@chaibuilder/pages 0.1.0-beta.98 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{B4MFY5CR-CA_Giz3R.js → B4MFY5CR-C8FVXGVL.js} +1 -1
- package/dist/{B4MFY5CR-OlSOhD3x.cjs → B4MFY5CR-D2PxmnMZ.cjs} +1 -1
- package/dist/ChaiBuilderPages-DhytbxWj.js +5887 -0
- package/dist/ChaiBuilderPages-dSYq3SO0.cjs +2 -0
- package/dist/{HO4MOOFI-BSyDOsJM.js → HO4MOOFI-BRNVyDKe.js} +2 -2
- package/dist/{HO4MOOFI-D3zgCfov.cjs → HO4MOOFI-CxJmuEBT.cjs} +1 -1
- package/dist/{HUY7CZI3-BxyFU_Pg.cjs → HUY7CZI3-B1ZKq-An.cjs} +1 -1
- package/dist/{HUY7CZI3-DBRaQ5aR.js → HUY7CZI3-CacgBf03.js} +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -2
- package/dist/pages.css +1 -6
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +8 -0
- package/dist/server.js +78 -54
- package/package.json +35 -9
- package/dist/ChaiBuilderPages-1e6SpM1E.js +0 -6142
- package/dist/ChaiBuilderPages-DlXPx_tF.cjs +0 -31
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";var is=e=>{throw TypeError(e)};var os=(e,t,n)=>t.has(e)||is("Cannot "+n);var U=(e,t,n)=>(os(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?is("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),te=(e,t,n,s)=>(os(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);const j=require("react"),Le=require("@chaibuilder/sdk"),Dr=require("@chaibuilder/sdk/web-blocks"),K=require("@tanstack/react-query"),p=require("lodash-es"),M=require("lucide-react"),js=require("jotai"),Cs=require("@chaibuilder/runtime"),d=require("@chaibuilder/sdk/ui");function Or(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 ge=Or(j);var en={exports:{}},Ct={};/**
|
|
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 ls;function Gr(){if(ls)return Ct;ls=1;var e=j,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function o(l,c,h){var y,g={},S=null,x=null;h!==void 0&&(S=""+h),c.key!==void 0&&(S=""+c.key),c.ref!==void 0&&(x=c.ref);for(y in c)s.call(c,y)&&!i.hasOwnProperty(y)&&(g[y]=c[y]);if(l&&l.defaultProps)for(y in c=l.defaultProps,c)g[y]===void 0&&(g[y]=c[y]);return{$$typeof:t,type:l,key:S,ref:x,props:g,_owner:a.current}}return Ct.Fragment=n,Ct.jsx=o,Ct.jsxs=o,Ct}var Tt={};/**
|
|
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 cs;function Ur(){return cs||(cs=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"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),C=Symbol.iterator,N="@@iterator";function A(u){if(u===null||typeof u!="object")return null;var E=C&&u[C]||u[N];return typeof E=="function"?E:null}var v=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function b(u){{for(var E=arguments.length,T=new Array(E>1?E-1:0),O=1;O<E;O++)T[O-1]=arguments[O];_("error",u,T)}}function _(u,E,T){{var O=v.ReactDebugCurrentFrame,ee=O.getStackAddendum();ee!==""&&(E+="%s",T=T.concat([ee]));var oe=T.map(function(X){return String(X)});oe.unshift("Warning: "+E),Function.prototype.apply.call(console[u],console,oe)}}var V=!1,$=!1,Se=!1,be=!1,q=!1,Y;Y=Symbol.for("react.module.reference");function w(u){return!!(typeof u=="string"||typeof u=="function"||u===s||u===i||q||u===a||u===h||u===y||be||u===x||V||$||Se||typeof u=="object"&&u!==null&&(u.$$typeof===S||u.$$typeof===g||u.$$typeof===o||u.$$typeof===l||u.$$typeof===c||u.$$typeof===Y||u.getModuleId!==void 0))}function P(u,E,T){var O=u.displayName;if(O)return O;var ee=E.displayName||E.name||"";return ee!==""?T+"("+ee+")":T}function ce(u){return u.displayName||"Context"}function ue(u){if(u==null)return null;if(typeof u.tag=="number"&&b("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case s:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case h:return"Suspense";case y:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case l:var E=u;return ce(E)+".Consumer";case o:var T=u;return ce(T._context)+".Provider";case c:return P(u,u.render,"ForwardRef");case g:var O=u.displayName||null;return O!==null?O:ue(u.type)||"Memo";case S:{var ee=u,oe=ee._payload,X=ee._init;try{return ue(X(oe))}catch{return null}}}return null}var je=Object.assign,De=0,He,Me,Qt,Yt,m,f,k;function L(){}L.__reactDisabledLog=!0;function B(){{if(De===0){He=console.log,Me=console.info,Qt=console.warn,Yt=console.error,m=console.group,f=console.groupCollapsed,k=console.groupEnd;var u={configurable:!0,enumerable:!0,value:L,writable:!0};Object.defineProperties(console,{info:u,log:u,warn:u,error:u,group:u,groupCollapsed:u,groupEnd:u})}De++}}function H(){{if(De--,De===0){var u={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:je({},u,{value:He}),info:je({},u,{value:Me}),warn:je({},u,{value:Qt}),error:je({},u,{value:Yt}),group:je({},u,{value:m}),groupCollapsed:je({},u,{value:f}),groupEnd:je({},u,{value:k})})}De<0&&b("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var W=v.ReactCurrentDispatcher,I;function F(u,E,T){{if(I===void 0)try{throw Error()}catch(ee){var O=ee.stack.trim().match(/\n( *(at )?)/);I=O&&O[1]||""}return`
|
|
18
|
-
`+I+u}}var Z=!1,ae;{var ie=typeof WeakMap=="function"?WeakMap:Map;ae=new ie}function le(u,E){if(!u||Z)return"";{var T=ae.get(u);if(T!==void 0)return T}var O;Z=!0;var ee=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var oe;oe=W.current,W.current=null,B();try{if(E){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(Ne){O=Ne}Reflect.construct(u,[],X)}else{try{X.call()}catch(Ne){O=Ne}u.call(X.prototype)}}else{try{throw Error()}catch(Ne){O=Ne}u()}}catch(Ne){if(Ne&&O&&typeof Ne.stack=="string"){for(var z=Ne.stack.split(`
|
|
19
|
-
`),Ce=O.stack.split(`
|
|
20
|
-
`),me=z.length-1,ye=Ce.length-1;me>=1&&ye>=0&&z[me]!==Ce[ye];)ye--;for(;me>=1&&ye>=0;me--,ye--)if(z[me]!==Ce[ye]){if(me!==1||ye!==1)do if(me--,ye--,ye<0||z[me]!==Ce[ye]){var Ie=`
|
|
21
|
-
`+z[me].replace(" at new "," at ");return u.displayName&&Ie.includes("<anonymous>")&&(Ie=Ie.replace("<anonymous>",u.displayName)),typeof u=="function"&&ae.set(u,Ie),Ie}while(me>=1&&ye>=0);break}}}finally{Z=!1,W.current=oe,H(),Error.prepareStackTrace=ee}var Ze=u?u.displayName||u.name:"",ze=Ze?F(Ze):"";return typeof u=="function"&&ae.set(u,ze),ze}function pe(u,E,T){return le(u,!1)}function Q(u){var E=u.prototype;return!!(E&&E.isReactComponent)}function xe(u,E,T){if(u==null)return"";if(typeof u=="function")return le(u,Q(u));if(typeof u=="string")return F(u);switch(u){case h:return F("Suspense");case y:return F("SuspenseList")}if(typeof u=="object")switch(u.$$typeof){case c:return pe(u.render);case g:return xe(u.type,E,T);case S:{var O=u,ee=O._payload,oe=O._init;try{return xe(oe(ee),E,T)}catch{}}}return""}var Ee=Object.prototype.hasOwnProperty,Ae={},_e=v.ReactDebugCurrentFrame;function Pe(u){if(u){var E=u._owner,T=xe(u.type,u._source,E?E.type:null);_e.setExtraStackFrame(T)}else _e.setExtraStackFrame(null)}function ke(u,E,T,O,ee){{var oe=Function.call.bind(Ee);for(var X in u)if(oe(u,X)){var z=void 0;try{if(typeof u[X]!="function"){var Ce=Error((O||"React class")+": "+T+" type `"+X+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof u[X]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Ce.name="Invariant Violation",Ce}z=u[X](E,X,O,T,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(me){z=me}z&&!(z instanceof Error)&&(Pe(ee),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).",O||"React class",T,X,typeof z),Pe(null)),z instanceof Error&&!(z.message in Ae)&&(Ae[z.message]=!0,Pe(ee),b("Failed %s type: %s",T,z.message),Pe(null))}}}var xn=Array.isArray;function bt(u){return xn(u)}function vn(u){{var E=typeof Symbol=="function"&&Symbol.toStringTag,T=E&&u[Symbol.toStringTag]||u.constructor.name||"Object";return T}}function Xt(u){try{return Jt(u),!1}catch{return!0}}function Jt(u){return""+u}function Et(u){if(Xt(u))return b("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",vn(u)),Jt(u)}var Zt=v.ReactCurrentOwner,bn={key:!0,ref:!0,__self:!0,__source:!0},St,wt;function jt(u){if(Ee.call(u,"ref")){var E=Object.getOwnPropertyDescriptor(u,"ref").get;if(E&&E.isReactWarning)return!1}return u.ref!==void 0}function En(u){if(Ee.call(u,"key")){var E=Object.getOwnPropertyDescriptor(u,"key").get;if(E&&E.isReactWarning)return!1}return u.key!==void 0}function Sn(u,E){typeof u.ref=="string"&&Zt.current}function br(u,E){{var T=function(){St||(St=!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)",E))};T.isReactWarning=!0,Object.defineProperty(u,"key",{get:T,configurable:!0})}}function Er(u,E){{var T=function(){wt||(wt=!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)",E))};T.isReactWarning=!0,Object.defineProperty(u,"ref",{get:T,configurable:!0})}}var Sr=function(u,E,T,O,ee,oe,X){var z={$$typeof:t,type:u,key:E,ref:T,props:X,_owner:oe};return z._store={},Object.defineProperty(z._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(z,"_self",{configurable:!1,enumerable:!1,writable:!1,value:O}),Object.defineProperty(z,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ee}),Object.freeze&&(Object.freeze(z.props),Object.freeze(z)),z};function wr(u,E,T,O,ee){{var oe,X={},z=null,Ce=null;T!==void 0&&(Et(T),z=""+T),En(E)&&(Et(E.key),z=""+E.key),jt(E)&&(Ce=E.ref,Sn(E,ee));for(oe in E)Ee.call(E,oe)&&!bn.hasOwnProperty(oe)&&(X[oe]=E[oe]);if(u&&u.defaultProps){var me=u.defaultProps;for(oe in me)X[oe]===void 0&&(X[oe]=me[oe])}if(z||Ce){var ye=typeof u=="function"?u.displayName||u.name||"Unknown":u;z&&br(X,ye),Ce&&Er(X,ye)}return Sr(u,z,Ce,ee,O,Zt.current,X)}}var wn=v.ReactCurrentOwner,Zn=v.ReactDebugCurrentFrame;function Je(u){if(u){var E=u._owner,T=xe(u.type,u._source,E?E.type:null);Zn.setExtraStackFrame(T)}else Zn.setExtraStackFrame(null)}var jn;jn=!1;function Cn(u){return typeof u=="object"&&u!==null&&u.$$typeof===t}function es(){{if(wn.current){var u=ue(wn.current.type);if(u)return`
|
|
22
|
-
|
|
23
|
-
Check the render method of \``+u+"`."}return""}}function jr(u){return""}var ts={};function Cr(u){{var E=es();if(!E){var T=typeof u=="string"?u:u.displayName||u.name;T&&(E=`
|
|
24
|
-
|
|
25
|
-
Check the top-level render call using <`+T+">.")}return E}}function ns(u,E){{if(!u._store||u._store.validated||u.key!=null)return;u._store.validated=!0;var T=Cr(E);if(ts[T])return;ts[T]=!0;var O="";u&&u._owner&&u._owner!==wn.current&&(O=" It was passed a child from "+ue(u._owner.type)+"."),Je(u),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',T,O),Je(null)}}function ss(u,E){{if(typeof u!="object")return;if(bt(u))for(var T=0;T<u.length;T++){var O=u[T];Cn(O)&&ns(O,E)}else if(Cn(u))u._store&&(u._store.validated=!0);else if(u){var ee=A(u);if(typeof ee=="function"&&ee!==u.entries)for(var oe=ee.call(u),X;!(X=oe.next()).done;)Cn(X.value)&&ns(X.value,E)}}}function Tr(u){{var E=u.type;if(E==null||typeof E=="string")return;var T;if(typeof E=="function")T=E.propTypes;else if(typeof E=="object"&&(E.$$typeof===c||E.$$typeof===g))T=E.propTypes;else return;if(T){var O=ue(E);ke(T,u.props,"prop",O,u)}else if(E.PropTypes!==void 0&&!jn){jn=!0;var ee=ue(E);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ee||"Unknown")}typeof E.getDefaultProps=="function"&&!E.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ar(u){{for(var E=Object.keys(u.props),T=0;T<E.length;T++){var O=E[T];if(O!=="children"&&O!=="key"){Je(u),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",O),Je(null);break}}u.ref!==null&&(Je(u),b("Invalid attribute `ref` supplied to `React.Fragment`."),Je(null))}}var rs={};function as(u,E,T,O,ee,oe){{var X=w(u);if(!X){var z="";(u===void 0||typeof u=="object"&&u!==null&&Object.keys(u).length===0)&&(z+=" 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 Ce=jr();Ce?z+=Ce:z+=es();var me;u===null?me="null":bt(u)?me="array":u!==void 0&&u.$$typeof===t?(me="<"+(ue(u.type)||"Unknown")+" />",z=" Did you accidentally export a JSX literal instead of a component?"):me=typeof u,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",me,z)}var ye=wr(u,E,T,ee,oe);if(ye==null)return ye;if(X){var Ie=E.children;if(Ie!==void 0)if(O)if(bt(Ie)){for(var Ze=0;Ze<Ie.length;Ze++)ss(Ie[Ze],u);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 ss(Ie,u)}if(Ee.call(E,"key")){var ze=ue(u),Ne=Object.keys(E).filter(function(Lr){return Lr!=="key"}),Tn=Ne.length>0?"{key: someKey, "+Ne.join(": ..., ")+": ...}":"{key: someKey}";if(!rs[ze+Tn]){var Ir=Ne.length>0?"{"+Ne.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} />`,Tn,ze,Ir,ze),rs[ze+Tn]=!0}}return u===s?Ar(ye):Tr(ye),ye}}function Nr(u,E,T){return as(u,E,T,!0)}function _r(u,E,T){return as(u,E,T,!1)}var Pr=_r,kr=Nr;Tt.Fragment=s,Tt.jsx=Pr,Tt.jsxs=kr}()),Tt}var us;function Rr(){return us||(us=1,process.env.NODE_ENV==="production"?en.exports=Gr():en.exports=Ur()),en.exports}var r=Rr(),R={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return ds(this.context.count)},getNextContextId(){return ds(this.context.count++)}};function ds(e){const t=String(e),n=t.length-1;return R.context.id+(n?String.fromCharCode(96+n):"")+t}function At(e){R.context=e}var Mr=(e,t)=>e===t,an=Symbol("solid-proxy"),Ts=typeof Proxy=="function",qn=Symbol("solid-track"),on={equals:Mr},As=Ds,qe=1,ln=2,Ns={owned:null,cleanups:null,context:null,owner:null},An={},J=null,Nn=null,Br=null,se=null,we=null,Be=null,mn=0;function We(e,t){const n=se,s=J,a=e.length===0,i=t===void 0?s:t,o=a?Ns:{owned:null,cleanups:null,context:i?i.context:null,owner:i},l=a?e:()=>e(()=>ve(()=>It(o)));J=o,se=null;try{return Ue(l,!0)}finally{se=n,J=s}}function de(e,t){t=t?Object.assign({},on,t):on;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=a=>(typeof a=="function"&&(a=a(n.value)),Ls(n,a));return[Is.bind(n),s]}function _s(e,t,n){const s=gn(e,t,!0,qe);vt(s)}function $e(e,t,n){const s=gn(e,t,!1,qe);vt(s)}function Hn(e,t,n){As=ea;const s=gn(e,t,!1,qe);(!n||!n.render)&&(s.user=!0),Be?Be.push(s):vt(s)}function Te(e,t,n){n=n?Object.assign({},on,n):on;const s=gn(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,vt(s),Is.bind(s)}function Fr(e){return e&&typeof e=="object"&&"then"in e}function qr(e,t,n){let s,a,i;arguments.length===1?(s=!0,a=e,i={}):(s=e,a=t,i={});let o=null,l=An,c=null,h=!1,y="initialValue"in i,g=typeof s=="function"&&Te(s);const S=new Set,[x,C]=(i.storage||de)(i.initialValue),[N,A]=de(void 0),[v,b]=de(void 0,{equals:!1}),[_,V]=de(y?"ready":"unresolved");R.context&&(c=R.getNextContextId(),i.ssrLoadFrom==="initial"?l=i.initialValue:R.load&&R.has(c)&&(l=R.load(c)));function $(Y,w,P,ce){return o===Y&&(o=null,ce!==void 0&&(y=!0),(Y===l||w===l)&&i.onHydrated&&queueMicrotask(()=>i.onHydrated(ce,{value:w})),l=An,Se(w,P)),w}function Se(Y,w){Ue(()=>{w===void 0&&C(()=>Y),V(w!==void 0?"errored":y?"ready":"unresolved"),A(w);for(const P of S.keys())P.decrement();S.clear()},!1)}function be(){const Y=Xr,w=x(),P=N();if(P!==void 0&&!o)throw P;return se&&se.user,w}function q(Y=!0){if(Y!==!1&&h)return;h=!1;const w=g?g():s;if(w==null||w===!1){$(o,ve(x));return}const P=l!==An?l:ve(()=>a(w,{value:x(),refetching:Y}));return Fr(P)?(o=P,"value"in P?(P.status==="success"?$(o,P.value,void 0,w):$(o,void 0,In(P.value),w),P):(h=!0,queueMicrotask(()=>h=!1),Ue(()=>{V(y?"refreshing":"pending"),b()},!1),P.then(ce=>$(P,ce,void 0,w),ce=>$(P,void 0,In(ce),w)))):($(o,P,void 0,w),P)}return Object.defineProperties(be,{state:{get:()=>_()},error:{get:()=>N()},loading:{get(){const Y=_();return Y==="pending"||Y==="refreshing"}},latest:{get(){if(!y)return be();const Y=N();if(Y&&!o)throw Y;return x()}}}),g?_s(()=>q(!1)):q(!1),[be,{refetch:q,mutate:C}]}function Hr(e){return Ue(e,!1)}function ve(e){if(se===null)return e();const t=se;se=null;try{return e()}finally{se=t}}function Wr(e,t,n){const s=Array.isArray(e);let a,i=n&&n.defer;return o=>{let l;if(s){l=Array(e.length);for(let h=0;h<e.length;h++)l[h]=e[h]()}else l=e();if(i)return i=!1,o;const c=ve(()=>t(l,a,o));return a=l,c}}function Ps(e){Hn(()=>ve(e))}function pt(e){return J===null||(J.cleanups===null?J.cleanups=[e]:J.cleanups.push(e)),e}function fs(){return J}function $r(e,t){const n=J,s=se;J=e,se=null;try{return Ue(t,!0)}catch(a){Wn(a)}finally{J=n,se=s}}function Vr(e){const t=se,n=J;return Promise.resolve().then(()=>{se=t,J=n;let s;return Ue(e,!1),se=J=null,s?s.done:void 0})}var[Kr,Eo]=de(!1);function zr(){return[Kr,Vr]}function Qr(e,t){const n=Symbol("context");return{id:n,Provider:ta(n),defaultValue:e}}function Yr(e){let t;return J&&J.context&&(t=J.context[e.id])!==void 0?t:e.defaultValue}function ks(e){const t=Te(e),n=Te(()=>Ln(t()));return n.toArray=()=>{const s=n();return Array.isArray(s)?s:s!=null?[s]:[]},n}var Xr;function Is(){if(this.sources&&this.state)if(this.state===qe)vt(this);else{const e=we;we=null,Ue(()=>un(this),!1),we=e}if(se){const e=this.observers?this.observers.length:0;se.sources?(se.sources.push(this),se.sourceSlots.push(e)):(se.sources=[this],se.sourceSlots=[e]),this.observers?(this.observers.push(se),this.observerSlots.push(se.sources.length-1)):(this.observers=[se],this.observerSlots=[se.sources.length-1])}return this.value}function Ls(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&Ue(()=>{for(let a=0;a<e.observers.length;a+=1){const i=e.observers[a],o=Nn&&Nn.running;o&&Nn.disposed.has(i),(o?!i.tState:!i.state)&&(i.pure?we.push(i):Be.push(i),i.observers&&Os(i)),o||(i.state=qe)}if(we.length>1e6)throw we=[],new Error},!1)),t}function vt(e){if(!e.fn)return;It(e);const t=mn;Jr(e,e.value,t)}function Jr(e,t,n){let s;const a=J,i=se;se=J=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=qe,e.owned&&e.owned.forEach(It),e.owned=null),e.updatedAt=n+1,Wn(o)}finally{se=i,J=a}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Ls(e,s):e.value=s,e.updatedAt=n)}function gn(e,t,n,s=qe,a){const i={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:J,context:J?J.context:null,pure:n};return J===null||J!==Ns&&(J.owned?J.owned.push(i):J.owned=[i]),i}function cn(e){if(e.state===0)return;if(e.state===ln)return un(e);if(e.suspense&&ve(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<mn);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===qe)vt(e);else if(e.state===ln){const s=we;we=null,Ue(()=>un(e,t[0]),!1),we=s}}function Ue(e,t){if(we)return e();let n=!1;t||(we=[]),Be?n=!0:Be=[],mn++;try{const s=e();return Zr(n),s}catch(s){n||(Be=null),we=null,Wn(s)}}function Zr(e){if(we&&(Ds(we),we=null),e)return;const t=Be;Be=null,t.length&&Ue(()=>As(t),!1)}function Ds(e){for(let t=0;t<e.length;t++)cn(e[t])}function ea(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:cn(s)}if(R.context){if(R.count){R.effects||(R.effects=[]),R.effects.push(...e.slice(0,n));return}At()}for(R.effects&&(R.done||!R.count)&&(e=[...R.effects,...e],n+=R.effects.length,delete R.effects),t=0;t<n;t++)cn(e[t])}function un(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const a=s.state;a===qe?s!==t&&(!s.updatedAt||s.updatedAt<mn)&&cn(s):a===ln&&un(s,t)}}}function Os(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=ln,n.pure?we.push(n):Be.push(n),n.observers&&Os(n))}}function It(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),s=e.sourceSlots.pop(),a=n.observers;if(a&&a.length){const i=a.pop(),o=n.observerSlots.pop();s<a.length&&(i.sourceSlots[o]=s,a[s]=i,n.observerSlots[s]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)It(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)It(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 In(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Wn(e,t=J){throw In(e)}function Ln(e){if(typeof e=="function"&&!e.length)return Ln(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const s=Ln(e[n]);Array.isArray(s)?t.push.apply(t,s):t.push(s)}return t}return e}function ta(e,t){return function(s){let a;return $e(()=>a=ve(()=>(J.context={...J.context,[e]:s.value},ks(()=>s.children))),void 0),a}}var Dn=Symbol("fallback");function dn(e){for(let t=0;t<e.length;t++)e[t]()}function na(e,t,n={}){let s=[],a=[],i=[],o=0,l=t.length>1?[]:null;return pt(()=>dn(i)),()=>{let c=e()||[],h=c.length,y,g;return c[qn],ve(()=>{let x,C,N,A,v,b,_,V,$;if(h===0)o!==0&&(dn(i),i=[],s=[],a=[],o=0,l&&(l=[])),n.fallback&&(s=[Dn],a[0]=We(Se=>(i[0]=Se,n.fallback())),o=1);else if(o===0){for(a=new Array(h),g=0;g<h;g++)s[g]=c[g],a[g]=We(S);o=h}else{for(N=new Array(h),A=new Array(h),l&&(v=new Array(h)),b=0,_=Math.min(o,h);b<_&&s[b]===c[b];b++);for(_=o-1,V=h-1;_>=b&&V>=b&&s[_]===c[V];_--,V--)N[V]=a[_],A[V]=i[_],l&&(v[V]=l[_]);for(x=new Map,C=new Array(V+1),g=V;g>=b;g--)$=c[g],y=x.get($),C[g]=y===void 0?-1:y,x.set($,g);for(y=b;y<=_;y++)$=s[y],g=x.get($),g!==void 0&&g!==-1?(N[g]=a[y],A[g]=i[y],l&&(v[g]=l[y]),g=C[g],x.set($,g)):i[y]();for(g=b;g<h;g++)g in N?(a[g]=N[g],i[g]=A[g],l&&(l[g]=v[g],l[g](g))):a[g]=We(S);a=a.slice(0,o=h),s=c.slice(0)}return a});function S(x){if(i[g]=x,l){const[C,N]=de(g);return l[g]=N,t(c[g],C)}return t(c[g])}}}function sa(e,t,n={}){let s=[],a=[],i=[],o=[],l=0,c;return pt(()=>dn(i)),()=>{const h=e()||[],y=h.length;return h[qn],ve(()=>{if(y===0)return l!==0&&(dn(i),i=[],s=[],a=[],l=0,o=[]),n.fallback&&(s=[Dn],a[0]=We(S=>(i[0]=S,n.fallback())),l=1),a;for(s[0]===Dn&&(i[0](),i=[],s=[],a=[],l=0),c=0;c<y;c++)c<s.length&&s[c]!==h[c]?o[c](()=>h[c]):c>=s.length&&(a[c]=We(g));for(;c<s.length;c++)i[c]();return l=o.length=i.length=y,s=h.slice(0),a=a.slice(0,l)});function g(S){i[c]=S;const[x,C]=de(h[c]);return o[c]=C,t(x,c)}}}function $n(e,t){return ve(()=>e(t||{}))}function tn(){return!0}var On={get(e,t,n){return t===an?n:e.get(t)},has(e,t){return t===an?!0:e.has(t)},set:tn,deleteProperty:tn,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:tn,deleteProperty:tn}},ownKeys(e){return e.keys()}};function _n(e){return(e=typeof e=="function"?e():e)?e:{}}function ra(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function Vn(...e){let t=!1;for(let o=0;o<e.length;o++){const l=e[o];t=t||!!l&&an in l,e[o]=typeof l=="function"?(t=!0,Te(l)):l}if(Ts&&t)return new Proxy({get(o){for(let l=e.length-1;l>=0;l--){const c=_n(e[l])[o];if(c!==void 0)return c}},has(o){for(let l=e.length-1;l>=0;l--)if(o in _n(e[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<e.length;l++)o.push(...Object.keys(_n(e[l])));return[...new Set(o)]}},On);const n={},s=Object.create(null);for(let o=e.length-1;o>=0;o--){const l=e[o];if(!l)continue;const c=Object.getOwnPropertyNames(l);for(let h=c.length-1;h>=0;h--){const y=c[h];if(y==="__proto__"||y==="constructor")continue;const g=Object.getOwnPropertyDescriptor(l,y);if(!s[y])s[y]=g.get?{enumerable:!0,configurable:!0,get:ra.bind(n[y]=[g.get.bind(l)])}:g.value!==void 0?g:void 0;else{const S=n[y];S&&(g.get?S.push(g.get.bind(l)):g.value!==void 0&&S.push(()=>g.value))}}}const a={},i=Object.keys(s);for(let o=i.length-1;o>=0;o--){const l=i[o],c=s[l];c&&c.get?Object.defineProperty(a,l,c):a[l]=c?c.value:void 0}return a}function Gs(e,...t){if(Ts&&an in e){const a=new Set(t.length>1?t.flat():t[0]),i=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)}},On));return i.push(new Proxy({get(o){return a.has(o)?void 0:e[o]},has(o){return a.has(o)?!1:o in e},keys(){return Object.keys(e).filter(o=>!a.has(o))}},On)),i}const n={},s=t.map(()=>({}));for(const a of Object.getOwnPropertyNames(e)){const i=Object.getOwnPropertyDescriptor(e,a),o=!i.get&&!i.set&&i.enumerable&&i.writable&&i.configurable;let l=!1,c=0;for(const h of t)h.includes(a)&&(l=!0,o?s[c][a]=i.value:Object.defineProperty(s[c],a,i)),++c;l||(o?n[a]=i.value:Object.defineProperty(n,a,i))}return[...s,n]}function Us(e){let t,n;const s=a=>{const i=R.context;if(i){const[l,c]=de();R.count||(R.count=0),R.count++,(n||(n=e())).then(h=>{!R.done&&At(i),R.count--,c(()=>h.default),At()}),t=l}else if(!t){const[l]=qr(()=>(n||(n=e())).then(c=>c.default));t=l}let o;return Te(()=>(o=t())?ve(()=>{if(!i||R.done)return o(a);const l=R.context;At(i);const c=o(a);return At(l),c}):"")};return s.preload=()=>n||((n=e()).then(a=>t=()=>a.default),n),s}var aa=0;function ia(){return R.context?R.getNextContextId():`cl-${aa++}`}var Rs=e=>`Stale read from <${e}>.`;function oa(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Te(na(()=>e.each,e.children,t||void 0))}function la(e){const t="fallback"in e&&{fallback:()=>e.fallback};return Te(sa(()=>e.each,e.children,t||void 0))}function ca(e){const t=e.keyed,n=Te(()=>e.when,void 0,{equals:(s,a)=>t?s===a:!s==!a});return Te(()=>{const s=n();if(s){const a=e.children;return typeof a=="function"&&a.length>0?ve(()=>a(t?s:()=>{if(!ve(n))throw Rs("Show");return e.when})):a}return e.fallback},void 0,void 0)}function ua(e){let t=!1;const n=(i,o)=>(t?i[1]===o[1]:!i[1]==!o[1])&&i[2]===o[2],s=ks(()=>e.children),a=Te(()=>{let i=s();Array.isArray(i)||(i=[i]);for(let o=0;o<i.length;o++){const l=i[o].when;if(l)return t=!!i[o].keyed,[o,l,i[o]]}return[-1]},void 0,{equals:n});return Te(()=>{const[i,o,l]=a();if(i<0)return e.fallback;const c=l.children;return typeof c=="function"&&c.length>0?ve(()=>c(t?o:()=>{if(ve(a)[0]!==i)throw Rs("Match");return l.when})):c},void 0,void 0)}function da(e){return e}var fa=["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"],ha=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...fa]),ma=new Set(["innerHTML","textContent","innerText","children"]),ga=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),ya=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 pa(e,t){const n=ya[e];return typeof n=="object"?n[t]?n.$:void 0:n}var xa=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),va=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"]),ba={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function Ea(e,t,n){let s=n.length,a=t.length,i=s,o=0,l=0,c=t[a-1].nextSibling,h=null;for(;o<a||l<i;){if(t[o]===n[l]){o++,l++;continue}for(;t[a-1]===n[i-1];)a--,i--;if(a===o){const y=i<s?l?n[l-1].nextSibling:n[i-l]:c;for(;l<i;)e.insertBefore(n[l++],y)}else if(i===l)for(;o<a;)(!h||!h.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[i-1]&&n[l]===t[a-1]){const y=t[--a].nextSibling;e.insertBefore(n[l++],t[o++].nextSibling),e.insertBefore(n[--i],y),t[a]=n[i]}else{if(!h){h=new Map;let g=l;for(;g<i;)h.set(n[g],g++)}const y=h.get(t[o]);if(y!=null)if(l<y&&y<i){let g=o,S=1,x;for(;++g<a&&g<i&&!((x=h.get(t[g]))==null||x!==y+S);)S++;if(S>y-l){const C=t[o];for(;l<y;)e.insertBefore(n[l++],C)}else e.replaceChild(n[l++],t[o++])}else o++;else t[o++].remove()}}}var Pt="_$DX_DELEGATE";function Ms(e,t,n,s={}){let a;return We(i=>{a=i,t===document?e():hn(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{a(),t.textContent=""}}function Sa(e,t,n){let s;const a=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},i=()=>(s||(s=a())).cloneNode(!0);return i.cloneNode=i,i}function Bs(e,t=window.document){const n=t[Pt]||(t[Pt]=new Set);for(let s=0,a=e.length;s<a;s++){const i=e[s];n.has(i)||(n.add(i),t.addEventListener(i,$s))}}function wa(e=window.document){if(e[Pt]){for(let t of e[Pt].keys())e.removeEventListener(t,$s);delete e[Pt]}}function fn(e,t,n){Xe(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function ja(e,t,n,s){Xe(e)||(s==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,s))}function Ca(e,t,n){Xe(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function Fs(e,t){Xe(e)||(t==null?e.removeAttribute("class"):e.className=t)}function qs(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 a=n[0];e.addEventListener(t,n[0]=i=>a.call(e,n[1],i))}else e.addEventListener(t,n,typeof n!="function"&&n)}function Ta(e,t,n={}){const s=Object.keys(t||{}),a=Object.keys(n);let i,o;for(i=0,o=a.length;i<o;i++){const l=a[i];!l||l==="undefined"||t[l]||(hs(e,l,!1),delete n[l])}for(i=0,o=s.length;i<o;i++){const l=s[i],c=!!t[l];!l||l==="undefined"||n[l]===c||!c||(hs(e,l,!0),n[l]=c)}return n}function Aa(e,t,n){if(!t)return n?fn(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 a,i;for(i in n)t[i]==null&&s.removeProperty(i),delete n[i];for(i in t)a=t[i],a!==n[i]&&(s.setProperty(i,a),n[i]=a);return n}function Hs(e,t={},n,s){const a={};return s||$e(()=>a.children=Lt(e,t.children,a.children)),$e(()=>typeof t.ref=="function"&&Ws(t.ref,e)),$e(()=>Na(e,t,n,!0,a,!0)),a}function Ws(e,t,n){return ve(()=>e(t,n))}function hn(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return Lt(e,t,s,n);$e(a=>Lt(e,t(),a,n),s)}function Na(e,t,n,s,a={},i=!1){t||(t={});for(const o in a)if(!(o in t)){if(o==="children")continue;a[o]=ms(e,o,null,a[o],n,i,t)}for(const o in t){if(o==="children")continue;const l=t[o];a[o]=ms(e,o,l,a[o],n,i,t)}}function _a(e){let t,n;return!Xe()||!(t=R.registry.get(n=ka()))?e():(R.completed&&R.completed.add(t),R.registry.delete(n),t)}function Xe(e){return!!R.context&&!R.done&&(!e||e.isConnected)}function Pa(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function hs(e,t,n){const s=t.trim().split(/\s+/);for(let a=0,i=s.length;a<i;a++)e.classList.toggle(s[a],n)}function ms(e,t,n,s,a,i,o){let l,c,h,y,g;if(t==="style")return Aa(e,n,s);if(t==="classList")return Ta(e,n,s);if(n===s)return s;if(t==="ref")i||n(e);else if(t.slice(0,3)==="on:"){const S=t.slice(3);s&&e.removeEventListener(S,s,typeof s!="function"&&s),n&&e.addEventListener(S,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const S=t.slice(10);s&&e.removeEventListener(S,s,!0),n&&e.addEventListener(S,n,!0)}else if(t.slice(0,2)==="on"){const S=t.slice(2).toLowerCase(),x=xa.has(S);if(!x&&s){const C=Array.isArray(s)?s[0]:s;e.removeEventListener(S,C)}(x||n)&&(qs(e,S,n,x),x&&Bs([S]))}else if(t.slice(0,5)==="attr:")fn(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")Ca(e,t.slice(5),n);else if((g=t.slice(0,5)==="prop:")||(h=ma.has(t))||!a&&((y=pa(t,e.tagName))||(c=ha.has(t)))||(l=e.nodeName.includes("-")||"is"in o)){if(g)t=t.slice(5),c=!0;else if(Xe(e))return n;t==="class"||t==="className"?Fs(e,n):l&&!c&&!h?e[Pa(t)]=n:e[y||t]=n}else{const S=a&&t.indexOf(":")>-1&&ba[t.split(":")[0]];S?ja(e,S,t,n):fn(e,ga[t]||t,n)}return n}function $s(e){if(R.registry&&R.events&&R.events.find(([c,h])=>h===e))return;let t=e.target;const n=`$$${e.type}`,s=e.target,a=e.currentTarget,i=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),o=()=>{const c=t[n];if(c&&!t.disabled){const h=t[`${n}Data`];if(h!==void 0?c.call(t,h,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&i(t.host),!0},l=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),R.registry&&!R.done&&(R.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();i(c[0]);for(let h=0;h<c.length-2&&(t=c[h],!!o());h++){if(t._$host){t=t._$host,l();break}if(t.parentNode===a)break}}else l();i(s)}function Lt(e,t,n,s,a){const i=Xe(e);if(i){!n&&(n=[...e.childNodes]);let c=[];for(let h=0;h<n.length;h++){const y=n[h];y.nodeType===8&&y.data.slice(0,2)==="!$"?y.remove():c.push(y)}n=c}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(i||o==="number"&&(t=t.toString(),t===n))return n;if(l){let c=n[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),n=et(e,n,s,c)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||o==="boolean"){if(i)return n;n=et(e,n,s)}else{if(o==="function")return $e(()=>{let c=t();for(;typeof c=="function";)c=c();n=Lt(e,c,n,s)}),()=>n;if(Array.isArray(t)){const c=[],h=n&&Array.isArray(n);if(Gn(c,t,n,a))return $e(()=>n=Lt(e,c,n,s,!0)),()=>n;if(i){if(!c.length)return n;if(s===void 0)return n=[...e.childNodes];let y=c[0];if(y.parentNode!==e)return n;const g=[y];for(;(y=y.nextSibling)!==s;)g.push(y);return n=g}if(c.length===0){if(n=et(e,n,s),l)return n}else h?n.length===0?gs(e,c,s):Ea(e,n,c):(n&&et(e),gs(e,c));n=c}else if(t.nodeType){if(i&&t.parentNode)return n=l?[t]:t;if(Array.isArray(n)){if(l)return n=et(e,n,s,t);et(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function Gn(e,t,n,s){let a=!1;for(let i=0,o=t.length;i<o;i++){let l=t[i],c=n&&n[e.length],h;if(!(l==null||l===!0||l===!1))if((h=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))a=Gn(e,l,c)||a;else if(h==="function")if(s){for(;typeof l=="function";)l=l();a=Gn(e,Array.isArray(l)?l:[l],Array.isArray(c)?c:[c])||a}else e.push(l),a=!0;else{const y=String(l);c&&c.nodeType===3&&c.data===y?e.push(c):e.push(document.createTextNode(y))}}return a}function gs(e,t,n=null){for(let s=0,a=t.length;s<a;s++)e.insertBefore(t[s],n)}function et(e,t,n,s){if(n===void 0)return e.textContent="";const a=s||document.createTextNode("");if(t.length){let i=!1;for(let o=t.length-1;o>=0;o--){const l=t[o];if(a!==l){const c=l.parentNode===e;!i&&!o?c?e.replaceChild(a,l):e.insertBefore(a,n):c&&l.remove()}else i=!0}}else e.insertBefore(a,n);return[a]}function ka(){return R.getNextContextId()}var Ia="http://www.w3.org/2000/svg";function Vs(e,t=!1){return t?document.createElementNS(Ia,e):document.createElement(e)}function La(e){const{useShadow:t}=e,n=document.createTextNode(""),s=()=>e.mount||document.body,a=fs();let i,o=!!R.context;return Hn(()=>{o&&(fs().user=o=!1),i||(i=$r(a,()=>Te(()=>e.children)));const l=s();if(l instanceof HTMLHeadElement){const[c,h]=de(!1),y=()=>h(!0);We(g=>hn(l,()=>c()?g():i(),null)),pt(y)}else{const c=Vs(e.isSVG?"g":"div",e.isSVG),h=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),hn(h,i),l.appendChild(c),e.ref&&e.ref(c),pt(()=>l.removeChild(c))}},void 0,{render:!o}),n}function Da(e){const[t,n]=Gs(e,["component"]),s=Te(()=>t.component);return Te(()=>{const a=s();switch(typeof a){case"function":return ve(()=>a(n));case"string":const i=va.has(a),o=R.context?_a():Vs(a,i);return Hs(o,n,i),o}})}var Oa=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()}},Ks=class{constructor(e){this.generateIdentifier=e,this.kv=new Oa}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)}},Ga=class extends Ks{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 Ua(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 Ra(e,t){const n=Ua(e);if("find"in n)return n.find(t);const s=n;for(let a=0;a<s.length;a++){const i=s[a];if(t(i))return i}}function xt(e,t){Object.entries(e).forEach(([n,s])=>t(s,n))}function rn(e,t){return e.indexOf(t)!==-1}function ys(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s))return s}}var Ma=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Ra(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},Ba=e=>Object.prototype.toString.call(e).slice(8,-1),zs=e=>typeof e>"u",Fa=e=>e===null,Dt=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,Un=e=>Dt(e)&&Object.keys(e).length===0,Ve=e=>Array.isArray(e),qa=e=>typeof e=="string",Ha=e=>typeof e=="number"&&!isNaN(e),Wa=e=>typeof e=="boolean",$a=e=>e instanceof RegExp,Ot=e=>e instanceof Map,Gt=e=>e instanceof Set,Qs=e=>Ba(e)==="Symbol",Va=e=>e instanceof Date&&!isNaN(e.valueOf()),Ka=e=>e instanceof Error,ps=e=>typeof e=="number"&&isNaN(e),za=e=>Wa(e)||Fa(e)||zs(e)||Ha(e)||qa(e)||Qs(e),Qa=e=>typeof e=="bigint",Ya=e=>e===1/0||e===-1/0,Xa=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),Ja=e=>e instanceof URL,Ys=e=>e.replace(/\./g,"\\."),Pn=e=>e.map(String).map(Ys).join("."),kt=e=>{const t=[];let n="";for(let a=0;a<e.length;a++){let i=e.charAt(a);if(i==="\\"&&e.charAt(a+1)==="."){n+=".",a++;continue}if(i==="."){t.push(n),n="";continue}n+=i}const s=n;return t.push(s),t};function Oe(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Xs=[Oe(zs,"undefined",()=>null,()=>{}),Oe(Qa,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),Oe(Va,"Date",e=>e.toISOString(),e=>new Date(e)),Oe(Ka,"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($a,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),Oe(Gt,"set",e=>[...e.values()],e=>new Set(e)),Oe(Ot,"map",e=>[...e.entries()],e=>new Map(e)),Oe(e=>ps(e)||Ya(e),"number",e=>ps(e)?"NaN":e>0?"Infinity":"-Infinity",Number),Oe(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),Oe(Ja,"URL",e=>e.toString(),e=>new URL(e))];function yn(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Js=yn((e,t)=>Qs(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}),Za=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),Zs=yn(Xa,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=Za[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function er(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var tr=yn(er,(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(a=>{s[a]=e[a]}),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)}),nr=yn((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)}),ei=[tr,Js,nr,Zs],xs=(e,t)=>{const n=ys(ei,a=>a.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const s=ys(Xs,a=>a.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},sr={};Xs.forEach(e=>{sr[e.annotation]=e});var ti=(e,t,n)=>{if(Ve(t))switch(t[0]){case"symbol":return Js.untransform(e,t,n);case"class":return tr.untransform(e,t,n);case"custom":return nr.untransform(e,t,n);case"typed-array":return Zs.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const s=sr[t];if(!s)throw new Error("Unknown transformation: "+t);return s.untransform(e,n)}},tt=(e,t)=>{const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function rr(e){if(rn(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(rn(e,"prototype"))throw new Error("prototype is not allowed as a property");if(rn(e,"constructor"))throw new Error("constructor is not allowed as a property")}var ni=(e,t)=>{rr(t);for(let n=0;n<t.length;n++){const s=t[n];if(Gt(e))e=tt(e,+s);else if(Ot(e)){const a=+s,i=+t[++n]==0?"key":"value",o=tt(e,a);switch(i){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[s]}return e},Rn=(e,t,n)=>{if(rr(t),t.length===0)return n(e);let s=e;for(let i=0;i<t.length-1;i++){const o=t[i];if(Ve(s)){const l=+o;s=s[l]}else if(Dt(s))s=s[o];else if(Gt(s)){const l=+o;s=tt(s,l)}else if(Ot(s)){if(i===t.length-2)break;const c=+o,h=+t[++i]==0?"key":"value",y=tt(s,c);switch(h){case"key":s=y;break;case"value":s=s.get(y);break}}}const a=t[t.length-1];if(Ve(s)?s[+a]=n(s[+a]):Dt(s)&&(s[a]=n(s[a])),Gt(s)){const i=tt(s,+a),o=n(i);i!==o&&(s.delete(i),s.add(o))}if(Ot(s)){const i=+t[t.length-2],o=tt(s,i);switch(+a==0?"key":"value"){case"key":{const c=n(o);s.set(c,s.get(o)),c!==o&&s.delete(o);break}case"value":{s.set(o,n(s.get(o)));break}}}return e};function Mn(e,t,n=[]){if(!e)return;if(!Ve(e)){xt(e,(i,o)=>Mn(i,t,[...n,...kt(o)]));return}const[s,a]=e;a&&xt(a,(i,o)=>{Mn(i,t,[...n,...kt(o)])}),t(s,n)}function si(e,t,n){return Mn(t,(s,a)=>{e=Rn(e,a,i=>ti(i,s,n))}),e}function ri(e,t){function n(s,a){const i=ni(e,kt(a));s.map(kt).forEach(o=>{e=Rn(e,o,()=>i)})}if(Ve(t)){const[s,a]=t;s.forEach(i=>{e=Rn(e,kt(i),()=>e)}),a&&xt(a,n)}else xt(t,n);return e}var ai=(e,t)=>Dt(e)||Ve(e)||Ot(e)||Gt(e)||er(e,t);function ii(e,t,n){const s=n.get(e);s?s.push(t):n.set(e,[t])}function oi(e,t){const n={};let s;return e.forEach(a=>{if(a.length<=1)return;t||(a=a.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[i,...o]=a;i.length===0?s=o.map(Pn):n[Pn(i)]=o.map(Pn)}),s?Un(n)?[s]:[s,n]:Un(n)?void 0:n}var ar=(e,t,n,s,a=[],i=[],o=new Map)=>{const l=za(e);if(!l){ii(e,a,t);const x=o.get(e);if(x)return s?{transformedValue:null}:x}if(!ai(e,n)){const x=xs(e,n),C=x?{transformedValue:x.value,annotations:[x.type]}:{transformedValue:e};return l||o.set(e,C),C}if(rn(i,e))return{transformedValue:null};const c=xs(e,n),h=(c==null?void 0:c.value)??e,y=Ve(h)?[]:{},g={};xt(h,(x,C)=>{if(C==="__proto__"||C==="constructor"||C==="prototype")throw new Error(`Detected property ${C}. This is a prototype pollution risk, please remove it from your object.`);const N=ar(x,t,n,s,[...a,C],[...i,e],o);y[C]=N.transformedValue,Ve(N.annotations)?g[C]=N.annotations:Dt(N.annotations)&&xt(N.annotations,(A,v)=>{g[Ys(C)+"."+v]=A})});const S=Un(g)?{transformedValue:y,annotations:c?[c.type]:void 0}:{transformedValue:y,annotations:c?[c.type,g]:g};return l||o.set(e,S),S};function ir(e){return Object.prototype.toString.call(e).slice(8,-1)}function vs(e){return ir(e)==="Array"}function li(e){if(ir(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function ci(e,t,n,s,a){const i={}.propertyIsEnumerable.call(s,t)?"enumerable":"nonenumerable";i==="enumerable"&&(e[t]=n),a&&i==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function Bn(e,t={}){if(vs(e))return e.map(a=>Bn(a,t));if(!li(e))return e;const n=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...n,...s].reduce((a,i)=>{if(vs(t.props)&&!t.props.includes(i))return a;const o=e[i],l=Bn(o,t);return ci(a,i,l,e,t.nonenumerable),a},{})}var re=class{constructor({dedupe:e=!1}={}){this.classRegistry=new Ga,this.symbolRegistry=new Ks(t=>t.description??""),this.customTransformerRegistry=new Ma,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=ar(e,t,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const a=oi(t,this.dedupe);return a&&(s.meta={...s.meta,referentialEqualities:a}),s}deserialize(e){const{json:t,meta:n}=e;let s=Bn(t);return n!=null&&n.values&&(s=si(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=ri(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)}};re.defaultInstance=new re;re.serialize=re.defaultInstance.serialize.bind(re.defaultInstance);re.deserialize=re.defaultInstance.deserialize.bind(re.defaultInstance);re.stringify=re.defaultInstance.stringify.bind(re.defaultInstance);re.parse=re.defaultInstance.parse.bind(re.defaultInstance);re.registerClass=re.defaultInstance.registerClass.bind(re.defaultInstance);re.registerSymbol=re.defaultInstance.registerSymbol.bind(re.defaultInstance);re.registerCustom=re.defaultInstance.registerCustom.bind(re.defaultInstance);re.allowErrorProps=re.defaultInstance.allowErrorProps.bind(re.defaultInstance);var or=re.serialize,ui=re.stringify;function di(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function fi(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function hi({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function mi({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function gi(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var yi=(e,t=!1)=>{const{json:n}=or(e);return JSON.stringify(n,null,t?2:void 0)},nn=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,pi=(e,t)=>e.queryHash.localeCompare(t.queryHash),lr=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,xi=(e,t)=>nn(e)===nn(t)?lr(e,t):nn(e)>nn(t)?1:-1,vi={status:xi,"query hash":pi,"last updated":lr},sn=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,cr=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,bi=(e,t)=>sn(e)===sn(t)?cr(e,t):sn(e)>sn(t)?1:-1,Ei={status:bi,"last updated":cr},Si=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),wi=()=>{const[e,t]=de("dark");return Ps(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const s=a=>{t(a.matches?"dark":"light")};n.addEventListener("change",s),pt(()=>n.removeEventListener("change",s))}),e},Nt=(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[a,...i]=t;return s.set(a,Nt(s.get(a),i,n)),s}if(e instanceof Set){const s=Nt(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[a,...i]=t;return s[a]=Nt(s[a],i,n),s}if(e instanceof Object){const s={...e};if(t.length===1)return s[t[0]]=n,s;const[a,...i]=t;return s[a]=Nt(s[a],i,n),s}return e},_t=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[s,...a]=t;return n.set(s,_t(n.get(s),a)),n}if(e instanceof Set){const n=_t(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((i,o)=>o.toString()!==t[0]);const[s,...a]=t;return n[s]=_t(n[s],a),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[s,...a]=t;return n[s]=_t(n[s],a),n}return e},ur=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const s=document.createElement("style"),a=document.createTextNode("");s.appendChild(a),s.id="_goober",s.setAttribute("nonce",e),t?t.appendChild(s):document.head.appendChild(s)},nt,Ut,Rt,Mt,Qe,Bt,st,rt,at,it,ot,lt,Ft,Ss,ji=(Ss=class{constructor(e){ne(this,nt);ne(this,Ut);ne(this,Rt);ne(this,Mt);ne(this,Qe,!1);ne(this,Bt);ne(this,st);ne(this,rt);ne(this,at);ne(this,it);ne(this,ot);ne(this,lt);ne(this,Ft);const{client:t,queryFlavor:n,version:s,onlineManager:a,buttonPosition:i,position:o,initialIsOpen:l,errorTypes:c,styleNonce:h,shadowDOMTarget:y}=e;te(this,nt,de(t)),te(this,Rt,n),te(this,Mt,s),te(this,Ut,a),te(this,Bt,h),te(this,st,y),te(this,rt,de(i)),te(this,at,de(o)),te(this,it,de(l)),te(this,ot,de(c))}setButtonPosition(e){U(this,rt)[1](e)}setPosition(e){U(this,at)[1](e)}setInitialIsOpen(e){U(this,it)[1](e)}setErrorTypes(e){U(this,ot)[1](e)}setClient(e){U(this,nt)[1](e)}mount(e){if(U(this,Qe))throw new Error("Devtools is already mounted");const t=Ms(()=>{const n=this,[s]=U(this,rt),[a]=U(this,at),[i]=U(this,it),[o]=U(this,ot),[l]=U(this,nt);let c;return U(this,lt)?c=U(this,lt):(c=Us(()=>Promise.resolve().then(()=>require("./HO4MOOFI-D3zgCfov.cjs"))),te(this,lt,c)),ur(U(this,Bt),U(this,st)),$n(c,Vn({get queryFlavor(){return U(n,Rt)},get version(){return U(n,Mt)},get onlineManager(){return U(n,Ut)},get shadowDOMTarget(){return U(n,st)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return a()},get initialIsOpen(){return i()},get errorTypes(){return o()}}))},e);te(this,Qe,!0),te(this,Ft,t)}unmount(){var e;if(!U(this,Qe))throw new Error("Devtools is not mounted");(e=U(this,Ft))==null||e.call(this),te(this,Qe,!1)}},nt=new WeakMap,Ut=new WeakMap,Rt=new WeakMap,Mt=new WeakMap,Qe=new WeakMap,Bt=new WeakMap,st=new WeakMap,rt=new WeakMap,at=new WeakMap,it=new WeakMap,ot=new WeakMap,lt=new WeakMap,Ft=new WeakMap,Ss),ct,qt,Ht,Wt,Ye,$t,ut,dt,ft,ht,mt,gt,yt,Vt,ws,Ci=(ws=class{constructor(e){ne(this,ct);ne(this,qt);ne(this,Ht);ne(this,Wt);ne(this,Ye,!1);ne(this,$t);ne(this,ut);ne(this,dt);ne(this,ft);ne(this,ht);ne(this,mt);ne(this,gt);ne(this,yt);ne(this,Vt);const{client:t,queryFlavor:n,version:s,onlineManager:a,buttonPosition:i,position:o,initialIsOpen:l,errorTypes:c,styleNonce:h,shadowDOMTarget:y,onClose:g}=e;te(this,ct,de(t)),te(this,Ht,n),te(this,Wt,s),te(this,qt,a),te(this,$t,h),te(this,ut,y),te(this,dt,de(i)),te(this,ft,de(o)),te(this,ht,de(l)),te(this,mt,de(c)),te(this,gt,de(g))}setButtonPosition(e){U(this,dt)[1](e)}setPosition(e){U(this,ft)[1](e)}setInitialIsOpen(e){U(this,ht)[1](e)}setErrorTypes(e){U(this,mt)[1](e)}setClient(e){U(this,ct)[1](e)}setOnClose(e){U(this,gt)[1](()=>e)}mount(e){if(U(this,Ye))throw new Error("Devtools is already mounted");const t=Ms(()=>{const n=this,[s]=U(this,dt),[a]=U(this,ft),[i]=U(this,ht),[o]=U(this,mt),[l]=U(this,ct),[c]=U(this,gt);let h;return U(this,yt)?h=U(this,yt):(h=Us(()=>Promise.resolve().then(()=>require("./HUY7CZI3-BxyFU_Pg.cjs"))),te(this,yt,h)),ur(U(this,$t),U(this,ut)),$n(h,Vn({get queryFlavor(){return U(n,Ht)},get version(){return U(n,Wt)},get onlineManager(){return U(n,qt)},get shadowDOMTarget(){return U(n,ut)}},{get client(){return l()},get buttonPosition(){return s()},get position(){return a()},get initialIsOpen(){return i()},get errorTypes(){return o()},get onClose(){return c()}}))},e);te(this,Ye,!0),te(this,Vt,t)}unmount(){var e;if(!U(this,Ye))throw new Error("Devtools is not mounted");(e=U(this,Vt))==null||e.call(this),te(this,Ye,!1)}},ct=new WeakMap,qt=new WeakMap,Ht=new WeakMap,Wt=new WeakMap,Ye=new WeakMap,$t=new WeakMap,ut=new WeakMap,dt=new WeakMap,ft=new WeakMap,ht=new WeakMap,mt=new WeakMap,gt=new WeakMap,yt=new WeakMap,Vt=new WeakMap,ws);function Ti(e){const t=K.useQueryClient(e.client),n=ge.useRef(null),{buttonPosition:s,position:a,initialIsOpen:i,errorTypes:o,styleNonce:l,shadowDOMTarget:c}=e,[h]=ge.useState(new ji({client:t,queryFlavor:"React Query",version:"5",onlineManager:K.onlineManager,buttonPosition:s,position:a,initialIsOpen:i,errorTypes:o,styleNonce:l,shadowDOMTarget:c}));return ge.useEffect(()=>{h.setClient(t)},[t,h]),ge.useEffect(()=>{s&&h.setButtonPosition(s)},[s,h]),ge.useEffect(()=>{a&&h.setPosition(a)},[a,h]),ge.useEffect(()=>{h.setInitialIsOpen(i||!1)},[i,h]),ge.useEffect(()=>{h.setErrorTypes(o||[])},[o,h]),ge.useEffect(()=>(n.current&&h.mount(n.current),()=>{h.unmount()}),[h]),r.jsx("div",{className:"tsqd-parent-container",ref:n})}function Ai(e){const t=K.useQueryClient(e.client),n=ge.useRef(null),{errorTypes:s,styleNonce:a,shadowDOMTarget:i}=e,[o]=ge.useState(new Ci({client:t,queryFlavor:"React Query",version:"5",onlineManager:K.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:s,styleNonce:a,shadowDOMTarget:i,onClose:e.onClose}));return ge.useEffect(()=>{o.setClient(t)},[t,o]),ge.useEffect(()=>{o.setOnClose(e.onClose??(()=>{}))},[e.onClose,o]),ge.useEffect(()=>{o.setErrorTypes(s||[])},[s,o]),ge.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 Ni=process.env.NODE_ENV!=="development"?function(){return null}:Ti;process.env.NODE_ENV;const G={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",GET_WEBSITE_PAGES:"GET_WEBSITE_PAGES",UPDATE_WEBSITE_SETTINGS:"UPDATE_WEBSITE_SETTINGS",GET_COLLECTIONS:"GET_COLLECTIONS",GET_PAGE_TYPES:"GET_PAGE_TYPES",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",GET_CHAI_USER:"GET_CHAI_USER",RELEASE_LOCK:"RELEASE_LOCK",GET_SEO_FIELDS:"GET_SEO_FIELDS",GET_BUILDER_PAGE_DATA:"GET_BUILDER_PAGE_DATA"},Kn=()=>{const e=K.useQueryClient(),{data:t}=K.useQuery({queryKey:[G.AI_CONTEXT],initialData:"",queryFn:()=>""});return{setAiContext:j.useCallback(s=>{e.setQueryData([G.AI_CONTEXT],s)},[]),aiContext:t}},_i=js.atom({}),dr=()=>js.useAtom(_i),Fe=(e,t)=>{const[n]=dr();return p.get(n,e,t)},fe=()=>Fe("apiUrl","/chai/api"),Pi=async(e,t,n={})=>await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)}),he=()=>{const e=Fe("user"),t=Fe("onSessionExpired"),n=j.useMemo(()=>e==null?void 0:e.authToken,[e]);return j.useCallback(async(s,a,i={})=>{if(n)try{const o=await Pi(s,a,{...i,Authorization:`Bearer ${n}`});if(o.status===401)throw t(),new Error("Session expired");if(o.status===400)throw new Error((await o.json()).error);return await o.json()}catch(o){throw console.error(o),o}},[n,t])},ki=()=>{const e=fe(),{aiContext:t}=Kn(),n=he();return j.useCallback(async(s,a,i,o)=>n(e,{action:G.ASK_AI,data:{type:s,prompt:a,blocks:i,context:t,lang:o}}),[e,t,n])};function Ke(){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=he(),t=fe();return K.useQuery({queryKey:[G.GET_WEBSITE_PAGES],staleTime:1e3*60*5,queryFn:async()=>e(t,{action:G.GET_WEBSITE_PAGES})||[]})},Re=()=>{const[e]=Ke(),t=e.get("page"),{data:n,isFetching:s}=pn();return{data:j.useMemo(()=>p.find(n,{id:t})||{},[n,t]),isFetching:s}},Ii=(e,t)=>t.map(n=>{if(p.has(e,n._type)){const s=Cs.getDefaultBlockProps(n._type);return{...s,...p.pick(n,[...p.keys(s),"_type","_id","_name","_parent","_bindings"]),...p.pickBy(n,(a,i)=>p.endsWith(i,"_attrs"))}}return n}),Li=e=>{const t=Cs.useRegisteredChaiBlocks();return j.useMemo(()=>{if(!e||p.isEmpty(e))return{blocks:[]};const n=p.filter(e,s=>!p.includes(s==null?void 0:s._type,"@chai/"));return{blocks:Ii(t,n)}},[e,t])},Di=e=>{const t=fe(),n=he();return K.useQuery({queryKey:["chaiUserInfo",e],queryFn:async()=>await n(t,{action:G.GET_CHAI_USER,data:{userId:e}}),enabled:!!e})},Kt=()=>{const e=Fe("user"),t=K.useQueryClient(),n=t.getQueryData(["currentEditor"]);return{isLocked:!p.isEmpty(n)&&(e==null?void 0:e.id)!==n,currentEditor:n,setCurrentEditor:s=>t.setQueryData(["currentEditor"],s)}},fr=()=>{const[e]=Ke(),t=e.get("page"),n=fe(),{setAiContext:s}=Kn(),{setCurrentEditor:a}=Kt(),i=he();return K.useQuery({queryKey:[G.GET_PAGE,t],initialData:[],queryFn:async()=>{a("");const o=await i(n,{action:G.GET_PAGE,data:{id:t,draft:!0}});a(o.currentEditor);const l=o.blocks??[],c=p.find(l,{_type:"@chai/ai-context"});return s(p.get(c,"_value","")||""),l},enabled:!!t})},Oi=()=>{const{data:e}=Re(),{selectedLang:t}=Le.useLanguages(),n=fe(),s=he();return K.useQuery({queryKey:[G.GET_BUILDER_PAGE_DATA,e],queryFn:async()=>s(n,{action:G.GET_BUILDER_PAGE_DATA,data:{pageType:e==null?void 0:e.pageType,lang:t}}),enabled:!!(e!=null&&e.pageType)})},hr=()=>{const e=fe(),t=K.useQueryClient(),n=he();return K.useMutation({mutationFn:async s=>n(e,{action:G.RELEASE_LOCK,data:{id:s}}),onSuccess:(s,a)=>{t.invalidateQueries({queryKey:[G.GET_PAGE,a]})}})},Gi=()=>{const e=fe(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=he();return K.useMutation({mutationFn:async a=>s(e,{action:G.UPDATE_WEBSITE_SETTINGS,data:a}),onSuccess:(a,i)=>{var o;t.invalidateQueries({queryKey:[G.GET_WEBSITE_SETTINGS]}),(o=i==null?void 0:i.settings)!=null&&o.theme||n({title:"Website settings updated successfully."})},onError:a=>{n({variant:"destructive",title:"Failed to update website settings",description:a.message})}})},Ui=()=>{const e=fe(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=he();return K.useMutation({mutationFn:async a=>s(e,{action:G.UPDATE_WEBSITE_DATA,data:a}),onSuccess:()=>{t.invalidateQueries({queryKey:[G.GET_WEBSITE_DATA]}),n({title:"Website data updated successfully."})},onError:a=>{n({variant:"destructive",title:"Failed to update website data",description:a.message})}})},zt=()=>{const e=fe(),t=he();return K.useQuery({queryKey:[G.GET_PAGE_TYPES],initialData:[],queryFn:async()=>t(e,{action:G.GET_PAGE_TYPES})})},Ri=()=>{const e=fe(),t=he();return K.useMutation({mutationFn:async({pageType:n,query:s})=>{try{return t(e,{action:G.SEARCH_PAGES,data:{pageType:n,query:Array.isArray(s)&&s.length>0?s[0]:s}})||[]}catch(a){return console.error(a),[]}}})},Mi=()=>K.useQuery({queryKey:["uiLibraries"],initialData:[],queryFn:async()=>[{uuid:"chaiblocks",name:"UI Blocks",url:"https://chaibuilder.com/chaiblocks"}]}),zn=()=>{const e=fe(),t=he();return K.useQuery({queryKey:[G.GET_WEBSITE_SETTINGS],initialData:{theme:{},fallbackLang:"en",languages:[]},queryFn:async()=>t(e,{action:G.GET_WEBSITE_SETTINGS,data:{draft:!0}})})},Bi=()=>{const e=fe(),t=he(),{setCurrentEditor:n}=Kt();return{getUILibraryBlock:async(o,l)=>{const y=(await(await fetch(o.url+(l.path?"/blocks/"+l.path:"/"+l.uuid+".html"))).text()).replace(/---([\s\S]*?)---/g,"");return Le.getBlocksFromHTML(`${y}`)},getUILibraryBlocks:async o=>{try{return(await(await fetch(o.url+"/blocks.json")).json()).map(h=>({...h,preview:o.url.replace("chaiblocks","")+h.preview}))}catch(l){return console.error(l),[]}},onSave:async({page:o,blocks:l})=>{try{const c=await t(e,{action:"UPDATE_PAGE",data:{id:o,blocks:l}});if(c.code==="PAGE_LOCKED"){n(c.editor);return}return c}catch(c){return console.error(c),new Error("Failed to save blocks")}}}},Fi=()=>{const{data:e}=pn(),t=fe(),n=he();return{getGlobalBlocks:async()=>{const s={};for(const a of e??[])p.isEmpty(a==null?void 0:a.slug)&&(s[a.id]={name:p.startCase(a.name??a.slug),description:""});return s},getGlobalBlockBlocks:async s=>s?(await n(t,{action:"GET_PAGE",data:{id:s,draft:!0,editor:!1}})).blocks:[]}},Ge={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"},Qn=()=>{const e=fe(),[t]=Ke(),n=t.get("page"),s=he();return K.useQuery({queryKey:[G.GET_LANGUAGE_PAGES,n],initialData:[],queryFn:async()=>{if(!n)return null;const a=await s(e,{action:G.GET_LANGUAGE_PAGES,data:{id:n}});return p.reverse(p.sortBy(a,"primaryPage"))},enabled:!!n})},D={PREVIEW:"Preview",THEME:"Theme",SAVEDRAFT:"Save draft",SAVING:"Saving",SAVED:"Saved",PUBLISHED:"Published",PUBLISH:"Publish",UNPUBLISH:"Unpublish",WEBSITEDATA:"Website data",OPEN:"Open",EDIT_LANGUAGE:"Edit language",ADD_NEW_LANGUAGE:"Add New language",ENTER_LANGUAGE_DETAILS:"Enter the details for the language",LANGUAGE:"Language",PAGE_NAME:"Page Name",SLUG:"Slug",UPDATE:"Update",UPDATING:"Updating...",ADDING:"Adding...",CHOOSE_LANGUAGE:"Choose language",ALL_AVAILABLE_LANGUAGE_PAGE:"All available language page is created.",TO_UPDATE_SLUG:"To update slug use 'Change slug' action",SLUG_SHOULD_START_WITH:" (Slug should start with /{lang})",CHOOSE_LANGUAGE_TO_ADD_SLUG:"Choose language to add slug",ENTER_PAGE_SLUG:"Enter page slug",ENTER_PAGE_NAME:"Enter page name",DELETE:"Delete",CHANGE_SLUG:"Change slug",PRIMARY:"Primary",SLUG_MUST_START_WITH:"Slug must start with /",EDIT:"Edit",UNPUBLISH_MSG:"Are you sure you want to unpublish",PAGE_ADD_SUCCESS:"New page added successfully.",GLOBAL_BLOCK_ADD_SUCCESS:"New global block added successfully.",SEO_SETTINGS_UPDATE_SUCCESS:"SEO Settings updated successfully.",PAGE_UPDATE_SUCCESS:"Page updated successfully.",GLOBAL_BLOCK_UPDATE_SUCCESS:"Global block updated successfully.",PAGE_DELETE_SUCCESS:"Page deleted successfully.",GLOBAL_BLOCK_DELETE_SUCCESS:"Global block deleted successfully.",PAGE_UNPUBLISH_SUCCESS:"Page unpublished successfully.",GLOBAL_BLOCK_UNPUBLISH_SUCCESS:"Global block unpublished successfully.",PAGE_PUBLISH_SUCCESS:"Page published successfully.",GLOBAL_BLOCK_PUBLISH_SUCCESS:"Global block published successfully.",PAGES_PUBLISH_SUCCESS:"Your changes have been published successfully.",SLUG_CHANGE_SUCCESS:"Slug changed successfully."},qi={SLUG_ALREADY_USED:"This slug is already in use. Please choose a different one."},mr=()=>{const e=fe(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=he();return K.useMutation({mutationFn:async a=>s(e,{action:G.CREATE_PAGE,data:a}),onSuccess:(a,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[G.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[G.GET_WEBSITE_PAGES]}),n({title:i.pageType==="global"?D.GLOBAL_BLOCK_ADD_SUCCESS:D.PAGE_ADD_SUCCESS})},onError:(a,i)=>{n({variant:"destructive",title:`Failed to add new ${i.pageType==="global"?"global block":"page"}.`,description:p.get(qi,a.message,a.message)})}})},Yn=()=>{const e=fe(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=he();return K.useMutation({mutationFn:async a=>await s(e,{action:G.UPDATE_PAGE,data:a}),onSuccess:(a,i)=>{i&&(i!=null&&i.primaryPage||i!=null&&i.seo)?t.invalidateQueries({queryKey:[G.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[G.GET_WEBSITE_PAGES]}),i!=null&&i.seo?n({title:D.SEO_SETTINGS_UPDATE_SUCCESS}):n({title:i.pageType==="global"?D.GLOBAL_BLOCK_UPDATE_SUCCESS:D.PAGE_UPDATE_SUCCESS})},onError:(a,i)=>{n({variant:"destructive",title:`Failed to update ${i.pageType==="global"?"global block":"page"}.`,description:a.message})}})},Hi=()=>{const e=fe(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=he();return K.useMutation({mutationFn:async a=>s(e,{action:G.DELETE_PAGE,data:{id:a==null?void 0:a.id}}),onSuccess:(a,i)=>{if(a.code==="PAGE_LOCKED"){n({title:"Delete not allowed",description:"Page is currently being edited by another user.",variant:"destructive"});return}i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[G.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[G.GET_WEBSITE_PAGES]}),n({title:i.pageType==="global"?D.GLOBAL_BLOCK_DELETE_SUCCESS:D.PAGE_DELETE_SUCCESS})},onError:(a,i)=>{n({variant:"destructive",title:`Failed to delete ${i.pageType==="global"?"global block":"page"}.`,description:a.message})}})},Wi=()=>{const e=fe(),t=K.useQueryClient(),{toast:n}=d.useToast(),s=he();return K.useMutation({mutationFn:async a=>s(e,{action:G.TAKE_OFFLINE,data:{id:a==null?void 0:a.id}}),onSuccess:(a,i)=>{i&&(i!=null&&i.primaryPage)?t.invalidateQueries({queryKey:[G.GET_LANGUAGE_PAGES,i==null?void 0:i.primaryPage]}):t.invalidateQueries({queryKey:[G.GET_WEBSITE_PAGES]}),n({title:i.pageType==="global"?D.GLOBAL_BLOCK_UNPUBLISH_SUCCESS:D.PAGE_UNPUBLISH_SUCCESS})},onError:(a,i)=>{n({variant:"destructive",title:`Failed to take offline ${i.pageType==="global"?"global block":"page"}.`,description:a.message})}})},gr=()=>{const e=fe(),{toast:t}=d.useToast(),n=he(),s=K.useQueryClient(),{data:a}=Re();return K.useMutation({mutationFn:async({ids:i})=>n(e,{action:G.PUBLISH_CHANGES,data:{ids:i}}),onSuccess:()=>{s.invalidateQueries({queryKey:[G.GET_CHANGES]}),s.invalidateQueries({queryKey:[G.GET_WEBSITE_PAGES]}),s.invalidateQueries({queryKey:[G.GET_LANGUAGE_PAGES,a==null?void 0:a.id]})},onError:()=>{t({title:"Failed to publish pages.",variant:"destructive"})}})},$i=()=>{const e=fe(),{toast:t}=d.useToast(),n=he(),s=K.useQueryClient();return K.useMutation({mutationFn:async({id:a,slug:i})=>n(e,{action:G.CHANGE_SLUG,data:{id:a,slug:i}}),onSuccess:(a,{primaryPage:i})=>{t({title:D.SLUG_CHANGE_SUCCESS}),i?s.invalidateQueries({queryKey:[G.GET_LANGUAGE_PAGES,i]}):s.invalidateQueries({queryKey:[G.GET_WEBSITE_PAGES]})},onError:()=>{t({title:"Failed to change slug",variant:"destructive"})}})},Vi=({page:e,onClose:t})=>{const[n,s]=j.useState(e.slug||""),{mutate:a,isPending:i}=$i(),{data:o}=zt(),l=p.find(o,{key:e==null?void 0:e.pageType}),c=y=>{if(y.preventDefault(),!(e!=null&&e.primaryPage)&&Object.keys(Ge).some(x=>n===`/${x}`||p.startsWith(n,`/${x}/`))){d.toast({title:"Error",description:"Slugs cannot start with a language code for primary page",variant:"destructive"});return}a({...e,slug:n},{onSuccess:t})},h=(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:c,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.pageType)]})]}),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 /",h]})]}),r.jsx(d.Input,{id:"slug",value:n,onChange:y=>{const g=y.target.value;p.startsWith(g,`/${h}`)&&s(g)},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:i||!p.startsWith(n,`/${h}`)||p.isEqual(e==null?void 0:e.slug,n),children:i?"Changing...":"Change Slug"})})]})]})})};function yr({page:e,onClose:t}){const[,n]=Ke(),{mutate:s,isPending:a}=Hi(),i=()=>{s(e,{onSuccess:()=>{e!=null&&e.primaryPage||(window.history.replaceState(null,"","/"),n(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate"))),t()}})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Confirm Deletion"}),r.jsxs(d.DialogDescription,{className:"py-4 text-slate-500",children:[r.jsxs("div",{children:["Are you sure you want to remove ",r.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)})," ",(e==null?void 0:e.pageType)==="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:p.get(Ge,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:a,onClick:i,children:a?"Deleting...":"Delete"})]})]})})}const Xn=({page:e,onClose:t})=>{const{mutate:n,isPending:s}=Wi(),a=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:[D.UNPUBLISH_MSG," ",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:a,children:s?D.UPDATING:D.UNPUBLISH})]})]})})},pr=({langProps:e,onClose:t,languages:n})=>{const{data:s}=Re(),[a,i]=j.useState(e.name||""),[o,l]=j.useState(e.edit?e.lang:""),[c,h]=j.useState(e.edit?e.slug:""),{mutate:y,isPending:g}=mr(),{mutate:S,isPending:x}=Yn(),C=(e==null?void 0:e.pageType)==="global",N=g||x,A=v=>{v.preventDefault();const b={name:a,lang:o,primaryPage:s==null?void 0:s.id,slug:c,pageType:s==null?void 0:s.pageType};b.pageType=e.pageType,e.edit&&(b.id=e==null?void 0:e.id),e.edit?S(b,{onSuccess:t}):y(b,{onSuccess:t})};return r.jsx(d.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(d.DialogContent,{className:"sm:max-w-[425px] text-slate-600",children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:e.edit?D.EDIT_LANGUAGE:D.ADD_NEW_LANGUAGE}),r.jsx(d.DialogDescription,{className:"font-light",children:D.ENTER_LANGUAGE_DETAILS})]}),r.jsxs("form",{onSubmit:A,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:D.LANGUAGE}),r.jsxs("select",{value:o,disabled:e.edit||p.isEmpty(n),onChange:v=>{const b=v.target.value;l(b),!C&&h(`/${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?p.get(Ge,e.lang,e.lang):p.isEmpty(n)?D.ALL_AVAILABLE_LANGUAGE_PAGE:D.CHOOSE_LANGUAGE}),p.map(n,v=>r.jsx("option",{value:v,children:p.get(Ge,v,v)},v))]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{htmlFor:"slug",className:"text-right",children:D.PAGE_NAME}),r.jsx(d.Input,{id:"name",value:a,onChange:v=>i(v.target.value),className:"col-span-3",required:!0,placeholder:D.ENTER_PAGE_NAME})]}),!C&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-right",children:[D.SLUG," ",r.jsx("small",{className:"font-light",children:D.SLUG_SHOULD_START_WITH})]}),r.jsx(d.Input,{id:"slug",value:c,onChange:v=>{const b=v.target.value;p.startsWith(b,`/${o}`)&&h(p.toLower(p.trim(b)))},className:"col-span-3",required:!0,pattern:"^/.*",disabled:p.isEmpty(o),title:D.SLUG_MUST_START_WITH,placeholder:p.isEmpty(o)?D.CHOOSE_LANGUAGE_TO_ADD_SLUG:D.ENTER_PAGE_SLUG})]})]}),r.jsx(d.DialogFooter,{children:r.jsx(d.Button,{type:"submit",disabled:N||!a||!o||!C&&!p.startsWith(c,`/${o}`),children:N?e.edit?D.UPDATING:D.ADDING:e.edit?D.UPDATE:D.ADD_NEW_LANGUAGE})})]})]})})},Ki=()=>{const[e,t]=j.useState(null),{selectedLang:n,fallbackLang:s,setSelectedLang:a}=Le.useLanguages(),{data:i,isFetching:o}=Qn(),{data:l}=Re(),[c,h]=j.useState(null),[y,g]=j.useState(null),[S,x]=j.useState(null),{data:C}=zn(),N=p.filter(p.get(C,"languages")||["en"],A=>!p.find(i,{lang:A})&&A!==p.get(C,"fallbackLang"));return r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsx("ul",{className:"space-y-2 mt-4",children:o?r.jsxs("div",{className:"w-full space-y-3 py-4",children:[r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):p.map(i,A=>{const v=A.lang,b=A.slug,_=!A.primaryPage,V=v===n;return r.jsxs(r.Fragment,{children:[r.jsxs("li",{className:`text-slate-500 w-full p-2 rounded cursor-pointer flex items-center justify-between ${V?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>a(v),children:[r.jsxs("div",{className:" flex-1 gap-x-3",children:[r.jsxs("div",{className:"text-[13px] text-slate-800 flex items-center gap-x-2",children:[r.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${A.online?"bg-green-300":"bg-gray-300"}`}),p.get(Ge,_?s:v,v)]}),r.jsxs("div",{children:[b&&r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Slug: ",r.jsx("b",{className:"font-medium",children:b})]}),r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Name:",r.jsxs("b",{className:"font-medium",children:[" ",A.name," "]})]})]})]}),_?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:$=>$.stopPropagation(),children:r.jsx(d.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:r.jsx(M.MoreHorizontal,{className:"h-4 w-4"})})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:$=>{$.stopPropagation(),t({...A,edit:!0})},children:[r.jsx(M.PencilIcon,{className:"size-3"}),D.EDIT]}),(A==null?void 0:A.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:$=>{$.stopPropagation(),g(A)},children:[r.jsx(M.Power,{className:"size-3"}),D.UNPUBLISH]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:$=>{$.stopPropagation(),h(A)},children:[r.jsx(M.TrashIcon,{className:"size-3"}),D.DELETE]})]})]})})]},A.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:p.isEmpty(N),onClick:()=>{t({name:l==null?void 0:l.name,pageType:l==null?void 0:l.pageType,lang:"",slug:"",edit:!1})},children:D.ADD_NEW_LANGUAGE})}),e&&r.jsx(pr,{languages:N,langProps:e,onClose:()=>t(null)}),c&&r.jsx(yr,{page:c,onClose:()=>h(null)}),y&&r.jsx(Xn,{page:y,onClose:()=>g(null)}),S&&r.jsx(Vi,{page:S,onClose:()=>x(null)})]})};function zi({avatar:e,name:t,email:n,onTakeOver:s}){const[a,i]=j.useState(!1),o=()=>{i(!1),s()};return r.jsx("div",{className:"absolute bottom-0 left-0 right-0 z-50 flex items-center justify-center w-screen top-14 bg-black/30 backdrop-blur-sm",children:r.jsxs(d.Card,{className:"w-full max-w-md mx-auto",children:[r.jsx(d.CardHeader,{className:"space-y-1",children:r.jsxs(d.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(M.LockIcon,{className:"w-6 h-6 text-yellow-500"}),"Page locked for editing"]})}),r.jsxs(d.CardContent,{className:"grid gap-4",children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[e?r.jsx(M.UserIcon,{className:"w-12 h-12 p-2 border border-gray-300 rounded-full"}):r.jsx("img",{src:e,alt:t,className:"w-12 h-12 border border-gray-300 rounded-full"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"font-semibold",children:t}),n&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n})]})]}),r.jsx("div",{className:"text-sm",children:r.jsx("p",{children:"This user is currently editing the page. You cannot make changes."})})]}),r.jsx(d.CardFooter,{children:r.jsxs(d.AlertDialog,{open:a,onOpenChange:i,children:[r.jsx(d.AlertDialogTrigger,{asChild:!0,children:r.jsxs("span",{className:"flex flex-col items-center",children:[r.jsx(d.Button,{className:"w-full",variant:"destructive",children:"Take Over"}),r.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"If you need to edit, you can take over the lock, but be aware that the other user might lose unsaved changes."})]})}),r.jsxs(d.AlertDialogContent,{children:[r.jsxs(d.AlertDialogHeader,{children:[r.jsx(d.AlertDialogTitle,{children:"Are you sure you want to take over?"}),r.jsxs(d.AlertDialogDescription,{children:[r.jsxs("div",{className:"flex items-center space-x-2 text-yellow-500",children:[r.jsx(M.AlertTriangleIcon,{className:"w-5 h-5"}),r.jsx("span",{children:"This action might cause the other user to lose unsaved changes."})]}),r.jsxs("p",{className:"mt-2",children:["By taking over, you will become the active editor of this page, and ",t," will lose their editing access."]})]})]}),r.jsxs(d.AlertDialogFooter,{children:[r.jsx(d.AlertDialogCancel,{children:"Cancel"}),r.jsx(d.AlertDialogAction,{onClick:o,children:"Yes, Take Over"})]})]})]})})]})})}const Qi=()=>{const{isLocked:e,currentEditor:t}=Kt(),{data:n}=Di(t),s=Fe("pageLockComponent",zi),[a]=Ke(),i=a.get("page"),{mutate:o}=hr(),{isFetching:l}=fr(),c=j.useCallback(()=>{o(i)},[i,o]);return!e||l?null:r.jsx(s,{...n,onTakeOver:c})},Yi=()=>{const{selectedLang:e}=Le.useLanguages(),{data:t,isFetching:n}=Qn();return{data:j.useMemo(()=>p.find(t,{lang:e||""})||{},[t,e]),isFetching:n}};function bs({data:e,onSelect:t,dataType:n="value"}){const[s,a]=ge.useState(!1),[i,o]=ge.useState([]),[l,c]=ge.useState(e);ge.useEffect(()=>{c(e)},[e]);const h=x=>Array.isArray(x)?"array":typeof x=="object"&&x!==null?"object":"value",y=ge.useCallback(x=>{const C=N=>n==="value"?N==="value"||N==="object":n==="array"?N==="array":N===n;x.type==="object"?(o(N=>[...N,x.key]),c(x.value)):C(x.type)&&(t([...i,x.key].join(".")),a(!1))},[i,t,n]),g=ge.useCallback(()=>{if(i.length>0){const x=i.slice(0,-1);o(x),c(x.reduce((C,N)=>C[N],e))}},[i,e]),S=ge.useMemo(()=>Object.entries(l).map(([x,C])=>({key:x,value:C,type:h(C)})).filter(x=>n==="value"?x.type==="value"||x.type==="object":n==="array"?x.type==="array"||x.type==="object":n==="object"?x.type==="object":!0),[l,n]);return r.jsxs(d.Popover,{open:s,onOpenChange:a,children:[r.jsx(d.PopoverTrigger,{asChild:!0,children:r.jsx(d.Button,{size:"sm",variant:"outline",className:"h-5 px-1 py-0 text-[9px] text-muted-foreground",role:"combobox","aria-expanded":s,children:"+ Add Field"})}),r.jsx(d.PopoverContent,{className:"w-[300px] p-0",children:r.jsxs(d.Command,{children:[r.jsx(d.CommandInput,{className:"border-none",placeholder:"Search..."}),r.jsxs(d.CommandList,{children:[r.jsx(d.CommandEmpty,{children:"No option found."}),r.jsxs(d.CommandGroup,{children:[i.length>0&&r.jsxs(d.CommandItem,{onSelect:g,className:"flex items-center text-sm",children:[r.jsx(M.ChevronLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),S.map(x=>r.jsxs(d.CommandItem,{onSelect:()=>y(x),className:"flex items-center justify-between",children:[r.jsx("span",{children:x.key}),r.jsxs("div",{className:"flex items-center gap-2",children:[n==="object"&&x.type==="object"&&r.jsx(d.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-primary hover:text-primary-foreground",onClick:C=>{C.stopPropagation(),t([...i,x.key].join(".")),a(!1)},children:"Select"}),(x.type==="object"||x.type==="array")&&r.jsx("div",{className:"p-1 rounded hover:bg-muted cursor-pointer",children:r.jsx(M.ChevronRight,{className:"w-4 h-4 opacity-50"})})]})]},x.key))]})]})]})})]})}const Xi=(e,t)=>{const n=e.selectionStart||0,s=e.selectionEnd||0,a=e.value;return{value:a.substring(0,n)+`[${t}]`+a.substring(s),newCursorPos:n+t.length+2}},xr=()=>{const{data:e}=Oi(),{data:t,isFetching:n}=Yi(),s=t==null?void 0:t.seo,[a,i]=j.useState({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...s}),o=j.useRef({initial:a,updated:a}),{selectedLang:l,fallbackLang:c,languages:h}=Le.useLanguages(),y=l.length?l:c,{mutate:g,isPending:S}=Yn(),x=S;j.useEffect(()=>{!n&&s&&i({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...s})},[n,s]);const C=async()=>{g({id:t==null?void 0:t.id,seo:a}),o.current.initial=a,o.current.updated=a},N=()=>{i({...a,ogTitle:a.title,ogDescription:a.description})},A=()=>{i({...a,searchTitle:a.ogTitle,searchDescription:a.ogDescription})},v=(_,V)=>{const $=document.getElementById(V);if($){const{value:Se,newCursorPos:be}=Xi($,_);i(q=>({...q,[$.name]:Se})),setTimeout(()=>{$.focus(),$.setSelectionRange(be,be)},0)}},b=_=>{const V={...a,[_.target.name]:_.target.name==="noIndex"||_.target.name==="noFollow"?_.target.checked:_.target.value};i(V),o.current.updated=V};return r.jsxs("div",{className:"relative pb-40",children:[r.jsxs("div",{className:"p-2 text-xs text-left bg-gray-100 rounded-md",children:["Slug: ",t==null?void 0:t.slug," ",h.length>0&&r.jsxs("span",{className:"font-semibold text-blue-500",children:["(",p.get(Ge,y,y),")"]})]}),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:"font-semibold text-slate-700",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.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"title",children:"SEO Title"}),r.jsx(bs,{dataType:"value",data:e??{},onSelect:_=>v(_,"title")})]}),r.jsx(d.Input,{type:"text",id:"title",name:"title",value:a.title,onChange:b,disabled:x,placeholder:"Enter SEO title"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"description",children:"SEO Description"}),r.jsx(bs,{data:e??{},onSelect:_=>v(_,"description")})]}),r.jsx(d.Textarea,{id:"description",name:"description",value:a.description,onChange:b,disabled:x,placeholder:"Enter SEO description"})]}),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:a.canonicalUrl,onChange:b,disabled:x,placeholder:"Enter Canonical URL"})]}),r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsx(d.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:a.noIndex,onChange:b,disabled:x,className:"w-4 h-4"}),r.jsx(d.Label,{className:"pb-1 text-xs",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:a.noFollow,onChange:b,disabled:x,className:"w-4 h-4"}),r.jsx(d.Label,{className:"pb-1 text-xs",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:"font-bold text-slate-700",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("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"ogTitle",children:"OG Title"})}),r.jsx(d.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:a.ogTitle,onChange:b,disabled:x,placeholder:"Enter OG title"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"ogDescription",children:"OG Description"})}),r.jsx(d.Textarea,{id:"ogDescription",name:"ogDescription",value:a.ogDescription,onChange:b,disabled:x,placeholder:"Enter OG description"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(d.Label,{className:"text-xs",htmlFor:"ogImage",children:"OG Image URL"}),r.jsx(d.Input,{type:"text",id:"ogImage",name:"ogImage",value:a.ogImage,onChange:b,disabled:x,placeholder:"Enter OG image URL"})]})]})})]}),r.jsxs(d.AccordionItem,{value:"search",children:[r.jsx(d.AccordionTrigger,{className:"font-bold text-slate-700",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:A,children:"Copy from OG Settings"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"searchTitle",children:"Search Title"})}),r.jsx(d.Input,{type:"text",id:"searchTitle",name:"searchTitle",value:a.searchTitle,onChange:b,disabled:x,placeholder:"Enter search title"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"searchDescription",children:"Search Description"})}),r.jsx(d.Textarea,{id:"searchDescription",name:"searchDescription",value:a.searchDescription,onChange:b,placeholder:"Enter search description"})]})]})})]}),r.jsxs(d.AccordionItem,{value:"jsonLD",children:[r.jsx(d.AccordionTrigger,{className:"font-bold text-slate-700",children:"JSON-LD"}),r.jsx(d.AccordionContent,{children:r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(d.Label,{className:"text-xs",htmlFor:"jsonLD",children:"JSON-LD"})}),r.jsx(d.Textarea,{id:"jsonLD",name:"jsonLD",rows:3,value:a.jsonLD,onChange:b,placeholder:"Enter JSON-LD"})]})})})]})]})}),r.jsx("div",{className:"flex items-center justify-end w-full mt-4",children:r.jsx(d.Button,{size:"lg",variant:"default",onClick:C,disabled:p.isEqual(o.current.initial,a)||x,children:S?"Saving...":"Save"})})]})};xr.displayName="SeoPanel";function Ji({addEditPage:e,additionalPageTypes:t=[],close:n}){var q,Y;const s=!!(e!=null&&e.id),{data:a}=pn(),{mutate:i,isPending:o}=mr(),{mutate:l,isPending:c}=Yn(),[h,y]=j.useState(null),[g,S]=j.useState((e==null?void 0:e.pageType)??"page"),[x,C]=j.useState((e==null?void 0:e.parent)??""),[N,A]=j.useState((e==null?void 0:e.name)??""),[v,b]=j.useState(((e==null?void 0:e.slug)??"").split("/").pop()||""),_=o||c,V=w=>{S(w),C(""),b("")},$=w=>{if(C(w),w&&w!=="none"){const P=a==null?void 0:a.find(ue=>ue.id===w),ce=(P==null?void 0:P.slug)||"";if(v.startsWith(ce)){const ue=v.slice(ce.length).replace(/^\/+/,"");b(ue)}else b(v.replace(/^\/+/,""))}else b(v?`${v}`:"")},Se=j.useCallback(w=>{if(x&&x!=="none"){const P=w.replace(/^\/+/,"").replace(/\/+$/,"");b(P)}else{const P=w.startsWith("/")?w:`${w}`;b(P)}},[x]),be=w=>{if(w.preventDefault(),v.length>0&&!v.match(/^[a-zA-Z0-9-_]+$/)){y("Slug can only contain letters, numbers, and hyphens");return}if(!N.trim()){d.toast({title:"Error",description:"Name is required",variant:"destructive"});return}if(g==="global"){const P={pageType:"global",name:N,slug:""};if(s){l({id:e==null?void 0:e.id,name:N},{onSuccess:()=>{d.toast({title:"Success",description:"Global Block updated successfully"}),n()}});return}i(P,{onSuccess:()=>{d.toast({title:"Success",description:"Global Block created successfully"}),n()}});return}if(x&&x!=="none"){if(!v.trim()){d.toast({title:"Error",description:"Child page slug is required",variant:"destructive"});return}const P=a==null?void 0:a.find(Me=>Me.id===x),ce=(P==null?void 0:P.slug)||"",ue=ce==="/"?`/${v}`:`${ce}/${v}`;if(Object.keys(Ge).some(Me=>ue===`/${Me}`||(ue==null?void 0:ue.startsWith(`/${Me}/`)))){d.toast({title:"Error",description:"Slugs cannot start with a language code for primary page",variant:"destructive"});return}const He={pageType:g,name:N,slug:ue.replace(/\/$/,""),parent:x};if(s){l({id:e==null?void 0:e.id,...He},{onSuccess:()=>{d.toast({title:"Success",description:"Page updated successfully"}),n()}});return}i(He,{onSuccess:()=>{d.toast({title:"Success",description:"Page created successfully"}),n()}})}else{const P={pageType:g,name:N,slug:v===""?"/":`/${v.replace(/\/$/,"")}`};if(s){l({id:e==null?void 0:e.id,...P},{onSuccess:()=>{d.toast({title:"Success",description:"Page updated successfully"}),n()}});return}i(P,{onSuccess:()=>{d.toast({title:"Success",description:"Page created successfully"}),n()}})}};return g==="global"?r.jsxs("form",{onSubmit:be,className:"w-full max-w-md mx-auto space-y-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"pageType",className:"text-sm",children:"Page Type"}),r.jsx("select",{id:"pageType",value:g,disabled:s,onChange:w=>V(w.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${s?"cursor-not-allowed text-gray-500":""}`,children:t.map(w=>r.jsx("option",{value:w.key,children:w.name},w.key))}),r.jsx("p",{className:"text-sm text-gray-500",children:(q=t.find(w=>w.key===g))==null?void 0:q.helpText})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),r.jsx(d.Input,{id:"name",value:N,onChange:w=>A(w.target.value),required:!0,"aria-required":"true"})]}),r.jsx(d.Button,{disabled:_,type:"submit",className:"w-full",children:s?_?"Updating...":"Update Global Block":_?"Creating...":"Create Global Block"})]}):r.jsxs("form",{onSubmit:be,className:"w-full max-w-md mx-auto space-y-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"pageType",className:"text-sm",children:"Page Type"}),r.jsx("select",{id:"pageType",value:g,disabled:s,onChange:w=>V(w.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${s?"cursor-not-allowed text-gray-500":""}`,children:t.map(w=>r.jsx("option",{value:w.key,children:w.name},w.key))})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"parentPage",className:"text-sm",children:"Parent"}),r.jsxs("select",{id:"parentPage",value:x,onChange:w=>$(w.target.value),className:"w-full rounded-md border border-gray-300 px-3 py-2",children:[r.jsx("option",{value:"none",children:"None"}),a==null?void 0:a.filter(w=>w.pageType!=="global"&&w.slug!=="/").map(w=>r.jsxs("option",{value:w.id,children:[w.name," (",w.slug,")"]},w.id))]})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(d.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),r.jsx(d.Input,{id:"name",value:N,onChange:w=>A(w.target.value),required:!0,"aria-required":"true"})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs(d.Label,{htmlFor:"slug",className:"text-sm",children:["Slug",x&&x!=="none"&&r.jsxs("span",{className:"ml-2 text-sm text-gray-500",children:["Parent:"," ",(Y=a==null?void 0:a.find(w=>w.id===x))==null?void 0:Y.slug]})]}),r.jsx(d.Input,{id:"slug",value:v,onChange:w=>Se(w.target.value),placeholder:x&&x!=="none"?"Enter page slug":g==="page"?"Leave empty for home page":"Required - e.g. /your-slug"}),h&&r.jsx("p",{className:"text-xs text-red-500",children:h})]}),r.jsx(d.Button,{disabled:_,type:"submit",className:"w-full",children:s?_?"Updating...":"Update page":_?"Creating...":"Create Page"})]})}const Zi=({addEditPage:e,setAddEditPage:t})=>{const{data:n}=zt(),s=!!(e!=null&&e.id);return r.jsx(d.Dialog,{open:!!e,onOpenChange:()=>t(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"," "]}),r.jsx(d.DialogDescription,{children:s?"Update your page name":"Enter details to create a new page"})]}),r.jsx(Ji,{addEditPage:e,close:()=>t(void 0),additionalPageTypes:n??[]})]})})},kn=({parentSlug:e,page:t,active:n,changeActivePage:s,setUnpublishPage:a,setDeletePage:i,setAddEditPage:o})=>{const{data:l}=zt(),c=p.find(l,{key:t.pageType});return console.log(l,c),r.jsxs("div",{onClick:()=>s(p.get(t,"id")),className:`rounded flex p-1.5 items-center justify-between leading-none duration-300 cursor-pointer px-3 py-1.5 ${n?"bg-gray-200":"hover:bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[c!=null&&c.icon?r.jsx("div",{className:"w-4 h-4 text-slate-500 stroke-[1]",dangerouslySetInnerHTML:{__html:c.icon}}):t.pageType==="global"?r.jsx(M.Globe,{className:"w-4 h-4 text-slate-500 stroke-[1]"}):r.jsx(M.File,{className:"w-4 h-4 text-slate-500 stroke-[1]"}),r.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.online?"bg-green-300":"bg-gray-300"}`}),r.jsx("span",{className:"font-light leading-none text-slate-800",children:p.startCase(t.name)??""}),t.pageType!=="global"?r.jsx(d.Badge,{variant:"outline",className:"ml-2 text-xs font-bold leading-none rounded-full text-slate-500",children:p.get(t,"slug").replace(e,"")||"/"}):r.jsx(d.Badge,{variant:"outline",className:"ml-2 text-xs font-bold leading-none rounded-full text-slate-500",children:"Global Block"})]}),r.jsx("div",{className:"flex items-center space-x-4",children:r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,onClick:h=>h.stopPropagation(),children:r.jsx(M.MoreHorizontal,{className:"h-4 w-4 hover:stroke-[3]"})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:h=>{h.stopPropagation(),o({...t,global:t.pageType==="global"})},children:[r.jsx(M.Pencil,{className:"size-3"}),"Edit"]}),(t==null?void 0:t.online)&&r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:h=>{h.stopPropagation(),a(t)},children:[r.jsx(M.Power,{className:"size-3"}),D.UNPUBLISH]}),r.jsxs(d.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:h=>{h.stopPropagation(),i(t)},children:[r.jsx(M.Trash,{className:"size-3"}),D.DELETE]})]})]})})]})},eo=({close:e})=>{const[,t]=j.useState([]),[n,s]=j.useState(""),[a,i]=j.useState(null),[o,l]=j.useState(null),[c,h]=j.useState(null),{mutate:y}=hr(),{data:g,isFetching:S}=pn(),[x,C]=Ke(),N=x.get("page"),A=j.useCallback(b=>{N&&y(N),window.history.pushState({},"",`?page=${b}`),C(new URLSearchParams({page:b})),window.dispatchEvent(new PopStateEvent("popstate")),e()},[N,C,e,y]);j.useEffect(()=>{if(N&&!S){const b=p.find(g,{id:N});b&&(b!=null&&b.pageType)?t(_=>[..._,b==null?void 0:b.pageType]):(window.history.replaceState(null,"","/"),C(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate")))}},[g,N,S,C]);const v=j.useMemo(()=>{const b=p.filter(g,q=>p.isEmpty(n)?!0:p.includes(p.toLower(q==null?void 0:q.name),p.toLower(n))||p.includes(p.toLower(q==null?void 0:q.slug),p.toLower(n))),_=new Map;b.forEach(q=>{_.set(q.id,{...q,children:[]})});const V=[],$=[];_.forEach(q=>{if(q.parent){const Y=_.get(q.parent);Y?Y.children.push(q):V.push(q)}else $.push(q)}),V.sort((q,Y)=>q.name.localeCompare(Y.name)),V.forEach(q=>{q.children.sort((Y,w)=>Y.name.localeCompare(w.name))});const Se=p.filter($,q=>q.pageType==="global"),be=p.filter($,q=>q.pageType!=="global").sort((q,Y)=>q.name.localeCompare(Y.name));return p.compact([...be,...Se,...V])},[g,n]);return r.jsxs("div",{className:"flex flex-col justify-between h-full",children:[r.jsxs("div",{className:"flex flex-col h-full space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary text-primary-foreground",children:r.jsx(M.File,{className:"w-6 h-6"})}),r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"text-sm font-semibold",children:"Pages"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Manage your site structure"})]})]}),r.jsxs("div",{className:"relative flex item-center gap-x-4",children:[r.jsx(M.Search,{strokeWidth:2.5,className:"absolute left-3 top-2.5 h-4 w-4 text-gray-400"}),r.jsx(d.Input,{placeholder:"Search pages...",className:"text-xs font-medium leading-none text-gray-700 pl-9 placeholder:text-gray-400",value:n,onChange:b=>s(b.target.value)})]}),S?r.jsx("div",{className:"space-y-2",children:p.map([...Array(5).keys()],b=>r.jsx("div",{className:"w-full bg-gray-200 rounded h-9 animate-pulse"},b))}):p.isEmpty(v)?r.jsxs("div",{className:"h-[70vh] flex flex-col gap-y-1 items-center justify-center text-slate-500 text-sm font-medium",children:[r.jsx(M.File,{className:"h-6 w-6 stroke-[1]"}),"Empty List!",r.jsx("span",{className:"font-light",children:"Add new page to start"})]}):r.jsx("div",{className:"text-sm text-slate-700 space-y-2 h-[70vh] overflow-y-auto",children:p.map(v,b=>b.children.length>0?r.jsxs("div",{className:"border-0",children:[r.jsx(kn,{changeActivePage:A,setUnpublishPage:l,setDeletePage:i,setAddEditPage:h,active:N===b.id,page:b}),r.jsx("div",{className:"pt-2 pl-6 bg-white",children:p.map(p.get(b,"children",[]),_=>{const V=N===p.get(_,"id");return r.jsx(kn,{parentSlug:b.slug,changeActivePage:A,setUnpublishPage:l,setDeletePage:i,setAddEditPage:h,active:V,page:_})})})]},b.key):r.jsx(kn,{changeActivePage:A,setUnpublishPage:l,setDeletePage:i,setAddEditPage:h,active:N===b.id,page:b}))})]}),r.jsxs(d.Button,{className:"flex text-sm gap-x-2",onClick:()=>{h({slug:"",name:"",pageType:"page"})},children:[r.jsx(M.Plus,{className:"w-4 h-4"})," Add New"]}),c&&r.jsx(Zi,{editPage:A,addEditPage:c,setAddEditPage:h}),a&&r.jsx(yr,{page:a,onClose:()=>i(null)}),o&&r.jsx(Xn,{page:o,onClose:()=>l(null)})]})},to=()=>{const e=Fe("logo",null);return e?r.jsx("div",{className:"w-full max-h-9 overflow-hidden pr-2",children:j.createElement(e,{})}):null},no=()=>{const[e]=Ke(),t=e.get("page"),{data:n,isFetching:s}=Re(),[a,i]=j.useState(!1),o=!!t&&!p.isEmpty(n),l=!t||!s&&p.isEmpty(n)||a;return r.jsxs(r.Fragment,{children:[r.jsxs(d.Button,{variant:"secondary",className:"flex items-center w-full space-x-2 py-1",onClick:()=>i(!0),children:[r.jsx("div",{children:r.jsx(M.Logs,{className:"h-4 w-4"})}),r.jsxs("span",{className:"truncate leading-tight flex items-center max-w-[200px]",children:[r.jsx("span",{className:"text-slate-600 pr-1 font-light",children:"Editing:"}),s?r.jsx(M.Loader,{className:"h-4 w-4 animate-spin text-slate-400 ml-2"}):p.startCase(p.get(n,"name"))??""]})]},"template-viewer"),r.jsx(d.Sheet,{open:l,onOpenChange:c=>!c&&o&&i(!1),children:r.jsx(d.SheetContent,{side:"left",className:`!max-w-screen-sm border-border w-full ${o?"":"sheet-hide-close-btn"}`,children:r.jsx(eo,{close:()=>i(!1)})})})]})},so=()=>{const{fallbackLang:e,languages:t,selectedLang:n,setSelectedLang:s}=Le.useLanguages(),a=p.isEmpty(n)?e:n,[i,o]=j.useState(null),{data:l}=Re(),{data:c}=zn(),{data:h,isFetching:y}=Qn(),g=j.useMemo(()=>{const S=p.compact(p.map(p.get(c,"languages"),x=>{const C=p.find(h,{lang:x});return{key:x,value:p.get(Ge,x,x),isLangPageAdded:!!C}})).filter(Boolean);return[{key:e,value:p.get(Ge,e),isLangPageAdded:!0},...S]},[e,h,c]);return p.isEmpty(t)||y?null:r.jsxs(r.Fragment,{children:[r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,className:"focus:outline-none",children:r.jsxs(d.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[r.jsx(M.Languages,{className:"w-4 h-4"}),p.get(Ge,a,a),r.jsx(M.ChevronDown,{className:"w-4 h-4"})]})}),r.jsxs(d.DropdownMenuContent,{className:"border-border space-y-1",children:[p.map(g.filter(S=>S.isLangPageAdded),S=>r.jsxs(d.DropdownMenuItem,{className:Le.mergeClasses("flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",S.key===a&&"!bg-gray-200 text-gray-700"),onClick:()=>s(S.key),children:[r.jsx("div",{className:"text-slate-600",children:S.value}),S.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"]})]},S.value)),!p.isEmpty(g.filter(S=>!S.isLangPageAdded))&&r.jsxs(r.Fragment,{children:[r.jsx(d.Separator,{}),r.jsxs(d.Button,{size:"sm",variant:"ghost",onClick:()=>{o({name:l==null?void 0:l.name,pageType:l==null?void 0:l.pageType,lang:"",slug:"",edit:!1})},className:"hover:bg-slate-300 duration-200 font-normal text-xs hover:text-slate-800",children:[r.jsx(M.Plus,{className:"w-3 h-3 mr-1"})," Add Langauge"]})]})]})]}),i&&r.jsx(pr,{languages:t,langProps:i,onClose:()=>o(null)})]})};function ro(){return r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(to,{}),r.jsx(no,{}),r.jsx(so,{})]})}const ao=()=>{const e=fe(),t=he();return K.useQuery({queryKey:[G.GET_CHANGES],queryFn:async()=>t(e,{action:G.GET_CHANGES})})};var Jn={};(function e(t,n,s,a){var i=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),o=typeof Path2D=="function"&&typeof DOMMatrix=="function",l=function(){if(!t.OffscreenCanvas)return!1;var m=new OffscreenCanvas(1,1),f=m.getContext("2d");f.fillRect(0,0,1,1);var k=m.transferToImageBitmap();try{f.createPattern(k,"no-repeat")}catch{return!1}return!0}();function c(){}function h(m){var f=n.exports.Promise,k=f!==void 0?f:t.Promise;return typeof k=="function"?new k(m):(m(c,c),null)}var y=function(m,f){return{transform:function(k){if(m)return k;if(f.has(k))return f.get(k);var L=new OffscreenCanvas(k.width,k.height),B=L.getContext("2d");return B.drawImage(k,0,0),f.set(k,L),L},clear:function(){f.clear()}}}(l,new Map),g=function(){var m=Math.floor(16.666666666666668),f,k,L={},B=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(f=function(H){var W=Math.random();return L[W]=requestAnimationFrame(function I(F){B===F||B+m-1<F?(B=F,delete L[W],H()):L[W]=requestAnimationFrame(I)}),W},k=function(H){L[H]&&cancelAnimationFrame(L[H])}):(f=function(H){return setTimeout(H,m)},k=function(H){return clearTimeout(H)}),{frame:f,cancel:k}}(),S=function(){var m,f,k={};function L(B){function H(W,I){B.postMessage({options:W||{},callback:I})}B.init=function(I){var F=I.transferControlToOffscreen();B.postMessage({canvas:F},[F])},B.fire=function(I,F,Z){if(f)return H(I,null),f;var ae=Math.random().toString(36).slice(2);return f=h(function(ie){function le(pe){pe.data.callback===ae&&(delete k[ae],B.removeEventListener("message",le),f=null,y.clear(),Z(),ie())}B.addEventListener("message",le),H(I,ae),k[ae]=le.bind(null,{data:{callback:ae}})}),f},B.reset=function(){B.postMessage({reset:!0});for(var I in k)k[I](),delete k[I]}}return function(){if(m)return m;if(!s&&i){var B=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
|
|
31
|
-
`);try{m=new Worker(URL.createObjectURL(new Blob([B])))}catch(H){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",H),null}L(m)}return m}}(),x={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function C(m,f){return f?f(m):m}function N(m){return m!=null}function A(m,f,k){return C(m&&N(m[f])?m[f]:x[f],k)}function v(m){return m<0?0:Math.floor(m)}function b(m,f){return Math.floor(Math.random()*(f-m))+m}function _(m){return parseInt(m,16)}function V(m){return m.map($)}function $(m){var f=String(m).replace(/[^0-9a-f]/gi,"");return f.length<6&&(f=f[0]+f[0]+f[1]+f[1]+f[2]+f[2]),{r:_(f.substring(0,2)),g:_(f.substring(2,4)),b:_(f.substring(4,6))}}function Se(m){var f=A(m,"origin",Object);return f.x=A(f,"x",Number),f.y=A(f,"y",Number),f}function be(m){m.width=document.documentElement.clientWidth,m.height=document.documentElement.clientHeight}function q(m){var f=m.getBoundingClientRect();m.width=f.width,m.height=f.height}function Y(m){var f=document.createElement("canvas");return f.style.position="fixed",f.style.top="0px",f.style.left="0px",f.style.pointerEvents="none",f.style.zIndex=m,f}function w(m,f,k,L,B,H,W,I,F){m.save(),m.translate(f,k),m.rotate(H),m.scale(L,B),m.arc(0,0,1,W,I,F),m.restore()}function P(m){var f=m.angle*(Math.PI/180),k=m.spread*(Math.PI/180);return{x:m.x,y:m.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:m.startVelocity*.5+Math.random()*m.startVelocity,angle2D:-f+(.5*k-Math.random()*k),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:m.color,shape:m.shape,tick:0,totalTicks:m.ticks,decay:m.decay,drift:m.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:m.gravity*3,ovalScalar:.6,scalar:m.scalar,flat:m.flat}}function ce(m,f){f.x+=Math.cos(f.angle2D)*f.velocity+f.drift,f.y+=Math.sin(f.angle2D)*f.velocity+f.gravity,f.velocity*=f.decay,f.flat?(f.wobble=0,f.wobbleX=f.x+10*f.scalar,f.wobbleY=f.y+10*f.scalar,f.tiltSin=0,f.tiltCos=0,f.random=1):(f.wobble+=f.wobbleSpeed,f.wobbleX=f.x+10*f.scalar*Math.cos(f.wobble),f.wobbleY=f.y+10*f.scalar*Math.sin(f.wobble),f.tiltAngle+=.1,f.tiltSin=Math.sin(f.tiltAngle),f.tiltCos=Math.cos(f.tiltAngle),f.random=Math.random()+2);var k=f.tick++/f.totalTicks,L=f.x+f.random*f.tiltCos,B=f.y+f.random*f.tiltSin,H=f.wobbleX+f.random*f.tiltCos,W=f.wobbleY+f.random*f.tiltSin;if(m.fillStyle="rgba("+f.color.r+", "+f.color.g+", "+f.color.b+", "+(1-k)+")",m.beginPath(),o&&f.shape.type==="path"&&typeof f.shape.path=="string"&&Array.isArray(f.shape.matrix))m.fill(Me(f.shape.path,f.shape.matrix,f.x,f.y,Math.abs(H-L)*.1,Math.abs(W-B)*.1,Math.PI/10*f.wobble));else if(f.shape.type==="bitmap"){var I=Math.PI/10*f.wobble,F=Math.abs(H-L)*.1,Z=Math.abs(W-B)*.1,ae=f.shape.bitmap.width*f.scalar,ie=f.shape.bitmap.height*f.scalar,le=new DOMMatrix([Math.cos(I)*F,Math.sin(I)*F,-Math.sin(I)*Z,Math.cos(I)*Z,f.x,f.y]);le.multiplySelf(new DOMMatrix(f.shape.matrix));var pe=m.createPattern(y.transform(f.shape.bitmap),"no-repeat");pe.setTransform(le),m.globalAlpha=1-k,m.fillStyle=pe,m.fillRect(f.x-ae/2,f.y-ie/2,ae,ie),m.globalAlpha=1}else if(f.shape==="circle")m.ellipse?m.ellipse(f.x,f.y,Math.abs(H-L)*f.ovalScalar,Math.abs(W-B)*f.ovalScalar,Math.PI/10*f.wobble,0,2*Math.PI):w(m,f.x,f.y,Math.abs(H-L)*f.ovalScalar,Math.abs(W-B)*f.ovalScalar,Math.PI/10*f.wobble,0,2*Math.PI);else if(f.shape==="star")for(var Q=Math.PI/2*3,xe=4*f.scalar,Ee=8*f.scalar,Ae=f.x,_e=f.y,Pe=5,ke=Math.PI/Pe;Pe--;)Ae=f.x+Math.cos(Q)*Ee,_e=f.y+Math.sin(Q)*Ee,m.lineTo(Ae,_e),Q+=ke,Ae=f.x+Math.cos(Q)*xe,_e=f.y+Math.sin(Q)*xe,m.lineTo(Ae,_e),Q+=ke;else m.moveTo(Math.floor(f.x),Math.floor(f.y)),m.lineTo(Math.floor(f.wobbleX),Math.floor(B)),m.lineTo(Math.floor(H),Math.floor(W)),m.lineTo(Math.floor(L),Math.floor(f.wobbleY));return m.closePath(),m.fill(),f.tick<f.totalTicks}function ue(m,f,k,L,B){var H=f.slice(),W=m.getContext("2d"),I,F,Z=h(function(ae){function ie(){I=F=null,W.clearRect(0,0,L.width,L.height),y.clear(),B(),ae()}function le(){s&&!(L.width===a.width&&L.height===a.height)&&(L.width=m.width=a.width,L.height=m.height=a.height),!L.width&&!L.height&&(k(m),L.width=m.width,L.height=m.height),W.clearRect(0,0,L.width,L.height),H=H.filter(function(pe){return ce(W,pe)}),H.length?I=g.frame(le):ie()}I=g.frame(le),F=ie});return{addFettis:function(ae){return H=H.concat(ae),Z},canvas:m,promise:Z,reset:function(){I&&g.cancel(I),F&&F()}}}function je(m,f){var k=!m,L=!!A(f||{},"resize"),B=!1,H=A(f,"disableForReducedMotion",Boolean),W=i&&!!A(f||{},"useWorker"),I=W?S():null,F=k?be:q,Z=m&&I?!!m.__confetti_initialized:!1,ae=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ie;function le(Q,xe,Ee){for(var Ae=A(Q,"particleCount",v),_e=A(Q,"angle",Number),Pe=A(Q,"spread",Number),ke=A(Q,"startVelocity",Number),xn=A(Q,"decay",Number),bt=A(Q,"gravity",Number),vn=A(Q,"drift",Number),Xt=A(Q,"colors",V),Jt=A(Q,"ticks",Number),Et=A(Q,"shapes"),Zt=A(Q,"scalar"),bn=!!A(Q,"flat"),St=Se(Q),wt=Ae,jt=[],En=m.width*St.x,Sn=m.height*St.y;wt--;)jt.push(P({x:En,y:Sn,angle:_e,spread:Pe,startVelocity:ke,color:Xt[wt%Xt.length],shape:Et[b(0,Et.length)],ticks:Jt,decay:xn,gravity:bt,drift:vn,scalar:Zt,flat:bn}));return ie?ie.addFettis(jt):(ie=ue(m,jt,F,xe,Ee),ie.promise)}function pe(Q){var xe=H||A(Q,"disableForReducedMotion",Boolean),Ee=A(Q,"zIndex",Number);if(xe&&ae)return h(function(ke){ke()});k&&ie?m=ie.canvas:k&&!m&&(m=Y(Ee),document.body.appendChild(m)),L&&!Z&&F(m);var Ae={width:m.width,height:m.height};I&&!Z&&I.init(m),Z=!0,I&&(m.__confetti_initialized=!0);function _e(){if(I){var ke={getBoundingClientRect:function(){if(!k)return m.getBoundingClientRect()}};F(ke),I.postMessage({resize:{width:ke.width,height:ke.height}});return}Ae.width=Ae.height=null}function Pe(){ie=null,L&&(B=!1,t.removeEventListener("resize",_e)),k&&m&&(document.body.contains(m)&&document.body.removeChild(m),m=null,Z=!1)}return L&&!B&&(B=!0,t.addEventListener("resize",_e,!1)),I?I.fire(Q,Ae,Pe):le(Q,Ae,Pe)}return pe.reset=function(){I&&I.reset(),ie&&ie.reset()},pe}var De;function He(){return De||(De=je(null,{useWorker:!0,resize:!0})),De}function Me(m,f,k,L,B,H,W){var I=new Path2D(m),F=new Path2D;F.addPath(I,new DOMMatrix(f));var Z=new Path2D;return Z.addPath(F,new DOMMatrix([Math.cos(W)*B,Math.sin(W)*B,-Math.sin(W)*H,Math.cos(W)*H,k,L])),Z}function Qt(m){if(!o)throw new Error("path confetti are not supported in this browser");var f,k;typeof m=="string"?f=m:(f=m.path,k=m.matrix);var L=new Path2D(f),B=document.createElement("canvas"),H=B.getContext("2d");if(!k){for(var W=1e3,I=W,F=W,Z=0,ae=0,ie,le,pe=0;pe<W;pe+=2)for(var Q=0;Q<W;Q+=2)H.isPointInPath(L,pe,Q,"nonzero")&&(I=Math.min(I,pe),F=Math.min(F,Q),Z=Math.max(Z,pe),ae=Math.max(ae,Q));ie=Z-I,le=ae-F;var xe=10,Ee=Math.min(xe/ie,xe/le);k=[Ee,0,0,Ee,-Math.round(ie/2+I)*Ee,-Math.round(le/2+F)*Ee]}return{type:"path",path:f,matrix:k}}function Yt(m){var f,k=1,L="#000000",B='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof m=="string"?f=m:(f=m.text,k="scalar"in m?m.scalar:k,B="fontFamily"in m?m.fontFamily:B,L="color"in m?m.color:L);var H=10*k,W=""+H+"px "+B,I=new OffscreenCanvas(H,H),F=I.getContext("2d");F.font=W;var Z=F.measureText(f),ae=Math.ceil(Z.actualBoundingBoxRight+Z.actualBoundingBoxLeft),ie=Math.ceil(Z.actualBoundingBoxAscent+Z.actualBoundingBoxDescent),le=2,pe=Z.actualBoundingBoxLeft+le,Q=Z.actualBoundingBoxAscent+le;ae+=le+le,ie+=le+le,I=new OffscreenCanvas(ae,ie),F=I.getContext("2d"),F.font=W,F.fillStyle=L,F.fillText(f,pe,Q);var xe=1/k;return{type:"bitmap",bitmap:I.transferToImageBitmap(),matrix:[xe,0,0,xe,-ae*xe/2,-ie*xe/2]}}n.exports=function(){return He().apply(this,arguments)},n.exports.reset=function(){He().reset()},n.exports.create=je,n.exports.shapeFromPath=Qt,n.exports.shapeFromText=Yt})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),Jn,!1);const Es=Jn.exports;Jn.exports.create;const Fn=e=>{Es(e==="TOP_RIGHT"?{particleCount:200,angle:225,spread:120,origin:{x:.9,y:0}}:{particleCount:350,spread:120,origin:{y:.6},angle:90})};function io({onClose:e=()=>console.log("Cancelled")}){const[t,n]=j.useState([]),{data:s,isFetching:a}=ao(),{data:i}=zt(),o=j.useMemo(()=>p.filter(s,v=>v.pageType!=="global"),[s]),l=j.useMemo(()=>p.filter(s,{pageType:"global"}),[s]),c=j.useMemo(()=>p.find(s,{pageType:"theme",id:"THEME"}),[s]),{mutate:h,isPending:y}=gr();j.useEffect(()=>{const v=p.map(p.filter(s,{online:!0}),"id");c&&v.push(c==null?void 0:c.id),n(v)},[s,c]);const g=t.length===(s==null?void 0:s.length),S=v=>{n(b=>p.includes(b,v)?p.filter(b,_=>_!==v):p.concat(b,v))},x=()=>{n(g?[]:p.map(s,"id"))},C=()=>{h({ids:p.uniq(t)},{onSuccess:()=>{e(),Fn("CENTER_CENTER")}})},N=v=>{if(v==="global")return"Global Block";if(v==="theme")return"Theme";const b=p.find(i,{key:v});return b?b==null?void 0:b.name:v},A=j.useMemo(()=>{const v=[{label:"Updated Pages & Global Blocks",top:"pt-2"},...p.orderBy(p.filter(o,{online:!0}),"pageType"),...p.orderBy(p.filter(l,{online:!0}),"pageType")].filter(V=>V.pageType!=="theme"),b=[{label:"Offline Pages & Global Blocks",top:"pt-6"},...p.orderBy(p.filter(o,{online:!1}),"pageType"),...p.orderBy(p.filter(l,{online:!1}),"pageType")],_=c?[{label:"Theme",top:"pt-6"},c]:[];return[...v,..._,...b]},[o,l,c]);return r.jsx(d.Dialog,{open:!0,onOpenChange:y?()=>{}:e,children:r.jsxs(d.DialogContent,{className:"max-w-4xl max-h-[80%] flex flex-col",children:[r.jsxs(d.DialogHeader,{children:[r.jsx(d.DialogTitle,{children:"Publish changes"}),r.jsx(d.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),r.jsx("div",{className:"relative -mx-4 h-full overflow-y-auto max-h-full no-scrollbar",children:a?r.jsxs("div",{className:"space-y-2 px-1",children:[r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse mt-2"}),r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"}),r.jsx("div",{className:"bg-gray-200 h-6 w-full rounded animate-pulse"})]}):r.jsxs("table",{className:"w-full text-xs text-left rtl:text-right text-gray-500 dark:text-gray-400",children:[r.jsx("thead",{className:"text-gray-700 border-b bg-gray-50 dark:bg-gray-700 dark:text-gray-400",children:r.jsxs("tr",{children:[r.jsxs("th",{scope:"col",className:"px-6 py-3 flex items-center gap-x-2 w-[1 50px]",children:[r.jsx("input",{checked:g,onClick:v=>{v.stopPropagation(),x()},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 mt-1 cursor-pointer"}),"Name"]}),r.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Language"}),r.jsx("th",{scope:"col",className:"px-2 py-3 w-[100px]",children:"Type"}),r.jsx("th",{scope:"col",className:"px-4 py-3 w-[150px] text-right",children:"Status"})]})}),r.jsx("tbody",{children:p.map(A,v=>v.label?r.jsx("tr",{children:r.jsxs("td",{colSpan:4,className:`px-6 py-2 text-xs font-medium text-gray-800 relative ${v.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:v.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:p.includes(t,v==null?void 0:v.id),onClick:b=>{b.stopPropagation(),S(v==null?void 0:v.id)},type:"checkbox",className:"rounded focus:outline-none focus:ring-0 cursor-pointer"})," ",v.pageType==="global"?r.jsx(M.GlobeIcon,{className:"h-4 w-4"}):r.jsx(M.File,{className:"h-4 w-4"}),v.name,v.slug&&r.jsxs("span",{className:"text-xs text-gray-500",children:["(",v.slug,")"]})]}),r.jsx("td",{className:"px-2",children:v.lang}),r.jsx("td",{className:"px-2",children:N(v==null?void 0:v.pageType)}),r.jsx("td",{className:"px-4 text-right",children:p.first(v.changes)||""})]},v==null?void 0:v.id))})]})}),r.jsxs(d.DialogFooter,{className:"mt-10",children:[r.jsx(d.Button,{disabled:y,variant:"outline",onClick:e,children:"Cancel"}),r.jsx(d.Button,{disabled:y||a||p.isEmpty(s),onClick:C,children:y?"Publishing...":"Publish"})]})]})})}const oo=()=>{const e=he(),t=fe();return K.useQuery({queryKey:[G.GET_WEBSITE_DATA],staleTime:1e3*60*5,queryFn:async()=>e(t,{action:G.GET_WEBSITE_DATA,data:{draft:!0}})})};function lo({onClose:e}){const{data:t,isFetching:n}=oo(),{mutateAsync:s,isPending:a}=Ui(),i=Fe("settingComponent",null),o=p.debounce(async l=>(await s({data:l}),!0),300);return i?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(i,{data:t||{},onSave:a?()=>{}:o,cancel:a?()=>{}:e})})]})}):null}function vr({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 co=()=>{const e=Fe("getPreviewUrl",async o=>o),[t,n]=j.useState(""),{data:s,isFetching:a}=Re(),i=j.useMemo(()=>s==null?void 0:s.slug,[s==null?void 0:s.slug]);return j.useEffect(()=>{(async()=>{if(i&&typeof e=="function"){const o=await e(i||"");n(o)}else n("")})()},[e,i]),!t||(s==null?void 0:s.pageType)==="global"||a?null:r.jsx(r.Fragment,{children:r.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:r.jsxs(d.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[r.jsx(M.Eye,{className:"w-4 h-4"})," ",D.PREVIEW]})})})},uo=()=>{const[e,t]=Le.useRightPanel();return r.jsxs(r.Fragment,{children:[r.jsx(vr,{content:D.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"})]})},fo=()=>{const[e,t]=j.useState(!1),{isLocked:n}=Kt(),{savePage:s,saveState:a}=Le.useSavePage();j.useEffect(()=>{const y=g=>{a==="UNSAVED"&&(g.preventDefault(),g.returnValue=!1)};return a==="UNSAVED"&&window.addEventListener("beforeunload",y),()=>{window.removeEventListener("beforeunload",y)}},[a]);const i=j.useCallback(async()=>{t(!0),await s(!1)},[s]);j.useEffect(()=>{a==="SAVED"&&t(!1)},[a]);const o=j.useMemo(()=>{if(a==="SAVED"||a==="UNSAVED")return a;if(a==="SAVING")return e?a:"SAVED"},[e,a]),{buttonIcon:l,buttonClass:c,tooltipContent:h}=j.useMemo(()=>{switch(o){case"UNSAVED":return{tooltipContent:D.SAVEDRAFT,buttonIcon:r.jsx(M.Save,{className:"w-4 h-4"}),buttonClass:"flex items-center gap-x-1 leading-tight"};case"SAVING":return{tooltipContent:D.SAVING,buttonIcon:r.jsx(M.Loader,{className:"w-4 h-4 animate-spin"}),buttonClass:"flex items-center gap-x-1 leading-tight"};case"SAVED":return{tooltipContent:D.SAVED,buttonIcon:r.jsx(M.CheckCircle,{className:"w-4 h-4"}),buttonClass:"text-green-500 flex items-center gap-x-1 leading-tight"}}},[o]);return n?null:r.jsxs(d.Button,{size:"sm",variant:"ghost",onClick:i,className:c,children:[l," ",h]})},ho=()=>{const[e,t]=j.useState(!1),[n,s]=j.useState(!1),[a,i]=j.useState(null),{data:o}=Re(),{mutate:l,isPending:c}=gr(),[h]=Le.useBlocksStore(),{buttonText:y,buttonClassName:g,isPublished:S}=j.useMemo(()=>{const C=o&&(o==null?void 0:o.online);return{buttonClassName:C?"hover:bg-green-600 bg-green-500":"",isPublished:C,buttonText:C?D.PUBLISHED:D.PUBLISH}},[o]),x=async()=>{var N,A;const C=((A=(N=h==null?void 0:h.filter(v=>(v==null?void 0:v._type)==="GlobalBlock"))==null?void 0:N.map(v=>v==null?void 0:v.globalBlock))==null?void 0:A.filter(v=>typeof v=="string"))||[];l({ids:[o==null?void 0:o.id,...C]},{onSuccess:()=>Fn("TOP_RIGHT")})};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex",children:[r.jsxs(d.Button,{size:"sm",onClick:x,disabled:c||!(o!=null&&o.id),className:`relative overflow-hidden transition-all duration-300 ease-in-out text-white flex items-center gap-1 rounded-r-none ${g}`,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:[r.jsx("span",{className:`flex items-center transition-transform duration-300 ease-in-out ${n?"-translate-y-10":""}`,children:S?r.jsx(M.Send,{className:"w-4 h-4"}):r.jsx(M.Rocket,{className:"w-4 h-4"})}),r.jsx("span",{className:`absolute inset-0 flex items-center left-3 transition-transform duration-300 ease-in-out ${n?"":"translate-y-10"}`,children:S?r.jsx(M.Rocket,{className:"w-4 h-4"}):r.jsx(M.Send,{className:"w-4 h-4"})}),r.jsx("span",{children:y})]}),r.jsxs(d.DropdownMenu,{children:[r.jsx(d.DropdownMenuTrigger,{asChild:!0,children:r.jsx(d.Button,{size:"sm",disabled:c||!(o!=null&&o.id),className:`px-2 text-white border-l border-white/50 rounded-l-none ${g}`,children:r.jsx(M.ChevronDown,{className:"w-4 h-4"})})}),r.jsxs(d.DropdownMenuContent,{align:"end",className:"w-36",children:[!S&&r.jsxs(d.DropdownMenuItem,{disabled:c,className:"text-xs cursor-pointer",onClick:()=>l({ids:[o==null?void 0:o.id]},{onSuccess:()=>Fn("TOP_RIGHT")}),children:[D.PUBLISH," page"]}),r.jsxs(d.DropdownMenuItem,{onClick:()=>t(!0),className:"text-xs cursor-pointer",children:[D.OPEN," publish menu"]}),S&&r.jsxs(d.DropdownMenuItem,{onClick:()=>i(o),className:"text-xs cursor-pointer",children:[D.UNPUBLISH," page"]})]})]})]}),e&&r.jsx(io,{onClose:()=>t(!1)}),a&&r.jsx(Xn,{page:a,onClose:()=>i(null)})]})},mo=()=>{const e=Fe("settingComponent",null),[t,n]=j.useState(!1);return e?r.jsxs(r.Fragment,{children:[r.jsx(vr,{content:D.WEBSITEDATA,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"})})}),t&&r.jsx(lo,{onClose:()=>n(!1)}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]}):null},go=()=>{const{data:e}=Re(),t=e&&(e==null?void 0:e.online);return(e==null?void 0:e.pageType)==="global"?null:r.jsxs(d.Button,{onClick:()=>t&&window.open(`${window.location.origin}${e.slug}`,"_blank"),disabled:!t,variant:"ghost",size:"sm",className:"flex items-center gap-1",children:[r.jsx(M.ExternalLink,{className:"w-4 h-4"}),r.jsx("span",{className:"hidden sm:inline",children:D.OPEN})]})};function yo(){const{isLocked:e}=Kt();return e?null:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(uo,{}),r.jsx(mo,{}),r.jsx(co,{}),r.jsx(fo,{}),r.jsx(ho,{}),r.jsx(go,{})]})}Dr.loadWebBlocks();const po=e=>{const t=j.useRef([]),[n]=Ke(),s=n.get("page"),{data:a}=Re(),{data:i}=Mi(),{data:o,isFetching:l}=fr(),{blocks:c}=Li(o),{data:h}=zn(),{data:y}=zt(),{mutateAsync:g}=Gi(),S=ki(),{getUILibraryBlock:x,getUILibraryBlocks:C,onSave:N}=Bi(),{getGlobalBlocks:A,getGlobalBlockBlocks:v}=Fi(),{aiContext:b,setAiContext:_}=Kn(),{mutateAsync:V}=Ri(),[$,Se]=j.useState(!1);j.useEffect(()=>{const P=()=>{document.hidden?Se(!0):Se(!1)};return window.addEventListener("visibilitychange",P),()=>window.removeEventListener("visibilitychange",P)},[]),t.current=c;const be=j.useMemo(()=>{const P={};return e.mediaManagerComponent&&(P.mediaManagerComponent=e.mediaManagerComponent),P},[e.mediaManagerComponent]),q=j.useMemo(()=>Array.isArray(e==null?void 0:e.uiLibraries)?[...i,...e==null?void 0:e.uiLibraries]:i,[i,e==null?void 0:e.uiLibraries]),Y=j.useCallback(async(P,ce)=>await V({pageType:P,query:ce}),[V]),w=j.useMemo(()=>p.get(h,"theme",{})||{},[h]);return r.jsxs(r.Fragment,{children:[l&&r.jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center w-screen h-screen bg-white/30",children:r.jsx("div",{className:"flex items-center justify-center bg-white rounded-full size-10",children:r.jsx(M.Loader2,{className:"size-5 animate-spin"})})}),r.jsx(Le.ChaiBuilderEditor,{pageId:a==null?void 0:a.id,addBlocksDialogTabs:e.addBlocksDialogTabs||[],loading:l,fallbackLang:h.fallbackLang||"en",languages:(h==null?void 0:h.languages)||[],brandingOptions:(h==null?void 0:h.theme)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSaveSupport:!$&&(e.autoSaveSupport??!0),autoSaveInterval:e.autoSaveInterval??15,onError:e.onError||console.error,getGlobalBlockBlocks:v,getGlobalBlocks:A,blocks:l?[]:c,theme:p.cloneDeep(w),getUILibraryBlock:x,getUILibraryBlocks:C,uiLibraries:q,pageTypes:y,searchPageTypeItems:Y,saveAiContextCallback:async P=>{if(!s)return!0;const ce=t.current,ue={_type:"@chai/ai-context",_value:p.isString(P)?P:""},je=[...ce,ue];return await N({page:s,blocks:je}),_(P),!0},aiContext:b,askAiCallBack:S,onSave:async({blocks:P,theme:ce})=>{if(!s)return!0;t.current=P;const ue={_type:"@chai/ai-context",_value:p.isString(b)?b:""},je=[...P,ue];return await N({page:s,blocks:je}),t.current=P,p.isEqual(ce,w)||await g({settings:{theme:ce}}),!0},topBarComponents:{left:[ro],right:[yo]},sideBarComponents:{top:[...(a==null?void 0:a.pageType)!=="global"?[{label:"SEO Setting",component:xr,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"})]})})}]:[],...p.isEmpty(h==null?void 0:h.languages)?[]:[{label:`Language ${(a==null?void 0:a.pageType)==="global"?"":"page"}`,component:Ki,icon:r.jsx(M.Languages,{className:"w-5 h-5 stroke-[2]"})}]],bottom:[...e!=null&&e.sidebarBottomComponents?[...e.sidebarBottomComponents]:[]]},...be}),r.jsx(Qi,{})]})},xo=new K.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnReconnect:!1}}}),vo=e=>{const[,t]=dr(),[n,s]=j.useState(!1);return j.useEffect(()=>(t(p.pick(e,["apiUrl","getPreviewUrl","logo","settingComponent","user","onSessionExpired","pageLockComponent"])),setTimeout(()=>{s(!0)},200),()=>{s(!1),t({})}),[e,t]),n?r.jsxs(K.QueryClientProvider,{client:xo,children:[r.jsx(po,{...e}),r.jsx(Ni,{})]}):r.jsx("div",{})};exports.$TRACK=qn;exports.ChaiBuilderForge=vo;exports.Dynamic=Da;exports.For=oa;exports.Index=la;exports.Match=da;exports.Portal=La;exports.Show=ca;exports.Switch=ua;exports.addEventListener=qs;exports.batch=Hr;exports.className=Fs;exports.clearDelegatedEvents=wa;exports.convertRemToPixels=Si;exports.createComponent=$n;exports.createComputed=_s;exports.createContext=Qr;exports.createEffect=Hn;exports.createMemo=Te;exports.createRenderEffect=$e;exports.createRoot=We;exports.createSignal=de;exports.createUniqueId=ia;exports.delegateEvents=Bs;exports.deleteNestedDataByPath=_t;exports.displayValue=yi;exports.getMutationStatusColor=mi;exports.getPreferredColorScheme=wi;exports.getQueryStatusColor=hi;exports.getQueryStatusColorByLabel=gi;exports.getQueryStatusLabel=di;exports.getSidedProp=fi;exports.insert=hn;exports.mergeProps=Vn;exports.mutationSortFns=Ei;exports.on=Wr;exports.onCleanup=pt;exports.onMount=Ps;exports.serialize=or;exports.setAttribute=fn;exports.sortFns=vi;exports.splitProps=Gs;exports.spread=Hs;exports.stringify=ui;exports.template=Sa;exports.untrack=ve;exports.updateNestedDataByPath=Nt;exports.use=Ws;exports.useContext=Yr;exports.useTransition=zr;
|