@chaibuilder/sdk 1.1.2 → 1.1.4

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 (60) hide show
  1. package/dist/{AddBlocks-P3qHuE5J.cjs → AddBlocks-Wsoku0Sm.cjs} +1 -1
  2. package/dist/{AddBlocks-imyQSCbI.js → AddBlocks-rteGefHR.js} +20 -20
  3. package/dist/{BrandingOptions-tSNtQ1Kv.js → BrandingOptions-4l1Yo42i.js} +1 -1
  4. package/dist/{BrandingOptions-_2XBEPab.cjs → BrandingOptions-CqVvc-GC.cjs} +1 -1
  5. package/dist/CanvasArea-_WcM6PCy.js +1426 -0
  6. package/dist/CanvasArea-jzvQJnbQ.cjs +59 -0
  7. package/dist/{CurrentPage-hHwsHam-.cjs → CurrentPage-8AWFWOJ8.cjs} +1 -1
  8. package/dist/{CurrentPage-uRwS0DQC.js → CurrentPage-tnHIOkX2.js} +5 -5
  9. package/dist/{Layers-eXMT1ncm.js → Layers-6PHQWIbV.js} +15 -15
  10. package/dist/{Layers--5nyqOjK.cjs → Layers-jsOPQbVU.cjs} +1 -1
  11. package/dist/{MarkAsGlobalBlock-aqik3ouc.js → MarkAsGlobalBlock-9pfqCgrO.js} +1 -1
  12. package/dist/{MarkAsGlobalBlock-p_wvHkQZ.cjs → MarkAsGlobalBlock-bXkERbl2.cjs} +1 -1
  13. package/dist/{PagesPanel-WZgw7xVs.cjs → PagesPanel-Zvy5ZKPf.cjs} +1 -1
  14. package/dist/{PagesPanel-xRUnAMIb.js → PagesPanel-cmJ1UiP0.js} +3 -3
  15. package/dist/{ProjectPanel-FC03TiyG.cjs → ProjectPanel-4BsxvZu-.cjs} +1 -1
  16. package/dist/{ProjectPanel-8l4Bi3Kh.js → ProjectPanel-VxbDdgA2.js} +5 -5
  17. package/dist/Settings-AJet4HbF.cjs +1 -0
  18. package/dist/{Settings-4v3M1bRS.js → Settings-zzs6KaRd.js} +294 -303
  19. package/dist/{SidePanels-0xaw3Td6.js → SidePanels-UGgpWdPF.js} +9 -9
  20. package/dist/{SidePanels-5e5q3c7J.cjs → SidePanels-_8tt1l6S.cjs} +1 -1
  21. package/dist/{Topbar-ZjAs5fDc.cjs → Topbar-geYx1fCH.cjs} +1 -1
  22. package/dist/{Topbar-Jc74a6oE.js → Topbar-zw_KlpKs.js} +5 -5
  23. package/dist/{UnsplashImages-nXceZLmd.cjs → UnsplashImages-C4_dg08Y.cjs} +1 -1
  24. package/dist/{UnsplashImages-_PxEYx5c.js → UnsplashImages-yk5eowZf.js} +4 -4
  25. package/dist/{UploadImages-tcQb5NZu.cjs → UploadImages-hLrNjSXF.cjs} +1 -1
  26. package/dist/{UploadImages-zzSgKmP9.js → UploadImages-ioTAmtvl.js} +10 -10
  27. package/dist/{add-page-modal-K5isTZOT.js → add-page-modal-31-dJjna.js} +3 -3
  28. package/dist/{add-page-modal-JRSQ_N56.cjs → add-page-modal-Gsa-gnsn.cjs} +1 -1
  29. package/dist/{confirm-alert-2JxcNf3T.js → confirm-alert-c7sRVjK8.js} +1 -1
  30. package/dist/{confirm-alert-mzlwOW9w.cjs → confirm-alert-zqK8LIx8.cjs} +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.d.ts +0 -25
  33. package/dist/core.js +51 -55
  34. package/dist/{delete-page-modal-x81Ed4jF.js → delete-page-modal-5xqoPPl3.js} +2 -2
  35. package/dist/{delete-page-modal-c8nB2y7w.cjs → delete-page-modal-jEsSWzKN.cjs} +1 -1
  36. package/dist/{form-TQ7vwDYO.js → form-5tYo3gKa.js} +1 -1
  37. package/dist/{form-bSW-Pkw9.cjs → form-hHv26OT7.cjs} +1 -1
  38. package/dist/{index-HjvZqhVh.js → index-K_TiChPs.js} +4 -4
  39. package/dist/index-LLhN-70p.cjs +1 -0
  40. package/dist/{index-ORFlyrBx.js → index-pJPfM9Bm.js} +874 -878
  41. package/dist/{index-7NRFGya_.cjs → index-rdttRR05.cjs} +2 -2
  42. package/dist/{page-viewer-huD5B1om.cjs → page-viewer-DJqp04Tr.cjs} +1 -1
  43. package/dist/{page-viewer-fFaDQOOI.js → page-viewer-Oku6zrcm.js} +3 -3
  44. package/dist/{project-general-setting-rH_1r38b.js → project-general-setting-hrJZUYnV.js} +3 -3
  45. package/dist/{project-general-setting-rNNI-K6l.cjs → project-general-setting-rVhljgfP.cjs} +1 -1
  46. package/dist/{project-seo-setting-cERASO9j.cjs → project-seo-setting-Xg6cVYXo.cjs} +1 -1
  47. package/dist/{project-seo-setting-k0HlefUD.js → project-seo-setting-fwyxNcY-.js} +2 -2
  48. package/dist/{single-page-detail-CrgTQFUX.js → single-page-detail-1UCpERBU.js} +4 -4
  49. package/dist/{single-page-detail-52_cuxNe.cjs → single-page-detail-ilh1I9gv.cjs} +1 -1
  50. package/dist/studio.cjs +1 -1
  51. package/dist/studio.js +2 -2
  52. package/dist/ui.cjs +1 -1
  53. package/dist/ui.js +41 -41
  54. package/dist/{useAddBlockByDrop-UA_Iw_4l.js → useAddBlockByDrop-UJ6QE7aE.js} +1 -1
  55. package/dist/{useAddBlockByDrop-DPV32UHP.cjs → useAddBlockByDrop-jJ_MnZ5y.cjs} +1 -1
  56. package/package.json +1 -1
  57. package/dist/CanvasArea-UtFK5IS6.cjs +0 -58
  58. package/dist/CanvasArea-dkwSFbQA.js +0 -1412
  59. package/dist/Settings-kcmKFymH.cjs +0 -1
  60. package/dist/index-zkc4SQCu.cjs +0 -1
@@ -0,0 +1,59 @@
1
+ "use strict";var We=Object.defineProperty;var $e=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var z=(e,t,n)=>($e(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-WUGKV8jN.cjs"),m=require("react"),x=require("lodash"),M=require("@radix-ui/react-icons"),r=require("./index-LLhN-70p.cjs"),Ue=require("react-i18next"),_=require("jotai"),he=require("react-dom"),Z=require("./MODIFIERS-WFzDQfiT.cjs"),Q=require("./index-rdttRR05.cjs"),ze=require("react-quill"),Ye=require("./useAddBlockByDrop-jJ_MnZ5y.cjs"),Se=require("flagged"),Ke=require("@floating-ui/dom"),ge=require("@floating-ui/react-dom"),Je=require("@react-hookz/web"),Xe=require("@bobthered/tailwindcss-palette-generator"),Ve=require("react-wrap-balancer"),Ze=require("tailwind-merge"),Ge=require("@chaibuilder/runtime");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("flat-to-nested");require("redux-undo");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const Qe=()=>{const{undoCount:e,redoCount:t,undo:n,redo:a}=r.useCanvasHistory();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Button,{disabled:!e,size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(M.ResetIcon,{})}),s.jsxRuntimeExports.jsx(r.Button,{disabled:!t,onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(M.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function et(){const[e,t]=r.useDarkMode(),{t:n}=Ue.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(r.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(r.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"}
2
+ relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:[s.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Use setting"}),s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"}
3
+ pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})]})]})}const me=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),ye=[{title:"Mobile (XS)",content:"Styles set here are applied to all screen unless edited at higher breakpoint",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(M.MobileIcon,{}),width:400},{title:"Mobile landscape (SM)",content:"Styles set here are applied at 640px and up unless edited at higher breakpoint",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(M.MobileIcon,{className:"rotate-90"}),width:640},{title:"Tablet (MD)",content:"Styles set here are applied at 768px and up",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(me,{}),width:800},{title:"Tablet Landscape (LG)",content:"Styles set here are applied at 1024px and up unless edited at higher breakpoint",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(me,{landscape:!0}),width:1024},{title:"Desktop (XL)",content:"Styles set here are applied at 1280px and up unless edited at higher breakpoint",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(M.LaptopIcon,{}),width:1420},{title:"Large Desktop (2XL)",content:"Styles set here are applied at 1536px and up",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(M.DesktopIcon,{}),width:1920}],tt=({title:e,content:t,currentBreakpoint:n,breakpoint:a,width:l,icon:i,onClick:u})=>s.jsxRuntimeExports.jsxs(r.HoverCard,{children:[s.jsxRuntimeExports.jsx(r.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(r.Button,{onClick:()=>u(l),size:"sm",variant:a===n?"secondary":"ghost",children:i})}),s.jsxRuntimeExports.jsx(r.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:e}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:t})]})})})]}),nt=()=>{const[,e,t]=r.useCanvasWidth(),[n,a]=r.useSelectedBreakpoints(),l=i=>{n.includes(i)?n.length>2&&a(n.filter(u=>u!==i)):a(u=>[...u,i])};return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[x.map(ye.filter(i=>x.includes(n,x.toUpper(i.breakpoint))),i=>m.createElement(tt,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(r.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(r.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(M.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(r.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(r.DropdownMenuLabel,{children:"Breakpoints"}),s.jsxRuntimeExports.jsx(r.DropdownMenuSeparator,{}),x.map(ye,i=>s.jsxRuntimeExports.jsx(r.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>l(x.toUpper(i.breakpoint)),checked:x.includes(n,x.toUpper(i.breakpoint)),children:i.title},i.breakpoint))]})]})]})},st=()=>{const[e]=r.useSetAllBlocks(),{createSnapshot:t}=r.useCanvasHistory(),[,n]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),l=m.useCallback(()=>{e([]),n([]),a([]),t()},[e,t]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(r.AlertDialog,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(r.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(M.EraserIcon,{})," Clear"]})}),s.jsxRuntimeExports.jsxs(r.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(r.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogTitle,{children:"Clear whole canvas?"}),s.jsxRuntimeExports.jsx(r.AlertDialogDescription,{children:"Are you sure you want to clear the whole canvas?"})]}),s.jsxRuntimeExports.jsxs(r.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(r.AlertDialogCancel,{children:"Cancel"}),s.jsxRuntimeExports.jsx(r.AlertDialogAction,{onClick:l,children:"Yes"})]})]})]})})},rt=()=>{const e=r.useFeatureSupport("darkMode",!1),[t]=r.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(et,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(nt,{}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 items-center justify-center gap-x-1 space-x-0 font-medium",children:[s.jsxRuntimeExports.jsx(M.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[x.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(Qe,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(r.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(st,{})]})]})},ot=`<!doctype html>
4
+ <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
+ .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
28
+ .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
29
+ a{ pointer-events: none !important; }
30
+ [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
31
+ [contenteditable="true"] {
32
+ outline: none;
33
+ box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
34
+ -webkit-user-select: text;
35
+ -moz-user-select: text;
36
+ user-select: text;
37
+ }
38
+ </style>
39
+ <style id="hidden-blocks"></style>
40
+ <style id="selected-block"></style>
41
+ <style id="selected-styling-block"></style>
42
+ <style id="highlighted-block"></style>
43
+ <style id="dragged-block"></style>
44
+
45
+ </head>
46
+ <body class="font-body antialiased h-full">
47
+ <div class="frame-root"></div>
48
+ <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
49
+ </body>
50
+ </html>`,it=e=>{const[t]=r.useCanvasWidth(),[,n]=r.useCanvasZoom(),[a,l]=m.useState({}),i=m.useCallback(()=>{const{width:u,height:o}=e;if(u<t){const p=parseFloat((u/t).toString());let d={};o&&(d={height:o+2*o*(1-p)}),l({transform:`scale(${p})`,transformOrigin:"top left",...d,maxWidth:"none"}),n(p*100)}else l({}),n(100)},[t,e,n]);return m.useEffect(()=>{i()},[t,e,n,i]),a};var te={exports:{}};/*
51
+ object-assign
52
+ (c) Sindre Sorhus
53
+ @license MIT
54
+ */var se,ve;function at(){if(ve)return se;ve=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function a(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function l(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[0]==="5")return!1;for(var u={},o=0;o<10;o++)u["_"+String.fromCharCode(o)]=o;var p=Object.getOwnPropertyNames(u).map(function(h){return u[h]});if(p.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(h){d[h]=h}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return se=l()?Object.assign:function(i,u){for(var o,p=a(i),d,h=1;h<arguments.length;h++){o=Object(arguments[h]);for(var g in o)t.call(o,g)&&(p[g]=o[g]);if(e){d=e(o);for(var R=0;R<d.length;R++)n.call(o,d[R])&&(p[d[R]]=o[d[R]])}}return p},se}var re,je;function pe(){if(je)return re;je=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return re=e,re}var oe,be;function Ce(){return be||(be=1,oe=Function.call.bind(Object.prototype.hasOwnProperty)),oe}var ie,Ee;function lt(){if(Ee)return ie;Ee=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=pe(),n={},a=Ce();e=function(i){var u="Warning: "+i;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function l(i,u,o,p,d){if(process.env.NODE_ENV!=="production"){for(var h in i)if(a(i,h)){var g;try{if(typeof i[h]!="function"){var R=Error((p||"React class")+": "+o+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw R.name="Invariant Violation",R}g=i[h](u,h,p,o,null,t)}catch(q){g=q}if(g&&!(g instanceof Error)&&e((p||"React class")+": type specification of "+o+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof g+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),g instanceof Error&&!(g.message in n)){n[g.message]=!0;var I=d?d():"";e("Failed "+o+" type: "+g.message+(I??""))}}}}return l.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ie=l,ie}var ae,ke;function ct(){if(ke)return ae;ke=1;var e=Q.reactIsExports,t=at(),n=pe(),a=Ce(),l=lt(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(o){var p="Warning: "+o;typeof console<"u"&&console.error(p);try{throw new Error(p)}catch{}});function u(){return null}return ae=function(o,p){var d=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function g(c){var f=c&&(d&&c[d]||c[h]);if(typeof f=="function")return f}var R="<<anonymous>>",I={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:W(),arrayOf:Y,element:K(),elementType:N(),instanceOf:D,node:Me(),objectOf:H,oneOf:F,oneOfType:Pe,shape:Le,exact:_e};function q(c,f){return c===f?c!==0||1/c===1/f:c!==c&&f!==f}function k(c,f){this.message=c,this.data=f&&typeof f=="object"?f:{},this.stack=""}k.prototype=Error.prototype;function A(c){if(process.env.NODE_ENV!=="production")var f={},w=0;function b(S,j,E,C,B,T,L){if(C=C||R,T=T||E,L!==n){if(p){var O=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw O.name="Invariant Violation",O}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var J=C+":"+E;!f[J]&&w<3&&(i("You are manually calling a React.PropTypes validation function for the `"+T+"` prop on `"+C+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),f[J]=!0,w++)}}return j[E]==null?S?j[E]===null?new k("The "+B+" `"+T+"` is marked as required "+("in `"+C+"`, but its value is `null`.")):new k("The "+B+" `"+T+"` is marked as required in "+("`"+C+"`, but its value is `undefined`.")):null:c(j,E,C,B,T)}var v=b.bind(null,!1);return v.isRequired=b.bind(null,!0),v}function y(c){function f(w,b,v,S,j,E){var C=w[b],B=$(C);if(B!==c){var T=X(C);return new k("Invalid "+S+" `"+j+"` of type "+("`"+T+"` supplied to `"+v+"`, expected ")+("`"+c+"`."),{expectedType:c})}return null}return A(f)}function W(){return A(u)}function Y(c){function f(w,b,v,S,j){if(typeof c!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside arrayOf.");var E=w[b];if(!Array.isArray(E)){var C=$(E);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an array."))}for(var B=0;B<E.length;B++){var T=c(E,B,v,S,j+"["+B+"]",n);if(T instanceof Error)return T}return null}return A(f)}function K(){function c(f,w,b,v,S){var j=f[w];if(!o(j)){var E=$(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement."))}return null}return A(c)}function N(){function c(f,w,b,v,S){var j=f[w];if(!e.isValidElementType(j)){var E=$(j);return new k("Invalid "+v+" `"+S+"` of type "+("`"+E+"` supplied to `"+b+"`, expected a single ReactElement type."))}return null}return A(c)}function D(c){function f(w,b,v,S,j){if(!(w[b]instanceof c)){var E=c.name||R,C=He(w[b]);return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected ")+("instance of `"+E+"`."))}return null}return A(f)}function F(c){if(!Array.isArray(c))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),u;function f(w,b,v,S,j){for(var E=w[b],C=0;C<c.length;C++)if(q(E,c[C]))return null;var B=JSON.stringify(c,function(L,O){var J=X(O);return J==="symbol"?String(O):O});return new k("Invalid "+S+" `"+j+"` of value `"+String(E)+"` "+("supplied to `"+v+"`, expected one of "+B+"."))}return A(f)}function H(c){function f(w,b,v,S,j){if(typeof c!="function")return new k("Property `"+j+"` of component `"+v+"` has invalid PropType notation inside objectOf.");var E=w[b],C=$(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type "+("`"+C+"` supplied to `"+v+"`, expected an object."));for(var B in E)if(a(E,B)){var T=c(E,B,v,S,j+"."+B,n);if(T instanceof Error)return T}return null}return A(f)}function Pe(c){if(!Array.isArray(c))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var f=0;f<c.length;f++){var w=c[f];if(typeof w!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Fe(w)+" at index "+f+"."),u}function b(v,S,j,E,C){for(var B=[],T=0;T<c.length;T++){var L=c[T],O=L(v,S,j,E,C,n);if(O==null)return null;O.data&&a(O.data,"expectedType")&&B.push(O.data.expectedType)}var J=B.length>0?", expected one of type ["+B.join(", ")+"]":"";return new k("Invalid "+E+" `"+C+"` supplied to "+("`"+j+"`"+J+"."))}return A(b)}function Me(){function c(f,w,b,v,S){return ee(f[w])?null:new k("Invalid "+v+" `"+S+"` supplied to "+("`"+b+"`, expected a ReactNode."))}return A(c)}function xe(c,f,w,b,v){return new k((c||"React class")+": "+f+" type `"+w+"."+b+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+v+"`.")}function Le(c){function f(w,b,v,S,j){var E=w[b],C=$(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));for(var B in c){var T=c[B];if(typeof T!="function")return xe(v,S,j,B,X(T));var L=T(E,B,v,S,j+"."+B,n);if(L)return L}return null}return A(f)}function _e(c){function f(w,b,v,S,j){var E=w[b],C=$(E);if(C!=="object")return new k("Invalid "+S+" `"+j+"` of type `"+C+"` "+("supplied to `"+v+"`, expected `object`."));var B=t({},w[b],c);for(var T in B){var L=c[T];if(a(c,T)&&typeof L!="function")return xe(v,S,j,T,X(L));if(!L)return new k("Invalid "+S+" `"+j+"` key `"+T+"` supplied to `"+v+"`.\nBad object: "+JSON.stringify(w[b],null," ")+`
55
+ Valid keys: `+JSON.stringify(Object.keys(c),null," "));var O=L(E,T,v,S,j+"."+T,n);if(O)return O}return null}return A(f)}function ee(c){switch(typeof c){case"number":case"string":case"undefined":return!0;case"boolean":return!c;case"object":if(Array.isArray(c))return c.every(ee);if(c===null||o(c))return!0;var f=g(c);if(f){var w=f.call(c),b;if(f!==c.entries){for(;!(b=w.next()).done;)if(!ee(b.value))return!1}else for(;!(b=w.next()).done;){var v=b.value;if(v&&!ee(v[1]))return!1}}else return!1;return!0;default:return!1}}function Ne(c,f){return c==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function $(c){var f=typeof c;return Array.isArray(c)?"array":c instanceof RegExp?"object":Ne(f,c)?"symbol":f}function X(c){if(typeof c>"u"||c===null)return""+c;var f=$(c);if(f==="object"){if(c instanceof Date)return"date";if(c instanceof RegExp)return"regexp"}return f}function Fe(c){var f=X(c);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function He(c){return!c.constructor||!c.constructor.name?R:c.constructor.name}return I.checkPropTypes=l,I.resetWarningCache=l.resetWarningCache,I.PropTypes=I,I},ae}var le,we;function dt(){if(we)return le;we=1;var e=pe();function t(){}function n(){}return n.resetWarningCache=t,le=function(){function a(u,o,p,d,h,g){if(g!==e){var R=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw R.name="Invariant Violation",R}}a.isRequired=a;function l(){return a}var i={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:l,element:a,elementType:a,instanceOf:l,node:a,objectOf:l,oneOf:l,oneOfType:l,shape:l,exact:l,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},le}var Wt=te.exports;if(process.env.NODE_ENV!=="production"){var ut=Q.reactIsExports,pt=!0;te.exports=ct()(ut.isElement,pt)}else te.exports=dt()();var ft=te.exports;const P=Z.getDefaultExportFromCjs(ft);let Te,Ie;typeof document<"u"&&(Te=document);typeof window<"u"&&(Ie=window);const Be=m.createContext({document:Te,window:Ie}),ne=()=>m.useContext(Be),{Provider:xt,Consumer:$t}=Be;class Ae extends m.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return m.Children.only(this.props.children)}}z(Ae,"propTypes",{children:P.element.isRequired,contentDidMount:P.func.isRequired,contentDidUpdate:P.func.isRequired});class de extends m.Component{constructor(n,a){super(n,a);z(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:a}=this.props;typeof a=="function"?a(n):a&&(a.current=n)});z(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});z(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=m.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const a=this.props.contentDidMount,l=this.props.contentDidUpdate,i=n.defaultView||n.parentView,u=s.jsxRuntimeExports.jsx(Ae,{contentDidMount:a,contentDidUpdate:l,children:s.jsxRuntimeExports.jsx(xt,{value:{document:n,window:i},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),o=this.getMountTarget();return[he.createPortal(this.props.head,this.getDoc().head),he.createPortal(u,o)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}z(de,"propTypes",{style:P.object,head:P.node,initialContent:P.string,mountTarget:P.string,contentDidMount:P.func,contentDidUpdate:P.func,children:P.oneOfType([P.element,P.arrayOf(P.element)])}),z(de,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const ht=m.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(de,{...e,forwardedRef:t}));let U=null,G=[],V=null,De=null;function gt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),a=parseInt(t.paddingTop,10),l=parseInt(t.paddingRight,10),i=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:a,paddingRight:l,paddingBottom:i}}const Re=(e,t,n)=>{if(!U)return;const a=e.getBoundingClientRect(),l=U==null?void 0:U.getElementById("placeholder"),{paddingLeft:i,paddingTop:u,paddingRight:o,paddingBottom:p}=gt(e);l.style.width=t==="vertical"?a.width-i-o+"px":"2px",l.style.height=t==="vertical"?"2px":a.height-u-p+"px",l.style.display="block";const d=G.reduce((h,g)=>Math.abs(g-n)<Math.abs(h-n)?g:h);De=G.indexOf(d),t==="vertical"?(l.style.top=e.offsetTop+d+"px",l.style.left=e.offsetLeft+i+"px"):(l.style.top=e.offsetTop+u+"px",l.style.left=e.offsetLeft+d+"px")},mt=e=>{const t=Oe(e),n=window.getComputedStyle(e),a=t==="horizontal",l=parseInt(n.paddingLeft),i=parseInt(n.paddingTop);let u=a?l:i;G=[u],Array.from(e.children).forEach(o=>{const p=window.getComputedStyle(o),d=parseInt(a?p.marginLeft+p.marginRight:p.marginTop+p.marginBottom),h=a?o.offsetWidth:o.offsetHeight;G.push(u+h+d),u+=h+d})};function Oe(e){const t=window.getComputedStyle(e).display,n=window.getComputedStyle(e).flexDirection;if(t==="flex")return n==="column"||n==="column-reverse"?"vertical":"horizontal";if(t==="grid"){const a=window.getComputedStyle(e).gridTemplateRows,l=window.getComputedStyle(e).gridTemplateColumns;if(a.includes("auto"))return"vertical";if(l.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const yt=x.throttle(e=>{const t=e.target,n=Oe(t);if(n==="vertical"){const a=e.clientY-t.offsetTop;Re(t,n,a)}else{const a=e.clientX-t.offsetLeft;Re(t,n,a)}},200),vt=e=>{e.preventDefault(),e.stopPropagation(),yt(e)};function ce(){const e=U==null?void 0:U.getElementById("placeholder");e.style.display="none"}const jt=()=>{const{document:e}=ne(),[t,n]=_.useAtom(r.draggingFlagAtom),a=Ye.useAddBlockByDrop(),l=Se.useFeature("dnd"),[,i]=r.useHighlightBlockId(),[,u]=r.useSelectedBlockIds();return U=e,{isDragging:t,"data-dnd":"branch",onDragOver:l?vt:x.noop,onDrop:l?o=>{V==null||V.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const p=JSON.parse(o.dataTransfer.getData("text/plain"));let d=o.target.getAttribute("data-block-id");d===null&&(d=o.target.parentElement.getAttribute("data-block-id")),a({block:p,dropTargetId:d||null,relativeIndex:De}),n(!1),ce(),setTimeout(()=>{ce()},300)}:x.noop,onDragEnter:l?o=>{const p=o;V=p.target,p.stopPropagation(),p.preventDefault(),G=[];const d=p.target;mt(d),d.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),i(""),u([])}:x.noop,onDragLeave:l?o=>{const p=o;V=null,p.stopPropagation(),p.preventDefault(),p.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:x.noop,onMouseOut:l?()=>{n(!1),ce()}:x.noop}};function fe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function bt(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Et=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=r.useUpdateBlocksProps(),[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[l,i]=_.useAtom(r.inlineEditingActiveAtom);return u=>{var R;if(l)return;const o=fe(u.target),p=o.getAttribute("data-block-type");if(!p||!e.includes(p))return;const d=o.cloneNode(!0);o.style.display="none",Array.from(d.attributes).forEach(I=>{I.name!=="class"&&d.removeAttribute(I.name)}),p==="Text"&&(d.style.display="inline-block"),o.parentNode.insertBefore(d,o.nextSibling);const h=new ze.Quill(d,{placeholder:"Type here..."});function g(){const I=h.getText(0,h.getLength());t([o.getAttribute("data-block-id")],{content:I}),o.removeAttribute("style"),d.removeEventListener("blur",g,!0),bt(h),i(""),a("")}d.addEventListener("blur",g,!0),h.focus(),(R=d.querySelector(".ql-clipboard"))==null||R.remove(),n([]),i(o.getAttribute("data-block-id"))}},kt=()=>{const[,e]=r.useSelectedStylingBlocks(),[,t]=r.useSelectedBlockIds(),[n]=_.useAtom(r.inlineEditingActiveAtom);return a=>{if(n)return;a.stopPropagation();const l=fe(a.target);if(l!=null&&l.getAttribute("data-block-parent")){const i=l.getAttribute("data-style-prop"),u=l.getAttribute("data-style-id"),o=l.getAttribute("data-block-parent");e([{id:u,prop:i,blockId:o}]),t([o])}else l!=null&&l.getAttribute("data-block-id")&&t([l.getAttribute("data-block-id")])}},wt=x.throttle((e,t)=>{const n=fe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),Rt=()=>{const[,e]=r.useHighlightBlockId(),[t]=_.useAtom(r.inlineEditingActiveAtom);return n=>{t||wt(n,e)}},St=({children:e})=>{const{document:t}=ne(),[n]=r.useSelectedBlockIds(),[a,l]=r.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!x.isEmpty(a))return;const d=qe(t,x.first(n));if(d){const h=d.getAttribute("data-style-prop");if(h){const g=d.getAttribute("data-style-id"),R=d.getAttribute("data-block-parent");l([{id:g,prop:h,blockId:R}])}}},100)},[t,n,l,a]);const i=Et(),u=kt(),o=Rt(),p=jt();return s.jsxRuntimeExports.jsx("div",{id:"canvas",onClick:u,onDoubleClick:i,onMouseMove:o,...x.omit(p,"isDragging"),className:"relative h-screen max-w-full "+(p.isDragging?"dragging":""),children:e})},qe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ct=()=>{const{window:e}=ne(),[t,n]=r.useSelectedBlockIds(),[,a]=r.useSelectedStylingBlocks(),{undo:l,redo:i}=r.useCanvasHistory(),u=r.useDuplicateBlocks(),[,o]=r.useCutBlockIds(),[,p]=r.useCopyBlockIds(),{pasteBlocks:d}=r.usePasteBlocks(),[,h]=r.usePreviewMode(),g=r.useRemoveBlocks(),{savePage:R}=r.useSavePage(),[I]=_.useAtom(r.inlineEditingActiveAtom),[,q]=_.useAtom(r.editLayerNameAtom),k=A=>{A.key==="Enter"&&(A.preventDefault(),t.length===1&&q(x.first(t)))};return m.useEffect(()=>{const A=y=>{if(y.key==="Escape"){n([]),a([]);return}if(k(y),!I&&(y.key==="Delete"||y.key==="Backspace")&&(y.preventDefault(),g(t)),y.ctrlKey||y.metaKey){if(["z","y","d","x","c","p","s","v"].includes(y.key)){if(I&&["x","z","v"].includes(y.key))return!0;y.preventDefault()}y.key==="s"&&(y.stopPropagation(),y.preventDefault(),R()),y.key==="z"&&l(),y.key==="y"&&i(),y.key==="d"&&u(t),y.key==="x"&&o(t),y.key==="c"&&p(t),y.key==="v"&&t.length>0&&d(t[0])}};return e.removeEventListener("keydown",A),e.addEventListener("keydown",A),()=>{e.removeEventListener("keydown",A)}},[t,n,l,g,h,i,u,o,p,d,I,R,e]),null},Tt=({block:e,label:t})=>{const[,n]=r.useSelectedBlockIds(),[,a]=r.useHighlightBlockId(),[,l]=_.useAtom(r.draggedBlockIdAtom),i=Se.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:i?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(x.pick(e,["_id","_type"]))),l(e._id),setTimeout(()=>{n([]),a(null)},200)},children:[s.jsxRuntimeExports.jsx(M.DragHandleDots2Icon,{}),t]})},It=({selectedBlockElement:e,block:t})=>{const n=r.useRemoveBlocks(),a=r.useDuplicateBlocks(),[,l]=r.useSelectedBlockIds(),[,i]=r.useSelectedStylingBlocks(),{floatingStyles:u,refs:o,update:p}=ge.useFloating({placement:"top-start",middleware:[ge.shift(),Ke.flip()],elements:{reference:e}});Je.useResizeObserver(e,()=>p(),e!==null);const d=x.get(t,"_parent",null),h=x.isEmpty(x.get(t,"_name",""))?x.get(t,"_type",""):x.get(t,"_name","");return!e||!t?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:o.setFloating,style:u,onClick:g=>{g.stopPropagation(),g.preventDefault()},onKeyDown:g=>g.stopPropagation(),className:"z-50 flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Tt,{label:h,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1 ",children:[d&&s.jsxRuntimeExports.jsx(M.ArrowUpIcon,{className:"hover:scale-105 ",onClick:()=>{i([]),l([d])}}),r.canDuplicateBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(M.CopyIcon,{className:"hover:scale-105 ",onClick:()=>a([t==null?void 0:t._id])}):null,r.canDeleteBlock(x.get(t,"_type",""))?s.jsxRuntimeExports.jsx(M.TrashIcon,{className:"hover:scale-105 ",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Bt=({model:e})=>{const[t]=r.useBrandingOptions(),[n]=r.useSelectedBlockIds(),[a]=r.useDarkMode(),[l]=r.useHighlightBlockId(),[i]=r.useSelectedStylingBlocks(),[u]=_.useAtom(r.draggedBlockIdAtom),{document:o,window:p}=ne(),[d]=m.useState(o==null?void 0:o.getElementById("highlighted-block")),[h]=m.useState(o==null?void 0:o.getElementById("selected-block")),[g]=m.useState(o==null?void 0:o.getElementById("selected-styling-block")),[R]=m.useState(o==null?void 0:o.getElementById("dragged-block"));m.useEffect(()=>{a?o==null||o.documentElement.classList.add("dark"):o==null||o.documentElement.classList.remove("dark")},[a,o]);const I=x.get(t,"headingFont","DM Sans"),q=x.get(t,"bodyFont","DM Sans");return m.useEffect(()=>{const k=x.get(t,"primaryColor","#000"),A=x.get(t,"secondaryColor","#FFF"),y=Xe.tailwindcssPaletteGenerator({colors:[k,A],names:["primary","secondary"]});y.primary.DEFAULT=k,y.secondary.DEFAULT=A;const W=x.get(t,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[I],body:[q]},extend:{borderRadius:{global:`${W||"0"}px`},colors:y}},plugins:[p.tailwind.plugin.withOptions(({prefix:Y="ui"}={})=>({addVariant:K})=>{for(const N of["open","checked","selected","active","disabled"])K(`${Y}-${N}`,[`&[data-headlessui-state~="${N}"]`,`:where([data-headlessui-state~="${N}"]) &`]),K(`${Y}-not-${N}`,[`&[data-headlessui-state]:not([data-headlessui-state~="${N}"])`,`:where([data-headlessui-state]:not([data-headlessui-state~="${N}"])) &:not([data-headlessui-state])`])})]})},[t,p,I,q]),m.useEffect(()=>{h&&(h.textContent=`${x.map(n,k=>`[data-block-id="${k}"]`).join(",")}{
56
+ outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
57
+ }`)},[n,h]),m.useEffect(()=>{if(!u){R.textContent="";return}R.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),m.useEffect(()=>{d&&(d.textContent=l?`[data-style-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[l,n,d]),m.useEffect(()=>{g&&(g.textContent=`${x.map(i,({id:k})=>`[data-style-id="${k}"]`).join(",")}{
58
+ outline: 1px solid #42a1fc !important; outline-offset: -1px;
59
+ }`)},[i,g]),m.useEffect(()=>{const k=x.get(t,"bodyTextLightColor","#64748b"),A=x.get(t,"bodyTextDarkColor","#94a3b8"),y=x.get(t,"bodyBgLightColor","#FFFFFF"),W=x.get(t,"bodyBgDarkColor","#0f172a");o.body.className=`font-body antialiased text-[${k}] bg-[${y}] dark:text-[${A}] dark:bg-[${W}]`},[t,o,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[I&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${I.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),q&&I!==q&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${q.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),I&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${I}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},At=e=>{const t={};return Object.keys(e).forEach(n=>{x.isString(e[n])&&e[n].startsWith(Z.SLOT_KEY)&&(t[n]=e[n].replace(Z.SLOT_KEY,"").split(","))}),t},Dt=x.memoize(e=>{const t=e.replace(Z.STYLES_KEY,"").split(",");return Ze.twMerge(t[0],t[1])});function Ot(e,t){return x.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(x.isString(e[n])&&e[n].startsWith(Z.STYLES_KEY)){const a=Dt(e[n]);t[n]={className:a,"data-style-prop":n,"data-block-parent":e._id,"data-style-id":`${n}-${e._id}`,...Ot(e,n)}}}),t}function Pt(e,t){const n=x.get(e,"_bindings",{});return x.isEmpty(n)?{...e}:(x.each(n,(a,l)=>{x.isString(a)&&x.get(t,a,null)&&(e[l]=x.get(t,a,null))}),e)}function ue({blocks:e}){const t=r.useAllBlocks(),n=m.useCallback(i=>qt(i),[]),[a]=Q.useChaiExternalData(),[l]=r.useAtom(r.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((i,u)=>{if(l===i._id)return null;const o=At(i),p={};x.isEmpty(o)||Object.keys(o).forEach(R=>{p[R]=m.Children.toArray(o[R].map(I=>s.jsxRuntimeExports.jsx(ue,{blocks:[x.find(t,{_id:I})]})))});const d=x.filter(t,{_parent:i._id});p.children=d.length?s.jsxRuntimeExports.jsx(ue,{blocks:d}):null;const h=Ge.getBlockComponent(i._type),g=x.get(h,"component",null);return x.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${i==null?void 0:i._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":i._id,"data-block-type":i._type,"data-dnd":r.canAddChildBlock(i._type)?"branch":"leaf"},inBuilder:!0,index:u,...Pt(i,a),...n(i),...p})})}))})}const Mt=()=>{const e=r.useAllBlocks();return s.jsxRuntimeExports.jsx(Ve.Provider,{children:x.isEmpty(e)?null:s.jsxRuntimeExports.jsx(Q.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(ue,{blocks:x.filter(e,t=>x.isEmpty(t._parent))})})})},Lt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),_t=()=>{const[e]=_.useAtom(r.networkModeAtom),[t]=r.usePreviewMode(),[n]=r.useCanvasWidth(),[,a]=r.useSelectedBlockIds(),l=r.useSelectedBlock(),[,i]=r.useHighlightBlockId(),u=m.useRef(null),o=m.useRef(null),[p,d]=m.useState({width:0,height:0}),h=it(p),[g,R]=m.useState(0),[I,q]=m.useState([]),[,k]=m.useState([]),[,A]=_.useAtom(r.canvasIframeAtom),[y,W]=r.useSelectedStylingBlocks(),Y=r.useBuilderProp("loadingCanvas",!1);m.useEffect(()=>{const{clientWidth:D,clientHeight:F}=o.current;d({width:D,height:F}),g===0&&R(D)},[o,n,g]);const K=(D,F=0)=>{const{top:H}=D.getBoundingClientRect();return H+F>=0&&H-F<=window.innerHeight};m.useEffect(()=>{var D,F;if(l&&l.type!=="Multiple"&&u.current){const H=qe(u.current.contentDocument,l._id);H&&(K(H)||(F=(D=u.current)==null?void 0:D.contentWindow)==null||F.scrollTo({top:H.offsetTop,behavior:"smooth"}),q([H]))}},[l]),m.useEffect(()=>{if(!x.isEmpty(y)&&u.current){const D=Lt(u.current.contentDocument,x.first(y).id);k(D?[D]:[null])}else k([null])},[y]);const N=m.useMemo(()=>{let D=ot;return e==="offline"&&(D=D.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),D=D.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),D=D.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),D},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{a([]),W([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto h-full w-full",style:g>0&&!x.isEmpty(h)?{width:t?"100%":g}:{},ref:o,children:s.jsxRuntimeExports.jsxs(ht,{contentDidMount:()=>A(u.current),ref:u,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:N,children:[s.jsxRuntimeExports.jsx(Ct,{}),s.jsxRuntimeExports.jsx(It,{block:l,selectedBlockElement:x.first(I)}),s.jsxRuntimeExports.jsx(Bt,{model:"page"}),s.jsxRuntimeExports.jsx(St,{children:Y?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute bg-green-500 z-[99999] max-w-full transition-transform"})]})})},Nt=m.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-Wsoku0Sm.cjs"))),Ft=()=>{const[e,t]=_.useAtom(r.addBlocksModalAtom);return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(rt,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative flex-1 overflow-hidden bg-slate-800/90 px-2 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px]",children:[s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(r.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(Q.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(_t,{})})}),e?s.jsxRuntimeExports.jsx("div",{onClick:()=>t(!1),className:"absolute inset-0 z-50 flex items-center bg-black/30 backdrop-blur-sm",children:s.jsxRuntimeExports.jsx("div",{onClick:n=>n.stopPropagation(),className:"mx-auto h-[90%] w-[90%] max-w-3xl rounded-md bg-white p-4 shadow-lg shadow-black/10 xl:w-[65%]",children:s.jsxRuntimeExports.jsx(Nt,{})})}):null]})]})};exports.default=Ft;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-zkc4SQCu.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index-7NRFGya_.cjs"),j=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=s.useSavePage(),d=o.useChangePage(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:m,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),s=require("./index-LLhN-70p.cjs"),i=require("lodash"),h=require("sonner"),l=require("react"),o=require("./index-rdttRR05.cjs"),j=require("lucide-react");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");const p=()=>{const{data:t}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:q}=s.useSavePage(),d=o.useChangePage(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(t==null?void 0:t.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&t.homepage&&!i.find(u,{uuid:n})&&a(t.homepage)},[n,u,t,a]),l.useEffect(()=>()=>a(null),[a]);const m=r=>{if(q!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});d(g)}};return x||i.isEmpty(n)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(j.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),i.capitalize(t.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(s.Select,{value:n||"",onValueChange:m,children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(s.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
@@ -1,9 +1,9 @@
1
1
  import { j as e } from "./jsx-runtime-NV737rRe.js";
2
- import { ag as x, au as h, av as f, aw as j, ax as y, ay as v } from "./index-ORFlyrBx.js";
3
- import { sortBy as P, filter as b, get as w, isEmpty as s, find as n, capitalize as C, map as N } from "lodash";
2
+ import { ag as x, aq as h, ar as f, as as j, at as y, au as P } from "./index-pJPfM9Bm.js";
3
+ import { sortBy as v, filter as b, get as w, isEmpty as s, find as n, capitalize as C, map as N } from "lodash";
4
4
  import { toast as S } from "sonner";
5
5
  import { useEffect as p } from "react";
6
- import { b as k, a as B, d as E, e as I } from "./index-HjvZqhVh.js";
6
+ import { b as k, a as B, d as E, e as I } from "./index-K_TiChPs.js";
7
7
  import { BriefcaseIcon as L } from "lucide-react";
8
8
  import "./MODIFIERS-MLfpKQY1.js";
9
9
  import "@radix-ui/react-toggle";
@@ -57,7 +57,7 @@ import "@tailwindcss/line-clamp";
57
57
  import "./tailwind-config-d1VL1lzE.js";
58
58
  import "react-hotkeys-hook";
59
59
  const De = () => {
60
- const { data: t } = k(), { data: i, isLoading: l } = B(), { syncState: c } = x(), d = E(), [o, a] = I(), m = P(b(i, { type: "STATIC" }), (r) => w(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
60
+ const { data: t } = k(), { data: i, isLoading: l } = B(), { syncState: c } = x(), d = E(), [o, a] = I(), m = v(b(i, { type: "STATIC" }), (r) => w(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
61
61
  p(() => {
62
62
  !s(i) && t.homepage && !n(i, { uuid: o }) && a(t.homepage);
63
63
  }, [o, i, t, a]), p(() => () => a(null), [a]);
@@ -102,7 +102,7 @@ const De = () => {
102
102
  ),
103
103
  /* @__PURE__ */ e.jsxs(h, { value: o || "", onValueChange: u, children: [
104
104
  /* @__PURE__ */ e.jsx(f, { 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(j, { placeholder: "Page" }) }),
105
- /* @__PURE__ */ e.jsx(y, { className: "z-[999]", children: N(m, (r) => /* @__PURE__ */ e.jsx(v, { value: r.uuid, children: r == null ? void 0 : r.name }, r.uuid)) })
105
+ /* @__PURE__ */ e.jsx(y, { className: "z-[999]", children: N(m, (r) => /* @__PURE__ */ e.jsx(P, { value: r.uuid, children: r == null ? void 0 : r.name }, r.uuid)) })
106
106
  ] })
107
107
  ] }) })
108
108
  ] })
@@ -1,18 +1,18 @@
1
1
  import { j as e } from "./jsx-runtime-NV737rRe.js";
2
- import { nth as k, startsWith as E, map as v, isUndefined as _, find as A, isEmpty as H, includes as P } from "lodash";
3
- import { BoxModelIcon as L, BoxIcon as F, DragHandleHorizontalIcon as V, ViewHorizontalIcon as z, BorderAllIcon as G, BorderTopIcon as $, TableIcon as K, DropdownMenuIcon as Q, RadiobuttonIcon as U, InputIcon as Y, ButtonIcon as y, CheckboxIcon as q, GroupIcon as W, SpaceBetweenVerticallyIcon as Z, ColumnsIcon as J, RowsIcon as B, TextIcon as C, SketchLogoIcon as X, DividerHorizontalIcon as ee, CodeIcon as te, CursorTextIcon as se, VideoIcon as oe, Link1Icon as ne, HeadingIcon as re, ImageIcon as ae, TriangleRightIcon as ce, ScissorsIcon as le, ClipboardIcon as ie, TrashIcon as xe, GlobeIcon as de, CopyIcon as me, ClipboardCopyIcon as pe, DoubleArrowDownIcon as ue, StackIcon as ge } from "@radix-ui/react-icons";
2
+ import { nth as k, startsWith as _, map as v, isUndefined as A, find as E, isEmpty as H, includes as P } from "lodash";
3
+ import { BoxModelIcon as L, BoxIcon as z, DragHandleHorizontalIcon as V, ViewHorizontalIcon as F, BorderAllIcon as G, BorderTopIcon as $, TableIcon as K, DropdownMenuIcon as Q, RadiobuttonIcon as U, InputIcon as Y, ButtonIcon as y, CheckboxIcon as q, GroupIcon as W, SpaceBetweenVerticallyIcon as Z, ColumnsIcon as J, RowsIcon as B, TextIcon as C, SketchLogoIcon as X, DividerHorizontalIcon as ee, CodeIcon as te, CursorTextIcon as se, VideoIcon as oe, Link1Icon as ne, HeadingIcon as re, ImageIcon as ae, TriangleRightIcon as ce, ScissorsIcon as le, ClipboardIcon as ie, TrashIcon as xe, GlobeIcon as de, CopyIcon as me, ClipboardCopyIcon as pe, DoubleArrowDownIcon as ue, StackIcon as ge } from "@radix-ui/react-icons";
4
4
  import { useDrop as je, useDragLayer as he } from "react-dnd";
5
5
  import { useDragOver as be, Tree as fe } from "@minoru/react-dnd-treeview";
6
6
  import { useTranslation as Ie } from "react-i18next";
7
- import { _ as ke, Z as ye, j as g, n as Be, bC as i, k as Ce, l as ve, a6 as we, m as Se, o as De, i as Te, bD as Ne, ao as Me, ap as Oe, bE as Re, bF as Ee, ae as _e, w as Ae, aj as He, p as Pe, aA as Le, br as Fe, bG as Ve } from "./index-ORFlyrBx.js";
8
- import { DatabaseIcon as ze } from "lucide-react";
7
+ import { _ as ke, Z as ye, j as g, n as Be, bz as i, k as Ce, l as ve, a6 as we, m as Se, o as De, i as Te, bA as Ne, ak as Me, al as Oe, bB as Re, bC as _e, ae as Ae, w as Ee, aj as He, p as Pe, aw as Le, bo as ze, bD as Ve } from "./index-pJPfM9Bm.js";
8
+ import { DatabaseIcon as Fe } from "lucide-react";
9
9
  import "./lib.js";
10
10
  import { useMemo as Ge, lazy as $e, useCallback as Ke, useState as Qe, Suspense as Ue } from "react";
11
11
  import { a as Ye } from "./MODIFIERS-MLfpKQY1.js";
12
12
  import { c as w } from "./utils-PPBbw5bk.js";
13
- import { f as qe } from "./index-HjvZqhVh.js";
13
+ import { f as qe } from "./index-K_TiChPs.js";
14
14
  import { useAtom as We } from "jotai";
15
- import { u as Ze } from "./useAddBlockByDrop-UA_Iw_4l.js";
15
+ import { u as Ze } from "./useAddBlockByDrop-UJ6QE7aE.js";
16
16
  import "@radix-ui/react-toggle";
17
17
  import "class-variance-authority";
18
18
  import "@radix-ui/react-switch";
@@ -109,13 +109,13 @@ const S = (t) => {
109
109
  case "TableBody":
110
110
  return /* @__PURE__ */ e.jsx(G, {});
111
111
  case "TableRow":
112
- return /* @__PURE__ */ e.jsx(z, {});
112
+ return /* @__PURE__ */ e.jsx(F, {});
113
113
  case "TableCell":
114
114
  return /* @__PURE__ */ e.jsx(V, {});
115
115
  case "DataProvider":
116
- return /* @__PURE__ */ e.jsx(ze, { size: 16 });
116
+ return /* @__PURE__ */ e.jsx(Fe, { size: 16 });
117
117
  case "Box":
118
- return /* @__PURE__ */ e.jsx(F, {});
118
+ return /* @__PURE__ */ e.jsx(z, {});
119
119
  default:
120
120
  return /* @__PURE__ */ e.jsx(L, {});
121
121
  }
@@ -146,7 +146,7 @@ function Je(t = "") {
146
146
  const Xe = (t) => {
147
147
  let s = "";
148
148
  return Object.keys(t).forEach((o) => {
149
- E(t[o], Ye) && (s = t[o]);
149
+ _(t[o], Ye) && (s = t[o]);
150
150
  }), s;
151
151
  }, et = (t) => {
152
152
  var p;
@@ -209,7 +209,7 @@ const Xe = (t) => {
209
209
  }, st = (t) => {
210
210
  const s = t.depth * 10 + 16;
211
211
  return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: s } });
212
- }, ot = $e(() => import("./MarkAsGlobalBlock-aqik3ouc.js")), nt = () => {
212
+ }, ot = $e(() => import("./MarkAsGlobalBlock-9pfqCgrO.js")), nt = () => {
213
213
  const [t] = g(), [, s] = Be();
214
214
  return /* @__PURE__ */ e.jsxs(i, { className: "flex items-center gap-x-4 text-xs", onClick: () => s(t), children: [
215
215
  /* @__PURE__ */ e.jsx(le, {}),
@@ -272,7 +272,7 @@ const Xe = (t) => {
272
272
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
273
273
  /* @__PURE__ */ e.jsx(Me, { open: o, onOpenChange: r, children: o && /* @__PURE__ */ e.jsx(Oe, { children: /* @__PURE__ */ e.jsx(Ue, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-96 w-full animate-pulse bg-gray-200" }), children: /* @__PURE__ */ e.jsx(ot, { closeModal: () => r(!1), id: s }) }) }) }),
274
274
  /* @__PURE__ */ e.jsxs(Re, { children: [
275
- /* @__PURE__ */ e.jsx(Ee, { children: t }),
275
+ /* @__PURE__ */ e.jsx(_e, { children: t }),
276
276
  /* @__PURE__ */ e.jsx(ct, { id: s, openMarkAsGlobalModal: () => r(!0) })
277
277
  ] })
278
278
  ] });
@@ -287,14 +287,14 @@ function it(t) {
287
287
  });
288
288
  }
289
289
  const gs = () => {
290
- const t = _e(), [s] = Ae(), [o, r, a] = g(), [, c] = He(), { t: x } = Ie(), { createSnapshot: d } = Pe(), j = qe(), m = Ze(), [, p] = We(Le), l = async (n, u) => {
290
+ const t = Ae(), [s] = Ee(), [o, r, a] = g(), [, c] = He(), { t: x } = Ie(), { createSnapshot: d } = Pe(), j = qe(), m = Ze(), [, p] = We(Le), l = async (n, u) => {
291
291
  const { dragSource: b, relativeIndex: f, dropTargetId: I, monitor: O } = u, R = it(n);
292
292
  s(R), b ? d() : (await m({ block: O.getItem(), dropTargetId: I, relativeIndex: f }), p(!1));
293
293
  }, D = v(t, (n) => ({
294
294
  id: n._id,
295
295
  text: n._type,
296
296
  parent: n._parent || 0,
297
- droppable: !_(A(t, { _parent: n._id })),
297
+ droppable: !A(E(t, { _parent: n._id })),
298
298
  data: n
299
299
  })), T = () => {
300
300
  r([]), c([]);
@@ -332,7 +332,7 @@ const gs = () => {
332
332
  /* @__PURE__ */ e.jsx("p", { className: "mt-2", children: x(h ? "drop_here_message" : "tree_view_no_blocks") })
333
333
  ]
334
334
  }
335
- ) : /* @__PURE__ */ e.jsx(Fe, { id: "layers-view", className: "no-scrollbar h-full overflow-y-auto p-1", children: /* @__PURE__ */ e.jsx(
335
+ ) : /* @__PURE__ */ e.jsx(ze, { id: "layers-view", className: "no-scrollbar h-full overflow-y-auto p-1", children: /* @__PURE__ */ e.jsx(
336
336
  fe,
337
337
  {
338
338
  initialOpen: j,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("lodash"),t=require("@radix-ui/react-icons"),q=require("react-dnd"),f=require("@minoru/react-dnd-treeview"),M=require("react-i18next"),r=require("./index-zkc4SQCu.cjs"),N=require("lucide-react");require("./lib.cjs");const g=require("react"),O=require("./MODIFIERS-WFzDQfiT.cjs"),B=require("./utils-It2K33fU.cjs"),A=require("./index-7NRFGya_.cjs"),_=require("jotai"),P=require("./useAddBlockByDrop-DPV32UHP.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const y=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(N.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function H(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const L=s=>{let n="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],O.STYLES_KEY)&&(n=s[o])}),n},F=s=>{var j;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:i}=s,{id:c,data:l}=s.node,d=s.depth*10,m=a=>{a.stopPropagation(),s.onToggle(s.node.id)},E=f.useDragOver(c,s.isOpen,s.onToggle),p=g.useMemo(()=>{const a=L(s.node.data);return H(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:B.cn("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&s.onSelect(c)},onContextMenu:()=>s.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(y,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=s.node.data)==null?void 0:j._name)||s.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},V=s=>{var o;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(y,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},z=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},G=g.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-p_wvHkQZ.cjs"))),$=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},K=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Q=()=>{const[s]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},U=({id:s=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),d=r.useBuilderProp("globalBlocksSupport",!1),m=g.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(r.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx($,{}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Q,{})]})},Y=({children:s,id:n=null})=>{const[o,i]=g.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(g.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(G,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(U,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})};function W(s){return u.map(s,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const J=()=>{const s=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:d}=M.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=A.useExpandedIds(),p=P.useAddBlockByDrop(),[,j]=_.useAtom(r.addBlocksModalAtom),a=async(x,R)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:D}=R,T=W(x);n(T),h?m():(await p({block:D.getItem(),dropTargetId:k,relativeIndex:b}),j(!1))},C=u.map(s,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(s,{_parent:x._id})),data:x})),v=()=>{i([]),l([])},[{isOver:I},S]=q.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await p({block:x,dropTargetId:"",relativeIndex:0}),j(!1)))()}})),{isDragging:w}=q.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>v(),className:B.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",w?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:S,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(f.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:C,rootId:0,render:(x,{depth:R,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(Y,{id:x.id,children:e.jsxRuntimeExports.jsx(F,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:R,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(V,{monitorProps:x}),onDrop:a,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:R})=>e.jsxRuntimeExports.jsx(z,{node:x,depth:R})})})})})};exports.default=J;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("lodash"),t=require("@radix-ui/react-icons"),q=require("react-dnd"),f=require("@minoru/react-dnd-treeview"),M=require("react-i18next"),r=require("./index-LLhN-70p.cjs"),N=require("lucide-react");require("./lib.cjs");const g=require("react"),O=require("./MODIFIERS-WFzDQfiT.cjs"),B=require("./utils-It2K33fU.cjs"),A=require("./index-rdttRR05.cjs"),_=require("jotai"),P=require("./useAddBlockByDrop-jJ_MnZ5y.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("clsx");require("tailwind-merge");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");require("sonner");const y=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(N.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function H(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const c=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(c);if(u.nth(l,1))return`Visible >=${n[u.nth(l,1)]}`}return""}const L=s=>{let n="";return Object.keys(s).forEach(o=>{u.startsWith(s[o],O.STYLES_KEY)&&(n=s[o])}),n},F=s=>{var j;const[,n]=r.useHighlightBlockId(),[o]=r.useHiddenBlockIds(),{isSelected:i}=s,{id:c,data:l}=s.node,d=s.depth*10,m=a=>{a.stopPropagation(),s.onToggle(s.node.id)},E=f.useDragOver(c,s.isOpen,s.onToggle),p=g.useMemo(()=>{const a=L(s.node.data);return H(a)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(c),className:B.cn("group flex w-full items-center justify-between space-x-px py-px ",i?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:a=>{a.stopPropagation(),!o.includes(c)&&s.onSelect(c)},onContextMenu:()=>s.onSelect(c),style:{paddingInlineStart:d},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:m,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(y,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((j=s.node.data)==null?void 0:j._name)||s.node.text}),p?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(i?"text-gray-200":"text-gray-500"),children:["(",p,")"]}):null]})]})})},V=s=>{var o;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(y,{type:(o=n==null?void 0:n.data)==null?void 0:o._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},z=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},G=g.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-bXkERbl2.cjs"))),$=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCutBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},K=()=>{const[s]=r.useSelectedBlockIds(),[,n]=r.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Q=()=>{const[s]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),o=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:(o==null?void 0:o._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},U=({id:s=null,openMarkAsGlobalModal:n})=>{const[o]=r.useSelectedBlockIds(),i=r.useDuplicateBlocks(),{pasteBlocks:c,canPaste:l}=r.usePasteBlocks(),d=r.useBuilderProp("globalBlocksSupport",!1),m=g.useCallback(()=>{i(o)},[o,i]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(r.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:m,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx($,{}),e.jsxRuntimeExports.jsx(K,{}),e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>c(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Q,{})]})},Y=({children:s,id:n=null})=>{const[o,i]=g.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(r.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxRuntimeExports.jsx(r.DialogContent,{children:e.jsxRuntimeExports.jsx(g.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(G,{closeModal:()=>i(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(U,{id:n,openMarkAsGlobalModal:()=>i(!0)})]})]})};function W(s){return u.map(s,n=>{const{data:o}=n;return{...o,_parent:n.parent===0?null:n.parent}})}const J=()=>{const s=r.useAllBlocks(),[n]=r.useSetAllBlocks(),[o,i,c]=r.useSelectedBlockIds(),[,l]=r.useSelectedStylingBlocks(),{t:d}=M.useTranslation(),{createSnapshot:m}=r.useCanvasHistory(),E=A.useExpandedIds(),p=P.useAddBlockByDrop(),[,j]=_.useAtom(r.addBlocksModalAtom),a=async(x,R)=>{const{dragSource:h,relativeIndex:b,dropTargetId:k,monitor:D}=R,T=W(x);n(T),h?m():(await p({block:D.getItem(),dropTargetId:k,relativeIndex:b}),j(!1))},C=u.map(s,x=>({id:x._id,text:x._type,parent:x._parent||0,droppable:!u.isUndefined(u.find(s,{_parent:x._id})),data:x})),v=()=>{i([]),l([])},[{isOver:I},S]=q.useDrop(()=>({accept:["CHAI_BLOCK"],collect:x=>({canDrop:x.canDrop(),isOver:x.isOver()}),drop:x=>{(async()=>(await p({block:x,dropTargetId:"",relativeIndex:0}),j(!1)))()}})),{isDragging:w}=q.useDragLayer(x=>({isDragging:x.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>v(),className:B.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",w?"bg-green-50/80":"bg-background"),children:u.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:S,className:`mx-1 mt-4 max-w-full h-full p-6 text-center text-sm text-gray-400 ${I?"bg-blue-200":""}`,children:[I?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(I?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(f.Tree,{initialOpen:E,extraAcceptTypes:["CHAI_BLOCK"],tree:C,rootId:0,render:(x,{depth:R,isOpen:h,onToggle:b})=>e.jsxRuntimeExports.jsx(Y,{id:x.id,children:e.jsxRuntimeExports.jsx(F,{onSelect:k=>{l([]),i([k])},isSelected:u.includes(o,x.id),node:x,depth:R,isOpen:h,onToggle:b,toggleIds:c})}),dragPreviewRender:x=>e.jsxRuntimeExports.jsx(V,{monitorProps:x}),onDrop:a,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(x,{depth:R})=>e.jsxRuntimeExports.jsx(z,{node:x,depth:R})})})})})};exports.default=J;
@@ -1,7 +1,7 @@
1
1
  import { j as t } from "./jsx-runtime-NV737rRe.js";
2
2
  import { GlobeIcon as m } from "@radix-ui/react-icons";
3
3
  import { useState as n } from "react";
4
- import { $ as p, B as o } from "./index-ORFlyrBx.js";
4
+ import { $ as p, B as o } from "./index-pJPfM9Bm.js";
5
5
  import { capitalize as c } from "lodash";
6
6
  import "./MODIFIERS-MLfpKQY1.js";
7
7
  import "@radix-ui/react-toggle";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("@radix-ui/react-icons"),o=require("react"),s=require("./index-zkc4SQCu.cjs"),c=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");const x=({id:t=null,closeModal:i})=>{const l=s.useMarkAsGlobalBlock(),[r,u]=o.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(n.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:a=>u(a.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{l(t,c.capitalize(r)),i()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(s.Button,{variant:"outline",onClick:i,children:"Cancel"})]})]})};exports.default=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),n=require("@radix-ui/react-icons"),o=require("react"),s=require("./index-LLhN-70p.cjs"),c=require("lodash");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");const x=({id:t=null,closeModal:i})=>{const l=s.useMarkAsGlobalBlock(),[r,u]=o.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(n.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:a=>u(a.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{l(t,c.capitalize(r)),i()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(s.Button,{variant:"outline",onClick:i,children:"Cancel"})]})]})};exports.default=x;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),i=require("lodash"),s=require("./index-7NRFGya_.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("i18next");require("react-i18next");require("./index-zkc4SQCu.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-JRSQ_N56.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-huD5B1om.cjs"))),d=()=>{const{data:q=[],isLoading:t}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(q,{type:"STATIC"}),o=>i.get(o,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("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:"Pages"}),e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:t,pages:n})})]})};exports.default=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),u=require("react"),i=require("lodash"),s=require("./index-rdttRR05.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("i18next");require("react-i18next");require("./index-LLhN-70p.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-Gsa-gnsn.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-DJqp04Tr.cjs"))),d=()=>{const{data:q=[],isLoading:t}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(q,{type:"STATIC"}),o=>i.get(o,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("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:"Pages"}),e.jsxRuntimeExports.jsx(u.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(a,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(x,{isLoading:t,pages:n})})]})};exports.default=d;
@@ -1,11 +1,11 @@
1
1
  import { j as t } from "./jsx-runtime-NV737rRe.js";
2
2
  import i, { Suspense as s } from "react";
3
3
  import { sortBy as a, filter as d, get as n } from "lodash";
4
- import { a as l, b as c } from "./index-HjvZqhVh.js";
4
+ import { a as l, b as c } from "./index-K_TiChPs.js";
5
5
  import "./MODIFIERS-MLfpKQY1.js";
6
6
  import "i18next";
7
7
  import "react-i18next";
8
- import "./index-ORFlyrBx.js";
8
+ import "./index-pJPfM9Bm.js";
9
9
  import "@radix-ui/react-toggle";
10
10
  import "class-variance-authority";
11
11
  import "./utils-PPBbw5bk.js";
@@ -56,7 +56,7 @@ import "./tailwind-config-d1VL1lzE.js";
56
56
  import "react-hotkeys-hook";
57
57
  import "sonner";
58
58
  import "lucide-react";
59
- const x = i.lazy(() => import("./add-page-modal-K5isTZOT.js")), g = i.lazy(() => import("./page-viewer-fFaDQOOI.js")), bt = () => {
59
+ const x = i.lazy(() => import("./add-page-modal-31-dJjna.js")), g = i.lazy(() => import("./page-viewer-Oku6zrcm.js")), bt = () => {
60
60
  const { data: o = [], isLoading: m } = l(), { data: r } = c(), p = a(d(o, { type: "STATIC" }), (e) => n(e, "uuid") === (r == null ? void 0 : r.homepage) ? 0 : 1);
61
61
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
62
62
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),r=require("react"),x=require("lodash"),s=require("./index-zkc4SQCu.cjs"),a=require("./index-7NRFGya_.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-rNNI-K6l.cjs"))),q=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-cERASO9j.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function m(){const t=a.useUpdateProject(),{data:n}=a.useProject(),[i,o]=r.useState(l(n||{})),u=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(n,u.current)||t.mutate(u.current,{onSuccess:()=>o(u.current)})},[u]),r.useEffect(()=>{u.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{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:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:o})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(q,{_projectData:i,seany:o})})})]})]})})]})}exports.default=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-WUGKV8jN.cjs"),r=require("react"),x=require("lodash"),s=require("./index-LLhN-70p.cjs"),a=require("./index-rdttRR05.cjs");require("./MODIFIERS-WFzDQfiT.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-It2K33fU.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("jotai");require("flat-to-nested");require("redux-undo");require("@chaibuilder/runtime");require("@react-hookz/web");require("react-i18next");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./lib.cjs");require("himalaya");require("./functions-KMQYiBHf.cjs");require("@mhsdesign/jit-browser-tailwindcss");require("@bobthered/tailwindcss-palette-generator");require("@tailwindcss/forms");require("@tailwindcss/typography");require("@tailwindcss/aspect-ratio");require("@tailwindcss/line-clamp");require("./tailwind-config-OxLD7oFU.cjs");require("react-hotkeys-hook");require("sonner");require("lucide-react");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-rVhljgfP.cjs"))),q=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-Xg6cVYXo.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function m(){const t=a.useUpdateProject(),{data:n}=a.useProject(),[i,o]=r.useState(l(n||{})),u=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(n,u.current)||t.mutate(u.current,{onSuccess:()=>o(u.current)})},[u]),r.useEffect(()=>{u.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{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:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:o})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(q,{_projectData:i,seany:o})})})]})]})})]})}exports.default=m;
@@ -1,8 +1,8 @@
1
1
  import { j as t } from "./jsx-runtime-NV737rRe.js";
2
2
  import m, { useRef as x, useEffect as a, Suspense as p } from "react";
3
3
  import { isEqual as b, isEmpty as j } from "lodash";
4
- import { bk as f, bl as n, bm as l, bn as c } from "./index-ORFlyrBx.js";
5
- import { c as h, b as g } from "./index-HjvZqhVh.js";
4
+ import { bh as h, bi as n, bj as l, bk as c } from "./index-pJPfM9Bm.js";
5
+ import { c as f, b as g } from "./index-K_TiChPs.js";
6
6
  import "./MODIFIERS-MLfpKQY1.js";
7
7
  import "@radix-ui/react-toggle";
8
8
  import "class-variance-authority";
@@ -56,12 +56,12 @@ import "./tailwind-config-d1VL1lzE.js";
56
56
  import "react-hotkeys-hook";
57
57
  import "sonner";
58
58
  import "lucide-react";
59
- const N = m.lazy(() => import("./project-general-setting-rH_1r38b.js")), S = m.lazy(() => import("./project-seo-setting-k0HlefUD.js")), d = /* @__PURE__ */ t.jsx("div", { className: "px-3", children: /* @__PURE__ */ t.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (r) => r && j(r.seoData) ? {
59
+ const N = m.lazy(() => import("./project-general-setting-hrJZUYnV.js")), S = m.lazy(() => import("./project-seo-setting-fwyxNcY-.js")), d = /* @__PURE__ */ t.jsx("div", { className: "px-3", children: /* @__PURE__ */ t.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (r) => r && j(r.seoData) ? {
60
60
  ...r,
61
61
  seoData: { title: "", description: "", image: "" }
62
62
  } : r;
63
63
  function At() {
64
- const r = h(), { data: i } = g(), [e, s] = m.useState(
64
+ const r = f(), { data: i } = g(), [e, s] = m.useState(
65
65
  u(i || {})
66
66
  ), o = x(e);
67
67
  return a(
@@ -76,7 +76,7 @@ function At() {
76
76
  }, [e]), /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
77
77
  /* @__PURE__ */ t.jsx("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ t.jsx("h1", { className: "px-1 font-semibold", children: "Website Settings" }) }),
78
78
  /* @__PURE__ */ t.jsx("hr", { className: "-mx-1" }),
79
- /* @__PURE__ */ t.jsx("div", { className: "-mx-1", children: /* @__PURE__ */ t.jsxs(f, { type: "single", className: "w-full", defaultValue: "GENERAL", children: [
79
+ /* @__PURE__ */ t.jsx("div", { className: "-mx-1", children: /* @__PURE__ */ t.jsxs(h, { type: "single", className: "w-full", defaultValue: "GENERAL", children: [
80
80
  /* @__PURE__ */ t.jsxs(n, { value: "GENERAL", className: "border-b-2 border-slate-100 dark:border-slate-800", children: [
81
81
  /* @__PURE__ */ t.jsx(l, { className: "bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800", children: "General Settings" }),
82
82
  /* @__PURE__ */ t.jsx(c, { className: "px-2 pt-4 text-sm", children: /* @__PURE__ */ t.jsx(p, { fallback: d, children: /* @__PURE__ */ t.jsx(N, { _projectData: e, seany: s }) }) })