@chaibuilder/sdk 1.0.22 → 1.0.24
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-kQZRgF1n.cjs → AddBlocks-F05ZiQnz.cjs} +1 -1
- package/dist/{AddBlocks--G1jvF_h.js → AddBlocks-kmAje7cV.js} +1 -1
- package/dist/{BrandingOptions-3zuS6-D8.cjs → BrandingOptions-2aNZT1u3.cjs} +1 -1
- package/dist/{BrandingOptions-dwNB6XlX.js → BrandingOptions-GLVanp1T.js} +1 -1
- package/dist/CanvasArea-AHGpIP2x.cjs +56 -0
- package/dist/CanvasArea-gJ_UifbO.js +1349 -0
- package/dist/{CurrentPage-Fw-gGZIK.cjs → CurrentPage-JJpZpFko.cjs} +1 -1
- package/dist/{CurrentPage-iC1tGuWi.js → CurrentPage-fyWf5F84.js} +2 -2
- package/dist/{Layers-tvGxr-fn.js → Layers-RGy6kyuR.js} +3 -3
- package/dist/{Layers-bvtrSZ0e.cjs → Layers-YtfF6ty5.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-wqHaABl_.cjs → MarkAsGlobalBlock-1G5m_8t3.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-hUoxbVet.js → MarkAsGlobalBlock-EsX3-clj.js} +1 -1
- package/dist/{PagesPanel-IHkdL59C.cjs → PagesPanel-J8uYp1Tp.cjs} +1 -1
- package/dist/{PagesPanel-w32nyAEE.js → PagesPanel-LjiXL4rp.js} +3 -3
- package/dist/{ProjectPanel-1yH8uzoo.js → ProjectPanel-F435j6T2.js} +3 -3
- package/dist/{ProjectPanel-Rt_C00rp.cjs → ProjectPanel-IXVY1LJ_.cjs} +1 -1
- package/dist/{Settings-MbtN9j5p.js → Settings-b3lEaQ7w.js} +479 -477
- package/dist/Settings-xwTkQuKA.cjs +1 -0
- package/dist/{SidePanels-PcCVJHFu.cjs → SidePanels-1Ooc-KTb.cjs} +1 -1
- package/dist/{SidePanels-WDSKmDRO.js → SidePanels-MnI_uhIo.js} +3 -3
- package/dist/{Topbar-QBbGJftd.js → Topbar-1ClabAix.js} +1 -1
- package/dist/{Topbar-p07CgA1J.cjs → Topbar-e0hKiAm_.cjs} +1 -1
- package/dist/{UnsplashImages-RobUmAqJ.cjs → UnsplashImages-OJ5u1mVM.cjs} +1 -1
- package/dist/{UnsplashImages-NOdXhrYp.js → UnsplashImages-UejSDiRk.js} +1 -1
- package/dist/{UploadImages-oRvUykXU.cjs → UploadImages-2SqVkr1u.cjs} +1 -1
- package/dist/{UploadImages-_yFxI_3x.js → UploadImages-xBJTMBKX.js} +1 -1
- package/dist/{add-page-modal-1C4AYlR3.js → add-page-modal-SdyjVxRW.js} +14 -15
- package/dist/{add-page-modal-c20toln3.cjs → add-page-modal-rkF5RqMj.cjs} +1 -1
- package/dist/{confirm-alert-LM4La_do.js → confirm-alert-TCwoZBC3.js} +1 -1
- package/dist/{confirm-alert-exrulqxB.cjs → confirm-alert-uk39UILT.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -3
- package/dist/core.js +2 -2
- package/dist/{delete-page-modal-sMfhH69k.cjs → delete-page-modal-PKSlPOAB.cjs} +1 -1
- package/dist/{delete-page-modal-ZkdZdhkf.js → delete-page-modal-pjChqG0d.js} +2 -2
- package/dist/{form-0TlI-dUt.cjs → form-N6Izl5Ni.cjs} +1 -1
- package/dist/{form-rvWlnmcr.js → form-aIN_qzKQ.js} +1 -1
- package/dist/{index-UPQtDmUs.js → index-0ZqKzbSx.js} +3 -3
- package/dist/index-4h4Ti2E4.cjs +1 -0
- package/dist/{index-8dYzEcE3.cjs → index-LL32f5q7.cjs} +2 -2
- package/dist/{index-pgz9p5Yh.js → index-aPk1Fuat.js} +50 -49
- package/dist/{page-viewer-3860AKDT.js → page-viewer-SMOg1l3b.js} +3 -3
- package/dist/{page-viewer-1EuLsHyz.cjs → page-viewer-wrYXvC-7.cjs} +1 -1
- package/dist/{project-general-setting-mg_zEkzX.js → project-general-setting-CcnnvnwD.js} +3 -3
- package/dist/{project-general-setting-Bg7qIWUd.cjs → project-general-setting-wDjCo89M.cjs} +1 -1
- package/dist/{project-seo-setting-6Q0gFmHY.js → project-seo-setting-CPtrvtsw.js} +2 -2
- package/dist/{project-seo-setting-8B9pZPZN.cjs → project-seo-setting-RJMYUQxR.cjs} +1 -1
- package/dist/{single-page-detail-Asn7bb7f.js → single-page-detail-7NRw-CLc.js} +4 -4
- package/dist/{single-page-detail-52Xz-XJ7.cjs → single-page-detail-gnpyWcy7.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/package.json +3 -3
- package/dist/CanvasArea-SzwU-7i5.cjs +0 -46
- package/dist/CanvasArea-YM7NWbx0.js +0 -1298
- package/dist/Settings-zqxhKtAP.cjs +0 -1
- package/dist/index-lH7BBNlu.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var lo=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)};var B=(t,e,a)=>(lo(t,e,"read from private field"),a?a.call(t):e.get(t)),z1=(t,e,a)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,a)},u1=(t,e,a,r)=>(lo(t,e,"write to private field"),r?r.call(t,a):e.set(t,a),a);var Cr=(t,e,a,r)=>({set _(n){u1(t,e,n,a)},get _(){return B(t,e,r)}}),C1=(t,e,a)=>(lo(t,e,"access private method"),a);const RO=require("i18next"),kO=require("react-i18next"),r1=require("./jsx-runtime-WUGKV8jN.cjs"),d=require("react"),o1=require("./index-
|
|
1
|
+
"use strict";var lo=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)};var B=(t,e,a)=>(lo(t,e,"read from private field"),a?a.call(t):e.get(t)),z1=(t,e,a)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,a)},u1=(t,e,a,r)=>(lo(t,e,"write to private field"),r?r.call(t,a):e.set(t,a),a);var Cr=(t,e,a,r)=>({set _(n){u1(t,e,n,a)},get _(){return B(t,e,r)}}),C1=(t,e,a)=>(lo(t,e,"access private method"),a);const RO=require("i18next"),kO=require("react-i18next"),r1=require("./jsx-runtime-WUGKV8jN.cjs"),d=require("react"),o1=require("./index-4h4Ti2E4.cjs"),T2=require("./MODIFIERS-WFzDQfiT.cjs"),Hf=require("clsx"),Vf=require("react-dom"),NO=require("@radix-ui/react-scroll-area"),pt=require("@floating-ui/react-dom"),TO=require("react-textarea-autosize"),be=require("jotai"),jO=require("flagged"),DO=require("react-dnd"),rt=require("lodash"),jh=require("@minoru/react-dnd-treeview"),FO=require("./lib.cjs"),qO=require("./utils-It2K33fU.cjs"),ne=require("react-hotkeys-hook"),wf=require("@chaibuilder/runtime"),P4=require("@radix-ui/react-icons"),F2=require("sonner"),o3=require("lucide-react");function bf(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return e.default=t,Object.freeze(e)}const O=bf(d),Ie=bf(NO),WO="Dark mode",KO="This page has no blocks. Add a block by clicking the + button",UO="This page is empty",ZO="Please select a block to edit settings or styles",GO="Please select a styling block",JO="Drop your block here",YO={dark_mode:WO,tree_view_no_blocks:KO,canvas_empty:UO,no_block_selected_for_styling:ZO,no_styling_block_selected:GO,drop_here_message:JO};RO.use(kO.initReactI18next).init({resources:{en:{translation:YO}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const QO="";var XO=Object.create,yf=Object.defineProperty,_O=Object.getOwnPropertyDescriptor,c3=Object.getOwnPropertyNames,$O=Object.getPrototypeOf,tS=Object.prototype.hasOwnProperty,eS=(t,e)=>function(){return t&&(e=(0,t[c3(t)[0]])(t=0)),e},g1=(t,e)=>function(){return e||(0,t[c3(t)[0]])((e={exports:{}}).exports,e),e.exports},aS=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of c3(e))!tS.call(t,n)&&n!==a&&yf(t,n,{get:()=>e[n],enumerable:!(r=_O(e,n))||r.enumerable});return t},na=(t,e,a)=>(a=t!=null?XO($O(t)):{},aS(e||!t||!t.__esModule?yf(a,"default",{value:t,enumerable:!0}):a,t)),j=eS({"react-shim.js"(){"use strict"}});j();j();var rS=(t,e)=>t.size===e.size&&Array.from(t).every(([a,r])=>Object.is(e.get(a),r)),nS=(t,e)=>t.size===e.size&&Array.from(t).every(([a,r])=>{const n=e.get(a);return n&&r.size===n.size&&Array.from(r).every(l=>n.has(l))});function lS({shouldShowPrivateAtoms:t=!1,...e}={}){const a=o1.useStore(e),[r,n]=d.useState(()=>({values:new Map,dependents:new Map})),l=d.useRef(!0);return l.current=!0,d.useLayoutEffect(()=>{l.current=!1}),d.useEffect(()=>{const i=(a==null?void 0:a.dev_subscribe_store)||(a==null?void 0:a.dev_subscribe_state);if(!i)return;let o=new Map,c=new Map;"dev_subscribe_store"in a||console.warn("[DEPRECATION-WARNING]: Your Jotai version is out-of-date and contains deprecated properties that will be removed soon. Please update to the latest version of Jotai.");const v=s=>{var f,z,M;typeof s!="object"&&console.warn("[DEPRECATION-WARNING]: Your Jotai version is out-of-date and contains deprecated properties that will be removed soon. Please update to the latest version of Jotai.");const u=new Map,g=new Map;for(const m of((f=a.dev_get_mounted_atoms)==null?void 0:f.call(a))||[]){if(!t&&m.debugPrivate)continue;const V=(z=a.dev_get_atom_state)==null?void 0:z.call(a,m);V&&"v"in V&&u.set(m,V.v);const b=(M=a.dev_get_mounted)==null?void 0:M.call(a,m);if(b){let w=b.t;t||(w=new Set(Array.from(w.values()).filter(y=>!y.debugPrivate))),g.set(m,w)}}if(rS(o,u)&&nS(c,g))return;o=u,c=g;const p=()=>n({values:u,dependents:g});l.current?Promise.resolve().then(p):p()},h=i==null?void 0:i(v,2);return v({}),h},[a,t]),r}j();function xf(t){const e=o1.useStore(t);return d.useCallback(a=>{e.dev_restore_atoms&&e.dev_restore_atoms(a.values)},[e])}j();j();j();j();j();function iS(t){if(t.sheet)return t.sheet;for(var e=0;e<document.styleSheets.length;e++)if(document.styleSheets[e].ownerNode===t)return document.styleSheets[e]}function oS(t){var e=document.createElement("style");return e.setAttribute("data-emotion",t.key),t.nonce!==void 0&&e.setAttribute("nonce",t.nonce),e.appendChild(document.createTextNode("")),e.setAttribute("data-s",""),e}var cS=function(){function t(a){var r=this;this._insertTag=function(n){var l;r.tags.length===0?r.insertionPoint?l=r.insertionPoint.nextSibling:r.prepend?l=r.container.firstChild:l=r.before:l=r.tags[r.tags.length-1].nextSibling,r.container.insertBefore(n,l),r.tags.push(n)},this.isSpeedy=a.speedy===void 0?process.env.NODE_ENV==="production":a.speedy,this.tags=[],this.ctr=0,this.nonce=a.nonce,this.key=a.key,this.container=a.container,this.prepend=a.prepend,this.insertionPoint=a.insertionPoint,this.before=null}var e=t.prototype;return e.hydrate=function(r){r.forEach(this._insertTag)},e.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(oS(this));var n=this.tags[this.tags.length-1];if(process.env.NODE_ENV!=="production"){var l=r.charCodeAt(0)===64&&r.charCodeAt(1)===105;l&&this._alreadyInsertedOrderInsensitiveRule&&console.error(`You're attempting to insert the following rule:
|
|
2
2
|
`+r+"\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules."),this._alreadyInsertedOrderInsensitiveRule=this._alreadyInsertedOrderInsensitiveRule||!l}if(this.isSpeedy){var i=iS(n);try{i.insertRule(r,i.cssRules.length)}catch(o){process.env.NODE_ENV!=="production"&&!/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(r)&&console.error('There was a problem inserting the following rule: "'+r+'"',o)}}else n.appendChild(document.createTextNode(r));this.ctr++},e.flush=function(){this.tags.forEach(function(r){return r.parentNode&&r.parentNode.removeChild(r)}),this.tags=[],this.ctr=0,process.env.NODE_ENV!=="production"&&(this._alreadyInsertedOrderInsensitiveRule=!1)},t}(),Pt="-ms-",I4="-moz-",j1="-webkit-",h3="comm",s3="rule",v3="decl";var hS="@import";var Lf="@keyframes";var sS="@layer",vS=Math.abs,mi=String.fromCharCode,dS=Object.assign;function uS(t,e){return Lt(t,0)^45?(((e<<2^Lt(t,0))<<2^Lt(t,1))<<2^Lt(t,2))<<2^Lt(t,3):0}function Of(t){return t.trim()}function gS(t,e){return(t=e.exec(t))?t[0]:t}function D1(t,e,a){return t.replace(e,a)}function uc(t,e){return t.indexOf(e)}function Lt(t,e){return t.charCodeAt(e)|0}function F0(t,e,a){return t.slice(e,a)}function R2(t){return t.length}function d3(t){return t.length}function Br(t,e){return e.push(t),t}function fS(t,e){return t.map(e).join("")}var Hi=1,Qa=1,Sf=0,Jt=0,ht=0,n0="";function Vi(t,e,a,r,n,l,i){return{value:t,root:e,parent:a,type:r,props:n,children:l,line:Hi,column:Qa,length:i,return:""}}function u0(t,e){return dS(Vi("",null,null,"",null,null,0),t,{length:-t.length},e)}function pS(){return ht}function zS(){return ht=Jt>0?Lt(n0,--Jt):0,Qa--,ht===10&&(Qa=1,Hi--),ht}function r2(){return ht=Jt<Sf?Lt(n0,Jt++):0,Qa++,ht===10&&(Qa=1,Hi++),ht}function q2(){return Lt(n0,Jt)}function f4(){return Jt}function vr(t,e){return F0(n0,t,e)}function q0(t){switch(t){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Cf(t){return Hi=Qa=1,Sf=R2(n0=t),Jt=0,[]}function Bf(t){return n0="",t}function p4(t){return Of(vr(Jt-1,gc(t===91?t+2:t===40?t+1:t)))}function MS(t){for(;(ht=q2())&&ht<33;)r2();return q0(t)>2||q0(ht)>3?"":" "}function mS(t,e){for(;--e&&r2()&&!(ht<48||ht>102||ht>57&&ht<65||ht>70&&ht<97););return vr(t,f4()+(e<6&&q2()==32&&r2()==32))}function gc(t){for(;r2();)switch(ht){case t:return Jt;case 34:case 39:t!==34&&t!==39&&gc(ht);break;case 40:t===41&&gc(t);break;case 92:r2();break}return Jt}function HS(t,e){for(;r2()&&t+ht!==57;)if(t+ht===84&&q2()===47)break;return"/*"+vr(e,Jt-1)+"*"+mi(t===47?t:r2())}function VS(t){for(;!q0(q2());)r2();return vr(t,Jt)}function wS(t){return Bf(z4("",null,null,null,[""],t=Cf(t),0,[0],t))}function z4(t,e,a,r,n,l,i,o,c){for(var v=0,h=0,s=i,u=0,g=0,p=0,f=1,z=1,M=1,m=0,V="",b=n,w=l,y=r,x=V;z;)switch(p=m,m=r2()){case 40:if(p!=108&&Lt(x,s-1)==58){uc(x+=D1(p4(m),"&","&\f"),"&\f")!=-1&&(M=-1);break}case 34:case 39:case 91:x+=p4(m);break;case 9:case 10:case 13:case 32:x+=MS(p);break;case 92:x+=mS(f4()-1,7);continue;case 47:switch(q2()){case 42:case 47:Br(bS(HS(r2(),f4()),e,a),c);break;default:x+="/"}break;case 123*f:o[v++]=R2(x)*M;case 125*f:case 59:case 0:switch(m){case 0:case 125:z=0;case 59+h:M==-1&&(x=D1(x,/\f/g,"")),g>0&&R2(x)-s&&Br(g>32?Fh(x+";",r,a,s-1):Fh(D1(x," ","")+";",r,a,s-2),c);break;case 59:x+=";";default:if(Br(y=Dh(x,e,a,v,h,n,o,V,b=[],w=[],s),l),m===123)if(h===0)z4(x,e,y,y,b,l,s,o,w);else switch(u===99&&Lt(x,3)===110?100:u){case 100:case 108:case 109:case 115:z4(t,y,y,r&&Br(Dh(t,y,y,0,0,n,o,V,n,b=[],s),w),n,w,s,o,r?b:w);break;default:z4(x,y,y,y,[""],w,0,o,w)}}v=h=g=0,f=M=1,V=x="",s=i;break;case 58:s=1+R2(x),g=p;default:if(f<1){if(m==123)--f;else if(m==125&&f++==0&&zS()==125)continue}switch(x+=mi(m),m*f){case 38:M=h>0?1:(x+="\f",-1);break;case 44:o[v++]=(R2(x)-1)*M,M=1;break;case 64:q2()===45&&(x+=p4(r2())),u=q2(),h=s=R2(V=x+=VS(f4())),m++;break;case 45:p===45&&R2(x)==2&&(f=0)}}return l}function Dh(t,e,a,r,n,l,i,o,c,v,h){for(var s=n-1,u=n===0?l:[""],g=d3(u),p=0,f=0,z=0;p<r;++p)for(var M=0,m=F0(t,s+1,s=vS(f=i[p])),V=t;M<g;++M)(V=Of(f>0?u[M]+" "+m:D1(m,/&\f/g,u[M])))&&(c[z++]=V);return Vi(t,e,a,n===0?s3:o,c,v,h)}function bS(t,e,a){return Vi(t,e,a,h3,mi(pS()),F0(t,2,-2),0)}function Fh(t,e,a,r){return Vi(t,e,a,v3,F0(t,0,r),F0(t,r+1,-1),r)}function Aa(t,e){for(var a="",r=d3(t),n=0;n<r;n++)a+=e(t[n],n,t,e)||"";return a}function yS(t,e,a,r){switch(t.type){case sS:if(t.children.length)break;case hS:case v3:return t.return=t.return||t.value;case h3:return"";case Lf:return t.return=t.value+"{"+Aa(t.children,r)+"}";case s3:t.value=t.props.join(",")}return R2(a=Aa(t.children,r))?t.return=t.value+"{"+a+"}":""}function xS(t){var e=d3(t);return function(a,r,n,l){for(var i="",o=0;o<e;o++)i+=t[o](a,r,n,l)||"";return i}}function LS(t){return function(e){e.root||(e=e.return)&&t(e)}}var qh=function(e){var a=new WeakMap;return function(r){if(a.has(r))return a.get(r);var n=e(r);return a.set(r,n),n}};function OS(t){var e=Object.create(null);return function(a){return e[a]===void 0&&(e[a]=t(a)),e[a]}}var SS=function(e,a,r){for(var n=0,l=0;n=l,l=q2(),n===38&&l===12&&(a[r]=1),!q0(l);)r2();return vr(e,Jt)},CS=function(e,a){var r=-1,n=44;do switch(q0(n)){case 0:n===38&&q2()===12&&(a[r]=1),e[r]+=SS(Jt-1,a,r);break;case 2:e[r]+=p4(n);break;case 4:if(n===44){e[++r]=q2()===58?"&\f":"",a[r]=e[r].length;break}default:e[r]+=mi(n)}while(n=r2());return e},BS=function(e,a){return Bf(CS(Cf(e),a))},Wh=new WeakMap,AS=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var a=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&a.charCodeAt(0)!==58&&!Wh.get(r))&&!n){Wh.set(e,!0);for(var l=[],i=BS(a,l),o=r.props,c=0,v=0;c<i.length;c++)for(var h=0;h<o.length;h++,v++)e.props[v]=l[c]?i[c].replace(/&\f/g,o[h]):o[h]+" "+i[c]}}},ES=function(e){if(e.type==="decl"){var a=e.value;a.charCodeAt(0)===108&&a.charCodeAt(2)===98&&(e.return="",e.value="")}},PS="emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason",IS=function(e){return e.type==="comm"&&e.children.indexOf(PS)>-1},RS=function(e){return function(a,r,n){if(!(a.type!=="rule"||e.compat)){var l=a.value.match(/(:first|:nth|:nth-last)-child/g);if(l){for(var i=!!a.parent,o=i?a.parent.children:n,c=o.length-1;c>=0;c--){var v=o[c];if(v.line<a.line)break;if(v.column<a.column){if(IS(v))return;break}}l.forEach(function(h){console.error('The pseudo class "'+h+'" is potentially unsafe when doing server-side rendering. Try changing it to "'+h.split("-child")[0]+'-of-type".')})}}}},Af=function(e){return e.type.charCodeAt(1)===105&&e.type.charCodeAt(0)===64},kS=function(e,a){for(var r=e-1;r>=0;r--)if(!Af(a[r]))return!0;return!1},Kh=function(e){e.type="",e.value="",e.return="",e.children="",e.props=""},NS=function(e,a,r){Af(e)&&(e.parent?(console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."),Kh(e)):kS(a,r)&&(console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."),Kh(e)))};function Ef(t,e){switch(uS(t,e)){case 5103:return j1+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return j1+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return j1+t+I4+t+Pt+t+t;case 6828:case 4268:return j1+t+Pt+t+t;case 6165:return j1+t+Pt+"flex-"+t+t;case 5187:return j1+t+D1(t,/(\w+).+(:[^]+)/,j1+"box-$1$2"+Pt+"flex-$1$2")+t;case 5443:return j1+t+Pt+"flex-item-"+D1(t,/flex-|-self/,"")+t;case 4675:return j1+t+Pt+"flex-line-pack"+D1(t,/align-content|flex-|-self/,"")+t;case 5548:return j1+t+Pt+D1(t,"shrink","negative")+t;case 5292:return j1+t+Pt+D1(t,"basis","preferred-size")+t;case 6060:return j1+"box-"+D1(t,"-grow","")+j1+t+Pt+D1(t,"grow","positive")+t;case 4554:return j1+D1(t,/([^-])(transform)/g,"$1"+j1+"$2")+t;case 6187:return D1(D1(D1(t,/(zoom-|grab)/,j1+"$1"),/(image-set)/,j1+"$1"),t,"")+t;case 5495:case 3959:return D1(t,/(image-set\([^]*)/,j1+"$1$`$1");case 4968:return D1(D1(t,/(.+:)(flex-)?(.*)/,j1+"box-pack:$3"+Pt+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+j1+t+t;case 4095:case 3583:case 4068:case 2532:return D1(t,/(.+)-inline(.+)/,j1+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(R2(t)-1-e>6)switch(Lt(t,e+1)){case 109:if(Lt(t,e+4)!==45)break;case 102:return D1(t,/(.+:)(.+)-([^]+)/,"$1"+j1+"$2-$3$1"+I4+(Lt(t,e+3)==108?"$3":"$2-$3"))+t;case 115:return~uc(t,"stretch")?Ef(D1(t,"stretch","fill-available"),e)+t:t}break;case 4949:if(Lt(t,e+1)!==115)break;case 6444:switch(Lt(t,R2(t)-3-(~uc(t,"!important")&&10))){case 107:return D1(t,":",":"+j1)+t;case 101:return D1(t,/(.+:)([^;!]+)(;|!.+)?/,"$1"+j1+(Lt(t,14)===45?"inline-":"")+"box$3$1"+j1+"$2$3$1"+Pt+"$2box$3")+t}break;case 5936:switch(Lt(t,e+11)){case 114:return j1+t+Pt+D1(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return j1+t+Pt+D1(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return j1+t+Pt+D1(t,/[svh]\w+-[tblr]{2}/,"lr")+t}return j1+t+Pt+t+t}return t}var TS=function(e,a,r,n){if(e.length>-1&&!e.return)switch(e.type){case v3:e.return=Ef(e.value,e.length);break;case Lf:return Aa([u0(e,{value:D1(e.value,"@","@"+j1)})],n);case s3:if(e.length)return fS(e.props,function(l){switch(gS(l,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Aa([u0(e,{props:[D1(l,/:(read-\w+)/,":"+I4+"$1")]})],n);case"::placeholder":return Aa([u0(e,{props:[D1(l,/:(plac\w+)/,":"+j1+"input-$1")]}),u0(e,{props:[D1(l,/:(plac\w+)/,":"+I4+"$1")]}),u0(e,{props:[D1(l,/:(plac\w+)/,Pt+"input-$1")]})],n)}return""})}},jS=[TS],wi=function(e){var a=e.key;if(process.env.NODE_ENV!=="production"&&!a)throw new Error(`You have to configure \`key\` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.
|
|
3
3
|
If multiple caches share the same key they might "fight" for each other's style elements.`);if(a==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(f){var z=f.getAttribute("data-emotion");z.indexOf(" ")!==-1&&(document.head.appendChild(f),f.setAttribute("data-s",""))})}var n=e.stylisPlugins||jS;if(process.env.NODE_ENV!=="production"&&/[^a-z-]/.test(a))throw new Error('Emotion key must only contain lower case alphabetical characters and - but "'+a+'" was passed');var l={},i,o=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+a+' "]'),function(f){for(var z=f.getAttribute("data-emotion").split(" "),M=1;M<z.length;M++)l[z[M]]=!0;o.push(f)});var c,v=[AS,ES];process.env.NODE_ENV!=="production"&&v.push(RS({get compat(){return p.compat}}),NS);{var h,s=[yS,process.env.NODE_ENV!=="production"?function(f){f.root||(f.return?h.insert(f.return):f.value&&f.type!==h3&&h.insert(f.value+"{}"))}:LS(function(f){h.insert(f)})],u=xS(v.concat(n,s)),g=function(z){return Aa(wS(z),u)};c=function(z,M,m,V){h=m,process.env.NODE_ENV!=="production"&&M.map!==void 0&&(h={insert:function(w){m.insert(w+M.map)}}),g(z?z+"{"+M.styles+"}":M.styles),V&&(p.inserted[M.name]=!0)}}var p={key:a,sheet:new cS({key:a,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:l,registered:{},insert:c};return p.sheet.hydrate(o),p};function fc(){return fc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r])}return t},fc.apply(this,arguments)}var R4={exports:{}},F1={};/** @license React v16.13.1
|
|
4
4
|
* react-is.production.min.js
|
|
@@ -203,4 +203,4 @@ object-assign/index.js:
|
|
|
203
203
|
(c) Sindre Sorhus
|
|
204
204
|
@license MIT
|
|
205
205
|
*)
|
|
206
|
-
*/j();var $c1=process.env.NODE_ENV!=="production"?_c1:()=>null;const t31={};class dO extends d.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?r1.jsxRuntimeExports.jsxs("div",{className:"bg-red-200 h-full w-full rounded-md text-red-500 p-4",id:"errorBoundary",children:[r1.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),r1.jsxRuntimeExports.jsx("p",{children:"Please try again later."})]}):this.props.children}}const e31=()=>{const[t,e]=o1.usePreviewMode(),a=o1.useBuilderProp("previewComponent");return r1.jsxRuntimeExports.jsxs("div",{className:qO.cn("fixed inset-0 z-[999] bg-background",t?"block":"hidden"),children:[r1.jsxRuntimeExports.jsx(o1.Button,{size:"sm",className:"absolute right-0 top-0 m-4",onClick:()=>e(!1),children:"Close Preview"}),r1.jsxRuntimeExports.jsx("div",{children:a?r1.jsxRuntimeExports.jsx(d.Suspense,{fallback:r1.jsxRuntimeExports.jsx(o1.Skeleton,{className:"h-96 w-full"}),children:d.createElement(a)}):null})]})},a31=()=>{const[t,e]=o1.useSelectedBlockIds(),[,a]=o1.useCopyBlockIds(),r=o1.useRemoveBlocks(),n=o1.useDuplicateBlocks(),[,l]=o1.useCutBlockIds(),{pasteBlocks:i}=o1.usePasteBlocks(),{undo:o,redo:c}=o1.useCanvasHistory();ne.useHotkeys("esc",()=>e([]),{},[e]),ne.useHotkeys("ctrl+c,command+c",()=>a(t),{},[t,a]),ne.useHotkeys("ctrl+d,command+d",()=>n(t),{preventDefault:!0},[t,n]),ne.useHotkeys("ctrl+x,command+x",()=>l(t),{},[t,l]),ne.useHotkeys("ctrl+v,command+v",()=>t.length===1?i(t[0]):null,{},[t,i]),ne.useHotkeys("ctrl+z,command+z",()=>o(),{},[o]),ne.useHotkeys("ctrl+y,command+y",()=>c(),{},[c]),ne.useHotkeys("del, backspace",v=>{v.preventDefault(),r(t)},{},[t,r])},r31=(t,e)=>{const a=[];let r=rt.find(t,{_id:e}),n=rt.get(r,"_parent","");for(;rt.isString(n)&&!rt.isEmpty(n);)a.push(r==null?void 0:r._parent),r=rt.find(t,{_id:n}),n=r==null?void 0:r._parent;return rt.flatten(a)},uO=be.atom([]),n31=()=>{const[t]=o1.useSelectedBlockIds(),e=be.useAtomValue(o1.presentBlocksAtom),[,a]=be.useAtom(uO);d.useEffect(()=>{let r=[];const n=rt.first(t);rt.isString(n)&&(r=[n,...r31(e,n)]),a(r)},[t,e,a])},l31=()=>be.useAtomValue(uO),gO=()=>be.useAtom(o1.chaiExternalDataAtom),i31=()=>d.useMemo(()=>wf.getChaiDataProviders(),[]),o31=({children:t})=>{const[,e]=gO(),[a]=o1.usePageDataProviders(),r=i31();return d.useEffect(()=>(e({}),rt.each(a,n=>{const l=rt.find(r,{providerKey:n.providerKey});if(l){const i=(l==null?void 0:l.mockFn)||(l==null?void 0:l.dataFn);i&&i(n.args).then(o=>e(c=>({...c,[n.providerKey]:o})))}}),()=>{rt.each(a,n=>{e(l=>(delete l[n.providerKey],l))})}),[r,a,e]),r1.jsxRuntimeExports.jsx(r1.jsxRuntimeExports.Fragment,{children:t})},c31=d.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-PcCVJHFu.cjs"))),h31=d.lazy(()=>Promise.resolve().then(()=>require("./Topbar-p07CgA1J.cjs"))),s31=d.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-SzwU-7i5.cjs"))),v31=d.lazy(()=>Promise.resolve().then(()=>require("./Settings-zqxhKtAP.cjs"))),d31=()=>{const[t]=be.useAtom(o1.pageSyncStateAtom),e=n=>{o1.isDevelopment()||n.preventDefault()};a31(),n31(),d.useEffect(()=>(t!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[t]);const a=o1.useBuilderProp("editable",!0),r=o1.useBuilderProp("nonEditableComponent",null);return r1.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-background text-foreground",children:r1.jsxRuntimeExports.jsxs(o1.TooltipProvider,{children:[r1.jsxRuntimeExports.jsxs("div",{onContextMenu:e,className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[r1.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:r1.jsxRuntimeExports.jsx(h31,{})})}),r1.jsxRuntimeExports.jsxs("main",{className:"flex h-full flex-row relative",children:[a?null:r1.jsxRuntimeExports.jsx("div",{className:"absolute backdrop-blur-[2px] flex items-center justify-center inset-0 z-[500] h-full w-full",children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:d.createElement(r)})}),r1.jsxRuntimeExports.jsx("div",{className:"flex h-full w-fit border-border max-h-full",style:{maxHeight:"calc(100vh - 56px)"},children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:r1.jsxRuntimeExports.jsx(c31,{})})}),r1.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:r1.jsxRuntimeExports.jsx(s31,{})})}),r1.jsxRuntimeExports.jsx("div",{className:"flex h-full w-[280px] min-w-[280px] border-l border-border",children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:r1.jsxRuntimeExports.jsx(v31,{})})})]})]}),r1.jsxRuntimeExports.jsx(e31,{})]})})},_g=be.getDefaultStore();var u31={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};u31.NODE_ENV==="development"&&console.log("Chai Builder:",QO);const g31=t=>r1.jsxRuntimeExports.jsx(r1.jsxRuntimeExports.Fragment,{children:t.children}),f31=t=>{const{dndOptions:e={backend:jh.MultiBackend}}=t,[a]=o1.useSetAllBlocks(),[,r]=o1.useBrandingOptions(),n=o1.useBuilderReset();return d.useEffect(()=>{_g.set(o1.chaiBuilderPropsAtom,rt.omit(t,["blocks","subPages","brandingOptions","dataProvidersAtom"]))},[t]),d.useEffect(()=>{_g.set(o1.dataProvidersAtom,t.dataProviders||[])},[t.dataProviders]),d.useEffect(()=>{a(wf.syncBlocksWithDefaults(t.blocks||[])),n()},[t.blocks]),d.useEffect(()=>{r(t.brandingOptions)},[t.brandingOptions,r]),r1.jsxRuntimeExports.jsx(DO.DndProvider,{...e,options:jh.getBackendOptions(),children:r1.jsxRuntimeExports.jsx(g31,{children:r1.jsxRuntimeExports.jsx(d31,{})})})},fO=t=>r1.jsxRuntimeExports.jsxs(dO,{children:[r1.jsxRuntimeExports.jsxs(jO.FlagsProvider,{features:t31,children:[r1.jsxRuntimeExports.jsx($c1,{}),r1.jsxRuntimeExports.jsx(f31,{...t})]}),r1.jsxRuntimeExports.jsx(o1.Toaster,{})]});var s0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},r0=typeof window>"u"||"Deno"in window;function g2(){}function p31(t,e){return typeof t=="function"?t(e):t}function Jc(t){return typeof t=="number"&&t>=0&&t!==1/0}function pO(t,e){return Math.max(t+(e||0)-Date.now(),0)}function $g(t,e){const{type:a="all",exact:r,fetchStatus:n,predicate:l,queryKey:i,stale:o}=t;if(i){if(r){if(e.queryHash!==Rh(i,e.options))return!1}else if(!_0(e.queryKey,i))return!1}if(a!=="all"){const c=e.isActive();if(a==="active"&&!c||a==="inactive"&&c)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||typeof n<"u"&&n!==e.state.fetchStatus||l&&!l(e))}function tf(t,e){const{exact:a,status:r,predicate:n,mutationKey:l}=t;if(l){if(!e.options.mutationKey)return!1;if(a){if(X0(e.options.mutationKey)!==X0(l))return!1}else if(!_0(e.options.mutationKey,l))return!1}return!(r&&e.state.status!==r||n&&!n(e))}function Rh(t,e){return((e==null?void 0:e.queryKeyHashFn)||X0)(t)}function X0(t){return JSON.stringify(t,(e,a)=>Yc(a)?Object.keys(a).sort().reduce((r,n)=>(r[n]=a[n],r),{}):a)}function _0(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(a=>!_0(t[a],e[a])):!1}function zO(t,e){if(t===e)return t;const a=ef(t)&&ef(e);if(a||Yc(t)&&Yc(e)){const r=a?t.length:Object.keys(t).length,n=a?e:Object.keys(e),l=n.length,i=a?[]:{};let o=0;for(let c=0;c<l;c++){const v=a?c:n[c];i[v]=zO(t[v],e[v]),i[v]===t[v]&&o++}return r===l&&o===r?t:i}return e}function fi(t,e){if(t&&!e||e&&!t)return!1;for(const a in t)if(t[a]!==e[a])return!1;return!0}function ef(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Yc(t){if(!af(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const a=e.prototype;return!(!af(a)||!a.hasOwnProperty("isPrototypeOf"))}function af(t){return Object.prototype.toString.call(t)==="[object Object]"}function MO(t){return new Promise(e=>{setTimeout(e,t)})}function rf(t){MO(0).then(t)}function Qc(t,e,a){return typeof a.structuralSharing=="function"?a.structuralSharing(t,e):a.structuralSharing!==!1?zO(t,e):e}function z31(t,e,a=0){const r=[...t,e];return a&&r.length>a?r.slice(1):r}function M31(t,e,a=0){const r=[e,...t];return a&&r.length>a?r.slice(0,-1):r}var qe,se,Ia,sf,m31=(sf=class extends s0{constructor(){super();z1(this,qe,void 0);z1(this,se,void 0);z1(this,Ia,void 0);u1(this,Ia,e=>{if(!r0&&window.addEventListener){const a=()=>e();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){B(this,se)||this.setEventListener(B(this,Ia))}onUnsubscribe(){var e;this.hasListeners()||((e=B(this,se))==null||e.call(this),u1(this,se,void 0))}setEventListener(e){var a;u1(this,Ia,e),(a=B(this,se))==null||a.call(this),u1(this,se,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){B(this,qe)!==e&&(u1(this,qe,e),this.onFocus())}onFocus(){this.listeners.forEach(e=>{e()})}isFocused(){var e;return typeof B(this,qe)=="boolean"?B(this,qe):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qe=new WeakMap,se=new WeakMap,Ia=new WeakMap,sf),pi=new m31,Ra,ve,ka,vf,H31=(vf=class extends s0{constructor(){super();z1(this,Ra,!0);z1(this,ve,void 0);z1(this,ka,void 0);u1(this,ka,e=>{if(!r0&&window.addEventListener){const a=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",r)}}})}onSubscribe(){B(this,ve)||this.setEventListener(B(this,ka))}onUnsubscribe(){var e;this.hasListeners()||((e=B(this,ve))==null||e.call(this),u1(this,ve,void 0))}setEventListener(e){var a;u1(this,ka,e),(a=B(this,ve))==null||a.call(this),u1(this,ve,e(this.setOnline.bind(this)))}setOnline(e){B(this,Ra)!==e&&(u1(this,Ra,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return B(this,Ra)}},Ra=new WeakMap,ve=new WeakMap,ka=new WeakMap,vf),zi=new H31;function V31(t){return Math.min(1e3*2**t,3e4)}function ao(t){return(t??"online")==="online"?zi.isOnline():!0}var mO=class{constructor(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function dc(t){return t instanceof mO}function HO(t){let e=!1,a=0,r=!1,n,l,i;const o=new Promise((z,M)=>{l=z,i=M}),c=z=>{var M;r||(g(new mO(z)),(M=t.abort)==null||M.call(t))},v=()=>{e=!0},h=()=>{e=!1},s=()=>!pi.isFocused()||t.networkMode!=="always"&&!zi.isOnline(),u=z=>{var M;r||(r=!0,(M=t.onSuccess)==null||M.call(t,z),n==null||n(),l(z))},g=z=>{var M;r||(r=!0,(M=t.onError)==null||M.call(t,z),n==null||n(),i(z))},p=()=>new Promise(z=>{var M;n=m=>{const V=r||!s();return V&&z(m),V},(M=t.onPause)==null||M.call(t)}).then(()=>{var z;n=void 0,r||(z=t.onContinue)==null||z.call(t)}),f=()=>{if(r)return;let z;try{z=t.fn()}catch(M){z=Promise.reject(M)}Promise.resolve(z).then(u).catch(M=>{var y;if(r)return;const m=t.retry??(r0?0:3),V=t.retryDelay??V31,b=typeof V=="function"?V(a,M):V,w=m===!0||typeof m=="number"&&a<m||typeof m=="function"&&m(a,M);if(e||!w){g(M);return}a++,(y=t.onFail)==null||y.call(t,a,M),MO(b).then(()=>{if(s())return p()}).then(()=>{e?g(M):f()})})};return ao(t.networkMode)?f():p().then(f),{promise:o,cancel:c,continue:()=>(n==null?void 0:n())?o:Promise.resolve(),cancelRetry:v,continueRetry:h}}function w31(){let t=[],e=0,a=h=>{h()},r=h=>{h()};const n=h=>{let s;e++;try{s=h()}finally{e--,e||o()}return s},l=h=>{e?t.push(h):rf(()=>{a(h)})},i=h=>(...s)=>{l(()=>{h(...s)})},o=()=>{const h=t;t=[],h.length&&rf(()=>{r(()=>{h.forEach(s=>{a(s)})})})};return{batch:n,batchCalls:i,schedule:l,setNotifyFunction:h=>{a=h},setBatchNotifyFunction:h=>{r=h}}}var zt=w31(),We,df,VO=(df=class{constructor(){z1(this,We,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jc(this.gcTime)&&u1(this,We,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(r0?1/0:5*60*1e3))}clearGcTimeout(){B(this,We)&&(clearTimeout(B(this,We)),u1(this,We,void 0))}},We=new WeakMap,df),Na,Ta,s2,de,v2,yt,$0,Ke,ja,A4,V2,G2,uf,b31=(uf=class extends VO{constructor(e){super();z1(this,ja);z1(this,V2);z1(this,Na,void 0);z1(this,Ta,void 0);z1(this,s2,void 0);z1(this,de,void 0);z1(this,v2,void 0);z1(this,yt,void 0);z1(this,$0,void 0);z1(this,Ke,void 0);u1(this,Ke,!1),u1(this,$0,e.defaultOptions),C1(this,ja,A4).call(this,e.options),u1(this,yt,[]),u1(this,s2,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,u1(this,Na,e.state||y31(this.options)),this.state=B(this,Na),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!B(this,yt).length&&this.state.fetchStatus==="idle"&&B(this,s2).remove(this)}setData(e,a){const r=Qc(this.state.data,e,this.options);return C1(this,V2,G2).call(this,{data:r,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),r}setState(e,a){C1(this,V2,G2).call(this,{type:"setState",state:e,setStateOptions:a})}cancel(e){var r;const a=B(this,de);return(r=B(this,v2))==null||r.cancel(e),a?a.then(g2).catch(g2):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(B(this,Na))}isActive(){return B(this,yt).some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||B(this,yt).some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!pO(this.state.dataUpdatedAt,e)}onFocus(){var a;const e=B(this,yt).find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(a=B(this,v2))==null||a.continue()}onOnline(){var a;const e=B(this,yt).find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(a=B(this,v2))==null||a.continue()}addObserver(e){B(this,yt).includes(e)||(B(this,yt).push(e),this.clearGcTimeout(),B(this,s2).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){B(this,yt).includes(e)&&(u1(this,yt,B(this,yt).filter(a=>a!==e)),B(this,yt).length||(B(this,v2)&&(B(this,Ke)?B(this,v2).cancel({revert:!0}):B(this,v2).cancelRetry()),this.scheduleGc()),B(this,s2).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return B(this,yt).length}invalidate(){this.state.isInvalidated||C1(this,V2,G2).call(this,{type:"invalidate"})}fetch(e,a){var v,h,s,u;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(B(this,de))return(v=B(this,v2))==null||v.continueRetry(),B(this,de)}if(e&&C1(this,ja,A4).call(this,e),!this.options.queryFn){const g=B(this,yt).find(p=>p.options.queryFn);g&&C1(this,ja,A4).call(this,g.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 r=new AbortController,n={queryKey:this.queryKey,meta:this.meta},l=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(u1(this,Ke,!0),r.signal)})};l(n);const i=()=>this.options.queryFn?(u1(this,Ke,!1),this.options.persister?this.options.persister(this.options.queryFn,n,this):this.options.queryFn(n)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),o={fetchOptions:a,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};l(o),(h=this.options.behavior)==null||h.onFetch(o,this),u1(this,Ta,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((s=o.fetchOptions)==null?void 0:s.meta))&&C1(this,V2,G2).call(this,{type:"fetch",meta:(u=o.fetchOptions)==null?void 0:u.meta});const c=g=>{var p,f,z,M;dc(g)&&g.silent||C1(this,V2,G2).call(this,{type:"error",error:g}),dc(g)||((f=(p=B(this,s2).config).onError)==null||f.call(p,g,this),(M=(z=B(this,s2).config).onSettled)==null||M.call(z,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return u1(this,v2,HO({fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var p,f,z,M;if(typeof g>"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}`),c(new Error(`${this.queryHash} data is undefined`));return}this.setData(g),(f=(p=B(this,s2).config).onSuccess)==null||f.call(p,g,this),(M=(z=B(this,s2).config).onSettled)==null||M.call(z,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:c,onFail:(g,p)=>{C1(this,V2,G2).call(this,{type:"failed",failureCount:g,error:p})},onPause:()=>{C1(this,V2,G2).call(this,{type:"pause"})},onContinue:()=>{C1(this,V2,G2).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode})),u1(this,de,B(this,v2).promise),B(this,de)}},Na=new WeakMap,Ta=new WeakMap,s2=new WeakMap,de=new WeakMap,v2=new WeakMap,yt=new WeakMap,$0=new WeakMap,Ke=new WeakMap,ja=new WeakSet,A4=function(e){this.options={...B(this,$0),...e},this.updateGcTime(this.options.gcTime)},V2=new WeakSet,G2=function(e){const a=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:ao(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return dc(n)&&n.revert&&B(this,Ta)?{...B(this,Ta),fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=a(this.state),zt.batch(()=>{B(this,yt).forEach(r=>{r.onQueryUpdate()}),B(this,s2).notify({query:this,type:"updated",action:e})})},uf);function y31(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,a=typeof e<"u",r=a?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:a?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var A2,gf,x31=(gf=class extends s0{constructor(e={}){super();z1(this,A2,void 0);this.config=e,u1(this,A2,new Map)}build(e,a,r){const n=a.queryKey,l=a.queryHash??Rh(n,a);let i=this.get(l);return i||(i=new b31({cache:this,queryKey:n,queryHash:l,options:e.defaultQueryOptions(a),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(i)),i}add(e){B(this,A2).has(e.queryHash)||(B(this,A2).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const a=B(this,A2).get(e.queryHash);a&&(e.destroy(),a===e&&B(this,A2).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){zt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return B(this,A2).get(e)}getAll(){return[...B(this,A2).values()]}find(e){const a={exact:!0,...e};return this.getAll().find(r=>$g(a,r))}findAll(e={}){const a=this.getAll();return Object.keys(e).length>0?a.filter(r=>$g(e,r)):a}notify(e){zt.batch(()=>{this.listeners.forEach(a=>{a(e)})})}onFocus(){zt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){zt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},A2=new WeakMap,gf),E2,tr,$t,Da,P2,he,ff,L31=(ff=class extends VO{constructor(e){super();z1(this,P2);z1(this,E2,void 0);z1(this,tr,void 0);z1(this,$t,void 0);z1(this,Da,void 0);this.mutationId=e.mutationId,u1(this,tr,e.defaultOptions),u1(this,$t,e.mutationCache),u1(this,E2,[]),this.state=e.state||wO(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...B(this,tr),...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){B(this,E2).includes(e)||(B(this,E2).push(e),this.clearGcTimeout(),B(this,$t).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){u1(this,E2,B(this,E2).filter(a=>a!==e)),this.scheduleGc(),B(this,$t).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){B(this,E2).length||(this.state.status==="pending"?this.scheduleGc():B(this,$t).remove(this))}continue(){var e;return((e=B(this,Da))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var n,l,i,o,c,v,h,s,u,g,p,f,z,M,m,V,b,w,y,x;const a=()=>(u1(this,Da,HO({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(L,S)=>{C1(this,P2,he).call(this,{type:"failed",failureCount:L,error:S})},onPause:()=>{C1(this,P2,he).call(this,{type:"pause"})},onContinue:()=>{C1(this,P2,he).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),B(this,Da).promise),r=this.state.status==="pending";try{if(!r){C1(this,P2,he).call(this,{type:"pending",variables:e}),await((l=(n=B(this,$t).config).onMutate)==null?void 0:l.call(n,e,this));const S=await((o=(i=this.options).onMutate)==null?void 0:o.call(i,e));S!==this.state.context&&C1(this,P2,he).call(this,{type:"pending",context:S,variables:e})}const L=await a();return await((v=(c=B(this,$t).config).onSuccess)==null?void 0:v.call(c,L,e,this.state.context,this)),await((s=(h=this.options).onSuccess)==null?void 0:s.call(h,L,e,this.state.context)),await((g=(u=B(this,$t).config).onSettled)==null?void 0:g.call(u,L,null,this.state.variables,this.state.context,this)),await((f=(p=this.options).onSettled)==null?void 0:f.call(p,L,null,e,this.state.context)),C1(this,P2,he).call(this,{type:"success",data:L}),L}catch(L){try{throw await((M=(z=B(this,$t).config).onError)==null?void 0:M.call(z,L,e,this.state.context,this)),await((V=(m=this.options).onError)==null?void 0:V.call(m,L,e,this.state.context)),await((w=(b=B(this,$t).config).onSettled)==null?void 0:w.call(b,void 0,L,this.state.variables,this.state.context,this)),await((x=(y=this.options).onSettled)==null?void 0:x.call(y,void 0,L,e,this.state.context)),L}finally{C1(this,P2,he).call(this,{type:"error",error:L})}}}},E2=new WeakMap,tr=new WeakMap,$t=new WeakMap,Da=new WeakMap,P2=new WeakSet,he=function(e){const a=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!ao(this.options.networkMode),status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=a(this.state),zt.batch(()=>{B(this,E2).forEach(r=>{r.onMutationUpdate(e)}),B(this,$t).notify({mutation:this,type:"updated",action:e})})},ff);function wO(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var d2,er,Ue,pf,O31=(pf=class extends s0{constructor(e={}){super();z1(this,d2,void 0);z1(this,er,void 0);z1(this,Ue,void 0);this.config=e,u1(this,d2,[]),u1(this,er,0)}build(e,a,r){const n=new L31({mutationCache:this,mutationId:++Cr(this,er)._,options:e.defaultMutationOptions(a),state:r});return this.add(n),n}add(e){B(this,d2).push(e),this.notify({type:"added",mutation:e})}remove(e){u1(this,d2,B(this,d2).filter(a=>a!==e)),this.notify({type:"removed",mutation:e})}clear(){zt.batch(()=>{B(this,d2).forEach(e=>{this.remove(e)})})}getAll(){return B(this,d2)}find(e){const a={exact:!0,...e};return B(this,d2).find(r=>tf(a,r))}findAll(e={}){return B(this,d2).filter(a=>tf(e,a))}notify(e){zt.batch(()=>{this.listeners.forEach(a=>{a(e)})})}resumePausedMutations(){return u1(this,Ue,(B(this,Ue)??Promise.resolve()).then(()=>{const e=B(this,d2).filter(a=>a.state.isPaused);return zt.batch(()=>e.reduce((a,r)=>a.then(()=>r.continue().catch(g2)),Promise.resolve()))}).then(()=>{u1(this,Ue,void 0)})),B(this,Ue)}},d2=new WeakMap,er=new WeakMap,Ue=new WeakMap,pf);function S31(t){return{onFetch:(e,a)=>{const r=async()=>{var p,f,z,M,m;const n=e.options,l=(z=(f=(p=e.fetchOptions)==null?void 0:p.meta)==null?void 0:f.fetchMore)==null?void 0:z.direction,i=((M=e.state.data)==null?void 0:M.pages)||[],o=((m=e.state.data)==null?void 0:m.pageParams)||[],c={pages:[],pageParams:[]};let v=!1;const h=V=>{Object.defineProperty(V,"signal",{enumerable:!0,get:()=>(e.signal.aborted?v=!0:e.signal.addEventListener("abort",()=>{v=!0}),e.signal)})},s=e.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${e.options.queryHash}'`))),u=async(V,b,w)=>{if(v)return Promise.reject();if(b==null&&V.pages.length)return Promise.resolve(V);const y={queryKey:e.queryKey,pageParam:b,direction:w?"backward":"forward",meta:e.options.meta};h(y);const x=await s(y),{maxPages:L}=e.options,S=w?M31:z31;return{pages:S(V.pages,x,L),pageParams:S(V.pageParams,b,L)}};let g;if(l&&i.length){const V=l==="backward",b=V?C31:nf,w={pages:i,pageParams:o},y=b(n,w);g=await u(w,y,V)}else{g=await u(c,o[0]??n.initialPageParam);const V=t??i.length;for(let b=1;b<V;b++){const w=nf(n,g);g=await u(g,w)}}return g};e.options.persister?e.fetchFn=()=>{var n,l;return(l=(n=e.options).persister)==null?void 0:l.call(n,r,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},a)}:e.fetchFn=r}}}function nf(t,{pages:e,pageParams:a}){const r=e.length-1;return t.getNextPageParam(e[r],e,a[r],a)}function C31(t,{pages:e,pageParams:a}){var r;return(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,a[0],a)}var ft,ue,ge,Fa,qa,fe,Wa,Ka,zf,B31=(zf=class{constructor(t={}){z1(this,ft,void 0);z1(this,ue,void 0);z1(this,ge,void 0);z1(this,Fa,void 0);z1(this,qa,void 0);z1(this,fe,void 0);z1(this,Wa,void 0);z1(this,Ka,void 0);u1(this,ft,t.queryCache||new x31),u1(this,ue,t.mutationCache||new O31),u1(this,ge,t.defaultOptions||{}),u1(this,Fa,new Map),u1(this,qa,new Map),u1(this,fe,0)}mount(){Cr(this,fe)._++,B(this,fe)===1&&(u1(this,Wa,pi.subscribe(()=>{pi.isFocused()&&(this.resumePausedMutations(),B(this,ft).onFocus())})),u1(this,Ka,zi.subscribe(()=>{zi.isOnline()&&(this.resumePausedMutations(),B(this,ft).onOnline())})))}unmount(){var t,e;Cr(this,fe)._--,B(this,fe)===0&&((t=B(this,Wa))==null||t.call(this),u1(this,Wa,void 0),(e=B(this,Ka))==null||e.call(this),u1(this,Ka,void 0))}isFetching(t){return B(this,ft).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return B(this,ue).findAll({...t,status:"pending"}).length}getQueryData(t){var e;return(e=B(this,ft).find({queryKey:t}))==null?void 0:e.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);return e!==void 0?Promise.resolve(e):this.fetchQuery(t)}getQueriesData(t){return this.getQueryCache().findAll(t).map(({queryKey:e,state:a})=>{const r=a.data;return[e,r]})}setQueryData(t,e,a){const r=B(this,ft).find({queryKey:t}),n=r==null?void 0:r.state.data,l=p31(e,n);if(typeof l>"u")return;const i=this.defaultQueryOptions({queryKey:t});return B(this,ft).build(this,i).setData(l,{...a,manual:!0})}setQueriesData(t,e,a){return zt.batch(()=>this.getQueryCache().findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,a)]))}getQueryState(t){var e;return(e=B(this,ft).find({queryKey:t}))==null?void 0:e.state}removeQueries(t){const e=B(this,ft);zt.batch(()=>{e.findAll(t).forEach(a=>{e.remove(a)})})}resetQueries(t,e){const a=B(this,ft),r={type:"active",...t};return zt.batch(()=>(a.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const a={revert:!0,...e},r=zt.batch(()=>B(this,ft).findAll(t).map(n=>n.cancel(a)));return Promise.all(r).then(g2).catch(g2)}invalidateQueries(t={},e={}){return zt.batch(()=>{if(B(this,ft).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const a={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(a,e)})}refetchQueries(t={},e){const a={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=zt.batch(()=>B(this,ft).findAll(t).filter(n=>!n.isDisabled()).map(n=>{let l=n.fetch(void 0,a);return a.throwOnError||(l=l.catch(g2)),n.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(r).then(g2)}fetchQuery(t){const e=this.defaultQueryOptions(t);typeof e.retry>"u"&&(e.retry=!1);const a=B(this,ft).build(this,e);return a.isStaleByTime(e.staleTime)?a.fetch(e):Promise.resolve(a.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(g2).catch(g2)}fetchInfiniteQuery(t){return t.behavior=S31(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(g2).catch(g2)}resumePausedMutations(){return B(this,ue).resumePausedMutations()}getQueryCache(){return B(this,ft)}getMutationCache(){return B(this,ue)}getDefaultOptions(){return B(this,ge)}setDefaultOptions(t){u1(this,ge,t)}setQueryDefaults(t,e){B(this,Fa).set(X0(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...B(this,Fa).values()];let a={};return e.forEach(r=>{_0(t,r.queryKey)&&(a={...a,...r.defaultOptions})}),a}setMutationDefaults(t,e){B(this,qa).set(X0(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...B(this,qa).values()];let a={};return e.forEach(r=>{_0(t,r.mutationKey)&&(a={...a,...r.defaultOptions})}),a}defaultQueryOptions(t){if(t!=null&&t._defaulted)return t;const e={...B(this,ge).queries,...(t==null?void 0:t.queryKey)&&this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Rh(e.queryKey,e)),typeof e.refetchOnReconnect>"u"&&(e.refetchOnReconnect=e.networkMode!=="always"),typeof e.throwOnError>"u"&&(e.throwOnError=!!e.suspense),typeof e.networkMode>"u"&&e.persister&&(e.networkMode="offlineFirst"),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...B(this,ge).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){B(this,ft).clear(),B(this,ue).clear()}},ft=new WeakMap,ue=new WeakMap,ge=new WeakMap,Fa=new WeakMap,qa=new WeakMap,fe=new WeakMap,Wa=new WeakMap,Ka=new WeakMap,zf),Ut,Q1,Ua,It,Ze,Za,I2,ar,Ga,Ja,Ge,Je,pe,Ye,Qe,k0,rr,Xc,nr,_c,lr,$c,ir,t3,or,e3,cr,a3,hr,r3,Mi,bO,Mf,A31=(Mf=class extends s0{constructor(e,a){super();z1(this,Qe);z1(this,rr);z1(this,nr);z1(this,lr);z1(this,ir);z1(this,or);z1(this,cr);z1(this,hr);z1(this,Mi);z1(this,Ut,void 0);z1(this,Q1,void 0);z1(this,Ua,void 0);z1(this,It,void 0);z1(this,Ze,void 0);z1(this,Za,void 0);z1(this,I2,void 0);z1(this,ar,void 0);z1(this,Ga,void 0);z1(this,Ja,void 0);z1(this,Ge,void 0);z1(this,Je,void 0);z1(this,pe,void 0);z1(this,Ye,void 0);u1(this,Q1,void 0),u1(this,Ua,void 0),u1(this,It,void 0),u1(this,Ye,new Set),u1(this,Ut,e),this.options=a,u1(this,I2,null),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(B(this,Q1).addObserver(this),lf(B(this,Q1),this.options)?C1(this,Qe,k0).call(this):this.updateResult(),C1(this,ir,t3).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return n3(B(this,Q1),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return n3(B(this,Q1),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,C1(this,or,e3).call(this),C1(this,cr,a3).call(this),B(this,Q1).removeObserver(this)}setOptions(e,a){const r=this.options,n=B(this,Q1);if(this.options=B(this,Ut).defaultQueryOptions(e),fi(r,this.options)||B(this,Ut).getQueryCache().notify({type:"observerOptionsUpdated",query:B(this,Q1),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=r.queryKey),C1(this,hr,r3).call(this);const l=this.hasListeners();l&&of(B(this,Q1),n,this.options,r)&&C1(this,Qe,k0).call(this),this.updateResult(a),l&&(B(this,Q1)!==n||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&C1(this,rr,Xc).call(this);const i=C1(this,nr,_c).call(this);l&&(B(this,Q1)!==n||this.options.enabled!==r.enabled||i!==B(this,pe))&&C1(this,lr,$c).call(this,i)}getOptimisticResult(e){const a=B(this,Ut).getQueryCache().build(B(this,Ut),e),r=this.createResult(a,e);return P31(this,r)&&(u1(this,It,r),u1(this,Za,this.options),u1(this,Ze,B(this,Q1).state)),r}getCurrentResult(){return B(this,It)}trackResult(e){const a={};return Object.keys(e).forEach(r=>{Object.defineProperty(a,r,{configurable:!1,enumerable:!0,get:()=>(B(this,Ye).add(r),e[r])})}),a}getCurrentQuery(){return B(this,Q1)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const a=B(this,Ut).defaultQueryOptions(e),r=B(this,Ut).getQueryCache().build(B(this,Ut),a);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,a))}fetch(e){return C1(this,Qe,k0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),B(this,It)))}createResult(e,a){var y;const r=B(this,Q1),n=this.options,l=B(this,It),i=B(this,Ze),o=B(this,Za),v=e!==r?e.state:B(this,Ua),{state:h}=e;let{error:s,errorUpdatedAt:u,fetchStatus:g,status:p}=h,f=!1,z;if(a._optimisticResults){const x=this.hasListeners(),L=!x&&lf(e,a),S=x&&of(e,r,a,n);(L||S)&&(g=ao(e.options.networkMode)?"fetching":"paused",h.dataUpdatedAt||(p="pending")),a._optimisticResults==="isRestoring"&&(g="idle")}if(a.select&&typeof h.data<"u")if(l&&h.data===(i==null?void 0:i.data)&&a.select===B(this,ar))z=B(this,Ga);else try{u1(this,ar,a.select),z=a.select(h.data),z=Qc(l==null?void 0:l.data,z,a),u1(this,Ga,z),u1(this,I2,null)}catch(x){u1(this,I2,x)}else z=h.data;if(typeof a.placeholderData<"u"&&typeof z>"u"&&p==="pending"){let x;if(l!=null&&l.isPlaceholderData&&a.placeholderData===(o==null?void 0:o.placeholderData))x=l.data;else if(x=typeof a.placeholderData=="function"?a.placeholderData((y=B(this,Ja))==null?void 0:y.state.data,B(this,Ja)):a.placeholderData,a.select&&typeof x<"u")try{x=a.select(x),u1(this,I2,null)}catch(L){u1(this,I2,L)}typeof x<"u"&&(p="success",z=Qc(l==null?void 0:l.data,x,a),f=!0)}B(this,I2)&&(s=B(this,I2),z=B(this,Ga),u=Date.now(),p="error");const M=g==="fetching",m=p==="pending",V=p==="error",b=m&&M;return{status:p,fetchStatus:g,isPending:m,isSuccess:p==="success",isError:V,isInitialLoading:b,isLoading:b,data:z,dataUpdatedAt:h.dataUpdatedAt,error:s,errorUpdatedAt:u,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>v.dataUpdateCount||h.errorUpdateCount>v.errorUpdateCount,isFetching:M,isRefetching:M&&!m,isLoadingError:V&&h.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:f,isRefetchError:V&&h.dataUpdatedAt!==0,isStale:kh(e,a),refetch:this.refetch}}updateResult(e){const a=B(this,It),r=this.createResult(B(this,Q1),this.options);if(u1(this,Ze,B(this,Q1).state),u1(this,Za,this.options),B(this,Ze).data!==void 0&&u1(this,Ja,B(this,Q1)),fi(r,a))return;u1(this,It,r);const n={},l=()=>{if(!a)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!B(this,Ye).size)return!0;const c=new Set(o??B(this,Ye));return this.options.throwOnError&&c.add("error"),Object.keys(B(this,It)).some(v=>{const h=v;return B(this,It)[h]!==a[h]&&c.has(h)})};(e==null?void 0:e.listeners)!==!1&&l()&&(n.listeners=!0),C1(this,Mi,bO).call(this,{...n,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&C1(this,ir,t3).call(this)}},Ut=new WeakMap,Q1=new WeakMap,Ua=new WeakMap,It=new WeakMap,Ze=new WeakMap,Za=new WeakMap,I2=new WeakMap,ar=new WeakMap,Ga=new WeakMap,Ja=new WeakMap,Ge=new WeakMap,Je=new WeakMap,pe=new WeakMap,Ye=new WeakMap,Qe=new WeakSet,k0=function(e){C1(this,hr,r3).call(this);let a=B(this,Q1).fetch(this.options,e);return e!=null&&e.throwOnError||(a=a.catch(g2)),a},rr=new WeakSet,Xc=function(){if(C1(this,or,e3).call(this),r0||B(this,It).isStale||!Jc(this.options.staleTime))return;const a=pO(B(this,It).dataUpdatedAt,this.options.staleTime)+1;u1(this,Ge,setTimeout(()=>{B(this,It).isStale||this.updateResult()},a))},nr=new WeakSet,_c=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(B(this,Q1)):this.options.refetchInterval)??!1},lr=new WeakSet,$c=function(e){C1(this,cr,a3).call(this),u1(this,pe,e),!(r0||this.options.enabled===!1||!Jc(B(this,pe))||B(this,pe)===0)&&u1(this,Je,setInterval(()=>{(this.options.refetchIntervalInBackground||pi.isFocused())&&C1(this,Qe,k0).call(this)},B(this,pe)))},ir=new WeakSet,t3=function(){C1(this,rr,Xc).call(this),C1(this,lr,$c).call(this,C1(this,nr,_c).call(this))},or=new WeakSet,e3=function(){B(this,Ge)&&(clearTimeout(B(this,Ge)),u1(this,Ge,void 0))},cr=new WeakSet,a3=function(){B(this,Je)&&(clearInterval(B(this,Je)),u1(this,Je,void 0))},hr=new WeakSet,r3=function(){const e=B(this,Ut).getQueryCache().build(B(this,Ut),this.options);if(e===B(this,Q1))return;const a=B(this,Q1);u1(this,Q1,e),u1(this,Ua,e.state),this.hasListeners()&&(a==null||a.removeObserver(this),e.addObserver(this))},Mi=new WeakSet,bO=function(e){zt.batch(()=>{e.listeners&&this.listeners.forEach(a=>{a(B(this,It))}),B(this,Ut).getQueryCache().notify({query:B(this,Q1),type:"observerResultsUpdated"})})},Mf);function E31(t,e){return e.enabled!==!1&&!t.state.dataUpdatedAt&&!(t.state.status==="error"&&e.retryOnMount===!1)}function lf(t,e){return E31(t,e)||t.state.dataUpdatedAt>0&&n3(t,e,e.refetchOnMount)}function n3(t,e,a){if(e.enabled!==!1){const r=typeof a=="function"?a(t):a;return r==="always"||r!==!1&&kh(t,e)}return!1}function of(t,e,a,r){return a.enabled!==!1&&(t!==e||r.enabled===!1)&&(!a.suspense||t.state.status!=="error")&&kh(t,a)}function kh(t,e){return t.isStaleByTime(e.staleTime)}function P31(t,e){return!fi(t.getCurrentResult(),e)}var ze,Dt,u2,Y2,Ya,E4,sr,l3,mf,I31=(mf=class extends s0{constructor(a,r){super();z1(this,Ya);z1(this,sr);z1(this,ze,void 0);z1(this,Dt,void 0);z1(this,u2,void 0);z1(this,Y2,void 0);u1(this,Dt,void 0),u1(this,ze,a),this.setOptions(r),this.bindMethods(),C1(this,Ya,E4).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){var n;const r=this.options;this.options=B(this,ze).defaultMutationOptions(a),fi(r,this.options)||B(this,ze).getMutationCache().notify({type:"observerOptionsUpdated",mutation:B(this,u2),observer:this}),(n=B(this,u2))==null||n.setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=B(this,u2))==null||a.removeObserver(this)}onMutationUpdate(a){C1(this,Ya,E4).call(this),C1(this,sr,l3).call(this,a)}getCurrentResult(){return B(this,Dt)}reset(){u1(this,u2,void 0),C1(this,Ya,E4).call(this),C1(this,sr,l3).call(this)}mutate(a,r){var n;return u1(this,Y2,r),(n=B(this,u2))==null||n.removeObserver(this),u1(this,u2,B(this,ze).getMutationCache().build(B(this,ze),this.options)),B(this,u2).addObserver(this),B(this,u2).execute(a)}},ze=new WeakMap,Dt=new WeakMap,u2=new WeakMap,Y2=new WeakMap,Ya=new WeakSet,E4=function(){var r;const a=((r=B(this,u2))==null?void 0:r.state)??wO();u1(this,Dt,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},sr=new WeakSet,l3=function(a){zt.batch(()=>{var r,n,l,i,o,c,v,h;B(this,Y2)&&this.hasListeners()&&((a==null?void 0:a.type)==="success"?((n=(r=B(this,Y2)).onSuccess)==null||n.call(r,a.data,B(this,Dt).variables,B(this,Dt).context),(i=(l=B(this,Y2)).onSettled)==null||i.call(l,a.data,null,B(this,Dt).variables,B(this,Dt).context)):(a==null?void 0:a.type)==="error"&&((c=(o=B(this,Y2)).onError)==null||c.call(o,a.error,B(this,Dt).variables,B(this,Dt).context),(h=(v=B(this,Y2)).onSettled)==null||h.call(v,void 0,a.error,B(this,Dt).variables,B(this,Dt).context))),this.listeners.forEach(s=>{s(B(this,Dt))})})},mf);var yO=O.createContext(void 0),n2=t=>{const e=O.useContext(yO);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},R31=({client:t,children:e})=>(O.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),O.createElement(yO.Provider,{value:t},e)),xO=O.createContext(!1),k31=()=>O.useContext(xO),Jh1=xO.Provider;function N31(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var T31=O.createContext(N31()),j31=()=>O.useContext(T31);function LO(t,e){return typeof t=="function"?t(...e):!!t}var D31=(t,e)=>{(t.suspense||t.throwOnError)&&(e.isReset()||(t.retryOnMount=!1))},F31=t=>{O.useEffect(()=>{t.clearReset()},[t])},q31=({result:t,errorResetBoundary:e,throwOnError:a,query:r})=>t.isError&&!e.isReset()&&!t.isFetching&&LO(a,[t.error,r]);var W31=t=>{t.suspense&&typeof t.staleTime!="number"&&(t.staleTime=1e3)};var K31=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,U31=(t,e,a)=>e.fetchOptimistic(t).catch(()=>{a.clearReset()});function Z31(t,e,a){if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))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 r=n2(a),n=k31(),l=j31(),i=r.defaultQueryOptions(t);i._optimisticResults=n?"isRestoring":"optimistic",W31(i),D31(i,l),F31(l);const[o]=O.useState(()=>new e(r,i)),c=o.getOptimisticResult(i);if(O.useSyncExternalStore(O.useCallback(v=>{const h=n?()=>{}:o.subscribe(zt.batchCalls(v));return o.updateResult(),h},[o,n]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),O.useEffect(()=>{o.setOptions(i,{listeners:!1})},[i,o]),K31(i,c))throw U31(i,o,l);if(q31({result:c,errorResetBoundary:l,throwOnError:i.throwOnError,query:o.getCurrentQuery()}))throw c.error;return i.notifyOnChangeProps?c:o.trackResult(c)}function Lr(t,e){return Z31(t,A31,e)}function S2(t,e){const a=n2(e),[r]=O.useState(()=>new I31(a,t));O.useEffect(()=>{r.setOptions(t)},[r,t]);const n=O.useSyncExternalStore(O.useCallback(i=>r.subscribe(zt.batchCalls(i)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),l=O.useCallback((i,o)=>{r.mutate(i,o).catch(G31)},[r]);if(n.error&&LO(r.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:l,mutateAsync:n.mutate}}function G31(){}function Nt(){return n2().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const Se=()=>{const{data:t,refetch:e}=Lr({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[t,a=>{a&&(localStorage.setItem("currentPage",a||""),e())}]};let cf="";const Or=()=>(cf=localStorage.getItem("__chai_at"),cf);function J31(t){const e={method:"GET",headers:{"x-chai-access-token":Or()}};return fetch(t,e)}function Y31(t,e){const a={method:"POST",headers:{"x-chai-access-token":Or()},body:JSON.stringify(e)};return fetch(t,a)}function Q31(t,e){const a={method:"PUT",headers:{"x-chai-access-token":Or()},body:JSON.stringify(e)};return fetch(t,a)}function X31(t,e){const a={method:"DELETE",headers:{"x-chai-access-token":Or()},body:JSON.stringify(e)};return fetch(t,a)}const l2={get:J31,post:Y31,put:Q31,delete:X31},Nh=()=>{const[t,e]=Se(),a=Nt();return Lr({queryKey:["project"],queryFn:async()=>{const{data:r}=await l2.get(`${a}/project`).then(n=>n.json());if(!t&&r){const n=localStorage.getItem("currentPage");e(n||(r==null?void 0:r.homepage))}return r}})},Th=()=>{const t=Nt();return Lr({queryKey:["pages"],queryFn:async()=>{const{data:e}=await l2.get(`${t}/pages`).then(a=>a.json());return e||[]}})},OO=()=>{const[t]=Se(),e=Nt();return Lr({queryKey:["page_data",t],queryFn:async()=>{const{data:a}=await l2.get(`${e}/page?uuid=${t}`).then(r=>r.json());return a},enabled:!!t,staleTime:3e3})},i3=()=>r1.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:r1.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[r1.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[r1.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),r1.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),r1.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),r1.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),r1.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),SO=(t="Project updated successfully.")=>{const e=n2(),a=Nt();return S2({mutationFn:async r=>await l2.put(`${a}/project`,r).then(n=>n.json()),onSuccess:()=>{e.invalidateQueries({queryKey:["project"]}),F2.toast.success(t)}})},CO=()=>{const[t]=["SAVED"],[e,a]=Se(),r=o1.useBuilderReset();return n=>t!=="SAVED"?(F2.toast.error("You have unsaved changes. Please save before changing the page."),!1):e===n.uuid?!1:(r(),setTimeout(()=>{a(n.uuid)},100),!0)},_31=()=>{const t=n2(),e=CO(),a=Nt();return S2({mutationFn:async r=>l2.post(`${a}/pages`,r).then(n=>n.json()),onSuccess:r=>{t.invalidateQueries({queryKey:["pages"]}),e({uuid:r.uuid,slug:r.slug}),F2.toast.success("Page added successfully.")}})},BO=()=>{const t=Nt(),[e]=Se(),a=n2();return S2({mutationFn:async r=>l2.put(`${t}/page`,r).then(n=>n.json()),onSuccess:async r=>{var n;if(r.result==="error"&&((n=r.error)==null?void 0:n.code)=="PAGE_LOCKED"){a.invalidateQueries({queryKey:["page_data",e]});return}F2.toast.success("Page saved successfully.")}})},$31=()=>{const t=Nt(),{data:e}=Th(),[a]=Se(),{data:r}=Nh(),n=n2();return S2({mutationFn:async()=>{const l=e.find(i=>i.uuid===a).slug;return await l2.post(`${t}/publish`,{slug:l,uuid:a,isHomepage:(r==null?void 0:r.homepage)===a}).then(i=>i.json())},onSuccess:async l=>{var i;if(l.result==="error"&&((i=l.error)==null?void 0:i.code)=="PAGE_LOCKED"){n.invalidateQueries({queryKey:["page_data",a]});return}F2.toast.success("Page published successfully.",{position:"top-right",duration:2e3})}})},th1=()=>{const t=n2(),e=Nt();return S2({mutationFn:async a=>l2.delete(`${e}/page`,a).then(r=>r.json()),onSuccess:()=>{F2.toast.success("Page deleted successfully."),t.invalidateQueries({queryKey:["pages"]})}})},eh1=()=>{const t=n2(),e=Nt();return S2({mutationFn:async a=>l2.post(`${e}/take-control`,{uuid:a}).then(r=>r.json()),onSuccess:(a,r)=>{t.invalidateQueries({queryKey:["page_data",r]})}})},ah1=()=>{const t=Nt();return S2({mutationFn:async()=>{const{data:e}=await l2.get(`${t}/library`).then(a=>a.json());return rt.sortBy(rt.filter(e,a=>!rt.has(a,"hidden")),"group")}})},rh1=()=>{const t=Nt();return S2({mutationFn:async e=>{if(!e||!e.uuid)return[];try{const{data:a}=await l2.get(`${t}/block?uuid=${e.uuid}&format=${e.format}`).then(async r=>e.format==="html"?FO.getBlocksFromHTML(await r.text()):await r.json());return rt.set(a,"0._name",rt.capitalize(e.group)),a||[]}catch{return[]}}})},nh1=()=>{const t=Nt();return S2({mutationFn:async e=>{const a=new FormData;a.append("file",e);const{data:r}=await fetch(`${t}/upload`,{method:"POST",headers:{"x-chai-access-token":Or()},body:a}).then(n=>n.json());return r}})};var AO={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},hf=d.createContext&&d.createContext(AO),we=function(){return we=Object.assign||function(t){for(var e,a=1,r=arguments.length;a<r;a++){e=arguments[a];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},we.apply(this,arguments)},lh1=function(t,e){var a={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(a[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(a[r[n]]=t[r[n]]);return a};function EO(t){return t&&t.map(function(e,a){return d.createElement(e.tag,we({key:a},e.attr),EO(e.child))})}function PO(t){return function(e){return d.createElement(ih1,we({attr:we({},t.attr)},e),EO(t.child))}}function ih1(t){var e=function(a){var r=t.attr,n=t.size,l=t.title,i=lh1(t,["attr","size","title"]),o=n||a.size||"1em",c;return a.className&&(c=a.className),t.className&&(c=(c?c+" ":"")+t.className),d.createElement("svg",we({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,r,i,{className:c,style:we(we({color:t.color||a.color},a.style),t.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),l&&d.createElement("title",null,l),t.children)};return hf!==void 0?d.createElement(hf.Consumer,null,function(a){return e(a)}):e(AO)}function IO(t){return PO({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"}}]})(t)}function oh1(t){return PO({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"}}]})(t)}const ch1=()=>{const{mutate:t,isPending:e}=eh1(),[a]=Se(),{data:r}=OO(),n=rt.get(r,"lockedBy.name",""),l=rt.get(r,"lockedBy.email","");return r1.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:[r1.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",r1.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),r1.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",r1.jsxRuntimeExports.jsx("br",{}),r1.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[r1.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[r1.jsxRuntimeExports.jsx(oh1,{className:"w-4 h-4 text-gray-500"})," ",n]}),r1.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[r1.jsxRuntimeExports.jsx(IO,{className:"w-4 h-4 text-gray-500"})," ",l]})]}),r1.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",n," will be ",r1.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),r1.jsxRuntimeExports.jsx(o1.Button,{disabled:e,onClick:()=>t(a),className:`w-36 ${e?"bg-transparent shadow-none hover:bg-transparent":""}`,children:e?r1.jsxRuntimeExports.jsx(o3.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},hh1=()=>{const t=Nt(),e=n2();return S2({mutationFn:async a=>{const r=await fetch(`${t}/login`,{method:"POST",body:JSON.stringify(a)});if(r.ok)return await r.json();throw r.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:a=>{const{data:r}=a;if(!r.accessToken){F2.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",r.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(rt.omit(r,["accessToken"]))),e.invalidateQueries({queryKey:["verify"]}),F2.toast.success("Logged in successfully.")},onError:()=>{F2.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},sh1=()=>{const t=Nt();return Lr({queryKey:["verify"],queryFn:async()=>{const e=await l2.get(`${t}/verify`);return e.ok?(await e.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},vh1=()=>{const t=Nt(),e=n2();return S2({mutationFn:async()=>{const{result:a}=await l2.post(`${t}/logout`).then(r=>r.json());if(a==="success")return localStorage.clear(),e.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},dh1=({children:t})=>{const e=vh1();return r1.jsxRuntimeExports.jsxs(o1.AlertDialog,{children:[r1.jsxRuntimeExports.jsx(o1.AlertDialogTrigger,{asChild:!0,children:t}),r1.jsxRuntimeExports.jsxs(o1.AlertDialogContent,{children:[r1.jsxRuntimeExports.jsxs(o1.AlertDialogHeader,{children:[r1.jsxRuntimeExports.jsxs(o1.AlertDialogTitle,{children:["Are you sure, you want to ",r1.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),r1.jsxRuntimeExports.jsx(o1.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"})]}),r1.jsxRuntimeExports.jsxs(o1.AlertDialogFooter,{children:[r1.jsxRuntimeExports.jsx(o1.AlertDialogCancel,{disabled:e.isPending,children:"Cancel"}),r1.jsxRuntimeExports.jsxs("button",{disabled:e.isPending,onClick:()=>e.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:[e.isPending&&r1.jsxRuntimeExports.jsx(o3.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},uh1=()=>r1.jsxRuntimeExports.jsx(dh1,{children:r1.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:r1.jsxRuntimeExports.jsx(o3.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),gh1=d.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-IHkdL59C.cjs"))),fh1=d.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-Rt_C00rp.cjs"))),ph1=d.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-Fw-gGZIK.cjs"))),zh1=()=>r1.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),Mh1=()=>{const{mutate:t}=$31();return o1.useBuilderProp("editable",!0)?r1.jsxRuntimeExports.jsx(o1.Button,{onClick:t,className:"bg-blue-600 text-white",children:"Publish"}):null},mh1=t=>{const{data:e,isLoading:a}=Nh(),{data:r,isLoading:n}=Th(),{data:l}=OO(),{mutate:i}=SO(),{mutate:o}=BO(),[c]=Se(),v=nh1(),h=ah1(),s=rh1(),u=Nt(),g=d.useCallback(async m=>await v.mutateAsync(m),[v]),p=d.useCallback(async()=>await h.mutateAsync(),[h]),f=d.useCallback(async m=>await s.mutateAsync(m),[s]),z=async(m=20,V=0)=>{const b=`limit=${m}&offset=${V}`;return await fetch(`${u}/assets?${b}`).then(w=>w.json())},{logo:M=zh1}=t;return a||!e?r1.jsxRuntimeExports.jsx(i3,{}):n||!r?r1.jsxRuntimeExports.jsx(i3,{}):r1.jsxRuntimeExports.jsx("div",{className:"bg-background text-foreground",children:r1.jsxRuntimeExports.jsx(fO,{editable:l!=null&&l.lockedBy?l==null?void 0:l.lockedBy.self:!0,nonEditableComponent:ch1,blocks:(l==null?void 0:l.blocks)||[],brandingOptions:e.brandingOptions,darkMode:t.darkMode||!1,dataProviders:(l==null?void 0:l.providers)||[],onSavePage:async({blocks:m,providers:V})=>(await o({blocks:m,providers:V,uuid:c}),!0),onSaveBrandingOptions:async m=>(await i({brandingOptions:m}),!0),topBarComponents:{left:[M],center:[ph1],right:[Mh1]},sideBarComponents:{top:[{icon:P4.FileTextIcon,name:"pages",panel:gh1},{icon:P4.GearIcon,name:"settings",panel:fh1}],bottom:[uh1]},uploadMediaCallback:g,fetchMediaCallback:z,getUILibraryBlocks:p,getExternalPredefinedBlock:f,getPages:()=>r,unsplashAccessKey:t.unsplashAccessKey||""})})},Hh1=({logo:t})=>{const[e,a]=d.useState(!1),[r,n]=d.useState(""),[l,i]=d.useState(""),{mutate:o,isPending:c}=hh1(),v=h=>{h.preventDefault(),o({email:r,password:l})};return r1.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:r1.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:r1.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[r1.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[r1.jsxRuntimeExports.jsx(d.Suspense,{children:t?d.createElement(t):""}),r1.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"})]}),r1.jsxRuntimeExports.jsx("div",{className:"mt-8",children:r1.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:v,className:"space-y-5",children:[r1.jsxRuntimeExports.jsx("div",{children:r1.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[r1.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:r1.jsxRuntimeExports.jsx(IO,{})}),r1.jsxRuntimeExports.jsx("input",{value:r,onChange:h=>n(h.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"})]})}),r1.jsxRuntimeExports.jsx("div",{children:r1.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[r1.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:r1.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:r1.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"})})}),r1.jsxRuntimeExports.jsx("input",{value:l,onChange:h=>i(h.target.value),type:e?"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"}),r1.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>a(!e),children:e?r1.jsxRuntimeExports.jsx(P4.EyeClosedIcon,{}):r1.jsxRuntimeExports.jsx(P4.EyeOpenIcon,{})})]})}),r1.jsxRuntimeExports.jsx("div",{children:r1.jsxRuntimeExports.jsx("button",{disabled:c||rt.size(r)<2||rt.size(l)<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:c?"Signing in...":"Login"})})]})}),r1.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:r1.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},Vh1=t=>{const{data:e,isLoading:a}=sh1(),r=n2();return d.useEffect(()=>{r.setQueryData(["apiBaseUrl"],t.apiBaseUrl||"/api/chaibuilder")},[t.apiBaseUrl,r]),a?r1.jsxRuntimeExports.jsx(i3,{}):e!=null&&e.valid?r1.jsxRuntimeExports.jsx(mh1,{...t}):r1.jsxRuntimeExports.jsx(Hh1,{logo:t.logo})},wh1=new B31,bh1=t=>r1.jsxRuntimeExports.jsxs(R31,{client:wh1,children:[r1.jsxRuntimeExports.jsx(F2.Toaster,{richColors:!0}),r1.jsxRuntimeExports.jsx(Vh1,{...t})]});exports.BlocksExternalDataProvider=o31;exports.ChaiBuilderEditor=fO;exports.ChaiBuilderStudio=bh1;exports.ErrorBoundary=dO;exports.reactIsExports=Pf;exports.useAddPage=_31;exports.useChaiExternalData=gO;exports.useChangePage=CO;exports.useCurrentPage=Se;exports.useDeletePage=th1;exports.useExpandedIds=l31;exports.usePages=Th;exports.useProject=Nh;exports.useQueryClient=n2;exports.useUpdatePage=BO;exports.useUpdateProject=SO;
|
|
206
|
+
*/j();var $c1=process.env.NODE_ENV!=="production"?_c1:()=>null;const t31={};class dO extends d.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?r1.jsxRuntimeExports.jsxs("div",{className:"bg-red-200 h-full w-full rounded-md text-red-500 p-4",id:"errorBoundary",children:[r1.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),r1.jsxRuntimeExports.jsx("p",{children:"Please try again later."})]}):this.props.children}}const e31=()=>{const[t,e]=o1.usePreviewMode(),a=o1.useBuilderProp("previewComponent");return r1.jsxRuntimeExports.jsxs("div",{className:qO.cn("fixed inset-0 z-[999] bg-background",t?"block":"hidden"),children:[r1.jsxRuntimeExports.jsx(o1.Button,{size:"sm",className:"absolute right-0 top-0 m-4",onClick:()=>e(!1),children:"Close Preview"}),r1.jsxRuntimeExports.jsx("div",{children:a?r1.jsxRuntimeExports.jsx(d.Suspense,{fallback:r1.jsxRuntimeExports.jsx(o1.Skeleton,{className:"h-96 w-full"}),children:d.createElement(a)}):null})]})},a31=()=>{const[t,e]=o1.useSelectedBlockIds(),[,a]=o1.useCopyBlockIds(),r=o1.useRemoveBlocks(),n=o1.useDuplicateBlocks(),[,l]=o1.useCutBlockIds(),{pasteBlocks:i}=o1.usePasteBlocks(),{undo:o,redo:c}=o1.useCanvasHistory();ne.useHotkeys("esc",()=>e([]),{},[e]),ne.useHotkeys("ctrl+c,command+c",()=>a(t),{},[t,a]),ne.useHotkeys("ctrl+d,command+d",()=>n(t),{preventDefault:!0},[t,n]),ne.useHotkeys("ctrl+x,command+x",()=>l(t),{},[t,l]),ne.useHotkeys("ctrl+v,command+v",()=>t.length===1?i(t[0]):null,{},[t,i]),ne.useHotkeys("ctrl+z,command+z",()=>o(),{},[o]),ne.useHotkeys("ctrl+y,command+y",()=>c(),{},[c]),ne.useHotkeys("del, backspace",v=>{v.preventDefault(),r(t)},{},[t,r])},r31=(t,e)=>{const a=[];let r=rt.find(t,{_id:e}),n=rt.get(r,"_parent","");for(;rt.isString(n)&&!rt.isEmpty(n);)a.push(r==null?void 0:r._parent),r=rt.find(t,{_id:n}),n=r==null?void 0:r._parent;return rt.flatten(a)},uO=be.atom([]),n31=()=>{const[t]=o1.useSelectedBlockIds(),e=be.useAtomValue(o1.presentBlocksAtom),[,a]=be.useAtom(uO);d.useEffect(()=>{let r=[];const n=rt.first(t);rt.isString(n)&&(r=[n,...r31(e,n)]),a(r)},[t,e,a])},l31=()=>be.useAtomValue(uO),gO=()=>be.useAtom(o1.chaiExternalDataAtom),i31=()=>d.useMemo(()=>wf.getChaiDataProviders(),[]),o31=({children:t})=>{const[,e]=gO(),[a]=o1.usePageDataProviders(),r=i31();return d.useEffect(()=>(e({}),rt.each(a,n=>{const l=rt.find(r,{providerKey:n.providerKey});if(l){const i=(l==null?void 0:l.mockFn)||(l==null?void 0:l.dataFn);i&&i(n.args).then(o=>e(c=>({...c,[n.providerKey]:o})))}}),()=>{rt.each(a,n=>{e(l=>(delete l[n.providerKey],l))})}),[r,a,e]),r1.jsxRuntimeExports.jsx(r1.jsxRuntimeExports.Fragment,{children:t})},c31=d.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-1Ooc-KTb.cjs"))),h31=d.lazy(()=>Promise.resolve().then(()=>require("./Topbar-e0hKiAm_.cjs"))),s31=d.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-AHGpIP2x.cjs"))),v31=d.lazy(()=>Promise.resolve().then(()=>require("./Settings-xwTkQuKA.cjs"))),d31=()=>{const[t]=be.useAtom(o1.pageSyncStateAtom),e=n=>{o1.isDevelopment()||n.preventDefault()};a31(),n31(),d.useEffect(()=>(t!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[t]);const a=o1.useBuilderProp("editable",!0),r=o1.useBuilderProp("nonEditableComponent",null);return r1.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-background text-foreground",children:r1.jsxRuntimeExports.jsxs(o1.TooltipProvider,{children:[r1.jsxRuntimeExports.jsxs("div",{onContextMenu:e,className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[r1.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:r1.jsxRuntimeExports.jsx(h31,{})})}),r1.jsxRuntimeExports.jsxs("main",{className:"flex h-full flex-row relative",children:[a?null:r1.jsxRuntimeExports.jsx("div",{className:"absolute backdrop-blur-[2px] flex items-center justify-center inset-0 z-[500] h-full w-full",children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:d.createElement(r)})}),r1.jsxRuntimeExports.jsx("div",{className:"flex h-full w-fit border-border max-h-full",style:{maxHeight:"calc(100vh - 56px)"},children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:r1.jsxRuntimeExports.jsx(c31,{})})}),r1.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:r1.jsxRuntimeExports.jsx(s31,{})})}),r1.jsxRuntimeExports.jsx("div",{className:"flex h-full w-[280px] min-w-[280px] border-l border-border",children:r1.jsxRuntimeExports.jsx(d.Suspense,{children:r1.jsxRuntimeExports.jsx(v31,{})})})]})]}),r1.jsxRuntimeExports.jsx(e31,{})]})})},_g=be.getDefaultStore();var u31={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};u31.NODE_ENV==="development"&&console.log("Chai Builder:",QO);const g31=t=>r1.jsxRuntimeExports.jsx(r1.jsxRuntimeExports.Fragment,{children:t.children}),f31=t=>{const{dndOptions:e={backend:jh.MultiBackend}}=t,[a]=o1.useSetAllBlocks(),[,r]=o1.useBrandingOptions(),n=o1.useBuilderReset();return d.useEffect(()=>{_g.set(o1.chaiBuilderPropsAtom,rt.omit(t,["blocks","subPages","brandingOptions","dataProvidersAtom"]))},[t]),d.useEffect(()=>{_g.set(o1.dataProvidersAtom,t.dataProviders||[])},[t.dataProviders]),d.useEffect(()=>{a(wf.syncBlocksWithDefaults(t.blocks||[])),n()},[t.blocks]),d.useEffect(()=>{r(t.brandingOptions)},[t.brandingOptions,r]),r1.jsxRuntimeExports.jsx(DO.DndProvider,{...e,options:jh.getBackendOptions(),children:r1.jsxRuntimeExports.jsx(g31,{children:r1.jsxRuntimeExports.jsx(d31,{})})})},fO=t=>r1.jsxRuntimeExports.jsxs(dO,{children:[r1.jsxRuntimeExports.jsxs(jO.FlagsProvider,{features:t31,children:[r1.jsxRuntimeExports.jsx($c1,{}),r1.jsxRuntimeExports.jsx(f31,{...t})]}),r1.jsxRuntimeExports.jsx(o1.Toaster,{})]});var s0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},r0=typeof window>"u"||"Deno"in window;function g2(){}function p31(t,e){return typeof t=="function"?t(e):t}function Jc(t){return typeof t=="number"&&t>=0&&t!==1/0}function pO(t,e){return Math.max(t+(e||0)-Date.now(),0)}function $g(t,e){const{type:a="all",exact:r,fetchStatus:n,predicate:l,queryKey:i,stale:o}=t;if(i){if(r){if(e.queryHash!==Rh(i,e.options))return!1}else if(!_0(e.queryKey,i))return!1}if(a!=="all"){const c=e.isActive();if(a==="active"&&!c||a==="inactive"&&c)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||typeof n<"u"&&n!==e.state.fetchStatus||l&&!l(e))}function tf(t,e){const{exact:a,status:r,predicate:n,mutationKey:l}=t;if(l){if(!e.options.mutationKey)return!1;if(a){if(X0(e.options.mutationKey)!==X0(l))return!1}else if(!_0(e.options.mutationKey,l))return!1}return!(r&&e.state.status!==r||n&&!n(e))}function Rh(t,e){return((e==null?void 0:e.queryKeyHashFn)||X0)(t)}function X0(t){return JSON.stringify(t,(e,a)=>Yc(a)?Object.keys(a).sort().reduce((r,n)=>(r[n]=a[n],r),{}):a)}function _0(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(a=>!_0(t[a],e[a])):!1}function zO(t,e){if(t===e)return t;const a=ef(t)&&ef(e);if(a||Yc(t)&&Yc(e)){const r=a?t.length:Object.keys(t).length,n=a?e:Object.keys(e),l=n.length,i=a?[]:{};let o=0;for(let c=0;c<l;c++){const v=a?c:n[c];i[v]=zO(t[v],e[v]),i[v]===t[v]&&o++}return r===l&&o===r?t:i}return e}function fi(t,e){if(t&&!e||e&&!t)return!1;for(const a in t)if(t[a]!==e[a])return!1;return!0}function ef(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Yc(t){if(!af(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const a=e.prototype;return!(!af(a)||!a.hasOwnProperty("isPrototypeOf"))}function af(t){return Object.prototype.toString.call(t)==="[object Object]"}function MO(t){return new Promise(e=>{setTimeout(e,t)})}function rf(t){MO(0).then(t)}function Qc(t,e,a){return typeof a.structuralSharing=="function"?a.structuralSharing(t,e):a.structuralSharing!==!1?zO(t,e):e}function z31(t,e,a=0){const r=[...t,e];return a&&r.length>a?r.slice(1):r}function M31(t,e,a=0){const r=[e,...t];return a&&r.length>a?r.slice(0,-1):r}var qe,se,Ia,sf,m31=(sf=class extends s0{constructor(){super();z1(this,qe,void 0);z1(this,se,void 0);z1(this,Ia,void 0);u1(this,Ia,e=>{if(!r0&&window.addEventListener){const a=()=>e();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){B(this,se)||this.setEventListener(B(this,Ia))}onUnsubscribe(){var e;this.hasListeners()||((e=B(this,se))==null||e.call(this),u1(this,se,void 0))}setEventListener(e){var a;u1(this,Ia,e),(a=B(this,se))==null||a.call(this),u1(this,se,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){B(this,qe)!==e&&(u1(this,qe,e),this.onFocus())}onFocus(){this.listeners.forEach(e=>{e()})}isFocused(){var e;return typeof B(this,qe)=="boolean"?B(this,qe):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qe=new WeakMap,se=new WeakMap,Ia=new WeakMap,sf),pi=new m31,Ra,ve,ka,vf,H31=(vf=class extends s0{constructor(){super();z1(this,Ra,!0);z1(this,ve,void 0);z1(this,ka,void 0);u1(this,ka,e=>{if(!r0&&window.addEventListener){const a=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",r)}}})}onSubscribe(){B(this,ve)||this.setEventListener(B(this,ka))}onUnsubscribe(){var e;this.hasListeners()||((e=B(this,ve))==null||e.call(this),u1(this,ve,void 0))}setEventListener(e){var a;u1(this,ka,e),(a=B(this,ve))==null||a.call(this),u1(this,ve,e(this.setOnline.bind(this)))}setOnline(e){B(this,Ra)!==e&&(u1(this,Ra,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return B(this,Ra)}},Ra=new WeakMap,ve=new WeakMap,ka=new WeakMap,vf),zi=new H31;function V31(t){return Math.min(1e3*2**t,3e4)}function ao(t){return(t??"online")==="online"?zi.isOnline():!0}var mO=class{constructor(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function dc(t){return t instanceof mO}function HO(t){let e=!1,a=0,r=!1,n,l,i;const o=new Promise((z,M)=>{l=z,i=M}),c=z=>{var M;r||(g(new mO(z)),(M=t.abort)==null||M.call(t))},v=()=>{e=!0},h=()=>{e=!1},s=()=>!pi.isFocused()||t.networkMode!=="always"&&!zi.isOnline(),u=z=>{var M;r||(r=!0,(M=t.onSuccess)==null||M.call(t,z),n==null||n(),l(z))},g=z=>{var M;r||(r=!0,(M=t.onError)==null||M.call(t,z),n==null||n(),i(z))},p=()=>new Promise(z=>{var M;n=m=>{const V=r||!s();return V&&z(m),V},(M=t.onPause)==null||M.call(t)}).then(()=>{var z;n=void 0,r||(z=t.onContinue)==null||z.call(t)}),f=()=>{if(r)return;let z;try{z=t.fn()}catch(M){z=Promise.reject(M)}Promise.resolve(z).then(u).catch(M=>{var y;if(r)return;const m=t.retry??(r0?0:3),V=t.retryDelay??V31,b=typeof V=="function"?V(a,M):V,w=m===!0||typeof m=="number"&&a<m||typeof m=="function"&&m(a,M);if(e||!w){g(M);return}a++,(y=t.onFail)==null||y.call(t,a,M),MO(b).then(()=>{if(s())return p()}).then(()=>{e?g(M):f()})})};return ao(t.networkMode)?f():p().then(f),{promise:o,cancel:c,continue:()=>(n==null?void 0:n())?o:Promise.resolve(),cancelRetry:v,continueRetry:h}}function w31(){let t=[],e=0,a=h=>{h()},r=h=>{h()};const n=h=>{let s;e++;try{s=h()}finally{e--,e||o()}return s},l=h=>{e?t.push(h):rf(()=>{a(h)})},i=h=>(...s)=>{l(()=>{h(...s)})},o=()=>{const h=t;t=[],h.length&&rf(()=>{r(()=>{h.forEach(s=>{a(s)})})})};return{batch:n,batchCalls:i,schedule:l,setNotifyFunction:h=>{a=h},setBatchNotifyFunction:h=>{r=h}}}var zt=w31(),We,df,VO=(df=class{constructor(){z1(this,We,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Jc(this.gcTime)&&u1(this,We,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(r0?1/0:5*60*1e3))}clearGcTimeout(){B(this,We)&&(clearTimeout(B(this,We)),u1(this,We,void 0))}},We=new WeakMap,df),Na,Ta,s2,de,v2,yt,$0,Ke,ja,A4,V2,G2,uf,b31=(uf=class extends VO{constructor(e){super();z1(this,ja);z1(this,V2);z1(this,Na,void 0);z1(this,Ta,void 0);z1(this,s2,void 0);z1(this,de,void 0);z1(this,v2,void 0);z1(this,yt,void 0);z1(this,$0,void 0);z1(this,Ke,void 0);u1(this,Ke,!1),u1(this,$0,e.defaultOptions),C1(this,ja,A4).call(this,e.options),u1(this,yt,[]),u1(this,s2,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,u1(this,Na,e.state||y31(this.options)),this.state=B(this,Na),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!B(this,yt).length&&this.state.fetchStatus==="idle"&&B(this,s2).remove(this)}setData(e,a){const r=Qc(this.state.data,e,this.options);return C1(this,V2,G2).call(this,{data:r,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),r}setState(e,a){C1(this,V2,G2).call(this,{type:"setState",state:e,setStateOptions:a})}cancel(e){var r;const a=B(this,de);return(r=B(this,v2))==null||r.cancel(e),a?a.then(g2).catch(g2):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(B(this,Na))}isActive(){return B(this,yt).some(e=>e.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||B(this,yt).some(e=>e.getCurrentResult().isStale)}isStaleByTime(e=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!pO(this.state.dataUpdatedAt,e)}onFocus(){var a;const e=B(this,yt).find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(a=B(this,v2))==null||a.continue()}onOnline(){var a;const e=B(this,yt).find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(a=B(this,v2))==null||a.continue()}addObserver(e){B(this,yt).includes(e)||(B(this,yt).push(e),this.clearGcTimeout(),B(this,s2).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){B(this,yt).includes(e)&&(u1(this,yt,B(this,yt).filter(a=>a!==e)),B(this,yt).length||(B(this,v2)&&(B(this,Ke)?B(this,v2).cancel({revert:!0}):B(this,v2).cancelRetry()),this.scheduleGc()),B(this,s2).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return B(this,yt).length}invalidate(){this.state.isInvalidated||C1(this,V2,G2).call(this,{type:"invalidate"})}fetch(e,a){var v,h,s,u;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(B(this,de))return(v=B(this,v2))==null||v.continueRetry(),B(this,de)}if(e&&C1(this,ja,A4).call(this,e),!this.options.queryFn){const g=B(this,yt).find(p=>p.options.queryFn);g&&C1(this,ja,A4).call(this,g.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 r=new AbortController,n={queryKey:this.queryKey,meta:this.meta},l=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(u1(this,Ke,!0),r.signal)})};l(n);const i=()=>this.options.queryFn?(u1(this,Ke,!1),this.options.persister?this.options.persister(this.options.queryFn,n,this):this.options.queryFn(n)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),o={fetchOptions:a,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};l(o),(h=this.options.behavior)==null||h.onFetch(o,this),u1(this,Ta,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((s=o.fetchOptions)==null?void 0:s.meta))&&C1(this,V2,G2).call(this,{type:"fetch",meta:(u=o.fetchOptions)==null?void 0:u.meta});const c=g=>{var p,f,z,M;dc(g)&&g.silent||C1(this,V2,G2).call(this,{type:"error",error:g}),dc(g)||((f=(p=B(this,s2).config).onError)==null||f.call(p,g,this),(M=(z=B(this,s2).config).onSettled)==null||M.call(z,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return u1(this,v2,HO({fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var p,f,z,M;if(typeof g>"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}`),c(new Error(`${this.queryHash} data is undefined`));return}this.setData(g),(f=(p=B(this,s2).config).onSuccess)==null||f.call(p,g,this),(M=(z=B(this,s2).config).onSettled)==null||M.call(z,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:c,onFail:(g,p)=>{C1(this,V2,G2).call(this,{type:"failed",failureCount:g,error:p})},onPause:()=>{C1(this,V2,G2).call(this,{type:"pause"})},onContinue:()=>{C1(this,V2,G2).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode})),u1(this,de,B(this,v2).promise),B(this,de)}},Na=new WeakMap,Ta=new WeakMap,s2=new WeakMap,de=new WeakMap,v2=new WeakMap,yt=new WeakMap,$0=new WeakMap,Ke=new WeakMap,ja=new WeakSet,A4=function(e){this.options={...B(this,$0),...e},this.updateGcTime(this.options.gcTime)},V2=new WeakSet,G2=function(e){const a=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:e.meta??null,fetchStatus:ao(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return dc(n)&&n.revert&&B(this,Ta)?{...B(this,Ta),fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=a(this.state),zt.batch(()=>{B(this,yt).forEach(r=>{r.onQueryUpdate()}),B(this,s2).notify({query:this,type:"updated",action:e})})},uf);function y31(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,a=typeof e<"u",r=a?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:a?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var A2,gf,x31=(gf=class extends s0{constructor(e={}){super();z1(this,A2,void 0);this.config=e,u1(this,A2,new Map)}build(e,a,r){const n=a.queryKey,l=a.queryHash??Rh(n,a);let i=this.get(l);return i||(i=new b31({cache:this,queryKey:n,queryHash:l,options:e.defaultQueryOptions(a),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(i)),i}add(e){B(this,A2).has(e.queryHash)||(B(this,A2).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const a=B(this,A2).get(e.queryHash);a&&(e.destroy(),a===e&&B(this,A2).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){zt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return B(this,A2).get(e)}getAll(){return[...B(this,A2).values()]}find(e){const a={exact:!0,...e};return this.getAll().find(r=>$g(a,r))}findAll(e={}){const a=this.getAll();return Object.keys(e).length>0?a.filter(r=>$g(e,r)):a}notify(e){zt.batch(()=>{this.listeners.forEach(a=>{a(e)})})}onFocus(){zt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){zt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},A2=new WeakMap,gf),E2,tr,$t,Da,P2,he,ff,L31=(ff=class extends VO{constructor(e){super();z1(this,P2);z1(this,E2,void 0);z1(this,tr,void 0);z1(this,$t,void 0);z1(this,Da,void 0);this.mutationId=e.mutationId,u1(this,tr,e.defaultOptions),u1(this,$t,e.mutationCache),u1(this,E2,[]),this.state=e.state||wO(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...B(this,tr),...e},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){B(this,E2).includes(e)||(B(this,E2).push(e),this.clearGcTimeout(),B(this,$t).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){u1(this,E2,B(this,E2).filter(a=>a!==e)),this.scheduleGc(),B(this,$t).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){B(this,E2).length||(this.state.status==="pending"?this.scheduleGc():B(this,$t).remove(this))}continue(){var e;return((e=B(this,Da))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var n,l,i,o,c,v,h,s,u,g,p,f,z,M,m,V,b,w,y,x;const a=()=>(u1(this,Da,HO({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(L,S)=>{C1(this,P2,he).call(this,{type:"failed",failureCount:L,error:S})},onPause:()=>{C1(this,P2,he).call(this,{type:"pause"})},onContinue:()=>{C1(this,P2,he).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),B(this,Da).promise),r=this.state.status==="pending";try{if(!r){C1(this,P2,he).call(this,{type:"pending",variables:e}),await((l=(n=B(this,$t).config).onMutate)==null?void 0:l.call(n,e,this));const S=await((o=(i=this.options).onMutate)==null?void 0:o.call(i,e));S!==this.state.context&&C1(this,P2,he).call(this,{type:"pending",context:S,variables:e})}const L=await a();return await((v=(c=B(this,$t).config).onSuccess)==null?void 0:v.call(c,L,e,this.state.context,this)),await((s=(h=this.options).onSuccess)==null?void 0:s.call(h,L,e,this.state.context)),await((g=(u=B(this,$t).config).onSettled)==null?void 0:g.call(u,L,null,this.state.variables,this.state.context,this)),await((f=(p=this.options).onSettled)==null?void 0:f.call(p,L,null,e,this.state.context)),C1(this,P2,he).call(this,{type:"success",data:L}),L}catch(L){try{throw await((M=(z=B(this,$t).config).onError)==null?void 0:M.call(z,L,e,this.state.context,this)),await((V=(m=this.options).onError)==null?void 0:V.call(m,L,e,this.state.context)),await((w=(b=B(this,$t).config).onSettled)==null?void 0:w.call(b,void 0,L,this.state.variables,this.state.context,this)),await((x=(y=this.options).onSettled)==null?void 0:x.call(y,void 0,L,e,this.state.context)),L}finally{C1(this,P2,he).call(this,{type:"error",error:L})}}}},E2=new WeakMap,tr=new WeakMap,$t=new WeakMap,Da=new WeakMap,P2=new WeakSet,he=function(e){const a=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!ao(this.options.networkMode),status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=a(this.state),zt.batch(()=>{B(this,E2).forEach(r=>{r.onMutationUpdate(e)}),B(this,$t).notify({mutation:this,type:"updated",action:e})})},ff);function wO(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var d2,er,Ue,pf,O31=(pf=class extends s0{constructor(e={}){super();z1(this,d2,void 0);z1(this,er,void 0);z1(this,Ue,void 0);this.config=e,u1(this,d2,[]),u1(this,er,0)}build(e,a,r){const n=new L31({mutationCache:this,mutationId:++Cr(this,er)._,options:e.defaultMutationOptions(a),state:r});return this.add(n),n}add(e){B(this,d2).push(e),this.notify({type:"added",mutation:e})}remove(e){u1(this,d2,B(this,d2).filter(a=>a!==e)),this.notify({type:"removed",mutation:e})}clear(){zt.batch(()=>{B(this,d2).forEach(e=>{this.remove(e)})})}getAll(){return B(this,d2)}find(e){const a={exact:!0,...e};return B(this,d2).find(r=>tf(a,r))}findAll(e={}){return B(this,d2).filter(a=>tf(e,a))}notify(e){zt.batch(()=>{this.listeners.forEach(a=>{a(e)})})}resumePausedMutations(){return u1(this,Ue,(B(this,Ue)??Promise.resolve()).then(()=>{const e=B(this,d2).filter(a=>a.state.isPaused);return zt.batch(()=>e.reduce((a,r)=>a.then(()=>r.continue().catch(g2)),Promise.resolve()))}).then(()=>{u1(this,Ue,void 0)})),B(this,Ue)}},d2=new WeakMap,er=new WeakMap,Ue=new WeakMap,pf);function S31(t){return{onFetch:(e,a)=>{const r=async()=>{var p,f,z,M,m;const n=e.options,l=(z=(f=(p=e.fetchOptions)==null?void 0:p.meta)==null?void 0:f.fetchMore)==null?void 0:z.direction,i=((M=e.state.data)==null?void 0:M.pages)||[],o=((m=e.state.data)==null?void 0:m.pageParams)||[],c={pages:[],pageParams:[]};let v=!1;const h=V=>{Object.defineProperty(V,"signal",{enumerable:!0,get:()=>(e.signal.aborted?v=!0:e.signal.addEventListener("abort",()=>{v=!0}),e.signal)})},s=e.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${e.options.queryHash}'`))),u=async(V,b,w)=>{if(v)return Promise.reject();if(b==null&&V.pages.length)return Promise.resolve(V);const y={queryKey:e.queryKey,pageParam:b,direction:w?"backward":"forward",meta:e.options.meta};h(y);const x=await s(y),{maxPages:L}=e.options,S=w?M31:z31;return{pages:S(V.pages,x,L),pageParams:S(V.pageParams,b,L)}};let g;if(l&&i.length){const V=l==="backward",b=V?C31:nf,w={pages:i,pageParams:o},y=b(n,w);g=await u(w,y,V)}else{g=await u(c,o[0]??n.initialPageParam);const V=t??i.length;for(let b=1;b<V;b++){const w=nf(n,g);g=await u(g,w)}}return g};e.options.persister?e.fetchFn=()=>{var n,l;return(l=(n=e.options).persister)==null?void 0:l.call(n,r,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},a)}:e.fetchFn=r}}}function nf(t,{pages:e,pageParams:a}){const r=e.length-1;return t.getNextPageParam(e[r],e,a[r],a)}function C31(t,{pages:e,pageParams:a}){var r;return(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,a[0],a)}var ft,ue,ge,Fa,qa,fe,Wa,Ka,zf,B31=(zf=class{constructor(t={}){z1(this,ft,void 0);z1(this,ue,void 0);z1(this,ge,void 0);z1(this,Fa,void 0);z1(this,qa,void 0);z1(this,fe,void 0);z1(this,Wa,void 0);z1(this,Ka,void 0);u1(this,ft,t.queryCache||new x31),u1(this,ue,t.mutationCache||new O31),u1(this,ge,t.defaultOptions||{}),u1(this,Fa,new Map),u1(this,qa,new Map),u1(this,fe,0)}mount(){Cr(this,fe)._++,B(this,fe)===1&&(u1(this,Wa,pi.subscribe(()=>{pi.isFocused()&&(this.resumePausedMutations(),B(this,ft).onFocus())})),u1(this,Ka,zi.subscribe(()=>{zi.isOnline()&&(this.resumePausedMutations(),B(this,ft).onOnline())})))}unmount(){var t,e;Cr(this,fe)._--,B(this,fe)===0&&((t=B(this,Wa))==null||t.call(this),u1(this,Wa,void 0),(e=B(this,Ka))==null||e.call(this),u1(this,Ka,void 0))}isFetching(t){return B(this,ft).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return B(this,ue).findAll({...t,status:"pending"}).length}getQueryData(t){var e;return(e=B(this,ft).find({queryKey:t}))==null?void 0:e.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);return e!==void 0?Promise.resolve(e):this.fetchQuery(t)}getQueriesData(t){return this.getQueryCache().findAll(t).map(({queryKey:e,state:a})=>{const r=a.data;return[e,r]})}setQueryData(t,e,a){const r=B(this,ft).find({queryKey:t}),n=r==null?void 0:r.state.data,l=p31(e,n);if(typeof l>"u")return;const i=this.defaultQueryOptions({queryKey:t});return B(this,ft).build(this,i).setData(l,{...a,manual:!0})}setQueriesData(t,e,a){return zt.batch(()=>this.getQueryCache().findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,a)]))}getQueryState(t){var e;return(e=B(this,ft).find({queryKey:t}))==null?void 0:e.state}removeQueries(t){const e=B(this,ft);zt.batch(()=>{e.findAll(t).forEach(a=>{e.remove(a)})})}resetQueries(t,e){const a=B(this,ft),r={type:"active",...t};return zt.batch(()=>(a.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const a={revert:!0,...e},r=zt.batch(()=>B(this,ft).findAll(t).map(n=>n.cancel(a)));return Promise.all(r).then(g2).catch(g2)}invalidateQueries(t={},e={}){return zt.batch(()=>{if(B(this,ft).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const a={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(a,e)})}refetchQueries(t={},e){const a={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=zt.batch(()=>B(this,ft).findAll(t).filter(n=>!n.isDisabled()).map(n=>{let l=n.fetch(void 0,a);return a.throwOnError||(l=l.catch(g2)),n.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(r).then(g2)}fetchQuery(t){const e=this.defaultQueryOptions(t);typeof e.retry>"u"&&(e.retry=!1);const a=B(this,ft).build(this,e);return a.isStaleByTime(e.staleTime)?a.fetch(e):Promise.resolve(a.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(g2).catch(g2)}fetchInfiniteQuery(t){return t.behavior=S31(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(g2).catch(g2)}resumePausedMutations(){return B(this,ue).resumePausedMutations()}getQueryCache(){return B(this,ft)}getMutationCache(){return B(this,ue)}getDefaultOptions(){return B(this,ge)}setDefaultOptions(t){u1(this,ge,t)}setQueryDefaults(t,e){B(this,Fa).set(X0(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...B(this,Fa).values()];let a={};return e.forEach(r=>{_0(t,r.queryKey)&&(a={...a,...r.defaultOptions})}),a}setMutationDefaults(t,e){B(this,qa).set(X0(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...B(this,qa).values()];let a={};return e.forEach(r=>{_0(t,r.mutationKey)&&(a={...a,...r.defaultOptions})}),a}defaultQueryOptions(t){if(t!=null&&t._defaulted)return t;const e={...B(this,ge).queries,...(t==null?void 0:t.queryKey)&&this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Rh(e.queryKey,e)),typeof e.refetchOnReconnect>"u"&&(e.refetchOnReconnect=e.networkMode!=="always"),typeof e.throwOnError>"u"&&(e.throwOnError=!!e.suspense),typeof e.networkMode>"u"&&e.persister&&(e.networkMode="offlineFirst"),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...B(this,ge).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){B(this,ft).clear(),B(this,ue).clear()}},ft=new WeakMap,ue=new WeakMap,ge=new WeakMap,Fa=new WeakMap,qa=new WeakMap,fe=new WeakMap,Wa=new WeakMap,Ka=new WeakMap,zf),Ut,Q1,Ua,It,Ze,Za,I2,ar,Ga,Ja,Ge,Je,pe,Ye,Qe,k0,rr,Xc,nr,_c,lr,$c,ir,t3,or,e3,cr,a3,hr,r3,Mi,bO,Mf,A31=(Mf=class extends s0{constructor(e,a){super();z1(this,Qe);z1(this,rr);z1(this,nr);z1(this,lr);z1(this,ir);z1(this,or);z1(this,cr);z1(this,hr);z1(this,Mi);z1(this,Ut,void 0);z1(this,Q1,void 0);z1(this,Ua,void 0);z1(this,It,void 0);z1(this,Ze,void 0);z1(this,Za,void 0);z1(this,I2,void 0);z1(this,ar,void 0);z1(this,Ga,void 0);z1(this,Ja,void 0);z1(this,Ge,void 0);z1(this,Je,void 0);z1(this,pe,void 0);z1(this,Ye,void 0);u1(this,Q1,void 0),u1(this,Ua,void 0),u1(this,It,void 0),u1(this,Ye,new Set),u1(this,Ut,e),this.options=a,u1(this,I2,null),this.bindMethods(),this.setOptions(a)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(B(this,Q1).addObserver(this),lf(B(this,Q1),this.options)?C1(this,Qe,k0).call(this):this.updateResult(),C1(this,ir,t3).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return n3(B(this,Q1),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return n3(B(this,Q1),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,C1(this,or,e3).call(this),C1(this,cr,a3).call(this),B(this,Q1).removeObserver(this)}setOptions(e,a){const r=this.options,n=B(this,Q1);if(this.options=B(this,Ut).defaultQueryOptions(e),fi(r,this.options)||B(this,Ut).getQueryCache().notify({type:"observerOptionsUpdated",query:B(this,Q1),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=r.queryKey),C1(this,hr,r3).call(this);const l=this.hasListeners();l&&of(B(this,Q1),n,this.options,r)&&C1(this,Qe,k0).call(this),this.updateResult(a),l&&(B(this,Q1)!==n||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&C1(this,rr,Xc).call(this);const i=C1(this,nr,_c).call(this);l&&(B(this,Q1)!==n||this.options.enabled!==r.enabled||i!==B(this,pe))&&C1(this,lr,$c).call(this,i)}getOptimisticResult(e){const a=B(this,Ut).getQueryCache().build(B(this,Ut),e),r=this.createResult(a,e);return P31(this,r)&&(u1(this,It,r),u1(this,Za,this.options),u1(this,Ze,B(this,Q1).state)),r}getCurrentResult(){return B(this,It)}trackResult(e){const a={};return Object.keys(e).forEach(r=>{Object.defineProperty(a,r,{configurable:!1,enumerable:!0,get:()=>(B(this,Ye).add(r),e[r])})}),a}getCurrentQuery(){return B(this,Q1)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const a=B(this,Ut).defaultQueryOptions(e),r=B(this,Ut).getQueryCache().build(B(this,Ut),a);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,a))}fetch(e){return C1(this,Qe,k0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),B(this,It)))}createResult(e,a){var y;const r=B(this,Q1),n=this.options,l=B(this,It),i=B(this,Ze),o=B(this,Za),v=e!==r?e.state:B(this,Ua),{state:h}=e;let{error:s,errorUpdatedAt:u,fetchStatus:g,status:p}=h,f=!1,z;if(a._optimisticResults){const x=this.hasListeners(),L=!x&&lf(e,a),S=x&&of(e,r,a,n);(L||S)&&(g=ao(e.options.networkMode)?"fetching":"paused",h.dataUpdatedAt||(p="pending")),a._optimisticResults==="isRestoring"&&(g="idle")}if(a.select&&typeof h.data<"u")if(l&&h.data===(i==null?void 0:i.data)&&a.select===B(this,ar))z=B(this,Ga);else try{u1(this,ar,a.select),z=a.select(h.data),z=Qc(l==null?void 0:l.data,z,a),u1(this,Ga,z),u1(this,I2,null)}catch(x){u1(this,I2,x)}else z=h.data;if(typeof a.placeholderData<"u"&&typeof z>"u"&&p==="pending"){let x;if(l!=null&&l.isPlaceholderData&&a.placeholderData===(o==null?void 0:o.placeholderData))x=l.data;else if(x=typeof a.placeholderData=="function"?a.placeholderData((y=B(this,Ja))==null?void 0:y.state.data,B(this,Ja)):a.placeholderData,a.select&&typeof x<"u")try{x=a.select(x),u1(this,I2,null)}catch(L){u1(this,I2,L)}typeof x<"u"&&(p="success",z=Qc(l==null?void 0:l.data,x,a),f=!0)}B(this,I2)&&(s=B(this,I2),z=B(this,Ga),u=Date.now(),p="error");const M=g==="fetching",m=p==="pending",V=p==="error",b=m&&M;return{status:p,fetchStatus:g,isPending:m,isSuccess:p==="success",isError:V,isInitialLoading:b,isLoading:b,data:z,dataUpdatedAt:h.dataUpdatedAt,error:s,errorUpdatedAt:u,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>v.dataUpdateCount||h.errorUpdateCount>v.errorUpdateCount,isFetching:M,isRefetching:M&&!m,isLoadingError:V&&h.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:f,isRefetchError:V&&h.dataUpdatedAt!==0,isStale:kh(e,a),refetch:this.refetch}}updateResult(e){const a=B(this,It),r=this.createResult(B(this,Q1),this.options);if(u1(this,Ze,B(this,Q1).state),u1(this,Za,this.options),B(this,Ze).data!==void 0&&u1(this,Ja,B(this,Q1)),fi(r,a))return;u1(this,It,r);const n={},l=()=>{if(!a)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!B(this,Ye).size)return!0;const c=new Set(o??B(this,Ye));return this.options.throwOnError&&c.add("error"),Object.keys(B(this,It)).some(v=>{const h=v;return B(this,It)[h]!==a[h]&&c.has(h)})};(e==null?void 0:e.listeners)!==!1&&l()&&(n.listeners=!0),C1(this,Mi,bO).call(this,{...n,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&C1(this,ir,t3).call(this)}},Ut=new WeakMap,Q1=new WeakMap,Ua=new WeakMap,It=new WeakMap,Ze=new WeakMap,Za=new WeakMap,I2=new WeakMap,ar=new WeakMap,Ga=new WeakMap,Ja=new WeakMap,Ge=new WeakMap,Je=new WeakMap,pe=new WeakMap,Ye=new WeakMap,Qe=new WeakSet,k0=function(e){C1(this,hr,r3).call(this);let a=B(this,Q1).fetch(this.options,e);return e!=null&&e.throwOnError||(a=a.catch(g2)),a},rr=new WeakSet,Xc=function(){if(C1(this,or,e3).call(this),r0||B(this,It).isStale||!Jc(this.options.staleTime))return;const a=pO(B(this,It).dataUpdatedAt,this.options.staleTime)+1;u1(this,Ge,setTimeout(()=>{B(this,It).isStale||this.updateResult()},a))},nr=new WeakSet,_c=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(B(this,Q1)):this.options.refetchInterval)??!1},lr=new WeakSet,$c=function(e){C1(this,cr,a3).call(this),u1(this,pe,e),!(r0||this.options.enabled===!1||!Jc(B(this,pe))||B(this,pe)===0)&&u1(this,Je,setInterval(()=>{(this.options.refetchIntervalInBackground||pi.isFocused())&&C1(this,Qe,k0).call(this)},B(this,pe)))},ir=new WeakSet,t3=function(){C1(this,rr,Xc).call(this),C1(this,lr,$c).call(this,C1(this,nr,_c).call(this))},or=new WeakSet,e3=function(){B(this,Ge)&&(clearTimeout(B(this,Ge)),u1(this,Ge,void 0))},cr=new WeakSet,a3=function(){B(this,Je)&&(clearInterval(B(this,Je)),u1(this,Je,void 0))},hr=new WeakSet,r3=function(){const e=B(this,Ut).getQueryCache().build(B(this,Ut),this.options);if(e===B(this,Q1))return;const a=B(this,Q1);u1(this,Q1,e),u1(this,Ua,e.state),this.hasListeners()&&(a==null||a.removeObserver(this),e.addObserver(this))},Mi=new WeakSet,bO=function(e){zt.batch(()=>{e.listeners&&this.listeners.forEach(a=>{a(B(this,It))}),B(this,Ut).getQueryCache().notify({query:B(this,Q1),type:"observerResultsUpdated"})})},Mf);function E31(t,e){return e.enabled!==!1&&!t.state.dataUpdatedAt&&!(t.state.status==="error"&&e.retryOnMount===!1)}function lf(t,e){return E31(t,e)||t.state.dataUpdatedAt>0&&n3(t,e,e.refetchOnMount)}function n3(t,e,a){if(e.enabled!==!1){const r=typeof a=="function"?a(t):a;return r==="always"||r!==!1&&kh(t,e)}return!1}function of(t,e,a,r){return a.enabled!==!1&&(t!==e||r.enabled===!1)&&(!a.suspense||t.state.status!=="error")&&kh(t,a)}function kh(t,e){return t.isStaleByTime(e.staleTime)}function P31(t,e){return!fi(t.getCurrentResult(),e)}var ze,Dt,u2,Y2,Ya,E4,sr,l3,mf,I31=(mf=class extends s0{constructor(a,r){super();z1(this,Ya);z1(this,sr);z1(this,ze,void 0);z1(this,Dt,void 0);z1(this,u2,void 0);z1(this,Y2,void 0);u1(this,Dt,void 0),u1(this,ze,a),this.setOptions(r),this.bindMethods(),C1(this,Ya,E4).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){var n;const r=this.options;this.options=B(this,ze).defaultMutationOptions(a),fi(r,this.options)||B(this,ze).getMutationCache().notify({type:"observerOptionsUpdated",mutation:B(this,u2),observer:this}),(n=B(this,u2))==null||n.setOptions(this.options)}onUnsubscribe(){var a;this.hasListeners()||(a=B(this,u2))==null||a.removeObserver(this)}onMutationUpdate(a){C1(this,Ya,E4).call(this),C1(this,sr,l3).call(this,a)}getCurrentResult(){return B(this,Dt)}reset(){u1(this,u2,void 0),C1(this,Ya,E4).call(this),C1(this,sr,l3).call(this)}mutate(a,r){var n;return u1(this,Y2,r),(n=B(this,u2))==null||n.removeObserver(this),u1(this,u2,B(this,ze).getMutationCache().build(B(this,ze),this.options)),B(this,u2).addObserver(this),B(this,u2).execute(a)}},ze=new WeakMap,Dt=new WeakMap,u2=new WeakMap,Y2=new WeakMap,Ya=new WeakSet,E4=function(){var r;const a=((r=B(this,u2))==null?void 0:r.state)??wO();u1(this,Dt,{...a,isPending:a.status==="pending",isSuccess:a.status==="success",isError:a.status==="error",isIdle:a.status==="idle",mutate:this.mutate,reset:this.reset})},sr=new WeakSet,l3=function(a){zt.batch(()=>{var r,n,l,i,o,c,v,h;B(this,Y2)&&this.hasListeners()&&((a==null?void 0:a.type)==="success"?((n=(r=B(this,Y2)).onSuccess)==null||n.call(r,a.data,B(this,Dt).variables,B(this,Dt).context),(i=(l=B(this,Y2)).onSettled)==null||i.call(l,a.data,null,B(this,Dt).variables,B(this,Dt).context)):(a==null?void 0:a.type)==="error"&&((c=(o=B(this,Y2)).onError)==null||c.call(o,a.error,B(this,Dt).variables,B(this,Dt).context),(h=(v=B(this,Y2)).onSettled)==null||h.call(v,void 0,a.error,B(this,Dt).variables,B(this,Dt).context))),this.listeners.forEach(s=>{s(B(this,Dt))})})},mf);var yO=O.createContext(void 0),n2=t=>{const e=O.useContext(yO);if(t)return t;if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},R31=({client:t,children:e})=>(O.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),O.createElement(yO.Provider,{value:t},e)),xO=O.createContext(!1),k31=()=>O.useContext(xO),Jh1=xO.Provider;function N31(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var T31=O.createContext(N31()),j31=()=>O.useContext(T31);function LO(t,e){return typeof t=="function"?t(...e):!!t}var D31=(t,e)=>{(t.suspense||t.throwOnError)&&(e.isReset()||(t.retryOnMount=!1))},F31=t=>{O.useEffect(()=>{t.clearReset()},[t])},q31=({result:t,errorResetBoundary:e,throwOnError:a,query:r})=>t.isError&&!e.isReset()&&!t.isFetching&&LO(a,[t.error,r]);var W31=t=>{t.suspense&&typeof t.staleTime!="number"&&(t.staleTime=1e3)};var K31=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,U31=(t,e,a)=>e.fetchOptimistic(t).catch(()=>{a.clearReset()});function Z31(t,e,a){if(process.env.NODE_ENV!=="production"&&(typeof t!="object"||Array.isArray(t)))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 r=n2(a),n=k31(),l=j31(),i=r.defaultQueryOptions(t);i._optimisticResults=n?"isRestoring":"optimistic",W31(i),D31(i,l),F31(l);const[o]=O.useState(()=>new e(r,i)),c=o.getOptimisticResult(i);if(O.useSyncExternalStore(O.useCallback(v=>{const h=n?()=>{}:o.subscribe(zt.batchCalls(v));return o.updateResult(),h},[o,n]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),O.useEffect(()=>{o.setOptions(i,{listeners:!1})},[i,o]),K31(i,c))throw U31(i,o,l);if(q31({result:c,errorResetBoundary:l,throwOnError:i.throwOnError,query:o.getCurrentQuery()}))throw c.error;return i.notifyOnChangeProps?c:o.trackResult(c)}function Lr(t,e){return Z31(t,A31,e)}function S2(t,e){const a=n2(e),[r]=O.useState(()=>new I31(a,t));O.useEffect(()=>{r.setOptions(t)},[r,t]);const n=O.useSyncExternalStore(O.useCallback(i=>r.subscribe(zt.batchCalls(i)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),l=O.useCallback((i,o)=>{r.mutate(i,o).catch(G31)},[r]);if(n.error&&LO(r.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:l,mutateAsync:n.mutate}}function G31(){}function Nt(){return n2().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const Se=()=>{const{data:t,refetch:e}=Lr({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[t,a=>{a&&(localStorage.setItem("currentPage",a||""),e())}]};let cf="";const Or=()=>(cf=localStorage.getItem("__chai_at"),cf);function J31(t){const e={method:"GET",headers:{"x-chai-access-token":Or()}};return fetch(t,e)}function Y31(t,e){const a={method:"POST",headers:{"x-chai-access-token":Or()},body:JSON.stringify(e)};return fetch(t,a)}function Q31(t,e){const a={method:"PUT",headers:{"x-chai-access-token":Or()},body:JSON.stringify(e)};return fetch(t,a)}function X31(t,e){const a={method:"DELETE",headers:{"x-chai-access-token":Or()},body:JSON.stringify(e)};return fetch(t,a)}const l2={get:J31,post:Y31,put:Q31,delete:X31},Nh=()=>{const[t,e]=Se(),a=Nt();return Lr({queryKey:["project"],queryFn:async()=>{const{data:r}=await l2.get(`${a}/project`).then(n=>n.json());if(!t&&r){const n=localStorage.getItem("currentPage");e(n||(r==null?void 0:r.homepage))}return r}})},Th=()=>{const t=Nt();return Lr({queryKey:["pages"],queryFn:async()=>{const{data:e}=await l2.get(`${t}/pages`).then(a=>a.json());return e||[]}})},OO=()=>{const[t]=Se(),e=Nt();return Lr({queryKey:["page_data",t],queryFn:async()=>{const{data:a}=await l2.get(`${e}/page?uuid=${t}`).then(r=>r.json());return a},enabled:!!t,staleTime:3e3})},i3=()=>r1.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:r1.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[r1.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[r1.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),r1.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),r1.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),r1.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),r1.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),SO=(t="Project updated successfully.")=>{const e=n2(),a=Nt();return S2({mutationFn:async r=>await l2.put(`${a}/project`,r).then(n=>n.json()),onSuccess:()=>{e.invalidateQueries({queryKey:["project"]}),F2.toast.success(t)}})},CO=()=>{const[t]=["SAVED"],[e,a]=Se(),r=o1.useBuilderReset();return n=>t!=="SAVED"?(F2.toast.error("You have unsaved changes. Please save before changing the page."),!1):e===n.uuid?!1:(r(),setTimeout(()=>{a(n.uuid)},100),!0)},_31=()=>{const t=n2(),e=CO(),a=Nt();return S2({mutationFn:async r=>l2.post(`${a}/pages`,r).then(n=>n.json()),onSuccess:r=>{t.invalidateQueries({queryKey:["pages"]}),e({uuid:r.uuid,slug:r.slug}),F2.toast.success("Page added successfully.")}})},BO=()=>{const t=Nt(),[e]=Se(),a=n2();return S2({mutationFn:async r=>l2.put(`${t}/page`,r).then(n=>n.json()),onSuccess:async r=>{var n;if(r.result==="error"&&((n=r.error)==null?void 0:n.code)=="PAGE_LOCKED"){a.invalidateQueries({queryKey:["page_data",e]});return}F2.toast.success("Page saved successfully.")}})},$31=()=>{const t=Nt(),{data:e}=Th(),[a]=Se(),{data:r}=Nh(),n=n2();return S2({mutationFn:async()=>{const l=e.find(i=>i.uuid===a).slug;return await l2.post(`${t}/publish`,{slug:l,uuid:a,isHomepage:(r==null?void 0:r.homepage)===a}).then(i=>i.json())},onSuccess:async l=>{var i;if(l.result==="error"&&((i=l.error)==null?void 0:i.code)=="PAGE_LOCKED"){n.invalidateQueries({queryKey:["page_data",a]});return}F2.toast.success("Page published successfully.",{position:"top-right",duration:2e3})}})},th1=()=>{const t=n2(),e=Nt();return S2({mutationFn:async a=>l2.delete(`${e}/page`,a).then(r=>r.json()),onSuccess:()=>{F2.toast.success("Page deleted successfully."),t.invalidateQueries({queryKey:["pages"]})}})},eh1=()=>{const t=n2(),e=Nt();return S2({mutationFn:async a=>l2.post(`${e}/take-control`,{uuid:a}).then(r=>r.json()),onSuccess:(a,r)=>{t.invalidateQueries({queryKey:["page_data",r]})}})},ah1=()=>{const t=Nt();return S2({mutationFn:async()=>{const{data:e}=await l2.get(`${t}/library`).then(a=>a.json());return rt.sortBy(rt.filter(e,a=>!rt.has(a,"hidden")),"group")}})},rh1=()=>{const t=Nt();return S2({mutationFn:async e=>{if(!e||!e.uuid)return[];try{const{data:a}=await l2.get(`${t}/block?uuid=${e.uuid}&format=${e.format}`).then(async r=>e.format==="html"?FO.getBlocksFromHTML(await r.text()):await r.json());return rt.set(a,"0._name",rt.capitalize(e.group)),a||[]}catch{return[]}}})},nh1=()=>{const t=Nt();return S2({mutationFn:async e=>{const a=new FormData;a.append("file",e);const{data:r}=await fetch(`${t}/upload`,{method:"POST",headers:{"x-chai-access-token":Or()},body:a}).then(n=>n.json());return r}})};var AO={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},hf=d.createContext&&d.createContext(AO),we=function(){return we=Object.assign||function(t){for(var e,a=1,r=arguments.length;a<r;a++){e=arguments[a];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},we.apply(this,arguments)},lh1=function(t,e){var a={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(a[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(t);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(t,r[n])&&(a[r[n]]=t[r[n]]);return a};function EO(t){return t&&t.map(function(e,a){return d.createElement(e.tag,we({key:a},e.attr),EO(e.child))})}function PO(t){return function(e){return d.createElement(ih1,we({attr:we({},t.attr)},e),EO(t.child))}}function ih1(t){var e=function(a){var r=t.attr,n=t.size,l=t.title,i=lh1(t,["attr","size","title"]),o=n||a.size||"1em",c;return a.className&&(c=a.className),t.className&&(c=(c?c+" ":"")+t.className),d.createElement("svg",we({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},a.attr,r,i,{className:c,style:we(we({color:t.color||a.color},a.style),t.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),l&&d.createElement("title",null,l),t.children)};return hf!==void 0?d.createElement(hf.Consumer,null,function(a){return e(a)}):e(AO)}function IO(t){return PO({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"}}]})(t)}function oh1(t){return PO({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"}}]})(t)}const ch1=()=>{const{mutate:t,isPending:e}=eh1(),[a]=Se(),{data:r}=OO(),n=rt.get(r,"lockedBy.name",""),l=rt.get(r,"lockedBy.email","");return r1.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:[r1.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",r1.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),r1.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",r1.jsxRuntimeExports.jsx("br",{}),r1.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[r1.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[r1.jsxRuntimeExports.jsx(oh1,{className:"w-4 h-4 text-gray-500"})," ",n]}),r1.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[r1.jsxRuntimeExports.jsx(IO,{className:"w-4 h-4 text-gray-500"})," ",l]})]}),r1.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",n," will be ",r1.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),r1.jsxRuntimeExports.jsx(o1.Button,{disabled:e,onClick:()=>t(a),className:`w-36 ${e?"bg-transparent shadow-none hover:bg-transparent":""}`,children:e?r1.jsxRuntimeExports.jsx(o3.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},hh1=()=>{const t=Nt(),e=n2();return S2({mutationFn:async a=>{const r=await fetch(`${t}/login`,{method:"POST",body:JSON.stringify(a)});if(r.ok)return await r.json();throw r.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:a=>{const{data:r}=a;if(!r.accessToken){F2.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",r.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(rt.omit(r,["accessToken"]))),e.invalidateQueries({queryKey:["verify"]}),F2.toast.success("Logged in successfully.")},onError:()=>{F2.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},sh1=()=>{const t=Nt();return Lr({queryKey:["verify"],queryFn:async()=>{const e=await l2.get(`${t}/verify`);return e.ok?(await e.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},vh1=()=>{const t=Nt(),e=n2();return S2({mutationFn:async()=>{const{result:a}=await l2.post(`${t}/logout`).then(r=>r.json());if(a==="success")return localStorage.clear(),e.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},dh1=({children:t})=>{const e=vh1();return r1.jsxRuntimeExports.jsxs(o1.AlertDialog,{children:[r1.jsxRuntimeExports.jsx(o1.AlertDialogTrigger,{asChild:!0,children:t}),r1.jsxRuntimeExports.jsxs(o1.AlertDialogContent,{children:[r1.jsxRuntimeExports.jsxs(o1.AlertDialogHeader,{children:[r1.jsxRuntimeExports.jsxs(o1.AlertDialogTitle,{children:["Are you sure, you want to ",r1.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),r1.jsxRuntimeExports.jsx(o1.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"})]}),r1.jsxRuntimeExports.jsxs(o1.AlertDialogFooter,{children:[r1.jsxRuntimeExports.jsx(o1.AlertDialogCancel,{disabled:e.isPending,children:"Cancel"}),r1.jsxRuntimeExports.jsxs("button",{disabled:e.isPending,onClick:()=>e.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:[e.isPending&&r1.jsxRuntimeExports.jsx(o3.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},uh1=()=>r1.jsxRuntimeExports.jsx(dh1,{children:r1.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:r1.jsxRuntimeExports.jsx(o3.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),gh1=d.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-J8uYp1Tp.cjs"))),fh1=d.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-IXVY1LJ_.cjs"))),ph1=d.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-JJpZpFko.cjs"))),zh1=()=>r1.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),Mh1=()=>{const{mutate:t}=$31();return o1.useBuilderProp("editable",!0)?r1.jsxRuntimeExports.jsx(o1.Button,{onClick:t,className:"bg-blue-600 text-white",children:"Publish"}):null},mh1=t=>{const{data:e,isLoading:a}=Nh(),{data:r,isLoading:n}=Th(),{data:l}=OO(),{mutate:i}=SO(),{mutate:o}=BO(),[c]=Se(),v=nh1(),h=ah1(),s=rh1(),u=Nt(),g=d.useCallback(async m=>await v.mutateAsync(m),[v]),p=d.useCallback(async()=>await h.mutateAsync(),[h]),f=d.useCallback(async m=>await s.mutateAsync(m),[s]),z=async(m=20,V=0)=>{const b=`limit=${m}&offset=${V}`;return await fetch(`${u}/assets?${b}`).then(w=>w.json())},{logo:M=zh1}=t;return a||!e?r1.jsxRuntimeExports.jsx(i3,{}):n||!r?r1.jsxRuntimeExports.jsx(i3,{}):r1.jsxRuntimeExports.jsx("div",{className:"bg-background text-foreground",children:r1.jsxRuntimeExports.jsx(fO,{editable:l!=null&&l.lockedBy?l==null?void 0:l.lockedBy.self:!0,nonEditableComponent:ch1,blocks:(l==null?void 0:l.blocks)||[],brandingOptions:e.brandingOptions,darkMode:t.darkMode||!1,dataProviders:(l==null?void 0:l.providers)||[],onSavePage:async({blocks:m,providers:V})=>(await o({blocks:m,providers:V,uuid:c}),!0),onSaveBrandingOptions:async m=>(await i({brandingOptions:m}),!0),topBarComponents:{left:[M],center:[ph1],right:[Mh1]},sideBarComponents:{top:[{icon:P4.FileTextIcon,name:"pages",panel:gh1},{icon:P4.GearIcon,name:"settings",panel:fh1}],bottom:[uh1]},uploadMediaCallback:g,fetchMediaCallback:z,getUILibraryBlocks:p,getExternalPredefinedBlock:f,getPages:()=>r,unsplashAccessKey:t.unsplashAccessKey||""})})},Hh1=({logo:t})=>{const[e,a]=d.useState(!1),[r,n]=d.useState(""),[l,i]=d.useState(""),{mutate:o,isPending:c}=hh1(),v=h=>{h.preventDefault(),o({email:r,password:l})};return r1.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:r1.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:r1.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[r1.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[r1.jsxRuntimeExports.jsx(d.Suspense,{children:t?d.createElement(t):""}),r1.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"})]}),r1.jsxRuntimeExports.jsx("div",{className:"mt-8",children:r1.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:v,className:"space-y-5",children:[r1.jsxRuntimeExports.jsx("div",{children:r1.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[r1.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:r1.jsxRuntimeExports.jsx(IO,{})}),r1.jsxRuntimeExports.jsx("input",{value:r,onChange:h=>n(h.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"})]})}),r1.jsxRuntimeExports.jsx("div",{children:r1.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[r1.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:r1.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:r1.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"})})}),r1.jsxRuntimeExports.jsx("input",{value:l,onChange:h=>i(h.target.value),type:e?"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"}),r1.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>a(!e),children:e?r1.jsxRuntimeExports.jsx(P4.EyeClosedIcon,{}):r1.jsxRuntimeExports.jsx(P4.EyeOpenIcon,{})})]})}),r1.jsxRuntimeExports.jsx("div",{children:r1.jsxRuntimeExports.jsx("button",{disabled:c||rt.size(r)<2||rt.size(l)<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:c?"Signing in...":"Login"})})]})}),r1.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:r1.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},Vh1=t=>{const{data:e,isLoading:a}=sh1(),r=n2();return d.useEffect(()=>{r.setQueryData(["apiBaseUrl"],t.apiBaseUrl||"/api/chaibuilder")},[t.apiBaseUrl,r]),a?r1.jsxRuntimeExports.jsx(i3,{}):e!=null&&e.valid?r1.jsxRuntimeExports.jsx(mh1,{...t}):r1.jsxRuntimeExports.jsx(Hh1,{logo:t.logo})},wh1=new B31,bh1=t=>r1.jsxRuntimeExports.jsxs(R31,{client:wh1,children:[r1.jsxRuntimeExports.jsx(F2.Toaster,{richColors:!0}),r1.jsxRuntimeExports.jsx(Vh1,{...t})]});exports.BlocksExternalDataProvider=o31;exports.ChaiBuilderEditor=fO;exports.ChaiBuilderStudio=bh1;exports.ErrorBoundary=dO;exports.reactIsExports=Pf;exports.useAddPage=_31;exports.useChaiExternalData=gO;exports.useChangePage=CO;exports.useCurrentPage=Se;exports.useDeletePage=th1;exports.useExpandedIds=l31;exports.usePages=Th;exports.useProject=Nh;exports.useQueryClient=n2;exports.useUpdatePage=BO;exports.useUpdateProject=SO;
|
|
@@ -734,9 +734,20 @@ const q = () => {
|
|
|
734
734
|
},
|
|
735
735
|
[e]
|
|
736
736
|
)];
|
|
737
|
-
}, Ye = (e) => [
|
|
738
|
-
|
|
739
|
-
|
|
737
|
+
}, Ye = (e) => [
|
|
738
|
+
"Box",
|
|
739
|
+
"Slot",
|
|
740
|
+
"Form",
|
|
741
|
+
"DataProvider",
|
|
742
|
+
"Link",
|
|
743
|
+
"List",
|
|
744
|
+
"ListItem",
|
|
745
|
+
"Row",
|
|
746
|
+
"Column",
|
|
747
|
+
"Table",
|
|
748
|
+
"Row",
|
|
749
|
+
"TableCell"
|
|
750
|
+
].includes(e), ti = (e) => !["Slot"].includes(e), si = (e) => !["Slot"].includes(e);
|
|
740
751
|
function Eo(e, t) {
|
|
741
752
|
return e === "Slot" || t === "List" && e !== "ListItem" || t === "Row" && e !== "Column" ? !1 : Ye(t);
|
|
742
753
|
}
|
|
@@ -1144,29 +1155,29 @@ const ds = () => {
|
|
|
1144
1155
|
}, us = y(!1);
|
|
1145
1156
|
us.debugLabel = "readOnlyModeAtom";
|
|
1146
1157
|
const sa = y(!1);
|
|
1147
|
-
sa.debugLabel = "
|
|
1148
|
-
const oa = y(
|
|
1149
|
-
oa.debugLabel = "
|
|
1150
|
-
const aa = y(
|
|
1151
|
-
aa.debugLabel = "
|
|
1158
|
+
sa.debugLabel = "advanceStylingOpenAtom";
|
|
1159
|
+
const oa = y("online");
|
|
1160
|
+
oa.debugLabel = "networkModeAtom";
|
|
1161
|
+
const aa = y(!1);
|
|
1162
|
+
aa.debugLabel = "codeEditorOpenAtom";
|
|
1152
1163
|
const na = y(!1);
|
|
1153
|
-
na.debugLabel = "
|
|
1154
|
-
const ra = y(
|
|
1155
|
-
ra.debugLabel = "
|
|
1164
|
+
na.debugLabel = "editLayerNameAtom";
|
|
1165
|
+
const ra = y("");
|
|
1166
|
+
ra.debugLabel = "activeLanguageAtom";
|
|
1156
1167
|
const ia = y("");
|
|
1157
|
-
ia.debugLabel = "
|
|
1158
|
-
const la = y(
|
|
1159
|
-
la.debugLabel = "
|
|
1160
|
-
const ca = y(
|
|
1161
|
-
ca.debugLabel = "
|
|
1162
|
-
const da = y(
|
|
1163
|
-
da.debugLabel = "
|
|
1164
|
-
const ua = y(
|
|
1165
|
-
ua.debugLabel = "
|
|
1166
|
-
const ma = y("");
|
|
1167
|
-
ma.debugLabel = "showPredefinedBlockCategoryAtom";
|
|
1168
|
+
ia.debugLabel = "primaryLanguageAtom";
|
|
1169
|
+
const la = y(null);
|
|
1170
|
+
la.debugLabel = "canvasIframeAtom";
|
|
1171
|
+
const ca = y("layers");
|
|
1172
|
+
ca.debugLabel = "activePanelAtom";
|
|
1173
|
+
const da = y(!1);
|
|
1174
|
+
da.debugLabel = "addBlockOffCanvasAtom";
|
|
1175
|
+
const ua = y("");
|
|
1176
|
+
ua.debugLabel = "showPredefinedBlockCategoryAtom";
|
|
1168
1177
|
const ze = y({ undoCount: 0, redoCount: 0 });
|
|
1169
1178
|
ze.debugLabel = "historyStatesAtom";
|
|
1179
|
+
const ma = y("");
|
|
1180
|
+
ma.debugLabel = "inlineEditingActiveAtom";
|
|
1170
1181
|
const ms = y([]);
|
|
1171
1182
|
ms.debugLabel = "dataProvidersAtom";
|
|
1172
1183
|
const pa = () => C(ms), gt = y("SAVED");
|
|
@@ -2582,7 +2593,7 @@ const Ar = (e) => {
|
|
|
2582
2593
|
}
|
|
2583
2594
|
)
|
|
2584
2595
|
] });
|
|
2585
|
-
}, Cr = et.lazy(() => import("./UnsplashImages-
|
|
2596
|
+
}, Cr = et.lazy(() => import("./UnsplashImages-UejSDiRk.js")), _r = et.lazy(() => import("./UploadImages-xBJTMBKX.js")), Es = ({
|
|
2586
2597
|
isModalView: e = !1,
|
|
2587
2598
|
onSelect: t = () => {
|
|
2588
2599
|
}
|
|
@@ -2669,30 +2680,20 @@ const Ar = (e) => {
|
|
|
2669
2680
|
const l = await r();
|
|
2670
2681
|
n(l || []);
|
|
2671
2682
|
})();
|
|
2672
|
-
}, [
|
|
2683
|
+
}, []), /* @__PURE__ */ a.jsxs("div", { children: [
|
|
2673
2684
|
/* @__PURE__ */ a.jsx("span", { className: "text-xs font-medium", children: (e == null ? void 0 : e.title) ?? "Link" }),
|
|
2674
2685
|
/* @__PURE__ */ a.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
|
|
2675
|
-
/* @__PURE__ */ a.jsx(
|
|
2676
|
-
"
|
|
2677
|
-
{
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
children: [
|
|
2683
|
-
{ const: "page", title: "Open Page" },
|
|
2684
|
-
{ const: "url", title: "Open URL" },
|
|
2685
|
-
{ const: "email", title: "Compose Email" },
|
|
2686
|
-
{ const: "telephone", title: "Call Phone" },
|
|
2687
|
-
{ const: "scroll", title: "Scroll to element" }
|
|
2688
|
-
].map((l) => /* @__PURE__ */ a.jsx("option", { value: l.const, children: l.title }, l.const))
|
|
2689
|
-
}
|
|
2690
|
-
),
|
|
2686
|
+
/* @__PURE__ */ a.jsx("select", { name: "type", value: i, onChange: (l) => s({ ...t, type: l.target.value }), children: [
|
|
2687
|
+
{ const: "page", title: "Open Page" },
|
|
2688
|
+
{ const: "url", title: "Open URL" },
|
|
2689
|
+
{ const: "email", title: "Compose Email" },
|
|
2690
|
+
{ const: "telephone", title: "Call Phone" },
|
|
2691
|
+
{ const: "scroll", title: "Scroll to element" }
|
|
2692
|
+
].map((l) => /* @__PURE__ */ a.jsx("option", { value: l.const, children: l.title }, l.const)) }),
|
|
2691
2693
|
i === "page" ? /* @__PURE__ */ a.jsxs(
|
|
2692
2694
|
"select",
|
|
2693
2695
|
{
|
|
2694
2696
|
name: "href",
|
|
2695
|
-
defaultValue: "",
|
|
2696
2697
|
placeholder: "Choose Page",
|
|
2697
2698
|
value: u,
|
|
2698
2699
|
onChange: (l) => s({ ...t, href: l.target.value }),
|
|
@@ -2756,7 +2757,7 @@ export {
|
|
|
2756
2757
|
fi as Z,
|
|
2757
2758
|
wa as _,
|
|
2758
2759
|
Yr as a,
|
|
2759
|
-
|
|
2760
|
+
oa as a$,
|
|
2760
2761
|
bi as a0,
|
|
2761
2762
|
hi as a1,
|
|
2762
2763
|
Ti as a2,
|
|
@@ -2790,8 +2791,8 @@ export {
|
|
|
2790
2791
|
Qn as aU,
|
|
2791
2792
|
Xn as aV,
|
|
2792
2793
|
Jn as aW,
|
|
2793
|
-
|
|
2794
|
-
|
|
2794
|
+
ma as aX,
|
|
2795
|
+
na as aY,
|
|
2795
2796
|
ti as aZ,
|
|
2796
2797
|
si as a_,
|
|
2797
2798
|
Zr as aa,
|
|
@@ -2819,10 +2820,10 @@ export {
|
|
|
2819
2820
|
ol as aw,
|
|
2820
2821
|
Dn as ax,
|
|
2821
2822
|
On as ay,
|
|
2822
|
-
|
|
2823
|
+
ca as az,
|
|
2823
2824
|
Z as b,
|
|
2824
2825
|
Tn as b$,
|
|
2825
|
-
|
|
2826
|
+
la as b0,
|
|
2826
2827
|
Hi as b1,
|
|
2827
2828
|
qi as b2,
|
|
2828
2829
|
wn as b3,
|
|
@@ -2837,7 +2838,7 @@ export {
|
|
|
2837
2838
|
pn as bC,
|
|
2838
2839
|
Ua as bD,
|
|
2839
2840
|
Ha as bE,
|
|
2840
|
-
|
|
2841
|
+
ua as bF,
|
|
2841
2842
|
Oa as bG,
|
|
2842
2843
|
ht as bH,
|
|
2843
2844
|
qa as bI,
|
|
@@ -2873,14 +2874,14 @@ export {
|
|
|
2873
2874
|
Ga as bl,
|
|
2874
2875
|
fn as bm,
|
|
2875
2876
|
Fi as bn,
|
|
2876
|
-
|
|
2877
|
+
sa as bo,
|
|
2877
2878
|
hn as bp,
|
|
2878
2879
|
vr as bq,
|
|
2879
2880
|
yr as br,
|
|
2880
2881
|
bl as bs,
|
|
2881
2882
|
xl as bt,
|
|
2882
2883
|
oi as bu,
|
|
2883
|
-
|
|
2884
|
+
da as bv,
|
|
2884
2885
|
ln as bw,
|
|
2885
2886
|
cn as bx,
|
|
2886
2887
|
dn as by,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-NV737rRe.js";
|
|
2
2
|
import s, { useState as n, Suspense as l } from "react";
|
|
3
3
|
import { ChevronRightIcon as c, GearIcon as u, HomeIcon as d, FileTextIcon as x } from "@radix-ui/react-icons";
|
|
4
|
-
import { b1 as g, b2 as h, b3 as f } from "./index-
|
|
5
|
-
import { e as j, b, d as N } from "./index-
|
|
4
|
+
import { b1 as g, b2 as h, b3 as f } from "./index-aPk1Fuat.js";
|
|
5
|
+
import { e as j, b, d as N } from "./index-0ZqKzbSx.js";
|
|
6
6
|
import "./MODIFIERS-MLfpKQY1.js";
|
|
7
7
|
import "@radix-ui/react-toggle";
|
|
8
8
|
import "class-variance-authority";
|
|
@@ -56,7 +56,7 @@ import "./tailwind-config-d1VL1lzE.js";
|
|
|
56
56
|
import "react-hotkeys-hook";
|
|
57
57
|
import "sonner";
|
|
58
58
|
import "lucide-react";
|
|
59
|
-
const v = s.lazy(() => import("./single-page-detail-
|
|
59
|
+
const v = s.lazy(() => import("./single-page-detail-7NRw-CLc.js")), P = ({ pageData: r }) => {
|
|
60
60
|
const [e, i] = n("CLOSE");
|
|
61
61
|
return /* @__PURE__ */ t.jsxs(
|
|
62
62
|
g,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),t=require("react"),n=require("@radix-ui/react-icons"),o=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),t=require("react"),n=require("@radix-ui/react-icons"),o=require("./index-4h4Ti2E4.cjs"),x=require("./index-LL32f5q7.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("lodash");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const q=t.lazy(()=>Promise.resolve().then(()=>require("./single-page-detail-gnpyWcy7.cjs"))),m=({pageData:s})=>{const[r,i]=t.useState("CLOSE");return e.jsxRuntimeExports.jsxs(o.Popover,{open:r==="OPEN"||r==="ALERT"||r==="PENDING",onOpenChange:u=>{i(r==="PENDING"?"ALERT":u?"OPEN":"CLOSE")},children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,onClick:u=>{u.stopPropagation(),i("OPEN")},children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:r==="OPEN"||r==="ALERT"||r==="PENDING"?e.jsxRuntimeExports.jsx(n.ChevronRightIcon,{}):e.jsxRuntimeExports.jsx("div",{className:"hidden hover:text-blue-600 group-hover:flex",children:e.jsxRuntimeExports.jsx(n.GearIcon,{})})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"right",align:"start",alignOffset:-35,className:"h-screen w-96",children:e.jsxRuntimeExports.jsx(t.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full animate-pulse flex-col gap-y-3",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-6 w-1/2"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-300 h-20 w-full"})]}),children:e.jsxRuntimeExports.jsx(q,{pageData:s,open:r,setOpen:i})})})]})},j=s=>{const[r]=x.useCurrentPage(),{data:i}=x.useProject(),u=x.useChangePage(),l=(i==null?void 0:i.homepage)===s.uuid,a=r===s.uuid,c=()=>u(s);return i?e.jsxRuntimeExports.jsxs("button",{className:`group relative flex w-full cursor-pointer items-center justify-between px-2.5 py-2 ${a?"bg-blue-200 ":""}`,onClick:c,type:"button",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex text-sm items-center gap-x-1.5",children:[l?e.jsxRuntimeExports.jsx(n.HomeIcon,{}):e.jsxRuntimeExports.jsx(n.FileTextIcon,{})," ",s.name]}),e.jsxRuntimeExports.jsx(m,{pageData:s})]}):null},p=({pages:s,isLoading:r})=>r?e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-1 px-2.5 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"}),e.jsxRuntimeExports.jsx("div",{className:"bg-background-200 h-7 w-full"})]}):s.length===0?e.jsxRuntimeExports.jsx("div",{className:"px-2.5 pb-2 pt-4",children:"No pages"}):e.jsxRuntimeExports.jsx("div",{className:"-mb-2",children:t.Children.toArray(s.map(i=>e.jsxRuntimeExports.jsx(j,{...i})))});exports.default=p;
|