@chaibuilder/sdk 1.2.42 → 1.2.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/AddBlocks-Bb-K6Y0Z.cjs +1 -0
  2. package/dist/{AddBlocks--7JKHvJX.js → AddBlocks-QCb-vIta.js} +57 -56
  3. package/dist/CanvasArea-Hqy_21xf.js +1215 -0
  4. package/dist/CanvasArea-xvT325mp.cjs +57 -0
  5. package/dist/{ChaiBuilderEditor-GronwWg6.cjs → ChaiBuilderEditor-AIXWnz29.cjs} +44 -44
  6. package/dist/{ChaiBuilderEditor-f4SJU7kK.js → ChaiBuilderEditor-NnMEdW3k.js} +6627 -6635
  7. package/dist/{CurrentPage-hq3wJX-B.cjs → CurrentPage-n_oOiHx5.cjs} +1 -1
  8. package/dist/{CurrentPage-S5EFVi8y.js → CurrentPage-rkdt2mNr.js} +3 -3
  9. package/dist/{ListTree-un8hNvIi.js → ListTree-PuZP9LQu.js} +3 -3
  10. package/dist/{ListTree-PbmMwEnK.cjs → ListTree-z0FeSAsc.cjs} +1 -1
  11. package/dist/{PagesPanel-2zdTxUbm.cjs → PagesPanel-4ftrFiS0.cjs} +1 -1
  12. package/dist/{PagesPanel-f0XKYnEj.js → PagesPanel-TYArrNU6.js} +4 -4
  13. package/dist/{ProjectPanel-RMEd0gwn.cjs → ProjectPanel-2scMInUn.cjs} +1 -1
  14. package/dist/{ProjectPanel-vbBl5OmU.js → ProjectPanel-qY_Bnqjm.js} +4 -4
  15. package/dist/{Settings-Lsp-FmFS.js → Settings-k9Ll55Wc.js} +965 -892
  16. package/dist/Settings-kbUR5-xt.cjs +1 -0
  17. package/dist/SidePanels-ZHxoiJ7y.cjs +1 -0
  18. package/dist/{SidePanels-zU4GsqbI.js → SidePanels-eOnxPSSw.js} +151 -151
  19. package/dist/{ThemeConfiguration-1rD36g89.js → ThemeConfiguration-TINcg8VX.js} +5 -5
  20. package/dist/{ThemeConfiguration-76oEQ5z0.cjs → ThemeConfiguration-fRsktVs4.cjs} +1 -1
  21. package/dist/{Topbar--M5IjXGt.js → Topbar--KrJ6nJg.js} +2 -2
  22. package/dist/{Topbar-7bRZS3P8.cjs → Topbar-tgFkKz7R.cjs} +1 -1
  23. package/dist/UILibrariesPanel-2HyAEVLE.cjs +1 -0
  24. package/dist/{UILibrariesPanel-EaMt1AzV.js → UILibrariesPanel-sleogb55.js} +55 -56
  25. package/dist/{UnsplashImages-o7mUozj7.js → UnsplashImages-P7_2yEo-.js} +9 -9
  26. package/dist/{UnsplashImages-eq44FmxF.cjs → UnsplashImages-azP_HIqG.cjs} +1 -1
  27. package/dist/{UploadImages-o4teNCqv.cjs → UploadImages-nnszHoZa.cjs} +1 -1
  28. package/dist/{UploadImages-s52Hvpts.js → UploadImages-ovzzQW6b.js} +7 -7
  29. package/dist/{add-page-modal-eoOwcRKz.js → add-page-modal-SmBfx0LH.js} +4 -4
  30. package/dist/{add-page-modal-7FLXbRFp.cjs → add-page-modal-nDBqhemF.cjs} +1 -1
  31. package/dist/atoms-ZOWyNoiC.js +6 -0
  32. package/dist/atoms-a0H_593V.cjs +1 -0
  33. package/dist/{confirm-alert-rFmTdGxh.cjs → confirm-alert-75rfTsgE.cjs} +1 -1
  34. package/dist/{confirm-alert-o0OjZdvp.js → confirm-alert-yipdBkkj.js} +2 -2
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.d.ts +1 -1
  37. package/dist/core.js +2 -2
  38. package/dist/{delete-page-modal-OU79XN8M.js → delete-page-modal-HIul7JBc.js} +3 -3
  39. package/dist/{delete-page-modal-sG2uFkT0.cjs → delete-page-modal-lO-dULGW.cjs} +1 -1
  40. package/dist/email-blocks.cjs +1 -1
  41. package/dist/email-blocks.js +30 -30
  42. package/dist/email.cjs +1 -1
  43. package/dist/email.d.ts +1 -1
  44. package/dist/email.js +2 -2
  45. package/dist/empty-slot-Lsxjts7Q.js +6 -0
  46. package/dist/empty-slot-Sy930lX6.cjs +1 -0
  47. package/dist/{form--h34bK4z.js → form-cZPoXqTP.js} +5 -5
  48. package/dist/{form-SuV0Z9nJ.cjs → form-yq_mbR58.cjs} +1 -1
  49. package/dist/{index-7hLL3kv4.js → index-Vu40oRWp.js} +2 -2
  50. package/dist/{index-3mF2lq-B.cjs → index-q_bEEzdK.cjs} +1 -1
  51. package/dist/lib.cjs +1 -1
  52. package/dist/lib.js +3 -3
  53. package/dist/{page-viewer-9-Dy66-a.cjs → page-viewer-3ZqrDjrz.cjs} +1 -1
  54. package/dist/{page-viewer-tfXRwkWz.js → page-viewer-ZOVAaE9q.js} +4 -4
  55. package/dist/{project-general-setting-ZjAN2VZX.js → project-general-setting-2iNlm_kN.js} +8 -8
  56. package/dist/{project-general-setting-ZbNwglNP.cjs → project-general-setting-IIxWGrU2.cjs} +1 -1
  57. package/dist/{project-seo-setting-vqWoo5Ev.cjs → project-seo-setting-46PdN9FR.cjs} +1 -1
  58. package/dist/{project-seo-setting-gAXZ15Wb.js → project-seo-setting-FX0cbkrO.js} +3 -3
  59. package/dist/{single-page-detail-ISRJ-Ebt.js → single-page-detail-4v8ojQss.js} +5 -5
  60. package/dist/{single-page-detail-a4nAhK0N.cjs → single-page-detail-MsBTVx9h.cjs} +1 -1
  61. package/dist/studio.cjs +1 -1
  62. package/dist/studio.d.ts +1 -1
  63. package/dist/studio.js +3 -3
  64. package/dist/style.css +1 -1
  65. package/dist/ui.cjs +1 -1
  66. package/dist/ui.d.ts +3 -3
  67. package/dist/ui.js +50 -50
  68. package/dist/{useCanvasSettings-EyxD8eas.cjs → useCanvasSettings-A7Qj0z4L.cjs} +1 -1
  69. package/dist/{useCanvasSettings-fsSISbZ6.js → useCanvasSettings-QH5zCmxD.js} +1 -1
  70. package/dist/utils-K3Zk762G.cjs +1 -0
  71. package/dist/{Class-6Hz2KzYb.js → utils-iMv3T4WT.js} +16 -15
  72. package/dist/web-blocks.cjs +4 -4
  73. package/dist/web-blocks.js +237 -238
  74. package/package.json +2 -2
  75. package/dist/AddBlocks-HZaa1NM6.cjs +0 -1
  76. package/dist/CanvasArea-CTmYdaUo.cjs +0 -55
  77. package/dist/CanvasArea-myZvxQCj.js +0 -1199
  78. package/dist/Class-Zc8hpE7f.cjs +0 -1
  79. package/dist/Settings-UqeNroki.cjs +0 -1
  80. package/dist/SidePanels-DimF3tJV.cjs +0 -1
  81. package/dist/UILibrariesPanel-1F_Kcnkm.cjs +0 -1
  82. package/dist/empty-slot-ZBlsQi6m.js +0 -15
  83. package/dist/empty-slot-nzYOgZuS.cjs +0 -1
@@ -0,0 +1,57 @@
1
+ "use strict";var ne=Object.defineProperty;var oe=(o,s,e)=>s in o?ne(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;var I=(o,s,e)=>(oe(o,typeof s!="symbol"?s+"":s,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),h=require("react"),c=require("lodash-es"),R=require("@radix-ui/react-icons"),i=require("./ChaiBuilderEditor-AIXWnz29.cjs"),N=require("react-i18next"),b=require("jotai"),re=require("lucide-react"),z=require("react-dom"),E=require("prop-types"),ie=require("react-quill"),_=require("./atoms-a0H_593V.cjs"),le=require("@floating-ui/dom"),W=require("@floating-ui/react-dom"),ce=require("@react-hookz/web"),ae=require("flagged"),de=require("@tailwindcss/typography"),ue=require("@tailwindcss/forms"),pe=require("@tailwindcss/aspect-ratio"),he=require("tailwindcss-palette-generator"),xe=require("tailwind-merge"),M=require("./STRINGS-gPz7CUOk.cjs"),me=require("@chaibuilder/runtime"),ge=require("./useCanvasSettings-A7Qj0z4L.cjs"),fe=require("react-wrap-balancer");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("i18next");require("./Functions-N3yhPYKY.cjs");require("./MODIFIERS-YPHRtwrM.cjs");require("./utils-K3Zk762G.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-hotkeys-hook");const ve=()=>{const{hasUndo:o,hasRedo:s,undo:e,redo:t}=i.useUndoManager();return r.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.jsxRuntimeExports.jsx(i.Button,{disabled:!o(),size:"sm",onClick:e,className:"rounded-full",variant:"ghost",children:r.jsxRuntimeExports.jsx(R.ResetIcon,{})}),r.jsxRuntimeExports.jsx(i.Button,{disabled:!s(),onClick:t,size:"sm",className:"rounded-full",variant:"ghost",children:r.jsxRuntimeExports.jsx(R.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function je(){const[o,s]=i.useDarkMode(),{t:e}=N.useTranslation();return r.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.jsxRuntimeExports.jsx(i.Label,{htmlFor:"dark-mode-switch",children:e("dark_mode")}),r.jsxRuntimeExports.jsxs(i.Switch,{id:"dark-mode-switch",checked:o,onCheckedChange:()=>{s(!o)},className:`${o?"bg-violet-600":"bg-violet-300"}
2
+ relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:e("use_setting")}),r.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${o?"translate-x-5":"translate-x-0"}
3
+ pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const K=({landscape:o=!1})=>r.jsxRuntimeExports.jsxs("svg",{className:o?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[r.jsxRuntimeExports.jsx("g",{strokeWidth:0}),r.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),r.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),$e=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:r.jsxRuntimeExports.jsx(R.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:r.jsxRuntimeExports.jsx(R.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:r.jsxRuntimeExports.jsx(K,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:r.jsxRuntimeExports.jsx(K,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:r.jsxRuntimeExports.jsx(R.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:r.jsxRuntimeExports.jsx(R.DesktopIcon,{}),width:1920}],Y=({title:o,content:s,currentBreakpoint:e,breakpoint:t,width:n,icon:u,onClick:a})=>{const{t:l}=N.useTranslation();return r.jsxRuntimeExports.jsxs(i.HoverCard,{children:[r.jsxRuntimeExports.jsx(i.HoverCardTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsx(i.Button,{onClick:()=>a(n),size:"sm",variant:t===e?"secondary":"ghost",children:u})}),r.jsxRuntimeExports.jsx(i.HoverCardContent,{className:"w-52 border-border",children:r.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:r.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[r.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:l(o)}),r.jsxRuntimeExports.jsx("p",{className:"text-xs",children:l(s)})]})})})]})},ye=()=>{const[,o,s]=i.useCanvasWidth(),[e,t]=i.useSelectedBreakpoints(),{t:n}=N.useTranslation(),u=i.useBuilderProp("breakpoints",$e),a=l=>{e.includes(l)?e.length>2&&t(e.filter(p=>p!==l)):t(p=>[...p,l])};return u.length<4?r.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:c.map(u,l=>h.createElement(Y,{...l,onClick:s,key:l.breakpoint,currentBreakpoint:o}))}):r.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[c.map(u.filter(l=>c.includes(e,c.toUpper(l.breakpoint))),l=>h.createElement(Y,{...l,onClick:s,key:l.breakpoint,currentBreakpoint:o})),r.jsxRuntimeExports.jsxs(i.DropdownMenu,{children:[r.jsxRuntimeExports.jsx(i.DropdownMenuTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:r.jsxRuntimeExports.jsx(R.DotsVerticalIcon,{className:"scale-90 transform"})})}),r.jsxRuntimeExports.jsxs(i.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[r.jsxRuntimeExports.jsx(i.DropdownMenuLabel,{children:n("Breakpoints")}),r.jsxRuntimeExports.jsx(i.DropdownMenuSeparator,{}),c.map(u,l=>r.jsxRuntimeExports.jsx(i.DropdownMenuCheckboxItem,{disabled:l.breakpoint==="xs",onCheckedChange:()=>a(c.toUpper(l.breakpoint)),checked:c.includes(e,c.toUpper(l.breakpoint)),children:n(l.title)},l.breakpoint))]})]})]})},be=()=>{const{t:o}=N.useTranslation(),{setNewBlocks:s}=i.useBlocksStoreUndoableActions(),[,e]=i.useSelectedBlockIds(),[,t]=i.useSelectedStylingBlocks(),n=h.useCallback(()=>{s([]),e([]),t([])},[s]);return r.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:r.jsxRuntimeExports.jsxs(i.AlertDialog,{children:[r.jsxRuntimeExports.jsx(i.AlertDialogTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsxs(i.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[r.jsxRuntimeExports.jsx(R.EraserIcon,{})," ",o("clear")]})}),r.jsxRuntimeExports.jsxs(i.AlertDialogContent,{className:"border-border",children:[r.jsxRuntimeExports.jsxs(i.AlertDialogHeader,{children:[r.jsxRuntimeExports.jsx(i.AlertDialogTitle,{children:o("clear_canvas_title")}),r.jsxRuntimeExports.jsx(i.AlertDialogDescription,{children:o("clear_canvas_description")})]}),r.jsxRuntimeExports.jsxs(i.AlertDialogFooter,{children:[r.jsxRuntimeExports.jsx(i.AlertDialogCancel,{children:o("cancel")}),r.jsxRuntimeExports.jsx(i.AlertDialogAction,{onClick:n,children:o("yes")})]})]})]})})},ke=()=>{const[o,s]=b.useAtom(i.aiAssistantActiveAtom);return i.useBuilderProp("askAiCallBack",null)?r.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxRuntimeExports.jsxs(i.Label,{htmlFor:"ai-assistant",className:"flex items-center gap-x-1 text-sm text-yellow-600",children:[r.jsxRuntimeExports.jsx(re.SparklesIcon,{className:"w-4"}),"AI Assistant"]}),r.jsxRuntimeExports.jsx(i.Switch,{className:"scale-90",checked:o,onCheckedChange:t=>{s(t)},id:"ai-assitantt"})]}):null},Ee=()=>{const o=i.useBuilderProp("darkMode",!1),[s]=i.useCanvasZoom();return r.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[r.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[o?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(je,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"})]}):null,r.jsxRuntimeExports.jsx(ye,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsxs("div",{className:"flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400",children:[r.jsxRuntimeExports.jsx(R.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",r.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[c.round(s,0),"%"]})]}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(ve,{})]}),r.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[r.jsxRuntimeExports.jsx(be,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(ke,{})]})]})},Re=`<!doctype html>
4
+ <html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
5
+ <head>
6
+ <meta charset="UTF-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
9
+ <style>
10
+ html { height: 100%; overflow:auto; }
11
+ body { height: 100%; }
12
+ .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
13
+ .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
14
+ body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
15
+ -moz-user-select: none;-ms-user-select: none; user-select: none; }
16
+ html{
17
+ -ms-overflow-style: none; /* IE and Edge */
18
+ scrollbar-width: none; /* Firefox */
19
+ }
20
+ /** IMPORTANT: Make fields content editable in SAFARI */
21
+ [contenteditable] {-webkit-user-select: text;user-select: text;}
22
+
23
+ html::-webkit-scrollbar { width: 0 !important }
24
+ .aspect-auto{aspect-ratio: auto;}
25
+ .aspect-square{aspect-ratio: 1/1;}
26
+ .aspect-video{aspect-ratio: 16/9;}
27
+ .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
28
+ .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
29
+ a{ pointer-events: none !important; }
30
+ [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
31
+ [contenteditable="true"] {
32
+ outline: none;
33
+ box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
34
+ -webkit-user-select: text;
35
+ -moz-user-select: text;
36
+ user-select: text;
37
+ }
38
+ .frame-root .frame-content { height: 100%; }
39
+ [data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
40
+ [data-dnd="no"] { pointer-events: none !important; }
41
+ </style>
42
+ <style id="hidden-blocks"></style>
43
+ <style id="selected-block"></style>
44
+ <style id="selected-styling-block"></style>
45
+ <style id="highlighted-block"></style>
46
+ <style id="dragged-block"></style>
47
+
48
+ </head>
49
+ <body class="font-body antialiased h-full">
50
+ <div class="frame-root h-full"></div>
51
+ <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
52
+ </body>
53
+ </html>`,we=o=>{const[s]=i.useCanvasWidth(),[,e]=i.useCanvasZoom(),[t,n]=h.useState({}),u=h.useCallback(()=>{const{width:a,height:l}=o;if(a<s){const p=parseFloat((a/s).toFixed(2).toString());let d={};const g=l*p;l&&(d={height:100+(l-g)/g*100+"%"}),n({position:"relative",top:0,transform:`scale(${p})`,transformOrigin:"top left",...d,maxWidth:"none"}),e(p*100)}else n({}),e(100)},[s,o,e]);return h.useEffect(()=>{u()},[s,o,e,u]),t};let Q,X;typeof document<"u"&&(Q=document);typeof window<"u"&&(X=window);const G=h.createContext({document:Q,window:X}),T=()=>h.useContext(G),{Provider:Se,Consumer:tt}=G;class J extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}I(J,"propTypes",{children:E.element.isRequired,contentDidMount:E.func.isRequired,contentDidUpdate:E.func.isRequired});class P extends h.Component{constructor(e,t){super(e,t);I(this,"setRef",e=>{this.nodeRef.current=e;const{forwardedRef:t}=this.props;typeof t=="function"?t(e):t&&(t.current=e)});I(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});I(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=h.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const e=this.getDoc();return this.props.mountTarget?e.querySelector(this.props.mountTarget):e.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const e=this.getDoc();if(!e)return null;const t=this.props.contentDidMount,n=this.props.contentDidUpdate,u=e.defaultView||e.parentView,a=r.jsxRuntimeExports.jsx(J,{contentDidMount:t,contentDidUpdate:n,children:r.jsxRuntimeExports.jsx(Se,{value:{document:e,window:u},children:r.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),l=this.getMountTarget();return[z.createPortal(this.props.head,this.getDoc().head),z.createPortal(a,l)]}render(){const e={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete e.head,delete e.initialContent,delete e.mountTarget,delete e.contentDidMount,delete e.contentDidUpdate,delete e.forwardedRef,r.jsxRuntimeExports.jsx("iframe",{...e,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}I(P,"propTypes",{style:E.object,head:E.node,initialContent:E.string,mountTarget:E.string,contentDidMount:E.func,contentDidUpdate:E.func,children:E.oneOfType([E.element,E.arrayOf(E.element)])}),I(P,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const Be=h.forwardRef((o,s)=>r.jsxRuntimeExports.jsx(P,{...o,forwardedRef:s}));function O(o){const s=window.getComputedStyle(o),e=s.display;if(e==="flex"){const t=s.flexDirection;return t==="column"||t==="column-reverse"?"vertical":"horizontal"}else if(e==="grid"){const t=s.gridAutoFlow,n=s.gridTemplateRows,u=s.gridTemplateColumns;return t.includes("column")||n.split(" ").length>u.split(" ").length?"vertical":"horizontal"}else if(e==="block"||e==="inline-block")return"vertical";return"horizontal"}let S=null,B=[],D=null,L=null;const Z=(o,s,e)=>{if(!S||!o)return;const t=S==null?void 0:S.getElementById("placeholder"),u=B.map(([l])=>l).reduce((l,p)=>Math.abs(p-e)<Math.abs(l-e)?p:l,0);if(!B[u])return;const a=B[u];t.style.width=s==="vertical"?a[2]+"px":"2px",t.style.height=s==="vertical"?"2px":a[2]+"px",t.style.display="block",s==="vertical"?(t.style.top=a[0]+"px",t.style.left=a[1]+"px"):(t.style.top=a[1]+"px",t.style.left=a[0]+"px")};function Ce(o,s){let e=0,t=1/0;return s.forEach((n,u)=>{const a=Math.abs(n[0]-o);a<t&&(t=a,e=u)}),e}const Ae=o=>{const e=O(o)==="horizontal";B=[],Array.from(o.children).forEach(t=>{if(t.classList.contains("pointer-events-none"))return;const n=e?t.offsetLeft:t.offsetTop,u=e?[t.offsetTop,t.clientHeight]:[t.offsetLeft,t.clientWidth];B.push([n,u[0],u[1]])})},Ie=c.throttle(o=>{const s=o.target,e=O(s);if(e==="vertical"){const t=o.clientY-s.offsetTop;Z(s,e,t)}else{const t=o.clientX-s.offsetLeft;Z(s,e,t)}},200);function F(){const o=S==null?void 0:S.getElementById("placeholder");o.style.display="none",De("pointer-none")}function De(o){document.querySelectorAll(`.${o}`).forEach(e=>{e.classList.remove(o)})}const _e=()=>{const{document:o}=T(),[s,e]=b.useAtom(i.draggingFlagAtom),{addCoreBlock:t}=i.useAddBlock(),[,n]=i.useHighlightBlockId(),[,u]=i.useSelectedBlockIds(),{moveBlocks:a}=i.useBlocksStoreUndoableActions(),[,l]=b.useAtom(i.draggedBlockIdAtom),[p,d]=b.useAtom(_.draggedBlockAtom),[,g]=b.useAtom(_.dropTargetAtom);return S=o,{isDragging:s,onDragOver:x=>{x.preventDefault(),x.stopPropagation(),Ie(x)},onDrop:x=>{D==null||D.classList.remove("drop-target");const m=D,$=O(m)==="vertical"?x.clientY:x.clientX;L=Ce($,B);const v=p,f=m.getAttribute("data-block-id");if(!c.has(v,"_id")){t(v,f==="canvas"?null:f,L),setTimeout(()=>{F()},300),B=[],e(!1),l(""),d(null),g(null);return}let k=m.getAttribute("data-block-id");k===null&&(k=x.target.parentElement.getAttribute("data-block-id")),a([v._id],k,L),F(),e(!1),l(""),setTimeout(()=>F(),300)},onDragEnter:x=>{const m=x,j=m.target;D=j;const $=j.getAttribute("data-block-id");g($),m.stopPropagation(),m.preventDefault(),B=[],Ae(j),j.classList.add("drop-target"),e(!0),n(""),u([])}}};function U(o){return o.getAttribute("data-block-id")?o:o.closest("[data-block-id]")}function Me(o){o.container.innerHTML="",o.container.parentNode.removeChild(o.container);var s=document.querySelector(".ql-toolbar");s&&s.parentNode.removeChild(s),o=null}const Ne=()=>{const o=["Heading","Paragraph","Text","Link","Span","Button"],s=i.useUpdateBlocksProps(),[,e]=i.useHighlightBlockId(),[t,n]=b.useAtom(i.inlineEditingActiveAtom);return u=>{var x;if(t)return;const a=U(u.target),l=a.getAttribute("data-block-type");if(!l||!o.includes(l))return;const p=a.cloneNode(!0);a.style.display="none",Array.from(p.attributes).forEach(m=>{m.name!=="class"&&p.removeAttribute(m.name)}),l==="Text"&&(p.style.display="inline-block"),a.parentNode.insertBefore(p,a.nextSibling);const d=new ie.Quill(p,{placeholder:"Type here..."});function g(){const m=d.getText(0,d.getLength());s([a.getAttribute("data-block-id")],{content:m}),a.removeAttribute("style"),p.removeEventListener("blur",g,!0),Me(d),n(""),e("")}p.addEventListener("blur",g,!0),p.addEventListener("keydown",m=>{(m.key==="Enter"||m.key==="Escape")&&g()}),d.focus(),(x=p.querySelector(".ql-clipboard"))==null||x.remove(),n(a.getAttribute("data-block-id"))}},Te=()=>{const[,o]=i.useSelectedStylingBlocks(),[s,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[n]=b.useAtom(i.inlineEditingActiveAtom),[u]=b.useAtom(i.treeRefAtom);return a=>{if(n)return;a.stopPropagation();const l=U(a.target);if(l!=null&&l.getAttribute("data-block-id")&&(l==null?void 0:l.getAttribute("data-block-id"))==="container"){e([]),o([]),t("");return}if(l!=null&&l.getAttribute("data-block-parent")){const p=l.getAttribute("data-style-prop"),d=l.getAttribute("data-style-id"),g=l.getAttribute("data-block-parent");s.includes(g)||u.closeAll(),o([{id:d,prop:p,blockId:g}]),e([g])}else if(l!=null&&l.getAttribute("data-block-id")){let p=l.getAttribute("data-block-id");s.includes(p)||u.closeAll(),e([p])}t("")}},qe=c.throttle((o,s)=>{const e=U(o.target);e!=null&&e.getAttribute("data-style-id")&&s(e.getAttribute("data-style-id"))},100),Le=()=>{const[,o]=i.useHighlightBlockId(),[s]=b.useAtom(i.inlineEditingActiveAtom);return e=>{s||qe(e,o)}},Fe=({children:o})=>{const{document:s}=T(),[e]=i.useSelectedBlockIds(),[t,n]=i.useSelectedStylingBlocks();h.useEffect(()=>{setTimeout(()=>{if(!c.isEmpty(t))return;const d=V(s,c.first(e));if(d){const g=d.getAttribute("data-style-prop");if(g){const x=d.getAttribute("data-style-id"),m=d.getAttribute("data-block-parent");n([{id:x,prop:g,blockId:m}])}}},100)},[s,e,n,t]);const u=Ne(),a=Te(),l=Le(),p=_e();return r.jsxRuntimeExports.jsx("div",{"data-block-id":"canvas",id:"canvas",onClick:a,onDoubleClick:u,onMouseMove:l,...c.omit(p,"isDragging"),className:"relative mb-5 h-full max-w-full "+(p.isDragging?"dragging":""),children:o})},V=(o,s)=>o.querySelector(`[data-block-id="${s}"]`),Pe=()=>{const{window:o}=T(),[s,e]=i.useSelectedBlockIds(),[t]=i.useBlocksStore(),[,n]=i.useSelectedStylingBlocks(),{undo:u,redo:a}=i.useUndoManager(),l=i.useDuplicateBlocks(),[,p]=i.usePreviewMode(),d=i.useRemoveBlocks(),{savePage:g}=i.useSavePage(),[x]=b.useAtom(i.inlineEditingActiveAtom),[,m]=b.useAtom(i.editLayerNameAtom),j=v=>{v.key==="Enter"&&(v.preventDefault(),s.length===1&&m(c.first(s)))},$=v=>{const f=t.find(k=>k._id===v);return f?f._parent:null};return h.useEffect(()=>{const v=f=>{if(f.key==="Escape"){e([]),n([]);return}if(j(f),!x&&(f.key==="Delete"||f.key==="Backspace")&&(f.preventDefault(),d(s)),f.ctrlKey||f.metaKey){if(f.key==="ArrowUp"){f.preventDefault();const k=s.length>0?$(s[0]):null;k&&e([k])}if(["z","y","d","x","c","p","s","v"].includes(f.key)){if(x&&["x","z","v"].includes(f.key))return!0;f.preventDefault()}f.key==="s"&&(f.stopPropagation(),f.preventDefault(),g()),f.key==="z"&&u(),f.key==="y"&&a(),f.key==="d"&&l(s)}};return o.removeEventListener("keydown",v),o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v)}},[s,e,u,d,p,a,l,x,g,o]),null},He=({block:o,label:s})=>{const[,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[,n]=b.useAtom(_.draggedBlockAtom),u=ae.useFeature("dnd");return r.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:u?"true":"false",onDragStart:a=>{a.dataTransfer.setData("text/plain",JSON.stringify(c.pick(o,["_id","_type","_name"]))),n(o),setTimeout(()=>{e([]),t(null)},200)},children:[r.jsxRuntimeExports.jsx(R.DragHandleDots2Icon,{}),s]})},Oe=({selectedBlockElement:o,block:s})=>{const e=i.useRemoveBlocks(),t=i.useDuplicateBlocks(),[,n]=i.useSelectedBlockIds(),[,u]=i.useSelectedStylingBlocks(),[a]=b.useAtom(i.inlineEditingActiveAtom),{floatingStyles:l,refs:p,update:d}=W.useFloating({placement:"top-start",middleware:[W.shift(),le.flip()],elements:{reference:o}});ce.useResizeObserver(o,()=>d(),o!==null);const g=c.get(s,"_parent",null),x=c.isEmpty(c.get(s,"_name",""))?c.get(s,"_type",""):c.get(s,"_name","");return!o||!s||a?null:r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:r.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:p.setFloating,style:l,onClick:m=>{m.stopPropagation(),m.preventDefault()},onKeyDown:m=>m.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[r.jsxRuntimeExports.jsx(He,{label:x,block:s}),r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[g&&r.jsxRuntimeExports.jsx(R.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{u([]),n([g])}}),i.canDuplicateBlock(c.get(s,"_type",""))?r.jsxRuntimeExports.jsx(R.CopyIcon,{className:"hover:scale-105",onClick:()=>t([s==null?void 0:s._id])}):null,i.canDeleteBlock(c.get(s,"_type",""))?r.jsxRuntimeExports.jsx(R.TrashIcon,{className:"hover:scale-105",onClick:()=>e([s==null?void 0:s._id])}):null]})]})})},Ue=({addVariant:o,e:s})=>{o("hs-dropdown-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open > .${s(`hs-dropdown-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open .hs-dropdown-toggle .${s(`hs-dropdown-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open > .hs-dropdown-menu > .${s(`hs-dropdown-open${t}${n}`)}`)}]),o("hs-removing",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-removing.${s(`hs-removing${t}${n}`)}`)}),o("hs-tooltip-shown",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-tooltip.show .${s(`hs-tooltip-shown${t}${n}`)}`)}),o("hs-accordion-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active.${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-toggle .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-toggle.${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${s(`hs-accordion-active${t}${n}`)}`)}]),o("hs-accordion-selected",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion .selected.${s(`hs-accordion-selected${t}${n}`)}`)}),o("hs-collapse-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse.open .${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse.open.${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse-toggle.open .${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse-toggle.open.${s(`hs-collapse-open${t}${n}`)}`)}]),o("hs-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`[data-hs-tab].active.${s(`hs-tab-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`[data-hs-tab].active .${s(`hs-tab-active${t}${n}`)}`)}]),o("hs-overlay-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.open.${s(`hs-overlay-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.open .${s(`hs-overlay-open${t}${n}`)}`)}]),o("hs-overlay-layout-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-body-open.${s(`hs-overlay-layout-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-body-open .${s(`hs-overlay-layout-open${t}${n}`)}`)}]),o("hs-overlay-backdrop-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-backdrop.${s(`hs-overlay-backdrop-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-backdrop .${s(`hs-overlay-backdrop-open${t}${n}`)}`)}]),o("hs-scrollspy-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-scrollspy-active${t}${n}`)}`)}),o("hs-carousel-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-carousel-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-carousel-active${t}${n}`)}`)}]),o("hs-carousel-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-carousel${t}disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-carousel${t}disabled${t}${n}`)}`)}]),o("hs-selected",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected.${s(`hs-selected${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected .${s(`hs-selected${t}${n}`)}`)}]),o("hs-select-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-select-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-select-disabled${t}${n}`)}`)}]),o("hs-select-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-select-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-select-active${t}${n}`)}`)}]),o("hs-input-number-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-input-number-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-input-number-disabled${t}${n}`)}`)}]),o("hs-pin-input-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-pin-input-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-pin-input-active${t}${n}`)}`)}]),o("hs-select-opened",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.opened.${s(`hs-select-opened${t}${n}`)}`)}]),o("hs-password-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-password-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-password-active${t}${n}`)}`)}]),o("hs-stepper-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-stepper-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-stepper-active${t}${n}`)}`)}]),o("hs-stepper-success",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success.${s(`hs-stepper-success${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success .${s(`hs-stepper-success${t}${n}`)}`)}]),o("hs-stepper-completed",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.completed.${s(`hs-stepper-completed${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.completed .${s(`hs-stepper-completed${t}${n}`)}`)}]),o("hs-stepper-error",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error.${s(`hs-stepper-error${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error .${s(`hs-stepper-error${t}${n}`)}`)}]),o("hs-stepper-processed",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.processed.${s(`hs-stepper-processed${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.processed .${s(`hs-stepper-processed${t}${n}`)}`)}]),o("hs-stepper-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-stepper-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-stepper-disabled${t}${n}`)}`)}]),o("hs-stepper-skipped",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.skipped.${s(`hs-stepper-skipped${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.skipped .${s(`hs-stepper-skipped${t}${n}`)}`)}]),o("hs-strong-password",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.passed.${s(`hs-strong-password${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.passed .${s(`hs-strong-password${t}${n}`)}`)}]),o("hs-strong-password-accepted",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.accepted.${s(`hs-strong-password-accepted${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.accepted .${s(`hs-strong-password-accepted${t}${n}`)}`)}]),o("hs-strong-password-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-strong-password-active${t}${n}`)}`)}]),o("hs-combo-box-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-combo-box-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-combo-box-active${t}${n}`)}`)}]),o("hs-combo-box-selected",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected .${s(`hs-combo-box-selected${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected.${s(`hs-combo-box-selected${t}${n}`)}`)}]),o("hs-combo-box-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-combo-box-tab-active${t}${n}`)}`)}]),o("hs-apexcharts-tooltip-dark",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.dark.${s(`hs-apexcharts-tooltip-dark${t}${n}`)}`)}]),o("hs-success",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success .${s(`hs-success${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success.${s(`hs-success${t}${n}`)}`)}]),o("hs-error",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error .${s(`hs-error${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error.${s(`hs-error${t}${n}`)}`)}]),o("hs-default-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.default .${s(`hs-default-mode-active${t}${n}`)}`)}),o("hs-dark-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.dark .${s(`hs-dark-mode-active${t}${n}`)}`)}),o("hs-auto-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.auto .${s(`hs-auto-mode-active${t}${n}`)}`)})},ze=({model:o})=>{const[s]=i.useBrandingOptions(),[e]=i.useSelectedBlockIds(),[t]=i.useDarkMode(),[n]=i.useHighlightBlockId(),[u]=i.useSelectedStylingBlocks(),[a]=b.useAtom(i.draggedBlockIdAtom),{document:l,window:p}=T(),[d]=h.useState(l==null?void 0:l.getElementById("highlighted-block")),[g]=h.useState(l==null?void 0:l.getElementById("selected-block")),[x]=h.useState(l==null?void 0:l.getElementById("selected-styling-block")),[m]=h.useState(l==null?void 0:l.getElementById("dragged-block"));h.useEffect(()=>{t?l==null||l.documentElement.classList.add("dark"):l==null||l.documentElement.classList.remove("dark")},[t,l]);const j=c.get(s,"headingFont","DM Sans"),$=c.get(s,"bodyFont","DM Sans");return h.useEffect(()=>{const v=c.get(s,"primaryColor","#000"),f=c.get(s,"secondaryColor","#FFF"),k=he([{color:v,name:"primary"},{color:f,name:"secondary"}]),w=c.get(s,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{extend:{fontFamily:{heading:[j],body:[$]},borderRadius:{global:`${w||"0"}px`},colors:k}},plugins:[de,ue,pe,p.tailwind.plugin.withOptions(()=>Ue)]})},[s,p,j,$]),h.useEffect(()=>{g&&(g.textContent=`${c.map(e,v=>`[data-block-id="${v}"]`).join(",")}{
54
+ outline: 1px solid ${e.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
55
+ }`)},[e,g]),h.useEffect(()=>{if(!a){m.textContent="";return}m.textContent=`[data-block-id="${a}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[a]),h.useEffect(()=>{d&&(d.textContent=n?`[data-style-id="${n}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[n,e,d]),h.useEffect(()=>{x&&(x.textContent=`${c.map(u,({id:v})=>`[data-style-id="${v}"]`).join(",")}{
56
+ outline: 1px solid #42a1fc !important; outline-offset: -1px;
57
+ }`)},[u,x]),h.useEffect(()=>{const v=c.get(s,"bodyTextLightColor","#64748b"),f=c.get(s,"bodyTextDarkColor","#94a3b8"),k=c.get(s,"bodyBgLightColor","#FFFFFF"),w=c.get(s,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${v}] bg-[${k}] dark:text-[${f}] dark:bg-[${w}]`},[s,l,o]),o==="page"?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[j&&r.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${j.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),$&&j!==$&&r.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${$.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),j&&r.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${j}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},We=o=>{const s={};return Object.keys(o).forEach(e=>{c.isString(o[e])&&o[e].startsWith(M.SLOT_KEY)&&(s[e]=o[e].replace(M.SLOT_KEY,"").split(","))}),s},Ke=c.memoize(o=>{const s=o.replace(M.STYLES_KEY,"").split(",");return xe.twMerge(s[0],s[1])});function Ye(o,s){return c.get(o,`${s}_attrs`,{})}function Ze(o){const s={};return Object.keys(o).forEach(e=>{if(c.isString(o[e])&&o[e].startsWith(M.STYLES_KEY)){const t=Ke(o[e]);s[e]={className:t,"data-style-prop":e,"data-block-parent":o._id,"data-style-id":`${e}-${o._id}`,...Ye(o,e)}}}),s}function Qe(o,s){const e=c.get(o,"_bindings",{});return c.isEmpty(e)?{...o}:(c.each(e,(t,n)=>{c.isString(t)&&c.get(s,t,null)&&(o[n]=c.get(s,t,null))}),o)}function H({blocks:o}){const[s]=i.useBlocksStore(),[e]=b.useAtom(_.draggedBlockAtom),[t]=b.useAtom(_.dropTargetAtom),[n]=ge.useCanvasSettings(),u=h.useCallback(d=>Ze(d),[]),[a]=i.useChaiExternalData(),[l]=b.useAtom(i.inlineEditingActiveAtom),p=h.useCallback(d=>d.reduce((g,x)=>{const m=c.get(n,x,{});return{...g,...m}},{}),[n,s]);return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:h.Children.toArray(o.map((d,g)=>{if(l===d._id)return null;const x=We(d),m={};c.isEmpty(x)||Object.keys(x).forEach(w=>{m[w]=h.Children.toArray(x[w].map(q=>r.jsxRuntimeExports.jsx(H,{blocks:[c.find(s,{_id:q})]})))});const j=c.filter(s,{_parent:d._id});m.children=j.length?r.jsxRuntimeExports.jsx(H,{blocks:j}):null;const $=me.getBlockComponent(d._type),v=c.get($,"builderComponent",c.get($,"component",null));if(c.isNull(v))return r.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${d==null?void 0:d._type} not registered -->`});const f=c.has($,"getBlockStateFrom")?$==null?void 0:$.getBlockStateFrom(d,s):[],k=p(f);return r.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(v,{blockProps:{"data-block-id":d._id,"data-block-type":d._type,...e?{"data-dnd":i.canAcceptChildBlock(d._type,e==null?void 0:e._type)?"yes":"no"}:{},...t===d._id?{"data-drop":"yes"}:{}},index:g,...Qe(d,a),...u(d),...m,inBuilder:!0,blockState:k})})}))})}const Xe=()=>{const[o]=i.useBlocksStore(),s=c.isEmpty(o)?null:r.jsxRuntimeExports.jsx(i.BlocksExternalDataProvider,{children:r.jsxRuntimeExports.jsx(H,{blocks:c.filter(o,e=>c.isEmpty(e._parent))})});return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:s})},Ge=(o,s)=>o.querySelector(`[data-style-id="${s}"]`),Je=()=>{const[o]=b.useAtom(i.networkModeAtom),[s]=i.usePreviewMode(),[e]=i.useCanvasWidth(),[,t]=i.useSelectedBlockIds(),n=i.useSelectedBlock(),[,u]=i.useHighlightBlockId(),a=h.useRef(null),l=h.useRef(null),[p,d]=h.useState({width:0,height:0}),g=we(p),[x,m]=h.useState(0),[j,$]=h.useState([]),[,v]=h.useState([]),[,f]=b.useAtom(i.canvasIframeAtom),[k,w]=i.useSelectedStylingBlocks(),q=i.useBuilderProp("loading",!1),ee=i.useBuilderProp("htmlDir","ltr");h.useEffect(()=>{const{clientWidth:y,clientHeight:C}=l.current;d({width:y,height:C}),x===0&&m(y)},[l,e,x]);const te=(y,C=0)=>{const{top:A}=y.getBoundingClientRect();return A+C>=0&&A-C<=window.innerHeight};h.useEffect(()=>{var y,C;if(n&&n.type!=="Multiple"&&a.current){const A=V(a.current.contentDocument,n._id);A&&(te(A)||(C=(y=a.current)==null?void 0:y.contentWindow)==null||C.scrollTo({top:A.offsetTop,behavior:"smooth"}),$([A]))}},[n]),h.useEffect(()=>{if(!c.isEmpty(k)&&a.current){const y=Ge(a.current.contentDocument,c.first(k).id);v(y?[y]:[null])}else v([null])},[k]);const se=h.useMemo(()=>{let y=Re;return y=y.replace("__HTML_DIR__",ee),o==="offline"&&(y=y.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),y=y.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),y=y.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),y},[o]);return r.jsxRuntimeExports.jsx("div",{onClick:()=>{t([]),w([])},onMouseLeave:()=>setTimeout(()=>u(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:x>0&&!c.isEmpty(g)?{width:s?"100%":x}:{},ref:l,children:r.jsxRuntimeExports.jsxs(Be,{contentDidMount:()=>f(a.current),ref:a,id:"canvas-iframe",style:{width:`${e}px`,...g},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:se,children:[r.jsxRuntimeExports.jsx(Pe,{}),r.jsxRuntimeExports.jsx(Oe,{block:n,selectedBlockElement:c.first(j)}),r.jsxRuntimeExports.jsx(ze,{model:"page"}),r.jsxRuntimeExports.jsx(fe.Provider,{children:r.jsxRuntimeExports.jsx(Fe,{children:q?r.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):r.jsxRuntimeExports.jsx(Xe,{})})}),r.jsxRuntimeExports.jsx("br",{}),r.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},Ve=()=>r.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[r.jsxRuntimeExports.jsx(Ee,{}),r.jsxRuntimeExports.jsx("div",{className:"relative h-full overflow-hidden bg-slate-800/90 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px] px-2",children:r.jsxRuntimeExports.jsx(h.Suspense,{fallback:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"}),children:r.jsxRuntimeExports.jsx(i.ErrorBoundary,{children:r.jsxRuntimeExports.jsx(Je,{})})})})]});exports.default=Ve;