@chaibuilder/pages 0.1.0-beta.49 → 0.1.0-beta.50

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.
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./STCWXWCR-CLk5kpH4.js";
2
- import { g as d, c as f, a as e } from "./ChaiBuilderPages-CI57F_om.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./STCWXWCR-KLNo0-G2.js";
2
+ import { g as d, c as f, a as e } from "./ChaiBuilderPages-XvzqxYTv.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./STCWXWCR-ChSnEo0x.cjs"),t=require("./ChaiBuilderPages-EsXvhnMU.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./STCWXWCR-n6BNpLo9.cjs"),t=require("./ChaiBuilderPages-BFO0dgE5.cjs");var s=c=>{const[r,o]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),l=t.getPreferredColorScheme(),a=t.createMemo(()=>{const n=r.theme_preference||e.THEME_PREFERENCE;return n!=="system"?n:l()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:c,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:o,get children(){return t.createComponent(e.ThemeContext.Provider,{value:a,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:o})}})}})}})},u=s;exports.default=u;
@@ -14,7 +14,7 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Wn;function Cr(){return Wn||(Wn=1,process.env.NODE_ENV!=="production"&&function(){var e=w,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),j=Symbol.for("react.offscreen"),C=Symbol.iterator,_="@@iterator";function S(c){if(c===null||typeof c!="object")return null;var p=C&&c[C]||c[_];return typeof p=="function"?p:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(c){{for(var p=arguments.length,b=new Array(p>1?p-1:0),T=1;T<p;T++)b[T-1]=arguments[T];K("error",c,b)}}function K(c,p,b){{var T=y.ReactDebugCurrentFrame,F=T.getStackAddendum();F!==""&&(p+="%s",b=b.concat([F]));var W=b.map(function(I){return String(I)});W.unshift("Warning: "+p),Function.prototype.apply.call(console[c],console,W)}}var Q=!1,G=!1,N=!1,M=!1,oe=!1,E;E=Symbol.for("react.module.reference");function B(c){return!!(typeof c=="string"||typeof c=="function"||c===s||c===a||oe||c===i||c===f||c===m||M||c===j||Q||G||N||typeof c=="object"&&c!==null&&(c.$$typeof===x||c.$$typeof===g||c.$$typeof===o||c.$$typeof===l||c.$$typeof===u||c.$$typeof===E||c.getModuleId!==void 0))}function z(c,p,b){var T=c.displayName;if(T)return T;var F=p.displayName||p.name||"";return F!==""?b+"("+F+")":b}function ae(c){return c.displayName||"Context"}function ce(c){if(c==null)return null;if(typeof c.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case s:return"Fragment";case n:return"Portal";case a:return"Profiler";case i:return"StrictMode";case f:return"Suspense";case m:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case l:var p=c;return ae(p)+".Consumer";case o:var b=c;return ae(b._context)+".Provider";case u:return z(c,c.render,"ForwardRef");case g:var T=c.displayName||null;return T!==null?T:ce(c.type)||"Memo";case x:{var F=c,W=F._payload,I=F._init;try{return ce(I(W))}catch{return null}}}return null}var ve=Object.assign,ze=0,wn,En,jn,Sn,Cn,Nn,Tn;function An(){}An.__reactDisabledLog=!0;function Qs(){{if(ze===0){wn=console.log,En=console.info,jn=console.warn,Sn=console.error,Cn=console.group,Nn=console.groupCollapsed,Tn=console.groupEnd;var c={configurable:!0,enumerable:!0,value:An,writable:!0};Object.defineProperties(console,{info:c,log:c,warn:c,error:c,group:c,groupCollapsed:c,groupEnd:c})}ze++}}function Ys(){{if(ze--,ze===0){var c={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ve({},c,{value:wn}),info:ve({},c,{value:En}),warn:ve({},c,{value:jn}),error:ve({},c,{value:Sn}),group:ve({},c,{value:Cn}),groupCollapsed:ve({},c,{value:Nn}),groupEnd:ve({},c,{value:Tn})})}ze<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Mt=y.ReactCurrentDispatcher,Bt;function vt(c,p,b){{if(Bt===void 0)try{throw Error()}catch(F){var T=F.stack.trim().match(/\n( *(at )?)/);Bt=T&&T[1]||""}return`
17
+ */var Wn;function Cr(){return Wn||(Wn=1,process.env.NODE_ENV!=="production"&&function(){var e=w,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),j=Symbol.for("react.offscreen"),C=Symbol.iterator,_="@@iterator";function S(c){if(c===null||typeof c!="object")return null;var p=C&&c[C]||c[_];return typeof p=="function"?p:null}var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(c){{for(var p=arguments.length,b=new Array(p>1?p-1:0),T=1;T<p;T++)b[T-1]=arguments[T];K("error",c,b)}}function K(c,p,b){{var T=y.ReactDebugCurrentFrame,F=T.getStackAddendum();F!==""&&(p+="%s",b=b.concat([F]));var W=b.map(function(I){return String(I)});W.unshift("Warning: "+p),Function.prototype.apply.call(console[c],console,W)}}var H=!1,G=!1,N=!1,M=!1,oe=!1,E;E=Symbol.for("react.module.reference");function B(c){return!!(typeof c=="string"||typeof c=="function"||c===s||c===a||oe||c===i||c===f||c===m||M||c===j||H||G||N||typeof c=="object"&&c!==null&&(c.$$typeof===x||c.$$typeof===g||c.$$typeof===o||c.$$typeof===l||c.$$typeof===u||c.$$typeof===E||c.getModuleId!==void 0))}function z(c,p,b){var T=c.displayName;if(T)return T;var F=p.displayName||p.name||"";return F!==""?b+"("+F+")":b}function ae(c){return c.displayName||"Context"}function ce(c){if(c==null)return null;if(typeof c.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof c=="function")return c.displayName||c.name||null;if(typeof c=="string")return c;switch(c){case s:return"Fragment";case n:return"Portal";case a:return"Profiler";case i:return"StrictMode";case f:return"Suspense";case m:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case l:var p=c;return ae(p)+".Consumer";case o:var b=c;return ae(b._context)+".Provider";case u:return z(c,c.render,"ForwardRef");case g:var T=c.displayName||null;return T!==null?T:ce(c.type)||"Memo";case x:{var F=c,W=F._payload,I=F._init;try{return ce(I(W))}catch{return null}}}return null}var ve=Object.assign,ze=0,wn,En,jn,Sn,Cn,Nn,Tn;function An(){}An.__reactDisabledLog=!0;function Qs(){{if(ze===0){wn=console.log,En=console.info,jn=console.warn,Sn=console.error,Cn=console.group,Nn=console.groupCollapsed,Tn=console.groupEnd;var c={configurable:!0,enumerable:!0,value:An,writable:!0};Object.defineProperties(console,{info:c,log:c,warn:c,error:c,group:c,groupCollapsed:c,groupEnd:c})}ze++}}function Ys(){{if(ze--,ze===0){var c={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ve({},c,{value:wn}),info:ve({},c,{value:En}),warn:ve({},c,{value:jn}),error:ve({},c,{value:Sn}),group:ve({},c,{value:Cn}),groupCollapsed:ve({},c,{value:Nn}),groupEnd:ve({},c,{value:Tn})})}ze<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Mt=y.ReactCurrentDispatcher,Bt;function vt(c,p,b){{if(Bt===void 0)try{throw Error()}catch(F){var T=F.stack.trim().match(/\n( *(at )?)/);Bt=T&&T[1]||""}return`
18
18
  `+Bt+c}}var qt=!1,bt;{var Js=typeof WeakMap=="function"?WeakMap:Map;bt=new Js}function kn(c,p){if(!c||qt)return"";{var b=bt.get(c);if(b!==void 0)return b}var T;qt=!0;var F=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var W;W=Mt.current,Mt.current=null,Qs();try{if(p){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(re){T=re}Reflect.construct(c,[],I)}else{try{I.call()}catch(re){T=re}c.call(I.prototype)}}else{try{throw Error()}catch(re){T=re}c()}}catch(re){if(re&&T&&typeof re.stack=="string"){for(var O=re.stack.split(`
19
19
  `),ne=T.stack.split(`
20
20
  `),Y=O.length-1,J=ne.length-1;Y>=1&&J>=0&&O[Y]!==ne[J];)J--;for(;Y>=1&&J>=0;Y--,J--)if(O[Y]!==ne[J]){if(Y!==1||J!==1)do if(Y--,J--,J<0||O[Y]!==ne[J]){var le=`
@@ -27,4 +27,4 @@ Check the top-level render call using <`+b+">.")}return p}}function Un(c,p){{if(
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,Ht,be,br,be),Bn[be+Ht]=!0}}return c===s?mr(J):gr(J),J}}function yr(c,p,b){return qn(c,p,b,!0)}function pr(c,p,b){return qn(c,p,b,!1)}var xr=pr,vr=yr;Je.Fragment=s,Je.jsx=xr,Je.jsxs=vr}()),Je}process.env.NODE_ENV==="production"?Zt.exports=Sr():Zt.exports=Cr();var r=Zt.exports,D={context:void 0,registry:void 0,getContextId(){return zn(this.context.count)},getNextContextId(){return zn(this.context.count++)}};function zn(e){const t=String(e),n=t.length-1;return D.context.id+(n?String.fromCharCode(96+n):"")+t}function Xe(e){D.context=e}var Nr=(e,t)=>e===t,Tt=Symbol("solid-proxy"),dn=Symbol("solid-track"),At={equals:Nr},is=ds,ge=1,kt=2,as={owned:null,cleanups:null,context:null,owner:null},Qt={},R=null,Yt=null,Tr=null,$=null,te=null,fe=null,Lt=0;function me(e,t){const n=$,s=R,i=e.length===0,a=t===void 0?s:t,o=i?as:{owned:null,cleanups:null,context:a?a.context:null,owner:a},l=i?e:()=>e(()=>ee(()=>Gt(o)));R=o,$=null;try{return de(l,!0)}finally{$=n,R=s}}function H(e,t){t=t?Object.assign({},At,t):At;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=i=>(typeof i=="function"&&(i=i(n.value)),us(n,i));return[cs.bind(n),s]}function en(e,t,n){const s=Rt(e,t,!0,ge);We(s)}function ye(e,t,n){const s=Rt(e,t,!1,ge);We(s)}function fn(e,t,n){is=Br;const s=Rt(e,t,!1,ge);(!n||!n.render)&&(s.user=!0),fe?fe.push(s):We(s)}function se(e,t,n){n=n?Object.assign({},At,n):At;const s=Rt(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,We(s),cs.bind(s)}function Ar(e){return e&&typeof e=="object"&&"then"in e}function kr(e,t,n){let s,i,a;arguments.length===2&&typeof t=="object"||arguments.length===1?(s=!0,i=e,a={}):(s=e,i=t,a={});let o=null,l=Qt,u=null,f=!1,m="initialValue"in a,g=typeof s=="function"&&se(s);const x=new Set,[j,C]=(a.storage||H)(a.initialValue),[_,S]=H(void 0),[y,v]=H(void 0,{equals:!1}),[K,Q]=H(m?"ready":"unresolved");if(D.context){u=D.getNextContextId();let E;a.ssrLoadFrom==="initial"?l=a.initialValue:D.load&&(E=D.load(u))&&(l=E)}function G(E,B,z,ae){return o===E&&(o=null,ae!==void 0&&(m=!0),(E===l||B===l)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(ae,{value:B})),l=Qt,N(B,z)),B}function N(E,B){de(()=>{B===void 0&&C(()=>E),Q(B!==void 0?"errored":m?"ready":"unresolved"),S(B);for(const z of x.keys())z.decrement();x.clear()},!1)}function M(){const E=Fr,B=j(),z=_();if(z!==void 0&&!o)throw z;return $&&!$.user&&E&&en(()=>{y(),o&&(E.resolved||x.has(E)||(E.increment(),x.add(E)))}),B}function oe(E=!0){if(E!==!1&&f)return;f=!1;const B=g?g():s;if(B==null||B===!1){G(o,ee(j));return}const z=l!==Qt?l:ee(()=>i(B,{value:j(),refetching:E}));return Ar(z)?(o=z,"value"in z?(z.status==="success"?G(o,z.value,void 0,B):G(o,void 0,tn(z.value),B),z):(f=!0,queueMicrotask(()=>f=!1),de(()=>{Q(m?"refreshing":"pending"),v()},!1),z.then(ae=>G(z,ae,void 0,B),ae=>G(z,void 0,tn(ae),B)))):(G(o,z,void 0,B),z)}return Object.defineProperties(M,{state:{get:()=>K()},error:{get:()=>_()},loading:{get(){const E=K();return E==="pending"||E==="refreshing"}},latest:{get(){if(!m)return M();const E=_();if(E&&!o)throw E;return j()}}}),g?en(()=>oe(!1)):oe(!1),[M,{refetch:oe,mutate:C}]}function Pr(e){return de(e,!1)}function ee(e){if($===null)return e();const t=$;$=null;try{return e()}finally{$=t}}function _r(e,t,n){const s=Array.isArray(e);let i,a=n&&n.defer;return o=>{let l;if(s){l=Array(e.length);for(let f=0;f<e.length;f++)l[f]=e[f]()}else l=e();if(a)return a=!1,o;const u=ee(()=>t(l,i,o));return i=l,u}}function os(e){fn(()=>ee(e))}function Ve(e){return R===null||(R.cleanups===null?R.cleanups=[e]:R.cleanups.push(e)),e}function Hn(){return R}function Dr(e,t){const n=R,s=$;R=e,$=null;try{return de(t,!0)}catch(i){hn(i)}finally{R=n,$=s}}function Or(e){const t=$,n=R;return Promise.resolve().then(()=>{$=t,R=n;let s;return de(e,!1),$=R=null,s?s.done:void 0})}var[Ir,Xa]=H(!1);function Lr(){return[Ir,Or]}function Rr(e,t){const n=Symbol("context");return{id:n,Provider:qr(n),defaultValue:e}}function Gr(e){let t;return R&&R.context&&(t=R.context[e.id])!==void 0?t:e.defaultValue}function ls(e){const t=se(e),n=se(()=>nn(t()));return n.toArray=()=>{const s=n();return Array.isArray(s)?s:s!=null?[s]:[]},n}var Fr;function cs(){if(this.sources&&this.state)if(this.state===ge)We(this);else{const e=te;te=null,de(()=>_t(this),!1),te=e}if($){const e=this.observers?this.observers.length:0;$.sources?($.sources.push(this),$.sourceSlots.push(e)):($.sources=[this],$.sourceSlots=[e]),this.observers?(this.observers.push($),this.observerSlots.push($.sources.length-1)):(this.observers=[$],this.observerSlots=[$.sources.length-1])}return this.value}function us(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&de(()=>{for(let i=0;i<e.observers.length;i+=1){const a=e.observers[i],o=Yt&&Yt.running;o&&Yt.disposed.has(a),(o?!a.tState:!a.state)&&(a.pure?te.push(a):fe.push(a),a.observers&&fs(a)),o||(a.state=ge)}if(te.length>1e6)throw te=[],new Error},!1)),t}function We(e){if(!e.fn)return;Gt(e);const t=Lt;Ur(e,e.value,t)}function Ur(e,t,n){let s;const i=R,a=$;$=R=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=ge,e.owned&&e.owned.forEach(Gt),e.owned=null),e.updatedAt=n+1,hn(o)}finally{$=a,R=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?us(e,s):e.value=s,e.updatedAt=n)}function Rt(e,t,n,s=ge,i){const a={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:R,context:R?R.context:null,pure:n};return R===null||R!==as&&(R.owned?R.owned.push(a):R.owned=[a]),a}function Pt(e){if(e.state===0)return;if(e.state===kt)return _t(e);if(e.suspense&&ee(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Lt);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===ge)We(e);else if(e.state===kt){const s=te;te=null,de(()=>_t(e,t[0]),!1),te=s}}function de(e,t){if(te)return e();let n=!1;t||(te=[]),fe?n=!0:fe=[],Lt++;try{const s=e();return Mr(n),s}catch(s){n||(fe=null),te=null,hn(s)}}function Mr(e){if(te&&(ds(te),te=null),e)return;const t=fe;fe=null,t.length&&de(()=>is(t),!1)}function ds(e){for(let t=0;t<e.length;t++)Pt(e[t])}function Br(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:Pt(s)}if(D.context){if(D.count){D.effects||(D.effects=[]),D.effects.push(...e.slice(0,n));return}else D.effects&&(e=[...D.effects,...e],n+=D.effects.length,delete D.effects);Xe()}for(t=0;t<n;t++)Pt(e[t])}function _t(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const i=s.state;i===ge?s!==t&&(!s.updatedAt||s.updatedAt<Lt)&&Pt(s):i===kt&&_t(s,t)}}}function fs(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=kt,n.pure?te.push(n):fe.push(n),n.observers&&fs(n))}}function Gt(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),s=e.sourceSlots.pop(),i=n.observers;if(i&&i.length){const a=i.pop(),o=n.observerSlots.pop();s<i.length&&(a.sourceSlots[o]=s,i[s]=a,n.observerSlots[s]=o)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Gt(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function tn(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function hn(e,t=R){throw tn(e)}function nn(e){if(typeof e=="function"&&!e.length)return nn(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const s=nn(e[n]);Array.isArray(s)?t.push.apply(t,s):t.push(s)}return t}return e}function qr(e,t){return function(s){let i;return ye(()=>i=ee(()=>(R.context={...R.context,[e]:s.value},ls(()=>s.children))),void 0),i}}var sn=Symbol("fallback");function Dt(e){for(let t=0;t<e.length;t++)e[t]()}function $r(e,t,n={}){let s=[],i=[],a=[],o=0,l=t.length>1?[]:null;return Ve(()=>Dt(a)),()=>{let u=e()||[],f=u.length,m,g;return u[dn],ee(()=>{let j,C,_,S,y,v,K,Q,G;if(f===0)o!==0&&(Dt(a),a=[],s=[],i=[],o=0,l&&(l=[])),n.fallback&&(s=[sn],i[0]=me(N=>(a[0]=N,n.fallback())),o=1);else if(o===0){for(i=new Array(f),g=0;g<f;g++)s[g]=u[g],i[g]=me(x);o=f}else{for(_=new Array(f),S=new Array(f),l&&(y=new Array(f)),v=0,K=Math.min(o,f);v<K&&s[v]===u[v];v++);for(K=o-1,Q=f-1;K>=v&&Q>=v&&s[K]===u[Q];K--,Q--)_[Q]=i[K],S[Q]=a[K],l&&(y[Q]=l[K]);for(j=new Map,C=new Array(Q+1),g=Q;g>=v;g--)G=u[g],m=j.get(G),C[g]=m===void 0?-1:m,j.set(G,g);for(m=v;m<=K;m++)G=s[m],g=j.get(G),g!==void 0&&g!==-1?(_[g]=i[m],S[g]=a[m],l&&(y[g]=l[m]),g=C[g],j.set(G,g)):a[m]();for(g=v;g<f;g++)g in _?(i[g]=_[g],a[g]=S[g],l&&(l[g]=y[g],l[g](g))):i[g]=me(x);i=i.slice(0,o=f),s=u.slice(0)}return i});function x(j){if(a[g]=j,l){const[C,_]=H(g);return l[g]=_,t(u[g],C)}return t(u[g])}}}function Vr(e,t,n={}){let s=[],i=[],a=[],o=[],l=0,u;return Ve(()=>Dt(a)),()=>{const f=e()||[],m=f.length;return f[dn],ee(()=>{if(m===0)return l!==0&&(Dt(a),a=[],s=[],i=[],l=0,o=[]),n.fallback&&(s=[sn],i[0]=me(x=>(a[0]=x,n.fallback())),l=1),i;for(s[0]===sn&&(a[0](),a=[],s=[],i=[],l=0),u=0;u<m;u++)u<s.length&&s[u]!==f[u]?o[u](()=>f[u]):u>=s.length&&(i[u]=me(g));for(;u<s.length;u++)a[u]();return l=o.length=a.length=m,s=f.slice(0),i=i.slice(0,l)});function g(x){a[u]=x;const[j,C]=H(f[u]);return o[u]=C,t(j,u)}}}function gn(e,t){return ee(()=>e(t||{}))}function jt(){return!0}var rn={get(e,t,n){return t===Tt?n:e.get(t)},has(e,t){return t===Tt?!0:e.has(t)},set:jt,deleteProperty:jt,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:jt,deleteProperty:jt}},ownKeys(e){return e.keys()}};function Jt(e){return(e=typeof e=="function"?e():e)?e:{}}function Kr(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function mn(...e){let t=!1;for(let o=0;o<e.length;o++){const l=e[o];t=t||!!l&&Tt in l,e[o]=typeof l=="function"?(t=!0,se(l)):l}if(t)return new Proxy({get(o){for(let l=e.length-1;l>=0;l--){const u=Jt(e[l])[o];if(u!==void 0)return u}},has(o){for(let l=e.length-1;l>=0;l--)if(o in Jt(e[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<e.length;l++)o.push(...Object.keys(Jt(e[l])));return[...new Set(o)]}},rn);const n={},s=Object.create(null);for(let o=e.length-1;o>=0;o--){const l=e[o];if(!l)continue;const u=Object.getOwnPropertyNames(l);for(let f=u.length-1;f>=0;f--){const m=u[f];if(m==="__proto__"||m==="constructor")continue;const g=Object.getOwnPropertyDescriptor(l,m);if(!s[m])s[m]=g.get?{enumerable:!0,configurable:!0,get:Kr.bind(n[m]=[g.get.bind(l)])}:g.value!==void 0?g:void 0;else{const x=n[m];x&&(g.get?x.push(g.get.bind(l)):g.value!==void 0&&x.push(()=>g.value))}}}const i={},a=Object.keys(s);for(let o=a.length-1;o>=0;o--){const l=a[o],u=s[l];u&&u.get?Object.defineProperty(i,l,u):i[l]=u?u.value:void 0}return i}function hs(e,...t){if(Tt in e){const i=new Set(t.length>1?t.flat():t[0]),a=t.map(o=>new Proxy({get(l){return o.includes(l)?e[l]:void 0},has(l){return o.includes(l)&&l in e},keys(){return o.filter(l=>l in e)}},rn));return a.push(new Proxy({get(o){return i.has(o)?void 0:e[o]},has(o){return i.has(o)?!1:o in e},keys(){return Object.keys(e).filter(o=>!i.has(o))}},rn)),a}const n={},s=t.map(()=>({}));for(const i of Object.getOwnPropertyNames(e)){const a=Object.getOwnPropertyDescriptor(e,i),o=!a.get&&!a.set&&a.enumerable&&a.writable&&a.configurable;let l=!1,u=0;for(const f of t)f.includes(i)&&(l=!0,o?s[u][i]=a.value:Object.defineProperty(s[u],i,a)),++u;l||(o?n[i]=a.value:Object.defineProperty(n,i,a))}return[...s,n]}function gs(e){let t,n;const s=i=>{const a=D.context;if(a){const[l,u]=H();D.count||(D.count=0),D.count++,(n||(n=e())).then(f=>{Xe(a),D.count--,u(()=>f.default),Xe()}),t=l}else if(!t){const[l]=kr(()=>(n||(n=e())).then(u=>u.default));t=l}let o;return se(()=>(o=t())&&ee(()=>{if(!a)return o(i);const l=D.context;Xe(a);const u=o(i);return Xe(l),u}))};return s.preload=()=>n||((n=e()).then(i=>t=()=>i.default),n),s}var Wr=0;function zr(){return D.context?D.getNextContextId():`cl-${Wr++}`}var ms=e=>`Stale read from <${e}>.`;function Hr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return se($r(()=>e.each,e.children,t||void 0))}function Qr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return se(Vr(()=>e.each,e.children,t||void 0))}function Yr(e){const t=e.keyed,n=se(()=>e.when,void 0,{equals:(s,i)=>t?s===i:!s==!i});return se(()=>{const s=n();if(s){const i=e.children;return typeof i=="function"&&i.length>0?ee(()=>i(t?s:()=>{if(!ee(n))throw ms("Show");return e.when})):i}return e.fallback},void 0,void 0)}function Jr(e){let t=!1;const n=(a,o)=>(t?a[1]===o[1]:!a[1]==!o[1])&&a[2]===o[2],s=ls(()=>e.children),i=se(()=>{let a=s();Array.isArray(a)||(a=[a]);for(let o=0;o<a.length;o++){const l=a[o].when;if(l)return t=!!a[o].keyed,[o,l,a[o]]}return[-1]},void 0,{equals:n});return se(()=>{const[a,o,l]=i();if(a<0)return e.fallback;const u=l.children;return typeof u=="function"&&u.length>0?ee(()=>u(t?o:()=>{if(ee(i)[0]!==a)throw ms("Match");return l.when})):u},void 0,void 0)}function Xr(e){return e}var Zr=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],ei=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Zr]),ti=new Set(["innerHTML","textContent","innerText","children"]),ni=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),si=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function ri(e,t){const n=si[e];return typeof n=="object"?n[t]?n.$:void 0:n}var ii=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),ai=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),oi={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function li(e,t,n){let s=n.length,i=t.length,a=s,o=0,l=0,u=t[i-1].nextSibling,f=null;for(;o<i||l<a;){if(t[o]===n[l]){o++,l++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){const m=a<s?l?n[l-1].nextSibling:n[a-l]:u;for(;l<a;)e.insertBefore(n[l++],m)}else if(a===l)for(;o<i;)(!f||!f.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[l]===t[i-1]){const m=t[--i].nextSibling;e.insertBefore(n[l++],t[o++].nextSibling),e.insertBefore(n[--a],m),t[i]=n[a]}else{if(!f){f=new Map;let g=l;for(;g<a;)f.set(n[g],g++)}const m=f.get(t[o]);if(m!=null)if(l<m&&m<a){let g=o,x=1,j;for(;++g<i&&g<a&&!((j=f.get(t[g]))==null||j!==m+x);)x++;if(x>m-l){const C=t[o];for(;l<m;)e.insertBefore(n[l++],C)}else e.replaceChild(n[l++],t[o++])}else o++;else t[o++].remove()}}}var tt="_$DX_DELEGATE";function ys(e,t,n,s={}){let i;return me(a=>{i=a,t===document?e():It(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{i(),t.textContent=""}}function ci(e,t,n){let s;const i=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},a=()=>(s||(s=i())).cloneNode(!0);return a.cloneNode=a,a}function ps(e,t=window.document){const n=t[tt]||(t[tt]=new Set);for(let s=0,i=e.length;s<i;s++){const a=e[s];n.has(a)||(n.add(a),t.addEventListener(a,Es))}}function ui(e=window.document){if(e[tt]){for(let t of e[tt].keys())e.removeEventListener(t,Es);delete e[tt]}}function Ot(e,t,n){D.context&&e.isConnected||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function di(e,t,n,s){D.context&&e.isConnected||(s==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,s))}function xs(e,t){D.context&&e.isConnected||(t==null?e.removeAttribute("class"):e.className=t)}function vs(e,t,n,s){if(s)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const i=n[0];e.addEventListener(t,n[0]=a=>i.call(e,n[1],a))}else e.addEventListener(t,n)}function fi(e,t,n={}){const s=Object.keys(t||{}),i=Object.keys(n);let a,o;for(a=0,o=i.length;a<o;a++){const l=i[a];!l||l==="undefined"||t[l]||(Qn(e,l,!1),delete n[l])}for(a=0,o=s.length;a<o;a++){const l=s[a],u=!!t[l];!l||l==="undefined"||n[l]===u||!u||(Qn(e,l,!0),n[l]=u)}return n}function hi(e,t,n){if(!t)return n?Ot(e,"style"):t;const s=e.style;if(typeof t=="string")return s.cssText=t;typeof n=="string"&&(s.cssText=n=void 0),n||(n={}),t||(t={});let i,a;for(a in n)t[a]==null&&s.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(s.setProperty(a,i),n[a]=i);return n}function bs(e,t={},n,s){const i={};return s||ye(()=>i.children=st(e,t.children,i.children)),ye(()=>typeof t.ref=="function"&&ws(t.ref,e)),ye(()=>gi(e,t,n,!0,i,!0)),i}function ws(e,t,n){return ee(()=>e(t,n))}function It(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return st(e,t,s,n);ye(i=>st(e,t(),i,n),s)}function gi(e,t,n,s,i={},a=!1){t||(t={});for(const o in i)if(!(o in t)){if(o==="children")continue;i[o]=Yn(e,o,null,i[o],n,a)}for(const o in t){if(o==="children")continue;const l=t[o];i[o]=Yn(e,o,l,i[o],n,a)}}function mi(e){let t,n;return!D.context||!(t=D.registry.get(n=pi()))?e():(D.completed&&D.completed.add(t),D.registry.delete(n),t)}function yi(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Qn(e,t,n){const s=t.trim().split(/\s+/);for(let i=0,a=s.length;i<a;i++)e.classList.toggle(s[i],n)}function Yn(e,t,n,s,i,a){let o,l,u,f,m;if(t==="style")return hi(e,n,s);if(t==="classList")return fi(e,n,s);if(n===s)return s;if(t==="ref")a||n(e);else if(t.slice(0,3)==="on:"){const g=t.slice(3);s&&e.removeEventListener(g,s),n&&e.addEventListener(g,n)}else if(t.slice(0,10)==="oncapture:"){const g=t.slice(10);s&&e.removeEventListener(g,s,!0),n&&e.addEventListener(g,n,!0)}else if(t.slice(0,2)==="on"){const g=t.slice(2).toLowerCase(),x=ii.has(g);if(!x&&s){const j=Array.isArray(s)?s[0]:s;e.removeEventListener(g,j)}(x||n)&&(vs(e,g,n,x),x&&ps([g]))}else if(t.slice(0,5)==="attr:")Ot(e,t.slice(5),n);else if((m=t.slice(0,5)==="prop:")||(u=ti.has(t))||!i&&((f=ri(t,e.tagName))||(l=ei.has(t)))||(o=e.nodeName.includes("-"))){if(m)t=t.slice(5),l=!0;else if(D.context&&e.isConnected)return n;t==="class"||t==="className"?xs(e,n):o&&!l&&!u?e[yi(t)]=n:e[f||t]=n}else{const g=i&&t.indexOf(":")>-1&&oi[t.split(":")[0]];g?di(e,g,t,n):Ot(e,ni[t]||t,n)}return n}function Es(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return n||document}}),D.registry&&!D.done&&(D.done=_$HY.done=!0);n;){const s=n[t];if(s&&!n.disabled){const i=n[`${t}Data`];if(i!==void 0?s.call(n,i,e):s.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function st(e,t,n,s,i){const a=!!D.context&&e.isConnected;if(a){!n&&(n=[...e.childNodes]);let u=[];for(let f=0;f<n.length;f++){const m=n[f];m.nodeType===8&&m.data.slice(0,2)==="!$"?m.remove():u.push(m)}n=u}for(;typeof n=="function";)n=n();if(t===n)return n;const o=typeof t,l=s!==void 0;if(e=l&&n[0]&&n[0].parentNode||e,o==="string"||o==="number"){if(a||o==="number"&&(t=t.toString(),t===n))return n;if(l){let u=n[0];u&&u.nodeType===3?u.data!==t&&(u.data=t):u=document.createTextNode(t),n=Te(e,n,s,u)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||o==="boolean"){if(a)return n;n=Te(e,n,s)}else{if(o==="function")return ye(()=>{let u=t();for(;typeof u=="function";)u=u();n=st(e,u,n,s)}),()=>n;if(Array.isArray(t)){const u=[],f=n&&Array.isArray(n);if(an(u,t,n,i))return ye(()=>n=st(e,u,n,s,!0)),()=>n;if(a){if(!u.length)return n;if(s===void 0)return[...e.childNodes];let m=u[0],g=[m];for(;(m=m.nextSibling)!==s;)g.push(m);return n=g}if(u.length===0){if(n=Te(e,n,s),l)return n}else f?n.length===0?Jn(e,u,s):li(e,n,u):(n&&Te(e),Jn(e,u));n=u}else if(t.nodeType){if(a&&t.parentNode)return n=l?[t]:t;if(Array.isArray(n)){if(l)return n=Te(e,n,s,t);Te(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function an(e,t,n,s){let i=!1;for(let a=0,o=t.length;a<o;a++){let l=t[a],u=n&&n[e.length],f;if(!(l==null||l===!0||l===!1))if((f=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))i=an(e,l,u)||i;else if(f==="function")if(s){for(;typeof l=="function";)l=l();i=an(e,Array.isArray(l)?l:[l],Array.isArray(u)?u:[u])||i}else e.push(l),i=!0;else{const m=String(l);u&&u.nodeType===3&&u.data===m?e.push(u):e.push(document.createTextNode(m))}}return i}function Jn(e,t,n=null){for(let s=0,i=t.length;s<i;s++)e.insertBefore(t[s],n)}function Te(e,t,n,s){if(n===void 0)return e.textContent="";const i=s||document.createTextNode("");if(t.length){let a=!1;for(let o=t.length-1;o>=0;o--){const l=t[o];if(i!==l){const u=l.parentNode===e;!a&&!o?u?e.replaceChild(i,l):e.insertBefore(i,n):u&&l.remove()}else a=!0}}else e.insertBefore(i,n);return[i]}function pi(){return D.getNextContextId()}var xi="http://www.w3.org/2000/svg";function js(e,t=!1){return t?document.createElementNS(xi,e):document.createElement(e)}function vi(e){const{useShadow:t}=e,n=document.createTextNode(""),s=()=>e.mount||document.body,i=Hn();let a,o=!!D.context;return fn(()=>{o&&(Hn().user=o=!1),a||(a=Dr(i,()=>se(()=>e.children)));const l=s();if(l instanceof HTMLHeadElement){const[u,f]=H(!1),m=()=>f(!0);me(g=>It(l,()=>u()?g():a(),null)),Ve(m)}else{const u=js(e.isSVG?"g":"div",e.isSVG),f=t&&u.attachShadow?u.attachShadow({mode:"open"}):u;Object.defineProperty(u,"_$host",{get(){return n.parentNode},configurable:!0}),It(f,a),l.appendChild(u),e.ref&&e.ref(u),Ve(()=>l.removeChild(u))}},void 0,{render:!o}),n}function bi(e){const[t,n]=hs(e,["component"]),s=se(()=>t.component);return se(()=>{const i=s();switch(typeof i){case"function":return ee(()=>i(n));case"string":const a=ai.has(i),o=D.context?mi():js(i,a);return bs(o,n,a),o}})}var wi=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},Ss=class{constructor(e){this.generateIdentifier=e,this.kv=new wi}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},Ei=class extends Ss{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function ji(e){if("values"in Object)return Object.values(e);const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function Si(e,t){const n=ji(e);if("find"in n)return n.find(t);const s=n;for(let i=0;i<s.length;i++){const a=s[i];if(t(a))return a}}function Ke(e,t){Object.entries(e).forEach(([n,s])=>t(s,n))}function Nt(e,t){return e.indexOf(t)!==-1}function Xn(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s))return s}}var Ci=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Si(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Ni=e=>Object.prototype.toString.call(e).slice(8,-1),Cs=e=>typeof e>"u",Ti=e=>e===null,rt=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,on=e=>rt(e)&&Object.keys(e).length===0,xe=e=>Array.isArray(e),Ai=e=>typeof e=="string",ki=e=>typeof e=="number"&&!isNaN(e),Pi=e=>typeof e=="boolean",_i=e=>e instanceof RegExp,it=e=>e instanceof Map,at=e=>e instanceof Set,Ns=e=>Ni(e)==="Symbol",Di=e=>e instanceof Date&&!isNaN(e.valueOf()),Oi=e=>e instanceof Error,Zn=e=>typeof e=="number"&&isNaN(e),Ii=e=>Pi(e)||Ti(e)||Cs(e)||ki(e)||Ai(e)||Ns(e),Li=e=>typeof e=="bigint",Ri=e=>e===1/0||e===-1/0,Gi=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Fi=e=>e instanceof URL,Ts=e=>e.replace(/\./g,"\\."),Xt=e=>e.map(String).map(Ts).join("."),nt=e=>{const t=[];let n="";for(let i=0;i<e.length;i++){let a=e.charAt(i);if(a==="\\"&&e.charAt(i+1)==="."){n+=".",i++;continue}if(a==="."){t.push(n),n="";continue}n+=a}const s=n;return t.push(s),t};function ue(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var As=[ue(Cs,"undefined",()=>null,()=>{}),ue(Li,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),ue(Di,"Date",e=>e.toISOString(),e=>new Date(e)),ue(Oi,"Error",(e,t)=>{const n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n},(e,t)=>{const n=new Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n}),ue(_i,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),ue(at,"set",e=>[...e.values()],e=>new Set(e)),ue(it,"map",e=>[...e.entries()],e=>new Map(e)),ue(e=>Zn(e)||Ri(e),"number",e=>Zn(e)?"NaN":e>0?"Infinity":"-Infinity",Number),ue(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),ue(Fi,"URL",e=>e.toString(),e=>new URL(e))];function Ft(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var ks=Ft((e,t)=>Ns(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{const s=n.symbolRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown symbol");return s}),Ui=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Ps=Ft(Gi,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=Ui[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function _s(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Ds=Ft(_s,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};const s={};return n.forEach(i=>{s[i]=e[i]}),s},(e,t,n)=>{const s=n.classRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(s.prototype),e)}),Os=Ft((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{const s=n.customTransformerRegistry.findByName(t[1]);if(!s)throw new Error("Trying to deserialize unknown custom value");return s.deserialize(e)}),Mi=[Ds,ks,Os,Ps],es=(e,t)=>{const n=Xn(Mi,i=>i.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const s=Xn(As,i=>i.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},Is={};As.forEach(e=>{Is[e.annotation]=e});var Bi=(e,t,n)=>{if(xe(t))switch(t[0]){case"symbol":return ks.untransform(e,t,n);case"class":return Ds.untransform(e,t,n);case"custom":return Os.untransform(e,t,n);case"typed-array":return Ps.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const s=Is[t];if(!s)throw new Error("Unknown transformation: "+t);return s.untransform(e,n)}},Ae=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function Ls(e){if(Nt(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Nt(e,"prototype"))throw new Error("prototype is not allowed as a property");if(Nt(e,"constructor"))throw new Error("constructor is not allowed as a property")}var qi=(e,t)=>{Ls(t);for(let n=0;n<t.length;n++){const s=t[n];if(at(e))e=Ae(e,+s);else if(it(e)){const i=+s,a=+t[++n]==0?"key":"value",o=Ae(e,i);switch(a){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[s]}return e},ln=(e,t,n)=>{if(Ls(t),t.length===0)return n(e);let s=e;for(let a=0;a<t.length-1;a++){const o=t[a];if(xe(s)){const l=+o;s=s[l]}else if(rt(s))s=s[o];else if(at(s)){const l=+o;s=Ae(s,l)}else if(it(s)){if(a===t.length-2)break;const u=+o,f=+t[++a]==0?"key":"value",m=Ae(s,u);switch(f){case"key":s=m;break;case"value":s=s.get(m);break}}}const i=t[t.length-1];if(xe(s)?s[+i]=n(s[+i]):rt(s)&&(s[i]=n(s[i])),at(s)){const a=Ae(s,+i),o=n(a);a!==o&&(s.delete(a),s.add(o))}if(it(s)){const a=+t[t.length-2],o=Ae(s,a);switch(+i==0?"key":"value"){case"key":{const u=n(o);s.set(u,s.get(o)),u!==o&&s.delete(o);break}case"value":{s.set(o,n(s.get(o)));break}}}return e};function cn(e,t,n=[]){if(!e)return;if(!xe(e)){Ke(e,(a,o)=>cn(a,t,[...n,...nt(o)]));return}const[s,i]=e;i&&Ke(i,(a,o)=>{cn(a,t,[...n,...nt(o)])}),t(s,n)}function $i(e,t,n){return cn(t,(s,i)=>{e=ln(e,i,a=>Bi(a,s,n))}),e}function Vi(e,t){function n(s,i){const a=qi(e,nt(i));s.map(nt).forEach(o=>{e=ln(e,o,()=>a)})}if(xe(t)){const[s,i]=t;s.forEach(a=>{e=ln(e,nt(a),()=>e)}),i&&Ke(i,n)}else Ke(t,n);return e}var Ki=(e,t)=>rt(e)||xe(e)||it(e)||at(e)||_s(e,t);function Wi(e,t,n){const s=n.get(e);s?s.push(t):n.set(e,[t])}function zi(e,t){const n={};let s;return e.forEach(i=>{if(i.length<=1)return;t||(i=i.map(l=>l.map(String)).sort((l,u)=>l.length-u.length));const[a,...o]=i;a.length===0?s=o.map(Xt):n[Xt(a)]=o.map(Xt)}),s?on(n)?[s]:[s,n]:on(n)?void 0:n}var Rs=(e,t,n,s,i=[],a=[],o=new Map)=>{const l=Ii(e);if(!l){Wi(e,i,t);const j=o.get(e);if(j)return s?{transformedValue:null}:j}if(!Ki(e,n)){const j=es(e,n),C=j?{transformedValue:j.value,annotations:[j.type]}:{transformedValue:e};return l||o.set(e,C),C}if(Nt(a,e))return{transformedValue:null};const u=es(e,n),f=(u==null?void 0:u.value)??e,m=xe(f)?[]:{},g={};Ke(f,(j,C)=>{if(C==="__proto__"||C==="constructor"||C==="prototype")throw new Error(`Detected property ${C}. This is a prototype pollution risk, please remove it from your object.`);const _=Rs(j,t,n,s,[...i,C],[...a,e],o);m[C]=_.transformedValue,xe(_.annotations)?g[C]=_.annotations:rt(_.annotations)&&Ke(_.annotations,(S,y)=>{g[Ts(C)+"."+y]=S})});const x=on(g)?{transformedValue:m,annotations:u?[u.type]:void 0}:{transformedValue:m,annotations:u?[u.type,g]:g};return l||o.set(e,x),x};function Gs(e){return Object.prototype.toString.call(e).slice(8,-1)}function ts(e){return Gs(e)==="Array"}function Hi(e){if(Gs(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function Qi(e,t,n,s,i){const a={}.propertyIsEnumerable.call(s,t)?"enumerable":"nonenumerable";a==="enumerable"&&(e[t]=n),i&&a==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function un(e,t={}){if(ts(e))return e.map(i=>un(i,t));if(!Hi(e))return e;const n=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...n,...s].reduce((i,a)=>{if(ts(t.props)&&!t.props.includes(a))return i;const o=e[a],l=un(o,t);return Qi(i,a,l,e,t.nonenumerable),i},{})}var V=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Ei,this.symbolRegistry=new Ss(t=>t.description??""),this.customTransformerRegistry=new Ci,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=Rs(e,t,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const i=zi(t,this.dedupe);return i&&(s.meta={...s.meta,referentialEqualities:i}),s}deserialize(e){const{json:t,meta:n}=e;let s=un(t);return n!=null&&n.values&&(s=$i(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=Vi(s,n.referentialEqualities)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};V.defaultInstance=new V;V.serialize=V.defaultInstance.serialize.bind(V.defaultInstance);V.deserialize=V.defaultInstance.deserialize.bind(V.defaultInstance);V.stringify=V.defaultInstance.stringify.bind(V.defaultInstance);V.parse=V.defaultInstance.parse.bind(V.defaultInstance);V.registerClass=V.defaultInstance.registerClass.bind(V.defaultInstance);V.registerSymbol=V.defaultInstance.registerSymbol.bind(V.defaultInstance);V.registerCustom=V.defaultInstance.registerCustom.bind(V.defaultInstance);V.allowErrorProps=V.defaultInstance.allowErrorProps.bind(V.defaultInstance);var Fs=V.serialize,Yi=V.stringify;function Ji(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function Xi(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function Zi({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function ea({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function ta(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var na=(e,t=!1)=>{const{json:n}=Fs(e);return JSON.stringify(n,null,t?2:void 0)},St=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,sa=(e,t)=>e.queryHash.localeCompare(t.queryHash),Us=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,ra=(e,t)=>St(e)===St(t)?Us(e,t):St(e)>St(t)?1:-1,ia={status:ra,"query hash":sa,"last updated":Us},Ct=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,Ms=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,aa=(e,t)=>Ct(e)===Ct(t)?Ms(e,t):Ct(e)>Ct(t)?1:-1,oa={status:aa,"last updated":Ms},la=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),ca=()=>{const[e,t]=H("dark");return os(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const s=i=>{t(i.matches?"dark":"light")};n.addEventListener("change",s),Ve(()=>n.removeEventListener("change",s))}),e},Ze=(e,t,n)=>{if(t.length===0)return n;if(e instanceof Map){const s=new Map(e);if(t.length===1)return s.set(t[0],n),s;const[i,...a]=t;return s.set(i,Ze(s.get(i),a,n)),s}if(e instanceof Set){const s=Ze(Array.from(e),t,n);return new Set(s)}if(Array.isArray(e)){const s=[...e];if(t.length===1)return s[t[0]]=n,s;const[i,...a]=t;return s[i]=Ze(s[i],a,n),s}if(e instanceof Object){const s={...e};if(t.length===1)return s[t[0]]=n,s;const[i,...a]=t;return s[i]=Ze(s[i],a,n),s}return e},et=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[s,...i]=t;return n.set(s,et(n.get(s),i)),n}if(e instanceof Set){const n=et(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((a,o)=>o.toString()!==t[0]);const[s,...i]=t;return n[s]=et(n[s],i),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[s,...i]=t;return n[s]=et(n[s],i),n}return e},Bs=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const s=document.createElement("style"),i=document.createTextNode("");s.appendChild(i),s.id="_goober",s.setAttribute("nonce",e),t?t.appendChild(s):document.head.appendChild(s)},ke,ot,lt,ct,we,ut,Pe,_e,De,Oe,Ie,Le,dt,ns,ua=(ns=class{constructor(e){q(this,ke);q(this,ot);q(this,lt);q(this,ct);q(this,we,!1);q(this,ut);q(this,Pe);q(this,_e);q(this,De);q(this,Oe);q(this,Ie);q(this,Le);q(this,dt);const{client:t,queryFlavor:n,version:s,onlineManager:i,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:f,shadowDOMTarget:m}=e;U(this,ke,H(t)),U(this,lt,n),U(this,ct,s),U(this,ot,i),U(this,ut,f),U(this,Pe,m),U(this,_e,H(a)),U(this,De,H(o)),U(this,Oe,H(l)),U(this,Ie,H(u))}setButtonPosition(e){A(this,_e)[1](e)}setPosition(e){A(this,De)[1](e)}setInitialIsOpen(e){A(this,Oe)[1](e)}setErrorTypes(e){A(this,Ie)[1](e)}setClient(e){A(this,ke)[1](e)}mount(e){if(A(this,we))throw new Error("Devtools is already mounted");const t=ys(()=>{const n=this,[s]=A(this,_e),[i]=A(this,De),[a]=A(this,Oe),[o]=A(this,Ie),[l]=A(this,ke);let u;return A(this,Le)?u=A(this,Le):(u=gs(()=>Promise.resolve().then(()=>require("./BMGNQTAT-ztWu0zq1.cjs"))),U(this,Le,u)),Bs(A(this,ut),A(this,Pe)),gn(u,mn({get queryFlavor(){return A(n,lt)},get version(){return A(n,ct)},get onlineManager(){return A(n,ot)},get shadowDOMTarget(){return A(n,Pe)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return i()},get initialIsOpen(){return a()},get errorTypes(){return o()}}))},e);U(this,we,!0),U(this,dt,t)}unmount(){var e;if(!A(this,we))throw new Error("Devtools is not mounted");(e=A(this,dt))==null||e.call(this),U(this,we,!1)}},ke=new WeakMap,ot=new WeakMap,lt=new WeakMap,ct=new WeakMap,we=new WeakMap,ut=new WeakMap,Pe=new WeakMap,_e=new WeakMap,De=new WeakMap,Oe=new WeakMap,Ie=new WeakMap,Le=new WeakMap,dt=new WeakMap,ns),Re,ft,ht,gt,Ee,mt,Ge,Fe,Ue,Me,Be,qe,$e,yt,ss,da=(ss=class{constructor(e){q(this,Re);q(this,ft);q(this,ht);q(this,gt);q(this,Ee,!1);q(this,mt);q(this,Ge);q(this,Fe);q(this,Ue);q(this,Me);q(this,Be);q(this,qe);q(this,$e);q(this,yt);const{client:t,queryFlavor:n,version:s,onlineManager:i,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:f,shadowDOMTarget:m,onClose:g}=e;U(this,Re,H(t)),U(this,ht,n),U(this,gt,s),U(this,ft,i),U(this,mt,f),U(this,Ge,m),U(this,Fe,H(a)),U(this,Ue,H(o)),U(this,Me,H(l)),U(this,Be,H(u)),U(this,qe,H(g))}setButtonPosition(e){A(this,Fe)[1](e)}setPosition(e){A(this,Ue)[1](e)}setInitialIsOpen(e){A(this,Me)[1](e)}setErrorTypes(e){A(this,Be)[1](e)}setClient(e){A(this,Re)[1](e)}setOnClose(e){A(this,qe)[1](()=>e)}mount(e){if(A(this,Ee))throw new Error("Devtools is already mounted");const t=ys(()=>{const n=this,[s]=A(this,Fe),[i]=A(this,Ue),[a]=A(this,Me),[o]=A(this,Be),[l]=A(this,Re),[u]=A(this,qe);let f;return A(this,$e)?f=A(this,$e):(f=gs(()=>Promise.resolve().then(()=>require("./UODQIBEW-DAaXM-q3.cjs"))),U(this,$e,f)),Bs(A(this,mt),A(this,Ge)),gn(f,mn({get queryFlavor(){return A(n,ht)},get version(){return A(n,gt)},get onlineManager(){return A(n,ft)},get shadowDOMTarget(){return A(n,Ge)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return i()},get initialIsOpen(){return a()},get errorTypes(){return o()},get onClose(){return u()}}))},e);U(this,Ee,!0),U(this,yt,t)}unmount(){var e;if(!A(this,Ee))throw new Error("Devtools is not mounted");(e=A(this,yt))==null||e.call(this),U(this,Ee,!1)}},Re=new WeakMap,ft=new WeakMap,ht=new WeakMap,gt=new WeakMap,Ee=new WeakMap,mt=new WeakMap,Ge=new WeakMap,Fe=new WeakMap,Ue=new WeakMap,Me=new WeakMap,Be=new WeakMap,qe=new WeakMap,$e=new WeakMap,yt=new WeakMap,ss);function fa(e){const t=L.useQueryClient(e.client),n=ie.useRef(null),{buttonPosition:s,position:i,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}=e,[f]=ie.useState(new ua({client:t,queryFlavor:"React Query",version:"5",onlineManager:L.onlineManager,buttonPosition:s,position:i,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}));return ie.useEffect(()=>{f.setClient(t)},[t,f]),ie.useEffect(()=>{s&&f.setButtonPosition(s)},[s,f]),ie.useEffect(()=>{i&&f.setPosition(i)},[i,f]),ie.useEffect(()=>{f.setInitialIsOpen(a||!1)},[a,f]),ie.useEffect(()=>{f.setErrorTypes(o||[])},[o,f]),ie.useEffect(()=>(n.current&&f.mount(n.current),()=>{f.unmount()}),[f]),r.jsx("div",{className:"tsqd-parent-container",ref:n})}function ha(e){const t=L.useQueryClient(e.client),n=ie.useRef(null),{errorTypes:s,styleNonce:i,shadowDOMTarget:a}=e,[o]=ie.useState(new da({client:t,queryFlavor:"React Query",version:"5",onlineManager:L.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:s,styleNonce:i,shadowDOMTarget:a,onClose:e.onClose}));return ie.useEffect(()=>{o.setClient(t)},[t,o]),ie.useEffect(()=>{o.setOnClose(e.onClose??(()=>{}))},[e.onClose,o]),ie.useEffect(()=>{o.setErrorTypes(s||[])},[s,o]),ie.useEffect(()=>(n.current&&o.mount(n.current),()=>{o.unmount()}),[o]),r.jsx("div",{style:{height:"500px",...e.style},className:"tsqd-parent-container",ref:n})}var ga=process.env.NODE_ENV!=="development"?function(){return null}:fa;process.env.NODE_ENV;const ma=rs.atom({}),qs=()=>rs.useAtom(ma),pt=(e,t)=>{const[n]=qs();return h.get(n,e,t)},X=()=>pt("apiUrl","/chai/api"),k={ASK_AI:"ASK_AI",GET_PAGE:"GET_PAGE",CREATE_PAGE:"CREATE_PAGE",UPDATE_PAGE:"UPDATE_PAGE",DELETE_PAGE:"DELETE_PAGE",CHANGE_SLUG:"CHANGE_SLUG",TAKE_OFFLINE:"TAKE_OFFLINE",PUBLISH_PAGE:"PUBLISH_PAGE",PUBLISH_CHANGES:"PUBLISH_CHANGES",ADD_NEW_LANGUAGE:"ADD_NEW_LANGUAGE",EDIT_LANGUAGE:"EDIT_LANGUAGE",DELETE_LANGUAGE:"DELETE_LANGUAGE",GET_CHANGES:"GET_CHANGES",GET_SERVER_BLOCK:"GET_SERVER_BLOCK",GET_LANGUAGE_PAGES:"GET_LANGUAGE_PAGES",GET_PROJECT_PAGES:"GET_PROJECT_PAGES",UPDATE_WEBSITE_SETTINGS:"UPDATE_WEBSITE_SETTINGS",GET_COLLECTIONS:"GET_COLLECTIONS",SEARCH_PAGES:"SEARCH_PAGES",GET_WEBSITE_SETTINGS:"GET_WEBSITE_SETTINGS",AI_CONTEXT:"AI_CONTEXT",GET_WEBSITE_DATA:"GET_WEBSITE_DATA",UPDATE_WEBSITE_DATA:"UPDATE_WEBSITE_DATA"},yn=()=>{const e=L.useQueryClient(),{data:t}=L.useQuery({queryKey:[k.AI_CONTEXT],initialData:"",queryFn:()=>""});return{setAiContext:w.useCallback(s=>{e.setQueryData([k.AI_CONTEXT],s)},[]),aiContext:t}},Z=async(e,t)=>{const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),s=await n.json();if(s!=null&&s.error||n.status===400||!n.ok)throw new Error((s==null?void 0:s.error)||"Something went wrong.");return s},ya=()=>{const e=X(),{aiContext:t}=yn();return w.useCallback(async(n,s,i,a)=>Z(e,{action:k.ASK_AI,data:{type:n,prompt:s,blocks:i,context:t,lang:a}}),[e,t])},pa=()=>{const e=X();return{getUILibraryBlock:async(i,a)=>{const u=(await(await fetch(i.url+(a.path?"/blocks/"+a.path:"/"+a.uuid+".html"))).text()).replace(/---([\s\S]*?)---/g,"");return he.getBlocksFromHTML(`${u}`)},getUILibraryBlocks:async i=>{try{return(await(await fetch(i.url+"/blocks.json")).json()).map(l=>({...l,preview:i.url.replace("chaiblocks","")+l.preview}))}catch(a){return console.error(a),[]}},onSave:async({page:i,blocks:a})=>{try{return await Z(e,{action:"UPDATE_PAGE",data:{id:i,blocks:a}})}catch{return new Error("Failed to save blocks")}}}};function je(){const[e,t]=w.useState(new URLSearchParams(window.location.search));return w.useEffect(()=>{const n=()=>{t(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}},[]),[e,t]}const pn=()=>{const e=X();return L.useQuery({queryKey:[k.GET_PROJECT_PAGES],staleTime:1e3*60*5,queryFn:async()=>Z(e,{action:k.GET_PROJECT_PAGES})||[]})},Se=()=>{const[e]=je(),t=e.get("page"),{data:n,isFetching:s}=pn();return{data:w.useMemo(()=>h.find(n,{id:t})||{},[n,t]),isFetching:s}},xa=()=>L.useQuery({queryKey:["uiLibraries"],initialData:[],queryFn:async()=>[{uuid:"meraki-ui",name:"Meraki UI",url:"https://chai-ui-blocks.vercel.app"},{uuid:"chaiblocks",name:"UI Blocks",url:"https://chaibuilder.com/chaiblocks"}]}),va=()=>{const[e]=je(),t=e.get("page"),n=X(),{setAiContext:s}=yn();return L.useQuery({queryKey:[k.GET_PAGE,t],initialData:[],queryFn:async()=>{const a=(await Z(n,{action:k.GET_PAGE,data:{id:t,draft:!0}})).blocks??[],o=h.find(a,{_type:"@chai/ai-context"});return s(h.get(o,"_value","")||""),a},enabled:!!t})},ba=e=>w.useMemo(()=>{if(!e||h.isEmpty(e))return{blocks:[],theme:{}};const t=h.find(e,{_type:"@chai/theme"}),n=h.get(t,"_value",{})||{},s=h.filter(e,i=>!h.includes(i==null?void 0:i._type,"@chai/"));return{theme:n,blocks:s}},[e]),xn=()=>{const e=X();return L.useQuery({queryKey:[k.GET_WEBSITE_SETTINGS],initialData:{theme:{},fallbackLang:"en",languages:[]},queryFn:async()=>Z(e,{action:k.GET_WEBSITE_SETTINGS,data:{draft:!0}})})},wa=()=>{const{data:e}=pn(),t=X();return{getGlobalBlocks:async()=>{const n={};for(const s of e??[])h.isEmpty(s==null?void 0:s.slug)&&(n[s.id]={name:h.startCase(s.name??s.slug),description:""});return n},getGlobalBlockBlocks:async n=>n?(await Z(t,{action:"GET_PAGE",data:{id:n,draft:!0}})).blocks:[]}},Ea=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.UPDATE_WEBSITE_SETTINGS,data:s}),onSuccess:(s,i)=>{var a;t.invalidateQueries({queryKey:[k.GET_WEBSITE_SETTINGS]}),(a=i==null?void 0:i.settings)!=null&&a.theme||n({title:"Website settings updated successfully."})},onError:s=>{n({variant:"destructive",title:"Failed to update website settings",description:s.message})}})},ja=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.UPDATE_WEBSITE_DATA,data:s}),onSuccess:()=>{t.invalidateQueries({queryKey:[k.GET_WEBSITE_DATA]}),n({title:"Website data updated successfully."})},onError:s=>{n({variant:"destructive",title:"Failed to update website data",description:s.message})}})},xt=()=>{const e=X();return L.useQuery({queryKey:[k.GET_COLLECTIONS],initialData:[],queryFn:async()=>Z(e,{action:k.GET_COLLECTIONS})})},Sa=()=>{const e=X();return L.useMutation({mutationFn:async({collection:t,query:n})=>{try{return Z(e,{action:k.SEARCH_PAGES,data:{collection:t,query:Array.isArray(n)&&n.length>0?n[0]:n}})||[]}catch{return[]}}})},pe={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",ak:"Akan",sq:"Albanian",am:"Amharic",ar:"Arabic",an:"Aragonese",hy:"Armenian",as:"Assamese",av:"Avaric",ae:"Avestan",ay:"Aymara",az:"Azerbaijani",bm:"Bambara",ba:"Bashkir",eu:"Basque",be:"Belarusian",bn:"Bengali",bh:"Bihari",bi:"Bislama",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",ny:"Chichewa",zh:"Chinese","zh-Hans":"Chinese (Simplified)","zh-Hant":"Chinese (Traditional)",cv:"Chuvash",kw:"Cornish",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",dv:"Maldivian",nl:"Dutch",dz:"Dzongkha",en:"English",eo:"Esperanto",et:"Estonian",ee:"Ewe",fo:"Faroese",fj:"Fijian",fi:"Finnish",fr:"French",ff:"Fula, Pular",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Manx",ka:"Georgian",de:"German",el:"Greek",kl:"Kalaallisut",gn:"Guarani",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hz:"Herero",hi:"Hindi",ho:"Hiri Motu",hu:"Hungarian",is:"Icelandic",io:"Ido",ig:"Igbo",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",jv:"Javanese",kn:"Kannada",kr:"Kanuri",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ki:"Kikuyu",rw:"Kinyarwanda",rn:"Kirundi",ky:"Kyrgyz",kv:"Komi",kg:"Kongo",ko:"Korean",ku:"Kurdish",kj:"Kwanyama",lo:"Lao",la:"Latin",lv:"Latvian",li:"Limburgish",ln:"Lingala",lt:"Lithuanian",lu:"Luga-Katanga",lg:"Luganda, Ganda",lb:"Luxembourgish",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mh:"Marshallese",mo:"Moldavian",mn:"Mongolian",na:"Nauru",nv:"Navajo",ng:"Ndonga",nd:"Northern Ndebele",ne:"Nepali",no:"Norwegian",nb:"Norwegian bokmål",nn:"Norwegian nynorsk",ii:"Sichuan Yi",oc:"Occitan",oj:"Ojibwe",cu:"Old Church Slavonic",or:"Oriya",om:"Oromo",os:"Ossetian",pi:"Pāli",ps:"Pashto, Pushto",fa:"Persian (Farsi)",pl:"Polish",pt:"Portuguese",pa:"Punjabi (Eastern)",qu:"Quechua",rm:"Romansh",ro:"Romanian",ru:"Russian",se:"Sami",sm:"Samoan",sg:"Sango",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Swati",sk:"Slovak",sl:"Slovenian",so:"Somali",nr:"Southern Ndebele",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",ty:"Tahitian",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uyghur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",ve:"Venda",vi:"Vietnamese",vo:"Volapük",wa:"Wallon",cy:"Welsh",wo:"Wolof",fy:"Western Frisian",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",za:"Zhuang, Chuang",zu:"Zulu"},Ca={SLUG_ALREADY_USED:"This slug is already in use. Please choose a different one."},$s=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.CREATE_PAGE,data:s}),onSuccess:(s,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),n({title:`New ${i.collection==="global"?"global block":"page"} added successfully.`})},onError:(s,i)=>{n({variant:"destructive",title:`Failed to add new ${i.collection==="global"?"global block":"page"}.`,description:h.get(Ca,s.message,s.message)})}})},vn=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.UPDATE_PAGE,data:s}),onSuccess:(s,i)=>{i&&(i!=null&&i.primaryPage||i!=null&&i.seo)?t.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),i!=null&&i.seo?n({title:"SEO Settings updated successfully."}):n({title:`${i.collection==="global"?"Global block":"Page"} updated successfully.`})},onError:(s,i)=>{n({variant:"destructive",title:`Failed to update ${i.collection==="global"?"global block":"page"}.`,description:s.message})}})},Na=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.DELETE_PAGE,data:{id:s==null?void 0:s.id}}),onSuccess:(s,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),n({title:`${i.collection==="global"?"Global block":"Page"} deleted successfully.`})},onError:(s,i)=>{n({variant:"destructive",title:`Failed to delete ${i.collection==="global"?"global block":"page"}.`,description:s.message})}})},Ta=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.TAKE_OFFLINE,data:{id:s==null?void 0:s.id}}),onSuccess:(s,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),n({title:`${i.collection==="global"?"Global block":"Page"} taken offline successfully.`})},onError:(s,i)=>{n({variant:"destructive",title:`Failed to take offline ${i.collection==="global"?"global block":"page"}.`,description:s.message})}})},Aa=()=>{const e=X(),{toast:t}=d.useToast(),n=L.useQueryClient(),{data:s}=Se();return L.useMutation({mutationFn:async({ids:i})=>Z(e,{action:k.PUBLISH_CHANGES,data:{ids:i}}),onSuccess:()=>{t({title:"Your changes have been published successfully."}),n.invalidateQueries({queryKey:[k.GET_CHANGES]}),n.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),n.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,s==null?void 0:s.id]})},onError:()=>{t({title:"Failed to publish pages.",variant:"destructive"})}})},ka=()=>{const e=X(),{toast:t}=d.useToast(),n=L.useQueryClient();return L.useMutation({mutationFn:async({id:s,slug:i})=>Z(e,{action:k.CHANGE_SLUG,data:{id:s,slug:i}}),onSuccess:(s,{primaryPage:i})=>{t({title:"Slug changed successfully."}),i?n.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i]}):n.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]})},onError:()=>{t({title:"Failed to change slug",variant:"destructive"})}})},bn=()=>{const e=X(),[t]=je(),n=t.get("page");return L.useQuery({queryKey:[k.GET_LANGUAGE_PAGES,n],initialData:[],queryFn:async()=>{if(!n)return null;const s=await Z(e,{action:k.GET_LANGUAGE_PAGES,data:{id:n}});return h.reverse(h.sortBy(s,"primaryPage"))}})},Pa=()=>{const{selectedLang:e}=he.useLanguages(),{data:t,isFetching:n}=bn();return{data:w.useMemo(()=>h.find(t,{lang:e||""})||{},[t,e]),isFetching:n}},Vs=()=>{const{data:e,isFetching:t}=Pa(),n=e==null?void 0:e.seo,[s,i]=w.useState({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n}),a=w.useRef({initial:s,updated:s}),{selectedLang:o,fallbackLang:l,languages:u}=he.useLanguages(),f=o.length?o:l,{mutate:m,isPending:g}=vn(),x=g;w.useEffect(()=>{!t&&n&&i({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n})},[t,n]);const j=async()=>{m({id:e==null?void 0:e.id,seo:s}),a.current.initial=s,a.current.updated=s},C=()=>{i({...s,ogTitle:s.title,ogDescription:s.description})},_=()=>{i({...s,searchTitle:s.ogTitle,searchDescription:s.ogDescription})},S=y=>{const v={...s,[y.target.name]:y.target.name==="noIndex"||y.target.name==="noFollow"?y.target.checked:y.target.value};i(v),a.current.updated=v};return r.jsxs("div",{className:"relative pb-40",children:[r.jsxs("div",{className:"text-xs bg-gray-100 p-2 rounded-md text-left",children:["Slug: ",e==null?void 0:e.slug,"  ",u.length>0&&r.jsxs("span",{className:"text-blue-500 font-semibold",children:["(",h.get(pe,f,f),")"]})]}),r.jsx("form",{className:"space-y-8",children:r.jsxs(d.Accordion,{type:"multiple",defaultValue:["page"],children:[r.jsxs(d.AccordionItem,{value:"page",children:[r.jsx(d.AccordionTrigger,{className:"text-slate-700 font-semibold",children:"SEO"}),r.jsx(d.AccordionContent,{className:"pt-2",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"title",children:"SEO Title"}),r.jsxs(r.Fragment,{children:[r.jsx(d.Input,{type:"text",id:"title",name:"title",value:s.title,onChange:S,disabled:x,placeholder:"Enter SEO title"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The title should be between 10 and 60 characters."})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"description",children:"SEO Description"}),r.jsx(d.Textarea,{id:"description",name:"description",value:s.description,onChange:S,disabled:x,placeholder:"Enter SEO description"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The description should be between 50 and 160 characters."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"title",children:"Canonical URL"}),r.jsx(d.Input,{type:"text",id:"canonicalUrl",name:"canonicalUrl",value:s.canonicalUrl,onChange:S,disabled:x,placeholder:"Enter Canonical URL"})]}),r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsx(d.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:s.noIndex,onChange:S,disabled:x,className:"h-4 w-4"}),r.jsx(d.Label,{className:"text-xs pb-1",htmlFor:"noIndex",children:"No Index"})]}),r.jsx("p",{className:"mt-0 text-[10px] font-light text-gray-400 leading-4",children:"Check this if you don't want search engines to index this page."})]}),r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsx(d.Input,{type:"checkbox",id:"noFollow",name:"noFollow",checked:s.noFollow,onChange:S,disabled:x,className:"h-4 w-4"}),r.jsx(d.Label,{className:"text-xs pb-1",htmlFor:"noIndex",children:"No Follow"})]}),r.jsx("p",{className:"text-[10px] font-light text-gray-400 leading-4",children:"Check this if you don't want search engines to follow links on this page."})]})]})})]}),r.jsxs(d.AccordionItem,{value:"og",children:[r.jsx(d.AccordionTrigger,{className:"text-slate-700 font-bold",children:"OG"}),r.jsx(d.AccordionContent,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:C,children:"Copy from SEO Settings"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"ogTitle",children:"OG Title"}),r.jsx(d.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:s.ogTitle,onChange:S,disabled:x,placeholder:"Enter OG title"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The OG title should be between 10 and 60 characters."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs pb-1",htmlFor:"ogDescription",children:"OG Description"}),r.jsx(d.Textarea,{id:"ogDescription",name:"ogDescription",value:s.ogDescription,onChange:S,disabled:x,placeholder:"Enter OG description"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The OG description should be between 50 and 160 characters."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs pb-1",htmlFor:"ogImage",children:"OG Image URL"}),r.jsx(d.Input,{type:"text",id:"ogImage",name:"ogImage",value:s.ogImage,onChange:S,disabled:x,placeholder:"Enter OG image URL"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"Enter a valid URL for the OG image."})]})]})})]}),r.jsxs(d.AccordionItem,{value:"search",children:[r.jsx(d.AccordionTrigger,{className:"text-slate-700 font-bold",children:"SEARCH"}),r.jsx(d.AccordionContent,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:_,children:"Copy from OG Settings"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"searchTitle",children:"Search Title"}),r.jsx(d.Input,{type:"text",id:"searchTitle",name:"searchTitle",value:s.searchTitle,onChange:S,disabled:x,placeholder:"Enter search title"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The search title should be between 10 and 60 characters."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"searchDescription",children:"Search Description"}),r.jsx(d.Textarea,{id:"searchDescription",name:"searchDescription",value:s.searchDescription,onChange:S,placeholder:"Enter search description"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The search description should be between 50 and 160 characters."})]})]})})]}),r.jsxs(d.AccordionItem,{value:"jsonLD",children:[r.jsx(d.AccordionTrigger,{className:"text-slate-700 font-bold",children:"JSON-LD"}),r.jsx(d.AccordionContent,{children:r.jsx("div",{className:"space-y-4",children:r.jsx("div",{children:r.jsx(d.Textarea,{id:"jsonLD",name:"jsonLD",rows:3,value:s.jsonLD,onChange:S,placeholder:"Enter JSON-LD"})})})})]})]})}),r.jsx("div",{className:"w-full flex items-center justify-end mt-4",children:r.jsx(d.Button,{size:"lg",variant:"default",onClick:j,disabled:h.isEqual(a.current.initial,s)||x,children:g?"Saving...":"Save"})})]})};Vs.displayName="SeoPanel";const Ks=({page:e,onClose:t})=>{const[n,s]=w.useState(e.slug||""),{mutate:i,isPending:a}=ka(),{data:o}=xt(),l=h.find(o,{key:e==null?void 0:e.collection}),u=m=>{m.preventDefault(),i({...e,slug:n},{onSuccess:t})},f=(e==null?void 0:e.lang)||"";return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Change Slug"}),r.jsx(d.DialogDescription,{className:"text-xs",children:r.jsxs(d.Alert,{variant:"destructive",className:"mt-2",children:[r.jsx(P.AlertCircle,{className:"h-4 w-4"}),"Changing the slug may have impact on your SEO. Please proceed with caution."]})})]}),r.jsxs("form",{onSubmit:u,children:[r.jsxs("div",{className:"space-y-4 py-4 text-sm ",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{children:[r.jsx("span",{children:"Type:"}),r.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(l==null?void 0:l.name)||(e==null?void 0:e.collection)]})]}),r.jsxs("div",{children:[r.jsx("span",{children:"Name:"}),r.jsxs("span",{className:"font-medium text-gray-600",children:[" ",e.name]})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",r.jsxs("small",{className:"font-light text-gray-500",children:["Slug should start with /",f]})]}),r.jsx(d.Input,{id:"slug",value:n,onChange:m=>{const g=m.target.value;h.startsWith(g,`/${f}`)&&s(g)},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:a||!h.startsWith(n,`/${f}`)||h.isEqual(e==null?void 0:e.slug,n),children:a?"Changing...":"Change Slug"})})]})]})})};function Ws({page:e,onClose:t}){const[,n]=je(),{mutate:s,isPending:i}=Na(),a=()=>{s(e,{onSuccess:()=>{e!=null&&e.primaryPage||(window.history.replaceState(null,"","/"),n(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate"))),t()}})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Confirm Deletion"}),r.jsxs(d.DialogDescription,{className:"py-4 text-slate-500",children:[r.jsxs("div",{children:["Are you sure you want to remove ",r.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)})," ",(e==null?void 0:e.collection)==="global"?"global block?":`page? ${e!=null&&e.primaryPage?"":"This will also delete all associated language pages."}`]}),e.lang&&r.jsxs("div",{className:"py-2 text-sm",children:["Language:"," ",r.jsx("span",{className:"font-medium text-gray-500",children:h.get(pe,e.lang,e.lang)})]})]})]}),r.jsxs(d.DialogFooter,{children:[r.jsx(d.Button,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(d.Button,{variant:"destructive",disabled:i,onClick:a,children:i?"Deleting...":"Delete"})]})]})})}const zs=({page:e,onClose:t})=>{const{mutate:n,isPending:s}=Ta(),i=async()=>{n(e,{onSuccess:t})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Confirm action"}),r.jsxs(d.DialogDescription,{children:["Are you sure you want to take offline"," ",r.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)}),"?"]})]}),r.jsxs(d.DialogFooter,{children:[r.jsx(d.Button,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(d.Button,{variant:"destructive",disabled:s,onClick:i,children:s?"Updating...":"Take offline"})]})]})})},Hs=({langProps:e,onClose:t,languages:n})=>{const{data:s}=Se(),[i,a]=w.useState(e.name||""),[o,l]=w.useState(e.edit?e.lang:""),[u,f]=w.useState(e.edit?e.slug:""),{mutate:m,isPending:g}=$s(),{mutate:x,isPending:j}=vn(),C=(e==null?void 0:e.collection)==="global",_=g||j,S=y=>{y.preventDefault();const v={name:i,lang:o,primaryPage:s==null?void 0:s.id,slug:u,collection:s==null?void 0:s.collection};v.collection=e.collection,e.edit&&(v.id=e==null?void 0:e.id),e.edit?x(v,{onSuccess:t}):m(v,{onSuccess:t})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{className:"sm:max-w-[425px] text-slate-600",children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:e.edit?"Edit language":"Add New language"}),r.jsx(d.DialogDescription,{className:"font-light",children:"Enter the details for the language"})]}),r.jsxs("form",{onSubmit:S,children:[r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"lang",className:"text-right",children:"Language"}),r.jsxs("select",{value:o,disabled:e.edit||h.isEmpty(n),onChange:y=>{const v=y.target.value;l(v),!C&&f(`/${v}`)},className:"flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 col-span-3",children:[r.jsx("option",{value:"",disabled:!0,selected:!0,children:e.edit?h.get(pe,e.lang,e.lang):h.isEmpty(n)?"All available language page is created.":"Choose language"}),h.map(n,y=>r.jsx("option",{value:y,children:h.get(pe,y,y)},y))]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"slug",className:"text-right",children:"Page Name"}),r.jsx(d.Input,{id:"name",value:i,onChange:y=>a(y.target.value),className:"col-span-3",required:!0,placeholder:"Enter page name"})]}),!C&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",r.jsx("small",{className:"font-light",children:e.edit?"To update slug use 'Change slug' action":" (Slug should start with /{lang})"})]}),r.jsx(d.Input,{id:"slug",value:u,onChange:y=>{const v=y.target.value;h.startsWith(v,`/${o}`)&&f(h.toLower(h.trim(v)))},className:"col-span-3",required:!0,pattern:"^/.*",disabled:h.isEmpty(o)||(e==null?void 0:e.edit),title:"Slug must start with /",placeholder:h.isEmpty(o)?"Choose language to add slug":"Enter page slug"})]})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:_||!i||!o||!C&&!h.startsWith(u,`/${o}`),children:_?e.edit?"Updating...":"Adding...":e.edit?"Update":"Add new language"})})]})]})})},_a=()=>{const[e,t]=w.useState(null),{selectedLang:n,fallbackLang:s,setSelectedLang:i}=he.useLanguages(),{data:a,isFetching:o}=bn(),{data:l}=Se(),[u,f]=w.useState(null),[m,g]=w.useState(null),[x,j]=w.useState(null),{data:C}=xn(),_=h.filter(h.get(C,"languages")||["en"],S=>!h.find(a,{lang:S})&&S!==h.get(C,"fallbackLang"));return r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsx("ul",{className:"space-y-2 mt-4",children:o?r.jsxs("div",{className:"w-full space-y-3 py-4",children:[r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):h.map(a,S=>{const y=S.lang,v=S.slug,K=!S.primaryPage,Q=y===n;return r.jsxs(r.Fragment,{children:[r.jsxs("li",{className:`text-slate-500 w-full p-2 rounded cursor-pointer flex items-center justify-between ${Q?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>i(y),children:[r.jsxs("div",{className:" flex-1 gap-x-3",children:[r.jsxs("div",{className:"text-[13px] text-slate-800 flex items-center gap-x-2",children:[r.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${S.online?"bg-green-300":"bg-gray-300"}`}),h.get(pe,K?s:y,y)]}),r.jsxs("div",{children:[v&&r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Slug: ",r.jsx("b",{className:"font-medium",children:v})]}),r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Name:",r.jsxs("b",{className:"font-medium",children:[" ",S.name," "]})]})]})]}),K?r.jsxs("div",{className:"flex items-center text-[11px] text-orange-500 gap-x-1",children:[r.jsx(P.StarIcon,{fill:"orange",className:"w-3 h-3"}),r.jsx("b",{children:" Primary"})]}):r.jsx("div",{className:"flex items-center gap-x-3",children:r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,onClick:G=>G.stopPropagation(),children:r.jsx(d.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:r.jsx(P.MoreHorizontal,{className:"h-4 w-4"})})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.stopPropagation(),t({...S,edit:!0})},children:[r.jsx(P.PencilIcon,{className:"size-3"}),"Edit"]}),(S==null?void 0:S.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.stopPropagation(),g(S)},children:[r.jsx(P.Power,{className:"size-3"}),"Take offline"]}),(S==null?void 0:S.collection)!=="global"&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.stopPropagation(),j(S)},children:[r.jsx(P.Link,{className:"size-3"}),"Change slug"]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.stopPropagation(),f(S)},children:[r.jsx(P.TrashIcon,{className:"size-3"}),"Delete"]})]})]})})]},S.id),r.jsx("div",{className:"h-1 w-full border-b"})]})})}),r.jsx("div",{className:"flex justify-center w-full",children:r.jsx(d.Button,{variant:"default",size:"sm",disabled:h.isEmpty(_),onClick:()=>{t({name:l==null?void 0:l.name,collection:l==null?void 0:l.collection,lang:"",slug:"",edit:!1})},children:"+ Add new language"})}),e&&r.jsx(Hs,{languages:_,langProps:e,onClose:()=>t(null)}),u&&r.jsx(Ws,{page:u,onClose:()=>f(null)}),m&&r.jsx(zs,{page:m,onClose:()=>g(null)}),x&&r.jsx(Ks,{page:x,onClose:()=>j(null)})]})},Da=()=>{const e=X();return L.useQuery({queryKey:[k.GET_CHANGES],queryFn:async()=>Z(e,{action:k.GET_CHANGES})})};function Oa({onClose:e=()=>console.log("Cancelled")}){const[t,n]=w.useState([]),{data:s,isFetching:i}=Da(),{data:a}=xt(),o=w.useMemo(()=>h.filter(s,y=>y.collection!=="global"),[s]),l=w.useMemo(()=>h.filter(s,{collection:"global"}),[s]),u=w.useMemo(()=>h.find(s,{collection:"theme",id:"THEME"}),[s]),{mutate:f,isPending:m}=Aa();w.useEffect(()=>{const y=h.map(h.filter(s,{online:!0}),"id");u&&y.push(u==null?void 0:u.id),n(y)},[s,u]);const g=t.length===(s==null?void 0:s.length),x=y=>{n(v=>h.includes(v,y)?h.filter(v,K=>K!==y):h.concat(v,y))},j=()=>{n(g?[]:h.map(s,"id"))},C=()=>{f({ids:t},{onSuccess:e})},_=y=>{if(y==="global")return"Global Block";if(y==="theme")return"Theme";const v=h.find(a,{key:y});return v?v==null?void 0:v.name:y},S=w.useMemo(()=>{const y=[{label:"Updated Pages & Global Blocks",top:"pt-2"},...h.orderBy(h.filter(o,{online:!0}),"collection"),...h.orderBy(h.filter(l,{online:!0}),"collection")],v=[{label:"Offline Pages & Global Blocks",top:"pt-6"},...h.orderBy(h.filter(o,{online:!1}),"collection"),...h.orderBy(h.filter(l,{online:!1}),"collection")],K=u?[{label:"Theme",top:"pt-6"},u]:[];return[...y,...K,...v]},[o,l,u]);return r.jsx(d.Dialog,{open:!0,onOpenChange:m?()=>{}:e,children:r.jsxs(d.DialogContent,{className:"max-w-4xl max-h-[80%] flex flex-col",children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Publish changes"}),r.jsx(d.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),r.jsx("div",{className:"relative -mx-4 h-full overflow-y-auto max-h-full no-scrollbar",children:i?r.jsxs("div",{className:"space-y-2 px-1",children:[r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse mt-2"}),r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"})]}):r.jsxs("table",{className:"w-full text-xs text-left rtl:text-right text-gray-500 dark:text-gray-400",children:[r.jsx("thead",{className:"text-gray-700 border-b bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:r.jsxs("tr",{children:[r.jsxs("th",{scope:"col",className:"px-6 py-3 flex items-center gap-x-2 w-[1 50px]",children:[r.jsx("input",{checked:g,onClick:y=>{y.stopPropagation(),j()},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 mt-1 cursor-pointer"}),"Name"]}),r.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Language"}),r.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Type"}),r.jsx("th",{scope:"col",className:"px-4 py-3 w-[150px] text-right",children:"Status"})]})}),r.jsx("tbody",{children:h.map(S,y=>y.label?r.jsx("tr",{children:r.jsxs("td",{colSpan:4,className:`px-6 py-2 text-xs font-medium text-gray-800 relative ${y.top}`,children:[r.jsx("div",{className:"absolute inset-0 left-6 flex items-center",children:r.jsx("div",{className:"w-full order-gray-300"})}),r.jsx("div",{className:"relative flex justify-start",children:r.jsx("span",{className:"bg-gray-50 pr-2",children:y.label})})]})},"separator"):r.jsxs("tr",{className:"hover:bg-gray-50 border-b last:border-b-0",children:[r.jsxs("td",{scope:"row",className:"px-6 py-2 text-gray-900 whitespace-nowrap dark:text-white flex items-center gap-x-1",children:[r.jsx("input",{checked:h.includes(t,y==null?void 0:y.id),onClick:v=>{v.stopPropagation(),x(y==null?void 0:y.id)},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 cursor-pointer"})," ",y.collection==="global"?r.jsx(P.GlobeIcon,{className:"h-4 w-4"}):r.jsx(P.File,{className:"h-4 w-4"}),y.name,y.slug&&r.jsxs("span",{className:"text-xs text-gray-500",children:["(",y.slug,")"]})]}),r.jsx("td",{className:"px-2",children:_(y==null?void 0:y.collection)}),r.jsx("td",{className:"px-4 text-right",children:h.first(y.changes)||""})]},y==null?void 0:y.id))})]})}),r.jsxs(d.DialogFooter,{className:"mt-10",children:[r.jsx(d.Button,{disabled:m,variant:"outline",onClick:e,children:"Cancel"}),r.jsx(d.Button,{disabled:m||i||h.isEmpty(s),onClick:C,children:m?"Publishing...":"Publish"})]})]})})}const Ia=()=>{const e=X();return L.useQuery({queryKey:[k.GET_WEBSITE_DATA],staleTime:1e3*60*5,queryFn:async()=>Z(e,{action:k.GET_WEBSITE_DATA,data:{draft:!0}})})};function La({onClose:e}){const{data:t,isFetching:n}=Ia(),{mutateAsync:s,isPending:i}=ja(),a=pt("settingComponent",null),o=h.debounce(async l=>(await s({data:l}),!0),300);return a?r.jsx(d.Dialog,{open:!0,onOpenChange:e,children:r.jsxs(d.DialogContent,{className:"w-full",children:[r.jsx(d.DialogHeader,{children:r.jsx(d.DialogTitle,{children:"Website Settings"})}),n?r.jsxs("div",{className:"w-full space-y-3 py-4",children:[r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):r.jsx("div",{children:w.createElement(a,{data:t||{},onSave:i?()=>{}:o,cancel:i?()=>{}:e})})]})}):null}function Ut({children:e,content:t}){return r.jsx(d.TooltipProvider,{children:r.jsxs(d.Tooltip,{children:[r.jsx(d.TooltipTrigger,{asChild:!0,children:e}),r.jsx(d.TooltipContent,{side:"bottom",sideOffset:10,children:r.jsx("p",{children:t})})]})})}const Ra=()=>{const e=pt("getPreviewUrl",async o=>o),[t,n]=w.useState(""),{data:s,isFetching:i}=Se(),a=w.useMemo(()=>s==null?void 0:s.slug,[s==null?void 0:s.slug]);return w.useEffect(()=>{(async()=>{if(a&&typeof e=="function"){const o=await e(a||"");n(o)}else n("")})()},[e,a]),!t||(s==null?void 0:s.collection)==="global"||i?null:r.jsxs(r.Fragment,{children:[r.jsx(Ut,{content:"Preview",children:r.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:r.jsx(d.Button,{variant:"ghost",size:"icon",className:"gap-2",children:r.jsx(P.Eye,{className:"w-4 h-4"})})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]})},Ga=()=>{const[e,t]=he.useRightPanel();return r.jsxs(r.Fragment,{children:[r.jsx(Ut,{content:"Theme",children:r.jsx(d.Button,{variant:e==="theme"?"outline":"ghost",size:"icon",className:"gap-2",onClick:()=>t(e==="theme"?"block":"theme"),children:r.jsx(P.Palette,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]})},Fa=()=>{const[e,t]=w.useState(!1),{savePage:n,saveState:s}=he.useSavePage();w.useEffect(()=>{const f=m=>{s==="UNSAVED"&&(m.preventDefault(),m.returnValue=!1)};return s==="UNSAVED"&&window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)}},[s]);const i=w.useCallback(async()=>{t(!0),await n(!1)},[n]);w.useEffect(()=>{s==="SAVED"&&t(!1)},[s]);const a=w.useMemo(()=>{if(s==="SAVED"||s==="UNSAVED")return s;if(s==="SAVING")return e?s:"SAVED"},[e,s]),{buttonIcon:o,buttonClass:l,tooltipContent:u}=w.useMemo(()=>{switch(a){case"UNSAVED":return{tooltipContent:"Save changes",buttonIcon:r.jsx(P.Check,{strokeWidth:5,className:"w-4 h-4 transition eas-in"}),buttonClass:"bg-gray-300 text-gray-500 focus:ring-gray-400 duration-100 hover:text-gray-900"};case"SAVING":return{tooltipContent:"Saving...",buttonIcon:r.jsx(P.Loader,{strokeWidth:3,className:"w-5 h-5 animate-spin transition ease-in-out"}),buttonClass:"bg-yellow-500 text-white focus:ring-yellow-400"};case"SAVED":return{tooltipContent:"Changes saved",buttonIcon:r.jsx(P.Check,{strokeWidth:5,className:"w-4 h-4 transition eas-in"}),buttonClass:"bg-green-500 text-white hover:bg-green-600 hover:text-white focus:ring-green-400"}}},[a]);return r.jsx(Ut,{content:u,children:r.jsx("button",{className:`w-7 h-7 mx-3 flex items-center justify-center p-2 rounded-full shadow-sm transition-all duration-200 ease-in-out active:scale-95 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-opacity-50 ${l}`,onClick:i,disabled:a==="SAVING","aria-label":u,children:o})})},Ua=()=>{const[e,t]=w.useState(!1),[n,s]=w.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(d.Button,{size:"sm",className:"relative overflow-hidden transition-all duration-300 ease-in-out from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-semibold shadow-md",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onClick:()=>t(!0),disabled:e,children:[r.jsx("span",{className:`flex items-center gap-2 transition-transform duration-300 ease-in-out ${n?"-translate-y-10":""}`,children:r.jsx(P.Rocket,{className:"w-4 h-4 mr-2"})}),r.jsx("span",{className:`absolute inset-0 flex items-center left-3 transition-transform duration-300 ease-in-out ${n?"":"translate-y-10"}`,children:r.jsx(P.Send,{className:"w-4 h-4 mr-2"})}),"Publish"]}),e&&r.jsx(Oa,{onClose:()=>t(!1)})]})},Ma=()=>{const e=pt("settingComponent",null),[t,n]=w.useState(!1);return e?r.jsxs(r.Fragment,{children:[r.jsx(Ut,{content:"Website data",children:r.jsx(d.Button,{variant:"ghost",size:"icon",className:"gap-2",onClick:()=>n(!0),children:r.jsx(P.Settings,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"}),t&&r.jsx(La,{onClose:()=>n(!1)})]}):null};function Ba(){return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Ma,{}),r.jsx(Ra,{}),r.jsx(Ga,{}),r.jsxs(r.Fragment,{children:[r.jsx(Fa,{}),r.jsx(Ua,{})]})]})}const qa=({editPage:e,addEditPage:t,setAddEditPage:n})=>{const s=t.id,[i,a]=w.useState(s&&t.name||""),[o,l]=w.useState(s&&t.slug||""),[u,f]=w.useState(s||!h.isEmpty(t==null?void 0:t.collection)?(t==null?void 0:t.collection)||"":"page"),{data:m=[]}=xt(),{mutate:g,isPending:x}=$s(),{mutate:j,isPending:C}=vn(),_=x||C,S=y=>{y.preventDefault(),s?j({name:i,slug:o,id:t.id,collection:t.global?"global":u},{onSuccess:()=>{n(null)}}):g({name:i,slug:o,collection:t.global?"global":u},{onSuccess:v=>{n(null),e(v.page.id)}})};return r.jsx(d.Dialog,{open:!!t,onOpenChange:()=>n(void 0),children:r.jsxs(d.DialogContent,{className:"sm:max-w-[425px]",children:[r.jsxs(d.DialogHeader,{children:[r.jsxs(d.DialogTitle,{children:[s?"Edit":"Add New"," ",t.global?"Global Block":h.startCase(u)]}),r.jsxs(d.DialogDescription,{children:["Enter the details for the new"," ",t.global?"Global Block":`${h.startCase(u)}. Slug must start with /`]})]}),r.jsxs("form",{onSubmit:S,children:[r.jsxs("div",{className:"grid gap-4 py-4",children:[!t.global&&r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"pageType",children:"Type"}),r.jsx("select",{value:u,disabled:s,onChange:y=>f(y.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:m.map(y=>r.jsx("option",{value:y.key,children:y.name},y.key))})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"name",className:"text-right",children:"Name"}),r.jsx(d.Input,{id:"name",value:i,placeholder:`Enter ${t.global?"global block":"page"} name`,onChange:y=>a(y.target.value),className:"col-span-3",required:!0})]}),!t.global&&r.jsx(r.Fragment,{children:r.jsxs("div",{className:"space-y-1",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-right",children:[t.global?"Identifier":"Slug"," ",s&&r.jsx("small",{className:"text-gray-400 font-light",children:"To update slug use 'Change slug' action"})]}),r.jsx(d.Input,{id:"slug",value:o,disabled:s,onChange:y=>{var v;return l((v=y.target.value)==null?void 0:v.trim().toLowerCase())},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:_||!i||!t.global&&!o.startsWith("/")||h.isEqual(t.name,i)&&h.isEqual(t.slug,o)&&h.isEqual(t.pageType,u),children:_?s?"Updating...":"Adding...":t.global?`${s?"Update":"Add"} global block`:`${s?"Update":"Add"} Page`})})]})]})})},$a=({close:e})=>{const[t,n]=w.useState([]),[s,i]=w.useState(""),[a,o]=w.useState(null),[l,u]=w.useState(null),[f,m]=w.useState(null),[g,x]=w.useState(null),{data:j}=xt(),{data:C,isFetching:_}=pn(),[S,y]=je(),v=S.get("page"),K=w.useCallback(N=>{window.history.pushState({},"",`?page=${N}`),y(new URLSearchParams({page:N})),window.dispatchEvent(new PopStateEvent("popstate")),e()},[e,y]),Q=N=>{h.includes(t,N)?n(h.filter(t,M=>M!==N)):n([...t,N])};w.useEffect(()=>{if(v&&!_){const N=h.find(C,{id:v});N&&(N!=null&&N.collection)?n(M=>[...M,N==null?void 0:N.collection]):(window.history.replaceState(null,"","/"),y(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate")))}},[C,v,_]);const G=w.useMemo(()=>{const N=h.filter(C,E=>h.isEmpty(s)?!0:h.includes(h.toLower(E==null?void 0:E.name),h.toLower(s))||h.includes(h.toLower(E==null?void 0:E.slug),h.toLower(s)));h.isEmpty(s)||n(h.map(N,"collection"));const M=h.groupBy(N,"collection"),oe=[{key:"page",name:"Pages"},{key:"global",name:"Global Block"},...j.filter(E=>E.key!=="page")];return h.map(oe,E=>({...E,items:h.orderBy(h.get(M,E.key,[]),"slug")||[]}))},[C,j,s]);return r.jsxs("div",{className:"h-full flex flex-col justify-between",children:[r.jsxs("div",{className:"space-y-6 flex flex-col h-full",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"rounded-md bg-primary p-2 text-primary-foreground",children:r.jsx(P.File,{className:"h-6 w-6"})}),r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"text-sm font-semibold",children:"Pages"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Manage your site structure"})]})]}),r.jsxs("div",{className:"relative flex item-center gap-x-4",children:[r.jsx(P.Search,{strokeWidth:2.5,className:"absolute left-3 top-2.5 h-4 w-4 text-gray-400"}),r.jsx(d.Input,{placeholder:"Search pages...",className:"pl-9 text-xs font-medium placeholder:text-gray-400 leading-none text-gray-700",value:s,onChange:N=>i(N.target.value)})]}),_?r.jsx("div",{className:"space-y-2",children:h.map([...Array(5).keys()],N=>r.jsx("div",{className:"h-9 w-full rounded bg-gray-200 animate-pulse"},N))}):h.isEmpty(G)?r.jsxs("div",{className:"h-[70vh] flex flex-col gap-y-1 items-center justify-center text-slate-500 text-sm font-medium",children:[r.jsx(P.File,{className:"h-6 w-6 stroke-[1]"}),"Empty List!",r.jsx("span",{className:"font-light",children:"Add new page to start"})]}):r.jsx("div",{className:"text-sm text-slate-700 space-y-2 h-[70vh] overflow-y-auto",children:h.map(G,N=>r.jsxs("div",{className:"border-0 py-",children:[r.jsxs("div",{className:"group font-medium flex items-center leading-none gap-x-2 cursor-pointer hover:bg-slate-100 rounded duration-200 p-1.5",onClick:()=>Q(N.key),children:[h.includes(t,N.key)?r.jsx(P.ChevronDown,{className:"w-4 h-4 text-slate-400 ease-in transition-all"}):r.jsx(P.ChevronRight,{className:"w-4 h-4 text-slate-400 ease-in"}),["page","global"].includes(N.key)?r.jsx(P.Folder,{className:"w-4 h-4"}):r.jsx(P.Database,{className:"w-4 h-4"}),r.jsx("span",{className:"leading-none",children:h.startCase(N.name)||"Uncategorized"}),r.jsx(d.Badge,{variant:"outline",className:`ml-2 text-xs font-bold rounded-full leading-none text-slate-500 ${N.key==="global"||N.key==="page"?"opacity-0":""}`,children:h.get(N,"baseSlug.FALLBACK")||"/"}),r.jsxs(d.Button,{variant:"ghost",size:"sm",className:"h-6 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1 text-xs",onClick:M=>{M.stopPropagation(),x({slug:"",name:"",collection:N.key,global:N.key==="global"})},children:[r.jsx(P.Plus,{className:"h-3 w-3"}),"Add ",h.startCase(N.name)||"Uncategorized"]})]}),h.includes(t,N.key)&&r.jsxs("div",{className:"bg-white pl-6 pt-2",children:[h.isEmpty(h.get(N,"items",[]))&&r.jsxs("div",{className:"text-xs font-light px-3 pb-1",children:["No ",h.startCase(N.name)||"Uncategorized"]}),h.map(h.get(N,"items",[]),M=>{const oe=v===h.get(M,"id");return r.jsxs("div",{onClick:()=>K(h.get(M,"id")),className:`rounded flex items-center justify-between leading-none duration-300 cursor-pointer px-3 py-1.5 ${oe?"bg-gray-200":"hover:bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[N.key==="global"?r.jsx(P.Globe,{className:"w-4 h-4 text-slate-500 stroke-[1]"}):r.jsx(P.File,{className:"w-4 h-4 text-slate-500 stroke-[1]"}),r.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${M.online?"bg-green-300":"bg-gray-300"}`}),r.jsx("span",{className:"leading-none text-slate-800 font-light",children:h.startCase(M.name)??""}),r.jsx(d.Badge,{variant:"outline",className:`ml-2 font-bold text-xs rounded-full leading-none text-slate-500 ${N.key==="global"?"opacity-0":""}`,children:h.get(M,"slug")||"/"})]}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,onClick:E=>E.stopPropagation(),children:r.jsx(P.MoreHorizontal,{className:"h-4 w-4 hover:stroke-[3]"})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:E=>{E.stopPropagation(),x({...M,global:N.key==="global"})},children:[r.jsx(P.Pencil,{className:"size-3"}),"Edit"]}),(M==null?void 0:M.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:E=>{E.stopPropagation(),u(M)},children:[r.jsx(P.Power,{className:"size-3"}),"Take offline"]}),N.key!=="global"&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:E=>{E.stopPropagation(),m(M)},children:[r.jsx(P.Link,{className:"size-3"}),"Change slug"]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:E=>{E.stopPropagation(),o(M)},children:[r.jsx(P.Trash,{className:"size-3"}),"Delete"]})]})]})})]})})]})]},N.key))})]}),r.jsxs(d.Button,{className:"text-sm flex gap-x-2",onClick:()=>{x({slug:"",name:"",collection:"page"})},children:[r.jsx(P.Plus,{className:"w-4 h-4"})," Add New"]}),g&&r.jsx(qa,{editPage:K,addEditPage:g,setAddEditPage:x}),a&&r.jsx(Ws,{page:a,onClose:()=>o(null)}),l&&r.jsx(zs,{page:l,onClose:()=>u(null)}),f&&r.jsx(Ks,{page:f,onClose:()=>m(null)})]})},Va=()=>{const e=pt("logo",null);return e?r.jsx("div",{className:"w-full max-h-9 overflow-hidden pr-2",children:w.createElement(e,{})}):null},Ka=()=>{const[e]=je(),t=e.get("page"),{data:n,isFetching:s}=Se(),[i,a]=w.useState(!1),o=!!t&&!h.isEmpty(n),l=!t||!s&&h.isEmpty(n)||i;return r.jsxs(r.Fragment,{children:[r.jsxs(d.Button,{variant:"secondary",className:"flex items-center w-full space-x-2 py-1",onClick:()=>a(!0),children:[r.jsx("div",{children:r.jsx(P.Logs,{className:"h-4 w-4"})}),r.jsxs("span",{className:"truncate leading-tight flex items-center max-w-[200px]",children:[r.jsx("span",{className:"text-slate-600 pr-1 font-light",children:"Editing:"}),s?r.jsx(P.Loader,{className:"h-4 w-4 animate-spin text-slate-400 ml-2"}):h.startCase(h.get(n,"name"))??""]})]},"template-viewer"),r.jsx(d.Sheet,{open:l,onOpenChange:u=>!u&&o&&a(!1),children:r.jsx(d.SheetContent,{side:"left",className:`!max-w-screen-sm border-border w-full ${o?"":"sheet-hide-close-btn"}`,children:r.jsx($a,{close:()=>a(!1)})})})]})},Wa=()=>{const{fallbackLang:e,languages:t,selectedLang:n,setSelectedLang:s}=he.useLanguages(),i=h.isEmpty(n)?e:n,[a,o]=w.useState(null),{data:l}=Se(),{data:u}=xn(),{data:f,isFetching:m}=bn(),g=w.useMemo(()=>{const x=h.compact(h.map(h.get(u,"languages"),j=>{const C=h.find(f,{lang:j});return{key:j,value:h.get(pe,j,j),isLangPageAdded:!!C}})).filter(Boolean);return[{key:e,value:h.get(pe,e),isLangPageAdded:!0},...x]},[f,u]);return h.isEmpty(t)||m?null:r.jsxs(r.Fragment,{children:[r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,className:"focus:outline-none",children:r.jsxs(d.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[r.jsx(P.Languages,{className:"w-4 h-4"}),h.get(pe,i,i),r.jsx(P.ChevronDown,{className:"w-4 h-4"})]})}),r.jsxs(d.DropdownMenuContent,{className:"border-border space-y-1",children:[h.map(g.filter(x=>x.isLangPageAdded),x=>r.jsxs(d.DropdownMenuItem,{className:he.mergeClasses("flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",x.key===i&&"!bg-gray-200 text-gray-700"),onClick:()=>s(x.key),children:[r.jsx("div",{className:"text-slate-600",children:x.value}),x.key===e&&r.jsxs("small",{className:"text-[9px] flex items-center gap-x-1 text-orange-500 leading-none",children:[r.jsx(P.Star,{fill:"orange",className:"w-2 h-2"}),"Primary"]})]},x.value)),!h.isEmpty(g.filter(x=>!x.isLangPageAdded))&&r.jsxs(r.Fragment,{children:[r.jsx(d.Separator,{}),r.jsxs(d.Button,{size:"sm",variant:"ghost",onClick:()=>{o({name:l==null?void 0:l.name,collection:l==null?void 0:l.collection,lang:"",slug:"",edit:!1})},className:"hover:bg-slate-300 duration-200 font-normal text-xs hover:text-slate-800",children:[r.jsx(P.Plus,{className:"w-3 h-3 mr-1"})," Add Langauge"]})]})]})]}),a&&r.jsx(Hs,{languages:t,langProps:a,onClose:()=>o(null)})]})};function za(){return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Va,{}),r.jsx(Ka,{}),r.jsx(Wa,{})]})}Er.loadWebBlocks();const Ha=e=>{const t=w.useRef([]),[n]=je(),s=n.get("page"),{data:i}=Se(),{data:a}=xa(),{data:o,isFetching:l}=va(),{blocks:u}=ba(o),{data:f}=xn(),{data:m}=xt(),{mutateAsync:g}=Ea(),x=ya(),{getUILibraryBlock:j,getUILibraryBlocks:C,onSave:_}=pa(),{getGlobalBlocks:S,getGlobalBlockBlocks:y}=wa(),{aiContext:v,setAiContext:K}=yn(),{mutateAsync:Q}=Sa();t.current=u;const G=w.useMemo(()=>{const E={};return e.mediaManagerComponent&&(E.mediaManagerComponent=e.mediaManagerComponent),E},[e.mediaManagerComponent]),N=w.useMemo(()=>Array.isArray(e==null?void 0:e.uiLibraries)?[...a,...e==null?void 0:e.uiLibraries]:a,[a,e==null?void 0:e.uiLibraries]),M=w.useCallback(async(E,B)=>await Q({collection:E,query:B}),[Q]),oe=w.useMemo(()=>h.get(f,"theme",{}),[f]);return r.jsx(r.Fragment,{children:r.jsx(he.ChaiBuilderEditor,{loading:l,fallbackLang:f.fallbackLang||"en",languages:(f==null?void 0:f.languages)||[],brandingOptions:(f==null?void 0:f.theme)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSaveSupport:e.autoSaveSupport||!0,autoSaveInterval:e.autoSaveInterval||25,onError:e.onError||console.error,getGlobalBlockBlocks:y,getGlobalBlocks:S,blocks:u,theme:oe,getUILibraryBlock:j,getUILibraryBlocks:C,uiLibraries:N,collections:m,searchCollectionItems:M,saveAiContextCallback:async E=>{if(!s)return!0;const B=t.current,z={_type:"@chai/ai-context",_value:h.isString(E)?E:""},ae=[...B,z];return await _({page:s,blocks:ae}),K(E),!0},aiContext:v,askAiCallBack:x,onSave:async({blocks:E,theme:B})=>{if(h.isEqual(B,oe)||await g({settings:{theme:B}}),!s)return!0;t.current=E;const z={_type:"@chai/ai-context",_value:h.isString(v)?v:""},ae=[...E,z];return await _({page:s,blocks:ae}),t.current=E,!0},topBarComponents:{left:[za],right:[Ba]},sideBarComponents:{top:[...(i==null?void 0:i.collection)!=="global"?[{label:"SEO Setting",component:Vs,icon:r.jsx(r.Fragment,{children:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21 21",fill:"currentColor",width:"21",height:"21",children:[r.jsx("path",{d:"M9.931 6.818c-1.238 0-2.136.925-2.136 2.2 0 1.279.898 2.207 2.136 2.207.664 0 1.257-.246 1.67-.694a.15.15 0 0 0-.009-.213l-.311-.286a.15.15 0 0 0-.213.009c-.273.297-.677.46-1.137.46-.699 0-1.233-.444-1.375-1.12h3.295a.15.15 0 0 0 .151-.151v-.211c0-1.295-.852-2.2-2.072-2.2m0 .724c.697 0 1.188.422 1.315 1.113h-2.69c.142-.673.676-1.113 1.374-1.113m4.332-.724c-1.246 0-2.15.925-2.15 2.2 0 1.279.904 2.207 2.15 2.207.596 0 1.143-.223 1.538-.628s.612-.965.612-1.579c0-1.275-.904-2.2-2.15-2.2m0 3.683c-.826 0-1.426-.624-1.426-1.483 0-.855.6-1.475 1.426-1.475s1.426.621 1.426 1.476c0 .423-.144.804-.406 1.073-.258.264-.62.41-1.019.41M6.318 8.71c-.665-.206-.902-.335-.902-.645 0-.47.564-.521.806-.521.29 0 .552.07.801.215a.15.15 0 0 0 .206-.055l.212-.366a.15.15 0 0 0-.055-.206 2.27 2.27 0 0 0-1.165-.312c-.915 0-1.53.501-1.53 1.245 0 .899.816 1.152 1.411 1.336.655.203.812.307.804.53-.016.398-.567.429-.735.429-.386 0-.722-.129-.972-.374q-.043-.042-.107-.043a.15.15 0 0 0-.106.045l-.295.302a.15.15 0 0 0 .002.213c.383.374.908.58 1.478.58.859 0 1.432-.441 1.459-1.125.031-.833-.746-1.074-1.313-1.249"}),r.jsx("path",{d:"M20.396 2.049H.604A.604.604 0 0 0 0 2.653v12.7c0 .333.27.604.604.604h6.941c-.266 1.296-.881 1.966-.886 1.971a.604.604 0 0 0 .434 1.024h6.815a.604.604 0 0 0 .434-1.024c-.007-.007-.621-.675-.886-1.971h6.941c.333 0 .604-.27.604-.604V2.652a.604.604 0 0 0-.604-.604m-.604 12.701h-.985v-.17a.604.604 0 0 0-1.208 0v.17h-.63v-.17a.604.604 0 0 0-1.208 0v.17H1.207V3.256h18.585z"})]})})}]:[],...h.isEmpty(f==null?void 0:f.languages)?[]:[{label:`Language ${(i==null?void 0:i.collection)==="global"?"":"page"}`,component:_a,icon:r.jsx(P.Languages,{className:"w-5 h-5 stroke-[2]"})}]]},...G})})},Qa=new L.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),Ya=e=>{const[,t]=qs();return w.useEffect(()=>{t(h.pick(e,["apiUrl","getPreviewUrl","logo","settingComponent"]))},[e,t]),r.jsxs(L.QueryClientProvider,{client:Qa,children:[r.jsx(Ha,{...e}),r.jsx(ga,{})]})};exports.$TRACK=dn;exports.ChaiBuilderForge=Ya;exports.Dynamic=bi;exports.For=Hr;exports.Index=Qr;exports.Match=Xr;exports.Portal=vi;exports.Show=Yr;exports.Switch=Jr;exports.addEventListener=vs;exports.batch=Pr;exports.className=xs;exports.clearDelegatedEvents=ui;exports.convertRemToPixels=la;exports.createComponent=gn;exports.createComputed=en;exports.createContext=Rr;exports.createEffect=fn;exports.createMemo=se;exports.createRenderEffect=ye;exports.createRoot=me;exports.createSignal=H;exports.createUniqueId=zr;exports.delegateEvents=ps;exports.deleteNestedDataByPath=et;exports.displayValue=na;exports.getMutationStatusColor=ea;exports.getPreferredColorScheme=ca;exports.getQueryStatusColor=Zi;exports.getQueryStatusColorByLabel=ta;exports.getQueryStatusLabel=Ji;exports.getSidedProp=Xi;exports.insert=It;exports.mergeProps=mn;exports.mutationSortFns=oa;exports.on=_r;exports.onCleanup=Ve;exports.onMount=os;exports.serialize=Fs;exports.setAttribute=Ot;exports.sortFns=ia;exports.splitProps=hs;exports.spread=bs;exports.stringify=Yi;exports.template=ci;exports.untrack=ee;exports.updateNestedDataByPath=Ze;exports.use=ws;exports.useContext=Gr;exports.useTransition=Lr;
30
+ <%s key={someKey} {...props} />`,Ht,be,br,be),Bn[be+Ht]=!0}}return c===s?mr(J):gr(J),J}}function yr(c,p,b){return qn(c,p,b,!0)}function pr(c,p,b){return qn(c,p,b,!1)}var xr=pr,vr=yr;Je.Fragment=s,Je.jsx=xr,Je.jsxs=vr}()),Je}process.env.NODE_ENV==="production"?Zt.exports=Sr():Zt.exports=Cr();var r=Zt.exports,D={context:void 0,registry:void 0,getContextId(){return zn(this.context.count)},getNextContextId(){return zn(this.context.count++)}};function zn(e){const t=String(e),n=t.length-1;return D.context.id+(n?String.fromCharCode(96+n):"")+t}function Xe(e){D.context=e}var Nr=(e,t)=>e===t,Tt=Symbol("solid-proxy"),dn=Symbol("solid-track"),At={equals:Nr},is=ds,ge=1,kt=2,as={owned:null,cleanups:null,context:null,owner:null},Qt={},R=null,Yt=null,Tr=null,$=null,te=null,fe=null,Lt=0;function me(e,t){const n=$,s=R,i=e.length===0,a=t===void 0?s:t,o=i?as:{owned:null,cleanups:null,context:a?a.context:null,owner:a},l=i?e:()=>e(()=>ee(()=>Gt(o)));R=o,$=null;try{return de(l,!0)}finally{$=n,R=s}}function Q(e,t){t=t?Object.assign({},At,t):At;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=i=>(typeof i=="function"&&(i=i(n.value)),us(n,i));return[cs.bind(n),s]}function en(e,t,n){const s=Rt(e,t,!0,ge);We(s)}function ye(e,t,n){const s=Rt(e,t,!1,ge);We(s)}function fn(e,t,n){is=Br;const s=Rt(e,t,!1,ge);(!n||!n.render)&&(s.user=!0),fe?fe.push(s):We(s)}function se(e,t,n){n=n?Object.assign({},At,n):At;const s=Rt(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,We(s),cs.bind(s)}function Ar(e){return e&&typeof e=="object"&&"then"in e}function kr(e,t,n){let s,i,a;arguments.length===2&&typeof t=="object"||arguments.length===1?(s=!0,i=e,a={}):(s=e,i=t,a={});let o=null,l=Qt,u=null,f=!1,m="initialValue"in a,g=typeof s=="function"&&se(s);const x=new Set,[j,C]=(a.storage||Q)(a.initialValue),[_,S]=Q(void 0),[y,v]=Q(void 0,{equals:!1}),[K,H]=Q(m?"ready":"unresolved");if(D.context){u=D.getNextContextId();let E;a.ssrLoadFrom==="initial"?l=a.initialValue:D.load&&(E=D.load(u))&&(l=E)}function G(E,B,z,ae){return o===E&&(o=null,ae!==void 0&&(m=!0),(E===l||B===l)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(ae,{value:B})),l=Qt,N(B,z)),B}function N(E,B){de(()=>{B===void 0&&C(()=>E),H(B!==void 0?"errored":m?"ready":"unresolved"),S(B);for(const z of x.keys())z.decrement();x.clear()},!1)}function M(){const E=Fr,B=j(),z=_();if(z!==void 0&&!o)throw z;return $&&!$.user&&E&&en(()=>{y(),o&&(E.resolved||x.has(E)||(E.increment(),x.add(E)))}),B}function oe(E=!0){if(E!==!1&&f)return;f=!1;const B=g?g():s;if(B==null||B===!1){G(o,ee(j));return}const z=l!==Qt?l:ee(()=>i(B,{value:j(),refetching:E}));return Ar(z)?(o=z,"value"in z?(z.status==="success"?G(o,z.value,void 0,B):G(o,void 0,tn(z.value),B),z):(f=!0,queueMicrotask(()=>f=!1),de(()=>{H(m?"refreshing":"pending"),v()},!1),z.then(ae=>G(z,ae,void 0,B),ae=>G(z,void 0,tn(ae),B)))):(G(o,z,void 0,B),z)}return Object.defineProperties(M,{state:{get:()=>K()},error:{get:()=>_()},loading:{get(){const E=K();return E==="pending"||E==="refreshing"}},latest:{get(){if(!m)return M();const E=_();if(E&&!o)throw E;return j()}}}),g?en(()=>oe(!1)):oe(!1),[M,{refetch:oe,mutate:C}]}function Pr(e){return de(e,!1)}function ee(e){if($===null)return e();const t=$;$=null;try{return e()}finally{$=t}}function _r(e,t,n){const s=Array.isArray(e);let i,a=n&&n.defer;return o=>{let l;if(s){l=Array(e.length);for(let f=0;f<e.length;f++)l[f]=e[f]()}else l=e();if(a)return a=!1,o;const u=ee(()=>t(l,i,o));return i=l,u}}function os(e){fn(()=>ee(e))}function Ve(e){return R===null||(R.cleanups===null?R.cleanups=[e]:R.cleanups.push(e)),e}function Hn(){return R}function Dr(e,t){const n=R,s=$;R=e,$=null;try{return de(t,!0)}catch(i){hn(i)}finally{R=n,$=s}}function Or(e){const t=$,n=R;return Promise.resolve().then(()=>{$=t,R=n;let s;return de(e,!1),$=R=null,s?s.done:void 0})}var[Ir,Xa]=Q(!1);function Lr(){return[Ir,Or]}function Rr(e,t){const n=Symbol("context");return{id:n,Provider:qr(n),defaultValue:e}}function Gr(e){let t;return R&&R.context&&(t=R.context[e.id])!==void 0?t:e.defaultValue}function ls(e){const t=se(e),n=se(()=>nn(t()));return n.toArray=()=>{const s=n();return Array.isArray(s)?s:s!=null?[s]:[]},n}var Fr;function cs(){if(this.sources&&this.state)if(this.state===ge)We(this);else{const e=te;te=null,de(()=>_t(this),!1),te=e}if($){const e=this.observers?this.observers.length:0;$.sources?($.sources.push(this),$.sourceSlots.push(e)):($.sources=[this],$.sourceSlots=[e]),this.observers?(this.observers.push($),this.observerSlots.push($.sources.length-1)):(this.observers=[$],this.observerSlots=[$.sources.length-1])}return this.value}function us(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&de(()=>{for(let i=0;i<e.observers.length;i+=1){const a=e.observers[i],o=Yt&&Yt.running;o&&Yt.disposed.has(a),(o?!a.tState:!a.state)&&(a.pure?te.push(a):fe.push(a),a.observers&&fs(a)),o||(a.state=ge)}if(te.length>1e6)throw te=[],new Error},!1)),t}function We(e){if(!e.fn)return;Gt(e);const t=Lt;Ur(e,e.value,t)}function Ur(e,t,n){let s;const i=R,a=$;$=R=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=ge,e.owned&&e.owned.forEach(Gt),e.owned=null),e.updatedAt=n+1,hn(o)}finally{$=a,R=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?us(e,s):e.value=s,e.updatedAt=n)}function Rt(e,t,n,s=ge,i){const a={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:R,context:R?R.context:null,pure:n};return R===null||R!==as&&(R.owned?R.owned.push(a):R.owned=[a]),a}function Pt(e){if(e.state===0)return;if(e.state===kt)return _t(e);if(e.suspense&&ee(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Lt);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===ge)We(e);else if(e.state===kt){const s=te;te=null,de(()=>_t(e,t[0]),!1),te=s}}function de(e,t){if(te)return e();let n=!1;t||(te=[]),fe?n=!0:fe=[],Lt++;try{const s=e();return Mr(n),s}catch(s){n||(fe=null),te=null,hn(s)}}function Mr(e){if(te&&(ds(te),te=null),e)return;const t=fe;fe=null,t.length&&de(()=>is(t),!1)}function ds(e){for(let t=0;t<e.length;t++)Pt(e[t])}function Br(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:Pt(s)}if(D.context){if(D.count){D.effects||(D.effects=[]),D.effects.push(...e.slice(0,n));return}else D.effects&&(e=[...D.effects,...e],n+=D.effects.length,delete D.effects);Xe()}for(t=0;t<n;t++)Pt(e[t])}function _t(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const i=s.state;i===ge?s!==t&&(!s.updatedAt||s.updatedAt<Lt)&&Pt(s):i===kt&&_t(s,t)}}}function fs(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=kt,n.pure?te.push(n):fe.push(n),n.observers&&fs(n))}}function Gt(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),s=e.sourceSlots.pop(),i=n.observers;if(i&&i.length){const a=i.pop(),o=n.observerSlots.pop();s<i.length&&(a.sourceSlots[o]=s,i[s]=a,n.observerSlots[s]=o)}}if(e.owned){for(t=e.owned.length-1;t>=0;t--)Gt(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function tn(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function hn(e,t=R){throw tn(e)}function nn(e){if(typeof e=="function"&&!e.length)return nn(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const s=nn(e[n]);Array.isArray(s)?t.push.apply(t,s):t.push(s)}return t}return e}function qr(e,t){return function(s){let i;return ye(()=>i=ee(()=>(R.context={...R.context,[e]:s.value},ls(()=>s.children))),void 0),i}}var sn=Symbol("fallback");function Dt(e){for(let t=0;t<e.length;t++)e[t]()}function $r(e,t,n={}){let s=[],i=[],a=[],o=0,l=t.length>1?[]:null;return Ve(()=>Dt(a)),()=>{let u=e()||[],f=u.length,m,g;return u[dn],ee(()=>{let j,C,_,S,y,v,K,H,G;if(f===0)o!==0&&(Dt(a),a=[],s=[],i=[],o=0,l&&(l=[])),n.fallback&&(s=[sn],i[0]=me(N=>(a[0]=N,n.fallback())),o=1);else if(o===0){for(i=new Array(f),g=0;g<f;g++)s[g]=u[g],i[g]=me(x);o=f}else{for(_=new Array(f),S=new Array(f),l&&(y=new Array(f)),v=0,K=Math.min(o,f);v<K&&s[v]===u[v];v++);for(K=o-1,H=f-1;K>=v&&H>=v&&s[K]===u[H];K--,H--)_[H]=i[K],S[H]=a[K],l&&(y[H]=l[K]);for(j=new Map,C=new Array(H+1),g=H;g>=v;g--)G=u[g],m=j.get(G),C[g]=m===void 0?-1:m,j.set(G,g);for(m=v;m<=K;m++)G=s[m],g=j.get(G),g!==void 0&&g!==-1?(_[g]=i[m],S[g]=a[m],l&&(y[g]=l[m]),g=C[g],j.set(G,g)):a[m]();for(g=v;g<f;g++)g in _?(i[g]=_[g],a[g]=S[g],l&&(l[g]=y[g],l[g](g))):i[g]=me(x);i=i.slice(0,o=f),s=u.slice(0)}return i});function x(j){if(a[g]=j,l){const[C,_]=Q(g);return l[g]=_,t(u[g],C)}return t(u[g])}}}function Vr(e,t,n={}){let s=[],i=[],a=[],o=[],l=0,u;return Ve(()=>Dt(a)),()=>{const f=e()||[],m=f.length;return f[dn],ee(()=>{if(m===0)return l!==0&&(Dt(a),a=[],s=[],i=[],l=0,o=[]),n.fallback&&(s=[sn],i[0]=me(x=>(a[0]=x,n.fallback())),l=1),i;for(s[0]===sn&&(a[0](),a=[],s=[],i=[],l=0),u=0;u<m;u++)u<s.length&&s[u]!==f[u]?o[u](()=>f[u]):u>=s.length&&(i[u]=me(g));for(;u<s.length;u++)a[u]();return l=o.length=a.length=m,s=f.slice(0),i=i.slice(0,l)});function g(x){a[u]=x;const[j,C]=Q(f[u]);return o[u]=C,t(j,u)}}}function gn(e,t){return ee(()=>e(t||{}))}function jt(){return!0}var rn={get(e,t,n){return t===Tt?n:e.get(t)},has(e,t){return t===Tt?!0:e.has(t)},set:jt,deleteProperty:jt,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:jt,deleteProperty:jt}},ownKeys(e){return e.keys()}};function Jt(e){return(e=typeof e=="function"?e():e)?e:{}}function Kr(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function mn(...e){let t=!1;for(let o=0;o<e.length;o++){const l=e[o];t=t||!!l&&Tt in l,e[o]=typeof l=="function"?(t=!0,se(l)):l}if(t)return new Proxy({get(o){for(let l=e.length-1;l>=0;l--){const u=Jt(e[l])[o];if(u!==void 0)return u}},has(o){for(let l=e.length-1;l>=0;l--)if(o in Jt(e[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<e.length;l++)o.push(...Object.keys(Jt(e[l])));return[...new Set(o)]}},rn);const n={},s=Object.create(null);for(let o=e.length-1;o>=0;o--){const l=e[o];if(!l)continue;const u=Object.getOwnPropertyNames(l);for(let f=u.length-1;f>=0;f--){const m=u[f];if(m==="__proto__"||m==="constructor")continue;const g=Object.getOwnPropertyDescriptor(l,m);if(!s[m])s[m]=g.get?{enumerable:!0,configurable:!0,get:Kr.bind(n[m]=[g.get.bind(l)])}:g.value!==void 0?g:void 0;else{const x=n[m];x&&(g.get?x.push(g.get.bind(l)):g.value!==void 0&&x.push(()=>g.value))}}}const i={},a=Object.keys(s);for(let o=a.length-1;o>=0;o--){const l=a[o],u=s[l];u&&u.get?Object.defineProperty(i,l,u):i[l]=u?u.value:void 0}return i}function hs(e,...t){if(Tt in e){const i=new Set(t.length>1?t.flat():t[0]),a=t.map(o=>new Proxy({get(l){return o.includes(l)?e[l]:void 0},has(l){return o.includes(l)&&l in e},keys(){return o.filter(l=>l in e)}},rn));return a.push(new Proxy({get(o){return i.has(o)?void 0:e[o]},has(o){return i.has(o)?!1:o in e},keys(){return Object.keys(e).filter(o=>!i.has(o))}},rn)),a}const n={},s=t.map(()=>({}));for(const i of Object.getOwnPropertyNames(e)){const a=Object.getOwnPropertyDescriptor(e,i),o=!a.get&&!a.set&&a.enumerable&&a.writable&&a.configurable;let l=!1,u=0;for(const f of t)f.includes(i)&&(l=!0,o?s[u][i]=a.value:Object.defineProperty(s[u],i,a)),++u;l||(o?n[i]=a.value:Object.defineProperty(n,i,a))}return[...s,n]}function gs(e){let t,n;const s=i=>{const a=D.context;if(a){const[l,u]=Q();D.count||(D.count=0),D.count++,(n||(n=e())).then(f=>{Xe(a),D.count--,u(()=>f.default),Xe()}),t=l}else if(!t){const[l]=kr(()=>(n||(n=e())).then(u=>u.default));t=l}let o;return se(()=>(o=t())&&ee(()=>{if(!a)return o(i);const l=D.context;Xe(a);const u=o(i);return Xe(l),u}))};return s.preload=()=>n||((n=e()).then(i=>t=()=>i.default),n),s}var Wr=0;function zr(){return D.context?D.getNextContextId():`cl-${Wr++}`}var ms=e=>`Stale read from <${e}>.`;function Hr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return se($r(()=>e.each,e.children,t||void 0))}function Qr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return se(Vr(()=>e.each,e.children,t||void 0))}function Yr(e){const t=e.keyed,n=se(()=>e.when,void 0,{equals:(s,i)=>t?s===i:!s==!i});return se(()=>{const s=n();if(s){const i=e.children;return typeof i=="function"&&i.length>0?ee(()=>i(t?s:()=>{if(!ee(n))throw ms("Show");return e.when})):i}return e.fallback},void 0,void 0)}function Jr(e){let t=!1;const n=(a,o)=>(t?a[1]===o[1]:!a[1]==!o[1])&&a[2]===o[2],s=ls(()=>e.children),i=se(()=>{let a=s();Array.isArray(a)||(a=[a]);for(let o=0;o<a.length;o++){const l=a[o].when;if(l)return t=!!a[o].keyed,[o,l,a[o]]}return[-1]},void 0,{equals:n});return se(()=>{const[a,o,l]=i();if(a<0)return e.fallback;const u=l.children;return typeof u=="function"&&u.length>0?ee(()=>u(t?o:()=>{if(ee(i)[0]!==a)throw ms("Match");return l.when})):u},void 0,void 0)}function Xr(e){return e}var Zr=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],ei=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Zr]),ti=new Set(["innerHTML","textContent","innerText","children"]),ni=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),si=Object.assign(Object.create(null),{class:"className",formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function ri(e,t){const n=si[e];return typeof n=="object"?n[t]?n.$:void 0:n}var ii=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),ai=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),oi={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function li(e,t,n){let s=n.length,i=t.length,a=s,o=0,l=0,u=t[i-1].nextSibling,f=null;for(;o<i||l<a;){if(t[o]===n[l]){o++,l++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){const m=a<s?l?n[l-1].nextSibling:n[a-l]:u;for(;l<a;)e.insertBefore(n[l++],m)}else if(a===l)for(;o<i;)(!f||!f.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[l]===t[i-1]){const m=t[--i].nextSibling;e.insertBefore(n[l++],t[o++].nextSibling),e.insertBefore(n[--a],m),t[i]=n[a]}else{if(!f){f=new Map;let g=l;for(;g<a;)f.set(n[g],g++)}const m=f.get(t[o]);if(m!=null)if(l<m&&m<a){let g=o,x=1,j;for(;++g<i&&g<a&&!((j=f.get(t[g]))==null||j!==m+x);)x++;if(x>m-l){const C=t[o];for(;l<m;)e.insertBefore(n[l++],C)}else e.replaceChild(n[l++],t[o++])}else o++;else t[o++].remove()}}}var tt="_$DX_DELEGATE";function ys(e,t,n,s={}){let i;return me(a=>{i=a,t===document?e():It(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{i(),t.textContent=""}}function ci(e,t,n){let s;const i=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},a=()=>(s||(s=i())).cloneNode(!0);return a.cloneNode=a,a}function ps(e,t=window.document){const n=t[tt]||(t[tt]=new Set);for(let s=0,i=e.length;s<i;s++){const a=e[s];n.has(a)||(n.add(a),t.addEventListener(a,Es))}}function ui(e=window.document){if(e[tt]){for(let t of e[tt].keys())e.removeEventListener(t,Es);delete e[tt]}}function Ot(e,t,n){D.context&&e.isConnected||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function di(e,t,n,s){D.context&&e.isConnected||(s==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,s))}function xs(e,t){D.context&&e.isConnected||(t==null?e.removeAttribute("class"):e.className=t)}function vs(e,t,n,s){if(s)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const i=n[0];e.addEventListener(t,n[0]=a=>i.call(e,n[1],a))}else e.addEventListener(t,n)}function fi(e,t,n={}){const s=Object.keys(t||{}),i=Object.keys(n);let a,o;for(a=0,o=i.length;a<o;a++){const l=i[a];!l||l==="undefined"||t[l]||(Qn(e,l,!1),delete n[l])}for(a=0,o=s.length;a<o;a++){const l=s[a],u=!!t[l];!l||l==="undefined"||n[l]===u||!u||(Qn(e,l,!0),n[l]=u)}return n}function hi(e,t,n){if(!t)return n?Ot(e,"style"):t;const s=e.style;if(typeof t=="string")return s.cssText=t;typeof n=="string"&&(s.cssText=n=void 0),n||(n={}),t||(t={});let i,a;for(a in n)t[a]==null&&s.removeProperty(a),delete n[a];for(a in t)i=t[a],i!==n[a]&&(s.setProperty(a,i),n[a]=i);return n}function bs(e,t={},n,s){const i={};return s||ye(()=>i.children=st(e,t.children,i.children)),ye(()=>typeof t.ref=="function"&&ws(t.ref,e)),ye(()=>gi(e,t,n,!0,i,!0)),i}function ws(e,t,n){return ee(()=>e(t,n))}function It(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return st(e,t,s,n);ye(i=>st(e,t(),i,n),s)}function gi(e,t,n,s,i={},a=!1){t||(t={});for(const o in i)if(!(o in t)){if(o==="children")continue;i[o]=Yn(e,o,null,i[o],n,a)}for(const o in t){if(o==="children")continue;const l=t[o];i[o]=Yn(e,o,l,i[o],n,a)}}function mi(e){let t,n;return!D.context||!(t=D.registry.get(n=pi()))?e():(D.completed&&D.completed.add(t),D.registry.delete(n),t)}function yi(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Qn(e,t,n){const s=t.trim().split(/\s+/);for(let i=0,a=s.length;i<a;i++)e.classList.toggle(s[i],n)}function Yn(e,t,n,s,i,a){let o,l,u,f,m;if(t==="style")return hi(e,n,s);if(t==="classList")return fi(e,n,s);if(n===s)return s;if(t==="ref")a||n(e);else if(t.slice(0,3)==="on:"){const g=t.slice(3);s&&e.removeEventListener(g,s),n&&e.addEventListener(g,n)}else if(t.slice(0,10)==="oncapture:"){const g=t.slice(10);s&&e.removeEventListener(g,s,!0),n&&e.addEventListener(g,n,!0)}else if(t.slice(0,2)==="on"){const g=t.slice(2).toLowerCase(),x=ii.has(g);if(!x&&s){const j=Array.isArray(s)?s[0]:s;e.removeEventListener(g,j)}(x||n)&&(vs(e,g,n,x),x&&ps([g]))}else if(t.slice(0,5)==="attr:")Ot(e,t.slice(5),n);else if((m=t.slice(0,5)==="prop:")||(u=ti.has(t))||!i&&((f=ri(t,e.tagName))||(l=ei.has(t)))||(o=e.nodeName.includes("-"))){if(m)t=t.slice(5),l=!0;else if(D.context&&e.isConnected)return n;t==="class"||t==="className"?xs(e,n):o&&!l&&!u?e[yi(t)]=n:e[f||t]=n}else{const g=i&&t.indexOf(":")>-1&&oi[t.split(":")[0]];g?di(e,g,t,n):Ot(e,ni[t]||t,n)}return n}function Es(e){const t=`$$${e.type}`;let n=e.composedPath&&e.composedPath()[0]||e.target;for(e.target!==n&&Object.defineProperty(e,"target",{configurable:!0,value:n}),Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return n||document}}),D.registry&&!D.done&&(D.done=_$HY.done=!0);n;){const s=n[t];if(s&&!n.disabled){const i=n[`${t}Data`];if(i!==void 0?s.call(n,i,e):s.call(n,e),e.cancelBubble)return}n=n._$host||n.parentNode||n.host}}function st(e,t,n,s,i){const a=!!D.context&&e.isConnected;if(a){!n&&(n=[...e.childNodes]);let u=[];for(let f=0;f<n.length;f++){const m=n[f];m.nodeType===8&&m.data.slice(0,2)==="!$"?m.remove():u.push(m)}n=u}for(;typeof n=="function";)n=n();if(t===n)return n;const o=typeof t,l=s!==void 0;if(e=l&&n[0]&&n[0].parentNode||e,o==="string"||o==="number"){if(a||o==="number"&&(t=t.toString(),t===n))return n;if(l){let u=n[0];u&&u.nodeType===3?u.data!==t&&(u.data=t):u=document.createTextNode(t),n=Te(e,n,s,u)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||o==="boolean"){if(a)return n;n=Te(e,n,s)}else{if(o==="function")return ye(()=>{let u=t();for(;typeof u=="function";)u=u();n=st(e,u,n,s)}),()=>n;if(Array.isArray(t)){const u=[],f=n&&Array.isArray(n);if(an(u,t,n,i))return ye(()=>n=st(e,u,n,s,!0)),()=>n;if(a){if(!u.length)return n;if(s===void 0)return[...e.childNodes];let m=u[0],g=[m];for(;(m=m.nextSibling)!==s;)g.push(m);return n=g}if(u.length===0){if(n=Te(e,n,s),l)return n}else f?n.length===0?Jn(e,u,s):li(e,n,u):(n&&Te(e),Jn(e,u));n=u}else if(t.nodeType){if(a&&t.parentNode)return n=l?[t]:t;if(Array.isArray(n)){if(l)return n=Te(e,n,s,t);Te(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function an(e,t,n,s){let i=!1;for(let a=0,o=t.length;a<o;a++){let l=t[a],u=n&&n[e.length],f;if(!(l==null||l===!0||l===!1))if((f=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))i=an(e,l,u)||i;else if(f==="function")if(s){for(;typeof l=="function";)l=l();i=an(e,Array.isArray(l)?l:[l],Array.isArray(u)?u:[u])||i}else e.push(l),i=!0;else{const m=String(l);u&&u.nodeType===3&&u.data===m?e.push(u):e.push(document.createTextNode(m))}}return i}function Jn(e,t,n=null){for(let s=0,i=t.length;s<i;s++)e.insertBefore(t[s],n)}function Te(e,t,n,s){if(n===void 0)return e.textContent="";const i=s||document.createTextNode("");if(t.length){let a=!1;for(let o=t.length-1;o>=0;o--){const l=t[o];if(i!==l){const u=l.parentNode===e;!a&&!o?u?e.replaceChild(i,l):e.insertBefore(i,n):u&&l.remove()}else a=!0}}else e.insertBefore(i,n);return[i]}function pi(){return D.getNextContextId()}var xi="http://www.w3.org/2000/svg";function js(e,t=!1){return t?document.createElementNS(xi,e):document.createElement(e)}function vi(e){const{useShadow:t}=e,n=document.createTextNode(""),s=()=>e.mount||document.body,i=Hn();let a,o=!!D.context;return fn(()=>{o&&(Hn().user=o=!1),a||(a=Dr(i,()=>se(()=>e.children)));const l=s();if(l instanceof HTMLHeadElement){const[u,f]=Q(!1),m=()=>f(!0);me(g=>It(l,()=>u()?g():a(),null)),Ve(m)}else{const u=js(e.isSVG?"g":"div",e.isSVG),f=t&&u.attachShadow?u.attachShadow({mode:"open"}):u;Object.defineProperty(u,"_$host",{get(){return n.parentNode},configurable:!0}),It(f,a),l.appendChild(u),e.ref&&e.ref(u),Ve(()=>l.removeChild(u))}},void 0,{render:!o}),n}function bi(e){const[t,n]=hs(e,["component"]),s=se(()=>t.component);return se(()=>{const i=s();switch(typeof i){case"function":return ee(()=>i(n));case"string":const a=ai.has(i),o=D.context?mi():js(i,a);return bs(o,n,a),o}})}var wi=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},Ss=class{constructor(e){this.generateIdentifier=e,this.kv=new wi}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},Ei=class extends Ss{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function ji(e){if("values"in Object)return Object.values(e);const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function Si(e,t){const n=ji(e);if("find"in n)return n.find(t);const s=n;for(let i=0;i<s.length;i++){const a=s[i];if(t(a))return a}}function Ke(e,t){Object.entries(e).forEach(([n,s])=>t(s,n))}function Nt(e,t){return e.indexOf(t)!==-1}function Xn(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s))return s}}var Ci=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Si(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Ni=e=>Object.prototype.toString.call(e).slice(8,-1),Cs=e=>typeof e>"u",Ti=e=>e===null,rt=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,on=e=>rt(e)&&Object.keys(e).length===0,xe=e=>Array.isArray(e),Ai=e=>typeof e=="string",ki=e=>typeof e=="number"&&!isNaN(e),Pi=e=>typeof e=="boolean",_i=e=>e instanceof RegExp,it=e=>e instanceof Map,at=e=>e instanceof Set,Ns=e=>Ni(e)==="Symbol",Di=e=>e instanceof Date&&!isNaN(e.valueOf()),Oi=e=>e instanceof Error,Zn=e=>typeof e=="number"&&isNaN(e),Ii=e=>Pi(e)||Ti(e)||Cs(e)||ki(e)||Ai(e)||Ns(e),Li=e=>typeof e=="bigint",Ri=e=>e===1/0||e===-1/0,Gi=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Fi=e=>e instanceof URL,Ts=e=>e.replace(/\./g,"\\."),Xt=e=>e.map(String).map(Ts).join("."),nt=e=>{const t=[];let n="";for(let i=0;i<e.length;i++){let a=e.charAt(i);if(a==="\\"&&e.charAt(i+1)==="."){n+=".",i++;continue}if(a==="."){t.push(n),n="";continue}n+=a}const s=n;return t.push(s),t};function ue(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var As=[ue(Cs,"undefined",()=>null,()=>{}),ue(Li,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),ue(Di,"Date",e=>e.toISOString(),e=>new Date(e)),ue(Oi,"Error",(e,t)=>{const n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n},(e,t)=>{const n=new Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n}),ue(_i,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),ue(at,"set",e=>[...e.values()],e=>new Set(e)),ue(it,"map",e=>[...e.entries()],e=>new Map(e)),ue(e=>Zn(e)||Ri(e),"number",e=>Zn(e)?"NaN":e>0?"Infinity":"-Infinity",Number),ue(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),ue(Fi,"URL",e=>e.toString(),e=>new URL(e))];function Ft(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var ks=Ft((e,t)=>Ns(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{const s=n.symbolRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown symbol");return s}),Ui=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Ps=Ft(Gi,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=Ui[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function _s(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Ds=Ft(_s,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};const s={};return n.forEach(i=>{s[i]=e[i]}),s},(e,t,n)=>{const s=n.classRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(s.prototype),e)}),Os=Ft((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{const s=n.customTransformerRegistry.findByName(t[1]);if(!s)throw new Error("Trying to deserialize unknown custom value");return s.deserialize(e)}),Mi=[Ds,ks,Os,Ps],es=(e,t)=>{const n=Xn(Mi,i=>i.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const s=Xn(As,i=>i.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},Is={};As.forEach(e=>{Is[e.annotation]=e});var Bi=(e,t,n)=>{if(xe(t))switch(t[0]){case"symbol":return ks.untransform(e,t,n);case"class":return Ds.untransform(e,t,n);case"custom":return Os.untransform(e,t,n);case"typed-array":return Ps.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const s=Is[t];if(!s)throw new Error("Unknown transformation: "+t);return s.untransform(e,n)}},Ae=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function Ls(e){if(Nt(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Nt(e,"prototype"))throw new Error("prototype is not allowed as a property");if(Nt(e,"constructor"))throw new Error("constructor is not allowed as a property")}var qi=(e,t)=>{Ls(t);for(let n=0;n<t.length;n++){const s=t[n];if(at(e))e=Ae(e,+s);else if(it(e)){const i=+s,a=+t[++n]==0?"key":"value",o=Ae(e,i);switch(a){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[s]}return e},ln=(e,t,n)=>{if(Ls(t),t.length===0)return n(e);let s=e;for(let a=0;a<t.length-1;a++){const o=t[a];if(xe(s)){const l=+o;s=s[l]}else if(rt(s))s=s[o];else if(at(s)){const l=+o;s=Ae(s,l)}else if(it(s)){if(a===t.length-2)break;const u=+o,f=+t[++a]==0?"key":"value",m=Ae(s,u);switch(f){case"key":s=m;break;case"value":s=s.get(m);break}}}const i=t[t.length-1];if(xe(s)?s[+i]=n(s[+i]):rt(s)&&(s[i]=n(s[i])),at(s)){const a=Ae(s,+i),o=n(a);a!==o&&(s.delete(a),s.add(o))}if(it(s)){const a=+t[t.length-2],o=Ae(s,a);switch(+i==0?"key":"value"){case"key":{const u=n(o);s.set(u,s.get(o)),u!==o&&s.delete(o);break}case"value":{s.set(o,n(s.get(o)));break}}}return e};function cn(e,t,n=[]){if(!e)return;if(!xe(e)){Ke(e,(a,o)=>cn(a,t,[...n,...nt(o)]));return}const[s,i]=e;i&&Ke(i,(a,o)=>{cn(a,t,[...n,...nt(o)])}),t(s,n)}function $i(e,t,n){return cn(t,(s,i)=>{e=ln(e,i,a=>Bi(a,s,n))}),e}function Vi(e,t){function n(s,i){const a=qi(e,nt(i));s.map(nt).forEach(o=>{e=ln(e,o,()=>a)})}if(xe(t)){const[s,i]=t;s.forEach(a=>{e=ln(e,nt(a),()=>e)}),i&&Ke(i,n)}else Ke(t,n);return e}var Ki=(e,t)=>rt(e)||xe(e)||it(e)||at(e)||_s(e,t);function Wi(e,t,n){const s=n.get(e);s?s.push(t):n.set(e,[t])}function zi(e,t){const n={};let s;return e.forEach(i=>{if(i.length<=1)return;t||(i=i.map(l=>l.map(String)).sort((l,u)=>l.length-u.length));const[a,...o]=i;a.length===0?s=o.map(Xt):n[Xt(a)]=o.map(Xt)}),s?on(n)?[s]:[s,n]:on(n)?void 0:n}var Rs=(e,t,n,s,i=[],a=[],o=new Map)=>{const l=Ii(e);if(!l){Wi(e,i,t);const j=o.get(e);if(j)return s?{transformedValue:null}:j}if(!Ki(e,n)){const j=es(e,n),C=j?{transformedValue:j.value,annotations:[j.type]}:{transformedValue:e};return l||o.set(e,C),C}if(Nt(a,e))return{transformedValue:null};const u=es(e,n),f=(u==null?void 0:u.value)??e,m=xe(f)?[]:{},g={};Ke(f,(j,C)=>{if(C==="__proto__"||C==="constructor"||C==="prototype")throw new Error(`Detected property ${C}. This is a prototype pollution risk, please remove it from your object.`);const _=Rs(j,t,n,s,[...i,C],[...a,e],o);m[C]=_.transformedValue,xe(_.annotations)?g[C]=_.annotations:rt(_.annotations)&&Ke(_.annotations,(S,y)=>{g[Ts(C)+"."+y]=S})});const x=on(g)?{transformedValue:m,annotations:u?[u.type]:void 0}:{transformedValue:m,annotations:u?[u.type,g]:g};return l||o.set(e,x),x};function Gs(e){return Object.prototype.toString.call(e).slice(8,-1)}function ts(e){return Gs(e)==="Array"}function Hi(e){if(Gs(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function Qi(e,t,n,s,i){const a={}.propertyIsEnumerable.call(s,t)?"enumerable":"nonenumerable";a==="enumerable"&&(e[t]=n),i&&a==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function un(e,t={}){if(ts(e))return e.map(i=>un(i,t));if(!Hi(e))return e;const n=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...n,...s].reduce((i,a)=>{if(ts(t.props)&&!t.props.includes(a))return i;const o=e[a],l=un(o,t);return Qi(i,a,l,e,t.nonenumerable),i},{})}var V=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Ei,this.symbolRegistry=new Ss(t=>t.description??""),this.customTransformerRegistry=new Ci,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=Rs(e,t,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const i=zi(t,this.dedupe);return i&&(s.meta={...s.meta,referentialEqualities:i}),s}deserialize(e){const{json:t,meta:n}=e;let s=un(t);return n!=null&&n.values&&(s=$i(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=Vi(s,n.referentialEqualities)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};V.defaultInstance=new V;V.serialize=V.defaultInstance.serialize.bind(V.defaultInstance);V.deserialize=V.defaultInstance.deserialize.bind(V.defaultInstance);V.stringify=V.defaultInstance.stringify.bind(V.defaultInstance);V.parse=V.defaultInstance.parse.bind(V.defaultInstance);V.registerClass=V.defaultInstance.registerClass.bind(V.defaultInstance);V.registerSymbol=V.defaultInstance.registerSymbol.bind(V.defaultInstance);V.registerCustom=V.defaultInstance.registerCustom.bind(V.defaultInstance);V.allowErrorProps=V.defaultInstance.allowErrorProps.bind(V.defaultInstance);var Fs=V.serialize,Yi=V.stringify;function Ji(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function Xi(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function Zi({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function ea({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function ta(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var na=(e,t=!1)=>{const{json:n}=Fs(e);return JSON.stringify(n,null,t?2:void 0)},St=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,sa=(e,t)=>e.queryHash.localeCompare(t.queryHash),Us=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,ra=(e,t)=>St(e)===St(t)?Us(e,t):St(e)>St(t)?1:-1,ia={status:ra,"query hash":sa,"last updated":Us},Ct=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,Ms=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,aa=(e,t)=>Ct(e)===Ct(t)?Ms(e,t):Ct(e)>Ct(t)?1:-1,oa={status:aa,"last updated":Ms},la=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),ca=()=>{const[e,t]=Q("dark");return os(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const s=i=>{t(i.matches?"dark":"light")};n.addEventListener("change",s),Ve(()=>n.removeEventListener("change",s))}),e},Ze=(e,t,n)=>{if(t.length===0)return n;if(e instanceof Map){const s=new Map(e);if(t.length===1)return s.set(t[0],n),s;const[i,...a]=t;return s.set(i,Ze(s.get(i),a,n)),s}if(e instanceof Set){const s=Ze(Array.from(e),t,n);return new Set(s)}if(Array.isArray(e)){const s=[...e];if(t.length===1)return s[t[0]]=n,s;const[i,...a]=t;return s[i]=Ze(s[i],a,n),s}if(e instanceof Object){const s={...e};if(t.length===1)return s[t[0]]=n,s;const[i,...a]=t;return s[i]=Ze(s[i],a,n),s}return e},et=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[s,...i]=t;return n.set(s,et(n.get(s),i)),n}if(e instanceof Set){const n=et(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((a,o)=>o.toString()!==t[0]);const[s,...i]=t;return n[s]=et(n[s],i),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[s,...i]=t;return n[s]=et(n[s],i),n}return e},Bs=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const s=document.createElement("style"),i=document.createTextNode("");s.appendChild(i),s.id="_goober",s.setAttribute("nonce",e),t?t.appendChild(s):document.head.appendChild(s)},ke,ot,lt,ct,we,ut,Pe,_e,De,Oe,Ie,Le,dt,ns,ua=(ns=class{constructor(e){q(this,ke);q(this,ot);q(this,lt);q(this,ct);q(this,we,!1);q(this,ut);q(this,Pe);q(this,_e);q(this,De);q(this,Oe);q(this,Ie);q(this,Le);q(this,dt);const{client:t,queryFlavor:n,version:s,onlineManager:i,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:f,shadowDOMTarget:m}=e;U(this,ke,Q(t)),U(this,lt,n),U(this,ct,s),U(this,ot,i),U(this,ut,f),U(this,Pe,m),U(this,_e,Q(a)),U(this,De,Q(o)),U(this,Oe,Q(l)),U(this,Ie,Q(u))}setButtonPosition(e){A(this,_e)[1](e)}setPosition(e){A(this,De)[1](e)}setInitialIsOpen(e){A(this,Oe)[1](e)}setErrorTypes(e){A(this,Ie)[1](e)}setClient(e){A(this,ke)[1](e)}mount(e){if(A(this,we))throw new Error("Devtools is already mounted");const t=ys(()=>{const n=this,[s]=A(this,_e),[i]=A(this,De),[a]=A(this,Oe),[o]=A(this,Ie),[l]=A(this,ke);let u;return A(this,Le)?u=A(this,Le):(u=gs(()=>Promise.resolve().then(()=>require("./BMGNQTAT-D2_DCbXI.cjs"))),U(this,Le,u)),Bs(A(this,ut),A(this,Pe)),gn(u,mn({get queryFlavor(){return A(n,lt)},get version(){return A(n,ct)},get onlineManager(){return A(n,ot)},get shadowDOMTarget(){return A(n,Pe)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return i()},get initialIsOpen(){return a()},get errorTypes(){return o()}}))},e);U(this,we,!0),U(this,dt,t)}unmount(){var e;if(!A(this,we))throw new Error("Devtools is not mounted");(e=A(this,dt))==null||e.call(this),U(this,we,!1)}},ke=new WeakMap,ot=new WeakMap,lt=new WeakMap,ct=new WeakMap,we=new WeakMap,ut=new WeakMap,Pe=new WeakMap,_e=new WeakMap,De=new WeakMap,Oe=new WeakMap,Ie=new WeakMap,Le=new WeakMap,dt=new WeakMap,ns),Re,ft,ht,gt,Ee,mt,Ge,Fe,Ue,Me,Be,qe,$e,yt,ss,da=(ss=class{constructor(e){q(this,Re);q(this,ft);q(this,ht);q(this,gt);q(this,Ee,!1);q(this,mt);q(this,Ge);q(this,Fe);q(this,Ue);q(this,Me);q(this,Be);q(this,qe);q(this,$e);q(this,yt);const{client:t,queryFlavor:n,version:s,onlineManager:i,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:f,shadowDOMTarget:m,onClose:g}=e;U(this,Re,Q(t)),U(this,ht,n),U(this,gt,s),U(this,ft,i),U(this,mt,f),U(this,Ge,m),U(this,Fe,Q(a)),U(this,Ue,Q(o)),U(this,Me,Q(l)),U(this,Be,Q(u)),U(this,qe,Q(g))}setButtonPosition(e){A(this,Fe)[1](e)}setPosition(e){A(this,Ue)[1](e)}setInitialIsOpen(e){A(this,Me)[1](e)}setErrorTypes(e){A(this,Be)[1](e)}setClient(e){A(this,Re)[1](e)}setOnClose(e){A(this,qe)[1](()=>e)}mount(e){if(A(this,Ee))throw new Error("Devtools is already mounted");const t=ys(()=>{const n=this,[s]=A(this,Fe),[i]=A(this,Ue),[a]=A(this,Me),[o]=A(this,Be),[l]=A(this,Re),[u]=A(this,qe);let f;return A(this,$e)?f=A(this,$e):(f=gs(()=>Promise.resolve().then(()=>require("./UODQIBEW-BXDPzZUT.cjs"))),U(this,$e,f)),Bs(A(this,mt),A(this,Ge)),gn(f,mn({get queryFlavor(){return A(n,ht)},get version(){return A(n,gt)},get onlineManager(){return A(n,ft)},get shadowDOMTarget(){return A(n,Ge)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return i()},get initialIsOpen(){return a()},get errorTypes(){return o()},get onClose(){return u()}}))},e);U(this,Ee,!0),U(this,yt,t)}unmount(){var e;if(!A(this,Ee))throw new Error("Devtools is not mounted");(e=A(this,yt))==null||e.call(this),U(this,Ee,!1)}},Re=new WeakMap,ft=new WeakMap,ht=new WeakMap,gt=new WeakMap,Ee=new WeakMap,mt=new WeakMap,Ge=new WeakMap,Fe=new WeakMap,Ue=new WeakMap,Me=new WeakMap,Be=new WeakMap,qe=new WeakMap,$e=new WeakMap,yt=new WeakMap,ss);function fa(e){const t=L.useQueryClient(e.client),n=ie.useRef(null),{buttonPosition:s,position:i,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}=e,[f]=ie.useState(new ua({client:t,queryFlavor:"React Query",version:"5",onlineManager:L.onlineManager,buttonPosition:s,position:i,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}));return ie.useEffect(()=>{f.setClient(t)},[t,f]),ie.useEffect(()=>{s&&f.setButtonPosition(s)},[s,f]),ie.useEffect(()=>{i&&f.setPosition(i)},[i,f]),ie.useEffect(()=>{f.setInitialIsOpen(a||!1)},[a,f]),ie.useEffect(()=>{f.setErrorTypes(o||[])},[o,f]),ie.useEffect(()=>(n.current&&f.mount(n.current),()=>{f.unmount()}),[f]),r.jsx("div",{className:"tsqd-parent-container",ref:n})}function ha(e){const t=L.useQueryClient(e.client),n=ie.useRef(null),{errorTypes:s,styleNonce:i,shadowDOMTarget:a}=e,[o]=ie.useState(new da({client:t,queryFlavor:"React Query",version:"5",onlineManager:L.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:s,styleNonce:i,shadowDOMTarget:a,onClose:e.onClose}));return ie.useEffect(()=>{o.setClient(t)},[t,o]),ie.useEffect(()=>{o.setOnClose(e.onClose??(()=>{}))},[e.onClose,o]),ie.useEffect(()=>{o.setErrorTypes(s||[])},[s,o]),ie.useEffect(()=>(n.current&&o.mount(n.current),()=>{o.unmount()}),[o]),r.jsx("div",{style:{height:"500px",...e.style},className:"tsqd-parent-container",ref:n})}var ga=process.env.NODE_ENV!=="development"?function(){return null}:fa;process.env.NODE_ENV;const ma=rs.atom({}),qs=()=>rs.useAtom(ma),pt=(e,t)=>{const[n]=qs();return h.get(n,e,t)},X=()=>pt("apiUrl","/chai/api"),k={ASK_AI:"ASK_AI",GET_PAGE:"GET_PAGE",CREATE_PAGE:"CREATE_PAGE",UPDATE_PAGE:"UPDATE_PAGE",DELETE_PAGE:"DELETE_PAGE",CHANGE_SLUG:"CHANGE_SLUG",TAKE_OFFLINE:"TAKE_OFFLINE",PUBLISH_PAGE:"PUBLISH_PAGE",PUBLISH_CHANGES:"PUBLISH_CHANGES",ADD_NEW_LANGUAGE:"ADD_NEW_LANGUAGE",EDIT_LANGUAGE:"EDIT_LANGUAGE",DELETE_LANGUAGE:"DELETE_LANGUAGE",GET_CHANGES:"GET_CHANGES",GET_SERVER_BLOCK:"GET_SERVER_BLOCK",GET_LANGUAGE_PAGES:"GET_LANGUAGE_PAGES",GET_PROJECT_PAGES:"GET_PROJECT_PAGES",UPDATE_WEBSITE_SETTINGS:"UPDATE_WEBSITE_SETTINGS",GET_COLLECTIONS:"GET_COLLECTIONS",SEARCH_PAGES:"SEARCH_PAGES",GET_WEBSITE_SETTINGS:"GET_WEBSITE_SETTINGS",AI_CONTEXT:"AI_CONTEXT",GET_WEBSITE_DATA:"GET_WEBSITE_DATA",UPDATE_WEBSITE_DATA:"UPDATE_WEBSITE_DATA"},yn=()=>{const e=L.useQueryClient(),{data:t}=L.useQuery({queryKey:[k.AI_CONTEXT],initialData:"",queryFn:()=>""});return{setAiContext:w.useCallback(s=>{e.setQueryData([k.AI_CONTEXT],s)},[]),aiContext:t}},Z=async(e,t)=>{const n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),s=await n.json();if(s!=null&&s.error||n.status===400||!n.ok)throw new Error((s==null?void 0:s.error)||"Something went wrong.");return s},ya=()=>{const e=X(),{aiContext:t}=yn();return w.useCallback(async(n,s,i,a)=>Z(e,{action:k.ASK_AI,data:{type:n,prompt:s,blocks:i,context:t,lang:a}}),[e,t])},pa=()=>{const e=X();return{getUILibraryBlock:async(i,a)=>{const u=(await(await fetch(i.url+(a.path?"/blocks/"+a.path:"/"+a.uuid+".html"))).text()).replace(/---([\s\S]*?)---/g,"");return he.getBlocksFromHTML(`${u}`)},getUILibraryBlocks:async i=>{try{return(await(await fetch(i.url+"/blocks.json")).json()).map(l=>({...l,preview:i.url.replace("chaiblocks","")+l.preview}))}catch(a){return console.error(a),[]}},onSave:async({page:i,blocks:a})=>{try{return await Z(e,{action:"UPDATE_PAGE",data:{id:i,blocks:a}})}catch{return new Error("Failed to save blocks")}}}};function je(){const[e,t]=w.useState(new URLSearchParams(window.location.search));return w.useEffect(()=>{const n=()=>{t(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}},[]),[e,t]}const pn=()=>{const e=X();return L.useQuery({queryKey:[k.GET_PROJECT_PAGES],staleTime:1e3*60*5,queryFn:async()=>Z(e,{action:k.GET_PROJECT_PAGES})||[]})},Se=()=>{const[e]=je(),t=e.get("page"),{data:n,isFetching:s}=pn();return{data:w.useMemo(()=>h.find(n,{id:t})||{},[n,t]),isFetching:s}},xa=()=>L.useQuery({queryKey:["uiLibraries"],initialData:[],queryFn:async()=>[{uuid:"meraki-ui",name:"Meraki UI",url:"https://chai-ui-blocks.vercel.app"},{uuid:"chaiblocks",name:"UI Blocks",url:"https://chaibuilder.com/chaiblocks"}]}),va=()=>{const[e]=je(),t=e.get("page"),n=X(),{setAiContext:s}=yn();return L.useQuery({queryKey:[k.GET_PAGE,t],initialData:[],queryFn:async()=>{const a=(await Z(n,{action:k.GET_PAGE,data:{id:t,draft:!0}})).blocks??[],o=h.find(a,{_type:"@chai/ai-context"});return s(h.get(o,"_value","")||""),a},enabled:!!t})},ba=e=>w.useMemo(()=>{if(!e||h.isEmpty(e))return{blocks:[],theme:{}};const t=h.find(e,{_type:"@chai/theme"}),n=h.get(t,"_value",{})||{},s=h.filter(e,i=>!h.includes(i==null?void 0:i._type,"@chai/"));return{theme:n,blocks:s}},[e]),xn=()=>{const e=X();return L.useQuery({queryKey:[k.GET_WEBSITE_SETTINGS],initialData:{theme:{},fallbackLang:"en",languages:[]},queryFn:async()=>Z(e,{action:k.GET_WEBSITE_SETTINGS,data:{draft:!0}})})},wa=()=>{const{data:e}=pn(),t=X();return{getGlobalBlocks:async()=>{const n={};for(const s of e??[])h.isEmpty(s==null?void 0:s.slug)&&(n[s.id]={name:h.startCase(s.name??s.slug),description:""});return n},getGlobalBlockBlocks:async n=>n?(await Z(t,{action:"GET_PAGE",data:{id:n,draft:!0}})).blocks:[]}},Ea=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.UPDATE_WEBSITE_SETTINGS,data:s}),onSuccess:(s,i)=>{var a;t.invalidateQueries({queryKey:[k.GET_WEBSITE_SETTINGS]}),(a=i==null?void 0:i.settings)!=null&&a.theme||n({title:"Website settings updated successfully."})},onError:s=>{n({variant:"destructive",title:"Failed to update website settings",description:s.message})}})},ja=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.UPDATE_WEBSITE_DATA,data:s}),onSuccess:()=>{t.invalidateQueries({queryKey:[k.GET_WEBSITE_DATA]}),n({title:"Website data updated successfully."})},onError:s=>{n({variant:"destructive",title:"Failed to update website data",description:s.message})}})},xt=()=>{const e=X();return L.useQuery({queryKey:[k.GET_COLLECTIONS],initialData:[],queryFn:async()=>Z(e,{action:k.GET_COLLECTIONS})})},Sa=()=>{const e=X();return L.useMutation({mutationFn:async({collection:t,query:n})=>{try{return Z(e,{action:k.SEARCH_PAGES,data:{collection:t,query:Array.isArray(n)&&n.length>0?n[0]:n}})||[]}catch{return[]}}})},pe={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",ak:"Akan",sq:"Albanian",am:"Amharic",ar:"Arabic",an:"Aragonese",hy:"Armenian",as:"Assamese",av:"Avaric",ae:"Avestan",ay:"Aymara",az:"Azerbaijani",bm:"Bambara",ba:"Bashkir",eu:"Basque",be:"Belarusian",bn:"Bengali",bh:"Bihari",bi:"Bislama",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",ny:"Chichewa",zh:"Chinese","zh-Hans":"Chinese (Simplified)","zh-Hant":"Chinese (Traditional)",cv:"Chuvash",kw:"Cornish",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",dv:"Maldivian",nl:"Dutch",dz:"Dzongkha",en:"English",eo:"Esperanto",et:"Estonian",ee:"Ewe",fo:"Faroese",fj:"Fijian",fi:"Finnish",fr:"French",ff:"Fula, Pular",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Manx",ka:"Georgian",de:"German",el:"Greek",kl:"Kalaallisut",gn:"Guarani",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hz:"Herero",hi:"Hindi",ho:"Hiri Motu",hu:"Hungarian",is:"Icelandic",io:"Ido",ig:"Igbo",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",jv:"Javanese",kn:"Kannada",kr:"Kanuri",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ki:"Kikuyu",rw:"Kinyarwanda",rn:"Kirundi",ky:"Kyrgyz",kv:"Komi",kg:"Kongo",ko:"Korean",ku:"Kurdish",kj:"Kwanyama",lo:"Lao",la:"Latin",lv:"Latvian",li:"Limburgish",ln:"Lingala",lt:"Lithuanian",lu:"Luga-Katanga",lg:"Luganda, Ganda",lb:"Luxembourgish",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mh:"Marshallese",mo:"Moldavian",mn:"Mongolian",na:"Nauru",nv:"Navajo",ng:"Ndonga",nd:"Northern Ndebele",ne:"Nepali",no:"Norwegian",nb:"Norwegian bokmål",nn:"Norwegian nynorsk",ii:"Sichuan Yi",oc:"Occitan",oj:"Ojibwe",cu:"Old Church Slavonic",or:"Oriya",om:"Oromo",os:"Ossetian",pi:"Pāli",ps:"Pashto, Pushto",fa:"Persian (Farsi)",pl:"Polish",pt:"Portuguese",pa:"Punjabi (Eastern)",qu:"Quechua",rm:"Romansh",ro:"Romanian",ru:"Russian",se:"Sami",sm:"Samoan",sg:"Sango",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Swati",sk:"Slovak",sl:"Slovenian",so:"Somali",nr:"Southern Ndebele",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",ty:"Tahitian",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uyghur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",ve:"Venda",vi:"Vietnamese",vo:"Volapük",wa:"Wallon",cy:"Welsh",wo:"Wolof",fy:"Western Frisian",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",za:"Zhuang, Chuang",zu:"Zulu"},Ca={SLUG_ALREADY_USED:"This slug is already in use. Please choose a different one."},$s=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.CREATE_PAGE,data:s}),onSuccess:(s,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),n({title:`New ${i.collection==="global"?"global block":"page"} added successfully.`})},onError:(s,i)=>{n({variant:"destructive",title:`Failed to add new ${i.collection==="global"?"global block":"page"}.`,description:h.get(Ca,s.message,s.message)})}})},vn=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.UPDATE_PAGE,data:s}),onSuccess:(s,i)=>{i&&(i!=null&&i.primaryPage||i!=null&&i.seo)?t.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),i!=null&&i.seo?n({title:"SEO Settings updated successfully."}):n({title:`${i.collection==="global"?"Global block":"Page"} updated successfully.`})},onError:(s,i)=>{n({variant:"destructive",title:`Failed to update ${i.collection==="global"?"global block":"page"}.`,description:s.message})}})},Na=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.DELETE_PAGE,data:{id:s==null?void 0:s.id}}),onSuccess:(s,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),n({title:`${i.collection==="global"?"Global block":"Page"} deleted successfully.`})},onError:(s,i)=>{n({variant:"destructive",title:`Failed to delete ${i.collection==="global"?"global block":"page"}.`,description:s.message})}})},Ta=()=>{const e=X(),t=L.useQueryClient(),{toast:n}=d.useToast();return L.useMutation({mutationFn:async s=>Z(e,{action:k.TAKE_OFFLINE,data:{id:s==null?void 0:s.id}}),onSuccess:(s,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),n({title:`${i.collection==="global"?"Global block":"Page"} taken offline successfully.`})},onError:(s,i)=>{n({variant:"destructive",title:`Failed to take offline ${i.collection==="global"?"global block":"page"}.`,description:s.message})}})},Aa=()=>{const e=X(),{toast:t}=d.useToast(),n=L.useQueryClient(),{data:s}=Se();return L.useMutation({mutationFn:async({ids:i})=>Z(e,{action:k.PUBLISH_CHANGES,data:{ids:i}}),onSuccess:()=>{t({title:"Your changes have been published successfully."}),n.invalidateQueries({queryKey:[k.GET_CHANGES]}),n.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]}),n.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,s==null?void 0:s.id]})},onError:()=>{t({title:"Failed to publish pages.",variant:"destructive"})}})},ka=()=>{const e=X(),{toast:t}=d.useToast(),n=L.useQueryClient();return L.useMutation({mutationFn:async({id:s,slug:i})=>Z(e,{action:k.CHANGE_SLUG,data:{id:s,slug:i}}),onSuccess:(s,{primaryPage:i})=>{t({title:"Slug changed successfully."}),i?n.invalidateQueries({queryKey:[k.GET_LANGUAGE_PAGES,i]}):n.invalidateQueries({queryKey:[k.GET_PROJECT_PAGES]})},onError:()=>{t({title:"Failed to change slug",variant:"destructive"})}})},bn=()=>{const e=X(),[t]=je(),n=t.get("page");return L.useQuery({queryKey:[k.GET_LANGUAGE_PAGES,n],initialData:[],queryFn:async()=>{if(!n)return null;const s=await Z(e,{action:k.GET_LANGUAGE_PAGES,data:{id:n}});return h.reverse(h.sortBy(s,"primaryPage"))}})},Pa=()=>{const{selectedLang:e}=he.useLanguages(),{data:t,isFetching:n}=bn();return{data:w.useMemo(()=>h.find(t,{lang:e||""})||{},[t,e]),isFetching:n}},Vs=()=>{const{data:e,isFetching:t}=Pa(),n=e==null?void 0:e.seo,[s,i]=w.useState({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n}),a=w.useRef({initial:s,updated:s}),{selectedLang:o,fallbackLang:l,languages:u}=he.useLanguages(),f=o.length?o:l,{mutate:m,isPending:g}=vn(),x=g;w.useEffect(()=>{!t&&n&&i({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n})},[t,n]);const j=async()=>{m({id:e==null?void 0:e.id,seo:s}),a.current.initial=s,a.current.updated=s},C=()=>{i({...s,ogTitle:s.title,ogDescription:s.description})},_=()=>{i({...s,searchTitle:s.ogTitle,searchDescription:s.ogDescription})},S=y=>{const v={...s,[y.target.name]:y.target.name==="noIndex"||y.target.name==="noFollow"?y.target.checked:y.target.value};i(v),a.current.updated=v};return r.jsxs("div",{className:"relative pb-40",children:[r.jsxs("div",{className:"text-xs bg-gray-100 p-2 rounded-md text-left",children:["Slug: ",e==null?void 0:e.slug,"  ",u.length>0&&r.jsxs("span",{className:"text-blue-500 font-semibold",children:["(",h.get(pe,f,f),")"]})]}),r.jsx("form",{className:"space-y-8",children:r.jsxs(d.Accordion,{type:"multiple",defaultValue:["page"],children:[r.jsxs(d.AccordionItem,{value:"page",children:[r.jsx(d.AccordionTrigger,{className:"text-slate-700 font-semibold",children:"SEO"}),r.jsx(d.AccordionContent,{className:"pt-2",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"title",children:"SEO Title"}),r.jsxs(r.Fragment,{children:[r.jsx(d.Input,{type:"text",id:"title",name:"title",value:s.title,onChange:S,disabled:x,placeholder:"Enter SEO title"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The title should be between 10 and 60 characters."})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"description",children:"SEO Description"}),r.jsx(d.Textarea,{id:"description",name:"description",value:s.description,onChange:S,disabled:x,placeholder:"Enter SEO description"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The description should be between 50 and 160 characters."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"title",children:"Canonical URL"}),r.jsx(d.Input,{type:"text",id:"canonicalUrl",name:"canonicalUrl",value:s.canonicalUrl,onChange:S,disabled:x,placeholder:"Enter Canonical URL"})]}),r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsx(d.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:s.noIndex,onChange:S,disabled:x,className:"h-4 w-4"}),r.jsx(d.Label,{className:"text-xs pb-1",htmlFor:"noIndex",children:"No Index"})]}),r.jsx("p",{className:"mt-0 text-[10px] font-light text-gray-400 leading-4",children:"Check this if you don't want search engines to index this page."})]}),r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsx(d.Input,{type:"checkbox",id:"noFollow",name:"noFollow",checked:s.noFollow,onChange:S,disabled:x,className:"h-4 w-4"}),r.jsx(d.Label,{className:"text-xs pb-1",htmlFor:"noIndex",children:"No Follow"})]}),r.jsx("p",{className:"text-[10px] font-light text-gray-400 leading-4",children:"Check this if you don't want search engines to follow links on this page."})]})]})})]}),r.jsxs(d.AccordionItem,{value:"og",children:[r.jsx(d.AccordionTrigger,{className:"text-slate-700 font-bold",children:"OG"}),r.jsx(d.AccordionContent,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:C,children:"Copy from SEO Settings"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"ogTitle",children:"OG Title"}),r.jsx(d.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:s.ogTitle,onChange:S,disabled:x,placeholder:"Enter OG title"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The OG title should be between 10 and 60 characters."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs pb-1",htmlFor:"ogDescription",children:"OG Description"}),r.jsx(d.Textarea,{id:"ogDescription",name:"ogDescription",value:s.ogDescription,onChange:S,disabled:x,placeholder:"Enter OG description"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The OG description should be between 50 and 160 characters."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs pb-1",htmlFor:"ogImage",children:"OG Image URL"}),r.jsx(d.Input,{type:"text",id:"ogImage",name:"ogImage",value:s.ogImage,onChange:S,disabled:x,placeholder:"Enter OG image URL"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"Enter a valid URL for the OG image."})]})]})})]}),r.jsxs(d.AccordionItem,{value:"search",children:[r.jsx(d.AccordionTrigger,{className:"text-slate-700 font-bold",children:"SEARCH"}),r.jsx(d.AccordionContent,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Button,{type:"button",variant:"outline",size:"sm",onClick:_,children:"Copy from OG Settings"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"searchTitle",children:"Search Title"}),r.jsx(d.Input,{type:"text",id:"searchTitle",name:"searchTitle",value:s.searchTitle,onChange:S,disabled:x,placeholder:"Enter search title"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The search title should be between 10 and 60 characters."})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"searchDescription",children:"Search Description"}),r.jsx(d.Textarea,{id:"searchDescription",name:"searchDescription",value:s.searchDescription,onChange:S,placeholder:"Enter search description"}),r.jsx("p",{className:"mt-1 text-[10px] font-light text-gray-400 leading-4",children:"The search description should be between 50 and 160 characters."})]})]})})]}),r.jsxs(d.AccordionItem,{value:"jsonLD",children:[r.jsx(d.AccordionTrigger,{className:"text-slate-700 font-bold",children:"JSON-LD"}),r.jsx(d.AccordionContent,{children:r.jsx("div",{className:"space-y-4",children:r.jsx("div",{children:r.jsx(d.Textarea,{id:"jsonLD",name:"jsonLD",rows:3,value:s.jsonLD,onChange:S,placeholder:"Enter JSON-LD"})})})})]})]})}),r.jsx("div",{className:"w-full flex items-center justify-end mt-4",children:r.jsx(d.Button,{size:"lg",variant:"default",onClick:j,disabled:h.isEqual(a.current.initial,s)||x,children:g?"Saving...":"Save"})})]})};Vs.displayName="SeoPanel";const Ks=({page:e,onClose:t})=>{const[n,s]=w.useState(e.slug||""),{mutate:i,isPending:a}=ka(),{data:o}=xt(),l=h.find(o,{key:e==null?void 0:e.collection}),u=m=>{m.preventDefault(),i({...e,slug:n},{onSuccess:t})},f=(e==null?void 0:e.lang)||"";return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Change Slug"}),r.jsx(d.DialogDescription,{className:"text-xs",children:r.jsxs(d.Alert,{variant:"destructive",className:"mt-2",children:[r.jsx(P.AlertCircle,{className:"h-4 w-4"}),"Changing the slug may have impact on your SEO. Please proceed with caution."]})})]}),r.jsxs("form",{onSubmit:u,children:[r.jsxs("div",{className:"space-y-4 py-4 text-sm ",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{children:[r.jsx("span",{children:"Type:"}),r.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(l==null?void 0:l.name)||(e==null?void 0:e.collection)]})]}),r.jsxs("div",{children:[r.jsx("span",{children:"Name:"}),r.jsxs("span",{className:"font-medium text-gray-600",children:[" ",e.name]})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",r.jsxs("small",{className:"font-light text-gray-500",children:["Slug should start with /",f]})]}),r.jsx(d.Input,{id:"slug",value:n,onChange:m=>{const g=m.target.value;h.startsWith(g,`/${f}`)&&s(g)},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:a||!h.startsWith(n,`/${f}`)||h.isEqual(e==null?void 0:e.slug,n),children:a?"Changing...":"Change Slug"})})]})]})})};function Ws({page:e,onClose:t}){const[,n]=je(),{mutate:s,isPending:i}=Na(),a=()=>{s(e,{onSuccess:()=>{e!=null&&e.primaryPage||(window.history.replaceState(null,"","/"),n(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate"))),t()}})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Confirm Deletion"}),r.jsxs(d.DialogDescription,{className:"py-4 text-slate-500",children:[r.jsxs("div",{children:["Are you sure you want to remove ",r.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)})," ",(e==null?void 0:e.collection)==="global"?"global block?":`page? ${e!=null&&e.primaryPage?"":"This will also delete all associated language pages."}`]}),e.lang&&r.jsxs("div",{className:"py-2 text-sm",children:["Language:"," ",r.jsx("span",{className:"font-medium text-gray-500",children:h.get(pe,e.lang,e.lang)})]})]})]}),r.jsxs(d.DialogFooter,{children:[r.jsx(d.Button,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(d.Button,{variant:"destructive",disabled:i,onClick:a,children:i?"Deleting...":"Delete"})]})]})})}const zs=({page:e,onClose:t})=>{const{mutate:n,isPending:s}=Ta(),i=async()=>{n(e,{onSuccess:t})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Confirm action"}),r.jsxs(d.DialogDescription,{children:["Are you sure you want to take offline"," ",r.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)}),"?"]})]}),r.jsxs(d.DialogFooter,{children:[r.jsx(d.Button,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(d.Button,{variant:"destructive",disabled:s,onClick:i,children:s?"Updating...":"Take offline"})]})]})})},Hs=({langProps:e,onClose:t,languages:n})=>{const{data:s}=Se(),[i,a]=w.useState(e.name||""),[o,l]=w.useState(e.edit?e.lang:""),[u,f]=w.useState(e.edit?e.slug:""),{mutate:m,isPending:g}=$s(),{mutate:x,isPending:j}=vn(),C=(e==null?void 0:e.collection)==="global",_=g||j,S=y=>{y.preventDefault();const v={name:i,lang:o,primaryPage:s==null?void 0:s.id,slug:u,collection:s==null?void 0:s.collection};v.collection=e.collection,e.edit&&(v.id=e==null?void 0:e.id),e.edit?x(v,{onSuccess:t}):m(v,{onSuccess:t})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{className:"sm:max-w-[425px] text-slate-600",children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:e.edit?"Edit language":"Add New language"}),r.jsx(d.DialogDescription,{className:"font-light",children:"Enter the details for the language"})]}),r.jsxs("form",{onSubmit:S,children:[r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"lang",className:"text-right",children:"Language"}),r.jsxs("select",{value:o,disabled:e.edit||h.isEmpty(n),onChange:y=>{const v=y.target.value;l(v),!C&&f(`/${v}`)},className:"flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 col-span-3",children:[r.jsx("option",{value:"",disabled:!0,selected:!0,children:e.edit?h.get(pe,e.lang,e.lang):h.isEmpty(n)?"All available language page is created.":"Choose language"}),h.map(n,y=>r.jsx("option",{value:y,children:h.get(pe,y,y)},y))]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"slug",className:"text-right",children:"Page Name"}),r.jsx(d.Input,{id:"name",value:i,onChange:y=>a(y.target.value),className:"col-span-3",required:!0,placeholder:"Enter page name"})]}),!C&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",r.jsx("small",{className:"font-light",children:e.edit?"To update slug use 'Change slug' action":" (Slug should start with /{lang})"})]}),r.jsx(d.Input,{id:"slug",value:u,onChange:y=>{const v=y.target.value;h.startsWith(v,`/${o}`)&&f(h.toLower(h.trim(v)))},className:"col-span-3",required:!0,pattern:"^/.*",disabled:h.isEmpty(o)||(e==null?void 0:e.edit),title:"Slug must start with /",placeholder:h.isEmpty(o)?"Choose language to add slug":"Enter page slug"})]})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:_||!i||!o||!C&&!h.startsWith(u,`/${o}`),children:_?e.edit?"Updating...":"Adding...":e.edit?"Update":"Add new language"})})]})]})})},_a=()=>{const[e,t]=w.useState(null),{selectedLang:n,fallbackLang:s,setSelectedLang:i}=he.useLanguages(),{data:a,isFetching:o}=bn(),{data:l}=Se(),[u,f]=w.useState(null),[m,g]=w.useState(null),[x,j]=w.useState(null),{data:C}=xn(),_=h.filter(h.get(C,"languages")||["en"],S=>!h.find(a,{lang:S})&&S!==h.get(C,"fallbackLang"));return r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsx("ul",{className:"space-y-2 mt-4",children:o?r.jsxs("div",{className:"w-full space-y-3 py-4",children:[r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):h.map(a,S=>{const y=S.lang,v=S.slug,K=!S.primaryPage,H=y===n;return r.jsxs(r.Fragment,{children:[r.jsxs("li",{className:`text-slate-500 w-full p-2 rounded cursor-pointer flex items-center justify-between ${H?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>i(y),children:[r.jsxs("div",{className:" flex-1 gap-x-3",children:[r.jsxs("div",{className:"text-[13px] text-slate-800 flex items-center gap-x-2",children:[r.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${S.online?"bg-green-300":"bg-gray-300"}`}),h.get(pe,K?s:y,y)]}),r.jsxs("div",{children:[v&&r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Slug: ",r.jsx("b",{className:"font-medium",children:v})]}),r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Name:",r.jsxs("b",{className:"font-medium",children:[" ",S.name," "]})]})]})]}),K?r.jsxs("div",{className:"flex items-center text-[11px] text-orange-500 gap-x-1",children:[r.jsx(P.StarIcon,{fill:"orange",className:"w-3 h-3"}),r.jsx("b",{children:" Primary"})]}):r.jsx("div",{className:"flex items-center gap-x-3",children:r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,onClick:G=>G.stopPropagation(),children:r.jsx(d.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:r.jsx(P.MoreHorizontal,{className:"h-4 w-4"})})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.stopPropagation(),t({...S,edit:!0})},children:[r.jsx(P.PencilIcon,{className:"size-3"}),"Edit"]}),(S==null?void 0:S.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.stopPropagation(),g(S)},children:[r.jsx(P.Power,{className:"size-3"}),"Take offline"]}),(S==null?void 0:S.collection)!=="global"&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.stopPropagation(),j(S)},children:[r.jsx(P.Link,{className:"size-3"}),"Change slug"]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.stopPropagation(),f(S)},children:[r.jsx(P.TrashIcon,{className:"size-3"}),"Delete"]})]})]})})]},S.id),r.jsx("div",{className:"h-1 w-full border-b"})]})})}),r.jsx("div",{className:"flex justify-center w-full",children:r.jsx(d.Button,{variant:"default",size:"sm",disabled:h.isEmpty(_),onClick:()=>{t({name:l==null?void 0:l.name,collection:l==null?void 0:l.collection,lang:"",slug:"",edit:!1})},children:"+ Add new language"})}),e&&r.jsx(Hs,{languages:_,langProps:e,onClose:()=>t(null)}),u&&r.jsx(Ws,{page:u,onClose:()=>f(null)}),m&&r.jsx(zs,{page:m,onClose:()=>g(null)}),x&&r.jsx(Ks,{page:x,onClose:()=>j(null)})]})},Da=()=>{const e=X();return L.useQuery({queryKey:[k.GET_CHANGES],queryFn:async()=>Z(e,{action:k.GET_CHANGES})})};function Oa({onClose:e=()=>console.log("Cancelled")}){const[t,n]=w.useState([]),{data:s,isFetching:i}=Da(),{data:a}=xt(),o=w.useMemo(()=>h.filter(s,y=>y.collection!=="global"),[s]),l=w.useMemo(()=>h.filter(s,{collection:"global"}),[s]),u=w.useMemo(()=>h.find(s,{collection:"theme",id:"THEME"}),[s]),{mutate:f,isPending:m}=Aa();w.useEffect(()=>{const y=h.map(h.filter(s,{online:!0}),"id");u&&y.push(u==null?void 0:u.id),n(y)},[s,u]);const g=t.length===(s==null?void 0:s.length),x=y=>{n(v=>h.includes(v,y)?h.filter(v,K=>K!==y):h.concat(v,y))},j=()=>{n(g?[]:h.map(s,"id"))},C=()=>{f({ids:h.uniq(t)},{onSuccess:e})},_=y=>{if(y==="global")return"Global Block";if(y==="theme")return"Theme";const v=h.find(a,{key:y});return v?v==null?void 0:v.name:y},S=w.useMemo(()=>{const y=[{label:"Updated Pages & Global Blocks",top:"pt-2"},...h.orderBy(h.filter(o,{online:!0}),"collection"),...h.orderBy(h.filter(l,{online:!0}),"collection")].filter(H=>H.collection!=="theme"),v=[{label:"Offline Pages & Global Blocks",top:"pt-6"},...h.orderBy(h.filter(o,{online:!1}),"collection"),...h.orderBy(h.filter(l,{online:!1}),"collection")],K=u?[{label:"Theme",top:"pt-6"},u]:[];return[...y,...K,...v]},[o,l,u]);return r.jsx(d.Dialog,{open:!0,onOpenChange:m?()=>{}:e,children:r.jsxs(d.DialogContent,{className:"max-w-4xl max-h-[80%] flex flex-col",children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Publish changes"}),r.jsx(d.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),r.jsx("div",{className:"relative -mx-4 h-full overflow-y-auto max-h-full no-scrollbar",children:i?r.jsxs("div",{className:"space-y-2 px-1",children:[r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse mt-2"}),r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"})]}):r.jsxs("table",{className:"w-full text-xs text-left rtl:text-right text-gray-500 dark:text-gray-400",children:[r.jsx("thead",{className:"text-gray-700 border-b bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:r.jsxs("tr",{children:[r.jsxs("th",{scope:"col",className:"px-6 py-3 flex items-center gap-x-2 w-[1 50px]",children:[r.jsx("input",{checked:g,onClick:y=>{y.stopPropagation(),j()},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 mt-1 cursor-pointer"}),"Name"]}),r.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Language"}),r.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Type"}),r.jsx("th",{scope:"col",className:"px-4 py-3 w-[150px] text-right",children:"Status"})]})}),r.jsx("tbody",{children:h.map(S,y=>y.label?r.jsx("tr",{children:r.jsxs("td",{colSpan:4,className:`px-6 py-2 text-xs font-medium text-gray-800 relative ${y.top}`,children:[r.jsx("div",{className:"absolute inset-0 left-6 flex items-center",children:r.jsx("div",{className:"w-full order-gray-300"})}),r.jsx("div",{className:"relative flex justify-start",children:r.jsx("span",{className:"bg-gray-50 pr-2",children:y.label})})]})},"separator"):r.jsxs("tr",{className:"hover:bg-gray-50 border-b last:border-b-0",children:[r.jsxs("td",{scope:"row",className:"px-6 py-2 text-gray-900 whitespace-nowrap dark:text-white flex items-center gap-x-1",children:[r.jsx("input",{checked:h.includes(t,y==null?void 0:y.id),onClick:v=>{v.stopPropagation(),x(y==null?void 0:y.id)},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 cursor-pointer"})," ",y.collection==="global"?r.jsx(P.GlobeIcon,{className:"h-4 w-4"}):r.jsx(P.File,{className:"h-4 w-4"}),y.name,y.slug&&r.jsxs("span",{className:"text-xs text-gray-500",children:["(",y.slug,")"]})]}),r.jsx("td",{className:"px-2",children:y.lang}),r.jsx("td",{className:"px-2",children:_(y==null?void 0:y.collection)}),r.jsx("td",{className:"px-4 text-right",children:h.first(y.changes)||""})]},y==null?void 0:y.id))})]})}),r.jsxs(d.DialogFooter,{className:"mt-10",children:[r.jsx(d.Button,{disabled:m,variant:"outline",onClick:e,children:"Cancel"}),r.jsx(d.Button,{disabled:m||i||h.isEmpty(s),onClick:C,children:m?"Publishing...":"Publish"})]})]})})}const Ia=()=>{const e=X();return L.useQuery({queryKey:[k.GET_WEBSITE_DATA],staleTime:1e3*60*5,queryFn:async()=>Z(e,{action:k.GET_WEBSITE_DATA,data:{draft:!0}})})};function La({onClose:e}){const{data:t,isFetching:n}=Ia(),{mutateAsync:s,isPending:i}=ja(),a=pt("settingComponent",null),o=h.debounce(async l=>(await s({data:l}),!0),300);return a?r.jsx(d.Dialog,{open:!0,onOpenChange:e,children:r.jsxs(d.DialogContent,{className:"w-full",children:[r.jsx(d.DialogHeader,{children:r.jsx(d.DialogTitle,{children:"Website Settings"})}),n?r.jsxs("div",{className:"w-full space-y-3 py-4",children:[r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):r.jsx("div",{children:w.createElement(a,{data:t||{},onSave:i?()=>{}:o,cancel:i?()=>{}:e})})]})}):null}function Ut({children:e,content:t}){return r.jsx(d.TooltipProvider,{children:r.jsxs(d.Tooltip,{children:[r.jsx(d.TooltipTrigger,{asChild:!0,children:e}),r.jsx(d.TooltipContent,{side:"bottom",sideOffset:10,children:r.jsx("p",{children:t})})]})})}const Ra=()=>{const e=pt("getPreviewUrl",async o=>o),[t,n]=w.useState(""),{data:s,isFetching:i}=Se(),a=w.useMemo(()=>s==null?void 0:s.slug,[s==null?void 0:s.slug]);return w.useEffect(()=>{(async()=>{if(a&&typeof e=="function"){const o=await e(a||"");n(o)}else n("")})()},[e,a]),!t||(s==null?void 0:s.collection)==="global"||i?null:r.jsxs(r.Fragment,{children:[r.jsx(Ut,{content:"Preview",children:r.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:r.jsx(d.Button,{variant:"ghost",size:"icon",className:"gap-2",children:r.jsx(P.Eye,{className:"w-4 h-4"})})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]})},Ga=()=>{const[e,t]=he.useRightPanel();return r.jsxs(r.Fragment,{children:[r.jsx(Ut,{content:"Theme",children:r.jsx(d.Button,{variant:e==="theme"?"outline":"ghost",size:"icon",className:"gap-2",onClick:()=>t(e==="theme"?"block":"theme"),children:r.jsx(P.Palette,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]})},Fa=()=>{const[e,t]=w.useState(!1),{savePage:n,saveState:s}=he.useSavePage();w.useEffect(()=>{const f=m=>{s==="UNSAVED"&&(m.preventDefault(),m.returnValue=!1)};return s==="UNSAVED"&&window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)}},[s]);const i=w.useCallback(async()=>{t(!0),await n(!1)},[n]);w.useEffect(()=>{s==="SAVED"&&t(!1)},[s]);const a=w.useMemo(()=>{if(s==="SAVED"||s==="UNSAVED")return s;if(s==="SAVING")return e?s:"SAVED"},[e,s]),{buttonIcon:o,buttonClass:l,tooltipContent:u}=w.useMemo(()=>{switch(a){case"UNSAVED":return{tooltipContent:"Save changes",buttonIcon:r.jsx(P.Check,{strokeWidth:5,className:"w-4 h-4 transition eas-in"}),buttonClass:"bg-gray-300 text-gray-500 focus:ring-gray-400 duration-100 hover:text-gray-900"};case"SAVING":return{tooltipContent:"Saving...",buttonIcon:r.jsx(P.Loader,{strokeWidth:3,className:"w-5 h-5 animate-spin transition ease-in-out"}),buttonClass:"bg-yellow-500 text-white focus:ring-yellow-400"};case"SAVED":return{tooltipContent:"Changes saved",buttonIcon:r.jsx(P.Check,{strokeWidth:5,className:"w-4 h-4 transition eas-in"}),buttonClass:"bg-green-500 text-white hover:bg-green-600 hover:text-white focus:ring-green-400"}}},[a]);return r.jsx(Ut,{content:u,children:r.jsx("button",{className:`w-7 h-7 mx-3 flex items-center justify-center p-2 rounded-full shadow-sm transition-all duration-200 ease-in-out active:scale-95 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-opacity-50 ${l}`,onClick:i,disabled:a==="SAVING","aria-label":u,children:o})})},Ua=()=>{const[e,t]=w.useState(!1),[n,s]=w.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(d.Button,{size:"sm",className:"relative overflow-hidden transition-all duration-300 ease-in-out from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 text-white font-semibold shadow-md",onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onClick:()=>t(!0),disabled:e,children:[r.jsx("span",{className:`flex items-center gap-2 transition-transform duration-300 ease-in-out ${n?"-translate-y-10":""}`,children:r.jsx(P.Rocket,{className:"w-4 h-4 mr-2"})}),r.jsx("span",{className:`absolute inset-0 flex items-center left-3 transition-transform duration-300 ease-in-out ${n?"":"translate-y-10"}`,children:r.jsx(P.Send,{className:"w-4 h-4 mr-2"})}),"Publish"]}),e&&r.jsx(Oa,{onClose:()=>t(!1)})]})},Ma=()=>{const e=pt("settingComponent",null),[t,n]=w.useState(!1);return e?r.jsxs(r.Fragment,{children:[r.jsx(Ut,{content:"Website data",children:r.jsx(d.Button,{variant:"ghost",size:"icon",className:"gap-2",onClick:()=>n(!0),children:r.jsx(P.Settings,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"}),t&&r.jsx(La,{onClose:()=>n(!1)})]}):null};function Ba(){return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Ma,{}),r.jsx(Ra,{}),r.jsx(Ga,{}),r.jsxs(r.Fragment,{children:[r.jsx(Fa,{}),r.jsx(Ua,{})]})]})}const qa=({editPage:e,addEditPage:t,setAddEditPage:n})=>{const s=t.id,[i,a]=w.useState(s&&t.name||""),[o,l]=w.useState(s&&t.slug||""),[u,f]=w.useState(s||!h.isEmpty(t==null?void 0:t.collection)?(t==null?void 0:t.collection)||"":"page"),{data:m=[]}=xt(),{mutate:g,isPending:x}=$s(),{mutate:j,isPending:C}=vn(),_=x||C,S=y=>{y.preventDefault(),s?j({name:i,slug:o,id:t.id,collection:t.global?"global":u},{onSuccess:()=>{n(null)}}):g({name:i,slug:o,collection:t.global?"global":u},{onSuccess:v=>{n(null),e(v.page.id)}})};return r.jsx(d.Dialog,{open:!!t,onOpenChange:()=>n(void 0),children:r.jsxs(d.DialogContent,{className:"sm:max-w-[425px]",children:[r.jsxs(d.DialogHeader,{children:[r.jsxs(d.DialogTitle,{children:[s?"Edit":"Add New"," ",t.global?"Global Block":h.startCase(u)]}),r.jsxs(d.DialogDescription,{children:["Enter the details for the new"," ",t.global?"Global Block":`${h.startCase(u)}. Slug must start with /`]})]}),r.jsxs("form",{onSubmit:S,children:[r.jsxs("div",{className:"grid gap-4 py-4",children:[!t.global&&r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"pageType",children:"Type"}),r.jsx("select",{value:u,disabled:s,onChange:y=>f(y.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:m.map(y=>r.jsx("option",{value:y.key,children:y.name},y.key))})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"name",className:"text-right",children:"Name"}),r.jsx(d.Input,{id:"name",value:i,placeholder:`Enter ${t.global?"global block":"page"} name`,onChange:y=>a(y.target.value),className:"col-span-3",required:!0})]}),!t.global&&r.jsx(r.Fragment,{children:r.jsxs("div",{className:"space-y-1",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-right",children:[t.global?"Identifier":"Slug"," ",s&&r.jsx("small",{className:"text-gray-400 font-light",children:"To update slug use 'Change slug' action"})]}),r.jsx(d.Input,{id:"slug",value:o,disabled:s,onChange:y=>{var v;return l((v=y.target.value)==null?void 0:v.trim().toLowerCase())},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:_||!i||!t.global&&!o.startsWith("/")||h.isEqual(t.name,i)&&h.isEqual(t.slug,o)&&h.isEqual(t.pageType,u),children:_?s?"Updating...":"Adding...":t.global?`${s?"Update":"Add"} global block`:`${s?"Update":"Add"} Page`})})]})]})})},$a=({close:e})=>{const[t,n]=w.useState([]),[s,i]=w.useState(""),[a,o]=w.useState(null),[l,u]=w.useState(null),[f,m]=w.useState(null),[g,x]=w.useState(null),{data:j}=xt(),{data:C,isFetching:_}=pn(),[S,y]=je(),v=S.get("page"),K=w.useCallback(N=>{window.history.pushState({},"",`?page=${N}`),y(new URLSearchParams({page:N})),window.dispatchEvent(new PopStateEvent("popstate")),e()},[e,y]),H=N=>{h.includes(t,N)?n(h.filter(t,M=>M!==N)):n([...t,N])};w.useEffect(()=>{if(v&&!_){const N=h.find(C,{id:v});N&&(N!=null&&N.collection)?n(M=>[...M,N==null?void 0:N.collection]):(window.history.replaceState(null,"","/"),y(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate")))}},[C,v,_]);const G=w.useMemo(()=>{const N=h.filter(C,E=>h.isEmpty(s)?!0:h.includes(h.toLower(E==null?void 0:E.name),h.toLower(s))||h.includes(h.toLower(E==null?void 0:E.slug),h.toLower(s)));h.isEmpty(s)||n(h.map(N,"collection"));const M=h.groupBy(N,"collection"),oe=[{key:"page",name:"Pages"},{key:"global",name:"Global Block"},...j.filter(E=>E.key!=="page")];return h.map(oe,E=>({...E,items:h.orderBy(h.get(M,E.key,[]),"slug")||[]}))},[C,j,s]);return r.jsxs("div",{className:"h-full flex flex-col justify-between",children:[r.jsxs("div",{className:"space-y-6 flex flex-col h-full",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"rounded-md bg-primary p-2 text-primary-foreground",children:r.jsx(P.File,{className:"h-6 w-6"})}),r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"text-sm font-semibold",children:"Pages"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Manage your site structure"})]})]}),r.jsxs("div",{className:"relative flex item-center gap-x-4",children:[r.jsx(P.Search,{strokeWidth:2.5,className:"absolute left-3 top-2.5 h-4 w-4 text-gray-400"}),r.jsx(d.Input,{placeholder:"Search pages...",className:"pl-9 text-xs font-medium placeholder:text-gray-400 leading-none text-gray-700",value:s,onChange:N=>i(N.target.value)})]}),_?r.jsx("div",{className:"space-y-2",children:h.map([...Array(5).keys()],N=>r.jsx("div",{className:"h-9 w-full rounded bg-gray-200 animate-pulse"},N))}):h.isEmpty(G)?r.jsxs("div",{className:"h-[70vh] flex flex-col gap-y-1 items-center justify-center text-slate-500 text-sm font-medium",children:[r.jsx(P.File,{className:"h-6 w-6 stroke-[1]"}),"Empty List!",r.jsx("span",{className:"font-light",children:"Add new page to start"})]}):r.jsx("div",{className:"text-sm text-slate-700 space-y-2 h-[70vh] overflow-y-auto",children:h.map(G,N=>r.jsxs("div",{className:"border-0 py-",children:[r.jsxs("div",{className:"group font-medium flex items-center leading-none gap-x-2 cursor-pointer hover:bg-slate-100 rounded duration-200 p-1.5",onClick:()=>H(N.key),children:[h.includes(t,N.key)?r.jsx(P.ChevronDown,{className:"w-4 h-4 text-slate-400 ease-in transition-all"}):r.jsx(P.ChevronRight,{className:"w-4 h-4 text-slate-400 ease-in"}),["page","global"].includes(N.key)?r.jsx(P.Folder,{className:"w-4 h-4"}):r.jsx(P.Database,{className:"w-4 h-4"}),r.jsx("span",{className:"leading-none",children:h.startCase(N.name)||"Uncategorized"}),r.jsx(d.Badge,{variant:"outline",className:`ml-2 text-xs font-bold rounded-full leading-none text-slate-500 ${N.key==="global"||N.key==="page"?"opacity-0":""}`,children:h.get(N,"baseSlug.FALLBACK")||"/"}),r.jsxs(d.Button,{variant:"ghost",size:"sm",className:"h-6 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1 text-xs",onClick:M=>{M.stopPropagation(),x({slug:"",name:"",collection:N.key,global:N.key==="global"})},children:[r.jsx(P.Plus,{className:"h-3 w-3"}),"Add ",h.startCase(N.name)||"Uncategorized"]})]}),h.includes(t,N.key)&&r.jsxs("div",{className:"bg-white pl-6 pt-2",children:[h.isEmpty(h.get(N,"items",[]))&&r.jsxs("div",{className:"text-xs font-light px-3 pb-1",children:["No ",h.startCase(N.name)||"Uncategorized"]}),h.map(h.get(N,"items",[]),M=>{const oe=v===h.get(M,"id");return r.jsxs("div",{onClick:()=>K(h.get(M,"id")),className:`rounded flex items-center justify-between leading-none duration-300 cursor-pointer px-3 py-1.5 ${oe?"bg-gray-200":"hover:bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[N.key==="global"?r.jsx(P.Globe,{className:"w-4 h-4 text-slate-500 stroke-[1]"}):r.jsx(P.File,{className:"w-4 h-4 text-slate-500 stroke-[1]"}),r.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${M.online?"bg-green-300":"bg-gray-300"}`}),r.jsx("span",{className:"leading-none text-slate-800 font-light",children:h.startCase(M.name)??""}),r.jsx(d.Badge,{variant:"outline",className:`ml-2 font-bold text-xs rounded-full leading-none text-slate-500 ${N.key==="global"?"opacity-0":""}`,children:h.get(M,"slug")||"/"})]}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,onClick:E=>E.stopPropagation(),children:r.jsx(P.MoreHorizontal,{className:"h-4 w-4 hover:stroke-[3]"})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:E=>{E.stopPropagation(),x({...M,global:N.key==="global"})},children:[r.jsx(P.Pencil,{className:"size-3"}),"Edit"]}),(M==null?void 0:M.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:E=>{E.stopPropagation(),u(M)},children:[r.jsx(P.Power,{className:"size-3"}),"Take offline"]}),N.key!=="global"&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:E=>{E.stopPropagation(),m(M)},children:[r.jsx(P.Link,{className:"size-3"}),"Change slug"]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:E=>{E.stopPropagation(),o(M)},children:[r.jsx(P.Trash,{className:"size-3"}),"Delete"]})]})]})})]})})]})]},N.key))})]}),r.jsxs(d.Button,{className:"text-sm flex gap-x-2",onClick:()=>{x({slug:"",name:"",collection:"page"})},children:[r.jsx(P.Plus,{className:"w-4 h-4"})," Add New"]}),g&&r.jsx(qa,{editPage:K,addEditPage:g,setAddEditPage:x}),a&&r.jsx(Ws,{page:a,onClose:()=>o(null)}),l&&r.jsx(zs,{page:l,onClose:()=>u(null)}),f&&r.jsx(Ks,{page:f,onClose:()=>m(null)})]})},Va=()=>{const e=pt("logo",null);return e?r.jsx("div",{className:"w-full max-h-9 overflow-hidden pr-2",children:w.createElement(e,{})}):null},Ka=()=>{const[e]=je(),t=e.get("page"),{data:n,isFetching:s}=Se(),[i,a]=w.useState(!1),o=!!t&&!h.isEmpty(n),l=!t||!s&&h.isEmpty(n)||i;return r.jsxs(r.Fragment,{children:[r.jsxs(d.Button,{variant:"secondary",className:"flex items-center w-full space-x-2 py-1",onClick:()=>a(!0),children:[r.jsx("div",{children:r.jsx(P.Logs,{className:"h-4 w-4"})}),r.jsxs("span",{className:"truncate leading-tight flex items-center max-w-[200px]",children:[r.jsx("span",{className:"text-slate-600 pr-1 font-light",children:"Editing:"}),s?r.jsx(P.Loader,{className:"h-4 w-4 animate-spin text-slate-400 ml-2"}):h.startCase(h.get(n,"name"))??""]})]},"template-viewer"),r.jsx(d.Sheet,{open:l,onOpenChange:u=>!u&&o&&a(!1),children:r.jsx(d.SheetContent,{side:"left",className:`!max-w-screen-sm border-border w-full ${o?"":"sheet-hide-close-btn"}`,children:r.jsx($a,{close:()=>a(!1)})})})]})},Wa=()=>{const{fallbackLang:e,languages:t,selectedLang:n,setSelectedLang:s}=he.useLanguages(),i=h.isEmpty(n)?e:n,[a,o]=w.useState(null),{data:l}=Se(),{data:u}=xn(),{data:f,isFetching:m}=bn(),g=w.useMemo(()=>{const x=h.compact(h.map(h.get(u,"languages"),j=>{const C=h.find(f,{lang:j});return{key:j,value:h.get(pe,j,j),isLangPageAdded:!!C}})).filter(Boolean);return[{key:e,value:h.get(pe,e),isLangPageAdded:!0},...x]},[f,u]);return h.isEmpty(t)||m?null:r.jsxs(r.Fragment,{children:[r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,className:"focus:outline-none",children:r.jsxs(d.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[r.jsx(P.Languages,{className:"w-4 h-4"}),h.get(pe,i,i),r.jsx(P.ChevronDown,{className:"w-4 h-4"})]})}),r.jsxs(d.DropdownMenuContent,{className:"border-border space-y-1",children:[h.map(g.filter(x=>x.isLangPageAdded),x=>r.jsxs(d.DropdownMenuItem,{className:he.mergeClasses("flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",x.key===i&&"!bg-gray-200 text-gray-700"),onClick:()=>s(x.key),children:[r.jsx("div",{className:"text-slate-600",children:x.value}),x.key===e&&r.jsxs("small",{className:"text-[9px] flex items-center gap-x-1 text-orange-500 leading-none",children:[r.jsx(P.Star,{fill:"orange",className:"w-2 h-2"}),"Primary"]})]},x.value)),!h.isEmpty(g.filter(x=>!x.isLangPageAdded))&&r.jsxs(r.Fragment,{children:[r.jsx(d.Separator,{}),r.jsxs(d.Button,{size:"sm",variant:"ghost",onClick:()=>{o({name:l==null?void 0:l.name,collection:l==null?void 0:l.collection,lang:"",slug:"",edit:!1})},className:"hover:bg-slate-300 duration-200 font-normal text-xs hover:text-slate-800",children:[r.jsx(P.Plus,{className:"w-3 h-3 mr-1"})," Add Langauge"]})]})]})]}),a&&r.jsx(Hs,{languages:t,langProps:a,onClose:()=>o(null)})]})};function za(){return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Va,{}),r.jsx(Ka,{}),r.jsx(Wa,{})]})}Er.loadWebBlocks();const Ha=e=>{const t=w.useRef([]),[n]=je(),s=n.get("page"),{data:i}=Se(),{data:a}=xa(),{data:o,isFetching:l}=va(),{blocks:u}=ba(o),{data:f}=xn(),{data:m}=xt(),{mutateAsync:g}=Ea(),x=ya(),{getUILibraryBlock:j,getUILibraryBlocks:C,onSave:_}=pa(),{getGlobalBlocks:S,getGlobalBlockBlocks:y}=wa(),{aiContext:v,setAiContext:K}=yn(),{mutateAsync:H}=Sa();t.current=u;const G=w.useMemo(()=>{const E={};return e.mediaManagerComponent&&(E.mediaManagerComponent=e.mediaManagerComponent),E},[e.mediaManagerComponent]),N=w.useMemo(()=>Array.isArray(e==null?void 0:e.uiLibraries)?[...a,...e==null?void 0:e.uiLibraries]:a,[a,e==null?void 0:e.uiLibraries]),M=w.useCallback(async(E,B)=>await H({collection:E,query:B}),[H]),oe=w.useMemo(()=>h.get(f,"theme",{}),[f]);return r.jsx(r.Fragment,{children:r.jsx(he.ChaiBuilderEditor,{loading:l,fallbackLang:f.fallbackLang||"en",languages:(f==null?void 0:f.languages)||[],brandingOptions:(f==null?void 0:f.theme)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSaveSupport:e.autoSaveSupport||!0,autoSaveInterval:e.autoSaveInterval||25,onError:e.onError||console.error,getGlobalBlockBlocks:y,getGlobalBlocks:S,blocks:u,theme:oe,getUILibraryBlock:j,getUILibraryBlocks:C,uiLibraries:N,collections:m,searchCollectionItems:M,saveAiContextCallback:async E=>{if(!s)return!0;const B=t.current,z={_type:"@chai/ai-context",_value:h.isString(E)?E:""},ae=[...B,z];return await _({page:s,blocks:ae}),K(E),!0},aiContext:v,askAiCallBack:x,onSave:async({blocks:E,theme:B})=>{if(h.isEqual(B,oe)||await g({settings:{theme:B}}),!s)return!0;t.current=E;const z={_type:"@chai/ai-context",_value:h.isString(v)?v:""},ae=[...E,z];return await _({page:s,blocks:ae}),t.current=E,!0},topBarComponents:{left:[za],right:[Ba]},sideBarComponents:{top:[...(i==null?void 0:i.collection)!=="global"?[{label:"SEO Setting",component:Vs,icon:r.jsx(r.Fragment,{children:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21 21",fill:"currentColor",width:"21",height:"21",children:[r.jsx("path",{d:"M9.931 6.818c-1.238 0-2.136.925-2.136 2.2 0 1.279.898 2.207 2.136 2.207.664 0 1.257-.246 1.67-.694a.15.15 0 0 0-.009-.213l-.311-.286a.15.15 0 0 0-.213.009c-.273.297-.677.46-1.137.46-.699 0-1.233-.444-1.375-1.12h3.295a.15.15 0 0 0 .151-.151v-.211c0-1.295-.852-2.2-2.072-2.2m0 .724c.697 0 1.188.422 1.315 1.113h-2.69c.142-.673.676-1.113 1.374-1.113m4.332-.724c-1.246 0-2.15.925-2.15 2.2 0 1.279.904 2.207 2.15 2.207.596 0 1.143-.223 1.538-.628s.612-.965.612-1.579c0-1.275-.904-2.2-2.15-2.2m0 3.683c-.826 0-1.426-.624-1.426-1.483 0-.855.6-1.475 1.426-1.475s1.426.621 1.426 1.476c0 .423-.144.804-.406 1.073-.258.264-.62.41-1.019.41M6.318 8.71c-.665-.206-.902-.335-.902-.645 0-.47.564-.521.806-.521.29 0 .552.07.801.215a.15.15 0 0 0 .206-.055l.212-.366a.15.15 0 0 0-.055-.206 2.27 2.27 0 0 0-1.165-.312c-.915 0-1.53.501-1.53 1.245 0 .899.816 1.152 1.411 1.336.655.203.812.307.804.53-.016.398-.567.429-.735.429-.386 0-.722-.129-.972-.374q-.043-.042-.107-.043a.15.15 0 0 0-.106.045l-.295.302a.15.15 0 0 0 .002.213c.383.374.908.58 1.478.58.859 0 1.432-.441 1.459-1.125.031-.833-.746-1.074-1.313-1.249"}),r.jsx("path",{d:"M20.396 2.049H.604A.604.604 0 0 0 0 2.653v12.7c0 .333.27.604.604.604h6.941c-.266 1.296-.881 1.966-.886 1.971a.604.604 0 0 0 .434 1.024h6.815a.604.604 0 0 0 .434-1.024c-.007-.007-.621-.675-.886-1.971h6.941c.333 0 .604-.27.604-.604V2.652a.604.604 0 0 0-.604-.604m-.604 12.701h-.985v-.17a.604.604 0 0 0-1.208 0v.17h-.63v-.17a.604.604 0 0 0-1.208 0v.17H1.207V3.256h18.585z"})]})})}]:[],...h.isEmpty(f==null?void 0:f.languages)?[]:[{label:`Language ${(i==null?void 0:i.collection)==="global"?"":"page"}`,component:_a,icon:r.jsx(P.Languages,{className:"w-5 h-5 stroke-[2]"})}]]},...G})})},Qa=new L.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),Ya=e=>{const[,t]=qs();return w.useEffect(()=>{t(h.pick(e,["apiUrl","getPreviewUrl","logo","settingComponent"]))},[e,t]),r.jsxs(L.QueryClientProvider,{client:Qa,children:[r.jsx(Ha,{...e}),r.jsx(ga,{})]})};exports.$TRACK=dn;exports.ChaiBuilderForge=Ya;exports.Dynamic=bi;exports.For=Hr;exports.Index=Qr;exports.Match=Xr;exports.Portal=vi;exports.Show=Yr;exports.Switch=Jr;exports.addEventListener=vs;exports.batch=Pr;exports.className=xs;exports.clearDelegatedEvents=ui;exports.convertRemToPixels=la;exports.createComponent=gn;exports.createComputed=en;exports.createContext=Rr;exports.createEffect=fn;exports.createMemo=se;exports.createRenderEffect=ye;exports.createRoot=me;exports.createSignal=Q;exports.createUniqueId=zr;exports.delegateEvents=ps;exports.deleteNestedDataByPath=et;exports.displayValue=na;exports.getMutationStatusColor=ea;exports.getPreferredColorScheme=ca;exports.getQueryStatusColor=Zi;exports.getQueryStatusColorByLabel=ta;exports.getQueryStatusLabel=Ji;exports.getSidedProp=Xi;exports.insert=It;exports.mergeProps=mn;exports.mutationSortFns=oa;exports.on=_r;exports.onCleanup=Ve;exports.onMount=os;exports.serialize=Fs;exports.setAttribute=Ot;exports.sortFns=ia;exports.splitProps=hs;exports.spread=bs;exports.stringify=Yi;exports.template=ci;exports.untrack=ee;exports.updateNestedDataByPath=Ze;exports.use=ws;exports.useContext=Gr;exports.useTransition=Lr;