@chaibuilder/sdk 1.2.60 → 1.2.62

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 (74) hide show
  1. package/README.md +1 -1
  2. package/dist/AddBlocks-Wja5xsTO.cjs +1 -0
  3. package/dist/{AddBlocks-L-3Io1jR.js → AddBlocks-ucNQHhx7.js} +18 -18
  4. package/dist/CanvasArea-1lUzUorh.js +975 -0
  5. package/dist/CanvasArea-dsxnMndK.cjs +60 -0
  6. package/dist/{CodeEditor-cY6z8D4N.js → CodeEditor-LeNocbY6.js} +1 -1
  7. package/dist/{CodeEditor-NuzOGqRn.cjs → CodeEditor-kk0bmQ3P.cjs} +1 -1
  8. package/dist/{CurrentPage-XXy2OzNq.js → CurrentPage-huy7O-ih.js} +3 -3
  9. package/dist/{CurrentPage-ccOL3l6S.cjs → CurrentPage-oPzQ-MY2.cjs} +1 -1
  10. package/dist/{ListTree-yoltG7gq.js → ListTree-5T-2KuBE.js} +1 -1
  11. package/dist/{ListTree-8jpTvI-s.cjs → ListTree-Fwl6Dtgc.cjs} +1 -1
  12. package/dist/{PagesPanel-t3NlycIl.cjs → PagesPanel-85U4O4ex.cjs} +1 -1
  13. package/dist/{PagesPanel-XUtE4Aou.js → PagesPanel-IT7AmWMs.js} +4 -4
  14. package/dist/{ProjectPanel-UClucyIl.cjs → ProjectPanel-NiOqTkub.cjs} +1 -1
  15. package/dist/{ProjectPanel-3zkDX3az.js → ProjectPanel-hhxqbHEX.js} +4 -4
  16. package/dist/{Settings-GVs7UvAX.cjs → Settings-NqIs7PLQ.cjs} +1 -1
  17. package/dist/{Settings-C9AegLbF.js → Settings-UO9zB4rm.js} +2 -2
  18. package/dist/{SidePanels-Y3z3wyQx.js → SidePanels-2ZXeWnl7.js} +3 -3
  19. package/dist/{SidePanels--qxWuuF-.cjs → SidePanels-n5WUkXLw.cjs} +1 -1
  20. package/dist/{ThemeConfiguration-03I3INEI.cjs → ThemeConfiguration-UNRnCxnU.cjs} +1 -1
  21. package/dist/{ThemeConfiguration-e_4e_ZcS.js → ThemeConfiguration-VSQaQn9_.js} +4 -4
  22. package/dist/{Topbar-lnCz7TLm.js → Topbar-Tkn___pR.js} +2 -2
  23. package/dist/{Topbar-Yrhyc6IQ.cjs → Topbar-m48Xdj0O.cjs} +1 -1
  24. package/dist/UILibrariesPanel-0NMxbnSZ.js +215 -0
  25. package/dist/UILibrariesPanel-9V4REpxW.cjs +1 -0
  26. package/dist/{UnsplashImages-Y0TGxNbH.js → UnsplashImages-LU3fiooG.js} +1 -1
  27. package/dist/{UnsplashImages-5JbDig-S.cjs → UnsplashImages-fm761J9M.cjs} +1 -1
  28. package/dist/{UploadImages-f6wPPJxc.cjs → UploadImages-2_SIuRI7.cjs} +1 -1
  29. package/dist/{UploadImages-Dh35M55S.js → UploadImages-MjYi7gfH.js} +1 -1
  30. package/dist/{add-page-modal-j2foeVKa.cjs → add-page-modal-QdlPDeMk.cjs} +1 -1
  31. package/dist/{add-page-modal-sKH5SHMa.js → add-page-modal-TWTjEGxY.js} +4 -4
  32. package/dist/{atoms-a0H_593V.cjs → atoms-KQpaDRnF.cjs} +1 -1
  33. package/dist/{atoms-ZOWyNoiC.js → atoms-Oomqut88.js} +2 -2
  34. package/dist/{confirm-alert-pGxJwZ2Q.js → confirm-alert-RNzVJyhU.js} +1 -1
  35. package/dist/{confirm-alert-C3wsf6lk.cjs → confirm-alert-gFBHhF1C.cjs} +1 -1
  36. package/dist/core.cjs +1 -1
  37. package/dist/core.js +2 -2
  38. package/dist/{delete-page-modal-XObwAnNB.cjs → delete-page-modal-B5W3a1ZW.cjs} +1 -1
  39. package/dist/{delete-page-modal-4Tp_VPx1.js → delete-page-modal-sUlXQ02P.js} +3 -3
  40. package/dist/email.cjs +1 -1
  41. package/dist/email.js +2 -2
  42. package/dist/{form-pya-o19L.js → form-c4b4A8Ap.js} +1 -1
  43. package/dist/{form-D9cWMUJ4.cjs → form-lqNXs-pv.cjs} +1 -1
  44. package/dist/{index-1teL5Lld.js → index-0M3H1dVb.js} +3 -3
  45. package/dist/{index-TzLilp-0.js → index-SyrshOUV.js} +399 -402
  46. package/dist/{index-849lneVZ.cjs → index-TKS5_SlD.cjs} +1 -1
  47. package/dist/{index-ZZTdYO7r.js → index-WN67ca4z.js} +9 -9
  48. package/dist/{index-8Fxmy4tt.cjs → index-afblGXKA.cjs} +2 -2
  49. package/dist/index-upb0eDoG.cjs +1 -0
  50. package/dist/lib.cjs +2 -2
  51. package/dist/lib.js +97 -146
  52. package/dist/{page-viewer-Q-eOjWmS.js → page-viewer-qb3ot43w.js} +4 -4
  53. package/dist/{page-viewer-tNzhbu_E.cjs → page-viewer-v4K0Wkhx.cjs} +1 -1
  54. package/dist/plugin-2hf9pCRy.cjs +1 -0
  55. package/dist/plugin-wDnsBVPp.js +54 -0
  56. package/dist/{project-general-setting-uDDo2ktT.js → project-general-setting-LfoijnjK.js} +4 -4
  57. package/dist/{project-general-setting-9fI_iZ_Q.cjs → project-general-setting-Q7hgQy5G.cjs} +1 -1
  58. package/dist/{project-seo-setting-rjrO9KDR.cjs → project-seo-setting-rjVkahzj.cjs} +1 -1
  59. package/dist/{project-seo-setting-PXJe5SSV.js → project-seo-setting-ztis1_yw.js} +2 -2
  60. package/dist/{single-page-detail-0ipAHwTX.js → single-page-detail-Neoai4eq.js} +11 -11
  61. package/dist/{single-page-detail-s_kkO9Zj.cjs → single-page-detail-tR7Qp9T4.cjs} +1 -1
  62. package/dist/studio.cjs +1 -1
  63. package/dist/studio.js +3 -3
  64. package/dist/ui.cjs +1 -1
  65. package/dist/ui.js +44 -44
  66. package/dist/web-blocks.cjs +1 -1
  67. package/dist/web-blocks.js +1 -1
  68. package/package.json +1 -1
  69. package/dist/AddBlocks-BtMNa99n.cjs +0 -1
  70. package/dist/CanvasArea-KBfW2Hh3.js +0 -978
  71. package/dist/CanvasArea-ZNRxUJR7.cjs +0 -59
  72. package/dist/UILibrariesPanel-LGbh-IZP.cjs +0 -1
  73. package/dist/UILibrariesPanel-PP4QDQRZ.js +0 -216
  74. package/dist/index-cH1CfTbV.cjs +0 -1
@@ -1,59 +0,0 @@
1
- "use strict";var ie=Object.defineProperty;var re=(e,t,n)=>t in e?ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var T=(e,t,n)=>(re(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-Z_BpKhVy.cjs"),p=require("react"),l=require("lodash-es"),R=require("@radix-ui/react-icons"),o=require("./index-cH1CfTbV.cjs"),F=require("./index-8Fxmy4tt.cjs"),U=require("react-i18next"),k=require("jotai"),le=require("lucide-react"),Y=require("react-dom"),C=require("prop-types"),ae=require("react-quill"),L=require("./atoms-a0H_593V.cjs"),ce=require("@floating-ui/dom"),V=require("@floating-ui/react-dom"),de=require("@react-hookz/web"),ue=require("flagged"),pe=require("@tailwindcss/typography"),xe=require("@tailwindcss/forms"),me=require("@tailwindcss/aspect-ratio"),ge=require("tailwindcss-palette-generator"),he=require("tailwind-merge"),H=require("./MODIFIERS-mVmfEGgo.cjs"),fe=require("@chaibuilder/runtime"),G=require("lodash"),je=require("react-wrap-balancer"),Ee=require("re-resizable");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.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("./Functions-N3yhPYKY.cjs");require("tree-model");require("i18next");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");const ye=()=>{const{hasUndo:e,hasRedo:t,undo:n,redo:r}=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(R.ResetIcon,{})}),s.jsxRuntimeExports.jsx(o.Button,{disabled:!t(),onClick:r,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(R.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function ke(){const[e,t]=o.useDarkMode();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(R.SunIcon,{className:"size-4 shrink-0"}),s.jsxRuntimeExports.jsx(o.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"} 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",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"} 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`})}),s.jsxRuntimeExports.jsx(F.FaMoon,{className:"size-4 ml-3 shrink-0"})]})}const X=({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"}})]}),be=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(R.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(R.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(X,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(X,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(R.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(R.DesktopIcon,{}),width:1920}],Z=({title:e,content:t,currentBreakpoint:n,breakpoint:r,width:c,icon:d,onClick:a})=>{const{t:i}=U.useTranslation();return s.jsxRuntimeExports.jsxs(o.HoverCard,{children:[s.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(o.Button,{onClick:()=>a(c),size:"sm",variant:r===n?"secondary":"ghost",children:d})}),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:i(e)}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:i(t)})]})})})]})},ve=()=>{const[,e,t]=o.useCanvasWidth(),[n,r]=o.useSelectedBreakpoints(),{t:c}=U.useTranslation(),d=o.useBuilderProp("breakpoints",be),a=i=>{n.includes(i)?n.length>2&&r(n.filter(u=>u!==i)):r(u=>[...u,i])};return d.length<4?s.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:l.map(d,i=>p.createElement(Z,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e}))}):s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[l.map(d.filter(i=>l.includes(n,l.toUpper(i.breakpoint))),i=>p.createElement(Z,{...i,onClick:t,key:i.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(R.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:c("Breakpoints")}),s.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),l.map(d,i=>s.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>a(l.toUpper(i.breakpoint)),checked:l.includes(n,l.toUpper(i.breakpoint)),children:c(i.title)},i.breakpoint))]})]})]})},Re=()=>{const{t:e}=U.useTranslation(),{setNewBlocks:t}=o.useBlocksStoreUndoableActions(),[,n]=o.useSelectedBlockIds(),[,r]=o.useSelectedStylingBlocks(),c=p.useCallback(()=>{t([]),n([]),r([])},[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(R.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:c,children:e("yes")})]})]})]})})},Se=()=>{const[e,t]=k.useAtom(o.aiAssistantActiveAtom);return o.useBuilderProp("askAiCallBack",null)?s.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxRuntimeExports.jsxs(o.Label,{htmlFor:"ai-assistant",className:"flex items-center gap-x-1 text-sm text-yellow-600",children:[s.jsxRuntimeExports.jsx(le.SparklesIcon,{className:"w-4"}),"AI Assistant"]}),s.jsxRuntimeExports.jsx(o.Switch,{className:"scale-90",checked:e,onCheckedChange:r=>{t(r)},id:"ai-assitantt"})]}):null},Ce=()=>{const e=o.useBuilderProp("darkMode",!0),[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:[s.jsxRuntimeExports.jsx(ve,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(ke,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400",children:[s.jsxRuntimeExports.jsx(R.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[l.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(ye,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(Re,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(Se,{})]})]})},we=`<!doctype html>
2
- <html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
7
- <style>
8
- html { height: 100%; overflow:auto; }
9
- body { height: 100%; }
10
- .air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
11
- .air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
12
- body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
13
- -moz-user-select: none;-ms-user-select: none; user-select: none; }
14
- html{
15
- -ms-overflow-style: none; /* IE and Edge */
16
- scrollbar-width: none; /* Firefox */
17
- }
18
- /** IMPORTANT: Make fields content editable in SAFARI */
19
- [contenteditable] {-webkit-user-select: text;user-select: text;}
20
-
21
- html::-webkit-scrollbar { width: 0 !important }
22
- .aspect-auto{aspect-ratio: auto;}
23
- .aspect-square{aspect-ratio: 1/1;}
24
- .aspect-video{aspect-ratio: 16/9;}
25
- .dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
26
- .dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
27
- a{ pointer-events: none !important; }
28
- [contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
29
- [contenteditable="true"] {
30
- outline: none;
31
- box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
32
- -webkit-user-select: text;
33
- -moz-user-select: text;
34
- user-select: text;
35
- }
36
- .frame-root .frame-content { height: 100%; }
37
- [data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
38
- [data-dnd="yes"] { pointer-events: auto !important}
39
- [data-dnd="no"] { pointer-events: none !important; }
40
- [data-dnd-dragged="yes"] { opacity: 0.6; pointer-events: none; }
41
- [data-dnd-dragged="no"] { opacity: 1; pointer-events: auto !important; }
42
- [force-show] { display: block !important; }
43
- </style>
44
- <style id="hidden-blocks"></style>
45
- <style id="selected-block"></style>
46
- <style id="selected-styling-block"></style>
47
- <style id="highlighted-block"></style>
48
- <style id="dragged-block"></style>
49
-
50
- </head>
51
- <body class="font-body antialiased h-full">
52
- <div class="frame-root h-full"></div>
53
- <script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
54
- </body>
55
- </html>`,Ae=e=>{const[t]=o.useCanvasWidth(),[,n]=o.useCanvasZoom(),[r,c]=p.useState({}),d=p.useCallback(()=>{const{width:a,height:i}=e;if(a<t){const u=parseFloat((a/t).toFixed(2).toString());let g={};const h=i*u;i&&(g={height:100+(i-h)/h*100+"%"}),c({position:"relative",top:0,transform:`scale(${u})`,transformOrigin:"top left",...g,maxWidth:"none"}),n(u*100)}else c({}),n(100)},[t,e,n]);return p.useEffect(()=>{d()},[t,e,n,d]),r};let ee,te;typeof document<"u"&&(ee=document);typeof window<"u"&&(te=window);const se=p.createContext({document:ee,window:te}),P=()=>p.useContext(se),{Provider:Be,Consumer:rt}=se;class ne extends p.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return p.Children.only(this.props.children)}}T(ne,"propTypes",{children:C.element.isRequired,contentDidMount:C.func.isRequired,contentDidUpdate:C.func.isRequired});class $ extends p.Component{constructor(n,r){super(n,r);T(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:r}=this.props;typeof r=="function"?r(n):r&&(r.current=n)});T(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});T(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=p.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 r=this.props.contentDidMount,c=this.props.contentDidUpdate,d=n.defaultView||n.parentView,a=s.jsxRuntimeExports.jsx(ne,{contentDidMount:r,contentDidUpdate:c,children:s.jsxRuntimeExports.jsx(Be,{value:{document:n,window:d},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),i=this.getMountTarget();return[Y.createPortal(this.props.head,this.getDoc().head),Y.createPortal(a,i)]}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()})}}T($,"propTypes",{style:C.object,head:C.node,initialContent:C.string,mountTarget:C.string,contentDidMount:C.func,contentDidUpdate:C.func,children:C.oneOfType([C.element,C.arrayOf(C.element)])}),T($,"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 Ie=p.forwardRef((e,t)=>s.jsxRuntimeExports.jsx($,{...e,forwardedRef:t}));function W(e){const t=window.getComputedStyle(e),n=t.display;if(n==="flex"||n==="inline-flex"){const r=t.flexDirection;return r==="column"||r==="column-reverse"?"vertical":"horizontal"}else if(n==="grid"){const r=t.gridAutoFlow,c=t.gridTemplateRows,d=t.gridTemplateColumns;return r.includes("column")||c.split(" ").length>d.split(" ").length?"vertical":"horizontal"}else if(n==="block"||n==="inline-block")return"vertical";return"horizontal"}let E=null,A=[],q=null,O=null;const Q=(e,t,n)=>{if(!E||!e)return;const r=E==null?void 0:E.getElementById("placeholder"),c=A.map(([u])=>u),d=c.reduce((u,g)=>Math.abs(g-n)<Math.abs(u-n)?g:u,0),a=c.indexOf(d);if(!A[a])return;const i=A[a];r.style.width=t==="vertical"?i[2]+"px":"2px",r.style.height=t==="vertical"?"2px":i[2]+"px",r.style.display="block",t==="vertical"?(r.style.top=i[0]+"px",r.style.left=i[1]+"px"):(r.style.top=i[1]+"px",r.style.left=i[0]+"px")};function _e(e,t){let n=0,r=1/0;return t.forEach((c,d)=>{const a=Math.abs(c[0]-e);a<r&&(r=a,n=d)}),n}const De=e=>{const n=W(e)==="horizontal";A=[],Array.from(e.children).forEach((r,c)=>{if(r.classList.contains("pointer-events-none"))return;const d=n?r.offsetLeft:r.offsetTop,a=n?[r.offsetTop,r.clientHeight]:[r.offsetLeft,r.clientWidth];if(A.push([d,a[0],a[1]]),c===e.children.length-1){const i=n?r.offsetLeft+r.clientWidth:r.offsetTop+r.clientHeight;A.push([i,a[0],a[1]])}})},Te=l.throttle(e=>{var c;const t=e.target,n=W(t),r=(c=E==null?void 0:E.defaultView)==null?void 0:c.scrollY;n==="vertical"?Q(t,n,e.clientY+r):Q(t,n,e.clientX)},0);function J(){const e=E==null?void 0:E.getElementById("placeholder");e.style.display="none",Me("pointer-none"),qe()}function Me(e){(E==null?void 0:E.querySelectorAll(`.${e}`)).forEach(n=>{n.classList.remove(e)})}function qe(){const e=E==null?void 0:E.querySelector('[data-drop="yes"]');e&&e.removeAttribute("data-drop")}const Ne=()=>{const{document:e}=P(),[t,n]=k.useAtom(o.draggingFlagAtom),{addCoreBlock:r}=o.useAddBlock(),[,c]=o.useHighlightBlockId(),[,d]=o.useSelectedBlockIds(),{moveBlocks:a}=o.useBlocksStoreUndoableActions(),[,i]=k.useAtom(o.draggedBlockIdAtom),[u,g]=k.useAtom(L.draggedBlockAtom),[,h]=k.useAtom(L.dropTargetAtom),x=()=>{J(),n(!1),i(""),g(null),h(null),A=[]};return E=e,{isDragging:t,onDragOver:m=>{m.preventDefault(),m.stopPropagation(),Te(m)},onDrop:m=>{var B;q==null||q.classList.remove("drop-target");const f=q,b=W(f)==="vertical"?m.clientY+((B=E==null?void 0:E.defaultView)==null?void 0:B.scrollY):m.clientX;O=_e(b,A);const v=u,S=f.getAttribute("data-block-id");if(v===q){x();return}if(!l.has(v,"_id")){r(v,S==="canvas"?null:S,O),setTimeout(x,300);return}let w=f.getAttribute("data-block-id");w===null&&(w=m.target.parentElement.getAttribute("data-block-id")),a([v._id],w,O),x(),setTimeout(J,300)},onDragEnter:m=>{const f=m,y=f.target;q=y;const b=y.getAttribute("data-block-id");h(b),f.stopPropagation(),f.preventDefault(),A=[],De(y),y.classList.add("drop-target"),n(!0),c(""),d([])}}};function K(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function Le(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Fe=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,n]=o.useHighlightBlockId(),[r,c]=k.useAtom(o.inlineEditingActiveAtom);return d=>{var x;if(r)return;const a=K(d.target),i=a.getAttribute("data-block-type");if(!i||!e.includes(i))return;const u=a.cloneNode(!0);a.style.display="none",Array.from(u.attributes).forEach(m=>{m.name!=="class"&&u.removeAttribute(m.name)}),i==="Text"&&(u.style.display="inline-block"),a.parentNode.insertBefore(u,a.nextSibling);const g=new ae.Quill(u,{placeholder:"Type here..."});function h(){const m=g.getText(0,g.getLength());t([a.getAttribute("data-block-id")],{content:m}),a.removeAttribute("style"),u.removeEventListener("blur",h,!0),Le(g),c(""),n("")}u.addEventListener("blur",h,!0),u.addEventListener("keydown",m=>{(m.key==="Enter"||m.key==="Escape")&&h()}),g.focus(),(x=u.querySelector(".ql-clipboard"))==null||x.remove(),c(a.getAttribute("data-block-id"))}},He=()=>{const[,e]=o.useSelectedStylingBlocks(),[t,n]=o.useSelectedBlockIds(),[,r]=o.useHighlightBlockId(),[c]=k.useAtom(o.inlineEditingActiveAtom),[d]=k.useAtom(o.treeRefAtom);return a=>{if(c)return;a.stopPropagation();const i=K(a.target);if(i!=null&&i.getAttribute("data-block-id")&&(i==null?void 0:i.getAttribute("data-block-id"))==="container"){n([]),e([]),r("");return}if(i!=null&&i.getAttribute("data-block-parent")){const u=i.getAttribute("data-style-prop"),g=i.getAttribute("data-style-id"),h=i.getAttribute("data-block-parent");t.includes(h)||d==null||d.closeAll(),e([{id:g,prop:u,blockId:h}]),n([h])}else if(i!=null&&i.getAttribute("data-block-id")){let u=i.getAttribute("data-block-id");t.includes(u)||d==null||d.closeAll(),e([]),n([u])}r("")}},Pe=l.throttle((e,t)=>{const n=K(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),Oe=()=>{const[,e]=o.useHighlightBlockId(),[t]=k.useAtom(o.inlineEditingActiveAtom);return n=>{t||Pe(n,e)}},$e=({children:e})=>{const{document:t}=P(),[n]=o.useSelectedBlockIds(),[r,c]=o.useSelectedStylingBlocks();p.useEffect(()=>{setTimeout(()=>{if(!l.isEmpty(r))return;const g=oe(t,l.first(n));if(g){const h=g.getAttribute("data-style-prop");if(h){const x=g.getAttribute("data-style-id"),m=g.getAttribute("data-block-parent");c([{id:x,prop:h,blockId:m}])}}},100)},[t,n,c,r]);const d=Fe(),a=He(),i=Oe(),u=Ne();return s.jsxRuntimeExports.jsx("div",{"data-block-id":"canvas",id:"canvas",onClick:a,onDoubleClick:d,onMouseMove:i,...l.omit(u,"isDragging"),className:"relative mb-5 h-full max-w-full px-1 "+(u.isDragging?"dragging":""),children:e})},oe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),ze=()=>{const{document:e}=P();return F.useKeyEventWatcher(e),null},Ue=({block:e,label:t})=>{const[,n]=o.useSelectedBlockIds(),[,r]=o.useHighlightBlockId(),[,c]=k.useAtom(L.draggedBlockAtom),d=ue.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:d?"true":"false",onDragStart:a=>{a.dataTransfer.setData("text/plain",JSON.stringify(l.pick(e,["_id","_type","_name"]))),c(e),setTimeout(()=>{n([]),r(null)},200)},children:[s.jsxRuntimeExports.jsx(R.DragHandleDots2Icon,{}),t]})},We=({selectedBlockElement:e,block:t})=>{const n=o.useRemoveBlocks(),r=o.useDuplicateBlocks(),[,c]=o.useSelectedBlockIds(),[,d]=o.useSelectedStylingBlocks(),[a]=k.useAtom(o.inlineEditingActiveAtom),{floatingStyles:i,refs:u,update:g}=V.useFloating({placement:"top-start",middleware:[V.shift(),ce.flip()],elements:{reference:e}});de.useResizeObserver(e,()=>g(),e!==null);const h=l.get(t,"_parent",null),x=l.isEmpty(l.get(t,"_name",""))?l.get(t,"_type",""):l.get(t,"_name","");return!e||!t||a?null:s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:u.setFloating,style:i,onClick:m=>{m.stopPropagation(),m.preventDefault()},onKeyDown:m=>m.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Ue,{label:x,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[h&&s.jsxRuntimeExports.jsx(R.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{d([]),c([h])}}),o.canDuplicateBlock(l.get(t,"_type",""))?s.jsxRuntimeExports.jsx(R.CopyIcon,{className:"hover:scale-105",onClick:()=>r([t==null?void 0:t._id])}):null,o.canDeleteBlock(l.get(t,"_type",""))?s.jsxRuntimeExports.jsx(R.TrashIcon,{className:"hover:scale-105",onClick:()=>n([t==null?void 0:t._id])}):null]})]})})},Ke=({model:e})=>{const[t]=o.useBrandingOptions(),[n]=o.useSelectedBlockIds(),[r]=o.useDarkMode(),[c]=o.useHighlightBlockId(),[d]=o.useSelectedStylingBlocks(),[a]=k.useAtom(o.draggedBlockIdAtom),{document:i,window:u}=P(),[g]=p.useState(i==null?void 0:i.getElementById("highlighted-block")),[h]=p.useState(i==null?void 0:i.getElementById("selected-block")),[x]=p.useState(i==null?void 0:i.getElementById("selected-styling-block")),[m]=p.useState(i==null?void 0:i.getElementById("dragged-block"));p.useEffect(()=>{r?i==null||i.documentElement.classList.add("dark"):i==null||i.documentElement.classList.remove("dark")},[r,i]);const f=l.get(t,"headingFont","DM Sans"),y=l.get(t,"bodyFont","DM Sans");return p.useEffect(()=>{const b=l.get(t,"primaryColor","#000"),v=l.get(t,"secondaryColor","#FFF"),S=l.get(t,"bodyBgLightColor","#fff"),w=l.get(t,"bodyBgDarkColor","#000"),B=l.get(t,"bodyTextDarkColor","#000"),I=l.get(t,"bodyTextLightColor","#fff"),M=ge([{color:b,name:"primary"},{color:v,name:"secondary"}]),N={"bg-light":S,"bg-dark":w,"text-dark":B,"text-light":I},j=l.get(t,"roundedCorners","0");!u||!u.tailwind||(u.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},fontFamily:{heading:[f],body:[y]},borderRadius:{DEFAULT:`${j||"0"}px`},colors:{...N,...M}}},plugins:[pe,xe,me]})},[t,u,f,y]),p.useEffect(()=>{h&&(h.textContent=`${l.map(n,b=>`[data-block-id="${b}"]`).join(",")}{
56
- outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
57
- }`)},[n,h]),p.useEffect(()=>{if(!a){m.textContent="";return}m.textContent=`[data-block-id="${a}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[a]),p.useEffect(()=>{g&&(g.textContent=c?`[data-style-id="${c}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[c,n,g]),p.useEffect(()=>{x&&(x.textContent=`${l.map(d,({id:b})=>`[data-style-id="${b}"]`).join(",")}{
58
- outline: 1px solid #42a1fc !important; outline-offset: -1px;
59
- }`)},[d,x]),p.useEffect(()=>{const b=l.get(t,"bodyTextLightColor","#64748b"),v=l.get(t,"bodyTextDarkColor","#94a3b8"),S=l.get(t,"bodyBgLightColor","#FFFFFF"),w=l.get(t,"bodyBgDarkColor","#0f172a");i.body.className=`font-body antialiased text-[${b}] bg-[${S}] dark:text-[${v}] dark:bg-[${w}]`},[t,i,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[f&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${f.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),y&&f!==y&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${y.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),f&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${f}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},Ye=()=>k.useAtom(o.canvasSettingsAtom),Ve=(e,t)=>{const n=["xs","sm","md","lg","xl","2xl"],r=n.indexOf(t),c=e.split(" ");let d=new Array(n.length).fill(!1);for(const a of c){let[i,u]=a.split(":");u||(u=i,i="xs");const g=n.indexOf(i);if(g<=r){const h=["block","flex","inline","inline-block","inline-flex","grid","table"],x=["hidden"];if(h.includes(u))for(let m=g;m<n.length;m++)d[m]=!0;else if(x.includes(u))for(let m=g;m<n.length;m++)d[m]=!1}}return d[r]},Ge=e=>{const t={};return Object.keys(e).forEach(n=>{l.isString(e[n])&&e[n].startsWith(H.SLOT_KEY)&&(t[n]=e[n].replace(H.SLOT_KEY,"").split(","))}),t},Xe=l.memoize(e=>{const t=e.replace(H.STYLES_KEY,"").split(",");return he.twMerge(t[0],t[1])});function Ze(e,t){return l.get(e,`${t}_attrs`,{})}function Qe(e,t){const n={};return Object.keys(e).forEach(r=>{if(l.isString(e[r])&&e[r].startsWith(H.STYLES_KEY)){const c=Xe(e[r]),d=Ze(e,r);n[r]={className:c,"data-style-prop":r,"data-block-parent":e._id,"data-style-id":`${r}-${e._id}`,...d};const a=l.has(d,"x-show")||l.has(d,"x-if");a&&(n.__isHidden=a&&!Ve(c,t))}}),n}function Je(e,t){const n=l.get(e,"_bindings",{});return l.isEmpty(n)?{...e}:(l.each(n,(r,c)=>{l.isString(r)&&l.get(t,r,null)&&(e[c]=l.get(t,r,null))}),e)}function z({blocks:e}){const[t]=o.useBlocksStore(),[n]=k.useAtom(o.xShowBlocksAtom),[r]=k.useAtom(L.draggedBlockAtom),[c]=k.useAtom(L.dropTargetAtom),[,d]=o.useCanvasWidth(),[a]=Ye(),i=p.useCallback(x=>Qe(x,d),[d]),[u]=F.useChaiExternalData(),[g]=k.useAtom(o.inlineEditingActiveAtom),h=p.useCallback(x=>x.reduce((m,f)=>{const y=l.get(a,f,{});return{...m,...y}},{}),[a,t]);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:p.Children.toArray(e.map((x,m)=>{if(g===x._id)return null;const f=Ge(x),y={};l.isEmpty(f)||Object.keys(f).forEach(M=>{y[M]=p.Children.toArray(f[M].map(N=>s.jsxRuntimeExports.jsx(z,{blocks:[l.find(t,{_id:N})]})))});const b=l.filter(t,{_parent:x._id});y.children=b.length?s.jsxRuntimeExports.jsx(z,{blocks:b}):null;const v=fe.getBlockComponent(x._type),S=l.get(v,"builderComponent",l.get(v,"component",null));if(l.isNull(S))return s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${x==null?void 0:x._type} not registered -->`});const w=l.has(v,"getBlockStateFrom")?v==null?void 0:v.getBlockStateFrom(x,t):[],B=h(w),I=i(x);return l.get(I,"__isHidden",!1)&&!G.includes(n,x._id)?null:s.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(S,{blockProps:{...G.includes(n,x._id)?{"force-show":""}:{},"data-block-id":x._id,"data-block-type":x._type,...r?{"data-dnd":o.canAcceptChildBlock(x._type,r==null?void 0:r._type)?"yes":"no","data-dnd-dragged":r._id===x._id?"yes":"no"}:{},...c===x._id?{"data-drop":"yes"}:{}},index:m,...Je(x,u),...l.omit(I,["__isHidden"]),...y,inBuilder:!0,blockState:B})})}))})}const et=()=>{const[e]=o.useBlocksStore(),t=l.isEmpty(e)?null:s.jsxRuntimeExports.jsx(F.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(z,{blocks:l.filter(e,n=>l.isEmpty(n._parent))})});return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:t})},tt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),st=()=>{const[e]=k.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[n]=o.useCanvasWidth(),[,r]=o.useSelectedBlockIds(),c=o.useSelectedBlock(),[,d]=o.useHighlightBlockId(),a=p.useRef(null),i=p.useRef(null),[u,g]=p.useState({width:0,height:0}),h=Ae(u),[x,m]=p.useState(0),[f,y]=p.useState([]),[,b]=p.useState([]),[,v]=k.useAtom(o.canvasIframeAtom),[S,w]=o.useSelectedStylingBlocks(),B=o.useBuilderProp("loading",!1),I=o.useBuilderProp("htmlDir","ltr");p.useEffect(()=>{const{clientWidth:j,clientHeight:_}=i.current;g({width:j,height:_}),x===0&&m(j)},[i,n,x]);const M=(j,_=0)=>{const{top:D}=j.getBoundingClientRect();return D+_>=0&&D-_<=window.innerHeight};p.useEffect(()=>{var j,_;if(c&&c.type!=="Multiple"&&a.current){const D=oe(a.current.contentDocument,c._id);D&&(M(D)||(_=(j=a.current)==null?void 0:j.contentWindow)==null||_.scrollTo({top:D.offsetTop,behavior:"smooth"}),y([D]))}},[c]),p.useEffect(()=>{if(!l.isEmpty(S)&&a.current){const j=tt(a.current.contentDocument,l.first(S).id);b(j?[j]:[null])}else b([null])},[S]);const N=p.useMemo(()=>{let j=we;return j=j.replace("__HTML_DIR__",I),e==="offline"&&(j=j.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),j=j.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),j=j.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),j},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{r([]),w([])},onMouseLeave:()=>setTimeout(()=>d(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:x>0&&!l.isEmpty(h)?{width:t?"100%":x}:{},ref:i,children:s.jsxRuntimeExports.jsxs(Ie,{contentDidMount:()=>v(a.current),ref:a,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(ze,{}),s.jsxRuntimeExports.jsx(We,{block:c,selectedBlockElement:l.first(f)}),s.jsxRuntimeExports.jsx(Ke,{model:"page"}),s.jsxRuntimeExports.jsx(je.Provider,{children:s.jsxRuntimeExports.jsx($e,{children:B?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(et,{})})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},nt=p.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-NuzOGqRn.cjs"))),ot=()=>{const[e]=o.useCodeEditor();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(Ce,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden bg-gray-100/40 px-2",children:[s.jsxRuntimeExports.jsx(p.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(F.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(st,{})})}),e?s.jsxRuntimeExports.jsx(p.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(Ee.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:s.jsxRuntimeExports.jsx(nt,{})})}):null]})]})};exports.default=ot;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),r=require("lodash-es"),j=require("react"),s=require("./index-cH1CfTbV.cjs"),N=require("@chaibuilder/runtime"),S=require("lucide-react"),g=require("jotai"),y=require("./Functions-N3yhPYKY.cjs"),w=require("@radix-ui/react-icons"),I=require("./MODIFIERS-mVmfEGgo.cjs"),C=require("react-i18next"),L=require("flagged"),T=require("./atoms-a0H_593V.cjs"),A=require("clsx");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");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("@react-hookz/web");require("tree-model");function P(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const l=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,l.get?l:{enumerable:!0,get:()=>t[u]})}}return o.default=t,Object.freeze(o)}const O=P(j);function D({uiLibraries:t,library:o,setLibrary:u}){var m;const[l,x]=O.useState(!1),{t:n}=C.useTranslation();return o?e.jsxRuntimeExports.jsxs(s.Popover,{open:l,onOpenChange:x,children:[e.jsxRuntimeExports.jsx(s.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:n("Choose Library")}),e.jsxRuntimeExports.jsxs(s.Button,{variant:"outline",size:"sm",role:"combobox","aria-expanded":l,className:"w-[200px] justify-between",children:[o?(m=t.find(c=>c.uuid===o))==null?void 0:m.name:n("Select library"),e.jsxRuntimeExports.jsx(w.CaretSortIcon,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})]})}),e.jsxRuntimeExports.jsx(s.PopoverContent,{className:"w-[200px] p-0",children:e.jsxRuntimeExports.jsxs(s.Command,{children:[e.jsxRuntimeExports.jsx(s.CommandInput,{placeholder:"Search library...",className:"h-9"}),e.jsxRuntimeExports.jsxs(s.CommandList,{children:[e.jsxRuntimeExports.jsx(s.CommandEmpty,{children:"No library found."}),e.jsxRuntimeExports.jsx(s.CommandGroup,{children:t.map(c=>e.jsxRuntimeExports.jsxs(s.CommandItem,{value:c.uuid,onSelect:p=>{u(p),x(!1)},children:[c.name,e.jsxRuntimeExports.jsx(w.CheckIcon,{className:y.cn("ml-auto h-4 w-4",o===c.uuid?"opacity-100":"opacity-0")})]},c.uuid))})]})]})})]}):null}const _=({block:t,closePopover:o,library:u})=>{const[l,x]=j.useState(!1),n=s.useBuilderProp("getUILibraryBlock",r.noop),{addCoreBlock:m,addPredefinedBlock:c}=s.useAddBlock(),[p,h]=s.useSelectedBlockIds(),[,E]=s.useHighlightBlockId(),[,q]=g.useAtom(T.draggedBlockAtom),b=L.useFeature("dnd"),R=i=>{const a=r.has(i,"styles_attrs.data-page-section");return i._type==="Box"&&a},d=j.useCallback(async i=>{if(i.stopPropagation(),r.has(t,"component")){m(t,r.first(p)),o();return}x(!0);const a=await n(u,t);let f=r.first(p);R(r.first(a))&&(f=null),r.isEmpty(a)||c(N.syncBlocksWithDefaults(a),f),o()},[t]),k=async i=>{const a=await n(u,t);let f=r.first(p);if(R(r.first(a))&&(f=null),!r.isEmpty(a)){const B={blocks:a,uiLibrary:!0,parent:f};if(i.dataTransfer.setData("text/plain",JSON.stringify(B)),t.preview){const v=new Image;v.src=t.preview,v.onload=()=>{i.dataTransfer.setDragImage(v,0,0)}}else i.dataTransfer.setDragImage(new Image,0,0);q(B),setTimeout(()=>{h([]),E(null),o()},200)}};return e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{onClick:l?()=>{}:d,draggable:!0,onDragStart:k,className:A("relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl",b?"cursor-grab":"cursor-pointer"),children:[l&&e.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black/70",children:[e.jsxRuntimeExports.jsx(S.Loader,{className:"animate-spin",size:15,color:"white"}),e.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),t.preview?e.jsxRuntimeExports.jsx("img",{src:t.preview,className:"min-h-[25px] w-full rounded-md",alt:t.name}):e.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200",children:e.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:t.name})})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t.name})})]})},M=g.atom({}),U=t=>{const[o,u]=g.useAtom(M),l=s.useBuilderProp("getUILibraryBlocks",r.noop),x=r.get(o,`${t==null?void 0:t.uuid}.blocks`,[]),n=r.get(o,`${t==null?void 0:t.uuid}.loading`,!1);return j.useEffect(()=>{(async()=>{if(n||x.length>0)return;u(c=>({...c,[t==null?void 0:t.uuid]:{loading:!0,blocks:[]}}));const m=await l(t);u(c=>({...c,[t==null?void 0:t.uuid]:{loading:!1,blocks:m||[]}}))})()},[t,x,n]),{data:x,isLoading:n}},z=s.atomWithStorage("_selectedLibrary",null),F=()=>{const[t,o]=g.useAtom(z),u=s.useBuilderProp("uiLibraries",[]),l=N.useChaiBlocks(),x=r.values(l).filter(i=>i.category==="custom"),n=u.find(i=>i.uuid===t)||r.first(u),{data:m,isLoading:c}=U(n),p=r.groupBy([...m,...x],"group"),[h,E]=j.useState("Hero"),[,q]=g.useAtom(s.activePanelAtom),b=r.get(p,h,[]),{t:R}=C.useTranslation(),d=j.useRef(null),k=i=>{d.current&&(clearTimeout(d.current),d.current=null),d.current=setTimeout(()=>{d.current&&E(i)},300)};return c?e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-full w-full"}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background",children:[n!=null&&n.uuid?e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 flex h-fit flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col",children:e.jsxRuntimeExports.jsx(D,{library:n==null?void 0:n.uuid,setLibrary:o,uiLibraries:u})})})}):null,e.jsxRuntimeExports.jsxs("div",{className:"flex h-[95%] border-t border-gray-300 pt-2",children:[e.jsxRuntimeExports.jsx("div",{className:"flex h-full w-40 flex-col gap-1 px-1",children:j.Children.toArray(r.map(p,(i,a)=>e.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>k(a),onMouseLeave:()=>clearTimeout(d.current),onClick:()=>E(a),className:y.cn("flex w-full cursor-pointer items-center justify-between rounded-md p-1 text-sm transition-all ease-in-out hover:bg-gray-200",a===h?"bg-blue-500 text-white hover:bg-blue-600":""),children:[e.jsxRuntimeExports.jsx("span",{children:r.capitalize(a)}),e.jsxRuntimeExports.jsx(w.CaretRightIcon,{className:"ml-2 h-5 w-5"})]},a)))}),e.jsxRuntimeExports.jsxs(s.ScrollArea,{onMouseEnter:()=>d.current?clearTimeout(d.current):null,className:"z-10 -mt-2 flex h-full max-h-full w-[300px] flex-col gap-2 border-l border-gray-300 transition-all ease-linear",children:[e.jsxRuntimeExports.jsx("div",{className:"sticky top-0 z-30 border-b border-gray-300 bg-gray-200 p-2 text-[9px] font-light leading-3 text-gray-500",children:R("Click on a block to add it to the page")}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-2 px-2",children:j.Children.toArray(b.map(i=>e.jsxRuntimeExports.jsx(_,{block:i,library:n,closePopover:()=>q(I.OUTLINE_KEY)})))}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})]})]})})},G=()=>e.jsxRuntimeExports.jsx(F,{});exports.default=G;
@@ -1,216 +0,0 @@
1
- import { j as e } from "./jsx-runtime-WbnYoNE9.js";
2
- import { noop as S, has as y, first as p, isEmpty as I, get as B, values as P, groupBy as D, map as U, capitalize as _ } from "lodash-es";
3
- import * as R from "react";
4
- import L, { useState as T, useCallback as z, useEffect as G, useRef as O } from "react";
5
- import { b7 as H, b8 as M, B as F, b9 as J, ba as W, bb as $, bc as q, bd as K, be as Y, bf as Q, h as N, a2 as V, r as X, ad as Z, aF as ee, aG as te, aH as se, o as oe, aJ as re, S as ae, bq as ne } from "./index-TzLilp-0.js";
6
- import { syncBlocksWithDefaults as ie, useChaiBlocks as le } from "@chaibuilder/runtime";
7
- import { Loader as ce } from "lucide-react";
8
- import { useAtom as j, atom as de } from "jotai";
9
- import { c as A } from "./Functions-7jnEwJyw.js";
10
- import { CaretSortIcon as me, CheckIcon as ue, CaretRightIcon as pe } from "@radix-ui/react-icons";
11
- import { O as xe } from "./MODIFIERS-fd5XOmum.js";
12
- import { useTranslation as E } from "react-i18next";
13
- import { useFeature as fe } from "flagged";
14
- import { d as he } from "./atoms-ZOWyNoiC.js";
15
- import ge from "clsx";
16
- import "./_commonjsHelpers-UyOWmZb0.js";
17
- import "@radix-ui/react-toggle";
18
- import "class-variance-authority";
19
- import "./utils-VpVqnC9m.js";
20
- import "tailwind-merge";
21
- import "@radix-ui/react-switch";
22
- import "@radix-ui/react-slot";
23
- import "@radix-ui/react-accordion";
24
- import "@radix-ui/react-alert-dialog";
25
- import "@radix-ui/react-dialog";
26
- import "@radix-ui/react-label";
27
- import "@radix-ui/react-scroll-area";
28
- import "@radix-ui/react-tabs";
29
- import "@radix-ui/react-tooltip";
30
- import "@radix-ui/react-popover";
31
- import "@radix-ui/react-menubar";
32
- import "@radix-ui/react-hover-card";
33
- import "@radix-ui/react-select";
34
- import "@radix-ui/react-dropdown-menu";
35
- import "@radix-ui/react-separator";
36
- import "@radix-ui/react-toast";
37
- import "cmdk";
38
- import "@radix-ui/react-context-menu";
39
- import "react-icons-picker";
40
- import "react-dom";
41
- import "react-quill";
42
- import "@react-hookz/web";
43
- import "tree-model";
44
- function je({
45
- uiLibraries: t,
46
- library: n,
47
- setLibrary: i
48
- }) {
49
- var m;
50
- const [d, l] = R.useState(!1), { t: s } = E();
51
- return n ? /* @__PURE__ */ e.jsxs(H, { open: d, onOpenChange: l, children: [
52
- /* @__PURE__ */ e.jsx(M, { asChild: !0, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-2", children: [
53
- /* @__PURE__ */ e.jsx("span", { children: s("Choose Library") }),
54
- /* @__PURE__ */ e.jsxs(
55
- F,
56
- {
57
- variant: "outline",
58
- size: "sm",
59
- role: "combobox",
60
- "aria-expanded": d,
61
- className: "w-[200px] justify-between",
62
- children: [
63
- n ? (m = t.find((a) => a.uuid === n)) == null ? void 0 : m.name : s("Select library"),
64
- /* @__PURE__ */ e.jsx(me, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
65
- ]
66
- }
67
- )
68
- ] }) }),
69
- /* @__PURE__ */ e.jsx(J, { className: "w-[200px] p-0", children: /* @__PURE__ */ e.jsxs(W, { children: [
70
- /* @__PURE__ */ e.jsx($, { placeholder: "Search library...", className: "h-9" }),
71
- /* @__PURE__ */ e.jsxs(q, { children: [
72
- /* @__PURE__ */ e.jsx(K, { children: "No library found." }),
73
- /* @__PURE__ */ e.jsx(Y, { children: t.map((a) => /* @__PURE__ */ e.jsxs(
74
- Q,
75
- {
76
- value: a.uuid,
77
- onSelect: (u) => {
78
- i(u), l(!1);
79
- },
80
- children: [
81
- a.name,
82
- /* @__PURE__ */ e.jsx(
83
- ue,
84
- {
85
- className: A("ml-auto h-4 w-4", n === a.uuid ? "opacity-100" : "opacity-0")
86
- }
87
- )
88
- ]
89
- },
90
- a.uuid
91
- )) })
92
- ] })
93
- ] }) })
94
- ] }) : null;
95
- }
96
- const be = ({
97
- block: t,
98
- closePopover: n,
99
- library: i
100
- }) => {
101
- const [d, l] = T(!1), s = N("getUILibraryBlock", S), { addCoreBlock: m, addPredefinedBlock: a } = V(), [u, f] = X(), [, h] = Z(), [, b] = j(he), k = fe("dnd"), g = (o) => {
102
- const r = y(o, "styles_attrs.data-page-section");
103
- return o._type === "Box" && r;
104
- }, c = z(
105
- async (o) => {
106
- if (o.stopPropagation(), y(t, "component")) {
107
- m(t, p(u)), n();
108
- return;
109
- }
110
- l(!0);
111
- const r = await s(i, t);
112
- let x = p(u);
113
- g(p(r)) && (x = null), I(r) || a(ie(r), x), n();
114
- },
115
- [t]
116
- ), w = async (o) => {
117
- const r = await s(i, t);
118
- let x = p(u);
119
- if (g(p(r)) && (x = null), !I(r)) {
120
- const C = { blocks: r, uiLibrary: !0, parent: x };
121
- if (o.dataTransfer.setData("text/plain", JSON.stringify(C)), t.preview) {
122
- const v = new Image();
123
- v.src = t.preview, v.onload = () => {
124
- o.dataTransfer.setDragImage(v, 0, 0);
125
- };
126
- } else
127
- o.dataTransfer.setDragImage(new Image(), 0, 0);
128
- b(C), setTimeout(() => {
129
- f([]), h(null), n();
130
- }, 200);
131
- }
132
- };
133
- return /* @__PURE__ */ e.jsxs(ee, { children: [
134
- /* @__PURE__ */ e.jsx(te, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
135
- "div",
136
- {
137
- onClick: d ? () => {
138
- } : c,
139
- draggable: !0,
140
- onDragStart: w,
141
- className: ge(
142
- "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-gray-300 bg-white duration-200 hover:border-blue-500 hover:shadow-xl",
143
- k ? "cursor-grab" : "cursor-pointer"
144
- ),
145
- children: [
146
- d && /* @__PURE__ */ e.jsxs("div", { className: "absolute flex h-full w-full items-center justify-center bg-black/70", children: [
147
- /* @__PURE__ */ e.jsx(ce, { className: "animate-spin", size: 15, color: "white" }),
148
- /* @__PURE__ */ e.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
149
- ] }),
150
- t.preview ? /* @__PURE__ */ e.jsx("img", { src: t.preview, className: "min-h-[25px] w-full rounded-md", alt: t.name }) : /* @__PURE__ */ e.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border border-gray-300 bg-gray-200", children: /* @__PURE__ */ e.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: t.name }) })
151
- ]
152
- }
153
- ) }),
154
- /* @__PURE__ */ e.jsx(se, { children: /* @__PURE__ */ e.jsx("p", { children: t.name }) })
155
- ] });
156
- }, ke = de({}), we = (t) => {
157
- const [n, i] = j(ke), d = N("getUILibraryBlocks", S), l = B(n, `${t == null ? void 0 : t.uuid}.blocks`, []), s = B(n, `${t == null ? void 0 : t.uuid}.loading`, !1);
158
- return G(() => {
159
- (async () => {
160
- if (s || l.length > 0)
161
- return;
162
- i((a) => ({ ...a, [t == null ? void 0 : t.uuid]: { loading: !0, blocks: [] } }));
163
- const m = await d(t);
164
- i((a) => ({ ...a, [t == null ? void 0 : t.uuid]: { loading: !1, blocks: m || [] } }));
165
- })();
166
- }, [t, l, s]), { data: l, isLoading: s };
167
- }, ve = oe("_selectedLibrary", null), Be = () => {
168
- const [t, n] = j(ve), i = N("uiLibraries", []), d = le(), l = P(d).filter((o) => o.category === "custom"), s = i.find((o) => o.uuid === t) || p(i), { data: m, isLoading: a } = we(s), u = D([...m, ...l], "group"), [f, h] = T("Hero"), [, b] = j(re), k = B(u, f, []), { t: g } = E(), c = O(null), w = (o) => {
169
- c.current && (clearTimeout(c.current), c.current = null), c.current = setTimeout(() => {
170
- c.current && h(o);
171
- }, 300);
172
- };
173
- return a ? /* @__PURE__ */ e.jsx(ae, { className: "h-full w-full" }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full max-h-full w-[460px] flex-col overflow-hidden bg-background", children: [
174
- s != null && s.uuid ? /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex h-fit flex-col", children: /* @__PURE__ */ e.jsx("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ e.jsx("h1", { className: "flex w-full flex-col items-baseline truncate px-1 text-sm font-semibold xl:flex-col", children: /* @__PURE__ */ e.jsx(je, { library: s == null ? void 0 : s.uuid, setLibrary: n, uiLibraries: i }) }) }) }) : null,
175
- /* @__PURE__ */ e.jsxs("div", { className: "flex h-[95%] border-t border-gray-300 pt-2", children: [
176
- /* @__PURE__ */ e.jsx("div", { className: "flex h-full w-40 flex-col gap-1 px-1", children: L.Children.toArray(
177
- U(u, (o, r) => /* @__PURE__ */ e.jsxs(
178
- "div",
179
- {
180
- onMouseEnter: () => w(r),
181
- onMouseLeave: () => clearTimeout(c.current),
182
- onClick: () => h(r),
183
- className: A(
184
- "flex w-full cursor-pointer items-center justify-between rounded-md p-1 text-sm transition-all ease-in-out hover:bg-gray-200",
185
- r === f ? "bg-blue-500 text-white hover:bg-blue-600" : ""
186
- ),
187
- children: [
188
- /* @__PURE__ */ e.jsx("span", { children: _(r) }),
189
- /* @__PURE__ */ e.jsx(pe, { className: "ml-2 h-5 w-5" })
190
- ]
191
- },
192
- r
193
- ))
194
- ) }),
195
- /* @__PURE__ */ e.jsxs(
196
- ne,
197
- {
198
- onMouseEnter: () => c.current ? clearTimeout(c.current) : null,
199
- className: "z-10 -mt-2 flex h-full max-h-full w-[300px] flex-col gap-2 border-l border-gray-300 transition-all ease-linear",
200
- children: [
201
- /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 z-30 border-b border-gray-300 bg-gray-200 p-2 text-[9px] font-light leading-3 text-gray-500", children: g("Click on a block to add it to the page") }),
202
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2 px-2", children: L.Children.toArray(
203
- k.map((o) => /* @__PURE__ */ e.jsx(be, { block: o, library: s, closePopover: () => b(xe) }))
204
- ) }),
205
- /* @__PURE__ */ e.jsx("br", {}),
206
- /* @__PURE__ */ e.jsx("br", {}),
207
- /* @__PURE__ */ e.jsx("br", {})
208
- ]
209
- }
210
- )
211
- ] })
212
- ] }) });
213
- }, ut = () => /* @__PURE__ */ e.jsx(Be, {});
214
- export {
215
- ut as default
216
- };
@@ -1 +0,0 @@
1
- "use strict";const r=require("./jsx-runtime-Z_BpKhVy.cjs"),R=require("react"),dn=require("@radix-ui/react-toggle"),ce=require("class-variance-authority"),u=require("./utils-D_vtk3zK.cjs"),un=require("@radix-ui/react-switch"),mn=require("@radix-ui/react-slot"),pn=require("@radix-ui/react-accordion"),Y=require("@radix-ui/react-icons"),fn=require("@radix-ui/react-alert-dialog"),xn=require("@radix-ui/react-dialog"),gn=require("@radix-ui/react-label"),hn=require("@radix-ui/react-scroll-area"),bn=require("@radix-ui/react-tabs"),vn=require("@radix-ui/react-tooltip"),yn=require("@radix-ui/react-popover"),jn=require("@radix-ui/react-menubar"),kn=require("@radix-ui/react-hover-card"),wn=require("@radix-ui/react-select"),Rn=require("@radix-ui/react-dropdown-menu"),Cn=require("@radix-ui/react-separator"),An=require("@radix-ui/react-toast"),J=require("cmdk"),Sn=require("@radix-ui/react-context-menu"),jt=require("react-icons-picker"),En=require("react-dom"),l=require("lodash-es"),Nn=require("react-quill"),ae=require("./Functions-N3yhPYKY.cjs"),Ae=require("@chaibuilder/runtime"),p=require("jotai"),X=require("./MODIFIERS-mVmfEGgo.cjs"),_n=require("./_commonjsHelpers-wDK0ZLPo.cjs"),Bn=require("@react-hookz/web"),Pn=require("tree-model");require("react-i18next");function H(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const f=H(R),kt=H(dn),Le=H(un),le=H(pn),W=H(fn),I=H(xn),wt=H(gn),ie=H(hn),de=H(bn),fe=H(vn),he=H(yn),B=H(jn),Se=H(kn),q=H(wn),D=H(Rn),Rt=H(Cn),Z=H(An),L=H(Sn);var $={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};let Tn=0;function ne(e,t){const s=`atom${++Tn}`,o={toString:()=>s};return typeof e=="function"?o.read=e:(o.init=e,o.read=n=>n(o),o.write=(n,a,i)=>a(o,typeof i=="function"?i(n(o)):i)),t&&(o.write=t),o}const Pe=e=>"init"in e,Te=e=>!!e.write,we=new WeakMap,In=(e,t)=>{we.set(e,t),e.catch(()=>{}).finally(()=>we.delete(e))},lt=(e,t)=>{const s=we.get(e);s&&(we.delete(e),s(t))},ct=(e,t)=>{e.status="fulfilled",e.value=t},dt=(e,t)=>{e.status="rejected",e.reason=t},Mn=e=>typeof(e==null?void 0:e.then)=="function",xe=(e,t)=>"v"in e&&"v"in t&&Object.is(e.v,t.v),ut=(e,t)=>"e"in e&&"e"in t&&Object.is(e.e,t.e),pe=e=>"v"in e&&e.v instanceof Promise,Dn=(e,t)=>"v"in e&&"v"in t&&e.v.orig&&e.v.orig===t.v.orig,ye=e=>{if("e"in e)throw e.e;return e.v},Ct=()=>{const e=new WeakMap,t=new WeakMap,s=new Map;let o,n,a;($?"production":void 0)!=="production"&&(o=new Set,n=new Set,a=new Set);const i=m=>e.get(m),d=(m,h)=>{($?"production":void 0)!=="production"&&Object.freeze(h);const y=e.get(m);if(e.set(m,h),s.has(m)||s.set(m,y),y&&pe(y)){const b="v"in h?h.v instanceof Promise?h.v:Promise.resolve(h.v):Promise.reject(h.e);lt(y.v,b)}},x=(m,h,y)=>{const b=new Map;let j=!1;y.forEach((v,A)=>{!v&&A===m&&(v=h),v?(b.set(A,v),h.d.get(A)!==v&&(j=!0)):($?"production":void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(j||h.d.size!==b.size)&&(h.d=b)},c=(m,h,y)=>{const b=i(m),j={d:(b==null?void 0:b.d)||new Map,v:h};if(y&&x(m,j,y),b&&xe(b,j)&&b.d===j.d)return b;if(b&&pe(b)&&pe(j)&&Dn(b,j)){if(b.d===j.d)return b;j.v=b.v}return d(m,j),j},g=(m,h,y,b)=>{if(Mn(h)){let j;const v=new Promise((A,z)=>{let E=!1;h.then(T=>{if(!E){E=!0;const N=i(m),oe=c(m,v,y);ct(v,T),A(T),(N==null?void 0:N.d)!==oe.d&&U(m,oe,N==null?void 0:N.d)}},T=>{if(!E){E=!0;const N=i(m),oe=c(m,v,y);dt(v,T),z(T),(N==null?void 0:N.d)!==oe.d&&U(m,oe,N==null?void 0:N.d)}}),j=T=>{E||(E=!0,T.then(N=>ct(v,N),N=>dt(v,N)),A(T))}});return v.orig=h,v.status="pending",In(v,A=>{A&&j(A),b==null||b()}),c(m,v,y)}return c(m,h,y)},k=(m,h,y)=>{const b=i(m),j={d:(b==null?void 0:b.d)||new Map,e:h};return y&&x(m,j,y),b&&ut(b,j)&&b.d===j.d?b:(d(m,j),j)},C=m=>{const h=i(m);if(h&&(h.d.forEach((E,T)=>{T!==m&&!t.has(T)&&C(T)}),Array.from(h.d).every(([E,T])=>{const N=i(E);return E===m||N===T||N&&!pe(N)&&xe(N,T)})))return h;const y=new Map;let b=!0;const j=E=>{if(E===m){const N=i(E);if(N)return y.set(E,N),ye(N);if(Pe(E))return y.set(E,void 0),E.init;throw new Error("no atom init")}const T=C(E);return y.set(E,T),ye(T)};let v,A;const z={get signal(){return v||(v=new AbortController),v.signal},get setSelf(){return($?"production":void 0)!=="production"&&!Te(m)&&console.warn("setSelf function cannot be used with read-only atom"),!A&&Te(m)&&(A=(...E)=>{if(($?"production":void 0)!=="production"&&b&&console.warn("setSelf function cannot be called in sync"),!b)return M(m,...E)}),A}};try{const E=m.read(j,z);return g(m,E,y,()=>v==null?void 0:v.abort())}catch(E){return k(m,E,y)}finally{b=!1}},O=m=>ye(C(m)),w=m=>{let h=t.get(m);return h||(h=V(m)),h},S=(m,h)=>!h.l.size&&(!h.t.size||h.t.size===1&&h.t.has(m)),_=m=>{const h=t.get(m);h&&S(m,h)&&G(m)},F=m=>{const h=new Map,y=new WeakMap,b=v=>{const A=t.get(v);A==null||A.t.forEach(z=>{z!==v&&(h.set(z,(h.get(z)||new Set).add(v)),y.set(z,(y.get(z)||0)+1),b(z))})};b(m);const j=v=>{const A=t.get(v);A==null||A.t.forEach(z=>{var E;if(z!==v){let T=y.get(z);if(T&&y.set(z,--T),!T){let N=!!((E=h.get(z))!=null&&E.size);if(N){const oe=i(z),cn=C(z);N=!oe||!xe(oe,cn)}N||h.forEach(oe=>oe.delete(z))}j(z)}})};j(m)},P=(m,...h)=>{let y=!0;const b=A=>ye(C(A)),j=(A,...z)=>{let E;if(A===m){if(!Pe(A))throw new Error("atom not writable");const T=i(A),N=g(A,z[0]);(!T||!xe(T,N))&&F(A)}else E=P(A,...z);if(!y){const T=se();($?"production":void 0)!=="production"&&n.forEach(N=>N({type:"async-write",flushed:T}))}return E},v=m.write(b,j,...h);return y=!1,v},M=(m,...h)=>{const y=P(m,...h),b=se();return($?"production":void 0)!=="production"&&n.forEach(j=>j({type:"write",flushed:b})),y},V=(m,h)=>{const y={t:new Set(h&&[h]),l:new Set};if(t.set(m,y),($?"production":void 0)!=="production"&&a.add(m),C(m).d.forEach((b,j)=>{const v=t.get(j);v?v.t.add(m):j!==m&&V(j,m)}),C(m),Te(m)&&m.onMount){const b=m.onMount((...j)=>M(m,...j));b&&(y.u=b)}return y},G=m=>{var h;const y=(h=t.get(m))==null?void 0:h.u;y&&y(),t.delete(m),($?"production":void 0)!=="production"&&a.delete(m);const b=i(m);b?(pe(b)&&lt(b.v),b.d.forEach((j,v)=>{if(v!==m){const A=t.get(v);A&&(A.t.delete(m),S(v,A)&&G(v))}})):($?"production":void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",m)},U=(m,h,y)=>{const b=new Set(h.d.keys());y==null||y.forEach((j,v)=>{if(b.has(v)){b.delete(v);return}const A=t.get(v);A&&(A.t.delete(m),S(v,A)&&G(v))}),b.forEach(j=>{const v=t.get(j);v?v.t.add(m):t.has(m)&&V(j,m)})},se=()=>{let m;for(($?"production":void 0)!=="production"&&(m=new Set);s.size;){const h=Array.from(s);s.clear(),h.forEach(([y,b])=>{const j=i(y);if(j){j.d!==(b==null?void 0:b.d)&&U(y,j,b==null?void 0:b.d);const v=t.get(y);v&&!(b&&!pe(b)&&(xe(b,j)||ut(b,j)))&&(v.l.forEach(A=>A()),($?"production":void 0)!=="production"&&m.add(y))}else($?"production":void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if(($?"production":void 0)!=="production")return o.forEach(h=>h("state")),m},K=(m,h)=>{const y=w(m),b=se(),j=y.l;return j.add(h),($?"production":void 0)!=="production"&&(o.forEach(v=>v("sub")),n.forEach(v=>v({type:"sub",flushed:b}))),()=>{j.delete(h),_(m),($?"production":void 0)!=="production"&&(o.forEach(v=>v("unsub")),n.forEach(v=>v({type:"unsub"})))}};return($?"production":void 0)!=="production"?{get:O,set:M,sub:K,dev_subscribe_store:(m,h)=>h!==2?(console.warn("The current StoreListener revision is 2. The older ones are deprecated."),o.add(m),()=>{o.delete(m)}):(n.add(m),()=>{n.delete(m)}),dev_get_mounted_atoms:()=>a.values(),dev_get_atom_state:m=>e.get(m),dev_get_mounted:m=>t.get(m),dev_restore_atoms:m=>{for(const[y,b]of m)Pe(y)&&(g(y,b),F(y));const h=se();n.forEach(y=>y({type:"restore",flushed:h}))}}:{get:O,set:M,sub:K}};let Ie;const Ln=()=>(Ie||(Ie=Ct()),Ie);var On={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const zn=R.createContext(void 0),Ue=e=>{const t=R.useContext(zn);return(e==null?void 0:e.store)||t||Ln()};const Vn=e=>typeof(e==null?void 0:e.then)=="function",Fn=R.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)});function At(e,t){const s=Ue(t),[[o,n,a],i]=R.useReducer(c=>{const g=s.get(e);return Object.is(c[0],g)&&c[1]===s&&c[2]===e?c:[g,s,e]},void 0,()=>[s.get(e),s,e]);let d=o;(n!==s||a!==e)&&(i(),d=s.get(e));const x=t==null?void 0:t.delay;return R.useEffect(()=>{const c=s.sub(e,()=>{if(typeof x=="number"){setTimeout(i,x);return}i()});return i(),c},[s,e,x]),R.useDebugValue(d),Vn(d)?Fn(d):d}function St(e,t){const s=Ue(t);return R.useCallback((...n)=>{if((On?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return s.set(e,...n)},[s,e])}function Et(e,t){return[At(e,t),St(e,t)]}var qe={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Nt=Symbol();const mt=(e,t,s)=>(t.has(s)?t:t.set(s,e())).get(s),Un=new WeakMap,qn=(e,t,s)=>{const o=mt(()=>new WeakMap,Un,t);return mt(e,o,s)},Hn={},pt=e=>!!e.write,$n=e=>typeof e=="function";function Gn(e,t){return qn(()=>{const s=new WeakMap,o=(i,d)=>{let x=s.get(i);if(x)return x;const c=d&&s.get(d),g=[],k=[];return i.forEach((C,O)=>{const w=t?t(C):O;k[O]=w;const S=c&&c.atomList[c.keyList.indexOf(w)];if(S){g[O]=S;return}const _=P=>{const M=P(n),V=P(e),U=o(V,M==null?void 0:M.arr).keyList.indexOf(w);if(U<0||U>=V.length){const se=i[o(i).keyList.indexOf(w)];if(se)return se;throw new Error("splitAtom: index out of bounds for read")}return V[U]},F=(P,M,V)=>{const G=P(n),U=P(e),K=o(U,G==null?void 0:G.arr).keyList.indexOf(w);if(K<0||K>=U.length)throw new Error("splitAtom: index out of bounds for write");const m=$n(V)?V(U[K]):V;M(e,[...U.slice(0,K),m,...U.slice(K+1)])};g[O]=pt(e)?ne(_,F):ne(_)}),c&&c.keyList.length===k.length&&c.keyList.every((C,O)=>C===k[O])?x=c:x={arr:i,atomList:g,keyList:k},s.set(i,x),x},n=ne(i=>{const d=i(n),x=i(e);return o(x,d==null?void 0:d.arr)});(qe?"production":void 0)!=="production"&&(n.debugPrivate=!0),n.init=void 0;const a=pt(e)?ne(i=>i(n).atomList,(i,d,x)=>{switch(x.type){case"remove":{const c=i(a).indexOf(x.atom);if(c>=0){const g=i(e);d(e,[...g.slice(0,c),...g.slice(c+1)])}break}case"insert":{const c=x.before?i(a).indexOf(x.before):i(a).length;if(c>=0){const g=i(e);d(e,[...g.slice(0,c),x.value,...g.slice(c)])}break}case"move":{const c=i(a).indexOf(x.atom),g=x.before?i(a).indexOf(x.before):i(a).length;if(c>=0&&g>=0){const k=i(e);c<g?d(e,[...k.slice(0,c),...k.slice(c+1,g),k[c],...k.slice(g)]):d(e,[...k.slice(0,g),k[c],...k.slice(g,c),...k.slice(c+1)])}break}}}):ne(i=>i(n).atomList);return a},e,t||Hn)}function Yn(e){const t=Symbol(),s=ne(t);(qe?"production":void 0)!=="production"&&(s.debugPrivate=!0);const o=ne((n,a)=>{const i=n(s);return i!==t?i:e(n,a)},(n,a,i)=>{if(i===Nt)a(s,t);else if(typeof i=="function"){const d=n(o);a(s,i(d))}else a(s,i)});return o}const Wn=e=>typeof(e==null?void 0:e.then)=="function";function Kn(e){let t,s;const o={getItem:(n,a)=>{var i,d;const x=g=>{if(g=g||"",t!==g){try{s=JSON.parse(g)}catch{return a}t=g}return s},c=(d=(i=e())==null?void 0:i.getItem(n))!=null?d:null;return Wn(c)?c.then(x):x(c)},setItem:(n,a)=>{var i;return(i=e())==null?void 0:i.setItem(n,JSON.stringify(a))},removeItem:n=>{var a;return(a=e())==null?void 0:a.removeItem(n)}};return typeof window<"u"&&typeof window.addEventListener=="function"&&(o.subscribe=(n,a,i)=>{if(!(e()instanceof window.Storage))return()=>{};const d=x=>{if(x.storageArea===e()&&x.key===n){let c;try{c=JSON.parse(x.newValue||"")}catch{c=i}a(c)}};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}}),o}const Xn=Kn(()=>typeof window<"u"?window.localStorage:void 0);function ue(e,t,s=Xn,o){const n=o==null?void 0:o.unstable_getOnInit,a=ne(n?s.getItem(e,t):t);return(qe?"production":void 0)!=="production"&&(a.debugPrivate=!0),a.onMount=d=>{n||d(s.getItem(e,t));let x;return s.subscribe&&(x=s.subscribe(e,d,t)),x},ne(d=>d(a),(d,x,c)=>{const g=typeof c=="function"?c(d(a)):c;return g===Nt?(x(a,t),s.removeItem(e)):g instanceof Promise?g.then(k=>(x(a,k),s.setItem(e,k))):(x(a,g),s.setItem(e,g))})}const He=p.atom(null);He.debugLabel="chaiBuilderPropsAtom";const _t=p.atom({});_t.debugLabel="chaiExternalDataAtom";const Jn=()=>!1,Zn=e=>{const t=e.replace(X.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},Oe=l.memoize((e,t)=>{if(!e)return!0;const s=Ae.getBlockComponent(e);return s&&l.has(s,"canAcceptBlock")?s.canAcceptBlock(t):!1}),Ri=l.memoize((e,t)=>{const s=Ae.getBlockComponent(t);return s&&l.has(s,"canBeNested")?s.canBeNested(e):!0}),Qn=l.memoize(e=>{const t=Ae.getBlockComponent(e);return t&&l.has(t,"canDuplicate")?t.canDuplicate():!0}),er=l.memoize(e=>{const t=Ae.getBlockComponent(e);return t&&l.has(t,"canDelete")?t.canDelete():!0});function Bt(e,t,s){const o=l.filter(e,a=>a._parent===t),n=[];for(let a=0;a<o.length;a++){const i=Tt(o[a]);if(Object.keys(i).length>0&&Object.keys(i).forEach(d=>{o[a][d]=`slot:${ae.generateUUID()}`}),l.filter(e,{_parent:o[a]._id}).length>0){const d=ae.generateUUID();n.push({...o[a],oldId:o[a]._id,_id:d,_parent:s}),n.push(l.flatten(Bt(e,o[a]._id,d)))}else n.push({...o[a],oldId:o[a]._id,_id:ae.generateUUID(),_parent:s})}return l.flatten(n)}function Pt(e){const t={};e.forEach(o=>{t[o._id]={...o,children:[]}});const s=[];return e.forEach(o=>{if(o._parent){const n=t[o._parent];n&&n.children.push(t[o._id])}else s.push(t[o._id])}),s}const Tt=e=>{const t={};return Object.keys(e).forEach(s=>{l.isString(e[s])&&e[s].startsWith("slot")&&(t[s]=e[s].replace("slot:",""))}),t},tr=(e,t,s=null)=>{let o=l.find(e,{_id:t});o={...o,oldId:o._id,_id:ae.generateUUID()},s&&(o={...o,_parent:s});const n=[o];l.filter(e,{_parent:t}).length>0&&n.push(l.flatten(Bt(e,t,o._id)));const a=l.flatten(n);return l.map(a,i=>{const d=i,x=Tt(d);return Object.keys(x).length>0&&Object.keys(x).forEach(c=>{const g=l.find(a,{oldId:x[c].replace("slot:","")});d[c]=`slot:${g._id}`}),l.omit(d,["global","oldId"])})};const ee=p.atom([]);ee.debugLabel="presentBlocksAtom";const It=p.atom(e=>{const t=e(ee);return Pt([...t])});It.debugLabel="treeDSBlocks";ee.debugLabel="presentBlocksAtom";const $e=Gn(ee);$e.debugLabel="pageBlocksAtomsAtom";const sr=p.atom("");sr.debugLabel="builderActivePageAtom";const or=p.atom(-1);or.debugLabel="destinationDropIndexAtom";const Mt=p.atom([]);Mt.debugLabel="buildingBlocksAtom";const nr=p.atom(e=>{const t=e(Mt);return l.filter(t,s=>l.has(s,"blockId"))});nr.debugLabel="globalBlocksAtom";const Ge=p.atom([]);Ge.debugLabel="selectedBlockIdsAtom";const Ye=p.atom(e=>{const t=e(ee),s=e(Ge);return l.map(l.filter(t,({_id:o})=>l.includes(s,o)),o=>({...o}))});Ye.debugLabel="selectedBlocksAtom";const Ee=p.atom(e=>{const t=e(Ye);if(t.length===0)return null;if(t.length===1)return t[0]});Ee.debugLabel="selectedBlockAtom";const rr=e=>l.get(e,"_parent",null),ar=p.atom(e=>{const t=e(Ye),s=l.map(t,rr);return l.filter(e(ee),o=>l.includes(s,o._id))});ar.debugLabel="selectedBlocksParentsAtom";const Dt=p.atom(()=>!1);Dt.debugLabel="selectedBlockFlexChildAtom";const Lt=p.atom(()=>!1);Lt.debugLabel="selectedBlockGridChildAtom";const We=p.atom("");We.debugLabel="styleStateAtom";const Ot=ue("styleBreakpoint","xs");Ot.debugLabel="styleBreakpointAtom";const ir=()=>({flexChild:p.useAtomValue(Dt),gridChild:p.useAtomValue(Lt)}),lr=()=>p.useAtomValue(Ee),Ci=p.atom(e=>{const t=e(Ee),s=e(ee);let o=t;const n=[t];do{const a=s.find(({_id:i})=>i===(o==null?void 0:o._parent));o=a,a&&n.push(a)}while(o!=null&&o._parent);return n});const be=()=>{const[e,t]=p.useAtom(Ge),s=R.useCallback(o=>{t(n=>l.includes(n,o)?l.without(n,o):[...n,o])},[t]);return[e,t,s]},ze=e=>{switch(e.type){case"singular":return e.uiSchema;case"model":const{properties:t}=e,s={};return Object.keys(t).forEach(a=>{const i=t[a];if(l.includes(["slot","styles"],i.type))return;const d=a;s[d]=ze(i)}),s;case"list":const{itemProperties:o}=e,n={items:{}};return Object.keys(o).forEach(a=>{const i=o[a];if(l.includes(["slot","styles"],i.type))return;const d=a;n.items[d]=ze(i)}),n;default:return{}}},Ve=e=>{switch(e.type){case"singular":return e.schema;case"model":const{properties:t,title:s}=e,o={title:s,type:"object",properties:{}};return Object.keys(t).forEach(d=>{const x=t[d];if(l.includes(["slot","styles"],x.type))return;const c=d;o.properties[c]=Ve(x)}),o;case"list":const{itemProperties:n,title:a}=e,i={title:a,type:"array",items:{type:"object",properties:{}}};return Object.keys(n).forEach(d=>{const x=n[d];if(l.includes(["slot","styles"],x.type))return;const c=d;i.items.properties[c]=Ve(x),l.set(i.items,"title",l.get(x,"itemTitle",`${a} item`))}),i;default:return{}}},zt=e=>{if(!e)return{};const t={};return Object.keys(e).forEach(s=>{t[s]=dr(e[s])}),t},cr=e=>{if(l.isEmpty(e.default))return[];const{itemProperties:t}=e;return l.map(e.default,s=>{const o={...s};return l.forIn(s,(n,a)=>{l.has(t,a)&&l.get(t[a],"i18n",!1)&&(o[a]=X.I18N_KEY)}),o})},dr=e=>{switch(e.type){case"styles":return e.default;case"slot":return`${X.SLOT_KEY}${ae.generateUUID()}`;case"singular":const{schema:t}=e;return l.get(t,"default","");case"model":return zt(e.properties);case"list":return cr(e);default:return""}};const ur=(e,t)=>{const s={};return l.set(s,e,t),s};var Ke={exports:{}},Ai=Ke.exports;(function(e){(function(){"use strict";function t(o,n,a){return o.splice(n,!a||1+a-n+(!(a<0^n>=0)&&(a<0||-1)*o.length)),o.length}let s=function(){let o=[],n=-1,a=0,i=!1,d;function x(c,g){return!c||typeof c[g]!="function"?this:(i=!0,c[g](),i=!1,this)}return{add:function(c){return i?this:(o.splice(n+1,o.length-n),o.push(c),a&&o.length>a&&t(o,0,-(a+1)),n=o.length-1,d&&d(),this)},setCallback:function(c){d=c},undo:function(){let c=o[n];if(!c)return this;const g=c.groupId;for(;c.groupId===g&&(x(c,"undo"),n-=1,c=o[n],!(!c||!c.groupId)););return d&&d(),this},redo:function(){let c=o[n+1];if(!c)return this;const g=c.groupId;for(;c.groupId===g&&(x(c,"redo"),n+=1,c=o[n+1],!(!c||!c.groupId)););return d&&d(),this},clear:function(){let c=o.length;o=[],n=-1,d&&c>0&&d()},hasUndo:function(){return n!==-1},hasRedo:function(){return n<o.length-1},getCommands:function(c){return c?o.filter(g=>g.groupId===c):o},getIndex:function(){return n},setLimit:function(c){a=c}}};e.exports?e.exports=s:window.UndoManager=s})()})(Ke);var mr=Ke.exports;const pr=_n.getDefaultExportFromCjs(mr),fr=p.atom(X.BRANDING_OPTIONS_DEFAULTS),xr=p.atom(null),Xe=()=>{const[e,t]=p.useAtom(fr);return[l.isObject(e)?{...X.BRANDING_OPTIONS_DEFAULTS,...e}:X.BRANDING_OPTIONS_DEFAULTS,t]},gr=()=>p.useAtom(xr),hr=p.atom(null),Vt=()=>({currentPage:p.useAtomValue(hr)});function Ft(e){return Pt(e)}const Je=(e,t)=>l.flatten(e.map(s=>{if(s=t?{...s,_parent:t}:{...s},s.children){const o=[...s.children];return delete s.children,l.flatten([s,...Je(o,s._id)])}return s}));function Ze(e,t=!1){for(let s=0;s<e.length;s++){const o=e[s];o.global&&!t?e[s]={type:"GlobalBlock",blockId:o.blockId,_parent:l.get(o,"_parent",null),_id:o._id}:o.children&&o.children.length&&Ze(o.children)}}function Ut(e){let t=[],s=l.filter(e,{type:"GlobalBlock"});return s.length>0&&(s=l.map(s,qt),l.each(s,o=>{t=[...t,...br(o)]})),t}function br(e){let t=[];const s=l.get(l.first(e),"_parent",null);l.set(l.first(e),"_parent",null);const o=[flatToNestedInstance.convert(Ht(e))];Ze(o,!0);let n=Je(o,e[0]._id);return n=l.set(n,"0._parent",s),t=[...t,n,...Ut(n)],t}function qt(e){const t=l.find(Fe,{_id:e._id});if(!t)return[];const s=[t],o=l.filter(Fe,{_parent:e._id});return o.length?l.flatten([...s,...l.flatten(l.map(o,qt))]):l.flatten(s)}const Ht=e=>JSON.parse(JSON.stringify(e));let Fe=[];function vr(e){Fe=e;const t=Ft(Ht(e));Ze(t);const s=Je(t,null),o=Ut(s),n={};return l.each(o,a=>l.set(n,l.first(a).blockId,a)),[s,n]}const $t=()=>{const[e]=Xe(),{currentPage:t}=Vt(),[s]=me();return R.useCallback(()=>{const o=l.map(s,a=>l.omit(a,["expanded","order","title","siblings","tempClasses"])),[n=[]]=vr(o);return{currentPage:t,blocks:n}},[e,t,s])},Q=(e,t=void 0)=>{const s=p.useAtomValue(He);return l.get(s,e,t)},Qe=p.atom([]);Qe.debugLabel="dataProvidersAtom";const Gt=()=>p.useAtom(Qe),Ne=p.atom("SAVED");Ne.debugLabel="builderSaveStateAtom";const yr=()=>{const[e,t]=p.useAtom(Ne),s=Q("onSavePage",async c=>{}),o=Q("onSave",async c=>{}),n=Q("onSaveStateChange",l.noop),a=$t(),[i]=Gt(),[d]=Xe();return{savePage:Bn.useThrottledCallback(async()=>{t("SAVING"),n("SAVING");const c=a();return await s({blocks:c.blocks,providers:i}),await o({blocks:c.blocks,providers:i,brandingOptions:d,themeConfiguration:d}),setTimeout(()=>{t("SAVED"),n("SAVED")},100),!0},[a,t,d,o,n],3e3),saveState:e,setSaveState:t}},re=new pr;re.setLimit(50);const et=()=>{const[,e]=p.useAtom(Ne),t=Q("onSaveStateChange",l.noop);return R.useEffect(()=>(re.setCallback(()=>{e("UNSAVED"),t("UNSAVED")}),()=>{re.setCallback(l.noop)}),[]),{add:re.add,undo:re.undo,redo:re.redo,hasRedo:re.hasRedo,hasUndo:re.hasUndo,clear:re.clear}},tt=(e,t)=>{const s=[],o=l.filter(e,n=>l.includes(t,n._id)||l.includes(t,n._parent)?(s.push(n._id),!1):!0);return l.isEmpty(s)?o:tt(o,s)},jr=()=>{const[e]=me(),[t,s]=be(),{setNewBlocks:o}=te();return R.useCallback(n=>{var i;const a=((i=l.find(e,{_id:n[0]}))==null?void 0:i._parent)||null;o(tt(e,n)),setTimeout(()=>s(a?[a]:[]),200)},[e,s,t])};function kr(e,t,s,o){let n=e.filter(d=>!d._parent);s&&(n=e.filter(d=>d._parent===s));const a=o!==void 0?o:n.length;let i=e.length;for(let d=0,x=0;d<e.length;d++)if(e[d]._parent===s){if(x===a){i=d;break}x++}return!s&&o!==void 0&&o>=n.length&&(i=e.length),[...e.slice(0,i),...t,...e.slice(i)]}function wr(e){let t=[];return e.walk(s=>(delete s.model.children,t.push(s.model),!0)),t}function ft(e,t){return e.first(s=>s.model._id===t)||null}function Rr(e,t,s,o){const n=ft(e,t),a=ft(e,s);if(n&&a){n.drop(),a.children||(a.model.children=[]);try{a.addChildAtIndex(n,o)}catch(i){return console.error("Error adding child to parent:",i),!1}return!0}return!1}function Cr(e,t,s,o){if(!t)return e;s=s||"root";const a=new Pn().parse({_id:"root",children:Ft(e)});if(Rr(a,t,s,o)){const i=wr(a),d=i.find(x=>x._id===t);return d&&(d._parent=s==="root"?null:s),i.shift(),i}return e}const Ar=()=>{const[,e]=me();return{setNewBlocks:t=>{e(t)},addBlocks:(t,s,o)=>{e(n=>kr(n,t,s,o))},removeBlocks:t=>{e(s=>tt(s,t))},moveBlocks:(t,s,o)=>{e(n=>{let a=n;for(let i=0;i<t.length;i++)a=Cr(a,t[i],s,o);return a})},updateBlocksProps:t=>{e(s=>{const o=t.map(n=>n._id);return s.map(n=>{if(o.includes(n._id)){const a=l.find(t,{_id:n._id});return{...n,...l.omit(a,"_id")}}return n})})}}},me=()=>p.useAtom(ee),te=()=>{const{add:e}=et(),[t]=me(),{setNewBlocks:s,addBlocks:o,removeBlocks:n,moveBlocks:a,updateBlocksProps:i}=Ar();return{moveBlocks:(w,S,_)=>{const F=l.map(w,M=>{const G=t.find(K=>K._id===M)._parent||null,se=t.filter(K=>G?K._parent===G:!K._parent).map(K=>K._id).indexOf(M);return{_id:M,oldParent:G,oldPosition:se}}),P=F.find(({_id:M})=>M===w[0]);P&&P.oldParent===S&&P.oldPosition===_||(a(w,S,_),e({undo:()=>l.each(F,({_id:M,oldParent:V,oldPosition:G})=>{a([M],V,G)}),redo:()=>a(w,S,_)}))},addBlocks:(w,S,_)=>{o(w,S,_),e({undo:()=>n(l.map(w,"_id")),redo:()=>o(w,S,_)})},removeBlocks:w=>{var P;const S=(P=l.first(w))==null?void 0:P._parent,F=t.filter(M=>S?M._parent===S:!M._parent).indexOf(l.first(w));n(l.map(w,"_id")),e({undo:()=>o(w,S,F),redo:()=>n(l.map(w,"_id"))})},updateBlocks:(w,S,_)=>{let F=[];if(_)F=l.map(w,P=>({_id:P,..._}));else{const P=l.keys(S);F=l.map(w,M=>{const V=t.find(U=>U._id===M),G={_id:M};return l.each(P,U=>G[U]=V[U]),G})}i(l.map(w,P=>({_id:P,...S}))),e({undo:()=>i(F),redo:()=>i(l.map(w,P=>({_id:P,...S})))})},updateBlocksRuntime:(w,S)=>{i(l.map(w,_=>({_id:_,...S})))},setNewBlocks:w=>{s(w),e({undo:()=>s(t),redo:()=>s(w)})},updateMultipleBlocksProps:w=>{let S=[];S=l.map(w,_=>{const F=l.keys(_),P=t.find(V=>V._id===_._id),M={};return l.each(F,V=>M[V]=P[V]),M}),i(w),e({undo:()=>i(S),redo:()=>i(w)})}}},Sr=()=>{const[e]=me(),[,t]=be(),{addBlocks:s}=te(),o=R.useCallback((a,i,d)=>{var C;for(let O=0;O<a.length;O++){const{_id:w}=a[O];a[O]._id=ae.generateUUID();const S=l.filter(a,{_parent:w});for(let _=0;_<S.length;_++)S[_]._parent=a[O]._id}const x=l.first(a);let c,g;return i&&(c=l.find(e,{_id:i}),a[0]._parent=i,g=i),!(c?Oe(c==null?void 0:c._type,x._type):!0)&&c&&(a[0]._parent=c._parent,g=c._parent),s(a,g,d),t([(C=l.first(a))==null?void 0:C._id]),l.first(a)},[e,t]);return{addCoreBlock:R.useCallback((a,i,d)=>{if(l.has(a,"blocks")){const _=a.blocks;return o(_,i,d)}const x=ae.generateUUID(),c=zt(a.props),g=[];l.forIn(c,(_,F)=>{if(l.startsWith(_,X.SLOT_KEY)){const P=_.replace(X.SLOT_KEY,"");g.push({_id:P,_type:"Slot",_parent:x,_name:a.props[F].name,_styles:a.props[F].styles,_emptyStyles:a.props[F].emptyStyles})}});const k={_type:a.type,_id:x,...c};let C,O;i&&(C=l.find(e,{_id:i}),k._parent=i,O=i),!Oe(C==null?void 0:C._type,k._type)&&C&&(k._parent=C._parent,O=C._parent);const S=[k,...g];return s(S,O,d),t([k._id]),k},[o,e,t]),addPredefinedBlock:o}},xt={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},gt=["xs","sm","md","lg","xl","2xl"];function Er(e,t){if(t===null)return"baseClasses";const s=t.mq;if(s==="xs"||t.dark||t.mod!=="")return"classes";let o="baseClasses",n=gt.indexOf(s);for(;n>0;){const a=gt[n-1];if(l.find(e,{mq:a,property:t.property})){o="classes";break}n--}return o}const ht=[];function Nr(e="",t="",s=[]){e=e.trim().replace(/ +/g,"");let o=l.filter(l.map(e.split(" "),u.constructClassObject),c=>!l.isNull(c)),n=l.filter(l.map(t.split(" "),u.constructClassObject),c=>!l.isNull(c));n=l.filter(n,c=>!l.includes(ht,c.property));const a=[],i=[];l.each(s,c=>{const g=u.constructClassObject(c),k=l.find(o,l.pick(g,["dark","mq","mod","property"]));if(k&&(o=l.filter(o,C=>C.fullCls!==(k==null?void 0:k.fullCls))),a.push(g),g.mq==="xs"&&!g.dark&&g.mod===""&&(n=l.filter(n,C=>C.property!==g.property)),Er(o,g)==="baseClasses"&&!l.includes(ht,g.property)){const C=l.find(n,l.pick(g,["property"]));k&&(n=l.filter(n,O=>O.fullCls!==(C==null?void 0:C.fullCls))),i.push({...g,fullCls:g.cls,mq:"xs"})}});const d=l.map(l.sortBy([...o,...a],c=>xt[c.mq]),"fullCls").join(" ");return`${l.map(l.sortBy([...n,...i],c=>xt[c.mq]),"fullCls").join(" ").trim()},${d.trim()}`.trim().replace(/ +/g,"")}const ve=p.atom([]);ve.debugLabel="selectedStylingBlocksAtom";const Yt=()=>p.useAtom(ve),_r=e=>{const t=e.replace(X.STYLES_KEY,"").split(",");return{baseClasses:t[0],classes:t[1]}},Br=p.atom(null,(e,t,{blockIds:s,newClasses:o})=>{const n=l.filter(e($e),i=>s.includes(e(i)._id)),a=l.first(e(ve));return l.map(n,i=>{const d=e(i),x=l.get(d,a.prop,`${X.STYLES_KEY},`),{baseClasses:c,classes:g}=_r(x);return{ids:[d._id],props:{[a.prop]:`${X.STYLES_KEY}${Nr(g,c,o)}`}}})}),Pr=()=>{const e=p.useSetAtom(Br),{updateBlocks:t,updateBlocksRuntime:s}=te();return R.useCallback((o,n,a=!1)=>{const i=e({blockIds:o,newClasses:n});if(!a){s(o,i[0].props);return}t(o,i[0].props)},[e])},Wt=()=>p.useAtom(Ot),Kt=ue("canvasWidth",800),Xt=p.atom(e=>{const t=e(Kt);return ae.getBreakpointValue(t).toLowerCase()}),Tr=()=>{const[e,t]=p.useAtom(Kt),s=p.useAtomValue(Xt),[o,n]=Wt();return R.useEffect(()=>{o!=="xs"&&n(s)},[s,o,n]),[e,s,t]},Ir=ue("canvasZoom",100),Mr=()=>p.useAtom(Ir),Jt=p.atom([]),Zt=()=>{const[e,t]=p.useAtom(Jt),s=p.useSetAtom(st),o=R.useCallback(n=>{t(n),s([])},[t,s]);return[e,o]},st=p.atom([]),Dr=()=>{const[e,t]=p.useAtom(st),s=p.useSetAtom(Jt),o=R.useCallback(n=>{t(n),s([])},[t,s]);return[e,o]},Qt=ue("darkMode",!1),Lr=()=>{const[e,t]=p.useAtom(Qt);return[e,t]},es=()=>{const[e]=me(),[,t]=be(),{addBlocks:s}=te();return R.useCallback((o,n=null)=>{const a=[];l.each(o,i=>{const d=e.find(C=>C._id===i);n||(n=d._parent);const g=l.filter(e,C=>l.isString(n)?C._parent===n:!d._parent).indexOf(d)+1,k=tr(e,i,n);s(k,n,g),a.push(l.get(k,"0._id",""))}),t(a)},[e,t])},Or=p.atom([]),zr=()=>{const[e,t]=p.useAtom(Or),s=R.useCallback(o=>{t(n=>l.includes(n,o)?l.without(n,o):[...n,o])},[t]);return[e,t,s]},Vr=p.atom(""),ts=()=>p.useAtom(Vr),Fr=()=>{const e=p.useAtomValue(ee);return R.useCallback((t,s)=>{const o=l.map(e,n=>(l.includes(t,l.get(n,"_id"))&&l.set(n,"_parent",s),n));console.log("newBlocks",o)},[e])},Ur=()=>{console.warn("usePasteBlocks is not implemented");const e=p.useAtomValue(st),[t,s]=Zt(),o=es(),n=Fr();return{canPaste:R.useMemo(()=>t.length>0||e.length>0,[e,t]),pasteBlocks:R.useCallback(i=>{l.isEmpty(e)?n(t,i):o(e,i),s(()=>[])},[t,e,o,n,s])}},qr=p.atom(!1),Hr=()=>{const[e,t]=p.useAtom(qr);return[e,t]},$r=p.atom(null,(e,t,{blockIds:s,fullClasses:o})=>{const n=l.first(e(ve)),a=l.filter(e($e),i=>s.includes(e(i)._id));return l.map(a,i=>{const d=e(i),x=o;let{classes:c,baseClasses:g}=Zn(l.get(d,n.prop,"styles:,"));return l.each(x,k=>{const C=k.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),O=new RegExp(`(^| )${C}($| )`,"g");c=c.replace(O," ").replace(/ +/g," ").trim();const w=l.first(k.split(":"));l.includes(["2xl","xl","lg","md","sm"],w)&&x.push(k.split(":").pop().trim())}),l.each(x,k=>{const C=new RegExp(`(^| )${k.replace("[","\\[").replace("]","\\]")}($| )`,"g");g=g.replace(C," ").replace(/ +/g," ").trim()}),{ids:[d._id],props:{[n.prop]:`${X.STYLES_KEY}${g},${c}`}}})}),Gr=()=>{const{updateBlocks:e}=te(),t=p.useSetAtom($r);return R.useCallback((s,o)=>{const n=t({blockIds:s,fullClasses:o});e(s,n[0].props)},[t])},ss=p.atom(e=>{const t=l.first(e(ve)),s=e(Ee);if(!t||t.blockId!==l.get(s,"_id",null))return[];const n=l.get(s,t.prop,`${X.STYLES_KEY},`).replace(X.STYLES_KEY,"").split(",").join(" ");return l.filter(l.map(n.trim().split(" "),u.constructClassObject),a=>!l.isNull(a))}),Yr=()=>p.useAtomValue(ss),bt={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},Wr=p.atom(e=>{const t=e(Xt),s=e(We),o=e(Qt),n=Kr(t);let a=l.filter(e(ss),{mod:s});return l.startsWith(s,"_")||(a=l.filter(a,i=>n.includes(i.mq))),a=a.sort((i,d)=>bt[i.mq]-bt[d.mq]),o||(a=l.filter(a,{dark:!1})),a}),Kr=e=>{let t=[];switch(e){case"xs":t=["xs"];break;case"sm":t=["xs","sm"];break;case"md":t=["xs","sm","md"];break;case"lg":t=["xs","sm","md","lg"];break;case"xl":t=["xs","sm","md","lg","xl"];break;case"2xl":t=["xs","sm","md","lg","xl","2xl"];break;default:t=["xs"];break}return t},Xr=()=>p.useAtomValue(Wr),Jr=()=>p.useAtom(We),Zr=()=>{const{updateBlocks:e}=te();return R.useCallback((t,s,o)=>{e(t,s,o)},[e])},Qr=()=>{const{updateMultipleBlocksProps:e}=te();return R.useCallback(t=>{e(t)},[e])},ea=()=>{const{updateBlocksRuntime:e}=te();return R.useCallback(async(t,s,o=30)=>{const n=l.keys(l.omit(s,["_id"]));for(const a of n){const i=s[a];if(l.isString(i)){const d=l.chunk(i.split(""),12);let x="";e([t],{[a]:""});for(let c=0;c<d.length;c++)x+=d[c].join(""),e([t],{[a]:x}),await new Promise(g=>setTimeout(g,o))}}},[e])},ta=()=>{const{updateMultipleBlocksProps:e}=te(),t=ea();return R.useCallback(async s=>{for(const o of s)await t(o._id,o);e(s)},[e])},sa=()=>{const{updateBlocksRuntime:e}=te();return R.useCallback((t,s)=>{e(t,s)},[e])},os={name:"",props:{},modalProps:{},backdropClose:!0},oa=p.atom(os),na=()=>{const[e,t]=p.useAtom(oa),s=R.useCallback((n,a={},i={})=>{t({name:n,props:a,modalProps:i})},[t]),o=R.useCallback((...n)=>{l.get(e,"props.onClose",()=>{})(...n),t(os)},[t,e]);return{activeModal:e,openModal:s,closeModal:o}},ra=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),p.useAtomValue(ee)),ns=p.atom(!1);ns.debugLabel="readOnlyModeAtom";const rs=p.atom("online");rs.debugLabel="networkModeAtom";const aa=p.atom(!1);aa.debugLabel="editLayerNameAtom";const ia=p.atom("");ia.debugLabel="activeLanguageAtom";const la=p.atom("");la.debugLabel="primaryLanguageAtom";const as=p.atom(null);as.debugLabel="canvasIframeAtom";const is=p.atom("outline");is.debugLabel="activePanelAtom";const ls=p.atom("");ls.debugLabel="showPredefinedBlockCategoryAtom";const cs=p.atom({undoCount:0,redoCount:0});cs.debugLabel="historyStatesAtom";const ds=p.atom("");ds.debugLabel="inlineEditingActiveAtom";const us=p.atom(!1);us.debugLabel="draggingFlagAtom";const ms=p.atom("");ms.debugLabel="draggedBlockIdAtom";const ps=p.atom(null);ps.debugLabel="treeRefAtom";const fs=p.atom({});fs.debugLabel="canvasSettingsAtom";const ot=p.atom(!1);ot.debugLabel="askAiActiveBlockAtom";const ca=p.atom(!1);ca.debugLabel="codeEditorOpenAtom";const da=ue("codeEditorHeight",500);da.debugLabel="codeEditorHeightAtom";const xs=p.atom([]);xs.debugLabel="xShowBlocksAtom";const ua=()=>p.useAtomValue(ns),ma=p.atom(""),pa=p.atom(null),fa=()=>p.useAtom(ma),xa=()=>p.useAtom(pa),ga=ue("selectedBreakpoints",["XS","MD","XL"]),ha=()=>{const[e,t]=p.useAtom(ga);return[e,t]},ba=()=>{const e=p.useSetAtom(cs),{clear:t}=et(),[,s]=be(),[,o]=ts(),[,n]=Yt(),[,a]=Et(ot);return()=>{s([]),n([]),o(""),t(),a(!1),e({undoCount:0,redoCount:0})}},va=()=>({data:Q("uiLibraries",[]),isLoading:!1}),ya=()=>{const[e,t]=R.useState(null),s=R.useCallback(async o=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(o),t(o),!0}catch(n){return console.warn("Copy failed",n),t(null),!1}},[]);return[e,s]},ja=p.atom(null),ka=()=>p.useAtom(ja),gs=ce.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),hs=f.forwardRef(({className:e,variant:t,size:s,...o},n)=>r.jsxRuntimeExports.jsx(kt.Root,{ref:n,className:u.cn(gs({variant:t,size:s,className:e})),...o}));hs.displayName=kt.Root.displayName;const bs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Le.Root,{className:u.cn("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-slate-900 data-[state=unchecked]:bg-slate-200 dark:focus-visible:ring-slate-800 dark:focus-visible:ring-offset-slate-950 dark:data-[state=checked]:bg-slate-50 dark:data-[state=unchecked]:bg-slate-800",e),...t,ref:s,children:r.jsxRuntimeExports.jsx(Le.Thumb,{className:u.cn("pointer-events-none block h-5 w-5 rounded-full bg-white shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 dark:bg-slate-950")})}));bs.displayName=Le.Root.displayName;const _e=ce.cva("inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),vs=f.forwardRef(({className:e,variant:t,size:s,asChild:o=!1,...n},a)=>{const i=o?mn.Slot:"button";return r.jsxRuntimeExports.jsx(i,{className:u.cn(_e({variant:t,size:s,className:e})),ref:a,...n})});vs.displayName="Button";const wa=le.Root,ys=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(le.Item,{ref:s,className:u.cn("border-b",e),...t}));ys.displayName="AccordionItem";const js=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsx(le.Header,{className:"flex",children:r.jsxRuntimeExports.jsxs(le.Trigger,{ref:o,className:u.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...s,children:[t,s.hideArrow?null:r.jsxRuntimeExports.jsx(Y.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));js.displayName=le.Trigger.displayName;const ks=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsx(le.Content,{ref:o,className:u.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",e),...s,children:r.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:t})}));ks.displayName=le.Content.displayName;const Ra=ce.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ws=f.forwardRef(({className:e,variant:t,...s},o)=>r.jsxRuntimeExports.jsx("div",{ref:o,role:"alert",className:u.cn(Ra({variant:t}),e),...s}));ws.displayName="Alert";const Rs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("h5",{ref:s,className:u.cn("mb-1 font-medium leading-none tracking-tight",e),...t}));Rs.displayName="AlertTitle";const Cs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("text-sm [&_p]:leading-relaxed",e),...t}));Cs.displayName="AlertDescription";const As=ce.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}}),Ca=({className:e,variant:t,...s})=>r.jsxRuntimeExports.jsx("div",{className:u.cn(As({variant:t}),e),...s}),Aa=W.Root,Sa=W.Trigger,Ss=({className:e,...t})=>r.jsxRuntimeExports.jsx(W.Portal,{className:u.cn(e),...t});Ss.displayName=W.Portal.displayName;const Es=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Overlay,{className:u.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:s}));Es.displayName=W.Overlay.displayName;const Ns=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsxs(Ss,{children:[r.jsxRuntimeExports.jsx(Es,{}),r.jsxRuntimeExports.jsx(W.Content,{ref:s,className:u.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...t})]}));Ns.displayName=W.Content.displayName;const _s=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});_s.displayName="AlertDialogHeader";const Bs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Bs.displayName="AlertDialogFooter";const Ps=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Title,{ref:s,className:u.cn("text-lg font-semibold",e),...t}));Ps.displayName=W.Title.displayName;const Ts=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Ts.displayName=W.Description.displayName;const Is=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Action,{ref:s,className:u.cn(_e(),e),...t}));Is.displayName=W.Action.displayName;const Ms=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(W.Cancel,{ref:s,className:u.cn(_e({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Ms.displayName=W.Cancel.displayName;const nt=I.Root,Ds=I.Trigger,Ls=({className:e,...t})=>r.jsxRuntimeExports.jsx(I.Portal,{className:u.cn(e),...t});Ls.displayName=I.Portal.displayName;const Os=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Overlay,{ref:s,className:u.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Os.displayName=I.Overlay.displayName;const Be=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(Ls,{children:[r.jsxRuntimeExports.jsx(Os,{}),r.jsxRuntimeExports.jsxs(I.Content,{ref:o,className:u.cn("fixed left-[50%] top-[50%] z-[999] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...s,children:[t,r.jsxRuntimeExports.jsxs(I.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsxRuntimeExports.jsx(Y.Cross2Icon,{className:"h-4 w-4"}),r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Be.displayName=I.Content.displayName;const zs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});zs.displayName="DialogHeader";const Vs=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Vs.displayName="DialogFooter";const Fs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Title,{ref:s,className:u.cn("text-lg font-semibold leading-none tracking-tight",e),...t}));Fs.displayName=I.Title.displayName;const Us=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Us.displayName=I.Description.displayName;const qs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("rounded-xl border bg-card text-card-foreground shadow",e),...t}));qs.displayName="Card";const Hs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("flex flex-col space-y-1.5 p-6",e),...t}));Hs.displayName="CardHeader";const $s=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("h3",{ref:s,className:u.cn("font-semibold leading-none tracking-tight",e),...t}));$s.displayName="CardTitle";const Gs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("p",{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Gs.displayName="CardDescription";const Ys=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn("p-6 pt-0",e),...t}));Ys.displayName="CardContent";const Ws=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("div",{ref:s,className:u.cn(" flex items-center p-6 pt-0",e),...t}));Ws.displayName="CardFooter";const Ks=f.forwardRef(({className:e,type:t,...s},o)=>r.jsxRuntimeExports.jsx("input",{type:t,className:u.cn("flex h-9 w-full rounded-md border border-border bg-background px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:o,...s,autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}));Ks.displayName="Input";const Ea=ce.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Xs=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(wt.Root,{ref:s,className:u.cn(Ea(),e),...t}));Xs.displayName=wt.Root.displayName;const Js=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx("textarea",{className:u.cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:s,...t,autoCapitalize:"off",autoCorrect:"off",spellCheck:"false"}));Js.displayName="Textarea";const Zs=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(ie.Root,{ref:o,className:u.cn("relative overflow-hidden",e),...s,children:[r.jsxRuntimeExports.jsx(ie.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsxRuntimeExports.jsx(rt,{}),r.jsxRuntimeExports.jsx(ie.Corner,{})]}));Zs.displayName=ie.Root.displayName;const rt=f.forwardRef(({className:e,orientation:t="vertical",...s},o)=>r.jsxRuntimeExports.jsx(ie.ScrollAreaScrollbar,{ref:o,orientation:t,className:u.cn("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",e),...s,children:r.jsxRuntimeExports.jsx(ie.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));rt.displayName=ie.ScrollAreaScrollbar.displayName;const Qs=de.Root,at=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(de.List,{ref:s,className:u.cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));at.displayName=de.List.displayName;const Re=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(de.Trigger,{ref:s,className:u.cn("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Re.displayName=de.Trigger.displayName;const Ce=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(de.Content,{ref:s,className:u.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Ce.displayName=de.Content.displayName;const Na=fe.Portal,_a=fe.Provider,Ba=fe.Root,Pa=fe.Trigger,eo=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>r.jsxRuntimeExports.jsx(fe.Content,{ref:o,sideOffset:t,className:u.cn("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s}));eo.displayName=fe.Content.displayName;const Ta=he.Root,Ia=he.Trigger,to=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},n)=>r.jsxRuntimeExports.jsx(he.Portal,{children:r.jsxRuntimeExports.jsx(he.Content,{ref:n,align:t,sideOffset:s,className:u.cn("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));to.displayName=he.Content.displayName;const Ma=B.Menu,Da=B.Group,La=B.Portal,Oa=B.Sub,za=B.RadioGroup,so=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.Root,{ref:s,className:u.cn("flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",e),...t}));so.displayName=B.Root.displayName;const oo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.Trigger,{ref:s,className:u.cn("flex cursor-default select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e),...t}));oo.displayName=B.Trigger.displayName;const no=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(B.SubTrigger,{ref:n,className:u.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...o,children:[s,r.jsxRuntimeExports.jsx(Y.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));no.displayName=B.SubTrigger.displayName;const ro=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.SubContent,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));ro.displayName=B.SubContent.displayName;const ao=f.forwardRef(({className:e,align:t="start",alignOffset:s=-4,sideOffset:o=8,...n},a)=>r.jsxRuntimeExports.jsx(B.Portal,{children:r.jsxRuntimeExports.jsx(B.Content,{ref:a,align:t,alignOffset:s,sideOffset:o,className:u.cn("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));ao.displayName=B.Content.displayName;const io=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(B.Item,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));io.displayName=B.Item.displayName;const lo=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(B.CheckboxItem,{ref:n,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...o,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(B.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.CheckIcon,{className:"h-4 w-4"})})}),t]}));lo.displayName=B.CheckboxItem.displayName;const co=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(B.RadioItem,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(B.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));co.displayName=B.RadioItem.displayName;const uo=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(B.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));uo.displayName=B.Label.displayName;const mo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(B.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));mo.displayName=B.Separator.displayName;const po=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});po.displayname="MenubarShortcut";const Va=Se.Root,Fa=Se.Trigger,fo=f.forwardRef(({className:e,align:t="center",sideOffset:s=4,...o},n)=>r.jsxRuntimeExports.jsx(Se.Content,{ref:n,align:t,sideOffset:s,className:u.cn("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o}));fo.displayName=Se.Content.displayName;const Ua=q.Root,qa=q.Group,Ha=q.Value,xo=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(q.Trigger,{ref:o,className:u.cn("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),...s,children:[t,r.jsxRuntimeExports.jsx(q.Icon,{asChild:!0,children:r.jsxRuntimeExports.jsx(Y.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));xo.displayName=q.Trigger.displayName;const go=f.forwardRef(({className:e,children:t,position:s="popper",...o},n)=>r.jsxRuntimeExports.jsx(q.Portal,{children:r.jsxRuntimeExports.jsx(q.Content,{ref:n,className:u.cn("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:s,...o,children:r.jsxRuntimeExports.jsx(q.Viewport,{className:u.cn("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));go.displayName=q.Content.displayName;const ho=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(q.Label,{ref:s,className:u.cn("px-2 py-1.5 text-sm font-semibold",e),...t}));ho.displayName=q.Label.displayName;const bo=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(q.Item,{ref:o,className:u.cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(q.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.CheckIcon,{className:"h-4 w-4"})})}),r.jsxRuntimeExports.jsx(q.ItemText,{children:t})]}));bo.displayName=q.Item.displayName;const vo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(q.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));vo.displayName=q.Separator.displayName;const $a=I.Root,Ga=I.Trigger,Ya=I.Close,yo=({className:e,...t})=>r.jsxRuntimeExports.jsx(I.Portal,{className:u.cn(e),...t});yo.displayName=I.Portal.displayName;const jo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Overlay,{className:u.cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:s}));jo.displayName=I.Overlay.displayName;const Wa=ce.cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),ko=f.forwardRef(({side:e="right",className:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(yo,{children:[r.jsxRuntimeExports.jsx(jo,{}),r.jsxRuntimeExports.jsxs(I.Content,{ref:n,className:u.cn(Wa({side:e}),t),...o,children:[s,r.jsxRuntimeExports.jsxs(I.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[r.jsxRuntimeExports.jsx(Y.Cross2Icon,{className:"h-4 w-4"}),r.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ko.displayName=I.Content.displayName;const wo=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col space-y-2 text-center sm:text-left",e),...t});wo.displayName="SheetHeader";const Ro=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ro.displayName="SheetFooter";const Co=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Title,{ref:s,className:u.cn("text-lg font-semibold text-foreground",e),...t}));Co.displayName=I.Title.displayName;const Ao=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(I.Description,{ref:s,className:u.cn("text-sm text-muted-foreground",e),...t}));Ao.displayName=I.Description.displayName;const Ka=D.Root,Xa=D.Trigger,Ja=D.Group,Za=D.Portal,Qa=D.Sub,ei=D.RadioGroup,So=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(D.SubTrigger,{ref:n,className:u.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...o,children:[s,r.jsxRuntimeExports.jsx(Y.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));So.displayName=D.SubTrigger.displayName;const Eo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(D.SubContent,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Eo.displayName=D.SubContent.displayName;const No=f.forwardRef(({className:e,sideOffset:t=4,...s},o)=>r.jsxRuntimeExports.jsx(D.Portal,{children:r.jsxRuntimeExports.jsx(D.Content,{ref:o,sideOffset:t,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));No.displayName=D.Content.displayName;const _o=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(D.Item,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));_o.displayName=D.Item.displayName;const Bo=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(D.CheckboxItem,{ref:n,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...o,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(D.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.CheckIcon,{className:"h-4 w-4"})})}),t]}));Bo.displayName=D.CheckboxItem.displayName;const Po=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(D.RadioItem,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(D.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));Po.displayName=D.RadioItem.displayName;const To=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(D.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));To.displayName=D.Label.displayName;const Io=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(D.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-muted",e),...t}));Io.displayName=D.Separator.displayName;const Mo=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest opacity-60",e),...t});Mo.displayName="DropdownMenuShortcut";const Do=f.forwardRef(({className:e,orientation:t="horizontal",decorative:s=!0,...o},n)=>r.jsxRuntimeExports.jsx(Rt.Root,{ref:n,decorative:s,orientation:t,className:u.cn("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));Do.displayName=Rt.Root.displayName;const ti=1,si=1e6;let Me=0;function oi(){return Me=(Me+1)%Number.MAX_VALUE,Me.toString()}const De=new Map,vt=e=>{if(De.has(e))return;const t=setTimeout(()=>{De.delete(e),ge({type:"REMOVE_TOAST",toastId:e})},si);De.set(e,t)},Lo=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,ti)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(s=>s.id===t.toast.id?{...s,...t.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=t;return s?vt(s):e.toasts.forEach(o=>{vt(o.id)}),{...e,toasts:e.toasts.map(o=>o.id===s||s===void 0?{...o,open:!1}:o)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(s=>s.id!==t.toastId)}}},je=[];let ke={toasts:[]};function ge(e){ke=Lo(ke,e),je.forEach(t=>{t(ke)})}function Oo({...e}){const t=oi(),s=n=>ge({type:"UPDATE_TOAST",toast:{...n,id:t}}),o=()=>ge({type:"DISMISS_TOAST",toastId:t});return ge({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:n=>{n||o()}}}),{id:t,dismiss:o,update:s}}function zo(){const[e,t]=f.useState(ke);return f.useEffect(()=>(je.push(t),()=>{const s=je.indexOf(t);s>-1&&je.splice(s,1)}),[e]),{...e,toast:Oo,dismiss:s=>ge({type:"DISMISS_TOAST",toastId:s})}}const ni=Z.Provider,Vo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Viewport,{ref:s,className:u.cn("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));Vo.displayName=Z.Viewport.displayName;const ri=ce.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Fo=f.forwardRef(({className:e,variant:t,...s},o)=>r.jsxRuntimeExports.jsx(Z.Root,{ref:o,className:u.cn(ri({variant:t}),e),...s}));Fo.displayName=Z.Root.displayName;const ai=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Action,{ref:s,className:u.cn("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));ai.displayName=Z.Action.displayName;const Uo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Close,{ref:s,className:u.cn("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:r.jsxRuntimeExports.jsx(Y.Cross2Icon,{className:"h-4 w-4"})}));Uo.displayName=Z.Close.displayName;const qo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Title,{ref:s,className:u.cn("text-sm font-semibold [&+div]:text-xs",e),...t}));qo.displayName=Z.Title.displayName;const Ho=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(Z.Description,{ref:s,className:u.cn("text-sm opacity-90",e),...t}));Ho.displayName=Z.Description.displayName;function ii(){const{toasts:e}=zo();return r.jsxRuntimeExports.jsxs(ni,{children:[e.map(({id:t,title:s,description:o,action:n,...a})=>r.jsxRuntimeExports.jsxs(Fo,{...a,children:[r.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[s&&r.jsxRuntimeExports.jsx(qo,{children:s}),o&&r.jsxRuntimeExports.jsx(Ho,{children:o})]}),n,r.jsxRuntimeExports.jsx(Uo,{})]},t)),r.jsxRuntimeExports.jsx(Vo,{})]})}const li=({className:e,...t})=>r.jsxRuntimeExports.jsx("div",{className:u.cn("animate-pulse rounded-md bg-primary/10",e),...t}),it=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command,{ref:s,className:u.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));it.displayName=J.Command.displayName;const ci=({children:e,...t})=>r.jsxRuntimeExports.jsx(nt,{...t,children:r.jsxRuntimeExports.jsx(Be,{className:"overflow-hidden p-0",children:r.jsxRuntimeExports.jsx(it,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})})}),$o=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsxRuntimeExports.jsx(Y.MagnifyingGlassIcon,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsxRuntimeExports.jsx(J.Command.Input,{ref:s,className:u.cn("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));$o.displayName=J.Command.Input.displayName;const Go=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.List,{ref:s,className:u.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Go.displayName=J.Command.List.displayName;const Yo=f.forwardRef((e,t)=>r.jsxRuntimeExports.jsx(J.Command.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Yo.displayName=J.Command.Empty.displayName;const Wo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.Group,{ref:s,className:u.cn("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Wo.displayName=J.Command.Group.displayName;const Ko=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.Separator,{ref:s,className:u.cn("-mx-1 h-px bg-border",e),...t}));Ko.displayName=J.Command.Separator.displayName;const Xo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(J.Command.Item,{ref:s,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));Xo.displayName=J.Command.Item.displayName;const Jo=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});Jo.displayName="CommandShortcut";const di=L.Root,ui=L.Trigger,mi=L.Group,pi=L.Portal,fi=L.Sub,xi=L.RadioGroup,Zo=f.forwardRef(({className:e,inset:t,children:s,...o},n)=>r.jsxRuntimeExports.jsxs(L.SubTrigger,{ref:n,className:u.cn("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...o,children:[s,r.jsxRuntimeExports.jsx(Y.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));Zo.displayName=L.SubTrigger.displayName;const Qo=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(L.SubContent,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Qo.displayName=L.SubContent.displayName;const en=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(L.Portal,{children:r.jsxRuntimeExports.jsx(L.Content,{ref:s,className:u.cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})}));en.displayName=L.Content.displayName;const tn=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(L.Item,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...s}));tn.displayName=L.Item.displayName;const sn=f.forwardRef(({className:e,children:t,checked:s,...o},n)=>r.jsxRuntimeExports.jsxs(L.CheckboxItem,{ref:n,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...o,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(L.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.CheckIcon,{className:"h-4 w-4"})})}),t]}));sn.displayName=L.CheckboxItem.displayName;const on=f.forwardRef(({className:e,children:t,...s},o)=>r.jsxRuntimeExports.jsxs(L.RadioItem,{ref:o,className:u.cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[r.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsxRuntimeExports.jsx(L.ItemIndicator,{children:r.jsxRuntimeExports.jsx(Y.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),t]}));on.displayName=L.RadioItem.displayName;const nn=f.forwardRef(({className:e,inset:t,...s},o)=>r.jsxRuntimeExports.jsx(L.Label,{ref:o,className:u.cn("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...s}));nn.displayName=L.Label.displayName;const rn=f.forwardRef(({className:e,...t},s)=>r.jsxRuntimeExports.jsx(L.Separator,{ref:s,className:u.cn("-mx-1 my-1 h-px bg-border",e),...t}));rn.displayName=L.Separator.displayName;const an=({className:e,...t})=>r.jsxRuntimeExports.jsx("span",{className:u.cn("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});an.displayName="ContextMenuShortcut";const gi=e=>{try{const t=document.getElementById("icon-picker-field"),s=document.createElement("div");En.render(r.jsxRuntimeExports.jsx(jt.IconPickerItem,{value:e}),s),t.appendChild(s),s.hidden=!0;let o=s.innerHTML;setTimeout(()=>t.removeChild(s),100);const a=new DOMParser().parseFromString(o,"image/svg+xml"),i=a.querySelector("svg");return i&&(i.removeAttribute("width"),i.removeAttribute("height")),new XMLSerializer().serializeToString(a)}catch(t){return console.error(t),""}},hi=({value:e,onChange:t})=>{const s=o=>{t("<svg />");const n=gi(o);t(n)};return r.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[r.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[r.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:e?e.replace("<svg",'<svg class="h-5 w-5"'):"<svg class='h-5 w-5' />"},className:"absolute left-1/2 top-1/2 z-0 -translate-x-1/2 -translate-y-1/2 transform cursor-pointer bg-white"}),r.jsxRuntimeExports.jsx(jt,{value:e?"BiSolidGrid":null,onChange:s,pickButtonStyle:{position:"relative",height:"48px",width:"48px",border:"1px solid #BBBBBB",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",backgroundColor:"transparent",zIndex:1},searchInputStyle:{backgroundColor:"transparent",width:"100%",border:"1px solid #BBBBBB",margin:"0px 10px",padding:"10px"}})]}),r.jsxRuntimeExports.jsx("textarea",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",value:e,onChange:o=>t(o.target.value),className:"h-full w-full rounded-sm border border-foreground/20 px-2 py-1 text-xs shadow-sm focus:border-gray-500/80 focus:outline-none focus:ring-0",placeholder:"Choose icon or enter svg"})]})},bi=R.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-5JbDig-S.cjs"))),vi=R.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-f6wPPJxc.cjs"))),ln=({isModalView:e=!1,onSelect:t=()=>{}})=>{const s=Q("uploadMediaCallback"),o=Q("unsplashAccessKey"),n=s===void 0,a=o===void 0,[i,d]=R.useState(a?"upload":n?"unsplash":"upload");return r.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[r.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:e&&n?"Unsplash images":e?"Select or upload images":"Images"})}),r.jsxRuntimeExports.jsxs(Qs,{value:i,onValueChange:x=>d(x),className:"flex h-full w-full flex-col py-2",children:[!(n||a)&&r.jsxRuntimeExports.jsxs(at,{className:"w-full",children:[r.jsxRuntimeExports.jsx(Re,{value:"upload",className:"w-full",children:"Upload"}),r.jsxRuntimeExports.jsx(Re,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),i==="unsplash"?r.jsxRuntimeExports.jsx(Ce,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:r.jsxRuntimeExports.jsx(R.Suspense,{fallback:r.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:r.jsxRuntimeExports.jsx(bi,{isModalView:e,onSelect:t})})}):r.jsxRuntimeExports.jsx(Ce,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:r.jsxRuntimeExports.jsx(R.Suspense,{fallback:r.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:r.jsxRuntimeExports.jsx(vi,{isModalView:e,onSelect:t})})})]})]})},yi=Object.freeze(Object.defineProperty({__proto__:null,default:ln},Symbol.toStringTag,{value:"Module"})),yt=({children:e,onSelect:t})=>{const[s,o]=R.useState(!1),n=(...a)=>{t.call(void 0,...a),o(!1)};return r.jsxRuntimeExports.jsxs(nt,{open:s,onOpenChange:a=>o(a),children:[r.jsxRuntimeExports.jsx(Ds,{asChild:!0,children:e}),r.jsxRuntimeExports.jsx(Be,{className:"flex h-3/4 max-w-5xl",children:r.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:r.jsxRuntimeExports.jsx(ln,{isModalView:!0,onSelect:n})})})]})},ji=({value:e,onChange:t,id:s,onBlur:o})=>{const n=Q("uploadMediaCallback"),a=Q("unsplashAccessKey"),i=n===void 0,d=a===void 0;return r.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[e?r.jsxRuntimeExports.jsx("img",{src:e,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):r.jsxRuntimeExports.jsx(yt,{onSelect:t,children:r.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px] hover:border-gray-400"})}),r.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[!(i&&d)&&r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(yt,{onSelect:t,children:r.jsxRuntimeExports.jsx("small",{className:"cursor-pointer rounded-full bg-gray-600 px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:e||!l.isEmpty(e)?"Replace Image":"Choose Image"})}),r.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"})]}),r.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",type:"url",className:"text-xs",placeholder:"Enter image URL",value:e,onBlur:({target:{value:x}})=>o(s,x),onChange:x=>t(x.target.value)})]})]})},ki=({id:e,placeholder:t,value:s,onChange:o,onBlur:n})=>{const a={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},i=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:r.jsxRuntimeExports.jsx(Nn,{id:e,value:s,onBlur:d=>n(e,d),onChange:d=>o(d),modules:a,formats:i,placeholder:t,className:"mt-1 rounded-md"})},wi=({schema:e,formData:t,onChange:s})=>{const[o,n]=R.useState([]),a=Q("getPages",()=>[]),{type:i="page",href:d="",target:x="self"}=t;return R.useEffect(()=>{(async()=>{const c=await a();n(c||[])})()},[]),r.jsxRuntimeExports.jsxs("div",{children:[r.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(e==null?void 0:e.title)??"Link"}),r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[r.jsxRuntimeExports.jsx("select",{name:"type",value:i,onChange:c=>s({...t,type:c.target.value}),children:[{const:"page",title:"Open Page"},{const:"url",title:"Open URL"},{const:"email",title:"Compose Email"},{const:"telephone",title:"Call Phone"},{const:"scroll",title:"Scroll to element"}].map(c=>r.jsxRuntimeExports.jsx("option",{value:c.const,children:c.title},c.const))}),i==="page"?r.jsxRuntimeExports.jsxs("select",{name:"href",value:d,onChange:c=>s({...t,href:c.target.value||"#"}),children:[r.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),l.map(o,c=>r.jsxRuntimeExports.jsx("option",{value:c.slug,children:c.name},c.uuid))]}):r.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",name:"href",type:"text",value:d,onChange:c=>s({...t,href:c.target.value||"#"}),placeholder:i==="page"||i==="url"?"Enter URL":i==="scroll"?"#ElementID":"Enter detail"}),(i==="page"||i==="url")&&r.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[r.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",type:"checkbox",defaultChecked:x==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>s({...t,target:x==="_blank"?"_self":"_blank"})}),r.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})};exports.Accordion=wa;exports.AccordionContent=ks;exports.AccordionItem=ys;exports.AccordionTrigger=js;exports.Alert=ws;exports.AlertDescription=Cs;exports.AlertDialog=Aa;exports.AlertDialogAction=Is;exports.AlertDialogCancel=Ms;exports.AlertDialogContent=Ns;exports.AlertDialogDescription=Ts;exports.AlertDialogFooter=Bs;exports.AlertDialogHeader=_s;exports.AlertDialogTitle=Ps;exports.AlertDialogTrigger=Sa;exports.AlertTitle=Rs;exports.Badge=Ca;exports.Button=vs;exports.Card=qs;exports.CardContent=Ys;exports.CardDescription=Gs;exports.CardFooter=Ws;exports.CardHeader=Hs;exports.CardTitle=$s;exports.Command=it;exports.CommandDialog=ci;exports.CommandEmpty=Yo;exports.CommandGroup=Wo;exports.CommandInput=$o;exports.CommandItem=Xo;exports.CommandList=Go;exports.CommandSeparator=Ko;exports.CommandShortcut=Jo;exports.ContextMenu=di;exports.ContextMenuCheckboxItem=sn;exports.ContextMenuContent=en;exports.ContextMenuGroup=mi;exports.ContextMenuItem=tn;exports.ContextMenuLabel=nn;exports.ContextMenuPortal=pi;exports.ContextMenuRadioGroup=xi;exports.ContextMenuRadioItem=on;exports.ContextMenuSeparator=rn;exports.ContextMenuShortcut=an;exports.ContextMenuSub=fi;exports.ContextMenuSubContent=Qo;exports.ContextMenuSubTrigger=Zo;exports.ContextMenuTrigger=ui;exports.Dialog=nt;exports.DialogContent=Be;exports.DialogDescription=Us;exports.DialogFooter=Vs;exports.DialogHeader=zs;exports.DialogTitle=Fs;exports.DialogTrigger=Ds;exports.DropdownMenu=Ka;exports.DropdownMenuCheckboxItem=Bo;exports.DropdownMenuContent=No;exports.DropdownMenuGroup=Ja;exports.DropdownMenuItem=_o;exports.DropdownMenuLabel=To;exports.DropdownMenuPortal=Za;exports.DropdownMenuRadioGroup=ei;exports.DropdownMenuRadioItem=Po;exports.DropdownMenuSeparator=Io;exports.DropdownMenuShortcut=Mo;exports.DropdownMenuSub=Qa;exports.DropdownMenuSubContent=Eo;exports.DropdownMenuSubTrigger=So;exports.DropdownMenuTrigger=Xa;exports.HoverCard=Va;exports.HoverCardContent=fo;exports.HoverCardTrigger=Fa;exports.IconPickerField=hi;exports.ImagePickerField=ji;exports.ImagesPanel=yi;exports.Input=Ks;exports.Label=Xs;exports.LinkField=wi;exports.Menubar=so;exports.MenubarCheckboxItem=lo;exports.MenubarContent=ao;exports.MenubarGroup=Da;exports.MenubarItem=io;exports.MenubarLabel=uo;exports.MenubarMenu=Ma;exports.MenubarPortal=La;exports.MenubarRadioGroup=za;exports.MenubarRadioItem=co;exports.MenubarSeparator=mo;exports.MenubarShortcut=po;exports.MenubarSub=Oa;exports.MenubarSubContent=ro;exports.MenubarSubTrigger=no;exports.MenubarTrigger=oo;exports.Popover=Ta;exports.PopoverContent=to;exports.PopoverTrigger=Ia;exports.RichTextEditorField=ki;exports.ScrollArea=Zs;exports.ScrollBar=rt;exports.Select=Ua;exports.SelectContent=go;exports.SelectGroup=qa;exports.SelectItem=bo;exports.SelectLabel=ho;exports.SelectSeparator=vo;exports.SelectTrigger=xo;exports.SelectValue=Ha;exports.Separator=Do;exports.Sheet=$a;exports.SheetClose=Ya;exports.SheetContent=ko;exports.SheetDescription=Ao;exports.SheetFooter=Ro;exports.SheetHeader=wo;exports.SheetTitle=Co;exports.SheetTrigger=Ga;exports.Skeleton=li;exports.Switch=bs;exports.Tabs=Qs;exports.TabsContent=Ce;exports.TabsList=at;exports.TabsTrigger=Re;exports.Textarea=Js;exports.Toaster=ii;exports.Toggle=hs;exports.Tooltip=Ba;exports.TooltipContent=eo;exports.TooltipPortal=Na;exports.TooltipProvider=_a;exports.TooltipTrigger=Pa;exports.activePanelAtom=is;exports.aiAssistantActiveAtom=ot;exports.atom=ne;exports.atomWithDefault=Yn;exports.atomWithStorage=ue;exports.badgeVariants=As;exports.builderSaveStateAtom=Ne;exports.buttonVariants=_e;exports.canAcceptChildBlock=Oe;exports.canDeleteBlock=er;exports.canDuplicateBlock=Qn;exports.canvasIframeAtom=as;exports.canvasSettingsAtom=fs;exports.chaiBuilderPropsAtom=He;exports.chaiExternalDataAtom=_t;exports.convertDotNotationToObject=ur;exports.createStore=Ct;exports.dataProvidersAtom=Qe;exports.draggedBlockIdAtom=ms;exports.draggingFlagAtom=us;exports.getBlockJSONFromSchemas=Ve;exports.getBlockJSONFromUISchemas=ze;exports.inlineEditingActiveAtom=ds;exports.isDevelopment=Jn;exports.networkModeAtom=rs;exports.presentBlocksAtom=ee;exports.reducer=Lo;exports.showPredefinedBlockCategoryAtom=ls;exports.toast=Oo;exports.toggleVariants=gs;exports.treeDSBlocks=It;exports.treeRefAtom=ps;exports.useActiveModal=na;exports.useActivePanel=fa;exports.useAddBlock=Sr;exports.useAddBlockParent=xa;exports.useAddClassesToBlocks=Pr;exports.useAllBlocks=ra;exports.useAtom=Et;exports.useAtomValue=At;exports.useBlocksContainer=gr;exports.useBlocksStore=me;exports.useBlocksStoreUndoableActions=te;exports.useBrandingOptions=Xe;exports.useBuilderProp=Q;exports.useBuilderReset=ba;exports.useCanvasWidth=Tr;exports.useCanvasZoom=Mr;exports.useCodeEditor=ka;exports.useCopyBlockIds=Dr;exports.useCopyToClipboard=ya;exports.useCurrentPage=Vt;exports.useCutBlockIds=Zt;exports.useDarkMode=Lr;exports.useDuplicateBlocks=es;exports.useGetPageData=$t;exports.useHiddenBlockIds=zr;exports.useHighlightBlockId=ts;exports.usePageDataProviders=Gt;exports.usePasteBlocks=Ur;exports.usePreviewMode=Hr;exports.useReadOnlyMode=ua;exports.useRemoveBlocks=jr;exports.useRemoveClassesFromBlocks=Gr;exports.useSavePage=yr;exports.useSelectedBlock=lr;exports.useSelectedBlockAllClasses=Yr;exports.useSelectedBlockCurrentClasses=Xr;exports.useSelectedBlockIds=be;exports.useSelectedBlocksDisplayChild=ir;exports.useSelectedBreakpoints=ha;exports.useSelectedStylingBlocks=Yt;exports.useSetAtom=St;exports.useStore=Ue;exports.useStreamMultipleBlocksProps=ta;exports.useStylingBreakpoint=Wt;exports.useStylingState=Jr;exports.useToast=zo;exports.useUILibraryBlocks=va;exports.useUndoManager=et;exports.useUpdateBlocksProps=Zr;exports.useUpdateBlocksPropsRealtime=sa;exports.useUpdateMultipleBlocksProps=Qr;exports.xShowBlocksAtom=xs;