@chaibuilder/pages 0.1.0-beta.13 → 0.1.0-beta.131
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-ZZRzApPd.js +9104 -0
- package/dist/B4MFY5CR-xjGwDOcl.cjs +1200 -0
- package/dist/ChaiBuilderPages-CyHr8byZ.cjs +2 -0
- package/dist/ChaiBuilderPages-DYaYUYo3.js +5804 -0
- package/dist/HO4MOOFI-CdR1fBwC.cjs +1 -0
- package/dist/HO4MOOFI-DUCL54uW.js +33 -0
- package/dist/HUY7CZI3-dwPlfeQ0.js +42 -0
- package/dist/HUY7CZI3-kvDxS9VQ.cjs +1 -0
- package/dist/index.cjs +1 -30
- package/dist/index.d.ts +23 -3
- package/dist/index.js +9 -2185
- package/dist/pages.css +1 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +0 -1
- package/dist/runtime.js +0 -1
- package/dist/server.cjs +1 -1
- package/dist/server.d.ts +51 -15
- package/dist/server.js +182 -69
- package/package.json +89 -57
- package/dist/style.css +0 -6
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var Ns=e=>{throw TypeError(e)};var Cs=(e,t,s)=>t.has(e)||Ns("Cannot "+s);var G=(e,t,s)=>(Cs(e,t,"read from private field"),s?s.call(e):t.get(e)),X=(e,t,s)=>t.has(e)?Ns("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),z=(e,t,s,n)=>(Cs(e,t,"write to private field"),n?n.call(e,s):t.set(e,s),s);const r=require("react/jsx-runtime"),xe=require("@chaibuilder/sdk"),Vn=require("@chaibuilder/sdk/web-blocks"),F=require("@tanstack/react-query"),E=require("react"),y=require("lodash-es"),I=require("lucide-react"),Ht=require("jotai"),Ms=require("@chaibuilder/runtime"),ee=require("sonner"),u=require("@chaibuilder/sdk/ui");function Kn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const ue=Kn(E);var O={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return As(this.context.count)},getNextContextId(){return As(this.context.count++)}};function As(e){const t=String(e),s=t.length-1;return O.context.id+(s?String.fromCharCode(96+s):"")+t}function it(e){O.context=e}var Wn=(e,t)=>e===t,Dt=Symbol("solid-proxy"),Bs=typeof Proxy=="function",us=Symbol("solid-track"),Gt={equals:Wn},Rs=Ws,ke=1,Ot=2,Fs={owned:null,cleanups:null,context:null,owner:null},Yt={},K=null,Xt=null,zn=null,Z=null,ge=null,Pe=null,$t=0;function Ie(e,t){const s=Z,n=K,a=e.length===0,i=t===void 0?n:t,o=a?Fs:{owned:null,cleanups:null,context:i?i.context:null,owner:i},l=a?e:()=>e(()=>de(()=>dt(o)));K=o,Z=null;try{return Ne(l,!0)}finally{Z=s,K=n}}function ie(e,t){t=t?Object.assign({},Gt,t):Gt;const s={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},n=a=>(typeof a=="function"&&(a=a(s.value)),Ks(s,a));return[Vs.bind(s),n]}function qs(e,t,s){const n=Vt(e,t,!0,ke);at(n)}function _e(e,t,s){const n=Vt(e,t,!1,ke);at(n)}function ds(e,t,s){Rs=lr;const n=Vt(e,t,!1,ke);(!s||!s.render)&&(n.user=!0),Pe?Pe.push(n):at(n)}function ye(e,t,s){s=s?Object.assign({},Gt,s):Gt;const n=Vt(e,t,!0,0);return n.observers=null,n.observerSlots=null,n.comparator=s.equals||void 0,at(n),Vs.bind(n)}function Qn(e){return e&&typeof e=="object"&&"then"in e}function Yn(e,t,s){let n,a,i;arguments.length===1?(n=!0,a=e,i={}):(n=e,a=t,i={});let o=null,l=Yt,c=null,d=!1,g="initialValue"in i,m=typeof n=="function"&&ye(n);const j=new Set,[x,v]=(i.storage||ie)(i.initialValue),[b,S]=ie(void 0),[C,p]=ie(void 0,{equals:!1}),[N,L]=ie(g?"ready":"unresolved");O.context&&(c=O.getNextContextId(),i.ssrLoadFrom==="initial"?l=i.initialValue:O.load&&O.has(c)&&(l=O.load(c)));function w(M,Q,$,ce){return o===M&&(o=null,ce!==void 0&&(g=!0),(M===l||Q===l)&&i.onHydrated&&queueMicrotask(()=>i.onHydrated(ce,{value:Q})),l=Yt,Y(Q,$)),Q}function Y(M,Q){Ne(()=>{Q===void 0&&v(()=>M),L(Q!==void 0?"errored":g?"ready":"unresolved"),S(Q);for(const $ of j.keys())$.decrement();j.clear()},!1)}function ne(){const M=ar,Q=x(),$=b();if($!==void 0&&!o)throw $;return Z&&Z.user,Q}function U(M=!0){if(M!==!1&&d)return;d=!1;const Q=m?m():n;if(Q==null||Q===!1){w(o,de(x));return}const $=l!==Yt?l:de(()=>a(Q,{value:x(),refetching:M}));return Qn($)?(o=$,"value"in $?($.status==="success"?w(o,$.value,void 0,Q):w(o,void 0,ts($.value),Q),$):(d=!0,queueMicrotask(()=>d=!1),Ne(()=>{L(g?"refreshing":"pending"),p()},!1),$.then(ce=>w($,ce,void 0,Q),ce=>w($,void 0,ts(ce),Q)))):(w(o,$,void 0,Q),$)}return Object.defineProperties(ne,{state:{get:()=>N()},error:{get:()=>b()},loading:{get(){const M=N();return M==="pending"||M==="refreshing"}},latest:{get(){if(!g)return ne();const M=b();if(M&&!o)throw M;return x()}}}),m?qs(()=>U(!1)):U(!1),[ne,{refetch:U,mutate:v}]}function Xn(e){return Ne(e,!1)}function de(e){if(Z===null)return e();const t=Z;Z=null;try{return e()}finally{Z=t}}function Zn(e,t,s){const n=Array.isArray(e);let a,i=s&&s.defer;return o=>{let l;if(n){l=Array(e.length);for(let d=0;d<e.length;d++)l[d]=e[d]()}else l=e();if(i)return i=!1,o;const c=de(()=>t(l,a,o));return a=l,c}}function Hs(e){ds(()=>de(e))}function nt(e){return K===null||(K.cleanups===null?K.cleanups=[e]:K.cleanups.push(e)),e}function Ts(){return K}function Jn(e,t){const s=K,n=Z;K=e,Z=null;try{return Ne(t,!0)}catch(a){hs(a)}finally{K=s,Z=n}}function er(e){const t=Z,s=K;return Promise.resolve().then(()=>{Z=t,K=s;let n;return Ne(e,!1),Z=K=null,n?n.done:void 0})}var[tr,Ii]=ie(!1);function sr(){return[tr,er]}function nr(e,t){const s=Symbol("context");return{id:s,Provider:cr(s),defaultValue:e}}function rr(e){let t;return K&&K.context&&(t=K.context[e.id])!==void 0?t:e.defaultValue}function $s(e){const t=ye(e),s=ye(()=>ss(t()));return s.toArray=()=>{const n=s();return Array.isArray(n)?n:n!=null?[n]:[]},s}var ar;function Vs(){if(this.sources&&this.state)if(this.state===ke)at(this);else{const e=ge;ge=null,Ne(()=>Mt(this),!1),ge=e}if(Z){const e=this.observers?this.observers.length:0;Z.sources?(Z.sources.push(this),Z.sourceSlots.push(e)):(Z.sources=[this],Z.sourceSlots=[e]),this.observers?(this.observers.push(Z),this.observerSlots.push(Z.sources.length-1)):(this.observers=[Z],this.observerSlots=[Z.sources.length-1])}return this.value}function Ks(e,t,s){let n=e.value;return(!e.comparator||!e.comparator(n,t))&&(e.value=t,e.observers&&e.observers.length&&Ne(()=>{for(let a=0;a<e.observers.length;a+=1){const i=e.observers[a],o=Xt&&Xt.running;o&&Xt.disposed.has(i),(o?!i.tState:!i.state)&&(i.pure?ge.push(i):Pe.push(i),i.observers&&zs(i)),o||(i.state=ke)}if(ge.length>1e6)throw ge=[],new Error},!1)),t}function at(e){if(!e.fn)return;dt(e);const t=$t;ir(e,e.value,t)}function ir(e,t,s){let n;const a=K,i=Z;Z=K=e;try{n=e.fn(t)}catch(o){return e.pure&&(e.state=ke,e.owned&&e.owned.forEach(dt),e.owned=null),e.updatedAt=s+1,hs(o)}finally{Z=i,K=a}(!e.updatedAt||e.updatedAt<=s)&&(e.updatedAt!=null&&"observers"in e?Ks(e,n):e.value=n,e.updatedAt=s)}function Vt(e,t,s,n=ke,a){const i={fn:e,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:K,context:K?K.context:null,pure:s};return K===null||K!==Fs&&(K.owned?K.owned.push(i):K.owned=[i]),i}function Ut(e){if(e.state===0)return;if(e.state===Ot)return Mt(e);if(e.suspense&&de(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<$t);)e.state&&t.push(e);for(let s=t.length-1;s>=0;s--)if(e=t[s],e.state===ke)at(e);else if(e.state===Ot){const n=ge;ge=null,Ne(()=>Mt(e,t[0]),!1),ge=n}}function Ne(e,t){if(ge)return e();let s=!1;t||(ge=[]),Pe?s=!0:Pe=[],$t++;try{const n=e();return or(s),n}catch(n){s||(Pe=null),ge=null,hs(n)}}function or(e){if(ge&&(Ws(ge),ge=null),e)return;const t=Pe;Pe=null,t.length&&Ne(()=>Rs(t),!1)}function Ws(e){for(let t=0;t<e.length;t++)Ut(e[t])}function lr(e){let t,s=0;for(t=0;t<e.length;t++){const n=e[t];n.user?e[s++]=n:Ut(n)}if(O.context){if(O.count){O.effects||(O.effects=[]),O.effects.push(...e.slice(0,s));return}it()}for(O.effects&&(O.done||!O.count)&&(e=[...O.effects,...e],s+=O.effects.length,delete O.effects),t=0;t<s;t++)Ut(e[t])}function Mt(e,t){e.state=0;for(let s=0;s<e.sources.length;s+=1){const n=e.sources[s];if(n.sources){const a=n.state;a===ke?n!==t&&(!n.updatedAt||n.updatedAt<$t)&&Ut(n):a===Ot&&Mt(n,t)}}}function zs(e){for(let t=0;t<e.observers.length;t+=1){const s=e.observers[t];s.state||(s.state=Ot,s.pure?ge.push(s):Pe.push(s),s.observers&&zs(s))}}function dt(e){let t;if(e.sources)for(;e.sources.length;){const s=e.sources.pop(),n=e.sourceSlots.pop(),a=s.observers;if(a&&a.length){const i=a.pop(),o=s.observerSlots.pop();n<a.length&&(i.sourceSlots[o]=n,a[n]=i,s.observerSlots[n]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)dt(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)dt(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 ts(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function hs(e,t=K){throw ts(e)}function ss(e){if(typeof e=="function"&&!e.length)return ss(e());if(Array.isArray(e)){const t=[];for(let s=0;s<e.length;s++){const n=ss(e[s]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function cr(e,t){return function(n){let a;return _e(()=>a=de(()=>(K.context={...K.context,[e]:n.value},$s(()=>n.children))),void 0),a}}var ns=Symbol("fallback");function Bt(e){for(let t=0;t<e.length;t++)e[t]()}function ur(e,t,s={}){let n=[],a=[],i=[],o=0,l=t.length>1?[]:null;return nt(()=>Bt(i)),()=>{let c=e()||[],d=c.length,g,m;return c[us],de(()=>{let x,v,b,S,C,p,N,L,w;if(d===0)o!==0&&(Bt(i),i=[],n=[],a=[],o=0,l&&(l=[])),s.fallback&&(n=[ns],a[0]=Ie(Y=>(i[0]=Y,s.fallback())),o=1);else if(o===0){for(a=new Array(d),m=0;m<d;m++)n[m]=c[m],a[m]=Ie(j);o=d}else{for(b=new Array(d),S=new Array(d),l&&(C=new Array(d)),p=0,N=Math.min(o,d);p<N&&n[p]===c[p];p++);for(N=o-1,L=d-1;N>=p&&L>=p&&n[N]===c[L];N--,L--)b[L]=a[N],S[L]=i[N],l&&(C[L]=l[N]);for(x=new Map,v=new Array(L+1),m=L;m>=p;m--)w=c[m],g=x.get(w),v[m]=g===void 0?-1:g,x.set(w,m);for(g=p;g<=N;g++)w=n[g],m=x.get(w),m!==void 0&&m!==-1?(b[m]=a[g],S[m]=i[g],l&&(C[m]=l[g]),m=v[m],x.set(w,m)):i[g]();for(m=p;m<d;m++)m in b?(a[m]=b[m],i[m]=S[m],l&&(l[m]=C[m],l[m](m))):a[m]=Ie(j);a=a.slice(0,o=d),n=c.slice(0)}return a});function j(x){if(i[m]=x,l){const[v,b]=ie(m);return l[m]=b,t(c[m],v)}return t(c[m])}}}function dr(e,t,s={}){let n=[],a=[],i=[],o=[],l=0,c;return nt(()=>Bt(i)),()=>{const d=e()||[],g=d.length;return d[us],de(()=>{if(g===0)return l!==0&&(Bt(i),i=[],n=[],a=[],l=0,o=[]),s.fallback&&(n=[ns],a[0]=Ie(j=>(i[0]=j,s.fallback())),l=1),a;for(n[0]===ns&&(i[0](),i=[],n=[],a=[],l=0),c=0;c<g;c++)c<n.length&&n[c]!==d[c]?o[c](()=>d[c]):c>=n.length&&(a[c]=Ie(m));for(;c<n.length;c++)i[c]();return l=o.length=i.length=g,n=d.slice(0),a=a.slice(0,l)});function m(j){i[c]=j;const[x,v]=ie(d[c]);return o[c]=v,t(x,c)}}}function fs(e,t){return de(()=>e(t||{}))}function Lt(){return!0}var rs={get(e,t,s){return t===Dt?s:e.get(t)},has(e,t){return t===Dt?!0:e.has(t)},set:Lt,deleteProperty:Lt,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Lt,deleteProperty:Lt}},ownKeys(e){return e.keys()}};function Zt(e){return(e=typeof e=="function"?e():e)?e:{}}function hr(){for(let e=0,t=this.length;e<t;++e){const s=this[e]();if(s!==void 0)return s}}function ms(...e){let t=!1;for(let o=0;o<e.length;o++){const l=e[o];t=t||!!l&&Dt in l,e[o]=typeof l=="function"?(t=!0,ye(l)):l}if(Bs&&t)return new Proxy({get(o){for(let l=e.length-1;l>=0;l--){const c=Zt(e[l])[o];if(c!==void 0)return c}},has(o){for(let l=e.length-1;l>=0;l--)if(o in Zt(e[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<e.length;l++)o.push(...Object.keys(Zt(e[l])));return[...new Set(o)]}},rs);const s={},n=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 d=c.length-1;d>=0;d--){const g=c[d];if(g==="__proto__"||g==="constructor")continue;const m=Object.getOwnPropertyDescriptor(l,g);if(!n[g])n[g]=m.get?{enumerable:!0,configurable:!0,get:hr.bind(s[g]=[m.get.bind(l)])}:m.value!==void 0?m:void 0;else{const j=s[g];j&&(m.get?j.push(m.get.bind(l)):m.value!==void 0&&j.push(()=>m.value))}}}const a={},i=Object.keys(n);for(let o=i.length-1;o>=0;o--){const l=i[o],c=n[l];c&&c.get?Object.defineProperty(a,l,c):a[l]=c?c.value:void 0}return a}function Qs(e,...t){if(Bs&&Dt 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)}},rs));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))}},rs)),i}const s={},n=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 d of t)d.includes(a)&&(l=!0,o?n[c][a]=i.value:Object.defineProperty(n[c],a,i)),++c;l||(o?s[a]=i.value:Object.defineProperty(s,a,i))}return[...n,s]}function Ys(e){let t,s;const n=a=>{const i=O.context;if(i){const[l,c]=ie();O.count||(O.count=0),O.count++,(s||(s=e())).then(d=>{!O.done&&it(i),O.count--,c(()=>d.default),it()}),t=l}else if(!t){const[l]=Yn(()=>(s||(s=e())).then(c=>c.default));t=l}let o;return ye(()=>(o=t())?de(()=>{if(!i||O.done)return o(a);const l=O.context;it(i);const c=o(a);return it(l),c}):"")};return n.preload=()=>s||((s=e()).then(a=>t=()=>a.default),s),n}var fr=0;function mr(){return O.context?O.getNextContextId():`cl-${fr++}`}var Xs=e=>`Stale read from <${e}>.`;function gr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return ye(ur(()=>e.each,e.children,t||void 0))}function yr(e){const t="fallback"in e&&{fallback:()=>e.fallback};return ye(dr(()=>e.each,e.children,t||void 0))}function pr(e){const t=e.keyed,s=ye(()=>e.when,void 0,{equals:(n,a)=>t?n===a:!n==!a});return ye(()=>{const n=s();if(n){const a=e.children;return typeof a=="function"&&a.length>0?de(()=>a(t?n:()=>{if(!de(s))throw Xs("Show");return e.when})):a}return e.fallback},void 0,void 0)}function xr(e){let t=!1;const s=(i,o)=>(t?i[1]===o[1]:!i[1]==!o[1])&&i[2]===o[2],n=$s(()=>e.children),a=ye(()=>{let i=n();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:s});return ye(()=>{const[i,o,l]=a();if(i<0)return e.fallback;const c=l.children;return typeof c=="function"&&c.length>0?de(()=>c(t?o:()=>{if(de(a)[0]!==i)throw Xs("Match");return l.when})):c},void 0,void 0)}function vr(e){return e}var br=["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"],Er=new Set(["className","value","readOnly","formNoValidate","isMap","noModule","playsInline",...br]),Sr=new Set(["innerHTML","textContent","innerText","children"]),wr=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),jr=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 Nr(e,t){const s=jr[e];return typeof s=="object"?s[t]?s.$:void 0:s}var Cr=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),Ar=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"]),Tr={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"};function Pr(e,t,s){let n=s.length,a=t.length,i=n,o=0,l=0,c=t[a-1].nextSibling,d=null;for(;o<a||l<i;){if(t[o]===s[l]){o++,l++;continue}for(;t[a-1]===s[i-1];)a--,i--;if(a===o){const g=i<n?l?s[l-1].nextSibling:s[i-l]:c;for(;l<i;)e.insertBefore(s[l++],g)}else if(i===l)for(;o<a;)(!d||!d.has(t[o]))&&t[o].remove(),o++;else if(t[o]===s[i-1]&&s[l]===t[a-1]){const g=t[--a].nextSibling;e.insertBefore(s[l++],t[o++].nextSibling),e.insertBefore(s[--i],g),t[a]=s[i]}else{if(!d){d=new Map;let m=l;for(;m<i;)d.set(s[m],m++)}const g=d.get(t[o]);if(g!=null)if(l<g&&g<i){let m=o,j=1,x;for(;++m<a&&m<i&&!((x=d.get(t[m]))==null||x!==g+j);)j++;if(j>g-l){const v=t[o];for(;l<g;)e.insertBefore(s[l++],v)}else e.replaceChild(s[l++],t[o++])}else o++;else t[o++].remove()}}}var ct="_$DX_DELEGATE";function Zs(e,t,s,n={}){let a;return Ie(i=>{a=i,t===document?e():Ft(t,e(),t.firstChild?null:void 0,s)},n.owner),()=>{a(),t.textContent=""}}function Lr(e,t,s){let n;const a=()=>{const o=document.createElement("template");return o.innerHTML=e,o.content.firstChild},i=()=>(n||(n=a())).cloneNode(!0);return i.cloneNode=i,i}function Js(e,t=window.document){const s=t[ct]||(t[ct]=new Set);for(let n=0,a=e.length;n<a;n++){const i=e[n];s.has(i)||(s.add(i),t.addEventListener(i,rn))}}function kr(e=window.document){if(e[ct]){for(let t of e[ct].keys())e.removeEventListener(t,rn);delete e[ct]}}function Rt(e,t,s){Be(e)||(s==null?e.removeAttribute(t):e.setAttribute(t,s))}function Ir(e,t,s,n){Be(e)||(n==null?e.removeAttributeNS(t,s):e.setAttributeNS(t,s,n))}function _r(e,t,s){Be(e)||(s?e.setAttribute(t,""):e.removeAttribute(t))}function en(e,t){Be(e)||(t==null?e.removeAttribute("class"):e.className=t)}function tn(e,t,s,n){if(n)Array.isArray(s)?(e[`$$${t}`]=s[0],e[`$$${t}Data`]=s[1]):e[`$$${t}`]=s;else if(Array.isArray(s)){const a=s[0];e.addEventListener(t,s[0]=i=>a.call(e,s[1],i))}else e.addEventListener(t,s,typeof s!="function"&&s)}function Dr(e,t,s={}){const n=Object.keys(t||{}),a=Object.keys(s);let i,o;for(i=0,o=a.length;i<o;i++){const l=a[i];!l||l==="undefined"||t[l]||(Ps(e,l,!1),delete s[l])}for(i=0,o=n.length;i<o;i++){const l=n[i],c=!!t[l];!l||l==="undefined"||s[l]===c||!c||(Ps(e,l,!0),s[l]=c)}return s}function Gr(e,t,s){if(!t)return s?Rt(e,"style"):t;const n=e.style;if(typeof t=="string")return n.cssText=t;typeof s=="string"&&(n.cssText=s=void 0),s||(s={}),t||(t={});let a,i;for(i in s)t[i]==null&&n.removeProperty(i),delete s[i];for(i in t)a=t[i],a!==s[i]&&(n.setProperty(i,a),s[i]=a);return s}function sn(e,t={},s,n){const a={};return n||_e(()=>a.children=ht(e,t.children,a.children)),_e(()=>typeof t.ref=="function"&&nn(t.ref,e)),_e(()=>Or(e,t,s,!0,a,!0)),a}function nn(e,t,s){return de(()=>e(t,s))}function Ft(e,t,s,n){if(s!==void 0&&!n&&(n=[]),typeof t!="function")return ht(e,t,n,s);_e(a=>ht(e,t(),a,s),n)}function Or(e,t,s,n,a={},i=!1){t||(t={});for(const o in a)if(!(o in t)){if(o==="children")continue;a[o]=Ls(e,o,null,a[o],s,i,t)}for(const o in t){if(o==="children")continue;const l=t[o];a[o]=Ls(e,o,l,a[o],s,i,t)}}function Ur(e){let t,s;return!Be()||!(t=O.registry.get(s=Br()))?e():(O.completed&&O.completed.add(t),O.registry.delete(s),t)}function Be(e){return!!O.context&&!O.done&&(!e||e.isConnected)}function Mr(e){return e.toLowerCase().replace(/-([a-z])/g,(t,s)=>s.toUpperCase())}function Ps(e,t,s){const n=t.trim().split(/\s+/);for(let a=0,i=n.length;a<i;a++)e.classList.toggle(n[a],s)}function Ls(e,t,s,n,a,i,o){let l,c,d,g,m;if(t==="style")return Gr(e,s,n);if(t==="classList")return Dr(e,s,n);if(s===n)return n;if(t==="ref")i||s(e);else if(t.slice(0,3)==="on:"){const j=t.slice(3);n&&e.removeEventListener(j,n,typeof n!="function"&&n),s&&e.addEventListener(j,s,typeof s!="function"&&s)}else if(t.slice(0,10)==="oncapture:"){const j=t.slice(10);n&&e.removeEventListener(j,n,!0),s&&e.addEventListener(j,s,!0)}else if(t.slice(0,2)==="on"){const j=t.slice(2).toLowerCase(),x=Cr.has(j);if(!x&&n){const v=Array.isArray(n)?n[0]:n;e.removeEventListener(j,v)}(x||s)&&(tn(e,j,s,x),x&&Js([j]))}else if(t.slice(0,5)==="attr:")Rt(e,t.slice(5),s);else if(t.slice(0,5)==="bool:")_r(e,t.slice(5),s);else if((m=t.slice(0,5)==="prop:")||(d=Sr.has(t))||!a&&((g=Nr(t,e.tagName))||(c=Er.has(t)))||(l=e.nodeName.includes("-")||"is"in o)){if(m)t=t.slice(5),c=!0;else if(Be(e))return s;t==="class"||t==="className"?en(e,s):l&&!c&&!d?e[Mr(t)]=s:e[g||t]=s}else{const j=a&&t.indexOf(":")>-1&&Tr[t.split(":")[0]];j?Ir(e,j,t,s):Rt(e,wr[t]||t,s)}return s}function rn(e){if(O.registry&&O.events&&O.events.find(([c,d])=>d===e))return;let t=e.target;const s=`$$${e.type}`,n=e.target,a=e.currentTarget,i=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),o=()=>{const c=t[s];if(c&&!t.disabled){const d=t[`${s}Data`];if(d!==void 0?c.call(t,d,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}}),O.registry&&!O.done&&(O.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();i(c[0]);for(let d=0;d<c.length-2&&(t=c[d],!!o());d++){if(t._$host){t=t._$host,l();break}if(t.parentNode===a)break}}else l();i(n)}function ht(e,t,s,n,a){const i=Be(e);if(i){!s&&(s=[...e.childNodes]);let c=[];for(let d=0;d<s.length;d++){const g=s[d];g.nodeType===8&&g.data.slice(0,2)==="!$"?g.remove():c.push(g)}s=c}for(;typeof s=="function";)s=s();if(t===s)return s;const o=typeof t,l=n!==void 0;if(e=l&&s[0]&&s[0].parentNode||e,o==="string"||o==="number"){if(i||o==="number"&&(t=t.toString(),t===s))return s;if(l){let c=s[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),s=Re(e,s,n,c)}else s!==""&&typeof s=="string"?s=e.firstChild.data=t:s=e.textContent=t}else if(t==null||o==="boolean"){if(i)return s;s=Re(e,s,n)}else{if(o==="function")return _e(()=>{let c=t();for(;typeof c=="function";)c=c();s=ht(e,c,s,n)}),()=>s;if(Array.isArray(t)){const c=[],d=s&&Array.isArray(s);if(as(c,t,s,a))return _e(()=>s=ht(e,c,s,n,!0)),()=>s;if(i){if(!c.length)return s;if(n===void 0)return s=[...e.childNodes];let g=c[0];if(g.parentNode!==e)return s;const m=[g];for(;(g=g.nextSibling)!==n;)m.push(g);return s=m}if(c.length===0){if(s=Re(e,s,n),l)return s}else d?s.length===0?ks(e,c,n):Pr(e,s,c):(s&&Re(e),ks(e,c));s=c}else if(t.nodeType){if(i&&t.parentNode)return s=l?[t]:t;if(Array.isArray(s)){if(l)return s=Re(e,s,n,t);Re(e,s,null,t)}else s==null||s===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);s=t}}return s}function as(e,t,s,n){let a=!1;for(let i=0,o=t.length;i<o;i++){let l=t[i],c=s&&s[e.length],d;if(!(l==null||l===!0||l===!1))if((d=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))a=as(e,l,c)||a;else if(d==="function")if(n){for(;typeof l=="function";)l=l();a=as(e,Array.isArray(l)?l:[l],Array.isArray(c)?c:[c])||a}else e.push(l),a=!0;else{const g=String(l);c&&c.nodeType===3&&c.data===g?e.push(c):e.push(document.createTextNode(g))}}return a}function ks(e,t,s=null){for(let n=0,a=t.length;n<a;n++)e.insertBefore(t[n],s)}function Re(e,t,s,n){if(s===void 0)return e.textContent="";const a=n||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,s):c&&l.remove()}else i=!0}}else e.insertBefore(a,s);return[a]}function Br(){return O.getNextContextId()}var Rr="http://www.w3.org/2000/svg";function an(e,t=!1){return t?document.createElementNS(Rr,e):document.createElement(e)}function Fr(e){const{useShadow:t}=e,s=document.createTextNode(""),n=()=>e.mount||document.body,a=Ts();let i,o=!!O.context;return ds(()=>{o&&(Ts().user=o=!1),i||(i=Jn(a,()=>ye(()=>e.children)));const l=n();if(l instanceof HTMLHeadElement){const[c,d]=ie(!1),g=()=>d(!0);Ie(m=>Ft(l,()=>c()?m():i(),null)),nt(g)}else{const c=an(e.isSVG?"g":"div",e.isSVG),d=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return s.parentNode},configurable:!0}),Ft(d,i),l.appendChild(c),e.ref&&e.ref(c),nt(()=>l.removeChild(c))}},void 0,{render:!o}),s}function qr(e){const[t,s]=Qs(e,["component"]),n=ye(()=>t.component);return ye(()=>{const a=n();switch(typeof a){case"function":return de(()=>a(s));case"string":const i=Ar.has(a),o=O.context?Ur():an(a,i);return sn(o,s,i),o}})}var Hr=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()}},on=class{constructor(e){this.generateIdentifier=e,this.kv=new Hr}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)}},$r=class extends on{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 Vr(e){if("values"in Object)return Object.values(e);const t=[];for(const s in e)e.hasOwnProperty(s)&&t.push(e[s]);return t}function Kr(e,t){const s=Vr(e);if("find"in s)return s.find(t);const n=s;for(let a=0;a<n.length;a++){const i=n[a];if(t(i))return i}}function rt(e,t){Object.entries(e).forEach(([s,n])=>t(n,s))}function _t(e,t){return e.indexOf(t)!==-1}function Is(e,t){for(let s=0;s<e.length;s++){const n=e[s];if(t(n))return n}}var Wr=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return Kr(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},zr=e=>Object.prototype.toString.call(e).slice(8,-1),ln=e=>typeof e>"u",Qr=e=>e===null,ft=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,is=e=>ft(e)&&Object.keys(e).length===0,De=e=>Array.isArray(e),Yr=e=>typeof e=="string",Xr=e=>typeof e=="number"&&!isNaN(e),Zr=e=>typeof e=="boolean",Jr=e=>e instanceof RegExp,mt=e=>e instanceof Map,gt=e=>e instanceof Set,cn=e=>zr(e)==="Symbol",ea=e=>e instanceof Date&&!isNaN(e.valueOf()),ta=e=>e instanceof Error,_s=e=>typeof e=="number"&&isNaN(e),sa=e=>Zr(e)||Qr(e)||ln(e)||Xr(e)||Yr(e)||cn(e),na=e=>typeof e=="bigint",ra=e=>e===1/0||e===-1/0,aa=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),ia=e=>e instanceof URL,un=e=>e.replace(/\./g,"\\."),Jt=e=>e.map(String).map(un).join("."),ut=e=>{const t=[];let s="";for(let a=0;a<e.length;a++){let i=e.charAt(a);if(i==="\\"&&e.charAt(a+1)==="."){s+=".",a++;continue}if(i==="."){t.push(s),s="";continue}s+=i}const n=s;return t.push(n),t};function je(e,t,s,n){return{isApplicable:e,annotation:t,transform:s,untransform:n}}var dn=[je(ln,"undefined",()=>null,()=>{}),je(na,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),je(ea,"Date",e=>e.toISOString(),e=>new Date(e)),je(ta,"Error",(e,t)=>{const s={name:e.name,message:e.message};return t.allowedErrorProps.forEach(n=>{s[n]=e[n]}),s},(e,t)=>{const s=new Error(e.message);return s.name=e.name,s.stack=e.stack,t.allowedErrorProps.forEach(n=>{s[n]=e[n]}),s}),je(Jr,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),s=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,s)}),je(gt,"set",e=>[...e.values()],e=>new Set(e)),je(mt,"map",e=>[...e.entries()],e=>new Map(e)),je(e=>_s(e)||ra(e),"number",e=>_s(e)?"NaN":e>0?"Infinity":"-Infinity",Number),je(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),je(ia,"URL",e=>e.toString(),e=>new URL(e))];function Kt(e,t,s,n){return{isApplicable:e,annotation:t,transform:s,untransform:n}}var hn=Kt((e,t)=>cn(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,s)=>{const n=s.symbolRegistry.getValue(t[1]);if(!n)throw new Error("Trying to deserialize unknown symbol");return n}),oa=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),fn=Kt(aa,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const s=oa[t[1]];if(!s)throw new Error("Trying to deserialize unknown typed array");return new s(e)});function mn(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var gn=Kt(mn,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const s=t.classRegistry.getAllowedProps(e.constructor);if(!s)return{...e};const n={};return s.forEach(a=>{n[a]=e[a]}),n},(e,t,s)=>{const n=s.classRegistry.getValue(t[1]);if(!n)throw new Error("Trying to deserialize unknown class - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564");return Object.assign(Object.create(n.prototype),e)}),yn=Kt((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,s)=>{const n=s.customTransformerRegistry.findByName(t[1]);if(!n)throw new Error("Trying to deserialize unknown custom value");return n.deserialize(e)}),la=[gn,hn,yn,fn],Ds=(e,t)=>{const s=Is(la,a=>a.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation(e,t)};const n=Is(dn,a=>a.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation}},pn={};dn.forEach(e=>{pn[e.annotation]=e});var ca=(e,t,s)=>{if(De(t))switch(t[0]){case"symbol":return hn.untransform(e,t,s);case"class":return gn.untransform(e,t,s);case"custom":return yn.untransform(e,t,s);case"typed-array":return fn.untransform(e,t,s);default:throw new Error("Unknown transformation: "+t)}else{const n=pn[t];if(!n)throw new Error("Unknown transformation: "+t);return n.untransform(e,s)}},Fe=(e,t)=>{const s=e.keys();for(;t>0;)s.next(),t--;return s.next().value};function xn(e){if(_t(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(_t(e,"prototype"))throw new Error("prototype is not allowed as a property");if(_t(e,"constructor"))throw new Error("constructor is not allowed as a property")}var ua=(e,t)=>{xn(t);for(let s=0;s<t.length;s++){const n=t[s];if(gt(e))e=Fe(e,+n);else if(mt(e)){const a=+n,i=+t[++s]==0?"key":"value",o=Fe(e,a);switch(i){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[n]}return e},os=(e,t,s)=>{if(xn(t),t.length===0)return s(e);let n=e;for(let i=0;i<t.length-1;i++){const o=t[i];if(De(n)){const l=+o;n=n[l]}else if(ft(n))n=n[o];else if(gt(n)){const l=+o;n=Fe(n,l)}else if(mt(n)){if(i===t.length-2)break;const c=+o,d=+t[++i]==0?"key":"value",g=Fe(n,c);switch(d){case"key":n=g;break;case"value":n=n.get(g);break}}}const a=t[t.length-1];if(De(n)?n[+a]=s(n[+a]):ft(n)&&(n[a]=s(n[a])),gt(n)){const i=Fe(n,+a),o=s(i);i!==o&&(n.delete(i),n.add(o))}if(mt(n)){const i=+t[t.length-2],o=Fe(n,i);switch(+a==0?"key":"value"){case"key":{const c=s(o);n.set(c,n.get(o)),c!==o&&n.delete(o);break}case"value":{n.set(o,s(n.get(o)));break}}}return e};function ls(e,t,s=[]){if(!e)return;if(!De(e)){rt(e,(i,o)=>ls(i,t,[...s,...ut(o)]));return}const[n,a]=e;a&&rt(a,(i,o)=>{ls(i,t,[...s,...ut(o)])}),t(n,s)}function da(e,t,s){return ls(t,(n,a)=>{e=os(e,a,i=>ca(i,n,s))}),e}function ha(e,t){function s(n,a){const i=ua(e,ut(a));n.map(ut).forEach(o=>{e=os(e,o,()=>i)})}if(De(t)){const[n,a]=t;n.forEach(i=>{e=os(e,ut(i),()=>e)}),a&&rt(a,s)}else rt(t,s);return e}var fa=(e,t)=>ft(e)||De(e)||mt(e)||gt(e)||mn(e,t);function ma(e,t,s){const n=s.get(e);n?n.push(t):s.set(e,[t])}function ga(e,t){const s={};let n;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?n=o.map(Jt):s[Jt(i)]=o.map(Jt)}),n?is(s)?[n]:[n,s]:is(s)?void 0:s}var vn=(e,t,s,n,a=[],i=[],o=new Map)=>{const l=sa(e);if(!l){ma(e,a,t);const x=o.get(e);if(x)return n?{transformedValue:null}:x}if(!fa(e,s)){const x=Ds(e,s),v=x?{transformedValue:x.value,annotations:[x.type]}:{transformedValue:e};return l||o.set(e,v),v}if(_t(i,e))return{transformedValue:null};const c=Ds(e,s),d=(c==null?void 0:c.value)??e,g=De(d)?[]:{},m={};rt(d,(x,v)=>{if(v==="__proto__"||v==="constructor"||v==="prototype")throw new Error(`Detected property ${v}. This is a prototype pollution risk, please remove it from your object.`);const b=vn(x,t,s,n,[...a,v],[...i,e],o);g[v]=b.transformedValue,De(b.annotations)?m[v]=b.annotations:ft(b.annotations)&&rt(b.annotations,(S,C)=>{m[un(v)+"."+C]=S})});const j=is(m)?{transformedValue:g,annotations:c?[c.type]:void 0}:{transformedValue:g,annotations:c?[c.type,m]:m};return l||o.set(e,j),j};function bn(e){return Object.prototype.toString.call(e).slice(8,-1)}function Gs(e){return bn(e)==="Array"}function ya(e){if(bn(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function pa(e,t,s,n,a){const i={}.propertyIsEnumerable.call(n,t)?"enumerable":"nonenumerable";i==="enumerable"&&(e[t]=s),a&&i==="nonenumerable"&&Object.defineProperty(e,t,{value:s,enumerable:!1,writable:!0,configurable:!0})}function cs(e,t={}){if(Gs(e))return e.map(a=>cs(a,t));if(!ya(e))return e;const s=Object.getOwnPropertyNames(e),n=Object.getOwnPropertySymbols(e);return[...s,...n].reduce((a,i)=>{if(Gs(t.props)&&!t.props.includes(i))return a;const o=e[i],l=cs(o,t);return pa(a,i,l,e,t.nonenumerable),a},{})}var J=class{constructor({dedupe:e=!1}={}){this.classRegistry=new $r,this.symbolRegistry=new on(t=>t.description??""),this.customTransformerRegistry=new Wr,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,s=vn(e,t,this,this.dedupe),n={json:s.transformedValue};s.annotations&&(n.meta={...n.meta,values:s.annotations});const a=ga(t,this.dedupe);return a&&(n.meta={...n.meta,referentialEqualities:a}),n}deserialize(e){const{json:t,meta:s}=e;let n=cs(t);return s!=null&&s.values&&(n=da(n,s.values,this)),s!=null&&s.referentialEqualities&&(n=ha(n,s.referentialEqualities)),n}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)}};J.defaultInstance=new J;J.serialize=J.defaultInstance.serialize.bind(J.defaultInstance);J.deserialize=J.defaultInstance.deserialize.bind(J.defaultInstance);J.stringify=J.defaultInstance.stringify.bind(J.defaultInstance);J.parse=J.defaultInstance.parse.bind(J.defaultInstance);J.registerClass=J.defaultInstance.registerClass.bind(J.defaultInstance);J.registerSymbol=J.defaultInstance.registerSymbol.bind(J.defaultInstance);J.registerCustom=J.defaultInstance.registerCustom.bind(J.defaultInstance);J.allowErrorProps=J.defaultInstance.allowErrorProps.bind(J.defaultInstance);var En=J.serialize,xa=J.stringify;function va(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function ba(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function Ea({queryState:e,observerCount:t,isStale:s}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":s?"yellow":"green":"gray"}function Sa({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function wa(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var ja=(e,t=!1)=>{const{json:s}=En(e);return JSON.stringify(s,null,t?2:void 0)},kt=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,Na=(e,t)=>e.queryHash.localeCompare(t.queryHash),Sn=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,Ca=(e,t)=>kt(e)===kt(t)?Sn(e,t):kt(e)>kt(t)?1:-1,Aa={status:Ca,"query hash":Na,"last updated":Sn},It=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,wn=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,Ta=(e,t)=>It(e)===It(t)?wn(e,t):It(e)>It(t)?1:-1,Pa={status:Ta,"last updated":wn},La=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),ka=()=>{const[e,t]=ie("dark");return Hs(()=>{const s=window.matchMedia("(prefers-color-scheme: dark)");t(s.matches?"dark":"light");const n=a=>{t(a.matches?"dark":"light")};s.addEventListener("change",n),nt(()=>s.removeEventListener("change",n))}),e},ot=(e,t,s)=>{if(t.length===0)return s;if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.set(t[0],s),n;const[a,...i]=t;return n.set(a,ot(n.get(a),i,s)),n}if(e instanceof Set){const n=ot(Array.from(e),t,s);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n[t[0]]=s,n;const[a,...i]=t;return n[a]=ot(n[a],i,s),n}if(e instanceof Object){const n={...e};if(t.length===1)return n[t[0]]=s,n;const[a,...i]=t;return n[a]=ot(n[a],i,s),n}return e},lt=(e,t)=>{if(e instanceof Map){const s=new Map(e);if(t.length===1)return s.delete(t[0]),s;const[n,...a]=t;return s.set(n,lt(s.get(n),a)),s}if(e instanceof Set){const s=lt(Array.from(e),t);return new Set(s)}if(Array.isArray(e)){const s=[...e];if(t.length===1)return s.filter((i,o)=>o.toString()!==t[0]);const[n,...a]=t;return s[n]=lt(s[n],a),s}if(e instanceof Object){const s={...e};if(t.length===1)return delete s[t[0]],s;const[n,...a]=t;return s[n]=lt(s[n],a),s}return e},jn=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const n=document.createElement("style"),a=document.createTextNode("");n.appendChild(a),n.id="_goober",n.setAttribute("nonce",e),t?t.appendChild(n):document.head.appendChild(n)},qe,yt,pt,xt,Ue,vt,He,$e,Ve,Ke,We,ze,bt,Os,Ia=(Os=class{constructor(e){X(this,qe);X(this,yt);X(this,pt);X(this,xt);X(this,Ue,!1);X(this,vt);X(this,He);X(this,$e);X(this,Ve);X(this,Ke);X(this,We);X(this,ze);X(this,bt);const{client:t,queryFlavor:s,version:n,onlineManager:a,buttonPosition:i,position:o,initialIsOpen:l,errorTypes:c,styleNonce:d,shadowDOMTarget:g}=e;z(this,qe,ie(t)),z(this,pt,s),z(this,xt,n),z(this,yt,a),z(this,vt,d),z(this,He,g),z(this,$e,ie(i)),z(this,Ve,ie(o)),z(this,Ke,ie(l)),z(this,We,ie(c))}setButtonPosition(e){G(this,$e)[1](e)}setPosition(e){G(this,Ve)[1](e)}setInitialIsOpen(e){G(this,Ke)[1](e)}setErrorTypes(e){G(this,We)[1](e)}setClient(e){G(this,qe)[1](e)}mount(e){if(G(this,Ue))throw new Error("Devtools is already mounted");const t=Zs(()=>{const s=this,[n]=G(this,$e),[a]=G(this,Ve),[i]=G(this,Ke),[o]=G(this,We),[l]=G(this,qe);let c;return G(this,ze)?c=G(this,ze):(c=Ys(()=>Promise.resolve().then(()=>require("./HO4MOOFI-CdR1fBwC.cjs"))),z(this,ze,c)),jn(G(this,vt),G(this,He)),fs(c,ms({get queryFlavor(){return G(s,pt)},get version(){return G(s,xt)},get onlineManager(){return G(s,yt)},get shadowDOMTarget(){return G(s,He)}},{get client(){return l()},get buttonPosition(){return n()},get position(){return a()},get initialIsOpen(){return i()},get errorTypes(){return o()}}))},e);z(this,Ue,!0),z(this,bt,t)}unmount(){var e;if(!G(this,Ue))throw new Error("Devtools is not mounted");(e=G(this,bt))==null||e.call(this),z(this,Ue,!1)}},qe=new WeakMap,yt=new WeakMap,pt=new WeakMap,xt=new WeakMap,Ue=new WeakMap,vt=new WeakMap,He=new WeakMap,$e=new WeakMap,Ve=new WeakMap,Ke=new WeakMap,We=new WeakMap,ze=new WeakMap,bt=new WeakMap,Os),Qe,Et,St,wt,Me,jt,Ye,Xe,Ze,Je,et,tt,st,Nt,Us,_a=(Us=class{constructor(e){X(this,Qe);X(this,Et);X(this,St);X(this,wt);X(this,Me,!1);X(this,jt);X(this,Ye);X(this,Xe);X(this,Ze);X(this,Je);X(this,et);X(this,tt);X(this,st);X(this,Nt);const{client:t,queryFlavor:s,version:n,onlineManager:a,buttonPosition:i,position:o,initialIsOpen:l,errorTypes:c,styleNonce:d,shadowDOMTarget:g,onClose:m}=e;z(this,Qe,ie(t)),z(this,St,s),z(this,wt,n),z(this,Et,a),z(this,jt,d),z(this,Ye,g),z(this,Xe,ie(i)),z(this,Ze,ie(o)),z(this,Je,ie(l)),z(this,et,ie(c)),z(this,tt,ie(m))}setButtonPosition(e){G(this,Xe)[1](e)}setPosition(e){G(this,Ze)[1](e)}setInitialIsOpen(e){G(this,Je)[1](e)}setErrorTypes(e){G(this,et)[1](e)}setClient(e){G(this,Qe)[1](e)}setOnClose(e){G(this,tt)[1](()=>e)}mount(e){if(G(this,Me))throw new Error("Devtools is already mounted");const t=Zs(()=>{const s=this,[n]=G(this,Xe),[a]=G(this,Ze),[i]=G(this,Je),[o]=G(this,et),[l]=G(this,Qe),[c]=G(this,tt);let d;return G(this,st)?d=G(this,st):(d=Ys(()=>Promise.resolve().then(()=>require("./HUY7CZI3-kvDxS9VQ.cjs"))),z(this,st,d)),jn(G(this,jt),G(this,Ye)),fs(d,ms({get queryFlavor(){return G(s,St)},get version(){return G(s,wt)},get onlineManager(){return G(s,Et)},get shadowDOMTarget(){return G(s,Ye)}},{get client(){return l()},get buttonPosition(){return n()},get position(){return a()},get initialIsOpen(){return i()},get errorTypes(){return o()},get onClose(){return c()}}))},e);z(this,Me,!0),z(this,Nt,t)}unmount(){var e;if(!G(this,Me))throw new Error("Devtools is not mounted");(e=G(this,Nt))==null||e.call(this),z(this,Me,!1)}},Qe=new WeakMap,Et=new WeakMap,St=new WeakMap,wt=new WeakMap,Me=new WeakMap,jt=new WeakMap,Ye=new WeakMap,Xe=new WeakMap,Ze=new WeakMap,Je=new WeakMap,et=new WeakMap,tt=new WeakMap,st=new WeakMap,Nt=new WeakMap,Us);function Da(e){const t=F.useQueryClient(e.client),s=ue.useRef(null),{buttonPosition:n,position:a,initialIsOpen:i,errorTypes:o,styleNonce:l,shadowDOMTarget:c}=e,[d]=ue.useState(new Ia({client:t,queryFlavor:"React Query",version:"5",onlineManager:F.onlineManager,buttonPosition:n,position:a,initialIsOpen:i,errorTypes:o,styleNonce:l,shadowDOMTarget:c}));return ue.useEffect(()=>{d.setClient(t)},[t,d]),ue.useEffect(()=>{n&&d.setButtonPosition(n)},[n,d]),ue.useEffect(()=>{a&&d.setPosition(a)},[a,d]),ue.useEffect(()=>{d.setInitialIsOpen(i||!1)},[i,d]),ue.useEffect(()=>{d.setErrorTypes(o||[])},[o,d]),ue.useEffect(()=>(s.current&&d.mount(s.current),()=>{d.unmount()}),[d]),r.jsx("div",{className:"tsqd-parent-container",ref:s})}function Ga(e){const t=F.useQueryClient(e.client),s=ue.useRef(null),{errorTypes:n,styleNonce:a,shadowDOMTarget:i}=e,[o]=ue.useState(new _a({client:t,queryFlavor:"React Query",version:"5",onlineManager:F.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:n,styleNonce:a,shadowDOMTarget:i,onClose:e.onClose}));return ue.useEffect(()=>{o.setClient(t)},[t,o]),ue.useEffect(()=>{o.setOnClose(e.onClose??(()=>{}))},[e.onClose,o]),ue.useEffect(()=>{o.setErrorTypes(n||[])},[n,o]),ue.useEffect(()=>(s.current&&o.mount(s.current),()=>{o.unmount()}),[o]),r.jsx("div",{style:{height:"500px",...e.style},className:"tsqd-parent-container",ref:s})}var Oa=process.env.NODE_ENV!=="development"?function(){return null}:Da;process.env.NODE_ENV;const _={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"},gs=()=>{const e=F.useQueryClient(),{data:t}=F.useQuery({queryKey:[_.AI_CONTEXT],initialData:"",queryFn:()=>""});return{setAiContext:E.useCallback(n=>{e.setQueryData([_.AI_CONTEXT],n)},[]),aiContext:t}},Ua=Ht.atom({}),Nn=()=>Ht.useAtom(Ua),Le=(e,t)=>{const[s]=Nn();return y.get(s,e,t)},oe=()=>Le("apiUrl","/chai/api"),Ma=async(e,t,s={})=>await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...s},body:JSON.stringify(t)}),le=()=>{const e=Le("user"),t=Le("onSessionExpired"),s=E.useMemo(()=>e==null?void 0:e.authToken,[e==null?void 0:e.authToken]);return E.useCallback(async(n,a,i={})=>{if(s)try{const o=y.get(a,"action","").toLowerCase(),l=await Ma(n+(o?`?action=${o}`:""),a,{...i,Authorization:`Bearer ${s}`});if(l.status===401)throw console.log("session expired",a,l),t(),new Error("Session expired");if(l.status===400)throw console.log("Something went wrong",a,l),new Error((await l.json()).error);return await l.json()}catch(o){throw console.log("Something went wrong",a,o),o}},[s,t])},Ba=()=>{const e=oe(),{aiContext:t}=gs(),s=le();return E.useCallback(async(n,a,i,o)=>s(e,{action:_.ASK_AI,data:{type:n,prompt:a,blocks:i,context:t,lang:o}}),[e,t,s])};function ve(){const[e,t]=E.useState(new URLSearchParams(window.location.search));return E.useEffect(()=>{const s=()=>{t(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",s),()=>{window.removeEventListener("popstate",s)}},[]),[e,t]}const Wt=()=>{const e=le(),t=oe();return F.useQuery({queryKey:[_.GET_WEBSITE_PAGES],staleTime:1e3*60*5,queryFn:async()=>e(t,{action:_.GET_WEBSITE_PAGES})||[]})},Ce=()=>{const[e]=ve(),t=e.get("page"),{data:s,isFetching:n}=Wt();return{data:E.useMemo(()=>y.find(s,{id:t})||{},[s,t]),isFetching:n}},Ra=(e,t)=>t.map(s=>{if(y.has(e,s._type)){const n=Ms.getDefaultBlockProps(s._type);return{...n,...y.pick(s,[...y.keys(n),"_type","_id","_name","_parent","_bindings"]),...y.pickBy(s,(a,i)=>y.endsWith(i,"_attrs")),...s}}return s}),Fa=e=>{const t=Ms.useRegisteredChaiBlocks();return E.useMemo(()=>{if(!e||y.isEmpty(e))return{blocks:[]};const s=y.filter(e,n=>!y.includes(n==null?void 0:n._type,"@chai/"));return{blocks:Ra(t,s)}},[e,t])},Cn=e=>{const t=oe(),s=le();return F.useQuery({queryKey:["chaiUserInfo",e],queryFn:async()=>await s(t,{action:_.GET_CHAI_USER,data:{userId:e}}),enabled:!!e&&e!=="EXPIRED"})},qa=Ht.atom(void 0),Ct=()=>{const[e]=ve(),t=e.get("page"),s=Le("user"),[n,a]=Ht.useAtom(qa);return E.useMemo(()=>({isLocked:t&&(s==null?void 0:s.id)!==n,currentEditor:n,setCurrentEditor:i=>a(i)}),[n,t,a,s==null?void 0:s.id])},An=()=>{const[e]=ve(),t=e.get("page"),s=oe(),{setAiContext:n}=gs(),{setCurrentEditor:a}=Ct(),i=le();return F.useQuery({queryKey:[_.GET_PAGE,t],initialData:[],queryFn:async()=>{a("");const o=await i(s,{action:_.GET_PAGE,data:{id:t,draft:!0}});a(o.currentEditor);const l=o.blocks??[],c=y.find(l,{_type:"@chai/ai-context"});return n(y.get(c,"_value","")||""),l},enabled:!!t})},Tn=({pageType:e,lang:t})=>{const s=oe(),n=le();return F.useQuery({queryKey:[_.GET_BUILDER_PAGE_DATA,e,t],initialData:{},queryFn:async()=>n(s,{action:_.GET_BUILDER_PAGE_DATA,data:{pageType:e,lang:t}}),enabled:!!e&&!!t})},Pn=()=>{const e=oe(),t=F.useQueryClient(),s=le();return F.useMutation({mutationFn:async n=>s(e,{action:_.RELEASE_LOCK,data:n}),onSuccess:(n,a)=>{t.invalidateQueries({queryKey:[_.GET_PAGE,a.id??""]})}})},Ln=()=>{const e=oe(),t=F.useQueryClient(),s=le();return F.useMutation({mutationFn:async n=>s(e,{action:_.UPDATE_WEBSITE_SETTINGS,data:n}),onSuccess:(n,a)=>{var i;t.invalidateQueries({queryKey:[_.GET_WEBSITE_SETTINGS]}),(i=a==null?void 0:a.settings)!=null&&i.theme||ee.toast.success("Website settings updated successfully.")},onError:n=>{ee.toast.error("Failed to update website settings",{description:n.message})}})},Ha=()=>{const e=oe(),t=F.useQueryClient(),s=le();return F.useMutation({mutationFn:async n=>s(e,{action:_.UPDATE_WEBSITE_DATA,data:n}),onSuccess:()=>{t.invalidateQueries({queryKey:[_.GET_WEBSITE_DATA]}),ee.toast.success("Website data updated successfully.")},onError:n=>{ee.toast.error("Failed to update website data",{description:n.message})}})},At=()=>{const e=oe(),t=le();return F.useQuery({queryKey:[_.GET_PAGE_TYPES],initialData:[],queryFn:async()=>t(e,{action:_.GET_PAGE_TYPES})})},$a=()=>{const e=oe(),t=le();return F.useMutation({mutationFn:async({pageType:s,query:n})=>{try{return t(e,{action:_.SEARCH_PAGES,data:{pageType:s,query:Array.isArray(n)&&n.length>0?n[0]:n}})||[]}catch(a){return console.error(a),[]}}})},Va=()=>F.useQuery({queryKey:["uiLibraries"],initialData:[],queryFn:async()=>[{uuid:"chaiblocks",name:"UI Blocks",url:"https://chaibuilder.com/chaiblocks"}]}),zt=()=>{const e=oe(),t=le();return F.useQuery({queryKey:[_.GET_WEBSITE_SETTINGS],initialData:{theme:{},fallbackLang:"en",languages:[]},queryFn:async()=>t(e,{action:_.GET_WEBSITE_SETTINGS,data:{draft:!0}})})},Ka=()=>{const e=oe(),t=le(),{setCurrentEditor:s}=Ct();return{getUILibraryBlock:async(o,l)=>{const g=(await(await fetch(o.url+(l.path?"/blocks/"+l.path:"/"+l.uuid+".html"))).text()).replace(/---([\s\S]*?)---/g,"");return xe.getBlocksFromHTML(`${g}`)},getUILibraryBlocks:async o=>{try{return(await(await fetch(o.url+"/blocks.json")).json()).map(d=>({...d,preview:o.url.replace("chaiblocks","")+d.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}});return c.code==="PAGE_LOCKED"?(s(c.editor===null?"EXPIRED":c.editor),!0):c}catch(c){return console.error(c),new Error("Failed to save blocks")}}}},Wa=()=>{const{data:e}=Wt(),t=oe(),s=le();return{getGlobalBlocks:async()=>{const n={};for(const a of e??[])y.isEmpty(a==null?void 0:a.slug)&&(n[a.id]={name:y.startCase(a.name??a.slug),description:""});return n},getGlobalBlockBlocks:async n=>{if(!n)return[];const a=await s(t,{action:"GET_PAGE",data:{id:n,draft:!0,editor:!1}});return y.filter(a.blocks,i=>y.has(i,"_id"))}}},Se={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"},Tt=()=>{const e=oe(),[t]=ve(),s=t.get("page"),n=le();return F.useQuery({queryKey:[_.GET_LANGUAGE_PAGES,s],initialData:[],queryFn:async()=>{if(!s)return null;const a=await n(e,{action:_.GET_LANGUAGE_PAGES,data:{id:s}});return y.reverse(y.sortBy(a,"primaryPage"))},enabled:!!s})},P={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."},za={SLUG_ALREADY_USED:"This slug is already in use. Please choose a different one."},kn=()=>{const e=oe(),t=F.useQueryClient(),s=le();return F.useMutation({mutationFn:async n=>s(e,{action:_.CREATE_PAGE,data:n}),onSuccess:(n,a)=>{a&&(a!=null&&a.primaryPage)?t.invalidateQueries({queryKey:[_.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}):t.invalidateQueries({queryKey:[_.GET_WEBSITE_PAGES]}),ee.toast.success(a.pageType==="global"?P.GLOBAL_BLOCK_ADD_SUCCESS:P.PAGE_ADD_SUCCESS)},onError:(n,a)=>{ee.toast.error(`Failed to add new ${a.pageType==="global"?"global block":"page"}.`,{description:y.get(za,n.message,n.message)})}})},ys=()=>{const e=oe(),t=F.useQueryClient(),s=le();return F.useMutation({mutationFn:async n=>await s(e,{action:_.UPDATE_PAGE,data:n}),onSuccess:(n,a)=>{a&&(a!=null&&a.primaryPage||a!=null&&a.seo)?t.invalidateQueries({queryKey:[_.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}):t.invalidateQueries({queryKey:[_.GET_WEBSITE_PAGES]}),a!=null&&a.seo?ee.toast.success(P.SEO_SETTINGS_UPDATE_SUCCESS):ee.toast.success(a.pageType==="global"?P.GLOBAL_BLOCK_UPDATE_SUCCESS:P.PAGE_UPDATE_SUCCESS)},onError:(n,a)=>{ee.toast.error(`Failed to update ${a.pageType==="global"?"global block":"page"}.`,{description:n.message})}})},Qa=()=>{const e=oe(),t=F.useQueryClient(),s=le();return F.useMutation({mutationFn:async n=>s(e,{action:_.DELETE_PAGE,data:{id:n==null?void 0:n.id}}),onSuccess:(n,a)=>{if(n.code==="PAGE_LOCKED"){ee.toast.error("Delete not allowed",{description:"Page is currently being edited by another user."});return}a&&(a!=null&&a.primaryPage)?t.invalidateQueries({queryKey:[_.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}):t.invalidateQueries({queryKey:[_.GET_WEBSITE_PAGES]}),ee.toast.success(a.pageType==="global"?P.GLOBAL_BLOCK_DELETE_SUCCESS:P.PAGE_DELETE_SUCCESS)},onError:(n,a)=>{ee.toast.error(`Failed to delete ${a.pageType==="global"?"global block":"page"}.`,{description:n.message})}})},Ya=()=>{const e=oe(),t=F.useQueryClient(),s=le();return F.useMutation({mutationFn:async n=>s(e,{action:_.TAKE_OFFLINE,data:{id:n==null?void 0:n.id}}),onSuccess:(n,a)=>{a&&(a!=null&&a.primaryPage)?t.invalidateQueries({queryKey:[_.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}):t.invalidateQueries({queryKey:[_.GET_WEBSITE_PAGES]}),ee.toast.success(a.pageType==="global"?P.GLOBAL_BLOCK_UNPUBLISH_SUCCESS:P.PAGE_UNPUBLISH_SUCCESS)},onError:(n,a)=>{ee.toast.error(`Failed to take offline ${a.pageType==="global"?"global block":"page"}.`,{description:n.message})}})},ps=()=>{const e=oe(),t=le(),s=F.useQueryClient(),{data:n}=Ce();return F.useMutation({mutationFn:async({ids:a})=>t(e,{action:_.PUBLISH_CHANGES,data:{ids:a}}),onSuccess:()=>{s.invalidateQueries({queryKey:[_.GET_CHANGES]}),s.invalidateQueries({queryKey:[_.GET_WEBSITE_PAGES]}),s.invalidateQueries({queryKey:[_.GET_LANGUAGE_PAGES,n==null?void 0:n.id]})},onError:()=>{ee.toast.error("Failed to publish pages.")}})},Xa=()=>{const e=oe(),t=le(),s=F.useQueryClient();return F.useMutation({mutationFn:async({id:n,slug:a})=>t(e,{action:_.CHANGE_SLUG,data:{id:n,slug:a}}),onSuccess:(n,{primaryPage:a})=>{ee.toast.success(P.SLUG_CHANGE_SUCCESS),a?s.invalidateQueries({queryKey:[_.GET_LANGUAGE_PAGES,a]}):s.invalidateQueries({queryKey:[_.GET_WEBSITE_PAGES]})},onError:()=>{ee.toast.error("Failed to change slug")}})},Za=({page:e,onClose:t})=>{const[s,n]=E.useState(e.slug||""),{mutate:a,isPending:i}=Xa(),{data:o}=At(),l=y.find(o,{key:e==null?void 0:e.pageType}),c=g=>{if(g.preventDefault(),!(e!=null&&e.primaryPage)&&Object.keys(Se).some(x=>s===`/${x}`||y.startsWith(s,`/${x}/`))){ee.toast.error("Error",{description:"Slugs cannot start with a language code for primary page"});return}a({...e,slug:s},{onSuccess:t})},d=(e==null?void 0:e.lang)||"";return r.jsx(u.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(u.DialogContent,{children:[r.jsxs(u.DialogHeader,{children:[r.jsx(u.DialogTitle,{children:"Change Slug"}),r.jsx(u.DialogDescription,{className:"text-xs",children:r.jsxs(u.Alert,{variant:"destructive",className:"mt-2",children:[r.jsx(I.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(u.Label,{htmlFor:"slug",className:"text-right",children:["Slug"," ",r.jsxs("small",{className:"font-light text-gray-500",children:["Slug should start with /",d]})]}),r.jsx(u.Input,{id:"slug",value:s,onChange:g=>{const m=g.target.value;y.startsWith(m,`/${d}`)&&n(m)},className:"col-span-3",required:!0,pattern:"^/.*",title:"Slug must start with /",placeholder:"Enter page slug"})]})]}),r.jsx(u.DialogFooter,{children:r.jsx(u.Button,{type:"submit",disabled:i||!y.startsWith(s,`/${d}`)||y.isEqual(e==null?void 0:e.slug,s),children:i?"Changing...":"Change Slug"})})]})]})})};function In({page:e,onClose:t}){const[,s]=ve(),{mutate:n,isPending:a}=Qa(),i=()=>{n(e,{onSuccess:()=>{e!=null&&e.primaryPage||(window.history.replaceState(null,"","/"),s(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate"))),t()}})};return r.jsx(u.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(u.DialogContent,{children:[r.jsxs(u.DialogHeader,{children:[r.jsx(u.DialogTitle,{children:"Confirm Deletion"}),r.jsxs(u.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:y.get(Se,e.lang,e.lang)})]})]})]}),r.jsxs(u.DialogFooter,{children:[r.jsx(u.Button,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(u.Button,{variant:"destructive",disabled:a,onClick:i,children:a?"Deleting...":"Delete"})]})]})})}const xs=({page:e,onClose:t})=>{const{mutate:s,isPending:n}=Ya(),a=async()=>{s(e,{onSuccess:t})};return r.jsx(u.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(u.DialogContent,{children:[r.jsxs(u.DialogHeader,{children:[r.jsx(u.DialogTitle,{children:"Confirm action"}),r.jsxs(u.DialogDescription,{children:[P.UNPUBLISH_MSG," ",r.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)}),"?"]})]}),r.jsxs(u.DialogFooter,{children:[r.jsx(u.Button,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(u.Button,{variant:"destructive",disabled:n,onClick:a,children:n?P.UPDATING:P.UNPUBLISH})]})]})})},_n=({langProps:e,onClose:t,languages:s})=>{const{data:n}=Ce(),[a,i]=E.useState(e.name||""),[o,l]=E.useState(e.edit?e.lang:""),[c,d]=E.useState(e.edit?e.slug:""),{mutate:g,isPending:m}=kn(),{mutate:j,isPending:x}=ys(),v=(e==null?void 0:e.pageType)==="global",b=m||x,S=C=>{C.preventDefault();const p={name:a,lang:o,primaryPage:n==null?void 0:n.id,slug:c,pageType:n==null?void 0:n.pageType};p.pageType=e.pageType,e.edit&&(p.id=e==null?void 0:e.id),e.edit?j(p,{onSuccess:t}):g(p,{onSuccess:t})};return r.jsx(u.Dialog,{open:!!e,onOpenChange:t,children:r.jsxs(u.DialogContent,{className:"sm:max-w-[425px] text-slate-600",children:[r.jsxs(u.DialogHeader,{children:[r.jsx(u.DialogTitle,{children:e.edit?P.EDIT_LANGUAGE:P.ADD_NEW_LANGUAGE}),r.jsx(u.DialogDescription,{className:"font-light",children:P.ENTER_LANGUAGE_DETAILS})]}),r.jsxs("form",{onSubmit:S,children:[r.jsxs("div",{className:"grid gap-4 py-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx(u.Label,{htmlFor:"lang",className:"text-right",children:P.LANGUAGE}),r.jsxs("select",{value:o,disabled:e.edit||y.isEmpty(s),onChange:C=>{const p=C.target.value;l(p),!v&&d(`/${p}`)},className:"flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 col-span-3",children:[r.jsx("option",{value:"",disabled:!0,selected:!0,children:e.edit?y.get(Se,e.lang,e.lang):y.isEmpty(s)?P.ALL_AVAILABLE_LANGUAGE_PAGE:P.CHOOSE_LANGUAGE}),y.map(s,C=>r.jsx("option",{value:C,children:y.get(Se,C,C)},C))]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx(u.Label,{htmlFor:"slug",className:"text-right",children:P.PAGE_NAME}),r.jsx(u.Input,{id:"name",value:a,onChange:C=>i(C.target.value),className:"col-span-3",required:!0,placeholder:P.ENTER_PAGE_NAME})]}),!v&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs(u.Label,{htmlFor:"slug",className:"text-right",children:[P.SLUG," ",r.jsx("small",{className:"font-light",children:P.SLUG_SHOULD_START_WITH})]}),r.jsx(u.Input,{id:"slug",value:c,onChange:C=>{const p=C.target.value;y.startsWith(p,`/${o}`)&&d(y.toLower(y.trim(p)))},className:"col-span-3",required:!0,pattern:"^/.*",disabled:y.isEmpty(o),title:P.SLUG_MUST_START_WITH,placeholder:y.isEmpty(o)?P.CHOOSE_LANGUAGE_TO_ADD_SLUG:P.ENTER_PAGE_SLUG})]})]}),r.jsx(u.DialogFooter,{children:r.jsx(u.Button,{type:"submit",disabled:b||!a||!o||!v&&!y.startsWith(c,`/${o}`),children:b?e.edit?P.UPDATING:P.ADDING:e.edit?P.UPDATE:P.ADD_NEW_LANGUAGE})})]})]})})},Ja=()=>{const[e,t]=E.useState(null),{selectedLang:s,fallbackLang:n,setSelectedLang:a}=xe.useLanguages(),{data:i,isFetching:o}=Tt(),{data:l}=Ce(),[c,d]=E.useState(null),[g,m]=E.useState(null),[j,x]=E.useState(null),{data:v}=zt(),b=y.filter(y.get(v,"languages")||["en"],S=>!y.find(i,{lang:S})&&S!==y.get(v,"fallbackLang"));return r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsx("ul",{className:"space-y-2 mt-4",children:o?r.jsxs("div",{className:"w-full space-y-3 py-4",children:[r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"}),r.jsx("div",{className:"w-full h-8 rounded bg-gray-300 animate-pulse"})]}):y.map(i,S=>{const C=S.lang,p=S.slug,N=!S.primaryPage,L=C===s;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 ${L?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>a(C),children:[r.jsxs("div",{className:" flex-1 gap-x-3",children:[r.jsxs("div",{className:"text-[13px] text-slate-800 flex items-center gap-x-2",children:[r.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${S.online?"bg-green-300":"bg-gray-300"}`}),y.get(Se,N?n:C,C)]}),r.jsxs("div",{children:[p&&r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Slug: ",r.jsx("b",{className:"font-medium",children:p})]}),r.jsxs("div",{className:"text-[11px] text-slate-600 font-light",children:["Name:",r.jsxs("b",{className:"font-medium",children:[" ",S.name," "]})]})]})]}),N?r.jsxs("div",{className:"flex items-center text-[11px] text-orange-500 gap-x-1",children:[r.jsx(I.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(u.DropdownMenu,{children:[r.jsx(u.DropdownMenuTrigger,{asChild:!0,onClick:w=>w.stopPropagation(),children:r.jsx(u.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:r.jsx(I.MoreHorizontal,{className:"h-4 w-4"})})}),r.jsxs(u.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(u.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:w=>{w.stopPropagation(),t({...S,edit:!0})},children:[r.jsx(I.PencilIcon,{className:"size-3"}),P.EDIT]}),(S==null?void 0:S.online)&&r.jsxs(u.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:w=>{w.stopPropagation(),m(S)},children:[r.jsx(I.Power,{className:"size-3"}),P.UNPUBLISH]}),r.jsxs(u.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:w=>{w.stopPropagation(),d(S)},children:[r.jsx(I.TrashIcon,{className:"size-3"}),P.DELETE]})]})]})})]},S.id),r.jsx("div",{className:"h-1 w-full border-b"})]})})}),r.jsx("div",{className:"flex justify-center w-full",children:r.jsx(u.Button,{variant:"default",size:"sm",disabled:y.isEmpty(b),onClick:()=>{t({name:l==null?void 0:l.name,pageType:l==null?void 0:l.pageType,lang:"",slug:"",edit:!1})},children:P.ADD_NEW_LANGUAGE})}),e&&r.jsx(_n,{languages:b,langProps:e,onClose:()=>t(null)}),c&&r.jsx(In,{page:c,onClose:()=>d(null)}),g&&r.jsx(xs,{page:g,onClose:()=>m(null)}),j&&r.jsx(Za,{page:j,onClose:()=>x(null)})]})},Dn=e=>{const{fallbackLang:t}=xe.useLanguages(),{data:s}=zt(),{data:n,isFetching:a}=Tt(),i=E.useMemo(()=>{const o={[t]:!0};return y.each(y.get(s,"languages"),l=>{const c=y.find(n,{lang:l});o[l]=!!c}),o},[t,n,s]);return a||y.isEmpty(e)||e&&i[e]};function ei({avatar:e,name:t,email:s,onTakeOver:n,currentEditor:a}){const[i,o]=E.useState(!1),l=()=>{o(!1),n()};return r.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-[20] flex items-center justify-center w-screen top-14 bg-black/30 backdrop-blur-sm",children:r.jsxs(u.Card,{className:"w-full max-w-md mx-auto",children:[r.jsx(u.CardHeader,{className:"space-y-1",children:r.jsxs(u.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(I.LockIcon,{className:"w-6 h-6 text-yellow-500"}),a==="EXPIRED"?"Editing access timed out":"Page locked for editing"]})}),r.jsx(u.CardContent,{className:"grid gap-4",children:a==="EXPIRED"?r.jsx("div",{children:r.jsx("p",{children:"Your editing access has been paused due to inactivity. Please refresh the page to continue"})}):r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center space-x-4",children:[e?r.jsx("img",{src:e,alt:t,className:"w-12 h-12 border border-gray-300 rounded-full"}):r.jsx(I.UserIcon,{className:"w-12 h-12 p-2 border border-gray-300 rounded-full"}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"font-semibold",children:t}),s&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s})]})]}),r.jsx("div",{className:"text-sm",children:r.jsx("p",{children:"This user is currently editing the page. You cannot make changes."})})]})}),r.jsx(u.CardFooter,{children:a==="EXPIRED"?r.jsx("div",{children:r.jsx(u.Button,{className:"w-full",onClick:()=>window.location.reload(),variant:"destructive",children:"Refresh"})}):r.jsxs(u.AlertDialog,{open:i,onOpenChange:o,children:[r.jsx(u.AlertDialogTrigger,{asChild:!0,children:r.jsxs("span",{className:"flex flex-col items-center",children:[r.jsx(u.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(u.AlertDialogContent,{className:"z-[99]",children:[r.jsxs(u.AlertDialogHeader,{children:[r.jsx(u.AlertDialogTitle,{children:"Are you sure you want to take over?"}),r.jsxs(u.AlertDialogDescription,{children:[r.jsxs("div",{className:"flex items-center space-x-2 text-yellow-500",children:[r.jsx(I.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(u.AlertDialogFooter,{children:[r.jsx(u.AlertDialogCancel,{children:"Cancel"}),r.jsx(u.AlertDialogAction,{onClick:l,children:"Yes, Take Over"})]})]})]})})]})})}const ti=()=>{const{isLocked:e,currentEditor:t}=Ct(),{data:s}=Cn(t),n=Le("pageLockComponent",ei),[a]=ve(),i=a.get("page"),{mutate:o}=Pn(),{isFetching:l}=An(),c=E.useCallback(()=>{o({id:i})},[i,o]);return!e||l?r.jsx("div",{className:""}):r.jsx(n,{...s,isLocked:e,currentEditor:t,onTakeOver:c})},si=()=>{const[e,t]=ve(),s=e.get("lang"),n=Dn(s),{setSelectedLang:a}=xe.useLanguages(),i=()=>{const l=new URLSearchParams(window.location.search);l.delete("lang");const c=l.toString(),d=`${window.location.pathname}${c?`?${c}`:""}`;window.history.pushState({},"",d),t(l),a(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(n)return null;const o=y.get(Se,s);return r.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-[20] flex items-center justify-center w-screen top-14 bg-black/30 backdrop-blur-sm",children:r.jsxs(u.Card,{className:"w-full max-w-md mx-auto",children:[r.jsx(u.CardHeader,{className:"space-y-1",children:r.jsxs(u.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[r.jsx(I.LockIcon,{className:"w-6 h-6 text-yellow-500"}),'Page missing for "',o,'" language.']})}),r.jsx(u.CardContent,{className:"grid gap-4",children:r.jsxs("div",{children:['Page is not available in the "',o,'" language. Either create the page in the "',o,'" language or switch to the base language.']})}),r.jsx(u.CardFooter,{children:r.jsx(u.Button,{onClick:i,className:"w-full",variant:"destructive",children:"Switch to default language"})})]})})},ni=()=>{const{selectedLang:e}=xe.useLanguages(),{data:t,isFetching:s}=Tt();return{data:E.useMemo(()=>y.find(t,{lang:e||""})||{},[t,e]),isFetching:s}};function Te({data:e,onSelect:t,dataType:s="value"}){const[n,a]=ue.useState(!1),[i,o]=ue.useState([]),[l,c]=ue.useState(e);ue.useEffect(()=>{n||o([]),c(e)},[e,n]);const d=x=>Array.isArray(x)?"array":typeof x=="object"&&x!==null?"object":"value",g=ue.useCallback(x=>{const v=b=>s==="value"?b==="value"||b==="object":s==="array"?b==="array":b===s;x.type==="object"?(o(b=>[...b,x.key]),c(x.value)):v(x.type)&&(t([...i,x.key].join(".")),a(!1))},[i,t,s]),m=ue.useCallback(()=>{if(i.length>0){const x=i.slice(0,-1);o(x),c(x.reduce((v,b)=>v[b],e))}},[i,e]),j=ue.useMemo(()=>Object.entries(l).map(([x,v])=>({key:x,value:v,type:d(v)})).filter(x=>s==="value"?x.type==="value"||x.type==="object":s==="array"?x.type==="array"||x.type==="object":s==="object"?x.type==="object":!0),[l,s]);return r.jsxs(u.Popover,{open:n,onOpenChange:a,children:[r.jsxs(u.Tooltip,{children:[r.jsx(u.TooltipTrigger,{asChild:!0,children:r.jsx(u.PopoverTrigger,{asChild:!0,children:r.jsx(u.Button,{size:"sm",variant:"outline",className:"h-6 w-6 px-1 py-0 text-[9px] text-muted-foreground",role:"combobox","aria-expanded":n,children:r.jsx(I.DatabaseIcon,{className:"h-3 w-3"})})})}),r.jsx(u.TooltipContent,{children:"Add field"})]}),r.jsx(u.PopoverContent,{className:"w-[200px] p-0",children:r.jsxs(u.Command,{children:[r.jsx(u.CommandInput,{className:"border-none",placeholder:"Search..."}),r.jsxs(u.CommandList,{children:[r.jsx(u.CommandEmpty,{children:"No option found."}),r.jsxs(u.CommandGroup,{children:[i.length>0&&r.jsxs(u.CommandItem,{onSelect:m,className:"flex items-center text-sm",children:[r.jsx(I.ChevronLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),j.map(x=>r.jsxs(u.CommandItem,{onSelect:()=>g(x),className:"flex items-center justify-between",children:[r.jsx("span",{children:x.key}),r.jsxs("div",{className:"flex items-center gap-2",children:[s==="object"&&x.type==="object"&&r.jsx(u.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-primary hover:text-primary-foreground",onClick:v=>{v.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(I.ChevronRight,{className:"w-4 h-4 opacity-50"})})]})]},x.key))]})]})]})})]})}const ri=(e,t)=>{const s=e.selectionStart||0,n=e.selectionEnd||0,a=e.value,i=a.substring(0,s),o=a.substring(n);let l=!1;if(s>0&&i.length>0){const v=i.charAt(i.length-1);l=!/[\s.,!?;:()[\]{}]/.test(v)&&v!==""}let c=!1;if(o.length>0){const v=o.charAt(0);c=!/[\s.,!?;:()[\]{}]/.test(v)&&v!==""}const d=l?" ":"",g=c?" ":"",m=`{{${t}}}`,j=i+(l?d:"")+m+(c?g:"")+o,x=s+(l?1:0)+m.length;return{value:j,newCursorPos:x}},Gn=()=>{const{selectedLang:e,fallbackLang:t,languages:s}=xe.useLanguages(),{data:n}=Ce(),{data:a}=Tn({lang:e||t,pageType:n==null?void 0:n.pageType}),{data:i,isFetching:o}=ni(),l=i==null?void 0:i.seo,c=E.useRef(null),[d,g]=E.useState({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...l}),m=E.useRef({initial:d,updated:d}),j=e.length?e:t,{mutate:x,isPending:v}=ys(),b=v;E.useEffect(()=>{!o&&l&&g({title:"",description:"",cononicalUrl:"",noIndex:!1,noFollow:"",ogTitle:"",ogDescription:"",ogImage:"",searchTitle:"",searchDescription:"",jsonLD:"",...l})},[o,l]);const S=async()=>{x({id:i==null?void 0:i.id,seo:d}),m.current.initial=d,m.current.updated=d},C=()=>{g({...d,ogTitle:d.title,ogDescription:d.description})},p=()=>{g({...d,searchTitle:d.ogTitle,searchDescription:d.ogDescription})},N=(w,Y)=>{const ne=document.getElementById(Y);if(ne){const{value:U,newCursorPos:M}=ri(ne,w);c.current={id:Y,position:M},ne.tagName.toLowerCase()==="input"?(ne.value=U,g(ce=>({...ce,[ne.name]:U})),ne.focus(),ne.setSelectionRange(M,M),[0,10,50,100,200].forEach(ce=>{setTimeout(()=>{const A=document.getElementById(Y);A&&(A.focus(),A.setSelectionRange(M,M))},ce)})):(g($=>({...$,[ne.name]:U})),requestAnimationFrame(()=>{const $=document.getElementById(Y);$&&($.focus(),$.setSelectionRange(M,M),setTimeout(()=>{const ce=document.getElementById(Y);ce&&(ce.focus(),ce.setSelectionRange(M,M))},50))}))}},L=w=>{const Y={...d,[w.target.name]:w.target.name==="noIndex"||w.target.name==="noFollow"?w.target.checked:w.target.value};g(Y),m.current.updated=Y};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: ",i==null?void 0:i.slug," ",s.length>0&&r.jsxs("span",{className:"font-semibold text-blue-500",children:["(",y.get(Se,j,j),")"]})]}),r.jsx("form",{className:"space-y-8",children:r.jsxs(u.Accordion,{type:"multiple",defaultValue:["page"],children:[r.jsxs(u.AccordionItem,{value:"page",children:[r.jsx(u.AccordionTrigger,{className:"font-semibold text-slate-700",children:"SEO"}),r.jsx(u.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(u.Label,{className:"text-xs",htmlFor:"title",children:"SEO Title"}),r.jsx(Te,{dataType:"value",data:a??{},onSelect:w=>N(w,"title")})]}),r.jsx(u.Input,{type:"text",id:"title",name:"title",value:d.title,onChange:L,disabled:b,placeholder:"Enter SEO title"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(u.Label,{className:"text-xs",htmlFor:"description",children:"SEO Description"}),r.jsx(Te,{data:a??{},onSelect:w=>N(w,"description")})]}),r.jsx(u.Textarea,{id:"description",name:"description",rows:5,value:d.description,onChange:L,disabled:b,placeholder:"Enter SEO description"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(u.Label,{className:"text-xs",htmlFor:"title",children:"Canonical URL"}),r.jsx(Te,{dataType:"value",data:a??{},onSelect:w=>N(w,"canonicalUrl")})]}),r.jsx(u.Input,{type:"text",id:"canonicalUrl",name:"canonicalUrl",value:d.canonicalUrl,onChange:L,disabled:b,placeholder:"Enter Canonical URL"})]}),r.jsxs("div",{className:"",children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsx(u.Input,{type:"checkbox",id:"noIndex",name:"noIndex",checked:d.noIndex,onChange:L,disabled:b,className:"w-4 h-4"}),r.jsx(u.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(u.Input,{type:"checkbox",id:"noFollow",name:"noFollow",checked:d.noFollow,onChange:L,disabled:b,className:"w-4 h-4"}),r.jsx(u.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(u.AccordionItem,{value:"og",children:[r.jsx(u.AccordionTrigger,{className:"font-bold text-slate-700",children:"Open Graph"}),r.jsx(u.AccordionContent,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(u.Button,{type:"button",variant:"outline",size:"sm",onClick:C,children:"Copy from SEO Settings"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(u.Label,{className:"text-xs",htmlFor:"ogTitle",children:"OG Title"}),r.jsx(Te,{dataType:"value",data:a??{},onSelect:w=>N(w,"ogTitle")})]}),r.jsx(u.Input,{type:"text",id:"ogTitle",name:"ogTitle",value:d.ogTitle,onChange:L,disabled:b,placeholder:"Enter OG title"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(u.Label,{className:"text-xs",htmlFor:"ogDescription",children:"OG Description"}),r.jsx(Te,{dataType:"value",data:a??{},onSelect:w=>N(w,"ogDescription")})]}),r.jsx(u.Textarea,{id:"ogDescription",name:"ogDescription",rows:5,value:d.ogDescription,onChange:L,disabled:b,placeholder:"Enter OG description"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(u.Label,{className:"text-xs",htmlFor:"ogImage",children:"OG Image URL"}),r.jsx(Te,{dataType:"value",data:a??{},onSelect:w=>N(w,"ogImage")})]}),r.jsx(u.Input,{type:"text",id:"ogImage",name:"ogImage",value:d.ogImage,onChange:L,disabled:b,placeholder:"Enter OG image URL"})]})]})})]}),r.jsxs(u.AccordionItem,{value:"search",children:[r.jsx(u.AccordionTrigger,{className:"font-bold text-slate-700",children:"Search"}),r.jsx(u.AccordionContent,{children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(u.Button,{type:"button",variant:"outline",size:"sm",onClick:p,children:"Copy from OG Settings"})}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(u.Label,{className:"text-xs",htmlFor:"searchTitle",children:"Search Title"}),r.jsx(Te,{dataType:"value",data:a??{},onSelect:w=>N(w,"searchTitle")})]}),r.jsx(u.Input,{type:"text",id:"searchTitle",name:"searchTitle",value:d.searchTitle,onChange:L,disabled:b,placeholder:"Enter search title"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(u.Label,{className:"text-xs",htmlFor:"searchDescription",children:"Search Description"}),r.jsx(Te,{dataType:"value",data:a??{},onSelect:w=>N(w,"searchDescription")})]}),r.jsx(u.Textarea,{id:"searchDescription",rows:5,name:"searchDescription",value:d.searchDescription,onChange:L,placeholder:"Enter search description"})]})]})})]}),r.jsxs(u.AccordionItem,{value:"jsonLD",children:[r.jsx(u.AccordionTrigger,{className:"font-bold text-slate-700",children:"JSON-LD"}),r.jsx(u.AccordionContent,{children:r.jsx("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(u.Label,{className:"text-xs",htmlFor:"jsonLD",children:"JSON-LD"}),r.jsx(Te,{dataType:"value",data:a??{},onSelect:w=>N(w,"jsonLD")})]}),r.jsx(u.Textarea,{id:"jsonLD",name:"jsonLD",rows:6,value:d.jsonLD,onChange:L,placeholder:"Enter JSON-LD"})]})})})]})]})}),r.jsx("div",{className:"flex items-center justify-end w-full mt-4",children:r.jsx(u.Button,{size:"lg",variant:"default",onClick:S,disabled:y.isEqual(m.current.initial,d)||b,children:v?"Saving...":"Save"})})]})};Gn.displayName="SeoPanel";var vs={};(function e(t,s,n,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 f=new OffscreenCanvas(1,1),h=f.getContext("2d");h.fillRect(0,0,1,1);var T=f.transferToImageBitmap();try{h.createPattern(T,"no-repeat")}catch{return!1}return!0}();function c(){}function d(f){var h=s.exports.Promise,T=h!==void 0?h:t.Promise;return typeof T=="function"?new T(f):(f(c,c),null)}var g=function(f,h){return{transform:function(T){if(f)return T;if(h.has(T))return h.get(T);var D=new OffscreenCanvas(T.width,T.height),B=D.getContext("2d");return B.drawImage(T,0,0),h.set(T,D),D},clear:function(){h.clear()}}}(l,new Map),m=function(){var f=Math.floor(16.666666666666668),h,T,D={},B=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(h=function(R){var q=Math.random();return D[q]=requestAnimationFrame(function k(H){B===H||B+f-1<H?(B=H,delete D[q],R()):D[q]=requestAnimationFrame(k)}),q},T=function(R){D[R]&&cancelAnimationFrame(D[R])}):(h=function(R){return setTimeout(R,f)},T=function(R){return clearTimeout(R)}),{frame:h,cancel:T}}(),j=function(){var f,h,T={};function D(B){function R(q,k){B.postMessage({options:q||{},callback:k})}B.init=function(k){var H=k.transferControlToOffscreen();B.postMessage({canvas:H},[H])},B.fire=function(k,H,te){if(h)return R(k,null),h;var re=Math.random().toString(36).slice(2);return h=d(function(se){function ae(he){he.data.callback===re&&(delete T[re],B.removeEventListener("message",ae),h=null,g.clear(),te(),se())}B.addEventListener("message",ae),R(k,re),T[re]=ae.bind(null,{data:{callback:re}})}),h},B.reset=function(){B.postMessage({reset:!0});for(var k in T)T[k](),delete T[k]}}return function(){if(f)return f;if(!n&&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(`
|
|
2
|
+
`);try{f=new Worker(URL.createObjectURL(new Blob([B])))}catch(R){return typeof console!==void 0&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",R),null}D(f)}return f}}(),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 v(f,h){return h?h(f):f}function b(f){return f!=null}function S(f,h,T){return v(f&&b(f[h])?f[h]:x[h],T)}function C(f){return f<0?0:Math.floor(f)}function p(f,h){return Math.floor(Math.random()*(h-f))+f}function N(f){return parseInt(f,16)}function L(f){return f.map(w)}function w(f){var h=String(f).replace(/[^0-9a-f]/gi,"");return h.length<6&&(h=h[0]+h[0]+h[1]+h[1]+h[2]+h[2]),{r:N(h.substring(0,2)),g:N(h.substring(2,4)),b:N(h.substring(4,6))}}function Y(f){var h=S(f,"origin",Object);return h.x=S(h,"x",Number),h.y=S(h,"y",Number),h}function ne(f){f.width=document.documentElement.clientWidth,f.height=document.documentElement.clientHeight}function U(f){var h=f.getBoundingClientRect();f.width=h.width,f.height=h.height}function M(f){var h=document.createElement("canvas");return h.style.position="fixed",h.style.top="0px",h.style.left="0px",h.style.pointerEvents="none",h.style.zIndex=f,h}function Q(f,h,T,D,B,R,q,k,H){f.save(),f.translate(h,T),f.rotate(R),f.scale(D,B),f.arc(0,0,1,q,k,H),f.restore()}function $(f){var h=f.angle*(Math.PI/180),T=f.spread*(Math.PI/180);return{x:f.x,y:f.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:f.startVelocity*.5+Math.random()*f.startVelocity,angle2D:-h+(.5*T-Math.random()*T),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:f.color,shape:f.shape,tick:0,totalTicks:f.ticks,decay:f.decay,drift:f.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:f.gravity*3,ovalScalar:.6,scalar:f.scalar,flat:f.flat}}function ce(f,h){h.x+=Math.cos(h.angle2D)*h.velocity+h.drift,h.y+=Math.sin(h.angle2D)*h.velocity+h.gravity,h.velocity*=h.decay,h.flat?(h.wobble=0,h.wobbleX=h.x+10*h.scalar,h.wobbleY=h.y+10*h.scalar,h.tiltSin=0,h.tiltCos=0,h.random=1):(h.wobble+=h.wobbleSpeed,h.wobbleX=h.x+10*h.scalar*Math.cos(h.wobble),h.wobbleY=h.y+10*h.scalar*Math.sin(h.wobble),h.tiltAngle+=.1,h.tiltSin=Math.sin(h.tiltAngle),h.tiltCos=Math.cos(h.tiltAngle),h.random=Math.random()+2);var T=h.tick++/h.totalTicks,D=h.x+h.random*h.tiltCos,B=h.y+h.random*h.tiltSin,R=h.wobbleX+h.random*h.tiltCos,q=h.wobbleY+h.random*h.tiltSin;if(f.fillStyle="rgba("+h.color.r+", "+h.color.g+", "+h.color.b+", "+(1-T)+")",f.beginPath(),o&&h.shape.type==="path"&&typeof h.shape.path=="string"&&Array.isArray(h.shape.matrix))f.fill(Ge(h.shape.path,h.shape.matrix,h.x,h.y,Math.abs(R-D)*.1,Math.abs(q-B)*.1,Math.PI/10*h.wobble));else if(h.shape.type==="bitmap"){var k=Math.PI/10*h.wobble,H=Math.abs(R-D)*.1,te=Math.abs(q-B)*.1,re=h.shape.bitmap.width*h.scalar,se=h.shape.bitmap.height*h.scalar,ae=new DOMMatrix([Math.cos(k)*H,Math.sin(k)*H,-Math.sin(k)*te,Math.cos(k)*te,h.x,h.y]);ae.multiplySelf(new DOMMatrix(h.shape.matrix));var he=f.createPattern(g.transform(h.shape.bitmap),"no-repeat");he.setTransform(ae),f.globalAlpha=1-T,f.fillStyle=he,f.fillRect(h.x-re/2,h.y-se/2,re,se),f.globalAlpha=1}else if(h.shape==="circle")f.ellipse?f.ellipse(h.x,h.y,Math.abs(R-D)*h.ovalScalar,Math.abs(q-B)*h.ovalScalar,Math.PI/10*h.wobble,0,2*Math.PI):Q(f,h.x,h.y,Math.abs(R-D)*h.ovalScalar,Math.abs(q-B)*h.ovalScalar,Math.PI/10*h.wobble,0,2*Math.PI);else if(h.shape==="star")for(var V=Math.PI/2*3,pe=4*h.scalar,be=8*h.scalar,Ee=h.x,Ae=h.y,Oe=5,we=Math.PI/Oe;Oe--;)Ee=h.x+Math.cos(V)*be,Ae=h.y+Math.sin(V)*be,f.lineTo(Ee,Ae),V+=we,Ee=h.x+Math.cos(V)*pe,Ae=h.y+Math.sin(V)*pe,f.lineTo(Ee,Ae),V+=we;else f.moveTo(Math.floor(h.x),Math.floor(h.y)),f.lineTo(Math.floor(h.wobbleX),Math.floor(B)),f.lineTo(Math.floor(R),Math.floor(q)),f.lineTo(Math.floor(D),Math.floor(h.wobbleY));return f.closePath(),f.fill(),h.tick<h.totalTicks}function A(f,h,T,D,B){var R=h.slice(),q=f.getContext("2d"),k,H,te=d(function(re){function se(){k=H=null,q.clearRect(0,0,D.width,D.height),g.clear(),B(),re()}function ae(){n&&!(D.width===a.width&&D.height===a.height)&&(D.width=f.width=a.width,D.height=f.height=a.height),!D.width&&!D.height&&(T(f),D.width=f.width,D.height=f.height),q.clearRect(0,0,D.width,D.height),R=R.filter(function(he){return ce(q,he)}),R.length?k=m.frame(ae):se()}k=m.frame(ae),H=se});return{addFettis:function(re){return R=R.concat(re),te},canvas:f,promise:te,reset:function(){k&&m.cancel(k),H&&H()}}}function W(f,h){var T=!f,D=!!S(h||{},"resize"),B=!1,R=S(h,"disableForReducedMotion",Boolean),q=i&&!!S(h||{},"useWorker"),k=q?j():null,H=T?ne:U,te=f&&k?!!f.__confetti_initialized:!1,re=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,se;function ae(V,pe,be){for(var Ee=S(V,"particleCount",C),Ae=S(V,"angle",Number),Oe=S(V,"spread",Number),we=S(V,"startVelocity",Number),Un=S(V,"decay",Number),Mn=S(V,"gravity",Number),Bn=S(V,"drift",Number),Es=S(V,"colors",L),Rn=S(V,"ticks",Number),Ss=S(V,"shapes"),Fn=S(V,"scalar"),qn=!!S(V,"flat"),ws=Y(V),js=Ee,Qt=[],Hn=f.width*ws.x,$n=f.height*ws.y;js--;)Qt.push($({x:Hn,y:$n,angle:Ae,spread:Oe,startVelocity:we,color:Es[js%Es.length],shape:Ss[p(0,Ss.length)],ticks:Rn,decay:Un,gravity:Mn,drift:Bn,scalar:Fn,flat:qn}));return se?se.addFettis(Qt):(se=A(f,Qt,H,pe,be),se.promise)}function he(V){var pe=R||S(V,"disableForReducedMotion",Boolean),be=S(V,"zIndex",Number);if(pe&&re)return d(function(we){we()});T&&se?f=se.canvas:T&&!f&&(f=M(be),document.body.appendChild(f)),D&&!te&&H(f);var Ee={width:f.width,height:f.height};k&&!te&&k.init(f),te=!0,k&&(f.__confetti_initialized=!0);function Ae(){if(k){var we={getBoundingClientRect:function(){if(!T)return f.getBoundingClientRect()}};H(we),k.postMessage({resize:{width:we.width,height:we.height}});return}Ee.width=Ee.height=null}function Oe(){se=null,D&&(B=!1,t.removeEventListener("resize",Ae)),T&&f&&(document.body.contains(f)&&document.body.removeChild(f),f=null,te=!1)}return D&&!B&&(B=!0,t.addEventListener("resize",Ae,!1)),k?k.fire(V,Ee,Oe):ae(V,Ee,Oe)}return he.reset=function(){k&&k.reset(),se&&se.reset()},he}var fe;function me(){return fe||(fe=W(null,{useWorker:!0,resize:!0})),fe}function Ge(f,h,T,D,B,R,q){var k=new Path2D(f),H=new Path2D;H.addPath(k,new DOMMatrix(h));var te=new Path2D;return te.addPath(H,new DOMMatrix([Math.cos(q)*B,Math.sin(q)*B,-Math.sin(q)*R,Math.cos(q)*R,T,D])),te}function bs(f){if(!o)throw new Error("path confetti are not supported in this browser");var h,T;typeof f=="string"?h=f:(h=f.path,T=f.matrix);var D=new Path2D(h),B=document.createElement("canvas"),R=B.getContext("2d");if(!T){for(var q=1e3,k=q,H=q,te=0,re=0,se,ae,he=0;he<q;he+=2)for(var V=0;V<q;V+=2)R.isPointInPath(D,he,V,"nonzero")&&(k=Math.min(k,he),H=Math.min(H,V),te=Math.max(te,he),re=Math.max(re,V));se=te-k,ae=re-H;var pe=10,be=Math.min(pe/se,pe/ae);T=[be,0,0,be,-Math.round(se/2+k)*be,-Math.round(ae/2+H)*be]}return{type:"path",path:h,matrix:T}}function Pt(f){var h,T=1,D="#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 f=="string"?h=f:(h=f.text,T="scalar"in f?f.scalar:T,B="fontFamily"in f?f.fontFamily:B,D="color"in f?f.color:D);var R=10*T,q=""+R+"px "+B,k=new OffscreenCanvas(R,R),H=k.getContext("2d");H.font=q;var te=H.measureText(h),re=Math.ceil(te.actualBoundingBoxRight+te.actualBoundingBoxLeft),se=Math.ceil(te.actualBoundingBoxAscent+te.actualBoundingBoxDescent),ae=2,he=te.actualBoundingBoxLeft+ae,V=te.actualBoundingBoxAscent+ae;re+=ae+ae,se+=ae+ae,k=new OffscreenCanvas(re,se),H=k.getContext("2d"),H.font=q,H.fillStyle=D,H.fillText(h,he,V);var pe=1/T;return{type:"bitmap",bitmap:k.transferToImageBitmap(),matrix:[pe,0,0,pe,-re*pe/2,-se*pe/2]}}s.exports=function(){return me().apply(this,arguments)},s.exports.reset=function(){me().reset()},s.exports.create=W,s.exports.shapeFromPath=bs,s.exports.shapeFromText=Pt})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),vs,!1);const ai=vs.exports;vs.exports.create;const ii={particleCount:350,spread:120,origin:{y:.6},angle:90},oi={TOP_RIGHT:{angle:225,origin:{x:.9,y:0}},BOTTOM_RIGHT:{angle:100,origin:{x:.9,y:.9}}},qt=e=>{let t=oi[e];t||(t={});const s={...ii,...t};ai(s)},li=()=>{const[e]=xe.useTheme(),{mutate:t,isPending:s}=ps(),{mutateAsync:n,isPending:a}=Ln(),i=()=>{n({settings:{theme:e}})},o=()=>{t({ids:["THEME"]},{onSuccess:()=>{qt("BOTTOM_RIGHT")}})};return r.jsxs("div",{className:"bg-white py-3 flex items-center justify-center gap-x-3 border-t",children:[r.jsx(u.Button,{size:"sm",variant:"outline",disabled:s||a,onClick:i,children:"Save draft"}),r.jsx(u.Button,{size:"sm",disabled:s||a,onClick:o,children:"Publish"})]})};function ci({addEditPage:e,additionalPageTypes:t=[],close:s}){var $,ce;const n=!!(e!=null&&e.id),{data:a}=Wt(),{mutate:i,isPending:o}=kn(),{mutate:l,isPending:c}=ys(),[d,g]=E.useState(null),[m,j]=E.useState((e==null?void 0:e.pageType)??"page"),[x,v]=E.useState((e==null?void 0:e.parent)??""),[b,S]=E.useState((e==null?void 0:e.name)??""),[C,p]=E.useState(((e==null?void 0:e.slug)??"").split("/").pop()||""),[N,L]=E.useState((e==null?void 0:e.dynamic)??!1),w=o||c,Y=t.find(A=>A.key===m),ne=A=>{j(A),v(""),p(""),L(!1)},U=A=>{L(A),A&&p("")},M=A=>{if(v(A),A&&A!=="none"){const W=a==null?void 0:a.find(me=>me.id===A),fe=(W==null?void 0:W.slug)||"";if(C.startsWith(fe)){const me=C.slice(fe.length).replace(/^\/+/,"");p(me)}else p(C.replace(/^\/+/,""))}else p(C?`${C}`:"")},Q=A=>{if(A.preventDefault(),C.length>0&&!N&&!C.match(/^[a-zA-Z0-9-_]+$/)){g("Slug can only contain letters, numbers, and hyphens");return}if(N&&C!==""){g("Slug must be empty when using dynamic slug");return}if(!b.trim()){ee.toast.error("Name is required");return}if(m==="global"){const W={pageType:"global",name:b,slug:""};if(n){l({id:e==null?void 0:e.id,name:b},{onSuccess:()=>{ee.toast.success("Global Block updated successfully"),s()}});return}i(W,{onSuccess:()=>{ee.toast.success("Global Block created successfully"),s()}});return}if(x&&x!=="none"){if(!C.trim()&&!N){ee.toast.error("Child page slug is required");return}const W=a==null?void 0:a.find(f=>f.id===x),fe=(W==null?void 0:W.slug)||"",me=fe==="/"?`/${C}`:`${fe}/${C}`;if(Object.keys(Se).some(f=>me===`/${f}`||(me==null?void 0:me.startsWith(`/${f}/`)))){ee.toast.error("Slugs cannot start with a language code for primary page");return}const Pt={pageType:m,name:b,slug:me.replace(/\/$/,""),parent:x,dynamic:N};if(n){l({id:e==null?void 0:e.id,...Pt},{onSuccess:()=>{ee.toast.success("Page updated successfully"),s()}});return}i(Pt,{onSuccess:()=>{ee.toast.success("Page created successfully"),s()}})}else{const W={pageType:m,name:b,slug:C===""?"/":`/${C.replace(/\/$/,"")}`};if(n){l({id:e==null?void 0:e.id,...W},{onSuccess:()=>{ee.toast.success("Page updated successfully"),s()}});return}i(W,{onSuccess:()=>{ee.toast.success("Page created successfully"),s()}})}};return m==="global"?r.jsxs("form",{onSubmit:Q,className:"w-full max-w-md mx-auto space-y-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(u.Label,{htmlFor:"pageType",className:"text-sm",children:"Page Type"}),r.jsx("select",{id:"pageType",value:m,disabled:n,onChange:A=>ne(A.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${n?"cursor-not-allowed text-gray-500":""}`,children:t.map(A=>r.jsx("option",{value:A.key,children:A.name},A.key))}),r.jsx("p",{className:"text-sm text-gray-500",children:($=t.find(A=>A.key===m))==null?void 0:$.helpText})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(u.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),r.jsx(u.Input,{id:"name",value:b,onChange:A=>S(A.target.value),required:!0,"aria-required":"true"})]}),r.jsx(u.Button,{disabled:w,type:"submit",className:"w-full",children:n?w?"Updating...":"Update Global Block":w?"Creating...":"Create Global Block"})]}):r.jsxs("form",{onSubmit:Q,className:"w-full max-w-md mx-auto space-y-4",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(u.Label,{htmlFor:"pageType",className:"text-sm",children:"Page Type"}),r.jsx("select",{id:"pageType",value:m,disabled:n,onChange:A=>ne(A.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${n?"cursor-not-allowed text-gray-500":""}`,children:t.map(A=>r.jsx("option",{value:A.key,children:A.name},A.key))})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(u.Label,{htmlFor:"parentPage",className:"text-sm",children:"Parent"}),r.jsxs("select",{id:"parentPage",value:x,onChange:A=>M(A.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(A=>A.pageType!=="global"&&A.slug!=="/").map(A=>r.jsxs("option",{value:A.id,children:[A.name," (",A.slug,")"]},A.id))]})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(u.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),r.jsx(u.Input,{id:"name",value:b,onChange:A=>S(A.target.value),required:!0,"aria-required":"true"})]}),(Y==null?void 0:Y.dynamicSegments)&&x&&x!=="none"&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx("input",{type:"checkbox",id:"useDynamicSlug",checked:N,onChange:A=>U(A.target.checked),className:"rounded border-gray-300"}),r.jsx(u.Label,{htmlFor:"useDynamicSlug",className:"text-sm",children:"Use Dynamic Slug"})]}),N&&r.jsxs("div",{className:"text-sm text-gray-500",children:["Pages will use pattern: ",Y==null?void 0:Y.dynamicSlug]})]}),(!(Y!=null&&Y.dynamicSegments)||!N)&&r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs(u.Label,{htmlFor:"slug",className:"text-sm",children:["Slug",x&&x!=="none"&&r.jsxs("span",{className:"ml-2 text-sm text-gray-500",children:["Parent:"," ",(ce=a==null?void 0:a.find(A=>A.id===x))==null?void 0:ce.slug]})]}),r.jsx(u.Input,{id:"slug",value:C,onChange:A=>p(A.target.value),placeholder:x&&x!=="none"?"Enter page slug":m==="page"?"Leave empty for home page":"Required - e.g. /your-slug"}),d&&r.jsx("p",{className:"text-xs text-red-500",children:d})]}),r.jsx(u.Button,{disabled:w,type:"submit",className:"w-full",children:n?w?"Updating...":"Update page":w?"Creating...":"Create Page"})]})}const ui=({addEditPage:e,setAddEditPage:t})=>{const{data:s}=At(),n=!!(e!=null&&e.id);return r.jsx(u.Dialog,{open:!!e,onOpenChange:()=>t(void 0),children:r.jsxs(u.DialogContent,{className:"sm:max-w-[425px]",children:[r.jsxs(u.DialogHeader,{children:[r.jsxs(u.DialogTitle,{children:[n?"Edit":"Add New"," "]}),r.jsx(u.DialogDescription,{children:n?"Update your page name":"Enter details to create a new page"})]}),r.jsx(ci,{addEditPage:e,close:()=>t(void 0),additionalPageTypes:s??[]})]})})},es=({parentSlug:e,page:t,active:s,changeActivePage:n,setUnpublishPage:a,setDeletePage:i,setAddEditPage:o})=>{const{data:l}=At(),c=y.find(l,{key:t.pageType});return r.jsxs("div",{onClick:()=>n(y.get(t,"id")),className:`rounded flex p-1.5 items-center justify-between leading-none duration-300 cursor-pointer px-3 py-1.5 ${s?"bg-gray-200":"hover:bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-x-2",children:[t.dynamic?r.jsx("div",{className:"w-4 h-4 text-slate-500 stroke-[1]",children:r.jsx(I.StarsIcon,{className:"w-4 h-4 text-yellow-400"})}):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(I.Globe,{className:"w-4 h-4 text-slate-500 stroke-[1]"}):r.jsx(I.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 truncate text-slate-800",children:y.startCase(t.name)??""}),t.pageType!=="global"?r.jsxs(u.Badge,{variant:"outline",className:"ml-2 text-xs max-w-full font-bold leading-none rounded-full text-slate-500",children:[y.get(t,"slug").replace(e,"")||"/",t.dynamic&&r.jsx("span",{className:"text-xs font-light leading-none text-slate-500",children:`${c==null?void 0:c.dynamicSlug}`})]}):r.jsx(u.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(u.DropdownMenu,{children:[r.jsx(u.DropdownMenuTrigger,{asChild:!0,onClick:d=>d.stopPropagation(),children:r.jsx(I.MoreHorizontal,{className:"h-4 w-4 hover:stroke-[3]"})}),r.jsxs(u.DropdownMenuContent,{align:"end",className:"text-sm",children:[r.jsxs(u.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:d=>{d.stopPropagation(),o({...t,global:t.pageType==="global"})},children:[r.jsx(I.Pencil,{className:"size-3"}),"Edit"]}),(t==null?void 0:t.online)&&r.jsxs(u.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:d=>{d.stopPropagation(),a(t)},children:[r.jsx(I.Power,{className:"size-3"}),P.UNPUBLISH]}),r.jsxs(u.DropdownMenuItem,{className:"flex items-center gap-2 cursor-pointer",onClick:d=>{d.stopPropagation(),i(t)},children:[r.jsx(I.Trash,{className:"size-3"}),P.DELETE]})]})]})})]})},di=({close:e})=>{const[,t]=E.useState([]),[s,n]=E.useState(""),[a,i]=E.useState(null),[o,l]=E.useState(null),[c,d]=E.useState(null),{mutate:g}=Pn(),{data:m,isFetching:j}=Wt(),[x,v]=ve(),b=x.get("page"),S=E.useCallback(p=>{b&&g({id:b});const L=new URLSearchParams(window.location.search).get("lang"),w=new URLSearchParams({page:p});L&&w.set("lang",L),window.history.pushState({},"",`?${w.toString()}`),v(w),window.dispatchEvent(new PopStateEvent("popstate")),e()},[b,v,e,g]);E.useEffect(()=>{if(b&&!j){const p=y.find(m,{id:b});p&&(p!=null&&p.pageType)?t(N=>[...N,p==null?void 0:p.pageType]):(window.history.replaceState(null,"","/"),v(new URLSearchParams({})),window.dispatchEvent(new PopStateEvent("popstate")))}},[m,b,j,v]);const C=E.useMemo(()=>{const p=y.filter(m,U=>y.isEmpty(s)?!0:y.includes(y.toLower(U==null?void 0:U.name),y.toLower(s))||y.includes(y.toLower(U==null?void 0:U.slug),y.toLower(s))),N=new Map;p.forEach(U=>{N.set(U.id,{...U,children:[]})});const L=[],w=[];N.forEach(U=>{if(U.parent){const M=N.get(U.parent);M?M.children.push(U):L.push(U)}else w.push(U)}),L.sort((U,M)=>U.name.localeCompare(M.name)),L.forEach(U=>{U.children.sort((M,Q)=>M.name.localeCompare(Q.name))});const Y=y.filter(w,U=>U.pageType==="global"),ne=y.filter(w,U=>U.pageType!=="global").sort((U,M)=>U.name.localeCompare(M.name));return y.compact([...ne,...Y,...L])},[m,s]);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:"relative flex item-center gap-x-4",children:[r.jsx(I.Search,{strokeWidth:2.5,className:"absolute left-3 top-2.5 h-4 w-4 text-gray-400"}),r.jsx(u.Input,{placeholder:"Search pages...",className:"text-xs font-medium leading-none text-gray-700 pl-9 placeholder:text-gray-400",value:s,onChange:p=>n(p.target.value)})]}),j?r.jsx("div",{className:"space-y-2",children:y.map([...Array(5).keys()],p=>r.jsx("div",{className:"w-full bg-gray-200 rounded h-9 animate-pulse"},p))}):y.isEmpty(C)?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(I.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:y.map(C,p=>p.children.length>0?r.jsxs("div",{className:"border-0",children:[r.jsx(es,{changeActivePage:S,setUnpublishPage:l,setDeletePage:i,setAddEditPage:d,active:b===p.id,page:p}),r.jsx("div",{className:"pt-2 pl-6 bg-white",children:y.map(y.get(p,"children",[]),N=>{const L=b===y.get(N,"id");return r.jsx(es,{parentSlug:p.slug,changeActivePage:S,setUnpublishPage:l,setDeletePage:i,setAddEditPage:d,active:L,page:N},N.id)})})]},p.key):r.jsx(es,{changeActivePage:S,setUnpublishPage:l,setDeletePage:i,setAddEditPage:d,active:b===p.id,page:p},p.id))})]}),r.jsxs(u.Button,{className:"flex text-sm gap-x-2",onClick:()=>{d({slug:"",name:"",pageType:"page"})},children:[r.jsx(I.Plus,{className:"w-4 h-4"})," Add New"]}),c&&r.jsx(ui,{editPage:S,addEditPage:c,setAddEditPage:d}),a&&r.jsx(In,{page:a,onClose:()=>i(null)}),o&&r.jsx(xs,{page:o,onClose:()=>l(null)})]})},hi=()=>{const e=Le("logo",null);return e?r.jsx("div",{className:"w-full max-h-9 overflow-hidden pr-2",children:E.createElement(e,{})}):null},fi=()=>{const[e]=ve(),t=e.get("page"),{data:s,isFetching:n}=Ce(),[a,i]=E.useState(!1),o=!!t&&!y.isEmpty(s),l=!t||!n&&y.isEmpty(s)||a;return r.jsxs(r.Fragment,{children:[r.jsxs(u.Button,{variant:"secondary",className:"flex items-center w-full space-x-2 py-1",onClick:()=>i(!0),children:[r.jsx("div",{children:r.jsx(I.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:"}),n?r.jsx(I.Loader,{className:"h-4 w-4 animate-spin text-slate-400 ml-2"}):y.startCase(y.get(s,"name"))??""]})]},"template-viewer"),r.jsx(u.Sheet,{open:l,onOpenChange:c=>!c&&o&&i(!1),children:r.jsxs(u.SheetContent,{side:"left",className:`!max-w-screen-sm z-50 border-border w-full ${o?"":"sheet-hide-close-btn"}`,children:[r.jsx(u.SheetHeader,{className:"mb-3",children:r.jsxs(u.SheetTitle,{className:"text-sm flex items-center gap-2 font-semibold",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary text-primary-foreground",children:r.jsx(I.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.jsx("div",{className:"h-[calc(100vh-100px)] overflow-y-auto",children:r.jsx(di,{close:()=>i(!1)})})]})})]})},mi=()=>{const{fallbackLang:e,languages:t,selectedLang:s,setSelectedLang:n}=xe.useLanguages(),a=y.isEmpty(s)?e:s,[,i]=ve();E.useEffect(()=>{const v=new URLSearchParams(window.location.search),b=v.get("lang");b&&(t.includes(b)?n(b):(v.delete("lang"),i(v),n("")))},[t,i,n]);const[o,l]=E.useState(null),{data:c}=Ce(),{data:d}=zt(),{data:g,isFetching:m}=Tt(),j=E.useMemo(()=>{const v=y.compact(y.map(y.get(d,"languages"),b=>{const S=y.find(g,{lang:b});return{key:b,value:y.get(Se,b,b),isLangPageAdded:!!S}})).filter(Boolean);return[{key:e,value:y.get(Se,e),isLangPageAdded:!0},...v]},[e,g,d]),x=v=>{n(v);const b=new URLSearchParams(window.location.search);v===e?b.delete("lang"):b.set("lang",v);const S=b.toString(),C=`${window.location.pathname}${S?`?${S}`:""}`;window.history.pushState({},"",C),i(b),window.dispatchEvent(new PopStateEvent("popstate"))};return y.isEmpty(t)||m?null:r.jsxs(r.Fragment,{children:[r.jsxs(u.DropdownMenu,{children:[r.jsx(u.DropdownMenuTrigger,{asChild:!0,className:"focus:outline-none",children:r.jsxs(u.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[r.jsx(I.Languages,{className:"w-4 h-4"}),y.get(Se,a,a),r.jsx(I.ChevronDown,{className:"w-4 h-4"})]})}),r.jsxs(u.DropdownMenuContent,{className:"border-border space-y-1",children:[y.map(j.filter(v=>v.isLangPageAdded),v=>r.jsxs(u.DropdownMenuItem,{className:xe.mergeClasses("flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",v.key===a&&"!bg-gray-200 text-gray-700"),onClick:()=>x(v.key),children:[r.jsx("div",{className:"text-slate-600",children:v.value}),v.key===e&&r.jsxs("small",{className:"text-[9px] flex items-center gap-x-1 text-orange-500 leading-none",children:[r.jsx(I.Star,{fill:"orange",className:"w-2 h-2"}),"Primary"]})]},v.value)),!y.isEmpty(j.filter(v=>!v.isLangPageAdded))&&r.jsxs(r.Fragment,{children:[r.jsx(u.Separator,{}),r.jsxs(u.Button,{size:"sm",variant:"ghost",onClick:()=>{l({name:c==null?void 0:c.name,pageType:c==null?void 0:c.pageType,lang:"",slug:"",edit:!1})},className:"hover:bg-slate-300 duration-200 font-normal text-xs hover:text-slate-800",children:[r.jsx(I.Plus,{className:"w-3 h-3 mr-1"})," Add Langauge"]})]})]})]}),o&&r.jsx(_n,{languages:t,langProps:o,onClose:()=>l(null)})]})};function gi(){return r.jsxs("div",{className:"flex relative z-10 items-center justify-end gap-1",children:[r.jsx(hi,{}),r.jsx(fi,{}),r.jsx(mi,{})]})}function On({children:e,content:t}){return r.jsx(u.TooltipProvider,{children:r.jsxs(u.Tooltip,{children:[r.jsx(u.TooltipTrigger,{asChild:!0,children:e}),r.jsx(u.TooltipContent,{side:"bottom",sideOffset:10,children:r.jsx("p",{children:t})})]})})}const yi=()=>{const e=oe(),t=le();return F.useQuery({queryKey:[_.GET_CHANGES],queryFn:async()=>t(e,{action:_.GET_CHANGES})})},pi=({currentEditor:e})=>{const{data:t}=Cn(e);return t==null?void 0:t.name};function xi({showModal:e=!1,onClose:t=()=>console.log("Cancelled")}){const[s,n]=E.useState([]),{data:a,isFetching:i}=yi(),{data:o}=At(),l=E.useMemo(()=>y.filter(a,p=>p.pageType!=="global"),[a]),c=E.useMemo(()=>y.filter(a,{pageType:"global"}),[a]),d=E.useMemo(()=>y.find(a,{pageType:"theme",id:"THEME"}),[a]),{mutate:g,isPending:m}=ps();E.useEffect(()=>{const p=y.map(y.filter(a,{online:!0}),"id");d&&p.push(d==null?void 0:d.id),n(p)},[a,d]);const j=s.length===(a==null?void 0:a.length),x=p=>{n(N=>y.includes(N,p)?y.filter(N,L=>L!==p):y.concat(N,p))},v=()=>{n(j?[]:y.map(a,"id"))},b=()=>{g({ids:y.uniq(s)},{onSuccess:()=>{t(),qt("CENTER_CENTER")}})},S=p=>{if(p==="global")return"Global Block";if(p==="theme")return"Theme";const N=y.find(o,{key:p});return N?N==null?void 0:N.name:p},C=E.useMemo(()=>{const p=[{label:"Updated Pages & Global Blocks",top:"pt-2"},...y.orderBy(y.filter(l,{online:!0}),"pageType"),...y.orderBy(y.filter(c,{online:!0}),"pageType")].filter(w=>w.pageType!=="theme"),N=[{label:"Offline Pages & Global Blocks",top:"pt-6"},...y.orderBy(y.filter(l,{online:!1}),"pageType"),...y.orderBy(y.filter(c,{online:!1}),"pageType")],L=d?[{label:"Theme",top:"pt-6"},d]:[];return[...p,...L,...N]},[l,c,d]);return r.jsx(u.Dialog,{open:e,onOpenChange:m?()=>{}:t,children:r.jsxs(u.DialogContent,{className:"max-w-4xl max-h-[80%] flex flex-col",children:[r.jsxs(u.DialogHeader,{children:[r.jsx(u.DialogTitle,{children:"Publish changes"}),r.jsx(u.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),r.jsx("div",{className:"relative h-full max-h-full -mx-4 overflow-y-auto no-scrollbar",children:i?r.jsxs("div",{className:"px-1 space-y-2",children:[r.jsx("div",{className:"w-full h-6 mt-2 bg-gray-200 rounded animate-pulse"}),r.jsx("div",{className:"w-full h-6 bg-gray-200 rounded animate-pulse"}),r.jsx("div",{className:"w-full h-6 bg-gray-200 rounded animate-pulse"}),r.jsx("div",{className:"w-full h-6 bg-gray-200 rounded animate-pulse"})]}):r.jsxs("table",{className:"w-full text-xs text-left text-gray-500 rtl:text-right 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:j,onClick:p=>{p.stopPropagation(),v()},type:"checkbox",className:"mt-1 rounded cursor-pointer focus:outline-none focus:ring-0"}),"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:y.map(C,p=>p.label?r.jsx("tr",{children:r.jsxs("td",{colSpan:4,className:`px-6 py-2 text-xs font-medium text-gray-800 relative ${p.top}`,children:[r.jsx("div",{className:"absolute inset-0 flex items-center left-6",children:r.jsx("div",{className:"w-full order-gray-300"})}),r.jsx("div",{className:"relative flex justify-start",children:r.jsx("span",{className:"pr-2 bg-gray-50",children:p.label})})]})},"separator"):r.jsxs("tr",{className:"border-b group hover:bg-gray-50 last:border-b-0",children:[r.jsxs("td",{scope:"row",className:"flex items-center px-6 py-2 text-gray-900 whitespace-nowrap dark:text-white gap-x-1",children:[r.jsx("input",{checked:y.includes(s,p==null?void 0:p.id),onClick:N=>{N.stopPropagation(),x(p==null?void 0:p.id)},type:"checkbox",className:"rounded cursor-pointer focus:outline-none focus:ring-0"})," ",p.pageType==="global"?r.jsx(I.GlobeIcon,{className:"w-4 h-4"}):r.jsx(I.File,{className:"w-4 h-4"}),p.name,p.slug&&r.jsxs("span",{className:"text-xs text-gray-500",children:["(",p.slug,")"]}),p.currentEditor&&r.jsx("div",{className:"flex items-center gap-x-1",children:r.jsxs("span",{className:"flex text-xs font-bold text-gray-500",children:[" ","-"," ",r.jsx(pi,{currentEditor:p.currentEditor})," ","is editing"]})})]}),r.jsx("td",{className:"px-2",children:p.lang}),r.jsx("td",{className:"px-2",children:S(p==null?void 0:p.pageType)}),r.jsx("td",{className:"px-4 text-right",children:y.first(p.changes)||""})]},p==null?void 0:p.id))})]})}),r.jsxs(u.DialogFooter,{className:"mt-10",children:[r.jsx(u.Button,{disabled:m,variant:"outline",onClick:t,children:"Cancel"}),r.jsx(u.Button,{disabled:m||i||y.isEmpty(a),onClick:b,children:m?"Publishing...":"Publish"})]})]})})}const vi=()=>{const e=le(),t=oe();return F.useQuery({queryKey:[_.GET_WEBSITE_DATA],staleTime:1e3*60*5,queryFn:async()=>e(t,{action:_.GET_WEBSITE_DATA,data:{draft:!0}})})};function bi({onClose:e}){const{data:t,isFetching:s}=vi(),{mutateAsync:n,isPending:a}=Ha(),i=Le("settingComponent",null),o=y.debounce(async l=>(await n({data:l}),!0),300);return i?r.jsx(u.Dialog,{open:!0,onOpenChange:e,children:r.jsxs(u.DialogContent,{className:"w-full",children:[r.jsx(u.DialogHeader,{children:r.jsx(u.DialogTitle,{children:"Website Settings"})}),s?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:E.createElement(i,{data:t||{},onSave:a?()=>{}:o,cancel:a?()=>{}:e})})]})}):null}const Ei=()=>{const{selectedLang:e}=xe.useLanguages(),t=Le("getPreviewUrl",async c=>c),[s,n]=E.useState(""),{data:a,isFetching:i}=Ce(),{data:o}=Tt(),l=E.useMemo(()=>{var c;return(c=o==null?void 0:o.find(d=>(d==null?void 0:d.lang)===e))==null?void 0:c.slug},[e,o]);return E.useEffect(()=>{(async()=>{if(l&&typeof t=="function"){const c=await t(l||"");n(c)}else n("")})()},[t,l]),!s||(a==null?void 0:a.pageType)==="global"||i?null:r.jsx(r.Fragment,{children:r.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:r.jsxs(u.Button,{variant:"ghost",size:"sm",className:"gap-2",children:[r.jsx(I.Eye,{className:"w-4 h-4"})," ",P.PREVIEW]})})})},Si=()=>{const[e,t]=xe.useRightPanel();return r.jsxs(r.Fragment,{children:[r.jsx(On,{content:P.THEME,children:r.jsx(u.Button,{variant:e==="theme"?"outline":"ghost",size:"icon",className:"gap-2",onClick:()=>t(e==="theme"?"block":"theme"),children:r.jsx(I.Palette,{className:"w-4 h-4"})})}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]})},wi=()=>{const[e,t]=E.useState(!1),{isLocked:s}=Ct(),{savePage:n,saveState:a}=xe.useSavePage();E.useEffect(()=>{const g=m=>{a==="UNSAVED"&&(m.preventDefault(),m.returnValue=!1)};return a==="UNSAVED"&&window.addEventListener("beforeunload",g),()=>{window.removeEventListener("beforeunload",g)}},[a]);const i=E.useCallback(async()=>{t(!0),await n(!1)},[n]);E.useEffect(()=>{a==="SAVED"&&t(!1)},[a]);const o=E.useMemo(()=>{if(a==="SAVED"||a==="UNSAVED")return a;if(a==="SAVING")return e?a:"SAVED"},[e,a]),{buttonIcon:l,buttonClass:c,tooltipContent:d}=E.useMemo(()=>{switch(o){case"UNSAVED":return{tooltipContent:P.SAVEDRAFT,buttonIcon:r.jsx(I.Save,{className:"w-4 h-4"}),buttonClass:"flex items-center gap-x-1 leading-tight"};case"SAVING":return{tooltipContent:P.SAVING,buttonIcon:r.jsx(I.Loader,{className:"w-4 h-4 animate-spin"}),buttonClass:"flex items-center gap-x-1 leading-tight"};case"SAVED":return{tooltipContent:P.SAVED,buttonIcon:r.jsx(I.CheckCircle,{className:"w-4 h-4"}),buttonClass:"text-green-500 flex items-center gap-x-1 leading-tight"}}},[o]);return s?null:r.jsxs(u.Button,{size:"sm",variant:"ghost",onClick:i,className:c,children:[l," ",d]})},ji=()=>{const[e,t]=E.useState(!1),[s,n]=E.useState(!1),[a,i]=E.useState(null),{data:o}=Ce(),{mutate:l,isPending:c}=ps(),[d]=xe.useBlocksStore(),{buttonText:g,buttonClassName:m,isPublished:j}=E.useMemo(()=>{const v=o&&(o==null?void 0:o.online);return{buttonClassName:v?"hover:bg-green-600 bg-green-500":"",isPublished:v,buttonText:v?P.PUBLISHED:P.PUBLISH}},[o]),x=async()=>{var b,S;const v=((S=(b=d==null?void 0:d.filter(C=>(C==null?void 0:C._type)==="GlobalBlock"))==null?void 0:b.map(C=>C==null?void 0:C.globalBlock))==null?void 0:S.filter(C=>typeof C=="string"))||[];l({ids:[o==null?void 0:o.id,...v]},{onSuccess:()=>qt("TOP_RIGHT")})};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex",children:[r.jsxs(u.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 ${m}`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[r.jsx("span",{className:`flex items-center transition-transform duration-300 ease-in-out ${s?"-translate-y-10":""}`,children:j?r.jsx(I.Send,{className:"w-4 h-4"}):r.jsx(I.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 ${s?"":"translate-y-10"}`,children:j?r.jsx(I.Rocket,{className:"w-4 h-4"}):r.jsx(I.Send,{className:"w-4 h-4"})}),r.jsx("span",{children:g})]}),r.jsxs(u.DropdownMenu,{children:[r.jsx(u.DropdownMenuTrigger,{asChild:!0,children:r.jsx(u.Button,{size:"sm",disabled:c||!(o!=null&&o.id),className:`px-2 text-white border-l border-white/50 rounded-l-none ${m}`,children:r.jsx(I.ChevronDown,{className:"w-4 h-4"})})}),r.jsxs(u.DropdownMenuContent,{align:"end",className:"w-36",children:[!j&&r.jsxs(u.DropdownMenuItem,{disabled:c,className:"text-xs cursor-pointer",onClick:()=>l({ids:[o==null?void 0:o.id]},{onSuccess:()=>qt("TOP_RIGHT")}),children:[P.PUBLISH," page"]}),r.jsxs(u.DropdownMenuItem,{onClick:()=>t(!0),className:"text-xs cursor-pointer",children:[P.OPEN," publish menu"]}),j&&r.jsxs(u.DropdownMenuItem,{onClick:()=>i(o),className:"text-xs cursor-pointer",children:[P.UNPUBLISH," page"]})]})]})]}),r.jsx(xi,{showModal:e,onClose:()=>t(!1)}),a&&r.jsx(xs,{page:a,onClose:()=>i(null)})]})},Ni=()=>{const e=Le("settingComponent",null),[t,s]=E.useState(!1);return e?r.jsxs(r.Fragment,{children:[r.jsx(On,{content:P.WEBSITEDATA,children:r.jsx(u.Button,{variant:"ghost",size:"icon",className:"gap-2",onClick:()=>s(!0),children:r.jsx(I.Settings,{className:"w-4 h-4"})})}),t&&r.jsx(bi,{onClose:()=>s(!1)}),r.jsx("div",{className:"w-px h-4 bg-gray-200 dark:bg-gray-700"})]}):null},Ci=()=>{const{data:e}=Ce(),t=e&&(e==null?void 0:e.online);return(e==null?void 0:e.pageType)==="global"?null:r.jsxs(u.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(I.ExternalLink,{className:"w-4 h-4"}),r.jsx("span",{className:"hidden sm:inline",children:P.OPEN})]})};function Ai(){const{isLocked:e}=Ct(),[t]=ve(),s=t.get("lang"),n=Dn(s);return e||!n?null:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(Si,{}),r.jsx(Ni,{}),r.jsx(Ei,{}),r.jsx(wi,{}),r.jsx(ji,{}),r.jsx(Ci,{})]})}Vn.loadWebBlocks();const Ti=e=>{const t=E.useRef([]),[s]=ve(),n=s.get("page"),a=s.get("lang"),{data:i}=Ce(),{data:o}=Va(),{data:l,isFetching:c}=An(),{blocks:d}=Fa(l),{data:g}=zt(),{data:m}=At(),{mutateAsync:j}=Ln(),x=Ba(),{getUILibraryBlock:v,getUILibraryBlocks:b,onSave:S}=Ka(),{getGlobalBlocks:C,getGlobalBlockBlocks:p}=Wa(),{aiContext:N,setAiContext:L}=gs(),{mutateAsync:w}=$a(),[Y,ne]=E.useState(!1),U=E.useMemo(()=>(g==null?void 0:g.fallbackLang)||"en",[g]),{data:M}=Tn({pageType:i==null?void 0:i.pageType,lang:a||U});E.useEffect(()=>{const W=()=>{document.hidden?ne(!0):ne(!1)};return window.addEventListener("visibilitychange",W),()=>window.removeEventListener("visibilitychange",W)},[]),t.current=d;const Q=E.useMemo(()=>{const W={};return e.mediaManagerComponent&&(W.mediaManagerComponent=e.mediaManagerComponent),W},[e.mediaManagerComponent]),$=E.useMemo(()=>Array.isArray(e==null?void 0:e.uiLibraries)?[...o,...e==null?void 0:e.uiLibraries]:o,[o,e==null?void 0:e.uiLibraries]),ce=E.useCallback(async(W,fe)=>await w({pageType:W,query:fe}),[w]),A=E.useMemo(()=>y.get(g,"theme",{})||{},[g]);return r.jsxs(r.Fragment,{children:[c&&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(I.Loader2,{className:"size-5 animate-spin"})})}),r.jsx(xe.ChaiBuilderEditor,{pageExternalData:M,themePresets:e.themePresets??[],pageId:i==null?void 0:i.id,addBlocksDialogTabs:e.addBlocksDialogTabs||[],loading:c,fallbackLang:U,languages:(g==null?void 0:g.languages)||[],brandingOptions:(g==null?void 0:g.theme)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSaveSupport:!Y&&(e.autoSaveSupport??!0),autoSaveInterval:e.autoSaveInterval??15,onError:e.onError||console.error,getGlobalBlockBlocks:p,getGlobalBlocks:C,blocks:c?[]:d,theme:y.cloneDeep(A),getUILibraryBlock:v,getUILibraryBlocks:b,uiLibraries:$,pageTypes:m,searchPageTypeItems:ce,saveAiContextCallback:async W=>{if(!n)return!0;const fe=t.current,me={_type:"@chai/ai-context",_value:y.isString(W)?W:""},Ge=[...fe,me];return await S({page:n,blocks:Ge}),L(W),!0},aiContext:N,askAiCallBack:x,onSave:async({blocks:W,theme:fe})=>{if(!n)return!0;t.current=W;const me={_type:"@chai/ai-context",_value:y.isString(N)?N:""},Ge=[...W,me];return await S({page:n,blocks:Ge}),t.current=Ge,y.isEqual(fe,A)||await j({settings:{theme:fe}}),!0},topBarComponents:{left:[gi],right:[Ai]},sideBarComponents:{top:[...(i==null?void 0:i.pageType)!=="global"?[{label:"SEO Setting",component:Gn,icon:r.jsx(r.Fragment,{children:r.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 21 21",fill:"currentColor",width:"21",height:"21",children:[r.jsx("path",{d:"M9.931 6.818c-1.238 0-2.136.925-2.136 2.2 0 1.279.898 2.207 2.136 2.207.664 0 1.257-.246 1.67-.694a.15.15 0 0 0-.009-.213l-.311-.286a.15.15 0 0 0-.213.009c-.273.297-.677.46-1.137.46-.699 0-1.233-.444-1.375-1.12h3.295a.15.15 0 0 0 .151-.151v-.211c0-1.295-.852-2.2-2.072-2.2m0 .724c.697 0 1.188.422 1.315 1.113h-2.69c.142-.673.676-1.113 1.374-1.113m4.332-.724c-1.246 0-2.15.925-2.15 2.2 0 1.279.904 2.207 2.15 2.207.596 0 1.143-.223 1.538-.628s.612-.965.612-1.579c0-1.275-.904-2.2-2.15-2.2m0 3.683c-.826 0-1.426-.624-1.426-1.483 0-.855.6-1.475 1.426-1.475s1.426.621 1.426 1.476c0 .423-.144.804-.406 1.073-.258.264-.62.41-1.019.41M6.318 8.71c-.665-.206-.902-.335-.902-.645 0-.47.564-.521.806-.521.29 0 .552.07.801.215a.15.15 0 0 0 .206-.055l.212-.366a.15.15 0 0 0-.055-.206 2.27 2.27 0 0 0-1.165-.312c-.915 0-1.53.501-1.53 1.245 0 .899.816 1.152 1.411 1.336.655.203.812.307.804.53-.016.398-.567.429-.735.429-.386 0-.722-.129-.972-.374q-.043-.042-.107-.043a.15.15 0 0 0-.106.045l-.295.302a.15.15 0 0 0 .002.213c.383.374.908.58 1.478.58.859 0 1.432-.441 1.459-1.125.031-.833-.746-1.074-1.313-1.249"}),r.jsx("path",{d:"M20.396 2.049H.604A.604.604 0 0 0 0 2.653v12.7c0 .333.27.604.604.604h6.941c-.266 1.296-.881 1.966-.886 1.971a.604.604 0 0 0 .434 1.024h6.815a.604.604 0 0 0 .434-1.024c-.007-.007-.621-.675-.886-1.971h6.941c.333 0 .604-.27.604-.604V2.652a.604.604 0 0 0-.604-.604m-.604 12.701h-.985v-.17a.604.604 0 0 0-1.208 0v.17h-.63v-.17a.604.604 0 0 0-1.208 0v.17H1.207V3.256h18.585z"})]})})}]:[],...y.isEmpty(g==null?void 0:g.languages)?[]:[{label:`Language ${(i==null?void 0:i.pageType)==="global"?"":"page"}`,component:Ja,icon:r.jsx(I.Languages,{className:"w-5 h-5 stroke-[2]"})}]],bottom:[...e!=null&&e.sidebarBottomComponents?[...e.sidebarBottomComponents]:[],ti,si]},themePanelComponent:li,...Q})]})},Pi=new F.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnReconnect:!1}}}),Li=e=>{const[,t]=Nn(),[s,n]=E.useState(!1);return E.useEffect(()=>(t(y.pick(e,["apiUrl","getPreviewUrl","logo","settingComponent","user","onSessionExpired","pageLockComponent"])),setTimeout(()=>{n(!0)},200),()=>{n(!1),t({})}),[e,t]),s?r.jsxs(F.QueryClientProvider,{client:Pi,children:[r.jsx(Ti,{...e}),r.jsx(Oa,{})]}):r.jsx("div",{})};exports.$TRACK=us;exports.ChaiBuilderPages=Li;exports.Dynamic=qr;exports.For=gr;exports.Index=yr;exports.Match=vr;exports.Portal=Fr;exports.Show=pr;exports.Switch=xr;exports.addEventListener=tn;exports.batch=Xn;exports.className=en;exports.clearDelegatedEvents=kr;exports.convertRemToPixels=La;exports.createComponent=fs;exports.createComputed=qs;exports.createContext=nr;exports.createEffect=ds;exports.createMemo=ye;exports.createRenderEffect=_e;exports.createRoot=Ie;exports.createSignal=ie;exports.createUniqueId=mr;exports.delegateEvents=Js;exports.deleteNestedDataByPath=lt;exports.displayValue=ja;exports.getMutationStatusColor=Sa;exports.getPreferredColorScheme=ka;exports.getQueryStatusColor=Ea;exports.getQueryStatusColorByLabel=wa;exports.getQueryStatusLabel=va;exports.getSidedProp=ba;exports.insert=Ft;exports.mergeProps=ms;exports.mutationSortFns=Pa;exports.on=Zn;exports.onCleanup=nt;exports.onMount=Hs;exports.serialize=En;exports.setAttribute=Rt;exports.sortFns=Aa;exports.splitProps=Qs;exports.spread=sn;exports.stringify=xa;exports.template=Lr;exports.untrack=de;exports.updateNestedDataByPath=ot;exports.use=nn;exports.useContext=rr;exports.useTransition=sr;
|