@chaibuilder/sdk 1.2.50 → 1.2.51
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/dist/{AddBlocks-IX7HKzSe.js → AddBlocks-LyEjf6h0.js} +2 -2
- package/dist/{AddBlocks-zwZ63DdP.cjs → AddBlocks-hOFqmmXZ.cjs} +1 -1
- package/dist/{CanvasArea-URgoG1jc.cjs → CanvasArea-luy5nUGR.cjs} +2 -2
- package/dist/{CanvasArea-ehmBje_E.js → CanvasArea-mhINqS0c.js} +3 -3
- package/dist/{ChaiBuilderEditor-ZRHqW7Gd.cjs → ChaiBuilderEditor-H173PF4T.cjs} +1 -1
- package/dist/{ChaiBuilderEditor-3xIN-AP_.js → ChaiBuilderEditor-KEwDa8Bl.js} +7 -15
- package/dist/{CodeEditor-0F7Dz3AB.js → CodeEditor-XaHQMfpT.js} +2 -2
- package/dist/{CodeEditor-1vu-qNgT.cjs → CodeEditor-jh9xwRXT.cjs} +1 -1
- package/dist/{CurrentPage-HOPNdQZ-.cjs → CurrentPage-RUx7wvBt.cjs} +1 -1
- package/dist/{CurrentPage-qhBjm7th.js → CurrentPage-UzajS1xZ.js} +3 -3
- package/dist/{ListTree-sTwXvXST.js → ListTree-BWBPjCzR.js} +1 -1
- package/dist/{ListTree-DkbFFDXB.cjs → ListTree-S6pMJlmj.cjs} +1 -1
- package/dist/{PagesPanel-kdl4A0IN.cjs → PagesPanel-LBW-4mVM.cjs} +1 -1
- package/dist/{PagesPanel-5iVsbDP1.js → PagesPanel-p-h6o26u.js} +4 -4
- package/dist/{ProjectPanel-mXPBI-TU.cjs → ProjectPanel-PQv2uVj2.cjs} +1 -1
- package/dist/{ProjectPanel-c8oTzhQd.js → ProjectPanel-o0OWWnYQ.js} +4 -4
- package/dist/Settings-DclX-cDC.cjs +1 -0
- package/dist/{Settings-0uSGoECC.js → Settings-zm-cF9rZ.js} +6 -6
- package/dist/{SidePanels-kKram02Q.cjs → SidePanels-0w036NaZ.cjs} +1 -1
- package/dist/{SidePanels-YLWdBer9.js → SidePanels-TOHaLWC6.js} +2 -2
- package/dist/{ThemeConfiguration-8W1CM4tW.cjs → ThemeConfiguration-MBuJmbDn.cjs} +1 -1
- package/dist/{ThemeConfiguration-AAGFJieC.js → ThemeConfiguration-wJA_aBly.js} +1 -1
- package/dist/{Topbar-nX9Muoem.js → Topbar-Rh7dWuJD.js} +1 -1
- package/dist/{Topbar-CLNUPx7K.cjs → Topbar-u5HAh7Mg.cjs} +1 -1
- package/dist/{UILibrariesPanel-fKn2nlgI.js → UILibrariesPanel-3-cWabRt.js} +1 -1
- package/dist/{UILibrariesPanel-cp0Mkaq_.cjs → UILibrariesPanel-xOys8g8A.cjs} +1 -1
- package/dist/{UnsplashImages-56HoW_ZA.cjs → UnsplashImages-Kymq8i6b.cjs} +1 -1
- package/dist/{UnsplashImages-zTZa3LjG.js → UnsplashImages-dhU2-pHY.js} +1 -1
- package/dist/{UploadImages-okNGjkXb.cjs → UploadImages-WpaiIEbj.cjs} +1 -1
- package/dist/{UploadImages-SnfaTrlz.js → UploadImages-dr_gpAea.js} +1 -1
- package/dist/{add-page-modal-Y2RY3x01.cjs → add-page-modal-vmUMNu7F.cjs} +1 -1
- package/dist/{add-page-modal-uDoO0zws.js → add-page-modal-zwq1hL_o.js} +4 -4
- package/dist/{confirm-alert-9XiVxCc0.js → confirm-alert-73tjkqtD.js} +1 -1
- package/dist/{confirm-alert-aD7AMK_6.cjs → confirm-alert-fK62IiTF.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-7sfoFf9r.js → delete-page-modal-DPNxHWfi.js} +3 -3
- package/dist/{delete-page-modal-ieJ367JA.cjs → delete-page-modal-G_aMq7K4.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{form-KWYHDVIf.cjs → form-YMuxx9Ju.cjs} +1 -1
- package/dist/{form-PQSmqcIl.js → form-_tKI6ugY.js} +1 -1
- package/dist/html-to-json-9uiQ2Dp2.cjs +1 -0
- package/dist/html-to-json-ofq1N3tB.js +186 -0
- package/dist/{index-VOrp9ZpX.cjs → index-9gfJqJ6E.cjs} +1 -1
- package/dist/{index-i2kgLkjC.js → index-vpfLlP7N.js} +3 -3
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +1 -1
- package/dist/{page-viewer-qkwZJ6e-.js → page-viewer-UZMtWQDj.js} +4 -4
- package/dist/{page-viewer-aoro5JxT.cjs → page-viewer-WQgFhgp5.cjs} +1 -1
- package/dist/{project-general-setting-arXitV5_.cjs → project-general-setting-Yh4fQsQH.cjs} +1 -1
- package/dist/{project-general-setting-3gkaXq1F.js → project-general-setting-Zz7qcIW7.js} +4 -4
- package/dist/{project-seo-setting-kjtUt-er.cjs → project-seo-setting-_gNPOTsp.cjs} +1 -1
- package/dist/{project-seo-setting-X8pykTmc.js → project-seo-setting-wFOVAoC2.js} +2 -2
- package/dist/{single-page-detail-ZXZX6Xmw.js → single-page-detail-1Vveonuh.js} +5 -5
- package/dist/{single-page-detail-UsWG0gfh.cjs → single-page-detail-EMxzuAe1.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -3
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/{useCodeEditor-yl5V3Hte.js → useCodeEditor-2KOfsFsx.js} +1 -1
- package/dist/{useCodeEditor-CtjbxWLf.cjs → useCodeEditor-gE1NWoNH.cjs} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +4 -4
- package/package.json +1 -1
- package/dist/Settings-3kBSStO6.cjs +0 -1
- package/dist/html-to-json-GJ6RioQf.js +0 -221
- package/dist/html-to-json-O1OpqICe.cjs +0 -1
|
@@ -203,4 +203,4 @@ object-assign/index.js:
|
|
|
203
203
|
(c) Sindre Sorhus
|
|
204
204
|
@license MIT
|
|
205
205
|
*)
|
|
206
|
-
*/Z();var cu1=process.env.NODE_ENV!=="production"?eu1:()=>null;function au1(){return new URLSearchParams(window.location.search).has("dnd")}function ru1(){return new URLSearchParams(window.location.search).has("outline")}const nu1={dnd:au1(),arborist:ru1()},Ur=l1.atom(null);Ur.debugLabel="chaiBuilderPropsAtom";const eL=l1.atom({});eL.debugLabel="chaiExternalDataAtom";class cL 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 ou1=()=>!1,su1=t=>{const e=t.replace(Y2.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},ha=j.memoize((t,e)=>{if(!t)return!0;const c=G3.getBlockComponent(t);return c&&j.has(c,"canAcceptBlock")?c.canAcceptBlock(e):!1}),zv1=j.memoize((t,e)=>{const c=G3.getBlockComponent(e);return c&&j.has(c,"canBeNested")?c.canBeNested(t):!0}),lu1=j.memoize(t=>{const e=G3.getBlockComponent(t);return e&&j.has(e,"canDuplicate")?e.canDuplicate():!0}),iu1=j.memoize(t=>{const e=G3.getBlockComponent(t);return e&&j.has(e,"canDelete")?e.canDelete():!0});function aL(t,e,c){const a=j.filter(t,n=>n._parent===e),r=[];for(let n=0;n<a.length;n++){const o=nL(a[n]);if(Object.keys(o).length>0&&Object.keys(o).forEach(s=>{a[n][s]=`slot:${W4.generateUUID()}`}),j.filter(t,{_parent:a[n]._id}).length>0){const s=W4.generateUUID();r.push({...a[n],oldId:a[n]._id,_id:s,_parent:c}),r.push(j.flatten(aL(t,a[n]._id,s)))}else r.push({...a[n],oldId:a[n]._id,_id:W4.generateUUID(),_parent:c})}return j.flatten(r)}function rL(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 nL=t=>{const e={};return Object.keys(t).forEach(c=>{j.isString(t[c])&&t[c].startsWith("slot")&&(e[c]=t[c].replace("slot:",""))}),e},uu1=(t,e,c=null)=>{let a=j.find(t,{_id:e});a={...a,oldId:a._id,_id:W4.generateUUID()},c&&(a={...a,_parent:c});const r=[a];j.filter(t,{_parent:e}).length>0&&r.push(j.flatten(aL(t,e,a._id)));const n=j.flatten(r);return j.map(n,o=>{const s=o,l=nL(s);return Object.keys(l).length>0&&Object.keys(l).forEach(u=>{const i=j.find(n,{oldId:l[u].replace("slot:","")});s[u]=`slot:${i._id}`}),j.omit(s,["global","oldId"])})};const I4=l1.atom([]);I4.debugLabel="presentBlocksAtom";const oL=l1.atom(t=>{const e=t(I4);return rL([...e])});oL.debugLabel="treeDSBlocks";I4.debugLabel="presentBlocksAtom";const Kr=ee1(I4);Kr.debugLabel="pageBlocksAtomsAtom";const du1=l1.atom("");du1.debugLabel="builderActivePageAtom";const hu1=l1.atom(-1);hu1.debugLabel="destinationDropIndexAtom";const sL=l1.atom([]);sL.debugLabel="buildingBlocksAtom";const vu1=l1.atom(t=>{const e=t(sL);return j.filter(e,c=>j.has(c,"blockId"))});vu1.debugLabel="globalBlocksAtom";const Jr=l1.atom([]);Jr.debugLabel="selectedBlockIdsAtom";const Yr=l1.atom(t=>{const e=t(I4),c=t(Jr);return j.map(j.filter(e,({_id:a})=>j.includes(c,a)),a=>({...a}))});Yr.debugLabel="selectedBlocksAtom";const de=l1.atom(t=>{const e=t(Yr);if(e.length===0)return null;if(e.length===1)return e[0]});de.debugLabel="selectedBlockAtom";const fu1=t=>j.get(t,"_parent",null),gu1=l1.atom(t=>{const e=t(Yr),c=j.map(e,fu1);return j.filter(t(I4),a=>j.includes(c,a._id))});gu1.debugLabel="selectedBlocksParentsAtom";const lL=l1.atom(()=>!1);lL.debugLabel="selectedBlockFlexChildAtom";const iL=l1.atom(()=>!1);iL.debugLabel="selectedBlockGridChildAtom";const Xr=l1.atom("");Xr.debugLabel="styleStateAtom";const uL=e4("styleBreakpoint","xs");uL.debugLabel="styleBreakpointAtom";const pu1=()=>({flexChild:l1.useAtomValue(lL),gridChild:l1.useAtomValue(iL)}),mu1=()=>l1.useAtomValue(de),zu1=l1.atom(t=>{const e=t(de),c=t(I4);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}),bu1=()=>l1.useAtomValue(zu1),Mu1=()=>{const t=bu1();return h.useMemo(()=>{for(let e=0;e<t.length;e++){const c=G3.getBlockComponent(t[e]._type),a=j.cloneDeep(j.get(c,"blockState",{}));if(!j.isEmpty(a))return{settings:a,block:t[e]}}return{}},[t])};const f3=()=>{const[t,e]=l1.useAtom(Jr),c=h.useCallback(a=>{e(r=>j.includes(r,a)?j.without(r,a):[...r,a])},[e]);return[t,e,c]},va=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(j.includes(["slot","styles"],o.type))return;const s=n;c[s]=va(o)}),c;case"list":const{itemProperties:a}=t,r={items:{}};return Object.keys(a).forEach(n=>{const o=a[n];if(j.includes(["slot","styles"],o.type))return;const s=n;r.items[s]=va(o)}),r;default:return{}}},fa=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(j.includes(["slot","styles"],l.type))return;const u=s;a.properties[u]=fa(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(j.includes(["slot","styles"],l.type))return;const u=s;o.items.properties[u]=fa(l),j.set(o.items,"title",j.get(l,"itemTitle",`${n} item`))}),o;default:return{}}},dL=t=>{if(!t)return{};const e={};return Object.keys(t).forEach(c=>{e[c]=Cu1(t[c])}),e},wu1=t=>{if(j.isEmpty(t.default))return[];const{itemProperties:e}=t;return j.map(t.default,c=>{const a={...c};return j.forIn(c,(r,n)=>{j.has(e,n)&&j.get(e[n],"i18n",!1)&&(a[n]=Y2.I18N_KEY)}),a})},Cu1=t=>{switch(t.type){case"styles":return t.default;case"slot":return`${Y2.SLOT_KEY}${W4.generateUUID()}`;case"singular":const{schema:e}=t;return j.get(e,"default","");case"model":return dL(t.properties);case"list":return wu1(t);default:return""}};const Vu1=(t,e)=>{const c={};return j.set(c,t,e),c};var Qr={exports:{}},bv1=Qr.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})()})(Qr);var Hu1=Qr.exports;const yu1=H4.getDefaultExportFromCjs(Hu1),xu1=l1.atom(Y2.BRANDING_OPTIONS_DEFAULTS),Lu1=l1.atom(null),he=()=>{const[t,e]=l1.useAtom(xu1);return[j.isObject(t)?{...Y2.BRANDING_OPTIONS_DEFAULTS,...t}:Y2.BRANDING_OPTIONS_DEFAULTS,e]},Iu1=()=>l1.useAtom(Lu1),Su1=l1.atom(null),hL=()=>({currentPage:l1.useAtomValue(Su1)});function vL(t){return rL(t)}const _r=(t,e)=>j.flatten(t.map(c=>{if(c=e?{...c,_parent:e}:{...c},c.children){const a=[...c.children];return delete c.children,j.flatten([c,..._r(a,c._id)])}return c}));function $r(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:j.get(a,"_parent",null),_id:a._id}:a.children&&a.children.length&&$r(a.children)}}function fL(t){let e=[],c=j.filter(t,{type:"GlobalBlock"});return c.length>0&&(c=j.map(c,gL),j.each(c,a=>{e=[...e,...Au1(a)]})),e}function Au1(t){let e=[];const c=j.get(j.first(t),"_parent",null);j.set(j.first(t),"_parent",null);const a=[flatToNestedInstance.convert(pL(t))];$r(a,!0);let r=_r(a,t[0]._id);return r=j.set(r,"0._parent",c),e=[...e,r,...fL(r)],e}function gL(t){const e=j.find(ga,{_id:t._id});if(!e)return[];const c=[e],a=j.filter(ga,{_parent:t._id});return a.length?j.flatten([...c,...j.flatten(j.map(a,gL))]):j.flatten(c)}const pL=t=>JSON.parse(JSON.stringify(t));let ga=[];function Fu1(t){ga=t;const e=vL(pL(t));$r(e);const c=_r(e,null),a=fL(c),r={};return j.each(a,n=>j.set(r,j.first(n).blockId,n)),[c,r]}const mL=()=>{const[t]=he(),{currentPage:e}=hL(),[c]=Q4();return h.useCallback(()=>{const a=j.map(c,n=>j.omit(n,["expanded","order","title","siblings","tempClasses"])),[r=[]]=Fu1(a);return{currentPage:e,blocks:r}},[t,e,c])},M2=(t,e=void 0)=>{const c=l1.useAtomValue(Ur);return j.get(c,t,e)},tn=l1.atom([]);tn.debugLabel="dataProvidersAtom";const en=()=>l1.useAtom(tn),k0=l1.atom("SAVED");k0.debugLabel="builderSaveStateAtom";const zL=()=>{const[t,e]=l1.useAtom(k0),c=M2("onSavePage",async u=>{}),a=M2("onSave",async u=>{}),r=M2("onSaveStateChange",j.noop),n=mL(),[o]=en(),[s]=he();return{savePage:sg.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}},D4=new yu1;D4.setLimit(50);const ve=()=>{const[,t]=l1.useAtom(k0),e=M2("onSaveStateChange",j.noop);return h.useEffect(()=>(D4.setCallback(()=>{t("UNSAVED"),e("UNSAVED")}),()=>{D4.setCallback(j.noop)}),[]),{add:D4.add,undo:D4.undo,redo:D4.redo,hasRedo:D4.hasRedo,hasUndo:D4.hasUndo,clear:D4.clear}},cn=(t,e)=>{const c=[],a=j.filter(t,r=>j.includes(e,r._id)||j.includes(e,r._parent)?(c.push(r._id),!1):!0);return j.isEmpty(c)?a:cn(a,c)},bL=()=>{const[t]=Q4(),[e,c]=f3(),{setNewBlocks:a}=S4();return h.useCallback(r=>{var o;const n=((o=j.find(t,{_id:r[0]}))==null?void 0:o._parent)||null;a(cn(t,r)),setTimeout(()=>c(n?[n]:[]),200)},[t,c,e])};function Bu1(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 Eu1(t){let e=[];return t.walk(c=>(delete c.model.children,e.push(c.model),!0)),e}function Qf(t,e){return t.first(c=>c.model._id===e)||null}function Ou1(t,e,c,a){const r=Qf(t,e),n=Qf(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 Pu1(t,e,c,a){if(!e)return t;c=c||"root";const n=new AS().parse({_id:"root",children:vL(t)});if(Ou1(n,e,c,a)){const o=Eu1(n),s=o.find(l=>l._id===e);return s&&(s._parent=c==="root"?null:c),o.shift(),o}return t}const Gu1=()=>{const[,t]=Q4();return{setNewBlocks:e=>{t(e)},addBlocks:(e,c,a)=>{t(r=>Bu1(r,e,c,a))},removeBlocks:e=>{t(c=>cn(c,e))},moveBlocks:(e,c,a)=>{t(r=>{let n=r;for(let o=0;o<e.length;o++)n=Pu1(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=j.find(e,{_id:r._id});return{...r,...j.omit(n,"_id")}}return r})})}}},Q4=()=>l1.useAtom(I4),S4=()=>{const{add:t}=ve(),[e]=Q4(),{setNewBlocks:c,addBlocks:a,removeBlocks:r,moveBlocks:n,updateBlocksProps:o}=Gu1();return{moveBlocks:(p,g,m)=>{const z=j.map(p,w=>{const C=e.find(A=>A._id===w)._parent||null,I=e.filter(A=>C?A._parent===C:!A._parent).map(A=>A._id).indexOf(w);return{_id:w,oldParent:C,oldPosition:I}}),b=z.find(({_id:w})=>w===p[0]);b&&b.oldParent===g&&b.oldPosition===m||(n(p,g,m),t({undo:()=>j.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(j.map(p,"_id")),redo:()=>a(p,g,m)})},removeBlocks:p=>{var b;const g=(b=j.first(p))==null?void 0:b._parent,z=e.filter(w=>g?w._parent===g:!w._parent).indexOf(j.first(p));r(j.map(p,"_id")),t({undo:()=>a(p,g,z),redo:()=>r(j.map(p,"_id"))})},updateBlocks:(p,g,m)=>{let z=[];if(m)z=j.map(p,b=>({_id:b,...m}));else{const b=j.keys(g);z=j.map(p,w=>{const V=e.find(H=>H._id===w),C={_id:w};return j.each(b,H=>C[H]=V[H]),C})}o(j.map(p,b=>({_id:b,...g}))),t({undo:()=>o(z),redo:()=>o(j.map(p,b=>({_id:b,...g})))})},updateBlocksRuntime:(p,g)=>{o(j.map(p,m=>({_id:m,...g})))},setNewBlocks:p=>{c(p),t({undo:()=>c(e),redo:()=>c(p)})},updateMultipleBlocksProps:p=>{let g=[];g=j.map(p,m=>{const z=j.keys(m),b=e.find(V=>V._id===m._id),w={};return j.each(z,V=>w[V]=b[V]),w}),o(p),t({undo:()=>o(g),redo:()=>o(p)})}}},ku1=()=>{const[t]=Q4(),[,e]=f3(),{addBlocks:c}=S4(),a=h.useCallback((n,o,s)=>{var v;for(let f=0;f<n.length;f++){const{_id:p}=n[f];n[f]._id=W4.generateUUID();const g=j.filter(n,{_parent:p});for(let m=0;m<g.length;m++)g[m]._parent=n[f]._id}const l=j.first(n);let u,i;return o&&(u=j.find(t,{_id:o}),n[0]._parent=o,i=o),!(u?ha(u==null?void 0:u._type,l._type):!0)&&u&&(n[0]._parent=u._parent,i=u._parent),c(n,i,s),e([(v=j.first(n))==null?void 0:v._id]),j.first(n)},[t,e]);return{addCoreBlock:h.useCallback((n,o,s)=>{if(j.has(n,"blocks")){const m=n.blocks;return a(m,o,s)}const l=W4.generateUUID(),u=dL(n.props),i=[];j.forIn(u,(m,z)=>{if(j.startsWith(m,Y2.SLOT_KEY)){const b=m.replace(Y2.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=j.find(t,{_id:o}),d._parent=o,f=o),!ha(v==null?void 0:v._type,d._type)&&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},$f=["xs","sm","md","lg","xl","2xl"];function Ru1(t,e){if(e===null)return"baseClasses";const c=e.mq;if(c==="xs"||e.dark||e.mod!=="")return"classes";let a="baseClasses",r=$f.indexOf(c);for(;r>0;){const n=$f[r-1];if(j.find(t,{mq:n,property:e.property})){a="classes";break}r--}return a}const tg=[];function Nu1(t="",e="",c=[]){t=t.trim().replace(/ +/g,"");let a=j.filter(j.map(t.split(" "),s1.constructClassObject),u=>!j.isNull(u)),r=j.filter(j.map(e.split(" "),s1.constructClassObject),u=>!j.isNull(u));r=j.filter(r,u=>!j.includes(tg,u.property));const n=[],o=[];j.each(c,u=>{const i=s1.constructClassObject(u),d=j.find(a,j.pick(i,["dark","mq","mod","property"]));if(d&&(a=j.filter(a,v=>v.fullCls!==(d==null?void 0:d.fullCls))),n.push(i),i.mq==="xs"&&!i.dark&&i.mod===""&&(r=j.filter(r,v=>v.property!==i.property)),Ru1(a,i)==="baseClasses"&&!j.includes(tg,i.property)){const v=j.find(r,j.pick(i,["property"]));d&&(r=j.filter(r,f=>f.fullCls!==(v==null?void 0:v.fullCls))),o.push({...i,fullCls:i.cls,mq:"xs"})}});const s=j.map(j.sortBy([...a,...n],u=>_f[u.mq]),"fullCls").join(" ");return`${j.map(j.sortBy([...r,...o],u=>_f[u.mq]),"fullCls").join(" ").trim()},${s.trim()}`.trim().replace(/ +/g,"")}const R0=l1.atom([]);R0.debugLabel="selectedStylingBlocksAtom";const ML=()=>l1.useAtom(R0),ju1=t=>{const e=t.replace(Y2.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},Tu1=l1.atom(null,(t,e,{blockIds:c,newClasses:a})=>{const r=j.filter(t(Kr),o=>c.includes(t(o)._id)),n=j.first(t(R0));return j.map(r,o=>{const s=t(o),l=j.get(s,n.prop,`${Y2.STYLES_KEY},`),{baseClasses:u,classes:i}=ju1(l);return{ids:[s._id],props:{[n.prop]:`${Y2.STYLES_KEY}${Nu1(i,u,a)}`}}})}),Du1=()=>{const t=l1.useSetAtom(Tu1),{updateBlocks:e,updateBlocksRuntime:c}=S4();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])},wL=()=>l1.useAtom(uL),CL=e4("canvasWidth",800),VL=l1.atom(t=>{const e=t(CL);return W4.getBreakpointValue(e).toLowerCase()}),qu1=()=>{const[t,e]=l1.useAtom(CL),c=l1.useAtomValue(VL),[a,r]=wL();return h.useEffect(()=>{a!=="xs"&&r(c)},[c,a,r]),[t,c,e]},Zu1=e4("canvasZoom",100),Wu1=()=>l1.useAtom(Zu1),HL=l1.atom([]),yL=()=>{const[t,e]=l1.useAtom(HL),c=l1.useSetAtom(an),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},an=l1.atom([]),Uu1=()=>{const[t,e]=l1.useAtom(an),c=l1.useSetAtom(HL),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},xL=e4("darkMode",!1),Ku1=()=>{const[t,e]=l1.useAtom(xL);return[t,e]},rn=()=>{const[t]=Q4(),[,e]=f3(),{addBlocks:c}=S4();return h.useCallback((a,r=null)=>{const n=[];j.each(a,o=>{const s=t.find(v=>v._id===o);r||(r=s._parent);const i=j.filter(t,v=>j.isString(r)?v._parent===r:!s._parent).indexOf(s)+1,d=uu1(t,o,r);c(d,r,i),n.push(j.get(d,"0._id",""))}),e(n)},[t,e])},Ju1=l1.atom([]),Yu1=()=>{const[t,e]=l1.useAtom(Ju1),c=h.useCallback(a=>{e(r=>j.includes(r,a)?j.without(r,a):[...r,a])},[e]);return[t,e,c]},Xu1=l1.atom(""),LL=()=>l1.useAtom(Xu1),Qu1=()=>{const t=l1.useAtomValue(I4);return h.useCallback((e,c)=>{const a=j.map(t,r=>(j.includes(e,j.get(r,"_id"))&&j.set(r,"_parent",c),r));console.log("newBlocks",a)},[t])},_u1=()=>{console.warn("usePasteBlocks is not implemented");const t=l1.useAtomValue(an),[e,c]=yL(),a=rn(),r=Qu1();return{canPaste:h.useMemo(()=>e.length>0||t.length>0,[t,e]),pasteBlocks:h.useCallback(o=>{j.isEmpty(t)?r(e,o):a(t,o),c(()=>[])},[e,t,a,r,c])}},$u1=l1.atom(!1),IL=()=>{const[t,e]=l1.useAtom($u1);return[t,e]},td1=l1.atom(null,(t,e,{blockIds:c,fullClasses:a})=>{const r=j.first(t(R0)),n=j.filter(t(Kr),o=>c.includes(t(o)._id));return j.map(n,o=>{const s=t(o),l=a;let{classes:u,baseClasses:i}=su1(j.get(s,r.prop,"styles:,"));return j.each(l,d=>{const v=d.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),f=new RegExp(`(^| )${v}($| )`,"g");u=u.replace(f," ").replace(/ +/g," ").trim();const p=j.first(d.split(":"));j.includes(["2xl","xl","lg","md","sm"],p)&&l.push(d.split(":").pop().trim())}),j.each(l,d=>{const v=new RegExp(`(^| )${d.replace("[","\\[").replace("]","\\]")}($| )`,"g");i=i.replace(v," ").replace(/ +/g," ").trim()}),{ids:[s._id],props:{[r.prop]:`${Y2.STYLES_KEY}${i},${u}`}}})}),ed1=()=>{const{updateBlocks:t}=S4(),e=l1.useSetAtom(td1);return h.useCallback((c,a)=>{const r=e({blockIds:c,fullClasses:a});t(c,r[0].props)},[e])},SL=l1.atom(t=>{const e=j.first(t(R0)),c=t(de);if(!e||e.blockId!==j.get(c,"_id",null))return[];const r=j.get(c,e.prop,`${Y2.STYLES_KEY},`).replace(Y2.STYLES_KEY,"").split(",").join(" ");return j.filter(j.map(r.trim().split(" "),s1.constructClassObject),n=>!j.isNull(n))}),cd1=()=>l1.useAtomValue(SL),eg={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},ad1=l1.atom(t=>{const e=t(VL),c=t(Xr),a=t(xL),r=rd1(e);let n=j.filter(t(SL),{mod:c});return j.startsWith(c,"_")||(n=j.filter(n,o=>r.includes(o.mq))),n=n.sort((o,s)=>eg[o.mq]-eg[s.mq]),a||(n=j.filter(n,{dark:!1})),n}),rd1=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},nd1=()=>l1.useAtomValue(ad1),od1=()=>l1.useAtom(Xr),sd1=()=>{const{updateBlocks:t}=S4();return h.useCallback((e,c,a)=>{t(e,c,a)},[t])},ld1=()=>{const{updateMultipleBlocksProps:t}=S4();return h.useCallback(e=>{t(e)},[t])},id1=()=>{const{updateBlocksRuntime:t}=S4();return h.useCallback(async(e,c,a=30)=>{const r=j.keys(j.omit(c,["_id"]));for(const n of r){const o=c[n];if(j.isString(o)){const s=j.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])},ud1=()=>{const{updateMultipleBlocksProps:t}=S4(),e=id1();return h.useCallback(async c=>{for(const a of c)await e(a._id,a);t(c)},[t])},dd1=()=>{const{updateBlocksRuntime:t}=S4();return h.useCallback((e,c)=>{t(e,c)},[t])},AL={name:"",props:{},modalProps:{},backdropClose:!0},hd1=l1.atom(AL),vd1=()=>{const[t,e]=l1.useAtom(hd1),c=h.useCallback((r,n={},o={})=>{e({name:r,props:n,modalProps:o})},[e]),a=h.useCallback((...r)=>{j.get(t,"props.onClose",()=>{})(...r),e(AL)},[e,t]);return{activeModal:t,openModal:c,closeModal:a}},fd1=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),l1.useAtomValue(I4)),FL=l1.atom(!1);FL.debugLabel="readOnlyModeAtom";const BL=l1.atom("online");BL.debugLabel="networkModeAtom";const EL=l1.atom(!1);EL.debugLabel="editLayerNameAtom";const gd1=l1.atom("");gd1.debugLabel="activeLanguageAtom";const pd1=l1.atom("");pd1.debugLabel="primaryLanguageAtom";const OL=l1.atom(null);OL.debugLabel="canvasIframeAtom";const PL=l1.atom("outline");PL.debugLabel="activePanelAtom";const GL=l1.atom("");GL.debugLabel="showPredefinedBlockCategoryAtom";const kL=l1.atom({undoCount:0,redoCount:0});kL.debugLabel="historyStatesAtom";const RL=l1.atom("");RL.debugLabel="inlineEditingActiveAtom";const NL=l1.atom(!1);NL.debugLabel="draggingFlagAtom";const jL=l1.atom("");jL.debugLabel="draggedBlockIdAtom";const TL=l1.atom(null);TL.debugLabel="treeRefAtom";const DL=l1.atom({});DL.debugLabel="canvasSettingsAtom";const fe=l1.atom(!1);fe.debugLabel="askAiActiveBlockAtom";const md1=l1.atom(!1);md1.debugLabel="codeEditorOpenAtom";const zd1=e4("codeEditorHeight",500);zd1.debugLabel="codeEditorHeightAtom";const bd1=()=>l1.useAtomValue(FL),Md1=l1.atom(""),wd1=l1.atom(null),Cd1=()=>l1.useAtom(Md1),Vd1=()=>l1.useAtom(wd1),Hd1=e4("selectedBreakpoints",["XS","MD","XL"]),yd1=()=>{const[t,e]=l1.useAtom(Hd1);return[t,e]},qL=()=>{const t=l1.useSetAtom(kL),{clear:e}=ve(),[,c]=f3(),[,a]=LL(),[,r]=ML(),[,n]=$2(fe);return()=>{c([]),r([]),a(""),e(),n(!1),t({undoCount:0,redoCount:0})}},xd1=()=>({data:M2("uiLibraries",[]),isLoading:!1}),Ld1=()=>{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]},ZL=k3.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"}}),WL=x.forwardRef(({className:t,variant:e,size:c,...a},r)=>L.jsxRuntimeExports.jsx(ig.Root,{ref:r,className:s1.cn(ZL({variant:e,size:c,className:t})),...a}));WL.displayName=ig.Root.displayName;const UL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Ac.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(Ac.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")})}));UL.displayName=Ac.Root.displayName;const ge=k3.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?ES.Slot:"button";return L.jsxRuntimeExports.jsx(o,{className:s1.cn(ge({variant:e,size:c,className:t})),ref:n,...r})});i3.displayName="Button";const KL=A3.Root,nn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(A3.Item,{ref:c,className:s1.cn("border-b",t),...e}));nn.displayName="AccordionItem";const on=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(A3.Header,{className:"flex",children:L.jsxRuntimeExports.jsxs(A3.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"})]})}));on.displayName=A3.Trigger.displayName;const sn=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(A3.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})}));sn.displayName=A3.Content.displayName;const Id1=k3.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"}}),JL=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx("div",{ref:a,role:"alert",className:s1.cn(Id1({variant:e}),t),...c}));JL.displayName="Alert";const YL=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}));YL.displayName="AlertTitle";const XL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("text-sm [&_p]:leading-relaxed",t),...e}));XL.displayName="AlertDescription";const QL=k3.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"}}),Sd1=({className:t,variant:e,...c})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn(QL({variant:e}),t),...c}),_L=N2.Root,$L=N2.Trigger,tI=({className:t,...e})=>L.jsxRuntimeExports.jsx(N2.Portal,{className:s1.cn(t),...e});tI.displayName=N2.Portal.displayName;const eI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.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}));eI.displayName=N2.Overlay.displayName;const ln=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs(tI,{children:[L.jsxRuntimeExports.jsx(eI,{}),L.jsxRuntimeExports.jsx(N2.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})]}));ln.displayName=N2.Content.displayName;const un=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});un.displayName="AlertDialogHeader";const dn=({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});dn.displayName="AlertDialogFooter";const hn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.Title,{ref:c,className:s1.cn("text-lg font-semibold",t),...e}));hn.displayName=N2.Title.displayName;const vn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));vn.displayName=N2.Description.displayName;const fn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.Action,{ref:c,className:s1.cn(ge(),t),...e}));fn.displayName=N2.Action.displayName;const gn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.Cancel,{ref:c,className:s1.cn(ge({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));gn.displayName=N2.Cancel.displayName;const pn=J1.Root,cI=J1.Trigger,aI=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});aI.displayName=J1.Portal.displayName;const rI=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}));rI.displayName=J1.Overlay.displayName;const pe=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(aI,{children:[L.jsxRuntimeExports.jsx(rI,{}),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"})]})]})]}));pe.displayName=J1.Content.displayName;const nI=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});nI.displayName="DialogHeader";const oI=({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});oI.displayName="DialogFooter";const sI=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}));sI.displayName=J1.Title.displayName;const lI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));lI.displayName=J1.Description.displayName;const iI=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}));iI.displayName="Card";const uI=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}));uI.displayName="CardHeader";const dI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h3",{ref:c,className:s1.cn("font-semibold leading-none tracking-tight",t),...e}));dI.displayName="CardTitle";const hI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("p",{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));hI.displayName="CardDescription";const vI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("p-6 pt-0",t),...e}));vI.displayName="CardContent";const fI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn(" flex items-center p-6 pt-0",t),...e}));fI.displayName="CardFooter";const gI=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}));gI.displayName="Input";const Ad1=k3.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),pI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(ug.Root,{ref:c,className:s1.cn(Ad1(),t),...e}));pI.displayName=ug.Root.displayName;const me=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}));me.displayName="Textarea";const mI=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(U2.Root,{ref:a,className:s1.cn("relative overflow-hidden",t),...c,children:[L.jsxRuntimeExports.jsx(U2.Viewport,{className:"h-full w-full rounded-[inherit]",children:e}),L.jsxRuntimeExports.jsx(mn,{}),L.jsxRuntimeExports.jsx(U2.Corner,{})]}));mI.displayName=U2.Root.displayName;const mn=x.forwardRef(({className:t,orientation:e="vertical",...c},a)=>L.jsxRuntimeExports.jsx(U2.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(U2.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));mn.displayName=U2.ScrollAreaScrollbar.displayName;const zI=R3.Root,zn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(R3.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}));zn.displayName=R3.List.displayName;const Ht=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(R3.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}));Ht.displayName=R3.Trigger.displayName;const yt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(R3.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}));yt.displayName=R3.Content.displayName;const Fd1=H6.Portal,bI=H6.Provider,Bd1=H6.Root,Ed1=H6.Trigger,MI=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(H6.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}));MI.displayName=H6.Content.displayName;const Od1=i0.Root,Pd1=i0.Trigger,wI=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(i0.Portal,{children:L.jsxRuntimeExports.jsx(i0.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})}));wI.displayName=i0.Content.displayName;const Gd1=U1.Menu,kd1=U1.Group,Rd1=U1.Portal,Nd1=U1.Sub,jd1=U1.RadioGroup,CI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(U1.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}));CI.displayName=U1.Root.displayName;const VI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(U1.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}));VI.displayName=U1.Trigger.displayName;const HI=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(U1.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"})]}));HI.displayName=U1.SubTrigger.displayName;const yI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(U1.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}));yI.displayName=U1.SubContent.displayName;const xI=x.forwardRef(({className:t,align:e="start",alignOffset:c=-4,sideOffset:a=8,...r},n)=>L.jsxRuntimeExports.jsx(U1.Portal,{children:L.jsxRuntimeExports.jsx(U1.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})}));xI.displayName=U1.Content.displayName;const LI=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(U1.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}));LI.displayName=U1.Item.displayName;const II=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(U1.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(U1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));II.displayName=U1.CheckboxItem.displayName;const SI=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(U1.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(U1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));SI.displayName=U1.RadioItem.displayName;const AI=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(U1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));AI.displayName=U1.Label.displayName;const FI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(U1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));FI.displayName=U1.Separator.displayName;const BI=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});BI.displayname="MenubarShortcut";const Td1=Lt.Root,Dd1=Lt.Trigger,EI=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(Lt.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}));EI.displayName=Lt.Content.displayName;const qd1=x2.Root,Zd1=x2.Group,Wd1=x2.Value,OI=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"})})]}));OI.displayName=x2.Trigger.displayName;const PI=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})})}));PI.displayName=x2.Content.displayName;const GI=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}));GI.displayName=x2.Label.displayName;const kI=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})]}));kI.displayName=x2.Item.displayName;const RI=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}));RI.displayName=x2.Separator.displayName;const Ud1=J1.Root,Kd1=J1.Trigger,Jd1=J1.Close,NI=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});NI.displayName=J1.Portal.displayName;const jI=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}));jI.displayName=J1.Overlay.displayName;const Yd1=k3.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"}}),TI=x.forwardRef(({side:t="right",className:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(NI,{children:[L.jsxRuntimeExports.jsx(jI,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:r,className:s1.cn(Yd1({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"})]})]})]}));TI.displayName=J1.Content.displayName;const DI=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});DI.displayName="SheetHeader";const qI=({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});qI.displayName="SheetFooter";const ZI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold text-foreground",t),...e}));ZI.displayName=J1.Title.displayName;const WI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));WI.displayName=J1.Description.displayName;const UI=_1.Root,KI=_1.Trigger,Xd1=_1.Group,Qd1=_1.Portal,_d1=_1.Sub,$d1=_1.RadioGroup,JI=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"})]}));JI.displayName=_1.SubTrigger.displayName;const YI=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}));YI.displayName=_1.SubContent.displayName;const bn=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})}));bn.displayName=_1.Content.displayName;const v6=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}));v6.displayName=_1.Item.displayName;const XI=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]}));XI.displayName=_1.CheckboxItem.displayName;const QI=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]}));QI.displayName=_1.RadioItem.displayName;const Mn=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}));Mn.displayName=_1.Label.displayName;const wn=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}));wn.displayName=_1.Separator.displayName;const _I=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest opacity-60",t),...e});_I.displayName="DropdownMenuShortcut";const $I=x.forwardRef(({className:t,orientation:e="horizontal",decorative:c=!0,...a},r)=>L.jsxRuntimeExports.jsx(dg.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}));$I.displayName=dg.Root.displayName;const th1=1,eh1=1e6;let Ic=0;function ch1(){return Ic=(Ic+1)%Number.MAX_VALUE,Ic.toString()}const Sc=new Map,cg=t=>{if(Sc.has(t))return;const e=setTimeout(()=>{Sc.delete(t),l0({type:"REMOVE_TOAST",toastId:t})},eh1);Sc.set(t,e)},tS=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,th1)};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?cg(c):t.toasts.forEach(a=>{cg(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)}}},D8=[];let q8={toasts:[]};function l0(t){q8=tS(q8,t),D8.forEach(e=>{e(q8)})}function eS({...t}){const e=ch1(),c=r=>l0({type:"UPDATE_TOAST",toast:{...r,id:e}}),a=()=>l0({type:"DISMISS_TOAST",toastId:e});return l0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:r=>{r||a()}}}),{id:e,dismiss:a,update:c}}function Cn(){const[t,e]=x.useState(q8);return x.useEffect(()=>(D8.push(e),()=>{const c=D8.indexOf(e);c>-1&&D8.splice(c,1)}),[t]),{...t,toast:eS,dismiss:c=>l0({type:"DISMISS_TOAST",toastId:c})}}const ah1=u4.Provider,cS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.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}));cS.displayName=u4.Viewport.displayName;const rh1=k3.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"}}),aS=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx(u4.Root,{ref:a,className:s1.cn(rh1({variant:e}),t),...c}));aS.displayName=u4.Root.displayName;const nh1=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.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}));nh1.displayName=u4.Action.displayName;const rS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.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"})}));rS.displayName=u4.Close.displayName;const nS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.Title,{ref:c,className:s1.cn("text-sm font-semibold [&+div]:text-xs",t),...e}));nS.displayName=u4.Title.displayName;const oS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.Description,{ref:c,className:s1.cn("text-sm opacity-90",t),...e}));oS.displayName=u4.Description.displayName;function sS(){const{toasts:t}=Cn();return L.jsxRuntimeExports.jsxs(ah1,{children:[t.map(({id:e,title:c,description:a,action:r,...n})=>L.jsxRuntimeExports.jsxs(aS,{...n,children:[L.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[c&&L.jsxRuntimeExports.jsx(nS,{children:c}),a&&L.jsxRuntimeExports.jsx(oS,{children:a})]}),r,L.jsxRuntimeExports.jsx(rS,{})]},e)),L.jsxRuntimeExports.jsx(cS,{})]})}const Vn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("animate-pulse rounded-md bg-primary/10",t),...e}),Hn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.Command,{ref:c,className:s1.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Hn.displayName=Q2.Command.displayName;const oh1=({children:t,...e})=>L.jsxRuntimeExports.jsx(pn,{...e,children:L.jsxRuntimeExports.jsx(pe,{className:"overflow-hidden p-0",children:L.jsxRuntimeExports.jsx(Hn,{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})})}),lS=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(Q2.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})]}));lS.displayName=Q2.Command.Input.displayName;const iS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.Command.List,{ref:c,className:s1.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));iS.displayName=Q2.Command.List.displayName;const uS=x.forwardRef((t,e)=>L.jsxRuntimeExports.jsx(Q2.Command.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));uS.displayName=Q2.Command.Empty.displayName;const dS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.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}));dS.displayName=Q2.Command.Group.displayName;const hS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.Command.Separator,{ref:c,className:s1.cn("-mx-1 h-px bg-border",t),...e}));hS.displayName=Q2.Command.Separator.displayName;const vS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.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}));vS.displayName=Q2.Command.Item.displayName;const fS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});fS.displayName="CommandShortcut";const sh1=$1.Root,lh1=$1.Trigger,ih1=$1.Group,uh1=$1.Portal,dh1=$1.Sub,hh1=$1.RadioGroup,gS=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"})]}));gS.displayName=$1.SubTrigger.displayName;const pS=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}));pS.displayName=$1.SubContent.displayName;const mS=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})}));mS.displayName=$1.Content.displayName;const zS=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}));zS.displayName=$1.Item.displayName;const bS=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]}));bS.displayName=$1.CheckboxItem.displayName;const MS=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]}));MS.displayName=$1.RadioItem.displayName;const wS=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}));wS.displayName=$1.Label.displayName;const CS=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}));CS.displayName=$1.Separator.displayName;const VS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});VS.displayName="ContextMenuShortcut";const vh1=t=>{try{const e=document.getElementById("icon-picker-field"),c=document.createElement("div");pa.render(L.jsxRuntimeExports.jsx(lg.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),""}},fh1=({value:t,onChange:e})=>{const c=a=>{e("<svg />");const r=vh1(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(lg,{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"})]})},gh1=h.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-56HoW_ZA.cjs"))),ph1=h.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-okNGjkXb.cjs"))),HS=({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(zI,{value:o,onValueChange:l=>s(l),className:"flex h-full w-full flex-col py-2",children:[!(r||n)&&L.jsxRuntimeExports.jsxs(zn,{className:"w-full",children:[L.jsxRuntimeExports.jsx(Ht,{value:"upload",className:"w-full",children:"Upload"}),L.jsxRuntimeExports.jsx(Ht,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),o==="unsplash"?L.jsxRuntimeExports.jsx(yt,{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(gh1,{isModalView:t,onSelect:e})})}):L.jsxRuntimeExports.jsx(yt,{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(ph1,{isModalView:t,onSelect:e})})})]})]})},mh1=Object.freeze(Object.defineProperty({__proto__:null,default:HS},Symbol.toStringTag,{value:"Module"})),ag=({children:t,onSelect:e})=>{const[c,a]=h.useState(!1),r=(...n)=>{e.call(void 0,...n),a(!1)};return L.jsxRuntimeExports.jsxs(pn,{open:c,onOpenChange:n=>a(n),children:[L.jsxRuntimeExports.jsx(cI,{asChild:!0,children:t}),L.jsxRuntimeExports.jsx(pe,{className:"flex h-3/4 max-w-5xl",children:L.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:L.jsxRuntimeExports.jsx(HS,{isModalView:!0,onSelect:r})})})]})},zh1=({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(ag,{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(ag,{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||!j.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)})]})]})},bh1=({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(JS,{id:t,value:c,onBlur:s=>r(t,s),onChange:s=>a(s),modules:n,formats:o,placeholder:e,className:"mt-1 rounded-md"})},Mh1=({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"}),j.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"})]})]})]})},wh1=()=>{const[t,e]=IL(),{t:c}=xt.useTranslation(),a=M2("previewComponent",null);return t?L.jsxRuntimeExports.jsxs("div",{className:W4.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(Vn,{className:"h-96 w-full"}),children:h.createElement(a)}):null})]}):null},Ch1=()=>{const[t,e]=f3(),c=bL(),a=rn(),{undo:r,redo:n}=ve();E6.useHotkeys("esc",()=>e([]),{},[e]),E6.useHotkeys("ctrl+d,command+d",()=>a(t),{preventDefault:!0},[t,a]),E6.useHotkeys("ctrl+z,command+z",()=>r(),{},[r]),E6.useHotkeys("ctrl+y,command+y",()=>n(),{},[n]),E6.useHotkeys("del, backspace",o=>{o.preventDefault(),c(t)},{},[t,c])},Vh1=(t,e)=>{const c=[];let a=j.find(t,{_id:e}),r=j.get(a,"_parent","");for(;j.isString(r)&&!j.isEmpty(r);)c.push(a==null?void 0:a._parent),a=j.find(t,{_id:r}),r=a==null?void 0:a._parent;return j.flatten(c)},Hh1=l1.atom([]),yh1=()=>{const[t]=f3(),e=l1.useAtomValue(I4),[,c]=l1.useAtom(Hh1);h.useEffect(()=>{let a=[];const r=j.first(t);j.isString(r)&&(a=[r,...Vh1(e,r)]),c(a)},[t,e,c])};const yS=()=>l1.useAtom(eL),xh1=()=>h.useMemo(()=>G3.getChaiDataProviders(),[]),Lh1=({children:t})=>{const[,e]=yS(),[c]=en(),a=xh1();return h.useEffect(()=>(e({}),j.each(c,r=>{const n=j.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})))}}),()=>{j.each(c,r=>{e(n=>(delete n[r.providerKey],n))})}),[a,c,e]),L.jsxRuntimeExports.jsx(L.jsxRuntimeExports.Fragment,{children:t})};function Ih1(t,e,c){c.push(j.find(t,{_id:e}));const a=j.filter(t,{_parent:e});for(const r of a)c.push(...xS(r._id,t));return c}const xS=(t,e)=>{let c=[];return c=j.flattenDeep([...c,...Ih1(e,t,c)]),c},Sh1=l1.atom(!1),yn=()=>{const[t,e]=l1.useAtom(Sh1),[c,a]=h.useState(null),r=M2("askAiCallBack",null),n=ud1(),o=ld1(),[s]=Q4();return{askAi:h.useCallback(async(l,u,i,d)=>{if(r){e(!0),a(null);try{const v=l==="content"?j.cloneDeep(xS(u,s)):[j.cloneDeep(s.find(g=>g._id===u))];j.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}};function Ah1(t){return M0.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"}}]})(t)}function Fh1(t){return M0.GenIcon({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 LS(t){return M0.GenIcon({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 Bh1(t){return M0.GenIcon({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 Eh1(t){return M0.GenIcon({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 Oh1=[{name:"Improve writing",icon:Eh1,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:Fh1,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:L3.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:L3.ShuffleIcon,prompt:"Randomize all text elements."}];function Ph1({onClick:t}){const{loading:e}=yn();return L.jsxRuntimeExports.jsx("div",{className:e?"pointer-events-none opacity-50":"",children:L.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:Oh1.map(({name:c,icon:a,subMenus:r,prompt:n})=>r?L.jsxRuntimeExports.jsxs(UI,{children:[L.jsxRuntimeExports.jsx(KI,{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(bn,{children:[L.jsxRuntimeExports.jsx(Mn,{children:"My Account"}),L.jsxRuntimeExports.jsx(wn,{}),L.jsxRuntimeExports.jsx(v6,{children:"Profile"}),L.jsxRuntimeExports.jsx(v6,{children:"Billing"}),L.jsxRuntimeExports.jsx(v6,{children:"Team"}),L.jsxRuntimeExports.jsx(v6,{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 Gh1=({blockId:t})=>{const{t:e}=xt.useTranslation(),{askAi:c,loading:a,error:r}=yn(),[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(me,{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(L3.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(Vn,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[L.jsxRuntimeExports.jsx(LS,{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(Ph1,{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(L3.SparklesIcon,{className:"mx-auto text-3xl"}),L.jsxRuntimeExports.jsx("h1",{children:e("no_block_selected_for_ask_ai")})]})})},kh1=({onOpen:t})=>{const{t:e}=xt.useTranslation(),c=M2("aiContext",""),[a,r]=h.useState(c),n=h.useRef(null),o=M2("saveAiContextCallback",j.noop),[s,l]=h.useState(!1),[u,i]=h.useState(null),[d,v]=h.useState(!1),{toast:f}=Cn(),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(KL,{onValueChange:m=>{t(m!==""),v(m!=="")},type:"single",collapsible:!0,className:"rounded-md border bg-gray-100 px-2",children:L.jsxRuntimeExports.jsxs(nn,{value:"set-context",children:[L.jsxRuntimeExports.jsx(on,{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(L3.EditIcon,{className:"h-4 w-4"})]})]})}),L.jsxRuntimeExports.jsxs(sn,{children:[L.jsxRuntimeExports.jsx(me,{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(L3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Save")}),c.trim().length>0?L.jsxRuntimeExports.jsxs(_L,{children:[L.jsxRuntimeExports.jsx($L,{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(L3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Delete")})}),L.jsxRuntimeExports.jsxs(ln,{children:[L.jsxRuntimeExports.jsxs(un,{children:[L.jsxRuntimeExports.jsx(hn,{children:e("Remove context?")}),L.jsxRuntimeExports.jsx(vn,{})]}),L.jsxRuntimeExports.jsxs(dn,{children:[L.jsxRuntimeExports.jsx(gn,{children:e("Cancel")}),L.jsxRuntimeExports.jsx(fn,{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})})]})]})})},Rh1=()=>{const[t]=f3(),[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(kh1,{onOpen:a=>c(a)}),e?null:L.jsxRuntimeExports.jsx(Gh1,{blockId:j.first(t)})]})},Nh1=h.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-kKram02Q.cjs"))),jh1=h.lazy(()=>Promise.resolve().then(()=>require("./Topbar-CLNUPx7K.cjs"))),Th1=h.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-URgoG1jc.cjs"))),Dh1=h.lazy(()=>Promise.resolve().then(()=>require("./Settings-3kBSStO6.cjs"))),qh1=()=>{const{savePage:t}=zL(),e=M2("autoSaveSupport",!0),c=M2("autoSaveInterval",60);sg.useIntervalEffect(()=>{e&&t()},c*1e3)},Zh1=()=>{const[t]=l1.useAtom(k0),[e]=l1.useAtom(fe),c=n=>{ou1()||n.preventDefault()};Ch1(),yh1(),qh1(),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(bI,{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(jh1,{})})}),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(Nh1,{})})}),L.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Th1,{})})}),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(Dh1,{})}),e?L.jsxRuntimeExports.jsx(Rh1,{}):null]})]})]}),L.jsxRuntimeExports.jsx(wh1,{})]})})},rg=l1.getDefaultStore(),Wh1=()=>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 Uh1=!1;const Kh1=t=>{Uh1=t};const Jh1=t=>{const[,e]=Q4(),[,c]=he(),a=qL();return h.useEffect(()=>{rg.set(Ur,j.omit(t,["blocks","subPages","brandingOptions","dataProviders"]))},[t]),h.useEffect(()=>{rg.set(tn,t.dataProviders||[])},[t.dataProviders]),h.useEffect(()=>{e(G3.syncBlocksWithDefaults(t.blocks||[])),a()},[t.blocks]),h.useEffect(()=>{og.changeLanguage(t.locale||"en")},[t.locale]),h.useEffect(()=>{Kh1(t.showDebugLogs)},[t.showDebugLogs]),h.useEffect(()=>{c(t.brandingOptions)},[t.brandingOptions,c]),L.jsxRuntimeExports.jsx(Zh1,{})},Yh1=t=>{const e=t._flags||{};return L.jsxRuntimeExports.jsxs(cL,{children:[L.jsxRuntimeExports.jsxs(SS.FlagsProvider,{features:{...nu1,...e},children:[L.jsxRuntimeExports.jsx(cu1,{}),L.jsxRuntimeExports.jsx(Wh1,{}),L.jsxRuntimeExports.jsx(Jh1,{...t})]}),L.jsxRuntimeExports.jsx(sS,{})]})};exports.Accordion=KL;exports.AccordionContent=sn;exports.AccordionItem=nn;exports.AccordionTrigger=on;exports.Alert=JL;exports.AlertDescription=XL;exports.AlertDialog=_L;exports.AlertDialogAction=fn;exports.AlertDialogCancel=gn;exports.AlertDialogContent=ln;exports.AlertDialogDescription=vn;exports.AlertDialogFooter=dn;exports.AlertDialogHeader=un;exports.AlertDialogTitle=hn;exports.AlertDialogTrigger=$L;exports.AlertTitle=YL;exports.Badge=Sd1;exports.BlocksExternalDataProvider=Lh1;exports.Button=i3;exports.Card=iI;exports.CardContent=vI;exports.CardDescription=hI;exports.CardFooter=fI;exports.CardHeader=uI;exports.CardTitle=dI;exports.ChaiBuilderEditor=Yh1;exports.Command=Hn;exports.CommandDialog=oh1;exports.CommandEmpty=uS;exports.CommandGroup=dS;exports.CommandInput=lS;exports.CommandItem=vS;exports.CommandList=iS;exports.CommandSeparator=hS;exports.CommandShortcut=fS;exports.ContextMenu=sh1;exports.ContextMenuCheckboxItem=bS;exports.ContextMenuContent=mS;exports.ContextMenuGroup=ih1;exports.ContextMenuItem=zS;exports.ContextMenuLabel=wS;exports.ContextMenuPortal=uh1;exports.ContextMenuRadioGroup=hh1;exports.ContextMenuRadioItem=MS;exports.ContextMenuSeparator=CS;exports.ContextMenuShortcut=VS;exports.ContextMenuSub=dh1;exports.ContextMenuSubContent=pS;exports.ContextMenuSubTrigger=gS;exports.ContextMenuTrigger=lh1;exports.Dialog=pn;exports.DialogContent=pe;exports.DialogDescription=lI;exports.DialogFooter=oI;exports.DialogHeader=nI;exports.DialogTitle=sI;exports.DialogTrigger=cI;exports.DropdownMenu=UI;exports.DropdownMenuCheckboxItem=XI;exports.DropdownMenuContent=bn;exports.DropdownMenuGroup=Xd1;exports.DropdownMenuItem=v6;exports.DropdownMenuLabel=Mn;exports.DropdownMenuPortal=Qd1;exports.DropdownMenuRadioGroup=$d1;exports.DropdownMenuRadioItem=QI;exports.DropdownMenuSeparator=wn;exports.DropdownMenuShortcut=_I;exports.DropdownMenuSub=_d1;exports.DropdownMenuSubContent=YI;exports.DropdownMenuSubTrigger=JI;exports.DropdownMenuTrigger=KI;exports.ErrorBoundary=cL;exports.FaCircleCheck=Bh1;exports.FaMoon=Ah1;exports.FaSpinner=LS;exports.HoverCard=Td1;exports.HoverCardContent=EI;exports.HoverCardTrigger=Dd1;exports.IconPickerField=fh1;exports.ImagePickerField=zh1;exports.ImagesPanel=mh1;exports.Input=gI;exports.Label=pI;exports.LinkField=Mh1;exports.Menubar=CI;exports.MenubarCheckboxItem=II;exports.MenubarContent=xI;exports.MenubarGroup=kd1;exports.MenubarItem=LI;exports.MenubarLabel=AI;exports.MenubarMenu=Gd1;exports.MenubarPortal=Rd1;exports.MenubarRadioGroup=jd1;exports.MenubarRadioItem=SI;exports.MenubarSeparator=FI;exports.MenubarShortcut=BI;exports.MenubarSub=Nd1;exports.MenubarSubContent=yI;exports.MenubarSubTrigger=HI;exports.MenubarTrigger=VI;exports.Popover=Od1;exports.PopoverContent=wI;exports.PopoverTrigger=Pd1;exports.RichTextEditorField=bh1;exports.ScrollArea=mI;exports.ScrollBar=mn;exports.Select=qd1;exports.SelectContent=PI;exports.SelectGroup=Zd1;exports.SelectItem=kI;exports.SelectLabel=GI;exports.SelectSeparator=RI;exports.SelectTrigger=OI;exports.SelectValue=Wd1;exports.Separator=$I;exports.Sheet=Ud1;exports.SheetClose=Jd1;exports.SheetContent=TI;exports.SheetDescription=WI;exports.SheetFooter=qI;exports.SheetHeader=DI;exports.SheetTitle=ZI;exports.SheetTrigger=Kd1;exports.Skeleton=Vn;exports.Switch=UL;exports.Tabs=zI;exports.TabsContent=yt;exports.TabsList=zn;exports.TabsTrigger=Ht;exports.Textarea=me;exports.Toaster=sS;exports.Toggle=WL;exports.Tooltip=Bd1;exports.TooltipContent=MI;exports.TooltipPortal=Fd1;exports.TooltipProvider=bI;exports.TooltipTrigger=Ed1;exports.activePanelAtom=PL;exports.aiAssistantActiveAtom=fe;exports.atomWithStorage=e4;exports.badgeVariants=QL;exports.builderSaveStateAtom=k0;exports.buttonVariants=ge;exports.canAcceptChildBlock=ha;exports.canDeleteBlock=iu1;exports.canDuplicateBlock=lu1;exports.canvasIframeAtom=OL;exports.canvasSettingsAtom=DL;exports.convertDotNotationToObject=Vu1;exports.draggedBlockIdAtom=jL;exports.draggingFlagAtom=NL;exports.editLayerNameAtom=EL;exports.getBlockJSONFromSchemas=fa;exports.getBlockJSONFromUISchemas=va;exports.inlineEditingActiveAtom=RL;exports.networkModeAtom=BL;exports.reducer=tS;exports.showPredefinedBlockCategoryAtom=GL;exports.toast=eS;exports.toggleVariants=ZL;exports.treeDSBlocks=oL;exports.treeRefAtom=TL;exports.useActiveModal=vd1;exports.useActivePanel=Cd1;exports.useAddBlock=ku1;exports.useAddBlockParent=Vd1;exports.useAddClassesToBlocks=Du1;exports.useAllBlocks=fd1;exports.useAskAi=yn;exports.useBlocksContainer=Iu1;exports.useBlocksStore=Q4;exports.useBlocksStoreUndoableActions=S4;exports.useBrandingOptions=he;exports.useBuilderProp=M2;exports.useBuilderReset=qL;exports.useCanvasWidth=qu1;exports.useCanvasZoom=Wu1;exports.useChaiExternalData=yS;exports.useCopyBlockIds=Uu1;exports.useCopyToClipboard=Ld1;exports.useCurrentPage=hL;exports.useCutBlockIds=yL;exports.useDarkMode=Ku1;exports.useDuplicateBlocks=rn;exports.useGetPageData=mL;exports.useHiddenBlockIds=Yu1;exports.useHighlightBlockId=LL;exports.usePageDataProviders=en;exports.usePasteBlocks=_u1;exports.usePreviewMode=IL;exports.useReadOnlyMode=bd1;exports.useRemoveBlocks=bL;exports.useRemoveClassesFromBlocks=ed1;exports.useSavePage=zL;exports.useSelectedBlock=mu1;exports.useSelectedBlockAllClasses=cd1;exports.useSelectedBlockCanvasSetting=Mu1;exports.useSelectedBlockCurrentClasses=nd1;exports.useSelectedBlockIds=f3;exports.useSelectedBlocksDisplayChild=pu1;exports.useSelectedBreakpoints=yd1;exports.useSelectedStylingBlocks=ML;exports.useStylingBreakpoint=wL;exports.useStylingState=od1;exports.useToast=Cn;exports.useUILibraryBlocks=xd1;exports.useUndoManager=ve;exports.useUpdateBlocksProps=sd1;exports.useUpdateBlocksPropsRealtime=dd1;
|
|
206
|
+
*/Z();var cu1=process.env.NODE_ENV!=="production"?eu1:()=>null;function au1(){return new URLSearchParams(window.location.search).has("dnd")}function ru1(){return new URLSearchParams(window.location.search).has("outline")}const nu1={dnd:au1(),arborist:ru1()},Ur=l1.atom(null);Ur.debugLabel="chaiBuilderPropsAtom";const eL=l1.atom({});eL.debugLabel="chaiExternalDataAtom";class cL 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 ou1=()=>!1,su1=t=>{const e=t.replace(Y2.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},ha=j.memoize((t,e)=>{if(!t)return!0;const c=G3.getBlockComponent(t);return c&&j.has(c,"canAcceptBlock")?c.canAcceptBlock(e):!1}),zv1=j.memoize((t,e)=>{const c=G3.getBlockComponent(e);return c&&j.has(c,"canBeNested")?c.canBeNested(t):!0}),lu1=j.memoize(t=>{const e=G3.getBlockComponent(t);return e&&j.has(e,"canDuplicate")?e.canDuplicate():!0}),iu1=j.memoize(t=>{const e=G3.getBlockComponent(t);return e&&j.has(e,"canDelete")?e.canDelete():!0});function aL(t,e,c){const a=j.filter(t,n=>n._parent===e),r=[];for(let n=0;n<a.length;n++){const o=nL(a[n]);if(Object.keys(o).length>0&&Object.keys(o).forEach(s=>{a[n][s]=`slot:${W4.generateUUID()}`}),j.filter(t,{_parent:a[n]._id}).length>0){const s=W4.generateUUID();r.push({...a[n],oldId:a[n]._id,_id:s,_parent:c}),r.push(j.flatten(aL(t,a[n]._id,s)))}else r.push({...a[n],oldId:a[n]._id,_id:W4.generateUUID(),_parent:c})}return j.flatten(r)}function rL(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 nL=t=>{const e={};return Object.keys(t).forEach(c=>{j.isString(t[c])&&t[c].startsWith("slot")&&(e[c]=t[c].replace("slot:",""))}),e},uu1=(t,e,c=null)=>{let a=j.find(t,{_id:e});a={...a,oldId:a._id,_id:W4.generateUUID()},c&&(a={...a,_parent:c});const r=[a];j.filter(t,{_parent:e}).length>0&&r.push(j.flatten(aL(t,e,a._id)));const n=j.flatten(r);return j.map(n,o=>{const s=o,l=nL(s);return Object.keys(l).length>0&&Object.keys(l).forEach(u=>{const i=j.find(n,{oldId:l[u].replace("slot:","")});s[u]=`slot:${i._id}`}),j.omit(s,["global","oldId"])})};const I4=l1.atom([]);I4.debugLabel="presentBlocksAtom";const oL=l1.atom(t=>{const e=t(I4);return rL([...e])});oL.debugLabel="treeDSBlocks";I4.debugLabel="presentBlocksAtom";const Kr=ee1(I4);Kr.debugLabel="pageBlocksAtomsAtom";const du1=l1.atom("");du1.debugLabel="builderActivePageAtom";const hu1=l1.atom(-1);hu1.debugLabel="destinationDropIndexAtom";const sL=l1.atom([]);sL.debugLabel="buildingBlocksAtom";const vu1=l1.atom(t=>{const e=t(sL);return j.filter(e,c=>j.has(c,"blockId"))});vu1.debugLabel="globalBlocksAtom";const Jr=l1.atom([]);Jr.debugLabel="selectedBlockIdsAtom";const Yr=l1.atom(t=>{const e=t(I4),c=t(Jr);return j.map(j.filter(e,({_id:a})=>j.includes(c,a)),a=>({...a}))});Yr.debugLabel="selectedBlocksAtom";const de=l1.atom(t=>{const e=t(Yr);if(e.length===0)return null;if(e.length===1)return e[0]});de.debugLabel="selectedBlockAtom";const fu1=t=>j.get(t,"_parent",null),gu1=l1.atom(t=>{const e=t(Yr),c=j.map(e,fu1);return j.filter(t(I4),a=>j.includes(c,a._id))});gu1.debugLabel="selectedBlocksParentsAtom";const lL=l1.atom(()=>!1);lL.debugLabel="selectedBlockFlexChildAtom";const iL=l1.atom(()=>!1);iL.debugLabel="selectedBlockGridChildAtom";const Xr=l1.atom("");Xr.debugLabel="styleStateAtom";const uL=e4("styleBreakpoint","xs");uL.debugLabel="styleBreakpointAtom";const pu1=()=>({flexChild:l1.useAtomValue(lL),gridChild:l1.useAtomValue(iL)}),mu1=()=>l1.useAtomValue(de),zu1=l1.atom(t=>{const e=t(de),c=t(I4);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}),bu1=()=>l1.useAtomValue(zu1),Mu1=()=>{const t=bu1();return h.useMemo(()=>{for(let e=0;e<t.length;e++){const c=G3.getBlockComponent(t[e]._type),a=j.cloneDeep(j.get(c,"blockState",{}));if(!j.isEmpty(a))return{settings:a,block:t[e]}}return{}},[t])};const f3=()=>{const[t,e]=l1.useAtom(Jr),c=h.useCallback(a=>{e(r=>j.includes(r,a)?j.without(r,a):[...r,a])},[e]);return[t,e,c]},va=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(j.includes(["slot","styles"],o.type))return;const s=n;c[s]=va(o)}),c;case"list":const{itemProperties:a}=t,r={items:{}};return Object.keys(a).forEach(n=>{const o=a[n];if(j.includes(["slot","styles"],o.type))return;const s=n;r.items[s]=va(o)}),r;default:return{}}},fa=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(j.includes(["slot","styles"],l.type))return;const u=s;a.properties[u]=fa(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(j.includes(["slot","styles"],l.type))return;const u=s;o.items.properties[u]=fa(l),j.set(o.items,"title",j.get(l,"itemTitle",`${n} item`))}),o;default:return{}}},dL=t=>{if(!t)return{};const e={};return Object.keys(t).forEach(c=>{e[c]=Cu1(t[c])}),e},wu1=t=>{if(j.isEmpty(t.default))return[];const{itemProperties:e}=t;return j.map(t.default,c=>{const a={...c};return j.forIn(c,(r,n)=>{j.has(e,n)&&j.get(e[n],"i18n",!1)&&(a[n]=Y2.I18N_KEY)}),a})},Cu1=t=>{switch(t.type){case"styles":return t.default;case"slot":return`${Y2.SLOT_KEY}${W4.generateUUID()}`;case"singular":const{schema:e}=t;return j.get(e,"default","");case"model":return dL(t.properties);case"list":return wu1(t);default:return""}};const Vu1=(t,e)=>{const c={};return j.set(c,t,e),c};var Qr={exports:{}},bv1=Qr.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})()})(Qr);var Hu1=Qr.exports;const yu1=H4.getDefaultExportFromCjs(Hu1),xu1=l1.atom(Y2.BRANDING_OPTIONS_DEFAULTS),Lu1=l1.atom(null),he=()=>{const[t,e]=l1.useAtom(xu1);return[j.isObject(t)?{...Y2.BRANDING_OPTIONS_DEFAULTS,...t}:Y2.BRANDING_OPTIONS_DEFAULTS,e]},Iu1=()=>l1.useAtom(Lu1),Su1=l1.atom(null),hL=()=>({currentPage:l1.useAtomValue(Su1)});function vL(t){return rL(t)}const _r=(t,e)=>j.flatten(t.map(c=>{if(c=e?{...c,_parent:e}:{...c},c.children){const a=[...c.children];return delete c.children,j.flatten([c,..._r(a,c._id)])}return c}));function $r(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:j.get(a,"_parent",null),_id:a._id}:a.children&&a.children.length&&$r(a.children)}}function fL(t){let e=[],c=j.filter(t,{type:"GlobalBlock"});return c.length>0&&(c=j.map(c,gL),j.each(c,a=>{e=[...e,...Au1(a)]})),e}function Au1(t){let e=[];const c=j.get(j.first(t),"_parent",null);j.set(j.first(t),"_parent",null);const a=[flatToNestedInstance.convert(pL(t))];$r(a,!0);let r=_r(a,t[0]._id);return r=j.set(r,"0._parent",c),e=[...e,r,...fL(r)],e}function gL(t){const e=j.find(ga,{_id:t._id});if(!e)return[];const c=[e],a=j.filter(ga,{_parent:t._id});return a.length?j.flatten([...c,...j.flatten(j.map(a,gL))]):j.flatten(c)}const pL=t=>JSON.parse(JSON.stringify(t));let ga=[];function Fu1(t){ga=t;const e=vL(pL(t));$r(e);const c=_r(e,null),a=fL(c),r={};return j.each(a,n=>j.set(r,j.first(n).blockId,n)),[c,r]}const mL=()=>{const[t]=he(),{currentPage:e}=hL(),[c]=Q4();return h.useCallback(()=>{const a=j.map(c,n=>j.omit(n,["expanded","order","title","siblings","tempClasses"])),[r=[]]=Fu1(a);return{currentPage:e,blocks:r}},[t,e,c])},M2=(t,e=void 0)=>{const c=l1.useAtomValue(Ur);return j.get(c,t,e)},tn=l1.atom([]);tn.debugLabel="dataProvidersAtom";const en=()=>l1.useAtom(tn),k0=l1.atom("SAVED");k0.debugLabel="builderSaveStateAtom";const zL=()=>{const[t,e]=l1.useAtom(k0),c=M2("onSavePage",async u=>{}),a=M2("onSave",async u=>{}),r=M2("onSaveStateChange",j.noop),n=mL(),[o]=en(),[s]=he();return{savePage:sg.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}},D4=new yu1;D4.setLimit(50);const ve=()=>{const[,t]=l1.useAtom(k0),e=M2("onSaveStateChange",j.noop);return h.useEffect(()=>(D4.setCallback(()=>{t("UNSAVED"),e("UNSAVED")}),()=>{D4.setCallback(j.noop)}),[]),{add:D4.add,undo:D4.undo,redo:D4.redo,hasRedo:D4.hasRedo,hasUndo:D4.hasUndo,clear:D4.clear}},cn=(t,e)=>{const c=[],a=j.filter(t,r=>j.includes(e,r._id)||j.includes(e,r._parent)?(c.push(r._id),!1):!0);return j.isEmpty(c)?a:cn(a,c)},bL=()=>{const[t]=Q4(),[e,c]=f3(),{setNewBlocks:a}=S4();return h.useCallback(r=>{var o;const n=((o=j.find(t,{_id:r[0]}))==null?void 0:o._parent)||null;a(cn(t,r)),setTimeout(()=>c(n?[n]:[]),200)},[t,c,e])};function Bu1(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 Eu1(t){let e=[];return t.walk(c=>(delete c.model.children,e.push(c.model),!0)),e}function Qf(t,e){return t.first(c=>c.model._id===e)||null}function Ou1(t,e,c,a){const r=Qf(t,e),n=Qf(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 Pu1(t,e,c,a){if(!e)return t;c=c||"root";const n=new AS().parse({_id:"root",children:vL(t)});if(Ou1(n,e,c,a)){const o=Eu1(n),s=o.find(l=>l._id===e);return s&&(s._parent=c==="root"?null:c),o.shift(),o}return t}const Gu1=()=>{const[,t]=Q4();return{setNewBlocks:e=>{t(e)},addBlocks:(e,c,a)=>{t(r=>Bu1(r,e,c,a))},removeBlocks:e=>{t(c=>cn(c,e))},moveBlocks:(e,c,a)=>{t(r=>{let n=r;for(let o=0;o<e.length;o++)n=Pu1(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=j.find(e,{_id:r._id});return{...r,...j.omit(n,"_id")}}return r})})}}},Q4=()=>l1.useAtom(I4),S4=()=>{const{add:t}=ve(),[e]=Q4(),{setNewBlocks:c,addBlocks:a,removeBlocks:r,moveBlocks:n,updateBlocksProps:o}=Gu1();return{moveBlocks:(p,g,m)=>{const z=j.map(p,w=>{const C=e.find(A=>A._id===w)._parent||null,I=e.filter(A=>C?A._parent===C:!A._parent).map(A=>A._id).indexOf(w);return{_id:w,oldParent:C,oldPosition:I}}),b=z.find(({_id:w})=>w===p[0]);b&&b.oldParent===g&&b.oldPosition===m||(n(p,g,m),t({undo:()=>j.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(j.map(p,"_id")),redo:()=>a(p,g,m)})},removeBlocks:p=>{var b;const g=(b=j.first(p))==null?void 0:b._parent,z=e.filter(w=>g?w._parent===g:!w._parent).indexOf(j.first(p));r(j.map(p,"_id")),t({undo:()=>a(p,g,z),redo:()=>r(j.map(p,"_id"))})},updateBlocks:(p,g,m)=>{let z=[];if(m)z=j.map(p,b=>({_id:b,...m}));else{const b=j.keys(g);z=j.map(p,w=>{const V=e.find(H=>H._id===w),C={_id:w};return j.each(b,H=>C[H]=V[H]),C})}o(j.map(p,b=>({_id:b,...g}))),t({undo:()=>o(z),redo:()=>o(j.map(p,b=>({_id:b,...g})))})},updateBlocksRuntime:(p,g)=>{o(j.map(p,m=>({_id:m,...g})))},setNewBlocks:p=>{c(p),t({undo:()=>c(e),redo:()=>c(p)})},updateMultipleBlocksProps:p=>{let g=[];g=j.map(p,m=>{const z=j.keys(m),b=e.find(V=>V._id===m._id),w={};return j.each(z,V=>w[V]=b[V]),w}),o(p),t({undo:()=>o(g),redo:()=>o(p)})}}},ku1=()=>{const[t]=Q4(),[,e]=f3(),{addBlocks:c}=S4(),a=h.useCallback((n,o,s)=>{var v;for(let f=0;f<n.length;f++){const{_id:p}=n[f];n[f]._id=W4.generateUUID();const g=j.filter(n,{_parent:p});for(let m=0;m<g.length;m++)g[m]._parent=n[f]._id}const l=j.first(n);let u,i;return o&&(u=j.find(t,{_id:o}),n[0]._parent=o,i=o),!(u?ha(u==null?void 0:u._type,l._type):!0)&&u&&(n[0]._parent=u._parent,i=u._parent),c(n,i,s),e([(v=j.first(n))==null?void 0:v._id]),j.first(n)},[t,e]);return{addCoreBlock:h.useCallback((n,o,s)=>{if(j.has(n,"blocks")){const m=n.blocks;return a(m,o,s)}const l=W4.generateUUID(),u=dL(n.props),i=[];j.forIn(u,(m,z)=>{if(j.startsWith(m,Y2.SLOT_KEY)){const b=m.replace(Y2.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=j.find(t,{_id:o}),d._parent=o,f=o),!ha(v==null?void 0:v._type,d._type)&&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},$f=["xs","sm","md","lg","xl","2xl"];function Ru1(t,e){if(e===null)return"baseClasses";const c=e.mq;if(c==="xs"||e.dark||e.mod!=="")return"classes";let a="baseClasses",r=$f.indexOf(c);for(;r>0;){const n=$f[r-1];if(j.find(t,{mq:n,property:e.property})){a="classes";break}r--}return a}const tg=[];function Nu1(t="",e="",c=[]){t=t.trim().replace(/ +/g,"");let a=j.filter(j.map(t.split(" "),s1.constructClassObject),u=>!j.isNull(u)),r=j.filter(j.map(e.split(" "),s1.constructClassObject),u=>!j.isNull(u));r=j.filter(r,u=>!j.includes(tg,u.property));const n=[],o=[];j.each(c,u=>{const i=s1.constructClassObject(u),d=j.find(a,j.pick(i,["dark","mq","mod","property"]));if(d&&(a=j.filter(a,v=>v.fullCls!==(d==null?void 0:d.fullCls))),n.push(i),i.mq==="xs"&&!i.dark&&i.mod===""&&(r=j.filter(r,v=>v.property!==i.property)),Ru1(a,i)==="baseClasses"&&!j.includes(tg,i.property)){const v=j.find(r,j.pick(i,["property"]));d&&(r=j.filter(r,f=>f.fullCls!==(v==null?void 0:v.fullCls))),o.push({...i,fullCls:i.cls,mq:"xs"})}});const s=j.map(j.sortBy([...a,...n],u=>_f[u.mq]),"fullCls").join(" ");return`${j.map(j.sortBy([...r,...o],u=>_f[u.mq]),"fullCls").join(" ").trim()},${s.trim()}`.trim().replace(/ +/g,"")}const R0=l1.atom([]);R0.debugLabel="selectedStylingBlocksAtom";const ML=()=>l1.useAtom(R0),ju1=t=>{const e=t.replace(Y2.STYLES_KEY,"").split(",");return{baseClasses:e[0],classes:e[1]}},Tu1=l1.atom(null,(t,e,{blockIds:c,newClasses:a})=>{const r=j.filter(t(Kr),o=>c.includes(t(o)._id)),n=j.first(t(R0));return j.map(r,o=>{const s=t(o),l=j.get(s,n.prop,`${Y2.STYLES_KEY},`),{baseClasses:u,classes:i}=ju1(l);return{ids:[s._id],props:{[n.prop]:`${Y2.STYLES_KEY}${Nu1(i,u,a)}`}}})}),Du1=()=>{const t=l1.useSetAtom(Tu1),{updateBlocks:e,updateBlocksRuntime:c}=S4();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])},wL=()=>l1.useAtom(uL),CL=e4("canvasWidth",800),VL=l1.atom(t=>{const e=t(CL);return W4.getBreakpointValue(e).toLowerCase()}),qu1=()=>{const[t,e]=l1.useAtom(CL),c=l1.useAtomValue(VL),[a,r]=wL();return h.useEffect(()=>{a!=="xs"&&r(c)},[c,a,r]),[t,c,e]},Zu1=e4("canvasZoom",100),Wu1=()=>l1.useAtom(Zu1),HL=l1.atom([]),yL=()=>{const[t,e]=l1.useAtom(HL),c=l1.useSetAtom(an),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},an=l1.atom([]),Uu1=()=>{const[t,e]=l1.useAtom(an),c=l1.useSetAtom(HL),a=h.useCallback(r=>{e(r),c([])},[e,c]);return[t,a]},xL=e4("darkMode",!1),Ku1=()=>{const[t,e]=l1.useAtom(xL);return[t,e]},rn=()=>{const[t]=Q4(),[,e]=f3(),{addBlocks:c}=S4();return h.useCallback((a,r=null)=>{const n=[];j.each(a,o=>{const s=t.find(v=>v._id===o);r||(r=s._parent);const i=j.filter(t,v=>j.isString(r)?v._parent===r:!s._parent).indexOf(s)+1,d=uu1(t,o,r);c(d,r,i),n.push(j.get(d,"0._id",""))}),e(n)},[t,e])},Ju1=l1.atom([]),Yu1=()=>{const[t,e]=l1.useAtom(Ju1),c=h.useCallback(a=>{e(r=>j.includes(r,a)?j.without(r,a):[...r,a])},[e]);return[t,e,c]},Xu1=l1.atom(""),LL=()=>l1.useAtom(Xu1),Qu1=()=>{const t=l1.useAtomValue(I4);return h.useCallback((e,c)=>{const a=j.map(t,r=>(j.includes(e,j.get(r,"_id"))&&j.set(r,"_parent",c),r));console.log("newBlocks",a)},[t])},_u1=()=>{console.warn("usePasteBlocks is not implemented");const t=l1.useAtomValue(an),[e,c]=yL(),a=rn(),r=Qu1();return{canPaste:h.useMemo(()=>e.length>0||t.length>0,[t,e]),pasteBlocks:h.useCallback(o=>{j.isEmpty(t)?r(e,o):a(t,o),c(()=>[])},[e,t,a,r,c])}},$u1=l1.atom(!1),IL=()=>{const[t,e]=l1.useAtom($u1);return[t,e]},td1=l1.atom(null,(t,e,{blockIds:c,fullClasses:a})=>{const r=j.first(t(R0)),n=j.filter(t(Kr),o=>c.includes(t(o)._id));return j.map(n,o=>{const s=t(o),l=a;let{classes:u,baseClasses:i}=su1(j.get(s,r.prop,"styles:,"));return j.each(l,d=>{const v=d.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),f=new RegExp(`(^| )${v}($| )`,"g");u=u.replace(f," ").replace(/ +/g," ").trim();const p=j.first(d.split(":"));j.includes(["2xl","xl","lg","md","sm"],p)&&l.push(d.split(":").pop().trim())}),j.each(l,d=>{const v=new RegExp(`(^| )${d.replace("[","\\[").replace("]","\\]")}($| )`,"g");i=i.replace(v," ").replace(/ +/g," ").trim()}),{ids:[s._id],props:{[r.prop]:`${Y2.STYLES_KEY}${i},${u}`}}})}),ed1=()=>{const{updateBlocks:t}=S4(),e=l1.useSetAtom(td1);return h.useCallback((c,a)=>{const r=e({blockIds:c,fullClasses:a});t(c,r[0].props)},[e])},SL=l1.atom(t=>{const e=j.first(t(R0)),c=t(de);if(!e||e.blockId!==j.get(c,"_id",null))return[];const r=j.get(c,e.prop,`${Y2.STYLES_KEY},`).replace(Y2.STYLES_KEY,"").split(",").join(" ");return j.filter(j.map(r.trim().split(" "),s1.constructClassObject),n=>!j.isNull(n))}),cd1=()=>l1.useAtomValue(SL),eg={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},ad1=l1.atom(t=>{const e=t(VL),c=t(Xr),a=t(xL),r=rd1(e);let n=j.filter(t(SL),{mod:c});return j.startsWith(c,"_")||(n=j.filter(n,o=>r.includes(o.mq))),n=n.sort((o,s)=>eg[o.mq]-eg[s.mq]),a||(n=j.filter(n,{dark:!1})),n}),rd1=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},nd1=()=>l1.useAtomValue(ad1),od1=()=>l1.useAtom(Xr),sd1=()=>{const{updateBlocks:t}=S4();return h.useCallback((e,c,a)=>{t(e,c,a)},[t])},ld1=()=>{const{updateMultipleBlocksProps:t}=S4();return h.useCallback(e=>{t(e)},[t])},id1=()=>{const{updateBlocksRuntime:t}=S4();return h.useCallback(async(e,c,a=30)=>{const r=j.keys(j.omit(c,["_id"]));for(const n of r){const o=c[n];if(j.isString(o)){const s=j.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])},ud1=()=>{const{updateMultipleBlocksProps:t}=S4(),e=id1();return h.useCallback(async c=>{for(const a of c)await e(a._id,a);t(c)},[t])},dd1=()=>{const{updateBlocksRuntime:t}=S4();return h.useCallback((e,c)=>{t(e,c)},[t])},AL={name:"",props:{},modalProps:{},backdropClose:!0},hd1=l1.atom(AL),vd1=()=>{const[t,e]=l1.useAtom(hd1),c=h.useCallback((r,n={},o={})=>{e({name:r,props:n,modalProps:o})},[e]),a=h.useCallback((...r)=>{j.get(t,"props.onClose",()=>{})(...r),e(AL)},[e,t]);return{activeModal:t,openModal:c,closeModal:a}},fd1=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),l1.useAtomValue(I4)),FL=l1.atom(!1);FL.debugLabel="readOnlyModeAtom";const BL=l1.atom("online");BL.debugLabel="networkModeAtom";const EL=l1.atom(!1);EL.debugLabel="editLayerNameAtom";const gd1=l1.atom("");gd1.debugLabel="activeLanguageAtom";const pd1=l1.atom("");pd1.debugLabel="primaryLanguageAtom";const OL=l1.atom(null);OL.debugLabel="canvasIframeAtom";const PL=l1.atom("outline");PL.debugLabel="activePanelAtom";const GL=l1.atom("");GL.debugLabel="showPredefinedBlockCategoryAtom";const kL=l1.atom({undoCount:0,redoCount:0});kL.debugLabel="historyStatesAtom";const RL=l1.atom("");RL.debugLabel="inlineEditingActiveAtom";const NL=l1.atom(!1);NL.debugLabel="draggingFlagAtom";const jL=l1.atom("");jL.debugLabel="draggedBlockIdAtom";const TL=l1.atom(null);TL.debugLabel="treeRefAtom";const DL=l1.atom({});DL.debugLabel="canvasSettingsAtom";const fe=l1.atom(!1);fe.debugLabel="askAiActiveBlockAtom";const md1=l1.atom(!1);md1.debugLabel="codeEditorOpenAtom";const zd1=e4("codeEditorHeight",500);zd1.debugLabel="codeEditorHeightAtom";const bd1=()=>l1.useAtomValue(FL),Md1=l1.atom(""),wd1=l1.atom(null),Cd1=()=>l1.useAtom(Md1),Vd1=()=>l1.useAtom(wd1),Hd1=e4("selectedBreakpoints",["XS","MD","XL"]),yd1=()=>{const[t,e]=l1.useAtom(Hd1);return[t,e]},qL=()=>{const t=l1.useSetAtom(kL),{clear:e}=ve(),[,c]=f3(),[,a]=LL(),[,r]=ML(),[,n]=$2(fe);return()=>{c([]),r([]),a(""),e(),n(!1),t({undoCount:0,redoCount:0})}},xd1=()=>({data:M2("uiLibraries",[]),isLoading:!1}),Ld1=()=>{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]},ZL=k3.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"}}),WL=x.forwardRef(({className:t,variant:e,size:c,...a},r)=>L.jsxRuntimeExports.jsx(ig.Root,{ref:r,className:s1.cn(ZL({variant:e,size:c,className:t})),...a}));WL.displayName=ig.Root.displayName;const UL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Ac.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(Ac.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")})}));UL.displayName=Ac.Root.displayName;const ge=k3.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?ES.Slot:"button";return L.jsxRuntimeExports.jsx(o,{className:s1.cn(ge({variant:e,size:c,className:t})),ref:n,...r})});i3.displayName="Button";const KL=A3.Root,nn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(A3.Item,{ref:c,className:s1.cn("border-b",t),...e}));nn.displayName="AccordionItem";const on=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(A3.Header,{className:"flex",children:L.jsxRuntimeExports.jsxs(A3.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"})]})}));on.displayName=A3.Trigger.displayName;const sn=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsx(A3.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})}));sn.displayName=A3.Content.displayName;const Id1=k3.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"}}),JL=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx("div",{ref:a,role:"alert",className:s1.cn(Id1({variant:e}),t),...c}));JL.displayName="Alert";const YL=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}));YL.displayName="AlertTitle";const XL=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("text-sm [&_p]:leading-relaxed",t),...e}));XL.displayName="AlertDescription";const QL=k3.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"}}),Sd1=({className:t,variant:e,...c})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn(QL({variant:e}),t),...c}),_L=N2.Root,$L=N2.Trigger,tI=({className:t,...e})=>L.jsxRuntimeExports.jsx(N2.Portal,{className:s1.cn(t),...e});tI.displayName=N2.Portal.displayName;const eI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.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}));eI.displayName=N2.Overlay.displayName;const ln=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsxs(tI,{children:[L.jsxRuntimeExports.jsx(eI,{}),L.jsxRuntimeExports.jsx(N2.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})]}));ln.displayName=N2.Content.displayName;const un=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});un.displayName="AlertDialogHeader";const dn=({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});dn.displayName="AlertDialogFooter";const hn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.Title,{ref:c,className:s1.cn("text-lg font-semibold",t),...e}));hn.displayName=N2.Title.displayName;const vn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));vn.displayName=N2.Description.displayName;const fn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.Action,{ref:c,className:s1.cn(ge(),t),...e}));fn.displayName=N2.Action.displayName;const gn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(N2.Cancel,{ref:c,className:s1.cn(ge({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));gn.displayName=N2.Cancel.displayName;const pn=J1.Root,cI=J1.Trigger,aI=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});aI.displayName=J1.Portal.displayName;const rI=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}));rI.displayName=J1.Overlay.displayName;const pe=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(aI,{children:[L.jsxRuntimeExports.jsx(rI,{}),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"})]})]})]}));pe.displayName=J1.Content.displayName;const nI=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});nI.displayName="DialogHeader";const oI=({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});oI.displayName="DialogFooter";const sI=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}));sI.displayName=J1.Title.displayName;const lI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));lI.displayName=J1.Description.displayName;const iI=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}));iI.displayName="Card";const uI=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}));uI.displayName="CardHeader";const dI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("h3",{ref:c,className:s1.cn("font-semibold leading-none tracking-tight",t),...e}));dI.displayName="CardTitle";const hI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("p",{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));hI.displayName="CardDescription";const vI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn("p-6 pt-0",t),...e}));vI.displayName="CardContent";const fI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx("div",{ref:c,className:s1.cn(" flex items-center p-6 pt-0",t),...e}));fI.displayName="CardFooter";const gI=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}));gI.displayName="Input";const Ad1=k3.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),pI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(ug.Root,{ref:c,className:s1.cn(Ad1(),t),...e}));pI.displayName=ug.Root.displayName;const me=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}));me.displayName="Textarea";const mI=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(U2.Root,{ref:a,className:s1.cn("relative overflow-hidden",t),...c,children:[L.jsxRuntimeExports.jsx(U2.Viewport,{className:"h-full w-full rounded-[inherit]",children:e}),L.jsxRuntimeExports.jsx(mn,{}),L.jsxRuntimeExports.jsx(U2.Corner,{})]}));mI.displayName=U2.Root.displayName;const mn=x.forwardRef(({className:t,orientation:e="vertical",...c},a)=>L.jsxRuntimeExports.jsx(U2.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(U2.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));mn.displayName=U2.ScrollAreaScrollbar.displayName;const zI=R3.Root,zn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(R3.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}));zn.displayName=R3.List.displayName;const Ht=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(R3.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}));Ht.displayName=R3.Trigger.displayName;const yt=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(R3.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}));yt.displayName=R3.Content.displayName;const Fd1=H6.Portal,bI=H6.Provider,Bd1=H6.Root,Ed1=H6.Trigger,MI=x.forwardRef(({className:t,sideOffset:e=4,...c},a)=>L.jsxRuntimeExports.jsx(H6.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}));MI.displayName=H6.Content.displayName;const Od1=i0.Root,Pd1=i0.Trigger,wI=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(i0.Portal,{children:L.jsxRuntimeExports.jsx(i0.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})}));wI.displayName=i0.Content.displayName;const Gd1=U1.Menu,kd1=U1.Group,Rd1=U1.Portal,Nd1=U1.Sub,jd1=U1.RadioGroup,CI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(U1.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}));CI.displayName=U1.Root.displayName;const VI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(U1.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}));VI.displayName=U1.Trigger.displayName;const HI=x.forwardRef(({className:t,inset:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(U1.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"})]}));HI.displayName=U1.SubTrigger.displayName;const yI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(U1.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}));yI.displayName=U1.SubContent.displayName;const xI=x.forwardRef(({className:t,align:e="start",alignOffset:c=-4,sideOffset:a=8,...r},n)=>L.jsxRuntimeExports.jsx(U1.Portal,{children:L.jsxRuntimeExports.jsx(U1.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})}));xI.displayName=U1.Content.displayName;const LI=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(U1.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}));LI.displayName=U1.Item.displayName;const II=x.forwardRef(({className:t,children:e,checked:c,...a},r)=>L.jsxRuntimeExports.jsxs(U1.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(U1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.CheckIcon,{className:"h-4 w-4"})})}),e]}));II.displayName=U1.CheckboxItem.displayName;const SI=x.forwardRef(({className:t,children:e,...c},a)=>L.jsxRuntimeExports.jsxs(U1.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(U1.ItemIndicator,{children:L.jsxRuntimeExports.jsx(s2.DotFilledIcon,{className:"h-4 w-4 fill-current"})})}),e]}));SI.displayName=U1.RadioItem.displayName;const AI=x.forwardRef(({className:t,inset:e,...c},a)=>L.jsxRuntimeExports.jsx(U1.Label,{ref:a,className:s1.cn("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...c}));AI.displayName=U1.Label.displayName;const FI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(U1.Separator,{ref:c,className:s1.cn("-mx-1 my-1 h-px bg-muted",t),...e}));FI.displayName=U1.Separator.displayName;const BI=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});BI.displayname="MenubarShortcut";const Td1=Lt.Root,Dd1=Lt.Trigger,EI=x.forwardRef(({className:t,align:e="center",sideOffset:c=4,...a},r)=>L.jsxRuntimeExports.jsx(Lt.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}));EI.displayName=Lt.Content.displayName;const qd1=x2.Root,Zd1=x2.Group,Wd1=x2.Value,OI=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"})})]}));OI.displayName=x2.Trigger.displayName;const PI=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})})}));PI.displayName=x2.Content.displayName;const GI=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}));GI.displayName=x2.Label.displayName;const kI=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})]}));kI.displayName=x2.Item.displayName;const RI=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}));RI.displayName=x2.Separator.displayName;const Ud1=J1.Root,Kd1=J1.Trigger,Jd1=J1.Close,NI=({className:t,...e})=>L.jsxRuntimeExports.jsx(J1.Portal,{className:s1.cn(t),...e});NI.displayName=J1.Portal.displayName;const jI=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}));jI.displayName=J1.Overlay.displayName;const Yd1=k3.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"}}),TI=x.forwardRef(({side:t="right",className:e,children:c,...a},r)=>L.jsxRuntimeExports.jsxs(NI,{children:[L.jsxRuntimeExports.jsx(jI,{}),L.jsxRuntimeExports.jsxs(J1.Content,{ref:r,className:s1.cn(Yd1({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"})]})]})]}));TI.displayName=J1.Content.displayName;const DI=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("flex flex-col space-y-2 text-center sm:text-left",t),...e});DI.displayName="SheetHeader";const qI=({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});qI.displayName="SheetFooter";const ZI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Title,{ref:c,className:s1.cn("text-lg font-semibold text-foreground",t),...e}));ZI.displayName=J1.Title.displayName;const WI=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(J1.Description,{ref:c,className:s1.cn("text-sm text-muted-foreground",t),...e}));WI.displayName=J1.Description.displayName;const UI=_1.Root,KI=_1.Trigger,Xd1=_1.Group,Qd1=_1.Portal,_d1=_1.Sub,$d1=_1.RadioGroup,JI=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"})]}));JI.displayName=_1.SubTrigger.displayName;const YI=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}));YI.displayName=_1.SubContent.displayName;const bn=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})}));bn.displayName=_1.Content.displayName;const v6=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}));v6.displayName=_1.Item.displayName;const XI=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]}));XI.displayName=_1.CheckboxItem.displayName;const QI=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]}));QI.displayName=_1.RadioItem.displayName;const Mn=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}));Mn.displayName=_1.Label.displayName;const wn=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}));wn.displayName=_1.Separator.displayName;const _I=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest opacity-60",t),...e});_I.displayName="DropdownMenuShortcut";const $I=x.forwardRef(({className:t,orientation:e="horizontal",decorative:c=!0,...a},r)=>L.jsxRuntimeExports.jsx(dg.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}));$I.displayName=dg.Root.displayName;const th1=1,eh1=1e6;let Ic=0;function ch1(){return Ic=(Ic+1)%Number.MAX_VALUE,Ic.toString()}const Sc=new Map,cg=t=>{if(Sc.has(t))return;const e=setTimeout(()=>{Sc.delete(t),l0({type:"REMOVE_TOAST",toastId:t})},eh1);Sc.set(t,e)},tS=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,th1)};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?cg(c):t.toasts.forEach(a=>{cg(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)}}},D8=[];let q8={toasts:[]};function l0(t){q8=tS(q8,t),D8.forEach(e=>{e(q8)})}function eS({...t}){const e=ch1(),c=r=>l0({type:"UPDATE_TOAST",toast:{...r,id:e}}),a=()=>l0({type:"DISMISS_TOAST",toastId:e});return l0({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:r=>{r||a()}}}),{id:e,dismiss:a,update:c}}function Cn(){const[t,e]=x.useState(q8);return x.useEffect(()=>(D8.push(e),()=>{const c=D8.indexOf(e);c>-1&&D8.splice(c,1)}),[t]),{...t,toast:eS,dismiss:c=>l0({type:"DISMISS_TOAST",toastId:c})}}const ah1=u4.Provider,cS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.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}));cS.displayName=u4.Viewport.displayName;const rh1=k3.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"}}),aS=x.forwardRef(({className:t,variant:e,...c},a)=>L.jsxRuntimeExports.jsx(u4.Root,{ref:a,className:s1.cn(rh1({variant:e}),t),...c}));aS.displayName=u4.Root.displayName;const nh1=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.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}));nh1.displayName=u4.Action.displayName;const rS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.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"})}));rS.displayName=u4.Close.displayName;const nS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.Title,{ref:c,className:s1.cn("text-sm font-semibold [&+div]:text-xs",t),...e}));nS.displayName=u4.Title.displayName;const oS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(u4.Description,{ref:c,className:s1.cn("text-sm opacity-90",t),...e}));oS.displayName=u4.Description.displayName;function sS(){const{toasts:t}=Cn();return L.jsxRuntimeExports.jsxs(ah1,{children:[t.map(({id:e,title:c,description:a,action:r,...n})=>L.jsxRuntimeExports.jsxs(aS,{...n,children:[L.jsxRuntimeExports.jsxs("div",{className:"grid gap-1",children:[c&&L.jsxRuntimeExports.jsx(nS,{children:c}),a&&L.jsxRuntimeExports.jsx(oS,{children:a})]}),r,L.jsxRuntimeExports.jsx(rS,{})]},e)),L.jsxRuntimeExports.jsx(cS,{})]})}const Vn=({className:t,...e})=>L.jsxRuntimeExports.jsx("div",{className:s1.cn("animate-pulse rounded-md bg-primary/10",t),...e}),Hn=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.Command,{ref:c,className:s1.cn("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));Hn.displayName=Q2.Command.displayName;const oh1=({children:t,...e})=>L.jsxRuntimeExports.jsx(pn,{...e,children:L.jsxRuntimeExports.jsx(pe,{className:"overflow-hidden p-0",children:L.jsxRuntimeExports.jsx(Hn,{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})})}),lS=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(Q2.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})]}));lS.displayName=Q2.Command.Input.displayName;const iS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.Command.List,{ref:c,className:s1.cn("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));iS.displayName=Q2.Command.List.displayName;const uS=x.forwardRef((t,e)=>L.jsxRuntimeExports.jsx(Q2.Command.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));uS.displayName=Q2.Command.Empty.displayName;const dS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.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}));dS.displayName=Q2.Command.Group.displayName;const hS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.Command.Separator,{ref:c,className:s1.cn("-mx-1 h-px bg-border",t),...e}));hS.displayName=Q2.Command.Separator.displayName;const vS=x.forwardRef(({className:t,...e},c)=>L.jsxRuntimeExports.jsx(Q2.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}));vS.displayName=Q2.Command.Item.displayName;const fS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});fS.displayName="CommandShortcut";const sh1=$1.Root,lh1=$1.Trigger,ih1=$1.Group,uh1=$1.Portal,dh1=$1.Sub,hh1=$1.RadioGroup,gS=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"})]}));gS.displayName=$1.SubTrigger.displayName;const pS=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}));pS.displayName=$1.SubContent.displayName;const mS=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})}));mS.displayName=$1.Content.displayName;const zS=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}));zS.displayName=$1.Item.displayName;const bS=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]}));bS.displayName=$1.CheckboxItem.displayName;const MS=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]}));MS.displayName=$1.RadioItem.displayName;const wS=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}));wS.displayName=$1.Label.displayName;const CS=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}));CS.displayName=$1.Separator.displayName;const VS=({className:t,...e})=>L.jsxRuntimeExports.jsx("span",{className:s1.cn("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});VS.displayName="ContextMenuShortcut";const vh1=t=>{try{const e=document.getElementById("icon-picker-field"),c=document.createElement("div");pa.render(L.jsxRuntimeExports.jsx(lg.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),""}},fh1=({value:t,onChange:e})=>{const c=a=>{e("<svg />");const r=vh1(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(lg,{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"})]})},gh1=h.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-Kymq8i6b.cjs"))),ph1=h.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-WpaiIEbj.cjs"))),HS=({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(zI,{value:o,onValueChange:l=>s(l),className:"flex h-full w-full flex-col py-2",children:[!(r||n)&&L.jsxRuntimeExports.jsxs(zn,{className:"w-full",children:[L.jsxRuntimeExports.jsx(Ht,{value:"upload",className:"w-full",children:"Upload"}),L.jsxRuntimeExports.jsx(Ht,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),o==="unsplash"?L.jsxRuntimeExports.jsx(yt,{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(gh1,{isModalView:t,onSelect:e})})}):L.jsxRuntimeExports.jsx(yt,{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(ph1,{isModalView:t,onSelect:e})})})]})]})},mh1=Object.freeze(Object.defineProperty({__proto__:null,default:HS},Symbol.toStringTag,{value:"Module"})),ag=({children:t,onSelect:e})=>{const[c,a]=h.useState(!1),r=(...n)=>{e.call(void 0,...n),a(!1)};return L.jsxRuntimeExports.jsxs(pn,{open:c,onOpenChange:n=>a(n),children:[L.jsxRuntimeExports.jsx(cI,{asChild:!0,children:t}),L.jsxRuntimeExports.jsx(pe,{className:"flex h-3/4 max-w-5xl",children:L.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:L.jsxRuntimeExports.jsx(HS,{isModalView:!0,onSelect:r})})})]})},zh1=({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(ag,{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(ag,{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||!j.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)})]})]})},bh1=({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(JS,{id:t,value:c,onBlur:s=>r(t,s),onChange:s=>a(s),modules:n,formats:o,placeholder:e,className:"mt-1 rounded-md"})},Mh1=({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"}),j.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"})]})]})]})},wh1=()=>{const[t,e]=IL(),{t:c}=xt.useTranslation(),a=M2("previewComponent",null);return t?L.jsxRuntimeExports.jsxs("div",{className:W4.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(Vn,{className:"h-96 w-full"}),children:h.createElement(a)}):null})]}):null},Ch1=()=>{const[t,e]=f3(),c=bL(),a=rn(),{undo:r,redo:n}=ve();E6.useHotkeys("esc",()=>e([]),{},[e]),E6.useHotkeys("ctrl+d,command+d",()=>a(t),{preventDefault:!0},[t,a]),E6.useHotkeys("ctrl+z,command+z",()=>r(),{},[r]),E6.useHotkeys("ctrl+y,command+y",()=>n(),{},[n]),E6.useHotkeys("del, backspace",o=>{o.preventDefault(),c(t)},{},[t,c])},Vh1=(t,e)=>{const c=[];let a=j.find(t,{_id:e}),r=j.get(a,"_parent","");for(;j.isString(r)&&!j.isEmpty(r);)c.push(a==null?void 0:a._parent),a=j.find(t,{_id:r}),r=a==null?void 0:a._parent;return j.flatten(c)},Hh1=l1.atom([]),yh1=()=>{const[t]=f3(),e=l1.useAtomValue(I4),[,c]=l1.useAtom(Hh1);h.useEffect(()=>{let a=[];const r=j.first(t);j.isString(r)&&(a=[r,...Vh1(e,r)]),c(a)},[t,e,c])};const yS=()=>l1.useAtom(eL),xh1=()=>h.useMemo(()=>G3.getChaiDataProviders(),[]),Lh1=({children:t})=>{const[,e]=yS(),[c]=en(),a=xh1();return h.useEffect(()=>(e({}),j.each(c,r=>{const n=j.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})))}}),()=>{j.each(c,r=>{e(n=>(delete n[r.providerKey],n))})}),[a,c,e]),L.jsxRuntimeExports.jsx(L.jsxRuntimeExports.Fragment,{children:t})};function Ih1(t,e,c){c.push(j.find(t,{_id:e}));const a=j.filter(t,{_parent:e});for(const r of a)c.push(...xS(r._id,t));return c}const xS=(t,e)=>{let c=[];return c=j.flattenDeep([...c,...Ih1(e,t,c)]),c},Sh1=l1.atom(!1),yn=()=>{const[t,e]=l1.useAtom(Sh1),[c,a]=h.useState(null),r=M2("askAiCallBack",null),n=ud1(),o=ld1(),[s]=Q4();return{askAi:h.useCallback(async(l,u,i,d)=>{if(r){e(!0),a(null);try{const v=l==="content"?j.cloneDeep(xS(u,s)):[j.cloneDeep(s.find(g=>g._id===u))];j.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}};function Ah1(t){return M0.GenIcon({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"}}]})(t)}function Fh1(t){return M0.GenIcon({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 LS(t){return M0.GenIcon({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 Bh1(t){return M0.GenIcon({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 Eh1(t){return M0.GenIcon({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 Oh1=[{name:"Improve writing",icon:Eh1,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:Fh1,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:L3.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:L3.ShuffleIcon,prompt:"Randomize all text elements."}];function Ph1({onClick:t}){const{loading:e}=yn();return L.jsxRuntimeExports.jsx("div",{className:e?"pointer-events-none opacity-50":"",children:L.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:Oh1.map(({name:c,icon:a,subMenus:r,prompt:n})=>r?L.jsxRuntimeExports.jsxs(UI,{children:[L.jsxRuntimeExports.jsx(KI,{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(bn,{children:[L.jsxRuntimeExports.jsx(Mn,{children:"My Account"}),L.jsxRuntimeExports.jsx(wn,{}),L.jsxRuntimeExports.jsx(v6,{children:"Profile"}),L.jsxRuntimeExports.jsx(v6,{children:"Billing"}),L.jsxRuntimeExports.jsx(v6,{children:"Team"}),L.jsxRuntimeExports.jsx(v6,{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 Gh1=({blockId:t})=>{const{t:e}=xt.useTranslation(),{askAi:c,loading:a,error:r}=yn(),[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(me,{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(L3.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(Vn,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[L.jsxRuntimeExports.jsx(LS,{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(Ph1,{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(L3.SparklesIcon,{className:"mx-auto text-3xl"}),L.jsxRuntimeExports.jsx("h1",{children:e("no_block_selected_for_ask_ai")})]})})},kh1=({onOpen:t})=>{const{t:e}=xt.useTranslation(),c=M2("aiContext",""),[a,r]=h.useState(c),n=h.useRef(null),o=M2("saveAiContextCallback",j.noop),[s,l]=h.useState(!1),[u,i]=h.useState(null),[d,v]=h.useState(!1),{toast:f}=Cn(),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(KL,{onValueChange:m=>{t(m!==""),v(m!=="")},type:"single",collapsible:!0,className:"rounded-md border bg-gray-100 px-2",children:L.jsxRuntimeExports.jsxs(nn,{value:"set-context",children:[L.jsxRuntimeExports.jsx(on,{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(L3.EditIcon,{className:"h-4 w-4"})]})]})}),L.jsxRuntimeExports.jsxs(sn,{children:[L.jsxRuntimeExports.jsx(me,{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(L3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Save")}),c.trim().length>0?L.jsxRuntimeExports.jsxs(_L,{children:[L.jsxRuntimeExports.jsx($L,{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(L3.Loader,{className:"h-5 w-5 animate-spin"}),e("Generating... Please wait")]}):e("Delete")})}),L.jsxRuntimeExports.jsxs(ln,{children:[L.jsxRuntimeExports.jsxs(un,{children:[L.jsxRuntimeExports.jsx(hn,{children:e("Remove context?")}),L.jsxRuntimeExports.jsx(vn,{})]}),L.jsxRuntimeExports.jsxs(dn,{children:[L.jsxRuntimeExports.jsx(gn,{children:e("Cancel")}),L.jsxRuntimeExports.jsx(fn,{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})})]})]})})},Rh1=()=>{const[t]=f3(),[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(kh1,{onOpen:a=>c(a)}),e?null:L.jsxRuntimeExports.jsx(Gh1,{blockId:j.first(t)})]})},Nh1=h.lazy(()=>Promise.resolve().then(()=>require("./SidePanels-0w036NaZ.cjs"))),jh1=h.lazy(()=>Promise.resolve().then(()=>require("./Topbar-u5HAh7Mg.cjs"))),Th1=h.lazy(()=>Promise.resolve().then(()=>require("./CanvasArea-luy5nUGR.cjs"))),Dh1=h.lazy(()=>Promise.resolve().then(()=>require("./Settings-DclX-cDC.cjs"))),qh1=()=>{const{savePage:t}=zL(),e=M2("autoSaveSupport",!0),c=M2("autoSaveInterval",60);sg.useIntervalEffect(()=>{e&&t()},c*1e3)},Zh1=()=>{const[t]=l1.useAtom(k0),[e]=l1.useAtom(fe),c=n=>{ou1()||n.preventDefault()};Ch1(),yh1(),qh1(),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(bI,{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(jh1,{})})}),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(Nh1,{})})}),L.jsxRuntimeExports.jsx("div",{className:"h-full flex-1 bg-slate-800/20",children:L.jsxRuntimeExports.jsx(h.Suspense,{children:L.jsxRuntimeExports.jsx(Th1,{})})}),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(Dh1,{})}),e?L.jsxRuntimeExports.jsx(Rh1,{}):null]})]})]}),L.jsxRuntimeExports.jsx(wh1,{})]})})},rg=l1.getDefaultStore(),Wh1=()=>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 Uh1=!1;const Kh1=t=>{Uh1=t};const Jh1=t=>{const[,e]=Q4(),[,c]=he(),a=qL();return h.useEffect(()=>{rg.set(Ur,j.omit(t,["blocks","subPages","brandingOptions","dataProviders"]))},[t]),h.useEffect(()=>{rg.set(tn,t.dataProviders||[])},[t.dataProviders]),h.useEffect(()=>{e(G3.syncBlocksWithDefaults(t.blocks||[])),a()},[t.blocks]),h.useEffect(()=>{og.changeLanguage(t.locale||"en")},[t.locale]),h.useEffect(()=>{Kh1(t.showDebugLogs)},[t.showDebugLogs]),h.useEffect(()=>{c(t.brandingOptions)},[t.brandingOptions,c]),L.jsxRuntimeExports.jsx(Zh1,{})},Yh1=t=>{const e=t._flags||{};return L.jsxRuntimeExports.jsxs(cL,{children:[L.jsxRuntimeExports.jsxs(SS.FlagsProvider,{features:{...nu1,...e},children:[L.jsxRuntimeExports.jsx(cu1,{}),L.jsxRuntimeExports.jsx(Wh1,{}),L.jsxRuntimeExports.jsx(Jh1,{...t})]}),L.jsxRuntimeExports.jsx(sS,{})]})};exports.Accordion=KL;exports.AccordionContent=sn;exports.AccordionItem=nn;exports.AccordionTrigger=on;exports.Alert=JL;exports.AlertDescription=XL;exports.AlertDialog=_L;exports.AlertDialogAction=fn;exports.AlertDialogCancel=gn;exports.AlertDialogContent=ln;exports.AlertDialogDescription=vn;exports.AlertDialogFooter=dn;exports.AlertDialogHeader=un;exports.AlertDialogTitle=hn;exports.AlertDialogTrigger=$L;exports.AlertTitle=YL;exports.Badge=Sd1;exports.BlocksExternalDataProvider=Lh1;exports.Button=i3;exports.Card=iI;exports.CardContent=vI;exports.CardDescription=hI;exports.CardFooter=fI;exports.CardHeader=uI;exports.CardTitle=dI;exports.ChaiBuilderEditor=Yh1;exports.Command=Hn;exports.CommandDialog=oh1;exports.CommandEmpty=uS;exports.CommandGroup=dS;exports.CommandInput=lS;exports.CommandItem=vS;exports.CommandList=iS;exports.CommandSeparator=hS;exports.CommandShortcut=fS;exports.ContextMenu=sh1;exports.ContextMenuCheckboxItem=bS;exports.ContextMenuContent=mS;exports.ContextMenuGroup=ih1;exports.ContextMenuItem=zS;exports.ContextMenuLabel=wS;exports.ContextMenuPortal=uh1;exports.ContextMenuRadioGroup=hh1;exports.ContextMenuRadioItem=MS;exports.ContextMenuSeparator=CS;exports.ContextMenuShortcut=VS;exports.ContextMenuSub=dh1;exports.ContextMenuSubContent=pS;exports.ContextMenuSubTrigger=gS;exports.ContextMenuTrigger=lh1;exports.Dialog=pn;exports.DialogContent=pe;exports.DialogDescription=lI;exports.DialogFooter=oI;exports.DialogHeader=nI;exports.DialogTitle=sI;exports.DialogTrigger=cI;exports.DropdownMenu=UI;exports.DropdownMenuCheckboxItem=XI;exports.DropdownMenuContent=bn;exports.DropdownMenuGroup=Xd1;exports.DropdownMenuItem=v6;exports.DropdownMenuLabel=Mn;exports.DropdownMenuPortal=Qd1;exports.DropdownMenuRadioGroup=$d1;exports.DropdownMenuRadioItem=QI;exports.DropdownMenuSeparator=wn;exports.DropdownMenuShortcut=_I;exports.DropdownMenuSub=_d1;exports.DropdownMenuSubContent=YI;exports.DropdownMenuSubTrigger=JI;exports.DropdownMenuTrigger=KI;exports.ErrorBoundary=cL;exports.FaCircleCheck=Bh1;exports.FaMoon=Ah1;exports.FaSpinner=LS;exports.HoverCard=Td1;exports.HoverCardContent=EI;exports.HoverCardTrigger=Dd1;exports.IconPickerField=fh1;exports.ImagePickerField=zh1;exports.ImagesPanel=mh1;exports.Input=gI;exports.Label=pI;exports.LinkField=Mh1;exports.Menubar=CI;exports.MenubarCheckboxItem=II;exports.MenubarContent=xI;exports.MenubarGroup=kd1;exports.MenubarItem=LI;exports.MenubarLabel=AI;exports.MenubarMenu=Gd1;exports.MenubarPortal=Rd1;exports.MenubarRadioGroup=jd1;exports.MenubarRadioItem=SI;exports.MenubarSeparator=FI;exports.MenubarShortcut=BI;exports.MenubarSub=Nd1;exports.MenubarSubContent=yI;exports.MenubarSubTrigger=HI;exports.MenubarTrigger=VI;exports.Popover=Od1;exports.PopoverContent=wI;exports.PopoverTrigger=Pd1;exports.RichTextEditorField=bh1;exports.ScrollArea=mI;exports.ScrollBar=mn;exports.Select=qd1;exports.SelectContent=PI;exports.SelectGroup=Zd1;exports.SelectItem=kI;exports.SelectLabel=GI;exports.SelectSeparator=RI;exports.SelectTrigger=OI;exports.SelectValue=Wd1;exports.Separator=$I;exports.Sheet=Ud1;exports.SheetClose=Jd1;exports.SheetContent=TI;exports.SheetDescription=WI;exports.SheetFooter=qI;exports.SheetHeader=DI;exports.SheetTitle=ZI;exports.SheetTrigger=Kd1;exports.Skeleton=Vn;exports.Switch=UL;exports.Tabs=zI;exports.TabsContent=yt;exports.TabsList=zn;exports.TabsTrigger=Ht;exports.Textarea=me;exports.Toaster=sS;exports.Toggle=WL;exports.Tooltip=Bd1;exports.TooltipContent=MI;exports.TooltipPortal=Fd1;exports.TooltipProvider=bI;exports.TooltipTrigger=Ed1;exports.activePanelAtom=PL;exports.aiAssistantActiveAtom=fe;exports.atomWithStorage=e4;exports.badgeVariants=QL;exports.builderSaveStateAtom=k0;exports.buttonVariants=ge;exports.canAcceptChildBlock=ha;exports.canDeleteBlock=iu1;exports.canDuplicateBlock=lu1;exports.canvasIframeAtom=OL;exports.canvasSettingsAtom=DL;exports.convertDotNotationToObject=Vu1;exports.draggedBlockIdAtom=jL;exports.draggingFlagAtom=NL;exports.editLayerNameAtom=EL;exports.getBlockJSONFromSchemas=fa;exports.getBlockJSONFromUISchemas=va;exports.inlineEditingActiveAtom=RL;exports.networkModeAtom=BL;exports.reducer=tS;exports.showPredefinedBlockCategoryAtom=GL;exports.toast=eS;exports.toggleVariants=ZL;exports.treeDSBlocks=oL;exports.treeRefAtom=TL;exports.useActiveModal=vd1;exports.useActivePanel=Cd1;exports.useAddBlock=ku1;exports.useAddBlockParent=Vd1;exports.useAddClassesToBlocks=Du1;exports.useAllBlocks=fd1;exports.useAskAi=yn;exports.useBlocksContainer=Iu1;exports.useBlocksStore=Q4;exports.useBlocksStoreUndoableActions=S4;exports.useBrandingOptions=he;exports.useBuilderProp=M2;exports.useBuilderReset=qL;exports.useCanvasWidth=qu1;exports.useCanvasZoom=Wu1;exports.useChaiExternalData=yS;exports.useCopyBlockIds=Uu1;exports.useCopyToClipboard=Ld1;exports.useCurrentPage=hL;exports.useCutBlockIds=yL;exports.useDarkMode=Ku1;exports.useDuplicateBlocks=rn;exports.useGetPageData=mL;exports.useHiddenBlockIds=Yu1;exports.useHighlightBlockId=LL;exports.usePageDataProviders=en;exports.usePasteBlocks=_u1;exports.usePreviewMode=IL;exports.useReadOnlyMode=bd1;exports.useRemoveBlocks=bL;exports.useRemoveClassesFromBlocks=ed1;exports.useSavePage=zL;exports.useSelectedBlock=mu1;exports.useSelectedBlockAllClasses=cd1;exports.useSelectedBlockCanvasSetting=Mu1;exports.useSelectedBlockCurrentClasses=nd1;exports.useSelectedBlockIds=f3;exports.useSelectedBlocksDisplayChild=pu1;exports.useSelectedBreakpoints=yd1;exports.useSelectedStylingBlocks=ML;exports.useStylingBreakpoint=wL;exports.useStylingState=od1;exports.useToast=Cn;exports.useUILibraryBlocks=xd1;exports.useUndoManager=ve;exports.useUpdateBlocksProps=sd1;exports.useUpdateBlocksPropsRealtime=dd1;
|
|
@@ -42140,7 +42140,7 @@ const bh1 = (t) => {
|
|
|
42140
42140
|
}
|
|
42141
42141
|
)
|
|
42142
42142
|
] });
|
|
42143
|
-
}, Mh1 = m.lazy(() => import("./UnsplashImages-
|
|
42143
|
+
}, Mh1 = m.lazy(() => import("./UnsplashImages-dhU2-pHY.js")), wh1 = m.lazy(() => import("./UploadImages-dr_gpAea.js")), LS = ({
|
|
42144
42144
|
isModalView: t = !1,
|
|
42145
42145
|
onSelect: e = () => {
|
|
42146
42146
|
}
|
|
@@ -42244,24 +42244,16 @@ const bh1 = (t) => {
|
|
|
42244
42244
|
{ const: "telephone", title: "Call Phone" },
|
|
42245
42245
|
{ const: "scroll", title: "Scroll to element" }
|
|
42246
42246
|
].map((u) => /* @__PURE__ */ L.jsx("option", { value: u.const, children: u.title }, u.const)) }),
|
|
42247
|
-
o === "page" ? /* @__PURE__ */ L.jsxs(
|
|
42248
|
-
"
|
|
42249
|
-
{
|
|
42250
|
-
|
|
42251
|
-
value: s,
|
|
42252
|
-
onChange: (u) => c({ ...e, href: u.target.value }),
|
|
42253
|
-
children: [
|
|
42254
|
-
/* @__PURE__ */ L.jsx("option", { value: "", children: "Choose page" }),
|
|
42255
|
-
c2(a, (u) => /* @__PURE__ */ L.jsx("option", { value: u.slug, children: u.name }, u.uuid))
|
|
42256
|
-
]
|
|
42257
|
-
}
|
|
42258
|
-
) : /* @__PURE__ */ L.jsx(
|
|
42247
|
+
o === "page" ? /* @__PURE__ */ L.jsxs("select", { name: "href", value: s, onChange: (u) => c({ ...e, href: u.target.value || "#" }), children: [
|
|
42248
|
+
/* @__PURE__ */ L.jsx("option", { value: "", children: "Choose page" }),
|
|
42249
|
+
c2(a, (u) => /* @__PURE__ */ L.jsx("option", { value: u.slug, children: u.name }, u.uuid))
|
|
42250
|
+
] }) : /* @__PURE__ */ L.jsx(
|
|
42259
42251
|
"input",
|
|
42260
42252
|
{
|
|
42261
42253
|
name: "href",
|
|
42262
42254
|
type: "text",
|
|
42263
42255
|
value: s,
|
|
42264
|
-
onChange: (u) => c({ ...e, href: u.target.value }),
|
|
42256
|
+
onChange: (u) => c({ ...e, href: u.target.value || "#" }),
|
|
42265
42257
|
placeholder: o === "page" || o === "url" ? "Enter URL" : o === "scroll" ? "#ElementID" : "Enter detail"
|
|
42266
42258
|
}
|
|
42267
42259
|
),
|
|
@@ -42623,7 +42615,7 @@ const Ih1 = ({ blockId: t }) => {
|
|
|
42623
42615
|
/* @__PURE__ */ L.jsx(Rh1, { onOpen: (a) => c(a) }),
|
|
42624
42616
|
e ? null : /* @__PURE__ */ L.jsx(Ih1, { blockId: e4(t) })
|
|
42625
42617
|
] });
|
|
42626
|
-
}, Th1 = _t(() => import("./SidePanels-
|
|
42618
|
+
}, Th1 = _t(() => import("./SidePanels-TOHaLWC6.js")), jh1 = _t(() => import("./Topbar-Rh7dWuJD.js")), Dh1 = _t(() => import("./CanvasArea-mhINqS0c.js")), qh1 = _t(() => import("./Settings-zm-cF9rZ.js")), Zh1 = () => {
|
|
42627
42619
|
const { savePage: t } = Yi1(), e = B2("autoSaveSupport", !0), c = B2("autoSaveInterval", 60);
|
|
42628
42620
|
$S(() => {
|
|
42629
42621
|
e && t();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as t } from "./jsx-runtime-WbnYoNE9.js";
|
|
2
2
|
import h from "@monaco-editor/react";
|
|
3
|
-
import { K as b, P as k, Q as C, B as j } from "./ChaiBuilderEditor-
|
|
3
|
+
import { K as b, P as k, Q as C, B as j } from "./ChaiBuilderEditor-KEwDa8Bl.js";
|
|
4
4
|
import { useTranslation as g } from "react-i18next";
|
|
5
5
|
import { useState as l, useCallback as a, useEffect as v } from "react";
|
|
6
|
-
import { a as y } from "./useCodeEditor-
|
|
6
|
+
import { a as y } from "./useCodeEditor-2KOfsFsx.js";
|
|
7
7
|
import { Cross2Icon as N } from "@radix-ui/react-icons";
|
|
8
8
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
9
9
|
import "clsx";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),j=require("@monaco-editor/react"),i=require("./ChaiBuilderEditor-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),j=require("@monaco-editor/react"),i=require("./ChaiBuilderEditor-H173PF4T.cjs"),f=require("react-i18next"),t=require("react"),b=require("./useCodeEditor-gE1NWoNH.cjs"),h=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("react-dom");require("@radix-ui/react-scroll-area");require("@floating-ui/react-dom");require("jotai");require("i18next");require("flagged");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("./Functions-N3yhPYKY.cjs");require("tailwind-merge");require("@chaibuilder/runtime");require("@react-hookz/web");require("tree-model");require("./utils-D_vtk3zK.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-quill");require("react-hotkeys-hook");require("lucide-react");require("./index-ecnGWzh9.cjs");function C(){const{t:o}=f.useTranslation(),[n,a]=t.useState(!1),[u,d]=t.useState(""),[r,l]=b.useCodeEditor(),[c]=i.useSelectedBlockIds(),q=i.useUpdateBlocksProps(),x=i.useUpdateBlocksPropsRealtime(),m=t.useCallback(s=>{x([r.blockId],{[r.blockProp]:s})},[]),p=t.useCallback(()=>{n&&q([r.blockId],{[r.blockProp]:u})},[n,u]);return t.useEffect(()=>{c.includes(r==null?void 0:r.blockId)||(p(),l(null))},[c]),e.jsxRuntimeExports.jsx("div",{className:"h-full rounded-t-lg border-t-4 border-black bg-black text-white",children:e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"-mt-1 flex items-center justify-between px-2 py-2",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:o("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:o("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>l(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(h.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx(j,{onMount:s=>{console.log(s,u),s.setValue(r.initialCode)},onChange:s=>{console.log(s),a(!0),d(s),m(s)},height:"100%",defaultLanguage:"html",theme:"vs-dark",defaultValue:"",options:{minimap:{enabled:!1}}})]})})}exports.default=C;
|