@chaibuilder/sdk 4.0.0-beta.31 → 4.0.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2SSKDMRQ-gmj-yWTy.js → 2SSKDMRQ-BXAXoR9y.js} +5 -5
- package/dist/{2SSKDMRQ-BksFOLpD.cjs → 2SSKDMRQ-BqOsh3tf.cjs} +1 -1
- package/dist/{AP7HFJJL-kVgc0R61.js → AP7HFJJL-B78LfetW.js} +1 -1
- package/dist/{AP7HFJJL-CO-deD_p.cjs → AP7HFJJL-Cv6sqAAd.cjs} +1 -1
- package/dist/{IconPicker-D_GRfhwS.js → IconPicker-BlO5Pnyu.js} +1 -1
- package/dist/{IconPicker-BJHUCDn4.cjs → IconPicker-D4yq_b-k.cjs} +1 -1
- package/dist/{WDYDFRGG-C9_E3QW0.js → WDYDFRGG-BE7jgVqa.js} +4 -4
- package/dist/{WDYDFRGG-KPpWFul_.cjs → WDYDFRGG-Dz9d3cVW.cjs} +1 -1
- package/dist/{actions-registery-Bj-j1k5i.js → actions-registery-D3-4Yha7.js} +1108 -1061
- package/dist/{actions-registery-Cy1lqUVI.cjs → actions-registery-vPaY-3dZ.cjs} +25 -25
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-1GoKTVcF.js → active-in-another-tab-CA47uafJ.js} +2 -2
- package/dist/{active-in-another-tab-iEd5fZD0.cjs → active-in-another-tab-CNn_R-55.cjs} +1 -1
- package/dist/{add-new-language-page-B3GUvWdP.js → add-new-language-page-B-kPbhFd.js} +3 -3
- package/dist/{add-new-language-page-Cq8R42Ro.cjs → add-new-language-page-QAZbAFQe.cjs} +1 -1
- package/dist/{add-new-page-DiHnECAR.cjs → add-new-page-D4nbAHOp.cjs} +1 -1
- package/dist/add-new-page-Y0d9tHh0.js +31 -0
- package/dist/{ai-panel-content-BPpawv4D.cjs → ai-panel-content-DXbebC-m.cjs} +1 -1
- package/dist/{ai-panel-content-tExD3yhH.js → ai-panel-content-WMOeK5pF.js} +5 -5
- package/dist/{ai-panel-default-lang-DnYLHSaS.js → ai-panel-default-lang-CM_psX_h.js} +7 -7
- package/dist/{ai-panel-default-lang-C6N4wUUF.cjs → ai-panel-default-lang-hmfyAYPM.cjs} +2 -2
- package/dist/{ai-panel-other-lang-D1pCJluY.js → ai-panel-other-lang-BKANRJAb.js} +13 -13
- package/dist/{ai-panel-other-lang-C65lVVtZ.cjs → ai-panel-other-lang-D4GL1b-W.cjs} +1 -1
- package/dist/{ai-prompt-input-Dws5BHhQ.cjs → ai-prompt-input-Dwd0-pcD.cjs} +1 -1
- package/dist/{ai-prompt-input-B2q30bhR.js → ai-prompt-input-mxXtWptn.js} +13 -13
- package/dist/{ai-translation-prompt-DnwG2BmF.cjs → ai-translation-prompt-7M2aEZ1w.cjs} +1 -1
- package/dist/{ai-translation-prompt-Dnn6i_t3.js → ai-translation-prompt-C_Pb7BE4.js} +1 -1
- package/dist/{apply-binding-chfbBKi2.js → apply-binding-BYCW1k2l.js} +1 -1
- package/dist/{apply-binding-9XSrYzAE.cjs → apply-binding-xiigK7eK.cjs} +1 -1
- package/dist/{change-password-modal-LKtYY-8V.cjs → change-password-modal-BYZoefwT.cjs} +1 -1
- package/dist/{change-password-modal-C0MMizgl.js → change-password-modal-Dqf_mleR.js} +5 -5
- package/dist/{code-editor-CWOmKcUc.js → code-editor-1fSEocLK.js} +1 -1
- package/dist/{code-editor-Cim6jQVF.cjs → code-editor-uN7W7KMD.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-oxYWGWON.js → continue-editing-in-this-client-DD7bBhjD.js} +2 -2
- package/dist/{continue-editing-in-this-client-Dd6nKIvX.cjs → continue-editing-in-this-client-DDM65ror.cjs} +1 -1
- package/dist/{core-BWQrViOY.cjs → core-czmLeR0h.cjs} +1 -1
- package/dist/{core-QlWEXm1d.js → core-nSRy3D7z.js} +16 -15
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +14 -2
- package/dist/core.js +19 -19
- package/dist/{css-import-modal-CXulmaB4.cjs → css-import-modal-BU7bJAaT.cjs} +1 -1
- package/dist/{css-import-modal-6bMTRlCg.js → css-import-modal-pBNRVmGj.js} +1 -1
- package/dist/default-theme-options-DN-3gIjM.cjs +22 -0
- package/dist/{plugin-BSjgGgwo.js → default-theme-options-saBIkWGT.js} +114 -114
- package/dist/{delete-page-D0tdn6VW.cjs → delete-page-8oEYsHPE.cjs} +1 -1
- package/dist/delete-page-B53nkF74.js +71 -0
- package/dist/{design-token-usage-D-hrcKz1.cjs → design-token-usage-Cm9m4AMz.cjs} +1 -1
- package/dist/{design-token-usage-lf7N_uOk.js → design-token-usage-DzWav2ip.js} +14 -14
- package/dist/{digital-asset-manager-DJhRhLGC.js → digital-asset-manager-1yLYGPuf.js} +5 -5
- package/dist/digital-asset-manager-BaTvMY8Q.cjs +1 -0
- package/dist/{duplicate-page-ChSp1TYN.cjs → duplicate-page-C2DZI4U0.cjs} +1 -1
- package/dist/{duplicate-page-CXzYy7vx.js → duplicate-page-DCRVR-kF.js} +6 -6
- package/dist/{dynamic-page-selector-btGtkyyv.cjs → dynamic-page-selector-CZJQnc-Q.cjs} +1 -1
- package/dist/{dynamic-page-selector-r5IR9_7k.js → dynamic-page-selector-DCGWkLVV.js} +12 -12
- package/dist/get-chai-builder-theme-C_qofMh_.cjs +1 -0
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-CyOkIlte.js} +1 -1
- package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
- package/dist/image-compression-UaU7Bwqe.cjs +1 -0
- package/dist/{image-editor-CilPMtAC.js → image-editor-C0EYZJY_.js} +1 -1
- package/dist/{image-editor-BdW476J8.cjs → image-editor-DkgZrSGr.cjs} +1 -1
- package/dist/{index-DtMksfXx.js → index-BDrc0HJQ.js} +1729 -1680
- package/dist/index-BuXfCtgR.cjs +5 -0
- package/dist/{index-DsQXiNA_.js → index-C7bidKtE.js} +2786 -2752
- package/dist/index-DKjYF53r.cjs +160 -0
- package/dist/{json-diff-viewer-BkrnLb3B.cjs → json-diff-viewer-88jEhq8D.cjs} +1 -1
- package/dist/{json-diff-viewer-D3N3w3Ax.js → json-diff-viewer-wmzIZcuQ.js} +34 -34
- package/dist/{lang-panel-BAaaP4Qc.js → lang-panel--kWBnU_W.js} +7 -7
- package/dist/{lang-panel-BjDRrpwN.cjs → lang-panel-I_ABfjOZ.cjs} +1 -1
- package/dist/manage-design-tokens-CslCEOXU.cjs +1 -0
- package/dist/manage-design-tokens-JdVKj09s.js +445 -0
- package/dist/manage-design-tokens-modal-DA15ou0u.cjs +1 -0
- package/dist/{manage-design-tokens-modal-9qpcb-EC.js → manage-design-tokens-modal-xKxC72Bc.js} +9 -9
- package/dist/{mark-as-template-DNHYNjI9.js → mark-as-template-AbZrkEYl.js} +7 -7
- package/dist/{mark-as-template-IYRjta97.cjs → mark-as-template-ClQjC2p2.cjs} +1 -1
- package/dist/{nested-path-selector-content-Be-pbnVl.js → nested-path-selector-content-B04k-PPB.js} +1 -1
- package/dist/{nested-path-selector-content-CWmPgU-L.cjs → nested-path-selector-content-dFwZaM1r.cjs} +1 -1
- package/dist/{no-language-page-content-C-ltY7bj.js → no-language-page-content-CbUqxuC4.js} +2 -2
- package/dist/{no-language-page-content-8_J6y-cm.cjs → no-language-page-content-pzkWJAg6.cjs} +1 -1
- package/dist/{no-language-page-dialog-D5NXpDHi.js → no-language-page-dialog-AavD_Mmc.js} +2 -2
- package/dist/{no-language-page-dialog-BOZZZzqx.cjs → no-language-page-dialog-DhlOVXUm.cjs} +1 -1
- package/dist/{page-creator-BuHHnqiQ.js → page-creator-2OZveMsR.js} +95 -95
- package/dist/{page-creator-wtbae2U7.cjs → page-creator-DMjnStPf.cjs} +1 -1
- package/dist/{page-lock-pPGlTxj7.js → page-lock-5MwwTWe8.js} +2 -2
- package/dist/{page-lock-DN4iJc-V.cjs → page-lock-B3CpoFTs.cjs} +1 -1
- package/dist/{page-locked-dialog-Bl-ojgIW.js → page-locked-dialog-BhNZC9wZ.js} +13 -13
- package/dist/{page-locked-dialog-B_vdgv24.cjs → page-locked-dialog-ZOvjnxRI.cjs} +1 -1
- package/dist/page-manager-new-BcI-1Dms.cjs +1 -0
- package/dist/{page-manager-new-Bg8H6yrg.js → page-manager-new-l68-Lc9h.js} +85 -88
- package/dist/{page-manager-search-and-filter-CDXunXNd.cjs → page-manager-search-and-filter-BOpne6v-.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-CyfO7O96.js → page-manager-search-and-filter-DJn98D02.js} +31 -30
- package/dist/{page-revisions-content-BKT8S9_g.cjs → page-revisions-content-B00tDCzu.cjs} +1 -1
- package/dist/{page-revisions-content-B-egQgoZ.js → page-revisions-content-Bqp-9bae.js} +23 -23
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +14 -2
- package/dist/pages.js +12 -12
- package/dist/{publish-pages-content-D2B_ScCQ.js → publish-pages-content-CtZLSG6O.js} +68 -75
- package/dist/publish-pages-content-DfYG0biw.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +5 -5
- package/dist/{rte-widget-modal-c3T09VeO.js → rte-widget-modal-DGEWoQ1b.js} +1 -1
- package/dist/{rte-widget-modal-CC1KcrAT.cjs → rte-widget-modal-DX66uSPv.cjs} +1 -1
- package/dist/runtime.cjs +6 -6
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +36 -35
- package/dist/{save-to-lib-dT1NDd5w.js → save-to-lib-CCxX5ZmQ.js} +26 -26
- package/dist/{save-to-lib-CiM0wiIr.cjs → save-to-lib-DmAjdhzU.cjs} +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-BgqcPsXI.cjs → selected-block-display-Csce27bR.cjs} +1 -1
- package/dist/{selected-block-display-BQndDPcY.js → selected-block-display-Cv6jBhJD.js} +20 -20
- package/dist/{seo-panel-DXZvGYEM.cjs → seo-panel-BZYXeYzE.cjs} +1 -1
- package/dist/{seo-panel-Z93Zf_bz.js → seo-panel-Ctstjs-d.js} +25 -25
- package/dist/{shared-json-ld-DwvUDGAS.cjs → shared-json-ld-BDWtjHgw.cjs} +1 -1
- package/dist/{shared-json-ld-Ct68RlWD.js → shared-json-ld-BNHGmUBd.js} +45 -45
- package/dist/{slug-input-CAqkFZBq.js → slug-input-Bui1Qmvh.js} +1 -1
- package/dist/{slug-input-Curnt2n3.cjs → slug-input-IAl_jfHr.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +272 -206
- package/dist/{take-over-request-D6y2HcDr.cjs → take-over-request-Bl6jS1cK.cjs} +1 -1
- package/dist/{take-over-request-C6ngP1QR.js → take-over-request-Ceuqyk5K.js} +13 -13
- package/dist/{translation-warning-modal-B876S5yp.cjs → translation-warning-modal-CCmmwz1C.cjs} +1 -1
- package/dist/{translation-warning-modal-kRcfrPgo.js → translation-warning-modal-DA5dt2FA.js} +9 -9
- package/dist/types.d.ts +14 -2
- package/dist/{unmark-as-template-DeeWUTco.js → unmark-as-template-CKVMibvu.js} +13 -13
- package/dist/{unmark-as-template-f1dl_YTz.cjs → unmark-as-template-OEUqo0uc.cjs} +1 -1
- package/dist/unpublish-page-A5qn6E6g.js +28 -0
- package/dist/{unpublish-page-DEPFjGuu.cjs → unpublish-page-C81bYHLI.cjs} +1 -1
- package/dist/{unpublished-partials-modal-Ts5ZhAK9.js → unpublished-partials-modal-FqzTp5el.js} +3 -3
- package/dist/{unpublished-partials-modal-CEFXp1D1.cjs → unpublished-partials-modal-af5uDL7Y.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/dist/{web-preview-CoT8r96b.js → web-preview-vge6uUSa.js} +1 -1
- package/dist/{web-preview-DTDoIE-c.cjs → web-preview-xtKkQOXy.cjs} +1 -1
- package/package.json +2 -7
- package/dist/add-new-page-C5HlQfzy.js +0 -31
- package/dist/delete-page-LnzR01A8.js +0 -71
- package/dist/digital-asset-manager-eCJHNSjj.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/image-compression-DZ9WMmyn.cjs +0 -1
- package/dist/index-CAhDwfHE.cjs +0 -5
- package/dist/index-mPCp0j2h.cjs +0 -160
- package/dist/manage-design-tokens-BknGNAKE.cjs +0 -1
- package/dist/manage-design-tokens-Co5677WS.js +0 -428
- package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +0 -1
- package/dist/page-manager-new-5W5M9_ue.cjs +0 -1
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/publish-pages-content-WJHTVYnx.cjs +0 -1
- package/dist/theme-panel-footer-CGZL2F7R.js +0 -26
- package/dist/theme-panel-footer-IgGj-_OA.cjs +0 -1
- package/dist/unpublish-page-U_79Pwc0.js +0 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),a=require("./register-chai-top-bar-DyW9GPzV.cjs"),u=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),a=require("./register-chai-top-bar-DyW9GPzV.cjs"),u=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-BuXfCtgR.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:o,setIframeWidth:r})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>r(s),variant:s===t?"default":"ghost",children:o}),p=()=>{const[t,s]=l.useState(1200),o=i=>s(i),[r,d]=u.useAtom(c.previewUrlAtom);if(!r)return null;const h=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,i=>l.createElement(w,{...i,setIframeWidth:o,key:i.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:h,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor",fillRule:"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:r})]})};exports.default=p;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"author": "Suraj Air",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"homepage": "https://chaibuilder.com",
|
|
8
|
-
"version": "4.0.0-beta.
|
|
8
|
+
"version": "4.0.0-beta.33",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -80,8 +80,7 @@
|
|
|
80
80
|
"drizzle-orm": "^0.45.1",
|
|
81
81
|
"postgres": "^3.4.8",
|
|
82
82
|
"react": "^18.0 || ^19.0 || ^19.1 || ^19.2",
|
|
83
|
-
"react-dom": "^18.0 || ^19.0 || ^19.1 || ^19.2"
|
|
84
|
-
"sharp": "^0.34.5"
|
|
83
|
+
"react-dom": "^18.0 || ^19.0 || ^19.1 || ^19.2"
|
|
85
84
|
},
|
|
86
85
|
"peerDependenciesMeta": {
|
|
87
86
|
"@types/react": {
|
|
@@ -99,9 +98,6 @@
|
|
|
99
98
|
"ai": {
|
|
100
99
|
"optional": true
|
|
101
100
|
},
|
|
102
|
-
"sharp": {
|
|
103
|
-
"optional": true
|
|
104
|
-
},
|
|
105
101
|
"next": {
|
|
106
102
|
"optional": true
|
|
107
103
|
},
|
|
@@ -252,7 +248,6 @@
|
|
|
252
248
|
"react-dom": "19.2.0",
|
|
253
249
|
"react-router-dom": "^7.11.0",
|
|
254
250
|
"shadcn": "2.3.0",
|
|
255
|
-
"sharp": "^0.34.5",
|
|
256
251
|
"tailwindcss": "^3.4.19",
|
|
257
252
|
"ts-jest": "^29.4.6",
|
|
258
253
|
"ts-node": "^10.9.2",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as o, jsxs as r } from "react/jsx-runtime";
|
|
2
|
-
import { D as t, e as c, f as p, g as m, p as h } from "./index-DsQXiNA_.js";
|
|
3
|
-
import { Suspense as f, lazy as D } from "react";
|
|
4
|
-
import { useTranslation as u } from "react-i18next";
|
|
5
|
-
const x = D(() => import("./page-creator-BuHHnqiQ.js")), C = ({
|
|
6
|
-
addEditPage: e,
|
|
7
|
-
setAddEditPage: s,
|
|
8
|
-
closePanel: l
|
|
9
|
-
}) => {
|
|
10
|
-
const { t: n } = u(), a = !!(e != null && e.id), i = !!e;
|
|
11
|
-
return /* @__PURE__ */ o(t, { open: i, onOpenChange: () => s(void 0), children: i && /* @__PURE__ */ r(c, { className: "sm:max-w-[425px]", children: [
|
|
12
|
-
/* @__PURE__ */ r(p, { children: [
|
|
13
|
-
/* @__PURE__ */ r(m, { children: [
|
|
14
|
-
n(a ? "Edit" : "Add New"),
|
|
15
|
-
" "
|
|
16
|
-
] }),
|
|
17
|
-
/* @__PURE__ */ o(h, { children: n(a ? "Update your page name" : "Enter details to create a new page") })
|
|
18
|
-
] }),
|
|
19
|
-
/* @__PURE__ */ o(f, { fallback: /* @__PURE__ */ o("div", { className: "min-h-40" }), children: /* @__PURE__ */ o(
|
|
20
|
-
x,
|
|
21
|
-
{
|
|
22
|
-
closePanel: l,
|
|
23
|
-
addEditPage: e,
|
|
24
|
-
close: () => s(void 0)
|
|
25
|
-
}
|
|
26
|
-
) })
|
|
27
|
-
] }) });
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
C as default
|
|
31
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { jsx as n, jsxs as i } from "react/jsx-runtime";
|
|
2
|
-
import { B as v } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { d as N, o as A, D as E, e as b, f as k, g as U, p as B, r as G } from "./index-DsQXiNA_.js";
|
|
4
|
-
import { c as R, o as W, m as F, g as H, l as M, L as Q } from "./index-DtMksfXx.js";
|
|
5
|
-
import { get as $ } from "lodash-es";
|
|
6
|
-
import { useMemo as w } from "react";
|
|
7
|
-
import { useTranslation as q } from "react-i18next";
|
|
8
|
-
const P = (e, r) => {
|
|
9
|
-
const t = r.filter((c) => c.parent === e);
|
|
10
|
-
if (t.length === 0) return 0;
|
|
11
|
-
let d = t.length;
|
|
12
|
-
return t.forEach((c) => {
|
|
13
|
-
d += P(c.id, r);
|
|
14
|
-
}), d;
|
|
15
|
-
};
|
|
16
|
-
function Y({ page: e, onClose: r }) {
|
|
17
|
-
const { t } = q(), [, d] = R(), { mutate: c, isPending: h } = W(), { data: f } = F(), { data: m = [] } = H(), { setSelectedLang: S, fallbackLang: x } = N(), [, L] = A(), l = !(e != null && e.primaryPage), { data: s = [] } = M(l ? e == null ? void 0 : e.id : void 0), D = w(() => !l || !s ? 0 : s.filter((a) => a.id !== (e == null ? void 0 : e.id)).length, [l, s, e == null ? void 0 : e.id]), u = w(() => {
|
|
18
|
-
if (!(e != null && e.id) || !m.length) return 0;
|
|
19
|
-
let a = P(e.id, m);
|
|
20
|
-
return l && s && s.length > 0 && s.forEach((y) => {
|
|
21
|
-
y.id !== e.id && (a += P(y.id, m));
|
|
22
|
-
}), a;
|
|
23
|
-
}, [e == null ? void 0 : e.id, m, l, s]), C = () => {
|
|
24
|
-
h || c(e, {
|
|
25
|
-
onSuccess: () => {
|
|
26
|
-
e != null && e.primaryPage ? (window.history.replaceState({}, "", `/?page=${e.primaryPage}`), d(new URLSearchParams({ page: e.primaryPage }))) : (window.history.replaceState({}, "", "/"), d(new URLSearchParams())), window.dispatchEvent(new PopStateEvent("popstate")), S(x), L("outline"), r();
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}, o = f == null ? void 0 : f.find((a) => a.key === (e == null ? void 0 : e.pageType));
|
|
30
|
-
return /* @__PURE__ */ n(E, { open: !!e, onOpenChange: r, children: /* @__PURE__ */ i(b, { children: [
|
|
31
|
-
/* @__PURE__ */ i(k, { children: [
|
|
32
|
-
/* @__PURE__ */ n(U, { children: t("Confirm Deletion") }),
|
|
33
|
-
/* @__PURE__ */ i(B, { className: "py-4 text-slate-500", children: [
|
|
34
|
-
/* @__PURE__ */ i("div", { children: [
|
|
35
|
-
t("Are you sure you want to remove"),
|
|
36
|
-
" ",
|
|
37
|
-
/* @__PURE__ */ n("b", { children: (e == null ? void 0 : e.name) ?? (e == null ? void 0 : e.slug) }),
|
|
38
|
-
" ",
|
|
39
|
-
o != null && o.hasSlug ? (o == null ? void 0 : o.name) + "?" : t("page?")
|
|
40
|
-
] }),
|
|
41
|
-
l && (D > 0 || u > 0) && /* @__PURE__ */ i("div", { className: "mt-3 rounded-md bg-red-50 p-3 text-sm", children: [
|
|
42
|
-
/* @__PURE__ */ i("div", { className: "font-semibold text-red-800", children: [
|
|
43
|
-
t("Warning: Deleting this primary page will also delete"),
|
|
44
|
-
":"
|
|
45
|
-
] }),
|
|
46
|
-
/* @__PURE__ */ i("ul", { className: "mt-2 list-inside list-disc space-y-1 text-red-700", children: [
|
|
47
|
-
u > 0 && /* @__PURE__ */ i("li", { children: [
|
|
48
|
-
/* @__PURE__ */ n("span", { className: "font-medium", children: u }),
|
|
49
|
-
" ",
|
|
50
|
-
t(u === 1 ? "nested child page" : "nested child pages")
|
|
51
|
-
] }),
|
|
52
|
-
D > 0 && /* @__PURE__ */ n("li", { children: t("All associated language pages") })
|
|
53
|
-
] })
|
|
54
|
-
] }),
|
|
55
|
-
e.lang && /* @__PURE__ */ i("div", { className: "py-2 text-sm", children: [
|
|
56
|
-
t("Language"),
|
|
57
|
-
":",
|
|
58
|
-
" ",
|
|
59
|
-
/* @__PURE__ */ n("span", { className: "font-medium text-gray-500", children: $(Q, e.lang, e.lang) })
|
|
60
|
-
] })
|
|
61
|
-
] })
|
|
62
|
-
] }),
|
|
63
|
-
/* @__PURE__ */ i(G, { children: [
|
|
64
|
-
/* @__PURE__ */ n(v, { variant: "outline", onClick: r, children: t("Cancel") }),
|
|
65
|
-
/* @__PURE__ */ n(v, { variant: "destructive", disabled: h, onClick: C, children: t(h ? "Deleting..." : "Delete") })
|
|
66
|
-
] })
|
|
67
|
-
] }) });
|
|
68
|
-
}
|
|
69
|
-
export {
|
|
70
|
-
Y as default
|
|
71
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("./register-chai-top-bar-DyW9GPzV.cjs"),d=require("./index-mPCp0j2h.cjs"),ee=require("./image-compression-DZ9WMmyn.cjs"),B=require("lodash-es"),f=require("lucide-react"),u=require("react"),ge=require("react-dropzone"),je=require("react-error-boundary"),R=require("react-i18next"),C=require("sonner"),D=require("@tanstack/react-query"),j=require("./index-CAhDwfHE.cjs"),te=require("./common-functions-B3a4xKt_.cjs"),ve=()=>{const r=j.useApiUrl(),a=D.useQueryClient(),x=j.useFetch();return D.useMutation({mutationFn:async i=>{const n=i.map(async l=>x(r,{action:j.ACTIONS.UPLOAD_ASSET,data:l}));return await Promise.all(n)},onSuccess:i=>{var n;if(i!=null&&i.some(s=>s.error))throw new Error(((n=i==null?void 0:i.find(s=>s.error))==null?void 0:n.error)||"Failed to upload asset");{a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSETS]});const s=i==null?void 0:i.length;C.toast.success(`${s===1?"Asset":s+" Assets"} uploaded successfully`)}},onError:()=>{C.toast.error("Failed to upload asset")}})},ye=()=>{const r=j.useApiUrl(),a=D.useQueryClient(),x=j.useFetch();return D.useMutation({mutationFn:async i=>x(r,{action:j.ACTIONS.DELETE_ASSET,data:{id:i}}),onSuccess:i=>{if(i!=null&&i.error)throw new Error(i==null?void 0:i.error);a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSETS]}),C.toast.success("Asset deleted successfully")},onError:()=>{C.toast.error("Failed to delete asset")}})},Ne=()=>{const r=j.useApiUrl(),a=D.useQueryClient(),x=j.useFetch();return D.useMutation({mutationFn:async i=>x(r,{action:j.ACTIONS.UPDATE_ASSET,data:i}),onSuccess:i=>{if(i!=null&&i.error)throw new Error(i==null?void 0:i.error);a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSETS]}),i!=null&&i.id&&a.invalidateQueries({queryKey:[j.ACTIONS.GET_ASSET,i.id]}),C.toast.success("Asset updated successfully")},onError:()=>{C.toast.error("Failed to update asset")}})};function be({currentPage:r,totalPages:a,onPageChange:x,pageRangeDisplayed:i=3,showPageInput:n=!0,className:s=""}){const[l,I]=u.useState(String(r)),b=u.useMemo(()=>{const o=Math.floor(i/2);let m=Math.max(1,r-o),c=Math.min(a,r+o);c-m+1<i&&(m===1?c=Math.min(a,m+i-1):c===a&&(m=Math.max(1,c-i+1)));const p=[];m>1&&(p.push(1),m>2&&p.push("..."));for(let N=m;N<=c;N++)p.push(N);return c<a&&(c<a-1&&p.push("..."),p.push(a)),p},[r,a,i]),y=o=>{o!==r&&o>=1&&o<=a&&(x(o),I(String(o)))},v=()=>{r>1&&y(r-1)},w=()=>{r<a&&y(r+1)},A=()=>{const o=Number(l);!isNaN(o)&&o>=1&&o<=a&&y(o)},S=o=>{o.key==="Enter"&&A()};return a<=1?null:e.jsxs("div",{className:`flex flex-wrap items-center justify-center gap-3 ${s}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(g.Button,{variant:"outline",size:"sm",onClick:v,disabled:r===1,className:"px-2 py-1 text-sm hover:bg-gray-50",children:[e.jsx(f.ChevronLeft,{className:"h-4 w-4"}),"Previous"]}),e.jsx("div",{className:"flex items-center gap-2",children:b.map((o,m)=>{if(o==="...")return e.jsx("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${m}`);const c=o,p=c===r;return e.jsx(g.Button,{variant:p?"default":"outline",size:"sm",onClick:()=>y(c),className:p?"border-blue-600 bg-blue-600 px-3 py-1 text-sm text-white":"border px-3 py-1 text-sm hover:bg-gray-50 hover:text-black",children:c},c)})}),e.jsxs(g.Button,{variant:"outline",size:"sm",onClick:w,disabled:r===a,className:"px-2 py-1 text-sm hover:bg-gray-50",children:["Next",e.jsx(f.ChevronRight,{className:"h-4 w-4"})]})]}),n&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Go to"}),e.jsx(g.Input,{type:"number",min:1,max:a,value:l,onChange:o=>{const m=o.target.value.replace(/[^\d]/g,"");I(m)},onKeyDown:S,className:"h-8 w-16 px-2 py-1"}),e.jsx(g.Button,{variant:"outline",size:"sm",onClick:A,disabled:l===""||Number(l)<1||Number(l)>a,children:"Go"})]})]})}const we=(r={})=>{const a=j.useApiUrl(),x=j.useFetch(),{search:i,page:n=1,limit:s=30}=r;return D.useQuery({queryKey:[j.ACTIONS.GET_ASSETS,i,n,s],queryFn:async()=>{const l=await x(a,{action:j.ACTIONS.GET_ASSETS,data:{search:i,page:n,limit:s}});return l.page=n,l.limit=s,l},staleTime:1/0,retry:1})},Ce=r=>{const a=j.useApiUrl(),x=j.useFetch();return D.useQuery({queryKey:[j.ACTIONS.GET_ASSET,r],queryFn:async()=>r?await x(a,{action:j.ACTIONS.GET_ASSET,data:{id:r}}):null,staleTime:1/0,retry:1})};function Ae(r){const a=isNaN(r)?0:typeof r=="number"?r:parseInt(r);return a?a<1024?`${a.toFixed(2)} B`:a<1024*1024?`${(a/1024).toFixed(2)} KB`:`${(a/(1024*1024)).toFixed(2)} MB`:"0 B"}function J(r){if(!r)return"N/A";const a=new Date(r);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(a)}function Y(r,a){let x=r,i=a==null?void 0:a.description;return(!i||typeof i!="string")&&(i=""),(!x||typeof x!="string")&&(x=""),x!==i}const Se=({assetId:r,onBack:a,onEdit:x,onSave:i,isSaving:n})=>{var o,m;const{t:s}=R.useTranslation(),{data:l,isLoading:I,isError:b}=Ce(r||""),[y,v]=u.useState(""),[w,A]=u.useState(!1);u.useEffect(()=>{const c=new Image;return c.src=(l==null?void 0:l.url)||"",c.onload=()=>A(!0),()=>{c.onload=null}},[l]);const S=async(c,p)=>{try{await navigator.clipboard.writeText(c),C.toast.success(s("{{type}} copied to clipboard",{type:p}))}catch(N){C.toast.error(s("Failed to copy {{type}}",{type:p}),{description:N==null?void 0:N.message})}};return u.useEffect(()=>{l!=null&&l.description&&v(l.description)},[l]),I||!w?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsx(f.Loader,{className:"h-8 w-8 animate-spin"})}):b||!(l!=null&&l.id)?e.jsx("div",{className:"flex flex-1 items-center justify-center",children:e.jsxs("div",{className:"mx-auto max-w-md p-6 text-center",children:[e.jsx("div",{className:"mb-4 flex justify-center",children:e.jsx(f.AlertCircle,{className:"h-12 w-12 text-gray-400"})}),e.jsx("h3",{className:"mb-2 text-lg font-medium text-gray-900",children:s("No Asset Found")}),e.jsx("p",{className:"mb-6 text-sm text-gray-500",children:s(b?"There was an error loading the asset. Please try again later.":"The asset you're looking for doesn't exist or has been removed.")}),e.jsxs("div",{className:"flex justify-center gap-4",children:[e.jsx(g.Button,{variant:"outline",onClick:a,children:s("Back to Assets")}),b&&e.jsx(g.Button,{variant:"default",onClick:()=>window.location.reload(),children:s("Try Again")})]})]})}):e.jsxs("div",{className:"flex flex-1 flex-col gap-y-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(g.Button,{variant:"outline",size:"sm",onClick:a,disabled:n,children:[e.jsx(f.ChevronLeft,{className:"h-4 w-4"}),s("Back to Assets")]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g.Button,{variant:"outline",onClick:a,disabled:n,children:s("Cancel")}),e.jsxs(g.Button,{variant:"outline",onClick:()=>S(l.url,s("Asset URL")),disabled:n,children:[e.jsx(f.Copy,{className:"mr-2 h-4 w-4"}),s("Copy URL")]}),e.jsxs(g.Button,{variant:"default",onClick:()=>x(l),disabled:n,children:[e.jsx(f.Pencil,{className:"h-4 w-4"}),s("Edit Image")]})]})]}),e.jsxs("div",{className:"grid flex-1 grid-cols-2 items-start gap-6 overflow-hidden",children:[e.jsx("div",{className:"relative flex h-[calc(80vh-200px)] w-full items-start justify-center",children:e.jsx("img",{src:l.url,alt:l.name,className:"h-full max-h-max w-full max-w-max rounded-lg object-contain"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid gap-3 rounded-md border bg-gray-100 pt-2",children:[e.jsx(d.Label,{className:"w-full text-center",children:s("Details")}),e.jsx("div",{className:"grid grid-cols-1 gap-2 rounded-md border bg-white p-2 text-sm",children:[{label:s("File Name"),value:l.name},{label:s("Type"),value:l.type,capitalize:!0},{label:s("Format"),value:((o=l.metadata)==null?void 0:o.format)||l.type,capitalize:!0},{label:s("Size"),value:Ae(l.size)},{label:s("Dimensions"),value:`${l.width||0} × ${l.height||0}`},{label:s("Created"),value:J(l.createdAt)},{label:s("Updated"),value:J(((m=l.metadata)==null?void 0:m.updatedAt)||(l==null?void 0:l.updatedAt)||l.createdAt)},{label:s("URL"),value:l.url,copyable:!0}].map(c=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d.Label,{className:"w-1/4 w-max px-2 text-left font-normal text-gray-700",children:c.label}),":",e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-max text-left font-medium text-gray-900"+(c.capitalize?" capitalize":""),children:c.value}),c.copyable&&e.jsx(g.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>S(c.value,c.label),children:e.jsx(f.Link,{className:"h-3 w-3"})})]})]},c.label))})]}),l.usedOn&&l.usedOn.length>0&&e.jsxs("div",{className:"grid gap-3",children:[e.jsx(d.Label,{children:s("Used On")}),e.jsx("div",{className:"grid grid-cols-1 gap-2 rounded-md border p-2 text-sm",children:l.usedOn.map((c,p)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-max text-left font-medium text-gray-900",children:c.name}),e.jsxs("div",{className:"text-gray-500",children:["(",c.slug,")"]})]},p))})]}),e.jsxs("div",{className:"relative grid gap-3 rounded-md border bg-gray-100 pt-2",children:[e.jsx(d.Label,{className:"w-full text-center",children:s("Description")}),e.jsx(d.Textarea,{id:"description",value:y,placeholder:s("Enter a description for the asset"),onChange:c=>v(c.target.value),rows:3,disabled:n,className:"bg-white hover:border-black/40"}),e.jsx("div",{className:"absolute right-2 top-1.5 flex items-start justify-end",children:e.jsx("button",{type:"button",onClick:()=>i(y),disabled:n||!Y(y,l),className:`rounded-md bg-blue-500 px-3 py-0 py-0.5 text-sm text-white ${n||!Y(y,l)?"cursor-not-allowed opacity-50":""}`,children:n?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"mr-2 h-4 w-4 animate-spin"}),s("Saving...")]}):s("Save")})})]})]})]})]})},Te=u.lazy(()=>Promise.resolve().then(()=>require("./image-editor-BdW476J8.cjs"))),Ee=25*1024*1024,Ie=({isUpdatingAsset:r,allowedTypes:a,uploadAssets:x,isUploadingAsset:i,onUploaded:n})=>{const{t:s}=R.useTranslation(),[l,I]=u.useState(()=>{const o=localStorage.getItem("chai_optimize_images");return o!==null?o==="true":!0});u.useEffect(()=>{localStorage.setItem("chai_optimize_images",l.toString())},[l]);const b=r||i,y=u.useCallback(async o=>{try{const m=o;if(!m.every(T=>T.type.startsWith("image/")))return C.toast.error(s("Invalid file type. Please upload a valid file.")),Promise.reject(new Error("Invalid file type"));const c=m.map(async T=>{let U=T;return T.type.startsWith("image/")&&(U=await ee.compressImageIfNeeded(T)),new Promise((_,q)=>{const L=new FileReader;L.readAsDataURL(U),L.onload=async()=>{_({file:L.result,folderId:void 0,name:T.name,optimize:l})},L.onerror=()=>q(null)})}),p=await Promise.all(c),N=await x(p);return(N==null?void 0:N.length)===1&&n(N[0]),N}catch(m){return Promise.reject(m)}},[x,l,n,s]),v=o=>{const m=[];let c=0;return o.forEach(p=>{p.size>Ee?c++:m.push(p)}),c>0&&C.toast.error(`${c===1&&o.length===1?s("File"):c+s(c===1?" file":" files")} ${s("exceed the maximum size limit of 10MB.")}`),B.isEmpty(m)?[]:y(m)},{getRootProps:w,getInputProps:A,isDragActive:S}=ge.useDropzone({onDrop:v,accept:{"image/*":a.includes("image")?[]:[]},disabled:r||i,multiple:!0});return e.jsx("div",{className:`flex h-[60px] w-full flex-col items-center justify-center rounded-lg border-2 border-dashed border-slate-300 p-0 py-2 hover:border-black/50 ${b?"pointer-events-none bg-gray-100 opacity-90":"bg-gray-100 hover:border-black/50 hover:bg-gray-100"}`,children:e.jsxs("div",{...w(),className:te.cn("flex h-max w-full cursor-pointer flex-col justify-center rounded-lg text-center",b?"items-start":"items-center",S?"border-primary bg-primary/5":"border-muted-foreground/20"),children:[e.jsx("input",{...A()}),b?e.jsx("div",{className:"flex flex-col items-center px-6",children:e.jsxs("div",{className:"flex items-center justify-center gap-2 leading-tight",children:[e.jsx("div",{className:"flex items-center justify-center rounded-full bg-indigo-100 p-2",children:e.jsx(f.Loader,{className:"h-4 w-4 animate-spin text-indigo-500"})}),e.jsxs("div",{className:"text-left",children:[e.jsx("div",{className:"font-medium",children:s(r?"Updating file...":"Uploading file...")}),e.jsxs("div",{className:"text-xs font-light text-muted-foreground",children:[s("Please wait while we")," ",s(r?"update":"upload")," ",s("your file...")]})]})]})}):e.jsxs("div",{className:"flex w-full items-center justify-between px-6",children:[e.jsx("div",{className:"flex flex-col items-center",children:e.jsxs("div",{className:"flex items-center justify-between gap-2 leading-tight",children:[e.jsx("div",{className:"flex items-center justify-center rounded-full border border-indigo-500 bg-indigo-100 p-2",children:e.jsx(f.Upload,{className:"h-4 w-4 text-indigo-500"})}),e.jsxs("div",{className:"text-left",children:[e.jsxs("div",{className:"font-medium",children:[s("Drop your file here or")," ",e.jsx("span",{className:"cursor-pointer text-indigo-500 hover:underline",children:s("browse")})]}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:e.jsxs("span",{className:"",children:[s("Accepted file types:")," ",e.jsx("span",{className:"capitalize text-indigo-400",children:a.join(", ")})]})})]})]})}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs",children:[s("Optimization:")," ",e.jsx("span",{className:l?"text-indigo-600":"text-gray-400",children:s(l?"On":"Off")})]}),e.jsx(d.Switch,{checked:l,onCheckedChange:o=>{I(o)},onClick:o=>{o.stopPropagation()},className:"data-[state=checked]:bg-indigo-500"})]}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx("span",{className:`flex cursor-help items-center text-amber-500 ${l?"invisible":""}`,children:e.jsx(f.AlertTriangle,{className:"mr-1 h-4 w-4"})})}),e.jsx(d.TooltipContent,{side:"top",children:e.jsx("p",{className:"text-xs text-white",children:s("Warning: Unoptimized images may affect performance and page load times")})})]})})]})]})]})})};function ke({close:r,onSelect:a,mode:x="image",assetId:i}){const{t:n}=R.useTranslation(),s=!1,l=10,I=u.useMemo(()=>[x],[x]),[b,y]=u.useState(null),[v,w]=u.useState(null),[A,S]=u.useState(null),[o,m]=u.useState({show:!1,file:""}),[c,p]=u.useState(!1),[N,T]=u.useState(i?"details":"grid"),[U,_]=u.useState(""),[q,L]=u.useState(""),[P,Q]=u.useState(1),[K]=u.useState(30),[E,G]=u.useState([]);u.useEffect(()=>{i&&(y(i),T("details"))},[i]),u.useEffect(()=>{const t=setTimeout(()=>{_(q),Q(1)},300);return()=>clearTimeout(t)},[q]);const{data:O,isLoading:$,refetch:se}=we({search:U.toLowerCase().trim(),page:P,limit:K}),F=(O==null?void 0:O.assets)||[],ie=(O==null?void 0:O.total)||0,k=Math.ceil(ie/K);u.useEffect(()=>{$||k<=0||Q(t=>t>k?k:t<1?1:t)},[$,k]);const le=(F==null?void 0:F.length)>0,{mutate:ae}=ye(),{mutateAsync:W,isPending:re}=ve(),{mutateAsync:V,isPending:ne}=Ne(),H=u.useCallback(t=>{const h=Math.min(Math.max(1,t),Math.max(1,k));h!==P&&Q(h)},[k,P]),oe=t=>{L(t.target.value)},ce=u.useCallback(t=>{G(h=>B.find(h,{id:t.id})?[]:[t])},[s]),de=u.useCallback(()=>{G([])},[]),X=t=>{(t==null?void 0:t.length)!==0&&(a(B.pick(B.first(t||E),["id","url","width","height","description"])),r())},ue=async t=>{w(t)},me=async()=>{v&&(S(v==null?void 0:v.id),await ae(v.id,{onSuccess:()=>{S(null),w(null)},onError:()=>{S(null)}}),w(null))},he=t=>{y(t.id),T("details")},xe=async(t,h)=>{try{const M=localStorage.getItem("chai_optimize_images")!=="false";if(h){const z=await W([{file:t,folderId:void 0,name:o.name||"",optimize:M}]);if((z==null?void 0:z.length)>0){const Z=z[0];a({...B.pick(Z,["id","width","height","description"]),url:Z.url})}}else{const z=await V({id:o.id||"",file:t});z&&a({...B.pick(z,["id","width","height","description"]),url:z.url})}m({show:!1,file:""}),r()}catch(M){console.error(n("Error saving edited image:"),M)}},fe=u.useCallback(t=>{G([t])},[]),pe=u.useCallback(t=>{H(t)},[H]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4",children:[e.jsx("h1",{className:"text-lg font-medium",children:n("Digital Asset Manager")}),N==="grid"?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{maxFileSize:l,allowedTypes:I,uploadAssets:W,isUpdatingAsset:ne,isUploadingAsset:re,onUploaded:fe}),e.jsxs("div",{className:"relative flex flex-1 flex-col gap-y-3 overflow-hidden rounded-lg border p-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"relative w-1/2",children:[e.jsx(f.Search,{strokeWidth:3,className:`absolute left-2 top-2.5 h-4 w-4 text-muted-foreground ${q.length>0?"text-indigo-800":""}`}),e.jsx(g.Input,{placeholder:n("Search assets..."),onChange:oe,value:q,className:"pl-8"})]}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[E.length>0?e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[E.length>0&&e.jsx(e.Fragment,{children:e.jsx(g.Button,{variant:"outline",size:"sm",onClick:()=>de(),title:n("Clear selection"),children:n("Clear")})}),e.jsx(g.Button,{size:"sm",onClick:()=>X(E),disabled:E.length===0,children:n("Select Asset")})]})}):null,e.jsx(g.Button,{variant:"ghost",size:"icon",onClick:()=>se(),children:e.jsx(f.RefreshCwIcon,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto pb-[66px]",children:$?e.jsxs("div",{className:"columns-1 gap-3 space-y-3 sm:columns-3 md:columns-5",children:[e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-64 w-full animate-pulse rounded bg-gray-200"})]}):!$&&!le?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center rounded-lg border",children:[e.jsx("div",{className:"text-muted-foreground",children:e.jsx(f.Archive,{className:"h-9 w-9 text-indigo-500"})}),e.jsx("div",{className:"text-lg text-muted-foreground",children:n("No assets found")}),e.jsx("div",{className:"text-sm text-muted-foreground",children:U.length>0?n("No assets found for your search: {{query}}",{query:U}):n("Start uploading assets to get started")}),e.jsx("br",{})]}):e.jsx("div",{className:"flex flex-wrap gap-3 p-1",children:F==null?void 0:F.map(t=>e.jsxs("div",{className:te.cn("group relative flex max-h-[180px] max-w-[180px] cursor-pointer flex-col justify-between overflow-hidden rounded-lg border-2 transition-all",E.some(h=>h.id===t.id)?"border-blue-500":"hover:border-black/90",A&&(v==null?void 0:v.id)===t.id?"pointer-events-none opacity-50":"",A===t.id?"pointer-events-none opacity-50":""),onClick:()=>ce(t),onDoubleClick:()=>X([t]),children:[e.jsxs("div",{className:"aspect-square relative overflow-hidden",children:[A===t.id?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx(f.Loader,{className:"h-8 w-8 animate-spin text-white"})}):null,t.type==="image"?e.jsx("img",{src:`${t.thumbnailUrl||"/placeholder.svg"}?v=${(t==null?void 0:t.updatedAt)||t.createdAt}`,alt:t.name,className:`h-full min-h-[80px] w-full object-contain ${E.some(h=>h.id===t.id)?"":"group-hover:blur group-hover:contrast-50"}`}):e.jsxs("div",{className:"flex h-full items-center justify-center",children:[e.jsx(f.Film,{className:"h-12 w-12 text-muted-foreground"}),t.thumbnailUrl&&e.jsx("img",{src:`${t.thumbnailUrl||"/placeholder.svg"}?v=${(t==null?void 0:t.updatedAt)||t.createdAt}`,alt:t.name,className:"absolute inset-0 h-full w-full object-cover"})]})]}),e.jsxs("div",{className:"flex items-end justify-between border-t-[1px] border-black/10 bg-white px-2 py-1",children:[e.jsx("div",{className:"truncate text-xs leading-tight",title:t.name,children:t.name}),e.jsx("div",{className:"flex items-center justify-between whitespace-nowrap text-[9px] font-light text-muted-foreground",children:e.jsx("span",{children:ee.formatFileSize((t==null?void 0:t.size)||0)})})]}),!E.some(h=>h.id===t.id)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-hover:opacity-100",children:e.jsxs("div",{className:"grid grid-cols-4 gap-2 p-2",children:[e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),he(t)},children:e.jsx(f.ImageIcon,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("View Details")})})]})}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),navigator.clipboard.writeText(t.url),C.toast.success(n("Asset URL copied to clipboard"))},children:e.jsx(f.Copy,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("Copy URL")})})]})}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"secondary",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),m({id:t.id,show:!0,file:t.url,name:t.name})},children:e.jsx(f.Edit,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("Edit Image")})})]})}),e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(g.Button,{variant:"destructive",size:"icon",className:"h-8 w-8 rounded-full",onClick:h=>{h.stopPropagation(),ue(t)},children:e.jsx(f.Trash2,{className:"h-4 w-4"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:n("Delete Asset")})})]})})]})}),E.some(h=>h.id===t.id)&&e.jsx("div",{className:"absolute right-1 top-1 h-max rounded-full border border-white bg-blue-500 p-1",children:e.jsx(f.Check,{className:"h-3 w-3 text-white",strokeWidth:5})})]},t.id))})}),k>1&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t bg-white p-4",children:e.jsx(je.ErrorBoundary,{fallback:e.jsx("div",{className:"text-red-500",children:n("Error loading pagination")}),children:e.jsx(be,{currentPage:P,totalPages:k,onPageChange:pe,pageRangeDisplayed:3,showPageInput:!0})})})]})]}):e.jsx(Se,{assetId:b||i||"",onBack:()=>{T("grid"),y(null)},onEdit:t=>{m({id:t.id,show:!0,file:t.url,name:t.name})},onSave:async t=>{if(b){p(!0);try{const h=F.find(M=>M.id===b);h&&await V(B.merge(h,{description:t}))}finally{p(!1)}}},isSaving:c})]}),o.show&&e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx(f.Loader,{className:"h-8 w-8 animate-spin"})}),children:e.jsx(Te,{imageUrl:o.file,onSave:xe,onClose:()=>m({show:!1,file:""}),defaultSavedImageName:o.name,isEditing:!!o.id})}),v&&e.jsx(d.Dialog,{open:!!v,onOpenChange:()=>w(null),children:e.jsxs(d.DialogContent,{children:[e.jsxs(d.DialogHeader,{children:[e.jsx(d.DialogTitle,{children:n("Delete Asset")}),e.jsx(d.DialogDescription,{children:n('Are you sure you want to delete "{{name}}"? This action cannot be undone.',{name:v.name})})]}),e.jsxs(d.DialogFooter,{className:"gap-2 sm:gap-0",children:[e.jsx(g.Button,{variant:"outline",onClick:()=>w(null),children:n("Cancel")}),e.jsx(g.Button,{variant:"destructive",onClick:me,children:n("Delete")})]})]})})]})}exports.default=ke;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("./plugin-DHpuZZXz.cjs"),e=o.plugin(function({addBase:n,theme:i}){n({"h1,h2,h3,h4,h5,h6":{fontFamily:i("fontFamily.heading")},body:{fontFamily:i("fontFamily.body"),color:i("colors.foreground"),backgroundColor:i("colors.background")}})}),r=(n=o.defaultThemeOptions)=>({container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...o.getChaiThemeOptions(n)});exports.chaiBuilderPlugin=e;exports.getChaiBuilderTheme=r;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("compressorjs"),m=require("sonner"),t=3*1024*1024,c=10*1024*1024;function s(e){const r=isNaN(e)?0:typeof e=="number"?e:parseInt(e);return r?r<1024?`${r.toFixed(2)} B`:r<1024*1024?`${(r/1024).toFixed(2)} KB`:`${(r/(1024*1024)).toFixed(2)} MB`:"0 B"}function a(e){return new Promise((r,o)=>{if(e.size<=t){r(e);return}new n(e,{quality:.8,maxWidth:2048,maxHeight:2048,convertSize:t,success(i){r(i)},error(i){m.toast.error(`Failed to compress image. Image size is ${s(e.size)}, which exceeds the maximum allowed size of ${s(c)}.`),o(i)}})})}exports.compressImageIfNeeded=a;exports.formatFileSize=s;
|
package/dist/index-CAhDwfHE.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";var dr=Object.create;var sn=Object.defineProperty;var fr=Object.getOwnPropertyDescriptor;var hr=Object.getOwnPropertyNames;var gr=Object.getPrototypeOf,mr=Object.prototype.hasOwnProperty;var On=e=>{throw TypeError(e)};var Er=(e,t,n)=>t in e?sn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pr=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of hr(t))!mr.call(e,r)&&r!==n&&sn(e,r,{get:()=>t[r],enumerable:!(s=fr(t,r))||s.enumerable});return e};var yr=(e,t,n)=>(n=e!=null?dr(gr(e)):{},pr(t||!e||!e.__esModule?sn(n,"default",{value:e,enumerable:!0}):n,e));var rn=(e,t,n)=>Er(e,typeof t!="symbol"?t+"":t,n),Rn=(e,t,n)=>t.has(e)||On("Cannot "+n);var x=(e,t,n)=>(Rn(e,t,"read from private field"),n?n.call(e):t.get(e)),D=(e,t,n)=>t.has(e)?On("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),O=(e,t,n,s)=>(Rn(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n);const i=require("react/jsx-runtime"),g=require("./index-mPCp0j2h.cjs"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),Q=require("jotai"),p=require("lodash-es"),h=require("react"),T=require("@tanstack/react-query"),w=require("lucide-react"),pe=require("react-i18next"),Ar=require("./plugin-DHpuZZXz.cjs"),Dt=require("./common-functions-B3a4xKt_.cjs"),F=require("sonner"),Sr=require("./core-BWQrViOY.cjs"),Tr=require("./apply-binding-9XSrYzAE.cjs"),Pr=require("./web-blocks.cjs"),xr=require("react-error-boundary");function _r(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const $=_r(h),ot=Q.atom(null),y={GET_GLOBAL_JSONLD_ITEMS:"GET_GLOBAL_JSONLD_ITEMS",GENERATE_SEO_FIELD:"GENERATE_SEO_FIELD",UPDATE_PAGE_METADATA:"UPDATE_PAGE_METADATA",GET_BLOCK_ASYNC_PROPS:"GET_BLOCK_ASYNC_PROPS",ASK_AI:"ASK_AI",GET_DRAFT_PAGE:"GET_DRAFT_PAGE",CREATE_PAGE:"CREATE_PAGE",UPDATE_PAGE:"UPDATE_PAGE",DELETE_PAGE:"DELETE_PAGE",DUPLICATE_PAGE:"DUPLICATE_PAGE",CHANGE_SLUG:"CHANGE_SLUG",TAKE_OFFLINE:"TAKE_OFFLINE",PUBLISH_PAGE:"PUBLISH_PAGE",PUBLISH_CHANGES:"PUBLISH_CHANGES",ADD_NEW_LANGUAGE:"ADD_NEW_LANGUAGE",EDIT_LANGUAGE:"EDIT_LANGUAGE",DELETE_LANGUAGE:"DELETE_LANGUAGE",GET_CHANGES:"GET_CHANGES",GET_SERVER_BLOCK:"GET_SERVER_BLOCK",GET_LANGUAGE_PAGES:"GET_LANGUAGE_PAGES",GET_PROJECT_PAGES:"GET_PROJECT_PAGES",GET_WEBSITE_PAGES:"GET_WEBSITE_PAGES",UPDATE_WEBSITE_FIELDS:"UPDATE_WEBSITE_FIELDS",GET_COLLECTIONS:"GET_COLLECTIONS",GET_PAGE_TYPES:"GET_PAGE_TYPES",SEARCH_PAGES:"SEARCH_PAGES",GET_WEBSITE_DRAFT_SETTINGS:"GET_WEBSITE_DRAFT_SETTINGS",AI_CONTEXT:"AI_CONTEXT",GET_WEBSITE_DATA:"GET_WEBSITE_DATA",GET_CHAI_USER:"GET_CHAI_USER",CHANGE_PASSWORD:"CHANGE_PASSWORD",GET_SEO_FIELDS:"GET_SEO_FIELDS",GET_BUILDER_PAGE_DATA:"GET_BUILDER_PAGE_DATA",GET_PAGE_REVISIONS:"GET_PAGE_REVISIONS",DELETE_PAGE_REVISION:"DELETE_PAGE_REVISION",RESTORE_PAGE_REVISION:"RESTORE_PAGE_REVISION",GET_REVISION_DATA:"GET_REVISION_DATA",GET_PAGE_DATA:"GET_PAGE_DATA",GET_COMPARE_DATA:"GET_COMPARE_DATA",GET_ROLE_AND_PERMISSIONS:"GET_ROLE_AND_PERMISSIONS",UPSERT_LIBRARY_ITEM:"UPSERT_LIBRARY_ITEM",GET_LIBRARIES:"GET_LIBRARIES",GET_LIBRARY_ITEM:"GET_LIBRARY_ITEM",GET_LIBRARY_ITEMS:"GET_LIBRARY_ITEMS",DELETE_LIBRARY_ITEM:"DELETE_LIBRARY_ITEM",MARK_AS_TEMPLATE:"MARK_AS_TEMPLATE",UNMARK_AS_TEMPLATE:"UNMARK_AS_TEMPLATE",GET_TEMPLATES_BY_TYPE:"GET_TEMPLATES_BY_TYPE",GET_DYNAMIC_PAGES:"GET_DYNAMIC_PAGES",GET_APP_SHARED_JSONLD:"GET_APP_SHARED_JSONLD",UPDATE_APP_SHARED_JSONLD:"UPDATE_APP_SHARED_JSONLD",ADD_GLOBAL_SCHEMA:"ADD_GLOBAL_SCHEMA",UPDATE_GLOBAL_SCHEMA:"UPDATE_GLOBAL_SCHEMA",DELETE_GLOBAL_SCHEMA:"DELETE_GLOBAL_SCHEMA",TOGGLE_PAGE_GLOBAL_SCHEMA:"TOGGLE_PAGE_GLOBAL_SCHEMA",APPLY_SCHEMA_TO_ALL_PAGES:"APPLY_SCHEMA_TO_ALL_PAGES",REMOVE_SCHEMA_FROM_ALL_PAGES:"REMOVE_SCHEMA_FROM_ALL_PAGES",UPLOAD_ASSET:"UPLOAD_ASSET",DELETE_ASSET:"DELETE_ASSET",UPDATE_ASSET:"UPDATE_ASSET",GET_ASSETS:"GET_ASSETS",GET_ASSET:"GET_ASSET"},wr=Q.atom({}),wt=()=>Q.useAtom(wr),se=(e,t)=>{const[n]=wt();return h.useMemo(()=>p.get(n,e,t),[n,e,t])},L=()=>se("apiUrl","/chai/api"),Tn=()=>se("realtimeAdapter",null),Jn=async(e,t,n={})=>await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(t)}),br=()=>{const e=k(),t=L();return h.useCallback(async({body:n,headers:s={},url:r=t,streamResponse:a=!1})=>e(r,n,s,a),[e])},k=()=>{const e=se("onLogout",p.noop),t=se("getAccessToken"),n=L();return h.useCallback(async(s=n,r,a={},o=!1)=>{const l=await t();try{const c=p.get(r,"action","").toLowerCase(),u=await Jn(s+(c?`?action=${c}`:""),r,{...a,Authorization:`Bearer ${l}`});if(o)return u;if(u.status===401)return console.log("401 Response",u),await e("SESSION_EXPIRED"),null;if(!u.ok){const d=await u.json();throw console.error(`API Error (${u.status}):`,d),{status:u.status,statusText:u.statusText,...d,message:d.error||d.message||`Server error: ${u.status}`}}return await u.json()}catch(c){throw console.error("API request failed:",r,c),c}},[e,t])};function he(){const[e,t]=h.useState(new URLSearchParams(window.location.search));return h.useEffect(()=>{const n=()=>{t(new URLSearchParams(window.location.search))};return window.addEventListener("popstate",n),()=>{window.removeEventListener("popstate",n)}},[]),[e,t]}const we=e=>{const t=L(),[n]=he(),s=e??n.get("page"),r=k();return T.useQuery({queryKey:[y.GET_LANGUAGE_PAGES,s],staleTime:1/0,gcTime:0,placeholderData:[],queryFn:async()=>{if(!s)return null;const a=await r(t,{action:y.GET_LANGUAGE_PAGES,data:{id:s}});return p.reverse(p.sortBy(a,"primaryPage"))},enabled:!!s})},vr=Q.atom(null),Zn=()=>Q.useAtom(vr),Pn=()=>{const[e]=Zn();return(e==null?void 0:e.slug)||""};function Cr(e,t){const[n,s]=h.useState(e);return h.useEffect(()=>{const r=setTimeout(()=>s(e),t);return()=>clearTimeout(r)},[e,t]),n}const Ir=({query:e,uuid:t})=>{const{selectedLang:n,fallbackLang:s}=g.useLanguages(),{data:r}=re(),a=r==null?void 0:r.pageType,o=L(),l=k(),{data:c,isFetching:u}=T.useQuery({queryKey:[y.GET_DYNAMIC_PAGES,e,a,t],staleTime:3600*1e3,placeholderData:[],queryFn:async()=>await l(o,{action:y.GET_DYNAMIC_PAGES,data:{query:e,pageType:a,uuid:t}})||[],enabled:!!a}),d=h.useMemo(()=>n===""?c.filter(f=>f.lang===""||f.lang===s):c.filter(f=>f.lang===n),[n,s,c]);return{allLangPages:c,data:d,isFetching:u}},Xn=()=>{const{selectedLang:e,fallbackLang:t}=g.useLanguages(),[n,s]=Zn(),[r,a]=h.useState(""),o=Cr(r,500),{allLangPages:l,data:c,isFetching:u}=Ir({query:o}),d=h.useCallback(m=>s(m),[s]),f=h.useCallback(m=>a(m),[a]),E=h.useCallback(()=>{if(!n)return;const m=!(n!=null&&n.primaryPage),S=e.length===0,v=m?n==null?void 0:n.id:n==null?void 0:n.primaryPage,b=l.filter(A=>(A==null?void 0:A.primaryPage)===v||A.id===v).find(A=>S?A.lang===e||A.lang===t:A.lang===e);s(b||n)},[n,e,l,s,t]);return{isFetching:u,dynamicPage:n,searchQuery:r,selectedLang:e,dynamicPages:c,allLangPages:l,updateDynamicPage:d,updateSearchQuery:f,onChangeLanguage:E}},Nr=Q.atom({lastSaved:void 0}),xn=()=>Q.useAtom(Nr),re=()=>{const[e]=he(),t=e.get("page"),{data:n,isFetching:s}=we();return{data:h.useMemo(()=>({...p.find(n,{id:t})||{}}),[n,t]),isFetching:s}},ye=()=>{const[e]=he(),t=e.get("lang")??"",{data:n,isFetching:s}=we();return{data:h.useMemo(()=>p.find(n,{lang:t})||{},[n,t]),isFetching:s}},Lr=Q.atom({}),jr=()=>Q.useAtom(Lr),kr=()=>{const{data:e}=ye(),t=Pn(),n=se("getLiveUrl",p.noop),s=e==null?void 0:e.slug,r=n(s||"/");return t?r+t:r},ie={...g.PERMISSIONS,ADD_PAGE:"add_page",EDIT_PAGE:"edit_page",DELETE_PAGE:"delete_page",CHANGE_PAGE_TYPE:"change_page_type",PUBLISH_PAGE:"publish_page",UNPUBLISH_PAGE:"unpublish_page",MARK_AS_TEMPLATE:"mark_as_template",EDIT_SEO:"edit_seo",RESTORE_REVISION:"restore_revision",DELETE_REVISION:"delete_revision",DELETE_LIBRARY_BLOCK:"delete_library_block"},Ae=()=>{const e=L(),t=k();return T.useQuery({queryKey:[y.GET_PAGE_TYPES],staleTime:1/0,placeholderData:[],queryFn:async()=>t(e,{action:y.GET_PAGE_TYPES})})},es=e=>{const{data:t}=Ae();return h.useMemo(()=>t==null?void 0:t.find(n=>n.key===e),[t,e])},Gr=()=>{const e=L(),t=k();return T.useMutation({mutationFn:async({pageType:n,query:s})=>{try{return t(e,{action:y.SEARCH_PAGES,data:{pageType:n,query:Array.isArray(s)&&s.length>0?s[0]:s}})||[]}catch(r){return console.error(r),[]}}})},ts=({page:e,setDuplicatePage:t,setAddEditPage:n,setUnpublishPage:s,setDeletePage:r,setMarkAsTemplate:a,setUnmarkAsTemplate:o,children:l,isLanguagePage:c})=>{const{t:u}=pe.useTranslation(),{hasPermission:d}=g.usePermissions(),{data:f}=Ae(),E=h.useMemo(()=>p.find(f,{key:e.pageType}),[f,e.pageType]),m=h.useMemo(()=>!!e.isTemplate,[e.isTemplate]),S=h.useMemo(()=>!!(E!=null&&E.hasSlug),[E==null?void 0:E.hasSlug]);return!d(ie.EDIT_PAGE)&&!d(ie.DELETE_PAGE)&&!d(ie.UNPUBLISH_PAGE)||!e?null:i.jsxs(g.DropdownMenu,{children:[i.jsx(g.DropdownMenuTrigger,{asChild:!0,onClick:_=>_.stopPropagation(),children:l}),i.jsxs(g.DropdownMenuContent,{align:"center",className:"text-sm",children:[d(ie.ADD_PAGE)&&!c&&i.jsxs(g.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:_=>{_.stopPropagation(),t(e)},children:[i.jsx(w.CopyPlusIcon,{className:"size-3"}),"Duplicate page"]}),d(ie.EDIT_PAGE)&&i.jsxs(g.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:_=>{_.stopPropagation(),n({...e,global:!(E!=null&&E.hasSlug)})},children:[i.jsx(w.Pencil,{className:"size-3"}),"Edit"]}),(e==null?void 0:e.online)&&d(ie.UNPUBLISH_PAGE)&&i.jsxs(g.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:_=>{_.stopPropagation(),s(e)},children:[i.jsx(w.Power,{className:"size-3"}),u("Unpublish")]}),d(ie.DELETE_PAGE)&&i.jsxs(g.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:_=>{_.stopPropagation(),r(e)},children:[i.jsx(w.Trash,{className:"size-3"}),u("Delete")]}),d(ie.MARK_AS_TEMPLATE)&&S&&!c&&i.jsx(i.Fragment,{children:m?i.jsxs(g.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:_=>{_.stopPropagation(),o(e)},children:[i.jsx(w.SquareLibrary,{className:"size-3"}),u("Unmark as template")]}):i.jsxs(g.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:_=>{_.stopPropagation(),a(e)},children:[i.jsx(w.SquareLibrary,{className:"size-3"}),u("Mark as template")]})})]})]})},be=()=>{const e=L(),t=k();return T.useQuery({queryKey:[y.GET_WEBSITE_DRAFT_SETTINGS],staleTime:300*1e3,placeholderData:{languages:[],theme:Ar.defaultThemeValues,appKey:"",fallbackLang:"",settings:{},designTokens:{}},queryFn:async()=>t(e,{action:y.GET_WEBSITE_DRAFT_SETTINGS,data:{draft:!0}})})},Qt=()=>{const e=se("currentUser"),t=se("onLogout");return{isLoggedIn:!!e,user:e,logout:t}},Z={LOCKED:"LOCKED",EDITING:"EDITING",CHECKING:"CHECKING",TAKE_OVER_REQUESTED:"TAKE_OVER_REQUESTED",ACTIVE_IN_ANOTHER_TAB:"ACTIVE_IN_ANOTHER_TAB",FORCE_TAKE_OVER:"FORCE_TAKE_OVER",CONNECTION_LOST:"CONNECTION_LOST"},ee={FORCE_TAKE_OVER:"FORCE_TAKE_OVER",TAKE_OVER_REQUEST:"TAKE_OVER_REQUEST",TAKE_OVER_APPROVED:"TAKE_OVER_APPROVED",TAKE_OVER_REJECTED:"TAKE_OVER_REJECTED",FORCE_TAKE_OVER_REQUEST:"FORCE_TAKE_OVER_REQUEST",CONTINUE_EDITING_IN_THIS_CLIENT:"CONTINUE_EDITING_IN_THIS_CLIENT",CONTINUE_EDITING_IN_THIS_TAB_REQUEST:"CONTINUE_EDITING_IN_THIS_TAB_REQUEST"},Or=["sync","join","leave"],Rr=[ee.FORCE_TAKE_OVER,ee.TAKE_OVER_REQUEST,ee.TAKE_OVER_APPROVED,ee.TAKE_OVER_REJECTED,ee.FORCE_TAKE_OVER_REQUEST,ee.CONTINUE_EDITING_IN_THIS_CLIENT,ee.CONTINUE_EDITING_IN_THIS_TAB_REQUEST],Dr=Q.atom({}),ns=Q.atom(null),Mr=Q.atom(Z.CHECKING),Ur=Q.atom({}),Br=e=>{const t={},n=p.groupBy(p.values(e).map(p.first).filter(Boolean),"pageId");return Object.entries(n).forEach(([s,r])=>t[s]=p.minBy(r,"onlineAt")),t},Fr=e=>{const t=p.minBy(p.values(e).map(p.first).filter(Boolean),"onlineAt"),n=t==null?void 0:t.onlineAt;return n?n-100:+new Date-1e3*60*60*4},bt=()=>{const{user:e}=Qt();return e==null?void 0:e.id},qr=()=>{const{data:e}=be();return`WEBSITE:${e==null?void 0:e.appKey}`},vt=()=>{const{data:e}=re();return e==null?void 0:e.id},Te=crypto.randomUUID();let an=null;const et=10,Kr=1e3,Vr=2,Hr=16e3,_n=()=>{const[e,t]=Q.useAtom(Dr);return{pageToUser:e,setPageToUser:t}},ue=()=>{const[e,t]=Q.useAtom(Mr),n=[Z.LOCKED,Z.ACTIVE_IN_ANOTHER_TAB].includes(e),s=[Z.EDITING].includes(e);return{pageStatus:e,setPageStatus:t,isLocked:n,isEditing:s}},wn=()=>{const[e,t]=Q.useAtom(Ur);return{pageLockMeta:e,setPageLockMeta:t}},ss=()=>{const e=vt(),{pageToUser:t}=_n();return h.useMemo(()=>t[e],[t,e])},bn=()=>{const e=Tn(),{setPageStatus:t}=ue(),[n]=Q.useAtom(ns);return h.useEffect(()=>{if(clearTimeout(an),!e)return an=setTimeout(()=>{e||t(Z.EDITING)},500),()=>clearTimeout(an)},[e,t]),n},Qr=()=>{const e=vt(),t=bt(),n=bn(),{setPageToUser:s}=_n(),{setPageStatus:r,pageStatus:a}=ue(),o=h.useRef(e);return h.useEffect(()=>{o.current=e},[e]),h.useCallback(l=>{const c=l||n;if(!c)return[];const u=c==null?void 0:c.presenceState(),d=Br(u);s(d);const f=d[o.current];if(!f)r(Z.CHECKING);else if(!t)r(Z.CHECKING);else if(f.userId===t&&f.clientId===Te){if(a===Z.TAKE_OVER_REQUESTED)return;r(Z.EDITING)}else f.userId===t&&f.clientId!==Te?r(Z.ACTIVE_IN_ANOTHER_TAB):r(Z.LOCKED)},[n,s,r,t,a])},rs=()=>{const e=bt(),t=vt(),n=bn(),s=ss(),{setPageLockMeta:r}=wn(),a=h.useRef(t);return h.useEffect(()=>{a.current=t},[t]),h.useCallback(async(o,l)=>{if(!n)return;const c=l||{};c.userId=e,c.pageId=a.current,c.senderClientId=Te,c.receiverClientId=(l==null?void 0:l.requestingClientId)||(s==null?void 0:s.clientId),await n.send(o,c),r({})},[n,e,s,r])},zr=()=>{const e=bt(),t=vt(),n=bn(),{setPageStatus:s}=ue(),{setPageLockMeta:r}=wn(),a=rs(),o=h.useRef(t),{savePageAsync:l}=g.useSavePage();return h.useEffect(()=>{o.current=t},[t]),h.useCallback(c=>async({payload:u})=>{const d=u||{};if(!(!(d!=null&&d.pageId)||(d==null?void 0:d.pageId)!==o.current||(d==null?void 0:d.receiverClientId)!==Te))switch(r({}),c){case ee.FORCE_TAKE_OVER_REQUEST:case ee.CONTINUE_EDITING_IN_THIS_TAB_REQUEST:{try{await l(!0)}catch(f){console.error("Failed to save page before releasing lock:",f)}await a(ee.CONTINUE_EDITING_IN_THIS_CLIENT,{requestingClientId:d==null?void 0:d.senderClientId}),setTimeout(()=>r({type:c}),0);break}case ee.TAKE_OVER_REQUEST:{r({requestingUserId:d==null?void 0:d.userId,requestingClientId:d==null?void 0:d.senderClientId}),s(Z.TAKE_OVER_REQUESTED);break}case ee.CONTINUE_EDITING_IN_THIS_CLIENT:{const f=Fr(n==null?void 0:n.presenceState());s(Z.CHECKING),await(n==null?void 0:n.track({onlineAt:f,pageId:o.current,userId:e,clientId:Te}));break}case ee.TAKE_OVER_REJECTED:{r({type:ee.TAKE_OVER_REJECTED});break}}},[a,r,s,n,e,l])},$r=()=>{const e=Tn(),t=bt(),n=vt(),s=qr(),[r,a]=Q.useAtom(ns),o=zr(),l=Qr(),c=h.useRef(o),u=h.useRef(l),d=h.useRef(null),f=h.useRef(!1),E=h.useRef(0),m=h.useRef(r),S=h.useRef(()=>{});h.useEffect(()=>{c.current=o,u.current=l,m.current=r},[o,l,r]);const v=h.useCallback(b=>{Rr.forEach(A=>{b.onBroadcast(A,C=>{c.current(A)(C)})}),Or.forEach(A=>{b.onPresence(A,()=>{u.current(b)})})},[]),_=h.useCallback(()=>{if(f.current||!e||!t||!s)return;if(E.current>=et){console.error(`Maximum reconnection attempts (${et}) reached. Stopping reconnection attempts.`);return}f.current=!0,E.current+=1,console.log(`Attempting to reconnect realtime channel (attempt ${E.current}/${et})`),d.current&&(clearTimeout(d.current),d.current=null),m.current&&(m.current.unsubscribe(),a(null),m.current=null);const b=Math.min(Kr*Math.pow(Vr,E.current-1),Hr);d.current=setTimeout(()=>{const A=e.channel(s,{config:{presence:{key:Te}}});v(A),A.subscribe(async C=>{C==="SUBSCRIBED"?(console.log("Realtime connection established successfully"),a(A),m.current=A,E.current=0,f.current=!1):C==="CHANNEL_ERROR"||C==="TIMED_OUT"?(console.log(`Realtime connection failed: ${C}. Attempt ${E.current}/${et}`),E.current<et?setTimeout(()=>{f.current=!1,S.current()},500):(console.error("Maximum reconnection attempts reached"),f.current=!1)):C==="CLOSED"&&(console.log("Realtime connection closed"),f.current=!1)})},b)},[e,t,s,a,v]);h.useEffect(()=>{S.current=_},[_]),h.useEffect(()=>{if(!e||!t||!s||r&&r.topic===s)return;E.current=0,f.current=!1;const b=e.channel(s,{config:{presence:{key:Te}}});return v(b),b.subscribe(async A=>{A==="SUBSCRIBED"?(console.log("Realtime connection established successfully"),a(b),m.current=b,E.current=0):A==="CHANNEL_ERROR"||A==="TIMED_OUT"?(console.log(`Realtime connection failed: ${A}. Will attempt to reconnect...`),f.current||_()):A==="CLOSED"&&console.log("Realtime connection closed")}),()=>{d.current&&(clearTimeout(d.current),d.current=null),f.current=!1,E.current=0,m.current===b&&(m.current=null),a(null),b.unsubscribe()}},[e,t,s,a,_,v]),h.useEffect(()=>{const b=()=>{if(document.visibilityState==="visible"){if(console.log("Tab became visible, checking realtime connection..."),!e||!t||!s){console.log("Required dependencies not available, skipping reconnection");return}if(f.current){console.log("Reconnection already in progress, skipping visibility change reconnect");return}m.current?m.current.getState()!=="JOINED"&&(console.log("Channel is not active, reconnecting..."),_()):(console.log("No active channel found, reconnecting..."),_())}};return document.addEventListener("visibilitychange",b),()=>{document.removeEventListener("visibilitychange",b)}},[e,t,s,_]),h.useEffect(()=>(r&&n&&t&&r.track({pageId:n,userId:t,clientId:Te,onlineAt:+new Date}),()=>{r&&n&&r.untrack()}),[r,n,t])},zt=()=>{const{data:e}=be();return h.useMemo(()=>(e==null?void 0:e.fallbackLang)||"en",[e])},$t=()=>{const e=k(),t=L();return T.useQuery({queryKey:[y.GET_WEBSITE_PAGES],staleTime:1e3*60*5,queryFn:async()=>e(t,{action:y.GET_WEBSITE_PAGES})||[],placeholderData:n=>n||[]})},Wr=e=>{const t=k(),n=L(),s=zt();return T.useQuery({queryKey:[y.GET_WEBSITE_PAGES,e,s],staleTime:1e3*60*5,enabled:!!e,queryFn:async()=>{if(s===e)return{};const r=await t(n,{action:y.GET_WEBSITE_PAGES,data:{lang:e}})||[];return p.keyBy(p.map(r,a=>({...a,lang:e})),"primaryPage")},placeholderData:r=>r||{}})},Yr=h.lazy(()=>Promise.resolve().then(()=>require("./page-manager-new-5W5M9_ue.cjs"))),as=({children:e})=>{const{t}=pe.useTranslation(),[n]=he(),s=n.get("page"),{data:r,isFetching:a}=re(),{data:o,isFetching:l}=$t(),[c,u]=h.useState(!1),[d,f]=h.useState(!0),{savePage:E}=g.useSavePage(),m=!!s&&!p.isEmpty(r),{isLocked:S}=ue();h.useEffect(()=>{!l&&o&&f(!1)},[l,o]);const v=!d&&!s,_=!d&&!a&&p.isEmpty(r),b=c||v||_;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex items-center gap-x-1",children:i.jsx("div",{className:"relative",children:i.jsxs(g.Tooltip,{children:[i.jsx(g.TooltipTrigger,{asChild:!0,onClick:()=>{S||E(),u(!0)},children:e||i.jsx(N.Button,{variant:"outline",className:"flex w-full items-center space-x-2 py-1",children:i.jsx(w.LogsIcon,{className:"h-4 w-4"})},"template-viewer")}),i.jsx(g.TooltipContent,{side:"right",children:i.jsx("p",{children:t("Open pages manager")})})]})})}),i.jsx(g.Sheet,{open:b,onOpenChange:A=>!A&&m&&u(!1),children:i.jsxs(g.SheetContent,{side:"left","aria-describedby":"pages-manager-description",className:`z-50 !min-w-[50vh] !max-w-[800px] border-border p-0 ${m?"":"sheet-hide-close-btn"}`,children:[i.jsxs(g.SheetHeader,{className:"mb-3 px-4 pt-4",children:[i.jsxs(g.SheetTitle,{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-primary text-primary-foreground",children:i.jsx(w.Folder,{className:"h-4 w-4"})}),i.jsxs("div",{className:"flex flex-col",children:[i.jsx("span",{className:"text-sm font-semibold",children:t("Pages")}),i.jsx("span",{id:"pages-manager-description",className:"text-xs font-normal text-muted-foreground",children:t("Manage your site structure")})]})]}),i.jsx(g.SheetDescription,{className:"sr-only",children:t("Manage your site structure")})]}),i.jsx("div",{className:"h-[calc(100vh-80px)] overflow-y-auto",children:b&&i.jsx(h.Suspense,{children:i.jsx(Yr,{close:()=>u(!1)})})})]})})]})},Jr=h.lazy(()=>Promise.resolve().then(()=>require("./add-new-page-DiHnECAR.cjs"))),Zr=h.lazy(()=>Promise.resolve().then(()=>require("./delete-page-D0tdn6VW.cjs"))),Xr=h.lazy(()=>Promise.resolve().then(()=>require("./duplicate-page-ChSp1TYN.cjs"))),ea=h.lazy(()=>Promise.resolve().then(()=>require("./mark-as-template-IYRjta97.cjs"))),ta=h.lazy(()=>Promise.resolve().then(()=>require("./unmark-as-template-f1dl_YTz.cjs"))),na=h.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-DEPFjGuu.cjs"))),sa=()=>{const[e,t]=h.useState(null),[n,s]=h.useState(null),[r,a]=h.useState(null),[o,l]=h.useState(null),[c,u]=h.useState(null),[d,f]=h.useState(null),{data:E,isFetching:m}=ye(),{selectedLang:S,fallbackLang:v}=g.useLanguages(),{data:_}=we(),b=_==null?void 0:_.find(P=>P.lang===S),{isLocked:A}=ue(),C=!(E!=null&&E.slug),M=Q.useSetAtom(ot);if(!E)return null;const H=P=>{S.length>0&&S!==v?M({edit:!0,id:P==null?void 0:P.id,primaryPage:P==null?void 0:P.primaryPage}):f(P)};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center justify-between rounded px-[2px] transition-colors duration-200",children:[i.jsx(as,{children:i.jsx(N.Button,{className:"flex h-7 max-w-[200px] cursor-pointer items-center truncate rounded px-1 text-xs font-medium",variant:"ghost",children:m?i.jsx(w.Loader,{className:"h-4 w-4 animate-spin text-slate-400"}):i.jsxs("span",{className:"flex w-full cursor-pointer items-end overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-xs font-medium",children:[C?i.jsx(w.Hash,{className:"mr-1 h-4 w-4"}):i.jsx(w.File,{className:"mr-1 h-4 w-4"}),p.get(b||E,"name")??""]})})}),A?i.jsx(N.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 cursor-not-allowed rounded opacity-50 hover:bg-transparent",children:i.jsx(w.MoreHorizontal,{className:"h-4 w-4"})}):i.jsx(ts,{page:E,setDuplicatePage:P=>u(P),setAddEditPage:P=>H(P),setUnpublishPage:P=>s(P),setDeletePage:P=>t(P),setMarkAsTemplate:P=>a(P),setUnmarkAsTemplate:P=>l(P),isLanguagePage:S.length>0&&S!==v,children:i.jsx(N.Button,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded",children:i.jsx(w.MoreHorizontal,{className:"h-4 w-4"})})})]}),d&&i.jsx(h.Suspense,{children:i.jsx(Jr,{closePanel:()=>f(null),editPage:()=>{},addEditPage:d,setAddEditPage:f})}),e&&i.jsx(h.Suspense,{children:i.jsx(Zr,{page:e,onClose:()=>t(null)})}),n&&i.jsx(h.Suspense,{children:i.jsx(na,{page:n,onClose:()=>s(null)})}),r&&i.jsx(h.Suspense,{children:i.jsx(ea,{page:r,onClose:()=>a(null)})}),o&&i.jsx(h.Suspense,{children:i.jsx(ta,{page:o,onClose:()=>l(null)})}),c&&i.jsx(h.Suspense,{children:i.jsx(Xr,{page:c,onClose:()=>u(null),closePanel:()=>f(null)})})]})},Wt=({children:e,className:t=""})=>i.jsx("div",{className:Dt.cn("fixed bottom-0 left-0 right-0 top-[50px] z-[20] flex w-screen flex-col items-center justify-center bg-black/40 transition-all",t),children:e}),ra=({hasDynamicPage:e})=>i.jsx(Wt,{children:i.jsxs("div",{className:"flex min-w-[300px] max-w-[400px] flex-col items-center justify-center rounded-lg border bg-white p-4 shadow-lg",children:[i.jsx("h1",{className:"text-lg font-medium",children:e?"Select a page":"No pages found"}),i.jsx("p",{className:"pt-2 text-center text-sm font-light text-gray-600",children:e?"Please select a page from the list in the top header. This will enable you to edit the page.":"Please add a new page"})]})}),tt={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",ak:"Akan",sq:"Albanian",am:"Amharic",ar:"Arabic",an:"Aragonese",hy:"Armenian",as:"Assamese",av:"Avaric",ae:"Avestan",ay:"Aymara",az:"Azerbaijani",bm:"Bambara",ba:"Bashkir",eu:"Basque",be:"Belarusian",bn:"Bengali",bh:"Bihari",bi:"Bislama",bs:"Bosnian",br:"Breton",bg:"Bulgarian",my:"Burmese",ca:"Catalan",ch:"Chamorro",ce:"Chechen",ny:"Chichewa",zh:"Chinese","zh-Hans":"Chinese (Simplified)","zh-Hant":"Chinese (Traditional)",cv:"Chuvash",kw:"Cornish",co:"Corsican",cr:"Cree",hr:"Croatian",cs:"Czech",da:"Danish",dv:"Maldivian",nl:"Dutch",dz:"Dzongkha",en:"English",eo:"Esperanto",et:"Estonian",ee:"Ewe",fo:"Faroese",fj:"Fijian",fi:"Finnish",fr:"French",ff:"Fula, Pular",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Manx",ka:"Georgian",de:"German",el:"Greek",kl:"Kalaallisut",gn:"Guarani",gu:"Gujarati",ht:"Haitian Creole",ha:"Hausa",he:"Hebrew",hz:"Herero",hi:"Hindi",ho:"Hiri Motu",hu:"Hungarian",is:"Icelandic",io:"Ido",ig:"Igbo",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",jv:"Javanese",kn:"Kannada",kr:"Kanuri",ks:"Kashmiri",kk:"Kazakh",km:"Khmer",ki:"Kikuyu",rw:"Kinyarwanda",rn:"Kirundi",ky:"Kyrgyz",kv:"Komi",kg:"Kongo",ko:"Korean",ku:"Kurdish",kj:"Kwanyama",lo:"Lao",la:"Latin",lv:"Latvian",li:"Limburgish",ln:"Lingala",lt:"Lithuanian",lu:"Luga-Katanga",lg:"Luganda, Ganda",lb:"Luxembourgish",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mh:"Marshallese",mo:"Moldavian",mn:"Mongolian",na:"Nauru",nv:"Navajo",ng:"Ndonga",nd:"Northern Ndebele",ne:"Nepali",no:"Norwegian",nb:"Norwegian bokmål",nn:"Norwegian nynorsk",ii:"Sichuan Yi",oc:"Occitan",oj:"Ojibwe",cu:"Old Church Slavonic",or:"Oriya",om:"Oromo",os:"Ossetian",pi:"Pāli",ps:"Pashto, Pushto",fa:"Persian (Farsi)",pl:"Polish",pt:"Portuguese",pa:"Punjabi (Eastern)",qu:"Quechua",rm:"Romansh",ro:"Romanian",ru:"Russian",se:"Sami",sm:"Samoan",sg:"Sango",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Swati",sk:"Slovak",sl:"Slovenian",so:"Somali",nr:"Southern Ndebele",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",ty:"Tahitian",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uyghur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",ve:"Venda",vi:"Vietnamese",vo:"Volapük",wa:"Wallon",cy:"Welsh",wo:"Wolof",fy:"Western Frisian",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",za:"Zhuang, Chuang",zu:"Zulu"};function is(e,t,n=!1){const s=e.toString()?`?${e.toString()}`:"/";n?window.history.replaceState(null,"",s):window.history.pushState({},"",s),t(e),window.dispatchEvent(new PopStateEvent("popstate"))}const aa=h.lazy(()=>Promise.resolve().then(()=>require("./add-new-language-page-Cq8R42Ro.cjs"))),ia=()=>{const e=se("topLeftCorner",null);return e?i.jsx("div",{className:"max-h-9 w-full overflow-hidden pr-2",children:h.createElement(e,{})}):null},os=({showAdd:e=!0,variant:t="ghost",goToDefaultLang:n=!1})=>{const{fallbackLang:s,languages:r,selectedLang:a,setSelectedLang:o}=g.useLanguages(),l=p.isEmpty(a)?s:a,[,c]=he(),{isLocked:u}=ue(),{t:d}=pe.useTranslation();h.useEffect(()=>{const A=new URLSearchParams(window.location.search),C=A.get("lang");C&&(r.includes(C)?o(C):(A.delete("lang"),c(A),o("")))},[r,c,o]);const f=Q.useSetAtom(ot),{data:E}=re(),{data:m}=be(),{data:S}=we(),v=h.useMemo(()=>{const A=p.compact(p.map(p.get(m,"languages"),C=>{const M=p.find(S,{lang:C});return{key:C,value:p.get(tt,C,C),isLangPageAdded:!!M}})).filter(Boolean);return[{key:s,value:p.get(tt,s),isLangPageAdded:!0},...A]},[s,S,m]),_=A=>{if(document.querySelector('[data-panel-id="seo"]')){const M=new CustomEvent("seo-language-switch-check",{detail:{fromLang:l,toLang:A,switchHandler:()=>b(A)}});window.dispatchEvent(M);return}b(A)},b=A=>{o(A);const C=new URLSearchParams(window.location.search);A===s?C.delete("lang"):C.set("lang",A),is(C,c)};return p.isEmpty(r)?null:u?i.jsxs(N.Button,{variant:"ghost",size:"sm",className:"ml-px h-max cursor-not-allowed gap-2 py-1.5 opacity-50",children:[i.jsx(w.Languages,{className:"h-4 w-4"}),p.get(tt,l,l),i.jsx(w.ChevronDown,{className:"h-4 w-4"})]}):n?i.jsx(N.Button,{onClick:()=>b(s),variant:"link",size:"sm",children:d("Switch to default language")}):i.jsx(i.Fragment,{children:i.jsxs(g.DropdownMenu,{children:[i.jsx(g.DropdownMenuTrigger,{asChild:!0,className:"focus:outline-none",children:i.jsxs(N.Button,{disabled:!!u,variant:t,size:"sm",className:"ml-px h-max gap-2 py-1.5",children:[i.jsx(w.Languages,{className:"h-4 w-4"}),p.get(tt,l,l),i.jsx(w.ChevronDown,{className:"h-4 w-4"})]})}),i.jsxs(g.DropdownMenuContent,{className:"space-y-1 border-border",children:[p.map(v.filter(A=>A.isLangPageAdded),A=>i.jsxs(g.DropdownMenuItem,{className:Dt.cn("flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",A.key===l&&"!bg-gray-200 text-gray-700"),onClick:()=>_(A.key),children:[i.jsx("div",{className:"text-slate-600",children:A.value}),A.key===s&&i.jsxs("small",{className:"flex items-center gap-x-1 text-[9px] leading-none text-orange-500",children:[i.jsx(w.Star,{fill:"orange",className:"h-2 w-2"}),"Primary"]})]},A.value)),e&&!p.isEmpty(v.filter(A=>!A.isLangPageAdded))&&i.jsxs(i.Fragment,{children:[i.jsx(g.Separator,{}),i.jsxs(N.Button,{size:"sm",variant:"ghost",onClick:()=>{E&&f({edit:!1,primaryPage:E.id})},className:"text-xs font-normal duration-200 hover:bg-slate-300 hover:text-slate-800",children:[i.jsx(w.Plus,{className:"mr-1 h-3 w-3"})," Add Language"]})]})]})]})})};function oa(){const e=Q.useAtomValue(ot),t=Q.useSetAtom(ot);return i.jsxs("div",{className:"relative z-10 flex items-center justify-end gap-1",children:[i.jsx(ia,{}),i.jsx(as,{}),e&&i.jsx(h.Suspense,{children:i.jsx(aa,{isOpen:!0,id:e==null?void 0:e.id,edit:!!(e!=null&&e.id),primaryPage:e==null?void 0:e.primaryPage,preselectedLang:e==null?void 0:e.preselectedLang,onClose:()=>t(null)})})]})}function la(){return i.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((e,t)=>i.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[i.jsxs("div",{className:"flex-1 space-y-1",children:[i.jsx(g.Skeleton,{className:"h-4 w-3/4"}),i.jsx(g.Skeleton,{className:"h-3 w-1/2"}),i.jsx(g.Skeleton,{className:"mt-1 h-5 w-20"})]}),i.jsx(g.Skeleton,{className:"h-8 w-8 rounded-full"})]},t))})}const ca=$.lazy(()=>Promise.resolve().then(()=>require("./page-revisions-content-BKT8S9_g.cjs")));function ua(){const[e,t]=$.useState(!1);return i.jsx(g.TooltipProvider,{children:i.jsxs(g.Tooltip,{delayDuration:0,children:[i.jsxs(g.Sheet,{open:e,onOpenChange:t,children:[i.jsx(g.SheetTrigger,{asChild:!0,children:i.jsx(g.TooltipTrigger,{asChild:!0,children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsxs(N.Button,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[i.jsx(w.History,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"View revision history"})]}),i.jsx("div",{className:"h-4 w-px bg-gray-200 dark:bg-gray-700"})]})})}),i.jsx(g.SheetContent,{className:"flex h-[100vh] flex-col",children:e&&i.jsx(h.Suspense,{fallback:i.jsx(la,{}),children:i.jsx(ca,{isOpen:e})})})]}),i.jsx(g.TooltipContent,{side:"bottom",children:i.jsx("p",{children:"Revision history"})})]})})}const Gt=({permission:e,permissions:t,children:n,fallback:s=null})=>{const{hasPermission:r}=g.usePermissions();return e&&!r(e)||t&&!t.some(a=>r(a))?s:n},da={SLUG_ALREADY_USED:"This slug is already in use. Please choose a different one."},ls=()=>{var t;const[e]=wt();return((t=e==null?void 0:e.flags)==null?void 0:t.revisions)??!1},fa=()=>{const e=L(),t=T.useQueryClient(),n=k(),{data:s}=Ae();return T.useMutation({mutationFn:async r=>await n(e,{action:y.CREATE_PAGE,data:r}),onSuccess:(r,a)=>{var l;a&&(a!=null&&a.primaryPage)?(t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}),t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES,a==null?void 0:a.lang]})):t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]});const o=a.template?`Page created from "${a.template.name}" template`:a.hasSlug===!1?"New "+((l=p.find(s,{key:a.pageType}))==null?void 0:l.name)+" added successfully":"New page added successfully";F.toast.success(o)},onError:(r,a)=>{const o=p.find(s,{key:a.pageType});F.toast.error(`Failed to add new ${o!=null&&o.hasSlug?"page":o.name}.`,{description:p.get(da,r.message,r.message)})}})},ha=()=>{const e=L(),t=T.useQueryClient(),n=k(),{data:s}=ye(),{data:r}=Ae();return T.useMutation({mutationFn:async a=>await n(e,{action:y.UPDATE_PAGE,data:a}),onSuccess:(a,o)=>{(s==null?void 0:s.id)===(o==null?void 0:o.id)&&t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES]}),o&&(o!=null&&o.primaryPage||o!=null&&o.seo)?(t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,o==null?void 0:o.primaryPage]}),t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})):t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})},onError:(a,o)=>{const l=p.find(r,{key:o.pageType});F.toast.error(`Failed to update ${l!=null&&l.hasSlug?"page":l.name}.`,{description:a.message})}})},ga=()=>{const e=L(),t=T.useQueryClient(),n=k(),{data:s}=Ae();return T.useMutation({mutationFn:async r=>n(e,{action:y.DELETE_PAGE,data:{id:r==null?void 0:r.id}}),onSuccess:(r,a)=>{if(r.code==="PAGE_LOCKED"){F.toast.error("Delete not allowed",{description:"Page is currently being edited by another user."});return}a&&(a!=null&&a.primaryPage)?(t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}),t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})):t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})},onError:(r,a)=>{const o=p.find(s,{key:a.pageType});F.toast.error(`Failed to delete ${o!=null&&o.hasSlug?"page":o.name}.`,{description:r.message})}})},ma=()=>{const e=L(),t=T.useQueryClient(),n=k(),{data:s}=Ae();return T.useMutation({mutationFn:async r=>n(e,{action:y.TAKE_OFFLINE,data:{id:r==null?void 0:r.id}}),onSuccess:(r,a)=>{a&&(a!=null&&a.primaryPage)?t.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,a==null?void 0:a.primaryPage]}):t.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]});const o=p.find(s,{key:a.pageType});F.toast.success(o!=null&&o.hasSlug?"Page unpublished successfully.":"New "+o.name+" added successfully.")},onError:(r,a)=>{const o=p.find(s,{key:a.pageType});F.toast.error(`Failed to take offline ${o!=null&&o.hasSlug?"page":o.name}.`,{description:r.message})}})},vn=()=>{const e=L(),t=k(),n=T.useQueryClient(),{data:s}=re(),{savePageAsync:r}=g.useSavePage(),a=ls();return T.useMutation({mutationFn:async({ids:o})=>(await r(),t(e,{action:y.PUBLISH_CHANGES,data:{ids:o,revisions:a}})),onSuccess:()=>{n.invalidateQueries({queryKey:[y.GET_CHANGES]}),n.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]}),n.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,s==null?void 0:s.id]})},onError:o=>{console.log("##",o),F.toast.error("Failed to publish pages.")}})},Ea=()=>{const e=L(),t=k(),n=T.useQueryClient();return T.useMutation({mutationFn:async s=>{var r;return t(e,{action:y.MARK_AS_TEMPLATE,data:{id:(r=s.page)==null?void 0:r.id,name:s.name,description:s.description,pageType:s.pageType,previewImage:s.previewImage}})},onSuccess:()=>{n.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]}),F.toast.success("Page marked as template successfully.")},onError:()=>{F.toast.error("Failed to mark page as template.")}})},pa=()=>{const e=L(),t=k(),n=T.useQueryClient();return T.useMutation({mutationFn:async s=>t(e,{action:y.UNMARK_AS_TEMPLATE,data:{id:s==null?void 0:s.id}}),onSuccess:()=>{n.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]}),F.toast.success("Page unmarked as template successfully.")},onError:()=>{F.toast.error("Failed to unmark page as template.")}})},ya=()=>{const e=L(),t=k(),n=T.useQueryClient();return T.useMutation({mutationFn:async({id:s,slug:r})=>t(e,{action:y.CHANGE_SLUG,data:{id:s,slug:r}}),onSuccess:(s,{primaryPage:r})=>{F.toast.success("Slug changed successfully."),r?n.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES,r]}):n.invalidateQueries({queryKey:[y.GET_WEBSITE_PAGES]})},onError:()=>{F.toast.error("Failed to change slug")}})},Aa=h.lazy(()=>Promise.resolve().then(()=>require("./publish-pages-content-WJHTVYnx.cjs")));function Sa({showModal:e=!1,onClose:t=()=>console.log("Cancelled")}){const{mutate:n,isPending:s}=vn();return i.jsx(g.Dialog,{open:e,onOpenChange:s?()=>{}:t,children:e&&i.jsx(h.Suspense,{fallback:i.jsx("div",{className:"h-96 w-96 animate-pulse bg-gray-100"}),children:i.jsx(Aa,{onClose:t,isPending:s,publishPage:n})})})}const cs=e=>{const{fallbackLang:t}=g.useLanguages(),{data:n}=be(),{data:s,isFetching:r}=we(),a=h.useMemo(()=>{const o={[t]:!0};return p.each(p.get(n,"languages"),l=>{const c=p.find(s,{lang:l});o[l]=!!c}),o},[t,s,n]);return r||p.isEmpty(e)||e&&a[e]},Ta=()=>{const[e]=g.useBlocksStore(),{data:t}=$t();return h.useCallback(()=>{if(!t)return{ids:[],names:[],partialBlocksInfo:[]};const s=p.filter(e,c=>c._type==="PartialBlock"),r=p.uniq(p.compact(s.map(c=>p.get(c,"partialBlockId","")))),a=p.compact(r.map(c=>{const u=p.find(t,{id:c});if(!u)return null;if(u.online){if(!p.isEmpty(u.changes))return{id:u.id,name:u.name||u.slug||u.id,status:"unpublished_changes"}}else return{id:u.id,name:u.name||u.slug||u.id,status:"unpublished"};return null})),o=a.map(c=>c.id),l=a.map(c=>c.name);return{ids:o,names:l,partialBlocksInfo:a}},[e,t])},Pa={particleCount:350,spread:120,origin:{y:.6},angle:90},xa={TOP_RIGHT:{angle:225,origin:{x:.9,y:0}},BOTTOM_RIGHT:{angle:100,origin:{x:.9,y:.9}}},_a=async()=>{const{default:e}=await import("canvas-confetti");return e},dn=e=>{let t=xa[e];t||(t={});const n={...Pa,...t};_a().then(s=>s(n))};function Yt({children:e,content:t,side:n="bottom",delayDuration:s=700,showTooltip:r=!0}){return r?i.jsx(g.TooltipProvider,{children:i.jsxs(g.Tooltip,{delayDuration:s,children:[i.jsx(g.TooltipTrigger,{asChild:!0,children:e}),i.jsx(g.TooltipContent,{side:n,sideOffset:10,children:i.jsx("p",{children:t})})]})}):e}const wa=h.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-DEPFjGuu.cjs"))),ba=h.lazy(()=>Promise.resolve().then(()=>require("./translation-warning-modal-B876S5yp.cjs"))),va=h.lazy(()=>Promise.resolve().then(()=>require("./unpublished-partials-modal-CEFXp1D1.cjs"))),Ca=h.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-BkrnLb3B.cjs"))),Ia=()=>{const{t:e}=pe.useTranslation(),{selectedLang:t,fallbackLang:n}=g.useLanguages(),s=se("getPreviewUrl",async E=>E),[r,a]=h.useState(""),{data:o}=re(),{data:l}=we(),{data:c}=Ae(),u=h.useMemo(()=>{var E;return(E=l==null?void 0:l.find(m=>(m==null?void 0:m.lang)===t))==null?void 0:E.slug},[t,l]),d=h.useCallback(E=>{var m;return(m=p.find(c,{key:E}))==null?void 0:m.hasSlug},[c]),f=t===n?"":t;return h.useEffect(()=>{(async()=>{if(typeof s=="function"){const E=!d(o==null?void 0:o.pageType),m=await s(E?`/_partial/${f!==""?f+"/":""}${o==null?void 0:o.id}`:u||"");a(m)}else a("")})()},[s,u,o==null?void 0:o.pageType,d,o==null?void 0:o.id,f]),i.jsx(i.Fragment,{children:i.jsx(Yt,{content:e("Open preview in new tab"),delayDuration:0,children:i.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:i.jsx(N.Button,{variant:"ghost",size:"sm",className:"gap-2",children:i.jsx(w.Play,{className:"h-4 w-4"})})})})})},Na=()=>{const{t:e}=pe.useTranslation(),[t,n]=g.useRightPanel();return i.jsxs(i.Fragment,{children:[i.jsx(Yt,{content:e("Theme"),delayDuration:0,children:i.jsx(N.Button,{variant:t==="theme"?"outline":"ghost",size:"icon",className:"gap-2",onClick:()=>n(t==="theme"?"block":"theme"),children:i.jsx(w.Palette,{className:"h-4 w-4"})})}),i.jsx("div",{className:"h-4 w-px bg-gray-200 dark:bg-gray-700"})]})},La=()=>{const{t:e}=pe.useTranslation(),[t,n]=h.useState(!1),{isLocked:s}=ue(),{savePageAsync:r,saveState:a}=g.useSavePage();h.useEffect(()=>{const d=f=>{a==="UNSAVED"&&(f.preventDefault(),f.returnValue=!1)};return a==="UNSAVED"&&window.addEventListener("beforeunload",d),()=>{window.removeEventListener("beforeunload",d)}},[a]);const o=h.useCallback(async()=>{t||(n(!0),await r(),n(!1))},[r,t]),{buttonIcon:l,buttonClass:c,tooltipContent:u}=h.useMemo(()=>{switch(a){case"UNSAVED":return{tooltipContent:e("Save draft"),buttonIcon:i.jsx(w.Save,{className:"h-4 w-4"}),buttonClass:"gap-x-1"};case"SAVING":return{tooltipContent:e("Saving"),buttonIcon:i.jsx(w.Loader,{className:"h-4 w-4 animate-spin text-sky-700"}),buttonClass:"gap-x-1"};case"SAVED":return{tooltipContent:e("Saved"),buttonIcon:i.jsx(w.CheckCircle,{className:"h-4 w-4"}),buttonClass:"text-green-500 gap-x-1"}}},[a,e]);return s?null:i.jsxs(N.Button,{size:"sm",variant:"ghost",onClick:o,className:`${c} w-24 max-w-24`,children:[l," ",u]})},ja=()=>{const{t:e}=pe.useTranslation(),{selectedLang:t}=g.useLanguages(),{data:n}=ye(),{data:s}=we(),r=Ta(),[a,o]=h.useState(!1),[l,c]=h.useState(!1),[u,d]=h.useState(null),[f,E]=h.useState(!1),{savePageAsync:m}=g.useSavePage(),[S,v]=h.useState(!1),[_,b]=h.useState(!1),[A,C]=h.useState([]),[M,H]=h.useState([]),{data:P}=re(),{mutate:oe,isPending:te}=vn(),{needTranslations:V}=g.useSavePage(),j=V(),{buttonText:G,buttonClassName:z,isPublished:q,hasUnpublishedChanges:ne}=h.useMemo(()=>{const ae=P&&(P==null?void 0:P.online),me=!p.isEmpty(P==null?void 0:P.changes);let ve=ae?"hover:bg-green-600 bg-green-500":"",J=e(ae?"Published":"Publish");return ae&&me&&(ve="hover:bg-blue-600 bg-blue-500",J=e("Publish")),{buttonClassName:ve,isPublished:ae,hasUnpublishedChanges:me,buttonText:J}},[P,e]),Le=async()=>{if(j){v(!0);return}ce([n==null?void 0:n.id,n==null?void 0:n.primaryPage])},le=ae=>{const me=[n==null?void 0:n.id,n==null?void 0:n.primaryPage,...Array.isArray(ae)?ae:[]];oe({ids:p.compact(me)},{onSuccess:()=>dn("TOP_RIGHT")})},ce=h.useCallback(ae=>{const{ids:me,partialBlocksInfo:ve}=r();me.length>0?(C(me),H(ve),b(!0)):oe({ids:p.compact(ae)},{onSuccess:()=>dn("TOP_RIGHT")})},[r,oe]),ge=()=>{b(!1),le(A),C([]),H([])},en=()=>{b(!1),C([]),H([])},Ct=()=>{v(!1),ce([n==null?void 0:n.id,n==null?void 0:n.primaryPage])},tn=async()=>{v(!1),await m()},nn=h.useMemo(()=>p.map(s??[],"id"),[s]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex",children:[i.jsxs(N.Button,{size:"sm",onClick:Le,disabled:te||!(P!=null&&P.id),className:`relative flex items-center gap-1 overflow-hidden rounded-r-none text-white transition-all duration-300 ease-in-out ${z}`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[i.jsx("span",{className:`flex items-center transition-transform duration-300 ease-in-out ${l?"-translate-y-10":""}`,children:q?ne?i.jsx(w.Pencil,{className:"h-4 w-4"}):i.jsx(w.Send,{className:"h-4 w-4"}):i.jsx(w.Rocket,{className:"h-4 w-4"})}),i.jsx("span",{className:`absolute inset-0 left-3 flex items-center transition-transform duration-300 ease-in-out ${l?"":"translate-y-10"}`,children:q?i.jsx(w.Rocket,{className:"h-4 w-4"}):i.jsx(w.Send,{className:"h-4 w-4"})}),i.jsx("span",{children:G}),t?`(${p.upperCase(t)})`:""]}),i.jsxs(g.DropdownMenu,{children:[i.jsx(g.DropdownMenuTrigger,{asChild:!0,children:i.jsx(N.Button,{size:"sm",disabled:te||!(P!=null&&P.id),className:`rounded-l-none border-l border-white/50 px-2 text-white ${z}`,children:i.jsx(w.ChevronDown,{className:"h-4 w-4"})})}),i.jsxs(g.DropdownMenuContent,{align:"end",className:"w-52",children:[i.jsxs(g.DropdownMenuItem,{disabled:te,className:"cursor-pointer text-xs",onClick:()=>ce(nn),children:[e("Publish")," with translation pages"]}),!q&&i.jsxs(g.DropdownMenuItem,{disabled:te,className:"cursor-pointer text-xs",onClick:()=>ce([P==null?void 0:P.id]),children:[e("Publish")," page"]}),i.jsxs(g.DropdownMenuItem,{onClick:()=>o(!0),className:"cursor-pointer text-xs",children:[e("Open")," publish menu"]}),q&&ne&&i.jsx(g.DropdownMenuItem,{onClick:()=>E(!0),className:"cursor-pointer text-xs",children:e("View Unpublished changes")}),q&&i.jsxs(g.DropdownMenuItem,{onClick:()=>d(n),className:"cursor-pointer text-xs",children:[e("Unpublish")," page ",t?`(${p.upperCase(t)})`:""]})]})]})]}),i.jsx(Sa,{showModal:a,onClose:()=>o(!1)}),u&&i.jsx(h.Suspense,{children:i.jsx(wa,{page:u,onClose:()=>d(null)})}),f&&i.jsx(h.Suspense,{children:i.jsx(Ca,{open:f,onOpenChange:E,compare:[{label:"draft",uid:`draft:${P==null?void 0:P.id}`,item:P},{label:"live",uid:`live:${P==null?void 0:P.id}`,item:{}}]})}),S&&i.jsx(h.Suspense,{children:i.jsx(ba,{isOpen:S,onClose:tn,onContinue:Ct,isPending:te})}),_&&i.jsx(h.Suspense,{children:i.jsx(va,{isOpen:_,onClose:en,onContinue:ge,isPending:te,partialBlocksInfo:M})})]})};function ka(){const{isLocked:e}=ue(),[t]=he(),n=t.get("lang"),s=cs(n),r=ls();return e||!s?i.jsx("div",{}):i.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r&&i.jsx(ua,{}),i.jsx(Gt,{permission:ie.EDIT_THEME,children:i.jsx(Na,{})}),i.jsx(Ia,{}),i.jsx(Gt,{permission:ie.SAVE_PAGE,children:i.jsx(La,{})}),i.jsx(Gt,{permission:ie.PUBLISH_PAGE,children:i.jsx(ja,{})})]})}const Ga=h.lazy(()=>Promise.resolve().then(()=>require("./dynamic-page-selector-btGtkyyv.cjs"))),Oa=()=>{const{dynamicPage:e,allLangPages:t,isFetching:n}=Xn(),s=t.length>0;return n?null:i.jsxs("div",{className:"relative",children:[!e&&i.jsx(ra,{hasDynamicPage:s}),i.jsx(h.Suspense,{children:i.jsx(Ga,{})})]})},Ra=()=>{const{data:e,isFetching:t}=ye(),{data:n,isFetching:s}=re(),r=p.get(n,"dynamic",!1),a=Pn(),o=N.useChaiFeatureFlag("dynamic-page-selector"),l=e==null?void 0:e.slug,c=!l,u=kr(),d=t||s,E=(c?`Partial: ${e==null?void 0:e.name} `:`${l}${a}`).replace(window.location.host,"");return i.jsxs("div",{className:"relative flex items-center",children:[i.jsx("div",{className:Dt.cn("flex h-8 w-auto max-w-[600px] items-center rounded-l-md border border-r-0 border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",d&&"max-w-0 overflow-hidden opacity-0"),children:i.jsx(sa,{})}),i.jsxs("div",{className:Dt.cn("flex h-8 w-auto max-w-[600px] items-center rounded-r-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800"+(c?" pr-2":""),d&&"max-w-0 overflow-hidden opacity-0"),children:[i.jsx(os,{}),i.jsxs("div",{className:"flex w-full items-center overflow-hidden",children:[i.jsx("div",{className:`w-full max-w-[200px] overflow-hidden overflow-ellipsis whitespace-nowrap pl-1 text-xs ${c?"italic text-gray-400":"font-mono text-gray-500"}`,children:E==="/"?i.jsxs("span",{className:"text-gray-900",children:["/",i.jsx("span",{className:"text-[11px] font-light italic text-gray-400",children:"(Homepage)"})]}):E}),!c&&i.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",children:i.jsx("div",{className:"ml-2 mr-px flex-shrink-0 rounded-sm p-1.5 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300",children:i.jsx(w.ExternalLink,{className:"h-4 w-4",strokeWidth:1})})})]})]}),r&&o&&i.jsx(Oa,{})]})},Da=()=>i.jsxs("div",{className:"grid h-full w-full grid-cols-3 items-center px-2",children:[i.jsx("div",{className:"flex justify-start",children:i.jsx(oa,{})}),i.jsx("div",{className:"flex justify-center",children:i.jsx(Ra,{})}),i.jsx("div",{className:"flex justify-end",children:i.jsx(ka,{})})]}),us=()=>{const e=T.useQueryClient(),{data:t}=T.useQuery({queryKey:[y.AI_CONTEXT],initialData:"",queryFn:()=>"",staleTime:0});return{setAiContext:h.useCallback(s=>{e.setQueryData([y.AI_CONTEXT],s)},[e]),aiContext:t}},Ma=()=>{const e=L(),{aiContext:t}=us(),n=k();return h.useCallback(async(s,r,a,o)=>n(e,{action:y.ASK_AI,data:{type:s,prompt:r,blocks:a,context:t,lang:o}}),[e,t,n])},Ua=e=>h.useMemo(()=>{if(!e||p.isEmpty(e))return{blocks:[]};const t=p.filter(e,n=>!p.includes(n==null?void 0:n._type,"@chai/"));return{blocks:Sr.syncBlocksWithDefaultProps(t)}},[e]),Ba=()=>{const[e]=he(),t=e.get("page"),n=L(),{setAiContext:s}=us(),[,r]=xn(),[,a]=jr(),[,o]=g.useIsPageLoaded(),l=k();return T.useQuery({queryKey:[y.GET_DRAFT_PAGE,t],staleTime:1/0,gcTime:0,queryFn:async()=>{o(!1);const c=await l(n,{action:y.GET_DRAFT_PAGE,data:{id:t,draft:!0}}),u=c.blocks??[],d=p.find(u,{_type:"@chai/ai-context"});return s(p.get(d,"_value","")||""),r(f=>({...f,lastSaved:c.lastSaved})),a(p.get(c,"metadata",{})),setTimeout(()=>o(!0),500),u},enabled:!!t})},ds=()=>{const{data:e}=re(),{data:t}=ye(),n=L(),s=k(),r=zt(),a=Pn();return T.useQuery({queryKey:[y.GET_BUILDER_PAGE_DATA,t==null?void 0:t.id,a],staleTime:1/0,gcTime:0,queryFn:async()=>s(n,{action:y.GET_BUILDER_PAGE_DATA,data:{pageType:e==null?void 0:e.pageType,lang:(t==null?void 0:t.lang)||r,dynamic:e==null?void 0:e.dynamic,pageProps:{slug:(t==null?void 0:t.slug)+a,searchParams:{},pageType:t==null?void 0:t.pageType,fallbackLang:r,lastSaved:t.lastSaved,pageId:e.id,primaryPageId:t.primaryPage||e.id,pageBaseSlug:t==null?void 0:t.slug,dynamic:e==null?void 0:e.dynamic,languagePageId:t.id,metadata:e.metadata||{}}}}),enabled:!!(e!=null&&e.pageType)&&!!t.id})},fs=()=>{const e=L(),t=T.useQueryClient(),n=k();return T.useMutation({mutationFn:async s=>n(e,{action:y.UPDATE_WEBSITE_FIELDS,data:s}),onSuccess:(s,r)=>{var a;t.invalidateQueries({queryKey:[y.GET_WEBSITE_DRAFT_SETTINGS]}),(a=r==null?void 0:r.settings)!=null&&a.theme||F.toast.success("Website settings updated successfully.")},onError:s=>{F.toast.error("Failed to update website settings",{description:s.message})}})},Fa=()=>{const e=L(),t=T.useQueryClient(),n=k(),{selectedLang:s}=g.useLanguages();return T.useMutation({mutationFn:async r=>n(e,{action:y.ADD_GLOBAL_SCHEMA,data:{...r,lang:s}}),onSuccess:()=>{t.invalidateQueries({queryKey:[y.GET_GLOBAL_JSONLD_ITEMS]}),F.toast.success("Schema added successfully.")},onError:r=>{F.toast.error("Failed to add schema",{description:r.message})}})},qa=()=>{const e=L(),t=T.useQueryClient(),n=k(),{selectedLang:s}=g.useLanguages();return T.useMutation({mutationFn:async r=>n(e,{action:y.UPDATE_GLOBAL_SCHEMA,data:{...r,lang:s}}),onSuccess:()=>{t.invalidateQueries({queryKey:[y.GET_GLOBAL_JSONLD_ITEMS]}),F.toast.success("Schema updated successfully.")},onError:r=>{F.toast.error("Failed to update schema",{description:r.message})}})},Ka=()=>{const e=L(),t=T.useQueryClient(),n=k();return T.useMutation({mutationFn:async s=>n(e,{action:y.DELETE_GLOBAL_SCHEMA,data:{id:s}}),onSuccess:()=>{t.invalidateQueries({queryKey:[y.GET_GLOBAL_JSONLD_ITEMS]}),F.toast.success("Schema deleted successfully.")},onError:s=>{F.toast.error("Failed to delete schema",{description:s.message})}})},Va=()=>{const e=L(),t=k();return T.useMutation({mutationFn:async n=>t(e,{action:y.TOGGLE_PAGE_GLOBAL_SCHEMA,data:n}),onError:n=>{F.toast.error("Failed to toggle schema",{description:n.message})}})},Ha=()=>{const e=L(),t=k();return T.useMutation({mutationFn:async n=>t(e,{action:y.APPLY_SCHEMA_TO_ALL_PAGES,data:{schemaId:n}}),onSuccess:n=>{F.toast.success(`Schema applied to ${n.count} page(s)`)},onError:n=>{F.toast.error("Failed to apply schema to all pages",{description:n.message})}})},Qa=()=>{const e=L(),t=k();return T.useMutation({mutationFn:async n=>t(e,{action:y.REMOVE_SCHEMA_FROM_ALL_PAGES,data:{schemaId:n}}),onSuccess:n=>{F.toast.success(`Schema removed from ${n.count} page(s)`)},onError:n=>{F.toast.error("Failed to remove schema from all pages",{description:n.message})}})},Dn={async getUILibraryBlock(e,t,n){const s=await t(n,{action:"GET_LIBRARY_ITEM",data:{id:e.id}}),r=p.get(s,"html",""),a=p.get(s,"blocks",[]);return p.isArray(a)?a:Tr.getBlocksFromHTML(r)},async getUILibraryBlocks(e,t,n){return(await t(n,{action:"GET_LIBRARY_ITEMS",data:{id:e.id}})).map(r=>({...r}))}},za=()=>{const e=L(),t=k();return T.useQuery({queryKey:["uiLibraries"],staleTime:"static",queryFn:async()=>{const s=(await t(e,{action:"GET_LIBRARIES"})).map(r=>({...r}));return s.forEach(r=>{N.registerChaiLibrary(r.id,{name:r.isSiteLibrary?r.name+" (Current Site) ":r.name,description:r.description,getBlocksList:a=>Dn.getUILibraryBlocks(a,t,e),getBlock:({block:a})=>Dn.getUILibraryBlock(a,t,e)})}),s}})},$a=(e=300)=>{const t=se("onLogout",p.noop),n=se("getAccessToken"),s=L();return T.useQuery({queryKey:["check-user-access"],queryFn:async()=>{const r=await n(),o=await Jn(s+"?action=check_user_access",{action:"CHECK_USER_ACCESS"},{Authorization:`Bearer ${r}`});if(o.status===401)throw console.log("401 Response",o),F.toast.error("You do not have access to edit this website. Please contact administrator"),await t("UNAUTHORIZED"),new Error("Unauthorized");return o},refetchInterval:e*1e3,refetchIntervalInBackground:!0,retry:!1})},hs=()=>{const e=L(),t=k(),{user:n}=Qt(),s=n==null?void 0:n.id;return T.useQuery({queryKey:[y.GET_ROLE_AND_PERMISSIONS,s],queryFn:()=>t(e,{action:y.GET_ROLE_AND_PERMISSIONS,data:{}}),enabled:!!s,staleTime:1/0})},Wa=()=>{const e=L(),t=k(),[,n]=xn(),s=T.useQueryClient();return{onSave:async({page:a,blocks:o,needTranslations:l})=>{try{const c=await t(e,{action:"UPDATE_PAGE",data:{id:a,blocks:o,needTranslations:l}});return c.code==="PAGE_LOCKED"?!0:(n(u=>({...u,lastSaved:new Date().toISOString()})),s.setQueryData([y.GET_LANGUAGE_PAGES,a],u=>u&&(u==null?void 0:u.map(d=>(d==null?void 0:d.id)===a?{...d,changes:["Page"]}:d))),s.setQueryData([y.GET_WEBSITE_PAGES],u=>u&&(u==null?void 0:u.map(d=>(d==null?void 0:d.id)===a?{...d,changes:["Page"]}:d))),c)}catch(c){return console.error(c),new Error("Failed to save blocks")}}}},Ya=()=>{const{data:e}=$t(),t=L(),n=k();return{getPartialBlocks:h.useCallback(async()=>{const s={};for(const r of e??[])p.isEmpty(r==null?void 0:r.slug)&&(s[r.id]={type:r.pageType,name:p.startCase(r.name??r.slug),description:""});return s},[e]),getPartialBlockBlocks:h.useCallback(async s=>{if(!s)return[];try{const r=await n(t,{action:"GET_DRAFT_PAGE",data:{id:s,draft:!0,editor:!1,mergePartials:!0}});return p.filter(r.blocks,a=>p.has(a,"_id"))}catch(r){return console.error(r),[]}},[n,t])}},Ja=h.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-content-BPpawv4D.cjs"))),gs="chai-chat-panel",Za=({className:e="h-full w-full"})=>i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512",version:"1.1",className:e,children:[i.jsx("title",{children:"ai"}),i.jsx("g",{id:"Page-1",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:i.jsx("g",{id:"icon",fill:"currentColor",transform:"translate(64.000000, 64.000000)",children:i.jsx("path",{d:"M320,64 L320,320 L64,320 L64,64 L320,64 Z M171.749388,128 L146.817842,128 L99.4840387,256 L121.976629,256 L130.913039,230.977 L187.575039,230.977 L196.319607,256 L220.167172,256 L171.749388,128 Z M260.093778,128 L237.691519,128 L237.691519,256 L260.093778,256 L260.093778,128 Z M159.094727,149.47526 L181.409039,213.333 L137.135039,213.333 L159.094727,149.47526 Z M341.333333,256 L384,256 L384,298.666667 L341.333333,298.666667 L341.333333,256 Z M85.3333333,341.333333 L128,341.333333 L128,384 L85.3333333,384 L85.3333333,341.333333 Z M170.666667,341.333333 L213.333333,341.333333 L213.333333,384 L170.666667,384 L170.666667,341.333333 Z M85.3333333,0 L128,0 L128,42.6666667 L85.3333333,42.6666667 L85.3333333,0 Z M256,341.333333 L298.666667,341.333333 L298.666667,384 L256,384 L256,341.333333 Z M170.666667,0 L213.333333,0 L213.333333,42.6666667 L170.666667,42.6666667 L170.666667,0 Z M256,0 L298.666667,0 L298.666667,42.6666667 L256,42.6666667 L256,0 Z M341.333333,170.666667 L384,170.666667 L384,213.333333 L341.333333,213.333333 L341.333333,170.666667 Z M0,256 L42.6666667,256 L42.6666667,298.666667 L0,298.666667 L0,256 Z M341.333333,85.3333333 L384,85.3333333 L384,128 L341.333333,128 L341.333333,85.3333333 Z M0,170.666667 L42.6666667,170.666667 L42.6666667,213.333333 L0,213.333333 L0,170.666667 Z M0,85.3333333 L42.6666667,85.3333333 L42.6666667,128 L0,128 L0,85.3333333 Z",id:"Combined-Shape"})})})]}),Xa=({isActive:e,show:t})=>g.useBuilderProp("flags.ai",!1)?i.jsx(N.Button,{size:"icon",className:"p-0 [&_svg]:size-6",onClick:t,variant:e?"default":"ghost",children:i.jsx(Za,{className:e?"h-5 w-5 text-white":"h-5 w-5 text-primary"})}):null,ei={id:gs,label:"AI Assistant",button:Xa,panel:Ja,position:"top"},ti=h.lazy(()=>Promise.resolve().then(()=>require("./lang-panel-BjDRrpwN.cjs"))),ni=({isActive:e,show:t})=>{const{data:n}=be();return!p.has(n,"languages")||!p.get(n,"languages",[]).length?null:i.jsx(N.Button,{size:"sm",onClick:t,variant:e?"default":"ghost",children:i.jsx(w.LanguagesIcon,{className:"h-4 w-4"})})},ms="lang",si={id:ms,label:"Languages",position:"top",panel:ti,button:ni,view:"modal",width:400},ri=h.lazy(()=>Promise.resolve().then(()=>require("./seo-panel-DXZvGYEM.cjs"))),Es="seo",ai=({isActive:e,show:t})=>{const{data:n}=re(),s=es(n==null?void 0:n.pageType);return!p.has(s,"hasSlug")||!s.hasSlug?null:i.jsx(N.Button,{size:"icon",className:"my-1 p-0",onClick:t,variant:e?"default":"ghost",children:i.jsxs("svg",{stroke:"currentColor",fill:"none",style:{height:"20px",width:"20px"},strokeWidth:"2",viewBox:"0 0 24 24",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M7 8h-3a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-3"}),i.jsx("path",{d:"M14 16h-4v-8h4"}),i.jsx("path",{d:"M11 12h2"}),i.jsx("path",{d:"M17 8m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"})]})})},ii={id:Es,label:"SEO",panel:ri,button:ai,position:"top",width:600,view:"modal"},oi=h.lazy(()=>Promise.resolve().then(()=>require("./change-password-modal-LKtYY-8V.cjs")).then(e=>({default:e.ChangePasswordModal}))),ps="user-info",li=()=>{const{t:e}=pe.useTranslation(),{user:t,logout:n}=Qt(),s=se("onLogout",p.noop),[r,a]=h.useState(!1);return t?i.jsxs(g.HoverCard,{children:[i.jsx(g.HoverCardTrigger,{asChild:!0,children:i.jsx(N.Button,{variant:"ghost",className:"text-sm font-medium",children:i.jsx(w.User,{className:"h-4 w-4"})})}),i.jsxs(g.HoverCardContent,{className:"w-auto space-y-2 p-4",children:[i.jsx("div",{className:"text-sm font-medium",children:t.name??t.email}),i.jsx("div",{className:"text-xs text-muted-foreground",children:t.email}),i.jsx(N.Button,{variant:"outline",size:"sm",className:"w-full",onClick:()=>a(!0),children:e("Change Password")}),r&&i.jsx(h.Suspense,{fallback:i.jsx(g.Dialog,{open:r,onOpenChange:a,children:i.jsx(g.DialogContent,{className:"sm:max-w-[425px]",children:i.jsx("div",{className:"flex h-[340px] items-center justify-center",children:i.jsx(w.Loader,{className:"h-8 w-8 animate-spin text-muted-foreground"})})})}),children:i.jsx(oi,{open:r,onOpenChange:a})}),i.jsxs(g.AlertDialog,{children:[i.jsx(g.AlertDialogTrigger,{asChild:!0,children:i.jsx(N.Button,{variant:"outline",size:"sm",className:"w-full",children:e("Logout")})}),i.jsxs(g.AlertDialogContent,{children:[i.jsxs(g.AlertDialogHeader,{children:[i.jsx(g.AlertDialogTitle,{children:e("Are you sure you want to logout?")}),i.jsx(g.AlertDialogDescription,{children:e("You will be redirected to the login page.")})]}),i.jsxs(g.AlertDialogFooter,{children:[i.jsx(g.AlertDialogCancel,{children:e("Cancel")}),i.jsx(g.AlertDialogAction,{onClick:()=>{n(),p.isFunction(s)&&s()},children:e("Logout")})]})]})]})]})]}):null},ci={id:ps,label:"User Info",button:li,position:"bottom"},ui=()=>{N.registerChaiSidebarPanel(Es,ii),N.registerChaiSidebarPanel(ms,si),N.registerChaiSidebarPanel(ps,ci),N.registerChaiSidebarPanel(gs,ei)};var I={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Mn(this.context.count)},getNextContextId(){return Mn(this.context.count++)}};function Mn(e){const t=String(e),n=t.length-1;return I.context.id+(n?String.fromCharCode(96+n):"")+t}function nt(e){I.context=e}var ys=!1,di=(e,t)=>e===t,Mt=Symbol("solid-proxy"),As=typeof Proxy=="function",Cn=Symbol("solid-track"),Ut={equals:di},Ss=Cs,Se=1,Bt=2,Ts={owned:null,cleanups:null,context:null,owner:null},on={},R=null,ln=null,fi=null,U=null,X=null,Ee=null,Jt=0;function Pe(e,t){const n=U,s=R,r=e.length===0,a=t===void 0?s:t,o=r?Ts:{owned:null,cleanups:null,context:a?a.context:null,owner:a},l=r?e:()=>e(()=>Y(()=>lt(o)));R=o,U=null;try{return fe(l,!0)}finally{U=n,R=s}}function K(e,t){t=t?Object.assign({},Ut,t):Ut;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},s=r=>(typeof r=="function"&&(r=r(n.value)),vs(n,r));return[bs.bind(n),s]}function Ps(e,t,n){const s=Zt(e,t,!0,Se);Xe(s)}function xe(e,t,n){const s=Zt(e,t,!1,Se);Xe(s)}function In(e,t,n){Ss=wi;const s=Zt(e,t,!1,Se);(!n||!n.render)&&(s.user=!0),Ee?Ee.push(s):Xe(s)}function W(e,t,n){n=n?Object.assign({},Ut,n):Ut;const s=Zt(e,t,!0,0);return s.observers=null,s.observerSlots=null,s.comparator=n.equals||void 0,Xe(s),bs.bind(s)}function hi(e){return e&&typeof e=="object"&&"then"in e}function gi(e,t,n){let s,r,a;s=!0,r=e,a={};let o=null,l=on,c=null,u=!1,d="initialValue"in a,f=typeof s=="function"&&W(s);const E=new Set,[m,S]=(a.storage||K)(a.initialValue),[v,_]=K(void 0),[b,A]=K(void 0,{equals:!1}),[C,M]=K(d?"ready":"unresolved");I.context&&(c=I.getNextContextId(),a.ssrLoadFrom==="initial"?l=a.initialValue:I.load&&I.has(c)&&(l=I.load(c)));function H(j,G,z,q){return o===j&&(o=null,q!==void 0&&(d=!0),(j===l||G===l)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(q,{value:G})),l=on,P(G,z)),G}function P(j,G){fe(()=>{G===void 0&&S(()=>j),M(G!==void 0?"errored":d?"ready":"unresolved"),_(G);for(const z of E.keys())z.decrement();E.clear()},!1)}function oe(){const j=Pi,G=m(),z=v();if(z!==void 0&&!o)throw z;return U&&U.user,G}function te(j=!0){if(j!==!1&&u)return;u=!1;const G=f?f():s;if(G==null||G===!1){H(o,Y(m));return}let z;const q=l!==on?l:Y(()=>{try{return r(G,{value:m(),refetching:j})}catch(ne){z=ne}});if(z!==void 0){H(o,void 0,Ot(z),G);return}else if(!hi(q))return H(o,q,void 0,G),q;return o=q,"v"in q?(q.s===1?H(o,q.v,void 0,G):H(o,void 0,Ot(q.v),G),q):(u=!0,queueMicrotask(()=>u=!1),fe(()=>{M(d?"refreshing":"pending"),A()},!1),q.then(ne=>H(q,ne,void 0,G),ne=>H(q,void 0,Ot(ne),G)))}Object.defineProperties(oe,{state:{get:()=>C()},error:{get:()=>v()},loading:{get(){const j=C();return j==="pending"||j==="refreshing"}},latest:{get(){if(!d)return oe();const j=v();if(j&&!o)throw j;return m()}}});let V=R;return f?Ps(()=>(V=R,te(!1))):te(!1),[oe,{refetch:j=>_s(V,()=>te(j)),mutate:S}]}function mi(e){return fe(e,!1)}function Y(e){if(U===null)return e();const t=U;U=null;try{return e()}finally{U=t}}function Ei(e,t,n){const s=Array.isArray(e);let r,a=n&&n.defer;return o=>{let l;if(s){l=Array(e.length);for(let u=0;u<e.length;u++)l[u]=e[u]()}else l=e();if(a)return a=!1,o;const c=Y(()=>t(l,r,o));return r=l,c}}function xs(e){In(()=>Y(e))}function Je(e){return R===null||(R.cleanups===null?R.cleanups=[e]:R.cleanups.push(e)),e}function Un(){return R}function _s(e,t){const n=R,s=U;R=e,U=null;try{return fe(t,!0)}catch(r){Nn(r)}finally{R=n,U=s}}function pi(e){const t=U,n=R;return Promise.resolve().then(()=>{U=t,R=n;let s;return fe(e,!1),U=R=null,s?s.done:void 0})}var[yi,jl]=K(!1);function Ai(){return[yi,pi]}function Si(e,t){const n=Symbol("context");return{id:n,Provider:bi(n),defaultValue:e}}function Ti(e){let t;return R&&R.context&&(t=R.context[e.id])!==void 0?t:e.defaultValue}function ws(e){const t=W(e),n=W(()=>fn(t()));return n.toArray=()=>{const s=n();return Array.isArray(s)?s:s!=null?[s]:[]},n}var Pi;function bs(){if(this.sources&&this.state)if(this.state===Se)Xe(this);else{const e=X;X=null,fe(()=>qt(this),!1),X=e}if(U){const e=this.observers?this.observers.length:0;U.sources?(U.sources.push(this),U.sourceSlots.push(e)):(U.sources=[this],U.sourceSlots=[e]),this.observers?(this.observers.push(U),this.observerSlots.push(U.sources.length-1)):(this.observers=[U],this.observerSlots=[U.sources.length-1])}return this.value}function vs(e,t,n){let s=e.value;return(!e.comparator||!e.comparator(s,t))&&(e.value=t,e.observers&&e.observers.length&&fe(()=>{for(let r=0;r<e.observers.length;r+=1){const a=e.observers[r],o=ln&&ln.running;o&&ln.disposed.has(a),(o?!a.tState:!a.state)&&(a.pure?X.push(a):Ee.push(a),a.observers&&Is(a)),o||(a.state=Se)}if(X.length>1e6)throw X=[],new Error},!1)),t}function Xe(e){if(!e.fn)return;lt(e);const t=Jt;xi(e,e.value,t)}function xi(e,t,n){let s;const r=R,a=U;U=R=e;try{s=e.fn(t)}catch(o){return e.pure&&(e.state=Se,e.owned&&e.owned.forEach(lt),e.owned=null),e.updatedAt=n+1,Nn(o)}finally{U=a,R=r}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?vs(e,s):e.value=s,e.updatedAt=n)}function Zt(e,t,n,s=Se,r){const a={fn:e,state:s,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:R,context:R?R.context:null,pure:n};return R===null||R!==Ts&&(R.owned?R.owned.push(a):R.owned=[a]),a}function Ft(e){if(e.state===0)return;if(e.state===Bt)return qt(e);if(e.suspense&&Y(e.suspense.inFallback))return e.suspense.effects.push(e);const t=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<Jt);)e.state&&t.push(e);for(let n=t.length-1;n>=0;n--)if(e=t[n],e.state===Se)Xe(e);else if(e.state===Bt){const s=X;X=null,fe(()=>qt(e,t[0]),!1),X=s}}function fe(e,t){if(X)return e();let n=!1;t||(X=[]),Ee?n=!0:Ee=[],Jt++;try{const s=e();return _i(n),s}catch(s){n||(Ee=null),X=null,Nn(s)}}function _i(e){if(X&&(Cs(X),X=null),e)return;const t=Ee;Ee=null,t.length&&fe(()=>Ss(t),!1)}function Cs(e){for(let t=0;t<e.length;t++)Ft(e[t])}function wi(e){let t,n=0;for(t=0;t<e.length;t++){const s=e[t];s.user?e[n++]=s:Ft(s)}if(I.context){if(I.count){I.effects||(I.effects=[]),I.effects.push(...e.slice(0,n));return}nt()}for(I.effects&&(I.done||!I.count)&&(e=[...I.effects,...e],n+=I.effects.length,delete I.effects),t=0;t<n;t++)Ft(e[t])}function qt(e,t){e.state=0;for(let n=0;n<e.sources.length;n+=1){const s=e.sources[n];if(s.sources){const r=s.state;r===Se?s!==t&&(!s.updatedAt||s.updatedAt<Jt)&&Ft(s):r===Bt&&qt(s,t)}}}function Is(e){for(let t=0;t<e.observers.length;t+=1){const n=e.observers[t];n.state||(n.state=Bt,n.pure?X.push(n):Ee.push(n),n.observers&&Is(n))}}function lt(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),s=e.sourceSlots.pop(),r=n.observers;if(r&&r.length){const a=r.pop(),o=n.observerSlots.pop();s<r.length&&(a.sourceSlots[o]=s,r[s]=a,n.observerSlots[s]=o)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)lt(e.tOwned[t]);delete e.tOwned}if(e.owned){for(t=e.owned.length-1;t>=0;t--)lt(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}e.state=0}function Ot(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function Nn(e,t=R){throw Ot(e)}function fn(e){if(typeof e=="function"&&!e.length)return fn(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const s=fn(e[n]);Array.isArray(s)?t.push.apply(t,s):t.push(s)}return t}return e}function bi(e,t){return function(s){let r;return xe(()=>r=Y(()=>(R.context={...R.context,[e]:s.value},ws(()=>s.children))),void 0),r}}var hn=Symbol("fallback");function Kt(e){for(let t=0;t<e.length;t++)e[t]()}function vi(e,t,n={}){let s=[],r=[],a=[],o=0,l=t.length>1?[]:null;return Je(()=>Kt(a)),()=>{let c=e()||[],u=c.length,d,f;return c[Cn],Y(()=>{let m,S,v,_,b,A,C,M,H;if(u===0)o!==0&&(Kt(a),a=[],s=[],r=[],o=0,l&&(l=[])),n.fallback&&(s=[hn],r[0]=Pe(P=>(a[0]=P,n.fallback())),o=1);else if(o===0){for(r=new Array(u),f=0;f<u;f++)s[f]=c[f],r[f]=Pe(E);o=u}else{for(v=new Array(u),_=new Array(u),l&&(b=new Array(u)),A=0,C=Math.min(o,u);A<C&&s[A]===c[A];A++);for(C=o-1,M=u-1;C>=A&&M>=A&&s[C]===c[M];C--,M--)v[M]=r[C],_[M]=a[C],l&&(b[M]=l[C]);for(m=new Map,S=new Array(M+1),f=M;f>=A;f--)H=c[f],d=m.get(H),S[f]=d===void 0?-1:d,m.set(H,f);for(d=A;d<=C;d++)H=s[d],f=m.get(H),f!==void 0&&f!==-1?(v[f]=r[d],_[f]=a[d],l&&(b[f]=l[d]),f=S[f],m.set(H,f)):a[d]();for(f=A;f<u;f++)f in v?(r[f]=v[f],a[f]=_[f],l&&(l[f]=b[f],l[f](f))):r[f]=Pe(E);r=r.slice(0,o=u),s=c.slice(0)}return r});function E(m){if(a[f]=m,l){const[S,v]=K(f);return l[f]=v,t(c[f],S)}return t(c[f])}}}function Ci(e,t,n={}){let s=[],r=[],a=[],o=[],l=0,c;return Je(()=>Kt(a)),()=>{const u=e()||[],d=u.length;return u[Cn],Y(()=>{if(d===0)return l!==0&&(Kt(a),a=[],s=[],r=[],l=0,o=[]),n.fallback&&(s=[hn],r[0]=Pe(E=>(a[0]=E,n.fallback())),l=1),r;for(s[0]===hn&&(a[0](),a=[],s=[],r=[],l=0),c=0;c<d;c++)c<s.length&&s[c]!==u[c]?o[c](()=>u[c]):c>=s.length&&(r[c]=Pe(f));for(;c<s.length;c++)a[c]();return l=o.length=a.length=d,s=u.slice(0),r=r.slice(0,l)});function f(E){a[c]=E;const[m,S]=K(u[c]);return o[c]=S,t(m,c)}}}function Ln(e,t){return Y(()=>e(t||{}))}function Lt(){return!0}var gn={get(e,t,n){return t===Mt?n:e.get(t)},has(e,t){return t===Mt?!0:e.has(t)},set:Lt,deleteProperty:Lt,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:Lt,deleteProperty:Lt}},ownKeys(e){return e.keys()}};function cn(e){return(e=typeof e=="function"?e():e)?e:{}}function Ii(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function jn(...e){let t=!1;for(let o=0;o<e.length;o++){const l=e[o];t=t||!!l&&Mt in l,e[o]=typeof l=="function"?(t=!0,W(l)):l}if(As&&t)return new Proxy({get(o){for(let l=e.length-1;l>=0;l--){const c=cn(e[l])[o];if(c!==void 0)return c}},has(o){for(let l=e.length-1;l>=0;l--)if(o in cn(e[l]))return!0;return!1},keys(){const o=[];for(let l=0;l<e.length;l++)o.push(...Object.keys(cn(e[l])));return[...new Set(o)]}},gn);const n={},s=Object.create(null);for(let o=e.length-1;o>=0;o--){const l=e[o];if(!l)continue;const c=Object.getOwnPropertyNames(l);for(let u=c.length-1;u>=0;u--){const d=c[u];if(d==="__proto__"||d==="constructor")continue;const f=Object.getOwnPropertyDescriptor(l,d);if(!s[d])s[d]=f.get?{enumerable:!0,configurable:!0,get:Ii.bind(n[d]=[f.get.bind(l)])}:f.value!==void 0?f:void 0;else{const E=n[d];E&&(f.get?E.push(f.get.bind(l)):f.value!==void 0&&E.push(()=>f.value))}}}const r={},a=Object.keys(s);for(let o=a.length-1;o>=0;o--){const l=a[o],c=s[l];c&&c.get?Object.defineProperty(r,l,c):r[l]=c?c.value:void 0}return r}function Ns(e,...t){if(As&&Mt in e){const r=new Set(t.length>1?t.flat():t[0]),a=t.map(o=>new Proxy({get(l){return o.includes(l)?e[l]:void 0},has(l){return o.includes(l)&&l in e},keys(){return o.filter(l=>l in e)}},gn));return a.push(new Proxy({get(o){return r.has(o)?void 0:e[o]},has(o){return r.has(o)?!1:o in e},keys(){return Object.keys(e).filter(o=>!r.has(o))}},gn)),a}const n={},s=t.map(()=>({}));for(const r of Object.getOwnPropertyNames(e)){const a=Object.getOwnPropertyDescriptor(e,r),o=!a.get&&!a.set&&a.enumerable&&a.writable&&a.configurable;let l=!1,c=0;for(const u of t)u.includes(r)&&(l=!0,o?s[c][r]=a.value:Object.defineProperty(s[c],r,a)),++c;l||(o?n[r]=a.value:Object.defineProperty(n,r,a))}return[...s,n]}function Ls(e){let t,n;const s=r=>{const a=I.context;if(a){const[l,c]=K();I.count||(I.count=0),I.count++,(n||(n=e())).then(u=>{!I.done&&nt(a),I.count--,c(()=>u.default),nt()}),t=l}else if(!t){const[l]=gi(()=>(n||(n=e())).then(c=>c.default));t=l}let o;return W(()=>(o=t())?Y(()=>{if(!a||I.done)return o(r);const l=I.context;nt(a);const c=o(r);return nt(l),c}):"")};return s.preload=()=>n||((n=e()).then(r=>t=()=>r.default),n),s}var Ni=0;function Li(){return I.context?I.getNextContextId():`cl-${Ni++}`}var js=e=>`Stale read from <${e}>.`;function ji(e){const t="fallback"in e&&{fallback:()=>e.fallback};return W(vi(()=>e.each,e.children,t||void 0))}function ki(e){const t="fallback"in e&&{fallback:()=>e.fallback};return W(Ci(()=>e.each,e.children,t||void 0))}function Gi(e){const t=e.keyed,n=W(()=>e.when,void 0,void 0),s=t?n:W(n,void 0,{equals:(r,a)=>!r==!a});return W(()=>{const r=s();if(r){const a=e.children;return typeof a=="function"&&a.length>0?Y(()=>a(t?r:()=>{if(!Y(s))throw js("Show");return n()})):a}return e.fallback},void 0,void 0)}function Oi(e){const t=ws(()=>e.children),n=W(()=>{const s=t(),r=Array.isArray(s)?s:[s];let a=()=>{};for(let o=0;o<r.length;o++){const l=o,c=r[o],u=a,d=W(()=>u()?void 0:c.when,void 0,void 0),f=c.keyed?d:W(d,void 0,{equals:(E,m)=>!E==!m});a=()=>u()||(f()?[l,d,c]:void 0)}return a});return W(()=>{const s=n()();if(!s)return e.fallback;const[r,a,o]=s,l=o.children;return typeof l=="function"&&l.length>0?Y(()=>l(o.keyed?a():()=>{var u;if(((u=Y(n)())==null?void 0:u[0])!==r)throw js("Match");return a()})):l},void 0,void 0)}function Ri(e){return e}var Di=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected"],Mi=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline",...Di]),Ui=new Set(["innerHTML","textContent","innerText","children"]),Bi=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),Fi=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1}});function qi(e,t){const n=Fi[e];return typeof n=="object"?n[t]?n.$:void 0:n}var Ki=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),Vi=new Set(["altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","set","stop","svg","switch","symbol","text","textPath","tref","tspan","use","view","vkern"]),Hi={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},Qi=e=>W(()=>e());function zi(e,t,n){let s=n.length,r=t.length,a=s,o=0,l=0,c=t[r-1].nextSibling,u=null;for(;o<r||l<a;){if(t[o]===n[l]){o++,l++;continue}for(;t[r-1]===n[a-1];)r--,a--;if(r===o){const d=a<s?l?n[l-1].nextSibling:n[a-l]:c;for(;l<a;)e.insertBefore(n[l++],d)}else if(a===l)for(;o<r;)(!u||!u.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[l]===t[r-1]){const d=t[--r].nextSibling;e.insertBefore(n[l++],t[o++].nextSibling),e.insertBefore(n[--a],d),t[r]=n[a]}else{if(!u){u=new Map;let f=l;for(;f<a;)u.set(n[f],f++)}const d=u.get(t[o]);if(d!=null)if(l<d&&d<a){let f=o,E=1,m;for(;++f<r&&f<a&&!((m=u.get(t[f]))==null||m!==d+E);)E++;if(E>d-l){const S=t[o];for(;l<d;)e.insertBefore(n[l++],S)}else e.replaceChild(n[l++],t[o++])}else o++;else t[o++].remove()}}}var at="_$DX_DELEGATE";function ks(e,t,n,s={}){let r;return Pe(a=>{r=a,t===document?e():Ht(t,e(),t.firstChild?null:void 0,n)},s.owner),()=>{r(),t.textContent=""}}function $i(e,t,n,s){let r;const a=()=>{const l=document.createElement("template");return l.innerHTML=e,l.content.firstChild},o=()=>(r||(r=a())).cloneNode(!0);return o.cloneNode=o,o}function Gs(e,t=window.document){const n=t[at]||(t[at]=new Set);for(let s=0,r=e.length;s<r;s++){const a=e[s];n.has(a)||(n.add(a),t.addEventListener(a,Us))}}function Wi(e=window.document){if(e[at]){for(let t of e[at].keys())e.removeEventListener(t,Us);delete e[at]}}function Vt(e,t,n){Ne(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function Yi(e,t,n,s){Ne(e)||(s==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,s))}function Ji(e,t,n){Ne(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function Os(e,t){Ne(e)||(t==null?e.removeAttribute("class"):e.className=t)}function Rs(e,t,n,s){if(s)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const r=n[0];e.addEventListener(t,n[0]=a=>r.call(e,n[1],a))}else e.addEventListener(t,n,typeof n!="function"&&n)}function Zi(e,t,n={}){const s=Object.keys(t||{}),r=Object.keys(n);let a,o;for(a=0,o=r.length;a<o;a++){const l=r[a];!l||l==="undefined"||t[l]||(Bn(e,l,!1),delete n[l])}for(a=0,o=s.length;a<o;a++){const l=s[a],c=!!t[l];!l||l==="undefined"||n[l]===c||!c||(Bn(e,l,!0),n[l]=c)}return n}function Xi(e,t,n){if(!t)return n?Vt(e,"style"):t;const s=e.style;if(typeof t=="string")return s.cssText=t;typeof n=="string"&&(s.cssText=n=void 0),n||(n={}),t||(t={});let r,a;for(a in n)t[a]==null&&s.removeProperty(a),delete n[a];for(a in t)r=t[a],r!==n[a]&&(s.setProperty(a,r),n[a]=r);return n}function Ds(e,t={},n,s){const r={};return s||xe(()=>r.children=ct(e,t.children,r.children)),xe(()=>typeof t.ref=="function"&&Ms(t.ref,e)),xe(()=>eo(e,t,n,!0,r,!0)),r}function Ms(e,t,n){return Y(()=>e(t,n))}function Ht(e,t,n,s){if(n!==void 0&&!s&&(s=[]),typeof t!="function")return ct(e,t,s,n);xe(r=>ct(e,t(),r,n),s)}function eo(e,t,n,s,r={},a=!1){t||(t={});for(const o in r)if(!(o in t)){if(o==="children")continue;r[o]=Fn(e,o,null,r[o],n,a,t)}for(const o in t){if(o==="children")continue;const l=t[o];r[o]=Fn(e,o,l,r[o],n,a,t)}}function to(e){let t,n;return!Ne()||!(t=I.registry.get(n=so()))?e():(I.completed&&I.completed.add(t),I.registry.delete(n),t)}function Ne(e){return!!I.context&&!I.done&&(!e||e.isConnected)}function no(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Bn(e,t,n){const s=t.trim().split(/\s+/);for(let r=0,a=s.length;r<a;r++)e.classList.toggle(s[r],n)}function Fn(e,t,n,s,r,a,o){let l,c,u,d,f;if(t==="style")return Xi(e,n,s);if(t==="classList")return Zi(e,n,s);if(n===s)return s;if(t==="ref")a||n(e);else if(t.slice(0,3)==="on:"){const E=t.slice(3);s&&e.removeEventListener(E,s,typeof s!="function"&&s),n&&e.addEventListener(E,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const E=t.slice(10);s&&e.removeEventListener(E,s,!0),n&&e.addEventListener(E,n,!0)}else if(t.slice(0,2)==="on"){const E=t.slice(2).toLowerCase(),m=Ki.has(E);if(!m&&s){const S=Array.isArray(s)?s[0]:s;e.removeEventListener(E,S)}(m||n)&&(Rs(e,E,n,m),m&&Gs([E]))}else if(t.slice(0,5)==="attr:")Vt(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")Ji(e,t.slice(5),n);else if((f=t.slice(0,5)==="prop:")||(u=Ui.has(t))||!r&&((d=qi(t,e.tagName))||(c=Mi.has(t)))||(l=e.nodeName.includes("-")||"is"in o)){if(f)t=t.slice(5),c=!0;else if(Ne(e))return n;t==="class"||t==="className"?Os(e,n):l&&!c&&!u?e[no(t)]=n:e[d||t]=n}else{const E=r&&t.indexOf(":")>-1&&Hi[t.split(":")[0]];E?Yi(e,E,t,n):Vt(e,Bi[t]||t,n)}return n}function Us(e){if(I.registry&&I.events&&I.events.find(([c,u])=>u===e))return;let t=e.target;const n=`$$${e.type}`,s=e.target,r=e.currentTarget,a=c=>Object.defineProperty(e,"target",{configurable:!0,value:c}),o=()=>{const c=t[n];if(c&&!t.disabled){const u=t[`${n}Data`];if(u!==void 0?c.call(t,u,e):c.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},l=()=>{for(;o()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),I.registry&&!I.done&&(I.done=_$HY.done=!0),e.composedPath){const c=e.composedPath();a(c[0]);for(let u=0;u<c.length-2&&(t=c[u],!!o());u++){if(t._$host){t=t._$host,l();break}if(t.parentNode===r)break}}else l();a(s)}function ct(e,t,n,s,r){const a=Ne(e);if(a){!n&&(n=[...e.childNodes]);let c=[];for(let u=0;u<n.length;u++){const d=n[u];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():c.push(d)}n=c}for(;typeof n=="function";)n=n();if(t===n)return n;const o=typeof t,l=s!==void 0;if(e=l&&n[0]&&n[0].parentNode||e,o==="string"||o==="number"){if(a||o==="number"&&(t=t.toString(),t===n))return n;if(l){let c=n[0];c&&c.nodeType===3?c.data!==t&&(c.data=t):c=document.createTextNode(t),n=je(e,n,s,c)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||o==="boolean"){if(a)return n;n=je(e,n,s)}else{if(o==="function")return xe(()=>{let c=t();for(;typeof c=="function";)c=c();n=ct(e,c,n,s)}),()=>n;if(Array.isArray(t)){const c=[],u=n&&Array.isArray(n);if(mn(c,t,n,r))return xe(()=>n=ct(e,c,n,s,!0)),()=>n;if(a){if(!c.length)return n;if(s===void 0)return n=[...e.childNodes];let d=c[0];if(d.parentNode!==e)return n;const f=[d];for(;(d=d.nextSibling)!==s;)f.push(d);return n=f}if(c.length===0){if(n=je(e,n,s),l)return n}else u?n.length===0?qn(e,c,s):zi(e,n,c):(n&&je(e),qn(e,c));n=c}else if(t.nodeType){if(a&&t.parentNode)return n=l?[t]:t;if(Array.isArray(n)){if(l)return n=je(e,n,s,t);je(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function mn(e,t,n,s){let r=!1;for(let a=0,o=t.length;a<o;a++){let l=t[a],c=n&&n[e.length],u;if(!(l==null||l===!0||l===!1))if((u=typeof l)=="object"&&l.nodeType)e.push(l);else if(Array.isArray(l))r=mn(e,l,c)||r;else if(u==="function")if(s){for(;typeof l=="function";)l=l();r=mn(e,Array.isArray(l)?l:[l],Array.isArray(c)?c:[c])||r}else e.push(l),r=!0;else{const d=String(l);c&&c.nodeType===3&&c.data===d?e.push(c):e.push(document.createTextNode(d))}}return r}function qn(e,t,n=null){for(let s=0,r=t.length;s<r;s++)e.insertBefore(t[s],n)}function je(e,t,n,s){if(n===void 0)return e.textContent="";const r=s||document.createTextNode("");if(t.length){let a=!1;for(let o=t.length-1;o>=0;o--){const l=t[o];if(r!==l){const c=l.parentNode===e;!a&&!o?c?e.replaceChild(r,l):e.insertBefore(r,n):c&&l.remove()}else a=!0}}else e.insertBefore(r,n);return[r]}function so(){return I.getNextContextId()}var ro="http://www.w3.org/2000/svg";function Bs(e,t=!1){return t?document.createElementNS(ro,e):document.createElement(e)}function ao(e){const{useShadow:t}=e,n=document.createTextNode(""),s=()=>e.mount||document.body,r=Un();let a,o=!!I.context;return In(()=>{o&&(Un().user=o=!1),a||(a=_s(r,()=>W(()=>e.children)));const l=s();if(l instanceof HTMLHeadElement){const[c,u]=K(!1),d=()=>u(!0);Pe(f=>Ht(l,()=>c()?f():a(),null)),Je(d)}else{const c=Bs(e.isSVG?"g":"div",e.isSVG),u=t&&c.attachShadow?c.attachShadow({mode:"open"}):c;Object.defineProperty(c,"_$host",{get(){return n.parentNode},configurable:!0}),Ht(u,a),l.appendChild(c),e.ref&&e.ref(c),Je(()=>l.removeChild(c))}},void 0,{render:!o}),n}function io(e,t){const n=W(e);return W(()=>{const s=n();switch(typeof s){case"function":return Y(()=>s(t));case"string":const r=Vi.has(s),a=I.context?to():Bs(s,r);return Ds(a,t,r),a}})}function oo(e){const[,t]=Ns(e,["component"]);return io(()=>e.component,t)}var lo=class{constructor(){this.keyToValue=new Map,this.valueToKey=new Map}set(e,t){this.keyToValue.set(e,t),this.valueToKey.set(t,e)}getByKey(e){return this.keyToValue.get(e)}getByValue(e){return this.valueToKey.get(e)}clear(){this.keyToValue.clear(),this.valueToKey.clear()}},Fs=class{constructor(e){this.generateIdentifier=e,this.kv=new lo}register(e,t){this.kv.getByValue(e)||(t||(t=this.generateIdentifier(e)),this.kv.set(t,e))}clear(){this.kv.clear()}getIdentifier(e){return this.kv.getByValue(e)}getValue(e){return this.kv.getByKey(e)}},co=class extends Fs{constructor(){super(e=>e.name),this.classToAllowedProps=new Map}register(e,t){typeof t=="object"?(t.allowProps&&this.classToAllowedProps.set(e,t.allowProps),super.register(e,t.identifier)):super.register(e,t)}getAllowedProps(e){return this.classToAllowedProps.get(e)}};function uo(e){if("values"in Object)return Object.values(e);const t=[];for(const n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t}function fo(e,t){const n=uo(e);if("find"in n)return n.find(t);const s=n;for(let r=0;r<s.length;r++){const a=s[r];if(t(a))return a}}function Ze(e,t){Object.entries(e).forEach(([n,s])=>t(s,n))}function Rt(e,t){return e.indexOf(t)!==-1}function Kn(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s))return s}}var ho=class{constructor(){this.transfomers={}}register(e){this.transfomers[e.name]=e}findApplicable(e){return fo(this.transfomers,t=>t.isApplicable(e))}findByName(e){return this.transfomers[e]}},go=e=>Object.prototype.toString.call(e).slice(8,-1),qs=e=>typeof e>"u",mo=e=>e===null,ut=e=>typeof e!="object"||e===null||e===Object.prototype?!1:Object.getPrototypeOf(e)===null?!0:Object.getPrototypeOf(e)===Object.prototype,En=e=>ut(e)&&Object.keys(e).length===0,_e=e=>Array.isArray(e),Eo=e=>typeof e=="string",po=e=>typeof e=="number"&&!isNaN(e),yo=e=>typeof e=="boolean",Ao=e=>e instanceof RegExp,dt=e=>e instanceof Map,ft=e=>e instanceof Set,Ks=e=>go(e)==="Symbol",So=e=>e instanceof Date&&!isNaN(e.valueOf()),To=e=>e instanceof Error,Vn=e=>typeof e=="number"&&isNaN(e),Po=e=>yo(e)||mo(e)||qs(e)||po(e)||Eo(e)||Ks(e),xo=e=>typeof e=="bigint",_o=e=>e===1/0||e===-1/0,wo=e=>ArrayBuffer.isView(e)&&!(e instanceof DataView),bo=e=>e instanceof URL,Vs=e=>e.replace(/\./g,"\\."),un=e=>e.map(String).map(Vs).join("."),it=e=>{const t=[];let n="";for(let r=0;r<e.length;r++){let a=e.charAt(r);if(a==="\\"&&e.charAt(r+1)==="."){n+=".",r++;continue}if(a==="."){t.push(n),n="";continue}n+=a}const s=n;return t.push(s),t};function de(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Hs=[de(qs,"undefined",()=>null,()=>{}),de(xo,"bigint",e=>e.toString(),e=>typeof BigInt<"u"?BigInt(e):e),de(So,"Date",e=>e.toISOString(),e=>new Date(e)),de(To,"Error",(e,t)=>{const n={name:e.name,message:e.message};return t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n},(e,t)=>{const n=new Error(e.message);return n.name=e.name,n.stack=e.stack,t.allowedErrorProps.forEach(s=>{n[s]=e[s]}),n}),de(Ao,"regexp",e=>""+e,e=>{const t=e.slice(1,e.lastIndexOf("/")),n=e.slice(e.lastIndexOf("/")+1);return new RegExp(t,n)}),de(ft,"set",e=>[...e.values()],e=>new Set(e)),de(dt,"map",e=>[...e.entries()],e=>new Map(e)),de(e=>Vn(e)||_o(e),"number",e=>Vn(e)?"NaN":e>0?"Infinity":"-Infinity",Number),de(e=>e===0&&1/e===-1/0,"number",()=>"-0",Number),de(bo,"URL",e=>e.toString(),e=>new URL(e))];function Xt(e,t,n,s){return{isApplicable:e,annotation:t,transform:n,untransform:s}}var Qs=Xt((e,t)=>Ks(e)?!!t.symbolRegistry.getIdentifier(e):!1,(e,t)=>["symbol",t.symbolRegistry.getIdentifier(e)],e=>e.description,(e,t,n)=>{const s=n.symbolRegistry.getValue(t[1]);if(!s)throw new Error("Trying to deserialize unknown symbol");return s}),vo=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,Uint8ClampedArray].reduce((e,t)=>(e[t.name]=t,e),{}),zs=Xt(wo,e=>["typed-array",e.constructor.name],e=>[...e],(e,t)=>{const n=vo[t[1]];if(!n)throw new Error("Trying to deserialize unknown typed array");return new n(e)});function $s(e,t){return e!=null&&e.constructor?!!t.classRegistry.getIdentifier(e.constructor):!1}var Ws=Xt($s,(e,t)=>["class",t.classRegistry.getIdentifier(e.constructor)],(e,t)=>{const n=t.classRegistry.getAllowedProps(e.constructor);if(!n)return{...e};const s={};return n.forEach(r=>{s[r]=e[r]}),s},(e,t,n)=>{const s=n.classRegistry.getValue(t[1]);if(!s)throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);return Object.assign(Object.create(s.prototype),e)}),Ys=Xt((e,t)=>!!t.customTransformerRegistry.findApplicable(e),(e,t)=>["custom",t.customTransformerRegistry.findApplicable(e).name],(e,t)=>t.customTransformerRegistry.findApplicable(e).serialize(e),(e,t,n)=>{const s=n.customTransformerRegistry.findByName(t[1]);if(!s)throw new Error("Trying to deserialize unknown custom value");return s.deserialize(e)}),Co=[Ws,Qs,Ys,zs],Hn=(e,t)=>{const n=Kn(Co,r=>r.isApplicable(e,t));if(n)return{value:n.transform(e,t),type:n.annotation(e,t)};const s=Kn(Hs,r=>r.isApplicable(e,t));if(s)return{value:s.transform(e,t),type:s.annotation}},Js={};Hs.forEach(e=>{Js[e.annotation]=e});var Io=(e,t,n)=>{if(_e(t))switch(t[0]){case"symbol":return Qs.untransform(e,t,n);case"class":return Ws.untransform(e,t,n);case"custom":return Ys.untransform(e,t,n);case"typed-array":return zs.untransform(e,t,n);default:throw new Error("Unknown transformation: "+t)}else{const s=Js[t];if(!s)throw new Error("Unknown transformation: "+t);return s.untransform(e,n)}},ke=(e,t)=>{if(t>e.size)throw new Error("index out of bounds");const n=e.keys();for(;t>0;)n.next(),t--;return n.next().value};function Zs(e){if(Rt(e,"__proto__"))throw new Error("__proto__ is not allowed as a property");if(Rt(e,"prototype"))throw new Error("prototype is not allowed as a property");if(Rt(e,"constructor"))throw new Error("constructor is not allowed as a property")}var No=(e,t)=>{Zs(t);for(let n=0;n<t.length;n++){const s=t[n];if(ft(e))e=ke(e,+s);else if(dt(e)){const r=+s,a=+t[++n]==0?"key":"value",o=ke(e,r);switch(a){case"key":e=o;break;case"value":e=e.get(o);break}}else e=e[s]}return e},pn=(e,t,n)=>{if(Zs(t),t.length===0)return n(e);let s=e;for(let a=0;a<t.length-1;a++){const o=t[a];if(_e(s)){const l=+o;s=s[l]}else if(ut(s))s=s[o];else if(ft(s)){const l=+o;s=ke(s,l)}else if(dt(s)){if(a===t.length-2)break;const c=+o,u=+t[++a]==0?"key":"value",d=ke(s,c);switch(u){case"key":s=d;break;case"value":s=s.get(d);break}}}const r=t[t.length-1];if(_e(s)?s[+r]=n(s[+r]):ut(s)&&(s[r]=n(s[r])),ft(s)){const a=ke(s,+r),o=n(a);a!==o&&(s.delete(a),s.add(o))}if(dt(s)){const a=+t[t.length-2],o=ke(s,a);switch(+r==0?"key":"value"){case"key":{const c=n(o);s.set(c,s.get(o)),c!==o&&s.delete(o);break}case"value":{s.set(o,n(s.get(o)));break}}}return e};function yn(e,t,n=[]){if(!e)return;if(!_e(e)){Ze(e,(a,o)=>yn(a,t,[...n,...it(o)]));return}const[s,r]=e;r&&Ze(r,(a,o)=>{yn(a,t,[...n,...it(o)])}),t(s,n)}function Lo(e,t,n){return yn(t,(s,r)=>{e=pn(e,r,a=>Io(a,s,n))}),e}function jo(e,t){function n(s,r){const a=No(e,it(r));s.map(it).forEach(o=>{e=pn(e,o,()=>a)})}if(_e(t)){const[s,r]=t;s.forEach(a=>{e=pn(e,it(a),()=>e)}),r&&Ze(r,n)}else Ze(t,n);return e}var ko=(e,t)=>ut(e)||_e(e)||dt(e)||ft(e)||$s(e,t);function Go(e,t,n){const s=n.get(e);s?s.push(t):n.set(e,[t])}function Oo(e,t){const n={};let s;return e.forEach(r=>{if(r.length<=1)return;t||(r=r.map(l=>l.map(String)).sort((l,c)=>l.length-c.length));const[a,...o]=r;a.length===0?s=o.map(un):n[un(a)]=o.map(un)}),s?En(n)?[s]:[s,n]:En(n)?void 0:n}var Xs=(e,t,n,s,r=[],a=[],o=new Map)=>{const l=Po(e);if(!l){Go(e,r,t);const m=o.get(e);if(m)return s?{transformedValue:null}:m}if(!ko(e,n)){const m=Hn(e,n),S=m?{transformedValue:m.value,annotations:[m.type]}:{transformedValue:e};return l||o.set(e,S),S}if(Rt(a,e))return{transformedValue:null};const c=Hn(e,n),u=(c==null?void 0:c.value)??e,d=_e(u)?[]:{},f={};Ze(u,(m,S)=>{if(S==="__proto__"||S==="constructor"||S==="prototype")throw new Error(`Detected property ${S}. This is a prototype pollution risk, please remove it from your object.`);const v=Xs(m,t,n,s,[...r,S],[...a,e],o);d[S]=v.transformedValue,_e(v.annotations)?f[S]=v.annotations:ut(v.annotations)&&Ze(v.annotations,(_,b)=>{f[Vs(S)+"."+b]=_})});const E=En(f)?{transformedValue:d,annotations:c?[c.type]:void 0}:{transformedValue:d,annotations:c?[c.type,f]:f};return l||o.set(e,E),E};function er(e){return Object.prototype.toString.call(e).slice(8,-1)}function Qn(e){return er(e)==="Array"}function Ro(e){if(er(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return!!t&&t.constructor===Object&&t===Object.prototype}function Do(e,t,n,s,r){const a={}.propertyIsEnumerable.call(s,t)?"enumerable":"nonenumerable";a==="enumerable"&&(e[t]=n),r&&a==="nonenumerable"&&Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!0,configurable:!0})}function An(e,t={}){if(Qn(e))return e.map(r=>An(r,t));if(!Ro(e))return e;const n=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e);return[...n,...s].reduce((r,a)=>{if(Qn(t.props)&&!t.props.includes(a))return r;const o=e[a],l=An(o,t);return Do(r,a,l,e,t.nonenumerable),r},{})}var B=class{constructor({dedupe:e=!1}={}){this.classRegistry=new co,this.symbolRegistry=new Fs(t=>t.description??""),this.customTransformerRegistry=new ho,this.allowedErrorProps=[],this.dedupe=e}serialize(e){const t=new Map,n=Xs(e,t,this,this.dedupe),s={json:n.transformedValue};n.annotations&&(s.meta={...s.meta,values:n.annotations});const r=Oo(t,this.dedupe);return r&&(s.meta={...s.meta,referentialEqualities:r}),s}deserialize(e){const{json:t,meta:n}=e;let s=An(t);return n!=null&&n.values&&(s=Lo(s,n.values,this)),n!=null&&n.referentialEqualities&&(s=jo(s,n.referentialEqualities)),s}stringify(e){return JSON.stringify(this.serialize(e))}parse(e){return this.deserialize(JSON.parse(e))}registerClass(e,t){this.classRegistry.register(e,t)}registerSymbol(e,t){this.symbolRegistry.register(e,t)}registerCustom(e,t){this.customTransformerRegistry.register({name:t,...e})}allowErrorProps(...e){this.allowedErrorProps.push(...e)}};B.defaultInstance=new B;B.serialize=B.defaultInstance.serialize.bind(B.defaultInstance);B.deserialize=B.defaultInstance.deserialize.bind(B.defaultInstance);B.stringify=B.defaultInstance.stringify.bind(B.defaultInstance);B.parse=B.defaultInstance.parse.bind(B.defaultInstance);B.registerClass=B.defaultInstance.registerClass.bind(B.defaultInstance);B.registerSymbol=B.defaultInstance.registerSymbol.bind(B.defaultInstance);B.registerCustom=B.defaultInstance.registerCustom.bind(B.defaultInstance);B.allowErrorProps=B.defaultInstance.allowErrorProps.bind(B.defaultInstance);var tr=B.serialize,Mo=B.stringify;function Uo(e){return e.state.fetchStatus==="fetching"?"fetching":e.getObserversCount()?e.state.fetchStatus==="paused"?"paused":e.isStale()?"stale":"fresh":"inactive"}function Bo(e,t){return`${e}${t.charAt(0).toUpperCase()+t.slice(1)}`}function Fo({queryState:e,observerCount:t,isStale:n}){return e.fetchStatus==="fetching"?"blue":t?e.fetchStatus==="paused"?"purple":n?"yellow":"green":"gray"}function qo({status:e,isPaused:t}){return t?"purple":e==="error"?"red":e==="pending"?"yellow":e==="success"?"green":"gray"}function Ko(e){return e==="fresh"?"green":e==="stale"?"yellow":e==="paused"?"purple":e==="inactive"?"gray":"blue"}var Vo=(e,t=!1)=>{const{json:n}=tr(e);return JSON.stringify(n,null,t?2:void 0)},jt=e=>e.state.fetchStatus!=="idle"?0:e.getObserversCount()?e.isStale()?2:1:3,Ho=(e,t)=>e.queryHash.localeCompare(t.queryHash),nr=(e,t)=>e.state.dataUpdatedAt<t.state.dataUpdatedAt?1:-1,Qo=(e,t)=>jt(e)===jt(t)?nr(e,t):jt(e)>jt(t)?1:-1,zo={status:Qo,"query hash":Ho,"last updated":nr},kt=e=>e.state.isPaused?0:e.state.status==="error"?2:e.state.status==="pending"?1:3,sr=(e,t)=>e.state.submittedAt<t.state.submittedAt?1:-1,$o=(e,t)=>kt(e)===kt(t)?sr(e,t):kt(e)>kt(t)?1:-1,Wo={status:$o,"last updated":sr},Yo=e=>e*parseFloat(getComputedStyle(document.documentElement).fontSize),Jo=()=>{const[e,t]=K("dark");return xs(()=>{const n=window.matchMedia("(prefers-color-scheme: dark)");t(n.matches?"dark":"light");const s=r=>{t(r.matches?"dark":"light")};n.addEventListener("change",s),Je(()=>n.removeEventListener("change",s))}),e},st=(e,t,n)=>{if(t.length===0)return n;if(e instanceof Map){const s=new Map(e);if(t.length===1)return s.set(t[0],n),s;const[r,...a]=t;return s.set(r,st(s.get(r),a,n)),s}if(e instanceof Set){const s=st(Array.from(e),t,n);return new Set(s)}if(Array.isArray(e)){const s=[...e];if(t.length===1)return s[t[0]]=n,s;const[r,...a]=t;return s[r]=st(s[r],a,n),s}if(e instanceof Object){const s={...e};if(t.length===1)return s[t[0]]=n,s;const[r,...a]=t;return s[r]=st(s[r],a,n),s}return e},rt=(e,t)=>{if(e instanceof Map){const n=new Map(e);if(t.length===1)return n.delete(t[0]),n;const[s,...r]=t;return n.set(s,rt(n.get(s),r)),n}if(e instanceof Set){const n=rt(Array.from(e),t);return new Set(n)}if(Array.isArray(e)){const n=[...e];if(t.length===1)return n.filter((a,o)=>o.toString()!==t[0]);const[s,...r]=t;return n[s]=rt(n[s],r),n}if(e instanceof Object){const n={...e};if(t.length===1)return delete n[t[0]],n;const[s,...r]=t;return n[s]=rt(n[s],r),n}return e},rr=(e,t)=>{if(!e||document.querySelector("#_goober")||(t==null?void 0:t.querySelector("#_goober")))return;const s=document.createElement("style"),r=document.createTextNode("");s.appendChild(r),s.id="_goober",s.setAttribute("nonce",e),t?t.appendChild(s):document.head.appendChild(s)},Ge,ht,gt,mt,Ce,Et,Oe,Re,De,Me,Ue,pt,Be,Fe,yt,Wn,Zo=(Wn=class{constructor(e){D(this,Ge);D(this,ht);D(this,gt);D(this,mt);D(this,Ce,!1);D(this,Et);D(this,Oe);D(this,Re);D(this,De);D(this,Me);D(this,Ue);D(this,pt);D(this,Be);D(this,Fe);D(this,yt);const{client:t,queryFlavor:n,version:s,onlineManager:r,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:c,styleNonce:u,shadowDOMTarget:d,hideDisabledQueries:f,theme:E}=e;O(this,Ge,K(t)),O(this,gt,n),O(this,mt,s),O(this,ht,r),O(this,Et,u),O(this,Oe,d),O(this,Re,K(a)),O(this,De,K(o)),O(this,Me,K(l)),O(this,Ue,K(c)),O(this,pt,K(f)),O(this,Fe,K(E))}setButtonPosition(e){x(this,Re)[1](e)}setPosition(e){x(this,De)[1](e)}setInitialIsOpen(e){x(this,Me)[1](e)}setErrorTypes(e){x(this,Ue)[1](e)}setClient(e){x(this,Ge)[1](e)}setTheme(e){x(this,Fe)[1](e)}mount(e){if(x(this,Ce))throw new Error("Devtools is already mounted");const t=ks(()=>{const n=this,[s]=x(this,Re),[r]=x(this,De),[a]=x(this,Me),[o]=x(this,Ue),[l]=x(this,pt),[c]=x(this,Ge),[u]=x(this,Fe);let d;return x(this,Be)?d=x(this,Be):(d=Ls(()=>Promise.resolve().then(()=>require("./WDYDFRGG-KPpWFul_.cjs"))),O(this,Be,d)),rr(x(this,Et),x(this,Oe)),Ln(d,jn({get queryFlavor(){return x(n,gt)},get version(){return x(n,mt)},get onlineManager(){return x(n,ht)},get shadowDOMTarget(){return x(n,Oe)}},{get client(){return c()},get buttonPosition(){return s()},get position(){return r()},get initialIsOpen(){return a()},get errorTypes(){return o()},get hideDisabledQueries(){return l()},get theme(){return u()}}))},e);O(this,Ce,!0),O(this,yt,t)}unmount(){var e;if(!x(this,Ce))throw new Error("Devtools is not mounted");(e=x(this,yt))==null||e.call(this),O(this,Ce,!1)}},Ge=new WeakMap,ht=new WeakMap,gt=new WeakMap,mt=new WeakMap,Ce=new WeakMap,Et=new WeakMap,Oe=new WeakMap,Re=new WeakMap,De=new WeakMap,Me=new WeakMap,Ue=new WeakMap,pt=new WeakMap,Be=new WeakMap,Fe=new WeakMap,yt=new WeakMap,Wn),qe,At,St,Tt,Ie,Pt,Ke,Ve,He,Qe,ze,xt,$e,We,Ye,_t,Yn,Xo=(Yn=class{constructor(e){D(this,qe);D(this,At);D(this,St);D(this,Tt);D(this,Ie,!1);D(this,Pt);D(this,Ke);D(this,Ve);D(this,He);D(this,Qe);D(this,ze);D(this,xt);D(this,$e);D(this,We);D(this,Ye);D(this,_t);const{client:t,queryFlavor:n,version:s,onlineManager:r,buttonPosition:a,position:o,initialIsOpen:l,errorTypes:c,styleNonce:u,shadowDOMTarget:d,onClose:f,hideDisabledQueries:E,theme:m}=e;O(this,qe,K(t)),O(this,St,n),O(this,Tt,s),O(this,At,r),O(this,Pt,u),O(this,Ke,d),O(this,Ve,K(a)),O(this,He,K(o)),O(this,Qe,K(l)),O(this,ze,K(c)),O(this,xt,K(E)),O(this,$e,K(f)),O(this,Ye,K(m))}setButtonPosition(e){x(this,Ve)[1](e)}setPosition(e){x(this,He)[1](e)}setInitialIsOpen(e){x(this,Qe)[1](e)}setErrorTypes(e){x(this,ze)[1](e)}setClient(e){x(this,qe)[1](e)}setOnClose(e){x(this,$e)[1](()=>e)}setTheme(e){x(this,Ye)[1](e)}mount(e){if(x(this,Ie))throw new Error("Devtools is already mounted");const t=ks(()=>{const n=this,[s]=x(this,Ve),[r]=x(this,He),[a]=x(this,Qe),[o]=x(this,ze),[l]=x(this,xt),[c]=x(this,qe),[u]=x(this,$e),[d]=x(this,Ye);let f;return x(this,We)?f=x(this,We):(f=Ls(()=>Promise.resolve().then(()=>require("./2SSKDMRQ-BksFOLpD.cjs"))),O(this,We,f)),rr(x(this,Pt),x(this,Ke)),Ln(f,jn({get queryFlavor(){return x(n,St)},get version(){return x(n,Tt)},get onlineManager(){return x(n,At)},get shadowDOMTarget(){return x(n,Ke)}},{get client(){return c()},get buttonPosition(){return s()},get position(){return r()},get initialIsOpen(){return a()},get errorTypes(){return o()},get hideDisabledQueries(){return l()},get onClose(){return u()},get theme(){return d()}}))},e);O(this,Ie,!0),O(this,_t,t)}unmount(){var e;if(!x(this,Ie))throw new Error("Devtools is not mounted");(e=x(this,_t))==null||e.call(this),O(this,Ie,!1)}},qe=new WeakMap,At=new WeakMap,St=new WeakMap,Tt=new WeakMap,Ie=new WeakMap,Pt=new WeakMap,Ke=new WeakMap,Ve=new WeakMap,He=new WeakMap,Qe=new WeakMap,ze=new WeakMap,xt=new WeakMap,$e=new WeakMap,We=new WeakMap,Ye=new WeakMap,_t=new WeakMap,Yn);function el(e){const t=T.useQueryClient(e.client),n=$.useRef(null),{buttonPosition:s,position:r,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:c,hideDisabledQueries:u,theme:d}=e,[f]=$.useState(new Zo({client:t,queryFlavor:"React Query",version:"5",onlineManager:T.onlineManager,buttonPosition:s,position:r,initialIsOpen:a,errorTypes:o,styleNonce:l,shadowDOMTarget:c,hideDisabledQueries:u,theme:d}));return $.useEffect(()=>{f.setClient(t)},[t,f]),$.useEffect(()=>{s&&f.setButtonPosition(s)},[s,f]),$.useEffect(()=>{r&&f.setPosition(r)},[r,f]),$.useEffect(()=>{f.setInitialIsOpen(a||!1)},[a,f]),$.useEffect(()=>{f.setErrorTypes(o||[])},[o,f]),$.useEffect(()=>{f.setTheme(d)},[d,f]),$.useEffect(()=>(n.current&&f.mount(n.current),()=>{f.unmount()}),[f]),i.jsx("div",{dir:"ltr",className:"tsqd-parent-container",ref:n})}function tl(e){const t=T.useQueryClient(e.client),n=$.useRef(null),{errorTypes:s,styleNonce:r,shadowDOMTarget:a,hideDisabledQueries:o,theme:l}=e,[c]=$.useState(new Xo({client:t,queryFlavor:"React Query",version:"5",onlineManager:T.onlineManager,buttonPosition:"bottom-left",position:"bottom",initialIsOpen:!0,errorTypes:s,styleNonce:r,shadowDOMTarget:a,onClose:e.onClose,hideDisabledQueries:o,theme:l}));return $.useEffect(()=>{c.setClient(t)},[t,c]),$.useEffect(()=>{c.setOnClose(e.onClose??(()=>{}))},[e.onClose,c]),$.useEffect(()=>{c.setErrorTypes(s||[])},[s,c]),$.useEffect(()=>{c.setTheme(l)},[l,c]),$.useEffect(()=>(n.current&&c.mount(n.current),()=>{c.unmount()}),[c]),i.jsx("div",{style:{height:"500px",...e.style},className:"tsqd-parent-container",ref:n})}var zn=process.env.NODE_ENV!=="development"?function(){return null}:el;process.env.NODE_ENV;const ar=Q.atom(""),nl=()=>{N.registerChaiFeatureFlag("dynamic-page-selector",{description:"Dynamic page selector"}),N.registerChaiFeatureFlag("enable-add-page-dropdown",{description:"Enable add page dropdown"})},sl=()=>{const e=L(),t=k();return T.useQuery({queryKey:[y.GET_COLLECTIONS],staleTime:1/0,queryFn:async()=>t(e,{action:y.GET_COLLECTIONS})})},rl=()=>{const{data:e}=re(),{data:t}=ye(),{data:n}=be(),s=L(),r=k(),a=h.useMemo(()=>(n==null?void 0:n.fallbackLang)||"en",[n==null?void 0:n.fallbackLang]),o=h.useRef(new Map);return T.useMutation({mutationFn:async({block:l})=>{const c=l._id,u=(t==null?void 0:t.lang)||a,d=`${c}:${u}`;if(o.current.has(d))return o.current.get(d);const f=r(s,{action:y.GET_BLOCK_ASYNC_PROPS,data:{block:l,lang:u,pageProps:{slug:t==null?void 0:t.slug,searchParams:{},pageType:t==null?void 0:t.pageType,fallbackLang:a,lastSaved:t.lastSaved,pageId:e.id,primaryPageId:t.primaryPage||e.id,pageBaseSlug:t==null?void 0:t.slug,dynamic:e==null?void 0:e.dynamic,languagePageId:t.id}}});return o.current.set(d,f),f.finally(()=>{o.current.delete(d)}),f}})},ir=()=>{const[,e]=he();return h.useCallback((t,n)=>{const r=new URLSearchParams(window.location.search).get("lang"),a=new URLSearchParams({page:t});r&&a.set("lang",r),window.history.pushState({},"",`?${a.toString()}`),e(a),window.dispatchEvent(new PopStateEvent("popstate")),n==null||n()},[e])},or=()=>{const e=ir();return h.useCallback(({pageId:t})=>{e(t)},[e])},al={SITE_WIDE_USAGE:"SITE_WIDE_USAGE"},il=e=>{const t=k(),n=L();return T.useQuery({queryKey:[al.SITE_WIDE_USAGE],queryFn:async()=>e?t(n,{action:"GET_SITE_WIDE_USAGE"}):{},retry:!1})},ol=h.lazy(()=>Promise.resolve().then(()=>require("./page-lock-DN4iJc-V.cjs"))),ll=h.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-dialog-BOZZZzqx.cjs"))),cl=h.lazy(()=>Promise.resolve().then(()=>require("./digital-asset-manager-eCJHNSjj.cjs"))),ul=h.lazy(()=>Promise.resolve().then(()=>require("./save-to-lib-CiM0wiIr.cjs"))),dl=h.lazy(()=>Promise.resolve().then(()=>require("./theme-panel-footer-IgGj-_OA.cjs"))),fl=h.lazy(()=>Promise.resolve().then(()=>require("./web-preview-DTDoIE-c.cjs")));nl();Pr.loadWebBlocks();N.registerChaiTopBar(Da);ui();N.registerChaiMediaManager(cl);N.registerChaiSaveToLibrary(ul);const hl={role:"",permissions:null},$n=e=>{const{isLoading:t}=$a();return t?i.jsx(Wt,{className:"fixed inset-0 bg-white",children:i.jsx(w.Loader,{className:"h-6 w-6 animate-spin text-primary"})}):i.jsx(gl,{...e})},gl=e=>{var ve;const{data:t}=za(),n=zt(),{data:s=hl,isFetching:r}=hs(),{data:a,isFetching:o}=Ae(),{data:l,isFetching:c}=sl(),{data:u,isFetching:d}=be(),f=r||o||c||d,[E]=he(),m=E.get("page"),{data:S}=re(),{data:v,isFetching:_}=Ba(),{blocks:b}=Ua(v),{data:A,isFetching:C}=ds(),{pageStatus:M}=ue(),H=Ma(),{onSave:P}=Wa(),{mutateAsync:oe}=rl(),{getPartialBlocks:te,getPartialBlockBlocks:V}=Ya(),{mutateAsync:j}=Gr(),{mutateAsync:G}=fs(),{data:z}=il(((ve=e.flags)==null?void 0:ve.designTokens)??!0),q=or(),[ne,Le]=h.useState(!1),le=h.useRef([]),ce=h.useMemo(()=>p.get(u,"theme",{})||{},[u]),ge=M===Z.EDITING,en=M===Z.CHECKING,Ct=_||en||C;h.useEffect(()=>{le.current=b},[b]);const[tn]=Q.useAtom(ar);h.useEffect(()=>{const J=()=>{document.hidden?Le(!0):Le(!1)};return window.addEventListener("visibilitychange",J),()=>window.removeEventListener("visibilitychange",J)},[]);const nn=h.useMemo(()=>{const J={};return s&&(J.permissions=p.get(s,"permissions",null),J.role=p.get(s,"role","user")),J},[s]),ae=h.useMemo(()=>t==null?void 0:t.some(J=>J.isSiteLibrary),[t]),me=h.useCallback(async(J,It)=>await j({pageType:J,query:It}),[j]);return i.jsxs(i.Fragment,{children:[Ct&&i.jsx(Wt,{className:f?"fixed inset-0 bg-white":"bg-white/75",children:i.jsx(w.Loader,{className:`animate-spin text-primary ${f?"h-6 w-6":"h-5 w-5"}`})}),tn&&i.jsx(h.Suspense,{fallback:i.jsx("div",{className:"absolute inset-0 z-[999999] flex min-h-screen w-screen items-center justify-center bg-gray-100",children:i.jsx(w.Loader,{className:"h-6 w-6 animate-spin text-primary"})}),children:i.jsx(fl,{})}),i.jsx(g.ChaiBuilderEditor,{siteWideUsage:z??{},flags:e.flags?{...e.flags,librarySite:ae}:{librarySite:ae},gotoPage:q,collections:l??[],getBlockAsyncProps:oe,pageExternalData:A,themePresets:e.themePresets??[],pageId:S==null?void 0:S.id,loading:_,fallbackLang:n,languages:(u==null?void 0:u.languages)||[],brandingOptions:(u==null?void 0:u.theme)||{},designTokens:(u==null?void 0:u.designTokens)||{},translations:e.translations||{},locale:e.locale||"en",htmlDir:e.htmlDir||"ltr",autoSave:!ne&&ge&&(e.autoSave??!0),autoSaveActionsCount:e.autoSaveActionsCount??10,onError:e.onError||console.error,getPartialBlockBlocks:V,getPartialBlocks:te,blocks:_?[]:b,theme:p.cloneDeep(ce),pageTypes:a,searchPageTypeItems:me,askAiCallBack:H,onSave:async({blocks:J,theme:It,needTranslations:ur,designTokens:kn})=>{if(!m)return!0;le.current=J;const Gn=[...J];await P({page:m,blocks:Gn,needTranslations:ur}),le.current=Gn;const Nt={};return p.isEqual(It,ce)||(Nt.theme=It),p.isEqual(kn,u==null?void 0:u.designTokens)||(Nt.designTokens=kn),p.isEmpty(Nt)||await G({settings:Nt}),!0},themePanelComponent:dl,...nn,children:i.jsx(ol,{isFetchingPageData:Ct})}),i.jsx("div",{children:i.jsx(ll,{})})]})},ml=new T.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnReconnect:!1,refetchOnMount:!1}}}),El=e=>{const[,t]=wt(),[n,s]=h.useState(!1);return h.useEffect(()=>(t(p.pick(e,["apiUrl","usersApiUrl","assetsApiUrl","getPreviewUrl","getLiveUrl","topLeftCorner","onLogout","getAccessToken","websocket","realtimeAdapter","getLoggedInUser","flags","currentUser"])),setTimeout(()=>{s(!0)},200),()=>{s(!1),t({})}),[e,t]),n?p.get(e,"hasReactQueryProvider",!1)===!0?i.jsxs(i.Fragment,{children:[i.jsx($n,{...e}),i.jsx(zn,{})]}):i.jsxs(T.QueryClientProvider,{client:ml,children:[i.jsx($n,{...e}),i.jsx(zn,{})]}):i.jsx("div",{})},pl=$.lazy(()=>Promise.resolve().then(()=>require("./nested-path-selector-content-CWmPgU-L.cjs")));function lr({data:e,onSelect:t,dataType:n="value",disabled:s=!1}){const[r,a]=$.useState(!1);return i.jsxs(g.Popover,{open:r,onOpenChange:a,children:[i.jsxs(g.Tooltip,{children:[i.jsx(g.TooltipTrigger,{asChild:!0,children:i.jsx(g.PopoverTrigger,{asChild:!0,children:i.jsx(N.Button,{size:"sm",variant:"outline",className:"h-6 w-6 px-1 py-0 text-[9px] text-muted-foreground",role:"combobox","aria-expanded":r,disabled:s,children:i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24px",height:"24px",viewBox:"0 0 24 24",fill:"none",children:i.jsx("path",{d:"M9.5 5H9C7.89543 5 7 5.89543 7 7V9C7 10 6.4 12 4 12C5 12 7 12.6 7 15V17.0002C7 18.1048 7.89543 19 9 19H9.5M14.5 5H15C16.1046 5 17 5.89543 17 7V9C17 10 17.6 12 20 12C19 12 17 12.6 17 15V17.0002C17 18.1048 16.1046 19 15 19H14.5",stroke:"#000000",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})})})}),i.jsx(g.TooltipContent,{children:"Add field"})]}),r&&i.jsx($.Suspense,{children:i.jsx(pl,{data:e,onSelect:t,dataType:n,open:r,setOpen:a})})]})}const yl=()=>{const{savePageAsync:e}=g.useSavePage(),t=T.useQueryClient(),{isLocked:n}=ue();return h.useCallback(async()=>{n||await e(),t.invalidateQueries({queryKey:[y.GET_DRAFT_PAGE]}),t.invalidateQueries({queryKey:[y.GET_BUILDER_PAGE_DATA]})},[e,t,n])},Al=()=>{const e=T.useQueryClient();return h.useCallback(()=>{e.clear()},[e])},Sl=()=>{const e=L(),t=k(),{data:n}=ye(),s=T.useQueryClient();return T.useMutation({mutationFn:async r=>{if(!(n!=null&&n.id))throw new Error("No active page found");return await t(`${e}`,{action:y.UPDATE_PAGE_METADATA,data:{id:n.id,metadata:r}})},onSuccess:()=>{s.invalidateQueries({queryKey:[y.GET_BUILDER_PAGE_DATA]}),s.invalidateQueries({queryKey:[y.GET_LANGUAGE_PAGES]})},onError:()=>{console.error("Failed to update metadata")}})},Tl=h.lazy(()=>Promise.resolve().then(()=>require("./digital-asset-manager-eCJHNSjj.cjs"))),Pl=({assetId:e,assetUrl:t,onChange:n,className:s="",placeholder:r="Select an image",disabled:a=!1})=>{const{t:o}=pe.useTranslation(),[l,c]=h.useState(!1),u=()=>{a||c(!0)},d=()=>{c(!1)},f=S=>{const v=Array.isArray(S)?S[0]:S;v!=null&&v.url&&n(p.pick(v,["url","id"])),c(!1)},E=()=>{n({url:"",id:""})},m=(t==null?void 0:t.startsWith("{{"))&&(t==null?void 0:t.endsWith("}}"));return i.jsxs("div",{className:`w-full ${s}`,children:[t?i.jsxs("div",{className:"relative overflow-hidden rounded-md border",children:[m?i.jsx("div",{className:"flex h-12 items-center bg-gray-100 px-4",children:i.jsx("p",{className:"text-xs text-gray-500",children:t})}):i.jsx("img",{onClick:u,src:t,alt:o("Selected image"),className:"h-auto max-h-[100px] w-full bg-gray-100 object-contain"}),i.jsxs("div",{className:"absolute right-2 top-2 flex gap-2",children:[i.jsx(N.Button,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8 rounded-full bg-white text-red-500",onClick:E,disabled:a,children:m?i.jsx(w.X,{className:"h-4 w-4"}):i.jsx(w.Trash2,{className:"h-4 w-4"})}),!m&&i.jsx(N.Button,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8 rounded-full bg-white/80 hover:bg-white/90",onClick:u,disabled:a,children:i.jsx(w.ImageIcon,{className:"h-4 w-4"})})]})]}):i.jsx("div",{className:`flex cursor-pointer items-center justify-center rounded-md border border-dashed p-6 ${a?"cursor-not-allowed opacity-50":"hover:border-gray-400"}`,onClick:u,children:i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx(w.ImageIcon,{className:"h-10 w-10 text-gray-400"}),i.jsx("p",{className:"text-sm text-gray-500",children:r})]})}),i.jsx(g.Dialog,{open:l,onOpenChange:c,children:i.jsxs(g.DialogContent,{className:"h-fit w-full max-w-7xl overflow-hidden p-0",children:[i.jsxs(g.DialogHeader,{className:"hidden border-b px-4 py-2",children:[i.jsx(g.DialogTitle,{children:o("Select Image")}),i.jsx(N.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-4 top-2",onClick:d,children:i.jsx(w.X,{className:"h-4 w-4"})})]}),i.jsx("div",{className:"h-full flex-1 p-4",children:i.jsx(h.Suspense,{children:i.jsx(Tl,{close:d,onSelect:f,mode:"image",assetId:e})})})]})})]})},xl=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Sn=e=>{if(!e.trim())return{isValid:!1,parsed:null,placeholders:[],error:{message:"JSON is empty"}};try{return{isValid:!0,parsed:JSON.parse(e),error:null,placeholders:[]}}catch{}const t=/{{([^{}]+)}}/g,n=[];let s=e,r;for(;(r=t.exec(e))!==null;){const a=r[0],o=r.index,l=`"__placeholder_${n.length}__"`;n.push({original:a,replaced:l,position:o}),s=s.replace(a,l)}try{return{isValid:!0,parsed:JSON.parse(s),error:null,placeholders:n}}catch(a){const o=a,l=o.message.match(/position (\d+)/),c=l?parseInt(l[1]):void 0;let u,d;if(c!==void 0){const f=s.substring(0,c).split(`
|
|
2
|
-
`);u=f.length,d=f[f.length-1].length+1}return{isValid:!1,parsed:null,placeholders:n,error:{message:o.message,line:u,column:d,position:c}}}},_l=(e,t)=>{let s=JSON.stringify(e,null,2);return t.forEach(({original:r},a)=>{const o=`"__placeholder_${a}__"`,l=new RegExp(xl(o),"g");s=s.replace(l,r)}),s},wl=(e,t)=>{if(!e)return"";let n=JSON.stringify(e,null,2);const s=/{{([^{}]+)}}/g;let r;for(;(r=s.exec(n))!==null;){const a=r[1],o=p.get(t,a,null);n=n.replace(r[0],o)}return n},bl=h.lazy(()=>Promise.resolve().then(()=>require("./shared-json-ld-DwvUDGAS.cjs"))),vl=({value:e,onChange:t,disabled:n=!1,readOnly:s=!1,placeholder:r="Enter JSON",rows:a=6,id:o="json-input",pageData:l={},handleFieldInsert:c,hasJsonLdForSelectedLang:u,copyJsonLDFromDefaultPage:d})=>{const[f,E]=h.useState("edit"),[m,S]=h.useState(null),[v,_]=h.useState(""),b=h.useRef(null),[A]=wt(),C=o==="jsonLD"&&p.get(A,"flags.sharedJsonLD",!1),M=o==="jsonLD"&&!u&&!!d;h.useEffect(()=>{e.trim()===""&&t("{}")},[e,t]);const H=V=>{if(s)return;const j=V.target.value;t(j)},P=V=>{if(V.key==="Tab"){V.preventDefault();const j=V.currentTarget,G=j.selectionStart,z=j.selectionEnd;if(G!==z){const ne=e.substring(G,z).split(`
|
|
3
|
-
`);if(V.shiftKey){const le=ne.map(ge=>ge.startsWith(" ")?ge.substring(2):ge).join(`
|
|
4
|
-
`),ce=e.substring(0,G)+le+e.substring(z);t(ce),setTimeout(()=>{j.selectionStart=G,j.selectionEnd=G+le.length},0)}else{const le=ne.map(ge=>` ${ge}`).join(`
|
|
5
|
-
`),ce=e.substring(0,G)+le+e.substring(z);t(ce),setTimeout(()=>{j.selectionStart=G,j.selectionEnd=G+le.length},0)}}else{const q=e.substring(0,G)+" "+e.substring(z);t(q),setTimeout(()=>{j.selectionStart=j.selectionEnd=G+2},0)}}};h.useEffect(()=>{const V=Sn(e);V.isValid?h.startTransition(()=>{if(S(null),V.parsed){const j=wl(V.parsed,l);_(j)}else _("")}):h.startTransition(()=>{S(V.error),_("")})},[e,l]);const oe=()=>{const V=Sn(e);if(V.isValid&&V.parsed){const j=_l(V.parsed,V.placeholders);t(j)}},te=()=>{m!=null&&m.position&&b.current&&(b.current.focus(),b.current.setSelectionRange(m.position,m.position+1))};return i.jsx(xr.ErrorBoundary,{fallback:i.jsx("div",{children:"Some error"}),children:i.jsx("div",{className:"space-y-2",children:i.jsxs(g.Tabs,{value:f,onValueChange:E,className:"w-full",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[i.jsxs(g.TabsList,{className:"w-max",children:[i.jsxs(g.TabsTrigger,{value:"edit",className:"flex items-center gap-1",children:[i.jsx(w.Code,{className:"h-4 w-4"}),i.jsx("span",{children:"Edit"})]}),i.jsxs(g.TabsTrigger,{value:"preview",className:"flex items-center gap-1",disabled:!e.trim()||m!==null||M,children:[i.jsx(w.Eye,{className:"h-4 w-4"}),i.jsx("span",{children:"Preview"})]}),C&&i.jsxs(g.TabsTrigger,{value:"shared",className:"flex items-center gap-1",disabled:!e.trim()||m!==null,children:[i.jsx(w.Share2,{className:"h-4 w-4"}),i.jsx("span",{children:"Shared"})]})]}),M?null:f==="edit"&&!s&&i.jsx("div",{className:"flex items-center gap-2",children:i.jsx(lr,{dataType:"value",data:l??{},onSelect:V=>c&&c(V,o)})})]}),i.jsxs(g.TabsContent,{value:"edit",className:"relative mt-0",children:[!M&&f==="edit"&&i.jsx(Yt,{content:"Format JSON",side:"right",showTooltip:!n&&!m,children:i.jsx(N.Button,{type:"button",variant:"outline",size:"icon",onClick:oe,className:"absolute right-1 top-1 h-6 w-6 p-1",disabled:!e.trim()||n||m!==null,children:i.jsx(w.FileCode2,{})})}),M?i.jsx("div",{className:"flex h-40 items-center justify-center rounded-md bg-black/20",children:i.jsxs("div",{className:"flex max-w-[400px] flex-col items-center gap-2 rounded-md bg-white p-4 shadow-lg",children:[i.jsx("div",{className:"max-w-xl text-center text-xs text-gray-500",children:"JSON-LD for is not added for selected language. JSON LD will be used from default language."}),i.jsxs(N.Button,{type:"button",variant:"default",size:"sm",onClick:d,children:[i.jsx(w.Plus,{}),"Copy & Edit from default language"]})]})}):i.jsx(g.Textarea,{ref:b,id:o,name:o,className:`rounded-md border border-input text-xs ${m?"border-red-500":""}`,onChange:H,onKeyDown:P,value:e,placeholder:r,rows:a,disabled:n,readOnly:s}),m&&i.jsxs(N.Alert,{variant:"destructive",className:"mt-2",children:[i.jsx(w.AlertTriangle,{className:"h-4 w-4"}),i.jsxs(N.AlertDescription,{className:"flex flex-col",children:[i.jsx("span",{className:"font-medium",children:"Invalid JSON"}),i.jsx("span",{className:"text-sm",children:m.message}),m.line&&m.column&&i.jsxs("span",{className:"text-sm",children:["Error at line ",m.line,", column ",m.column]}),i.jsx(N.Button,{type:"button",variant:"link",size:"sm",className:"mt-1 h-auto self-start p-0 text-sm",onClick:te,children:"Show position"})]})]})]}),i.jsxs(g.TabsContent,{value:"preview",className:"mt-0",children:[i.jsx(g.Textarea,{rows:a,value:v,readOnly:!0,className:"cursor-default bg-muted font-mono text-sm"}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"This is how the JSON will look after placeholder substitution."})]}),C&&i.jsx(g.TabsContent,{value:"shared",className:"mt-0",children:i.jsx(h.Suspense,{children:i.jsx(bl,{})})})]})})})},Cl=e=>{const t=L(),n=k();return T.useQuery({queryKey:[y.GET_CHAI_USER,e],queryFn:async()=>{const s=await n(t,{action:y.GET_CHAI_USER,data:{userId:e}}),r=(s==null?void 0:s.data)||{};return{...r,name:r.name||r.email}},enabled:!p.isEmpty(e),staleTime:"static"})};class Il{constructor(t){rn(this,"channel");this.channel=t}get topic(){return this.channel.topic}getState(){const t=this.channel.state;return{closed:"CLOSED",errored:"ERROR",joined:"JOINED",joining:"JOINING",leaving:"LEAVING"}[t]||"CLOSED"}async subscribe(t){this.channel.subscribe(n=>{t(n)})}unsubscribe(){this.channel.unsubscribe()}onBroadcast(t,n){this.channel.on("broadcast",{event:t},n)}onPresence(t,n){this.channel.on("presence",{event:t},n)}async send(t,n){await this.channel.send({event:t,payload:n,type:"broadcast"})}async track(t){await this.channel.track(t)}untrack(){this.channel.untrack()}presenceState(){return this.channel.presenceState()}}class cr{constructor(t){rn(this,"client");this.client=t}channel(t,n){const s=this.client.channel(t,n);return new Il(s)}}function Nl(e){return new cr(e)}if(typeof window>"u")throw new Error("@chaibuilder/pages is not available on the server");exports.$TRACK=Cn;exports.ACTIONS=y;exports.BlurContainer=Wt;exports.ChaiWebsiteBuilder=El;exports.Dynamic=oo;exports.EVENT=ee;exports.For=ji;exports.ImagePicker=Pl;exports.Index=ki;exports.LANGUAGES=tt;exports.LanguageSwitcher=os;exports.Match=Ri;exports.NestedPathSelector=lr;exports.PAGES_PERMISSIONS=ie;exports.PAGE_STATUS=Z;exports.PageActionsDropdown=ts;exports.PermissionChecker=Gt;exports.Portal=ao;exports.Show=Gi;exports.SmartJsonInput=vl;exports.SupabaseRealtimeAdapter=cr;exports.Switch=Oi;exports.Tooltip=Yt;exports.addEventListener=Rs;exports.addNewLangAtom=ot;exports.batch=mi;exports.className=Os;exports.clearDelegatedEvents=Wi;exports.convertRemToPixels=Yo;exports.createComponent=Ln;exports.createComputed=Ps;exports.createContext=Si;exports.createEffect=In;exports.createMemo=W;exports.createRealtimeAdapter=Nl;exports.createRenderEffect=xe;exports.createRoot=Pe;exports.createSignal=K;exports.createUniqueId=Li;exports.delegateEvents=Gs;exports.deleteNestedDataByPath=rt;exports.displayValue=Vo;exports.getMutationStatusColor=qo;exports.getPreferredColorScheme=Jo;exports.getQueryStatusColor=Fo;exports.getQueryStatusColorByLabel=Ko;exports.getQueryStatusLabel=Uo;exports.getSidedProp=Bo;exports.insert=Ht;exports.memo=Qi;exports.mergeProps=jn;exports.mutationSortFns=Wo;exports.navigateToPage=is;exports.on=Ei;exports.onCleanup=Je;exports.onMount=xs;exports.parseJSONWithPlaceholders=Sn;exports.previewUrlAtom=ar;exports.serialize=tr;exports.setAttribute=Vt;exports.sortFns=zo;exports.splitProps=Ns;exports.spread=Ds;exports.stringify=Mo;exports.template=$i;exports.throwConfetti=dn;exports.untrack=Y;exports.updateNestedDataByPath=st;exports.use=Ms;exports.useActivePage=ye;exports.useAddGlobalSchema=Fa;exports.useApiUrl=L;exports.useApplySchemaToAllPages=Ha;exports.useBuilderFetch=br;exports.useBuilderPageData=ds;exports.useChaiAuth=Qt;exports.useChaiCurrentPage=re;exports.useChaiUserInfo=Cl;exports.useChaibuilderRealtime=$r;exports.useChangePage=ir;exports.useChangeSlug=ya;exports.useClearAll=Al;exports.useContext=Ti;exports.useCreatePage=fa;exports.useCurrentPageOwner=ss;exports.useDeleteGlobalSchema=Ka;exports.useDeletePage=ga;exports.useDynamicPageSelector=Xn;exports.useFallbackLang=zt;exports.useFetch=k;exports.useGotoPage=or;exports.useIsLanguagePageCreated=cs;exports.useLanguagePages=we;exports.useMarkAsTemplate=Ea;exports.usePageEditInfo=xn;exports.usePageLockMeta=wn;exports.usePageLockStatus=ue;exports.usePageToUser=_n;exports.usePageType=es;exports.usePageTypes=Ae;exports.usePagesProp=se;exports.usePagesProps=wt;exports.usePublishPages=vn;exports.useRealtimeAdapter=Tn;exports.useReloadPage=yl;exports.useRemoveSchemaFromAllPages=Qa;exports.useSearchParams=he;exports.useSendRealtimeEvent=rs;exports.useTogglePageGlobalSchema=Va;exports.useTransition=Ai;exports.useUnmarkAsTemplate=pa;exports.useUnpublishPage=ma;exports.useUpdateActivePageMetadata=Sl;exports.useUpdateGlobalSchema=qa;exports.useUpdatePage=ha;exports.useUpdateWebsiteFields=fs;exports.useUserId=bt;exports.useUserRoleAndPermissions=hs;exports.useWebsiteLanguagePages=Wr;exports.useWebsitePages=$t;exports.useWebsiteSetting=be;
|