@chaibuilder/pages 0.1.0-beta.35 → 0.1.0-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BMGNQTAT-DzZErzd7.js → BMGNQTAT-BXIBti0l.js} +2 -2
- package/dist/{BMGNQTAT-BjaltGdX.cjs → BMGNQTAT-DSWovR3D.cjs} +1 -1
- package/dist/ChaiBuilderPages-DhVKmwMd.cjs +30 -0
- package/dist/ChaiBuilderPages-Di_cyyTF.js +4891 -0
- package/dist/{STCWXWCR-CYflySHg.js → STCWXWCR-Bg7WoRnN.js} +1 -1
- package/dist/{STCWXWCR-DUcuCL1k.cjs → STCWXWCR-DGtXkjIN.cjs} +1 -1
- package/dist/{UODQIBEW-D6TjcU8i.cjs → UODQIBEW-CCBz9xzO.cjs} +1 -1
- package/dist/{UODQIBEW-DT63fo2-.js → UODQIBEW-CEELzvCt.js} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -4
- package/package.json +2 -2
- package/dist/ChaiBuilderPages-90fDaAoT.js +0 -4645
- package/dist/ChaiBuilderPages-CuARrKoP.cjs +0 -30
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c, T as l, P as m, a as u, D as v, Q as i } from "./STCWXWCR-
|
|
2
|
-
import { g as d, c as f, a as e } from "./ChaiBuilderPages-
|
|
1
|
+
import { c, T as l, P as m, a as u, D as v, Q as i } from "./STCWXWCR-Bg7WoRnN.js";
|
|
2
|
+
import { g as d, c as f, a as e } from "./ChaiBuilderPages-Di_cyyTF.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-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./STCWXWCR-DGtXkjIN.cjs"),t=require("./ChaiBuilderPages-DhVKmwMd.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;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";var qn=e=>{throw TypeError(e)};var Vn=(e,t,n)=>t.has(e)||qn("Cannot "+n);var T=(e,t,n)=>(Vn(e,t,"read from private field"),n?n.call(e):t.get(e)),F=(e,t,n)=>t.has(e)?qn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),G=(e,t,n,s)=>(Vn(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);const j=require("react"),R=require("@tanstack/react-query"),wr=require("@chaibuilder/sdk/web-blocks"),de=require("@chaibuilder/sdk"),y=require("lodash-es"),ss=require("jotai"),d=require("@chaibuilder/sdk/ui"),M=require("lucide-react");function Er(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const re=Er(j);var Zt={exports:{}},Ye={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-jsx-runtime.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var $n;function jr(){if($n)return Ye;$n=1;var e=j,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function o(l,u,f){var g,h={},E=null,S=null;f!==void 0&&(E=""+f),u.key!==void 0&&(E=""+u.key),u.ref!==void 0&&(S=u.ref);for(g in u)s.call(u,g)&&!a.hasOwnProperty(g)&&(h[g]=u[g]);if(l&&l.defaultProps)for(g in u=l.defaultProps,u)h[g]===void 0&&(h[g]=u[g]);return{$$typeof:t,type:l,key:E,ref:S,props:h,_owner:i.current}}return Ye.Fragment=n,Ye.jsx=o,Ye.jsxs=o,Ye}var Je={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Kn;function Sr(){return Kn||(Kn=1,process.env.NODE_ENV!=="production"&&function(){var e=j,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"),g=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),N=Symbol.iterator,x="@@iterator";function w(c){if(c===null||typeof c!="object")return null;var m=N&&c[N]||c[x];return typeof m=="function"?m:null}var p=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(c){{for(var m=arguments.length,v=new Array(m>1?m-1:0),C=1;C<m;C++)v[C-1]=arguments[C];O("error",c,v)}}function O(c,m,v){{var C=p.ReactDebugCurrentFrame,L=C.getStackAddendum();L!==""&&(m+="%s",v=v.concat([L]));var V=v.map(function(_){return String(_)});V.unshift("Warning: "+m),Function.prototype.apply.call(console[c],console,V)}}var $=!1,q=!1,pe=!1,xe=!1,Y=!1,D;D=Symbol.for("react.module.reference");function K(c){return!!(typeof c=="string"||typeof c=="function"||c===s||c===a||Y||c===i||c===f||c===g||xe||c===S||$||q||pe||typeof c=="object"&&c!==null&&(c.$$typeof===E||c.$$typeof===h||c.$$typeof===o||c.$$typeof===l||c.$$typeof===u||c.$$typeof===D||c.getModuleId!==void 0))}function W(c,m,v){var C=c.displayName;if(C)return C;var L=m.displayName||m.name||"";return L!==""?v+"("+L+")":v}function ce(c){return c.displayName||"Context"}function ae(c){if(c==null)return null;if(typeof c.tag=="number"&&b("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 g:return"SuspenseList"}if(typeof c=="object")switch(c.$$typeof){case l:var m=c;return ce(m)+".Consumer";case o:var v=c;return ce(v._context)+".Provider";case u:return W(c,c.render,"ForwardRef");case h:var C=c.displayName||null;return C!==null?C:ae(c.type)||"Memo";case E:{var L=c,V=L._payload,_=L._init;try{return ae(_(V))}catch{return null}}}return null}var ve=Object.assign,ze=0,bn,wn,En,jn,Sn,Cn,Nn;function Tn(){}Tn.__reactDisabledLog=!0;function Hs(){{if(ze===0){bn=console.log,wn=console.info,En=console.warn,jn=console.error,Sn=console.group,Cn=console.groupCollapsed,Nn=console.groupEnd;var c={configurable:!0,enumerable:!0,value:Tn,writable:!0};Object.defineProperties(console,{info:c,log:c,warn:c,error:c,group:c,groupCollapsed:c,groupEnd:c})}ze++}}function Qs(){{if(ze--,ze===0){var c={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ve({},c,{value:bn}),info:ve({},c,{value:wn}),warn:ve({},c,{value:En}),error:ve({},c,{value:jn}),group:ve({},c,{value:Sn}),groupCollapsed:ve({},c,{value:Cn}),groupEnd:ve({},c,{value:Nn})})}ze<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Mt=p.ReactCurrentDispatcher,Ut;function xt(c,m,v){{if(Ut===void 0)try{throw Error()}catch(L){var C=L.stack.trim().match(/\n( *(at )?)/);Ut=C&&C[1]||""}return`
|
|
18
|
+
`+Ut+c}}var qt=!1,vt;{var Ys=typeof WeakMap=="function"?WeakMap:Map;vt=new Ys}function An(c,m){if(!c||qt)return"";{var v=vt.get(c);if(v!==void 0)return v}var C;qt=!0;var L=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var V;V=Mt.current,Mt.current=null,Hs();try{if(m){var _=function(){throw Error()};if(Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(se){C=se}Reflect.construct(c,[],_)}else{try{_.call()}catch(se){C=se}c.call(_.prototype)}}else{try{throw Error()}catch(se){C=se}c()}}catch(se){if(se&&C&&typeof se.stack=="string"){for(var P=se.stack.split(`
|
|
19
|
+
`),te=C.stack.split(`
|
|
20
|
+
`),H=P.length-1,Q=te.length-1;H>=1&&Q>=0&&P[H]!==te[Q];)Q--;for(;H>=1&&Q>=0;H--,Q--)if(P[H]!==te[Q]){if(H!==1||Q!==1)do if(H--,Q--,Q<0||P[H]!==te[Q]){var ie=`
|
|
21
|
+
`+P[H].replace(" at new "," at ");return c.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",c.displayName)),typeof c=="function"&&vt.set(c,ie),ie}while(H>=1&&Q>=0);break}}}finally{qt=!1,Mt.current=V,Qs(),Error.prepareStackTrace=L}var Ce=c?c.displayName||c.name:"",be=Ce?xt(Ce):"";return typeof c=="function"&&vt.set(c,be),be}function Js(c,m,v){return An(c,!1)}function Xs(c){var m=c.prototype;return!!(m&&m.isReactComponent)}function bt(c,m,v){if(c==null)return"";if(typeof c=="function")return An(c,Xs(c));if(typeof c=="string")return xt(c);switch(c){case f:return xt("Suspense");case g:return xt("SuspenseList")}if(typeof c=="object")switch(c.$$typeof){case u:return Js(c.render);case h:return bt(c.type,m,v);case E:{var C=c,L=C._payload,V=C._init;try{return bt(V(L),m,v)}catch{}}}return""}var He=Object.prototype.hasOwnProperty,kn={},Pn=p.ReactDebugCurrentFrame;function wt(c){if(c){var m=c._owner,v=bt(c.type,c._source,m?m.type:null);Pn.setExtraStackFrame(v)}else Pn.setExtraStackFrame(null)}function Zs(c,m,v,C,L){{var V=Function.call.bind(He);for(var _ in c)if(V(c,_)){var P=void 0;try{if(typeof c[_]!="function"){var te=Error((C||"React class")+": "+v+" type `"+_+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[_]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw te.name="Invariant Violation",te}P=c[_](m,_,C,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(H){P=H}P&&!(P instanceof Error)&&(wt(L),b("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",C||"React class",v,_,typeof P),wt(null)),P instanceof Error&&!(P.message in kn)&&(kn[P.message]=!0,wt(L),b("Failed %s type: %s",v,P.message),wt(null))}}}var er=Array.isArray;function Vt(c){return er(c)}function tr(c){{var m=typeof Symbol=="function"&&Symbol.toStringTag,v=m&&c[Symbol.toStringTag]||c.constructor.name||"Object";return v}}function nr(c){try{return _n(c),!1}catch{return!0}}function _n(c){return""+c}function On(c){if(nr(c))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",tr(c)),_n(c)}var Qe=p.ReactCurrentOwner,sr={key:!0,ref:!0,__self:!0,__source:!0},Dn,In,$t;$t={};function rr(c){if(He.call(c,"ref")){var m=Object.getOwnPropertyDescriptor(c,"ref").get;if(m&&m.isReactWarning)return!1}return c.ref!==void 0}function ir(c){if(He.call(c,"key")){var m=Object.getOwnPropertyDescriptor(c,"key").get;if(m&&m.isReactWarning)return!1}return c.key!==void 0}function ar(c,m){if(typeof c.ref=="string"&&Qe.current&&m&&Qe.current.stateNode!==m){var v=ae(Qe.current.type);$t[v]||(b('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',ae(Qe.current.type),c.ref),$t[v]=!0)}}function or(c,m){{var v=function(){Dn||(Dn=!0,b("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};v.isReactWarning=!0,Object.defineProperty(c,"key",{get:v,configurable:!0})}}function lr(c,m){{var v=function(){In||(In=!0,b("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",m))};v.isReactWarning=!0,Object.defineProperty(c,"ref",{get:v,configurable:!0})}}var cr=function(c,m,v,C,L,V,_){var P={$$typeof:t,type:c,key:m,ref:v,props:_,_owner:V};return P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(P,"_self",{configurable:!1,enumerable:!1,writable:!1,value:C}),Object.defineProperty(P,"_source",{configurable:!1,enumerable:!1,writable:!1,value:L}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P};function ur(c,m,v,C,L){{var V,_={},P=null,te=null;v!==void 0&&(On(v),P=""+v),ir(m)&&(On(m.key),P=""+m.key),rr(m)&&(te=m.ref,ar(m,L));for(V in m)He.call(m,V)&&!sr.hasOwnProperty(V)&&(_[V]=m[V]);if(c&&c.defaultProps){var H=c.defaultProps;for(V in H)_[V]===void 0&&(_[V]=H[V])}if(P||te){var Q=typeof c=="function"?c.displayName||c.name||"Unknown":c;P&&or(_,Q),te&&lr(_,Q)}return cr(c,P,te,L,C,Qe.current,_)}}var Kt=p.ReactCurrentOwner,Rn=p.ReactDebugCurrentFrame;function Se(c){if(c){var m=c._owner,v=bt(c.type,c._source,m?m.type:null);Rn.setExtraStackFrame(v)}else Rn.setExtraStackFrame(null)}var Wt;Wt=!1;function zt(c){return typeof c=="object"&&c!==null&&c.$$typeof===t}function Ln(){{if(Kt.current){var c=ae(Kt.current.type);if(c)return`
|
|
22
|
+
|
|
23
|
+
Check the render method of \``+c+"`."}return""}}function dr(c){return""}var Gn={};function fr(c){{var m=Ln();if(!m){var v=typeof c=="string"?c:c.displayName||c.name;v&&(m=`
|
|
24
|
+
|
|
25
|
+
Check the top-level render call using <`+v+">.")}return m}}function Fn(c,m){{if(!c._store||c._store.validated||c.key!=null)return;c._store.validated=!0;var v=fr(m);if(Gn[v])return;Gn[v]=!0;var C="";c&&c._owner&&c._owner!==Kt.current&&(C=" It was passed a child from "+ae(c._owner.type)+"."),Se(c),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,C),Se(null)}}function Bn(c,m){{if(typeof c!="object")return;if(Vt(c))for(var v=0;v<c.length;v++){var C=c[v];zt(C)&&Fn(C,m)}else if(zt(c))c._store&&(c._store.validated=!0);else if(c){var L=w(c);if(typeof L=="function"&&L!==c.entries)for(var V=L.call(c),_;!(_=V.next()).done;)zt(_.value)&&Fn(_.value,m)}}}function hr(c){{var m=c.type;if(m==null||typeof m=="string")return;var v;if(typeof m=="function")v=m.propTypes;else if(typeof m=="object"&&(m.$$typeof===u||m.$$typeof===h))v=m.propTypes;else return;if(v){var C=ae(m);Zs(v,c.props,"prop",C,c)}else if(m.PropTypes!==void 0&&!Wt){Wt=!0;var L=ae(m);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",L||"Unknown")}typeof m.getDefaultProps=="function"&&!m.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gr(c){{for(var m=Object.keys(c.props),v=0;v<m.length;v++){var C=m[v];if(C!=="children"&&C!=="key"){Se(c),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",C),Se(null);break}}c.ref!==null&&(Se(c),b("Invalid attribute `ref` supplied to `React.Fragment`."),Se(null))}}var Mn={};function Un(c,m,v,C,L,V){{var _=K(c);if(!_){var P="";(c===void 0||typeof c=="object"&&c!==null&&Object.keys(c).length===0)&&(P+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var te=dr();te?P+=te:P+=Ln();var H;c===null?H="null":Vt(c)?H="array":c!==void 0&&c.$$typeof===t?(H="<"+(ae(c.type)||"Unknown")+" />",P=" Did you accidentally export a JSX literal instead of a component?"):H=typeof c,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",H,P)}var Q=ur(c,m,v,L,V);if(Q==null)return Q;if(_){var ie=m.children;if(ie!==void 0)if(C)if(Vt(ie)){for(var Ce=0;Ce<ie.length;Ce++)Bn(ie[Ce],c);Object.freeze&&Object.freeze(ie)}else b("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Bn(ie,c)}if(He.call(m,"key")){var be=ae(c),se=Object.keys(m).filter(function(br){return br!=="key"}),Ht=se.length>0?"{key: someKey, "+se.join(": ..., ")+": ...}":"{key: someKey}";if(!Mn[be+Ht]){var vr=se.length>0?"{"+se.join(": ..., ")+": ...}":"{}";b(`A props object containing a "key" prop is being spread into JSX:
|
|
26
|
+
let props = %s;
|
|
27
|
+
<%s {...props} />
|
|
28
|
+
React keys must be passed directly to JSX without using spread:
|
|
29
|
+
let props = %s;
|
|
30
|
+
<%s key={someKey} {...props} />`,Ht,be,vr,be),Mn[be+Ht]=!0}}return c===s?gr(Q):hr(Q),Q}}function mr(c,m,v){return Un(c,m,v,!0)}function yr(c,m,v){return Un(c,m,v,!1)}var pr=yr,xr=mr;Je.Fragment=s,Je.jsx=pr,Je.jsxs=xr}()),Je}process.env.NODE_ENV==="production"?Zt.exports=jr():Zt.exports=Sr();var r=Zt.exports,A={context:void 0,registry:void 0,getContextId(){return Wn(this.context.count)},getNextContextId(){return Wn(this.context.count++)}};function Wn(e){const t=String(e),n=t.length-1;return A.context.id+(n?String.fromCharCode(96+n):"")+t}function Xe(e){A.context=e}var Cr=(e,t)=>e===t,Nt=Symbol("solid-proxy"),dn=Symbol("solid-track"),Tt={equals:Cr},rs=us,fe=1,At=2,is={owned:null,cleanups:null,context:null,owner:null},Qt={},I=null,Yt=null,Nr=null,B=null,ee=null,ue=null,It=0;function he(e,t){const n=B,s=I,i=e.length===0,a=t===void 0?s:t,o=i?is:{owned:null,cleanups:null,context:a?a.context:null,owner:a},l=i?e:()=>e(()=>J(()=>Lt(o)));I=o,B=null;try{return le(l,!0)}finally{B=n,I=s}}function z(e,t){t=t?Object.assign({},Tt,t):Tt;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=i=>(typeof i=="function"&&(i=i(n.value)),cs(n,i));return[ls.bind(n),s]}function en(e,t,n){const s=Rt(e,t,!0,fe);Ke(s)}function ge(e,t,n){const s=Rt(e,t,!1,fe);Ke(s)}function fn(e,t,n){rs=Mr;const s=Rt(e,t,!1,fe);(!n||!n.render)&&(s.user=!0),ue?ue.push(s):Ke(s)}function ne(e,t,n){n=n?Object.assign({},Tt,n):Tt;const s=Rt(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,Ke(s),ls.bind(s)}function Tr(e){return e&&typeof e=="object"&&"then"in e}function Ar(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,g="initialValue"in a,h=typeof s=="function"&&ne(s);const E=new Set,[S,N]=(a.storage||z)(a.initialValue),[x,w]=z(void 0),[p,b]=z(void 0,{equals:!1}),[O,$]=z(g?"ready":"unresolved");if(A.context){u=A.getNextContextId();let D;a.ssrLoadFrom==="initial"?l=a.initialValue:A.load&&(D=A.load(u))&&(l=D)}function q(D,K,W,ce){return o===D&&(o=null,ce!==void 0&&(g=!0),(D===l||K===l)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(ce,{value:K})),l=Qt,pe(K,W)),K}function pe(D,K){le(()=>{K===void 0&&N(()=>D),$(K!==void 0?"errored":g?"ready":"unresolved"),w(K);for(const W of E.keys())W.decrement();E.clear()},!1)}function xe(){const D=Gr,K=S(),W=x();if(W!==void 0&&!o)throw W;return B&&!B.user&&D&&en(()=>{p(),o&&(D.resolved||E.has(D)||(D.increment(),E.add(D)))}),K}function Y(D=!0){if(D!==!1&&f)return;f=!1;const K=h?h():s;if(K==null||K===!1){q(o,J(S));return}const W=l!==Qt?l:J(()=>i(K,{value:S(),refetching:D}));return Tr(W)?(o=W,"value"in W?(W.status==="success"?q(o,W.value,void 0,K):q(o,void 0,tn(W.value),K),W):(f=!0,queueMicrotask(()=>f=!1),le(()=>{$(g?"refreshing":"pending"),b()},!1),W.then(ce=>q(W,ce,void 0,K),ce=>q(W,void 0,tn(ce),K)))):(q(o,W,void 0,K),W)}return Object.defineProperties(xe,{state:{get:()=>O()},error:{get:()=>x()},loading:{get(){const D=O();return D==="pending"||D==="refreshing"}},latest:{get(){if(!g)return xe();const D=x();if(D&&!o)throw D;return S()}}}),h?en(()=>Y(!1)):Y(!1),[xe,{refetch:Y,mutate:N}]}function kr(e){return le(e,!1)}function J(e){if(B===null)return e();const t=B;B=null;try{return e()}finally{B=t}}function Pr(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=J(()=>t(l,i,o));return i=l,u}}function as(e){fn(()=>J(e))}function Ve(e){return I===null||(I.cleanups===null?I.cleanups=[e]:I.cleanups.push(e)),e}function zn(){return I}function _r(e,t){const n=I,s=B;I=e,B=null;try{return le(t,!0)}catch(i){hn(i)}finally{I=n,B=s}}function Or(e){const t=B,n=I;return Promise.resolve().then(()=>{B=t,I=n;let s;return le(e,!1),B=I=null,s?s.done:void 0})}var[Dr,Xa]=z(!1);function Ir(){return[Dr,Or]}function Rr(e,t){const n=Symbol("context");return{id:n,Provider:Ur(n),defaultValue:e}}function Lr(e){let t;return I&&I.context&&(t=I.context[e.id])!==void 0?t:e.defaultValue}function os(e){const t=ne(e),n=ne(()=>nn(t()));return n.toArray=()=>{const s=n();return Array.isArray(s)?s:s!=null?[s]:[]},n}var Gr;function ls(){if(this.sources&&this.state)if(this.state===fe)Ke(this);else{const e=ee;ee=null,le(()=>Pt(this),!1),ee=e}if(B){const e=this.observers?this.observers.length:0;B.sources?(B.sources.push(this),B.sourceSlots.push(e)):(B.sources=[this],B.sourceSlots=[e]),this.observers?(this.observers.push(B),this.observerSlots.push(B.sources.length-1)):(this.observers=[B],this.observerSlots=[B.sources.length-1])}return this.value}function cs(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&le(()=>{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?ee.push(a):ue.push(a),a.observers&&ds(a)),o||(a.state=fe)}if(ee.length>1e6)throw ee=[],new Error},!1)),t}function Ke(e){if(!e.fn)return;Lt(e);const t=It;Fr(e,e.value,t)}function Fr(e,t,n){let s;const i=I,a=B;B=I=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=fe,e.owned&&e.owned.forEach(Lt),e.owned=null),e.updatedAt=n+1,hn(o)}finally{B=a,I=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?cs(e,s):e.value=s,e.updatedAt=n)}function Rt(e,t,n,s=fe,i){const a={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:I,context:I?I.context:null,pure:n};return I===null||I!==is&&(I.owned?I.owned.push(a):I.owned=[a]),a}function kt(e){if(e.state===0)return;if(e.state===At)return Pt(e);if(e.suspense&&J(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<It);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===fe)Ke(e);else if(e.state===At){const s=ee;ee=null,le(()=>Pt(e,t[0]),!1),ee=s}}function le(e,t){if(ee)return e();let n=!1;t||(ee=[]),ue?n=!0:ue=[],It++;try{const s=e();return Br(n),s}catch(s){n||(ue=null),ee=null,hn(s)}}function Br(e){if(ee&&(us(ee),ee=null),e)return;const t=ue;ue=null,t.length&&le(()=>rs(t),!1)}function us(e){for(let t=0;t<e.length;t++)kt(e[t])}function Mr(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:kt(s)}if(A.context){if(A.count){A.effects||(A.effects=[]),A.effects.push(...e.slice(0,n));return}else A.effects&&(e=[...A.effects,...e],n+=A.effects.length,delete A.effects);Xe()}for(t=0;t<n;t++)kt(e[t])}function Pt(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===fe?s!==t&&(!s.updatedAt||s.updatedAt<It)&&kt(s):i===At&&Pt(s,t)}}}function ds(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=At,n.pure?ee.push(n):ue.push(n),n.observers&&ds(n))}}function Lt(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--)Lt(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=I){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 Ur(e,t){return function(s){let i;return ge(()=>i=J(()=>(I.context={...I.context,[e]:s.value},os(()=>s.children))),void 0),i}}var sn=Symbol("fallback");function _t(e){for(let t=0;t<e.length;t++)e[t]()}function qr(e,t,n={}){let s=[],i=[],a=[],o=0,l=t.length>1?[]:null;return Ve(()=>_t(a)),()=>{let u=e()||[],f=u.length,g,h;return u[dn],J(()=>{let S,N,x,w,p,b,O,$,q;if(f===0)o!==0&&(_t(a),a=[],s=[],i=[],o=0,l&&(l=[])),n.fallback&&(s=[sn],i[0]=he(pe=>(a[0]=pe,n.fallback())),o=1);else if(o===0){for(i=new Array(f),h=0;h<f;h++)s[h]=u[h],i[h]=he(E);o=f}else{for(x=new Array(f),w=new Array(f),l&&(p=new Array(f)),b=0,O=Math.min(o,f);b<O&&s[b]===u[b];b++);for(O=o-1,$=f-1;O>=b&&$>=b&&s[O]===u[$];O--,$--)x[$]=i[O],w[$]=a[O],l&&(p[$]=l[O]);for(S=new Map,N=new Array($+1),h=$;h>=b;h--)q=u[h],g=S.get(q),N[h]=g===void 0?-1:g,S.set(q,h);for(g=b;g<=O;g++)q=s[g],h=S.get(q),h!==void 0&&h!==-1?(x[h]=i[g],w[h]=a[g],l&&(p[h]=l[g]),h=N[h],S.set(q,h)):a[g]();for(h=b;h<f;h++)h in x?(i[h]=x[h],a[h]=w[h],l&&(l[h]=p[h],l[h](h))):i[h]=he(E);i=i.slice(0,o=f),s=u.slice(0)}return i});function E(S){if(a[h]=S,l){const[N,x]=z(h);return l[h]=x,t(u[h],N)}return t(u[h])}}}function Vr(e,t,n={}){let s=[],i=[],a=[],o=[],l=0,u;return Ve(()=>_t(a)),()=>{const f=e()||[],g=f.length;return f[dn],J(()=>{if(g===0)return l!==0&&(_t(a),a=[],s=[],i=[],l=0,o=[]),n.fallback&&(s=[sn],i[0]=he(E=>(a[0]=E,n.fallback())),l=1),i;for(s[0]===sn&&(a[0](),a=[],s=[],i=[],l=0),u=0;u<g;u++)u<s.length&&s[u]!==f[u]?o[u](()=>f[u]):u>=s.length&&(i[u]=he(h));for(;u<s.length;u++)a[u]();return l=o.length=a.length=g,s=f.slice(0),i=i.slice(0,l)});function h(E){a[u]=E;const[S,N]=z(f[u]);return o[u]=N,t(S,u)}}}function gn(e,t){return J(()=>e(t||{}))}function Et(){return!0}var rn={get(e,t,n){return t===Nt?n:e.get(t)},has(e,t){return t===Nt?!0:e.has(t)},set:Et,deleteProperty:Et,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Et,deleteProperty:Et}},ownKeys(e){return e.keys()}};function Jt(e){return(e=typeof e=="function"?e():e)?e:{}}function $r(){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&&Nt in l,e[o]=typeof l=="function"?(t=!0,ne(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 g=u[f];if(g==="__proto__"||g==="constructor")continue;const h=Object.getOwnPropertyDescriptor(l,g);if(!s[g])s[g]=h.get?{enumerable:!0,configurable:!0,get:$r.bind(n[g]=[h.get.bind(l)])}:h.value!==void 0?h:void 0;else{const E=n[g];E&&(h.get?E.push(h.get.bind(l)):h.value!==void 0&&E.push(()=>h.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 fs(e,...t){if(Nt 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 hs(e){let t,n;const s=i=>{const a=A.context;if(a){const[l,u]=z();A.count||(A.count=0),A.count++,(n||(n=e())).then(f=>{Xe(a),A.count--,u(()=>f.default),Xe()}),t=l}else if(!t){const[l]=Ar(()=>(n||(n=e())).then(u=>u.default));t=l}let o;return ne(()=>(o=t())&&J(()=>{if(!a)return o(i);const l=A.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 Kr=0;function Wr(){return A.context?A.getNextContextId():`cl-${Kr++}`}var gs=e=>`Stale read from <${e}>.`;function zr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return ne(qr(()=>e.each,e.children,t||void 0))}function Hr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return ne(Vr(()=>e.each,e.children,t||void 0))}function Qr(e){const t=e.keyed,n=ne(()=>e.when,void 0,{equals:(s,i)=>t?s===i:!s==!i});return ne(()=>{const s=n();if(s){const i=e.children;return typeof i=="function"&&i.length>0?J(()=>i(t?s:()=>{if(!J(n))throw gs("Show");return e.when})):i}return e.fallback},void 0,void 0)}function Yr(e){let t=!1;const n=(a,o)=>(t?a[1]===o[1]:!a[1]==!o[1])&&a[2]===o[2],s=os(()=>e.children),i=ne(()=>{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 ne(()=>{const[a,o,l]=i();if(a<0)return e.fallback;const u=l.children;return typeof u=="function"&&u.length>0?J(()=>u(t?o:()=>{if(J(i)[0]!==a)throw gs("Match");return l.when})):u},void 0,void 0)}function Jr(e){return e}var Xr=["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"],Zr=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...Xr]),ei=new Set(["innerHTML","textContent","innerText","children"]),ti=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ni=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 si(e,t){const n=ni[e];return typeof n=="object"?n[t]?n.$:void 0:n}var ri=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),ii=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"]),ai={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function oi(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 g=a<s?l?n[l-1].nextSibling:n[a-l]:u;for(;l<a;)e.insertBefore(n[l++],g)}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 g=t[--i].nextSibling;e.insertBefore(n[l++],t[o++].nextSibling),e.insertBefore(n[--a],g),t[i]=n[a]}else{if(!f){f=new Map;let h=l;for(;h<a;)f.set(n[h],h++)}const g=f.get(t[o]);if(g!=null)if(l<g&&g<a){let h=o,E=1,S;for(;++h<i&&h<a&&!((S=f.get(t[h]))==null||S!==g+E);)E++;if(E>g-l){const N=t[o];for(;l<g;)e.insertBefore(n[l++],N)}else e.replaceChild(n[l++],t[o++])}else o++;else t[o++].remove()}}}var tt="_$DX_DELEGATE";function ms(e,t,n,s={}){let i;return he(a=>{i=a,t===document?e():Dt(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{i(),t.textContent=""}}function li(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 ys(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,ws))}}function ci(e=window.document){if(e[tt]){for(let t of e[tt].keys())e.removeEventListener(t,ws);delete e[tt]}}function Ot(e,t,n){A.context&&e.isConnected||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function ui(e,t,n,s){A.context&&e.isConnected||(s==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,s))}function ps(e,t){A.context&&e.isConnected||(t==null?e.removeAttribute("class"):e.className=t)}function xs(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 di(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]||(Hn(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||(Hn(e,l,!0),n[l]=u)}return n}function fi(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 vs(e,t={},n,s){const i={};return s||ge(()=>i.children=st(e,t.children,i.children)),ge(()=>typeof t.ref=="function"&&bs(t.ref,e)),ge(()=>hi(e,t,n,!0,i,!0)),i}function bs(e,t,n){return J(()=>e(t,n))}function Dt(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return st(e,t,s,n);ge(i=>st(e,t(),i,n),s)}function hi(e,t,n,s,i={},a=!1){t||(t={});for(const o in i)if(!(o in t)){if(o==="children")continue;i[o]=Qn(e,o,null,i[o],n,a)}for(const o in t){if(o==="children")continue;const l=t[o];i[o]=Qn(e,o,l,i[o],n,a)}}function gi(e){let t,n;return!A.context||!(t=A.registry.get(n=yi()))?e():(A.completed&&A.completed.add(t),A.registry.delete(n),t)}function mi(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Hn(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 Qn(e,t,n,s,i,a){let o,l,u,f,g;if(t==="style")return fi(e,n,s);if(t==="classList")return di(e,n,s);if(n===s)return s;if(t==="ref")a||n(e);else if(t.slice(0,3)==="on:"){const h=t.slice(3);s&&e.removeEventListener(h,s),n&&e.addEventListener(h,n)}else if(t.slice(0,10)==="oncapture:"){const h=t.slice(10);s&&e.removeEventListener(h,s,!0),n&&e.addEventListener(h,n,!0)}else if(t.slice(0,2)==="on"){const h=t.slice(2).toLowerCase(),E=ri.has(h);if(!E&&s){const S=Array.isArray(s)?s[0]:s;e.removeEventListener(h,S)}(E||n)&&(xs(e,h,n,E),E&&ys([h]))}else if(t.slice(0,5)==="attr:")Ot(e,t.slice(5),n);else if((g=t.slice(0,5)==="prop:")||(u=ei.has(t))||!i&&((f=si(t,e.tagName))||(l=Zr.has(t)))||(o=e.nodeName.includes("-"))){if(g)t=t.slice(5),l=!0;else if(A.context&&e.isConnected)return n;t==="class"||t==="className"?ps(e,n):o&&!l&&!u?e[mi(t)]=n:e[f||t]=n}else{const h=i&&t.indexOf(":")>-1&&ai[t.split(":")[0]];h?ui(e,h,t,n):Ot(e,ti[t]||t,n)}return n}function ws(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}}),A.registry&&!A.done&&(A.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=!!A.context&&e.isConnected;if(a){!n&&(n=[...e.childNodes]);let u=[];for(let f=0;f<n.length;f++){const g=n[f];g.nodeType===8&&g.data.slice(0,2)==="!$"?g.remove():u.push(g)}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=Ne(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=Ne(e,n,s)}else{if(o==="function")return ge(()=>{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 ge(()=>n=st(e,u,n,s,!0)),()=>n;if(a){if(!u.length)return n;if(s===void 0)return[...e.childNodes];let g=u[0],h=[g];for(;(g=g.nextSibling)!==s;)h.push(g);return n=h}if(u.length===0){if(n=Ne(e,n,s),l)return n}else f?n.length===0?Yn(e,u,s):oi(e,n,u):(n&&Ne(e),Yn(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=Ne(e,n,s,t);Ne(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 g=String(l);u&&u.nodeType===3&&u.data===g?e.push(u):e.push(document.createTextNode(g))}}return i}function Yn(e,t,n=null){for(let s=0,i=t.length;s<i;s++)e.insertBefore(t[s],n)}function Ne(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 yi(){return A.getNextContextId()}var pi="http://www.w3.org/2000/svg";function Es(e,t=!1){return t?document.createElementNS(pi,e):document.createElement(e)}function xi(e){const{useShadow:t}=e,n=document.createTextNode(""),s=()=>e.mount||document.body,i=zn();let a,o=!!A.context;return fn(()=>{o&&(zn().user=o=!1),a||(a=_r(i,()=>ne(()=>e.children)));const l=s();if(l instanceof HTMLHeadElement){const[u,f]=z(!1),g=()=>f(!0);he(h=>Dt(l,()=>u()?h():a(),null)),Ve(g)}else{const u=Es(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}),Dt(f,a),l.appendChild(u),e.ref&&e.ref(u),Ve(()=>l.removeChild(u))}},void 0,{render:!o}),n}function vi(e){const[t,n]=fs(e,["component"]),s=ne(()=>t.component);return ne(()=>{const i=s();switch(typeof i){case"function":return J(()=>i(n));case"string":const a=ii.has(i),o=A.context?gi():Es(i,a);return vs(o,n,a),o}})}var bi=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()}},js=class{constructor(e){this.generateIdentifier=e,this.kv=new bi}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)}},wi=class extends js{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 Ei(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 ji(e,t){const n=Ei(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 $e(e,t){Object.entries(e).forEach(([n,s])=>t(s,n))}function Ct(e,t){return e.indexOf(t)!==-1}function Jn(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s))return s}}var Si=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return ji(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Ci=e=>Object.prototype.toString.call(e).slice(8,-1),Ss=e=>typeof e>"u",Ni=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,ye=e=>Array.isArray(e),Ti=e=>typeof e=="string",Ai=e=>typeof e=="number"&&!isNaN(e),ki=e=>typeof e=="boolean",Pi=e=>e instanceof RegExp,it=e=>e instanceof Map,at=e=>e instanceof Set,Cs=e=>Ci(e)==="Symbol",_i=e=>e instanceof Date&&!isNaN(e.valueOf()),Oi=e=>e instanceof Error,Xn=e=>typeof e=="number"&&isNaN(e),Di=e=>ki(e)||Ni(e)||Ss(e)||Ai(e)||Ti(e)||Cs(e),Ii=e=>typeof e=="bigint",Ri=e=>e===1/0||e===-1/0,Li=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Gi=e=>e instanceof URL,Ns=e=>e.replace(/\./g,"\\."),Xt=e=>e.map(String).map(Ns).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 oe(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Ts=[oe(Ss,"undefined",()=>null,()=>{}),oe(Ii,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),oe(_i,"Date",e=>e.toISOString(),e=>new Date(e)),oe(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}),oe(Pi,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),oe(at,"set",e=>[...e.values()],e=>new Set(e)),oe(it,"map",e=>[...e.entries()],e=>new Map(e)),oe(e=>Xn(e)||Ri(e),"number",e=>Xn(e)?"NaN":e>0?"Infinity":"-Infinity",Number),oe(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),oe(Gi,"URL",e=>e.toString(),e=>new URL(e))];function Gt(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var As=Gt((e,t)=>Cs(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}),Fi=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),ks=Gt(Li,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=Fi[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function Ps(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var _s=Gt(Ps,(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=Gt((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)}),Bi=[_s,As,Os,ks],Zn=(e,t)=>{const n=Jn(Bi,i=>i.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const s=Jn(Ts,i=>i.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},Ds={};Ts.forEach(e=>{Ds[e.annotation]=e});var Mi=(e,t,n)=>{if(ye(t))switch(t[0]){case"symbol":return As.untransform(e,t,n);case"class":return _s.untransform(e,t,n);case"custom":return Os.untransform(e,t,n);case"typed-array":return ks.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const s=Ds[t];if(!s)throw new Error("Unknown transformation: "+t);return s.untransform(e,n)}},Te=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function Is(e){if(Ct(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Ct(e,"prototype"))throw new Error("prototype is not allowed as a property");if(Ct(e,"constructor"))throw new Error("constructor is not allowed as a property")}var Ui=(e,t)=>{Is(t);for(let n=0;n<t.length;n++){const s=t[n];if(at(e))e=Te(e,+s);else if(it(e)){const i=+s,a=+t[++n]==0?"key":"value",o=Te(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(Is(t),t.length===0)return n(e);let s=e;for(let a=0;a<t.length-1;a++){const o=t[a];if(ye(s)){const l=+o;s=s[l]}else if(rt(s))s=s[o];else if(at(s)){const l=+o;s=Te(s,l)}else if(it(s)){if(a===t.length-2)break;const u=+o,f=+t[++a]==0?"key":"value",g=Te(s,u);switch(f){case"key":s=g;break;case"value":s=s.get(g);break}}}const i=t[t.length-1];if(ye(s)?s[+i]=n(s[+i]):rt(s)&&(s[i]=n(s[i])),at(s)){const a=Te(s,+i),o=n(a);a!==o&&(s.delete(a),s.add(o))}if(it(s)){const a=+t[t.length-2],o=Te(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(!ye(e)){$e(e,(a,o)=>cn(a,t,[...n,...nt(o)]));return}const[s,i]=e;i&&$e(i,(a,o)=>{cn(a,t,[...n,...nt(o)])}),t(s,n)}function qi(e,t,n){return cn(t,(s,i)=>{e=ln(e,i,a=>Mi(a,s,n))}),e}function Vi(e,t){function n(s,i){const a=Ui(e,nt(i));s.map(nt).forEach(o=>{e=ln(e,o,()=>a)})}if(ye(t)){const[s,i]=t;s.forEach(a=>{e=ln(e,nt(a),()=>e)}),i&&$e(i,n)}else $e(t,n);return e}var $i=(e,t)=>rt(e)||ye(e)||it(e)||at(e)||Ps(e,t);function Ki(e,t,n){const s=n.get(e);s?s.push(t):n.set(e,[t])}function Wi(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=Di(e);if(!l){Ki(e,i,t);const S=o.get(e);if(S)return s?{transformedValue:null}:S}if(!$i(e,n)){const S=Zn(e,n),N=S?{transformedValue:S.value,annotations:[S.type]}:{transformedValue:e};return l||o.set(e,N),N}if(Ct(a,e))return{transformedValue:null};const u=Zn(e,n),f=(u==null?void 0:u.value)??e,g=ye(f)?[]:{},h={};$e(f,(S,N)=>{if(N==="__proto__"||N==="constructor"||N==="prototype")throw new Error(`Detected property ${N}. This is a prototype pollution risk, please remove it from your object.`);const x=Rs(S,t,n,s,[...i,N],[...a,e],o);g[N]=x.transformedValue,ye(x.annotations)?h[N]=x.annotations:rt(x.annotations)&&$e(x.annotations,(w,p)=>{h[Ns(N)+"."+p]=w})});const E=on(h)?{transformedValue:g,annotations:u?[u.type]:void 0}:{transformedValue:g,annotations:u?[u.type,h]:h};return l||o.set(e,E),E};function Ls(e){return Object.prototype.toString.call(e).slice(8,-1)}function es(e){return Ls(e)==="Array"}function zi(e){if(Ls(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function Hi(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(es(e))return e.map(i=>un(i,t));if(!zi(e))return e;const n=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...n,...s].reduce((i,a)=>{if(es(t.props)&&!t.props.includes(a))return i;const o=e[a],l=un(o,t);return Hi(i,a,l,e,t.nonenumerable),i},{})}var U=class{constructor({dedupe:e=!1}={}){this.classRegistry=new wi,this.symbolRegistry=new js(t=>t.description??""),this.customTransformerRegistry=new Si,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=Wi(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=qi(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)}};U.defaultInstance=new U;U.serialize=U.defaultInstance.serialize.bind(U.defaultInstance);U.deserialize=U.defaultInstance.deserialize.bind(U.defaultInstance);U.stringify=U.defaultInstance.stringify.bind(U.defaultInstance);U.parse=U.defaultInstance.parse.bind(U.defaultInstance);U.registerClass=U.defaultInstance.registerClass.bind(U.defaultInstance);U.registerSymbol=U.defaultInstance.registerSymbol.bind(U.defaultInstance);U.registerCustom=U.defaultInstance.registerCustom.bind(U.defaultInstance);U.allowErrorProps=U.defaultInstance.allowErrorProps.bind(U.defaultInstance);var Gs=U.serialize,Qi=U.stringify;function Yi(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function Ji(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function Xi({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function Zi({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function ea(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var ta=(e,t=!1)=>{const{json:n}=Gs(e);return JSON.stringify(n,null,t?2:void 0)},jt=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,na=(e,t)=>e.queryHash.localeCompare(t.queryHash),Fs=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,sa=(e,t)=>jt(e)===jt(t)?Fs(e,t):jt(e)>jt(t)?1:-1,ra={status:sa,"query hash":na,"last updated":Fs},St=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,Bs=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,ia=(e,t)=>St(e)===St(t)?Bs(e,t):St(e)>St(t)?1:-1,aa={status:ia,"last updated":Bs},oa=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),la=()=>{const[e,t]=z("dark");return as(()=>{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},Ms=(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)},Ae,ot,lt,ct,we,ut,ke,Pe,_e,Oe,De,Ie,dt,ts,ca=(ts=class{constructor(e){F(this,Ae);F(this,ot);F(this,lt);F(this,ct);F(this,we,!1);F(this,ut);F(this,ke);F(this,Pe);F(this,_e);F(this,Oe);F(this,De);F(this,Ie);F(this,dt);const{client:t,queryFlavor:n,version:s,onlineManager:i,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:f,shadowDOMTarget:g}=e;G(this,Ae,z(t)),G(this,lt,n),G(this,ct,s),G(this,ot,i),G(this,ut,f),G(this,ke,g),G(this,Pe,z(a)),G(this,_e,z(o)),G(this,Oe,z(l)),G(this,De,z(u))}setButtonPosition(e){T(this,Pe)[1](e)}setPosition(e){T(this,_e)[1](e)}setInitialIsOpen(e){T(this,Oe)[1](e)}setErrorTypes(e){T(this,De)[1](e)}setClient(e){T(this,Ae)[1](e)}mount(e){if(T(this,we))throw new Error("Devtools is already mounted");const t=ms(()=>{const n=this,[s]=T(this,Pe),[i]=T(this,_e),[a]=T(this,Oe),[o]=T(this,De),[l]=T(this,Ae);let u;return T(this,Ie)?u=T(this,Ie):(u=hs(()=>Promise.resolve().then(()=>require("./BMGNQTAT-DSWovR3D.cjs"))),G(this,Ie,u)),Ms(T(this,ut),T(this,ke)),gn(u,mn({get queryFlavor(){return T(n,lt)},get version(){return T(n,ct)},get onlineManager(){return T(n,ot)},get shadowDOMTarget(){return T(n,ke)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return i()},get initialIsOpen(){return a()},get errorTypes(){return o()}}))},e);G(this,we,!0),G(this,dt,t)}unmount(){var e;if(!T(this,we))throw new Error("Devtools is not mounted");(e=T(this,dt))==null||e.call(this),G(this,we,!1)}},Ae=new WeakMap,ot=new WeakMap,lt=new WeakMap,ct=new WeakMap,we=new WeakMap,ut=new WeakMap,ke=new WeakMap,Pe=new WeakMap,_e=new WeakMap,Oe=new WeakMap,De=new WeakMap,Ie=new WeakMap,dt=new WeakMap,ts),Re,ft,ht,gt,Ee,mt,Le,Ge,Fe,Be,Me,Ue,qe,yt,ns,ua=(ns=class{constructor(e){F(this,Re);F(this,ft);F(this,ht);F(this,gt);F(this,Ee,!1);F(this,mt);F(this,Le);F(this,Ge);F(this,Fe);F(this,Be);F(this,Me);F(this,Ue);F(this,qe);F(this,yt);const{client:t,queryFlavor:n,version:s,onlineManager:i,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:u,styleNonce:f,shadowDOMTarget:g,onClose:h}=e;G(this,Re,z(t)),G(this,ht,n),G(this,gt,s),G(this,ft,i),G(this,mt,f),G(this,Le,g),G(this,Ge,z(a)),G(this,Fe,z(o)),G(this,Be,z(l)),G(this,Me,z(u)),G(this,Ue,z(h))}setButtonPosition(e){T(this,Ge)[1](e)}setPosition(e){T(this,Fe)[1](e)}setInitialIsOpen(e){T(this,Be)[1](e)}setErrorTypes(e){T(this,Me)[1](e)}setClient(e){T(this,Re)[1](e)}setOnClose(e){T(this,Ue)[1](()=>e)}mount(e){if(T(this,Ee))throw new Error("Devtools is already mounted");const t=ms(()=>{const n=this,[s]=T(this,Ge),[i]=T(this,Fe),[a]=T(this,Be),[o]=T(this,Me),[l]=T(this,Re),[u]=T(this,Ue);let f;return T(this,qe)?f=T(this,qe):(f=hs(()=>Promise.resolve().then(()=>require("./UODQIBEW-CCBz9xzO.cjs"))),G(this,qe,f)),Ms(T(this,mt),T(this,Le)),gn(f,mn({get queryFlavor(){return T(n,ht)},get version(){return T(n,gt)},get onlineManager(){return T(n,ft)},get shadowDOMTarget(){return T(n,Le)}},{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);G(this,Ee,!0),G(this,yt,t)}unmount(){var e;if(!T(this,Ee))throw new Error("Devtools is not mounted");(e=T(this,yt))==null||e.call(this),G(this,Ee,!1)}},Re=new WeakMap,ft=new WeakMap,ht=new WeakMap,gt=new WeakMap,Ee=new WeakMap,mt=new WeakMap,Le=new WeakMap,Ge=new WeakMap,Fe=new WeakMap,Be=new WeakMap,Me=new WeakMap,Ue=new WeakMap,qe=new WeakMap,yt=new WeakMap,ns);function da(e){const t=R.useQueryClient(e.client),n=re.useRef(null),{buttonPosition:s,position:i,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}=e,[f]=re.useState(new ca({client:t,queryFlavor:"React Query",version:"5",onlineManager:R.onlineManager,buttonPosition:s,position:i,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:u}));return re.useEffect(()=>{f.setClient(t)},[t,f]),re.useEffect(()=>{s&&f.setButtonPosition(s)},[s,f]),re.useEffect(()=>{i&&f.setPosition(i)},[i,f]),re.useEffect(()=>{f.setInitialIsOpen(a||!1)},[a,f]),re.useEffect(()=>{f.setErrorTypes(o||[])},[o,f]),re.useEffect(()=>(n.current&&f.mount(n.current),()=>{f.unmount()}),[f]),r.jsx("div",{className:"tsqd-parent-container",ref:n})}function fa(e){const t=R.useQueryClient(e.client),n=re.useRef(null),{errorTypes:s,styleNonce:i,shadowDOMTarget:a}=e,[o]=re.useState(new ua({client:t,queryFlavor:"React Query",version:"5",onlineManager:R.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:s,styleNonce:i,shadowDOMTarget:a,onClose:e.onClose}));return re.useEffect(()=>{o.setClient(t)},[t,o]),re.useEffect(()=>{o.setOnClose(e.onClose??(()=>{}))},[e.onClose,o]),re.useEffect(()=>{o.setErrorTypes(s||[])},[s,o]),re.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 ha=process.env.NODE_ENV!=="development"?function(){return null}:da;process.env.NODE_ENV;const ga=ss.atom({}),Us=()=>ss.useAtom(ga),pt=(e,t)=>{const[n]=Us();return y.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=R.useQueryClient(),{data:t}=R.useQuery({queryKey:[k.AI_CONTEXT],initialData:"",queryFn:()=>""});return{setAiContext:j.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},ma=()=>{const e=X(),{aiContext:t}=yn();return j.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])},ya=()=>{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 de.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]=j.useState(new URLSearchParams(window.location.search));return j.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 R.useQuery({queryKey:[k.GET_PROJECT_PAGES],staleTime:1e3*60*5,queryFn:async()=>Z(e,{action:k.GET_PROJECT_PAGES})||[]})},We=()=>{const[e]=je(),t=e.get("page"),{data:n,isFetching:s}=pn();return{data:j.useMemo(()=>y.find(n,{id:t})||{},[n,t]),isFetching:s}},pa=()=>R.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"}]}),xa=()=>{const[e]=je(),t=e.get("page"),n=X(),{setAiContext:s}=yn();return R.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=y.find(a,{_type:"@chai/ai-context"});return s(y.get(o,"_value","")||""),a},enabled:!!t})},va=e=>j.useMemo(()=>{if(!e||y.isEmpty(e))return{blocks:[],theme:{}};const t=y.find(e,{_type:"@chai/theme"}),n=y.get(t,"_value",{})||{},s=y.filter(e,i=>!y.includes(i==null?void 0:i._type,"@chai/"));return{theme:n,blocks:s}},[e]),qs=()=>{const e=X();return R.useQuery({queryKey:[k.GET_WEBSITE_SETTINGS],initialData:{theme:{},fallbackLang:"en",languages:[]},queryFn:async()=>Z(e,{action:k.GET_WEBSITE_SETTINGS,data:{draft:!0}})})},ba=()=>{const{data:e}=pn(),t=X();return{getGlobalBlocks:async()=>{const n={};for(const s of e??[])y.isEmpty(s==null?void 0:s.slug)&&(n[s.id]={name:y.startCase(s.name??s.slug),description:""});return n},getGlobalBlockBlocks:async n=>n?(await Z(t,{action:"GET_PAGE",data:{id:n,draft:!0}})).blocks:[]}},xn=()=>{const e=X(),[t]=je(),n=t.get("page");return R.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 y.reverse(y.sortBy(s,"primaryPage"))}})},Ft=()=>{const e=X();return R.useQuery({queryKey:[k.GET_COLLECTIONS],initialData:[],queryFn:async()=>Z(e,{action:k.GET_COLLECTIONS})})},wa=()=>{const e=X();return R.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[]}}})},me={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"},Vs=()=>{const e=X(),t=R.useQueryClient(),{toast:n}=d.useToast();return R.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:s.message})}})},vn=()=>{const e=X(),t=R.useQueryClient(),{toast:n}=d.useToast();return R.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})}})},Ea=()=>{const e=X(),t=R.useQueryClient(),{toast:n}=d.useToast();return R.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})}})},ja=()=>{const e=X(),t=R.useQueryClient(),{toast:n}=d.useToast();return R.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})}})},Sa=()=>{const e=X(),{toast:t}=d.useToast(),n=R.useQueryClient(),{data:s}=We();return R.useMutation({mutationFn:async({ids:i,theme:a})=>Z(e,{action:k.PUBLISH_CHANGES,data:{ids:i,theme:a}}),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"})}})},Ca=()=>{const e=X(),{toast:t}=d.useToast(),n=R.useQueryClient();return R.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"})}})},Na=()=>{const{selectedLang:e}=de.useLanguages(),{data:t,isFetching:n}=xn();return{data:j.useMemo(()=>y.find(t,{lang:e||""})||{},[t,e]),isFetching:n}},$s=()=>{const{data:e,isFetching:t}=Na(),n=e==null?void 0:e.seo,[s,i]=j.useState({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n}),a=j.useRef({initial:s,updated:s}),{selectedLang:o,fallbackLang:l,languages:u}=de.useLanguages(),f=o.length?o:l,{mutate:g,isPending:h}=vn(),E=h;j.useEffect(()=>{!t&&n&&i({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...n})},[t,n]);const S=async()=>{g({id:e==null?void 0:e.id,seo:s}),a.current.initial=s,a.current.updated=s},N=()=>{i({...s,ogTitle:s.title,ogDescription:s.description})},x=()=>{i({...s,searchTitle:s.ogTitle,searchDescription:s.ogDescription})},w=p=>{const b={...s,[p.target.name]:p.target.name==="noIndex"||p.target.name==="noFollow"?p.target.checked:p.target.value};i(b),a.current.updated=b};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:["(",y.get(me,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-gray-900 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:w,disabled:E,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:w,disabled:E,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:w,disabled:E,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:w,disabled:E,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:w,disabled:E,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-gray-900 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:N,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:w,disabled:E,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:w,disabled:E,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:w,disabled:E,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-gray-900 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:x,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:w,disabled:E,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:w,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-gray-900 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:w,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:S,disabled:y.isEqual(a.current.initial,s)||E,children:h?"Saving...":"Save"})})]})};$s.displayName="SeoPanel";const Ks=({page:e,onClose:t})=>{const[n,s]=j.useState(e.slug||""),{mutate:i,isPending:a}=Ca(),{data:o}=Ft(),l=y.find(o,{key:e==null?void 0:e.collection}),u=g=>{g.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(M.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:g=>{const h=g.target.value;y.startsWith(h,`/${f}`)&&s(h)},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||!y.startsWith(n,`/${f}`)||y.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}=Ea(),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,{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:y.get(me,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}=ja(),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"})]})]})})},Ta=({langProps:e,onClose:t,languages:n})=>{const{data:s}=We(),[i,a]=j.useState(e.name||""),[o,l]=j.useState(e.edit?e.lang:""),[u,f]=j.useState(e.edit?e.slug:""),{mutate:g,isPending:h}=Vs(),{mutate:E,isPending:S}=vn(),N=(e==null?void 0:e.collection)==="global",x=h||S,w=p=>{p.preventDefault();const b={name:i,lang:o,primaryPage:s==null?void 0:s.id,slug:u,collection:s==null?void 0:s.collection};b.collection=e.collection,e.edit&&(b.id=e==null?void 0:e.id),e.edit?E(b,{onSuccess:t}):g(b,{onSuccess:t})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{className:"sm:max-w-[425px]",children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:e.edit?"Edit language":"Add New language"}),r.jsx(d.DialogDescription,{children:"Enter the details for the language"})]}),r.jsxs("form",{onSubmit:w,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||y.isEmpty(n),onChange:p=>{const b=p.target.value;l(b),!N&&f(`/${b}`)},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?y.get(me,e.lang,e.lang):y.isEmpty(n)?"All available language page is created.":"Choose language"}),y.map(n,p=>r.jsx("option",{value:p,children:y.get(me,p,p)},p))]})]}),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:p=>a(p.target.value),className:"col-span-3",required:!0,placeholder:"Enter page name"})]}),!N&&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:p=>{const b=p.target.value;y.startsWith(b,`/${o}`)&&f(y.toLower(y.trim(b)))},className:"col-span-3",required:!0,pattern:"^/.*",disabled:y.isEmpty(o)||(e==null?void 0:e.edit),title:"Slug must start with /",placeholder:y.isEmpty(o)?"Choose language to add slug":"Enter page slug"})]})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:x||!i||!o||!N&&!y.startsWith(u,`/${o}`),children:x?e.edit?"Updating...":"Adding...":e.edit?"Update":"Add new language"})})]})]})})},Aa=()=>{const[e,t]=j.useState(null),{selectedLang:n,fallbackLang:s,setSelectedLang:i}=de.useLanguages(),{data:a,isFetching:o}=xn(),{data:l}=We(),[u,f]=j.useState(null),[g,h]=j.useState(null),[E,S]=j.useState(null),{data:N}=qs(),x=y.filter(y.get(N,"languages")||["en"],w=>!y.find(a,{lang:w})&&w!==y.get(N,"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"})]}):y.map(a,w=>{const p=w.lang,b=w.slug,O=!w.primaryPage,$=p===n;return r.jsxs(r.Fragment,{children:[r.jsxs("li",{className:`w-full p-2 rounded cursor-pointer flex items-center justify-between ${$?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>i(p),children:[r.jsxs("div",{className:" flex-1 gap-x-3",children:[r.jsxs("div",{className:"text-[13px] flex items-center gap-x-2",children:[y.get(me,O?s:p,p),r.jsx("div",{style:{backgroundColor:w!=null&&w.online?"lightgreen":"lightgray"},className:"rounded-full w-2 h-2 mt-1"})]}),r.jsxs("div",{children:[b&&r.jsxs("div",{className:"text-[11px] text-gray-500",children:["Slug:",r.jsxs("b",{children:[" ",b]})]}),r.jsxs("div",{className:"text-[11px] text-gray-500",children:["Name:",r.jsxs("b",{children:[" ",w.name," "]})]})]})]}),O?r.jsxs("div",{className:"flex items-center text-[11px] text-orange-500 gap-x-1",children:[r.jsx(M.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:q=>q.stopPropagation(),children:r.jsx(d.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:r.jsx(M.MoreVertical,{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:q=>{q.stopPropagation(),t({...w,edit:!0})},children:[r.jsx(M.PencilIcon,{className:"size-3"}),"Edit"]}),(w==null?void 0:w.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.stopPropagation(),h(w)},children:[r.jsx(M.Power,{className:"size-3"}),"Take offline"]}),(w==null?void 0:w.collection)!=="global"&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.stopPropagation(),S(w)},children:[r.jsx(M.Link,{className:"size-3"}),"Change slug"]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.stopPropagation(),f(w)},children:[r.jsx(M.TrashIcon,{className:"size-3"}),"Delete"]})]})]})})]},w.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:y.isEmpty(x),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(Ta,{languages:x,langProps:e,onClose:()=>t(null)}),u&&r.jsx(Ws,{page:u,onClose:()=>f(null)}),g&&r.jsx(zs,{page:g,onClose:()=>h(null)}),E&&r.jsx(Ks,{page:E,onClose:()=>S(null)})]})},ka=()=>{const e=X();return R.useQuery({queryKey:[k.GET_CHANGES],queryFn:async()=>Z(e,{action:k.GET_CHANGES})})};function Pa({onClose:e=()=>console.log("Cancelled")}){const[t,n]=j.useState([]),{data:s,isFetching:i}=ka(),{data:a}=Ft(),o=j.useMemo(()=>y.filter(s,x=>x.collection!=="global"),[s]),l=j.useMemo(()=>y.filter(s,{collection:"global"}),[s]),{mutate:u,isPending:f}=Sa();j.useEffect(()=>{n(y.map(y.filter(s,{online:!0}),"id"))},[s]);const g=t.length===(s==null?void 0:s.length),h=x=>{n(w=>y.includes(w,x)?y.filter(w,p=>p!==x):y.concat(w,x))},E=()=>{n(g?[]:y.map(s,"id"))},S=()=>{u({ids:t,theme:!1},{onSuccess:()=>{e()}})},N=x=>{if(x==="global")return"Global Block";const w=y.find(a,{key:x});return w?w==null?void 0:w.name:x};return r.jsx(d.Dialog,{open:!0,onOpenChange:f?()=>{}:e,children:r.jsxs(d.DialogContent,{className:"max-w-4xl",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 overflow-x-auto -mx-4",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:"max-h-96 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:x=>{x.stopPropagation(),E()},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:"Type"}),r.jsx("th",{scope:"col",className:"px-4 py-3 w-[150px] text-right",children:"Status"})]})}),r.jsx("tbody",{children:y.map([{label:"Updated Pages & Global Blocks",top:"pt-2"},...y.orderBy(y.filter(o,{online:!0}),"collection"),...y.orderBy(y.filter(l,{online:!0}),"collection"),{label:"Offline Pages & Global Blocks",top:"pt-6"},...y.orderBy(y.filter(o,{online:!1}),"collection"),...y.orderBy(y.filter(l,{online:!1}),"collection")],x=>x.label?r.jsx("tr",{children:r.jsxs("td",{colSpan:4,className:`px-6 py-2 text-xs font-medium text-gray-800 relative ${x.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:x.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:y.includes(t,x==null?void 0:x.id),onClick:w=>{w.stopPropagation(),h(x==null?void 0:x.id)},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 cursor-pointer"})," ",x.collection==="global"?r.jsx(M.GlobeIcon,{className:"h-4 w-4"}):r.jsx(M.File,{className:"h-4 w-4"}),x.name,x.slug&&r.jsxs("span",{className:"text-xs text-gray-500",children:["(",x.slug,")"]})]}),r.jsx("td",{className:"px-2",children:N(x==null?void 0:x.collection)}),r.jsx("td",{className:"px-4 text-right",children:y.first(x.changes)||""})]},x==null?void 0:x.id))})]})}),r.jsxs(d.DialogFooter,{className:"mt-10",children:[r.jsx(d.Button,{disabled:f,variant:"outline",onClick:e,children:"Cancel"}),r.jsx(d.Button,{disabled:f||i||y.isEmpty(s),onClick:S,children:f?"Publishing...":"Publish"})]})]})})}const _a=()=>{const e=X();return R.useQuery({queryKey:[k.GET_WEBSITE_DATA],staleTime:1e3*60*5,queryFn:async()=>Z(e,{action:k.GET_WEBSITE_DATA,data:{draft:!0}})})},Oa=()=>{const e=X(),t=R.useQueryClient(),{toast:n}=d.useToast();return R.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})}})};function Da({onClose:e}){const{data:t,isFetching:n}=_a(),{mutateAsync:s,isPending:i}=Oa(),a=pt("settingComponent",null),o=y.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:j.createElement(a,{data:t||{},onSave:i?()=>{}:o,cancel:i?()=>{}:e})})]})}):null}function Bt({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 Ia=()=>{const e=pt("getPreviewUrl",async o=>o),[t,n]=j.useState(""),{data:s,isFetching:i}=We(),a=j.useMemo(()=>s==null?void 0:s.slug,[s==null?void 0:s.slug]);return j.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(Bt,{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(M.Eye,{className:"w-4 h-4"})})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]})},Ra=()=>{const[e,t]=de.useRightPanel();return r.jsxs(r.Fragment,{children:[r.jsx(Bt,{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(M.Palette,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]})},La=()=>{const[e,t]=j.useState(!1),{savePage:n,saveState:s}=de.useSavePage();j.useEffect(()=>{const f=g=>{s==="UNSAVED"&&(g.preventDefault(),g.returnValue=!1)};return s==="UNSAVED"&&window.addEventListener("beforeunload",f),()=>{window.removeEventListener("beforeunload",f)}},[s]);const i=j.useCallback(async()=>{t(!0),await n()},[]);j.useEffect(()=>{s==="SAVED"&&t(!1)},[s]);const a=j.useMemo(()=>{if(s==="SAVED"||s==="UNSAVED")return s;if(s==="SAVING")return e?s:"SAVED"},[e,s]),{buttonIcon:o,buttonClass:l,tooltipContent:u}=j.useMemo(()=>{switch(a){case"UNSAVED":return{tooltipContent:"Save changes",buttonIcon:r.jsx(M.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(M.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(M.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(Bt,{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})})},Ga=()=>{const[e,t]=j.useState(!1),[n,s]=j.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(M.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(M.Send,{className:"w-4 h-4 mr-2"})}),"Publish"]}),e&&r.jsx(Pa,{onClose:()=>t(!1)})]})},Fa=()=>{const e=pt("settingComponent",null),[t,n]=j.useState(!1);return e?r.jsxs(r.Fragment,{children:[r.jsx(Bt,{content:"Website data",children:r.jsx(d.Button,{variant:"ghost",size:"icon",className:"gap-2",onClick:()=>n(!0),children:r.jsx(M.Settings,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"}),t&&r.jsx(Da,{onClose:()=>n(!1)})]}):null};function Ba(){return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Fa,{}),r.jsx(Ia,{}),r.jsx(Ra,{}),r.jsxs(r.Fragment,{children:[r.jsx(La,{}),r.jsx(Ga,{})]})]})}const Ma=({activePage:e,editPage:t,onAddEditPage:n})=>{const[s,i]=j.useState("pages"),{data:a,isFetching:o}=pn(),[l,u]=j.useState(null),[f,g]=j.useState(null),[h,E]=j.useState(null),S=x=>{var b;if(s==="globalBlocks")return N(y.filter(x,O=>!O.slug));const w=y.groupBy(y.filter(x,O=>O.slug),"collection"),p=Object.entries(w).sort(([O],[$])=>O?!$||O.toLowerCase()==="page"?-1:$.toLowerCase()==="page"?1:O.localeCompare($):1);return r.jsx(d.Accordion,{type:"single",collapsible:!0,className:"w-full",defaultValue:((b=p[0])==null?void 0:b[0])||"uncategorized",children:p.map(([O,$])=>r.jsxs(d.AccordionItem,{value:O||"uncategorized",children:[r.jsx(d.AccordionTrigger,{className:"px-2",children:y.startCase(O)||"Uncategorized"}),r.jsx(d.AccordionContent,{className:"bg-white",children:r.jsx("div",{className:"space-y-2",children:N($)})})]},O))})},N=x=>y.orderBy(x,"online","desc").map(p=>r.jsxs(d.Button,{onClick:()=>t(p.id),variant:p.id===e?"default":"ghost",className:"flex justify-between items-start h-auto w-full space-x-2",children:[r.jsxs("div",{className:"flex items-center space-x-2 relative",children:[r.jsx("div",{className:"",children:r.jsx("div",{style:{backgroundColor:p!=null&&p.online?"lightgreen":"lightgray"},className:"rounded-full w-3 h-3"})}),r.jsxs("div",{className:"flex items-center",children:[r.jsxs("span",{children:[p.name??p.slug," "]}),(p==null?void 0:p.slug)&&r.jsxs("span",{className:"text-xs font-light",children:["(",p.slug,")"]})]})]}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,onClick:b=>b.stopPropagation(),children:r.jsx(d.Button,{variant:"ghost",size:"sm",className:`h-8 w-8 p-0 hover:bg-transparent ${p.id===e?" hover:text-gray-200":"bg-transparent "}`,children:r.jsx(M.MoreVertical,{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:b=>{b.stopPropagation(),n({...p,global:s==="globalBlocks"})},children:[r.jsx(M.PencilIcon,{className:"size-3"}),"Edit"]}),(p==null?void 0:p.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:b=>{b.stopPropagation(),g(p)},children:[r.jsx(M.Power,{className:"size-3"}),"Take offline"]}),(p==null?void 0:p.collection)!=="global"&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:b=>{b.stopPropagation(),E(p)},children:[r.jsx(M.Link,{className:"size-3"}),"Change slug"]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:b=>{b.stopPropagation(),u(p)},children:[r.jsx(M.TrashIcon,{className:"size-3"}),"Delete"]})]})]})})]},p.id));return r.jsxs(r.Fragment,{children:[r.jsx("br",{}),r.jsxs(d.Tabs,{value:s,className:"w-full",onValueChange:i,children:[r.jsxs(d.TabsList,{className:"w-full",children:[r.jsx(d.TabsTrigger,{value:"pages",className:"w-full",children:r.jsx("div",{className:"px-4",children:"Pages"})}),r.jsx(d.TabsTrigger,{value:"globalBlocks",className:"w-full",children:r.jsx("div",{className:"px-4",children:"Global Blocks"})})]}),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"})]}):r.jsxs("div",{className:"py-4 space-y-3",children:[r.jsx("div",{className:"w-full flex justify-center",children:r.jsxs(d.Button,{variant:"default",size:"sm",disabled:o,onClick:()=>n({slug:"",name:"",global:s==="globalBlocks"}),className:"mb-4 w-1/2 bg-blue-500 hover:bg-blue-400",children:[r.jsx(M.Plus,{className:"h-4 w-4 mr-2"}),o?"Loading...":`Add ${s==="pages"?"page":"Global Block"}`]})}),r.jsx("div",{className:"pt-0",children:r.jsx("div",{className:"space-y-2",children:o?r.jsx(Ua,{}):S(a)})})]})]}),l&&r.jsx(Ws,{page:l,onClose:()=>u(null)}),f&&r.jsx(zs,{page:f,onClose:()=>g(null)}),h&&r.jsx(Ks,{page:h,onClose:()=>E(null)})]})};function Ua(){return r.jsx("div",{className:"h-32 w-full flex justify-center items-center text-sm animate-pulse",children:"Loading..."})}const qa=({editPage:e,addEditPage:t,setAddEditPage:n})=>{const s=t.id,[i,a]=j.useState(s&&t.name||""),[o,l]=j.useState(s&&t.slug||""),[u,f]=j.useState(s?(t==null?void 0:t.collection)||"":"page"),{data:g=[]}=Ft(),{mutate:h,isPending:E}=Vs(),{mutate:S,isPending:N}=vn(),x=E||N,w=p=>{p.preventDefault(),s?S({name:i,slug:o,id:t.id,collection:t.global?"global":u},{onSuccess:()=>{n(void 0)}}):h({name:i,slug:o,collection:t.global?"global":u},{onSuccess:b=>{e(b.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":y.startCase(u)]}),r.jsxs(d.DialogDescription,{children:["Enter the details for the new"," ",t.global?"Global Block":`${y.startCase(u)}. Slug must start with /`]})]}),r.jsxs("form",{onSubmit:w,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:p=>f(p.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:g.map(p=>r.jsx("option",{value:p.key,children:p.name},p.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:p=>a(p.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:p=>{var b;return l((b=p.target.value)==null?void 0:b.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:x||!i||!t.global&&!o.startsWith("/")||y.isEqual(t.name,i)&&y.isEqual(t.slug,o)&&y.isEqual(t.pageType,u),children:x?s?"Updating...":"Adding...":t.global?`${s?"Update":"Add"} global block`:`${s?"Update":"Add"} Page`})})]})]})})};function Va(e){const{activePage:t,canClose:n,open:s,close:i}=e,[,a]=je(),[o,l]=j.useState(),u=f=>{window.history.pushState({},"",`?page=${f}`),a(new URLSearchParams({page:f})),window.dispatchEvent(new PopStateEvent("popstate")),l(void 0),i()};return r.jsx(d.Sheet,{open:s,onOpenChange:f=>{!f&&n&&i()},children:r.jsxs(d.SheetContent,{side:"left",className:`border-border w-full ${n?"":"sheet-hide-close-btn"}`,children:[r.jsx("div",{children:r.jsx(Ma,{onAddEditPage:f=>l(f),activePage:t,editPage:u})}),o&&r.jsx(qa,{editPage:u,addEditPage:o,setAddEditPage:l})]})})}const $a=()=>{const e=pt("logo",null);return e?r.jsx("div",{className:"w-full max-h-9 overflow-hidden pr-2",children:j.createElement(e,{})}):null},Ka=()=>{const[e]=je(),t=e.get("page"),{data:n,isFetching:s}=We(),[i,a]=j.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(d.Button,{variant:"secondary",className:"flex max-w-[250px] items-center w-full space-x-2 py-1",onClick:()=>a(!0),children:[r.jsx(M.Logs,{className:"h-4 w-4"}),r.jsxs("span",{className:"truncate leading-none",children:["Editing: ",y.get(n,"name")??""]})]},"template-viewer"),r.jsx(Va,{activePage:t||"",canClose:!!t&&!y.isEmpty(n),open:!t||!s&&y.isEmpty(n)||i,close:()=>a(!1)})]})},Wa=()=>{const{fallbackLang:e,languages:t,selectedLang:n,setSelectedLang:s}=de.useLanguages(),i=y.isEmpty(n)?e:n,a=j.useMemo(()=>y.uniq([e,...t]).map(o=>{const l=y.get(me,o);return l?{key:o,value:l}:null}).filter(o=>o&&(o==null?void 0:o.value)),[e,t]);return y.isEmpty(t)&&i===e?null:y.isEmpty(t)&&i!==e?r.jsxs(d.Button,{variant:"ghost",size:"sm",className:"gap-2 hover:bg-transparent",children:[r.jsx(M.LanguagesIcon,{className:"w-4 h-4"}),y.get(me,i,i)]}):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(M.LanguagesIcon,{className:"w-4 h-4"}),y.get(me,i,i),r.jsx(M.ChevronDown,{className:"w-4 h-4"})]})}),r.jsx(d.DropdownMenuContent,{className:"border-border space-y-1",children:y.map(a,o=>r.jsxs(d.DropdownMenuItem,{className:de.mergeClasses("flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",o.key===i&&"!bg-gray-200 text-gray-700"),onClick:()=>s(o.key),children:[r.jsx("div",{children:o.value}),o.key===e&&r.jsxs("small",{className:"text-[9px] flex items-center gap-x-1 text-orange-500 leading-none",children:[r.jsx(M.Star,{fill:"orange",className:"w-2 h-2"}),"Primary"]})]},o.value))})]})};function za(){return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx($a,{}),r.jsx(Ka,{}),r.jsx(Wa,{})]})}wr.loadWebBlocks();const Ha=e=>{const t=j.useRef([]),[n]=je(),s=n.get("page"),{data:i}=We(),{data:a}=pa(),{data:o,isFetching:l}=xa(),{blocks:u}=va(o),{data:f}=qs(),{data:g}=Ft(),{data:h}=xn(),E=ma(),{getUILibraryBlock:S,getUILibraryBlocks:N,onSave:x}=ya(),{getGlobalBlocks:w,getGlobalBlockBlocks:p}=ba(),{aiContext:b,setAiContext:O}=yn(),{mutateAsync:$}=wa();t.current=u;const q=j.useMemo(()=>{const Y={};return e.mediaManagerComponent&&(Y.mediaManagerComponent=e.mediaManagerComponent),Y},[e.mediaManagerComponent]),pe=j.useMemo(()=>Array.isArray(e==null?void 0:e.uiLibraries)?[...a,...e==null?void 0:e.uiLibraries]:a,[a,e==null?void 0:e.uiLibraries]),xe=j.useCallback(async(Y,D)=>await $({collection:Y,query:D}),[$]);return r.jsx(r.Fragment,{children:r.jsx(de.ChaiBuilderEditor,{loading:l,fallbackLang:f.fallbackLang||"en",languages:y.compact(y.map(h,"lang"))||[],brandingOptions:(f==null?void 0:f.theme)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSaveSupport:e.autoSaveSupport||!1,autoSaveInterval:e.autoSaveInterval||15,onError:e.onError||console.error,getGlobalBlockBlocks:p,getGlobalBlocks:w,blocks:u,getUILibraryBlock:S,getUILibraryBlocks:N,uiLibraries:pe,collections:g,searchCollectionItems:xe,saveAiContextCallback:async Y=>{if(!s)return!0;const D=t.current,K={_type:"@chai/ai-context",_value:y.isString(Y)?Y:""},W=[...D,K];return await x({page:s,blocks:W}),O(Y),!0},aiContext:b,askAiCallBack:E,onSave:async({blocks:Y})=>{if(!s)return!0;t.current=Y;const D={_type:"@chai/ai-context",_value:y.isString(b)?b:""},K=[...Y,D];return await x({page:s,blocks:K}),t.current=Y,!0},topBarComponents:{left:[za],right:[Ba]},sideBarComponents:{top:[...(i==null?void 0:i.collection)!=="global"?[{label:"SEO Setting",component:$s,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"})]})})}]:[],...y.isEmpty(f==null?void 0:f.languages)?[]:[{label:`Language ${(i==null?void 0:i.collection)==="global"?"":"page"}`,component:Aa,icon:r.jsx(r.Fragment,{children:r.jsx("svg",{width:"21",height:"21",viewBox:"0 0 21 21",fill:"currentColor",children:r.jsxs("g",{fill:"none","fill-rule":"evenodd",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",children:[r.jsx("path",{d:"M18.5 10.5v-6a2 2 0 0 0-2-2h-6a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2"}),r.jsx("path",{d:"M6.5 8.503h-2a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h.003l6-.01a2 2 0 0 0 1.997-2V14.5"}),r.jsx("path",{d:"M7.5 12.503h-3M9 14l-1 1q-.5.5-2.5 1.5"}),r.jsx("path",{d:"M5.5 12.503q.501 1.75 1.5 2.499c1 .749 1.5.999 2.5 1.498m4-12-3 6m3-6 3 6m-1-2h-4"})]})})})}]]},...q})})},Qa=new R.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),Ya=e=>{const[,t]=Us();return j.useEffect(()=>{t(y.pick(e,["apiUrl","getPreviewUrl","logo","settingComponent"]))},[e,t]),r.jsxs(R.QueryClientProvider,{client:Qa,children:[r.jsx(Ha,{...e}),r.jsx(ha,{})]})};exports.$TRACK=dn;exports.ChaiBuilderForge=Ya;exports.Dynamic=vi;exports.For=zr;exports.Index=Hr;exports.Match=Jr;exports.Portal=xi;exports.Show=Qr;exports.Switch=Yr;exports.addEventListener=xs;exports.batch=kr;exports.className=ps;exports.clearDelegatedEvents=ci;exports.convertRemToPixels=oa;exports.createComponent=gn;exports.createComputed=en;exports.createContext=Rr;exports.createEffect=fn;exports.createMemo=ne;exports.createRenderEffect=ge;exports.createRoot=he;exports.createSignal=z;exports.createUniqueId=Wr;exports.delegateEvents=ys;exports.deleteNestedDataByPath=et;exports.displayValue=ta;exports.getMutationStatusColor=Zi;exports.getPreferredColorScheme=la;exports.getQueryStatusColor=Xi;exports.getQueryStatusColorByLabel=ea;exports.getQueryStatusLabel=Yi;exports.getSidedProp=Ji;exports.insert=Dt;exports.mergeProps=mn;exports.mutationSortFns=aa;exports.on=Pr;exports.onCleanup=Ve;exports.onMount=as;exports.serialize=Gs;exports.setAttribute=Ot;exports.sortFns=ra;exports.splitProps=fs;exports.spread=vs;exports.stringify=Qi;exports.template=li;exports.untrack=J;exports.updateNestedDataByPath=Ze;exports.use=bs;exports.useContext=Lr;exports.useTransition=Ir;
|