@chaibuilder/sdk 0.1.19 → 0.1.21

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 (71) hide show
  1. package/dist/{AddBlocks-d5a8235d.js → AddBlocks-b2d43d6c.js} +5 -6
  2. package/dist/AddBlocks-b510ac3a.cjs +3 -0
  3. package/dist/BrandingOptions-6fbe4b26.cjs +1 -0
  4. package/dist/{BrandingOptions-e77f91bc.js → BrandingOptions-7f66e02c.js} +5 -6
  5. package/dist/{CanvasArea-50356121.js → CanvasArea-68841a13.js} +10 -11
  6. package/dist/{CanvasArea-a09ed911.cjs → CanvasArea-a8d28eb3.cjs} +6 -6
  7. package/dist/{CurrentPage-0dd3a1fe.js → CurrentPage-6655ce50.js} +5 -6
  8. package/dist/CurrentPage-c10e6c89.cjs +1 -0
  9. package/dist/Layers-595cc98e.cjs +1 -0
  10. package/dist/{Layers-e17bbf6a.js → Layers-99bdc689.js} +48 -49
  11. package/dist/{MODIFIERS-c2e02614.js → MODIFIERS-2f19c314.js} +13 -7
  12. package/dist/MODIFIERS-4716c669.cjs +1 -0
  13. package/dist/{MarkAsGlobalBlock-3a58a10b.js → MarkAsGlobalBlock-522e170a.js} +5 -6
  14. package/dist/MarkAsGlobalBlock-ea769ea4.cjs +1 -0
  15. package/dist/{PagesPanel-68bb4554.js → PagesPanel-b0debeed.js} +5 -6
  16. package/dist/PagesPanel-e176d7e8.cjs +1 -0
  17. package/dist/{ProjectPanel-decfe6bb.js → ProjectPanel-9cec967c.js} +6 -7
  18. package/dist/ProjectPanel-d0f33df2.cjs +1 -0
  19. package/dist/Settings-208ab051.cjs +1 -0
  20. package/dist/{Settings-27bb6012.js → Settings-fd1e3b5d.js} +82 -83
  21. package/dist/SidePanels-40966390.cjs +1 -0
  22. package/dist/{SidePanels-839ecfae.js → SidePanels-ca294b35.js} +6 -7
  23. package/dist/{Topbar-d3dc4a34.js → Topbar-1edef1b2.js} +15 -16
  24. package/dist/Topbar-75c99c88.cjs +1 -0
  25. package/dist/add-page-modal-18f134c0.cjs +1 -0
  26. package/dist/{add-page-modal-da3e0ad5.js → add-page-modal-9985b5ce.js} +5 -6
  27. package/dist/core.cjs +1 -1
  28. package/dist/core.d.ts +1 -1
  29. package/dist/core.js +56 -57
  30. package/dist/delete-page-modal-393697d7.cjs +1 -0
  31. package/dist/{delete-page-modal-3aa66051.js → delete-page-modal-98272bf5.js} +8 -9
  32. package/dist/functions-83b1de8d.js +1106 -0
  33. package/dist/functions-f84d5e2a.cjs +2 -0
  34. package/dist/{html-to-json-8397fab5.js → html-to-json-45e0e3b5.js} +1 -1
  35. package/dist/{html-to-json-78bfa1f3.cjs → html-to-json-aadcbf66.cjs} +1 -1
  36. package/dist/{index-ca7c3430.js → index-436bba3e.js} +110 -111
  37. package/dist/{index-976ec896.cjs → index-c3a98a78.cjs} +40 -40
  38. package/dist/lib.cjs +1 -1
  39. package/dist/lib.d.ts +39 -1
  40. package/dist/lib.js +56 -45
  41. package/dist/page-viewer-32261f49.cjs +1 -0
  42. package/dist/{page-viewer-3e7a6d70.js → page-viewer-a3ac057a.js} +16 -17
  43. package/dist/{project-general-setting-c8aa9370.js → project-general-setting-21e324a9.js} +5 -6
  44. package/dist/project-general-setting-75a8e94b.cjs +1 -0
  45. package/dist/render.cjs +1 -2
  46. package/dist/render.d.ts +16 -17
  47. package/dist/render.js +88 -1169
  48. package/dist/server.cjs +1 -1
  49. package/dist/server.d.ts +21 -1
  50. package/dist/server.js +47 -35
  51. package/dist/{single-page-detail-55638cb1.js → single-page-detail-0e881b82.js} +6 -7
  52. package/dist/single-page-detail-649b1379.cjs +1 -0
  53. package/package.json +1 -1
  54. package/dist/AddBlocks-6fc9d7de.cjs +0 -3
  55. package/dist/BrandingOptions-e44ef105.cjs +0 -1
  56. package/dist/CurrentPage-19086054.cjs +0 -1
  57. package/dist/Layers-2dd7336a.cjs +0 -1
  58. package/dist/MODIFIERS-70fef873.cjs +0 -1
  59. package/dist/MarkAsGlobalBlock-d4fe0af6.cjs +0 -1
  60. package/dist/PagesPanel-fa54f8c4.cjs +0 -1
  61. package/dist/ProjectPanel-750e4a4f.cjs +0 -1
  62. package/dist/Settings-c18e276b.cjs +0 -1
  63. package/dist/SidePanels-90ac74bf.cjs +0 -1
  64. package/dist/Topbar-57cd1611.cjs +0 -1
  65. package/dist/_commonjsHelpers-10dfc225.js +0 -8
  66. package/dist/_commonjsHelpers-87b0abe8.cjs +0 -1
  67. package/dist/add-page-modal-f49ebaf3.cjs +0 -1
  68. package/dist/delete-page-modal-6667ee2b.cjs +0 -1
  69. package/dist/page-viewer-5f00c933.cjs +0 -1
  70. package/dist/project-general-setting-a23cc2c4.cjs +0 -1
  71. package/dist/single-page-detail-a4b59a16.cjs +0 -1
@@ -8,7 +8,7 @@ import { T as oe, a as te, b as A } from "./tabs-85caa1e8.js";
8
8
  import { d as le, e as ae, f as ce, u as ie, B as ne, S as de } from "./useBuilderProp-81a14920.js";
9
9
  import { useDrag as R, DragPreviewImage as O } from "react-dnd";
10
10
  import { BoxIcon as me, ExclamationTriangleIcon as ue, Cross1Icon as pe } from "@radix-ui/react-icons";
11
- import { W as F, i as C, a as z, b as T, Z as D, _ as xe, $ as he, B as fe } from "./index-ca7c3430.js";
11
+ import { W as F, i as C, a as z, b as T, Z as D, _ as xe, $ as he, B as fe } from "./index-436bba3e.js";
12
12
  import "react-i18next";
13
13
  import { syncBlocksWithDefaults as G, useChaiBlocks as U } from "@chaibuilder/blocks";
14
14
  import { Loader as ge } from "lucide-react";
@@ -16,7 +16,7 @@ import { c as be } from "./utils-ac68b2c8.js";
16
16
  import { T as je, A as ye, a as we } from "./textarea-9dfb6a32.js";
17
17
  import { C as ke, a as Be, c as ve, d as Ce, e as Te, b as Ne } from "./card-f8f4f985.js";
18
18
  import { L as Ae } from "./label-e770a087.js";
19
- import { b as Ie } from "./html-to-json-8397fab5.js";
19
+ import { b as Ie } from "./html-to-json-45e0e3b5.js";
20
20
  import "@radix-ui/react-accordion";
21
21
  import "@radix-ui/react-scroll-area";
22
22
  import "@radix-ui/react-tabs";
@@ -24,7 +24,7 @@ import "@radix-ui/react-slot";
24
24
  import "class-variance-authority";
25
25
  import "@radix-ui/react-tooltip";
26
26
  import "@radix-ui/react-toast";
27
- import "./_commonjsHelpers-10dfc225.js";
27
+ import "./MODIFIERS-2f19c314.js";
28
28
  import "clsx";
29
29
  import "react-dom";
30
30
  import "@floating-ui/react-dom";
@@ -35,7 +35,6 @@ import "react-hotkeys-hook";
35
35
  import "flat-to-nested";
36
36
  import "redux-undo";
37
37
  import "@react-hookz/web";
38
- import "./MODIFIERS-c2e02614.js";
39
38
  import "sonner";
40
39
  import "tailwind-merge";
41
40
  import "@radix-ui/react-label";
@@ -198,7 +197,7 @@ const Le = ({ block: s }) => {
198
197
  return !P(S, r);
199
198
  const o = s._type;
200
199
  return o === "List" ? r === "ListItem" : o === "Table" ? r === "TableHead" || r === "TableBody" : o === "TableHead" || o === "TableBody" ? r === "TableRow" : o === "TableRow" ? r === "TableCell" : o === "Row" ? r === "Column" : !P(S, r);
201
- }, vs = () => {
200
+ }, Bs = () => {
202
201
  const [s, r] = j("core"), [o, a] = j("basic"), i = U(), [, d] = h(he), [, m] = h(T), [n] = C(), t = fe(), f = M(t, { _id: b(n) }), { data: x, isLoading: u } = D(), g = I(
203
202
  w(i, (c) => Ee(f, c.type)),
204
203
  "category"
@@ -258,5 +257,5 @@ const Le = ({ block: s }) => {
258
257
  ] });
259
258
  };
260
259
  export {
261
- vs as default
260
+ Bs as default
262
261
  };
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),n=require("react"),s=require("lodash"),g=require("jotai"),w=require("./accordion-0afd8143.cjs"),I=require("./scroll-area-bb343b86.cjs"),k=require("./tabs-860e37aa.cjs"),y=require("./useBuilderProp-5e57d0c8.cjs"),v=require("react-dnd"),N=require("@radix-ui/react-icons"),l=require("./index-c3a98a78.cjs");require("react-i18next");const T=require("@chaibuilder/blocks"),L=require("lucide-react"),P=require("./utils-3c452dd0.cjs"),C=require("./textarea-20b2f6b2.cjs"),R=require("./card-14e1d020.cjs"),S=require("./label-167415e5.cjs"),M=require("./html-to-json-aadcbf66.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("./MODIFIERS-4716c669.cjs");require("clsx");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("@react-hookz/web");require("sonner");require("tailwind-merge");require("@radix-ui/react-label");require("himalaya");const F=({block:t})=>{const{type:r,icon:o,label:c}=t,{addCoreBlock:u,addPredefinedBlock:m}=l.useAddBlock(),[p]=l.useSelectedBlockIds(),[,x]=g.useAtom(l.activePanelAtom),[,i]=g.useAtom(l.addBlocksModalAtom),b=()=>{s.has(t,"blocks")?m(T.syncBlocksWithDefaults(t.blocks),s.first(p)):u(t,s.first(p)),i(!1),x("layers")},[,f,j]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}));return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:j,src:"https://placehold.co/100x30/000000/FFF?text="+(c||r).replace(/ /g,"+")}),e.jsxRuntimeExports.jsxs(y.Tooltip,{children:[e.jsxRuntimeExports.jsx(y.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:b,type:"button",ref:f,className:"cursor-grab space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50",children:[n.createElement(o||N.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:c||r})]})}),e.jsxRuntimeExports.jsx(y.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:c||r})})]})]})},H=({block:t,closePopover:r})=>{var j;const[o,c]=n.useState(!1),u=y.useBuilderProp("getExternalPredefinedBlock"),{addCoreBlock:m,addPredefinedBlock:p}=l.useAddBlock(),[x]=l.useSelectedBlockIds(),[,i,b]=v.useDrag(()=>({type:"CHAI_BLOCK",item:t}),[t]),f=n.useCallback(async E=>{if(E.stopPropagation(),s.has(t,"component")){m(t,s.first(x)),r();return}c(!0);const a=await u(t);s.isEmpty(a)||p(T.syncBlocksWithDefaults(a),s.first(x)),r()},[t]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(v.DragPreviewImage,{connect:b,src:"https://placehold.co/100x30/000000/FFF?text="+((j=t.name||t.label)==null?void 0:j.replace(" ","+"))}),e.jsxRuntimeExports.jsxs("div",{ref:i,onClick:o?()=>{}:f,className:"relative cursor-grab overflow-hidden rounded-md border border-transparent duration-200 hover:scale-x-105 hover:border-foreground/20 hover:shadow-2xl",children:[o&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black bg-opacity-70",children:[e.jsxRuntimeExports.jsx(L.Loader,{className:"animate-spin",size:15,color:"white"})," ",e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[50px] w-full rounded-md border border-gray-300",alt:t.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:t.name})})]})]})},D=()=>{const{data:t,isLoading:r}=l.useUILibraryBlocks(),o=T.useChaiBlocks(),c=s.filter(s.values(o),{category:"custom"}),u=s.groupBy(c,"group"),m=s.groupBy(t,"group"),[p,x]=n.useState(null),i=n.useMemo(()=>s.mergeWith(u,m,(a,h)=>{if(s.isArray(a)&&s.isArray(h))return[...a,...h]}),[u,m]),[,b]=g.useAtom(l.addBlocksModalAtom),[f,j]=n.useState("Navbar"),E=s.get(i,f,[]);return e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full overflow-hidden py-2",children:[e.jsxRuntimeExports.jsx("ul",{className:"sticky top-0 h-full w-48 space-y-1 overflow-y-auto border-r px-2",children:r?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("li",{className:"h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"}),e.jsxRuntimeExports.jsx("li",{className:"mt-2 h-8 w-full animate-pulse bg-gray-200"})]}):n.Children.toArray(s.map(i,(a,h)=>e.jsxRuntimeExports.jsx("li",{onMouseOut:()=>{clearTimeout(p),x(null)},onMouseEnter:()=>{const B=setTimeout(()=>{j(h)},300);x(B)},onClick:()=>j(h),className:P.cn("-mx-2 cursor-default rounded-md rounded-r-none px-2 py-1 text-sm font-medium capitalize",f===h?"bg-blue-500 text-white":" text-gray-700 hover:bg-foreground/10"),children:h})))}),e.jsxRuntimeExports.jsx("div",{className:"h-full w-full space-y-2 overflow-y-auto px-8",children:n.Children.toArray(E.map(a=>e.jsxRuntimeExports.jsx(H,{block:a,closePopover:()=>b(!1)})))})]})},O=()=>{const[t,r]=n.useState(""),{addPredefinedBlock:o}=l.useAddBlock(),[c]=l.useSelectedBlockIds(),[,u]=g.useAtom(l.addBlockOffCanvasAtom),[,m]=g.useAtom(l.activePanelAtom),[,p]=g.useAtom(l.addBlocksModalAtom),x=()=>{const i=M.getBlocksFromHTML(t);o([...i],s.first(c)||null),r(""),u(!1),m("layers"),p(!1)};return e.jsxRuntimeExports.jsxs(R.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsxs(R.CardHeader,{className:"p-3",children:[e.jsxRuntimeExports.jsx(R.CardTitle,{children:"Import HTML"}),e.jsxRuntimeExports.jsx(R.CardDescription,{children:"Use HTML snippets from component libraries like Tailwind UI, Flowbite, Preline, Kitwind, Tailblocks etc. or just copy paste your own HTML code. Only Tailwind CSS markup is supported."})]}),e.jsxRuntimeExports.jsx(R.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(S.Label,{htmlFor:"current",className:"text-sm",children:"Enter HTML Code:"}),e.jsxRuntimeExports.jsx(C.Textarea,{autoFocus:!0,tabIndex:1,ref:i=>i&&i.focus(),defaultValue:t,onChange:i=>r(i.target.value),rows:12,placeholder:`<div>
2
+ <h1>Enter code here</h1>
3
+ </div>`,className:"resize-none overflow-x-auto whitespace-pre font-mono font-normal"})]})}),e.jsxRuntimeExports.jsxs(R.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(y.Button,{disabled:t.trim()==="",onClick:()=>x(),size:"sm",className:"w-full",children:"Import"}),e.jsxRuntimeExports.jsxs(C.Alert,{variant:"default",className:"mt-2 p-1 text-blue-400",children:[e.jsxRuntimeExports.jsx(N.ExclamationTriangleIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx(C.AlertTitle,{className:"text-sm leading-4",children:"Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page."})]})]})]})},U=O,q=["ListItem","TableHead","TableBody","TableRow","TableCell","Column"],z=(t,r)=>{if(!t)return!s.includes(q,r);const o=t._type;return o==="List"?r==="ListItem":o==="Table"?r==="TableHead"||r==="TableBody":o==="TableHead"||o==="TableBody"?r==="TableRow":o==="TableRow"?r==="TableCell":o==="Row"?r==="Column":!s.includes(q,r)},G=()=>{const[t,r]=n.useState("core"),[o,c]=n.useState("basic"),u=T.useChaiBlocks(),[,m]=g.useAtom(l.showPredefinedBlockCategoryAtom),[,p]=g.useAtom(l.addBlocksModalAtom),[x]=l.useSelectedBlockIds(),i=l.useAllBlocks(),b=s.find(i,{_id:s.first(x)}),{data:f,isLoading:j}=l.useUILibraryBlocks(),E=s.groupBy(s.filter(u,d=>z(b,d.type)),"category"),a=s.uniq(s.map(E.core,"group"));n.useEffect(()=>{!s.includes(a,o)&&!s.isEmpty(a)&&!s.isEmpty(o)&&c(s.first(a))},[a,o]);const h=d=>c(A=>A===d?"":d),B=!j&&!s.isEmpty(f)||s.find(s.values(u),{category:"custom"})!==void 0;return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsxs("h1",{className:"flex flex-col items-baseline px-1 text-2xl font-semibold xl:flex-row",children:["Add block",e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:t==="html"?"(Enter or paste your own HTML code)":"(Drag & drop into tree view or click to add)"})]}),e.jsxRuntimeExports.jsxs("button",{onClick:()=>p(!1),className:"flex h-max items-center gap-x-1 rounded-full border p-px text-xs text-gray-800 hover:bg-gray-100 md:p-2",children:[e.jsxRuntimeExports.jsx(N.Cross1Icon,{width:12})," Close"]})]}),e.jsxRuntimeExports.jsx(k.Tabs,{onValueChange:d=>{m(""),r(d)},value:t,className:"h-max",children:e.jsxRuntimeExports.jsxs(k.TabsList,{className:"grid w-full "+(B?"grid-cols-3":"grid-cols-2"),children:[e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"core",children:"Core"}),B?e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"ui-blocks",children:"UI Blocks"}):null,e.jsxRuntimeExports.jsx(k.TabsTrigger,{value:"html",children:"Import"})]})}),t==="core"&&e.jsxRuntimeExports.jsx(I.ScrollArea,{className:"-mx-1.5 h-full",children:e.jsxRuntimeExports.jsx(w.Accordion,{type:"single",value:o,className:"w-full px-3",children:n.Children.toArray(s.map(a,d=>s.reject(s.filter(s.values(E.core),{group:d}),{hidden:!0}).length?e.jsxRuntimeExports.jsxs(w.AccordionItem,{value:d,className:"border-border",children:[e.jsxRuntimeExports.jsx(w.AccordionTrigger,{onClick:()=>h(d),className:"py-2 capitalize",children:d}),e.jsxRuntimeExports.jsx(w.AccordionContent,{children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-4 gap-2",children:n.Children.toArray(s.reject(s.filter(s.values(E.core),{group:d}),{hidden:!0}).map(A=>e.jsxRuntimeExports.jsx(F,{block:A})))})})]}):null))})}),t==="ui-blocks"&&e.jsxRuntimeExports.jsx(n.Suspense,{fallback:e.jsxRuntimeExports.jsx(y.Skeleton,{className:"h-32 w-full"}),children:e.jsxRuntimeExports.jsx(D,{})}),t==="html"&&e.jsxRuntimeExports.jsx(U,{})]})};exports.default=G;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./jsx-runtime-5c3ac4f7.cjs"),O=require("react"),C=require("@rjsf/validator-ajv8"),B=require("@rjsf/core"),j=require("./index-c3a98a78.cjs");require("react-i18next");const R=require("./useBuilderProp-5e57d0c8.cjs"),e=require("@chaibuilder/blocks"),P=require("lodash");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./utils-3c452dd0.cjs");require("tailwind-merge");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@radix-ui/react-icons");require("lucide-react");require("sonner");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");function k(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const i in r)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(t,i,a.get?a:{enumerable:!0,get:()=>r[i]})}}return t.default=r,Object.freeze(t)}const c=k(O),v=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"}],D=()=>{const r=R.useBuilderProp("onSaveBrandingOptions",async()=>{}),[t,i]=j.useBrandingOptions(),a=c.useRef(t);c.useEffect(()=>()=>{P.isEqual(t,a.current)||r(a.current)},[]);const p=({formData:l},u)=>{u&&(i(l),a.current=l)},{bodyFont:g,headingFont:f,primaryColor:b,bodyTextDarkColor:m,bodyTextLightColor:y,bodyBgDarkColor:q,secondaryColor:x,bodyBgLightColor:h,roundedCorners:S}=t,s={headingFont:e.SelectOption({title:"Heading font",default:f,options:v}),bodyFont:e.SelectOption({title:"Body font",default:g,options:v}),roundedCorners:e.Numeric({title:"Rounded Corner",default:parseInt(S||5,10)}),primaryColor:e.Color({title:"Primary",default:b}),secondaryColor:e.Color({title:"Secondary",default:x}),bodyBgLightColor:e.Color({title:"Body Background (Light)",default:h}),bodyBgDarkColor:e.Color({title:"Body Background (Dark)",default:q}),bodyTextLightColor:e.Color({title:"Body Text (Light)",default:m}),bodyTextDarkColor:e.Color({title:"Body Text (Dark)",default:y})},n={type:"object",properties:{}},d={};return Object.keys(s).forEach(l=>{const u=s[l];return n.properties||(n.properties={}),n.properties[l]=u.schema,d[l]=u.uiSchema,!0}),o.jsxRuntimeExports.jsxs("div",{className:"flex h-full select-none flex-col",children:[o.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:o.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Branding Options"})}),o.jsxRuntimeExports.jsx("div",{className:"-mx-2",children:o.jsxRuntimeExports.jsx(B,{idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:d,schema:n,formData:t,validator:C,onChange:p})})]})};exports.default=D;
@@ -2,12 +2,12 @@ import { j as a } from "./jsx-runtime-944c88e2.js";
2
2
  import * as s from "react";
3
3
  import B from "@rjsf/validator-ajv8";
4
4
  import k from "@rjsf/core";
5
- import { z as N } from "./index-ca7c3430.js";
5
+ import { z as N } from "./index-436bba3e.js";
6
6
  import "react-i18next";
7
7
  import { u as D } from "./useBuilderProp-81a14920.js";
8
8
  import { SelectOption as p, Numeric as P, Color as e } from "@chaibuilder/blocks";
9
9
  import { isEqual as R } from "lodash";
10
- import "./_commonjsHelpers-10dfc225.js";
10
+ import "./MODIFIERS-2f19c314.js";
11
11
  import "clsx";
12
12
  import "@radix-ui/react-scroll-area";
13
13
  import "react-dom";
@@ -21,8 +21,7 @@ import "./utils-ac68b2c8.js";
21
21
  import "tailwind-merge";
22
22
  import "react-hotkeys-hook";
23
23
  import "flat-to-nested";
24
- import "./html-to-json-8397fab5.js";
25
- import "./MODIFIERS-c2e02614.js";
24
+ import "./html-to-json-45e0e3b5.js";
26
25
  import "himalaya";
27
26
  import "redux-undo";
28
27
  import "@react-hookz/web";
@@ -83,7 +82,7 @@ const d = [
83
82
  { title: "Lustria", value: "Lustria" },
84
83
  { title: "Ovo", value: "Ovo" },
85
84
  { title: "Suranna", value: "Suranna" }
86
- ], pt = () => {
85
+ ], st = () => {
87
86
  const m = D("onSaveBrandingOptions", async () => {
88
87
  }), [o, v] = N(), r = s.useRef(o);
89
88
  s.useEffect(() => () => {
@@ -162,5 +161,5 @@ const d = [
162
161
  ] });
163
162
  };
164
163
  export {
165
- pt as default
164
+ st as default
166
165
  };
@@ -6,7 +6,7 @@ import H, { useMemo as Ne, useEffect as B, createElement as mt, useCallback as V
6
6
  import { each as pe, find as We, map as Q, includes as Te, toUpper as se, round as vt, isEmpty as q, first as ee, get as O, memoize as xt, filter as $e, isNull as bt, isString as ye } from "lodash";
7
7
  import { ResetIcon as Ce, DotsVerticalIcon as jt, MobileIcon as Ee, LaptopIcon as wt, DesktopIcon as kt, EraserIcon as Tt, ZoomInIcon as Ct, ArrowUpIcon as Et, CopyIcon as St, TrashIcon as It, DragHandleDots2Icon as At } from "@radix-ui/react-icons";
8
8
  import { B as te, u as qe, S as Ue } from "./useBuilderProp-81a14920.js";
9
- import { u as Dt, d as ge, e as He, f as ve, g as Ot, h as Rt, i as z, j as K, k as Pt, l as ze, r as Ke, m as Ye, n as Bt, o as Mt, q as _t, s as Ve, t as Ge, c as Nt, v as Lt, w as Ft, x as Wt, y as $t, z as qt, A as xe, B as Xe, C as Ut, D as Ht, E as zt, b as Kt, F as Yt } from "./index-ca7c3430.js";
9
+ import { u as Dt, d as ge, e as He, f as ve, g as Ot, h as Rt, i as z, j as K, k as Pt, l as ze, r as Ke, m as Ye, n as Bt, o as Mt, q as _t, s as Ve, t as Ge, c as Nt, v as Lt, w as Ft, x as Wt, y as $t, z as qt, A as xe, B as Xe, C as Ut, D as Ht, E as zt, b as Kt, F as Yt } from "./index-436bba3e.js";
10
10
  import { useTranslation as Je } from "react-i18next";
11
11
  import { S as Z } from "./separator-a80d065b.js";
12
12
  import { S as Vt, D as Gt, c as Xt, d as Jt, h as Zt, i as Qt, f as en, H as tn, a as nn, b as rn } from "./dropdown-menu-ae3ed09b.js";
@@ -20,11 +20,10 @@ import { useResizeObserver as xn } from "@react-hookz/web";
20
20
  import { tailwindcssPaletteGenerator as bn } from "@bobthered/tailwindcss-palette-generator";
21
21
  import { Provider as jn } from "react-wrap-balancer";
22
22
  import { twMerge as wn } from "tailwind-merge";
23
- import { S as Ze, a as Se } from "./MODIFIERS-c2e02614.js";
24
- import { getChaiDataProviders as kn, getBlockComponent as Tn } from "@chaibuilder/blocks";
23
+ import { g as kn, S as Ze, a as Se } from "./MODIFIERS-2f19c314.js";
24
+ import { getChaiDataProviders as Tn, getBlockComponent as Cn } from "@chaibuilder/blocks";
25
25
  import { u as Qe } from "./useChaiExternalData-192c7896.js";
26
26
  import Ie from "react-dom";
27
- import { g as Cn } from "./_commonjsHelpers-10dfc225.js";
28
27
  import "@radix-ui/react-slot";
29
28
  import "class-variance-authority";
30
29
  import "./utils-ac68b2c8.js";
@@ -37,7 +36,7 @@ import "flagged";
37
36
  import "@minoru/react-dnd-treeview";
38
37
  import "react-hotkeys-hook";
39
38
  import "flat-to-nested";
40
- import "./html-to-json-8397fab5.js";
39
+ import "./html-to-json-45e0e3b5.js";
41
40
  import "himalaya";
42
41
  import "redux-undo";
43
42
  import "lucide-react";
@@ -48,7 +47,7 @@ import "@radix-ui/react-hover-card";
48
47
  import "@radix-ui/react-dropdown-menu";
49
48
  import "@radix-ui/react-label";
50
49
  import "@radix-ui/react-alert-dialog";
51
- const En = () => Ne(() => kn(), []), Sn = ({ children: n }) => {
50
+ const En = () => Ne(() => Tn(), []), Sn = ({ children: n }) => {
52
51
  const [, t] = Qe(), [r] = Dt(), i = En();
53
52
  return B(() => (t({}), pe(r, (l) => {
54
53
  const s = We(i, { providerKey: l.providerKey });
@@ -811,11 +810,11 @@ if (process.env.NODE_ENV !== "production") {
811
810
  } else
812
811
  fe.exports = Fn()();
813
812
  var qn = fe.exports;
814
- const P = /* @__PURE__ */ Cn(qn);
813
+ const P = /* @__PURE__ */ kn(qn);
815
814
  let tt, nt;
816
815
  typeof document < "u" && (tt = document);
817
816
  typeof window < "u" && (nt = window);
818
- const rt = H.createContext({ document: tt, window: nt }), je = () => H.useContext(rt), { Provider: Un, Consumer: es } = rt;
817
+ const rt = H.createContext({ document: tt, window: nt }), je = () => H.useContext(rt), { Provider: Un, Consumer: Qr } = rt;
819
818
  class st extends Le {
820
819
  componentDidMount() {
821
820
  this.props.contentDidMount();
@@ -1189,7 +1188,7 @@ function me({ blocks: n }) {
1189
1188
  });
1190
1189
  const A = $e(t, { _parent: p._id });
1191
1190
  k.children = A.length ? /* @__PURE__ */ e.jsx(me, { blocks: A }) : null;
1192
- const w = Tn(p._type), S = O(w, "component", null);
1191
+ const w = Cn(p._type), S = O(w, "component", null);
1193
1192
  return bt(S) ? /* @__PURE__ */ e.jsx("noscript", { children: `<!-- ${p == null ? void 0 : p._type} not registered -->` }) : /* @__PURE__ */ e.jsx(Fe, { children: H.createElement(S, {
1194
1193
  blockProps: {
1195
1194
  onClick: d,
@@ -1279,7 +1278,7 @@ const nr = () => {
1279
1278
  )
1280
1279
  }
1281
1280
  );
1282
- }, or = gt(() => import("./AddBlocks-d5a8235d.js")), ts = () => {
1281
+ }, or = gt(() => import("./AddBlocks-b2d43d6c.js")), es = () => {
1283
1282
  const n = qe("mode", oe.STATIC), [t, r] = X(Kt), i = {
1284
1283
  [oe.STATIC]: /* @__PURE__ */ e.jsx(sr, {}),
1285
1284
  [oe.FRAMEWORK]: null
@@ -1307,5 +1306,5 @@ const nr = () => {
1307
1306
  ] });
1308
1307
  };
1309
1308
  export {
1310
- ts as default
1309
+ es as default
1311
1310
  };
@@ -1,6 +1,6 @@
1
- "use strict";var Fe=Object.defineProperty;var We=(n,t,s)=>t in n?Fe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var K=(n,t,s)=>(We(n,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),h=require("react"),d=require("lodash"),q=require("@radix-ui/react-icons"),z=require("./useBuilderProp-5e57d0c8.cjs"),u=require("./index-976ec896.cjs"),ke=require("react-i18next"),Z=require("./separator-a597dba7.cjs"),L=require("./dropdown-menu-84b2439e.cjs"),$e=require("./label-167415e5.cjs"),$=require("./alert-dialog-4ce6ed22.cjs"),V=require("jotai"),Ue=require("@floating-ui/dom"),xe=require("@floating-ui/react-dom"),He=require("react-dnd"),ze=require("@react-hookz/web"),Ke=require("@bobthered/tailwindcss-palette-generator"),Ye=require("react-wrap-balancer"),Ge=require("tailwind-merge"),J=require("./MODIFIERS-70fef873.cjs"),we=require("@chaibuilder/blocks"),Se=require("./useChaiExternalData-a90e8aac.cjs"),he=require("react-dom"),Ve=require("./_commonjsHelpers-87b0abe8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("himalaya");require("redux-undo");require("lucide-react");require("sonner");require("@radix-ui/react-separator");require("@radix-ui/react-switch");require("@radix-ui/react-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-label");require("@radix-ui/react-alert-dialog");const Xe=()=>h.useMemo(()=>we.getChaiDataProviders(),[]),Ze=({children:n})=>{const[,t]=Se.useChaiExternalData(),[s]=u.usePageDataProviders(),i=Xe();return h.useEffect(()=>(t({}),d.each(s,c=>{const r=d.find(i,{providerKey:c.providerKey});if(r){const a=(r==null?void 0:r.mockFn)||(r==null?void 0:r.dataFn);a&&a(c.args).then(p=>t(v=>({...v,[c.providerKey]:p})))}}),()=>{d.each(s,c=>{t(r=>(delete r[c.providerKey],r))})}),[i,s,t]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n})},Je=()=>{const{undoCount:n,redoCount:t,undo:s,redo:i}=u.useCanvasHistory();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(z.Button,{disabled:!n,size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(q.ResetIcon,{})}),e.jsxRuntimeExports.jsx(z.Button,{disabled:!t,onClick:i,size:"sm",className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(q.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function Qe(){const[n,t]=u.useDarkMode(),{t:s}=ke.useTranslation();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx($e.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),e.jsxRuntimeExports.jsxs(L.Switch,{id:"dark-mode-switch",checked:n,onCheckedChange:()=>{t(!n)},className:`${n?"bg-violet-600":"bg-violet-300"}
1
+ "use strict";var Fe=Object.defineProperty;var We=(n,t,s)=>t in n?Fe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var K=(n,t,s)=>(We(n,typeof t!="symbol"?t+"":t,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),h=require("react"),d=require("lodash"),q=require("@radix-ui/react-icons"),z=require("./useBuilderProp-5e57d0c8.cjs"),u=require("./index-c3a98a78.cjs"),ke=require("react-i18next"),J=require("./separator-a597dba7.cjs"),L=require("./dropdown-menu-84b2439e.cjs"),$e=require("./label-167415e5.cjs"),$=require("./alert-dialog-4ce6ed22.cjs"),V=require("jotai"),Ue=require("@floating-ui/dom"),xe=require("@floating-ui/react-dom"),He=require("react-dnd"),ze=require("@react-hookz/web"),Ke=require("@bobthered/tailwindcss-palette-generator"),Ye=require("react-wrap-balancer"),Ge=require("tailwind-merge"),X=require("./MODIFIERS-4716c669.cjs"),we=require("@chaibuilder/blocks"),Se=require("./useChaiExternalData-a90e8aac.cjs"),he=require("react-dom");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");require("i18next");require("flagged");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("lucide-react");require("sonner");require("@radix-ui/react-separator");require("@radix-ui/react-switch");require("@radix-ui/react-hover-card");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-label");require("@radix-ui/react-alert-dialog");const Ve=()=>h.useMemo(()=>we.getChaiDataProviders(),[]),Xe=({children:n})=>{const[,t]=Se.useChaiExternalData(),[s]=u.usePageDataProviders(),i=Ve();return h.useEffect(()=>(t({}),d.each(s,c=>{const r=d.find(i,{providerKey:c.providerKey});if(r){const a=(r==null?void 0:r.mockFn)||(r==null?void 0:r.dataFn);a&&a(c.args).then(p=>t(v=>({...v,[c.providerKey]:p})))}}),()=>{d.each(s,c=>{t(r=>(delete r[c.providerKey],r))})}),[i,s,t]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n})},Ze=()=>{const{undoCount:n,redoCount:t,undo:s,redo:i}=u.useCanvasHistory();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(z.Button,{disabled:!n,size:"sm",onClick:s,className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(q.ResetIcon,{})}),e.jsxRuntimeExports.jsx(z.Button,{disabled:!t,onClick:i,size:"sm",className:"rounded-full",variant:"ghost",children:e.jsxRuntimeExports.jsx(q.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function Je(){const[n,t]=u.useDarkMode(),{t:s}=ke.useTranslation();return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx($e.Label,{htmlFor:"dark-mode-switch",children:s("dark_mode")}),e.jsxRuntimeExports.jsxs(L.Switch,{id:"dark-mode-switch",checked:n,onCheckedChange:()=>{t(!n)},className:`${n?"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:[e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),e.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${n?"translate-x-5":"translate-x-0"}
3
- pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const me=({landscape:n=!1})=>e.jsxRuntimeExports.jsxs("svg",{className:n?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[e.jsxRuntimeExports.jsx("g",{strokeWidth:0}),e.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),e.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:e.jsxRuntimeExports.jsx(q.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:e.jsxRuntimeExports.jsx(q.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:e.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:e.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:e.jsxRuntimeExports.jsx(q.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:e.jsxRuntimeExports.jsx(q.DesktopIcon,{}),width:1920}],et=({title:n,content:t,currentBreakpoint:s,breakpoint:i,width:c,icon:r,onClick:a})=>e.jsxRuntimeExports.jsxs(L.HoverCard,{children:[e.jsxRuntimeExports.jsx(L.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(z.Button,{onClick:()=>a(c),size:"sm",variant:i===s?"secondary":"ghost",children:r})}),e.jsxRuntimeExports.jsx(L.HoverCardContent,{className:"w-52 border-border",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:n}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),tt=()=>{const[,n,t]=u.useCanvasWidth(),[s,i]=u.useSelectedBreakpoints(),c=r=>{s.includes(r)?s.length>2&&i(s.filter(a=>a!==r)):i(a=>[...a,r])};return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[d.map(ye.filter(r=>d.includes(s,d.toUpper(r.breakpoint))),r=>h.createElement(et,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:n})),e.jsxRuntimeExports.jsxs(L.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(L.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:e.jsxRuntimeExports.jsx(q.DotsVerticalIcon,{className:"scale-90 transform"})})}),e.jsxRuntimeExports.jsxs(L.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[e.jsxRuntimeExports.jsx(L.DropdownMenuLabel,{children:"Breakpoints"}),e.jsxRuntimeExports.jsx(L.DropdownMenuSeparator,{}),d.map(ye,r=>e.jsxRuntimeExports.jsx(L.DropdownMenuCheckboxItem,{disabled:r.breakpoint==="xs",onCheckedChange:()=>c(d.toUpper(r.breakpoint)),checked:d.includes(s,d.toUpper(r.breakpoint)),children:r.title},r.breakpoint))]})]})]})},nt=()=>{const[n]=u.useSetAllBlocks(),{createSnapshot:t}=u.useCanvasHistory(),[,s]=u.useSelectedBlockIds(),[,i]=u.useSelectedStylingBlocks(),c=h.useCallback(()=>{n([]),s([]),i([]),t()},[n,t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs($.AlertDialog,{children:[e.jsxRuntimeExports.jsx($.AlertDialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(z.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[e.jsxRuntimeExports.jsx(q.EraserIcon,{})," Clear"]})}),e.jsxRuntimeExports.jsxs($.AlertDialogContent,{className:"border-border",children:[e.jsxRuntimeExports.jsxs($.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx($.AlertDialogTitle,{children:"Clear whole canvas?"}),e.jsxRuntimeExports.jsx($.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),e.jsxRuntimeExports.jsxs($.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx($.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx($.AlertDialogAction,{onClick:c,children:"Yes"})]})]})]})})},st=()=>{const n=u.useFeatureSupport("darkMode",!1),[t]=u.useCanvasZoom();return e.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Qe,{}),e.jsxRuntimeExports.jsx(Z.Separator,{orientation:"vertical"})]}):null,e.jsxRuntimeExports.jsx(tt,{}),e.jsxRuntimeExports.jsx(Z.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[e.jsxRuntimeExports.jsx(q.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",e.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[d.round(t,0),"%"]})]}),e.jsxRuntimeExports.jsx(Z.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Je,{})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[e.jsxRuntimeExports.jsx(Z.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(nt,{})]})]})},te={FRAMEWORK:"FRAMEWORK",STATIC:"STATIC",EMAIL:"EMAIL",PRESENTATION:"PRESENTATION",GRAPHIC:"GRAPHIC"},rt=`<!doctype html>
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:n=!1})=>e.jsxRuntimeExports.jsxs("svg",{className:n?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[e.jsxRuntimeExports.jsx("g",{strokeWidth:0}),e.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),e.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:e.jsxRuntimeExports.jsx(q.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:e.jsxRuntimeExports.jsx(q.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:e.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:e.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:e.jsxRuntimeExports.jsx(q.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:e.jsxRuntimeExports.jsx(q.DesktopIcon,{}),width:1920}],Qe=({title:n,content:t,currentBreakpoint:s,breakpoint:i,width:c,icon:r,onClick:a})=>e.jsxRuntimeExports.jsxs(L.HoverCard,{children:[e.jsxRuntimeExports.jsx(L.HoverCardTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(z.Button,{onClick:()=>a(c),size:"sm",variant:i===s?"secondary":"ghost",children:r})}),e.jsxRuntimeExports.jsx(L.HoverCardContent,{className:"w-52 border-border",children:e.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:n}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),et=()=>{const[,n,t]=u.useCanvasWidth(),[s,i]=u.useSelectedBreakpoints(),c=r=>{s.includes(r)?s.length>2&&i(s.filter(a=>a!==r)):i(a=>[...a,r])};return e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[d.map(ye.filter(r=>d.includes(s,d.toUpper(r.breakpoint))),r=>h.createElement(Qe,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:n})),e.jsxRuntimeExports.jsxs(L.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(L.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:e.jsxRuntimeExports.jsx(q.DotsVerticalIcon,{className:"scale-90 transform"})})}),e.jsxRuntimeExports.jsxs(L.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[e.jsxRuntimeExports.jsx(L.DropdownMenuLabel,{children:"Breakpoints"}),e.jsxRuntimeExports.jsx(L.DropdownMenuSeparator,{}),d.map(ye,r=>e.jsxRuntimeExports.jsx(L.DropdownMenuCheckboxItem,{disabled:r.breakpoint==="xs",onCheckedChange:()=>c(d.toUpper(r.breakpoint)),checked:d.includes(s,d.toUpper(r.breakpoint)),children:r.title},r.breakpoint))]})]})]})},tt=()=>{const[n]=u.useSetAllBlocks(),{createSnapshot:t}=u.useCanvasHistory(),[,s]=u.useSelectedBlockIds(),[,i]=u.useSelectedStylingBlocks(),c=h.useCallback(()=>{n([]),s([]),i([]),t()},[n,t]);return e.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:e.jsxRuntimeExports.jsxs($.AlertDialog,{children:[e.jsxRuntimeExports.jsx($.AlertDialogTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs(z.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[e.jsxRuntimeExports.jsx(q.EraserIcon,{})," Clear"]})}),e.jsxRuntimeExports.jsxs($.AlertDialogContent,{className:"border-border",children:[e.jsxRuntimeExports.jsxs($.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx($.AlertDialogTitle,{children:"Clear whole canvas?"}),e.jsxRuntimeExports.jsx($.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),e.jsxRuntimeExports.jsxs($.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx($.AlertDialogCancel,{children:"Cancel"}),e.jsxRuntimeExports.jsx($.AlertDialogAction,{onClick:c,children:"Yes"})]})]})]})})},nt=()=>{const n=u.useFeatureSupport("darkMode",!1),[t]=u.useCanvasZoom();return e.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Je,{}),e.jsxRuntimeExports.jsx(J.Separator,{orientation:"vertical"})]}):null,e.jsxRuntimeExports.jsx(et,{}),e.jsxRuntimeExports.jsx(J.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[e.jsxRuntimeExports.jsx(q.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",e.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[d.round(t,0),"%"]})]}),e.jsxRuntimeExports.jsx(J.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(Ze,{})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[e.jsxRuntimeExports.jsx(J.Separator,{orientation:"vertical"}),e.jsxRuntimeExports.jsx(tt,{})]})]})},te={FRAMEWORK:"FRAMEWORK",STATIC:"STATIC",EMAIL:"EMAIL",PRESENTATION:"PRESENTATION",GRAPHIC:"GRAPHIC"},st=`<!doctype html>
4
4
  <html class="scroll-smooth h-full overflow-y-auto">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -34,13 +34,13 @@
34
34
  <body class="font-body antialiased h-full">
35
35
  <div class="frame-root"></div>
36
36
  </body>
37
- </html>`,ot=n=>{const[t]=u.useCanvasWidth(),[,s]=u.useCanvasZoom(),[i,c]=h.useState({}),r=h.useCallback(()=>{const{width:a,height:p}=n;if(a<t){const v=parseFloat((a/t).toString());let R={};p&&(R={height:p+2*p*(1-v)}),c({transform:`scale(${v})`,transformOrigin:"top left",...R,maxWidth:"none"}),s(v*100)}else c({}),s(100)},[t,n,s]);return h.useEffect(()=>{r()},[t,n,s,r]),i};var ce={exports:{}};/*
37
+ </html>`,rt=n=>{const[t]=u.useCanvasWidth(),[,s]=u.useCanvasZoom(),[i,c]=h.useState({}),r=h.useCallback(()=>{const{width:a,height:p}=n;if(a<t){const v=parseFloat((a/t).toString());let R={};p&&(R={height:p+2*p*(1-v)}),c({transform:`scale(${v})`,transformOrigin:"top left",...R,maxWidth:"none"}),s(v*100)}else c({}),s(100)},[t,n,s]);return h.useEffect(()=>{r()},[t,n,s,r]),i};var ce={exports:{}};/*
38
38
  object-assign
39
39
  (c) Sindre Sorhus
40
40
  @license MIT
41
- */var ne,ge;function it(){if(ge)return ne;ge=1;var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function i(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function c(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var a={},p=0;p<10;p++)a["_"+String.fromCharCode(p)]=p;var v=Object.getOwnPropertyNames(a).map(function(x){return a[x]});if(v.join("")!=="0123456789")return!1;var R={};return"abcdefghijklmnopqrst".split("").forEach(function(x){R[x]=x}),Object.keys(Object.assign({},R)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ne=c()?Object.assign:function(r,a){for(var p,v=i(r),R,x=1;x<arguments.length;x++){p=Object(arguments[x]);for(var f in p)t.call(p,f)&&(v[f]=p[f]);if(n){R=n(p);for(var g=0;g<R.length;g++)s.call(p,R[g])&&(v[R[g]]=p[R[g]])}}return v},ne}var se,ve;function de(){if(ve)return se;ve=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return se=n,se}var re,je;function Ce(){return je||(je=1,re=Function.call.bind(Object.prototype.hasOwnProperty)),re}var oe,Ee;function at(){if(Ee)return oe;Ee=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var t=de(),s={},i=Ce();n=function(r){var a="Warning: "+r;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}}}function c(r,a,p,v,R){if(process.env.NODE_ENV!=="production"){for(var x in r)if(i(r,x)){var f;try{if(typeof r[x]!="function"){var g=Error((v||"React class")+": "+p+" type `"+x+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[x]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}f=r[x](a,x,v,p,null,t)}catch(B){f=B}if(f&&!(f instanceof Error)&&n((v||"React class")+": type specification of "+p+" `"+x+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in s)){s[f.message]=!0;var S=R?R():"";n("Failed "+p+" type: "+f.message+(S??""))}}}}return c.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(s={})},oe=c,oe}var ie,be;function ct(){if(be)return ie;be=1;var n=u.reactIsExports,t=it(),s=de(),i=Ce(),c=at(),r=function(){};process.env.NODE_ENV!=="production"&&(r=function(p){var v="Warning: "+p;typeof console<"u"&&console.error(v);try{throw new Error(v)}catch{}});function a(){return null}return ie=function(p,v){var R=typeof Symbol=="function"&&Symbol.iterator,x="@@iterator";function f(o){var l=o&&(R&&o[R]||o[x]);if(typeof l=="function")return l}var g="<<anonymous>>",S={array:m("array"),bigint:m("bigint"),bool:m("boolean"),func:m("function"),number:m("number"),object:m("object"),string:m("string"),symbol:m("symbol"),any:U(),arrayOf:N,element:Q(),elementType:ee(),instanceOf:O,node:Pe(),objectOf:W,oneOf:F,oneOfType:Oe,shape:Me,exact:qe};function B(o,l){return o===l?o!==0||1/o===1/l:o!==o&&l!==l}function w(o,l){this.message=o,this.data=l&&typeof l=="object"?l:{},this.stack=""}w.prototype=Error.prototype;function D(o){if(process.env.NODE_ENV!=="production")var l={},k=0;function E(C,j,b,T,A,I,_){if(T=T||g,I=I||b,_!==s){if(v){var P=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 P.name="Invariant Violation",P}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var Y=T+":"+b;!l[Y]&&k<3&&(r("You are manually calling a React.PropTypes validation function for the `"+I+"` prop on `"+T+"`. 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."),l[Y]=!0,k++)}}return j[b]==null?C?j[b]===null?new w("The "+A+" `"+I+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new w("The "+A+" `"+I+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:o(j,b,T,A,I)}var y=E.bind(null,!1);return y.isRequired=E.bind(null,!0),y}function m(o){function l(k,E,y,C,j,b){var T=k[E],A=H(T);if(A!==o){var I=G(T);return new w("Invalid "+C+" `"+j+"` of type "+("`"+I+"` supplied to `"+y+"`, expected ")+("`"+o+"`."),{expectedType:o})}return null}return D(l)}function U(){return D(a)}function N(o){function l(k,E,y,C,j){if(typeof o!="function")return new w("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside arrayOf.");var b=k[E];if(!Array.isArray(b)){var T=H(b);return new w("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an array."))}for(var A=0;A<b.length;A++){var I=o(b,A,y,C,j+"["+A+"]",s);if(I instanceof Error)return I}return null}return D(l)}function Q(){function o(l,k,E,y,C){var j=l[k];if(!p(j)){var b=H(j);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return D(o)}function ee(){function o(l,k,E,y,C){var j=l[k];if(!n.isValidElementType(j)){var b=H(j);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return D(o)}function O(o){function l(k,E,y,C,j){if(!(k[E]instanceof o)){var b=o.name||g,T=Le(k[E]);return new w("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected ")+("instance of `"+b+"`."))}return null}return D(l)}function F(o){if(!Array.isArray(o))return process.env.NODE_ENV!=="production"&&(arguments.length>1?r("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])."):r("Invalid argument supplied to oneOf, expected an array.")),a;function l(k,E,y,C,j){for(var b=k[E],T=0;T<o.length;T++)if(B(b,o[T]))return null;var A=JSON.stringify(o,function(_,P){var Y=G(P);return Y==="symbol"?String(P):P});return new w("Invalid "+C+" `"+j+"` of value `"+String(b)+"` "+("supplied to `"+y+"`, expected one of "+A+"."))}return D(l)}function W(o){function l(k,E,y,C,j){if(typeof o!="function")return new w("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside objectOf.");var b=k[E],T=H(b);if(T!=="object")return new w("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an object."));for(var A in b)if(i(b,A)){var I=o(b,A,y,C,j+"."+A,s);if(I instanceof Error)return I}return null}return D(l)}function Oe(o){if(!Array.isArray(o))return process.env.NODE_ENV!=="production"&&r("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var l=0;l<o.length;l++){var k=o[l];if(typeof k!="function")return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Ne(k)+" at index "+l+"."),a}function E(y,C,j,b,T){for(var A=[],I=0;I<o.length;I++){var _=o[I],P=_(y,C,j,b,T,s);if(P==null)return null;P.data&&i(P.data,"expectedType")&&A.push(P.data.expectedType)}var Y=A.length>0?", expected one of type ["+A.join(", ")+"]":"";return new w("Invalid "+b+" `"+T+"` supplied to "+("`"+j+"`"+Y+"."))}return D(E)}function Pe(){function o(l,k,E,y,C){return X(l[k])?null:new w("Invalid "+y+" `"+C+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return D(o)}function fe(o,l,k,E,y){return new w((o||"React class")+": "+l+" type `"+k+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+y+"`.")}function Me(o){function l(k,E,y,C,j){var b=k[E],T=H(b);if(T!=="object")return new w("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));for(var A in o){var I=o[A];if(typeof I!="function")return fe(y,C,j,A,G(I));var _=I(b,A,y,C,j+"."+A,s);if(_)return _}return null}return D(l)}function qe(o){function l(k,E,y,C,j){var b=k[E],T=H(b);if(T!=="object")return new w("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));var A=t({},k[E],o);for(var I in A){var _=o[I];if(i(o,I)&&typeof _!="function")return fe(y,C,j,I,G(_));if(!_)return new w("Invalid "+C+" `"+j+"` key `"+I+"` supplied to `"+y+"`.\nBad object: "+JSON.stringify(k[E],null," ")+`
42
- Valid keys: `+JSON.stringify(Object.keys(o),null," "));var P=_(b,I,y,C,j+"."+I,s);if(P)return P}return null}return D(l)}function X(o){switch(typeof o){case"number":case"string":case"undefined":return!0;case"boolean":return!o;case"object":if(Array.isArray(o))return o.every(X);if(o===null||p(o))return!0;var l=f(o);if(l){var k=l.call(o),E;if(l!==o.entries){for(;!(E=k.next()).done;)if(!X(E.value))return!1}else for(;!(E=k.next()).done;){var y=E.value;if(y&&!X(y[1]))return!1}}else return!1;return!0;default:return!1}}function _e(o,l){return o==="symbol"?!0:l?l["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&l instanceof Symbol:!1}function H(o){var l=typeof o;return Array.isArray(o)?"array":o instanceof RegExp?"object":_e(l,o)?"symbol":l}function G(o){if(typeof o>"u"||o===null)return""+o;var l=H(o);if(l==="object"){if(o instanceof Date)return"date";if(o instanceof RegExp)return"regexp"}return l}function Ne(o){var l=G(o);switch(l){case"array":case"object":return"an "+l;case"boolean":case"date":case"regexp":return"a "+l;default:return l}}function Le(o){return!o.constructor||!o.constructor.name?g:o.constructor.name}return S.checkPropTypes=c,S.resetWarningCache=c.resetWarningCache,S.PropTypes=S,S},ie}var ae,Re;function lt(){if(Re)return ae;Re=1;var n=de();function t(){}function s(){}return s.resetWarningCache=t,ae=function(){function i(a,p,v,R,x,f){if(f!==n){var g=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 g.name="Invariant Violation",g}}i.isRequired=i;function c(){return i}var r={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:c,element:i,elementType:i,instanceOf:c,node:i,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:s,resetWarningCache:t};return r.PropTypes=r,r},ae}if(process.env.NODE_ENV!=="production"){var ut=u.reactIsExports,dt=!0;ce.exports=ct()(ut.isElement,dt)}else ce.exports=lt()();var pt=ce.exports;const M=Ve.getDefaultExportFromCjs(pt);let Te,Ie;typeof document<"u"&&(Te=document);typeof window<"u"&&(Ie=window);const De=h.createContext({document:Te,window:Ie}),pe=()=>h.useContext(De),{Provider:ft,Consumer:Bt}=De;class Ae extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}K(Ae,"propTypes",{children:M.element.isRequired,contentDidMount:M.func.isRequired,contentDidUpdate:M.func.isRequired});class le extends h.Component{constructor(s,i){super(s,i);K(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:i}=this.props;typeof i=="function"?i(s):i&&(i.current=s)});K(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});K(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=h.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const s=this.getDoc();return this.props.mountTarget?s.querySelector(this.props.mountTarget):s.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const s=this.getDoc();if(!s)return null;const i=this.props.contentDidMount,c=this.props.contentDidUpdate,r=s.defaultView||s.parentView,a=e.jsxRuntimeExports.jsx(Ae,{contentDidMount:i,contentDidUpdate:c,children:e.jsxRuntimeExports.jsx(ft,{value:{document:s,window:r},children:e.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),p=this.getMountTarget();return[he.createPortal(this.props.head,this.getDoc().head),he.createPortal(a,p)]}render(){const s={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete s.head,delete s.initialContent,delete s.mountTarget,delete s.contentDidMount,delete s.contentDidUpdate,delete s.forwardedRef,e.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}K(le,"propTypes",{style:M.object,head:M.node,initialContent:M.string,mountTarget:M.string,contentDidMount:M.func,contentDidUpdate:M.func,children:M.oneOfType([M.element,M.arrayOf(M.element)])}),K(le,"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 xt=h.forwardRef((n,t)=>e.jsxRuntimeExports.jsx(le,{...n,forwardedRef:t})),ht=({children:n})=>{const{document:t}=pe(),[s]=u.useSelectedBlockIds(),[i,c]=u.useSelectedStylingBlocks();return h.useEffect(()=>{setTimeout(()=>{if(!d.isEmpty(i))return;const r=Be(t,d.first(s));if(r){const a=r.getAttribute("data-style-prop");if(a){const p=r.getAttribute("data-style-id"),v=r.getAttribute("data-block-parent");c([{id:p,prop:a,blockId:v}])}}},100)},[t,s,c,i]),e.jsxRuntimeExports.jsx("div",{id:"canvas",className:"relative h-screen max-w-full outline-2",children:n})},Be=(n,t)=>n.querySelector(`[data-block-id="${t}"]`),mt=()=>{const{window:n}=pe(),[t,s]=u.useSelectedBlockIds(),[,i]=u.useSelectedStylingBlocks(),{undo:c,redo:r}=u.useCanvasHistory(),a=u.useDuplicateBlocks(),[,p]=u.useCutBlockIds(),[,v]=u.useCopyBlockIds(),{pasteBlocks:R}=u.usePasteBlocks(),[,x]=u.usePreviewMode(),f=u.useRemoveBlocks(),{savePage:g}=u.useSavePage(),[S]=V.useAtom(u.inlineEditingActiveAtom),[,B]=V.useAtom(u.editLayerNameAtom),w=D=>{D.key==="Enter"&&(D.preventDefault(),t.length===1&&B(d.first(t)))};return h.useEffect(()=>{const D=m=>{if(m.key==="Escape"){s([]),i([]);return}if(w(m),!S&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),f(t)),m.ctrlKey||m.metaKey){if(["z","y","d","x","c","p","s","v"].includes(m.key)){if(S&&["x","z","v"].includes(m.key))return!0;m.preventDefault()}m.key==="s"&&(m.stopPropagation(),m.preventDefault(),g()),m.key==="z"&&c(),m.key==="y"&&r(),m.key==="d"&&a(t),m.key==="x"&&p(t),m.key==="c"&&v(t),m.key==="v"&&t.length>0&&R(t[0])}};return n.removeEventListener("keydown",D),n.addEventListener("keydown",D),()=>{n.removeEventListener("keydown",D)}},[t,s,c,f,x,r,a,p,v,R,S,g,n]),null},yt=({block:n,label:t})=>{const[,s]=He.useDrag(()=>({type:"CANVAS_BLOCK",item:n}));return e.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:s,onDragStart:()=>{console.log("drag start")},children:[e.jsxRuntimeExports.jsx(q.DragHandleDots2Icon,{}),t]})},gt=({selectedBlockElement:n,block:t})=>{const s=u.useRemoveBlocks(),i=u.useDuplicateBlocks(),[,c]=u.useSelectedBlockIds(),[,r]=u.useSelectedStylingBlocks(),{floatingStyles:a,refs:p,update:v}=xe.useFloating({placement:"top-start",middleware:[xe.shift(),Ue.flip()],elements:{reference:n}});ze.useResizeObserver(n,()=>v(),n!==null);const R=d.get(t,"_parent",null),x=d.isEmpty(d.get(t,"_name",""))?d.get(t,"_type",""):d.get(t,"_name","");return!n||!t?null:e.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:p.setFloating,style:a,onClick:f=>{f.stopPropagation(),f.preventDefault()},onKeyDown:f=>f.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[e.jsxRuntimeExports.jsx(yt,{label:x,block:t}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[R&&e.jsxRuntimeExports.jsx(q.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{r([]),c([R])}}),u.canDuplicateBlock(d.get(t,"_type",""))?e.jsxRuntimeExports.jsx(q.CopyIcon,{className:"hover:scale-105 ",onClick:()=>i([t==null?void 0:t._id])}):null,u.canDeleteBlock(d.get(t,"_type",""))?e.jsxRuntimeExports.jsx(q.TrashIcon,{className:"hover:scale-105 ",onClick:()=>s([t==null?void 0:t._id])}):null]})]})},vt=({model:n})=>{const[t]=u.useBrandingOptions(),[s]=u.useSelectedBlockIds(),[i]=u.useDarkMode(),[c]=u.useHighlightBlockId(),[r]=u.useSelectedStylingBlocks(),{document:a,window:p}=pe(),[v]=h.useState(a==null?void 0:a.getElementById("highlighted-block")),[R]=h.useState(a==null?void 0:a.getElementById("selected-block")),[x]=h.useState(a==null?void 0:a.getElementById("selected-styling-block"));h.useEffect(()=>{i?a==null||a.documentElement.classList.add("dark"):a==null||a.documentElement.classList.remove("dark")},[i,a]);const f=d.get(t,"headingFont","DM Sans"),g=d.get(t,"bodyFont","DM Sans");return h.useEffect(()=>{const S=d.get(t,"primaryColor","#000"),B=d.get(t,"secondaryColor","#FFF"),w=Ke.tailwindcssPaletteGenerator({colors:[S,B],names:["primary","secondary"]});w.primary.DEFAULT=S,w.secondary.DEFAULT=B;const D=d.get(t,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[f],body:[g]},extend:{borderRadius:{global:`${D||"0"}px`},colors:w}},plugins:[p.tailwind.plugin.withOptions(({prefix:m="ui"}={})=>({addVariant:U})=>{for(const N of["open","checked","selected","active","disabled"])U(`${m}-${N}`,[`&[data-headlessui-state~="${N}"]`,`:where([data-headlessui-state~="${N}"]) &`]),U(`${m}-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,f,g]),h.useEffect(()=>{R&&(R.textContent=`${d.map(s,S=>`[data-block-id="${S}"]`).join(",")}{
41
+ */var ne,ge;function ot(){if(ge)return ne;ge=1;var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function i(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function c(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var a={},p=0;p<10;p++)a["_"+String.fromCharCode(p)]=p;var v=Object.getOwnPropertyNames(a).map(function(x){return a[x]});if(v.join("")!=="0123456789")return!1;var R={};return"abcdefghijklmnopqrst".split("").forEach(function(x){R[x]=x}),Object.keys(Object.assign({},R)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ne=c()?Object.assign:function(r,a){for(var p,v=i(r),R,x=1;x<arguments.length;x++){p=Object(arguments[x]);for(var f in p)t.call(p,f)&&(v[f]=p[f]);if(n){R=n(p);for(var g=0;g<R.length;g++)s.call(p,R[g])&&(v[R[g]]=p[R[g]])}}return v},ne}var se,ve;function de(){if(ve)return se;ve=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return se=n,se}var re,je;function Ce(){return je||(je=1,re=Function.call.bind(Object.prototype.hasOwnProperty)),re}var oe,Ee;function it(){if(Ee)return oe;Ee=1;var n=function(){};if(process.env.NODE_ENV!=="production"){var t=de(),s={},i=Ce();n=function(r){var a="Warning: "+r;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}}}function c(r,a,p,v,R){if(process.env.NODE_ENV!=="production"){for(var x in r)if(i(r,x)){var f;try{if(typeof r[x]!="function"){var g=Error((v||"React class")+": "+p+" type `"+x+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[x]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}f=r[x](a,x,v,p,null,t)}catch(B){f=B}if(f&&!(f instanceof Error)&&n((v||"React class")+": type specification of "+p+" `"+x+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in s)){s[f.message]=!0;var S=R?R():"";n("Failed "+p+" type: "+f.message+(S??""))}}}}return c.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(s={})},oe=c,oe}var ie,be;function at(){if(be)return ie;be=1;var n=u.reactIsExports,t=ot(),s=de(),i=Ce(),c=it(),r=function(){};process.env.NODE_ENV!=="production"&&(r=function(p){var v="Warning: "+p;typeof console<"u"&&console.error(v);try{throw new Error(v)}catch{}});function a(){return null}return ie=function(p,v){var R=typeof Symbol=="function"&&Symbol.iterator,x="@@iterator";function f(o){var l=o&&(R&&o[R]||o[x]);if(typeof l=="function")return l}var g="<<anonymous>>",S={array:m("array"),bigint:m("bigint"),bool:m("boolean"),func:m("function"),number:m("number"),object:m("object"),string:m("string"),symbol:m("symbol"),any:U(),arrayOf:N,element:Q(),elementType:ee(),instanceOf:O,node:Pe(),objectOf:W,oneOf:F,oneOfType:Oe,shape:Me,exact:qe};function B(o,l){return o===l?o!==0||1/o===1/l:o!==o&&l!==l}function w(o,l){this.message=o,this.data=l&&typeof l=="object"?l:{},this.stack=""}w.prototype=Error.prototype;function D(o){if(process.env.NODE_ENV!=="production")var l={},k=0;function E(C,j,b,T,A,I,_){if(T=T||g,I=I||b,_!==s){if(v){var P=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 P.name="Invariant Violation",P}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var Y=T+":"+b;!l[Y]&&k<3&&(r("You are manually calling a React.PropTypes validation function for the `"+I+"` prop on `"+T+"`. 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."),l[Y]=!0,k++)}}return j[b]==null?C?j[b]===null?new w("The "+A+" `"+I+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new w("The "+A+" `"+I+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:o(j,b,T,A,I)}var y=E.bind(null,!1);return y.isRequired=E.bind(null,!0),y}function m(o){function l(k,E,y,C,j,b){var T=k[E],A=H(T);if(A!==o){var I=G(T);return new w("Invalid "+C+" `"+j+"` of type "+("`"+I+"` supplied to `"+y+"`, expected ")+("`"+o+"`."),{expectedType:o})}return null}return D(l)}function U(){return D(a)}function N(o){function l(k,E,y,C,j){if(typeof o!="function")return new w("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside arrayOf.");var b=k[E];if(!Array.isArray(b)){var T=H(b);return new w("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an array."))}for(var A=0;A<b.length;A++){var I=o(b,A,y,C,j+"["+A+"]",s);if(I instanceof Error)return I}return null}return D(l)}function Q(){function o(l,k,E,y,C){var j=l[k];if(!p(j)){var b=H(j);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement."))}return null}return D(o)}function ee(){function o(l,k,E,y,C){var j=l[k];if(!n.isValidElementType(j)){var b=H(j);return new w("Invalid "+y+" `"+C+"` of type "+("`"+b+"` supplied to `"+E+"`, expected a single ReactElement type."))}return null}return D(o)}function O(o){function l(k,E,y,C,j){if(!(k[E]instanceof o)){var b=o.name||g,T=Le(k[E]);return new w("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected ")+("instance of `"+b+"`."))}return null}return D(l)}function F(o){if(!Array.isArray(o))return process.env.NODE_ENV!=="production"&&(arguments.length>1?r("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])."):r("Invalid argument supplied to oneOf, expected an array.")),a;function l(k,E,y,C,j){for(var b=k[E],T=0;T<o.length;T++)if(B(b,o[T]))return null;var A=JSON.stringify(o,function(_,P){var Y=G(P);return Y==="symbol"?String(P):P});return new w("Invalid "+C+" `"+j+"` of value `"+String(b)+"` "+("supplied to `"+y+"`, expected one of "+A+"."))}return D(l)}function W(o){function l(k,E,y,C,j){if(typeof o!="function")return new w("Property `"+j+"` of component `"+y+"` has invalid PropType notation inside objectOf.");var b=k[E],T=H(b);if(T!=="object")return new w("Invalid "+C+" `"+j+"` of type "+("`"+T+"` supplied to `"+y+"`, expected an object."));for(var A in b)if(i(b,A)){var I=o(b,A,y,C,j+"."+A,s);if(I instanceof Error)return I}return null}return D(l)}function Oe(o){if(!Array.isArray(o))return process.env.NODE_ENV!=="production"&&r("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var l=0;l<o.length;l++){var k=o[l];if(typeof k!="function")return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Ne(k)+" at index "+l+"."),a}function E(y,C,j,b,T){for(var A=[],I=0;I<o.length;I++){var _=o[I],P=_(y,C,j,b,T,s);if(P==null)return null;P.data&&i(P.data,"expectedType")&&A.push(P.data.expectedType)}var Y=A.length>0?", expected one of type ["+A.join(", ")+"]":"";return new w("Invalid "+b+" `"+T+"` supplied to "+("`"+j+"`"+Y+"."))}return D(E)}function Pe(){function o(l,k,E,y,C){return Z(l[k])?null:new w("Invalid "+y+" `"+C+"` supplied to "+("`"+E+"`, expected a ReactNode."))}return D(o)}function fe(o,l,k,E,y){return new w((o||"React class")+": "+l+" type `"+k+"."+E+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+y+"`.")}function Me(o){function l(k,E,y,C,j){var b=k[E],T=H(b);if(T!=="object")return new w("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));for(var A in o){var I=o[A];if(typeof I!="function")return fe(y,C,j,A,G(I));var _=I(b,A,y,C,j+"."+A,s);if(_)return _}return null}return D(l)}function qe(o){function l(k,E,y,C,j){var b=k[E],T=H(b);if(T!=="object")return new w("Invalid "+C+" `"+j+"` of type `"+T+"` "+("supplied to `"+y+"`, expected `object`."));var A=t({},k[E],o);for(var I in A){var _=o[I];if(i(o,I)&&typeof _!="function")return fe(y,C,j,I,G(_));if(!_)return new w("Invalid "+C+" `"+j+"` key `"+I+"` supplied to `"+y+"`.\nBad object: "+JSON.stringify(k[E],null," ")+`
42
+ Valid keys: `+JSON.stringify(Object.keys(o),null," "));var P=_(b,I,y,C,j+"."+I,s);if(P)return P}return null}return D(l)}function Z(o){switch(typeof o){case"number":case"string":case"undefined":return!0;case"boolean":return!o;case"object":if(Array.isArray(o))return o.every(Z);if(o===null||p(o))return!0;var l=f(o);if(l){var k=l.call(o),E;if(l!==o.entries){for(;!(E=k.next()).done;)if(!Z(E.value))return!1}else for(;!(E=k.next()).done;){var y=E.value;if(y&&!Z(y[1]))return!1}}else return!1;return!0;default:return!1}}function _e(o,l){return o==="symbol"?!0:l?l["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&l instanceof Symbol:!1}function H(o){var l=typeof o;return Array.isArray(o)?"array":o instanceof RegExp?"object":_e(l,o)?"symbol":l}function G(o){if(typeof o>"u"||o===null)return""+o;var l=H(o);if(l==="object"){if(o instanceof Date)return"date";if(o instanceof RegExp)return"regexp"}return l}function Ne(o){var l=G(o);switch(l){case"array":case"object":return"an "+l;case"boolean":case"date":case"regexp":return"a "+l;default:return l}}function Le(o){return!o.constructor||!o.constructor.name?g:o.constructor.name}return S.checkPropTypes=c,S.resetWarningCache=c.resetWarningCache,S.PropTypes=S,S},ie}var ae,Re;function ct(){if(Re)return ae;Re=1;var n=de();function t(){}function s(){}return s.resetWarningCache=t,ae=function(){function i(a,p,v,R,x,f){if(f!==n){var g=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 g.name="Invariant Violation",g}}i.isRequired=i;function c(){return i}var r={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:c,element:i,elementType:i,instanceOf:c,node:i,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:s,resetWarningCache:t};return r.PropTypes=r,r},ae}if(process.env.NODE_ENV!=="production"){var lt=u.reactIsExports,ut=!0;ce.exports=at()(lt.isElement,ut)}else ce.exports=ct()();var dt=ce.exports;const M=X.getDefaultExportFromCjs(dt);let Te,Ie;typeof document<"u"&&(Te=document);typeof window<"u"&&(Ie=window);const De=h.createContext({document:Te,window:Ie}),pe=()=>h.useContext(De),{Provider:pt,Consumer:At}=De;class Ae extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}K(Ae,"propTypes",{children:M.element.isRequired,contentDidMount:M.func.isRequired,contentDidUpdate:M.func.isRequired});class le extends h.Component{constructor(s,i){super(s,i);K(this,"setRef",s=>{this.nodeRef.current=s;const{forwardedRef:i}=this.props;typeof i=="function"?i(s):i&&(i.current=s)});K(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});K(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=h.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const s=this.getDoc();return this.props.mountTarget?s.querySelector(this.props.mountTarget):s.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const s=this.getDoc();if(!s)return null;const i=this.props.contentDidMount,c=this.props.contentDidUpdate,r=s.defaultView||s.parentView,a=e.jsxRuntimeExports.jsx(Ae,{contentDidMount:i,contentDidUpdate:c,children:e.jsxRuntimeExports.jsx(pt,{value:{document:s,window:r},children:e.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),p=this.getMountTarget();return[he.createPortal(this.props.head,this.getDoc().head),he.createPortal(a,p)]}render(){const s={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete s.head,delete s.initialContent,delete s.mountTarget,delete s.contentDidMount,delete s.contentDidUpdate,delete s.forwardedRef,e.jsxRuntimeExports.jsx("iframe",{...s,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}K(le,"propTypes",{style:M.object,head:M.node,initialContent:M.string,mountTarget:M.string,contentDidMount:M.func,contentDidUpdate:M.func,children:M.oneOfType([M.element,M.arrayOf(M.element)])}),K(le,"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 ft=h.forwardRef((n,t)=>e.jsxRuntimeExports.jsx(le,{...n,forwardedRef:t})),xt=({children:n})=>{const{document:t}=pe(),[s]=u.useSelectedBlockIds(),[i,c]=u.useSelectedStylingBlocks();return h.useEffect(()=>{setTimeout(()=>{if(!d.isEmpty(i))return;const r=Be(t,d.first(s));if(r){const a=r.getAttribute("data-style-prop");if(a){const p=r.getAttribute("data-style-id"),v=r.getAttribute("data-block-parent");c([{id:p,prop:a,blockId:v}])}}},100)},[t,s,c,i]),e.jsxRuntimeExports.jsx("div",{id:"canvas",className:"relative h-screen max-w-full outline-2",children:n})},Be=(n,t)=>n.querySelector(`[data-block-id="${t}"]`),ht=()=>{const{window:n}=pe(),[t,s]=u.useSelectedBlockIds(),[,i]=u.useSelectedStylingBlocks(),{undo:c,redo:r}=u.useCanvasHistory(),a=u.useDuplicateBlocks(),[,p]=u.useCutBlockIds(),[,v]=u.useCopyBlockIds(),{pasteBlocks:R}=u.usePasteBlocks(),[,x]=u.usePreviewMode(),f=u.useRemoveBlocks(),{savePage:g}=u.useSavePage(),[S]=V.useAtom(u.inlineEditingActiveAtom),[,B]=V.useAtom(u.editLayerNameAtom),w=D=>{D.key==="Enter"&&(D.preventDefault(),t.length===1&&B(d.first(t)))};return h.useEffect(()=>{const D=m=>{if(m.key==="Escape"){s([]),i([]);return}if(w(m),!S&&(m.key==="Delete"||m.key==="Backspace")&&(m.preventDefault(),f(t)),m.ctrlKey||m.metaKey){if(["z","y","d","x","c","p","s","v"].includes(m.key)){if(S&&["x","z","v"].includes(m.key))return!0;m.preventDefault()}m.key==="s"&&(m.stopPropagation(),m.preventDefault(),g()),m.key==="z"&&c(),m.key==="y"&&r(),m.key==="d"&&a(t),m.key==="x"&&p(t),m.key==="c"&&v(t),m.key==="v"&&t.length>0&&R(t[0])}};return n.removeEventListener("keydown",D),n.addEventListener("keydown",D),()=>{n.removeEventListener("keydown",D)}},[t,s,c,f,x,r,a,p,v,R,S,g,n]),null},mt=({block:n,label:t})=>{const[,s]=He.useDrag(()=>({type:"CANVAS_BLOCK",item:n}));return e.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",ref:s,onDragStart:()=>{console.log("drag start")},children:[e.jsxRuntimeExports.jsx(q.DragHandleDots2Icon,{}),t]})},yt=({selectedBlockElement:n,block:t})=>{const s=u.useRemoveBlocks(),i=u.useDuplicateBlocks(),[,c]=u.useSelectedBlockIds(),[,r]=u.useSelectedStylingBlocks(),{floatingStyles:a,refs:p,update:v}=xe.useFloating({placement:"top-start",middleware:[xe.shift(),Ue.flip()],elements:{reference:n}});ze.useResizeObserver(n,()=>v(),n!==null);const R=d.get(t,"_parent",null),x=d.isEmpty(d.get(t,"_name",""))?d.get(t,"_type",""):d.get(t,"_name","");return!n||!t?null:e.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:p.setFloating,style:a,onClick:f=>{f.stopPropagation(),f.preventDefault()},onKeyDown:f=>f.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[e.jsxRuntimeExports.jsx(mt,{label:x,block:t}),e.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[R&&e.jsxRuntimeExports.jsx(q.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{r([]),c([R])}}),u.canDuplicateBlock(d.get(t,"_type",""))?e.jsxRuntimeExports.jsx(q.CopyIcon,{className:"hover:scale-105 ",onClick:()=>i([t==null?void 0:t._id])}):null,u.canDeleteBlock(d.get(t,"_type",""))?e.jsxRuntimeExports.jsx(q.TrashIcon,{className:"hover:scale-105 ",onClick:()=>s([t==null?void 0:t._id])}):null]})]})},gt=({model:n})=>{const[t]=u.useBrandingOptions(),[s]=u.useSelectedBlockIds(),[i]=u.useDarkMode(),[c]=u.useHighlightBlockId(),[r]=u.useSelectedStylingBlocks(),{document:a,window:p}=pe(),[v]=h.useState(a==null?void 0:a.getElementById("highlighted-block")),[R]=h.useState(a==null?void 0:a.getElementById("selected-block")),[x]=h.useState(a==null?void 0:a.getElementById("selected-styling-block"));h.useEffect(()=>{i?a==null||a.documentElement.classList.add("dark"):a==null||a.documentElement.classList.remove("dark")},[i,a]);const f=d.get(t,"headingFont","DM Sans"),g=d.get(t,"bodyFont","DM Sans");return h.useEffect(()=>{const S=d.get(t,"primaryColor","#000"),B=d.get(t,"secondaryColor","#FFF"),w=Ke.tailwindcssPaletteGenerator({colors:[S,B],names:["primary","secondary"]});w.primary.DEFAULT=S,w.secondary.DEFAULT=B;const D=d.get(t,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[f],body:[g]},extend:{borderRadius:{global:`${D||"0"}px`},colors:w}},plugins:[p.tailwind.plugin.withOptions(({prefix:m="ui"}={})=>({addVariant:U})=>{for(const N of["open","checked","selected","active","disabled"])U(`${m}-${N}`,[`&[data-headlessui-state~="${N}"]`,`:where([data-headlessui-state~="${N}"]) &`]),U(`${m}-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,f,g]),h.useEffect(()=>{R&&(R.textContent=`${d.map(s,S=>`[data-block-id="${S}"]`).join(",")}{
43
43
  outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
44
44
  }`)},[s,R]),h.useEffect(()=>{v&&(v.textContent=c?`[data-style-id="${c}"]{ outline: 1px solid orange !important; outline-offset: -1px;}`:"")},[c,s,v]),h.useEffect(()=>{x&&(x.textContent=`${d.map(r,({id:S})=>`[data-style-id="${S}"]`).join(",")}{
45
45
  outline: 1px solid orange !important; outline-offset: -1px;
46
- }`)},[r,x]),h.useEffect(()=>{if(n==="section")return;const S=d.get(t,"bodyTextLightColor","#64748b"),B=d.get(t,"bodyTextDarkColor","#94a3b8"),w=d.get(t,"bodyBgLightColor","#FFFFFF"),D=d.get(t,"bodyBgDarkColor","#0f172a");a.body.className=`font-body antialiased text-[${S}] bg-[${w}] dark:text-[${B}] dark:bg-[${D}]`},[t,a,n]),n==="page"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[f&&e.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${f.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),g&&f!==g&&e.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${g.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),f&&e.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${f}",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},jt=()=>{const{t:n}=ke.useTranslation();return e.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:e.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:n("canvas_empty")})})},Et=n=>{const t={};return Object.keys(n).forEach(s=>{d.isString(n[s])&&n[s].startsWith(J.SLOT_KEY)&&(t[s]=n[s].replace(J.SLOT_KEY,"").split(","))}),t},bt=d.memoize(n=>{const t=n.replace(J.STYLES_KEY,"").split(",");return Ge.twMerge(t[0],t[1])});function Rt(n,t){return d.get(n,`${t}_attrs`,{})}function kt(n,t,s,i){const c={};return Object.keys(n).forEach(r=>{if(d.isString(n[r])&&n[r].startsWith(J.STYLES_KEY)){const a=bt(n[r]);c[r]={className:a,"data-style-prop":r,"data-block-parent":n._id,"data-style-id":`${r}-${n._id}`,onMouseEnter:t,onMouseLeave:s,onClick:i,...Rt(n,r)}}}),c}function wt(n,t){const s=d.get(n,"_bindings",{});return d.isEmpty(s)?{...n}:(d.each(s,(i,c)=>{d.isString(i)&&d.get(t,i,null)&&(n[c]=d.get(t,i,null))}),n)}function ue({blocks:n}){const t=u.useAllBlocks(),[,s]=u.useHighlightBlockId(),[,i]=u.useSelectedStylingBlocks(),[,c]=u.useSelectedBlockIds(),r=h.useCallback(x=>{var g;const f=(g=x.currentTarget)==null?void 0:g.getAttribute("data-style-id");s(f||""),x.stopPropagation()},[s]),a=h.useCallback(x=>{s(""),x.stopPropagation()},[s]),p=h.useCallback(x=>{x.stopPropagation();const f=x.currentTarget;if(f.getAttribute("data-block-parent")){const g=f.getAttribute("data-style-prop"),S=f.getAttribute("data-style-id"),B=f.getAttribute("data-block-parent");i([{id:S,prop:g,blockId:B}]),c([B])}else if(f.getAttribute("data-block-id")&&(c([f.getAttribute("data-block-id")]),f.getAttribute("data-block-parent"))){const g=f.getAttribute("data-style-prop"),S=f.getAttribute("data-style-id"),B=f.getAttribute("data-block-parent");i([{id:S,prop:g,blockId:B}])}},[i,c]),v=h.useCallback(x=>kt(x,r,a,p),[p,r,a]),[R]=Se.useChaiExternalData();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:h.Children.toArray(n.map((x,f)=>{const g=Et(x),S={};d.isEmpty(g)||Object.keys(g).forEach(m=>{S[m]=h.Children.toArray(g[m].map(U=>e.jsxRuntimeExports.jsx(ue,{blocks:[d.find(t,{_id:U})]})))});const B=d.filter(t,{_parent:x._id});S.children=B.length?e.jsxRuntimeExports.jsx(ue,{blocks:B}):null;const w=we.getBlockComponent(x._type),D=d.get(w,"component",null);return d.isNull(D)?e.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${x==null?void 0:x._type} not registered -->`}):e.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(D,{blockProps:{onClick:p,"data-block-id":x._id,"data-block-type":x._type},inBuilder:!0,index:f,...wt(x,R),...v(x),...S})})}))})}const St=()=>{const n=u.useAllBlocks();return e.jsxRuntimeExports.jsx(Ye.Provider,{children:d.isEmpty(n)?e.jsxRuntimeExports.jsx(jt,{}):e.jsxRuntimeExports.jsx(Ze,{children:e.jsxRuntimeExports.jsx(ue,{blocks:d.filter(n,t=>d.isEmpty(t._parent))})})})},Ct=(n,t)=>n.querySelector(`[data-style-id="${t}"]`),Tt=()=>{const[n]=V.useAtom(u.networkModeAtom),[t]=u.usePreviewMode(),[s]=u.useCanvasWidth(),[,i]=u.useSelectedBlockIds(),c=u.useSelectedBlock(),[,r]=u.useHighlightBlockId(),a=h.useRef(null),p=h.useRef(null),[v,R]=h.useState({width:0,height:0}),x=ot(v),[f,g]=h.useState(0),[S,B]=h.useState([]),[,w]=h.useState([]),[,D]=V.useAtom(u.canvasIframeAtom),[m,U]=u.useSelectedStylingBlocks(),N=z.useBuilderProp("loadingCanvas",!1);h.useEffect(()=>{const{clientWidth:O,clientHeight:F}=p.current;R({width:O,height:F}),f===0&&g(O)},[p,s,f]);const Q=(O,F=0)=>{const{top:W}=O.getBoundingClientRect();return W+F>=0&&W-F<=window.innerHeight};h.useEffect(()=>{var O,F;if(c&&c.type!=="Multiple"&&a.current){const W=Be(a.current.contentDocument,c._id);W&&(Q(W)||(F=(O=a.current)==null?void 0:O.contentWindow)==null||F.scrollTo({top:W.offsetTop,behavior:"smooth"}),B([W]))}},[c]),h.useEffect(()=>{if(!d.isEmpty(m)&&a.current){const O=Ct(a.current.contentDocument,d.first(m).id);w(O?[O]:[null])}else w([null])},[m]);const ee=h.useMemo(()=>{let O=rt;return n==="offline"&&(O=O.replace("https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio","/offline/tailwind.cdn.js"),O=O.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),O=O.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),O},[n]);return e.jsxRuntimeExports.jsx("div",{onClick:()=>{i([]),U([])},onMouseLeave:()=>setTimeout(()=>r(""),300),className:"relative mx-auto h-full w-full bg-black/80",style:f>0&&!d.isEmpty(x)?{width:t?"100%":f}:{},ref:p,children:e.jsxRuntimeExports.jsxs(xt,{contentDidMount:()=>D(a.current),ref:a,id:"canvas-iframe",style:{width:`${s}px`,...x},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:ee,children:[e.jsxRuntimeExports.jsx(mt,{}),e.jsxRuntimeExports.jsx(gt,{block:c,selectedBlockElement:d.first(S)}),e.jsxRuntimeExports.jsx(vt,{model:"page"}),e.jsxRuntimeExports.jsxs(ht,{children:[N?e.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:e.jsxRuntimeExports.jsx(z.Skeleton,{className:"h-full"})}):e.jsxRuntimeExports.jsx(St,{}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},It=h.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-6fc9d7de.cjs"))),Dt=()=>{const n=z.useBuilderProp("mode",te.STATIC),[t,s]=V.useAtom(u.addBlocksModalAtom),i={[te.STATIC]:e.jsxRuntimeExports.jsx(Tt,{}),[te.FRAMEWORK]:null}[n];return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxRuntimeExports.jsx(st,{}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/20 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[e.jsxRuntimeExports.jsx(h.Suspense,{fallback:e.jsxRuntimeExports.jsx(z.Skeleton,{className:"h-full"}),children:e.jsxRuntimeExports.jsx(u.ErrorBoundary,{children:i})}),t?e.jsxRuntimeExports.jsx("div",{onClick:()=>s(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:e.jsxRuntimeExports.jsx("div",{onClick:c=>c.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:e.jsxRuntimeExports.jsx(It,{})})}):null]})]})};exports.default=Dt;
46
+ }`)},[r,x]),h.useEffect(()=>{if(n==="section")return;const S=d.get(t,"bodyTextLightColor","#64748b"),B=d.get(t,"bodyTextDarkColor","#94a3b8"),w=d.get(t,"bodyBgLightColor","#FFFFFF"),D=d.get(t,"bodyBgDarkColor","#0f172a");a.body.className=`font-body antialiased text-[${S}] bg-[${w}] dark:text-[${B}] dark:bg-[${D}]`},[t,a,n]),n==="page"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[f&&e.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${f.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),g&&f!==g&&e.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${g.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),f&&e.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${f}",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},vt=()=>{const{t:n}=ke.useTranslation();return e.jsxRuntimeExports.jsx("div",{className:"my-auto py-24 text-center text-gray-600 dark:text-white",children:e.jsxRuntimeExports.jsx("h1",{className:"mb-10 text-4xl ",children:n("canvas_empty")})})},jt=n=>{const t={};return Object.keys(n).forEach(s=>{d.isString(n[s])&&n[s].startsWith(X.SLOT_KEY)&&(t[s]=n[s].replace(X.SLOT_KEY,"").split(","))}),t},Et=d.memoize(n=>{const t=n.replace(X.STYLES_KEY,"").split(",");return Ge.twMerge(t[0],t[1])});function bt(n,t){return d.get(n,`${t}_attrs`,{})}function Rt(n,t,s,i){const c={};return Object.keys(n).forEach(r=>{if(d.isString(n[r])&&n[r].startsWith(X.STYLES_KEY)){const a=Et(n[r]);c[r]={className:a,"data-style-prop":r,"data-block-parent":n._id,"data-style-id":`${r}-${n._id}`,onMouseEnter:t,onMouseLeave:s,onClick:i,...bt(n,r)}}}),c}function kt(n,t){const s=d.get(n,"_bindings",{});return d.isEmpty(s)?{...n}:(d.each(s,(i,c)=>{d.isString(i)&&d.get(t,i,null)&&(n[c]=d.get(t,i,null))}),n)}function ue({blocks:n}){const t=u.useAllBlocks(),[,s]=u.useHighlightBlockId(),[,i]=u.useSelectedStylingBlocks(),[,c]=u.useSelectedBlockIds(),r=h.useCallback(x=>{var g;const f=(g=x.currentTarget)==null?void 0:g.getAttribute("data-style-id");s(f||""),x.stopPropagation()},[s]),a=h.useCallback(x=>{s(""),x.stopPropagation()},[s]),p=h.useCallback(x=>{x.stopPropagation();const f=x.currentTarget;if(f.getAttribute("data-block-parent")){const g=f.getAttribute("data-style-prop"),S=f.getAttribute("data-style-id"),B=f.getAttribute("data-block-parent");i([{id:S,prop:g,blockId:B}]),c([B])}else if(f.getAttribute("data-block-id")&&(c([f.getAttribute("data-block-id")]),f.getAttribute("data-block-parent"))){const g=f.getAttribute("data-style-prop"),S=f.getAttribute("data-style-id"),B=f.getAttribute("data-block-parent");i([{id:S,prop:g,blockId:B}])}},[i,c]),v=h.useCallback(x=>Rt(x,r,a,p),[p,r,a]),[R]=Se.useChaiExternalData();return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:h.Children.toArray(n.map((x,f)=>{const g=jt(x),S={};d.isEmpty(g)||Object.keys(g).forEach(m=>{S[m]=h.Children.toArray(g[m].map(U=>e.jsxRuntimeExports.jsx(ue,{blocks:[d.find(t,{_id:U})]})))});const B=d.filter(t,{_parent:x._id});S.children=B.length?e.jsxRuntimeExports.jsx(ue,{blocks:B}):null;const w=we.getBlockComponent(x._type),D=d.get(w,"component",null);return d.isNull(D)?e.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${x==null?void 0:x._type} not registered -->`}):e.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(D,{blockProps:{onClick:p,"data-block-id":x._id,"data-block-type":x._type},inBuilder:!0,index:f,...kt(x,R),...v(x),...S})})}))})}const wt=()=>{const n=u.useAllBlocks();return e.jsxRuntimeExports.jsx(Ye.Provider,{children:d.isEmpty(n)?e.jsxRuntimeExports.jsx(vt,{}):e.jsxRuntimeExports.jsx(Xe,{children:e.jsxRuntimeExports.jsx(ue,{blocks:d.filter(n,t=>d.isEmpty(t._parent))})})})},St=(n,t)=>n.querySelector(`[data-style-id="${t}"]`),Ct=()=>{const[n]=V.useAtom(u.networkModeAtom),[t]=u.usePreviewMode(),[s]=u.useCanvasWidth(),[,i]=u.useSelectedBlockIds(),c=u.useSelectedBlock(),[,r]=u.useHighlightBlockId(),a=h.useRef(null),p=h.useRef(null),[v,R]=h.useState({width:0,height:0}),x=rt(v),[f,g]=h.useState(0),[S,B]=h.useState([]),[,w]=h.useState([]),[,D]=V.useAtom(u.canvasIframeAtom),[m,U]=u.useSelectedStylingBlocks(),N=z.useBuilderProp("loadingCanvas",!1);h.useEffect(()=>{const{clientWidth:O,clientHeight:F}=p.current;R({width:O,height:F}),f===0&&g(O)},[p,s,f]);const Q=(O,F=0)=>{const{top:W}=O.getBoundingClientRect();return W+F>=0&&W-F<=window.innerHeight};h.useEffect(()=>{var O,F;if(c&&c.type!=="Multiple"&&a.current){const W=Be(a.current.contentDocument,c._id);W&&(Q(W)||(F=(O=a.current)==null?void 0:O.contentWindow)==null||F.scrollTo({top:W.offsetTop,behavior:"smooth"}),B([W]))}},[c]),h.useEffect(()=>{if(!d.isEmpty(m)&&a.current){const O=St(a.current.contentDocument,d.first(m).id);w(O?[O]:[null])}else w([null])},[m]);const ee=h.useMemo(()=>{let O=st;return n==="offline"&&(O=O.replace("https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio","/offline/tailwind.cdn.js"),O=O.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),O=O.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),O},[n]);return e.jsxRuntimeExports.jsx("div",{onClick:()=>{i([]),U([])},onMouseLeave:()=>setTimeout(()=>r(""),300),className:"relative mx-auto h-full w-full bg-black/80",style:f>0&&!d.isEmpty(x)?{width:t?"100%":f}:{},ref:p,children:e.jsxRuntimeExports.jsxs(ft,{contentDidMount:()=>D(a.current),ref:a,id:"canvas-iframe",style:{width:`${s}px`,...x},className:"relative mx-auto box-content h-full max-w-full shadow-md transition-all duration-300 ease-linear",initialContent:ee,children:[e.jsxRuntimeExports.jsx(ht,{}),e.jsxRuntimeExports.jsx(yt,{block:c,selectedBlockElement:d.first(S)}),e.jsxRuntimeExports.jsx(gt,{model:"page"}),e.jsxRuntimeExports.jsxs(xt,{children:[N?e.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:e.jsxRuntimeExports.jsx(z.Skeleton,{className:"h-full"})}):e.jsxRuntimeExports.jsx(wt,{}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})})},Tt=h.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-b510ac3a.cjs"))),It=()=>{const n=z.useBuilderProp("mode",te.STATIC),[t,s]=V.useAtom(u.addBlocksModalAtom),i={[te.STATIC]:e.jsxRuntimeExports.jsx(Ct,{}),[te.FRAMEWORK]:null}[n];return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[e.jsxRuntimeExports.jsx(nt,{}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/20 bg-[linear-gradient(to_right,#EEE_0.5px,transparent_0.5px),linear-gradient(to_bottom,#EEE_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[e.jsxRuntimeExports.jsx(h.Suspense,{fallback:e.jsxRuntimeExports.jsx(z.Skeleton,{className:"h-full"}),children:e.jsxRuntimeExports.jsx(u.ErrorBoundary,{children:i})}),t?e.jsxRuntimeExports.jsx("div",{onClick:()=>s(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:e.jsxRuntimeExports.jsx("div",{onClick:c=>c.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:e.jsxRuntimeExports.jsx(Tt,{})})}):null]})]})};exports.default=It;
@@ -3,7 +3,7 @@ import { S as x, c as h, b as f, d as j, f as y } from "./select-7fddd7c3.js";
3
3
  import { sortBy as P, filter as v, get as b, isEmpty as n, find as m, capitalize as S, map as w } from "lodash";
4
4
  import { toast as C } from "sonner";
5
5
  import { useEffect as l } from "react";
6
- import { R as k, Q as N, c as B, T as E, U as T } from "./index-ca7c3430.js";
6
+ import { R as k, Q as N, c as B, T as E, U as T } from "./index-436bba3e.js";
7
7
  import "react-i18next";
8
8
  import { BriefcaseIcon as I } from "lucide-react";
9
9
  import "@radix-ui/react-icons";
@@ -11,7 +11,7 @@ import "@radix-ui/react-select";
11
11
  import "./utils-ac68b2c8.js";
12
12
  import "clsx";
13
13
  import "tailwind-merge";
14
- import "./_commonjsHelpers-10dfc225.js";
14
+ import "./MODIFIERS-2f19c314.js";
15
15
  import "@radix-ui/react-scroll-area";
16
16
  import "react-dom";
17
17
  import "@floating-ui/react-dom";
@@ -27,13 +27,12 @@ import "@radix-ui/react-tooltip";
27
27
  import "@radix-ui/react-toast";
28
28
  import "react-hotkeys-hook";
29
29
  import "flat-to-nested";
30
- import "./html-to-json-8397fab5.js";
31
- import "./MODIFIERS-c2e02614.js";
30
+ import "./html-to-json-45e0e3b5.js";
32
31
  import "himalaya";
33
32
  import "redux-undo";
34
33
  import "@react-hookz/web";
35
34
  import "@chaibuilder/blocks";
36
- const ue = () => {
35
+ const de = () => {
37
36
  const { data: t } = k(), { data: a, isLoading: c } = N(), { syncState: p } = B(), d = E(), [i, s] = T(), o = P(v(a, { type: "STATIC" }), (r) => b(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
38
37
  l(() => {
39
38
  !n(a) && t.homepage && !m(a, { uuid: i }) && s(t.homepage);
@@ -87,5 +86,5 @@ const ue = () => {
87
86
  );
88
87
  };
89
88
  export {
90
- ue as default
89
+ de as default
91
90
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("./select-0e32300c.cjs"),t=require("lodash"),h=require("sonner"),l=require("react"),n=require("./index-c3a98a78.cjs");require("react-i18next");const j=require("lucide-react");require("@radix-ui/react-icons");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");const p=()=>{const{data:s}=n.useProject(),{data:u,isLoading:x}=n.usePages(),{syncState:d}=n.useSavePage(),m=n.useChangePage(),[a,o]=n.useCurrentPage(),c=t.sortBy(t.filter(u,{type:"STATIC"}),r=>t.get(r,"uuid")===(s==null?void 0:s.homepage)?0:1);l.useEffect(()=>{!t.isEmpty(u)&&s.homepage&&!t.find(u,{uuid:a})&&o(s.homepage)},[a,u,s,o]),l.useEffect(()=>()=>o(null),[o]);const g=r=>{if(d!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const q=t.find(c,{uuid:r});m(q)}};return x||t.isEmpty(a)?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"}),t.capitalize(s.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(i.Select,{value:a||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(i.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(i.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(i.SelectContent,{children:t.map(c,r=>e.jsxRuntimeExports.jsx(i.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),s=require("@radix-ui/react-icons"),f=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),P=require("react-i18next"),x=require("./index-c3a98a78.cjs"),_=require("lucide-react"),v=require("./utils-3c452dd0.cjs"),m=require("react"),H=require("./MODIFIERS-4716c669.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),q=require("./useBuilderProp-5e57d0c8.cjs"),L=require("./scroll-area-bb343b86.cjs"),F=require("jotai");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");const S=t=>{switch(t.type){case"Image":return e.jsxRuntimeExports.jsx(s.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(s.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(s.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(s.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(s.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(s.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(s.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(s.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(s.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(s.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(s.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(s.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(s.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(s.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(s.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(s.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(s.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(s.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(s.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(s.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(_.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}};function V(t=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(t))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(t))return"Visible on mobile";if(t.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=t.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const z=t=>{let n="";return Object.keys(t).forEach(r=>{a.startsWith(t[r],H.STYLES_KEY)&&(n=t[r])}),n},G=t=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=t,{id:i,data:l}=t.node,d=t.depth*10,j=p=>{p.stopPropagation(),t.onToggle(t.node.id)},I=y.useDragOver(i,t.isOpen,t.onToggle),g=m.useMemo(()=>{const p=z(t.node.data);return V(p)},[t.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&t.onSelect(i)},onContextMenu:()=>t.onSelect(i),style:{paddingInlineStart:d},...I,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 ${t.isOpen?"rotate-90":""}`,children:t.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(s.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(S,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=t.node.data)==null?void 0:R._name)||t.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},$=t=>{var r;const{item:n}=t.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(S,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},K=t=>{const n=t.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}})},Q=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-ea769ea4.cjs"))),U=()=>{const[t]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ScissorsIcon,{})," Cut"]})},Y=()=>{const[t]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.ClipboardIcon,{})," Copy"]})},W=()=>{const[t]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},J=({id:t=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=q.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.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(s.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsx(Y,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(t),disabled:!l,children:[e.jsxRuntimeExports.jsx(s.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(W,{})]})},X=({children:t,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(Q,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx(J,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},Z=()=>{const{addCoreBlock:t}=x.useAddBlock(),n=q.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return t({blocks:d},i===0?null:i,l)}return t(c,i===0?null:i,l)},[t])};function ee(t){return a.map(t,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const te=()=>{const t=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=P.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=Z(),[,R]=F.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:B,dropTargetId:N,monitor:O}=E,A=ee(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:B}),R(!1))},w=a.map(t,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(t,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=f.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=f.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:a.isEmpty(t)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(s.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(s.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(L.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:w,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(X,{id:o.id,children:e.jsxRuntimeExports.jsx(G,{onSelect:B=>{l([]),c([B])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx($,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx(K,{node:o,depth:E})})})})})};exports.default=te;