@chaibuilder/sdk 4.0.0-beta.30 → 4.0.0-beta.31
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-Dub3pRV1.cjs → 2SSKDMRQ-BksFOLpD.cjs} +1 -1
- package/dist/{2SSKDMRQ-B5Tzwoh4.js → 2SSKDMRQ-gmj-yWTy.js} +2 -2
- package/dist/{AP7HFJJL-Dt6MglIr.cjs → AP7HFJJL-CO-deD_p.cjs} +1 -1
- package/dist/{AP7HFJJL-CfmdXP9M.js → AP7HFJJL-kVgc0R61.js} +1 -1
- package/dist/{IconPicker-DLqOB-ri.cjs → IconPicker-BJHUCDn4.cjs} +1 -1
- package/dist/{IconPicker-Cn8Z42-Z.js → IconPicker-D_GRfhwS.js} +1 -1
- package/dist/{WDYDFRGG-BOpmZGHS.js → WDYDFRGG-C9_E3QW0.js} +2 -2
- package/dist/{WDYDFRGG-Dfj1ikzw.cjs → WDYDFRGG-KPpWFul_.cjs} +1 -1
- package/dist/{active-in-another-tab-CEWvA8SG.js → active-in-another-tab-1GoKTVcF.js} +2 -2
- package/dist/{active-in-another-tab-DV83cJ_v.cjs → active-in-another-tab-iEd5fZD0.cjs} +1 -1
- package/dist/{add-new-language-page-B3wK94-S.js → add-new-language-page-B3GUvWdP.js} +3 -3
- package/dist/{add-new-language-page-C3Uu92KN.cjs → add-new-language-page-Cq8R42Ro.cjs} +1 -1
- package/dist/{add-new-page-DsvGVrR8.js → add-new-page-C5HlQfzy.js} +2 -2
- package/dist/{add-new-page-BOE-xwBc.cjs → add-new-page-DiHnECAR.cjs} +1 -1
- package/dist/{ai-panel-content-DBlnfRRi.cjs → ai-panel-content-BPpawv4D.cjs} +1 -1
- package/dist/{ai-panel-content-BBSzHZG6.js → ai-panel-content-tExD3yhH.js} +3 -3
- package/dist/{ai-panel-default-lang-DJJWAtN0.cjs → ai-panel-default-lang-C6N4wUUF.cjs} +2 -2
- package/dist/{ai-panel-default-lang-BVBuwnyU.js → ai-panel-default-lang-DnYLHSaS.js} +9 -9
- package/dist/{ai-panel-other-lang-v8Yd5ggR.cjs → ai-panel-other-lang-C65lVVtZ.cjs} +1 -1
- package/dist/{ai-panel-other-lang-fIEZkmRy.js → ai-panel-other-lang-D1pCJluY.js} +13 -13
- package/dist/{ai-prompt-input-CmSfGxTN.js → ai-prompt-input-B2q30bhR.js} +16 -16
- package/dist/{ai-prompt-input-C7ha_0Cn.cjs → ai-prompt-input-Dws5BHhQ.cjs} +1 -1
- package/dist/{ai-translation-prompt-CtBmvsRy.js → ai-translation-prompt-Dnn6i_t3.js} +1 -1
- package/dist/{ai-translation-prompt-BzTGAS3W.cjs → ai-translation-prompt-DnwG2BmF.cjs} +1 -1
- package/dist/{change-password-modal-DxkhBI5d.js → change-password-modal-C0MMizgl.js} +2 -2
- package/dist/{change-password-modal-CdOwtCWN.cjs → change-password-modal-LKtYY-8V.cjs} +1 -1
- package/dist/{code-editor-Bpn8z2fo.js → code-editor-CWOmKcUc.js} +1 -1
- package/dist/{code-editor-fL3s6Hk7.cjs → code-editor-Cim6jQVF.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-DjxpjsA8.cjs → continue-editing-in-this-client-Dd6nKIvX.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-DDB816CQ.js → continue-editing-in-this-client-oxYWGWON.js} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -0
- package/dist/core.js +37 -37
- package/dist/{css-import-modal-CL8SIC3K.js → css-import-modal-6bMTRlCg.js} +1 -1
- package/dist/{css-import-modal-CRC7bK1c.cjs → css-import-modal-CXulmaB4.cjs} +1 -1
- package/dist/{delete-page-BHPlx8ec.cjs → delete-page-D0tdn6VW.cjs} +1 -1
- package/dist/{delete-page-41tvYcEw.js → delete-page-LnzR01A8.js} +2 -2
- package/dist/{design-token-usage-DtdjTCn3.cjs → design-token-usage-D-hrcKz1.cjs} +1 -1
- package/dist/{design-token-usage-CyOY4Pni.js → design-token-usage-lf7N_uOk.js} +28 -28
- package/dist/{digital-asset-manager-C_ru4Zes.js → digital-asset-manager-DJhRhLGC.js} +3 -3
- package/dist/{digital-asset-manager-DSLQz8qk.cjs → digital-asset-manager-eCJHNSjj.cjs} +1 -1
- package/dist/{duplicate-page-DMmDdmfS.js → duplicate-page-CXzYy7vx.js} +3 -3
- package/dist/{duplicate-page-BvggF83O.cjs → duplicate-page-ChSp1TYN.cjs} +1 -1
- package/dist/{dynamic-page-selector-C5agz2Ze.cjs → dynamic-page-selector-btGtkyyv.cjs} +1 -1
- package/dist/{dynamic-page-selector-D2z51nLi.js → dynamic-page-selector-r5IR9_7k.js} +2 -2
- package/dist/{get-chai-builder-tailwind-config-DNp8Vhme.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-k8l5sdcw.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +3 -3
- package/dist/{get-chai-builder-theme-BSUcPs5t.js → get-chai-builder-theme-BpuwSLeS.js} +1 -1
- package/dist/{image-editor-DFmlG348.cjs → image-editor-BdW476J8.cjs} +1 -1
- package/dist/{image-editor-sKvOFo-S.js → image-editor-CilPMtAC.js} +1 -1
- package/dist/index-CAhDwfHE.cjs +5 -0
- package/dist/{index-BFnMzGe6.js → index-DsQXiNA_.js} +4997 -4877
- package/dist/{index-CA1OwKJX.js → index-DtMksfXx.js} +1711 -1666
- package/dist/index-mPCp0j2h.cjs +160 -0
- package/dist/{json-diff-viewer-DRQSNhaS.cjs → json-diff-viewer-BkrnLb3B.cjs} +1 -1
- package/dist/{json-diff-viewer-B5wAR5GY.js → json-diff-viewer-D3N3w3Ax.js} +34 -34
- package/dist/{lang-panel-q04hEq5o.js → lang-panel-BAaaP4Qc.js} +3 -3
- package/dist/{lang-panel-BZsICcBR.cjs → lang-panel-BjDRrpwN.cjs} +1 -1
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
- package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
- package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
- package/dist/library-blocks/bento/product-features/product-features.html +159 -0
- package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
- package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
- package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
- package/dist/library-blocks/blocks-list.json +145 -12
- package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
- package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
- package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
- package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
- package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
- package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
- package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
- package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
- package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
- package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
- package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
- package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
- package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
- package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
- package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
- package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
- package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
- package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
- package/dist/manage-design-tokens-BknGNAKE.cjs +1 -0
- package/dist/manage-design-tokens-Co5677WS.js +428 -0
- package/dist/manage-design-tokens-modal-9qpcb-EC.js +161 -0
- package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +1 -0
- package/dist/{mark-as-template-raTtKmQ9.js → mark-as-template-DNHYNjI9.js} +2 -2
- package/dist/{mark-as-template-CT-hLGIW.cjs → mark-as-template-IYRjta97.cjs} +1 -1
- package/dist/{nested-path-selector-content-CzQ2Lorl.js → nested-path-selector-content-Be-pbnVl.js} +1 -1
- package/dist/{nested-path-selector-content-CSUHTj9G.cjs → nested-path-selector-content-CWmPgU-L.cjs} +1 -1
- package/dist/{no-language-page-content-Bkj8JpEY.cjs → no-language-page-content-8_J6y-cm.cjs} +1 -1
- package/dist/{no-language-page-content-Bg6VjMVY.js → no-language-page-content-C-ltY7bj.js} +4 -4
- package/dist/{no-language-page-dialog-TffLjvJn.cjs → no-language-page-dialog-BOZZZzqx.cjs} +1 -1
- package/dist/{no-language-page-dialog-CRPMr9YT.js → no-language-page-dialog-D5NXpDHi.js} +2 -2
- package/dist/{page-creator-CQhE1tgn.js → page-creator-BuHHnqiQ.js} +172 -172
- package/dist/{page-creator-RrUhy8uH.cjs → page-creator-wtbae2U7.cjs} +1 -1
- package/dist/{page-lock-D9h5pgxn.cjs → page-lock-DN4iJc-V.cjs} +1 -1
- package/dist/{page-lock-Dye1JZBB.js → page-lock-pPGlTxj7.js} +2 -2
- package/dist/{page-locked-dialog-b2_f-A7a.cjs → page-locked-dialog-B_vdgv24.cjs} +1 -1
- package/dist/{page-locked-dialog-BMjPVyHF.js → page-locked-dialog-Bl-ojgIW.js} +16 -16
- package/dist/page-manager-new-5W5M9_ue.cjs +1 -0
- package/dist/page-manager-new-Bg8H6yrg.js +418 -0
- package/dist/{page-manager-search-and-filter-D0ZXojiu.cjs → page-manager-search-and-filter-CDXunXNd.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-DCcYyoPO.js → page-manager-search-and-filter-CyfO7O96.js} +2 -2
- package/dist/{page-revisions-content-mDwvH6J-.js → page-revisions-content-B-egQgoZ.js} +13 -13
- package/dist/{page-revisions-content-BX8ZWebc.cjs → page-revisions-content-BKT8S9_g.cjs} +1 -1
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +3 -0
- package/dist/pages.js +1 -1
- package/dist/{plugin-Dkmjb2_e.js → plugin-BSjgGgwo.js} +10 -10
- package/dist/{publish-pages-content-M_Kb8b-F.js → publish-pages-content-D2B_ScCQ.js} +3 -3
- package/dist/{publish-pages-content-CR4e9inX.cjs → publish-pages-content-WJHTVYnx.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +1 -0
- package/dist/render.js +32 -32
- package/dist/{rte-widget-modal-BRSm1Lnp.cjs → rte-widget-modal-CC1KcrAT.cjs} +1 -1
- package/dist/{rte-widget-modal-CVZDktXI.js → rte-widget-modal-c3T09VeO.js} +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/{save-to-lib-CYEAWxL9.cjs → save-to-lib-CiM0wiIr.cjs} +1 -1
- package/dist/{save-to-lib-B1ccNhR2.js → save-to-lib-dT1NDd5w.js} +26 -26
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-aGR7p5JC.js → selected-block-display-BQndDPcY.js} +11 -11
- package/dist/{selected-block-display-MyU0rS4q.cjs → selected-block-display-BgqcPsXI.cjs} +1 -1
- package/dist/{seo-panel-B5mDwpaT.cjs → seo-panel-DXZvGYEM.cjs} +1 -1
- package/dist/{seo-panel-P9uixkoZ.js → seo-panel-Z93Zf_bz.js} +138 -138
- package/dist/{shared-json-ld-Ba9GcvLr.js → shared-json-ld-Ct68RlWD.js} +70 -70
- package/dist/{shared-json-ld-DhQJh_mT.cjs → shared-json-ld-DwvUDGAS.cjs} +1 -1
- package/dist/{slug-input-CAfGHqMW.js → slug-input-CAqkFZBq.js} +1 -1
- package/dist/{slug-input-BdMnlYKT.cjs → slug-input-Curnt2n3.cjs} +1 -1
- package/dist/{take-over-request-CXjaDliJ.js → take-over-request-C6ngP1QR.js} +10 -10
- package/dist/{take-over-request-BeHTL28z.cjs → take-over-request-D6y2HcDr.cjs} +1 -1
- package/dist/{theme-panel-footer-BkwhuXM7.js → theme-panel-footer-CGZL2F7R.js} +2 -2
- package/dist/{theme-panel-footer-D_gxD0j4.cjs → theme-panel-footer-IgGj-_OA.cjs} +1 -1
- package/dist/{translation-warning-modal-D_vt37fW.cjs → translation-warning-modal-B876S5yp.cjs} +1 -1
- package/dist/{translation-warning-modal-CTfArsb1.js → translation-warning-modal-kRcfrPgo.js} +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/{unmark-as-template-vFgMIdxN.js → unmark-as-template-DeeWUTco.js} +2 -2
- package/dist/{unmark-as-template-D2bvjGKt.cjs → unmark-as-template-f1dl_YTz.cjs} +1 -1
- package/dist/{unpublish-page-CPjHmtSM.cjs → unpublish-page-DEPFjGuu.cjs} +1 -1
- package/dist/{unpublish-page-CxkjTzBB.js → unpublish-page-U_79Pwc0.js} +2 -2
- package/dist/unpublished-partials-modal-CEFXp1D1.cjs +1 -0
- package/dist/unpublished-partials-modal-Ts5ZhAK9.js +41 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/{web-preview--by73Vvr.js → web-preview-CoT8r96b.js} +1 -1
- package/dist/{web-preview-C3AMe_BB.cjs → web-preview-DTDoIE-c.cjs} +1 -1
- package/package.json +1 -1
- package/dist/delete-design-token-B0md8qUi.js +0 -40
- package/dist/delete-design-token-C94IgWdi.cjs +0 -1
- package/dist/index-Bzn_gpaK.cjs +0 -5
- package/dist/index-D30xvFa5.cjs +0 -160
- package/dist/library-blocks/hero-1/hero-1.html +0 -74
- package/dist/library-blocks/hero-1/hero-1.webp +0 -0
- package/dist/library-blocks/hero-2/hero-2.html +0 -95
- package/dist/library-blocks/hero-2/hero-2.webp +0 -0
- package/dist/manage-design-tokens-Cene3KEu.js +0 -241
- package/dist/manage-design-tokens-Di5C6nTj.cjs +0 -1
- package/dist/page-manager-new-2mDjnSqc.cjs +0 -1
- package/dist/page-manager-new-DP1b_dXt.js +0 -411
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
2
|
import { z as C, D as A, B as v } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { D as T, e as w, f as q, g as F, p as _, q as D } from "./index-
|
|
4
|
-
import { ar as G, as as L, A as U, at as j } from "./index-
|
|
3
|
+
import { D as T, e as w, f as q, g as F, p as _, q as D } from "./index-DsQXiNA_.js";
|
|
4
|
+
import { ar as G, as as L, A as U, at as j } from "./index-DtMksfXx.js";
|
|
5
5
|
import { useQueryClient as $, useMutation as B } from "@tanstack/react-query";
|
|
6
6
|
import { toast as P } from "sonner";
|
|
7
7
|
import { isEmpty as O, initial as M } from "lodash-es";
|
|
8
8
|
import { AlertCircle as Q } from "lucide-react";
|
|
9
9
|
import { useState as p } from "react";
|
|
10
10
|
import { useTranslation as V } from "react-i18next";
|
|
11
|
-
import { S as k } from "./slug-input-
|
|
11
|
+
import { S as k } from "./slug-input-CAqkFZBq.js";
|
|
12
12
|
const z = () => {
|
|
13
13
|
const s = G(), o = $(), g = L();
|
|
14
14
|
return B({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("./register-chai-top-bar-DyW9GPzV.cjs"),l=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("./register-chai-top-bar-DyW9GPzV.cjs"),l=require("./index-mPCp0j2h.cjs"),h=require("./index-CAhDwfHE.cjs"),v=require("@tanstack/react-query"),P=require("sonner"),D=require("lodash-es"),C=require("lucide-react"),p=require("react"),T=require("react-i18next"),A=require("./slug-input-Curnt2n3.cjs"),w=()=>{const t=h.useApiUrl(),u=v.useQueryClient(),x=h.useFetch();return v.useMutation({mutationFn:async({pageId:s,name:j,slug:r})=>{const o={pageId:s,name:j};return r&&(o.slug=r),await x(t,{action:"DUPLICATE_PAGE",data:o})},onSuccess:()=>{u.invalidateQueries({queryKey:[h.ACTIONS.GET_WEBSITE_PAGES]}),P.toast.success("Page duplicated successfully")},onError:s=>{P.toast.error("Failed to duplicate page",{description:s.message||"An error occurred while duplicating the page"})}})},F=({page:t,onClose:u,closePanel:x=()=>{}})=>{const{t:s}=T.useTranslation(),{mutate:j,isPending:r}=w(),[o,a]=p.useState(null),[d,I]=p.useState(`${t.name} (Copy)`),b=h.useChangePage(),i=D.isEmpty(t.slug),[m,q]=p.useState(i?"":`${t.slug.split("/").pop()}-copy`),y=i?"":D.initial(t.slug.split("/")).join("/"),[S,f]=p.useState(!1),E=n=>{if(n.preventDefault(),!d.trim()){a(s("Name is required"));return}if(!i&&!m.trim()){a(s("Slug is required"));return}a(null),f(!0);const N={pageId:t.id,name:d};i||(N.slug=`${y}/${m}`),j(N,{onSuccess:c=>{f(!1),u(),b(c.id,x)},onError:c=>{f(!1),c.code==="SLUG_EXISTS"?a(s("A page with this slug already exists. Please choose a different slug.")):c.code==="INVALID_SLUG"?a(s("The slug format is invalid. Please use only lowercase letters, numbers, and hyphens.")):c.code==="PERMISSION_DENIED"?a(s("You don't have permission to duplicate this page.")):a(c.message||s("Failed to duplicate page. Please try again later."))}})};return e.jsx(l.Dialog,{open:!!t,onOpenChange:u,children:e.jsxs(l.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(l.DialogHeader,{children:[e.jsx(l.DialogTitle,{children:s("Duplicate Page")}),e.jsx(l.DialogDescription,{children:s("Create a copy of the page with a new name and slug")})]}),e.jsxs("div",{className:"mb-4 rounded-md bg-gray-50 p-3",children:[e.jsxs("h3",{className:"mb-1 text-sm font-medium",children:[s("Duplicating:"),":"]}),e.jsxs("div",{className:"flex flex-col gap-1 text-sm text-gray-700",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[s("Name"),":"]})," ",t.name]}),!i&&e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[s("Slug"),":"]})," ",t.slug]}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:[s("Type"),":"]})," ",t.pageType]})]})]}),e.jsxs("form",{onSubmit:E,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l.Label,{htmlFor:"name",className:"text-sm",children:s("Name")}),e.jsx(g.Input,{id:"name",value:d,onChange:n=>I(n.target.value),required:!0})]}),!i&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(l.Label,{htmlFor:"slug",className:"text-sm",children:s("Slug")}),e.jsx(A.SlugInput,{value:m,onChange:n=>q(n),parentSlug:y,onValidationChange:n=>{a(n?null:s("Invalid slug"))}})]}),o&&e.jsxs(g.Alert,{variant:"destructive",className:"py-2",children:[e.jsx(C.AlertCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:o})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(g.Button,{type:"button",variant:"outline",onClick:u,disabled:r,children:s("Cancel")}),e.jsx(g.Button,{type:"submit",disabled:!d.trim()||!i&&!m.trim()||r||S,children:s(r||S?"Duplicating...":"Duplicate")})]})]})]})})};exports.default=F;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("./register-chai-top-bar-DyW9GPzV.cjs"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("./register-chai-top-bar-DyW9GPzV.cjs"),c=require("./index-mPCp0j2h.cjs"),h=require("./index-CAhDwfHE.cjs"),p=require("lodash-es"),g=require("lucide-react"),d=require("react"),f=({isDefaultLang:r,searchQuery:a,setSearchQuery:l})=>e.jsx(x.Input,{type:"text",autoFocus:!0,value:r?a:"",onChange:t=>l(t.target.value),placeholder:r?"Search pages...":"To search select default language",disabled:!r,onKeyDown:t=>t.stopPropagation()}),m=({dynamicPage:r,setDynamicPage:a,searchQuery:l,setSearchQuery:t,dynamicPages:n})=>{const{selectedLang:o,fallbackLang:i}=c.useLanguages(),u=(o==null?void 0:o.length)===0;return e.jsxs(c.DropdownMenu,{children:[e.jsx(c.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(x.Button,{variant:"ghost",className:"h-max w-max rounded-md border border-[0px] border-gray-200 py-1 pl-4 text-sm hover:bg-gray-100 focus:outline-none focus:ring-0",children:[r?p.get(r,"name"):"Select Page",e.jsx(g.ChevronDown,{className:"ml-2 h-4 w-4"})]})}),e.jsxs(c.DropdownMenuContent,{className:"max-h-[75vh] w-96 divide-y p-0 shadow-xl",children:[e.jsx("div",{className:"bg-gray-50/30 p-1.5",children:e.jsx(f,{isDefaultLang:u,searchQuery:l,setSearchQuery:t})}),(n==null?void 0:n.length)===0?e.jsx("div",{className:"flex h-24 items-center justify-center text-xs",children:"No pages found"}):n==null?void 0:n.map(s=>e.jsx(c.DropdownMenuItem,{onClick:()=>a(s),disabled:u?i!==s.lang:o!==s.lang,className:`no-scrollbar flex cursor-pointer flex-col justify-start overflow-x-auto whitespace-nowrap ${s.id===(r==null?void 0:r.id)?"bg-blue-50":"hover:bg-gray-50"}`,children:e.jsx("div",{className:"w-full whitespace-nowrap px-2 py-[2px] text-xs",children:e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx("span",{className:"font-medium",children:s.name}),e.jsx("span",{className:"truncate rounded-full border border-gray-300 px-2 py-[1px] font-mono text-xs font-medium text-gray-500",children:s.slug})]})})},s.id))]})]})},j=()=>{const{dynamicPage:r,dynamicPages:a,allLangPages:l,selectedLang:t,searchQuery:n,updateDynamicPage:o,updateSearchQuery:i,onChangeLanguage:u}=h.useDynamicPageSelector(),s=d.useRef(void 0);return d.useEffect(()=>{s.current!==t&&r&&(u(),s.current=t)},[t,a]),e.jsx("div",{className:"relative",children:e.jsx(m,{dynamicPage:r,setDynamicPage:o,searchQuery:n,setSearchQuery:i,dynamicPages:l})})};exports.default=j;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as r, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import { B as i, z as h } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { d as p, s as m, t as f, v as x, w as g } from "./index-
|
|
4
|
-
import { n as v } from "./index-
|
|
3
|
+
import { d as p, s as m, t as f, v as x, w as g } from "./index-DsQXiNA_.js";
|
|
4
|
+
import { n as v } from "./index-DtMksfXx.js";
|
|
5
5
|
import { get as w } from "lodash-es";
|
|
6
6
|
import { ChevronDown as b } from "lucide-react";
|
|
7
7
|
import { useRef as N, useEffect as y } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("@tailwindcss/aspect-ratio"),n=require("@tailwindcss/container-queries"),d=require("@tailwindcss/forms"),
|
|
1
|
+
"use strict";const a=require("@tailwindcss/aspect-ratio"),n=require("@tailwindcss/container-queries"),d=require("@tailwindcss/forms"),c=require("@tailwindcss/typography");function r(){return{colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},destructive:{DEFAULT:"hsl(var(--destructive))",foreground:"hsl(var(--destructive-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},card:{DEFAULT:"hsl(var(--card))",foreground:"hsl(var(--card-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"},keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}}const i=({content:o,theme:e})=>({darkMode:"class",content:[...o],theme:{extend:{...r(),...e??{}}},plugins:[c,d,a,n]});exports.getChaiBuilderTailwindConfig=i;exports.shadcnTheme=r;
|
|
@@ -2,7 +2,7 @@ import a from "@tailwindcss/aspect-ratio";
|
|
|
2
2
|
import e from "@tailwindcss/container-queries";
|
|
3
3
|
import n from "@tailwindcss/forms";
|
|
4
4
|
import d from "@tailwindcss/typography";
|
|
5
|
-
function
|
|
5
|
+
function c() {
|
|
6
6
|
return {
|
|
7
7
|
colors: {
|
|
8
8
|
border: "hsl(var(--border))",
|
|
@@ -65,7 +65,7 @@ const h = ({ content: r, theme: o }) => ({
|
|
|
65
65
|
content: [...r],
|
|
66
66
|
theme: {
|
|
67
67
|
extend: {
|
|
68
|
-
...
|
|
68
|
+
...c(),
|
|
69
69
|
...o ?? {}
|
|
70
70
|
}
|
|
71
71
|
},
|
|
@@ -73,5 +73,5 @@ const h = ({ content: r, theme: o }) => ({
|
|
|
73
73
|
});
|
|
74
74
|
export {
|
|
75
75
|
h as g,
|
|
76
|
-
|
|
76
|
+
c as s
|
|
77
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),b=require("./index-mPCp0j2h.cjs"),S=require("lodash-es"),c=require("lucide-react"),a=require("react"),T=require("react-filerobot-image-editor"),k=require("react-i18next"),h=a.memo(({imageUrl:l,onSave:u,onClose:m,defaultSavedImageName:y,isEditing:f=!1})=>{const{t:n}=k.useTranslation(),[v,i]=a.useState(!1),[p,I]=a.useState(!0),[w,j]=a.useState(!1);a.useEffect(()=>{const e=new Image;return e.src=l,e.onload=()=>j(!0),()=>{e.onload=null}},[l]),a.useEffect(()=>{const e=t=>{t.key==="Escape"&&p&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[]);const g=a.useMemo(()=>S.debounce(async(e,t=!1)=>{i(!0);const s=e.imageBase64;await u(s,t),I(!1),i(!1)},300),[u]),r=a.useCallback((e,t=!1)=>{g(e,t)},[g]),x=a.useCallback(()=>{I(!1),m()},[m]),d=a.useMemo(()=>({tabsIds:["Adjust","Annotate","Watermark","Finetune","Resize","Filters"],toolsIds:["Rotate"],defaultTabId:"Adjust",defaultToolId:"Rotate"}),[]),C=a.useMemo(()=>({colors:{primary:"#000000",secondary:"#000000",tertiary:"#000000"}}),[]),E=a.useMemo(()=>f?[{label:n("Update this file"),onClick:(e,t)=>t((...s)=>{i(!0),r(s[0],!1)}),icon:c.Save},{label:n("Save as new file"),onClick:(e,t)=>t((...s)=>{i(!0),r(s[0],!0)}),icon:c.Copy}]:[],[f,r,n]);return o.jsx(b.Dialog,{open:!0,onOpenChange:e=>!e&&x(),children:o.jsxs(b.DialogContent,{id:"chai-image-editor-container",className:"flex h-[80vh] max-h-[1232px] w-[80vw] max-w-[1232px] flex-col space-y-4 p-0",children:[v&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 text-white",children:o.jsx(c.Loader,{className:"h-4 w-4 animate-spin"})}),p&&w&&o.jsx(T,{theme:C,source:l,onSave:r,onClose:x,Text:{text:n("Add text here")},Rotate:{angle:90,componentType:"slider"},tabsIds:d.tabsIds,defaultTabId:d.defaultTabId,defaultToolId:d.defaultToolId,savingPixelRatio:20,previewPixelRatio:6,defaultSavedImageName:y,moreSaveOptions:E,useZoomPresetsMenu:!0})]})})});h.displayName="ImageEditor";exports.default=h;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as i, jsxs as E } from "react/jsx-runtime";
|
|
2
|
-
import { D as L, e as R } from "./index-
|
|
2
|
+
import { D as L, e as R } from "./index-DsQXiNA_.js";
|
|
3
3
|
import { debounce as S } from "lodash-es";
|
|
4
4
|
import { Save as j, Copy as D, Loader as O } from "lucide-react";
|
|
5
5
|
import { memo as P, useState as m, useEffect as x, useMemo as r, useCallback as b } from "react";
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|