@chaibuilder/sdk 1.2.56 → 1.2.57

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 (94) hide show
  1. package/dist/{AddBlocks-HeYXoex4.js → AddBlocks-05ZH2Suu.js} +46 -50
  2. package/dist/AddBlocks-MH_fqSRf.cjs +1 -0
  3. package/dist/{CanvasArea-CqILE5PR.js → CanvasArea-8f_Ki3B7.js} +361 -361
  4. package/dist/CanvasArea-UisRL54b.cjs +56 -0
  5. package/dist/CodeEditor-vECReGwz.cjs +1 -0
  6. package/dist/{CodeEditor-kxV5RCpd.js → CodeEditor-zYBqhBv3.js} +33 -39
  7. package/dist/CurrentPage-7aEIhzQ0.cjs +1 -0
  8. package/dist/{CurrentPage-IrFGAb7n.js → CurrentPage-nzo4lszx.js} +26 -25
  9. package/dist/ListTree-A-097CZ-.cjs +1 -0
  10. package/dist/{ListTree-0n_G8NJx.js → ListTree-KUGhFsb_.js} +9 -13
  11. package/dist/PagesPanel-L1mI3y_6.cjs +1 -0
  12. package/dist/{PagesPanel-RYBf0Yct.js → PagesPanel-hleqqZBo.js} +20 -19
  13. package/dist/ProjectPanel-HTxa1kHv.cjs +1 -0
  14. package/dist/{ProjectPanel-Zagx6l3Q.js → ProjectPanel-RXEhYr0a.js} +25 -24
  15. package/dist/Settings-7EMwx6zL.cjs +1 -0
  16. package/dist/{Settings-RLDTFFf8.js → Settings-b1ZuIn4y.js} +404 -395
  17. package/dist/{SidePanels-ao969pMV.js → SidePanels-6hZeCR5Z.js} +89 -88
  18. package/dist/SidePanels-_6WlMWq_.cjs +1 -0
  19. package/dist/ThemeConfiguration-PvMN3j6h.cjs +1 -0
  20. package/dist/{ThemeConfiguration-S7yArRMp.js → ThemeConfiguration-ab7lbA2y.js} +18 -24
  21. package/dist/Topbar-WdGZIIZp.cjs +1 -0
  22. package/dist/{Topbar-B8u0whpc.js → Topbar-YfsC1DZ2.js} +39 -38
  23. package/dist/{UILibrariesPanel-tcfz2ELp.js → UILibrariesPanel-5QxxXYg2.js} +56 -61
  24. package/dist/UILibrariesPanel-r8nQzXQ-.cjs +1 -0
  25. package/dist/{UnsplashImages-wWRifkCp.js → UnsplashImages-alt_doTy.js} +42 -47
  26. package/dist/UnsplashImages-cah1BRL_.cjs +1 -0
  27. package/dist/UploadImages-5dRETWCo.cjs +1 -0
  28. package/dist/{UploadImages-lUvZhW_j.js → UploadImages-JqVL_aQd.js} +32 -38
  29. package/dist/{add-page-modal-04b4l2zu.js → add-page-modal-CtMwNEsW.js} +29 -28
  30. package/dist/add-page-modal-DA5P4pVu.cjs +1 -0
  31. package/dist/{confirm-alert-FX5030eR.js → confirm-alert-m85JJlQi.js} +15 -21
  32. package/dist/confirm-alert-rYsxlfR4.cjs +1 -0
  33. package/dist/core.cjs +1 -1
  34. package/dist/core.js +44 -43
  35. package/dist/delete-page-modal-AvUZI9Tk.cjs +1 -0
  36. package/dist/{delete-page-modal-1u9CyAIP.js → delete-page-modal-TMpN1Dvm.js} +22 -21
  37. package/dist/email.cjs +1 -1
  38. package/dist/email.js +19 -19
  39. package/dist/form-G3PqS2Gc.cjs +1 -0
  40. package/dist/{form-HRdEJjVq.js → form-MSL4CDff.js} +3 -3
  41. package/dist/{html-to-json-OnIZDDXw.js → html-to-json-_01DXd-a.js} +37 -36
  42. package/dist/html-to-json-ndxaXRT8.cjs +1 -0
  43. package/dist/{index-vfmO3y2d.js → index--hN9ZQsP.js} +19 -19
  44. package/dist/index-0FIxW0gR.cjs +1 -0
  45. package/dist/{ChaiBuilderEditor-tkzS851D.js → index-IgLSTkN6.js} +14660 -17763
  46. package/dist/index-sspgZwTk.cjs +206 -0
  47. package/dist/index-uLn8W3eR.js +3145 -0
  48. package/dist/index-zaKhyTQ6.cjs +1 -0
  49. package/dist/lib.cjs +2 -2
  50. package/dist/lib.js +17 -16
  51. package/dist/page-viewer-2BMSxxfd.cjs +1 -0
  52. package/dist/{page-viewer-dcb3u4OV.js → page-viewer-D8nsi13f.js} +27 -26
  53. package/dist/project-general-setting--0hX9Otn.cjs +1 -0
  54. package/dist/{project-general-setting--sS34seu.js → project-general-setting-HGjTNFRx.js} +23 -22
  55. package/dist/{project-seo-setting-8tc3I-0M.js → project-seo-setting-3kFJ77jY.js} +20 -26
  56. package/dist/project-seo-setting-C3ilIIeM.cjs +1 -0
  57. package/dist/render.cjs +1 -1
  58. package/dist/render.js +104 -102
  59. package/dist/single-page-detail-7BpYAyMO.cjs +1 -0
  60. package/dist/{single-page-detail-tP2pfgBp.js → single-page-detail-eMnjt_Ih.js} +26 -25
  61. package/dist/studio.cjs +1 -1
  62. package/dist/studio.js +19 -18
  63. package/dist/ui.cjs +1 -1
  64. package/dist/ui.js +144 -150
  65. package/dist/web-blocks.cjs +1 -1
  66. package/dist/web-blocks.js +164 -107
  67. package/package.json +1 -1
  68. package/dist/AddBlocks-VHoZezjj.cjs +0 -1
  69. package/dist/CanvasArea-137WY3Wx.cjs +0 -56
  70. package/dist/ChaiBuilderEditor-aY8flOgX.cjs +0 -206
  71. package/dist/CodeEditor-R2jKe97T.cjs +0 -1
  72. package/dist/CurrentPage-PjrVzHXR.cjs +0 -1
  73. package/dist/ListTree-C6oCXZDV.cjs +0 -1
  74. package/dist/PagesPanel-lIC3kYmS.cjs +0 -1
  75. package/dist/ProjectPanel-0Siyi5YS.cjs +0 -1
  76. package/dist/Settings-6QRVcl16.cjs +0 -1
  77. package/dist/SidePanels-j1EFsBlK.cjs +0 -1
  78. package/dist/ThemeConfiguration-q1471P7b.cjs +0 -1
  79. package/dist/Topbar-ogFKKDbx.cjs +0 -1
  80. package/dist/UILibrariesPanel-cm9CFWxc.cjs +0 -1
  81. package/dist/UnsplashImages-E2L3YDJI.cjs +0 -1
  82. package/dist/UploadImages-s-eeaGiS.cjs +0 -1
  83. package/dist/add-page-modal-eroF20lO.cjs +0 -1
  84. package/dist/confirm-alert-XuxEzG-V.cjs +0 -1
  85. package/dist/delete-page-modal-pgh7sdfg.cjs +0 -1
  86. package/dist/form-Z4IRWj0o.cjs +0 -1
  87. package/dist/html-to-json-rauxDBi6.cjs +0 -1
  88. package/dist/index-bt7EhwLh.cjs +0 -1
  89. package/dist/page-viewer-O960kM2x.cjs +0 -1
  90. package/dist/project-general-setting-lIvNs-Vq.cjs +0 -1
  91. package/dist/project-seo-setting-MIlAuqcc.cjs +0 -1
  92. package/dist/single-page-detail-0Z_hvd_j.cjs +0 -1
  93. package/dist/useCanvasSettings-R0h03UfD.cjs +0 -1
  94. package/dist/useCanvasSettings-rEZHbw3s.js +0 -6
@@ -0,0 +1,56 @@
1
+ "use strict";var oe=Object.defineProperty;var re=(o,s,e)=>s in o?oe(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;var _=(o,s,e)=>(re(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("./index-0FIxW0gR.cjs"),F=require("./index-sspgZwTk.cjs"),W=require("react-i18next"),b=require("jotai"),ie=require("lucide-react"),G=require("react-dom"),w=require("prop-types"),le=require("react-quill"),q=require("./atoms-a0H_593V.cjs"),ce=require("@floating-ui/dom"),X=require("@floating-ui/react-dom"),ae=require("@react-hookz/web"),de=require("flagged"),ue=require("@tailwindcss/typography"),pe=require("@tailwindcss/forms"),he=require("@tailwindcss/aspect-ratio"),xe=require("tailwindcss-palette-generator"),me=require("tailwind-merge"),L=require("./MODIFIERS-mVmfEGgo.cjs"),ge=require("@chaibuilder/runtime"),fe=require("react-wrap-balancer"),ve=require("re-resizable");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("clsx");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-scroll-area");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("./Functions-N3yhPYKY.cjs");require("tree-model");require("i18next");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");const je=()=>{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 ye(){const[o,s]=i.useDarkMode();return r.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.jsxRuntimeExports.jsx(R.SunIcon,{className:"size-4 shrink-0"}),r.jsxRuntimeExports.jsx(i.Switch,{id:"dark-mode-switch",checked:o,onCheckedChange:()=>{s(!o)},className:`${o?"bg-violet-600":"bg-violet-300"} 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",{"aria-hidden":"true",className:`${o?"translate-x-5":"translate-x-0"} 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`})}),r.jsxRuntimeExports.jsx(F.FaMoon,{className:"size-4 ml-3 shrink-0"})]})}const Z=({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(Z,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:r.jsxRuntimeExports.jsx(Z,{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}],Q=({title:o,content:s,currentBreakpoint:e,breakpoint:t,width:n,icon:u,onClick:a})=>{const{t:l}=W.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)})]})})})]})},be=()=>{const[,o,s]=i.useCanvasWidth(),[e,t]=i.useSelectedBreakpoints(),{t:n}=W.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(Q,{...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(Q,{...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))]})]})]})},ke=()=>{const{t:o}=W.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")})]})]})]})})},Ee=()=>{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(ie.SparklesIcon,{className:"w-4"}),"AI Assistant"]}),r.jsxRuntimeExports.jsx(i.Switch,{className:"scale-90",checked:o,onCheckedChange:t=>{s(t)},id:"ai-assitantt"})]}):null},Re=()=>{const o=i.useBuilderProp("darkMode",!0),[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:[r.jsxRuntimeExports.jsx(be,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),o?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(ye,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"})]}):null,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(je,{})]}),r.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[r.jsxRuntimeExports.jsx(ke,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(Ee,{})]})]})},we=`<!doctype html>
2
+ <html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
7
+ <style>
8
+ html { height: 100%; overflow:auto; }
9
+ body { height: 100%; }
10
+ .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
11
+ .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
12
+ body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
13
+ -moz-user-select: none;-ms-user-select: none; user-select: none; }
14
+ html{
15
+ -ms-overflow-style: none; /* IE and Edge */
16
+ scrollbar-width: none; /* Firefox */
17
+ }
18
+ /** IMPORTANT: Make fields content editable in SAFARI */
19
+ [contenteditable] {-webkit-user-select: text;user-select: text;}
20
+
21
+ html::-webkit-scrollbar { width: 0 !important }
22
+ .aspect-auto{aspect-ratio: auto;}
23
+ .aspect-square{aspect-ratio: 1/1;}
24
+ .aspect-video{aspect-ratio: 16/9;}
25
+ .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
26
+ .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
27
+ a{ pointer-events: none !important; }
28
+ [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
29
+ [contenteditable="true"] {
30
+ outline: none;
31
+ box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
32
+ -webkit-user-select: text;
33
+ -moz-user-select: text;
34
+ user-select: text;
35
+ }
36
+ .frame-root .frame-content { height: 100%; }
37
+ [data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
38
+ [data-dnd="yes"] { pointer-events: auto !important}
39
+ [data-dnd="no"] { pointer-events: none !important; }
40
+ </style>
41
+ <style id="hidden-blocks"></style>
42
+ <style id="selected-block"></style>
43
+ <style id="selected-styling-block"></style>
44
+ <style id="highlighted-block"></style>
45
+ <style id="dragged-block"></style>
46
+
47
+ </head>
48
+ <body class="font-body antialiased h-full">
49
+ <div class="frame-root h-full"></div>
50
+ <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
51
+ </body>
52
+ </html>`,Se=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 f={};const d=l*p;l&&(f={height:100+(l-d)/d*100+"%"}),n({position:"relative",top:0,transform:`scale(${p})`,transformOrigin:"top left",...f,maxWidth:"none"}),e(p*100)}else n({}),e(100)},[s,o,e]);return h.useEffect(()=>{u()},[s,o,e,u]),t};let V,ee;typeof document<"u"&&(V=document);typeof window<"u"&&(ee=window);const te=h.createContext({document:V,window:ee}),P=()=>h.useContext(te),{Provider:Be,Consumer:rt}=te;class se extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}_(se,"propTypes",{children:w.element.isRequired,contentDidMount:w.func.isRequired,contentDidUpdate:w.func.isRequired});class z extends h.Component{constructor(e,t){super(e,t);_(this,"setRef",e=>{this.nodeRef.current=e;const{forwardedRef:t}=this.props;typeof t=="function"?t(e):t&&(t.current=e)});_(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});_(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(se,{contentDidMount:t,contentDidUpdate:n,children:r.jsxRuntimeExports.jsx(Be,{value:{document:e,window:u},children:r.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),l=this.getMountTarget();return[G.createPortal(this.props.head,this.getDoc().head),G.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()})}}_(z,"propTypes",{style:w.object,head:w.node,initialContent:w.string,mountTarget:w.string,contentDidMount:w.func,contentDidUpdate:w.func,children:w.oneOfType([w.element,w.arrayOf(w.element)])}),_(z,"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 Ae=h.forwardRef((o,s)=>r.jsxRuntimeExports.jsx(z,{...o,forwardedRef:s}));function K(o){const s=window.getComputedStyle(o),e=s.display;if(e==="flex"||e==="inline-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 $=null,S=[],N=null,H=null;const J=(o,s,e)=>{if(!$||!o)return;const t=$==null?void 0:$.getElementById("placeholder"),n=S.map(([p])=>p),u=n.reduce((p,f)=>Math.abs(f-e)<Math.abs(p-e)?f:p,0),a=n.indexOf(u);if(!S[a])return;const l=S[a];t.style.width=s==="vertical"?l[2]+"px":"2px",t.style.height=s==="vertical"?"2px":l[2]+"px",t.style.display="block",s==="vertical"?(t.style.top=l[0]+"px",t.style.left=l[1]+"px"):(t.style.top=l[1]+"px",t.style.left=l[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 Ie=o=>{const e=K(o)==="horizontal";S=[],Array.from(o.children).forEach((t,n)=>{if(t.classList.contains("pointer-events-none"))return;const u=e?t.offsetLeft:t.offsetTop,a=e?[t.offsetTop,t.clientHeight]:[t.offsetLeft,t.clientWidth];if(S.push([u,a[0],a[1]]),n===o.children.length-1){const l=e?t.offsetLeft+t.clientWidth:t.offsetTop+t.clientHeight;S.push([l,a[0],a[1]])}})},_e=c.throttle(o=>{var n;const s=o.target,e=K(s),t=(n=$==null?void 0:$.defaultView)==null?void 0:n.scrollY;e==="vertical"?J(s,e,o.clientY+t):J(s,e,o.clientX)},0);function O(){const o=$==null?void 0:$.getElementById("placeholder");o.style.display="none",De("pointer-none"),Me()}function De(o){($==null?void 0:$.querySelectorAll(`.${o}`)).forEach(e=>{e.classList.remove(o)})}function Me(){const o=$==null?void 0:$.querySelector('[data-drop="yes"]');o&&o.removeAttribute("data-drop")}const Te=()=>{const{document:o}=P(),[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,f]=b.useAtom(q.draggedBlockAtom),[,d]=b.useAtom(q.dropTargetAtom);return $=o,{isDragging:s,onDragOver:m=>{m.preventDefault(),m.stopPropagation(),_e(m)},onDrop:m=>{var B;N==null||N.classList.remove("drop-target");const x=N,E=K(x)==="vertical"?m.clientY+((B=$==null?void 0:$.defaultView)==null?void 0:B.scrollY):m.clientX;H=Ce(E,S);const v=p,g=x.getAttribute("data-block-id");if(!c.has(v,"_id")){t(v,g==="canvas"?null:g,H),setTimeout(()=>{O()},300),S=[],e(!1),l(""),f(null),d(null);return}let k=x.getAttribute("data-block-id");k===null&&(k=m.target.parentElement.getAttribute("data-block-id")),a([v._id],k,H),O(),e(!1),l(""),S=[],setTimeout(()=>O(),300)},onDragEnter:m=>{const x=m,j=x.target;N=j;const E=j.getAttribute("data-block-id");d(E),x.stopPropagation(),x.preventDefault(),S=[],Ie(j),console.log(S,m.clientY,$.defaultView.scrollY),j.classList.add("drop-target"),e(!0),n(""),u([])}}};function Y(o){return o.getAttribute("data-block-id")?o:o.closest("[data-block-id]")}function Ne(o){o.container.innerHTML="",o.container.parentNode.removeChild(o.container);var s=document.querySelector(".ql-toolbar");s&&s.parentNode.removeChild(s),o=null}const qe=()=>{const o=["Heading","Paragraph","Text","Link","Span","Button"],s=i.useUpdateBlocksProps(),[,e]=i.useHighlightBlockId(),[t,n]=b.useAtom(i.inlineEditingActiveAtom);return u=>{var m;if(t)return;const a=Y(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(x=>{x.name!=="class"&&p.removeAttribute(x.name)}),l==="Text"&&(p.style.display="inline-block"),a.parentNode.insertBefore(p,a.nextSibling);const f=new le.Quill(p,{placeholder:"Type here..."});function d(){const x=f.getText(0,f.getLength());s([a.getAttribute("data-block-id")],{content:x}),a.removeAttribute("style"),p.removeEventListener("blur",d,!0),Ne(f),n(""),e("")}p.addEventListener("blur",d,!0),p.addEventListener("keydown",x=>{(x.key==="Enter"||x.key==="Escape")&&d()}),f.focus(),(m=p.querySelector(".ql-clipboard"))==null||m.remove(),n(a.getAttribute("data-block-id"))}},Le=()=>{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=Y(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"),f=l.getAttribute("data-style-id"),d=l.getAttribute("data-block-parent");s.includes(d)||u==null||u.closeAll(),o([{id:f,prop:p,blockId:d}]),e([d])}else if(l!=null&&l.getAttribute("data-block-id")){let p=l.getAttribute("data-block-id");s.includes(p)||u==null||u.closeAll(),e([p])}t("")}},Fe=c.throttle((o,s)=>{const e=Y(o.target);e!=null&&e.getAttribute("data-style-id")&&s(e.getAttribute("data-style-id"))},100),Pe=()=>{const[,o]=i.useHighlightBlockId(),[s]=b.useAtom(i.inlineEditingActiveAtom);return e=>{s||Fe(e,o)}},He=({children:o})=>{const{document:s}=P(),[e]=i.useSelectedBlockIds(),[t,n]=i.useSelectedStylingBlocks();h.useEffect(()=>{setTimeout(()=>{if(!c.isEmpty(t))return;const f=ne(s,c.first(e));if(f){const d=f.getAttribute("data-style-prop");if(d){const m=f.getAttribute("data-style-id"),x=f.getAttribute("data-block-parent");n([{id:m,prop:d,blockId:x}])}}},100)},[s,e,n,t]);const u=qe(),a=Le(),l=Pe(),p=Te();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})},ne=(o,s)=>o.querySelector(`[data-block-id="${s}"]`),Oe=()=>{const{window:o}=P(),[s,e]=i.useSelectedBlockIds(),[t]=i.useBlocksStore(),[,n]=i.useSelectedStylingBlocks(),{undo:u,redo:a}=i.useUndoManager(),l=i.useDuplicateBlocks(),[,p]=i.usePreviewMode(),f=i.useRemoveBlocks(),{savePage:d}=i.useSavePage(),[m]=b.useAtom(i.inlineEditingActiveAtom),[,x]=b.useAtom(i.editLayerNameAtom),j=v=>{v.key==="Enter"&&(v.preventDefault(),s.length===1&&x(c.first(s)))},E=v=>{const g=t.find(k=>k._id===v);return g?g._parent:null};return h.useEffect(()=>{const v=g=>{if(g.key==="Escape"){e([]),n([]);return}if(j(g),!m&&(g.key==="Delete"||g.key==="Backspace")&&(g.preventDefault(),f(s)),g.ctrlKey||g.metaKey){if(g.key==="ArrowUp"){g.preventDefault();const k=s.length>0?E(s[0]):null;k&&e([k])}if(["z","y","d","x","c","p","s","v"].includes(g.key)){if(m&&["x","z","v"].includes(g.key))return!0;g.preventDefault()}g.key==="s"&&(g.stopPropagation(),g.preventDefault(),d()),g.key==="z"&&u(),g.key==="y"&&a(),g.key==="d"&&l(s)}};return o.removeEventListener("keydown",v),o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v)}},[s,e,u,f,p,a,l,m,d,o]),null},ze=({block:o,label:s})=>{const[,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[,n]=b.useAtom(q.draggedBlockAtom),u=de.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]})},Ue=({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:f}=X.useFloating({placement:"top-start",middleware:[X.shift(),ce.flip()],elements:{reference:o}});ae.useResizeObserver(o,()=>f(),o!==null);const d=c.get(s,"_parent",null),m=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:x=>{x.stopPropagation(),x.preventDefault()},onKeyDown:x=>x.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[r.jsxRuntimeExports.jsx(ze,{label:m,block:s}),r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[d&&r.jsxRuntimeExports.jsx(R.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{u([]),n([d])}}),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]})]})})},We=({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}`)}`)})},Ke=({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}=P(),[f]=h.useState(l==null?void 0:l.getElementById("highlighted-block")),[d]=h.useState(l==null?void 0:l.getElementById("selected-block")),[m]=h.useState(l==null?void 0:l.getElementById("selected-styling-block")),[x]=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"),E=c.get(s,"bodyFont","DM Sans");return h.useEffect(()=>{const v=c.get(s,"primaryColor","#000"),g=c.get(s,"secondaryColor","#FFF"),k=c.get(s,"bodyBgLightColor","#fff"),B=c.get(s,"bodyBgDarkColor","#000"),A=c.get(s,"bodyTextDarkColor","#000"),M=c.get(s,"bodyTextLightColor","#fff"),D=xe([{color:v,name:"primary"},{color:g,name:"secondary"}]),T={"bg-light":k,"bg-dark":B,"text-dark":A,"text-light":M},y=c.get(s,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},fontFamily:{heading:[j],body:[E]},borderRadius:{DEFAULT:`${y||"0"}px`},colors:{...T,...D}}},plugins:[ue,pe,he,p.tailwind.plugin.withOptions(()=>We)]})},[s,p,j,E]),h.useEffect(()=>{d&&(d.textContent=`${c.map(e,v=>`[data-block-id="${v}"]`).join(",")}{
53
+ outline: 1px solid ${e.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
54
+ }`)},[e,d]),h.useEffect(()=>{if(!a){x.textContent="";return}x.textContent=`[data-block-id="${a}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[a]),h.useEffect(()=>{f&&(f.textContent=n?`[data-style-id="${n}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[n,e,f]),h.useEffect(()=>{m&&(m.textContent=`${c.map(u,({id:v})=>`[data-style-id="${v}"]`).join(",")}{
55
+ outline: 1px solid #42a1fc !important; outline-offset: -1px;
56
+ }`)},[u,m]),h.useEffect(()=>{const v=c.get(s,"bodyTextLightColor","#64748b"),g=c.get(s,"bodyTextDarkColor","#94a3b8"),k=c.get(s,"bodyBgLightColor","#FFFFFF"),B=c.get(s,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${v}] bg-[${k}] dark:text-[${g}] dark:bg-[${B}]`},[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"}),E&&j!==E&&r.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${E.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},Ye=()=>b.useAtom(i.canvasSettingsAtom),Ge=o=>{const s={};return Object.keys(o).forEach(e=>{c.isString(o[e])&&o[e].startsWith(L.SLOT_KEY)&&(s[e]=o[e].replace(L.SLOT_KEY,"").split(","))}),s},Xe=c.memoize(o=>{const s=o.replace(L.STYLES_KEY,"").split(",");return me.twMerge(s[0],s[1])});function Ze(o,s){return c.get(o,`${s}_attrs`,{})}function Qe(o){const s={};return Object.keys(o).forEach(e=>{if(c.isString(o[e])&&o[e].startsWith(L.STYLES_KEY)){const t=Xe(o[e]);s.__key=e,s[e]={className:t,"data-style-prop":e,"data-block-parent":o._id,"data-style-id":`${e}-${o._id}`,...Ze(o,e)}}}),s}function Je(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 U({blocks:o}){const[s]=i.useBlocksStore(),[e]=b.useAtom(i.xShowBlocksAtom),[t]=b.useAtom(q.draggedBlockAtom),[n]=b.useAtom(q.dropTargetAtom),[u]=Ye(),a=h.useCallback(d=>Qe(d),[]),[l]=F.useChaiExternalData(),[p]=b.useAtom(i.inlineEditingActiveAtom),f=h.useCallback(d=>d.reduce((m,x)=>{const j=c.get(u,x,{});return{...m,...j}},{}),[u,s]);return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:h.Children.toArray(o.map((d,m)=>{if(p===d._id)return null;const x=Ge(d),j={};c.isEmpty(x)||Object.keys(x).forEach(D=>{j[D]=h.Children.toArray(x[D].map(T=>r.jsxRuntimeExports.jsx(U,{blocks:[c.find(s,{_id:T})]})))});const E=c.filter(s,{_parent:d._id});j.children=E.length?r.jsxRuntimeExports.jsx(U,{blocks:E}):null;const v=ge.getBlockComponent(d._type),g=c.get(v,"builderComponent",c.get(v,"component",null));if(c.isNull(g))return r.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${d==null?void 0:d._type} not registered -->`});const k=c.has(v,"getBlockStateFrom")?v==null?void 0:v.getBlockStateFrom(d,s):[],B=f(k),A=a(d),M=c.get(A,"__key","styles");return c.has(A,M+".x-show")&&!c.includes(e,d._id)?null:r.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(g,{blockProps:{"data-block-id":d._id,"data-block-type":d._type,...t?{"data-dnd":i.canAcceptChildBlock(d._type,t==null?void 0:t._type)?"yes":"no"}:{},...n===d._id?{"data-drop":"yes"}:{}},index:m,...Je(d,l),...c.omit(A,["__key"]),...j,inBuilder:!0,blockState:B})})}))})}const Ve=()=>{const[o]=i.useBlocksStore(),s=c.isEmpty(o)?null:r.jsxRuntimeExports.jsx(F.BlocksExternalDataProvider,{children:r.jsxRuntimeExports.jsx(U,{blocks:c.filter(o,e=>c.isEmpty(e._parent))})});return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:s})},et=(o,s)=>o.querySelector(`[data-style-id="${s}"]`),tt=()=>{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,f]=h.useState({width:0,height:0}),d=Se(p),[m,x]=h.useState(0),[j,E]=h.useState([]),[,v]=h.useState([]),[,g]=b.useAtom(i.canvasIframeAtom),[k,B]=i.useSelectedStylingBlocks(),A=i.useBuilderProp("loading",!1),M=i.useBuilderProp("htmlDir","ltr");h.useEffect(()=>{const{clientWidth:y,clientHeight:C}=l.current;f({width:y,height:C}),m===0&&x(y)},[l,e,m]);const D=(y,C=0)=>{const{top:I}=y.getBoundingClientRect();return I+C>=0&&I-C<=window.innerHeight};h.useEffect(()=>{var y,C;if(n&&n.type!=="Multiple"&&a.current){const I=ne(a.current.contentDocument,n._id);I&&(D(I)||(C=(y=a.current)==null?void 0:y.contentWindow)==null||C.scrollTo({top:I.offsetTop,behavior:"smooth"}),E([I]))}},[n]),h.useEffect(()=>{if(!c.isEmpty(k)&&a.current){const y=et(a.current.contentDocument,c.first(k).id);v(y?[y]:[null])}else v([null])},[k]);const T=h.useMemo(()=>{let y=we;return y=y.replace("__HTML_DIR__",M),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([]),B([])},onMouseLeave:()=>setTimeout(()=>u(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:m>0&&!c.isEmpty(d)?{width:s?"100%":m}:{},ref:l,children:r.jsxRuntimeExports.jsxs(Ae,{contentDidMount:()=>g(a.current),ref:a,id:"canvas-iframe",style:{width:`${e}px`,...d},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:T,children:[r.jsxRuntimeExports.jsx(Oe,{}),r.jsxRuntimeExports.jsx(Ue,{block:n,selectedBlockElement:c.first(j)}),r.jsxRuntimeExports.jsx(Ke,{model:"page"}),r.jsxRuntimeExports.jsx(fe.Provider,{children:r.jsxRuntimeExports.jsx(He,{children:A?r.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):r.jsxRuntimeExports.jsx(Ve,{})})}),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"})]})})},st=h.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-vECReGwz.cjs"))),nt=()=>{const[o]=i.useCodeEditor();return r.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[r.jsxRuntimeExports.jsx(Re,{}),r.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col 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(F.ErrorBoundary,{children:r.jsxRuntimeExports.jsx(tt,{})})}),o?r.jsxRuntimeExports.jsx(h.Suspense,{fallback:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"}),children:r.jsxRuntimeExports.jsx(ve.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:r.jsxRuntimeExports.jsx(st,{})})}):null]})]})};exports.default=nt;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),b=require("@monaco-editor/react"),i=require("./index-0FIxW0gR.cjs"),k=require("react-i18next"),n=require("react"),C=require("@radix-ui/react-icons"),E=require("@react-hookz/web");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");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-scroll-area");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-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("tree-model");const a=u=>{const s=document.createElement("div");return s.innerHTML=u,s.innerHTML};function R(){const{t:u}=k.useTranslation(),[s,d]=n.useState(!1),[l,x]=n.useState(""),[r,o]=i.useCodeEditor(),[c]=i.useSelectedBlockIds(),q=i.useUpdateBlocksProps(),m=i.useUpdateBlocksPropsRealtime(),p=E.useThrottledCallback(t=>{const h=a(t);m([r.blockId],{[r.blockProp]:h})},[],300),j=n.useCallback(()=>{if(s){const t=a(l);q([r.blockId],{[r.blockProp]:t})}},[s,l]);n.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(j(),o(null))},[c]);const f=()=>{o(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:[e.jsxRuntimeExports.jsx("button",{onClick:f,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:u("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:u("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>o(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(C.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(b,{onMount:t=>{t.setValue(r.initialCode)},onChange:t=>{d(!0),x(t),p(t)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})]})}exports.default=R;
@@ -1,33 +1,25 @@
1
1
  import { j as t } from "./jsx-runtime-WbnYoNE9.js";
2
2
  import k from "@monaco-editor/react";
3
- import { i as C, L as j, Q as v, R as g, B as y } from "./ChaiBuilderEditor-tkzS851D.js";
3
+ import { $ as C, r as j, am as v, an as g, B as y } from "./index-uLn8W3eR.js";
4
4
  import { useTranslation as N } from "react-i18next";
5
- import { useState as n, useCallback as T, useEffect as E } from "react";
5
+ import { useState as a, useCallback as T, useEffect as E } from "react";
6
6
  import { Cross2Icon as w } from "@radix-ui/react-icons";
7
7
  import { useThrottledCallback as B } from "@react-hookz/web";
8
8
  import "./_commonjsHelpers-UyOWmZb0.js";
9
- import "clsx";
10
- import "react-dom";
11
- import "@radix-ui/react-scroll-area";
12
- import "@floating-ui/react-dom";
13
- import "jotai";
14
- import "i18next";
15
- import "flagged";
9
+ import "@radix-ui/react-toggle";
10
+ import "class-variance-authority";
11
+ import "./utils-VpVqnC9m.js";
16
12
  import "lodash-es";
17
13
  import "./MODIFIERS-fd5XOmum.js";
18
- import "./Functions-7jnEwJyw.js";
14
+ import "clsx";
19
15
  import "tailwind-merge";
20
- import "@chaibuilder/runtime";
21
- import "tree-model";
22
- import "./utils-VpVqnC9m.js";
23
- import "@radix-ui/react-toggle";
24
- import "class-variance-authority";
25
16
  import "@radix-ui/react-switch";
26
17
  import "@radix-ui/react-slot";
27
18
  import "@radix-ui/react-accordion";
28
19
  import "@radix-ui/react-alert-dialog";
29
20
  import "@radix-ui/react-dialog";
30
21
  import "@radix-ui/react-label";
22
+ import "@radix-ui/react-scroll-area";
31
23
  import "@radix-ui/react-tabs";
32
24
  import "@radix-ui/react-tooltip";
33
25
  import "@radix-ui/react-popover";
@@ -40,46 +32,48 @@ import "@radix-ui/react-toast";
40
32
  import "cmdk";
41
33
  import "@radix-ui/react-context-menu";
42
34
  import "react-icons-picker";
35
+ import "react-dom";
43
36
  import "react-quill";
44
- import "react-hotkeys-hook";
45
- import "lucide-react";
46
- import "./index-VBXQixVm.js";
47
- const a = (r) => {
37
+ import "./Functions-7jnEwJyw.js";
38
+ import "@chaibuilder/runtime";
39
+ import "jotai";
40
+ import "tree-model";
41
+ const n = (s) => {
48
42
  const i = document.createElement("div");
49
- return i.innerHTML = r, i.innerHTML;
43
+ return i.innerHTML = s, i.innerHTML;
50
44
  };
51
- function vt() {
52
- const { t: r } = N(), [i, p] = n(!1), [m, c] = n(""), [o, s] = C(), [l] = j(), d = v(), u = g(), f = B(
53
- (e) => {
54
- const b = a(e);
55
- u([o.blockId], { [o.blockProp]: b });
45
+ function xt() {
46
+ const { t: s } = N(), [i, p] = a(!1), [l, c] = a(""), [e, r] = C(), [m] = j(), d = v(), u = g(), f = B(
47
+ (o) => {
48
+ const b = n(o);
49
+ u([e.blockId], { [e.blockProp]: b });
56
50
  },
57
51
  [],
58
52
  300
59
53
  ), x = T(() => {
60
54
  if (i) {
61
- const e = a(m);
62
- d([o.blockId], { [o.blockProp]: e });
55
+ const o = n(l);
56
+ d([e.blockId], { [e.blockProp]: o });
63
57
  }
64
- }, [i, m]);
58
+ }, [i, l]);
65
59
  E(() => {
66
- l.includes(o == null ? void 0 : o.blockId) || (x(), s(null));
67
- }, [l]);
60
+ m.includes(e == null ? void 0 : e.blockId) || (x(), r(null));
61
+ }, [m]);
68
62
  const h = () => {
69
- s(null);
63
+ r(null);
70
64
  };
71
65
  return /* @__PURE__ */ t.jsxs("div", { className: "h-full rounded-t-lg border-t-4 border-black bg-black text-white", children: [
72
66
  /* @__PURE__ */ t.jsx("button", { onClick: h, className: "fixed inset-0 z-[100000] cursor-default bg-gray-400/20" }),
73
67
  /* @__PURE__ */ t.jsxs("div", { className: "relative z-[100001] h-full w-full flex-col gap-y-1", children: [
74
68
  /* @__PURE__ */ t.jsxs("div", { className: "-mt-1 flex items-center justify-between px-2 py-2", children: [
75
69
  /* @__PURE__ */ t.jsxs("h3", { className: "space-x-3 text-sm font-semibold", children: [
76
- /* @__PURE__ */ t.jsx("span", { children: r("HTML Code Editor |") }),
77
- /* @__PURE__ */ t.jsx("span", { className: "text-xs text-gray-400", children: r("Scripts will be only executed in preview and live mode.") })
70
+ /* @__PURE__ */ t.jsx("span", { children: s("HTML Code Editor |") }),
71
+ /* @__PURE__ */ t.jsx("span", { className: "text-xs text-gray-400", children: s("Scripts will be only executed in preview and live mode.") })
78
72
  ] }),
79
73
  /* @__PURE__ */ t.jsx("div", { className: "flex gap-x-2", children: /* @__PURE__ */ t.jsx(
80
74
  y,
81
75
  {
82
- onClick: () => s(null),
76
+ onClick: () => r(null),
83
77
  size: "sm",
84
78
  variant: "destructive",
85
79
  className: "h-6 w-fit",
@@ -90,11 +84,11 @@ function vt() {
90
84
  /* @__PURE__ */ t.jsx(
91
85
  k,
92
86
  {
93
- onMount: (e) => {
94
- e.setValue(o.initialCode);
87
+ onMount: (o) => {
88
+ o.setValue(e.initialCode);
95
89
  },
96
- onChange: (e) => {
97
- p(!0), c(e), f(e);
90
+ onChange: (o) => {
91
+ p(!0), c(o), f(o);
98
92
  },
99
93
  height: "100%",
100
94
  defaultLanguage: "html",
@@ -111,5 +105,5 @@ function vt() {
111
105
  ] });
112
106
  }
113
107
  export {
114
- vt as default
108
+ xt as default
115
109
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),s=require("./index-0FIxW0gR.cjs"),i=require("lodash-es"),j=require("sonner"),l=require("react"),o=require("./index-zaKhyTQ6.cjs"),p=require("lucide-react"),f=require("react-i18next");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");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-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("./index-sspgZwTk.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");const E=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{saveState:d}=s.useSavePage(),m=o.useChangePage(),{t:q}=f.useTranslation(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const g=r=>{if(d!=="SAVED")j.toast.error(q("You have unsaved changes. Please save before changing the page."));else{const h=i.find(c,{uuid:r});m(h)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 py-1 pr-0 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(p.BriefcaseIcon,{className:"mr-2 h-4 w-4"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=E;
@@ -1,28 +1,18 @@
1
1
  import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import { V as h, a6 as f, a7 as j, a8 as y, a9 as v, aa as P } from "./ChaiBuilderEditor-tkzS851D.js";
3
- import { sortBy as b, filter as w, get as C, isEmpty as m, find as n, capitalize as N, map as S } from "lodash-es";
2
+ import { Q as h, az as f, aA as j, aB as y, aC as v, aD as P } from "./index-uLn8W3eR.js";
3
+ import { sortBy as C, filter as b, get as w, isEmpty as m, find as n, capitalize as N, map as S } from "lodash-es";
4
4
  import { toast as k } from "sonner";
5
5
  import { useEffect as p } from "react";
6
- import { a as B, u as E, c as T, d as V } from "./index-vfmO3y2d.js";
7
- import { BriefcaseIcon as I } from "lucide-react";
8
- import { useTranslation as L } from "react-i18next";
6
+ import { a as B, u as E, c as T, d as z } from "./index--hN9ZQsP.js";
7
+ import { BriefcaseIcon as A } from "lucide-react";
8
+ import { useTranslation as D } from "react-i18next";
9
9
  import "./_commonjsHelpers-UyOWmZb0.js";
10
- import "clsx";
11
- import "react-dom";
12
- import "@radix-ui/react-scroll-area";
13
- import "@floating-ui/react-dom";
14
- import "jotai";
15
- import "i18next";
16
- import "flagged";
17
- import "./MODIFIERS-fd5XOmum.js";
18
- import "./Functions-7jnEwJyw.js";
19
- import "tailwind-merge";
20
- import "@chaibuilder/runtime";
21
- import "@react-hookz/web";
22
- import "tree-model";
23
- import "./utils-VpVqnC9m.js";
24
10
  import "@radix-ui/react-toggle";
25
11
  import "class-variance-authority";
12
+ import "./utils-VpVqnC9m.js";
13
+ import "./MODIFIERS-fd5XOmum.js";
14
+ import "clsx";
15
+ import "tailwind-merge";
26
16
  import "@radix-ui/react-switch";
27
17
  import "@radix-ui/react-slot";
28
18
  import "@radix-ui/react-accordion";
@@ -30,6 +20,7 @@ import "@radix-ui/react-icons";
30
20
  import "@radix-ui/react-alert-dialog";
31
21
  import "@radix-ui/react-dialog";
32
22
  import "@radix-ui/react-label";
23
+ import "@radix-ui/react-scroll-area";
33
24
  import "@radix-ui/react-tabs";
34
25
  import "@radix-ui/react-tooltip";
35
26
  import "@radix-ui/react-popover";
@@ -42,14 +33,24 @@ import "@radix-ui/react-toast";
42
33
  import "cmdk";
43
34
  import "@radix-ui/react-context-menu";
44
35
  import "react-icons-picker";
36
+ import "react-dom";
45
37
  import "react-quill";
38
+ import "./Functions-7jnEwJyw.js";
39
+ import "@chaibuilder/runtime";
40
+ import "jotai";
41
+ import "@react-hookz/web";
42
+ import "tree-model";
43
+ import "./index-IgLSTkN6.js";
44
+ import "i18next";
45
+ import "@floating-ui/react-dom";
46
+ import "flagged";
46
47
  import "react-hotkeys-hook";
47
48
  import "./index-VBXQixVm.js";
48
- import "./core.js";
49
- import "./html-to-json-OnIZDDXw.js";
49
+ import "./html-to-json-_01DXd-a.js";
50
50
  import "himalaya";
51
- const Te = () => {
52
- const { data: t } = B(), { data: i, isLoading: l } = E(), { saveState: c } = h(), d = T(), { t: u } = L(), [a, o] = V(), s = b(w(i, { type: "STATIC" }), (r) => C(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
51
+ import "lodash";
52
+ const ze = () => {
53
+ const { data: t } = B(), { data: i, isLoading: l } = E(), { saveState: c } = h(), d = T(), { t: u } = D(), [a, o] = z(), s = C(b(i, { type: "STATIC" }), (r) => w(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
53
54
  p(() => {
54
55
  !m(i) && t.homepage && !n(i, { uuid: a }) && o(t.homepage);
55
56
  }, [a, i, t, o]), p(() => () => o(null), [o]);
@@ -68,7 +69,7 @@ const Te = () => {
68
69
  "aria-label": "Breadcrumb",
69
70
  children: /* @__PURE__ */ e.jsxs("ol", { className: "inline-flex items-center space-x-1 md:space-x-3", children: [
70
71
  /* @__PURE__ */ e.jsx("li", { className: "inline-flex items-center", children: /* @__PURE__ */ e.jsxs("div", { className: "inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400", children: [
71
- /* @__PURE__ */ e.jsx(I, { className: "mr-2 h-4 w-4" }),
72
+ /* @__PURE__ */ e.jsx(A, { className: "mr-2 h-4 w-4" }),
72
73
  N(t.name)
73
74
  ] }) }),
74
75
  /* @__PURE__ */ e.jsx("li", { "aria-current": "page", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
@@ -102,5 +103,5 @@ const Te = () => {
102
103
  );
103
104
  };
104
105
  export {
105
- Te as default
106
+ ze as default
106
107
  };