nnews-react 0.4.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -184,7 +184,7 @@ ${oa(this.code(t,n))}
184
184
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[jh]=this[jh]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=$i(o);r[a]||(UP(i,o),r[a]=!0)}return P.isArray(t)?t.forEach(s):s(t),this}};wt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);P.reduceDescriptors(wt.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});P.freezeMethods(wt);function $l(e,t){const n=this||_s,r=t||n,i=wt.from(r.headers);let s=r.data;return P.forEach(e,function(a){s=a.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function Jb(e){return!!(e&&e.__CANCEL__)}function pi(e,t,n){he.call(this,e??"canceled",he.ERR_CANCELED,t,n),this.name="CanceledError"}P.inherits(pi,he,{__CANCEL__:!0});function ey(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new he("Request failed with status code "+n.status,[he.ERR_BAD_REQUEST,he.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function jP(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function qP(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),u=r[s];o||(o=c),n[i]=l,r[i]=c;let d=s,h=0;for(;d!==i;)h+=n[d++],d=d%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),c-o<t)return;const f=u&&c-u;return f?Math.round(h*1e3/f):void 0}}function zP(e,t){let n=0,r=1e3/t,i,s;const o=(c,u=Date.now())=>{n=u,i=null,s&&(clearTimeout(s),s=null),e(...c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=r?o(c,u):(i=c,s||(s=setTimeout(()=>{s=null,o(i)},r-d)))},()=>i&&o(i)]}const Do=(e,t,n=3)=>{let r=0;const i=qP(50,250);return zP(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,c=i(l),u=o<=a;r=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:s,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},n)},qh=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},zh=e=>(...t)=>P.asap(()=>e(...t)),HP=it.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,it.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(it.origin),it.navigator&&/(msie|trident)/i.test(it.navigator.userAgent)):()=>!0,GP=it.hasStandardBrowserEnv?{write(e,t,n,r,i,s,o){if(typeof document>"u")return;const a=[`${e}=${encodeURIComponent(t)}`];P.isNumber(n)&&a.push(`expires=${new Date(n).toUTCString()}`),P.isString(r)&&a.push(`path=${r}`),P.isString(i)&&a.push(`domain=${i}`),s===!0&&a.push("secure"),P.isString(o)&&a.push(`SameSite=${o}`),document.cookie=a.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function KP(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function WP(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ty(e,t,n){let r=!KP(t);return e&&(r||n==!1)?WP(e,t):t}const Hh=e=>e instanceof wt?{...e}:e;function hr(e,t){t=t||{};const n={};function r(c,u,d,h){return P.isPlainObject(c)&&P.isPlainObject(u)?P.merge.call({caseless:h},c,u):P.isPlainObject(u)?P.merge({},u):P.isArray(u)?u.slice():u}function i(c,u,d,h){if(P.isUndefined(u)){if(!P.isUndefined(c))return r(void 0,c,d,h)}else return r(c,u,d,h)}function s(c,u){if(!P.isUndefined(u))return r(void 0,u)}function o(c,u){if(P.isUndefined(u)){if(!P.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in t)return r(c,u);if(d in e)return r(void 0,c)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u,d)=>i(Hh(c),Hh(u),d,!0)};return P.forEach(Object.keys({...e,...t}),function(u){const d=l[u]||i,h=d(e[u],t[u],u);P.isUndefined(h)&&d!==a||(n[u]=h)}),n}const ny=e=>{const t=hr({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=t;if(t.headers=o=wt.from(o),t.url=Zb(ty(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),P.isFormData(n)){if(it.hasStandardBrowserEnv||it.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(P.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&o.set(u,d)})}}if(it.hasStandardBrowserEnv&&(r&&P.isFunction(r)&&(r=r(t)),r||r!==!1&&HP(t.url))){const l=i&&s&&GP.read(s);l&&o.set(i,l)}return t},VP=typeof XMLHttpRequest<"u",YP=VP&&function(e){return new Promise(function(n,r){const i=ny(e);let s=i.data;const o=wt.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,u,d,h,f,p;function g(){f&&f(),p&&p(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(i.method.toUpperCase(),i.url,!0),b.timeout=i.timeout;function y(){if(!b)return;const v=wt.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),C={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:v,config:e,request:b};ey(function(L){n(L),g()},function(L){r(L),g()},C),b=null}"onloadend"in b?b.onloadend=y:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(y)},b.onabort=function(){b&&(r(new he("Request aborted",he.ECONNABORTED,e,b)),b=null)},b.onerror=function(N){const C=N&&N.message?N.message:"Network Error",k=new he(C,he.ERR_NETWORK,e,b);k.event=N||null,r(k),b=null},b.ontimeout=function(){let N=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const C=i.transitional||Xb;i.timeoutErrorMessage&&(N=i.timeoutErrorMessage),r(new he(N,C.clarifyTimeoutError?he.ETIMEDOUT:he.ECONNABORTED,e,b)),b=null},s===void 0&&o.setContentType(null),"setRequestHeader"in b&&P.forEach(o.toJSON(),function(N,C){b.setRequestHeader(C,N)}),P.isUndefined(i.withCredentials)||(b.withCredentials=!!i.withCredentials),a&&a!=="json"&&(b.responseType=i.responseType),c&&([h,p]=Do(c,!0),b.addEventListener("progress",h)),l&&b.upload&&([d,f]=Do(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",f)),(i.cancelToken||i.signal)&&(u=v=>{b&&(r(!v||v.type?new pi(null,e,b):v),b.abort(),b=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));const E=jP(i.url);if(E&&it.protocols.indexOf(E)===-1){r(new he("Unsupported protocol "+E+":",he.ERR_BAD_REQUEST,e));return}b.send(s||null)})},ZP=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const s=function(c){if(!i){i=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof he?u:new pi(u instanceof Error?u.message:u))}};let o=t&&setTimeout(()=>{o=null,s(new he(`timeout ${t} of ms exceeded`,he.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),e=null)};e.forEach(c=>c.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>P.asap(a),l}},XP=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,i;for(;r<n;)i=r+t,yield e.slice(r,i),r=i},QP=async function*(e,t){for await(const n of JP(e))yield*XP(n,t)},JP=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Gh=(e,t,n,r)=>{const i=QP(e,t);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await i.next();if(c){a(),l.close();return}let d=u.byteLength;if(n){let h=s+=d;n(h)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},Kh=64*1024,{isFunction:no}=P,eD=(({Request:e,Response:t})=>({Request:e,Response:t}))(P.global),{ReadableStream:Wh,TextEncoder:Vh}=P.global,Yh=(e,...t)=>{try{return!!e(...t)}catch{return!1}},tD=e=>{e=P.merge.call({skipUndefined:!0},eD,e);const{fetch:t,Request:n,Response:r}=e,i=t?no(t):typeof fetch=="function",s=no(n),o=no(r);if(!i)return!1;const a=i&&no(Wh),l=i&&(typeof Vh=="function"?(p=>g=>p.encode(g))(new Vh):async p=>new Uint8Array(await new n(p).arrayBuffer())),c=s&&a&&Yh(()=>{let p=!1;const g=new n(it.origin,{body:new Wh,method:"POST",get duplex(){return p=!0,"half"}}).headers.has("Content-Type");return p&&!g}),u=o&&a&&Yh(()=>P.isReadableStream(new r("").body)),d={stream:u&&(p=>p.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(p=>{!d[p]&&(d[p]=(g,b)=>{let y=g&&g[p];if(y)return y.call(g);throw new he(`Response type '${p}' is not supported`,he.ERR_NOT_SUPPORT,b)})});const h=async p=>{if(p==null)return 0;if(P.isBlob(p))return p.size;if(P.isSpecCompliantForm(p))return(await new n(it.origin,{method:"POST",body:p}).arrayBuffer()).byteLength;if(P.isArrayBufferView(p)||P.isArrayBuffer(p))return p.byteLength;if(P.isURLSearchParams(p)&&(p=p+""),P.isString(p))return(await l(p)).byteLength},f=async(p,g)=>{const b=P.toFiniteNumber(p.getContentLength());return b??h(g)};return async p=>{let{url:g,method:b,data:y,signal:E,cancelToken:v,timeout:N,onDownloadProgress:C,onUploadProgress:k,responseType:L,headers:j,withCredentials:z="same-origin",fetchOptions:R}=ny(p),F=t||fetch;L=L?(L+"").toLowerCase():"text";let D=ZP([E,v&&v.toAbortSignal()],N),Y=null;const G=D&&D.unsubscribe&&(()=>{D.unsubscribe()});let Z;try{if(k&&c&&b!=="get"&&b!=="head"&&(Z=await f(j,y))!==0){let W=new n(g,{method:"POST",body:y,duplex:"half"}),re;if(P.isFormData(y)&&(re=W.headers.get("content-type"))&&j.setContentType(re),W.body){const[S,fe]=qh(Z,Do(zh(k)));y=Gh(W.body,Kh,S,fe)}}P.isString(z)||(z=z?"include":"omit");const I=s&&"credentials"in n.prototype,q={...R,signal:D,method:b.toUpperCase(),headers:j.normalize().toJSON(),body:y,duplex:"half",credentials:I?z:void 0};Y=s&&new n(g,q);let H=await(s?F(Y,R):F(g,q));const X=u&&(L==="stream"||L==="response");if(u&&(C||X&&G)){const W={};["status","statusText","headers"].forEach(se=>{W[se]=H[se]});const re=P.toFiniteNumber(H.headers.get("content-length")),[S,fe]=C&&qh(re,Do(zh(C),!0))||[];H=new r(Gh(H.body,Kh,S,()=>{fe&&fe(),G&&G()}),W)}L=L||"text";let _=await d[P.findKey(d,L)||"text"](H,p);return!X&&G&&G(),await new Promise((W,re)=>{ey(W,re,{data:_,headers:wt.from(H.headers),status:H.status,statusText:H.statusText,config:p,request:Y})})}catch(I){throw G&&G(),I&&I.name==="TypeError"&&/Load failed|fetch/i.test(I.message)?Object.assign(new he("Network Error",he.ERR_NETWORK,p,Y),{cause:I.cause||I}):he.from(I,I&&I.code,p,Y)}}},nD=new Map,ry=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,s=[r,i,n];let o=s.length,a=o,l,c,u=nD;for(;a--;)l=s[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:tD(t)),u=c;return c};ry();const zu={http:xP,xhr:YP,fetch:{get:ry}};P.forEach(zu,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Zh=e=>`- ${e}`,rD=e=>P.isFunction(e)||e===null||e===!1;function iD(e,t){e=P.isArray(e)?e:[e];const{length:n}=e;let r,i;const s={};for(let o=0;o<n;o++){r=e[o];let a;if(i=r,!rD(r)&&(i=zu[(a=String(r)).toLowerCase()],i===void 0))throw new he(`Unknown adapter '${a}'`);if(i&&(P.isFunction(i)||(i=i.get(t))))break;s[a||"#"+o]=i}if(!i){const o=Object.entries(s).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
185
185
  `+o.map(Zh).join(`
186
186
  `):" "+Zh(o[0]):"as no adapter specified";throw new he("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return i}const iy={getAdapter:iD,adapters:zu};function Ul(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pi(null,e)}function Xh(e){return Ul(e),e.headers=wt.from(e.headers),e.data=$l.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),iy.getAdapter(e.adapter||_s.adapter,e)(e).then(function(r){return Ul(e),r.data=$l.call(e,e.transformResponse,r),r.headers=wt.from(r.headers),r},function(r){return Jb(r)||(Ul(e),r&&r.response&&(r.response.data=$l.call(e,e.transformResponse,r.response),r.response.headers=wt.from(r.response.headers))),Promise.reject(r)})}const sy="1.13.2",pa={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{pa[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Qh={};pa.transitional=function(t,n,r){function i(s,o){return"[Axios v"+sy+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(t===!1)throw new he(i(o," has been removed"+(n?" in "+n:"")),he.ERR_DEPRECATED);return n&&!Qh[o]&&(Qh[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,a):!0}};pa.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function sD(e,t,n){if(typeof e!="object")throw new he("options must be an object",he.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const a=e[s],l=a===void 0||o(a,s,e);if(l!==!0)throw new he("option "+s+" must be "+l,he.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new he("Unknown option "+s,he.ERR_BAD_OPTION)}}const bo={assertOptions:sD,validators:pa},ln=bo.validators;let ar=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Uh,response:new Uh}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
187
- `+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=hr(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&bo.assertOptions(r,{silentJSONParsing:ln.transitional(ln.boolean),forcedJSONParsing:ln.transitional(ln.boolean),clarifyTimeoutError:ln.transitional(ln.boolean)},!1),i!=null&&(P.isFunction(i)?n.paramsSerializer={serialize:i}:bo.assertOptions(i,{encode:ln.function,serialize:ln.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),bo.assertOptions(n,{baseUrl:ln.spelling("baseURL"),withXsrfToken:ln.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&P.merge(s.common,s[n.method]);s&&P.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),n.headers=wt.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(l=l&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,h;if(!l){const p=[Xh.bind(this),void 0];for(p.unshift(...a),p.push(...c),h=p.length,u=Promise.resolve(n);d<h;)u=u.then(p[d++],p[d++]);return u}h=a.length;let f=n;for(;d<h;){const p=a[d++],g=a[d++];try{f=p(f)}catch(b){g.call(this,b);break}}try{u=Xh.call(this,f)}catch(p){return Promise.reject(p)}for(d=0,h=c.length;d<h;)u=u.then(c[d++],c[d++]);return u}getUri(t){t=hr(this.defaults,t);const n=ty(t.baseURL,t.url,t.allowAbsoluteUrls);return Zb(n,t.params,t.paramsSerializer)}};P.forEach(["delete","get","head","options"],function(t){ar.prototype[t]=function(n,r){return this.request(hr(r||{},{method:t,url:n,data:(r||{}).data}))}});P.forEach(["post","put","patch"],function(t){function n(r){return function(s,o,a){return this.request(hr(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ar.prototype[t]=n(),ar.prototype[t+"Form"]=n(!0)});let oD=class oy{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,a){r.reason||(r.reason=new pi(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new oy(function(i){t=i}),cancel:t}}};function aD(e){return function(n){return e.apply(null,n)}}function lD(e){return P.isObject(e)&&e.isAxiosError===!0}const qc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(qc).forEach(([e,t])=>{qc[t]=e});function ay(e){const t=new ar(e),n=Fb(ar.prototype.request,t);return P.extend(n,ar.prototype,t,{allOwnKeys:!0}),P.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return ay(hr(e,i))},n}const De=ay(_s);De.Axios=ar;De.CanceledError=pi;De.CancelToken=oD;De.isCancel=Jb;De.VERSION=sy;De.toFormData=ha;De.AxiosError=he;De.Cancel=De.CanceledError;De.all=function(t){return Promise.all(t)};De.spread=aD;De.isAxiosError=lD;De.mergeConfig=hr;De.AxiosHeaders=wt;De.formToJSON=e=>Qb(P.isHTMLForm(e)?new FormData(e):e);De.getAdapter=iy.getAdapter;De.HttpStatusCode=qc;De.default=De;const{Axios:iF,AxiosError:sF,CanceledError:oF,isCancel:aF,CancelToken:lF,VERSION:cF,all:uF,Cancel:dF,isAxiosError:fF,spread:hF,toFormData:pF,AxiosHeaders:gF,HttpStatusCode:mF,formToJSON:bF,getAdapter:yF,mergeConfig:xF}=De,Pe={ARTICLES:"/Article",LIST_BY_CATEGORY:"/Article/ListByCategory",LIST_BY_ROLES:"/Article/ListByRoles",LIST_BY_TAG:"/Article/ListByTag",SEARCH:"/Article/Search",ARTICLE_BY_ID:e=>`/Article/${e}`,IMAGE_UPLOAD:"/Image/uploadImage",INSERT_WITH_AI:"/Article/insertWithAI",UPDATE_WITH_AI:"/Article/updateWithAI"};class ly{constructor(t){this.client=t}async uploadImage(t){const n=new FormData;n.append("file",t),console.log("[ArticleAPI] uploadImage - Request:",{fileName:t.name,fileSize:t.size});const r=await this.client.post(Pe.IMAGE_UPLOAD,n,{headers:{"Content-Type":"multipart/form-data"}});return console.log("[ArticleAPI] uploadImage - Response:",r.data),r.data}async listArticles(t,n,r=1,i=10){const s={page:r,pageSize:i};t&&(s.categoryId=t),n!==void 0&&(s.status=n),console.log("[ArticleAPI] listArticles - Request:",{url:Pe.ARTICLES,params:s});const o=await this.client.get(Pe.ARTICLES,{params:s});return console.log("[ArticleAPI] listArticles - Response:",o.data),this.transformArticleDates(o.data)}async listByCategory(t,n=1,r=10){const i={categoryId:t,page:n,pageSize:r};console.log("[ArticleAPI] listByCategory - Request:",{url:Pe.LIST_BY_CATEGORY,params:i});const s=await this.client.get(Pe.LIST_BY_CATEGORY,{params:i});return console.log("[ArticleAPI] listByCategory - Response:",s.data),this.transformArticleDates(s.data)}async listByRoles(t=1,n=10){const r={page:t,pageSize:n};console.log("[ArticleAPI] listByRoles - Request:",{url:Pe.LIST_BY_ROLES,params:r});const i=await this.client.get(Pe.LIST_BY_ROLES,{params:r});return console.log("[ArticleAPI] listByRoles - Response:",i.data),this.transformArticleDates(i.data)}async listByTag(t,n=1,r=10){const i={tagSlug:t,page:n,pageSize:r};console.log("[ArticleAPI] listByTag - Request:",{url:Pe.LIST_BY_TAG,params:i});const s=await this.client.get(Pe.LIST_BY_TAG,{params:i});return console.log("[ArticleAPI] listByTag - Response:",s.data),this.transformArticleDates(s.data)}async search(t,n=1,r=10){const i={keyword:t,page:n,pageSize:r};console.log("[ArticleAPI] search - Request:",{url:Pe.SEARCH,params:i});const s=await this.client.get(Pe.SEARCH,{params:i});return console.log("[ArticleAPI] search - Response:",s.data),this.transformArticleDates(s.data)}async getArticleById(t){const n=await this.client.get(Pe.ARTICLE_BY_ID(t));return this.transformArticleDate(n.data)}async createArticle(t){console.log("[ArticleAPI] createArticle - Request:",{url:Pe.ARTICLES,data:t});const n=await this.client.post(Pe.ARTICLES,t);return console.log("[ArticleAPI] createArticle - Response:",n.data),this.transformArticleDate(n.data)}async updateArticle(t){console.log("[ArticleAPI] updateArticle - Request:",{url:Pe.ARTICLES,data:t});const n=await this.client.put(Pe.ARTICLES,t);return console.log("[ArticleAPI] updateArticle - Response:",n.data),this.transformArticleDate(n.data)}async deleteArticle(t){console.log("[ArticleAPI] deleteArticle - Request:",{id:t,url:Pe.ARTICLE_BY_ID(t)}),await this.client.delete(Pe.ARTICLE_BY_ID(t)),console.log("[ArticleAPI] deleteArticle - Success")}async createArticleWithAI(t){console.log("[ArticleAPI] createArticleWithAI - Request:",{url:Pe.INSERT_WITH_AI,data:t});const n=await this.client.post(Pe.INSERT_WITH_AI,t);return console.log("[ArticleAPI] createArticleWithAI - Response:",n.data),this.transformArticleDate(n.data)}async updateArticleWithAI(t){if(!t.articleId)throw new Error("articleId is required for updateWithAI");console.log("[ArticleAPI] updateArticleWithAI - Request:",{url:Pe.UPDATE_WITH_AI,data:t});const n=await this.client.put(Pe.UPDATE_WITH_AI,t);return console.log("[ArticleAPI] updateArticleWithAI - Response:",n.data),this.transformArticleDate(n.data)}transformArticleDate(t){return{...t,dateAt:t.dateAt?new Date(t.dateAt):void 0,createdAt:t.createdAt?new Date(t.createdAt):void 0,updatedAt:t.updatedAt?new Date(t.updatedAt):void 0,category:t.category?{...t.category,createdAt:t.category.createdAt?new Date(t.category.createdAt):void 0,updatedAt:t.category.updatedAt?new Date(t.category.updatedAt):void 0}:void 0}}transformArticleDates(t){return{...t,items:t.items.map(n=>this.transformArticleDate(n))}}}const Gt={CATEGORIES:"/Category",LIST_BY_PARENT:"/Category/listByParent",CATEGORY_BY_ID:e=>`/Category/${e}`};class cy{constructor(t){this.client=t}async listCategories(){console.log("[CategoryAPI] listCategories - Request:",{url:Gt.CATEGORIES});const t=await this.client.get(Gt.CATEGORIES);return console.log("[CategoryAPI] listCategories - Response:",t.data),this.transformCategoryDates(t.data)}async listByParent(t,n){const r={};t&&t.length>0&&(r.roles=t.join(",")),n!==void 0&&(r.parentId=n),console.log("[CategoryAPI] listByParent - Request:",{url:Gt.LIST_BY_PARENT,params:r});const i=await this.client.get(Gt.LIST_BY_PARENT,{params:r});return console.log("[CategoryAPI] listByParent - Response:",i.data),this.transformCategoryDates(i.data)}async getCategoryById(t){const n=await this.client.get(Gt.CATEGORY_BY_ID(t));return this.transformCategoryDate(n.data)}async createCategory(t){console.log("[CategoryAPI] createCategory - Request:",{url:Gt.CATEGORIES,data:t});const n=await this.client.post(Gt.CATEGORIES,t);return console.log("[CategoryAPI] createCategory - Response:",n.data),this.transformCategoryDate(n.data)}async updateCategory(t){console.log("[CategoryAPI] updateCategory - Request:",{url:Gt.CATEGORIES,data:t});const n=await this.client.put(Gt.CATEGORIES,t);return console.log("[CategoryAPI] updateCategory - Response:",n.data),this.transformCategoryDate(n.data)}async deleteCategory(t){console.log("[CategoryAPI] deleteCategory - Request:",{id:t,url:Gt.CATEGORY_BY_ID(t)}),await this.client.delete(Gt.CATEGORY_BY_ID(t)),console.log("[CategoryAPI] deleteCategory - Success")}transformCategoryDate(t){return{...t,createdAt:t.createdAt?new Date(t.createdAt):void 0,updatedAt:t.updatedAt?new Date(t.updatedAt):void 0}}transformCategoryDates(t){return t.map(n=>this.transformCategoryDate(n))}}const kt={TAGS:"/Tag",LIST_BY_ROLES:"/Tag/ListByRoles",TAG_BY_ID:e=>`/Tag/${e}`,TAG_MERGE:(e,t)=>`/Tag/merge/${e}/${t}`};class uy{constructor(t){this.client=t}async listTags(){console.log("[TagAPI] listTags - Request:",{url:kt.TAGS});const t=await this.client.get(kt.TAGS);return console.log("[TagAPI] listTags - Response:",t.data),t.data}async listByRoles(){console.log("[TagAPI] listByRoles - Request:",{url:kt.LIST_BY_ROLES});const t=await this.client.get(kt.LIST_BY_ROLES);return console.log("[TagAPI] listByRoles - Response:",t.data),t.data}async getTagById(t){console.log("[TagAPI] getTagById - Request:",{id:t,url:kt.TAG_BY_ID(t)});const n=await this.client.get(kt.TAG_BY_ID(t));return console.log("[TagAPI] getTagById - Response:",n.data),n.data}async createTag(t){console.log("[TagAPI] createTag - Request:",{url:kt.TAGS,data:t});const n=await this.client.post(kt.TAGS,t);return console.log("[TagAPI] createTag - Response:",n.data),n.data}async updateTag(t){console.log("[TagAPI] updateTag - Request:",{url:kt.TAGS,data:t});const n=await this.client.put(kt.TAGS,t);return console.log("[TagAPI] updateTag - Response:",n.data),n.data}async deleteTag(t){console.log("[TagAPI] deleteTag - Request:",{id:t,url:kt.TAG_BY_ID(t)}),await this.client.delete(kt.TAG_BY_ID(t)),console.log("[TagAPI] deleteTag - Success")}async mergeTags(t,n){const r=kt.TAG_MERGE(t,n);console.log("[TagAPI] mergeTags - Request:",{url:r,sourceTagId:t,targetTagId:n}),await this.client.post(r),console.log("[TagAPI] mergeTags - Success")}}const dy=$.createContext(void 0);function cD(){const[e,t]=$.useState(()=>typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return $.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia("(prefers-color-scheme: dark)"),r=i=>t(i.matches?"dark":"light");return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}function uD(e,t){return e==="dark"?"dark":e==="light"?"light":t}function dD({config:e,children:t}){var u;const n=e.theme||{},r=cD(),i=uD(n.mode,r),s=$.useMemo(()=>Ap(e.language,e.translations),[e.language,e.translations]),o=$.useRef(e.language);$.useEffect(()=>{e.language&&e.language!==o.current&&(s.changeLanguage(e.language),o.current=e.language)},[e.language,s]);const a=$.useRef(e);$.useEffect(()=>{var d;a.current=e,console.log("[NNews] Config updated:",{apiUrl:e.apiUrl,hasAuthHeader:!!((d=e.headers)!=null&&d.Authorization)})},[e]);const l=$.useMemo(()=>{const d=e.apiClient||De.create({baseURL:e.apiUrl,headers:{"Content-Type":"application/json"}});d.interceptors.request.use(g=>{var y,E,v,N;const b=a.current;return b.headers&&Object.entries(b.headers).forEach(([C,k])=>{k&&g.headers.set(C,k)}),b.tenantId&&g.headers.set("X-Tenant-Id",b.tenantId),console.log("[NNews] Request interceptor:",{method:(y=g.method)==null?void 0:y.toUpperCase(),url:`${g.baseURL||""}${g.url||""}`,headers:{Authorization:((E=g.headers)==null?void 0:E.Authorization)||"(not set)","Content-Type":((v=g.headers)==null?void 0:v["Content-Type"])||"(not set)","X-Tenant-Id":((N=g.headers)==null?void 0:N["X-Tenant-Id"])||"(not set)"}}),g});const h=new ly(d),f=new cy(d),p=new uy(d);return{config:e,apiClient:d,articleApi:h,categoryApi:f,tagApi:p,theme:n,resolvedMode:i}},[e.apiUrl,e.apiClient,e.tenantId,n,i]),c=["nnews-root",i==="dark"?"dark":"",((u=n.classNames)==null?void 0:u.root)||""].filter(Boolean).join(" ");return x.jsx(dx,{i18n:s,children:x.jsx(dy.Provider,{value:l,children:x.jsx("div",{className:c,children:t})})})}function gi(){const e=$.useContext(dy);if(!e)throw new Error("useNNews must be used within a NNewsProvider");return e}function fD({article:e,categories:t=[],availableRoles:n,onFetchRoles:r,onSave:i,onCancel:s,loading:o=!1}){const{articleApi:a}=gi(),{t:l}=Ft(),[c,u]=$.useState(""),[d,h]=$.useState(""),[f,p]=$.useState(""),[g,b]=$.useState(""),[y,E]=$.useState(!1),[v,N]=$.useState(ze.Draft),[C,k]=$.useState(Wt.Html),[L,j]=$.useState(null),[z,R]=$.useState(""),[F,D]=$.useState(""),[Y,G]=$.useState(!0),[Z,I]=$.useState(new Set),[q,H]=$.useState([]),[X,_]=$.useState(!1),[W,re]=$.useState({});$.useEffect(()=>{var te;e&&(u(e.title),h(e.content),p(e.imageName||""),console.log("imageName:",e.imageName),e.imageName&&b(e.imageName),N(e.status),k(e.contentType||Wt.Html),j(e.categoryId||null),R(e.dateAt?new Date(e.dateAt).toISOString().slice(0,16):""),D(((te=e.tags)==null?void 0:te.map(Ee=>Ee.title).join(", "))||""),e.roles&&e.roles.length>0?(G(!1),I(new Set(e.roles.map(Ee=>Ee.slug)))):(G(!0),I(new Set)))},[e]);const S=n||q;$.useEffect(()=>{if(n&&n.length>0||!r)return;let te=!1;return _(!0),r().then(Ee=>{te||H(Ee)}).catch(Ee=>{console.warn("Failed to fetch roles:",Ee)}).finally(()=>{te||_(!1)}),()=>{te=!0}},[n,r]);const fe=$.useCallback(te=>{G(te),te&&I(new Set)},[]),se=$.useCallback(te=>{I(Ee=>{const Me=new Set(Ee);return Me.has(te)?Me.delete(te):Me.add(te),Me})},[]),_e=()=>{const te={};return c.trim()||(te.title=l("validation.titleRequired")),d.trim()||(te.content=l("validation.contentRequired")),re(te),Object.keys(te).length===0},Ye=async te=>{if(te.preventDefault(),!_e())return;const Ee=Y?[]:Array.from(Z),Me={title:c.trim(),content:d.trim(),imageName:f||void 0,status:v,contentType:C,categoryId:L||void 0,dateAt:z||void 0,tagList:F.trim()||void 0,roles:Ee.length>0?Ee:void 0};e?await i({articleId:e.articleId,...Me}):await i(Me)},Se=async te=>{var Ze;const Ee=(Ze=te.target.files)==null?void 0:Ze[0];if(!Ee)return;if(!Ee.type.startsWith("image/")){re({...W,image:l("validation.imageFileType")});return}if(Ee.size>5*1024*1024){re({...W,image:l("validation.imageSizeLimit")});return}re({...W,image:""});const Me=new FileReader;Me.onloadend=()=>{b(Me.result)},Me.readAsDataURL(Ee);try{E(!0);const Xe=await a.uploadImage(Ee);p(Xe),re({...W,image:""})}catch(Xe){console.error("Error uploading image:",Xe),re({...W,image:l("validation.imageUploadFailed")})}finally{E(!1)}},He=()=>{b(""),p("")};return x.jsxs("form",{onSubmit:Ye,className:"space-y-6",children:[x.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[x.jsxs("div",{className:"col-span-2 p-4",children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"title",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("common.titleRequired")}),x.jsx("input",{id:"title",type:"text",value:c,onChange:te=>u(te.target.value),className:`w-full rounded-md border ${W.title?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500`,placeholder:l("articleEditor.enterTitle")}),W.title&&x.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.title})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"dateAt",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.publicationDate")}),x.jsx("input",{id:"dateAt",type:"datetime-local",value:z,onChange:te=>R(te.target.value),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"category",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.category")}),x.jsxs("select",{id:"category",value:L||"",onChange:te=>j(te.target.value?Number(te.target.value):null),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[x.jsx("option",{value:"",children:l("common.noCategory")}),t.map(te=>x.jsx("option",{value:te.categoryId,children:te.title},te.categoryId))]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"status",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.status")}),x.jsxs("select",{id:"status",value:v,onChange:te=>N(Number(te.target.value)),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[x.jsx("option",{value:ze.Draft,children:l("articleEditor.statusDraft")}),x.jsx("option",{value:ze.Published,children:l("articleEditor.statusPublished")}),x.jsx("option",{value:ze.Archived,children:l("articleEditor.statusArchived")}),x.jsx("option",{value:ze.Scheduled,children:l("articleEditor.statusScheduled")}),x.jsx("option",{value:ze.Review,children:l("articleEditor.statusReview")})]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"contentType",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.contentType")}),x.jsxs("select",{id:"contentType",value:C,onChange:te=>k(Number(te.target.value)),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[x.jsx("option",{value:Wt.PlainText,children:l("articleEditor.contentTypePlainText")}),x.jsx("option",{value:Wt.Html,children:l("articleEditor.contentTypeHtml")}),x.jsx("option",{value:Wt.MarkDown,children:l("articleEditor.contentTypeMarkDown")})]})]})]}),x.jsx("div",{className:"col-span-1",children:x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"image",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.featuredImage")}),x.jsxs("div",{className:"relative",children:[g?x.jsx("img",{src:g,alt:"Preview",className:"w-full h-[250px] object-cover rounded-md border border-gray-300 dark:border-gray-600"}):x.jsx("div",{className:"w-full h-[250px] rounded-md border border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-gray-700 flex items-center justify-center",children:x.jsx("svg",{className:"w-16 h-16 text-gray-300 dark:text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:x.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),g&&x.jsx("button",{type:"button",onClick:He,className:"absolute top-2 right-2 rounded-full bg-red-600 p-2 text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",disabled:y,children:x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:x.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})}),y&&x.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 rounded-md",children:x.jsx("span",{className:"text-white text-sm",children:l("articleEditor.uploading")})})]}),x.jsx("label",{htmlFor:"image",className:"block",children:x.jsx("input",{id:"image",type:"file",accept:"image/*",onChange:Se,disabled:y,className:"block w-full text-sm text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md cursor-pointer bg-white dark:bg-gray-900 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 mt-2"})}),W.image&&x.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.image}),x.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.imageHint")})]})})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.contentLabel")}),C===Wt.Html?x.jsx(Db,{value:d,onChange:h,placeholder:l("articleEditor.contentPlaceholder"),error:W.content}):C===Wt.MarkDown?x.jsx(Bb,{value:d,onChange:h,placeholder:l("articleEditor.contentPlaceholder")}):x.jsx("textarea",{value:d,onChange:te=>h(te.target.value),placeholder:l("articleEditor.contentPlaceholder"),rows:15,className:`w-full rounded-md border ${W.content?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 font-mono`}),W.content&&x.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.content})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"tags",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.tags")}),x.jsx("input",{id:"tags",type:"text",value:F,onChange:te=>D(te.target.value),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:l("articleEditor.tagsPlaceholder")}),x.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.tagsHint")})]}),x.jsxs("div",{className:"space-y-3",children:[x.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.visibility")}),x.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[x.jsx("input",{type:"checkbox",checked:Y,onChange:te=>fe(te.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),x.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:l("articleEditor.visibleToAll")})]}),!Y&&x.jsx("div",{className:"ml-6 space-y-2",children:X?x.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("articleEditor.loadingRoles")}):S.length>0?x.jsxs("div",{className:"space-y-2",children:[x.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.selectRolesHint")}),S.map(te=>x.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[x.jsx("input",{type:"checkbox",checked:Z.has(te.slug),onChange:()=>se(te.slug),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),x.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:te.name})]},te.slug))]}):x.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("articleEditor.noRolesAvailable")})})]}),x.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[x.jsx("button",{type:"button",onClick:s,disabled:o,className:"rounded-md border border-gray-300 dark:border-gray-600 px-6 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50",children:l("common.cancel")}),x.jsx("button",{type:"submit",disabled:o,className:"rounded-md bg-blue-600 px-6 py-2 text-white hover:bg-blue-700 disabled:opacity-50",children:l(o?"common.saving":e?"articleEditor.updateArticle":"articleEditor.createArticle")})]})]})}function Gn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Jh(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mi(...e){return t=>{let n=!1;const r=e.map(i=>{const s=Jh(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():Jh(e[i],null)}}}}function kr(...e){return A.useCallback(mi(...e),e)}function hD(e,t){const n=A.createContext(t),r=s=>{const{children:o,...a}=s,l=A.useMemo(()=>a,Object.values(a));return x.jsx(n.Provider,{value:l,children:o})};r.displayName=e+"Provider";function i(s){const o=A.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,i]}function pD(e,t=[]){let n=[];function r(s,o){const a=A.createContext(o),l=n.length;n=[...n,o];const c=d=>{var y;const{scope:h,children:f,...p}=d,g=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,b=A.useMemo(()=>p,Object.values(p));return x.jsx(g.Provider,{value:b,children:f})};c.displayName=s+"Provider";function u(d,h){var g;const f=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,p=A.useContext(f);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=n.map(o=>A.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return A.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,gD(i,...t)]}function gD(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return A.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Wn=globalThis!=null&&globalThis.document?A.useLayoutEffect:()=>{},mD=A[" useId ".trim().toString()]||(()=>{}),bD=0;function jl(e){const[t,n]=A.useState(mD());return Wn(()=>{n(r=>r??String(bD++))},[e]),e||(t?`radix-${t}`:"")}var yD=A[" useInsertionEffect ".trim().toString()]||Wn;function xD({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,o]=ED({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=A.useRef(e!==void 0);A.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=A.useCallback(u=>{var d;if(a){const h=wD(u)?u(e):u;h!==e&&((d=o.current)==null||d.call(o,h))}else s(u)},[a,e,s,o]);return[l,c]}function ED({defaultProp:e,onChange:t}){const[n,r]=A.useState(e),i=A.useRef(n),s=A.useRef(t);return yD(()=>{s.current=t},[t]),A.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function wD(e){return typeof e=="function"}function vD(e){const t=_D(e),n=A.forwardRef((r,i)=>{const{children:s,...o}=r,a=A.Children.toArray(s),l=a.find(SD);if(l){const c=l.props.children,u=a.map(d=>d===l?A.Children.count(c)>1?A.Children.only(null):A.isValidElement(c)?c.props.children:null:d);return x.jsx(t,{...o,ref:i,children:A.isValidElement(c)?A.cloneElement(c,void 0,u):null})}return x.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function _D(e){const t=A.forwardRef((n,r)=>{const{children:i,...s}=n;if(A.isValidElement(i)){const o=AD(i),a=ND(s,i.props);return i.type!==A.Fragment&&(a.ref=r?mi(r,o):o),A.cloneElement(i,a)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kD=Symbol("radix.slottable");function SD(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kD}function ND(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function AD(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var TD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fy=TD.reduce((e,t)=>{const n=vD(`Primitive.${t}`),r=A.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function CD(e,t){e&&S0.flushSync(()=>e.dispatchEvent(t))}function ci(e){const t=A.useRef(e);return A.useEffect(()=>{t.current=e}),A.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function OD(e,t=globalThis==null?void 0:globalThis.document){const n=ci(e);A.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var RD="DismissableLayer",zc="dismissableLayer.update",ID="dismissableLayer.pointerDownOutside",LD="dismissableLayer.focusOutside",ep,hy=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),py=A.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,c=A.useContext(hy),[u,d]=A.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=A.useState({}),p=kr(t,L=>d(L)),g=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(b),E=u?g.indexOf(u):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,N=E>=y,C=DD(L=>{const j=L.target,z=[...c.branches].some(R=>R.contains(j));!N||z||(i==null||i(L),o==null||o(L),L.defaultPrevented||a==null||a())},h),k=BD(L=>{const j=L.target;[...c.branches].some(R=>R.contains(j))||(s==null||s(L),o==null||o(L),L.defaultPrevented||a==null||a())},h);return OD(L=>{E===c.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&a&&(L.preventDefault(),a()))},h),A.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(ep=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),tp(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=ep)}},[u,h,n,c]),A.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),tp())},[u,c]),A.useEffect(()=>{const L=()=>f({});return document.addEventListener(zc,L),()=>document.removeEventListener(zc,L)},[]),x.jsx(fy.div,{...l,ref:p,style:{pointerEvents:v?N?"auto":"none":void 0,...e.style},onFocusCapture:Gn(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Gn(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Gn(e.onPointerDownCapture,C.onPointerDownCapture)})});py.displayName=RD;var MD="DismissableLayerBranch",PD=A.forwardRef((e,t)=>{const n=A.useContext(hy),r=A.useRef(null),i=kr(t,r);return A.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),x.jsx(fy.div,{...e,ref:i})});PD.displayName=MD;function DD(e,t=globalThis==null?void 0:globalThis.document){const n=ci(e),r=A.useRef(!1),i=A.useRef(()=>{});return A.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){gy(ID,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function BD(e,t=globalThis==null?void 0:globalThis.document){const n=ci(e),r=A.useRef(!1);return A.useEffect(()=>{const i=s=>{s.target&&!r.current&&gy(LD,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tp(){const e=new CustomEvent(zc);document.dispatchEvent(e)}function gy(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?CD(i,s):i.dispatchEvent(s)}function FD(e){const t=$D(e),n=A.forwardRef((r,i)=>{const{children:s,...o}=r,a=A.Children.toArray(s),l=a.find(jD);if(l){const c=l.props.children,u=a.map(d=>d===l?A.Children.count(c)>1?A.Children.only(null):A.isValidElement(c)?c.props.children:null:d);return x.jsx(t,{...o,ref:i,children:A.isValidElement(c)?A.cloneElement(c,void 0,u):null})}return x.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function $D(e){const t=A.forwardRef((n,r)=>{const{children:i,...s}=n;if(A.isValidElement(i)){const o=zD(i),a=qD(s,i.props);return i.type!==A.Fragment&&(a.ref=r?mi(r,o):o),A.cloneElement(i,a)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UD=Symbol("radix.slottable");function jD(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===UD}function qD(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function zD(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var HD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],GD=HD.reduce((e,t)=>{const n=FD(`Primitive.${t}`),r=A.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ql="focusScope.autoFocusOnMount",zl="focusScope.autoFocusOnUnmount",np={bubbles:!1,cancelable:!0},KD="FocusScope",my=A.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=A.useState(null),c=ci(i),u=ci(s),d=A.useRef(null),h=kr(t,g=>l(g)),f=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(r){let g=function(v){if(f.paused||!a)return;const N=v.target;a.contains(N)?d.current=N:$n(d.current,{select:!0})},b=function(v){if(f.paused||!a)return;const N=v.relatedTarget;N!==null&&(a.contains(N)||$n(d.current,{select:!0}))},y=function(v){if(document.activeElement===document.body)for(const C of v)C.removedNodes.length>0&&$n(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",b);const E=new MutationObserver(y);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",b),E.disconnect()}}},[r,a,f.paused]),A.useEffect(()=>{if(a){ip.add(f);const g=document.activeElement;if(!a.contains(g)){const y=new CustomEvent(ql,np);a.addEventListener(ql,c),a.dispatchEvent(y),y.defaultPrevented||(WD(QD(by(a)),{select:!0}),document.activeElement===g&&$n(a))}return()=>{a.removeEventListener(ql,c),setTimeout(()=>{const y=new CustomEvent(zl,np);a.addEventListener(zl,u),a.dispatchEvent(y),y.defaultPrevented||$n(g??document.body,{select:!0}),a.removeEventListener(zl,u),ip.remove(f)},0)}}},[a,c,u,f]);const p=A.useCallback(g=>{if(!n&&!r||f.paused)return;const b=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(b&&y){const E=g.currentTarget,[v,N]=VD(E);v&&N?!g.shiftKey&&y===N?(g.preventDefault(),n&&$n(v,{select:!0})):g.shiftKey&&y===v&&(g.preventDefault(),n&&$n(N,{select:!0})):y===E&&g.preventDefault()}},[n,r,f.paused]);return x.jsx(GD.div,{tabIndex:-1,...o,ref:h,onKeyDown:p})});my.displayName=KD;function WD(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if($n(r,{select:t}),document.activeElement!==n)return}function VD(e){const t=by(e),n=rp(t,e),r=rp(t.reverse(),e);return[n,r]}function by(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function rp(e,t){for(const n of e)if(!YD(n,{upTo:t}))return n}function YD(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ZD(e){return e instanceof HTMLInputElement&&"select"in e}function $n(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ZD(e)&&t&&e.select()}}var ip=XD();function XD(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=sp(e,t),e.unshift(t)},remove(t){var n;e=sp(e,t),(n=e[0])==null||n.resume()}}}function sp(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function QD(e){return e.filter(t=>t.tagName!=="A")}function JD(e){const t=eB(e),n=A.forwardRef((r,i)=>{const{children:s,...o}=r,a=A.Children.toArray(s),l=a.find(nB);if(l){const c=l.props.children,u=a.map(d=>d===l?A.Children.count(c)>1?A.Children.only(null):A.isValidElement(c)?c.props.children:null:d);return x.jsx(t,{...o,ref:i,children:A.isValidElement(c)?A.cloneElement(c,void 0,u):null})}return x.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function eB(e){const t=A.forwardRef((n,r)=>{const{children:i,...s}=n;if(A.isValidElement(i)){const o=iB(i),a=rB(s,i.props);return i.type!==A.Fragment&&(a.ref=r?mi(r,o):o),A.cloneElement(i,a)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tB=Symbol("radix.slottable");function nB(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tB}function rB(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function iB(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var sB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oB=sB.reduce((e,t)=>{const n=JD(`Primitive.${t}`),r=A.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),aB="Portal",yy=A.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,s]=A.useState(!1);Wn(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?bp.createPortal(x.jsx(oB.div,{...r,ref:t}),o):null});yy.displayName=aB;function lB(e,t){return A.useReducer((n,r)=>t[n][r]??n,e)}var ga=e=>{const{present:t,children:n}=e,r=cB(t),i=typeof n=="function"?n({present:r.isPresent}):A.Children.only(n),s=kr(r.ref,uB(i));return typeof n=="function"||r.isPresent?A.cloneElement(i,{ref:s}):null};ga.displayName="Presence";function cB(e){const[t,n]=A.useState(),r=A.useRef(null),i=A.useRef(e),s=A.useRef("none"),o=e?"mounted":"unmounted",[a,l]=lB(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const c=ro(r.current);s.current=a==="mounted"?c:"none"},[a]),Wn(()=>{const c=r.current,u=i.current;if(u!==e){const h=s.current,f=ro(c);e?l("MOUNT"):f==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Wn(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=f=>{const g=ro(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&g&&(l("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=f=>{f.target===t&&(s.current=ro(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:A.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function ro(e){return(e==null?void 0:e.animationName)||"none"}function uB(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function xy(e){const t=dB(e),n=A.forwardRef((r,i)=>{const{children:s,...o}=r,a=A.Children.toArray(s),l=a.find(hB);if(l){const c=l.props.children,u=a.map(d=>d===l?A.Children.count(c)>1?A.Children.only(null):A.isValidElement(c)?c.props.children:null:d);return x.jsx(t,{...o,ref:i,children:A.isValidElement(c)?A.cloneElement(c,void 0,u):null})}return x.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function dB(e){const t=A.forwardRef((n,r)=>{const{children:i,...s}=n;if(A.isValidElement(i)){const o=gB(i),a=pB(s,i.props);return i.type!==A.Fragment&&(a.ref=r?mi(r,o):o),A.cloneElement(i,a)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fB=Symbol("radix.slottable");function hB(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fB}function pB(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function gB(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ks=mB.reduce((e,t)=>{const n=xy(`Primitive.${t}`),r=A.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Hl=0;function bB(){A.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??op()),document.body.insertAdjacentElement("beforeend",e[1]??op()),Hl++,()=>{Hl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Hl--}},[])}function op(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var fn=function(){return fn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},fn.apply(this,arguments)};function Ey(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function yB(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var yo="right-scroll-bar-position",xo="width-before-scroll-bar",xB="with-scroll-bars-hidden",EB="--removed-body-scroll-bar-size";function Gl(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function wB(e,t){var n=$.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var vB=typeof window<"u"?A.useLayoutEffect:A.useEffect,ap=new WeakMap;function _B(e,t){var n=wB(null,function(r){return e.forEach(function(i){return Gl(i,r)})});return vB(function(){var r=ap.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Gl(a,null)}),s.forEach(function(a){i.has(a)||Gl(a,o)})}ap.set(n,e)},[e]),n}function kB(e){return e}function SB(e,t){t===void 0&&(t=kB);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var o=t(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return i}function NB(e){e===void 0&&(e={});var t=SB(null);return t.options=fn({async:!0,ssr:!1},e),t}var wy=function(e){var t=e.sideCar,n=Ey(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return A.createElement(r,fn({},n))};wy.isSideCarExport=!0;function AB(e,t){return e.useMedium(t),wy}var vy=NB(),Kl=function(){},ma=A.forwardRef(function(e,t){var n=A.useRef(null),r=A.useState({onScrollCapture:Kl,onWheelCapture:Kl,onTouchMoveCapture:Kl}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,h=e.sideCar,f=e.noRelative,p=e.noIsolation,g=e.inert,b=e.allowPinchZoom,y=e.as,E=y===void 0?"div":y,v=e.gapMode,N=Ey(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,k=_B([n,t]),L=fn(fn({},N),i);return A.createElement(A.Fragment,null,u&&A.createElement(C,{sideCar:vy,removeScrollBar:c,shards:d,noRelative:f,noIsolation:p,inert:g,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:v}),o?A.cloneElement(A.Children.only(a),fn(fn({},L),{ref:k})):A.createElement(E,fn({},L,{className:l,ref:k}),a))});ma.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ma.classNames={fullWidth:xo,zeroRight:yo};var TB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function CB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=TB();return t&&e.setAttribute("nonce",t),e}function OB(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function RB(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var IB=function(){var e=0,t=null;return{add:function(n){e==0&&(t=CB())&&(OB(t,n),RB(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},LB=function(){var e=IB();return function(t,n){A.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_y=function(){var e=LB(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},MB={left:0,top:0,right:0,gap:0},Wl=function(e){return parseInt(e||"",10)||0},PB=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Wl(n),Wl(r),Wl(i)]},DB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return MB;var t=PB(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},BB=_y(),Jr="data-scroll-locked",FB=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
187
+ `+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=hr(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&bo.assertOptions(r,{silentJSONParsing:ln.transitional(ln.boolean),forcedJSONParsing:ln.transitional(ln.boolean),clarifyTimeoutError:ln.transitional(ln.boolean)},!1),i!=null&&(P.isFunction(i)?n.paramsSerializer={serialize:i}:bo.assertOptions(i,{encode:ln.function,serialize:ln.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),bo.assertOptions(n,{baseUrl:ln.spelling("baseURL"),withXsrfToken:ln.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&P.merge(s.common,s[n.method]);s&&P.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),n.headers=wt.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(l=l&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,h;if(!l){const p=[Xh.bind(this),void 0];for(p.unshift(...a),p.push(...c),h=p.length,u=Promise.resolve(n);d<h;)u=u.then(p[d++],p[d++]);return u}h=a.length;let f=n;for(;d<h;){const p=a[d++],g=a[d++];try{f=p(f)}catch(b){g.call(this,b);break}}try{u=Xh.call(this,f)}catch(p){return Promise.reject(p)}for(d=0,h=c.length;d<h;)u=u.then(c[d++],c[d++]);return u}getUri(t){t=hr(this.defaults,t);const n=ty(t.baseURL,t.url,t.allowAbsoluteUrls);return Zb(n,t.params,t.paramsSerializer)}};P.forEach(["delete","get","head","options"],function(t){ar.prototype[t]=function(n,r){return this.request(hr(r||{},{method:t,url:n,data:(r||{}).data}))}});P.forEach(["post","put","patch"],function(t){function n(r){return function(s,o,a){return this.request(hr(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}ar.prototype[t]=n(),ar.prototype[t+"Form"]=n(!0)});let oD=class oy{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,a){r.reason||(r.reason=new pi(s,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new oy(function(i){t=i}),cancel:t}}};function aD(e){return function(n){return e.apply(null,n)}}function lD(e){return P.isObject(e)&&e.isAxiosError===!0}const qc={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(qc).forEach(([e,t])=>{qc[t]=e});function ay(e){const t=new ar(e),n=Fb(ar.prototype.request,t);return P.extend(n,ar.prototype,t,{allOwnKeys:!0}),P.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return ay(hr(e,i))},n}const De=ay(_s);De.Axios=ar;De.CanceledError=pi;De.CancelToken=oD;De.isCancel=Jb;De.VERSION=sy;De.toFormData=ha;De.AxiosError=he;De.Cancel=De.CanceledError;De.all=function(t){return Promise.all(t)};De.spread=aD;De.isAxiosError=lD;De.mergeConfig=hr;De.AxiosHeaders=wt;De.formToJSON=e=>Qb(P.isHTMLForm(e)?new FormData(e):e);De.getAdapter=iy.getAdapter;De.HttpStatusCode=qc;De.default=De;const{Axios:iF,AxiosError:sF,CanceledError:oF,isCancel:aF,CancelToken:lF,VERSION:cF,all:uF,Cancel:dF,isAxiosError:fF,spread:hF,toFormData:pF,AxiosHeaders:gF,HttpStatusCode:mF,formToJSON:bF,getAdapter:yF,mergeConfig:xF}=De,Pe={ARTICLES:"/Article",LIST_BY_CATEGORY:"/Article/ListByCategory",LIST_BY_ROLES:"/Article/ListByRoles",LIST_BY_TAG:"/Article/ListByTag",SEARCH:"/Article/Search",ARTICLE_BY_ID:e=>`/Article/${e}`,IMAGE_UPLOAD:"/Image/uploadImage",INSERT_WITH_AI:"/Article/insertWithAI",UPDATE_WITH_AI:"/Article/updateWithAI"};class ly{constructor(t){this.client=t}async uploadImage(t){const n=new FormData;n.append("file",t),console.log("[ArticleAPI] uploadImage - Request:",{fileName:t.name,fileSize:t.size});const r=await this.client.post(Pe.IMAGE_UPLOAD,n,{headers:{"Content-Type":"multipart/form-data"}});return console.log("[ArticleAPI] uploadImage - Response:",r.data),r.data}async listArticles(t,n,r=1,i=10){const s={page:r,pageSize:i};t&&(s.categoryId=t),n!==void 0&&(s.status=n),console.log("[ArticleAPI] listArticles - Request:",{url:Pe.ARTICLES,params:s});const o=await this.client.get(Pe.ARTICLES,{params:s});return console.log("[ArticleAPI] listArticles - Response:",o.data),this.transformArticleDates(o.data)}async listByCategory(t,n=1,r=10){const i={categoryId:t,page:n,pageSize:r};console.log("[ArticleAPI] listByCategory - Request:",{url:Pe.LIST_BY_CATEGORY,params:i});const s=await this.client.get(Pe.LIST_BY_CATEGORY,{params:i});return console.log("[ArticleAPI] listByCategory - Response:",s.data),this.transformArticleDates(s.data)}async listByRoles(t=1,n=10){const r={page:t,pageSize:n};console.log("[ArticleAPI] listByRoles - Request:",{url:Pe.LIST_BY_ROLES,params:r});const i=await this.client.get(Pe.LIST_BY_ROLES,{params:r});return console.log("[ArticleAPI] listByRoles - Response:",i.data),this.transformArticleDates(i.data)}async listByTag(t,n=1,r=10){const i={tagSlug:t,page:n,pageSize:r};console.log("[ArticleAPI] listByTag - Request:",{url:Pe.LIST_BY_TAG,params:i});const s=await this.client.get(Pe.LIST_BY_TAG,{params:i});return console.log("[ArticleAPI] listByTag - Response:",s.data),this.transformArticleDates(s.data)}async search(t,n=1,r=10){const i={keyword:t,page:n,pageSize:r};console.log("[ArticleAPI] search - Request:",{url:Pe.SEARCH,params:i});const s=await this.client.get(Pe.SEARCH,{params:i});return console.log("[ArticleAPI] search - Response:",s.data),this.transformArticleDates(s.data)}async getArticleById(t){const n=await this.client.get(Pe.ARTICLE_BY_ID(t));return this.transformArticleDate(n.data)}async createArticle(t){console.log("[ArticleAPI] createArticle - Request:",{url:Pe.ARTICLES,data:t});const n=await this.client.post(Pe.ARTICLES,t);return console.log("[ArticleAPI] createArticle - Response:",n.data),this.transformArticleDate(n.data)}async updateArticle(t){console.log("[ArticleAPI] updateArticle - Request:",{url:Pe.ARTICLES,data:t});const n=await this.client.put(Pe.ARTICLES,t);return console.log("[ArticleAPI] updateArticle - Response:",n.data),this.transformArticleDate(n.data)}async deleteArticle(t){console.log("[ArticleAPI] deleteArticle - Request:",{id:t,url:Pe.ARTICLE_BY_ID(t)}),await this.client.delete(Pe.ARTICLE_BY_ID(t)),console.log("[ArticleAPI] deleteArticle - Success")}async createArticleWithAI(t){console.log("[ArticleAPI] createArticleWithAI - Request:",{url:Pe.INSERT_WITH_AI,data:t});const n=await this.client.post(Pe.INSERT_WITH_AI,t);return console.log("[ArticleAPI] createArticleWithAI - Response:",n.data),this.transformArticleDate(n.data)}async updateArticleWithAI(t){if(!t.articleId)throw new Error("articleId is required for updateWithAI");console.log("[ArticleAPI] updateArticleWithAI - Request:",{url:Pe.UPDATE_WITH_AI,data:t});const n=await this.client.put(Pe.UPDATE_WITH_AI,t);return console.log("[ArticleAPI] updateArticleWithAI - Response:",n.data),this.transformArticleDate(n.data)}transformArticleDate(t){return{...t,dateAt:t.dateAt?new Date(t.dateAt):void 0,createdAt:t.createdAt?new Date(t.createdAt):void 0,updatedAt:t.updatedAt?new Date(t.updatedAt):void 0,category:t.category?{...t.category,createdAt:t.category.createdAt?new Date(t.category.createdAt):void 0,updatedAt:t.category.updatedAt?new Date(t.category.updatedAt):void 0}:void 0}}transformArticleDates(t){return{...t,items:t.items.map(n=>this.transformArticleDate(n))}}}const Gt={CATEGORIES:"/Category",LIST_BY_PARENT:"/Category/listByParent",CATEGORY_BY_ID:e=>`/Category/${e}`};class cy{constructor(t){this.client=t}async listCategories(){console.log("[CategoryAPI] listCategories - Request:",{url:Gt.CATEGORIES});const t=await this.client.get(Gt.CATEGORIES);return console.log("[CategoryAPI] listCategories - Response:",t.data),this.transformCategoryDates(t.data)}async listByParent(t,n){const r={};t&&t.length>0&&(r.roles=t.join(",")),n!==void 0&&(r.parentId=n),console.log("[CategoryAPI] listByParent - Request:",{url:Gt.LIST_BY_PARENT,params:r});const i=await this.client.get(Gt.LIST_BY_PARENT,{params:r});return console.log("[CategoryAPI] listByParent - Response:",i.data),this.transformCategoryDates(i.data)}async getCategoryById(t){const n=await this.client.get(Gt.CATEGORY_BY_ID(t));return this.transformCategoryDate(n.data)}async createCategory(t){console.log("[CategoryAPI] createCategory - Request:",{url:Gt.CATEGORIES,data:t});const n=await this.client.post(Gt.CATEGORIES,t);return console.log("[CategoryAPI] createCategory - Response:",n.data),this.transformCategoryDate(n.data)}async updateCategory(t){console.log("[CategoryAPI] updateCategory - Request:",{url:Gt.CATEGORIES,data:t});const n=await this.client.put(Gt.CATEGORIES,t);return console.log("[CategoryAPI] updateCategory - Response:",n.data),this.transformCategoryDate(n.data)}async deleteCategory(t){console.log("[CategoryAPI] deleteCategory - Request:",{id:t,url:Gt.CATEGORY_BY_ID(t)}),await this.client.delete(Gt.CATEGORY_BY_ID(t)),console.log("[CategoryAPI] deleteCategory - Success")}transformCategoryDate(t){return{...t,createdAt:t.createdAt?new Date(t.createdAt):void 0,updatedAt:t.updatedAt?new Date(t.updatedAt):void 0}}transformCategoryDates(t){return t.map(n=>this.transformCategoryDate(n))}}const kt={TAGS:"/Tag",LIST_BY_ROLES:"/Tag/ListByRoles",TAG_BY_ID:e=>`/Tag/${e}`,TAG_MERGE:(e,t)=>`/Tag/merge/${e}/${t}`};class uy{constructor(t){this.client=t}async listTags(){console.log("[TagAPI] listTags - Request:",{url:kt.TAGS});const t=await this.client.get(kt.TAGS);return console.log("[TagAPI] listTags - Response:",t.data),t.data}async listByRoles(){console.log("[TagAPI] listByRoles - Request:",{url:kt.LIST_BY_ROLES});const t=await this.client.get(kt.LIST_BY_ROLES);return console.log("[TagAPI] listByRoles - Response:",t.data),t.data}async getTagById(t){console.log("[TagAPI] getTagById - Request:",{id:t,url:kt.TAG_BY_ID(t)});const n=await this.client.get(kt.TAG_BY_ID(t));return console.log("[TagAPI] getTagById - Response:",n.data),n.data}async createTag(t){console.log("[TagAPI] createTag - Request:",{url:kt.TAGS,data:t});const n=await this.client.post(kt.TAGS,t);return console.log("[TagAPI] createTag - Response:",n.data),n.data}async updateTag(t){console.log("[TagAPI] updateTag - Request:",{url:kt.TAGS,data:t});const n=await this.client.put(kt.TAGS,t);return console.log("[TagAPI] updateTag - Response:",n.data),n.data}async deleteTag(t){console.log("[TagAPI] deleteTag - Request:",{id:t,url:kt.TAG_BY_ID(t)}),await this.client.delete(kt.TAG_BY_ID(t)),console.log("[TagAPI] deleteTag - Success")}async mergeTags(t,n){const r=kt.TAG_MERGE(t,n);console.log("[TagAPI] mergeTags - Request:",{url:r,sourceTagId:t,targetTagId:n}),await this.client.post(r),console.log("[TagAPI] mergeTags - Success")}}const dy=$.createContext(void 0);function cD(){const[e,t]=$.useState(()=>typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return $.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia("(prefers-color-scheme: dark)"),r=i=>t(i.matches?"dark":"light");return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}function uD(e,t){return e==="dark"?"dark":e==="light"?"light":t}function dD({config:e,children:t}){var u;const n=e.theme||{},r=cD(),i=uD(n.mode,r),s=$.useMemo(()=>Ap(e.language,e.translations),[e.language,e.translations]),o=$.useRef(e.language);$.useEffect(()=>{e.language&&e.language!==o.current&&(s.changeLanguage(e.language),o.current=e.language)},[e.language,s]);const a=$.useRef(e);$.useEffect(()=>{var d;a.current=e,console.log("[NNews] Config updated:",{apiUrl:e.apiUrl,hasAuthHeader:!!((d=e.headers)!=null&&d.Authorization)})},[e]);const l=$.useMemo(()=>{const d=e.apiClient||De.create({baseURL:e.apiUrl,headers:{"Content-Type":"application/json"}});d.interceptors.request.use(g=>{var y,E,v,N;const b=a.current;return b.headers&&Object.entries(b.headers).forEach(([C,k])=>{k&&g.headers.set(C,k)}),b.tenantId&&g.headers.set("X-Tenant-Id",b.tenantId),console.log("[NNews] Request interceptor:",{method:(y=g.method)==null?void 0:y.toUpperCase(),url:`${g.baseURL||""}${g.url||""}`,headers:{Authorization:((E=g.headers)==null?void 0:E.Authorization)||"(not set)","Content-Type":((v=g.headers)==null?void 0:v["Content-Type"])||"(not set)","X-Tenant-Id":((N=g.headers)==null?void 0:N["X-Tenant-Id"])||"(not set)"}}),g});const h=new ly(d),f=new cy(d),p=new uy(d);return{config:e,apiClient:d,articleApi:h,categoryApi:f,tagApi:p,theme:n,resolvedMode:i}},[e.apiUrl,e.apiClient,e.tenantId,n,i]),c=["nnews-root",i==="dark"?"dark":"",((u=n.classNames)==null?void 0:u.root)||""].filter(Boolean).join(" ");return x.jsx(dx,{i18n:s,children:x.jsx(dy.Provider,{value:l,children:x.jsx("div",{className:c,children:t})})})}function gi(){const e=$.useContext(dy);if(!e)throw new Error("useNNews must be used within a NNewsProvider");return e}function fD({article:e,categories:t=[],availableRoles:n,onFetchRoles:r,onSave:i,onCancel:s,loading:o=!1}){const{articleApi:a}=gi(),{t:l}=Ft(),[c,u]=$.useState(""),[d,h]=$.useState(""),[f,p]=$.useState(""),[g,b]=$.useState(""),[y,E]=$.useState(!1),[v,N]=$.useState(ze.Draft),[C,k]=$.useState(Wt.Html),[L,j]=$.useState(null),[z,R]=$.useState(""),[F,D]=$.useState(""),[Y,G]=$.useState(!0),[Z,I]=$.useState(new Set),[q,H]=$.useState([]),[X,_]=$.useState(!1),[W,re]=$.useState({});$.useEffect(()=>{var te;e&&(u(e.title),h(e.content),p(e.imageName||""),e.imageName&&b(e.imageName),N(e.status),k(e.contentType||Wt.Html),j(e.categoryId||null),R(e.dateAt?new Date(e.dateAt).toISOString().slice(0,16):""),D(((te=e.tags)==null?void 0:te.map(Ee=>Ee.title).join(", "))||""),e.roles&&e.roles.length>0?(G(!1),I(new Set(e.roles.map(Ee=>Ee.slug)))):(G(!0),I(new Set)))},[e]);const S=n||q;$.useEffect(()=>{if(n&&n.length>0||!r)return;let te=!1;return _(!0),r().then(Ee=>{te||H(Ee)}).catch(Ee=>{console.warn("Failed to fetch roles:",Ee)}).finally(()=>{te||_(!1)}),()=>{te=!0}},[n,r]);const fe=$.useCallback(te=>{G(te),te&&I(new Set)},[]),se=$.useCallback(te=>{I(Ee=>{const Me=new Set(Ee);return Me.has(te)?Me.delete(te):Me.add(te),Me})},[]),_e=()=>{const te={};return c.trim()||(te.title=l("validation.titleRequired")),d.trim()||(te.content=l("validation.contentRequired")),re(te),Object.keys(te).length===0},Ye=async te=>{if(te.preventDefault(),!_e())return;const Ee=Y?[]:Array.from(Z),Me={title:c.trim(),content:d.trim(),imageName:f||void 0,status:v,contentType:C,categoryId:L||void 0,dateAt:z||void 0,tagList:F.trim()||void 0,roles:Ee.length>0?Ee:void 0};e?await i({articleId:e.articleId,...Me}):await i(Me)},Se=async te=>{var Ze;const Ee=(Ze=te.target.files)==null?void 0:Ze[0];if(!Ee)return;if(!Ee.type.startsWith("image/")){re({...W,image:l("validation.imageFileType")});return}if(Ee.size>5*1024*1024){re({...W,image:l("validation.imageSizeLimit")});return}re({...W,image:""});const Me=new FileReader;Me.onloadend=()=>{b(Me.result)},Me.readAsDataURL(Ee);try{E(!0);const Xe=await a.uploadImage(Ee);p(Xe),re({...W,image:""})}catch(Xe){console.error("Error uploading image:",Xe),re({...W,image:l("validation.imageUploadFailed")})}finally{E(!1)}},He=()=>{b(""),p("")};return x.jsxs("form",{onSubmit:Ye,className:"space-y-6",children:[x.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[x.jsxs("div",{className:"col-span-2 p-4",children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"title",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("common.titleRequired")}),x.jsx("input",{id:"title",type:"text",value:c,onChange:te=>u(te.target.value),className:`w-full rounded-md border ${W.title?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500`,placeholder:l("articleEditor.enterTitle")}),W.title&&x.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.title})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"dateAt",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.publicationDate")}),x.jsx("input",{id:"dateAt",type:"datetime-local",value:z,onChange:te=>R(te.target.value),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"category",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.category")}),x.jsxs("select",{id:"category",value:L||"",onChange:te=>j(te.target.value?Number(te.target.value):null),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[x.jsx("option",{value:"",children:l("common.noCategory")}),t.map(te=>x.jsx("option",{value:te.categoryId,children:te.title},te.categoryId))]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"status",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.status")}),x.jsxs("select",{id:"status",value:v,onChange:te=>N(Number(te.target.value)),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[x.jsx("option",{value:ze.Draft,children:l("articleEditor.statusDraft")}),x.jsx("option",{value:ze.Published,children:l("articleEditor.statusPublished")}),x.jsx("option",{value:ze.Archived,children:l("articleEditor.statusArchived")}),x.jsx("option",{value:ze.Scheduled,children:l("articleEditor.statusScheduled")}),x.jsx("option",{value:ze.Review,children:l("articleEditor.statusReview")})]})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"contentType",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.contentType")}),x.jsxs("select",{id:"contentType",value:C,onChange:te=>k(Number(te.target.value)),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",children:[x.jsx("option",{value:Wt.PlainText,children:l("articleEditor.contentTypePlainText")}),x.jsx("option",{value:Wt.Html,children:l("articleEditor.contentTypeHtml")}),x.jsx("option",{value:Wt.MarkDown,children:l("articleEditor.contentTypeMarkDown")})]})]})]}),x.jsx("div",{className:"col-span-1",children:x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"image",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.featuredImage")}),x.jsxs("div",{className:"relative",children:[g?x.jsx("img",{src:g,alt:"Preview",className:"w-full h-[250px] object-cover rounded-md border border-gray-300 dark:border-gray-600"}):x.jsx("div",{className:"w-full h-[250px] rounded-md border border-gray-300 dark:border-gray-600 bg-gray-200 dark:bg-gray-700 flex items-center justify-center",children:x.jsx("svg",{className:"w-16 h-16 text-gray-300 dark:text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:x.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0022.5 18.75V5.25A2.25 2.25 0 0020.25 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"})})}),g&&x.jsx("button",{type:"button",onClick:He,className:"absolute top-2 right-2 rounded-full bg-red-600 p-2 text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500",disabled:y,children:x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:x.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})}),y&&x.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black bg-opacity-50 rounded-md",children:x.jsx("span",{className:"text-white text-sm",children:l("articleEditor.uploading")})})]}),x.jsx("label",{htmlFor:"image",className:"block",children:x.jsx("input",{id:"image",type:"file",accept:"image/*",onChange:Se,disabled:y,className:"block w-full text-sm text-gray-900 dark:text-gray-100 border border-gray-300 dark:border-gray-600 rounded-md cursor-pointer bg-white dark:bg-gray-900 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 mt-2"})}),W.image&&x.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.image}),x.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.imageHint")})]})})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.contentLabel")}),C===Wt.Html?x.jsx(Db,{value:d,onChange:h,placeholder:l("articleEditor.contentPlaceholder"),error:W.content}):C===Wt.MarkDown?x.jsx(Bb,{value:d,onChange:h,placeholder:l("articleEditor.contentPlaceholder")}):x.jsx("textarea",{value:d,onChange:te=>h(te.target.value),placeholder:l("articleEditor.contentPlaceholder"),rows:15,className:`w-full rounded-md border ${W.content?"border-red-300 dark:border-red-600":"border-gray-300 dark:border-gray-600"} px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 font-mono`}),W.content&&x.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:W.content})]}),x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{htmlFor:"tags",className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.tags")}),x.jsx("input",{id:"tags",type:"text",value:F,onChange:te=>D(te.target.value),className:"w-full rounded-md border border-gray-300 dark:border-gray-600 px-4 py-2 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:l("articleEditor.tagsPlaceholder")}),x.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.tagsHint")})]}),x.jsxs("div",{className:"space-y-3",children:[x.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:l("articleEditor.visibility")}),x.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[x.jsx("input",{type:"checkbox",checked:Y,onChange:te=>fe(te.target.checked),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),x.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:l("articleEditor.visibleToAll")})]}),!Y&&x.jsx("div",{className:"ml-6 space-y-2",children:X?x.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("articleEditor.loadingRoles")}):S.length>0?x.jsxs("div",{className:"space-y-2",children:[x.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:l("articleEditor.selectRolesHint")}),S.map(te=>x.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[x.jsx("input",{type:"checkbox",checked:Z.has(te.slug),onChange:()=>se(te.slug),className:"h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"}),x.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:te.name})]},te.slug))]}):x.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:l("articleEditor.noRolesAvailable")})})]}),x.jsxs("div",{className:"mt-6 flex justify-end gap-3",children:[x.jsx("button",{type:"button",onClick:s,disabled:o,className:"rounded-md border border-gray-300 dark:border-gray-600 px-6 py-2 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50",children:l("common.cancel")}),x.jsx("button",{type:"submit",disabled:o,className:"rounded-md bg-blue-600 px-6 py-2 text-white hover:bg-blue-700 disabled:opacity-50",children:l(o?"common.saving":e?"articleEditor.updateArticle":"articleEditor.createArticle")})]})]})}function Gn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Jh(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mi(...e){return t=>{let n=!1;const r=e.map(i=>{const s=Jh(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():Jh(e[i],null)}}}}function kr(...e){return A.useCallback(mi(...e),e)}function hD(e,t){const n=A.createContext(t),r=s=>{const{children:o,...a}=s,l=A.useMemo(()=>a,Object.values(a));return x.jsx(n.Provider,{value:l,children:o})};r.displayName=e+"Provider";function i(s){const o=A.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,i]}function pD(e,t=[]){let n=[];function r(s,o){const a=A.createContext(o),l=n.length;n=[...n,o];const c=d=>{var y;const{scope:h,children:f,...p}=d,g=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,b=A.useMemo(()=>p,Object.values(p));return x.jsx(g.Provider,{value:b,children:f})};c.displayName=s+"Provider";function u(d,h){var g;const f=((g=h==null?void 0:h[e])==null?void 0:g[l])||a,p=A.useContext(f);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[c,u]}const i=()=>{const s=n.map(o=>A.createContext(o));return function(a){const l=(a==null?void 0:a[e])||s;return A.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,gD(i,...t)]}function gD(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(s)[`__scope${c}`];return{...a,...d}},{});return A.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var Wn=globalThis!=null&&globalThis.document?A.useLayoutEffect:()=>{},mD=A[" useId ".trim().toString()]||(()=>{}),bD=0;function jl(e){const[t,n]=A.useState(mD());return Wn(()=>{n(r=>r??String(bD++))},[e]),e||(t?`radix-${t}`:"")}var yD=A[" useInsertionEffect ".trim().toString()]||Wn;function xD({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,s,o]=ED({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:i;{const u=A.useRef(e!==void 0);A.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=A.useCallback(u=>{var d;if(a){const h=wD(u)?u(e):u;h!==e&&((d=o.current)==null||d.call(o,h))}else s(u)},[a,e,s,o]);return[l,c]}function ED({defaultProp:e,onChange:t}){const[n,r]=A.useState(e),i=A.useRef(n),s=A.useRef(t);return yD(()=>{s.current=t},[t]),A.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function wD(e){return typeof e=="function"}function vD(e){const t=_D(e),n=A.forwardRef((r,i)=>{const{children:s,...o}=r,a=A.Children.toArray(s),l=a.find(SD);if(l){const c=l.props.children,u=a.map(d=>d===l?A.Children.count(c)>1?A.Children.only(null):A.isValidElement(c)?c.props.children:null:d);return x.jsx(t,{...o,ref:i,children:A.isValidElement(c)?A.cloneElement(c,void 0,u):null})}return x.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function _D(e){const t=A.forwardRef((n,r)=>{const{children:i,...s}=n;if(A.isValidElement(i)){const o=AD(i),a=ND(s,i.props);return i.type!==A.Fragment&&(a.ref=r?mi(r,o):o),A.cloneElement(i,a)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kD=Symbol("radix.slottable");function SD(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===kD}function ND(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function AD(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var TD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],fy=TD.reduce((e,t)=>{const n=vD(`Primitive.${t}`),r=A.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function CD(e,t){e&&S0.flushSync(()=>e.dispatchEvent(t))}function ci(e){const t=A.useRef(e);return A.useEffect(()=>{t.current=e}),A.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function OD(e,t=globalThis==null?void 0:globalThis.document){const n=ci(e);A.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var RD="DismissableLayer",zc="dismissableLayer.update",ID="dismissableLayer.pointerDownOutside",LD="dismissableLayer.focusOutside",ep,hy=A.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),py=A.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=e,c=A.useContext(hy),[u,d]=A.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=A.useState({}),p=kr(t,L=>d(L)),g=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=g.indexOf(b),E=u?g.indexOf(u):-1,v=c.layersWithOutsidePointerEventsDisabled.size>0,N=E>=y,C=DD(L=>{const j=L.target,z=[...c.branches].some(R=>R.contains(j));!N||z||(i==null||i(L),o==null||o(L),L.defaultPrevented||a==null||a())},h),k=BD(L=>{const j=L.target;[...c.branches].some(R=>R.contains(j))||(s==null||s(L),o==null||o(L),L.defaultPrevented||a==null||a())},h);return OD(L=>{E===c.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&a&&(L.preventDefault(),a()))},h),A.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(ep=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),tp(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=ep)}},[u,h,n,c]),A.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),tp())},[u,c]),A.useEffect(()=>{const L=()=>f({});return document.addEventListener(zc,L),()=>document.removeEventListener(zc,L)},[]),x.jsx(fy.div,{...l,ref:p,style:{pointerEvents:v?N?"auto":"none":void 0,...e.style},onFocusCapture:Gn(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Gn(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Gn(e.onPointerDownCapture,C.onPointerDownCapture)})});py.displayName=RD;var MD="DismissableLayerBranch",PD=A.forwardRef((e,t)=>{const n=A.useContext(hy),r=A.useRef(null),i=kr(t,r);return A.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),x.jsx(fy.div,{...e,ref:i})});PD.displayName=MD;function DD(e,t=globalThis==null?void 0:globalThis.document){const n=ci(e),r=A.useRef(!1),i=A.useRef(()=>{});return A.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){gy(ID,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=l,t.addEventListener("click",i.current,{once:!0})):l()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function BD(e,t=globalThis==null?void 0:globalThis.document){const n=ci(e),r=A.useRef(!1);return A.useEffect(()=>{const i=s=>{s.target&&!r.current&&gy(LD,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tp(){const e=new CustomEvent(zc);document.dispatchEvent(e)}function gy(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?CD(i,s):i.dispatchEvent(s)}function FD(e){const t=$D(e),n=A.forwardRef((r,i)=>{const{children:s,...o}=r,a=A.Children.toArray(s),l=a.find(jD);if(l){const c=l.props.children,u=a.map(d=>d===l?A.Children.count(c)>1?A.Children.only(null):A.isValidElement(c)?c.props.children:null:d);return x.jsx(t,{...o,ref:i,children:A.isValidElement(c)?A.cloneElement(c,void 0,u):null})}return x.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function $D(e){const t=A.forwardRef((n,r)=>{const{children:i,...s}=n;if(A.isValidElement(i)){const o=zD(i),a=qD(s,i.props);return i.type!==A.Fragment&&(a.ref=r?mi(r,o):o),A.cloneElement(i,a)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UD=Symbol("radix.slottable");function jD(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===UD}function qD(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function zD(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var HD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],GD=HD.reduce((e,t)=>{const n=FD(`Primitive.${t}`),r=A.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),ql="focusScope.autoFocusOnMount",zl="focusScope.autoFocusOnUnmount",np={bubbles:!1,cancelable:!0},KD="FocusScope",my=A.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[a,l]=A.useState(null),c=ci(i),u=ci(s),d=A.useRef(null),h=kr(t,g=>l(g)),f=A.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A.useEffect(()=>{if(r){let g=function(v){if(f.paused||!a)return;const N=v.target;a.contains(N)?d.current=N:$n(d.current,{select:!0})},b=function(v){if(f.paused||!a)return;const N=v.relatedTarget;N!==null&&(a.contains(N)||$n(d.current,{select:!0}))},y=function(v){if(document.activeElement===document.body)for(const C of v)C.removedNodes.length>0&&$n(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",b);const E=new MutationObserver(y);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",b),E.disconnect()}}},[r,a,f.paused]),A.useEffect(()=>{if(a){ip.add(f);const g=document.activeElement;if(!a.contains(g)){const y=new CustomEvent(ql,np);a.addEventListener(ql,c),a.dispatchEvent(y),y.defaultPrevented||(WD(QD(by(a)),{select:!0}),document.activeElement===g&&$n(a))}return()=>{a.removeEventListener(ql,c),setTimeout(()=>{const y=new CustomEvent(zl,np);a.addEventListener(zl,u),a.dispatchEvent(y),y.defaultPrevented||$n(g??document.body,{select:!0}),a.removeEventListener(zl,u),ip.remove(f)},0)}}},[a,c,u,f]);const p=A.useCallback(g=>{if(!n&&!r||f.paused)return;const b=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,y=document.activeElement;if(b&&y){const E=g.currentTarget,[v,N]=VD(E);v&&N?!g.shiftKey&&y===N?(g.preventDefault(),n&&$n(v,{select:!0})):g.shiftKey&&y===v&&(g.preventDefault(),n&&$n(N,{select:!0})):y===E&&g.preventDefault()}},[n,r,f.paused]);return x.jsx(GD.div,{tabIndex:-1,...o,ref:h,onKeyDown:p})});my.displayName=KD;function WD(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if($n(r,{select:t}),document.activeElement!==n)return}function VD(e){const t=by(e),n=rp(t,e),r=rp(t.reverse(),e);return[n,r]}function by(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function rp(e,t){for(const n of e)if(!YD(n,{upTo:t}))return n}function YD(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function ZD(e){return e instanceof HTMLInputElement&&"select"in e}function $n(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ZD(e)&&t&&e.select()}}var ip=XD();function XD(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=sp(e,t),e.unshift(t)},remove(t){var n;e=sp(e,t),(n=e[0])==null||n.resume()}}}function sp(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function QD(e){return e.filter(t=>t.tagName!=="A")}function JD(e){const t=eB(e),n=A.forwardRef((r,i)=>{const{children:s,...o}=r,a=A.Children.toArray(s),l=a.find(nB);if(l){const c=l.props.children,u=a.map(d=>d===l?A.Children.count(c)>1?A.Children.only(null):A.isValidElement(c)?c.props.children:null:d);return x.jsx(t,{...o,ref:i,children:A.isValidElement(c)?A.cloneElement(c,void 0,u):null})}return x.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function eB(e){const t=A.forwardRef((n,r)=>{const{children:i,...s}=n;if(A.isValidElement(i)){const o=iB(i),a=rB(s,i.props);return i.type!==A.Fragment&&(a.ref=r?mi(r,o):o),A.cloneElement(i,a)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tB=Symbol("radix.slottable");function nB(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tB}function rB(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function iB(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var sB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],oB=sB.reduce((e,t)=>{const n=JD(`Primitive.${t}`),r=A.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),aB="Portal",yy=A.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[i,s]=A.useState(!1);Wn(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?bp.createPortal(x.jsx(oB.div,{...r,ref:t}),o):null});yy.displayName=aB;function lB(e,t){return A.useReducer((n,r)=>t[n][r]??n,e)}var ga=e=>{const{present:t,children:n}=e,r=cB(t),i=typeof n=="function"?n({present:r.isPresent}):A.Children.only(n),s=kr(r.ref,uB(i));return typeof n=="function"||r.isPresent?A.cloneElement(i,{ref:s}):null};ga.displayName="Presence";function cB(e){const[t,n]=A.useState(),r=A.useRef(null),i=A.useRef(e),s=A.useRef("none"),o=e?"mounted":"unmounted",[a,l]=lB(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return A.useEffect(()=>{const c=ro(r.current);s.current=a==="mounted"?c:"none"},[a]),Wn(()=>{const c=r.current,u=i.current;if(u!==e){const h=s.current,f=ro(c);e?l("MOUNT"):f==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Wn(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=f=>{const g=ro(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&g&&(l("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=f=>{f.target===t&&(s.current=ro(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:A.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function ro(e){return(e==null?void 0:e.animationName)||"none"}function uB(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function xy(e){const t=dB(e),n=A.forwardRef((r,i)=>{const{children:s,...o}=r,a=A.Children.toArray(s),l=a.find(hB);if(l){const c=l.props.children,u=a.map(d=>d===l?A.Children.count(c)>1?A.Children.only(null):A.isValidElement(c)?c.props.children:null:d);return x.jsx(t,{...o,ref:i,children:A.isValidElement(c)?A.cloneElement(c,void 0,u):null})}return x.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function dB(e){const t=A.forwardRef((n,r)=>{const{children:i,...s}=n;if(A.isValidElement(i)){const o=gB(i),a=pB(s,i.props);return i.type!==A.Fragment&&(a.ref=r?mi(r,o):o),A.cloneElement(i,a)}return A.Children.count(i)>1?A.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fB=Symbol("radix.slottable");function hB(e){return A.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fB}function pB(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function gB(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ks=mB.reduce((e,t)=>{const n=xy(`Primitive.${t}`),r=A.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),x.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Hl=0;function bB(){A.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??op()),document.body.insertAdjacentElement("beforeend",e[1]??op()),Hl++,()=>{Hl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Hl--}},[])}function op(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var fn=function(){return fn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},fn.apply(this,arguments)};function Ey(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function yB(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var yo="right-scroll-bar-position",xo="width-before-scroll-bar",xB="with-scroll-bars-hidden",EB="--removed-body-scroll-bar-size";function Gl(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function wB(e,t){var n=$.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var vB=typeof window<"u"?A.useLayoutEffect:A.useEffect,ap=new WeakMap;function _B(e,t){var n=wB(null,function(r){return e.forEach(function(i){return Gl(i,r)})});return vB(function(){var r=ap.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Gl(a,null)}),s.forEach(function(a){i.has(a)||Gl(a,o)})}ap.set(n,e)},[e]),n}function kB(e){return e}function SB(e,t){t===void 0&&(t=kB);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var o=t(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var u=o;o=[],u.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){o.push(u),c()},filter:function(u){return o=o.filter(u),n}}}};return i}function NB(e){e===void 0&&(e={});var t=SB(null);return t.options=fn({async:!0,ssr:!1},e),t}var wy=function(e){var t=e.sideCar,n=Ey(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return A.createElement(r,fn({},n))};wy.isSideCarExport=!0;function AB(e,t){return e.useMedium(t),wy}var vy=NB(),Kl=function(){},ma=A.forwardRef(function(e,t){var n=A.useRef(null),r=A.useState({onScrollCapture:Kl,onWheelCapture:Kl,onTouchMoveCapture:Kl}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,h=e.sideCar,f=e.noRelative,p=e.noIsolation,g=e.inert,b=e.allowPinchZoom,y=e.as,E=y===void 0?"div":y,v=e.gapMode,N=Ey(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,k=_B([n,t]),L=fn(fn({},N),i);return A.createElement(A.Fragment,null,u&&A.createElement(C,{sideCar:vy,removeScrollBar:c,shards:d,noRelative:f,noIsolation:p,inert:g,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:v}),o?A.cloneElement(A.Children.only(a),fn(fn({},L),{ref:k})):A.createElement(E,fn({},L,{className:l,ref:k}),a))});ma.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ma.classNames={fullWidth:xo,zeroRight:yo};var TB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function CB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=TB();return t&&e.setAttribute("nonce",t),e}function OB(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function RB(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var IB=function(){var e=0,t=null;return{add:function(n){e==0&&(t=CB())&&(OB(t,n),RB(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},LB=function(){var e=IB();return function(t,n){A.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},_y=function(){var e=LB(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},MB={left:0,top:0,right:0,gap:0},Wl=function(e){return parseInt(e||"",10)||0},PB=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Wl(n),Wl(r),Wl(i)]},DB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return MB;var t=PB(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},BB=_y(),Jr="data-scroll-locked",FB=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
188
188
  .`.concat(xB,` {
189
189
  overflow: hidden `).concat(r,`;
190
190
  padding-right: `).concat(a,"px ").concat(r,`;