@chaibuilder/sdk 4.0.0-beta.48 → 4.0.0-beta.49
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-DqwAKdGS.cjs → 2SSKDMRQ-CjvuNdPo.cjs} +1 -1
- package/dist/{2SSKDMRQ-CLLNh3td.js → 2SSKDMRQ-Dvf9zadl.js} +2 -2
- package/dist/{AP7HFJJL-BA2SSB20.cjs → AP7HFJJL-DYFttFoI.cjs} +1 -1
- package/dist/{AP7HFJJL-wgsmCJDJ.js → AP7HFJJL-q4dJdyFs.js} +1 -1
- package/dist/{IconPicker-DsT0ONLh.js → IconPicker-Bf163F7t.js} +1 -1
- package/dist/{IconPicker-BQy4V5jA.cjs → IconPicker-JWhYq2Gp.cjs} +1 -1
- package/dist/{WDYDFRGG-DyEYv-Y5.cjs → WDYDFRGG-BEksfGMC.cjs} +1 -1
- package/dist/{WDYDFRGG-EEb06kwn.js → WDYDFRGG-O9GIrtX0.js} +2 -2
- package/dist/{actions-registery-2natwC9b.cjs → actions-registery-BHbZHkE3.cjs} +10 -2
- package/dist/{actions-registery-wRY05tEE.js → actions-registery-gJb_wq2F.js} +24 -12
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.ts +10 -3
- package/dist/actions.js +6 -4
- package/dist/{active-in-another-tab-DE2fn30l.js → active-in-another-tab-B4Ur0JP7.js} +2 -2
- package/dist/{active-in-another-tab-p0hkvIFc.cjs → active-in-another-tab-BPdx4lWh.cjs} +1 -1
- package/dist/{add-new-language-page-f2wam593.cjs → add-new-language-page-BfUp5Ua2.cjs} +1 -1
- package/dist/{add-new-language-page-CH7GtcqC.js → add-new-language-page-CRR93tLq.js} +3 -3
- package/dist/{add-new-page-CV7A1XJQ.cjs → add-new-page-B8NGK6WS.cjs} +1 -1
- package/dist/{add-new-page-8d0Nn-zI.js → add-new-page-Ppy5-y5j.js} +2 -2
- package/dist/{ai-panel-default-lang-Dcm4e1o8.js → ai-panel-default-lang-BXYQye3N.js} +6 -5
- package/dist/{ai-panel-default-lang-BJLeTdw3.cjs → ai-panel-default-lang-VhgmHFoQ.cjs} +3 -3
- package/dist/{ai-panel-other-lang-B48Y5C8z.js → ai-panel-other-lang-DaCf-cq4.js} +36 -35
- package/dist/ai-panel-other-lang-Ds0EXeUC.cjs +1 -0
- package/dist/{ai-prompt-input-DhVfzVhy.js → ai-prompt-input-7iWk72w5.js} +2 -2
- package/dist/{ai-prompt-input-C1yoNntS.cjs → ai-prompt-input-nZ5_Dm7X.cjs} +1 -1
- package/dist/{ai-translation-prompt-CUYVv2jG.js → ai-translation-prompt-1OUs1P7n.js} +1 -1
- package/dist/{ai-translation-prompt-mj26BpgQ.cjs → ai-translation-prompt-B16cK-1Q.cjs} +1 -1
- package/dist/{change-password-modal-DiEQWZez.js → change-password-modal-CdvJR1Ln.js} +2 -2
- package/dist/{change-password-modal-DFupkIGx.cjs → change-password-modal-D5eXjiYq.cjs} +1 -1
- package/dist/{code-editor-CazbxsDv.js → code-editor-CyLjDiEp.js} +1 -1
- package/dist/{code-editor-BiLiryYr.cjs → code-editor-SWbfFj1E.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-CpKDDW6u.js → continue-editing-in-this-client-BrSvK-Ay.js} +2 -2
- package/dist/{continue-editing-in-this-client-C3NoncEN.cjs → continue-editing-in-this-client-Cmi-GkYZ.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{css-import-modal-DFdZ471B.cjs → css-import-modal-Bdwgd05S.cjs} +1 -1
- package/dist/{css-import-modal-BOQr_e6S.js → css-import-modal-Be47CBJn.js} +1 -1
- package/dist/{delete-page-DIZhbU2t.js → delete-page-C99K2qzS.js} +2 -2
- package/dist/{delete-page-D8Vr-1aC.cjs → delete-page-DLohaU-U.cjs} +1 -1
- package/dist/{design-token-usage-Co5Lj1HN.js → design-token-usage-D1lWCJ3L.js} +1 -1
- package/dist/{design-token-usage-N5DLBdWf.cjs → design-token-usage-eY2wQ0l3.cjs} +1 -1
- package/dist/{digital-asset-manager-CObQa_0R.js → digital-asset-manager-BZMb6sC7.js} +3 -3
- package/dist/{digital-asset-manager-uXP27Dou.cjs → digital-asset-manager-Z5aJxkq0.cjs} +1 -1
- package/dist/{duplicate-page-xpV-pRVU.js → duplicate-page-CDc2X0eW.js} +3 -3
- package/dist/{duplicate-page-DomSAvnp.cjs → duplicate-page-D5Gtvqdv.cjs} +1 -1
- package/dist/{dynamic-page-selector-CYZv-SlK.cjs → dynamic-page-selector-DZHhX008.cjs} +1 -1
- package/dist/{dynamic-page-selector-Bl5kYPWG.js → dynamic-page-selector-DvNBXo6o.js} +2 -2
- package/dist/{image-editor-CDFnNWAz.js → image-editor-BBvvi9Vm.js} +1 -1
- package/dist/{image-editor-pOsT95KQ.cjs → image-editor-DwhTYkVR.cjs} +1 -1
- package/dist/{index-j-XsKW-V.cjs → index-BVwFJWDq.cjs} +3 -3
- package/dist/{index-DonDtb8f.cjs → index-DCJDQs1a.cjs} +8 -8
- package/dist/{index-Cyz_Iww4.js → index-LBTm1Jmk.js} +35 -26
- package/dist/{index-BbkBlCE2.js → index-OuHV9Ann.js} +7 -6
- package/dist/{json-diff-viewer-CoEViavL.cjs → json-diff-viewer-Cb1CmRqP.cjs} +1 -1
- package/dist/{json-diff-viewer-amjoEZ5K.js → json-diff-viewer-DG6qMOBS.js} +2 -2
- package/dist/{lang-panel-DPpIXFl4.js → lang-panel-B3USOxGq.js} +3 -3
- package/dist/{lang-panel-BzWstLZ-.cjs → lang-panel-DxoJ0v4y.cjs} +1 -1
- package/dist/{manage-design-tokens-BVfEFOrN.js → manage-design-tokens-6YGIctip.js} +2 -2
- package/dist/{manage-design-tokens-modal-m3D2luIa.cjs → manage-design-tokens-modal-BSSCXH8Y.cjs} +1 -1
- package/dist/{manage-design-tokens-modal-CBOw_Dg6.js → manage-design-tokens-modal-CzsnN49F.js} +2 -2
- package/dist/{manage-design-tokens-CIiwBv2v.cjs → manage-design-tokens-udLBvkHA.cjs} +1 -1
- package/dist/{mark-as-template-C2-S_aA2.cjs → mark-as-template-B9yLcasI.cjs} +1 -1
- package/dist/{mark-as-template-CQjchLk7.js → mark-as-template-CP_F9ZQ4.js} +2 -2
- package/dist/{nested-path-selector-content-BtsI3H0i.js → nested-path-selector-content-DmtCI3q9.js} +1 -1
- package/dist/{nested-path-selector-content-Dd3NzUE0.cjs → nested-path-selector-content-aTdu-o0e.cjs} +1 -1
- package/dist/{no-language-page-content-CggJC14_.cjs → no-language-page-content-C-MCdPXt.cjs} +1 -1
- package/dist/{no-language-page-content-BrDAjkdi.js → no-language-page-content-D8t5dfgh.js} +2 -2
- package/dist/{no-language-page-dialog-DSbcLM8f.js → no-language-page-dialog-C_fHI2zI.js} +2 -2
- package/dist/{no-language-page-dialog-Dkxdu99i.cjs → no-language-page-dialog-D4QIAHnE.cjs} +1 -1
- package/dist/{page-creator-DqKFL1sB.cjs → page-creator-Cz_ah-qE.cjs} +1 -1
- package/dist/{page-creator-CR-FbJ7C.js → page-creator-DKEkuGCO.js} +3 -3
- package/dist/{page-lock-CwzMBdD-.js → page-lock-CwZKJ4IE.js} +2 -2
- package/dist/{page-lock-D4Anxwpy.cjs → page-lock-DdCvtA-I.cjs} +1 -1
- package/dist/{page-locked-dialog-UrTgnXd6.cjs → page-locked-dialog-CrTDBoC4.cjs} +1 -1
- package/dist/{page-locked-dialog-Dv_unUwx.js → page-locked-dialog-DqLlooUz.js} +2 -2
- package/dist/{page-manager-new-DuqhyqMY.cjs → page-manager-new-ah6QYar2.cjs} +1 -1
- package/dist/{page-manager-new-DpCTazS0.js → page-manager-new-ttsrxdW9.js} +3 -3
- package/dist/{page-manager-search-and-filter-Yt0pjK_r.cjs → page-manager-search-and-filter-D7AupT6_.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-B6F-ZvdQ.js → page-manager-search-and-filter-bsqZ6wnI.js} +2 -2
- package/dist/{page-revisions-content-C2VMkAt4.cjs → page-revisions-content-B6hsIla7.cjs} +1 -1
- package/dist/{page-revisions-content-CUPsMEVU.js → page-revisions-content-C5O8_Fms.js} +3 -3
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +16 -10
- package/dist/pages.js +1 -1
- package/dist/{publish-pages-content-BrjDksNY.cjs → publish-pages-content-BrajJUcP.cjs} +1 -1
- package/dist/{publish-pages-content-CK0ahL2t.js → publish-pages-content-KZVMHT6V.js} +3 -3
- package/dist/{rte-widget-modal-Dktetdg4.cjs → rte-widget-modal-CiTwsXTr.cjs} +1 -1
- package/dist/{rte-widget-modal-DgEF73WC.js → rte-widget-modal-IU8JzPuZ.js} +1 -1
- package/dist/{save-to-lib-Bs6-wr2u.js → save-to-lib-DMnv7ENo.js} +2 -2
- package/dist/{save-to-lib-CuVYPtm-.cjs → save-to-lib-Dc700Aop.cjs} +1 -1
- package/dist/{selected-block-display-BCcwnFzJ.cjs → selected-block-display-CAFEOrLV.cjs} +1 -1
- package/dist/{selected-block-display-D-lzXUfE.js → selected-block-display-CidmQ-wz.js} +2 -2
- package/dist/{seo-panel-By-TlhHK.js → seo-panel-Br8gxDxu.js} +155 -165
- package/dist/{seo-panel-DTqsu3I0.cjs → seo-panel-CMY-adM-.cjs} +2 -2
- package/dist/{shared-json-ld-C_vaAxgT.cjs → shared-json-ld-CMH-eRUq.cjs} +1 -1
- package/dist/{shared-json-ld-CMCwFEI0.js → shared-json-ld-uvMmwCYp.js} +2 -2
- package/dist/{slug-input-DCmvuN69.cjs → slug-input-CiHC5l3r.cjs} +1 -1
- package/dist/{slug-input-bhZSv9VS.js → slug-input-DLWTMTsO.js} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-BGvKpN5m.cjs → take-over-request-IRLgF1dG.cjs} +1 -1
- package/dist/{take-over-request-f0dbfkLe.js → take-over-request-KdR1_h_K.js} +2 -2
- package/dist/{translation-warning-modal-_0YmCcU8.cjs → translation-warning-modal-CLZ9tC1F.cjs} +1 -1
- package/dist/{translation-warning-modal-D0-WNJnG.js → translation-warning-modal-CzNt6LDO.js} +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/{unmark-as-template-WE3WJ-RJ.js → unmark-as-template-C5ovsEBP.js} +2 -2
- package/dist/{unmark-as-template-BE1BO8Z0.cjs → unmark-as-template-F7TdgWjI.cjs} +1 -1
- package/dist/{unpublish-page-B4A-GQEz.js → unpublish-page-0fR1o0b7.js} +2 -2
- package/dist/{unpublish-page-DrZnWLVM.cjs → unpublish-page-CUr8Xub6.cjs} +1 -1
- package/dist/{unpublished-partials-modal-CGK-4WJ3.js → unpublished-partials-modal-BhNAub_z.js} +1 -1
- package/dist/{unpublished-partials-modal-KFXm1fG4.cjs → unpublished-partials-modal-Cv5R9-hi.cjs} +1 -1
- package/dist/{web-preview-ClV1a6hl.cjs → web-preview-CuMYekVJ.cjs} +1 -1
- package/dist/{web-preview-BSmef-RL.js → web-preview-D9pXonAv.js} +1 -1
- package/package.json +1 -1
- package/dist/ai-panel-other-lang-Ch0RHXqZ.cjs +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as $ } from "react/jsx-runtime";
|
|
2
2
|
import { B as L } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { e as K, f as Q, g as J, o as V, q as W } from "./index-
|
|
4
|
-
import { aq as X, ar as Y, A as I, aA as O, aB as Z, i as ee, k as te, ao as se, T as U, aC as le } from "./index-
|
|
5
|
-
import { LanguageSelector as ae } from "./page-manager-search-and-filter-
|
|
3
|
+
import { e as K, f as Q, g as J, o as V, q as W } from "./index-OuHV9Ann.js";
|
|
4
|
+
import { aq as X, ar as Y, A as I, aA as O, aB as Z, i as ee, k as te, ao as se, T as U, aC as le } from "./index-LBTm1Jmk.js";
|
|
5
|
+
import { LanguageSelector as ae } from "./page-manager-search-and-filter-bsqZ6wnI.js";
|
|
6
6
|
import { useQuery as ne } from "@tanstack/react-query";
|
|
7
7
|
import { find as B, filter as a, map as b, keys as re, get as F, includes as P, orderBy as N, isEmpty as oe, uniq as G, first as ce, concat as ie } from "lodash-es";
|
|
8
8
|
import { Lock as de, GlobeIcon as ue, File as he, Edit as me } from "lucide-react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DCJDQs1a.cjs"),p=require("./register-chai-top-bar-DyW9GPzV.cjs"),S=({isOpen:m,onClose:r,editor:t,rteElement:f})=>{const a=s.usePageExternalData(),u=o=>{if(!t)return;const i=`{{${o}}}`;t.commands.focus();const{from:j,to:g}=t.state.selection;if(j!==g)t.chain().deleteSelection().insertContent(i).run();else{const{state:c}=t,n=c.selection.from,x=c.doc.textBetween(Math.max(0,n-1),n),l=c.doc.textBetween(n,Math.min(n+1,c.doc.content.size));let d="";n>0&&x!==" "&&!/[.,!?;:]/.test(x)&&(d=" ");let h="";l&&l!==" "&&!/[.,!?;:]/.test(l)&&(h=" "),t.chain().insertContent(d+i+h).run()}};return e.jsx(s.Dialog,{open:m,onOpenChange:o=>!o&&r(),children:e.jsxs(s.DialogContent,{className:"max-h-[90vh] overflow-y-auto sm:max-w-[800px]",children:[e.jsx(s.DialogHeader,{children:e.jsxs(s.DialogTitle,{className:"flex items-center justify-between pr-8",children:[e.jsx("span",{children:"Rich Text Editor"}),a&&Object.keys(a).length>0&&e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-2 text-sm text-muted-foreground",children:"Add field:"}),e.jsx("div",{className:"rte-path-selector",children:e.jsx(s.NestedPathSelector,{data:a,onSelect:u})})]})]})}),f,e.jsx("div",{className:"mt-4 flex justify-end",children:e.jsx(p.Button,{onClick:r,children:"Done"})})]})})};exports.default=S;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import { h as D, D as N, e as S, f as j, g as v, N as w } from "./index-
|
|
2
|
+
import { h as D, D as N, e as S, f as j, g as v, N as w } from "./index-OuHV9Ann.js";
|
|
3
3
|
import { B } from "./register-chai-top-bar-D6GjnauV.js";
|
|
4
4
|
const M = ({
|
|
5
5
|
isOpen: f,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { B as b, z as L } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { aF as ne, c as M, X as ie, Y as oe, P as le, aG as ce, ax as de, aH as ue, p as P } from "./index-
|
|
4
|
-
import { aq as D, ar as G, A as _, ax as me } from "./index-
|
|
3
|
+
import { aF as ne, c as M, X as ie, Y as oe, P as le, aG as ce, ax as de, aH as ue, p as P } from "./index-OuHV9Ann.js";
|
|
4
|
+
import { aq as D, ar as G, A as _, ax as me } from "./index-LBTm1Jmk.js";
|
|
5
5
|
import { useQuery as K, useMutation as A, useQueryClient as pe } from "@tanstack/react-query";
|
|
6
6
|
import { useSetAtom as fe } from "jotai";
|
|
7
7
|
import { toast as N } from "sonner";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./register-chai-top-bar-DyW9GPzV.cjs"),x=require("./index-DonDtb8f.cjs"),b=require("./index-j-XsKW-V.cjs"),C=require("@tanstack/react-query"),X=require("jotai"),j=require("sonner"),E=require("lucide-react"),i=require("react"),J=require("./image-compression-UaU7Bwqe.cjs"),R=require("lodash-es"),Z=s=>{const r=b.useApiUrl(),l=b.useFetch();return C.useMutation({mutationFn:async t=>l(r,{action:b.ACTIONS.UPSERT_LIBRARY_ITEM,data:t}),onSuccess:t=>{s?s(t):j.toast.success("Block saved successfully")},onError:t=>{console.error("Error saving block:",t),j.toast.error("Failed to save block",{description:t instanceof Error?t.message:"Unknown error"})}})},ee=s=>{const r=b.useApiUrl(),l=b.useFetch();return C.useQuery({staleTime:"static",queryKey:[b.ACTIONS.GET_LIBRARY_ITEM,s],enabled:!!s,queryFn:async()=>{if(!s)return null;try{return await l(r,{action:b.ACTIONS.GET_LIBRARY_ITEM,data:{id:s}})}catch(t){throw console.error(t),new Error("The block could not be found on the server. It may have been deleted.")}},retry:!1})},te=s=>{const r=b.useApiUrl(),l=b.useFetch(),t=X.useSetAtom(x.libraryBlocksAtom);return C.useMutation({mutationFn:async c=>l(r,{action:b.ACTIONS.DELETE_LIBRARY_ITEM,data:{id:c}}),onSuccess:()=>{t(c=>{const m={...c};return Object.keys(m).forEach(u=>{m[u]={loading:"idle",blocks:[],error:!1}}),m}),s?s():j.toast.success("Block deleted successfully")},onError:c=>{console.error("Error deleting block:",c),j.toast.error("Failed to delete block",{description:c instanceof Error?c.message:"Unknown error"})}})},se=({blockId:s,libBlockId:r,isOpen:l,onClose:t,blockName:c,trigger:m})=>{const[u,o]=i.useState(!1),d=x.useUpdateBlocksPropsRealtime(),y=te(()=>{d([s],{_libBlockId:void 0}),j.toast.success("Block deleted successfully"),o(!1),t()}),h=()=>{o(!0),y.mutate(r)},g=e.jsxs(p.Button,{type:"button",variant:"destructive",size:"sm",onClick:f=>f.preventDefault(),disabled:u,children:[e.jsx(E.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]});return e.jsxs(x.Popover,{open:l,onOpenChange:f=>!f&&t(),children:[e.jsx(x.PopoverTrigger,{asChild:!0,children:m||g}),e.jsx(x.PopoverContent,{className:"z-[9999] w-72 p-4",sideOffset:5,align:"center",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-medium",children:"Delete Block"}),e.jsxs("p",{className:"text-sm",children:["Are you sure you want to delete the block",e.jsxs("span",{className:"font-medium",children:[' "',c,'"']}),"?"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This block will be permanently removed from the library. This action cannot be undone."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(p.Button,{type:"button",variant:"outline",size:"sm",onClick:t,disabled:u,children:"Cancel"}),e.jsx(p.Button,{type:"button",variant:"destructive",size:"sm",onClick:h,disabled:u,children:u?"Deleting...":"Delete"})]})]})})]})},re=({blockId:s,libBlockId:r,blockName:l,size:t="sm",className:c="",close:m})=>{const[u,o]=i.useState(!1);return e.jsx(se,{blockId:s,libBlockId:r,isOpen:u,onClose:()=>{o(!1),m()},blockName:l,trigger:e.jsxs(p.Button,{type:"button",variant:"destructive",size:t,className:c,onClick:()=>o(!0),children:[e.jsx(E.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]})})},ne=()=>{const s=b.useApiUrl(),r=b.useFetch(),l=C.useQueryClient(),{data:t=[],isLoading:c,error:m}=C.useQuery({queryKey:["library-groups"],staleTime:"static",placeholderData:[],queryFn:async()=>{try{return await r(s,{action:"GET_LIBRARY_GROUPS"})||[]}catch(d){return console.error("Error fetching library groups:",d),[]}}}),{mutateAsync:u,isPending:o}=C.useMutation({mutationFn:async d=>{if(!d.trim())throw new Error("Group name is required");return r(s,{action:"CREATE_BLOCK_GROUP",data:{name:d}})},onSuccess:()=>{l.invalidateQueries({queryKey:["library-groups"]}),j.toast.success("Group created successfully")},onError:d=>{console.error("Error creating group:",d),j.toast.error("Failed to create group",{description:d instanceof Error?d.message:"Unknown error"})}});return{groups:t,isLoading:c,error:m,createGroup:u,isCreating:o}},ae=({value:s,onChange:r})=>{const[l,t]=i.useState(!1),[c,m]=i.useState(""),u=i.useRef(null),{groups:o}=ne(),[d,y]=i.useState([{id:"hero",name:"Hero"},{id:"feature",name:"Feature"},{id:"footer",name:"Footer"},{id:"content",name:"Content"},{id:"testimonial",name:"Testimonial"},{id:"pricing",name:"Pricing"},{id:"login",name:"Login"},{id:"logos",name:"Logos"},{id:"about",name:"About"},{id:"banner",name:"Banner"},{id:"blog",name:"Blog"},{id:"careers",name:"Careers"},{id:"casestudy",name:"Casestudy"},{id:"changelog",name:"Changelog"},{id:"compare",name:"Compare"},{id:"contact",name:"Contact"},{id:"cta",name:"Cta"},{id:"faq",name:"Faq"},{id:"gallery",name:"Gallery"},{id:"integration",name:"Integration"},{id:"list",name:"List"},{id:"navbar",name:"Navbar"},{id:"product",name:"Product"},{id:"signup",name:"Signup"},{id:"stats",name:"Stats"},{id:"team",name:"Team"},{id:"timeline",name:"Timeline"}]),h=i.useMemo(()=>[...o,...d.filter(n=>!o.some(B=>B.id===n.id))],[o,d]),g=()=>{const n=c.trim();if(!n)return;const B={id:n,name:n};y(w=>[...w,B]),r(B.id),m(""),t(!1)};i.useEffect(()=>{l&&u.current&&u.current.focus()},[l]);const f=n=>{n.key==="Enter"&&(n.preventDefault(),g())};return i.useEffect(()=>{s&&!h.some(n=>n.id===s)&&r("")},[s,h,r]),l?e.jsxs("div",{className:"space-y-2",children:[e.jsx(p.Input,{ref:u,placeholder:"Enter new group name",value:c,onChange:n=>m(n.target.value),onKeyDown:f}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(p.Button,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),e.jsx(p.Button,{size:"sm",onClick:g,children:"Create"})]})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",value:s,onChange:n=>r(n.target.value),children:[e.jsx("option",{value:"",children:"Select a group"}),o.length>0&&e.jsx("optgroup",{label:"Library Groups",children:o.map(n=>e.jsx("option",{value:n.id,children:n.name},`lib-${n.id}`))}),d.length>0&&e.jsx("optgroup",{label:"Predefined Groups",children:d.filter(n=>!o.some(B=>B.id===n.id)).map(n=>e.jsx("option",{value:n.id,children:n.name},`local-${n.id}`))})]}),e.jsx(p.Button,{type:"button",size:"icon",variant:"outline",onClick:()=>t(!0),children:e.jsx(E.Plus,{className:"h-4 w-4"})})]})},oe=({value:s,onChange:r})=>{const[l,t]=i.useState(!1),c=i.useRef(null),m=i.useCallback(async d=>{var h;const y=(h=d.target.files)==null?void 0:h[0];if(y)try{t(!0);let g=y;y.type.startsWith("image/")&&(g=await J.compressImageIfNeeded(y));const f=new FileReader;f.onloadend=()=>{r(f.result),t(!1)},f.readAsDataURL(g)}catch(g){console.error("Error reading file:",g),t(!1),j.toast.error("Failed to process image",{description:g instanceof Error?g.message:"Unknown error"})}},[r]),u=()=>{r(""),c.current&&(c.current.value="")},o=()=>{var d;(d=c.current)==null||d.click()};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p.Input,{type:"file",ref:c,onChange:m,accept:"image/*",className:"hidden"}),e.jsx(p.Button,{type:"button",variant:"outline",onClick:o,disabled:l,className:"w-full",children:l?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Uploading..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(E.ImageIcon,{className:"h-4 w-4"}),"Select image"]})}),s&&e.jsx(p.Button,{type:"button",variant:"outline",size:"icon",onClick:u,children:e.jsx(E.X,{className:"h-4 w-4"})})]}),s&&e.jsx("div",{className:"aspect-video h-[200px] max-h-[200px] overflow-hidden rounded-md border",children:e.jsx("img",{src:s,alt:"Preview",className:"h-full w-full object-contain"})})]})},ie=s=>{const{blocks:r,close:l,blockId:t}=s,{getPartialBlocks:c}=x.usePartialBlocksStore(),m=r.find(a=>a._id===t),u=m==null?void 0:m._libBlockId,o=!!u,d=i.useMemo(()=>r.some(a=>a._type==="PartialBlock"||a._type==="GlobalBlock"),[r]),y=i.useMemo(()=>{let a=[];for(const k of r)if(k._type==="PartialBlock"||k._type==="GlobalBlock"){let v=c(k.partialBlockId);k._parent&&(v==null?void 0:v.length)>0&&(v=v.map(T=>(R.isEmpty(T._parent)&&R.set(T,"_parent",k._parent),T))),a=[...a,...v]}else a.push(k);return a},[r,c]),[h,g]=i.useState(""),[f,n]=i.useState(""),[B,w]=i.useState(""),[S,_]=i.useState(""),[N,U]=i.useState({}),[q,M]=i.useState(!1),[O,F]=i.useState(o),[z,K]=i.useState(!1),{hasPermission:Y}=x.usePermissions(),Q=Y(b.PAGES_PERMISSIONS.DELETE_LIBRARY_BLOCK),D=x.useUpdateBlocksPropsRealtime(),V=()=>{D([t],{_libBlockId:void 0}),j.toast.success("Block delinked from library"),l()},{data:I,isLoading:P,isError:G}=ee(u);i.useEffect(()=>{G&&o&&(K(!0),F(!1))},[G,o]),i.useEffect(()=>{I&&!P&&(g(I.name||""),n(I.group||""),w(I.description||""),_(I.preview||""),F(!1))},[I,P]),i.useEffect(()=>{const a=h.trim().length>=2,k=f.trim()!=="";M(a&&k)},[h,f]);const W=()=>{const a={};return h.trim()?h.length<2&&(a.name="Name must be at least 2 characters"):a.name="Name is required",f||(a.group="Group is required"),U(a),Object.keys(a).length===0},{resetLibrary:$}=x.useLibraryBlocks({id:""}),A=Z(a=>{o||D([t],{_libBlockId:a.id}),j.toast.success(`Block ${o?"updated":"saved"} successfully`),$(a.library),l()}),H=async a=>{if(a.preventDefault(),!W())return;const k=y.map(v=>(R.has(v,"_libBlockId")&&delete v._libBlockId,v));A.mutate({name:h.trim(),group:f,blocks:k,description:B.trim(),...S&&S.startsWith("data:")?{previewImage:S}:{},...o?{id:u}:{}})},L=A.isPending;return O||P?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):z?e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsx("div",{className:"font-medium text-destructive",children:"Block Not Found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This block could not be found on the server. It may have been deleted."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(p.Button,{type:"button",variant:"outline",onClick:l,children:"Cancel"}),e.jsx(p.Button,{onClick:V,variant:"destructive",children:"Delink Block"})]})]}):e.jsxs("div",{children:[d&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive",children:[e.jsx(E.AlertCircle,{className:"mt-0.5 h-5 w-5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Partial Blocks Detected"}),e.jsx("p",{className:"mt-1 text-xs",children:"This block contains one or more Partial Blocks. Partial blocks will be merged into the library block"})]})]}),e.jsxs("form",{onSubmit:H,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"name",className:N.name?"text-destructive":"",children:"Name"}),e.jsx(p.Input,{id:"name",placeholder:"Enter block name",value:h,onChange:a=>g(a.target.value),className:N.name?"border-destructive":""}),N.name&&e.jsx("p",{className:"text-xs text-destructive",children:N.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"group",className:N.group?"text-destructive":"",children:"Group"}),e.jsx(ae,{value:f,onChange:n}),N.group&&e.jsx("p",{className:"text-xs text-destructive",children:N.group})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(p.Input,{id:"description",placeholder:"Enter a brief description",className:"resize-none",value:B,onChange:a=>w(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"previewImage",children:"Preview Image (optional)"}),e.jsx(oe,{value:S,onChange:_})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o&&Q&&e.jsx(re,{blockId:t,libBlockId:u,blockName:h,className:"mr-auto",close:l}),e.jsx(p.Button,{type:"button",variant:"outline",onClick:l,disabled:L,children:"Cancel"}),e.jsx(p.Button,{type:"submit",disabled:L||!q,children:L?"Saving...":o?"Update Block":"Save Block"})]})]})]})};exports.default=ie;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./register-chai-top-bar-DyW9GPzV.cjs"),x=require("./index-DCJDQs1a.cjs"),b=require("./index-BVwFJWDq.cjs"),C=require("@tanstack/react-query"),X=require("jotai"),j=require("sonner"),E=require("lucide-react"),i=require("react"),J=require("./image-compression-UaU7Bwqe.cjs"),R=require("lodash-es"),Z=s=>{const r=b.useApiUrl(),l=b.useFetch();return C.useMutation({mutationFn:async t=>l(r,{action:b.ACTIONS.UPSERT_LIBRARY_ITEM,data:t}),onSuccess:t=>{s?s(t):j.toast.success("Block saved successfully")},onError:t=>{console.error("Error saving block:",t),j.toast.error("Failed to save block",{description:t instanceof Error?t.message:"Unknown error"})}})},ee=s=>{const r=b.useApiUrl(),l=b.useFetch();return C.useQuery({staleTime:"static",queryKey:[b.ACTIONS.GET_LIBRARY_ITEM,s],enabled:!!s,queryFn:async()=>{if(!s)return null;try{return await l(r,{action:b.ACTIONS.GET_LIBRARY_ITEM,data:{id:s}})}catch(t){throw console.error(t),new Error("The block could not be found on the server. It may have been deleted.")}},retry:!1})},te=s=>{const r=b.useApiUrl(),l=b.useFetch(),t=X.useSetAtom(x.libraryBlocksAtom);return C.useMutation({mutationFn:async c=>l(r,{action:b.ACTIONS.DELETE_LIBRARY_ITEM,data:{id:c}}),onSuccess:()=>{t(c=>{const m={...c};return Object.keys(m).forEach(u=>{m[u]={loading:"idle",blocks:[],error:!1}}),m}),s?s():j.toast.success("Block deleted successfully")},onError:c=>{console.error("Error deleting block:",c),j.toast.error("Failed to delete block",{description:c instanceof Error?c.message:"Unknown error"})}})},se=({blockId:s,libBlockId:r,isOpen:l,onClose:t,blockName:c,trigger:m})=>{const[u,o]=i.useState(!1),d=x.useUpdateBlocksPropsRealtime(),y=te(()=>{d([s],{_libBlockId:void 0}),j.toast.success("Block deleted successfully"),o(!1),t()}),h=()=>{o(!0),y.mutate(r)},g=e.jsxs(p.Button,{type:"button",variant:"destructive",size:"sm",onClick:f=>f.preventDefault(),disabled:u,children:[e.jsx(E.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]});return e.jsxs(x.Popover,{open:l,onOpenChange:f=>!f&&t(),children:[e.jsx(x.PopoverTrigger,{asChild:!0,children:m||g}),e.jsx(x.PopoverContent,{className:"z-[9999] w-72 p-4",sideOffset:5,align:"center",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-medium",children:"Delete Block"}),e.jsxs("p",{className:"text-sm",children:["Are you sure you want to delete the block",e.jsxs("span",{className:"font-medium",children:[' "',c,'"']}),"?"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This block will be permanently removed from the library. This action cannot be undone."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(p.Button,{type:"button",variant:"outline",size:"sm",onClick:t,disabled:u,children:"Cancel"}),e.jsx(p.Button,{type:"button",variant:"destructive",size:"sm",onClick:h,disabled:u,children:u?"Deleting...":"Delete"})]})]})})]})},re=({blockId:s,libBlockId:r,blockName:l,size:t="sm",className:c="",close:m})=>{const[u,o]=i.useState(!1);return e.jsx(se,{blockId:s,libBlockId:r,isOpen:u,onClose:()=>{o(!1),m()},blockName:l,trigger:e.jsxs(p.Button,{type:"button",variant:"destructive",size:t,className:c,onClick:()=>o(!0),children:[e.jsx(E.Trash2,{className:"mr-2 h-4 w-4"}),"Delete"]})})},ne=()=>{const s=b.useApiUrl(),r=b.useFetch(),l=C.useQueryClient(),{data:t=[],isLoading:c,error:m}=C.useQuery({queryKey:["library-groups"],staleTime:"static",placeholderData:[],queryFn:async()=>{try{return await r(s,{action:"GET_LIBRARY_GROUPS"})||[]}catch(d){return console.error("Error fetching library groups:",d),[]}}}),{mutateAsync:u,isPending:o}=C.useMutation({mutationFn:async d=>{if(!d.trim())throw new Error("Group name is required");return r(s,{action:"CREATE_BLOCK_GROUP",data:{name:d}})},onSuccess:()=>{l.invalidateQueries({queryKey:["library-groups"]}),j.toast.success("Group created successfully")},onError:d=>{console.error("Error creating group:",d),j.toast.error("Failed to create group",{description:d instanceof Error?d.message:"Unknown error"})}});return{groups:t,isLoading:c,error:m,createGroup:u,isCreating:o}},ae=({value:s,onChange:r})=>{const[l,t]=i.useState(!1),[c,m]=i.useState(""),u=i.useRef(null),{groups:o}=ne(),[d,y]=i.useState([{id:"hero",name:"Hero"},{id:"feature",name:"Feature"},{id:"footer",name:"Footer"},{id:"content",name:"Content"},{id:"testimonial",name:"Testimonial"},{id:"pricing",name:"Pricing"},{id:"login",name:"Login"},{id:"logos",name:"Logos"},{id:"about",name:"About"},{id:"banner",name:"Banner"},{id:"blog",name:"Blog"},{id:"careers",name:"Careers"},{id:"casestudy",name:"Casestudy"},{id:"changelog",name:"Changelog"},{id:"compare",name:"Compare"},{id:"contact",name:"Contact"},{id:"cta",name:"Cta"},{id:"faq",name:"Faq"},{id:"gallery",name:"Gallery"},{id:"integration",name:"Integration"},{id:"list",name:"List"},{id:"navbar",name:"Navbar"},{id:"product",name:"Product"},{id:"signup",name:"Signup"},{id:"stats",name:"Stats"},{id:"team",name:"Team"},{id:"timeline",name:"Timeline"}]),h=i.useMemo(()=>[...o,...d.filter(n=>!o.some(B=>B.id===n.id))],[o,d]),g=()=>{const n=c.trim();if(!n)return;const B={id:n,name:n};y(w=>[...w,B]),r(B.id),m(""),t(!1)};i.useEffect(()=>{l&&u.current&&u.current.focus()},[l]);const f=n=>{n.key==="Enter"&&(n.preventDefault(),g())};return i.useEffect(()=>{s&&!h.some(n=>n.id===s)&&r("")},[s,h,r]),l?e.jsxs("div",{className:"space-y-2",children:[e.jsx(p.Input,{ref:u,placeholder:"Enter new group name",value:c,onChange:n=>m(n.target.value),onKeyDown:f}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(p.Button,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),e.jsx(p.Button,{size:"sm",onClick:g,children:"Create"})]})]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",value:s,onChange:n=>r(n.target.value),children:[e.jsx("option",{value:"",children:"Select a group"}),o.length>0&&e.jsx("optgroup",{label:"Library Groups",children:o.map(n=>e.jsx("option",{value:n.id,children:n.name},`lib-${n.id}`))}),d.length>0&&e.jsx("optgroup",{label:"Predefined Groups",children:d.filter(n=>!o.some(B=>B.id===n.id)).map(n=>e.jsx("option",{value:n.id,children:n.name},`local-${n.id}`))})]}),e.jsx(p.Button,{type:"button",size:"icon",variant:"outline",onClick:()=>t(!0),children:e.jsx(E.Plus,{className:"h-4 w-4"})})]})},oe=({value:s,onChange:r})=>{const[l,t]=i.useState(!1),c=i.useRef(null),m=i.useCallback(async d=>{var h;const y=(h=d.target.files)==null?void 0:h[0];if(y)try{t(!0);let g=y;y.type.startsWith("image/")&&(g=await J.compressImageIfNeeded(y));const f=new FileReader;f.onloadend=()=>{r(f.result),t(!1)},f.readAsDataURL(g)}catch(g){console.error("Error reading file:",g),t(!1),j.toast.error("Failed to process image",{description:g instanceof Error?g.message:"Unknown error"})}},[r]),u=()=>{r(""),c.current&&(c.current.value="")},o=()=>{var d;(d=c.current)==null||d.click()};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p.Input,{type:"file",ref:c,onChange:m,accept:"image/*",className:"hidden"}),e.jsx(p.Button,{type:"button",variant:"outline",onClick:o,disabled:l,className:"w-full",children:l?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Uploading..."]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(E.ImageIcon,{className:"h-4 w-4"}),"Select image"]})}),s&&e.jsx(p.Button,{type:"button",variant:"outline",size:"icon",onClick:u,children:e.jsx(E.X,{className:"h-4 w-4"})})]}),s&&e.jsx("div",{className:"aspect-video h-[200px] max-h-[200px] overflow-hidden rounded-md border",children:e.jsx("img",{src:s,alt:"Preview",className:"h-full w-full object-contain"})})]})},ie=s=>{const{blocks:r,close:l,blockId:t}=s,{getPartialBlocks:c}=x.usePartialBlocksStore(),m=r.find(a=>a._id===t),u=m==null?void 0:m._libBlockId,o=!!u,d=i.useMemo(()=>r.some(a=>a._type==="PartialBlock"||a._type==="GlobalBlock"),[r]),y=i.useMemo(()=>{let a=[];for(const k of r)if(k._type==="PartialBlock"||k._type==="GlobalBlock"){let v=c(k.partialBlockId);k._parent&&(v==null?void 0:v.length)>0&&(v=v.map(T=>(R.isEmpty(T._parent)&&R.set(T,"_parent",k._parent),T))),a=[...a,...v]}else a.push(k);return a},[r,c]),[h,g]=i.useState(""),[f,n]=i.useState(""),[B,w]=i.useState(""),[S,_]=i.useState(""),[N,U]=i.useState({}),[q,M]=i.useState(!1),[O,F]=i.useState(o),[z,K]=i.useState(!1),{hasPermission:Y}=x.usePermissions(),Q=Y(b.PAGES_PERMISSIONS.DELETE_LIBRARY_BLOCK),D=x.useUpdateBlocksPropsRealtime(),V=()=>{D([t],{_libBlockId:void 0}),j.toast.success("Block delinked from library"),l()},{data:I,isLoading:P,isError:G}=ee(u);i.useEffect(()=>{G&&o&&(K(!0),F(!1))},[G,o]),i.useEffect(()=>{I&&!P&&(g(I.name||""),n(I.group||""),w(I.description||""),_(I.preview||""),F(!1))},[I,P]),i.useEffect(()=>{const a=h.trim().length>=2,k=f.trim()!=="";M(a&&k)},[h,f]);const W=()=>{const a={};return h.trim()?h.length<2&&(a.name="Name must be at least 2 characters"):a.name="Name is required",f||(a.group="Group is required"),U(a),Object.keys(a).length===0},{resetLibrary:$}=x.useLibraryBlocks({id:""}),A=Z(a=>{o||D([t],{_libBlockId:a.id}),j.toast.success(`Block ${o?"updated":"saved"} successfully`),$(a.library),l()}),H=async a=>{if(a.preventDefault(),!W())return;const k=y.map(v=>(R.has(v,"_libBlockId")&&delete v._libBlockId,v));A.mutate({name:h.trim(),group:f,blocks:k,description:B.trim(),...S&&S.startsWith("data:")?{previewImage:S}:{},...o?{id:u}:{}})},L=A.isPending;return O||P?e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):z?e.jsxs("div",{className:"space-y-4 p-6",children:[e.jsx("div",{className:"font-medium text-destructive",children:"Block Not Found"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This block could not be found on the server. It may have been deleted."}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[e.jsx(p.Button,{type:"button",variant:"outline",onClick:l,children:"Cancel"}),e.jsx(p.Button,{onClick:V,variant:"destructive",children:"Delink Block"})]})]}):e.jsxs("div",{children:[d&&e.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive",children:[e.jsx(E.AlertCircle,{className:"mt-0.5 h-5 w-5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Partial Blocks Detected"}),e.jsx("p",{className:"mt-1 text-xs",children:"This block contains one or more Partial Blocks. Partial blocks will be merged into the library block"})]})]}),e.jsxs("form",{onSubmit:H,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"name",className:N.name?"text-destructive":"",children:"Name"}),e.jsx(p.Input,{id:"name",placeholder:"Enter block name",value:h,onChange:a=>g(a.target.value),className:N.name?"border-destructive":""}),N.name&&e.jsx("p",{className:"text-xs text-destructive",children:N.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"group",className:N.group?"text-destructive":"",children:"Group"}),e.jsx(ae,{value:f,onChange:n}),N.group&&e.jsx("p",{className:"text-xs text-destructive",children:N.group})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(p.Input,{id:"description",placeholder:"Enter a brief description",className:"resize-none",value:B,onChange:a=>w(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(x.Label,{htmlFor:"previewImage",children:"Preview Image (optional)"}),e.jsx(oe,{value:S,onChange:_})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[o&&Q&&e.jsx(re,{blockId:t,libBlockId:u,blockName:h,className:"mr-auto",close:l}),e.jsx(p.Button,{type:"button",variant:"outline",onClick:l,disabled:L,children:"Cancel"}),e.jsx(p.Button,{type:"submit",disabled:L||!q,children:L?"Saving...":o?"Update Block":"Save Block"})]})]})]})};exports.default=ie;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const o=require("react/jsx-runtime"),r=require("./register-chai-top-bar-DyW9GPzV.cjs"),m=require("lucide-react"),i=require("react"),p=require("use-stick-to-bottom"),T=require("streamdown");require("@radix-ui/react-slot");const P=require("class-variance-authority"),_=require("./index-
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),r=require("./register-chai-top-bar-DyW9GPzV.cjs"),m=require("lucide-react"),i=require("react"),p=require("use-stick-to-bottom"),T=require("streamdown");require("@radix-ui/react-slot");const P=require("class-variance-authority"),_=require("./index-DCJDQs1a.cjs");require("clsx");require("tailwind-merge");const z=require("@radix-ui/react-tooltip"),j=require("@radix-ui/react-use-controllable-state"),B=require("@radix-ui/react-collapsible"),D=require("framer-motion"),f=require("./index-BVwFJWDq.cjs"),I=require("react-i18next");function h(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const L=h(i),S=h(z),b=h(B),G=({className:e,...t})=>o.jsx(p.StickToBottom,{className:r.cn("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),$=({className:e,...t})=>o.jsx(p.StickToBottom.Content,{className:r.cn("flex flex-col gap-8 p-4",e),...t}),F=({className:e,title:t="No messages yet",description:s="Start a conversation to see messages here",icon:n,children:a,...l})=>o.jsx("div",{className:r.cn("flex size-full flex-col items-center justify-center gap-3 p-8 text-center",e),...l,children:a??o.jsxs(o.Fragment,{children:[n&&o.jsx("div",{className:"text-muted-foreground",children:n}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("h3",{className:"text-sm font-medium",children:t}),s&&o.jsx("p",{className:"text-sm text-muted-foreground",children:s})]})]})}),Q=({className:e,...t})=>{const{isAtBottom:s,scrollToBottom:n}=p.useStickToBottomContext(),a=i.useCallback(()=>{n()},[n]);return!s&&o.jsx(r.Button,{className:r.cn("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full",e),onClick:a,size:"icon",type:"button",variant:"outline",...t,children:o.jsx(m.ArrowDownIcon,{className:"size-4"})})};P.cva("flex w-fit items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});const V=L.forwardRef(({className:e,sideOffset:t=4,...s},n)=>o.jsx(S.Content,{ref:n,sideOffset:t,className:r.cn("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...s}));V.displayName=S.Content.displayName;const K=({className:e,from:t,...s})=>o.jsx("div",{className:r.cn("group flex w-full max-w-[80%] flex-col gap-2",t==="user"?"is-user ml-auto justify-end":"is-assistant",e),...s}),Y=({children:e,className:t,...s})=>o.jsx("div",{className:r.cn("is-user:dark flex w-fit flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground",t),...s,children:e});i.createContext(null);const w=i.memo(({className:e,...t})=>o.jsx(T.Streamdown,{className:r.cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...t}),(e,t)=>e.children===t.children);w.displayName="MessageResponse";const J=b.Root,X=b.CollapsibleTrigger,H=b.CollapsibleContent,W=({children:e,as:t="p",className:s,duration:n=2,spread:a=2})=>{const l=D.motion.create(t),g=i.useMemo(()=>((e==null?void 0:e.length)??0)*a,[e,a]);return o.jsx(l,{animate:{backgroundPosition:"0% center"},className:r.cn("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",s),initial:{backgroundPosition:"100% center"},style:{"--spread":`${g}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:Number.POSITIVE_INFINITY,duration:n,ease:"linear"},children:e})},E=i.memo(W),R=i.createContext(null),Z=()=>{const e=i.useContext(R);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},ee=1e3,te=1e3,y=i.memo(({className:e,isStreaming:t=!1,open:s,defaultOpen:n=!0,onOpenChange:a,duration:l,children:g,...U})=>{const[c,d]=j.useControllableState({prop:s,defaultProp:n,onChange:a}),[M,v]=j.useControllableState({prop:l,defaultProp:void 0}),[N,q]=i.useState(!1),[u,C]=i.useState(null);i.useEffect(()=>{t?u===null&&C(Date.now()):u!==null&&(v(Math.ceil((Date.now()-u)/te)),C(null))},[t,u,v]),i.useEffect(()=>{if(n&&!t&&c&&!N){const x=setTimeout(()=>{d(!1),q(!0)},ee);return()=>clearTimeout(x)}},[t,c,n,d,N]);const O=x=>{d(x)};return o.jsx(R.Provider,{value:{isStreaming:t,isOpen:c,setIsOpen:d,duration:M},children:o.jsx(J,{className:r.cn("not-prose mb-4",e),onOpenChange:O,open:c,...U,children:g})})}),oe=(e,t)=>e||t===0?o.jsx(E,{duration:1,children:"Thinking..."}):t===void 0?o.jsx("p",{children:"Thought for a few seconds"}):o.jsxs("p",{children:["Thought for ",t," seconds"]}),A=i.memo(({className:e,children:t,...s})=>{const{isStreaming:n,isOpen:a,duration:l}=Z();return o.jsx(X,{className:r.cn("flex w-full items-center gap-2 text-sm text-muted-foreground transition-colors hover:text-foreground",e),...s,children:t??o.jsxs(o.Fragment,{children:[o.jsx(m.BrainIcon,{className:"size-4"}),oe(n,l),o.jsx(m.ChevronDownIcon,{className:r.cn("size-4 transition-transform",a?"rotate-180":"rotate-0")})]})})}),k=i.memo(({className:e,children:t,...s})=>o.jsx(H,{className:r.cn("mt-4 text-sm","text-muted-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2",e),...s,children:o.jsx(T.Streamdown,{...s,children:t})}));y.displayName="Reasoning";A.displayName="ReasoningTrigger";k.displayName="ReasoningContent";const se=({className:e,content:t,isLoading:s=!1,...n})=>o.jsx("div",{className:r.cn("is-assistant flex w-full max-w-[80%] flex-col gap-2",e),...n,children:o.jsx("div",{className:"flex w-fit flex-col gap-2 overflow-hidden text-sm",children:o.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-muted-foreground/20 bg-muted/50 p-3",children:o.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[s&&o.jsx(E,{duration:1.5,children:t}),!s&&o.jsx("div",{className:"text-xs text-muted-foreground",children:t})]})})})});function ne({userInput:e,language:t="en",currentHtml:s}){const n=f.LANGUAGES[t]||"English";return s&&s.trim().length>0?`
|
|
2
2
|
MODE: EDIT
|
|
3
3
|
CURRENT HTML:
|
|
4
4
|
${s}
|
|
@@ -7,14 +7,14 @@ import { StickToBottom as R, useStickToBottomContext as Q } from "use-stick-to-b
|
|
|
7
7
|
import { Streamdown as y } from "streamdown";
|
|
8
8
|
import "@radix-ui/react-slot";
|
|
9
9
|
import { cva as F } from "class-variance-authority";
|
|
10
|
-
import { r as K } from "./index-
|
|
10
|
+
import { r as K } from "./index-OuHV9Ann.js";
|
|
11
11
|
import "clsx";
|
|
12
12
|
import "tailwind-merge";
|
|
13
13
|
import * as A from "@radix-ui/react-tooltip";
|
|
14
14
|
import { useControllableState as w } from "@radix-ui/react-use-controllable-state";
|
|
15
15
|
import * as x from "@radix-ui/react-collapsible";
|
|
16
16
|
import { motion as V } from "framer-motion";
|
|
17
|
-
import { L as h } from "./index-
|
|
17
|
+
import { L as h } from "./index-LBTm1Jmk.js";
|
|
18
18
|
import { useTranslation as Y } from "react-i18next";
|
|
19
19
|
const Te = ({ className: e, ...t }) => /* @__PURE__ */ o(
|
|
20
20
|
R,
|