@chaibuilder/sdk 1.2.18 → 1.2.20

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 (101) hide show
  1. package/dist/{AddBlocks-uCdu9Xpr.js → AddBlocks-VIWJkaHJ.js} +24 -25
  2. package/dist/AddBlocks-X9eh8OWJ.cjs +1 -0
  3. package/dist/{BrandingOptions-JbHRN7V5.js → BrandingOptions-5ss0k1nb.js} +12 -13
  4. package/dist/BrandingOptions-PzPdafIT.cjs +1 -0
  5. package/dist/CanvasArea-TTGqlBKO.js +908 -0
  6. package/dist/CanvasArea-hoyr4dfb.cjs +55 -0
  7. package/dist/CurrentPage-EddxgHU-.cjs +1 -0
  8. package/dist/{CurrentPage-AlOLPG4o.js → CurrentPage-a3T2uy8Q.js} +10 -12
  9. package/dist/ListTree-kergCZrw.js +126 -0
  10. package/dist/ListTree-tADrgsqZ.cjs +1 -0
  11. package/dist/Outline-3IHYlOzF.cjs +1 -0
  12. package/dist/Outline-rNFJGkap.js +294 -0
  13. package/dist/{PagesPanel-VbSQHEu_.js → PagesPanel-0bL28ofN.js} +5 -7
  14. package/dist/PagesPanel-B33hWN11.cjs +1 -0
  15. package/dist/ProjectPanel-qtRTXNOP.cjs +1 -0
  16. package/dist/{ProjectPanel-fqux215P.js → ProjectPanel-sBRkUXnY.js} +15 -17
  17. package/dist/{Settings-IhWI1ice.js → Settings-HgGe1ANj.js} +587 -554
  18. package/dist/Settings-rXxS3RGM.cjs +1 -0
  19. package/dist/{SidePanels-lMCXrchR.js → SidePanels-R_g9rSjP.js} +132 -134
  20. package/dist/SidePanels-aAm-2A3s.cjs +1 -0
  21. package/dist/{Topbar-DYiisBtw.js → Topbar-AUTKpVHO.js} +3 -4
  22. package/dist/Topbar-cXtxVswU.cjs +1 -0
  23. package/dist/TypeIcon-ElNNPazl.cjs +1 -0
  24. package/dist/TypeIcon-qO96rNbV.js +69 -0
  25. package/dist/{UnsplashImages-lGLcqo4M.js → UnsplashImages-1RFHZIte.js} +13 -14
  26. package/dist/UnsplashImages-p34UJJWJ.cjs +1 -0
  27. package/dist/UploadImages-CLfyNo1i.cjs +1 -0
  28. package/dist/{UploadImages-06m6vjbL.js → UploadImages-G2orrhmZ.js} +8 -9
  29. package/dist/{add-page-modal-mEbIXSKX.js → add-page-modal-DUthvJNJ.js} +7 -9
  30. package/dist/add-page-modal-KCy_Khfe.cjs +1 -0
  31. package/dist/confirm-alert-T8vimDRx.cjs +1 -0
  32. package/dist/{confirm-alert-YETlIRpE.js → confirm-alert-nk2WQHud.js} +3 -4
  33. package/dist/{controls-Dy1qa8Dc.cjs → controls-KK2oLIa8.cjs} +1 -1
  34. package/dist/{controls-XPXGHKht.js → controls-OfJWSEqC.js} +29 -28
  35. package/dist/core.cjs +1 -1
  36. package/dist/core.d.ts +2 -1
  37. package/dist/core.js +45 -47
  38. package/dist/defaultTheme-7Lk2zq60.cjs +1 -0
  39. package/dist/{defaultTheme-s0cpA5Oy.js → defaultTheme-gunU_Fe5.js} +31 -33
  40. package/dist/{delete-page-modal-J_SmPWrw.js → delete-page-modal-WvWRQUgU.js} +8 -10
  41. package/dist/delete-page-modal-_pFjWLJn.cjs +1 -0
  42. package/dist/email-blocks.cjs +1 -1
  43. package/dist/email-blocks.js +81 -81
  44. package/dist/email.cjs +1 -1
  45. package/dist/email.d.ts +2 -0
  46. package/dist/email.js +4 -6
  47. package/dist/{form-Y0Vb4m04.cjs → form-YnnWtUGk.cjs} +1 -1
  48. package/dist/{form-2xJcQs_Y.js → form-kXQX4L2W.js} +1 -1
  49. package/dist/{index-627XtO9e.js → index--Pt4B5bv.js} +3 -3
  50. package/dist/index-DeHH1q_1.cjs +1 -0
  51. package/dist/{index-3TQsdso6.cjs → index-JqRQZLN5.cjs} +1 -1
  52. package/dist/{index-LF3KXx4u.js → index-QIbDWoML.js} +8308 -8162
  53. package/dist/{index-ZwpjuB-N.cjs → index-e5cgISUO.cjs} +51 -51
  54. package/dist/{index-ZBqiaKhx.js → index-la4rqGKN.js} +802 -794
  55. package/dist/lib.cjs +1 -1
  56. package/dist/lib.js +1 -1
  57. package/dist/page-viewer-6phtctz6.cjs +1 -0
  58. package/dist/{page-viewer-7u0SWWmO.js → page-viewer-s_lHBVfx.js} +6 -8
  59. package/dist/project-general-setting-SaNOMXEl.cjs +1 -0
  60. package/dist/{project-general-setting-SqC85J7F.js → project-general-setting-gj4A0X5W.js} +7 -9
  61. package/dist/{project-seo-setting-TlQherop.js → project-seo-setting-aCPg-IIc.js} +5 -6
  62. package/dist/project-seo-setting-bMDdgKRZ.cjs +1 -0
  63. package/dist/render.cjs +1 -1
  64. package/dist/render.d.ts +10 -0
  65. package/dist/render.js +164 -78
  66. package/dist/{single-page-detail-ClZYIdSO.js → single-page-detail-TP-cxVIT.js} +36 -38
  67. package/dist/single-page-detail-er8i2FIF.cjs +1 -0
  68. package/dist/studio.cjs +1 -1
  69. package/dist/studio.d.ts +2 -0
  70. package/dist/studio.js +4 -6
  71. package/dist/ui.cjs +1 -1
  72. package/dist/ui.d.ts +1 -1
  73. package/dist/ui.js +130 -131
  74. package/dist/{useAddBlockByDrop-E343zoB3.cjs → useAddBlockByDrop-LSV8adwE.cjs} +1 -1
  75. package/dist/{useAddBlockByDrop-sPX4lN-O.js → useAddBlockByDrop-_vczk5o_.js} +1 -1
  76. package/dist/web-blocks.cjs +1 -1
  77. package/dist/web-blocks.js +1 -1
  78. package/package.json +4 -14
  79. package/dist/AddBlocks-5Q5w5lPJ.cjs +0 -1
  80. package/dist/BrandingOptions-xrGQI1Kn.cjs +0 -1
  81. package/dist/CanvasArea-aWzbzB9p.js +0 -1403
  82. package/dist/CanvasArea-oUIvLfdq.cjs +0 -60
  83. package/dist/CurrentPage-atmd8UrZ.cjs +0 -1
  84. package/dist/Outline-oGoAdnBw.js +0 -355
  85. package/dist/Outline-uMUTwN-R.cjs +0 -1
  86. package/dist/PagesPanel-nN3QUwXp.cjs +0 -1
  87. package/dist/ProjectPanel-UIEFhref.cjs +0 -1
  88. package/dist/Settings-8qUW0Iow.cjs +0 -1
  89. package/dist/SidePanels-cOHgPE9y.cjs +0 -1
  90. package/dist/Topbar-vLD-rWl5.cjs +0 -1
  91. package/dist/UnsplashImages-1JWfKlBc.cjs +0 -1
  92. package/dist/UploadImages-T4MYMOhW.cjs +0 -1
  93. package/dist/add-page-modal-niwhffYL.cjs +0 -1
  94. package/dist/confirm-alert-ZpEIxh3X.cjs +0 -1
  95. package/dist/defaultTheme-1XwPZT2b.cjs +0 -1
  96. package/dist/delete-page-modal-sOqRlmKb.cjs +0 -1
  97. package/dist/index-T3wfa1kz.cjs +0 -1
  98. package/dist/page-viewer-6UDraUKW.cjs +0 -1
  99. package/dist/project-general-setting-AW5Vtmgx.cjs +0 -1
  100. package/dist/project-seo-setting-cWiNZcxW.cjs +0 -1
  101. package/dist/single-page-detail-kJUW6FE9.cjs +0 -1
@@ -1,60 +0,0 @@
1
- "use strict";var $e=Object.defineProperty;var Ue=(e,t,n)=>t in e?$e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var z=(e,t,n)=>(Ue(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-Z_BpKhVy.cjs"),m=require("react"),p=require("lodash-es"),P=require("@radix-ui/react-icons"),o=require("./index-T3wfa1kz.cjs"),ne=require("react-i18next"),L=require("jotai"),ge=require("react-dom"),ze=require("./_commonjsHelpers-wDK0ZLPo.cjs"),G=require("./index-ZwpjuB-N.cjs"),Ye=require("react-quill"),Ke=require("./useAddBlockByDrop-E343zoB3.cjs"),Te=require("flagged"),Je=require("@floating-ui/dom"),me=require("@floating-ui/react-dom"),Ve=require("@react-hookz/web"),Ze=require("@bobthered/tailwindcss-palette-generator"),Qe=require("react-wrap-balancer"),Ge=require("tailwind-merge"),ee=require("./MODIFIERS-9EwxLM8V.cjs"),Xe=require("@chaibuilder/runtime");require("./Functions-N3yhPYKY.cjs");require("clsx");require("flat-to-nested");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("i18next");require("react-textarea-autosize");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");const et=()=>{const{hasUndo:e,hasRedo:t,undo:n,redo:i}=o.useUndoManager();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Button,{disabled:!e(),size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{})}),s.jsxRuntimeExports.jsx(o.Button,{disabled:!t(),onClick:i,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(P.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function tt(){const[e,t]=o.useDarkMode(),{t:n}=ne.useTranslation();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Label,{htmlFor:"dark-mode-switch",children:n("dark_mode")}),s.jsxRuntimeExports.jsxs(o.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:n("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 ye=({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"}})]}),nt=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(P.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(P.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(ye,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(ye,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(P.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(P.DesktopIcon,{}),width:1920}],ve=({title:e,content:t,currentBreakpoint:n,breakpoint:i,width:a,icon:c,onClick:u})=>{const{t:r}=ne.useTranslation();return s.jsxRuntimeExports.jsxs(o.HoverCard,{children:[s.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(o.Button,{onClick:()=>u(a),size:"sm",variant:i===n?"secondary":"ghost",children:c})}),s.jsxRuntimeExports.jsx(o.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:r(e)}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:r(t)})]})})})]})},st=()=>{const[,e,t]=o.useCanvasWidth(),[n,i]=o.useSelectedBreakpoints(),{t:a}=ne.useTranslation(),c=o.useBuilderProp("breakpoints",nt),u=r=>{n.includes(r)?n.length>2&&i(n.filter(d=>d!==r)):i(d=>[...d,r])};return c.length<4?s.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:p.map(c,r=>m.createElement(ve,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:e}))}):s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[p.map(c.filter(r=>p.includes(n,p.toUpper(r.breakpoint))),r=>m.createElement(ve,{...r,onClick:t,key:r.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(P.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:a("Breakpoints")}),s.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),p.map(c,r=>s.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:r.breakpoint==="xs",onCheckedChange:()=>u(p.toUpper(r.breakpoint)),checked:p.includes(n,p.toUpper(r.breakpoint)),children:a(r.title)},r.breakpoint))]})]})]})},rt=()=>{const{t:e}=ne.useTranslation(),{setNewBlocks:t}=o.useBlocksStoreUndoableActions(),[,n]=o.useSelectedBlockIds(),[,i]=o.useSelectedStylingBlocks(),a=m.useCallback(()=>{t([]),n([]),i([])},[t]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(P.EraserIcon,{})," ",e("clear")]})}),s.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:e("clear_canvas_title")}),s.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:e("clear_canvas_description")})]}),s.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:e("cancel")}),s.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:a,children:e("yes")})]})]})]})})},ot=()=>{const e=o.useBuilderProp("darkMode",!1),[t]=o.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(tt,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsx(st,{}),s.jsxRuntimeExports.jsx(o.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(P.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[p.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(et,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(rt,{})]})]})},it=`<!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://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/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
- .frame-root .frame-content { height: 100%; }
39
- </style>
40
- <style id="hidden-blocks"></style>
41
- <style id="selected-block"></style>
42
- <style id="selected-styling-block"></style>
43
- <style id="highlighted-block"></style>
44
- <style id="dragged-block"></style>
45
-
46
- </head>
47
- <body class="font-body antialiased h-full">
48
- <div class="frame-root h-full"></div>
49
- <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
50
- </body>
51
- </html>`,at=e=>{const[t]=o.useCanvasWidth(),[,n]=o.useCanvasZoom(),[i,a]=m.useState({}),c=m.useCallback(()=>{const{width:u,height:r}=e;if(u<t){const d=parseFloat((u/t).toFixed(2).toString());let x={};const h=r*d;r&&(x={height:100+(r-h)/h*100+"%"}),a({position:"relative",top:0,transform:`scale(${d})`,transformOrigin:"top left",...x,maxWidth:"none"}),n(d*100)}else a({}),n(100)},[t,e,n]);return m.useEffect(()=>{c()},[t,e,n,c]),i};var te={exports:{}};/*
52
- object-assign
53
- (c) Sindre Sorhus
54
- @license MIT
55
- */var re,je;function lt(){if(je)return re;je=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function i(c){if(c==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(c)}function a(){try{if(!Object.assign)return!1;var c=new String("abc");if(c[5]="de",Object.getOwnPropertyNames(c)[0]==="5")return!1;for(var u={},r=0;r<10;r++)u["_"+String.fromCharCode(r)]=r;var d=Object.getOwnPropertyNames(u).map(function(h){return u[h]});if(d.join("")!=="0123456789")return!1;var x={};return"abcdefghijklmnopqrst".split("").forEach(function(h){x[h]=h}),Object.keys(Object.assign({},x)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return re=a()?Object.assign:function(c,u){for(var r,d=i(c),x,h=1;h<arguments.length;h++){r=Object(arguments[h]);for(var g in r)t.call(r,g)&&(d[g]=r[g]);if(e){x=e(r);for(var b=0;b<x.length;b++)n.call(r,x[b])&&(d[x[b]]=r[x[b]])}}return d},re}var oe,be;function fe(){if(be)return oe;be=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return oe=e,oe}var ie,Ee;function Ce(){return Ee||(Ee=1,ie=Function.call.bind(Object.prototype.hasOwnProperty)),ie}var ae,ke;function ct(){if(ke)return ae;ke=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=fe(),n={},i=Ce();e=function(c){var u="Warning: "+c;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}}}function a(c,u,r,d,x){if(process.env.NODE_ENV!=="production"){for(var h in c)if(i(c,h)){var g;try{if(typeof c[h]!="function"){var b=Error((d||"React class")+": "+r+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof c[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw b.name="Invariant Violation",b}g=c[h](u,h,d,r,null,t)}catch(O){g=O}if(g&&!(g instanceof Error)&&e((d||"React class")+": type specification of "+r+" `"+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 D=x?x():"";e("Failed "+r+" type: "+g.message+(D??""))}}}}return a.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},ae=a,ae}var le,Re;function dt(){if(Re)return le;Re=1;var e=G.reactIsExports,t=lt(),n=fe(),i=Ce(),a=ct(),c=function(){};process.env.NODE_ENV!=="production"&&(c=function(r){var d="Warning: "+r;typeof console<"u"&&console.error(d);try{throw new Error(d)}catch{}});function u(){return null}return le=function(r,d){var x=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function g(l){var f=l&&(x&&l[x]||l[h]);if(typeof f=="function")return f}var b="<<anonymous>>",D={array:B("array"),bigint:B("bigint"),bool:B("boolean"),func:B("function"),number:B("number"),object:B("object"),string:B("string"),symbol:B("symbol"),any:H(),arrayOf:Y,element:K(),elementType:N(),instanceOf:A,node:Me(),objectOf:F,oneOf:W,oneOfType:Pe,shape:Le,exact:Ne};function O(l,f){return l===f?l!==0||1/l===1/f:l!==l&&f!==f}function v(l,f){this.message=l,this.data=f&&typeof f=="object"?f:{},this.stack=""}v.prototype=Error.prototype;function y(l){if(process.env.NODE_ENV!=="production")var f={},w=0;function k(S,E,R,T,I,C,M){if(T=T||b,C=C||R,M!==n){if(d){var _=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 _.name="Invariant Violation",_}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var J=T+":"+R;!f[J]&&w<3&&(c("You are manually calling a React.PropTypes validation function for the `"+C+"` prop on `"+T+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),f[J]=!0,w++)}}return E[R]==null?S?E[R]===null?new v("The "+I+" `"+C+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new v("The "+I+" `"+C+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:l(E,R,T,I,C)}var j=k.bind(null,!1);return j.isRequired=k.bind(null,!0),j}function B(l){function f(w,k,j,S,E,R){var T=w[k],I=$(T);if(I!==l){var C=V(T);return new v("Invalid "+S+" `"+E+"` of type "+("`"+C+"` supplied to `"+j+"`, expected ")+("`"+l+"`."),{expectedType:l})}return null}return y(f)}function H(){return y(u)}function Y(l){function f(w,k,j,S,E){if(typeof l!="function")return new v("Property `"+E+"` of component `"+j+"` has invalid PropType notation inside arrayOf.");var R=w[k];if(!Array.isArray(R)){var T=$(R);return new v("Invalid "+S+" `"+E+"` of type "+("`"+T+"` supplied to `"+j+"`, expected an array."))}for(var I=0;I<R.length;I++){var C=l(R,I,j,S,E+"["+I+"]",n);if(C instanceof Error)return C}return null}return y(f)}function K(){function l(f,w,k,j,S){var E=f[w];if(!r(E)){var R=$(E);return new v("Invalid "+j+" `"+S+"` of type "+("`"+R+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return y(l)}function N(){function l(f,w,k,j,S){var E=f[w];if(!e.isValidElementType(E)){var R=$(E);return new v("Invalid "+j+" `"+S+"` of type "+("`"+R+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return y(l)}function A(l){function f(w,k,j,S,E){if(!(w[k]instanceof l)){var R=l.name||b,T=He(w[k]);return new v("Invalid "+S+" `"+E+"` of type "+("`"+T+"` supplied to `"+j+"`, expected ")+("instance of `"+R+"`."))}return null}return y(f)}function W(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&(arguments.length>1?c("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])."):c("Invalid argument supplied to oneOf, expected an array.")),u;function f(w,k,j,S,E){for(var R=w[k],T=0;T<l.length;T++)if(O(R,l[T]))return null;var I=JSON.stringify(l,function(M,_){var J=V(_);return J==="symbol"?String(_):_});return new v("Invalid "+S+" `"+E+"` of value `"+String(R)+"` "+("supplied to `"+j+"`, expected one of "+I+"."))}return y(f)}function F(l){function f(w,k,j,S,E){if(typeof l!="function")return new v("Property `"+E+"` of component `"+j+"` has invalid PropType notation inside objectOf.");var R=w[k],T=$(R);if(T!=="object")return new v("Invalid "+S+" `"+E+"` of type "+("`"+T+"` supplied to `"+j+"`, expected an object."));for(var I in R)if(i(R,I)){var C=l(R,I,j,S,E+"."+I,n);if(C instanceof Error)return C}return null}return y(f)}function Pe(l){if(!Array.isArray(l))return process.env.NODE_ENV!=="production"&&c("Invalid argument supplied to oneOfType, expected an instance of array."),u;for(var f=0;f<l.length;f++){var w=l[f];if(typeof w!="function")return c("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Fe(w)+" at index "+f+"."),u}function k(j,S,E,R,T){for(var I=[],C=0;C<l.length;C++){var M=l[C],_=M(j,S,E,R,T,n);if(_==null)return null;_.data&&i(_.data,"expectedType")&&I.push(_.data.expectedType)}var J=I.length>0?", expected one of type ["+I.join(", ")+"]":"";return new v("Invalid "+R+" `"+T+"` supplied to "+("`"+E+"`"+J+"."))}return y(k)}function Me(){function l(f,w,k,j,S){return X(f[w])?null:new v("Invalid "+j+" `"+S+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return y(l)}function he(l,f,w,k,j){return new v((l||"React class")+": "+f+" type `"+w+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+j+"`.")}function Le(l){function f(w,k,j,S,E){var R=w[k],T=$(R);if(T!=="object")return new v("Invalid "+S+" `"+E+"` of type `"+T+"` "+("supplied to `"+j+"`, expected `object`."));for(var I in l){var C=l[I];if(typeof C!="function")return he(j,S,E,I,V(C));var M=C(R,I,j,S,E+"."+I,n);if(M)return M}return null}return y(f)}function Ne(l){function f(w,k,j,S,E){var R=w[k],T=$(R);if(T!=="object")return new v("Invalid "+S+" `"+E+"` of type `"+T+"` "+("supplied to `"+j+"`, expected `object`."));var I=t({},w[k],l);for(var C in I){var M=l[C];if(i(l,C)&&typeof M!="function")return he(j,S,E,C,V(M));if(!M)return new v("Invalid "+S+" `"+E+"` key `"+C+"` supplied to `"+j+"`.\nBad object: "+JSON.stringify(w[k],null," ")+`
56
- Valid keys: `+JSON.stringify(Object.keys(l),null," "));var _=M(R,C,j,S,E+"."+C,n);if(_)return _}return null}return y(f)}function X(l){switch(typeof l){case"number":case"string":case"undefined":return!0;case"boolean":return!l;case"object":if(Array.isArray(l))return l.every(X);if(l===null||r(l))return!0;var f=g(l);if(f){var w=f.call(l),k;if(f!==l.entries){for(;!(k=w.next()).done;)if(!X(k.value))return!1}else for(;!(k=w.next()).done;){var j=k.value;if(j&&!X(j[1]))return!1}}else return!1;return!0;default:return!1}}function We(l,f){return l==="symbol"?!0:f?f["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&f instanceof Symbol:!1}function $(l){var f=typeof l;return Array.isArray(l)?"array":l instanceof RegExp?"object":We(f,l)?"symbol":f}function V(l){if(typeof l>"u"||l===null)return""+l;var f=$(l);if(f==="object"){if(l instanceof Date)return"date";if(l instanceof RegExp)return"regexp"}return f}function Fe(l){var f=V(l);switch(f){case"array":case"object":return"an "+f;case"boolean":case"date":case"regexp":return"a "+f;default:return f}}function He(l){return!l.constructor||!l.constructor.name?b:l.constructor.name}return D.checkPropTypes=a,D.resetWarningCache=a.resetWarningCache,D.PropTypes=D,D},le}var ce,we;function ut(){if(we)return ce;we=1;var e=fe();function t(){}function n(){}return n.resetWarningCache=t,ce=function(){function i(u,r,d,x,h,g){if(g!==e){var b=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 b.name="Invariant Violation",b}}i.isRequired=i;function a(){return i}var c={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:a,element:i,elementType:i,instanceOf:a,node:i,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:n,resetWarningCache:t};return c.PropTypes=c,c},ce}var Ht=te.exports;if(process.env.NODE_ENV!=="production"){var pt=G.reactIsExports,ft=!0;te.exports=dt()(pt.isElement,ft)}else te.exports=ut()();var xt=te.exports;const q=ze.getDefaultExportFromCjs(xt);let Ie,Be;typeof document<"u"&&(Ie=document);typeof window<"u"&&(Be=window);const De=m.createContext({document:Ie,window:Be}),se=()=>m.useContext(De),{Provider:ht,Consumer:$t}=De;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:q.element.isRequired,contentDidMount:q.func.isRequired,contentDidUpdate:q.func.isRequired});class ue extends m.Component{constructor(n,i){super(n,i);z(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:i}=this.props;typeof i=="function"?i(n):i&&(i.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 i=this.props.contentDidMount,a=this.props.contentDidUpdate,c=n.defaultView||n.parentView,u=s.jsxRuntimeExports.jsx(Ae,{contentDidMount:i,contentDidUpdate:a,children:s.jsxRuntimeExports.jsx(ht,{value:{document:n,window:c},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),r=this.getMountTarget();return[ge.createPortal(this.props.head,this.getDoc().head),ge.createPortal(u,r)]}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(ue,"propTypes",{style:q.object,head:q.node,initialContent:q.string,mountTarget:q.string,contentDidMount:q.func,contentDidUpdate:q.func,children:q.oneOfType([q.element,q.arrayOf(q.element)])}),z(ue,"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 gt=m.forwardRef((e,t)=>s.jsxRuntimeExports.jsx(ue,{...e,forwardedRef:t}));let U=null,Q=[],Z=null,_e=null;function mt(e){const t=window.getComputedStyle(e),n=parseInt(t.paddingLeft,10),i=parseInt(t.paddingTop,10),a=parseInt(t.paddingRight,10),c=parseInt(t.paddingBottom,10);return{paddingLeft:n,paddingTop:i,paddingRight:a,paddingBottom:c}}const Se=(e,t,n)=>{if(!U)return;const i=e.getBoundingClientRect(),a=U==null?void 0:U.getElementById("placeholder"),{paddingLeft:c,paddingTop:u,paddingRight:r,paddingBottom:d}=mt(e);a.style.width=t==="vertical"?i.width-c-r+"px":"2px",a.style.height=t==="vertical"?"2px":i.height-u-d+"px",a.style.display="block";const x=Q.reduce((h,g)=>Math.abs(g-n)<Math.abs(h-n)?g:h);_e=Q.indexOf(x),t==="vertical"?(a.style.top=e.offsetTop+x+"px",a.style.left=e.offsetLeft+c+"px"):(a.style.top=e.offsetTop+u+"px",a.style.left=e.offsetLeft+x+"px")},yt=e=>{const t=Oe(e),n=window.getComputedStyle(e),i=t==="horizontal",a=parseInt(n.paddingLeft),c=parseInt(n.paddingTop);let u=i?a:c;Q=[u],Array.from(e.children).forEach(r=>{const d=window.getComputedStyle(r),x=parseInt(i?d.marginLeft+d.marginRight:d.marginTop+d.marginBottom),h=i?r.offsetWidth:r.offsetHeight;Q.push(u+h+x),u+=h+x})};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 i=window.getComputedStyle(e).gridTemplateRows,a=window.getComputedStyle(e).gridTemplateColumns;if(i.includes("auto"))return"vertical";if(a.includes("auto"))return"horizontal"}return t==="block"?"vertical":"horizontal"}const vt=p.throttle(e=>{const t=e.target,n=Oe(t);if(n==="vertical"){const i=e.clientY-t.offsetTop;Se(t,n,i)}else{const i=e.clientX-t.offsetLeft;Se(t,n,i)}},200),jt=e=>{e.preventDefault(),e.stopPropagation(),vt(e)};function de(){const e=U==null?void 0:U.getElementById("placeholder");e.style.display="none"}const bt=()=>{const{document:e}=se(),[t,n]=L.useAtom(o.draggingFlagAtom),i=Ke.useAddBlockByDrop(),a=Te.useFeature("dnd"),[,c]=o.useHighlightBlockId(),[,u]=o.useSelectedBlockIds();return U=e,{isDragging:t,"data-dnd":"branch",onDragOver:a?jt:p.noop,onDrop:a?r=>{Z==null||Z.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2");const d=JSON.parse(r.dataTransfer.getData("text/plain"));let x=r.target.getAttribute("data-block-id");x===null&&(x=r.target.parentElement.getAttribute("data-block-id")),i({block:d,dropTargetId:x||null,relativeIndex:_e}),n(!1),de(),setTimeout(()=>{de()},300)}:p.noop,onDragEnter:a?r=>{const d=r;Z=d.target,d.stopPropagation(),d.preventDefault(),Q=[];const x=d.target;yt(x),x.classList.add("outline","outline-green-300","outline-2","-outline-offset-2"),n(!0),c(""),u([])}:p.noop,onDragLeave:a?r=>{const d=r;Z=null,d.stopPropagation(),d.preventDefault(),d.target.classList.remove("outline","outline-green-300","outline-2","-outline-offset-2")}:p.noop,onMouseOut:a?()=>{n(!1),de()}:p.noop}};function xe(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function Et(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const kt=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,n]=o.useHighlightBlockId(),[i,a]=L.useAtom(o.inlineEditingActiveAtom);return c=>{var g;if(i)return;const u=xe(c.target),r=u.getAttribute("data-block-type");if(!r||!e.includes(r))return;const d=u.cloneNode(!0);u.style.display="none",Array.from(d.attributes).forEach(b=>{b.name!=="class"&&d.removeAttribute(b.name)}),r==="Text"&&(d.style.display="inline-block"),u.parentNode.insertBefore(d,u.nextSibling);const x=new Ye.Quill(d,{placeholder:"Type here..."});function h(){const b=x.getText(0,x.getLength());t([u.getAttribute("data-block-id")],{content:b}),u.removeAttribute("style"),d.removeEventListener("blur",h,!0),Et(x),a(""),n("")}d.addEventListener("blur",h,!0),x.focus(),(g=d.querySelector(".ql-clipboard"))==null||g.remove(),a(u.getAttribute("data-block-id"))}},Rt=()=>{const[,e]=o.useSelectedStylingBlocks(),[,t]=o.useSelectedBlockIds(),[n]=L.useAtom(o.inlineEditingActiveAtom);return i=>{if(n)return;i.stopPropagation();const a=xe(i.target);if(a!=null&&a.getAttribute("data-block-parent")){const c=a.getAttribute("data-style-prop"),u=a.getAttribute("data-style-id"),r=a.getAttribute("data-block-parent");e([{id:u,prop:c,blockId:r}]),t([r])}else a!=null&&a.getAttribute("data-block-id")&&t([a.getAttribute("data-block-id")])}},wt=p.throttle((e,t)=>{const n=xe(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),St=()=>{const[,e]=o.useHighlightBlockId(),[t]=L.useAtom(o.inlineEditingActiveAtom);return n=>{t||wt(n,e)}},Tt=({children:e})=>{const{document:t}=se(),[n]=o.useSelectedBlockIds(),[i,a]=o.useSelectedStylingBlocks();m.useEffect(()=>{setTimeout(()=>{if(!p.isEmpty(i))return;const x=qe(t,p.first(n));if(x){const h=x.getAttribute("data-style-prop");if(h){const g=x.getAttribute("data-style-id"),b=x.getAttribute("data-block-parent");a([{id:g,prop:h,blockId:b}])}}},100)},[t,n,a,i]);const c=kt(),u=Rt(),r=St(),d=bt();return s.jsxRuntimeExports.jsx("div",{"data-block-id":"container",id:"canvas",onClick:u,onDoubleClick:c,onMouseMove:r,...p.omit(d,"isDragging"),className:"relative mb-5 h-full max-w-full "+(d.isDragging?"dragging":""),children:e})},qe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),Ct=()=>{const{window:e}=se(),[t,n]=o.useSelectedBlockIds(),[i]=o.useBlocksStore(),[,a]=o.useSelectedStylingBlocks(),{undo:c,redo:u}=o.useUndoManager(),r=o.useDuplicateBlocks(),[,d]=o.usePreviewMode(),x=o.useRemoveBlocks(),{savePage:h}=o.useSavePage(),[g]=L.useAtom(o.inlineEditingActiveAtom),[,b]=L.useAtom(o.editLayerNameAtom),D=v=>{v.key==="Enter"&&(v.preventDefault(),t.length===1&&b(p.first(t)))},O=v=>{const y=i.find(B=>B._id===v);return y?y._parent:null};return m.useEffect(()=>{const v=y=>{if(y.key==="Escape"){n([]),a([]);return}if(D(y),!g&&(y.key==="Delete"||y.key==="Backspace")&&(y.preventDefault(),x(t)),y.ctrlKey||y.metaKey){if(y.key==="ArrowUp"){y.preventDefault();const B=t.length>0?O(t[0]):null;B&&n([B])}if(["z","y","d","x","c","p","s","v"].includes(y.key)){if(g&&["x","z","v"].includes(y.key))return!0;y.preventDefault()}y.key==="s"&&(y.stopPropagation(),y.preventDefault(),h()),y.key==="z"&&c(),y.key==="y"&&u(),y.key==="d"&&r(t)}};return e.removeEventListener("keydown",v),e.addEventListener("keydown",v),()=>{e.removeEventListener("keydown",v)}},[t,n,c,x,d,u,r,g,h,e]),null},It=({block:e,label:t})=>{const[,n]=o.useSelectedBlockIds(),[,i]=o.useHighlightBlockId(),[,a]=L.useAtom(o.draggedBlockIdAtom),c=Te.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:c?"true":"false",onDragStart:u=>{u.dataTransfer.setData("text/plain",JSON.stringify(p.pick(e,["_id","_type"]))),a(e._id),setTimeout(()=>{n([]),i(null)},200)},children:[s.jsxRuntimeExports.jsx(P.DragHandleDots2Icon,{}),t]})},Bt=({selectedBlockElement:e,block:t})=>{const n=o.useRemoveBlocks(),i=o.useDuplicateBlocks(),[,a]=o.useSelectedBlockIds(),[,c]=o.useSelectedStylingBlocks(),[u]=L.useAtom(o.inlineEditingActiveAtom),{floatingStyles:r,refs:d,update:x}=me.useFloating({placement:"top-start",middleware:[me.shift(),Je.flip()],elements:{reference:e}});Ve.useResizeObserver(e,()=>x(),e!==null);const h=p.get(t,"_parent",null),g=p.isEmpty(p.get(t,"_name",""))?p.get(t,"_type",""):p.get(t,"_name","");return!e||!t||u?null:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:d.setFloating,style:r,onClick:b=>{b.stopPropagation(),b.preventDefault()},onKeyDown:b=>b.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(It,{label:g,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[h&&s.jsxRuntimeExports.jsx(P.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{c([]),a([h])}}),o.canDuplicateBlock(p.get(t,"_type",""))?s.jsxRuntimeExports.jsx(P.CopyIcon,{className:"hover:scale-105",onClick:()=>i([t==null?void 0:t._id])}):null,o.canDeleteBlock(p.get(t,"_type",""))?s.jsxRuntimeExports.jsx(P.TrashIcon,{className:"hover:scale-105",onClick:()=>n([t==null?void 0:t._id])}):null]})]})},Dt=({model:e})=>{const[t]=o.useBrandingOptions(),[n]=o.useSelectedBlockIds(),[i]=o.useDarkMode(),[a]=o.useHighlightBlockId(),[c]=o.useSelectedStylingBlocks(),[u]=L.useAtom(o.draggedBlockIdAtom),{document:r,window:d}=se(),[x]=m.useState(r==null?void 0:r.getElementById("highlighted-block")),[h]=m.useState(r==null?void 0:r.getElementById("selected-block")),[g]=m.useState(r==null?void 0:r.getElementById("selected-styling-block")),[b]=m.useState(r==null?void 0:r.getElementById("dragged-block"));m.useEffect(()=>{i?r==null||r.documentElement.classList.add("dark"):r==null||r.documentElement.classList.remove("dark")},[i,r]);const D=p.get(t,"headingFont","DM Sans"),O=p.get(t,"bodyFont","DM Sans");return m.useEffect(()=>{const v=p.get(t,"primaryColor","#000"),y=p.get(t,"secondaryColor","#FFF"),B=Ze.tailwindcssPaletteGenerator({colors:[v,y],names:["primary","secondary"]});B.primary.DEFAULT=v,B.secondary.DEFAULT=y;const H=p.get(t,"roundedCorners","0");!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{fontFamily:{heading:[D],body:[O]},extend:{borderRadius:{global:`${H||"0"}px`},colors:B}},plugins:[d.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,d,D,O]),m.useEffect(()=>{h&&(h.textContent=`${p.map(n,v=>`[data-block-id="${v}"]`).join(",")}{
57
- outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
58
- }`)},[n,h]),m.useEffect(()=>{if(!u){b.textContent="";return}b.textContent=`[data-block-id="${u}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[u]),m.useEffect(()=>{x&&(x.textContent=a?`[data-style-id="${a}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[a,n,x]),m.useEffect(()=>{g&&(g.textContent=`${p.map(c,({id:v})=>`[data-style-id="${v}"]`).join(",")}{
59
- outline: 1px solid #42a1fc !important; outline-offset: -1px;
60
- }`)},[c,g]),m.useEffect(()=>{const v=p.get(t,"bodyTextLightColor","#64748b"),y=p.get(t,"bodyTextDarkColor","#94a3b8"),B=p.get(t,"bodyBgLightColor","#FFFFFF"),H=p.get(t,"bodyBgDarkColor","#0f172a");r.body.className=`font-body antialiased text-[${v}] bg-[${B}] dark:text-[${y}] dark:bg-[${H}]`},[t,r,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[D&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${D.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),O&&D!==O&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${O.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),D&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${D}",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=>{p.isString(e[n])&&e[n].startsWith(ee.SLOT_KEY)&&(t[n]=e[n].replace(ee.SLOT_KEY,"").split(","))}),t},_t=p.memoize(e=>{const t=e.replace(ee.STYLES_KEY,"").split(",");return Ge.twMerge(t[0],t[1])});function Ot(e,t){return p.get(e,`${t}_attrs`,{})}function qt(e){const t={};return Object.keys(e).forEach(n=>{if(p.isString(e[n])&&e[n].startsWith(ee.STYLES_KEY)){const i=_t(e[n]);t[n]={className:i,"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=p.get(e,"_bindings",{});return p.isEmpty(n)?{...e}:(p.each(n,(i,a)=>{p.isString(i)&&p.get(t,i,null)&&(e[a]=p.get(t,i,null))}),e)}function pe({blocks:e}){const[t]=o.useBlocksStore(),n=m.useCallback(c=>qt(c),[]),[i]=G.useChaiExternalData(),[a]=L.useAtom(o.inlineEditingActiveAtom);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:m.Children.toArray(e.map((c,u)=>{if(a===c._id)return null;const r=At(c),d={};p.isEmpty(r)||Object.keys(r).forEach(b=>{d[b]=m.Children.toArray(r[b].map(D=>s.jsxRuntimeExports.jsx(pe,{blocks:[p.find(t,{_id:D})]})))});const x=p.filter(t,{_parent:c._id});d.children=x.length?s.jsxRuntimeExports.jsx(pe,{blocks:x}):null;const h=Xe.getBlockComponent(c._type),g=p.get(h,"builderComponent",p.get(h,"component",null));return p.isNull(g)?s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${c==null?void 0:c._type} not registered -->`}):s.jsxRuntimeExports.jsx(m.Suspense,{children:m.createElement(g,{blockProps:{"data-block-id":c._id,"data-block-type":c._type,"data-dnd":p.has(h,"canAcceptBlock")?"branch":"leaf"},inBuilder:!0,index:u,...Pt(c,i),...n(c),...d})})}))})}const Mt=()=>{const[e]=o.useBlocksStore(),t=p.isEmpty(e)?null:s.jsxRuntimeExports.jsx(G.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(pe,{blocks:p.filter(e,n=>p.isEmpty(n._parent))})});return s.jsxRuntimeExports.jsx(Qe.Provider,{children:t})},Lt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),Nt=()=>{const[e]=L.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[n]=o.useCanvasWidth(),[,i]=o.useSelectedBlockIds(),a=o.useSelectedBlock(),[,c]=o.useHighlightBlockId(),u=m.useRef(null),r=m.useRef(null),[d,x]=m.useState({width:0,height:0}),h=at(d),[g,b]=m.useState(0),[D,O]=m.useState([]),[,v]=m.useState([]),[,y]=L.useAtom(o.canvasIframeAtom),[B,H]=o.useSelectedStylingBlocks(),Y=o.useBuilderProp("loading",!1);m.useEffect(()=>{const{clientWidth:A,clientHeight:W}=r.current;x({width:A,height:W}),g===0&&b(A)},[r,n,g]);const K=(A,W=0)=>{const{top:F}=A.getBoundingClientRect();return F+W>=0&&F-W<=window.innerHeight};m.useEffect(()=>{var A,W;if(a&&a.type!=="Multiple"&&u.current){const F=qe(u.current.contentDocument,a._id);F&&(K(F)||(W=(A=u.current)==null?void 0:A.contentWindow)==null||W.scrollTo({top:F.offsetTop,behavior:"smooth"}),O([F]))}},[a]),m.useEffect(()=>{if(!p.isEmpty(B)&&u.current){const A=Lt(u.current.contentDocument,p.first(B).id);v(A?[A]:[null])}else v([null])},[B]);const N=m.useMemo(()=>{let A=it;return e==="offline"&&(A=A.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),A=A.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),A=A.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),A},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{i([]),H([])},onMouseLeave:()=>setTimeout(()=>c(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:g>0&&!p.isEmpty(h)?{width:t?"100%":g}:{},ref:r,children:s.jsxRuntimeExports.jsxs(gt,{contentDidMount:()=>y(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(Bt,{block:a,selectedBlockElement:p.first(D)}),s.jsxRuntimeExports.jsx(Dt,{model:"page"}),s.jsxRuntimeExports.jsx(Tt,{children:Y?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(Mt,{})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},Wt=()=>s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(ot,{}),s.jsxRuntimeExports.jsx("div",{className:"relative h-full overflow-hidden bg-slate-800/90 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px] px-2",children:s.jsxRuntimeExports.jsx(m.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(G.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(Nt,{})})})})]});exports.default=Wt;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),t=require("./index-T3wfa1kz.cjs"),i=require("lodash-es"),h=require("sonner"),l=require("react"),o=require("./index-3TQsdso6.cjs"),j=require("lucide-react");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");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("react-i18next");require("./index-ZwpjuB-N.cjs");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("./html-to-json-FGufPv9R.cjs");require("himalaya");require("./index-ecnGWzh9.cjs");const p=()=>{const{data:s}=o.useProject(),{data:u,isLoading:x}=o.usePages(),{syncState:d}=t.useSavePage(),q=o.useChangePage(),[n,a]=o.useCurrentPage(),c=i.sortBy(i.filter(u,{type:"STATIC"}),r=>i.get(r,"uuid")===(s==null?void 0:s.homepage)?0:1);l.useEffect(()=>{!i.isEmpty(u)&&s.homepage&&!i.find(u,{uuid:n})&&a(s.homepage)},[n,u,s,a]),l.useEffect(()=>()=>a(null),[a]);const m=r=>{if(d!=="SAVED")h.toast.error("You have unsaved changes. Please save before changing the page.");else{const g=i.find(c,{uuid:r});q(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(s.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(t.Select,{value:n||"",onValueChange:m,children:[e.jsxRuntimeExports.jsx(t.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(t.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(t.SelectContent,{className:"z-[999]",children:i.map(c,r=>e.jsxRuntimeExports.jsx(t.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
@@ -1,355 +0,0 @@
1
- import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import { nth as k, startsWith as _, map as C, isUndefined as H, find as A, isEmpty as L, includes as P } from "lodash-es";
3
- import { BoxModelIcon as V, BoxIcon as F, DragHandleHorizontalIcon as z, ViewHorizontalIcon as $, BorderAllIcon as q, BorderTopIcon as K, TableIcon as U, DropdownMenuIcon as Y, RadiobuttonIcon as Q, InputIcon as G, ButtonIcon as v, CheckboxIcon as W, GroupIcon as X, SpaceBetweenVerticallyIcon as J, ColumnsIcon as Z, RowsIcon as B, TextIcon as w, SketchLogoIcon as ee, DividerHorizontalIcon as te, CodeIcon as se, CursorTextIcon as re, VideoIcon as ne, Link1Icon as oe, HeadingIcon as ae, ImageIcon as ce, TriangleRightIcon as ie, TrashIcon as le, CopyIcon as xe, DoubleArrowDownIcon as de, StackIcon as me } from "@radix-ui/react-icons";
4
- import { useDrop as ue, useDragLayer as pe } from "react-dnd";
5
- import { useDragOver as ge, Tree as he } from "@minoru/react-dnd-treeview";
6
- import { useTranslation as je } from "react-i18next";
7
- import { Y as be, X as Ie, h as fe, ap as ye, aq as ke, ar as ve, r as f, s as Be, a1 as T, bq as D, aS as we, t as Ce, br as Te, aR as De, bs as Se, bt as Ne, E as Oe, aM as Re, ac as Me, bu as Ee, bg as _e, bv as He } from "./index-ZBqiaKhx.js";
8
- import { DatabaseIcon as Ae } from "lucide-react";
9
- import { useMemo as Le, useCallback as Pe } from "react";
10
- import { a as Ve } from "./MODIFIERS-WQdaNvb8.js";
11
- import { c as S } from "./Functions-7jnEwJyw.js";
12
- import { a as Fe } from "./index-LF3KXx4u.js";
13
- import { u as ze } from "./useAddBlockByDrop-sPX4lN-O.js";
14
- import "./_commonjsHelpers-UyOWmZb0.js";
15
- import "@chaibuilder/runtime";
16
- import "jotai";
17
- import "flat-to-nested";
18
- import "@react-hookz/web";
19
- import "@radix-ui/react-toggle";
20
- import "class-variance-authority";
21
- import "./Class-3k8xjeiM.js";
22
- import "clsx";
23
- import "tailwind-merge";
24
- import "@radix-ui/react-switch";
25
- import "@radix-ui/react-slot";
26
- import "@radix-ui/react-accordion";
27
- import "@radix-ui/react-alert-dialog";
28
- import "@radix-ui/react-dialog";
29
- import "@radix-ui/react-label";
30
- import "@radix-ui/react-scroll-area";
31
- import "@radix-ui/react-tabs";
32
- import "@radix-ui/react-tooltip";
33
- import "@radix-ui/react-popover";
34
- import "@radix-ui/react-menubar";
35
- import "@radix-ui/react-hover-card";
36
- import "@radix-ui/react-select";
37
- import "@radix-ui/react-dropdown-menu";
38
- import "@radix-ui/react-separator";
39
- import "@radix-ui/react-toast";
40
- import "cmdk";
41
- import "@radix-ui/react-context-menu";
42
- import "react-icons-picker";
43
- import "react-dom";
44
- import "react-quill";
45
- import "i18next";
46
- import "@floating-ui/react-dom";
47
- import "react-textarea-autosize";
48
- import "flagged";
49
- import "react-hotkeys-hook";
50
- const N = (t) => {
51
- switch (t.type) {
52
- case "Image":
53
- return /* @__PURE__ */ e.jsx(ce, {});
54
- case "Heading":
55
- return /* @__PURE__ */ e.jsx(ae, {});
56
- case "Text":
57
- return /* @__PURE__ */ e.jsx(w, {});
58
- case "Link":
59
- return /* @__PURE__ */ e.jsx(oe, {});
60
- case "Video":
61
- return /* @__PURE__ */ e.jsx(ne, {});
62
- case "RichText":
63
- return /* @__PURE__ */ e.jsx(re, {});
64
- case "Button":
65
- return /* @__PURE__ */ e.jsx(v, {});
66
- case "CustomHTML":
67
- return /* @__PURE__ */ e.jsx(se, {});
68
- case "Divider":
69
- return /* @__PURE__ */ e.jsx(te, {});
70
- case "Icon":
71
- return /* @__PURE__ */ e.jsx(ee, {});
72
- case "List":
73
- return /* @__PURE__ */ e.jsx(B, {});
74
- case "Paragraph":
75
- return /* @__PURE__ */ e.jsx(w, {});
76
- case "Row":
77
- return /* @__PURE__ */ e.jsx(B, {});
78
- case "ListItem":
79
- return /* @__PURE__ */ e.jsx(Z, {});
80
- case "LineBreak":
81
- return /* @__PURE__ */ e.jsx(J, {});
82
- case "Form":
83
- return /* @__PURE__ */ e.jsx(X, {});
84
- case "Checkbox":
85
- return /* @__PURE__ */ e.jsx(W, {});
86
- case "FormButton":
87
- return /* @__PURE__ */ e.jsx(v, {});
88
- case "Input":
89
- case "TextArea":
90
- return /* @__PURE__ */ e.jsx(G, {});
91
- case "Radio":
92
- return /* @__PURE__ */ e.jsx(Q, {});
93
- case "Select":
94
- return /* @__PURE__ */ e.jsx(Y, {});
95
- case "Table":
96
- return /* @__PURE__ */ e.jsx(U, {});
97
- case "TableHead":
98
- return /* @__PURE__ */ e.jsx(K, {});
99
- case "TableBody":
100
- return /* @__PURE__ */ e.jsx(q, {});
101
- case "TableRow":
102
- return /* @__PURE__ */ e.jsx($, {});
103
- case "TableCell":
104
- return /* @__PURE__ */ e.jsx(z, {});
105
- case "DataProvider":
106
- return /* @__PURE__ */ e.jsx(Ae, { size: 16 });
107
- case "Box":
108
- return /* @__PURE__ */ e.jsx(F, {});
109
- default:
110
- return /* @__PURE__ */ e.jsx(V, {});
111
- }
112
- };
113
- function $e(t = "") {
114
- const s = {
115
- xs: "390px",
116
- sm: "640px",
117
- md: "768px",
118
- lg: "1024px",
119
- xl: "1366px",
120
- "2xl": "1536px"
121
- };
122
- if (new RegExp(/\bsr-only\b/).test(t))
123
- return "Sr Only";
124
- if (new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(t))
125
- return "Visible on mobile";
126
- if (t.match(/(^| )hidden( |$)/g)) {
127
- const i = new RegExp(
128
- // checks if any of the display property is set for any higher media query
129
- /\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/
130
- ), o = t.match(i);
131
- if (k(o, 1))
132
- return `Visible >=${s[k(o, 1)]}`;
133
- }
134
- return "";
135
- }
136
- const qe = (t) => {
137
- let s = "";
138
- return Object.keys(t).forEach((n) => {
139
- _(t[n], Ve) && (s = t[n]);
140
- }), s;
141
- }, Ke = (t) => {
142
- var u;
143
- const [, s] = be(), [n] = Ie(), c = fe("outlineMenuItems", []), { isSelected: i } = t, { id: o, data: l } = t.node, p = t.depth * 10, d = (a) => {
144
- a.stopPropagation(), t.onToggle(t.node.id);
145
- }, g = ge(o, t.isOpen, t.onToggle), m = Le(() => {
146
- const a = qe(t.node.data);
147
- return $e(a);
148
- }, [t.node.data]);
149
- return (
150
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
151
- /* @__PURE__ */ e.jsx(
152
- "div",
153
- {
154
- onMouseEnter: () => s(o),
155
- className: S(
156
- "group flex w-full items-center justify-between space-x-px py-px",
157
- i ? "bg-blue-500 text-white" : "text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800"
158
- ),
159
- onClick: (a) => {
160
- a.stopPropagation(), !n.includes(o) && t.onSelect(o);
161
- },
162
- onContextMenu: () => t.onSelect(o),
163
- style: { paddingInlineStart: p },
164
- ...g,
165
- children: /* @__PURE__ */ e.jsxs("div", { className: "flex w-full items-center justify-between pr-2", children: [
166
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
167
- /* @__PURE__ */ e.jsx(
168
- "div",
169
- {
170
- className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${t.isOpen ? "rotate-90" : ""}`,
171
- children: t.node.droppable && /* @__PURE__ */ e.jsx("button", { onClick: d, type: "button", children: /* @__PURE__ */ e.jsx(ie, {}) })
172
- }
173
- ),
174
- /* @__PURE__ */ e.jsxs("button", { type: "button", className: "flex items-center", children: [
175
- /* @__PURE__ */ e.jsx("div", { className: "-mt-1 h-3 w-3", children: /* @__PURE__ */ e.jsx(N, { type: l == null ? void 0 : l._type }) }),
176
- /* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: ((u = t.node.data) == null ? void 0 : u._name) || t.node.text }),
177
- m ? /* @__PURE__ */ e.jsxs(
178
- "span",
179
- {
180
- className: "ml-2 flex items-center text-[10px] italic " + (i ? "text-gray-200" : "text-gray-500"),
181
- children: [
182
- "(",
183
- m,
184
- ")"
185
- ]
186
- }
187
- ) : null
188
- ] })
189
- ] }),
190
- /* @__PURE__ */ e.jsx("div", { className: "invisible flex items-center space-x-1 group-hover:visible", children: c.map((a) => /* @__PURE__ */ e.jsxs(ye, { children: [
191
- /* @__PURE__ */ e.jsx(
192
- ke,
193
- {
194
- className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
195
- asChild: !0,
196
- children: a.item(o)
197
- }
198
- ),
199
- /* @__PURE__ */ e.jsx(ve, { children: a.tooltip })
200
- ] })) })
201
- ] })
202
- }
203
- )
204
- );
205
- }, Ue = (t) => {
206
- var n;
207
- const { item: s } = t.monitorProps;
208
- return /* @__PURE__ */ e.jsxs("div", { className: "flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700", children: [
209
- /* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(N, { type: (n = s == null ? void 0 : s.data) == null ? void 0 : n._type }) }),
210
- /* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: s.text })
211
- ] });
212
- }, Ye = (t) => {
213
- const s = t.depth * 10 + 16;
214
- 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 } });
215
- }, Qe = () => {
216
- const [t] = f(), s = Be(), n = T();
217
- return /* @__PURE__ */ e.jsxs(
218
- D,
219
- {
220
- disabled: !we(n == null ? void 0 : n._type),
221
- className: "flex items-center gap-x-4 text-xs",
222
- onClick: () => s(t),
223
- children: [
224
- /* @__PURE__ */ e.jsx(le, {}),
225
- " Remove"
226
- ]
227
- }
228
- );
229
- }, Ge = () => {
230
- const [t] = f(), s = Ce(), n = T(), c = Pe(() => {
231
- s(t);
232
- }, [t, s]);
233
- return /* @__PURE__ */ e.jsxs(Te, { className: "text-xs", children: [
234
- /* @__PURE__ */ e.jsxs(
235
- D,
236
- {
237
- disabled: !De(n == null ? void 0 : n._type),
238
- className: "flex items-center gap-x-4 text-xs",
239
- onClick: c,
240
- children: [
241
- /* @__PURE__ */ e.jsx(xe, {}),
242
- " Duplicate"
243
- ]
244
- }
245
- ),
246
- /* @__PURE__ */ e.jsx(Qe, {})
247
- ] });
248
- }, We = ({ children: t }) => /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
249
- /* @__PURE__ */ e.jsx(Ne, { children: t }),
250
- /* @__PURE__ */ e.jsx(Ge, {})
251
- ] }) });
252
- function Xe(t) {
253
- return C(t, (s) => {
254
- const { data: n } = s;
255
- return {
256
- ...n,
257
- _parent: s.parent === 0 ? null : s.parent
258
- };
259
- });
260
- }
261
- const Yt = () => {
262
- const [t] = Oe(), { setNewBlocks: s } = Re(), [n, c, i] = f(), [, o] = Me(), { t: l } = je(), p = Fe(), d = ze(), [g] = Ee(), m = async (r, x) => {
263
- const { dragSource: j, relativeIndex: b, dropTargetId: I, monitor: y } = x;
264
- if (j) {
265
- const M = Xe(r);
266
- s(M);
267
- const E = y.getItem();
268
- c([E.id]);
269
- } else
270
- await d({ block: y.getItem(), dropTargetId: I, relativeIndex: b });
271
- }, u = C(t, (r) => ({
272
- id: r._id,
273
- text: r._type,
274
- parent: r._parent || 0,
275
- droppable: !H(A(t, { _parent: r._id })),
276
- data: r
277
- })), a = () => {
278
- c([]), o([]);
279
- }, [{ isOver: h }, O] = ue(() => ({
280
- accept: ["CHAI_BLOCK"],
281
- collect: (r) => ({
282
- canDrop: r.canDrop(),
283
- isOver: r.isOver()
284
- }),
285
- drop: (r) => {
286
- (async () => await d({
287
- block: r,
288
- dropTargetId: "",
289
- relativeIndex: 0
290
- }))();
291
- }
292
- })), { isDragging: R } = pe((r) => ({
293
- isDragging: r.isDragging()
294
- }));
295
- return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
296
- "div",
297
- {
298
- onClick: () => a(),
299
- className: S(
300
- "-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",
301
- R ? "bg-green-50/80" : "bg-background"
302
- ),
303
- children: L(t) ? /* @__PURE__ */ e.jsxs(
304
- "div",
305
- {
306
- ref: O,
307
- className: `mx-1 mt-4 h-full max-w-full p-6 text-center text-sm text-gray-400 ${h ? "bg-blue-200" : ""}`,
308
- children: [
309
- h ? /* @__PURE__ */ e.jsx(de, { className: "mx-auto h-12 w-12 animate-bounce" }) : /* @__PURE__ */ e.jsx(me, { className: "mx-auto h-10 w-10" }),
310
- /* @__PURE__ */ e.jsx("p", { className: "mt-2", children: l(h ? "drop_here_message" : "tree_view_no_blocks") })
311
- ]
312
- }
313
- ) : /* @__PURE__ */ e.jsx(_e, { id: "layers-view", className: "no-scrollbar h-full overflow-y-auto p-1", children: /* @__PURE__ */ e.jsx(
314
- he,
315
- {
316
- initialOpen: p,
317
- extraAcceptTypes: ["CHAI_BLOCK"],
318
- tree: u,
319
- rootId: 0,
320
- render: (r, { depth: x, isOpen: j, onToggle: b }) => /* @__PURE__ */ e.jsx(We, { id: r.id, children: /* @__PURE__ */ e.jsx(
321
- Ke,
322
- {
323
- onSelect: (I) => {
324
- o([]), c([I]);
325
- },
326
- isSelected: P(n, r.id),
327
- node: r,
328
- depth: x,
329
- isOpen: j,
330
- onToggle: b,
331
- toggleIds: i
332
- }
333
- ) }),
334
- dragPreviewRender: (r) => /* @__PURE__ */ e.jsx(Ue, { monitorProps: r }),
335
- onDrop: m,
336
- classes: {
337
- root: "h-[90%] " + (g ? "pl-2" : "pt-2"),
338
- draggingSource: "opacity-30",
339
- dropTarget: "bg-green-100",
340
- placeholder: "relative"
341
- },
342
- sort: !1,
343
- insertDroppableFirst: !1,
344
- canDrop: He,
345
- dropTargetOffset: 2,
346
- enableAnimateExpand: !0,
347
- placeholderRender: (r, { depth: x }) => /* @__PURE__ */ e.jsx(Ye, { node: r, depth: x })
348
- }
349
- ) })
350
- }
351
- ) });
352
- };
353
- export {
354
- Yt as default
355
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("lodash-es"),s=require("@radix-ui/react-icons"),y=require("react-dnd"),k=require("@minoru/react-dnd-treeview"),N=require("react-i18next"),r=require("./index-T3wfa1kz.cjs"),O=require("lucide-react"),B=require("react"),M=require("./MODIFIERS-9EwxLM8V.cjs"),v=require("./Functions-N3yhPYKY.cjs"),_=require("./index-ZwpjuB-N.cjs"),A=require("./useAddBlockByDrop-E343zoB3.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.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("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-hotkeys-hook");const w=t=>{switch(t.type){case"Image":return e.jsxRuntimeExports.jsx(s.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(s.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(s.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(s.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(s.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(s.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(s.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(s.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(s.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(s.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(s.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(s.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(s.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(s.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(s.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(s.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(s.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(s.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(s.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(s.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(s.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(s.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(s.DragHandleHorizontalIcon,{});case"DataProvider":return e.jsxRuntimeExports.jsx(O.DatabaseIcon,{size:16});case"Box":return e.jsxRuntimeExports.jsx(s.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(s.BoxModelIcon,{})}};function H(t=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(t))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(t))return"Visible on mobile";if(t.match(/(^| )hidden( |$)/g)){const a=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),x=t.match(a);if(u.nth(x,1))return`Visible >=${n[u.nth(x,1)]}`}return""}const L=t=>{let n="";return Object.keys(t).forEach(i=>{u.startsWith(t[i],M.STYLES_KEY)&&(n=t[i])}),n},P=t=>{var g;const[,n]=r.useHighlightBlockId(),[i]=r.useHiddenBlockIds(),l=r.useBuilderProp("outlineMenuItems",[]),{isSelected:a}=t,{id:x,data:d}=t.node,R=t.depth*10,p=c=>{c.stopPropagation(),t.onToggle(t.node.id)},E=k.useDragOver(x,t.isOpen,t.onToggle),j=B.useMemo(()=>{const c=L(t.node.data);return H(c)},[t.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(x),className:v.cn("group flex w-full items-center justify-between space-x-px py-px",a?"bg-blue-500 text-white":"text-gray-600 hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:c=>{c.stopPropagation(),!i.includes(x)&&t.onSelect(x)},onContextMenu:()=>t.onSelect(x),style:{paddingInlineStart:R},...E,children:e.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-between pr-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${t.isOpen?"rotate-90":""}`,children:t.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:p,type:"button",children:e.jsxRuntimeExports.jsx(s.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(w,{type:d==null?void 0:d._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((g=t.node.data)==null?void 0:g._name)||t.node.text}),j?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(a?"text-gray-200":"text-gray-500"),children:["(",j,")"]}):null]})]}),e.jsxRuntimeExports.jsx("div",{className:"invisible flex items-center space-x-1 group-hover:visible",children:l.map(c=>e.jsxRuntimeExports.jsxs(r.Tooltip,{children:[e.jsxRuntimeExports.jsx(r.TooltipTrigger,{className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",asChild:!0,children:c.item(x)}),e.jsxRuntimeExports.jsx(r.TooltipContent,{children:c.tooltip})]}))})]})})},F=t=>{var i;const{item:n}=t.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(w,{type:(i=n==null?void 0:n.data)==null?void 0:i._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},V=t=>{const n=t.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},z=()=>{const[t]=r.useSelectedBlockIds(),n=r.useRemoveBlocks(),i=r.useSelectedBlock();return e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:!r.canDeleteBlock(i==null?void 0:i._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>n(t),children:[e.jsxRuntimeExports.jsx(s.TrashIcon,{})," Remove"]})},$=()=>{const[t]=r.useSelectedBlockIds(),n=r.useDuplicateBlocks(),i=r.useSelectedBlock(),l=B.useCallback(()=>{n(t)},[t,n]);return e.jsxRuntimeExports.jsxs(r.ContextMenuContent,{className:"text-xs",children:[e.jsxRuntimeExports.jsxs(r.ContextMenuItem,{disabled:!r.canDuplicateBlock(i==null?void 0:i._type),className:"flex items-center gap-x-4 text-xs",onClick:l,children:[e.jsxRuntimeExports.jsx(s.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(z,{})]})},K=({children:t})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(r.ContextMenu,{children:[e.jsxRuntimeExports.jsx(r.ContextMenuTrigger,{children:t}),e.jsxRuntimeExports.jsx($,{})]})});function U(t){return u.map(t,n=>{const{data:i}=n;return{...i,_parent:n.parent===0?null:n.parent}})}const Q=()=>{const[t]=r.useBlocksStore(),{setNewBlocks:n}=r.useBlocksStoreUndoableActions(),[i,l,a]=r.useSelectedBlockIds(),[,x]=r.useSelectedStylingBlocks(),{t:d}=N.useTranslation(),R=_.useExpandedIds(),p=A.useAddBlockByDrop(),[E]=r.useBlocksContainer(),j=async(o,m)=>{const{dragSource:I,relativeIndex:b,dropTargetId:q,monitor:f}=m;if(I){const D=U(o);n(D);const S=f.getItem();l([S.id])}else await p({block:f.getItem(),dropTargetId:q,relativeIndex:b})},g=u.map(t,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!u.isUndefined(u.find(t,{_parent:o._id})),data:o})),c=()=>{l([]),x([])},[{isOver:h},T]=y.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>await p({block:o,dropTargetId:"",relativeIndex:0}))()}})),{isDragging:C}=y.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{onClick:()=>c(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",C?"bg-green-50/80":"bg-background"),children:u.isEmpty(t)?e.jsxRuntimeExports.jsxs("div",{ref:T,className:`mx-1 mt-4 h-full max-w-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(s.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(s.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(r.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(k.Tree,{initialOpen:R,extraAcceptTypes:["CHAI_BLOCK"],tree:g,rootId:0,render:(o,{depth:m,isOpen:I,onToggle:b})=>e.jsxRuntimeExports.jsx(K,{id:o.id,children:e.jsxRuntimeExports.jsx(P,{onSelect:q=>{x([]),l([q])},isSelected:u.includes(i,o.id),node:o,depth:m,isOpen:I,onToggle:b,toggleIds:a})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(F,{monitorProps:o}),onDrop:j,classes:{root:"h-[90%] "+(E?"pl-2":"pt-2"),draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:r.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:m})=>e.jsxRuntimeExports.jsx(V,{node:o,depth:m})})})})})};exports.default=Q;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),i=require("lodash-es"),s=require("./index-3TQsdso6.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./index-ZwpjuB-N.cjs");require("i18next");require("react-i18next");require("./index-T3wfa1kz.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");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("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-FGufPv9R.cjs");require("himalaya");require("lucide-react");require("./index-ecnGWzh9.cjs");const a=u.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-niwhffYL.cjs"))),x=u.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-6UDraUKW.cjs"))),d=()=>{const{data:t=[],isLoading:q}=s.usePages(),{data:r}=s.useProject(),n=i.sortBy(i.filter(t,{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:q,pages:n})})]})};exports.default=d;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("react"),x=require("lodash-es"),s=require("./index-T3wfa1kz.cjs"),a=require("./index-3TQsdso6.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("@chaibuilder/runtime");require("jotai");require("flat-to-nested");require("./MODIFIERS-9EwxLM8V.cjs");require("@react-hookz/web");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-MmCxz2Ay.cjs");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("react-i18next");require("./index-ZwpjuB-N.cjs");require("i18next");require("@floating-ui/react-dom");require("react-textarea-autosize");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("sonner");require("./html-to-json-FGufPv9R.cjs");require("himalaya");require("lucide-react");require("./index-ecnGWzh9.cjs");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-AW5Vtmgx.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-cWiNZcxW.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 q(){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(m,{_projectData:i,seany:o})})})]})]})})]})}exports.default=q;