@chaibuilder/sdk 0.1.16 → 0.1.18

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 (89) hide show
  1. package/dist/AddBlocks-5cb44efb.cjs +3 -0
  2. package/dist/{AddBlocks-6f4db22d.js → AddBlocks-c47af38f.js} +49 -45
  3. package/dist/BrandingOptions-4f3e3a8d.cjs +1 -0
  4. package/dist/{BrandingOptions-d6351932.js → BrandingOptions-52b2de6f.js} +11 -7
  5. package/dist/CanvasArea-90a395c1.js +1311 -0
  6. package/dist/CanvasArea-aef3fa5e.cjs +46 -0
  7. package/dist/{CurrentPage-e8f8ff05.js → CurrentPage-2721bc7b.js} +18 -14
  8. package/dist/CurrentPage-d1ec06db.cjs +1 -0
  9. package/dist/{ImagesPanel-68a11293.cjs → ImagesPanel-0db5c72f.cjs} +1 -1
  10. package/dist/{ImagesPanel-996761b1.js → ImagesPanel-38c44785.js} +1 -1
  11. package/dist/{Layers-6fc21e86.js → Layers-a9cf4d7c.js} +144 -142
  12. package/dist/Layers-d0edf1a8.cjs +1 -0
  13. package/dist/{MarkAsGlobalBlock-cf7e8b31.js → MarkAsGlobalBlock-0cf6e5a2.js} +15 -11
  14. package/dist/MarkAsGlobalBlock-c43c3b2c.cjs +1 -0
  15. package/dist/PagesPanel-22050a98.cjs +1 -0
  16. package/dist/{PagesPanel-7db807df.js → PagesPanel-589544c2.js} +12 -8
  17. package/dist/ProjectPanel-215ba7f1.cjs +1 -0
  18. package/dist/{ProjectPanel-a7c78e1f.js → ProjectPanel-dbea8af1.js} +12 -8
  19. package/dist/Settings-71c0312b.cjs +1 -0
  20. package/dist/{Settings-1e6e0534.js → Settings-c347533e.js} +909 -640
  21. package/dist/SidePanels-214fef72.js +2999 -0
  22. package/dist/SidePanels-3844d8b5.cjs +13 -0
  23. package/dist/{Topbar-4f1aca98.js → Topbar-1dd5c34e.js} +23 -19
  24. package/dist/Topbar-4fa3ab61.cjs +1 -0
  25. package/dist/{UnsplashImages-f761ad96.cjs → UnsplashImages-0d091e33.cjs} +1 -1
  26. package/dist/{UnsplashImages-47374e0c.js → UnsplashImages-10c95b63.js} +1 -1
  27. package/dist/{UploadImages-33c1507a.cjs → UploadImages-10439fde.cjs} +1 -1
  28. package/dist/{UploadImages-f0ba3215.js → UploadImages-b14bd152.js} +1 -1
  29. package/dist/_commonjsHelpers-10dfc225.js +8 -0
  30. package/dist/_commonjsHelpers-87b0abe8.cjs +1 -0
  31. package/dist/add-page-modal-05c947fb.cjs +1 -0
  32. package/dist/{add-page-modal-d4f5ba20.js → add-page-modal-5cc1393d.js} +14 -11
  33. package/dist/card-14e1d020.cjs +1 -0
  34. package/dist/card-f8f4f985.js +33 -0
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.d.ts +6 -4
  37. package/dist/core.js +63 -59
  38. package/dist/delete-page-modal-859c3a09.cjs +1 -0
  39. package/dist/{delete-page-modal-00d5fbab.js → delete-page-modal-a79bfc45.js} +15 -11
  40. package/dist/{form-bf09d392.js → form-725e3191.js} +3 -3
  41. package/dist/{form-5d04c9b3.cjs → form-99b51245.cjs} +1 -1
  42. package/dist/index-dfeadcce.cjs +164 -0
  43. package/dist/index-f8a2f8ef.js +31068 -0
  44. package/dist/{link-6467eda6.js → link-2af5de8b.js} +1 -1
  45. package/dist/{link-4585b2d6.cjs → link-86ac8848.cjs} +1 -1
  46. package/dist/page-viewer-aac7b439.cjs +1 -0
  47. package/dist/{page-viewer-c494031b.js → page-viewer-c6421156.js} +22 -18
  48. package/dist/project-general-setting-ce814ecf.cjs +1 -0
  49. package/dist/{project-general-setting-fca12629.js → project-general-setting-f9fd21cc.js} +9 -7
  50. package/dist/{project-seo-setting-3f645a02.cjs → project-seo-setting-a9403f1d.cjs} +1 -1
  51. package/dist/{project-seo-setting-e9587467.js → project-seo-setting-c1980ec3.js} +3 -3
  52. package/dist/render.cjs +1 -1
  53. package/dist/render.js +1 -1
  54. package/dist/{scroll-area-9f64a082.js → scroll-area-83bd9e8f.js} +7 -7
  55. package/dist/{scroll-area-088530b9.cjs → scroll-area-bb343b86.cjs} +1 -1
  56. package/dist/{single-page-detail-ff7fceb1.js → single-page-detail-2ac00c2e.js} +32 -30
  57. package/dist/single-page-detail-dcbb3cab.cjs +1 -0
  58. package/dist/style.css +1 -1
  59. package/dist/textarea-20b2f6b2.cjs +1 -0
  60. package/dist/textarea-9dfb6a32.js +45 -0
  61. package/dist/ui.cjs +1 -1
  62. package/dist/ui.js +74 -73
  63. package/dist/useChaiExternalData-192c7896.js +5 -0
  64. package/dist/useChaiExternalData-a90e8aac.cjs +1 -0
  65. package/package.json +5 -3
  66. package/dist/AddBlocks-59a68fc9.cjs +0 -3
  67. package/dist/BrandingOptions-8e7a159f.cjs +0 -1
  68. package/dist/CanvasArea-08537c6e.cjs +0 -60
  69. package/dist/CanvasArea-a585620d.js +0 -1459
  70. package/dist/CurrentPage-cbbfdbf4.cjs +0 -1
  71. package/dist/Layers-636e0bc6.cjs +0 -1
  72. package/dist/MarkAsGlobalBlock-23dd24b9.cjs +0 -1
  73. package/dist/PagesPanel-bf13d0a5.cjs +0 -1
  74. package/dist/ProjectPanel-d98d3585.cjs +0 -1
  75. package/dist/Settings-1b76c006.cjs +0 -1
  76. package/dist/SidePanels-55124e18.cjs +0 -1
  77. package/dist/SidePanels-af4f2c45.js +0 -149
  78. package/dist/Topbar-5df341d7.cjs +0 -1
  79. package/dist/_commonjsHelpers-5a53b418.cjs +0 -1
  80. package/dist/_commonjsHelpers-d4512b9c.js +0 -6
  81. package/dist/add-page-modal-b685709e.cjs +0 -1
  82. package/dist/delete-page-modal-bbd3ffa2.cjs +0 -1
  83. package/dist/index-8a7a37ce.js +0 -5028
  84. package/dist/index-bf44bc93.cjs +0 -2
  85. package/dist/page-viewer-f0a54a92.cjs +0 -1
  86. package/dist/project-general-setting-a3e99d1e.cjs +0 -1
  87. package/dist/single-page-detail-84c67e67.cjs +0 -1
  88. package/dist/textarea-0750bcd2.js +0 -73
  89. package/dist/textarea-a338ede6.cjs +0 -1
@@ -0,0 +1,46 @@
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-dfeadcce.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"}
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>
4
+ <html class="scroll-smooth h-full overflow-y-auto">
5
+ <head>
6
+ <meta charset="UTF-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <script src="https://old.chaibuilder.com/offline/tailwind.cdn.js"><\/script>
9
+ <style>
10
+ html { height: 100%; overflow:auto; }
11
+ body { height: 100%; }
12
+ .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
13
+ .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
14
+ body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
15
+ -moz-user-select: none;-ms-user-select: none; user-select: none; }
16
+ html{
17
+ -ms-overflow-style: none; /* IE and Edge */
18
+ scrollbar-width: none; /* Firefox */
19
+ }
20
+ /** IMPORTANT: Make fields content editable in SAFARI */
21
+ [contenteditable] {-webkit-user-select: text;user-select: text;}
22
+
23
+ html::-webkit-scrollbar { width: 0 !important }
24
+ .aspect-auto{aspect-ratio: auto;}
25
+ .aspect-square{aspect-ratio: 1/1;}
26
+ .aspect-video{aspect-ratio: 16/9;}
27
+ a{ pointer-events: none !important; }
28
+ </style>
29
+ <style id="hidden-blocks"></style>
30
+ <style id="selected-block"></style>
31
+ <style id="selected-styling-block"></style>
32
+ <style id="highlighted-block"></style>
33
+ </head>
34
+ <body class="font-body antialiased h-full">
35
+ <div class="frame-root"></div>
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:{}};/*
38
+ object-assign
39
+ (c) Sindre Sorhus
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(",")}{
43
+ outline: 1px solid ${s.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
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
+ 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-5cb44efb.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;
@@ -3,14 +3,19 @@ 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 { O as N, N as k, u as B, Q as E, R as I } from "./index-8a7a37ce.js";
6
+ import { R as k, Q as N, c as B, T as E, U as T } from "./index-f8a2f8ef.js";
7
7
  import "react-i18next";
8
- import { BriefcaseIcon as L } from "lucide-react";
8
+ import { BriefcaseIcon as I } from "lucide-react";
9
9
  import "@radix-ui/react-icons";
10
10
  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";
15
+ import "@radix-ui/react-scroll-area";
16
+ import "react-dom";
17
+ import "@floating-ui/react-dom";
18
+ import "jotai";
14
19
  import "i18next";
15
20
  import "flagged";
16
21
  import "react-dnd";
@@ -20,7 +25,6 @@ import "@radix-ui/react-slot";
20
25
  import "class-variance-authority";
21
26
  import "@radix-ui/react-tooltip";
22
27
  import "@radix-ui/react-toast";
23
- import "jotai";
24
28
  import "react-hotkeys-hook";
25
29
  import "flat-to-nested";
26
30
  import "./html-to-json-8397fab5.js";
@@ -29,27 +33,27 @@ import "himalaya";
29
33
  import "redux-undo";
30
34
  import "@react-hookz/web";
31
35
  import "@chaibuilder/blocks";
32
- const le = () => {
33
- const { data: t } = N(), { data: a, isLoading: c } = k(), { syncState: d } = B(), u = E(), [s, i] = I(), o = P(v(a, { type: "STATIC" }), (r) => b(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
36
+ const ue = () => {
37
+ 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);
34
38
  l(() => {
35
- !n(a) && t.homepage && !m(a, { uuid: s }) && i(t.homepage);
36
- }, [s, a, t, i]), l(() => () => i(null), [i]);
37
- const p = (r) => {
38
- if (d !== "SAVED")
39
+ !n(a) && t.homepage && !m(a, { uuid: i }) && s(t.homepage);
40
+ }, [i, a, t, s]), l(() => () => s(null), [s]);
41
+ const u = (r) => {
42
+ if (p !== "SAVED")
39
43
  C.error("You have unsaved changes. Please save before changing the page.");
40
44
  else {
41
45
  const g = m(o, { uuid: r });
42
- u(g);
46
+ d(g);
43
47
  }
44
48
  };
45
- return c || n(s) ? null : /* @__PURE__ */ e.jsx(
49
+ return c || n(i) ? null : /* @__PURE__ */ e.jsx(
46
50
  "nav",
47
51
  {
48
52
  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",
49
53
  "aria-label": "Breadcrumb",
50
54
  children: /* @__PURE__ */ e.jsxs("ol", { className: "inline-flex items-center space-x-1 md:space-x-3", children: [
51
55
  /* @__PURE__ */ e.jsx("li", { className: "inline-flex items-center", children: /* @__PURE__ */ e.jsxs("div", { className: "inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400", children: [
52
- /* @__PURE__ */ e.jsx(L, { className: "w-4 h-4 mr-2" }),
56
+ /* @__PURE__ */ e.jsx(I, { className: "w-4 h-4 mr-2" }),
53
57
  S(t.name)
54
58
  ] }) }),
55
59
  /* @__PURE__ */ e.jsx("li", { "aria-current": "page", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
@@ -73,7 +77,7 @@ const le = () => {
73
77
  )
74
78
  }
75
79
  ),
76
- /* @__PURE__ */ e.jsxs(x, { value: s || "", onValueChange: p, children: [
80
+ /* @__PURE__ */ e.jsxs(x, { value: i || "", onValueChange: u, children: [
77
81
  /* @__PURE__ */ e.jsx(h, { 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: /* @__PURE__ */ e.jsx(f, { placeholder: "Page" }) }),
78
82
  /* @__PURE__ */ e.jsx(j, { children: w(o, (r) => /* @__PURE__ */ e.jsx(y, { value: r.uuid, children: r == null ? void 0 : r.name }, r.uuid)) })
79
83
  ] })
@@ -83,5 +87,5 @@ const le = () => {
83
87
  );
84
88
  };
85
89
  export {
86
- le as default
90
+ ue as default
87
91
  };
@@ -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-dfeadcce.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("./_commonjsHelpers-87b0abe8.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-78bfa1f3.cjs");require("./MODIFIERS-70fef873.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;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("react"),s=require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");const x=l.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-f761ad96.cjs"))),i=l.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-33c1507a.cjs"))),o=({isModalView:a=!1,onSelect:t=()=>{}})=>{const[r,n]=l.useState("upload");return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:a?"Select or upload images":"Images"})}),e.jsxRuntimeExports.jsxs(s.Tabs,{value:r,onValueChange:u=>n(u),className:"flex h-full w-full flex-col py-2",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"w-full",children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"upload",className:"w-1/2",children:"Upload"}),e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"unsplash",className:"w-1/2",children:"Unsplash"})]}),r==="unsplash"?e.jsxRuntimeExports.jsx(s.TabsContent,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(x,{isModalView:a,onSelect:t})})}):e.jsxRuntimeExports.jsx(s.TabsContent,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(i,{isModalView:a,onSelect:t})})})]})]})},c=o;exports.default=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),l=require("react"),s=require("./tabs-860e37aa.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");const x=l.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-0d091e33.cjs"))),i=l.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-10439fde.cjs"))),o=({isModalView:a=!1,onSelect:t=()=>{}})=>{const[r,n]=l.useState("upload");return e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:a?"Select or upload images":"Images"})}),e.jsxRuntimeExports.jsxs(s.Tabs,{value:r,onValueChange:u=>n(u),className:"flex h-full w-full flex-col py-2",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"w-full",children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"upload",className:"w-1/2",children:"Upload"}),e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"unsplash",className:"w-1/2",children:"Unsplash"})]}),r==="unsplash"?e.jsxRuntimeExports.jsx(s.TabsContent,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(x,{isModalView:a,onSelect:t})})}):e.jsxRuntimeExports.jsx(s.TabsContent,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:e.jsxRuntimeExports.jsx(l.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:e.jsxRuntimeExports.jsx(i,{isModalView:a,onSelect:t})})})]})]})},c=o;exports.default=c;
@@ -5,7 +5,7 @@ import "@radix-ui/react-tabs";
5
5
  import "./utils-ac68b2c8.js";
6
6
  import "clsx";
7
7
  import "tailwind-merge";
8
- const f = r.lazy(() => import("./UnsplashImages-47374e0c.js")), p = r.lazy(() => import("./UploadImages-f0ba3215.js")), x = ({
8
+ const f = r.lazy(() => import("./UnsplashImages-10c95b63.js")), p = r.lazy(() => import("./UploadImages-b14bd152.js")), x = ({
9
9
  isModalView: s = !1,
10
10
  onSelect: a = () => {
11
11
  }