@chaibuilder/sdk 4.0.0-beta.39 → 4.0.0-beta.40
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-CrizdRp9.cjs → 2SSKDMRQ-D-2rSLsq.cjs} +1 -1
- package/dist/{2SSKDMRQ-BcWcE20A.js → 2SSKDMRQ-DKit4bEt.js} +2 -2
- package/dist/{AP7HFJJL-CTA4QETG.js → AP7HFJJL-BWruCozs.js} +1 -1
- package/dist/{AP7HFJJL-DBZaIXdU.cjs → AP7HFJJL-CAE2yHEv.cjs} +1 -1
- package/dist/{IconPicker-CQPu4qCk.js → IconPicker-BOBnjfJc.js} +1 -1
- package/dist/{WDYDFRGG-Dq7X-4LG.cjs → WDYDFRGG-BNve1FlV.cjs} +1 -1
- package/dist/{WDYDFRGG-DXflAYc6.js → WDYDFRGG-Bv40IVPG.js} +2 -2
- package/dist/{active-in-another-tab-CS_Xyg9M.cjs → active-in-another-tab-BPBvEwmD.cjs} +1 -1
- package/dist/{active-in-another-tab-Bq_Wa7Kh.js → active-in-another-tab-C334yD2g.js} +2 -2
- package/dist/{add-new-language-page-DwrzMqcA.cjs → add-new-language-page-BVME8b7v.cjs} +1 -1
- package/dist/{add-new-language-page-B8L-hQcH.js → add-new-language-page-DVL-HkWR.js} +3 -3
- package/dist/{add-new-page-BHKNRQyt.cjs → add-new-page-BPysPck8.cjs} +1 -1
- package/dist/{add-new-page-AV_1Z_BE.js → add-new-page-BQOsHkVl.js} +2 -2
- package/dist/{ai-panel-content-Doozx8LF.cjs → ai-panel-content-BsElc0Ke.cjs} +1 -1
- package/dist/{ai-panel-content-BrPbjb_D.js → ai-panel-content-BwX0YBGD.js} +3 -3
- package/dist/{ai-panel-default-lang-Bi8DGULC.cjs → ai-panel-default-lang-BqhAu1iN.cjs} +1 -1
- package/dist/{ai-panel-default-lang-DQf2LA2L.js → ai-panel-default-lang-CYZuwSQn.js} +6 -6
- package/dist/{ai-panel-other-lang-UyfYikvT.js → ai-panel-other-lang-CL83Mwha.js} +13 -13
- package/dist/{ai-panel-other-lang-DKTFzStW.cjs → ai-panel-other-lang-CivH2s8Q.cjs} +1 -1
- package/dist/{ai-prompt-input-CrRc0Z7y.js → ai-prompt-input-C37B_jlE.js} +1 -1
- package/dist/{ai-translation-prompt-DE5XCMVu.cjs → ai-translation-prompt-CgZKlkF_.cjs} +1 -1
- package/dist/{ai-translation-prompt-CJUenKeN.js → ai-translation-prompt-V5PBEZRn.js} +1 -1
- package/dist/{change-password-modal-CRyy3prg.js → change-password-modal-AQU_GLqq.js} +2 -2
- package/dist/{change-password-modal-7aF0hhk-.cjs → change-password-modal-Chufk3yU.cjs} +1 -1
- package/dist/{code-editor-ClZiD7lg.js → code-editor-D-fpas30.js} +1 -1
- package/dist/{continue-editing-in-this-client-DW7I9Mpe.cjs → continue-editing-in-this-client-BNEnV0hi.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-DFvQosVX.js → continue-editing-in-this-client-Dx3f64SH.js} +2 -2
- package/dist/core.js +8 -8
- package/dist/{css-import-modal-nJooZxLU.js → css-import-modal-c_6VH1js.js} +1 -1
- package/dist/{delete-page-Bjd442Zg.js → delete-page-B1R1w8O5.js} +2 -2
- package/dist/{delete-page-CVwEDtXv.cjs → delete-page-DbQDbCyB.cjs} +1 -1
- package/dist/{design-token-usage-nTgxy81G.js → design-token-usage-11kPk5n1.js} +18 -18
- package/dist/{digital-asset-manager-CmFVa94V.cjs → digital-asset-manager-B0h5rUVQ.cjs} +1 -1
- package/dist/{digital-asset-manager-Bh81gahp.js → digital-asset-manager-BbEQ8cPb.js} +3 -3
- package/dist/{duplicate-page-BcjVrWcG.js → duplicate-page-BY_Pcqbb.js} +3 -3
- package/dist/{duplicate-page-CDlNKgey.cjs → duplicate-page-BaAzKbiX.cjs} +1 -1
- package/dist/{dynamic-page-selector-Bqm8905G.cjs → dynamic-page-selector-DzH_gCQ4.cjs} +1 -1
- package/dist/{dynamic-page-selector-B4nvhjx6.js → dynamic-page-selector-bsaLGZkO.js} +2 -2
- package/dist/{image-editor-JNxRYYiG.js → image-editor-CyGqVNvX.js} +1 -1
- package/dist/{index-By4ZAgM3.js → index-BpVxZOd-.js} +1587 -1581
- package/dist/index-CQf0jL1k.cjs +5 -0
- package/dist/{index-7OSd9ssH.js → index-DpeytsiB.js} +38 -38
- package/dist/{json-diff-viewer-DmMae-RI.cjs → json-diff-viewer-BBERGXdt.cjs} +1 -1
- package/dist/{json-diff-viewer-89Jo1RMw.js → json-diff-viewer-C-bpInzt.js} +41 -41
- package/dist/{lang-panel-Dwus0Ere.js → lang-panel-4Q_PTmKm.js} +3 -3
- package/dist/{lang-panel-CMxkNgMj.cjs → lang-panel-uI149Beq.cjs} +1 -1
- package/dist/{manage-design-tokens-QAUcjndy.js → manage-design-tokens-CHpHE-dx.js} +9 -9
- package/dist/{manage-design-tokens-modal-BpkJx1YU.js → manage-design-tokens-modal-DO_tHkgp.js} +2 -2
- package/dist/{mark-as-template-CYam4yZo.cjs → mark-as-template-BEnMYTql.cjs} +1 -1
- package/dist/{mark-as-template-BsrSmjXD.js → mark-as-template-Ca3QLzX4.js} +2 -2
- package/dist/{nested-path-selector-content-CoovvfzI.js → nested-path-selector-content-5gECLoRV.js} +1 -1
- package/dist/{no-language-page-content-Ct9N81tE.js → no-language-page-content-Bb3nUSLv.js} +2 -2
- package/dist/{no-language-page-content-y0ZHol_q.cjs → no-language-page-content-CKxggLC_.cjs} +1 -1
- package/dist/{no-language-page-dialog-ReXCVTbW.js → no-language-page-dialog-BEVRCAhM.js} +2 -2
- package/dist/{no-language-page-dialog--aNToxYL.cjs → no-language-page-dialog-DMb5Z5on.cjs} +1 -1
- package/dist/{page-creator-npkwiskB.cjs → page-creator-C_95U8kn.cjs} +1 -1
- package/dist/{page-creator-CA016zh5.js → page-creator-DQRFXhNj.js} +51 -51
- package/dist/{page-lock-u-_c4KNm.js → page-lock-Be5wPHz5.js} +2 -2
- package/dist/{page-lock-a6tjvGFZ.cjs → page-lock-DKWt66MX.cjs} +1 -1
- package/dist/{page-locked-dialog-Ba2alb7I.cjs → page-locked-dialog-CWyZol0i.cjs} +1 -1
- package/dist/{page-locked-dialog-BgYhqsTp.js → page-locked-dialog-CkXpQUpO.js} +4 -4
- package/dist/{page-manager-new-vSAd74ha.js → page-manager-new-2gYNPR6y.js} +3 -3
- package/dist/{page-manager-new-D50CT83l.cjs → page-manager-new-Bt7rBO1J.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-BHHMe76x.js → page-manager-search-and-filter-BotSCoAo.js} +5 -5
- package/dist/{page-manager-search-and-filter-C-RUmk2F.cjs → page-manager-search-and-filter-Dkwl089C.cjs} +1 -1
- package/dist/{page-revisions-content-DltGMooA.js → page-revisions-content-OigWteYc.js} +13 -13
- package/dist/{page-revisions-content-BIVAWoTR.cjs → page-revisions-content-bQ32feXp.cjs} +1 -1
- package/dist/pages.cjs +1 -1
- package/dist/pages.js +1 -1
- package/dist/{publish-pages-content-D7szOpuc.js → publish-pages-content-2RcG3Ptp.js} +3 -3
- package/dist/{publish-pages-content-cwvy42Ki.cjs → publish-pages-content-Dtkal6ue.cjs} +1 -1
- package/dist/{rte-widget-modal-iLgUdcBu.js → rte-widget-modal-DmQk0Lfj.js} +1 -1
- package/dist/{save-to-lib-J_EuJeDc.cjs → save-to-lib-BSsuvkZS.cjs} +1 -1
- package/dist/{save-to-lib-DeiLaQkZ.js → save-to-lib-CVqlFkRK.js} +7 -7
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CNF87vmF.cjs → selected-block-display-Cr7R1ojV.cjs} +1 -1
- package/dist/{selected-block-display-QQ9XJDjM.js → selected-block-display-DngI-pF1.js} +20 -20
- package/dist/{seo-panel-CZClW8ir.cjs → seo-panel-BMYdzcoJ.cjs} +1 -1
- package/dist/{seo-panel-Co1nnRam.js → seo-panel-CHkFLI5b.js} +2 -2
- package/dist/{shared-json-ld-BoiITtvd.js → shared-json-ld-BzjOUN-P.js} +15 -15
- package/dist/{shared-json-ld-D95s9hEi.cjs → shared-json-ld-ClIZw1aA.cjs} +1 -1
- package/dist/{slug-input-DcYoeQxL.js → slug-input-07EKw9U5.js} +1 -1
- package/dist/{take-over-request-BMXtQxzX.cjs → take-over-request-BLdOZhUs.cjs} +1 -1
- package/dist/{take-over-request-BEffb4ve.js → take-over-request-zqtItFSK.js} +6 -6
- package/dist/{translation-warning-modal-DEW8JWRh.js → translation-warning-modal-DnSd7lOJ.js} +1 -1
- package/dist/{unmark-as-template-CCm3f8cE.cjs → unmark-as-template-C4UkGyOP.cjs} +1 -1
- package/dist/{unmark-as-template-Zmv7v2cS.js → unmark-as-template-DIKZYr01.js} +2 -2
- package/dist/{unpublish-page-BJu004pK.js → unpublish-page-CK0sAZcB.js} +2 -2
- package/dist/{unpublish-page-8i-1uR98.cjs → unpublish-page-DFXLzJbc.cjs} +1 -1
- package/dist/unpublished-partials-modal-BAr1SkEG.cjs +1 -0
- package/dist/unpublished-partials-modal-CDaOvXgp.js +52 -0
- package/dist/{web-preview-Bg6I0jk7.js → web-preview-CRSjh2he.js} +1 -1
- package/dist/{web-preview-BpsfCkMt.cjs → web-preview-DA7_F3vv.cjs} +1 -1
- package/package.json +1 -1
- package/dist/index-DeEYXKvD.cjs +0 -5
- package/dist/unpublished-partials-modal-D50Hxk6N.cjs +0 -1
- package/dist/unpublished-partials-modal-Do2HSNYq.js +0 -41
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { B as M, z as f } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import {
|
|
3
|
+
import { X as b, Y as C, P as j } from "./index-DpeytsiB.js";
|
|
4
4
|
import { MagnifyingGlassIcon as x } from "@radix-ui/react-icons";
|
|
5
5
|
import H from "fuse.js";
|
|
6
6
|
import { useState as g, useMemo as d } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AP7HFJJL-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./AP7HFJJL-CAE2yHEv.cjs"),t=require("./index-CQf0jL1k.cjs");var s=o=>{const[r,n]=e.createLocalStorage({prefix:"TanstackQueryDevtools"}),a=t.getPreferredColorScheme(),l=t.createMemo(()=>{const c=o.theme||r.theme_preference||e.THEME_PREFERENCE;return c!=="system"?c:a()});return t.createComponent(e.QueryDevtoolsContext.Provider,{value:o,get children(){return t.createComponent(e.PiPProvider,{localStore:r,setLocalStore:n,get children(){return t.createComponent(e.ThemeContext.Provider,{value:l,get children(){return t.createComponent(e.Devtools,{localStore:r,setLocalStore:n})}})}})}})},u=s;exports.default=u;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c, T as l, P as m, a as v, D as u, Q as i } from "./AP7HFJJL-
|
|
2
|
-
import { t as d, v as f, w as e } from "./index-
|
|
1
|
+
import { c, T as l, P as m, a as v, D as u, Q as i } from "./AP7HFJJL-BWruCozs.js";
|
|
2
|
+
import { t as d, v as f, w as e } from "./index-BpVxZOd-.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-P-2SvZA9.cjs"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-P-2SvZA9.cjs"),s=require("./index-CQf0jL1k.cjs"),n=require("lucide-react"),l=require("react-i18next"),o=()=>{const r=s.useSendRealtimeEvent(),{setPageStatus:i}=s.usePageLockStatus(),{t:a}=l.useTranslation();return e.jsx(s.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-xl font-medium",children:[e.jsx(n.TableIcon,{className:"h-6 w-6 text-green-500"}),e.jsx("span",{children:a("Active in Another Tab")})]})}),e.jsx(t.CardContent,{className:"space-y-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:a("This page is currently being edited in another tab. You can continue editing here, which will close the editor in the other tab.")})}),e.jsx(t.CardFooter,{className:"flex justify-end gap-2",children:e.jsxs(c.Button,{variant:"default",onClick:()=>{r(s.EVENT.CONTINUE_EDITING_IN_THIS_TAB_REQUEST),i(s.PAGE_STATUS.CHECKING)},className:"gap-2",children:[e.jsx(n.Edit,{className:"h-4 w-4"}),a("Continue Editing Here")]})})]})})};exports.default=o;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { B as r } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import {
|
|
4
|
-
import { am as d, a as h, B as u, E as p, P as N } from "./index-
|
|
3
|
+
import { G as i, H as o, I as l, J as c, K as m } from "./index-DpeytsiB.js";
|
|
4
|
+
import { am as d, a as h, B as u, E as p, P as N } from "./index-BpVxZOd-.js";
|
|
5
5
|
import { TableIcon as f, Edit as T } from "lucide-react";
|
|
6
6
|
import { useTranslation as E } from "react-i18next";
|
|
7
7
|
const b = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("./register-chai-top-bar-DyW9GPzV.cjs"),N=require("./index-P-2SvZA9.cjs"),Y=require("./slug-input-DHVDl_Dv.cjs"),g=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("./register-chai-top-bar-DyW9GPzV.cjs"),N=require("./index-P-2SvZA9.cjs"),Y=require("./slug-input-DHVDl_Dv.cjs"),g=require("./index-CQf0jL1k.cjs"),j=require("lodash-es"),ds=require("lucide-react"),v=require("react"),U=require("react-i18next"),Z=({edit:c,lang:h,languages:a,name:u,setLang:t,setName:i,primaryPageObject:o})=>{const{t:s}=U.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(N.Label,{htmlFor:"lang",children:s("Language")}),e.jsxs("select",{value:c?"":h,disabled:c||!a.length,onChange:l=>{const x=l.target.value;t(x),!c&&(j.startsWith(u,o==null?void 0:o.name)||u.length===0)&&i(`${o==null?void 0:o.name} - ${g.LANGUAGES[x]}`)},className:"col-span-3 flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx("option",{value:"",disabled:!0,children:c?g.LANGUAGES[h]||h:a.length?s("Choose language"):s("All available language page is created.")}),a.map(l=>e.jsx("option",{value:l,children:g.LANGUAGES[l]||l},l))]})]})},_=({lang:c,name:h,setName:a,parentHasSelectedLanguagePage:u})=>{const{t}=U.useTranslation();return e.jsxs("div",{className:"space-y-1",children:[e.jsx(N.Label,{htmlFor:"name",children:t("Page Name")}),e.jsx(k.Input,{id:"name",value:c?h:"",onChange:i=>a(i.target.value),required:!0,placeholder:t(c?"Enter page name":"Choose language to add slug"),disabled:!u||!c})]})},cs=({dynamic:c,isNonSlugPageType:h,isRootPage:a,lang:u,useLanguagePrefix:t,setUseLanguagePrefix:i,isHomePage:o,parentSlug:s,parentHasSelectedLanguagePage:l,slug:x,setSlug:d,setIsSlugValid:S,getSlug:f})=>{const{t:r}=U.useTranslation();return h?null:e.jsxs("div",{className:"space-y-1",children:[a&&u&&e.jsxs("div",{className:"flex items-center space-x-2 pb-1",children:[e.jsx("input",{type:"checkbox",id:"useLanguagePrefix",checked:t,onChange:A=>i(A.target.checked),className:"rounded border-gray-300"}),e.jsxs(N.Label,{htmlFor:"useLanguagePrefix",className:"text-sm font-normal leading-tight",children:["Add language code (",e.jsxs("span",{className:"font-mono text-gray-900",children:["/",u]}),") as slug prefix"]})]}),e.jsx(N.Label,{htmlFor:"slug",children:r("Slug")}),c?e.jsx(k.Alert,{variant:"default",className:"p-2 text-xs font-medium italic text-muted-foreground",children:r("This page will use dynamic slug as defined in primary page")}):e.jsx(Y.SlugInput,{disabled:!u||!l,value:x,onChange:d,placeholder:r(u?o&&t?"Leave empty for home page":"Enter page slug":"Choose language to add slug"),parentSlug:s,onValidationChange:S,fullSlug:f()})]})},H=({parentHasSelectedLanguagePage:c,name:h,lang:a,slug:u,edit:t,id:i,primaryPageObject:o,pages:s,isNonSlugPageType:l,isHomePage:x,useLanguagePrefix:d,isSlugValid:S,isPending:f})=>{const{t:r}=U.useTranslation(),A=f||!h||!a||s.some(m=>(t?m.id!==i:!0)&&m.parent===(o==null?void 0:o.id)&&m.lang===a)||!l&&!(x&&d)&&(!S||!u);return e.jsx(N.DialogFooter,{children:c?e.jsxs(e.Fragment,{children:[e.jsx(k.Button,{type:"submit",disabled:A&&!o.dynamic,children:f?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"loader mr-2"}),r(t?"Updating...":"Adding...")]}):r(t?"Update":"Add new language page")}),s.some(m=>(t?m.id!==i:!0)&&m.parent===(o==null?void 0:o.id)&&m.lang===a)&&e.jsx("p",{className:"mt-2 text-xs text-red-500",children:r("A page for this language already exists.")})]}):a&&e.jsx(k.Alert,{variant:"destructive",children:e.jsxs("p",{className:"mx-auto w-5/6 text-center",children:[r("You need to create the")," ",e.jsx("span",{className:"font-medium",children:g.LANGUAGES[a]})," ",r("page in the parent to add here.")]})})})},rs=({onSubmit:c,edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s,parentHasSelectedLanguagePage:l,id:x,pages:d,isNonSlugPageType:S,isHomePage:f,useLanguagePrefix:r,slug:A,isSlugValid:m,isPending:p})=>e.jsxs("form",{onSubmit:c,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(Z,{edit:h,lang:a,languages:u,name:t,setLang:i,setName:o,primaryPageObject:s}),e.jsx(_,{lang:a,name:t,setName:o,parentHasSelectedLanguagePage:l})]}),e.jsx(H,{parentHasSelectedLanguagePage:l,name:t,lang:a,slug:A,edit:h,id:x,primaryPageObject:s,pages:d,isNonSlugPageType:S,isHomePage:f,useLanguagePrefix:r,isSlugValid:m,isPending:p})]}),hs=({loading:c,onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,isNonSlugPageType:d,isRootPage:S,useLanguagePrefix:f,setUseLanguagePrefix:r,isHomePage:A,parentSlug:m,slug:p,setSlug:C,isSlugValid:T,setIsSlugValid:I,getSlug:M,isPending:$,id:q,pages:L})=>c?e.jsx("div",{className:"flex h-80 items-center justify-center",children:e.jsx(ds.Loader,{className:"animate-spin"})}):d?e.jsx(rs,{onSubmit:h,edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l,parentHasSelectedLanguagePage:x,id:q,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:f,slug:p,isSlugValid:T,isPending:$}):e.jsxs("form",{onSubmit:h,children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(Z,{edit:a,lang:u,languages:t,name:i,setLang:o,setName:s,primaryPageObject:l}),e.jsx(_,{lang:u,name:i,setName:s,parentHasSelectedLanguagePage:x}),e.jsx(cs,{dynamic:l==null?void 0:l.dynamic,isNonSlugPageType:d,isRootPage:S,lang:u,useLanguagePrefix:f,setUseLanguagePrefix:r,isHomePage:A,parentSlug:m,parentHasSelectedLanguagePage:x,slug:p,setSlug:C,isSlugValid:T,setIsSlugValid:I,getSlug:M})]}),e.jsx(H,{parentHasSelectedLanguagePage:x,name:i,lang:u,slug:p,edit:a,id:q,primaryPageObject:l,pages:L,isNonSlugPageType:d,isHomePage:A,useLanguagePrefix:f,isSlugValid:T,isPending:$})]}),xs=({id:c,isOpen:h,onClose:a,primaryPage:u,edit:t=!1,preselectedLang:i})=>{const{data:o=[]}=g.useWebsitePrimaryPages(),s=v.useMemo(()=>o.find(n=>n.id===u),[o,u]),[l,x]=v.useState(""),[d,S]=v.useState(""),[f,r]=v.useState(""),[A,m]=v.useState(!0),[p,C]=v.useState(!0),{mutate:T,isPending:I}=g.useCreatePage(),{mutate:M,isPending:$}=g.useUpdatePage(),q=I||$,{data:L,isFetching:b}=g.useWebsiteSetting(),z=g.useFallbackLang(),{data:w,isFetching:y}=g.useLanguagePages(u),{data:F=[],isFetching:P}=g.useLanguagePages(s==null?void 0:s.parent),{data:J=[],isFetching:O}=g.usePageTypes(),{setSelectedLang:ss}=N.useLanguages(),{t:B}=U.useTranslation(),[,es]=g.useSearchParams(),[,ns]=N.useSidebarActivePanel(),ts=b||y||P||O,G=v.useMemo(()=>j.filter(L==null?void 0:L.languages,n=>!j.find(w,{lang:n})),[L,w]),W=v.useMemo(()=>J.find(n=>n.key===(s==null?void 0:s.pageType)),[J,s==null?void 0:s.pageType]),K=!(W!=null&&W.hasSlug),V=(s==null?void 0:s.slug)==="/";v.useEffect(()=>{if(!t&&s&&i&&(S(i),x(`${s.name} - ${g.LANGUAGES[i]}`)),!t||!s)return;const n=w==null?void 0:w.find(is=>is.id===c);if(!n)return;x(n.name),S(n.lang);const E=n.slug||"",{initSlug:R,prefix:us}=Y.parseSlugForEdit(E,s);r(R),C(us)},[t,c,w,s,i]),v.useEffect(()=>{if(i)S(i);else if((G==null?void 0:G.length)===1&&!t){const n=G[0];if(!n||!g.LANGUAGES[n])return;S(n),(!l||l===(s==null?void 0:s.name))&&x(`${s==null?void 0:s.name} - ${g.LANGUAGES[n]}`)}},[i,G,t,l,s]);const{parentSlug:Q,isRootPage:D}=v.useMemo(()=>{if(V||!d)return{parentSlug:void 0,isRootPage:!(s!=null&&s.parent)};if(!(s!=null&&s.parent))return{parentSlug:p?`/${d}`:void 0,isRootPage:!0};const n=F==null?void 0:F.find(E=>E.lang===d);return{parentSlug:n==null?void 0:n.slug,isRootPage:!1}},[s==null?void 0:s.parent,F,p,d,V]),os=v.useMemo(()=>D?!0:!!(F!=null&&F.some(n=>(n==null?void 0:n.lang)===d)),[d,F,D]),X=()=>{let n="";return D?n=`/${p?[d,f].filter(Boolean).join("/"):f}`:n=`${Y.removeSlugExtension(Q)}/${f}`,n.replace(/\/{2,}/g,"/").replace(/\/$/,"")},ls=n=>{const E=new URLSearchParams(window.location.search);z&&n===z?E.delete("lang"):E.set("lang",n),es(E),window.dispatchEvent(new PopStateEvent("popstate"))},as=n=>{n.preventDefault();const E={name:l,lang:d,primaryPage:s==null?void 0:s.id,slug:K?"":X(),pageType:s==null?void 0:s.pageType,...t&&{id:c}},R=()=>{!t&&d&&(ss(d),ls(d)),ns("outline"),a()};t?M(E,{onSuccess:R}):T(E,{onSuccess:R})};return e.jsx(N.Dialog,{open:h,onOpenChange:a,children:h&&e.jsxs(N.DialogContent,{className:"text-slate-600 sm:max-w-[425px]",children:[e.jsxs(N.DialogHeader,{children:[e.jsx(N.DialogTitle,{children:B(t?"Edit language":"Add new language page")}),e.jsx(N.DialogDescription,{className:"font-light",children:B("Enter the details for the language")})]}),e.jsx(hs,{id:c,pages:o,loading:ts,onSubmit:as,edit:t,lang:d,languages:G,name:l,setLang:S,setName:x,primaryPageObject:s,parentHasSelectedLanguagePage:os,isNonSlugPageType:K,isRootPage:D,useLanguagePrefix:p,setUseLanguagePrefix:C,isHomePage:V,parentSlug:Q,slug:f,setSlug:r,isSlugValid:A,setIsSlugValid:m,getSlug:X,isPending:q})]})})};exports.default=xs;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as t, jsxs as g, Fragment as hn } from "react/jsx-runtime";
|
|
2
2
|
import { z as fn, D as H, B as gn } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { d as mn, n as xn, D as vn, e as pn, f as Sn, g as Nn, o as Fn, p as I, q as wn } from "./index-
|
|
4
|
-
import { p as An, r as Cn, S as Dn } from "./slug-input-
|
|
5
|
-
import { e as En, f as $n, g as Ln, h as kn, i as Tn, j as Z, k as Un, c as Bn, L as A } from "./index-
|
|
3
|
+
import { d as mn, n as xn, D as vn, e as pn, f as Sn, g as Nn, o as Fn, p as I, q as wn } from "./index-DpeytsiB.js";
|
|
4
|
+
import { p as An, r as Cn, S as Dn } from "./slug-input-07EKw9U5.js";
|
|
5
|
+
import { e as En, f as $n, g as Ln, h as kn, i as Tn, j as Z, k as Un, c as Bn, L as A } from "./index-BpVxZOd-.js";
|
|
6
6
|
import { filter as Rn, find as Wn, startsWith as In } from "lodash-es";
|
|
7
7
|
import { Loader as qn } from "lucide-react";
|
|
8
8
|
import { useMemo as $, useState as L, useEffect as _ } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-P-2SvZA9.cjs"),c=require("react"),a=require("react-i18next"),u=c.lazy(()=>Promise.resolve().then(()=>require("./page-creator-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-P-2SvZA9.cjs"),c=require("react"),a=require("react-i18next"),u=c.lazy(()=>Promise.resolve().then(()=>require("./page-creator-C_95U8kn.cjs"))),x=({addEditPage:n,setAddEditPage:r,closePanel:l})=>{const{t:o}=a.useTranslation(),t=!!(n!=null&&n.id),i=!!n;return e.jsx(s.Dialog,{open:i,onOpenChange:()=>r(void 0),children:i&&e.jsxs(s.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(s.DialogHeader,{children:[e.jsxs(s.DialogTitle,{children:[o(t?"Edit":"Add New")," "]}),e.jsx(s.DialogDescription,{children:o(t?"Update your page name":"Enter details to create a new page")})]}),e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"min-h-40"}),children:e.jsx(u,{closePanel:l,addEditPage:n,close:()=>r(void 0)})})]})})};exports.default=x;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
|
-
import { D as t, e as c, f as m, g as p, o as h } from "./index-
|
|
2
|
+
import { D as t, e as c, f as m, g as p, o as h } from "./index-DpeytsiB.js";
|
|
3
3
|
import { Suspense as f, lazy as D } from "react";
|
|
4
4
|
import { useTranslation as u } from "react-i18next";
|
|
5
|
-
const x = D(() => import("./page-creator-
|
|
5
|
+
const x = D(() => import("./page-creator-DQRFXhNj.js")), C = ({
|
|
6
6
|
addEditPage: o,
|
|
7
7
|
setAddEditPage: s,
|
|
8
8
|
closePanel: l
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),L=require("./register-chai-top-bar-DyW9GPzV.cjs"),N=require("./index-P-2SvZA9.cjs"),j=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),L=require("./register-chai-top-bar-DyW9GPzV.cjs"),N=require("./index-P-2SvZA9.cjs"),j=require("./index-CQf0jL1k.cjs"),M=require("lucide-react"),s=require("react"),k=require("react-i18next"),A=require("sonner"),B=require("./models-5gOsRC56.cjs"),R=s.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-default-lang-BqhAu1iN.cjs"))),z=s.lazy(()=>Promise.resolve().then(()=>require("./ai-panel-other-lang-CivH2s8Q.cjs"))),F=()=>{const{t:o}=k.useTranslation(),[m,a]=s.useState(""),[t,l]=s.useState([]),[c,i]=s.useState(!1),[u,d]=s.useState(null),[S,f]=s.useState(null),[p,b]=s.useState(B.getDefaultModel().id),{selectedLang:h,fallbackLang:q}=N.useLanguages(),P=j.useBuilderFetch(),[v]=j.useSearchParams(),w=v.get("page"),C=(t==null?void 0:t.filter(n=>n.role==="user").length)>=4,y=(t==null?void 0:t.filter(n=>n.role==="user").length)>=10;s.useEffect(()=>{l([])},[h,w]);const g=()=>{l([]),a(""),f(null),d(null),i(!1)},x={t:o,fetch:P,input:m,messages:t,setInput:a,isLoading:c,handleStop:()=>{u&&(u.abort(),d(null)),i(!1),a(""),f(null),l(n=>{const r=n[n.length-1];return r&&r.role==="assistant"&&r.isReasoning&&r.isStreaming?n.slice(0,-1):n}),A.toast.info(o("Generation stopped"))},handleReset:g,setMessages:l,setIsLoading:i,currentBlock:S,fallbackLang:q,abortController:u,setCurrentBlock:f,setAbortController:d,forceNewConversation:y,suggestNewConversation:C,selectedModel:p,onModelChange:b};return e.jsxs(e.Fragment,{children:[c&&e.jsx("div",{className:"fixed inset-0 left-0 top-0 z-40 flex h-screen w-screen flex-col items-center justify-center bg-transparent"}),e.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx("p",{className:"text-xs text-gray-500",children:o("Your conversation will not be saved")}),(t==null?void 0:t.length)>0&&e.jsx(L.Button,{variant:"outline",size:"icon",onClick:g,className:"h-6 w-6",disabled:c,children:e.jsx(M.Plus,{})})]}),e.jsx(s.Suspense,{fallback:e.jsx("div",{className:"flex h-full w-full items-center justify-center text-xs",children:"Loading AI Panel"}),children:h?e.jsx(z,{...x,selectedLang:h}):e.jsx(R,{...x})})]})]})};exports.default=F;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as h, Fragment as k, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { B as y } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { d as A } from "./index-
|
|
4
|
-
import { s as B, c as F } from "./index-
|
|
3
|
+
import { d as A } from "./index-DpeytsiB.js";
|
|
4
|
+
import { s as B, c as F } from "./index-BpVxZOd-.js";
|
|
5
5
|
import { Plus as z } from "lucide-react";
|
|
6
6
|
import { useState as l, useEffect as I, Suspense as D, lazy as x } from "react";
|
|
7
7
|
import { useTranslation as R } from "react-i18next";
|
|
8
8
|
import { toast as E } from "sonner";
|
|
9
9
|
import { g as G } from "./models-D95ZYr_x.js";
|
|
10
|
-
const O = x(() => import("./ai-panel-default-lang-
|
|
10
|
+
const O = x(() => import("./ai-panel-default-lang-CYZuwSQn.js")), T = x(() => import("./ai-panel-other-lang-CL83Mwha.js")), Z = () => {
|
|
11
11
|
const { t: r } = R(), [b, a] = l(""), [e, s] = l([]), [i, c] = l(!1), [f, u] = l(null), [w, d] = l(null), [C, L] = l(G().id), { selectedLang: m, fallbackLang: N } = A(), P = B(), [S] = F(), v = S.get("page"), M = (e == null ? void 0 : e.filter((t) => t.role === "user").length) >= 4, j = (e == null ? void 0 : e.filter((t) => t.role === "user").length) >= 10;
|
|
12
12
|
I(() => {
|
|
13
13
|
s([]);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),S=require("./index-P-2SvZA9.cjs"),p=require("./selected-block-display-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),S=require("./index-P-2SvZA9.cjs"),p=require("./selected-block-display-Cr7R1ojV.cjs"),P=require("lucide-react"),j=require("react"),W=require("sonner"),F=require("./models-5gOsRC56.cjs"),L=require("./apply-binding-BuwI_Uf5.cjs"),O=require("@tanstack/react-query"),$=()=>{const{addPredefinedBlock:k}=S.useAddBlock(),N=S.useReplaceBlock(),y=S.useRemoveBlocks(),T=O.useQueryClient(),w=async(r,e)=>{if(!e)return;const s=L.getBlocksFromHTML(e);await k(s,r.parentId,r.position)},B=async(r,e)=>{if(!r.blockId||!e)return;const s=L.getBlocksFromHTML(e);await N(r.blockId,s)},I=async r=>{!r.ids||r.ids.length===0||await y(r.ids)};let d=null;const E=(r,e)=>{const s=document.getElementById("canvas-iframe");if(!s)return null;const u=s==null?void 0:s.contentDocument;if(!u)return null;u.querySelectorAll("[data-stream-canvas]").forEach(n=>n.remove());let o=null;if(r&&r!=="undefined"&&(o=u.querySelector(`[data-block-id="${r}"]`)),o||(o=u.body),!o)return null;if(d=u.createElement("div"),d.setAttribute("data-stream-canvas","true"),e!==void 0&&e>=0&&o.children){const n=Math.min(e,o.children.length);n<o.children.length?o.insertBefore(d,o.children[n]):o.appendChild(d)}else o.appendChild(d);return d},H=r=>{var o;const e=document.getElementById("canvas-iframe");if(!e)return null;const s=e==null?void 0:e.contentDocument;if(!s)return null;s.querySelectorAll("[data-stream-canvas]").forEach(n=>n.remove());const f=s.querySelector(`[data-block-id="${r}"]`);return f?(d=s.createElement("div"),d.setAttribute("data-stream-canvas","true"),(o=f.parentNode)==null||o.insertBefore(d,f.nextSibling),f.style.display="none",d):null},M=r=>{const e=document.getElementById("canvas-iframe");(e==null?void 0:e.contentWindow)&&r.scrollIntoView({behavior:"smooth",block:"end"})},v=(r,e,s)=>{const u=E(e,s);u&&(u.innerHTML=r,M(u))},x=(r,e)=>{const s=H(e);s&&(s.innerHTML=r,M(s))},D=r=>{const e=r.match(/^--ACTION=(.+)--$/);if(!e)return null;let u=e[1].replace(/--/g,"").split("|");const o={type:u[0]};return u.forEach(n=>{const t=n.trim();if(t.startsWith("PARENT=")){const A=t.substring(7);o.parentId=A==="undefined"?void 0:A}else t.startsWith("POS=")?o.position=parseInt(t.substring(4)):t.startsWith("ID=")?o.blockId=t.substring(3):t.startsWith("IDS=")&&(o.ids=t.substring(4).split(",").map(A=>A.trim()))}),o};return j.useCallback(async(r,e)=>{const s=new TextDecoder;let u="",f="",o=!1,n=null;const t={isInAction:!1,currentAction:null,htmlBuffer:"",isCapturingHtml:!1},A=async m=>{const i=m.trim();if(i==="--START--"){o=!0;return}if(o){if(i==="--END--"){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await C(t.currentAction,t.htmlBuffer),d&&(d.remove(),d=null);return}if(i.startsWith("--THINKING=")){const c=i.substring(11);e(l=>{const h=[...l],g=h[h.length-1];if(g&&g.role==="assistant"&&g.isReasoning)g.content=c,g.isStreaming=!1;else{const b={id:Date.now().toString(),role:"assistant",content:c,isReasoning:!0,isStreaming:!1};h.push(b)}return h});return}if(i.startsWith("--TASK=")){const c=i.substring(7),l=`task-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,h={id:l,role:"assistant",content:c.replace(/--$/,""),isTask:!0,isTaskLoading:!0,isTaskCompleted:!1};n=l,e(g=>[...g,h]);return}if(i.startsWith("--MSG=")){const c=i.substring(6),l={id:Date.now().toString(),role:"assistant",content:c.replace(/--$/g,""),isReasoning:!1,isStreaming:!1};e(h=>[...h,l]);return}if(i.startsWith("--ACTION=")){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await C(t.currentAction,t.htmlBuffer),t.currentAction=D(i),t.htmlBuffer="",t.isInAction=!0;return}if(i==="--ENDACTION--"){t.currentAction&&(t.htmlBuffer||t.currentAction.type==="REMOVE")&&await C(t.currentAction,t.htmlBuffer),n&&(e(c=>c.map(l=>l.isTask?{...l,isTaskCompleted:!0}:l)),n=null),t.currentAction=null,t.htmlBuffer="",t.isInAction=!1;return}if(i==="--HTML--"){t.isCapturingHtml=!0;return}if(i==="--ENDHTML--"){t.isCapturingHtml=!1;return}if(i.startsWith("--HTML--")&&i.includes("--ENDHTML--")){const c=i.match(/^--HTML--(.+?)--ENDHTML--$/);if(c&&t.currentAction){const l=c[1];t.htmlBuffer+=l,t.currentAction.type==="ADD"?v(t.htmlBuffer,t.currentAction.parentId,t.currentAction.position):t.currentAction.type==="EDIT"&&t.currentAction.blockId&&x(t.htmlBuffer,t.currentAction.blockId)}return}t.isCapturingHtml&&t.currentAction&&(t.htmlBuffer+=m+`
|
|
2
2
|
`,t.currentAction.type==="ADD"?v(t.htmlBuffer,t.currentAction.parentId,t.currentAction.position):t.currentAction.type==="EDIT"&&t.currentAction.blockId&&x(t.htmlBuffer,t.currentAction.blockId))}},C=async(m,i)=>{try{switch(m.type){case"ADD":await w(m,i);break;case"EDIT":await B(m,i);break;case"REMOVE":await I(m);break}e(c=>c.filter(l=>!l.isTask))}catch(c){console.log(c)}};try{for(;;){const{done:m,value:i}=await r.read();if(m)break;const c=s.decode(i,{stream:!0});u+=c,f+=c;const l=f.split(`
|
|
3
3
|
`);f=l.pop()||"";for(const h of l)await A(h)}f&&await A(f),T.invalidateQueries({queryKey:["AI_USAGE"]})}catch(m){console.log(m)}},[y])},V=j.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-BuP52voq.cjs"))),K=({t:k,fetch:N,input:y,messages:T,setInput:w,isLoading:B,setMessages:I,handleStop:d,setIsLoading:E,currentBlock:H,fallbackLang:M,setCurrentBlock:v,setAbortController:x,selectedModel:D=F.getDefaultModel().id,onModelChange:r})=>{const e=S.useSelectedBlock(),[,s]=S.useSelectedBlockIds(),u=S.useBlocksHtmlForAi(),f=$(),o=async(n,t,A,C)=>{var h;if(!n||B)return;v(e);const m=u(e?{blockId:e._id,additionalCoreBlocks:["Icon"]}:{additionalCoreBlocks:["Icon"]});if(e&&!m){W.toast.error(k("Something went wrong. Please try again."));return}const i={id:Date.now().toString(),role:"user",content:p.getUserPrompt({language:M,userInput:t||n,currentHtml:m}),userMessage:n},c={id:(Date.now()+1).toString(),role:"assistant",content:"",isReasoning:!0,isStreaming:!0};I(g=>[...g,i,c]),E(!0);const l=new AbortController;x(l);try{const g={messages:[i].map(q=>({role:q.role,content:q.content})),model:C||D};A&&(g.image=A);const b=await N({body:{action:"ASK_AI",data:g},streamResponse:!0});if(!b.ok)throw new Error(k("Failed to get AI response"));const R=(h=b.body)==null?void 0:h.getReader();if(!R)throw new Error(k("Response body is not readable"));await f(R,I)}catch(g){if(g.name!=="AbortError"){const b={id:(Date.now()+1).toString(),role:"assistant",content:k("Sorry, I encountered an error. Please try again.")};I(R=>[...R,b])}}finally{w(""),E(!1),v(null),x(null)}};return a.jsxs(a.Fragment,{children:[a.jsxs(p.Conversation,{className:"no-scrollbar",children:[a.jsxs(p.ConversationContent,{className:"gap-2 px-0",children:[T.length===0&&a.jsx(p.ConversationEmptyState,{icon:a.jsx(P.Bot,{size:48,className:"text-gray-300"}),title:"Start a conversation",description:k("Start a conversation with the AI assistant to add/edit current page")}),T.map(n=>n.role!=="system"&&a.jsx(j.Fragment,{children:n.isReasoning?a.jsxs(p.Reasoning,{isStreaming:n.isStreaming,defaultOpen:!0,children:[a.jsx(p.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),a.jsx(p.ReasoningContent,{className:"p-0 text-xs",children:n.content})]}):n.isTask&&!n.isTaskCompleted?a.jsx(p.TaskMessage,{content:n.content,isLoading:n.isTaskLoading}):a.jsx(p.Message,{from:n.role,children:a.jsx(p.MessageContent,{className:"p-0",children:n.role==="assistant"?a.jsx(p.MessageResponse,{className:"p-0 text-xs",children:n.content}):a.jsx("div",{className:"p-0 text-xs",children:n.userMessage||n.content})})})},n.id))]}),a.jsx(p.ConversationScrollButton,{})]}),a.jsxs("div",{className:"border-gray-200 pb-2",children:[a.jsx(p.SelectedBlockDisplay,{onRemove:()=>s([]),isLoading:B}),a.jsx(j.Suspense,{fallback:a.jsx("div",{children:"Loading..."}),children:a.jsx(V,{input:y,setInput:w,onSend:o,onStop:d,isLoading:B,selectedLang:"",currentBlock:e||H,disabled:(y==null?void 0:y.length)===0,selectedModel:D,onModelChange:r})})]})]})};exports.default=K;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as C, Fragment as W, jsx as d } from "react/jsx-runtime";
|
|
2
|
-
import { ah as F, ai as P, aj as O,
|
|
3
|
-
import { C as j, a as K, b as _, R as G, c as
|
|
2
|
+
import { ah as F, ai as P, aj as O, U as $, a as q, ak as V } from "./index-DpeytsiB.js";
|
|
3
|
+
import { C as j, a as K, b as _, R as G, c as U, d as z, T as Q, M as J, e as X, f as Y, h as Z, S as tt, i as et } from "./selected-block-display-DngI-pF1.js";
|
|
4
4
|
import { Bot as nt } from "lucide-react";
|
|
5
5
|
import { useCallback as rt, Fragment as st, Suspense as ot, lazy as at } from "react";
|
|
6
6
|
import { toast as it } from "sonner";
|
|
@@ -199,7 +199,7 @@ const ut = () => {
|
|
|
199
199
|
},
|
|
200
200
|
[k]
|
|
201
201
|
);
|
|
202
|
-
}, dt = at(() => import("./ai-prompt-input-
|
|
202
|
+
}, dt = at(() => import("./ai-prompt-input-C37B_jlE.js")), It = ({
|
|
203
203
|
t: A,
|
|
204
204
|
fetch: x,
|
|
205
205
|
input: k,
|
|
@@ -285,9 +285,9 @@ const ut = () => {
|
|
|
285
285
|
),
|
|
286
286
|
w.map(
|
|
287
287
|
(n) => n.role !== "system" && /* @__PURE__ */ d(st, { children: n.isReasoning ? /* @__PURE__ */ C(G, { isStreaming: n.isStreaming, defaultOpen: !0, children: [
|
|
288
|
-
/* @__PURE__ */ d(
|
|
289
|
-
/* @__PURE__ */ d(
|
|
290
|
-
] }) : n.isTask && !n.isTaskCompleted ? /* @__PURE__ */ d(
|
|
288
|
+
/* @__PURE__ */ d(U, { className: "text-xs [&_p]:text-muted-foreground" }),
|
|
289
|
+
/* @__PURE__ */ d(z, { className: "p-0 text-xs", children: n.content })
|
|
290
|
+
] }) : n.isTask && !n.isTaskCompleted ? /* @__PURE__ */ d(Q, { content: n.content, isLoading: n.isTaskLoading }) : /* @__PURE__ */ d(J, { from: n.role, children: /* @__PURE__ */ d(X, { className: "p-0", children: n.role === "assistant" ? /* @__PURE__ */ d(Y, { className: "p-0 text-xs", children: n.content }) : /* @__PURE__ */ d("div", { className: "p-0 text-xs", children: n.userMessage || n.content }) }) }) }, n.id)
|
|
291
291
|
)
|
|
292
292
|
] }),
|
|
293
293
|
/* @__PURE__ */ d(Z, {})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as c, Fragment as $, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { C as Y, a as Z, b as L, R as ee, c as te, d as ne, T as se, M as oe, e as ae, f as re, S as ie, g as ce } from "./selected-block-display-
|
|
2
|
+
import { U as G, a as H, V as Q, W as X } from "./index-DpeytsiB.js";
|
|
3
|
+
import { C as Y, a as Z, b as L, R as ee, c as te, d as ne, T as se, M as oe, e as ae, f as re, S as ie, g as ce } from "./selected-block-display-DngI-pF1.js";
|
|
4
4
|
import { Bot as le } from "lucide-react";
|
|
5
5
|
import { useRef as de, useEffect as ue, Suspense as B, lazy as v, Fragment as he } from "react";
|
|
6
6
|
import { useTranslation as me } from "react-i18next";
|
|
7
7
|
import { g as ge } from "./models-D95ZYr_x.js";
|
|
8
|
-
const fe = v(() => import("./ai-translation-prompt-
|
|
8
|
+
const fe = v(() => import("./ai-translation-prompt-V5PBEZRn.js")), pe = v(() => import("./ai-prompt-input-C37B_jlE.js")), xe = ({
|
|
9
9
|
fetch: A,
|
|
10
10
|
input: o,
|
|
11
11
|
messages: l,
|
|
@@ -52,24 +52,24 @@ const fe = v(() => import("./ai-translation-prompt-CJUenKeN.js")), pe = v(() =>
|
|
|
52
52
|
};
|
|
53
53
|
d(!0);
|
|
54
54
|
const q = new AbortController();
|
|
55
|
-
O(q), g((
|
|
55
|
+
O(q), g((b) => [...b, w, U]), d(!0);
|
|
56
56
|
try {
|
|
57
|
-
const
|
|
57
|
+
const x = await A({ body: { action: "ASK_AI", data: {
|
|
58
58
|
messages: [w],
|
|
59
59
|
initiator: S ? "TRANSLATE_CONTENT" : "UPDATE_CONTENT",
|
|
60
60
|
model: _ || p
|
|
61
61
|
} }, streamResponse: !0 });
|
|
62
|
-
if (!
|
|
62
|
+
if (!x.ok)
|
|
63
63
|
throw new Error(n("Failed to get AI response"));
|
|
64
|
-
const
|
|
64
|
+
const R = (N = x.body) == null ? void 0 : N.getReader(), z = new TextDecoder();
|
|
65
65
|
let s = "";
|
|
66
|
-
if (!
|
|
66
|
+
if (!R) throw new Error(n("Response body is not readable"));
|
|
67
67
|
for (; ; ) {
|
|
68
|
-
const { done:
|
|
69
|
-
if (
|
|
68
|
+
const { done: W, value: J } = await R.read();
|
|
69
|
+
if (W)
|
|
70
70
|
break;
|
|
71
|
-
const
|
|
72
|
-
s +=
|
|
71
|
+
const K = z.decode(J, { stream: !0 });
|
|
72
|
+
s += K, g((h) => (h[h.length - 1].content = s, [...h]));
|
|
73
73
|
}
|
|
74
74
|
const V = JSON.parse(s == null ? void 0 : s.replace("```json", "").replace("```", ""));
|
|
75
75
|
F(V);
|
|
@@ -128,5 +128,5 @@ const fe = v(() => import("./ai-translation-prompt-CJUenKeN.js")), pe = v(() =>
|
|
|
128
128
|
] });
|
|
129
129
|
};
|
|
130
130
|
export {
|
|
131
|
-
|
|
131
|
+
xe as default
|
|
132
132
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./index-P-2SvZA9.cjs"),s=require("./selected-block-display-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./index-P-2SvZA9.cjs"),s=require("./selected-block-display-Cr7R1ojV.cjs"),G=require("lucide-react"),o=require("react"),H=require("react-i18next"),Q=require("./models-5gOsRC56.cjs"),X=o.lazy(()=>Promise.resolve().then(()=>require("./ai-translation-prompt-CgZKlkF_.cjs"))),Y=o.lazy(()=>Promise.resolve().then(()=>require("./ai-prompt-input-BuP52voq.cjs"))),Z=({fetch:v,input:a,messages:u,setInput:j,isLoading:c,handleStop:q,setMessages:y,setIsLoading:h,selectedLang:i,currentBlock:A,fallbackLang:P,abortController:x,setAbortController:E,setCurrentBlock:k,selectedModel:S=Q.getDefaultModel().id,onModelChange:M})=>{const{t:n}=H.useTranslation(),O=o.useRef(null),l=d.useSelectedBlock(),[,D]=d.useSelectedBlockIds(),T=d.useI18nBlocks(),I=d.useStreamMultipleBlocksProps(),C=()=>{var t;(t=O.current)==null||t.scrollIntoView({behavior:"smooth"})};o.useEffect(()=>{C()},[u,c]);const f=async(t,m,F)=>{var b;l&&k(l);const p=(t==null?void 0:t.toLowerCase())==="translate",R={id:Date.now().toString(),role:"user",content:s.getTranslationUserPrompt({fallbackLang:P,userInput:m||t,language:i,blocks:p?T():T(i)}),userMessage:m||t||n("Translate the content")},_={id:(Date.now()+1).toString(),role:"assistant",content:"Thinking...",isReasoning:!0,isStreaming:!0};h(!0);const z=new AbortController;E(z),y(w=>[...w,R,_]),h(!0);try{const N=await v({body:{action:"ASK_AI",data:{messages:[R],initiator:p?"TRANSLATE_CONTENT":"UPDATE_CONTENT",model:F||S}},streamResponse:!0});if(!N.ok)throw new Error(n("Failed to get AI response"));const B=(b=N.body)==null?void 0:b.getReader(),U=new TextDecoder;let r="";if(!B)throw new Error(n("Response body is not readable"));for(;;){const{done:K,value:V}=await B.read();if(K)break;const W=U.decode(V,{stream:!0});r+=W,y(g=>(g[g.length-1].content=r,[...g]))}const J=JSON.parse(r==null?void 0:r.replace("```json","").replace("```",""));I(J)}catch{x==null||x.abort()}finally{h(!1),j(""),k(null)}};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(o.Suspense,{fallback:e.jsx("div",{children:n("Loading...")}),children:e.jsx(X,{isLoading:c,selectedBlock:l,selectedLang:i,onClick:f})})}),e.jsx(s.Conversation,{children:e.jsxs(s.ConversationContent,{className:"gap-4 px-0",children:[u.length===0&&e.jsx(s.ConversationEmptyState,{icon:e.jsx(G.Bot,{size:48,className:"text-gray-300"}),title:n("Start a conversation with the AI assistant to translate/edit your content"),description:n("Only content can be edited in secondary languages. To edit layout, styles and more, switch to the default language.")}),u.map(t=>t.role!=="system"&&e.jsx(o.Fragment,{children:t.isReasoning?e.jsxs(s.Reasoning,{isStreaming:t.isStreaming,defaultOpen:!0,children:[e.jsx(s.ReasoningTrigger,{className:"text-xs [&_p]:text-muted-foreground"}),e.jsx(s.ReasoningContent,{className:"p-0 text-xs",children:t.content})]}):t.isTask?e.jsx(s.TaskMessage,{content:t.content,isLoading:t.isTaskLoading}):e.jsx(s.Message,{from:t.role,children:e.jsx(s.MessageContent,{className:"p-0",children:t.role==="assistant"?e.jsx(s.MessageResponse,{className:"p-0 text-xs",children:t.content}):e.jsx("div",{className:"p-0 text-xs",children:t.userMessage||t.content})})})},t.id))]})}),e.jsxs("div",{className:"border-gray-200 pb-2",children:[e.jsx(s.SelectedBlockDisplay,{onRemove:()=>D([]),isLoading:c}),e.jsx(o.Suspense,{fallback:e.jsx("div",{children:n("Loading...")}),children:e.jsx(Y,{input:a,setInput:j,onSend:f,onStop:q,isLoading:c,selectedLang:i,currentBlock:l||A,disabled:(a==null?void 0:a.length)===0,selectedModel:S,onModelChange:M})})]})]})};exports.default=Z;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e, jsxs as w, Fragment as ie } from "react/jsx-runtime";
|
|
2
2
|
import { E as N, B as _ } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { T as le, aB as ce, r as ue, s as de, t as pe, v as me, aC as fe, aD as he, D as ge, aE as ve, e as be, g as xe, C as we, i as Ne, j as Ie, l as ye, m as Se } from "./index-
|
|
3
|
+
import { T as le, aB as ce, r as ue, s as de, t as pe, v as me, aC as fe, aD as he, D as ge, aE as ve, e as be, g as xe, C as we, i as Ne, j as Ie, l as ye, m as Se } from "./index-DpeytsiB.js";
|
|
4
4
|
import { cva as Y } from "class-variance-authority";
|
|
5
5
|
import { PaperclipIcon as ke, XIcon as J, PlusIcon as De, ImageIcon as ze, MicIcon as Pe, CornerDownLeftIcon as Te, Loader2Icon as Ae, SquareIcon as Ce, Cpu as Le, Paperclip as Re, GlobeIcon as Me, Square as je, Send as Ue } from "lucide-react";
|
|
6
6
|
import { nanoid as Oe } from "nanoid";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("./register-chai-top-bar-DyW9GPzV.cjs"),i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("./register-chai-top-bar-DyW9GPzV.cjs"),i=require("./index-CQf0jL1k.cjs"),c=require("lucide-react"),o=require("react-i18next"),x=({selectedLang:s,isLoading:n,selectedBlock:a,onClick:l})=>{const{t}=o.useTranslation();return e.jsx("div",{className:"flex flex-col gap-2",children:e.jsx("div",{className:`flex flex-col gap-2 ${n?"pointer-events-none opacity-50":""}`,children:a?e.jsx(r.Button,{variant:"outline",className:"h-auto",onClick:()=>l("TRANSLATE"),children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("p",{className:"text-left text-xs font-thin",children:t("Quick Action:")}),e.jsxs("span",{className:"flex items-center gap-x-2 text-sm font-medium",children:[t("Translate Content")," ",t("to")," ",i.LANGUAGES[s]," ",e.jsx(c.ArrowRight,{className:"h-4 w-4"})]})]})}):null})})};exports.default=x;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
2
|
import { B as r } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { L as i } from "./index-
|
|
3
|
+
import { L as i } from "./index-BpVxZOd-.js";
|
|
4
4
|
import { ArrowRight as c } from "lucide-react";
|
|
5
5
|
import { useTranslation as m } from "react-i18next";
|
|
6
6
|
const u = ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as s, jsxs as t, Fragment as L } from "react/jsx-runtime";
|
|
2
2
|
import { z as h, B as F } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { D as T, e as q, f as O, g as z, o as B, p as f, q as H } from "./index-
|
|
4
|
-
import { ap as I, aq as M, A as E, ax as R } from "./index-
|
|
3
|
+
import { D as T, e as q, f as O, g as z, o as B, p as f, q as H } from "./index-DpeytsiB.js";
|
|
4
|
+
import { ap as I, aq as M, A as E, ax as R } from "./index-BpVxZOd-.js";
|
|
5
5
|
import { useMutation as U } from "@tanstack/react-query";
|
|
6
6
|
import { Loader2 as W } from "lucide-react";
|
|
7
7
|
import { useState as c, useCallback as S, useEffect as G } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-P-2SvZA9.cjs"),u=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-P-2SvZA9.cjs"),u=require("./index-CQf0jL1k.cjs"),A=require("@tanstack/react-query"),F=require("lucide-react"),d=require("react"),k=require("react-i18next"),m=require("zod"),E=()=>{const r=u.useApiUrl(),o=u.useFetch();return A.useMutation({mutationKey:[u.ACTIONS.CHANGE_PASSWORD],mutationFn:async e=>{const t=await o(r,{action:u.ACTIONS.CHANGE_PASSWORD,data:e});return t==null?void 0:t.data}})},L=r=>m.z.object({oldPassword:m.z.string().min(1,r("Current password is required")),newPassword:m.z.string().min(8,r("Password must be at least 8 characters")).max(128,r("Password must be less than 128 characters")).regex(/[A-Z]/,r("Password must contain at least one uppercase letter")).regex(/[a-z]/,r("Password must contain at least one lowercase letter")).regex(/[0-9]/,r("Password must contain at least one number")).regex(/[!@#$%^&*(),.?":{}|<>]/,r("Password must contain at least one special character")),confirmPassword:m.z.string().min(1,r("Confirm password is required"))}).refine(o=>o.newPassword===o.confirmPassword,{message:r("New password and confirm password do not match"),path:["confirmPassword"]}).refine(o=>o.oldPassword!==o.newPassword,{message:r("New password must be different from current password"),path:["newPassword"]}),T=({open:r,onOpenChange:o})=>{const{t:e}=k.useTranslation(),t=u.usePagesProp("currentUser",null),{mutate:q,isPending:h,isSuccess:p,reset:P}=E(),[x,f]=d.useState(""),[j,C]=d.useState(""),[N,v]=d.useState(""),[b,i]=d.useState(null),S=d.useCallback(()=>{f(""),C(""),v(""),i(null),P()},[P]),w=d.useCallback(a=>{o(a),a||S()},[o,S]);d.useEffect(()=>{if(p){const a=setTimeout(()=>{w(!1)},2e3);return()=>clearTimeout(a)}},[p,w]);const D=()=>{var y;i(null);const a={oldPassword:x.trim(),newPassword:j.trim(),confirmPassword:N.trim()},c=L(e).safeParse(a);if(!c.success){i(((y=c.error.issues[0])==null?void 0:y.message)||e("Validation failed"));return}if(!(t!=null&&t.email)){i(e("User email not found"));return}q({email:t.email,oldPassword:c.data.oldPassword,newPassword:c.data.newPassword,confirmPassword:c.data.confirmPassword},{onError:g=>{i((g==null?void 0:g.message)||e("Failed to change password"))}})};return s.jsx(n.Dialog,{open:r,onOpenChange:w,children:s.jsx(n.DialogContent,{className:"sm:max-w-[425px]",children:h?s.jsx("div",{className:"flex h-[340px] items-center justify-center",children:s.jsx(F.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):p?s.jsxs("div",{className:"flex h-[340px] flex-col items-center justify-center gap-2",children:[s.jsx("div",{className:"rounded-full bg-green-100 p-3",children:s.jsx("svg",{className:"h-6 w-6 text-green-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:s.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),s.jsx("p",{className:"text-lg font-medium",children:e("Password updated successfully")})]}):s.jsxs(s.Fragment,{children:[s.jsxs(n.DialogHeader,{children:[s.jsx(n.DialogTitle,{children:e("Change Password")}),s.jsx(n.DialogDescription,{children:e("Enter your current password and a new password.")})]}),s.jsxs("div",{className:"grid gap-4 py-4",children:[s.jsxs("div",{className:"grid gap-2",children:[s.jsx(n.Label,{htmlFor:"old-password",children:e("Current Password")}),s.jsx(l.Input,{id:"old-password",type:"password",value:x,onChange:a=>f(a.target.value),placeholder:e("Enter current password")})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(n.Label,{htmlFor:"new-password",children:e("New Password")}),s.jsx(l.Input,{id:"new-password",type:"password",value:j,onChange:a=>C(a.target.value),placeholder:e("Enter new password")})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(n.Label,{htmlFor:"confirm-password",children:e("Confirm Password")}),s.jsx(l.Input,{id:"confirm-password",type:"password",value:N,onChange:a=>v(a.target.value),placeholder:e("Confirm new password")})]}),b&&s.jsx("p",{className:"text-sm text-destructive",children:b})]}),s.jsxs(n.DialogFooter,{children:[s.jsx(l.Button,{variant:"outline",onClick:()=>w(!1),disabled:h,children:e("Cancel")}),s.jsx(l.Button,{onClick:D,disabled:h,children:e("Change Password")})]})]})})})};exports.ChangePasswordModal=T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as t, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { u as k, a as v, b as T, c as E, d as L, L as N, D as y, e as w, f as D, g as H, T as M } from "./index-
|
|
2
|
+
import { u as k, a as v, b as T, c as E, d as L, L as N, D as y, e as w, f as D, g as H, T as M } from "./index-DpeytsiB.js";
|
|
3
3
|
import { useThrottledCallback as P } from "@react-hookz/web";
|
|
4
4
|
import { get as B } from "lodash-es";
|
|
5
5
|
import { useState as p, useMemo as I, useCallback as S, useEffect as j } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./register-chai-top-bar-DyW9GPzV.cjs"),s=require("./index-P-2SvZA9.cjs"),a=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("./register-chai-top-bar-DyW9GPzV.cjs"),s=require("./index-P-2SvZA9.cjs"),a=require("./index-CQf0jL1k.cjs"),n=require("lucide-react"),l=require("react-i18next"),o=()=>{const{setPageLockMeta:r}=a.usePageLockMeta(),{t}=l.useTranslation(),c=async()=>{r({})};return e.jsx(a.BlurContainer,{children:e.jsxs(s.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(s.CardHeader,{className:"space-y-1",children:e.jsxs(s.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(n.CheckCircle,{className:"h-6 w-6 text-green-500"}),t("You can edit the page now")]})}),e.jsx(s.CardContent,{className:"space-y-4",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:t("This page is released by other user you can continue editing now")})}),e.jsx(s.CardFooter,{className:"flex gap-2",children:e.jsxs(i.Button,{variant:"default",onClick:c,className:"flex-1 gap-2",children:[e.jsx(n.Check,{className:"h-4 w-4"}),t("Continue Editing")]})})]})})};exports.default=o;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { B as r } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import {
|
|
4
|
-
import { b as d, B as h } from "./index-
|
|
3
|
+
import { G as o, H as c, I as i, J as l, K as m } from "./index-DpeytsiB.js";
|
|
4
|
+
import { b as d, B as h } from "./index-BpVxZOd-.js";
|
|
5
5
|
import { CheckCircle as u, Check as p } from "lucide-react";
|
|
6
6
|
import { useTranslation as C } from "react-i18next";
|
|
7
7
|
const y = () => {
|
package/dist/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b6 as s, aZ as r, b5 as i, b7 as o, a_ as t, a$ as l, b0 as C, aX as h, aK as g, b8 as u, b9 as d, ba as n, b1 as c, b2 as b, aL as B, b3 as k, b4 as S, aM as p, aO as m, bc as T, bb as L, ah as F, ak as A, bd as M,
|
|
1
|
+
import { b6 as s, aZ as r, b5 as i, b7 as o, a_ as t, a$ as l, b0 as C, aX as h, aK as g, b8 as u, b9 as d, ba as n, b1 as c, b2 as b, aL as B, b3 as k, b4 as S, aM as p, aO as m, bc as T, bb as L, ah as F, ak as A, bd as M, V as I, d as P, ai as f, F as E, U as H, W as x } from "./index-DpeytsiB.js";
|
|
2
2
|
import { g as v, c as D } from "./common-functions-D2lMFR6K.js";
|
|
3
3
|
import { g as U, g as _ } from "./apply-binding-RQRSIe56.js";
|
|
4
|
-
import { A as N, C as w, I as K, R as V, k as
|
|
4
|
+
import { A as N, C as w, I as K, R as V, k as W, o as X, c as j, a as q, b as z, r as J, e as Z, f as $, j as G, m as Q, p as Y, q as aa, v as ea, x as sa, t as ra, d as ia, u as oa, h as ta, g as la, l as Ca, w as ha, n as ga, s as ua, i as da, y as na } from "./register-chai-top-bar-D6GjnauV.js";
|
|
5
5
|
import { useTranslation as ba } from "react-i18next";
|
|
6
6
|
import { default as ka } from "i18next";
|
|
7
7
|
export {
|
|
@@ -32,15 +32,15 @@ export {
|
|
|
32
32
|
T as defaultChaiLibrary,
|
|
33
33
|
v as generateBlockId,
|
|
34
34
|
_ as getBlocksFromHTML,
|
|
35
|
-
|
|
35
|
+
W as getChaiLibrary,
|
|
36
36
|
L as getClassValueAndUnit,
|
|
37
|
-
|
|
37
|
+
X as getPreImportHTML,
|
|
38
38
|
ka as i18n,
|
|
39
39
|
D as mergeClasses,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
j as registerChaiAddBlockTab,
|
|
41
|
+
q as registerChaiBlockSettingField,
|
|
42
|
+
z as registerChaiBlockSettingTemplate,
|
|
43
|
+
J as registerChaiBlockSettingWidget,
|
|
44
44
|
Z as registerChaiFeatureFlag,
|
|
45
45
|
$ as registerChaiFeatureFlags,
|
|
46
46
|
G as registerChaiLibrary,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as i, jsxs as u } from "react/jsx-runtime";
|
|
2
2
|
import { B as y } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { D as T, e as V, f as N, g as R, o as E, p as D, T as I, q as A } from "./index-
|
|
3
|
+
import { D as T, e as V, f as N, g as R, o as E, p as D, T as I, q as A } from "./index-DpeytsiB.js";
|
|
4
4
|
import "lodash-es";
|
|
5
5
|
import * as b from "culori";
|
|
6
6
|
import { a as P } from "./fonts-B3UYxuJI.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as s, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { B as L } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { d as k, n as U, D as W, e as g, f as B, g as G, o as R, q as j } from "./index-
|
|
4
|
-
import { c as q, m as F, k as H, e as M, j as Q, n as T, L as $ } from "./index-
|
|
3
|
+
import { d as k, n as U, D as W, e as g, f as B, g as G, o as R, q as j } from "./index-DpeytsiB.js";
|
|
4
|
+
import { c as q, m as F, k as H, e as M, j as Q, n as T, L as $ } from "./index-BpVxZOd-.js";
|
|
5
5
|
import { isEmpty as z, get as I } from "lodash-es";
|
|
6
6
|
import { useMemo as f } from "react";
|
|
7
7
|
import { useTranslation as J } from "react-i18next";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),b=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-P-2SvZA9.cjs"),l=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),b=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-P-2SvZA9.cjs"),l=require("./index-CQf0jL1k.cjs"),C=require("lodash-es"),f=require("react"),g=require("react-i18next"),S=(e,d)=>{const t=d.filter(m=>m.parent===e);if(t.length===0)return 0;let u=t.length;return t.forEach(m=>{u+=S(m.id,d)}),u};function U({page:e,onClose:d}){const{t}=g.useTranslation(),[,u]=l.useSearchParams(),{mutate:m,isPending:P}=l.useDeletePage(),{data:j}=l.usePageTypes(),{data:h=[]}=l.useWebsitePrimaryPages(),{setSelectedLang:E,fallbackLang:L}=n.useLanguages(),[,q]=n.useSidebarActivePanel(),c=!(e!=null&&e.primaryPage),{data:r=[]}=l.useLanguagePages(c?e==null?void 0:e.id:void 0),{data:y}=l.useSiteWideUsage(),v=f.useMemo(()=>C.isEmpty(e==null?void 0:e.slug),[e==null?void 0:e.slug]),w=f.useMemo(()=>{if(!v||!(e!=null&&e.id)||!y)return[];const i=[];return Object.entries(y).forEach(([o,D])=>{D.partialBlocks.includes(e.id)&&!D.isPartial&&i.push({id:o,name:D.name})}),i},[v,e.id,y]),N=f.useMemo(()=>!c||!r?0:r.filter(i=>i.id!==e.id).length,[c,r,e.id]),x=f.useMemo(()=>{if(!(e!=null&&e.id)||!h.length)return 0;let i=S(e.id,h);return c&&r&&r.length>0&&r.forEach(o=>{o.id!==e.id&&(i+=S(o.id,h))}),i},[e.id,h,c,r]),A=()=>{P||m(e,{onSuccess:()=>{e!=null&&e.primaryPage?(window.history.replaceState({},"",`/?page=${e.primaryPage}`),u(new URLSearchParams({page:e.primaryPage}))):(window.history.replaceState({},"","/"),u(new URLSearchParams)),window.dispatchEvent(new PopStateEvent("popstate")),E(L),q("outline"),d()}})},a=j==null?void 0:j.find(i=>i.key===(e==null?void 0:e.pageType));return s.jsx(n.Dialog,{open:!!e,onOpenChange:d,children:s.jsxs(n.DialogContent,{children:[s.jsxs(n.DialogHeader,{children:[s.jsx(n.DialogTitle,{children:t("Confirm Deletion")}),s.jsxs(n.DialogDescription,{className:"py-4 text-slate-500",children:[s.jsxs("div",{children:[t("Are you sure you want to remove")," ",s.jsx("b",{children:(e==null?void 0:e.name)??(e==null?void 0:e.slug)})," ",a!=null&&a.hasSlug?(a==null?void 0:a.name)+"?":t("page?")]}),c&&(N>0||x>0)&&s.jsxs("div",{className:"mt-3 rounded-md bg-red-50 p-3 text-sm",children:[s.jsxs("div",{className:"font-semibold text-red-800",children:[t("Warning: Deleting this primary page will also delete"),":"]}),s.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-red-700",children:[x>0&&s.jsxs("li",{children:[s.jsx("span",{className:"font-medium",children:x})," ",t(x===1?"nested child page":"nested child pages")]}),N>0&&s.jsx("li",{children:t("All associated language pages")})]})]}),v&&w.length>0&&s.jsxs("div",{className:"mt-3 rounded-md bg-red-50 p-3 text-sm",children:[s.jsxs("div",{className:"font-semibold text-red-800",children:[t("Warning: This partial is currently used in the following pages"),":"]}),s.jsx("ul",{className:"mt-2 list-inside list-disc space-y-1 text-red-700",children:w.map(({id:i,name:o})=>s.jsx("li",{children:s.jsx("span",{className:"font-medium",children:o})},i))})]}),e.lang&&s.jsxs("div",{className:"py-2 text-sm",children:[t("Language"),":"," ",s.jsx("span",{className:"font-medium text-gray-500",children:C.get(l.LANGUAGES,e.lang,e.lang)})]})]})]}),s.jsxs(n.DialogFooter,{children:[s.jsx(b.Button,{variant:"outline",onClick:d,children:t("Cancel")}),s.jsx(b.Button,{variant:"destructive",disabled:P,onClick:A,children:t(P?"Deleting...":"Delete")})]})]})})}exports.default=U;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { ag as _, a as j,
|
|
3
|
-
import { E as
|
|
4
|
-
import { ArrowRightIcon as
|
|
5
|
-
import { noop as
|
|
6
|
-
import { useMemo as d, useCallback as
|
|
7
|
-
import { useTranslation as
|
|
2
|
+
import { ag as _, a as j, a0 as p, d as C, F as I, X as O, Y as z, P as E } from "./index-DpeytsiB.js";
|
|
3
|
+
import { E as F } from "./register-chai-top-bar-D6GjnauV.js";
|
|
4
|
+
import { ArrowRightIcon as W, FileIcon as A, GlobeIcon as M } from "@radix-ui/react-icons";
|
|
5
|
+
import { noop as R } from "lodash-es";
|
|
6
|
+
import { useMemo as d, useCallback as X } from "react";
|
|
7
|
+
import { useTranslation as Y } from "react-i18next";
|
|
8
8
|
const b = ({ title: s, items: i, emptyLabel: r, onSelect: t, icon: o }) => /* @__PURE__ */ c("div", { className: "space-y-2", children: [
|
|
9
9
|
/* @__PURE__ */ n("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: s }),
|
|
10
10
|
i.length > 0 ? /* @__PURE__ */ n("div", { className: "space-y-1", children: i.map((a) => /* @__PURE__ */ n(
|
|
@@ -12,7 +12,7 @@ const b = ({ title: s, items: i, emptyLabel: r, onSelect: t, icon: o }) => /* @_
|
|
|
12
12
|
{
|
|
13
13
|
type: "button",
|
|
14
14
|
onClick: () => t(a.id),
|
|
15
|
-
className:
|
|
15
|
+
className: F(
|
|
16
16
|
"group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-1 text-left text-xs transition",
|
|
17
17
|
"hover:border-muted-foreground/20 hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",
|
|
18
18
|
a.isSelected && "border-primary/40 bg-primary/10 text-primary"
|
|
@@ -24,20 +24,20 @@ const b = ({ title: s, items: i, emptyLabel: r, onSelect: t, icon: o }) => /* @_
|
|
|
24
24
|
},
|
|
25
25
|
a.id
|
|
26
26
|
)) }) : /* @__PURE__ */ n("div", { className: "rounded border border-dashed border-muted px-3 py-1 text-xs text-muted-foreground", children: r })
|
|
27
|
-
] }),
|
|
27
|
+
] }), $ = "#styles:", D = (s) => {
|
|
28
28
|
const r = [
|
|
29
29
|
typeof s._name == "string" ? s._name : void 0,
|
|
30
30
|
typeof s._type == "string" ? s._type : void 0
|
|
31
31
|
].filter(Boolean).find((t) => t.trim().length > 0);
|
|
32
32
|
return r ? r.length > 40 ? `${r.slice(0, 37)}...` : r : s._id;
|
|
33
|
-
},
|
|
33
|
+
}, G = (s, i) => {
|
|
34
34
|
const r = `${i}`;
|
|
35
|
-
return s.filter((t) => Object.values(t).some((o) => typeof o != "string" || !o.startsWith(
|
|
35
|
+
return s.filter((t) => Object.values(t).some((o) => typeof o != "string" || !o.startsWith($) ? !1 : o.includes(r))).map((t) => ({
|
|
36
36
|
id: t._id,
|
|
37
|
-
label:
|
|
37
|
+
label: D(t)
|
|
38
38
|
}));
|
|
39
39
|
}, ee = ({ tokenId: s, tokenName: i, children: r }) => {
|
|
40
|
-
const { t } =
|
|
40
|
+
const { t } = Y(), [o] = _(), [a, g] = j(), h = p("pageId", ""), u = p("siteWideUsage", {}), y = d(() => G(o, s), [o, s]), k = d(
|
|
41
41
|
() => y.map((e) => ({
|
|
42
42
|
id: e.id,
|
|
43
43
|
label: e.label,
|
|
@@ -59,17 +59,17 @@ const b = ({ title: s, items: i, emptyLabel: r, onSelect: t, icon: o }) => /* @_
|
|
|
59
59
|
label: e.name
|
|
60
60
|
})),
|
|
61
61
|
[m]
|
|
62
|
-
), N =
|
|
62
|
+
), N = X(
|
|
63
63
|
(e) => {
|
|
64
64
|
g([e]);
|
|
65
65
|
},
|
|
66
66
|
[g]
|
|
67
|
-
), B = p("gotoPage",
|
|
67
|
+
), B = p("gotoPage", R), { selectedLang: T, fallbackLang: L } = C(), { savePageAsync: w } = I(), x = async (e) => {
|
|
68
68
|
e && (await w(!0), B({ pageId: e, lang: T || L }));
|
|
69
69
|
};
|
|
70
70
|
return /* @__PURE__ */ c(O, { children: [
|
|
71
|
-
/* @__PURE__ */ n(
|
|
72
|
-
/* @__PURE__ */ c(
|
|
71
|
+
/* @__PURE__ */ n(z, { asChild: !0, children: r }),
|
|
72
|
+
/* @__PURE__ */ c(E, { side: "bottom", align: "end", className: "w-80 p-0", children: [
|
|
73
73
|
/* @__PURE__ */ c("div", { className: "space-y-1 px-4 py-3", children: [
|
|
74
74
|
/* @__PURE__ */ n("p", { className: "text-xs font-semibold", children: i }),
|
|
75
75
|
/* @__PURE__ */ n("p", { className: "text-[11px] text-muted-foreground", children: t("Usage summary for this design token across your site.") })
|
|
@@ -82,7 +82,7 @@ const b = ({ title: s, items: i, emptyLabel: r, onSelect: t, icon: o }) => /* @_
|
|
|
82
82
|
items: k,
|
|
83
83
|
emptyLabel: t("None"),
|
|
84
84
|
onSelect: N,
|
|
85
|
-
icon: /* @__PURE__ */ n(
|
|
85
|
+
icon: /* @__PURE__ */ n(W, { fontSize: 4 })
|
|
86
86
|
}
|
|
87
87
|
),
|
|
88
88
|
/* @__PURE__ */ n(
|
|
@@ -102,7 +102,7 @@ const b = ({ title: s, items: i, emptyLabel: r, onSelect: t, icon: o }) => /* @_
|
|
|
102
102
|
items: S,
|
|
103
103
|
emptyLabel: t("None"),
|
|
104
104
|
onSelect: x,
|
|
105
|
-
icon: /* @__PURE__ */ n(
|
|
105
|
+
icon: /* @__PURE__ */ n(M, { fontSize: 8 })
|
|
106
106
|
}
|
|
107
107
|
)
|
|
108
108
|
] })
|