@chaibuilder/sdk 1.2.26 → 1.2.28
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/{AddBlocks-l1JENNvq.js → AddBlocks-0sW6gkCO.js} +5 -5
- package/dist/AddBlocks-YJPdSqcY.cjs +1 -0
- package/dist/{BrandingOptions-udtH5yJs.js → BrandingOptions--vgnQvD1.js} +8 -8
- package/dist/{BrandingOptions-DkpqGARR.cjs → BrandingOptions-RDn_Nhcq.cjs} +1 -1
- package/dist/CanvasArea-41QoxuLf.cjs +55 -0
- package/dist/CanvasArea-aii0PyU-.js +1179 -0
- package/dist/{Class-lGzsNBOK.js → Class-6Hz2KzYb.js} +1 -1
- package/dist/{Class-PoYusiA5.cjs → Class-Zc8hpE7f.cjs} +1 -1
- package/dist/{CurrentPage-tJUjXWdb.js → CurrentPage-06Iacwyp.js} +6 -6
- package/dist/{CurrentPage-Hl52iub_.cjs → CurrentPage-2W1pdAOG.cjs} +1 -1
- package/dist/ListTree-DnA8gj-7.js +314 -0
- package/dist/ListTree-pdQ14QJC.cjs +1 -0
- package/dist/MODIFIERS-YPHRtwrM.cjs +1 -0
- package/dist/{MODIFIERS-dytZ-osO.js → MODIFIERS-cBT31iqE.js} +3 -11
- package/dist/{PagesPanel-WzCocl6u.cjs → PagesPanel-PBFzPSNY.cjs} +1 -1
- package/dist/{PagesPanel-6rrLXEO-.js → PagesPanel-_1CDTUdE.js} +7 -7
- package/dist/{ProjectPanel-o7gdcwPn.cjs → ProjectPanel-755bbzEQ.cjs} +1 -1
- package/dist/{ProjectPanel-tz3bjdXy.js → ProjectPanel-pUMeIiUW.js} +7 -7
- package/dist/Settings-G9Xtqr7n.cjs +1 -0
- package/dist/{Settings-4s2LUVmC.js → Settings-dnO-s6x0.js} +596 -560
- package/dist/{SidePanels-3o6Okmvu.cjs → SidePanels-Gq2LdVuY.cjs} +1 -1
- package/dist/{SidePanels-bugFfInz.js → SidePanels-VxSXXkt_.js} +56 -56
- package/dist/{Topbar-pWzBEOed.js → Topbar-5zbOSGF6.js} +3 -3
- package/dist/{Topbar-CqW7G360.cjs → Topbar-J2tb4SA1.cjs} +1 -1
- package/dist/{UnsplashImages-qvwFbV-E.js → UnsplashImages-4WAWgA4s.js} +9 -9
- package/dist/{UnsplashImages-NGskB93R.cjs → UnsplashImages-XwjKheek.cjs} +1 -1
- package/dist/{UploadImages-9NapgXBq.js → UploadImages-PONIHtn6.js} +3 -3
- package/dist/{UploadImages-Oh7Glr9A.cjs → UploadImages-y7LAQVrT.cjs} +1 -1
- package/dist/{add-page-modal-k2Kb92HS.js → add-page-modal-4VrFvgEm.js} +7 -7
- package/dist/{add-page-modal--6TTBRYa.cjs → add-page-modal-jWcp0w-S.cjs} +1 -1
- package/dist/{confirm-alert-C4M9eF-o.cjs → confirm-alert-4OQlXZTJ.cjs} +1 -1
- package/dist/{confirm-alert-GUhZ_G8w.js → confirm-alert-j7b88hsW.js} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.js +4 -4
- package/dist/{delete-page-modal-zONvdebd.js → delete-page-modal--xHHdRAq.js} +6 -6
- package/dist/{delete-page-modal-cFoL-wdo.cjs → delete-page-modal-p6b0upz4.cjs} +1 -1
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +4 -4
- package/dist/{form-STUz-6nE.js → form-_GJb9YcB.js} +1 -1
- package/dist/{form-lBQ_76Uw.cjs → form-jQj7E-hS.cjs} +1 -1
- package/dist/html-to-json-LJyJsnmZ.js +228 -0
- package/dist/html-to-json-vP1ESB_e.cjs +1 -0
- package/dist/{index-SkyM3d6Q.js → index-0QJwevON.js} +2 -2
- package/dist/index-12HbDLon.cjs +1 -0
- package/dist/{index-llTXLDGE.js → index-Eb5zyh2F.js} +4 -4
- package/dist/{index-mbyqq81O.cjs → index-KArv7pNz.cjs} +1 -1
- package/dist/{index-Gk6sASBd.js → index-UHaqEdws.js} +993 -957
- package/dist/{index-OB199Izc.cjs → index-mlMvwv2b.cjs} +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +4 -4
- package/dist/{page-viewer-Pdg9F5Hv.js → page-viewer-00Xx4u8e.js} +7 -7
- package/dist/{page-viewer-2kwnKM6v.cjs → page-viewer-SZNm7b1n.cjs} +1 -1
- package/dist/{project-general-setting-CnNL98NM.cjs → project-general-setting-C_pHNuZE.cjs} +1 -1
- package/dist/{project-general-setting-f8Ebsn6K.js → project-general-setting-asDxlmhZ.js} +7 -7
- package/dist/{project-seo-setting-pX34Qsym.js → project-seo-setting-DuAaDfDR.js} +4 -4
- package/dist/{project-seo-setting-mlxL_e2_.cjs → project-seo-setting-q2953ybQ.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.js +1 -1
- package/dist/{single-page-detail-dpe5LT0M.js → single-page-detail-UNxXvhl4.js} +14 -14
- package/dist/{single-page-detail-XfzrGlzA.cjs → single-page-detail-oqj6zsLU.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +6 -6
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +9 -9
- package/dist/useCanvasSettings-MR0Glu1b.cjs +1 -0
- package/dist/useCanvasSettings-R6br4J9i.js +6 -0
- package/dist/web-blocks.cjs +33 -6
- package/dist/web-blocks.js +461 -388
- package/package.json +1 -1
- package/dist/AddBlocks-zPPKkeKs.cjs +0 -1
- package/dist/CanvasArea-h0W-Tyha.js +0 -951
- package/dist/CanvasArea-zme1r3Zi.cjs +0 -55
- package/dist/ListTree-WvTjY5rr.cjs +0 -1
- package/dist/ListTree-cZ-Ihlt3.js +0 -309
- package/dist/MODIFIERS-0g14w5RS.cjs +0 -1
- package/dist/Settings-AqoKwR92.cjs +0 -1
- package/dist/html-to-json-efmv1pCj.cjs +0 -1
- package/dist/html-to-json-ngX9ef2u.js +0 -185
- package/dist/index-h-hd6EvN.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const k=require("react"),i=require("lodash-es"),ne=require("./Functions-N3yhPYKY.cjs"),pe=require("@chaibuilder/runtime"),p=require("jotai"),X=require("./STRINGS-gPz7CUOk.cjs"),cn=require("./_commonjsHelpers-wDK0ZLPo.cjs"),dn=require("@react-hookz/web"),Oe=require("./MODIFIERS-YPHRtwrM.cjs"),u=require("./Class-Zc8hpE7f.cjs");require("react-i18next");const r=require("./jsx-runtime-Z_BpKhVy.cjs"),un=require("@radix-ui/react-toggle"),ce=require("class-variance-authority"),mn=require("@radix-ui/react-switch"),pn=require("@radix-ui/react-slot"),fn=require("@radix-ui/react-accordion"),G=require("@radix-ui/react-icons"),xn=require("@radix-ui/react-alert-dialog"),gn=require("@radix-ui/react-dialog"),hn=require("@radix-ui/react-label"),bn=require("@radix-ui/react-scroll-area"),vn=require("@radix-ui/react-tabs"),yn=require("@radix-ui/react-tooltip"),jn=require("@radix-ui/react-popover"),wn=require("@radix-ui/react-menubar"),Rn=require("@radix-ui/react-hover-card"),kn=require("@radix-ui/react-select"),Sn=require("@radix-ui/react-dropdown-menu"),Nn=require("@radix-ui/react-separator"),Cn=require("@radix-ui/react-toast"),K=require("cmdk"),En=require("@radix-ui/react-context-menu"),wt=require("react-icons-picker"),An=require("react-dom"),Bn=require("react-quill");function U(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const f=U(k),Rt=U(un),Le=U(mn),le=U(fn),W=U(xn),P=U(gn),kt=U(hn),ae=U(bn),de=U(vn),fe=U(yn),be=U(jn),_=U(wn),Ce=U(Rn),F=U(kn),M=U(Sn),St=U(Nn),Q=U(Cn),D=U(En);var q={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};let _n=0;function te(e,t){const s=`atom${++_n}`,o={toString:()=>s};return typeof e=="function"?o.read=e:(o.init=e,o.read=n=>n(o),o.write=(n,l,a)=>l(o,typeof a=="function"?a(n(o)):a)),t&&(o.write=t),o}const Te=e=>"init"in e,Pe=e=>!!e.write,ke=new WeakMap,Tn=(e,t)=>{ke.set(e,t),e.catch(()=>{}).finally(()=>ke.delete(e))},ct=(e,t)=>{const s=ke.get(e);s&&(ke.delete(e),s(t))},dt=(e,t)=>{e.status="fulfilled",e.value=t},ut=(e,t)=>{e.status="rejected",e.reason=t},Pn=e=>typeof(e==null?void 0:e.then)=="function",ge=(e,t)=>"v"in e&&"v"in t&&Object.is(e.v,t.v),mt=(e,t)=>"e"in e&&"e"in t&&Object.is(e.e,t.e),me=e=>"v"in e&&e.v instanceof Promise,In=(e,t)=>"v"in e&&"v"in t&&e.v.orig&&e.v.orig===t.v.orig,je=e=>{if("e"in e)throw e.e;return e.v},Nt=()=>{const e=new WeakMap,t=new WeakMap,s=new Map;let o,n,l;(q?"production":void 0)!=="production"&&(o=new Set,n=new Set,l=new Set);const a=m=>e.get(m),d=(m,h)=>{(q?"production":void 0)!=="production"&&Object.freeze(h);const y=e.get(m);if(e.set(m,h),s.has(m)||s.set(m,y),y&&me(y)){const b="v"in h?h.v instanceof Promise?h.v:Promise.resolve(h.v):Promise.reject(h.e);ct(y.v,b)}},g=(m,h,y)=>{const b=new Map;let w=!1;y.forEach((v,S)=>{!v&&S===m&&(v=h),v?(b.set(S,v),h.d.get(S)!==v&&(w=!0)):(q?"production":void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(w||h.d.size!==b.size)&&(h.d=b)},c=(m,h,y)=>{const b=a(m),w={d:(b==null?void 0:b.d)||new Map,v:h};if(y&&g(m,w,y),b&&ge(b,w)&&b.d===w.d)return b;if(b&&me(b)&&me(w)&&In(b,w)){if(b.d===w.d)return b;w.v=b.v}return d(m,w),w},x=(m,h,y,b)=>{if(Pn(h)){let w;const v=new Promise((S,L)=>{let E=!1;h.then(T=>{if(!E){E=!0;const A=a(m),ee=c(m,v,y);dt(v,T),S(T),(A==null?void 0:A.d)!==ee.d&&H(m,ee,A==null?void 0:A.d)}},T=>{if(!E){E=!0;const A=a(m),ee=c(m,v,y);ut(v,T),L(T),(A==null?void 0:A.d)!==ee.d&&H(m,ee,A==null?void 0:A.d)}}),w=T=>{E||(E=!0,T.then(A=>dt(v,A),A=>ut(v,A)),S(T))}});return v.orig=h,v.status="pending",Tn(v,S=>{S&&w(S),b==null||b()}),c(m,v,y)}return c(m,h,y)},R=(m,h,y)=>{const b=a(m),w={d:(b==null?void 0:b.d)||new Map,e:h};return y&&g(m,w,y),b&&mt(b,w)&&b.d===w.d?b:(d(m,w),w)},N=m=>{const h=a(m);if(h&&(h.d.forEach((E,T)=>{T!==m&&!t.has(T)&&N(T)}),Array.from(h.d).every(([E,T])=>{const A=a(E);return E===m||A===T||A&&!me(A)&&ge(A,T)})))return h;const y=new Map;let b=!0;const w=E=>{if(E===m){const A=a(E);if(A)return y.set(E,A),je(A);if(Te(E))return y.set(E,void 0),E.init;throw new Error("no atom init")}const T=N(E);return y.set(E,T),je(T)};let v,S;const L={get signal(){return v||(v=new AbortController),v.signal},get setSelf(){return(q?"production":void 0)!=="production"&&!Pe(m)&&console.warn("setSelf function cannot be used with read-only atom"),!S&&Pe(m)&&(S=(...E)=>{if((q?"production":void 0)!=="production"&&b&&console.warn("setSelf function cannot be called in sync"),!b)return $(m,...E)}),S}};try{const E=m.read(w,L);return x(m,E,y,()=>v==null?void 0:v.abort())}catch(E){return R(m,E,y)}finally{b=!1}},j=m=>je(N(m)),C=m=>{let h=t.get(m);return h||(h=z(m)),h},O=(m,h)=>!h.l.size&&(!h.t.size||h.t.size===1&&h.t.has(m)),V=m=>{const h=t.get(m);h&&O(m,h)&&J(m)},B=m=>{const h=new Map,y=new WeakMap,b=v=>{const S=t.get(v);S==null||S.t.forEach(L=>{L!==v&&(h.set(L,(h.get(L)||new Set).add(v)),y.set(L,(y.get(L)||0)+1),b(L))})};b(m);const w=v=>{const S=t.get(v);S==null||S.t.forEach(L=>{var E;if(L!==v){let T=y.get(L);if(T&&y.set(L,--T),!T){let A=!!((E=h.get(L))!=null&&E.size);if(A){const ee=a(L),ln=N(L);A=!ee||!ge(ee,ln)}A||h.forEach(ee=>ee.delete(L))}w(L)}})};w(m)},I=(m,...h)=>{let y=!0;const b=S=>je(N(S)),w=(S,...L)=>{let E;if(S===m){if(!Te(S))throw new Error("atom not writable");const T=a(S),A=x(S,L[0]);(!T||!ge(T,A))&&B(S)}else E=I(S,...L);if(!y){const T=Y();(q?"production":void 0)!=="production"&&n.forEach(A=>A({type:"async-write",flushed:T}))}return E},v=m.write(b,w,...h);return y=!1,v},$=(m,...h)=>{const y=I(m,...h),b=Y();return(q?"production":void 0)!=="production"&&n.forEach(w=>w({type:"write",flushed:b})),y},z=(m,h)=>{const y={t:new Set(h&&[h]),l:new Set};if(t.set(m,y),(q?"production":void 0)!=="production"&&l.add(m),N(m).d.forEach((b,w)=>{const v=t.get(w);v?v.t.add(m):w!==m&&z(w,m)}),N(m),Pe(m)&&m.onMount){const b=m.onMount((...w)=>$(m,...w));b&&(y.u=b)}return y},J=m=>{var h;const y=(h=t.get(m))==null?void 0:h.u;y&&y(),t.delete(m),(q?"production":void 0)!=="production"&&l.delete(m);const b=a(m);b?(me(b)&&ct(b.v),b.d.forEach((w,v)=>{if(v!==m){const S=t.get(v);S&&(S.t.delete(m),O(v,S)&&J(v))}})):(q?"production":void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",m)},H=(m,h,y)=>{const b=new Set(h.d.keys());y==null||y.forEach((w,v)=>{if(b.has(v)){b.delete(v);return}const S=t.get(v);S&&(S.t.delete(m),O(v,S)&&J(v))}),b.forEach(w=>{const v=t.get(w);v?v.t.add(m):t.has(m)&&z(w,m)})},Y=()=>{let m;for((q?"production":void 0)!=="production"&&(m=new Set);s.size;){const h=Array.from(s);s.clear(),h.forEach(([y,b])=>{const w=a(y);if(w){w.d!==(b==null?void 0:b.d)&&H(y,w,b==null?void 0:b.d);const v=t.get(y);v&&!(b&&!me(b)&&(ge(b,w)||mt(b,w)))&&(v.l.forEach(S=>S()),(q?"production":void 0)!=="production"&&m.add(y))}else(q?"production":void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if((q?"production":void 0)!=="production")return o.forEach(h=>h("state")),m},oe=(m,h)=>{const y=C(m),b=Y(),w=y.l;return w.add(h),(q?"production":void 0)!=="production"&&(o.forEach(v=>v("sub")),n.forEach(v=>v({type:"sub",flushed:b}))),()=>{w.delete(h),V(m),(q?"production":void 0)!=="production"&&(o.forEach(v=>v("unsub")),n.forEach(v=>v({type:"unsub"})))}};return(q?"production":void 0)!=="production"?{get:j,set:$,sub:oe,dev_subscribe_store:(m,h)=>h!==2?(console.warn("The current StoreListener revision is 2. The older ones are deprecated."),o.add(m),()=>{o.delete(m)}):(n.add(m),()=>{n.delete(m)}),dev_get_mounted_atoms:()=>l.values(),dev_get_atom_state:m=>e.get(m),dev_get_mounted:m=>t.get(m),dev_restore_atoms:m=>{for(const[y,b]of m)Te(y)&&(x(y,b),B(y));const h=Y();n.forEach(y=>y({type:"restore",flushed:h}))}}:{get:j,set:$,sub:oe}};let Ie;const Mn=()=>(Ie||(Ie=Nt()),Ie);var Dn={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const On=k.createContext(void 0),qe=e=>{const t=k.useContext(On);return(e==null?void 0:e.store)||t||Mn()};const Ln=e=>typeof(e==null?void 0:e.then)=="function",zn=k.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)});function Ct(e,t){const s=qe(t),[[o,n,l],a]=k.useReducer(c=>{const x=s.get(e);return Object.is(c[0],x)&&c[1]===s&&c[2]===e?c:[x,s,e]},void 0,()=>[s.get(e),s,e]);let d=o;(n!==s||l!==e)&&(a(),d=s.get(e));const g=t==null?void 0:t.delay;return k.useEffect(()=>{const c=s.sub(e,()=>{if(typeof g=="number"){setTimeout(a,g);return}a()});return a(),c},[s,e,g]),k.useDebugValue(d),Ln(d)?zn(d):d}function Et(e,t){const s=qe(t);return k.useCallback((...n)=>{if((Dn?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return s.set(e,...n)},[s,e])}function Vn(e,t){return[Ct(e,t),Et(e,t)]}var $e={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const At=Symbol();const pt=(e,t,s)=>(t.has(s)?t:t.set(s,e())).get(s),Fn=new WeakMap,Un=(e,t,s)=>{const o=pt(()=>new WeakMap,Fn,t);return pt(e,o,s)},qn={},ft=e=>!!e.write,$n=e=>typeof e=="function";function Gn(e,t){return Un(()=>{const s=new WeakMap,o=(a,d)=>{let g=s.get(a);if(g)return g;const c=d&&s.get(d),x=[],R=[];return a.forEach((N,j)=>{const C=t?t(N):j;R[j]=C;const O=c&&c.atomList[c.keyList.indexOf(C)];if(O){x[j]=O;return}const V=I=>{const $=I(n),z=I(e),H=o(z,$==null?void 0:$.arr).keyList.indexOf(C);if(H<0||H>=z.length){const Y=a[o(a).keyList.indexOf(C)];if(Y)return Y;throw new Error("splitAtom: index out of bounds for read")}return z[H]},B=(I,$,z)=>{const J=I(n),H=I(e),oe=o(H,J==null?void 0:J.arr).keyList.indexOf(C);if(oe<0||oe>=H.length)throw new Error("splitAtom: index out of bounds for write");const m=$n(z)?z(H[oe]):z;$(e,[...H.slice(0,oe),m,...H.slice(oe+1)])};x[j]=ft(e)?te(V,B):te(V)}),c&&c.keyList.length===R.length&&c.keyList.every((N,j)=>N===R[j])?g=c:g={arr:a,atomList:x,keyList:R},s.set(a,g),g},n=te(a=>{const d=a(n),g=a(e);return o(g,d==null?void 0:d.arr)});($e?"production":void 0)!=="production"&&(n.debugPrivate=!0),n.init=void 0;const l=ft(e)?te(a=>a(n).atomList,(a,d,g)=>{switch(g.type){case"remove":{const c=a(l).indexOf(g.atom);if(c>=0){const x=a(e);d(e,[...x.slice(0,c),...x.slice(c+1)])}break}case"insert":{const c=g.before?a(l).indexOf(g.before):a(l).length;if(c>=0){const x=a(e);d(e,[...x.slice(0,c),g.value,...x.slice(c)])}break}case"move":{const c=a(l).indexOf(g.atom),x=g.before?a(l).indexOf(g.before):a(l).length;if(c>=0&&x>=0){const R=a(e);c<x?d(e,[...R.slice(0,c),...R.slice(c+1,x),R[c],...R.slice(x)]):d(e,[...R.slice(0,x),R[c],...R.slice(x,c),...R.slice(c+1)])}break}}}):te(a=>a(n).atomList);return l},e,t||qn)}function Wn(e){const t=Symbol(),s=te(t);($e?"production":void 0)!=="production"&&(s.debugPrivate=!0);const o=te((n,l)=>{const a=n(s);return a!==t?a:e(n,l)},(n,l,a)=>{if(a===At)l(s,t);else if(typeof a=="function"){const d=n(o);l(s,a(d))}else l(s,a)});return o}const Hn=e=>typeof(e==null?void 0:e.then)=="function";function Yn(e){let t,s;const o={getItem:(n,l)=>{var a,d;const g=x=>{if(x=x||"",t!==x){try{s=JSON.parse(x)}catch{return l}t=x}return s},c=(d=(a=e())==null?void 0:a.getItem(n))!=null?d:null;return Hn(c)?c.then(g):g(c)},setItem:(n,l)=>{var a;return(a=e())==null?void 0:a.setItem(n,JSON.stringify(l))},removeItem:n=>{var l;return(l=e())==null?void 0:l.removeItem(n)}};return typeof window<"u"&&typeof window.addEventListener=="function"&&(o.subscribe=(n,l,a)=>{if(!(e()instanceof window.Storage))return()=>{};const d=g=>{if(g.storageArea===e()&&g.key===n){let c;try{c=JSON.parse(g.newValue||"")}catch{c=a}l(c)}};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}}),o}const Kn=Yn(()=>typeof window<"u"?window.localStorage:void 0);function xe(e,t,s=Kn,o){const n=o==null?void 0:o.unstable_getOnInit,l=te(n?s.getItem(e,t):t);return($e?"production":void 0)!=="production"&&(l.debugPrivate=!0),l.onMount=d=>{n||d(s.getItem(e,t));let g;return s.subscribe&&(g=s.subscribe(e,d,t)),g},te(d=>d(l),(d,g,c)=>{const x=typeof c=="function"?c(d(l)):c;return x===At?(g(l,t),s.removeItem(e)):x instanceof Promise?x.then(R=>(g(l,R),s.setItem(e,R))):(g(l,x),s.setItem(e,x))})}const Ge=p.atom(null);Ge.debugLabel="chaiBuilderPropsAtom";const Bt=p.atom({});Bt.debugLabel="chaiExternalDataAtom";const Jn=()=>!1,Qn=e=>{const t=e.replace(X.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},ze=i.memoize((e,t)=>{if(!e)return!0;const s=pe.getBlockComponent(e);return s&&i.has(s,"canAcceptBlock")?s.canAcceptBlock(t):!1}),Xn=i.memoize((e,t)=>{const s=pe.getBlockComponent(t);return s&&i.has(s,"canBeNested")?s.canBeNested(e):!0}),Zn=i.memoize(e=>{const t=pe.getBlockComponent(e);return t&&i.has(t,"canDuplicate")?t.canDuplicate():!0}),er=i.memoize(e=>{const t=pe.getBlockComponent(e);return t&&i.has(t,"canDelete")?t.canDelete():!0});function _t(e,t,s){const o=i.filter(e,l=>l._parent===t),n=[];for(let l=0;l<o.length;l++){const a=Pt(o[l]);if(Object.keys(a).length>0&&Object.keys(a).forEach(d=>{o[l][d]=`slot:${ne.generateUUID()}`}),i.filter(e,{_parent:o[l]._id}).length>0){const d=ne.generateUUID();n.push({...o[l],oldId:o[l]._id,_id:d,_parent:s}),n.push(i.flatten(_t(e,o[l]._id,d)))}else n.push({...o[l],oldId:o[l]._id,_id:ne.generateUUID(),_parent:s})}return i.flatten(n)}function Tt(e){const t={};e.forEach(o=>{t[o._id]={...o,children:[]}});const s=[];return e.forEach(o=>{if(o._parent){const n=t[o._parent];n&&n.children.push(t[o._id])}else s.push(t[o._id])}),s}const Pt=e=>{const t={};return Object.keys(e).forEach(s=>{i.isString(e[s])&&e[s].startsWith("slot")&&(t[s]=e[s].replace("slot:",""))}),t},tr=(e,t,s=null)=>{let o=i.find(e,{_id:t});o={...o,oldId:o._id,_id:ne.generateUUID()},s&&(o={...o,_parent:s});const n=[o];i.filter(e,{_parent:t}).length>0&&n.push(i.flatten(_t(e,t,o._id)));const l=i.flatten(n);return i.map(l,a=>{const d=a,g=Pt(d);return Object.keys(g).length>0&&Object.keys(g).forEach(c=>{const x=i.find(l,{oldId:g[c].replace("slot:","")});d[c]=`slot:${x._id}`}),i.omit(d,["global","oldId"])})};const Z=p.atom([]);Z.debugLabel="presentBlocksAtom";const It=p.atom(e=>{const t=e(Z);return Tt([...t])});It.debugLabel="treeDSBlocks";Z.debugLabel="presentBlocksAtom";const We=Gn(Z);We.debugLabel="pageBlocksAtomsAtom";const sr=p.atom("");sr.debugLabel="builderActivePageAtom";const or=p.atom(-1);or.debugLabel="destinationDropIndexAtom";const Mt=p.atom([]);Mt.debugLabel="buildingBlocksAtom";const nr=p.atom(e=>{const t=e(Mt);return i.filter(t,s=>i.has(s,"blockId"))});nr.debugLabel="globalBlocksAtom";const He=p.atom([]);He.debugLabel="selectedBlockIdsAtom";const Ye=p.atom(e=>{const t=e(Z),s=e(He);return i.map(i.filter(t,({_id:o})=>i.includes(s,o)),o=>({...o}))});Ye.debugLabel="selectedBlocksAtom";const Ee=p.atom(e=>{const t=e(Ye);if(t.length===0)return null;if(t.length===1)return t[0]});Ee.debugLabel="selectedBlockAtom";const rr=e=>i.get(e,"parent",null),ar=p.atom(e=>{const t=e(Ye),s=i.map(t,rr);return i.filter(e(Z),o=>i.includes(s,o._id))});ar.debugLabel="selectedBlocksParentsAtom";const Dt=p.atom(()=>!1);Dt.debugLabel="selectedBlockFlexChildAtom";const Ot=p.atom(()=>!1);Ot.debugLabel="selectedBlockGridChildAtom";const Ke=p.atom("");Ke.debugLabel="styleStateAtom";const Lt=xe("styleBreakpoint","xs");Lt.debugLabel="styleBreakpointAtom";const ir=()=>({flexChild:p.useAtomValue(Dt),gridChild:p.useAtomValue(Ot)}),lr=()=>p.useAtomValue(Ee),cr=p.atom(e=>{const t=e(Ee),s=e(Z);let o=t;const n=[t];do{const l=s.find(({_id:a})=>a===(o==null?void 0:o._parent));o=l,l&&n.push(l)}while(o!=null&&o._parent);return n}),zt=()=>p.useAtomValue(cr),dr=()=>{const e=zt();return k.useMemo(()=>{for(let t=0;t<e.length;t++){const s=pe.getBlockComponent(e[t]._type),o=i.cloneDeep(i.get(s,"blockState",{}));if(!i.isEmpty(o))return{settings:o,block:e[t]}}return{}},[e])},ur=()=>{const e=zt();return k.useMemo(()=>{let t={};for(let s=0;s<e.length;s++){const o=pe.getBlockComponent(e[s]._type),n=i.get(o,"customStylingStates",{});t={...t,...n}}return t},[e])},ve=()=>{const[e,t]=p.useAtom(He),s=k.useCallback(o=>{t(n=>i.includes(n,o)?i.without(n,o):[...n,o])},[t]);return[e,t,s]},Ve=e=>{switch(e.type){case"singular":return e.uiSchema;case"model":const{properties:t}=e,s={};return Object.keys(t).forEach(l=>{const a=t[l];if(i.includes(["slot","styles"],a.type))return;const d=l;s[d]=Ve(a)}),s;case"list":const{itemProperties:o}=e,n={items:{}};return Object.keys(o).forEach(l=>{const a=o[l];if(i.includes(["slot","styles"],a.type))return;const d=l;n.items[d]=Ve(a)}),n;default:return{}}},Fe=e=>{switch(e.type){case"singular":return e.schema;case"model":const{properties:t,title:s}=e,o={title:s,type:"object",properties:{}};return Object.keys(t).forEach(d=>{const g=t[d];if(i.includes(["slot","styles"],g.type))return;const c=d;o.properties[c]=Fe(g)}),o;case"list":const{itemProperties:n,title:l}=e,a={title:l,type:"array",items:{type:"object",properties:{}}};return Object.keys(n).forEach(d=>{const g=n[d];if(i.includes(["slot","styles"],g.type))return;const c=d;a.items.properties[c]=Fe(g),i.set(a.items,"title",i.get(g,"itemTitle",`${l} item`))}),a;default:return{}}},Vt=e=>{if(!e)return{};const t={};return Object.keys(e).forEach(s=>{t[s]=pr(e[s])}),t},mr=e=>{if(i.isEmpty(e.default))return[];const{itemProperties:t}=e;return i.map(e.default,s=>{const o={...s};return i.forIn(s,(n,l)=>{i.has(t,l)&&i.get(t[l],"i18n",!1)&&(o[l]=X.I18N_KEY)}),o})},pr=e=>{switch(e.type){case"styles":return e.default;case"slot":return`${X.SLOT_KEY}${ne.generateUUID()}`;case"singular":const{i18n:t,schema:s}=e;return t?X.I18N_KEY:i.get(s,"default","");case"model":return Vt(e.properties);case"list":return mr(e);default:return""}};var Je={exports:{}},vi=Je.exports;(function(e){(function(){"use strict";function t(o,n,l){return o.splice(n,!l||1+l-n+(!(l<0^n>=0)&&(l<0||-1)*o.length)),o.length}let s=function(){let o=[],n=-1,l=0,a=!1,d;function g(c,x){return!c||typeof c[x]!="function"?this:(a=!0,c[x](),a=!1,this)}return{add:function(c){return a?this:(o.splice(n+1,o.length-n),o.push(c),l&&o.length>l&&t(o,0,-(l+1)),n=o.length-1,d&&d(),this)},setCallback:function(c){d=c},undo:function(){let c=o[n];if(!c)return this;const x=c.groupId;for(;c.groupId===x&&(g(c,"undo"),n-=1,c=o[n],!(!c||!c.groupId)););return d&&d(),this},redo:function(){let c=o[n+1];if(!c)return this;const x=c.groupId;for(;c.groupId===x&&(g(c,"redo"),n+=1,c=o[n+1],!(!c||!c.groupId)););return d&&d(),this},clear:function(){let c=o.length;o=[],n=-1,d&&c>0&&d()},hasUndo:function(){return n!==-1},hasRedo:function(){return n<o.length-1},getCommands:function(c){return c?o.filter(x=>x.groupId===c):o},getIndex:function(){return n},setLimit:function(c){l=c}}};e.exports?e.exports=s:window.UndoManager=s})()})(Je);var fr=Je.exports;const xr=cn.getDefaultExportFromCjs(fr),gr=p.atom(Oe.BRANDING_OPTIONS_DEFAULTS),hr=p.atom(null),Qe=()=>{const[e,t]=p.useAtom(gr);return[i.isObject(e)?{...Oe.BRANDING_OPTIONS_DEFAULTS,...e}:Oe.BRANDING_OPTIONS_DEFAULTS,t]},br=()=>p.useAtom(hr),vr=p.atom(null),Ft=()=>({currentPage:p.useAtomValue(vr)});function yr(e){return Tt(e)}const Xe=(e,t)=>i.flatten(e.map(s=>{if(s=t?{...s,parent:t}:{...s},s.children){const o=[...s.children];return delete s.children,i.flatten([s,...Xe(o,s._id)])}return s}));function Ze(e,t=!1){for(let s=0;s<e.length;s++){const o=e[s];o.global&&!t?e[s]={type:"GlobalBlock",blockId:o.blockId,_parent:i.get(o,"parent",null),_id:o._id}:o.children&&o.children.length&&Ze(o.children)}}function Ut(e){let t=[],s=i.filter(e,{type:"GlobalBlock"});return s.length>0&&(s=i.map(s,qt),i.each(s,o=>{t=[...t,...jr(o)]})),t}function jr(e){let t=[];const s=i.get(i.first(e),"parent",null);i.set(i.first(e),"parent",null);const o=[flatToNestedInstance.convert($t(e))];Ze(o,!0);let n=Xe(o,e[0]._id);return n=i.set(n,"0.parent",s),t=[...t,n,...Ut(n)],t}function qt(e){const t=i.find(Ue,{_id:e._id});if(!t)return[];const s=[t],o=i.filter(Ue,{_parent:e._id});return o.length?i.flatten([...s,...i.flatten(i.map(o,qt))]):i.flatten(s)}const $t=e=>JSON.parse(JSON.stringify(e));let Ue=[];function wr(e){Ue=e;const t=yr($t(e));Ze(t);const s=Xe(t,null),o=Ut(s),n={};return i.each(o,l=>i.set(n,i.first(l).blockId,l)),[s,n]}const Gt=()=>{const[e]=Qe(),{currentPage:t}=Ft(),[s]=ue();return k.useCallback(()=>{const o=i.map(s,l=>i.omit(l,["expanded","order","title","siblings","tempClasses"])),[n=[]]=wr(o);return{currentPage:t,blocks:n}},[e,t,s])},ie=(e,t=void 0)=>{const s=p.useAtomValue(Ge);return i.get(s,e,t)},et=p.atom([]);et.debugLabel="dataProvidersAtom";const Wt=()=>p.useAtom(et),Ae=p.atom("SAVED");Ae.debugLabel="builderSaveStateAtom";const Rr=()=>{const[e,t]=p.useAtom(Ae),s=ie("onSavePage",async c=>{}),o=ie("onSave",async c=>{}),n=ie("onSaveStateChange",i.noop),l=Gt(),[a]=Wt(),[d]=Qe();return{savePage:dn.useThrottledCallback(async()=>{t("SAVING"),n("SAVING");const c=l();return await s({blocks:c.blocks,providers:a}),await o({blocks:c.blocks,providers:a,brandingOptions:d}),setTimeout(()=>{t("SAVED"),n("SAVED")},100),!0},[l,t,d,o,n],3e3),saveState:e,setSaveState:t}},se=new xr;se.setLimit(50);const tt=()=>{const[,e]=p.useAtom(Ae),t=ie("onSaveStateChange",i.noop);return k.useEffect(()=>(se.setCallback(()=>{e("UNSAVED"),t("UNSAVED")}),()=>{se.setCallback(i.noop)}),[]),{add:se.add,undo:se.undo,redo:se.redo,hasRedo:se.hasRedo,hasUndo:se.hasUndo,clear:se.clear}},st=(e,t)=>{const s=[],o=i.filter(e,n=>i.includes(t,n._id)||i.includes(t,n._parent)?(s.push(n._id),!1):!0);return i.isEmpty(s)?o:st(o,s)},kr=()=>{const[e]=ue(),[t,s]=ve(),{setNewBlocks:o}=re();return k.useCallback(n=>{var a;const l=((a=i.find(e,{_id:n[0]}))==null?void 0:a._parent)||null;o(st(e,n)),setTimeout(()=>s(l?[l]:[]),200)},[e,s,t])};function Sr(e,t,s,o){let n=e.filter(d=>!d._parent);s&&(n=e.filter(d=>d._parent===s));const l=o!==void 0?o:n.length;let a=e.length;for(let d=0,g=0;d<e.length;d++)if(e[d]._parent===s){if(g===l){a=d;break}g++}return!s&&o!==void 0&&o>=n.length&&(a=e.length),[...e.slice(0,a),...t,...e.slice(a)]}function xt(e){const t=[],s=new Map;e.forEach(n=>{s.set(n._id,n)});function o(n){const l=s.get(n);t.includes(l)||(t.push(l),e.forEach(a=>{a._parent===n&&o(a._id)}))}return e.forEach(n=>{n._parent||o(n._id)}),t}const Nr=(e,t,s,o)=>{if(i.isEmpty(t))return xt(e);function n(d,g){const c=d.filter(R=>R._parent===g);let x=[...c];return c.forEach(R=>{x=x.concat(n(d,R._id))}),x}const l=t.reduce((d,g)=>{const c=e.find(x=>x._id===g);if(c){const x=n(e,g);d.push(c,...x)}return d},[]);e=e.filter(d=>!l.includes(d)),l.forEach(d=>{t.includes(d._id)&&(d._parent=s)});let a;if(!s)a=o;else{const d=e.findIndex(g=>g._id===s);if(d===-1)a=o;else{a=d+1;let g=0;for(;g<o&&a<e.length;)e[a]._parent===s&&g++,a++}}return e.splice(a,0,...l),xt(e)},Cr=()=>{const[,e]=ue();return{setNewBlocks:t=>{e(t)},addBlocks:(t,s,o)=>{e(n=>Sr(n,t,s,o))},removeBlocks:t=>{e(s=>st(s,t))},moveBlocks:(t,s,o)=>{e(n=>Nr(n,t,s,o))},updateBlocksProps:t=>{e(s=>{const o=t.map(n=>n._id);return s.map(n=>{if(o.includes(n._id)){const l=i.find(t,{_id:n._id});return{...n,...i.omit(l,"_id")}}return n})})}}},ue=()=>p.useAtom(Z),re=()=>{const{add:e}=tt(),[t]=ue(),{setNewBlocks:s,addBlocks:o,removeBlocks:n,moveBlocks:l,updateBlocksProps:a}=Cr();return{moveBlocks:(j,C,O)=>{const V=i.map(j,I=>{const z=t.find(Y=>Y._id===I)._parent||null,H=t.filter(Y=>z?Y._parent===z:!Y._parent).map(Y=>Y._id).indexOf(I);return{_id:I,oldParent:z,oldPosition:H}}),B=V.find(({_id:I})=>I===j[0]);B&&B.oldParent===C&&B.oldPosition===O||(l(j,C,O),e({undo:()=>i.each(V,({_id:I,oldParent:$,oldPosition:z})=>{l([I],$,z)}),redo:()=>l(j,C,O)}))},addBlocks:(j,C,O)=>{o(j,C,O),e({undo:()=>n(i.map(j,"_id")),redo:()=>o(j,C,O)})},removeBlocks:j=>{var B;const C=(B=i.first(j))==null?void 0:B._parent,V=t.filter(I=>C?I._parent===C:!I._parent).indexOf(i.first(j));n(i.map(j,"_id")),e({undo:()=>o(j,C,V),redo:()=>n(i.map(j,"_id"))})},updateBlocks:(j,C,O)=>{let V=[];if(O)V=i.map(j,B=>({_id:B,...O}));else{const B=i.keys(C);V=i.map(j,I=>{const $=t.find(J=>J._id===I),z={_id:I};return i.each(B,J=>z[J]=$[J]),z})}a(i.map(j,B=>({_id:B,...C}))),e({undo:()=>a(V),redo:()=>a(i.map(j,B=>({_id:B,...C})))})},updateBlocksRuntime:(j,C)=>{a(i.map(j,O=>({_id:O,...C})))},setNewBlocks:j=>{s(j),e({undo:()=>s(t),redo:()=>s(j)})}}},Ht=ce.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),Yt=f.forwardRef(({className:e,variant:t,size:s,...o},n)=>r.jsxRuntimeExports.jsx(Rt.Root,{ref:n,className:u.cn(Ht({variant:t,size:s,className:e})),...o}));Yt.displayName=Rt.Root.displayName;const Kt=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Le.Root,{className:u.cn("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus-visible:ring-slate-800 dark:focus-visible:ring-offset-slate-950 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",e),...t,ref:s,children:r.jsxRuntimeExports.jsx(Le.Thumb,{className:u.cn("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-slate-950")})}));Kt.displayName=Le.Root.displayName;const Be=ce.cva("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Jt=f.forwardRef(({className:e,variant:t,size:s,asChild:o=!1,...n},l)=>{const a=o?pn.Slot:"button";return r.jsxRuntimeExports.jsx(a,{className:u.cn(Be({variant:t,size:s,className:e})),ref:l,...n})});Jt.displayName="Button";const Er=le.Root,Qt=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(le.Item,{ref:s,className:u.cn("border-b",e),...t}));Qt.displayName="AccordionItem";const Xt=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsx(le.Header,{className:"flex",children:r.jsxRuntimeExports.jsxs(le.Trigger,{ref:o,className:u.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...s,children:[t,r.jsxRuntimeExports.jsx(G.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));Xt.displayName=le.Trigger.displayName;const Zt=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsx(le.Content,{ref:o,className:u.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...s,children:r.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:t})}));Zt.displayName=le.Content.displayName;const Ar=ce.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),es=f.forwardRef(({className:e,variant:t,...s},o)=>r.jsxRuntimeExports.jsx("div",{ref:o,role:"alert",className:u.cn(Ar({variant:t}),e),...s}));es.displayName="Alert";const ts=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("h5",{ref:s,className:u.cn("mb-1 font-medium leading-none tracking-tight",e),...t}));ts.displayName="AlertTitle";const ss=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("text-sm [&_p]:leading-relaxed",e),...t}));ss.displayName="AlertDescription";const os=ce.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}}),Br=({className:e,variant:t,...s})=>r.jsxRuntimeExports.jsx("div",{className:u.cn(os({variant:t}),e),...s}),_r=W.Root,Tr=W.Trigger,ns=({className:e,...t})=>r.jsxRuntimeExports.jsx(W.Portal,{className:u.cn(e),...t});ns.displayName=W.Portal.displayName;const rs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Overlay,{className:u.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:s}));rs.displayName=W.Overlay.displayName;const as=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsxs(ns,{children:[r.jsxRuntimeExports.jsx(rs,{}),r.jsxRuntimeExports.jsx(W.Content,{ref:s,className:u.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...t})]}));as.displayName=W.Content.displayName;const is=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});is.displayName="AlertDialogHeader";const ls=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ls.displayName="AlertDialogFooter";const cs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Title,{ref:s,className:u.cn("text-lg font-semibold",e),...t}));cs.displayName=W.Title.displayName;const ds=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));ds.displayName=W.Description.displayName;const us=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Action,{ref:s,className:u.cn(Be(),e),...t}));us.displayName=W.Action.displayName;const ms=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Cancel,{ref:s,className:u.cn(Be({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ms.displayName=W.Cancel.displayName;const ot=P.Root,ps=P.Trigger,fs=({className:e,...t})=>r.jsxRuntimeExports.jsx(P.Portal,{className:u.cn(e),...t});fs.displayName=P.Portal.displayName;const xs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Overlay,{ref:s,className:u.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));xs.displayName=P.Overlay.displayName;const _e=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(fs,{children:[r.jsxRuntimeExports.jsx(xs,{}),r.jsxRuntimeExports.jsxs(P.Content,{ref:o,className:u.cn("fixed left-[50%] top-[50%] z-[999] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...s,children:[t,r.jsxRuntimeExports.jsxs(P.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsxRuntimeExports.jsx(G.Cross2Icon,{className:"h-4 w-4"}),r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_e.displayName=P.Content.displayName;const gs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});gs.displayName="DialogHeader";const hs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});hs.displayName="DialogFooter";const bs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Title,{ref:s,className:u.cn("text-lg font-semibold leading-none tracking-tight",e),...t}));bs.displayName=P.Title.displayName;const vs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));vs.displayName=P.Description.displayName;const ys=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ys.displayName="Card";const js=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("flex flex-col space-y-1.5 p-6",e),...t}));js.displayName="CardHeader";const ws=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("h3",{ref:s,className:u.cn("font-semibold leading-none tracking-tight",e),...t}));ws.displayName="CardTitle";const Rs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("p",{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Rs.displayName="CardDescription";const ks=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("p-6 pt-0",e),...t}));ks.displayName="CardContent";const Ss=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn(" flex items-center p-6 pt-0",e),...t}));Ss.displayName="CardFooter";const Ns=f.forwardRef(({className:e,type:t,...s},o)=>r.jsxRuntimeExports.jsx("input",{type:t,className:u.cn("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",e),ref:o,...s}));Ns.displayName="Input";const Pr=ce.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Cs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(kt.Root,{ref:s,className:u.cn(Pr(),e),...t}));Cs.displayName=kt.Root.displayName;const Es=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("textarea",{className:u.cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...t}));Es.displayName="Textarea";const As=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(ae.Root,{ref:o,className:u.cn("relative overflow-hidden",e),...s,children:[r.jsxRuntimeExports.jsx(ae.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsxRuntimeExports.jsx(nt,{}),r.jsxRuntimeExports.jsx(ae.Corner,{})]}));As.displayName=ae.Root.displayName;const nt=f.forwardRef(({className:e,orientation:t="vertical",...s},o)=>r.jsxRuntimeExports.jsx(ae.ScrollAreaScrollbar,{ref:o,orientation:t,className:u.cn("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",e),...s,children:r.jsxRuntimeExports.jsx(ae.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));nt.displayName=ae.ScrollAreaScrollbar.displayName;const Bs=de.Root,rt=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(de.List,{ref:s,className:u.cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));rt.displayName=de.List.displayName;const Se=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(de.Trigger,{ref:s,className:u.cn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Se.displayName=de.Trigger.displayName;const Ne=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(de.Content,{ref:s,className:u.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Ne.displayName=de.Content.displayName;const Ir=fe.Portal,Mr=fe.Provider,Dr=fe.Root,Or=fe.Trigger,_s=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>r.jsxRuntimeExports.jsx(fe.Content,{ref:o,sideOffset:t,className:u.cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));_s.displayName=fe.Content.displayName;const Lr=be.Root,zr=be.Trigger,Ts=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},n)=>r.jsxRuntimeExports.jsx(be.Portal,{children:r.jsxRuntimeExports.jsx(be.Content,{ref:n,align:t,sideOffset:s,className:u.cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));Ts.displayName=be.Content.displayName;const Vr=_.Menu,Fr=_.Group,Ur=_.Portal,qr=_.Sub,$r=_.RadioGroup,Ps=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(_.Root,{ref:s,className:u.cn("flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",e),...t}));Ps.displayName=_.Root.displayName;const Is=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(_.Trigger,{ref:s,className:u.cn("flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e),...t}));Is.displayName=_.Trigger.displayName;const Ms=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(_.SubTrigger,{ref:n,className:u.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...o,children:[s,r.jsxRuntimeExports.jsx(G.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));Ms.displayName=_.SubTrigger.displayName;const Ds=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(_.SubContent,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Ds.displayName=_.SubContent.displayName;const Os=f.forwardRef(({className:e,align:t="start",alignOffset:s=-4,sideOffset:o=8,...n},l)=>r.jsxRuntimeExports.jsx(_.Portal,{children:r.jsxRuntimeExports.jsx(_.Content,{ref:l,align:t,alignOffset:s,sideOffset:o,className:u.cn("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Os.displayName=_.Content.displayName;const Ls=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(_.Item,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));Ls.displayName=_.Item.displayName;const zs=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(_.CheckboxItem,{ref:n,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...o,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(_.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.CheckIcon,{className:"h-4 w-4"})})}),t]}));zs.displayName=_.CheckboxItem.displayName;const Vs=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(_.RadioItem,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(_.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Vs.displayName=_.RadioItem.displayName;const Fs=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(_.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));Fs.displayName=_.Label.displayName;const Us=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(_.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));Us.displayName=_.Separator.displayName;const qs=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});qs.displayname="MenubarShortcut";const Gr=Ce.Root,Wr=Ce.Trigger,$s=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},n)=>r.jsxRuntimeExports.jsx(Ce.Content,{ref:n,align:t,sideOffset:s,className:u.cn("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o}));$s.displayName=Ce.Content.displayName;const Hr=F.Root,Yr=F.Group,Kr=F.Value,Gs=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(F.Trigger,{ref:o,className:u.cn("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...s,children:[t,r.jsxRuntimeExports.jsx(F.Icon,{asChild:!0,children:r.jsxRuntimeExports.jsx(G.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));Gs.displayName=F.Trigger.displayName;const Ws=f.forwardRef(({className:e,children:t,position:s="popper",...o},n)=>r.jsxRuntimeExports.jsx(F.Portal,{children:r.jsxRuntimeExports.jsx(F.Content,{ref:n,className:u.cn("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...o,children:r.jsxRuntimeExports.jsx(F.Viewport,{className:u.cn("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));Ws.displayName=F.Content.displayName;const Hs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(F.Label,{ref:s,className:u.cn("px-2 py-1.5 text-sm font-semibold",e),...t}));Hs.displayName=F.Label.displayName;const Ys=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(F.Item,{ref:o,className:u.cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(F.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.CheckIcon,{className:"h-4 w-4"})})}),r.jsxRuntimeExports.jsx(F.ItemText,{children:t})]}));Ys.displayName=F.Item.displayName;const Ks=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(F.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));Ks.displayName=F.Separator.displayName;const Jr=P.Root,Qr=P.Trigger,Xr=P.Close,Js=({className:e,...t})=>r.jsxRuntimeExports.jsx(P.Portal,{className:u.cn(e),...t});Js.displayName=P.Portal.displayName;const Qs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Overlay,{className:u.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:s}));Qs.displayName=P.Overlay.displayName;const Zr=ce.cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Xs=f.forwardRef(({side:e="right",className:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(Js,{children:[r.jsxRuntimeExports.jsx(Qs,{}),r.jsxRuntimeExports.jsxs(P.Content,{ref:n,className:u.cn(Zr({side:e}),t),...o,children:[s,r.jsxRuntimeExports.jsxs(P.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[r.jsxRuntimeExports.jsx(G.Cross2Icon,{className:"h-4 w-4"}),r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Xs.displayName=P.Content.displayName;const Zs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});Zs.displayName="SheetHeader";const eo=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});eo.displayName="SheetFooter";const to=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Title,{ref:s,className:u.cn("text-lg font-semibold text-foreground",e),...t}));to.displayName=P.Title.displayName;const so=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(P.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));so.displayName=P.Description.displayName;const ea=M.Root,ta=M.Trigger,sa=M.Group,oa=M.Portal,na=M.Sub,ra=M.RadioGroup,oo=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(M.SubTrigger,{ref:n,className:u.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...o,children:[s,r.jsxRuntimeExports.jsx(G.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));oo.displayName=M.SubTrigger.displayName;const no=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(M.SubContent,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));no.displayName=M.SubContent.displayName;const ro=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>r.jsxRuntimeExports.jsx(M.Portal,{children:r.jsxRuntimeExports.jsx(M.Content,{ref:o,sideOffset:t,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));ro.displayName=M.Content.displayName;const ao=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(M.Item,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));ao.displayName=M.Item.displayName;const io=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(M.CheckboxItem,{ref:n,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...o,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(M.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.CheckIcon,{className:"h-4 w-4"})})}),t]}));io.displayName=M.CheckboxItem.displayName;const lo=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(M.RadioItem,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(M.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));lo.displayName=M.RadioItem.displayName;const co=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(M.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));co.displayName=M.Label.displayName;const uo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(M.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));uo.displayName=M.Separator.displayName;const mo=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest opacity-60",e),...t});mo.displayName="DropdownMenuShortcut";const po=f.forwardRef(({className:e,orientation:t="horizontal",decorative:s=!0,...o},n)=>r.jsxRuntimeExports.jsx(St.Root,{ref:n,decorative:s,orientation:t,className:u.cn("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));po.displayName=St.Root.displayName;const aa=1,ia=1e6;let Me=0;function la(){return Me=(Me+1)%Number.MAX_VALUE,Me.toString()}const De=new Map,gt=e=>{if(De.has(e))return;const t=setTimeout(()=>{De.delete(e),he({type:"REMOVE_TOAST",toastId:e})},ia);De.set(e,t)},fo=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,aa)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(s=>s.id===t.toast.id?{...s,...t.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=t;return s?gt(s):e.toasts.forEach(o=>{gt(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(s=>s.id!==t.toastId)}}},we=[];let Re={toasts:[]};function he(e){Re=fo(Re,e),we.forEach(t=>{t(Re)})}function xo({...e}){const t=la(),s=n=>he({type:"UPDATE_TOAST",toast:{...n,id:t}}),o=()=>he({type:"DISMISS_TOAST",toastId:t});return he({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:n=>{n||o()}}}),{id:t,dismiss:o,update:s}}function at(){const[e,t]=f.useState(Re);return f.useEffect(()=>(we.push(t),()=>{const s=we.indexOf(t);s>-1&&we.splice(s,1)}),[e]),{...e,toast:xo,dismiss:s=>he({type:"DISMISS_TOAST",toastId:s})}}const ca=Q.Provider,go=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.Viewport,{ref:s,className:u.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));go.displayName=Q.Viewport.displayName;const da=ce.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),ho=f.forwardRef(({className:e,variant:t,...s},o)=>r.jsxRuntimeExports.jsx(Q.Root,{ref:o,className:u.cn(da({variant:t}),e),...s}));ho.displayName=Q.Root.displayName;const ua=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.Action,{ref:s,className:u.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));ua.displayName=Q.Action.displayName;const bo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.Close,{ref:s,className:u.cn("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:r.jsxRuntimeExports.jsx(G.Cross2Icon,{className:"h-4 w-4"})}));bo.displayName=Q.Close.displayName;const vo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.Title,{ref:s,className:u.cn("text-sm font-semibold [&+div]:text-xs",e),...t}));vo.displayName=Q.Title.displayName;const yo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Q.Description,{ref:s,className:u.cn("text-sm opacity-90",e),...t}));yo.displayName=Q.Description.displayName;function ma(){const{toasts:e}=at();return r.jsxRuntimeExports.jsxs(ca,{children:[e.map(({id:t,title:s,description:o,action:n,...l})=>r.jsxRuntimeExports.jsxs(ho,{...l,children:[r.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[s&&r.jsxRuntimeExports.jsx(vo,{children:s}),o&&r.jsxRuntimeExports.jsx(yo,{children:o})]}),n,r.jsxRuntimeExports.jsx(bo,{})]},t)),r.jsxRuntimeExports.jsx(go,{})]})}const pa=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("animate-pulse rounded-md bg-primary/10",e),...t}),it=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(K.Command,{ref:s,className:u.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));it.displayName=K.Command.displayName;const fa=({children:e,...t})=>r.jsxRuntimeExports.jsx(ot,{...t,children:r.jsxRuntimeExports.jsx(_e,{className:"overflow-hidden p-0",children:r.jsxRuntimeExports.jsx(it,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),jo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsxRuntimeExports.jsx(G.MagnifyingGlassIcon,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsxRuntimeExports.jsx(K.Command.Input,{ref:s,className:u.cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));jo.displayName=K.Command.Input.displayName;const wo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(K.Command.List,{ref:s,className:u.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));wo.displayName=K.Command.List.displayName;const Ro=f.forwardRef((e,t)=>r.jsxRuntimeExports.jsx(K.Command.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Ro.displayName=K.Command.Empty.displayName;const ko=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(K.Command.Group,{ref:s,className:u.cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));ko.displayName=K.Command.Group.displayName;const So=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(K.Command.Separator,{ref:s,className:u.cn("-mx-1 h-px bg-border",e),...t}));So.displayName=K.Command.Separator.displayName;const No=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(K.Command.Item,{ref:s,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));No.displayName=K.Command.Item.displayName;const Co=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Co.displayName="CommandShortcut";const xa=D.Root,ga=D.Trigger,ha=D.Group,ba=D.Portal,va=D.Sub,ya=D.RadioGroup,Eo=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(D.SubTrigger,{ref:n,className:u.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...o,children:[s,r.jsxRuntimeExports.jsx(G.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));Eo.displayName=D.SubTrigger.displayName;const Ao=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(D.SubContent,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Ao.displayName=D.SubContent.displayName;const Bo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(D.Portal,{children:r.jsxRuntimeExports.jsx(D.Content,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));Bo.displayName=D.Content.displayName;const _o=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(D.Item,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));_o.displayName=D.Item.displayName;const To=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(D.CheckboxItem,{ref:n,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...o,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(D.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.CheckIcon,{className:"h-4 w-4"})})}),t]}));To.displayName=D.CheckboxItem.displayName;const Po=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(D.RadioItem,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(D.ItemIndicator,{children:r.jsxRuntimeExports.jsx(G.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Po.displayName=D.RadioItem.displayName;const Io=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(D.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...s}));Io.displayName=D.Label.displayName;const Mo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(D.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-border",e),...t}));Mo.displayName=D.Separator.displayName;const Do=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Do.displayName="ContextMenuShortcut";const ja=e=>{try{const t=document.getElementById("icon-picker-field"),s=document.createElement("div");An.render(r.jsxRuntimeExports.jsx(wt.IconPickerItem,{value:e}),s),t.appendChild(s),s.hidden=!0;let o=s.innerHTML;setTimeout(()=>t.removeChild(s),100);const l=new DOMParser().parseFromString(o,"image/svg+xml"),a=l.querySelector("svg");return a&&(a.removeAttribute("width"),a.removeAttribute("height")),new XMLSerializer().serializeToString(l)}catch(t){return console.error(t),""}},wa=({value:e,onChange:t})=>{const s=o=>{t("<svg />");const n=ja(o);t(n)};return r.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[r.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[r.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:e?e.replace("<svg",'<svg class="h-5 w-5"'):"<svg class='h-5 w-5' />"},className:"absolute left-1/2 top-1/2 z-0 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white"}),r.jsxRuntimeExports.jsx(wt,{value:e?"BiSolidGrid":null,onChange:s,pickButtonStyle:{position:"relative",height:"48px",width:"48px",border:"1px solid #BBBBBB",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",backgroundColor:"transparent",zIndex:1},searchInputStyle:{backgroundColor:"transparent",width:"100%",border:"1px solid #BBBBBB",margin:"0px 10px",padding:"10px"}})]}),r.jsxRuntimeExports.jsx("textarea",{value:e,onChange:o=>t(o.target.value),className:"h-full w-full rounded-sm border border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",placeholder:"Choose icon or enter svg"})]})},Ra=k.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-XwjKheek.cjs"))),ka=k.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-y7LAQVrT.cjs"))),Oo=({isModalView:e=!1,onSelect:t=()=>{}})=>{const[s,o]=k.useState("upload");return r.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[r.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:e?"Select or upload images":"Images"})}),r.jsxRuntimeExports.jsxs(Bs,{value:s,onValueChange:n=>o(n),className:"flex h-full w-full flex-col py-2",children:[r.jsxRuntimeExports.jsxs(rt,{className:"w-full",children:[r.jsxRuntimeExports.jsx(Se,{value:"upload",className:"w-1/2",children:"Upload"}),r.jsxRuntimeExports.jsx(Se,{value:"unsplash",className:"w-1/2",children:"Unsplash"})]}),s==="unsplash"?r.jsxRuntimeExports.jsx(Ne,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:r.jsxRuntimeExports.jsx(k.Suspense,{fallback:r.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:r.jsxRuntimeExports.jsx(Ra,{isModalView:e,onSelect:t})})}):r.jsxRuntimeExports.jsx(Ne,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:r.jsxRuntimeExports.jsx(k.Suspense,{fallback:r.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:r.jsxRuntimeExports.jsx(ka,{isModalView:e,onSelect:t})})})]})]})},Sa=Object.freeze(Object.defineProperty({__proto__:null,default:Oo},Symbol.toStringTag,{value:"Module"})),ht=({children:e,onSelect:t})=>{const[s,o]=k.useState(!1),n=(...l)=>{t.call(void 0,...l),o(!1)};return r.jsxRuntimeExports.jsxs(ot,{open:s,onOpenChange:l=>o(l),children:[r.jsxRuntimeExports.jsx(ps,{asChild:!0,children:e}),r.jsxRuntimeExports.jsx(_e,{className:"flex h-3/4 max-w-5xl",children:r.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:r.jsxRuntimeExports.jsx(Oo,{isModalView:!0,onSelect:n})})})]})},Na=({value:e,onChange:t,id:s,onBlur:o})=>r.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[e?r.jsxRuntimeExports.jsx("img",{src:e,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):r.jsxRuntimeExports.jsx(ht,{onSelect:t,children:r.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400"})}),r.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[r.jsxRuntimeExports.jsx(ht,{onSelect:t,children:r.jsxRuntimeExports.jsx("small",{className:"cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:e||!i.isEmpty(e)?"Replace Image":"Choose Image"})}),r.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"}),r.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:e,onBlur:({target:{value:n}})=>o(s,n),onChange:n=>t(n.target.value)})]})]}),Ca=({id:e,placeholder:t,value:s,onChange:o,onBlur:n})=>{const l={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},a=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:r.jsxRuntimeExports.jsx(Bn,{id:e,value:s,onBlur:d=>n(e,d),onChange:d=>o(d),modules:l,formats:a,placeholder:t,className:"mt-1 rounded-md"})},Ea=({schema:e,formData:t,onChange:s})=>{const[o,n]=k.useState([]),l=ie("getPages",()=>[]),{type:a="page",href:d="",target:g="self"}=t;return k.useEffect(()=>{(async()=>{const c=await l();n(c||[])})()},[]),r.jsxRuntimeExports.jsxs("div",{children:[r.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(e==null?void 0:e.title)??"Link"}),r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[r.jsxRuntimeExports.jsx("select",{name:"type",value:a,onChange:c=>s({...t,type:c.target.value}),children:[{const:"page",title:"Open Page"},{const:"url",title:"Open URL"},{const:"email",title:"Compose Email"},{const:"telephone",title:"Call Phone"},{const:"scroll",title:"Scroll to element"}].map(c=>r.jsxRuntimeExports.jsx("option",{value:c.const,children:c.title},c.const))}),a==="page"?r.jsxRuntimeExports.jsxs("select",{name:"href",placeholder:"Choose Page",value:d,onChange:c=>s({...t,href:c.target.value}),children:[r.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),i.map(o,c=>r.jsxRuntimeExports.jsx("option",{value:c.slug,children:c.name},c.uuid))]}):r.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:d,onChange:c=>s({...t,href:c.target.value}),placeholder:a==="page"||a==="url"?"Enter URL":a==="scroll"?"#ElementID":"Enter detail"}),(a==="page"||a==="url")&&r.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:g==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>s({...t,target:g==="_blank"?"_self":"_blank"})}),r.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})},Aa=()=>{const[e]=ue(),[,t]=ve(),{addBlocks:s}=re(),{toast:o}=at(),n=k.useCallback((a,d,g)=>{var j;for(let C=0;C<a.length;C++){const{_id:O}=a[C];a[C]._id=ne.generateUUID();const V=i.filter(a,{_parent:O});for(let B=0;B<V.length;B++)V[B]._parent=a[C]._id}const c=i.first(a);let x,R;return d&&(x=i.find(e,{_id:d}),a[0]._parent=d,R=d),!(x?ze(x._type,c._type):!0)&&x&&(a[0]._parent=x._parent,R=x._parent),s(a,R,g),t([(j=i.first(a))==null?void 0:j._id]),i.first(a)},[e,t]);return{addCoreBlock:k.useCallback((a,d,g)=>{if(i.has(a,"blocks")){const B=a.blocks;return n(B,d,g)}const c=ne.generateUUID(),x=Vt(a.props),R=[];i.forIn(x,(B,I)=>{if(i.startsWith(B,X.SLOT_KEY)){const $=B.replace(X.SLOT_KEY,"");R.push({_id:$,_type:"Slot",_parent:c,_name:a.props[I].name,_styles:a.props[I].styles,_emptyStyles:a.props[I].emptyStyles})}});const N={_type:a.type,_id:c,...x};let j,C;if(d&&(j=i.find(e,{_id:d}),N._parent=d,C=d),!Xn(j==null?void 0:j._type,a.type)){o({variant:"destructive",title:"Error",description:`"${a.type}" cannot be added under "${j?j==null?void 0:j._type:"root"}"`}),t([]);return}!(j?ze(j._type,a.type):!0)&&j&&(N._parent=j._parent,C=j._parent);const V=[N,...R];return s(V,C,g),t([N._id]),N},[n,e,t]),addPredefinedBlock:n}},bt={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},vt=["xs","sm","md","lg","xl","2xl"];function Ba(e,t){if(t===null)return"baseClasses";const s=t.mq;if(s==="xs"||t.dark||t.mod!=="")return"classes";let o="baseClasses",n=vt.indexOf(s);for(;n>0;){const l=vt[n-1];if(i.find(e,{mq:l,property:t.property})){o="classes";break}n--}return o}const yt=[];function _a(e="",t="",s=[]){e=e.trim().replace(/ +/g,"");let o=i.filter(i.map(e.split(" "),u.constructClassObject),c=>!i.isNull(c)),n=i.filter(i.map(t.split(" "),u.constructClassObject),c=>!i.isNull(c));n=i.filter(n,c=>!i.includes(yt,c.property));const l=[],a=[];i.each(s,c=>{const x=u.constructClassObject(c),R=i.find(o,i.pick(x,["dark","mq","mod","property"]));if(R&&(o=i.filter(o,N=>N.fullCls!==(R==null?void 0:R.fullCls))),l.push(x),x.mq==="xs"&&!x.dark&&x.mod===""&&(n=i.filter(n,N=>N.property!==x.property)),Ba(o,x)==="baseClasses"&&!i.includes(yt,x.property)){const N=i.find(n,i.pick(x,["property"]));R&&(n=i.filter(n,j=>j.fullCls!==(N==null?void 0:N.fullCls))),a.push({...x,fullCls:x.cls,mq:"xs"})}});const d=i.map(i.sortBy([...o,...l],c=>bt[c.mq]),"fullCls").join(" ");return`${i.map(i.sortBy([...n,...a],c=>bt[c.mq]),"fullCls").join(" ").trim()},${d.trim()}`.trim().replace(/ +/g,"")}const ye=p.atom([]);ye.debugLabel="selectedStylingBlocksAtom";const Lo=()=>p.useAtom(ye),Ta=e=>{const t=e.replace(X.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},Pa=p.atom(null,(e,t,{blockIds:s,newClasses:o})=>{const n=i.filter(e(We),a=>s.includes(e(a)._id)),l=i.first(e(ye));return i.map(n,a=>{const d=e(a),g=i.get(d,l.prop,`${X.STYLES_KEY},`),{baseClasses:c,classes:x}=Ta(g);return{ids:[d._id],props:{[l.prop]:`${X.STYLES_KEY}${_a(x,c,o)}`}}})}),Ia=()=>{const e=p.useSetAtom(Pa),{updateBlocks:t,updateBlocksRuntime:s}=re();return k.useCallback((o,n,l=!1)=>{const a=e({blockIds:o,newClasses:n});if(!l){s(o,a[0].props);return}t(o,a[0].props)},[e])},zo=()=>p.useAtom(Lt),Vo=xe("canvasWidth",800),Fo=p.atom(e=>{const t=e(Vo);return ne.getBreakpointValue(t).toLowerCase()}),Ma=()=>{const[e,t]=p.useAtom(Vo),s=p.useAtomValue(Fo),[o,n]=zo();return k.useEffect(()=>{o!=="xs"&&n(s)},[s,o,n]),[e,s,t]},Da=xe("canvasZoom",100),Oa=()=>p.useAtom(Da),Uo=p.atom([]),qo=()=>{const[e,t]=p.useAtom(Uo),s=p.useSetAtom(lt),o=k.useCallback(n=>{t(n),s([])},[t,s]);return[e,o]},lt=p.atom([]),La=()=>{const[e,t]=p.useAtom(lt),s=p.useSetAtom(Uo),o=k.useCallback(n=>{t(n),s([])},[t,s]);return[e,o]},$o=xe("darkMode",!1),za=()=>{const[e,t]=p.useAtom($o);return[e,t]},Go=()=>{const[e]=ue(),[,t]=ve(),{addBlocks:s}=re();return k.useCallback((o,n=null)=>{const l=[];i.each(o,a=>{const d=e.find(N=>N._id===a);n||(n=d._parent);const x=i.filter(e,N=>i.isString(n)?N._parent===n:!d._parent).indexOf(d)+1,R=tr(e,a,n);s(R,n,x),l.push(i.get(R,"0._id",""))}),t(l)},[e,t])},Va=p.atom([]),Fa=()=>{const[e,t]=p.useAtom(Va),s=k.useCallback(o=>{t(n=>i.includes(n,o)?i.without(n,o):[...n,o])},[t]);return[e,t,s]},Ua=p.atom(""),Wo=()=>p.useAtom(Ua),qa=()=>{const e=p.useAtomValue(Z);return k.useCallback((t,s)=>{const o=i.map(e,n=>(i.includes(t,i.get(n,"_id"))&&i.set(n,"_parent",s),n));console.log("newBlocks",o)},[e])},$a=()=>{console.warn("usePasteBlocks is not implemented");const e=p.useAtomValue(lt),[t,s]=qo(),o=Go(),n=qa();return{canPaste:k.useMemo(()=>t.length>0||e.length>0,[e,t]),pasteBlocks:k.useCallback(a=>{i.isEmpty(e)?n(t,a):o(e,a),s(()=>[])},[t,e,o,n,s])}},Ga=p.atom(!1),Wa=()=>{const[e,t]=p.useAtom(Ga);return[e,t]},Ha=p.atom(null,(e,t,{blockIds:s,fullClasses:o})=>{const n=i.first(e(ye)),l=i.filter(e(We),a=>s.includes(e(a)._id));return i.map(l,a=>{const d=e(a),g=o;let{classes:c,baseClasses:x}=Qn(i.get(d,n.prop,"styles:,"));return i.each(g,R=>{const N=new RegExp(`(^| )${R.replace("[","\\[").replace("]","\\]")}($| )`,"g");c=c.replace(N," ").replace(/ +/g," ").trim();const j=i.first(R.split(":"));i.includes(["2xl","xl","lg","md","sm"],j)&&g.push(R.split(":").pop().trim())}),i.each(g,R=>{const N=new RegExp(`(^| )${R.replace("[","\\[").replace("]","\\]")}($| )`,"g");x=x.replace(N," ").replace(/ +/g," ").trim()}),{ids:[d._id],props:{[n.prop]:`${X.STYLES_KEY}${x},${c}`}}})}),Ya=()=>{const{updateBlocks:e}=re(),t=p.useSetAtom(Ha);return k.useCallback((s,o)=>{const n=t({blockIds:s,fullClasses:o});e(s,n[0].props)},[t])},Ho=p.atom(e=>{const t=i.first(e(ye)),s=e(Ee);if(!t||t.blockId!==i.get(s,"_id",null))return[];const n=i.get(s,t.prop,`${X.STYLES_KEY},`).replace(X.STYLES_KEY,"").split(",").join(" ");return i.filter(i.map(n.trim().split(" "),u.constructClassObject),l=>!i.isNull(l))}),Ka=()=>p.useAtomValue(Ho),jt={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},Ja=p.atom(e=>{const t=e(Fo),s=e(Ke),o=e($o),n=Qa(t);let l=i.filter(e(Ho),{mod:s});return i.startsWith(s,"_")||(l=i.filter(l,a=>n.includes(a.mq))),l=l.sort((a,d)=>jt[a.mq]-jt[d.mq]),o||(l=i.filter(l,{dark:!1})),l}),Qa=e=>{let t=[];switch(e){case"xs":t=["xs"];break;case"sm":t=["xs","sm"];break;case"md":t=["xs","sm","md"];break;case"lg":t=["xs","sm","md","lg"];break;case"xl":t=["xs","sm","md","lg","xl"];break;case"2xl":t=["xs","sm","md","lg","xl","2xl"];break;default:t=["xs"];break}return t},Xa=()=>p.useAtomValue(Ja),Za=()=>p.useAtom(Ke),ei=()=>{const{updateBlocks:e}=re();return k.useCallback((t,s,o)=>{e(t,s,o)},[e])},ti=()=>{const{updateBlocksRuntime:e}=re();return k.useCallback((t,s)=>{e(t,s)},[e])},Yo={name:"",props:{},modalProps:{},backdropClose:!0},si=p.atom(Yo),oi=()=>{const[e,t]=p.useAtom(si),s=k.useCallback((n,l={},a={})=>{t({name:n,props:l,modalProps:a})},[t]),o=k.useCallback((...n)=>{i.get(e,"props.onClose",()=>{})(...n),t(Yo)},[t,e]);return{activeModal:e,openModal:s,closeModal:o}},ni=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),p.useAtomValue(Z)),Ko=p.atom(!1);Ko.debugLabel="readOnlyModeAtom";const Jo=p.atom("online");Jo.debugLabel="networkModeAtom";const ri=p.atom(!1);ri.debugLabel="codeEditorOpenAtom";const Qo=p.atom(!1);Qo.debugLabel="editLayerNameAtom";const ai=p.atom("");ai.debugLabel="activeLanguageAtom";const ii=p.atom("");ii.debugLabel="primaryLanguageAtom";const Xo=p.atom(null);Xo.debugLabel="canvasIframeAtom";const Zo=p.atom("outline");Zo.debugLabel="activePanelAtom";const en=p.atom("");en.debugLabel="showPredefinedBlockCategoryAtom";const tn=p.atom({undoCount:0,redoCount:0});tn.debugLabel="historyStatesAtom";const sn=p.atom("");sn.debugLabel="inlineEditingActiveAtom";const on=p.atom(!1);on.debugLabel="draggingFlagAtom";const nn=p.atom("");nn.debugLabel="draggedBlockIdAtom";const rn=p.atom(null);rn.debugLabel="treeRefAtom";const an=p.atom({});an.debugLabel="canvasSettingsAtom";const li=()=>p.useAtomValue(Ko),ci=p.atom(""),di=p.atom(null),ui=()=>p.useAtom(ci),mi=()=>p.useAtom(di),pi=xe("selectedBreakpoints",["XS","MD","XL"]),fi=()=>{const[e,t]=p.useAtom(pi);return[e,t]},xi=()=>{const e=p.useSetAtom(tn),{clear:t}=tt(),[,s]=ve(),[,o]=Wo(),[,n]=Lo();return()=>{s([]),n([]),o(""),t(),e({undoCount:0,redoCount:0})}},gi=p.atom([]),hi=()=>{const[e,t]=k.useState(!1),[s,o]=p.useAtom(gi),n=ie("getUILibraryBlocks",()=>[]);return k.useEffect(()=>{(async()=>s.length>0||(t(!0),o(await n()),t(!1)))()},[]),{data:s,isLoading:e}},bi=()=>{const[e,t]=k.useState(null),s=k.useCallback(async o=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(o),t(o),!0}catch(n){return console.warn("Copy failed",n),t(null),!1}},[]);return[e,s]};exports.Accordion=Er;exports.AccordionContent=Zt;exports.AccordionItem=Qt;exports.AccordionTrigger=Xt;exports.Alert=es;exports.AlertDescription=ss;exports.AlertDialog=_r;exports.AlertDialogAction=us;exports.AlertDialogCancel=ms;exports.AlertDialogContent=as;exports.AlertDialogDescription=ds;exports.AlertDialogFooter=ls;exports.AlertDialogHeader=is;exports.AlertDialogTitle=cs;exports.AlertDialogTrigger=Tr;exports.AlertTitle=ts;exports.Badge=Br;exports.Button=Jt;exports.Card=ys;exports.CardContent=ks;exports.CardDescription=Rs;exports.CardFooter=Ss;exports.CardHeader=js;exports.CardTitle=ws;exports.Command=it;exports.CommandDialog=fa;exports.CommandEmpty=Ro;exports.CommandGroup=ko;exports.CommandInput=jo;exports.CommandItem=No;exports.CommandList=wo;exports.CommandSeparator=So;exports.CommandShortcut=Co;exports.ContextMenu=xa;exports.ContextMenuCheckboxItem=To;exports.ContextMenuContent=Bo;exports.ContextMenuGroup=ha;exports.ContextMenuItem=_o;exports.ContextMenuLabel=Io;exports.ContextMenuPortal=ba;exports.ContextMenuRadioGroup=ya;exports.ContextMenuRadioItem=Po;exports.ContextMenuSeparator=Mo;exports.ContextMenuShortcut=Do;exports.ContextMenuSub=va;exports.ContextMenuSubContent=Ao;exports.ContextMenuSubTrigger=Eo;exports.ContextMenuTrigger=ga;exports.Dialog=ot;exports.DialogContent=_e;exports.DialogDescription=vs;exports.DialogFooter=hs;exports.DialogHeader=gs;exports.DialogTitle=bs;exports.DialogTrigger=ps;exports.DropdownMenu=ea;exports.DropdownMenuCheckboxItem=io;exports.DropdownMenuContent=ro;exports.DropdownMenuGroup=sa;exports.DropdownMenuItem=ao;exports.DropdownMenuLabel=co;exports.DropdownMenuPortal=oa;exports.DropdownMenuRadioGroup=ra;exports.DropdownMenuRadioItem=lo;exports.DropdownMenuSeparator=uo;exports.DropdownMenuShortcut=mo;exports.DropdownMenuSub=na;exports.DropdownMenuSubContent=no;exports.DropdownMenuSubTrigger=oo;exports.DropdownMenuTrigger=ta;exports.HoverCard=Gr;exports.HoverCardContent=$s;exports.HoverCardTrigger=Wr;exports.IconPickerField=wa;exports.ImagePickerField=Na;exports.ImagesPanel=Sa;exports.Input=Ns;exports.Label=Cs;exports.LinkField=Ea;exports.Menubar=Ps;exports.MenubarCheckboxItem=zs;exports.MenubarContent=Os;exports.MenubarGroup=Fr;exports.MenubarItem=Ls;exports.MenubarLabel=Fs;exports.MenubarMenu=Vr;exports.MenubarPortal=Ur;exports.MenubarRadioGroup=$r;exports.MenubarRadioItem=Vs;exports.MenubarSeparator=Us;exports.MenubarShortcut=qs;exports.MenubarSub=qr;exports.MenubarSubContent=Ds;exports.MenubarSubTrigger=Ms;exports.MenubarTrigger=Is;exports.Popover=Lr;exports.PopoverContent=Ts;exports.PopoverTrigger=zr;exports.RichTextEditorField=Ca;exports.ScrollArea=As;exports.ScrollBar=nt;exports.Select=Hr;exports.SelectContent=Ws;exports.SelectGroup=Yr;exports.SelectItem=Ys;exports.SelectLabel=Hs;exports.SelectSeparator=Ks;exports.SelectTrigger=Gs;exports.SelectValue=Kr;exports.Separator=po;exports.Sheet=Jr;exports.SheetClose=Xr;exports.SheetContent=Xs;exports.SheetDescription=so;exports.SheetFooter=eo;exports.SheetHeader=Zs;exports.SheetTitle=to;exports.SheetTrigger=Qr;exports.Skeleton=pa;exports.Switch=Kt;exports.Tabs=Bs;exports.TabsContent=Ne;exports.TabsList=rt;exports.TabsTrigger=Se;exports.Textarea=Es;exports.Toaster=ma;exports.Toggle=Yt;exports.Tooltip=Dr;exports.TooltipContent=_s;exports.TooltipPortal=Ir;exports.TooltipProvider=Mr;exports.TooltipTrigger=Or;exports.activePanelAtom=Zo;exports.atom=te;exports.atomWithDefault=Wn;exports.atomWithStorage=xe;exports.badgeVariants=os;exports.builderSaveStateAtom=Ae;exports.buttonVariants=Be;exports.canAcceptChildBlock=ze;exports.canDeleteBlock=er;exports.canDuplicateBlock=Zn;exports.canvasIframeAtom=Xo;exports.canvasSettingsAtom=an;exports.chaiBuilderPropsAtom=Ge;exports.chaiExternalDataAtom=Bt;exports.createStore=Nt;exports.dataProvidersAtom=et;exports.draggedBlockIdAtom=nn;exports.draggingFlagAtom=on;exports.editLayerNameAtom=Qo;exports.getBlockJSONFromSchemas=Fe;exports.getBlockJSONFromUISchemas=Ve;exports.inlineEditingActiveAtom=sn;exports.isDevelopment=Jn;exports.networkModeAtom=Jo;exports.presentBlocksAtom=Z;exports.reducer=fo;exports.showPredefinedBlockCategoryAtom=en;exports.toast=xo;exports.toggleVariants=Ht;exports.treeDSBlocks=It;exports.treeRefAtom=rn;exports.useActiveModal=oi;exports.useActivePanel=ui;exports.useAddBlock=Aa;exports.useAddBlockParent=mi;exports.useAddClassesToBlocks=Ia;exports.useAllBlocks=ni;exports.useAtom=Vn;exports.useAtomValue=Ct;exports.useBlocksContainer=br;exports.useBlocksStore=ue;exports.useBlocksStoreUndoableActions=re;exports.useBrandingOptions=Qe;exports.useBuilderProp=ie;exports.useBuilderReset=xi;exports.useCanvasWidth=Ma;exports.useCanvasZoom=Oa;exports.useCopyBlockIds=La;exports.useCopyToClipboard=bi;exports.useCurrentPage=Ft;exports.useCutBlockIds=qo;exports.useDarkMode=za;exports.useDuplicateBlocks=Go;exports.useGetPageData=Gt;exports.useHiddenBlockIds=Fa;exports.useHighlightBlockId=Wo;exports.usePageDataProviders=Wt;exports.usePasteBlocks=$a;exports.usePreviewMode=Wa;exports.useReadOnlyMode=li;exports.useRemoveBlocks=kr;exports.useRemoveClassesFromBlocks=Ya;exports.useSavePage=Rr;exports.useSelectedBlock=lr;exports.useSelectedBlockAllClasses=Ka;exports.useSelectedBlockCanvasSetting=dr;exports.useSelectedBlockCurrentClasses=Xa;exports.useSelectedBlockCustomStylingStates=ur;exports.useSelectedBlockIds=ve;exports.useSelectedBlocksDisplayChild=ir;exports.useSelectedBreakpoints=fi;exports.useSelectedStylingBlocks=Lo;exports.useSetAtom=Et;exports.useStore=qe;exports.useStylingBreakpoint=zo;exports.useStylingState=Za;exports.useToast=at;exports.useUILibraryBlocks=hi;exports.useUndoManager=tt;exports.useUpdateBlocksProps=ei;exports.useUpdateBlocksPropsRealtime=ti;
|
|
@@ -18,13 +18,13 @@ var v2 = (a, t, h, v) => ({
|
|
|
18
18
|
import { j as i } from "./jsx-runtime-WbnYoNE9.js";
|
|
19
19
|
import * as b from "react";
|
|
20
20
|
import H0, { lazy as A2, useCallback as g2, useState as M2, Suspense as u0, useEffect as s0 } from "react";
|
|
21
|
-
import { C as p0 } from "./index-
|
|
21
|
+
import { C as p0 } from "./index-0QJwevON.js";
|
|
22
22
|
import { FileTextIcon as V0, GearIcon as f0, EyeClosedIcon as m0, EyeOpenIcon as L0 } from "@radix-ui/react-icons";
|
|
23
|
-
import { u as x0, B as Y2, A as w0, a as B0, b as C0, c as O0, d as A0, e as S0, f as y0, g as b0, h as P0 } from "./index-
|
|
23
|
+
import { u as x0, B as Y2, A as w0, a as B0, b as C0, c as O0, d as A0, e as S0, f as y0, g as b0, h as P0 } from "./index-UHaqEdws.js";
|
|
24
24
|
import { toast as h1, Toaster as F0 } from "sonner";
|
|
25
25
|
import { useTranslation as D0 } from "react-i18next";
|
|
26
26
|
import { sortBy as R0, filter as k0, has as T0, set as E0, capitalize as N0, get as b2, omit as I0, size as P2 } from "lodash-es";
|
|
27
|
-
import { g as W0 } from "./html-to-json-
|
|
27
|
+
import { g as W0 } from "./html-to-json-LJyJsnmZ.js";
|
|
28
28
|
import { Loader as U0, Loader2 as j0, LogOutIcon as Q0 } from "lucide-react";
|
|
29
29
|
import { G as X2 } from "./index-YpnaudSM.js";
|
|
30
30
|
var N1 = class {
|
|
@@ -2044,7 +2044,7 @@ const k4 = () => {
|
|
|
2044
2044
|
] })
|
|
2045
2045
|
] })
|
|
2046
2046
|
] });
|
|
2047
|
-
}, W4 = () => /* @__PURE__ */ i.jsx(I4, { children: /* @__PURE__ */ i.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ i.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-
|
|
2047
|
+
}, W4 = () => /* @__PURE__ */ i.jsx(I4, { children: /* @__PURE__ */ i.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ i.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-_1CDTUdE.js")), j4 = A2(() => import("./ProjectPanel-pUMeIiUW.js")), Q4 = A2(() => import("./CurrentPage-06Iacwyp.js")), K4 = () => /* @__PURE__ */ i.jsx("h2", { children: "Your Logo" }), G4 = () => {
|
|
2048
2048
|
const { mutate: a } = y4();
|
|
2049
2049
|
return P0("editable", !0) ? /* @__PURE__ */ i.jsx(Y2, { onClick: a, className: "bg-blue-600 text-white", children: "Publish" }) : null;
|
|
2050
2050
|
}, q4 = (a) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var H2=(a,t,h)=>{if(!t.has(a))throw TypeError("Cannot "+h)};var c=(a,t,h)=>(H2(a,t,"read from private field"),h?h.call(a):t.get(a)),o=(a,t,h)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,h)},e=(a,t,h,n)=>(H2(a,t,"write to private field"),n?n.call(a,h):t.set(a,h),h);var r2=(a,t,h,n)=>({set _(v){e(a,t,v,h)},get _(){return c(a,t,n)}}),M=(a,t,h)=>(H2(a,t,"access private method"),h);const l=require("./jsx-runtime-Z_BpKhVy.cjs"),T=require("react"),s0=require("./index-OB199Izc.cjs"),i2=require("@radix-ui/react-icons"),q=require("./index-h-hd6EvN.cjs"),a1=require("sonner"),p0=require("react-i18next"),h1=require("lodash-es"),V0=require("./html-to-json-efmv1pCj.cjs"),S2=require("lucide-react"),t0=require("./index-ecnGWzh9.cjs");function f0(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const h in a)if(h!=="default"){const n=Object.getOwnPropertyDescriptor(a,h);Object.defineProperty(t,h,n.get?n:{enumerable:!0,get:()=>a[h]})}}return t.default=a,Object.freeze(t)}const A=f0(T);var W1=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N1=typeof window>"u"||"Deno"in window;function _(){}function m0(a,t){return typeof a=="function"?a(t):a}function s2(a){return typeof a=="number"&&a>=0&&a!==1/0}function a0(a,t){return Math.max(a+(t||0)-Date.now(),0)}function R2(a,t){const{type:h="all",exact:n,fetchStatus:v,predicate:r,queryKey:i,stale:z}=a;if(i){if(n){if(t.queryHash!==A2(i,t.options))return!1}else if(!Q1(t.queryKey,i))return!1}if(h!=="all"){const s=t.isActive();if(h==="active"&&!s||h==="inactive"&&s)return!1}return!(typeof z=="boolean"&&t.isStale()!==z||typeof v<"u"&&v!==t.state.fetchStatus||r&&!r(t))}function F2(a,t){const{exact:h,status:n,predicate:v,mutationKey:r}=a;if(r){if(!t.options.mutationKey)return!1;if(h){if(U1(t.options.mutationKey)!==U1(r))return!1}else if(!Q1(t.options.mutationKey,r))return!1}return!(n&&t.state.status!==n||v&&!v(t))}function A2(a,t){return((t==null?void 0:t.queryKeyHashFn)||U1)(a)}function U1(a){return JSON.stringify(a,(t,h)=>p2(h)?Object.keys(h).sort().reduce((n,v)=>(n[v]=h[v],n),{}):h)}function Q1(a,t){return a===t?!0:typeof a!=typeof t?!1:a&&t&&typeof a=="object"&&typeof t=="object"?!Object.keys(t).some(h=>!Q1(a[h],t[h])):!1}function h0(a,t){if(a===t)return a;const h=D2(a)&&D2(t);if(h||p2(a)&&p2(t)){const n=h?a.length:Object.keys(a).length,v=h?t:Object.keys(t),r=v.length,i=h?[]:{};let z=0;for(let s=0;s<r;s++){const p=h?s:v[s];i[p]=h0(a[p],t[p]),i[p]===a[p]&&z++}return n===r&&z===n?a:i}return t}function o2(a,t){if(a&&!t||t&&!a)return!1;for(const h in a)if(a[h]!==t[h])return!1;return!0}function D2(a){return Array.isArray(a)&&a.length===Object.keys(a).length}function p2(a){if(!k2(a))return!1;const t=a.constructor;if(typeof t>"u")return!0;const h=t.prototype;return!(!k2(h)||!h.hasOwnProperty("isPrototypeOf"))}function k2(a){return Object.prototype.toString.call(a)==="[object Object]"}function n0(a){return new Promise(t=>{setTimeout(t,a)})}function E2(a){n0(0).then(a)}function V2(a,t,h){return typeof h.structuralSharing=="function"?h.structuralSharing(a,t):h.structuralSharing!==!1?h0(a,t):t}function L0(a,t,h=0){const n=[...a,t];return h&&n.length>h?n.slice(1):n}function x0(a,t,h=0){const n=[t,...a];return h&&n.length>h?n.slice(0,-1):n}var u1,e1,B1,U2,w0=(U2=class extends W1{constructor(){super();o(this,u1,void 0);o(this,e1,void 0);o(this,B1,void 0);e(this,B1,t=>{if(!N1&&window.addEventListener){const h=()=>t();return window.addEventListener("visibilitychange",h,!1),()=>{window.removeEventListener("visibilitychange",h)}}})}onSubscribe(){c(this,e1)||this.setEventListener(c(this,B1))}onUnsubscribe(){var t;this.hasListeners()||((t=c(this,e1))==null||t.call(this),e(this,e1,void 0))}setEventListener(t){var h;e(this,B1,t),(h=c(this,e1))==null||h.call(this),e(this,e1,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){c(this,u1)!==t&&(e(this,u1,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof c(this,u1)=="boolean"?c(this,u1):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},u1=new WeakMap,e1=new WeakMap,B1=new WeakMap,U2),d2=new w0,I1,l1,G1,Q2,B0=(Q2=class extends W1{constructor(){super();o(this,I1,!0);o(this,l1,void 0);o(this,G1,void 0);e(this,G1,t=>{if(!N1&&window.addEventListener){const h=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",h,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",h),window.removeEventListener("offline",n)}}})}onSubscribe(){c(this,l1)||this.setEventListener(c(this,G1))}onUnsubscribe(){var t;this.hasListeners()||((t=c(this,l1))==null||t.call(this),e(this,l1,void 0))}setEventListener(t){var h;e(this,G1,t),(h=c(this,l1))==null||h.call(this),e(this,l1,t(this.setOnline.bind(this)))}setOnline(t){c(this,I1)!==t&&(e(this,I1,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return c(this,I1)}},I1=new WeakMap,l1=new WeakMap,G1=new WeakMap,Q2),z2=new B0;function I0(a){return Math.min(1e3*2**a,3e4)}function M2(a){return(a??"online")==="online"?z2.isOnline():!0}var c0=class{constructor(a){this.revert=a==null?void 0:a.revert,this.silent=a==null?void 0:a.silent}};function u2(a){return a instanceof c0}function v0(a){let t=!1,h=0,n=!1,v,r,i;const z=new Promise((g,u)=>{r=g,i=u}),s=g=>{var u;n||(H(new c0(g)),(u=a.abort)==null||u.call(a))},p=()=>{t=!0},d=()=>{t=!1},x=()=>!d2.isFocused()||a.networkMode!=="always"&&!z2.isOnline(),b=g=>{var u;n||(n=!0,(u=a.onSuccess)==null||u.call(a,g),v==null||v(),r(g))},H=g=>{var u;n||(n=!0,(u=a.onError)==null||u.call(a,g),v==null||v(),i(g))},V=()=>new Promise(g=>{var u;v=G=>{const f=n||!x();return f&&g(G),f},(u=a.onPause)==null||u.call(a)}).then(()=>{var g;v=void 0,n||(g=a.onContinue)==null||g.call(a)}),B=()=>{if(n)return;let g;try{g=a.fn()}catch(u){g=Promise.reject(u)}Promise.resolve(g).then(b).catch(u=>{var F;if(n)return;const G=a.retry??(N1?0:3),f=a.retryDelay??I0,m=typeof f=="function"?f(h,u):f,y=G===!0||typeof G=="number"&&h<G||typeof G=="function"&&G(h,u);if(t||!y){H(u);return}h++,(F=a.onFail)==null||F.call(a,h,u),n0(m).then(()=>{if(x())return V()}).then(()=>{t?H(u):B()})})};return M2(a.networkMode)?B():V().then(B),{promise:z,cancel:s,continue:()=>(v==null?void 0:v())?z:Promise.resolve(),cancelRetry:p,continueRetry:d}}function G0(){let a=[],t=0,h=d=>{d()},n=d=>{d()};const v=d=>{let x;t++;try{x=d()}finally{t--,t||z()}return x},r=d=>{t?a.push(d):E2(()=>{h(d)})},i=d=>(...x)=>{r(()=>{d(...x)})},z=()=>{const d=a;a=[],d.length&&E2(()=>{n(()=>{d.forEach(x=>{h(x)})})})};return{batch:v,batchCalls:i,schedule:r,setNotifyFunction:d=>{h=d},setBatchNotifyFunction:d=>{n=d}}}var O=G0(),s1,K2,r0=(K2=class{constructor(){o(this,s1,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),s2(this.gcTime)&&e(this,s1,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(a){this.gcTime=Math.max(this.gcTime||0,a??(N1?1/0:5*60*1e3))}clearGcTimeout(){c(this,s1)&&(clearTimeout(c(this,s1)),e(this,s1,void 0))}},s1=new WeakMap,K2),C1,O1,j,i1,U,S,K1,p1,S1,e2,$,c1,q2,C0=(q2=class extends r0{constructor(t){super();o(this,S1);o(this,$);o(this,C1,void 0);o(this,O1,void 0);o(this,j,void 0);o(this,i1,void 0);o(this,U,void 0);o(this,S,void 0);o(this,K1,void 0);o(this,p1,void 0);e(this,p1,!1),e(this,K1,t.defaultOptions),M(this,S1,e2).call(this,t.options),e(this,S,[]),e(this,j,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,e(this,C1,t.state||O0(this.options)),this.state=c(this,C1),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!c(this,S).length&&this.state.fetchStatus==="idle"&&c(this,j).remove(this)}setData(t,h){const n=V2(this.state.data,t,this.options);return M(this,$,c1).call(this,{data:n,type:"success",dataUpdatedAt:h==null?void 0:h.updatedAt,manual:h==null?void 0:h.manual}),n}setState(t,h){M(this,$,c1).call(this,{type:"setState",state:t,setStateOptions:h})}cancel(t){var n;const h=c(this,i1);return(n=c(this,U))==null||n.cancel(t),h?h.then(_).catch(_):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(c(this,C1))}isActive(){return c(this,S).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||c(this,S).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!a0(this.state.dataUpdatedAt,t)}onFocus(){var h;const t=c(this,S).find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,U))==null||h.continue()}onOnline(){var h;const t=c(this,S).find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,U))==null||h.continue()}addObserver(t){c(this,S).includes(t)||(c(this,S).push(t),this.clearGcTimeout(),c(this,j).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){c(this,S).includes(t)&&(e(this,S,c(this,S).filter(h=>h!==t)),c(this,S).length||(c(this,U)&&(c(this,p1)?c(this,U).cancel({revert:!0}):c(this,U).cancelRetry()),this.scheduleGc()),c(this,j).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return c(this,S).length}invalidate(){this.state.isInvalidated||M(this,$,c1).call(this,{type:"invalidate"})}fetch(t,h){var p,d,x,b;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(h!=null&&h.cancelRefetch))this.cancel({silent:!0});else if(c(this,i1))return(p=c(this,U))==null||p.continueRetry(),c(this,i1)}if(t&&M(this,S1,e2).call(this,t),!this.options.queryFn){const H=c(this,S).find(V=>V.options.queryFn);H&&M(this,S1,e2).call(this,H.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,v={queryKey:this.queryKey,meta:this.meta},r=H=>{Object.defineProperty(H,"signal",{enumerable:!0,get:()=>(e(this,p1,!0),n.signal)})};r(v);const i=()=>this.options.queryFn?(e(this,p1,!1),this.options.persister?this.options.persister(this.options.queryFn,v,this):this.options.queryFn(v)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),z={fetchOptions:h,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};r(z),(d=this.options.behavior)==null||d.onFetch(z,this),e(this,O1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=z.fetchOptions)==null?void 0:x.meta))&&M(this,$,c1).call(this,{type:"fetch",meta:(b=z.fetchOptions)==null?void 0:b.meta});const s=H=>{var V,B,g,u;u2(H)&&H.silent||M(this,$,c1).call(this,{type:"error",error:H}),u2(H)||((B=(V=c(this,j).config).onError)==null||B.call(V,H,this),(u=(g=c(this,j).config).onSettled)==null||u.call(g,this.state.data,H,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return e(this,U,v0({fn:z.fetchFn,abort:n.abort.bind(n),onSuccess:H=>{var V,B,g,u;if(typeof H>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),s(new Error(`${this.queryHash} data is undefined`));return}this.setData(H),(B=(V=c(this,j).config).onSuccess)==null||B.call(V,H,this),(u=(g=c(this,j).config).onSettled)==null||u.call(g,H,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:s,onFail:(H,V)=>{M(this,$,c1).call(this,{type:"failed",failureCount:H,error:V})},onPause:()=>{M(this,$,c1).call(this,{type:"pause"})},onContinue:()=>{M(this,$,c1).call(this,{type:"continue"})},retry:z.options.retry,retryDelay:z.options.retryDelay,networkMode:z.options.networkMode})),e(this,i1,c(this,U).promise),c(this,i1)}},C1=new WeakMap,O1=new WeakMap,j=new WeakMap,i1=new WeakMap,U=new WeakMap,S=new WeakMap,K1=new WeakMap,p1=new WeakMap,S1=new WeakSet,e2=function(t){this.options={...c(this,K1),...t},this.updateGcTime(this.options.gcTime)},$=new WeakSet,c1=function(t){const h=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:M2(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const v=t.error;return u2(v)&&v.revert&&c(this,O1)?{...c(this,O1),fetchStatus:"idle"}:{...n,error:v,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:v,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=h(this.state),O.batch(()=>{c(this,S).forEach(n=>{n.onQueryUpdate()}),c(this,j).notify({query:this,type:"updated",action:t})})},q2);function O0(a){const t=typeof a.initialData=="function"?a.initialData():a.initialData,h=typeof t<"u",n=h?typeof a.initialDataUpdatedAt=="function"?a.initialDataUpdatedAt():a.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:h?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:h?"success":"pending",fetchStatus:"idle"}}var Z,_2,S0=(_2=class extends W1{constructor(t={}){super();o(this,Z,void 0);this.config=t,e(this,Z,new Map)}build(t,h,n){const v=h.queryKey,r=h.queryHash??A2(v,h);let i=this.get(r);return i||(i=new C0({cache:this,queryKey:v,queryHash:r,options:t.defaultQueryOptions(h),state:n,defaultOptions:t.getQueryDefaults(v)}),this.add(i)),i}add(t){c(this,Z).has(t.queryHash)||(c(this,Z).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const h=c(this,Z).get(t.queryHash);h&&(t.destroy(),h===t&&c(this,Z).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){O.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return c(this,Z).get(t)}getAll(){return[...c(this,Z).values()]}find(t){const h={exact:!0,...t};return this.getAll().find(n=>R2(h,n))}findAll(t={}){const h=this.getAll();return Object.keys(t).length>0?h.filter(n=>R2(t,n)):h}notify(t){O.batch(()=>{this.listeners.forEach(h=>{h(t)})})}onFocus(){O.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Z=new WeakMap,_2),Y,q1,E,A1,X,r1,$2,A0=($2=class extends r0{constructor(t){super();o(this,X);o(this,Y,void 0);o(this,q1,void 0);o(this,E,void 0);o(this,A1,void 0);this.mutationId=t.mutationId,e(this,q1,t.defaultOptions),e(this,E,t.mutationCache),e(this,Y,[]),this.state=t.state||e0(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...c(this,q1),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){c(this,Y).includes(t)||(c(this,Y).push(t),this.clearGcTimeout(),c(this,E).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){e(this,Y,c(this,Y).filter(h=>h!==t)),this.scheduleGc(),c(this,E).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){c(this,Y).length||(this.state.status==="pending"?this.scheduleGc():c(this,E).remove(this))}continue(){var t;return((t=c(this,A1))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var v,r,i,z,s,p,d,x,b,H,V,B,g,u,G,f,m,y,F,I;const h=()=>(e(this,A1,v0({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(w,n1)=>{M(this,X,r1).call(this,{type:"failed",failureCount:w,error:n1})},onPause:()=>{M(this,X,r1).call(this,{type:"pause"})},onContinue:()=>{M(this,X,r1).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),c(this,A1).promise),n=this.state.status==="pending";try{if(!n){M(this,X,r1).call(this,{type:"pending",variables:t}),await((r=(v=c(this,E).config).onMutate)==null?void 0:r.call(v,t,this));const n1=await((z=(i=this.options).onMutate)==null?void 0:z.call(i,t));n1!==this.state.context&&M(this,X,r1).call(this,{type:"pending",context:n1,variables:t})}const w=await h();return await((p=(s=c(this,E).config).onSuccess)==null?void 0:p.call(s,w,t,this.state.context,this)),await((x=(d=this.options).onSuccess)==null?void 0:x.call(d,w,t,this.state.context)),await((H=(b=c(this,E).config).onSettled)==null?void 0:H.call(b,w,null,this.state.variables,this.state.context,this)),await((B=(V=this.options).onSettled)==null?void 0:B.call(V,w,null,t,this.state.context)),M(this,X,r1).call(this,{type:"success",data:w}),w}catch(w){try{throw await((u=(g=c(this,E).config).onError)==null?void 0:u.call(g,w,t,this.state.context,this)),await((f=(G=this.options).onError)==null?void 0:f.call(G,w,t,this.state.context)),await((y=(m=c(this,E).config).onSettled)==null?void 0:y.call(m,void 0,w,this.state.variables,this.state.context,this)),await((I=(F=this.options).onSettled)==null?void 0:I.call(F,void 0,w,t,this.state.context)),w}finally{M(this,X,r1).call(this,{type:"error",error:w})}}}},Y=new WeakMap,q1=new WeakMap,E=new WeakMap,A1=new WeakMap,X=new WeakSet,r1=function(t){const h=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!M2(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=h(this.state),O.batch(()=>{c(this,Y).forEach(n=>{n.onMutationUpdate(t)}),c(this,E).notify({mutation:this,type:"updated",action:t})})},$2);function e0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Q,_1,V1,J2,y0=(J2=class extends W1{constructor(t={}){super();o(this,Q,void 0);o(this,_1,void 0);o(this,V1,void 0);this.config=t,e(this,Q,[]),e(this,_1,0)}build(t,h,n){const v=new A0({mutationCache:this,mutationId:++r2(this,_1)._,options:t.defaultMutationOptions(h),state:n});return this.add(v),v}add(t){c(this,Q).push(t),this.notify({type:"added",mutation:t})}remove(t){e(this,Q,c(this,Q).filter(h=>h!==t)),this.notify({type:"removed",mutation:t})}clear(){O.batch(()=>{c(this,Q).forEach(t=>{this.remove(t)})})}getAll(){return c(this,Q)}find(t){const h={exact:!0,...t};return c(this,Q).find(n=>F2(h,n))}findAll(t={}){return c(this,Q).filter(h=>F2(t,h))}notify(t){O.batch(()=>{this.listeners.forEach(h=>{h(t)})})}resumePausedMutations(){return e(this,V1,(c(this,V1)??Promise.resolve()).then(()=>{const t=c(this,Q).filter(h=>h.state.isPaused);return O.batch(()=>t.reduce((h,n)=>h.then(()=>n.continue().catch(_)),Promise.resolve()))}).then(()=>{e(this,V1,void 0)})),c(this,V1)}},Q=new WeakMap,_1=new WeakMap,V1=new WeakMap,J2);function b0(a){return{onFetch:(t,h)=>{const n=async()=>{var V,B,g,u,G;const v=t.options,r=(g=(B=(V=t.fetchOptions)==null?void 0:V.meta)==null?void 0:B.fetchMore)==null?void 0:g.direction,i=((u=t.state.data)==null?void 0:u.pages)||[],z=((G=t.state.data)==null?void 0:G.pageParams)||[],s={pages:[],pageParams:[]};let p=!1;const d=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)})},x=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),b=async(f,m,y)=>{if(p)return Promise.reject();if(m==null&&f.pages.length)return Promise.resolve(f);const F={queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};d(F);const I=await x(F),{maxPages:w}=t.options,n1=y?x0:L0;return{pages:n1(f.pages,I,w),pageParams:n1(f.pageParams,m,w)}};let H;if(r&&i.length){const f=r==="backward",m=f?P0:T2,y={pages:i,pageParams:z},F=m(v,y);H=await b(y,F,f)}else{H=await b(s,z[0]??v.initialPageParam);const f=a??i.length;for(let m=1;m<f;m++){const y=T2(v,H);H=await b(H,y)}}return H};t.options.persister?t.fetchFn=()=>{var v,r;return(r=(v=t.options).persister)==null?void 0:r.call(v,n,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},h)}:t.fetchFn=n}}}function T2(a,{pages:t,pageParams:h}){const n=t.length-1;return a.getNextPageParam(t[n],t,h[n],h)}function P0(a,{pages:t,pageParams:h}){var n;return(n=a.getPreviousPageParam)==null?void 0:n.call(a,t[0],t,h[0],h)}var C,o1,d1,y1,b1,z1,P1,R1,Z2,R0=(Z2=class{constructor(a={}){o(this,C,void 0);o(this,o1,void 0);o(this,d1,void 0);o(this,y1,void 0);o(this,b1,void 0);o(this,z1,void 0);o(this,P1,void 0);o(this,R1,void 0);e(this,C,a.queryCache||new S0),e(this,o1,a.mutationCache||new y0),e(this,d1,a.defaultOptions||{}),e(this,y1,new Map),e(this,b1,new Map),e(this,z1,0)}mount(){r2(this,z1)._++,c(this,z1)===1&&(e(this,P1,d2.subscribe(()=>{d2.isFocused()&&(this.resumePausedMutations(),c(this,C).onFocus())})),e(this,R1,z2.subscribe(()=>{z2.isOnline()&&(this.resumePausedMutations(),c(this,C).onOnline())})))}unmount(){var a,t;r2(this,z1)._--,c(this,z1)===0&&((a=c(this,P1))==null||a.call(this),e(this,P1,void 0),(t=c(this,R1))==null||t.call(this),e(this,R1,void 0))}isFetching(a){return c(this,C).findAll({...a,fetchStatus:"fetching"}).length}isMutating(a){return c(this,o1).findAll({...a,status:"pending"}).length}getQueryData(a){var t;return(t=c(this,C).find({queryKey:a}))==null?void 0:t.state.data}ensureQueryData(a){const t=this.getQueryData(a.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(a)}getQueriesData(a){return this.getQueryCache().findAll(a).map(({queryKey:t,state:h})=>{const n=h.data;return[t,n]})}setQueryData(a,t,h){const n=c(this,C).find({queryKey:a}),v=n==null?void 0:n.state.data,r=m0(t,v);if(typeof r>"u")return;const i=this.defaultQueryOptions({queryKey:a});return c(this,C).build(this,i).setData(r,{...h,manual:!0})}setQueriesData(a,t,h){return O.batch(()=>this.getQueryCache().findAll(a).map(({queryKey:n})=>[n,this.setQueryData(n,t,h)]))}getQueryState(a){var t;return(t=c(this,C).find({queryKey:a}))==null?void 0:t.state}removeQueries(a){const t=c(this,C);O.batch(()=>{t.findAll(a).forEach(h=>{t.remove(h)})})}resetQueries(a,t){const h=c(this,C),n={type:"active",...a};return O.batch(()=>(h.findAll(a).forEach(v=>{v.reset()}),this.refetchQueries(n,t)))}cancelQueries(a={},t={}){const h={revert:!0,...t},n=O.batch(()=>c(this,C).findAll(a).map(v=>v.cancel(h)));return Promise.all(n).then(_).catch(_)}invalidateQueries(a={},t={}){return O.batch(()=>{if(c(this,C).findAll(a).forEach(n=>{n.invalidate()}),a.refetchType==="none")return Promise.resolve();const h={...a,type:a.refetchType??a.type??"active"};return this.refetchQueries(h,t)})}refetchQueries(a={},t){const h={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},n=O.batch(()=>c(this,C).findAll(a).filter(v=>!v.isDisabled()).map(v=>{let r=v.fetch(void 0,h);return h.throwOnError||(r=r.catch(_)),v.state.fetchStatus==="paused"?Promise.resolve():r}));return Promise.all(n).then(_)}fetchQuery(a){const t=this.defaultQueryOptions(a);typeof t.retry>"u"&&(t.retry=!1);const h=c(this,C).build(this,t);return h.isStaleByTime(t.staleTime)?h.fetch(t):Promise.resolve(h.state.data)}prefetchQuery(a){return this.fetchQuery(a).then(_).catch(_)}fetchInfiniteQuery(a){return a.behavior=b0(a.pages),this.fetchQuery(a)}prefetchInfiniteQuery(a){return this.fetchInfiniteQuery(a).then(_).catch(_)}resumePausedMutations(){return c(this,o1).resumePausedMutations()}getQueryCache(){return c(this,C)}getMutationCache(){return c(this,o1)}getDefaultOptions(){return c(this,d1)}setDefaultOptions(a){e(this,d1,a)}setQueryDefaults(a,t){c(this,y1).set(U1(a),{queryKey:a,defaultOptions:t})}getQueryDefaults(a){const t=[...c(this,y1).values()];let h={};return t.forEach(n=>{Q1(a,n.queryKey)&&(h={...h,...n.defaultOptions})}),h}setMutationDefaults(a,t){c(this,b1).set(U1(a),{mutationKey:a,defaultOptions:t})}getMutationDefaults(a){const t=[...c(this,b1).values()];let h={};return t.forEach(n=>{Q1(a,n.mutationKey)&&(h={...h,...n.defaultOptions})}),h}defaultQueryOptions(a){if(a!=null&&a._defaulted)return a;const t={...c(this,d1).queries,...(a==null?void 0:a.queryKey)&&this.getQueryDefaults(a.queryKey),...a,_defaulted:!0};return t.queryHash||(t.queryHash=A2(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(a){return a!=null&&a._defaulted?a:{...c(this,d1).mutations,...(a==null?void 0:a.mutationKey)&&this.getMutationDefaults(a.mutationKey),...a,_defaulted:!0}}clear(){c(this,C).clear(),c(this,o1).clear()}},C=new WeakMap,o1=new WeakMap,d1=new WeakMap,y1=new WeakMap,b1=new WeakMap,z1=new WeakMap,P1=new WeakMap,R1=new WeakMap,Z2),k,L,F1,P,f1,D1,t1,$1,k1,E1,m1,L1,g1,x1,w1,j1,J1,f2,Z1,m2,Y1,L2,X1,x2,t2,w2,a2,B2,h2,I2,g2,l0,Y2,F0=(Y2=class extends W1{constructor(t,h){super();o(this,w1);o(this,J1);o(this,Z1);o(this,Y1);o(this,X1);o(this,t2);o(this,a2);o(this,h2);o(this,g2);o(this,k,void 0);o(this,L,void 0);o(this,F1,void 0);o(this,P,void 0);o(this,f1,void 0);o(this,D1,void 0);o(this,t1,void 0);o(this,$1,void 0);o(this,k1,void 0);o(this,E1,void 0);o(this,m1,void 0);o(this,L1,void 0);o(this,g1,void 0);o(this,x1,void 0);e(this,L,void 0),e(this,F1,void 0),e(this,P,void 0),e(this,x1,new Set),e(this,k,t),this.options=h,e(this,t1,null),this.bindMethods(),this.setOptions(h)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(c(this,L).addObserver(this),N2(c(this,L),this.options)?M(this,w1,j1).call(this):this.updateResult(),M(this,X1,x2).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G2(c(this,L),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G2(c(this,L),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,M(this,t2,w2).call(this),M(this,a2,B2).call(this),c(this,L).removeObserver(this)}setOptions(t,h){const n=this.options,v=c(this,L);if(this.options=c(this,k).defaultQueryOptions(t),o2(n,this.options)||c(this,k).getQueryCache().notify({type:"observerOptionsUpdated",query:c(this,L),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=n.queryKey),M(this,h2,I2).call(this);const r=this.hasListeners();r&&W2(c(this,L),v,this.options,n)&&M(this,w1,j1).call(this),this.updateResult(h),r&&(c(this,L)!==v||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&M(this,J1,f2).call(this);const i=M(this,Z1,m2).call(this);r&&(c(this,L)!==v||this.options.enabled!==n.enabled||i!==c(this,g1))&&M(this,Y1,L2).call(this,i)}getOptimisticResult(t){const h=c(this,k).getQueryCache().build(c(this,k),t),n=this.createResult(h,t);return k0(this,n)&&(e(this,P,n),e(this,D1,this.options),e(this,f1,c(this,L).state)),n}getCurrentResult(){return c(this,P)}trackResult(t){const h={};return Object.keys(t).forEach(n=>{Object.defineProperty(h,n,{configurable:!1,enumerable:!0,get:()=>(c(this,x1).add(n),t[n])})}),h}getCurrentQuery(){return c(this,L)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const h=c(this,k).defaultQueryOptions(t),n=c(this,k).getQueryCache().build(c(this,k),h);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,h))}fetch(t){return M(this,w1,j1).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),c(this,P)))}createResult(t,h){var F;const n=c(this,L),v=this.options,r=c(this,P),i=c(this,f1),z=c(this,D1),p=t!==n?t.state:c(this,F1),{state:d}=t;let{error:x,errorUpdatedAt:b,fetchStatus:H,status:V}=d,B=!1,g;if(h._optimisticResults){const I=this.hasListeners(),w=!I&&N2(t,h),n1=I&&W2(t,n,h,v);(w||n1)&&(H=M2(t.options.networkMode)?"fetching":"paused",d.dataUpdatedAt||(V="pending")),h._optimisticResults==="isRestoring"&&(H="idle")}if(h.select&&typeof d.data<"u")if(r&&d.data===(i==null?void 0:i.data)&&h.select===c(this,$1))g=c(this,k1);else try{e(this,$1,h.select),g=h.select(d.data),g=V2(r==null?void 0:r.data,g,h),e(this,k1,g),e(this,t1,null)}catch(I){e(this,t1,I)}else g=d.data;if(typeof h.placeholderData<"u"&&typeof g>"u"&&V==="pending"){let I;if(r!=null&&r.isPlaceholderData&&h.placeholderData===(z==null?void 0:z.placeholderData))I=r.data;else if(I=typeof h.placeholderData=="function"?h.placeholderData((F=c(this,E1))==null?void 0:F.state.data,c(this,E1)):h.placeholderData,h.select&&typeof I<"u")try{I=h.select(I),e(this,t1,null)}catch(w){e(this,t1,w)}typeof I<"u"&&(V="success",g=V2(r==null?void 0:r.data,I,h),B=!0)}c(this,t1)&&(x=c(this,t1),g=c(this,k1),b=Date.now(),V="error");const u=H==="fetching",G=V==="pending",f=V==="error",m=G&&u;return{status:V,fetchStatus:H,isPending:G,isSuccess:V==="success",isError:f,isInitialLoading:m,isLoading:m,data:g,dataUpdatedAt:d.dataUpdatedAt,error:x,errorUpdatedAt:b,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>p.dataUpdateCount||d.errorUpdateCount>p.errorUpdateCount,isFetching:u,isRefetching:u&&!G,isLoadingError:f&&d.dataUpdatedAt===0,isPaused:H==="paused",isPlaceholderData:B,isRefetchError:f&&d.dataUpdatedAt!==0,isStale:y2(t,h),refetch:this.refetch}}updateResult(t){const h=c(this,P),n=this.createResult(c(this,L),this.options);if(e(this,f1,c(this,L).state),e(this,D1,this.options),c(this,f1).data!==void 0&&e(this,E1,c(this,L)),o2(n,h))return;e(this,P,n);const v={},r=()=>{if(!h)return!0;const{notifyOnChangeProps:i}=this.options,z=typeof i=="function"?i():i;if(z==="all"||!z&&!c(this,x1).size)return!0;const s=new Set(z??c(this,x1));return this.options.throwOnError&&s.add("error"),Object.keys(c(this,P)).some(p=>{const d=p;return c(this,P)[d]!==h[d]&&s.has(d)})};(t==null?void 0:t.listeners)!==!1&&r()&&(v.listeners=!0),M(this,g2,l0).call(this,{...v,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&M(this,X1,x2).call(this)}},k=new WeakMap,L=new WeakMap,F1=new WeakMap,P=new WeakMap,f1=new WeakMap,D1=new WeakMap,t1=new WeakMap,$1=new WeakMap,k1=new WeakMap,E1=new WeakMap,m1=new WeakMap,L1=new WeakMap,g1=new WeakMap,x1=new WeakMap,w1=new WeakSet,j1=function(t){M(this,h2,I2).call(this);let h=c(this,L).fetch(this.options,t);return t!=null&&t.throwOnError||(h=h.catch(_)),h},J1=new WeakSet,f2=function(){if(M(this,t2,w2).call(this),N1||c(this,P).isStale||!s2(this.options.staleTime))return;const h=a0(c(this,P).dataUpdatedAt,this.options.staleTime)+1;e(this,m1,setTimeout(()=>{c(this,P).isStale||this.updateResult()},h))},Z1=new WeakSet,m2=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(c(this,L)):this.options.refetchInterval)??!1},Y1=new WeakSet,L2=function(t){M(this,a2,B2).call(this),e(this,g1,t),!(N1||this.options.enabled===!1||!s2(c(this,g1))||c(this,g1)===0)&&e(this,L1,setInterval(()=>{(this.options.refetchIntervalInBackground||d2.isFocused())&&M(this,w1,j1).call(this)},c(this,g1)))},X1=new WeakSet,x2=function(){M(this,J1,f2).call(this),M(this,Y1,L2).call(this,M(this,Z1,m2).call(this))},t2=new WeakSet,w2=function(){c(this,m1)&&(clearTimeout(c(this,m1)),e(this,m1,void 0))},a2=new WeakSet,B2=function(){c(this,L1)&&(clearInterval(c(this,L1)),e(this,L1,void 0))},h2=new WeakSet,I2=function(){const t=c(this,k).getQueryCache().build(c(this,k),this.options);if(t===c(this,L))return;const h=c(this,L);e(this,L,t),e(this,F1,t.state),this.hasListeners()&&(h==null||h.removeObserver(this),t.addObserver(this))},g2=new WeakSet,l0=function(t){O.batch(()=>{t.listeners&&this.listeners.forEach(h=>{h(c(this,P))}),c(this,k).getQueryCache().notify({query:c(this,L),type:"observerResultsUpdated"})})},Y2);function D0(a,t){return t.enabled!==!1&&!a.state.dataUpdatedAt&&!(a.state.status==="error"&&t.retryOnMount===!1)}function N2(a,t){return D0(a,t)||a.state.dataUpdatedAt>0&&G2(a,t,t.refetchOnMount)}function G2(a,t,h){if(t.enabled!==!1){const n=typeof h=="function"?h(a):h;return n==="always"||n!==!1&&y2(a,t)}return!1}function W2(a,t,h,n){return h.enabled!==!1&&(a!==t||n.enabled===!1)&&(!h.suspense||a.state.status!=="error")&&y2(a,h)}function y2(a,t){return a.isStaleByTime(t.staleTime)}function k0(a,t){return!o2(a.getCurrentResult(),t)}var M1,D,K,v1,T1,l2,n2,C2,X2,E0=(X2=class extends W1{constructor(t,h){super();o(this,T1);o(this,n2);o(this,M1,void 0);o(this,D,void 0);o(this,K,void 0);o(this,v1,void 0);e(this,D,void 0),e(this,M1,t),this.setOptions(h),this.bindMethods(),M(this,T1,l2).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const h=this.options;this.options=c(this,M1).defaultMutationOptions(t),o2(h,this.options)||c(this,M1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:c(this,K),observer:this}),(n=c(this,K))==null||n.setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=c(this,K))==null||t.removeObserver(this)}onMutationUpdate(t){M(this,T1,l2).call(this),M(this,n2,C2).call(this,t)}getCurrentResult(){return c(this,D)}reset(){e(this,K,void 0),M(this,T1,l2).call(this),M(this,n2,C2).call(this)}mutate(t,h){var n;return e(this,v1,h),(n=c(this,K))==null||n.removeObserver(this),e(this,K,c(this,M1).getMutationCache().build(c(this,M1),this.options)),c(this,K).addObserver(this),c(this,K).execute(t)}},M1=new WeakMap,D=new WeakMap,K=new WeakMap,v1=new WeakMap,T1=new WeakSet,l2=function(){var h;const t=((h=c(this,K))==null?void 0:h.state)??e0();e(this,D,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},n2=new WeakSet,C2=function(t){O.batch(()=>{var h,n,v,r,i,z,s,p;c(this,v1)&&this.hasListeners()&&((t==null?void 0:t.type)==="success"?((n=(h=c(this,v1)).onSuccess)==null||n.call(h,t.data,c(this,D).variables,c(this,D).context),(r=(v=c(this,v1)).onSettled)==null||r.call(v,t.data,null,c(this,D).variables,c(this,D).context)):(t==null?void 0:t.type)==="error"&&((z=(i=c(this,v1)).onError)==null||z.call(i,t.error,c(this,D).variables,c(this,D).context),(p=(s=c(this,v1)).onSettled)==null||p.call(s,void 0,t.error,c(this,D).variables,c(this,D).context))),this.listeners.forEach(d=>{d(c(this,D))})})},X2);var i0=A.createContext(void 0),N=a=>{const t=A.useContext(i0);if(a)return a;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},T0=({client:a,children:t})=>(A.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),A.createElement(i0.Provider,{value:a},t)),o0=A.createContext(!1),N0=()=>A.useContext(o0),C4=o0.Provider;function W0(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var j0=A.createContext(W0()),U0=()=>A.useContext(j0);function d0(a,t){return typeof a=="function"?a(...t):!!a}var Q0=(a,t)=>{(a.suspense||a.throwOnError)&&(t.isReset()||(a.retryOnMount=!1))},K0=a=>{A.useEffect(()=>{a.clearReset()},[a])},q0=({result:a,errorResetBoundary:t,throwOnError:h,query:n})=>a.isError&&!t.isReset()&&!a.isFetching&&d0(h,[a.error,n]);var _0=a=>{a.suspense&&typeof a.staleTime!="number"&&(a.staleTime=1e3)};var $0=(a,t)=>(a==null?void 0:a.suspense)&&t.isPending,J0=(a,t,h)=>t.fetchOptimistic(a).catch(()=>{h.clearReset()});function Z0(a,t,h){if(process.env.NODE_ENV!=="production"&&(typeof a!="object"||Array.isArray(a)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=N(h),v=N0(),r=U0(),i=n.defaultQueryOptions(a);i._optimisticResults=v?"isRestoring":"optimistic",_0(i),Q0(i,r),K0(r);const[z]=A.useState(()=>new t(n,i)),s=z.getOptimisticResult(i);if(A.useSyncExternalStore(A.useCallback(p=>{const d=v?()=>{}:z.subscribe(O.batchCalls(p));return z.updateResult(),d},[z,v]),()=>z.getCurrentResult(),()=>z.getCurrentResult()),A.useEffect(()=>{z.setOptions(i,{listeners:!1})},[i,z]),$0(i,s))throw J0(i,z,r);if(q0({result:s,errorResetBoundary:r,throwOnError:i.throwOnError,query:z.getCurrentQuery()}))throw s.error;return i.notifyOnChangeProps?s:z.trackResult(s)}function c2(a,t){return Z0(a,F0,t)}function J(a,t){const h=N(t),[n]=A.useState(()=>new E0(h,a));A.useEffect(()=>{n.setOptions(a)},[n,a]);const v=A.useSyncExternalStore(A.useCallback(i=>n.subscribe(O.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),r=A.useCallback((i,z)=>{n.mutate(i,z).catch(Y0)},[n]);if(v.error&&d0(n.options.throwOnError,[v.error]))throw v.error;return{...v,mutate:r,mutateAsync:v.mutate}}function Y0(){}function R(){return N().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const H1=()=>{const{data:a,refetch:t}=c2({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[a,h=>{h&&(localStorage.setItem("currentPage",h||""),t())}]};let j2="";const v2=()=>(j2=localStorage.getItem("__chai_at"),j2);function X0(a){const t={method:"GET",headers:{"x-chai-access-token":v2()}};return fetch(a,t)}function t4(a,t){const h={method:"POST",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function a4(a,t){const h={method:"PUT",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function h4(a,t){const h={method:"DELETE",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}const W={get:X0,post:t4,put:a4,delete:h4},b2=()=>{const[a,t]=H1(),h=R();return c2({queryKey:["project"],queryFn:async()=>{const{data:n}=await W.get(`${h}/project`).then(v=>v.json());if(!a&&n){const v=localStorage.getItem("currentPage");t(v||(n==null?void 0:n.homepage))}return n}})},P2=()=>{const a=R();return c2({queryKey:["pages"],queryFn:async()=>{const{data:t}=await W.get(`${a}/pages`).then(h=>h.json());return t||[]}})},z0=()=>{const[a]=H1(),t=R();return c2({queryKey:["page_data",a],queryFn:async()=>{const{data:h}=await W.get(`${t}/page?uuid=${a}`).then(n=>n.json());return h},enabled:!!a,staleTime:3e3})},O2=()=>l.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:l.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[l.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),l.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),g0=(a="Project updated successfully.")=>{const t=N(),h=R();return J({mutationFn:async n=>await W.put(`${h}/project`,n).then(v=>v.json()),onSuccess:()=>{t.invalidateQueries({queryKey:["project"]}),a1.toast.success(a)}})},M0=()=>{const[a]=["SAVED"],[t,h]=H1(),n=q.useBuilderReset(),{t:v}=p0.useTranslation();return r=>a!=="SAVED"?(a1.toast.error(v("You have unsaved changes. Please save before changing the page.")),!1):t===r.uuid?!1:(n(),setTimeout(()=>h(r.uuid),100),!0)},n4=()=>{const a=N(),t=M0(),h=R();return J({mutationFn:async n=>W.post(`${h}/pages`,n).then(v=>v.json()),onSuccess:n=>{a.invalidateQueries({queryKey:["pages"]}),t({uuid:n.uuid,slug:n.slug}),a1.toast.success("Page added successfully.")}})},H0=()=>{const a=R(),[t]=H1(),h=N();return J({mutationFn:async n=>W.put(`${a}/page`,n).then(v=>v.json()),onSuccess:async n=>{var v;if(n.result==="error"&&((v=n.error)==null?void 0:v.code)=="PAGE_LOCKED"){h.invalidateQueries({queryKey:["page_data",t]});return}a1.toast.success("Page saved successfully.")}})},c4=()=>{const a=R(),{data:t}=P2(),[h]=H1(),{data:n}=b2(),v=N();return J({mutationFn:async()=>{const r=t.find(i=>i.uuid===h).slug;return await W.post(`${a}/publish`,{slug:r,uuid:h,isHomepage:(n==null?void 0:n.homepage)===h}).then(i=>i.json())},onSuccess:async r=>{var i;if(r.result==="error"&&((i=r.error)==null?void 0:i.code)=="PAGE_LOCKED"){v.invalidateQueries({queryKey:["page_data",h]});return}a1.toast.success("Page published successfully.",{position:"bottom-right",duration:2e3})}})},v4=()=>{const a=N(),t=R();return J({mutationFn:async h=>W.delete(`${t}/page`,h).then(n=>n.json()),onSuccess:()=>{a1.toast.success("Page deleted successfully."),a.invalidateQueries({queryKey:["pages"]})}})},r4=()=>{const a=N(),t=R();return J({mutationFn:async h=>W.post(`${t}/take-control`,{uuid:h}).then(n=>n.json()),onSuccess:(h,n)=>{a.invalidateQueries({queryKey:["page_data",n]})}})},e4=()=>{const a=R();return J({mutationFn:async()=>{const{data:t}=await W.get(`${a}/library`).then(h=>h.json());return h1.sortBy(h1.filter(t,h=>!h1.has(h,"hidden")),"group")}})},l4=()=>{const a=R();return J({mutationFn:async t=>{if(!t||!t.uuid)return[];try{const{data:h}=await W.get(`${a}/block?uuid=${t.uuid}&format=${t.format}`).then(async n=>t.format==="html"?V0.getBlocksFromHTML(await n.text()):await n.json());return h1.set(h,"0._name",h1.capitalize(t.group)),h||[]}catch{return[]}}})},i4=()=>{const a=R();return J({mutationFn:async t=>{const h=new FormData;h.append("file",t);const{data:n}=await fetch(`${a}/upload`,{method:"POST",headers:{"x-chai-access-token":v2()},body:h}).then(v=>v.json());return n}})};function u0(a){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"}}]})(a)}function o4(a){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}}]})(a)}const d4=()=>{const{mutate:a,isPending:t}=r4(),[h]=H1(),{data:n}=z0(),v=h1.get(n,"lockedBy.name",""),r=h1.get(n,"lockedBy.email","");return l.jsxRuntimeExports.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg drop-shadow-2xl mx-auto p-10 space-y-4 text-center max-w-xl",children:[l.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),l.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",l.jsxRuntimeExports.jsx("br",{}),l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[l.jsxRuntimeExports.jsx(o4,{className:"w-4 h-4 text-gray-500"})," ",v]}),l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[l.jsxRuntimeExports.jsx(u0,{className:"w-4 h-4 text-gray-500"})," ",r]})]}),l.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",v," will be ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),l.jsxRuntimeExports.jsx(q.Button,{disabled:t,onClick:()=>a(h),className:`w-36 ${t?"bg-transparent shadow-none hover:bg-transparent":""}`,children:t?l.jsxRuntimeExports.jsx(S2.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},z4=()=>{const a=R(),t=N();return J({mutationFn:async h=>{const n=await fetch(`${a}/login`,{method:"POST",body:JSON.stringify(h)});if(n.ok)return await n.json();throw n.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:h=>{const{data:n}=h;if(!n.accessToken){a1.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",n.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(h1.omit(n,["accessToken"]))),t.invalidateQueries({queryKey:["verify"]}),a1.toast.success("Logged in successfully.")},onError:()=>{a1.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},g4=()=>{const a=R();return c2({queryKey:["verify"],queryFn:async()=>{const t=await W.get(`${a}/verify`);return t.ok?(await t.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},M4=()=>{const a=R(),t=N();return J({mutationFn:async()=>{const{result:h}=await W.post(`${a}/logout`).then(n=>n.json());if(h==="success")return localStorage.clear(),t.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},H4=({children:a})=>{const t=M4();return l.jsxRuntimeExports.jsxs(q.AlertDialog,{children:[l.jsxRuntimeExports.jsx(q.AlertDialogTrigger,{asChild:!0,children:a}),l.jsxRuntimeExports.jsxs(q.AlertDialogContent,{children:[l.jsxRuntimeExports.jsxs(q.AlertDialogHeader,{children:[l.jsxRuntimeExports.jsxs(q.AlertDialogTitle,{children:["Are you sure, you want to ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),l.jsxRuntimeExports.jsx(q.AlertDialogDescription,{children:"Kindly ensure that all your data is saved before proceeding with the sign-out process to prevent any potential loss of unsaved information"})]}),l.jsxRuntimeExports.jsxs(q.AlertDialogFooter,{children:[l.jsxRuntimeExports.jsx(q.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),l.jsxRuntimeExports.jsxs("button",{disabled:t.isPending,onClick:()=>t.mutate(),className:"rounded-md text-white w-28 text-center justify-center bg-red-600 hover:bg-red-700 flex items-center gap-x-2",children:[t.isPending&&l.jsxRuntimeExports.jsx(S2.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},u4=()=>l.jsxRuntimeExports.jsx(H4,{children:l.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:l.jsxRuntimeExports.jsx(S2.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),s4=T.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-WzCocl6u.cjs"))),p4=T.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-o7gdcwPn.cjs"))),V4=T.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-Hl52iub_.cjs"))),f4=()=>l.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),m4=()=>{const{mutate:a}=c4();return q.useBuilderProp("editable",!0)?l.jsxRuntimeExports.jsx(q.Button,{onClick:a,className:"bg-blue-600 text-white",children:"Publish"}):null},L4=a=>{var f;const{data:t,isLoading:h}=b2(),{data:n,isLoading:v}=P2(),{data:r}=z0(),{mutate:i}=g0(),{mutate:z}=H0(),[s]=H1(),p=i4(),d=e4(),x=l4(),b=R(),H=T.useCallback(async m=>await p.mutateAsync(m),[p]),V=T.useCallback(async()=>await d.mutateAsync(),[d]),B=T.useCallback(async m=>await x.mutateAsync(m),[x]),g=async(m=20,y=0)=>{const F=`limit=${m}&offset=${y}`,I=await fetch(`${b}/assets?${F}`).then(w=>w.json());return I.result==="success"?I.data:[]},{logo:u=f4}=a;if(h||!t)return l.jsxRuntimeExports.jsx(O2,{});if(v||!n)return l.jsxRuntimeExports.jsx(O2,{});const G={...a,editable:r!=null&&r.lockedBy?r==null?void 0:r.lockedBy.self:!0,nonEditableComponent:d4,blocks:(r==null?void 0:r.blocks)||[],brandingOptions:t.brandingOptions,darkMode:a.darkMode||!1,dataProviders:(r==null?void 0:r.providers)||[],onSavePage:async({blocks:m,providers:y})=>(await z({blocks:m,providers:y,uuid:s}),!0),onSaveBrandingOptions:async m=>(await i({brandingOptions:m}),!0),topBarComponents:{left:[u],center:[V4],right:[m4]},sideBarComponents:{top:[{icon:i2.FileTextIcon,name:"pages",panel:s4},{icon:i2.GearIcon,name:"settings",panel:p4},...((f=a.sideBarComponents)==null?void 0:f.top)||[]],bottom:[u4]},uploadMediaCallback:H,fetchMediaCallback:g,getUILibraryBlocks:V,getExternalPredefinedBlock:B,getPages:()=>n};return l.jsxRuntimeExports.jsx(s0.ChaiBuilderEditor,{...G})},x4=({logo:a})=>{const[t,h]=T.useState(!1),[n,v]=T.useState(""),[r,i]=T.useState(""),{mutate:z,isPending:s}=z4(),p=d=>{d.preventDefault(),z({email:n,password:r})};return l.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen flex items-center justify-center bg-[radial-gradient(#AAA,transparent_0.5px)] duration-300 [background-size:6px_6px]",children:l.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:l.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[l.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[l.jsxRuntimeExports.jsx(T.Suspense,{children:a?T.createElement(a):""}),l.jsxRuntimeExports.jsx("p",{className:"max-w-xl mx-auto text-base leading-relaxed text-gray-700 font-thin",children:"Enter your login credential to continue"})]}),l.jsxRuntimeExports.jsx("div",{className:"mt-8",children:l.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:p,className:"space-y-5",children:[l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[l.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:l.jsxRuntimeExports.jsx(u0,{})}),l.jsxRuntimeExports.jsx("input",{value:n,onChange:d=>v(d.target.value),type:"email",id:"email",placeholder:"Enter email",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"})]})}),l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[l.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:l.jsxRuntimeExports.jsx("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 11c0 3.517-1.009 6.799-2.753 9.571m-3.44-2.04l.054-.09A13.916 13.916 0 008 11a4 4 0 118 0c0 1.017-.07 2.019-.203 3m-2.118 6.844A21.88 21.88 0 0015.171 17m3.839 1.132c.645-2.266.99-4.659.99-7.132A8 8 0 008 4.07M3 15.364c.64-1.319 1-2.8 1-4.364 0-1.457.39-2.823 1.07-4"})})}),l.jsxRuntimeExports.jsx("input",{value:r,onChange:d=>i(d.target.value),type:t?"text":"password",id:"pwd",placeholder:"Enter password",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"}),l.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>h(!t),children:t?l.jsxRuntimeExports.jsx(i2.EyeClosedIcon,{}):l.jsxRuntimeExports.jsx(i2.EyeOpenIcon,{})})]})}),l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsx("button",{disabled:s||h1.size(n)<2||h1.size(r)<2,type:"submit",className:"inline-flex disabled:bg-gray-400 items-center justify-center w-full px-4 py-4 text-base font-semibold text-white transition-all duration-200 bg-blue-600 border border-transparent rounded-md focus:outline-none hover:bg-blue-700 focus:bg-blue-700",children:s?"Signing in...":"Login"})})]})}),l.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:l.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},w4=a=>{const{data:t,isLoading:h}=g4(),n=N();return T.useEffect(()=>{n.setQueryData(["apiBaseUrl"],a.apiBaseUrl||"/api/chaibuilder")},[a.apiBaseUrl,n]),h?l.jsxRuntimeExports.jsx(O2,{}):t!=null&&t.valid?l.jsxRuntimeExports.jsx(L4,{...a}):l.jsxRuntimeExports.jsx(x4,{logo:a.logo})},B4=new R0,I4=a=>l.jsxRuntimeExports.jsxs(T0,{client:B4,children:[l.jsxRuntimeExports.jsx(a1.Toaster,{richColors:!0}),l.jsxRuntimeExports.jsx(w4,{...a})]});exports.ChaiBuilderStudio=I4;exports.useAddPage=n4;exports.useChangePage=M0;exports.useCurrentPage=H1;exports.useDeletePage=v4;exports.usePages=P2;exports.useProject=b2;exports.useQueryClient=N;exports.useUpdatePage=H0;exports.useUpdateProject=g0;
|
|
1
|
+
"use strict";var H2=(a,t,h)=>{if(!t.has(a))throw TypeError("Cannot "+h)};var c=(a,t,h)=>(H2(a,t,"read from private field"),h?h.call(a):t.get(a)),o=(a,t,h)=>{if(t.has(a))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(a):t.set(a,h)},e=(a,t,h,n)=>(H2(a,t,"write to private field"),n?n.call(a,h):t.set(a,h),h);var r2=(a,t,h,n)=>({set _(v){e(a,t,v,h)},get _(){return c(a,t,n)}}),M=(a,t,h)=>(H2(a,t,"access private method"),h);const l=require("./jsx-runtime-Z_BpKhVy.cjs"),T=require("react"),s0=require("./index-mlMvwv2b.cjs"),i2=require("@radix-ui/react-icons"),q=require("./index-12HbDLon.cjs"),a1=require("sonner"),p0=require("react-i18next"),h1=require("lodash-es"),V0=require("./html-to-json-vP1ESB_e.cjs"),S2=require("lucide-react"),t0=require("./index-ecnGWzh9.cjs");function f0(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const h in a)if(h!=="default"){const n=Object.getOwnPropertyDescriptor(a,h);Object.defineProperty(t,h,n.get?n:{enumerable:!0,get:()=>a[h]})}}return t.default=a,Object.freeze(t)}const A=f0(T);var W1=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N1=typeof window>"u"||"Deno"in window;function _(){}function m0(a,t){return typeof a=="function"?a(t):a}function s2(a){return typeof a=="number"&&a>=0&&a!==1/0}function a0(a,t){return Math.max(a+(t||0)-Date.now(),0)}function R2(a,t){const{type:h="all",exact:n,fetchStatus:v,predicate:r,queryKey:i,stale:z}=a;if(i){if(n){if(t.queryHash!==A2(i,t.options))return!1}else if(!Q1(t.queryKey,i))return!1}if(h!=="all"){const s=t.isActive();if(h==="active"&&!s||h==="inactive"&&s)return!1}return!(typeof z=="boolean"&&t.isStale()!==z||typeof v<"u"&&v!==t.state.fetchStatus||r&&!r(t))}function F2(a,t){const{exact:h,status:n,predicate:v,mutationKey:r}=a;if(r){if(!t.options.mutationKey)return!1;if(h){if(U1(t.options.mutationKey)!==U1(r))return!1}else if(!Q1(t.options.mutationKey,r))return!1}return!(n&&t.state.status!==n||v&&!v(t))}function A2(a,t){return((t==null?void 0:t.queryKeyHashFn)||U1)(a)}function U1(a){return JSON.stringify(a,(t,h)=>p2(h)?Object.keys(h).sort().reduce((n,v)=>(n[v]=h[v],n),{}):h)}function Q1(a,t){return a===t?!0:typeof a!=typeof t?!1:a&&t&&typeof a=="object"&&typeof t=="object"?!Object.keys(t).some(h=>!Q1(a[h],t[h])):!1}function h0(a,t){if(a===t)return a;const h=D2(a)&&D2(t);if(h||p2(a)&&p2(t)){const n=h?a.length:Object.keys(a).length,v=h?t:Object.keys(t),r=v.length,i=h?[]:{};let z=0;for(let s=0;s<r;s++){const p=h?s:v[s];i[p]=h0(a[p],t[p]),i[p]===a[p]&&z++}return n===r&&z===n?a:i}return t}function o2(a,t){if(a&&!t||t&&!a)return!1;for(const h in a)if(a[h]!==t[h])return!1;return!0}function D2(a){return Array.isArray(a)&&a.length===Object.keys(a).length}function p2(a){if(!k2(a))return!1;const t=a.constructor;if(typeof t>"u")return!0;const h=t.prototype;return!(!k2(h)||!h.hasOwnProperty("isPrototypeOf"))}function k2(a){return Object.prototype.toString.call(a)==="[object Object]"}function n0(a){return new Promise(t=>{setTimeout(t,a)})}function E2(a){n0(0).then(a)}function V2(a,t,h){return typeof h.structuralSharing=="function"?h.structuralSharing(a,t):h.structuralSharing!==!1?h0(a,t):t}function L0(a,t,h=0){const n=[...a,t];return h&&n.length>h?n.slice(1):n}function x0(a,t,h=0){const n=[t,...a];return h&&n.length>h?n.slice(0,-1):n}var u1,e1,B1,U2,w0=(U2=class extends W1{constructor(){super();o(this,u1,void 0);o(this,e1,void 0);o(this,B1,void 0);e(this,B1,t=>{if(!N1&&window.addEventListener){const h=()=>t();return window.addEventListener("visibilitychange",h,!1),()=>{window.removeEventListener("visibilitychange",h)}}})}onSubscribe(){c(this,e1)||this.setEventListener(c(this,B1))}onUnsubscribe(){var t;this.hasListeners()||((t=c(this,e1))==null||t.call(this),e(this,e1,void 0))}setEventListener(t){var h;e(this,B1,t),(h=c(this,e1))==null||h.call(this),e(this,e1,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){c(this,u1)!==t&&(e(this,u1,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof c(this,u1)=="boolean"?c(this,u1):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},u1=new WeakMap,e1=new WeakMap,B1=new WeakMap,U2),d2=new w0,I1,l1,G1,Q2,B0=(Q2=class extends W1{constructor(){super();o(this,I1,!0);o(this,l1,void 0);o(this,G1,void 0);e(this,G1,t=>{if(!N1&&window.addEventListener){const h=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",h,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",h),window.removeEventListener("offline",n)}}})}onSubscribe(){c(this,l1)||this.setEventListener(c(this,G1))}onUnsubscribe(){var t;this.hasListeners()||((t=c(this,l1))==null||t.call(this),e(this,l1,void 0))}setEventListener(t){var h;e(this,G1,t),(h=c(this,l1))==null||h.call(this),e(this,l1,t(this.setOnline.bind(this)))}setOnline(t){c(this,I1)!==t&&(e(this,I1,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return c(this,I1)}},I1=new WeakMap,l1=new WeakMap,G1=new WeakMap,Q2),z2=new B0;function I0(a){return Math.min(1e3*2**a,3e4)}function M2(a){return(a??"online")==="online"?z2.isOnline():!0}var c0=class{constructor(a){this.revert=a==null?void 0:a.revert,this.silent=a==null?void 0:a.silent}};function u2(a){return a instanceof c0}function v0(a){let t=!1,h=0,n=!1,v,r,i;const z=new Promise((g,u)=>{r=g,i=u}),s=g=>{var u;n||(H(new c0(g)),(u=a.abort)==null||u.call(a))},p=()=>{t=!0},d=()=>{t=!1},x=()=>!d2.isFocused()||a.networkMode!=="always"&&!z2.isOnline(),b=g=>{var u;n||(n=!0,(u=a.onSuccess)==null||u.call(a,g),v==null||v(),r(g))},H=g=>{var u;n||(n=!0,(u=a.onError)==null||u.call(a,g),v==null||v(),i(g))},V=()=>new Promise(g=>{var u;v=G=>{const f=n||!x();return f&&g(G),f},(u=a.onPause)==null||u.call(a)}).then(()=>{var g;v=void 0,n||(g=a.onContinue)==null||g.call(a)}),B=()=>{if(n)return;let g;try{g=a.fn()}catch(u){g=Promise.reject(u)}Promise.resolve(g).then(b).catch(u=>{var F;if(n)return;const G=a.retry??(N1?0:3),f=a.retryDelay??I0,m=typeof f=="function"?f(h,u):f,y=G===!0||typeof G=="number"&&h<G||typeof G=="function"&&G(h,u);if(t||!y){H(u);return}h++,(F=a.onFail)==null||F.call(a,h,u),n0(m).then(()=>{if(x())return V()}).then(()=>{t?H(u):B()})})};return M2(a.networkMode)?B():V().then(B),{promise:z,cancel:s,continue:()=>(v==null?void 0:v())?z:Promise.resolve(),cancelRetry:p,continueRetry:d}}function G0(){let a=[],t=0,h=d=>{d()},n=d=>{d()};const v=d=>{let x;t++;try{x=d()}finally{t--,t||z()}return x},r=d=>{t?a.push(d):E2(()=>{h(d)})},i=d=>(...x)=>{r(()=>{d(...x)})},z=()=>{const d=a;a=[],d.length&&E2(()=>{n(()=>{d.forEach(x=>{h(x)})})})};return{batch:v,batchCalls:i,schedule:r,setNotifyFunction:d=>{h=d},setBatchNotifyFunction:d=>{n=d}}}var O=G0(),s1,K2,r0=(K2=class{constructor(){o(this,s1,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),s2(this.gcTime)&&e(this,s1,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(a){this.gcTime=Math.max(this.gcTime||0,a??(N1?1/0:5*60*1e3))}clearGcTimeout(){c(this,s1)&&(clearTimeout(c(this,s1)),e(this,s1,void 0))}},s1=new WeakMap,K2),C1,O1,j,i1,U,S,K1,p1,S1,e2,$,c1,q2,C0=(q2=class extends r0{constructor(t){super();o(this,S1);o(this,$);o(this,C1,void 0);o(this,O1,void 0);o(this,j,void 0);o(this,i1,void 0);o(this,U,void 0);o(this,S,void 0);o(this,K1,void 0);o(this,p1,void 0);e(this,p1,!1),e(this,K1,t.defaultOptions),M(this,S1,e2).call(this,t.options),e(this,S,[]),e(this,j,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,e(this,C1,t.state||O0(this.options)),this.state=c(this,C1),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!c(this,S).length&&this.state.fetchStatus==="idle"&&c(this,j).remove(this)}setData(t,h){const n=V2(this.state.data,t,this.options);return M(this,$,c1).call(this,{data:n,type:"success",dataUpdatedAt:h==null?void 0:h.updatedAt,manual:h==null?void 0:h.manual}),n}setState(t,h){M(this,$,c1).call(this,{type:"setState",state:t,setStateOptions:h})}cancel(t){var n;const h=c(this,i1);return(n=c(this,U))==null||n.cancel(t),h?h.then(_).catch(_):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(c(this,C1))}isActive(){return c(this,S).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||c(this,S).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!a0(this.state.dataUpdatedAt,t)}onFocus(){var h;const t=c(this,S).find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,U))==null||h.continue()}onOnline(){var h;const t=c(this,S).find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(h=c(this,U))==null||h.continue()}addObserver(t){c(this,S).includes(t)||(c(this,S).push(t),this.clearGcTimeout(),c(this,j).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){c(this,S).includes(t)&&(e(this,S,c(this,S).filter(h=>h!==t)),c(this,S).length||(c(this,U)&&(c(this,p1)?c(this,U).cancel({revert:!0}):c(this,U).cancelRetry()),this.scheduleGc()),c(this,j).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return c(this,S).length}invalidate(){this.state.isInvalidated||M(this,$,c1).call(this,{type:"invalidate"})}fetch(t,h){var p,d,x,b;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(h!=null&&h.cancelRefetch))this.cancel({silent:!0});else if(c(this,i1))return(p=c(this,U))==null||p.continueRetry(),c(this,i1)}if(t&&M(this,S1,e2).call(this,t),!this.options.queryFn){const H=c(this,S).find(V=>V.options.queryFn);H&&M(this,S1,e2).call(this,H.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,v={queryKey:this.queryKey,meta:this.meta},r=H=>{Object.defineProperty(H,"signal",{enumerable:!0,get:()=>(e(this,p1,!0),n.signal)})};r(v);const i=()=>this.options.queryFn?(e(this,p1,!1),this.options.persister?this.options.persister(this.options.queryFn,v,this):this.options.queryFn(v)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),z={fetchOptions:h,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};r(z),(d=this.options.behavior)==null||d.onFetch(z,this),e(this,O1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=z.fetchOptions)==null?void 0:x.meta))&&M(this,$,c1).call(this,{type:"fetch",meta:(b=z.fetchOptions)==null?void 0:b.meta});const s=H=>{var V,B,g,u;u2(H)&&H.silent||M(this,$,c1).call(this,{type:"error",error:H}),u2(H)||((B=(V=c(this,j).config).onError)==null||B.call(V,H,this),(u=(g=c(this,j).config).onSettled)==null||u.call(g,this.state.data,H,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return e(this,U,v0({fn:z.fetchFn,abort:n.abort.bind(n),onSuccess:H=>{var V,B,g,u;if(typeof H>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),s(new Error(`${this.queryHash} data is undefined`));return}this.setData(H),(B=(V=c(this,j).config).onSuccess)==null||B.call(V,H,this),(u=(g=c(this,j).config).onSettled)==null||u.call(g,H,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:s,onFail:(H,V)=>{M(this,$,c1).call(this,{type:"failed",failureCount:H,error:V})},onPause:()=>{M(this,$,c1).call(this,{type:"pause"})},onContinue:()=>{M(this,$,c1).call(this,{type:"continue"})},retry:z.options.retry,retryDelay:z.options.retryDelay,networkMode:z.options.networkMode})),e(this,i1,c(this,U).promise),c(this,i1)}},C1=new WeakMap,O1=new WeakMap,j=new WeakMap,i1=new WeakMap,U=new WeakMap,S=new WeakMap,K1=new WeakMap,p1=new WeakMap,S1=new WeakSet,e2=function(t){this.options={...c(this,K1),...t},this.updateGcTime(this.options.gcTime)},$=new WeakSet,c1=function(t){const h=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:M2(this.options.networkMode)?"fetching":"paused",...!n.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...n,data:t.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const v=t.error;return u2(v)&&v.revert&&c(this,O1)?{...c(this,O1),fetchStatus:"idle"}:{...n,error:v,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:v,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=h(this.state),O.batch(()=>{c(this,S).forEach(n=>{n.onQueryUpdate()}),c(this,j).notify({query:this,type:"updated",action:t})})},q2);function O0(a){const t=typeof a.initialData=="function"?a.initialData():a.initialData,h=typeof t<"u",n=h?typeof a.initialDataUpdatedAt=="function"?a.initialDataUpdatedAt():a.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:h?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:h?"success":"pending",fetchStatus:"idle"}}var Z,_2,S0=(_2=class extends W1{constructor(t={}){super();o(this,Z,void 0);this.config=t,e(this,Z,new Map)}build(t,h,n){const v=h.queryKey,r=h.queryHash??A2(v,h);let i=this.get(r);return i||(i=new C0({cache:this,queryKey:v,queryHash:r,options:t.defaultQueryOptions(h),state:n,defaultOptions:t.getQueryDefaults(v)}),this.add(i)),i}add(t){c(this,Z).has(t.queryHash)||(c(this,Z).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const h=c(this,Z).get(t.queryHash);h&&(t.destroy(),h===t&&c(this,Z).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){O.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return c(this,Z).get(t)}getAll(){return[...c(this,Z).values()]}find(t){const h={exact:!0,...t};return this.getAll().find(n=>R2(h,n))}findAll(t={}){const h=this.getAll();return Object.keys(t).length>0?h.filter(n=>R2(t,n)):h}notify(t){O.batch(()=>{this.listeners.forEach(h=>{h(t)})})}onFocus(){O.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Z=new WeakMap,_2),Y,q1,E,A1,X,r1,$2,A0=($2=class extends r0{constructor(t){super();o(this,X);o(this,Y,void 0);o(this,q1,void 0);o(this,E,void 0);o(this,A1,void 0);this.mutationId=t.mutationId,e(this,q1,t.defaultOptions),e(this,E,t.mutationCache),e(this,Y,[]),this.state=t.state||e0(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...c(this,q1),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){c(this,Y).includes(t)||(c(this,Y).push(t),this.clearGcTimeout(),c(this,E).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){e(this,Y,c(this,Y).filter(h=>h!==t)),this.scheduleGc(),c(this,E).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){c(this,Y).length||(this.state.status==="pending"?this.scheduleGc():c(this,E).remove(this))}continue(){var t;return((t=c(this,A1))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var v,r,i,z,s,p,d,x,b,H,V,B,g,u,G,f,m,y,F,I;const h=()=>(e(this,A1,v0({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(w,n1)=>{M(this,X,r1).call(this,{type:"failed",failureCount:w,error:n1})},onPause:()=>{M(this,X,r1).call(this,{type:"pause"})},onContinue:()=>{M(this,X,r1).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),c(this,A1).promise),n=this.state.status==="pending";try{if(!n){M(this,X,r1).call(this,{type:"pending",variables:t}),await((r=(v=c(this,E).config).onMutate)==null?void 0:r.call(v,t,this));const n1=await((z=(i=this.options).onMutate)==null?void 0:z.call(i,t));n1!==this.state.context&&M(this,X,r1).call(this,{type:"pending",context:n1,variables:t})}const w=await h();return await((p=(s=c(this,E).config).onSuccess)==null?void 0:p.call(s,w,t,this.state.context,this)),await((x=(d=this.options).onSuccess)==null?void 0:x.call(d,w,t,this.state.context)),await((H=(b=c(this,E).config).onSettled)==null?void 0:H.call(b,w,null,this.state.variables,this.state.context,this)),await((B=(V=this.options).onSettled)==null?void 0:B.call(V,w,null,t,this.state.context)),M(this,X,r1).call(this,{type:"success",data:w}),w}catch(w){try{throw await((u=(g=c(this,E).config).onError)==null?void 0:u.call(g,w,t,this.state.context,this)),await((f=(G=this.options).onError)==null?void 0:f.call(G,w,t,this.state.context)),await((y=(m=c(this,E).config).onSettled)==null?void 0:y.call(m,void 0,w,this.state.variables,this.state.context,this)),await((I=(F=this.options).onSettled)==null?void 0:I.call(F,void 0,w,t,this.state.context)),w}finally{M(this,X,r1).call(this,{type:"error",error:w})}}}},Y=new WeakMap,q1=new WeakMap,E=new WeakMap,A1=new WeakMap,X=new WeakSet,r1=function(t){const h=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!M2(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=h(this.state),O.batch(()=>{c(this,Y).forEach(n=>{n.onMutationUpdate(t)}),c(this,E).notify({mutation:this,type:"updated",action:t})})},$2);function e0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Q,_1,V1,J2,y0=(J2=class extends W1{constructor(t={}){super();o(this,Q,void 0);o(this,_1,void 0);o(this,V1,void 0);this.config=t,e(this,Q,[]),e(this,_1,0)}build(t,h,n){const v=new A0({mutationCache:this,mutationId:++r2(this,_1)._,options:t.defaultMutationOptions(h),state:n});return this.add(v),v}add(t){c(this,Q).push(t),this.notify({type:"added",mutation:t})}remove(t){e(this,Q,c(this,Q).filter(h=>h!==t)),this.notify({type:"removed",mutation:t})}clear(){O.batch(()=>{c(this,Q).forEach(t=>{this.remove(t)})})}getAll(){return c(this,Q)}find(t){const h={exact:!0,...t};return c(this,Q).find(n=>F2(h,n))}findAll(t={}){return c(this,Q).filter(h=>F2(t,h))}notify(t){O.batch(()=>{this.listeners.forEach(h=>{h(t)})})}resumePausedMutations(){return e(this,V1,(c(this,V1)??Promise.resolve()).then(()=>{const t=c(this,Q).filter(h=>h.state.isPaused);return O.batch(()=>t.reduce((h,n)=>h.then(()=>n.continue().catch(_)),Promise.resolve()))}).then(()=>{e(this,V1,void 0)})),c(this,V1)}},Q=new WeakMap,_1=new WeakMap,V1=new WeakMap,J2);function b0(a){return{onFetch:(t,h)=>{const n=async()=>{var V,B,g,u,G;const v=t.options,r=(g=(B=(V=t.fetchOptions)==null?void 0:V.meta)==null?void 0:B.fetchMore)==null?void 0:g.direction,i=((u=t.state.data)==null?void 0:u.pages)||[],z=((G=t.state.data)==null?void 0:G.pageParams)||[],s={pages:[],pageParams:[]};let p=!1;const d=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)})},x=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),b=async(f,m,y)=>{if(p)return Promise.reject();if(m==null&&f.pages.length)return Promise.resolve(f);const F={queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};d(F);const I=await x(F),{maxPages:w}=t.options,n1=y?x0:L0;return{pages:n1(f.pages,I,w),pageParams:n1(f.pageParams,m,w)}};let H;if(r&&i.length){const f=r==="backward",m=f?P0:T2,y={pages:i,pageParams:z},F=m(v,y);H=await b(y,F,f)}else{H=await b(s,z[0]??v.initialPageParam);const f=a??i.length;for(let m=1;m<f;m++){const y=T2(v,H);H=await b(H,y)}}return H};t.options.persister?t.fetchFn=()=>{var v,r;return(r=(v=t.options).persister)==null?void 0:r.call(v,n,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},h)}:t.fetchFn=n}}}function T2(a,{pages:t,pageParams:h}){const n=t.length-1;return a.getNextPageParam(t[n],t,h[n],h)}function P0(a,{pages:t,pageParams:h}){var n;return(n=a.getPreviousPageParam)==null?void 0:n.call(a,t[0],t,h[0],h)}var C,o1,d1,y1,b1,z1,P1,R1,Z2,R0=(Z2=class{constructor(a={}){o(this,C,void 0);o(this,o1,void 0);o(this,d1,void 0);o(this,y1,void 0);o(this,b1,void 0);o(this,z1,void 0);o(this,P1,void 0);o(this,R1,void 0);e(this,C,a.queryCache||new S0),e(this,o1,a.mutationCache||new y0),e(this,d1,a.defaultOptions||{}),e(this,y1,new Map),e(this,b1,new Map),e(this,z1,0)}mount(){r2(this,z1)._++,c(this,z1)===1&&(e(this,P1,d2.subscribe(()=>{d2.isFocused()&&(this.resumePausedMutations(),c(this,C).onFocus())})),e(this,R1,z2.subscribe(()=>{z2.isOnline()&&(this.resumePausedMutations(),c(this,C).onOnline())})))}unmount(){var a,t;r2(this,z1)._--,c(this,z1)===0&&((a=c(this,P1))==null||a.call(this),e(this,P1,void 0),(t=c(this,R1))==null||t.call(this),e(this,R1,void 0))}isFetching(a){return c(this,C).findAll({...a,fetchStatus:"fetching"}).length}isMutating(a){return c(this,o1).findAll({...a,status:"pending"}).length}getQueryData(a){var t;return(t=c(this,C).find({queryKey:a}))==null?void 0:t.state.data}ensureQueryData(a){const t=this.getQueryData(a.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(a)}getQueriesData(a){return this.getQueryCache().findAll(a).map(({queryKey:t,state:h})=>{const n=h.data;return[t,n]})}setQueryData(a,t,h){const n=c(this,C).find({queryKey:a}),v=n==null?void 0:n.state.data,r=m0(t,v);if(typeof r>"u")return;const i=this.defaultQueryOptions({queryKey:a});return c(this,C).build(this,i).setData(r,{...h,manual:!0})}setQueriesData(a,t,h){return O.batch(()=>this.getQueryCache().findAll(a).map(({queryKey:n})=>[n,this.setQueryData(n,t,h)]))}getQueryState(a){var t;return(t=c(this,C).find({queryKey:a}))==null?void 0:t.state}removeQueries(a){const t=c(this,C);O.batch(()=>{t.findAll(a).forEach(h=>{t.remove(h)})})}resetQueries(a,t){const h=c(this,C),n={type:"active",...a};return O.batch(()=>(h.findAll(a).forEach(v=>{v.reset()}),this.refetchQueries(n,t)))}cancelQueries(a={},t={}){const h={revert:!0,...t},n=O.batch(()=>c(this,C).findAll(a).map(v=>v.cancel(h)));return Promise.all(n).then(_).catch(_)}invalidateQueries(a={},t={}){return O.batch(()=>{if(c(this,C).findAll(a).forEach(n=>{n.invalidate()}),a.refetchType==="none")return Promise.resolve();const h={...a,type:a.refetchType??a.type??"active"};return this.refetchQueries(h,t)})}refetchQueries(a={},t){const h={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},n=O.batch(()=>c(this,C).findAll(a).filter(v=>!v.isDisabled()).map(v=>{let r=v.fetch(void 0,h);return h.throwOnError||(r=r.catch(_)),v.state.fetchStatus==="paused"?Promise.resolve():r}));return Promise.all(n).then(_)}fetchQuery(a){const t=this.defaultQueryOptions(a);typeof t.retry>"u"&&(t.retry=!1);const h=c(this,C).build(this,t);return h.isStaleByTime(t.staleTime)?h.fetch(t):Promise.resolve(h.state.data)}prefetchQuery(a){return this.fetchQuery(a).then(_).catch(_)}fetchInfiniteQuery(a){return a.behavior=b0(a.pages),this.fetchQuery(a)}prefetchInfiniteQuery(a){return this.fetchInfiniteQuery(a).then(_).catch(_)}resumePausedMutations(){return c(this,o1).resumePausedMutations()}getQueryCache(){return c(this,C)}getMutationCache(){return c(this,o1)}getDefaultOptions(){return c(this,d1)}setDefaultOptions(a){e(this,d1,a)}setQueryDefaults(a,t){c(this,y1).set(U1(a),{queryKey:a,defaultOptions:t})}getQueryDefaults(a){const t=[...c(this,y1).values()];let h={};return t.forEach(n=>{Q1(a,n.queryKey)&&(h={...h,...n.defaultOptions})}),h}setMutationDefaults(a,t){c(this,b1).set(U1(a),{mutationKey:a,defaultOptions:t})}getMutationDefaults(a){const t=[...c(this,b1).values()];let h={};return t.forEach(n=>{Q1(a,n.mutationKey)&&(h={...h,...n.defaultOptions})}),h}defaultQueryOptions(a){if(a!=null&&a._defaulted)return a;const t={...c(this,d1).queries,...(a==null?void 0:a.queryKey)&&this.getQueryDefaults(a.queryKey),...a,_defaulted:!0};return t.queryHash||(t.queryHash=A2(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(a){return a!=null&&a._defaulted?a:{...c(this,d1).mutations,...(a==null?void 0:a.mutationKey)&&this.getMutationDefaults(a.mutationKey),...a,_defaulted:!0}}clear(){c(this,C).clear(),c(this,o1).clear()}},C=new WeakMap,o1=new WeakMap,d1=new WeakMap,y1=new WeakMap,b1=new WeakMap,z1=new WeakMap,P1=new WeakMap,R1=new WeakMap,Z2),k,L,F1,P,f1,D1,t1,$1,k1,E1,m1,L1,g1,x1,w1,j1,J1,f2,Z1,m2,Y1,L2,X1,x2,t2,w2,a2,B2,h2,I2,g2,l0,Y2,F0=(Y2=class extends W1{constructor(t,h){super();o(this,w1);o(this,J1);o(this,Z1);o(this,Y1);o(this,X1);o(this,t2);o(this,a2);o(this,h2);o(this,g2);o(this,k,void 0);o(this,L,void 0);o(this,F1,void 0);o(this,P,void 0);o(this,f1,void 0);o(this,D1,void 0);o(this,t1,void 0);o(this,$1,void 0);o(this,k1,void 0);o(this,E1,void 0);o(this,m1,void 0);o(this,L1,void 0);o(this,g1,void 0);o(this,x1,void 0);e(this,L,void 0),e(this,F1,void 0),e(this,P,void 0),e(this,x1,new Set),e(this,k,t),this.options=h,e(this,t1,null),this.bindMethods(),this.setOptions(h)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(c(this,L).addObserver(this),N2(c(this,L),this.options)?M(this,w1,j1).call(this):this.updateResult(),M(this,X1,x2).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G2(c(this,L),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G2(c(this,L),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,M(this,t2,w2).call(this),M(this,a2,B2).call(this),c(this,L).removeObserver(this)}setOptions(t,h){const n=this.options,v=c(this,L);if(this.options=c(this,k).defaultQueryOptions(t),o2(n,this.options)||c(this,k).getQueryCache().notify({type:"observerOptionsUpdated",query:c(this,L),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=n.queryKey),M(this,h2,I2).call(this);const r=this.hasListeners();r&&W2(c(this,L),v,this.options,n)&&M(this,w1,j1).call(this),this.updateResult(h),r&&(c(this,L)!==v||this.options.enabled!==n.enabled||this.options.staleTime!==n.staleTime)&&M(this,J1,f2).call(this);const i=M(this,Z1,m2).call(this);r&&(c(this,L)!==v||this.options.enabled!==n.enabled||i!==c(this,g1))&&M(this,Y1,L2).call(this,i)}getOptimisticResult(t){const h=c(this,k).getQueryCache().build(c(this,k),t),n=this.createResult(h,t);return k0(this,n)&&(e(this,P,n),e(this,D1,this.options),e(this,f1,c(this,L).state)),n}getCurrentResult(){return c(this,P)}trackResult(t){const h={};return Object.keys(t).forEach(n=>{Object.defineProperty(h,n,{configurable:!1,enumerable:!0,get:()=>(c(this,x1).add(n),t[n])})}),h}getCurrentQuery(){return c(this,L)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const h=c(this,k).defaultQueryOptions(t),n=c(this,k).getQueryCache().build(c(this,k),h);return n.isFetchingOptimistic=!0,n.fetch().then(()=>this.createResult(n,h))}fetch(t){return M(this,w1,j1).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),c(this,P)))}createResult(t,h){var F;const n=c(this,L),v=this.options,r=c(this,P),i=c(this,f1),z=c(this,D1),p=t!==n?t.state:c(this,F1),{state:d}=t;let{error:x,errorUpdatedAt:b,fetchStatus:H,status:V}=d,B=!1,g;if(h._optimisticResults){const I=this.hasListeners(),w=!I&&N2(t,h),n1=I&&W2(t,n,h,v);(w||n1)&&(H=M2(t.options.networkMode)?"fetching":"paused",d.dataUpdatedAt||(V="pending")),h._optimisticResults==="isRestoring"&&(H="idle")}if(h.select&&typeof d.data<"u")if(r&&d.data===(i==null?void 0:i.data)&&h.select===c(this,$1))g=c(this,k1);else try{e(this,$1,h.select),g=h.select(d.data),g=V2(r==null?void 0:r.data,g,h),e(this,k1,g),e(this,t1,null)}catch(I){e(this,t1,I)}else g=d.data;if(typeof h.placeholderData<"u"&&typeof g>"u"&&V==="pending"){let I;if(r!=null&&r.isPlaceholderData&&h.placeholderData===(z==null?void 0:z.placeholderData))I=r.data;else if(I=typeof h.placeholderData=="function"?h.placeholderData((F=c(this,E1))==null?void 0:F.state.data,c(this,E1)):h.placeholderData,h.select&&typeof I<"u")try{I=h.select(I),e(this,t1,null)}catch(w){e(this,t1,w)}typeof I<"u"&&(V="success",g=V2(r==null?void 0:r.data,I,h),B=!0)}c(this,t1)&&(x=c(this,t1),g=c(this,k1),b=Date.now(),V="error");const u=H==="fetching",G=V==="pending",f=V==="error",m=G&&u;return{status:V,fetchStatus:H,isPending:G,isSuccess:V==="success",isError:f,isInitialLoading:m,isLoading:m,data:g,dataUpdatedAt:d.dataUpdatedAt,error:x,errorUpdatedAt:b,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>p.dataUpdateCount||d.errorUpdateCount>p.errorUpdateCount,isFetching:u,isRefetching:u&&!G,isLoadingError:f&&d.dataUpdatedAt===0,isPaused:H==="paused",isPlaceholderData:B,isRefetchError:f&&d.dataUpdatedAt!==0,isStale:y2(t,h),refetch:this.refetch}}updateResult(t){const h=c(this,P),n=this.createResult(c(this,L),this.options);if(e(this,f1,c(this,L).state),e(this,D1,this.options),c(this,f1).data!==void 0&&e(this,E1,c(this,L)),o2(n,h))return;e(this,P,n);const v={},r=()=>{if(!h)return!0;const{notifyOnChangeProps:i}=this.options,z=typeof i=="function"?i():i;if(z==="all"||!z&&!c(this,x1).size)return!0;const s=new Set(z??c(this,x1));return this.options.throwOnError&&s.add("error"),Object.keys(c(this,P)).some(p=>{const d=p;return c(this,P)[d]!==h[d]&&s.has(d)})};(t==null?void 0:t.listeners)!==!1&&r()&&(v.listeners=!0),M(this,g2,l0).call(this,{...v,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&M(this,X1,x2).call(this)}},k=new WeakMap,L=new WeakMap,F1=new WeakMap,P=new WeakMap,f1=new WeakMap,D1=new WeakMap,t1=new WeakMap,$1=new WeakMap,k1=new WeakMap,E1=new WeakMap,m1=new WeakMap,L1=new WeakMap,g1=new WeakMap,x1=new WeakMap,w1=new WeakSet,j1=function(t){M(this,h2,I2).call(this);let h=c(this,L).fetch(this.options,t);return t!=null&&t.throwOnError||(h=h.catch(_)),h},J1=new WeakSet,f2=function(){if(M(this,t2,w2).call(this),N1||c(this,P).isStale||!s2(this.options.staleTime))return;const h=a0(c(this,P).dataUpdatedAt,this.options.staleTime)+1;e(this,m1,setTimeout(()=>{c(this,P).isStale||this.updateResult()},h))},Z1=new WeakSet,m2=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(c(this,L)):this.options.refetchInterval)??!1},Y1=new WeakSet,L2=function(t){M(this,a2,B2).call(this),e(this,g1,t),!(N1||this.options.enabled===!1||!s2(c(this,g1))||c(this,g1)===0)&&e(this,L1,setInterval(()=>{(this.options.refetchIntervalInBackground||d2.isFocused())&&M(this,w1,j1).call(this)},c(this,g1)))},X1=new WeakSet,x2=function(){M(this,J1,f2).call(this),M(this,Y1,L2).call(this,M(this,Z1,m2).call(this))},t2=new WeakSet,w2=function(){c(this,m1)&&(clearTimeout(c(this,m1)),e(this,m1,void 0))},a2=new WeakSet,B2=function(){c(this,L1)&&(clearInterval(c(this,L1)),e(this,L1,void 0))},h2=new WeakSet,I2=function(){const t=c(this,k).getQueryCache().build(c(this,k),this.options);if(t===c(this,L))return;const h=c(this,L);e(this,L,t),e(this,F1,t.state),this.hasListeners()&&(h==null||h.removeObserver(this),t.addObserver(this))},g2=new WeakSet,l0=function(t){O.batch(()=>{t.listeners&&this.listeners.forEach(h=>{h(c(this,P))}),c(this,k).getQueryCache().notify({query:c(this,L),type:"observerResultsUpdated"})})},Y2);function D0(a,t){return t.enabled!==!1&&!a.state.dataUpdatedAt&&!(a.state.status==="error"&&t.retryOnMount===!1)}function N2(a,t){return D0(a,t)||a.state.dataUpdatedAt>0&&G2(a,t,t.refetchOnMount)}function G2(a,t,h){if(t.enabled!==!1){const n=typeof h=="function"?h(a):h;return n==="always"||n!==!1&&y2(a,t)}return!1}function W2(a,t,h,n){return h.enabled!==!1&&(a!==t||n.enabled===!1)&&(!h.suspense||a.state.status!=="error")&&y2(a,h)}function y2(a,t){return a.isStaleByTime(t.staleTime)}function k0(a,t){return!o2(a.getCurrentResult(),t)}var M1,D,K,v1,T1,l2,n2,C2,X2,E0=(X2=class extends W1{constructor(t,h){super();o(this,T1);o(this,n2);o(this,M1,void 0);o(this,D,void 0);o(this,K,void 0);o(this,v1,void 0);e(this,D,void 0),e(this,M1,t),this.setOptions(h),this.bindMethods(),M(this,T1,l2).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const h=this.options;this.options=c(this,M1).defaultMutationOptions(t),o2(h,this.options)||c(this,M1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:c(this,K),observer:this}),(n=c(this,K))==null||n.setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=c(this,K))==null||t.removeObserver(this)}onMutationUpdate(t){M(this,T1,l2).call(this),M(this,n2,C2).call(this,t)}getCurrentResult(){return c(this,D)}reset(){e(this,K,void 0),M(this,T1,l2).call(this),M(this,n2,C2).call(this)}mutate(t,h){var n;return e(this,v1,h),(n=c(this,K))==null||n.removeObserver(this),e(this,K,c(this,M1).getMutationCache().build(c(this,M1),this.options)),c(this,K).addObserver(this),c(this,K).execute(t)}},M1=new WeakMap,D=new WeakMap,K=new WeakMap,v1=new WeakMap,T1=new WeakSet,l2=function(){var h;const t=((h=c(this,K))==null?void 0:h.state)??e0();e(this,D,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},n2=new WeakSet,C2=function(t){O.batch(()=>{var h,n,v,r,i,z,s,p;c(this,v1)&&this.hasListeners()&&((t==null?void 0:t.type)==="success"?((n=(h=c(this,v1)).onSuccess)==null||n.call(h,t.data,c(this,D).variables,c(this,D).context),(r=(v=c(this,v1)).onSettled)==null||r.call(v,t.data,null,c(this,D).variables,c(this,D).context)):(t==null?void 0:t.type)==="error"&&((z=(i=c(this,v1)).onError)==null||z.call(i,t.error,c(this,D).variables,c(this,D).context),(p=(s=c(this,v1)).onSettled)==null||p.call(s,void 0,t.error,c(this,D).variables,c(this,D).context))),this.listeners.forEach(d=>{d(c(this,D))})})},X2);var i0=A.createContext(void 0),N=a=>{const t=A.useContext(i0);if(a)return a;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},T0=({client:a,children:t})=>(A.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),A.createElement(i0.Provider,{value:a},t)),o0=A.createContext(!1),N0=()=>A.useContext(o0),C4=o0.Provider;function W0(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var j0=A.createContext(W0()),U0=()=>A.useContext(j0);function d0(a,t){return typeof a=="function"?a(...t):!!a}var Q0=(a,t)=>{(a.suspense||a.throwOnError)&&(t.isReset()||(a.retryOnMount=!1))},K0=a=>{A.useEffect(()=>{a.clearReset()},[a])},q0=({result:a,errorResetBoundary:t,throwOnError:h,query:n})=>a.isError&&!t.isReset()&&!a.isFetching&&d0(h,[a.error,n]);var _0=a=>{a.suspense&&typeof a.staleTime!="number"&&(a.staleTime=1e3)};var $0=(a,t)=>(a==null?void 0:a.suspense)&&t.isPending,J0=(a,t,h)=>t.fetchOptimistic(a).catch(()=>{h.clearReset()});function Z0(a,t,h){if(process.env.NODE_ENV!=="production"&&(typeof a!="object"||Array.isArray(a)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=N(h),v=N0(),r=U0(),i=n.defaultQueryOptions(a);i._optimisticResults=v?"isRestoring":"optimistic",_0(i),Q0(i,r),K0(r);const[z]=A.useState(()=>new t(n,i)),s=z.getOptimisticResult(i);if(A.useSyncExternalStore(A.useCallback(p=>{const d=v?()=>{}:z.subscribe(O.batchCalls(p));return z.updateResult(),d},[z,v]),()=>z.getCurrentResult(),()=>z.getCurrentResult()),A.useEffect(()=>{z.setOptions(i,{listeners:!1})},[i,z]),$0(i,s))throw J0(i,z,r);if(q0({result:s,errorResetBoundary:r,throwOnError:i.throwOnError,query:z.getCurrentQuery()}))throw s.error;return i.notifyOnChangeProps?s:z.trackResult(s)}function c2(a,t){return Z0(a,F0,t)}function J(a,t){const h=N(t),[n]=A.useState(()=>new E0(h,a));A.useEffect(()=>{n.setOptions(a)},[n,a]);const v=A.useSyncExternalStore(A.useCallback(i=>n.subscribe(O.batchCalls(i)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),r=A.useCallback((i,z)=>{n.mutate(i,z).catch(Y0)},[n]);if(v.error&&d0(n.options.throwOnError,[v.error]))throw v.error;return{...v,mutate:r,mutateAsync:v.mutate}}function Y0(){}function R(){return N().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const H1=()=>{const{data:a,refetch:t}=c2({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[a,h=>{h&&(localStorage.setItem("currentPage",h||""),t())}]};let j2="";const v2=()=>(j2=localStorage.getItem("__chai_at"),j2);function X0(a){const t={method:"GET",headers:{"x-chai-access-token":v2()}};return fetch(a,t)}function t4(a,t){const h={method:"POST",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function a4(a,t){const h={method:"PUT",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}function h4(a,t){const h={method:"DELETE",headers:{"x-chai-access-token":v2()},body:JSON.stringify(t)};return fetch(a,h)}const W={get:X0,post:t4,put:a4,delete:h4},b2=()=>{const[a,t]=H1(),h=R();return c2({queryKey:["project"],queryFn:async()=>{const{data:n}=await W.get(`${h}/project`).then(v=>v.json());if(!a&&n){const v=localStorage.getItem("currentPage");t(v||(n==null?void 0:n.homepage))}return n}})},P2=()=>{const a=R();return c2({queryKey:["pages"],queryFn:async()=>{const{data:t}=await W.get(`${a}/pages`).then(h=>h.json());return t||[]}})},z0=()=>{const[a]=H1(),t=R();return c2({queryKey:["page_data",a],queryFn:async()=>{const{data:h}=await W.get(`${t}/page?uuid=${a}`).then(n=>n.json());return h},enabled:!!a,staleTime:3e3})},O2=()=>l.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:l.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[l.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),l.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),l.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),g0=(a="Project updated successfully.")=>{const t=N(),h=R();return J({mutationFn:async n=>await W.put(`${h}/project`,n).then(v=>v.json()),onSuccess:()=>{t.invalidateQueries({queryKey:["project"]}),a1.toast.success(a)}})},M0=()=>{const[a]=["SAVED"],[t,h]=H1(),n=q.useBuilderReset(),{t:v}=p0.useTranslation();return r=>a!=="SAVED"?(a1.toast.error(v("You have unsaved changes. Please save before changing the page.")),!1):t===r.uuid?!1:(n(),setTimeout(()=>h(r.uuid),100),!0)},n4=()=>{const a=N(),t=M0(),h=R();return J({mutationFn:async n=>W.post(`${h}/pages`,n).then(v=>v.json()),onSuccess:n=>{a.invalidateQueries({queryKey:["pages"]}),t({uuid:n.uuid,slug:n.slug}),a1.toast.success("Page added successfully.")}})},H0=()=>{const a=R(),[t]=H1(),h=N();return J({mutationFn:async n=>W.put(`${a}/page`,n).then(v=>v.json()),onSuccess:async n=>{var v;if(n.result==="error"&&((v=n.error)==null?void 0:v.code)=="PAGE_LOCKED"){h.invalidateQueries({queryKey:["page_data",t]});return}a1.toast.success("Page saved successfully.")}})},c4=()=>{const a=R(),{data:t}=P2(),[h]=H1(),{data:n}=b2(),v=N();return J({mutationFn:async()=>{const r=t.find(i=>i.uuid===h).slug;return await W.post(`${a}/publish`,{slug:r,uuid:h,isHomepage:(n==null?void 0:n.homepage)===h}).then(i=>i.json())},onSuccess:async r=>{var i;if(r.result==="error"&&((i=r.error)==null?void 0:i.code)=="PAGE_LOCKED"){v.invalidateQueries({queryKey:["page_data",h]});return}a1.toast.success("Page published successfully.",{position:"bottom-right",duration:2e3})}})},v4=()=>{const a=N(),t=R();return J({mutationFn:async h=>W.delete(`${t}/page`,h).then(n=>n.json()),onSuccess:()=>{a1.toast.success("Page deleted successfully."),a.invalidateQueries({queryKey:["pages"]})}})},r4=()=>{const a=N(),t=R();return J({mutationFn:async h=>W.post(`${t}/take-control`,{uuid:h}).then(n=>n.json()),onSuccess:(h,n)=>{a.invalidateQueries({queryKey:["page_data",n]})}})},e4=()=>{const a=R();return J({mutationFn:async()=>{const{data:t}=await W.get(`${a}/library`).then(h=>h.json());return h1.sortBy(h1.filter(t,h=>!h1.has(h,"hidden")),"group")}})},l4=()=>{const a=R();return J({mutationFn:async t=>{if(!t||!t.uuid)return[];try{const{data:h}=await W.get(`${a}/block?uuid=${t.uuid}&format=${t.format}`).then(async n=>t.format==="html"?V0.getBlocksFromHTML(await n.text()):await n.json());return h1.set(h,"0._name",h1.capitalize(t.group)),h||[]}catch{return[]}}})},i4=()=>{const a=R();return J({mutationFn:async t=>{const h=new FormData;h.append("file",t);const{data:n}=await fetch(`${a}/upload`,{method:"POST",headers:{"x-chai-access-token":v2()},body:h}).then(v=>v.json());return n}})};function u0(a){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"}}]})(a)}function o4(a){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}}]})(a)}const d4=()=>{const{mutate:a,isPending:t}=r4(),[h]=H1(),{data:n}=z0(),v=h1.get(n,"lockedBy.name",""),r=h1.get(n,"lockedBy.email","");return l.jsxRuntimeExports.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg drop-shadow-2xl mx-auto p-10 space-y-4 text-center max-w-xl",children:[l.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),l.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",l.jsxRuntimeExports.jsx("br",{}),l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[l.jsxRuntimeExports.jsx(o4,{className:"w-4 h-4 text-gray-500"})," ",v]}),l.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[l.jsxRuntimeExports.jsx(u0,{className:"w-4 h-4 text-gray-500"})," ",r]})]}),l.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",v," will be ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),l.jsxRuntimeExports.jsx(q.Button,{disabled:t,onClick:()=>a(h),className:`w-36 ${t?"bg-transparent shadow-none hover:bg-transparent":""}`,children:t?l.jsxRuntimeExports.jsx(S2.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},z4=()=>{const a=R(),t=N();return J({mutationFn:async h=>{const n=await fetch(`${a}/login`,{method:"POST",body:JSON.stringify(h)});if(n.ok)return await n.json();throw n.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:h=>{const{data:n}=h;if(!n.accessToken){a1.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",n.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(h1.omit(n,["accessToken"]))),t.invalidateQueries({queryKey:["verify"]}),a1.toast.success("Logged in successfully.")},onError:()=>{a1.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},g4=()=>{const a=R();return c2({queryKey:["verify"],queryFn:async()=>{const t=await W.get(`${a}/verify`);return t.ok?(await t.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},M4=()=>{const a=R(),t=N();return J({mutationFn:async()=>{const{result:h}=await W.post(`${a}/logout`).then(n=>n.json());if(h==="success")return localStorage.clear(),t.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},H4=({children:a})=>{const t=M4();return l.jsxRuntimeExports.jsxs(q.AlertDialog,{children:[l.jsxRuntimeExports.jsx(q.AlertDialogTrigger,{asChild:!0,children:a}),l.jsxRuntimeExports.jsxs(q.AlertDialogContent,{children:[l.jsxRuntimeExports.jsxs(q.AlertDialogHeader,{children:[l.jsxRuntimeExports.jsxs(q.AlertDialogTitle,{children:["Are you sure, you want to ",l.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),l.jsxRuntimeExports.jsx(q.AlertDialogDescription,{children:"Kindly ensure that all your data is saved before proceeding with the sign-out process to prevent any potential loss of unsaved information"})]}),l.jsxRuntimeExports.jsxs(q.AlertDialogFooter,{children:[l.jsxRuntimeExports.jsx(q.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),l.jsxRuntimeExports.jsxs("button",{disabled:t.isPending,onClick:()=>t.mutate(),className:"rounded-md text-white w-28 text-center justify-center bg-red-600 hover:bg-red-700 flex items-center gap-x-2",children:[t.isPending&&l.jsxRuntimeExports.jsx(S2.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},u4=()=>l.jsxRuntimeExports.jsx(H4,{children:l.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:l.jsxRuntimeExports.jsx(S2.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),s4=T.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-PBFzPSNY.cjs"))),p4=T.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-755bbzEQ.cjs"))),V4=T.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-2W1pdAOG.cjs"))),f4=()=>l.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),m4=()=>{const{mutate:a}=c4();return q.useBuilderProp("editable",!0)?l.jsxRuntimeExports.jsx(q.Button,{onClick:a,className:"bg-blue-600 text-white",children:"Publish"}):null},L4=a=>{var f;const{data:t,isLoading:h}=b2(),{data:n,isLoading:v}=P2(),{data:r}=z0(),{mutate:i}=g0(),{mutate:z}=H0(),[s]=H1(),p=i4(),d=e4(),x=l4(),b=R(),H=T.useCallback(async m=>await p.mutateAsync(m),[p]),V=T.useCallback(async()=>await d.mutateAsync(),[d]),B=T.useCallback(async m=>await x.mutateAsync(m),[x]),g=async(m=20,y=0)=>{const F=`limit=${m}&offset=${y}`,I=await fetch(`${b}/assets?${F}`).then(w=>w.json());return I.result==="success"?I.data:[]},{logo:u=f4}=a;if(h||!t)return l.jsxRuntimeExports.jsx(O2,{});if(v||!n)return l.jsxRuntimeExports.jsx(O2,{});const G={...a,editable:r!=null&&r.lockedBy?r==null?void 0:r.lockedBy.self:!0,nonEditableComponent:d4,blocks:(r==null?void 0:r.blocks)||[],brandingOptions:t.brandingOptions,darkMode:a.darkMode||!1,dataProviders:(r==null?void 0:r.providers)||[],onSavePage:async({blocks:m,providers:y})=>(await z({blocks:m,providers:y,uuid:s}),!0),onSaveBrandingOptions:async m=>(await i({brandingOptions:m}),!0),topBarComponents:{left:[u],center:[V4],right:[m4]},sideBarComponents:{top:[{icon:i2.FileTextIcon,name:"pages",panel:s4},{icon:i2.GearIcon,name:"settings",panel:p4},...((f=a.sideBarComponents)==null?void 0:f.top)||[]],bottom:[u4]},uploadMediaCallback:H,fetchMediaCallback:g,getUILibraryBlocks:V,getExternalPredefinedBlock:B,getPages:()=>n};return l.jsxRuntimeExports.jsx(s0.ChaiBuilderEditor,{...G})},x4=({logo:a})=>{const[t,h]=T.useState(!1),[n,v]=T.useState(""),[r,i]=T.useState(""),{mutate:z,isPending:s}=z4(),p=d=>{d.preventDefault(),z({email:n,password:r})};return l.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen flex items-center justify-center bg-[radial-gradient(#AAA,transparent_0.5px)] duration-300 [background-size:6px_6px]",children:l.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:l.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[l.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[l.jsxRuntimeExports.jsx(T.Suspense,{children:a?T.createElement(a):""}),l.jsxRuntimeExports.jsx("p",{className:"max-w-xl mx-auto text-base leading-relaxed text-gray-700 font-thin",children:"Enter your login credential to continue"})]}),l.jsxRuntimeExports.jsx("div",{className:"mt-8",children:l.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:p,className:"space-y-5",children:[l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[l.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:l.jsxRuntimeExports.jsx(u0,{})}),l.jsxRuntimeExports.jsx("input",{value:n,onChange:d=>v(d.target.value),type:"email",id:"email",placeholder:"Enter email",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"})]})}),l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[l.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:l.jsxRuntimeExports.jsx("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsxRuntimeExports.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 11c0 3.517-1.009 6.799-2.753 9.571m-3.44-2.04l.054-.09A13.916 13.916 0 008 11a4 4 0 118 0c0 1.017-.07 2.019-.203 3m-2.118 6.844A21.88 21.88 0 0015.171 17m3.839 1.132c.645-2.266.99-4.659.99-7.132A8 8 0 008 4.07M3 15.364c.64-1.319 1-2.8 1-4.364 0-1.457.39-2.823 1.07-4"})})}),l.jsxRuntimeExports.jsx("input",{value:r,onChange:d=>i(d.target.value),type:t?"text":"password",id:"pwd",placeholder:"Enter password",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"}),l.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>h(!t),children:t?l.jsxRuntimeExports.jsx(i2.EyeClosedIcon,{}):l.jsxRuntimeExports.jsx(i2.EyeOpenIcon,{})})]})}),l.jsxRuntimeExports.jsx("div",{children:l.jsxRuntimeExports.jsx("button",{disabled:s||h1.size(n)<2||h1.size(r)<2,type:"submit",className:"inline-flex disabled:bg-gray-400 items-center justify-center w-full px-4 py-4 text-base font-semibold text-white transition-all duration-200 bg-blue-600 border border-transparent rounded-md focus:outline-none hover:bg-blue-700 focus:bg-blue-700",children:s?"Signing in...":"Login"})})]})}),l.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:l.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},w4=a=>{const{data:t,isLoading:h}=g4(),n=N();return T.useEffect(()=>{n.setQueryData(["apiBaseUrl"],a.apiBaseUrl||"/api/chaibuilder")},[a.apiBaseUrl,n]),h?l.jsxRuntimeExports.jsx(O2,{}):t!=null&&t.valid?l.jsxRuntimeExports.jsx(L4,{...a}):l.jsxRuntimeExports.jsx(x4,{logo:a.logo})},B4=new R0,I4=a=>l.jsxRuntimeExports.jsxs(T0,{client:B4,children:[l.jsxRuntimeExports.jsx(a1.Toaster,{richColors:!0}),l.jsxRuntimeExports.jsx(w4,{...a})]});exports.ChaiBuilderStudio=I4;exports.useAddPage=n4;exports.useChangePage=M0;exports.useCurrentPage=H1;exports.useDeletePage=v4;exports.usePages=P2;exports.useProject=b2;exports.useQueryClient=N;exports.useUpdatePage=H0;exports.useUpdateProject=g0;
|