@chaibuilder/sdk 1.2.46 → 1.2.47
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.
- package/README.md +1 -1
- package/dist/{AddBlocks-Jse1nYBd.cjs → AddBlocks-_fhhS7Lm.cjs} +1 -1
- package/dist/{AddBlocks-wY7YpsXy.js → AddBlocks-cX8vIt0V.js} +7 -7
- package/dist/{CanvasArea-2widR9Ry.js → CanvasArea-HRipTJFS.js} +271 -263
- package/dist/CanvasArea-N3rYeBJV.cjs +55 -0
- package/dist/{ChaiBuilderEditor-74s7jELl.cjs → ChaiBuilderEditor-EtQOC5uy.cjs} +1 -1
- package/dist/{ChaiBuilderEditor-wriVkIG1.js → ChaiBuilderEditor-dKHRL-Es.js} +20 -20
- package/dist/{CurrentPage-UozVUoj8.cjs → CurrentPage-9FijxWbn.cjs} +1 -1
- package/dist/{CurrentPage--JhcSlGs.js → CurrentPage-U8ms8Hs7.js} +2 -2
- package/dist/{ListTree-qTfVR-jh.js → ListTree-OgLdyfQs.js} +1 -1
- package/dist/{ListTree-aFX8fD7v.cjs → ListTree-jOvHpo3_.cjs} +1 -1
- package/dist/{PagesPanel-1ZzPulaC.cjs → PagesPanel-8Cd6UYsh.cjs} +1 -1
- package/dist/{PagesPanel-qatBt4Nf.js → PagesPanel-MsUBq9Xx.js} +3 -3
- package/dist/{ProjectPanel-QUIcKWwM.cjs → ProjectPanel-KmnXPfxx.cjs} +1 -1
- package/dist/{ProjectPanel-Vp-EZS_Y.js → ProjectPanel-hsZG_Btj.js} +3 -3
- package/dist/{Settings-E_xif3_e.js → Settings-WcLqIeQy.js} +7 -7
- package/dist/{Settings-jKpJi5Wy.cjs → Settings-xVjTnVSf.cjs} +1 -1
- package/dist/{SidePanels-s_Yl7HhG.cjs → SidePanels-6zRgfZpi.cjs} +1 -1
- package/dist/{SidePanels-UEa90HOL.js → SidePanels-PmCljlnf.js} +2 -2
- package/dist/{ThemeConfiguration-IUuxGaDf.js → ThemeConfiguration-mkbFdePB.js} +17 -17
- package/dist/{ThemeConfiguration-YkPc6RGq.cjs → ThemeConfiguration-pt7TTAty.cjs} +1 -1
- package/dist/{Topbar-YzdQKElx.cjs → Topbar--m1E08Jl.cjs} +1 -1
- package/dist/{Topbar-C7Qfcatg.js → Topbar-FPywhpub.js} +1 -1
- package/dist/{UILibrariesPanel-qv8AiOn1.cjs → UILibrariesPanel-HhHGcexY.cjs} +1 -1
- package/dist/{UILibrariesPanel-didKK7tC.js → UILibrariesPanel-VrA2X4LO.js} +1 -1
- package/dist/{UnsplashImages-VkZ_KszK.js → UnsplashImages-7uAXYHPH.js} +1 -1
- package/dist/{UnsplashImages-QeZ65lKC.cjs → UnsplashImages-Yu0msAD8.cjs} +1 -1
- package/dist/{UploadImages-6drauLA-.js → UploadImages-5M0Q27R-.js} +1 -1
- package/dist/{UploadImages-igQroUtu.cjs → UploadImages-jS51ZcPG.cjs} +1 -1
- package/dist/{add-page-modal-rJ7OwdoX.js → add-page-modal-6o7MAbq-.js} +3 -3
- package/dist/{add-page-modal-esHlLYay.cjs → add-page-modal-KAbflupJ.cjs} +1 -1
- package/dist/{confirm-alert-08q_BmL6.cjs → confirm-alert-dow0GlxC.cjs} +1 -1
- package/dist/{confirm-alert-HfChUtfw.js → confirm-alert-jL0z_gFv.js} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-SOCB_9UB.cjs → delete-page-modal-EDQZneVM.cjs} +1 -1
- package/dist/{delete-page-modal-E3tO5Q1p.js → delete-page-modal-U5_JYYp7.js} +2 -2
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{form-gRWwpKzq.cjs → form-KBtrnNWh.cjs} +1 -1
- package/dist/{form-hi_RCepy.js → form-Sgpl2fXL.js} +1 -1
- package/dist/functions-7ybAMUuA.js +31 -0
- package/dist/functions-yvRwasT2.cjs +1 -0
- package/dist/{index-3j3SZ9Pb.cjs → index-HjN7LtDT.cjs} +1 -1
- package/dist/{index-OnzJQ25d.js → index-po-naEa5.js} +2 -2
- package/dist/lib.cjs +2 -3
- package/dist/lib.d.ts +11 -11
- package/dist/lib.js +175 -100
- package/dist/{page-viewer-S3xZLu53.cjs → page-viewer-PfZEbcDZ.cjs} +1 -1
- package/dist/{page-viewer-K_8dfU3A.js → page-viewer-nLRRk7DR.js} +3 -3
- package/dist/{project-general-setting-vSkiqVk-.js → project-general-setting-D1UJdZ2D.js} +3 -3
- package/dist/{project-general-setting-IRQ9TNAd.cjs → project-general-setting-HO6zeum2.cjs} +1 -1
- package/dist/{project-seo-setting-b9jZC0dr.js → project-seo-setting-VIZWEMRk.js} +2 -2
- package/dist/{project-seo-setting-XHFqgtW9.cjs → project-seo-setting-gT9N1tnB.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +2 -1
- package/dist/render.js +82 -80
- package/dist/{single-page-detail-RG82dk4d.cjs → single-page-detail-To8TcpgJ.cjs} +1 -1
- package/dist/{single-page-detail-zHbO3vOI.js → single-page-detail-lQ8fujC5.js} +4 -4
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/{useCanvasSettings-2Wzyf2PK.cjs → useCanvasSettings-7BXlDuLG.cjs} +1 -1
- package/dist/{useCanvasSettings-L2pW5boY.js → useCanvasSettings-UzjYHFG5.js} +1 -1
- package/package.json +1 -1
- package/dist/CanvasArea-pQP-jR11.cjs +0 -57
- package/dist/functions-ge87TVcc.js +0 -30
- package/dist/functions-sBiIevFh.cjs +0 -1
|
@@ -203,4 +203,4 @@ object-assign/index.js:
|
|
|
203
203
|
(c) Sindre Sorhus
|
|
204
204
|
@license MIT
|
|
205
205
|
*)
|
|
206
|
-
*/W();var su1=process.env.NODE_ENV!=="production"?ou1:()=>null;function lu1(){return new URLSearchParams(window.location.search).has("dnd")}function iu1(){return new URLSearchParams(window.location.search).has("outline")}const uu1={dnd:lu1(),arborist:iu1()},Gr=l1.atom(null);Gr.debugLabel="chaiBuilderPropsAtom";const aL=l1.atom({});aL.debugLabel="chaiExternalDataAtom";class rL extends h.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?L.jsxRuntimeExports.jsxs("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",id:"errorBoundary",children:[L.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),L.jsxRuntimeExports.jsx("p",{children:"Please try again later."})]}):this.props.children}}const du1=()=>!1,hu1=t=>{const e=t.replace(x4.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},nL=T.memoize((t,e)=>{if(!t)return!0;const c=I3.getBlockComponent(t);return c&&T.has(c,"canAcceptBlock")?c.canAcceptBlock(e):!1}),Vv1=T.memoize((t,e)=>{const c=I3.getBlockComponent(e);return c&&T.has(c,"canBeNested")?c.canBeNested(t):!0}),vu1=T.memoize(t=>{const e=I3.getBlockComponent(t);return e&&T.has(e,"canDuplicate")?e.canDuplicate():!0}),fu1=T.memoize(t=>{const e=I3.getBlockComponent(t);return e&&T.has(e,"canDelete")?e.canDelete():!0});function oL(t,e,c){const a=T.filter(t,n=>n._parent===e),r=[];for(let n=0;n<a.length;n++){const o=lL(a[n]);if(Object.keys(o).length>0&&Object.keys(o).forEach(s=>{a[n][s]=`slot:${U4.generateUUID()}`}),T.filter(t,{_parent:a[n]._id}).length>0){const s=U4.generateUUID();r.push({...a[n],oldId:a[n]._id,_id:s,_parent:c}),r.push(T.flatten(oL(t,a[n]._id,s)))}else r.push({...a[n],oldId:a[n]._id,_id:U4.generateUUID(),_parent:c})}return T.flatten(r)}function sL(t){const e={};t.forEach(a=>{e[a._id]={...a,children:[]}});const c=[];return t.forEach(a=>{if(a._parent){const r=e[a._parent];r&&r.children.push(e[a._id])}else c.push(e[a._id])}),c}const lL=t=>{const e={};return Object.keys(t).forEach(c=>{T.isString(t[c])&&t[c].startsWith("slot")&&(e[c]=t[c].replace("slot:",""))}),e},gu1=(t,e,c=null)=>{let a=T.find(t,{_id:e});a={...a,oldId:a._id,_id:U4.generateUUID()},c&&(a={...a,_parent:c});const r=[a];T.filter(t,{_parent:e}).length>0&&r.push(T.flatten(oL(t,e,a._id)));const n=T.flatten(r);return T.map(n,o=>{const s=o,l=lL(s);return Object.keys(l).length>0&&Object.keys(l).forEach(u=>{const i=T.find(n,{oldId:l[u].replace("slot:","")});s[u]=`slot:${i._id}`}),T.omit(s,["global","oldId"])})};const S4=l1.atom([]);S4.debugLabel="presentBlocksAtom";const iL=l1.atom(t=>{const e=t(S4);return sL([...e])});iL.debugLabel="treeDSBlocks";S4.debugLabel="presentBlocksAtom";const Jr=oe1(S4);Jr.debugLabel="pageBlocksAtomsAtom";const pu1=l1.atom("");pu1.debugLabel="builderActivePageAtom";const mu1=l1.atom(-1);mu1.debugLabel="destinationDropIndexAtom";const uL=l1.atom([]);uL.debugLabel="buildingBlocksAtom";const zu1=l1.atom(t=>{const e=t(uL);return T.filter(e,c=>T.has(c,"blockId"))});zu1.debugLabel="globalBlocksAtom";const Yr=l1.atom([]);Yr.debugLabel="selectedBlockIdsAtom";const Xr=l1.atom(t=>{const e=t(S4),c=t(Yr);return T.map(T.filter(e,({_id:a})=>T.includes(c,a)),a=>({...a}))});Xr.debugLabel="selectedBlocksAtom";const he=l1.atom(t=>{const e=t(Xr);if(e.length===0)return null;if(e.length===1)return e[0]});he.debugLabel="selectedBlockAtom";const bu1=t=>T.get(t,"_parent",null),Mu1=l1.atom(t=>{const e=t(Xr),c=T.map(e,bu1);return T.filter(t(S4),a=>T.includes(c,a._id))});Mu1.debugLabel="selectedBlocksParentsAtom";const dL=l1.atom(()=>!1);dL.debugLabel="selectedBlockFlexChildAtom";const hL=l1.atom(()=>!1);hL.debugLabel="selectedBlockGridChildAtom";const Qr=l1.atom("");Qr.debugLabel="styleStateAtom";const vL=g4("styleBreakpoint","xs");vL.debugLabel="styleBreakpointAtom";const wu1=()=>({flexChild:l1.useAtomValue(dL),gridChild:l1.useAtomValue(hL)}),Cu1=()=>l1.useAtomValue(he),Vu1=l1.atom(t=>{const e=t(he),c=t(S4);let a=e;const r=[e];do{const n=c.find(({_id:o})=>o===(a==null?void 0:a._parent));a=n,n&&r.push(n)}while(a!=null&&a._parent);return r}),Hu1=()=>l1.useAtomValue(Vu1),yu1=()=>{const t=Hu1();return h.useMemo(()=>{for(let e=0;e<t.length;e++){const c=I3.getBlockComponent(t[e]._type),a=T.cloneDeep(T.get(c,"blockState",{}));if(!T.isEmpty(a))return{settings:a,block:t[e]}}return{}},[t])};const g3=()=>{const[t,e]=l1.useAtom(Yr),c=h.useCallback(a=>{e(r=>T.includes(r,a)?T.without(r,a):[...r,a])},[e]);return[t,e,c]},fa=t=>{switch(t.type){case"singular":return t.uiSchema;case"model":const{properties:e}=t,c={};return Object.keys(e).forEach(n=>{const o=e[n];if(T.includes(["slot","styles"],o.type))return;const s=n;c[s]=fa(o)}),c;case"list":const{itemProperties:a}=t,r={items:{}};return Object.keys(a).forEach(n=>{const o=a[n];if(T.includes(["slot","styles"],o.type))return;const s=n;r.items[s]=fa(o)}),r;default:return{}}},ga=t=>{switch(t.type){case"singular":return t.schema;case"model":const{properties:e,title:c}=t,a={title:c,type:"object",properties:{}};return Object.keys(e).forEach(s=>{const l=e[s];if(T.includes(["slot","styles"],l.type))return;const u=s;a.properties[u]=ga(l)}),a;case"list":const{itemProperties:r,title:n}=t,o={title:n,type:"array",items:{type:"object",properties:{}}};return Object.keys(r).forEach(s=>{const l=r[s];if(T.includes(["slot","styles"],l.type))return;const u=s;o.items.properties[u]=ga(l),T.set(o.items,"title",T.get(l,"itemTitle",`${n} item`))}),o;default:return{}}},fL=t=>{if(!t)return{};const e={};return Object.keys(t).forEach(c=>{e[c]=Lu1(t[c])}),e},xu1=t=>{if(T.isEmpty(t.default))return[];const{itemProperties:e}=t;return T.map(t.default,c=>{const a={...c};return T.forIn(c,(r,n)=>{T.has(e,n)&&T.get(e[n],"i18n",!1)&&(a[n]=x4.I18N_KEY)}),a})},Lu1=t=>{switch(t.type){case"styles":return t.default;case"slot":return`${x4.SLOT_KEY}${U4.generateUUID()}`;case"singular":const{schema:e}=t;return T.get(e,"default","");case"model":return fL(t.properties);case"list":return xu1(t);default:return""}};const Su1=(t,e)=>{const c={};return T.set(c,t,e),c};var _r={exports:{}},Hv1=_r.exports;(function(t){(function(){"use strict";function e(a,r,n){return a.splice(r,!n||1+n-r+(!(n<0^r>=0)&&(n<0||-1)*a.length)),a.length}let c=function(){let a=[],r=-1,n=0,o=!1,s;function l(u,i){return!u||typeof u[i]!="function"?this:(o=!0,u[i](),o=!1,this)}return{add:function(u){return o?this:(a.splice(r+1,a.length-r),a.push(u),n&&a.length>n&&e(a,0,-(n+1)),r=a.length-1,s&&s(),this)},setCallback:function(u){s=u},undo:function(){let u=a[r];if(!u)return this;const i=u.groupId;for(;u.groupId===i&&(l(u,"undo"),r-=1,u=a[r],!(!u||!u.groupId)););return s&&s(),this},redo:function(){let u=a[r+1];if(!u)return this;const i=u.groupId;for(;u.groupId===i&&(l(u,"redo"),r+=1,u=a[r+1],!(!u||!u.groupId)););return s&&s(),this},clear:function(){let u=a.length;a=[],r=-1,s&&u>0&&s()},hasUndo:function(){return r!==-1},hasRedo:function(){return r<a.length-1},getCommands:function(u){return u?a.filter(i=>i.groupId===u):a},getIndex:function(){return r},setLimit:function(u){n=u}}};t.exports?t.exports=c:window.UndoManager=c})()})(_r);var Au1=_r.exports;const Fu1=V4.getDefaultExportFromCjs(Au1),Bu1=l1.atom(Bc.BRANDING_OPTIONS_DEFAULTS),Eu1=l1.atom(null),ve=()=>{const[t,e]=l1.useAtom(Bu1);return[T.isObject(t)?{...Bc.BRANDING_OPTIONS_DEFAULTS,...t}:Bc.BRANDING_OPTIONS_DEFAULTS,e]},Ou1=()=>l1.useAtom(Eu1),Pu1=l1.atom(null),gL=()=>({currentPage:l1.useAtomValue(Pu1)});function pL(t){return sL(t)}const $r=(t,e)=>T.flatten(t.map(c=>{if(c=e?{...c,_parent:e}:{...c},c.children){const a=[...c.children];return delete c.children,T.flatten([c,...$r(a,c._id)])}return c}));function tn(t,e=!1){for(let c=0;c<t.length;c++){const a=t[c];a.global&&!e?t[c]={type:"GlobalBlock",blockId:a.blockId,_parent:T.get(a,"_parent",null),_id:a._id}:a.children&&a.children.length&&tn(a.children)}}function mL(t){let e=[],c=T.filter(t,{type:"GlobalBlock"});return c.length>0&&(c=T.map(c,zL),T.each(c,a=>{e=[...e,...ku1(a)]})),e}function ku1(t){let e=[];const c=T.get(T.first(t),"_parent",null);T.set(T.first(t),"_parent",null);const a=[flatToNestedInstance.convert(bL(t))];tn(a,!0);let r=$r(a,t[0]._id);return r=T.set(r,"0._parent",c),e=[...e,r,...mL(r)],e}function zL(t){const e=T.find(pa,{_id:t._id});if(!e)return[];const c=[e],a=T.filter(pa,{_parent:t._id});return a.length?T.flatten([...c,...T.flatten(T.map(a,zL))]):T.flatten(c)}const bL=t=>JSON.parse(JSON.stringify(t));let pa=[];function Ru1(t){pa=t;const e=pL(bL(t));tn(e);const c=$r(e,null),a=mL(c),r={};return T.each(a,n=>T.set(r,T.first(n).blockId,n)),[c,r]}const ML=()=>{const[t]=ve(),{currentPage:e}=gL(),[c]=Q4();return h.useCallback(()=>{const a=T.map(c,n=>T.omit(n,["expanded","order","title","siblings","tempClasses"])),[r=[]]=Ru1(a);return{currentPage:e,blocks:r}},[t,e,c])},M2=(t,e=void 0)=>{const c=l1.useAtomValue(Gr);return T.get(c,t,e)},en=l1.atom([]);en.debugLabel="dataProvidersAtom";const cn=()=>l1.useAtom(en),I0=l1.atom("SAVED");I0.debugLabel="builderSaveStateAtom";const wL=()=>{const[t,e]=l1.useAtom(I0),c=M2("onSavePage",async u=>{}),a=M2("onSave",async u=>{}),r=M2("onSaveStateChange",T.noop),n=ML(),[o]=cn(),[s]=ve();return{savePage:ig.useThrottledCallback(async()=>{e("SAVING"),r("SAVING");const u=n();return await c({blocks:u.blocks,providers:o}),await a({blocks:u.blocks,providers:o,brandingOptions:s,themeConfiguration:s}),setTimeout(()=>{e("SAVED"),r("SAVED")},100),!0},[n,e,s,a,r],3e3),saveState:t,setSaveState:e}},q4=new Fu1;q4.setLimit(50);const fe=()=>{const[,t]=l1.useAtom(I0),e=M2("onSaveStateChange",T.noop);return h.useEffect(()=>(q4.setCallback(()=>{t("UNSAVED"),e("UNSAVED")}),()=>{q4.setCallback(T.noop)}),[]),{add:q4.add,undo:q4.undo,redo:q4.redo,hasRedo:q4.hasRedo,hasUndo:q4.hasUndo,clear:q4.clear}},an=(t,e)=>{const c=[],a=T.filter(t,r=>T.includes(e,r._id)||T.includes(e,r._parent)?(c.push(r._id),!1):!0);return T.isEmpty(c)?a:an(a,c)},CL=()=>{const[t]=Q4(),[e,c]=g3(),{setNewBlocks:a}=A4();return h.useCallback(r=>{var o;const n=((o=T.find(t,{_id:r[0]}))==null?void 0:o._parent)||null;a(an(t,r)),setTimeout(()=>c(n?[n]:[]),200)},[t,c,e])};function Iu1(t,e,c,a){let r=t.filter(s=>!s._parent);c&&(r=t.filter(s=>s._parent===c));const n=a!==void 0?a:r.length;let o=t.length;for(let s=0,l=0;s<t.length;s++)if(t[s]._parent===c){if(l===n){o=s;break}l++}return!c&&a!==void 0&&a>=r.length&&(o=t.length),[...t.slice(0,o),...e,...t.slice(o)]}function Nu1(t){let e=[];return t.walk(c=>(delete c.model.children,e.push(c.model),!0)),e}function _f(t,e){return t.first(c=>c.model._id===e)||null}function ju1(t,e,c,a){const r=_f(t,e),n=_f(t,c);if(r&&n){r.drop(),n.children||(n.model.children=[]);try{n.addChildAtIndex(r,a)}catch(o){return console.error("Error adding child to parent:",o),!1}return!0}return!1}function Tu1(t,e,c,a){if(!e)return t;c=c||"root";const n=new kA().parse({_id:"root",children:pL(t)});if(ju1(n,e,c,a)){const o=Nu1(n),s=o.find(l=>l._id===e);return s&&(s._parent=c==="root"?null:c),o.shift(),o}return t}const Du1=()=>{const[,t]=Q4();return{setNewBlocks:e=>{t(e)},addBlocks:(e,c,a)=>{t(r=>Iu1(r,e,c,a))},removeBlocks:e=>{t(c=>an(c,e))},moveBlocks:(e,c,a)=>{t(r=>{let n=r;for(let o=0;o<e.length;o++)n=Tu1(n,e[o],c,a);return n})},updateBlocksProps:e=>{t(c=>{const a=e.map(r=>r._id);return c.map(r=>{if(a.includes(r._id)){const n=T.find(e,{_id:r._id});return{...r,...T.omit(n,"_id")}}return r})})}}},Q4=()=>l1.useAtom(S4),A4=()=>{const{add:t}=fe(),[e]=Q4(),{setNewBlocks:c,addBlocks:a,removeBlocks:r,moveBlocks:n,updateBlocksProps:o}=Du1();return{moveBlocks:(p,g,m)=>{const z=T.map(p,w=>{const C=e.find(F=>F._id===w)._parent||null,S=e.filter(F=>C?F._parent===C:!F._parent).map(F=>F._id).indexOf(w);return{_id:w,oldParent:C,oldPosition:S}}),b=z.find(({_id:w})=>w===p[0]);b&&b.oldParent===g&&b.oldPosition===m||(n(p,g,m),t({undo:()=>T.each(z,({_id:w,oldParent:V,oldPosition:C})=>{n([w],V,C)}),redo:()=>n(p,g,m)}))},addBlocks:(p,g,m)=>{a(p,g,m),t({undo:()=>r(T.map(p,"_id")),redo:()=>a(p,g,m)})},removeBlocks:p=>{var b;const g=(b=T.first(p))==null?void 0:b._parent,z=e.filter(w=>g?w._parent===g:!w._parent).indexOf(T.first(p));r(T.map(p,"_id")),t({undo:()=>a(p,g,z),redo:()=>r(T.map(p,"_id"))})},updateBlocks:(p,g,m)=>{let z=[];if(m)z=T.map(p,b=>({_id:b,...m}));else{const b=T.keys(g);z=T.map(p,w=>{const V=e.find(H=>H._id===w),C={_id:w};return T.each(b,H=>C[H]=V[H]),C})}o(T.map(p,b=>({_id:b,...g}))),t({undo:()=>o(z),redo:()=>o(T.map(p,b=>({_id:b,...g})))})},updateBlocksRuntime:(p,g)=>{o(T.map(p,m=>({_id:m,...g})))},setNewBlocks:p=>{c(p),t({undo:()=>c(e),redo:()=>c(p)})},updateMultipleBlocksProps:p=>{let g=[];g=T.map(p,m=>{const z=T.keys(m),b=e.find(V=>V._id===m._id),w={};return T.each(z,V=>w[V]=b[V]),w}),o(p),t({undo:()=>o(g),redo:()=>o(p)})}}},qu1=()=>{const[t]=Q4(),[,e]=g3(),{addBlocks:c}=A4(),a=h.useCallback((n,o,s)=>{var v;for(let f=0;f<n.length;f++){const{_id:p}=n[f];n[f]._id=U4.generateUUID();const g=T.filter(n,{_parent:p});for(let m=0;m<g.length;m++)g[m]._parent=n[f]._id}const l=T.first(n);let u,i;return o&&(u=T.find(t,{_id:o}),n[0]._parent=o,i=o),!(u?nL(u._type,l._type):!0)&&u&&(n[0]._parent=u._parent,i=u._parent),c(n,i,s),e([(v=T.first(n))==null?void 0:v._id]),T.first(n)},[t,e]);return{addCoreBlock:h.useCallback((n,o,s)=>{if(T.has(n,"blocks")){const m=n.blocks;return a(m,o,s)}const l=U4.generateUUID(),u=fL(n.props),i=[];T.forIn(u,(m,z)=>{if(T.startsWith(m,x4.SLOT_KEY)){const b=m.replace(x4.SLOT_KEY,"");i.push({_id:b,_type:"Slot",_parent:l,_name:n.props[z].name,_styles:n.props[z].styles,_emptyStyles:n.props[z].emptyStyles})}});const d={_type:n.type,_id:l,...u};let v,f;o&&(v=T.find(t,{_id:o}),d._parent=o,f=o),!!0&&v&&(d._parent=v._parent,f=v._parent);const g=[d,...i];return c(g,f,s),e([d._id]),d},[a,t,e]),addPredefinedBlock:a}},$f={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},tg=["xs","sm","md","lg","xl","2xl"];function Zu1(t,e){if(e===null)return"baseClasses";const c=e.mq;if(c==="xs"||e.dark||e.mod!=="")return"classes";let a="baseClasses",r=tg.indexOf(c);for(;r>0;){const n=tg[r-1];if(T.find(t,{mq:n,property:e.property})){a="classes";break}r--}return a}const eg=[];function Wu1(t="",e="",c=[]){t=t.trim().replace(/ +/g,"");let a=T.filter(T.map(t.split(" "),s1.constructClassObject),u=>!T.isNull(u)),r=T.filter(T.map(e.split(" "),s1.constructClassObject),u=>!T.isNull(u));r=T.filter(r,u=>!T.includes(eg,u.property));const n=[],o=[];T.each(c,u=>{const i=s1.constructClassObject(u),d=T.find(a,T.pick(i,["dark","mq","mod","property"]));if(d&&(a=T.filter(a,v=>v.fullCls!==(d==null?void 0:d.fullCls))),n.push(i),i.mq==="xs"&&!i.dark&&i.mod===""&&(r=T.filter(r,v=>v.property!==i.property)),Zu1(a,i)==="baseClasses"&&!T.includes(eg,i.property)){const v=T.find(r,T.pick(i,["property"]));d&&(r=T.filter(r,f=>f.fullCls!==(v==null?void 0:v.fullCls))),o.push({...i,fullCls:i.cls,mq:"xs"})}});const s=T.map(T.sortBy([...a,...n],u=>$f[u.mq]),"fullCls").join(" ");return`${T.map(T.sortBy([...r,...o],u=>$f[u.mq]),"fullCls").join(" ").trim()},${s.trim()}`.trim().replace(/ +/g,"")}const N0=l1.atom([]);N0.debugLabel="selectedStylingBlocksAtom";const VL=()=>l1.useAtom(N0),Uu1=t=>{const e=t.replace(x4.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},Ku1=l1.atom(null,(t,e,{blockIds:c,newClasses:a})=>{const r=T.filter(t(Jr),o=>c.includes(t(o)._id)),n=T.first(t(N0));return T.map(r,o=>{const s=t(o),l=T.get(s,n.prop,`${x4.STYLES_KEY},`),{baseClasses:u,classes:i}=Uu1(l);return{ids:[s._id],props:{[n.prop]:`${x4.STYLES_KEY}${Wu1(i,u,a)}`}}})}),Gu1=()=>{const t=l1.useSetAtom(Ku1),{updateBlocks:e,updateBlocksRuntime:c}=A4();return h.useCallback((a,r,n=!1)=>{const o=t({blockIds:a,newClasses:r});if(!n){c(a,o[0].props);return}e(a,o[0].props)},[t])},HL=()=>l1.useAtom(vL),yL=g4("canvasWidth",800),xL=l1.atom(t=>{const e=t(yL);return U4.getBreakpointValue(e).toLowerCase()}),Ju1=()=>{const[t,e]=l1.useAtom(yL),c=l1.useAtomValue(xL),[a,r]=HL();return h.useEffect(()=>{a!=="xs"&&r(c)},[c,a,r]),[t,c,e]},Yu1=g4("canvasZoom",100),Xu1=()=>l1.useAtom(Yu1),LL=l1.atom([]),SL=()=>{const[t,e]=l1.useAtom(LL),c=l1.useSetAtom(rn),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},rn=l1.atom([]),Qu1=()=>{const[t,e]=l1.useAtom(rn),c=l1.useSetAtom(LL),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},AL=g4("darkMode",!1),_u1=()=>{const[t,e]=l1.useAtom(AL);return[t,e]},nn=()=>{const[t]=Q4(),[,e]=g3(),{addBlocks:c}=A4();return h.useCallback((a,r=null)=>{const n=[];T.each(a,o=>{const s=t.find(v=>v._id===o);r||(r=s._parent);const i=T.filter(t,v=>T.isString(r)?v._parent===r:!s._parent).indexOf(s)+1,d=gu1(t,o,r);c(d,r,i),n.push(T.get(d,"0._id",""))}),e(n)},[t,e])},$u1=l1.atom([]),td1=()=>{const[t,e]=l1.useAtom($u1),c=h.useCallback(a=>{e(r=>T.includes(r,a)?T.without(r,a):[...r,a])},[e]);return[t,e,c]},ed1=l1.atom(""),FL=()=>l1.useAtom(ed1),cd1=()=>{const t=l1.useAtomValue(S4);return h.useCallback((e,c)=>{const a=T.map(t,r=>(T.includes(e,T.get(r,"_id"))&&T.set(r,"_parent",c),r));console.log("newBlocks",a)},[t])},ad1=()=>{console.warn("usePasteBlocks is not implemented");const t=l1.useAtomValue(rn),[e,c]=SL(),a=nn(),r=cd1();return{canPaste:h.useMemo(()=>e.length>0||t.length>0,[t,e]),pasteBlocks:h.useCallback(o=>{T.isEmpty(t)?r(e,o):a(t,o),c(()=>[])},[e,t,a,r,c])}},rd1=l1.atom(!1),BL=()=>{const[t,e]=l1.useAtom(rd1);return[t,e]},nd1=l1.atom(null,(t,e,{blockIds:c,fullClasses:a})=>{const r=T.first(t(N0)),n=T.filter(t(Jr),o=>c.includes(t(o)._id));return T.map(n,o=>{const s=t(o),l=a;let{classes:u,baseClasses:i}=hu1(T.get(s,r.prop,"styles:,"));return T.each(l,d=>{const v=d.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),f=new RegExp(`(^| )${v}($| )`,"g");u=u.replace(f," ").replace(/ +/g," ").trim();const p=T.first(d.split(":"));T.includes(["2xl","xl","lg","md","sm"],p)&&l.push(d.split(":").pop().trim())}),T.each(l,d=>{const v=new RegExp(`(^| )${d.replace("[","\\[").replace("]","\\]")}($| )`,"g");i=i.replace(v," ").replace(/ +/g," ").trim()}),{ids:[s._id],props:{[r.prop]:`${x4.STYLES_KEY}${i},${u}`}}})}),od1=()=>{const{updateBlocks:t}=A4(),e=l1.useSetAtom(nd1);return h.useCallback((c,a)=>{const r=e({blockIds:c,fullClasses:a});t(c,r[0].props)},[e])},EL=l1.atom(t=>{const e=T.first(t(N0)),c=t(he);if(!e||e.blockId!==T.get(c,"_id",null))return[];const r=T.get(c,e.prop,`${x4.STYLES_KEY},`).replace(x4.STYLES_KEY,"").split(",").join(" ");return T.filter(T.map(r.trim().split(" "),s1.constructClassObject),n=>!T.isNull(n))}),sd1=()=>l1.useAtomValue(EL),cg={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},ld1=l1.atom(t=>{const e=t(xL),c=t(Qr),a=t(AL),r=id1(e);let n=T.filter(t(EL),{mod:c});return T.startsWith(c,"_")||(n=T.filter(n,o=>r.includes(o.mq))),n=n.sort((o,s)=>cg[o.mq]-cg[s.mq]),a||(n=T.filter(n,{dark:!1})),n}),id1=t=>{let e=[];switch(t){case"xs":e=["xs"];break;case"sm":e=["xs","sm"];break;case"md":e=["xs","sm","md"];break;case"lg":e=["xs","sm","md","lg"];break;case"xl":e=["xs","sm","md","lg","xl"];break;case"2xl":e=["xs","sm","md","lg","xl","2xl"];break;default:e=["xs"];break}return e},ud1=()=>l1.useAtomValue(ld1),dd1=()=>l1.useAtom(Qr),hd1=()=>{const{updateBlocks:t}=A4();return h.useCallback((e,c,a)=>{t(e,c,a)},[t])},vd1=()=>{const{updateMultipleBlocksProps:t}=A4();return h.useCallback(e=>{t(e)},[t])},fd1=()=>{const{updateBlocksRuntime:t}=A4();return h.useCallback(async(e,c,a=30)=>{const r=T.keys(T.omit(c,["_id"]));for(const n of r){const o=c[n];if(T.isString(o)){const s=T.chunk(o.split(""),12);let l="";t([e],{[n]:""});for(let u=0;u<s.length;u++)l+=s[u].join(""),t([e],{[n]:l}),await new Promise(i=>setTimeout(i,a))}}},[t])},gd1=()=>{const{updateMultipleBlocksProps:t}=A4(),e=fd1();return h.useCallback(async c=>{for(const a of c)await e(a._id,a);t(c)},[t])},pd1=()=>{const{updateBlocksRuntime:t}=A4();return h.useCallback((e,c)=>{t(e,c)},[t])},OL={name:"",props:{},modalProps:{},backdropClose:!0},md1=l1.atom(OL),zd1=()=>{const[t,e]=l1.useAtom(md1),c=h.useCallback((r,n={},o={})=>{e({name:r,props:n,modalProps:o})},[e]),a=h.useCallback((...r)=>{T.get(t,"props.onClose",()=>{})(...r),e(OL)},[e,t]);return{activeModal:t,openModal:c,closeModal:a}},bd1=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),l1.useAtomValue(S4)),PL=l1.atom(!1);PL.debugLabel="readOnlyModeAtom";const kL=l1.atom("online");kL.debugLabel="networkModeAtom";const Md1=l1.atom(!1);Md1.debugLabel="codeEditorOpenAtom";const RL=l1.atom(!1);RL.debugLabel="editLayerNameAtom";const wd1=l1.atom("");wd1.debugLabel="activeLanguageAtom";const Cd1=l1.atom("");Cd1.debugLabel="primaryLanguageAtom";const IL=l1.atom(null);IL.debugLabel="canvasIframeAtom";const NL=l1.atom("outline");NL.debugLabel="activePanelAtom";const jL=l1.atom("");jL.debugLabel="showPredefinedBlockCategoryAtom";const TL=l1.atom({undoCount:0,redoCount:0});TL.debugLabel="historyStatesAtom";const DL=l1.atom("");DL.debugLabel="inlineEditingActiveAtom";const qL=l1.atom(!1);qL.debugLabel="draggingFlagAtom";const ZL=l1.atom("");ZL.debugLabel="draggedBlockIdAtom";const WL=l1.atom(null);WL.debugLabel="treeRefAtom";const UL=l1.atom({});UL.debugLabel="canvasSettingsAtom";const ge=l1.atom(!1);ge.debugLabel="askAiActiveBlockAtom";const Vd1=()=>l1.useAtomValue(PL),Hd1=l1.atom(""),yd1=l1.atom(null),xd1=()=>l1.useAtom(Hd1),Ld1=()=>l1.useAtom(yd1),Sd1=g4("selectedBreakpoints",["XS","MD","XL"]),Ad1=()=>{const[t,e]=l1.useAtom(Sd1);return[t,e]},KL=()=>{const t=l1.useSetAtom(TL),{clear:e}=fe(),[,c]=g3(),[,a]=FL(),[,r]=VL(),[,n]=_2(ge);return()=>{c([]),r([]),a(""),e(),n(!1),t({undoCount:0,redoCount:0})}},Fd1=()=>({data:M2("uiLibraries",[]),isLoading:!1}),Bd1=()=>{const[t,e]=h.useState(null),c=h.useCallback(async a=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(a),e(a),!0}catch(r){return console.warn("Copy failed",r),e(null),!1}},[]);return[t,c]},GL=N3.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"}}),JL=x.forwardRef(({className:t,variant:e,size:c,...a},r)=>L.jsxRuntimeExports.jsx(dg.Root,{ref:r,className:s1.cn(GL({variant:e,size:c,className:t})),...a}));JL.displayName=dg.Root.displayName;const YL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Ec.Root,{className:s1.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",t),...e,ref:c,children:L.jsxRuntimeExports.jsx(Ec.Thumb,{className:s1.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")})}));YL.displayName=Ec.Root.displayName;const pe=N3.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"}}),i3=x.forwardRef(({className:t,variant:e,size:c,asChild:a=!1,...r},n)=>{const o=a?NA.Slot:"button";return L.jsxRuntimeExports.jsx(o,{className:s1.cn(pe({variant:e,size:c,className:t})),ref:n,...r})});i3.displayName="Button";const XL=B3.Root,on=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(B3.Item,{ref:c,className:s1.cn("border-b",t),...e}));on.displayName="AccordionItem";const sn=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(B3.Header,{className:"flex",children:L.jsxRuntimeExports.jsxs(B3.Trigger,{ref:a,className:s1.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...c,children:[e,c.hideArrow?null:L.jsxRuntimeExports.jsx(s2.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));sn.displayName=B3.Trigger.displayName;const ln=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(B3.Content,{ref:a,className:s1.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",t),...c,children:L.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:e})}));ln.displayName=B3.Content.displayName;const Ed1=N3.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"}}),QL=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx("div",{ref:a,role:"alert",className:s1.cn(Ed1({variant:e}),t),...c}));QL.displayName="Alert";const _L=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h5",{ref:c,className:s1.cn("mb-1 font-medium leading-none tracking-tight",t),...e}));_L.displayName="AlertTitle";const $L=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("text-sm [&_p]:leading-relaxed",t),...e}));$L.displayName="AlertDescription";const tS=N3.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"}}),Od1=({className:t,variant:e,...c})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn(tS({variant:e}),t),...c}),eS=j2.Root,cS=j2.Trigger,aS=({className:t,...e})=>L.jsxRuntimeExports.jsx(j2.Portal,{className:s1.cn(t),...e});aS.displayName=j2.Portal.displayName;const rS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Overlay,{className:s1.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",t),...e,ref:c}));rS.displayName=j2.Overlay.displayName;const un=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs(aS,{children:[L.jsxRuntimeExports.jsx(rS,{}),L.jsxRuntimeExports.jsx(j2.Content,{ref:c,className:s1.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",t),...e})]}));un.displayName=j2.Content.displayName;const dn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});dn.displayName="AlertDialogHeader";const hn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});hn.displayName="AlertDialogFooter";const vn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Title,{ref:c,className:s1.cn("text-lg font-semibold",t),...e}));vn.displayName=j2.Title.displayName;const fn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));fn.displayName=j2.Description.displayName;const gn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Action,{ref:c,className:s1.cn(pe(),t),...e}));gn.displayName=j2.Action.displayName;const pn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Cancel,{ref:c,className:s1.cn(pe({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));pn.displayName=j2.Cancel.displayName;const mn=J1.Root,nS=J1.Trigger,oS=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});oS.displayName=J1.Portal.displayName;const sS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Overlay,{ref:c,className:s1.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",t),...e}));sS.displayName=J1.Overlay.displayName;const me=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(oS,{children:[L.jsxRuntimeExports.jsx(sS,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:a,className:s1.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",t),...c,children:[e,L.jsxRuntimeExports.jsxs(J1.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:[L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));me.displayName=J1.Content.displayName;const lS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});lS.displayName="DialogHeader";const iS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});iS.displayName="DialogFooter";const uS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold leading-none tracking-tight",t),...e}));uS.displayName=J1.Title.displayName;const dS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));dS.displayName=J1.Description.displayName;const hS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("rounded-xl border bg-card text-card-foreground shadow",t),...e}));hS.displayName="Card";const vS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("flex flex-col space-y-1.5 p-6",t),...e}));vS.displayName="CardHeader";const fS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h3",{ref:c,className:s1.cn("font-semibold leading-none tracking-tight",t),...e}));fS.displayName="CardTitle";const gS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("p",{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));gS.displayName="CardDescription";const pS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("p-6 pt-0",t),...e}));pS.displayName="CardContent";const mS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn(" flex items-center p-6 pt-0",t),...e}));mS.displayName="CardFooter";const zS=x.forwardRef(({className:t,type:e,...c},a)=>L.jsxRuntimeExports.jsx("input",{type:e,className:s1.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",t),ref:a,...c}));zS.displayName="Input";const Pd1=N3.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),bS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(hg.Root,{ref:c,className:s1.cn(Pd1(),t),...e}));bS.displayName=hg.Root.displayName;const ze=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("textarea",{className:s1.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",t),ref:c,...e}));ze.displayName="Textarea";const MS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(K2.Root,{ref:a,className:s1.cn("relative overflow-hidden",t),...c,children:[L.jsxRuntimeExports.jsx(K2.Viewport,{className:"h-full w-full rounded-[inherit]",children:e}),L.jsxRuntimeExports.jsx(zn,{}),L.jsxRuntimeExports.jsx(K2.Corner,{})]}));MS.displayName=K2.Root.displayName;const zn=x.forwardRef(({className:t,orientation:e="vertical",...c},a)=>L.jsxRuntimeExports.jsx(K2.ScrollAreaScrollbar,{ref:a,orientation:e,className:s1.cn("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",t),...c,children:L.jsxRuntimeExports.jsx(K2.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));zn.displayName=K2.ScrollAreaScrollbar.displayName;const wS=j3.Root,bn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.List,{ref:c,className:s1.cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));bn.displayName=j3.List.displayName;const yt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.Trigger,{ref:c,className:s1.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",t),...e}));yt.displayName=j3.Trigger.displayName;const xt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.Content,{ref:c,className:s1.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));xt.displayName=j3.Content.displayName;const kd1=y6.Portal,CS=y6.Provider,Rd1=y6.Root,Id1=y6.Trigger,VS=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(y6.Content,{ref:a,sideOffset:e,className:s1.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",t),...c}));VS.displayName=y6.Content.displayName;const Nd1=u0.Root,jd1=u0.Trigger,HS=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(u0.Portal,{children:L.jsxRuntimeExports.jsx(u0.Content,{ref:r,align:e,sideOffset:c,className:s1.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",t),...a})}));HS.displayName=u0.Content.displayName;const Td1=K1.Menu,Dd1=K1.Group,qd1=K1.Portal,Zd1=K1.Sub,Wd1=K1.RadioGroup,yS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Root,{ref:c,className:s1.cn("flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",t),...e}));yS.displayName=K1.Root.displayName;const xS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Trigger,{ref:c,className:s1.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",t),...e}));xS.displayName=K1.Trigger.displayName;const LS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(K1.SubTrigger,{ref:r,className:s1.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",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));LS.displayName=K1.SubTrigger.displayName;const SS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.SubContent,{ref:c,className:s1.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",t),...e}));SS.displayName=K1.SubContent.displayName;const AS=x.forwardRef(({className:t,align:e="start",alignOffset:c=-4,sideOffset:a=8,...r},n)=>L.jsxRuntimeExports.jsx(K1.Portal,{children:L.jsxRuntimeExports.jsx(K1.Content,{ref:n,align:e,alignOffset:c,sideOffset:a,className:s1.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",t),...r})}));AS.displayName=K1.Content.displayName;const FS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(K1.Item,{ref:a,className:s1.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",e&&"pl-8",t),...c}));FS.displayName=K1.Item.displayName;const BS=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(K1.CheckboxItem,{ref:r,className:s1.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",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(K1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));BS.displayName=K1.CheckboxItem.displayName;const ES=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(K1.RadioItem,{ref:a,className:s1.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",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(K1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));ES.displayName=K1.RadioItem.displayName;const OS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(K1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));OS.displayName=K1.Label.displayName;const PS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));PS.displayName=K1.Separator.displayName;const kS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});kS.displayname="MenubarShortcut";const Ud1=St.Root,Kd1=St.Trigger,RS=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(St.Content,{ref:r,align:e,sideOffset:c,className:s1.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",t),...a}));RS.displayName=St.Content.displayName;const Gd1=x2.Root,Jd1=x2.Group,Yd1=x2.Value,IS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(x2.Trigger,{ref:a,className:s1.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",t),...c,children:[e,L.jsxRuntimeExports.jsx(x2.Icon,{asChild:!0,children:L.jsxRuntimeExports.jsx(s2.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));IS.displayName=x2.Trigger.displayName;const NS=x.forwardRef(({className:t,children:e,position:c="popper",...a},r)=>L.jsxRuntimeExports.jsx(x2.Portal,{children:L.jsxRuntimeExports.jsx(x2.Content,{ref:r,className:s1.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",c==="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",t),position:c,...a,children:L.jsxRuntimeExports.jsx(x2.Viewport,{className:s1.cn("p-1",c==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e})})}));NS.displayName=x2.Content.displayName;const jS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(x2.Label,{ref:c,className:s1.cn("px-2 py-1.5 text-sm font-semibold",t),...e}));jS.displayName=x2.Label.displayName;const TS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(x2.Item,{ref:a,className:s1.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",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(x2.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),L.jsxRuntimeExports.jsx(x2.ItemText,{children:e})]}));TS.displayName=x2.Item.displayName;const DS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(x2.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));DS.displayName=x2.Separator.displayName;const Xd1=J1.Root,Qd1=J1.Trigger,_d1=J1.Close,qS=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});qS.displayName=J1.Portal.displayName;const ZS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Overlay,{className:s1.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",t),...e,ref:c}));ZS.displayName=J1.Overlay.displayName;const $d1=N3.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"}}),WS=x.forwardRef(({side:t="right",className:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(qS,{children:[L.jsxRuntimeExports.jsx(ZS,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:r,className:s1.cn($d1({side:t}),e),...a,children:[c,L.jsxRuntimeExports.jsxs(J1.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:[L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));WS.displayName=J1.Content.displayName;const US=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});US.displayName="SheetHeader";const KS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});KS.displayName="SheetFooter";const GS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold text-foreground",t),...e}));GS.displayName=J1.Title.displayName;const JS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));JS.displayName=J1.Description.displayName;const YS=_1.Root,XS=_1.Trigger,th1=_1.Group,eh1=_1.Portal,ch1=_1.Sub,ah1=_1.RadioGroup,QS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(_1.SubTrigger,{ref:r,className:s1.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",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));QS.displayName=_1.SubTrigger.displayName;const _S=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(_1.SubContent,{ref:c,className:s1.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",t),...e}));_S.displayName=_1.SubContent.displayName;const Mn=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(_1.Portal,{children:L.jsxRuntimeExports.jsx(_1.Content,{ref:a,sideOffset:e,className:s1.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",t),...c})}));Mn.displayName=_1.Content.displayName;const f6=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(_1.Item,{ref:a,className:s1.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",e&&"pl-8",t),...c}));f6.displayName=_1.Item.displayName;const $S=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(_1.CheckboxItem,{ref:r,className:s1.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",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(_1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));$S.displayName=_1.CheckboxItem.displayName;const tA=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(_1.RadioItem,{ref:a,className:s1.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",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(_1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));tA.displayName=_1.RadioItem.displayName;const wn=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(_1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));wn.displayName=_1.Label.displayName;const Cn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(_1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));Cn.displayName=_1.Separator.displayName;const eA=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest opacity-60",t),...e});eA.displayName="DropdownMenuShortcut";const cA=x.forwardRef(({className:t,orientation:e="horizontal",decorative:c=!0,...a},r)=>L.jsxRuntimeExports.jsx(vg.Root,{ref:r,decorative:c,orientation:e,className:s1.cn("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...a}));cA.displayName=vg.Root.displayName;const rh1=1,nh1=1e6;let Ac=0;function oh1(){return Ac=(Ac+1)%Number.MAX_VALUE,Ac.toString()}const Fc=new Map,ag=t=>{if(Fc.has(t))return;const e=setTimeout(()=>{Fc.delete(t),i0({type:"REMOVE_TOAST",toastId:t})},nh1);Fc.set(t,e)},aA=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,rh1)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(c=>c.id===e.toast.id?{...c,...e.toast}:c)};case"DISMISS_TOAST":{const{toastId:c}=e;return c?ag(c):t.toasts.forEach(a=>{ag(a.id)}),{...t,toasts:t.toasts.map(a=>a.id===c||c===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(c=>c.id!==e.toastId)}}},Z8=[];let W8={toasts:[]};function i0(t){W8=aA(W8,t),Z8.forEach(e=>{e(W8)})}function rA({...t}){const e=oh1(),c=r=>i0({type:"UPDATE_TOAST",toast:{...r,id:e}}),a=()=>i0({type:"DISMISS_TOAST",toastId:e});return i0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:r=>{r||a()}}}),{id:e,dismiss:a,update:c}}function Vn(){const[t,e]=x.useState(W8);return x.useEffect(()=>(Z8.push(e),()=>{const c=Z8.indexOf(e);c>-1&&Z8.splice(c,1)}),[t]),{...t,toast:rA,dismiss:c=>i0({type:"DISMISS_TOAST",toastId:c})}}const sh1=l4.Provider,nA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Viewport,{ref:c,className:s1.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]",t),...e}));nA.displayName=l4.Viewport.displayName;const lh1=N3.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"}}),oA=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx(l4.Root,{ref:a,className:s1.cn(lh1({variant:e}),t),...c}));oA.displayName=l4.Root.displayName;const ih1=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Action,{ref:c,className:s1.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",t),...e}));ih1.displayName=l4.Action.displayName;const sA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Close,{ref:c,className:s1.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",t),"toast-close":"",...e,children:L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"})}));sA.displayName=l4.Close.displayName;const lA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Title,{ref:c,className:s1.cn("text-sm font-semibold [&+div]:text-xs",t),...e}));lA.displayName=l4.Title.displayName;const iA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Description,{ref:c,className:s1.cn("text-sm opacity-90",t),...e}));iA.displayName=l4.Description.displayName;function uA(){const{toasts:t}=Vn();return L.jsxRuntimeExports.jsxs(sh1,{children:[t.map(({id:e,title:c,description:a,action:r,...n})=>L.jsxRuntimeExports.jsxs(oA,{...n,children:[L.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[c&&L.jsxRuntimeExports.jsx(lA,{children:c}),a&&L.jsxRuntimeExports.jsx(iA,{children:a})]}),r,L.jsxRuntimeExports.jsx(sA,{})]},e)),L.jsxRuntimeExports.jsx(nA,{})]})}const Hn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("animate-pulse rounded-md bg-primary/10",t),...e}),yn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command,{ref:c,className:s1.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));yn.displayName=X2.Command.displayName;const uh1=({children:t,...e})=>L.jsxRuntimeExports.jsx(mn,{...e,children:L.jsxRuntimeExports.jsx(me,{className:"overflow-hidden p-0",children:L.jsxRuntimeExports.jsx(yn,{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:t})})}),dA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[L.jsxRuntimeExports.jsx(s2.MagnifyingGlassIcon,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),L.jsxRuntimeExports.jsx(X2.Command.Input,{ref:c,className:s1.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",t),...e})]}));dA.displayName=X2.Command.Input.displayName;const hA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.List,{ref:c,className:s1.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));hA.displayName=X2.Command.List.displayName;const vA=x.forwardRef((t,e)=>L.jsxRuntimeExports.jsx(X2.Command.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));vA.displayName=X2.Command.Empty.displayName;const fA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Group,{ref:c,className:s1.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",t),...e}));fA.displayName=X2.Command.Group.displayName;const gA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Separator,{ref:c,className:s1.cn("-mx-1 h-px bg-border",t),...e}));gA.displayName=X2.Command.Separator.displayName;const pA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Item,{ref:c,className:s1.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",t),...e}));pA.displayName=X2.Command.Item.displayName;const mA=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});mA.displayName="CommandShortcut";const dh1=$1.Root,hh1=$1.Trigger,vh1=$1.Group,fh1=$1.Portal,gh1=$1.Sub,ph1=$1.RadioGroup,zA=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs($1.SubTrigger,{ref:r,className:s1.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",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));zA.displayName=$1.SubTrigger.displayName;const bA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.SubContent,{ref:c,className:s1.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",t),...e}));bA.displayName=$1.SubContent.displayName;const MA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.Portal,{children:L.jsxRuntimeExports.jsx($1.Content,{ref:c,className:s1.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",t),...e})}));MA.displayName=$1.Content.displayName;const wA=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx($1.Item,{ref:a,className:s1.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",e&&"pl-8",t),...c}));wA.displayName=$1.Item.displayName;const CA=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs($1.CheckboxItem,{ref:r,className:s1.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",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx($1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));CA.displayName=$1.CheckboxItem.displayName;const VA=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs($1.RadioItem,{ref:a,className:s1.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",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx($1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));VA.displayName=$1.RadioItem.displayName;const HA=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx($1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...c}));HA.displayName=$1.Label.displayName;const yA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-border",t),...e}));yA.displayName=$1.Separator.displayName;const xA=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});xA.displayName="ContextMenuShortcut";const mh1=t=>{try{const e=document.getElementById("icon-picker-field"),c=document.createElement("div");ma.render(L.jsxRuntimeExports.jsx(ug.IconPickerItem,{value:t}),c),e.appendChild(c),c.hidden=!0;let a=c.innerHTML;setTimeout(()=>e.removeChild(c),100);const n=new DOMParser().parseFromString(a,"image/svg+xml"),o=n.querySelector("svg");return o&&(o.removeAttribute("width"),o.removeAttribute("height")),new XMLSerializer().serializeToString(n)}catch(e){return console.error(e),""}},zh1=({value:t,onChange:e})=>{const c=a=>{e("<svg />");const r=mh1(a);e(r)};return L.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[L.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[L.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:t?t.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"}),L.jsxRuntimeExports.jsx(ug,{value:t?"BiSolidGrid":null,onChange:c,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"}})]}),L.jsxRuntimeExports.jsx("textarea",{value:t,onChange:a=>e(a.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"})]})},bh1=h.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-QeZ65lKC.cjs"))),Mh1=h.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-igQroUtu.cjs"))),LA=({isModalView:t=!1,onSelect:e=()=>{}})=>{const c=M2("uploadMediaCallback"),a=M2("unsplashAccessKey"),r=c===void 0,n=a===void 0,[o,s]=h.useState(n?"upload":r?"unsplash":"upload");return L.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[L.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:L.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:t&&r?"Unsplash images":t?"Select or upload images":"Images"})}),L.jsxRuntimeExports.jsxs(wS,{value:o,onValueChange:l=>s(l),className:"flex h-full w-full flex-col py-2",children:[!(r||n)&&L.jsxRuntimeExports.jsxs(bn,{className:"w-full",children:[L.jsxRuntimeExports.jsx(yt,{value:"upload",className:"w-full",children:"Upload"}),L.jsxRuntimeExports.jsx(yt,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),o==="unsplash"?L.jsxRuntimeExports.jsx(xt,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:L.jsxRuntimeExports.jsx(bh1,{isModalView:t,onSelect:e})})}):L.jsxRuntimeExports.jsx(xt,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:L.jsxRuntimeExports.jsx(Mh1,{isModalView:t,onSelect:e})})})]})]})},wh1=Object.freeze(Object.defineProperty({__proto__:null,default:LA},Symbol.toStringTag,{value:"Module"})),rg=({children:t,onSelect:e})=>{const[c,a]=h.useState(!1),r=(...n)=>{e.call(void 0,...n),a(!1)};return L.jsxRuntimeExports.jsxs(mn,{open:c,onOpenChange:n=>a(n),children:[L.jsxRuntimeExports.jsx(nS,{asChild:!0,children:t}),L.jsxRuntimeExports.jsx(me,{className:"flex h-3/4 max-w-5xl",children:L.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:L.jsxRuntimeExports.jsx(LA,{isModalView:!0,onSelect:r})})})]})},Ch1=({value:t,onChange:e,id:c,onBlur:a})=>{const r=M2("uploadMediaCallback"),n=M2("unsplashAccessKey"),o=r===void 0,s=n===void 0;return L.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[t?L.jsxRuntimeExports.jsx("img",{src:t,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):L.jsxRuntimeExports.jsx(rg,{onSelect:e,children:L.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"})}),L.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[!(o&&s)&&L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(rg,{onSelect:e,children:L.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:t||!T.isEmpty(t)?"Replace Image":"Choose Image"})}),L.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"})]}),L.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:t,onBlur:({target:{value:l}})=>a(c,l),onChange:l=>e(l.target.value)})]})]})},Vh1=({id:t,placeholder:e,value:c,onChange:a,onBlur:r})=>{const n={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},o=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:L.jsxRuntimeExports.jsx($A,{id:t,value:c,onBlur:s=>r(t,s),onChange:s=>a(s),modules:n,formats:o,placeholder:e,className:"mt-1 rounded-md"})},Hh1=({schema:t,formData:e,onChange:c})=>{const[a,r]=h.useState([]),n=M2("getPages",()=>[]),{type:o="page",href:s="",target:l="self"}=e;return h.useEffect(()=>{(async()=>{const u=await n();r(u||[])})()},[]),L.jsxRuntimeExports.jsxs("div",{children:[L.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(t==null?void 0:t.title)??"Link"}),L.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[L.jsxRuntimeExports.jsx("select",{name:"type",value:o,onChange:u=>c({...e,type:u.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(u=>L.jsxRuntimeExports.jsx("option",{value:u.const,children:u.title},u.const))}),o==="page"?L.jsxRuntimeExports.jsxs("select",{name:"href",value:s,onChange:u=>c({...e,href:u.target.value}),children:[L.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),T.map(a,u=>L.jsxRuntimeExports.jsx("option",{value:u.slug,children:u.name},u.uuid))]}):L.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:s,onChange:u=>c({...e,href:u.target.value}),placeholder:o==="page"||o==="url"?"Enter URL":o==="scroll"?"#ElementID":"Enter detail"}),(o==="page"||o==="url")&&L.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[L.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:l==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>c({...e,target:l==="_blank"?"_self":"_blank"})}),L.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})},yh1=()=>{const[t,e]=BL(),{t:c}=Lt.useTranslation(),a=M2("previewComponent",null);return t?L.jsxRuntimeExports.jsxs("div",{className:U4.cn("fixed inset-0 z-[999] bg-background",t?"block":"hidden"),children:[L.jsxRuntimeExports.jsxs(i3,{size:"sm",className:"absolute right-0 top-0 m-4 space-x-2",onClick:()=>e(!1),children:[L.jsxRuntimeExports.jsx(s2.EyeClosedIcon,{}),L.jsxRuntimeExports.jsx("span",{children:c("Close Preview")})]}),L.jsxRuntimeExports.jsx("div",{children:a?L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx(Hn,{className:"h-96 w-full"}),children:h.createElement(a)}):null})]}):null},xh1=()=>{const[t,e]=g3(),c=CL(),a=nn(),{undo:r,redo:n}=fe();P6.useHotkeys("esc",()=>e([]),{},[e]),P6.useHotkeys("ctrl+d,command+d",()=>a(t),{preventDefault:!0},[t,a]),P6.useHotkeys("ctrl+z,command+z",()=>r(),{},[r]),P6.useHotkeys("ctrl+y,command+y",()=>n(),{},[n]),P6.useHotkeys("del, backspace",o=>{o.preventDefault(),c(t)},{},[t,c])},Lh1=(t,e)=>{const c=[];let a=T.find(t,{_id:e}),r=T.get(a,"_parent","");for(;T.isString(r)&&!T.isEmpty(r);)c.push(a==null?void 0:a._parent),a=T.find(t,{_id:r}),r=a==null?void 0:a._parent;return T.flatten(c)},Sh1=l1.atom([]),Ah1=()=>{const[t]=g3(),e=l1.useAtomValue(S4),[,c]=l1.useAtom(Sh1);h.useEffect(()=>{let a=[];const r=T.first(t);T.isString(r)&&(a=[r,...Lh1(e,r)]),c(a)},[t,e,c])};const SA=()=>l1.useAtom(aL),Fh1=()=>h.useMemo(()=>I3.getChaiDataProviders(),[]),Bh1=({children:t})=>{const[,e]=SA(),[c]=cn(),a=Fh1();return h.useEffect(()=>(e({}),T.each(c,r=>{const n=T.find(a,{providerKey:r.providerKey});if(n){const o=(n==null?void 0:n.mockFn)||(n==null?void 0:n.dataFn);o&&o(r.args).then(s=>e(l=>({...l,[r.providerKey]:s})))}}),()=>{T.each(c,r=>{e(n=>(delete n[r.providerKey],n))})}),[a,c,e]),L.jsxRuntimeExports.jsx(L.jsxRuntimeExports.Fragment,{children:t})};function Eh1(t,e,c){c.push(T.find(t,{_id:e}));const a=T.filter(t,{_parent:e});for(const r of a)c.push(...AA(r._id,t));return c}const AA=(t,e)=>{let c=[];return c=T.flattenDeep([...c,...Eh1(e,t,c)]),c},Oh1=l1.atom(!1),xn=()=>{const[t,e]=l1.useAtom(Oh1),[c,a]=h.useState(null),r=M2("askAiCallBack",null),n=gd1(),o=vd1(),[s]=Q4();return{askAi:h.useCallback(async(l,u,i,d)=>{if(r){e(!0),a(null);try{const v=l==="content"?T.cloneDeep(AA(u,s)):[T.cloneDeep(s.find(g=>g._id===u))];T.set(v,"0._parent",null);const{blocks:f,error:p}=await r(l,i,v);if(p){a(p);return}l==="styles"?o(f):n(f)}catch(v){a(v)}finally{e(!1),d&&d()}}},[r,s]),loading:t,error:c}};var FA={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ng=h.createContext&&h.createContext(FA),u3=function(){return u3=Object.assign||function(t){for(var e,c=1,a=arguments.length;c<a;c++){e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},u3.apply(this,arguments)},Ph1=function(t,e){var c={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(c[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(t);r<a.length;r++)e.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(t,a[r])&&(c[a[r]]=t[a[r]]);return c};function BA(t){return t&&t.map(function(e,c){return h.createElement(e.tag,u3({key:c},e.attr),BA(e.child))})}function j0(t){return function(e){return h.createElement(kh1,u3({attr:u3({},t.attr)},e),BA(t.child))}}function kh1(t){var e=function(c){var a=t.attr,r=t.size,n=t.title,o=Ph1(t,["attr","size","title"]),s=r||c.size||"1em",l;return c.className&&(l=c.className),t.className&&(l=(l?l+" ":"")+t.className),h.createElement("svg",u3({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},c.attr,a,o,{className:l,style:u3(u3({color:t.color||c.color},c.style),t.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),n&&h.createElement("title",null,n),t.children)};return ng!==void 0?h.createElement(ng.Consumer,null,function(c){return e(c)}):e(FA)}function Rh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"}}]})(t)}function EA(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"}}]})(t)}function Ih1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"}}]})(t)}function Nh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V285.7l-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"}}]})(t)}const jh1=[{name:"Improve writing",icon:Nh1,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:Rh1,prompt:"Discard current placeholder content and replace with meaningful relevant content."},{name:"Fix grammar",icon:s2.CheckIcon,prompt:"Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors."},{name:"Make longer",icon:s2.ArrowUpIcon,prompt:"Make all text elements longer."},{name:"Make shorter",icon:s2.ArrowDownIcon,prompt:"Make all text elements shorter."},{name:"Add emojis",icon:S3.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:S3.ShuffleIcon,prompt:"Randomize all text elements."}];function Th1({onClick:t}){const{loading:e}=xn();return L.jsxRuntimeExports.jsx("div",{className:e?"pointer-events-none opacity-50":"",children:L.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:jh1.map(({name:c,icon:a,subMenus:r,prompt:n})=>r?L.jsxRuntimeExports.jsxs(YS,{children:[L.jsxRuntimeExports.jsx(XS,{asChild:!0,children:L.jsxRuntimeExports.jsxs("li",{className:"flex cursor-pointer items-center space-x-2 hover:bg-gray-100",children:[L.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{children:c})]},c)}),L.jsxRuntimeExports.jsxs(Mn,{children:[L.jsxRuntimeExports.jsx(wn,{children:"My Account"}),L.jsxRuntimeExports.jsx(Cn,{}),L.jsxRuntimeExports.jsx(f6,{children:"Profile"}),L.jsxRuntimeExports.jsx(f6,{children:"Billing"}),L.jsxRuntimeExports.jsx(f6,{children:"Team"}),L.jsxRuntimeExports.jsx(f6,{children:"Subscription"})]})]}):L.jsxRuntimeExports.jsxs("li",{onClick:()=>t(n),className:"flex cursor-pointer items-center space-x-2 rounded p-1 pl-2 text-sm hover:bg-gray-100",children:[L.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{children:c})]},c))})})}const Dh1=({blockId:t})=>{const{t:e}=Lt.useTranslation(),{askAi:c,loading:a,error:r}=xn(),[n,o]=h.useState(""),s=h.useRef(null);h.useEffect(()=>{var u;(u=s.current)==null||u.focus()},[]);const l=()=>{r||o("")};return t?L.jsxRuntimeExports.jsxs("div",{className:"mt-4",children:[L.jsxRuntimeExports.jsxs("h2",{className:"mb-1 text-sm font-semibold leading-none tracking-tight",children:[e("Ask AI")," (GPT-4o mini)"]}),L.jsxRuntimeExports.jsx(ze,{ref:s,value:n,onChange:u=>o(u.target.value),placeholder:e("Ask AI to edit content"),className:"w-full border border-gray-400 focus:border-0",rows:3,onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c("content",t,n,l))}}),L.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:L.jsxRuntimeExports.jsx(i3,{disabled:n.trim().length<5||a,onClick:()=>c("content",t,n,l),variant:"default",className:"w-fit",size:"sm",children:a?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(S3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Edit with AI")}),a?L.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[L.jsxRuntimeExports.jsxs(Hn,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[L.jsxRuntimeExports.jsx(EA,{className:"h-4 w-4 animate-spin text-gray-500"}),L.jsxRuntimeExports.jsx("p",{className:"text-xs",children:e("Generating... Please wait")})]}),L.jsxRuntimeExports.jsx(i3,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:e("Stop")})]}):null]}),L.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:r&&L.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:r.message})}),L.jsxRuntimeExports.jsx(Th1,{onClick:u=>c("content",t,u,l)})]}):L.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:L.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[L.jsxRuntimeExports.jsx(S3.SparklesIcon,{className:"mx-auto text-3xl"}),L.jsxRuntimeExports.jsx("h1",{children:e("no_block_selected_for_ask_ai")})]})})},qh1=({onOpen:t})=>{const{t:e}=Lt.useTranslation(),c=M2("aiContext",""),[a,r]=h.useState(c),n=h.useRef(null),o=M2("saveAiContextCallback",T.noop),[s,l]=h.useState(!1),[u,i]=h.useState(null),[d,v]=h.useState(!1),{toast:f}=Vn(),p=h.useRef(null);h.useEffect(()=>{c&&r(c)},[c]);const g=async()=>{try{l(!0),i(null),await o(a),f({title:e("AI Context updated"),description:e("You can now ask AI to edit your content"),variant:"default"}),p.current.click()}catch(m){i(m)}finally{l(!1)}};return L.jsxRuntimeExports.jsx(XL,{onValueChange:m=>{t(m!==""),v(m!=="")},type:"single",collapsible:!0,className:"-mx-2 -mt-2 bg-gray-100 px-2",children:L.jsxRuntimeExports.jsxs(on,{value:"set-context",children:[L.jsxRuntimeExports.jsx(sn,{ref:p,hideArrow:!0,className:"py-2 hover:no-underline",children:L.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-between",children:[L.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:e("Set Context For AI")}),L.jsxRuntimeExports.jsxs(i3,{variant:"default",size:"sm",children:[L.jsxRuntimeExports.jsx("span",{children:e(d?"Cancel":"Edit")})," ",d?L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}):L.jsxRuntimeExports.jsx(S3.EditIcon,{className:"h-4 w-4"})]})]})}),L.jsxRuntimeExports.jsxs(ln,{children:[L.jsxRuntimeExports.jsx(ze,{ref:n,value:a,onChange:m=>r(m.target.value),placeholder:e("Tell about this page. Eg: This page is about ..."),className:"w-full border border-gray-400 bg-background focus:border",rows:10,onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),g())}}),c.trim().length===0?L.jsxRuntimeExports.jsx("p",{className:"mt-2 text-xs text-gray-500",children:e("Eg: This page is about an AI assistant app called Chai Studio. It allows users to create beautiful webpages and edit content with AI.")}):null,L.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex items-center",children:[L.jsxRuntimeExports.jsx(i3,{disabled:a.trim().length<5,onClick:()=>g(),variant:"default",className:"w-fit",size:"sm",children:s?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(S3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Save")}),c.trim().length>0?L.jsxRuntimeExports.jsxs(eS,{children:[L.jsxRuntimeExports.jsx(cS,{asChild:!0,children:L.jsxRuntimeExports.jsx(i3,{disabled:c.trim().length===0,variant:"ghost",className:"w-fit",size:"sm",children:s?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(S3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Delete")})}),L.jsxRuntimeExports.jsxs(un,{children:[L.jsxRuntimeExports.jsxs(dn,{children:[L.jsxRuntimeExports.jsx(vn,{children:e("Remove context?")}),L.jsxRuntimeExports.jsx(fn,{})]}),L.jsxRuntimeExports.jsxs(hn,{children:[L.jsxRuntimeExports.jsx(pn,{children:e("Cancel")}),L.jsxRuntimeExports.jsx(gn,{onClick:()=>{r(""),g()},children:"Yes, Delete"})]})]})]}):null]}),L.jsxRuntimeExports.jsx("div",{className:"mt-2 max-w-full",children:u&&L.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:u.message})})]})]})})},Zh1=()=>{const[t]=g3(),[e,c]=h.useState(!1);return L.jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 z-50 h-full w-full bg-background p-2",children:[L.jsxRuntimeExports.jsx(qh1,{onOpen:a=>c(a)}),e?null:L.jsxRuntimeExports.jsx(Dh1,{blockId:T.first(t)})]})},Wh1=h.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-s_Yl7HhG.cjs"))),Uh1=h.lazy(()=>Promise.resolve().then(()=>require("./Topbar-YzdQKElx.cjs"))),Kh1=h.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-pQP-jR11.cjs"))),Gh1=h.lazy(()=>Promise.resolve().then(()=>require("./Settings-jKpJi5Wy.cjs"))),Jh1=()=>{const{savePage:t}=wL(),e=M2("autoSaveSupport",!0),c=M2("autoSaveInterval",60);ig.useIntervalEffect(()=>{e&&t()},c*1e3)},Yh1=()=>{const[t]=l1.useAtom(I0),[e]=l1.useAtom(ge),c=n=>{du1()||n.preventDefault()};xh1(),Ah1(),Jh1(),h.useEffect(()=>(t!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[t]);const a=M2("editable",!0),r=M2("nonEditableComponent",null);return L.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-background text-foreground",children:L.jsxRuntimeExports.jsxs(CS,{children:[L.jsxRuntimeExports.jsxs("div",{onContextMenu:c,className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[L.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Uh1,{})})}),L.jsxRuntimeExports.jsxs("main",{className:"relative flex h-full flex-1 flex-row",children:[a?null:L.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 z-[500] flex h-full w-full items-center justify-center backdrop-blur-[2px]",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(r)})}),L.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-fit border-border",style:{maxHeight:"calc(100vh - 56px)"},children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Wh1,{})})}),L.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Kh1,{})})}),L.jsxRuntimeExports.jsxs("div",{className:"relative flex h-[100%] w-[280px] min-w-[280px] border-l border-border pb-10",children:[L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Gh1,{})}),e?L.jsxRuntimeExports.jsx(Zh1,{}):null]})]})]}),L.jsxRuntimeExports.jsx(yh1,{})]})})},og=l1.getDefaultStore(),Xh1=()=>L.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen bg-gray-900 py-12 sm:py-16 lg:py-20 xl:hidden",children:L.jsxRuntimeExports.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:L.jsxRuntimeExports.jsxs("div",{className:"mx-auto max-w-md text-center",children:[L.jsxRuntimeExports.jsx("img",{src:"https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/chaibuilder-blob-storage/175ac8d8-37fe-4707-bb4a-3c0cd6a6db75/gVH7O-Ir_400x400.png",alt:"Chai Builder",className:"mx-auto w-14 rounded-full"}),L.jsxRuntimeExports.jsx("br",{}),L.jsxRuntimeExports.jsx("h2",{className:"text-4xl font-bold text-white",children:"Screen too small"}),L.jsxRuntimeExports.jsx("p",{className:"mt-6 text-sm font-medium leading-6 text-white text-opacity-70",children:"Please view this page on greater than 1280px screen width."})]})})});let Qh1=!1;const _h1=t=>{Qh1=t};const $h1=t=>{const[,e]=Q4(),[,c]=ve(),a=KL();return h.useEffect(()=>{og.set(Gr,T.omit(t,["blocks","subPages","brandingOptions","dataProviders"]))},[t]),h.useEffect(()=>{og.set(en,t.dataProviders||[])},[t.dataProviders]),h.useEffect(()=>{e(I3.syncBlocksWithDefaults(t.blocks||[])),a()},[t.blocks]),h.useEffect(()=>{lg.changeLanguage(t.locale||"en")},[t.locale]),h.useEffect(()=>{_h1(t.showDebugLogs)},[t.showDebugLogs]),h.useEffect(()=>{c(t.brandingOptions)},[t.brandingOptions,c]),L.jsxRuntimeExports.jsx(Yh1,{})},tv1=t=>{const e=t._flags||{};return L.jsxRuntimeExports.jsxs(rL,{children:[L.jsxRuntimeExports.jsxs(PA.FlagsProvider,{features:{...uu1,...e},children:[L.jsxRuntimeExports.jsx(su1,{}),L.jsxRuntimeExports.jsx(Xh1,{}),L.jsxRuntimeExports.jsx($h1,{...t})]}),L.jsxRuntimeExports.jsx(uA,{})]})};exports.Accordion=XL;exports.AccordionContent=ln;exports.AccordionItem=on;exports.AccordionTrigger=sn;exports.Alert=QL;exports.AlertDescription=$L;exports.AlertDialog=eS;exports.AlertDialogAction=gn;exports.AlertDialogCancel=pn;exports.AlertDialogContent=un;exports.AlertDialogDescription=fn;exports.AlertDialogFooter=hn;exports.AlertDialogHeader=dn;exports.AlertDialogTitle=vn;exports.AlertDialogTrigger=cS;exports.AlertTitle=_L;exports.Badge=Od1;exports.BlocksExternalDataProvider=Bh1;exports.Button=i3;exports.Card=hS;exports.CardContent=pS;exports.CardDescription=gS;exports.CardFooter=mS;exports.CardHeader=vS;exports.CardTitle=fS;exports.ChaiBuilderEditor=tv1;exports.Command=yn;exports.CommandDialog=uh1;exports.CommandEmpty=vA;exports.CommandGroup=fA;exports.CommandInput=dA;exports.CommandItem=pA;exports.CommandList=hA;exports.CommandSeparator=gA;exports.CommandShortcut=mA;exports.ContextMenu=dh1;exports.ContextMenuCheckboxItem=CA;exports.ContextMenuContent=MA;exports.ContextMenuGroup=vh1;exports.ContextMenuItem=wA;exports.ContextMenuLabel=HA;exports.ContextMenuPortal=fh1;exports.ContextMenuRadioGroup=ph1;exports.ContextMenuRadioItem=VA;exports.ContextMenuSeparator=yA;exports.ContextMenuShortcut=xA;exports.ContextMenuSub=gh1;exports.ContextMenuSubContent=bA;exports.ContextMenuSubTrigger=zA;exports.ContextMenuTrigger=hh1;exports.Dialog=mn;exports.DialogContent=me;exports.DialogDescription=dS;exports.DialogFooter=iS;exports.DialogHeader=lS;exports.DialogTitle=uS;exports.DialogTrigger=nS;exports.DropdownMenu=YS;exports.DropdownMenuCheckboxItem=$S;exports.DropdownMenuContent=Mn;exports.DropdownMenuGroup=th1;exports.DropdownMenuItem=f6;exports.DropdownMenuLabel=wn;exports.DropdownMenuPortal=eh1;exports.DropdownMenuRadioGroup=ah1;exports.DropdownMenuRadioItem=tA;exports.DropdownMenuSeparator=Cn;exports.DropdownMenuShortcut=eA;exports.DropdownMenuSub=ch1;exports.DropdownMenuSubContent=_S;exports.DropdownMenuSubTrigger=QS;exports.DropdownMenuTrigger=XS;exports.ErrorBoundary=rL;exports.FaCircleCheck=Ih1;exports.FaSpinner=EA;exports.GenIcon=j0;exports.HoverCard=Ud1;exports.HoverCardContent=RS;exports.HoverCardTrigger=Kd1;exports.IconPickerField=zh1;exports.ImagePickerField=Ch1;exports.ImagesPanel=wh1;exports.Input=zS;exports.Label=bS;exports.LinkField=Hh1;exports.Menubar=yS;exports.MenubarCheckboxItem=BS;exports.MenubarContent=AS;exports.MenubarGroup=Dd1;exports.MenubarItem=FS;exports.MenubarLabel=OS;exports.MenubarMenu=Td1;exports.MenubarPortal=qd1;exports.MenubarRadioGroup=Wd1;exports.MenubarRadioItem=ES;exports.MenubarSeparator=PS;exports.MenubarShortcut=kS;exports.MenubarSub=Zd1;exports.MenubarSubContent=SS;exports.MenubarSubTrigger=LS;exports.MenubarTrigger=xS;exports.Popover=Nd1;exports.PopoverContent=HS;exports.PopoverTrigger=jd1;exports.RichTextEditorField=Vh1;exports.ScrollArea=MS;exports.ScrollBar=zn;exports.Select=Gd1;exports.SelectContent=NS;exports.SelectGroup=Jd1;exports.SelectItem=TS;exports.SelectLabel=jS;exports.SelectSeparator=DS;exports.SelectTrigger=IS;exports.SelectValue=Yd1;exports.Separator=cA;exports.Sheet=Xd1;exports.SheetClose=_d1;exports.SheetContent=WS;exports.SheetDescription=JS;exports.SheetFooter=KS;exports.SheetHeader=US;exports.SheetTitle=GS;exports.SheetTrigger=Qd1;exports.Skeleton=Hn;exports.Switch=YL;exports.Tabs=wS;exports.TabsContent=xt;exports.TabsList=bn;exports.TabsTrigger=yt;exports.Textarea=ze;exports.Toaster=uA;exports.Toggle=JL;exports.Tooltip=Rd1;exports.TooltipContent=VS;exports.TooltipPortal=kd1;exports.TooltipProvider=CS;exports.TooltipTrigger=Id1;exports.activePanelAtom=NL;exports.aiAssistantActiveAtom=ge;exports.badgeVariants=tS;exports.builderSaveStateAtom=I0;exports.buttonVariants=pe;exports.canAcceptChildBlock=nL;exports.canDeleteBlock=fu1;exports.canDuplicateBlock=vu1;exports.canvasIframeAtom=IL;exports.canvasSettingsAtom=UL;exports.convertDotNotationToObject=Su1;exports.draggedBlockIdAtom=ZL;exports.draggingFlagAtom=qL;exports.editLayerNameAtom=RL;exports.getBlockJSONFromSchemas=ga;exports.getBlockJSONFromUISchemas=fa;exports.inlineEditingActiveAtom=DL;exports.networkModeAtom=kL;exports.reducer=aA;exports.showPredefinedBlockCategoryAtom=jL;exports.toast=rA;exports.toggleVariants=GL;exports.treeDSBlocks=iL;exports.treeRefAtom=WL;exports.useActiveModal=zd1;exports.useActivePanel=xd1;exports.useAddBlock=qu1;exports.useAddBlockParent=Ld1;exports.useAddClassesToBlocks=Gu1;exports.useAllBlocks=bd1;exports.useAskAi=xn;exports.useBlocksContainer=Ou1;exports.useBlocksStore=Q4;exports.useBlocksStoreUndoableActions=A4;exports.useBrandingOptions=ve;exports.useBuilderProp=M2;exports.useBuilderReset=KL;exports.useCanvasWidth=Ju1;exports.useCanvasZoom=Xu1;exports.useChaiExternalData=SA;exports.useCopyBlockIds=Qu1;exports.useCopyToClipboard=Bd1;exports.useCurrentPage=gL;exports.useCutBlockIds=SL;exports.useDarkMode=_u1;exports.useDuplicateBlocks=nn;exports.useGetPageData=ML;exports.useHiddenBlockIds=td1;exports.useHighlightBlockId=FL;exports.usePageDataProviders=cn;exports.usePasteBlocks=ad1;exports.usePreviewMode=BL;exports.useReadOnlyMode=Vd1;exports.useRemoveBlocks=CL;exports.useRemoveClassesFromBlocks=od1;exports.useSavePage=wL;exports.useSelectedBlock=Cu1;exports.useSelectedBlockAllClasses=sd1;exports.useSelectedBlockCanvasSetting=yu1;exports.useSelectedBlockCurrentClasses=ud1;exports.useSelectedBlockIds=g3;exports.useSelectedBlocksDisplayChild=wu1;exports.useSelectedBreakpoints=Ad1;exports.useSelectedStylingBlocks=VL;exports.useStylingBreakpoint=HL;exports.useStylingState=dd1;exports.useToast=Vn;exports.useUILibraryBlocks=Fd1;exports.useUndoManager=fe;exports.useUpdateBlocksProps=hd1;exports.useUpdateBlocksPropsRealtime=pd1;
|
|
206
|
+
*/W();var su1=process.env.NODE_ENV!=="production"?ou1:()=>null;function lu1(){return new URLSearchParams(window.location.search).has("dnd")}function iu1(){return new URLSearchParams(window.location.search).has("outline")}const uu1={dnd:lu1(),arborist:iu1()},Gr=l1.atom(null);Gr.debugLabel="chaiBuilderPropsAtom";const aL=l1.atom({});aL.debugLabel="chaiExternalDataAtom";class rL extends h.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?L.jsxRuntimeExports.jsxs("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",id:"errorBoundary",children:[L.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),L.jsxRuntimeExports.jsx("p",{children:"Please try again later."})]}):this.props.children}}const du1=()=>!1,hu1=t=>{const e=t.replace(x4.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},nL=T.memoize((t,e)=>{if(!t)return!0;const c=I3.getBlockComponent(t);return c&&T.has(c,"canAcceptBlock")?c.canAcceptBlock(e):!1}),Vv1=T.memoize((t,e)=>{const c=I3.getBlockComponent(e);return c&&T.has(c,"canBeNested")?c.canBeNested(t):!0}),vu1=T.memoize(t=>{const e=I3.getBlockComponent(t);return e&&T.has(e,"canDuplicate")?e.canDuplicate():!0}),fu1=T.memoize(t=>{const e=I3.getBlockComponent(t);return e&&T.has(e,"canDelete")?e.canDelete():!0});function oL(t,e,c){const a=T.filter(t,n=>n._parent===e),r=[];for(let n=0;n<a.length;n++){const o=lL(a[n]);if(Object.keys(o).length>0&&Object.keys(o).forEach(s=>{a[n][s]=`slot:${U4.generateUUID()}`}),T.filter(t,{_parent:a[n]._id}).length>0){const s=U4.generateUUID();r.push({...a[n],oldId:a[n]._id,_id:s,_parent:c}),r.push(T.flatten(oL(t,a[n]._id,s)))}else r.push({...a[n],oldId:a[n]._id,_id:U4.generateUUID(),_parent:c})}return T.flatten(r)}function sL(t){const e={};t.forEach(a=>{e[a._id]={...a,children:[]}});const c=[];return t.forEach(a=>{if(a._parent){const r=e[a._parent];r&&r.children.push(e[a._id])}else c.push(e[a._id])}),c}const lL=t=>{const e={};return Object.keys(t).forEach(c=>{T.isString(t[c])&&t[c].startsWith("slot")&&(e[c]=t[c].replace("slot:",""))}),e},gu1=(t,e,c=null)=>{let a=T.find(t,{_id:e});a={...a,oldId:a._id,_id:U4.generateUUID()},c&&(a={...a,_parent:c});const r=[a];T.filter(t,{_parent:e}).length>0&&r.push(T.flatten(oL(t,e,a._id)));const n=T.flatten(r);return T.map(n,o=>{const s=o,l=lL(s);return Object.keys(l).length>0&&Object.keys(l).forEach(u=>{const i=T.find(n,{oldId:l[u].replace("slot:","")});s[u]=`slot:${i._id}`}),T.omit(s,["global","oldId"])})};const S4=l1.atom([]);S4.debugLabel="presentBlocksAtom";const iL=l1.atom(t=>{const e=t(S4);return sL([...e])});iL.debugLabel="treeDSBlocks";S4.debugLabel="presentBlocksAtom";const Jr=oe1(S4);Jr.debugLabel="pageBlocksAtomsAtom";const pu1=l1.atom("");pu1.debugLabel="builderActivePageAtom";const mu1=l1.atom(-1);mu1.debugLabel="destinationDropIndexAtom";const uL=l1.atom([]);uL.debugLabel="buildingBlocksAtom";const zu1=l1.atom(t=>{const e=t(uL);return T.filter(e,c=>T.has(c,"blockId"))});zu1.debugLabel="globalBlocksAtom";const Yr=l1.atom([]);Yr.debugLabel="selectedBlockIdsAtom";const Xr=l1.atom(t=>{const e=t(S4),c=t(Yr);return T.map(T.filter(e,({_id:a})=>T.includes(c,a)),a=>({...a}))});Xr.debugLabel="selectedBlocksAtom";const he=l1.atom(t=>{const e=t(Xr);if(e.length===0)return null;if(e.length===1)return e[0]});he.debugLabel="selectedBlockAtom";const bu1=t=>T.get(t,"_parent",null),Mu1=l1.atom(t=>{const e=t(Xr),c=T.map(e,bu1);return T.filter(t(S4),a=>T.includes(c,a._id))});Mu1.debugLabel="selectedBlocksParentsAtom";const dL=l1.atom(()=>!1);dL.debugLabel="selectedBlockFlexChildAtom";const hL=l1.atom(()=>!1);hL.debugLabel="selectedBlockGridChildAtom";const Qr=l1.atom("");Qr.debugLabel="styleStateAtom";const vL=g4("styleBreakpoint","xs");vL.debugLabel="styleBreakpointAtom";const wu1=()=>({flexChild:l1.useAtomValue(dL),gridChild:l1.useAtomValue(hL)}),Cu1=()=>l1.useAtomValue(he),Vu1=l1.atom(t=>{const e=t(he),c=t(S4);let a=e;const r=[e];do{const n=c.find(({_id:o})=>o===(a==null?void 0:a._parent));a=n,n&&r.push(n)}while(a!=null&&a._parent);return r}),Hu1=()=>l1.useAtomValue(Vu1),yu1=()=>{const t=Hu1();return h.useMemo(()=>{for(let e=0;e<t.length;e++){const c=I3.getBlockComponent(t[e]._type),a=T.cloneDeep(T.get(c,"blockState",{}));if(!T.isEmpty(a))return{settings:a,block:t[e]}}return{}},[t])};const g3=()=>{const[t,e]=l1.useAtom(Yr),c=h.useCallback(a=>{e(r=>T.includes(r,a)?T.without(r,a):[...r,a])},[e]);return[t,e,c]},fa=t=>{switch(t.type){case"singular":return t.uiSchema;case"model":const{properties:e}=t,c={};return Object.keys(e).forEach(n=>{const o=e[n];if(T.includes(["slot","styles"],o.type))return;const s=n;c[s]=fa(o)}),c;case"list":const{itemProperties:a}=t,r={items:{}};return Object.keys(a).forEach(n=>{const o=a[n];if(T.includes(["slot","styles"],o.type))return;const s=n;r.items[s]=fa(o)}),r;default:return{}}},ga=t=>{switch(t.type){case"singular":return t.schema;case"model":const{properties:e,title:c}=t,a={title:c,type:"object",properties:{}};return Object.keys(e).forEach(s=>{const l=e[s];if(T.includes(["slot","styles"],l.type))return;const u=s;a.properties[u]=ga(l)}),a;case"list":const{itemProperties:r,title:n}=t,o={title:n,type:"array",items:{type:"object",properties:{}}};return Object.keys(r).forEach(s=>{const l=r[s];if(T.includes(["slot","styles"],l.type))return;const u=s;o.items.properties[u]=ga(l),T.set(o.items,"title",T.get(l,"itemTitle",`${n} item`))}),o;default:return{}}},fL=t=>{if(!t)return{};const e={};return Object.keys(t).forEach(c=>{e[c]=Lu1(t[c])}),e},xu1=t=>{if(T.isEmpty(t.default))return[];const{itemProperties:e}=t;return T.map(t.default,c=>{const a={...c};return T.forIn(c,(r,n)=>{T.has(e,n)&&T.get(e[n],"i18n",!1)&&(a[n]=x4.I18N_KEY)}),a})},Lu1=t=>{switch(t.type){case"styles":return t.default;case"slot":return`${x4.SLOT_KEY}${U4.generateUUID()}`;case"singular":const{schema:e}=t;return T.get(e,"default","");case"model":return fL(t.properties);case"list":return xu1(t);default:return""}};const Su1=(t,e)=>{const c={};return T.set(c,t,e),c};var _r={exports:{}},Hv1=_r.exports;(function(t){(function(){"use strict";function e(a,r,n){return a.splice(r,!n||1+n-r+(!(n<0^r>=0)&&(n<0||-1)*a.length)),a.length}let c=function(){let a=[],r=-1,n=0,o=!1,s;function l(u,i){return!u||typeof u[i]!="function"?this:(o=!0,u[i](),o=!1,this)}return{add:function(u){return o?this:(a.splice(r+1,a.length-r),a.push(u),n&&a.length>n&&e(a,0,-(n+1)),r=a.length-1,s&&s(),this)},setCallback:function(u){s=u},undo:function(){let u=a[r];if(!u)return this;const i=u.groupId;for(;u.groupId===i&&(l(u,"undo"),r-=1,u=a[r],!(!u||!u.groupId)););return s&&s(),this},redo:function(){let u=a[r+1];if(!u)return this;const i=u.groupId;for(;u.groupId===i&&(l(u,"redo"),r+=1,u=a[r+1],!(!u||!u.groupId)););return s&&s(),this},clear:function(){let u=a.length;a=[],r=-1,s&&u>0&&s()},hasUndo:function(){return r!==-1},hasRedo:function(){return r<a.length-1},getCommands:function(u){return u?a.filter(i=>i.groupId===u):a},getIndex:function(){return r},setLimit:function(u){n=u}}};t.exports?t.exports=c:window.UndoManager=c})()})(_r);var Au1=_r.exports;const Fu1=V4.getDefaultExportFromCjs(Au1),Bu1=l1.atom(Bc.BRANDING_OPTIONS_DEFAULTS),Eu1=l1.atom(null),ve=()=>{const[t,e]=l1.useAtom(Bu1);return[T.isObject(t)?{...Bc.BRANDING_OPTIONS_DEFAULTS,...t}:Bc.BRANDING_OPTIONS_DEFAULTS,e]},Ou1=()=>l1.useAtom(Eu1),Pu1=l1.atom(null),gL=()=>({currentPage:l1.useAtomValue(Pu1)});function pL(t){return sL(t)}const $r=(t,e)=>T.flatten(t.map(c=>{if(c=e?{...c,_parent:e}:{...c},c.children){const a=[...c.children];return delete c.children,T.flatten([c,...$r(a,c._id)])}return c}));function tn(t,e=!1){for(let c=0;c<t.length;c++){const a=t[c];a.global&&!e?t[c]={type:"GlobalBlock",blockId:a.blockId,_parent:T.get(a,"_parent",null),_id:a._id}:a.children&&a.children.length&&tn(a.children)}}function mL(t){let e=[],c=T.filter(t,{type:"GlobalBlock"});return c.length>0&&(c=T.map(c,zL),T.each(c,a=>{e=[...e,...ku1(a)]})),e}function ku1(t){let e=[];const c=T.get(T.first(t),"_parent",null);T.set(T.first(t),"_parent",null);const a=[flatToNestedInstance.convert(bL(t))];tn(a,!0);let r=$r(a,t[0]._id);return r=T.set(r,"0._parent",c),e=[...e,r,...mL(r)],e}function zL(t){const e=T.find(pa,{_id:t._id});if(!e)return[];const c=[e],a=T.filter(pa,{_parent:t._id});return a.length?T.flatten([...c,...T.flatten(T.map(a,zL))]):T.flatten(c)}const bL=t=>JSON.parse(JSON.stringify(t));let pa=[];function Ru1(t){pa=t;const e=pL(bL(t));tn(e);const c=$r(e,null),a=mL(c),r={};return T.each(a,n=>T.set(r,T.first(n).blockId,n)),[c,r]}const ML=()=>{const[t]=ve(),{currentPage:e}=gL(),[c]=Q4();return h.useCallback(()=>{const a=T.map(c,n=>T.omit(n,["expanded","order","title","siblings","tempClasses"])),[r=[]]=Ru1(a);return{currentPage:e,blocks:r}},[t,e,c])},M2=(t,e=void 0)=>{const c=l1.useAtomValue(Gr);return T.get(c,t,e)},en=l1.atom([]);en.debugLabel="dataProvidersAtom";const cn=()=>l1.useAtom(en),I0=l1.atom("SAVED");I0.debugLabel="builderSaveStateAtom";const wL=()=>{const[t,e]=l1.useAtom(I0),c=M2("onSavePage",async u=>{}),a=M2("onSave",async u=>{}),r=M2("onSaveStateChange",T.noop),n=ML(),[o]=cn(),[s]=ve();return{savePage:ig.useThrottledCallback(async()=>{e("SAVING"),r("SAVING");const u=n();return await c({blocks:u.blocks,providers:o}),await a({blocks:u.blocks,providers:o,brandingOptions:s,themeConfiguration:s}),setTimeout(()=>{e("SAVED"),r("SAVED")},100),!0},[n,e,s,a,r],3e3),saveState:t,setSaveState:e}},q4=new Fu1;q4.setLimit(50);const fe=()=>{const[,t]=l1.useAtom(I0),e=M2("onSaveStateChange",T.noop);return h.useEffect(()=>(q4.setCallback(()=>{t("UNSAVED"),e("UNSAVED")}),()=>{q4.setCallback(T.noop)}),[]),{add:q4.add,undo:q4.undo,redo:q4.redo,hasRedo:q4.hasRedo,hasUndo:q4.hasUndo,clear:q4.clear}},an=(t,e)=>{const c=[],a=T.filter(t,r=>T.includes(e,r._id)||T.includes(e,r._parent)?(c.push(r._id),!1):!0);return T.isEmpty(c)?a:an(a,c)},CL=()=>{const[t]=Q4(),[e,c]=g3(),{setNewBlocks:a}=A4();return h.useCallback(r=>{var o;const n=((o=T.find(t,{_id:r[0]}))==null?void 0:o._parent)||null;a(an(t,r)),setTimeout(()=>c(n?[n]:[]),200)},[t,c,e])};function Iu1(t,e,c,a){let r=t.filter(s=>!s._parent);c&&(r=t.filter(s=>s._parent===c));const n=a!==void 0?a:r.length;let o=t.length;for(let s=0,l=0;s<t.length;s++)if(t[s]._parent===c){if(l===n){o=s;break}l++}return!c&&a!==void 0&&a>=r.length&&(o=t.length),[...t.slice(0,o),...e,...t.slice(o)]}function Nu1(t){let e=[];return t.walk(c=>(delete c.model.children,e.push(c.model),!0)),e}function _f(t,e){return t.first(c=>c.model._id===e)||null}function ju1(t,e,c,a){const r=_f(t,e),n=_f(t,c);if(r&&n){r.drop(),n.children||(n.model.children=[]);try{n.addChildAtIndex(r,a)}catch(o){return console.error("Error adding child to parent:",o),!1}return!0}return!1}function Tu1(t,e,c,a){if(!e)return t;c=c||"root";const n=new kA().parse({_id:"root",children:pL(t)});if(ju1(n,e,c,a)){const o=Nu1(n),s=o.find(l=>l._id===e);return s&&(s._parent=c==="root"?null:c),o.shift(),o}return t}const Du1=()=>{const[,t]=Q4();return{setNewBlocks:e=>{t(e)},addBlocks:(e,c,a)=>{t(r=>Iu1(r,e,c,a))},removeBlocks:e=>{t(c=>an(c,e))},moveBlocks:(e,c,a)=>{t(r=>{let n=r;for(let o=0;o<e.length;o++)n=Tu1(n,e[o],c,a);return n})},updateBlocksProps:e=>{t(c=>{const a=e.map(r=>r._id);return c.map(r=>{if(a.includes(r._id)){const n=T.find(e,{_id:r._id});return{...r,...T.omit(n,"_id")}}return r})})}}},Q4=()=>l1.useAtom(S4),A4=()=>{const{add:t}=fe(),[e]=Q4(),{setNewBlocks:c,addBlocks:a,removeBlocks:r,moveBlocks:n,updateBlocksProps:o}=Du1();return{moveBlocks:(p,g,m)=>{const z=T.map(p,w=>{const C=e.find(F=>F._id===w)._parent||null,S=e.filter(F=>C?F._parent===C:!F._parent).map(F=>F._id).indexOf(w);return{_id:w,oldParent:C,oldPosition:S}}),b=z.find(({_id:w})=>w===p[0]);b&&b.oldParent===g&&b.oldPosition===m||(n(p,g,m),t({undo:()=>T.each(z,({_id:w,oldParent:V,oldPosition:C})=>{n([w],V,C)}),redo:()=>n(p,g,m)}))},addBlocks:(p,g,m)=>{a(p,g,m),t({undo:()=>r(T.map(p,"_id")),redo:()=>a(p,g,m)})},removeBlocks:p=>{var b;const g=(b=T.first(p))==null?void 0:b._parent,z=e.filter(w=>g?w._parent===g:!w._parent).indexOf(T.first(p));r(T.map(p,"_id")),t({undo:()=>a(p,g,z),redo:()=>r(T.map(p,"_id"))})},updateBlocks:(p,g,m)=>{let z=[];if(m)z=T.map(p,b=>({_id:b,...m}));else{const b=T.keys(g);z=T.map(p,w=>{const V=e.find(H=>H._id===w),C={_id:w};return T.each(b,H=>C[H]=V[H]),C})}o(T.map(p,b=>({_id:b,...g}))),t({undo:()=>o(z),redo:()=>o(T.map(p,b=>({_id:b,...g})))})},updateBlocksRuntime:(p,g)=>{o(T.map(p,m=>({_id:m,...g})))},setNewBlocks:p=>{c(p),t({undo:()=>c(e),redo:()=>c(p)})},updateMultipleBlocksProps:p=>{let g=[];g=T.map(p,m=>{const z=T.keys(m),b=e.find(V=>V._id===m._id),w={};return T.each(z,V=>w[V]=b[V]),w}),o(p),t({undo:()=>o(g),redo:()=>o(p)})}}},qu1=()=>{const[t]=Q4(),[,e]=g3(),{addBlocks:c}=A4(),a=h.useCallback((n,o,s)=>{var v;for(let f=0;f<n.length;f++){const{_id:p}=n[f];n[f]._id=U4.generateUUID();const g=T.filter(n,{_parent:p});for(let m=0;m<g.length;m++)g[m]._parent=n[f]._id}const l=T.first(n);let u,i;return o&&(u=T.find(t,{_id:o}),n[0]._parent=o,i=o),!(u?nL(u._type,l._type):!0)&&u&&(n[0]._parent=u._parent,i=u._parent),c(n,i,s),e([(v=T.first(n))==null?void 0:v._id]),T.first(n)},[t,e]);return{addCoreBlock:h.useCallback((n,o,s)=>{if(T.has(n,"blocks")){const m=n.blocks;return a(m,o,s)}const l=U4.generateUUID(),u=fL(n.props),i=[];T.forIn(u,(m,z)=>{if(T.startsWith(m,x4.SLOT_KEY)){const b=m.replace(x4.SLOT_KEY,"");i.push({_id:b,_type:"Slot",_parent:l,_name:n.props[z].name,_styles:n.props[z].styles,_emptyStyles:n.props[z].emptyStyles})}});const d={_type:n.type,_id:l,...u};let v,f;o&&(v=T.find(t,{_id:o}),d._parent=o,f=o),!!0&&v&&(d._parent=v._parent,f=v._parent);const g=[d,...i];return c(g,f,s),e([d._id]),d},[a,t,e]),addPredefinedBlock:a}},$f={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},tg=["xs","sm","md","lg","xl","2xl"];function Zu1(t,e){if(e===null)return"baseClasses";const c=e.mq;if(c==="xs"||e.dark||e.mod!=="")return"classes";let a="baseClasses",r=tg.indexOf(c);for(;r>0;){const n=tg[r-1];if(T.find(t,{mq:n,property:e.property})){a="classes";break}r--}return a}const eg=[];function Wu1(t="",e="",c=[]){t=t.trim().replace(/ +/g,"");let a=T.filter(T.map(t.split(" "),s1.constructClassObject),u=>!T.isNull(u)),r=T.filter(T.map(e.split(" "),s1.constructClassObject),u=>!T.isNull(u));r=T.filter(r,u=>!T.includes(eg,u.property));const n=[],o=[];T.each(c,u=>{const i=s1.constructClassObject(u),d=T.find(a,T.pick(i,["dark","mq","mod","property"]));if(d&&(a=T.filter(a,v=>v.fullCls!==(d==null?void 0:d.fullCls))),n.push(i),i.mq==="xs"&&!i.dark&&i.mod===""&&(r=T.filter(r,v=>v.property!==i.property)),Zu1(a,i)==="baseClasses"&&!T.includes(eg,i.property)){const v=T.find(r,T.pick(i,["property"]));d&&(r=T.filter(r,f=>f.fullCls!==(v==null?void 0:v.fullCls))),o.push({...i,fullCls:i.cls,mq:"xs"})}});const s=T.map(T.sortBy([...a,...n],u=>$f[u.mq]),"fullCls").join(" ");return`${T.map(T.sortBy([...r,...o],u=>$f[u.mq]),"fullCls").join(" ").trim()},${s.trim()}`.trim().replace(/ +/g,"")}const N0=l1.atom([]);N0.debugLabel="selectedStylingBlocksAtom";const VL=()=>l1.useAtom(N0),Uu1=t=>{const e=t.replace(x4.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},Ku1=l1.atom(null,(t,e,{blockIds:c,newClasses:a})=>{const r=T.filter(t(Jr),o=>c.includes(t(o)._id)),n=T.first(t(N0));return T.map(r,o=>{const s=t(o),l=T.get(s,n.prop,`${x4.STYLES_KEY},`),{baseClasses:u,classes:i}=Uu1(l);return{ids:[s._id],props:{[n.prop]:`${x4.STYLES_KEY}${Wu1(i,u,a)}`}}})}),Gu1=()=>{const t=l1.useSetAtom(Ku1),{updateBlocks:e,updateBlocksRuntime:c}=A4();return h.useCallback((a,r,n=!1)=>{const o=t({blockIds:a,newClasses:r});if(!n){c(a,o[0].props);return}e(a,o[0].props)},[t])},HL=()=>l1.useAtom(vL),yL=g4("canvasWidth",800),xL=l1.atom(t=>{const e=t(yL);return U4.getBreakpointValue(e).toLowerCase()}),Ju1=()=>{const[t,e]=l1.useAtom(yL),c=l1.useAtomValue(xL),[a,r]=HL();return h.useEffect(()=>{a!=="xs"&&r(c)},[c,a,r]),[t,c,e]},Yu1=g4("canvasZoom",100),Xu1=()=>l1.useAtom(Yu1),LL=l1.atom([]),SL=()=>{const[t,e]=l1.useAtom(LL),c=l1.useSetAtom(rn),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},rn=l1.atom([]),Qu1=()=>{const[t,e]=l1.useAtom(rn),c=l1.useSetAtom(LL),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},AL=g4("darkMode",!1),_u1=()=>{const[t,e]=l1.useAtom(AL);return[t,e]},nn=()=>{const[t]=Q4(),[,e]=g3(),{addBlocks:c}=A4();return h.useCallback((a,r=null)=>{const n=[];T.each(a,o=>{const s=t.find(v=>v._id===o);r||(r=s._parent);const i=T.filter(t,v=>T.isString(r)?v._parent===r:!s._parent).indexOf(s)+1,d=gu1(t,o,r);c(d,r,i),n.push(T.get(d,"0._id",""))}),e(n)},[t,e])},$u1=l1.atom([]),td1=()=>{const[t,e]=l1.useAtom($u1),c=h.useCallback(a=>{e(r=>T.includes(r,a)?T.without(r,a):[...r,a])},[e]);return[t,e,c]},ed1=l1.atom(""),FL=()=>l1.useAtom(ed1),cd1=()=>{const t=l1.useAtomValue(S4);return h.useCallback((e,c)=>{const a=T.map(t,r=>(T.includes(e,T.get(r,"_id"))&&T.set(r,"_parent",c),r));console.log("newBlocks",a)},[t])},ad1=()=>{console.warn("usePasteBlocks is not implemented");const t=l1.useAtomValue(rn),[e,c]=SL(),a=nn(),r=cd1();return{canPaste:h.useMemo(()=>e.length>0||t.length>0,[t,e]),pasteBlocks:h.useCallback(o=>{T.isEmpty(t)?r(e,o):a(t,o),c(()=>[])},[e,t,a,r,c])}},rd1=l1.atom(!1),BL=()=>{const[t,e]=l1.useAtom(rd1);return[t,e]},nd1=l1.atom(null,(t,e,{blockIds:c,fullClasses:a})=>{const r=T.first(t(N0)),n=T.filter(t(Jr),o=>c.includes(t(o)._id));return T.map(n,o=>{const s=t(o),l=a;let{classes:u,baseClasses:i}=hu1(T.get(s,r.prop,"styles:,"));return T.each(l,d=>{const v=d.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),f=new RegExp(`(^| )${v}($| )`,"g");u=u.replace(f," ").replace(/ +/g," ").trim();const p=T.first(d.split(":"));T.includes(["2xl","xl","lg","md","sm"],p)&&l.push(d.split(":").pop().trim())}),T.each(l,d=>{const v=new RegExp(`(^| )${d.replace("[","\\[").replace("]","\\]")}($| )`,"g");i=i.replace(v," ").replace(/ +/g," ").trim()}),{ids:[s._id],props:{[r.prop]:`${x4.STYLES_KEY}${i},${u}`}}})}),od1=()=>{const{updateBlocks:t}=A4(),e=l1.useSetAtom(nd1);return h.useCallback((c,a)=>{const r=e({blockIds:c,fullClasses:a});t(c,r[0].props)},[e])},EL=l1.atom(t=>{const e=T.first(t(N0)),c=t(he);if(!e||e.blockId!==T.get(c,"_id",null))return[];const r=T.get(c,e.prop,`${x4.STYLES_KEY},`).replace(x4.STYLES_KEY,"").split(",").join(" ");return T.filter(T.map(r.trim().split(" "),s1.constructClassObject),n=>!T.isNull(n))}),sd1=()=>l1.useAtomValue(EL),cg={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},ld1=l1.atom(t=>{const e=t(xL),c=t(Qr),a=t(AL),r=id1(e);let n=T.filter(t(EL),{mod:c});return T.startsWith(c,"_")||(n=T.filter(n,o=>r.includes(o.mq))),n=n.sort((o,s)=>cg[o.mq]-cg[s.mq]),a||(n=T.filter(n,{dark:!1})),n}),id1=t=>{let e=[];switch(t){case"xs":e=["xs"];break;case"sm":e=["xs","sm"];break;case"md":e=["xs","sm","md"];break;case"lg":e=["xs","sm","md","lg"];break;case"xl":e=["xs","sm","md","lg","xl"];break;case"2xl":e=["xs","sm","md","lg","xl","2xl"];break;default:e=["xs"];break}return e},ud1=()=>l1.useAtomValue(ld1),dd1=()=>l1.useAtom(Qr),hd1=()=>{const{updateBlocks:t}=A4();return h.useCallback((e,c,a)=>{t(e,c,a)},[t])},vd1=()=>{const{updateMultipleBlocksProps:t}=A4();return h.useCallback(e=>{t(e)},[t])},fd1=()=>{const{updateBlocksRuntime:t}=A4();return h.useCallback(async(e,c,a=30)=>{const r=T.keys(T.omit(c,["_id"]));for(const n of r){const o=c[n];if(T.isString(o)){const s=T.chunk(o.split(""),12);let l="";t([e],{[n]:""});for(let u=0;u<s.length;u++)l+=s[u].join(""),t([e],{[n]:l}),await new Promise(i=>setTimeout(i,a))}}},[t])},gd1=()=>{const{updateMultipleBlocksProps:t}=A4(),e=fd1();return h.useCallback(async c=>{for(const a of c)await e(a._id,a);t(c)},[t])},pd1=()=>{const{updateBlocksRuntime:t}=A4();return h.useCallback((e,c)=>{t(e,c)},[t])},OL={name:"",props:{},modalProps:{},backdropClose:!0},md1=l1.atom(OL),zd1=()=>{const[t,e]=l1.useAtom(md1),c=h.useCallback((r,n={},o={})=>{e({name:r,props:n,modalProps:o})},[e]),a=h.useCallback((...r)=>{T.get(t,"props.onClose",()=>{})(...r),e(OL)},[e,t]);return{activeModal:t,openModal:c,closeModal:a}},bd1=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),l1.useAtomValue(S4)),PL=l1.atom(!1);PL.debugLabel="readOnlyModeAtom";const kL=l1.atom("online");kL.debugLabel="networkModeAtom";const Md1=l1.atom(!1);Md1.debugLabel="codeEditorOpenAtom";const RL=l1.atom(!1);RL.debugLabel="editLayerNameAtom";const wd1=l1.atom("");wd1.debugLabel="activeLanguageAtom";const Cd1=l1.atom("");Cd1.debugLabel="primaryLanguageAtom";const IL=l1.atom(null);IL.debugLabel="canvasIframeAtom";const NL=l1.atom("outline");NL.debugLabel="activePanelAtom";const jL=l1.atom("");jL.debugLabel="showPredefinedBlockCategoryAtom";const TL=l1.atom({undoCount:0,redoCount:0});TL.debugLabel="historyStatesAtom";const DL=l1.atom("");DL.debugLabel="inlineEditingActiveAtom";const qL=l1.atom(!1);qL.debugLabel="draggingFlagAtom";const ZL=l1.atom("");ZL.debugLabel="draggedBlockIdAtom";const WL=l1.atom(null);WL.debugLabel="treeRefAtom";const UL=l1.atom({});UL.debugLabel="canvasSettingsAtom";const ge=l1.atom(!1);ge.debugLabel="askAiActiveBlockAtom";const Vd1=()=>l1.useAtomValue(PL),Hd1=l1.atom(""),yd1=l1.atom(null),xd1=()=>l1.useAtom(Hd1),Ld1=()=>l1.useAtom(yd1),Sd1=g4("selectedBreakpoints",["XS","MD","XL"]),Ad1=()=>{const[t,e]=l1.useAtom(Sd1);return[t,e]},KL=()=>{const t=l1.useSetAtom(TL),{clear:e}=fe(),[,c]=g3(),[,a]=FL(),[,r]=VL(),[,n]=_2(ge);return()=>{c([]),r([]),a(""),e(),n(!1),t({undoCount:0,redoCount:0})}},Fd1=()=>({data:M2("uiLibraries",[]),isLoading:!1}),Bd1=()=>{const[t,e]=h.useState(null),c=h.useCallback(async a=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(a),e(a),!0}catch(r){return console.warn("Copy failed",r),e(null),!1}},[]);return[t,c]},GL=N3.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"}}),JL=x.forwardRef(({className:t,variant:e,size:c,...a},r)=>L.jsxRuntimeExports.jsx(dg.Root,{ref:r,className:s1.cn(GL({variant:e,size:c,className:t})),...a}));JL.displayName=dg.Root.displayName;const YL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Ec.Root,{className:s1.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",t),...e,ref:c,children:L.jsxRuntimeExports.jsx(Ec.Thumb,{className:s1.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")})}));YL.displayName=Ec.Root.displayName;const pe=N3.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"}}),i3=x.forwardRef(({className:t,variant:e,size:c,asChild:a=!1,...r},n)=>{const o=a?NA.Slot:"button";return L.jsxRuntimeExports.jsx(o,{className:s1.cn(pe({variant:e,size:c,className:t})),ref:n,...r})});i3.displayName="Button";const XL=B3.Root,on=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(B3.Item,{ref:c,className:s1.cn("border-b",t),...e}));on.displayName="AccordionItem";const sn=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(B3.Header,{className:"flex",children:L.jsxRuntimeExports.jsxs(B3.Trigger,{ref:a,className:s1.cn("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...c,children:[e,c.hideArrow?null:L.jsxRuntimeExports.jsx(s2.ChevronDownIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));sn.displayName=B3.Trigger.displayName;const ln=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(B3.Content,{ref:a,className:s1.cn("text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",t),...c,children:L.jsxRuntimeExports.jsx("div",{className:"pb-4 pt-0",children:e})}));ln.displayName=B3.Content.displayName;const Ed1=N3.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"}}),QL=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx("div",{ref:a,role:"alert",className:s1.cn(Ed1({variant:e}),t),...c}));QL.displayName="Alert";const _L=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h5",{ref:c,className:s1.cn("mb-1 font-medium leading-none tracking-tight",t),...e}));_L.displayName="AlertTitle";const $L=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("text-sm [&_p]:leading-relaxed",t),...e}));$L.displayName="AlertDescription";const tS=N3.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"}}),Od1=({className:t,variant:e,...c})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn(tS({variant:e}),t),...c}),eS=j2.Root,cS=j2.Trigger,aS=({className:t,...e})=>L.jsxRuntimeExports.jsx(j2.Portal,{className:s1.cn(t),...e});aS.displayName=j2.Portal.displayName;const rS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Overlay,{className:s1.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",t),...e,ref:c}));rS.displayName=j2.Overlay.displayName;const un=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs(aS,{children:[L.jsxRuntimeExports.jsx(rS,{}),L.jsxRuntimeExports.jsx(j2.Content,{ref:c,className:s1.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",t),...e})]}));un.displayName=j2.Content.displayName;const dn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});dn.displayName="AlertDialogHeader";const hn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});hn.displayName="AlertDialogFooter";const vn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Title,{ref:c,className:s1.cn("text-lg font-semibold",t),...e}));vn.displayName=j2.Title.displayName;const fn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));fn.displayName=j2.Description.displayName;const gn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Action,{ref:c,className:s1.cn(pe(),t),...e}));gn.displayName=j2.Action.displayName;const pn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j2.Cancel,{ref:c,className:s1.cn(pe({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));pn.displayName=j2.Cancel.displayName;const mn=J1.Root,nS=J1.Trigger,oS=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});oS.displayName=J1.Portal.displayName;const sS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Overlay,{ref:c,className:s1.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",t),...e}));sS.displayName=J1.Overlay.displayName;const me=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(oS,{children:[L.jsxRuntimeExports.jsx(sS,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:a,className:s1.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",t),...c,children:[e,L.jsxRuntimeExports.jsxs(J1.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:[L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));me.displayName=J1.Content.displayName;const lS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});lS.displayName="DialogHeader";const iS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});iS.displayName="DialogFooter";const uS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold leading-none tracking-tight",t),...e}));uS.displayName=J1.Title.displayName;const dS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));dS.displayName=J1.Description.displayName;const hS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("rounded-xl border bg-card text-card-foreground shadow",t),...e}));hS.displayName="Card";const vS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("flex flex-col space-y-1.5 p-6",t),...e}));vS.displayName="CardHeader";const fS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h3",{ref:c,className:s1.cn("font-semibold leading-none tracking-tight",t),...e}));fS.displayName="CardTitle";const gS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("p",{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));gS.displayName="CardDescription";const pS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("p-6 pt-0",t),...e}));pS.displayName="CardContent";const mS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn(" flex items-center p-6 pt-0",t),...e}));mS.displayName="CardFooter";const zS=x.forwardRef(({className:t,type:e,...c},a)=>L.jsxRuntimeExports.jsx("input",{type:e,className:s1.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",t),ref:a,...c}));zS.displayName="Input";const Pd1=N3.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),bS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(hg.Root,{ref:c,className:s1.cn(Pd1(),t),...e}));bS.displayName=hg.Root.displayName;const ze=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("textarea",{className:s1.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",t),ref:c,...e}));ze.displayName="Textarea";const MS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(K2.Root,{ref:a,className:s1.cn("relative overflow-hidden",t),...c,children:[L.jsxRuntimeExports.jsx(K2.Viewport,{className:"h-full w-full rounded-[inherit]",children:e}),L.jsxRuntimeExports.jsx(zn,{}),L.jsxRuntimeExports.jsx(K2.Corner,{})]}));MS.displayName=K2.Root.displayName;const zn=x.forwardRef(({className:t,orientation:e="vertical",...c},a)=>L.jsxRuntimeExports.jsx(K2.ScrollAreaScrollbar,{ref:a,orientation:e,className:s1.cn("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",t),...c,children:L.jsxRuntimeExports.jsx(K2.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));zn.displayName=K2.ScrollAreaScrollbar.displayName;const wS=j3.Root,bn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.List,{ref:c,className:s1.cn("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));bn.displayName=j3.List.displayName;const yt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.Trigger,{ref:c,className:s1.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",t),...e}));yt.displayName=j3.Trigger.displayName;const xt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(j3.Content,{ref:c,className:s1.cn("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));xt.displayName=j3.Content.displayName;const kd1=y6.Portal,CS=y6.Provider,Rd1=y6.Root,Id1=y6.Trigger,VS=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(y6.Content,{ref:a,sideOffset:e,className:s1.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",t),...c}));VS.displayName=y6.Content.displayName;const Nd1=u0.Root,jd1=u0.Trigger,HS=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(u0.Portal,{children:L.jsxRuntimeExports.jsx(u0.Content,{ref:r,align:e,sideOffset:c,className:s1.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",t),...a})}));HS.displayName=u0.Content.displayName;const Td1=K1.Menu,Dd1=K1.Group,qd1=K1.Portal,Zd1=K1.Sub,Wd1=K1.RadioGroup,yS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Root,{ref:c,className:s1.cn("flex h-9 items-center space-x-1 rounded-md border bg-background p-1 shadow-sm",t),...e}));yS.displayName=K1.Root.displayName;const xS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Trigger,{ref:c,className:s1.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",t),...e}));xS.displayName=K1.Trigger.displayName;const LS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(K1.SubTrigger,{ref:r,className:s1.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",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));LS.displayName=K1.SubTrigger.displayName;const SS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.SubContent,{ref:c,className:s1.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",t),...e}));SS.displayName=K1.SubContent.displayName;const AS=x.forwardRef(({className:t,align:e="start",alignOffset:c=-4,sideOffset:a=8,...r},n)=>L.jsxRuntimeExports.jsx(K1.Portal,{children:L.jsxRuntimeExports.jsx(K1.Content,{ref:n,align:e,alignOffset:c,sideOffset:a,className:s1.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",t),...r})}));AS.displayName=K1.Content.displayName;const FS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(K1.Item,{ref:a,className:s1.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",e&&"pl-8",t),...c}));FS.displayName=K1.Item.displayName;const BS=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(K1.CheckboxItem,{ref:r,className:s1.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",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(K1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));BS.displayName=K1.CheckboxItem.displayName;const ES=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(K1.RadioItem,{ref:a,className:s1.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",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(K1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));ES.displayName=K1.RadioItem.displayName;const OS=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(K1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));OS.displayName=K1.Label.displayName;const PS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(K1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));PS.displayName=K1.Separator.displayName;const kS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});kS.displayname="MenubarShortcut";const Ud1=St.Root,Kd1=St.Trigger,RS=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(St.Content,{ref:r,align:e,sideOffset:c,className:s1.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",t),...a}));RS.displayName=St.Content.displayName;const Gd1=x2.Root,Jd1=x2.Group,Yd1=x2.Value,IS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(x2.Trigger,{ref:a,className:s1.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",t),...c,children:[e,L.jsxRuntimeExports.jsx(x2.Icon,{asChild:!0,children:L.jsxRuntimeExports.jsx(s2.CaretSortIcon,{className:"h-4 w-4 opacity-50"})})]}));IS.displayName=x2.Trigger.displayName;const NS=x.forwardRef(({className:t,children:e,position:c="popper",...a},r)=>L.jsxRuntimeExports.jsx(x2.Portal,{children:L.jsxRuntimeExports.jsx(x2.Content,{ref:r,className:s1.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",c==="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",t),position:c,...a,children:L.jsxRuntimeExports.jsx(x2.Viewport,{className:s1.cn("p-1",c==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e})})}));NS.displayName=x2.Content.displayName;const jS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(x2.Label,{ref:c,className:s1.cn("px-2 py-1.5 text-sm font-semibold",t),...e}));jS.displayName=x2.Label.displayName;const TS=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(x2.Item,{ref:a,className:s1.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",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(x2.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),L.jsxRuntimeExports.jsx(x2.ItemText,{children:e})]}));TS.displayName=x2.Item.displayName;const DS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(x2.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));DS.displayName=x2.Separator.displayName;const Xd1=J1.Root,Qd1=J1.Trigger,_d1=J1.Close,qS=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});qS.displayName=J1.Portal.displayName;const ZS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Overlay,{className:s1.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",t),...e,ref:c}));ZS.displayName=J1.Overlay.displayName;const $d1=N3.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"}}),WS=x.forwardRef(({side:t="right",className:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(qS,{children:[L.jsxRuntimeExports.jsx(ZS,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:r,className:s1.cn($d1({side:t}),e),...a,children:[c,L.jsxRuntimeExports.jsxs(J1.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:[L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));WS.displayName=J1.Content.displayName;const US=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});US.displayName="SheetHeader";const KS=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});KS.displayName="SheetFooter";const GS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold text-foreground",t),...e}));GS.displayName=J1.Title.displayName;const JS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));JS.displayName=J1.Description.displayName;const YS=_1.Root,XS=_1.Trigger,th1=_1.Group,eh1=_1.Portal,ch1=_1.Sub,ah1=_1.RadioGroup,QS=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(_1.SubTrigger,{ref:r,className:s1.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",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));QS.displayName=_1.SubTrigger.displayName;const _S=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(_1.SubContent,{ref:c,className:s1.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",t),...e}));_S.displayName=_1.SubContent.displayName;const Mn=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(_1.Portal,{children:L.jsxRuntimeExports.jsx(_1.Content,{ref:a,sideOffset:e,className:s1.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",t),...c})}));Mn.displayName=_1.Content.displayName;const f6=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(_1.Item,{ref:a,className:s1.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",e&&"pl-8",t),...c}));f6.displayName=_1.Item.displayName;const $S=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(_1.CheckboxItem,{ref:r,className:s1.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",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(_1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));$S.displayName=_1.CheckboxItem.displayName;const tA=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(_1.RadioItem,{ref:a,className:s1.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",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx(_1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));tA.displayName=_1.RadioItem.displayName;const wn=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(_1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));wn.displayName=_1.Label.displayName;const Cn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(_1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));Cn.displayName=_1.Separator.displayName;const eA=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest opacity-60",t),...e});eA.displayName="DropdownMenuShortcut";const cA=x.forwardRef(({className:t,orientation:e="horizontal",decorative:c=!0,...a},r)=>L.jsxRuntimeExports.jsx(vg.Root,{ref:r,decorative:c,orientation:e,className:s1.cn("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...a}));cA.displayName=vg.Root.displayName;const rh1=1,nh1=1e6;let Ac=0;function oh1(){return Ac=(Ac+1)%Number.MAX_VALUE,Ac.toString()}const Fc=new Map,ag=t=>{if(Fc.has(t))return;const e=setTimeout(()=>{Fc.delete(t),i0({type:"REMOVE_TOAST",toastId:t})},nh1);Fc.set(t,e)},aA=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,rh1)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(c=>c.id===e.toast.id?{...c,...e.toast}:c)};case"DISMISS_TOAST":{const{toastId:c}=e;return c?ag(c):t.toasts.forEach(a=>{ag(a.id)}),{...t,toasts:t.toasts.map(a=>a.id===c||c===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(c=>c.id!==e.toastId)}}},Z8=[];let W8={toasts:[]};function i0(t){W8=aA(W8,t),Z8.forEach(e=>{e(W8)})}function rA({...t}){const e=oh1(),c=r=>i0({type:"UPDATE_TOAST",toast:{...r,id:e}}),a=()=>i0({type:"DISMISS_TOAST",toastId:e});return i0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:r=>{r||a()}}}),{id:e,dismiss:a,update:c}}function Vn(){const[t,e]=x.useState(W8);return x.useEffect(()=>(Z8.push(e),()=>{const c=Z8.indexOf(e);c>-1&&Z8.splice(c,1)}),[t]),{...t,toast:rA,dismiss:c=>i0({type:"DISMISS_TOAST",toastId:c})}}const sh1=l4.Provider,nA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Viewport,{ref:c,className:s1.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]",t),...e}));nA.displayName=l4.Viewport.displayName;const lh1=N3.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"}}),oA=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx(l4.Root,{ref:a,className:s1.cn(lh1({variant:e}),t),...c}));oA.displayName=l4.Root.displayName;const ih1=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Action,{ref:c,className:s1.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",t),...e}));ih1.displayName=l4.Action.displayName;const sA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Close,{ref:c,className:s1.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",t),"toast-close":"",...e,children:L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"})}));sA.displayName=l4.Close.displayName;const lA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Title,{ref:c,className:s1.cn("text-sm font-semibold [&+div]:text-xs",t),...e}));lA.displayName=l4.Title.displayName;const iA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(l4.Description,{ref:c,className:s1.cn("text-sm opacity-90",t),...e}));iA.displayName=l4.Description.displayName;function uA(){const{toasts:t}=Vn();return L.jsxRuntimeExports.jsxs(sh1,{children:[t.map(({id:e,title:c,description:a,action:r,...n})=>L.jsxRuntimeExports.jsxs(oA,{...n,children:[L.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[c&&L.jsxRuntimeExports.jsx(lA,{children:c}),a&&L.jsxRuntimeExports.jsx(iA,{children:a})]}),r,L.jsxRuntimeExports.jsx(sA,{})]},e)),L.jsxRuntimeExports.jsx(nA,{})]})}const Hn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("animate-pulse rounded-md bg-primary/10",t),...e}),yn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command,{ref:c,className:s1.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));yn.displayName=X2.Command.displayName;const uh1=({children:t,...e})=>L.jsxRuntimeExports.jsx(mn,{...e,children:L.jsxRuntimeExports.jsx(me,{className:"overflow-hidden p-0",children:L.jsxRuntimeExports.jsx(yn,{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:t})})}),dA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[L.jsxRuntimeExports.jsx(s2.MagnifyingGlassIcon,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),L.jsxRuntimeExports.jsx(X2.Command.Input,{ref:c,className:s1.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",t),...e})]}));dA.displayName=X2.Command.Input.displayName;const hA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.List,{ref:c,className:s1.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));hA.displayName=X2.Command.List.displayName;const vA=x.forwardRef((t,e)=>L.jsxRuntimeExports.jsx(X2.Command.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));vA.displayName=X2.Command.Empty.displayName;const fA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Group,{ref:c,className:s1.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",t),...e}));fA.displayName=X2.Command.Group.displayName;const gA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Separator,{ref:c,className:s1.cn("-mx-1 h-px bg-border",t),...e}));gA.displayName=X2.Command.Separator.displayName;const pA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(X2.Command.Item,{ref:c,className:s1.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",t),...e}));pA.displayName=X2.Command.Item.displayName;const mA=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});mA.displayName="CommandShortcut";const dh1=$1.Root,hh1=$1.Trigger,vh1=$1.Group,fh1=$1.Portal,gh1=$1.Sub,ph1=$1.RadioGroup,zA=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs($1.SubTrigger,{ref:r,className:s1.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",e&&"pl-8",t),...a,children:[c,L.jsxRuntimeExports.jsx(s2.ChevronRightIcon,{className:"ml-auto h-4 w-4"})]}));zA.displayName=$1.SubTrigger.displayName;const bA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.SubContent,{ref:c,className:s1.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",t),...e}));bA.displayName=$1.SubContent.displayName;const MA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.Portal,{children:L.jsxRuntimeExports.jsx($1.Content,{ref:c,className:s1.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",t),...e})}));MA.displayName=$1.Content.displayName;const wA=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx($1.Item,{ref:a,className:s1.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",e&&"pl-8",t),...c}));wA.displayName=$1.Item.displayName;const CA=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs($1.CheckboxItem,{ref:r,className:s1.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",t),checked:c,...a,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx($1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));CA.displayName=$1.CheckboxItem.displayName;const VA=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs($1.RadioItem,{ref:a,className:s1.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",t),...c,children:[L.jsxRuntimeExports.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:L.jsxRuntimeExports.jsx($1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));VA.displayName=$1.RadioItem.displayName;const HA=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx($1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...c}));HA.displayName=$1.Label.displayName;const yA=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx($1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-border",t),...e}));yA.displayName=$1.Separator.displayName;const xA=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});xA.displayName="ContextMenuShortcut";const mh1=t=>{try{const e=document.getElementById("icon-picker-field"),c=document.createElement("div");ma.render(L.jsxRuntimeExports.jsx(ug.IconPickerItem,{value:t}),c),e.appendChild(c),c.hidden=!0;let a=c.innerHTML;setTimeout(()=>e.removeChild(c),100);const n=new DOMParser().parseFromString(a,"image/svg+xml"),o=n.querySelector("svg");return o&&(o.removeAttribute("width"),o.removeAttribute("height")),new XMLSerializer().serializeToString(n)}catch(e){return console.error(e),""}},zh1=({value:t,onChange:e})=>{const c=a=>{e("<svg />");const r=mh1(a);e(r)};return L.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[L.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[L.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:t?t.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"}),L.jsxRuntimeExports.jsx(ug,{value:t?"BiSolidGrid":null,onChange:c,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"}})]}),L.jsxRuntimeExports.jsx("textarea",{value:t,onChange:a=>e(a.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"})]})},bh1=h.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-Yu0msAD8.cjs"))),Mh1=h.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-jS51ZcPG.cjs"))),LA=({isModalView:t=!1,onSelect:e=()=>{}})=>{const c=M2("uploadMediaCallback"),a=M2("unsplashAccessKey"),r=c===void 0,n=a===void 0,[o,s]=h.useState(n?"upload":r?"unsplash":"upload");return L.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[L.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:L.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:t&&r?"Unsplash images":t?"Select or upload images":"Images"})}),L.jsxRuntimeExports.jsxs(wS,{value:o,onValueChange:l=>s(l),className:"flex h-full w-full flex-col py-2",children:[!(r||n)&&L.jsxRuntimeExports.jsxs(bn,{className:"w-full",children:[L.jsxRuntimeExports.jsx(yt,{value:"upload",className:"w-full",children:"Upload"}),L.jsxRuntimeExports.jsx(yt,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),o==="unsplash"?L.jsxRuntimeExports.jsx(xt,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:L.jsxRuntimeExports.jsx(bh1,{isModalView:t,onSelect:e})})}):L.jsxRuntimeExports.jsx(xt,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:L.jsxRuntimeExports.jsx(Mh1,{isModalView:t,onSelect:e})})})]})]})},wh1=Object.freeze(Object.defineProperty({__proto__:null,default:LA},Symbol.toStringTag,{value:"Module"})),rg=({children:t,onSelect:e})=>{const[c,a]=h.useState(!1),r=(...n)=>{e.call(void 0,...n),a(!1)};return L.jsxRuntimeExports.jsxs(mn,{open:c,onOpenChange:n=>a(n),children:[L.jsxRuntimeExports.jsx(nS,{asChild:!0,children:t}),L.jsxRuntimeExports.jsx(me,{className:"flex h-3/4 max-w-5xl",children:L.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:L.jsxRuntimeExports.jsx(LA,{isModalView:!0,onSelect:r})})})]})},Ch1=({value:t,onChange:e,id:c,onBlur:a})=>{const r=M2("uploadMediaCallback"),n=M2("unsplashAccessKey"),o=r===void 0,s=n===void 0;return L.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[t?L.jsxRuntimeExports.jsx("img",{src:t,className:"h-20 w-20 overflow-hidden rounded-md border object-cover",alt:""}):L.jsxRuntimeExports.jsx(rg,{onSelect:e,children:L.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"})}),L.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[!(o&&s)&&L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(rg,{onSelect:e,children:L.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:t||!T.isEmpty(t)?"Replace Image":"Choose Image"})}),L.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"})]}),L.jsxRuntimeExports.jsx("input",{type:"url",className:"text-xs",placeholder:"Enter image URL",value:t,onBlur:({target:{value:l}})=>a(c,l),onChange:l=>e(l.target.value)})]})]})},Vh1=({id:t,placeholder:e,value:c,onChange:a,onBlur:r})=>{const n={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},o=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:L.jsxRuntimeExports.jsx($A,{id:t,value:c,onBlur:s=>r(t,s),onChange:s=>a(s),modules:n,formats:o,placeholder:e,className:"mt-1 rounded-md"})},Hh1=({schema:t,formData:e,onChange:c})=>{const[a,r]=h.useState([]),n=M2("getPages",()=>[]),{type:o="page",href:s="",target:l="self"}=e;return h.useEffect(()=>{(async()=>{const u=await n();r(u||[])})()},[]),L.jsxRuntimeExports.jsxs("div",{children:[L.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(t==null?void 0:t.title)??"Link"}),L.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[L.jsxRuntimeExports.jsx("select",{name:"type",value:o,onChange:u=>c({...e,type:u.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(u=>L.jsxRuntimeExports.jsx("option",{value:u.const,children:u.title},u.const))}),o==="page"?L.jsxRuntimeExports.jsxs("select",{name:"href",value:s,onChange:u=>c({...e,href:u.target.value}),children:[L.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),T.map(a,u=>L.jsxRuntimeExports.jsx("option",{value:u.slug,children:u.name},u.uuid))]}):L.jsxRuntimeExports.jsx("input",{name:"href",type:"text",value:s,onChange:u=>c({...e,href:u.target.value}),placeholder:o==="page"||o==="url"?"Enter URL":o==="scroll"?"#ElementID":"Enter detail"}),(o==="page"||o==="url")&&L.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[L.jsxRuntimeExports.jsx("input",{type:"checkbox",defaultChecked:l==="_blank",className:"cursor-pointer rounded-md border border-border",onChange:()=>c({...e,target:l==="_blank"?"_self":"_blank"})}),L.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})},yh1=()=>{const[t,e]=BL(),{t:c}=Lt.useTranslation(),a=M2("previewComponent",null);return t?L.jsxRuntimeExports.jsxs("div",{className:U4.cn("fixed inset-0 z-[999] bg-background",t?"block":"hidden"),children:[L.jsxRuntimeExports.jsxs(i3,{size:"sm",className:"absolute right-0 top-0 m-4 space-x-2",onClick:()=>e(!1),children:[L.jsxRuntimeExports.jsx(s2.EyeClosedIcon,{}),L.jsxRuntimeExports.jsx("span",{children:c("Close Preview")})]}),L.jsxRuntimeExports.jsx("div",{children:a?L.jsxRuntimeExports.jsx(h.Suspense,{fallback:L.jsxRuntimeExports.jsx(Hn,{className:"h-96 w-full"}),children:h.createElement(a)}):null})]}):null},xh1=()=>{const[t,e]=g3(),c=CL(),a=nn(),{undo:r,redo:n}=fe();P6.useHotkeys("esc",()=>e([]),{},[e]),P6.useHotkeys("ctrl+d,command+d",()=>a(t),{preventDefault:!0},[t,a]),P6.useHotkeys("ctrl+z,command+z",()=>r(),{},[r]),P6.useHotkeys("ctrl+y,command+y",()=>n(),{},[n]),P6.useHotkeys("del, backspace",o=>{o.preventDefault(),c(t)},{},[t,c])},Lh1=(t,e)=>{const c=[];let a=T.find(t,{_id:e}),r=T.get(a,"_parent","");for(;T.isString(r)&&!T.isEmpty(r);)c.push(a==null?void 0:a._parent),a=T.find(t,{_id:r}),r=a==null?void 0:a._parent;return T.flatten(c)},Sh1=l1.atom([]),Ah1=()=>{const[t]=g3(),e=l1.useAtomValue(S4),[,c]=l1.useAtom(Sh1);h.useEffect(()=>{let a=[];const r=T.first(t);T.isString(r)&&(a=[r,...Lh1(e,r)]),c(a)},[t,e,c])};const SA=()=>l1.useAtom(aL),Fh1=()=>h.useMemo(()=>I3.getChaiDataProviders(),[]),Bh1=({children:t})=>{const[,e]=SA(),[c]=cn(),a=Fh1();return h.useEffect(()=>(e({}),T.each(c,r=>{const n=T.find(a,{providerKey:r.providerKey});if(n){const o=(n==null?void 0:n.mockFn)||(n==null?void 0:n.dataFn);o&&o(r.args).then(s=>e(l=>({...l,[r.providerKey]:s})))}}),()=>{T.each(c,r=>{e(n=>(delete n[r.providerKey],n))})}),[a,c,e]),L.jsxRuntimeExports.jsx(L.jsxRuntimeExports.Fragment,{children:t})};function Eh1(t,e,c){c.push(T.find(t,{_id:e}));const a=T.filter(t,{_parent:e});for(const r of a)c.push(...AA(r._id,t));return c}const AA=(t,e)=>{let c=[];return c=T.flattenDeep([...c,...Eh1(e,t,c)]),c},Oh1=l1.atom(!1),xn=()=>{const[t,e]=l1.useAtom(Oh1),[c,a]=h.useState(null),r=M2("askAiCallBack",null),n=gd1(),o=vd1(),[s]=Q4();return{askAi:h.useCallback(async(l,u,i,d)=>{if(r){e(!0),a(null);try{const v=l==="content"?T.cloneDeep(AA(u,s)):[T.cloneDeep(s.find(g=>g._id===u))];T.set(v,"0._parent",null);const{blocks:f,error:p}=await r(l,i,v);if(p){a(p);return}l==="styles"?o(f):n(f)}catch(v){a(v)}finally{e(!1),d&&d()}}},[r,e,s,o,n]),loading:t,error:c}};var FA={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ng=h.createContext&&h.createContext(FA),u3=function(){return u3=Object.assign||function(t){for(var e,c=1,a=arguments.length;c<a;c++){e=arguments[c];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},u3.apply(this,arguments)},Ph1=function(t,e){var c={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(c[a]=t[a]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,a=Object.getOwnPropertySymbols(t);r<a.length;r++)e.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(t,a[r])&&(c[a[r]]=t[a[r]]);return c};function BA(t){return t&&t.map(function(e,c){return h.createElement(e.tag,u3({key:c},e.attr),BA(e.child))})}function j0(t){return function(e){return h.createElement(kh1,u3({attr:u3({},t.attr)},e),BA(t.child))}}function kh1(t){var e=function(c){var a=t.attr,r=t.size,n=t.title,o=Ph1(t,["attr","size","title"]),s=r||c.size||"1em",l;return c.className&&(l=c.className),t.className&&(l=(l?l+" ":"")+t.className),h.createElement("svg",u3({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},c.attr,a,o,{className:l,style:u3(u3({color:t.color||c.color},c.style),t.style),height:s,width:s,xmlns:"http://www.w3.org/2000/svg"}),n&&h.createElement("title",null,n),t.children)};return ng!==void 0?h.createElement(ng.Consumer,null,function(c){return e(c)}):e(FA)}function Rh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z"}}]})(t)}function EA(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"}}]})(t)}function Ih1(t){return j0({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"}}]})(t)}function Nh1(t){return j0({tag:"svg",attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V285.7l-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5H64c-35.3 0-64-28.7-64-64V64zm384 64H256V0L384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z"}}]})(t)}const jh1=[{name:"Improve writing",icon:Nh1,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:Rh1,prompt:"Discard current placeholder content and replace with meaningful relevant content."},{name:"Fix grammar",icon:s2.CheckIcon,prompt:"Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors."},{name:"Make longer",icon:s2.ArrowUpIcon,prompt:"Make all text elements longer."},{name:"Make shorter",icon:s2.ArrowDownIcon,prompt:"Make all text elements shorter."},{name:"Add emojis",icon:S3.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:S3.ShuffleIcon,prompt:"Randomize all text elements."}];function Th1({onClick:t}){const{loading:e}=xn();return L.jsxRuntimeExports.jsx("div",{className:e?"pointer-events-none opacity-50":"",children:L.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:jh1.map(({name:c,icon:a,subMenus:r,prompt:n})=>r?L.jsxRuntimeExports.jsxs(YS,{children:[L.jsxRuntimeExports.jsx(XS,{asChild:!0,children:L.jsxRuntimeExports.jsxs("li",{className:"flex cursor-pointer items-center space-x-2 hover:bg-gray-100",children:[L.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{children:c})]},c)}),L.jsxRuntimeExports.jsxs(Mn,{children:[L.jsxRuntimeExports.jsx(wn,{children:"My Account"}),L.jsxRuntimeExports.jsx(Cn,{}),L.jsxRuntimeExports.jsx(f6,{children:"Profile"}),L.jsxRuntimeExports.jsx(f6,{children:"Billing"}),L.jsxRuntimeExports.jsx(f6,{children:"Team"}),L.jsxRuntimeExports.jsx(f6,{children:"Subscription"})]})]}):L.jsxRuntimeExports.jsxs("li",{onClick:()=>t(n),className:"flex cursor-pointer items-center space-x-2 rounded p-1 pl-2 text-sm hover:bg-gray-100",children:[L.jsxRuntimeExports.jsx(a,{className:"h-4 w-4"}),L.jsxRuntimeExports.jsx("span",{children:c})]},c))})})}const Dh1=({blockId:t})=>{const{t:e}=Lt.useTranslation(),{askAi:c,loading:a,error:r}=xn(),[n,o]=h.useState(""),s=h.useRef(null);h.useEffect(()=>{var u;(u=s.current)==null||u.focus()},[]);const l=()=>{r||o("")};return t?L.jsxRuntimeExports.jsxs("div",{className:"mt-4",children:[L.jsxRuntimeExports.jsxs("h2",{className:"mb-2 text-xs font-semibold leading-none tracking-tight text-gray-500",children:[e("Ask AI")," (GPT-4o mini)"]}),L.jsxRuntimeExports.jsx(ze,{ref:s,value:n,onChange:u=>o(u.target.value),placeholder:e("Ask AI to edit content"),className:"w-full border border-gray-400 focus:border-0",rows:3,onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c("content",t,n,l))}}),L.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:L.jsxRuntimeExports.jsx(i3,{disabled:n.trim().length<5||a,onClick:()=>c("content",t,n,l),variant:"default",className:"w-fit",size:"sm",children:a?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(S3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Edit with AI")}),a?L.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[L.jsxRuntimeExports.jsxs(Hn,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[L.jsxRuntimeExports.jsx(EA,{className:"h-4 w-4 animate-spin text-gray-500"}),L.jsxRuntimeExports.jsx("p",{className:"text-xs",children:e("Generating... Please wait")})]}),L.jsxRuntimeExports.jsx(i3,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:e("Stop")})]}):null]}),L.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:r&&L.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:r.message})}),L.jsxRuntimeExports.jsx(Th1,{onClick:u=>c("content",t,u,l)})]}):L.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:L.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[L.jsxRuntimeExports.jsx(S3.SparklesIcon,{className:"mx-auto text-3xl"}),L.jsxRuntimeExports.jsx("h1",{children:e("no_block_selected_for_ask_ai")})]})})},qh1=({onOpen:t})=>{const{t:e}=Lt.useTranslation(),c=M2("aiContext",""),[a,r]=h.useState(c),n=h.useRef(null),o=M2("saveAiContextCallback",T.noop),[s,l]=h.useState(!1),[u,i]=h.useState(null),[d,v]=h.useState(!1),{toast:f}=Vn(),p=h.useRef(null);h.useEffect(()=>{c&&r(c)},[c]);const g=async()=>{try{l(!0),i(null),await o(a),f({title:e("AI Context updated"),description:e("You can now ask AI to edit your content"),variant:"default"}),p.current.click()}catch(m){i(m)}finally{l(!1)}};return L.jsxRuntimeExports.jsx(XL,{onValueChange:m=>{t(m!==""),v(m!=="")},type:"single",collapsible:!0,className:"rounded-md border bg-gray-100 px-2",children:L.jsxRuntimeExports.jsxs(on,{value:"set-context",children:[L.jsxRuntimeExports.jsx(sn,{ref:p,hideArrow:!0,className:"py-1 hover:no-underline",children:L.jsxRuntimeExports.jsxs("div",{className:"flex w-full items-center justify-between",children:[L.jsxRuntimeExports.jsx("span",{className:"font-semibold",children:e("AI Context")}),L.jsxRuntimeExports.jsxs(i3,{variant:"default",size:"sm",children:[L.jsxRuntimeExports.jsx("span",{children:e(d?"Cancel":"Edit")})," ",d?L.jsxRuntimeExports.jsx(s2.Cross2Icon,{className:"h-4 w-4"}):L.jsxRuntimeExports.jsx(S3.EditIcon,{className:"h-4 w-4"})]})]})}),L.jsxRuntimeExports.jsxs(ln,{children:[L.jsxRuntimeExports.jsx(ze,{ref:n,value:a,onChange:m=>r(m.target.value),placeholder:e("Tell about this page. Eg: This page is about ..."),className:"w-full border border-gray-400 bg-background focus:border",rows:10,onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),g())}}),c.trim().length===0?L.jsxRuntimeExports.jsx("p",{className:"mt-2 text-xs text-gray-500",children:e("Eg: This page is about an AI assistant app called Chai Studio. It allows users to create beautiful webpages and edit content with AI.")}):null,L.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex items-center",children:[L.jsxRuntimeExports.jsx(i3,{disabled:a.trim().length<5,onClick:()=>g(),variant:"default",className:"w-fit",size:"sm",children:s?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(S3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Save")}),c.trim().length>0?L.jsxRuntimeExports.jsxs(eS,{children:[L.jsxRuntimeExports.jsx(cS,{asChild:!0,children:L.jsxRuntimeExports.jsx(i3,{disabled:c.trim().length===0,variant:"ghost",className:"w-fit",size:"sm",children:s?L.jsxRuntimeExports.jsxs(L.jsxRuntimeExports.Fragment,{children:[L.jsxRuntimeExports.jsx(S3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Delete")})}),L.jsxRuntimeExports.jsxs(un,{children:[L.jsxRuntimeExports.jsxs(dn,{children:[L.jsxRuntimeExports.jsx(vn,{children:e("Remove context?")}),L.jsxRuntimeExports.jsx(fn,{})]}),L.jsxRuntimeExports.jsxs(hn,{children:[L.jsxRuntimeExports.jsx(pn,{children:e("Cancel")}),L.jsxRuntimeExports.jsx(gn,{onClick:()=>{r(""),g()},children:"Yes, Delete"})]})]})]}):null]}),L.jsxRuntimeExports.jsx("div",{className:"mt-2 max-w-full",children:u&&L.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:u.message})})]})]})})},Zh1=()=>{const[t]=g3(),[e,c]=h.useState(!1);return L.jsxRuntimeExports.jsxs("div",{className:"absolute inset-0 z-50 h-full w-full bg-background p-2",children:[L.jsxRuntimeExports.jsx(qh1,{onOpen:a=>c(a)}),e?null:L.jsxRuntimeExports.jsx(Dh1,{blockId:T.first(t)})]})},Wh1=h.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-6zRgfZpi.cjs"))),Uh1=h.lazy(()=>Promise.resolve().then(()=>require("./Topbar--m1E08Jl.cjs"))),Kh1=h.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-N3rYeBJV.cjs"))),Gh1=h.lazy(()=>Promise.resolve().then(()=>require("./Settings-xVjTnVSf.cjs"))),Jh1=()=>{const{savePage:t}=wL(),e=M2("autoSaveSupport",!0),c=M2("autoSaveInterval",60);ig.useIntervalEffect(()=>{e&&t()},c*1e3)},Yh1=()=>{const[t]=l1.useAtom(I0),[e]=l1.useAtom(ge),c=n=>{du1()||n.preventDefault()};xh1(),Ah1(),Jh1(),h.useEffect(()=>(t!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[t]);const a=M2("editable",!0),r=M2("nonEditableComponent",null);return L.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen bg-background text-foreground",children:L.jsxRuntimeExports.jsxs(CS,{children:[L.jsxRuntimeExports.jsxs("div",{onContextMenu:c,className:"flex h-screen flex-col overflow-hidden bg-background text-foreground",children:[L.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Uh1,{})})}),L.jsxRuntimeExports.jsxs("main",{className:"relative flex h-full flex-1 flex-row",children:[a?null:L.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 z-[500] flex h-full w-full items-center justify-center backdrop-blur-[2px]",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(r)})}),L.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-fit border-border",style:{maxHeight:"calc(100vh - 56px)"},children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Wh1,{})})}),L.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Kh1,{})})}),L.jsxRuntimeExports.jsxs("div",{className:"relative flex h-[100%] w-[280px] min-w-[280px] border-l border-border pb-10",children:[L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Gh1,{})}),e?L.jsxRuntimeExports.jsx(Zh1,{}):null]})]})]}),L.jsxRuntimeExports.jsx(yh1,{})]})})},og=l1.getDefaultStore(),Xh1=()=>L.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen bg-gray-900 py-12 sm:py-16 lg:py-20 xl:hidden",children:L.jsxRuntimeExports.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:L.jsxRuntimeExports.jsxs("div",{className:"mx-auto max-w-md text-center",children:[L.jsxRuntimeExports.jsx("img",{src:"https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/chaibuilder-blob-storage/175ac8d8-37fe-4707-bb4a-3c0cd6a6db75/gVH7O-Ir_400x400.png",alt:"Chai Builder",className:"mx-auto w-14 rounded-full"}),L.jsxRuntimeExports.jsx("br",{}),L.jsxRuntimeExports.jsx("h2",{className:"text-4xl font-bold text-white",children:"Screen too small"}),L.jsxRuntimeExports.jsx("p",{className:"mt-6 text-sm font-medium leading-6 text-white text-opacity-70",children:"Please view this page on greater than 1280px screen width."})]})})});let Qh1=!1;const _h1=t=>{Qh1=t};const $h1=t=>{const[,e]=Q4(),[,c]=ve(),a=KL();return h.useEffect(()=>{og.set(Gr,T.omit(t,["blocks","subPages","brandingOptions","dataProviders"]))},[t]),h.useEffect(()=>{og.set(en,t.dataProviders||[])},[t.dataProviders]),h.useEffect(()=>{e(I3.syncBlocksWithDefaults(t.blocks||[])),a()},[t.blocks]),h.useEffect(()=>{lg.changeLanguage(t.locale||"en")},[t.locale]),h.useEffect(()=>{_h1(t.showDebugLogs)},[t.showDebugLogs]),h.useEffect(()=>{c(t.brandingOptions)},[t.brandingOptions,c]),L.jsxRuntimeExports.jsx(Yh1,{})},tv1=t=>{const e=t._flags||{};return L.jsxRuntimeExports.jsxs(rL,{children:[L.jsxRuntimeExports.jsxs(PA.FlagsProvider,{features:{...uu1,...e},children:[L.jsxRuntimeExports.jsx(su1,{}),L.jsxRuntimeExports.jsx(Xh1,{}),L.jsxRuntimeExports.jsx($h1,{...t})]}),L.jsxRuntimeExports.jsx(uA,{})]})};exports.Accordion=XL;exports.AccordionContent=ln;exports.AccordionItem=on;exports.AccordionTrigger=sn;exports.Alert=QL;exports.AlertDescription=$L;exports.AlertDialog=eS;exports.AlertDialogAction=gn;exports.AlertDialogCancel=pn;exports.AlertDialogContent=un;exports.AlertDialogDescription=fn;exports.AlertDialogFooter=hn;exports.AlertDialogHeader=dn;exports.AlertDialogTitle=vn;exports.AlertDialogTrigger=cS;exports.AlertTitle=_L;exports.Badge=Od1;exports.BlocksExternalDataProvider=Bh1;exports.Button=i3;exports.Card=hS;exports.CardContent=pS;exports.CardDescription=gS;exports.CardFooter=mS;exports.CardHeader=vS;exports.CardTitle=fS;exports.ChaiBuilderEditor=tv1;exports.Command=yn;exports.CommandDialog=uh1;exports.CommandEmpty=vA;exports.CommandGroup=fA;exports.CommandInput=dA;exports.CommandItem=pA;exports.CommandList=hA;exports.CommandSeparator=gA;exports.CommandShortcut=mA;exports.ContextMenu=dh1;exports.ContextMenuCheckboxItem=CA;exports.ContextMenuContent=MA;exports.ContextMenuGroup=vh1;exports.ContextMenuItem=wA;exports.ContextMenuLabel=HA;exports.ContextMenuPortal=fh1;exports.ContextMenuRadioGroup=ph1;exports.ContextMenuRadioItem=VA;exports.ContextMenuSeparator=yA;exports.ContextMenuShortcut=xA;exports.ContextMenuSub=gh1;exports.ContextMenuSubContent=bA;exports.ContextMenuSubTrigger=zA;exports.ContextMenuTrigger=hh1;exports.Dialog=mn;exports.DialogContent=me;exports.DialogDescription=dS;exports.DialogFooter=iS;exports.DialogHeader=lS;exports.DialogTitle=uS;exports.DialogTrigger=nS;exports.DropdownMenu=YS;exports.DropdownMenuCheckboxItem=$S;exports.DropdownMenuContent=Mn;exports.DropdownMenuGroup=th1;exports.DropdownMenuItem=f6;exports.DropdownMenuLabel=wn;exports.DropdownMenuPortal=eh1;exports.DropdownMenuRadioGroup=ah1;exports.DropdownMenuRadioItem=tA;exports.DropdownMenuSeparator=Cn;exports.DropdownMenuShortcut=eA;exports.DropdownMenuSub=ch1;exports.DropdownMenuSubContent=_S;exports.DropdownMenuSubTrigger=QS;exports.DropdownMenuTrigger=XS;exports.ErrorBoundary=rL;exports.FaCircleCheck=Ih1;exports.FaSpinner=EA;exports.GenIcon=j0;exports.HoverCard=Ud1;exports.HoverCardContent=RS;exports.HoverCardTrigger=Kd1;exports.IconPickerField=zh1;exports.ImagePickerField=Ch1;exports.ImagesPanel=wh1;exports.Input=zS;exports.Label=bS;exports.LinkField=Hh1;exports.Menubar=yS;exports.MenubarCheckboxItem=BS;exports.MenubarContent=AS;exports.MenubarGroup=Dd1;exports.MenubarItem=FS;exports.MenubarLabel=OS;exports.MenubarMenu=Td1;exports.MenubarPortal=qd1;exports.MenubarRadioGroup=Wd1;exports.MenubarRadioItem=ES;exports.MenubarSeparator=PS;exports.MenubarShortcut=kS;exports.MenubarSub=Zd1;exports.MenubarSubContent=SS;exports.MenubarSubTrigger=LS;exports.MenubarTrigger=xS;exports.Popover=Nd1;exports.PopoverContent=HS;exports.PopoverTrigger=jd1;exports.RichTextEditorField=Vh1;exports.ScrollArea=MS;exports.ScrollBar=zn;exports.Select=Gd1;exports.SelectContent=NS;exports.SelectGroup=Jd1;exports.SelectItem=TS;exports.SelectLabel=jS;exports.SelectSeparator=DS;exports.SelectTrigger=IS;exports.SelectValue=Yd1;exports.Separator=cA;exports.Sheet=Xd1;exports.SheetClose=_d1;exports.SheetContent=WS;exports.SheetDescription=JS;exports.SheetFooter=KS;exports.SheetHeader=US;exports.SheetTitle=GS;exports.SheetTrigger=Qd1;exports.Skeleton=Hn;exports.Switch=YL;exports.Tabs=wS;exports.TabsContent=xt;exports.TabsList=bn;exports.TabsTrigger=yt;exports.Textarea=ze;exports.Toaster=uA;exports.Toggle=JL;exports.Tooltip=Rd1;exports.TooltipContent=VS;exports.TooltipPortal=kd1;exports.TooltipProvider=CS;exports.TooltipTrigger=Id1;exports.activePanelAtom=NL;exports.aiAssistantActiveAtom=ge;exports.badgeVariants=tS;exports.builderSaveStateAtom=I0;exports.buttonVariants=pe;exports.canAcceptChildBlock=nL;exports.canDeleteBlock=fu1;exports.canDuplicateBlock=vu1;exports.canvasIframeAtom=IL;exports.canvasSettingsAtom=UL;exports.convertDotNotationToObject=Su1;exports.draggedBlockIdAtom=ZL;exports.draggingFlagAtom=qL;exports.editLayerNameAtom=RL;exports.getBlockJSONFromSchemas=ga;exports.getBlockJSONFromUISchemas=fa;exports.inlineEditingActiveAtom=DL;exports.networkModeAtom=kL;exports.reducer=aA;exports.showPredefinedBlockCategoryAtom=jL;exports.toast=rA;exports.toggleVariants=GL;exports.treeDSBlocks=iL;exports.treeRefAtom=WL;exports.useActiveModal=zd1;exports.useActivePanel=xd1;exports.useAddBlock=qu1;exports.useAddBlockParent=Ld1;exports.useAddClassesToBlocks=Gu1;exports.useAllBlocks=bd1;exports.useAskAi=xn;exports.useBlocksContainer=Ou1;exports.useBlocksStore=Q4;exports.useBlocksStoreUndoableActions=A4;exports.useBrandingOptions=ve;exports.useBuilderProp=M2;exports.useBuilderReset=KL;exports.useCanvasWidth=Ju1;exports.useCanvasZoom=Xu1;exports.useChaiExternalData=SA;exports.useCopyBlockIds=Qu1;exports.useCopyToClipboard=Bd1;exports.useCurrentPage=gL;exports.useCutBlockIds=SL;exports.useDarkMode=_u1;exports.useDuplicateBlocks=nn;exports.useGetPageData=ML;exports.useHiddenBlockIds=td1;exports.useHighlightBlockId=FL;exports.usePageDataProviders=cn;exports.usePasteBlocks=ad1;exports.usePreviewMode=BL;exports.useReadOnlyMode=Vd1;exports.useRemoveBlocks=CL;exports.useRemoveClassesFromBlocks=od1;exports.useSavePage=wL;exports.useSelectedBlock=Cu1;exports.useSelectedBlockAllClasses=sd1;exports.useSelectedBlockCanvasSetting=yu1;exports.useSelectedBlockCurrentClasses=ud1;exports.useSelectedBlockIds=g3;exports.useSelectedBlocksDisplayChild=wu1;exports.useSelectedBreakpoints=Ad1;exports.useSelectedStylingBlocks=VL;exports.useStylingBreakpoint=HL;exports.useStylingState=dd1;exports.useToast=Vn;exports.useUILibraryBlocks=Fd1;exports.useUndoManager=fe;exports.useUpdateBlocksProps=hd1;exports.useUpdateBlocksPropsRealtime=pd1;
|
|
@@ -42138,7 +42138,7 @@ const Ch1 = (t) => {
|
|
|
42138
42138
|
}
|
|
42139
42139
|
)
|
|
42140
42140
|
] });
|
|
42141
|
-
}, Vh1 = p.lazy(() => import("./UnsplashImages-
|
|
42141
|
+
}, Vh1 = p.lazy(() => import("./UnsplashImages-7uAXYHPH.js")), Hh1 = p.lazy(() => import("./UploadImages-5M0Q27R-.js")), SS = ({
|
|
42142
42142
|
isModalView: t = !1,
|
|
42143
42143
|
onSelect: e = () => {
|
|
42144
42144
|
}
|
|
@@ -42359,7 +42359,7 @@ const FS = (t, e) => {
|
|
|
42359
42359
|
}
|
|
42360
42360
|
}
|
|
42361
42361
|
},
|
|
42362
|
-
[r, s]
|
|
42362
|
+
[r, e, s, o, n]
|
|
42363
42363
|
),
|
|
42364
42364
|
loading: t,
|
|
42365
42365
|
error: c
|
|
@@ -42525,7 +42525,7 @@ const Dh1 = ({ blockId: t }) => {
|
|
|
42525
42525
|
r || o("");
|
|
42526
42526
|
};
|
|
42527
42527
|
return t ? /* @__PURE__ */ L.jsxs("div", { className: "mt-4", children: [
|
|
42528
|
-
/* @__PURE__ */ L.jsxs("h2", { className: "mb-
|
|
42528
|
+
/* @__PURE__ */ L.jsxs("h2", { className: "mb-2 text-xs font-semibold leading-none tracking-tight text-gray-500", children: [
|
|
42529
42529
|
e("Ask AI"),
|
|
42530
42530
|
" (GPT-4o mini)"
|
|
42531
42531
|
] }),
|
|
@@ -42598,10 +42598,10 @@ const Dh1 = ({ blockId: t }) => {
|
|
|
42598
42598
|
},
|
|
42599
42599
|
type: "single",
|
|
42600
42600
|
collapsible: !0,
|
|
42601
|
-
className: "-
|
|
42601
|
+
className: "rounded-md border bg-gray-100 px-2",
|
|
42602
42602
|
children: /* @__PURE__ */ L.jsxs(_L, { value: "set-context", children: [
|
|
42603
|
-
/* @__PURE__ */ L.jsx($L, { ref: f, hideArrow: !0, className: "py-
|
|
42604
|
-
/* @__PURE__ */ L.jsx("span", { className: "font-semibold", children: e("
|
|
42603
|
+
/* @__PURE__ */ L.jsx($L, { ref: f, hideArrow: !0, className: "py-1 hover:no-underline", children: /* @__PURE__ */ L.jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
42604
|
+
/* @__PURE__ */ L.jsx("span", { className: "font-semibold", children: e("AI Context") }),
|
|
42605
42605
|
/* @__PURE__ */ L.jsxs(q3, { variant: "default", size: "sm", children: [
|
|
42606
42606
|
/* @__PURE__ */ L.jsx("span", { children: e(d ? "Cancel" : "Edit") }),
|
|
42607
42607
|
" ",
|
|
@@ -42677,7 +42677,7 @@ const Dh1 = ({ blockId: t }) => {
|
|
|
42677
42677
|
/* @__PURE__ */ L.jsx(qh1, { onOpen: (a) => c(a) }),
|
|
42678
42678
|
e ? null : /* @__PURE__ */ L.jsx(Dh1, { blockId: e4(t) })
|
|
42679
42679
|
] });
|
|
42680
|
-
}, Wh1 = _t(() => import("./SidePanels-
|
|
42680
|
+
}, Wh1 = _t(() => import("./SidePanels-PmCljlnf.js")), Uh1 = _t(() => import("./Topbar-FPywhpub.js")), Kh1 = _t(() => import("./CanvasArea-HRipTJFS.js")), Gh1 = _t(() => import("./Settings-WcLqIeQy.js")), Jh1 = () => {
|
|
42681
42681
|
const { savePage: t } = $i1(), e = B2("autoSaveSupport", !0), c = B2("autoSaveInterval", 60);
|
|
42682
42682
|
cF(() => {
|
|
42683
42683
|
e && t();
|
|
@@ -42800,9 +42800,9 @@ export {
|
|
|
42800
42800
|
Od1 as a7,
|
|
42801
42801
|
jg1 as a8,
|
|
42802
42802
|
Ed1 as a9,
|
|
42803
|
-
|
|
42804
|
-
|
|
42805
|
-
|
|
42803
|
+
Y4 as aA,
|
|
42804
|
+
Nn as aB,
|
|
42805
|
+
gd1 as aC,
|
|
42806
42806
|
Iu1 as aD,
|
|
42807
42807
|
Ru1 as aE,
|
|
42808
42808
|
ku1 as aF,
|
|
@@ -42843,16 +42843,16 @@ export {
|
|
|
42843
42843
|
Pd1 as an,
|
|
42844
42844
|
sf1 as ao,
|
|
42845
42845
|
Xd1 as ap,
|
|
42846
|
-
|
|
42847
|
-
|
|
42848
|
-
|
|
42849
|
-
|
|
42850
|
-
|
|
42851
|
-
|
|
42852
|
-
|
|
42853
|
-
|
|
42854
|
-
|
|
42855
|
-
|
|
42846
|
+
Ku1 as aq,
|
|
42847
|
+
Ig1 as ar,
|
|
42848
|
+
Rg1 as as,
|
|
42849
|
+
Bd1 as at,
|
|
42850
|
+
Zd1 as au,
|
|
42851
|
+
Wd1 as av,
|
|
42852
|
+
mS as aw,
|
|
42853
|
+
zS as ax,
|
|
42854
|
+
bS as ay,
|
|
42855
|
+
Gd1 as az,
|
|
42856
42856
|
aS as b,
|
|
42857
42857
|
Td1 as b$,
|
|
42858
42858
|
ef1 as b0,
|