intlayer-editor 9.4.3 → 9.4.4
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/client/dist/assets/{CodeBlockShiki-C2jZfupZ.js → CodeBlockShiki-Bjm0Ego0.js} +2 -2
- package/client/dist/assets/MarkDownRender-DL6ufzaY.js +1 -0
- package/client/dist/assets/{MarkDownRender-OKmQ5wkB.js → MarkDownRender-clRAHZLd.js} +3 -3
- package/client/dist/assets/{MarkdownEditor-QEPrPZ-E.js → MarkdownEditor-DWz0fVZF.js} +1 -1
- package/client/dist/assets/dynamic-D3VGB1Rn.js +41 -0
- package/client/dist/assets/{index-CIl3DRiy.js → index-BNSCZ8xm.js} +6 -6
- package/client/dist/assets/index-DB7qjJFL.css +2 -0
- package/client/dist/assets/{shikiBundle-DErVn1dN.js → shikiBundle-C2Pc5KKu.js} +1 -1
- package/client/dist/index.html +3 -3
- package/package.json +15 -15
- package/server/dist/controllers/configuration.controller.d.ts +2 -3
- package/server/dist/controllers/dictionary.controller.d.ts +5 -6
- package/server/dist/routes/config.routes.d.ts +2 -3
- package/server/dist/routes/dictionary.routes.d.ts +2 -3
- package/server/dist/types/Routes.d.ts +2 -3
- package/server/dist/utils/checkPortAvailability.d.ts +1 -2
- package/server/dist/utils/httpStatusCodes.d.ts +1 -2
- package/server/dist/utils/responseData.d.ts +6 -7
- package/client/dist/assets/MarkDownRender-CiKQVquM.js +0 -1
- package/client/dist/assets/dynamic-Cu9eK9Sn.js +0 -41
- package/client/dist/assets/index-DAo12t9O.css +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkDownRender-
|
|
2
|
-
import{i as e,n as t,r as n,t as r}from"./react-SIfiwpqq.js";import{$ as i,$t as a,A as o,At as s,B as c,Bt as l,Ct as u,D as d,Dt as f,Et as p,F as m,Ft as h,G as g,Gt as _,H as v,Ht as y,I as b,It as x,J as S,Jt as C,K as w,Kt as T,L as E,Lt as D,M as O,Mt as k,N as ee,Nt as A,O as j,Ot as te,P as M,Pt as N,Q as P,Qt as ne,R as re,Rt as ie,St as F,Tt as I,U as ae,Ut as oe,V as se,Vt as ce,W as le,Wt as ue,X as de,Xt as fe,Y as pe,Yt as me,Z as he,Zt as ge,_t as _e,at as ve,bt as ye,ct as be,d as xe,dt as Se,en as Ce,et as we,f as Te,ft as Ee,g as De,gt as Oe,h as ke,ht as Ae,i as je,it as Me,j as Ne,jt as Pe,k as Fe,kt as Ie,lt as Le,m as L,mt as Re,n as ze,ot as Be,p as Ve,pt as He,q as Ue,qt as We,r as Ge,rt as Ke,s as qe,st as Je,t as Ye,tn as Xe,tt as Ze,ut as Qe,vt as $e,wt as et,xt as tt,yt as nt,z as rt,zt as it}from"./dynamic-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkDownRender-DL6ufzaY.js","assets/MarkDownRender-clRAHZLd.js","assets/react-SIfiwpqq.js","assets/dynamic-D3VGB1Rn.js","assets/dist-DmXGrB9_.js","assets/MarkdownEditor-DWz0fVZF.js","assets/shikiBundle-C2Pc5KKu.js","assets/dist-CMBnegHe.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,n as t,r as n,t as r}from"./react-SIfiwpqq.js";import{$ as i,$t as a,A as o,At as s,B as c,Bt as l,Ct as u,D as d,Dt as f,Et as p,F as m,Ft as h,G as g,Gt as _,H as v,Ht as y,I as b,It as x,J as S,Jt as C,K as w,Kt as T,L as E,Lt as D,M as O,Mt as k,N as ee,Nt as A,O as j,Ot as te,P as M,Pt as N,Q as P,Qt as ne,R as re,Rt as ie,St as F,Tt as I,U as ae,Ut as oe,V as se,Vt as ce,W as le,Wt as ue,X as de,Xt as fe,Y as pe,Yt as me,Z as he,Zt as ge,_t as _e,at as ve,bt as ye,ct as be,d as xe,dt as Se,en as Ce,et as we,f as Te,ft as Ee,g as De,gt as Oe,h as ke,ht as Ae,i as je,it as Me,j as Ne,jt as Pe,k as Fe,kt as Ie,lt as Le,m as L,mt as Re,n as ze,ot as Be,p as Ve,pt as He,q as Ue,qt as We,r as Ge,rt as Ke,s as qe,st as Je,t as Ye,tn as Xe,tt as Ze,ut as Qe,vt as $e,wt as et,xt as tt,yt as nt,z as rt,zt as it}from"./dynamic-D3VGB1Rn.js";import{n as at,r as ot,t as R}from"./dist-DmXGrB9_.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var st=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ct=t(((e,t)=>{t.exports=st()})),lt=t((e=>{var t=ct(),n=r(),i=Xe();function a(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function s(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function c(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(s(e)!==e)throw Error(a(188))}function d(e){var t=e.alternate;if(!t){if(t=s(e),t===null)throw Error(a(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var o=i.alternate;if(o===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return u(i),e;if(o===r)return u(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var c=!1,l=i.child;l;){if(l===n){c=!0,n=i,r=o;break}if(l===r){c=!0,r=i,n=o;break}l=l.sibling}if(!c){for(l=o.child;l;){if(l===n){c=!0,n=o,r=i;break}if(l===r){c=!0,r=o,n=i;break}l=l.sibling}if(!c)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(n.tag!==3)throw Error(a(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var A=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var te=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P={pending:!1,data:null,method:null,action:null},ne=[],re=-1;function ie(e){return{current:e}}function F(e){0>re||(e.current=ne[re],ne[re]=null,re--)}function I(e,t){re++,ne[re]=e.current,e.current=t}var ae=ie(null),oe=ie(null),se=ie(null),ce=ie(null);function le(e,t){switch(I(se,t),I(oe,e),I(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}F(ae),I(ae,e)}function ue(){F(ae),F(oe),F(se)}function de(e){e.memoizedState!==null&&I(ce,e);var t=ae.current,n=Kd(t,e.type);t!==n&&(I(oe,e),I(ae,n))}function fe(e){oe.current===e&&(F(ae),F(oe)),ce.current===e&&(F(ce),np._currentValue=P)}var pe,me;function he(e){if(pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);pe=t&&t[1]||``,me=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+pe+e+me}var ge=!1;function _e(e,t){if(!e||ge)return``;ge=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
5
|
`),l=s.split(`
|
|
@@ -41,7 +41,7 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
41
41
|
.wrapper[data-active] {
|
|
42
42
|
outline-color: inherit;
|
|
43
43
|
}
|
|
44
|
-
`,Sf=typeof HTMLElement<`u`?HTMLElement:class{},Cf=class extends Sf{_isSelecting=!1;_pressDuration=bf;_isHovered=!1;_isSelectingState=!1;_wrapper;_pressTimer=null;_clickOutsideHandler=null;static get observedAttributes(){return[`is-selecting`,`press-duration`]}get isSelecting(){return this._isSelecting}set isSelecting(e){this._isSelecting=e,this._updateActiveState()}get pressDuration(){return this._pressDuration}set pressDuration(e){this._pressDuration=e}constructor(){super();let e=this.attachShadow({mode:`open`}),t=document.createElement(`style`);t.textContent=xf,e.appendChild(t);let n=document.createElement(`span`);n.className=`wrapper`,n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`),n.appendChild(document.createElement(`slot`)),e.appendChild(n),this._wrapper=n,n.addEventListener(`mousedown`,()=>this._handleMouseDown()),n.addEventListener(`mouseup`,()=>this._handleMouseUpOrLeave()),n.addEventListener(`mouseleave`,()=>this._handleMouseUpOrLeave()),n.addEventListener(`mouseenter`,()=>this._handleMouseEnter()),n.addEventListener(`click`,e=>this._handleClick(e)),n.addEventListener(`touchstart`,()=>this._handleMouseDown()),n.addEventListener(`touchend`,()=>this._handleMouseUpOrLeave()),n.addEventListener(`touchcancel`,()=>this._handleMouseUpOrLeave()),n.addEventListener(`blur`,()=>this._handleBlur())}attributeChangedCallback(e,t,n){e===`is-selecting`?(this._isSelecting=n!==null,this._updateActiveState()):e===`press-duration`&&(this._pressDuration=n===null?bf:parseInt(n,10))}connectedCallback(){this._clickOutsideHandler=e=>{e.composedPath().includes(this)||(this._isSelectingState=!1,this._dispatch(`intlayer:click-outside`),this._updateActiveState())},document.addEventListener(`mousedown`,this._clickOutsideHandler)}disconnectedCallback(){this._clickOutsideHandler&&=(document.removeEventListener(`mousedown`,this._clickOutsideHandler),null),this._clearPressTimer()}_updateActiveState(){this._isSelecting||this._isSelectingState||this._isHovered?this._wrapper.setAttribute(`data-active`,``):this._wrapper.removeAttribute(`data-active`)}_clearPressTimer(){this._pressTimer!==null&&(clearTimeout(this._pressTimer),this._pressTimer=null)}_dispatch(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}_handleMouseDown(){this._clearPressTimer(),this._pressTimer=setTimeout(()=>{this._isSelectingState=!0,this._updateActiveState(),this._dispatch(`intlayer:press`)},this._pressDuration)}_handleMouseEnter(){this._isHovered=!0,this._updateActiveState(),this._dispatch(`intlayer:hover`)}_handleMouseUpOrLeave(){this._isHovered&&(this._isHovered=!1,this._dispatch(`intlayer:unhover`)),this._clearPressTimer(),this._updateActiveState()}_handleClick(e){(this._isSelecting||this._isSelectingState)&&(e.preventDefault(),e.stopPropagation())}_handleBlur(){this._isSelectingState=!1,this._updateActiveState()}},wf=()=>{typeof customElements>`u`||(customElements.get(`intlayer-content-selector`)||customElements.define(`intlayer-content-selector`,Cf),Jd(),Zd(),yf())},Tf=()=>{let e=typeof window<`u`?window.location.origin:void 0;return{allowedOrigins:[...new Set([a?.editorURL,a?.cmsURL,e].filter(Boolean))],postMessageFn:(e,t)=>{typeof window>`u`||window.self!==window.top&&window.parent?.postMessage(e,t)}}},Ef=0,Df=()=>{Ef++;let e=Ud();if(e)return e;let t=new gf({mode:`client`,messenger:Tf(),configuration:{editor:a}});return Wd(t),wf(),t.start(),t},Of=()=>{Ef=Math.max(0,Ef-1),!(Ef>0)&&(Ud()?.stop(),Wd(null))},kf=(e,t,n)=>{let r=Pd(),i=typeof t==`function`?t():t,[a,o]=(0,z.useState)(i),s=(0,z.useRef)(i),c=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let{emit:t=!0,receive:a=!0}=n??{},l=new ef(e,r?.messenger,{emit:t,receive:a,initialValue:i});c.current=l;let u=e=>{let t=e.detail;s.current=t,o(t)};return l.addEventListener(`change`,u),l.start(),()=>{l.removeEventListener(`change`,u),l.stop(),c.current=null}},[e,r?.messenger,n?.emit,n?.receive]),[a,e=>{o(t=>{let n=typeof e==`function`?e(t):e;return s.current=n,c.current?.set(n),n})},()=>{c.current?.postCurrentValue()}]},Af=(e,t)=>kf(Rd.INTLAYER_URL_CHANGE,e,t),jf=()=>{let e=(0,V.c)(13),t=Pd(),n;e[0]===t?.localeDictionaries.value?n=e[1]:(n=t?.localeDictionaries.value??{},e[0]=t?.localeDictionaries.value,e[1]=n);let[r,i]=(0,z.useState)(n),a,o;e[2]===t?(a=e[3],o=e[4]):(a=()=>{if(!t)return;let e=e=>i(e.detail??{});return t.localeDictionaries.addEventListener(`change`,e),()=>t.localeDictionaries.removeEventListener(`change`,e)},o=[t],e[2]=t,e[3]=a,e[4]=o),(0,z.useEffect)(a,o);let s;e[5]===t?.localeDictionaries?s=e[6]:(s=e=>t?.localeDictionaries.set(e),e[5]=t?.localeDictionaries,e[6]=s);let c=s,l;e[7]===t?l=e[8]:(l=e=>t?.setLocaleDictionary(e),e[7]=t,e[8]=l);let u=l,d;return e[9]!==r||e[10]!==c||e[11]!==u?(d={localeDictionaries:r,setLocaleDictionaries:c,setLocaleDictionary:u},e[9]=r,e[10]=c,e[11]=u,e[12]=d):d=e[12],d},Mf=()=>{let e=(0,V.c)(3),{setLocaleDictionaries:t,setLocaleDictionary:n}=jf(),r;return e[0]!==t||e[1]!==n?(r={setLocaleDictionaries:t,setLocaleDictionary:n},e[0]=t,e[1]=n,e[2]=r):r=e[2],r},Nf=()=>{let e=(0,V.c)(3),t=Pd(),[n,r]=(0,z.useState)(t?.currentLocale.value),i,a;return e[0]===t?(i=e[1],a=e[2]):(i=()=>{if(!t)return;let e=e=>r(e.detail);return t.currentLocale.addEventListener(`change`,e),()=>t.currentLocale.removeEventListener(`change`,e)},a=[t],e[0]=t,e[1]=i,e[2]=a),(0,z.useEffect)(i,a),n},Pf=(e,t,n)=>{for(let r of t)try{if(Mt(r.content,e??[],n))return{keyPath:e,dictionaryLocalId:r.localId}}catch{}},Ff=()=>{let e=(0,V.c)(12),{localeDictionaries:t}=jf(),n=Nf(),{setFocusedContent:r,setFocusedContentKeyPath:i,focusedContent:a}=Id(),o;bb0:{if(!a){o=a;break bb0}if(!t){o=a;break bb0}if(a.dictionaryLocalId){o=a;break bb0}let r;if(e[0]!==n||e[1]!==t||e[2]!==a.dictionaryKey||e[3]!==a.keyPath){let i=Object.values(t).filter(e=>e.key===a.dictionaryKey);r=Pf(a.keyPath??[],i,n),e[0]=n,e[1]=t,e[2]=a.dictionaryKey,e[3]=a.keyPath,e[4]=r}else r=e[4];let i=r,s;e[5]!==a||e[6]!==i?(s={...a,...i},e[5]=a,e[6]=i,e[7]=s):s=e[7],o=s}let s;return e[8]!==r||e[9]!==i||e[10]!==o?(s={focusedContent:o,setFocusedContent:r,setFocusedContentKeyPath:i},e[8]=r,e[9]=i,e[10]=o,e[11]=s):s=e[11],s},If=({children:e,configuration:t,postMessage:n,allowedOrigins:r})=>{let i=(0,z.useRef)(null);i.current||=new gf({mode:`editor`,messenger:{allowedOrigins:r,postMessageFn:n},configuration:t});let a=i.current;return(0,z.useEffect)(()=>(wf(),Wd(a),a.start(),()=>{a.stop(),Wd(null)}),[a]),(0,z.useEffect)(()=>{!a||!t||Object.keys(t).length===0||a.configuration.set(t)},[a,t]),(0,H.jsx)(Nd,{manager:a,children:e})},Lf=(0,z.createContext)(void 0),Rf=()=>{let e=(0,V.c)(4),t=Pd(),n=(0,z.useContext)(Lf),[r,i]=(0,z.useState)(t?.configuration.value??n),a,o;return e[0]!==t||e[1]!==n?(a=()=>{if(!t){i(n);return}let e=e=>{let t=e.detail;i(t??n)};return t.configuration.addEventListener(`change`,e),()=>t.configuration.removeEventListener(`change`,e)},o=[t,n],e[0]=t,e[1]=n,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,z.useEffect)(a,o),r??n},zf=()=>{let e=(0,V.c)(23),t=Pd(),n;e[0]===t?.editedContent?n=e[1]:(n=e=>t?.editedContent.set(e),e[0]=t?.editedContent,e[1]=n);let r,i,a,o,s,c,l,u,d;e[2]===t?(r=e[3],i=e[4],a=e[5],o=e[6],s=e[7],c=e[8],l=e[9],u=e[10],d=e[11]):(r=e=>t?.setEditedDictionary(e),i=(e,n)=>t?.setEditedContent(e,n),a=(e,n,r,i)=>t?.addContent(e,n,r,i),o=(e,n,r)=>t?.renameContent(e,n,r),s=(e,n)=>t?.removeContent(e,n),c=e=>t?.restoreContent(e),l=e=>t?.clearContent(e),u=()=>t?.clearAllContent(),d=(e,n)=>t?.getContentValue(e,n),e[2]=t,e[3]=r,e[4]=i,e[5]=a,e[6]=o,e[7]=s,e[8]=c,e[9]=l,e[10]=u,e[11]=d);let f;return e[12]!==n||e[13]!==r||e[14]!==i||e[15]!==a||e[16]!==o||e[17]!==s||e[18]!==c||e[19]!==l||e[20]!==u||e[21]!==d?(f={setEditedContentState:n,setEditedDictionary:r,setEditedContent:i,addEditedContent:a,renameEditedContent:o,removeEditedContent:s,restoreEditedContent:c,clearEditedDictionaryContent:l,clearEditedContent:u,getEditedContentValue:d},e[12]=n,e[13]=r,e[14]=i,e[15]=a,e[16]=o,e[17]=s,e[18]=c,e[19]=l,e[20]=u,e[21]=d,e[22]=f):f=e[22],f},Bf=()=>{let e=(0,V.c)(6),t=Pd(),[n,r]=(0,z.useState)(t?.editedContent.value),i,a;e[0]===t?(i=e[1],a=e[2]):(i=()=>{if(!t)return;let e=e=>r(e.detail);return t.editedContent.addEventListener(`change`,e),()=>t.editedContent.removeEventListener(`change`,e)},a=[t],e[0]=t,e[1]=i,e[2]=a),(0,z.useEffect)(i,a);let o=zf(),s;return e[3]!==n||e[4]!==o?(s={editedContent:n,...o},e[3]=n,e[4]=o,e[5]=s):s=e[5],s},Vf=()=>{let e=(0,V.c)(5),t=Pd(),[n,r]=(0,z.useState)(t?.editorEnabled.value??!1),i,a;e[0]===t?(i=e[1],a=e[2]):(i=()=>{if(!t)return;let e=e=>r(e.detail);return t.editorEnabled.addEventListener(`change`,e),()=>t.editorEnabled.removeEventListener(`change`,e)},a=[t],e[0]=t,e[1]=i,e[2]=a),(0,z.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={enabled:n},e[3]=n,e[4]=o),o},Hf=()=>{let e=(0,V.c)(2),t=Pd(),n;return e[0]===t?n=e[1]:(n=()=>t?.pingClient(),e[0]=t,e[1]=n),n},Uf=(e,t,n)=>{let r=(0,V.c)(11),i=Pd(),a;r[0]!==e||r[1]!==i?.messenger||r[2]!==t?(a=()=>{if(t)return i?.messenger.subscribe(e,t)},r[0]=e,r[1]=i?.messenger,r[2]=t,r[3]=a):a=r[3];let o;r[4]!==e||r[5]!==i||r[6]!==n?(o=[i,e,n],r[4]=e,r[5]=i,r[6]=n,r[7]=o):o=r[7],(0,z.useEffect)(a,o);let s;return r[8]!==e||r[9]!==i?.messenger?(s=t=>{i?.messenger.send(e,t)},r[8]=e,r[9]=i?.messenger,r[10]=s):s=r[10],s},Wf=()=>{Uf(Rd.INTLAYER_IFRAME_CLICKED,zd)},Gf=e=>{let t=(0,V.c)(10),n=Rf(),r;t[0]===e?r=t[1]:(r=e?.sessionToken&&{headers:{Authorization:`Bearer ${e.sessionToken}`}},t[0]=e,t[1]=r);let i;t[2]===e?.options?i=t[3]:(i=e?.options??{},t[2]=e?.options,t[3]=i);let a;t[4]!==r||t[5]!==i?(a={...r,...i},t[4]=r,t[5]=i,t[6]=a):a=t[6];let o=a,s=e?.intlayerConfiguration??n,c=s?.editor?s:void 0,l;return t[7]!==o||t[8]!==c?(l={options:o,resolvedConfig:c},t[7]=o,t[8]=c,t[9]=l):l=t[9],l},Kf=e=>{let t=(0,V.c)(2),n=Rf(),r=e?.intlayerConfiguration??n,i;return t[0]===r?i=t[1]:(i=Sd(r),t[0]=r,t[1]=i),i},qf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=Ad(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Jf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=Od(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Yf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=Dd(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Xf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=jd(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Zf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=kd(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Qf=[[`session`],[`users`],[`organizations`],[`projects`],[`dictionaries`],[`tags`]],$f=()=>{let e=(0,V.c)(8),t=Kf(),n=yo(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[`logout`],e[0]=r):r=e[0];let i;e[1]===t?i=e[2]:(i=()=>t.signOut(),e[1]=t,e[2]=i);let a;e[3]===n?a=e[4]:(a=()=>{Qf.forEach(e=>{n.removeQueries({queryKey:e})})},e[3]=n,e[4]=a);let o;return e[5]!==i||e[6]!==a?(o={mutationKey:r,mutationFn:i,onSettled:a},e[5]=i,e[6]=a,e[7]=o):o=e[7],Fo(o)},ep=e=>{let t=(0,V.c)(10),n=Rf(),r,i;t[0]!==n||t[1]!==e?(r=gu(e,n,{editor:a}),i=Ed(void 0,r),t[0]=n,t[1]=e,t[2]=r,t[3]=i):(r=t[2],i=t[3]);let o=i,s=Bi(),c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=[`oAuth2AccessToken`],t[4]=c):c=t[4];let l=!!(r.editor.clientId&&r.editor.clientSecret)&&s,u;t[5]!==o.getOAuth2AccessToken||t[6]!==l?(u={queryKey:c,queryFn:o.getOAuth2AccessToken,enabled:l,staleTime:0,gcTime:0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,refetchInterval:!1,refetchIntervalInBackground:!1},t[5]=o.getOAuth2AccessToken,t[6]=l,t[7]=u):u=t[7];let{data:d}=Po(u),f=d?.data,p;return t[8]===f?p=t[9]:(p={oAuth2AccessToken:f},t[8]=f,t[9]=p),p},tp=(e,t)=>{let n=(0,V.c)(17),r=Rf(),i;n[0]!==r||n[1]!==t?(i=t??r??{editor:a},n[0]=r,n[1]=t,n[2]=i):i=n[2];let o=i,s=yo(),c=Bi(),l;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=[`session`],n[3]=l):l=n[3];let u;n[4]===o?u=n[5]:(u=async()=>(await Sd(o).getSession()).data,n[4]=o,n[5]=u);let d=!e&&c,f;n[6]!==u||n[7]!==d?(f={queryKey:l,queryFn:u,staleTime:3e5,gcTime:18e5,refetchInterval:6e5,refetchIntervalInBackground:!1,refetchOnMount:!0,refetchOnWindowFocus:!0,refetchOnReconnect:!0,enabled:d},n[6]=u,n[7]=d,n[8]=f):f=n[8];let{data:p,isFetched:m,refetch:h}=Po(f),g=p??(m?null:void 0),_;n[9]===s?_=n[10]:(_=e=>{s.setQueryData([`session`],e)},n[9]=s,n[10]=_);let v=_,y;n[11]===h?y=n[12]:(y=async()=>(await h()).data,n[11]=h,n[12]=y);let b=y,x;return n[13]!==b||n[14]!==g||n[15]!==v?(x={session:g,fetchSession:b,revalidateSession:b,setSession:v},n[13]=b,n[14]=g,n[15]=v,n[16]=x):x=n[16],x},np=e=>{let t=(0,V.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{session:r,intlayerConfiguration:i}=n,{session:a,fetchSession:o,revalidateSession:s,setSession:c}=tp(r,i),{oAuth2AccessToken:l}=ep(i),u=!!(a?.user||l),d;return t[2]!==o||t[3]!==l||t[4]!==s||t[5]!==a||t[6]!==c||t[7]!==u?(d={session:a,fetchSession:o,setSession:c,revalidateSession:s,oAuth2AccessToken:l,isAuthenticated:u},t[2]=o,t[3]=l,t[4]=s,t[5]=a,t[6]=c,t[7]=u,t[8]=d):d=t[8],d},rp=()=>{let e=(0,V.c)(9),{session:t,revalidateSession:n,setSession:r}=np(),{mutate:i}=$f(),a=t?.user?`authenticated`:`unauthenticated`,o=a===`authenticated`,s=a===`unauthenticated`,c=t?.user,l;e[0]!==i||e[1]!==r?(l=async()=>{r(null),i()},e[0]=i,e[1]=r,e[2]=l):l=e[2];let u=l,d;return e[3]!==o||e[4]!==s||e[5]!==u||e[6]!==n||e[7]!==c?(d={isAuthenticated:o,isUnauthenticated:s,user:c,revalidateSession:n,logout:u},e[3]=o,e[4]=s,e[5]=u,e[6]=n,e[7]=c,e[8]=d):d=e[8],d},ip=e=>{let t=(0,V.c)(4),{requireUser:n,requireProject:r,requireOrganization:i}=e,a=Rf(),o;t[0]===a?o=t[1]:(o={intlayerConfiguration:a},t[0]=a,t[1]=o);let{oAuth2AccessToken:s,session:c}=np(o),l=c?c.user:s?.user,u=c?c.organization:s?.organization,d=c?c.project:s?.project,f=(!n||!!l)&&(!r||!!d)&&(!i||!!u),p;return t[2]===f?p=t[3]:(p={enable:f},t[2]=f,t[3]=p),p},ap=e=>{let t=(0,V.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({requireUser:i,requireProject:r,requireOrganization:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]!==n||t[6]!==r||t[7]!==i?(o={requireUser:i,requireProject:r,requireOrganization:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8];let{enable:s}=ip(o),c=a?.enabled!==!1&&s,l;return t[9]!==a||t[10]!==c?(l={enabled:c,...a},t[9]=a,t[10]=c,t[11]=l):l=t[11],Po(l)},op=()=>{let e=(0,V.c)(3),t=Yf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`ai-auditContentDeclarationMetadata`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={mutationKey:n,mutationFn:e=>t.auditContentDeclarationMetadata(e)},e[1]=t,e[2]=r),Fo(r)},sp=()=>{let e=(0,V.c)(3),t=Yf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`ai-auditContentDeclarationField`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={mutationKey:n,mutationFn:e=>t.auditContentDeclarationField(e)},e[1]=t,e[2]=r),Fo(r)},cp=()=>{let e=(0,V.c)(3),t=Yf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`ai-customQuery`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={mutationKey:n,mutationFn:e=>t.customQuery(e)},e[1]=t,e[2]=r),Fo(r)},lp=(e,t)=>{let n=(0,V.c)(9),r=Jf(),i;n[0]===e?i=n[1]:(i=[`dictionaries`,e],n[0]=e,n[1]=i);let a;n[2]!==r||n[3]!==e?(a=t=>{let{signal:n}=t;return r.getDictionaries(e,{signal:n})},n[2]=r,n[3]=e,n[4]=a):a=n[4];let o;return n[5]!==t||n[6]!==i||n[7]!==a?(o={queryKey:i,queryFn:a,requireUser:!0,requireOrganization:!0,requireProject:!0,...t},n[5]=t,n[6]=i,n[7]=a,n[8]=o):o=n[8],ap(o)},up=()=>{let e=(0,V.c)(6),t=Jf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`dictionaries`],e[0]=n):n=e[0];let r;e[1]===t?r=e[2]:(r=e=>t.pushDictionaries(e.dictionaries),e[1]=t,e[2]=r);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={invalidateQueries:[[`dictionaries`],[`dictionary`],[`dictionariesKeys`]]},e[3]=i):i=e[3];let a;return e[4]===r?a=e[5]:(a={mutationKey:n,mutationFn:r,meta:i},e[4]=r,e[5]=a),Fo(a)},dp=()=>{let e=(0,V.c)(6),t=Jf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`dictionaries`],e[0]=n):n=e[0];let r;e[1]===t?r=e[2]:(r=e=>t.deleteDictionary(e.dictionaryId),e[1]=t,e[2]=r);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={invalidateQueries:[[`dictionaries`],[`dictionary`],[`dictionariesKeys`]]},e[3]=i):i=e[3];let a;return e[4]===r?a=e[5]:(a={mutationKey:n,mutationFn:r,meta:i},e[4]=r,e[5]=a),Fo(a)},fp=()=>{let e=(0,V.c)(3),t=Zf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`editor`,`dictionaries`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={queryKey:n,queryFn:()=>t.getDictionaries()},e[1]=t,e[2]=r),Po(r)},pp=()=>{let e=(0,V.c)(3),t=Zf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`editor`,`dictionaries`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={mutationKey:n,mutationFn:e=>t.writeDictionary(e)},e[1]=t,e[2]=r),Fo(r)},mp=(e,t)=>{let n=(0,V.c)(9),r=qf(),i;n[0]===e?i=n[1]:(i=[`projects`,e],n[0]=e,n[1]=i);let a;n[2]!==e||n[3]!==r?(a=t=>{let{signal:n}=t;return r.getProjects(e,{signal:n})},n[2]=e,n[3]=r,n[4]=a):a=n[4];let o;return n[5]!==t||n[6]!==i||n[7]!==a?(o={queryKey:i,queryFn:a,requireUser:!0,requireOrganization:!0,...t},n[5]=t,n[6]=i,n[7]=a,n[8]=o):o=n[8],ap(o)},hp=(e,t)=>{let n=(0,V.c)(9),r=Xf(),i;n[0]===e?i=n[1]:(i=[`tags`,e],n[0]=e,n[1]=i);let a;n[2]!==e||n[3]!==r?(a=t=>{let{signal:n}=t;return r.getTags(e,{signal:n})},n[2]=e,n[3]=r,n[4]=a):a=n[4];let o;return n[5]!==t||n[6]!==i||n[7]!==a?(o={queryKey:i,queryFn:a,requireUser:!0,requireOrganization:!0,...t},n[5]=t,n[6]=i,n[7]=a,n[8]=o):o=n[8],ap(o)},gp=({children:e,header:t,isOpen:n,defaultIsOpen:r=!1,onToggle:i,onClick:a,disabled:o=!1,contentClassName:s,headerClassName:c,contentId:l,"aria-label":u,className:d,...f})=>{let p=n!==void 0,[m,h]=(0,z.useState)(r),g=(0,z.useId)(),_=p?n:m,v=!_,y=l??`${g}-accordion-content`,b=e=>{if(o)return;let t=!_;p||h(t),i?.(t),a?.(e)};return(0,H.jsxs)(`div`,{className:R(`w-full`,d),children:[(0,H.jsx)(M,{variant:`hoverable`,color:`text`,onClick:b,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b(e))},disabled:o,isFullWidth:!0,className:R(`flex items-center justify-between gap-2`,c),IconRight:P,iconClassName:R(`transform transition-transform duration-500 ease-in-out`,_?`rotate-0`:`-rotate-180`),"aria-expanded":_,"aria-controls":y,"aria-label":u,role:`button`,...f,children:t}),(0,H.jsx)(ee,{id:y,tabIndex:v?-1:void 0,isHidden:v,className:s,role:`region`,"aria-labelledby":y,children:e})]})},_p=({level:e,title:t,description:n,children:r,rightParam:i,isSelected:a,...o})=>(0,H.jsx)(`div`,{className:R(`rounded-md p-2 transition`,`hover:bg-card/30 [&:has(.section:hover)]:bg-transparent`,e===2&&`hover:bg-card/30`,e>=3&&``,a===!0&&`bg-card/40`),...o,children:(0,H.jsx)(gp,{isOpen:a,label:t,header:(0,H.jsxs)(`div`,{className:`flex w-full`,children:[(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-between`,children:[(0,H.jsx)(`span`,{className:R(e===0&&`text-lg`,e===1&&`text-md`,e===2&&`text-md`,e>=3&&`text-base`),children:t}),i&&(0,H.jsx)(`div`,{className:`flex w-auto items-center justify-between p-3`,children:i})]}),n&&(0,H.jsx)(`p`,{className:`pl-3 text-card-foreground text-sm`,children:n})]}),children:(0,H.jsx)(`div`,{className:`size-full px-2`,children:r})})}),vp=e=>{let{keyPath:t,section:n,onFocusKeyPath:r,focusedKeyPath:i=[]}=e;return n.map((n,a)=>{let o={key:a,type:k},s=[...t,o];return(0,H.jsx)(_p,{level:t.length,title:`${a}`,description:``,isSelected:Et(s,i),onClick:e=>{e.stopPropagation(),r(s)},children:(0,H.jsx)(Zp,{...e,keyPath:s,section:n})},JSON.stringify(n))})},yp=({choices:e=[],value:t,defaultValue:n,onChange:r,hoverable:i=!0,disabled:a=!1},o)=>{let[s,c]=(0,z.useState)(t??n??e[0].value),[l,u]=(0,z.useState)(null),d=(0,z.useRef)([]),f=(0,z.useRef)(null),{choiceIndicatorPosition:p}=O(d,{selector:e=>e?.getAttribute(`data-indicator`)===`true`,isHoverable:!1,orientation:o}),m=e.findIndex(e=>e.value===s),h=i&&l!==null?l:m;return(0,z.useEffect)(()=>{t!==void 0&&c(t)},[t]),{valueState:s,hoveredIndex:l,setHoveredIndex:u,optionsRefs:d,indicatorRef:f,choiceIndicatorPosition:p,selectedIndex:m,indicatorIndex:h,handleChange:e=>{c(e),r?.(e)},disabled:a}},bp=[{content:`Off`,value:!1},{content:`On`,value:!0}],xp=Ze(`flex h-fit w-fit cursor-pointer flex-row gap-2 rounded-full border-[1.3px] p-0.38`,{variants:{color:{primary:`border-primary text-primary`,secondary:`border-secondary text-secondary`,neutral:`border-neutral text-neutral`,white:`border-white text-white`,black:`border-black text-black`,text:`border-foreground text-foreground`,error:`border-error text-error`},disabled:{true:`cursor-not-allowed opacity-50`,false:``}},defaultVariants:{color:`text`,disabled:!1}}),Sp=Ze(`z-1 flex-1 cursor-pointer font-medium text-sm transition-all duration-300 ease-in-out aria-selected:cursor-default data-[indicator=true]:text-background motion-reduce:transition-none`,{variants:{size:{xs:`px-2 py-0.5 text-xs`,sm:`px-2 py-1 text-xs`,md:`p-2 text-sm`,lg:`p-4 text-base`}},defaultVariants:{size:`md`}}),Cp=Ze(`absolute top-0 z-0 h-full w-auto rounded-full transition-all duration-300 ease-in-out motion-reduce:transition-none`,{variants:{color:{primary:`bg-primary data-[indicator=true]:text-primary-foreground`,secondary:`bg-secondary data-[indicator=true]:text-secondary-foreground`,neutral:`bg-neutral data-[indicator=true]:text-white`,white:`bg-white data-[indicator=true]:text-black`,black:`bg-black data-[indicator=true]:text-white`,text:`bg-foreground data-[indicator=true]:text-background`,error:`bg-error data-[indicator=true]:text-white`}}}),wp=e=>{let{choices:t=bp,color:n=`primary`,size:r=`md`,className:i,itemClassName:a}=e,{selectedIndex:o,indicatorIndex:s,handleChange:c,optionsRefs:l,indicatorRef:u,choiceIndicatorPosition:d,setHoveredIndex:f,disabled:p}=yp({choices:t,value:e.value,defaultValue:e.defaultValue,onChange:e.onChange,hoverable:e.hoverable,disabled:e.disabled},`horizontal`);return(0,H.jsx)(`div`,{className:xp({color:n,disabled:p,className:i}),role:`tablist`,"aria-disabled":p?`true`:void 0,children:(0,H.jsxs)(`div`,{className:`relative flex size-full flex-row items-center justify-center`,children:[t.map((e,t)=>{let{content:n,value:i,...u}=e,d=typeof i==`string`||typeof i==`number`,m=t===o,h=t===s;return(0,z.createElement)(`button`,{...u,type:`button`,className:R(Sp({size:r}),p&&`cursor-not-allowed`,a),key:d?i:t,role:`tab`,onClick:()=>c(i),"aria-selected":m?`true`:void 0,"data-indicator":h?`true`:void 0,disabled:p,tabIndex:m?0:-1,ref:e=>{l.current[t]=e},onMouseEnter:()=>!p&&f(t),onMouseLeave:()=>!p&&f(null)},n)}),d&&(0,H.jsx)(`div`,{className:R(Cp({color:n})),style:d,ref:u})]})})},Tp=e=>{let t=(0,V.c)(15),{keyPath:n,section:r,editedContent:i,onContentChange:a,onFocusKeyPath:o}=e,s=Nf(),c,l;if(t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==o||t[5]!==r){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Mt(i,n,s);if(e!==void 0&&typeof e!=`boolean`){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(H.Fragment,{children:`Error loading section - Edited content incoherence with the original content format`}),t[8]=e):e=t[8],l=e;break bb0}let u=n.length,d=e??r,f;t[9]!==n||t[10]!==o?(f=e=>{e.stopPropagation(),o(n)},t[9]=n,t[10]=o,t[11]=f):f=t[11];let p;t[12]!==n||t[13]!==a?(p=e=>a({keyPath:n,newValue:String(e)}),t[12]=n,t[13]=a,t[14]=p):p=t[14],c=(0,H.jsx)(`button`,{type:`button`,className:R(`w-full rounded-md p-2 text-left transition`,`hover:bg-card/30 [&:has(.section:hover)]:bg-transparent`,u===2&&`hover:bg-card/30`,u>=3&&``),onClick:f,children:(0,H.jsx)(wp,{value:d,onChange:p})})}t[0]=s,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=r,t[6]=c,t[7]=l}else c=t[6],l=t[7];return l===Symbol.for(`react.early_return_sentinel`)?c:l},Ep=e=>{let{keyPath:t,section:n}=e;return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:Object.keys(n[N]).map(r=>{let i={type:N,key:r},a=[...t,i],o=n[N][r];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`flex items-center font-bold`,children:r}),(0,z.createElement)(Zp,{...e,key:r,keyPath:a,section:o})]})})})},Dp=e=>{let{keyPath:t,section:n}=e;return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:Object.keys(n[h]).map(r=>{let i={type:h,key:r},a=[...t,i],o=n[h][r];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`flex items-center font-bold`,children:r}),(0,z.createElement)(Zp,{...e,key:r,keyPath:a,section:o})]})})})},Op=(...e)=>e.filter(Boolean).join(` `),kp=Ze([`w-full select-text resize-none text-base shadow-none outline-none`,`transition-all duration-300 md:text-sm`,`ring-0`,`disabled:opacity-50`,`rounded-xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl`].join(` `),{variants:{variant:{default:[`text-foreground`,`bg-accent`,`ring-text/20`,`disabled:ring-0`,`hover:ring-3`,`focus-within:ring-4`,`focus-visible:outline-none focus-visible:ring-4`,`[box-shadow:none] focus:[box-shadow:none]`,`aria-invalid:border-error`].join(` `),invisible:`border-none text-inherit outline-none ring-0`},size:{sm:`px-2 py-2 text-sm md:py-1.5 md:text-xs`,md:`px-2 py-3 md:py-2`,lg:`p-4`},validationStyleEnabled:{disabled:``,enabled:`valid:border-success invalid:border-error`}},defaultVariants:{variant:`default`,size:`md`,validationStyleEnabled:`disabled`}}),Ap=({validationStyleEnabled:e=!1,variant:t,size:n,className:r,...i})=>(0,H.jsx)(`input`,{className:Op(kp({variant:t,size:n,validationStyleEnabled:e?`enabled`:`disabled`}),r),suppressHydrationWarning:!0,...i}),jp=({className:e,variant:t,validationStyleEnabled:n=!1,...r})=>(0,H.jsx)(`textarea`,{className:R(`resize-none`,kp({variant:t,validationStyleEnabled:n?`enabled`:`disabled`,className:e})),...r}),Mp=24,Np=12,Pp=({className:e,autoSize:t=!0,onChange:n,maxRows:r=999,ref:i,...a})=>{let o=(0,z.useRef)(null);(0,z.useImperativeHandle)(i,()=>o.current);let s=()=>{let e=o.current;if(!e||!t)return;let n=e.style;n.height=`auto`;let i=e.scrollHeight,a=Mp*r+Np;n.height=`${Math.max(Math.min(i,a),36)}px`};return(0,z.useLayoutEffect)(()=>{(a.value??a.defaultValue)&&s()},[a.value,a.defaultValue,t,r]),(0,H.jsx)(jp,{ref:e=>{o.current=e},onChange:e=>{n?.(e),s()},className:R(`overflow-y-auto`,t&&`resize-none`,e),...a})},Fp=({value:e=``,onCancel:t,onSave:n,onClick:r,children:a,isDisabled:o,...s})=>{let[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=e=>{e.stopPropagation(),l(!1),n()},f=e=>{e.stopPropagation(),l(!1),t()},p=!e||e===``?`-`:e,m=(0,z.useCallback)(e=>{let t=window.getSelection();t&&t.toString().trim()!==``||u.current&&!u.current.contains(e.target)&&(l(!1),n())},[n]);return(0,z.useEffect)(()=>(c?document.addEventListener(`click`,m):document.removeEventListener(`click`,m),()=>document.removeEventListener(`click`,m)),[m,c]),(0,H.jsxs)(`span`,{className:`group/editable-field flex gap-2`,role:`button`,tabIndex:0,onClick:e=>{l(!0),r?.(e)},ref:u,...s,children:[(0,H.jsxs)(`div`,{className:R(`flex flex-1 gap-2`,c?`display`:`hidden`),children:[a,(0,H.jsx)(M,{label:`Save`,variant:`hoverable`,size:`icon-sm`,color:`text`,Icon:i,onClick:d,disabled:o,className:`!text-current`,role:`button`,tabIndex:0,"aria-label":`Save changes`,"data-testid":`editable-field-save-button`}),(0,H.jsx)(M,{label:`Cancel`,color:`text`,variant:`hoverable`,className:`!text-current`,size:`icon-sm`,Icon:pe,onClick:f,disabled:o,role:`button`,tabIndex:0,"aria-label":`Cancel changes`,"data-testid":`editable-field-cancel-button`})]},String(c)),(0,H.jsxs)(`div`,{className:R(`flex flex-1 gap-2`,c?`hidden`:`display`),children:[(0,H.jsx)(`span`,{className:`ml-2 flex w-full whitespace-pre-wrap p-1 text-sm leading-6`,children:p}),(0,H.jsx)(M,{label:`Edit`,Icon:tc,color:`text`,variant:`hoverable`,size:`icon-sm`,className:`!text-current invisible group-hover/editable-field:visible`,disabled:o,onClick:e=>{e.stopPropagation(),l(!0)}})]})]})},Ip=({onSave:e,onCancel:t,ref:n,...r})=>{let i=(0,z.useRef)(null);(0,z.useImperativeHandle)(n,()=>i.current);let a=()=>{e?.(i.current?.value??``)},o=()=>{i.current&&(i.current.value=i.current.defaultValue??``),t?.()},s=r.value??i.current?.value??r.defaultValue??``;return(0,H.jsx)(Fp,{value:s,onCancel:o,onSave:a,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:(0,H.jsx)(Pp,{className:`leading-6`,ref:i,onClick:e=>{e.preventDefault(),e.stopPropagation()},...r})})},Lp=e=>{let t=(0,V.c)(16),{keyPath:n,section:r,editedContent:i,editedContentValue:a,onContentChange:o,onFocusKeyPath:s,renderSection:c}=e,l=Nf(),u;t[0]!==l||t[1]!==i||t[2]!==a||t[3]!==n?(u=a??Mt(i,n,l),t[0]=l,t[1]=i,t[2]=a,t[3]=n,t[4]=u):u=t[4];let d=u;if(d&&typeof d!=`string`){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(H.Fragment,{children:`Error loading section - Edited content Incoherence with the original content format`}),t[5]=e):e=t[5],e}let f=n.length,p=String(d??r),m;if(t[6]!==p||t[7]!==n||t[8]!==f||t[9]!==o||t[10]!==s||t[11]!==c){let e;t[13]!==n||t[14]!==s?(e=e=>{e.stopPropagation(),s(n)},t[13]=n,t[14]=s,t[15]=e):e=t[15],m=(0,H.jsx)(`button`,{type:`button`,className:R(`w-full rounded-md p-2 text-left transition`,`hover:bg-card/30 [&:has(.section:hover)]:bg-transparent`,f===2&&`hover:bg-card/30`,f>=3&&``),onClick:e,children:typeof c==`function`?c(p):(0,H.jsx)(Ip,{"aria-label":`Editable field`,defaultValue:p,onSave:e=>o({keyPath:n,newValue:e}),onCancel:Rp})}),t[6]=p,t[7]=n,t[8]=f,t[9]=o,t[10]=s,t[11]=c,t[12]=m}else m=t[12];return m};function Rp(){return null}var zp=e=>{let t=(0,V.c)(10),{keyPath:n,section:r}=e,{addEditedContent:i}=Bf(),a;if(t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==r){let o=Mt(e.editedContent,n),s=r[x],{content:c}=r,l=[...n,{type:x}],u;t[5]!==i||t[6]!==n||t[7]!==e.dictionary||t[8]!==r?(u=t=>{i(e.dictionary.localId,{...r,content:t.newValue},n)},t[5]=i,t[6]=n,t[7]=e.dictionary,t[8]=r,t[9]=u):u=t[9],a=(0,H.jsxs)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:[(0,H.jsxs)(`span`,{className:`text-neutral text-sm`,children:[s,` `]}),(0,H.jsx)(Lp,{...e,keyPath:l,section:c,editedContentValue:o?.content,onContentChange:u})]}),t[0]=i,t[1]=n,t[2]=e,t[3]=r,t[4]=a}else a=t[4];return a},Bp=e=>{let{keyPath:t,section:n}=e,r=[...t,{type:ie}],i=n[ie];return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:(0,H.jsx)(Zp,{...e,keyPath:r,section:i})})},Vp=e=>{let{keyPath:t,section:n}=e,r=[...t,{type:it}],i=n[it];return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:(0,H.jsx)(Zp,{...e,keyPath:r,section:i})})},Hp=e=>{let{keyPath:t,section:n}=e,r=[...t,{type:l}],i=n[l];return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:(0,H.jsx)(Zp,{...e,keyPath:r,section:i})})},Up=(0,z.memo)(e=>{let{keyPath:t,section:n,focusedKeyPath:r=[],onFocusKeyPath:i}=e;return(0,z.useMemo)(()=>Object.keys(n??{}).filter(e=>!Xp.includes(e)),[n]).map(a=>{let o={key:a,type:ue},s=[...t,o],c=Et(s,r);return(0,H.jsx)(_p,{level:t.length,title:Dt(a),description:``,isSelected:c,onClick:e=>{e.stopPropagation(),i(c?[]:s)},children:(0,H.jsx)(Zp,{...e,keyPath:s,section:n[a]})},a)})}),Wp=({onSave:e,onCancel:t,ref:n,...r})=>{let i=(0,z.useRef)(null),a=()=>{e?.(i.current?.value??``)},o=()=>{i.current&&(i.current.value=i.current.defaultValue??``),t?.()};(0,z.useImperativeHandle)(n,()=>i.current);let s=(0,z.useMemo)(()=>r.value??i.current?.value??r.defaultValue,[r.value,r.defaultValue,i.current?.value]);return(0,H.jsx)(Fp,{value:s,onCancel:o,onSave:a,children:(0,H.jsx)(Ap,{ref:i,...r})})},Gp=e=>{let t=(0,V.c)(17),{keyPath:n,section:r,editedContent:i,onContentChange:a,onFocusKeyPath:o}=e,s=Nf(),c;t[0]!==s||t[1]!==i||t[2]!==n?(c=Mt(i,n,s),t[0]=s,t[1]=i,t[2]=n,t[3]=c):c=t[3];let l=c;if(l!==void 0&&typeof l!=`number`){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(H.Fragment,{children:`Error loading section - Edited content incoherence with the original content format`}),t[4]=e):e=t[4],e}let u=n.length,d=String(l??r),f;if(t[5]!==d||t[6]!==n||t[7]!==u||t[8]!==a||t[9]!==o){let e;t[11]!==n||t[12]!==o?(e=e=>{e.stopPropagation(),o(n)},t[11]=n,t[12]=o,t[13]=e):e=t[13];let r;t[14]!==n||t[15]!==a?(r=e=>a({keyPath:n,newValue:e}),t[14]=n,t[15]=a,t[16]=r):r=t[16],f=(0,H.jsx)(`button`,{type:`button`,className:R(`w-full rounded-md p-2 text-left transition`,`hover:bg-card/30 [&:has(.section:hover)]:bg-transparent`,u===2&&`hover:bg-card/30`,u>=3&&``),onClick:e,children:(0,H.jsx)(Wp,{"aria-label":`Editable number field`,type:`number`,defaultValue:d,onSave:r,onCancel:Kp})}),t[5]=d,t[6]=n,t[7]=u,t[8]=a,t[9]=o,t[10]=f}else f=t[10];return f};function Kp(){return null}var qp=e=>{let{keyPath:t,section:n}=e;return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:Object.keys(n).filter(e=>!Xp.includes(e)).map(r=>{let i={type:_,key:r},a=[...t,i],o=n[_][r];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`flex items-center font-bold`,children:r}),(0,z.createElement)(Zp,{...e,key:r,keyPath:a,section:o})]})})})},Jp=e=>{let{keyPath:t,section:n}=e,r=n[C];return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:Object.keys(r).map(n=>{let i={type:C,key:n},a=[...t,i];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`flex items-center font-bold`,children:n}),(0,z.createElement)(Zp,{...e,key:n,keyPath:a,section:r[n]})]})})})},Yp=e=>{let{keyPath:t,section:n,locale:r}=e,i={type:ge,key:r},a=[...t,i],o=n[ge][r];return(0,H.jsx)(Zp,{...e,keyPath:a,section:o})},Xp=[`filePath`,`id`,`nodeType`],Zp=(0,z.memo)(e=>{let t=Nf(),n=(0,z.useMemo)(()=>Mt(e.editedContent,e.keyPath,t)??e.section,[e.editedContent,e.keyPath,e.section]),r=(0,z.useMemo)(()=>zt(n),[n]);if(typeof n==`object`)return r===`reactNode`?(0,H.jsx)(`span`,{className:`text-neutral text-xs`,children:`React node not editable`}):r===`nested`?(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:`[Nested] Dictionary`}):r===`markdown`?(0,H.jsx)(Hp,{...e,section:n}):r===`html`?(0,H.jsx)(Bp,{...e,section:n}):r===`translation`?(0,H.jsx)(Yp,{...e,section:n}):r===`enumeration`?(0,H.jsx)(Dp,{...e,section:n}):r===`plural`?(0,H.jsx)(qp,{...e,section:n}):r===`select`?(0,H.jsx)(Jp,{...e,section:n}):r===`condition`?(0,H.jsx)(Ep,{...e,section:n}):r===`insertion`?(0,H.jsx)(Vp,{...e,section:n}):r===`array`?(0,H.jsx)(vp,{...e,section:n}):r===`file`?(0,H.jsx)(zp,{...e,section:n}):(0,H.jsx)(Up,{...e,section:n});if(typeof n==`string`)return(0,H.jsx)(Lp,{...e,section:n});if(typeof n==`number`)return(0,H.jsx)(Gp,{...e,section:n});if(typeof n==`boolean`)return(0,H.jsx)(Tp,{...e,section:n})}),Qp=e=>{let t=(0,V.c)(6),{dictionary:n,...r}=e,i=Nf(),{editedContent:a,addEditedContent:o}=Bf(),{focusedContent:s,setFocusedContentKeyPath:c}=Ff(),l;t[0]!==n||t[1]!==a?(l=JSON.stringify((a?.[n.localId]??n).content),t[0]=n,t[1]=a,t[2]=l):l=t[2];let u;return t[3]!==o||t[4]!==n.localId?(u=e=>{o(n.localId,e.newValue,e.keyPath)},t[3]=o,t[4]=n.localId,t[5]=u):u=t[5],(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,z.createElement)(Zp,{...r,keyPath:[],locale:i,dictionary:n,key:`${l}${i}`,editedContent:a?.[n.localId]?.content,focusedKeyPath:s?.keyPath,section:n.content,onContentChange:u,onFocusKeyPath:c})})},$p=e=>{let t=(0,V.c)(9),{children:n,onContentChange:r,disabled:a,validate:o,additionalButtons:s,...c}=e,[l,u]=(0,z.useState)(n),[d,f]=(0,z.useState)(0),p=l!==n,m;t[0]===n?m=t[1]:(m=()=>{u(n),f(em)},t[0]=n,t[1]=m);let h=m,g;t[2]!==l||t[3]!==r?(g=()=>{r(l)},t[2]=l,t[3]=r,t[4]=g):g=t[4];let _=g,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e.currentTarget.value)},t[5]=v):v=t[5];let y=v,b=e=>{e.key===`Enter`&&!a&&C?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),h())},x,S;t[6]===n?(x=t[7],S=t[8]):(x=()=>{u(n),f(tm)},S=[n],t[6]=n,t[7]=x,t[8]=S),(0,z.useEffect)(x,S);let C=o?.(l)??!0;return(0,H.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-between gap-2`,role:`group`,"aria-label":`Content editor input`,children:[(0,H.jsx)(Ap,{onChange:y,onKeyDown:b,"aria-label":`Editable input value`,"aria-describedby":p||s?`content-editor-input-actions`:void 0,"aria-invalid":!C,variant:`invisible`,className:`size-full`,defaultValue:n,disabled:a,...c},d),(p||s)&&(0,H.jsxs)(`div`,{id:`content-editor-input-actions`,className:`flex w-full items-center justify-end gap-2`,role:`group`,"aria-label":`Edit actions`,children:[p&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M,{Icon:i,label:`Save changes${C?``:` (invalid content)`}`,variant:`hoverable`,color:`text`,size:`icon-sm`,className:`cursor-pointer hover:scale-110`,disabled:a||!C,onClick:_,"aria-describedby":C?void 0:`validation-error`}),(0,H.jsx)(M,{Icon:pe,label:`Cancel changes`,variant:`hoverable`,size:`icon-sm`,color:`text`,className:`cursor-pointer hover:scale-110`,onClick:h,disabled:a})]}),s]})]},String(n))};function em(e){return e+1}function tm(e){return e+1}var nm=``,rm=e=>{let t=e.querySelectorAll(`[data-line]`);return t.length===0?(e.textContent??``).split(nm).join(``):Array.from(t).map(e=>{let t=e.querySelector(`[data-editable]`)?.textContent??e.textContent??``;return t===nm?``:t.split(nm).join(``)}).join(`
|
|
44
|
+
`,Sf=typeof HTMLElement<`u`?HTMLElement:class{},Cf=class extends Sf{_isSelecting=!1;_pressDuration=bf;_isHovered=!1;_isSelectingState=!1;_wrapper;_pressTimer=null;_clickOutsideHandler=null;static get observedAttributes(){return[`is-selecting`,`press-duration`]}get isSelecting(){return this._isSelecting}set isSelecting(e){this._isSelecting=e,this._updateActiveState()}get pressDuration(){return this._pressDuration}set pressDuration(e){this._pressDuration=e}constructor(){super();let e=this.attachShadow({mode:`open`}),t=document.createElement(`style`);t.textContent=xf,e.appendChild(t);let n=document.createElement(`span`);n.className=`wrapper`,n.setAttribute(`role`,`button`),n.setAttribute(`tabindex`,`0`),n.appendChild(document.createElement(`slot`)),e.appendChild(n),this._wrapper=n,n.addEventListener(`mousedown`,()=>this._handleMouseDown()),n.addEventListener(`mouseup`,()=>this._handleMouseUpOrLeave()),n.addEventListener(`mouseleave`,()=>this._handleMouseUpOrLeave()),n.addEventListener(`mouseenter`,()=>this._handleMouseEnter()),n.addEventListener(`click`,e=>this._handleClick(e)),n.addEventListener(`touchstart`,()=>this._handleMouseDown()),n.addEventListener(`touchend`,()=>this._handleMouseUpOrLeave()),n.addEventListener(`touchcancel`,()=>this._handleMouseUpOrLeave()),n.addEventListener(`blur`,()=>this._handleBlur())}attributeChangedCallback(e,t,n){e===`is-selecting`?(this._isSelecting=n!==null,this._updateActiveState()):e===`press-duration`&&(this._pressDuration=n===null?bf:parseInt(n,10))}connectedCallback(){this._clickOutsideHandler=e=>{e.composedPath().includes(this)||(this._isSelectingState=!1,this._dispatch(`intlayer:click-outside`),this._updateActiveState())},document.addEventListener(`mousedown`,this._clickOutsideHandler)}disconnectedCallback(){this._clickOutsideHandler&&=(document.removeEventListener(`mousedown`,this._clickOutsideHandler),null),this._clearPressTimer()}_updateActiveState(){this._isSelecting||this._isSelectingState||this._isHovered?this._wrapper.setAttribute(`data-active`,``):this._wrapper.removeAttribute(`data-active`)}_clearPressTimer(){this._pressTimer!==null&&(clearTimeout(this._pressTimer),this._pressTimer=null)}_dispatch(e){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0}))}_handleMouseDown(){this._clearPressTimer(),this._pressTimer=setTimeout(()=>{this._isSelectingState=!0,this._updateActiveState(),this._dispatch(`intlayer:press`)},this._pressDuration)}_handleMouseEnter(){this._isHovered=!0,this._updateActiveState(),this._dispatch(`intlayer:hover`)}_handleMouseUpOrLeave(){this._isHovered&&(this._isHovered=!1,this._dispatch(`intlayer:unhover`)),this._clearPressTimer(),this._updateActiveState()}_handleClick(e){(this._isSelecting||this._isSelectingState)&&(e.preventDefault(),e.stopPropagation())}_handleBlur(){this._isSelectingState=!1,this._updateActiveState()}},wf=()=>{typeof customElements>`u`||(customElements.get(`intlayer-content-selector`)||customElements.define(`intlayer-content-selector`,Cf),Jd(),Zd(),yf())},Tf=()=>{let e=typeof window<`u`?window.location.origin:void 0;return{allowedOrigins:[...new Set([a?.editorURL,a?.cmsURL,e].filter(Boolean))],postMessageFn:(e,t)=>{typeof window>`u`||window.self!==window.top&&window.parent?.postMessage(e,t)}}},Ef=0,Df=()=>{Ef++;let e=Ud();if(e)return e;let t=new gf({mode:`client`,messenger:Tf(),configuration:{editor:a}});return Wd(t),wf(),t.start(),t},Of=()=>{Ef=Math.max(0,Ef-1),!(Ef>0)&&(Ud()?.stop(),Wd(null))},kf=(e,t,n)=>{let r=Pd(),i=typeof t==`function`?t():t,[a,o]=(0,z.useState)(i),s=(0,z.useRef)(i),c=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let{emit:t=!0,receive:a=!0}=n??{},l=new ef(e,r?.messenger,{emit:t,receive:a,initialValue:i});c.current=l;let u=e=>{let t=e.detail;s.current=t,o(t)};return l.addEventListener(`change`,u),l.start(),()=>{l.removeEventListener(`change`,u),l.stop(),c.current=null}},[e,r?.messenger,n?.emit,n?.receive]),[a,e=>{o(t=>{let n=typeof e==`function`?e(t):e;return s.current=n,c.current?.set(n),n})},()=>{c.current?.postCurrentValue()}]},Af=(e,t)=>kf(Rd.INTLAYER_URL_CHANGE,e,t),jf=()=>{let e=(0,V.c)(13),t=Pd(),n;e[0]===t?.localeDictionaries.value?n=e[1]:(n=t?.localeDictionaries.value??{},e[0]=t?.localeDictionaries.value,e[1]=n);let[r,i]=(0,z.useState)(n),a,o;e[2]===t?(a=e[3],o=e[4]):(a=()=>{if(!t)return;let e=e=>i(e.detail??{});return t.localeDictionaries.addEventListener(`change`,e),()=>t.localeDictionaries.removeEventListener(`change`,e)},o=[t],e[2]=t,e[3]=a,e[4]=o),(0,z.useEffect)(a,o);let s;e[5]===t?.localeDictionaries?s=e[6]:(s=e=>t?.localeDictionaries.set(e),e[5]=t?.localeDictionaries,e[6]=s);let c=s,l;e[7]===t?l=e[8]:(l=e=>t?.setLocaleDictionary(e),e[7]=t,e[8]=l);let u=l,d;return e[9]!==r||e[10]!==c||e[11]!==u?(d={localeDictionaries:r,setLocaleDictionaries:c,setLocaleDictionary:u},e[9]=r,e[10]=c,e[11]=u,e[12]=d):d=e[12],d},Mf=()=>{let e=(0,V.c)(3),{setLocaleDictionaries:t,setLocaleDictionary:n}=jf(),r;return e[0]!==t||e[1]!==n?(r={setLocaleDictionaries:t,setLocaleDictionary:n},e[0]=t,e[1]=n,e[2]=r):r=e[2],r},Nf=()=>{let e=(0,V.c)(3),t=Pd(),[n,r]=(0,z.useState)(t?.currentLocale.value),i,a;return e[0]===t?(i=e[1],a=e[2]):(i=()=>{if(!t)return;let e=e=>r(e.detail);return t.currentLocale.addEventListener(`change`,e),()=>t.currentLocale.removeEventListener(`change`,e)},a=[t],e[0]=t,e[1]=i,e[2]=a),(0,z.useEffect)(i,a),n},Pf=(e,t,n)=>{for(let r of t)try{if(Mt(r.content,e??[],n))return{keyPath:e,dictionaryLocalId:r.localId}}catch{}},Ff=()=>{let e=(0,V.c)(12),{localeDictionaries:t}=jf(),n=Nf(),{setFocusedContent:r,setFocusedContentKeyPath:i,focusedContent:a}=Id(),o;bb0:{if(!a){o=a;break bb0}if(!t){o=a;break bb0}if(a.dictionaryLocalId){o=a;break bb0}let r;if(e[0]!==n||e[1]!==t||e[2]!==a.dictionaryKey||e[3]!==a.keyPath){let i=Object.values(t).filter(e=>e.key===a.dictionaryKey);r=Pf(a.keyPath??[],i,n),e[0]=n,e[1]=t,e[2]=a.dictionaryKey,e[3]=a.keyPath,e[4]=r}else r=e[4];let i=r,s;e[5]!==a||e[6]!==i?(s={...a,...i},e[5]=a,e[6]=i,e[7]=s):s=e[7],o=s}let s;return e[8]!==r||e[9]!==i||e[10]!==o?(s={focusedContent:o,setFocusedContent:r,setFocusedContentKeyPath:i},e[8]=r,e[9]=i,e[10]=o,e[11]=s):s=e[11],s},If=({children:e,configuration:t,postMessage:n,allowedOrigins:r})=>{let i=(0,z.useRef)(null);i.current||=new gf({mode:`editor`,messenger:{allowedOrigins:r,postMessageFn:n},configuration:t});let a=i.current;return(0,z.useEffect)(()=>(wf(),Wd(a),a.start(),()=>{a.stop(),Wd(null)}),[a]),(0,z.useEffect)(()=>{!a||!t||Object.keys(t).length===0||a.configuration.set(t)},[a,t]),(0,H.jsx)(Nd,{manager:a,children:e})},Lf=(0,z.createContext)(void 0),Rf=()=>{let e=(0,V.c)(4),t=Pd(),n=(0,z.useContext)(Lf),[r,i]=(0,z.useState)(t?.configuration.value??n),a,o;return e[0]!==t||e[1]!==n?(a=()=>{if(!t){i(n);return}let e=e=>{let t=e.detail;i(t??n)};return t.configuration.addEventListener(`change`,e),()=>t.configuration.removeEventListener(`change`,e)},o=[t,n],e[0]=t,e[1]=n,e[2]=a,e[3]=o):(a=e[2],o=e[3]),(0,z.useEffect)(a,o),r??n},zf=()=>{let e=(0,V.c)(23),t=Pd(),n;e[0]===t?.editedContent?n=e[1]:(n=e=>t?.editedContent.set(e),e[0]=t?.editedContent,e[1]=n);let r,i,a,o,s,c,l,u,d;e[2]===t?(r=e[3],i=e[4],a=e[5],o=e[6],s=e[7],c=e[8],l=e[9],u=e[10],d=e[11]):(r=e=>t?.setEditedDictionary(e),i=(e,n)=>t?.setEditedContent(e,n),a=(e,n,r,i)=>t?.addContent(e,n,r,i),o=(e,n,r)=>t?.renameContent(e,n,r),s=(e,n)=>t?.removeContent(e,n),c=e=>t?.restoreContent(e),l=e=>t?.clearContent(e),u=()=>t?.clearAllContent(),d=(e,n)=>t?.getContentValue(e,n),e[2]=t,e[3]=r,e[4]=i,e[5]=a,e[6]=o,e[7]=s,e[8]=c,e[9]=l,e[10]=u,e[11]=d);let f;return e[12]!==n||e[13]!==r||e[14]!==i||e[15]!==a||e[16]!==o||e[17]!==s||e[18]!==c||e[19]!==l||e[20]!==u||e[21]!==d?(f={setEditedContentState:n,setEditedDictionary:r,setEditedContent:i,addEditedContent:a,renameEditedContent:o,removeEditedContent:s,restoreEditedContent:c,clearEditedDictionaryContent:l,clearEditedContent:u,getEditedContentValue:d},e[12]=n,e[13]=r,e[14]=i,e[15]=a,e[16]=o,e[17]=s,e[18]=c,e[19]=l,e[20]=u,e[21]=d,e[22]=f):f=e[22],f},Bf=()=>{let e=(0,V.c)(6),t=Pd(),[n,r]=(0,z.useState)(t?.editedContent.value),i,a;e[0]===t?(i=e[1],a=e[2]):(i=()=>{if(!t)return;let e=e=>r(e.detail);return t.editedContent.addEventListener(`change`,e),()=>t.editedContent.removeEventListener(`change`,e)},a=[t],e[0]=t,e[1]=i,e[2]=a),(0,z.useEffect)(i,a);let o=zf(),s;return e[3]!==n||e[4]!==o?(s={editedContent:n,...o},e[3]=n,e[4]=o,e[5]=s):s=e[5],s},Vf=()=>{let e=(0,V.c)(5),t=Pd(),[n,r]=(0,z.useState)(t?.editorEnabled.value??!1),i,a;e[0]===t?(i=e[1],a=e[2]):(i=()=>{if(!t)return;let e=e=>r(e.detail);return t.editorEnabled.addEventListener(`change`,e),()=>t.editorEnabled.removeEventListener(`change`,e)},a=[t],e[0]=t,e[1]=i,e[2]=a),(0,z.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={enabled:n},e[3]=n,e[4]=o),o},Hf=()=>{let e=(0,V.c)(2),t=Pd(),n;return e[0]===t?n=e[1]:(n=()=>t?.pingClient(),e[0]=t,e[1]=n),n},Uf=(e,t,n)=>{let r=(0,V.c)(11),i=Pd(),a;r[0]!==e||r[1]!==i?.messenger||r[2]!==t?(a=()=>{if(t)return i?.messenger.subscribe(e,t)},r[0]=e,r[1]=i?.messenger,r[2]=t,r[3]=a):a=r[3];let o;r[4]!==e||r[5]!==i||r[6]!==n?(o=[i,e,n],r[4]=e,r[5]=i,r[6]=n,r[7]=o):o=r[7],(0,z.useEffect)(a,o);let s;return r[8]!==e||r[9]!==i?.messenger?(s=t=>{i?.messenger.send(e,t)},r[8]=e,r[9]=i?.messenger,r[10]=s):s=r[10],s},Wf=()=>{Uf(Rd.INTLAYER_IFRAME_CLICKED,zd)},Gf=e=>{let t=(0,V.c)(10),n=Rf(),r;t[0]===e?r=t[1]:(r=e?.sessionToken&&{headers:{Authorization:`Bearer ${e.sessionToken}`}},t[0]=e,t[1]=r);let i;t[2]===e?.options?i=t[3]:(i=e?.options??{},t[2]=e?.options,t[3]=i);let a;t[4]!==r||t[5]!==i?(a={...r,...i},t[4]=r,t[5]=i,t[6]=a):a=t[6];let o=a,s=e?.intlayerConfiguration??n,c=s?.editor?s:void 0,l;return t[7]!==o||t[8]!==c?(l={options:o,resolvedConfig:c},t[7]=o,t[8]=c,t[9]=l):l=t[9],l},Kf=e=>{let t=(0,V.c)(2),n=Rf(),r=e?.intlayerConfiguration??n,i;return t[0]===r?i=t[1]:(i=Sd(r),t[0]=r,t[1]=i),i},qf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=Ad(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Jf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=Od(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Yf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=Dd(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Xf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=jd(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Zf=e=>{let t=(0,V.c)(3),{options:n,resolvedConfig:r}=Gf(e),i;return t[0]!==n||t[1]!==r?(i=kd(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},Qf=e=>{let t=(0,V.c)(10),n=Rf(),r,i;t[0]!==n||t[1]!==e?(r=gu(e,n,{editor:a}),i=Ed(void 0,r),t[0]=n,t[1]=e,t[2]=r,t[3]=i):(r=t[2],i=t[3]);let o=i,s=Bi(),c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=[`oAuth2AccessToken`],t[4]=c):c=t[4];let l=!!(r.editor.clientId&&r.editor.clientSecret)&&s,u;t[5]!==o.getOAuth2AccessToken||t[6]!==l?(u={queryKey:c,queryFn:o.getOAuth2AccessToken,enabled:l,staleTime:0,gcTime:0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,refetchInterval:!1,refetchIntervalInBackground:!1},t[5]=o.getOAuth2AccessToken,t[6]=l,t[7]=u):u=t[7];let{data:d}=Po(u),f=d?.data,p;return t[8]===f?p=t[9]:(p={oAuth2AccessToken:f},t[8]=f,t[9]=p),p},$f=(e,t)=>{let n=(0,V.c)(17),r=Rf(),i;n[0]!==r||n[1]!==t?(i=t??r??{editor:a},n[0]=r,n[1]=t,n[2]=i):i=n[2];let o=i,s=yo(),c=Bi(),l;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=[`session`],n[3]=l):l=n[3];let u;n[4]===o?u=n[5]:(u=async()=>(await Sd(o).getSession()).data,n[4]=o,n[5]=u);let d=!e&&c,f;n[6]!==u||n[7]!==d?(f={queryKey:l,queryFn:u,staleTime:3e5,gcTime:18e5,refetchInterval:6e5,refetchIntervalInBackground:!1,refetchOnMount:!0,refetchOnWindowFocus:!0,refetchOnReconnect:!0,enabled:d},n[6]=u,n[7]=d,n[8]=f):f=n[8];let{data:p,isFetched:m,refetch:h}=Po(f),g=p??(m?null:void 0),_;n[9]===s?_=n[10]:(_=e=>{s.setQueryData([`session`],e)},n[9]=s,n[10]=_);let v=_,y;n[11]===h?y=n[12]:(y=async()=>(await h()).data,n[11]=h,n[12]=y);let b=y,x;return n[13]!==b||n[14]!==g||n[15]!==v?(x={session:g,fetchSession:b,revalidateSession:b,setSession:v},n[13]=b,n[14]=g,n[15]=v,n[16]=x):x=n[16],x},ep=e=>{let t=(0,V.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{session:r,intlayerConfiguration:i}=n,{session:a,fetchSession:o,revalidateSession:s,setSession:c}=$f(r,i),{oAuth2AccessToken:l}=Qf(i),u=!!(a?.user||l),d;return t[2]!==o||t[3]!==l||t[4]!==s||t[5]!==a||t[6]!==c||t[7]!==u?(d={session:a,fetchSession:o,setSession:c,revalidateSession:s,oAuth2AccessToken:l,isAuthenticated:u},t[2]=o,t[3]=l,t[4]=s,t[5]=a,t[6]=c,t[7]=u,t[8]=d):d=t[8],d},tp=e=>{let t=(0,V.c)(4),{requireUser:n,requireProject:r,requireOrganization:i}=e,a=Rf(),o;t[0]===a?o=t[1]:(o={intlayerConfiguration:a},t[0]=a,t[1]=o);let{oAuth2AccessToken:s,session:c}=ep(o),l=c?c.user:s?.user,u=c?c.organization:s?.organization,d=c?c.project:s?.project,f=(!n||!!l)&&(!r||!!d)&&(!i||!!u),p;return t[2]===f?p=t[3]:(p={enable:f},t[2]=f,t[3]=p),p},np=e=>{let t=(0,V.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({requireUser:i,requireProject:r,requireOrganization:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]!==n||t[6]!==r||t[7]!==i?(o={requireUser:i,requireProject:r,requireOrganization:n},t[5]=n,t[6]=r,t[7]=i,t[8]=o):o=t[8];let{enable:s}=tp(o),c=a?.enabled!==!1&&s,l;return t[9]!==a||t[10]!==c?(l={enabled:c,...a},t[9]=a,t[10]=c,t[11]=l):l=t[11],Po(l)},rp=()=>{let e=(0,V.c)(3),t=Yf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`ai-auditContentDeclarationMetadata`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={mutationKey:n,mutationFn:e=>t.auditContentDeclarationMetadata(e)},e[1]=t,e[2]=r),Fo(r)},ip=()=>{let e=(0,V.c)(3),t=Yf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`ai-auditContentDeclarationField`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={mutationKey:n,mutationFn:e=>t.auditContentDeclarationField(e)},e[1]=t,e[2]=r),Fo(r)},ap=()=>{let e=(0,V.c)(3),t=Yf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`ai-customQuery`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={mutationKey:n,mutationFn:e=>t.customQuery(e)},e[1]=t,e[2]=r),Fo(r)},op=[[`session`],[`users`],[`organizations`],[`projects`],[`dictionaries`],[`tags`]],sp=()=>{let e=(0,V.c)(8),t=Kf(),n=yo(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[`logout`],e[0]=r):r=e[0];let i;e[1]===t?i=e[2]:(i=()=>t.signOut(),e[1]=t,e[2]=i);let a;e[3]===n?a=e[4]:(a=()=>{op.forEach(e=>{n.removeQueries({queryKey:e})})},e[3]=n,e[4]=a);let o;return e[5]!==i||e[6]!==a?(o={mutationKey:r,mutationFn:i,onSettled:a},e[5]=i,e[6]=a,e[7]=o):o=e[7],Fo(o)},cp=(e,t)=>{let n=(0,V.c)(9),r=Jf(),i;n[0]===e?i=n[1]:(i=[`dictionaries`,e],n[0]=e,n[1]=i);let a;n[2]!==r||n[3]!==e?(a=t=>{let{signal:n}=t;return r.getDictionaries(e,{signal:n})},n[2]=r,n[3]=e,n[4]=a):a=n[4];let o;return n[5]!==t||n[6]!==i||n[7]!==a?(o={queryKey:i,queryFn:a,requireUser:!0,requireOrganization:!0,requireProject:!0,...t},n[5]=t,n[6]=i,n[7]=a,n[8]=o):o=n[8],np(o)},lp=()=>{let e=(0,V.c)(6),t=Jf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`dictionaries`],e[0]=n):n=e[0];let r;e[1]===t?r=e[2]:(r=e=>t.pushDictionaries(e.dictionaries),e[1]=t,e[2]=r);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={invalidateQueries:[[`dictionaries`],[`dictionary`],[`dictionariesKeys`]]},e[3]=i):i=e[3];let a;return e[4]===r?a=e[5]:(a={mutationKey:n,mutationFn:r,meta:i},e[4]=r,e[5]=a),Fo(a)},up=()=>{let e=(0,V.c)(6),t=Jf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`dictionaries`],e[0]=n):n=e[0];let r;e[1]===t?r=e[2]:(r=e=>t.deleteDictionary(e.dictionaryId),e[1]=t,e[2]=r);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={invalidateQueries:[[`dictionaries`],[`dictionary`],[`dictionariesKeys`]]},e[3]=i):i=e[3];let a;return e[4]===r?a=e[5]:(a={mutationKey:n,mutationFn:r,meta:i},e[4]=r,e[5]=a),Fo(a)},dp=()=>{let e=(0,V.c)(3),t=Zf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`editor`,`dictionaries`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={queryKey:n,queryFn:()=>t.getDictionaries()},e[1]=t,e[2]=r),Po(r)},fp=()=>{let e=(0,V.c)(3),t=Zf(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[`editor`,`dictionaries`],e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r={mutationKey:n,mutationFn:e=>t.writeDictionary(e)},e[1]=t,e[2]=r),Fo(r)},pp=(e,t)=>{let n=(0,V.c)(9),r=qf(),i;n[0]===e?i=n[1]:(i=[`projects`,e],n[0]=e,n[1]=i);let a;n[2]!==e||n[3]!==r?(a=t=>{let{signal:n}=t;return r.getProjects(e,{signal:n})},n[2]=e,n[3]=r,n[4]=a):a=n[4];let o;return n[5]!==t||n[6]!==i||n[7]!==a?(o={queryKey:i,queryFn:a,requireUser:!0,requireOrganization:!0,...t},n[5]=t,n[6]=i,n[7]=a,n[8]=o):o=n[8],np(o)},mp=(e,t)=>{let n=(0,V.c)(9),r=Xf(),i;n[0]===e?i=n[1]:(i=[`tags`,e],n[0]=e,n[1]=i);let a;n[2]!==e||n[3]!==r?(a=t=>{let{signal:n}=t;return r.getTags(e,{signal:n})},n[2]=e,n[3]=r,n[4]=a):a=n[4];let o;return n[5]!==t||n[6]!==i||n[7]!==a?(o={queryKey:i,queryFn:a,requireUser:!0,requireOrganization:!0,...t},n[5]=t,n[6]=i,n[7]=a,n[8]=o):o=n[8],np(o)},hp=()=>{let e=(0,V.c)(9),{session:t,revalidateSession:n,setSession:r}=ep(),{mutate:i}=sp(),a=t?.user?`authenticated`:`unauthenticated`,o=a===`authenticated`,s=a===`unauthenticated`,c=t?.user,l;e[0]!==i||e[1]!==r?(l=async()=>{r(null),i()},e[0]=i,e[1]=r,e[2]=l):l=e[2];let u=l,d;return e[3]!==o||e[4]!==s||e[5]!==u||e[6]!==n||e[7]!==c?(d={isAuthenticated:o,isUnauthenticated:s,user:c,revalidateSession:n,logout:u},e[3]=o,e[4]=s,e[5]=u,e[6]=n,e[7]=c,e[8]=d):d=e[8],d},gp=({children:e,header:t,isOpen:n,defaultIsOpen:r=!1,onToggle:i,onClick:a,disabled:o=!1,contentClassName:s,headerClassName:c,contentId:l,"aria-label":u,className:d,...f})=>{let p=n!==void 0,[m,h]=(0,z.useState)(r),g=(0,z.useId)(),_=p?n:m,v=!_,y=l??`${g}-accordion-content`,b=e=>{if(o)return;let t=!_;p||h(t),i?.(t),a?.(e)};return(0,H.jsxs)(`div`,{className:R(`w-full`,d),children:[(0,H.jsx)(M,{variant:`hoverable`,color:`text`,onClick:b,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),b(e))},disabled:o,isFullWidth:!0,className:R(`flex items-center justify-between gap-2`,c),IconRight:P,iconClassName:R(`transform transition-transform duration-500 ease-in-out`,_?`rotate-0`:`-rotate-180`),"aria-expanded":_,"aria-controls":y,"aria-label":u,role:`button`,...f,children:t}),(0,H.jsx)(ee,{id:y,tabIndex:v?-1:void 0,isHidden:v,className:s,role:`region`,"aria-labelledby":y,children:e})]})},_p=({level:e,title:t,description:n,children:r,rightParam:i,isSelected:a,...o})=>(0,H.jsx)(`div`,{className:R(`rounded-md p-2 transition`,`hover:bg-card/30 [&:has(.section:hover)]:bg-transparent`,e===2&&`hover:bg-card/30`,e>=3&&``,a===!0&&`bg-card/40`),...o,children:(0,H.jsx)(gp,{isOpen:a,label:t,header:(0,H.jsxs)(`div`,{className:`flex w-full`,children:[(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-between`,children:[(0,H.jsx)(`span`,{className:R(e===0&&`text-lg`,e===1&&`text-md`,e===2&&`text-md`,e>=3&&`text-base`),children:t}),i&&(0,H.jsx)(`div`,{className:`flex w-auto items-center justify-between p-3`,children:i})]}),n&&(0,H.jsx)(`p`,{className:`pl-3 text-card-foreground text-sm`,children:n})]}),children:(0,H.jsx)(`div`,{className:`size-full px-2`,children:r})})}),vp=e=>{let{keyPath:t,section:n,onFocusKeyPath:r,focusedKeyPath:i=[]}=e;return n.map((n,a)=>{let o={key:a,type:k},s=[...t,o];return(0,H.jsx)(_p,{level:t.length,title:`${a}`,description:``,isSelected:Et(s,i),onClick:e=>{e.stopPropagation(),r(s)},children:(0,H.jsx)(Zp,{...e,keyPath:s,section:n})},JSON.stringify(n))})},yp=({choices:e=[],value:t,defaultValue:n,onChange:r,hoverable:i=!0,disabled:a=!1},o)=>{let[s,c]=(0,z.useState)(t??n??e[0].value),[l,u]=(0,z.useState)(null),d=(0,z.useRef)([]),f=(0,z.useRef)(null),{choiceIndicatorPosition:p}=O(d,{selector:e=>e?.getAttribute(`data-indicator`)===`true`,isHoverable:!1,orientation:o}),m=e.findIndex(e=>e.value===s),h=i&&l!==null?l:m;return(0,z.useEffect)(()=>{t!==void 0&&c(t)},[t]),{valueState:s,hoveredIndex:l,setHoveredIndex:u,optionsRefs:d,indicatorRef:f,choiceIndicatorPosition:p,selectedIndex:m,indicatorIndex:h,handleChange:e=>{c(e),r?.(e)},disabled:a}},bp=[{content:`Off`,value:!1},{content:`On`,value:!0}],xp=Ze(`flex h-fit w-fit cursor-pointer flex-row gap-2 rounded-full border-[1.3px] p-0.38`,{variants:{color:{primary:`border-primary text-primary`,secondary:`border-secondary text-secondary`,neutral:`border-neutral text-neutral`,white:`border-white text-white`,black:`border-black text-black`,text:`border-foreground text-foreground`,error:`border-error text-error`},disabled:{true:`cursor-not-allowed opacity-50`,false:``}},defaultVariants:{color:`text`,disabled:!1}}),Sp=Ze(`z-1 flex-1 cursor-pointer font-medium text-sm transition-all duration-300 ease-in-out aria-selected:cursor-default data-[indicator=true]:text-background motion-reduce:transition-none`,{variants:{size:{xs:`px-2 py-0.5 text-xs`,sm:`px-2 py-1 text-xs`,md:`p-2 text-sm`,lg:`p-4 text-base`}},defaultVariants:{size:`md`}}),Cp=Ze(`absolute top-0 z-0 h-full w-auto rounded-full transition-all duration-300 ease-in-out motion-reduce:transition-none`,{variants:{color:{primary:`bg-primary data-[indicator=true]:text-primary-foreground`,secondary:`bg-secondary data-[indicator=true]:text-secondary-foreground`,neutral:`bg-neutral data-[indicator=true]:text-white`,white:`bg-white data-[indicator=true]:text-black`,black:`bg-black data-[indicator=true]:text-white`,text:`bg-foreground data-[indicator=true]:text-background`,error:`bg-error data-[indicator=true]:text-white`}}}),wp=e=>{let{choices:t=bp,color:n=`primary`,size:r=`md`,className:i,itemClassName:a}=e,{selectedIndex:o,indicatorIndex:s,handleChange:c,optionsRefs:l,indicatorRef:u,choiceIndicatorPosition:d,setHoveredIndex:f,disabled:p}=yp({choices:t,value:e.value,defaultValue:e.defaultValue,onChange:e.onChange,hoverable:e.hoverable,disabled:e.disabled},`horizontal`);return(0,H.jsx)(`div`,{className:xp({color:n,disabled:p,className:i}),role:`tablist`,"aria-disabled":p?`true`:void 0,children:(0,H.jsxs)(`div`,{className:`relative flex size-full flex-row items-center justify-center`,children:[t.map((e,t)=>{let{content:n,value:i,...u}=e,d=typeof i==`string`||typeof i==`number`,m=t===o,h=t===s;return(0,z.createElement)(`button`,{...u,type:`button`,className:R(Sp({size:r}),p&&`cursor-not-allowed`,a),key:d?i:t,role:`tab`,onClick:()=>c(i),"aria-selected":m?`true`:void 0,"data-indicator":h?`true`:void 0,disabled:p,tabIndex:m?0:-1,ref:e=>{l.current[t]=e},onMouseEnter:()=>!p&&f(t),onMouseLeave:()=>!p&&f(null)},n)}),d&&(0,H.jsx)(`div`,{className:R(Cp({color:n})),style:d,ref:u})]})})},Tp=e=>{let t=(0,V.c)(15),{keyPath:n,section:r,editedContent:i,onContentChange:a,onFocusKeyPath:o}=e,s=Nf(),c,l;if(t[0]!==s||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==o||t[5]!==r){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Mt(i,n,s);if(e!==void 0&&typeof e!=`boolean`){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(H.Fragment,{children:`Error loading section - Edited content incoherence with the original content format`}),t[8]=e):e=t[8],l=e;break bb0}let u=n.length,d=e??r,f;t[9]!==n||t[10]!==o?(f=e=>{e.stopPropagation(),o(n)},t[9]=n,t[10]=o,t[11]=f):f=t[11];let p;t[12]!==n||t[13]!==a?(p=e=>a({keyPath:n,newValue:String(e)}),t[12]=n,t[13]=a,t[14]=p):p=t[14],c=(0,H.jsx)(`button`,{type:`button`,className:R(`w-full rounded-md p-2 text-left transition`,`hover:bg-card/30 [&:has(.section:hover)]:bg-transparent`,u===2&&`hover:bg-card/30`,u>=3&&``),onClick:f,children:(0,H.jsx)(wp,{value:d,onChange:p})})}t[0]=s,t[1]=i,t[2]=n,t[3]=a,t[4]=o,t[5]=r,t[6]=c,t[7]=l}else c=t[6],l=t[7];return l===Symbol.for(`react.early_return_sentinel`)?c:l},Ep=e=>{let{keyPath:t,section:n}=e;return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:Object.keys(n[N]).map(r=>{let i={type:N,key:r},a=[...t,i],o=n[N][r];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`flex items-center font-bold`,children:r}),(0,z.createElement)(Zp,{...e,key:r,keyPath:a,section:o})]})})})},Dp=e=>{let{keyPath:t,section:n}=e;return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:Object.keys(n[h]).map(r=>{let i={type:h,key:r},a=[...t,i],o=n[h][r];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`flex items-center font-bold`,children:r}),(0,z.createElement)(Zp,{...e,key:r,keyPath:a,section:o})]})})})},Op=(...e)=>e.filter(Boolean).join(` `),kp=Ze([`w-full select-text resize-none text-base shadow-none outline-none`,`transition-all duration-300 md:text-sm`,`ring-0`,`disabled:opacity-50`,`rounded-xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl`].join(` `),{variants:{variant:{default:[`text-foreground`,`bg-accent`,`ring-text/20`,`disabled:ring-0`,`hover:ring-3`,`focus-within:ring-4`,`focus-visible:outline-none focus-visible:ring-4`,`[box-shadow:none] focus:[box-shadow:none]`,`aria-invalid:border-error`].join(` `),invisible:`border-none text-inherit outline-none ring-0`},size:{sm:`px-2 py-2 text-sm md:py-1.5 md:text-xs`,md:`px-2 py-3 md:py-2`,lg:`p-4`},validationStyleEnabled:{disabled:``,enabled:`valid:border-success invalid:border-error`}},defaultVariants:{variant:`default`,size:`md`,validationStyleEnabled:`disabled`}}),Ap=({validationStyleEnabled:e=!1,variant:t,size:n,className:r,...i})=>(0,H.jsx)(`input`,{className:Op(kp({variant:t,size:n,validationStyleEnabled:e?`enabled`:`disabled`}),r),suppressHydrationWarning:!0,...i}),jp=({className:e,variant:t,validationStyleEnabled:n=!1,...r})=>(0,H.jsx)(`textarea`,{className:R(`resize-none`,kp({variant:t,validationStyleEnabled:n?`enabled`:`disabled`,className:e})),...r}),Mp=24,Np=12,Pp=({className:e,autoSize:t=!0,onChange:n,maxRows:r=999,ref:i,...a})=>{let o=(0,z.useRef)(null);(0,z.useImperativeHandle)(i,()=>o.current);let s=()=>{let e=o.current;if(!e||!t)return;let n=e.style;n.height=`auto`;let i=e.scrollHeight,a=Mp*r+Np;n.height=`${Math.max(Math.min(i,a),36)}px`};return(0,z.useLayoutEffect)(()=>{(a.value??a.defaultValue)&&s()},[a.value,a.defaultValue,t,r]),(0,H.jsx)(jp,{ref:e=>{o.current=e},onChange:e=>{n?.(e),s()},className:R(`overflow-y-auto`,t&&`resize-none`,e),...a})},Fp=({value:e=``,onCancel:t,onSave:n,onClick:r,children:a,isDisabled:o,...s})=>{let[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=e=>{e.stopPropagation(),l(!1),n()},f=e=>{e.stopPropagation(),l(!1),t()},p=!e||e===``?`-`:e,m=(0,z.useCallback)(e=>{let t=window.getSelection();t&&t.toString().trim()!==``||u.current&&!u.current.contains(e.target)&&(l(!1),n())},[n]);return(0,z.useEffect)(()=>(c?document.addEventListener(`click`,m):document.removeEventListener(`click`,m),()=>document.removeEventListener(`click`,m)),[m,c]),(0,H.jsxs)(`span`,{className:`group/editable-field flex gap-2`,role:`button`,tabIndex:0,onClick:e=>{l(!0),r?.(e)},ref:u,...s,children:[(0,H.jsxs)(`div`,{className:R(`flex flex-1 gap-2`,c?`display`:`hidden`),children:[a,(0,H.jsx)(M,{label:`Save`,variant:`hoverable`,size:`icon-sm`,color:`text`,Icon:i,onClick:d,disabled:o,className:`!text-current`,role:`button`,tabIndex:0,"aria-label":`Save changes`,"data-testid":`editable-field-save-button`}),(0,H.jsx)(M,{label:`Cancel`,color:`text`,variant:`hoverable`,className:`!text-current`,size:`icon-sm`,Icon:pe,onClick:f,disabled:o,role:`button`,tabIndex:0,"aria-label":`Cancel changes`,"data-testid":`editable-field-cancel-button`})]},String(c)),(0,H.jsxs)(`div`,{className:R(`flex flex-1 gap-2`,c?`hidden`:`display`),children:[(0,H.jsx)(`span`,{className:`ml-2 flex w-full whitespace-pre-wrap p-1 text-sm leading-6`,children:p}),(0,H.jsx)(M,{label:`Edit`,Icon:tc,color:`text`,variant:`hoverable`,size:`icon-sm`,className:`!text-current invisible group-hover/editable-field:visible`,disabled:o,onClick:e=>{e.stopPropagation(),l(!0)}})]})]})},Ip=({onSave:e,onCancel:t,ref:n,...r})=>{let i=(0,z.useRef)(null);(0,z.useImperativeHandle)(n,()=>i.current);let a=()=>{e?.(i.current?.value??``)},o=()=>{i.current&&(i.current.value=i.current.defaultValue??``),t?.()},s=r.value??i.current?.value??r.defaultValue??``;return(0,H.jsx)(Fp,{value:s,onCancel:o,onSave:a,onClick:e=>{e.preventDefault(),e.stopPropagation()},children:(0,H.jsx)(Pp,{className:`leading-6`,ref:i,onClick:e=>{e.preventDefault(),e.stopPropagation()},...r})})},Lp=e=>{let t=(0,V.c)(16),{keyPath:n,section:r,editedContent:i,editedContentValue:a,onContentChange:o,onFocusKeyPath:s,renderSection:c}=e,l=Nf(),u;t[0]!==l||t[1]!==i||t[2]!==a||t[3]!==n?(u=a??Mt(i,n,l),t[0]=l,t[1]=i,t[2]=a,t[3]=n,t[4]=u):u=t[4];let d=u;if(d&&typeof d!=`string`){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(H.Fragment,{children:`Error loading section - Edited content Incoherence with the original content format`}),t[5]=e):e=t[5],e}let f=n.length,p=String(d??r),m;if(t[6]!==p||t[7]!==n||t[8]!==f||t[9]!==o||t[10]!==s||t[11]!==c){let e;t[13]!==n||t[14]!==s?(e=e=>{e.stopPropagation(),s(n)},t[13]=n,t[14]=s,t[15]=e):e=t[15],m=(0,H.jsx)(`button`,{type:`button`,className:R(`w-full rounded-md p-2 text-left transition`,`hover:bg-card/30 [&:has(.section:hover)]:bg-transparent`,f===2&&`hover:bg-card/30`,f>=3&&``),onClick:e,children:typeof c==`function`?c(p):(0,H.jsx)(Ip,{"aria-label":`Editable field`,defaultValue:p,onSave:e=>o({keyPath:n,newValue:e}),onCancel:Rp})}),t[6]=p,t[7]=n,t[8]=f,t[9]=o,t[10]=s,t[11]=c,t[12]=m}else m=t[12];return m};function Rp(){return null}var zp=e=>{let t=(0,V.c)(10),{keyPath:n,section:r}=e,{addEditedContent:i}=Bf(),a;if(t[0]!==i||t[1]!==n||t[2]!==e||t[3]!==r){let o=Mt(e.editedContent,n),s=r[x],{content:c}=r,l=[...n,{type:x}],u;t[5]!==i||t[6]!==n||t[7]!==e.dictionary||t[8]!==r?(u=t=>{i(e.dictionary.localId,{...r,content:t.newValue},n)},t[5]=i,t[6]=n,t[7]=e.dictionary,t[8]=r,t[9]=u):u=t[9],a=(0,H.jsxs)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:[(0,H.jsxs)(`span`,{className:`text-neutral text-sm`,children:[s,` `]}),(0,H.jsx)(Lp,{...e,keyPath:l,section:c,editedContentValue:o?.content,onContentChange:u})]}),t[0]=i,t[1]=n,t[2]=e,t[3]=r,t[4]=a}else a=t[4];return a},Bp=e=>{let{keyPath:t,section:n}=e,r=[...t,{type:ie}],i=n[ie];return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:(0,H.jsx)(Zp,{...e,keyPath:r,section:i})})},Vp=e=>{let{keyPath:t,section:n}=e,r=[...t,{type:it}],i=n[it];return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:(0,H.jsx)(Zp,{...e,keyPath:r,section:i})})},Hp=e=>{let{keyPath:t,section:n}=e,r=[...t,{type:l}],i=n[l];return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:(0,H.jsx)(Zp,{...e,keyPath:r,section:i})})},Up=(0,z.memo)(e=>{let{keyPath:t,section:n,focusedKeyPath:r=[],onFocusKeyPath:i}=e;return(0,z.useMemo)(()=>Object.keys(n??{}).filter(e=>!Xp.includes(e)),[n]).map(a=>{let o={key:a,type:ue},s=[...t,o],c=Et(s,r);return(0,H.jsx)(_p,{level:t.length,title:Dt(a),description:``,isSelected:c,onClick:e=>{e.stopPropagation(),i(c?[]:s)},children:(0,H.jsx)(Zp,{...e,keyPath:s,section:n[a]})},a)})}),Wp=({onSave:e,onCancel:t,ref:n,...r})=>{let i=(0,z.useRef)(null),a=()=>{e?.(i.current?.value??``)},o=()=>{i.current&&(i.current.value=i.current.defaultValue??``),t?.()};(0,z.useImperativeHandle)(n,()=>i.current);let s=(0,z.useMemo)(()=>r.value??i.current?.value??r.defaultValue,[r.value,r.defaultValue,i.current?.value]);return(0,H.jsx)(Fp,{value:s,onCancel:o,onSave:a,children:(0,H.jsx)(Ap,{ref:i,...r})})},Gp=e=>{let t=(0,V.c)(17),{keyPath:n,section:r,editedContent:i,onContentChange:a,onFocusKeyPath:o}=e,s=Nf(),c;t[0]!==s||t[1]!==i||t[2]!==n?(c=Mt(i,n,s),t[0]=s,t[1]=i,t[2]=n,t[3]=c):c=t[3];let l=c;if(l!==void 0&&typeof l!=`number`){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(H.Fragment,{children:`Error loading section - Edited content incoherence with the original content format`}),t[4]=e):e=t[4],e}let u=n.length,d=String(l??r),f;if(t[5]!==d||t[6]!==n||t[7]!==u||t[8]!==a||t[9]!==o){let e;t[11]!==n||t[12]!==o?(e=e=>{e.stopPropagation(),o(n)},t[11]=n,t[12]=o,t[13]=e):e=t[13];let r;t[14]!==n||t[15]!==a?(r=e=>a({keyPath:n,newValue:e}),t[14]=n,t[15]=a,t[16]=r):r=t[16],f=(0,H.jsx)(`button`,{type:`button`,className:R(`w-full rounded-md p-2 text-left transition`,`hover:bg-card/30 [&:has(.section:hover)]:bg-transparent`,u===2&&`hover:bg-card/30`,u>=3&&``),onClick:e,children:(0,H.jsx)(Wp,{"aria-label":`Editable number field`,type:`number`,defaultValue:d,onSave:r,onCancel:Kp})}),t[5]=d,t[6]=n,t[7]=u,t[8]=a,t[9]=o,t[10]=f}else f=t[10];return f};function Kp(){return null}var qp=e=>{let{keyPath:t,section:n}=e;return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:Object.keys(n).filter(e=>!Xp.includes(e)).map(r=>{let i={type:_,key:r},a=[...t,i],o=n[_][r];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`flex items-center font-bold`,children:r}),(0,z.createElement)(Zp,{...e,key:r,keyPath:a,section:o})]})})})},Jp=e=>{let{keyPath:t,section:n}=e,r=n[C];return(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:Object.keys(r).map(n=>{let i={type:C,key:n},a=[...t,i];return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`flex items-center font-bold`,children:n}),(0,z.createElement)(Zp,{...e,key:n,keyPath:a,section:r[n]})]})})})},Yp=e=>{let{keyPath:t,section:n,locale:r}=e,i={type:ge,key:r},a=[...t,i],o=n[ge][r];return(0,H.jsx)(Zp,{...e,keyPath:a,section:o})},Xp=[`filePath`,`id`,`nodeType`],Zp=(0,z.memo)(e=>{let t=Nf(),n=(0,z.useMemo)(()=>Mt(e.editedContent,e.keyPath,t)??e.section,[e.editedContent,e.keyPath,e.section]),r=(0,z.useMemo)(()=>zt(n),[n]);if(typeof n==`object`)return r===`reactNode`?(0,H.jsx)(`span`,{className:`text-neutral text-xs`,children:`React node not editable`}):r===`nested`?(0,H.jsx)(`div`,{className:`ml-2 grid grid-cols-[auto,1fr] gap-2`,children:`[Nested] Dictionary`}):r===`markdown`?(0,H.jsx)(Hp,{...e,section:n}):r===`html`?(0,H.jsx)(Bp,{...e,section:n}):r===`translation`?(0,H.jsx)(Yp,{...e,section:n}):r===`enumeration`?(0,H.jsx)(Dp,{...e,section:n}):r===`plural`?(0,H.jsx)(qp,{...e,section:n}):r===`select`?(0,H.jsx)(Jp,{...e,section:n}):r===`condition`?(0,H.jsx)(Ep,{...e,section:n}):r===`insertion`?(0,H.jsx)(Vp,{...e,section:n}):r===`array`?(0,H.jsx)(vp,{...e,section:n}):r===`file`?(0,H.jsx)(zp,{...e,section:n}):(0,H.jsx)(Up,{...e,section:n});if(typeof n==`string`)return(0,H.jsx)(Lp,{...e,section:n});if(typeof n==`number`)return(0,H.jsx)(Gp,{...e,section:n});if(typeof n==`boolean`)return(0,H.jsx)(Tp,{...e,section:n})}),Qp=e=>{let t=(0,V.c)(6),{dictionary:n,...r}=e,i=Nf(),{editedContent:a,addEditedContent:o}=Bf(),{focusedContent:s,setFocusedContentKeyPath:c}=Ff(),l;t[0]!==n||t[1]!==a?(l=JSON.stringify((a?.[n.localId]??n).content),t[0]=n,t[1]=a,t[2]=l):l=t[2];let u;return t[3]!==o||t[4]!==n.localId?(u=e=>{o(n.localId,e.newValue,e.keyPath)},t[3]=o,t[4]=n.localId,t[5]=u):u=t[5],(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,z.createElement)(Zp,{...r,keyPath:[],locale:i,dictionary:n,key:`${l}${i}`,editedContent:a?.[n.localId]?.content,focusedKeyPath:s?.keyPath,section:n.content,onContentChange:u,onFocusKeyPath:c})})},$p=e=>{let t=(0,V.c)(9),{children:n,onContentChange:r,disabled:a,validate:o,additionalButtons:s,...c}=e,[l,u]=(0,z.useState)(n),[d,f]=(0,z.useState)(0),p=l!==n,m;t[0]===n?m=t[1]:(m=()=>{u(n),f(em)},t[0]=n,t[1]=m);let h=m,g;t[2]!==l||t[3]!==r?(g=()=>{r(l)},t[2]=l,t[3]=r,t[4]=g):g=t[4];let _=g,v;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{u(e.currentTarget.value)},t[5]=v):v=t[5];let y=v,b=e=>{e.key===`Enter`&&!a&&C?(e.preventDefault(),_()):e.key===`Escape`&&(e.preventDefault(),h())},x,S;t[6]===n?(x=t[7],S=t[8]):(x=()=>{u(n),f(tm)},S=[n],t[6]=n,t[7]=x,t[8]=S),(0,z.useEffect)(x,S);let C=o?.(l)??!0;return(0,H.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-between gap-2`,role:`group`,"aria-label":`Content editor input`,children:[(0,H.jsx)(Ap,{onChange:y,onKeyDown:b,"aria-label":`Editable input value`,"aria-describedby":p||s?`content-editor-input-actions`:void 0,"aria-invalid":!C,variant:`invisible`,className:`size-full`,defaultValue:n,disabled:a,...c},d),(p||s)&&(0,H.jsxs)(`div`,{id:`content-editor-input-actions`,className:`flex w-full items-center justify-end gap-2`,role:`group`,"aria-label":`Edit actions`,children:[p&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M,{Icon:i,label:`Save changes${C?``:` (invalid content)`}`,variant:`hoverable`,color:`text`,size:`icon-sm`,className:`cursor-pointer hover:scale-110`,disabled:a||!C,onClick:_,"aria-describedby":C?void 0:`validation-error`}),(0,H.jsx)(M,{Icon:pe,label:`Cancel changes`,variant:`hoverable`,size:`icon-sm`,color:`text`,className:`cursor-pointer hover:scale-110`,onClick:h,disabled:a})]}),s]})]},String(n))};function em(e){return e+1}function tm(e){return e+1}var nm=``,rm=e=>{let t=e.querySelectorAll(`[data-line]`);return t.length===0?(e.textContent??``).split(nm).join(``):Array.from(t).map(e=>{let t=e.querySelector(`[data-editable]`)?.textContent??e.textContent??``;return t===nm?``:t.split(nm).join(``)}).join(`
|
|
45
45
|
`)},im=e=>{let t=e.split(`
|
|
46
46
|
`);return t.length===0?[``]:t},am=(()=>{if(typeof Intl>`u`||!(`Segmenter`in Intl))return null;let e=Intl.Segmenter;return new e(void 0,{granularity:`grapheme`})})(),om=(e,t)=>{if(t<=0)return 0;if(am){let n=[...am.segment(e.slice(0,t))],r=n[n.length-1];return r?t-r.segment.length:t-1}let n=e.charCodeAt(t-1);return n>=56320&&n<=57343&&t>=2?t-2:t-1},sm=(e,t)=>{if(t>=e.length)return e.length;if(am){let n=[...am.segment(e.slice(t))][0];return n?t+n.segment.length:t+1}let n=e.charCodeAt(t);return n>=55296&&n<=56319&&t+1<e.length?t+2:t+1},cm=(e,t)=>{if(t<=0)return 0;let n=t-1;for(;n>0&&/\s/.test(e[n-1]);)n--;for(;n>0&&/\S/.test(e[n-1]);)n--;return n},lm=(e,t)=>{if(t>=e.length)return e.length;let n=t;for(;n<e.length&&/\S/.test(e[n]);)n++;for(;n<e.length&&/\s/.test(e[n]);)n++;return n},um=(e,t)=>e.slice(0,t).lastIndexOf(`
|
|
47
47
|
`)+1,dm=(e,t)=>{let n=e.indexOf(`
|
|
@@ -55,7 +55,7 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
55
55
|
`+n.slice(t.end);v(r,t.start+1);return}if(e.key===`Backspace`){if(e.preventDefault(),t.hasSelection){let e=n.slice(0,t.start)+n.slice(t.end);v(e,t.start)}else{if(t.start===0)return;let r;r=e.metaKey?um(n,t.start):e.altKey?cm(n,t.start):om(n,t.start);let i=n.slice(0,r)+n.slice(t.start);v(i,r)}return}if(e.key===`Delete`){if(e.preventDefault(),t.hasSelection){let e=n.slice(0,t.start)+n.slice(t.end);v(e,t.start)}else{if(t.start>=n.length)return;let r;r=e.metaKey?dm(n,t.start):e.altKey?lm(n,t.start):sm(n,t.start);let i=n.slice(0,t.start)+n.slice(r);v(i,t.start)}return}},handleCut:e=>{if(r){e.preventDefault();return}e.preventDefault();let t=p();if(!t?.hasSelection)return;let n=u.current.join(`
|
|
56
56
|
`),i=n.slice(t.start,t.end);e.clipboardData.setData(`text/plain`,i);let a=n.slice(0,t.start)+n.slice(t.end);v(a,t.start)},handlePaste:e=>{if(r){e.preventDefault();return}e.preventDefault();let t=e.clipboardData.getData(`text/plain`);if(!t)return;let n=p();if(!n)return;let i=u.current.join(`
|
|
57
57
|
`),a=i.slice(0,n.start)+t+i.slice(n.end);v(a,n.start+t.length)},handleDrop:e=>{e.preventDefault()},handleDragOver:e=>{e.preventDefault()},getCaretPosition:f,setCaretPosition:m,getCursorOffset:_,caretFromFlatOffset:g}},pm=({index:e,text:t,isLast:n,ghostText:r})=>(0,H.jsxs)(`span`,{"data-line":e,className:`block min-h-[1.5rem]`,children:[(0,H.jsx)(`span`,{"data-editable":!0,children:t||``}),r&&(0,H.jsx)(`span`,{"data-ghost":!0,className:`pointer-events-none select-none text-neutral`,"aria-hidden":`true`,children:r}),!n&&(0,H.jsx)(`br`,{})]}),mm=24,hm=12,gm=({value:e,defaultValue:t,onChange:n,placeholder:r,disabled:i=!1,minRows:a=1,maxRows:o=999,autoSize:s=!0,validationStyleEnabled:c=!1,variant:l,ghostText:u,ghostLine:d,ghostOffset:f,onClick:p,className:m,dir:h=`auto`,ref:g,..._})=>{let{lines:v,containerRef:y,getText:b,handleInput:x,handleBeforeInput:S,handleKeyDown:C,handleCut:w,handlePaste:T,handleDrop:E,handleDragOver:D,getCursorOffset:O,setCaretPosition:k,caretFromFlatOffset:ee}=fm({value:e,defaultValue:t,onChange:n,disabled:i}),A=(0,z.useRef)(null),j=e=>{A.current=e,y.current=e};(0,z.useImperativeHandle)(g,()=>({getContainer:()=>A.current,getText:b,focus:()=>A.current?.focus(),getCursorOffset:O,setCursorAtOffset:e=>{k(ee(e,v))}})),(0,z.useLayoutEffect)(()=>{if(!s||!A.current)return;let e=A.current,t=mm*o+hm,n=mm*a+hm;e.style.height=`auto`;let r=e.scrollHeight;e.style.height=`${Math.max(Math.min(r,t),n)}px`,e.style.overflowY=r>t?`auto`:`hidden`},[v,s,o,a]);let te=v.length===1&&v[0]===``,M=u&&d!==void 0&&f!==void 0;return(0,H.jsxs)(`div`,{className:`relative w-full`,children:[te&&r&&(0,H.jsx)(`div`,{className:`pointer-events-none absolute inset-0 select-none px-2 py-3 text-base text-neutral-400 leading-[1.5rem] md:py-2 md:text-sm`,"aria-hidden":`true`,children:r}),(0,H.jsx)(`div`,{..._,ref:j,role:`textbox`,"aria-multiline":`true`,"aria-placeholder":r,"aria-disabled":i,"aria-autocomplete":M?`inline`:void 0,tabIndex:i?-1:0,contentEditable:!i,suppressContentEditableWarning:!0,dir:h,onInput:x,onBeforeInput:S,onKeyDown:C,onCut:w,onPaste:T,onDrop:E,onDragOver:D,onClick:p,className:R(`resize-none whitespace-pre-wrap break-words outline-none`,kp({variant:l,validationStyleEnabled:c?`enabled`:`disabled`}),s&&`overflow-y-auto`,m),children:v.map((e,t)=>(0,H.jsx)(pm,{index:t,text:e,isLast:t===v.length-1,ghostText:M&&d===t?u:void 0},t))})]})},_m=({isActive:e=!0,suggestion:t,...n})=>{let r=String(n.value??n.defaultValue??``),[i,a]=(0,z.useState)(r),[o,s]=(0,z.useState)(``),c=(0,z.useRef)(null);(0,z.useEffect)(()=>{n.value!==void 0&&a(String(n.value??n.defaultValue??``))},[n.value,n.defaultValue]);let l=()=>{let e=t??o;if(!e)return;let n=c.current?.getCursorOffset()??i.length,r=i.slice(0,n)+e+i.slice(n);a(r),s(``),setTimeout(()=>{c.current?.focus(),c.current?.setCursorAtOffset(n+e.length)},0)},u=e?t??(o||void 0):void 0,d=i.split(`
|
|
58
|
-
`),f=t?d.length-1:void 0,p=t?d[d.length-1]?.length??0:void 0;return(0,H.jsx)(gm,{ref:c,value:i,onChange:e=>{if(a(e),s(``),n.onChange){let t={target:{value:e},currentTarget:{value:e}};n.onChange(t)}},onKeyDown:e=>{e.key===`Tab`&&(t??o)&&(e.preventDefault(),l()),n.onKeyDown?.(e)},ghostText:u,ghostLine:f,ghostOffset:p,placeholder:n.placeholder,disabled:n.disabled,autoSize:n.autoSize,maxRows:n.maxRows,minRows:n.rows,variant:n.variant,validationStyleEnabled:n.validationStyleEnabled,className:n.className,dir:n.dir,"aria-label":n[`aria-label`],"aria-invalid":n[`aria-invalid`],"aria-describedby":n[`aria-describedby`],"data-testid":n[`data-testid`]})},vm=e=>{let t=(0,V.c)(9),{children:n,onContentChange:r,disabled:a,validate:o,additionalButtons:s,...c}=e,{isAuthenticated:l}=rp(),[u,d]=(0,z.useState)(n),[f,p]=(0,z.useState)(0),m=u!==n,h;t[0]===n?h=t[1]:(h=()=>{d(n),p(ym)},t[0]=n,t[1]=h);let g=h,_;t[2]!==u||t[3]!==r?(_=()=>{r(u)},t[2]=u,t[3]=r,t[4]=_):_=t[4];let v=_,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>d(e.currentTarget.value??``),t[5]=y):y=t[5];let b=y,x=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!a&&w?(e.preventDefault(),v()):e.key===`Escape`&&(e.preventDefault(),g())},S,C;t[6]===n?(S=t[7],C=t[8]):(S=()=>{d(n),p(bm)},C=[n],t[6]=n,t[7]=S,t[8]=C),(0,z.useEffect)(S,C);let w=o?.(u)??!0;return(0,H.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-between gap-2`,role:`group`,"aria-label":`Content editor textarea`,children:[(0,H.jsx)(_m,{onChange:b,onKeyDown:x,variant:`invisible`,className:`size-full`,value:n,isActive:l,disabled:a,"aria-label":`Editable textarea content`,"aria-describedby":m||s?`content-editor-textarea-actions`:void 0,"aria-invalid":!w,...c},f),(m||s)&&(0,H.jsxs)(`div`,{id:`content-editor-textarea-actions`,className:`flex w-full items-center justify-end gap-2`,role:`group`,"aria-label":`Edit actions`,children:[m&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M,{Icon:i,label:`Save changes${w?``:` (invalid content)`}`,variant:`hoverable`,color:`text`,size:`icon-sm`,className:`cursor-pointer hover:scale-110`,disabled:a||!w,onClick:v,"aria-describedby":w?void 0:`textarea-validation-error`}),(0,H.jsx)(M,{Icon:pe,label:`Cancel changes`,variant:`hoverable`,size:`icon-sm`,color:`text`,className:`cursor-pointer hover:scale-110`,onClick:g,disabled:a})]}),s]})]},n)};function ym(e){return e+1}function bm(e){return e+1}var xm=(e,t,n)=>{let r={...e};for(let i of Object.keys(e))i===t?(r[n]=e[t],delete r[t]):r[i]=e[i];return r},Sm=({htmlFor:e,required:t=!1,disabled:n=!1,className:r,children:i,...a})=>(0,H.jsxs)(`label`,{className:R(`select-none font-medium text-sm leading-none`,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,n&&`cursor-not-allowed text-muted-foreground opacity-70`,r),htmlFor:e,suppressHydrationWarning:!0,...a,children:[i,t&&(0,H.jsx)(`span`,{className:`ml-1 text-error`,"aria-hidden":`true`,title:`This field is required`,children:`*`})]}),Cm=(0,z.createContext)({availableLocales:[],selectedLocales:[],setSelectedLocales:()=>{}}),wm=()=>(0,z.useContext)(Cm),Tm=e=>{let t=(0,V.c)(16),{availableLocales:n,defaultSelectedLocales:r,children:i}=e,{locale:a}=Ht(),s;t[0]!==r||t[1]!==a?(s=r??[a],t[0]=r,t[1]=a,t[2]=s):s=t[2];let[c,l]=o(`locale-content-selector-selected-locales`,s),u;t[3]!==n||t[4]!==r||t[5]!==a||t[6]!==c||t[7]!==l?(u=()=>{if(n.length&&!c?.some(e=>n.includes(e))){let e=r?.filter(e=>n.includes(e));l(e?.length?e:[a])}},t[3]=n,t[4]=r,t[5]=a,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=[n],t[9]=n,t[10]=d),(0,z.useEffect)(u,d);let f;return t[11]!==n||t[12]!==i||t[13]!==c||t[14]!==l?(f=(0,H.jsx)(Cm,{value:{availableLocales:n,selectedLocales:c,setSelectedLocales:l},children:i}),t[11]=n,t[12]=i,t[13]=c,t[14]=l,t[15]=f):f=t[15],f},Em=e=>{let t,n;if(typeof e==`number`||!Number.isNaN(Number(e)))t=`=`,n=e.toString();else if(typeof e==`string`){let r=[`<=`,`>=`,`<`,`>`,`=`].find(t=>e.startsWith(t));r&&(t=r,n=e.slice(r.length))}return{comparator:t,numberValue:n}},Dm=e=>{let t=(0,V.c)(13),{value:n,onChange:r}=e,i;t[0]===n?i=t[1]:(i=Em(n),t[0]=n,t[1]=i);let{comparator:a,numberValue:o}=i,[s,c]=(0,z.useState)(a??null),[l,u]=(0,z.useState)(o??null),d,f;t[2]!==s||t[3]!==a||t[4]!==o||t[5]!==l||t[6]!==r?(d=()=>{s&&l&&(s!==a||l!==o)&&r(`${s}${l}`)},f=[s,a,o,l,r],t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=r,t[7]=d,t[8]=f):(d=t[7],f=t[8]),(0,z.useEffect)(d,f);let p;if(t[9]!==a||t[10]!==l){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>u(e.target.value),t[12]=e):e=t[12],p=(0,H.jsxs)(`div`,{className:`flex gap-1`,children:[(0,H.jsxs)(L,{onValueChange:c,defaultValue:a,children:[(0,H.jsx)(L.Trigger,{className:`w-20`,children:(0,H.jsx)(L.Value,{placeholder:`Select a comparator`})}),(0,H.jsxs)(L.Content,{children:[(0,H.jsx)(L.Item,{value:`<`,children:`<`}),(0,H.jsx)(L.Item,{value:`<=`,children:`<=`}),(0,H.jsx)(L.Item,{value:`=`,children:`=`}),(0,H.jsx)(L.Item,{value:`>=`,children:`>=`}),(0,H.jsx)(L.Item,{value:`>`,children:`>`})]})]}),(0,H.jsx)(Ap,{type:`number`,"aria-label":`Quantity`,defaultValue:l??void 0,onChange:e,className:`min-w-4`})]}),t[9]=a,t[10]=l,t[11]=p}else p=t[11];return p},Om=({rawContent:e})=>{let[t,n]=(0,z.useState)(``);return(0,z.useEffect)(()=>{Ct(async()=>{let{default:e}=await import(`./purify.es-ChwZkWde.js`);return{default:e}},[]).then(({default:t})=>{n(t.sanitize(e))})},[e]),t?(0,H.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t}}):(0,H.jsx)(`div`,{})},km=(0,z.lazy)(()=>Ct(()=>import(`./MarkDownRender-CiKQVquM.js`).then(e=>({default:e.MarkdownRenderer})),__vite__mapDeps([0,1,2,3,4]))),Am=(0,z.lazy)(()=>Ct(()=>import(`./MarkdownEditor-QEPrPZ-E.js`).then(e=>({default:e.MarkdownEditor})),__vite__mapDeps([5,2,3,4,1,6]))),jm=(0,z.memo)(function(e){let t=(0,V.c)(2),{label:n,...r}=e,[i,a]=(0,z.useState)(!1),o;return t[0]===i?o=t[1]:(o=e=>{e&&!i&&a(!0)},t[0]=i,t[1]=o),(0,H.jsx)(gp,{header:n,label:n,onToggle:o,children:i?(0,H.jsx)(Xm,{...r}):null})}),Mm=e=>{let t=(0,V.c)(14),{keyPath:n,dictionary:r,...i}=e,{editedContent:a,addEditedContent:o}=Bf(),s=Rf(),{mutate:c,isPending:l}=sp(),u;t[0]!==o||t[1]!==r||t[2]!==n?(u=e=>o(r.localId,e,n),t[0]=o,t[1]=r,t[2]=n,t[3]=u):u=t[3];let d;return t[4]!==o||t[5]!==c||t[6]!==s?.ai?.apiKey||t[7]!==s?.ai?.model||t[8]!==s?.ai?.temperature||t[9]!==s?.internationalization||t[10]!==r||t[11]!==a||t[12]!==n?(d=()=>{c({fileContent:JSON.stringify({...r,...a?.[r.localId]??{}}),keyPath:n,locales:s?.internationalization.locales??[],aiOptions:{apiKey:s?.ai?.apiKey,model:s?.ai?.model,temperature:s?.ai?.temperature}},{onSuccess:e=>{if(e?.data)try{let t=e.data.fileContent;o(r.localId,t,n)}catch(e){console.error(e)}}})},t[4]=o,t[5]=c,t[6]=s?.ai?.apiKey,t[7]=s?.ai?.model,t[8]=s?.ai?.temperature,t[9]=s?.internationalization,t[10]=r,t[11]=a,t[12]=n,t[13]=d):d=t[13],(0,H.jsx)(vm,{variant:`default`,onContentChange:u,additionalButtons:(0,H.jsx)(M,{Icon:sc,label:`Audit`,variant:`hoverable`,size:`icon-sm`,color:`text`,className:`cursor-pointer hover:scale-110`,isLoading:l,onClick:d}),...i})},Nm=e=>{let t=(0,V.c)(4),{keyPath:n,dictionary:r,...i}=e,{addEditedContent:a}=Bf(),o;return t[0]!==a||t[1]!==r||t[2]!==n?(o=e=>a(r.localId,e,n),t[0]=a,t[1]=r,t[2]=n,t[3]=o):o=t[3],(0,H.jsx)($p,{variant:`default`,onContentChange:o,...i})},Pm=[{content:`False`,value:!1},{content:`True`,value:!0}],Fm=e=>{let t=(0,V.c)(4),{dictionary:n,keyPath:r,...i}=e,{addEditedContent:a}=Bf(),o;return t[0]!==a||t[1]!==n||t[2]!==r?(o=e=>a(n.localId,e,r),t[0]=a,t[1]=n,t[2]=r,t[3]=o):o=t[3],(0,H.jsx)(wp,{choices:Pm,value:!0,onChange:o,color:`text`,size:`sm`,...i})},Im=e=>{let t=(0,V.c)(15),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{locale:o,defaultLocale:s}=Ht(),{selectedLocales:c}=wm(),l=n[ge],u;if(t[0]!==l||t[1]!==s||t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a||t[6]!==c){let e;t[8]!==l||t[9]!==s||t[10]!==i||t[11]!==r||t[12]!==o||t[13]!==a?(e=e=>{let t=`${JSON.stringify(r)}-translation-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 w-full p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:At(e,o)})}),(0,H.jsx)(`tr`,{className:`flex`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:l[e]??Pt(l[s]),keyPath:[...r,{type:ge,key:e}],dictionary:i,renderSection:a})})})]},t)},t[8]=l,t[9]=s,t[10]=i,t[11]=r,t[12]=o,t[13]=a,t[14]=e):e=t[14],u=(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:c.map(e)})}),t[0]=l,t[1]=s,t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=c,t[7]=u}else u=t[7];return u},Lm=e=>{let t=(0,V.c)(19),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{addEditedContent:o}=Bf(),{addNewEnumeration:s,removeEnumeration:c}=F(`navigation-view`),l=n[h],u;t[0]===l?u=t[1]:(u=Object.keys(l),t[0]=l,t[1]=u);let d=u[0],f;if(t[2]!==o||t[3]!==s.label.value||t[4]!==s.text||t[5]!==l||t[6]!==i||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==a||t[11]!==n){let e;t[13]!==o||t[14]!==l||t[15]!==i||t[16]!==d||t[17]!==r?(e=()=>o(i.localId,Pt(l[d])??``,[...r,{type:h,key:`unknown`}]),t[13]=o,t[14]=l,t[15]=i,t[16]=d,t[17]=r,t[18]=e):e=t[18],f=(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:Object.keys(n[h]).map(e=>{let t=[...r,{type:h,key:e}],s=`${JSON.stringify(r)}-enumeration-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(`div`,{className:`flex flex-1`,children:(0,H.jsx)(M,{label:c.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-muted-foreground hover:text-error`,Icon:oc,onClick:()=>o(i.localId,void 0,t),children:c.text})})})}),(0,H.jsx)(`tr`,{className:`w-full p-2`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Dm,{value:e,onChange:t=>{let a=n[h],s=xm(a,e,t),c={...n,[h]:s};console.log(`newValue`,c),o(i.localId,c,r)}})})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Xm,{section:l[e]??Pt(l[d]),keyPath:t,dictionary:i,renderSection:a})})})]},s)})})}),(0,H.jsx)(M,{label:s.label.value,variant:`hoverable`,color:`neutral`,textAlign:`left`,isFullWidth:!0,onClick:e,Icon:nc,className:`m-2`,children:s.text})]}),t[2]=o,t[3]=s.label.value,t[4]=s.text,t[5]=l,t[6]=i,t[7]=d,t[8]=r,t[9]=c,t[10]=a,t[11]=n,t[12]=f}else f=t[12];return f},Rm=e=>{let t=(0,V.c)(19),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{addEditedContent:o}=Bf(),{addNewSelectCase:s,removeSelectCase:c}=F(`navigation-view`),l=n[C],u;t[0]===l?u=t[1]:(u=Object.keys(l),t[0]=l,t[1]=u);let d=u[0],f;if(t[2]!==o||t[3]!==s.label.value||t[4]!==s.text||t[5]!==l||t[6]!==i||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==a||t[11]!==n){let e;t[13]!==o||t[14]!==l||t[15]!==i||t[16]!==d||t[17]!==r?(e=()=>o(i.localId,Pt(l[d])??``,[...r,{type:C,key:`newCase`}]),t[13]=o,t[14]=l,t[15]=i,t[16]=d,t[17]=r,t[18]=e):e=t[18],f=(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:Object.keys(l).map(e=>{let t=[...r,{type:C,key:e}],s=`${JSON.stringify(r)}-select-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(`div`,{className:`flex flex-1`,children:(0,H.jsx)(M,{label:c.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-muted-foreground hover:text-error`,Icon:oc,onClick:()=>o(i.localId,void 0,t),children:c.text})})})}),(0,H.jsx)(`tr`,{className:`w-full p-2`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)($p,{"aria-label":`Edit case`,type:`text`,variant:`default`,onContentChange:t=>{let a={...n,[C]:xm(l,e,String(t))};o(i.localId,a,r)},children:e})})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Xm,{section:l[e]??Pt(l[d]),keyPath:t,dictionary:i,renderSection:a})})})]},s)})})}),(0,H.jsx)(M,{label:s.label.value,variant:`hoverable`,color:`neutral`,textAlign:`left`,isFullWidth:!0,onClick:e,Icon:nc,className:`m-2`,children:s.text})]}),t[2]=o,t[3]=s.label.value,t[4]=s.text,t[5]=l,t[6]=i,t[7]=d,t[8]=r,t[9]=c,t[10]=a,t[11]=n,t[12]=f}else f=t[12];return f},zm=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[N];return(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:[`true`,`false`,`fallback`].map(e=>{let a=`${JSON.stringify(t)}-condition-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:String(e)})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:i[e]??Pt(i.true),keyPath:[...t,{type:N,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},Bm=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[D];return(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:[`male`,`female`,`fallback`].map(e=>{let a=`${JSON.stringify(t)}-gender-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:String(e)})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:i[e]??Pt(i.male),keyPath:[...t,{type:D,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},Vm=[`zero`,`one`,`two`,`few`,`many`,`other`],Hm=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[_];return(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:Vm.map(e=>{let a=`${JSON.stringify(t)}-plural-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:e})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:i[e]??Pt(i.other),keyPath:[...t,{type:_,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},Um=e=>{let t=(0,V.c)(22),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{addEditedContent:o}=Bf(),{addNewElement:s,removeElement:c}=F(`navigation-view`),l;if(t[0]!==o||t[1]!==s.label.value||t[2]!==s.text||t[3]!==i||t[4]!==r||t[5]!==c||t[6]!==a||t[7]!==n){let e;t[9]!==o||t[10]!==i||t[11]!==r||t[12]!==c||t[13]!==a||t[14]!==n[0]?(e=(e,t)=>{let s=`${JSON.stringify(r)}-array-${t}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 w-full p-2`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs`,children:String(t)}),(0,H.jsx)(M,{label:c.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-muted-foreground hover:text-error`,onClick:()=>{let e=[...r,{type:k,key:t}];o(i.localId,void 0,e)},Icon:oc,children:c.text})]})})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:e??Pt(n[0]),keyPath:[...r,{type:k,key:t}],dictionary:i,renderSection:a})})})]},s)},t[9]=o,t[10]=i,t[11]=r,t[12]=c,t[13]=a,t[14]=n[0],t[15]=e):e=t[15];let u;t[16]!==o||t[17]!==i||t[18]!==r||t[19]!==n[0]||t[20]!==n.length?(u=()=>{let e=[...r,{type:k,key:n.length}];o(i.localId,Pt(n[0])??``,e,!1)},t[16]=o,t[17]=i,t[18]=r,t[19]=n[0],t[20]=n.length,t[21]=u):u=t[21],l=(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:n.map(e)})}),(0,H.jsx)(M,{label:s.label.value,variant:`hoverable`,color:`neutral`,textAlign:`left`,isFullWidth:!0,onClick:u,Icon:nc,children:s.text})]}),t[0]=o,t[1]=s.label.value,t[2]=s.text,t[3]=i,t[4]=r,t[5]=c,t[6]=a,t[7]=n,t[8]=l}else l=t[8];return l},Wm=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e,a=Object.keys(i)[0];return(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex flex-col gap-2`,children:Object.keys(i).map(e=>{let o=[...t,{type:ue,key:e}],s=i[e]??Pt(i[a]),c=`${JSON.stringify(t)}-object-${e}`;return typeof s!=`object`||!s?(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:String(e)})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Xm,{section:s,keyPath:o,dictionary:n,renderSection:r})})})]},c):(0,H.jsx)(`tr`,{className:`block w-full border-neutral/10 border-t py-1`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(jm,{label:Dt(e),section:s,keyPath:o,dictionary:n,renderSection:r})})},c)})})})},Gm=e=>{let t=(0,V.c)(5),{section:n,keyPath:r,dictionary:i}=e,[a,o]=(0,z.useState)(0),s;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n){let e=[{content:`Edit`,value:0},{content:`Preview`,value:1}],c=[...r,{type:ie}],l=n[ie];s=(0,H.jsxs)(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[(0,H.jsx)(wp,{choices:e,value:a,onChange:o,color:`text`,size:`sm`,className:`ml-auto`}),(0,H.jsx)(Zm,{section:l,keyPath:c,dictionary:i,renderSection:a===1?Qm:void 0})]}),t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=s}else s=t[4];return s},Km=e=>{let t=(0,V.c)(9),{section:n,keyPath:r,dictionary:i}=e,[a,o]=(0,z.useState)(0),{addEditedContent:s}=Bf(),c;if(t[0]!==s||t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==n){let e=[{content:`Edit`,value:0},{content:`Raw`,value:1},{content:`Preview`,value:2}],u=[...r,{type:l}],d=n.markdown??``,f;t[6]!==s||t[7]!==i?(f=(e,t)=>(0,H.jsx)(z.Suspense,{fallback:(0,H.jsx)(m,{}),children:(0,H.jsx)(Am,{defaultValue:e,onChange:e=>s(i.localId,e,t)},JSON.stringify(t))}),t[6]=s,t[7]=i,t[8]=f):f=t[8];let p=f,h=$m;c=(0,H.jsxs)(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[(0,H.jsx)(wp,{choices:e,value:a,onChange:o,color:`text`,size:`sm`,className:`ml-auto`}),(0,H.jsx)(Zm,{section:d,keyPath:u,dictionary:i,renderSection:a===0?p:a===2?h:void 0})]}),t[0]=s,t[1]=i,t[2]=r,t[3]=a,t[4]=n,t[5]=c}else c=t[5];return c},qm=({section:e,keyPath:t,...n})=>{let r=[...t,{type:it}],i=e[it];return(0,H.jsx)(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:(0,H.jsx)(Zm,{section:i,keyPath:r,...n})})},Jm=({section:e,keyPath:t,...n})=>{let r=[...t,{type:x}],i=e[x],{content:a}=e;return(0,H.jsxs)(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[(0,H.jsxs)(`span`,{className:`text-neutral text-sm`,children:[i,` `]}),(0,H.jsx)(Zm,{section:a,keyPath:r,...n})]})},Ym=e=>{let{keyPath:t,dictionary:n,renderSection:r,section:i,...a}=e,{addEditedContent:o}=Bf(),s=i[ce],c=[...t,{type:ce}];return(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-4 p-2`,children:[(0,H.jsx)(Sm,{children:`Dictionary key`}),(0,H.jsx)($p,{"aria-label":`Edit field`,type:`text`,variant:`default`,...a,onContentChange:e=>{o(n.localId,{...s,dictionaryKey:String(e)},c)},children:s.dictionaryKey??``}),(0,H.jsx)(Sm,{children:`Path (optional)`}),(0,H.jsx)($p,{"aria-label":`Edit field`,type:`text`,variant:`default`,...a,onContentChange:e=>{o(n.localId,{...s,path:e===``?void 0:e},c)},children:s.path??``})]})},Xm=(0,z.memo)(function(e){let t=(0,V.c)(85),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{tsxNotEditable:o}=F(`navigation-view`),s,c;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n||t[4]!==o){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=zt(n);if(e===`reactNode`){let e;t[7]===o?e=t[8]:(e=(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,H.jsx)(`span`,{children:`(React Node)`}),(0,H.jsx)(`span`,{className:`flex text-muted-foreground text-xs`,children:o})]}),t[7]=o,t[8]=e),c=e;break bb0}if(e===`nested`){let e;t[9]!==i||t[10]!==r||t[11]!==a||t[12]!==n?(e=(0,H.jsx)(Ym,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[9]=i,t[10]=r,t[11]=a,t[12]=n,t[13]=e):e=t[13],c=e;break bb0}if(e===`translation`){let e;t[14]!==i||t[15]!==r||t[16]!==a||t[17]!==n?(e=(0,H.jsx)(Im,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[14]=i,t[15]=r,t[16]=a,t[17]=n,t[18]=e):e=t[18],c=e;break bb0}if(e===`enumeration`){let e;t[19]!==i||t[20]!==r||t[21]!==a||t[22]!==n?(e=(0,H.jsx)(Lm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[19]=i,t[20]=r,t[21]=a,t[22]=n,t[23]=e):e=t[23],c=e;break bb0}if(e===`condition`){let e;t[24]!==i||t[25]!==r||t[26]!==a||t[27]!==n?(e=(0,H.jsx)(zm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[24]=i,t[25]=r,t[26]=a,t[27]=n,t[28]=e):e=t[28],c=e;break bb0}if(e===`select`){let e;t[29]!==i||t[30]!==r||t[31]!==a||t[32]!==n?(e=(0,H.jsx)(Rm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[29]=i,t[30]=r,t[31]=a,t[32]=n,t[33]=e):e=t[33],c=e;break bb0}if(e===`gender`){let e;t[34]!==i||t[35]!==r||t[36]!==a||t[37]!==n?(e=(0,H.jsx)(Bm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[34]=i,t[35]=r,t[36]=a,t[37]=n,t[38]=e):e=t[38],c=e;break bb0}if(e===`plural`){let e;t[39]!==i||t[40]!==r||t[41]!==a||t[42]!==n?(e=(0,H.jsx)(Hm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[39]=i,t[40]=r,t[41]=a,t[42]=n,t[43]=e):e=t[43],c=e;break bb0}if(e===`insertion`){let e;t[44]!==i||t[45]!==r||t[46]!==a||t[47]!==n?(e=(0,H.jsx)(qm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[44]=i,t[45]=r,t[46]=a,t[47]=n,t[48]=e):e=t[48],c=e;break bb0}if(e===`markdown`){let e;t[49]!==i||t[50]!==r||t[51]!==n?(e=(0,H.jsx)(Km,{dictionary:i,keyPath:r,section:n}),t[49]=i,t[50]=r,t[51]=n,t[52]=e):e=t[52],c=e;break bb0}if(e===`html`){let e;t[53]!==i||t[54]!==r||t[55]!==n?(e=(0,H.jsx)(Gm,{dictionary:i,keyPath:r,section:n}),t[53]=i,t[54]=r,t[55]=n,t[56]=e):e=t[56],c=e;break bb0}if(e===`file`){let e;t[57]!==i||t[58]!==r||t[59]!==a||t[60]!==n?(e=(0,H.jsx)(Jm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[57]=i,t[58]=r,t[59]=a,t[60]=n,t[61]=e):e=t[61],c=e;break bb0}if(e===`array`){let e;t[62]!==i||t[63]!==r||t[64]!==a||t[65]!==n?(e=(0,H.jsx)(Um,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[62]=i,t[63]=r,t[64]=a,t[65]=n,t[66]=e):e=t[66],c=e;break bb0}if(e===`object`){let e;t[67]!==i||t[68]!==r||t[69]!==a||t[70]!==n?(e=(0,H.jsx)(Wm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[67]=i,t[68]=r,t[69]=a,t[70]=n,t[71]=e):e=t[71],c=e;break bb0}if(e===`number`){let e;t[72]!==i||t[73]!==r||t[74]!==n?(e=(0,H.jsx)(`div`,{className:`w-full p-2`,children:(0,H.jsx)(Nm,{dictionary:i,keyPath:r,type:`number`,"aria-label":`Edit field`,children:n})}),t[72]=i,t[73]=r,t[74]=n,t[75]=e):e=t[75],c=e;break bb0}if(e===`text`){let e;t[76]!==i||t[77]!==r||t[78]!==a||t[79]!==n?(e=(0,H.jsx)(`div`,{className:`w-full p-2`,children:typeof a==`function`?a(n,r):(0,H.jsx)(Mm,{variant:`default`,"aria-label":`Edit field`,keyPath:r,dictionary:i,children:n})}),t[76]=i,t[77]=r,t[78]=a,t[79]=n,t[80]=e):e=t[80],c=e;break bb0}if(e===`boolean`){let e;t[81]!==i||t[82]!==r||t[83]!==n?(e=(0,H.jsx)(`div`,{className:`w-full p-2`,children:(0,H.jsx)(Fm,{dictionary:i,keyPath:r,value:n})}),t[81]=i,t[82]=r,t[83]=n,t[84]=e):e=t[84],c=e;break bb0}s=(0,H.jsxs)(`div`,{className:`w-full p-2`,children:[`Error. Format not supported.`,JSON.stringify(n,null,2),JSON.stringify(r,null,2),`NodeType : `,e]})}t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];return c===Symbol.for(`react.early_return_sentinel`)?s:c}),Zm=(0,z.memo)(function(e){return(0,H.jsx)(Ne,{border:!0,background:`none`,className:`top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky`,roundedSize:`2xl`,children:(0,H.jsx)(Xm,{...e})})});function Qm(e){return(0,H.jsx)(Om,{rawContent:e})}function $m(e){return(0,H.jsx)(z.Suspense,{fallback:(0,H.jsx)(m,{}),children:(0,H.jsx)(km,{children:e})})}var eh=Ze(`inline-flex items-center rounded-md border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{color:{primary:`border-primary bg-primary text-primary hover:bg-primary-500`,secondary:`border-secondary bg-secondary text-secondary hover:bg-secondary-300`,success:`border-success bg-success text-success hover:bg-success-500`,error:`border-error bg-error text-error hover:bg-error-500`,neutral:`border-neutral bg-neutral text-muted-foreground hover:bg-neutral-600`,light:`border-white bg-white text-white hover:bg-neutral-500`,dark:`border-neutral-800 bg-neutral-800 text-neutral-800 hover:bg-neutral-900`,text:`border-text bg-text text-foreground hover:opacity-80`,custom:``},variant:{default:`rounded-lg text-foreground-opposite`,none:`border-none bg-opacity-0 text-inherit hover:bg-opacity-0`,outline:`rounded-lg border-[1.3px] bg-opacity-0 hover:bg-opacity-30`,hoverable:`rounded-lg border-none bg-opacity-0 transition hover:bg-opacity-10`},size:{sm:`px-2 py-0.5 text-xs`,md:`px-2.5 py-0.5 text-xs`,lg:`px-3 py-1 text-sm`}},defaultVariants:{variant:`default`,color:`primary`,size:`md`}}),th=({className:e,variant:t=`default`,color:n=`primary`,size:r=`md`,children:i,clickable:a=!1,dismissible:o=!1,onClick:s,onDismiss:c,role:l,tabIndex:u,"aria-label":d,...f})=>{let p=a?`button`:`span`,m=e=>{a&&s&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s(e))},h=e=>{e.stopPropagation(),c?.()};return(0,H.jsxs)(p,{className:R(eh({variant:t,color:n,size:r}),a&&`cursor-pointer hover:opacity-80 focus-visible:ring-2 focus-visible:ring-offset-2`,o&&`pr-1`,e),onClick:a?s:void 0,onKeyDown:a?m:void 0,role:l||(a?`button`:`status`),tabIndex:a?u??0:u,"aria-label":d||(a?`${i} button`:void 0),...f,children:[i,o&&(0,H.jsx)(`button`,{type:`button`,className:`ml-1 inline-flex h-4 w-4 items-center justify-center rounded-full hover:bg-black/10 focus:outline-none focus:ring-1 focus:ring-offset-1`,onClick:h,"aria-label":`Remove ${i} badge`,children:(0,H.jsxs)(`svg`,{className:`size-3`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-label":`Remove badge`,children:[(0,H.jsx)(`title`,{children:`Remove badge`}),(0,H.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`})]})})]})},nh=Object.defineProperty,rh=(e,t)=>nh(e,`name`,{value:t,configurable:!0}),ih=`Dialog`,[ah,oh]=$e(ih),[sh,ch]=ah(ih),lh=rh(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=z.useRef(null),c=z.useRef(null),[l,u]=Me({prop:r,defaultProp:i??!1,onChange:a,caller:ih}),[f,p]=z.useState(0),[m,h]=z.useState(0);return(0,H.jsx)(sh,{scope:t,triggerRef:s,contentRef:c,contentId:d(),titleId:d(),descriptionId:d(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:h,open:l,onOpenChange:u,onOpenToggle:z.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),uh=`DialogPortal`,[dh,fh]=ah(uh,{forceMount:void 0}),ph=rh(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=ch(uh,t);return(0,H.jsx)(dh,{scope:t,forceMount:n,children:z.Children.map(r,e=>(0,H.jsx)(ve,{present:n||a.open,children:(0,H.jsx)(Be,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),mh=`DialogOverlay`,hh=z.forwardRef(rh(function(e,t){let n=fh(mh,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ch(mh,e.__scopeDialog);return a.modal?(0,H.jsx)(ve,{present:r||a.open,children:(0,H.jsx)(_h,{...i,ref:t})}):null},`DialogOverlay`)),gh=_e(`DialogOverlay.RemoveScroll`),_h=z.forwardRef(rh(function(e,t){let{__scopeDialog:n,...r}=e,i=ch(mh,n),a=Se(),o=ye(t,a);return(0,H.jsx)(ke,{as:gh,allowPinchZoom:!0,shards:[i.contentRef],children:(0,H.jsx)(He.div,{"data-state":Ch(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),vh=`DialogContent`,yh=z.forwardRef(rh(function(e,t){let n=fh(vh,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ch(vh,e.__scopeDialog);return(0,H.jsx)(ve,{present:r||a.open,children:a.modal?(0,H.jsx)(bh,{...i,ref:t}):(0,H.jsx)(xh,{...i,ref:t})})},`DialogContent`)),bh=z.forwardRef(rh(function(e,t){let n=ch(vh,e.__scopeDialog),r=z.useRef(null),i=ye(t,n.contentRef,r);return z.useEffect(()=>{let e=r.current;if(e)return De(e)},[]),(0,H.jsx)(Sh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:tt(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:tt(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:tt(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),xh=z.forwardRef(rh(function(e,t){let n=ch(vh,e.__scopeDialog),r=z.useRef(!1),i=z.useRef(!1);return(0,H.jsx)(Sh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Sh=z.forwardRef(rh(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=ch(vh,n);return Fe(),(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(j,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Le,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Ch(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function Ch(e){return e?`open`:`closed`}rh(Ch,`getState`);var wh=1,Th=.9,Eh=.8,Dh=.17,Oh=.1,kh=.999,Ah=.9999,jh=.99,Mh=/[\\\/_+.#"@\[\(\{&]/,Nh=/[\\\/_+.#"@\[\(\{&]/g,Ph=/[\s-]/,Fh=/[\s-]/g;function Ih(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?wh:jh;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Ih(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=wh:Mh.test(e.charAt(l-1))?(d*=Eh,p=e.slice(i,l-1).match(Nh),p&&i>0&&(d*=kh**+p.length)):Ph.test(e.charAt(l-1))?(d*=Th,m=e.slice(i,l-1).match(Fh),m&&i>0&&(d*=kh**+m.length)):(d*=Dh,i>0&&(d*=kh**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Ah)),(d<Oh&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Ih(e,t,n,r,l+1,a+2,o),f*Oh>d&&(d=f*Oh)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Lh(e){return e.toLowerCase().replace(Fh,` `)}function Rh(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Ih(e,t,Lh(e),Lh(t),0,0,{})}var zh=`[cmdk-group=""]`,Bh=`[cmdk-group-items=""]`,Vh=`[cmdk-group-heading=""]`,Hh=`[cmdk-item=""]`,Uh=`${Hh}:not([aria-disabled="true"])`,Wh=`cmdk-item-select`,Gh=`data-value`,Kh=(e,t,n)=>Rh(e,t,n),qh=z.createContext(void 0),Jh=()=>z.useContext(qh),Yh=z.createContext(void 0),Xh=()=>z.useContext(Yh),Zh=z.createContext(void 0),Qh=z.forwardRef((e,t)=>{let n=fg(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=fg(()=>new Set),i=fg(()=>new Map),a=fg(()=>new Map),o=fg(()=>new Set),s=ug(e),{label:c,children:l,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=d(),b=d(),x=d(),S=z.useRef(null),C=hg();dg(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),dg(()=>{C(6,ee)},[]);let w=z.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=A()?.id,w.emit()}),r||C(5,ee),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=z.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??Kh;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Bh);t?t.appendChild(e.parentElement===t?e:e.closest(`${Bh} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Bh} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${zh}[${Gh}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Gh);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function ee(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(zh)?.querySelector(Vh))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return S.current?.querySelector(`${Hh}[aria-selected="true"]`)}function j(){return Array.from(S.current?.querySelectorAll(Uh)||[])}function te(e){let t=j()[e];t&&w.setState(`value`,t.getAttribute(Gh))}function M(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(Gh))}function N(e){let t=A()?.closest(zh),n;for(;t&&!n;)t=e>0?cg(t,zh):lg(t,zh),n=t?.querySelector(Uh);n?w.setState(`value`,n.getAttribute(Gh)):M(e)}let P=()=>te(j().length-1),ne=e=>{e.preventDefault(),e.metaKey?P():e.altKey?N(1):M(1)},re=e=>{e.preventDefault(),e.metaKey?te(0):e.altKey?N(-1):M(-1)};return z.createElement(He.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:_&&e.ctrlKey&&ne(e);break;case`ArrowDown`:ne(e);break;case`p`:case`k`:_&&e.ctrlKey&&re(e);break;case`ArrowUp`:re(e);break;case`Home`:e.preventDefault(),te(0);break;case`End`:e.preventDefault(),P();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Wh);t.dispatchEvent(e)}}}}},z.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:vg},c),_g(e,e=>z.createElement(Yh.Provider,{value:w},z.createElement(qh.Provider,{value:T},e))))}),$h=z.forwardRef((e,t)=>{let n=d(),r=z.useRef(null),i=z.useContext(Zh),a=Jh(),o=ug(e),s=o.current?.forceMount??i?.forceMount;dg(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=mg(n,r,[e.value,e.children,r],e.keywords),l=Xh(),u=pg(e=>e.value&&e.value===c.current),f=pg(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);z.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Wh,p),()=>t.removeEventListener(Wh,p)},[f,e.onSelect,e.disabled]);function p(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function m(){l.setState(`value`,c.current,!0)}if(!f)return null;let{disabled:h,value:g,onSelect:_,forceMount:v,keywords:y,...b}=e;return z.createElement(He.div,{ref:nt(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:p},e.children)}),eg=z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=d(),s=z.useRef(null),c=z.useRef(null),l=d(),u=Jh(),f=pg(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));dg(()=>u.group(o),[]),mg(o,s,[e.value,e.heading,c]);let p=z.useMemo(()=>({id:o,forceMount:i}),[i]);return z.createElement(He.div,{ref:nt(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},n&&z.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),_g(e,e=>z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},z.createElement(Zh.Provider,{value:p},e))))}),tg=z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=z.useRef(null),a=pg(e=>!e.search);return!n&&!a?null:z.createElement(He.div,{ref:nt(i,t),...r,"cmdk-separator":``,role:`separator`})}),ng=z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Xh(),o=pg(e=>e.search),s=pg(e=>e.selectedItemId),c=Jh();return z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),z.createElement(He.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),rg=z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=z.useRef(null),o=z.useRef(null),s=pg(e=>e.selectedItemId),c=Jh();return z.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),z.createElement(He.div,{ref:nt(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},_g(e,e=>z.createElement(`div`,{ref:nt(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),ig=z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return z.createElement(lh,{open:n,onOpenChange:r},z.createElement(ph,{container:o},z.createElement(hh,{"cmdk-overlay":``,className:i}),z.createElement(yh,{"aria-label":e.label,"cmdk-dialog":``,className:a},z.createElement(Qh,{ref:t,...s}))))}),ag=z.forwardRef((e,t)=>pg(e=>e.filtered.count===0)?z.createElement(He.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),og=z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return z.createElement(He.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},_g(e,e=>z.createElement(`div`,{"aria-hidden":!0},e)))}),sg=Object.assign(Qh,{List:rg,Item:$h,Input:ng,Group:eg,Separator:tg,Dialog:ig,Empty:ag,Loading:og});function cg(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function lg(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ug(e){let t=z.useRef(e);return dg(()=>{t.current=e}),t}var dg=typeof window>`u`?z.useEffect:z.useLayoutEffect;function fg(e){let t=z.useRef();return t.current===void 0&&(t.current=e()),t}function pg(e){let t=Xh(),n=()=>e(t.snapshot());return z.useSyncExternalStore(t.subscribe,n,n)}function mg(e,t,n,r=[]){let i=z.useRef(),a=Jh();return dg(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Gh,s),i.current=s}),i}var hg=()=>{let[e,t]=z.useState(),n=fg(()=>new Map);return dg(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function gg(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function _g({asChild:e,children:t},n){return e&&z.isValidElement(t)?z.cloneElement(gg(t),{ref:t.ref},n(t.props.children)):n(t)}var vg={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},yg=({className:e,...t})=>(0,H.jsx)(sg,{className:R(`flex flex-col overflow-hidden rounded-md px-3 py-2`,e),...t}),bg=({children:e,...t})=>(0,H.jsx)(lh,{...t,children:(0,H.jsx)(yh,{className:`overflow-hidden p-0`,children:(0,H.jsx)(yg,{className:`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]_svg]:size-5`,children:e})})}),xg=({className:e,...t})=>(0,H.jsxs)(`div`,{className:R(`flex flex-1 items-center gap-2 px-3 py-2`,`rounded-2xl supports-[corner-shape:squircle]:rounded-4xl`,`bg-neutral-50 dark:bg-neutral-950`,`ring-1 ring-neutral-100 dark:ring-neutral-700`,`transition-shadow duration-100 focus-within:ring-3 hover:ring-3`,e),"cmdk-input-wrapper":``,children:[(0,H.jsx)(ac,{className:`size-4 shrink-0 opacity-50`}),(0,H.jsx)(sg.Input,{className:`flex-1 bg-transparent text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,...t})]}),Sg=({className:e,...t})=>(0,H.jsx)(sg.List,{className:R(`max-h-75 overflow-y-auto overflow-x-hidden`,e),...t}),Cg=e=>(0,H.jsx)(sg.Empty,{className:`py-6 text-center text-sm`,...e}),wg=({className:e,...t})=>(0,H.jsx)(sg.Group,{className:R(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs`,e),...t}),Tg=({className:e,...t})=>(0,H.jsx)(sg.Separator,{className:R(`-mx-1 h-px bg-border`,e),...t}),Eg=({className:e,...t})=>(0,H.jsx)(sg.Item,{className:R(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50`,e),...t}),Dg=({className:e,...t})=>(0,H.jsx)(`span`,{className:R(`ml-auto text-muted-foreground text-xs tracking-widest`,e),...t}),Og={...yg,Dialog:bg,Input:xg,List:Sg,Empty:Cg,Group:wg,Separator:Tg,Item:Eg,Shortcut:Dg},kg=(0,z.createContext)(null),Ag=()=>{let e=(0,z.useContext)(kg);if(!e)throw Error(`useMultiSelect must be used within MultiSelectProvider`);return e},jg=({values:e,defaultValues:t,onValueChange:n,loop:r=!1,className:i,children:a,dir:o,...s})=>{let[c,l]=(0,z.useState)(t??[]),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(-1),g=(0,z.useRef)(null),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(``);(0,z.useEffect)(()=>{e&&l(e)},[e]);let x=(0,z.useCallback)(e=>{if(c.includes(e)){let t=c.filter(t=>t!==e);l(t),n?.(t)}else{let t=[...c,e];l(t),n?.(t)}},[c]),S=(0,z.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=t.value.substring(t.selectionStart??0,t.selectionEnd??0);b(n),v(n===u)},[u]),C=(0,z.useCallback)(e=>{e.stopPropagation();let t=g.current;if(!t)return;let n=()=>{let e=m+1;h(e>c.length-1?r?0:-1:e)},i=()=>{let e=m-1;h(e<0?c.length-1:e)},a=()=>{let e=m-1<=0?c.length-1==0?-1:0:m-1;h(e)};switch(e.key){case`ArrowLeft`:o===`rtl`?c.length>0&&(m!==-1||r)&&n():c.length>0&&t.selectionStart===0&&i();break;case`ArrowRight`:o===`rtl`?c.length>0&&t.selectionStart===0&&i():c.length>0&&(m!==-1||r)&&n();break;case`Backspace`:case`Delete`:c.length>0&&(m!==-1&&m<c.length?(x(c[m]),a()):(t.selectionStart===0&&y===u||_)&&x(c[c.length-1]));break;case`Enter`:p(!0);break;case`Escape`:m===-1?f&&p(!1):h(-1)}},[c,u,m,r]),w=(0,z.useMemo)(()=>({value:c,onValueChange:x,open:f,setOpen:p,inputValue:u,setInputValue:d,activeIndex:m,setActiveIndex:h,ref:g,handleSelect:S}),[c,x,f,p,u,d,m,h,g,S]);return(0,H.jsx)(kg,{value:w,children:(0,H.jsx)(yg,{onKeyDown:C,className:R(`flex w-full flex-col gap-2 overflow-visible bg-transparent`,i),dir:o,...s,children:a})})},Mg=({className:e,getBadgeValue:t=e=>e,validationStyleEnabled:n=!1,children:r,...i})=>{let{value:a,onValueChange:o,activeIndex:s}=Ag(),c=(0,z.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return(0,H.jsxs)(`div`,{className:R(`flex w-full flex-col gap-3`,`cursor-pointer select-text text-base shadow-none outline-none md:text-sm`,`rounded-xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl`,`px-2 py-3 md:py-2`,`bg-neutral-50 dark:bg-neutral-950`,`text-foreground`,`ring-0`,`focus-within:outline-none`,`focus-within:ring-3`,`focus-within:ring-neutral-200`,`dark:focus-within:ring-neutral-500`,`focus-within:ring-offset-white`,`dark:focus-within:ring-offset-neutral-500`,`[box-shadow:none]`,`disabled:cursor-not-allowed disabled:opacity-50`,`aria-invalid:border-error`,n&&`valid:border-success invalid:border-error`,e),...i,children:[a.length>0&&(0,H.jsx)(`div`,{className:`flex w-full flex-wrap gap-1`,children:a.map((e,n)=>(0,H.jsxs)(th,{className:R(`flex items-center gap-1 rounded-xl px-1`,s===n&&`ring-2 ring-muted-foreground`),color:`text`,children:[(0,H.jsx)(`span`,{className:`text-xs`,children:t(e)}),(0,H.jsxs)(`button`,{"aria-label":`Remove ${e} option`,"aria-roledescription":`button to remove option`,onMouseDown:c,onClick:()=>o(e),children:[(0,H.jsxs)(`span`,{className:`sr-only`,children:[`Remove `,e,` option`]}),(0,H.jsx)(pe,{className:`size-4 cursor-pointer`})]})]},e))}),r]})},Ng=e=>{let t=(0,V.c)(5),{className:n,...r}=e,{setOpen:i,inputValue:a,setInputValue:o,activeIndex:s,setActiveIndex:c,handleSelect:l,ref:u}=Ag(),d,f;t[0]===i?(d=t[1],f=t[2]):(d=()=>i(!1),f=()=>i(!0),t[0]=i,t[1]=d,t[2]=f);let p;return t[3]===c?p=t[4]:(p=()=>c(-1),t[3]=c,t[4]=p),(0,H.jsx)(Og.Input,{...r,tabIndex:0,ref:u,value:a,onValueChange:s===-1?o:void 0,onSelect:l,onBlur:d,onFocus:f,onClick:p,className:R(`ml-2 flex-1 cursor-pointer outline-hidden`,n,s!==-1&&`caret-transparent`)})},Pg=e=>{let t=(0,V.c)(2),{children:n}=e,{open:r}=Ag(),i=r&&n,a;return t[0]===i?a=t[1]:(a=(0,H.jsx)(`div`,{className:`relative`,children:i}),t[0]=i,t[1]=a),a},Fg=({className:e,children:t})=>(0,H.jsxs)(Og.List,{className:R(`absolute top-0 z-10 flex w-full flex-col gap-2`,`rounded-xl p-2 shadow-md`,`bg-white dark:bg-neutral-950`,`text-foreground`,`border border-neutral-200 dark:border-neutral-800`,`transition-colors`,e),children:[t,(0,H.jsx)(Og.Empty,{children:(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`No results found`})})]}),Ig=e=>{let t=(0,V.c)(4),{className:n,value:r,children:a,...o}=e,{value:s,onValueChange:c,setInputValue:l}=Ag(),u=Rg,d=s.includes(r),f;return t[0]!==c||t[1]!==l||t[2]!==r?(f=()=>{c(r),l(``)},t[0]=c,t[1]=l,t[2]=r,t[3]=f):f=t[3],(0,H.jsxs)(Og.Item,{...o,onSelect:f,className:R(`flex cursor-pointer justify-between`,`rounded-lg px-2 py-1`,`transition-colors`,`hover:bg-neutral/10`,d&&`opacity-50`,o.disabled&&`cursor-not-allowed opacity-50`,n),onMouseDown:u,children:[a,d&&(0,H.jsx)(i,{className:`size-4`})]})},Lg=jg;Lg.Trigger=Mg,Lg.Input=Ng,Lg.Content=Pg,Lg.List=Fg,Lg.Item=Ig;function Rg(e){e.preventDefault(),e.stopPropagation()}var zg=e=>{let{id:t,...n}=e,r=(0,z.useId)(),i=t??r;return(0,H.jsx)(Bg,{value:{id:i},children:(0,H.jsx)(`div`,{className:`flex flex-col gap-2 p-2`,id:i,suppressHydrationWarning:!0,...n})})},Bg=(0,z.createContext)({}),Vg=e=>e.type===`checkbox`,Hg=e=>e.type===`file`,Ug=e=>e instanceof Date,Wg=e=>e==null,Gg=e=>typeof e==`object`,Kg=e=>!Wg(e)&&!Array.isArray(e)&&Gg(e)&&!Ug(e),qg=e=>Kg(e)&&e.target?Vg(e.target)?e.target.checked:Hg(e.target)?e.target.files:e.target.value:e,Jg=/[.[\]'"]/,Yg=e=>e.split(Jg).filter(Boolean);function Xg(e,t){let n=Yg(t),r=e._formValues,i=e._defaultValues;for(let e=0;e<n.length-1;e++){let t=n[e];if(r=r==null?r:r[t],i=i==null?i:i[t],r===null||i===null)return null}}var Zg=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),Qg=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function $g(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(Qg&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&e.constructor!==Object)return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=$g(e[t]));return r}var e_={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},t_={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},n_={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},r_=`root`,i_=[`__proto__`,`constructor`,`prototype`],a_=/^\w*$/,o_=e=>a_.test(e),s_=e=>e===void 0,X=(e,t,n)=>{if(!t||!Kg(e))return n;let r=o_(t)?[t]:Yg(t);if(r.some(e=>i_.includes(e)))return n;let i=r.reduce((e,t)=>Wg(e)?void 0:e[t],e);return s_(i)||i===e?s_(e[t])?n:e[t]:i},c_=e=>typeof e==`boolean`,l_=e=>typeof e==`function`,u_=(e,t,n)=>{let r=-1,i=o_(t)?[t]:Yg(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=Kg(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(i_.includes(t))return;e[t]=a,e=e[t]}},d_=z.createContext(null);d_.displayName=`HookFormControlContext`;var f_=()=>z.useContext(d_),p_=(e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==t_.all&&(t._proxyFormState[i]=!r||t_.all),n&&(n[i]=!0),e[i]}});return i},m_=Qg?z.useLayoutEffect:z.useEffect,h_=e=>{let t=e.constructor&&e.constructor.prototype;return Kg(t)&&t.hasOwnProperty(`isPrototypeOf`)},g_=e=>Wg(e)||!Gg(e),__=(e,t)=>t.length===0&&!Array.isArray(e)&&!h_(e);function v_(e,t,n=new WeakMap){if(e===t)return!0;if(g_(e)||g_(t))return Object.is(e,t);if(Ug(e)&&Ug(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(__(e,r)||__(t,i))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;let a=n.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{let r=new WeakSet;r.add(t),n.set(e,r)}for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(Ug(r)&&Ug(e)||(Kg(r)||Array.isArray(r))&&(Kg(e)||Array.isArray(e))?!v_(r,e,n):!Object.is(r,e))return!1}}return!0}function y_(e){let t=z.useRef(!1),n=z.useRef(!1),r=z.useRef(void 0),i=z.useRef(0);return i.current++,!n.current&&e&&(n.current=!0,r.current=$g(e())),{resyncIfNeeded:z.useCallback((e,a,o)=>{if(e&&(t.current||n.current&&i.current>1)){let e=a();v_(r.current,e)||o(e)}t.current=!0},[]),snapshot:z.useCallback((e,t)=>{e&&(r.current=$g(t()))},[])}}function b_(e){let t=f_(),{control:n=t,disabled:r,name:i,exact:a}=e||{},o=()=>({...n._formState,defaultValues:n._defaultValues}),[s,c]=z.useState(o),l=z.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:u,snapshot:d}=y_(o);return m_(()=>{u(!r,o,c);let e=n._subscribe({name:i,formState:l.current,exact:a,callback:e=>{!r&&c({...n._formState,...e,defaultValues:n._defaultValues})}});return()=>{e(),d(!r,o)}},[i,r,a,u,d]),z.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),z.useMemo(()=>p_(s,n,l.current,!1),[s,n])}var x_=e=>typeof e==`string`,S_=(e,t,n,r,i)=>x_(e)?(r&&t.watch.add(e),X(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),X(n,e,X(i,e)))):(r&&(t.watchAll=!0),n);function C_(e){let t=f_(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=z.useRef(i),l=z.useRef(s),u=z.useRef(void 0),d=z.useRef(n),f=z.useRef(r);l.current=s;let p=()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e},[m,h]=z.useState(p),g=z.useCallback(e=>{let t=S_(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),_=z.useCallback(e=>{if(!a){let t=S_(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);v_(e,u.current)||(h(e),u.current=e)}else h(t)}},[n._formValues,n._names,a,r]),{resyncIfNeeded:v,snapshot:y}=y_(p),b=z.useRef(_);b.current=_;let x=z.useRef(g);x.current=g,m_(()=>{d.current!==n||!v_(f.current,r)?(d.current=n,f.current=r,b.current()):v(!a,()=>x.current(),e=>{h(e),u.current=e});let e=n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{b.current(e.values)}});return()=>{e(),y(!a,()=>x.current())}},[n,o,r,a,v,y]),z.useEffect(()=>n._removeUnmounted());let S=d.current!==n,C=f.current;return z.useMemo(()=>{if(a)return!1;let e=!S&&!v_(C,r);return S||e},[a,S,r,C])?g():m}function w_(e){let t=f_(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=Zg(i._names.array,n),l=C_({control:i,name:n,defaultValue:z.useMemo(()=>{let e=X(i._formValues,n,X(i._defaultValues,n,o));return s_(e)?Xg(i,n):e},[i,n,o]),exact:s}),u=b_({control:i,name:n,exact:s}),d=z.useRef(e),f=z.useRef(null),p=z.useRef(i.register(n,{...e.rules,value:l,...c_(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=z.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!X(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!X(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!X(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!X(u.validatingFields,n)},error:{enumerable:!0,get:()=>X(u.errors,n)}}),[u,n]),h=z.useCallback(e=>{let t=qg(e);return X(i._fields,n)||(p.current=i.register(n,{...d.current.rules,value:t})),p.current.onChange({target:{value:qg(e),name:n},type:e_.CHANGE})},[n,i]),g=z.useCallback(()=>p.current.onBlur({target:{value:X(i._formValues,n),name:n},type:e_.BLUR}),[n,i._formValues]),_=z.useCallback(e=>{e&&(f.current={focus:()=>l_(e.focus)&&e.focus(),select:()=>l_(e.select)&&e.select(),setCustomValidity:t=>l_(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>l_(e.reportValidity)&&e.reportValidity()});let t=X(i._fields,n);t&&t._f&&e&&(t._f.ref=f.current)},[i._fields,n]),v=z.useMemo(()=>({name:n,value:l,...c_(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:g,ref:_}),[n,r,u.disabled,h,g,_,l]);return z.useEffect(()=>{let e=i._options.shouldUnregister||a;p.current=i.register(n,{...d.current.rules,...c_(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=X(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=$g(X(a?i._defaultValues:i._options.values||i._defaultValues,n,X(i._options.defaultValues,n,d.current.defaultValue)));u_(i._defaultValues,n,e),s_(X(i._formValues,n))&&u_(i._formValues,n,e)}if(!c&&i.register(n),f.current){let e=X(i._fields,n);e&&e._f&&(e._f.ref=f.current)}return()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),z.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),z.useMemo(()=>({field:v,formState:u,fieldState:m}),[v,u,m])}var T_=e=>e.render(w_(e)),E_=e=>({isOnSubmit:!e||e===t_.onSubmit,isOnBlur:e===t_.onBlur,isOnChange:e===t_.onChange,isOnAll:e===t_.all,isOnTouch:e===t_.onTouched}),D_=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let n of t.watch)if(e.startsWith(n)&&e.charAt(n.length)===`.`)return!0;return!1},O_=(e,t,n,r)=>{for(let i of n||Object.keys(e)){if(i===`_f`)continue;let a=n?X(e,i):e[i];if(a){let{_f:e}=a;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(O_(a,t))break}else if((Kg(a)||Array.isArray(a))&&O_(a,t))break}}},k_=(e,t,n)=>{let r=X(e,n),i=Array.isArray(r)?r:[];return u_(i,r_,t[n]),u_(e,n,i),e},A_=e=>Kg(e)&&!Object.keys(e).length,j_=e=>{if(!Qg)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},M_=e=>e.type===`radio`,N_=e=>e instanceof RegExp,P_=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},F_={value:!1,isValid:!1},I_={value:!0,isValid:!0},L_=e=>{if(!Array.isArray(e))return F_;if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}let t=e[0];return!t||!t.checked||t.disabled?F_:!t.attributes||!(`value`in t.attributes)||s_(t.value)||t.value===``?I_:{value:t.value,isValid:!0}},R_={isValid:!1,value:null},z_=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,R_):R_;function B_(e,t,n=`validate`){if(x_(e)||Array.isArray(e)&&e.every(x_)||c_(e)&&!e)return{type:n,message:x_(e)?e:``,ref:t}}var V_=e=>Kg(e)&&!N_(e)?e:{value:e,message:``},H_=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=X(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{if(i&&y.reportValidity){let t=c_(e)?``:e||``;s?s.forEach(e=>e.setCustomValidity(t)):y.setCustomValidity(t),y.reportValidity()}},x={},S=M_(o),C=Vg(o),w=S||C,T=(g||Hg(o))&&s_(o.value)&&s_(v)||j_(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=P_.bind(null,h,r,x),D=(e,t,n,r=n_.maxLength,i=n_.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||Wg(v))||c_(v)&&!v||C&&!L_(s).isValid||S&&!z_(s).isValid)){let{value:e,message:t}=x_(c)?{value:!!c,message:c}:V_(c);if(e&&(x[h]={type:n_.required,message:t,ref:y,...E(n_.required,t)},!r))return b(t),x}if(!T&&(!Wg(d)||!Wg(f))){let e,t,n=V_(f),i=V_(d);if(!Wg(v)&&!Ug(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;Wg(n.value)||(e=r>n.value),Wg(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;x_(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),x_(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,n_.max,n_.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(x_(v)||a&&Array.isArray(v))){let e=V_(l),t=V_(u),n=!Wg(e.value)&&v.length>+e.value,i=!Wg(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&x_(v)){let{value:e,message:t}=V_(p);if(N_(e)&&!v.match(e)&&(x[h]={type:n_.pattern,message:t,ref:o,...E(n_.pattern,t)},!r))return b(t),x}if(m){if(l_(m)){let e=B_(await m(v,n),y);if(e&&(x[h]={...e,...E(n_.validate,e.message)},!r))return b(e.message),x}else if(Kg(m)){let e={};for(let t in m){if(!A_(e)&&!r)break;let i=B_(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!A_(e)&&(x[h]={ref:y,...e},!r))return x}}let O=x[h];return b(!O||O.message),x},U_=e=>Array.isArray(e)?e:[e],W_=e=>Array.isArray(e)?e.filter(Boolean):[];function G_(e,t){let n=t.length-1,r=0;for(;r<n;){if(Wg(e)){e=void 0;break}e=e[t[r]],r++}return e}function K_(e){for(let t in e)if(e.hasOwnProperty(t)&&!s_(e[t]))return!1;return!0}function q_(e,t){if(x_(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:o_(t)?[t]:Yg(t);if(n.some(e=>i_.includes(String(e))))return e;let r=n.length===1?e:G_(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(Kg(r)&&A_(r)||Array.isArray(r)&&K_(r))&&q_(e,n.slice(0,-1)),e}var J_=z.createContext(null);J_.displayName=`HookFormContext`;var Y_=()=>z.useContext(J_),X_=({children:e,watch:t,getValues:n,getErrors:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:c,trigger:l,formState:u,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y})=>{let b=z.useMemo(()=>({watch:t,getValues:n,getErrors:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:c,trigger:l,formState:u,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y}),[o,g,u,r,i,n,m,_,f,p,d,a,v,s,c,y,l,h,t]);return z.createElement(J_.Provider,{value:b},z.createElement(d_.Provider,{value:b.control},e))},Z_=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function Q_(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&Kg(i)&&a){let e=Q_(i,a);Kg(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var $_=(e,t)=>e!==null&&Gg(e)&&Object.prototype.hasOwnProperty.call(e,t),ev=(e,t)=>{if(!t)return!1;let n=e;for(let r of o_(t)?[t]:Yg(t)){if(!$_(n,r))return $_(e,t);n=n[r]}return!0},tv=e=>e.type===`select-multiple`,nv=e=>M_(e)||Vg(e),rv=e=>j_(e)&&e.isConnected;function iv(e){return Array.isArray(e)||Kg(e)}function av(e,t,n=``,r=[]){for(let i in e){let a=n?`${n}.${i}`:i,o=e[i];iv(o)&&iv(X(t,a))?av(o,t,a,r):r.push(a)}return r}var ov=e=>{for(let t in e)if(l_(e[t]))return!0;return!1};function sv(e){return Array.isArray(e)||Kg(e)&&!ov(e)}function cv(e){return!!(e&&`_f`in e)}function lv(e){return Array.isArray(e)?!e.some(e=>!s_(e)):!Object.keys(e).length}function uv(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function dv(e,t={},n){for(let r in e){let i=e[r],a=n&&n[r];sv(i)&&(!Array.isArray(i)||!cv(a))?(t[r]=Array.isArray(i)?[]:{},dv(i,t[r],a),lv(t[r])&&uv(t,r)):s_(i)||(t[r]=!0)}return t}function fv(e,t,n,r){n||=dv(t,{},r);for(let i in e){let a=e[i],o=r&&r[i];sv(a)&&(!Array.isArray(a)||!cv(o))?(s_(t)||g_(n[i])?n[i]=dv(a,Array.isArray(a)?[]:{},o):fv(a,Wg(t)?{}:t[i],n[i],o),lv(n[i])&&uv(n,i)):v_(a,t[i])?uv(n,i):n[i]=!0}return n}var pv=(e,t)=>{let n=t.split(`.`),r=[],i=n[0];for(let t=1;t<n.length;i+=`.`+n[t++])!isNaN(+n[t])&&e.has(i)&&r.push(`${i}.${n[t]}`);return r},mv=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>s_(e)?e:t?e===``?NaN:e&&+e:n&&x_(e)?new Date(e):r?r(e):e;function hv(e){let t=e.ref;return Hg(t)?t.files:M_(t)?z_(e.refs).value:tv(t)?[...t.selectedOptions].map(({value:e})=>e):Vg(t)?L_(e.refs).value:mv(t.value,e)}var gv=(e,t,n,r)=>{let i={};for(let n of e){let e=X(t,n);e&&u_(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},_v=e=>s_(e)?e:N_(e)?e.source:Kg(e)?N_(e.value)?e.value.source:e.value:e,vv=`AsyncFunction`,yv=e=>{if(!e||!e.validate)return!1;if(l_(e.validate))return e.validate.constructor.name===vv;if(Kg(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===vv)return!0}return!1},bv=e=>e.mount&&(e.required||!s_(e.required)&&e.required!==!1||!s_(e.min)||!s_(e.max)||!s_(e.maxLength)||!s_(e.minLength)||e.pattern||e.validate);function xv(e,t,n){let r=X(e,n);if(r||o_(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=X(t,r),o=X(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var Sv=(e,t,n,r)=>{n(e);let i=Object.keys(e).filter(e=>e!==`name`);return!i.length||r&&i.length>=Object.keys(t).length||i.find(e=>t[e]===(!r||t_.all))},Cv=(e,t,n)=>!e||!t||e===t||U_(e).some(e=>e&&(n?e===t||e.startsWith(t+`.`):e.startsWith(t)||t.startsWith(e))),wv=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e,Tv=(e,t)=>{let n=X(e,t);!W_(n).length&&!(n!=null&&n.root)&&q_(e,t)},Ev={mode:t_.onSubmit,reValidateMode:t_.onChange,shouldFocusError:!0},Dv=`form`,Ov=(e,t)=>{for(let n in e)n in t||delete e[n];Object.assign(e,t)},kv={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Av(e={}){let t={...Ev,...e},n={...$g(kv),isLoading:l_(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},i=(Kg(t.defaultValues)||Kg(t.values))&&$g(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:$g(i),o={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c={},l={},u=0,d=E_(t.mode),f=E_(t.reValidateMode),p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p},h={...m},g={array:Z_(),state:Z_()},_=0,v=t.criteriaMode===t_.all,y=(e,t)=>n=>{clearTimeout(l[e]),l[e]=setTimeout(t,n)},b=async e=>{if(!o.keepIsValid&&!t.disabled&&(m.isValid||h.isValid||e)){let e=++_,i;t.resolver?(i=A_((await A()).errors),e===_&&x()):i=await M({fields:r,onlyCheckValid:!0,eventType:e_.VALID}),e===_&&i!==n.isValid&&g.state.next({isValid:i})}},x=(e,r)=>{!t.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((e||s.mount).forEach(e=>{e&&(r?u_(n.validatingFields,e,r):q_(n.validatingFields,e))}),g.state.next({validatingFields:n.validatingFields,isValidating:!A_(n.validatingFields)}))},S=()=>{n.dirtyFields=fv(i,a,void 0,r)},C=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){o.action=!0;let t=X(r,e);if(o.actionArrayLengths.has(e)||o.actionArrayLengths.set(e,Array.isArray(t)?t.length:0),u&&Array.isArray(t)){let n=s(t,c.argA,c.argB);l&&u_(r,e,n)}let a=X(n.errors,e);if(u&&Array.isArray(a)){let t=a.root,r=s(a,c.argA,c.argB)||a;t&&(r.root=t),l&&u_(n.errors,e,r),Tv(n.errors,e)}let d=X(n.touchedFields,e);if((m.touchedFields||h.touchedFields)&&u&&Array.isArray(d)){let t=s(d,c.argA,c.argB);l&&u_(n.touchedFields,e,t)}(m.dirtyFields||h.dirtyFields)&&S(),g.state.next({name:e,isDirty:P(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else u_(a,e,i)},w=(e,t)=>{u_(n.errors,e,t),n.errors={...n.errors},g.state.next({errors:n.errors})},T=e=>{n.errors=e,g.state.next({errors:n.errors,isValid:!1})},E=e=>{let t=o_(e)?[e]:Yg(e),n=a,r=i;for(let e=0;e<t.length-1;e++){let i=t[e];if(n=Wg(n)?n:n[i],r=Wg(r)?r:r[i],n===null&&r!==null)return!0}return!1},D=e=>{if(!o.actionArrayLengths.size)return!1;let t=o_(e)?[e]:Yg(e),n=a,r=``,i=-1,s=0;for(let e=0;e<t.length;e++){if(Wg(n))return!1;let a=t[e];if(r=r?`${r}.${a}`:a,Array.isArray(n)&&+a>=n.length)return i===-1?!1:e!==i||+a<s;o.actionArrayLengths.has(r)&&(i=e+1,s=o.actionArrayLengths.get(r)),n=n[a]}return!1},O=(t,c,l,u)=>{let d=X(r,t);if(d){if(E(t)||D(t))return;let r=s_(X(a,t)),f=X(a,t,s_(l)?X(i,t):l);s_(f)||u&&u.defaultChecked||c?u_(a,t,c?f:hv(d._f)):ie(t,f),o.mount&&!o.action&&(b(),r&&n.isDirty&&(m.isDirty||h.isDirty)&&(P()||(n.isDirty=!1,g.state.next({...n}))),e.shouldUnregister&&r&&!s_(X(a,t))&&D_(t,s)&&(o.watch=!0))}},k=(e,o,s,c,l)=>{let u=!1,d=!1,f={name:e};if(!t.disabled||c===!0){if(!s||c){let t=v_(X(i,e),o);(m.isDirty||h.isDirty)&&(d=n.isDirty,n.isDirty=f.isDirty=!t||P(),u=d!==f.isDirty),d=!!X(n.dirtyFields,e),t===n.isDirty?t?q_(n.dirtyFields,e):u_(n.dirtyFields,e,!0):Ov(n.dirtyFields,fv(i,a,void 0,r)),f.dirtyFields=n.dirtyFields,u||=(m.dirtyFields||h.dirtyFields)&&d!==!t}if(s){let t=X(n.touchedFields,e);t||(u_(n.touchedFields,e,s),f.touchedFields=n.touchedFields,u||=(m.touchedFields||h.touchedFields)&&t!==s)}u&&l&&g.state.next(f)}return u?f:{}},ee=(e,r,i,a)=>{let o=X(n.errors,e),s=(m.isValid||h.isValid)&&c_(r)&&n.isValid!==r;if(t.delayError&&i?(c[e]=y(e,()=>w(e,i)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e],i?u_(n.errors,e,i):q_(n.errors,e),n.errors={...n.errors}),(i?!v_(o,i):o)||!A_(a)||s){let t={...a,...s&&c_(r)?{isValid:r}:{},errors:n.errors,name:e};g.state.next(t)}},A=async e=>(x(e,!0),await t.resolver(a,t.context,gv(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),j=async e=>{let{errors:t}=await A(e);if(x(e),e){for(let r of e){let e=X(t,r);e?s.array.has(r)&&Kg(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e)))?k_(n.errors,{[r]:e},r):u_(n.errors,r,e):q_(n.errors,r)}n.errors={...n.errors}}else n.errors=t;return t},te=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(Kg(i))for(let e in i){let t=i[e];t&&me(`${Dv}.${e}`,{message:x_(t.message)?t.message:``,type:t.type||n_.validate})}else x_(i)||!i?me(Dv,{message:i||``,type:n_.validate}):pe(Dv);return i}return!0},M=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await te({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let u=r[o];if(u){let{_f:r,...d}=u;if(r){let o=s.array.has(r.name),c=u._f&&yv(u._f),d=m.validatingFields||m.isValidating||h.validatingFields||h.isValidating;c&&d&&x([r.name],!0);let f=await H_(u,s.disabled,a,v,t.shouldUseNativeValidation&&!i,o);if(c&&d&&x([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(X(f,r.name)?o?k_(n.errors,f,r.name):u_(n.errors,r.name,f[r.name]):q_(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!A_(d)&&await M({context:l,onlyCheckValid:i,fields:d,name:o,eventType:c})}}return l.valid},N=()=>{for(let e of s.unMount){let t=X(r,e);t&&(t._f.refs?t._f.refs.every(e=>!rv(e)):!rv(t._f.ref))&&ve(e)}s.unMount=new Set},P=(e,t)=>(e&&t&&u_(a,e,t),!v_(o.mount?a:i,i)),ne=(e,t,n)=>S_(e,s,{...o.mount?a:s_(t)||x_(e)?i:t},n,t),re=e=>W_(X(o.mount?a:i,e,t.shouldUnregister?X(i,e,[]):[])),ie=(e,t,n={},i=!1,o=!1,s=!1)=>{let c=X(r,e),l=t;if(c){let n=c._f;n&&(!n.disabled&&u_(a,e,mv(t,n)),l=j_(n.ref)&&Wg(t)?``:t,tv(n.ref)?[...n.ref.options].forEach(e=>e.selected=l.includes(e.value)):n.refs?Vg(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(l)?!!l.find(t=>t===e.value):l===e.value||!!l)}):n.refs.forEach(e=>e.checked=e.value===l):Hg(n.ref)?n.ref.value=``:(n.ref.value=l,!n.ref.type&&!o&&!s&&g.state.next({name:e,values:i?a:$g(a)})))}(n.shouldDirty||n.shouldTouch)&&k(e,l,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&le(e,{delayError:n.delayError})},F=(e,t,n,i=!1,o=!1,c=!1)=>{s.array.has(e)&&g.array.next({name:e,values:i?a:$g(a)});for(let a in t){if(!t.hasOwnProperty(a))continue;let l=t[a],u=e+`.`+a,d=X(r,u);(s.array.has(e)||Kg(l)||d&&!d._f)&&!Ug(l)?F(u,l,n,i,o,c):ie(u,l,n,i,o,c)}},I=(e,t,i,c,l=!1)=>{let u=X(r,e),d=s.array.has(e),f=c?t:$g(t),p=v_(X(a,e),f);if(p||u_(a,e,f),d)g.array.next({name:e,values:c?a:$g(a)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&i.shouldDirty&&(S(),l||g.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:P(e,f)}));else{let t=Array.isArray(f)&&!f.length||A_(f),n=!p&&!l;!u||u._f||Wg(f)||t?ie(e,f,i,c,l,n):F(e,f,i,c,l,n)}if(!p&&!l){let t=D_(e,s),r=c?a:$g(a);if(g.state.next({...t&&n,name:o.mount||t?e:void 0,values:r}),!d)for(let t of pv(s.array,e))g.state.next({name:t,values:r})}},ae=(e,t,n={})=>I(e,t,n,!1),oe=(e,t={})=>{let r=l_(e)?e(a):e;if(!v_(a,r)){a={...a,...r};for(let e of s.mount)ev(r,e)&&I(e,X(r,e),t,!0,!0);g.state.next({...n,name:void 0,type:void 0,...u?{values:a}:{}}),t.shouldValidate&&b()}},se=async i=>{o.mount=!0;let l=i.target,p=l.name,_=!0,y=X(r,p),S=e=>{_=Number.isNaN(e)||Ug(e)&&isNaN(e.getTime())||v_(e,X(a,p,e))};if(y){let o,C,w=l.type?hv(y._f):qg(i),T=i.type===e_.BLUR||i.type===e_.FOCUS_OUT,E=!bv(y._f)&&!e.validate&&!t.resolver&&!X(n.errors,p)&&!y._f.deps,D=E||wv(T,X(n.touchedFields,p),n.isSubmitted,f,d),O=D_(p,s,T);if(u_(a,p,$g(w)),T){if(!l||!l.readOnly){y._f.onBlur&&y._f.onBlur(i);let e=c[p];e&&e(0)}}else y._f.onChange&&y._f.onChange(i);let j=k(p,w,T),N=!A_(j)||O;if(!T&&g.state.next({name:p,type:i.type,...u?{values:$g(a)}:{}}),D)return(!E||!n.isValid)&&(m.isValid||h.isValid)&&(t.mode===`onBlur`?T&&b():T||b()),N&&g.state.next({name:p,...O?{}:j});if(!t.resolver&&e.validate&&await te({name:p,eventType:i.type}),!T&&O&&g.state.next({...n}),t.resolver){let{errors:e}=await A([p]);if(x([p]),S(w),!_){!A_(j)&&g.state.next(j);return}let t=xv(n.errors,r,p),i=xv(e,r,t.name||p);o=i.error,p=i.name,C=A_(e)}else x([p],!0),o=(await H_(y,s.disabled,a,v,t.shouldUseNativeValidation))[p],x([p]),S(w),_&&(o?C=!1:(m.isValid||h.isValid)&&(C=await M({fields:r,onlyCheckValid:!0,name:p,eventType:i.type})));_&&(y._f.deps&&(!Array.isArray(y._f.deps)||y._f.deps.length>0)&&le(y._f.deps),ee(p,C,o,j))}},ce=(e,t)=>{if(X(n.errors,t)&&e.focus)return e.focus(),1},le=async(e,i={})=>{let a,o,u=U_(e);if(t.resolver){let t=await j(s_(e)?e:u);a=A_(t),o=e?!u.some(e=>X(t,e)):a}else e?(o=(await Promise.all(u.map(async e=>{let t=X(r,e);return await M({fields:t&&t._f?{[e]:t}:t,eventType:e_.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&b()):o=a=await M({fields:r,name:e,eventType:e_.TRIGGER});if(i.delayError&&t.delayError&&x_(e)){let r=X(n.errors,e);r?(q_(n.errors,e),c[e]=y(e,()=>w(e,r)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e])}if(i.shouldTouch)for(let t of e?u:s.mount)!s.array.has(t)&&u_(n.touchedFields,t,!0);return g.state.next({...!x_(e)||(m.isValid||h.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},...i.shouldTouch&&(m.touchedFields||h.touchedFields)?{touchedFields:n.touchedFields}:{},errors:n.errors}),i.shouldFocus&&!o&&O_(r,ce,e?u:s.mount),o},ue=(e,t)=>{let r={...o.mount?a:i};return t&&(r=Q_(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),s_(e)?r:x_(e)?X(r,e):e.map(e=>X(r,e))},de=e=>s_(e)?{...n.errors}:x_(e)?X(n.errors,e):e.map(e=>X(n.errors,e)),fe=(e,t)=>{let r=t||n,i=X(r.errors,e);return{invalid:!!i,isDirty:!!X(r.dirtyFields,e),error:i,isValidating:!!X(n.validatingFields,e),isTouched:!!X(r.touchedFields,e)}},pe=e=>{let t=e?U_(e):void 0;t?.forEach(e=>q_(n.errors,e)),t?t.forEach(e=>{g.state.next({name:e,errors:n.errors})}):(n.errors={},g.state.next({errors:n.errors}))},me=(e,t,i)=>{let a=(X(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=X(n.errors,e)||{};u_(n.errors,e,{...l,...t,ref:a}),g.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},he=(e,t)=>{if(l_(e)){u++;let{unsubscribe:n}=g.state.subscribe({next:n=>`values`in n&&e(n.values||ne(void 0,t),n)}),r=!1;return{unsubscribe:()=>{r||(r=!0,u--,n())}}}return ne(e,t,!0)},ge=e=>{let t=!!e.formState?.values;t&&u++;let{unsubscribe:r}=g.state.subscribe({next:t=>{if(Cv(e.name,t.name,e.exact)&&Sv(t,e.formState||m,Oe,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}});if(!t)return r;let o=!1;return()=>{o||(o=!0,u--,r())}},_e=e=>(o.mount=!0,h={...h,...e.formState},ge({...e,formState:{...p,...e.formState}})),ve=(e,o={})=>{for(let c of e?U_(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(q_(r,c),q_(a,c)),!o.keepError&&q_(n.errors,c),!o.keepDirty&&q_(n.dirtyFields,c),!o.keepTouched&&q_(n.touchedFields,c),!o.keepIsValidating&&q_(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&q_(i,c);u&&g.state.next({values:$g(a)}),g.state.next({...n,...o.keepDirty?{}:{isDirty:P()}}),!o.keepIsValid&&b()},ye=({disabled:e,name:t})=>{if(c_(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&b()}},be=(e,n={})=>{let a=X(r,e),c=c_(n.disabled)||c_(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return u_(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?ye({disabled:c_(n.disabled)?n.disabled:t.disabled,name:e}):O(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:_v(n.min),max:_v(n.max),minLength:_v(n.minLength),maxLength:_v(n.maxLength),pattern:_v(n.pattern)}:{},name:e,onChange:se,onBlur:se,ref:c=>{if(c){s.registerName.add(e),be(e,n),s.registerName.delete(e),a=X(r,e);let t=s_(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=nv(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;let u={...a._f};o?(u.refs=[...l.filter(rv),t,...Array.isArray(X(i,e))?[{}]:[]],u.ref={type:t.type,name:e}):(u.ref=t,delete u.refs),u_(r,e,{_f:u}),O(e,!1,void 0,t)}else a=X(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(Zg(s.array,e)&&o.action)&&s.unMount.add(e)}}},xe=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&O_(r,ce,s.mount),Se=e=>{c_(e)&&(g.state.next({disabled:e}),O_(r,(t,n)=>{let i=X(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},Ce=(e,i)=>async o=>{let c,l;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let u=$g(a);if(g.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await A();x(),n.errors=e,u=$g(t)}else await M({fields:r,eventType:e_.SUBMIT});if(s.disabled.size)for(let e of s.disabled)q_(u,e);if(q_(n.errors,r_),A_(n.errors)){g.state.next({errors:{}});try{c=await e(u,o)}catch(e){l=e}}else i&&await i({...n.errors},o),xe(),setTimeout(xe);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:A_(n.errors)&&!l,submitCount:n.submitCount+1,errors:n.errors}),l)throw l;return c},we=(e,t={})=>{X(r,e)&&(s_(t.defaultValue)?ae(e,$g(X(i,e))):(ae(e,t.defaultValue),u_(i,e,$g(t.defaultValue))),t.keepTouched||q_(n.touchedFields,e),t.keepDirty||(q_(n.dirtyFields,e),n.isDirty=t.defaultValue?P(e,$g(X(i,e))):P()),t.keepError||(q_(n.errors,e),b()),g.state.next({...n}))},Te=(e,c={})=>{let l=e?$g(e):i,u=$g(l),d=A_(e),f=u,p=r;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...av(fv(i,a,void 0,p),n.dirtyFields)]);for(let t of e){let e=X(n.dirtyFields,t),r=X(a,t),i=X(f,t);e&&!s_(r)?u_(f,t,r):!e&&!s_(i)&&ae(t,i)}}else{if(Qg&&s_(e))for(let e of s.mount){let t=X(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(j_(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)ae(e,X(f,e));else r={}}if(t.shouldUnregister){if(a=c.keepDefaultValues?$g(i):{},c.keepFieldsRef)for(let e of s.mount)u_(a,e,X(f,e))}else a=$g(f);g.array.next({values:{...f}}),g.state.next({name:void 0,type:void 0,values:{...f}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!m.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!A_(f),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,o.actionArrayLengths.clear(),c.keepErrors||(n.errors={}),g.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:d?!1:c.keepDirty?n.isDirty:c.keepValues?P():!!(c.keepDefaultValues&&!v_(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:d?{}:c.keepDirtyValues?c.keepDefaultValues&&a?fv(i,a,void 0,p):n.dirtyFields:c.keepDefaultValues&&e?fv(i,e,void 0,p):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Ee=(e,n)=>Te(l_(e)?e(a):e,{...t.resetOptions,...n}),De=(e,t={})=>{let n=X(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&l_(e.select)&&e.select()})}},Oe=e=>{let{name:t,type:r,values:i,...a}=e;n={...n,...a}};g.state.subscribe({next:Oe});let ke={control:{register:be,unregister:ve,getFieldState:fe,handleSubmit:Ce,setError:me,_subscribe:ge,_runSchema:A,_updateIsValidating:x,_focusError:xe,_getWatch:ne,_getDirty:P,_setValid:b,_setFieldArray:C,_setDisabledField:ye,_setErrors:T,_getFieldArray:re,_reset:Te,_resetDefaultValues:()=>l_(t.defaultValues)&&t.defaultValues().then(e=>{Ee(e,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:N,_disableForm:Se,_subjects:g,_proxyFormState:m,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},d=E_(t.mode),f=E_(t.reValidateMode)}},subscribe:_e,trigger:le,register:be,handleSubmit:Ce,watch:he,setValue:ae,setValues:oe,getValues:ue,getErrors:de,reset:Ee,resetField:we,resetDefaultValues:(e,t={})=>{if(i=$g(e),!t.keepDirty){let e=fv(i,a,void 0,r);n.dirtyFields=e,n.isDirty=!A_(e)}t.keepIsValid||b(),g.state.next({...n,defaultValues:i})},clearErrors:pe,unregister:ve,setError:me,setFocus:De,getFieldState:fe};return{...ke,formControl:ke}}function jv(e={}){let t=z.useRef(void 0),n=z.useRef(void 0),r=z.useRef(e.formControl),[i,a]=z.useState(()=>({...$g(kv),isLoading:l_(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:l_(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl){if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!l_(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...r}=Av(e);t.current={...r,formState:i}}}let o=t.current.control;o._options=e;let{resyncIfNeeded:s,snapshot:c}=y_();return m_(()=>{let e=()=>({...o._formState,defaultValues:o._defaultValues});s(!0,e,a);let t=o._subscribe({formState:o._proxyFormState,callback:()=>a({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return a(e=>({...e,isReady:!0})),o._formState.isReady=!0,()=>{t(),c(!0,e)}},[o,s,c]),z.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),z.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),z.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),z.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),z.useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),z.useEffect(()=>{e.values&&!v_(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),o._options.resetOptions?.keepIsValid||o._setValid(),n.current=e.values,a(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),z.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=z.useMemo(()=>p_(i,o),[o,i]),t.current}var Mv=(0,z.createContext)({}),Nv=e=>{let t=(0,V.c)(7),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i=r,a;return t[4]!==i||t[5]!==n?(a=(0,H.jsx)(Mv,{value:i,children:(0,H.jsx)(T_,{...n})}),t[4]=i,t[5]=n,t[6]=a):a=t[6],a},Pv=()=>{let e=(0,V.c)(11),t=(0,z.useContext)(Mv),n=(0,z.useContext)(Bg),{getFieldState:r,formState:i}=Y_(),a;e[0]!==t.name||e[1]!==i||e[2]!==r?(a=r(t.name,i),e[0]=t.name,e[1]=i,e[2]=r,e[3]=a):a=e[3];let o=a;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:s}=n,c=`${s}-form-item`,l=`${s}-form-item-description`,u=`${s}-form-item-message`,d;return e[4]!==t.name||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==l||e[9]!==u?(d={id:s,name:t.name,formItemId:c,formDescriptionId:l,formMessageId:u,...o},e[4]=t.name,e[5]=o,e[6]=s,e[7]=c,e[8]=l,e[9]=u,e[10]=d):d=e[10],d},Fv=e=>{let t=(0,V.c)(5),{error:n,formItemId:r,formDescriptionId:i,formMessageId:a}=Pv(),o=n?`${i} ${a}`:`${i}`,s=!!n,c;return t[0]!==r||t[1]!==e||t[2]!==o||t[3]!==s?(c=(0,H.jsx)(Oe,{id:r,"aria-describedby":o,"aria-invalid":s,...e}),t[0]=r,t[1]=e,t[2]=o,t[3]=s,t[4]=c):c=t[4],c},Iv=e=>{let t=(0,V.c)(3),{formDescriptionId:n}=Pv(),r;return t[0]!==n||t[1]!==e?(r=(0,H.jsx)(`p`,{className:`text-neutral text-sm`,id:n,...e}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r},Lv=e=>{let{children:t,...n}=e,{error:r,formMessageId:i}=Pv(),a=r?String(r?.message??``):t;return a?(0,H.jsx)(`p`,{className:`font-medium text-error text-xs`,role:`alert`,id:i,...n,children:a}):null},Rv=({className:e,children:t,...n})=>(0,H.jsxs)(`i`,{className:R(`text-neutral-400 text-xs`,e),...n,children:[`ⓘ `,t]}),zv=e=>{let{className:t,...n}=e,{error:r,formItemId:i}=Pv();return(0,H.jsx)(Sm,{className:R(`mb-2`,r&&`text-error`,t),htmlFor:i,...n})},Bv=({isRequired:e})=>e?(0,H.jsx)(`span`,{"aria-label":`Asterisk meaning the field is required`,children:`*`}):(0,H.jsx)(H.Fragment,{}),Vv=({children:e,isRequired:t,info:n,htmlFor:r,className:i})=>(0,H.jsxs)(`div`,{className:`ml-1 flex gap-1 align-middle text-base leading-none`,children:[e&&(0,H.jsxs)(zv,{htmlFor:r,id:`${r}-label`,suppressHydrationWarning:!0,className:R(`font-bold`,i),children:[e,(0,H.jsx)(Bv,{isRequired:t})]}),n&&(0,H.jsx)(Rv,{content:n})]}),Hv=({label:e,description:t,isRequired:n,info:r,children:i,showErrorMessage:a=!0,htmlFor:o,className:s})=>(0,H.jsxs)(zg,{className:R(`flex w-full flex-col flex-wrap gap-2 px-1 py-2`,s),children:[(t||e)&&(0,H.jsxs)(`div`,{className:`flex max-w-full flex-col gap-1 p-1 leading-none`,children:[e&&(0,H.jsx)(Vv,{isRequired:n,info:r,htmlFor:o,children:e}),t&&(0,H.jsx)(Iv,{children:t})]}),(0,H.jsx)(Fv,{children:i}),a&&(0,H.jsx)(Lv,{"data-testid":`error-message`})]}),Uv=({field:e,name:t,label:n,Element:r,isRequired:i=!1,info:a,description:o,showErrorMessage:s=!0,layoutClassName:c,...l})=>{let{error:u}=Pv(),{value:d,onChange:f,...p}=e??{},m=l,h=m.value===void 0?d??``:m.value,g=(...e)=>{typeof f==`function`&&f(...e),typeof m.onChange==`function`&&m.onChange(...e)};return(0,H.jsx)(Hv,{htmlFor:t,label:n,description:o,isRequired:i,info:a,showErrorMessage:s,"aria-invalid":!!u,className:c,children:(0,H.jsx)(r,{"data-testid":`element`,id:t,...p,...l,value:h,onChange:g,children:l.children})})},Wv=e=>{let t=(0,V.c)(6),{control:n}=Y_(),r;t[0]===e?r=t[1]:(r=t=>{let{field:n}=t;return(0,H.jsx)(Uv,{...e,field:n})},t[0]=e,t[1]=r);let i;return t[2]!==n||t[3]!==e.name||t[4]!==r?(i=(0,H.jsx)(Nv,{control:n,name:e.name,render:r}),t[2]=n,t[3]=e.name,t[4]=r,t[5]=i):i=t[5],i},Gv=e=>(0,H.jsx)(Wv,{id:e.name,"data-testid":e.name,Element:Ap,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,...e}),Kv=e=>{let{field:t,name:n,label:r,description:i,isRequired:a,info:o,showErrorMessage:s,children:c,...l}=e,{error:u}=Pv();return(0,H.jsx)(Hv,{htmlFor:n,label:r,description:i,isRequired:a,info:o,showErrorMessage:s,"aria-invalid":!!u,children:(0,H.jsx)(Lg,{onValueChange:t.onChange,values:t.value,...l,children:c})})},qv=e=>{let{name:t,description:n,label:r,isRequired:i,info:a,showErrorMessage:o,children:s,...c}=e,{control:l}=Y_();return(0,H.jsx)(Nv,{control:l,name:t,render:e=>{let{field:l}=e;return(0,H.jsx)(Kv,{field:l,name:t,label:r,description:n,isRequired:i,info:a,showErrorMessage:o,...c,children:s})}})},Jv=e=>{let{field:t,name:n,label:r,description:i,isRequired:a,info:o,showErrorMessage:s,children:c,...l}=e,{error:u}=Pv();return(0,H.jsx)(Hv,{htmlFor:n,label:r,description:i,isRequired:a,info:o,showErrorMessage:s,"aria-invalid":!!u,children:(0,H.jsx)(L,{onValueChange:t.onChange,defaultValue:t.value,...l,children:c})})},Yv=e=>{let{name:t,description:n,label:r,isRequired:i,info:a,showErrorMessage:o,children:s,...c}=e,{control:l}=Y_();return(0,H.jsx)(Nv,{control:l,name:t,render:e=>{let{field:l}=e;return(0,H.jsx)(Jv,{field:l,name:t,label:r,description:n,isRequired:i,info:a,showErrorMessage:o,...c,children:s})}})},Xv=(e,t,n)=>{if(e&&`reportValidity`in e){let r=X(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},Zv=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?Xv(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>Xv(t,n,e))}},Qv=(e,t)=>{t.shouldUseNativeValidation&&Zv(e,t);let n={};for(let r in e){let i=X(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if($v(t.names||Object.keys(e),r)){let e=Object.assign({},X(n,r));u_(e,`root`,a),u_(n,r,e)}else u_(n,r,a)}return n},$v=(e,t)=>{let n=ey(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>ey(e).match(`^${n}\\.\\d+`))};function ey(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function ty(){return ty=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ty.apply(null,arguments)}function ny(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function ry(e,t){for(var n=Object.create(null);e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(`unionErrors`in r){var s=r.unionErrors.reduce(function(e,t){return t.errors.length<e.errors.length?t:e}).errors[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=P_(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function iy(e,t){for(var n=Object.create(null),r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors.reduce(function(e,t){return t.length<e.length?t:e})[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(ty({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=P_(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function ay(e,t,n){if(n===void 0&&(n={}),function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(ny(function(){function i(e){return a.shouldUseNativeValidation&&Zv({},a),{errors:{},values:n.raw?Object.assign({},r):e}}var o=e;return n.mode===`sync`?i(o.parse(r,t)):Promise.resolve(o.parseAsync(r,t)).then(i)},function(e){if(function(e){var t;return!(e==null||(t=e._zod)==null||(t=t.traits)==null||!t.has(`$ZodError`))}(e))return{values:{},errors:Qv(iy(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_def`in e&&typeof e._def==`object`}(e))return function(r,i,a){try{return Promise.resolve(ny(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&Zv({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:Qv(ry(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var oy=async e=>e&&typeof e.then==`function`?await e:e,sy=({schema:e,onSubmit:t,onSubmitSuccess:n,onSubmitError:r,className:i,children:a,autoComplete:o,method:s,...c})=>{let l=async i=>{let a=e?.safeParse(i)??{success:!0,data:void 0};await oy(t?.(i)),a.success?await oy(n?.(a.data)):await oy(r?.(Error(a.error.issues.map(e=>e.message).join(`, `))))},u=e=>{if(e.key!==`Enter`)return;let t=e.target;if(t.tagName!==`INPUT`)return;e.preventDefault();let n=e.currentTarget,r=Array.from(n.querySelectorAll(`input:not([disabled]):not([type="hidden"]), textarea:not([disabled])`)),i=r.indexOf(t);i>=0&&i<r.length-1&&r[i+1]?.focus()};return(0,H.jsx)(X_,{...c,children:(0,H.jsx)(`form`,{className:R(`flex flex-col gap-y-6`,i),onSubmit:c.handleSubmit(l),onKeyDown:u,autoComplete:o?`on`:`off`,noValidate:!0,method:s,children:a})})},cy=(e,t)=>{let n=(0,V.c)(13),r;n[0]===e?r=n[1]:(r=ay(e),n[0]=e,n[1]=r);let i;n[2]!==t||n[3]!==r?(i={resolver:r,...t},n[2]=t,n[3]=r,n[4]=i):i=n[4];let a=jv(i),o;n[5]===a.control?o=n[6]:(o={control:a.control},n[5]=a.control,n[6]=o);let{isSubmitting:s,isSubmitted:c,isLoading:l,isValid:u}=b_(o),d;return n[7]!==a||n[8]!==l||n[9]!==c||n[10]!==s||n[11]!==u?(d={form:a,isSubmitting:s,isSubmitted:c,isLoading:l,isValid:u},n[7]=a,n[8]=l,n[9]=c,n[10]=s,n[11]=u,n[12]=d):d=n[12],d},ly=sy;function uy(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function dy(e,t=`|`){return e.map(e=>Oy(e)).join(t)}function fy(e,t){return typeof t==`bigint`?t.toString():t}function py(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function my(e){return e==null}function hy(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function gy(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function _y(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function vy(e){return JSON.stringify(e)}function yy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var by=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function xy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Sy=py(()=>{if(fb.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Cy(e){if(xy(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return xy(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function wy(e){return Cy(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Ty=new Set([`string`,`number`,`symbol`]);function Ey(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Dy(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Z(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Oy(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ky(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function Ay(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Dy(e,_y(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&gy(e,r,n.shape[r])}return gy(this,`shape`,e),e},checks:[]}))}function jy(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Dy(e,_y(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return gy(this,`shape`,r),r},checks:[]}))}function My(e,t){if(!Cy(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Dy(e,_y(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return gy(this,`shape`,n),n}}))}function Ny(e,t){if(!Cy(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Dy(e,_y(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return gy(this,`shape`,n),n}}))}function Py(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Dy(e,_y(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return gy(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Fy(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return Dy(t,_y(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return gy(this,`shape`,i),i},checks:[]}))}function Iy(e,t,n){return Dy(t,_y(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return gy(this,`shape`,i),i}}))}function Ly(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ry(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function zy(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function By(e){return typeof e==`string`?e:e?.message}function Vy(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Hy(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:By(e.inst?._zod.def?.error?.(e))??By(a?.(e))??By(t?.error?.(e))??By(n.customError?.(e))??By(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}var Uy=/[\uD800-\uDBFF]/;function Wy(e){let t=e.length;if(!Uy.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Gy(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ky(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function qy(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Jy(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Zy(e,n,r.value)}}function Yy(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Xy(e,t,n){return Yy(e,t,n,!1)}function Zy(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Yy(this,t,n.bind(this))},set(e){Yy(this,t,e)}})}function Qy(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var $y,eb=!1,tb={configurable:!0,get(){eb=!0}};function nb(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&$y!==e._zod){$y=void 0;return}$y=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,tb);let e=eb;eb=!1;try{let r=n(this);return eb?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),eb||=e,r}catch(n){throw delete this[t],eb||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function rb(e,t,n,r){let i=Qy(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var ib=`~constantCatch`;function ab(e){let t=()=>e;return t[ib]=!0,t}var ob,sb={value:void 0,enumerable:!1},cb=`captureStackTrace`in Error?Error:null;function lb(e){let t=cb;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return cb=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function Q(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){sb.value=new a(r);try{Object.defineProperty(n,"_zod",sb)}finally{sb.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Jy(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?lb(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var ub=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},db=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ob=globalThis).__zod_globalConfig??(ob.__zod_globalConfig={});var fb=globalThis.__zod_globalConfig;function pb(e){return e&&Object.assign(fb,e),fb}function mb(){let e=this._zod;return e.message??=JSON.stringify(e.def,fy,2),e.message}function hb(e){this._zod.message=e}var gb={get:mb,set:hb,enumerable:!0,configurable:!0},_b={value:void 0,enumerable:!1},vb={value:void 0,enumerable:!1},yb=new WeakSet([Object.prototype,Error.prototype]),bb=(e,t)=>{e.name=`$ZodError`,_b.value=e._zod,Object.defineProperty(e,"_zod",_b),vb.value=t,Object.defineProperty(e,"issues",vb),_b.value=void 0,vb.value=void 0,Object.defineProperty(e,"message",gb);let n=Object.getPrototypeOf(e);yb.has(n)||(yb.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},xb=Q(`$ZodError`,bb),Sb=Q(`$ZodError`,bb,void 0,{Parent:Error});function Cb(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function wb(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Cb(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Tb(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Eb(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Db=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ub;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Hy(e,o,pb())));throw by(n,a?.callee??t),n}return s.value};return t},Ob=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Hy(e,o,pb())));throw by(n,a?.callee??t),n}return s.value};return t},kb=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ub;return a.issues.length?{success:!1,error:new(e??xb)(a.issues.map(e=>Hy(e,i,pb())))}:{success:!0,data:a.value}},Ab=kb(Sb),jb=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Hy(e,i,pb())))}:{success:!0,data:a.value}},Mb=jb(Sb),Nb=e=>{let t=Db(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Eb(n,a))};return n},Pb=e=>{let t=Db(e),n=(e,r,i,a)=>t(e,r,i,Eb(n,a));return n},Fb=e=>{let t=Ob(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Eb(n,a))};return n},Ib=e=>{let t=Ob(e),n=async(e,r,i,a)=>await t(e,r,i,Eb(n,a));return n},Lb=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return kb(e)(t,n,i)},Rb=e=>(t,n,r)=>kb(e)(t,n,r),zb=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jb(e)(t,n,i)},Bb=e=>async(t,n,r)=>jb(e)(t,n,r),Vb=/^[cC][0-9a-z]{6,}$/,Hb=/^[0-9a-z]+$/,Ub=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Wb=/^[0-9a-vA-V]{20}$/,Gb=/^[A-Za-z0-9]{27}$/,Kb=/^[a-zA-Z0-9_-]{21}$/;function qb(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Jb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Yb=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Xb=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Zb=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qb=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function $b(){return new RegExp(Qb,`u`)}var ex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nx=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ix=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ax=/^[A-Za-z0-9_-]*$/,ox=/^https?$/,sx=/^\+[1-9]\d{6,14}$/,cx=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function lx(e){return RegExp(`^${e}$`)}var ux=lx(cx);function dx(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function fx(e){return RegExp(`^${dx(e)}$`)}function px(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${dx({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${dx({precision:e.precision})}`:n;return RegExp(`^${cx}T(?:${r})$`)}var mx=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},hx=/^[^A-Z]*$/,gx=/^[^a-z]*$/,_x=Q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),vx=e=>{let t=e.value;return!my(t)&&t.length!==void 0},yx=Q(`$ZodCheckMaxLength`,(e,t)=>{var n;_x.init(e,t),(n=e._zod.def).when??(n.when=vx),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Wy(r):i)<=t.maximum)return;let a=Gy(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),bx=Q(`$ZodCheckMinLength`,(e,t)=>{var n;_x.init(e,t),(n=e._zod.def).when??(n.when=vx),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Wy(r):i)>=t.minimum)return;let a=Gy(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xx=Q(`$ZodCheckLengthEquals`,(e,t)=>{var n;_x.init(e,t),(n=e._zod.def).when??(n.when=vx),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Wy(r):i;if(a===t.length)return;let o=Gy(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Sx=Q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;_x.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Cx=Q(`$ZodCheckRegex`,(e,t)=>{Sx.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),wx=Q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=hx,Sx.init(e,t)}),Tx=Q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=gx,Sx.init(e,t)}),Ex=Q(`$ZodCheckIncludes`,(e,t)=>{_x.init(e,t);let n=Ey(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Dx=Q(`$ZodCheckStartsWith`,(e,t)=>{_x.init(e,t);let n=RegExp(`^${Ey(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ox=Q(`$ZodCheckEndsWith`,(e,t)=>{_x.init(e,t);let n=RegExp(`.*${Ey(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),kx=Q(`$ZodCheckOverwrite`,(e,t)=>{_x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ax=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
58
|
+
`),f=t?d.length-1:void 0,p=t?d[d.length-1]?.length??0:void 0;return(0,H.jsx)(gm,{ref:c,value:i,onChange:e=>{if(a(e),s(``),n.onChange){let t={target:{value:e},currentTarget:{value:e}};n.onChange(t)}},onKeyDown:e=>{e.key===`Tab`&&(t??o)&&(e.preventDefault(),l()),n.onKeyDown?.(e)},ghostText:u,ghostLine:f,ghostOffset:p,placeholder:n.placeholder,disabled:n.disabled,autoSize:n.autoSize,maxRows:n.maxRows,minRows:n.rows,variant:n.variant,validationStyleEnabled:n.validationStyleEnabled,className:n.className,dir:n.dir,"aria-label":n[`aria-label`],"aria-invalid":n[`aria-invalid`],"aria-describedby":n[`aria-describedby`],"data-testid":n[`data-testid`]})},vm=e=>{let t=(0,V.c)(9),{children:n,onContentChange:r,disabled:a,validate:o,additionalButtons:s,...c}=e,{isAuthenticated:l}=hp(),[u,d]=(0,z.useState)(n),[f,p]=(0,z.useState)(0),m=u!==n,h;t[0]===n?h=t[1]:(h=()=>{d(n),p(ym)},t[0]=n,t[1]=h);let g=h,_;t[2]!==u||t[3]!==r?(_=()=>{r(u)},t[2]=u,t[3]=r,t[4]=_):_=t[4];let v=_,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>d(e.currentTarget.value??``),t[5]=y):y=t[5];let b=y,x=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!a&&w?(e.preventDefault(),v()):e.key===`Escape`&&(e.preventDefault(),g())},S,C;t[6]===n?(S=t[7],C=t[8]):(S=()=>{d(n),p(bm)},C=[n],t[6]=n,t[7]=S,t[8]=C),(0,z.useEffect)(S,C);let w=o?.(u)??!0;return(0,H.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-between gap-2`,role:`group`,"aria-label":`Content editor textarea`,children:[(0,H.jsx)(_m,{onChange:b,onKeyDown:x,variant:`invisible`,className:`size-full`,value:n,isActive:l,disabled:a,"aria-label":`Editable textarea content`,"aria-describedby":m||s?`content-editor-textarea-actions`:void 0,"aria-invalid":!w,...c},f),(m||s)&&(0,H.jsxs)(`div`,{id:`content-editor-textarea-actions`,className:`flex w-full items-center justify-end gap-2`,role:`group`,"aria-label":`Edit actions`,children:[m&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M,{Icon:i,label:`Save changes${w?``:` (invalid content)`}`,variant:`hoverable`,color:`text`,size:`icon-sm`,className:`cursor-pointer hover:scale-110`,disabled:a||!w,onClick:v,"aria-describedby":w?void 0:`textarea-validation-error`}),(0,H.jsx)(M,{Icon:pe,label:`Cancel changes`,variant:`hoverable`,size:`icon-sm`,color:`text`,className:`cursor-pointer hover:scale-110`,onClick:g,disabled:a})]}),s]})]},n)};function ym(e){return e+1}function bm(e){return e+1}var xm=(e,t,n)=>{let r={...e};for(let i of Object.keys(e))i===t?(r[n]=e[t],delete r[t]):r[i]=e[i];return r},Sm=({htmlFor:e,required:t=!1,disabled:n=!1,className:r,children:i,...a})=>(0,H.jsxs)(`label`,{className:R(`select-none font-medium text-sm leading-none`,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70`,n&&`cursor-not-allowed text-muted-foreground opacity-70`,r),htmlFor:e,suppressHydrationWarning:!0,...a,children:[i,t&&(0,H.jsx)(`span`,{className:`ml-1 text-error`,"aria-hidden":`true`,title:`This field is required`,children:`*`})]}),Cm=(0,z.createContext)({availableLocales:[],selectedLocales:[],setSelectedLocales:()=>{}}),wm=()=>(0,z.useContext)(Cm),Tm=e=>{let t=(0,V.c)(16),{availableLocales:n,defaultSelectedLocales:r,children:i}=e,{locale:a}=Ht(),s;t[0]!==r||t[1]!==a?(s=r??[a],t[0]=r,t[1]=a,t[2]=s):s=t[2];let[c,l]=o(`locale-content-selector-selected-locales`,s),u;t[3]!==n||t[4]!==r||t[5]!==a||t[6]!==c||t[7]!==l?(u=()=>{if(n.length&&!c?.some(e=>n.includes(e))){let e=r?.filter(e=>n.includes(e));l(e?.length?e:[a])}},t[3]=n,t[4]=r,t[5]=a,t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=[n],t[9]=n,t[10]=d),(0,z.useEffect)(u,d);let f;return t[11]!==n||t[12]!==i||t[13]!==c||t[14]!==l?(f=(0,H.jsx)(Cm,{value:{availableLocales:n,selectedLocales:c,setSelectedLocales:l},children:i}),t[11]=n,t[12]=i,t[13]=c,t[14]=l,t[15]=f):f=t[15],f},Em=e=>{let t,n;if(typeof e==`number`||!Number.isNaN(Number(e)))t=`=`,n=e.toString();else if(typeof e==`string`){let r=[`<=`,`>=`,`<`,`>`,`=`].find(t=>e.startsWith(t));r&&(t=r,n=e.slice(r.length))}return{comparator:t,numberValue:n}},Dm=e=>{let t=(0,V.c)(13),{value:n,onChange:r}=e,i;t[0]===n?i=t[1]:(i=Em(n),t[0]=n,t[1]=i);let{comparator:a,numberValue:o}=i,[s,c]=(0,z.useState)(a??null),[l,u]=(0,z.useState)(o??null),d,f;t[2]!==s||t[3]!==a||t[4]!==o||t[5]!==l||t[6]!==r?(d=()=>{s&&l&&(s!==a||l!==o)&&r(`${s}${l}`)},f=[s,a,o,l,r],t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=r,t[7]=d,t[8]=f):(d=t[7],f=t[8]),(0,z.useEffect)(d,f);let p;if(t[9]!==a||t[10]!==l){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>u(e.target.value),t[12]=e):e=t[12],p=(0,H.jsxs)(`div`,{className:`flex gap-1`,children:[(0,H.jsxs)(L,{onValueChange:c,defaultValue:a,children:[(0,H.jsx)(L.Trigger,{className:`w-20`,children:(0,H.jsx)(L.Value,{placeholder:`Select a comparator`})}),(0,H.jsxs)(L.Content,{children:[(0,H.jsx)(L.Item,{value:`<`,children:`<`}),(0,H.jsx)(L.Item,{value:`<=`,children:`<=`}),(0,H.jsx)(L.Item,{value:`=`,children:`=`}),(0,H.jsx)(L.Item,{value:`>=`,children:`>=`}),(0,H.jsx)(L.Item,{value:`>`,children:`>`})]})]}),(0,H.jsx)(Ap,{type:`number`,"aria-label":`Quantity`,defaultValue:l??void 0,onChange:e,className:`min-w-4`})]}),t[9]=a,t[10]=l,t[11]=p}else p=t[11];return p},Om=({rawContent:e})=>{let[t,n]=(0,z.useState)(``);return(0,z.useEffect)(()=>{Ct(async()=>{let{default:e}=await import(`./purify.es-ChwZkWde.js`);return{default:e}},[]).then(({default:t})=>{n(t.sanitize(e))})},[e]),t?(0,H.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t}}):(0,H.jsx)(`div`,{})},km=(0,z.lazy)(()=>Ct(()=>import(`./MarkDownRender-DL6ufzaY.js`).then(e=>({default:e.MarkdownRenderer})),__vite__mapDeps([0,1,2,3,4]))),Am=(0,z.lazy)(()=>Ct(()=>import(`./MarkdownEditor-DWz0fVZF.js`).then(e=>({default:e.MarkdownEditor})),__vite__mapDeps([5,2,3,4,1,6]))),jm=(0,z.memo)(function(e){let t=(0,V.c)(2),{label:n,...r}=e,[i,a]=(0,z.useState)(!1),o;return t[0]===i?o=t[1]:(o=e=>{e&&!i&&a(!0)},t[0]=i,t[1]=o),(0,H.jsx)(gp,{header:n,label:n,onToggle:o,children:i?(0,H.jsx)(Xm,{...r}):null})}),Mm=e=>{let t=(0,V.c)(14),{keyPath:n,dictionary:r,...i}=e,{editedContent:a,addEditedContent:o}=Bf(),s=Rf(),{mutate:c,isPending:l}=ip(),u;t[0]!==o||t[1]!==r||t[2]!==n?(u=e=>o(r.localId,e,n),t[0]=o,t[1]=r,t[2]=n,t[3]=u):u=t[3];let d;return t[4]!==o||t[5]!==c||t[6]!==s?.ai?.apiKey||t[7]!==s?.ai?.model||t[8]!==s?.ai?.temperature||t[9]!==s?.internationalization||t[10]!==r||t[11]!==a||t[12]!==n?(d=()=>{c({fileContent:JSON.stringify({...r,...a?.[r.localId]??{}}),keyPath:n,locales:s?.internationalization.locales??[],aiOptions:{apiKey:s?.ai?.apiKey,model:s?.ai?.model,temperature:s?.ai?.temperature}},{onSuccess:e=>{if(e?.data)try{let t=e.data.fileContent;o(r.localId,t,n)}catch(e){console.error(e)}}})},t[4]=o,t[5]=c,t[6]=s?.ai?.apiKey,t[7]=s?.ai?.model,t[8]=s?.ai?.temperature,t[9]=s?.internationalization,t[10]=r,t[11]=a,t[12]=n,t[13]=d):d=t[13],(0,H.jsx)(vm,{variant:`default`,onContentChange:u,additionalButtons:(0,H.jsx)(M,{Icon:sc,label:`Audit`,variant:`hoverable`,size:`icon-sm`,color:`text`,className:`cursor-pointer hover:scale-110`,isLoading:l,onClick:d}),...i})},Nm=e=>{let t=(0,V.c)(4),{keyPath:n,dictionary:r,...i}=e,{addEditedContent:a}=Bf(),o;return t[0]!==a||t[1]!==r||t[2]!==n?(o=e=>a(r.localId,e,n),t[0]=a,t[1]=r,t[2]=n,t[3]=o):o=t[3],(0,H.jsx)($p,{variant:`default`,onContentChange:o,...i})},Pm=[{content:`False`,value:!1},{content:`True`,value:!0}],Fm=e=>{let t=(0,V.c)(4),{dictionary:n,keyPath:r,...i}=e,{addEditedContent:a}=Bf(),o;return t[0]!==a||t[1]!==n||t[2]!==r?(o=e=>a(n.localId,e,r),t[0]=a,t[1]=n,t[2]=r,t[3]=o):o=t[3],(0,H.jsx)(wp,{choices:Pm,value:!0,onChange:o,color:`text`,size:`sm`,...i})},Im=e=>{let t=(0,V.c)(15),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{locale:o,defaultLocale:s}=Ht(),{selectedLocales:c}=wm(),l=n[ge],u;if(t[0]!==l||t[1]!==s||t[2]!==i||t[3]!==r||t[4]!==o||t[5]!==a||t[6]!==c){let e;t[8]!==l||t[9]!==s||t[10]!==i||t[11]!==r||t[12]!==o||t[13]!==a?(e=e=>{let t=`${JSON.stringify(r)}-translation-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 w-full p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:At(e,o)})}),(0,H.jsx)(`tr`,{className:`flex`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:l[e]??Pt(l[s]),keyPath:[...r,{type:ge,key:e}],dictionary:i,renderSection:a})})})]},t)},t[8]=l,t[9]=s,t[10]=i,t[11]=r,t[12]=o,t[13]=a,t[14]=e):e=t[14],u=(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:c.map(e)})}),t[0]=l,t[1]=s,t[2]=i,t[3]=r,t[4]=o,t[5]=a,t[6]=c,t[7]=u}else u=t[7];return u},Lm=e=>{let t=(0,V.c)(19),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{addEditedContent:o}=Bf(),{addNewEnumeration:s,removeEnumeration:c}=F(`navigation-view`),l=n[h],u;t[0]===l?u=t[1]:(u=Object.keys(l),t[0]=l,t[1]=u);let d=u[0],f;if(t[2]!==o||t[3]!==s.label.value||t[4]!==s.text||t[5]!==l||t[6]!==i||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==a||t[11]!==n){let e;t[13]!==o||t[14]!==l||t[15]!==i||t[16]!==d||t[17]!==r?(e=()=>o(i.localId,Pt(l[d])??``,[...r,{type:h,key:`unknown`}]),t[13]=o,t[14]=l,t[15]=i,t[16]=d,t[17]=r,t[18]=e):e=t[18],f=(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:Object.keys(n[h]).map(e=>{let t=[...r,{type:h,key:e}],s=`${JSON.stringify(r)}-enumeration-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(`div`,{className:`flex flex-1`,children:(0,H.jsx)(M,{label:c.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-muted-foreground hover:text-error`,Icon:oc,onClick:()=>o(i.localId,void 0,t),children:c.text})})})}),(0,H.jsx)(`tr`,{className:`w-full p-2`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Dm,{value:e,onChange:t=>{let a=n[h],s=xm(a,e,t),c={...n,[h]:s};console.log(`newValue`,c),o(i.localId,c,r)}})})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Xm,{section:l[e]??Pt(l[d]),keyPath:t,dictionary:i,renderSection:a})})})]},s)})})}),(0,H.jsx)(M,{label:s.label.value,variant:`hoverable`,color:`neutral`,textAlign:`left`,isFullWidth:!0,onClick:e,Icon:nc,className:`m-2`,children:s.text})]}),t[2]=o,t[3]=s.label.value,t[4]=s.text,t[5]=l,t[6]=i,t[7]=d,t[8]=r,t[9]=c,t[10]=a,t[11]=n,t[12]=f}else f=t[12];return f},Rm=e=>{let t=(0,V.c)(19),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{addEditedContent:o}=Bf(),{addNewSelectCase:s,removeSelectCase:c}=F(`navigation-view`),l=n[C],u;t[0]===l?u=t[1]:(u=Object.keys(l),t[0]=l,t[1]=u);let d=u[0],f;if(t[2]!==o||t[3]!==s.label.value||t[4]!==s.text||t[5]!==l||t[6]!==i||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==a||t[11]!==n){let e;t[13]!==o||t[14]!==l||t[15]!==i||t[16]!==d||t[17]!==r?(e=()=>o(i.localId,Pt(l[d])??``,[...r,{type:C,key:`newCase`}]),t[13]=o,t[14]=l,t[15]=i,t[16]=d,t[17]=r,t[18]=e):e=t[18],f=(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:Object.keys(l).map(e=>{let t=[...r,{type:C,key:e}],s=`${JSON.stringify(r)}-select-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(`div`,{className:`flex flex-1`,children:(0,H.jsx)(M,{label:c.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-muted-foreground hover:text-error`,Icon:oc,onClick:()=>o(i.localId,void 0,t),children:c.text})})})}),(0,H.jsx)(`tr`,{className:`w-full p-2`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)($p,{"aria-label":`Edit case`,type:`text`,variant:`default`,onContentChange:t=>{let a={...n,[C]:xm(l,e,String(t))};o(i.localId,a,r)},children:e})})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Xm,{section:l[e]??Pt(l[d]),keyPath:t,dictionary:i,renderSection:a})})})]},s)})})}),(0,H.jsx)(M,{label:s.label.value,variant:`hoverable`,color:`neutral`,textAlign:`left`,isFullWidth:!0,onClick:e,Icon:nc,className:`m-2`,children:s.text})]}),t[2]=o,t[3]=s.label.value,t[4]=s.text,t[5]=l,t[6]=i,t[7]=d,t[8]=r,t[9]=c,t[10]=a,t[11]=n,t[12]=f}else f=t[12];return f},zm=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[N];return(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:[`true`,`false`,`fallback`].map(e=>{let a=`${JSON.stringify(t)}-condition-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:String(e)})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:i[e]??Pt(i.true),keyPath:[...t,{type:N,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},Bm=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[D];return(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:[`male`,`female`,`fallback`].map(e=>{let a=`${JSON.stringify(t)}-gender-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:String(e)})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:i[e]??Pt(i.male),keyPath:[...t,{type:D,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},Vm=[`zero`,`one`,`two`,`few`,`many`,`other`],Hm=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e[_];return(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:Vm.map(e=>{let a=`${JSON.stringify(t)}-plural-${e}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 block w-full p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:e})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:i[e]??Pt(i.other),keyPath:[...t,{type:_,key:e}],dictionary:n,renderSection:r})})})]},a)})})})},Um=e=>{let t=(0,V.c)(22),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{addEditedContent:o}=Bf(),{addNewElement:s,removeElement:c}=F(`navigation-view`),l;if(t[0]!==o||t[1]!==s.label.value||t[2]!==s.text||t[3]!==i||t[4]!==r||t[5]!==c||t[6]!==a||t[7]!==n){let e;t[9]!==o||t[10]!==i||t[11]!==r||t[12]!==c||t[13]!==a||t[14]!==n[0]?(e=(e,t)=>{let s=`${JSON.stringify(r)}-array-${t}`;return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 w-full p-2`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs`,children:String(t)}),(0,H.jsx)(M,{label:c.label.value,variant:`hoverable`,size:`sm`,color:`error`,className:`ml-auto text-muted-foreground hover:text-error`,onClick:()=>{let e=[...r,{type:k,key:t}];o(i.localId,void 0,e)},Icon:oc,children:c.text})]})})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Zm,{section:e??Pt(n[0]),keyPath:[...r,{type:k,key:t}],dictionary:i,renderSection:a})})})]},s)},t[9]=o,t[10]=i,t[11]=r,t[12]=c,t[13]=a,t[14]=n[0],t[15]=e):e=t[15];let u;t[16]!==o||t[17]!==i||t[18]!==r||t[19]!==n[0]||t[20]!==n.length?(u=()=>{let e=[...r,{type:k,key:n.length}];o(i.localId,Pt(n[0])??``,e,!1)},t[16]=o,t[17]=i,t[18]=r,t[19]=n[0],t[20]=n.length,t[21]=u):u=t[21],l=(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex w-full flex-col gap-2`,children:n.map(e)})}),(0,H.jsx)(M,{label:s.label.value,variant:`hoverable`,color:`neutral`,textAlign:`left`,isFullWidth:!0,onClick:u,Icon:nc,children:s.text})]}),t[0]=o,t[1]=s.label.value,t[2]=s.text,t[3]=i,t[4]=r,t[5]=c,t[6]=a,t[7]=n,t[8]=l}else l=t[8];return l},Wm=({section:e,keyPath:t,dictionary:n,renderSection:r})=>{let i=e,a=Object.keys(i)[0];return(0,H.jsx)(`table`,{className:`w-full`,children:(0,H.jsx)(`tbody`,{className:`flex flex-col gap-2`,children:Object.keys(i).map(e=>{let o=[...t,{type:ue,key:e}],s=i[e]??Pt(i[a]),c=`${JSON.stringify(t)}-object-${e}`;return typeof s!=`object`||!s?(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`tr`,{className:`mt-2 p-2 text-xs`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:String(e)})}),(0,H.jsx)(`tr`,{className:`block w-full`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(Xm,{section:s,keyPath:o,dictionary:n,renderSection:r})})})]},c):(0,H.jsx)(`tr`,{className:`block w-full border-neutral/10 border-t py-1`,children:(0,H.jsx)(`td`,{className:`flex w-full`,children:(0,H.jsx)(jm,{label:Dt(e),section:s,keyPath:o,dictionary:n,renderSection:r})})},c)})})})},Gm=e=>{let t=(0,V.c)(5),{section:n,keyPath:r,dictionary:i}=e,[a,o]=(0,z.useState)(0),s;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n){let e=[{content:`Edit`,value:0},{content:`Preview`,value:1}],c=[...r,{type:ie}],l=n[ie];s=(0,H.jsxs)(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[(0,H.jsx)(wp,{choices:e,value:a,onChange:o,color:`text`,size:`sm`,className:`ml-auto`}),(0,H.jsx)(Zm,{section:l,keyPath:c,dictionary:i,renderSection:a===1?Qm:void 0})]}),t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=s}else s=t[4];return s},Km=e=>{let t=(0,V.c)(9),{section:n,keyPath:r,dictionary:i}=e,[a,o]=(0,z.useState)(0),{addEditedContent:s}=Bf(),c;if(t[0]!==s||t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==n){let e=[{content:`Edit`,value:0},{content:`Raw`,value:1},{content:`Preview`,value:2}],u=[...r,{type:l}],d=n.markdown??``,f;t[6]!==s||t[7]!==i?(f=(e,t)=>(0,H.jsx)(z.Suspense,{fallback:(0,H.jsx)(m,{}),children:(0,H.jsx)(Am,{defaultValue:e,onChange:e=>s(i.localId,e,t)},JSON.stringify(t))}),t[6]=s,t[7]=i,t[8]=f):f=t[8];let p=f,h=$m;c=(0,H.jsxs)(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[(0,H.jsx)(wp,{choices:e,value:a,onChange:o,color:`text`,size:`sm`,className:`ml-auto`}),(0,H.jsx)(Zm,{section:d,keyPath:u,dictionary:i,renderSection:a===0?p:a===2?h:void 0})]}),t[0]=s,t[1]=i,t[2]=r,t[3]=a,t[4]=n,t[5]=c}else c=t[5];return c},qm=({section:e,keyPath:t,...n})=>{let r=[...t,{type:it}],i=e[it];return(0,H.jsx)(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:(0,H.jsx)(Zm,{section:i,keyPath:r,...n})})},Jm=({section:e,keyPath:t,...n})=>{let r=[...t,{type:x}],i=e[x],{content:a}=e;return(0,H.jsxs)(`div`,{className:`flex w-full flex-col justify-center gap-6 p-2`,children:[(0,H.jsxs)(`span`,{className:`text-neutral text-sm`,children:[i,` `]}),(0,H.jsx)(Zm,{section:a,keyPath:r,...n})]})},Ym=e=>{let{keyPath:t,dictionary:n,renderSection:r,section:i,...a}=e,{addEditedContent:o}=Bf(),s=i[ce],c=[...t,{type:ce}];return(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-4 p-2`,children:[(0,H.jsx)(Sm,{children:`Dictionary key`}),(0,H.jsx)($p,{"aria-label":`Edit field`,type:`text`,variant:`default`,...a,onContentChange:e=>{o(n.localId,{...s,dictionaryKey:String(e)},c)},children:s.dictionaryKey??``}),(0,H.jsx)(Sm,{children:`Path (optional)`}),(0,H.jsx)($p,{"aria-label":`Edit field`,type:`text`,variant:`default`,...a,onContentChange:e=>{o(n.localId,{...s,path:e===``?void 0:e},c)},children:s.path??``})]})},Xm=(0,z.memo)(function(e){let t=(0,V.c)(85),{section:n,keyPath:r,dictionary:i,renderSection:a}=e,{tsxNotEditable:o}=F(`navigation-view`),s,c;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n||t[4]!==o){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=zt(n);if(e===`reactNode`){let e;t[7]===o?e=t[8]:(e=(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,children:[(0,H.jsx)(`span`,{children:`(React Node)`}),(0,H.jsx)(`span`,{className:`flex text-muted-foreground text-xs`,children:o})]}),t[7]=o,t[8]=e),c=e;break bb0}if(e===`nested`){let e;t[9]!==i||t[10]!==r||t[11]!==a||t[12]!==n?(e=(0,H.jsx)(Ym,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[9]=i,t[10]=r,t[11]=a,t[12]=n,t[13]=e):e=t[13],c=e;break bb0}if(e===`translation`){let e;t[14]!==i||t[15]!==r||t[16]!==a||t[17]!==n?(e=(0,H.jsx)(Im,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[14]=i,t[15]=r,t[16]=a,t[17]=n,t[18]=e):e=t[18],c=e;break bb0}if(e===`enumeration`){let e;t[19]!==i||t[20]!==r||t[21]!==a||t[22]!==n?(e=(0,H.jsx)(Lm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[19]=i,t[20]=r,t[21]=a,t[22]=n,t[23]=e):e=t[23],c=e;break bb0}if(e===`condition`){let e;t[24]!==i||t[25]!==r||t[26]!==a||t[27]!==n?(e=(0,H.jsx)(zm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[24]=i,t[25]=r,t[26]=a,t[27]=n,t[28]=e):e=t[28],c=e;break bb0}if(e===`select`){let e;t[29]!==i||t[30]!==r||t[31]!==a||t[32]!==n?(e=(0,H.jsx)(Rm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[29]=i,t[30]=r,t[31]=a,t[32]=n,t[33]=e):e=t[33],c=e;break bb0}if(e===`gender`){let e;t[34]!==i||t[35]!==r||t[36]!==a||t[37]!==n?(e=(0,H.jsx)(Bm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[34]=i,t[35]=r,t[36]=a,t[37]=n,t[38]=e):e=t[38],c=e;break bb0}if(e===`plural`){let e;t[39]!==i||t[40]!==r||t[41]!==a||t[42]!==n?(e=(0,H.jsx)(Hm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[39]=i,t[40]=r,t[41]=a,t[42]=n,t[43]=e):e=t[43],c=e;break bb0}if(e===`insertion`){let e;t[44]!==i||t[45]!==r||t[46]!==a||t[47]!==n?(e=(0,H.jsx)(qm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[44]=i,t[45]=r,t[46]=a,t[47]=n,t[48]=e):e=t[48],c=e;break bb0}if(e===`markdown`){let e;t[49]!==i||t[50]!==r||t[51]!==n?(e=(0,H.jsx)(Km,{dictionary:i,keyPath:r,section:n}),t[49]=i,t[50]=r,t[51]=n,t[52]=e):e=t[52],c=e;break bb0}if(e===`html`){let e;t[53]!==i||t[54]!==r||t[55]!==n?(e=(0,H.jsx)(Gm,{dictionary:i,keyPath:r,section:n}),t[53]=i,t[54]=r,t[55]=n,t[56]=e):e=t[56],c=e;break bb0}if(e===`file`){let e;t[57]!==i||t[58]!==r||t[59]!==a||t[60]!==n?(e=(0,H.jsx)(Jm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[57]=i,t[58]=r,t[59]=a,t[60]=n,t[61]=e):e=t[61],c=e;break bb0}if(e===`array`){let e;t[62]!==i||t[63]!==r||t[64]!==a||t[65]!==n?(e=(0,H.jsx)(Um,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[62]=i,t[63]=r,t[64]=a,t[65]=n,t[66]=e):e=t[66],c=e;break bb0}if(e===`object`){let e;t[67]!==i||t[68]!==r||t[69]!==a||t[70]!==n?(e=(0,H.jsx)(Wm,{dictionary:i,renderSection:a,keyPath:r,section:n}),t[67]=i,t[68]=r,t[69]=a,t[70]=n,t[71]=e):e=t[71],c=e;break bb0}if(e===`number`){let e;t[72]!==i||t[73]!==r||t[74]!==n?(e=(0,H.jsx)(`div`,{className:`w-full p-2`,children:(0,H.jsx)(Nm,{dictionary:i,keyPath:r,type:`number`,"aria-label":`Edit field`,children:n})}),t[72]=i,t[73]=r,t[74]=n,t[75]=e):e=t[75],c=e;break bb0}if(e===`text`){let e;t[76]!==i||t[77]!==r||t[78]!==a||t[79]!==n?(e=(0,H.jsx)(`div`,{className:`w-full p-2`,children:typeof a==`function`?a(n,r):(0,H.jsx)(Mm,{variant:`default`,"aria-label":`Edit field`,keyPath:r,dictionary:i,children:n})}),t[76]=i,t[77]=r,t[78]=a,t[79]=n,t[80]=e):e=t[80],c=e;break bb0}if(e===`boolean`){let e;t[81]!==i||t[82]!==r||t[83]!==n?(e=(0,H.jsx)(`div`,{className:`w-full p-2`,children:(0,H.jsx)(Fm,{dictionary:i,keyPath:r,value:n})}),t[81]=i,t[82]=r,t[83]=n,t[84]=e):e=t[84],c=e;break bb0}s=(0,H.jsxs)(`div`,{className:`w-full p-2`,children:[`Error. Format not supported.`,JSON.stringify(n,null,2),JSON.stringify(r,null,2),`NodeType : `,e]})}t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=o,t[5]=s,t[6]=c}else s=t[5],c=t[6];return c===Symbol.for(`react.early_return_sentinel`)?s:c}),Zm=(0,z.memo)(function(e){return(0,H.jsx)(Ne,{border:!0,background:`none`,className:`top-6 flex h-full flex-1 flex-col gap-6 overflow-hidden p-2 md:sticky`,roundedSize:`2xl`,children:(0,H.jsx)(Xm,{...e})})});function Qm(e){return(0,H.jsx)(Om,{rawContent:e})}function $m(e){return(0,H.jsx)(z.Suspense,{fallback:(0,H.jsx)(m,{}),children:(0,H.jsx)(km,{children:e})})}var eh=Ze(`inline-flex items-center rounded-md border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{color:{primary:`border-primary bg-primary text-primary hover:bg-primary-500`,secondary:`border-secondary bg-secondary text-secondary hover:bg-secondary-300`,success:`border-success bg-success text-success hover:bg-success-500`,error:`border-error bg-error text-error hover:bg-error-500`,neutral:`border-neutral bg-neutral text-muted-foreground hover:bg-neutral-600`,light:`border-white bg-white text-white hover:bg-neutral-500`,dark:`border-neutral-800 bg-neutral-800 text-neutral-800 hover:bg-neutral-900`,text:`border-text bg-text text-foreground hover:opacity-80`,custom:``},variant:{default:`rounded-lg text-foreground-opposite`,none:`border-none bg-opacity-0 text-inherit hover:bg-opacity-0`,outline:`rounded-lg border-[1.3px] bg-opacity-0 hover:bg-opacity-30`,hoverable:`rounded-lg border-none bg-opacity-0 transition hover:bg-opacity-10`},size:{sm:`px-2 py-0.5 text-xs`,md:`px-2.5 py-0.5 text-xs`,lg:`px-3 py-1 text-sm`}},defaultVariants:{variant:`default`,color:`primary`,size:`md`}}),th=({className:e,variant:t=`default`,color:n=`primary`,size:r=`md`,children:i,clickable:a=!1,dismissible:o=!1,onClick:s,onDismiss:c,role:l,tabIndex:u,"aria-label":d,...f})=>{let p=a?`button`:`span`,m=e=>{a&&s&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s(e))},h=e=>{e.stopPropagation(),c?.()};return(0,H.jsxs)(p,{className:R(eh({variant:t,color:n,size:r}),a&&`cursor-pointer hover:opacity-80 focus-visible:ring-2 focus-visible:ring-offset-2`,o&&`pr-1`,e),onClick:a?s:void 0,onKeyDown:a?m:void 0,role:l||(a?`button`:`status`),tabIndex:a?u??0:u,"aria-label":d||(a?`${i} button`:void 0),...f,children:[i,o&&(0,H.jsx)(`button`,{type:`button`,className:`ml-1 inline-flex h-4 w-4 items-center justify-center rounded-full hover:bg-black/10 focus:outline-none focus:ring-1 focus:ring-offset-1`,onClick:h,"aria-label":`Remove ${i} badge`,children:(0,H.jsxs)(`svg`,{className:`size-3`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-label":`Remove badge`,children:[(0,H.jsx)(`title`,{children:`Remove badge`}),(0,H.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`})]})})]})},nh=Object.defineProperty,rh=(e,t)=>nh(e,`name`,{value:t,configurable:!0}),ih=`Dialog`,[ah,oh]=$e(ih),[sh,ch]=ah(ih),lh=rh(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=z.useRef(null),c=z.useRef(null),[l,u]=Me({prop:r,defaultProp:i??!1,onChange:a,caller:ih}),[f,p]=z.useState(0),[m,h]=z.useState(0);return(0,H.jsx)(sh,{scope:t,triggerRef:s,contentRef:c,contentId:d(),titleId:d(),descriptionId:d(),titlePresent:f>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:h,open:l,onOpenChange:u,onOpenToggle:z.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),uh=`DialogPortal`,[dh,fh]=ah(uh,{forceMount:void 0}),ph=rh(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=ch(uh,t);return(0,H.jsx)(dh,{scope:t,forceMount:n,children:z.Children.map(r,e=>(0,H.jsx)(ve,{present:n||a.open,children:(0,H.jsx)(Be,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),mh=`DialogOverlay`,hh=z.forwardRef(rh(function(e,t){let n=fh(mh,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ch(mh,e.__scopeDialog);return a.modal?(0,H.jsx)(ve,{present:r||a.open,children:(0,H.jsx)(_h,{...i,ref:t})}):null},`DialogOverlay`)),gh=_e(`DialogOverlay.RemoveScroll`),_h=z.forwardRef(rh(function(e,t){let{__scopeDialog:n,...r}=e,i=ch(mh,n),a=Se(),o=ye(t,a);return(0,H.jsx)(ke,{as:gh,allowPinchZoom:!0,shards:[i.contentRef],children:(0,H.jsx)(He.div,{"data-state":Ch(i.open),...r,ref:o,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),vh=`DialogContent`,yh=z.forwardRef(rh(function(e,t){let n=fh(vh,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=ch(vh,e.__scopeDialog);return(0,H.jsx)(ve,{present:r||a.open,children:a.modal?(0,H.jsx)(bh,{...i,ref:t}):(0,H.jsx)(xh,{...i,ref:t})})},`DialogContent`)),bh=z.forwardRef(rh(function(e,t){let n=ch(vh,e.__scopeDialog),r=z.useRef(null),i=ye(t,n.contentRef,r);return z.useEffect(()=>{let e=r.current;if(e)return De(e)},[]),(0,H.jsx)(Sh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:tt(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:tt(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:tt(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),xh=z.forwardRef(rh(function(e,t){let n=ch(vh,e.__scopeDialog),r=z.useRef(!1),i=z.useRef(!1);return(0,H.jsx)(Sh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Sh=z.forwardRef(rh(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=ch(vh,n);return Fe(),(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(j,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,H.jsx)(Le,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Ch(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`));function Ch(e){return e?`open`:`closed`}rh(Ch,`getState`);var wh=1,Th=.9,Eh=.8,Dh=.17,Oh=.1,kh=.999,Ah=.9999,jh=.99,Mh=/[\\\/_+.#"@\[\(\{&]/,Nh=/[\\\/_+.#"@\[\(\{&]/g,Ph=/[\s-]/,Fh=/[\s-]/g;function Ih(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?wh:jh;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Ih(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=wh:Mh.test(e.charAt(l-1))?(d*=Eh,p=e.slice(i,l-1).match(Nh),p&&i>0&&(d*=kh**+p.length)):Ph.test(e.charAt(l-1))?(d*=Th,m=e.slice(i,l-1).match(Fh),m&&i>0&&(d*=kh**+m.length)):(d*=Dh,i>0&&(d*=kh**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Ah)),(d<Oh&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=Ih(e,t,n,r,l+1,a+2,o),f*Oh>d&&(d=f*Oh)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Lh(e){return e.toLowerCase().replace(Fh,` `)}function Rh(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Ih(e,t,Lh(e),Lh(t),0,0,{})}var zh=`[cmdk-group=""]`,Bh=`[cmdk-group-items=""]`,Vh=`[cmdk-group-heading=""]`,Hh=`[cmdk-item=""]`,Uh=`${Hh}:not([aria-disabled="true"])`,Wh=`cmdk-item-select`,Gh=`data-value`,Kh=(e,t,n)=>Rh(e,t,n),qh=z.createContext(void 0),Jh=()=>z.useContext(qh),Yh=z.createContext(void 0),Xh=()=>z.useContext(Yh),Zh=z.createContext(void 0),Qh=z.forwardRef((e,t)=>{let n=fg(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=fg(()=>new Set),i=fg(()=>new Map),a=fg(()=>new Map),o=fg(()=>new Set),s=ug(e),{label:c,children:l,value:u,onValueChange:f,filter:p,shouldFilter:m,loop:h,disablePointerSelection:g=!1,vimBindings:_=!0,...v}=e,y=d(),b=d(),x=d(),S=z.useRef(null),C=hg();dg(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),dg(()=>{C(6,ee)},[]);let w=z.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=A()?.id,w.emit()}),r||C(5,ee),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=z.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??Kh;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Bh);t?t.appendChild(e.parentElement===t?e:e.closest(`${Bh} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Bh} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${zh}[${Gh}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Gh);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function ee(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(zh)?.querySelector(Vh))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return S.current?.querySelector(`${Hh}[aria-selected="true"]`)}function j(){return Array.from(S.current?.querySelectorAll(Uh)||[])}function te(e){let t=j()[e];t&&w.setState(`value`,t.getAttribute(Gh))}function M(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(Gh))}function N(e){let t=A()?.closest(zh),n;for(;t&&!n;)t=e>0?cg(t,zh):lg(t,zh),n=t?.querySelector(Uh);n?w.setState(`value`,n.getAttribute(Gh)):M(e)}let P=()=>te(j().length-1),ne=e=>{e.preventDefault(),e.metaKey?P():e.altKey?N(1):M(1)},re=e=>{e.preventDefault(),e.metaKey?te(0):e.altKey?N(-1):M(-1)};return z.createElement(He.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:_&&e.ctrlKey&&ne(e);break;case`ArrowDown`:ne(e);break;case`p`:case`k`:_&&e.ctrlKey&&re(e);break;case`ArrowUp`:re(e);break;case`Home`:e.preventDefault(),te(0);break;case`End`:e.preventDefault(),P();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(Wh);t.dispatchEvent(e)}}}}},z.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:vg},c),_g(e,e=>z.createElement(Yh.Provider,{value:w},z.createElement(qh.Provider,{value:T},e))))}),$h=z.forwardRef((e,t)=>{let n=d(),r=z.useRef(null),i=z.useContext(Zh),a=Jh(),o=ug(e),s=o.current?.forceMount??i?.forceMount;dg(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=mg(n,r,[e.value,e.children,r],e.keywords),l=Xh(),u=pg(e=>e.value&&e.value===c.current),f=pg(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);z.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Wh,p),()=>t.removeEventListener(Wh,p)},[f,e.onSelect,e.disabled]);function p(){var e,t;m(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function m(){l.setState(`value`,c.current,!0)}if(!f)return null;let{disabled:h,value:g,onSelect:_,forceMount:v,keywords:y,...b}=e;return z.createElement(He.div,{ref:nt(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!h,"aria-selected":!!u,"data-disabled":!!h,"data-selected":!!u,onPointerMove:h||a.getDisablePointerSelection()?void 0:m,onClick:h?void 0:p},e.children)}),eg=z.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=d(),s=z.useRef(null),c=z.useRef(null),l=d(),u=Jh(),f=pg(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));dg(()=>u.group(o),[]),mg(o,s,[e.value,e.heading,c]);let p=z.useMemo(()=>({id:o,forceMount:i}),[i]);return z.createElement(He.div,{ref:nt(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!f||void 0},n&&z.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),_g(e,e=>z.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},z.createElement(Zh.Provider,{value:p},e))))}),tg=z.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=z.useRef(null),a=pg(e=>!e.search);return!n&&!a?null:z.createElement(He.div,{ref:nt(i,t),...r,"cmdk-separator":``,role:`separator`})}),ng=z.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Xh(),o=pg(e=>e.search),s=pg(e=>e.selectedItemId),c=Jh();return z.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),z.createElement(He.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),rg=z.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=z.useRef(null),o=z.useRef(null),s=pg(e=>e.selectedItemId),c=Jh();return z.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),z.createElement(He.div,{ref:nt(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},_g(e,e=>z.createElement(`div`,{ref:nt(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),ig=z.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return z.createElement(lh,{open:n,onOpenChange:r},z.createElement(ph,{container:o},z.createElement(hh,{"cmdk-overlay":``,className:i}),z.createElement(yh,{"aria-label":e.label,"cmdk-dialog":``,className:a},z.createElement(Qh,{ref:t,...s}))))}),ag=z.forwardRef((e,t)=>pg(e=>e.filtered.count===0)?z.createElement(He.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),og=z.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return z.createElement(He.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},_g(e,e=>z.createElement(`div`,{"aria-hidden":!0},e)))}),sg=Object.assign(Qh,{List:rg,Item:$h,Input:ng,Group:eg,Separator:tg,Dialog:ig,Empty:ag,Loading:og});function cg(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function lg(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ug(e){let t=z.useRef(e);return dg(()=>{t.current=e}),t}var dg=typeof window>`u`?z.useEffect:z.useLayoutEffect;function fg(e){let t=z.useRef();return t.current===void 0&&(t.current=e()),t}function pg(e){let t=Xh(),n=()=>e(t.snapshot());return z.useSyncExternalStore(t.subscribe,n,n)}function mg(e,t,n,r=[]){let i=z.useRef(),a=Jh();return dg(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Gh,s),i.current=s}),i}var hg=()=>{let[e,t]=z.useState(),n=fg(()=>new Map);return dg(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function gg(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function _g({asChild:e,children:t},n){return e&&z.isValidElement(t)?z.cloneElement(gg(t),{ref:t.ref},n(t.props.children)):n(t)}var vg={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},yg=({className:e,...t})=>(0,H.jsx)(sg,{className:R(`flex flex-col overflow-hidden rounded-md px-3 py-2`,e),...t}),bg=({children:e,...t})=>(0,H.jsx)(lh,{...t,children:(0,H.jsx)(yh,{className:`overflow-hidden p-0`,children:(0,H.jsx)(yg,{className:`[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]_svg]:size-5`,children:e})})}),xg=({className:e,...t})=>(0,H.jsxs)(`div`,{className:R(`flex flex-1 items-center gap-2 px-3 py-2`,`rounded-2xl supports-[corner-shape:squircle]:rounded-4xl`,`bg-neutral-50 dark:bg-neutral-950`,`ring-1 ring-neutral-100 dark:ring-neutral-700`,`transition-shadow duration-100 focus-within:ring-3 hover:ring-3`,e),"cmdk-input-wrapper":``,children:[(0,H.jsx)(ac,{className:`size-4 shrink-0 opacity-50`}),(0,H.jsx)(sg.Input,{className:`flex-1 bg-transparent text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,...t})]}),Sg=({className:e,...t})=>(0,H.jsx)(sg.List,{className:R(`max-h-75 overflow-y-auto overflow-x-hidden`,e),...t}),Cg=e=>(0,H.jsx)(sg.Empty,{className:`py-6 text-center text-sm`,...e}),wg=({className:e,...t})=>(0,H.jsx)(sg.Group,{className:R(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs`,e),...t}),Tg=({className:e,...t})=>(0,H.jsx)(sg.Separator,{className:R(`-mx-1 h-px bg-border`,e),...t}),Eg=({className:e,...t})=>(0,H.jsx)(sg.Item,{className:R(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50`,e),...t}),Dg=({className:e,...t})=>(0,H.jsx)(`span`,{className:R(`ml-auto text-muted-foreground text-xs tracking-widest`,e),...t}),Og={...yg,Dialog:bg,Input:xg,List:Sg,Empty:Cg,Group:wg,Separator:Tg,Item:Eg,Shortcut:Dg},kg=(0,z.createContext)(null),Ag=()=>{let e=(0,z.useContext)(kg);if(!e)throw Error(`useMultiSelect must be used within MultiSelectProvider`);return e},jg=({values:e,defaultValues:t,onValueChange:n,loop:r=!1,className:i,children:a,dir:o,...s})=>{let[c,l]=(0,z.useState)(t??[]),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(-1),g=(0,z.useRef)(null),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(``);(0,z.useEffect)(()=>{e&&l(e)},[e]);let x=(0,z.useCallback)(e=>{if(c.includes(e)){let t=c.filter(t=>t!==e);l(t),n?.(t)}else{let t=[...c,e];l(t),n?.(t)}},[c]),S=(0,z.useCallback)(e=>{e.preventDefault();let t=e.currentTarget,n=t.value.substring(t.selectionStart??0,t.selectionEnd??0);b(n),v(n===u)},[u]),C=(0,z.useCallback)(e=>{e.stopPropagation();let t=g.current;if(!t)return;let n=()=>{let e=m+1;h(e>c.length-1?r?0:-1:e)},i=()=>{let e=m-1;h(e<0?c.length-1:e)},a=()=>{let e=m-1<=0?c.length-1==0?-1:0:m-1;h(e)};switch(e.key){case`ArrowLeft`:o===`rtl`?c.length>0&&(m!==-1||r)&&n():c.length>0&&t.selectionStart===0&&i();break;case`ArrowRight`:o===`rtl`?c.length>0&&t.selectionStart===0&&i():c.length>0&&(m!==-1||r)&&n();break;case`Backspace`:case`Delete`:c.length>0&&(m!==-1&&m<c.length?(x(c[m]),a()):(t.selectionStart===0&&y===u||_)&&x(c[c.length-1]));break;case`Enter`:p(!0);break;case`Escape`:m===-1?f&&p(!1):h(-1)}},[c,u,m,r]),w=(0,z.useMemo)(()=>({value:c,onValueChange:x,open:f,setOpen:p,inputValue:u,setInputValue:d,activeIndex:m,setActiveIndex:h,ref:g,handleSelect:S}),[c,x,f,p,u,d,m,h,g,S]);return(0,H.jsx)(kg,{value:w,children:(0,H.jsx)(yg,{onKeyDown:C,className:R(`flex w-full flex-col gap-2 overflow-visible bg-transparent`,i),dir:o,...s,children:a})})},Mg=({className:e,getBadgeValue:t=e=>e,validationStyleEnabled:n=!1,children:r,...i})=>{let{value:a,onValueChange:o,activeIndex:s}=Ag(),c=(0,z.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]);return(0,H.jsxs)(`div`,{className:R(`flex w-full flex-col gap-3`,`cursor-pointer select-text text-base shadow-none outline-none md:text-sm`,`rounded-xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl`,`px-2 py-3 md:py-2`,`bg-neutral-50 dark:bg-neutral-950`,`text-foreground`,`ring-0`,`focus-within:outline-none`,`focus-within:ring-3`,`focus-within:ring-neutral-200`,`dark:focus-within:ring-neutral-500`,`focus-within:ring-offset-white`,`dark:focus-within:ring-offset-neutral-500`,`[box-shadow:none]`,`disabled:cursor-not-allowed disabled:opacity-50`,`aria-invalid:border-error`,n&&`valid:border-success invalid:border-error`,e),...i,children:[a.length>0&&(0,H.jsx)(`div`,{className:`flex w-full flex-wrap gap-1`,children:a.map((e,n)=>(0,H.jsxs)(th,{className:R(`flex items-center gap-1 rounded-xl px-1`,s===n&&`ring-2 ring-muted-foreground`),color:`text`,children:[(0,H.jsx)(`span`,{className:`text-xs`,children:t(e)}),(0,H.jsxs)(`button`,{"aria-label":`Remove ${e} option`,"aria-roledescription":`button to remove option`,onMouseDown:c,onClick:()=>o(e),children:[(0,H.jsxs)(`span`,{className:`sr-only`,children:[`Remove `,e,` option`]}),(0,H.jsx)(pe,{className:`size-4 cursor-pointer`})]})]},e))}),r]})},Ng=e=>{let t=(0,V.c)(5),{className:n,...r}=e,{setOpen:i,inputValue:a,setInputValue:o,activeIndex:s,setActiveIndex:c,handleSelect:l,ref:u}=Ag(),d,f;t[0]===i?(d=t[1],f=t[2]):(d=()=>i(!1),f=()=>i(!0),t[0]=i,t[1]=d,t[2]=f);let p;return t[3]===c?p=t[4]:(p=()=>c(-1),t[3]=c,t[4]=p),(0,H.jsx)(Og.Input,{...r,tabIndex:0,ref:u,value:a,onValueChange:s===-1?o:void 0,onSelect:l,onBlur:d,onFocus:f,onClick:p,className:R(`ml-2 flex-1 cursor-pointer outline-hidden`,n,s!==-1&&`caret-transparent`)})},Pg=e=>{let t=(0,V.c)(2),{children:n}=e,{open:r}=Ag(),i=r&&n,a;return t[0]===i?a=t[1]:(a=(0,H.jsx)(`div`,{className:`relative`,children:i}),t[0]=i,t[1]=a),a},Fg=({className:e,children:t})=>(0,H.jsxs)(Og.List,{className:R(`absolute top-0 z-10 flex w-full flex-col gap-2`,`rounded-xl p-2 shadow-md`,`bg-white dark:bg-neutral-950`,`text-foreground`,`border border-neutral-200 dark:border-neutral-800`,`transition-colors`,e),children:[t,(0,H.jsx)(Og.Empty,{children:(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`No results found`})})]}),Ig=e=>{let t=(0,V.c)(4),{className:n,value:r,children:a,...o}=e,{value:s,onValueChange:c,setInputValue:l}=Ag(),u=Rg,d=s.includes(r),f;return t[0]!==c||t[1]!==l||t[2]!==r?(f=()=>{c(r),l(``)},t[0]=c,t[1]=l,t[2]=r,t[3]=f):f=t[3],(0,H.jsxs)(Og.Item,{...o,onSelect:f,className:R(`flex cursor-pointer justify-between`,`rounded-lg px-2 py-1`,`transition-colors`,`hover:bg-neutral/10`,d&&`opacity-50`,o.disabled&&`cursor-not-allowed opacity-50`,n),onMouseDown:u,children:[a,d&&(0,H.jsx)(i,{className:`size-4`})]})},Lg=jg;Lg.Trigger=Mg,Lg.Input=Ng,Lg.Content=Pg,Lg.List=Fg,Lg.Item=Ig;function Rg(e){e.preventDefault(),e.stopPropagation()}var zg=e=>{let{id:t,...n}=e,r=(0,z.useId)(),i=t??r;return(0,H.jsx)(Bg,{value:{id:i},children:(0,H.jsx)(`div`,{className:`flex flex-col gap-2 p-2`,id:i,suppressHydrationWarning:!0,...n})})},Bg=(0,z.createContext)({}),Vg=e=>e.type===`checkbox`,Hg=e=>e.type===`file`,Ug=e=>e instanceof Date,Wg=e=>e==null,Gg=e=>typeof e==`object`,Kg=e=>!Wg(e)&&!Array.isArray(e)&&Gg(e)&&!Ug(e),qg=e=>Kg(e)&&e.target?Vg(e.target)?e.target.checked:Hg(e.target)?e.target.files:e.target.value:e,Jg=/[.[\]'"]/,Yg=e=>e.split(Jg).filter(Boolean);function Xg(e,t){let n=Yg(t),r=e._formValues,i=e._defaultValues;for(let e=0;e<n.length-1;e++){let t=n[e];if(r=r==null?r:r[t],i=i==null?i:i[t],r===null||i===null)return null}}var Zg=(e,t)=>t.split(`.`).some((t,n,r)=>!isNaN(Number(t))&&e.has(r.slice(0,n).join(`.`))),Qg=typeof window<`u`&&window.HTMLElement!==void 0&&typeof document<`u`;function $g(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e);let t=typeof FileList<`u`&&e instanceof FileList;if(Qg&&(e instanceof Blob||t))return e;let n=Array.isArray(e);if(!n&&e.constructor!==Object)return e;let r=n?[]:Object.create(Object.getPrototypeOf(e));for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=$g(e[t]));return r}var e_={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`,SUBMIT:`submit`,TRIGGER:`trigger`,VALID:`valid`},t_={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},n_={max:`max`,min:`min`,maxLength:`maxLength`,minLength:`minLength`,pattern:`pattern`,required:`required`,validate:`validate`},r_=`root`,i_=[`__proto__`,`constructor`,`prototype`],a_=/^\w*$/,o_=e=>a_.test(e),s_=e=>e===void 0,X=(e,t,n)=>{if(!t||!Kg(e))return n;let r=o_(t)?[t]:Yg(t);if(r.some(e=>i_.includes(e)))return n;let i=r.reduce((e,t)=>Wg(e)?void 0:e[t],e);return s_(i)||i===e?s_(e[t])?n:e[t]:i},c_=e=>typeof e==`boolean`,l_=e=>typeof e==`function`,u_=(e,t,n)=>{let r=-1,i=o_(t)?[t]:Yg(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=Kg(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(i_.includes(t))return;e[t]=a,e=e[t]}},d_=z.createContext(null);d_.displayName=`HookFormControlContext`;var f_=()=>z.useContext(d_),p_=(e,t,n,r=!0)=>{let i={};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==t_.all&&(t._proxyFormState[i]=!r||t_.all),n&&(n[i]=!0),e[i]}});return i},m_=Qg?z.useLayoutEffect:z.useEffect,h_=e=>{let t=e.constructor&&e.constructor.prototype;return Kg(t)&&t.hasOwnProperty(`isPrototypeOf`)},g_=e=>Wg(e)||!Gg(e),__=(e,t)=>t.length===0&&!Array.isArray(e)&&!h_(e);function v_(e,t,n=new WeakMap){if(e===t)return!0;if(g_(e)||g_(t))return Object.is(e,t);if(Ug(e)&&Ug(t))return Object.is(e.getTime(),t.getTime());let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(__(e,r)||__(t,i))return Object.is(e,t);if(!r.length&&Array.isArray(e)!==Array.isArray(t))return!1;let a=n.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{let r=new WeakSet;r.add(t),n.set(e,r)}for(let i of r){let r=e[i];if(!(i in t))return!1;if(i!==`ref`){let e=t[i];if(Ug(r)&&Ug(e)||(Kg(r)||Array.isArray(r))&&(Kg(e)||Array.isArray(e))?!v_(r,e,n):!Object.is(r,e))return!1}}return!0}function y_(e){let t=z.useRef(!1),n=z.useRef(!1),r=z.useRef(void 0),i=z.useRef(0);return i.current++,!n.current&&e&&(n.current=!0,r.current=$g(e())),{resyncIfNeeded:z.useCallback((e,a,o)=>{if(e&&(t.current||n.current&&i.current>1)){let e=a();v_(r.current,e)||o(e)}t.current=!0},[]),snapshot:z.useCallback((e,t)=>{e&&(r.current=$g(t()))},[])}}function b_(e){let t=f_(),{control:n=t,disabled:r,name:i,exact:a}=e||{},o=()=>({...n._formState,defaultValues:n._defaultValues}),[s,c]=z.useState(o),l=z.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),{resyncIfNeeded:u,snapshot:d}=y_(o);return m_(()=>{u(!r,o,c);let e=n._subscribe({name:i,formState:l.current,exact:a,callback:e=>{!r&&c({...n._formState,...e,defaultValues:n._defaultValues})}});return()=>{e(),d(!r,o)}},[i,r,a,u,d]),z.useEffect(()=>{l.current.isValid&&n._setValid(!0)},[n]),z.useMemo(()=>p_(s,n,l.current,!1),[s,n])}var x_=e=>typeof e==`string`,S_=(e,t,n,r,i)=>x_(e)?(r&&t.watch.add(e),X(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),X(n,e,X(i,e)))):(r&&(t.watchAll=!0),n);function C_(e){let t=f_(),{control:n=t,name:r,defaultValue:i,disabled:a,exact:o,compute:s}=e||{},c=z.useRef(i),l=z.useRef(s),u=z.useRef(void 0),d=z.useRef(n),f=z.useRef(r);l.current=s;let p=()=>{let e=n._getWatch(r,c.current);return l.current?l.current(e):e},[m,h]=z.useState(p),g=z.useCallback(e=>{let t=S_(r,n._names,e||n._formValues,!1,c.current);return l.current?l.current(t):t},[n._formValues,n._names,r]),_=z.useCallback(e=>{if(!a){let t=S_(r,n._names,e||n._formValues,!1,c.current);if(l.current){let e=l.current(t);v_(e,u.current)||(h(e),u.current=e)}else h(t)}},[n._formValues,n._names,a,r]),{resyncIfNeeded:v,snapshot:y}=y_(p),b=z.useRef(_);b.current=_;let x=z.useRef(g);x.current=g,m_(()=>{d.current!==n||!v_(f.current,r)?(d.current=n,f.current=r,b.current()):v(!a,()=>x.current(),e=>{h(e),u.current=e});let e=n._subscribe({name:r,formState:{values:!0},exact:o,callback:e=>{b.current(e.values)}});return()=>{e(),y(!a,()=>x.current())}},[n,o,r,a,v,y]),z.useEffect(()=>n._removeUnmounted());let S=d.current!==n,C=f.current;return z.useMemo(()=>{if(a)return!1;let e=!S&&!v_(C,r);return S||e},[a,S,r,C])?g():m}function w_(e){let t=f_(),{name:n,disabled:r,control:i=t,shouldUnregister:a,defaultValue:o,exact:s=!0}=e,c=Zg(i._names.array,n),l=C_({control:i,name:n,defaultValue:z.useMemo(()=>{let e=X(i._formValues,n,X(i._defaultValues,n,o));return s_(e)?Xg(i,n):e},[i,n,o]),exact:s}),u=b_({control:i,name:n,exact:s}),d=z.useRef(e),f=z.useRef(null),p=z.useRef(i.register(n,{...e.rules,value:l,...c_(e.disabled)?{disabled:e.disabled}:{}}));d.current=e;let m=z.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!X(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!X(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!X(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!X(u.validatingFields,n)},error:{enumerable:!0,get:()=>X(u.errors,n)}}),[u,n]),h=z.useCallback(e=>{let t=qg(e);return X(i._fields,n)||(p.current=i.register(n,{...d.current.rules,value:t})),p.current.onChange({target:{value:qg(e),name:n},type:e_.CHANGE})},[n,i]),g=z.useCallback(()=>p.current.onBlur({target:{value:X(i._formValues,n),name:n},type:e_.BLUR}),[n,i._formValues]),_=z.useCallback(e=>{e&&(f.current={focus:()=>l_(e.focus)&&e.focus(),select:()=>l_(e.select)&&e.select(),setCustomValidity:t=>l_(e.setCustomValidity)&&e.setCustomValidity(t),reportValidity:()=>l_(e.reportValidity)&&e.reportValidity()});let t=X(i._fields,n);t&&t._f&&e&&(t._f.ref=f.current)},[i._fields,n]),v=z.useMemo(()=>({name:n,value:l,...c_(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:h,onBlur:g,ref:_}),[n,r,u.disabled,h,g,_,l]);return z.useEffect(()=>{let e=i._options.shouldUnregister||a;p.current=i.register(n,{...d.current.rules,...c_(d.current.disabled)?{disabled:d.current.disabled}:{}});let t=(e,t)=>{let n=X(i._fields,e);n&&n._f&&(n._f.mount=t)};if(t(n,!0),e){let e=$g(X(a?i._defaultValues:i._options.values||i._defaultValues,n,X(i._options.defaultValues,n,d.current.defaultValue)));u_(i._defaultValues,n,e),s_(X(i._formValues,n))&&u_(i._formValues,n,e)}if(!c&&i.register(n),f.current){let e=X(i._fields,n);e&&e._f&&(e._f.ref=f.current)}return()=>{(c?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,c,a]),z.useEffect(()=>{i._setDisabledField({disabled:r,name:n})},[r,n,i]),z.useMemo(()=>({field:v,formState:u,fieldState:m}),[v,u,m])}var T_=e=>e.render(w_(e)),E_=e=>({isOnSubmit:!e||e===t_.onSubmit,isOnBlur:e===t_.onBlur,isOnChange:e===t_.onChange,isOnAll:e===t_.all,isOnTouch:e===t_.onTouched}),D_=(e,t,n)=>{if(n)return!1;if(t.watchAll||t.watch.has(e))return!0;for(let n of t.watch)if(e.startsWith(n)&&e.charAt(n.length)===`.`)return!0;return!1},O_=(e,t,n,r)=>{for(let i of n||Object.keys(e)){if(i===`_f`)continue;let a=n?X(e,i):e[i];if(a){let{_f:e}=a;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],i)&&!r||e.ref&&t(e.ref,e.name)&&!r)return!0;if(O_(a,t))break}else if((Kg(a)||Array.isArray(a))&&O_(a,t))break}}},k_=(e,t,n)=>{let r=X(e,n),i=Array.isArray(r)?r:[];return u_(i,r_,t[n]),u_(e,n,i),e},A_=e=>Kg(e)&&!Object.keys(e).length,j_=e=>{if(!Qg)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},M_=e=>e.type===`radio`,N_=e=>e instanceof RegExp,P_=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},F_={value:!1,isValid:!1},I_={value:!0,isValid:!0},L_=e=>{if(!Array.isArray(e))return F_;if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}let t=e[0];return!t||!t.checked||t.disabled?F_:!t.attributes||!(`value`in t.attributes)||s_(t.value)||t.value===``?I_:{value:t.value,isValid:!0}},R_={isValid:!1,value:null},z_=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,R_):R_;function B_(e,t,n=`validate`){if(x_(e)||Array.isArray(e)&&e.every(x_)||c_(e)&&!e)return{type:n,message:x_(e)?e:``,ref:t}}var V_=e=>Kg(e)&&!N_(e)?e:{value:e,message:``},H_=async(e,t,n,r,i,a)=>{let{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:p,validate:m,name:h,valueAsNumber:g,mount:_}=e._f,v=X(n,h);if(!_||t.has(h))return{};let y=s?s[0]:o,b=e=>{if(i&&y.reportValidity){let t=c_(e)?``:e||``;s?s.forEach(e=>e.setCustomValidity(t)):y.setCustomValidity(t),y.reportValidity()}},x={},S=M_(o),C=Vg(o),w=S||C,T=(g||Hg(o))&&s_(o.value)&&s_(v)||j_(o)&&o.value===``||v===``||Array.isArray(v)&&!v.length,E=P_.bind(null,h,r,x),D=(e,t,n,r=n_.maxLength,i=n_.minLength)=>{let a=e?t:n;x[h]={type:e?r:i,message:a,ref:o,...E(e?r:i,a)}};if(a?!Array.isArray(v)||!v.length:c&&(!w&&(T||Wg(v))||c_(v)&&!v||C&&!L_(s).isValid||S&&!z_(s).isValid)){let{value:e,message:t}=x_(c)?{value:!!c,message:c}:V_(c);if(e&&(x[h]={type:n_.required,message:t,ref:y,...E(n_.required,t)},!r))return b(t),x}if(!T&&(!Wg(d)||!Wg(f))){let e,t,n=V_(f),i=V_(d);if(!Wg(v)&&!Ug(v)&&!isNaN(v)){let r=o.valueAsNumber||v&&+v;Wg(n.value)||(e=r>n.value),Wg(i.value)||(t=r<i.value)}else{let r=o.valueAsDate||new Date(v),a=e=>new Date(new Date().toDateString()+` `+e),s=o.type==`time`,c=o.type==`week`;x_(n.value)&&v&&(e=s?a(v)>a(n.value):c?v>n.value:r>new Date(n.value)),x_(i.value)&&v&&(t=s?a(v)<a(i.value):c?v<i.value:r<new Date(i.value))}if((e||t)&&(D(!!e,n.message,i.message,n_.max,n_.min),!r))return b(x[h].message),x}if((l||u)&&!T&&(x_(v)||a&&Array.isArray(v))){let e=V_(l),t=V_(u),n=!Wg(e.value)&&v.length>+e.value,i=!Wg(t.value)&&v.length<+t.value;if((n||i)&&(D(n,e.message,t.message),!r))return b(x[h].message),x}if(p&&!T&&x_(v)){let{value:e,message:t}=V_(p);if(N_(e)&&!v.match(e)&&(x[h]={type:n_.pattern,message:t,ref:o,...E(n_.pattern,t)},!r))return b(t),x}if(m){if(l_(m)){let e=B_(await m(v,n),y);if(e&&(x[h]={...e,...E(n_.validate,e.message)},!r))return b(e.message),x}else if(Kg(m)){let e={};for(let t in m){if(!A_(e)&&!r)break;let i=B_(await m[t](v,n),y,t);i&&(e={...i,...E(t,i.message)},b(i.message),r&&(x[h]=e))}if(!A_(e)&&(x[h]={ref:y,...e},!r))return x}}let O=x[h];return b(!O||O.message),x},U_=e=>Array.isArray(e)?e:[e],W_=e=>Array.isArray(e)?e.filter(Boolean):[];function G_(e,t){let n=t.length-1,r=0;for(;r<n;){if(Wg(e)){e=void 0;break}e=e[t[r]],r++}return e}function K_(e){for(let t in e)if(e.hasOwnProperty(t)&&!s_(e[t]))return!1;return!0}function q_(e,t){if(x_(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;let n=Array.isArray(t)?t:o_(t)?[t]:Yg(t);if(n.some(e=>i_.includes(String(e))))return e;let r=n.length===1?e:G_(e,n),i=n.length-1,a=n[i];return r&&delete r[a],i!==0&&(Kg(r)&&A_(r)||Array.isArray(r)&&K_(r))&&q_(e,n.slice(0,-1)),e}var J_=z.createContext(null);J_.displayName=`HookFormContext`;var Y_=()=>z.useContext(J_),X_=({children:e,watch:t,getValues:n,getErrors:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:c,trigger:l,formState:u,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y})=>{let b=z.useMemo(()=>({watch:t,getValues:n,getErrors:r,getFieldState:i,setError:a,clearErrors:o,setValue:s,setValues:c,trigger:l,formState:u,resetField:d,reset:f,resetDefaultValues:p,handleSubmit:m,unregister:h,control:g,register:_,setFocus:v,subscribe:y}),[o,g,u,r,i,n,m,_,f,p,d,a,v,s,c,y,l,h,t]);return z.createElement(J_.Provider,{value:b},z.createElement(d_.Provider,{value:b.control},e))},Z_=()=>{let e=[];return{get observers(){return e},next:t=>{for(let n of e)n.next&&n.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}};function Q_(e,t){let n={};for(let r in e)if(e.hasOwnProperty(r)){let i=e[r],a=t[r];if(i&&Kg(i)&&a){let e=Q_(i,a);Kg(e)&&(n[r]=e)}else e[r]&&(n[r]=a)}return n}var $_=(e,t)=>e!==null&&Gg(e)&&Object.prototype.hasOwnProperty.call(e,t),ev=(e,t)=>{if(!t)return!1;let n=e;for(let r of o_(t)?[t]:Yg(t)){if(!$_(n,r))return $_(e,t);n=n[r]}return!0},tv=e=>e.type===`select-multiple`,nv=e=>M_(e)||Vg(e),rv=e=>j_(e)&&e.isConnected;function iv(e){return Array.isArray(e)||Kg(e)}function av(e,t,n=``,r=[]){for(let i in e){let a=n?`${n}.${i}`:i,o=e[i];iv(o)&&iv(X(t,a))?av(o,t,a,r):r.push(a)}return r}var ov=e=>{for(let t in e)if(l_(e[t]))return!0;return!1};function sv(e){return Array.isArray(e)||Kg(e)&&!ov(e)}function cv(e){return!!(e&&`_f`in e)}function lv(e){return Array.isArray(e)?!e.some(e=>!s_(e)):!Object.keys(e).length}function uv(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function dv(e,t={},n){for(let r in e){let i=e[r],a=n&&n[r];sv(i)&&(!Array.isArray(i)||!cv(a))?(t[r]=Array.isArray(i)?[]:{},dv(i,t[r],a),lv(t[r])&&uv(t,r)):s_(i)||(t[r]=!0)}return t}function fv(e,t,n,r){n||=dv(t,{},r);for(let i in e){let a=e[i],o=r&&r[i];sv(a)&&(!Array.isArray(a)||!cv(o))?(s_(t)||g_(n[i])?n[i]=dv(a,Array.isArray(a)?[]:{},o):fv(a,Wg(t)?{}:t[i],n[i],o),lv(n[i])&&uv(n,i)):v_(a,t[i])?uv(n,i):n[i]=!0}return n}var pv=(e,t)=>{let n=t.split(`.`),r=[],i=n[0];for(let t=1;t<n.length;i+=`.`+n[t++])!isNaN(+n[t])&&e.has(i)&&r.push(`${i}.${n[t]}`);return r},mv=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>s_(e)?e:t?e===``?NaN:e&&+e:n&&x_(e)?new Date(e):r?r(e):e;function hv(e){let t=e.ref;return Hg(t)?t.files:M_(t)?z_(e.refs).value:tv(t)?[...t.selectedOptions].map(({value:e})=>e):Vg(t)?L_(e.refs).value:mv(t.value,e)}var gv=(e,t,n,r)=>{let i={};for(let n of e){let e=X(t,n);e&&u_(i,n,e._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},_v=e=>s_(e)?e:N_(e)?e.source:Kg(e)?N_(e.value)?e.value.source:e.value:e,vv=`AsyncFunction`,yv=e=>{if(!e||!e.validate)return!1;if(l_(e.validate))return e.validate.constructor.name===vv;if(Kg(e.validate)){for(let t in e.validate)if(e.validate[t].constructor.name===vv)return!0}return!1},bv=e=>e.mount&&(e.required||!s_(e.required)&&e.required!==!1||!s_(e.min)||!s_(e.max)||!s_(e.maxLength)||!s_(e.minLength)||e.pattern||e.validate);function xv(e,t,n){let r=X(e,n);if(r||o_(n))return{error:r,name:n};let i=n.split(`.`);for(;i.length;){let r=i.join(`.`),a=X(t,r),o=X(e,r);if(a&&!Array.isArray(a)&&n!==r)return{name:n};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};i.pop()}return{name:n}}var Sv=(e,t,n,r)=>{n(e);let i=Object.keys(e).filter(e=>e!==`name`);return!i.length||r&&i.length>=Object.keys(t).length||i.find(e=>t[e]===(!r||t_.all))},Cv=(e,t,n)=>!e||!t||e===t||U_(e).some(e=>e&&(n?e===t||e.startsWith(t+`.`):e.startsWith(t)||t.startsWith(e))),wv=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:!(n?r.isOnChange:i.isOnChange)||e,Tv=(e,t)=>{let n=X(e,t);!W_(n).length&&!(n!=null&&n.root)&&q_(e,t)},Ev={mode:t_.onSubmit,reValidateMode:t_.onChange,shouldFocusError:!0},Dv=`form`,Ov=(e,t)=>{for(let n in e)n in t||delete e[n];Object.assign(e,t)},kv={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Av(e={}){let t={...Ev,...e},n={...$g(kv),isLoading:l_(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},r={},i=(Kg(t.defaultValues)||Kg(t.values))&&$g(t.defaultValues||t.values)||{},a=t.shouldUnregister?{}:$g(i),o={action:!1,actionArrayLengths:new Map,mount:!1,watch:!1,keepIsValid:!1},s={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c={},l={},u=0,d=E_(t.mode),f=E_(t.reValidateMode),p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},m={...p},h={...m},g={array:Z_(),state:Z_()},_=0,v=t.criteriaMode===t_.all,y=(e,t)=>n=>{clearTimeout(l[e]),l[e]=setTimeout(t,n)},b=async e=>{if(!o.keepIsValid&&!t.disabled&&(m.isValid||h.isValid||e)){let e=++_,i;t.resolver?(i=A_((await A()).errors),e===_&&x()):i=await M({fields:r,onlyCheckValid:!0,eventType:e_.VALID}),e===_&&i!==n.isValid&&g.state.next({isValid:i})}},x=(e,r)=>{!t.disabled&&(m.isValidating||m.validatingFields||h.isValidating||h.validatingFields)&&((e||s.mount).forEach(e=>{e&&(r?u_(n.validatingFields,e,r):q_(n.validatingFields,e))}),g.state.next({validatingFields:n.validatingFields,isValidating:!A_(n.validatingFields)}))},S=()=>{n.dirtyFields=fv(i,a,void 0,r)},C=(e,i=[],s,c,l=!0,u=!0)=>{if(c&&s&&!t.disabled){o.action=!0;let t=X(r,e);if(o.actionArrayLengths.has(e)||o.actionArrayLengths.set(e,Array.isArray(t)?t.length:0),u&&Array.isArray(t)){let n=s(t,c.argA,c.argB);l&&u_(r,e,n)}let a=X(n.errors,e);if(u&&Array.isArray(a)){let t=a.root,r=s(a,c.argA,c.argB)||a;t&&(r.root=t),l&&u_(n.errors,e,r),Tv(n.errors,e)}let d=X(n.touchedFields,e);if((m.touchedFields||h.touchedFields)&&u&&Array.isArray(d)){let t=s(d,c.argA,c.argB);l&&u_(n.touchedFields,e,t)}(m.dirtyFields||h.dirtyFields)&&S(),g.state.next({name:e,isDirty:P(e,i),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else u_(a,e,i)},w=(e,t)=>{u_(n.errors,e,t),n.errors={...n.errors},g.state.next({errors:n.errors})},T=e=>{n.errors=e,g.state.next({errors:n.errors,isValid:!1})},E=e=>{let t=o_(e)?[e]:Yg(e),n=a,r=i;for(let e=0;e<t.length-1;e++){let i=t[e];if(n=Wg(n)?n:n[i],r=Wg(r)?r:r[i],n===null&&r!==null)return!0}return!1},D=e=>{if(!o.actionArrayLengths.size)return!1;let t=o_(e)?[e]:Yg(e),n=a,r=``,i=-1,s=0;for(let e=0;e<t.length;e++){if(Wg(n))return!1;let a=t[e];if(r=r?`${r}.${a}`:a,Array.isArray(n)&&+a>=n.length)return i===-1?!1:e!==i||+a<s;o.actionArrayLengths.has(r)&&(i=e+1,s=o.actionArrayLengths.get(r)),n=n[a]}return!1},O=(t,c,l,u)=>{let d=X(r,t);if(d){if(E(t)||D(t))return;let r=s_(X(a,t)),f=X(a,t,s_(l)?X(i,t):l);s_(f)||u&&u.defaultChecked||c?u_(a,t,c?f:hv(d._f)):ie(t,f),o.mount&&!o.action&&(b(),r&&n.isDirty&&(m.isDirty||h.isDirty)&&(P()||(n.isDirty=!1,g.state.next({...n}))),e.shouldUnregister&&r&&!s_(X(a,t))&&D_(t,s)&&(o.watch=!0))}},k=(e,o,s,c,l)=>{let u=!1,d=!1,f={name:e};if(!t.disabled||c===!0){if(!s||c){let t=v_(X(i,e),o);(m.isDirty||h.isDirty)&&(d=n.isDirty,n.isDirty=f.isDirty=!t||P(),u=d!==f.isDirty),d=!!X(n.dirtyFields,e),t===n.isDirty?t?q_(n.dirtyFields,e):u_(n.dirtyFields,e,!0):Ov(n.dirtyFields,fv(i,a,void 0,r)),f.dirtyFields=n.dirtyFields,u||=(m.dirtyFields||h.dirtyFields)&&d!==!t}if(s){let t=X(n.touchedFields,e);t||(u_(n.touchedFields,e,s),f.touchedFields=n.touchedFields,u||=(m.touchedFields||h.touchedFields)&&t!==s)}u&&l&&g.state.next(f)}return u?f:{}},ee=(e,r,i,a)=>{let o=X(n.errors,e),s=(m.isValid||h.isValid)&&c_(r)&&n.isValid!==r;if(t.delayError&&i?(c[e]=y(e,()=>w(e,i)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e],i?u_(n.errors,e,i):q_(n.errors,e),n.errors={...n.errors}),(i?!v_(o,i):o)||!A_(a)||s){let t={...a,...s&&c_(r)?{isValid:r}:{},errors:n.errors,name:e};g.state.next(t)}},A=async e=>(x(e,!0),await t.resolver(a,t.context,gv(e||s.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),j=async e=>{let{errors:t}=await A(e);if(x(e),e){for(let r of e){let e=X(t,r);e?s.array.has(r)&&Kg(e)&&!Object.keys(e).some(e=>!Number.isNaN(Number(e)))?k_(n.errors,{[r]:e},r):u_(n.errors,r,e):q_(n.errors,r)}n.errors={...n.errors}}else n.errors=t;return t},te=async({name:t,eventType:r})=>{if(e.validate){let i=await e.validate({formValues:a,formState:n,name:t,eventType:r});if(Kg(i))for(let e in i){let t=i[e];t&&me(`${Dv}.${e}`,{message:x_(t.message)?t.message:``,type:t.type||n_.validate})}else x_(i)||!i?me(Dv,{message:i||``,type:n_.validate}):pe(Dv);return i}return!0},M=async({fields:r,onlyCheckValid:i,name:o,eventType:c,context:l={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(l.runRootValidation=!0,!await te({name:o,eventType:c})&&(l.valid=!1,i)))return l.valid;for(let o in r){let u=r[o];if(u){let{_f:r,...d}=u;if(r){let o=s.array.has(r.name),c=u._f&&yv(u._f),d=m.validatingFields||m.isValidating||h.validatingFields||h.isValidating;c&&d&&x([r.name],!0);let f=await H_(u,s.disabled,a,v,t.shouldUseNativeValidation&&!i,o);if(c&&d&&x([r.name]),f[r.name]&&(l.valid=!1,i)||(!i&&(X(f,r.name)?o?k_(n.errors,f,r.name):u_(n.errors,r.name,f[r.name]):q_(n.errors,r.name)),e.shouldUseNativeValidation&&f[r.name]))break}!A_(d)&&await M({context:l,onlyCheckValid:i,fields:d,name:o,eventType:c})}}return l.valid},N=()=>{for(let e of s.unMount){let t=X(r,e);t&&(t._f.refs?t._f.refs.every(e=>!rv(e)):!rv(t._f.ref))&&ve(e)}s.unMount=new Set},P=(e,t)=>(e&&t&&u_(a,e,t),!v_(o.mount?a:i,i)),ne=(e,t,n)=>S_(e,s,{...o.mount?a:s_(t)||x_(e)?i:t},n,t),re=e=>W_(X(o.mount?a:i,e,t.shouldUnregister?X(i,e,[]):[])),ie=(e,t,n={},i=!1,o=!1,s=!1)=>{let c=X(r,e),l=t;if(c){let n=c._f;n&&(!n.disabled&&u_(a,e,mv(t,n)),l=j_(n.ref)&&Wg(t)?``:t,tv(n.ref)?[...n.ref.options].forEach(e=>e.selected=l.includes(e.value)):n.refs?Vg(n.ref)?n.refs.forEach(e=>{(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(l)?!!l.find(t=>t===e.value):l===e.value||!!l)}):n.refs.forEach(e=>e.checked=e.value===l):Hg(n.ref)?n.ref.value=``:(n.ref.value=l,!n.ref.type&&!o&&!s&&g.state.next({name:e,values:i?a:$g(a)})))}(n.shouldDirty||n.shouldTouch)&&k(e,l,n.shouldTouch,n.shouldDirty,!o),n.shouldValidate&&le(e,{delayError:n.delayError})},F=(e,t,n,i=!1,o=!1,c=!1)=>{s.array.has(e)&&g.array.next({name:e,values:i?a:$g(a)});for(let a in t){if(!t.hasOwnProperty(a))continue;let l=t[a],u=e+`.`+a,d=X(r,u);(s.array.has(e)||Kg(l)||d&&!d._f)&&!Ug(l)?F(u,l,n,i,o,c):ie(u,l,n,i,o,c)}},I=(e,t,i,c,l=!1)=>{let u=X(r,e),d=s.array.has(e),f=c?t:$g(t),p=v_(X(a,e),f);if(p||u_(a,e,f),d)g.array.next({name:e,values:c?a:$g(a)}),(m.isDirty||m.dirtyFields||h.isDirty||h.dirtyFields)&&i.shouldDirty&&(S(),l||g.state.next({name:e,dirtyFields:n.dirtyFields,isDirty:P(e,f)}));else{let t=Array.isArray(f)&&!f.length||A_(f),n=!p&&!l;!u||u._f||Wg(f)||t?ie(e,f,i,c,l,n):F(e,f,i,c,l,n)}if(!p&&!l){let t=D_(e,s),r=c?a:$g(a);if(g.state.next({...t&&n,name:o.mount||t?e:void 0,values:r}),!d)for(let t of pv(s.array,e))g.state.next({name:t,values:r})}},ae=(e,t,n={})=>I(e,t,n,!1),oe=(e,t={})=>{let r=l_(e)?e(a):e;if(!v_(a,r)){a={...a,...r};for(let e of s.mount)ev(r,e)&&I(e,X(r,e),t,!0,!0);g.state.next({...n,name:void 0,type:void 0,...u?{values:a}:{}}),t.shouldValidate&&b()}},se=async i=>{o.mount=!0;let l=i.target,p=l.name,_=!0,y=X(r,p),S=e=>{_=Number.isNaN(e)||Ug(e)&&isNaN(e.getTime())||v_(e,X(a,p,e))};if(y){let o,C,w=l.type?hv(y._f):qg(i),T=i.type===e_.BLUR||i.type===e_.FOCUS_OUT,E=!bv(y._f)&&!e.validate&&!t.resolver&&!X(n.errors,p)&&!y._f.deps,D=E||wv(T,X(n.touchedFields,p),n.isSubmitted,f,d),O=D_(p,s,T);if(u_(a,p,$g(w)),T){if(!l||!l.readOnly){y._f.onBlur&&y._f.onBlur(i);let e=c[p];e&&e(0)}}else y._f.onChange&&y._f.onChange(i);let j=k(p,w,T),N=!A_(j)||O;if(!T&&g.state.next({name:p,type:i.type,...u?{values:$g(a)}:{}}),D)return(!E||!n.isValid)&&(m.isValid||h.isValid)&&(t.mode===`onBlur`?T&&b():T||b()),N&&g.state.next({name:p,...O?{}:j});if(!t.resolver&&e.validate&&await te({name:p,eventType:i.type}),!T&&O&&g.state.next({...n}),t.resolver){let{errors:e}=await A([p]);if(x([p]),S(w),!_){!A_(j)&&g.state.next(j);return}let t=xv(n.errors,r,p),i=xv(e,r,t.name||p);o=i.error,p=i.name,C=A_(e)}else x([p],!0),o=(await H_(y,s.disabled,a,v,t.shouldUseNativeValidation))[p],x([p]),S(w),_&&(o?C=!1:(m.isValid||h.isValid)&&(C=await M({fields:r,onlyCheckValid:!0,name:p,eventType:i.type})));_&&(y._f.deps&&(!Array.isArray(y._f.deps)||y._f.deps.length>0)&&le(y._f.deps),ee(p,C,o,j))}},ce=(e,t)=>{if(X(n.errors,t)&&e.focus)return e.focus(),1},le=async(e,i={})=>{let a,o,u=U_(e);if(t.resolver){let t=await j(s_(e)?e:u);a=A_(t),o=e?!u.some(e=>X(t,e)):a}else e?(o=(await Promise.all(u.map(async e=>{let t=X(r,e);return await M({fields:t&&t._f?{[e]:t}:t,eventType:e_.TRIGGER})}))).every(Boolean),!(!o&&!n.isValid)&&b()):o=a=await M({fields:r,name:e,eventType:e_.TRIGGER});if(i.delayError&&t.delayError&&x_(e)){let r=X(n.errors,e);r?(q_(n.errors,e),c[e]=y(e,()=>w(e,r)),c[e](t.delayError)):(clearTimeout(l[e]),delete c[e])}if(i.shouldTouch)for(let t of e?u:s.mount)!s.array.has(t)&&u_(n.touchedFields,t,!0);return g.state.next({...!x_(e)||(m.isValid||h.isValid)&&a!==n.isValid?{}:{name:e},...t.resolver||!e?{isValid:a}:{},...i.shouldTouch&&(m.touchedFields||h.touchedFields)?{touchedFields:n.touchedFields}:{},errors:n.errors}),i.shouldFocus&&!o&&O_(r,ce,e?u:s.mount),o},ue=(e,t)=>{let r={...o.mount?a:i};return t&&(r=Q_(t.dirtyFields?n.dirtyFields:n.touchedFields,r)),s_(e)?r:x_(e)?X(r,e):e.map(e=>X(r,e))},de=e=>s_(e)?{...n.errors}:x_(e)?X(n.errors,e):e.map(e=>X(n.errors,e)),fe=(e,t)=>{let r=t||n,i=X(r.errors,e);return{invalid:!!i,isDirty:!!X(r.dirtyFields,e),error:i,isValidating:!!X(n.validatingFields,e),isTouched:!!X(r.touchedFields,e)}},pe=e=>{let t=e?U_(e):void 0;t?.forEach(e=>q_(n.errors,e)),t?t.forEach(e=>{g.state.next({name:e,errors:n.errors})}):(n.errors={},g.state.next({errors:n.errors}))},me=(e,t,i)=>{let a=(X(r,e,{_f:{}})._f||{}).ref,{ref:o,message:s,type:c,...l}=X(n.errors,e)||{};u_(n.errors,e,{...l,...t,ref:a}),g.state.next({name:e,errors:n.errors,isValid:!1}),i&&i.shouldFocus&&a&&a.focus&&a.focus()},he=(e,t)=>{if(l_(e)){u++;let{unsubscribe:n}=g.state.subscribe({next:n=>`values`in n&&e(n.values||ne(void 0,t),n)}),r=!1;return{unsubscribe:()=>{r||(r=!0,u--,n())}}}return ne(e,t,!0)},ge=e=>{let t=!!e.formState?.values;t&&u++;let{unsubscribe:r}=g.state.subscribe({next:t=>{if(Cv(e.name,t.name,e.exact)&&Sv(t,e.formState||m,Oe,e.reRenderRoot)){let r={...a};e.callback({values:r,...n,...t,defaultValues:i})}}});if(!t)return r;let o=!1;return()=>{o||(o=!0,u--,r())}},_e=e=>(o.mount=!0,h={...h,...e.formState},ge({...e,formState:{...p,...e.formState}})),ve=(e,o={})=>{for(let c of e?U_(e):s.mount)s.mount.delete(c),s.array.delete(c),o.keepValue||(q_(r,c),q_(a,c)),!o.keepError&&q_(n.errors,c),!o.keepDirty&&q_(n.dirtyFields,c),!o.keepTouched&&q_(n.touchedFields,c),!o.keepIsValidating&&q_(n.validatingFields,c),!t.shouldUnregister&&!o.keepDefaultValue&&q_(i,c);u&&g.state.next({values:$g(a)}),g.state.next({...n,...o.keepDirty?{}:{isDirty:P()}}),!o.keepIsValid&&b()},ye=({disabled:e,name:t})=>{if(c_(e)&&o.mount||e||s.disabled.has(t)){let n=s.disabled.has(t)!==!!e;e?s.disabled.add(t):s.disabled.delete(t),n&&o.mount&&!o.action&&b()}},be=(e,n={})=>{let a=X(r,e),c=c_(n.disabled)||c_(t.disabled),l=!s.registerName.has(e)&&a&&a._f&&!a._f.mount;return u_(r,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...n}}),s.mount.add(e),a&&!l?ye({disabled:c_(n.disabled)?n.disabled:t.disabled,name:e}):O(e,!0,n.value),{...c?{disabled:n.disabled||t.disabled}:{},...t.progressive?{required:!!n.required,min:_v(n.min),max:_v(n.max),minLength:_v(n.minLength),maxLength:_v(n.maxLength),pattern:_v(n.pattern)}:{},name:e,onChange:se,onBlur:se,ref:c=>{if(c){s.registerName.add(e),be(e,n),s.registerName.delete(e),a=X(r,e);let t=s_(c.value)&&c.querySelectorAll&&c.querySelectorAll(`input,select,textarea`)[0]||c,o=nv(t),l=a._f.refs||[];if(o?l.find(e=>e===t):t===a._f.ref)return;let u={...a._f};o?(u.refs=[...l.filter(rv),t,...Array.isArray(X(i,e))?[{}]:[]],u.ref={type:t.type,name:e}):(u.ref=t,delete u.refs),u_(r,e,{_f:u}),O(e,!1,void 0,t)}else a=X(r,e,{}),a._f&&(a._f.mount=!1),(t.shouldUnregister||n.shouldUnregister)&&!(Zg(s.array,e)&&o.action)&&s.unMount.add(e)}}},xe=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&O_(r,ce,s.mount),Se=e=>{c_(e)&&(g.state.next({disabled:e}),O_(r,(t,n)=>{let i=X(r,n);i&&(t.disabled=i._f.disabled||e,Array.isArray(i._f.refs)&&i._f.refs.forEach(t=>{t.disabled=i._f.disabled||e}))},0,!1))},Ce=(e,i)=>async o=>{let c,l;o&&(o.preventDefault&&o.preventDefault(),o.persist&&o.persist());let u=$g(a);if(g.state.next({isSubmitting:!0}),t.resolver){let{errors:e,values:t}=await A();x(),n.errors=e,u=$g(t)}else await M({fields:r,eventType:e_.SUBMIT});if(s.disabled.size)for(let e of s.disabled)q_(u,e);if(q_(n.errors,r_),A_(n.errors)){g.state.next({errors:{}});try{c=await e(u,o)}catch(e){l=e}}else i&&await i({...n.errors},o),xe(),setTimeout(xe);if(g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:A_(n.errors)&&!l,submitCount:n.submitCount+1,errors:n.errors}),l)throw l;return c},we=(e,t={})=>{X(r,e)&&(s_(t.defaultValue)?ae(e,$g(X(i,e))):(ae(e,t.defaultValue),u_(i,e,$g(t.defaultValue))),t.keepTouched||q_(n.touchedFields,e),t.keepDirty||(q_(n.dirtyFields,e),n.isDirty=t.defaultValue?P(e,$g(X(i,e))):P()),t.keepError||(q_(n.errors,e),b()),g.state.next({...n}))},Te=(e,c={})=>{let l=e?$g(e):i,u=$g(l),d=A_(e),f=u,p=r;if(c.keepDefaultValues||(i=l),!c.keepValues){if(c.keepDirtyValues){let e=new Set([...s.mount,...av(fv(i,a,void 0,p),n.dirtyFields)]);for(let t of e){let e=X(n.dirtyFields,t),r=X(a,t),i=X(f,t);e&&!s_(r)?u_(f,t,r):!e&&!s_(i)&&ae(t,i)}}else{if(Qg&&s_(e))for(let e of s.mount){let t=X(r,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(j_(e)){let t=e.closest(`form`);if(t){t.reset();break}}}}if(c.keepFieldsRef)for(let e of s.mount)ae(e,X(f,e));else r={}}if(t.shouldUnregister){if(a=c.keepDefaultValues?$g(i):{},c.keepFieldsRef)for(let e of s.mount)u_(a,e,X(f,e))}else a=$g(f);g.array.next({values:{...f}}),g.state.next({name:void 0,type:void 0,values:{...f}})}s={mount:c.keepDirtyValues?s.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:``},o.mount=!m.isValid||!!c.keepIsValid||!!c.keepDirtyValues||!t.shouldUnregister&&!A_(f),o.watch=!!t.shouldUnregister,o.keepIsValid=!!c.keepIsValid,o.action=!1,o.actionArrayLengths.clear(),c.keepErrors||(n.errors={}),g.state.next({submitCount:c.keepSubmitCount?n.submitCount:0,isDirty:d?!1:c.keepDirty?n.isDirty:c.keepValues?P():!!(c.keepDefaultValues&&!v_(e,i)),isSubmitted:c.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:d?{}:c.keepDirtyValues?c.keepDefaultValues&&a?fv(i,a,void 0,p):n.dirtyFields:c.keepDefaultValues&&e?fv(i,e,void 0,p):c.keepDirty?n.dirtyFields:{},touchedFields:c.keepTouched?n.touchedFields:{},errors:c.keepErrors?n.errors:{},isSubmitSuccessful:c.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},Ee=(e,n)=>Te(l_(e)?e(a):e,{...t.resetOptions,...n}),De=(e,t={})=>{let n=X(r,e),i=n&&n._f;if(i){let e=i.refs?i.refs[0]:i.ref;e.focus&&setTimeout(()=>{e.focus(),t.shouldSelect&&l_(e.select)&&e.select()})}},Oe=e=>{let{name:t,type:r,values:i,...a}=e;n={...n,...a}};g.state.subscribe({next:Oe});let ke={control:{register:be,unregister:ve,getFieldState:fe,handleSubmit:Ce,setError:me,_subscribe:ge,_runSchema:A,_updateIsValidating:x,_focusError:xe,_getWatch:ne,_getDirty:P,_setValid:b,_setFieldArray:C,_setDisabledField:ye,_setErrors:T,_getFieldArray:re,_reset:Te,_resetDefaultValues:()=>l_(t.defaultValues)&&t.defaultValues().then(e=>{Ee(e,t.resetOptions),g.state.next({isLoading:!1})}),_removeUnmounted:N,_disableForm:Se,_subjects:g,_proxyFormState:m,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(e){o=e},get _defaultValues(){return i},get _names(){return s},set _names(e){s=e},get _formState(){return n},get _options(){return t},set _options(e){t={...t,...e},d=E_(t.mode),f=E_(t.reValidateMode)}},subscribe:_e,trigger:le,register:be,handleSubmit:Ce,watch:he,setValue:ae,setValues:oe,getValues:ue,getErrors:de,reset:Ee,resetField:we,resetDefaultValues:(e,t={})=>{if(i=$g(e),!t.keepDirty){let e=fv(i,a,void 0,r);n.dirtyFields=e,n.isDirty=!A_(e)}t.keepIsValid||b(),g.state.next({...n,defaultValues:i})},clearErrors:pe,unregister:ve,setError:me,setFocus:De,getFieldState:fe};return{...ke,formControl:ke}}function jv(e={}){let t=z.useRef(void 0),n=z.useRef(void 0),r=z.useRef(e.formControl),[i,a]=z.useState(()=>({...$g(kv),isLoading:l_(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:l_(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&r.current!==e.formControl){if(r.current=e.formControl,e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!l_(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{let{formControl:n,...r}=Av(e);t.current={...r,formState:i}}}let o=t.current.control;o._options=e;let{resyncIfNeeded:s,snapshot:c}=y_();return m_(()=>{let e=()=>({...o._formState,defaultValues:o._defaultValues});s(!0,e,a);let t=o._subscribe({formState:o._proxyFormState,callback:()=>a({...o._formState,defaultValues:o._defaultValues}),reRenderRoot:!0});return a(e=>({...e,isReady:!0})),o._formState.isReady=!0,()=>{t(),c(!0,e)}},[o,s,c]),z.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),z.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),z.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),z.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),z.useEffect(()=>{if(o._proxyFormState.isDirty){let e=o._getDirty();e!==i.isDirty&&o._subjects.state.next({isDirty:e})}},[o,i.isDirty]),z.useEffect(()=>{e.values&&!v_(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),o._options.resetOptions?.keepIsValid||o._setValid(),n.current=e.values,a(e=>({...e}))):o._resetDefaultValues()},[o,e.values]),z.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=z.useMemo(()=>p_(i,o),[o,i]),t.current}var Mv=(0,z.createContext)({}),Nv=e=>{let t=(0,V.c)(7),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;t[2]===n.name?r=t[3]:(r={name:n.name},t[2]=n.name,t[3]=r);let i=r,a;return t[4]!==i||t[5]!==n?(a=(0,H.jsx)(Mv,{value:i,children:(0,H.jsx)(T_,{...n})}),t[4]=i,t[5]=n,t[6]=a):a=t[6],a},Pv=()=>{let e=(0,V.c)(11),t=(0,z.useContext)(Mv),n=(0,z.useContext)(Bg),{getFieldState:r,formState:i}=Y_(),a;e[0]!==t.name||e[1]!==i||e[2]!==r?(a=r(t.name,i),e[0]=t.name,e[1]=i,e[2]=r,e[3]=a):a=e[3];let o=a;if(!t)throw Error(`useFormField should be used within <FormField>`);let{id:s}=n,c=`${s}-form-item`,l=`${s}-form-item-description`,u=`${s}-form-item-message`,d;return e[4]!==t.name||e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==l||e[9]!==u?(d={id:s,name:t.name,formItemId:c,formDescriptionId:l,formMessageId:u,...o},e[4]=t.name,e[5]=o,e[6]=s,e[7]=c,e[8]=l,e[9]=u,e[10]=d):d=e[10],d},Fv=e=>{let t=(0,V.c)(5),{error:n,formItemId:r,formDescriptionId:i,formMessageId:a}=Pv(),o=n?`${i} ${a}`:`${i}`,s=!!n,c;return t[0]!==r||t[1]!==e||t[2]!==o||t[3]!==s?(c=(0,H.jsx)(Oe,{id:r,"aria-describedby":o,"aria-invalid":s,...e}),t[0]=r,t[1]=e,t[2]=o,t[3]=s,t[4]=c):c=t[4],c},Iv=e=>{let t=(0,V.c)(3),{formDescriptionId:n}=Pv(),r;return t[0]!==n||t[1]!==e?(r=(0,H.jsx)(`p`,{className:`text-neutral text-sm`,id:n,...e}),t[0]=n,t[1]=e,t[2]=r):r=t[2],r},Lv=e=>{let{children:t,...n}=e,{error:r,formMessageId:i}=Pv(),a=r?String(r?.message??``):t;return a?(0,H.jsx)(`p`,{className:`font-medium text-error text-xs`,role:`alert`,id:i,...n,children:a}):null},Rv=({className:e,children:t,...n})=>(0,H.jsxs)(`i`,{className:R(`text-neutral-400 text-xs`,e),...n,children:[`ⓘ `,t]}),zv=e=>{let{className:t,...n}=e,{error:r,formItemId:i}=Pv();return(0,H.jsx)(Sm,{className:R(`mb-2`,r&&`text-error`,t),htmlFor:i,...n})},Bv=({isRequired:e})=>e?(0,H.jsx)(`span`,{"aria-label":`Asterisk meaning the field is required`,children:`*`}):(0,H.jsx)(H.Fragment,{}),Vv=({children:e,isRequired:t,info:n,htmlFor:r,className:i})=>(0,H.jsxs)(`div`,{className:`ml-1 flex gap-1 align-middle text-base leading-none`,children:[e&&(0,H.jsxs)(zv,{htmlFor:r,id:`${r}-label`,suppressHydrationWarning:!0,className:R(`font-bold`,i),children:[e,(0,H.jsx)(Bv,{isRequired:t})]}),n&&(0,H.jsx)(Rv,{content:n})]}),Hv=({label:e,description:t,isRequired:n,info:r,children:i,showErrorMessage:a=!0,htmlFor:o,className:s})=>(0,H.jsxs)(zg,{className:R(`flex w-full flex-col flex-wrap gap-2 px-1 py-2`,s),children:[(t||e)&&(0,H.jsxs)(`div`,{className:`flex max-w-full flex-col gap-1 p-1 leading-none`,children:[e&&(0,H.jsx)(Vv,{isRequired:n,info:r,htmlFor:o,children:e}),t&&(0,H.jsx)(Iv,{children:t})]}),(0,H.jsx)(Fv,{children:i}),a&&(0,H.jsx)(Lv,{"data-testid":`error-message`})]}),Uv=({field:e,name:t,label:n,Element:r,isRequired:i=!1,info:a,description:o,showErrorMessage:s=!0,layoutClassName:c,...l})=>{let{error:u}=Pv(),{value:d,onChange:f,...p}=e??{},m=l,h=m.value===void 0?d??``:m.value,g=(...e)=>{typeof f==`function`&&f(...e),typeof m.onChange==`function`&&m.onChange(...e)};return(0,H.jsx)(Hv,{htmlFor:t,label:n,description:o,isRequired:i,info:a,showErrorMessage:s,"aria-invalid":!!u,className:c,children:(0,H.jsx)(r,{"data-testid":`element`,id:t,...p,...l,value:h,onChange:g,children:l.children})})},Wv=e=>{let t=(0,V.c)(6),{control:n}=Y_(),r;t[0]===e?r=t[1]:(r=t=>{let{field:n}=t;return(0,H.jsx)(Uv,{...e,field:n})},t[0]=e,t[1]=r);let i;return t[2]!==n||t[3]!==e.name||t[4]!==r?(i=(0,H.jsx)(Nv,{control:n,name:e.name,render:r}),t[2]=n,t[3]=e.name,t[4]=r,t[5]=i):i=t[5],i},Gv=e=>(0,H.jsx)(Wv,{id:e.name,"data-testid":e.name,Element:Ap,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,...e}),Kv=e=>{let{field:t,name:n,label:r,description:i,isRequired:a,info:o,showErrorMessage:s,children:c,...l}=e,{error:u}=Pv();return(0,H.jsx)(Hv,{htmlFor:n,label:r,description:i,isRequired:a,info:o,showErrorMessage:s,"aria-invalid":!!u,children:(0,H.jsx)(Lg,{onValueChange:t.onChange,values:t.value,...l,children:c})})},qv=e=>{let{name:t,description:n,label:r,isRequired:i,info:a,showErrorMessage:o,children:s,...c}=e,{control:l}=Y_();return(0,H.jsx)(Nv,{control:l,name:t,render:e=>{let{field:l}=e;return(0,H.jsx)(Kv,{field:l,name:t,label:r,description:n,isRequired:i,info:a,showErrorMessage:o,...c,children:s})}})},Jv=e=>{let{field:t,name:n,label:r,description:i,isRequired:a,info:o,showErrorMessage:s,children:c,...l}=e,{error:u}=Pv();return(0,H.jsx)(Hv,{htmlFor:n,label:r,description:i,isRequired:a,info:o,showErrorMessage:s,"aria-invalid":!!u,children:(0,H.jsx)(L,{onValueChange:t.onChange,defaultValue:t.value,...l,children:c})})},Yv=e=>{let{name:t,description:n,label:r,isRequired:i,info:a,showErrorMessage:o,children:s,...c}=e,{control:l}=Y_();return(0,H.jsx)(Nv,{control:l,name:t,render:e=>{let{field:l}=e;return(0,H.jsx)(Jv,{field:l,name:t,label:r,description:n,isRequired:i,info:a,showErrorMessage:o,...c,children:s})}})},Xv=(e,t,n)=>{if(e&&`reportValidity`in e){let r=X(n,t);e.setCustomValidity(r&&r.message||``),e.reportValidity()}},Zv=(e,t)=>{for(let n in t.fields){let r=t.fields[n];r&&r.ref&&`reportValidity`in r.ref?Xv(r.ref,n,e):r&&r.refs&&r.refs.forEach(t=>Xv(t,n,e))}},Qv=(e,t)=>{t.shouldUseNativeValidation&&Zv(e,t);let n={};for(let r in e){let i=X(t.fields,r),a=Object.assign(e[r]||{},{ref:i&&i.refs?i.refs[0]:i&&i.ref});if($v(t.names||Object.keys(e),r)){let e=Object.assign({},X(n,r));u_(e,`root`,a),u_(n,r,e)}else u_(n,r,a)}return n},$v=(e,t)=>{let n=ey(t).replace(/[.*+?^${}()|\\]/g,`\\$&`);return e.some(e=>ey(e).match(`^${n}\\.\\d+`))};function ey(e){return e.replace(/\[(\d+)]/g,`.$1`).replace(/[[\]]/g,``)}function ty(){return ty=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ty.apply(null,arguments)}function ny(e,t){try{var n=e()}catch(e){return t(e)}return n&&n.then?n.then(void 0,t):n}function ry(e,t){for(var n=Object.create(null);e.length;){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(`unionErrors`in r){var s=r.unionErrors.reduce(function(e,t){return t.errors.length<e.errors.length?t:e}).errors[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(`unionErrors`in r&&r.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=P_(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()}return n}function iy(e,t){for(var n=Object.create(null),r=function(){var r=e[0],i=r.code,a=r.message,o=r.path.join(`.`);if(!n[o]){if(r.code===`invalid_union`&&r.errors.length>0){var s=r.errors.reduce(function(e,t){return t.length<e.length?t:e})[0];n[o]={message:s?.message??a,type:s?.code??i}}else n[o]={message:a,type:i}}if(r.code===`invalid_union`&&r.errors.forEach(function(t){return t.forEach(function(t){return e.push(ty({},t,{path:[].concat(r.path,t.path)}))})}),t){var c=n[o].types,l=c&&c[r.code];n[o]=P_(o,t,n,i,l?[].concat(l,r.message):r.message)}e.shift()};e.length;)r();return n}function ay(e,t,n){if(n===void 0&&(n={}),function(e){return`_zod`in e&&typeof e._zod==`object`}(e))return function(r,i,a){try{return Promise.resolve(ny(function(){function i(e){return a.shouldUseNativeValidation&&Zv({},a),{errors:{},values:n.raw?Object.assign({},r):e}}var o=e;return n.mode===`sync`?i(o.parse(r,t)):Promise.resolve(o.parseAsync(r,t)).then(i)},function(e){if(function(e){var t;return!(e==null||(t=e._zod)==null||(t=t.traits)==null||!t.has(`$ZodError`))}(e))return{values:{},errors:Qv(iy(e.issues,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};if(function(e){return`_def`in e&&typeof e._def==`object`}(e))return function(r,i,a){try{return Promise.resolve(ny(function(){return Promise.resolve(e[n.mode===`sync`?`parse`:`parseAsync`](r,t)).then(function(e){return a.shouldUseNativeValidation&&Zv({},a),{errors:{},values:n.raw?Object.assign({},r):e}})},function(e){if(function(e){return Array.isArray(e?.issues)}(e))return{values:{},errors:Qv(ry(e.errors,!a.shouldUseNativeValidation&&a.criteriaMode===`all`),a)};throw e}))}catch(e){return Promise.reject(e)}};throw Error(`Invalid input: not a Zod schema`)}var oy=async e=>e&&typeof e.then==`function`?await e:e,sy=({schema:e,onSubmit:t,onSubmitSuccess:n,onSubmitError:r,className:i,children:a,autoComplete:o,method:s,...c})=>{let l=async i=>{let a=e?.safeParse(i)??{success:!0,data:void 0};await oy(t?.(i)),a.success?await oy(n?.(a.data)):await oy(r?.(Error(a.error.issues.map(e=>e.message).join(`, `))))},u=e=>{if(e.key!==`Enter`)return;let t=e.target;if(t.tagName!==`INPUT`)return;e.preventDefault();let n=e.currentTarget,r=Array.from(n.querySelectorAll(`input:not([disabled]):not([type="hidden"]), textarea:not([disabled])`)),i=r.indexOf(t);i>=0&&i<r.length-1&&r[i+1]?.focus()};return(0,H.jsx)(X_,{...c,children:(0,H.jsx)(`form`,{className:R(`flex flex-col gap-y-6`,i),onSubmit:c.handleSubmit(l),onKeyDown:u,autoComplete:o?`on`:`off`,noValidate:!0,method:s,children:a})})},cy=(e,t)=>{let n=(0,V.c)(13),r;n[0]===e?r=n[1]:(r=ay(e),n[0]=e,n[1]=r);let i;n[2]!==t||n[3]!==r?(i={resolver:r,...t},n[2]=t,n[3]=r,n[4]=i):i=n[4];let a=jv(i),o;n[5]===a.control?o=n[6]:(o={control:a.control},n[5]=a.control,n[6]=o);let{isSubmitting:s,isSubmitted:c,isLoading:l,isValid:u}=b_(o),d;return n[7]!==a||n[8]!==l||n[9]!==c||n[10]!==s||n[11]!==u?(d={form:a,isSubmitting:s,isSubmitted:c,isLoading:l,isValid:u},n[7]=a,n[8]=l,n[9]=c,n[10]=s,n[11]=u,n[12]=d):d=n[12],d},ly=sy;function uy(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function dy(e,t=`|`){return e.map(e=>Oy(e)).join(t)}function fy(e,t){return typeof t==`bigint`?t.toString():t}function py(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function my(e){return e==null}function hy(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function gy(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function _y(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function vy(e){return JSON.stringify(e)}function yy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var by=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function xy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Sy=py(()=>{if(fb.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Cy(e){if(xy(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return xy(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function wy(e){return Cy(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Ty=new Set([`string`,`number`,`symbol`]);function Ey(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Dy(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Z(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Oy(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ky(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function Ay(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Dy(e,_y(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&gy(e,r,n.shape[r])}return gy(this,`shape`,e),e},checks:[]}))}function jy(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Dy(e,_y(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return gy(this,`shape`,r),r},checks:[]}))}function My(e,t){if(!Cy(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Dy(e,_y(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return gy(this,`shape`,n),n}}))}function Ny(e,t){if(!Cy(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Dy(e,_y(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return gy(this,`shape`,n),n}}))}function Py(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Dy(e,_y(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return gy(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Fy(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return Dy(t,_y(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return gy(this,`shape`,i),i},checks:[]}))}function Iy(e,t,n){return Dy(t,_y(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return gy(this,`shape`,i),i}}))}function Ly(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ry(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function zy(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function By(e){return typeof e==`string`?e:e?.message}function Vy(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function Hy(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:By(e.inst?._zod.def?.error?.(e))??By(a?.(e))??By(t?.error?.(e))??By(n.customError?.(e))??By(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}var Uy=/[\uD800-\uDBFF]/;function Wy(e){let t=e.length;if(!Uy.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Gy(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ky(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function qy(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Jy(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Zy(e,n,r.value)}}function Yy(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Xy(e,t,n){return Yy(e,t,n,!1)}function Zy(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Yy(this,t,n.bind(this))},set(e){Yy(this,t,e)}})}function Qy(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var $y,eb=!1,tb={configurable:!0,get(){eb=!0}};function nb(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&$y!==e._zod){$y=void 0;return}$y=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,tb);let e=eb;eb=!1;try{let r=n(this);return eb?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),eb||=e,r}catch(n){throw delete this[t],eb||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function rb(e,t,n,r){let i=Qy(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var ib=`~constantCatch`;function ab(e){let t=()=>e;return t[ib]=!0,t}var ob,sb={value:void 0,enumerable:!1},cb=`captureStackTrace`in Error?Error:null;function lb(e){let t=cb;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return cb=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function Q(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){sb.value=new a(r);try{Object.defineProperty(n,"_zod",sb)}finally{sb.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Jy(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?lb(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var ub=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},db=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ob=globalThis).__zod_globalConfig??(ob.__zod_globalConfig={});var fb=globalThis.__zod_globalConfig;function pb(e){return e&&Object.assign(fb,e),fb}function mb(){let e=this._zod;return e.message??=JSON.stringify(e.def,fy,2),e.message}function hb(e){this._zod.message=e}var gb={get:mb,set:hb,enumerable:!0,configurable:!0},_b={value:void 0,enumerable:!1},vb={value:void 0,enumerable:!1},yb=new WeakSet([Object.prototype,Error.prototype]),bb=(e,t)=>{e.name=`$ZodError`,_b.value=e._zod,Object.defineProperty(e,"_zod",_b),vb.value=t,Object.defineProperty(e,"issues",vb),_b.value=void 0,vb.value=void 0,Object.defineProperty(e,"message",gb);let n=Object.getPrototypeOf(e);yb.has(n)||(yb.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},xb=Q(`$ZodError`,bb),Sb=Q(`$ZodError`,bb,void 0,{Parent:Error});function Cb(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function wb(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Cb(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Tb(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Eb(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Db=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ub;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Hy(e,o,pb())));throw by(n,a?.callee??t),n}return s.value};return t},Ob=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>Hy(e,o,pb())));throw by(n,a?.callee??t),n}return s.value};return t},kb=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ub;return a.issues.length?{success:!1,error:new(e??xb)(a.issues.map(e=>Hy(e,i,pb())))}:{success:!0,data:a.value}},Ab=kb(Sb),jb=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Hy(e,i,pb())))}:{success:!0,data:a.value}},Mb=jb(Sb),Nb=e=>{let t=Db(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Eb(n,a))};return n},Pb=e=>{let t=Db(e),n=(e,r,i,a)=>t(e,r,i,Eb(n,a));return n},Fb=e=>{let t=Ob(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Eb(n,a))};return n},Ib=e=>{let t=Ob(e),n=async(e,r,i,a)=>await t(e,r,i,Eb(n,a));return n},Lb=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return kb(e)(t,n,i)},Rb=e=>(t,n,r)=>kb(e)(t,n,r),zb=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jb(e)(t,n,i)},Bb=e=>async(t,n,r)=>jb(e)(t,n,r),Vb=/^[cC][0-9a-z]{6,}$/,Hb=/^[0-9a-z]+$/,Ub=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Wb=/^[0-9a-vA-V]{20}$/,Gb=/^[A-Za-z0-9]{27}$/,Kb=/^[a-zA-Z0-9_-]{21}$/;function qb(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Jb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Yb=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Xb=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Zb=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qb=`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function $b(){return new RegExp(Qb,`u`)}var ex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nx=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rx=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ix=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ax=/^[A-Za-z0-9_-]*$/,ox=/^https?$/,sx=/^\+[1-9]\d{6,14}$/,cx=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function lx(e){return RegExp(`^${e}$`)}var ux=lx(cx);function dx(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function fx(e){return RegExp(`^${dx(e)}$`)}function px(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${dx({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${dx({precision:e.precision})}`:n;return RegExp(`^${cx}T(?:${r})$`)}var mx=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},hx=/^[^A-Z]*$/,gx=/^[^a-z]*$/,_x=Q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),vx=e=>{let t=e.value;return!my(t)&&t.length!==void 0},yx=Q(`$ZodCheckMaxLength`,(e,t)=>{var n;_x.init(e,t),(n=e._zod.def).when??(n.when=vx),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Wy(r):i)<=t.maximum)return;let a=Gy(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),bx=Q(`$ZodCheckMinLength`,(e,t)=>{var n;_x.init(e,t),(n=e._zod.def).when??(n.when=vx),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Wy(r):i)>=t.minimum)return;let a=Gy(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xx=Q(`$ZodCheckLengthEquals`,(e,t)=>{var n;_x.init(e,t),(n=e._zod.def).when??(n.when=vx),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Wy(r):i;if(a===t.length)return;let o=Gy(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Sx=Q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;_x.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Cx=Q(`$ZodCheckRegex`,(e,t)=>{Sx.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),wx=Q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=hx,Sx.init(e,t)}),Tx=Q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=gx,Sx.init(e,t)}),Ex=Q(`$ZodCheckIncludes`,(e,t)=>{_x.init(e,t);let n=Ey(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Dx=Q(`$ZodCheckStartsWith`,(e,t)=>{_x.init(e,t);let n=RegExp(`^${Ey(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ox=Q(`$ZodCheckEndsWith`,(e,t)=>{_x.init(e,t);let n=RegExp(`.*${Ey(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),kx=Q(`$ZodCheckOverwrite`,(e,t)=>{_x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ax=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
59
59
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
60
60
|
`)}\n};`)(...Object.values(this.closed))}},jx={major:4,minor:5,patch:4},Mx=Q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=jx;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Ly(t),a;for(let o of n){if(o._zod.def.when){if(Ry(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new ub;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Vy(t.issues,n,e),i||=Ly(t,n))});else{if(t.issues.length===n)continue;Vy(t.issues,n,e),i||=Ly(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Ly(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new ub;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new ub;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Xy(this,`~standard`,Px(this))},set"~standard"(e){Yy(this,`~standard`,e)}}),Nx=e=>e.success?{value:e.data}:{issues:e.error?.issues};function Px(e){return{validate:t=>{try{return Nx(Ab(e,t))}catch{return Mb(e,t).then(Nx)}},vendor:`zod`,version:1}}var Fx=Q(`$ZodString`,(e,t)=>{Mx.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??mx(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Ix=Q(`$ZodStringFormat`,(e,t)=>{Sx.init(e,t),Fx.init(e,t)}),Lx=Q(`$ZodGUID`,(e,t)=>{t.pattern??=Yb,Ix.init(e,t)}),Rx=Q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Xb(e)}else t.pattern??=Xb();Ix.init(e,t)}),zx=Q(`$ZodEmail`,(e,t)=>{t.pattern??=Zb,Ix.init(e,t)});function Bx(e,t){if(!t.normalize&&t.protocol?.source===ox.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}var Vx=/[\t\n\r]/g;function Hx(e){return e.replace(Vx,``)}function Ux(e,t){return t.lastIndex=0,t.test(e.hostname)}function Wx(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Gx=Q(`$ZodURL`,(e,t)=>{Ix.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Bx(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!Ux(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Wx(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Hx(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Kx=Q(`$ZodEmoji`,(e,t)=>{t.pattern??=$b(),Ix.init(e,t)}),qx=Q(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Kb:qb(t.length),Ix.init(e,t)}),Jx=Q(`$ZodCUID`,(e,t)=>{t.pattern??=Vb,Ix.init(e,t)}),Yx=Q(`$ZodCUID2`,(e,t)=>{t.pattern??=Hb,Ix.init(e,t)}),Xx=Q(`$ZodULID`,(e,t)=>{t.pattern??=Ub,Ix.init(e,t)}),Zx=Q(`$ZodXID`,(e,t)=>{t.pattern??=Wb,Ix.init(e,t)}),Qx=Q(`$ZodKSUID`,(e,t)=>{t.pattern??=Gb,Ix.init(e,t)}),$x=Q(`$ZodISODateTime`,(e,t)=>{t.pattern??=px(t),Ix.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),eS=Q(`$ZodISODate`,(e,t)=>{t.pattern??=ux,Ix.init(e,t)}),tS=Q(`$ZodISOTime`,(e,t)=>{t.pattern??=fx(t),Ix.init(e,t)}),nS=Q(`$ZodISODuration`,(e,t)=>{t.pattern??=Jb,Ix.init(e,t)}),rS=Q(`$ZodIPv4`,(e,t)=>{t.pattern??=ex,Ix.init(e,t),e._zod.bag.format=`ipv4`}),iS=/^[0-9a-fA-F:.]+$/;function aS(e){if(!iS.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var oS=Q(`$ZodIPv6`,(e,t)=>{t.pattern??=tx,Ix.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{aS(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),sS=Q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=nx,Ix.init(e,t)});function cS(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:aS(n)}var lS=Q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=rx,Ix.init(e,t),e._zod.check=n=>{cS(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function uS(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var dS=Q(`$ZodBase64`,(e,t)=>{t.pattern??=ix,Ix.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{uS(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function fS(e){if(!ax.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return uS(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var pS=Q(`$ZodBase64URL`,(e,t)=>{t.pattern??=ax,Ix.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{fS(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),mS=Q(`$ZodE164`,(e,t)=>{t.pattern??=sx,Ix.init(e,t)});function hS(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var gS=Q(`$ZodJWT`,(e,t)=>{Ix.init(e,t),e._zod.check=n=>{hS(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),_S=Q(`$ZodUnknown`,(e,t)=>{Mx.init(e,t),e._zod.parse=e=>e}),vS=Q(`$ZodNever`,(e,t)=>{Mx.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function yS(e,t,n){e.issues.length&&t.issues.push(...zy(n,e.issues)),t.value[n]=e.value}var bS=Q(`$ZodArray`,(e,t)=>{Mx.init(e,t);let n=fb.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[];for(let e=0;e<a.length;e++){let n=a[e],s=t.element._zod.run({value:n,issues:[]},i);s instanceof Promise?o.push(s.then(t=>yS(t,r,e))):yS(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function xS(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...zy(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}}var SS=[];function CS(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:SS,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ky(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function wS(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>xS(e,n,i,t,u,d))):xS(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var TS=new WeakMap,ES=Q(`$ZodObject`,(e,t)=>{if(Mx.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;TS.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),TS.set(t,n),n}})}let n=py(()=>CS(t));nb(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||gy(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let r=xy,i=t.catchall,a,o=fb.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>xS(n,t,e,c,r,i))):xS(a,t,e,c,r,i)}return i?wS(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),DS=Q(`$ZodObjectJIT`,(e,t)=>{ES.init(e,t);let n=e._zod.parse,r=py(()=>CS(t)),i=fb.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Ax([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
61
61
|
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
@@ -104,5 +104,5 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
104
104
|
|
|
105
105
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=xy,c=!fb.jitless,l=c&&Sy.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?wS([],p,i,f,d,e):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function OS(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Ly(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Hy(e,r,pb())))}),t)}var kS=Q(`$ZodUnion`,(e,t)=>{Mx.init(e,t),nb(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),nb(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),nb(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),nb(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>hy(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>OS(t,r,e,i)):OS(o,r,e,i)}}),AS=Q(`$ZodIntersection`,(e,t)=>{Mx.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>MS(e,t,n)):MS(e,i,a)}});function jS(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Cy(e)&&Cy(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=jS(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=jS(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function MS(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=jS(t.value,n.value);if(!c.valid){if(Ly(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var NS=Q(`$ZodEnum`,(e,t)=>{Mx.init(e,t);let n=uy(t.entries),r=new Set(n);e._zod.values=r;let i=n.filter(e=>Ty.has(typeof e));e._zod.pattern=RegExp(i.length?`^(${i.map(e=>Ey(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),PS=Q(`$ZodTransform`,(e,t)=>{Mx.init(e,t),e._zod.optin=`optional`,fb.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new db(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new ub;return n.value=i,n}});function FS(e,t){return e.value=t.issues.length?void 0:t.value,e}var IS=Q(`$ZodOptional`,(e,t)=>{Mx.init(e,t),nb(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,nb(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),nb(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${hy(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>FS(e,t)):FS(e,r)}return t.innerType._zod.run(e,n)}}),LS=Q(`$ZodExactOptional`,(e,t)=>{IS.init(e,t),nb(e,`values`,e=>e.def.innerType._zod.values),nb(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),RS=Q(`$ZodNullable`,(e,t)=>{Mx.init(e,t),nb(e,`optin`,e=>e.def.innerType._zod.optin),nb(e,`optout`,e=>e.def.innerType._zod.optout),nb(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${hy(t.source)}|null)$`):void 0}),nb(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),zS=Q(`$ZodDefault`,(e,t)=>{Mx.init(e,t),e._zod.optin=`defaulted`,nb(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>BS(e,t)):BS(r,t)}});function BS(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var VS=Q(`$ZodPrefault`,(e,t)=>{Mx.init(e,t),e._zod.optin=`defaulted`,nb(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),HS=Q(`$ZodNonOptional`,(e,t)=>{Mx.init(e,t),nb(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>US(t,e)):US(i,e)}});function US(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function WS(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>Hy(e,r,pb()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var GS=Q(`$ZodCatch`,(e,t)=>{Mx.init(e,t),nb(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),nb(e,`optout`,e=>e.def.innerType._zod.optout),nb(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>WS(e,r,t,n)):WS(e,r,t,n)}}),KS=Q(`$ZodPipe`,(e,t)=>{Mx.init(e,t),nb(e,`values`,e=>e.def.in._zod.values),nb(e,`optin`,e=>e.def.in._zod.optin),nb(e,`optout`,e=>e.def.out._zod.optout),nb(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>qS(e,t.in,n)):qS(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>qS(e,t.out,n)):qS(r,t.out,n)}});function qS(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var JS=Q(`$ZodReadonly`,(e,t)=>{Mx.init(e,t),nb(e,`propValues`,e=>e.def.innerType._zod.propValues),nb(e,`values`,e=>e.def.innerType._zod.values),nb(e,`optin`,e=>e.def.innerType?._zod?.optin),nb(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(YS):YS(r)}});function YS(e){return e.memo||(e.value=Object.freeze(e.value)),e}var XS=Q(`$ZodCustom`,(e,t)=>{_x.init(e,t),Mx.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ZS(t,n,r,e));ZS(i,n,r,e)}});function ZS(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(qy(e))}}var QS=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},$S=`~memo`,eC=[];function tC(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var nC=new WeakMap;function rC(e,t){let n=nC.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let r=!1,i=e=>{!r&&e?._zod&&rC(e,t)&&(r=!0)},a=e._zod.def;switch(a.type){case`object`:for(let e of Reflect.ownKeys(a.shape))i(a.shape[e]);i(a.catchall);break;case`array`:i(a.element);break;case`tuple`:for(let e of a.items)i(e);i(a.rest);break;case`record`:case`map`:i(a.keyType),i(a.valueType);break;case`set`:i(a.valueType);break;case`union`:for(let e of a.options)i(e);break;case`intersection`:i(a.left),i(a.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:i(a.innerType);break;case`pipe`:i(a.in),i(a.out);break;case`function`:i(a.input),i(a.output);break;case`lazy`:i(e._zod.innerType);break;case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}}return t.delete(e),nC.set(e,r),r}function iC(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}var aC,oC=[],sC={alloc(e,t,n){let r=aC;if(!r)return n;aC=void 0;let i={value:n,issues:null};return r.set(t.value,i),oC.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&lC(n,e.value))throw new QS;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(o,s)=>{if(n===void 0&&(n=rC(e,new Set),!n))return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(o,s);let c=o.value;if(typeof c!=`object`||!c)return t(o,s);let l=s[$S];l||(l={buckets:new Map,backEdges:void 0},s[$S]=l);let u;r===s?u=i:(u=iC(l,e),r=s,i=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...tC(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(d.value)),o;aC=u;let f=oC.length,p=t(o,s);aC=void 0;let m=oC.length>f?oC.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?tC(e.issues):eC),e)):(m&&(m.issues=p.issues.length?tC(p.issues):eC),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function cC(){return sC}function lC(e,t){let n=e[$S]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}var uC=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,credit_card:`credit card number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Ky(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Oy(e.values[0])}`:`Invalid option: expected one of ${dy(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${dy(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function dC(){return{localeError:uC()}}var fC,pC=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function mC(){return new pC}(fC=globalThis).__zod_globalRegistry??(fC.__zod_globalRegistry=mC());var hC=globalThis.__zod_globalRegistry;function gC(e,t){return new e({type:`string`,...Z(t)})}function _C(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Z(t)})}function vC(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Z(t)})}function yC(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Z(t)})}function bC(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Z(t)})}function xC(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Z(t)})}function SC(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Z(t)})}function CC(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Z(t)})}function wC(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Z(t)})}function TC(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Z(t)})}function EC(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Z(t)})}function DC(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Z(t)})}function OC(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Z(t)})}function kC(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Z(t)})}function AC(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Z(t)})}function jC(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Z(t)})}function MC(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Z(t)})}function NC(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Z(t)})}function PC(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Z(t)})}function FC(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Z(t)})}function IC(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Z(t)})}function LC(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Z(t)})}function RC(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Z(t)})}function zC(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Z(t)})}function BC(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Z(t)})}function VC(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Z(t)})}function HC(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Z(t)})}function UC(e){return new e({type:`unknown`})}function WC(e,t){return new e({type:`never`,...Z(t)})}function GC(e,t){return new yx({check:`max_length`,...Z(t),maximum:e})}function KC(e,t){return new bx({check:`min_length`,...Z(t),minimum:e})}function qC(e,t){return new xx({check:`length_equals`,...Z(t),length:e})}function JC(e,t){return new Cx({check:`string_format`,format:`regex`,...Z(t),pattern:e})}function YC(e){return new wx({check:`string_format`,format:`lowercase`,...Z(e)})}function XC(e){return new Tx({check:`string_format`,format:`uppercase`,...Z(e)})}function ZC(e,t){return new Ex({check:`string_format`,format:`includes`,...Z(t),includes:e})}function QC(e,t){return new Dx({check:`string_format`,format:`starts_with`,...Z(t),prefix:e})}function $C(e,t){return new Ox({check:`string_format`,format:`ends_with`,...Z(t),suffix:e})}function ew(e){return new kx({check:`overwrite`,tx:e})}function tw(e){return ew(t=>t.normalize(e))}function nw(){return ew(e=>e.trim())}function rw(){return ew(e=>e.toLowerCase())}function iw(){return ew(e=>e.toUpperCase())}function aw(){return ew(e=>yy(e))}function ow(e,t,n){return new e({type:`array`,element:t,...Z(n)})}function sw(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Z(n)})}function cw(e,t){let n=lw(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(qy(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(qy(r))}},e(t.value,t)),t);return n}function lw(e,t){let n=new _x({check:`custom`,...Z(t)});return n._zod.check=e,n}function uw(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&gy(e,t,n[t]);return e}function dw(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??hC,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function fw(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function pw(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,pw(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&uw(o.schema,c),t.io===`input`&&Cw(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function mw(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function hw(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${mw(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+mw(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
106
106
|
|
|
107
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function gw(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;gw(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var _w=new Set([`type`,`properties`,`required`,`additionalProperties`]),vw=[`oneOf`,`anyOf`];function yw(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function bw(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!_w.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??yw(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}gy(n,r,e.length===1?e[0]:bw(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=yw(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function xw(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of _w)if(t in e)return;let n=t.filter(e=>vw.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=bw(t);else{let e=n[0],i=vw.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>bw([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,uw(e,r))}function Sw(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):uw(i,s),uw(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())gw(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])xw(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}uw(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,gy(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Tw(t,`input`,e.processors),output:Tw(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Cw(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Cw(r.element,n);if(r.type===`set`)return Cw(r.valueType,n);if(r.type===`lazy`)return Cw(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Cw(r.innerType,n);if(r.type===`intersection`)return Cw(r.left,n)||Cw(r.right,n);if(r.type===`record`||r.type===`map`)return Cw(r.keyType,n)||Cw(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Cw(r.in,n)||Cw(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Cw(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Cw(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Cw(e,n))return!0;return!!(r.rest&&Cw(r.rest,n))}return!1}var ww=(e,t={})=>n=>{let r=dw({...n,processors:t});return pw(e,r),hw(r,e),Sw(r,e)},Tw=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=dw({...i??{},target:a,io:t,processors:n});return pw(e,o),hw(o,e),Sw(o,e)},Ew={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Dw=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ew[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ow=(e,t,n,r)=>{n.not={}},kw=(e,t,n,r)=>{let i=e._zod.def,a=uy(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Aw=(e,t,n,r)=>{fw(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},jw=(e,t,n,r)=>{fw(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Mw=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=pw(a.element,t,{...r,path:[...r.path,`items`]})};function Nw(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Nw(t.out):t.type===`catch`?Nw(t.innerType):e._zod.optin}var Pw=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&fw(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)gy(i.properties,e,pw(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?Nw(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=pw(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Fw=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>pw(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Iw=(e,t,n,r)=>{let i=e._zod.def,a=pw(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=pw(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Lw=(e,t,n,r)=>{let i=e._zod.def,a=pw(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Rw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},zw=Symbol();function Bw(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(fw(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),zw):JSON.parse(o)}var Vw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Bw(i.defaultValue,e,t,n,r);o!==zw&&(n.default=o)},Hw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Bw(i.defaultValue,e,t,n,r);o!==zw&&(n._prefault=o)},Uw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{fw(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ww=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;pw(o,t,r);let s=t.seen.get(e);s.ref=o},Gw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Kw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},qw=new WeakSet([Object.prototype,Error.prototype]);function Jw(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Yw=Q(`ZodError`,(e,t)=>{xb.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);qw.has(n)||(qw.add(n),Jw(n,`format`,e=>t=>Tb(e,t)),Jw(n,`flatten`,e=>t=>wb(e,t)),Jw(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,fy,2)}),Jw(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,fy,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Xw=Db(Yw),Zw=Ob(Yw),Qw=kb(Yw),$w=jb(Yw),eT=Nb(Yw),tT=Pb(Yw),nT=Fb(Yw),rT=Ib(Yw),iT=Lb(Yw),aT=Rb(Yw),oT=zb(Yw),sT=Bb(Yw);function cT(){fb.localeError||pb(dC())}function lT(){fb.memoizer||pb({memoizer:cC()})}var uT=Q(`ZodType`,(e,t)=>(cT(),Mx.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(_y(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Dy(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(yE(e,t))},superRefine(e,t){return this.check(bE(e,t))},overwrite(e){return this.check(ew(e))},optional(){return tE(this)},exactOptional(){return rE(this)},nullable(){return aE(this)},nullish(){return tE(aE(this))},nonoptional(e){return dE(this,e)},array(){return UT(this)},or(e){return qT([this,e])},and(e){return YT(this,e)},transform(e){return hE(this,$T(e))},default(e){return sE(this,e)},prefault(e){return lE(this,e)},catch(e){return pE(this,e)},pipe(e){return hE(this,e)},readonly(){return _E(this)},describe(e){let t=this.clone();return hC.add(t,{description:e}),t},meta(...e){if(e.length===0)return hC.get(this);let t=this.clone();return hC.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Xy(this,`~standard`,{...Px(this),jsonSchema:{input:Tw(this,`input`),output:Tw(this,`output`)}})},set"~standard"(e){Yy(this,`~standard`,e)},parse:function e(t,n){return Xw(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Zw(this,t,n,{callee:e})},safeParse(e,t){return Qw(this,e,t)},async safeParseAsync(e,t){return $w(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Yy(this,`spa`,e)},encode:function e(t,n){return eT(this,t,n,{callee:e})},decode:function e(t,n){return tT(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await nT(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await rT(this,t,n,{callee:e})},safeEncode(e,t){return iT(this,e,t)},safeDecode(e,t){return aT(this,e,t)},async safeEncodeAsync(e,t){return oT(this,e,t)},async safeDecodeAsync(e,t){return sT(this,e,t)},toJSONSchema(e){return ww(this,{})(e)},get description(){return hC.get(this)?.description},get _def(){return this._zod.def}}),dT=Q(`_ZodString`,(e,t)=>{Fx.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dw(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(JC(...e))},includes(...e){return this.check(ZC(...e))},startsWith(...e){return this.check(QC(...e))},endsWith(...e){return this.check($C(...e))},min(...e){return this.check(KC(...e))},max(...e){return this.check(GC(...e))},length(...e){return this.check(qC(...e))},nonempty(...e){return this.check(KC(1,...e))},lowercase(e){return this.check(YC(e))},uppercase(e){return this.check(XC(e))},trim(){return this.check(nw())},normalize(...e){return this.check(tw(...e))},toLowerCase(){return this.check(rw())},toUpperCase(){return this.check(iw())},slugify(){return this.check(aw())}}),fT=Q(`ZodString`,(e,t)=>{Fx.init(e,t),dT.init(e,t)},{email(e){return this.check(_C(yT,e))},url(e){return this.check(CC(ST,e))},jwt(e){return this.check(RC(LT,e))},emoji(e){return this.check(wC(CT,e))},guid(e){return this.check(vC(bT,e))},uuid(e){return this.check(yC(xT,e))},uuidv4(e){return this.check(bC(xT,e))},uuidv6(e){return this.check(xC(xT,e))},uuidv7(e){return this.check(SC(xT,e))},nanoid(e){return this.check(TC(wT,e))},cuid(e){return this.check(EC(TT,e))},cuid2(e){return this.check(DC(ET,e))},ulid(e){return this.check(OC(DT,e))},base64(e){return this.check(FC(PT,e))},base64url(e){return this.check(IC(FT,e))},xid(e){return this.check(kC(OT,e))},ksuid(e){return this.check(AC(kT,e))},ipv4(e){return this.check(jC(AT,e))},ipv6(e){return this.check(MC(jT,e))},cidrv4(e){return this.check(NC(MT,e))},cidrv6(e){return this.check(PC(NT,e))},e164(e){return this.check(LC(IT,e))},datetime(e){return this.check(zC(hT,e))},date(e){return this.check(BC(gT,e))},time(e){return this.check(VC(_T,e))},duration(e){return this.check(HC(vT,e))}});function pT(e){return gC(fT,e)}var mT=Q(`ZodStringFormat`,(e,t)=>{Ix.init(e,t),dT.init(e,t)}),hT=Q(`ZodISODateTime`,(e,t)=>{$x.init(e,t),mT.init(e,t)}),gT=Q(`ZodISODate`,(e,t)=>{eS.init(e,t),mT.init(e,t)}),_T=Q(`ZodISOTime`,(e,t)=>{tS.init(e,t),mT.init(e,t)}),vT=Q(`ZodISODuration`,(e,t)=>{nS.init(e,t),mT.init(e,t)}),yT=Q(`ZodEmail`,(e,t)=>{zx.init(e,t),mT.init(e,t)}),bT=Q(`ZodGUID`,(e,t)=>{Lx.init(e,t),mT.init(e,t)}),xT=Q(`ZodUUID`,(e,t)=>{Rx.init(e,t),mT.init(e,t)}),ST=Q(`ZodURL`,(e,t)=>{Gx.init(e,t),mT.init(e,t)}),CT=Q(`ZodEmoji`,(e,t)=>{Kx.init(e,t),mT.init(e,t)}),wT=Q(`ZodNanoID`,(e,t)=>{qx.init(e,t),mT.init(e,t)}),TT=Q(`ZodCUID`,(e,t)=>{Jx.init(e,t),mT.init(e,t)}),ET=Q(`ZodCUID2`,(e,t)=>{Yx.init(e,t),mT.init(e,t)}),DT=Q(`ZodULID`,(e,t)=>{Xx.init(e,t),mT.init(e,t)}),OT=Q(`ZodXID`,(e,t)=>{Zx.init(e,t),mT.init(e,t)}),kT=Q(`ZodKSUID`,(e,t)=>{Qx.init(e,t),mT.init(e,t)}),AT=Q(`ZodIPv4`,(e,t)=>{rS.init(e,t),mT.init(e,t)}),jT=Q(`ZodIPv6`,(e,t)=>{oS.init(e,t),mT.init(e,t)}),MT=Q(`ZodCIDRv4`,(e,t)=>{sS.init(e,t),mT.init(e,t)}),NT=Q(`ZodCIDRv6`,(e,t)=>{lS.init(e,t),mT.init(e,t)}),PT=Q(`ZodBase64`,(e,t)=>{dS.init(e,t),mT.init(e,t)}),FT=Q(`ZodBase64URL`,(e,t)=>{pS.init(e,t),mT.init(e,t)}),IT=Q(`ZodE164`,(e,t)=>{mS.init(e,t),mT.init(e,t)}),LT=Q(`ZodJWT`,(e,t)=>{gS.init(e,t),mT.init(e,t)}),RT=Q(`ZodUnknown`,(e,t)=>{_S.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function zT(){return UC(RT)}var BT=Q(`ZodNever`,(e,t)=>{vS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ow(e,t,n,r)});function VT(e){return WC(BT,e)}var HT=Q(`ZodArray`,(e,t)=>{lT(),bS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mw(e,t,n,r),e.element=t.element},{min(e,t){return this.check(KC(e,t))},nonempty(e){return this.check(KC(1,e))},max(e,t){return this.check(GC(e,t))},length(e,t){return this.check(qC(e,t))},unwrap(){return this.element}});function UT(e,t){return ow(HT,e,t)}var WT=Q(`ZodObject`,(e,t)=>{lT(),DS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pw(e,t,n,r),rb(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return ZT(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:zT()})},loose(){return this.clone({...this._zod.def,catchall:zT()})},strict(){return this.clone({...this._zod.def,catchall:VT()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return My(this,e)},safeExtend(e){return Ny(this,e)},merge(e){return Py(this,e)},pick(e){return Ay(this,e)},omit(e){return jy(this,e)},partial(...e){return Fy(eE,this,e[0])},exactPartial(...e){return Fy(nE,this,e[0],`exactPartial`)},required(...e){return Iy(uE,this,e[0])}});function GT(e,t){return new WT({type:`object`,shape:e??{},...Z(t)})}var KT=Q(`ZodUnion`,(e,t)=>{kS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fw(e,t,n,r),e.options=t.options});function qT(e,t){return new KT({type:`union`,options:e,...Z(t)})}var JT=Q(`ZodIntersection`,(e,t)=>{AS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iw(e,t,n,r)});function YT(e,t){return new JT({type:`intersection`,left:e,right:t})}var XT=Q(`ZodEnum`,(e,t)=>{NS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kw(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new XT({...t,checks:[],...Z(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new XT({...t,checks:[],...Z(r),entries:i})}});function ZT(e,t){return new XT({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Z(t)})}var QT=Q(`ZodTransform`,(e,t)=>{lT(),PS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jw(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new db(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(qy(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(qy(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function $T(e){return new QT({type:`transform`,transform:e})}var eE=Q(`ZodOptional`,(e,t)=>{IS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tE(e){return new eE({type:`optional`,innerType:e})}var nE=Q(`ZodExactOptional`,(e,t)=>{LS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rE(e){return new nE({type:`optional`,innerType:e})}var iE=Q(`ZodNullable`,(e,t)=>{RS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function aE(e){return new iE({type:`nullable`,innerType:e})}var oE=Q(`ZodDefault`,(e,t)=>{zS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function sE(e,t){return new oE({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():wy(t)}})}var cE=Q(`ZodPrefault`,(e,t)=>{VS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lE(e,t){return new cE({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():wy(t)}})}var uE=Q(`ZodNonOptional`,(e,t)=>{HS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dE(e,t){return new uE({type:`nonoptional`,innerType:e,...Z(t)})}var fE=Q(`ZodCatch`,(e,t)=>{GS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pE(e,t){return new fE({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ab(t)})}var mE=Q(`ZodPipe`,(e,t)=>{KS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ww(e,t,n,r),e.in=t.in,e.out=t.out});function hE(e,t){return new mE({type:`pipe`,in:e,out:t})}var gE=Q(`ZodReadonly`,(e,t)=>{JS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _E(e){return new gE({type:`readonly`,innerType:e})}var vE=Q(`ZodCustom`,(e,t)=>{XS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aw(e,t,n,r)});function yE(e,t={}){return sw(vE,e,t)}function bE(e,t){return cw(e,t)}var xE=e=>e&&{primary:`text-primary`,secondary:`text-secondary`,neutral:`text-neutral`,light:`text-white`,dark:`text-neutral-800`,text:`text-muted-foreground`,"text-inverse":`text-foreground-opposite`,error:`text-error`,success:`text-success`,custom:``}[e]||``,SE=Ze(`flex flex-row flex-wrap items-center`,{variants:{size:{xs:`gap-1 text-xs`,sm:`gap-1.5 text-sm`,md:`gap-2 text-base`,lg:`gap-3 text-lg`,xl:`gap-4 text-xl`},spacing:{compact:`gap-1`,normal:`gap-2`,loose:`gap-4`}},defaultVariants:{size:`md`,spacing:`normal`}}),CE=({href:e,lang:t,children:n,onClick:r,color:i,position:a,locale:o,className:c,...l})=>{let u=s(`breadcrumb`).linkLabel;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ve,{href:e,locale:o,color:i,onClick:r,itemProp:`item`,isExternalLink:!1,itemScope:!0,itemType:`https://schema.org/WebPage`,...l,label:`${u} ${n}`,itemID:e,size:`custom`,children:(0,H.jsx)(`span`,{itemProp:`name`,children:n})}),(0,H.jsx)(`meta`,{itemProp:`position`,content:a.toString()})]})},wE=e=>{let{children:t,onClick:n,color:r,position:i,className:a,...o}=e,{linkLabel:s}=F(`breadcrumb`);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M,{onClick:n,variant:`link`,label:`${s} ${t}`,color:r,itemProp:`item`,size:`custom`,...o,children:(0,H.jsx)(`span`,{itemProp:`name`,children:t})}),(0,H.jsx)(`meta`,{itemProp:`position`,content:i.toString()})]})},TE=({children:e,position:t,className:n,...r})=>(0,H.jsxs)(`span`,{itemProp:`item`,className:R(`inline-flex items-center`,`font-medium text-muted-foreground`,`transition-colors duration-200`,n),children:[(0,H.jsx)(`span`,{itemProp:`name`,...r,children:e}),(0,H.jsx)(`meta`,{itemProp:`position`,content:t.toString()})]}),EE=({links:e,className:t,color:n=`text`,locale:r,elementType:i=`page`,separator:a=(0,H.jsx)(Ys,{size:10}),ariaLabel:o=`breadcrumb`,includeStructuredData:s=!0,maxItems:c,size:l,spacing:u,...d})=>{let f=c&&e.length>c?[...e.slice(0,1),`...`,...e.slice(-(c-2))]:e;return(0,H.jsx)(`nav`,{"aria-label":o,children:(0,H.jsx)(`ol`,{className:R(SE({size:l,spacing:u}),t),...s&&{itemScope:!0,itemType:`http://schema.org/BreadcrumbList`},...d,children:f.map((e,t)=>{let o=t===f.length-1,c=typeof e==`object`&&typeof e.href==`string`,l=typeof e==`object`&&typeof e.onClick==`function`,u=t===f.length-1,d=u?i:void 0,p=e===`...`,m=e.text??e,h=xE(n);if(p)return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`li`,{className:`flex items-center`,"aria-hidden":`true`,children:(0,H.jsx)(`span`,{className:`text-neutral-500`,children:`…`})}),!o&&(0,H.jsx)(`li`,{"aria-hidden":`true`,className:`flex items-center`,children:(0,H.jsx)(`span`,{className:R(h),children:a})})]},`truncated-${m}`);let g=(0,H.jsx)(TE,{position:t+1,"aria-current":d,className:R(`transition-colors duration-200`,u&&`text-foreground`),children:m},m);c?g=(0,H.jsx)(CE,{href:e.href,color:n,position:t+1,locale:r,"aria-current":d,className:R(u&&`cursor-default text-foreground`),children:m},m):l&&(g=(0,H.jsx)(wE,{onClick:e.onClick,color:n,position:t+1,"aria-current":d,className:R(u&&`cursor-default text-neutral-900`),children:m},m));let _=(0,z.createElement)(`li`,{...s&&{itemProp:`itemListElement`,itemScope:!0,itemType:`https://schema.org/ListItem`},key:m,className:`flex items-center`},g);return o?_:(0,H.jsxs)(z.Fragment,{children:[_,(0,H.jsx)(`li`,{"aria-hidden":`true`,className:`flex items-center`,children:(0,H.jsx)(`span`,{className:R(h),children:a})})]},m)})})})},DE=({keyPath:e,dictionaryKey:t,onClickKeyPath:n,locale:r,color:i,showDictionaryKey:a=!0})=>{let o=[...a?[{text:Dt(t),onClick:n?()=>n([]):void 0}]:[],...e.map((t,r)=>({onClick:n?()=>n?.(e.slice(0,r+1)):void 0,text:Dt(t.key?.toString()??``)}))];return(0,H.jsx)(EE,{links:o,locale:r,elementType:`location`,color:i})},OE=({children:e,className:t,identifier:n,...r})=>(0,H.jsx)(`div`,{className:R(`group/dropdown relative flex`,t),"aria-label":`DropDown ${n}`,id:`dropdown-container-${n}`,...r,children:e});OE.Trigger=({children:e,identifier:t,className:n,label:r,...i})=>(0,H.jsx)(M,{className:R([`w-full cursor-pointer`,`group-focus-within/dropdown:bg-current/20 group-focus-within/dropdown:ring-4`,n]),label:r??`Open panel ${t}`,"aria-haspopup":`true`,"aria-controls":`dropdown-panel-${t}`,id:`dropdown-trigger-${t}`,onClick:e=>{e.currentTarget.focus()},variant:`none`,...i,children:e}),OE.Panel=({children:e,isHidden:t=void 0,isOverable:n=!1,isFocusable:r=!1,align:i=`start`,yAlign:a=`below`,identifier:o,className:s,smootherClassName:c,...l})=>(0,H.jsx)(`div`,{className:R(`absolute z-100 min-w-full`,i===`start`&&`left-0`,i===`end`&&`right-0`,a===`below`&&`top-[calc(100%+0.5rem)]`,a===`above`&&`bottom-[calc(100%+0.5rem)]`,s),"aria-hidden":t,role:`region`,"aria-labelledby":`dropdown-trigger-${o}`,id:`dropdown-panel-${o}`,children:(0,H.jsx)(ee,{isHidden:t,className:R(`overflow-x-visible`,t===!1&&`invisible`,t===!0&&`visible`,n&&`group-hover/dropdown:visible group-hover/dropdown:grid-rows-[1fr]`,r&&`group-focus-within/dropdown:visible group-focus-within/dropdown:grid-rows-[1fr]`,c),...l,children:e})});function kE(e){return Array.isArray?Array.isArray(e):zE(e)===`[object Array]`}function AE(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function jE(e){return e==null?``:AE(e)}function ME(e){return typeof e==`string`}function NE(e){return typeof e==`number`}function PE(e){return e===!0||e===!1||IE(e)&&zE(e)==`[object Boolean]`}function FE(e){return typeof e==`object`}function IE(e){return FE(e)&&e!==null}function LE(e){return e!=null}function RE(e){return!e.trim().length}function zE(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var BE=`Incorrect 'index' type`,VE=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,HE=e=>`Invalid value for key ${e}`,UE=e=>`Pattern length exceeds max of ${e}.`,WE=e=>`Missing ${e} property in key`,GE=e=>`Property 'weight' in key '${e}' must be a positive integer`,KE=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,qE=Object.prototype.hasOwnProperty,JE=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=YE(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function YE(e){let t=null,n=null,r=null,i=1,a=null;if(ME(e)||kE(e))r=e,t=XE(e),n=ZE(e);else{if(!qE.call(e,`name`))throw Error(WE(`name`));let o=e.name;if(r=o,qE.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(GE(ZE(o)));t=XE(o),n=ZE(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function XE(e){return kE(e)?e:e.split(`.`)}function ZE(e){return kE(e)?e.join(`.`):e}function QE(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(LE(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!LE(s))return;if(a===t.length-1&&(ME(s)||NE(s)||PE(s)||typeof s==`bigint`))n.push(o===void 0?jE(s):{v:jE(s),i:o});else if(kE(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}}};return i(e,ME(t)?t.split(`.`):t,0),r?n:n[0]}var $E={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},eD={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},tD={location:0,threshold:.6,distance:100},nD={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:QE,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},$=Object.freeze({...eD,...$E,...tD,...nD});function rD(e){return e>=9&&e<=13||e===32||e===160}function iD(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=0,a=!1;for(let e=0;e<t.length;e++)rD(t.charCodeAt(e))?a=!1:a||=(i++,!0);if(i===0&&(i=1),n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var aD=class{constructor({getFn:e=$.getFn,fieldNormWeight:t=$.fieldNormWeight}={}){this.norm=iD(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(ME(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(VE);if(ME(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(VE);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!LE(e)||RE(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(LE(i)){if(kE(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(LE(n)){if(ME(n)){if(!RE(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(LE(n.v)){let t=ME(n.v)?n.v:jE(n.v);if(!RE(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(ME(i)&&!RE(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function oD(e,t,{getFn:n=$.getFn,fieldNormWeight:r=$.fieldNormWeight}={}){let i=new aD({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(YE)),i.setSources(t),i.create(),i}function sD(e,{getFn:t=$.getFn,fieldNormWeight:n=$.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new aD({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function cD(e=[],t=$.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function lD(e,t,n,{location:r=$.location,distance:i=$.distance,threshold:a=$.threshold,findAllMatches:o=$.findAllMatches,minMatchCharLength:s=$.minMatchCharLength,includeMatches:c=$.includeMatches,ignoreLocation:l=$.ignoreLocation}={}){if(t.length>32)throw Error(UE(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=cD(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function uD(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function dD(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var fD={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},pD=RegExp(`[`+Object.keys(fD).join(``)+`]`,`g`),mD=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(pD,e=>fD[e]):e=>e,hD=class{constructor(e,{location:t=$.location,threshold:n=$.threshold,distance:r=$.distance,includeMatches:i=$.includeMatches,findAllMatches:a=$.findAllMatches,minMatchCharLength:o=$.minMatchCharLength,isCaseSensitive:s=$.isCaseSensitive,ignoreDiacritics:c=$.ignoreDiacritics,ignoreLocation:l=$.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?mD(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:uD(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?mD(e):e,this.pattern===e){if(e.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=lD(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=dD(u)),p}},gD=new Set([`fuzzy`,`include`]);function _D(e){return e.startsWith(`inverse`)}var vD=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new hD(e,{location:t.location??$.location,threshold:t.threshold??$.threshold,distance:t.distance??$.distance,includeMatches:t.includeMatches??$.includeMatches,findAllMatches:t.findAllMatches??$.findAllMatches,minMatchCharLength:t.minMatchCharLength??$.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??$.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??$.ignoreDiacritics,ignoreLocation:t.ignoreLocation??$.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],yD=vD.length,bD=`\0`,xD=`|`;function SD(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function CD(e,t){let n=e.match(t);return n?n[1]:null}function wD(e,t={}){return e.replace(/\\\|/g,bD).split(xD).map(e=>{let n=SD(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<yD;){let e=vD[o],n=CD(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<yD;){let e=vD[o],n=CD(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var TD=class{constructor(e,{isCaseSensitive:t=$.isCaseSensitive,ignoreDiacritics:n=$.ignoreDiacritics,includeMatches:r=$.includeMatches,minMatchCharLength:i=$.minMatchCharLength,ignoreLocation:a=$.ignoreLocation,findAllMatches:o=$.findAllMatches,location:s=$.location,threshold:c=$.threshold,distance:l=$.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?mD(e):e,this.pattern=e,this.query=wD(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?mD(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,_D(r.type)&&(c=!0),n&&(gD.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=dD(o)),e}}return{isMatch:!1,score:1}}},ED=[];function DD(...e){ED.push(...e)}function OD(e,t){for(let n=0,r=ED.length;n<r;n+=1){let r=ED[n];if(r.condition(e,t))return new r(e,t)}return new hD(e,t)}var kD={AND:`$and`,OR:`$or`},AD={PATH:`$path`,PATTERN:`$val`},jD=e=>!!(e[kD.AND]||e[kD.OR]),MD=e=>!!e[AD.PATH],ND=e=>!kE(e)&&FE(e)&&!jD(e),PD=e=>({[kD.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function FD(e,t,{auto:n=!0}={}){let r=e=>{if(ME(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=OD(e,t)),r}let i=Object.keys(e),a=MD(e);if(!a&&i.length>1&&!jD(e))return r(PD(e));if(ND(e)){let r=a?e[AD.PATH]:i[0],o=a?e[AD.PATTERN]:e[r];if(!ME(o))throw Error(HE(r));let s={keyId:ZE(r),pattern:o};return n&&(s.searcher=OD(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];kE(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return jD(e)||(e=PD(e)),r(e)}function ID(e,{ignoreFieldNorm:t=$.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function LD(e,{ignoreFieldNorm:t=$.ignoreFieldNorm}){e.forEach(e=>{e.score=ID(e.matches,{ignoreFieldNorm:t})})}var RD=class{constructor(e,t){this.limit=e,this.heap=[],this.comparator=t}get size(){return this.heap.length}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):this.comparator(e,this.heap[0])<0&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(this.comparator(t[e],t[n])<=0)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&this.comparator(t[i],t[r])>0&&(r=i),a<n&&this.comparator(t[a],t[r])>0&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function zD(e){let t=[];return e.matches.forEach(e=>{if(!LE(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function BD(e,t,{includeMatches:n=$.includeMatches,includeScore:r=$.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=zD(e)),r&&(a.score=e.score),a})}var VD=/[\p{L}\p{M}\p{N}_]+/gu,HD=new WeakSet;function UD(e){HD.has(e)||(HD.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function WD(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||UD(e),t=>t.match(e)||[]):e=>e.match(VD)||[]}function GD({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=WD(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=mD(n)),r(n)}}}var KD=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=GD({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new hD(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=dD(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function qD(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function JD(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0){qD(e,a,i,r);return}if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)qD(e,t.v,i,r);else qD(e,n.v,i,r)}}}function YD(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)JD(r,i,t,n);return r}function XD(e,t,n,r){JD(e,t,n,r)}function ZD(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function QD(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)ZD(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var $D=class{constructor(e,t,n){this.options={...$,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new JE(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=OD(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof aD))throw Error(BE);if(this._myIndex=t||oD(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=GD({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=YD(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!LE(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=GD({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});XD(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&QD(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(VE);this._invertedIndex&&QD(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(e=>this._keyStore.get(e.id)||e)}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(ME(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return NE(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&NE(n)&&n>0&&ME(e),l=o,u=(e,t)=>l(e,t)||e.idx-t.idx,d;if(c){let t=new RD(n,u);ME(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),d=t.extractSorted()}else d=ME(e)?ME(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),LD(d,{ignoreFieldNorm:s}),a&&d.sort(ME(e)?u:l),NE(n)&&n>-1&&(d=d.slice(0,n));return BD(d,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!LE(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=ID(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=FD(e,this.options),n=this._normalizedKeys(),r=(e,t,i)=>{if(!(`children`in e)){let{keyId:r,searcher:a}=e,o;return r===null?(o=[],n.forEach((e,n)=>{o.push(...this._findMatches({key:e,value:t[n],searcher:a}))})):o=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:a}),o&&o.length?[{idx:i,item:t,matches:o}]:[]}let{children:a,operator:o}=e,s=[];for(let e=0,n=a.length;e<n;e+=1){let n=a[e],c=r(n,t,i);if(c.length)s.push(...c);else if(o===kD.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if(LE(e)){let i=r(t,e,n);i.length&&(a.has(n)||(a.set(n,{idx:n,item:e,matches:[]}),o.push(a.get(n))),i.forEach(({matches:e})=>{a.get(n).matches.push(...e)}))}}),o}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=this._normalizedKeys(),s=t?null:[];return a.forEach(({$:e,i:a})=>{if(!LE(e))return;let c=[],l=!1,u=!1;if(o.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:a,item:e,matches:c};t?(r.score=ID(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!LE(t))return[];let r=[];if(kE(t))t.forEach(({v:t,i,n:a})=>{if(!LE(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};$D.version=`7.5.0`,$D.createIndex=oD,$D.parseIndex=sD,$D.config=$,$D.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(KE);return OD(e,{...$,...n}).searchIn(t)},$D.parseQuery=FD,DD(TD),DD(KD),$D.use=function(...e){e.forEach(e=>DD(e))};var eO=$D,tO=`locale-switcher-content`,nO=({panelProps:e,isMultilingual:t=!0})=>{let{switchTo:n,searchInput:r,localeSwitcherLabel:a,languageListLabel:s,seeAllLocalesSwitch:c}=F(`locale-switcher-content`),l=(0,z.useRef)(null),{locale:u}=Ht(),{availableLocales:d,selectedLocales:f,setSelectedLocales:p}=wm(),m=(0,z.useMemo)(()=>d.map(e=>({locale:e,englishName:At(e,`en`),currentLocaleName:At(e,u),ownLocaleName:At(e)})),[d,u]),[h,g]=(0,z.useState)(``),[_,v]=o(`locale-content-selector-see-all-locales`,!1),y=(0,z.useMemo)(()=>new eO(m,{keys:[{name:`ownLocaleName`,weight:.4},{name:`englishName`,weight:.2},{name:`currentLocaleName`,weight:.2},{name:`locale`,weight:.2}],threshold:.02}),[m]),b=(0,z.useMemo)(()=>h?y.search(h).map(e=>e.item):m,[h,m,y]),x=e=>{t?f.includes(e)?f.length>1&&p(t=>t.filter(t=>t!==e)):p(t=>[...t,e]):p([e])},S=e=>{v(e),p(e?d:[u])};return(0,H.jsx)(`div`,{className:`rounded-xl border border-text text-foreground transition-colors`,children:(0,H.jsxs)(OE,{identifier:tO,children:[(0,H.jsx)(OE.Trigger,{identifier:tO,label:a.value,className:`p-0!`,roundedSize:`3xl`,color:`text`,variant:`hoverable`,children:(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-between text-foreground`,children:[(0,H.jsx)(`div`,{className:`px-2 py-1`,children:(0,H.jsx)(Qs,{size:16})}),(0,H.jsx)($s,{className:`self-center`,size:16})]})}),(0,H.jsx)(OE.Panel,{identifier:tO,isOverable:!0,isFocusable:!0,align:`end`,...e,children:(0,H.jsxs)(Ne,{className:`max-h-[60vh] min-w-28`,separator:`y`,role:`listbox`,transparency:`xs`,border:!0,roundedSize:`3xl`,borderColor:`text`,"aria-label":s.value,children:[t&&(0,H.jsx)(`div`,{className:`m-auto p-2`,children:(0,H.jsx)(wp,{defaultValue:_,onChange:S,color:`text`,size:`sm`,className:`!w-60`,choices:[{content:c.true.value,value:!0},{content:c.false.value,value:!1}]})}),!(t&&_)&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`p-3`,children:(0,H.jsx)(Ap,{type:`search`,"aria-label":r.ariaLabel.value,placeholder:r.placeholder.value,onChange:e=>g(e.target.value),ref:l})}),(0,H.jsx)(`ol`,{className:`divide-y divide-dashed divide-text/20 overflow-y-auto p-1`,children:b.map(({locale:e,currentLocaleName:r,ownLocaleName:a})=>(0,H.jsx)(`li`,{className:`px-1.5 py-1`,children:(0,H.jsx)(M,{onClick:()=>x(e),label:`${n} ${r}`,disabled:!(d??d).includes(e),isActive:f.includes(e),variant:`hoverable`,color:`text`,isFullWidth:!0,textAlign:`left`,size:`sm`,children:(0,H.jsxs)(`div`,{className:`flex flex-row items-center justify-between gap-3 px-2 py-1`,children:[t&&(0,H.jsx)(`div`,{className:`w-4`,children:f.includes(e)&&(0,H.jsx)(i,{className:`size-full`})}),(0,H.jsxs)(`div`,{className:`flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col text-nowrap`,children:[(0,H.jsx)(`span`,{dir:kt(e),lang:e,children:a}),(0,H.jsx)(`span`,{className:`text-neutral text-xs`,children:r})]}),(0,H.jsx)(`span`,{className:`text-neutral text-sm`,children:e.toUpperCase()})]})]})})},e))})]})]})})]})})},rO=Ze(`flex items-center justify-center gap-1`,{variants:{size:{sm:`gap-1`,md:`gap-2`,lg:`gap-3`},color:{text:`background-text`,primary:`background-primary`,secondary:`background-secondary`,neutral:`background-neutral`},variant:{default:``,bordered:`rounded-lg border border-border p-2`,ghost:`bg-transparent`}},defaultVariants:{size:`md`,variant:`default`}}),iO=(e,t,n)=>{if(t<=n)return Array.from({length:t},(e,t)=>t+1);let r=[],i=Math.floor(n/2);if(r.push(1),e<=i+2){for(let e=2;e<=Math.min(n-1,t-1);e++)r.push(e);t>n&&r.push(`ellipsis`),t>1&&r.push(t)}else if(e>=t-i-1){t>n&&r.push(`ellipsis`);for(let e=Math.max(2,t-n+2);e<=t;e++)r.push(e)}else{r.push(`ellipsis`);let n=e-i,a=e+i;for(let e=n;e<=a;e++)r.push(e);r.push(`ellipsis`),r.push(t)}return r},aO=e=>e?.getAttribute(`aria-current`)===`true`,oO=e=>e===`sm`?`icon-sm`:e===`lg`?`icon-lg`:`icon-md`,sO=e=>(0,H.jsx)(`div`,{className:`absolute top-0 z-0 h-full w-auto rounded-xl bg-text/20 ring-4 ring-text/10 transition-[left,width] duration-300 ease-in-out [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl motion-reduce:transition-none`,...e}),cO=({currentPage:e,totalPages:t,onPageChange:n,showFirstLast:r=!1,showPrevNext:i=!0,maxVisiblePages:a=5,disabled:o=!1,size:s=`md`,variant:c=`default`,color:l=`text`,className:u,...d})=>{let{goToNextPage:f,goToPreviousPage:p}=F(`pagination`),m=iO(e,t,a),h=oO(s),g=e===1,_=e===t,v=(0,z.useRef)([]),y=(0,z.useRef)(null),{choiceIndicatorPosition:b,scheduleMeasurement:x}=O(v,{selector:aO,isHoverable:!0});if((0,z.useEffect)(()=>{let e=setTimeout(()=>{x()},300);return()=>clearTimeout(e)},[e,x]),t<=1)return null;let S=r=>{!o&&r>=1&&r<=t&&r!==e&&n(r)};return(0,H.jsx)(`div`,{className:R(rO({size:s,variant:c}),u),...d,children:(0,H.jsxs)(`div`,{className:`relative flex items-center gap-1`,children:[b&&(0,H.jsx)(sO,{style:b,ref:y}),i&&(0,H.jsx)(M,{variant:`outline`,size:h,color:`text`,onClick:()=>S(e-1),disabled:o||g,label:p.value,Icon:Js,ref:e=>{e&&(v.current[0]=e)},className:`min-w-0 px-2`}),(0,H.jsx)(`div`,{className:`flex items-center gap-1 max-md:gap-0.5`,children:m.map((t,n)=>{if(t===`ellipsis`){let e=n===m.indexOf(`ellipsis`)?`ellipsis-start`:`ellipsis-end`;return(0,H.jsx)(`div`,{className:`flex h-8 min-w-8 items-center justify-center px-1`,children:(0,H.jsx)(Zs,{className:`h-4 w-4 text-muted-foreground`})},e)}let r=t===e,a=+!!i+m.slice(0,n).filter(e=>e!==`ellipsis`).length;return(0,H.jsx)(M,{variant:r?`default`:`outline`,size:h,color:`text`,onClick:()=>S(t),disabled:o,label:`Go to page ${t}`,"aria-current":r?`true`:`false`,ref:e=>{e&&(v.current[a]=e)},className:R(`flex aspect-square h-8 w-8 min-w-0 items-center justify-center p-0 text-sm`,s===`sm`&&`h-6 w-6 text-xs`,s===`lg`&&`size-10 text-base`,r&&`font-semibold`),children:t},t)})}),i&&(0,H.jsx)(M,{variant:`outline`,size:h,color:`text`,onClick:()=>S(e+1),disabled:o||_,label:f.value,Icon:Ys,ref:e=>{let t=+!!i+m.filter(e=>e!==`ellipsis`).length;e&&(v.current[t]=e)},className:`min-w-0 px-2`})]})})},lO=e=>{let t=Ft(e),n=zt(e);return t&&(n===`reactNode`||n===`file`)?!0:t&&typeof t.nodeType==`string`?lO(t[t.nodeType]):typeof t==`string`||typeof t==`number`||typeof t==`boolean`||t===void 0},uO=e=>{let t=(0,V.c)(3),{children:n,onToggle:r,...i}=e,[a,o]=(0,z.useState)(!1),s;return t[0]!==a||t[1]!==r?(s=e=>{e&&!a&&o(!0),r?.(e)},t[0]=a,t[1]=r,t[2]=s):s=t[2],(0,H.jsx)(gp,{...i,onToggle:s,children:a?n:null})},dO=e=>{let t=(0,V.c)(16),{section:n,keyPath:r,dictionary:i}=e,{selectedLocales:a}=wm(),o=Mt(n,r,Nf()),{addEditedContent:s}=zf(),{setFocusedContentKeyPath:c,focusedContent:l}=Ff(),{addNewElement:u,goToField:d}=F(`navigation-view`),f=zt(o),p;t[0]===l?.keyPath?p=t[1]:(p=e=>(l?.keyPath?.length??0)>0&&Et(e,l?.keyPath??[]),t[0]=l?.keyPath,t[1]=p);let m=p,h=lO(o);if(!o)return(0,H.jsx)(H.Fragment,{});if(h){let e;return t[2]!==r||t[3]!==c?(e=()=>c(r),t[2]=r,t[3]=c,t[4]=e):e=t[4],(0,H.jsx)(M,{label:d.label.value,variant:`hoverable`,color:`text`,className:`w-full`,onClick:e,IconRight:Ys,children:Dt(r[r.length-1]?.key)})}if(typeof o==`object`){if(f===`reactNode`)return(0,H.jsx)(H.Fragment,{children:`React Node`});if(f===`translation`){let e;return t[5]!==i||t[6]!==r||t[7]!==n?(e=e=>{let t=[...r,{type:ge,key:e}];return(0,H.jsx)(dO,{keyPath:t,section:n,dictionary:i},e)},t[5]=i,t[6]=r,t[7]=n,t[8]=e):e=t[8],(0,H.jsx)(`div`,{className:`flex flex-col justify-between gap-2`,children:a.map(e)})}if(f===`enumeration`||f===`plural`||f===`condition`)return(0,H.jsx)(`div`,{className:`flex flex-col justify-between gap-2`,children:Object.keys(o[f]).map(e=>{let t=[...r,{type:f,key:e}];return(0,H.jsx)(dO,{keyPath:t,section:n,dictionary:i},e)})});if(f===`array`){let e;return t[9]!==i||t[10]!==m||t[11]!==d||t[12]!==r||t[13]!==n||t[14]!==c?(e=(e,t)=>{let a=[...r,{type:k,key:t}];return lO(e)?(0,H.jsxs)(M,{label:`${d.label.value} ${t}`,variant:`hoverable`,color:`text`,className:`w-full`,onClick:()=>c(a),IconRight:Ys,isActive:m(a),children:[`Item `,t]},JSON.stringify(a)):(0,H.jsx)(uO,{label:`${d.label.value} ${t}`,header:`Item ${t}`,isActive:m(a),onClick:()=>c(a),children:(0,H.jsx)(`div`,{className:`mt-2 flex w-full max-w-full`,children:(0,H.jsx)(`div`,{className:`flex-1 pl-10`,children:(0,H.jsx)(dO,{keyPath:a,section:n,dictionary:i})})})},JSON.stringify(a))},t[9]=i,t[10]=m,t[11]=d,t[12]=r,t[13]=n,t[14]=c,t[15]=e):e=t[15],(0,H.jsxs)(`div`,{className:`flex flex-col justify-between gap-2`,children:[o.map(e),(0,H.jsx)(M,{label:u.label.value,variant:`hoverable`,color:`neutral`,textAlign:`left`,onClick:()=>{let e=[...r,{type:k,key:o.length}],t=o,n=Pt(t[t.length-1])??``;s(i.localId,n,e,!1),c(e)},Icon:nc,children:u.text})]})}if(typeof o.nodeType==`string`){let e=[...r,{type:o.nodeType}];return(0,H.jsx)(dO,{keyPath:e,section:n,dictionary:i})}let e=Object.keys(o);return(0,H.jsx)(`div`,{className:`flex w-full max-w-full flex-col justify-between gap-2`,children:e.map(e=>{let t=[...r,{type:ue,key:e}];return lO(Mt(n,t))?(0,H.jsx)(M,{label:`${d.label.value} ${e}`,isActive:m(t),variant:`hoverable`,color:`text`,className:`w-full`,onClick:()=>c(t),IconRight:Ys,children:Dt(e)},e):(0,H.jsx)(uO,{label:`${d.label.value} ${e}`,isActive:m(t),onClick:()=>c(t),header:Dt(e),children:(0,H.jsx)(`div`,{className:`mt-2 flex w-full max-w-full`,children:(0,H.jsx)(`div`,{className:`flex-1 pl-10`,children:(0,H.jsx)(dO,{keyPath:t,section:n,dictionary:i})})})},e)})})}return(0,H.jsxs)(H.Fragment,{children:[`Error loading section --`,f,`--`,JSON.stringify(o),`--`,JSON.stringify(r)]})},fO=e=>typeof e==`object`&&e?JSON.stringify(e):e??``,pO=e=>{let t=(0,V.c)(35),{dictionary:n}=e,{itemPagination:r,variantSwitcher:i}=F(`content-editor`),{editedContent:a}=Bf(),{focusedContent:o,setFocusedContentKeyPath:s}=Ff(),[,c]=(0,z.useTransition)(),l;t[0]!==s||t[1]!==c?(l=e=>c(()=>s(e)),t[0]=s,t[1]=c,t[2]=l):l=t[2];let u=l,[d,f]=(0,z.useState)(n),p,m;t[3]===n?(p=t[4],m=t[5]):(p=()=>{f(n)},m=[n],t[3]=n,t[4]=p,t[5]=m),(0,z.useEffect)(p,m);let h=n.item!==void 0||n.variant!==void 0,g;t[6]===n.key?g=t[7]:(g={keys:[n.key]},t[6]=n.key,t[7]=g);let _=h&&!!n.key,v;t[8]===_?v=t[9]:(v={enabled:_},t[8]=_,t[9]=v);let{data:y}=lp(g,v),b;t[10]===y?.data?b=t[11]:(b=y?.data??[],t[10]=y?.data,t[11]=b);let x=b,S;bb0:{if(n.item===void 0){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[12]=e):e=t[12],S=e;break bb0}let e;t[13]===x?e=t[14]:(e=x.filter(mO).sort(hO),t[13]=x,t[14]=e),S=e}let C=S,w;bb1:{if(n.variant===void 0){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[15]=e):e=t[15],w=e;break bb1}let e;t[16]===x?e=t[17]:(e=x.filter(gO),t[16]=x,t[17]=e),w=e}let T=w,E;t[18]===u?E=t[19]:(E=e=>{f(e),u([])},t[18]=u,t[19]=E);let D=E,{content:O,key:k,localId:ee}=d,A=o?.keyPath,j=a?.[ee]?.content===void 0?O:a?.[ee]?.content,te=Nf(),M;t[20]===A?M=t[21]:(M=A??[],t[20]=A,t[21]=M);let N;t[22]!==te||t[23]!==j||t[24]!==M?(N=Mt(j,M,te),t[22]=te,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P=N,ne=(0,z.useDeferredValue)(A),re=(0,z.useDeferredValue)(P),ie=re!==P,I;t[26]===j?I=t[27]:(I=lO(j),t[26]=j,t[27]=I);let ae=I,oe=lO(re),se;t[28]!==o?.keyPath||t[29]!==P||t[30]!==u?(se=()=>{P===void 0&&u(o?.keyPath?.slice(0,-1)??[])},t[28]=o?.keyPath,t[29]=P,t[30]=u,t[31]=se):se=t[31];let ce;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ce=[],t[32]=ce):ce=t[32],(0,z.useEffect)(se,ce);let le;t[33]===d.localId?le=t[34]:(le=e=>e.localId===d.localId,t[33]=d.localId,t[34]=le);let ue=C.findIndex(le),de=d.variant;return(0,H.jsxs)(`div`,{children:[h&&(0,H.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-4`,children:[C.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-muted text-xs`,children:r.label}),(0,H.jsx)(cO,{currentPage:ue>=0?ue+1:1,totalPages:C.length,onPageChange:e=>{let t=C[e-1];t&&D(t)},size:`sm`})]}),T.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:`font-medium text-muted text-xs`,children:[i.label,`:`]}),T.map(e=>{let t=e.localId===d.localId;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>!t&&D(e),className:`rounded-lg px-3 py-1 text-xs transition-colors ${t?`bg-text font-semibold text-foreground-opposite`:`cursor-pointer border border-border hover:bg-text/10`}`,children:fO(e.variant)},e.localId)}),de!==void 0&&!T.some(e=>e.localId===n.localId)&&(0,H.jsx)(`span`,{className:`rounded-lg bg-text px-3 py-1 font-semibold text-foreground-opposite text-xs`,children:fO(de)})]})]}),(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-2`,children:[(0,H.jsx)(DE,{dictionaryKey:k,keyPath:A??[],onClickKeyPath:u}),(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(nO,{})})]}),(0,H.jsxs)(`div`,{className:`flex flex-1 gap-2 overflow-visible max-md:flex-col`,children:[typeof j==`object`&&j&&!ae&&Object.keys(j).length>0&&(0,H.jsx)(Ne,{border:!0,background:`none`,className:`top-10 flex h-full flex-col items-start gap-0.5 overflow-auto p-2 md:sticky md:max-w-[50%]`,roundedSize:`2xl`,transparency:`xs`,children:(0,H.jsx)(dO,{keyPath:[],section:j,dictionary:d})}),(oe||(ne??[]).length>0)&&(0,H.jsx)(`div`,{className:ie?`pointer-events-none flex-1 opacity-50 transition-opacity`:`flex-1 transition-opacity`,children:(0,H.jsx)(Zm,{keyPath:ne??[],section:re,dictionary:d})})]})]})};function mO(e){return e.item!==void 0}function hO(e,t){return(e.item??0)-(t.item??0)}function gO(e){return e.variant!==void 0}var _O=e=>{let t=(0,V.c)(25),{dictionary:n,mode:r,className:i,onDelete:a,onSave:o,...s}=e,[c,l]=(0,z.useState)(!1),{setLocaleDictionary:u}=Mf(),{mutate:d,isPending:f}=dp(),{mutate:p,isPending:m}=pp(),{mutate:h,isPending:g}=up(),_=m||g,{editedContent:v,restoreEditedContent:y}=Bf(),{deleteButton:b,resetButton:x,saveButton:S,publishButton:C,downloadButton:w,confirmation:T}=F(`save-dictionary-details`),{isAuthenticated:E}=np(),{session:D}=tp(),O;t[0]===D?.permissions?O=t[1]:(O=(D?.permissions?.includes(`dictionary:admin`)||D?.permissions?.includes(`dictionary:write`))??!1,t[0]=D?.permissions,t[1]=O);let k=O,ee=k,A=v?.[n.localId],j;t[2]!==n||t[3]!==A?(j=A&&JSON.stringify(A)!==JSON.stringify(n),t[2]=n,t[3]=A,t[4]=j):j=t[4];let te=j,N=n?.id!==void 0,P;t[5]!==n||t[6]!==v||t[7]!==o||t[8]!==y||t[9]!==u||t[10]!==p?(P=async()=>{if(!v?.[n.localId])return;let e={...n,...v?.[n.localId]};p({dictionary:e},{onSuccess:()=>{u(v?.[n.localId]),y(n.localId),l(!1),o?.()}})},t[5]=n,t[6]=v,t[7]=o,t[8]=y,t[9]=u,t[10]=p,t[11]=P):P=t[11];let ne=P,re;t[12]!==n||t[13]!==v||t[14]!==o||t[15]!==h||t[16]!==y||t[17]!==u?(re=()=>{let e={...n,...v?.[n.localId]};h({dictionaries:[e]},{onSuccess:t=>{t&&(u(e),y(n.localId),o?.())}})},t[12]=n,t[13]=v,t[14]=o,t[15]=h,t[16]=y,t[17]=u,t[18]=re):re=t[18];let ie=re,I;t[19]!==d||t[20]!==n||t[21]!==a?(I=()=>{n.id&&d({dictionaryId:n.id},{onSuccess:e=>{e&&a?.()}})},t[19]=d,t[20]=n,t[21]=a,t[22]=I):I=t[22];let ae=I,oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>l(!1),t[23]=oe):oe=t[23];let se;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>l(!1),t[24]=se):se=t[24],(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(je,{isOpen:c,title:T.title.value,size:`md`,onClose:oe,padding:`md`,children:(0,H.jsxs)(`form`,{className:`size-full`,children:[(0,H.jsx)(`p`,{className:`py-4 text-muted-foreground text-sm`,children:T.message}),(0,H.jsxs)(`div`,{className:`mt-12 flex justify-end gap-2 max-md:flex-col`,children:[(0,H.jsx)(M,{label:T.cancelButton.label.value,disabled:!te||_,color:`text`,className:`max-md:w-full`,variant:`outline`,onClick:se,children:T.cancelButton.text}),(0,H.jsx)(M,{label:T.confirmButton.label.value,disabled:!te||_||!k,Icon:ic,color:`text`,className:`max-md:w-full`,isLoading:g,onClick:ne,children:T.confirmButton.text})]})]})}),(0,H.jsxs)(`form`,{className:R(`flex justify-end gap-2`,i),...s,children:[r.includes(`remote`)&&N&&a&&E&&(0,H.jsx)(M,{label:b.label.value,Icon:oc,color:`error`,variant:`outline`,className:`max-md:w-full`,isLoading:f,onClick:ae,disabled:!ee,children:b.text}),te&&(0,H.jsx)(M,{label:x.label.value,disabled:!te,Icon:rc,variant:`outline`,color:`text`,className:`max-md:w-full`,onClick:()=>y(n.localId),children:x.text}),r.includes(`local`)&&(0,H.jsx)(M,{label:w.label.value,disabled:!te||_,Icon:Xs,color:`text`,variant:E?`outline`:`default`,className:`max-md:w-full`,isLoading:m,onClick:()=>l(!0),children:w.text}),r.includes(`remote`)&&E&&!N&&(0,H.jsx)(M,{label:C.label.value,disabled:_||!k,Icon:qs,color:`text`,className:`max-md:w-full`,isLoading:g,onClick:ie,children:C.text}),r.includes(`remote`)&&E&&N&&te&&(0,H.jsx)(M,{label:S.label.value,disabled:!te||_||!k,Icon:ic,color:`text`,className:`max-md:w-full`,isLoading:g,onClick:ie,children:S.text})]})]})},vO=(e,t=2e3,n,r)=>{let[i,a]=(0,z.useState)(!1);return{isCopied:i,copy:async()=>{if(e)try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else{r?.(Error(`Clipboard API not supported in this browser`));return}a(!0),setTimeout(()=>a(!1),t),n?.()}catch(e){let t=e instanceof Error?e.message:`Failed to copy to clipboard`;r?.(e instanceof Error?e:Error(t))}}}},yO=({text:e,children:t,className:n,"aria-label":r=`Copy to clipboard`,"aria-copied-label":i=`Copied to clipboard`,feedbackDuration:a=2e3,onCopySuccess:o,onCopyError:s,disable:c,preventDefault:l=!0,stopPropagation:u=!0,size:d=14})=>{let{isCopied:f,copy:p}=vO(e,a,o,s);if(c)return(0,H.jsx)(`span`,{className:n,children:t});let m=e=>{(e.key===`Enter`||e.key===` `)&&h(e)},h=e=>{l&&e.preventDefault(),u&&e.stopPropagation(),p()},g=f?i:r,_=f?he:de;return(0,H.jsxs)(`span`,{className:R(`inline-flex max-w-full cursor-pointer items-center gap-2 rounded-md p-0.5 hover:bg-neutral/10`,n),onClick:h,onKeyDown:m,role:`button`,tabIndex:0,"aria-label":g,"aria-pressed":f,"data-testid":`copy-to-clipboard`,children:[(0,H.jsx)(`span`,{className:`min-w-0 break-all`,children:t}),e&&(0,H.jsx)(_,{className:`ml-1 ml-auto shrink-0`,size:d,"aria-hidden":`true`})]})},bO=Ze([`appearance-none`,`relative cursor-pointer border-2`,`focus:outline-0`,`checked:hover:opacity-80`,`ring-offset-background`,`hover:bg-neutral-500/10`,`disabled:opacity-50`,`ring-0 transition-all duration-300 ease-in-out hover:ring-4 focus-visible:ring-6`,`checked:before:absolute checked:before:inset-0 checked:before:content-['✓']`,`checked:before:flex checked:before:items-center checked:before:justify-center`,`checked:before:text-foreground-opposite/80`,`rounded-xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl`,`after:absolute after:-inset-2 after:content-['']`].join(` `),{variants:{variant:{default:``},size:{xs:`size-3 rounded-sm`,sm:`size-4 rounded-md`,md:`size-5 rounded-lg`,lg:`size-6 rounded-xl`},color:{primary:`border-primary/30 text-primary ring-primary/20 checked:border-primary checked:bg-primary`,secondary:`border-secondary/30 text-secondary ring-secondary/20 checked:border-secondary checked:bg-secondary`,neutral:`border-neutral/30 text-muted-foreground ring-neutral/20 checked:border-neutral checked:bg-neutral`,light:`border-white/30 text-white ring-white/20 checked:border-white checked:bg-white`,text:`border-text/30 text-foreground ring-text/20 checked:border-text checked:bg-text`,"text-inverse":`border-text-inverse/30 text-foreground-inverse ring-text-inverse/20 checked:border-text-inverse checked:bg-text-inverse`,dark:`border-neutral-800/30 text-neutral-800 ring-neutral-800/20 checked:border-neutral-800 checked:bg-neutral-800`,error:`border-error/30 text-error ring-error/20 checked:border-error checked:bg-error`,success:`border-success/30 text-success ring-success/20 checked:border-success checked:bg-success`,custom:`border-custom/30 text-custom ring-custom/20 checked:border-custom checked:bg-custom`},validationStyleEnabled:{disabled:``,enabled:`valid:border-success invalid:border-error`}},defaultVariants:{variant:`default`,color:`text`,validationStyleEnabled:`disabled`,size:`md`}}),xO=({validationStyleEnabled:e=!1,label:t,size:n,color:r,name:i,variant:a,className:o,labelClassName:s,...c})=>(0,H.jsx)(`input`,{type:`checkbox`,className:R(bO({variant:a,size:n,color:r,validationStyleEnabled:e?`enabled`:`disabled`}),o),...c}),SO=e=>{let{label:t,name:n,id:r}=e;return t?(0,H.jsxs)(`label`,{htmlFor:r??n,className:R(`flex w-full cursor-pointer items-center gap-x-4 font-medium text-sm`,e.size===`xs`&&`text-xs`,e.labelClassName),children:[(0,H.jsx)(xO,{id:r??n,...e}),t]}):(0,H.jsx)(xO,{id:r??n,...e})},CO=e=>(0,H.jsx)(Wv,{id:e.name,"data-testid":e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,Element:Wp,...e}),wO=e=>(0,H.jsx)(Wv,{id:e.name,"data-testid":e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,Element:Ip,...e}),TO=e=>{let t=(0,V.c)(38),{titleRequiredError:n,titleInvalidTypeError:r,titleMinLengthError:i,keyRequiredError:a,keyInvalidTypeError:o,keySpaceError:s,keyMinLengthError:c,descriptionRequiredError:l,descriptionInvalidTypeError:u,requiredErrorProjectId:d,invalidTypeErrorProjectId:f,invalidTypeErrorTags:p,locationRequiredError:m,locationInvalidTypeError:h,filePathRequiredError:g,filePathInvalidTypeError:_}=F(`dictionary-detail-schema`),v;if(t[0]!==u||t[1]!==l||t[2]!==_||t[3]!==g||t[4]!==f||t[5]!==p||t[6]!==o||t[7]!==c.value||t[8]!==a||t[9]!==s.value||t[10]!==h||t[11]!==m||t[12]!==e||t[13]!==d||t[14]!==r||t[15]!==i.value||t[16]!==n){let y;t[18]!==r||t[19]!==n?(y=e=>e.input===void 0?n.value:r.value,t[18]=r,t[19]=n,t[20]=y):y=t[20];let b;t[21]!==o||t[22]!==a?(b=e=>e.input===void 0?a.value:o.value,t[21]=o,t[22]=a,t[23]=b):b=t[23];let x;t[24]!==u||t[25]!==l?(x=e=>e.input===void 0?l.value:u.value,t[24]=u,t[25]=l,t[26]=x):x=t[26];let S;t[27]!==f||t[28]!==d?(S=e=>e.input===void 0?d.value:f.value,t[27]=f,t[28]=d,t[29]=S):S=t[29];let C;t[30]===p?C=t[31]:(C=()=>p.value,t[30]=p,t[31]=C);let w;t[32]!==h||t[33]!==m?(w=e=>e.input===void 0?m.value:h.value,t[32]=h,t[33]=m,t[34]=w):w=t[34];let T;t[35]!==_||t[36]!==g?(T=e=>e.input===void 0?g.value:_.value,t[35]=_,t[36]=g,t[37]=T):T=t[37],v=GT({title:pT({error:y}).refine(EO,{error:i.value}).optional(),key:pT({error:b}).min(4,{error:c.value}).regex(/^[a-zA-Z0-9-_]+$/,{error:s.value}).default(``),description:pT({error:x}).optional(),projectIds:UT(pT({error:S})).default([e]),tags:UT(pT({error:C})).default([]),location:ZT([`local`,`remote`,`hybrid`,`plugin`],{error:w}).optional(),importMode:ZT([`static`,`dynamic`,`fetch`]).optional(),filePath:pT({error:T}).optional()}),t[0]=u,t[1]=l,t[2]=_,t[3]=g,t[4]=f,t[5]=p,t[6]=o,t[7]=c.value,t[8]=a,t[9]=s.value,t[10]=h,t[11]=m,t[12]=e,t[13]=d,t[14]=r,t[15]=i.value,t[16]=n,t[17]=v}else v=t[17];return v};function EO(e){return e.length===0||e.length>=4}var DO=[`collection`,`variant`],OO=e=>{let t=[];return e.item!==void 0&&t.push(`collection`),e.variant!==void 0&&t.push(`variant`),t},kO=e=>typeof e==`object`&&e?JSON.stringify(e):e??``,AO=e=>{if(e.trim().startsWith(`{`))try{return{variant:JSON.parse(e),error:!1}}catch{return{variant:e,error:!0}}return{variant:e,error:!1}},jO=({dictionary:e,mode:t,onSelectSibling:n})=>{let{session:r}=tp(),{project:i}=r??{},{data:a,isLoading:o}=mp(),{data:s}=hp(),c=a?.data??[],l=s?.data??[],u=TO(String(i?.id)),{form:d,isSubmitting:f}=cy(u,{defaultValues:{...e,location:e.location??`remote`}}),{editedContent:p,setEditedDictionary:h}=Bf(),{titleInput:g,keyInput:_,descriptionInput:v,projectInput:y,tagsSelect:x,locationSelect:S,importModeSelect:C,filePathInput:w,auditButton:T,qualifierSection:E,siblingDictionaries:D,typeSwitch:O}=F(`dictionary-details`),{mutate:k,isPending:ee}=op(),A=p?.[e.localId],{data:j,isLoading:te}=lp({keys:[e.key]},{enabled:!!e.key}),N=(0,z.useMemo)(()=>(j?.data??[]).filter(t=>t.localId!==e.localId),[j,e.localId]),P=(0,z.useMemo)(()=>N.filter(e=>e.item!==void 0).sort((e,t)=>(e.item??0)-(t.item??0)),[N]),ne=(0,z.useMemo)(()=>N.filter(e=>e.variant!==void 0),[N]),re=(0,z.useMemo)(()=>e.item===void 0?P:[e,...P].sort((e,t)=>(e.item??0)-(t.item??0)),[e,P]),ie=(0,z.useMemo)(()=>e.variant===void 0?ne:[e,...ne],[e,ne]);(0,z.useEffect)(()=>{d.reset({...e,tags:e.tags??[],location:e.location??`remote`}),le(OO(e)),de(e.item??1),pe(kO(e.variant)),he(!1),_e(!1)},[e,d?.reset]),(0,z.useEffect)(()=>{A===void 0&&d.reset({...e,tags:e.tags??[],location:e.location??`remote`})},[A]);let I=()=>{let t={...e,...A};k({fileContent:JSON.stringify(t)},{onSuccess:e=>{if(!e?.data)return;let n=e.data.fileContent,r={...t,...n,tags:n.tags??t.tags??[]};h(r),d.reset(r)}})},ae=C_({control:d.control,name:`location`}),oe=ae===`local`||ae===`hybrid`,se=N.length>0,[ce,le]=(0,z.useState)(()=>OO(e)),[ue,de]=(0,z.useState)(e.item??1),[fe,pe]=(0,z.useState)(kO(e.variant)),[me,he]=(0,z.useState)(!1),[ge,_e]=(0,z.useState)(!1),ve=(0,z.useMemo)(()=>[...P,...ne],[P,ne]),ye=t=>{let n=[t].flat(),r=n.filter(e=>!ce.includes(e)),i=ce.filter(e=>!n.includes(e)),a={...e,...A??{}};for(let e of i)e===`collection`&&(a={...a,item:void 0}),e===`variant`&&(a={...a,variant:void 0});for(let e of r)if(e===`collection`){let e=re.length>0?Math.max(...re.map(e=>e.item??0))+1:1;de(e),a={...a,item:e}}else if(e===`variant`){let e=fe||`default`;pe(e),a={...a,variant:AO(e).variant}}le(n),h(a),he(!1),n.length===0&&ve.length>0?_e(!0):_e(!1)};return(0,H.jsxs)(ly,{className:`flex w-full flex-col gap-8`,...d,schema:u,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[(0,H.jsx)(CO,{name:`key`,label:_.label,placeholder:_.label.value,description:_.description,disabled:f,isRequired:!0,onSave:t=>{d.setValue(`key`,t,{shouldDirty:!0}),h({...e,...A??{},key:t})}}),(0,H.jsx)(CO,{name:`title`,label:g.label,placeholder:g.placeholder.value,description:g.description,disabled:f,onSave:t=>{d.setValue(`title`,t,{shouldDirty:!0}),h({...e,...A??{},title:t})}})]}),(0,H.jsx)(wO,{name:`description`,label:v.label,placeholder:v.placeholder.value,description:v.description,disabled:f,onSave:t=>{d.setValue(`description`,t,{shouldDirty:!0}),h({...e,...A??{},description:t})}}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-8 px-1 max-md:grid-cols-1`,children:[(0,H.jsx)(Nv,{control:d.control,name:`location`,render:({field:n})=>{let r=n.value,i=r===`local`||r===`hybrid`,a=r===`remote`||r===`hybrid`,o=t=>{if(!t&&!a)return;let r=t?a?`hybrid`:`local`:`remote`;n.onChange(r);let i=t?d.getValues(`filePath`)??e.filePath:void 0;t||d.setValue(`filePath`,void 0),h({...e,...A??{},location:r,filePath:i})},s=t=>{if(!t&&!i)return;let r=t?i?`hybrid`:`remote`:`local`;n.onChange(r),h({...e,...A??{},location:r})};return(0,H.jsxs)(zg,{className:`flex flex-col gap-2 px-1`,children:[(0,H.jsx)(Vv,{className:`ml-1`,children:S.label}),(0,H.jsxs)(`div`,{className:`ml-2 flex items-center gap-4 py-2`,children:[(0,H.jsx)(SO,{id:`location-local`,name:`location-local`,label:S.local.value,color:`text`,checked:i,disabled:!t.includes(`local`)&&!t.includes(`remote`),onChange:e=>o(e.target.checked)}),(0,H.jsx)(SO,{id:`location-remote`,name:`location-remote`,label:S.remote.value,color:`text`,checked:a,disabled:!t.includes(`remote`)&&e.location!==`remote`&&e.location!==`hybrid`,onChange:e=>s(e.target.checked)})]}),(0,H.jsx)(Iv,{children:S.testDescription}),(0,H.jsx)(Lv,{})]})}}),(0,H.jsx)(Ec,{mode:`wait`,children:oe&&(0,H.jsx)(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.3},children:(0,H.jsx)(Gv,{name:`filePath`,label:w.label.value,placeholder:w.placeholder.value,description:w.description.value,disabled:f||!oe,onChange:t=>{let n=t.target.value;h({...e,...A??{},filePath:n})}})},`filePath-input`)})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:(0,H.jsxs)(Yv,{name:`importMode`,label:C.label.value,description:C.description.value,onValueChange:t=>{d.setValue(`importMode`,t,{shouldDirty:!0}),h({...e,...A??{},importMode:t})},children:[(0,H.jsx)(L.Trigger,{children:(0,H.jsx)(L.Value,{placeholder:C.label.value})}),(0,H.jsxs)(L.Content,{children:[(0,H.jsx)(L.Item,{value:`static`,children:C.static.value}),(0,H.jsx)(L.Item,{value:`dynamic`,children:C.dynamic.value}),(0,H.jsx)(L.Item,{value:`live`,children:C.live.value})]})]})}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[(0,H.jsxs)(qv,{name:`projectIds`,label:y.label.value,description:y.description,onValueChange:t=>{let n=[t].flat();d.setValue(`projectIds`,n,{shouldDirty:!0}),h({...e,...A??{},projectIds:n})},children:[(0,H.jsx)(Lg.Trigger,{getBadgeValue:e=>c?.find(t=>String(t.id)===e)?.name??e,children:(0,H.jsx)(Lg.Input,{placeholder:y.placeholder.value})}),(0,H.jsx)(Lg.Content,{children:(0,H.jsx)(m,{isLoading:o,children:(0,H.jsx)(Lg.List,{children:c?.map(e=>(0,H.jsx)(Lg.Item,{value:String(e.id),children:e.name},String(e.id)))})})})]}),(0,H.jsxs)(qv,{name:`tags`,label:x.label.value,description:x.description,onValueChange:t=>{let n=[t].flat();d.setValue(`tags`,n,{shouldDirty:!0}),h({...e,...A??{},tags:n})},children:[(0,H.jsx)(Lg.Trigger,{getBadgeValue:e=>l?.find(t=>String(t.key)===e)?.name??e,children:(0,H.jsx)(Lg.Input,{placeholder:x.placeholder.value})}),(0,H.jsx)(Lg.Content,{children:(0,H.jsx)(m,{isLoading:o,children:(0,H.jsx)(Lg.List,{children:l?.map(e=>(0,H.jsx)(Lg.Item,{value:String(e.key),children:e.name??e.key},String(e.key)))})})})]})]}),(0,H.jsxs)(Ne,{className:`gap-4`,padding:`md`,roundedSize:`2xl`,background:`none`,border:!0,borderColor:`card`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`p`,{className:`ml-1 font-semibold text-sm`,children:O.label}),(0,H.jsx)(`p`,{className:`ml-1 text-muted text-xs`,children:O.description})]}),(0,H.jsxs)(Lg,{values:ce,onValueChange:ye,className:`max-w-xs`,children:[(0,H.jsx)(Lg.Trigger,{getBadgeValue:e=>e===`collection`?String(O.collection):e===`variant`?String(O.variant):e,children:(0,H.jsx)(Lg.Input,{placeholder:O.label.value})}),(0,H.jsx)(Lg.Content,{children:(0,H.jsx)(Lg.List,{children:DO.map(e=>(0,H.jsx)(Lg.Item,{value:e,children:O[e].value},e))})})]}),(0,H.jsxs)(Ec,{children:[ce.includes(`collection`)&&(0,H.jsx)(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2},children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,H.jsx)(`label`,{htmlFor:`qualifier-item-value`,className:`ml-1 font-medium text-sm`,children:O.itemValueLabel}),(0,H.jsx)(Ap,{id:`qualifier-item-value`,type:`number`,min:1,value:ue,placeholder:O.itemValuePlaceholder.value,onChange:t=>{let n=parseInt(t.target.value,10);!Number.isNaN(n)&&n>=1&&(de(n),h({...e,...A??{},item:n}))}})]})},`item-input`),ce.includes(`variant`)&&(0,H.jsx)(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2},children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,H.jsx)(`label`,{htmlFor:`qualifier-variant-value`,className:`ml-1 font-medium text-sm`,children:O.variantValueLabel}),(0,H.jsx)(Ap,{id:`qualifier-variant-value`,type:`text`,value:fe,placeholder:O.variantValuePlaceholder.value,onChange:t=>{let n=t.target.value;pe(n);let{variant:r,error:i}=AO(n);he(i),i||h({...e,...A??{},variant:r})}}),me&&(0,H.jsx)(`p`,{className:`ml-1 text-destructive text-xs`,children:O.variantJsonError})]})},`variant-input`),ce.length===0&&ge&&(0,H.jsx)(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2},children:(0,H.jsxs)(Ne,{background:`none`,border:!0,borderColor:`neutral`,roundedSize:`xl`,padding:`md`,className:`gap-3`,children:[(0,H.jsx)(`p`,{className:`font-medium text-sm`,children:O.disablePickerTitle}),(0,H.jsx)(`p`,{className:`text-muted text-xs`,children:O.disablePickerDescription}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ve.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{n?.(e),_e(!1)},className:`cursor-pointer rounded-lg border border-border px-3 py-1 text-xs transition-colors hover:bg-text/10`,children:[e.variant!==void 0&&(0,H.jsxs)(`span`,{children:[E.variant,`:`,` `,kO(e.variant)]}),e.item!==void 0&&(0,H.jsxs)(`span`,{children:[E.item,`: `,e.item]})]},e.localId))})]})},`sibling-picker`)]})]}),(0,H.jsxs)(Ne,{className:`gap-4`,padding:`md`,roundedSize:`2xl`,background:`none`,border:!0,borderColor:`neutral`,children:[(0,H.jsx)(`p`,{className:`font-semibold text-sm`,children:D.title}),(0,H.jsxs)(m,{isLoading:te,children:[!se&&(0,H.jsx)(`p`,{className:`text-muted text-sm`,children:D.noSiblings}),re.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`p`,{className:`font-medium text-muted text-xs uppercase tracking-wide`,children:D.collectionItems}),(0,H.jsx)(cO,{currentPage:re.findIndex(t=>t.localId===e.localId)+1||1,totalPages:re.length,onPageChange:e=>{let t=re[e-1];t&&n&&n(t)},showPrevNext:!0}),(0,H.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:re.map(t=>{let r=t.localId===e.localId;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>!r&&n?.(t),className:R(`rounded-lg px-3 py-1 text-xs transition-colors`,r?`bg-text font-semibold text-foreground-opposite`:`cursor-pointer border border-border hover:bg-text/10`),children:[D.itemIndex,` `,t.item]},t.localId)})})]}),ie.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`p`,{className:`font-medium text-muted text-xs uppercase tracking-wide`,children:D.variants}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(t=>{let r=t.localId===e.localId;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>!r&&n?.(t),className:R(`rounded-lg px-3 py-1 text-xs transition-colors`,r?`bg-text font-semibold text-foreground-opposite`:`cursor-pointer border border-border hover:bg-text/10`),children:kO(t.variant)},t.localId)})})]})]})]}),(0,H.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 max-md:flex-col`,children:(0,H.jsx)(M,{type:`button`,size:`icon-md`,label:T.label.value,Icon:sc,variant:`outline`,color:`text`,className:`max-md:w-full`,onClick:I,disabled:f||ee,isLoading:ee})})]})},MO=(0,z.lazy)(()=>Ct(()=>import(`./dist-CMBnegHe.js`).then(e=>({default:e.Editor})),__vite__mapDeps([7,2]))),NO=({children:e,language:t,isDarkMode:n,showLineNumbers:r,showCopyButton:i=!0,isReadOnly:a=!1,onChange:o})=>{let s=(0,z.useRef)(null),c=(0,z.useRef)(null),[l,u]=(0,z.useState)({height:0,width:0}),d=n?`vs-dark-transparent`:`hc-light-theme`,f=(e,t)=>{c.current=e;let n=(e.getContentHeight()??0)+25;t.editor.defineTheme(`vs-dark-transparent`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#00000000`}}),t.editor.defineTheme(`hc-light-theme`,{base:`vs`,inherit:!0,rules:[],colors:{"editor.background":`#00000000`}}),t.editor.setTheme(d),t.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0}),t.languages.typescript.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0}),t.languages.typescript.typescriptDefaults.setCompilerOptions({noLib:!0,allowNonTsExtensions:!0}),t.languages.typescript.javascriptDefaults.setCompilerOptions({noLib:!0,allowNonTsExtensions:!0}),u({height:n,width:s.current?.clientWidth??0})},p=r??(typeof e==`string`&&e.split(`
|
|
108
|
-
`).length>1);return(0,H.jsxs)(`div`,{className:R(`relative size-full text-sm`,r&&`ml-0`),children:[i&&(0,H.jsx)(`div`,{className:`sticky top-5 z-10`,children:(0,H.jsx)(`div`,{className:R(`absolute right-2 bottom-0 flex h-7 items-center`),children:(0,H.jsx)(ze,{content:e})})}),(0,H.jsx)(`div`,{className:`z-0 grid size-full grid-cols-[0px] overflow-auto`,ref:s,children:(0,H.jsx)(z.Suspense,{fallback:(0,H.jsx)(m,{}),children:(0,H.jsx)(MO,{...l,defaultLanguage:`typescript`,language:t,loading:(0,H.jsx)(m,{}),defaultValue:String(e).replace(/\n$/,``),onMount:f,onChange:o,options:{contextmenu:!1,readOnly:a,cursorStyle:`line`,minimap:{enabled:!1},scrollbar:{vertical:`hidden`,verticalScrollbarSize:0,alwaysConsumeMouseWheel:!1},folding:!1,renderValidationDecorations:`off`,quickSuggestions:!1,parameterHints:{enabled:!1},suggestOnTriggerCharacters:!1,mouseWheelScrollSensitivity:0,fastScrollSensitivity:0,scrollBeyondLastLine:!1,lineNumbers:p?`on`:`off`},theme:d,className:`my-2 rounded-md`})})})]})},PO=e=>{let t=(0,V.c)(7),{dictionary:n,isDarkMode:r}=e,{setEditedContent:i,editedContent:a}=Bf(),o=FO,s=a?.[n.localId]?.content??n?.content,c;t[0]!==n||t[1]!==i?(c=e=>{o(e??`{}`)&&i(n.localId,JSON.parse(e??`{}`))},t[0]=n,t[1]=i,t[2]=c):c=t[2];let l;return t[3]!==s||t[4]!==r||t[5]!==c?(l=(0,H.jsx)(NO,{language:`json`,onChange:c,isDarkMode:r,children:JSON.stringify(s,null,2)}),t[3]=s,t[4]=r,t[5]=c,t[6]=l):l=t[6],l};function FO(e){try{return JSON.parse(e),!0}catch{return!1}}var IO=e=>{let t=(0,V.c)(24),{section:n,onValueChange:r}=e,{multilingual:i,text:a,number:o,boolean:s,node:c,array:u,enumeration:d,plural:f,triggerPlaceHolder:p,nest:m,gender:g,select:v,condition:y,markdown:b,insertion:S,reactNode:w,file:T}=F(`node-type-selector`),E;t[0]===n?E=t[1]:(E=zt(n),t[0]=n,t[1]=E);let[O,ee]=(0,z.useState)(E),j;t[2]===r?j=t[3]:(j=e=>{ee(e),r(e)},t[2]=r,t[3]=j);let te=j,M;return t[4]!==u||t[5]!==s||t[6]!==y||t[7]!==d||t[8]!==T||t[9]!==g||t[10]!==S||t[11]!==O||t[12]!==b||t[13]!==i||t[14]!==m||t[15]!==c||t[16]!==o||t[17]!==te||t[18]!==f||t[19]!==w||t[20]!==v||t[21]!==a||t[22]!==p?(M=(0,H.jsxs)(L,{value:O,onValueChange:te,children:[(0,H.jsx)(L.Trigger,{children:(0,H.jsx)(L.Value,{placeholder:p})}),(0,H.jsxs)(L.Content,{children:[(0,H.jsx)(L.Item,{value:ge,children:i}),(0,H.jsx)(L.Item,{value:fe,children:a}),(0,H.jsx)(L.Item,{value:oe,children:o}),(0,H.jsx)(L.Item,{value:A,children:s}),(0,H.jsx)(L.Item,{value:ue,children:c}),(0,H.jsx)(L.Item,{value:k,children:u}),(0,H.jsx)(L.Item,{value:h,children:d}),(0,H.jsx)(L.Item,{value:_,children:f}),(0,H.jsx)(L.Item,{value:D,children:g}),(0,H.jsx)(L.Item,{value:C,children:v}),(0,H.jsx)(L.Item,{value:it,children:S}),(0,H.jsx)(L.Item,{value:l,children:b}),(0,H.jsx)(L.Item,{value:ce,children:m}),(0,H.jsx)(L.Item,{value:N,children:y}),(0,H.jsx)(L.Item,{value:We,disabled:!0,children:w}),(0,H.jsx)(L.Item,{value:x,children:T})]})]}),t[4]=u,t[5]=s,t[6]=y,t[7]=d,t[8]=T,t[9]=g,t[10]=S,t[11]=O,t[12]=b,t[13]=i,t[14]=m,t[15]=c,t[16]=o,t[17]=te,t[18]=f,t[19]=w,t[20]=v,t[21]=a,t[22]=p,t[23]=M):M=t[23],M},LO=e=>{let t=(0,V.c)(15),{section:n,dictionaryLocalId:r,keyPath:i,onNodeTypeChange:a}=e,o=Rf()?.internationalization?.locales??[],s=zt(n),c=Ft(n),l=e=>{a(Nt(s,o,e))};if(s===`translation`||s===`condition`||s===`gender`||s===`select`||s===`enumeration`||s===`plural`){let e=Object.keys(n[s])[0],t=[...i,{type:s,key:e}];return(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,H.jsx)(IO,{section:n,onValueChange:e=>a(Nt(e,o))}),(0,H.jsx)(LO,{section:c,keyPath:t,dictionaryLocalId:r,onNodeTypeChange:l})]})}if(s===`array`){let e=[...i,{type:s,key:0}];return(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,H.jsx)(IO,{section:n,onValueChange:e=>a(Nt(e,o))}),(0,H.jsx)(LO,{section:c,keyPath:e,dictionaryLocalId:r,onNodeTypeChange:l})]})}if(s===`object`){let e;if(t[0]!==r||t[1]!==i||t[2]!==o||t[3]!==a||t[4]!==n){let s;t[6]!==o||t[7]!==a?(s=e=>a(Nt(e,o)),t[6]=o,t[7]=a,t[8]=s):s=t[8],e=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(IO,{section:n,onValueChange:s}),(0,H.jsx)(`div`,{className:`mt-6 ml-10`,children:(0,H.jsx)(BO,{keyPath:i,section:n,dictionaryLocalId:r})})]}),t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=n,t[5]=e}else e=t[5];return e}let u;t[9]!==o||t[10]!==a?(u=e=>a(Nt(e,o)),t[9]=o,t[10]=a,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==u?(d=(0,H.jsx)(IO,{section:n,onValueChange:u}),t[12]=n,t[13]=u,t[14]=d):d=t[14],d},RO=e=>{let t=(0,V.c)(23),{sectionKey:n,section:r,keyPath:i,dictionaryLocalId:a}=e,{focusedContent:o,setFocusedContentKeyPath:s}=Ff(),{renameEditedContent:c,addEditedContent:l}=zf(),{titleInput:u,deleteButton:d}=F(`structure-view`),f;t[0]!==a||t[1]!==i||t[2]!==c||t[3]!==s?(f=e=>{c(a,e,i);let t=i.slice(0,-1),n=i[i.length-1],r=[...t,{...n,key:e}];s(r)},t[0]=a,t[1]=i,t[2]=c,t[3]=s,t[4]=f):f=t[4];let p=f,m;if(t[5]!==l||t[6]!==d||t[7]!==a||t[8]!==o?.keyPath||t[9]!==p||t[10]!==i||t[11]!==r||t[12]!==n||t[13]!==s||t[14]!==u){let e;t[16]!==i||t[17]!==s?(e=()=>s(i),t[16]=i,t[17]=s,t[18]=e):e=t[18];let c;t[19]!==l||t[20]!==a||t[21]!==i?(c=e=>{l(a,e,i)},t[19]=l,t[20]=a,t[21]=i,t[22]=c):c=t[22],m=(0,H.jsx)(Ne,{transparency:`xl`,roundedSize:`2xl`,className:`w-full min-w-80 gap-2 overflow-auto px-5 py-2`,border:!0,borderColor:`text`,background:`none`,"aria-selected":Et(i,o?.keyPath??[]),onClick:e,children:(0,H.jsxs)(`div`,{className:`flex w-full flex-col items-start justify-between gap-3`,children:[typeof n==`string`&&(0,H.jsxs)(`div`,{className:`w-full`,children:[(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-10`,children:[(0,H.jsx)(Wp,{name:`key`,"aria-label":`Key`,placeholder:u.placeholder.value,defaultValue:n,onSave:e=>p(e),variant:`invisible`}),(0,H.jsx)(M,{label:d.label.value,variant:`hoverable`,size:`icon-sm`,color:`text`,className:`translate-x-2`,Icon:oc,onClick:()=>{l(a,void 0,i);let e=i.slice(0,-1);s(e)}})]}),(0,H.jsxs)(`span`,{className:`ml-3 text-muted-foreground text-sm`,children:[`( `,Dt(n),` )`]})]}),(0,H.jsx)(LO,{keyPath:i,dictionaryLocalId:a,section:r,onNodeTypeChange:c})]})}),t[5]=l,t[6]=d,t[7]=a,t[8]=o?.keyPath,t[9]=p,t[10]=i,t[11]=r,t[12]=n,t[13]=s,t[14]=u,t[15]=m}else m=t[15];return m},zO=e=>{let t=(0,V.c)(14),{section:n,keyPath:r,dictionaryLocalId:i}=e,{addNodeButton:a}=F(`structure-view`),{setFocusedContentKeyPath:o}=Ff(),{addEditedContent:s}=zf();if(!n||typeof n!=`object`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{children:`Not an object`}),t[0]=e):e=t[0],e}let c;if(t[1]!==s||t[2]!==a.label.value||t[3]!==a.text||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==o){let e;t[9]!==s||t[10]!==i||t[11]!==r||t[12]!==o?(e=()=>{let e=[...r,{type:ue,key:`newKey`}];s(i,``,e),o(e)},t[9]=s,t[10]=i,t[11]=r,t[12]=o,t[13]=e):e=t[13],c=(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 overflow-y-auto`,children:[(0,H.jsx)(`ul`,{className:`mr-auto flex flex-col gap-4`,children:Object.keys(n).map(e=>(0,H.jsx)(`li`,{className:`flex w-full`,children:(0,H.jsx)(RO,{sectionKey:e,section:n?.[e],keyPath:[...r,{type:ue,key:e}],dictionaryLocalId:i})},`${JSON.stringify(r)}-object-${e}`))}),(0,H.jsx)(M,{label:a.label.value,variant:`hoverable`,size:`md`,color:`text`,Icon:nc,className:`flex-1`,onClick:e,children:a.text})]}),t[1]=s,t[2]=a.label.value,t[3]=a.text,t[4]=i,t[5]=r,t[6]=n,t[7]=o,t[8]=c}else c=t[8];return c},BO=({section:e,keyPath:t,dictionaryLocalId:n})=>!e||typeof e!=`object`||typeof e.nodeType==`string`?(0,H.jsx)(RO,{sectionKey:`content`,section:e,keyPath:t,dictionaryLocalId:n}):(0,H.jsx)(zO,{section:e,keyPath:t,dictionaryLocalId:n}),VO=e=>{let t=(0,V.c)(3),{dictionary:n}=e,{content:r,localId:i}=n,{editedContent:a}=Bf(),o=a?.[i]?.content===void 0?r:a?.[i]?.content,s;return t[0]!==o||t[1]!==i?(s=(0,H.jsx)(RO,{section:o,keyPath:[],dictionaryLocalId:i}),t[0]=o,t[1]=i,t[2]=s):s=t[2],s},HO=({dictionary:e,onClickDictionaryList:t,isDarkMode:n,mode:r,onDelete:i,onSave:a,showReturnButton:o=!0,rightContent:s})=>{let c=Rf(),{returnToDictionaryList:l}=F(`dictionary-field-editor`),{focusedContent:u,setFocusedContent:d}=Ff(),{setLocaleDictionary:f}=Mf(),[p,m]=(0,z.useState)(`content`);return(0,z.useEffect)(()=>{d({...u??{},dictionaryKey:e.key,dictionaryLocalId:e.localId}),f(e)},[]),(0,H.jsx)(Tm,{availableLocales:c?.internationalization?.locales??[],children:(0,H.jsxs)(`div`,{className:`relative flex h-full min-h-0 w-full flex-1 flex-col md:overflow-hidden`,children:[o&&(0,H.jsx)(M,{onClick:t,variant:`hoverable`,className:`z-10 mr-auto mb-6 ml-5 shrink-0`,color:`text`,Icon:Ks,label:l.label.value,children:l.text}),(0,H.jsxs)(`div`,{className:`mb-22 flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`sticky top-0 z-10 flex shrink-0 gap-3 rounded-xl bg-background/20 p-3 pb-4`,children:[(0,H.jsx)(Ge,{selectedChoice:p,tabs:[...r.includes(`remote`)?[(0,H.jsx)(`button`,{className:`cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none`,"data-active":p===`details`,onClick:()=>m(`details`),type:`button`,children:`Details`},`details`)]:[],(0,H.jsx)(`button`,{className:`cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none`,"data-active":p===`structure`,onClick:()=>m(`structure`),type:`button`,children:`Structure`},`structure`),(0,H.jsx)(`button`,{className:`cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none`,"data-active":p===`content`,onClick:()=>m(`content`),type:`button`,children:`Content`},`content`),(0,H.jsx)(`button`,{className:`cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none`,"data-active":p===`json`,onClick:()=>m(`json`),type:`button`,children:`JSON`},`json`)],hoverable:!0,color:`text`}),(0,H.jsx)(`div`,{className:`flex w-full items-center justify-end`,children:s})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,H.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col items-stretch gap-6`,children:[r.includes(`remote`)&&p===`details`&&(0,H.jsx)(jO,{dictionary:e,mode:r}),p===`structure`&&(0,H.jsx)(VO,{dictionary:e}),p===`content`&&(0,H.jsx)(pO,{dictionary:e}),p===`json`&&(0,H.jsx)(PO,{dictionary:e,isDarkMode:n})]})})]}),(0,H.jsx)(`div`,{className:`absolute bottom-3 z-20 w-full p-2`,children:(0,H.jsxs)(Ne,{color:`card`,roundedSize:`2xl`,padding:`sm`,className:`w-full shrink-0 flex-row flex-wrap items-center justify-end gap-10 bg-background/20 md:bottom-0`,children:[(0,H.jsx)(yO,{text:e.id,className:`text-nowrap text-muted-foreground text-sm`,size:9,children:e.id}),(0,H.jsx)(_O,{dictionary:e,mode:r,onDelete:()=>{d(null),i?.()},onSave:a})]})})]})})},UO=new class{listeners=new Set;drawers={};subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.drawers;isOpen=e=>!!this.drawers[e];open=e=>{this.drawers[e]||(this.drawers={...this.drawers,[e]:!0},this.emit())};close=e=>{this.drawers[e]&&(this.drawers={...this.drawers,[e]:!1},this.emit())};set=e=>{let t=!1,n={...this.drawers};for(let[r,i]of Object.entries(e))n[r]!==i&&(n[r]=i,t=!0);t&&(this.drawers=n,this.emit())};emit=()=>{this.listeners.forEach(e=>{e()})}},WO={open:UO.open,close:UO.close,set:UO.set},GO=()=>!1,KO=()=>WO,qO=e=>{let t=(0,V.c)(2),n;t[0]===e?n=t[1]:(n=()=>UO.isOpen(e),t[0]=e,t[1]=n);let r=n;return(0,z.useSyncExternalStore)(UO.subscribe,r,GO)},JO=()=>{let e=(0,V.c)(2),t=(0,z.useSyncExternalStore)(UO.subscribe,UO.getSnapshot,YO),n;return e[0]===t?n=e[1]:(n={...WO,isOpen:e=>!!t[e]},e[0]=t,e[1]=n),n};function YO(){return{}}var XO=e=>{switch(e){case`xs`:return 480;case`sm`:return 640;case`md`:return 768;case`lg`:return 1024;case`xl`:return 1280;case`2xl`:return 1536;default:return e}},ZO=()=>{if(typeof window>`u`)return;let e=window.navigator?.userAgent;if(e!==void 0)return/android|bb\d+|meego|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(?:hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(?:ob|in)i|palm(?: os)?|phone|p(?:ixi|re)\/|plucker|pocket|psp|series(?:4|6)0|symbian|treo|up\.(?:browser|link)|vodafone|wap|windows ce|windows phone|xda|xiino|zte-/i.test(e)},QO=()=>{if(typeof window>`u`)return;let e=window.navigator?.userAgent;if(e!==void 0)return/iP(?:hone|ad|od)/.test(e)},$O=()=>{if(typeof window>`u`)return;let e=window.navigator?.userAgent;if(e!==void 0)return/Macintosh|MacIntel|Mac OS X/.test(e)},ek=e=>{let t=(0,V.c)(4),n=e===void 0?`md`:e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={isMobileScreen:void 0,isMobileUserAgent:void 0,isMobile:void 0,isIOS:void 0,isMac:void 0},t[0]=r):r=t[0];let[i,a]=(0,z.useState)(r),o,s;return t[1]===n?(o=t[2],s=t[3]):(o=()=>{let e=XO(n),t=window.matchMedia(`(max-width: ${e}px)`),r=ZO(),i=QO(),o=$O(),s=e=>a({isMobileScreen:e,isMobileUserAgent:r,isMobile:e,isIOS:i,isMac:o});s(t.matches);let c=e=>s(e.matches);return t.addEventListener(`change`,c),()=>t.removeEventListener(`change`,c)},s=[n],t[1]=n,t[2]=o,t[3]=s),(0,z.useEffect)(o,s),i},tk=e=>e.split(` + `).map(e=>e.trim()),nk=e=>({"⌘":`Meta`,Ctrl:`Control`,Control:`Control`,Alt:`Alt`,"⌥":`Alt`,Shift:`Shift`,Meta:`Meta`,"↑":`ArrowUp`,"↓":`ArrowDown`,"←":`ArrowLeft`,"→":`ArrowRight`,ArrowUp:`ArrowUp`,ArrowDown:`ArrowDown`,ArrowLeft:`ArrowLeft`,ArrowRight:`ArrowRight`})[e]||e,rk=(e,t)=>{let n=t.map(nk),r={Meta:n.includes(`Meta`),Control:n.includes(`Control`),Alt:n.includes(`Alt`),Shift:n.includes(`Shift`)};if(r.Meta!==e.metaKey||r.Control!==e.ctrlKey||r.Alt!==e.altKey||r.Shift!==e.shiftKey)return!1;let i=t.find(e=>![`⌘`,`Ctrl`,`Control`,`Alt`,`⌥`,`Shift`,`Meta`].includes(nk(e)));if(!i)return!1;let a=nk(i);return a.startsWith(`Arrow`)?e.key===a:e.key.toLowerCase()===a.toLowerCase()},ik=e=>({ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`})[e]||e,ak=(e,t)=>{let n=e;return t?(n=n.replace(/Ctrl/g,`⌘`),n=n.replace(/Alt/g,`⌥`)):(n=n.replace(/⌘/g,`Ctrl`),n=n.replace(/⌥/g,`Alt`)),n=n.replace(/ArrowUp/g,`↑`),n=n.replace(/ArrowDown/g,`↓`),n=n.replace(/ArrowLeft/g,`←`),n=n.replace(/ArrowRight/g,`→`),n},ok=({shortcut:e,onTriggered:t,display:n=!0,disabled:r=!1,className:i,size:a=`md`})=>{let{isMac:o}=ek(),s=tk(ak(e,o??!1)),[c,l]=(0,z.useState)(new Set);if((0,z.useEffect)(()=>{let e=e=>{let n=e.target,i=n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.isContentEditable,a=e.key,c=new Set;if(e.metaKey&&c.add(`⌘`),e.ctrlKey&&c.add(`Ctrl`),e.altKey&&c.add(o?`⌥`:`Alt`),e.shiftKey&&c.add(`Shift`),a.startsWith(`Arrow`)?(c.add(a),c.add(ik(a))):c.add(a.toUpperCase()),l(c),!r&&t&&rk(e,s)){let n=s.includes(`Escape`);if(i&&!n)return;e.preventDefault(),t()}},n=()=>{l(new Set)};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,n),window.addEventListener(`blur`,n),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,n),window.removeEventListener(`blur`,n)}},[s,t,o,r]),!n)return null;let u=e=>{let t=e.toUpperCase(),n=nk(e);return c.has(e)||c.has(t)||c.has(n)||e===`⌘`&&c.has(`Meta`)||e===`Ctrl`&&c.has(`Control`)||e===`⌥`&&c.has(`Alt`)||e===`Alt`&&c.has(`Alt`)||e===`←`&&c.has(`ArrowLeft`)||e===`→`&&c.has(`ArrowRight`)||e===`↑`&&c.has(`ArrowUp`)||e===`↓`&&c.has(`ArrowDown`)};return(0,H.jsx)(`kbd`,{className:R(`inline-flex items-center justify-center gap-0.5 p-0.5`,`rounded-lg [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-xl`,`font-medium font-sans`,`border-1 text-neutral`,a===`sm`&&`text-xs`,a===`md`&&`text-sm`,a===`lg`&&`text-base`,i),children:s.map((t,n)=>{let r=`${t}-${n}-${e}`,i=ik(t);return(0,H.jsxs)(`span`,{className:`inline-flex items-center`,children:[n>0&&(0,H.jsx)(`span`,{className:`text-neutral/50`,children:`+`}),(0,H.jsx)(`span`,{className:R(`min-w-4 px-0.5 text-center`,u(t)&&`scale-120 font-bold text-foreground`),suppressHydrationWarning:!0,children:i})]},r)})})},sk=({children:e,isHidden:t,minWidth:n=0,align:r=`left`,isDisabled:i=!1,className:a,...o})=>{let s=t&&!i;return(0,H.jsx)(`div`,{className:R(`relative grid h-full grid-cols-[0fr] overflow-x-hidden overflow-y-hidden transition-[grid-template-columns] duration-500 ease-in-out`,s?``:`grid-cols-[1fr]`,a),"aria-hidden":s,inert:s?!0:void 0,...o,children:(0,H.jsx)(`div`,{style:{minWidth:`${n}px`},className:R(r===`right`&&`ml-auto`),children:e})})},ck=e=>{let t=e.getBoundingClientRect(),n=t.top,r=t.bottom-1;if(n>=0&&r<=window.innerHeight){let n=t.left+t.width/2,r=t.top+10,i=document.elementFromPoint(n,r);return e===i||e.contains(i)}return!1},lk=({title:e,identifier:t,children:n,header:r,footer:i,closeOnOutsideClick:a=!0,backButton:o,isOpen:s,onClose:c,container:l})=>{let u=F(`right-drawer`),{isMobile:d}=ek(`md`),f=(0,z.useRef)(null),p=(0,z.useRef)(null),m=Te(l),{open:h,close:g}=KO(),_=qO(t),v=_,[y,b]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!v){b(!1);return}let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>b(!0))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}},[v]);let x=v&&y;xe({disableScroll:v,key:t?`right_drawer_${t}`:`right_drawer`}),(0,z.useEffect)(()=>{if(!v)return;let e=e=>{try{if(!f.current)return;let n=a,r=e.target&&!f.current.contains(e.target),i=ck(f.current);(n&&r&&i||!e.target)&&(g(t),c?.())}catch{g(t),c?.()}};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[v,g,c,a,t]);let S=(0,z.useRef)(c);return(0,z.useEffect)(()=>{S.current=c},[c]),(0,z.useEffect)(()=>{s!==void 0&&s!==_&&(s?h(t):(g(t),S.current?.()))},[s,_,t,h,g]),m?(0,Xo.createPortal)((0,H.jsx)(`div`,{className:`fixed top-0 right-0 z-50 flex h-full justify-end`,children:(0,H.jsx)(sk,{isHidden:!x,align:`right`,children:(0,H.jsxs)(Ne,{className:`relative flex h-screen w-screen flex-col border-l text-foreground md:w-100`,ref:f,roundedSize:`none`,borderColor:`neutral`,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3 px-6 pt-6`,children:[(0,H.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,H.jsx)(`div`,{children:o&&(0,H.jsx)(M,{variant:`hoverable`,color:`text`,label:o.text??u.goBack.value,onClick:o.onBack,Icon:Js,children:o?.text})}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(Ye,{identifier:`close-drawer`,children:[(0,H.jsx)(M,{variant:`hoverable`,color:`text`,label:`Close`,className:`ml-auto`,onClick:()=>{g(t),c?.()},Icon:pe,size:`icon-md`}),(0,H.jsx)(Ye.Detail,{identifier:`close-drawer`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[(0,H.jsx)(`span`,{className:`whitespace-nowrap text-muted-foreground text-xs`,children:u.closeDrawer}),(0,H.jsx)(ok,{shortcut:`Escape`,size:`sm`,onTriggered:()=>{g(t),c?.()}})]})})]})})]}),e&&(0,H.jsx)(`h2`,{className:`flex items-center justify-center font-bold text-lg`,children:e}),r]}),(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto p-2`,children:(0,H.jsx)(`div`,{className:`flex flex-1 flex-col outline-none`,onClick:e=>{e.target===e.currentTarget&&d&&(g(t),c?.())},onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d&&(g(t),c?.()))},ref:p,role:`button`,tabIndex:0,children:n})}),i&&(0,H.jsx)(`div`,{className:`shrink-0`,children:i})]})})}),m):(0,H.jsx)(H.Fragment,{})},uk=Ze(`w-fit backdrop-blur`,{variants:{roundedSize:{none:`rounded-none`,sm:`rounded-sm`,md:`rounded-md`,lg:`rounded-lg`,xl:`rounded-xl`,xxl:`rounded-2xl`,xxxl:`rounded-3xl`,full:`rounded-full`},color:{primary:`border-primary bg-primary/10 text-primary`,success:`border-success bg-success/10 text-success`,error:`border-error bg-error/10 text-error`,warning:`border-warning bg-warning/10 text-warning`,neutral:`/10 border-neutral bg-neutral/10 text-neutral`,text:`border-text bg-text/10 text-foreground`,black:`border-black bg-black/10 text-black`,white:`border-white bg-white/10 text-white`},size:{xs:`border-[1.2px] px-2 py-0.5 text-xs`,sm:`border-[1.3px] px-2 py-0.5 text-sm`,md:`border-2 px-2 py-1 text-base`,lg:`border-2 px-3 py-2 text-lg`,xl:`border-2 px-3 py-2 text-xl`},border:{none:`border-none`,with:`border-[1.3px] border-text`},background:{none:`bg-none`,with:``}},defaultVariants:{roundedSize:`full`,border:`none`,color:`text`,size:`md`}}),dk=({children:e,color:t,roundedSize:n,size:r,border:i,background:a,className:o,...s})=>(0,H.jsx)(`div`,{className:uk({color:t,roundedSize:n,size:r,border:i,background:a,className:o}),...s,children:e}),fk=`dictionaryList`,pk=e=>`dictionary_edition_${e}`,mk=e=>{let t=(0,V.c)(23),n;t[0]===e?n=t[1]:(n=pk(e),t[0]=e,t[1]=n);let r=n,{isOpen:i,open:a,close:o}=JO(),{getEditedContentValue:s}=zf(),{focusedContent:c,setFocusedContent:l}=Ff(),u;t[2]!==c?.dictionaryKey||t[3]!==r||t[4]!==a?(u=()=>{c?.dictionaryKey&&a(r)},t[2]=c?.dictionaryKey,t[3]=r,t[4]=a,t[5]=u):u=t[5];let d=c?.dictionaryKey,f;t[6]!==r||t[7]!==a||t[8]!==d?(f=[d,a,r],t[6]=r,t[7]=a,t[8]=d,t[9]=f):f=t[9],(0,z.useEffect)(u,f);let p;t[10]!==i||t[11]!==r?(p=i(r),t[10]=i,t[11]=r,t[12]=p):p=t[12];let m;t[13]!==o||t[14]!==c||t[15]!==r||t[16]!==l?(m=()=>{o(r),c?.dictionaryKey&&l({...c,keyPath:[]})},t[13]=o,t[14]=c,t[15]=r,t[16]=l,t[17]=m):m=t[17];let h;return t[18]!==c||t[19]!==s||t[20]!==p||t[21]!==m?(h={isOpen:p,focusedContent:c,getEditedContentValue:s,close:m},t[18]=c,t[19]=s,t[20]=p,t[21]=m,t[22]=h):h=t[22],h},hk=e=>{let t=(0,V.c)(77),{dictionaryKey:n,isDarkMode:r}=e,{backButtonText:i,openDictionaryEditor:a,modalTitle:o,noDictionaryFocused:s,focusedDictionaryNotFound:c}=Vt(Pc),l;t[0]===n?l=t[1]:(l=pk(n),t[0]=n,t[1]=l);let u=l,{focusedContent:d,close:f}=mk(n),{setFocusedContent:p}=Ff(),{open:m}=JO(),h;t[2]===m?h=t[3]:(h=()=>m(fk),t[2]=m,t[3]=h);let g=h,{data:_}=fp(),v;t[4]!==f||t[5]!==g||t[6]!==p?(v=()=>{f(),p(null),g()},t[4]=f,t[5]=g,t[6]=p,t[7]=v):v=t[7];let y=v,[b,x]=(0,z.useState)(!1),S;t[8]===y?S=t[9]:(S=()=>{x(!1),y()},t[8]=y,t[9]=S);let C=S;if(!d?.dictionaryKey){let e;return t[10]===s?e=t[11]:(e=(0,H.jsx)(`span`,{className:`mx-auto my-10 text-neutral text-sm`,children:s}),t[10]=s,t[11]=e),e}let w,T,E,D,O,k,ee,A,j,te;if(t[12]!==i||t[13]!==f||t[14]!==d||t[15]!==c||t[16]!==y||t[17]!==u||t[18]!==a||t[19]!==p||t[20]!==_){O=Symbol.for(`react.early_return_sentinel`);bb0:{if(T=_?.[d.dictionaryKey]?.find(e=>e.localId===d?.dictionaryLocalId),!T){let e;t[31]===c?e=t[32]:(e=(0,H.jsx)(`span`,{className:`mx-auto my-10 text-neutral text-sm`,children:c}),t[31]=c,t[32]=e),O=e;break bb0}w=lk,te=u,t[33]!==i.value||t[34]!==y?(E={onBack:y,text:i.value},t[33]=i.value,t[34]=y,t[35]=E):E=t[35],t[36]!==f||t[37]!==p?(D=()=>{f(),p(null)},t[36]=f,t[37]=p,t[38]=D):D=t[38];let e;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>x(!0),t[39]=e):e=t[39];let n;t[40]===a.label.value?n=t[41]:(n=(0,H.jsx)(M,{variant:`hoverable`,color:`text`,size:`icon-md`,IconRight:ec,label:a.label.value,onClick:e}),t[40]=a.label.value,t[41]=n);let r;t[42]===a.popoverContent?r=t[43]:(r=(0,H.jsx)(Ye.Detail,{identifier:`open-dictionary-editor`,children:(0,H.jsx)(`span`,{className:`whitespace-nowrap p-2 text-neutral text-xs`,children:a.popoverContent})}),t[42]=a.popoverContent,t[43]=r);let o;t[44]!==n||t[45]!==r?(o=(0,H.jsxs)(Ye,{identifier:`open-dictionary-editor`,children:[n,r]}),t[44]=n,t[45]=r,t[46]=o):o=t[46],j=(0,H.jsxs)(`header`,{className:`mb-5 flex w-full px-3`,children:[(0,H.jsx)(`h3`,{className:`w-full text-center text-lg`,children:T.title?T.title:T.key}),o]}),k=`flex flex-wrap items-center justify-center gap-x-4 gap-y-2 border-text/20 border-b border-dotted pb-3`,ee=(0,H.jsx)(dk,{color:`text`,roundedSize:`full`,size:`xs`,children:T.key}),A=T.filePath&&(0,H.jsx)(dk,{color:`blue`,roundedSize:`full`,size:`xs`,children:T.filePath.split(`/`).pop()})}t[12]=i,t[13]=f,t[14]=d,t[15]=c,t[16]=y,t[17]=u,t[18]=a,t[19]=p,t[20]=_,t[21]=w,t[22]=T,t[23]=E,t[24]=D,t[25]=O,t[26]=k,t[27]=ee,t[28]=A,t[29]=j,t[30]=te}else w=t[21],T=t[22],E=t[23],D=t[24],O=t[25],k=t[26],ee=t[27],A=t[28],j=t[29],te=t[30];if(O!==Symbol.for(`react.early_return_sentinel`))return O;let N;t[47]===T.id?N=t[48]:(N=T.id&&(0,H.jsx)(dk,{color:`purple`,roundedSize:`full`,size:`xs`,children:`remote`}),t[47]=T.id,t[48]=N);let P;t[49]!==N||t[50]!==k||t[51]!==ee||t[52]!==A?(P=(0,H.jsxs)(`div`,{className:k,children:[ee,A,N]}),t[49]=N,t[50]=k,t[51]=ee,t[52]=A,t[53]=P):P=t[53];let ne;t[54]!==P||t[55]!==j?(ne=(0,H.jsxs)(H.Fragment,{children:[j,P]}),t[54]=P,t[55]=j,t[56]=ne):ne=t[56];let re;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(re=[`local`,`remote`],t[57]=re):re=t[57];let ie;t[58]!==T||t[59]!==y?(ie=(0,H.jsx)(_O,{dictionary:T,mode:re,className:`mb-4 flex-col px-3`,onDelete:y}),t[58]=T,t[59]=y,t[60]=ie):ie=t[60];let F;t[61]!==T||t[62]!==b||t[63]!==d||t[64]!==y||t[65]!==r||t[66]!==o||t[67]!==C?(F=d&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(je,{isOpen:b,onClose:()=>x(!1),hasCloseButton:!0,title:o,size:`xl`,transparency:`lg`,className:`h-full`,children:(0,H.jsx)(`div`,{className:`flex h-full min-h-0 w-full flex-1 flex-col px-3 pt-5`,children:(0,H.jsx)(HO,{dictionary:T,onClickDictionaryList:C,isDarkMode:r,mode:[`local`,`remote`],onDelete:()=>{x(!1),y()},onSave:()=>{x(!1)}})})}),(0,H.jsx)(Qp,{dictionary:T})]}),t[61]=T,t[62]=b,t[63]=d,t[64]=y,t[65]=r,t[66]=o,t[67]=C,t[68]=F):F=t[68];let I;return t[69]!==w||t[70]!==E||t[71]!==D||t[72]!==ne||t[73]!==ie||t[74]!==F||t[75]!==te?(I=(0,H.jsx)(w,{identifier:te,backButton:E,onClose:D,header:ne,footer:ie,children:F}),t[69]=w,t[70]=E,t[71]=D,t[72]=ne,t[73]=ie,t[74]=F,t[75]=te,t[76]=I):I=t[76],I},gk=e=>{let t=(0,V.c)(4),{isDarkMode:n}=e,{focusedContent:r}=Ff(),i=r?.dictionaryKey;if(!i){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(H.Fragment,{}),t[0]=e):e=t[0],e}let a;return t[1]!==i||t[2]!==n?(a=(0,H.jsx)(hk,{dictionaryKey:i,isDarkMode:n}),t[1]=i,t[2]=n,t[3]=a):a=t[3],a},_k={key:`dictionary-list-drawer`,content:{nodeType:`translation`,translation:{en:{drawerTitle:{label:`Dictionary list`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Open dictionary editor {{dictionaryLocalId}}`}}},"en-GB":{drawerTitle:{label:`Dictionary list`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Open dictionary editor {{dictionaryLocalId}}`}}},fr:{drawerTitle:{label:`Liste des dictionnaires`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Ouvrir le dictionnaire dans l'éditeur {{dictionaryLocalId}}`}}},es:{drawerTitle:{label:`Lista de diccionarios`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Abrir el diccionario en el editor {{dictionaryLocalId}}`}}},de:{drawerTitle:{label:`Wörterbuchliste`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Wörterbuch-Editor öffnen {{dictionaryLocalId}}`}}},ja:{drawerTitle:{label:`辞書リスト`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`辞書エディタを開く {{dictionaryLocalId}}`}}},ko:{drawerTitle:{label:`사전 목록`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`사전 편집기 열기 {{dictionaryLocalId}}`}}},zh:{drawerTitle:{label:`字典列表`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`打开字典编辑器 {{dictionaryLocalId}}`}}},it:{drawerTitle:{label:`Lista dei dizionari`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Apri editor dizionario {{dictionaryLocalId}}`}}},pt:{drawerTitle:{label:`Lista de dicionários`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Abrir editor de dicionário {{dictionaryLocalId}}`}}},hi:{drawerTitle:{label:`शब्दकोश सूची`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`शब्दकोश संपादक खोलें {{dictionaryLocalId}}`}}},ar:{drawerTitle:{label:`قائمة القواميس`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`فتح محرر القاموس {{dictionaryLocalId}}`}}},ru:{drawerTitle:{label:`Список словарей`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Открыть редактор словаря {{dictionaryLocalId}}`}}}}},location:`local`,localId:`dictionary-list-drawer::local::client/src/components/Editor/DictionaryListDrawer/dictionaryListDrawer.content.ts`,filePath:`client/src/components/Editor/DictionaryListDrawer/dictionaryListDrawer.content.ts`},vk=e=>{let{minChars:t=3,debounceMs:n=300,trim:r=!0,defaultValue:i,onSearch:a,onClear:o}=e??{},s=(0,z.useRef)(``),c=(0,z.useRef)(null),[l,u]=(0,z.useState)(i??``),d=()=>{c.current&&=(clearTimeout(c.current),null)};return(0,z.useEffect)(()=>()=>{d()},[]),{setSearch:e=>{s.current=e;let i=r?e.trim():e;if(d(),i.length<t){u(``),o?.();return}c.current=setTimeout(()=>{let e=r?s.current.trim():s.current;e.length>=t?(u(e),a?.(e)):(u(``),o?.())},n)},search:l,hasMinChars:l.length>=t}},yk=({className:e,...t})=>(0,H.jsxs)(`div`,{className:`relative flex w-full items-center gap-1`,children:[(0,H.jsx)(ac,{className:`absolute left-2 size-4`}),(0,H.jsx)(Ap,{...t,type:`search`,className:R(`pl-8`,e)})]}),bk=()=>{let{drawerTitle:e,buttonLabel:t}=Vt(_k),{set:n}=JO(),{localeDictionaries:r}=jf(),{editedContent:i}=Bf(),{setFocusedContent:a}=Ff(),{setSearch:o,search:s}=vk(),c=(0,z.useMemo)(()=>new eO(Object.values(r),{keys:[`key`,`title`,`filePath`,`description`,`tags`],threshold:.3,includeScore:!0}),[r]),l=(0,z.useMemo)(()=>!s||s.trim()===``?Object.values(r):c.search(s).map(e=>e.item),[s,c,r]),u=e=>{a({dictionaryKey:e.key,dictionaryLocalId:e.localId,keyPath:[]}),n({[fk]:!1,[pk(e.key)]:!0})},d=e=>Object.keys(i??{}).includes(e);return(0,H.jsxs)(lk,{title:e.label.value,identifier:fk,children:[(0,H.jsx)(`div`,{className:`p-3 pb-4`,children:(0,H.jsx)(yk,{placeholder:`Search dictionaries`,onChange:e=>o(e.target.value),type:`search`})}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-1`,children:l.map(e=>(0,H.jsx)(`li`,{className:`w-full`,children:(0,H.jsx)(M,{label:t.label({dictionaryLocalId:e.localId}).value,onClick:()=>u(e),variant:`hoverable`,color:`text`,IconRight:Ys,size:`md`,isFullWidth:!0,Icon:d(e.localId)?tc:void 0,children:(0,H.jsx)(`div`,{className:`flex items-center gap-2 py-1`,children:(0,H.jsxs)(`div`,{className:`flex max-w-full flex-col gap-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-1.5`,children:[(0,H.jsx)(dk,{color:`text`,roundedSize:`full`,size:`xs`,children:e.key}),e.filePath&&(0,H.jsx)(dk,{color:`blue`,roundedSize:`full`,size:`xs`,children:e.filePath.split(`/`).pop()}),e.id&&(0,H.jsx)(dk,{color:`purple`,roundedSize:`full`,size:`xs`,children:`remote`})]}),(0,H.jsx)(`span`,{children:(e.title??``).length>0?e.title:e.key})]})})})},e.localId))})]})},xk={key:`long-press-message`,content:{nodeType:`translation`,translation:{en:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Long press to edit the "{{dictionaryKey}}" dictionary`}},"en-GB":{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Long press to edit the "{{dictionaryKey}}" dictionary`}},fr:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Long press pour éditer le dictionnaire "{{dictionaryKey}}"`}},es:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Presiona largo para editar el diccionario "{{dictionaryKey}}"`}},de:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Lang press für Bearbeitung des Wörterbuchs "{{dictionaryKey}}"`}},ja:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`長押しして編集 "{{dictionaryKey}}" 辞書`}},ko:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`길게 눌러 편집 "{{dictionaryKey}}" 사전`}},zh:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`长按编辑 "{{dictionaryKey}}" 字典`}},it:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Premi a lungo per modificare il dizionario "{{dictionaryKey}}"`}},pt:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Pressione longa para editar o dicionário "{{dictionaryKey}}"`}},hi:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`लंग प्रेस करें टू एडिट "{{dictionaryKey}}"`}},ar:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`اضغط طويلاً للتعديل "{{dictionaryKey}}"`}},ru:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Длительное нажатие для редактирования словаря "{{dictionaryKey}}"`}}}},location:`local`,localId:`long-press-message::local::client/src/components/Editor/LongPressMessage/index.content.ts`,filePath:`client/src/components/Editor/LongPressMessage/index.content.ts`},Sk=()=>{let e=(0,V.c)(8),{message:t}=Vt(xk),[n]=kf(Rd.INTLAYER_HOVERED_CONTENT_CHANGED,null),r=n?.dictionaryKey?`opacity-100`:`opacity-0`,i;e[0]===r?i=e[1]:(i=R(`rounded-2xl bg-neutral/30 px-3 py-1 font-bold text-sm text-text transition-opacity duration-100`,r),e[0]=r,e[1]=i);let a;e[2]!==n||e[3]!==t?(a=n?.dictionaryKey?t({dictionaryKey:n.dictionaryKey}):``,e[2]=n,e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=(0,H.jsx)(`div`,{className:i,children:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o},Ck=e=>{let t=(0,V.c)(5),{children:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,H.jsx)(`div`,{className:`absolute right-2 bottom-2`,children:(0,H.jsx)(Sk,{})}),i=(0,H.jsx)(gk,{}),a=(0,H.jsx)(bk,{}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,H.jsxs)(`div`,{className:`relative size-full bg-card p-3`,children:[n,r,i,a]}),t[3]=n,t[4]=o),o},wk=()=>{let e=(0,V.c)(2),[t,n]=(0,z.useState)(),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{fetch(`/api/config`).then(Tk).then(e=>n(e.data))},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,z.useEffect)(r,i),t};function Tk(e){return e.json()}var Ek=e=>{let t=(0,V.c)(11),{children:n,iframeRef:r}=e,i=wk(),a=i?.editor.applicationURL;if(!i){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(m,{}),t[0]=e):e=t[0],e}let o;t[1]!==a||t[2]!==r?(o=e=>{r.current?.contentWindow?.postMessage(e,a)},t[1]=a,t[2]=r,t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=[a],t[4]=a,t[5]=s);let c;return t[6]!==n||t[7]!==i||t[8]!==o||t[9]!==s?(c=(0,H.jsx)(If,{postMessage:o,allowedOrigins:s,configuration:i,children:n}),t[6]=n,t[7]=i,t[8]=o,t[9]=s,t[10]=c):c=t[10],c},Dk={key:`iframe-controller`,content:{nodeType:`translation`,translation:{en:{intlayerApplication:`Intlayer Application`,enableEditor:`Enable Editor`},"en-GB":{intlayerApplication:`Intlayer Application`,enableEditor:`Enable Editor`},fr:{intlayerApplication:`Application Intlayer`,enableEditor:`Activer l'éditeur`},es:{intlayerApplication:`Aplicación Intlayer`,enableEditor:`Activar el editor`},de:{intlayerApplication:`Intlayer-Anwendung`,enableEditor:`Editor aktivieren`},ja:{intlayerApplication:`Intlayerアプリケーション`,enableEditor:`エディタを有効にする`},ko:{intlayerApplication:`Intlayer 애플리케이션`,enableEditor:`에디터 활성화`},zh:{intlayerApplication:`Intlayer 应用程序`,enableEditor:`启用编辑器`},it:{intlayerApplication:`Applicazione Intlayer`,enableEditor:`Abilita l'editor`},pt:{intlayerApplication:`Aplicativo Intlayer`,enableEditor:`Ativar editor`},hi:{intlayerApplication:`इंटलेयर एप्लिकेशन`,enableEditor:`संपादक सक्षम करें`},ar:{intlayerApplication:`تطبيق Intlayer`,enableEditor:`تفعيل المحرر`},ru:{intlayerApplication:`Приложение Intlayer`,enableEditor:`Включить редактор`}}},location:`local`,localId:`iframe-controller::local::client/src/components/Editor/iframeController.content.ts`,filePath:`client/src/components/Editor/iframeController.content.ts`},Ok=()=>{let e=(0,V.c)(9),{editedContent:t,setEditedContentState:n}=Bf(),r;e[0]===n?r=e[1]:(r=()=>{let e=localStorage?.getItem(`INTLAYER_EDITED_CONTENT_CHANGED`);if(e)try{let t=JSON.parse(e);n(t)}catch(e){console.error(e)}},e[0]=n,e[1]=r);let i=r,a,o;e[2]===t?(a=e[3],o=e[4]):(a=()=>{t!==void 0&&localStorage?.setItem(`INTLAYER_EDITED_CONTENT_CHANGED`,JSON.stringify(t))},o=[t],e[2]=t,e[3]=a,e[4]=o),(0,z.useEffect)(a,o);let s;e[5]!==t||e[6]!==i?(s=()=>{t===void 0&&i()},e[5]=t,e[6]=i,e[7]=s):s=e[7];let c;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],e[8]=c):c=e[8],(0,z.useEffect)(s,c),i},kk={key:`no-application-url-view`,content:{nodeType:`translation`,translation:{en:{title:`Your project configuration do not includes application URL`,description:`To use the editor, you need to add the URL of the application to access to the configuration file.`,documentationLink:{label:`Click to go to the editor documentation`,text:`See how to configure the editor`}},"en-GB":{title:`Your project configuration do not includes application URL`,description:`To use the editor, you need to add the URL of the application to access to the configuration file.`,documentationLink:{label:`Click to go to the editor documentation`,text:`See how to configure the editor`}},fr:{title:`Votre configuration de projet ne comprend pas l’URL de l’application`,description:`Pour utiliser l’éditeur, vous devez ajouter l’URL de l’application pour accéder au fichier de configuration.`,documentationLink:{label:`Cliquez ici pour accéder à la documentation de l’éditeur`,text:`Voir comment configurer l’éditeur`}},es:{title:`Su configuración de proyecto no incluye la URL de la aplicación`,description:`Para usar el editor, debe agregar la URL de la aplicación para acceder al archivo de configuración.`,documentationLink:{label:`Haga clic aquí para acceder a la documentación del editor`,text:`Vea cómo configurar el editor`}},de:{title:`Ihre Projektkonfiguration enthält keine Anwendungs-URL`,description:`Um den Editor zu verwenden, müssen Sie die URL der Anwendung hinzufügen, um auf die Konfigurationsdatei zuzugreifen.`,documentationLink:{label:`Klicken Sie hier, um die Editor-Dokumentation zu besuchen`,text:`Siehe, wie man den Editor konfiguriert`}},ja:{title:`あなたのプロジェクト構成にはアプリケーション URL が含まれていません`,description:`エディターを使用するには、アプリケーションの URL を設定ファイルに追加する必要があります。`,documentationLink:{label:`エディターのドキュメントに移動するには、ここをクリックしてください`,text:`エディターの設定方法を見る`}},ko:{title:`당신의 프로젝트 구성에 앱 URL이 포함되어 있지 않습니다.`,description:`에디터를 사용하려면 설정 파일에 앱 URL을 추가해야 합니다.`,documentationLink:{label:`에디터 문서로 이동하려면 여기를 클릭하십시오.`,text:`에디터 설정 방법을 보십시오`}},zh:{title:`您的项目配置未包含应用程序 URL`,description:`要使用编辑器,您需要将应用程序 URL 添加到访问配置文件。`,documentationLink:{label:`点击此处访问编辑器文档`,text:`查看如何配置编辑器`}},it:{title:`La configurazione del progetto non include l’URL dell’applicazione`,description:`Per utilizzare l’editor, è necessario aggiungere l’URL dell’applicazione per accedere al file di configurazione.`,documentationLink:{label:`Fai clic qui per accedere alla documentazione dell’editor`,text:`Vedi come configurare l’editor`}},pt:{title:`Sua configuração do projeto não inclui a URL do aplicativo`,description:`Para usar o editor, você precisa adicionar a URL do aplicativo para acessar o arquivo de configuração.`,documentationLink:{label:`Clique aqui para acessar a documentação do editor`,text:`Veja como configurar o editor`}},hi:{title:`आपके प्रोजेक्ट कॉन्फ़िगरेशन में ऐप का URL शामिल नहीं है`,description:`एडिटर का उपयोग करने के लिए, आपको कॉन्फ़िगरेशन फ़ाइल तक ऐप का URL को जोड़ना होगा।`,documentationLink:{label:`एडिटर को डॉक्यूमेंट पर जाए रखना चाहते हैं?`,text:`एडिटर को काने के बारे में देखें`}},ar:{title:`تم إنشاء مشروعك بدون تضمين عنوان URL التطبيق`,description:`لاستخدام المحرر، يجب عليك إضافة عنوان URL التطبيق للوصول إلى ملف التكوين.`,documentationLink:{label:`انقر هنا للوصول إلى وثائق المحرر`,text:`انظر كيفية تكوين المحرر`}},ru:{title:`Ваша конфигурация проекта не включает URL-адрес приложения`,description:`Чтобы использовать редактор, вам необходимо добавить URL-адрес приложения для доступа к файлу конфигурации.`,documentationLink:{label:`Нажмите, чтобы перейти к документации редактора`,text:`Смотрите, как настроить редактор`}}}},location:`local`,localId:`no-application-url-view::local::client/src/components/Editor/NoApplicationURLView/noApplicationURLView.content.ts`,filePath:`client/src/components/Editor/NoApplicationURLView/noApplicationURLView.content.ts`},Ak=()=>{let e=(0,V.c)(11),{title:t,description:n,documentationLink:r}=Vt(kk),i;e[0]===t?i=e[1]:(i=(0,H.jsx)(qe,{className:`mb-8`,children:t}),e[0]=t,e[1]=i);let a;e[2]===n?a=e[3]:(a=(0,H.jsx)(`strong`,{className:`block text-neutral`,children:n}),e[2]=n,e[3]=a);let o;e[4]!==r.label.value||e[5]!==r.text?(o=(0,H.jsx)(Ve,{label:r.label.value,href:`https://intlayer.org/doc/concept/configuration#editor-configuration`,color:`text`,variant:`button`,className:`ml-auto`,isExternalLink:!0,children:r.text}),e[4]=r.label.value,e[5]=r.text,e[6]=o):o=e[6];let s;return e[7]!==i||e[8]!==a||e[9]!==o?(s=(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i,a,o]}),e[7]=i,e[8]=a,e[9]=o,e[10]=s):s=e[10],s},jk=e=>{let t=(0,V.c)(23),{iframeRef:n,applicationPath:r}=e,i=Vt(Dk),{editor:a}=Rf()??{},{enabled:o}=Vf(),s=Hf();Ok(),Wf();let[c,l]=(0,z.useState)(!0),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={receive:!0,emit:!1},t[0]=u):u=t[0];let[d]=Af(void 0,u),f,p;if(t[1]===d?(f=t[2],p=t[3]):(f=()=>{typeof d==`string`&&window.history.replaceState({},``,d)},p=[d],t[1]=d,t[2]=f,t[3]=p),(0,z.useEffect)(f,p),!a?.applicationURL){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(Ne,{className:`max-w-xl`,padding:`xl`,roundedSize:`2xl`,children:(0,H.jsx)(Ak,{})}),t[4]=e):e=t[4],e}let h;t[5]===c?h=t[6]:(h=(0,H.jsx)(m,{isLoading:c}),t[5]=c,t[6]=h);let g=`${a.applicationURL}${r}`,_=i.intlayerApplication.value,v=c&&`hidden`,y;t[7]===v?y=t[8]:(y=R(`size-full`,v),t[7]=v,t[8]=y);let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{l(!1)},t[9]=b):b=t[9];let x;t[10]!==i.intlayerApplication.value||t[11]!==n||t[12]!==g||t[13]!==y?(x=(0,H.jsx)(`iframe`,{src:g,title:_,sandbox:`allow-scripts allow-same-origin`,className:y,ref:n,onLoad:b}),t[10]=i.intlayerApplication.value,t[11]=n,t[12]=g,t[13]=y,t[14]=x):x=t[14];let S;t[15]!==i.enableEditor||t[16]!==o||t[17]!==s?(S=!o&&(0,H.jsx)(`div`,{className:`fixed right-4 bottom-4`,children:(0,H.jsx)(M,{label:i.enableEditor.value,onClick:s,color:`text`,children:i.enableEditor})}),t[15]=i.enableEditor,t[16]=o,t[17]=s,t[18]=S):S=t[18];let C;return t[19]!==x||t[20]!==S||t[21]!==h?(C=(0,H.jsxs)(`div`,{className:`relative size-full overflow-hidden rounded-lg`,children:[h,x,S]}),t[19]=x,t[20]=S,t[21]=h,t[22]=C):C=t[22],C},Mk=()=>{let e=(0,V.c)(2),t=(0,z.useRef)(null),n=gr(),r;return e[0]===n.pathname?r=e[1]:(r=(0,H.jsx)(Ek,{iframeRef:t,children:(0,H.jsx)(et,{disableEditor:!0,children:(0,H.jsx)(Ck,{children:(0,H.jsx)(jk,{iframeRef:t,applicationPath:n.pathname})})})}),e[0]=n.pathname,e[1]=r),r};(0,Ac.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(z.StrictMode,{children:(0,H.jsx)(()=>{let e=(0,V.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,H.jsx)(Nc,{children:(0,H.jsx)(Mc,{children:(0,H.jsx)(Mk,{})})}),e[0]=t):t=e[0],t},{})}));export{$h as a,Zi as c,sg as i,Ct as l,yg as n,cp as o,ag as r,oc as s,Og as t};
|
|
107
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function gw(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;gw(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var _w=new Set([`type`,`properties`,`required`,`additionalProperties`]),vw=[`oneOf`,`anyOf`];function yw(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function bw(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!_w.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??yw(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}gy(n,r,e.length===1?e[0]:bw(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=yw(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function xw(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of _w)if(t in e)return;let n=t.filter(e=>vw.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=bw(t);else{let e=n[0],i=vw.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>bw([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,uw(e,r))}function Sw(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):uw(i,s),uw(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())gw(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])xw(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}uw(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,gy(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Tw(t,`input`,e.processors),output:Tw(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Cw(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Cw(r.element,n);if(r.type===`set`)return Cw(r.valueType,n);if(r.type===`lazy`)return Cw(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Cw(r.innerType,n);if(r.type===`intersection`)return Cw(r.left,n)||Cw(r.right,n);if(r.type===`record`||r.type===`map`)return Cw(r.keyType,n)||Cw(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Cw(r.in,n)||Cw(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Cw(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Cw(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Cw(e,n))return!0;return!!(r.rest&&Cw(r.rest,n))}return!1}var ww=(e,t={})=>n=>{let r=dw({...n,processors:t});return pw(e,r),hw(r,e),Sw(r,e)},Tw=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=dw({...i??{},target:a,io:t,processors:n});return pw(e,o),hw(o,e),Sw(o,e)},Ew={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Dw=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ew[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ow=(e,t,n,r)=>{n.not={}},kw=(e,t,n,r)=>{let i=e._zod.def,a=uy(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Aw=(e,t,n,r)=>{fw(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},jw=(e,t,n,r)=>{fw(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Mw=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=pw(a.element,t,{...r,path:[...r.path,`items`]})};function Nw(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Nw(t.out):t.type===`catch`?Nw(t.innerType):e._zod.optin}var Pw=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&fw(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)gy(i.properties,e,pw(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?Nw(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=pw(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Fw=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>pw(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Iw=(e,t,n,r)=>{let i=e._zod.def,a=pw(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=pw(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Lw=(e,t,n,r)=>{let i=e._zod.def,a=pw(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Rw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},zw=Symbol();function Bw(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(fw(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),zw):JSON.parse(o)}var Vw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Bw(i.defaultValue,e,t,n,r);o!==zw&&(n.default=o)},Hw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Bw(i.defaultValue,e,t,n,r);o!==zw&&(n._prefault=o)},Uw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{fw(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Ww=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;pw(o,t,r);let s=t.seen.get(e);s.ref=o},Gw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Kw=(e,t,n,r)=>{let i=e._zod.def;pw(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},qw=new WeakSet([Object.prototype,Error.prototype]);function Jw(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Yw=Q(`ZodError`,(e,t)=>{xb.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);qw.has(n)||(qw.add(n),Jw(n,`format`,e=>t=>Tb(e,t)),Jw(n,`flatten`,e=>t=>wb(e,t)),Jw(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,fy,2)}),Jw(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,fy,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Xw=Db(Yw),Zw=Ob(Yw),Qw=kb(Yw),$w=jb(Yw),eT=Nb(Yw),tT=Pb(Yw),nT=Fb(Yw),rT=Ib(Yw),iT=Lb(Yw),aT=Rb(Yw),oT=zb(Yw),sT=Bb(Yw);function cT(){fb.localeError||pb(dC())}function lT(){fb.memoizer||pb({memoizer:cC()})}var uT=Q(`ZodType`,(e,t)=>(cT(),Mx.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(_y(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Dy(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(yE(e,t))},superRefine(e,t){return this.check(bE(e,t))},overwrite(e){return this.check(ew(e))},optional(){return tE(this)},exactOptional(){return rE(this)},nullable(){return aE(this)},nullish(){return tE(aE(this))},nonoptional(e){return dE(this,e)},array(){return UT(this)},or(e){return qT([this,e])},and(e){return YT(this,e)},transform(e){return hE(this,$T(e))},default(e){return sE(this,e)},prefault(e){return lE(this,e)},catch(e){return pE(this,e)},pipe(e){return hE(this,e)},readonly(){return _E(this)},describe(e){let t=this.clone();return hC.add(t,{description:e}),t},meta(...e){if(e.length===0)return hC.get(this);let t=this.clone();return hC.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Xy(this,`~standard`,{...Px(this),jsonSchema:{input:Tw(this,`input`),output:Tw(this,`output`)}})},set"~standard"(e){Yy(this,`~standard`,e)},parse:function e(t,n){return Xw(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Zw(this,t,n,{callee:e})},safeParse(e,t){return Qw(this,e,t)},async safeParseAsync(e,t){return $w(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Yy(this,`spa`,e)},encode:function e(t,n){return eT(this,t,n,{callee:e})},decode:function e(t,n){return tT(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await nT(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await rT(this,t,n,{callee:e})},safeEncode(e,t){return iT(this,e,t)},safeDecode(e,t){return aT(this,e,t)},async safeEncodeAsync(e,t){return oT(this,e,t)},async safeDecodeAsync(e,t){return sT(this,e,t)},toJSONSchema(e){return ww(this,{})(e)},get description(){return hC.get(this)?.description},get _def(){return this._zod.def}}),dT=Q(`_ZodString`,(e,t)=>{Fx.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dw(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(JC(...e))},includes(...e){return this.check(ZC(...e))},startsWith(...e){return this.check(QC(...e))},endsWith(...e){return this.check($C(...e))},min(...e){return this.check(KC(...e))},max(...e){return this.check(GC(...e))},length(...e){return this.check(qC(...e))},nonempty(...e){return this.check(KC(1,...e))},lowercase(e){return this.check(YC(e))},uppercase(e){return this.check(XC(e))},trim(){return this.check(nw())},normalize(...e){return this.check(tw(...e))},toLowerCase(){return this.check(rw())},toUpperCase(){return this.check(iw())},slugify(){return this.check(aw())}}),fT=Q(`ZodString`,(e,t)=>{Fx.init(e,t),dT.init(e,t)},{email(e){return this.check(_C(yT,e))},url(e){return this.check(CC(ST,e))},jwt(e){return this.check(RC(LT,e))},emoji(e){return this.check(wC(CT,e))},guid(e){return this.check(vC(bT,e))},uuid(e){return this.check(yC(xT,e))},uuidv4(e){return this.check(bC(xT,e))},uuidv6(e){return this.check(xC(xT,e))},uuidv7(e){return this.check(SC(xT,e))},nanoid(e){return this.check(TC(wT,e))},cuid(e){return this.check(EC(TT,e))},cuid2(e){return this.check(DC(ET,e))},ulid(e){return this.check(OC(DT,e))},base64(e){return this.check(FC(PT,e))},base64url(e){return this.check(IC(FT,e))},xid(e){return this.check(kC(OT,e))},ksuid(e){return this.check(AC(kT,e))},ipv4(e){return this.check(jC(AT,e))},ipv6(e){return this.check(MC(jT,e))},cidrv4(e){return this.check(NC(MT,e))},cidrv6(e){return this.check(PC(NT,e))},e164(e){return this.check(LC(IT,e))},datetime(e){return this.check(zC(hT,e))},date(e){return this.check(BC(gT,e))},time(e){return this.check(VC(_T,e))},duration(e){return this.check(HC(vT,e))}});function pT(e){return gC(fT,e)}var mT=Q(`ZodStringFormat`,(e,t)=>{Ix.init(e,t),dT.init(e,t)}),hT=Q(`ZodISODateTime`,(e,t)=>{$x.init(e,t),mT.init(e,t)}),gT=Q(`ZodISODate`,(e,t)=>{eS.init(e,t),mT.init(e,t)}),_T=Q(`ZodISOTime`,(e,t)=>{tS.init(e,t),mT.init(e,t)}),vT=Q(`ZodISODuration`,(e,t)=>{nS.init(e,t),mT.init(e,t)}),yT=Q(`ZodEmail`,(e,t)=>{zx.init(e,t),mT.init(e,t)}),bT=Q(`ZodGUID`,(e,t)=>{Lx.init(e,t),mT.init(e,t)}),xT=Q(`ZodUUID`,(e,t)=>{Rx.init(e,t),mT.init(e,t)}),ST=Q(`ZodURL`,(e,t)=>{Gx.init(e,t),mT.init(e,t)}),CT=Q(`ZodEmoji`,(e,t)=>{Kx.init(e,t),mT.init(e,t)}),wT=Q(`ZodNanoID`,(e,t)=>{qx.init(e,t),mT.init(e,t)}),TT=Q(`ZodCUID`,(e,t)=>{Jx.init(e,t),mT.init(e,t)}),ET=Q(`ZodCUID2`,(e,t)=>{Yx.init(e,t),mT.init(e,t)}),DT=Q(`ZodULID`,(e,t)=>{Xx.init(e,t),mT.init(e,t)}),OT=Q(`ZodXID`,(e,t)=>{Zx.init(e,t),mT.init(e,t)}),kT=Q(`ZodKSUID`,(e,t)=>{Qx.init(e,t),mT.init(e,t)}),AT=Q(`ZodIPv4`,(e,t)=>{rS.init(e,t),mT.init(e,t)}),jT=Q(`ZodIPv6`,(e,t)=>{oS.init(e,t),mT.init(e,t)}),MT=Q(`ZodCIDRv4`,(e,t)=>{sS.init(e,t),mT.init(e,t)}),NT=Q(`ZodCIDRv6`,(e,t)=>{lS.init(e,t),mT.init(e,t)}),PT=Q(`ZodBase64`,(e,t)=>{dS.init(e,t),mT.init(e,t)}),FT=Q(`ZodBase64URL`,(e,t)=>{pS.init(e,t),mT.init(e,t)}),IT=Q(`ZodE164`,(e,t)=>{mS.init(e,t),mT.init(e,t)}),LT=Q(`ZodJWT`,(e,t)=>{gS.init(e,t),mT.init(e,t)}),RT=Q(`ZodUnknown`,(e,t)=>{_S.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function zT(){return UC(RT)}var BT=Q(`ZodNever`,(e,t)=>{vS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ow(e,t,n,r)});function VT(e){return WC(BT,e)}var HT=Q(`ZodArray`,(e,t)=>{lT(),bS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mw(e,t,n,r),e.element=t.element},{min(e,t){return this.check(KC(e,t))},nonempty(e){return this.check(KC(1,e))},max(e,t){return this.check(GC(e,t))},length(e,t){return this.check(qC(e,t))},unwrap(){return this.element}});function UT(e,t){return ow(HT,e,t)}var WT=Q(`ZodObject`,(e,t)=>{lT(),DS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pw(e,t,n,r),rb(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return ZT(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:zT()})},loose(){return this.clone({...this._zod.def,catchall:zT()})},strict(){return this.clone({...this._zod.def,catchall:VT()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return My(this,e)},safeExtend(e){return Ny(this,e)},merge(e){return Py(this,e)},pick(e){return Ay(this,e)},omit(e){return jy(this,e)},partial(...e){return Fy(eE,this,e[0])},exactPartial(...e){return Fy(nE,this,e[0],`exactPartial`)},required(...e){return Iy(uE,this,e[0])}});function GT(e,t){return new WT({type:`object`,shape:e??{},...Z(t)})}var KT=Q(`ZodUnion`,(e,t)=>{kS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fw(e,t,n,r),e.options=t.options});function qT(e,t){return new KT({type:`union`,options:e,...Z(t)})}var JT=Q(`ZodIntersection`,(e,t)=>{AS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Iw(e,t,n,r)});function YT(e,t){return new JT({type:`intersection`,left:e,right:t})}var XT=Q(`ZodEnum`,(e,t)=>{NS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kw(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new XT({...t,checks:[],...Z(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new XT({...t,checks:[],...Z(r),entries:i})}});function ZT(e,t){return new XT({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Z(t)})}var QT=Q(`ZodTransform`,(e,t)=>{lT(),PS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jw(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new db(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(qy(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(qy(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function $T(e){return new QT({type:`transform`,transform:e})}var eE=Q(`ZodOptional`,(e,t)=>{IS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tE(e){return new eE({type:`optional`,innerType:e})}var nE=Q(`ZodExactOptional`,(e,t)=>{LS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function rE(e){return new nE({type:`optional`,innerType:e})}var iE=Q(`ZodNullable`,(e,t)=>{RS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function aE(e){return new iE({type:`nullable`,innerType:e})}var oE=Q(`ZodDefault`,(e,t)=>{zS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function sE(e,t){return new oE({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():wy(t)}})}var cE=Q(`ZodPrefault`,(e,t)=>{VS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function lE(e,t){return new cE({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():wy(t)}})}var uE=Q(`ZodNonOptional`,(e,t)=>{HS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dE(e,t){return new uE({type:`nonoptional`,innerType:e,...Z(t)})}var fE=Q(`ZodCatch`,(e,t)=>{GS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pE(e,t){return new fE({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ab(t)})}var mE=Q(`ZodPipe`,(e,t)=>{KS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ww(e,t,n,r),e.in=t.in,e.out=t.out});function hE(e,t){return new mE({type:`pipe`,in:e,out:t})}var gE=Q(`ZodReadonly`,(e,t)=>{JS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gw(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _E(e){return new gE({type:`readonly`,innerType:e})}var vE=Q(`ZodCustom`,(e,t)=>{XS.init(e,t),uT.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aw(e,t,n,r)});function yE(e,t={}){return sw(vE,e,t)}function bE(e,t){return cw(e,t)}var xE=e=>e&&{primary:`text-primary`,secondary:`text-secondary`,neutral:`text-neutral`,light:`text-white`,dark:`text-neutral-800`,text:`text-muted-foreground`,"text-inverse":`text-foreground-opposite`,error:`text-error`,success:`text-success`,custom:``}[e]||``,SE=Ze(`flex flex-row flex-wrap items-center`,{variants:{size:{xs:`gap-1 text-xs`,sm:`gap-1.5 text-sm`,md:`gap-2 text-base`,lg:`gap-3 text-lg`,xl:`gap-4 text-xl`},spacing:{compact:`gap-1`,normal:`gap-2`,loose:`gap-4`}},defaultVariants:{size:`md`,spacing:`normal`}}),CE=({href:e,lang:t,children:n,onClick:r,color:i,position:a,locale:o,className:c,...l})=>{let u=s(`breadcrumb`).linkLabel;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ve,{href:e,locale:o,color:i,onClick:r,itemProp:`item`,isExternalLink:!1,itemScope:!0,itemType:`https://schema.org/WebPage`,...l,label:`${u} ${n}`,itemID:e,size:`custom`,children:(0,H.jsx)(`span`,{itemProp:`name`,children:n})}),(0,H.jsx)(`meta`,{itemProp:`position`,content:a.toString()})]})},wE=e=>{let{children:t,onClick:n,color:r,position:i,className:a,...o}=e,{linkLabel:s}=F(`breadcrumb`);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(M,{onClick:n,variant:`link`,label:`${s} ${t}`,color:r,itemProp:`item`,size:`custom`,...o,children:(0,H.jsx)(`span`,{itemProp:`name`,children:t})}),(0,H.jsx)(`meta`,{itemProp:`position`,content:i.toString()})]})},TE=({children:e,position:t,className:n,...r})=>(0,H.jsxs)(`span`,{itemProp:`item`,className:R(`inline-flex items-center`,`font-medium text-muted-foreground`,`transition-colors duration-200`,n),children:[(0,H.jsx)(`span`,{itemProp:`name`,...r,children:e}),(0,H.jsx)(`meta`,{itemProp:`position`,content:t.toString()})]}),EE=({links:e,className:t,color:n=`text`,locale:r,elementType:i=`page`,separator:a=(0,H.jsx)(Ys,{size:10}),ariaLabel:o=`breadcrumb`,includeStructuredData:s=!0,maxItems:c,size:l,spacing:u,...d})=>{let f=c&&e.length>c?[...e.slice(0,1),`...`,...e.slice(-(c-2))]:e;return(0,H.jsx)(`nav`,{"aria-label":o,children:(0,H.jsx)(`ol`,{className:R(SE({size:l,spacing:u}),t),...s&&{itemScope:!0,itemType:`http://schema.org/BreadcrumbList`},...d,children:f.map((e,t)=>{let o=t===f.length-1,c=typeof e==`object`&&typeof e.href==`string`,l=typeof e==`object`&&typeof e.onClick==`function`,u=t===f.length-1,d=u?i:void 0,p=e===`...`,m=e.text??e,h=xE(n);if(p)return(0,H.jsxs)(z.Fragment,{children:[(0,H.jsx)(`li`,{className:`flex items-center`,"aria-hidden":`true`,children:(0,H.jsx)(`span`,{className:`text-neutral-500`,children:`…`})}),!o&&(0,H.jsx)(`li`,{"aria-hidden":`true`,className:`flex items-center`,children:(0,H.jsx)(`span`,{className:R(h),children:a})})]},`truncated-${m}`);let g=(0,H.jsx)(TE,{position:t+1,"aria-current":d,className:R(`transition-colors duration-200`,u&&`text-foreground`),children:m},m);c?g=(0,H.jsx)(CE,{href:e.href,color:n,position:t+1,locale:r,"aria-current":d,className:R(u&&`cursor-default text-foreground`),children:m},m):l&&(g=(0,H.jsx)(wE,{onClick:e.onClick,color:n,position:t+1,"aria-current":d,className:R(u&&`cursor-default text-neutral-900`),children:m},m));let _=(0,z.createElement)(`li`,{...s&&{itemProp:`itemListElement`,itemScope:!0,itemType:`https://schema.org/ListItem`},key:m,className:`flex items-center`},g);return o?_:(0,H.jsxs)(z.Fragment,{children:[_,(0,H.jsx)(`li`,{"aria-hidden":`true`,className:`flex items-center`,children:(0,H.jsx)(`span`,{className:R(h),children:a})})]},m)})})})},DE=({keyPath:e,dictionaryKey:t,onClickKeyPath:n,locale:r,color:i,showDictionaryKey:a=!0})=>{let o=[...a?[{text:Dt(t),onClick:n?()=>n([]):void 0}]:[],...e.map((t,r)=>({onClick:n?()=>n?.(e.slice(0,r+1)):void 0,text:Dt(t.key?.toString()??``)}))];return(0,H.jsx)(EE,{links:o,locale:r,elementType:`location`,color:i})},OE=({children:e,className:t,identifier:n,...r})=>(0,H.jsx)(`div`,{className:R(`group/dropdown relative flex`,t),"aria-label":`DropDown ${n}`,id:`dropdown-container-${n}`,...r,children:e});OE.Trigger=({children:e,identifier:t,className:n,label:r,...i})=>(0,H.jsx)(M,{className:R([`w-full cursor-pointer`,`group-focus-within/dropdown:bg-current/20 group-focus-within/dropdown:ring-4`,n]),label:r??`Open panel ${t}`,"aria-haspopup":`true`,"aria-controls":`dropdown-panel-${t}`,id:`dropdown-trigger-${t}`,onClick:e=>{e.currentTarget.focus()},variant:`none`,...i,children:e}),OE.Panel=({children:e,isHidden:t=void 0,isOverable:n=!1,isFocusable:r=!1,align:i=`start`,yAlign:a=`below`,identifier:o,className:s,smootherClassName:c,...l})=>(0,H.jsx)(`div`,{className:R(`absolute z-100 min-w-full`,i===`start`&&`left-0`,i===`end`&&`right-0`,a===`below`&&`top-[calc(100%+0.5rem)]`,a===`above`&&`bottom-[calc(100%+0.5rem)]`,s),"aria-hidden":t,role:`region`,"aria-labelledby":`dropdown-trigger-${o}`,id:`dropdown-panel-${o}`,children:(0,H.jsx)(ee,{isHidden:t,className:R(`overflow-x-visible`,t===!1&&`invisible`,t===!0&&`visible`,n&&`group-hover/dropdown:visible group-hover/dropdown:grid-rows-[1fr]`,r&&`group-focus-within/dropdown:visible group-focus-within/dropdown:grid-rows-[1fr]`,c),...l,children:e})});function kE(e){return Array.isArray?Array.isArray(e):zE(e)===`[object Array]`}function AE(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function jE(e){return e==null?``:AE(e)}function ME(e){return typeof e==`string`}function NE(e){return typeof e==`number`}function PE(e){return e===!0||e===!1||IE(e)&&zE(e)==`[object Boolean]`}function FE(e){return typeof e==`object`}function IE(e){return FE(e)&&e!==null}function LE(e){return e!=null}function RE(e){return!e.trim().length}function zE(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var BE=`Incorrect 'index' type`,VE=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,HE=e=>`Invalid value for key ${e}`,UE=e=>`Pattern length exceeds max of ${e}.`,WE=e=>`Missing ${e} property in key`,GE=e=>`Property 'weight' in key '${e}' must be a positive integer`,KE=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,qE=Object.prototype.hasOwnProperty,JE=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=YE(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function YE(e){let t=null,n=null,r=null,i=1,a=null;if(ME(e)||kE(e))r=e,t=XE(e),n=ZE(e);else{if(!qE.call(e,`name`))throw Error(WE(`name`));let o=e.name;if(r=o,qE.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(GE(ZE(o)));t=XE(o),n=ZE(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function XE(e){return kE(e)?e:e.split(`.`)}function ZE(e){return kE(e)?e.join(`.`):e}function QE(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(LE(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!LE(s))return;if(a===t.length-1&&(ME(s)||NE(s)||PE(s)||typeof s==`bigint`))n.push(o===void 0?jE(s):{v:jE(s),i:o});else if(kE(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}}};return i(e,ME(t)?t.split(`.`):t,0),r?n:n[0]}var $E={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},eD={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},tD={location:0,threshold:.6,distance:100},nD={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:QE,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},$=Object.freeze({...eD,...$E,...tD,...nD});function rD(e){return e>=9&&e<=13||e===32||e===160}function iD(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=0,a=!1;for(let e=0;e<t.length;e++)rD(t.charCodeAt(e))?a=!1:a||=(i++,!0);if(i===0&&(i=1),n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var aD=class{constructor({getFn:e=$.getFn,fieldNormWeight:t=$.fieldNormWeight}={}){this.norm=iD(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(ME(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(VE);if(ME(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(VE);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!LE(e)||RE(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(LE(i)){if(kE(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(LE(n)){if(ME(n)){if(!RE(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(LE(n.v)){let t=ME(n.v)?n.v:jE(n.v);if(!RE(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(ME(i)&&!RE(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function oD(e,t,{getFn:n=$.getFn,fieldNormWeight:r=$.fieldNormWeight}={}){let i=new aD({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(YE)),i.setSources(t),i.create(),i}function sD(e,{getFn:t=$.getFn,fieldNormWeight:n=$.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new aD({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function cD(e=[],t=$.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function lD(e,t,n,{location:r=$.location,distance:i=$.distance,threshold:a=$.threshold,findAllMatches:o=$.findAllMatches,minMatchCharLength:s=$.minMatchCharLength,includeMatches:c=$.includeMatches,ignoreLocation:l=$.ignoreLocation}={}){if(t.length>32)throw Error(UE(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=cD(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function uD(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function dD(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var fD={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},pD=RegExp(`[`+Object.keys(fD).join(``)+`]`,`g`),mD=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(pD,e=>fD[e]):e=>e,hD=class{constructor(e,{location:t=$.location,threshold:n=$.threshold,distance:r=$.distance,includeMatches:i=$.includeMatches,findAllMatches:a=$.findAllMatches,minMatchCharLength:o=$.minMatchCharLength,isCaseSensitive:s=$.isCaseSensitive,ignoreDiacritics:c=$.ignoreDiacritics,ignoreLocation:l=$.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?mD(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:uD(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?mD(e):e,this.pattern===e){if(e.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=lD(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=dD(u)),p}},gD=new Set([`fuzzy`,`include`]);function _D(e){return e.startsWith(`inverse`)}var vD=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new hD(e,{location:t.location??$.location,threshold:t.threshold??$.threshold,distance:t.distance??$.distance,includeMatches:t.includeMatches??$.includeMatches,findAllMatches:t.findAllMatches??$.findAllMatches,minMatchCharLength:t.minMatchCharLength??$.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??$.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??$.ignoreDiacritics,ignoreLocation:t.ignoreLocation??$.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],yD=vD.length,bD=`\0`,xD=`|`;function SD(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function CD(e,t){let n=e.match(t);return n?n[1]:null}function wD(e,t={}){return e.replace(/\\\|/g,bD).split(xD).map(e=>{let n=SD(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<yD;){let e=vD[o],n=CD(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<yD;){let e=vD[o],n=CD(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var TD=class{constructor(e,{isCaseSensitive:t=$.isCaseSensitive,ignoreDiacritics:n=$.ignoreDiacritics,includeMatches:r=$.includeMatches,minMatchCharLength:i=$.minMatchCharLength,ignoreLocation:a=$.ignoreLocation,findAllMatches:o=$.findAllMatches,location:s=$.location,threshold:c=$.threshold,distance:l=$.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?mD(e):e,this.pattern=e,this.query=wD(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?mD(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,_D(r.type)&&(c=!0),n&&(gD.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=dD(o)),e}}return{isMatch:!1,score:1}}},ED=[];function DD(...e){ED.push(...e)}function OD(e,t){for(let n=0,r=ED.length;n<r;n+=1){let r=ED[n];if(r.condition(e,t))return new r(e,t)}return new hD(e,t)}var kD={AND:`$and`,OR:`$or`},AD={PATH:`$path`,PATTERN:`$val`},jD=e=>!!(e[kD.AND]||e[kD.OR]),MD=e=>!!e[AD.PATH],ND=e=>!kE(e)&&FE(e)&&!jD(e),PD=e=>({[kD.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function FD(e,t,{auto:n=!0}={}){let r=e=>{if(ME(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=OD(e,t)),r}let i=Object.keys(e),a=MD(e);if(!a&&i.length>1&&!jD(e))return r(PD(e));if(ND(e)){let r=a?e[AD.PATH]:i[0],o=a?e[AD.PATTERN]:e[r];if(!ME(o))throw Error(HE(r));let s={keyId:ZE(r),pattern:o};return n&&(s.searcher=OD(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];kE(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return jD(e)||(e=PD(e)),r(e)}function ID(e,{ignoreFieldNorm:t=$.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function LD(e,{ignoreFieldNorm:t=$.ignoreFieldNorm}){e.forEach(e=>{e.score=ID(e.matches,{ignoreFieldNorm:t})})}var RD=class{constructor(e,t){this.limit=e,this.heap=[],this.comparator=t}get size(){return this.heap.length}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):this.comparator(e,this.heap[0])<0&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(this.comparator(t[e],t[n])<=0)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&this.comparator(t[i],t[r])>0&&(r=i),a<n&&this.comparator(t[a],t[r])>0&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function zD(e){let t=[];return e.matches.forEach(e=>{if(!LE(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function BD(e,t,{includeMatches:n=$.includeMatches,includeScore:r=$.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=zD(e)),r&&(a.score=e.score),a})}var VD=/[\p{L}\p{M}\p{N}_]+/gu,HD=new WeakSet;function UD(e){HD.has(e)||(HD.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function WD(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||UD(e),t=>t.match(e)||[]):e=>e.match(VD)||[]}function GD({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=WD(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=mD(n)),r(n)}}}var KD=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=GD({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new hD(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=dD(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function qD(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function JD(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0){qD(e,a,i,r);return}if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)qD(e,t.v,i,r);else qD(e,n.v,i,r)}}}function YD(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)JD(r,i,t,n);return r}function XD(e,t,n,r){JD(e,t,n,r)}function ZD(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function QD(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)ZD(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var $D=class{constructor(e,t,n){this.options={...$,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new JE(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=OD(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof aD))throw Error(BE);if(this._myIndex=t||oD(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=GD({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=YD(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!LE(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=GD({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});XD(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&QD(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(VE);this._invertedIndex&&QD(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map(e=>this._keyStore.get(e.id)||e)}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(ME(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return NE(n)&&n>-1&&(e=e.slice(0,n)),e}let c=a&&NE(n)&&n>0&&ME(e),l=o,u=(e,t)=>l(e,t)||e.idx-t.idx,d;if(c){let t=new RD(n,u);ME(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),d=t.extractSorted()}else d=ME(e)?ME(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),LD(d,{ignoreFieldNorm:s}),a&&d.sort(ME(e)?u:l),NE(n)&&n>-1&&(d=d.slice(0,n));return BD(d,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!LE(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=ID(r.matches,{ignoreFieldNorm:n}),t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=FD(e,this.options),n=this._normalizedKeys(),r=(e,t,i)=>{if(!(`children`in e)){let{keyId:r,searcher:a}=e,o;return r===null?(o=[],n.forEach((e,n)=>{o.push(...this._findMatches({key:e,value:t[n],searcher:a}))})):o=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:a}),o&&o.length?[{idx:i,item:t,matches:o}]:[]}let{children:a,operator:o}=e,s=[];for(let e=0,n=a.length;e<n;e+=1){let n=a[e],c=r(n,t,i);if(c.length)s.push(...c);else if(o===kD.AND)return[]}return s},i=this._myIndex.records,a=new Map,o=[];return i.forEach(({$:e,i:n})=>{if(LE(e)){let i=r(t,e,n);i.length&&(a.has(n)||(a.set(n,{idx:n,item:e,matches:[]}),o.push(a.get(n))),i.forEach(({matches:e})=>{a.get(n).matches.push(...e)}))}}),o}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=this._normalizedKeys(),s=t?null:[];return a.forEach(({$:e,i:a})=>{if(!LE(e))return;let c=[],l=!1,u=!1;if(o.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:a,item:e,matches:c};t?(r.score=ID(r.matches,{ignoreFieldNorm:n}),t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!LE(t))return[];let r=[];if(kE(t))t.forEach(({v:t,i,n:a})=>{if(!LE(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};$D.version=`7.5.0`,$D.createIndex=oD,$D.parseIndex=sD,$D.config=$,$D.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(KE);return OD(e,{...$,...n}).searchIn(t)},$D.parseQuery=FD,DD(TD),DD(KD),$D.use=function(...e){e.forEach(e=>DD(e))};var eO=$D,tO=`locale-switcher-content`,nO=({panelProps:e,isMultilingual:t=!0})=>{let{switchTo:n,searchInput:r,localeSwitcherLabel:a,languageListLabel:s,seeAllLocalesSwitch:c}=F(`locale-switcher-content`),l=(0,z.useRef)(null),{locale:u}=Ht(),{availableLocales:d,selectedLocales:f,setSelectedLocales:p}=wm(),m=(0,z.useMemo)(()=>d.map(e=>({locale:e,englishName:At(e,`en`),currentLocaleName:At(e,u),ownLocaleName:At(e)})),[d,u]),[h,g]=(0,z.useState)(``),[_,v]=o(`locale-content-selector-see-all-locales`,!1),y=(0,z.useMemo)(()=>new eO(m,{keys:[{name:`ownLocaleName`,weight:.4},{name:`englishName`,weight:.2},{name:`currentLocaleName`,weight:.2},{name:`locale`,weight:.2}],threshold:.02}),[m]),b=(0,z.useMemo)(()=>h?y.search(h).map(e=>e.item):m,[h,m,y]),x=e=>{t?f.includes(e)?f.length>1&&p(t=>t.filter(t=>t!==e)):p(t=>[...t,e]):p([e])},S=e=>{v(e),p(e?d:[u])};return(0,H.jsx)(`div`,{className:`rounded-xl border border-text text-foreground transition-colors`,children:(0,H.jsxs)(OE,{identifier:tO,children:[(0,H.jsx)(OE.Trigger,{identifier:tO,label:a.value,className:`p-0!`,roundedSize:`3xl`,color:`text`,variant:`hoverable`,children:(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-between text-foreground`,children:[(0,H.jsx)(`div`,{className:`px-2 py-1`,children:(0,H.jsx)(Qs,{size:16})}),(0,H.jsx)($s,{className:`self-center`,size:16})]})}),(0,H.jsx)(OE.Panel,{identifier:tO,isOverable:!0,isFocusable:!0,align:`end`,...e,children:(0,H.jsxs)(Ne,{className:`max-h-[60vh] min-w-28`,separator:`y`,role:`listbox`,transparency:`xs`,border:!0,roundedSize:`3xl`,borderColor:`text`,"aria-label":s.value,children:[t&&(0,H.jsx)(`div`,{className:`m-auto p-2`,children:(0,H.jsx)(wp,{defaultValue:_,onChange:S,color:`text`,size:`sm`,className:`!w-60`,choices:[{content:c.true.value,value:!0},{content:c.false.value,value:!1}]})}),!(t&&_)&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`p-3`,children:(0,H.jsx)(Ap,{type:`search`,"aria-label":r.ariaLabel.value,placeholder:r.placeholder.value,onChange:e=>g(e.target.value),ref:l})}),(0,H.jsx)(`ol`,{className:`divide-y divide-dashed divide-text/20 overflow-y-auto p-1`,children:b.map(({locale:e,currentLocaleName:r,ownLocaleName:a})=>(0,H.jsx)(`li`,{className:`px-1.5 py-1`,children:(0,H.jsx)(M,{onClick:()=>x(e),label:`${n} ${r}`,disabled:!(d??d).includes(e),isActive:f.includes(e),variant:`hoverable`,color:`text`,isFullWidth:!0,textAlign:`left`,size:`sm`,children:(0,H.jsxs)(`div`,{className:`flex flex-row items-center justify-between gap-3 px-2 py-1`,children:[t&&(0,H.jsx)(`div`,{className:`w-4`,children:f.includes(e)&&(0,H.jsx)(i,{className:`size-full`})}),(0,H.jsxs)(`div`,{className:`flex flex-1 flex-row items-center justify-between gap-3 px-2 py-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col text-nowrap`,children:[(0,H.jsx)(`span`,{dir:kt(e),lang:e,children:a}),(0,H.jsx)(`span`,{className:`text-neutral text-xs`,children:r})]}),(0,H.jsx)(`span`,{className:`text-neutral text-sm`,children:e.toUpperCase()})]})]})})},e))})]})]})})]})})},rO=Ze(`flex items-center justify-center gap-1`,{variants:{size:{sm:`gap-1`,md:`gap-2`,lg:`gap-3`},color:{text:`background-text`,primary:`background-primary`,secondary:`background-secondary`,neutral:`background-neutral`},variant:{default:``,bordered:`rounded-lg border border-border p-2`,ghost:`bg-transparent`}},defaultVariants:{size:`md`,variant:`default`}}),iO=(e,t,n)=>{if(t<=n)return Array.from({length:t},(e,t)=>t+1);let r=[],i=Math.floor(n/2);if(r.push(1),e<=i+2){for(let e=2;e<=Math.min(n-1,t-1);e++)r.push(e);t>n&&r.push(`ellipsis`),t>1&&r.push(t)}else if(e>=t-i-1){t>n&&r.push(`ellipsis`);for(let e=Math.max(2,t-n+2);e<=t;e++)r.push(e)}else{r.push(`ellipsis`);let n=e-i,a=e+i;for(let e=n;e<=a;e++)r.push(e);r.push(`ellipsis`),r.push(t)}return r},aO=e=>e?.getAttribute(`aria-current`)===`true`,oO=e=>e===`sm`?`icon-sm`:e===`lg`?`icon-lg`:`icon-md`,sO=e=>(0,H.jsx)(`div`,{className:`absolute top-0 z-0 h-full w-auto rounded-xl bg-text/20 ring-4 ring-text/10 transition-[left,width] duration-300 ease-in-out [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl motion-reduce:transition-none`,...e}),cO=({currentPage:e,totalPages:t,onPageChange:n,showFirstLast:r=!1,showPrevNext:i=!0,maxVisiblePages:a=5,disabled:o=!1,size:s=`md`,variant:c=`default`,color:l=`text`,className:u,...d})=>{let{goToNextPage:f,goToPreviousPage:p}=F(`pagination`),m=iO(e,t,a),h=oO(s),g=e===1,_=e===t,v=(0,z.useRef)([]),y=(0,z.useRef)(null),{choiceIndicatorPosition:b,scheduleMeasurement:x}=O(v,{selector:aO,isHoverable:!0});if((0,z.useEffect)(()=>{let e=setTimeout(()=>{x()},300);return()=>clearTimeout(e)},[e,x]),t<=1)return null;let S=r=>{!o&&r>=1&&r<=t&&r!==e&&n(r)};return(0,H.jsx)(`div`,{className:R(rO({size:s,variant:c}),u),...d,children:(0,H.jsxs)(`div`,{className:`relative flex items-center gap-1`,children:[b&&(0,H.jsx)(sO,{style:b,ref:y}),i&&(0,H.jsx)(M,{variant:`outline`,size:h,color:`text`,onClick:()=>S(e-1),disabled:o||g,label:p.value,Icon:Js,ref:e=>{e&&(v.current[0]=e)},className:`min-w-0 px-2`}),(0,H.jsx)(`div`,{className:`flex items-center gap-1 max-md:gap-0.5`,children:m.map((t,n)=>{if(t===`ellipsis`){let e=n===m.indexOf(`ellipsis`)?`ellipsis-start`:`ellipsis-end`;return(0,H.jsx)(`div`,{className:`flex h-8 min-w-8 items-center justify-center px-1`,children:(0,H.jsx)(Zs,{className:`h-4 w-4 text-muted-foreground`})},e)}let r=t===e,a=+!!i+m.slice(0,n).filter(e=>e!==`ellipsis`).length;return(0,H.jsx)(M,{variant:r?`default`:`outline`,size:h,color:`text`,onClick:()=>S(t),disabled:o,label:`Go to page ${t}`,"aria-current":r?`true`:`false`,ref:e=>{e&&(v.current[a]=e)},className:R(`flex aspect-square h-8 w-8 min-w-0 items-center justify-center p-0 text-sm`,s===`sm`&&`h-6 w-6 text-xs`,s===`lg`&&`size-10 text-base`,r&&`font-semibold`),children:t},t)})}),i&&(0,H.jsx)(M,{variant:`outline`,size:h,color:`text`,onClick:()=>S(e+1),disabled:o||_,label:f.value,Icon:Ys,ref:e=>{let t=+!!i+m.filter(e=>e!==`ellipsis`).length;e&&(v.current[t]=e)},className:`min-w-0 px-2`})]})})},lO=e=>{let t=Ft(e),n=zt(e);return t&&(n===`reactNode`||n===`file`)?!0:t&&typeof t.nodeType==`string`?lO(t[t.nodeType]):typeof t==`string`||typeof t==`number`||typeof t==`boolean`||t===void 0},uO=e=>{let t=(0,V.c)(3),{children:n,onToggle:r,...i}=e,[a,o]=(0,z.useState)(!1),s;return t[0]!==a||t[1]!==r?(s=e=>{e&&!a&&o(!0),r?.(e)},t[0]=a,t[1]=r,t[2]=s):s=t[2],(0,H.jsx)(gp,{...i,onToggle:s,children:a?n:null})},dO=e=>{let t=(0,V.c)(16),{section:n,keyPath:r,dictionary:i}=e,{selectedLocales:a}=wm(),o=Mt(n,r,Nf()),{addEditedContent:s}=zf(),{setFocusedContentKeyPath:c,focusedContent:l}=Ff(),{addNewElement:u,goToField:d}=F(`navigation-view`),f=zt(o),p;t[0]===l?.keyPath?p=t[1]:(p=e=>(l?.keyPath?.length??0)>0&&Et(e,l?.keyPath??[]),t[0]=l?.keyPath,t[1]=p);let m=p,h=lO(o);if(!o)return(0,H.jsx)(H.Fragment,{});if(h){let e;return t[2]!==r||t[3]!==c?(e=()=>c(r),t[2]=r,t[3]=c,t[4]=e):e=t[4],(0,H.jsx)(M,{label:d.label.value,variant:`hoverable`,color:`text`,className:`w-full`,onClick:e,IconRight:Ys,children:Dt(r[r.length-1]?.key)})}if(typeof o==`object`){if(f===`reactNode`)return(0,H.jsx)(H.Fragment,{children:`React Node`});if(f===`translation`){let e;return t[5]!==i||t[6]!==r||t[7]!==n?(e=e=>{let t=[...r,{type:ge,key:e}];return(0,H.jsx)(dO,{keyPath:t,section:n,dictionary:i},e)},t[5]=i,t[6]=r,t[7]=n,t[8]=e):e=t[8],(0,H.jsx)(`div`,{className:`flex flex-col justify-between gap-2`,children:a.map(e)})}if(f===`enumeration`||f===`plural`||f===`condition`)return(0,H.jsx)(`div`,{className:`flex flex-col justify-between gap-2`,children:Object.keys(o[f]).map(e=>{let t=[...r,{type:f,key:e}];return(0,H.jsx)(dO,{keyPath:t,section:n,dictionary:i},e)})});if(f===`array`){let e;return t[9]!==i||t[10]!==m||t[11]!==d||t[12]!==r||t[13]!==n||t[14]!==c?(e=(e,t)=>{let a=[...r,{type:k,key:t}];return lO(e)?(0,H.jsxs)(M,{label:`${d.label.value} ${t}`,variant:`hoverable`,color:`text`,className:`w-full`,onClick:()=>c(a),IconRight:Ys,isActive:m(a),children:[`Item `,t]},JSON.stringify(a)):(0,H.jsx)(uO,{label:`${d.label.value} ${t}`,header:`Item ${t}`,isActive:m(a),onClick:()=>c(a),children:(0,H.jsx)(`div`,{className:`mt-2 flex w-full max-w-full`,children:(0,H.jsx)(`div`,{className:`flex-1 pl-10`,children:(0,H.jsx)(dO,{keyPath:a,section:n,dictionary:i})})})},JSON.stringify(a))},t[9]=i,t[10]=m,t[11]=d,t[12]=r,t[13]=n,t[14]=c,t[15]=e):e=t[15],(0,H.jsxs)(`div`,{className:`flex flex-col justify-between gap-2`,children:[o.map(e),(0,H.jsx)(M,{label:u.label.value,variant:`hoverable`,color:`neutral`,textAlign:`left`,onClick:()=>{let e=[...r,{type:k,key:o.length}],t=o,n=Pt(t[t.length-1])??``;s(i.localId,n,e,!1),c(e)},Icon:nc,children:u.text})]})}if(typeof o.nodeType==`string`){let e=[...r,{type:o.nodeType}];return(0,H.jsx)(dO,{keyPath:e,section:n,dictionary:i})}let e=Object.keys(o);return(0,H.jsx)(`div`,{className:`flex w-full max-w-full flex-col justify-between gap-2`,children:e.map(e=>{let t=[...r,{type:ue,key:e}];return lO(Mt(n,t))?(0,H.jsx)(M,{label:`${d.label.value} ${e}`,isActive:m(t),variant:`hoverable`,color:`text`,className:`w-full`,onClick:()=>c(t),IconRight:Ys,children:Dt(e)},e):(0,H.jsx)(uO,{label:`${d.label.value} ${e}`,isActive:m(t),onClick:()=>c(t),header:Dt(e),children:(0,H.jsx)(`div`,{className:`mt-2 flex w-full max-w-full`,children:(0,H.jsx)(`div`,{className:`flex-1 pl-10`,children:(0,H.jsx)(dO,{keyPath:t,section:n,dictionary:i})})})},e)})})}return(0,H.jsxs)(H.Fragment,{children:[`Error loading section --`,f,`--`,JSON.stringify(o),`--`,JSON.stringify(r)]})},fO=e=>typeof e==`object`&&e?JSON.stringify(e):e??``,pO=e=>{let t=(0,V.c)(35),{dictionary:n}=e,{itemPagination:r,variantSwitcher:i}=F(`content-editor`),{editedContent:a}=Bf(),{focusedContent:o,setFocusedContentKeyPath:s}=Ff(),[,c]=(0,z.useTransition)(),l;t[0]!==s||t[1]!==c?(l=e=>c(()=>s(e)),t[0]=s,t[1]=c,t[2]=l):l=t[2];let u=l,[d,f]=(0,z.useState)(n),p,m;t[3]===n?(p=t[4],m=t[5]):(p=()=>{f(n)},m=[n],t[3]=n,t[4]=p,t[5]=m),(0,z.useEffect)(p,m);let h=n.item!==void 0||n.variant!==void 0,g;t[6]===n.key?g=t[7]:(g={keys:[n.key]},t[6]=n.key,t[7]=g);let _=h&&!!n.key,v;t[8]===_?v=t[9]:(v={enabled:_},t[8]=_,t[9]=v);let{data:y}=cp(g,v),b;t[10]===y?.data?b=t[11]:(b=y?.data??[],t[10]=y?.data,t[11]=b);let x=b,S;bb0:{if(n.item===void 0){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[12]=e):e=t[12],S=e;break bb0}let e;t[13]===x?e=t[14]:(e=x.filter(mO).sort(hO),t[13]=x,t[14]=e),S=e}let C=S,w;bb1:{if(n.variant===void 0){let e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[15]=e):e=t[15],w=e;break bb1}let e;t[16]===x?e=t[17]:(e=x.filter(gO),t[16]=x,t[17]=e),w=e}let T=w,E;t[18]===u?E=t[19]:(E=e=>{f(e),u([])},t[18]=u,t[19]=E);let D=E,{content:O,key:k,localId:ee}=d,A=o?.keyPath,j=a?.[ee]?.content===void 0?O:a?.[ee]?.content,te=Nf(),M;t[20]===A?M=t[21]:(M=A??[],t[20]=A,t[21]=M);let N;t[22]!==te||t[23]!==j||t[24]!==M?(N=Mt(j,M,te),t[22]=te,t[23]=j,t[24]=M,t[25]=N):N=t[25];let P=N,ne=(0,z.useDeferredValue)(A),re=(0,z.useDeferredValue)(P),ie=re!==P,I;t[26]===j?I=t[27]:(I=lO(j),t[26]=j,t[27]=I);let ae=I,oe=lO(re),se;t[28]!==o?.keyPath||t[29]!==P||t[30]!==u?(se=()=>{P===void 0&&u(o?.keyPath?.slice(0,-1)??[])},t[28]=o?.keyPath,t[29]=P,t[30]=u,t[31]=se):se=t[31];let ce;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(ce=[],t[32]=ce):ce=t[32],(0,z.useEffect)(se,ce);let le;t[33]===d.localId?le=t[34]:(le=e=>e.localId===d.localId,t[33]=d.localId,t[34]=le);let ue=C.findIndex(le),de=d.variant;return(0,H.jsxs)(`div`,{children:[h&&(0,H.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-4`,children:[C.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`font-medium text-muted text-xs`,children:r.label}),(0,H.jsx)(cO,{currentPage:ue>=0?ue+1:1,totalPages:C.length,onPageChange:e=>{let t=C[e-1];t&&D(t)},size:`sm`})]}),T.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:`font-medium text-muted text-xs`,children:[i.label,`:`]}),T.map(e=>{let t=e.localId===d.localId;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>!t&&D(e),className:`rounded-lg px-3 py-1 text-xs transition-colors ${t?`bg-text font-semibold text-foreground-opposite`:`cursor-pointer border border-border hover:bg-text/10`}`,children:fO(e.variant)},e.localId)}),de!==void 0&&!T.some(e=>e.localId===n.localId)&&(0,H.jsx)(`span`,{className:`rounded-lg bg-text px-3 py-1 font-semibold text-foreground-opposite text-xs`,children:fO(de)})]})]}),(0,H.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-2`,children:[(0,H.jsx)(DE,{dictionaryKey:k,keyPath:A??[],onClickKeyPath:u}),(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,H.jsx)(nO,{})})]}),(0,H.jsxs)(`div`,{className:`flex flex-1 gap-2 overflow-visible max-md:flex-col`,children:[typeof j==`object`&&j&&!ae&&Object.keys(j).length>0&&(0,H.jsx)(Ne,{border:!0,background:`none`,className:`top-10 flex h-full flex-col items-start gap-0.5 overflow-auto p-2 md:sticky md:max-w-[50%]`,roundedSize:`2xl`,transparency:`xs`,children:(0,H.jsx)(dO,{keyPath:[],section:j,dictionary:d})}),(oe||(ne??[]).length>0)&&(0,H.jsx)(`div`,{className:ie?`pointer-events-none flex-1 opacity-50 transition-opacity`:`flex-1 transition-opacity`,children:(0,H.jsx)(Zm,{keyPath:ne??[],section:re,dictionary:d})})]})]})};function mO(e){return e.item!==void 0}function hO(e,t){return(e.item??0)-(t.item??0)}function gO(e){return e.variant!==void 0}var _O=e=>{let t=(0,V.c)(25),{dictionary:n,mode:r,className:i,onDelete:a,onSave:o,...s}=e,[c,l]=(0,z.useState)(!1),{setLocaleDictionary:u}=Mf(),{mutate:d,isPending:f}=up(),{mutate:p,isPending:m}=fp(),{mutate:h,isPending:g}=lp(),_=m||g,{editedContent:v,restoreEditedContent:y}=Bf(),{deleteButton:b,resetButton:x,saveButton:S,publishButton:C,downloadButton:w,confirmation:T}=F(`save-dictionary-details`),{isAuthenticated:E}=ep(),{session:D}=$f(),O;t[0]===D?.permissions?O=t[1]:(O=(D?.permissions?.includes(`dictionary:admin`)||D?.permissions?.includes(`dictionary:write`))??!1,t[0]=D?.permissions,t[1]=O);let k=O,ee=k,A=v?.[n.localId],j;t[2]!==n||t[3]!==A?(j=A&&JSON.stringify(A)!==JSON.stringify(n),t[2]=n,t[3]=A,t[4]=j):j=t[4];let te=j,N=n?.id!==void 0,P;t[5]!==n||t[6]!==v||t[7]!==o||t[8]!==y||t[9]!==u||t[10]!==p?(P=async()=>{if(!v?.[n.localId])return;let e={...n,...v?.[n.localId]};p({dictionary:e},{onSuccess:()=>{u(v?.[n.localId]),y(n.localId),l(!1),o?.()}})},t[5]=n,t[6]=v,t[7]=o,t[8]=y,t[9]=u,t[10]=p,t[11]=P):P=t[11];let ne=P,re;t[12]!==n||t[13]!==v||t[14]!==o||t[15]!==h||t[16]!==y||t[17]!==u?(re=()=>{let e={...n,...v?.[n.localId]};h({dictionaries:[e]},{onSuccess:t=>{t&&(u(e),y(n.localId),o?.())}})},t[12]=n,t[13]=v,t[14]=o,t[15]=h,t[16]=y,t[17]=u,t[18]=re):re=t[18];let ie=re,I;t[19]!==d||t[20]!==n||t[21]!==a?(I=()=>{n.id&&d({dictionaryId:n.id},{onSuccess:e=>{e&&a?.()}})},t[19]=d,t[20]=n,t[21]=a,t[22]=I):I=t[22];let ae=I,oe;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>l(!1),t[23]=oe):oe=t[23];let se;return t[24]===Symbol.for(`react.memo_cache_sentinel`)?(se=()=>l(!1),t[24]=se):se=t[24],(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(je,{isOpen:c,title:T.title.value,size:`md`,onClose:oe,padding:`md`,children:(0,H.jsxs)(`form`,{className:`size-full`,children:[(0,H.jsx)(`p`,{className:`py-4 text-muted-foreground text-sm`,children:T.message}),(0,H.jsxs)(`div`,{className:`mt-12 flex justify-end gap-2 max-md:flex-col`,children:[(0,H.jsx)(M,{label:T.cancelButton.label.value,disabled:!te||_,color:`text`,className:`max-md:w-full`,variant:`outline`,onClick:se,children:T.cancelButton.text}),(0,H.jsx)(M,{label:T.confirmButton.label.value,disabled:!te||_||!k,Icon:ic,color:`text`,className:`max-md:w-full`,isLoading:g,onClick:ne,children:T.confirmButton.text})]})]})}),(0,H.jsxs)(`form`,{className:R(`flex justify-end gap-2`,i),...s,children:[r.includes(`remote`)&&N&&a&&E&&(0,H.jsx)(M,{label:b.label.value,Icon:oc,color:`error`,variant:`outline`,className:`max-md:w-full`,isLoading:f,onClick:ae,disabled:!ee,children:b.text}),te&&(0,H.jsx)(M,{label:x.label.value,disabled:!te,Icon:rc,variant:`outline`,color:`text`,className:`max-md:w-full`,onClick:()=>y(n.localId),children:x.text}),r.includes(`local`)&&(0,H.jsx)(M,{label:w.label.value,disabled:!te||_,Icon:Xs,color:`text`,variant:E?`outline`:`default`,className:`max-md:w-full`,isLoading:m,onClick:()=>l(!0),children:w.text}),r.includes(`remote`)&&E&&!N&&(0,H.jsx)(M,{label:C.label.value,disabled:_||!k,Icon:qs,color:`text`,className:`max-md:w-full`,isLoading:g,onClick:ie,children:C.text}),r.includes(`remote`)&&E&&N&&te&&(0,H.jsx)(M,{label:S.label.value,disabled:!te||_||!k,Icon:ic,color:`text`,className:`max-md:w-full`,isLoading:g,onClick:ie,children:S.text})]})]})},vO=(e,t=2e3,n,r)=>{let[i,a]=(0,z.useState)(!1);return{isCopied:i,copy:async()=>{if(e)try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else{r?.(Error(`Clipboard API not supported in this browser`));return}a(!0),setTimeout(()=>a(!1),t),n?.()}catch(e){let t=e instanceof Error?e.message:`Failed to copy to clipboard`;r?.(e instanceof Error?e:Error(t))}}}},yO=({text:e,children:t,className:n,"aria-label":r=`Copy to clipboard`,"aria-copied-label":i=`Copied to clipboard`,feedbackDuration:a=2e3,onCopySuccess:o,onCopyError:s,disable:c,preventDefault:l=!0,stopPropagation:u=!0,size:d=14})=>{let{isCopied:f,copy:p}=vO(e,a,o,s);if(c)return(0,H.jsx)(`span`,{className:n,children:t});let m=e=>{(e.key===`Enter`||e.key===` `)&&h(e)},h=e=>{l&&e.preventDefault(),u&&e.stopPropagation(),p()},g=f?i:r,_=f?he:de;return(0,H.jsxs)(`span`,{className:R(`inline-flex max-w-full cursor-pointer items-center gap-2 rounded-md p-0.5 hover:bg-neutral/10`,n),onClick:h,onKeyDown:m,role:`button`,tabIndex:0,"aria-label":g,"aria-pressed":f,"data-testid":`copy-to-clipboard`,children:[(0,H.jsx)(`span`,{className:`min-w-0 break-all`,children:t}),e&&(0,H.jsx)(_,{className:`ml-1 ml-auto shrink-0`,size:d,"aria-hidden":`true`})]})},bO=Ze([`appearance-none`,`relative cursor-pointer border-2`,`focus:outline-0`,`checked:hover:opacity-80`,`ring-offset-background`,`hover:bg-neutral-500/10`,`disabled:opacity-50`,`ring-0 transition-all duration-300 ease-in-out hover:ring-4 focus-visible:ring-6`,`checked:before:absolute checked:before:inset-0 checked:before:content-['✓']`,`checked:before:flex checked:before:items-center checked:before:justify-center`,`checked:before:text-foreground-opposite/80`,`rounded-xl [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-2xl`,`after:absolute after:-inset-2 after:content-['']`].join(` `),{variants:{variant:{default:``},size:{xs:`size-3 rounded-sm`,sm:`size-4 rounded-md`,md:`size-5 rounded-lg`,lg:`size-6 rounded-xl`},color:{primary:`border-primary/30 text-primary ring-primary/20 checked:border-primary checked:bg-primary`,secondary:`border-secondary/30 text-secondary ring-secondary/20 checked:border-secondary checked:bg-secondary`,neutral:`border-neutral/30 text-muted-foreground ring-neutral/20 checked:border-neutral checked:bg-neutral`,light:`border-white/30 text-white ring-white/20 checked:border-white checked:bg-white`,text:`border-text/30 text-foreground ring-text/20 checked:border-text checked:bg-text`,"text-inverse":`border-text-inverse/30 text-foreground-inverse ring-text-inverse/20 checked:border-text-inverse checked:bg-text-inverse`,dark:`border-neutral-800/30 text-neutral-800 ring-neutral-800/20 checked:border-neutral-800 checked:bg-neutral-800`,error:`border-error/30 text-error ring-error/20 checked:border-error checked:bg-error`,success:`border-success/30 text-success ring-success/20 checked:border-success checked:bg-success`,custom:`border-custom/30 text-custom ring-custom/20 checked:border-custom checked:bg-custom`},validationStyleEnabled:{disabled:``,enabled:`valid:border-success invalid:border-error`}},defaultVariants:{variant:`default`,color:`text`,validationStyleEnabled:`disabled`,size:`md`}}),xO=({validationStyleEnabled:e=!1,label:t,size:n,color:r,name:i,variant:a,className:o,labelClassName:s,...c})=>(0,H.jsx)(`input`,{type:`checkbox`,className:R(bO({variant:a,size:n,color:r,validationStyleEnabled:e?`enabled`:`disabled`}),o),...c}),SO=e=>{let{label:t,name:n,id:r}=e;return t?(0,H.jsxs)(`label`,{htmlFor:r??n,className:R(`flex w-full cursor-pointer items-center gap-x-4 font-medium text-sm`,e.size===`xs`&&`text-xs`,e.labelClassName),children:[(0,H.jsx)(xO,{id:r??n,...e}),t]}):(0,H.jsx)(xO,{id:r??n,...e})},CO=e=>(0,H.jsx)(Wv,{id:e.name,"data-testid":e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,Element:Wp,...e}),wO=e=>(0,H.jsx)(Wv,{id:e.name,"data-testid":e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,Element:Ip,...e}),TO=e=>{let t=(0,V.c)(38),{titleRequiredError:n,titleInvalidTypeError:r,titleMinLengthError:i,keyRequiredError:a,keyInvalidTypeError:o,keySpaceError:s,keyMinLengthError:c,descriptionRequiredError:l,descriptionInvalidTypeError:u,requiredErrorProjectId:d,invalidTypeErrorProjectId:f,invalidTypeErrorTags:p,locationRequiredError:m,locationInvalidTypeError:h,filePathRequiredError:g,filePathInvalidTypeError:_}=F(`dictionary-detail-schema`),v;if(t[0]!==u||t[1]!==l||t[2]!==_||t[3]!==g||t[4]!==f||t[5]!==p||t[6]!==o||t[7]!==c.value||t[8]!==a||t[9]!==s.value||t[10]!==h||t[11]!==m||t[12]!==e||t[13]!==d||t[14]!==r||t[15]!==i.value||t[16]!==n){let y;t[18]!==r||t[19]!==n?(y=e=>e.input===void 0?n.value:r.value,t[18]=r,t[19]=n,t[20]=y):y=t[20];let b;t[21]!==o||t[22]!==a?(b=e=>e.input===void 0?a.value:o.value,t[21]=o,t[22]=a,t[23]=b):b=t[23];let x;t[24]!==u||t[25]!==l?(x=e=>e.input===void 0?l.value:u.value,t[24]=u,t[25]=l,t[26]=x):x=t[26];let S;t[27]!==f||t[28]!==d?(S=e=>e.input===void 0?d.value:f.value,t[27]=f,t[28]=d,t[29]=S):S=t[29];let C;t[30]===p?C=t[31]:(C=()=>p.value,t[30]=p,t[31]=C);let w;t[32]!==h||t[33]!==m?(w=e=>e.input===void 0?m.value:h.value,t[32]=h,t[33]=m,t[34]=w):w=t[34];let T;t[35]!==_||t[36]!==g?(T=e=>e.input===void 0?g.value:_.value,t[35]=_,t[36]=g,t[37]=T):T=t[37],v=GT({title:pT({error:y}).refine(EO,{error:i.value}).optional(),key:pT({error:b}).min(4,{error:c.value}).regex(/^[a-zA-Z0-9-_]+$/,{error:s.value}).default(``),description:pT({error:x}).optional(),projectIds:UT(pT({error:S})).default([e]),tags:UT(pT({error:C})).default([]),location:ZT([`local`,`remote`,`hybrid`,`plugin`],{error:w}).optional(),importMode:ZT([`static`,`dynamic`,`fetch`]).optional(),filePath:pT({error:T}).optional()}),t[0]=u,t[1]=l,t[2]=_,t[3]=g,t[4]=f,t[5]=p,t[6]=o,t[7]=c.value,t[8]=a,t[9]=s.value,t[10]=h,t[11]=m,t[12]=e,t[13]=d,t[14]=r,t[15]=i.value,t[16]=n,t[17]=v}else v=t[17];return v};function EO(e){return e.length===0||e.length>=4}var DO=[`collection`,`variant`],OO=e=>{let t=[];return e.item!==void 0&&t.push(`collection`),e.variant!==void 0&&t.push(`variant`),t},kO=e=>typeof e==`object`&&e?JSON.stringify(e):e??``,AO=e=>{if(e.trim().startsWith(`{`))try{return{variant:JSON.parse(e),error:!1}}catch{return{variant:e,error:!0}}return{variant:e,error:!1}},jO=({dictionary:e,mode:t,onSelectSibling:n})=>{let{session:r}=$f(),{project:i}=r??{},{data:a,isLoading:o}=pp(),{data:s}=mp(),c=a?.data??[],l=s?.data??[],u=TO(String(i?.id)),{form:d,isSubmitting:f}=cy(u,{defaultValues:{...e,location:e.location??`remote`}}),{editedContent:p,setEditedDictionary:h}=Bf(),{titleInput:g,keyInput:_,descriptionInput:v,projectInput:y,tagsSelect:x,locationSelect:S,importModeSelect:C,filePathInput:w,auditButton:T,qualifierSection:E,siblingDictionaries:D,typeSwitch:O}=F(`dictionary-details`),{mutate:k,isPending:ee}=rp(),A=p?.[e.localId],{data:j,isLoading:te}=cp({keys:[e.key]},{enabled:!!e.key}),N=(0,z.useMemo)(()=>(j?.data??[]).filter(t=>t.localId!==e.localId),[j,e.localId]),P=(0,z.useMemo)(()=>N.filter(e=>e.item!==void 0).sort((e,t)=>(e.item??0)-(t.item??0)),[N]),ne=(0,z.useMemo)(()=>N.filter(e=>e.variant!==void 0),[N]),re=(0,z.useMemo)(()=>e.item===void 0?P:[e,...P].sort((e,t)=>(e.item??0)-(t.item??0)),[e,P]),ie=(0,z.useMemo)(()=>e.variant===void 0?ne:[e,...ne],[e,ne]);(0,z.useEffect)(()=>{d.reset({...e,tags:e.tags??[],location:e.location??`remote`}),le(OO(e)),de(e.item??1),pe(kO(e.variant)),he(!1),_e(!1)},[e,d?.reset]),(0,z.useEffect)(()=>{A===void 0&&d.reset({...e,tags:e.tags??[],location:e.location??`remote`})},[A]);let I=()=>{let t={...e,...A};k({fileContent:JSON.stringify(t)},{onSuccess:e=>{if(!e?.data)return;let n=e.data.fileContent,r={...t,...n,tags:n.tags??t.tags??[]};h(r),d.reset(r)}})},ae=C_({control:d.control,name:`location`}),oe=ae===`local`||ae===`hybrid`,se=N.length>0,[ce,le]=(0,z.useState)(()=>OO(e)),[ue,de]=(0,z.useState)(e.item??1),[fe,pe]=(0,z.useState)(kO(e.variant)),[me,he]=(0,z.useState)(!1),[ge,_e]=(0,z.useState)(!1),ve=(0,z.useMemo)(()=>[...P,...ne],[P,ne]),ye=t=>{let n=[t].flat(),r=n.filter(e=>!ce.includes(e)),i=ce.filter(e=>!n.includes(e)),a={...e,...A??{}};for(let e of i)e===`collection`&&(a={...a,item:void 0}),e===`variant`&&(a={...a,variant:void 0});for(let e of r)if(e===`collection`){let e=re.length>0?Math.max(...re.map(e=>e.item??0))+1:1;de(e),a={...a,item:e}}else if(e===`variant`){let e=fe||`default`;pe(e),a={...a,variant:AO(e).variant}}le(n),h(a),he(!1),n.length===0&&ve.length>0?_e(!0):_e(!1)};return(0,H.jsxs)(ly,{className:`flex w-full flex-col gap-8`,...d,schema:u,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[(0,H.jsx)(CO,{name:`key`,label:_.label,placeholder:_.label.value,description:_.description,disabled:f,isRequired:!0,onSave:t=>{d.setValue(`key`,t,{shouldDirty:!0}),h({...e,...A??{},key:t})}}),(0,H.jsx)(CO,{name:`title`,label:g.label,placeholder:g.placeholder.value,description:g.description,disabled:f,onSave:t=>{d.setValue(`title`,t,{shouldDirty:!0}),h({...e,...A??{},title:t})}})]}),(0,H.jsx)(wO,{name:`description`,label:v.label,placeholder:v.placeholder.value,description:v.description,disabled:f,onSave:t=>{d.setValue(`description`,t,{shouldDirty:!0}),h({...e,...A??{},description:t})}}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-8 px-1 max-md:grid-cols-1`,children:[(0,H.jsx)(Nv,{control:d.control,name:`location`,render:({field:n})=>{let r=n.value,i=r===`local`||r===`hybrid`,a=r===`remote`||r===`hybrid`,o=t=>{if(!t&&!a)return;let r=t?a?`hybrid`:`local`:`remote`;n.onChange(r);let i=t?d.getValues(`filePath`)??e.filePath:void 0;t||d.setValue(`filePath`,void 0),h({...e,...A??{},location:r,filePath:i})},s=t=>{if(!t&&!i)return;let r=t?i?`hybrid`:`remote`:`local`;n.onChange(r),h({...e,...A??{},location:r})};return(0,H.jsxs)(zg,{className:`flex flex-col gap-2 px-1`,children:[(0,H.jsx)(Vv,{className:`ml-1`,children:S.label}),(0,H.jsxs)(`div`,{className:`ml-2 flex items-center gap-4 py-2`,children:[(0,H.jsx)(SO,{id:`location-local`,name:`location-local`,label:S.local.value,color:`text`,checked:i,disabled:!t.includes(`local`)&&!t.includes(`remote`),onChange:e=>o(e.target.checked)}),(0,H.jsx)(SO,{id:`location-remote`,name:`location-remote`,label:S.remote.value,color:`text`,checked:a,disabled:!t.includes(`remote`)&&e.location!==`remote`&&e.location!==`hybrid`,onChange:e=>s(e.target.checked)})]}),(0,H.jsx)(Iv,{children:S.testDescription}),(0,H.jsx)(Lv,{})]})}}),(0,H.jsx)(Ec,{mode:`wait`,children:oe&&(0,H.jsx)(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.3},children:(0,H.jsx)(Gv,{name:`filePath`,label:w.label.value,placeholder:w.placeholder.value,description:w.description.value,disabled:f||!oe,onChange:t=>{let n=t.target.value;h({...e,...A??{},filePath:n})}})},`filePath-input`)})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:(0,H.jsxs)(Yv,{name:`importMode`,label:C.label.value,description:C.description.value,onValueChange:t=>{d.setValue(`importMode`,t,{shouldDirty:!0}),h({...e,...A??{},importMode:t})},children:[(0,H.jsx)(L.Trigger,{children:(0,H.jsx)(L.Value,{placeholder:C.label.value})}),(0,H.jsxs)(L.Content,{children:[(0,H.jsx)(L.Item,{value:`static`,children:C.static.value}),(0,H.jsx)(L.Item,{value:`dynamic`,children:C.dynamic.value}),(0,H.jsx)(L.Item,{value:`live`,children:C.live.value})]})]})}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-8 max-md:grid-cols-1`,children:[(0,H.jsxs)(qv,{name:`projectIds`,label:y.label.value,description:y.description,onValueChange:t=>{let n=[t].flat();d.setValue(`projectIds`,n,{shouldDirty:!0}),h({...e,...A??{},projectIds:n})},children:[(0,H.jsx)(Lg.Trigger,{getBadgeValue:e=>c?.find(t=>String(t.id)===e)?.name??e,children:(0,H.jsx)(Lg.Input,{placeholder:y.placeholder.value})}),(0,H.jsx)(Lg.Content,{children:(0,H.jsx)(m,{isLoading:o,children:(0,H.jsx)(Lg.List,{children:c?.map(e=>(0,H.jsx)(Lg.Item,{value:String(e.id),children:e.name},String(e.id)))})})})]}),(0,H.jsxs)(qv,{name:`tags`,label:x.label.value,description:x.description,onValueChange:t=>{let n=[t].flat();d.setValue(`tags`,n,{shouldDirty:!0}),h({...e,...A??{},tags:n})},children:[(0,H.jsx)(Lg.Trigger,{getBadgeValue:e=>l?.find(t=>String(t.key)===e)?.name??e,children:(0,H.jsx)(Lg.Input,{placeholder:x.placeholder.value})}),(0,H.jsx)(Lg.Content,{children:(0,H.jsx)(m,{isLoading:o,children:(0,H.jsx)(Lg.List,{children:l?.map(e=>(0,H.jsx)(Lg.Item,{value:String(e.key),children:e.name??e.key},String(e.key)))})})})]})]}),(0,H.jsxs)(Ne,{className:`gap-4`,padding:`md`,roundedSize:`2xl`,background:`none`,border:!0,borderColor:`card`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`p`,{className:`ml-1 font-semibold text-sm`,children:O.label}),(0,H.jsx)(`p`,{className:`ml-1 text-muted text-xs`,children:O.description})]}),(0,H.jsxs)(Lg,{values:ce,onValueChange:ye,className:`max-w-xs`,children:[(0,H.jsx)(Lg.Trigger,{getBadgeValue:e=>e===`collection`?String(O.collection):e===`variant`?String(O.variant):e,children:(0,H.jsx)(Lg.Input,{placeholder:O.label.value})}),(0,H.jsx)(Lg.Content,{children:(0,H.jsx)(Lg.List,{children:DO.map(e=>(0,H.jsx)(Lg.Item,{value:e,children:O[e].value},e))})})]}),(0,H.jsxs)(Ec,{children:[ce.includes(`collection`)&&(0,H.jsx)(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2},children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,H.jsx)(`label`,{htmlFor:`qualifier-item-value`,className:`ml-1 font-medium text-sm`,children:O.itemValueLabel}),(0,H.jsx)(Ap,{id:`qualifier-item-value`,type:`number`,min:1,value:ue,placeholder:O.itemValuePlaceholder.value,onChange:t=>{let n=parseInt(t.target.value,10);!Number.isNaN(n)&&n>=1&&(de(n),h({...e,...A??{},item:n}))}})]})},`item-input`),ce.includes(`variant`)&&(0,H.jsx)(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2},children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,H.jsx)(`label`,{htmlFor:`qualifier-variant-value`,className:`ml-1 font-medium text-sm`,children:O.variantValueLabel}),(0,H.jsx)(Ap,{id:`qualifier-variant-value`,type:`text`,value:fe,placeholder:O.variantValuePlaceholder.value,onChange:t=>{let n=t.target.value;pe(n);let{variant:r,error:i}=AO(n);he(i),i||h({...e,...A??{},variant:r})}}),me&&(0,H.jsx)(`p`,{className:`ml-1 text-destructive text-xs`,children:O.variantJsonError})]})},`variant-input`),ce.length===0&&ge&&(0,H.jsx)(b.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:`auto`},exit:{opacity:0,height:0},transition:{duration:.2},children:(0,H.jsxs)(Ne,{background:`none`,border:!0,borderColor:`neutral`,roundedSize:`xl`,padding:`md`,className:`gap-3`,children:[(0,H.jsx)(`p`,{className:`font-medium text-sm`,children:O.disablePickerTitle}),(0,H.jsx)(`p`,{className:`text-muted text-xs`,children:O.disablePickerDescription}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ve.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>{n?.(e),_e(!1)},className:`cursor-pointer rounded-lg border border-border px-3 py-1 text-xs transition-colors hover:bg-text/10`,children:[e.variant!==void 0&&(0,H.jsxs)(`span`,{children:[E.variant,`:`,` `,kO(e.variant)]}),e.item!==void 0&&(0,H.jsxs)(`span`,{children:[E.item,`: `,e.item]})]},e.localId))})]})},`sibling-picker`)]})]}),(0,H.jsxs)(Ne,{className:`gap-4`,padding:`md`,roundedSize:`2xl`,background:`none`,border:!0,borderColor:`neutral`,children:[(0,H.jsx)(`p`,{className:`font-semibold text-sm`,children:D.title}),(0,H.jsxs)(m,{isLoading:te,children:[!se&&(0,H.jsx)(`p`,{className:`text-muted text-sm`,children:D.noSiblings}),re.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`p`,{className:`font-medium text-muted text-xs uppercase tracking-wide`,children:D.collectionItems}),(0,H.jsx)(cO,{currentPage:re.findIndex(t=>t.localId===e.localId)+1||1,totalPages:re.length,onPageChange:e=>{let t=re[e-1];t&&n&&n(t)},showPrevNext:!0}),(0,H.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:re.map(t=>{let r=t.localId===e.localId;return(0,H.jsxs)(`button`,{type:`button`,onClick:()=>!r&&n?.(t),className:R(`rounded-lg px-3 py-1 text-xs transition-colors`,r?`bg-text font-semibold text-foreground-opposite`:`cursor-pointer border border-border hover:bg-text/10`),children:[D.itemIndex,` `,t.item]},t.localId)})})]}),ie.length>0&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`p`,{className:`font-medium text-muted text-xs uppercase tracking-wide`,children:D.variants}),(0,H.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(t=>{let r=t.localId===e.localId;return(0,H.jsx)(`button`,{type:`button`,onClick:()=>!r&&n?.(t),className:R(`rounded-lg px-3 py-1 text-xs transition-colors`,r?`bg-text font-semibold text-foreground-opposite`:`cursor-pointer border border-border hover:bg-text/10`),children:kO(t.variant)},t.localId)})})]})]})]}),(0,H.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 max-md:flex-col`,children:(0,H.jsx)(M,{type:`button`,size:`icon-md`,label:T.label.value,Icon:sc,variant:`outline`,color:`text`,className:`max-md:w-full`,onClick:I,disabled:f||ee,isLoading:ee})})]})},MO=(0,z.lazy)(()=>Ct(()=>import(`./dist-CMBnegHe.js`).then(e=>({default:e.Editor})),__vite__mapDeps([7,2]))),NO=({children:e,language:t,isDarkMode:n,showLineNumbers:r,showCopyButton:i=!0,isReadOnly:a=!1,onChange:o})=>{let s=(0,z.useRef)(null),c=(0,z.useRef)(null),[l,u]=(0,z.useState)({height:0,width:0}),d=n?`vs-dark-transparent`:`hc-light-theme`,f=(e,t)=>{c.current=e;let n=(e.getContentHeight()??0)+25;t.editor.defineTheme(`vs-dark-transparent`,{base:`vs-dark`,inherit:!0,rules:[],colors:{"editor.background":`#00000000`}}),t.editor.defineTheme(`hc-light-theme`,{base:`vs`,inherit:!0,rules:[],colors:{"editor.background":`#00000000`}}),t.editor.setTheme(d),t.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0}),t.languages.typescript.javascriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0}),t.languages.typescript.typescriptDefaults.setCompilerOptions({noLib:!0,allowNonTsExtensions:!0}),t.languages.typescript.javascriptDefaults.setCompilerOptions({noLib:!0,allowNonTsExtensions:!0}),u({height:n,width:s.current?.clientWidth??0})},p=r??(typeof e==`string`&&e.split(`
|
|
108
|
+
`).length>1);return(0,H.jsxs)(`div`,{className:R(`relative size-full text-sm`,r&&`ml-0`),children:[i&&(0,H.jsx)(`div`,{className:`sticky top-5 z-10`,children:(0,H.jsx)(`div`,{className:R(`absolute right-2 bottom-0 flex h-7 items-center`),children:(0,H.jsx)(ze,{content:e})})}),(0,H.jsx)(`div`,{className:`z-0 grid size-full grid-cols-[0px] overflow-auto`,ref:s,children:(0,H.jsx)(z.Suspense,{fallback:(0,H.jsx)(m,{}),children:(0,H.jsx)(MO,{...l,defaultLanguage:`typescript`,language:t,loading:(0,H.jsx)(m,{}),defaultValue:String(e).replace(/\n$/,``),onMount:f,onChange:o,options:{contextmenu:!1,readOnly:a,cursorStyle:`line`,minimap:{enabled:!1},scrollbar:{vertical:`hidden`,verticalScrollbarSize:0,alwaysConsumeMouseWheel:!1},folding:!1,renderValidationDecorations:`off`,quickSuggestions:!1,parameterHints:{enabled:!1},suggestOnTriggerCharacters:!1,mouseWheelScrollSensitivity:0,fastScrollSensitivity:0,scrollBeyondLastLine:!1,lineNumbers:p?`on`:`off`},theme:d,className:`my-2 rounded-md`})})})]})},PO=e=>{let t=(0,V.c)(7),{dictionary:n,isDarkMode:r}=e,{setEditedContent:i,editedContent:a}=Bf(),o=FO,s=a?.[n.localId]?.content??n?.content,c;t[0]!==n||t[1]!==i?(c=e=>{o(e??`{}`)&&i(n.localId,JSON.parse(e??`{}`))},t[0]=n,t[1]=i,t[2]=c):c=t[2];let l;return t[3]!==s||t[4]!==r||t[5]!==c?(l=(0,H.jsx)(NO,{language:`json`,onChange:c,isDarkMode:r,children:JSON.stringify(s,null,2)}),t[3]=s,t[4]=r,t[5]=c,t[6]=l):l=t[6],l};function FO(e){try{return JSON.parse(e),!0}catch{return!1}}var IO=e=>{let t=(0,V.c)(24),{section:n,onValueChange:r}=e,{multilingual:i,text:a,number:o,boolean:s,node:c,array:u,enumeration:d,plural:f,triggerPlaceHolder:p,nest:m,gender:g,select:v,condition:y,markdown:b,insertion:S,reactNode:w,file:T}=F(`node-type-selector`),E;t[0]===n?E=t[1]:(E=zt(n),t[0]=n,t[1]=E);let[O,ee]=(0,z.useState)(E),j;t[2]===r?j=t[3]:(j=e=>{ee(e),r(e)},t[2]=r,t[3]=j);let te=j,M;return t[4]!==u||t[5]!==s||t[6]!==y||t[7]!==d||t[8]!==T||t[9]!==g||t[10]!==S||t[11]!==O||t[12]!==b||t[13]!==i||t[14]!==m||t[15]!==c||t[16]!==o||t[17]!==te||t[18]!==f||t[19]!==w||t[20]!==v||t[21]!==a||t[22]!==p?(M=(0,H.jsxs)(L,{value:O,onValueChange:te,children:[(0,H.jsx)(L.Trigger,{children:(0,H.jsx)(L.Value,{placeholder:p})}),(0,H.jsxs)(L.Content,{children:[(0,H.jsx)(L.Item,{value:ge,children:i}),(0,H.jsx)(L.Item,{value:fe,children:a}),(0,H.jsx)(L.Item,{value:oe,children:o}),(0,H.jsx)(L.Item,{value:A,children:s}),(0,H.jsx)(L.Item,{value:ue,children:c}),(0,H.jsx)(L.Item,{value:k,children:u}),(0,H.jsx)(L.Item,{value:h,children:d}),(0,H.jsx)(L.Item,{value:_,children:f}),(0,H.jsx)(L.Item,{value:D,children:g}),(0,H.jsx)(L.Item,{value:C,children:v}),(0,H.jsx)(L.Item,{value:it,children:S}),(0,H.jsx)(L.Item,{value:l,children:b}),(0,H.jsx)(L.Item,{value:ce,children:m}),(0,H.jsx)(L.Item,{value:N,children:y}),(0,H.jsx)(L.Item,{value:We,disabled:!0,children:w}),(0,H.jsx)(L.Item,{value:x,children:T})]})]}),t[4]=u,t[5]=s,t[6]=y,t[7]=d,t[8]=T,t[9]=g,t[10]=S,t[11]=O,t[12]=b,t[13]=i,t[14]=m,t[15]=c,t[16]=o,t[17]=te,t[18]=f,t[19]=w,t[20]=v,t[21]=a,t[22]=p,t[23]=M):M=t[23],M},LO=e=>{let t=(0,V.c)(15),{section:n,dictionaryLocalId:r,keyPath:i,onNodeTypeChange:a}=e,o=Rf()?.internationalization?.locales??[],s=zt(n),c=Ft(n),l=e=>{a(Nt(s,o,e))};if(s===`translation`||s===`condition`||s===`gender`||s===`select`||s===`enumeration`||s===`plural`){let e=Object.keys(n[s])[0],t=[...i,{type:s,key:e}];return(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,H.jsx)(IO,{section:n,onValueChange:e=>a(Nt(e,o))}),(0,H.jsx)(LO,{section:c,keyPath:t,dictionaryLocalId:r,onNodeTypeChange:l})]})}if(s===`array`){let e=[...i,{type:s,key:0}];return(0,H.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,H.jsx)(IO,{section:n,onValueChange:e=>a(Nt(e,o))}),(0,H.jsx)(LO,{section:c,keyPath:e,dictionaryLocalId:r,onNodeTypeChange:l})]})}if(s===`object`){let e;if(t[0]!==r||t[1]!==i||t[2]!==o||t[3]!==a||t[4]!==n){let s;t[6]!==o||t[7]!==a?(s=e=>a(Nt(e,o)),t[6]=o,t[7]=a,t[8]=s):s=t[8],e=(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(IO,{section:n,onValueChange:s}),(0,H.jsx)(`div`,{className:`mt-6 ml-10`,children:(0,H.jsx)(BO,{keyPath:i,section:n,dictionaryLocalId:r})})]}),t[0]=r,t[1]=i,t[2]=o,t[3]=a,t[4]=n,t[5]=e}else e=t[5];return e}let u;t[9]!==o||t[10]!==a?(u=e=>a(Nt(e,o)),t[9]=o,t[10]=a,t[11]=u):u=t[11];let d;return t[12]!==n||t[13]!==u?(d=(0,H.jsx)(IO,{section:n,onValueChange:u}),t[12]=n,t[13]=u,t[14]=d):d=t[14],d},RO=e=>{let t=(0,V.c)(23),{sectionKey:n,section:r,keyPath:i,dictionaryLocalId:a}=e,{focusedContent:o,setFocusedContentKeyPath:s}=Ff(),{renameEditedContent:c,addEditedContent:l}=zf(),{titleInput:u,deleteButton:d}=F(`structure-view`),f;t[0]!==a||t[1]!==i||t[2]!==c||t[3]!==s?(f=e=>{c(a,e,i);let t=i.slice(0,-1),n=i[i.length-1],r=[...t,{...n,key:e}];s(r)},t[0]=a,t[1]=i,t[2]=c,t[3]=s,t[4]=f):f=t[4];let p=f,m;if(t[5]!==l||t[6]!==d||t[7]!==a||t[8]!==o?.keyPath||t[9]!==p||t[10]!==i||t[11]!==r||t[12]!==n||t[13]!==s||t[14]!==u){let e;t[16]!==i||t[17]!==s?(e=()=>s(i),t[16]=i,t[17]=s,t[18]=e):e=t[18];let c;t[19]!==l||t[20]!==a||t[21]!==i?(c=e=>{l(a,e,i)},t[19]=l,t[20]=a,t[21]=i,t[22]=c):c=t[22],m=(0,H.jsx)(Ne,{transparency:`xl`,roundedSize:`2xl`,className:`w-full min-w-80 gap-2 overflow-auto px-5 py-2`,border:!0,borderColor:`text`,background:`none`,"aria-selected":Et(i,o?.keyPath??[]),onClick:e,children:(0,H.jsxs)(`div`,{className:`flex w-full flex-col items-start justify-between gap-3`,children:[typeof n==`string`&&(0,H.jsxs)(`div`,{className:`w-full`,children:[(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-between gap-10`,children:[(0,H.jsx)(Wp,{name:`key`,"aria-label":`Key`,placeholder:u.placeholder.value,defaultValue:n,onSave:e=>p(e),variant:`invisible`}),(0,H.jsx)(M,{label:d.label.value,variant:`hoverable`,size:`icon-sm`,color:`text`,className:`translate-x-2`,Icon:oc,onClick:()=>{l(a,void 0,i);let e=i.slice(0,-1);s(e)}})]}),(0,H.jsxs)(`span`,{className:`ml-3 text-muted-foreground text-sm`,children:[`( `,Dt(n),` )`]})]}),(0,H.jsx)(LO,{keyPath:i,dictionaryLocalId:a,section:r,onNodeTypeChange:c})]})}),t[5]=l,t[6]=d,t[7]=a,t[8]=o?.keyPath,t[9]=p,t[10]=i,t[11]=r,t[12]=n,t[13]=s,t[14]=u,t[15]=m}else m=t[15];return m},zO=e=>{let t=(0,V.c)(14),{section:n,keyPath:r,dictionaryLocalId:i}=e,{addNodeButton:a}=F(`structure-view`),{setFocusedContentKeyPath:o}=Ff(),{addEditedContent:s}=zf();if(!n||typeof n!=`object`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{children:`Not an object`}),t[0]=e):e=t[0],e}let c;if(t[1]!==s||t[2]!==a.label.value||t[3]!==a.text||t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==o){let e;t[9]!==s||t[10]!==i||t[11]!==r||t[12]!==o?(e=()=>{let e=[...r,{type:ue,key:`newKey`}];s(i,``,e),o(e)},t[9]=s,t[10]=i,t[11]=r,t[12]=o,t[13]=e):e=t[13],c=(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 overflow-y-auto`,children:[(0,H.jsx)(`ul`,{className:`mr-auto flex flex-col gap-4`,children:Object.keys(n).map(e=>(0,H.jsx)(`li`,{className:`flex w-full`,children:(0,H.jsx)(RO,{sectionKey:e,section:n?.[e],keyPath:[...r,{type:ue,key:e}],dictionaryLocalId:i})},`${JSON.stringify(r)}-object-${e}`))}),(0,H.jsx)(M,{label:a.label.value,variant:`hoverable`,size:`md`,color:`text`,Icon:nc,className:`flex-1`,onClick:e,children:a.text})]}),t[1]=s,t[2]=a.label.value,t[3]=a.text,t[4]=i,t[5]=r,t[6]=n,t[7]=o,t[8]=c}else c=t[8];return c},BO=({section:e,keyPath:t,dictionaryLocalId:n})=>!e||typeof e!=`object`||typeof e.nodeType==`string`?(0,H.jsx)(RO,{sectionKey:`content`,section:e,keyPath:t,dictionaryLocalId:n}):(0,H.jsx)(zO,{section:e,keyPath:t,dictionaryLocalId:n}),VO=e=>{let t=(0,V.c)(3),{dictionary:n}=e,{content:r,localId:i}=n,{editedContent:a}=Bf(),o=a?.[i]?.content===void 0?r:a?.[i]?.content,s;return t[0]!==o||t[1]!==i?(s=(0,H.jsx)(RO,{section:o,keyPath:[],dictionaryLocalId:i}),t[0]=o,t[1]=i,t[2]=s):s=t[2],s},HO=({dictionary:e,onClickDictionaryList:t,isDarkMode:n,mode:r,onDelete:i,onSave:a,showReturnButton:o=!0,rightContent:s})=>{let c=Rf(),{returnToDictionaryList:l}=F(`dictionary-field-editor`),{focusedContent:u,setFocusedContent:d}=Ff(),{setLocaleDictionary:f}=Mf(),[p,m]=(0,z.useState)(`content`);return(0,z.useEffect)(()=>{d({...u??{},dictionaryKey:e.key,dictionaryLocalId:e.localId}),f(e)},[]),(0,H.jsx)(Tm,{availableLocales:c?.internationalization?.locales??[],children:(0,H.jsxs)(`div`,{className:`relative flex h-full min-h-0 w-full flex-1 flex-col md:overflow-hidden`,children:[o&&(0,H.jsx)(M,{onClick:t,variant:`hoverable`,className:`z-10 mr-auto mb-6 ml-5 shrink-0`,color:`text`,Icon:Ks,label:l.label.value,children:l.text}),(0,H.jsxs)(`div`,{className:`mb-22 flex min-h-0 flex-1 flex-col overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`sticky top-0 z-10 flex shrink-0 gap-3 rounded-xl bg-background/20 p-3 pb-4`,children:[(0,H.jsx)(Ge,{selectedChoice:p,tabs:[...r.includes(`remote`)?[(0,H.jsx)(`button`,{className:`cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none`,"data-active":p===`details`,onClick:()=>m(`details`),type:`button`,children:`Details`},`details`)]:[],(0,H.jsx)(`button`,{className:`cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none`,"data-active":p===`structure`,onClick:()=>m(`structure`),type:`button`,children:`Structure`},`structure`),(0,H.jsx)(`button`,{className:`cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none`,"data-active":p===`content`,onClick:()=>m(`content`),type:`button`,children:`Content`},`content`),(0,H.jsx)(`button`,{className:`cursor-pointer whitespace-nowrap rounded-md px-4 py-1 font-medium text-sm transition-colors focus:outline-none`,"data-active":p===`json`,onClick:()=>m(`json`),type:`button`,children:`JSON`},`json`)],hoverable:!0,color:`text`}),(0,H.jsx)(`div`,{className:`flex w-full items-center justify-end`,children:s})]}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,H.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col items-stretch gap-6`,children:[r.includes(`remote`)&&p===`details`&&(0,H.jsx)(jO,{dictionary:e,mode:r}),p===`structure`&&(0,H.jsx)(VO,{dictionary:e}),p===`content`&&(0,H.jsx)(pO,{dictionary:e}),p===`json`&&(0,H.jsx)(PO,{dictionary:e,isDarkMode:n})]})})]}),(0,H.jsx)(`div`,{className:`absolute bottom-3 z-20 w-full p-2`,children:(0,H.jsxs)(Ne,{color:`card`,roundedSize:`2xl`,padding:`sm`,className:`w-full shrink-0 flex-row flex-wrap items-center justify-end gap-10 bg-background/20 md:bottom-0`,children:[(0,H.jsx)(yO,{text:e.id,className:`text-nowrap text-muted-foreground text-sm`,size:9,children:e.id}),(0,H.jsx)(_O,{dictionary:e,mode:r,onDelete:()=>{d(null),i?.()},onSave:a})]})})]})})},UO=new class{listeners=new Set;drawers={};subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.drawers;isOpen=e=>!!this.drawers[e];open=e=>{this.drawers[e]||(this.drawers={...this.drawers,[e]:!0},this.emit())};close=e=>{this.drawers[e]&&(this.drawers={...this.drawers,[e]:!1},this.emit())};set=e=>{let t=!1,n={...this.drawers};for(let[r,i]of Object.entries(e))n[r]!==i&&(n[r]=i,t=!0);t&&(this.drawers=n,this.emit())};emit=()=>{this.listeners.forEach(e=>{e()})}},WO={open:UO.open,close:UO.close,set:UO.set},GO=()=>!1,KO=()=>WO,qO=e=>{let t=(0,V.c)(2),n;t[0]===e?n=t[1]:(n=()=>UO.isOpen(e),t[0]=e,t[1]=n);let r=n;return(0,z.useSyncExternalStore)(UO.subscribe,r,GO)},JO=()=>{let e=(0,V.c)(2),t=(0,z.useSyncExternalStore)(UO.subscribe,UO.getSnapshot,YO),n;return e[0]===t?n=e[1]:(n={...WO,isOpen:e=>!!t[e]},e[0]=t,e[1]=n),n};function YO(){return{}}var XO={xs:480,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},ZO=e=>typeof e==`number`?e:XO[e]??XO.md,QO=()=>{if(typeof window>`u`)return;let e=window.navigator?.userAgent;if(e!==void 0)return/android|bb\d+|meego|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(?:hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(?:ob|in)i|palm(?: os)?|phone|p(?:ixi|re)\/|plucker|pocket|psp|series(?:4|6)0|symbian|treo|up\.(?:browser|link)|vodafone|wap|windows ce|windows phone|xda|xiino|zte-/i.test(e)},$O=()=>{if(typeof window>`u`)return;let e=window.navigator?.userAgent;if(e!==void 0)return/iP(?:hone|ad|od)/.test(e)},ek=()=>{if(typeof window>`u`)return;let e=window.navigator?.userAgent;if(e!==void 0)return/Macintosh|MacIntel|Mac OS X/.test(e)},tk=Object.freeze({isMobileScreen:void 0,isMobileUserAgent:void 0,isMobile:void 0,isIOS:void 0,isMac:void 0}),nk,rk=()=>(nk??={isMobileUserAgent:QO(),isIOS:$O(),isMac:ek()},nk),ik=new Map,ak=e=>{let t=window.matchMedia(`(max-width: ${e}px)`),n=new Set,r=e=>({...rk(),isMobileScreen:e,isMobile:e}),i=r(t.matches),a=e=>i.isMobileScreen!==e&&(i=r(e),!0),o=e=>{if(a(e.matches))for(let e of n)e()};return{subscribe:e=>(n.size===0&&(a(t.matches),t.addEventListener(`change`,o)),n.add(e),()=>{n.delete(e),n.size===0&&t.removeEventListener(`change`,o)}),getSnapshot:()=>i}},ok=e=>{let t=ik.get(e);if(t)return t;let n=ak(e);return ik.set(e,n),n},sk=()=>tk,ck=e=>{let t=(0,V.c)(6),n=e===void 0?`md`:e,r;t[0]===n?r=t[1]:(r=ZO(n),t[0]=n,t[1]=r);let i=r,a;t[2]===i?a=t[3]:(a=e=>ok(i).subscribe(e),t[2]=i,t[3]=a);let o=a,s;return t[4]===i?s=t[5]:(s=()=>ok(i).getSnapshot(),t[4]=i,t[5]=s),(0,z.useSyncExternalStore)(o,s,sk)},lk=e=>e.split(` + `).map(e=>e.trim()),uk=e=>({"⌘":`Meta`,Ctrl:`Control`,Control:`Control`,Alt:`Alt`,"⌥":`Alt`,Shift:`Shift`,Meta:`Meta`,"↑":`ArrowUp`,"↓":`ArrowDown`,"←":`ArrowLeft`,"→":`ArrowRight`,ArrowUp:`ArrowUp`,ArrowDown:`ArrowDown`,ArrowLeft:`ArrowLeft`,ArrowRight:`ArrowRight`})[e]||e,dk=(e,t)=>{let n=t.map(uk),r={Meta:n.includes(`Meta`),Control:n.includes(`Control`),Alt:n.includes(`Alt`),Shift:n.includes(`Shift`)};if(r.Meta!==e.metaKey||r.Control!==e.ctrlKey||r.Alt!==e.altKey||r.Shift!==e.shiftKey)return!1;let i=t.find(e=>![`⌘`,`Ctrl`,`Control`,`Alt`,`⌥`,`Shift`,`Meta`].includes(uk(e)));if(!i)return!1;let a=uk(i);return a.startsWith(`Arrow`)?e.key===a:e.key.toLowerCase()===a.toLowerCase()},fk=e=>({ArrowUp:`↑`,ArrowDown:`↓`,ArrowLeft:`←`,ArrowRight:`→`})[e]||e,pk=(e,t)=>{let n=e;return t?(n=n.replace(/Ctrl/g,`⌘`),n=n.replace(/Alt/g,`⌥`)):(n=n.replace(/⌘/g,`Ctrl`),n=n.replace(/⌥/g,`Alt`)),n=n.replace(/ArrowUp/g,`↑`),n=n.replace(/ArrowDown/g,`↓`),n=n.replace(/ArrowLeft/g,`←`),n=n.replace(/ArrowRight/g,`→`),n},mk=({shortcut:e,onTriggered:t,display:n=!0,disabled:r=!1,className:i,size:a=`md`})=>{let{isMac:o}=ck(),s=lk(pk(e,o??!1)),[c,l]=(0,z.useState)(new Set);if((0,z.useEffect)(()=>{let e=e=>{let n=e.target,i=n.tagName===`INPUT`||n.tagName===`TEXTAREA`||n.isContentEditable,a=e.key,c=new Set;if(e.metaKey&&c.add(`⌘`),e.ctrlKey&&c.add(`Ctrl`),e.altKey&&c.add(o?`⌥`:`Alt`),e.shiftKey&&c.add(`Shift`),a.startsWith(`Arrow`)?(c.add(a),c.add(fk(a))):c.add(a.toUpperCase()),l(c),!r&&t&&dk(e,s)){let n=s.includes(`Escape`);if(i&&!n)return;e.preventDefault(),t()}},n=()=>{l(new Set)};return window.addEventListener(`keydown`,e),window.addEventListener(`keyup`,n),window.addEventListener(`blur`,n),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`keyup`,n),window.removeEventListener(`blur`,n)}},[s,t,o,r]),!n)return null;let u=e=>{let t=e.toUpperCase(),n=uk(e);return c.has(e)||c.has(t)||c.has(n)||e===`⌘`&&c.has(`Meta`)||e===`Ctrl`&&c.has(`Control`)||e===`⌥`&&c.has(`Alt`)||e===`Alt`&&c.has(`Alt`)||e===`←`&&c.has(`ArrowLeft`)||e===`→`&&c.has(`ArrowRight`)||e===`↑`&&c.has(`ArrowUp`)||e===`↓`&&c.has(`ArrowDown`)};return(0,H.jsx)(`kbd`,{className:R(`inline-flex items-center justify-center gap-0.5 p-0.5`,`rounded-lg [corner-shape:squircle] supports-[corner-shape:squircle]:rounded-xl`,`font-medium font-sans`,`border-1 text-neutral`,a===`sm`&&`text-xs`,a===`md`&&`text-sm`,a===`lg`&&`text-base`,i),children:s.map((t,n)=>{let r=`${t}-${n}-${e}`,i=fk(t);return(0,H.jsxs)(`span`,{className:`inline-flex items-center`,children:[n>0&&(0,H.jsx)(`span`,{className:`text-neutral/50`,children:`+`}),(0,H.jsx)(`span`,{className:R(`min-w-4 px-0.5 text-center`,u(t)&&`scale-120 font-bold text-foreground`),suppressHydrationWarning:!0,children:i})]},r)})})},hk=({children:e,isHidden:t,minWidth:n=0,align:r=`left`,isDisabled:i=!1,className:a,...o})=>{let s=t&&!i;return(0,H.jsx)(`div`,{className:R(`relative grid h-full grid-cols-[0fr] overflow-x-hidden overflow-y-hidden transition-[grid-template-columns] duration-500 ease-in-out`,s?``:`grid-cols-[1fr]`,a),"aria-hidden":s,inert:s?!0:void 0,...o,children:(0,H.jsx)(`div`,{style:{minWidth:`${n}px`},className:R(r===`right`&&`ml-auto`),children:e})})},gk=e=>{let t=e.getBoundingClientRect(),n=t.top,r=t.bottom-1;if(n>=0&&r<=window.innerHeight){let n=t.left+t.width/2,r=t.top+10,i=document.elementFromPoint(n,r);return e===i||e.contains(i)}return!1},_k=({title:e,identifier:t,children:n,header:r,footer:i,closeOnOutsideClick:a=!0,backButton:o,isOpen:s,onClose:c,container:l})=>{let u=F(`right-drawer`),{isMobile:d}=ck(`md`),f=(0,z.useRef)(null),p=(0,z.useRef)(null),m=Te(l),{open:h,close:g}=KO(),_=qO(t),v=_,[y,b]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!v){b(!1);return}let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>b(!0))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}},[v]);let x=v&&y;xe({disableScroll:v,key:t?`right_drawer_${t}`:`right_drawer`}),(0,z.useEffect)(()=>{if(!v)return;let e=e=>{try{if(!f.current)return;let n=a,r=e.target&&!f.current.contains(e.target),i=gk(f.current);(n&&r&&i||!e.target)&&(g(t),c?.())}catch{g(t),c?.()}};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[v,g,c,a,t]);let S=(0,z.useRef)(c);return(0,z.useEffect)(()=>{S.current=c},[c]),(0,z.useEffect)(()=>{s!==void 0&&s!==_&&(s?h(t):(g(t),S.current?.()))},[s,_,t,h,g]),m?(0,Xo.createPortal)((0,H.jsx)(`div`,{className:`fixed top-0 right-0 z-50 flex h-full justify-end`,children:(0,H.jsx)(hk,{isHidden:!x,align:`right`,children:(0,H.jsxs)(Ne,{className:`relative flex h-screen w-screen flex-col border-l text-foreground md:w-100`,ref:f,roundedSize:`none`,borderColor:`neutral`,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-3 px-6 pt-6`,children:[(0,H.jsxs)(`div`,{className:`flex justify-between gap-3`,children:[(0,H.jsx)(`div`,{children:o&&(0,H.jsx)(M,{variant:`hoverable`,color:`text`,label:o.text??u.goBack.value,onClick:o.onBack,Icon:Js,children:o?.text})}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(Ye,{identifier:`close-drawer`,children:[(0,H.jsx)(M,{variant:`hoverable`,color:`text`,label:`Close`,className:`ml-auto`,onClick:()=>{g(t),c?.()},Icon:pe,size:`icon-md`}),(0,H.jsx)(Ye.Detail,{identifier:`close-drawer`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-2 p-2`,children:[(0,H.jsx)(`span`,{className:`whitespace-nowrap text-muted-foreground text-xs`,children:u.closeDrawer}),(0,H.jsx)(mk,{shortcut:`Escape`,size:`sm`,onTriggered:()=>{g(t),c?.()}})]})})]})})]}),e&&(0,H.jsx)(`h2`,{className:`flex items-center justify-center font-bold text-lg`,children:e}),r]}),(0,H.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto p-2`,children:(0,H.jsx)(`div`,{className:`flex flex-1 flex-col outline-none`,onClick:e=>{e.target===e.currentTarget&&d&&(g(t),c?.())},onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d&&(g(t),c?.()))},ref:p,role:`button`,tabIndex:0,children:n})}),i&&(0,H.jsx)(`div`,{className:`shrink-0`,children:i})]})})}),m):(0,H.jsx)(H.Fragment,{})},vk=Ze(`w-fit backdrop-blur`,{variants:{roundedSize:{none:`rounded-none`,sm:`rounded-sm`,md:`rounded-md`,lg:`rounded-lg`,xl:`rounded-xl`,xxl:`rounded-2xl`,xxxl:`rounded-3xl`,full:`rounded-full`},color:{primary:`border-primary bg-primary/10 text-primary`,success:`border-success bg-success/10 text-success`,error:`border-error bg-error/10 text-error`,warning:`border-warning bg-warning/10 text-warning`,neutral:`/10 border-neutral bg-neutral/10 text-neutral`,text:`border-text bg-text/10 text-foreground`,black:`border-black bg-black/10 text-black`,white:`border-white bg-white/10 text-white`},size:{xs:`border-[1.2px] px-2 py-0.5 text-xs`,sm:`border-[1.3px] px-2 py-0.5 text-sm`,md:`border-2 px-2 py-1 text-base`,lg:`border-2 px-3 py-2 text-lg`,xl:`border-2 px-3 py-2 text-xl`},border:{none:`border-none`,with:`border-[1.3px] border-text`},background:{none:`bg-none`,with:``}},defaultVariants:{roundedSize:`full`,border:`none`,color:`text`,size:`md`}}),yk=({children:e,color:t,roundedSize:n,size:r,border:i,background:a,className:o,...s})=>(0,H.jsx)(`div`,{className:vk({color:t,roundedSize:n,size:r,border:i,background:a,className:o}),...s,children:e}),bk=`dictionaryList`,xk=e=>`dictionary_edition_${e}`,Sk=e=>{let t=(0,V.c)(23),n;t[0]===e?n=t[1]:(n=xk(e),t[0]=e,t[1]=n);let r=n,{isOpen:i,open:a,close:o}=JO(),{getEditedContentValue:s}=zf(),{focusedContent:c,setFocusedContent:l}=Ff(),u;t[2]!==c?.dictionaryKey||t[3]!==r||t[4]!==a?(u=()=>{c?.dictionaryKey&&a(r)},t[2]=c?.dictionaryKey,t[3]=r,t[4]=a,t[5]=u):u=t[5];let d=c?.dictionaryKey,f;t[6]!==r||t[7]!==a||t[8]!==d?(f=[d,a,r],t[6]=r,t[7]=a,t[8]=d,t[9]=f):f=t[9],(0,z.useEffect)(u,f);let p;t[10]!==i||t[11]!==r?(p=i(r),t[10]=i,t[11]=r,t[12]=p):p=t[12];let m;t[13]!==o||t[14]!==c||t[15]!==r||t[16]!==l?(m=()=>{o(r),c?.dictionaryKey&&l({...c,keyPath:[]})},t[13]=o,t[14]=c,t[15]=r,t[16]=l,t[17]=m):m=t[17];let h;return t[18]!==c||t[19]!==s||t[20]!==p||t[21]!==m?(h={isOpen:p,focusedContent:c,getEditedContentValue:s,close:m},t[18]=c,t[19]=s,t[20]=p,t[21]=m,t[22]=h):h=t[22],h},Ck=e=>{let t=(0,V.c)(77),{dictionaryKey:n,isDarkMode:r}=e,{backButtonText:i,openDictionaryEditor:a,modalTitle:o,noDictionaryFocused:s,focusedDictionaryNotFound:c}=Vt(Pc),l;t[0]===n?l=t[1]:(l=xk(n),t[0]=n,t[1]=l);let u=l,{focusedContent:d,close:f}=Sk(n),{setFocusedContent:p}=Ff(),{open:m}=JO(),h;t[2]===m?h=t[3]:(h=()=>m(bk),t[2]=m,t[3]=h);let g=h,{data:_}=dp(),v;t[4]!==f||t[5]!==g||t[6]!==p?(v=()=>{f(),p(null),g()},t[4]=f,t[5]=g,t[6]=p,t[7]=v):v=t[7];let y=v,[b,x]=(0,z.useState)(!1),S;t[8]===y?S=t[9]:(S=()=>{x(!1),y()},t[8]=y,t[9]=S);let C=S;if(!d?.dictionaryKey){let e;return t[10]===s?e=t[11]:(e=(0,H.jsx)(`span`,{className:`mx-auto my-10 text-neutral text-sm`,children:s}),t[10]=s,t[11]=e),e}let w,T,E,D,O,k,ee,A,j,te;if(t[12]!==i||t[13]!==f||t[14]!==d||t[15]!==c||t[16]!==y||t[17]!==u||t[18]!==a||t[19]!==p||t[20]!==_){O=Symbol.for(`react.early_return_sentinel`);bb0:{if(T=_?.[d.dictionaryKey]?.find(e=>e.localId===d?.dictionaryLocalId),!T){let e;t[31]===c?e=t[32]:(e=(0,H.jsx)(`span`,{className:`mx-auto my-10 text-neutral text-sm`,children:c}),t[31]=c,t[32]=e),O=e;break bb0}w=_k,te=u,t[33]!==i.value||t[34]!==y?(E={onBack:y,text:i.value},t[33]=i.value,t[34]=y,t[35]=E):E=t[35],t[36]!==f||t[37]!==p?(D=()=>{f(),p(null)},t[36]=f,t[37]=p,t[38]=D):D=t[38];let e;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>x(!0),t[39]=e):e=t[39];let n;t[40]===a.label.value?n=t[41]:(n=(0,H.jsx)(M,{variant:`hoverable`,color:`text`,size:`icon-md`,IconRight:ec,label:a.label.value,onClick:e}),t[40]=a.label.value,t[41]=n);let r;t[42]===a.popoverContent?r=t[43]:(r=(0,H.jsx)(Ye.Detail,{identifier:`open-dictionary-editor`,children:(0,H.jsx)(`span`,{className:`whitespace-nowrap p-2 text-neutral text-xs`,children:a.popoverContent})}),t[42]=a.popoverContent,t[43]=r);let o;t[44]!==n||t[45]!==r?(o=(0,H.jsxs)(Ye,{identifier:`open-dictionary-editor`,children:[n,r]}),t[44]=n,t[45]=r,t[46]=o):o=t[46],j=(0,H.jsxs)(`header`,{className:`mb-5 flex w-full px-3`,children:[(0,H.jsx)(`h3`,{className:`w-full text-center text-lg`,children:T.title?T.title:T.key}),o]}),k=`flex flex-wrap items-center justify-center gap-x-4 gap-y-2 border-text/20 border-b border-dotted pb-3`,ee=(0,H.jsx)(yk,{color:`text`,roundedSize:`full`,size:`xs`,children:T.key}),A=T.filePath&&(0,H.jsx)(yk,{color:`blue`,roundedSize:`full`,size:`xs`,children:T.filePath.split(`/`).pop()})}t[12]=i,t[13]=f,t[14]=d,t[15]=c,t[16]=y,t[17]=u,t[18]=a,t[19]=p,t[20]=_,t[21]=w,t[22]=T,t[23]=E,t[24]=D,t[25]=O,t[26]=k,t[27]=ee,t[28]=A,t[29]=j,t[30]=te}else w=t[21],T=t[22],E=t[23],D=t[24],O=t[25],k=t[26],ee=t[27],A=t[28],j=t[29],te=t[30];if(O!==Symbol.for(`react.early_return_sentinel`))return O;let N;t[47]===T.id?N=t[48]:(N=T.id&&(0,H.jsx)(yk,{color:`purple`,roundedSize:`full`,size:`xs`,children:`remote`}),t[47]=T.id,t[48]=N);let P;t[49]!==N||t[50]!==k||t[51]!==ee||t[52]!==A?(P=(0,H.jsxs)(`div`,{className:k,children:[ee,A,N]}),t[49]=N,t[50]=k,t[51]=ee,t[52]=A,t[53]=P):P=t[53];let ne;t[54]!==P||t[55]!==j?(ne=(0,H.jsxs)(H.Fragment,{children:[j,P]}),t[54]=P,t[55]=j,t[56]=ne):ne=t[56];let re;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(re=[`local`,`remote`],t[57]=re):re=t[57];let ie;t[58]!==T||t[59]!==y?(ie=(0,H.jsx)(_O,{dictionary:T,mode:re,className:`mb-4 flex-col px-3`,onDelete:y}),t[58]=T,t[59]=y,t[60]=ie):ie=t[60];let F;t[61]!==T||t[62]!==b||t[63]!==d||t[64]!==y||t[65]!==r||t[66]!==o||t[67]!==C?(F=d&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(je,{isOpen:b,onClose:()=>x(!1),hasCloseButton:!0,title:o,size:`xl`,transparency:`lg`,className:`h-full`,children:(0,H.jsx)(`div`,{className:`flex h-full min-h-0 w-full flex-1 flex-col px-3 pt-5`,children:(0,H.jsx)(HO,{dictionary:T,onClickDictionaryList:C,isDarkMode:r,mode:[`local`,`remote`],onDelete:()=>{x(!1),y()},onSave:()=>{x(!1)}})})}),(0,H.jsx)(Qp,{dictionary:T})]}),t[61]=T,t[62]=b,t[63]=d,t[64]=y,t[65]=r,t[66]=o,t[67]=C,t[68]=F):F=t[68];let I;return t[69]!==w||t[70]!==E||t[71]!==D||t[72]!==ne||t[73]!==ie||t[74]!==F||t[75]!==te?(I=(0,H.jsx)(w,{identifier:te,backButton:E,onClose:D,header:ne,footer:ie,children:F}),t[69]=w,t[70]=E,t[71]=D,t[72]=ne,t[73]=ie,t[74]=F,t[75]=te,t[76]=I):I=t[76],I},wk=e=>{let t=(0,V.c)(4),{isDarkMode:n}=e,{focusedContent:r}=Ff(),i=r?.dictionaryKey;if(!i){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(H.Fragment,{}),t[0]=e):e=t[0],e}let a;return t[1]!==i||t[2]!==n?(a=(0,H.jsx)(Ck,{dictionaryKey:i,isDarkMode:n}),t[1]=i,t[2]=n,t[3]=a):a=t[3],a},Tk={key:`dictionary-list-drawer`,content:{nodeType:`translation`,translation:{en:{drawerTitle:{label:`Dictionary list`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Open dictionary editor {{dictionaryLocalId}}`}}},"en-GB":{drawerTitle:{label:`Dictionary list`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Open dictionary editor {{dictionaryLocalId}}`}}},fr:{drawerTitle:{label:`Liste des dictionnaires`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Ouvrir le dictionnaire dans l'éditeur {{dictionaryLocalId}}`}}},es:{drawerTitle:{label:`Lista de diccionarios`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Abrir el diccionario en el editor {{dictionaryLocalId}}`}}},de:{drawerTitle:{label:`Wörterbuchliste`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Wörterbuch-Editor öffnen {{dictionaryLocalId}}`}}},ja:{drawerTitle:{label:`辞書リスト`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`辞書エディタを開く {{dictionaryLocalId}}`}}},ko:{drawerTitle:{label:`사전 목록`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`사전 편집기 열기 {{dictionaryLocalId}}`}}},zh:{drawerTitle:{label:`字典列表`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`打开字典编辑器 {{dictionaryLocalId}}`}}},it:{drawerTitle:{label:`Lista dei dizionari`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Apri editor dizionario {{dictionaryLocalId}}`}}},pt:{drawerTitle:{label:`Lista de dicionários`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Abrir editor de dicionário {{dictionaryLocalId}}`}}},hi:{drawerTitle:{label:`शब्दकोश सूची`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`शब्दकोश संपादक खोलें {{dictionaryLocalId}}`}}},ar:{drawerTitle:{label:`قائمة القواميس`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`فتح محرر القاموس {{dictionaryLocalId}}`}}},ru:{drawerTitle:{label:`Список словарей`},buttonLabel:{label:{fields:[`dictionaryLocalId`],nodeType:`insertion`,insertion:`Открыть редактор словаря {{dictionaryLocalId}}`}}}}},location:`local`,localId:`dictionary-list-drawer::local::client/src/components/Editor/DictionaryListDrawer/dictionaryListDrawer.content.ts`,filePath:`client/src/components/Editor/DictionaryListDrawer/dictionaryListDrawer.content.ts`},Ek=e=>{let{minChars:t=3,debounceMs:n=300,trim:r=!0,defaultValue:i,onSearch:a,onClear:o}=e??{},s=(0,z.useRef)(``),c=(0,z.useRef)(null),[l,u]=(0,z.useState)(i??``),d=()=>{c.current&&=(clearTimeout(c.current),null)};return(0,z.useEffect)(()=>()=>{d()},[]),{setSearch:e=>{s.current=e;let i=r?e.trim():e;if(d(),i.length<t){u(``),o?.();return}c.current=setTimeout(()=>{let e=r?s.current.trim():s.current;e.length>=t?(u(e),a?.(e)):(u(``),o?.())},n)},search:l,hasMinChars:l.length>=t}},Dk=({className:e,...t})=>(0,H.jsxs)(`div`,{className:`relative flex w-full items-center gap-1`,children:[(0,H.jsx)(ac,{className:`absolute left-2 size-4`}),(0,H.jsx)(Ap,{...t,type:`search`,className:R(`pl-8`,e)})]}),Ok=()=>{let{drawerTitle:e,buttonLabel:t}=Vt(Tk),{set:n}=JO(),{localeDictionaries:r}=jf(),{editedContent:i}=Bf(),{setFocusedContent:a}=Ff(),{setSearch:o,search:s}=Ek(),c=(0,z.useMemo)(()=>new eO(Object.values(r),{keys:[`key`,`title`,`filePath`,`description`,`tags`],threshold:.3,includeScore:!0}),[r]),l=(0,z.useMemo)(()=>!s||s.trim()===``?Object.values(r):c.search(s).map(e=>e.item),[s,c,r]),u=e=>{a({dictionaryKey:e.key,dictionaryLocalId:e.localId,keyPath:[]}),n({[bk]:!1,[xk(e.key)]:!0})},d=e=>Object.keys(i??{}).includes(e);return(0,H.jsxs)(_k,{title:e.label.value,identifier:bk,children:[(0,H.jsx)(`div`,{className:`p-3 pb-4`,children:(0,H.jsx)(Dk,{placeholder:`Search dictionaries`,onChange:e=>o(e.target.value),type:`search`})}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-1`,children:l.map(e=>(0,H.jsx)(`li`,{className:`w-full`,children:(0,H.jsx)(M,{label:t.label({dictionaryLocalId:e.localId}).value,onClick:()=>u(e),variant:`hoverable`,color:`text`,IconRight:Ys,size:`md`,isFullWidth:!0,Icon:d(e.localId)?tc:void 0,children:(0,H.jsx)(`div`,{className:`flex items-center gap-2 py-1`,children:(0,H.jsxs)(`div`,{className:`flex max-w-full flex-col gap-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 py-1.5`,children:[(0,H.jsx)(yk,{color:`text`,roundedSize:`full`,size:`xs`,children:e.key}),e.filePath&&(0,H.jsx)(yk,{color:`blue`,roundedSize:`full`,size:`xs`,children:e.filePath.split(`/`).pop()}),e.id&&(0,H.jsx)(yk,{color:`purple`,roundedSize:`full`,size:`xs`,children:`remote`})]}),(0,H.jsx)(`span`,{children:(e.title??``).length>0?e.title:e.key})]})})})},e.localId))})]})},kk={key:`long-press-message`,content:{nodeType:`translation`,translation:{en:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Long press to edit the "{{dictionaryKey}}" dictionary`}},"en-GB":{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Long press to edit the "{{dictionaryKey}}" dictionary`}},fr:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Long press pour éditer le dictionnaire "{{dictionaryKey}}"`}},es:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Presiona largo para editar el diccionario "{{dictionaryKey}}"`}},de:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Lang press für Bearbeitung des Wörterbuchs "{{dictionaryKey}}"`}},ja:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`長押しして編集 "{{dictionaryKey}}" 辞書`}},ko:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`길게 눌러 편집 "{{dictionaryKey}}" 사전`}},zh:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`长按编辑 "{{dictionaryKey}}" 字典`}},it:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Premi a lungo per modificare il dizionario "{{dictionaryKey}}"`}},pt:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Pressione longa para editar o dicionário "{{dictionaryKey}}"`}},hi:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`लंग प्रेस करें टू एडिट "{{dictionaryKey}}"`}},ar:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`اضغط طويلاً للتعديل "{{dictionaryKey}}"`}},ru:{message:{fields:[`dictionaryKey`],nodeType:`insertion`,insertion:`Длительное нажатие для редактирования словаря "{{dictionaryKey}}"`}}}},location:`local`,localId:`long-press-message::local::client/src/components/Editor/LongPressMessage/index.content.ts`,filePath:`client/src/components/Editor/LongPressMessage/index.content.ts`},Ak=()=>{let e=(0,V.c)(8),{message:t}=Vt(kk),[n]=kf(Rd.INTLAYER_HOVERED_CONTENT_CHANGED,null),r=n?.dictionaryKey?`opacity-100`:`opacity-0`,i;e[0]===r?i=e[1]:(i=R(`rounded-2xl bg-neutral/30 px-3 py-1 font-bold text-sm text-text transition-opacity duration-100`,r),e[0]=r,e[1]=i);let a;e[2]!==n||e[3]!==t?(a=n?.dictionaryKey?t({dictionaryKey:n.dictionaryKey}):``,e[2]=n,e[3]=t,e[4]=a):a=e[4];let o;return e[5]!==i||e[6]!==a?(o=(0,H.jsx)(`div`,{className:i,children:a}),e[5]=i,e[6]=a,e[7]=o):o=e[7],o},jk=e=>{let t=(0,V.c)(5),{children:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,H.jsx)(`div`,{className:`absolute right-2 bottom-2`,children:(0,H.jsx)(Ak,{})}),i=(0,H.jsx)(wk,{}),a=(0,H.jsx)(Ok,{}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,H.jsxs)(`div`,{className:`relative size-full bg-card p-3`,children:[n,r,i,a]}),t[3]=n,t[4]=o),o},Mk=()=>{let e=(0,V.c)(2),[t,n]=(0,z.useState)(),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{fetch(`/api/config`).then(Nk).then(e=>n(e.data))},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,z.useEffect)(r,i),t};function Nk(e){return e.json()}var Pk=e=>{let t=(0,V.c)(11),{children:n,iframeRef:r}=e,i=Mk(),a=i?.editor.applicationURL;if(!i){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(m,{}),t[0]=e):e=t[0],e}let o;t[1]!==a||t[2]!==r?(o=e=>{r.current?.contentWindow?.postMessage(e,a)},t[1]=a,t[2]=r,t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=[a],t[4]=a,t[5]=s);let c;return t[6]!==n||t[7]!==i||t[8]!==o||t[9]!==s?(c=(0,H.jsx)(If,{postMessage:o,allowedOrigins:s,configuration:i,children:n}),t[6]=n,t[7]=i,t[8]=o,t[9]=s,t[10]=c):c=t[10],c},Fk={key:`iframe-controller`,content:{nodeType:`translation`,translation:{en:{intlayerApplication:`Intlayer Application`,enableEditor:`Enable Editor`},"en-GB":{intlayerApplication:`Intlayer Application`,enableEditor:`Enable Editor`},fr:{intlayerApplication:`Application Intlayer`,enableEditor:`Activer l'éditeur`},es:{intlayerApplication:`Aplicación Intlayer`,enableEditor:`Activar el editor`},de:{intlayerApplication:`Intlayer-Anwendung`,enableEditor:`Editor aktivieren`},ja:{intlayerApplication:`Intlayerアプリケーション`,enableEditor:`エディタを有効にする`},ko:{intlayerApplication:`Intlayer 애플리케이션`,enableEditor:`에디터 활성화`},zh:{intlayerApplication:`Intlayer 应用程序`,enableEditor:`启用编辑器`},it:{intlayerApplication:`Applicazione Intlayer`,enableEditor:`Abilita l'editor`},pt:{intlayerApplication:`Aplicativo Intlayer`,enableEditor:`Ativar editor`},hi:{intlayerApplication:`इंटलेयर एप्लिकेशन`,enableEditor:`संपादक सक्षम करें`},ar:{intlayerApplication:`تطبيق Intlayer`,enableEditor:`تفعيل المحرر`},ru:{intlayerApplication:`Приложение Intlayer`,enableEditor:`Включить редактор`}}},location:`local`,localId:`iframe-controller::local::client/src/components/Editor/iframeController.content.ts`,filePath:`client/src/components/Editor/iframeController.content.ts`},Ik=()=>{let e=(0,V.c)(9),{editedContent:t,setEditedContentState:n}=Bf(),r;e[0]===n?r=e[1]:(r=()=>{let e=localStorage?.getItem(`INTLAYER_EDITED_CONTENT_CHANGED`);if(e)try{let t=JSON.parse(e);n(t)}catch(e){console.error(e)}},e[0]=n,e[1]=r);let i=r,a,o;e[2]===t?(a=e[3],o=e[4]):(a=()=>{t!==void 0&&localStorage?.setItem(`INTLAYER_EDITED_CONTENT_CHANGED`,JSON.stringify(t))},o=[t],e[2]=t,e[3]=a,e[4]=o),(0,z.useEffect)(a,o);let s;e[5]!==t||e[6]!==i?(s=()=>{t===void 0&&i()},e[5]=t,e[6]=i,e[7]=s):s=e[7];let c;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=[],e[8]=c):c=e[8],(0,z.useEffect)(s,c),i},Lk={key:`no-application-url-view`,content:{nodeType:`translation`,translation:{en:{title:`Your project configuration do not includes application URL`,description:`To use the editor, you need to add the URL of the application to access to the configuration file.`,documentationLink:{label:`Click to go to the editor documentation`,text:`See how to configure the editor`}},"en-GB":{title:`Your project configuration do not includes application URL`,description:`To use the editor, you need to add the URL of the application to access to the configuration file.`,documentationLink:{label:`Click to go to the editor documentation`,text:`See how to configure the editor`}},fr:{title:`Votre configuration de projet ne comprend pas l’URL de l’application`,description:`Pour utiliser l’éditeur, vous devez ajouter l’URL de l’application pour accéder au fichier de configuration.`,documentationLink:{label:`Cliquez ici pour accéder à la documentation de l’éditeur`,text:`Voir comment configurer l’éditeur`}},es:{title:`Su configuración de proyecto no incluye la URL de la aplicación`,description:`Para usar el editor, debe agregar la URL de la aplicación para acceder al archivo de configuración.`,documentationLink:{label:`Haga clic aquí para acceder a la documentación del editor`,text:`Vea cómo configurar el editor`}},de:{title:`Ihre Projektkonfiguration enthält keine Anwendungs-URL`,description:`Um den Editor zu verwenden, müssen Sie die URL der Anwendung hinzufügen, um auf die Konfigurationsdatei zuzugreifen.`,documentationLink:{label:`Klicken Sie hier, um die Editor-Dokumentation zu besuchen`,text:`Siehe, wie man den Editor konfiguriert`}},ja:{title:`あなたのプロジェクト構成にはアプリケーション URL が含まれていません`,description:`エディターを使用するには、アプリケーションの URL を設定ファイルに追加する必要があります。`,documentationLink:{label:`エディターのドキュメントに移動するには、ここをクリックしてください`,text:`エディターの設定方法を見る`}},ko:{title:`당신의 프로젝트 구성에 앱 URL이 포함되어 있지 않습니다.`,description:`에디터를 사용하려면 설정 파일에 앱 URL을 추가해야 합니다.`,documentationLink:{label:`에디터 문서로 이동하려면 여기를 클릭하십시오.`,text:`에디터 설정 방법을 보십시오`}},zh:{title:`您的项目配置未包含应用程序 URL`,description:`要使用编辑器,您需要将应用程序 URL 添加到访问配置文件。`,documentationLink:{label:`点击此处访问编辑器文档`,text:`查看如何配置编辑器`}},it:{title:`La configurazione del progetto non include l’URL dell’applicazione`,description:`Per utilizzare l’editor, è necessario aggiungere l’URL dell’applicazione per accedere al file di configurazione.`,documentationLink:{label:`Fai clic qui per accedere alla documentazione dell’editor`,text:`Vedi come configurare l’editor`}},pt:{title:`Sua configuração do projeto não inclui a URL do aplicativo`,description:`Para usar o editor, você precisa adicionar a URL do aplicativo para acessar o arquivo de configuração.`,documentationLink:{label:`Clique aqui para acessar a documentação do editor`,text:`Veja como configurar o editor`}},hi:{title:`आपके प्रोजेक्ट कॉन्फ़िगरेशन में ऐप का URL शामिल नहीं है`,description:`एडिटर का उपयोग करने के लिए, आपको कॉन्फ़िगरेशन फ़ाइल तक ऐप का URL को जोड़ना होगा।`,documentationLink:{label:`एडिटर को डॉक्यूमेंट पर जाए रखना चाहते हैं?`,text:`एडिटर को काने के बारे में देखें`}},ar:{title:`تم إنشاء مشروعك بدون تضمين عنوان URL التطبيق`,description:`لاستخدام المحرر، يجب عليك إضافة عنوان URL التطبيق للوصول إلى ملف التكوين.`,documentationLink:{label:`انقر هنا للوصول إلى وثائق المحرر`,text:`انظر كيفية تكوين المحرر`}},ru:{title:`Ваша конфигурация проекта не включает URL-адрес приложения`,description:`Чтобы использовать редактор, вам необходимо добавить URL-адрес приложения для доступа к файлу конфигурации.`,documentationLink:{label:`Нажмите, чтобы перейти к документации редактора`,text:`Смотрите, как настроить редактор`}}}},location:`local`,localId:`no-application-url-view::local::client/src/components/Editor/NoApplicationURLView/noApplicationURLView.content.ts`,filePath:`client/src/components/Editor/NoApplicationURLView/noApplicationURLView.content.ts`},Rk=()=>{let e=(0,V.c)(11),{title:t,description:n,documentationLink:r}=Vt(Lk),i;e[0]===t?i=e[1]:(i=(0,H.jsx)(qe,{className:`mb-8`,children:t}),e[0]=t,e[1]=i);let a;e[2]===n?a=e[3]:(a=(0,H.jsx)(`strong`,{className:`block text-neutral`,children:n}),e[2]=n,e[3]=a);let o;e[4]!==r.label.value||e[5]!==r.text?(o=(0,H.jsx)(Ve,{label:r.label.value,href:`https://intlayer.org/doc/concept/configuration#editor-configuration`,color:`text`,variant:`button`,className:`ml-auto`,isExternalLink:!0,children:r.text}),e[4]=r.label.value,e[5]=r.text,e[6]=o):o=e[6];let s;return e[7]!==i||e[8]!==a||e[9]!==o?(s=(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i,a,o]}),e[7]=i,e[8]=a,e[9]=o,e[10]=s):s=e[10],s},zk=e=>{let t=(0,V.c)(23),{iframeRef:n,applicationPath:r}=e,i=Vt(Fk),{editor:a}=Rf()??{},{enabled:o}=Vf(),s=Hf();Ik(),Wf();let[c,l]=(0,z.useState)(!0),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={receive:!0,emit:!1},t[0]=u):u=t[0];let[d]=Af(void 0,u),f,p;if(t[1]===d?(f=t[2],p=t[3]):(f=()=>{typeof d==`string`&&window.history.replaceState({},``,d)},p=[d],t[1]=d,t[2]=f,t[3]=p),(0,z.useEffect)(f,p),!a?.applicationURL){let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(Ne,{className:`max-w-xl`,padding:`xl`,roundedSize:`2xl`,children:(0,H.jsx)(Rk,{})}),t[4]=e):e=t[4],e}let h;t[5]===c?h=t[6]:(h=(0,H.jsx)(m,{isLoading:c}),t[5]=c,t[6]=h);let g=`${a.applicationURL}${r}`,_=i.intlayerApplication.value,v=c&&`hidden`,y;t[7]===v?y=t[8]:(y=R(`size-full`,v),t[7]=v,t[8]=y);let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{l(!1)},t[9]=b):b=t[9];let x;t[10]!==i.intlayerApplication.value||t[11]!==n||t[12]!==g||t[13]!==y?(x=(0,H.jsx)(`iframe`,{src:g,title:_,sandbox:`allow-scripts allow-same-origin`,className:y,ref:n,onLoad:b}),t[10]=i.intlayerApplication.value,t[11]=n,t[12]=g,t[13]=y,t[14]=x):x=t[14];let S;t[15]!==i.enableEditor||t[16]!==o||t[17]!==s?(S=!o&&(0,H.jsx)(`div`,{className:`fixed right-4 bottom-4`,children:(0,H.jsx)(M,{label:i.enableEditor.value,onClick:s,color:`text`,children:i.enableEditor})}),t[15]=i.enableEditor,t[16]=o,t[17]=s,t[18]=S):S=t[18];let C;return t[19]!==x||t[20]!==S||t[21]!==h?(C=(0,H.jsxs)(`div`,{className:`relative size-full overflow-hidden rounded-lg`,children:[h,x,S]}),t[19]=x,t[20]=S,t[21]=h,t[22]=C):C=t[22],C},Bk=()=>{let e=(0,V.c)(2),t=(0,z.useRef)(null),n=gr(),r;return e[0]===n.pathname?r=e[1]:(r=(0,H.jsx)(Pk,{iframeRef:t,children:(0,H.jsx)(et,{disableEditor:!0,children:(0,H.jsx)(jk,{children:(0,H.jsx)(zk,{iframeRef:t,applicationPath:n.pathname})})})}),e[0]=n.pathname,e[1]=r),r};(0,Ac.createRoot)(document.getElementById(`root`)).render((0,H.jsx)(z.StrictMode,{children:(0,H.jsx)(()=>{let e=(0,V.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,H.jsx)(Nc,{children:(0,H.jsx)(Mc,{children:(0,H.jsx)(Bk,{})})}),e[0]=t):t=e[0],t},{})}));export{$h as a,Zi as c,sg as i,Ct as l,yg as n,ap as o,ag as r,oc as s,Og as t};
|