@chaibuilder/sdk 1.2.59 → 1.2.60

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.
Files changed (64) hide show
  1. package/dist/{AddBlocks-MH_fqSRf.cjs → AddBlocks-BtMNa99n.cjs} +1 -1
  2. package/dist/{AddBlocks-05ZH2Suu.js → AddBlocks-L-3Io1jR.js} +6 -6
  3. package/dist/CanvasArea-KBfW2Hh3.js +978 -0
  4. package/dist/CanvasArea-ZNRxUJR7.cjs +59 -0
  5. package/dist/{CodeEditor-vECReGwz.cjs → CodeEditor-NuzOGqRn.cjs} +1 -1
  6. package/dist/{CodeEditor-zYBqhBv3.js → CodeEditor-cY6z8D4N.js} +1 -1
  7. package/dist/{CurrentPage-cOvRmEIZ.js → CurrentPage-XXy2OzNq.js} +3 -3
  8. package/dist/{CurrentPage-pwDwQsWa.cjs → CurrentPage-ccOL3l6S.cjs} +1 -1
  9. package/dist/ListTree-8jpTvI-s.cjs +1 -0
  10. package/dist/{ListTree-0iy8aBgI.js → ListTree-yoltG7gq.js} +2 -2
  11. package/dist/{PagesPanel-A3du_vDn.js → PagesPanel-XUtE4Aou.js} +4 -4
  12. package/dist/{PagesPanel-bfNUqq2a.cjs → PagesPanel-t3NlycIl.cjs} +1 -1
  13. package/dist/{ProjectPanel-92EtwSrh.js → ProjectPanel-3zkDX3az.js} +4 -4
  14. package/dist/{ProjectPanel-QMaTK2Jx.cjs → ProjectPanel-UClucyIl.cjs} +1 -1
  15. package/dist/{Settings-3ZuMFtd6.js → Settings-C9AegLbF.js} +2 -2
  16. package/dist/{Settings-8_Twq9DO.cjs → Settings-GVs7UvAX.cjs} +1 -1
  17. package/dist/{SidePanels-C8RdCe7y.cjs → SidePanels--qxWuuF-.cjs} +1 -1
  18. package/dist/{SidePanels-XUVc9jMH.js → SidePanels-Y3z3wyQx.js} +3 -3
  19. package/dist/{ThemeConfiguration-PvMN3j6h.cjs → ThemeConfiguration-03I3INEI.cjs} +1 -1
  20. package/dist/{ThemeConfiguration-ab7lbA2y.js → ThemeConfiguration-e_4e_ZcS.js} +1 -1
  21. package/dist/{Topbar-EkBS5_nt.cjs → Topbar-Yrhyc6IQ.cjs} +1 -1
  22. package/dist/{Topbar-VdVqOT-8.js → Topbar-lnCz7TLm.js} +2 -2
  23. package/dist/{UILibrariesPanel-CaGLzB9c.cjs → UILibrariesPanel-LGbh-IZP.cjs} +1 -1
  24. package/dist/{UILibrariesPanel-raxCToMd.js → UILibrariesPanel-PP4QDQRZ.js} +4 -4
  25. package/dist/{UnsplashImages-cah1BRL_.cjs → UnsplashImages-5JbDig-S.cjs} +1 -1
  26. package/dist/{UnsplashImages-alt_doTy.js → UnsplashImages-Y0TGxNbH.js} +1 -1
  27. package/dist/UploadImages-Dh35M55S.js +134 -0
  28. package/dist/UploadImages-f6wPPJxc.cjs +1 -0
  29. package/dist/{add-page-modal-VmIvQ5ug.cjs → add-page-modal-j2foeVKa.cjs} +1 -1
  30. package/dist/{add-page-modal-OH7DL-Yz.js → add-page-modal-sKH5SHMa.js} +4 -4
  31. package/dist/{confirm-alert-rYsxlfR4.cjs → confirm-alert-C3wsf6lk.cjs} +1 -1
  32. package/dist/{confirm-alert-m85JJlQi.js → confirm-alert-pGxJwZ2Q.js} +1 -1
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.js +2 -2
  35. package/dist/{delete-page-modal--g92Sj1h.js → delete-page-modal-4Tp_VPx1.js} +3 -3
  36. package/dist/{delete-page-modal-uSFaC2aS.cjs → delete-page-modal-XObwAnNB.cjs} +1 -1
  37. package/dist/email.cjs +1 -1
  38. package/dist/email.js +2 -2
  39. package/dist/{form-G3PqS2Gc.cjs → form-D9cWMUJ4.cjs} +1 -1
  40. package/dist/{form-MSL4CDff.js → form-pya-o19L.js} +1 -1
  41. package/dist/{index-yVCgnTlS.js → index-1teL5Lld.js} +3 -3
  42. package/dist/{index-4C2qT6ju.cjs → index-849lneVZ.cjs} +1 -1
  43. package/dist/{index-Phf9F3An.cjs → index-8Fxmy4tt.cjs} +42 -42
  44. package/dist/{index-uLn8W3eR.js → index-TzLilp-0.js} +99 -100
  45. package/dist/{index--t_K8Sw6.js → index-ZZTdYO7r.js} +17 -13
  46. package/dist/{index-0FIxW0gR.cjs → index-cH1CfTbV.cjs} +1 -1
  47. package/dist/{page-viewer-hBsE440V.js → page-viewer-Q-eOjWmS.js} +7 -7
  48. package/dist/{page-viewer-yIl2jRO8.cjs → page-viewer-tNzhbu_E.cjs} +1 -1
  49. package/dist/{project-general-setting-NFCzMKqN.cjs → project-general-setting-9fI_iZ_Q.cjs} +1 -1
  50. package/dist/{project-general-setting-9AGMKDNq.js → project-general-setting-uDDo2ktT.js} +4 -4
  51. package/dist/{project-seo-setting-3kFJ77jY.js → project-seo-setting-PXJe5SSV.js} +2 -2
  52. package/dist/{project-seo-setting-C3ilIIeM.cjs → project-seo-setting-rjrO9KDR.cjs} +1 -1
  53. package/dist/{single-page-detail-5qDQmlL-.js → single-page-detail-0ipAHwTX.js} +11 -11
  54. package/dist/{single-page-detail-wwJYm5lF.cjs → single-page-detail-s_kkO9Zj.cjs} +1 -1
  55. package/dist/studio.cjs +1 -1
  56. package/dist/studio.js +3 -3
  57. package/dist/ui.cjs +1 -1
  58. package/dist/ui.js +42 -42
  59. package/package.json +1 -1
  60. package/dist/CanvasArea-NLbaLcFM.cjs +0 -59
  61. package/dist/CanvasArea-akw7npWW.js +0 -1259
  62. package/dist/ListTree-Njsk1AzL.cjs +0 -1
  63. package/dist/UploadImages-5dRETWCo.cjs +0 -1
  64. package/dist/UploadImages-JqVL_aQd.js +0 -140
@@ -1,6 +1,6 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import { A as p, a as l, b as n, d, e as a, g as c, B as u } from "./index-uLn8W3eR.js";
3
- import { h } from "./index-yVCgnTlS.js";
2
+ import { A as p, a as l, b as n, d, e as a, g as c, B as u } from "./index-TzLilp-0.js";
3
+ import { h } from "./index-1teL5Lld.js";
4
4
  import { TrashIcon as x } from "@radix-ui/react-icons";
5
5
  import "./_commonjsHelpers-UyOWmZb0.js";
6
6
  import "react";
@@ -38,7 +38,7 @@ import "jotai";
38
38
  import "@react-hookz/web";
39
39
  import "tree-model";
40
40
  import "react-i18next";
41
- import "./index--t_K8Sw6.js";
41
+ import "./index-ZZTdYO7r.js";
42
42
  import "i18next";
43
43
  import "@floating-ui/react-dom";
44
44
  import "flagged";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("./index-0FIxW0gR.cjs"),l=require("./index-4C2qT6ju.cjs"),q=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");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("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("react-i18next");require("./index-Phf9F3An.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("sonner");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");const d=({pageData:i,projectData:t})=>{const n={},u=l.useDeletePage(),s=i.uuid===t.homepage,o=()=>{u.mutate(i,{onSuccess:()=>{n({uuid:t.homepage,slug:"/home"})}})};return e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{disabled:s,children:e.jsxRuntimeExports.jsx("div",{className:`flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${s?"cursor-not-allowed border-red-200 text-red-200":"cursor-pointer border-red-400 text-red-400"}`,children:e.jsxRuntimeExports.jsx(q.TrashIcon,{})})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(r.AlertDialogTitle,{children:["Are you sure you want to delete ",e.jsxRuntimeExports.jsx("i",{className:"text-red-500",children:i.name})," page?"]}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"This action cannot be undone. This will permanently delete your page."}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:u.isPending,children:"Cancel"}),e.jsxRuntimeExports.jsx(r.Button,{variant:"destructive",onClick:o,disabled:u.isPending,children:"Yes, Delete"})]})]})]})};exports.default=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("./index-cH1CfTbV.cjs"),l=require("./index-849lneVZ.cjs"),q=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");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("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("react-i18next");require("./index-8Fxmy4tt.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("sonner");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");const d=({pageData:i,projectData:t})=>{const n={},u=l.useDeletePage(),s=i.uuid===t.homepage,o=()=>{u.mutate(i,{onSuccess:()=>{n({uuid:t.homepage,slug:"/home"})}})};return e.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[e.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{disabled:s,children:e.jsxRuntimeExports.jsx("div",{className:`flex h-full items-center justify-center rounded-md border px-2 py-2 font-medium hover:bg-red-400 hover:text-white ${s?"cursor-not-allowed border-red-200 text-red-200":"cursor-pointer border-red-400 text-red-400"}`,children:e.jsxRuntimeExports.jsx(q.TrashIcon,{})})}),e.jsxRuntimeExports.jsxs(r.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(r.AlertDialogTitle,{children:["Are you sure you want to delete ",e.jsxRuntimeExports.jsx("i",{className:"text-red-500",children:i.name})," page?"]}),e.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"This action cannot be undone. This will permanently delete your page."}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-3",children:[e.jsxRuntimeExports.jsx(r.AlertDialogCancel,{disabled:u.isPending,children:"Cancel"}),e.jsxRuntimeExports.jsx(r.Button,{variant:"destructive",onClick:o,disabled:u.isPending,children:"Yes, Delete"})]})]})]})};exports.default=d;
package/dist/email.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),q=require("./index-Phf9F3An.cjs"),r=require("@radix-ui/react-icons"),o=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("i18next");require("react-i18next");require("./index-0FIxW0gR.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");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("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");const n=[{title:"Mobile",content:"Mobile email client",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{}),width:400},{title:"Email Client",content:"Content as seen inside an email client",breakpoint:"sm",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{className:"rotate-90"}),width:700}],s=i=>{const u={...i,filterChaiBlock:t=>o.includes(t.type,"Email/"),importHTMLSupport:!1,dataBindingSupport:!1,breakpoints:n};return e.jsxRuntimeExports.jsx(q.ChaiBuilderEditor,{...u})};exports.ChaiBuilderEmail=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),q=require("./index-8Fxmy4tt.cjs"),r=require("@radix-ui/react-icons"),o=require("lodash-es");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("react");require("i18next");require("react-i18next");require("./index-cH1CfTbV.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");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("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");const n=[{title:"Mobile",content:"Mobile email client",breakpoint:"xs",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{}),width:400},{title:"Email Client",content:"Content as seen inside an email client",breakpoint:"sm",icon:e.jsxRuntimeExports.jsx(r.MobileIcon,{className:"rotate-90"}),width:700}],s=i=>{const u={...i,filterChaiBlock:t=>o.includes(t.type,"Email/"),importHTMLSupport:!1,dataBindingSupport:!1,breakpoints:n};return e.jsxRuntimeExports.jsx(q.ChaiBuilderEditor,{...u})};exports.ChaiBuilderEmail=s;
package/dist/email.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { j as i } from "./jsx-runtime-WbnYoNE9.js";
2
- import { C as p } from "./index--t_K8Sw6.js";
2
+ import { C as p } from "./index-ZZTdYO7r.js";
3
3
  import { MobileIcon as t } from "@radix-ui/react-icons";
4
4
  import { includes as e } from "lodash-es";
5
5
  import "./_commonjsHelpers-UyOWmZb0.js";
6
6
  import "react";
7
7
  import "i18next";
8
8
  import "react-i18next";
9
- import "./index-uLn8W3eR.js";
9
+ import "./index-TzLilp-0.js";
10
10
  import "@radix-ui/react-toggle";
11
11
  import "class-variance-authority";
12
12
  import "./utils-VpVqnC9m.js";
@@ -1 +1 @@
1
- "use strict";const f=require("./jsx-runtime-Z_BpKhVy.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash-es"),d=require("./index-0FIxW0gR.cjs"),h=(c,n="")=>{switch(c.type){case"singular":return c.uiSchema;case"model":const{properties:p}=c,u={};return Object.keys(p).forEach(r=>{const e=p[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;u[o]=h(e,n)}),u;case"list":const{itemProperties:m}=c,l={items:{}};return Object.keys(m).forEach(r=>{const e=m[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;l.items[o]=h(e,n)}),l;default:return{}}},x=(c,n="")=>{switch(c.type){case"singular":return c.schema;case"model":const{properties:p,title:u}=c,m={title:u,type:"object",properties:{}};return Object.keys(p).forEach(o=>{const t=p[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;m.properties[s]=x(t,n)}),m;case"list":const{itemProperties:l,title:r}=c,e={title:r,type:"array",items:{type:"object",properties:{}}};return Object.keys(l).forEach(o=>{const t=l[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;e.items.properties[s]=x(t,n),i.set(e.items,"title",i.get(t,"itemTitle",`${r} item`))}),e;default:return{}}},$=({title:c,properties:n={},formData:p,onChange:u,disabled:m=!1,activeLang:l=""})=>{const r={type:"object",properties:{}},e={};Object.keys(n).forEach(t=>{const s=n[t];if(i.includes(["slot","styles"],s.type))return;const a=i.get(s,"i18n",!1)?`${t}-${l}`:t;r.properties[a]=x(s,l),e[a]=h(s,l)});const o=({...t},s)=>{const a=s==null?void 0:s.replace("root.","").split("/").pop();if(!s||!a)return;const j=i.first(a.split("."));s&&j&&u({...t},j)};return f.jsxRuntimeExports.jsxs(f.jsxRuntimeExports.Fragment,{children:[c&&f.jsxRuntimeExports.jsx("h1",{className:"px-1 text-sm font-semibold underline",children:c}),f.jsxRuntimeExports.jsx("div",{className:"-mx-3",children:f.jsxRuntimeExports.jsx(y,{widgets:{richtext:d.RichTextEditorField,icon:d.IconPickerField,image:d.ImagePickerField},fields:{link:d.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:e,schema:r,formData:p,validator:E,onChange:o,disabled:m})})]})};exports.Form=$;
1
+ "use strict";const f=require("./jsx-runtime-Z_BpKhVy.cjs"),y=require("@rjsf/core"),E=require("@rjsf/validator-ajv8"),i=require("lodash-es"),d=require("./index-cH1CfTbV.cjs"),h=(c,n="")=>{switch(c.type){case"singular":return c.uiSchema;case"model":const{properties:p}=c,u={};return Object.keys(p).forEach(r=>{const e=p[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;u[o]=h(e,n)}),u;case"list":const{itemProperties:m}=c,l={items:{}};return Object.keys(m).forEach(r=>{const e=m[r];if(i.includes(["slot","styles"],e.type))return;const o=i.get(e,"i18n",!1)?`${r}-${n}`:r;l.items[o]=h(e,n)}),l;default:return{}}},x=(c,n="")=>{switch(c.type){case"singular":return c.schema;case"model":const{properties:p,title:u}=c,m={title:u,type:"object",properties:{}};return Object.keys(p).forEach(o=>{const t=p[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;m.properties[s]=x(t,n)}),m;case"list":const{itemProperties:l,title:r}=c,e={title:r,type:"array",items:{type:"object",properties:{}}};return Object.keys(l).forEach(o=>{const t=l[o];if(i.includes(["slot","styles"],t.type))return;const s=i.get(t,"i18n",!1)?`${o}-${n}`:o;e.items.properties[s]=x(t,n),i.set(e.items,"title",i.get(t,"itemTitle",`${r} item`))}),e;default:return{}}},$=({title:c,properties:n={},formData:p,onChange:u,disabled:m=!1,activeLang:l=""})=>{const r={type:"object",properties:{}},e={};Object.keys(n).forEach(t=>{const s=n[t];if(i.includes(["slot","styles"],s.type))return;const a=i.get(s,"i18n",!1)?`${t}-${l}`:t;r.properties[a]=x(s,l),e[a]=h(s,l)});const o=({...t},s)=>{const a=s==null?void 0:s.replace("root.","").split("/").pop();if(!s||!a)return;const j=i.first(a.split("."));s&&j&&u({...t},j)};return f.jsxRuntimeExports.jsxs(f.jsxRuntimeExports.Fragment,{children:[c&&f.jsxRuntimeExports.jsx("h1",{className:"px-1 text-sm font-semibold underline",children:c}),f.jsxRuntimeExports.jsx("div",{className:"-mx-3",children:f.jsxRuntimeExports.jsx(y,{widgets:{richtext:d.RichTextEditorField,icon:d.IconPickerField,image:d.ImagePickerField},fields:{link:d.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:e,schema:r,formData:p,validator:E,onChange:o,disabled:m})})]})};exports.Form=$;
@@ -2,7 +2,7 @@ import { j as u } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import b from "@rjsf/core";
3
3
  import x from "@rjsf/validator-ajv8";
4
4
  import { includes as h, get as a, set as $, first as F } from "lodash-es";
5
- import { bk as P, bl as E, bm as O, bn as S } from "./index-uLn8W3eR.js";
5
+ import { bj as P, bk as E, bl as O, bm as S } from "./index-TzLilp-0.js";
6
6
  const d = (i, l = "") => {
7
7
  switch (i.type) {
8
8
  case "singular":
@@ -18,9 +18,9 @@ var c2 = (h, t, a, c) => ({
18
18
  import { j as r } from "./jsx-runtime-WbnYoNE9.js";
19
19
  import * as b from "react";
20
20
  import H0, { lazy as A2, useCallback as g2, useState as o2, Suspense as u0, useEffect as s0 } from "react";
21
- import { C as p0 } from "./index--t_K8Sw6.js";
21
+ import { C as p0 } from "./index-ZZTdYO7r.js";
22
22
  import { FileTextIcon as V0, GearIcon as f0, EyeClosedIcon as m0, EyeOpenIcon as L0 } from "@radix-ui/react-icons";
23
- import { u as x0, B as Y2, A as w0, a as B0, b as C0, c as O0, d as A0, e as S0, f as y0, g as b0, h as P0 } from "./index-uLn8W3eR.js";
23
+ import { u as x0, B as Y2, A as w0, a as B0, b as C0, c as O0, d as A0, e as S0, f as y0, g as b0, h as P0 } from "./index-TzLilp-0.js";
24
24
  import { toast as a1, Toaster as F0 } from "sonner";
25
25
  import { useTranslation as k0 } from "react-i18next";
26
26
  import { sortBy as R0, filter as D0, has as T0, set as E0, capitalize as N0, get as b2, omit as I0, size as P2 } from "lodash-es";
@@ -2044,7 +2044,7 @@ const D4 = () => {
2044
2044
  ] })
2045
2045
  ] })
2046
2046
  ] });
2047
- }, W4 = () => /* @__PURE__ */ r.jsx(I4, { children: /* @__PURE__ */ r.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ r.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-A3du_vDn.js")), j4 = A2(() => import("./ProjectPanel-92EtwSrh.js")), Q4 = A2(() => import("./CurrentPage-cOvRmEIZ.js")), K4 = () => /* @__PURE__ */ r.jsx("h2", { children: "Your Logo" }), G4 = () => {
2047
+ }, W4 = () => /* @__PURE__ */ r.jsx(I4, { children: /* @__PURE__ */ r.jsx("button", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ r.jsx(Q0, { className: "w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300" }) }) }), U4 = A2(() => import("./PagesPanel-XUtE4Aou.js")), j4 = A2(() => import("./ProjectPanel-3zkDX3az.js")), Q4 = A2(() => import("./CurrentPage-XXy2OzNq.js")), K4 = () => /* @__PURE__ */ r.jsx("h2", { children: "Your Logo" }), G4 = () => {
2048
2048
  const { mutate: h } = y4();
2049
2049
  return P0("editable", !0) ? /* @__PURE__ */ r.jsx(Y2, { onClick: h, className: "bg-blue-600 text-white", children: "Publish" }) : null;
2050
2050
  }, q4 = (h) => {
@@ -1 +1 @@
1
- "use strict";var H2=(h,t,c)=>{if(!t.has(h))throw TypeError("Cannot "+c)};var n=(h,t,c)=>(H2(h,t,"read from private field"),c?c.call(h):t.get(h)),e=(h,t,c)=>{if(t.has(h))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(h):t.set(h,c)},v=(h,t,c,a)=>(H2(h,t,"write to private field"),a?a.call(h,c):t.set(h,c),c);var i2=(h,t,c,a)=>({set _(l){v(h,t,l,c)},get _(){return n(h,t,a)}}),M=(h,t,c)=>(H2(h,t,"access private method"),c);const d=require("./jsx-runtime-Z_BpKhVy.cjs"),T=require("react"),s0=require("./index-Phf9F3An.cjs"),r2=require("@radix-ui/react-icons"),q=require("./index-0FIxW0gR.cjs"),h1=require("sonner"),p0=require("react-i18next"),c1=require("lodash-es"),V0=require("./html-to-json-ndxaXRT8.cjs"),S2=require("lucide-react"),t0=require("./index--mLLy7QQ.cjs");function f0(h){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const c in h)if(c!=="default"){const a=Object.getOwnPropertyDescriptor(h,c);Object.defineProperty(t,c,a.get?a:{enumerable:!0,get:()=>h[c]})}}return t.default=h,Object.freeze(t)}const A=f0(T);var W1=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(h){return this.listeners.add(h),this.onSubscribe(),()=>{this.listeners.delete(h),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N1=typeof window>"u"||"Deno"in window;function _(){}function m0(h,t){return typeof h=="function"?h(t):h}function s2(h){return typeof h=="number"&&h>=0&&h!==1/0}function h0(h,t){return Math.max(h+(t||0)-Date.now(),0)}function R2(h,t){const{type:c="all",exact:a,fetchStatus:l,predicate:i,queryKey:r,stale:z}=h;if(r){if(a){if(t.queryHash!==A2(r,t.options))return!1}else if(!Q1(t.queryKey,r))return!1}if(c!=="all"){const s=t.isActive();if(c==="active"&&!s||c==="inactive"&&s)return!1}return!(typeof z=="boolean"&&t.isStale()!==z||typeof l<"u"&&l!==t.state.fetchStatus||i&&!i(t))}function F2(h,t){const{exact:c,status:a,predicate:l,mutationKey:i}=h;if(i){if(!t.options.mutationKey)return!1;if(c){if(U1(t.options.mutationKey)!==U1(i))return!1}else if(!Q1(t.options.mutationKey,i))return!1}return!(a&&t.state.status!==a||l&&!l(t))}function A2(h,t){return((t==null?void 0:t.queryKeyHashFn)||U1)(h)}function U1(h){return JSON.stringify(h,(t,c)=>p2(c)?Object.keys(c).sort().reduce((a,l)=>(a[l]=c[l],a),{}):c)}function Q1(h,t){return h===t?!0:typeof h!=typeof t?!1:h&&t&&typeof h=="object"&&typeof t=="object"?!Object.keys(t).some(c=>!Q1(h[c],t[c])):!1}function c0(h,t){if(h===t)return h;const c=k2(h)&&k2(t);if(c||p2(h)&&p2(t)){const a=c?h.length:Object.keys(h).length,l=c?t:Object.keys(t),i=l.length,r=c?[]:{};let z=0;for(let s=0;s<i;s++){const p=c?s:l[s];r[p]=c0(h[p],t[p]),r[p]===h[p]&&z++}return a===i&&z===a?h:r}return t}function e2(h,t){if(h&&!t||t&&!h)return!1;for(const c in h)if(h[c]!==t[c])return!1;return!0}function k2(h){return Array.isArray(h)&&h.length===Object.keys(h).length}function p2(h){if(!D2(h))return!1;const t=h.constructor;if(typeof t>"u")return!0;const c=t.prototype;return!(!D2(c)||!c.hasOwnProperty("isPrototypeOf"))}function D2(h){return Object.prototype.toString.call(h)==="[object Object]"}function a0(h){return new Promise(t=>{setTimeout(t,h)})}function E2(h){a0(0).then(h)}function V2(h,t,c){return typeof c.structuralSharing=="function"?c.structuralSharing(h,t):c.structuralSharing!==!1?c0(h,t):t}function x0(h,t,c=0){const a=[...h,t];return c&&a.length>c?a.slice(1):a}function L0(h,t,c=0){const a=[t,...h];return c&&a.length>c?a.slice(0,-1):a}var u1,v1,B1,U2,w0=(U2=class extends W1{constructor(){super();e(this,u1,void 0);e(this,v1,void 0);e(this,B1,void 0);v(this,B1,t=>{if(!N1&&window.addEventListener){const c=()=>t();return window.addEventListener("visibilitychange",c,!1),()=>{window.removeEventListener("visibilitychange",c)}}})}onSubscribe(){n(this,v1)||this.setEventListener(n(this,B1))}onUnsubscribe(){var t;this.hasListeners()||((t=n(this,v1))==null||t.call(this),v(this,v1,void 0))}setEventListener(t){var c;v(this,B1,t),(c=n(this,v1))==null||c.call(this),v(this,v1,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){n(this,u1)!==t&&(v(this,u1,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof n(this,u1)=="boolean"?n(this,u1):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},u1=new WeakMap,v1=new WeakMap,B1=new WeakMap,U2),o2=new w0,I1,d1,G1,Q2,B0=(Q2=class extends W1{constructor(){super();e(this,I1,!0);e(this,d1,void 0);e(this,G1,void 0);v(this,G1,t=>{if(!N1&&window.addEventListener){const c=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",c,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",c),window.removeEventListener("offline",a)}}})}onSubscribe(){n(this,d1)||this.setEventListener(n(this,G1))}onUnsubscribe(){var t;this.hasListeners()||((t=n(this,d1))==null||t.call(this),v(this,d1,void 0))}setEventListener(t){var c;v(this,G1,t),(c=n(this,d1))==null||c.call(this),v(this,d1,t(this.setOnline.bind(this)))}setOnline(t){n(this,I1)!==t&&(v(this,I1,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return n(this,I1)}},I1=new WeakMap,d1=new WeakMap,G1=new WeakMap,Q2),z2=new B0;function I0(h){return Math.min(1e3*2**h,3e4)}function M2(h){return(h??"online")==="online"?z2.isOnline():!0}var n0=class{constructor(h){this.revert=h==null?void 0:h.revert,this.silent=h==null?void 0:h.silent}};function u2(h){return h instanceof n0}function l0(h){let t=!1,c=0,a=!1,l,i,r;const z=new Promise((g,u)=>{i=g,r=u}),s=g=>{var u;a||(H(new n0(g)),(u=h.abort)==null||u.call(h))},p=()=>{t=!0},o=()=>{t=!1},L=()=>!o2.isFocused()||h.networkMode!=="always"&&!z2.isOnline(),b=g=>{var u;a||(a=!0,(u=h.onSuccess)==null||u.call(h,g),l==null||l(),i(g))},H=g=>{var u;a||(a=!0,(u=h.onError)==null||u.call(h,g),l==null||l(),r(g))},V=()=>new Promise(g=>{var u;l=G=>{const f=a||!L();return f&&g(G),f},(u=h.onPause)==null||u.call(h)}).then(()=>{var g;l=void 0,a||(g=h.onContinue)==null||g.call(h)}),B=()=>{if(a)return;let g;try{g=h.fn()}catch(u){g=Promise.reject(u)}Promise.resolve(g).then(b).catch(u=>{var F;if(a)return;const G=h.retry??(N1?0:3),f=h.retryDelay??I0,m=typeof f=="function"?f(c,u):f,y=G===!0||typeof G=="number"&&c<G||typeof G=="function"&&G(c,u);if(t||!y){H(u);return}c++,(F=h.onFail)==null||F.call(h,c,u),a0(m).then(()=>{if(L())return V()}).then(()=>{t?H(u):B()})})};return M2(h.networkMode)?B():V().then(B),{promise:z,cancel:s,continue:()=>(l==null?void 0:l())?z:Promise.resolve(),cancelRetry:p,continueRetry:o}}function G0(){let h=[],t=0,c=o=>{o()},a=o=>{o()};const l=o=>{let L;t++;try{L=o()}finally{t--,t||z()}return L},i=o=>{t?h.push(o):E2(()=>{c(o)})},r=o=>(...L)=>{i(()=>{o(...L)})},z=()=>{const o=h;h=[],o.length&&E2(()=>{a(()=>{o.forEach(L=>{c(L)})})})};return{batch:l,batchCalls:r,schedule:i,setNotifyFunction:o=>{c=o},setBatchNotifyFunction:o=>{a=o}}}var O=G0(),s1,K2,i0=(K2=class{constructor(){e(this,s1,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),s2(this.gcTime)&&v(this,s1,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(h){this.gcTime=Math.max(this.gcTime||0,h??(N1?1/0:5*60*1e3))}clearGcTimeout(){n(this,s1)&&(clearTimeout(n(this,s1)),v(this,s1,void 0))}},s1=new WeakMap,K2),C1,O1,j,r1,U,S,K1,p1,S1,v2,$,n1,q2,C0=(q2=class extends i0{constructor(t){super();e(this,S1);e(this,$);e(this,C1,void 0);e(this,O1,void 0);e(this,j,void 0);e(this,r1,void 0);e(this,U,void 0);e(this,S,void 0);e(this,K1,void 0);e(this,p1,void 0);v(this,p1,!1),v(this,K1,t.defaultOptions),M(this,S1,v2).call(this,t.options),v(this,S,[]),v(this,j,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,v(this,C1,t.state||O0(this.options)),this.state=n(this,C1),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!n(this,S).length&&this.state.fetchStatus==="idle"&&n(this,j).remove(this)}setData(t,c){const a=V2(this.state.data,t,this.options);return M(this,$,n1).call(this,{data:a,type:"success",dataUpdatedAt:c==null?void 0:c.updatedAt,manual:c==null?void 0:c.manual}),a}setState(t,c){M(this,$,n1).call(this,{type:"setState",state:t,setStateOptions:c})}cancel(t){var a;const c=n(this,r1);return(a=n(this,U))==null||a.cancel(t),c?c.then(_).catch(_):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(n(this,C1))}isActive(){return n(this,S).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||n(this,S).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!h0(this.state.dataUpdatedAt,t)}onFocus(){var c;const t=n(this,S).find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(c=n(this,U))==null||c.continue()}onOnline(){var c;const t=n(this,S).find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(c=n(this,U))==null||c.continue()}addObserver(t){n(this,S).includes(t)||(n(this,S).push(t),this.clearGcTimeout(),n(this,j).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){n(this,S).includes(t)&&(v(this,S,n(this,S).filter(c=>c!==t)),n(this,S).length||(n(this,U)&&(n(this,p1)?n(this,U).cancel({revert:!0}):n(this,U).cancelRetry()),this.scheduleGc()),n(this,j).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return n(this,S).length}invalidate(){this.state.isInvalidated||M(this,$,n1).call(this,{type:"invalidate"})}fetch(t,c){var p,o,L,b;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(c!=null&&c.cancelRefetch))this.cancel({silent:!0});else if(n(this,r1))return(p=n(this,U))==null||p.continueRetry(),n(this,r1)}if(t&&M(this,S1,v2).call(this,t),!this.options.queryFn){const H=n(this,S).find(V=>V.options.queryFn);H&&M(this,S1,v2).call(this,H.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const a=new AbortController,l={queryKey:this.queryKey,meta:this.meta},i=H=>{Object.defineProperty(H,"signal",{enumerable:!0,get:()=>(v(this,p1,!0),a.signal)})};i(l);const r=()=>this.options.queryFn?(v(this,p1,!1),this.options.persister?this.options.persister(this.options.queryFn,l,this):this.options.queryFn(l)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),z={fetchOptions:c,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:r};i(z),(o=this.options.behavior)==null||o.onFetch(z,this),v(this,O1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((L=z.fetchOptions)==null?void 0:L.meta))&&M(this,$,n1).call(this,{type:"fetch",meta:(b=z.fetchOptions)==null?void 0:b.meta});const s=H=>{var V,B,g,u;u2(H)&&H.silent||M(this,$,n1).call(this,{type:"error",error:H}),u2(H)||((B=(V=n(this,j).config).onError)==null||B.call(V,H,this),(u=(g=n(this,j).config).onSettled)==null||u.call(g,this.state.data,H,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return v(this,U,l0({fn:z.fetchFn,abort:a.abort.bind(a),onSuccess:H=>{var V,B,g,u;if(typeof H>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),s(new Error(`${this.queryHash} data is undefined`));return}this.setData(H),(B=(V=n(this,j).config).onSuccess)==null||B.call(V,H,this),(u=(g=n(this,j).config).onSettled)==null||u.call(g,H,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:s,onFail:(H,V)=>{M(this,$,n1).call(this,{type:"failed",failureCount:H,error:V})},onPause:()=>{M(this,$,n1).call(this,{type:"pause"})},onContinue:()=>{M(this,$,n1).call(this,{type:"continue"})},retry:z.options.retry,retryDelay:z.options.retryDelay,networkMode:z.options.networkMode})),v(this,r1,n(this,U).promise),n(this,r1)}},C1=new WeakMap,O1=new WeakMap,j=new WeakMap,r1=new WeakMap,U=new WeakMap,S=new WeakMap,K1=new WeakMap,p1=new WeakMap,S1=new WeakSet,v2=function(t){this.options={...n(this,K1),...t},this.updateGcTime(this.options.gcTime)},$=new WeakSet,n1=function(t){const c=a=>{switch(t.type){case"failed":return{...a,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:M2(this.options.networkMode)?"fetching":"paused",...!a.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...a,data:t.data,dataUpdateCount:a.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const l=t.error;return u2(l)&&l.revert&&n(this,O1)?{...n(this,O1),fetchStatus:"idle"}:{...a,error:l,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error"};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...t.state}}};this.state=c(this.state),O.batch(()=>{n(this,S).forEach(a=>{a.onQueryUpdate()}),n(this,j).notify({query:this,type:"updated",action:t})})},q2);function O0(h){const t=typeof h.initialData=="function"?h.initialData():h.initialData,c=typeof t<"u",a=c?typeof h.initialDataUpdatedAt=="function"?h.initialDataUpdatedAt():h.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:c?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:c?"success":"pending",fetchStatus:"idle"}}var Z,_2,S0=(_2=class extends W1{constructor(t={}){super();e(this,Z,void 0);this.config=t,v(this,Z,new Map)}build(t,c,a){const l=c.queryKey,i=c.queryHash??A2(l,c);let r=this.get(i);return r||(r=new C0({cache:this,queryKey:l,queryHash:i,options:t.defaultQueryOptions(c),state:a,defaultOptions:t.getQueryDefaults(l)}),this.add(r)),r}add(t){n(this,Z).has(t.queryHash)||(n(this,Z).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const c=n(this,Z).get(t.queryHash);c&&(t.destroy(),c===t&&n(this,Z).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){O.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return n(this,Z).get(t)}getAll(){return[...n(this,Z).values()]}find(t){const c={exact:!0,...t};return this.getAll().find(a=>R2(c,a))}findAll(t={}){const c=this.getAll();return Object.keys(t).length>0?c.filter(a=>R2(t,a)):c}notify(t){O.batch(()=>{this.listeners.forEach(c=>{c(t)})})}onFocus(){O.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Z=new WeakMap,_2),Y,q1,E,A1,X,i1,$2,A0=($2=class extends i0{constructor(t){super();e(this,X);e(this,Y,void 0);e(this,q1,void 0);e(this,E,void 0);e(this,A1,void 0);this.mutationId=t.mutationId,v(this,q1,t.defaultOptions),v(this,E,t.mutationCache),v(this,Y,[]),this.state=t.state||v0(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...n(this,q1),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){n(this,Y).includes(t)||(n(this,Y).push(t),this.clearGcTimeout(),n(this,E).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){v(this,Y,n(this,Y).filter(c=>c!==t)),this.scheduleGc(),n(this,E).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){n(this,Y).length||(this.state.status==="pending"?this.scheduleGc():n(this,E).remove(this))}continue(){var t;return((t=n(this,A1))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,i,r,z,s,p,o,L,b,H,V,B,g,u,G,f,m,y,F,I;const c=()=>(v(this,A1,l0({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(w,a1)=>{M(this,X,i1).call(this,{type:"failed",failureCount:w,error:a1})},onPause:()=>{M(this,X,i1).call(this,{type:"pause"})},onContinue:()=>{M(this,X,i1).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),n(this,A1).promise),a=this.state.status==="pending";try{if(!a){M(this,X,i1).call(this,{type:"pending",variables:t}),await((i=(l=n(this,E).config).onMutate)==null?void 0:i.call(l,t,this));const a1=await((z=(r=this.options).onMutate)==null?void 0:z.call(r,t));a1!==this.state.context&&M(this,X,i1).call(this,{type:"pending",context:a1,variables:t})}const w=await c();return await((p=(s=n(this,E).config).onSuccess)==null?void 0:p.call(s,w,t,this.state.context,this)),await((L=(o=this.options).onSuccess)==null?void 0:L.call(o,w,t,this.state.context)),await((H=(b=n(this,E).config).onSettled)==null?void 0:H.call(b,w,null,this.state.variables,this.state.context,this)),await((B=(V=this.options).onSettled)==null?void 0:B.call(V,w,null,t,this.state.context)),M(this,X,i1).call(this,{type:"success",data:w}),w}catch(w){try{throw await((u=(g=n(this,E).config).onError)==null?void 0:u.call(g,w,t,this.state.context,this)),await((f=(G=this.options).onError)==null?void 0:f.call(G,w,t,this.state.context)),await((y=(m=n(this,E).config).onSettled)==null?void 0:y.call(m,void 0,w,this.state.variables,this.state.context,this)),await((I=(F=this.options).onSettled)==null?void 0:I.call(F,void 0,w,t,this.state.context)),w}finally{M(this,X,i1).call(this,{type:"error",error:w})}}}},Y=new WeakMap,q1=new WeakMap,E=new WeakMap,A1=new WeakMap,X=new WeakSet,i1=function(t){const c=a=>{switch(t.type){case"failed":return{...a,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!M2(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...a,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=c(this.state),O.batch(()=>{n(this,Y).forEach(a=>{a.onMutationUpdate(t)}),n(this,E).notify({mutation:this,type:"updated",action:t})})},$2);function v0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Q,_1,V1,J2,y0=(J2=class extends W1{constructor(t={}){super();e(this,Q,void 0);e(this,_1,void 0);e(this,V1,void 0);this.config=t,v(this,Q,[]),v(this,_1,0)}build(t,c,a){const l=new A0({mutationCache:this,mutationId:++i2(this,_1)._,options:t.defaultMutationOptions(c),state:a});return this.add(l),l}add(t){n(this,Q).push(t),this.notify({type:"added",mutation:t})}remove(t){v(this,Q,n(this,Q).filter(c=>c!==t)),this.notify({type:"removed",mutation:t})}clear(){O.batch(()=>{n(this,Q).forEach(t=>{this.remove(t)})})}getAll(){return n(this,Q)}find(t){const c={exact:!0,...t};return n(this,Q).find(a=>F2(c,a))}findAll(t={}){return n(this,Q).filter(c=>F2(t,c))}notify(t){O.batch(()=>{this.listeners.forEach(c=>{c(t)})})}resumePausedMutations(){return v(this,V1,(n(this,V1)??Promise.resolve()).then(()=>{const t=n(this,Q).filter(c=>c.state.isPaused);return O.batch(()=>t.reduce((c,a)=>c.then(()=>a.continue().catch(_)),Promise.resolve()))}).then(()=>{v(this,V1,void 0)})),n(this,V1)}},Q=new WeakMap,_1=new WeakMap,V1=new WeakMap,J2);function b0(h){return{onFetch:(t,c)=>{const a=async()=>{var V,B,g,u,G;const l=t.options,i=(g=(B=(V=t.fetchOptions)==null?void 0:V.meta)==null?void 0:B.fetchMore)==null?void 0:g.direction,r=((u=t.state.data)==null?void 0:u.pages)||[],z=((G=t.state.data)==null?void 0:G.pageParams)||[],s={pages:[],pageParams:[]};let p=!1;const o=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)})},L=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),b=async(f,m,y)=>{if(p)return Promise.reject();if(m==null&&f.pages.length)return Promise.resolve(f);const F={queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};o(F);const I=await L(F),{maxPages:w}=t.options,a1=y?L0:x0;return{pages:a1(f.pages,I,w),pageParams:a1(f.pageParams,m,w)}};let H;if(i&&r.length){const f=i==="backward",m=f?P0:T2,y={pages:r,pageParams:z},F=m(l,y);H=await b(y,F,f)}else{H=await b(s,z[0]??l.initialPageParam);const f=h??r.length;for(let m=1;m<f;m++){const y=T2(l,H);H=await b(H,y)}}return H};t.options.persister?t.fetchFn=()=>{var l,i;return(i=(l=t.options).persister)==null?void 0:i.call(l,a,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},c)}:t.fetchFn=a}}}function T2(h,{pages:t,pageParams:c}){const a=t.length-1;return h.getNextPageParam(t[a],t,c[a],c)}function P0(h,{pages:t,pageParams:c}){var a;return(a=h.getPreviousPageParam)==null?void 0:a.call(h,t[0],t,c[0],c)}var C,e1,o1,y1,b1,z1,P1,R1,Z2,R0=(Z2=class{constructor(h={}){e(this,C,void 0);e(this,e1,void 0);e(this,o1,void 0);e(this,y1,void 0);e(this,b1,void 0);e(this,z1,void 0);e(this,P1,void 0);e(this,R1,void 0);v(this,C,h.queryCache||new S0),v(this,e1,h.mutationCache||new y0),v(this,o1,h.defaultOptions||{}),v(this,y1,new Map),v(this,b1,new Map),v(this,z1,0)}mount(){i2(this,z1)._++,n(this,z1)===1&&(v(this,P1,o2.subscribe(()=>{o2.isFocused()&&(this.resumePausedMutations(),n(this,C).onFocus())})),v(this,R1,z2.subscribe(()=>{z2.isOnline()&&(this.resumePausedMutations(),n(this,C).onOnline())})))}unmount(){var h,t;i2(this,z1)._--,n(this,z1)===0&&((h=n(this,P1))==null||h.call(this),v(this,P1,void 0),(t=n(this,R1))==null||t.call(this),v(this,R1,void 0))}isFetching(h){return n(this,C).findAll({...h,fetchStatus:"fetching"}).length}isMutating(h){return n(this,e1).findAll({...h,status:"pending"}).length}getQueryData(h){var t;return(t=n(this,C).find({queryKey:h}))==null?void 0:t.state.data}ensureQueryData(h){const t=this.getQueryData(h.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(h)}getQueriesData(h){return this.getQueryCache().findAll(h).map(({queryKey:t,state:c})=>{const a=c.data;return[t,a]})}setQueryData(h,t,c){const a=n(this,C).find({queryKey:h}),l=a==null?void 0:a.state.data,i=m0(t,l);if(typeof i>"u")return;const r=this.defaultQueryOptions({queryKey:h});return n(this,C).build(this,r).setData(i,{...c,manual:!0})}setQueriesData(h,t,c){return O.batch(()=>this.getQueryCache().findAll(h).map(({queryKey:a})=>[a,this.setQueryData(a,t,c)]))}getQueryState(h){var t;return(t=n(this,C).find({queryKey:h}))==null?void 0:t.state}removeQueries(h){const t=n(this,C);O.batch(()=>{t.findAll(h).forEach(c=>{t.remove(c)})})}resetQueries(h,t){const c=n(this,C),a={type:"active",...h};return O.batch(()=>(c.findAll(h).forEach(l=>{l.reset()}),this.refetchQueries(a,t)))}cancelQueries(h={},t={}){const c={revert:!0,...t},a=O.batch(()=>n(this,C).findAll(h).map(l=>l.cancel(c)));return Promise.all(a).then(_).catch(_)}invalidateQueries(h={},t={}){return O.batch(()=>{if(n(this,C).findAll(h).forEach(a=>{a.invalidate()}),h.refetchType==="none")return Promise.resolve();const c={...h,type:h.refetchType??h.type??"active"};return this.refetchQueries(c,t)})}refetchQueries(h={},t){const c={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},a=O.batch(()=>n(this,C).findAll(h).filter(l=>!l.isDisabled()).map(l=>{let i=l.fetch(void 0,c);return c.throwOnError||(i=i.catch(_)),l.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(a).then(_)}fetchQuery(h){const t=this.defaultQueryOptions(h);typeof t.retry>"u"&&(t.retry=!1);const c=n(this,C).build(this,t);return c.isStaleByTime(t.staleTime)?c.fetch(t):Promise.resolve(c.state.data)}prefetchQuery(h){return this.fetchQuery(h).then(_).catch(_)}fetchInfiniteQuery(h){return h.behavior=b0(h.pages),this.fetchQuery(h)}prefetchInfiniteQuery(h){return this.fetchInfiniteQuery(h).then(_).catch(_)}resumePausedMutations(){return n(this,e1).resumePausedMutations()}getQueryCache(){return n(this,C)}getMutationCache(){return n(this,e1)}getDefaultOptions(){return n(this,o1)}setDefaultOptions(h){v(this,o1,h)}setQueryDefaults(h,t){n(this,y1).set(U1(h),{queryKey:h,defaultOptions:t})}getQueryDefaults(h){const t=[...n(this,y1).values()];let c={};return t.forEach(a=>{Q1(h,a.queryKey)&&(c={...c,...a.defaultOptions})}),c}setMutationDefaults(h,t){n(this,b1).set(U1(h),{mutationKey:h,defaultOptions:t})}getMutationDefaults(h){const t=[...n(this,b1).values()];let c={};return t.forEach(a=>{Q1(h,a.mutationKey)&&(c={...c,...a.defaultOptions})}),c}defaultQueryOptions(h){if(h!=null&&h._defaulted)return h;const t={...n(this,o1).queries,...(h==null?void 0:h.queryKey)&&this.getQueryDefaults(h.queryKey),...h,_defaulted:!0};return t.queryHash||(t.queryHash=A2(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(h){return h!=null&&h._defaulted?h:{...n(this,o1).mutations,...(h==null?void 0:h.mutationKey)&&this.getMutationDefaults(h.mutationKey),...h,_defaulted:!0}}clear(){n(this,C).clear(),n(this,e1).clear()}},C=new WeakMap,e1=new WeakMap,o1=new WeakMap,y1=new WeakMap,b1=new WeakMap,z1=new WeakMap,P1=new WeakMap,R1=new WeakMap,Z2),D,x,F1,P,f1,k1,t1,$1,D1,E1,m1,x1,g1,L1,w1,j1,J1,f2,Z1,m2,Y1,x2,X1,L2,t2,w2,h2,B2,c2,I2,g2,d0,Y2,F0=(Y2=class extends W1{constructor(t,c){super();e(this,w1);e(this,J1);e(this,Z1);e(this,Y1);e(this,X1);e(this,t2);e(this,h2);e(this,c2);e(this,g2);e(this,D,void 0);e(this,x,void 0);e(this,F1,void 0);e(this,P,void 0);e(this,f1,void 0);e(this,k1,void 0);e(this,t1,void 0);e(this,$1,void 0);e(this,D1,void 0);e(this,E1,void 0);e(this,m1,void 0);e(this,x1,void 0);e(this,g1,void 0);e(this,L1,void 0);v(this,x,void 0),v(this,F1,void 0),v(this,P,void 0),v(this,L1,new Set),v(this,D,t),this.options=c,v(this,t1,null),this.bindMethods(),this.setOptions(c)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(n(this,x).addObserver(this),N2(n(this,x),this.options)?M(this,w1,j1).call(this):this.updateResult(),M(this,X1,L2).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G2(n(this,x),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G2(n(this,x),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,M(this,t2,w2).call(this),M(this,h2,B2).call(this),n(this,x).removeObserver(this)}setOptions(t,c){const a=this.options,l=n(this,x);if(this.options=n(this,D).defaultQueryOptions(t),e2(a,this.options)||n(this,D).getQueryCache().notify({type:"observerOptionsUpdated",query:n(this,x),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=a.queryKey),M(this,c2,I2).call(this);const i=this.hasListeners();i&&W2(n(this,x),l,this.options,a)&&M(this,w1,j1).call(this),this.updateResult(c),i&&(n(this,x)!==l||this.options.enabled!==a.enabled||this.options.staleTime!==a.staleTime)&&M(this,J1,f2).call(this);const r=M(this,Z1,m2).call(this);i&&(n(this,x)!==l||this.options.enabled!==a.enabled||r!==n(this,g1))&&M(this,Y1,x2).call(this,r)}getOptimisticResult(t){const c=n(this,D).getQueryCache().build(n(this,D),t),a=this.createResult(c,t);return D0(this,a)&&(v(this,P,a),v(this,k1,this.options),v(this,f1,n(this,x).state)),a}getCurrentResult(){return n(this,P)}trackResult(t){const c={};return Object.keys(t).forEach(a=>{Object.defineProperty(c,a,{configurable:!1,enumerable:!0,get:()=>(n(this,L1).add(a),t[a])})}),c}getCurrentQuery(){return n(this,x)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const c=n(this,D).defaultQueryOptions(t),a=n(this,D).getQueryCache().build(n(this,D),c);return a.isFetchingOptimistic=!0,a.fetch().then(()=>this.createResult(a,c))}fetch(t){return M(this,w1,j1).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),n(this,P)))}createResult(t,c){var F;const a=n(this,x),l=this.options,i=n(this,P),r=n(this,f1),z=n(this,k1),p=t!==a?t.state:n(this,F1),{state:o}=t;let{error:L,errorUpdatedAt:b,fetchStatus:H,status:V}=o,B=!1,g;if(c._optimisticResults){const I=this.hasListeners(),w=!I&&N2(t,c),a1=I&&W2(t,a,c,l);(w||a1)&&(H=M2(t.options.networkMode)?"fetching":"paused",o.dataUpdatedAt||(V="pending")),c._optimisticResults==="isRestoring"&&(H="idle")}if(c.select&&typeof o.data<"u")if(i&&o.data===(r==null?void 0:r.data)&&c.select===n(this,$1))g=n(this,D1);else try{v(this,$1,c.select),g=c.select(o.data),g=V2(i==null?void 0:i.data,g,c),v(this,D1,g),v(this,t1,null)}catch(I){v(this,t1,I)}else g=o.data;if(typeof c.placeholderData<"u"&&typeof g>"u"&&V==="pending"){let I;if(i!=null&&i.isPlaceholderData&&c.placeholderData===(z==null?void 0:z.placeholderData))I=i.data;else if(I=typeof c.placeholderData=="function"?c.placeholderData((F=n(this,E1))==null?void 0:F.state.data,n(this,E1)):c.placeholderData,c.select&&typeof I<"u")try{I=c.select(I),v(this,t1,null)}catch(w){v(this,t1,w)}typeof I<"u"&&(V="success",g=V2(i==null?void 0:i.data,I,c),B=!0)}n(this,t1)&&(L=n(this,t1),g=n(this,D1),b=Date.now(),V="error");const u=H==="fetching",G=V==="pending",f=V==="error",m=G&&u;return{status:V,fetchStatus:H,isPending:G,isSuccess:V==="success",isError:f,isInitialLoading:m,isLoading:m,data:g,dataUpdatedAt:o.dataUpdatedAt,error:L,errorUpdatedAt:b,failureCount:o.fetchFailureCount,failureReason:o.fetchFailureReason,errorUpdateCount:o.errorUpdateCount,isFetched:o.dataUpdateCount>0||o.errorUpdateCount>0,isFetchedAfterMount:o.dataUpdateCount>p.dataUpdateCount||o.errorUpdateCount>p.errorUpdateCount,isFetching:u,isRefetching:u&&!G,isLoadingError:f&&o.dataUpdatedAt===0,isPaused:H==="paused",isPlaceholderData:B,isRefetchError:f&&o.dataUpdatedAt!==0,isStale:y2(t,c),refetch:this.refetch}}updateResult(t){const c=n(this,P),a=this.createResult(n(this,x),this.options);if(v(this,f1,n(this,x).state),v(this,k1,this.options),n(this,f1).data!==void 0&&v(this,E1,n(this,x)),e2(a,c))return;v(this,P,a);const l={},i=()=>{if(!c)return!0;const{notifyOnChangeProps:r}=this.options,z=typeof r=="function"?r():r;if(z==="all"||!z&&!n(this,L1).size)return!0;const s=new Set(z??n(this,L1));return this.options.throwOnError&&s.add("error"),Object.keys(n(this,P)).some(p=>{const o=p;return n(this,P)[o]!==c[o]&&s.has(o)})};(t==null?void 0:t.listeners)!==!1&&i()&&(l.listeners=!0),M(this,g2,d0).call(this,{...l,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&M(this,X1,L2).call(this)}},D=new WeakMap,x=new WeakMap,F1=new WeakMap,P=new WeakMap,f1=new WeakMap,k1=new WeakMap,t1=new WeakMap,$1=new WeakMap,D1=new WeakMap,E1=new WeakMap,m1=new WeakMap,x1=new WeakMap,g1=new WeakMap,L1=new WeakMap,w1=new WeakSet,j1=function(t){M(this,c2,I2).call(this);let c=n(this,x).fetch(this.options,t);return t!=null&&t.throwOnError||(c=c.catch(_)),c},J1=new WeakSet,f2=function(){if(M(this,t2,w2).call(this),N1||n(this,P).isStale||!s2(this.options.staleTime))return;const c=h0(n(this,P).dataUpdatedAt,this.options.staleTime)+1;v(this,m1,setTimeout(()=>{n(this,P).isStale||this.updateResult()},c))},Z1=new WeakSet,m2=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(n(this,x)):this.options.refetchInterval)??!1},Y1=new WeakSet,x2=function(t){M(this,h2,B2).call(this),v(this,g1,t),!(N1||this.options.enabled===!1||!s2(n(this,g1))||n(this,g1)===0)&&v(this,x1,setInterval(()=>{(this.options.refetchIntervalInBackground||o2.isFocused())&&M(this,w1,j1).call(this)},n(this,g1)))},X1=new WeakSet,L2=function(){M(this,J1,f2).call(this),M(this,Y1,x2).call(this,M(this,Z1,m2).call(this))},t2=new WeakSet,w2=function(){n(this,m1)&&(clearTimeout(n(this,m1)),v(this,m1,void 0))},h2=new WeakSet,B2=function(){n(this,x1)&&(clearInterval(n(this,x1)),v(this,x1,void 0))},c2=new WeakSet,I2=function(){const t=n(this,D).getQueryCache().build(n(this,D),this.options);if(t===n(this,x))return;const c=n(this,x);v(this,x,t),v(this,F1,t.state),this.hasListeners()&&(c==null||c.removeObserver(this),t.addObserver(this))},g2=new WeakSet,d0=function(t){O.batch(()=>{t.listeners&&this.listeners.forEach(c=>{c(n(this,P))}),n(this,D).getQueryCache().notify({query:n(this,x),type:"observerResultsUpdated"})})},Y2);function k0(h,t){return t.enabled!==!1&&!h.state.dataUpdatedAt&&!(h.state.status==="error"&&t.retryOnMount===!1)}function N2(h,t){return k0(h,t)||h.state.dataUpdatedAt>0&&G2(h,t,t.refetchOnMount)}function G2(h,t,c){if(t.enabled!==!1){const a=typeof c=="function"?c(h):c;return a==="always"||a!==!1&&y2(h,t)}return!1}function W2(h,t,c,a){return c.enabled!==!1&&(h!==t||a.enabled===!1)&&(!c.suspense||h.state.status!=="error")&&y2(h,c)}function y2(h,t){return h.isStaleByTime(t.staleTime)}function D0(h,t){return!e2(h.getCurrentResult(),t)}var M1,k,K,l1,T1,d2,a2,C2,X2,E0=(X2=class extends W1{constructor(t,c){super();e(this,T1);e(this,a2);e(this,M1,void 0);e(this,k,void 0);e(this,K,void 0);e(this,l1,void 0);v(this,k,void 0),v(this,M1,t),this.setOptions(c),this.bindMethods(),M(this,T1,d2).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var a;const c=this.options;this.options=n(this,M1).defaultMutationOptions(t),e2(c,this.options)||n(this,M1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:n(this,K),observer:this}),(a=n(this,K))==null||a.setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=n(this,K))==null||t.removeObserver(this)}onMutationUpdate(t){M(this,T1,d2).call(this),M(this,a2,C2).call(this,t)}getCurrentResult(){return n(this,k)}reset(){v(this,K,void 0),M(this,T1,d2).call(this),M(this,a2,C2).call(this)}mutate(t,c){var a;return v(this,l1,c),(a=n(this,K))==null||a.removeObserver(this),v(this,K,n(this,M1).getMutationCache().build(n(this,M1),this.options)),n(this,K).addObserver(this),n(this,K).execute(t)}},M1=new WeakMap,k=new WeakMap,K=new WeakMap,l1=new WeakMap,T1=new WeakSet,d2=function(){var c;const t=((c=n(this,K))==null?void 0:c.state)??v0();v(this,k,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},a2=new WeakSet,C2=function(t){O.batch(()=>{var c,a,l,i,r,z,s,p;n(this,l1)&&this.hasListeners()&&((t==null?void 0:t.type)==="success"?((a=(c=n(this,l1)).onSuccess)==null||a.call(c,t.data,n(this,k).variables,n(this,k).context),(i=(l=n(this,l1)).onSettled)==null||i.call(l,t.data,null,n(this,k).variables,n(this,k).context)):(t==null?void 0:t.type)==="error"&&((z=(r=n(this,l1)).onError)==null||z.call(r,t.error,n(this,k).variables,n(this,k).context),(p=(s=n(this,l1)).onSettled)==null||p.call(s,void 0,t.error,n(this,k).variables,n(this,k).context))),this.listeners.forEach(o=>{o(n(this,k))})})},X2);var r0=A.createContext(void 0),N=h=>{const t=A.useContext(r0);if(h)return h;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},T0=({client:h,children:t})=>(A.useEffect(()=>(h.mount(),()=>{h.unmount()}),[h]),A.createElement(r0.Provider,{value:h},t)),e0=A.createContext(!1),N0=()=>A.useContext(e0),C4=e0.Provider;function W0(){let h=!1;return{clearReset:()=>{h=!1},reset:()=>{h=!0},isReset:()=>h}}var j0=A.createContext(W0()),U0=()=>A.useContext(j0);function o0(h,t){return typeof h=="function"?h(...t):!!h}var Q0=(h,t)=>{(h.suspense||h.throwOnError)&&(t.isReset()||(h.retryOnMount=!1))},K0=h=>{A.useEffect(()=>{h.clearReset()},[h])},q0=({result:h,errorResetBoundary:t,throwOnError:c,query:a})=>h.isError&&!t.isReset()&&!h.isFetching&&o0(c,[h.error,a]);var _0=h=>{h.suspense&&typeof h.staleTime!="number"&&(h.staleTime=1e3)};var $0=(h,t)=>(h==null?void 0:h.suspense)&&t.isPending,J0=(h,t,c)=>t.fetchOptimistic(h).catch(()=>{c.clearReset()});function Z0(h,t,c){if(process.env.NODE_ENV!=="production"&&(typeof h!="object"||Array.isArray(h)))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 a=N(c),l=N0(),i=U0(),r=a.defaultQueryOptions(h);r._optimisticResults=l?"isRestoring":"optimistic",_0(r),Q0(r,i),K0(i);const[z]=A.useState(()=>new t(a,r)),s=z.getOptimisticResult(r);if(A.useSyncExternalStore(A.useCallback(p=>{const o=l?()=>{}:z.subscribe(O.batchCalls(p));return z.updateResult(),o},[z,l]),()=>z.getCurrentResult(),()=>z.getCurrentResult()),A.useEffect(()=>{z.setOptions(r,{listeners:!1})},[r,z]),$0(r,s))throw J0(r,z,i);if(q0({result:s,errorResetBoundary:i,throwOnError:r.throwOnError,query:z.getCurrentQuery()}))throw s.error;return r.notifyOnChangeProps?s:z.trackResult(s)}function n2(h,t){return Z0(h,F0,t)}function J(h,t){const c=N(t),[a]=A.useState(()=>new E0(c,h));A.useEffect(()=>{a.setOptions(h)},[a,h]);const l=A.useSyncExternalStore(A.useCallback(r=>a.subscribe(O.batchCalls(r)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),i=A.useCallback((r,z)=>{a.mutate(r,z).catch(Y0)},[a]);if(l.error&&o0(a.options.throwOnError,[l.error]))throw l.error;return{...l,mutate:i,mutateAsync:l.mutate}}function Y0(){}function R(){return N().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const H1=()=>{const{data:h,refetch:t}=n2({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[h,c=>{c&&(localStorage.setItem("currentPage",c||""),t())}]};let j2="";const l2=()=>(j2=localStorage.getItem("__chai_at"),j2);function X0(h){const t={method:"GET",headers:{"x-chai-access-token":l2()}};return fetch(h,t)}function t4(h,t){const c={method:"POST",headers:{"x-chai-access-token":l2()},body:JSON.stringify(t)};return fetch(h,c)}function h4(h,t){const c={method:"PUT",headers:{"x-chai-access-token":l2()},body:JSON.stringify(t)};return fetch(h,c)}function c4(h,t){const c={method:"DELETE",headers:{"x-chai-access-token":l2()},body:JSON.stringify(t)};return fetch(h,c)}const W={get:X0,post:t4,put:h4,delete:c4},b2=()=>{const[h,t]=H1(),c=R();return n2({queryKey:["project"],queryFn:async()=>{const{data:a}=await W.get(`${c}/project`).then(l=>l.json());if(!h&&a){const l=localStorage.getItem("currentPage");t(l||(a==null?void 0:a.homepage))}return a}})},P2=()=>{const h=R();return n2({queryKey:["pages"],queryFn:async()=>{const{data:t}=await W.get(`${h}/pages`).then(c=>c.json());return t||[]}})},z0=()=>{const[h]=H1(),t=R();return n2({queryKey:["page_data",h],queryFn:async()=>{const{data:c}=await W.get(`${t}/page?uuid=${h}`).then(a=>a.json());return c},enabled:!!h,staleTime:3e3})},O2=()=>d.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:d.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[d.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[d.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),d.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),d.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),d.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),d.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),g0=(h="Project updated successfully.")=>{const t=N(),c=R();return J({mutationFn:async a=>await W.put(`${c}/project`,a).then(l=>l.json()),onSuccess:()=>{t.invalidateQueries({queryKey:["project"]}),h1.toast.success(h)}})},M0=()=>{const[h]=["SAVED"],[t,c]=H1(),a=q.useBuilderReset(),{t:l}=p0.useTranslation();return i=>h!=="SAVED"?(h1.toast.error(l("You have unsaved changes. Please save before changing the page.")),!1):t===i.uuid?!1:(a(),setTimeout(()=>c(i.uuid),100),!0)},a4=()=>{const h=N(),t=M0(),c=R();return J({mutationFn:async a=>W.post(`${c}/pages`,a).then(l=>l.json()),onSuccess:a=>{h.invalidateQueries({queryKey:["pages"]}),t({uuid:a.uuid,slug:a.slug}),h1.toast.success("Page added successfully.")}})},H0=()=>{const h=R(),[t]=H1(),c=N();return J({mutationFn:async a=>W.put(`${h}/page`,a).then(l=>l.json()),onSuccess:async a=>{var l;if(a.result==="error"&&((l=a.error)==null?void 0:l.code)=="PAGE_LOCKED"){c.invalidateQueries({queryKey:["page_data",t]});return}h1.toast.success("Page saved successfully.")}})},n4=()=>{const h=R(),{data:t}=P2(),[c]=H1(),{data:a}=b2(),l=N();return J({mutationFn:async()=>{const i=t.find(r=>r.uuid===c).slug;return await W.post(`${h}/publish`,{slug:i,uuid:c,isHomepage:(a==null?void 0:a.homepage)===c}).then(r=>r.json())},onSuccess:async i=>{var r;if(i.result==="error"&&((r=i.error)==null?void 0:r.code)=="PAGE_LOCKED"){l.invalidateQueries({queryKey:["page_data",c]});return}h1.toast.success("Page published successfully.",{position:"bottom-right",duration:2e3})}})},l4=()=>{const h=N(),t=R();return J({mutationFn:async c=>W.delete(`${t}/page`,c).then(a=>a.json()),onSuccess:()=>{h1.toast.success("Page deleted successfully."),h.invalidateQueries({queryKey:["pages"]})}})},i4=()=>{const h=N(),t=R();return J({mutationFn:async c=>W.post(`${t}/take-control`,{uuid:c}).then(a=>a.json()),onSuccess:(c,a)=>{h.invalidateQueries({queryKey:["page_data",a]})}})},v4=()=>{const h=R();return J({mutationFn:async()=>{const{data:t}=await W.get(`${h}/library`).then(c=>c.json());return c1.sortBy(c1.filter(t,c=>!c1.has(c,"hidden")),"group")}})},d4=()=>{const h=R();return J({mutationFn:async t=>{if(!t||!t.uuid)return[];try{const{data:c}=await W.get(`${h}/block?uuid=${t.uuid}&format=${t.format}`).then(async a=>t.format==="html"?V0.getBlocksFromHTML(await a.text()):await a.json());return c1.set(c,"0._name",c1.capitalize(t.group)),c||[]}catch{return[]}}})},r4=()=>{const h=R();return J({mutationFn:async t=>{const c=new FormData;c.append("file",t);const{data:a}=await fetch(`${h}/upload`,{method:"POST",headers:{"x-chai-access-token":l2()},body:c}).then(l=>l.json());return a}})};function u0(h){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{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 4-8 5-8-5V6l8 5 8-5v2z"},child:[]}]})(h)}function e4(h){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{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"},child:[]}]})(h)}const o4=()=>{const{mutate:h,isPending:t}=i4(),[c]=H1(),{data:a}=z0(),l=c1.get(a,"lockedBy.name",""),i=c1.get(a,"lockedBy.email","");return d.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:[d.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",d.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),d.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",d.jsxRuntimeExports.jsx("br",{}),d.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[d.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[d.jsxRuntimeExports.jsx(e4,{className:"w-4 h-4 text-gray-500"})," ",l]}),d.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[d.jsxRuntimeExports.jsx(u0,{className:"w-4 h-4 text-gray-500"})," ",i]})]}),d.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",l," will be ",d.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),d.jsxRuntimeExports.jsx(q.Button,{disabled:t,onClick:()=>h(c),className:`w-36 ${t?"bg-transparent shadow-none hover:bg-transparent":""}`,children:t?d.jsxRuntimeExports.jsx(S2.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},z4=()=>{const h=R(),t=N();return J({mutationFn:async c=>{const a=await fetch(`${h}/login`,{method:"POST",body:JSON.stringify(c)});if(a.ok)return await a.json();throw a.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:c=>{const{data:a}=c;if(!a.accessToken){h1.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",a.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(c1.omit(a,["accessToken"]))),t.invalidateQueries({queryKey:["verify"]}),h1.toast.success("Logged in successfully.")},onError:()=>{h1.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},g4=()=>{const h=R();return n2({queryKey:["verify"],queryFn:async()=>{const t=await W.get(`${h}/verify`);return t.ok?(await t.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},M4=()=>{const h=R(),t=N();return J({mutationFn:async()=>{const{result:c}=await W.post(`${h}/logout`).then(a=>a.json());if(c==="success")return localStorage.clear(),t.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},H4=({children:h})=>{const t=M4();return d.jsxRuntimeExports.jsxs(q.AlertDialog,{children:[d.jsxRuntimeExports.jsx(q.AlertDialogTrigger,{asChild:!0,children:h}),d.jsxRuntimeExports.jsxs(q.AlertDialogContent,{children:[d.jsxRuntimeExports.jsxs(q.AlertDialogHeader,{children:[d.jsxRuntimeExports.jsxs(q.AlertDialogTitle,{children:["Are you sure, you want to ",d.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),d.jsxRuntimeExports.jsx(q.AlertDialogDescription,{children:"Kindly ensure that all your data is saved before proceeding with the sign-out process to prevent any potential loss of unsaved information"})]}),d.jsxRuntimeExports.jsxs(q.AlertDialogFooter,{children:[d.jsxRuntimeExports.jsx(q.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),d.jsxRuntimeExports.jsxs("button",{disabled:t.isPending,onClick:()=>t.mutate(),className:"rounded-md text-white w-28 text-center justify-center bg-red-600 hover:bg-red-700 flex items-center gap-x-2",children:[t.isPending&&d.jsxRuntimeExports.jsx(S2.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},u4=()=>d.jsxRuntimeExports.jsx(H4,{children:d.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:d.jsxRuntimeExports.jsx(S2.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),s4=T.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-bfNUqq2a.cjs"))),p4=T.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-QMaTK2Jx.cjs"))),V4=T.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-pwDwQsWa.cjs"))),f4=()=>d.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),m4=()=>{const{mutate:h}=n4();return q.useBuilderProp("editable",!0)?d.jsxRuntimeExports.jsx(q.Button,{onClick:h,className:"bg-blue-600 text-white",children:"Publish"}):null},x4=h=>{var f;const{data:t,isLoading:c}=b2(),{data:a,isLoading:l}=P2(),{data:i}=z0(),{mutate:r}=g0(),{mutate:z}=H0(),[s]=H1(),p=r4(),o=v4(),L=d4(),b=R(),H=T.useCallback(async m=>await p.mutateAsync(m),[p]),V=T.useCallback(async()=>await o.mutateAsync(),[o]),B=T.useCallback(async m=>await L.mutateAsync(m),[L]),g=async(m=20,y=0)=>{const F=`limit=${m}&offset=${y}`,I=await fetch(`${b}/assets?${F}`).then(w=>w.json());return I.result==="success"?I.data:[]},{logo:u=f4}=h;if(c||!t)return d.jsxRuntimeExports.jsx(O2,{});if(l||!a)return d.jsxRuntimeExports.jsx(O2,{});const G={...h,editable:i!=null&&i.lockedBy?i==null?void 0:i.lockedBy.self:!0,nonEditableComponent:o4,blocks:(i==null?void 0:i.blocks)||[],brandingOptions:t.brandingOptions,darkMode:h.darkMode||!1,dataProviders:(i==null?void 0:i.providers)||[],onSavePage:async({blocks:m,providers:y})=>(await z({blocks:m,providers:y,uuid:s}),!0),onSaveBrandingOptions:async m=>(await r({brandingOptions:m}),!0),topBarComponents:{left:[u],center:[V4],right:[m4]},sideBarComponents:{top:[{icon:r2.FileTextIcon,name:"pages",panel:s4},{icon:r2.GearIcon,name:"settings",panel:p4},...((f=h.sideBarComponents)==null?void 0:f.top)||[]],bottom:[u4]},uploadMediaCallback:H,fetchMediaCallback:g,getUILibraryBlocks:V,getExternalPredefinedBlock:B,getPages:()=>a};return d.jsxRuntimeExports.jsx(s0.ChaiBuilderEditor,{...G})},L4=({logo:h})=>{const[t,c]=T.useState(!1),[a,l]=T.useState(""),[i,r]=T.useState(""),{mutate:z,isPending:s}=z4(),p=o=>{o.preventDefault(),z({email:a,password:i})};return d.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:d.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:d.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[d.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[d.jsxRuntimeExports.jsx(T.Suspense,{children:h?T.createElement(h):""}),d.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"})]}),d.jsxRuntimeExports.jsx("div",{className:"mt-8",children:d.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:p,className:"space-y-5",children:[d.jsxRuntimeExports.jsx("div",{children:d.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[d.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:d.jsxRuntimeExports.jsx(u0,{})}),d.jsxRuntimeExports.jsx("input",{value:a,onChange:o=>l(o.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"})]})}),d.jsxRuntimeExports.jsx("div",{children:d.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[d.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:d.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:d.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"})})}),d.jsxRuntimeExports.jsx("input",{value:i,onChange:o=>r(o.target.value),type:t?"text":"password",id:"pwd",placeholder:"Enter password",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"}),d.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>c(!t),children:t?d.jsxRuntimeExports.jsx(r2.EyeClosedIcon,{}):d.jsxRuntimeExports.jsx(r2.EyeOpenIcon,{})})]})}),d.jsxRuntimeExports.jsx("div",{children:d.jsxRuntimeExports.jsx("button",{disabled:s||c1.size(a)<2||c1.size(i)<2,type:"submit",className:"inline-flex disabled:bg-gray-400 items-center justify-center w-full px-4 py-4 text-base font-semibold text-white transition-all duration-200 bg-blue-600 border border-transparent rounded-md focus:outline-none hover:bg-blue-700 focus:bg-blue-700",children:s?"Signing in...":"Login"})})]})}),d.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:d.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},w4=h=>{const{data:t,isLoading:c}=g4(),a=N();return T.useEffect(()=>{a.setQueryData(["apiBaseUrl"],h.apiBaseUrl||"/api/chaibuilder")},[h.apiBaseUrl,a]),c?d.jsxRuntimeExports.jsx(O2,{}):t!=null&&t.valid?d.jsxRuntimeExports.jsx(x4,{...h}):d.jsxRuntimeExports.jsx(L4,{logo:h.logo})},B4=new R0,I4=h=>d.jsxRuntimeExports.jsxs(T0,{client:B4,children:[d.jsxRuntimeExports.jsx(h1.Toaster,{richColors:!0}),d.jsxRuntimeExports.jsx(w4,{...h})]});exports.ChaiBuilderStudio=I4;exports.useAddPage=a4;exports.useChangePage=M0;exports.useCurrentPage=H1;exports.useDeletePage=l4;exports.usePages=P2;exports.useProject=b2;exports.useQueryClient=N;exports.useUpdatePage=H0;exports.useUpdateProject=g0;
1
+ "use strict";var H2=(h,t,c)=>{if(!t.has(h))throw TypeError("Cannot "+c)};var n=(h,t,c)=>(H2(h,t,"read from private field"),c?c.call(h):t.get(h)),e=(h,t,c)=>{if(t.has(h))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(h):t.set(h,c)},v=(h,t,c,a)=>(H2(h,t,"write to private field"),a?a.call(h,c):t.set(h,c),c);var i2=(h,t,c,a)=>({set _(l){v(h,t,l,c)},get _(){return n(h,t,a)}}),M=(h,t,c)=>(H2(h,t,"access private method"),c);const d=require("./jsx-runtime-Z_BpKhVy.cjs"),T=require("react"),s0=require("./index-8Fxmy4tt.cjs"),r2=require("@radix-ui/react-icons"),q=require("./index-cH1CfTbV.cjs"),h1=require("sonner"),p0=require("react-i18next"),c1=require("lodash-es"),V0=require("./html-to-json-ndxaXRT8.cjs"),S2=require("lucide-react"),t0=require("./index--mLLy7QQ.cjs");function f0(h){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const c in h)if(c!=="default"){const a=Object.getOwnPropertyDescriptor(h,c);Object.defineProperty(t,c,a.get?a:{enumerable:!0,get:()=>h[c]})}}return t.default=h,Object.freeze(t)}const A=f0(T);var W1=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(h){return this.listeners.add(h),this.onSubscribe(),()=>{this.listeners.delete(h),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},N1=typeof window>"u"||"Deno"in window;function _(){}function m0(h,t){return typeof h=="function"?h(t):h}function s2(h){return typeof h=="number"&&h>=0&&h!==1/0}function h0(h,t){return Math.max(h+(t||0)-Date.now(),0)}function R2(h,t){const{type:c="all",exact:a,fetchStatus:l,predicate:i,queryKey:r,stale:z}=h;if(r){if(a){if(t.queryHash!==A2(r,t.options))return!1}else if(!Q1(t.queryKey,r))return!1}if(c!=="all"){const s=t.isActive();if(c==="active"&&!s||c==="inactive"&&s)return!1}return!(typeof z=="boolean"&&t.isStale()!==z||typeof l<"u"&&l!==t.state.fetchStatus||i&&!i(t))}function F2(h,t){const{exact:c,status:a,predicate:l,mutationKey:i}=h;if(i){if(!t.options.mutationKey)return!1;if(c){if(U1(t.options.mutationKey)!==U1(i))return!1}else if(!Q1(t.options.mutationKey,i))return!1}return!(a&&t.state.status!==a||l&&!l(t))}function A2(h,t){return((t==null?void 0:t.queryKeyHashFn)||U1)(h)}function U1(h){return JSON.stringify(h,(t,c)=>p2(c)?Object.keys(c).sort().reduce((a,l)=>(a[l]=c[l],a),{}):c)}function Q1(h,t){return h===t?!0:typeof h!=typeof t?!1:h&&t&&typeof h=="object"&&typeof t=="object"?!Object.keys(t).some(c=>!Q1(h[c],t[c])):!1}function c0(h,t){if(h===t)return h;const c=k2(h)&&k2(t);if(c||p2(h)&&p2(t)){const a=c?h.length:Object.keys(h).length,l=c?t:Object.keys(t),i=l.length,r=c?[]:{};let z=0;for(let s=0;s<i;s++){const p=c?s:l[s];r[p]=c0(h[p],t[p]),r[p]===h[p]&&z++}return a===i&&z===a?h:r}return t}function e2(h,t){if(h&&!t||t&&!h)return!1;for(const c in h)if(h[c]!==t[c])return!1;return!0}function k2(h){return Array.isArray(h)&&h.length===Object.keys(h).length}function p2(h){if(!D2(h))return!1;const t=h.constructor;if(typeof t>"u")return!0;const c=t.prototype;return!(!D2(c)||!c.hasOwnProperty("isPrototypeOf"))}function D2(h){return Object.prototype.toString.call(h)==="[object Object]"}function a0(h){return new Promise(t=>{setTimeout(t,h)})}function E2(h){a0(0).then(h)}function V2(h,t,c){return typeof c.structuralSharing=="function"?c.structuralSharing(h,t):c.structuralSharing!==!1?c0(h,t):t}function x0(h,t,c=0){const a=[...h,t];return c&&a.length>c?a.slice(1):a}function L0(h,t,c=0){const a=[t,...h];return c&&a.length>c?a.slice(0,-1):a}var u1,v1,B1,U2,w0=(U2=class extends W1{constructor(){super();e(this,u1,void 0);e(this,v1,void 0);e(this,B1,void 0);v(this,B1,t=>{if(!N1&&window.addEventListener){const c=()=>t();return window.addEventListener("visibilitychange",c,!1),()=>{window.removeEventListener("visibilitychange",c)}}})}onSubscribe(){n(this,v1)||this.setEventListener(n(this,B1))}onUnsubscribe(){var t;this.hasListeners()||((t=n(this,v1))==null||t.call(this),v(this,v1,void 0))}setEventListener(t){var c;v(this,B1,t),(c=n(this,v1))==null||c.call(this),v(this,v1,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){n(this,u1)!==t&&(v(this,u1,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof n(this,u1)=="boolean"?n(this,u1):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},u1=new WeakMap,v1=new WeakMap,B1=new WeakMap,U2),o2=new w0,I1,d1,G1,Q2,B0=(Q2=class extends W1{constructor(){super();e(this,I1,!0);e(this,d1,void 0);e(this,G1,void 0);v(this,G1,t=>{if(!N1&&window.addEventListener){const c=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",c,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",c),window.removeEventListener("offline",a)}}})}onSubscribe(){n(this,d1)||this.setEventListener(n(this,G1))}onUnsubscribe(){var t;this.hasListeners()||((t=n(this,d1))==null||t.call(this),v(this,d1,void 0))}setEventListener(t){var c;v(this,G1,t),(c=n(this,d1))==null||c.call(this),v(this,d1,t(this.setOnline.bind(this)))}setOnline(t){n(this,I1)!==t&&(v(this,I1,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return n(this,I1)}},I1=new WeakMap,d1=new WeakMap,G1=new WeakMap,Q2),z2=new B0;function I0(h){return Math.min(1e3*2**h,3e4)}function M2(h){return(h??"online")==="online"?z2.isOnline():!0}var n0=class{constructor(h){this.revert=h==null?void 0:h.revert,this.silent=h==null?void 0:h.silent}};function u2(h){return h instanceof n0}function l0(h){let t=!1,c=0,a=!1,l,i,r;const z=new Promise((g,u)=>{i=g,r=u}),s=g=>{var u;a||(H(new n0(g)),(u=h.abort)==null||u.call(h))},p=()=>{t=!0},o=()=>{t=!1},L=()=>!o2.isFocused()||h.networkMode!=="always"&&!z2.isOnline(),b=g=>{var u;a||(a=!0,(u=h.onSuccess)==null||u.call(h,g),l==null||l(),i(g))},H=g=>{var u;a||(a=!0,(u=h.onError)==null||u.call(h,g),l==null||l(),r(g))},V=()=>new Promise(g=>{var u;l=G=>{const f=a||!L();return f&&g(G),f},(u=h.onPause)==null||u.call(h)}).then(()=>{var g;l=void 0,a||(g=h.onContinue)==null||g.call(h)}),B=()=>{if(a)return;let g;try{g=h.fn()}catch(u){g=Promise.reject(u)}Promise.resolve(g).then(b).catch(u=>{var F;if(a)return;const G=h.retry??(N1?0:3),f=h.retryDelay??I0,m=typeof f=="function"?f(c,u):f,y=G===!0||typeof G=="number"&&c<G||typeof G=="function"&&G(c,u);if(t||!y){H(u);return}c++,(F=h.onFail)==null||F.call(h,c,u),a0(m).then(()=>{if(L())return V()}).then(()=>{t?H(u):B()})})};return M2(h.networkMode)?B():V().then(B),{promise:z,cancel:s,continue:()=>(l==null?void 0:l())?z:Promise.resolve(),cancelRetry:p,continueRetry:o}}function G0(){let h=[],t=0,c=o=>{o()},a=o=>{o()};const l=o=>{let L;t++;try{L=o()}finally{t--,t||z()}return L},i=o=>{t?h.push(o):E2(()=>{c(o)})},r=o=>(...L)=>{i(()=>{o(...L)})},z=()=>{const o=h;h=[],o.length&&E2(()=>{a(()=>{o.forEach(L=>{c(L)})})})};return{batch:l,batchCalls:r,schedule:i,setNotifyFunction:o=>{c=o},setBatchNotifyFunction:o=>{a=o}}}var O=G0(),s1,K2,i0=(K2=class{constructor(){e(this,s1,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),s2(this.gcTime)&&v(this,s1,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(h){this.gcTime=Math.max(this.gcTime||0,h??(N1?1/0:5*60*1e3))}clearGcTimeout(){n(this,s1)&&(clearTimeout(n(this,s1)),v(this,s1,void 0))}},s1=new WeakMap,K2),C1,O1,j,r1,U,S,K1,p1,S1,v2,$,n1,q2,C0=(q2=class extends i0{constructor(t){super();e(this,S1);e(this,$);e(this,C1,void 0);e(this,O1,void 0);e(this,j,void 0);e(this,r1,void 0);e(this,U,void 0);e(this,S,void 0);e(this,K1,void 0);e(this,p1,void 0);v(this,p1,!1),v(this,K1,t.defaultOptions),M(this,S1,v2).call(this,t.options),v(this,S,[]),v(this,j,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,v(this,C1,t.state||O0(this.options)),this.state=n(this,C1),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!n(this,S).length&&this.state.fetchStatus==="idle"&&n(this,j).remove(this)}setData(t,c){const a=V2(this.state.data,t,this.options);return M(this,$,n1).call(this,{data:a,type:"success",dataUpdatedAt:c==null?void 0:c.updatedAt,manual:c==null?void 0:c.manual}),a}setState(t,c){M(this,$,n1).call(this,{type:"setState",state:t,setStateOptions:c})}cancel(t){var a;const c=n(this,r1);return(a=n(this,U))==null||a.cancel(t),c?c.then(_).catch(_):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(n(this,C1))}isActive(){return n(this,S).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||n(this,S).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!h0(this.state.dataUpdatedAt,t)}onFocus(){var c;const t=n(this,S).find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(c=n(this,U))==null||c.continue()}onOnline(){var c;const t=n(this,S).find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(c=n(this,U))==null||c.continue()}addObserver(t){n(this,S).includes(t)||(n(this,S).push(t),this.clearGcTimeout(),n(this,j).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){n(this,S).includes(t)&&(v(this,S,n(this,S).filter(c=>c!==t)),n(this,S).length||(n(this,U)&&(n(this,p1)?n(this,U).cancel({revert:!0}):n(this,U).cancelRetry()),this.scheduleGc()),n(this,j).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return n(this,S).length}invalidate(){this.state.isInvalidated||M(this,$,n1).call(this,{type:"invalidate"})}fetch(t,c){var p,o,L,b;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(c!=null&&c.cancelRefetch))this.cancel({silent:!0});else if(n(this,r1))return(p=n(this,U))==null||p.continueRetry(),n(this,r1)}if(t&&M(this,S1,v2).call(this,t),!this.options.queryFn){const H=n(this,S).find(V=>V.options.queryFn);H&&M(this,S1,v2).call(this,H.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const a=new AbortController,l={queryKey:this.queryKey,meta:this.meta},i=H=>{Object.defineProperty(H,"signal",{enumerable:!0,get:()=>(v(this,p1,!0),a.signal)})};i(l);const r=()=>this.options.queryFn?(v(this,p1,!1),this.options.persister?this.options.persister(this.options.queryFn,l,this):this.options.queryFn(l)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),z={fetchOptions:c,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:r};i(z),(o=this.options.behavior)==null||o.onFetch(z,this),v(this,O1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((L=z.fetchOptions)==null?void 0:L.meta))&&M(this,$,n1).call(this,{type:"fetch",meta:(b=z.fetchOptions)==null?void 0:b.meta});const s=H=>{var V,B,g,u;u2(H)&&H.silent||M(this,$,n1).call(this,{type:"error",error:H}),u2(H)||((B=(V=n(this,j).config).onError)==null||B.call(V,H,this),(u=(g=n(this,j).config).onSettled)==null||u.call(g,this.state.data,H,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return v(this,U,l0({fn:z.fetchFn,abort:a.abort.bind(a),onSuccess:H=>{var V,B,g,u;if(typeof H>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),s(new Error(`${this.queryHash} data is undefined`));return}this.setData(H),(B=(V=n(this,j).config).onSuccess)==null||B.call(V,H,this),(u=(g=n(this,j).config).onSettled)==null||u.call(g,H,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:s,onFail:(H,V)=>{M(this,$,n1).call(this,{type:"failed",failureCount:H,error:V})},onPause:()=>{M(this,$,n1).call(this,{type:"pause"})},onContinue:()=>{M(this,$,n1).call(this,{type:"continue"})},retry:z.options.retry,retryDelay:z.options.retryDelay,networkMode:z.options.networkMode})),v(this,r1,n(this,U).promise),n(this,r1)}},C1=new WeakMap,O1=new WeakMap,j=new WeakMap,r1=new WeakMap,U=new WeakMap,S=new WeakMap,K1=new WeakMap,p1=new WeakMap,S1=new WeakSet,v2=function(t){this.options={...n(this,K1),...t},this.updateGcTime(this.options.gcTime)},$=new WeakSet,n1=function(t){const c=a=>{switch(t.type){case"failed":return{...a,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:M2(this.options.networkMode)?"fetching":"paused",...!a.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...a,data:t.data,dataUpdateCount:a.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const l=t.error;return u2(l)&&l.revert&&n(this,O1)?{...n(this,O1),fetchStatus:"idle"}:{...a,error:l,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error"};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...t.state}}};this.state=c(this.state),O.batch(()=>{n(this,S).forEach(a=>{a.onQueryUpdate()}),n(this,j).notify({query:this,type:"updated",action:t})})},q2);function O0(h){const t=typeof h.initialData=="function"?h.initialData():h.initialData,c=typeof t<"u",a=c?typeof h.initialDataUpdatedAt=="function"?h.initialDataUpdatedAt():h.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:c?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:c?"success":"pending",fetchStatus:"idle"}}var Z,_2,S0=(_2=class extends W1{constructor(t={}){super();e(this,Z,void 0);this.config=t,v(this,Z,new Map)}build(t,c,a){const l=c.queryKey,i=c.queryHash??A2(l,c);let r=this.get(i);return r||(r=new C0({cache:this,queryKey:l,queryHash:i,options:t.defaultQueryOptions(c),state:a,defaultOptions:t.getQueryDefaults(l)}),this.add(r)),r}add(t){n(this,Z).has(t.queryHash)||(n(this,Z).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const c=n(this,Z).get(t.queryHash);c&&(t.destroy(),c===t&&n(this,Z).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){O.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return n(this,Z).get(t)}getAll(){return[...n(this,Z).values()]}find(t){const c={exact:!0,...t};return this.getAll().find(a=>R2(c,a))}findAll(t={}){const c=this.getAll();return Object.keys(t).length>0?c.filter(a=>R2(t,a)):c}notify(t){O.batch(()=>{this.listeners.forEach(c=>{c(t)})})}onFocus(){O.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){O.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Z=new WeakMap,_2),Y,q1,E,A1,X,i1,$2,A0=($2=class extends i0{constructor(t){super();e(this,X);e(this,Y,void 0);e(this,q1,void 0);e(this,E,void 0);e(this,A1,void 0);this.mutationId=t.mutationId,v(this,q1,t.defaultOptions),v(this,E,t.mutationCache),v(this,Y,[]),this.state=t.state||v0(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...n(this,q1),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){n(this,Y).includes(t)||(n(this,Y).push(t),this.clearGcTimeout(),n(this,E).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){v(this,Y,n(this,Y).filter(c=>c!==t)),this.scheduleGc(),n(this,E).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){n(this,Y).length||(this.state.status==="pending"?this.scheduleGc():n(this,E).remove(this))}continue(){var t;return((t=n(this,A1))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,i,r,z,s,p,o,L,b,H,V,B,g,u,G,f,m,y,F,I;const c=()=>(v(this,A1,l0({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(w,a1)=>{M(this,X,i1).call(this,{type:"failed",failureCount:w,error:a1})},onPause:()=>{M(this,X,i1).call(this,{type:"pause"})},onContinue:()=>{M(this,X,i1).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),n(this,A1).promise),a=this.state.status==="pending";try{if(!a){M(this,X,i1).call(this,{type:"pending",variables:t}),await((i=(l=n(this,E).config).onMutate)==null?void 0:i.call(l,t,this));const a1=await((z=(r=this.options).onMutate)==null?void 0:z.call(r,t));a1!==this.state.context&&M(this,X,i1).call(this,{type:"pending",context:a1,variables:t})}const w=await c();return await((p=(s=n(this,E).config).onSuccess)==null?void 0:p.call(s,w,t,this.state.context,this)),await((L=(o=this.options).onSuccess)==null?void 0:L.call(o,w,t,this.state.context)),await((H=(b=n(this,E).config).onSettled)==null?void 0:H.call(b,w,null,this.state.variables,this.state.context,this)),await((B=(V=this.options).onSettled)==null?void 0:B.call(V,w,null,t,this.state.context)),M(this,X,i1).call(this,{type:"success",data:w}),w}catch(w){try{throw await((u=(g=n(this,E).config).onError)==null?void 0:u.call(g,w,t,this.state.context,this)),await((f=(G=this.options).onError)==null?void 0:f.call(G,w,t,this.state.context)),await((y=(m=n(this,E).config).onSettled)==null?void 0:y.call(m,void 0,w,this.state.variables,this.state.context,this)),await((I=(F=this.options).onSettled)==null?void 0:I.call(F,void 0,w,t,this.state.context)),w}finally{M(this,X,i1).call(this,{type:"error",error:w})}}}},Y=new WeakMap,q1=new WeakMap,E=new WeakMap,A1=new WeakMap,X=new WeakSet,i1=function(t){const c=a=>{switch(t.type){case"failed":return{...a,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!M2(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...a,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=c(this.state),O.batch(()=>{n(this,Y).forEach(a=>{a.onMutationUpdate(t)}),n(this,E).notify({mutation:this,type:"updated",action:t})})},$2);function v0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Q,_1,V1,J2,y0=(J2=class extends W1{constructor(t={}){super();e(this,Q,void 0);e(this,_1,void 0);e(this,V1,void 0);this.config=t,v(this,Q,[]),v(this,_1,0)}build(t,c,a){const l=new A0({mutationCache:this,mutationId:++i2(this,_1)._,options:t.defaultMutationOptions(c),state:a});return this.add(l),l}add(t){n(this,Q).push(t),this.notify({type:"added",mutation:t})}remove(t){v(this,Q,n(this,Q).filter(c=>c!==t)),this.notify({type:"removed",mutation:t})}clear(){O.batch(()=>{n(this,Q).forEach(t=>{this.remove(t)})})}getAll(){return n(this,Q)}find(t){const c={exact:!0,...t};return n(this,Q).find(a=>F2(c,a))}findAll(t={}){return n(this,Q).filter(c=>F2(t,c))}notify(t){O.batch(()=>{this.listeners.forEach(c=>{c(t)})})}resumePausedMutations(){return v(this,V1,(n(this,V1)??Promise.resolve()).then(()=>{const t=n(this,Q).filter(c=>c.state.isPaused);return O.batch(()=>t.reduce((c,a)=>c.then(()=>a.continue().catch(_)),Promise.resolve()))}).then(()=>{v(this,V1,void 0)})),n(this,V1)}},Q=new WeakMap,_1=new WeakMap,V1=new WeakMap,J2);function b0(h){return{onFetch:(t,c)=>{const a=async()=>{var V,B,g,u,G;const l=t.options,i=(g=(B=(V=t.fetchOptions)==null?void 0:V.meta)==null?void 0:B.fetchMore)==null?void 0:g.direction,r=((u=t.state.data)==null?void 0:u.pages)||[],z=((G=t.state.data)==null?void 0:G.pageParams)||[],s={pages:[],pageParams:[]};let p=!1;const o=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(t.signal.aborted?p=!0:t.signal.addEventListener("abort",()=>{p=!0}),t.signal)})},L=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),b=async(f,m,y)=>{if(p)return Promise.reject();if(m==null&&f.pages.length)return Promise.resolve(f);const F={queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};o(F);const I=await L(F),{maxPages:w}=t.options,a1=y?L0:x0;return{pages:a1(f.pages,I,w),pageParams:a1(f.pageParams,m,w)}};let H;if(i&&r.length){const f=i==="backward",m=f?P0:T2,y={pages:r,pageParams:z},F=m(l,y);H=await b(y,F,f)}else{H=await b(s,z[0]??l.initialPageParam);const f=h??r.length;for(let m=1;m<f;m++){const y=T2(l,H);H=await b(H,y)}}return H};t.options.persister?t.fetchFn=()=>{var l,i;return(i=(l=t.options).persister)==null?void 0:i.call(l,a,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},c)}:t.fetchFn=a}}}function T2(h,{pages:t,pageParams:c}){const a=t.length-1;return h.getNextPageParam(t[a],t,c[a],c)}function P0(h,{pages:t,pageParams:c}){var a;return(a=h.getPreviousPageParam)==null?void 0:a.call(h,t[0],t,c[0],c)}var C,e1,o1,y1,b1,z1,P1,R1,Z2,R0=(Z2=class{constructor(h={}){e(this,C,void 0);e(this,e1,void 0);e(this,o1,void 0);e(this,y1,void 0);e(this,b1,void 0);e(this,z1,void 0);e(this,P1,void 0);e(this,R1,void 0);v(this,C,h.queryCache||new S0),v(this,e1,h.mutationCache||new y0),v(this,o1,h.defaultOptions||{}),v(this,y1,new Map),v(this,b1,new Map),v(this,z1,0)}mount(){i2(this,z1)._++,n(this,z1)===1&&(v(this,P1,o2.subscribe(()=>{o2.isFocused()&&(this.resumePausedMutations(),n(this,C).onFocus())})),v(this,R1,z2.subscribe(()=>{z2.isOnline()&&(this.resumePausedMutations(),n(this,C).onOnline())})))}unmount(){var h,t;i2(this,z1)._--,n(this,z1)===0&&((h=n(this,P1))==null||h.call(this),v(this,P1,void 0),(t=n(this,R1))==null||t.call(this),v(this,R1,void 0))}isFetching(h){return n(this,C).findAll({...h,fetchStatus:"fetching"}).length}isMutating(h){return n(this,e1).findAll({...h,status:"pending"}).length}getQueryData(h){var t;return(t=n(this,C).find({queryKey:h}))==null?void 0:t.state.data}ensureQueryData(h){const t=this.getQueryData(h.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(h)}getQueriesData(h){return this.getQueryCache().findAll(h).map(({queryKey:t,state:c})=>{const a=c.data;return[t,a]})}setQueryData(h,t,c){const a=n(this,C).find({queryKey:h}),l=a==null?void 0:a.state.data,i=m0(t,l);if(typeof i>"u")return;const r=this.defaultQueryOptions({queryKey:h});return n(this,C).build(this,r).setData(i,{...c,manual:!0})}setQueriesData(h,t,c){return O.batch(()=>this.getQueryCache().findAll(h).map(({queryKey:a})=>[a,this.setQueryData(a,t,c)]))}getQueryState(h){var t;return(t=n(this,C).find({queryKey:h}))==null?void 0:t.state}removeQueries(h){const t=n(this,C);O.batch(()=>{t.findAll(h).forEach(c=>{t.remove(c)})})}resetQueries(h,t){const c=n(this,C),a={type:"active",...h};return O.batch(()=>(c.findAll(h).forEach(l=>{l.reset()}),this.refetchQueries(a,t)))}cancelQueries(h={},t={}){const c={revert:!0,...t},a=O.batch(()=>n(this,C).findAll(h).map(l=>l.cancel(c)));return Promise.all(a).then(_).catch(_)}invalidateQueries(h={},t={}){return O.batch(()=>{if(n(this,C).findAll(h).forEach(a=>{a.invalidate()}),h.refetchType==="none")return Promise.resolve();const c={...h,type:h.refetchType??h.type??"active"};return this.refetchQueries(c,t)})}refetchQueries(h={},t){const c={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},a=O.batch(()=>n(this,C).findAll(h).filter(l=>!l.isDisabled()).map(l=>{let i=l.fetch(void 0,c);return c.throwOnError||(i=i.catch(_)),l.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(a).then(_)}fetchQuery(h){const t=this.defaultQueryOptions(h);typeof t.retry>"u"&&(t.retry=!1);const c=n(this,C).build(this,t);return c.isStaleByTime(t.staleTime)?c.fetch(t):Promise.resolve(c.state.data)}prefetchQuery(h){return this.fetchQuery(h).then(_).catch(_)}fetchInfiniteQuery(h){return h.behavior=b0(h.pages),this.fetchQuery(h)}prefetchInfiniteQuery(h){return this.fetchInfiniteQuery(h).then(_).catch(_)}resumePausedMutations(){return n(this,e1).resumePausedMutations()}getQueryCache(){return n(this,C)}getMutationCache(){return n(this,e1)}getDefaultOptions(){return n(this,o1)}setDefaultOptions(h){v(this,o1,h)}setQueryDefaults(h,t){n(this,y1).set(U1(h),{queryKey:h,defaultOptions:t})}getQueryDefaults(h){const t=[...n(this,y1).values()];let c={};return t.forEach(a=>{Q1(h,a.queryKey)&&(c={...c,...a.defaultOptions})}),c}setMutationDefaults(h,t){n(this,b1).set(U1(h),{mutationKey:h,defaultOptions:t})}getMutationDefaults(h){const t=[...n(this,b1).values()];let c={};return t.forEach(a=>{Q1(h,a.mutationKey)&&(c={...c,...a.defaultOptions})}),c}defaultQueryOptions(h){if(h!=null&&h._defaulted)return h;const t={...n(this,o1).queries,...(h==null?void 0:h.queryKey)&&this.getQueryDefaults(h.queryKey),...h,_defaulted:!0};return t.queryHash||(t.queryHash=A2(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(h){return h!=null&&h._defaulted?h:{...n(this,o1).mutations,...(h==null?void 0:h.mutationKey)&&this.getMutationDefaults(h.mutationKey),...h,_defaulted:!0}}clear(){n(this,C).clear(),n(this,e1).clear()}},C=new WeakMap,e1=new WeakMap,o1=new WeakMap,y1=new WeakMap,b1=new WeakMap,z1=new WeakMap,P1=new WeakMap,R1=new WeakMap,Z2),D,x,F1,P,f1,k1,t1,$1,D1,E1,m1,x1,g1,L1,w1,j1,J1,f2,Z1,m2,Y1,x2,X1,L2,t2,w2,h2,B2,c2,I2,g2,d0,Y2,F0=(Y2=class extends W1{constructor(t,c){super();e(this,w1);e(this,J1);e(this,Z1);e(this,Y1);e(this,X1);e(this,t2);e(this,h2);e(this,c2);e(this,g2);e(this,D,void 0);e(this,x,void 0);e(this,F1,void 0);e(this,P,void 0);e(this,f1,void 0);e(this,k1,void 0);e(this,t1,void 0);e(this,$1,void 0);e(this,D1,void 0);e(this,E1,void 0);e(this,m1,void 0);e(this,x1,void 0);e(this,g1,void 0);e(this,L1,void 0);v(this,x,void 0),v(this,F1,void 0),v(this,P,void 0),v(this,L1,new Set),v(this,D,t),this.options=c,v(this,t1,null),this.bindMethods(),this.setOptions(c)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(n(this,x).addObserver(this),N2(n(this,x),this.options)?M(this,w1,j1).call(this):this.updateResult(),M(this,X1,L2).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return G2(n(this,x),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return G2(n(this,x),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,M(this,t2,w2).call(this),M(this,h2,B2).call(this),n(this,x).removeObserver(this)}setOptions(t,c){const a=this.options,l=n(this,x);if(this.options=n(this,D).defaultQueryOptions(t),e2(a,this.options)||n(this,D).getQueryCache().notify({type:"observerOptionsUpdated",query:n(this,x),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=a.queryKey),M(this,c2,I2).call(this);const i=this.hasListeners();i&&W2(n(this,x),l,this.options,a)&&M(this,w1,j1).call(this),this.updateResult(c),i&&(n(this,x)!==l||this.options.enabled!==a.enabled||this.options.staleTime!==a.staleTime)&&M(this,J1,f2).call(this);const r=M(this,Z1,m2).call(this);i&&(n(this,x)!==l||this.options.enabled!==a.enabled||r!==n(this,g1))&&M(this,Y1,x2).call(this,r)}getOptimisticResult(t){const c=n(this,D).getQueryCache().build(n(this,D),t),a=this.createResult(c,t);return D0(this,a)&&(v(this,P,a),v(this,k1,this.options),v(this,f1,n(this,x).state)),a}getCurrentResult(){return n(this,P)}trackResult(t){const c={};return Object.keys(t).forEach(a=>{Object.defineProperty(c,a,{configurable:!1,enumerable:!0,get:()=>(n(this,L1).add(a),t[a])})}),c}getCurrentQuery(){return n(this,x)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const c=n(this,D).defaultQueryOptions(t),a=n(this,D).getQueryCache().build(n(this,D),c);return a.isFetchingOptimistic=!0,a.fetch().then(()=>this.createResult(a,c))}fetch(t){return M(this,w1,j1).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),n(this,P)))}createResult(t,c){var F;const a=n(this,x),l=this.options,i=n(this,P),r=n(this,f1),z=n(this,k1),p=t!==a?t.state:n(this,F1),{state:o}=t;let{error:L,errorUpdatedAt:b,fetchStatus:H,status:V}=o,B=!1,g;if(c._optimisticResults){const I=this.hasListeners(),w=!I&&N2(t,c),a1=I&&W2(t,a,c,l);(w||a1)&&(H=M2(t.options.networkMode)?"fetching":"paused",o.dataUpdatedAt||(V="pending")),c._optimisticResults==="isRestoring"&&(H="idle")}if(c.select&&typeof o.data<"u")if(i&&o.data===(r==null?void 0:r.data)&&c.select===n(this,$1))g=n(this,D1);else try{v(this,$1,c.select),g=c.select(o.data),g=V2(i==null?void 0:i.data,g,c),v(this,D1,g),v(this,t1,null)}catch(I){v(this,t1,I)}else g=o.data;if(typeof c.placeholderData<"u"&&typeof g>"u"&&V==="pending"){let I;if(i!=null&&i.isPlaceholderData&&c.placeholderData===(z==null?void 0:z.placeholderData))I=i.data;else if(I=typeof c.placeholderData=="function"?c.placeholderData((F=n(this,E1))==null?void 0:F.state.data,n(this,E1)):c.placeholderData,c.select&&typeof I<"u")try{I=c.select(I),v(this,t1,null)}catch(w){v(this,t1,w)}typeof I<"u"&&(V="success",g=V2(i==null?void 0:i.data,I,c),B=!0)}n(this,t1)&&(L=n(this,t1),g=n(this,D1),b=Date.now(),V="error");const u=H==="fetching",G=V==="pending",f=V==="error",m=G&&u;return{status:V,fetchStatus:H,isPending:G,isSuccess:V==="success",isError:f,isInitialLoading:m,isLoading:m,data:g,dataUpdatedAt:o.dataUpdatedAt,error:L,errorUpdatedAt:b,failureCount:o.fetchFailureCount,failureReason:o.fetchFailureReason,errorUpdateCount:o.errorUpdateCount,isFetched:o.dataUpdateCount>0||o.errorUpdateCount>0,isFetchedAfterMount:o.dataUpdateCount>p.dataUpdateCount||o.errorUpdateCount>p.errorUpdateCount,isFetching:u,isRefetching:u&&!G,isLoadingError:f&&o.dataUpdatedAt===0,isPaused:H==="paused",isPlaceholderData:B,isRefetchError:f&&o.dataUpdatedAt!==0,isStale:y2(t,c),refetch:this.refetch}}updateResult(t){const c=n(this,P),a=this.createResult(n(this,x),this.options);if(v(this,f1,n(this,x).state),v(this,k1,this.options),n(this,f1).data!==void 0&&v(this,E1,n(this,x)),e2(a,c))return;v(this,P,a);const l={},i=()=>{if(!c)return!0;const{notifyOnChangeProps:r}=this.options,z=typeof r=="function"?r():r;if(z==="all"||!z&&!n(this,L1).size)return!0;const s=new Set(z??n(this,L1));return this.options.throwOnError&&s.add("error"),Object.keys(n(this,P)).some(p=>{const o=p;return n(this,P)[o]!==c[o]&&s.has(o)})};(t==null?void 0:t.listeners)!==!1&&i()&&(l.listeners=!0),M(this,g2,d0).call(this,{...l,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&M(this,X1,L2).call(this)}},D=new WeakMap,x=new WeakMap,F1=new WeakMap,P=new WeakMap,f1=new WeakMap,k1=new WeakMap,t1=new WeakMap,$1=new WeakMap,D1=new WeakMap,E1=new WeakMap,m1=new WeakMap,x1=new WeakMap,g1=new WeakMap,L1=new WeakMap,w1=new WeakSet,j1=function(t){M(this,c2,I2).call(this);let c=n(this,x).fetch(this.options,t);return t!=null&&t.throwOnError||(c=c.catch(_)),c},J1=new WeakSet,f2=function(){if(M(this,t2,w2).call(this),N1||n(this,P).isStale||!s2(this.options.staleTime))return;const c=h0(n(this,P).dataUpdatedAt,this.options.staleTime)+1;v(this,m1,setTimeout(()=>{n(this,P).isStale||this.updateResult()},c))},Z1=new WeakSet,m2=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(n(this,x)):this.options.refetchInterval)??!1},Y1=new WeakSet,x2=function(t){M(this,h2,B2).call(this),v(this,g1,t),!(N1||this.options.enabled===!1||!s2(n(this,g1))||n(this,g1)===0)&&v(this,x1,setInterval(()=>{(this.options.refetchIntervalInBackground||o2.isFocused())&&M(this,w1,j1).call(this)},n(this,g1)))},X1=new WeakSet,L2=function(){M(this,J1,f2).call(this),M(this,Y1,x2).call(this,M(this,Z1,m2).call(this))},t2=new WeakSet,w2=function(){n(this,m1)&&(clearTimeout(n(this,m1)),v(this,m1,void 0))},h2=new WeakSet,B2=function(){n(this,x1)&&(clearInterval(n(this,x1)),v(this,x1,void 0))},c2=new WeakSet,I2=function(){const t=n(this,D).getQueryCache().build(n(this,D),this.options);if(t===n(this,x))return;const c=n(this,x);v(this,x,t),v(this,F1,t.state),this.hasListeners()&&(c==null||c.removeObserver(this),t.addObserver(this))},g2=new WeakSet,d0=function(t){O.batch(()=>{t.listeners&&this.listeners.forEach(c=>{c(n(this,P))}),n(this,D).getQueryCache().notify({query:n(this,x),type:"observerResultsUpdated"})})},Y2);function k0(h,t){return t.enabled!==!1&&!h.state.dataUpdatedAt&&!(h.state.status==="error"&&t.retryOnMount===!1)}function N2(h,t){return k0(h,t)||h.state.dataUpdatedAt>0&&G2(h,t,t.refetchOnMount)}function G2(h,t,c){if(t.enabled!==!1){const a=typeof c=="function"?c(h):c;return a==="always"||a!==!1&&y2(h,t)}return!1}function W2(h,t,c,a){return c.enabled!==!1&&(h!==t||a.enabled===!1)&&(!c.suspense||h.state.status!=="error")&&y2(h,c)}function y2(h,t){return h.isStaleByTime(t.staleTime)}function D0(h,t){return!e2(h.getCurrentResult(),t)}var M1,k,K,l1,T1,d2,a2,C2,X2,E0=(X2=class extends W1{constructor(t,c){super();e(this,T1);e(this,a2);e(this,M1,void 0);e(this,k,void 0);e(this,K,void 0);e(this,l1,void 0);v(this,k,void 0),v(this,M1,t),this.setOptions(c),this.bindMethods(),M(this,T1,d2).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var a;const c=this.options;this.options=n(this,M1).defaultMutationOptions(t),e2(c,this.options)||n(this,M1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:n(this,K),observer:this}),(a=n(this,K))==null||a.setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=n(this,K))==null||t.removeObserver(this)}onMutationUpdate(t){M(this,T1,d2).call(this),M(this,a2,C2).call(this,t)}getCurrentResult(){return n(this,k)}reset(){v(this,K,void 0),M(this,T1,d2).call(this),M(this,a2,C2).call(this)}mutate(t,c){var a;return v(this,l1,c),(a=n(this,K))==null||a.removeObserver(this),v(this,K,n(this,M1).getMutationCache().build(n(this,M1),this.options)),n(this,K).addObserver(this),n(this,K).execute(t)}},M1=new WeakMap,k=new WeakMap,K=new WeakMap,l1=new WeakMap,T1=new WeakSet,d2=function(){var c;const t=((c=n(this,K))==null?void 0:c.state)??v0();v(this,k,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},a2=new WeakSet,C2=function(t){O.batch(()=>{var c,a,l,i,r,z,s,p;n(this,l1)&&this.hasListeners()&&((t==null?void 0:t.type)==="success"?((a=(c=n(this,l1)).onSuccess)==null||a.call(c,t.data,n(this,k).variables,n(this,k).context),(i=(l=n(this,l1)).onSettled)==null||i.call(l,t.data,null,n(this,k).variables,n(this,k).context)):(t==null?void 0:t.type)==="error"&&((z=(r=n(this,l1)).onError)==null||z.call(r,t.error,n(this,k).variables,n(this,k).context),(p=(s=n(this,l1)).onSettled)==null||p.call(s,void 0,t.error,n(this,k).variables,n(this,k).context))),this.listeners.forEach(o=>{o(n(this,k))})})},X2);var r0=A.createContext(void 0),N=h=>{const t=A.useContext(r0);if(h)return h;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},T0=({client:h,children:t})=>(A.useEffect(()=>(h.mount(),()=>{h.unmount()}),[h]),A.createElement(r0.Provider,{value:h},t)),e0=A.createContext(!1),N0=()=>A.useContext(e0),C4=e0.Provider;function W0(){let h=!1;return{clearReset:()=>{h=!1},reset:()=>{h=!0},isReset:()=>h}}var j0=A.createContext(W0()),U0=()=>A.useContext(j0);function o0(h,t){return typeof h=="function"?h(...t):!!h}var Q0=(h,t)=>{(h.suspense||h.throwOnError)&&(t.isReset()||(h.retryOnMount=!1))},K0=h=>{A.useEffect(()=>{h.clearReset()},[h])},q0=({result:h,errorResetBoundary:t,throwOnError:c,query:a})=>h.isError&&!t.isReset()&&!h.isFetching&&o0(c,[h.error,a]);var _0=h=>{h.suspense&&typeof h.staleTime!="number"&&(h.staleTime=1e3)};var $0=(h,t)=>(h==null?void 0:h.suspense)&&t.isPending,J0=(h,t,c)=>t.fetchOptimistic(h).catch(()=>{c.clearReset()});function Z0(h,t,c){if(process.env.NODE_ENV!=="production"&&(typeof h!="object"||Array.isArray(h)))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 a=N(c),l=N0(),i=U0(),r=a.defaultQueryOptions(h);r._optimisticResults=l?"isRestoring":"optimistic",_0(r),Q0(r,i),K0(i);const[z]=A.useState(()=>new t(a,r)),s=z.getOptimisticResult(r);if(A.useSyncExternalStore(A.useCallback(p=>{const o=l?()=>{}:z.subscribe(O.batchCalls(p));return z.updateResult(),o},[z,l]),()=>z.getCurrentResult(),()=>z.getCurrentResult()),A.useEffect(()=>{z.setOptions(r,{listeners:!1})},[r,z]),$0(r,s))throw J0(r,z,i);if(q0({result:s,errorResetBoundary:i,throwOnError:r.throwOnError,query:z.getCurrentQuery()}))throw s.error;return r.notifyOnChangeProps?s:z.trackResult(s)}function n2(h,t){return Z0(h,F0,t)}function J(h,t){const c=N(t),[a]=A.useState(()=>new E0(c,h));A.useEffect(()=>{a.setOptions(h)},[a,h]);const l=A.useSyncExternalStore(A.useCallback(r=>a.subscribe(O.batchCalls(r)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),i=A.useCallback((r,z)=>{a.mutate(r,z).catch(Y0)},[a]);if(l.error&&o0(a.options.throwOnError,[l.error]))throw l.error;return{...l,mutate:i,mutateAsync:l.mutate}}function Y0(){}function R(){return N().getQueryData(["apiBaseUrl"])||"/api/chaibuilder"}const H1=()=>{const{data:h,refetch:t}=n2({queryKey:["currentPage"],queryFn:()=>localStorage.getItem("currentPage")||""});return[h,c=>{c&&(localStorage.setItem("currentPage",c||""),t())}]};let j2="";const l2=()=>(j2=localStorage.getItem("__chai_at"),j2);function X0(h){const t={method:"GET",headers:{"x-chai-access-token":l2()}};return fetch(h,t)}function t4(h,t){const c={method:"POST",headers:{"x-chai-access-token":l2()},body:JSON.stringify(t)};return fetch(h,c)}function h4(h,t){const c={method:"PUT",headers:{"x-chai-access-token":l2()},body:JSON.stringify(t)};return fetch(h,c)}function c4(h,t){const c={method:"DELETE",headers:{"x-chai-access-token":l2()},body:JSON.stringify(t)};return fetch(h,c)}const W={get:X0,post:t4,put:h4,delete:c4},b2=()=>{const[h,t]=H1(),c=R();return n2({queryKey:["project"],queryFn:async()=>{const{data:a}=await W.get(`${c}/project`).then(l=>l.json());if(!h&&a){const l=localStorage.getItem("currentPage");t(l||(a==null?void 0:a.homepage))}return a}})},P2=()=>{const h=R();return n2({queryKey:["pages"],queryFn:async()=>{const{data:t}=await W.get(`${h}/pages`).then(c=>c.json());return t||[]}})},z0=()=>{const[h]=H1(),t=R();return n2({queryKey:["page_data",h],queryFn:async()=>{const{data:c}=await W.get(`${t}/page?uuid=${h}`).then(a=>a.json());return c},enabled:!!h,staleTime:3e3})},O2=()=>d.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-gray-200",children:d.jsxRuntimeExports.jsxs("div",{className:"flex flex-col h-full w-full justify-center items-center",children:[d.jsxRuntimeExports.jsxs("div",{className:"flex flex-row gap-2",children:[d.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-orange-600 animate-bounce [animation-delay:.6s]"}),d.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-600 animate-bounce [animation-delay:.4s]"}),d.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-green-600 animate-bounce [animation-delay:.2s]"}),d.jsxRuntimeExports.jsx("div",{className:"w-4 h-4 rounded-full bg-yellow-600 animate-bounce [animation-delay:.0s]"})]}),d.jsxRuntimeExports.jsx("div",{className:"text-gray-700 font-thin",children:"Loading Builder..."})]})}),g0=(h="Project updated successfully.")=>{const t=N(),c=R();return J({mutationFn:async a=>await W.put(`${c}/project`,a).then(l=>l.json()),onSuccess:()=>{t.invalidateQueries({queryKey:["project"]}),h1.toast.success(h)}})},M0=()=>{const[h]=["SAVED"],[t,c]=H1(),a=q.useBuilderReset(),{t:l}=p0.useTranslation();return i=>h!=="SAVED"?(h1.toast.error(l("You have unsaved changes. Please save before changing the page.")),!1):t===i.uuid?!1:(a(),setTimeout(()=>c(i.uuid),100),!0)},a4=()=>{const h=N(),t=M0(),c=R();return J({mutationFn:async a=>W.post(`${c}/pages`,a).then(l=>l.json()),onSuccess:a=>{h.invalidateQueries({queryKey:["pages"]}),t({uuid:a.uuid,slug:a.slug}),h1.toast.success("Page added successfully.")}})},H0=()=>{const h=R(),[t]=H1(),c=N();return J({mutationFn:async a=>W.put(`${h}/page`,a).then(l=>l.json()),onSuccess:async a=>{var l;if(a.result==="error"&&((l=a.error)==null?void 0:l.code)=="PAGE_LOCKED"){c.invalidateQueries({queryKey:["page_data",t]});return}h1.toast.success("Page saved successfully.")}})},n4=()=>{const h=R(),{data:t}=P2(),[c]=H1(),{data:a}=b2(),l=N();return J({mutationFn:async()=>{const i=t.find(r=>r.uuid===c).slug;return await W.post(`${h}/publish`,{slug:i,uuid:c,isHomepage:(a==null?void 0:a.homepage)===c}).then(r=>r.json())},onSuccess:async i=>{var r;if(i.result==="error"&&((r=i.error)==null?void 0:r.code)=="PAGE_LOCKED"){l.invalidateQueries({queryKey:["page_data",c]});return}h1.toast.success("Page published successfully.",{position:"bottom-right",duration:2e3})}})},l4=()=>{const h=N(),t=R();return J({mutationFn:async c=>W.delete(`${t}/page`,c).then(a=>a.json()),onSuccess:()=>{h1.toast.success("Page deleted successfully."),h.invalidateQueries({queryKey:["pages"]})}})},i4=()=>{const h=N(),t=R();return J({mutationFn:async c=>W.post(`${t}/take-control`,{uuid:c}).then(a=>a.json()),onSuccess:(c,a)=>{h.invalidateQueries({queryKey:["page_data",a]})}})},v4=()=>{const h=R();return J({mutationFn:async()=>{const{data:t}=await W.get(`${h}/library`).then(c=>c.json());return c1.sortBy(c1.filter(t,c=>!c1.has(c,"hidden")),"group")}})},d4=()=>{const h=R();return J({mutationFn:async t=>{if(!t||!t.uuid)return[];try{const{data:c}=await W.get(`${h}/block?uuid=${t.uuid}&format=${t.format}`).then(async a=>t.format==="html"?V0.getBlocksFromHTML(await a.text()):await a.json());return c1.set(c,"0._name",c1.capitalize(t.group)),c||[]}catch{return[]}}})},r4=()=>{const h=R();return J({mutationFn:async t=>{const c=new FormData;c.append("file",t);const{data:a}=await fetch(`${h}/upload`,{method:"POST",headers:{"x-chai-access-token":l2()},body:c}).then(l=>l.json());return a}})};function u0(h){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{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 4-8 5-8-5V6l8 5 8-5v2z"},child:[]}]})(h)}function e4(h){return t0.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{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"},child:[]}]})(h)}const o4=()=>{const{mutate:h,isPending:t}=i4(),[c]=H1(),{data:a}=z0(),l=c1.get(a,"lockedBy.name",""),i=c1.get(a,"lockedBy.email","");return d.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:[d.jsxRuntimeExports.jsxs("h2",{className:"text-2xl font-bold",children:["Page is ",d.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"locked"})]}),d.jsxRuntimeExports.jsxs("div",{className:"text-gray-500 dark:text-gray-400 font-light",children:["This page is currently being edited by ",d.jsxRuntimeExports.jsx("br",{}),d.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-3 w-max mx-auto font-medium text-gray-700 mt-2 text-sm",children:[d.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md",children:[d.jsxRuntimeExports.jsx(e4,{className:"w-4 h-4 text-gray-500"})," ",l]}),d.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 bg-gray-100 py-1 px-2 rounded-md lowercase",children:[d.jsxRuntimeExports.jsx(u0,{className:"w-4 h-4 text-gray-500"})," ",i]})]}),d.jsxRuntimeExports.jsxs("div",{className:"pt-4",children:["If you take control, ",l," will be ",d.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"restricted"})," from making additional edits."]})]}),d.jsxRuntimeExports.jsx(q.Button,{disabled:t,onClick:()=>h(c),className:`w-36 ${t?"bg-transparent shadow-none hover:bg-transparent":""}`,children:t?d.jsxRuntimeExports.jsx(S2.Loader,{className:"text-sm animate-spin text-gray-500"}):"Take Over"})]})},z4=()=>{const h=R(),t=N();return J({mutationFn:async c=>{const a=await fetch(`${h}/login`,{method:"POST",body:JSON.stringify(c)});if(a.ok)return await a.json();throw a.status===401?new Error("Invalid login credentials"):new Error("Invalid")},onSuccess:c=>{const{data:a}=c;if(!a.accessToken){h1.toast.error("Something went wrong. Please try again.",{position:"top-center"});return}localStorage.setItem("__chai_at",a.accessToken),localStorage.setItem("__chai_ur",JSON.stringify(c1.omit(a,["accessToken"]))),t.invalidateQueries({queryKey:["verify"]}),h1.toast.success("Logged in successfully.")},onError:()=>{h1.toast.error("Invalid login credentials. Please try again.",{position:"top-center"})}})},g4=()=>{const h=R();return n2({queryKey:["verify"],queryFn:async()=>{const t=await W.get(`${h}/verify`);return t.ok?(await t.json()).result==="success"?{valid:!0}:(localStorage.removeItem("__chai_at"),{valid:!1}):(localStorage.removeItem("__chai_at"),{valid:!0})}})},M4=()=>{const h=R(),t=N();return J({mutationFn:async()=>{const{result:c}=await W.post(`${h}/logout`).then(a=>a.json());if(c==="success")return localStorage.clear(),t.invalidateQueries({queryKey:["verify"]}),{logout:!0};throw new Error("Invalid session")}})},H4=({children:h})=>{const t=M4();return d.jsxRuntimeExports.jsxs(q.AlertDialog,{children:[d.jsxRuntimeExports.jsx(q.AlertDialogTrigger,{asChild:!0,children:h}),d.jsxRuntimeExports.jsxs(q.AlertDialogContent,{children:[d.jsxRuntimeExports.jsxs(q.AlertDialogHeader,{children:[d.jsxRuntimeExports.jsxs(q.AlertDialogTitle,{children:["Are you sure, you want to ",d.jsxRuntimeExports.jsx("span",{className:"text-red-500",children:"Sign Out"}),"?"]}),d.jsxRuntimeExports.jsx(q.AlertDialogDescription,{children:"Kindly ensure that all your data is saved before proceeding with the sign-out process to prevent any potential loss of unsaved information"})]}),d.jsxRuntimeExports.jsxs(q.AlertDialogFooter,{children:[d.jsxRuntimeExports.jsx(q.AlertDialogCancel,{disabled:t.isPending,children:"Cancel"}),d.jsxRuntimeExports.jsxs("button",{disabled:t.isPending,onClick:()=>t.mutate(),className:"rounded-md text-white w-28 text-center justify-center bg-red-600 hover:bg-red-700 flex items-center gap-x-2",children:[t.isPending&&d.jsxRuntimeExports.jsx(S2.Loader2,{className:"animate-spin w-5 h-5"}),"Sign Out"]})]})]})]})},u4=()=>d.jsxRuntimeExports.jsx(H4,{children:d.jsxRuntimeExports.jsx("button",{className:"border-gray-200 rounded-md p-2 mb-2 border",children:d.jsxRuntimeExports.jsx(S2.LogOutIcon,{className:"w-4 h-4 text-red-500 cursor-pointer hover:text-red-300 duration-300"})})}),s4=T.lazy(()=>Promise.resolve().then(()=>require("./PagesPanel-t3NlycIl.cjs"))),p4=T.lazy(()=>Promise.resolve().then(()=>require("./ProjectPanel-UClucyIl.cjs"))),V4=T.lazy(()=>Promise.resolve().then(()=>require("./CurrentPage-ccOL3l6S.cjs"))),f4=()=>d.jsxRuntimeExports.jsx("h2",{children:"Your Logo"}),m4=()=>{const{mutate:h}=n4();return q.useBuilderProp("editable",!0)?d.jsxRuntimeExports.jsx(q.Button,{onClick:h,className:"bg-blue-600 text-white",children:"Publish"}):null},x4=h=>{var f;const{data:t,isLoading:c}=b2(),{data:a,isLoading:l}=P2(),{data:i}=z0(),{mutate:r}=g0(),{mutate:z}=H0(),[s]=H1(),p=r4(),o=v4(),L=d4(),b=R(),H=T.useCallback(async m=>await p.mutateAsync(m),[p]),V=T.useCallback(async()=>await o.mutateAsync(),[o]),B=T.useCallback(async m=>await L.mutateAsync(m),[L]),g=async(m=20,y=0)=>{const F=`limit=${m}&offset=${y}`,I=await fetch(`${b}/assets?${F}`).then(w=>w.json());return I.result==="success"?I.data:[]},{logo:u=f4}=h;if(c||!t)return d.jsxRuntimeExports.jsx(O2,{});if(l||!a)return d.jsxRuntimeExports.jsx(O2,{});const G={...h,editable:i!=null&&i.lockedBy?i==null?void 0:i.lockedBy.self:!0,nonEditableComponent:o4,blocks:(i==null?void 0:i.blocks)||[],brandingOptions:t.brandingOptions,darkMode:h.darkMode||!1,dataProviders:(i==null?void 0:i.providers)||[],onSavePage:async({blocks:m,providers:y})=>(await z({blocks:m,providers:y,uuid:s}),!0),onSaveBrandingOptions:async m=>(await r({brandingOptions:m}),!0),topBarComponents:{left:[u],center:[V4],right:[m4]},sideBarComponents:{top:[{icon:r2.FileTextIcon,name:"pages",panel:s4},{icon:r2.GearIcon,name:"settings",panel:p4},...((f=h.sideBarComponents)==null?void 0:f.top)||[]],bottom:[u4]},uploadMediaCallback:H,fetchMediaCallback:g,getUILibraryBlocks:V,getExternalPredefinedBlock:B,getPages:()=>a};return d.jsxRuntimeExports.jsx(s0.ChaiBuilderEditor,{...G})},L4=({logo:h})=>{const[t,c]=T.useState(!1),[a,l]=T.useState(""),[i,r]=T.useState(""),{mutate:z,isPending:s}=z4(),p=o=>{o.preventDefault(),z({email:a,password:i})};return d.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:d.jsxRuntimeExports.jsx("div",{className:"overflow-hidden bg-white rounded-xl w-96 drop-shadow-2xl duration-300",children:d.jsxRuntimeExports.jsxs("div",{className:"p-12",children:[d.jsxRuntimeExports.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[d.jsxRuntimeExports.jsx(T.Suspense,{children:h?T.createElement(h):""}),d.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"})]}),d.jsxRuntimeExports.jsx("div",{className:"mt-8",children:d.jsxRuntimeExports.jsxs("form",{method:"POST",onSubmit:p,className:"space-y-5",children:[d.jsxRuntimeExports.jsx("div",{children:d.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[d.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:d.jsxRuntimeExports.jsx(u0,{})}),d.jsxRuntimeExports.jsx("input",{value:a,onChange:o=>l(o.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"})]})}),d.jsxRuntimeExports.jsx("div",{children:d.jsxRuntimeExports.jsxs("div",{className:"mt-2.5 relative text-gray-400 focus-within:text-gray-600",children:[d.jsxRuntimeExports.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:d.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:d.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"})})}),d.jsxRuntimeExports.jsx("input",{value:i,onChange:o=>r(o.target.value),type:t?"text":"password",id:"pwd",placeholder:"Enter password",className:"block w-full py-4 px-10 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"}),d.jsxRuntimeExports.jsx("button",{type:"button",className:"absolute inset-y-0 right-4 flex items-center pl-3 cursor-pointer",onClick:()=>c(!t),children:t?d.jsxRuntimeExports.jsx(r2.EyeClosedIcon,{}):d.jsxRuntimeExports.jsx(r2.EyeOpenIcon,{})})]})}),d.jsxRuntimeExports.jsx("div",{children:d.jsxRuntimeExports.jsx("button",{disabled:s||c1.size(a)<2||c1.size(i)<2,type:"submit",className:"inline-flex disabled:bg-gray-400 items-center justify-center w-full px-4 py-4 text-base font-semibold text-white transition-all duration-200 bg-blue-600 border border-transparent rounded-md focus:outline-none hover:bg-blue-700 focus:bg-blue-700",children:s?"Signing in...":"Login"})})]})}),d.jsxRuntimeExports.jsx("div",{className:"mt-4 flex items-center justify-end gap-x-2 text-sm",children:d.jsxRuntimeExports.jsx("a",{href:"https://apps.chaibuilder.com/settings",target:"_blank",className:"text-gray-500 hover:text-blue-400",children:"Forget your password?"})})]})})})},w4=h=>{const{data:t,isLoading:c}=g4(),a=N();return T.useEffect(()=>{a.setQueryData(["apiBaseUrl"],h.apiBaseUrl||"/api/chaibuilder")},[h.apiBaseUrl,a]),c?d.jsxRuntimeExports.jsx(O2,{}):t!=null&&t.valid?d.jsxRuntimeExports.jsx(x4,{...h}):d.jsxRuntimeExports.jsx(L4,{logo:h.logo})},B4=new R0,I4=h=>d.jsxRuntimeExports.jsxs(T0,{client:B4,children:[d.jsxRuntimeExports.jsx(h1.Toaster,{richColors:!0}),d.jsxRuntimeExports.jsx(w4,{...h})]});exports.ChaiBuilderStudio=I4;exports.useAddPage=a4;exports.useChangePage=M0;exports.useCurrentPage=H1;exports.useDeletePage=l4;exports.usePages=P2;exports.useProject=b2;exports.useQueryClient=N;exports.useUpdatePage=H0;exports.useUpdateProject=g0;