@chaibuilder/sdk 1.1.7 → 1.1.8

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 (32) hide show
  1. package/dist/{CanvasArea-56IwfHIV.cjs → CanvasArea-0dMH8DLY.cjs} +5 -5
  2. package/dist/{CanvasArea-_gcqHG0e.js → CanvasArea-qr3Iv0Xx.js} +6 -6
  3. package/dist/{CurrentPage-ogo1pTCD.js → CurrentPage-XW_-vuBP.js} +1 -1
  4. package/dist/{CurrentPage-d3IIwt97.cjs → CurrentPage-xRSxWOUz.cjs} +1 -1
  5. package/dist/{Layers-SmpctVMM.cjs → Layers-fvXADkdU.cjs} +1 -1
  6. package/dist/{Layers-3C2qfE8G.js → Layers-urjdDTKB.js} +116 -109
  7. package/dist/{PagesPanel-sc72ECZ1.js → PagesPanel-ID_Vm6CO.js} +2 -2
  8. package/dist/{PagesPanel-n8aaGxOS.cjs → PagesPanel-SkDUfIP1.cjs} +1 -1
  9. package/dist/{ProjectPanel-C4_3bWv2.js → ProjectPanel-_XAgk4uz.js} +2 -2
  10. package/dist/{ProjectPanel-7AXA-iE5.cjs → ProjectPanel-tbw24HmR.cjs} +1 -1
  11. package/dist/Settings-CchIkXh7.cjs +1 -0
  12. package/dist/{Settings-E0XoSH8T.js → Settings-b5UJ1CbF.js} +97 -100
  13. package/dist/{SidePanels-1069fKzh.js → SidePanels-BH-IFPaj.js} +2 -2
  14. package/dist/{SidePanels-hUn7OxCz.cjs → SidePanels-cPyWHJGN.cjs} +1 -1
  15. package/dist/{add-page-modal-zJdjAwi4.cjs → add-page-modal-FSnagas1.cjs} +1 -1
  16. package/dist/{add-page-modal-FHkXgRVi.js → add-page-modal-ZvUYpd4h.js} +1 -1
  17. package/dist/core.cjs +1 -1
  18. package/dist/core.js +1 -1
  19. package/dist/{delete-page-modal-6YM8fLlU.js → delete-page-modal-4MVbQbIE.js} +1 -1
  20. package/dist/{delete-page-modal-zvGw8-RI.cjs → delete-page-modal-DAFOspX2.cjs} +1 -1
  21. package/dist/{index-QWyJwEV6.js → index-LOLasIJD.js} +3 -3
  22. package/dist/{index--Qs9Me8k.cjs → index-rhyb2TB9.cjs} +1 -1
  23. package/dist/{page-viewer-oMx73Vh5.cjs → page-viewer-V6dlnIHN.cjs} +1 -1
  24. package/dist/{page-viewer-xoXV9sNk.js → page-viewer-r_ZdpaXh.js} +2 -2
  25. package/dist/{project-general-setting-asVlFesb.js → project-general-setting-6kSqNVU3.js} +1 -1
  26. package/dist/{project-general-setting-jUTxNFN_.cjs → project-general-setting-Dh5ki1wJ.cjs} +1 -1
  27. package/dist/{single-page-detail-lsJhbpKe.cjs → single-page-detail-E3QAv3RO.cjs} +1 -1
  28. package/dist/{single-page-detail-qjCS5xcG.js → single-page-detail-LTirOwox.js} +2 -2
  29. package/dist/studio.cjs +1 -1
  30. package/dist/studio.js +1 -1
  31. package/package.json +1 -1
  32. package/dist/Settings-5FA08bpV.cjs +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";var We=Object.defineProperty;var $e=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var z=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),x=require("lodash"),M=require("@radix-ui/react-icons"),r=require("./index-U_pW4Tkc.cjs"),Ue=require("react-i18next"),_=require("jotai"),he=require("react-dom"),Z=require("./MODIFIERS-WFzDQfiT.cjs"),Q=require("./index--Qs9Me8k.cjs"),ze=require("react-quill"),Ye=require("./useAddBlockByDrop-qOKe8QVt.cjs"),Se=require("flagged"),Ke=require("@floating-ui/dom"),ge=require("@floating-ui/react-dom"),Je=require("@react-hookz/web"),Xe=require("@bobthered/tailwindcss-palette-generator"),Ve=require("react-wrap-balancer"),Ze=require("tailwind-merge"),Ge=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.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("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const Qe=()=>{const{undoCount:e,redoCount:t,undo:n,redo:a}=r.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(M.ResetIcon,{})}),s.jsxRuntimeExports.jsx(r.Button,{disabled:!t,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(M.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function et(){const[e,t]=r.useDarkMode(),{t:n}=Ue.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(r.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
1
+ "use strict";var We=Object.defineProperty;var $e=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var z=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),x=require("lodash"),M=require("@radix-ui/react-icons"),r=require("./index-U_pW4Tkc.cjs"),Ue=require("react-i18next"),_=require("jotai"),he=require("react-dom"),Z=require("./MODIFIERS-WFzDQfiT.cjs"),Q=require("./index-rhyb2TB9.cjs"),ze=require("react-quill"),Ye=require("./useAddBlockByDrop-qOKe8QVt.cjs"),Se=require("flagged"),Ke=require("@floating-ui/dom"),ge=require("@floating-ui/react-dom"),Je=require("@react-hookz/web"),Xe=require("@bobthered/tailwindcss-palette-generator"),Ve=require("react-wrap-balancer"),Ze=require("tailwind-merge"),Ge=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.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("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const Qe=()=>{const{undoCount:e,redoCount:t,undo:n,redo:a}=r.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(M.ResetIcon,{})}),s.jsxRuntimeExports.jsx(r.Button,{disabled:!t,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(M.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function et(){const[e,t]=r.useDarkMode(),{t:n}=Ue.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(r.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"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:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
3
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 me=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.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"}})]}),ye=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(M.MobileIcon,{}),width:400},{title:"Mobile landscape (SM)",content:"Styles set here are applied at 640px and up unless edited at higher breakpoint",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(M.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(me,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(me,{landscape:!0}),width:1024},{title:"Desktop (XL)",content:"Styles set here are applied at 1280px and up unless edited at higher breakpoint",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(M.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(M.DesktopIcon,{}),width:1920}],tt=({title:e,content:t,currentBreakpoint:n,breakpoint:a,width:l,icon:i,onClick:u})=>s.jsxRuntimeExports.jsxs(r.HoverCard,{children:[s.jsxRuntimeExports.jsx(r.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(r.Button,{onClick:()=>u(l),size:"sm",variant:a===n?"secondary":"ghost",children:i})}),s.jsxRuntimeExports.jsx(r.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:e}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),nt=()=>{const[,e,t]=r.useCanvasWidth(),[n,a]=r.useSelectedBreakpoints(),l=i=>{n.includes(i)?n.length>2&&a(n.filter(u=>u!==i)):a(u=>[...u,i])};return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[x.map(ye.filter(i=>x.includes(n,x.toUpper(i.breakpoint))),i=>m.createElement(tt,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(r.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(r.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(M.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(r.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(r.DropdownMenuLabel,{children:"Breakpoints"}),s.jsxRuntimeExports.jsx(r.DropdownMenuSeparator,{}),x.map(ye,i=>s.jsxRuntimeExports.jsx(r.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>l(x.toUpper(i.breakpoint)),checked:x.includes(n,x.toUpper(i.breakpoint)),children:i.title},i.breakpoint))]})]})]})},st=()=>{const[e]=r.useSetAllBlocks(),{createSnapshot:t}=r.useCanvasHistory(),[,n]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),l=m.useCallback(()=>{e([]),n([]),a([]),t()},[e,t]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(r.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(M.EraserIcon,{})," Clear"]})}),s.jsxRuntimeExports.jsxs(r.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(r.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:"Clear whole canvas?"}),s.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),s.jsxRuntimeExports.jsxs(r.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogCancel,{children:"Cancel"}),s.jsxRuntimeExports.jsx(r.AlertDialogAction,{onClick:l,children:"Yes"})]})]})]})})},rt=()=>{const e=r.useFeatureSupport("darkMode",!1),[t]=r.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(et,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(nt,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[s.jsxRuntimeExports.jsx(M.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[x.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(Qe,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(st,{})]})]})},ot=`<!doctype html>
4
4
  <html class="scroll-smooth h-full overflow-y-auto">
@@ -51,9 +51,9 @@
51
51
  object-assign
52
52
  (c) Sindre Sorhus
53
53
  @license MIT
54
- */var se,ve;function at(){if(ve)return se;ve=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function a(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function l(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var u={},o=0;o<10;o++)u["_"+String.fromCharCode(o)]=o;var p=Object.getOwnPropertyNames(u).map(function(h){return u[h]});if(p.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(h){d[h]=h}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return se=l()?Object.assign:function(i,u){for(var o,p=a(i),d,h=1;h<arguments.length;h++){o=Object(arguments[h]);for(var g in o)t.call(o,g)&&(p[g]=o[g]);if(e){d=e(o);for(var w=0;w<d.length;w++)n.call(o,d[w])&&(p[d[w]]=o[d[w]])}}return p},se}var re,je;function pe(){if(je)return re;je=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return re=e,re}var oe,be;function Ce(){return be||(be=1,oe=Function.call.bind(Object.prototype.hasOwnProperty)),oe}var ie,Ee;function lt(){if(Ee)return ie;Ee=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=pe(),n={},a=Ce();e=function(i){var u="Warning: "+i;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function l(i,u,o,p,d){if(process.env.NODE_ENV!=="production"){for(var h in i)if(a(i,h)){var g;try{if(typeof i[h]!="function"){var w=Error((p||"React class")+": "+o+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw w.name="Invariant Violation",w}g=i[h](u,h,p,o,null,t)}catch(q){g=q}if(g&&!(g instanceof Error)&&e((p||"React class")+": type specification of "+o+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof g+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),g instanceof Error&&!(g.message in n)){n[g.message]=!0;var I=d?d():"";e("Failed "+o+" type: "+g.message+(I??""))}}}}return l.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ie=l,ie}var ae,ke;function ct(){if(ke)return ae;ke=1;var e=Q.reactIsExports,t=at(),n=pe(),a=Ce(),l=lt(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var p="Warning: "+o;typeof console<"u"&&console.error(p);try{throw new Error(p)}catch{}});function u(){return null}return ae=function(o,p){var d=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function g(c){var f=c&&(d&&c[d]||c[h]);if(typeof f=="function")return f}var w="<<anonymous>>",I={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:W(),arrayOf:Y,element:K(),elementType:N(),instanceOf:D,node:Me(),objectOf:H,oneOf:F,oneOfType:Pe,shape:Le,exact:_e};function q(c,f){return c===f?c!==0||1/c===1/f:c!==c&&f!==f}function k(c,f){this.message=c,this.data=f&&typeof f=="object"?f:{},this.stack=""}k.prototype=Error.prototype;function A(c){if(process.env.NODE_ENV!=="production")var f={},R=0;function b(S,j,E,C,B,T,L){if(C=C||w,T=T||E,L!==n){if(p){var O=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw O.name="Invariant Violation",O}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var J=C+":"+E;!f[J]&&R<3&&(i("You are manually calling a React.PropTypes validation function for the `"+T+"` prop on `"+C+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),f[J]=!0,R++)}}return j[E]==null?S?j[E]===null?new k("The "+B+" `"+T+"` is marked as required "+("in `"+C+"`, but its value is `null`.")):new k("The "+B+" `"+T+"` is marked as required in "+("`"+C+"`, but its value is `undefined`.")):null:c(j,E,C,B,T)}var v=b.bind(null,!1);return v.isRequired=b.bind(null,!0),v}function y(c){function f(R,b,v,S,j,E){var C=R[b],B=$(C);if(B!==c){var T=X(C);return new k("Invalid "+S+" `"+j+"` of type "+("`"+T+"` supplied to `"+v+"`, expected ")+("`"+c+"`."),{expectedType:c})}return null}return A(f)}function W(){return A(u)}function Y(c){function f(R,b,v,S,j){if(typeof c!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside arrayOf.");var E=R[b];if(!Array.isArray(E)){var C=$(E);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an array."))}for(var B=0;B<E.length;B++){var T=c(E,B,v,S,j+"["+B+"]",n);if(T instanceof Error)return T}return null}return A(f)}function K(){function c(f,R,b,v,S){var j=f[R];if(!o(j)){var E=$(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement."))}return null}return A(c)}function N(){function c(f,R,b,v,S){var j=f[R];if(!e.isValidElementType(j)){var E=$(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement type."))}return null}return A(c)}function D(c){function f(R,b,v,S,j){if(!(R[b]instanceof c)){var E=c.name||w,C=He(R[b]);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected ")+("instance of `"+E+"`."))}return null}return A(f)}function F(c){if(!Array.isArray(c))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),u;function f(R,b,v,S,j){for(var E=R[b],C=0;C<c.length;C++)if(q(E,c[C]))return null;var B=JSON.stringify(c,function(L,O){var J=X(O);return J==="symbol"?String(O):O});return new k("Invalid "+S+" `"+j+"` of value `"+String(E)+"` "+("supplied to `"+v+"`, expected one of "+B+"."))}return A(f)}function H(c){function f(R,b,v,S,j){if(typeof c!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside objectOf.");var E=R[b],C=$(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an object."));for(var B in E)if(a(E,B)){var T=c(E,B,v,S,j+"."+B,n);if(T instanceof Error)return T}return null}return A(f)}function Pe(c){if(!Array.isArray(c))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var f=0;f<c.length;f++){var R=c[f];if(typeof R!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Fe(R)+" at index "+f+"."),u}function b(v,S,j,E,C){for(var B=[],T=0;T<c.length;T++){var L=c[T],O=L(v,S,j,E,C,n);if(O==null)return null;O.data&&a(O.data,"expectedType")&&B.push(O.data.expectedType)}var J=B.length>0?", expected one of type ["+B.join(", ")+"]":"";return new k("Invalid "+E+" `"+C+"` supplied to "+("`"+j+"`"+J+"."))}return A(b)}function Me(){function c(f,R,b,v,S){return ee(f[R])?null:new k("Invalid "+v+" `"+S+"` supplied to "+("`"+b+"`, expected a ReactNode."))}return A(c)}function xe(c,f,R,b,v){return new k((c||"React class")+": "+f+" type `"+R+"."+b+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+v+"`.")}function Le(c){function f(R,b,v,S,j){var E=R[b],C=$(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));for(var B in c){var T=c[B];if(typeof T!="function")return xe(v,S,j,B,X(T));var L=T(E,B,v,S,j+"."+B,n);if(L)return L}return null}return A(f)}function _e(c){function f(R,b,v,S,j){var E=R[b],C=$(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));var B=t({},R[b],c);for(var T in B){var L=c[T];if(a(c,T)&&typeof L!="function")return xe(v,S,j,T,X(L));if(!L)return new k("Invalid "+S+" `"+j+"` key `"+T+"` supplied to `"+v+"`.\nBad object: "+JSON.stringify(R[b],null," ")+`
55
- Valid keys: `+JSON.stringify(Object.keys(c),null," "));var O=L(E,T,v,S,j+"."+T,n);if(O)return O}return null}return A(f)}function ee(c){switch(typeof c){case"number":case"string":case"undefined":return!0;case"boolean":return!c;case"object":if(Array.isArray(c))return c.every(ee);if(c===null||o(c))return!0;var f=g(c);if(f){var R=f.call(c),b;if(f!==c.entries){for(;!(b=R.next()).done;)if(!ee(b.value))return!1}else for(;!(b=R.next()).done;){var v=b.value;if(v&&!ee(v[1]))return!1}}else return!1;return!0;default:return!1}}function Ne(c,f){return c==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function $(c){var f=typeof c;return Array.isArray(c)?"array":c instanceof RegExp?"object":Ne(f,c)?"symbol":f}function X(c){if(typeof c>"u"||c===null)return""+c;var f=$(c);if(f==="object"){if(c instanceof Date)return"date";if(c instanceof RegExp)return"regexp"}return f}function Fe(c){var f=X(c);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function He(c){return!c.constructor||!c.constructor.name?w:c.constructor.name}return I.checkPropTypes=l,I.resetWarningCache=l.resetWarningCache,I.PropTypes=I,I},ae}var le,Re;function dt(){if(Re)return le;Re=1;var e=pe();function t(){}function n(){}return n.resetWarningCache=t,le=function(){function a(u,o,p,d,h,g){if(g!==e){var w=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw w.name="Invariant Violation",w}}a.isRequired=a;function l(){return a}var i={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:l,element:a,elementType:a,instanceOf:l,node:a,objectOf:l,oneOf:l,oneOfType:l,shape:l,exact:l,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},le}var Wt=te.exports;if(process.env.NODE_ENV!=="production"){var ut=Q.reactIsExports,pt=!0;te.exports=ct()(ut.isElement,pt)}else te.exports=dt()();var ft=te.exports;const P=Z.getDefaultExportFromCjs(ft);let Te,Ie;typeof document<"u"&&(Te=document);typeof window<"u"&&(Ie=window);const Be=m.createContext({document:Te,window:Ie}),ne=()=>m.useContext(Be),{Provider:xt,Consumer:$t}=Be;class Ae extends m.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return m.Children.only(this.props.children)}}z(Ae,"propTypes",{children:P.element.isRequired,contentDidMount:P.func.isRequired,contentDidUpdate:P.func.isRequired});class de extends m.Component{constructor(n,a){super(n,a);z(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:a}=this.props;typeof a=="function"?a(n):a&&(a.current=n)});z(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});z(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=m.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 n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const a=this.props.contentDidMount,l=this.props.contentDidUpdate,i=n.defaultView||n.parentView,u=s.jsxRuntimeExports.jsx(Ae,{contentDidMount:a,contentDidUpdate:l,children:s.jsxRuntimeExports.jsx(xt,{value:{document:n,window:i},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),o=this.getMountTarget();return[he.createPortal(this.props.head,this.getDoc().head),he.createPortal(u,o)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}z(de,"propTypes",{style:P.object,head:P.node,initialContent:P.string,mountTarget:P.string,contentDidMount:P.func,contentDidUpdate:P.func,children:P.oneOfType([P.element,P.arrayOf(P.element)])}),z(de,"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 ht=m.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(de,{...e,forwardedRef:t}));let U=null,G=[],V=null,De=null;function gt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),a=parseInt(t.paddingTop,10),l=parseInt(t.paddingRight,10),i=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:a,paddingRight:l,paddingBottom:i}}const we=(e,t,n)=>{if(!U)return;const a=e.getBoundingClientRect(),l=U==null?void 0:U.getElementById("placeholder"),{paddingLeft:i,paddingTop:u,paddingRight:o,paddingBottom:p}=gt(e);l.style.width=t==="vertical"?a.width-i-o+"px":"2px",l.style.height=t==="vertical"?"2px":a.height-u-p+"px",l.style.display="block";const d=G.reduce((h,g)=>Math.abs(g-n)<Math.abs(h-n)?g:h);De=G.indexOf(d),t==="vertical"?(l.style.top=e.offsetTop+d+"px",l.style.left=e.offsetLeft+i+"px"):(l.style.top=e.offsetTop+u+"px",l.style.left=e.offsetLeft+d+"px")},mt=e=>{const t=Oe(e),n=window.getComputedStyle(e),a=t==="horizontal",l=parseInt(n.paddingLeft),i=parseInt(n.paddingTop);let u=a?l:i;G=[u],Array.from(e.children).forEach(o=>{const p=window.getComputedStyle(o),d=parseInt(a?p.marginLeft+p.marginRight:p.marginTop+p.marginBottom),h=a?o.offsetWidth:o.offsetHeight;G.push(u+h+d),u+=h+d})};function Oe(e){const t=window.getComputedStyle(e).display,n=window.getComputedStyle(e).flexDirection;if(t==="flex")return n==="column"||n==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const a=window.getComputedStyle(e).gridTemplateRows,l=window.getComputedStyle(e).gridTemplateColumns;if(a.includes("auto"))return"vertical";if(l.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const yt=x.throttle(e=>{const t=e.target,n=Oe(t);if(n==="vertical"){const a=e.clientY-t.offsetTop;we(t,n,a)}else{const a=e.clientX-t.offsetLeft;we(t,n,a)}},200),vt=e=>{e.preventDefault(),e.stopPropagation(),yt(e)};function ce(){const e=U==null?void 0:U.getElementById("placeholder");e.style.display="none"}const jt=()=>{const{document:e}=ne(),[t,n]=_.useAtom(r.draggingFlagAtom),a=Ye.useAddBlockByDrop(),l=Se.useFeature("dnd"),[,i]=r.useHighlightBlockId(),[,u]=r.useSelectedBlockIds();return U=e,{isDragging:t,"data-dnd":"branch",onDragOver:l?vt:x.noop,onDrop:l?o=>{V==null||V.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const p=JSON.parse(o.dataTransfer.getData("text/plain"));let d=o.target.getAttribute("data-block-id");d===null&&(d=o.target.parentElement.getAttribute("data-block-id")),a({block:p,dropTargetId:d||null,relativeIndex:De}),n(!1),ce(),setTimeout(()=>{ce()},300)}:x.noop,onDragEnter:l?o=>{const p=o;V=p.target,p.stopPropagation(),p.preventDefault(),G=[];const d=p.target;mt(d),d.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),i(""),u([])}:x.noop,onDragLeave:l?o=>{const p=o;V=null,p.stopPropagation(),p.preventDefault(),p.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:x.noop,onMouseOut:l?()=>{n(!1),ce()}:x.noop}};function fe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function bt(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Et=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=r.useUpdateBlocksProps(),[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[l,i]=_.useAtom(r.inlineEditingActiveAtom);return u=>{var w;if(l)return;const o=fe(u.target),p=o.getAttribute("data-block-type");if(!p||!e.includes(p))return;const d=o.cloneNode(!0);o.style.display="none",Array.from(d.attributes).forEach(I=>{I.name!=="class"&&d.removeAttribute(I.name)}),p==="Text"&&(d.style.display="inline-block"),o.parentNode.insertBefore(d,o.nextSibling);const h=new ze.Quill(d,{placeholder:"Type here..."});function g(){const I=h.getText(0,h.getLength());t([o.getAttribute("data-block-id")],{content:I}),o.removeAttribute("style"),d.removeEventListener("blur",g,!0),bt(h),i(""),a("")}d.addEventListener("blur",g,!0),h.focus(),(w=d.querySelector(".ql-clipboard"))==null||w.remove(),n([]),i(o.getAttribute("data-block-id"))}},kt=()=>{const[,e]=r.useSelectedStylingBlocks(),[,t]=r.useSelectedBlockIds(),[n]=_.useAtom(r.inlineEditingActiveAtom);return a=>{if(n)return;a.stopPropagation();const l=fe(a.target);if(l!=null&&l.getAttribute("data-block-parent")){const i=l.getAttribute("data-style-prop"),u=l.getAttribute("data-style-id"),o=l.getAttribute("data-block-parent");e([{id:u,prop:i,blockId:o}]),t([o])}else l!=null&&l.getAttribute("data-block-id")&&t([l.getAttribute("data-block-id")])}},Rt=x.throttle((e,t)=>{const n=fe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),wt=()=>{const[,e]=r.useHighlightBlockId(),[t]=_.useAtom(r.inlineEditingActiveAtom);return n=>{t||Rt(n,e)}},St=({children:e})=>{const{document:t}=ne(),[n]=r.useSelectedBlockIds(),[a,l]=r.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!x.isEmpty(a))return;const d=qe(t,x.first(n));if(d){const h=d.getAttribute("data-style-prop");if(h){const g=d.getAttribute("data-style-id"),w=d.getAttribute("data-block-parent");l([{id:g,prop:h,blockId:w}])}}},100)},[t,n,l,a]);const i=Et(),u=kt(),o=wt(),p=jt();return s.jsxRuntimeExports.jsx("div",{id:"canvas",onClick:u,onDoubleClick:i,onMouseMove:o,...x.omit(p,"isDragging"),className:"relative h-screen max-w-full "+(p.isDragging?"dragging":""),children:e})},qe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ct=()=>{const{window:e}=ne(),[t,n]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),{undo:l,redo:i}=r.useCanvasHistory(),u=r.useDuplicateBlocks(),[,o]=r.useCutBlockIds(),[,p]=r.useCopyBlockIds(),{pasteBlocks:d}=r.usePasteBlocks(),[,h]=r.usePreviewMode(),g=r.useRemoveBlocks(),{savePage:w}=r.useSavePage(),[I]=_.useAtom(r.inlineEditingActiveAtom),[,q]=_.useAtom(r.editLayerNameAtom),k=A=>{A.key==="Enter"&&(A.preventDefault(),t.length===1&&q(x.first(t)))};return m.useEffect(()=>{const A=y=>{if(y.key==="Escape"){n([]),a([]);return}if(k(y),!I&&(y.key==="Delete"||y.key==="Backspace")&&(y.preventDefault(),g(t)),y.ctrlKey||y.metaKey){if(["z","y","d","x","c","p","s","v"].includes(y.key)){if(I&&["x","z","v"].includes(y.key))return!0;y.preventDefault()}y.key==="s"&&(y.stopPropagation(),y.preventDefault(),w()),y.key==="z"&&l(),y.key==="y"&&i(),y.key==="d"&&u(t),y.key==="x"&&o(t),y.key==="c"&&p(t),y.key==="v"&&t.length>0&&d(t[0])}};return e.removeEventListener("keydown",A),e.addEventListener("keydown",A),()=>{e.removeEventListener("keydown",A)}},[t,n,l,g,h,i,u,o,p,d,I,w,e]),null},Tt=({block:e,label:t})=>{const[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[,l]=_.useAtom(r.draggedBlockIdAtom),i=Se.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:i?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(x.pick(e,["_id","_type"]))),l(e._id),setTimeout(()=>{n([]),a(null)},200)},children:[s.jsxRuntimeExports.jsx(M.DragHandleDots2Icon,{}),t]})},It=({selectedBlockElement:e,block:t})=>{const n=r.useRemoveBlocks(),a=r.useDuplicateBlocks(),[,l]=r.useSelectedBlockIds(),[,i]=r.useSelectedStylingBlocks(),{floatingStyles:u,refs:o,update:p}=ge.useFloating({placement:"top-start",middleware:[ge.shift(),Ke.flip()],elements:{reference:e}});Je.useResizeObserver(e,()=>p(),e!==null);const d=x.get(t,"_parent",null),h=x.isEmpty(x.get(t,"_name",""))?x.get(t,"_type",""):x.get(t,"_name","");return!e||!t?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:o.setFloating,style:u,onClick:g=>{g.stopPropagation(),g.preventDefault()},onKeyDown:g=>g.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Tt,{label:h,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[d&&s.jsxRuntimeExports.jsx(M.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{i([]),l([d])}}),r.canDuplicateBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(M.CopyIcon,{className:"hover:scale-105 ",onClick:()=>a([t==null?void 0:t._id])}):null,r.canDeleteBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(M.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Bt=({model:e})=>{const[t]=r.useBrandingOptions(),[n]=r.useSelectedBlockIds(),[a]=r.useDarkMode(),[l]=r.useHighlightBlockId(),[i]=r.useSelectedStylingBlocks(),[u]=_.useAtom(r.draggedBlockIdAtom),{document:o,window:p}=ne(),[d]=m.useState(o==null?void 0:o.getElementById("highlighted-block")),[h]=m.useState(o==null?void 0:o.getElementById("selected-block")),[g]=m.useState(o==null?void 0:o.getElementById("selected-styling-block")),[w]=m.useState(o==null?void 0:o.getElementById("dragged-block"));m.useEffect(()=>{a?o==null||o.documentElement.classList.add("dark"):o==null||o.documentElement.classList.remove("dark")},[a,o]);const I=x.get(t,"headingFont","DM Sans"),q=x.get(t,"bodyFont","DM Sans");return m.useEffect(()=>{const k=x.get(t,"primaryColor","#000"),A=x.get(t,"secondaryColor","#FFF"),y=Xe.tailwindcssPaletteGenerator({colors:[k,A],names:["primary","secondary"]});y.primary.DEFAULT=k,y.secondary.DEFAULT=A;const W=x.get(t,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[I],body:[q]},extend:{borderRadius:{global:`${W||"0"}px`},colors:y}},plugins:[p.tailwind.plugin.withOptions(({prefix:Y="ui"}={})=>({addVariant:K})=>{for(const N of["open","checked","selected","active","disabled"])K(`${Y}-${N}`,[`&[data-headlessui-state~="${N}"]`,`:where([data-headlessui-state~="${N}"]) &`]),K(`${Y}-not-${N}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${N}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${N}"])) &:not([data-headlessui-state])`])})]})},[t,p,I,q]),m.useEffect(()=>{h&&(h.textContent=`${x.map(n,k=>`[data-block-id="${k}"]`).join(",")}{
54
+ */var se,ve;function at(){if(ve)return se;ve=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function a(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function l(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var u={},o=0;o<10;o++)u["_"+String.fromCharCode(o)]=o;var p=Object.getOwnPropertyNames(u).map(function(h){return u[h]});if(p.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(h){d[h]=h}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return se=l()?Object.assign:function(i,u){for(var o,p=a(i),d,h=1;h<arguments.length;h++){o=Object(arguments[h]);for(var g in o)t.call(o,g)&&(p[g]=o[g]);if(e){d=e(o);for(var R=0;R<d.length;R++)n.call(o,d[R])&&(p[d[R]]=o[d[R]])}}return p},se}var re,je;function pe(){if(je)return re;je=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return re=e,re}var oe,be;function Ce(){return be||(be=1,oe=Function.call.bind(Object.prototype.hasOwnProperty)),oe}var ie,Ee;function lt(){if(Ee)return ie;Ee=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=pe(),n={},a=Ce();e=function(i){var u="Warning: "+i;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function l(i,u,o,p,d){if(process.env.NODE_ENV!=="production"){for(var h in i)if(a(i,h)){var g;try{if(typeof i[h]!="function"){var R=Error((p||"React class")+": "+o+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}g=i[h](u,h,p,o,null,t)}catch(q){g=q}if(g&&!(g instanceof Error)&&e((p||"React class")+": type specification of "+o+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof g+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),g instanceof Error&&!(g.message in n)){n[g.message]=!0;var I=d?d():"";e("Failed "+o+" type: "+g.message+(I??""))}}}}return l.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ie=l,ie}var ae,ke;function ct(){if(ke)return ae;ke=1;var e=Q.reactIsExports,t=at(),n=pe(),a=Ce(),l=lt(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var p="Warning: "+o;typeof console<"u"&&console.error(p);try{throw new Error(p)}catch{}});function u(){return null}return ae=function(o,p){var d=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function g(c){var f=c&&(d&&c[d]||c[h]);if(typeof f=="function")return f}var R="<<anonymous>>",I={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:W(),arrayOf:Y,element:K(),elementType:N(),instanceOf:D,node:Me(),objectOf:H,oneOf:F,oneOfType:Pe,shape:Le,exact:_e};function q(c,f){return c===f?c!==0||1/c===1/f:c!==c&&f!==f}function k(c,f){this.message=c,this.data=f&&typeof f=="object"?f:{},this.stack=""}k.prototype=Error.prototype;function A(c){if(process.env.NODE_ENV!=="production")var f={},w=0;function b(S,j,E,C,B,T,L){if(C=C||R,T=T||E,L!==n){if(p){var O=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw O.name="Invariant Violation",O}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var J=C+":"+E;!f[J]&&w<3&&(i("You are manually calling a React.PropTypes validation function for the `"+T+"` prop on `"+C+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),f[J]=!0,w++)}}return j[E]==null?S?j[E]===null?new k("The "+B+" `"+T+"` is marked as required "+("in `"+C+"`, but its value is `null`.")):new k("The "+B+" `"+T+"` is marked as required in "+("`"+C+"`, but its value is `undefined`.")):null:c(j,E,C,B,T)}var v=b.bind(null,!1);return v.isRequired=b.bind(null,!0),v}function y(c){function f(w,b,v,S,j,E){var C=w[b],B=$(C);if(B!==c){var T=X(C);return new k("Invalid "+S+" `"+j+"` of type "+("`"+T+"` supplied to `"+v+"`, expected ")+("`"+c+"`."),{expectedType:c})}return null}return A(f)}function W(){return A(u)}function Y(c){function f(w,b,v,S,j){if(typeof c!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside arrayOf.");var E=w[b];if(!Array.isArray(E)){var C=$(E);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an array."))}for(var B=0;B<E.length;B++){var T=c(E,B,v,S,j+"["+B+"]",n);if(T instanceof Error)return T}return null}return A(f)}function K(){function c(f,w,b,v,S){var j=f[w];if(!o(j)){var E=$(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement."))}return null}return A(c)}function N(){function c(f,w,b,v,S){var j=f[w];if(!e.isValidElementType(j)){var E=$(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement type."))}return null}return A(c)}function D(c){function f(w,b,v,S,j){if(!(w[b]instanceof c)){var E=c.name||R,C=He(w[b]);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected ")+("instance of `"+E+"`."))}return null}return A(f)}function F(c){if(!Array.isArray(c))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),u;function f(w,b,v,S,j){for(var E=w[b],C=0;C<c.length;C++)if(q(E,c[C]))return null;var B=JSON.stringify(c,function(L,O){var J=X(O);return J==="symbol"?String(O):O});return new k("Invalid "+S+" `"+j+"` of value `"+String(E)+"` "+("supplied to `"+v+"`, expected one of "+B+"."))}return A(f)}function H(c){function f(w,b,v,S,j){if(typeof c!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside objectOf.");var E=w[b],C=$(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an object."));for(var B in E)if(a(E,B)){var T=c(E,B,v,S,j+"."+B,n);if(T instanceof Error)return T}return null}return A(f)}function Pe(c){if(!Array.isArray(c))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var f=0;f<c.length;f++){var w=c[f];if(typeof w!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Fe(w)+" at index "+f+"."),u}function b(v,S,j,E,C){for(var B=[],T=0;T<c.length;T++){var L=c[T],O=L(v,S,j,E,C,n);if(O==null)return null;O.data&&a(O.data,"expectedType")&&B.push(O.data.expectedType)}var J=B.length>0?", expected one of type ["+B.join(", ")+"]":"";return new k("Invalid "+E+" `"+C+"` supplied to "+("`"+j+"`"+J+"."))}return A(b)}function Me(){function c(f,w,b,v,S){return ee(f[w])?null:new k("Invalid "+v+" `"+S+"` supplied to "+("`"+b+"`, expected a ReactNode."))}return A(c)}function xe(c,f,w,b,v){return new k((c||"React class")+": "+f+" type `"+w+"."+b+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+v+"`.")}function Le(c){function f(w,b,v,S,j){var E=w[b],C=$(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));for(var B in c){var T=c[B];if(typeof T!="function")return xe(v,S,j,B,X(T));var L=T(E,B,v,S,j+"."+B,n);if(L)return L}return null}return A(f)}function _e(c){function f(w,b,v,S,j){var E=w[b],C=$(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));var B=t({},w[b],c);for(var T in B){var L=c[T];if(a(c,T)&&typeof L!="function")return xe(v,S,j,T,X(L));if(!L)return new k("Invalid "+S+" `"+j+"` key `"+T+"` supplied to `"+v+"`.\nBad object: "+JSON.stringify(w[b],null," ")+`
55
+ Valid keys: `+JSON.stringify(Object.keys(c),null," "));var O=L(E,T,v,S,j+"."+T,n);if(O)return O}return null}return A(f)}function ee(c){switch(typeof c){case"number":case"string":case"undefined":return!0;case"boolean":return!c;case"object":if(Array.isArray(c))return c.every(ee);if(c===null||o(c))return!0;var f=g(c);if(f){var w=f.call(c),b;if(f!==c.entries){for(;!(b=w.next()).done;)if(!ee(b.value))return!1}else for(;!(b=w.next()).done;){var v=b.value;if(v&&!ee(v[1]))return!1}}else return!1;return!0;default:return!1}}function Ne(c,f){return c==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function $(c){var f=typeof c;return Array.isArray(c)?"array":c instanceof RegExp?"object":Ne(f,c)?"symbol":f}function X(c){if(typeof c>"u"||c===null)return""+c;var f=$(c);if(f==="object"){if(c instanceof Date)return"date";if(c instanceof RegExp)return"regexp"}return f}function Fe(c){var f=X(c);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function He(c){return!c.constructor||!c.constructor.name?R:c.constructor.name}return I.checkPropTypes=l,I.resetWarningCache=l.resetWarningCache,I.PropTypes=I,I},ae}var le,we;function dt(){if(we)return le;we=1;var e=pe();function t(){}function n(){}return n.resetWarningCache=t,le=function(){function a(u,o,p,d,h,g){if(g!==e){var R=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw R.name="Invariant Violation",R}}a.isRequired=a;function l(){return a}var i={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:l,element:a,elementType:a,instanceOf:l,node:a,objectOf:l,oneOf:l,oneOfType:l,shape:l,exact:l,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},le}var Wt=te.exports;if(process.env.NODE_ENV!=="production"){var ut=Q.reactIsExports,pt=!0;te.exports=ct()(ut.isElement,pt)}else te.exports=dt()();var ft=te.exports;const P=Z.getDefaultExportFromCjs(ft);let Te,Ie;typeof document<"u"&&(Te=document);typeof window<"u"&&(Ie=window);const Be=m.createContext({document:Te,window:Ie}),ne=()=>m.useContext(Be),{Provider:xt,Consumer:$t}=Be;class Ae extends m.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return m.Children.only(this.props.children)}}z(Ae,"propTypes",{children:P.element.isRequired,contentDidMount:P.func.isRequired,contentDidUpdate:P.func.isRequired});class de extends m.Component{constructor(n,a){super(n,a);z(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:a}=this.props;typeof a=="function"?a(n):a&&(a.current=n)});z(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});z(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=m.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 n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const a=this.props.contentDidMount,l=this.props.contentDidUpdate,i=n.defaultView||n.parentView,u=s.jsxRuntimeExports.jsx(Ae,{contentDidMount:a,contentDidUpdate:l,children:s.jsxRuntimeExports.jsx(xt,{value:{document:n,window:i},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),o=this.getMountTarget();return[he.createPortal(this.props.head,this.getDoc().head),he.createPortal(u,o)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}z(de,"propTypes",{style:P.object,head:P.node,initialContent:P.string,mountTarget:P.string,contentDidMount:P.func,contentDidUpdate:P.func,children:P.oneOfType([P.element,P.arrayOf(P.element)])}),z(de,"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 ht=m.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(de,{...e,forwardedRef:t}));let U=null,G=[],V=null,De=null;function gt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),a=parseInt(t.paddingTop,10),l=parseInt(t.paddingRight,10),i=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:a,paddingRight:l,paddingBottom:i}}const Re=(e,t,n)=>{if(!U)return;const a=e.getBoundingClientRect(),l=U==null?void 0:U.getElementById("placeholder"),{paddingLeft:i,paddingTop:u,paddingRight:o,paddingBottom:p}=gt(e);l.style.width=t==="vertical"?a.width-i-o+"px":"2px",l.style.height=t==="vertical"?"2px":a.height-u-p+"px",l.style.display="block";const d=G.reduce((h,g)=>Math.abs(g-n)<Math.abs(h-n)?g:h);De=G.indexOf(d),t==="vertical"?(l.style.top=e.offsetTop+d+"px",l.style.left=e.offsetLeft+i+"px"):(l.style.top=e.offsetTop+u+"px",l.style.left=e.offsetLeft+d+"px")},mt=e=>{const t=Oe(e),n=window.getComputedStyle(e),a=t==="horizontal",l=parseInt(n.paddingLeft),i=parseInt(n.paddingTop);let u=a?l:i;G=[u],Array.from(e.children).forEach(o=>{const p=window.getComputedStyle(o),d=parseInt(a?p.marginLeft+p.marginRight:p.marginTop+p.marginBottom),h=a?o.offsetWidth:o.offsetHeight;G.push(u+h+d),u+=h+d})};function Oe(e){const t=window.getComputedStyle(e).display,n=window.getComputedStyle(e).flexDirection;if(t==="flex")return n==="column"||n==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const a=window.getComputedStyle(e).gridTemplateRows,l=window.getComputedStyle(e).gridTemplateColumns;if(a.includes("auto"))return"vertical";if(l.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const yt=x.throttle(e=>{const t=e.target,n=Oe(t);if(n==="vertical"){const a=e.clientY-t.offsetTop;Re(t,n,a)}else{const a=e.clientX-t.offsetLeft;Re(t,n,a)}},200),vt=e=>{e.preventDefault(),e.stopPropagation(),yt(e)};function ce(){const e=U==null?void 0:U.getElementById("placeholder");e.style.display="none"}const jt=()=>{const{document:e}=ne(),[t,n]=_.useAtom(r.draggingFlagAtom),a=Ye.useAddBlockByDrop(),l=Se.useFeature("dnd"),[,i]=r.useHighlightBlockId(),[,u]=r.useSelectedBlockIds();return U=e,{isDragging:t,"data-dnd":"branch",onDragOver:l?vt:x.noop,onDrop:l?o=>{V==null||V.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const p=JSON.parse(o.dataTransfer.getData("text/plain"));let d=o.target.getAttribute("data-block-id");d===null&&(d=o.target.parentElement.getAttribute("data-block-id")),a({block:p,dropTargetId:d||null,relativeIndex:De}),n(!1),ce(),setTimeout(()=>{ce()},300)}:x.noop,onDragEnter:l?o=>{const p=o;V=p.target,p.stopPropagation(),p.preventDefault(),G=[];const d=p.target;mt(d),d.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),i(""),u([])}:x.noop,onDragLeave:l?o=>{const p=o;V=null,p.stopPropagation(),p.preventDefault(),p.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:x.noop,onMouseOut:l?()=>{n(!1),ce()}:x.noop}};function fe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function bt(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Et=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=r.useUpdateBlocksProps(),[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[l,i]=_.useAtom(r.inlineEditingActiveAtom);return u=>{var R;if(l)return;const o=fe(u.target),p=o.getAttribute("data-block-type");if(!p||!e.includes(p))return;const d=o.cloneNode(!0);o.style.display="none",Array.from(d.attributes).forEach(I=>{I.name!=="class"&&d.removeAttribute(I.name)}),p==="Text"&&(d.style.display="inline-block"),o.parentNode.insertBefore(d,o.nextSibling);const h=new ze.Quill(d,{placeholder:"Type here..."});function g(){const I=h.getText(0,h.getLength());t([o.getAttribute("data-block-id")],{content:I}),o.removeAttribute("style"),d.removeEventListener("blur",g,!0),bt(h),i(""),a("")}d.addEventListener("blur",g,!0),h.focus(),(R=d.querySelector(".ql-clipboard"))==null||R.remove(),n([]),i(o.getAttribute("data-block-id"))}},kt=()=>{const[,e]=r.useSelectedStylingBlocks(),[,t]=r.useSelectedBlockIds(),[n]=_.useAtom(r.inlineEditingActiveAtom);return a=>{if(n)return;a.stopPropagation();const l=fe(a.target);if(l!=null&&l.getAttribute("data-block-parent")){const i=l.getAttribute("data-style-prop"),u=l.getAttribute("data-style-id"),o=l.getAttribute("data-block-parent");e([{id:u,prop:i,blockId:o}]),t([o])}else l!=null&&l.getAttribute("data-block-id")&&t([l.getAttribute("data-block-id")])}},wt=x.throttle((e,t)=>{const n=fe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),Rt=()=>{const[,e]=r.useHighlightBlockId(),[t]=_.useAtom(r.inlineEditingActiveAtom);return n=>{t||wt(n,e)}},St=({children:e})=>{const{document:t}=ne(),[n]=r.useSelectedBlockIds(),[a,l]=r.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!x.isEmpty(a))return;const d=qe(t,x.first(n));if(d){const h=d.getAttribute("data-style-prop");if(h){const g=d.getAttribute("data-style-id"),R=d.getAttribute("data-block-parent");l([{id:g,prop:h,blockId:R}])}}},100)},[t,n,l,a]);const i=Et(),u=kt(),o=Rt(),p=jt();return s.jsxRuntimeExports.jsx("div",{id:"canvas",onClick:u,onDoubleClick:i,onMouseMove:o,...x.omit(p,"isDragging"),className:"relative mb-5 max-w-full "+(p.isDragging?"dragging":""),children:e})},qe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ct=()=>{const{window:e}=ne(),[t,n]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),{undo:l,redo:i}=r.useCanvasHistory(),u=r.useDuplicateBlocks(),[,o]=r.useCutBlockIds(),[,p]=r.useCopyBlockIds(),{pasteBlocks:d}=r.usePasteBlocks(),[,h]=r.usePreviewMode(),g=r.useRemoveBlocks(),{savePage:R}=r.useSavePage(),[I]=_.useAtom(r.inlineEditingActiveAtom),[,q]=_.useAtom(r.editLayerNameAtom),k=A=>{A.key==="Enter"&&(A.preventDefault(),t.length===1&&q(x.first(t)))};return m.useEffect(()=>{const A=y=>{if(y.key==="Escape"){n([]),a([]);return}if(k(y),!I&&(y.key==="Delete"||y.key==="Backspace")&&(y.preventDefault(),g(t)),y.ctrlKey||y.metaKey){if(["z","y","d","x","c","p","s","v"].includes(y.key)){if(I&&["x","z","v"].includes(y.key))return!0;y.preventDefault()}y.key==="s"&&(y.stopPropagation(),y.preventDefault(),R()),y.key==="z"&&l(),y.key==="y"&&i(),y.key==="d"&&u(t),y.key==="x"&&o(t),y.key==="c"&&p(t),y.key==="v"&&t.length>0&&d(t[0])}};return e.removeEventListener("keydown",A),e.addEventListener("keydown",A),()=>{e.removeEventListener("keydown",A)}},[t,n,l,g,h,i,u,o,p,d,I,R,e]),null},Tt=({block:e,label:t})=>{const[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[,l]=_.useAtom(r.draggedBlockIdAtom),i=Se.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:i?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(x.pick(e,["_id","_type"]))),l(e._id),setTimeout(()=>{n([]),a(null)},200)},children:[s.jsxRuntimeExports.jsx(M.DragHandleDots2Icon,{}),t]})},It=({selectedBlockElement:e,block:t})=>{const n=r.useRemoveBlocks(),a=r.useDuplicateBlocks(),[,l]=r.useSelectedBlockIds(),[,i]=r.useSelectedStylingBlocks(),{floatingStyles:u,refs:o,update:p}=ge.useFloating({placement:"top-start",middleware:[ge.shift(),Ke.flip()],elements:{reference:e}});Je.useResizeObserver(e,()=>p(),e!==null);const d=x.get(t,"_parent",null),h=x.isEmpty(x.get(t,"_name",""))?x.get(t,"_type",""):x.get(t,"_name","");return!e||!t?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:o.setFloating,style:u,onClick:g=>{g.stopPropagation(),g.preventDefault()},onKeyDown:g=>g.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Tt,{label:h,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[d&&s.jsxRuntimeExports.jsx(M.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{i([]),l([d])}}),r.canDuplicateBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(M.CopyIcon,{className:"hover:scale-105 ",onClick:()=>a([t==null?void 0:t._id])}):null,r.canDeleteBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(M.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Bt=({model:e})=>{const[t]=r.useBrandingOptions(),[n]=r.useSelectedBlockIds(),[a]=r.useDarkMode(),[l]=r.useHighlightBlockId(),[i]=r.useSelectedStylingBlocks(),[u]=_.useAtom(r.draggedBlockIdAtom),{document:o,window:p}=ne(),[d]=m.useState(o==null?void 0:o.getElementById("highlighted-block")),[h]=m.useState(o==null?void 0:o.getElementById("selected-block")),[g]=m.useState(o==null?void 0:o.getElementById("selected-styling-block")),[R]=m.useState(o==null?void 0:o.getElementById("dragged-block"));m.useEffect(()=>{a?o==null||o.documentElement.classList.add("dark"):o==null||o.documentElement.classList.remove("dark")},[a,o]);const I=x.get(t,"headingFont","DM Sans"),q=x.get(t,"bodyFont","DM Sans");return m.useEffect(()=>{const k=x.get(t,"primaryColor","#000"),A=x.get(t,"secondaryColor","#FFF"),y=Xe.tailwindcssPaletteGenerator({colors:[k,A],names:["primary","secondary"]});y.primary.DEFAULT=k,y.secondary.DEFAULT=A;const W=x.get(t,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[I],body:[q]},extend:{borderRadius:{global:`${W||"0"}px`},colors:y}},plugins:[p.tailwind.plugin.withOptions(({prefix:Y="ui"}={})=>({addVariant:K})=>{for(const N of["open","checked","selected","active","disabled"])K(`${Y}-${N}`,[`&[data-headlessui-state~="${N}"]`,`:where([data-headlessui-state~="${N}"]) &`]),K(`${Y}-not-${N}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${N}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${N}"])) &:not([data-headlessui-state])`])})]})},[t,p,I,q]),m.useEffect(()=>{h&&(h.textContent=`${x.map(n,k=>`[data-block-id="${k}"]`).join(",")}{
56
56
  outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
57
- }`)},[n,h]),m.useEffect(()=>{if(!u){w.textContent="";return}w.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),m.useEffect(()=>{d&&(d.textContent=l?`[data-style-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[l,n,d]),m.useEffect(()=>{g&&(g.textContent=`${x.map(i,({id:k})=>`[data-style-id="${k}"]`).join(",")}{
57
+ }`)},[n,h]),m.useEffect(()=>{if(!u){R.textContent="";return}R.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),m.useEffect(()=>{d&&(d.textContent=l?`[data-style-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[l,n,d]),m.useEffect(()=>{g&&(g.textContent=`${x.map(i,({id:k})=>`[data-style-id="${k}"]`).join(",")}{
58
58
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
59
- }`)},[i,g]),m.useEffect(()=>{const k=x.get(t,"bodyTextLightColor","#64748b"),A=x.get(t,"bodyTextDarkColor","#94a3b8"),y=x.get(t,"bodyBgLightColor","#FFFFFF"),W=x.get(t,"bodyBgDarkColor","#0f172a");o.body.className=`font-body antialiased text-[${k}] bg-[${y}] dark:text-[${A}] dark:bg-[${W}]`},[t,o,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[I&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${I.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),q&&I!==q&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${q.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),I&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${I}",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},At=e=>{const t={};return Object.keys(e).forEach(n=>{x.isString(e[n])&&e[n].startsWith(Z.SLOT_KEY)&&(t[n]=e[n].replace(Z.SLOT_KEY,"").split(","))}),t},Dt=x.memoize(e=>{const t=e.replace(Z.STYLES_KEY,"").split(",");return Ze.twMerge(t[0],t[1])});function Ot(e,t){return x.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(x.isString(e[n])&&e[n].startsWith(Z.STYLES_KEY)){const a=Dt(e[n]);t[n]={className:a,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...Ot(e,n)}}}),t}function Pt(e,t){const n=x.get(e,"_bindings",{});return x.isEmpty(n)?{...e}:(x.each(n,(a,l)=>{x.isString(a)&&x.get(t,a,null)&&(e[l]=x.get(t,a,null))}),e)}function ue({blocks:e}){const t=r.useAllBlocks(),n=m.useCallback(i=>qt(i),[]),[a]=Q.useChaiExternalData(),[l]=r.useAtom(r.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((i,u)=>{if(l===i._id)return null;const o=At(i),p={};x.isEmpty(o)||Object.keys(o).forEach(w=>{p[w]=m.Children.toArray(o[w].map(I=>s.jsxRuntimeExports.jsx(ue,{blocks:[x.find(t,{_id:I})]})))});const d=x.filter(t,{_parent:i._id});p.children=d.length?s.jsxRuntimeExports.jsx(ue,{blocks:d}):null;const h=Ge.getBlockComponent(i._type),g=x.get(h,"component",null);return x.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${i==null?void 0:i._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":i._id,"data-block-type":i._type,"data-dnd":r.canAddChildBlock(i._type)?"branch":"leaf"},inBuilder:!0,index:u,...Pt(i,a),...n(i),...p})})}))})}const Mt=()=>{const e=r.useAllBlocks();return s.jsxRuntimeExports.jsx(Ve.Provider,{children:x.isEmpty(e)?null:s.jsxRuntimeExports.jsx(Q.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(ue,{blocks:x.filter(e,t=>x.isEmpty(t._parent))})})})},Lt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),_t=()=>{const[e]=_.useAtom(r.networkModeAtom),[t]=r.usePreviewMode(),[n]=r.useCanvasWidth(),[,a]=r.useSelectedBlockIds(),l=r.useSelectedBlock(),[,i]=r.useHighlightBlockId(),u=m.useRef(null),o=m.useRef(null),[p,d]=m.useState({width:0,height:0}),h=it(p),[g,w]=m.useState(0),[I,q]=m.useState([]),[,k]=m.useState([]),[,A]=_.useAtom(r.canvasIframeAtom),[y,W]=r.useSelectedStylingBlocks(),Y=r.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:D,clientHeight:F}=o.current;d({width:D,height:F}),g===0&&w(D)},[o,n,g]);const K=(D,F=0)=>{const{top:H}=D.getBoundingClientRect();return H+F>=0&&H-F<=window.innerHeight};m.useEffect(()=>{var D,F;if(l&&l.type!=="Multiple"&&u.current){const H=qe(u.current.contentDocument,l._id);H&&(K(H)||(F=(D=u.current)==null?void 0:D.contentWindow)==null||F.scrollTo({top:H.offsetTop,behavior:"smooth"}),q([H]))}},[l]),m.useEffect(()=>{if(!x.isEmpty(y)&&u.current){const D=Lt(u.current.contentDocument,x.first(y).id);k(D?[D]:[null])}else k([null])},[y]);const N=m.useMemo(()=>{let D=ot;return e==="offline"&&(D=D.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),D=D.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),D=D.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),D},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),W([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto h-full w-full",style:g>0&&!x.isEmpty(h)?{width:t?"100%":g}:{},ref:o,children:s.jsxRuntimeExports.jsxs(ht,{contentDidMount:()=>A(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:N,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(It,{block:l,selectedBlockElement:x.first(I)}),s.jsxRuntimeExports.jsx(Bt,{model:"page"}),s.jsxRuntimeExports.jsx(St,{children:Y?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"}),s.jsxRuntimeExports.jsx("div",{className:"py-10"})]})})},Nt=m.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-EBCXennD.cjs"))),Ft=()=>{const[e,t]=_.useAtom(r.addBlocksModalAtom);return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(rt,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative h-full overflow-hidden bg-slate-800/90 px-2 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]",children:[s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(Q.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(_t,{})})}),e?s.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:s.jsxRuntimeExports.jsx("div",{onClick:n=>n.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:s.jsxRuntimeExports.jsx(Nt,{})})}):null]})]})};exports.default=Ft;
59
+ }`)},[i,g]),m.useEffect(()=>{const k=x.get(t,"bodyTextLightColor","#64748b"),A=x.get(t,"bodyTextDarkColor","#94a3b8"),y=x.get(t,"bodyBgLightColor","#FFFFFF"),W=x.get(t,"bodyBgDarkColor","#0f172a");o.body.className=`font-body antialiased text-[${k}] bg-[${y}] dark:text-[${A}] dark:bg-[${W}]`},[t,o,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[I&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${I.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),q&&I!==q&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${q.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),I&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${I}",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},At=e=>{const t={};return Object.keys(e).forEach(n=>{x.isString(e[n])&&e[n].startsWith(Z.SLOT_KEY)&&(t[n]=e[n].replace(Z.SLOT_KEY,"").split(","))}),t},Dt=x.memoize(e=>{const t=e.replace(Z.STYLES_KEY,"").split(",");return Ze.twMerge(t[0],t[1])});function Ot(e,t){return x.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(x.isString(e[n])&&e[n].startsWith(Z.STYLES_KEY)){const a=Dt(e[n]);t[n]={className:a,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...Ot(e,n)}}}),t}function Pt(e,t){const n=x.get(e,"_bindings",{});return x.isEmpty(n)?{...e}:(x.each(n,(a,l)=>{x.isString(a)&&x.get(t,a,null)&&(e[l]=x.get(t,a,null))}),e)}function ue({blocks:e}){const t=r.useAllBlocks(),n=m.useCallback(i=>qt(i),[]),[a]=Q.useChaiExternalData(),[l]=r.useAtom(r.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((i,u)=>{if(l===i._id)return null;const o=At(i),p={};x.isEmpty(o)||Object.keys(o).forEach(R=>{p[R]=m.Children.toArray(o[R].map(I=>s.jsxRuntimeExports.jsx(ue,{blocks:[x.find(t,{_id:I})]})))});const d=x.filter(t,{_parent:i._id});p.children=d.length?s.jsxRuntimeExports.jsx(ue,{blocks:d}):null;const h=Ge.getBlockComponent(i._type),g=x.get(h,"component",null);return x.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${i==null?void 0:i._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":i._id,"data-block-type":i._type,"data-dnd":r.canAddChildBlock(i._type)?"branch":"leaf"},inBuilder:!0,index:u,...Pt(i,a),...n(i),...p})})}))})}const Mt=()=>{const e=r.useAllBlocks();return s.jsxRuntimeExports.jsx(Ve.Provider,{children:x.isEmpty(e)?null:s.jsxRuntimeExports.jsx(Q.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(ue,{blocks:x.filter(e,t=>x.isEmpty(t._parent))})})})},Lt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),_t=()=>{const[e]=_.useAtom(r.networkModeAtom),[t]=r.usePreviewMode(),[n]=r.useCanvasWidth(),[,a]=r.useSelectedBlockIds(),l=r.useSelectedBlock(),[,i]=r.useHighlightBlockId(),u=m.useRef(null),o=m.useRef(null),[p,d]=m.useState({width:0,height:0}),h=it(p),[g,R]=m.useState(0),[I,q]=m.useState([]),[,k]=m.useState([]),[,A]=_.useAtom(r.canvasIframeAtom),[y,W]=r.useSelectedStylingBlocks(),Y=r.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:D,clientHeight:F}=o.current;d({width:D,height:F}),g===0&&R(D)},[o,n,g]);const K=(D,F=0)=>{const{top:H}=D.getBoundingClientRect();return H+F>=0&&H-F<=window.innerHeight};m.useEffect(()=>{var D,F;if(l&&l.type!=="Multiple"&&u.current){const H=qe(u.current.contentDocument,l._id);H&&(K(H)||(F=(D=u.current)==null?void 0:D.contentWindow)==null||F.scrollTo({top:H.offsetTop,behavior:"smooth"}),q([H]))}},[l]),m.useEffect(()=>{if(!x.isEmpty(y)&&u.current){const D=Lt(u.current.contentDocument,x.first(y).id);k(D?[D]:[null])}else k([null])},[y]);const N=m.useMemo(()=>{let D=ot;return e==="offline"&&(D=D.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),D=D.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),D=D.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),D},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),W([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto overflow-hidden h-full w-full",style:g>0&&!x.isEmpty(h)?{width:t?"100%":g}:{},ref:o,children:s.jsxRuntimeExports.jsxs(ht,{contentDidMount:()=>A(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content max-h-full h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:N,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(It,{block:l,selectedBlockElement:x.first(I)}),s.jsxRuntimeExports.jsx(Bt,{model:"page"}),s.jsxRuntimeExports.jsx(St,{children:Y?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Nt=m.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-EBCXennD.cjs"))),Ft=()=>{const[e,t]=_.useAtom(r.addBlocksModalAtom);return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(rt,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative h-full overflow-hidden bg-slate-800/90 px-2 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]",children:[s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(Q.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(_t,{})})}),e?s.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:s.jsxRuntimeExports.jsx("div",{onClick:n=>n.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:s.jsxRuntimeExports.jsx(Nt,{})})}):null]})]})};exports.default=Ft;
@@ -10,7 +10,7 @@ import { useTranslation as En } from "react-i18next";
10
10
  import { useAtom as _ } from "jotai";
11
11
  import Ae from "react-dom";
12
12
  import { g as Dn, S as Pe, a as tt } from "./MODIFIERS-MLfpKQY1.js";
13
- import { r as nt, u as Bn, B as On, E as An } from "./index-QWyJwEV6.js";
13
+ import { r as nt, u as Bn, B as On, E as An } from "./index-LOLasIJD.js";
14
14
  import { Quill as Pn } from "react-quill";
15
15
  import { u as Rn } from "./useAddBlockByDrop-LM3owe-j.js";
16
16
  import { useFeature as rt } from "flagged";
@@ -1070,7 +1070,7 @@ const pr = () => {
1070
1070
  onDoubleClick: o,
1071
1071
  onMouseMove: s,
1072
1072
  ...St(u, "isDragging"),
1073
- className: "relative h-screen max-w-full " + (u.isDragging ? "dragging" : ""),
1073
+ className: "relative mb-5 max-w-full " + (u.isDragging ? "dragging" : ""),
1074
1074
  children: e
1075
1075
  }
1076
1076
  );
@@ -1368,7 +1368,7 @@ const Sr = () => {
1368
1368
  i([]), H([]);
1369
1369
  },
1370
1370
  onMouseLeave: () => setTimeout(() => o(""), 300),
1371
- className: "relative mx-auto h-full w-full",
1371
+ className: "relative mx-auto overflow-hidden h-full w-full",
1372
1372
  style: h > 0 && !z(f) ? { width: t ? "100%" : h } : {},
1373
1373
  ref: s,
1374
1374
  children: /* @__PURE__ */ r.jsxs(
@@ -1378,7 +1378,7 @@ const Sr = () => {
1378
1378
  ref: d,
1379
1379
  id: "canvas-iframe",
1380
1380
  style: { width: `${n}px`, ...f },
1381
- className: "relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
1381
+ className: "relative mx-auto box-content max-h-full h-full max-w-full shadow-lg transition-all duration-300 ease-linear",
1382
1382
  initialContent: L,
1383
1383
  children: [
1384
1384
  /* @__PURE__ */ r.jsx(yr, {}),
@@ -1391,8 +1391,8 @@ const Sr = () => {
1391
1391
  ),
1392
1392
  /* @__PURE__ */ r.jsx(br, { model: "page" }),
1393
1393
  /* @__PURE__ */ r.jsx(mr, { children: X ? /* @__PURE__ */ r.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ r.jsx(et, { className: "h-full" }) }) : /* @__PURE__ */ r.jsx(Sr, {}) }),
1394
- /* @__PURE__ */ r.jsx("div", { id: "placeholder", className: "absolute bg-green-500 z-[99999] max-w-full transition-transform" }),
1395
- /* @__PURE__ */ r.jsx("div", { className: "py-10" })
1394
+ /* @__PURE__ */ r.jsx("br", {}),
1395
+ /* @__PURE__ */ r.jsx("div", { id: "placeholder", className: "absolute bg-green-500 z-[99999] max-w-full transition-transform" })
1396
1396
  ]
1397
1397
  }
1398
1398
  )
@@ -3,7 +3,7 @@ import { ag as x, aq as h, ar as f, as as j, at as y, au as P } from "./index-bK
3
3
  import { sortBy as v, filter as b, get as w, isEmpty as s, find as n, capitalize as C, map as N } from "lodash";
4
4
  import { toast as S } from "sonner";
5
5
  import { useEffect as p } from "react";
6
- import { b as k, a as B, d as E, e as I } from "./index-QWyJwEV6.js";
6
+ import { b as k, a as B, d as E, e as I } from "./index-LOLasIJD.js";
7
7
  import { BriefcaseIcon as L } from "lucide-react";
8
8
  import "./MODIFIERS-MLfpKQY1.js";
9
9
  import "@radix-ui/react-toggle";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-U_pW4Tkc.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index--Qs9Me8k.cjs"),j=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.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("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=s.useSavePage(),d=o.useChangePage(),[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 m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 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(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),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:m,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=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-U_pW4Tkc.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index-rhyb2TB9.cjs"),j=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.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("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=s.useSavePage(),d=o.useChangePage(),[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 m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 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(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),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:m,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=p;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("lodash"),t=require("@radix-ui/react-icons"),q=require("react-dnd"),f=require("@minoru/react-dnd-treeview"),M=require("react-i18next"),r=require("./index-U_pW4Tkc.cjs"),N=require("lucide-react");require("./lib.cjs");const g=require("react"),O=require("./MODIFIERS-WFzDQfiT.cjs"),B=require("./utils-It2K33fU.cjs"),A=require("./index--Qs9Me8k.cjs"),_=require("jotai"),P=require("./useAddBlockByDrop-qOKe8QVt.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("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const y=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(N.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function H(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const L=s=>{let n="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],O.STYLES_KEY)&&(n=s[o])}),n},F=s=>{var j;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:i}=s,{id:c,data:l}=s.node,d=s.depth*10,m=a=>{a.stopPropagation(),s.onToggle(s.node.id)},E=f.useDragOver(c,s.isOpen,s.onToggle),p=g.useMemo(()=>{const a=L(s.node.data);return H(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:B.cn("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&s.onSelect(c)},onContextMenu:()=>s.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(y,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=s.node.data)==null?void 0:j._name)||s.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},V=s=>{var o;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(y,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},z=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},G=g.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-E_w2sPGA.cjs"))),$=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},K=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Q=()=>{const[s]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},U=({id:s=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),d=r.useBuilderProp("globalBlocksSupport",!1),m=g.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(r.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx($,{}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Q,{})]})},Y=({children:s,id:n=null})=>{const[o,i]=g.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(g.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(G,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(U,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})};function W(s){return u.map(s,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const J=()=>{const s=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:d}=M.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=A.useExpandedIds(),p=P.useAddBlockByDrop(),[,j]=_.useAtom(r.addBlocksModalAtom),a=async(x,R)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:D}=R,T=W(x);n(T),h?m():(await p({block:D.getItem(),dropTargetId:k,relativeIndex:b}),j(!1))},C=u.map(s,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(s,{_parent:x._id})),data:x})),v=()=>{i([]),l([])},[{isOver:I},S]=q.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await p({block:x,dropTargetId:"",relativeIndex:0}),j(!1)))()}})),{isDragging:w}=q.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>v(),className:B.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",w?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:S,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(f.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:C,rootId:0,render:(x,{depth:R,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(Y,{id:x.id,children:e.jsxRuntimeExports.jsx(F,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:R,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(V,{monitorProps:x}),onDrop:a,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:R})=>e.jsxRuntimeExports.jsx(z,{node:x,depth:R})})})})})};exports.default=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("lodash"),t=require("@radix-ui/react-icons"),f=require("react-dnd"),B=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),r=require("./index-U_pW4Tkc.cjs"),O=require("lucide-react");require("./lib.cjs");const R=require("react"),A=require("./MODIFIERS-WFzDQfiT.cjs"),y=require("./utils-It2K33fU.cjs"),_=require("./index-rhyb2TB9.cjs"),P=require("jotai"),H=require("./useAddBlockByDrop-qOKe8QVt.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("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const C=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function L(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const F=s=>{let n="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],A.STYLES_KEY)&&(n=s[o])}),n},V=s=>{var j;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:i}=s,{id:c,data:l}=s.node,d=s.depth*10,m=a=>{a.stopPropagation(),s.onToggle(s.node.id)},E=B.useDragOver(c,s.isOpen,s.onToggle),p=R.useMemo(()=>{const a=F(s.node.data);return L(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:y.cn("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&s.onSelect(c)},onContextMenu:()=>s.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(C,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=s.node.data)==null?void 0:j._name)||s.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},z=s=>{var o;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(C,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},G=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},$=R.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-E_w2sPGA.cjs"))),K=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},Q=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},U=()=>{const[s]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},Y=({id:s=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),d=r.useBuilderProp("globalBlocksSupport",!1),m=R.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(r.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(U,{})]})},W=({children:s,id:n=null})=>{const[o,i]=R.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(R.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx($,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(Y,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})};function J(s){return u.map(s,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const X=()=>{const s=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:d}=N.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=_.useExpandedIds(),p=H.useAddBlockByDrop(),[,j]=P.useAtom(r.addBlocksModalAtom),a=async(x,g)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:q}=g;if(h){m();const T=J(x);n(T);const M=q.getItem();i([M.id])}else await p({block:q.getItem(),dropTargetId:k,relativeIndex:b}),j(!1)},v=u.map(s,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(s,{_parent:x._id})),data:x})),S=()=>{i([]),l([])},[{isOver:I},w]=f.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await p({block:x,dropTargetId:"",relativeIndex:0}),j(!1)))()}})),{isDragging:D}=f.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>S(),className:y.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:w,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(B.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:v,rootId:0,render:(x,{depth:g,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(W,{id:x.id,children:e.jsxRuntimeExports.jsx(V,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:g,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(z,{monitorProps:x}),onDrop:a,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:g})=>e.jsxRuntimeExports.jsx(G,{node:x,depth:g})})})})})};exports.default=X;