@chaibuilder/sdk 1.2.30 → 1.2.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CanvasArea-e829y1ts.cjs → CanvasArea-AP2VxTme.cjs} +4 -4
- package/dist/{CanvasArea-3D9rpjpk.js → CanvasArea-AgZG60eK.js} +67 -67
- package/dist/{CurrentPage-5xKDQqvg.cjs → CurrentPage-lBwqlXua.cjs} +1 -1
- package/dist/{CurrentPage-VbdmddMv.js → CurrentPage-urEDcMfR.js} +2 -2
- package/dist/{PagesPanel-_VzJ1__k.js → PagesPanel-C3yfpE0O.js} +3 -3
- package/dist/{PagesPanel-wex1zGzm.cjs → PagesPanel-QAb3JjVO.cjs} +1 -1
- package/dist/{ProjectPanel-rPNO2QsE.js → ProjectPanel--8xzmpgT.js} +3 -3
- package/dist/{ProjectPanel-N6iWd_4Z.cjs → ProjectPanel-DJHfHFni.cjs} +1 -1
- package/dist/{Settings-mlh0i_1M.cjs → Settings-alHeC0FS.cjs} +1 -1
- package/dist/{Settings-jTl7IOPc.js → Settings-oMxnykls.js} +1 -1
- package/dist/{SidePanels-jYJEFpxC.js → SidePanels-TuKVMKxP.js} +1 -1
- package/dist/{SidePanels-mx5TyZBn.cjs → SidePanels-znlH133C.cjs} +1 -1
- package/dist/{add-page-modal-v5smARyL.cjs → add-page-modal-PhWtC-ZY.cjs} +1 -1
- package/dist/{add-page-modal-o1euqbsp.js → add-page-modal-Q3c1EOw1.js} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/defaultTheme-9e2np_iI.cjs +1 -0
- package/dist/{defaultTheme-D8B4-wHO.js → defaultTheme-ocvEtKQ3.js} +14 -5
- package/dist/{delete-page-modal-QzRkBAct.js → delete-page-modal-9B7603s-.js} +2 -2
- package/dist/{delete-page-modal-DNjqQuop.cjs → delete-page-modal-eh0Afqbu.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{index-5c_rU-9B.cjs → index-B1EMostm.cjs} +1 -1
- package/dist/{index-SEJRE2ab.js → index-FVtnWx9d.js} +1 -1
- package/dist/{index-DtBYhldP.js → index-TXu6kBv9.js} +2 -2
- package/dist/{index-DHwvjZ5z.cjs → index-tFX6mX_R.cjs} +1 -1
- package/dist/lib.cjs +3 -3
- package/dist/lib.d.ts +2 -0
- package/dist/lib.js +83 -81
- package/dist/{page-viewer-1vswRGpL.js → page-viewer-3UIfb9p1.js} +3 -3
- package/dist/{page-viewer-87wtE0pN.cjs → page-viewer-wVQGkDJd.cjs} +1 -1
- package/dist/{project-general-setting-SE9QJ6mF.js → project-general-setting-8vqXfr75.js} +2 -2
- package/dist/{project-general-setting-RSG7ZQSx.cjs → project-general-setting-LrABWutT.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +2 -0
- package/dist/render.js +76 -74
- package/dist/{single-page-detail-8Arndzmw.cjs → single-page-detail-76C_iDiS.cjs} +1 -1
- package/dist/{single-page-detail-bels-Cjo.js → single-page-detail-py5_WxGu.js} +3 -3
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/tailwind.cjs +1 -1
- package/dist/tailwind.d.ts +37 -0
- package/dist/tailwind.js +102 -11
- package/package.json +2 -2
- package/dist/defaultTheme-7VqqhOcp.cjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var ne=Object.defineProperty;var oe=(o,n,e)=>n in o?ne(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e;var C=(o,n,e)=>(oe(o,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),h=require("react"),a=require("lodash-es"),k=require("@radix-ui/react-icons"),i=require("./index-12HbDLon.cjs"),
|
|
1
|
+
"use strict";var ne=Object.defineProperty;var oe=(o,n,e)=>n in o?ne(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e;var C=(o,n,e)=>(oe(o,typeof n!="symbol"?n+"":n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),h=require("react"),a=require("lodash-es"),k=require("@radix-ui/react-icons"),i=require("./index-12HbDLon.cjs"),M=require("react-i18next"),E=require("jotai"),H=require("react-dom"),b=require("prop-types"),re=require("react-quill"),K=require("flagged"),ie=require("@floating-ui/dom"),O=require("@floating-ui/react-dom"),le=require("@react-hookz/web"),ce=require("tailwindcss-palette-generator"),ae=require("@tailwindcss/typography"),de=require("@tailwindcss/forms"),ue=require("@tailwindcss/aspect-ratio"),pe=require("react-wrap-balancer"),he=require("tailwind-merge"),_=require("./STRINGS-gPz7CUOk.cjs"),xe=require("@chaibuilder/runtime"),P=require("./index-tFX6mX_R.cjs"),me=require("./useCanvasSettings-MR0Glu1b.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("./MODIFIERS-YPHRtwrM.cjs");require("./Class-Zc8hpE7f.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-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("i18next");require("react-hotkeys-hook");const ge=()=>{const{hasUndo:o,hasRedo:n,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(k.ResetIcon,{})}),r.jsxRuntimeExports.jsx(i.Button,{disabled:!n(),onClick:t,size:"sm",className:"rounded-full",variant:"ghost",children:r.jsxRuntimeExports.jsx(k.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function fe(){const[o,n]=i.useDarkMode(),{t:e}=M.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:()=>{n(!o)},className:`${o?"bg-violet-600":"bg-violet-300"}
|
|
2
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 U=({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"}})]}),ve=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:r.jsxRuntimeExports.jsx(k.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:r.jsxRuntimeExports.jsx(k.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:r.jsxRuntimeExports.jsx(U,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:r.jsxRuntimeExports.jsx(U,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:r.jsxRuntimeExports.jsx(k.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:r.jsxRuntimeExports.jsx(k.DesktopIcon,{}),width:1920}],z=({title:o,content:n,currentBreakpoint:e,breakpoint:t,width:s,icon:p,onClick:c})=>{const{t:l}=
|
|
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 U=({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"}})]}),ve=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:r.jsxRuntimeExports.jsx(k.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:r.jsxRuntimeExports.jsx(k.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:r.jsxRuntimeExports.jsx(U,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:r.jsxRuntimeExports.jsx(U,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:r.jsxRuntimeExports.jsx(k.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:r.jsxRuntimeExports.jsx(k.DesktopIcon,{}),width:1920}],z=({title:o,content:n,currentBreakpoint:e,breakpoint:t,width:s,icon:p,onClick:c})=>{const{t:l}=M.useTranslation();return r.jsxRuntimeExports.jsxs(i.HoverCard,{children:[r.jsxRuntimeExports.jsx(i.HoverCardTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsx(i.Button,{onClick:()=>c(s),size:"sm",variant:t===e?"secondary":"ghost",children:p})}),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(n)})]})})})]})},$e=()=>{const[,o,n]=i.useCanvasWidth(),[e,t]=i.useSelectedBreakpoints(),{t:s}=M.useTranslation(),p=i.useBuilderProp("breakpoints",ve),c=l=>{e.includes(l)?e.length>2&&t(e.filter(d=>d!==l)):t(d=>[...d,l])};return p.length<4?r.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:a.map(p,l=>h.createElement(z,{...l,onClick:n,key:l.breakpoint,currentBreakpoint:o}))}):r.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[a.map(p.filter(l=>a.includes(e,a.toUpper(l.breakpoint))),l=>h.createElement(z,{...l,onClick:n,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(k.DotsVerticalIcon,{className:"scale-90 transform"})})}),r.jsxRuntimeExports.jsxs(i.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[r.jsxRuntimeExports.jsx(i.DropdownMenuLabel,{children:s("Breakpoints")}),r.jsxRuntimeExports.jsx(i.DropdownMenuSeparator,{}),a.map(p,l=>r.jsxRuntimeExports.jsx(i.DropdownMenuCheckboxItem,{disabled:l.breakpoint==="xs",onCheckedChange:()=>c(a.toUpper(l.breakpoint)),checked:a.includes(e,a.toUpper(l.breakpoint)),children:s(l.title)},l.breakpoint))]})]})]})},je=()=>{const{t:o}=M.useTranslation(),{setNewBlocks:n}=i.useBlocksStoreUndoableActions(),[,e]=i.useSelectedBlockIds(),[,t]=i.useSelectedStylingBlocks(),s=h.useCallback(()=>{n([]),e([]),t([])},[n]);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(k.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:s,children:o("yes")})]})]})]})})},ye=()=>{const o=i.useBuilderProp("darkMode",!1),[n]=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(fe,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"})]}):null,r.jsxRuntimeExports.jsx($e,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[r.jsxRuntimeExports.jsx(k.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",r.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[a.round(n,0),"%"]})]}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(ge,{})]}),r.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(je,{})]})]})},be=`<!doctype html>
|
|
4
4
|
<html class="scroll-smooth h-full overflow-y-auto">
|
|
5
5
|
<head>
|
|
6
6
|
<meta charset="UTF-8">
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
<div class="frame-root h-full"></div>
|
|
49
49
|
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
50
50
|
</body>
|
|
51
|
-
</html>`,ke=o=>{const[n]=i.useCanvasWidth(),[,e]=i.useCanvasZoom(),[t,s]=h.useState({}),p=h.useCallback(()=>{const{width:c,height:l}=o;if(c<n){const d=parseFloat((c/n).toFixed(2).toString());let u={};const x=l*d;l&&(u={height:100+(l-x)/x*100+"%"}),s({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...u,maxWidth:"none"}),e(d*100)}else s({}),e(100)},[n,o,e]);return h.useEffect(()=>{p()},[n,o,e,p]),t};let Y,Z;typeof document<"u"&&(Y=document);typeof window<"u"&&(Z=window);const G=h.createContext({document:Y,window:Z}),M=()=>h.useContext(G),{Provider:Ee,Consumer:Ve}=G;class Q extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}C(Q,"propTypes",{children:b.element.isRequired,contentDidMount:b.func.isRequired,contentDidUpdate:b.func.isRequired});class q extends h.Component{constructor(e,t){super(e,t);C(this,"setRef",e=>{this.nodeRef.current=e;const{forwardedRef:t}=this.props;typeof t=="function"?t(e):t&&(t.current=e)});C(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});C(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,s=this.props.contentDidUpdate,p=e.defaultView||e.parentView,c=r.jsxRuntimeExports.jsx(Q,{contentDidMount:t,contentDidUpdate:s,children:r.jsxRuntimeExports.jsx(Ee,{value:{document:e,window:p},children:r.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),l=this.getMountTarget();return[H.createPortal(this.props.head,this.getDoc().head),H.createPortal(c,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()})}}C(q,"propTypes",{style:b.object,head:b.node,initialContent:b.string,mountTarget:b.string,contentDidMount:b.func,contentDidUpdate:b.func,children:b.oneOfType([b.element,b.arrayOf(b.element)])}),C(q,"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 we=h.forwardRef((o,n)=>r.jsxRuntimeExports.jsx(q,{...o,forwardedRef:n})),Re=()=>{const{addCoreBlock:o}=i.useAddBlock(),n=i.useBuilderProp("getExternalPredefinedBlock",a.noop);return h.useCallback(async e=>{const{block:t,dropTargetId:s,relativeIndex:p}=e;if(a.has(t,"format")){const c=await n(t);return o({blocks:c},s===0?null:s,p)}return o(t,s===0?null:s,p)},[o])};let R=null,A=[],D=null,J=null;function Se(o){const n=window.getComputedStyle(o),e=parseInt(n.paddingLeft,10),t=parseInt(n.paddingTop,10),s=parseInt(n.paddingRight,10),p=parseInt(n.paddingBottom,10);return{paddingLeft:e,paddingTop:t,paddingRight:s,paddingBottom:p}}const W=(o,n,e)=>{if(!R)return;const t=o.getBoundingClientRect(),s=R==null?void 0:R.getElementById("placeholder"),{paddingLeft:p,paddingTop:c,paddingRight:l,paddingBottom:d}=Se(o);s.style.width=n==="vertical"?t.width-p-l+"px":"2px",s.style.height=n==="vertical"?"2px":t.height-c-d+"px",s.style.display="block";const u=A.reduce((x,f)=>Math.abs(f-e)<Math.abs(x-e)?f:x);J=A.indexOf(u),n==="vertical"?(s.style.top=o.offsetTop+u+"px",s.style.left=o.offsetLeft+p+"px"):(s.style.top=o.offsetTop+c+"px",s.style.left=o.offsetLeft+u+"px")},Be=o=>{const n=X(o),e=window.getComputedStyle(o),t=n==="horizontal",s=parseInt(e.paddingLeft),p=parseInt(e.paddingTop);let c=t?s:p;A=[c],Array.from(o.children).forEach(l=>{const d=window.getComputedStyle(l),u=parseInt(t?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),x=t?l.offsetWidth:l.offsetHeight;A.push(c+x+u),c+=x+u})};function X(o){const n=window.getComputedStyle(o).display,e=window.getComputedStyle(o).flexDirection;if(n==="flex")return e==="column"||e==="column-reverse"?"vertical":"horizontal";if(n==="grid"){const t=window.getComputedStyle(o).gridTemplateRows,s=window.getComputedStyle(o).gridTemplateColumns;if(t.includes("auto"))return"vertical";if(s.includes("auto"))return"horizontal"}return n==="block"?"vertical":"horizontal"}const Ce=a.throttle(o=>{const n=o.target,e=X(n);if(e==="vertical"){const t=o.clientY-n.offsetTop;W(n,e,t)}else{const t=o.clientX-n.offsetLeft;W(n,e,t)}},200),Ie=o=>{o.preventDefault(),o.stopPropagation(),Ce(o)};function N(){const o=R==null?void 0:R.getElementById("placeholder");o.style.display="none"}const De=()=>{const{document:o}=M(),[n,e]=E.useAtom(i.draggingFlagAtom),t=Re(),s=K.useFeature("dnd"),[,p]=i.useHighlightBlockId(),[,c]=i.useSelectedBlockIds();return R=o,{isDragging:n,"data-dnd":"branch",onDragOver:s?Ie:a.noop,onDrop:s?l=>{D==null||D.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(l.dataTransfer.getData("text/plain"));let u=l.target.getAttribute("data-block-id");u===null&&(u=l.target.parentElement.getAttribute("data-block-id")),t({block:d,dropTargetId:u||null,relativeIndex:J}),e(!1),N(),setTimeout(()=>{N()},300)}:a.noop,onDragEnter:s?l=>{const d=l;D=d.target,d.stopPropagation(),d.preventDefault(),A=[];const u=d.target;Be(u),u.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),e(!0),p(""),c([])}:a.noop,onDragLeave:s?l=>{const d=l;D=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:a.noop,onMouseOut:s?()=>{e(!1),N()}:a.noop}};function F(o){return o.getAttribute("data-block-id")?o:o.closest("[data-block-id]")}function Ae(o){o.container.innerHTML="",o.container.parentNode.removeChild(o.container);var n=document.querySelector(".ql-toolbar");n&&n.parentNode.removeChild(n),o=null}const _e=()=>{const o=["Heading","Paragraph","Text","Link","Span","Button"],n=i.useUpdateBlocksProps(),[,e]=i.useHighlightBlockId(),[t,s]=E.useAtom(i.inlineEditingActiveAtom);return p=>{var f;if(t)return;const c=F(p.target),l=c.getAttribute("data-block-type");if(!l||!o.includes(l))return;const d=c.cloneNode(!0);c.style.display="none",Array.from(d.attributes).forEach(g=>{g.name!=="class"&&d.removeAttribute(g.name)}),l==="Text"&&(d.style.display="inline-block"),c.parentNode.insertBefore(d,c.nextSibling);const u=new re.Quill(d,{placeholder:"Type here..."});function x(){const g=u.getText(0,u.getLength());n([c.getAttribute("data-block-id")],{content:g}),c.removeAttribute("style"),d.removeEventListener("blur",x,!0),Ae(u),s(""),e("")}d.addEventListener("blur",x,!0),u.focus(),(f=d.querySelector(".ql-clipboard"))==null||f.remove(),s(c.getAttribute("data-block-id"))}},Te=()=>{const[,o]=i.useSelectedStylingBlocks(),[,n]=i.useSelectedBlockIds(),[,e]=i.useHighlightBlockId(),[t]=E.useAtom(i.inlineEditingActiveAtom),[s]=E.useAtom(i.treeRefAtom);return p=>{if(t)return;s.closeAll(),p.stopPropagation();const c=F(p.target);if(c!=null&&c.getAttribute("data-block-id")&&(c==null?void 0:c.getAttribute("data-block-id"))==="container"){n([]),o([]),e("");return}if(c!=null&&c.getAttribute("data-block-parent")){const l=c.getAttribute("data-style-prop"),d=c.getAttribute("data-style-id"),u=c.getAttribute("data-block-parent");o([{id:d,prop:l,blockId:u}]),n([u])}else c!=null&&c.getAttribute("data-block-id")&&n([c.getAttribute("data-block-id")]);e("")}},Me=a.throttle((o,n)=>{const e=F(o.target);e!=null&&e.getAttribute("data-style-id")&&n(e.getAttribute("data-style-id"))},100),Ne=()=>{const[,o]=i.useHighlightBlockId(),[n]=E.useAtom(i.inlineEditingActiveAtom);return e=>{n||Me(e,o)}},qe=({children:o})=>{const{document:n}=M(),[e]=i.useSelectedBlockIds(),[t,s]=i.useSelectedStylingBlocks();h.useEffect(()=>{setTimeout(()=>{if(!a.isEmpty(t))return;const u=V(n,a.first(e));if(u){const x=u.getAttribute("data-style-prop");if(x){const f=u.getAttribute("data-style-id"),g=u.getAttribute("data-block-parent");s([{id:f,prop:x,blockId:g}])}}},100)},[n,e,s,t]);const p=_e(),c=Te(),l=Ne(),d=De();return r.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:c,onDoubleClick:p,onMouseMove:l,...a.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:o})},V=(o,n)=>o.querySelector(`[data-block-id="${n}"]`),Le=()=>{const{window:o}=M(),[n,e]=i.useSelectedBlockIds(),[t]=i.useBlocksStore(),[,s]=i.useSelectedStylingBlocks(),{undo:p,redo:c}=i.useUndoManager(),l=i.useDuplicateBlocks(),[,d]=i.usePreviewMode(),u=i.useRemoveBlocks(),{savePage:x}=i.useSavePage(),[f]=E.useAtom(i.inlineEditingActiveAtom),[,g]=E.useAtom(i.editLayerNameAtom),y=v=>{v.key==="Enter"&&(v.preventDefault(),n.length===1&&g(a.first(n)))},w=v=>{const m=t.find(j=>j._id===v);return m?m._parent:null};return h.useEffect(()=>{const v=m=>{if(m.key==="Escape"){e([]),s([]);return}if(y(m),!f&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),u(n)),m.ctrlKey||m.metaKey){if(m.key==="ArrowUp"){m.preventDefault();const j=n.length>0?w(n[0]):null;j&&e([j])}if(["z","y","d","x","c","p","s","v"].includes(m.key)){if(f&&["x","z","v"].includes(m.key))return!0;m.preventDefault()}m.key==="s"&&(m.stopPropagation(),m.preventDefault(),x()),m.key==="z"&&p(),m.key==="y"&&c(),m.key==="d"&&l(n)}};return o.removeEventListener("keydown",v),o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v)}},[n,e,p,u,d,c,l,f,x,o]),null},Pe=({block:o,label:n})=>{const[,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[,s]=E.useAtom(i.draggedBlockIdAtom),p=K.useFeature("dnd");return r.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:p?"true":"false",onDragStart:c=>{c.dataTransfer.setData("text/plain",JSON.stringify(a.pick(o,["_id","_type"]))),s(o._id),setTimeout(()=>{e([]),t(null)},200)},children:[r.jsxRuntimeExports.jsx(k.DragHandleDots2Icon,{}),n]})},Fe=({selectedBlockElement:o,block:n})=>{const e=i.useRemoveBlocks(),t=i.useDuplicateBlocks(),[,s]=i.useSelectedBlockIds(),[,p]=i.useSelectedStylingBlocks(),[c]=E.useAtom(i.inlineEditingActiveAtom),{floatingStyles:l,refs:d,update:u}=O.useFloating({placement:"top-start",middleware:[O.shift(),ie.flip()],elements:{reference:o}});le.useResizeObserver(o,()=>u(),o!==null);const x=a.get(n,"_parent",null),f=a.isEmpty(a.get(n,"_name",""))?a.get(n,"_type",""):a.get(n,"_name","");return!o||!n||c?null:r.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:l,onClick:g=>{g.stopPropagation(),g.preventDefault()},onKeyDown:g=>g.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[r.jsxRuntimeExports.jsx(Pe,{label:f,block:n}),r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[x&&r.jsxRuntimeExports.jsx(k.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{p([]),s([x])}}),i.canDuplicateBlock(a.get(n,"_type",""))?r.jsxRuntimeExports.jsx(k.CopyIcon,{className:"hover:scale-105",onClick:()=>t([n==null?void 0:n._id])}):null,i.canDeleteBlock(a.get(n,"_type",""))?r.jsxRuntimeExports.jsx(k.TrashIcon,{className:"hover:scale-105",onClick:()=>e([n==null?void 0:n._id])}):null]})]})},He=({addVariant:o,e:n})=>{o("hs-dropdown-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open > .${n(`hs-dropdown-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open .hs-dropdown-toggle .${n(`hs-dropdown-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open > .hs-dropdown-menu > .${n(`hs-dropdown-open${t}${s}`)}`)}]),o("hs-removing",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-removing.${n(`hs-removing${t}${s}`)}`)}),o("hs-tooltip-shown",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-tooltip.show .${n(`hs-tooltip-shown${t}${s}`)}`)}),o("hs-accordion-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active.${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-toggle .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-toggle.${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${n(`hs-accordion-active${t}${s}`)}`)}]),o("hs-accordion-selected",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion .selected.${n(`hs-accordion-selected${t}${s}`)}`)}),o("hs-collapse-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse.open .${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse.open.${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse-toggle.open .${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse-toggle.open.${n(`hs-collapse-open${t}${s}`)}`)}]),o("hs-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`[data-hs-tab].active.${n(`hs-tab-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`[data-hs-tab].active .${n(`hs-tab-active${t}${s}`)}`)}]),o("hs-overlay-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.open.${n(`hs-overlay-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.open .${n(`hs-overlay-open${t}${s}`)}`)}]),o("hs-overlay-layout-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-body-open.${n(`hs-overlay-layout-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-body-open .${n(`hs-overlay-layout-open${t}${s}`)}`)}]),o("hs-overlay-backdrop-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-backdrop.${n(`hs-overlay-backdrop-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-backdrop .${n(`hs-overlay-backdrop-open${t}${s}`)}`)}]),o("hs-scrollspy-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-scrollspy-active${t}${s}`)}`)}),o("hs-carousel-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-carousel-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-carousel-active${t}${s}`)}`)}]),o("hs-carousel-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-carousel${t}disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-carousel${t}disabled${t}${s}`)}`)}]),o("hs-selected",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected.${n(`hs-selected${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected .${n(`hs-selected${t}${s}`)}`)}]),o("hs-select-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-select-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-select-disabled${t}${s}`)}`)}]),o("hs-select-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-select-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-select-active${t}${s}`)}`)}]),o("hs-input-number-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-input-number-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-input-number-disabled${t}${s}`)}`)}]),o("hs-pin-input-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-pin-input-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-pin-input-active${t}${s}`)}`)}]),o("hs-select-opened",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.opened.${n(`hs-select-opened${t}${s}`)}`)}]),o("hs-password-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-password-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-password-active${t}${s}`)}`)}]),o("hs-stepper-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-stepper-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-stepper-active${t}${s}`)}`)}]),o("hs-stepper-success",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success.${n(`hs-stepper-success${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success .${n(`hs-stepper-success${t}${s}`)}`)}]),o("hs-stepper-completed",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.completed.${n(`hs-stepper-completed${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.completed .${n(`hs-stepper-completed${t}${s}`)}`)}]),o("hs-stepper-error",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error.${n(`hs-stepper-error${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error .${n(`hs-stepper-error${t}${s}`)}`)}]),o("hs-stepper-processed",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.processed.${n(`hs-stepper-processed${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.processed .${n(`hs-stepper-processed${t}${s}`)}`)}]),o("hs-stepper-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-stepper-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-stepper-disabled${t}${s}`)}`)}]),o("hs-stepper-skipped",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.skipped.${n(`hs-stepper-skipped${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.skipped .${n(`hs-stepper-skipped${t}${s}`)}`)}]),o("hs-strong-password",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.passed.${n(`hs-strong-password${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.passed .${n(`hs-strong-password${t}${s}`)}`)}]),o("hs-strong-password-accepted",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.accepted.${n(`hs-strong-password-accepted${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.accepted .${n(`hs-strong-password-accepted${t}${s}`)}`)}]),o("hs-strong-password-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-strong-password-active${t}${s}`)}`)}]),o("hs-combo-box-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-combo-box-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-combo-box-active${t}${s}`)}`)}]),o("hs-combo-box-selected",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected .${n(`hs-combo-box-selected${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected.${n(`hs-combo-box-selected${t}${s}`)}`)}]),o("hs-combo-box-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-combo-box-tab-active${t}${s}`)}`)}]),o("hs-apexcharts-tooltip-dark",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.dark.${n(`hs-apexcharts-tooltip-dark${t}${s}`)}`)}]),o("hs-success",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success .${n(`hs-success${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success.${n(`hs-success${t}${s}`)}`)}]),o("hs-error",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error .${n(`hs-error${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error.${n(`hs-error${t}${s}`)}`)}]),o("hs-default-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.default .${n(`hs-default-mode-active${t}${s}`)}`)}),o("hs-dark-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.dark .${n(`hs-dark-mode-active${t}${s}`)}`)}),o("hs-auto-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.auto .${n(`hs-auto-mode-active${t}${s}`)}`)})},Oe=({model:o})=>{const[n]=i.useBrandingOptions(),[e]=i.useSelectedBlockIds(),[t]=i.useDarkMode(),[s]=i.useHighlightBlockId(),[p]=i.useSelectedStylingBlocks(),[c]=E.useAtom(i.draggedBlockIdAtom),{document:l,window:d}=M(),[u]=h.useState(l==null?void 0:l.getElementById("highlighted-block")),[x]=h.useState(l==null?void 0:l.getElementById("selected-block")),[f]=h.useState(l==null?void 0:l.getElementById("selected-styling-block")),[g]=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 y=a.get(n,"headingFont","DM Sans"),w=a.get(n,"bodyFont","DM Sans");return h.useEffect(()=>{const v=a.get(n,"primaryColor","#000"),m=a.get(n,"secondaryColor","#FFF"),j=ce.tailwindcssPaletteGenerator({colors:[v,m],names:["primary","secondary"]});j.primary.DEFAULT=v,j.secondary.DEFAULT=m;const I=a.get(n,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[y],body:[w]},extend:{borderRadius:{global:`${I||"0"}px`},colors:j}},plugins:[ae,de,ue,d.tailwind.plugin.withOptions(()=>He)]})},[n,d,y,w]),h.useEffect(()=>{x&&(x.textContent=`${a.map(e,v=>`[data-block-id="${v}"]`).join(",")}{
|
|
51
|
+
</html>`,ke=o=>{const[n]=i.useCanvasWidth(),[,e]=i.useCanvasZoom(),[t,s]=h.useState({}),p=h.useCallback(()=>{const{width:c,height:l}=o;if(c<n){const d=parseFloat((c/n).toFixed(2).toString());let u={};const x=l*d;l&&(u={height:100+(l-x)/x*100+"%"}),s({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...u,maxWidth:"none"}),e(d*100)}else s({}),e(100)},[n,o,e]);return h.useEffect(()=>{p()},[n,o,e,p]),t};let Y,Z;typeof document<"u"&&(Y=document);typeof window<"u"&&(Z=window);const Q=h.createContext({document:Y,window:Z}),T=()=>h.useContext(Q),{Provider:Ee,Consumer:Ve}=Q;class J extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}C(J,"propTypes",{children:b.element.isRequired,contentDidMount:b.func.isRequired,contentDidUpdate:b.func.isRequired});class q extends h.Component{constructor(e,t){super(e,t);C(this,"setRef",e=>{this.nodeRef.current=e;const{forwardedRef:t}=this.props;typeof t=="function"?t(e):t&&(t.current=e)});C(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});C(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,s=this.props.contentDidUpdate,p=e.defaultView||e.parentView,c=r.jsxRuntimeExports.jsx(J,{contentDidMount:t,contentDidUpdate:s,children:r.jsxRuntimeExports.jsx(Ee,{value:{document:e,window:p},children:r.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),l=this.getMountTarget();return[H.createPortal(this.props.head,this.getDoc().head),H.createPortal(c,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()})}}C(q,"propTypes",{style:b.object,head:b.node,initialContent:b.string,mountTarget:b.string,contentDidMount:b.func,contentDidUpdate:b.func,children:b.oneOfType([b.element,b.arrayOf(b.element)])}),C(q,"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 Re=h.forwardRef((o,n)=>r.jsxRuntimeExports.jsx(q,{...o,forwardedRef:n})),we=()=>{const{addCoreBlock:o}=i.useAddBlock(),n=i.useBuilderProp("getExternalPredefinedBlock",a.noop);return h.useCallback(async e=>{const{block:t,dropTargetId:s,relativeIndex:p}=e;if(a.has(t,"format")){const c=await n(t);return o({blocks:c},s===0?null:s,p)}return o(t,s===0?null:s,p)},[o])};let w=null,A=[],D=null,G=null;function Se(o){const n=window.getComputedStyle(o),e=parseInt(n.paddingLeft,10),t=parseInt(n.paddingTop,10),s=parseInt(n.paddingRight,10),p=parseInt(n.paddingBottom,10);return{paddingLeft:e,paddingTop:t,paddingRight:s,paddingBottom:p}}const W=(o,n,e)=>{if(!w)return;const t=o.getBoundingClientRect(),s=w==null?void 0:w.getElementById("placeholder"),{paddingLeft:p,paddingTop:c,paddingRight:l,paddingBottom:d}=Se(o);s.style.width=n==="vertical"?t.width-p-l+"px":"2px",s.style.height=n==="vertical"?"2px":t.height-c-d+"px",s.style.display="block";const u=A.reduce((x,f)=>Math.abs(f-e)<Math.abs(x-e)?f:x);G=A.indexOf(u),n==="vertical"?(s.style.top=o.offsetTop+u+"px",s.style.left=o.offsetLeft+p+"px"):(s.style.top=o.offsetTop+c+"px",s.style.left=o.offsetLeft+u+"px")},Be=o=>{const n=X(o),e=window.getComputedStyle(o),t=n==="horizontal",s=parseInt(e.paddingLeft),p=parseInt(e.paddingTop);let c=t?s:p;A=[c],Array.from(o.children).forEach(l=>{const d=window.getComputedStyle(l),u=parseInt(t?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),x=t?l.offsetWidth:l.offsetHeight;A.push(c+x+u),c+=x+u})};function X(o){const n=window.getComputedStyle(o).display,e=window.getComputedStyle(o).flexDirection;if(n==="flex")return e==="column"||e==="column-reverse"?"vertical":"horizontal";if(n==="grid"){const t=window.getComputedStyle(o).gridTemplateRows,s=window.getComputedStyle(o).gridTemplateColumns;if(t.includes("auto"))return"vertical";if(s.includes("auto"))return"horizontal"}return n==="block"?"vertical":"horizontal"}const Ce=a.throttle(o=>{const n=o.target,e=X(n);if(e==="vertical"){const t=o.clientY-n.offsetTop;W(n,e,t)}else{const t=o.clientX-n.offsetLeft;W(n,e,t)}},200),Ie=o=>{o.preventDefault(),o.stopPropagation(),Ce(o)};function N(){const o=w==null?void 0:w.getElementById("placeholder");o.style.display="none"}const De=()=>{const{document:o}=T(),[n,e]=E.useAtom(i.draggingFlagAtom),t=we(),s=K.useFeature("dnd"),[,p]=i.useHighlightBlockId(),[,c]=i.useSelectedBlockIds();return w=o,{isDragging:n,"data-dnd":"branch",onDragOver:s?Ie:a.noop,onDrop:s?l=>{D==null||D.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(l.dataTransfer.getData("text/plain"));let u=l.target.getAttribute("data-block-id");u===null&&(u=l.target.parentElement.getAttribute("data-block-id")),t({block:d,dropTargetId:u||null,relativeIndex:G}),e(!1),N(),setTimeout(()=>{N()},300)}:a.noop,onDragEnter:s?l=>{const d=l;D=d.target,d.stopPropagation(),d.preventDefault(),A=[];const u=d.target;Be(u),u.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),e(!0),p(""),c([])}:a.noop,onDragLeave:s?l=>{const d=l;D=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:a.noop,onMouseOut:s?()=>{e(!1),N()}:a.noop}};function F(o){return o.getAttribute("data-block-id")?o:o.closest("[data-block-id]")}function Ae(o){o.container.innerHTML="",o.container.parentNode.removeChild(o.container);var n=document.querySelector(".ql-toolbar");n&&n.parentNode.removeChild(n),o=null}const _e=()=>{const o=["Heading","Paragraph","Text","Link","Span","Button"],n=i.useUpdateBlocksProps(),[,e]=i.useHighlightBlockId(),[t,s]=E.useAtom(i.inlineEditingActiveAtom);return p=>{var f;if(t)return;const c=F(p.target),l=c.getAttribute("data-block-type");if(!l||!o.includes(l))return;const d=c.cloneNode(!0);c.style.display="none",Array.from(d.attributes).forEach(g=>{g.name!=="class"&&d.removeAttribute(g.name)}),l==="Text"&&(d.style.display="inline-block"),c.parentNode.insertBefore(d,c.nextSibling);const u=new re.Quill(d,{placeholder:"Type here..."});function x(){const g=u.getText(0,u.getLength());n([c.getAttribute("data-block-id")],{content:g}),c.removeAttribute("style"),d.removeEventListener("blur",x,!0),Ae(u),s(""),e("")}d.addEventListener("blur",x,!0),u.focus(),(f=d.querySelector(".ql-clipboard"))==null||f.remove(),s(c.getAttribute("data-block-id"))}},Me=()=>{const[,o]=i.useSelectedStylingBlocks(),[,n]=i.useSelectedBlockIds(),[,e]=i.useHighlightBlockId(),[t]=E.useAtom(i.inlineEditingActiveAtom),[s]=E.useAtom(i.treeRefAtom);return p=>{if(t)return;s.closeAll(),p.stopPropagation();const c=F(p.target);if(c!=null&&c.getAttribute("data-block-id")&&(c==null?void 0:c.getAttribute("data-block-id"))==="container"){n([]),o([]),e("");return}if(c!=null&&c.getAttribute("data-block-parent")){const l=c.getAttribute("data-style-prop"),d=c.getAttribute("data-style-id"),u=c.getAttribute("data-block-parent");o([{id:d,prop:l,blockId:u}]),n([u])}else c!=null&&c.getAttribute("data-block-id")&&n([c.getAttribute("data-block-id")]);e("")}},Te=a.throttle((o,n)=>{const e=F(o.target);e!=null&&e.getAttribute("data-style-id")&&n(e.getAttribute("data-style-id"))},100),Ne=()=>{const[,o]=i.useHighlightBlockId(),[n]=E.useAtom(i.inlineEditingActiveAtom);return e=>{n||Te(e,o)}},qe=({children:o})=>{const{document:n}=T(),[e]=i.useSelectedBlockIds(),[t,s]=i.useSelectedStylingBlocks();h.useEffect(()=>{setTimeout(()=>{if(!a.isEmpty(t))return;const u=V(n,a.first(e));if(u){const x=u.getAttribute("data-style-prop");if(x){const f=u.getAttribute("data-style-id"),g=u.getAttribute("data-block-parent");s([{id:f,prop:x,blockId:g}])}}},100)},[n,e,s,t]);const p=_e(),c=Me(),l=Ne(),d=De();return r.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:c,onDoubleClick:p,onMouseMove:l,...a.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:o})},V=(o,n)=>o.querySelector(`[data-block-id="${n}"]`),Le=()=>{const{window:o}=T(),[n,e]=i.useSelectedBlockIds(),[t]=i.useBlocksStore(),[,s]=i.useSelectedStylingBlocks(),{undo:p,redo:c}=i.useUndoManager(),l=i.useDuplicateBlocks(),[,d]=i.usePreviewMode(),u=i.useRemoveBlocks(),{savePage:x}=i.useSavePage(),[f]=E.useAtom(i.inlineEditingActiveAtom),[,g]=E.useAtom(i.editLayerNameAtom),j=v=>{v.key==="Enter"&&(v.preventDefault(),n.length===1&&g(a.first(n)))},R=v=>{const m=t.find(y=>y._id===v);return m?m._parent:null};return h.useEffect(()=>{const v=m=>{if(m.key==="Escape"){e([]),s([]);return}if(j(m),!f&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),u(n)),m.ctrlKey||m.metaKey){if(m.key==="ArrowUp"){m.preventDefault();const y=n.length>0?R(n[0]):null;y&&e([y])}if(["z","y","d","x","c","p","s","v"].includes(m.key)){if(f&&["x","z","v"].includes(m.key))return!0;m.preventDefault()}m.key==="s"&&(m.stopPropagation(),m.preventDefault(),x()),m.key==="z"&&p(),m.key==="y"&&c(),m.key==="d"&&l(n)}};return o.removeEventListener("keydown",v),o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v)}},[n,e,p,u,d,c,l,f,x,o]),null},Pe=({block:o,label:n})=>{const[,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[,s]=E.useAtom(i.draggedBlockIdAtom),p=K.useFeature("dnd");return r.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:p?"true":"false",onDragStart:c=>{c.dataTransfer.setData("text/plain",JSON.stringify(a.pick(o,["_id","_type"]))),s(o._id),setTimeout(()=>{e([]),t(null)},200)},children:[r.jsxRuntimeExports.jsx(k.DragHandleDots2Icon,{}),n]})},Fe=({selectedBlockElement:o,block:n})=>{const e=i.useRemoveBlocks(),t=i.useDuplicateBlocks(),[,s]=i.useSelectedBlockIds(),[,p]=i.useSelectedStylingBlocks(),[c]=E.useAtom(i.inlineEditingActiveAtom),{floatingStyles:l,refs:d,update:u}=O.useFloating({placement:"top-start",middleware:[O.shift(),ie.flip()],elements:{reference:o}});le.useResizeObserver(o,()=>u(),o!==null);const x=a.get(n,"_parent",null),f=a.isEmpty(a.get(n,"_name",""))?a.get(n,"_type",""):a.get(n,"_name","");return!o||!n||c?null:r.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:l,onClick:g=>{g.stopPropagation(),g.preventDefault()},onKeyDown:g=>g.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[r.jsxRuntimeExports.jsx(Pe,{label:f,block:n}),r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[x&&r.jsxRuntimeExports.jsx(k.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{p([]),s([x])}}),i.canDuplicateBlock(a.get(n,"_type",""))?r.jsxRuntimeExports.jsx(k.CopyIcon,{className:"hover:scale-105",onClick:()=>t([n==null?void 0:n._id])}):null,i.canDeleteBlock(a.get(n,"_type",""))?r.jsxRuntimeExports.jsx(k.TrashIcon,{className:"hover:scale-105",onClick:()=>e([n==null?void 0:n._id])}):null]})]})},He=({addVariant:o,e:n})=>{o("hs-dropdown-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open > .${n(`hs-dropdown-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open .hs-dropdown-toggle .${n(`hs-dropdown-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-dropdown.open > .hs-dropdown-menu > .${n(`hs-dropdown-open${t}${s}`)}`)}]),o("hs-removing",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-removing.${n(`hs-removing${t}${s}`)}`)}),o("hs-tooltip-shown",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-tooltip.show .${n(`hs-tooltip-shown${t}${s}`)}`)}),o("hs-accordion-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active.${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-toggle .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-toggle.${n(`hs-accordion-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${n(`hs-accordion-active${t}${s}`)}`)}]),o("hs-accordion-selected",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-accordion .selected.${n(`hs-accordion-selected${t}${s}`)}`)}),o("hs-collapse-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse.open .${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse.open.${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse-toggle.open .${n(`hs-collapse-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-collapse-toggle.open.${n(`hs-collapse-open${t}${s}`)}`)}]),o("hs-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`[data-hs-tab].active.${n(`hs-tab-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`[data-hs-tab].active .${n(`hs-tab-active${t}${s}`)}`)}]),o("hs-overlay-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.open.${n(`hs-overlay-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.open .${n(`hs-overlay-open${t}${s}`)}`)}]),o("hs-overlay-layout-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-body-open.${n(`hs-overlay-layout-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-body-open .${n(`hs-overlay-layout-open${t}${s}`)}`)}]),o("hs-overlay-backdrop-open",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-backdrop.${n(`hs-overlay-backdrop-open${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.hs-overlay-backdrop .${n(`hs-overlay-backdrop-open${t}${s}`)}`)}]),o("hs-scrollspy-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-scrollspy-active${t}${s}`)}`)}),o("hs-carousel-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-carousel-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-carousel-active${t}${s}`)}`)}]),o("hs-carousel-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-carousel${t}disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-carousel${t}disabled${t}${s}`)}`)}]),o("hs-selected",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected.${n(`hs-selected${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected .${n(`hs-selected${t}${s}`)}`)}]),o("hs-select-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-select-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-select-disabled${t}${s}`)}`)}]),o("hs-select-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-select-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-select-active${t}${s}`)}`)}]),o("hs-input-number-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-input-number-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-input-number-disabled${t}${s}`)}`)}]),o("hs-pin-input-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-pin-input-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-pin-input-active${t}${s}`)}`)}]),o("hs-select-opened",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.opened.${n(`hs-select-opened${t}${s}`)}`)}]),o("hs-password-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-password-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-password-active${t}${s}`)}`)}]),o("hs-stepper-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-stepper-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-stepper-active${t}${s}`)}`)}]),o("hs-stepper-success",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success.${n(`hs-stepper-success${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success .${n(`hs-stepper-success${t}${s}`)}`)}]),o("hs-stepper-completed",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.completed.${n(`hs-stepper-completed${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.completed .${n(`hs-stepper-completed${t}${s}`)}`)}]),o("hs-stepper-error",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error.${n(`hs-stepper-error${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error .${n(`hs-stepper-error${t}${s}`)}`)}]),o("hs-stepper-processed",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.processed.${n(`hs-stepper-processed${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.processed .${n(`hs-stepper-processed${t}${s}`)}`)}]),o("hs-stepper-disabled",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled.${n(`hs-stepper-disabled${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.disabled .${n(`hs-stepper-disabled${t}${s}`)}`)}]),o("hs-stepper-skipped",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.skipped.${n(`hs-stepper-skipped${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.skipped .${n(`hs-stepper-skipped${t}${s}`)}`)}]),o("hs-strong-password",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.passed.${n(`hs-strong-password${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.passed .${n(`hs-strong-password${t}${s}`)}`)}]),o("hs-strong-password-accepted",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.accepted.${n(`hs-strong-password-accepted${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.accepted .${n(`hs-strong-password-accepted${t}${s}`)}`)}]),o("hs-strong-password-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-strong-password-active${t}${s}`)}`)}]),o("hs-combo-box-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active .${n(`hs-combo-box-active${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-combo-box-active${t}${s}`)}`)}]),o("hs-combo-box-selected",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected .${n(`hs-combo-box-selected${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.selected.${n(`hs-combo-box-selected${t}${s}`)}`)}]),o("hs-combo-box-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.active.${n(`hs-combo-box-tab-active${t}${s}`)}`)}]),o("hs-apexcharts-tooltip-dark",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.dark.${n(`hs-apexcharts-tooltip-dark${t}${s}`)}`)}]),o("hs-success",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success .${n(`hs-success${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.success.${n(`hs-success${t}${s}`)}`)}]),o("hs-error",[({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error .${n(`hs-error${t}${s}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:s})=>`.error.${n(`hs-error${t}${s}`)}`)}]),o("hs-default-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.default .${n(`hs-default-mode-active${t}${s}`)}`)}),o("hs-dark-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.dark .${n(`hs-dark-mode-active${t}${s}`)}`)}),o("hs-auto-mode-active",({modifySelectors:e,separator:t})=>{e(({className:s})=>`.auto .${n(`hs-auto-mode-active${t}${s}`)}`)})},Oe=({model:o})=>{const[n]=i.useBrandingOptions(),[e]=i.useSelectedBlockIds(),[t]=i.useDarkMode(),[s]=i.useHighlightBlockId(),[p]=i.useSelectedStylingBlocks(),[c]=E.useAtom(i.draggedBlockIdAtom),{document:l,window:d}=T(),[u]=h.useState(l==null?void 0:l.getElementById("highlighted-block")),[x]=h.useState(l==null?void 0:l.getElementById("selected-block")),[f]=h.useState(l==null?void 0:l.getElementById("selected-styling-block")),[g]=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=a.get(n,"headingFont","DM Sans"),R=a.get(n,"bodyFont","DM Sans");return h.useEffect(()=>{if(!d||!d.tailwind)return;const v=a.get(n,"primaryColor","#000"),m=a.get(n,"secondaryColor","#FFF"),y=ce([{color:v,name:"primary"},{color:m,name:"secondary"}]),I=a.get(n,"roundedCorners","0");d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[j],body:[R]},extend:{borderRadius:{global:`${I||"0"}px`},colors:y}},plugins:[ae,de,ue,d.tailwind.plugin.withOptions(()=>He)]}},[n,d,j,R]),h.useEffect(()=>{x&&(x.textContent=`${a.map(e,v=>`[data-block-id="${v}"]`).join(",")}{
|
|
52
52
|
outline: 1px solid ${e.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
53
53
|
}`)},[e,x]),h.useEffect(()=>{if(!c){g.textContent="";return}g.textContent=`[data-block-id="${c}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[c]),h.useEffect(()=>{u&&(u.textContent=s?`[data-style-id="${s}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[s,e,u]),h.useEffect(()=>{f&&(f.textContent=`${a.map(p,({id:v})=>`[data-style-id="${v}"]`).join(",")}{
|
|
54
54
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
55
|
-
}`)},[p,f]),h.useEffect(()=>{const v=a.get(n,"bodyTextLightColor","#64748b"),m=a.get(n,"bodyTextDarkColor","#94a3b8"),
|
|
55
|
+
}`)},[p,f]),h.useEffect(()=>{const v=a.get(n,"bodyTextLightColor","#64748b"),m=a.get(n,"bodyTextDarkColor","#94a3b8"),y=a.get(n,"bodyBgLightColor","#FFFFFF"),I=a.get(n,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${v}] bg-[${y}] dark:text-[${m}] dark:bg-[${I}]`},[n,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"}),R&&j!==R&&r.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${R.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},Ue=o=>{const n={};return Object.keys(o).forEach(e=>{a.isString(o[e])&&o[e].startsWith(_.SLOT_KEY)&&(n[e]=o[e].replace(_.SLOT_KEY,"").split(","))}),n},ze=a.memoize(o=>{const n=o.replace(_.STYLES_KEY,"").split(",");return he.twMerge(n[0],n[1])});function We(o,n){return a.get(o,`${n}_attrs`,{})}function Ke(o){const n={};return Object.keys(o).forEach(e=>{if(a.isString(o[e])&&o[e].startsWith(_.STYLES_KEY)){const t=ze(o[e]);n[e]={className:t,"data-style-prop":e,"data-block-parent":o._id,"data-style-id":`${e}-${o._id}`,...We(o,e)}}}),n}function Ye(o,n){const e=a.get(o,"_bindings",{});return a.isEmpty(e)?{...o}:(a.each(e,(t,s)=>{a.isString(t)&&a.get(n,t,null)&&(o[s]=a.get(n,t,null))}),o)}function L({blocks:o}){const[n]=i.useBlocksStore(),[e]=me.useCanvasSettings(),t=h.useCallback(l=>Ke(l),[]),[s]=P.useChaiExternalData(),[p]=E.useAtom(i.inlineEditingActiveAtom),c=h.useCallback(l=>l.reduce((d,u)=>{const x=a.get(e,u,{});return{...d,...x}},{}),[e,n]);return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:h.Children.toArray(o.map((l,d)=>{if(p===l._id)return null;const u=Ue(l),x={};a.isEmpty(u)||Object.keys(u).forEach(m=>{x[m]=h.Children.toArray(u[m].map(y=>r.jsxRuntimeExports.jsx(L,{blocks:[a.find(n,{_id:y})]})))});const f=a.filter(n,{_parent:l._id});x.children=f.length?r.jsxRuntimeExports.jsx(L,{blocks:f}):null;const g=xe.getBlockComponent(l._type),j=a.get(g,"builderComponent",a.get(g,"component",null));if(a.isNull(j))return r.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${l==null?void 0:l._type} not registered -->`});const R=a.has(g,"getBlockStateFrom")?g==null?void 0:g.getBlockStateFrom(l,n):[],v=c(R);return r.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(j,{blockProps:{"data-block-id":l._id,"data-block-type":l._type,"data-dnd":a.has(g,"canAcceptBlock")?"branch":"leaf"},index:d,...Ye(l,s),...t(l),...x,inBuilder:!0,blockState:v})})}))})}const Ze=()=>{const[o]=i.useBlocksStore(),n=a.isEmpty(o)?null:r.jsxRuntimeExports.jsx(P.BlocksExternalDataProvider,{children:r.jsxRuntimeExports.jsx(L,{blocks:a.filter(o,e=>a.isEmpty(e._parent))})});return r.jsxRuntimeExports.jsx(pe.Provider,{children:n})},Qe=(o,n)=>o.querySelector(`[data-style-id="${n}"]`),Je=()=>{const[o]=E.useAtom(i.networkModeAtom),[n]=i.usePreviewMode(),[e]=i.useCanvasWidth(),[,t]=i.useSelectedBlockIds(),s=i.useSelectedBlock(),[,p]=i.useHighlightBlockId(),c=h.useRef(null),l=h.useRef(null),[d,u]=h.useState({width:0,height:0}),x=ke(d),[f,g]=h.useState(0),[j,R]=h.useState([]),[,v]=h.useState([]),[,m]=E.useAtom(i.canvasIframeAtom),[y,I]=i.useSelectedStylingBlocks(),ee=i.useBuilderProp("loading",!1);h.useEffect(()=>{const{clientWidth:$,clientHeight:S}=l.current;u({width:$,height:S}),f===0&&g($)},[l,e,f]);const te=($,S=0)=>{const{top:B}=$.getBoundingClientRect();return B+S>=0&&B-S<=window.innerHeight};h.useEffect(()=>{var $,S;if(s&&s.type!=="Multiple"&&c.current){const B=V(c.current.contentDocument,s._id);B&&(te(B)||(S=($=c.current)==null?void 0:$.contentWindow)==null||S.scrollTo({top:B.offsetTop,behavior:"smooth"}),R([B]))}},[s]),h.useEffect(()=>{if(!a.isEmpty(y)&&c.current){const $=Qe(c.current.contentDocument,a.first(y).id);v($?[$]:[null])}else v([null])},[y]);const se=h.useMemo(()=>{let $=be;return o==="offline"&&($=$.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),$=$.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),$=$.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),$},[o]);return r.jsxRuntimeExports.jsx("div",{onClick:()=>{t([]),I([])},onMouseLeave:()=>setTimeout(()=>p(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:f>0&&!a.isEmpty(x)?{width:n?"100%":f}:{},ref:l,children:r.jsxRuntimeExports.jsxs(Re,{contentDidMount:()=>m(c.current),ref:c,id:"canvas-iframe",style:{width:`${e}px`,...x},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(Le,{}),r.jsxRuntimeExports.jsx(Fe,{block:s,selectedBlockElement:a.first(j)}),r.jsxRuntimeExports.jsx(Oe,{model:"page"}),r.jsxRuntimeExports.jsx(qe,{children:ee?r.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):r.jsxRuntimeExports.jsx(Ze,{})}),r.jsxRuntimeExports.jsx("br",{}),r.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},Ge=()=>r.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[r.jsxRuntimeExports.jsx(ye,{}),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(P.ErrorBoundary,{children:r.jsxRuntimeExports.jsx(Je,{})})})})]});exports.default=Ge;
|
|
@@ -2,10 +2,10 @@ var Le = Object.defineProperty;
|
|
|
2
2
|
var Re = (n, o, e) => o in n ? Le(n, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[o] = e;
|
|
3
3
|
var _ = (n, o, e) => (Re(n, typeof o != "symbol" ? o + "" : o, e), e);
|
|
4
4
|
import { j as r } from "./jsx-runtime-WbnYoNE9.js";
|
|
5
|
-
import
|
|
5
|
+
import N, { createElement as se, useCallback as P, useState as j, useEffect as b, Component as ue, Children as Fe, Suspense as he, useRef as oe, useMemo as Pe } from "react";
|
|
6
6
|
import { map as F, includes as ne, toUpper as Y, round as Oe, noop as T, has as Q, throttle as me, isEmpty as S, first as z, omit as He, pick as ze, get as f, isString as X, memoize as Ue, each as We, find as qe, filter as ge, isNull as Ke } from "lodash-es";
|
|
7
7
|
import { ResetIcon as re, MobileIcon as ie, LaptopIcon as Ye, DesktopIcon as Je, DotsVerticalIcon as Qe, EraserIcon as Ze, ZoomInIcon as Ge, DragHandleDots2Icon as Xe, ArrowUpIcon as Ve, CopyIcon as et, TrashIcon as tt } from "@radix-ui/react-icons";
|
|
8
|
-
import { v as fe, B as U, V as xe, aB as st, aC as ot, aD as nt, aE as rt, aF as it, N as V, ab as at, h as W, aG as lt, aH as ct, aI as dt, aJ as pt, aK as ut, aL as ht, aM as mt, r as C, ac as
|
|
8
|
+
import { v as fe, B as U, V as xe, aB as st, aC as ot, aD as nt, aE as rt, aF as it, N as V, ab as at, h as W, aG as lt, aH as ct, aI as dt, aJ as pt, aK as ut, aL as ht, aM as mt, r as C, ac as A, A as gt, a as ft, b as xt, c as $t, d as vt, e as yt, f as bt, g as kt, ai as wt, O as $e, aA as H, L as jt, aN as Ct, Y as M, a5 as Bt, aO as L, aP as St, E as ee, t as ve, q as ye, s as be, z as Dt, aQ as It, aR as ke, aS as _t, aT as Nt, F as At, aU as Mt, a1 as Et, aV as Tt, S as we } from "./index-HiiWSXkE.js";
|
|
9
9
|
import { useTranslation as q } from "react-i18next";
|
|
10
10
|
import { useAtom as k } from "jotai";
|
|
11
11
|
import ae from "react-dom";
|
|
@@ -15,7 +15,7 @@ import { useFeature as je } from "flagged";
|
|
|
15
15
|
import { flip as Rt } from "@floating-ui/dom";
|
|
16
16
|
import { useFloating as Ft, shift as Pt } from "@floating-ui/react-dom";
|
|
17
17
|
import { useResizeObserver as Ot } from "@react-hookz/web";
|
|
18
|
-
import
|
|
18
|
+
import Ht from "tailwindcss-palette-generator";
|
|
19
19
|
import zt from "@tailwindcss/typography";
|
|
20
20
|
import Ut from "@tailwindcss/forms";
|
|
21
21
|
import Wt from "@tailwindcss/aspect-ratio";
|
|
@@ -23,7 +23,7 @@ import { Provider as qt } from "react-wrap-balancer";
|
|
|
23
23
|
import { twMerge as Kt } from "tailwind-merge";
|
|
24
24
|
import { S as le, a as Ce } from "./STRINGS--j49GZJP.js";
|
|
25
25
|
import { getBlockComponent as Yt } from "@chaibuilder/runtime";
|
|
26
|
-
import { u as Jt, B as Qt, E as Zt } from "./index-
|
|
26
|
+
import { u as Jt, B as Qt, E as Zt } from "./index-FVtnWx9d.js";
|
|
27
27
|
import { u as Gt } from "./useCanvasSettings-unTQUdlP.js";
|
|
28
28
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
29
29
|
import "./Functions-7jnEwJyw.js";
|
|
@@ -208,7 +208,7 @@ const ce = ({ landscape: n = !1 }) => /* @__PURE__ */ r.jsxs(
|
|
|
208
208
|
] })
|
|
209
209
|
] });
|
|
210
210
|
}, ss = () => {
|
|
211
|
-
const { t: n } = q(), { setNewBlocks: o } = mt(), [, e] = C(), [, t] =
|
|
211
|
+
const { t: n } = q(), { setNewBlocks: o } = mt(), [, e] = C(), [, t] = A(), s = P(() => {
|
|
212
212
|
o([]), e([]), t([]);
|
|
213
213
|
}, [o]);
|
|
214
214
|
return /* @__PURE__ */ r.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ r.jsxs(gt, { children: [
|
|
@@ -330,7 +330,7 @@ const ce = ({ landscape: n = !1 }) => /* @__PURE__ */ r.jsxs(
|
|
|
330
330
|
let Be, Se;
|
|
331
331
|
typeof document < "u" && (Be = document);
|
|
332
332
|
typeof window < "u" && (Se = window);
|
|
333
|
-
const De =
|
|
333
|
+
const De = N.createContext({ document: Be, window: Se }), K = () => N.useContext(De), { Provider: is, Consumer: Mo } = De;
|
|
334
334
|
class Ie extends ue {
|
|
335
335
|
componentDidMount() {
|
|
336
336
|
this.props.contentDidMount();
|
|
@@ -363,7 +363,7 @@ class Z extends ue {
|
|
|
363
363
|
_(this, "loadCheck", () => setInterval(() => {
|
|
364
364
|
this.handleLoad();
|
|
365
365
|
}, 500));
|
|
366
|
-
this._isMounted = !1, this.nodeRef =
|
|
366
|
+
this._isMounted = !1, this.nodeRef = N.createRef(), this.state = { iframeLoaded: !1 };
|
|
367
367
|
}
|
|
368
368
|
componentDidMount() {
|
|
369
369
|
this._isMounted = !0, this.getDoc() && this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded", this.handleLoad);
|
|
@@ -421,7 +421,7 @@ _(Z, "propTypes", {
|
|
|
421
421
|
},
|
|
422
422
|
initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
|
|
423
423
|
});
|
|
424
|
-
const as =
|
|
424
|
+
const as = N.forwardRef((n, o) => /* @__PURE__ */ r.jsx(Z, { ...n, forwardedRef: o })), ls = () => {
|
|
425
425
|
const { addCoreBlock: n } = jt(), o = W("getExternalPredefinedBlock", T);
|
|
426
426
|
return P(
|
|
427
427
|
async (e) => {
|
|
@@ -450,7 +450,7 @@ const pe = (n, o, e) => {
|
|
|
450
450
|
);
|
|
451
451
|
_e = O.indexOf(c), o === "vertical" ? (s.style.top = n.offsetTop + c + "px", s.style.left = n.offsetLeft + d + "px") : (s.style.top = n.offsetTop + a + "px", s.style.left = n.offsetLeft + c + "px");
|
|
452
452
|
}, ds = (n) => {
|
|
453
|
-
const o =
|
|
453
|
+
const o = Ne(n), e = window.getComputedStyle(n), t = o === "horizontal", s = parseInt(e.paddingLeft), d = parseInt(e.paddingTop);
|
|
454
454
|
let a = t ? s : d;
|
|
455
455
|
O = [a], Array.from(n.children).forEach((i) => {
|
|
456
456
|
const l = window.getComputedStyle(i), c = parseInt(
|
|
@@ -459,7 +459,7 @@ const pe = (n, o, e) => {
|
|
|
459
459
|
O.push(a + p + c), a += p + c;
|
|
460
460
|
});
|
|
461
461
|
};
|
|
462
|
-
function
|
|
462
|
+
function Ne(n) {
|
|
463
463
|
const o = window.getComputedStyle(n).display, e = window.getComputedStyle(n).flexDirection;
|
|
464
464
|
if (o === "flex")
|
|
465
465
|
return e === "column" || e === "column-reverse" ? "vertical" : "horizontal";
|
|
@@ -473,7 +473,7 @@ function Ae(n) {
|
|
|
473
473
|
return o === "block" ? "vertical" : "horizontal";
|
|
474
474
|
}
|
|
475
475
|
const ps = me((n) => {
|
|
476
|
-
const o = n.target, e =
|
|
476
|
+
const o = n.target, e = Ne(o);
|
|
477
477
|
if (e === "vertical") {
|
|
478
478
|
const t = n.clientY - o.offsetTop;
|
|
479
479
|
pe(o, e, t);
|
|
@@ -489,7 +489,7 @@ function J() {
|
|
|
489
489
|
n.style.display = "none";
|
|
490
490
|
}
|
|
491
491
|
const hs = () => {
|
|
492
|
-
const { document: n } = K(), [o, e] = k(Ct), t = ls(), s = je("dnd"), [, d] =
|
|
492
|
+
const { document: n } = K(), [o, e] = k(Ct), t = ls(), s = je("dnd"), [, d] = M(), [, a] = C();
|
|
493
493
|
return B = n, {
|
|
494
494
|
isDragging: o,
|
|
495
495
|
"data-dnd": "branch",
|
|
@@ -526,7 +526,7 @@ function ms(n) {
|
|
|
526
526
|
o && o.parentNode.removeChild(o), n = null;
|
|
527
527
|
}
|
|
528
528
|
const gs = () => {
|
|
529
|
-
const n = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], o = Bt(), [, e] =
|
|
529
|
+
const n = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], o = Bt(), [, e] = M(), [t, s] = k(L);
|
|
530
530
|
return (d) => {
|
|
531
531
|
var m;
|
|
532
532
|
if (t)
|
|
@@ -546,7 +546,7 @@ const gs = () => {
|
|
|
546
546
|
l.addEventListener("blur", p, !0), c.focus(), (m = l.querySelector(".ql-clipboard")) == null || m.remove(), s(a.getAttribute("data-block-id"));
|
|
547
547
|
};
|
|
548
548
|
}, fs = () => {
|
|
549
|
-
const [, n] =
|
|
549
|
+
const [, n] = A(), [, o] = C(), [, e] = M(), [t] = k(L), [s] = k(St);
|
|
550
550
|
return (d) => {
|
|
551
551
|
if (t)
|
|
552
552
|
return;
|
|
@@ -567,17 +567,17 @@ const gs = () => {
|
|
|
567
567
|
const e = te(n.target);
|
|
568
568
|
e != null && e.getAttribute("data-style-id") && o(e.getAttribute("data-style-id"));
|
|
569
569
|
}, 100), $s = () => {
|
|
570
|
-
const [, n] =
|
|
570
|
+
const [, n] = M(), [o] = k(L);
|
|
571
571
|
return (e) => {
|
|
572
572
|
o || xs(e, n);
|
|
573
573
|
};
|
|
574
574
|
}, vs = ({ children: n }) => {
|
|
575
|
-
const { document: o } = K(), [e] = C(), [t, s] =
|
|
575
|
+
const { document: o } = K(), [e] = C(), [t, s] = A();
|
|
576
576
|
b(() => {
|
|
577
577
|
setTimeout(() => {
|
|
578
578
|
if (!S(t))
|
|
579
579
|
return;
|
|
580
|
-
const c =
|
|
580
|
+
const c = Ae(o, z(e));
|
|
581
581
|
if (c) {
|
|
582
582
|
const p = c.getAttribute("data-style-prop");
|
|
583
583
|
if (p) {
|
|
@@ -601,11 +601,11 @@ const gs = () => {
|
|
|
601
601
|
children: n
|
|
602
602
|
}
|
|
603
603
|
);
|
|
604
|
-
},
|
|
605
|
-
const { window: n } = K(), [o, e] = C(), [t] = ee(), [, s] =
|
|
604
|
+
}, Ae = (n, o) => n.querySelector(`[data-block-id="${o}"]`), ys = () => {
|
|
605
|
+
const { window: n } = K(), [o, e] = C(), [t] = ee(), [, s] = A(), { undo: d, redo: a } = fe(), i = ve(), [, l] = ye(), c = be(), { savePage: p } = Dt(), [m] = k(L), [, h] = k(It), $ = (g) => {
|
|
606
606
|
g.key === "Enter" && (g.preventDefault(), o.length === 1 && h(z(o)));
|
|
607
607
|
}, w = (g) => {
|
|
608
|
-
const u = t.find((
|
|
608
|
+
const u = t.find((v) => v._id === g);
|
|
609
609
|
return u ? u._parent : null;
|
|
610
610
|
};
|
|
611
611
|
return b(() => {
|
|
@@ -614,11 +614,11 @@ const gs = () => {
|
|
|
614
614
|
e([]), s([]);
|
|
615
615
|
return;
|
|
616
616
|
}
|
|
617
|
-
if (
|
|
617
|
+
if ($(u), !m && (u.key === "Delete" || u.key === "Backspace") && (u.preventDefault(), c(o)), u.ctrlKey || u.metaKey) {
|
|
618
618
|
if (u.key === "ArrowUp") {
|
|
619
619
|
u.preventDefault();
|
|
620
|
-
const
|
|
621
|
-
|
|
620
|
+
const v = o.length > 0 ? w(o[0]) : null;
|
|
621
|
+
v && e([v]);
|
|
622
622
|
}
|
|
623
623
|
if (["z", "y", "d", "x", "c", "p", "s", "v"].includes(u.key)) {
|
|
624
624
|
if (m && ["x", "z", "v"].includes(u.key))
|
|
@@ -633,7 +633,7 @@ const gs = () => {
|
|
|
633
633
|
};
|
|
634
634
|
}, [o, e, d, c, l, a, i, m, p, n]), null;
|
|
635
635
|
}, bs = ({ block: n, label: o }) => {
|
|
636
|
-
const [, e] = C(), [, t] =
|
|
636
|
+
const [, e] = C(), [, t] = M(), [, s] = k(ke), d = je("dnd");
|
|
637
637
|
return /* @__PURE__ */ r.jsxs(
|
|
638
638
|
"div",
|
|
639
639
|
{
|
|
@@ -651,7 +651,7 @@ const gs = () => {
|
|
|
651
651
|
}
|
|
652
652
|
);
|
|
653
653
|
}, ks = ({ selectedBlockElement: n, block: o }) => {
|
|
654
|
-
const e = be(), t = ve(), [, s] = C(), [, d] =
|
|
654
|
+
const e = be(), t = ve(), [, s] = C(), [, d] = A(), [a] = k(L), { floatingStyles: i, refs: l, update: c } = Ft({
|
|
655
655
|
placement: "top-start",
|
|
656
656
|
middleware: [Pt(), Rt()],
|
|
657
657
|
elements: {
|
|
@@ -685,7 +685,7 @@ const gs = () => {
|
|
|
685
685
|
}
|
|
686
686
|
),
|
|
687
687
|
_t(f(o, "_type", "")) ? /* @__PURE__ */ r.jsx(et, { className: "hover:scale-105", onClick: () => t([o == null ? void 0 : o._id]) }) : null,
|
|
688
|
-
|
|
688
|
+
Nt(f(o, "_type", "")) ? /* @__PURE__ */ r.jsx(tt, { className: "hover:scale-105", onClick: () => e([o == null ? void 0 : o._id]) }) : null
|
|
689
689
|
] })
|
|
690
690
|
]
|
|
691
691
|
}
|
|
@@ -944,7 +944,7 @@ const gs = () => {
|
|
|
944
944
|
e(({ className: s }) => `.auto .${o(`hs-auto-mode-active${t}${s}`)}`);
|
|
945
945
|
});
|
|
946
946
|
}, js = ({ model: n }) => {
|
|
947
|
-
const [o] =
|
|
947
|
+
const [o] = At(), [e] = C(), [t] = xe(), [s] = M(), [d] = A(), [a] = k(ke), { document: i, window: l } = K(), [c] = j(i == null ? void 0 : i.getElementById("highlighted-block")), [p] = j(
|
|
948
948
|
i == null ? void 0 : i.getElementById("selected-block")
|
|
949
949
|
), [m] = j(
|
|
950
950
|
i == null ? void 0 : i.getElementById("selected-styling-block")
|
|
@@ -952,31 +952,31 @@ const gs = () => {
|
|
|
952
952
|
b(() => {
|
|
953
953
|
t ? i == null || i.documentElement.classList.add("dark") : i == null || i.documentElement.classList.remove("dark");
|
|
954
954
|
}, [t, i]);
|
|
955
|
-
const
|
|
955
|
+
const $ = f(o, "headingFont", "DM Sans"), w = f(o, "bodyFont", "DM Sans");
|
|
956
956
|
return b(() => {
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
957
|
+
if (!l || !l.tailwind)
|
|
958
|
+
return;
|
|
959
|
+
const g = f(o, "primaryColor", "#000"), u = f(o, "secondaryColor", "#FFF"), v = Ht([
|
|
960
|
+
{ color: g, name: "primary" },
|
|
961
|
+
{ color: u, name: "secondary" }
|
|
962
|
+
]), E = f(o, "roundedCorners", "0");
|
|
963
|
+
l.tailwind.config = {
|
|
964
964
|
darkMode: "class",
|
|
965
965
|
theme: {
|
|
966
966
|
fontFamily: {
|
|
967
|
-
heading: [
|
|
967
|
+
heading: [$],
|
|
968
968
|
body: [w]
|
|
969
969
|
},
|
|
970
970
|
extend: {
|
|
971
971
|
borderRadius: {
|
|
972
|
-
global: `${
|
|
972
|
+
global: `${E || "0"}px`
|
|
973
973
|
},
|
|
974
|
-
colors:
|
|
974
|
+
colors: v
|
|
975
975
|
}
|
|
976
976
|
},
|
|
977
977
|
plugins: [zt, Ut, Wt, l.tailwind.plugin.withOptions(() => ws)]
|
|
978
|
-
}
|
|
979
|
-
}, [o, l,
|
|
978
|
+
};
|
|
979
|
+
}, [o, l, $, w]), b(() => {
|
|
980
980
|
p && (p.textContent = `${F(e, (g) => `[data-block-id="${g}"]`).join(",")}{
|
|
981
981
|
outline: 1px solid ${e.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
|
|
982
982
|
}`);
|
|
@@ -993,23 +993,23 @@ const gs = () => {
|
|
|
993
993
|
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
994
994
|
}`);
|
|
995
995
|
}, [d, m]), b(() => {
|
|
996
|
-
const g = f(o, "bodyTextLightColor", "#64748b"), u = f(o, "bodyTextDarkColor", "#94a3b8"),
|
|
997
|
-
i.body.className = `font-body antialiased text-[${g}] bg-[${
|
|
996
|
+
const g = f(o, "bodyTextLightColor", "#64748b"), u = f(o, "bodyTextDarkColor", "#94a3b8"), v = f(o, "bodyBgLightColor", "#FFFFFF"), E = f(o, "bodyBgDarkColor", "#0f172a");
|
|
997
|
+
i.body.className = `font-body antialiased text-[${g}] bg-[${v}] dark:text-[${u}] dark:bg-[${E}]`;
|
|
998
998
|
}, [o, i, n]), n === "page" ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
999
|
-
|
|
999
|
+
$ && /* @__PURE__ */ r.jsx(
|
|
1000
1000
|
"link",
|
|
1001
1001
|
{
|
|
1002
1002
|
id: "heading-font",
|
|
1003
1003
|
rel: "stylesheet",
|
|
1004
1004
|
type: "text/css",
|
|
1005
|
-
href: `https://fonts.googleapis.com/css2?family=${
|
|
1005
|
+
href: `https://fonts.googleapis.com/css2?family=${$.replace(
|
|
1006
1006
|
/ /g,
|
|
1007
1007
|
"+"
|
|
1008
1008
|
)}:wght@300;400;500;600;700;800;900&display=swap`,
|
|
1009
1009
|
media: "all"
|
|
1010
1010
|
}
|
|
1011
1011
|
),
|
|
1012
|
-
w &&
|
|
1012
|
+
w && $ !== w && /* @__PURE__ */ r.jsx(
|
|
1013
1013
|
"link",
|
|
1014
1014
|
{
|
|
1015
1015
|
id: "body-font",
|
|
@@ -1022,7 +1022,7 @@ const gs = () => {
|
|
|
1022
1022
|
media: "all"
|
|
1023
1023
|
}
|
|
1024
1024
|
),
|
|
1025
|
-
|
|
1025
|
+
$ && /* @__PURE__ */ r.jsx("style", { children: `h1,h2,h3,h4,h5,h6{font-family: "${$}",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";}` })
|
|
1026
1026
|
] }) : null;
|
|
1027
1027
|
}, Cs = (n) => {
|
|
1028
1028
|
const o = {};
|
|
@@ -1065,23 +1065,23 @@ function G({ blocks: n }) {
|
|
|
1065
1065
|
}, {}),
|
|
1066
1066
|
[e, o]
|
|
1067
1067
|
);
|
|
1068
|
-
return /* @__PURE__ */ r.jsx(r.Fragment, { children:
|
|
1068
|
+
return /* @__PURE__ */ r.jsx(r.Fragment, { children: N.Children.toArray(
|
|
1069
1069
|
n.map((i, l) => {
|
|
1070
1070
|
if (d === i._id)
|
|
1071
1071
|
return null;
|
|
1072
1072
|
const c = Cs(i), p = {};
|
|
1073
1073
|
S(c) || Object.keys(c).forEach((u) => {
|
|
1074
|
-
p[u] =
|
|
1075
|
-
c[u].map((
|
|
1074
|
+
p[u] = N.Children.toArray(
|
|
1075
|
+
c[u].map((v) => /* @__PURE__ */ r.jsx(G, { blocks: [qe(o, { _id: v })] }))
|
|
1076
1076
|
);
|
|
1077
1077
|
});
|
|
1078
1078
|
const m = ge(o, { _parent: i._id });
|
|
1079
1079
|
p.children = m.length ? /* @__PURE__ */ r.jsx(G, { blocks: m }) : null;
|
|
1080
|
-
const h = Yt(i._type),
|
|
1081
|
-
if (Ke(
|
|
1080
|
+
const h = Yt(i._type), $ = f(h, "builderComponent", f(h, "component", null));
|
|
1081
|
+
if (Ke($))
|
|
1082
1082
|
return /* @__PURE__ */ r.jsx("noscript", { children: `<!-- ${i == null ? void 0 : i._type} not registered -->` });
|
|
1083
1083
|
const w = Q(h, "getBlockStateFrom") ? h == null ? void 0 : h.getBlockStateFrom(i, o) : [], g = a(w);
|
|
1084
|
-
return /* @__PURE__ */ r.jsx(he, { children:
|
|
1084
|
+
return /* @__PURE__ */ r.jsx(he, { children: N.createElement($, {
|
|
1085
1085
|
blockProps: {
|
|
1086
1086
|
"data-block-id": i._id,
|
|
1087
1087
|
"data-block-type": i._type,
|
|
@@ -1100,32 +1100,32 @@ function G({ blocks: n }) {
|
|
|
1100
1100
|
const _s = () => {
|
|
1101
1101
|
const [n] = ee(), o = S(n) ? null : /* @__PURE__ */ r.jsx(Qt, { children: /* @__PURE__ */ r.jsx(G, { blocks: ge(n, (e) => S(e._parent)) }) });
|
|
1102
1102
|
return /* @__PURE__ */ r.jsx(qt, { children: o });
|
|
1103
|
-
},
|
|
1104
|
-
const [n] = k(
|
|
1103
|
+
}, Ns = (n, o) => n.querySelector(`[data-style-id="${o}"]`), As = () => {
|
|
1104
|
+
const [n] = k(Mt), [o] = ye(), [e] = V(), [, t] = C(), s = Et(), [, d] = M(), a = oe(null), i = oe(null), [l, c] = j({ width: 0, height: 0 }), p = rs(l), [m, h] = j(0), [$, w] = j([]), [, g] = j([]), [, u] = k(Tt), [v, E] = A(), Me = W("loading", !1);
|
|
1105
1105
|
b(() => {
|
|
1106
1106
|
const { clientWidth: x, clientHeight: D } = i.current;
|
|
1107
1107
|
c({ width: x, height: D }), m === 0 && h(x);
|
|
1108
1108
|
}, [i, e, m]);
|
|
1109
|
-
const
|
|
1109
|
+
const Ee = (x, D = 0) => {
|
|
1110
1110
|
const { top: I } = x.getBoundingClientRect();
|
|
1111
1111
|
return I + D >= 0 && I - D <= window.innerHeight;
|
|
1112
1112
|
};
|
|
1113
1113
|
b(() => {
|
|
1114
1114
|
var x, D;
|
|
1115
1115
|
if (s && s.type !== "Multiple" && a.current) {
|
|
1116
|
-
const I =
|
|
1117
|
-
I && (
|
|
1116
|
+
const I = Ae(a.current.contentDocument, s._id);
|
|
1117
|
+
I && (Ee(I) || (D = (x = a.current) == null ? void 0 : x.contentWindow) == null || D.scrollTo({ top: I.offsetTop, behavior: "smooth" }), w([I]));
|
|
1118
1118
|
}
|
|
1119
1119
|
}, [s]), b(() => {
|
|
1120
|
-
if (!S(
|
|
1121
|
-
const x =
|
|
1120
|
+
if (!S(v) && a.current) {
|
|
1121
|
+
const x = Ns(
|
|
1122
1122
|
a.current.contentDocument,
|
|
1123
|
-
z(
|
|
1123
|
+
z(v).id
|
|
1124
1124
|
);
|
|
1125
1125
|
g(x ? [x] : [null]);
|
|
1126
1126
|
} else
|
|
1127
1127
|
g([null]);
|
|
1128
|
-
}, [
|
|
1128
|
+
}, [v]);
|
|
1129
1129
|
const Te = Pe(() => {
|
|
1130
1130
|
let x = ns;
|
|
1131
1131
|
return n === "offline" && (x = x.replace(
|
|
@@ -1137,7 +1137,7 @@ const _s = () => {
|
|
|
1137
1137
|
"div",
|
|
1138
1138
|
{
|
|
1139
1139
|
onClick: () => {
|
|
1140
|
-
t([]),
|
|
1140
|
+
t([]), E([]);
|
|
1141
1141
|
},
|
|
1142
1142
|
onMouseLeave: () => setTimeout(() => d(""), 300),
|
|
1143
1143
|
className: "relative mx-auto h-full w-full overflow-hidden",
|
|
@@ -1158,11 +1158,11 @@ const _s = () => {
|
|
|
1158
1158
|
ks,
|
|
1159
1159
|
{
|
|
1160
1160
|
block: s,
|
|
1161
|
-
selectedBlockElement: z(
|
|
1161
|
+
selectedBlockElement: z($)
|
|
1162
1162
|
}
|
|
1163
1163
|
),
|
|
1164
1164
|
/* @__PURE__ */ r.jsx(js, { model: "page" }),
|
|
1165
|
-
/* @__PURE__ */ r.jsx(vs, { children:
|
|
1165
|
+
/* @__PURE__ */ r.jsx(vs, { children: Me ? /* @__PURE__ */ r.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ r.jsx(we, { className: "h-full" }) }) : /* @__PURE__ */ r.jsx(_s, {}) }),
|
|
1166
1166
|
/* @__PURE__ */ r.jsx("br", {}),
|
|
1167
1167
|
/* @__PURE__ */ r.jsx("div", { id: "placeholder", className: "absolute z-[99999] max-w-full bg-green-500 transition-transform" })
|
|
1168
1168
|
]
|
|
@@ -1170,10 +1170,10 @@ const _s = () => {
|
|
|
1170
1170
|
)
|
|
1171
1171
|
}
|
|
1172
1172
|
);
|
|
1173
|
-
},
|
|
1173
|
+
}, Eo = () => /* @__PURE__ */ r.jsxs("div", { className: "flex h-full w-full flex-col", children: [
|
|
1174
1174
|
/* @__PURE__ */ r.jsx(os, {}),
|
|
1175
|
-
/* @__PURE__ */ r.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: /* @__PURE__ */ r.jsx(he, { fallback: /* @__PURE__ */ r.jsx(we, { className: "h-full" }), children: /* @__PURE__ */ r.jsx(Zt, { children: /* @__PURE__ */ r.jsx(
|
|
1175
|
+
/* @__PURE__ */ r.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: /* @__PURE__ */ r.jsx(he, { fallback: /* @__PURE__ */ r.jsx(we, { className: "h-full" }), children: /* @__PURE__ */ r.jsx(Zt, { children: /* @__PURE__ */ r.jsx(As, {}) }) }) })
|
|
1176
1176
|
] });
|
|
1177
1177
|
export {
|
|
1178
|
-
|
|
1178
|
+
Eo as default
|
|
1179
1179
|
};
|