@chaibuilder/sdk 1.2.89 → 1.2.90

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.
@@ -1,4 +1,4 @@
1
- "use strict";var dt=Object.defineProperty;var pt=(r,n,o)=>n in r?dt(r,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[n]=o;var De=(r,n,o)=>(pt(r,typeof n!="symbol"?n+"":n,o),o);const jsxRuntime=require("./jsx-runtime-JYMCiFoE.cjs"),React=require("react"),contextMenu=require("./context-menu--DZnHfxj.cjs"),lodashEs=require("lodash-es"),jotai=require("jotai"),iconBase=require("./iconBase-vJD0OXxU.cjs"),runtime=require("@chaibuilder/runtime"),reactI18next=require("react-i18next"),plugin=require("./plugin-_F-KZp1i.cjs"),web=require("@react-hookz/web"),TreeModel=require("tree-model"),ReactQuill=require("react-quill"),STRINGS=require("./STRINGS-Yl7cSWDc.cjs"),flagged=require("flagged"),reactHotkeysHook=require("react-hotkeys-hook"),dom=require("@floating-ui/dom"),reactDom=require("@floating-ui/react-dom"),reactIcons=require("@radix-ui/react-icons"),reactEventHook=require("react-event-hook"),typography$1=require("@tailwindcss/typography"),forms=require("@tailwindcss/forms"),aspectRatio=require("@tailwindcss/aspect-ratio"),getPalette=require("tailwindcss-palette-generator"),tailwindMerge=require("tailwind-merge"),reactWrapBalancer=require("react-wrap-balancer"),ReactDOM=require("react-dom"),PropTypes=require("prop-types"),reactErrorBoundary=require("react-error-boundary"),reResizable=require("re-resizable"),lucideReact=require("lucide-react"),validator=require("@rjsf/validator-ajv8"),Form=require("@rjsf/core"),reactArborist=require("react-arborist"),himalaya=require("himalaya"),IconPicker=require("react-icons-picker"),Autosuggest=require("react-autosuggest"),Fuse=require("fuse.js"),clsx=require("clsx"),i18n=require("i18next"),ScrollAreaPrimitive=require("@radix-ui/react-scroll-area"),framerMotion=require("framer-motion");function _interopNamespaceDefault(r){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(n,o,a.get?a:{enumerable:!0,get:()=>r[o]})}}return n.default=r,Object.freeze(n)}const React__namespace=_interopNamespaceDefault(React),ScrollAreaPrimitive__namespace=_interopNamespaceDefault(ScrollAreaPrimitive),canAcceptChildBlock=(r,n)=>{if(!r)return!0;const o=runtime.getBlockComponent(r);return o&&lodashEs.has(o,"canAcceptBlock")?o.canAcceptBlock(n):!1},canAddChildBlock=r=>{const n=runtime.getBlockComponent(r);return n?lodashEs.has(n,"canAcceptBlock"):!1},canBeNestedInside=(r,n)=>{const o=runtime.getBlockComponent(n);return o&&lodashEs.has(o,"canBeNested")?o.canBeNested(r):!0},canDuplicateBlock=r=>{const n=runtime.getBlockComponent(r);return n&&lodashEs.has(n,"canDuplicate")?n.canDuplicate():!0},canDeleteBlock=r=>{const n=runtime.getBlockComponent(r);return n&&lodashEs.has(n,"canDelete")?n.canDelete():!0};var define_import_meta_env_default$2={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};let keyCount=0;function atom(r,n){const o=`atom${++keyCount}`,a={toString:()=>o};return typeof r=="function"?a.read=r:(a.init=r,a.read=i=>i(a),a.write=(i,l,c)=>l(a,typeof c=="function"?c(i(a)):c)),n&&(a.write=n),a}const hasInitialValue=r=>"init"in r,isActuallyWritableAtom=r=>!!r.write,cancelPromiseMap=new WeakMap,registerCancelPromise=(r,n)=>{cancelPromiseMap.set(r,n),r.catch(()=>{}).finally(()=>cancelPromiseMap.delete(r))},cancelPromise=(r,n)=>{const o=cancelPromiseMap.get(r);o&&(cancelPromiseMap.delete(r),o(n))},resolvePromise=(r,n)=>{r.status="fulfilled",r.value=n},rejectPromise=(r,n)=>{r.status="rejected",r.reason=n},isPromiseLike$2=r=>typeof(r==null?void 0:r.then)=="function",isEqualAtomValue=(r,n)=>"v"in r&&"v"in n&&Object.is(r.v,n.v),isEqualAtomError=(r,n)=>"e"in r&&"e"in n&&Object.is(r.e,n.e),hasPromiseAtomValue=r=>"v"in r&&r.v instanceof Promise,isEqualPromiseAtomValue=(r,n)=>"v"in r&&"v"in n&&r.v.orig&&r.v.orig===n.v.orig,returnAtomValue=r=>{if("e"in r)throw r.e;return r.v},createStore=()=>{const r=new WeakMap,n=new WeakMap,o=new Map;let a,i,l;(define_import_meta_env_default$2?"production":void 0)!=="production"&&(a=new Set,i=new Set,l=new Set);const c=j=>r.get(j),u=(j,I)=>{(define_import_meta_env_default$2?"production":void 0)!=="production"&&Object.freeze(I);const P=r.get(j);if(r.set(j,I),o.has(j)||o.set(j,P),P&&hasPromiseAtomValue(P)){const O="v"in I?I.v instanceof Promise?I.v:Promise.resolve(I.v):Promise.reject(I.e);cancelPromise(P.v,O)}},d=(j,I,P)=>{const O=new Map;let B=!1;P.forEach((N,F)=>{!N&&F===j&&(N=I),N?(O.set(F,N),I.d.get(F)!==N&&(B=!0)):(define_import_meta_env_default$2?"production":void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(B||I.d.size!==O.size)&&(I.d=O)},p=(j,I,P)=>{const O=c(j),B={d:(O==null?void 0:O.d)||new Map,v:I};if(P&&d(j,B,P),O&&isEqualAtomValue(O,B)&&O.d===B.d)return O;if(O&&hasPromiseAtomValue(O)&&hasPromiseAtomValue(B)&&isEqualPromiseAtomValue(O,B)){if(O.d===B.d)return O;B.v=O.v}return u(j,B),B},f=(j,I,P,O)=>{if(isPromiseLike$2(I)){let B;const N=new Promise((F,H)=>{let V=!1;I.then(D=>{if(!V){V=!0;const z=c(j),Z=p(j,N,P);resolvePromise(N,D),F(D),(z==null?void 0:z.d)!==Z.d&&A(j,Z,z==null?void 0:z.d)}},D=>{if(!V){V=!0;const z=c(j),Z=p(j,N,P);rejectPromise(N,D),H(D),(z==null?void 0:z.d)!==Z.d&&A(j,Z,z==null?void 0:z.d)}}),B=D=>{V||(V=!0,D.then(z=>resolvePromise(N,z),z=>rejectPromise(N,z)),F(D))}});return N.orig=I,N.status="pending",registerCancelPromise(N,F=>{F&&B(F),O==null||O()}),p(j,N,P)}return p(j,I,P)},m=(j,I,P)=>{const O=c(j),B={d:(O==null?void 0:O.d)||new Map,e:I};return P&&d(j,B,P),O&&isEqualAtomError(O,B)&&O.d===B.d?O:(u(j,B),B)},h=j=>{const I=c(j);if(I&&(I.d.forEach((V,D)=>{D!==j&&!n.has(D)&&h(D)}),Array.from(I.d).every(([V,D])=>{const z=c(V);return V===j||z===D||z&&!hasPromiseAtomValue(z)&&isEqualAtomValue(z,D)})))return I;const P=new Map;let O=!0;const B=V=>{if(V===j){const z=c(V);if(z)return P.set(V,z),returnAtomValue(z);if(hasInitialValue(V))return P.set(V,void 0),V.init;throw new Error("no atom init")}const D=h(V);return P.set(V,D),returnAtomValue(D)};let N,F;const H={get signal(){return N||(N=new AbortController),N.signal},get setSelf(){return(define_import_meta_env_default$2?"production":void 0)!=="production"&&!isActuallyWritableAtom(j)&&console.warn("setSelf function cannot be used with read-only atom"),!F&&isActuallyWritableAtom(j)&&(F=(...V)=>{if((define_import_meta_env_default$2?"production":void 0)!=="production"&&O&&console.warn("setSelf function cannot be called in sync"),!O)return S(j,...V)}),F}};try{const V=j.read(B,H);return f(j,V,P,()=>N==null?void 0:N.abort())}catch(V){return m(j,V,P)}finally{O=!1}},g=j=>returnAtomValue(h(j)),y=j=>{let I=n.get(j);return I||(I=w(j)),I},b=(j,I)=>!I.l.size&&(!I.t.size||I.t.size===1&&I.t.has(j)),v=j=>{const I=n.get(j);I&&b(j,I)&&R(j)},x=j=>{const I=new Map,P=new WeakMap,O=N=>{const F=n.get(N);F==null||F.t.forEach(H=>{H!==N&&(I.set(H,(I.get(H)||new Set).add(N)),P.set(H,(P.get(H)||0)+1),O(H))})};O(j);const B=N=>{const F=n.get(N);F==null||F.t.forEach(H=>{var V;if(H!==N){let D=P.get(H);if(D&&P.set(H,--D),!D){let z=!!((V=I.get(H))!=null&&V.size);if(z){const Z=c(H),Q=h(H);z=!Z||!isEqualAtomValue(Z,Q)}z||I.forEach(Z=>Z.delete(H))}B(H)}})};B(j)},E=(j,...I)=>{let P=!0;const O=F=>returnAtomValue(h(F)),B=(F,...H)=>{let V;if(F===j){if(!hasInitialValue(F))throw new Error("atom not writable");const D=c(F),z=f(F,H[0]);(!D||!isEqualAtomValue(D,z))&&x(F)}else V=E(F,...H);if(!P){const D=C();(define_import_meta_env_default$2?"production":void 0)!=="production"&&i.forEach(z=>z({type:"async-write",flushed:D}))}return V},N=j.write(O,B,...I);return P=!1,N},S=(j,...I)=>{const P=E(j,...I),O=C();return(define_import_meta_env_default$2?"production":void 0)!=="production"&&i.forEach(B=>B({type:"write",flushed:O})),P},w=(j,I)=>{const P={t:new Set(I&&[I]),l:new Set};if(n.set(j,P),(define_import_meta_env_default$2?"production":void 0)!=="production"&&l.add(j),h(j).d.forEach((O,B)=>{const N=n.get(B);N?N.t.add(j):B!==j&&w(B,j)}),h(j),isActuallyWritableAtom(j)&&j.onMount){const O=j.onMount((...B)=>S(j,...B));O&&(P.u=O)}return P},R=j=>{var I;const P=(I=n.get(j))==null?void 0:I.u;P&&P(),n.delete(j),(define_import_meta_env_default$2?"production":void 0)!=="production"&&l.delete(j);const O=c(j);O?(hasPromiseAtomValue(O)&&cancelPromise(O.v),O.d.forEach((B,N)=>{if(N!==j){const F=n.get(N);F&&(F.t.delete(j),b(N,F)&&R(N))}})):(define_import_meta_env_default$2?"production":void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",j)},A=(j,I,P)=>{const O=new Set(I.d.keys());P==null||P.forEach((B,N)=>{if(O.has(N)){O.delete(N);return}const F=n.get(N);F&&(F.t.delete(j),b(N,F)&&R(N))}),O.forEach(B=>{const N=n.get(B);N?N.t.add(j):n.has(j)&&w(B,j)})},C=()=>{let j;for((define_import_meta_env_default$2?"production":void 0)!=="production"&&(j=new Set);o.size;){const I=Array.from(o);o.clear(),I.forEach(([P,O])=>{const B=c(P);if(B){B.d!==(O==null?void 0:O.d)&&A(P,B,O==null?void 0:O.d);const N=n.get(P);N&&!(O&&!hasPromiseAtomValue(O)&&(isEqualAtomValue(O,B)||isEqualAtomError(O,B)))&&(N.l.forEach(F=>F()),(define_import_meta_env_default$2?"production":void 0)!=="production"&&j.add(P))}else(define_import_meta_env_default$2?"production":void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if((define_import_meta_env_default$2?"production":void 0)!=="production")return a.forEach(I=>I("state")),j},k=(j,I)=>{const P=y(j),O=C(),B=P.l;return B.add(I),(define_import_meta_env_default$2?"production":void 0)!=="production"&&(a.forEach(N=>N("sub")),i.forEach(N=>N({type:"sub",flushed:O}))),()=>{B.delete(I),v(j),(define_import_meta_env_default$2?"production":void 0)!=="production"&&(a.forEach(N=>N("unsub")),i.forEach(N=>N({type:"unsub"})))}};return(define_import_meta_env_default$2?"production":void 0)!=="production"?{get:g,set:S,sub:k,dev_subscribe_store:(j,I)=>I!==2?(console.warn("The current StoreListener revision is 2. The older ones are deprecated."),a.add(j),()=>{a.delete(j)}):(i.add(j),()=>{i.delete(j)}),dev_get_mounted_atoms:()=>l.values(),dev_get_atom_state:j=>r.get(j),dev_get_mounted:j=>n.get(j),dev_restore_atoms:j=>{for(const[P,O]of j)hasInitialValue(P)&&(f(P,O),x(P));const I=C();i.forEach(P=>P({type:"restore",flushed:I}))}}:{get:g,set:S,sub:k}};let defaultStore;const getDefaultStore=()=>(defaultStore||(defaultStore=createStore()),defaultStore);var define_import_meta_env_default$1={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const RESET=Symbol(),getCached$1=(r,n,o)=>(n.has(o)?n:n.set(o,r())).get(o),cache1$2=new WeakMap,memo2$1=(r,n,o)=>{const a=getCached$1(()=>new WeakMap,cache1$2,n);return getCached$1(r,a,o)},cacheKeyForEmptyKeyExtractor={},isWritable=r=>!!r.write,isFunction$1=r=>typeof r=="function";function splitAtom(r,n){return memo2$1(()=>{const o=new WeakMap,a=(c,u)=>{let d=o.get(c);if(d)return d;const p=u&&o.get(u),f=[],m=[];return c.forEach((h,g)=>{const y=n?n(h):g;m[g]=y;const b=p&&p.atomList[p.keyList.indexOf(y)];if(b){f[g]=b;return}const v=E=>{const S=E(i),w=E(r),A=a(w,S==null?void 0:S.arr).keyList.indexOf(y);if(A<0||A>=w.length){const C=c[a(c).keyList.indexOf(y)];if(C)return C;throw new Error("splitAtom: index out of bounds for read")}return w[A]},x=(E,S,w)=>{const R=E(i),A=E(r),k=a(A,R==null?void 0:R.arr).keyList.indexOf(y);if(k<0||k>=A.length)throw new Error("splitAtom: index out of bounds for write");const j=isFunction$1(w)?w(A[k]):w;S(r,[...A.slice(0,k),j,...A.slice(k+1)])};f[g]=isWritable(r)?atom(v,x):atom(v)}),p&&p.keyList.length===m.length&&p.keyList.every((h,g)=>h===m[g])?d=p:d={arr:c,atomList:f,keyList:m},o.set(c,d),d},i=atom(c=>{const u=c(i),d=c(r);return a(d,u==null?void 0:u.arr)});(define_import_meta_env_default$1?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.init=void 0;const l=isWritable(r)?atom(c=>c(i).atomList,(c,u,d)=>{switch(d.type){case"remove":{const p=c(l).indexOf(d.atom);if(p>=0){const f=c(r);u(r,[...f.slice(0,p),...f.slice(p+1)])}break}case"insert":{const p=d.before?c(l).indexOf(d.before):c(l).length;if(p>=0){const f=c(r);u(r,[...f.slice(0,p),d.value,...f.slice(p)])}break}case"move":{const p=c(l).indexOf(d.atom),f=d.before?c(l).indexOf(d.before):c(l).length;if(p>=0&&f>=0){const m=c(r);p<f?u(r,[...m.slice(0,p),...m.slice(p+1,f),m[p],...m.slice(f)]):u(r,[...m.slice(0,f),m[p],...m.slice(f,p),...m.slice(p+1)])}break}}}):atom(c=>c(i).atomList);return l},r,n||cacheKeyForEmptyKeyExtractor)}function atomWithDefault(r){const n=Symbol(),o=atom(n);(define_import_meta_env_default$1?"production":void 0)!=="production"&&(o.debugPrivate=!0);const a=atom((i,l)=>{const c=i(o);return c!==n?c:r(i,l)},(i,l,c)=>{if(c===RESET)l(o,n);else if(typeof c=="function"){const u=i(a);l(o,c(u))}else l(o,c)});return a}const isPromiseLike$1=r=>typeof(r==null?void 0:r.then)=="function";function createJSONStorage(r){let n,o;const a={getItem:(i,l)=>{var c,u;const d=f=>{if(f=f||"",n!==f){try{o=JSON.parse(f)}catch{return l}n=f}return o},p=(u=(c=r())==null?void 0:c.getItem(i))!=null?u:null;return isPromiseLike$1(p)?p.then(d):d(p)},setItem:(i,l)=>{var c;return(c=r())==null?void 0:c.setItem(i,JSON.stringify(l))},removeItem:i=>{var l;return(l=r())==null?void 0:l.removeItem(i)}};return typeof window<"u"&&typeof window.addEventListener=="function"&&(a.subscribe=(i,l,c)=>{if(!(r()instanceof window.Storage))return()=>{};const u=d=>{if(d.storageArea===r()&&d.key===i){let p;try{p=JSON.parse(d.newValue||"")}catch{p=c}l(p)}};return window.addEventListener("storage",u),()=>{window.removeEventListener("storage",u)}}),a}const defaultStorage$1=createJSONStorage(()=>typeof window<"u"?window.localStorage:void 0);function atomWithStorage(r,n,o=defaultStorage$1,a){const i=a==null?void 0:a.unstable_getOnInit,l=atom(i?o.getItem(r,n):n);return(define_import_meta_env_default$1?"production":void 0)!=="production"&&(l.debugPrivate=!0),l.onMount=u=>{i||u(o.getItem(r,n));let d;return o.subscribe&&(d=o.subscribe(r,u,n)),d},atom(u=>u(l),(u,d,p)=>{const f=typeof p=="function"?p(u(l)):p;return f===RESET?(d(l,n),o.removeItem(r)):f instanceof Promise?f.then(m=>(d(l,m),o.setItem(r,m))):(d(l,f),o.setItem(r,f))})}var define_import_meta_env_default={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const StoreContext=React.createContext(void 0),useStore=r=>{const n=React.useContext(StoreContext);return(r==null?void 0:r.store)||n||getDefaultStore()},isPromiseLike=r=>typeof(r==null?void 0:r.then)=="function",use$1=React.use||(r=>{if(r.status==="pending")throw r;if(r.status==="fulfilled")return r.value;throw r.status==="rejected"?r.reason:(r.status="pending",r.then(n=>{r.status="fulfilled",r.value=n},n=>{r.status="rejected",r.reason=n}),r)});function useAtomValue(r,n){const o=useStore(n),[[a,i,l],c]=React.useReducer(p=>{const f=o.get(r);return Object.is(p[0],f)&&p[1]===o&&p[2]===r?p:[f,o,r]},void 0,()=>[o.get(r),o,r]);let u=a;(i!==o||l!==r)&&(c(),u=o.get(r));const d=n==null?void 0:n.delay;return React.useEffect(()=>{const p=o.sub(r,()=>{if(typeof d=="number"){setTimeout(c,d);return}c()});return c(),p},[o,r,d]),React.useDebugValue(u),isPromiseLike(u)?use$1(u):u}function useSetAtom(r,n){const o=useStore(n);return React.useCallback((...i)=>{if((define_import_meta_env_default?"production":void 0)!=="production"&&!("write"in r))throw new Error("not writable atom");return o.set(r,...i)},[o,r])}function useAtom(r,n){return[useAtomValue(r,n),useSetAtom(r,n)]}function duplicateBlocks(r,n,o){const a=lodashEs.filter(r,l=>l._parent===n),i=[];for(let l=0;l<a.length;l++){const c=getSlots$1(a[l]);if(Object.keys(c).length>0&&Object.keys(c).forEach(u=>{a[l][u]=`slot:${iconBase.generateUUID()}`}),lodashEs.filter(r,{_parent:a[l]._id}).length>0){const u=iconBase.generateUUID();i.push({...a[l],oldId:a[l]._id,_id:u,_parent:o}),i.push(lodashEs.flatten(duplicateBlocks(r,a[l]._id,u)))}else i.push({...a[l],oldId:a[l]._id,_id:iconBase.generateUUID(),_parent:o})}return lodashEs.flatten(i)}function convertToBlocksTree(r){const n={};r.forEach(a=>{n[a._id]={...a,children:[]}});const o=[];return r.forEach(a=>{if(a._parent){const i=n[a._parent];i&&i.children.push(n[a._id])}else o.push(n[a._id])}),o}const getSlots$1=r=>{const n={};return Object.keys(r).forEach(o=>{lodashEs.isString(r[o])&&r[o].startsWith("slot")&&(n[o]=r[o].replace("slot:",""))}),n},getDuplicatedBlocks=(r,n,o=null)=>{let a=lodashEs.find(r,{_id:n});a={...a,oldId:a._id,_id:iconBase.generateUUID()},o&&(a={...a,_parent:o});const i=[a];lodashEs.filter(r,{_parent:n}).length>0&&i.push(lodashEs.flatten(duplicateBlocks(r,n,a._id)));const l=lodashEs.flatten(i);return lodashEs.map(l,c=>{const u=c,d=getSlots$1(u);return Object.keys(d).length>0&&Object.keys(d).forEach(p=>{const f=lodashEs.find(l,{oldId:d[p].replace("slot:","")});u[p]=`slot:${f._id}`}),lodashEs.omit(u,["global","oldId"])})},presentBlocksAtom=jotai.atom([]);presentBlocksAtom.debugLabel="presentBlocksAtom";const treeDSBlocks=jotai.atom(r=>{const n=r(presentBlocksAtom);return convertToBlocksTree([...n])});treeDSBlocks.debugLabel="treeDSBlocks";presentBlocksAtom.debugLabel="presentBlocksAtom";const pageBlocksAtomsAtom=splitAtom(presentBlocksAtom);pageBlocksAtomsAtom.debugLabel="pageBlocksAtomsAtom";const builderActivePageAtom=jotai.atom("");builderActivePageAtom.debugLabel="builderActivePageAtom";const destinationDropIndexAtom=jotai.atom(-1);destinationDropIndexAtom.debugLabel="destinationDropIndexAtom";const buildingBlocksAtom=jotai.atom([]);buildingBlocksAtom.debugLabel="buildingBlocksAtom";const globalBlocksAtom=jotai.atom(r=>{const n=r(buildingBlocksAtom);return lodashEs.filter(n,o=>lodashEs.has(o,"blockId"))});globalBlocksAtom.debugLabel="globalBlocksAtom";const selectedBlockIdsAtom=jotai.atom([]);selectedBlockIdsAtom.debugLabel="selectedBlockIdsAtom";const selectedBlocksAtom=jotai.atom(r=>{const n=r(presentBlocksAtom),o=r(selectedBlockIdsAtom);return lodashEs.map(lodashEs.filter(n,({_id:a})=>lodashEs.includes(o,a)),a=>({...a}))});selectedBlocksAtom.debugLabel="selectedBlocksAtom";const selectedBlockAtom=jotai.atom(r=>{const n=r(selectedBlocksAtom);if(n.length===0)return null;if(n.length===1)return n[0]});selectedBlockAtom.debugLabel="selectedBlockAtom";const getParentId=r=>lodashEs.get(r,"_parent",null),selectedBlocksParentsAtom=jotai.atom(r=>{const n=r(selectedBlocksAtom),o=lodashEs.map(n,getParentId);return lodashEs.filter(r(presentBlocksAtom),a=>lodashEs.includes(o,a._id))});selectedBlocksParentsAtom.debugLabel="selectedBlocksParentsAtom";const selectedBlockFlexChildAtom=jotai.atom(()=>!1);selectedBlockFlexChildAtom.debugLabel="selectedBlockFlexChildAtom";const selectedBlockGridChildAtom=jotai.atom(()=>!1);selectedBlockGridChildAtom.debugLabel="selectedBlockGridChildAtom";const styleStateAtom=jotai.atom("");styleStateAtom.debugLabel="styleStateAtom";const styleBreakpointAtom=atomWithStorage("styleBreakpoint","xs");styleBreakpointAtom.debugLabel="styleBreakpointAtom";const useSelectedBlocksDisplayChild=()=>({flexChild:jotai.useAtomValue(selectedBlockFlexChildAtom),gridChild:jotai.useAtomValue(selectedBlockGridChildAtom)}),useSelectedBlock=()=>jotai.useAtomValue(selectedBlockAtom),selectedBlockHierarchy=jotai.atom(r=>{const n=r(selectedBlockAtom),o=r(presentBlocksAtom);let a=n;const i=[n];do{const l=o.find(({_id:c})=>c===(a==null?void 0:a._parent));a=l,l&&i.push(l)}while(a!=null&&a._parent);return i}),useSelectedBlockHierarchy=()=>lodashEs.compact(jotai.useAtomValue(selectedBlockHierarchy)),useSelectedBlockIds=()=>{const[r,n]=jotai.useAtom(selectedBlockIdsAtom),o=React.useCallback(a=>{n(i=>lodashEs.includes(i,a)?lodashEs.without(i,a):[...i,a])},[n]);return[r,n,o]},getBlockJSONFromUISchemas=r=>{switch(r.type){case"singular":return r.uiSchema;case"model":const{properties:n}=r,o={};return Object.keys(n).forEach(l=>{const c=n[l];if(lodashEs.includes(["slot","styles"],c.type))return;const u=l;o[u]=getBlockJSONFromUISchemas(c)}),o;case"list":const{itemProperties:a}=r,i={items:{}};return Object.keys(a).forEach(l=>{const c=a[l];if(lodashEs.includes(["slot","styles"],c.type))return;const u=l;i.items[u]=getBlockJSONFromUISchemas(c)}),i;default:return{}}},getBlockJSONFromSchemas=(r,n)=>{switch(r.type){case"singular":{const d=r.schema;return d.title&&(d.title=n(d.title)),d.oneOf&&Array.isArray(d.oneOf)&&(d.oneOf=d.oneOf.map(p=>(p.title&&(p.title=n(p.title)),p))),d}case"model":const{properties:o,title:a}=r,i={title:n(a),type:"object",properties:{}};return Object.keys(o).forEach(d=>{const p=o[d];if(lodashEs.includes(["slot","styles"],p.type))return;const f=d;i.properties[f]=getBlockJSONFromSchemas(p,n)}),i;case"list":const{itemProperties:l,title:c}=r,u={title:n(c),type:"array",items:{type:"object",properties:{}}};return Object.keys(l).forEach(d=>{const p=l[d];if(lodashEs.includes(["slot","styles"],p.type))return;const f=d;u.items.properties[f]=getBlockJSONFromSchemas(p,n),lodashEs.set(u.items,"title",lodashEs.get(p,"itemTitle",`${n(c)} item`))}),u;default:return{}}},getBlockDefaultProps=r=>{if(!r)return{};const n={};return Object.keys(r).forEach(o=>{n[o]=getBlockDefaultProp(r[o])}),n},getListDefaults=r=>{if(lodashEs.isEmpty(r.default))return[];const{itemProperties:n}=r;return lodashEs.map(r.default,o=>{const a={...o};return lodashEs.forIn(o,(i,l)=>{lodashEs.has(n,l)&&lodashEs.get(n[l],"i18n",!1)&&(a[l]=STRINGS.I18N_KEY)}),a})},getBlockDefaultProp=r=>{switch(r.type){case"styles":return r.default;case"slot":return`${STRINGS.SLOT_KEY}${iconBase.generateUUID()}`;case"singular":const{schema:n}=r;return lodashEs.get(n,"default","");case"model":return getBlockDefaultProps(r.properties);case"list":return getListDefaults(r);default:return""}},convertDotNotationToObject=(r,n)=>{const o={};return lodashEs.set(o,r,n),o};var undomanager={exports:{}};(function(r){(function(){function n(a,i,l){return a.splice(i,!l||1+l-i+(!(l<0^i>=0)&&(l<0||-1)*a.length)),a.length}let o=function(){let a=[],i=-1,l=0,c=!1,u;function d(p,f){return!p||typeof p[f]!="function"?this:(c=!0,p[f](),c=!1,this)}return{add:function(p){return c?this:(a.splice(i+1,a.length-i),a.push(p),l&&a.length>l&&n(a,0,-(l+1)),i=a.length-1,u&&u(),this)},setCallback:function(p){u=p},undo:function(){let p=a[i];if(!p)return this;const f=p.groupId;for(;p.groupId===f&&(d(p,"undo"),i-=1,p=a[i],!(!p||!p.groupId)););return u&&u(),this},redo:function(){let p=a[i+1];if(!p)return this;const f=p.groupId;for(;p.groupId===f&&(d(p,"redo"),i+=1,p=a[i+1],!(!p||!p.groupId)););return u&&u(),this},clear:function(){let p=a.length;a=[],i=-1,u&&p>0&&u()},hasUndo:function(){return i!==-1},hasRedo:function(){return i<a.length-1},getCommands:function(p){return p?a.filter(f=>f.groupId===p):a},getIndex:function(){return i},setLimit:function(p){l=p}}};r.exports?r.exports=o:window.UndoManager=o})()})(undomanager);var undomanagerExports=undomanager.exports;const UndoManager=plugin.getDefaultExportFromCjs(undomanagerExports),MODIFIERS=["hover","focus","focus-within","focus-visible","active","visited","target","first","last","only","odd","even","first-of-type","last-of-type","only-of-type","empty","disabled","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","open","before","after","first-letter","first-line","marker","selection","file","placeholder","hs-collapse-open","hs-accordion-active"],BRANDING_OPTIONS_DEFAULTS={bodyFont:"Inter",headingFont:"Inter",roundedCorners:5,primaryColor:"#570df8",secondaryColor:"#f002b8",bodyBgDarkColor:"#031022",bodyBgLightColor:"#fcfcfc",bodyTextDarkColor:"#ffffff",bodyTextLightColor:"#000000"},brandingOptionsAtom=jotai.atom(BRANDING_OPTIONS_DEFAULTS),blocksContainerAtom=jotai.atom(null),useBrandingOptions=()=>{const[r,n]=jotai.useAtom(brandingOptionsAtom);return[lodashEs.isObject(r)?{...BRANDING_OPTIONS_DEFAULTS,...r}:BRANDING_OPTIONS_DEFAULTS,n]},useBlocksContainer=()=>jotai.useAtom(blocksContainerAtom),currentPageAtom=jotai.atom(null),useCurrentPage=()=>({currentPage:jotai.useAtomValue(currentPageAtom)});function getBlocksTree(r){return convertToBlocksTree(r)}const nestedToFlatArray=(r,n)=>lodashEs.flatten(r.map(o=>{if(o=n?{...o,_parent:n}:{...o},o.children){const a=[...o.children];return delete o.children,lodashEs.flatten([o,...nestedToFlatArray(a,o._id)])}return o}));function setProjectBlocksInMemory(r,n=!1){for(let o=0;o<r.length;o++){const a=r[o];a.global&&!n?r[o]={type:"GlobalBlock",blockId:a.blockId,_parent:lodashEs.get(a,"_parent",null),_id:a._id}:a.children&&a.children.length&&setProjectBlocksInMemory(a.children)}}function getInnerBlocks(r){let n=[],o=lodashEs.filter(r,{type:"GlobalBlock"});return o.length>0&&(o=lodashEs.map(o,getPBlocks),lodashEs.each(o,a=>{n=[...n,...getSingleBlock(a)]})),n}function getSingleBlock(r){let n=[];const o=lodashEs.get(lodashEs.first(r),"_parent",null);lodashEs.set(lodashEs.first(r),"_parent",null);const a=[flatToNestedInstance.convert(clone(r))];setProjectBlocksInMemory(a,!0);let i=nestedToFlatArray(a,r[0]._id);return i=lodashEs.set(i,"0._parent",o),n=[...n,i,...getInnerBlocks(i)],n}function getPBlocks(r){const n=lodashEs.find(FLAT_ARRAY,{_id:r._id});if(!n)return[];const o=[n],a=lodashEs.filter(FLAT_ARRAY,{_parent:r._id});return a.length?lodashEs.flatten([...o,...lodashEs.flatten(lodashEs.map(a,getPBlocks))]):lodashEs.flatten(o)}const clone=r=>JSON.parse(JSON.stringify(r));let FLAT_ARRAY=[];function splitPageBlocks(r){FLAT_ARRAY=r;const n=getBlocksTree(clone(r));setProjectBlocksInMemory(n);const o=nestedToFlatArray(n,null),a=getInnerBlocks(o),i={};return lodashEs.each(a,l=>lodashEs.set(i,lodashEs.first(l).blockId,l)),[o,i]}const useGetPageData=()=>{const[r]=useBrandingOptions(),{currentPage:n}=useCurrentPage(),[o]=useBlocksStore();return React.useCallback(()=>{const a=lodashEs.map(o,l=>lodashEs.omit(l,["expanded","order","title","siblings","tempClasses"])),[i=[]]=splitPageBlocks(a);return{currentPage:n,blocks:i}},[r,n,o])},chaiBuilderPropsAtom=jotai.atom(null);chaiBuilderPropsAtom.debugLabel="chaiBuilderPropsAtom";const chaiExternalDataAtom=jotai.atom({});chaiExternalDataAtom.debugLabel="chaiExternalDataAtom";const useBuilderProp=(r,n=void 0)=>{const o=jotai.useAtomValue(chaiBuilderPropsAtom);return lodashEs.get(o,r,n)},dataProvidersAtom=jotai.atom([]);dataProvidersAtom.debugLabel="dataProvidersAtom";const usePageDataProviders=()=>jotai.useAtom(dataProvidersAtom),builderSaveStateAtom=jotai.atom("SAVED");builderSaveStateAtom.debugLabel="builderSaveStateAtom";const useSavePage=()=>{const[r,n]=jotai.useAtom(builderSaveStateAtom),o=useBuilderProp("onSave",async d=>{}),a=useBuilderProp("onSaveStateChange",lodashEs.noop),i=useGetPageData(),[l]=usePageDataProviders(),[c]=useBrandingOptions();return{savePage:web.useThrottledCallback(async()=>{n("SAVING"),a("SAVING");const d=i();return await o({blocks:d.blocks,providers:l,brandingOptions:c,themeConfiguration:c}),setTimeout(()=>{n("SAVED"),a("SAVED")},100),!0},[i,n,c,o,a],3e3),saveState:r,setSaveState:n}},undoManager=new UndoManager;undoManager.setLimit(50);const useUndoManager=()=>{const[,r]=jotai.useAtom(builderSaveStateAtom),n=useBuilderProp("onSaveStateChange",lodashEs.noop);return React.useEffect(()=>(undoManager.setCallback(()=>{r("UNSAVED"),n("UNSAVED")}),()=>{undoManager.setCallback(lodashEs.noop)}),[]),{add:undoManager.add,undo:undoManager.undo,redo:undoManager.redo,hasRedo:undoManager.hasRedo,hasUndo:undoManager.hasUndo,clear:undoManager.clear}},removeNestedBlocks=(r,n)=>{const o=[],a=lodashEs.filter(r,i=>lodashEs.includes(n,i._id)||lodashEs.includes(n,i._parent)?(o.push(i._id),!1):!0);return lodashEs.isEmpty(o)?a:removeNestedBlocks(a,o)},useRemoveBlocks=()=>{const[r]=useBlocksStore(),[n,o]=useSelectedBlockIds(),{setNewBlocks:a}=useBlocksStoreUndoableActions();return React.useCallback(i=>{var c;const l=((c=lodashEs.find(r,{_id:i[0]}))==null?void 0:c._parent)||null;a(removeNestedBlocks(r,i)),setTimeout(()=>o(l?[l]:[]),200)},[r,o,n])};function insertBlocksAtPosition(r,n,o,a){let i=r.filter(u=>!u._parent);o&&(i=r.filter(u=>u._parent===o));const l=a!==void 0?a:i.length;let c=r.length;for(let u=0,d=0;u<r.length;u++)if(r[u]._parent===o){if(d===l){c=u;break}d++}return!o&&a!==void 0&&a>=i.length&&(c=r.length),[...r.slice(0,c),...n,...r.slice(c)]}function flattenTree(r){let n=[];return r.walk(o=>(delete o.model.children,n.push(o.model),!0)),n}function findNodeById(r,n){return r.first(o=>o.model._id===n)||null}function moveNode(r,n,o,a){const i=findNodeById(r,n),l=findNodeById(r,o);if(i&&l){i.drop(),l.children||(l.model.children=[]);try{l.addChildAtIndex(i,a)}catch(c){return console.error("Error adding child to parent:",c),!1}return!0}return!1}function moveBlocksWithChildren(r,n,o,a){if(!n)return r;o=o||"root";const l=new TreeModel().parse({_id:"root",children:getBlocksTree(r)});if(moveNode(l,n,o,a)){const c=flattenTree(l),u=c.find(d=>d._id===n);return u&&(u._parent=o==="root"?null:o),c.shift(),c}return r}const useBlocksStoreManager=()=>{const[,r]=useBlocksStore();return{setNewBlocks:n=>{r(n)},addBlocks:(n,o,a)=>{r(i=>insertBlocksAtPosition(i,n,o,a))},removeBlocks:n=>{r(o=>removeNestedBlocks(o,n))},moveBlocks:(n,o,a)=>{r(i=>{let l=i;for(let c=0;c<n.length;c++)l=moveBlocksWithChildren(l,n[c],o,a);return l})},updateBlocksProps:n=>{r(o=>{const a=n.map(i=>i._id);return o.map(i=>{if(a.includes(i._id)){const l=lodashEs.find(n,{_id:i._id});return{...i,...lodashEs.omit(l,"_id")}}return i})})}}},useBlocksStore=()=>jotai.useAtom(presentBlocksAtom),useBlocksStoreUndoableActions=()=>{const{add:r}=useUndoManager(),[n]=useBlocksStore(),{setNewBlocks:o,addBlocks:a,removeBlocks:i,moveBlocks:l,updateBlocksProps:c}=useBlocksStoreManager();return{moveBlocks:(y,b,v)=>{const x=lodashEs.map(y,S=>{const R=n.find(k=>k._id===S)._parent||null,C=n.filter(k=>R?k._parent===R:!k._parent).map(k=>k._id).indexOf(S);return{_id:S,oldParent:R,oldPosition:C}}),E=x.find(({_id:S})=>S===y[0]);E&&E.oldParent===b&&E.oldPosition===v||(l(y,b,v),r({undo:()=>lodashEs.each(x,({_id:S,oldParent:w,oldPosition:R})=>{l([S],w,R)}),redo:()=>l(y,b,v)}))},addBlocks:(y,b,v)=>{a(y,b,v),r({undo:()=>i(lodashEs.map(y,"_id")),redo:()=>a(y,b,v)})},removeBlocks:y=>{var E;const b=(E=lodashEs.first(y))==null?void 0:E._parent,x=n.filter(S=>b?S._parent===b:!S._parent).indexOf(lodashEs.first(y));i(lodashEs.map(y,"_id")),r({undo:()=>a(y,b,x),redo:()=>i(lodashEs.map(y,"_id"))})},updateBlocks:(y,b,v)=>{let x=[];if(v)x=lodashEs.map(y,E=>({_id:E,...v}));else{const E=lodashEs.keys(b);x=lodashEs.map(y,S=>{const w=n.find(A=>A._id===S),R={_id:S};return lodashEs.each(E,A=>R[A]=w[A]),R})}c(lodashEs.map(y,E=>({_id:E,...b}))),r({undo:()=>c(x),redo:()=>c(lodashEs.map(y,E=>({_id:E,...b})))})},updateBlocksRuntime:(y,b)=>{c(lodashEs.map(y,v=>({_id:v,...b})))},setNewBlocks:y=>{o(y),r({undo:()=>o(n),redo:()=>o(y)})},updateMultipleBlocksProps:y=>{let b=[];b=lodashEs.map(y,v=>{const x=lodashEs.keys(v),E=n.find(w=>w._id===v._id),S={};return lodashEs.each(x,w=>S[w]=E[w]),S}),c(y),r({undo:()=>c(b),redo:()=>c(y)})}}},useAddBlock=()=>{const[r]=useBlocksStore(),[,n]=useSelectedBlockIds(),{addBlocks:o}=useBlocksStoreUndoableActions(),a=React.useCallback((l,c,u)=>{var h;for(let g=0;g<l.length;g++){const{_id:y}=l[g];l[g]._id=iconBase.generateUUID();const b=lodashEs.filter(l,{_parent:y});for(let v=0;v<b.length;v++)b[v]._parent=l[g]._id}const d=lodashEs.first(l);let p,f;return c&&(p=lodashEs.find(r,{_id:c}),l[0]._parent=c,f=c),!(p?canAcceptChildBlock(p==null?void 0:p._type,d._type):!0)&&p&&(l[0]._parent=p._parent,f=p._parent),o(l,f,u),n([(h=lodashEs.first(l))==null?void 0:h._id]),lodashEs.first(l)},[r,n]);return{addCoreBlock:React.useCallback((l,c,u)=>{if(lodashEs.has(l,"blocks")){const v=l.blocks;return a(v,c,u)}const d=iconBase.generateUUID(),p=getBlockDefaultProps(l.props),f=[];lodashEs.forIn(p,(v,x)=>{if(lodashEs.startsWith(v,STRINGS.SLOT_KEY)){const E=v.replace(STRINGS.SLOT_KEY,"");f.push({_id:E,_type:"Slot",_parent:d,_name:l.props[x].name,_styles:l.props[x].styles,_emptyStyles:l.props[x].emptyStyles})}});const m={_type:l.type,_id:d,...p};let h,g;c&&(h=lodashEs.find(r,{_id:c}),m._parent=c,g=c),!canAcceptChildBlock(h==null?void 0:h._type,m._type)&&h&&(m._parent=h._parent,g=h._parent);const b=[m,...f];return o(b,g,u),n([m._id]),m},[a,r,n]),addPredefinedBlock:a}},STANDARD=[0,1,2,3,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96],CLASS_VALUES={columns:[...lodashEs.range(1,13),"auto","3xs","2xs","xs","sm","md","lg","xl",...lodashEs.map(lodashEs.range(2,8),r=>`${r}xl`)],breakAfter:["auto","avoid","all","avoid-page","page","left","right","column"],breakInside:["auto","avoid","avoid-page","avoid-column"],display:["block","flex","grid","inline-block","inline","hidden"],objectFit:["contain","cover","fill","none","scale-down"],objectPosition:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],overflow:["auto","hidden","clip","visible","scroll"],overscroll:["auto","contain","none"],trbl:[0,"px","0.5",1,1.5,2,2.5,3,3.5,...lodashEs.range(4,13),14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,"auto","1/2","1/3","2/3","1/4","2/4","3/4","full"],flexBasis:[...STANDARD,"auto","px","0.5","1.5","2.5","3.5","1/2","1/3","2/3","1/4","2/4","3/4","1/5","2/5","3/5","4/5","1/6","2/6","3/6","4/6","5/6","1/12","2/12","3/12","4/12","5/12","6/12","7/12","8/12","9/12","10/12","11/12","full"],padding:[...STANDARD,"px","0.5","1.5","2.5","3.5"],margin:["auto",...STANDARD,"px","0.5","1.5","2.5","3.5"],scale:[0,50,75,90,95,100,105,110,125,150],origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],blendEffect:["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],borderWidth:[0,2,4,8],borderRadius:["global","none","sm","md","lg","xl","2xl","3xl","full"],indent:[0,"px","0.5",1,1.5,2,2.5,3,3.5,...lodashEs.range(4,13),14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96],maxHeight:[0,"px","0.5",1,1.5,2,2.5,3,3.5,...lodashEs.range(4,13),14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,"full","screen","min","max","fit"],space:[0,"px","0.5",1,1.5,2,2.5,3,3.5,...lodashEs.range(4,13),14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,"px","reverse"],width:["0","px","0.5","1","1.5","2","2.5","3","3.5","4","5","6","7","8","9","10","11","12","14","16","20","24","28","32","36","40","44","48","52","56","60","64","72","80","96","auto","1/2","1/3","2/3","1/4","2/4","3/4","1/5","2/5","3/5","4/5","1/6","2/6","3/6","4/6","5/6","1/12","2/12","3/12","4/12","5/12","6/12","7/12","8/12","9/12","10/12","11/12"],maxWidth:["0","none","xs","sm","md","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","full","min","max","fit","prose","screen-sm","screen-md","screen-lg","screen-xl","screen-2xl"],height:["0","px","0.5","1","1.5","2","2.5","3","3.5","4","5","6","7","8","9","10","11","12","14","16","20","24","28","32","36","40","44","48","52","56","60","64","72","80","96","auto","1/2","1/3","2/3","1/4","2/4","3/4","1/5","2/5","3/5","4/5","1/6","2/6","3/6","4/6","5/6","full","screen","min","max","fit"]},CLASSES_LIST={textColor:{classes:[],regExp:"text-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},aspectRatio:{classes:["aspect-auto","aspect-square","aspect-video"],regExp:"aspect-(auto|square|video)"},container:{classes:["container"],regExp:"container"},columns:{classes:lodashEs.map(CLASS_VALUES.columns,r=>`columns-${r}`),regExp:"columns-(auto|[0-9]xl|[0-9]xs|xs|sm|md|lg|xl|\\d+)"},breakAfter:{classes:lodashEs.map(CLASS_VALUES.breakAfter,r=>`break-after-${r}`),regExp:"break-after-\\S+"},breakBefore:{classes:lodashEs.map(CLASS_VALUES.breakAfter,r=>`break-before-${r}`),regExp:"break-before-\\S+"},breakInside:{classes:lodashEs.map(CLASS_VALUES.breakInside,r=>`break-inside-${r}`),regExp:"break-inside-\\S+"},boxDecoration:{classes:["box-decoration-clone","box-decoration-slice"],regExp:"box-decoration-\\S+"},boxSizing:{classes:["box-border","box-content"],regExp:"box-(border|content)"},flexDirection:{classes:["flex-row","flex-row-reverse","flex-col","flex-col-reverse"],regExp:"flex-(row|row-reverse|col|col-reverse)"},flexWrap:{classes:["flex-wrap","flex-wrap-reverse","flex-nowrap"],regExp:"flex-(wrap|wrap-reverse|nowrap)"},flexGrowShrink:{classes:["flex-1","flex-auto","flex-initial","flex-none"],regExp:"flex-1|flex-auto|flex-initial|flex-none"},gridColumns:{classes:lodashEs.map([...lodashEs.range(0,13),"none"],r=>`grid-cols-${r}`),regExp:"grid-cols-(\\d+|none)"},gridFlow:{classes:["grid-flow-row","grid-flow-col","grid-flow-row-dense","grid-flow-col-dense"],regExp:"grid-flow-(row|col|row-dense|col-dense)"},outlineStyle:{classes:lodashEs.map(["none","dashed","dotted","double","hidden"],r=>`outline-${r}`),regExp:"outline-(none|dashed|dotted|double|hidden)"},borderStyle:{classes:lodashEs.map(["solid","dashed","dotted","double","hidden","none"],r=>`border-${r}`),regExp:"border-(solid|dashed|dotted|double|hidden|none)"},overflow:{classes:lodashEs.map(CLASS_VALUES.overflow,r=>`overflow-${r}`),regExp:`overflow-(${CLASS_VALUES.overflow.join("|")})`},overflowX:{classes:lodashEs.map(CLASS_VALUES.overflow,r=>`overflow-x-${r}`),regExp:`overflow-x-(${CLASS_VALUES.overflow.join("|")})`},overflowY:{classes:lodashEs.map(CLASS_VALUES.overflow,r=>`overflow-y-${r}`),regExp:`overflow-y-(${CLASS_VALUES.overflow.join("|")})`},gridRows:{classes:lodashEs.map([1,2,3,4,5,6,"none"],r=>`grid-rows-${r}`),regExp:"grid-rows-(\\d|none)"},display:{classes:lodashEs.map(CLASS_VALUES.display,r=>r.toString()),regExp:`(${CLASS_VALUES.display.join("|")})`},float:{classes:["float-right","float-left","float-none"],regExp:"float-\\S+"},clear:{classes:["clear-right","clear-left","clear-none","clear-both"],regExp:"clear-\\S+"},isolation:{classes:["isolate","isolation-auto"],regExp:"isolate|isolation-auto"},objectFit:{classes:lodashEs.map(CLASS_VALUES.objectFit,r=>`object-${r}`),regExp:"object-(contain|cover|fill|none|scale-down)"},objectPosition:{classes:lodashEs.map(CLASS_VALUES.objectPosition,r=>`object-${r}`),regExp:`object-(${CLASS_VALUES.objectPosition.join("|")})`},overscroll:{classes:lodashEs.map(CLASS_VALUES.overscroll,r=>`overscroll-${r}`),regExp:`overscroll-(${CLASS_VALUES.overscroll.join("|")})`},overscrollX:{classes:lodashEs.map(CLASS_VALUES.overscroll,r=>`overscroll-x-${r}`),regExp:`overscroll-x-(${CLASS_VALUES.overscroll.join("|")})`},overscrollY:{classes:lodashEs.map(CLASS_VALUES.overscroll,r=>`overscroll-y-${r}`),regExp:`overscroll-y-(${CLASS_VALUES.overscroll.join("|")})`},inset:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`inset-${r}`),regExp:"-?inset-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},insetX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`inset-x-${r}`),regExp:"-?inset-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},insetY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`inset-y-${r}`),regExp:"-?inset-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},top:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`top-${r}`),regExp:"-?top-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},topX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`top-x-${r}`),regExp:"-?top-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},topY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`top-y-${r}`),regExp:"-?top-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},right:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`right-${r}`),regExp:"-?right-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},rightX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`right-x-${r}`),regExp:"-?right-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},rightY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`right-y-${r}`),regExp:"-?right-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},bottom:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`bottom-${r}`),regExp:"-?bottom-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},bottomX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`bottom-x-${r}`),regExp:"-?bottom-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},bottomY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`bottom-y-${r}`),regExp:"-?bottom-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},left:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`left-${r}`),regExp:"-?left-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},leftX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`left-x-${r}`),regExp:"-?left-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},leftY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`left-y-${r}`),regExp:"-?left-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},visibility:{classes:["visible","invisible"],regExp:"invisible|visible"},zIndex:{classes:lodashEs.map(["0",10,20,30,40,50,"auto"],r=>`z-${r}`),regExp:"-?z-(\\d+|auto|\\[.*\\])"},flexBasis:{classes:lodashEs.map(CLASS_VALUES.flexBasis,r=>`basis-${r}`),regExp:"basis-(\\d+|\\S+)"},flexGrow:{classes:["grow","grow-0"],regExp:"grow(-0)?"},flexShrink:{classes:["shrink","shrink-0"],regExp:"shrink(-0)?"},gridColSpan:{classes:["col-auto",...lodashEs.map(lodashEs.range(1,13),r=>`col-span-${r}`),"col-span-full"],regExp:"col-(auto|span-(\\d+|full))"},gridColStart:{classes:[...lodashEs.map(lodashEs.range(1,14),r=>`col-start-${r}`),"col-start-auto"],regExp:"col-start-(\\d+|auto)"},gridColEnd:{classes:[...lodashEs.map(lodashEs.range(1,14),r=>`col-end-${r}`),"col-end-auto"],regExp:"col-end-(\\d+|auto)"},gridRowSpan:{classes:["row-auto",...lodashEs.map(lodashEs.range(1,7),r=>`row-span-${r}`),"row-span-full"],regExp:"row-(auto|span-(\\d+|full))"},gridRowStart:{classes:[...lodashEs.map(lodashEs.range(1,8),r=>`row-start-${r}`),"row-start-auto"],regExp:"row-start-(\\d+|auto)"},gridRowEnd:{classes:[...lodashEs.map(lodashEs.range(1,8),r=>`row-end-${r}`),"row-end-auto"],regExp:"row-end-(\\d+|auto)"},gridAutoColumns:{classes:["auto-cols-auto","auto-cols-min","auto-cols-max","auto-cols-fr"],regExp:"auto-cols-(auto|min|max|fr)"},gridAutoRows:{classes:["auto-rows-auto","auto-rows-min","auto-rows-max","auto-rows-fr"],regExp:"auto-rows-(auto|min|max|fr)"},gap:{classes:lodashEs.map(CLASS_VALUES.indent,r=>`gap-${r}`),regExp:"gap-(px|\\d.\\d|\\d|\\[.*\\])"},gapX:{classes:lodashEs.map(CLASS_VALUES.indent,r=>`gap-x-${r}`),regExp:"gap-x-(px|\\d.\\d|\\d|\\[.*\\])"},gapY:{classes:lodashEs.map(CLASS_VALUES.indent,r=>`gap-y-${r}`),regExp:"gap-y-(px|\\d.\\d|\\d|\\[.*\\])"},justifyContent:{classes:["justify-start","justify-end","justify-center","justify-between","justify-around","justify-evenly"],regExp:"justify-(start|end|center|between|around|evenly)"},justifyItems:{classes:["justify-items-start","justify-items-end","justify-items-center","justify-items-stretch"],regExp:"justify-items-(start|end|center|stretch)"},justifySelf:{classes:["justify-self-auto","justify-self-start","justify-self-end","justify-self-center","justify-self-stretch"],regExp:"justify-self-(auto|start|end|center|stretch)"},placeContent:{classes:["place-content-center","place-content-start","place-content-end","place-content-between","place-content-around","place-content-evenly","place-content-stretch"],regExp:"place-content-(center|start|end|between|around|evenly|stretch)"},placeItems:{classes:["place-items-start","place-items-end","place-items-center","place-items-stretch"],regExp:"place-items-(start|end|center|stretch)"},placeSelf:{classes:["place-self-auto","place-self-start","place-self-end","place-self-center","place-self-stretch"],regExp:"place-self-(auto|start|end|center|stretch)"},alignContent:{classes:["content-center","content-start","content-end","content-between","content-around","content-evenly"],regExp:"content-(center|start|end|between|around|evenly)"},alignItems:{classes:["items-start","items-end","items-center","items-baseline","items-stretch"],regExp:"items-(start|end|center|baseline|stretch)"},alignSelf:{classes:["self-auto","self-start","self-end","self-center","self-stretch","self-baseline"],regExp:"self-(auto|start|end|center|stretch|baseline)"},backgroundClip:{classes:["bg-clip-border","bg-clip-padding","bg-clip-content","bg-clip-text"],regExp:"bg-clip-(border|padding|content|text)"},dropShadow:{classes:lodashEs.map(["sm","md","lg","xl","2xl","none"],r=>`drop-shadow-${r}`),regExp:"drop-shadow-(sm|md|lg|xl|2xl|none)"},backdropBlur:{classes:lodashEs.map(["none","sm","md","lg","xl","2xl","3xl"],r=>`backdrop-blur-${r}`),regExp:"backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)"},backdropBrightness:{classes:lodashEs.map([0,50,75,90,95,100,105,110,125,150,200],r=>`backdrop-brightness-${r}`),regExp:"backdrop-brightness-(\\d+)"},backdropContrast:{classes:lodashEs.map([0,50,75,100,125,150,200],r=>`backdrop-contrast-${r}`),regExp:"backdrop-contrast-(\\d+)"},backdropGrayScale:{classes:["backdrop-grayscale-0","backdrop-grayscale"],regExp:"backdrop-grayscale(-0)?"},backdropHueRotate:{classes:lodashEs.map([0,15,30,60,90,180],r=>`backdrop-hue-rotate-${r}`),regExp:"-?backdrop-hue-rotate-(\\d+)"},backdropInvert:{classes:["backdrop-invert-0","backdrop-invert"],regExp:"backdrop-invert(-0)?"},backdropOpacity:{classes:lodashEs.map([0,5,10,20,25,30,40,50,60,70,75,80,90,95,100],r=>`backdrop-opacity-${r}`),regExp:"backdrop-opacity-(\\d+)"},backdropSaturate:{classes:lodashEs.map([0,50,100,150,200],r=>`backdrop-saturate-${r}`),regExp:"backdrop-saturate-(\\d+)"},backdropSepia:{classes:["backdrop-sepia-0, backdrop-sepia"],regExp:"backdrop-sepia(-0)?"},backgroundOrigin:{classes:["bg-origin-border","bg-origin-padding","bg-origin-content"],regExp:"bg-origin-(border|padding|content)"},transformOrigin:{classes:lodashEs.map(CLASS_VALUES.origin,r=>`origin-${r}`),regExp:"origin-(\\d+|\\S+)"},padding:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`p-${r}`),regExp:"p-(\\d+|\\S+|\\[.*\\])"},paddingX:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`px-${r}`),regExp:"px-(\\d+|\\S+|\\[.*\\])"},paddingY:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`py-${r}`),regExp:"py-(\\d+|\\S+|\\[.*\\])"},paddingTop:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`pt-${r}`),regExp:"pt-(\\d+|\\S+|\\[.*\\])"},paddingRight:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`pr-${r}`),regExp:"pr-(\\d+|\\S+|\\[.*\\])"},paddingBottom:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`pb-${r}`),regExp:"pb-(\\d+|\\S+|\\[.*\\])"},paddingLeft:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`pl-${r}`),regExp:"pl-(\\d+|\\S+|\\[.*\\])"},textDecorationStyle:{classes:["decoration-solid","decoration-double","decoration-dotted","decoration-dashed","decoration-wavy"],regExp:"decoration-(solid|double|dotted|dashed|wavy)"},textDecorationThickness:{classes:lodashEs.map(["auto","from-font","0",1,2,4,8],r=>`decoration-${r}`),regExp:"decoration-(auto|from-font|\\d+|\\S+)"},fromColor:{classes:[],regExp:"from-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},margin:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`m-${r}`),regExp:"-?m-(\\d+|\\S+|\\[.*\\])"},marginX:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`mx-${r}`),regExp:"-?mx-(\\d+|\\S+|\\[.*\\])"},marginY:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`my-${r}`),regExp:"-?my-(\\d+|\\S+|\\[.*\\])"},marginTop:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`mt-${r}`),regExp:"-?mt-(\\d+|\\S+|\\[.*\\])"},marginRight:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`mr-${r}`),regExp:"-?mr-(\\d+|\\S+|\\[.*\\])"},marginBottom:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`mb-${r}`),regExp:"-?mb-(\\d+|\\S+|\\[.*\\])"},marginLeft:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`ml-${r}`),regExp:"-?ml-(\\d+|\\S+|\\[.*\\])"},spaceX:{classes:lodashEs.map(CLASS_VALUES.space,r=>`space-x-${r}`),regExp:"-?space-x-(\\d+|\\S+|\\[.*\\])"},spaceY:{classes:lodashEs.map(CLASS_VALUES.space,r=>`space-y-${r}`),regExp:"-?space-y-(\\d+|\\S+|\\[.*\\])"},boxShadow:{classes:lodashEs.map(["sm","md","lg","xl","2xl","inner","none"],r=>`shadow-${r}`),regExp:"shadow-(sm|md|lg|xl|2xl|inner|none)"},minWidth:{classes:["min-w-0","min-w-full","min-w-min","min-w-max","min-w-fit"],regExp:"min-w-(\\d+|\\S+|\\[.*\\])"},maxWidth:{classes:lodashEs.map(CLASS_VALUES.maxWidth,r=>`max-w-${r}`),regExp:"max-w-(\\d+|\\S+|\\[.*\\])"},width:{classes:lodashEs.map([...CLASS_VALUES.width,"full","screen","min","max","fit"],r=>`w-${r}`),regExp:"w-(\\d+.\\d+|\\d+|px|auto|full|screen|min|max|fit|\\[.*\\])"},minHeight:{classes:["min-h-0","min-h-full","min-h-screen","min-h-min","min-h-max","min-h-fit"],regExp:"min-h-(\\d+|\\S+|\\[.*\\])"},maxHeight:{classes:lodashEs.map(CLASS_VALUES.maxHeight,r=>`max-h-${r}`),regExp:"max-h-(\\d+|\\S+|\\[.*\\])"},height:{classes:lodashEs.map(CLASS_VALUES.height,r=>`h-${r}`),regExp:"h-(\\d+.\\d+|\\d+|px|auto|full|screen|min|max|fit|\\[.*\\])"},fontFamily:{classes:["font-heading","font-body","font-sans","font-serif","font-mono"],regExp:"font-(heading|body|sans|serif|mono)"},textAlign:{classes:["text-left","text-center","text-right","text-justify"],regExp:"text-(left|center|right|justify)"},textOverflow:{classes:["truncate","text-ellipsis","text-clip"],regExp:"truncate|text-ellipsis|text-clip"},verticalAlign:{classes:["align-baseline","align-top","align-middle","align-bottom","align-text-top","align-text-bottom","align-sub","align-super"],regExp:"align-(baseline|top|middle|bottom|text-top|text-bottom|sub|super)"},fontSize:{classes:["text-xs","text-sm","text-base","text-lg","text-xl","text-2xl","text-3xl","text-4xl","text-5xl","text-6xl","text-7xl","text-8xl","text-9xl"],regExp:"text-(\\d+|\\S+|\\[.*\\])"},fontSmoothing:{classes:["antialiased","subpixel-antialiased"],regExp:"antialiased|subpixel-antialiased"},fontStyle:{classes:["italic","not-italic"],regExp:"not-italic|italic"},fontWeight:{classes:["font-thin","font-extralight","font-light","font-normal","font-medium","font-semibold","font-bold","font-extrabold","font-black"],regExp:"font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)"},fontVariantNum:{classes:["normal-nums","ordinal","diagonal-fractions","stacked-fractions","tabular-nums","oldstyle-nums","proportional-nums","lining-nums","slashed-zero"],regExp:"normal-nums|ordinal|diagonal-fractions|stacked-fractions|tabular-nums|oldstyle-nums|proportional-nums|lining-nums|slashed-zero"},letterSpacing:{classes:["tracking-tighter","tracking-tight","tracking-normal","tracking-wide","tracking-wider","tracking-widest"],regExp:"-?tracking-(tighter|tight|normal|wide|wider|widest|\\[.*\\])"},lineHeight:{classes:["leading-none","leading-tight","leading-snug","leading-normal","leading-relaxed","leading-loose","leading-3","leading-4","leading-5","leading-6","leading-7","leading-8","leading-9","leading-10"],regExp:"leading-(none|tight|snug|normal|relaxed|loose|\\[.*\\]|\\d+)"},listStyleType:{classes:["list-none","list-disc","list-decimal"],regExp:"list-(none|disc|decimal)"},listStylePosition:{classes:["list-inside","list-outside"],regExp:"list-(inside|outside)"},textUnderlineOffset:{classes:["underline-offset-auto","underline-offset-0","underline-offset-1","underline-offset-2","underline-offset-4","underline-offset-8"],regExp:"underline-offset-(auto|\\d+|\\S+)"},textDecoration:{classes:["underline","overline","line-through","no-underline"],regExp:"underline|overline|line-through|no-underline"},textDecorationColor:{classes:[],regExp:"decoration-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},textTransform:{classes:["uppercase","lowercase","capitalize","normal-case"],regExp:"uppercase|lowercase|capitalize|normal-case"},textIndent:{classes:lodashEs.map(CLASS_VALUES.indent,r=>`indent-${r}`),regExp:"-?indent-(\\d+|\\S+)"},whitespace:{classes:["whitespace-normal","whitespace-no-wrap","whitespace-pre","whitespace-pre-line","whitespace-pre-wrap"],regExp:"whitespace-(normal|no-wrap|pre|pre-line|pre-wrap)"},wordBreak:{classes:["break-normal","break-words","break-all"],regExp:"break-(normal|words|all)"},content:{classes:["content-none"],regExp:"content-none"},backgroundColor:{classes:[],regExp:"bg-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},backgroundAttachment:{classes:["bg-fixed","bg-local","bg-scroll"],regExp:"bg-(fixed|local|scroll)"},backgroundPosition:{classes:["bg-bottom","bg-center","bg-left","bg-left-bottom","bg-left-top","bg-right","bg-right-bottom","bg-right-top","bg-top"],regExp:"bg-(bottom|center|left|left-bottom|left-top|right|right-bottom|right-top|top)"},backgroundRepeat:{classes:["bg-repeat","bg-repeat-x","bg-repeat-y","bg-no-repeat","bg-repeat-round","bg-repeat-space"],regExp:"bg-(repeat|repeat-x|repeat-y|no-repeat|repeat-round|repeat-space)"},backgroundSize:{classes:["bg-auto","bg-cover","bg-contain"],regExp:"bg-(auto|cover|contain)"},backgroundGradient:{classes:["bg-gradient-none","bg-gradient-to-t","bg-gradient-to-tr","bg-gradient-to-r","bg-gradient-to-br","bg-gradient-to-b","bg-gradient-to-bl","bg-gradient-to-l","bg-gradient-to-tl"],regExp:"bg-gradient-(none|to-(t|tr|r|br|b|bl|l|tl))"},viaColor:{classes:[],regExp:"via-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},toColor:{classes:[],regExp:"to-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},position:{classes:["static","fixed","absolute","relative","sticky"],regExp:"(static|fixed|absolute|relative|sticky)"},borderRadiusTopLeft:{classes:["rounded-tl",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-tl-${r}`)],regExp:"rounded-tl-?(\\d+|\\S+)?"},borderRadiusTopRight:{classes:["rounded-tr",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-tr-${r}`)],regExp:"rounded-tr-?(\\d+|\\S+)?"},borderRadiusBottomRight:{classes:["rounded-br",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-br-${r}`)],regExp:"rounded-br-?(\\d+|\\S+)?"},borderRadiusBottomLeft:{classes:["rounded-bl",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-bl-${r}`)],regExp:"rounded-bl-?(\\d+|\\S+)?"},borderRadiusTop:{classes:["rounded-t",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-t-${r}`)],regExp:"rounded-t-?(\\d+|\\S+)?"},borderRadiusRight:{classes:["rounded-r",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-r-${r}`)],regExp:"rounded-r-?(\\d+|\\S+)?"},borderRadiusBottom:{classes:["rounded-b",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-b-${r}`)],regExp:"rounded-b-?(\\d+|\\S+)?"},borderRadiusLeft:{classes:["rounded-l",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-l-${r}`)],regExp:`(rounded-l-(${CLASS_VALUES.borderRadius.join("|")})|rounded-l$)`},borderRadius:{classes:["rounded",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-${r}`)],regExp:`(rounded-(${CLASS_VALUES.borderRadius.join("|")}$)|rounded)`},borderX:{classes:["border-x",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-x-${r}`)],regExp:"border-x-?(\\d+|\\S+|\\[.*\\])?"},borderY:{classes:["border-y",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-y-${r}`)],regExp:"border-y-?(\\d+|\\S+|\\[.*\\])?"},borderTop:{classes:["border-t",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-t-${r}`)],regExp:"border-t-?(\\d+|\\S+|\\[.*\\])?"},borderRight:{classes:["border-r",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-r-${r}`)],regExp:"border-r-?(\\d+|\\S+|\\[.*\\])?"},borderBottom:{classes:["border-b",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-b-${r}`)],regExp:"border-b-?(\\d+|\\S+|\\[.*\\])?"},borderLeft:{classes:["border-l",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-l-${r}`)],regExp:"border-l-?(\\d+|\\S+|\\[.*\\])?"},borderColor:{classes:[],regExp:"border-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},border:{classes:["border",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-${r}`)],regExp:"border-?(\\d+|\\S+|\\[.*\\])?"},order:{classes:lodashEs.map([...lodashEs.range(0,13),"first","last","none"],r=>`order-${r}`),regExp:"-?order-(\\d+|first|last|none)"},divideXWidth:{classes:lodashEs.map(["0",2,4,8],r=>`divide-x-${r}`),regExp:"divide-x-(\\d+|\\[.*\\])"},divideYWidth:{classes:lodashEs.map(["0",2,4,8],r=>`divide-y-${r}`),regExp:"divide-y-(\\d+|\\[.*\\])"},divideColor:{classes:[],regExp:"divide-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},divideStyle:{classes:lodashEs.map(["solid","dashed","dotted","double","none"],r=>`divide-${r}`),regExp:"divide-(solid|dashed|dotted|double|none)"},outlineWidth:{classes:lodashEs.map([0,1,2,4,8],r=>`outline-${r}`),regExp:"outline-(\\d+)"},outlineOffset:{classes:lodashEs.map([0,1,2,4,8],r=>`outline-offset-${r}`),regExp:"outline-offset-(\\d+)"},outlineColor:{classes:[],regExp:"outline-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},ringWidth:{classes:lodashEs.map([0,1,2,4,8,"inset"],r=>`ring-${r}`),regExp:"ring-(\\d+|inset)"},ringOffsetWidth:{classes:lodashEs.map([0,1,2,4,8],r=>`ring-offset-${r}`),regExp:"ring-offset-(\\d+)"},ringOffsetColor:{classes:[],regExp:"ring-offset-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},ringColor:{classes:[],regExp:"ring-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},boxShadowColor:{classes:[],regExp:"shadow-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},opacity:{classes:lodashEs.map([0,5,10,20,25,30,40,50,60,70,75,80,90,95,100],r=>`opacity-${r}`),regExp:"opacity-(\\d+|\\[.*\\])"},mixBlendMode:{classes:lodashEs.map(CLASS_VALUES.blendEffect,r=>`mix-blend-${r}`),regExp:"mix-blend-(\\d+|\\S+)"},bgBlendMode:{classes:lodashEs.map(CLASS_VALUES.blendEffect,r=>`bg-blend-${r}`),regExp:"bg-blend-(\\d+|\\S+)"},blur:{classes:lodashEs.map(["none","sm","md","lg","xl","2xl","3xl"],r=>`blur-${r}`),regExp:"blur-(none|sm|md|lg|xl|2xl|3xl)"},brightness:{classes:lodashEs.map([0,50,75,90,95,100,105,110,125,150,200],r=>`brightness-${r}`),regExp:"brightness-(\\d+)"},contrast:{classes:lodashEs.map([0,50,75,100,125,150,200],r=>`contrast-${r}`),regExp:"contrast-(\\d+)"},grayScale:{classes:["grayscale-0","grayscale"],regExp:"grayscale(-0)?"},hueRotate:{classes:lodashEs.map([0,15,30,60,90,180],r=>`hue-rotate-${r}`),regExp:"-?hue-rotate-(\\d+)"},invert:{classes:["invert-0","invert"],regExp:"invert(-0)?"},saturate:{classes:lodashEs.map([0,50,100,150,200],r=>`saturate-${r}`),regExp:"saturate-(\\d+)"},sepia:{classes:["sepia-0","sepia"],regExp:"sepia(-0)?"},transition:{classes:["transition-none","transition-all","transition-colors","transition-opacity","transition-shadow","transition-transform"],regExp:"transition-(none|all|colors|opacity|shadow|transform)"},duration:{classes:lodashEs.map([75,100,150,200,300,500,700,1e3],r=>`duration-${r}`),regExp:"duration-(\\d+|\\[.*\\])"},transitionEase:{classes:["ease-linear","ease-in","ease-out","ease-in-out"],regExp:"eas(e-linear|e-in|e-out|e-in-out)"},transitionDelay:{classes:lodashEs.map([75,100,150,200,300,500,700,1e3],r=>`delay-${r}`),regExp:"delay-(\\d+|\\[.*\\])"},animation:{classes:["animation-none","animation-spin","animation-ping"],regExp:"animation-(none|spin|ping)"},scaleX:{classes:lodashEs.map(CLASS_VALUES.scale,r=>`scale-x-${r}`),regExp:"-?scale-x-(\\d+|\\S+|\\[.*\\])"},scaleY:{classes:lodashEs.map(CLASS_VALUES.scale,r=>`scale-y-${r}`),regExp:"-?scale-y-(\\d+|\\S+|\\[.*\\])"},scale:{classes:lodashEs.map(CLASS_VALUES.scale,r=>`scale-${r}`),regExp:"-?scale-(\\d+|\\S+|\\[.*\\])"},rotate:{classes:lodashEs.map([0,1,2,3,6,12,45,90,180],r=>`rotate-${r}`),regExp:"-?rotate-(\\d+|\\S+|\\[.*\\])"},translateX:{classes:lodashEs.map([0,"px","0.5",1],r=>`translate-x-${r}`),regExp:"-?translate-x-(\\d+|\\S+|\\[.*\\])"},translateY:{classes:lodashEs.map([0,"px","0.5",1],r=>`translate-y-${r}`),regExp:"-?translate-y-(\\d+|\\S+|\\[.*\\])"},skewX:{classes:lodashEs.map([0,1,2,3,6,12],r=>`skew-x-${r}`),regExp:"-?skew-x-(\\d+|\\S+|\\[.*\\])"},skewY:{classes:lodashEs.map([0,1,2,3,6,12],r=>`skew-y-${r}`),regExp:"-?skew-y-(\\d+|\\S+|\\[.*\\])"},accentColor:{classes:[],regExp:"accent-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},appearance:{classes:["appearance-none"],regExp:"appearance-none"},cursor:{classes:["cursor-auto","cursor-default","cursor-pointer","cursor-wait","cursor-text","cursor-move","cursor-help","cursor-not-allowed"],regExp:"cursor-(auto|default|pointer|wait|text|move|help|not-allowed)"},caretColor:{classes:[],regExp:"caret-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},pointerEvents:{classes:["pointer-events-none","pointer-events-auto"],regExp:"pointer-events-(none|auto)"},userSelect:{classes:["select-none","select-text","select-all","select-auto"],regExp:"select-(none|text|all|auto)"},fill:{classes:[],regExp:"caret-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},stroke:{classes:[],regExp:"caret-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},strokeWidth:{classes:["stroke-0","stroke-1","stroke-2"],regExp:"stroke-(\\d+|\\[.*\\])"}},colorOptions={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},soloColors=["current","inherit","transparent","black","white","primary","secondary"],chaiColors=["primary","secondary"],shadedColors=["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],shades=["50","100","200","300","400","500","600","700","800","900"],colorKeys=lodashEs.map(lodashEs.values(colorOptions),r=>r),ALL_COLORS=lodashEs.flattenDeep([...lodashEs.map(soloColors,r=>lodashEs.flatten(lodashEs.map(colorKeys,n=>`${n}-${r}`))),...lodashEs.map(chaiColors,r=>lodashEs.flattenDeep(lodashEs.map(colorKeys,n=>lodashEs.flattenDeep(lodashEs.map(shades,o=>`${n}-${r}-${o}`))))),...lodashEs.map(shadedColors,r=>lodashEs.flattenDeep(lodashEs.map(colorKeys,n=>lodashEs.flattenDeep(lodashEs.map(shades,o=>`${n}-${r}-${o}`)))))]),ALL_TW_CLASSES=lodashEs.map(lodashEs.flattenDeep(lodashEs.values(CLASSES_LIST).map(r=>r.classes).concat(ALL_COLORS)),r=>({name:r}));function getMqForCls(r){if(lodashEs.isEmpty(r.trim()))return"";const n=r.match(/sm:|md:|lg:|xl:|2xl:/g);return lodashEs.get(n,0,"xs").replace(":","")}function getModForCls(r){const n=lodashEs.map(MODIFIERS,a=>`${a}:`).join("|"),o=new RegExp(n,"g");return lodashEs.get(o.exec(r.trim()),0,"").replace(":","")}function getPureClsName(r){return r.trim().split(":").pop()||""}const memoizedProps={};function getPropertyForClass(r){if(lodashEs.isEmpty(r))return"";if(memoizedProps[r])return memoizedProps[r];let n="";for(const o in CLASSES_LIST){const a=lodashEs.get(CLASSES_LIST,`${o}.regExp`,"");if(new RegExp(a,"g").test(r)){n=o,memoizedProps[r]=n;break}}return n}function constructClassObject(r){return lodashEs.isEmpty(r)?null:{dark:lodashEs.startsWith(r,"dark:"),mq:getMqForCls(r),mod:getModForCls(r),cls:getPureClsName(r),fullCls:r,property:getPropertyForClass(r)}}function generateFullClsName(r){let n="";return r.dark&&(n+="dark:"),r.mq.toLowerCase()!=="xs"&&(n+=`${r.mq}:`),r.mod&&(n+=`${r.mod}:`),n+=r.cls,n}const MEDIA_QUERIES={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},breakpoints=["xs","sm","md","lg","xl","2xl"];function getBelongsToForClass(r,n){if(n===null)return"baseClasses";const o=n.mq;if(o==="xs"||n.dark||n.mod!=="")return"classes";let a="baseClasses",i=breakpoints.indexOf(o);for(;i>0;){const l=breakpoints[i-1];if(lodashEs.find(r,{mq:l,property:n.property})){a="classes";break}i--}return a}const IGNORED_BASES_CLASSES_PROPERTIES=[];function getNewClasses(r="",n="",o=[]){r=r.trim().replace(/ +/g,"");let a=lodashEs.filter(lodashEs.map(r.split(" "),constructClassObject),p=>!lodashEs.isNull(p)),i=lodashEs.filter(lodashEs.map(n.split(" "),constructClassObject),p=>!lodashEs.isNull(p));i=lodashEs.filter(i,p=>!lodashEs.includes(IGNORED_BASES_CLASSES_PROPERTIES,p.property));const l=[],c=[];lodashEs.each(o,p=>{const f=constructClassObject(p),m=lodashEs.find(a,lodashEs.pick(f,["dark","mq","mod","property"]));if(m&&(a=lodashEs.filter(a,h=>h.fullCls!==(m==null?void 0:m.fullCls))),l.push(f),f.mq==="xs"&&!f.dark&&f.mod===""&&(i=lodashEs.filter(i,h=>h.property!==f.property)),getBelongsToForClass(a,f)==="baseClasses"&&!lodashEs.includes(IGNORED_BASES_CLASSES_PROPERTIES,f.property)){const h=lodashEs.find(i,lodashEs.pick(f,["property"]));m&&(i=lodashEs.filter(i,g=>g.fullCls!==(h==null?void 0:h.fullCls))),c.push({...f,fullCls:f.cls,mq:"xs"})}});const u=lodashEs.map(lodashEs.sortBy([...a,...l],p=>MEDIA_QUERIES[p.mq]),"fullCls").join(" ");return`${lodashEs.map(lodashEs.sortBy([...i,...c],p=>MEDIA_QUERIES[p.mq]),"fullCls").join(" ").trim()},${u.trim()}`.trim().replace(/ +/g,"")}const selectedStylingBlocksAtom=jotai.atom([]);selectedStylingBlocksAtom.debugLabel="selectedStylingBlocksAtom";const useSelectedStylingBlocks=()=>jotai.useAtom(selectedStylingBlocksAtom),getSplitClasses$1=r=>{const n=r.replace(STRINGS.STYLES_KEY,"").split(",");return{baseClasses:n[0],classes:n[1]}},addClassesToBlocksAtom=jotai.atom(null,(r,n,{blockIds:o,newClasses:a})=>{const i=lodashEs.filter(r(pageBlocksAtomsAtom),c=>o.includes(r(c)._id)),l=lodashEs.first(r(selectedStylingBlocksAtom));return lodashEs.map(i,c=>{const u=r(c),d=lodashEs.get(u,l.prop,`${STRINGS.STYLES_KEY},`),{baseClasses:p,classes:f}=getSplitClasses$1(d);return{ids:[u._id],props:{[l.prop]:`${STRINGS.STYLES_KEY}${getNewClasses(f,p,a)}`}}})}),useAddClassesToBlocks=()=>{const r=jotai.useSetAtom(addClassesToBlocksAtom),{updateBlocks:n,updateBlocksRuntime:o}=useBlocksStoreUndoableActions();return React.useCallback((a,i,l=!1)=>{const c=r({blockIds:a,newClasses:i});if(!l){o(a,c[0].props);return}n(a,c[0].props)},[r])},useStylingBreakpoint=()=>jotai.useAtom(styleBreakpointAtom),canvasWidthAtom=atomWithStorage("canvasWidth",800),canvasBreakpointAtom=jotai.atom(r=>{const n=r(canvasWidthAtom);return iconBase.getBreakpointValue(n).toLowerCase()}),useCanvasWidth=()=>{const[r,n]=jotai.useAtom(canvasWidthAtom),o=jotai.useAtomValue(canvasBreakpointAtom),[a,i]=useStylingBreakpoint();return React.useEffect(()=>{a!=="xs"&&i(o)},[o,a,i]),[r,o,n]},canvasZoomAtom=atomWithStorage("canvasZoom",100),useCanvasZoom=()=>jotai.useAtom(canvasZoomAtom),cutBlockIdsAtom=jotai.atom([]),useCutBlockIds=()=>{const[r,n]=jotai.useAtom(cutBlockIdsAtom),o=jotai.useSetAtom(copiedBlockIdsAtom),a=React.useCallback(i=>{n(i),o([])},[n,o]);return[r,a]},copiedBlockIdsAtom=jotai.atom([]),useCopyBlockIds=()=>{const[r,n]=jotai.useAtom(copiedBlockIdsAtom),o=jotai.useSetAtom(cutBlockIdsAtom),a=React.useCallback(i=>{n(i),o([])},[n,o]);return[r,a]},darkModeAtom=atomWithStorage("darkMode",!1),useDarkMode=()=>{const[r,n]=jotai.useAtom(darkModeAtom);return[r,n]},useDuplicateBlocks=()=>{const[r]=useBlocksStore(),[,n]=useSelectedBlockIds(),{addBlocks:o}=useBlocksStoreUndoableActions();return React.useCallback((a,i=null)=>{const l=[];lodashEs.each(a,c=>{const u=r.find(h=>h._id===c);i||(i=u._parent);const f=lodashEs.filter(r,h=>lodashEs.isString(i)?h._parent===i:!u._parent).indexOf(u)+1,m=getDuplicatedBlocks(r,c,i);o(m,i,f),l.push(lodashEs.get(m,"0._id",""))}),n(l)},[r,n])},hiddenBlockIdsAtom=jotai.atom([]),useHiddenBlockIds=()=>{const[r,n]=jotai.useAtom(hiddenBlockIdsAtom),o=React.useCallback(a=>{n(i=>lodashEs.includes(i,a)?lodashEs.without(i,a):[...i,a])},[n]);return[r,n,o]},highlightBlockIdAtom=jotai.atom(""),useHighlightBlockId=()=>jotai.useAtom(highlightBlockIdAtom),useCanPaste=()=>{const[r]=useBlocksStore();return(n,o)=>{var l;const a=(l=lodashEs.find(r,{_id:o}))==null?void 0:l._type,i=lodashEs.first(n.map(c=>{var u;return(u=lodashEs.find(r,{_id:c}))==null?void 0:u._type}));return canAcceptChildBlock(a,i)}},useMoveCutBlocks=()=>{const r=jotai.useAtomValue(presentBlocksAtom),{moveBlocks:n}=useBlocksStoreUndoableActions();return React.useCallback((o,a)=>{const i=a[0],l=r.find(u=>u._id===a),c=l?l.children.length:0;n(o,i,c)},[n,r])},usePasteBlocks=()=>{const r=jotai.useAtomValue(copiedBlockIdsAtom),[n,o]=useCutBlockIds(),a=useDuplicateBlocks(),i=useMoveCutBlocks(),l=useCanPaste();return{canPaste:React.useCallback(u=>r.length>0?l(r,u):n.length>0?l(n,u):!1,[l,r,n]),pasteBlocks:React.useCallback(u=>{const d=Array.isArray(u)?u[0]:u;lodashEs.isEmpty(r)?i(n,u):a(r,d),o([])},[n,r,a,i,o])}},previewModeAtom=jotai.atom(!1),usePreviewMode=()=>{const[r,n]=jotai.useAtom(previewModeAtom);return[r,n]},getSplitClasses=r=>{const n=r.replace(STRINGS.STYLES_KEY,"").split(",");return{baseClasses:n[0],classes:n[1]}},removeClassFromBlocksAtom=jotai.atom(null,(r,n,{blockIds:o,fullClasses:a})=>{const i=lodashEs.first(r(selectedStylingBlocksAtom)),l=lodashEs.filter(r(pageBlocksAtomsAtom),c=>o.includes(r(c)._id));return lodashEs.map(l,c=>{const u=r(c),d=a;let{classes:p,baseClasses:f}=getSplitClasses(lodashEs.get(u,i.prop,"styles:,"));return lodashEs.each(d,m=>{const h=m.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),g=new RegExp(`(^| )${h}($| )`,"g");p=p.replace(g," ").replace(/ +/g," ").trim();const y=lodashEs.first(m.split(":"));lodashEs.includes(["2xl","xl","lg","md","sm"],y)&&d.push(m.split(":").pop().trim())}),lodashEs.each(d,m=>{const h=new RegExp(`(^| )${m.replace("[","\\[").replace("]","\\]")}($| )`,"g");f=f.replace(h," ").replace(/ +/g," ").trim()}),{ids:[u._id],props:{[i.prop]:`${STRINGS.STYLES_KEY}${f},${p}`}}})}),useRemoveClassesFromBlocks=()=>{const{updateBlocks:r}=useBlocksStoreUndoableActions(),n=jotai.useSetAtom(removeClassFromBlocksAtom);return React.useCallback((o,a)=>{const i=n({blockIds:o,fullClasses:a});r(o,i[0].props)},[n])},selectedBlockAllClassesAtom=jotai.atom(r=>{const n=lodashEs.first(r(selectedStylingBlocksAtom)),o=r(selectedBlockAtom);if(!n||n.blockId!==lodashEs.get(o,"_id",null))return[];const i=lodashEs.get(o,n.prop,`${STRINGS.STYLES_KEY},`).replace(STRINGS.STYLES_KEY,"").split(",").join(" ");return lodashEs.filter(lodashEs.map(i.trim().split(" "),constructClassObject),l=>!lodashEs.isNull(l))}),useSelectedBlockAllClasses=()=>jotai.useAtomValue(selectedBlockAllClassesAtom),MQ={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},selectedBlockCurrentClassesAtom=jotai.atom(r=>{const n=r(canvasBreakpointAtom),o=r(styleStateAtom),a=r(darkModeAtom),i=getQueries(n);let l=lodashEs.filter(r(selectedBlockAllClassesAtom),{mod:o});return lodashEs.startsWith(o,"_")||(l=lodashEs.filter(l,c=>i.includes(c.mq))),l=l.sort((c,u)=>MQ[c.mq]-MQ[u.mq]),a||(l=lodashEs.filter(l,{dark:!1})),l}),getQueries=r=>{let n=[];switch(r){case"xs":n=["xs"];break;case"sm":n=["xs","sm"];break;case"md":n=["xs","sm","md"];break;case"lg":n=["xs","sm","md","lg"];break;case"xl":n=["xs","sm","md","lg","xl"];break;case"2xl":n=["xs","sm","md","lg","xl","2xl"];break;default:n=["xs"];break}return n},useSelectedBlockCurrentClasses=()=>jotai.useAtomValue(selectedBlockCurrentClassesAtom),useStylingState=()=>jotai.useAtom(styleStateAtom),useUpdateBlocksProps=()=>{const{updateBlocks:r}=useBlocksStoreUndoableActions();return React.useCallback((n,o,a)=>{r(n,o,a)},[r])},useUpdateMultipleBlocksProps=()=>{const{updateMultipleBlocksProps:r}=useBlocksStoreUndoableActions();return React.useCallback(n=>{r(n)},[r])},useFakeStreamEffect=()=>{const{updateBlocksRuntime:r}=useBlocksStoreUndoableActions();return React.useCallback(async(n,o,a=30)=>{const i=lodashEs.keys(lodashEs.omit(o,["_id"]));for(const l of i){const c=o[l];if(lodashEs.isString(c)){const u=lodashEs.chunk(c.split(""),12);let d="";r([n],{[l]:""});for(let p=0;p<u.length;p++)d+=u[p].join(""),r([n],{[l]:d}),await new Promise(f=>setTimeout(f,a))}}},[r])},useStreamMultipleBlocksProps=()=>{const{updateMultipleBlocksProps:r}=useBlocksStoreUndoableActions(),n=useFakeStreamEffect();return React.useCallback(async o=>{for(const a of o)await n(a._id,a);r(o)},[r])},useUpdateBlocksPropsRealtime=()=>{const{updateBlocksRuntime:r}=useBlocksStoreUndoableActions();return React.useCallback((n,o)=>{r(n,o)},[r])},defaultProps$F={name:"",props:{},modalProps:{},backdropClose:!0},activeModalAtom=jotai.atom(defaultProps$F),useActiveModal=()=>{const[r,n]=jotai.useAtom(activeModalAtom),o=React.useCallback((i,l={},c={})=>{n({name:i,props:l,modalProps:c})},[n]),a=React.useCallback((...i)=>{lodashEs.get(r,"props.onClose",()=>{})(...i),n(defaultProps$F)},[n,r]);return{activeModal:r,openModal:o,closeModal:a}},useAllBlocks=()=>(console.warn("useAllBlocks is deprecated, use useBlocksStore() instead"),jotai.useAtomValue(presentBlocksAtom)),readOnlyModeAtom=jotai.atom(!1);readOnlyModeAtom.debugLabel="readOnlyModeAtom";const networkModeAtom=jotai.atom("online");networkModeAtom.debugLabel="networkModeAtom";jotai.atom("");const editLayerNameAtom=jotai.atom(!1);editLayerNameAtom.debugLabel="editLayerNameAtom";const activeLanguageAtom=jotai.atom("");activeLanguageAtom.debugLabel="activeLanguageAtom";const primaryLanguageAtom=jotai.atom("");primaryLanguageAtom.debugLabel="primaryLanguageAtom";const canvasIframeAtom=jotai.atom(null);canvasIframeAtom.debugLabel="canvasIframeAtom";const activePanelAtom$1=jotai.atom("outline");activePanelAtom$1.debugLabel="activePanelAtom";const showPredefinedBlockCategoryAtom=jotai.atom("");showPredefinedBlockCategoryAtom.debugLabel="showPredefinedBlockCategoryAtom";const historyStatesAtom=jotai.atom({undoCount:0,redoCount:0});historyStatesAtom.debugLabel="historyStatesAtom";const inlineEditingActiveAtom=jotai.atom("");inlineEditingActiveAtom.debugLabel="inlineEditingActiveAtom";const draggingFlagAtom=jotai.atom(!1);draggingFlagAtom.debugLabel="draggingFlagAtom";const treeRefAtom=jotai.atom(null);treeRefAtom.debugLabel="treeRefAtom";const canvasSettingsAtom=jotai.atom({});canvasSettingsAtom.debugLabel="canvasSettingsAtom";const aiAssistantActiveAtom=jotai.atom(!1);aiAssistantActiveAtom.debugLabel="askAiActiveBlockAtom";const codeEditorOpenAtom=jotai.atom(!1);codeEditorOpenAtom.debugLabel="codeEditorOpenAtom";const codeEditorHeightAtom=atomWithStorage("codeEditorHeight",500);codeEditorHeightAtom.debugLabel="codeEditorHeightAtom";const xShowBlocksAtom=jotai.atom([]);xShowBlocksAtom.debugLabel="xShowBlocksAtom";const selectedLibraryAtom=atomWithStorage("_selectedLibrary",null);selectedLibraryAtom.debugLabel="selectedLibraryAtom";const useReadOnlyMode=()=>jotai.useAtomValue(readOnlyModeAtom),activePanelAtom=jotai.atom(""),parentBlockIdAtom=jotai.atom(null),useActivePanel=()=>jotai.useAtom(activePanelAtom),useAddBlockParent=()=>jotai.useAtom(parentBlockIdAtom),selectedBreakpointsAtom=atomWithStorage("selectedBreakpoints",["XS","MD","XL"]),useSelectedBreakpoints=()=>{const[r,n]=jotai.useAtom(selectedBreakpointsAtom);return[r,n]},useBuilderReset=()=>{const r=jotai.useSetAtom(historyStatesAtom),{clear:n}=useUndoManager(),[,o]=useSelectedBlockIds(),[,a]=useHighlightBlockId(),[,i]=useSelectedStylingBlocks(),[,l]=useAtom(aiAssistantActiveAtom);return()=>{o([]),i([]),a(""),n(),l(!1),r({undoCount:0,redoCount:0})}},useUILibraryBlocks=()=>({data:useBuilderProp("uiLibraries",[]),isLoading:!1}),useCopyToClipboard=()=>{const[r,n]=React.useState(null),o=React.useCallback(async a=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(a),n(a),!0}catch(i){return console.warn("Copy failed",i),n(null),!1}},[]);return[r,o]},codeEditorAtom=jotai.atom(null),useCodeEditor=()=>jotai.useAtom(codeEditorAtom),LAYOUT_MODE={SINGLE_SIDE_PANEL:"SINGLE_SIDE_PANEL",DUAL_SIDE_PANEL:"DUAL_SIDE_PANEL",DUAL_SIDE_PANEL_ADVANCED:"DUAL_SIDE_PANEL_ADVANCED"},layoutVariantAtom=atomWithStorage("__layout_variant_mode",LAYOUT_MODE.DUAL_SIDE_PANEL),useLayoutVariant=()=>{const[r,n]=jotai.useAtom(layoutVariantAtom),o=useBuilderProp("layoutVariant",LAYOUT_MODE.DUAL_SIDE_PANEL);return[r||o,n]},IframeInitialContent=`<!doctype html>
1
+ "use strict";var dt=Object.defineProperty;var pt=(r,n,o)=>n in r?dt(r,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[n]=o;var De=(r,n,o)=>(pt(r,typeof n!="symbol"?n+"":n,o),o);const jsxRuntime=require("./jsx-runtime-JYMCiFoE.cjs"),React=require("react"),contextMenu=require("./context-menu--DZnHfxj.cjs"),lodashEs=require("lodash-es"),jotai=require("jotai"),iconBase=require("./iconBase-vJD0OXxU.cjs"),runtime=require("@chaibuilder/runtime"),reactI18next=require("react-i18next"),plugin=require("./plugin-_F-KZp1i.cjs"),web=require("@react-hookz/web"),TreeModel=require("tree-model"),ReactQuill=require("react-quill"),STRINGS=require("./STRINGS-Yl7cSWDc.cjs"),flagged=require("flagged"),reactHotkeysHook=require("react-hotkeys-hook"),dom=require("@floating-ui/dom"),reactDom=require("@floating-ui/react-dom"),reactIcons=require("@radix-ui/react-icons"),reactEventHook=require("react-event-hook"),typography$1=require("@tailwindcss/typography"),forms=require("@tailwindcss/forms"),aspectRatio=require("@tailwindcss/aspect-ratio"),getPalette=require("tailwindcss-palette-generator"),tailwindMerge=require("tailwind-merge"),reactWrapBalancer=require("react-wrap-balancer"),ReactDOM=require("react-dom"),PropTypes=require("prop-types"),reactErrorBoundary=require("react-error-boundary"),reResizable=require("re-resizable"),lucideReact=require("lucide-react"),validator=require("@rjsf/validator-ajv8"),Form=require("@rjsf/core"),reactArborist=require("react-arborist"),himalaya=require("himalaya"),IconPicker=require("react-icons-picker"),Autosuggest=require("react-autosuggest"),Fuse=require("fuse.js"),clsx=require("clsx"),i18n=require("i18next"),ScrollAreaPrimitive=require("@radix-ui/react-scroll-area"),framerMotion=require("framer-motion");function _interopNamespaceDefault(r){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const a=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(n,o,a.get?a:{enumerable:!0,get:()=>r[o]})}}return n.default=r,Object.freeze(n)}const React__namespace=_interopNamespaceDefault(React),ScrollAreaPrimitive__namespace=_interopNamespaceDefault(ScrollAreaPrimitive),canAcceptChildBlock=(r,n)=>{if(!r)return!0;const o=runtime.getBlockComponent(r);return o&&lodashEs.has(o,"canAcceptBlock")?o.canAcceptBlock(n):!1},canAddChildBlock=r=>{const n=runtime.getBlockComponent(r);return n?lodashEs.has(n,"canAcceptBlock"):!1},canBeNestedInside=(r,n)=>{const o=runtime.getBlockComponent(n);return o&&lodashEs.has(o,"canBeNested")?o.canBeNested(r):!0},canDuplicateBlock=r=>{const n=runtime.getBlockComponent(r);return n&&lodashEs.has(n,"canDuplicate")?n.canDuplicate():!0},canDeleteBlock=r=>{const n=runtime.getBlockComponent(r);return n&&lodashEs.has(n,"canDelete")?n.canDelete():!0};var define_import_meta_env_default$2={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};let keyCount=0;function atom(r,n){const o=`atom${++keyCount}`,a={toString:()=>o};return typeof r=="function"?a.read=r:(a.init=r,a.read=i=>i(a),a.write=(i,l,c)=>l(a,typeof c=="function"?c(i(a)):c)),n&&(a.write=n),a}const hasInitialValue=r=>"init"in r,isActuallyWritableAtom=r=>!!r.write,cancelPromiseMap=new WeakMap,registerCancelPromise=(r,n)=>{cancelPromiseMap.set(r,n),r.catch(()=>{}).finally(()=>cancelPromiseMap.delete(r))},cancelPromise=(r,n)=>{const o=cancelPromiseMap.get(r);o&&(cancelPromiseMap.delete(r),o(n))},resolvePromise=(r,n)=>{r.status="fulfilled",r.value=n},rejectPromise=(r,n)=>{r.status="rejected",r.reason=n},isPromiseLike$2=r=>typeof(r==null?void 0:r.then)=="function",isEqualAtomValue=(r,n)=>"v"in r&&"v"in n&&Object.is(r.v,n.v),isEqualAtomError=(r,n)=>"e"in r&&"e"in n&&Object.is(r.e,n.e),hasPromiseAtomValue=r=>"v"in r&&r.v instanceof Promise,isEqualPromiseAtomValue=(r,n)=>"v"in r&&"v"in n&&r.v.orig&&r.v.orig===n.v.orig,returnAtomValue=r=>{if("e"in r)throw r.e;return r.v},createStore=()=>{const r=new WeakMap,n=new WeakMap,o=new Map;let a,i,l;(define_import_meta_env_default$2?"production":void 0)!=="production"&&(a=new Set,i=new Set,l=new Set);const c=j=>r.get(j),u=(j,I)=>{(define_import_meta_env_default$2?"production":void 0)!=="production"&&Object.freeze(I);const P=r.get(j);if(r.set(j,I),o.has(j)||o.set(j,P),P&&hasPromiseAtomValue(P)){const O="v"in I?I.v instanceof Promise?I.v:Promise.resolve(I.v):Promise.reject(I.e);cancelPromise(P.v,O)}},d=(j,I,P)=>{const O=new Map;let B=!1;P.forEach((N,F)=>{!N&&F===j&&(N=I),N?(O.set(F,N),I.d.get(F)!==N&&(B=!0)):(define_import_meta_env_default$2?"production":void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(B||I.d.size!==O.size)&&(I.d=O)},p=(j,I,P)=>{const O=c(j),B={d:(O==null?void 0:O.d)||new Map,v:I};if(P&&d(j,B,P),O&&isEqualAtomValue(O,B)&&O.d===B.d)return O;if(O&&hasPromiseAtomValue(O)&&hasPromiseAtomValue(B)&&isEqualPromiseAtomValue(O,B)){if(O.d===B.d)return O;B.v=O.v}return u(j,B),B},f=(j,I,P,O)=>{if(isPromiseLike$2(I)){let B;const N=new Promise((F,H)=>{let V=!1;I.then(D=>{if(!V){V=!0;const z=c(j),Z=p(j,N,P);resolvePromise(N,D),F(D),(z==null?void 0:z.d)!==Z.d&&A(j,Z,z==null?void 0:z.d)}},D=>{if(!V){V=!0;const z=c(j),Z=p(j,N,P);rejectPromise(N,D),H(D),(z==null?void 0:z.d)!==Z.d&&A(j,Z,z==null?void 0:z.d)}}),B=D=>{V||(V=!0,D.then(z=>resolvePromise(N,z),z=>rejectPromise(N,z)),F(D))}});return N.orig=I,N.status="pending",registerCancelPromise(N,F=>{F&&B(F),O==null||O()}),p(j,N,P)}return p(j,I,P)},m=(j,I,P)=>{const O=c(j),B={d:(O==null?void 0:O.d)||new Map,e:I};return P&&d(j,B,P),O&&isEqualAtomError(O,B)&&O.d===B.d?O:(u(j,B),B)},h=j=>{const I=c(j);if(I&&(I.d.forEach((V,D)=>{D!==j&&!n.has(D)&&h(D)}),Array.from(I.d).every(([V,D])=>{const z=c(V);return V===j||z===D||z&&!hasPromiseAtomValue(z)&&isEqualAtomValue(z,D)})))return I;const P=new Map;let O=!0;const B=V=>{if(V===j){const z=c(V);if(z)return P.set(V,z),returnAtomValue(z);if(hasInitialValue(V))return P.set(V,void 0),V.init;throw new Error("no atom init")}const D=h(V);return P.set(V,D),returnAtomValue(D)};let N,F;const H={get signal(){return N||(N=new AbortController),N.signal},get setSelf(){return(define_import_meta_env_default$2?"production":void 0)!=="production"&&!isActuallyWritableAtom(j)&&console.warn("setSelf function cannot be used with read-only atom"),!F&&isActuallyWritableAtom(j)&&(F=(...V)=>{if((define_import_meta_env_default$2?"production":void 0)!=="production"&&O&&console.warn("setSelf function cannot be called in sync"),!O)return S(j,...V)}),F}};try{const V=j.read(B,H);return f(j,V,P,()=>N==null?void 0:N.abort())}catch(V){return m(j,V,P)}finally{O=!1}},g=j=>returnAtomValue(h(j)),y=j=>{let I=n.get(j);return I||(I=w(j)),I},b=(j,I)=>!I.l.size&&(!I.t.size||I.t.size===1&&I.t.has(j)),v=j=>{const I=n.get(j);I&&b(j,I)&&R(j)},x=j=>{const I=new Map,P=new WeakMap,O=N=>{const F=n.get(N);F==null||F.t.forEach(H=>{H!==N&&(I.set(H,(I.get(H)||new Set).add(N)),P.set(H,(P.get(H)||0)+1),O(H))})};O(j);const B=N=>{const F=n.get(N);F==null||F.t.forEach(H=>{var V;if(H!==N){let D=P.get(H);if(D&&P.set(H,--D),!D){let z=!!((V=I.get(H))!=null&&V.size);if(z){const Z=c(H),Q=h(H);z=!Z||!isEqualAtomValue(Z,Q)}z||I.forEach(Z=>Z.delete(H))}B(H)}})};B(j)},E=(j,...I)=>{let P=!0;const O=F=>returnAtomValue(h(F)),B=(F,...H)=>{let V;if(F===j){if(!hasInitialValue(F))throw new Error("atom not writable");const D=c(F),z=f(F,H[0]);(!D||!isEqualAtomValue(D,z))&&x(F)}else V=E(F,...H);if(!P){const D=C();(define_import_meta_env_default$2?"production":void 0)!=="production"&&i.forEach(z=>z({type:"async-write",flushed:D}))}return V},N=j.write(O,B,...I);return P=!1,N},S=(j,...I)=>{const P=E(j,...I),O=C();return(define_import_meta_env_default$2?"production":void 0)!=="production"&&i.forEach(B=>B({type:"write",flushed:O})),P},w=(j,I)=>{const P={t:new Set(I&&[I]),l:new Set};if(n.set(j,P),(define_import_meta_env_default$2?"production":void 0)!=="production"&&l.add(j),h(j).d.forEach((O,B)=>{const N=n.get(B);N?N.t.add(j):B!==j&&w(B,j)}),h(j),isActuallyWritableAtom(j)&&j.onMount){const O=j.onMount((...B)=>S(j,...B));O&&(P.u=O)}return P},R=j=>{var I;const P=(I=n.get(j))==null?void 0:I.u;P&&P(),n.delete(j),(define_import_meta_env_default$2?"production":void 0)!=="production"&&l.delete(j);const O=c(j);O?(hasPromiseAtomValue(O)&&cancelPromise(O.v),O.d.forEach((B,N)=>{if(N!==j){const F=n.get(N);F&&(F.t.delete(j),b(N,F)&&R(N))}})):(define_import_meta_env_default$2?"production":void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",j)},A=(j,I,P)=>{const O=new Set(I.d.keys());P==null||P.forEach((B,N)=>{if(O.has(N)){O.delete(N);return}const F=n.get(N);F&&(F.t.delete(j),b(N,F)&&R(N))}),O.forEach(B=>{const N=n.get(B);N?N.t.add(j):n.has(j)&&w(B,j)})},C=()=>{let j;for((define_import_meta_env_default$2?"production":void 0)!=="production"&&(j=new Set);o.size;){const I=Array.from(o);o.clear(),I.forEach(([P,O])=>{const B=c(P);if(B){B.d!==(O==null?void 0:O.d)&&A(P,B,O==null?void 0:O.d);const N=n.get(P);N&&!(O&&!hasPromiseAtomValue(O)&&(isEqualAtomValue(O,B)||isEqualAtomError(O,B)))&&(N.l.forEach(F=>F()),(define_import_meta_env_default$2?"production":void 0)!=="production"&&j.add(P))}else(define_import_meta_env_default$2?"production":void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if((define_import_meta_env_default$2?"production":void 0)!=="production")return a.forEach(I=>I("state")),j},k=(j,I)=>{const P=y(j),O=C(),B=P.l;return B.add(I),(define_import_meta_env_default$2?"production":void 0)!=="production"&&(a.forEach(N=>N("sub")),i.forEach(N=>N({type:"sub",flushed:O}))),()=>{B.delete(I),v(j),(define_import_meta_env_default$2?"production":void 0)!=="production"&&(a.forEach(N=>N("unsub")),i.forEach(N=>N({type:"unsub"})))}};return(define_import_meta_env_default$2?"production":void 0)!=="production"?{get:g,set:S,sub:k,dev_subscribe_store:(j,I)=>I!==2?(console.warn("The current StoreListener revision is 2. The older ones are deprecated."),a.add(j),()=>{a.delete(j)}):(i.add(j),()=>{i.delete(j)}),dev_get_mounted_atoms:()=>l.values(),dev_get_atom_state:j=>r.get(j),dev_get_mounted:j=>n.get(j),dev_restore_atoms:j=>{for(const[P,O]of j)hasInitialValue(P)&&(f(P,O),x(P));const I=C();i.forEach(P=>P({type:"restore",flushed:I}))}}:{get:g,set:S,sub:k}};let defaultStore;const getDefaultStore=()=>(defaultStore||(defaultStore=createStore()),defaultStore);var define_import_meta_env_default$1={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const RESET=Symbol(),getCached$1=(r,n,o)=>(n.has(o)?n:n.set(o,r())).get(o),cache1$2=new WeakMap,memo2$1=(r,n,o)=>{const a=getCached$1(()=>new WeakMap,cache1$2,n);return getCached$1(r,a,o)},cacheKeyForEmptyKeyExtractor={},isWritable=r=>!!r.write,isFunction$1=r=>typeof r=="function";function splitAtom(r,n){return memo2$1(()=>{const o=new WeakMap,a=(c,u)=>{let d=o.get(c);if(d)return d;const p=u&&o.get(u),f=[],m=[];return c.forEach((h,g)=>{const y=n?n(h):g;m[g]=y;const b=p&&p.atomList[p.keyList.indexOf(y)];if(b){f[g]=b;return}const v=E=>{const S=E(i),w=E(r),A=a(w,S==null?void 0:S.arr).keyList.indexOf(y);if(A<0||A>=w.length){const C=c[a(c).keyList.indexOf(y)];if(C)return C;throw new Error("splitAtom: index out of bounds for read")}return w[A]},x=(E,S,w)=>{const R=E(i),A=E(r),k=a(A,R==null?void 0:R.arr).keyList.indexOf(y);if(k<0||k>=A.length)throw new Error("splitAtom: index out of bounds for write");const j=isFunction$1(w)?w(A[k]):w;S(r,[...A.slice(0,k),j,...A.slice(k+1)])};f[g]=isWritable(r)?atom(v,x):atom(v)}),p&&p.keyList.length===m.length&&p.keyList.every((h,g)=>h===m[g])?d=p:d={arr:c,atomList:f,keyList:m},o.set(c,d),d},i=atom(c=>{const u=c(i),d=c(r);return a(d,u==null?void 0:u.arr)});(define_import_meta_env_default$1?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.init=void 0;const l=isWritable(r)?atom(c=>c(i).atomList,(c,u,d)=>{switch(d.type){case"remove":{const p=c(l).indexOf(d.atom);if(p>=0){const f=c(r);u(r,[...f.slice(0,p),...f.slice(p+1)])}break}case"insert":{const p=d.before?c(l).indexOf(d.before):c(l).length;if(p>=0){const f=c(r);u(r,[...f.slice(0,p),d.value,...f.slice(p)])}break}case"move":{const p=c(l).indexOf(d.atom),f=d.before?c(l).indexOf(d.before):c(l).length;if(p>=0&&f>=0){const m=c(r);p<f?u(r,[...m.slice(0,p),...m.slice(p+1,f),m[p],...m.slice(f)]):u(r,[...m.slice(0,f),m[p],...m.slice(f,p),...m.slice(p+1)])}break}}}):atom(c=>c(i).atomList);return l},r,n||cacheKeyForEmptyKeyExtractor)}function atomWithDefault(r){const n=Symbol(),o=atom(n);(define_import_meta_env_default$1?"production":void 0)!=="production"&&(o.debugPrivate=!0);const a=atom((i,l)=>{const c=i(o);return c!==n?c:r(i,l)},(i,l,c)=>{if(c===RESET)l(o,n);else if(typeof c=="function"){const u=i(a);l(o,c(u))}else l(o,c)});return a}const isPromiseLike$1=r=>typeof(r==null?void 0:r.then)=="function";function createJSONStorage(r){let n,o;const a={getItem:(i,l)=>{var c,u;const d=f=>{if(f=f||"",n!==f){try{o=JSON.parse(f)}catch{return l}n=f}return o},p=(u=(c=r())==null?void 0:c.getItem(i))!=null?u:null;return isPromiseLike$1(p)?p.then(d):d(p)},setItem:(i,l)=>{var c;return(c=r())==null?void 0:c.setItem(i,JSON.stringify(l))},removeItem:i=>{var l;return(l=r())==null?void 0:l.removeItem(i)}};return typeof window<"u"&&typeof window.addEventListener=="function"&&(a.subscribe=(i,l,c)=>{if(!(r()instanceof window.Storage))return()=>{};const u=d=>{if(d.storageArea===r()&&d.key===i){let p;try{p=JSON.parse(d.newValue||"")}catch{p=c}l(p)}};return window.addEventListener("storage",u),()=>{window.removeEventListener("storage",u)}}),a}const defaultStorage$1=createJSONStorage(()=>typeof window<"u"?window.localStorage:void 0);function atomWithStorage(r,n,o=defaultStorage$1,a){const i=a==null?void 0:a.unstable_getOnInit,l=atom(i?o.getItem(r,n):n);return(define_import_meta_env_default$1?"production":void 0)!=="production"&&(l.debugPrivate=!0),l.onMount=u=>{i||u(o.getItem(r,n));let d;return o.subscribe&&(d=o.subscribe(r,u,n)),d},atom(u=>u(l),(u,d,p)=>{const f=typeof p=="function"?p(u(l)):p;return f===RESET?(d(l,n),o.removeItem(r)):f instanceof Promise?f.then(m=>(d(l,m),o.setItem(r,m))):(d(l,f),o.setItem(r,f))})}var define_import_meta_env_default={VITE_OPENAI_API_KEY:"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",VITE_UNSPASH_ACCESS_KEY:"XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const StoreContext=React.createContext(void 0),useStore=r=>{const n=React.useContext(StoreContext);return(r==null?void 0:r.store)||n||getDefaultStore()},isPromiseLike=r=>typeof(r==null?void 0:r.then)=="function",use$1=React.use||(r=>{if(r.status==="pending")throw r;if(r.status==="fulfilled")return r.value;throw r.status==="rejected"?r.reason:(r.status="pending",r.then(n=>{r.status="fulfilled",r.value=n},n=>{r.status="rejected",r.reason=n}),r)});function useAtomValue(r,n){const o=useStore(n),[[a,i,l],c]=React.useReducer(p=>{const f=o.get(r);return Object.is(p[0],f)&&p[1]===o&&p[2]===r?p:[f,o,r]},void 0,()=>[o.get(r),o,r]);let u=a;(i!==o||l!==r)&&(c(),u=o.get(r));const d=n==null?void 0:n.delay;return React.useEffect(()=>{const p=o.sub(r,()=>{if(typeof d=="number"){setTimeout(c,d);return}c()});return c(),p},[o,r,d]),React.useDebugValue(u),isPromiseLike(u)?use$1(u):u}function useSetAtom(r,n){const o=useStore(n);return React.useCallback((...i)=>{if((define_import_meta_env_default?"production":void 0)!=="production"&&!("write"in r))throw new Error("not writable atom");return o.set(r,...i)},[o,r])}function useAtom(r,n){return[useAtomValue(r,n),useSetAtom(r,n)]}function duplicateBlocks(r,n,o){const a=lodashEs.filter(r,l=>l._parent===n),i=[];for(let l=0;l<a.length;l++){const c=getSlots$1(a[l]);if(Object.keys(c).length>0&&Object.keys(c).forEach(u=>{a[l][u]=`slot:${iconBase.generateUUID()}`}),lodashEs.filter(r,{_parent:a[l]._id}).length>0){const u=iconBase.generateUUID();i.push({...a[l],oldId:a[l]._id,_id:u,_parent:o}),i.push(lodashEs.flatten(duplicateBlocks(r,a[l]._id,u)))}else i.push({...a[l],oldId:a[l]._id,_id:iconBase.generateUUID(),_parent:o})}return lodashEs.flatten(i)}function convertToBlocksTree(r){const n={};r.forEach(a=>{n[a._id]={...a,children:[]}});const o=[];return r.forEach(a=>{if(a._parent){const i=n[a._parent];i&&i.children.push(n[a._id])}else o.push(n[a._id])}),o}const getSlots$1=r=>{const n={};return Object.keys(r).forEach(o=>{lodashEs.isString(r[o])&&r[o].startsWith("slot")&&(n[o]=r[o].replace("slot:",""))}),n},getDuplicatedBlocks=(r,n,o=null)=>{let a=lodashEs.find(r,{_id:n});a={...a,oldId:a._id,_id:iconBase.generateUUID()},o&&(a={...a,_parent:o});const i=[a];lodashEs.filter(r,{_parent:n}).length>0&&i.push(lodashEs.flatten(duplicateBlocks(r,n,a._id)));const l=lodashEs.flatten(i);return lodashEs.map(l,c=>{const u=c,d=getSlots$1(u);return Object.keys(d).length>0&&Object.keys(d).forEach(p=>{const f=lodashEs.find(l,{oldId:d[p].replace("slot:","")});u[p]=`slot:${f._id}`}),lodashEs.omit(u,["global","oldId"])})},presentBlocksAtom=jotai.atom([]);presentBlocksAtom.debugLabel="presentBlocksAtom";const treeDSBlocks=jotai.atom(r=>{const n=r(presentBlocksAtom);return convertToBlocksTree([...n])});treeDSBlocks.debugLabel="treeDSBlocks";presentBlocksAtom.debugLabel="presentBlocksAtom";const pageBlocksAtomsAtom=splitAtom(presentBlocksAtom);pageBlocksAtomsAtom.debugLabel="pageBlocksAtomsAtom";const builderActivePageAtom=jotai.atom("");builderActivePageAtom.debugLabel="builderActivePageAtom";const destinationDropIndexAtom=jotai.atom(-1);destinationDropIndexAtom.debugLabel="destinationDropIndexAtom";const buildingBlocksAtom=jotai.atom([]);buildingBlocksAtom.debugLabel="buildingBlocksAtom";const globalBlocksAtom=jotai.atom(r=>{const n=r(buildingBlocksAtom);return lodashEs.filter(n,o=>lodashEs.has(o,"blockId"))});globalBlocksAtom.debugLabel="globalBlocksAtom";const selectedBlockIdsAtom=jotai.atom([]);selectedBlockIdsAtom.debugLabel="selectedBlockIdsAtom";const selectedBlocksAtom=jotai.atom(r=>{const n=r(presentBlocksAtom),o=r(selectedBlockIdsAtom);return lodashEs.map(lodashEs.filter(n,({_id:a})=>lodashEs.includes(o,a)),a=>({...a}))});selectedBlocksAtom.debugLabel="selectedBlocksAtom";const selectedBlockAtom=jotai.atom(r=>{const n=r(selectedBlocksAtom);if(n.length===0)return null;if(n.length===1)return n[0]});selectedBlockAtom.debugLabel="selectedBlockAtom";const getParentId=r=>lodashEs.get(r,"_parent",null),selectedBlocksParentsAtom=jotai.atom(r=>{const n=r(selectedBlocksAtom),o=lodashEs.map(n,getParentId);return lodashEs.filter(r(presentBlocksAtom),a=>lodashEs.includes(o,a._id))});selectedBlocksParentsAtom.debugLabel="selectedBlocksParentsAtom";const selectedBlockFlexChildAtom=jotai.atom(()=>!1);selectedBlockFlexChildAtom.debugLabel="selectedBlockFlexChildAtom";const selectedBlockGridChildAtom=jotai.atom(()=>!1);selectedBlockGridChildAtom.debugLabel="selectedBlockGridChildAtom";const styleStateAtom=jotai.atom("");styleStateAtom.debugLabel="styleStateAtom";const styleBreakpointAtom=atomWithStorage("styleBreakpoint","xs");styleBreakpointAtom.debugLabel="styleBreakpointAtom";const useSelectedBlocksDisplayChild=()=>({flexChild:jotai.useAtomValue(selectedBlockFlexChildAtom),gridChild:jotai.useAtomValue(selectedBlockGridChildAtom)}),useSelectedBlock=()=>jotai.useAtomValue(selectedBlockAtom),selectedBlockHierarchy=jotai.atom(r=>{const n=r(selectedBlockAtom),o=r(presentBlocksAtom);let a=n;const i=[n];do{const l=o.find(({_id:c})=>c===(a==null?void 0:a._parent));a=l,l&&i.push(l)}while(a!=null&&a._parent);return i}),useSelectedBlockHierarchy=()=>lodashEs.compact(jotai.useAtomValue(selectedBlockHierarchy)),useSelectedBlockIds=()=>{const[r,n]=jotai.useAtom(selectedBlockIdsAtom),o=React.useCallback(a=>{n(i=>lodashEs.includes(i,a)?lodashEs.without(i,a):[...i,a])},[n]);return[r,n,o]},getBlockJSONFromUISchemas=r=>{switch(r.type){case"singular":return r.uiSchema;case"model":const{properties:n}=r,o={};return Object.keys(n).forEach(l=>{const c=n[l];if(lodashEs.includes(["slot","styles"],c.type))return;const u=l;o[u]=getBlockJSONFromUISchemas(c)}),o;case"list":const{itemProperties:a}=r,i={items:{}};return Object.keys(a).forEach(l=>{const c=a[l];if(lodashEs.includes(["slot","styles"],c.type))return;const u=l;i.items[u]=getBlockJSONFromUISchemas(c)}),i;default:return{}}},getBlockJSONFromSchemas=(r,n)=>{switch(r.type){case"singular":{const d=r.schema;return d.title&&(d.title=n(d.title)),d.oneOf&&Array.isArray(d.oneOf)&&(d.oneOf=d.oneOf.map(p=>(p.title&&(p.title=n(p.title)),p))),d}case"model":const{properties:o,title:a}=r,i={title:n(a),type:"object",properties:{}};return Object.keys(o).forEach(d=>{const p=o[d];if(lodashEs.includes(["slot","styles"],p.type))return;const f=d;i.properties[f]=getBlockJSONFromSchemas(p,n)}),i;case"list":const{itemProperties:l,title:c}=r,u={title:n(c),type:"array",items:{type:"object",properties:{}}};return Object.keys(l).forEach(d=>{const p=l[d];if(lodashEs.includes(["slot","styles"],p.type))return;const f=d;u.items.properties[f]=getBlockJSONFromSchemas(p,n),lodashEs.set(u.items,"title",lodashEs.get(p,"itemTitle",`${n(c)} item`))}),u;default:return{}}},getBlockDefaultProps=r=>{if(!r)return{};const n={};return Object.keys(r).forEach(o=>{n[o]=getBlockDefaultProp(r[o])}),n},getListDefaults=r=>{if(lodashEs.isEmpty(r.default))return[];const{itemProperties:n}=r;return lodashEs.map(r.default,o=>{const a={...o};return lodashEs.forIn(o,(i,l)=>{lodashEs.has(n,l)&&lodashEs.get(n[l],"i18n",!1)&&(a[l]=STRINGS.I18N_KEY)}),a})},getBlockDefaultProp=r=>{switch(r.type){case"styles":return r.default;case"slot":return`${STRINGS.SLOT_KEY}${iconBase.generateUUID()}`;case"singular":const{schema:n}=r;return lodashEs.get(n,"default","");case"model":return getBlockDefaultProps(r.properties);case"list":return getListDefaults(r);default:return""}},convertDotNotationToObject=(r,n)=>{const o={};return lodashEs.set(o,r,n),o};var undomanager={exports:{}};(function(r){(function(){function n(a,i,l){return a.splice(i,!l||1+l-i+(!(l<0^i>=0)&&(l<0||-1)*a.length)),a.length}let o=function(){let a=[],i=-1,l=0,c=!1,u;function d(p,f){return!p||typeof p[f]!="function"?this:(c=!0,p[f](),c=!1,this)}return{add:function(p){return c?this:(a.splice(i+1,a.length-i),a.push(p),l&&a.length>l&&n(a,0,-(l+1)),i=a.length-1,u&&u(),this)},setCallback:function(p){u=p},undo:function(){let p=a[i];if(!p)return this;const f=p.groupId;for(;p.groupId===f&&(d(p,"undo"),i-=1,p=a[i],!(!p||!p.groupId)););return u&&u(),this},redo:function(){let p=a[i+1];if(!p)return this;const f=p.groupId;for(;p.groupId===f&&(d(p,"redo"),i+=1,p=a[i+1],!(!p||!p.groupId)););return u&&u(),this},clear:function(){let p=a.length;a=[],i=-1,u&&p>0&&u()},hasUndo:function(){return i!==-1},hasRedo:function(){return i<a.length-1},getCommands:function(p){return p?a.filter(f=>f.groupId===p):a},getIndex:function(){return i},setLimit:function(p){l=p}}};r.exports?r.exports=o:window.UndoManager=o})()})(undomanager);var undomanagerExports=undomanager.exports;const UndoManager=plugin.getDefaultExportFromCjs(undomanagerExports),MODIFIERS=["hover","focus","focus-within","focus-visible","active","visited","target","first","last","only","odd","even","first-of-type","last-of-type","only-of-type","empty","disabled","checked","indeterminate","default","required","valid","invalid","in-range","out-of-range","placeholder-shown","autofill","read-only","open","before","after","first-letter","first-line","marker","selection","file","placeholder","hs-collapse-open","hs-accordion-active"],BRANDING_OPTIONS_DEFAULTS={bodyFont:"Inter",headingFont:"Inter",roundedCorners:5,primaryColor:"#570df8",secondaryColor:"#f002b8",bodyBgDarkColor:"#031022",bodyBgLightColor:"#fcfcfc",bodyTextDarkColor:"#ffffff",bodyTextLightColor:"#000000"},brandingOptionsAtom=jotai.atom(BRANDING_OPTIONS_DEFAULTS),blocksContainerAtom=jotai.atom(null),useBrandingOptions=()=>{const[r,n]=jotai.useAtom(brandingOptionsAtom);return[lodashEs.isObject(r)?{...BRANDING_OPTIONS_DEFAULTS,...r}:BRANDING_OPTIONS_DEFAULTS,n]},useBlocksContainer=()=>jotai.useAtom(blocksContainerAtom),currentPageAtom=jotai.atom(null),useCurrentPage=()=>({currentPage:jotai.useAtomValue(currentPageAtom)});function getBlocksTree(r){return convertToBlocksTree(r)}const nestedToFlatArray=(r,n)=>lodashEs.flatten(r.map(o=>{if(o=n?{...o,_parent:n}:{...o},o.children){const a=[...o.children];return delete o.children,lodashEs.flatten([o,...nestedToFlatArray(a,o._id)])}return o}));function setProjectBlocksInMemory(r,n=!1){for(let o=0;o<r.length;o++){const a=r[o];a.global&&!n?r[o]={type:"GlobalBlock",blockId:a.blockId,_parent:lodashEs.get(a,"_parent",null),_id:a._id}:a.children&&a.children.length&&setProjectBlocksInMemory(a.children)}}function getInnerBlocks(r){let n=[],o=lodashEs.filter(r,{type:"GlobalBlock"});return o.length>0&&(o=lodashEs.map(o,getPBlocks),lodashEs.each(o,a=>{n=[...n,...getSingleBlock(a)]})),n}function getSingleBlock(r){let n=[];const o=lodashEs.get(lodashEs.first(r),"_parent",null);lodashEs.set(lodashEs.first(r),"_parent",null);const a=[flatToNestedInstance.convert(clone(r))];setProjectBlocksInMemory(a,!0);let i=nestedToFlatArray(a,r[0]._id);return i=lodashEs.set(i,"0._parent",o),n=[...n,i,...getInnerBlocks(i)],n}function getPBlocks(r){const n=lodashEs.find(FLAT_ARRAY,{_id:r._id});if(!n)return[];const o=[n],a=lodashEs.filter(FLAT_ARRAY,{_parent:r._id});return a.length?lodashEs.flatten([...o,...lodashEs.flatten(lodashEs.map(a,getPBlocks))]):lodashEs.flatten(o)}const clone=r=>JSON.parse(JSON.stringify(r));let FLAT_ARRAY=[];function splitPageBlocks(r){FLAT_ARRAY=r;const n=getBlocksTree(clone(r));setProjectBlocksInMemory(n);const o=nestedToFlatArray(n,null),a=getInnerBlocks(o),i={};return lodashEs.each(a,l=>lodashEs.set(i,lodashEs.first(l).blockId,l)),[o,i]}const useGetPageData=()=>{const[r]=useBrandingOptions(),{currentPage:n}=useCurrentPage(),[o]=useBlocksStore();return React.useCallback(()=>{const a=lodashEs.map(o,l=>lodashEs.omit(l,["expanded","order","title","siblings","tempClasses"])),[i=[]]=splitPageBlocks(a);return{currentPage:n,blocks:i}},[r,n,o])},chaiBuilderPropsAtom=jotai.atom(null);chaiBuilderPropsAtom.debugLabel="chaiBuilderPropsAtom";const chaiExternalDataAtom=jotai.atom({});chaiExternalDataAtom.debugLabel="chaiExternalDataAtom";const useBuilderProp=(r,n=void 0)=>{const o=jotai.useAtomValue(chaiBuilderPropsAtom);return lodashEs.get(o,r,n)},dataProvidersAtom=jotai.atom([]);dataProvidersAtom.debugLabel="dataProvidersAtom";const usePageDataProviders=()=>jotai.useAtom(dataProvidersAtom),builderSaveStateAtom=jotai.atom("SAVED");builderSaveStateAtom.debugLabel="builderSaveStateAtom";const useSavePage=()=>{const[r,n]=jotai.useAtom(builderSaveStateAtom),o=useBuilderProp("onSave",async d=>{}),a=useBuilderProp("onSaveStateChange",lodashEs.noop),i=useGetPageData(),[l]=usePageDataProviders(),[c]=useBrandingOptions();return{savePage:web.useThrottledCallback(async()=>{n("SAVING"),a("SAVING");const d=i();return await o({blocks:d.blocks,providers:l,brandingOptions:c,themeConfiguration:c}),setTimeout(()=>{n("SAVED"),a("SAVED")},100),!0},[i,n,c,o,a],3e3),saveState:r,setSaveState:n}},undoManager=new UndoManager;undoManager.setLimit(50);const useUndoManager=()=>{const[,r]=jotai.useAtom(builderSaveStateAtom),n=useBuilderProp("onSaveStateChange",lodashEs.noop);return React.useEffect(()=>(undoManager.setCallback(()=>{r("UNSAVED"),n("UNSAVED")}),()=>{undoManager.setCallback(lodashEs.noop)}),[]),{add:undoManager.add,undo:undoManager.undo,redo:undoManager.redo,hasRedo:undoManager.hasRedo,hasUndo:undoManager.hasUndo,clear:undoManager.clear}},removeNestedBlocks=(r,n)=>{const o=[],a=lodashEs.filter(r,i=>lodashEs.includes(n,i._id)||lodashEs.includes(n,i._parent)?(o.push(i._id),!1):!0);return lodashEs.isEmpty(o)?a:removeNestedBlocks(a,o)},useRemoveBlocks=()=>{const[r]=useBlocksStore(),[n,o]=useSelectedBlockIds(),{setNewBlocks:a}=useBlocksStoreUndoableActions();return React.useCallback(i=>{var c;const l=((c=lodashEs.find(r,{_id:i[0]}))==null?void 0:c._parent)||null;a(removeNestedBlocks(r,i)),setTimeout(()=>o(l?[l]:[]),200)},[r,o,n])};function insertBlocksAtPosition(r,n,o,a){let i=r.filter(u=>!u._parent);o&&(i=r.filter(u=>u._parent===o));const l=a!==void 0?a:i.length;let c=r.length;for(let u=0,d=0;u<r.length;u++)if(r[u]._parent===o){if(d===l){c=u;break}d++}return!o&&a!==void 0&&a>=i.length&&(c=r.length),[...r.slice(0,c),...n,...r.slice(c)]}function flattenTree(r){let n=[];return r.walk(o=>(delete o.model.children,n.push(o.model),!0)),n}function findNodeById(r,n){return r.first(o=>o.model._id===n)||null}function moveNode(r,n,o,a){const i=findNodeById(r,n),l=findNodeById(r,o);if(i&&l){i.drop(),l.children||(l.model.children=[]);try{l.addChildAtIndex(i,a)}catch(c){return console.error("Error adding child to parent:",c),!1}return!0}return!1}function moveBlocksWithChildren(r,n,o,a){if(!n)return r;o=o||"root";const l=new TreeModel().parse({_id:"root",children:getBlocksTree(r)});if(moveNode(l,n,o,a)){const c=flattenTree(l),u=c.find(d=>d._id===n);return u&&(u._parent=o==="root"?null:o),c.shift(),c}return r}const useBlocksStoreManager=()=>{const[,r]=useBlocksStore();return{setNewBlocks:n=>{r(n)},addBlocks:(n,o,a)=>{r(i=>insertBlocksAtPosition(i,n,o,a))},removeBlocks:n=>{r(o=>removeNestedBlocks(o,n))},moveBlocks:(n,o,a)=>{r(i=>{let l=i;for(let c=0;c<n.length;c++)l=moveBlocksWithChildren(l,n[c],o,a);return l})},updateBlocksProps:n=>{r(o=>{const a=n.map(i=>i._id);return o.map(i=>{if(a.includes(i._id)){const l=lodashEs.find(n,{_id:i._id});return{...i,...lodashEs.omit(l,"_id")}}return i})})}}},useBlocksStore=()=>jotai.useAtom(presentBlocksAtom),useBlocksStoreUndoableActions=()=>{const{add:r}=useUndoManager(),[n]=useBlocksStore(),{setNewBlocks:o,addBlocks:a,removeBlocks:i,moveBlocks:l,updateBlocksProps:c}=useBlocksStoreManager();return{moveBlocks:(y,b,v)=>{const x=lodashEs.map(y,S=>{const R=n.find(k=>k._id===S)._parent||null,C=n.filter(k=>R?k._parent===R:!k._parent).map(k=>k._id).indexOf(S);return{_id:S,oldParent:R,oldPosition:C}}),E=x.find(({_id:S})=>S===y[0]);E&&E.oldParent===b&&E.oldPosition===v||(l(y,b,v),r({undo:()=>lodashEs.each(x,({_id:S,oldParent:w,oldPosition:R})=>{l([S],w,R)}),redo:()=>l(y,b,v)}))},addBlocks:(y,b,v)=>{a(y,b,v),r({undo:()=>i(lodashEs.map(y,"_id")),redo:()=>a(y,b,v)})},removeBlocks:y=>{var E;const b=(E=lodashEs.first(y))==null?void 0:E._parent,x=n.filter(S=>b?S._parent===b:!S._parent).indexOf(lodashEs.first(y));i(lodashEs.map(y,"_id")),r({undo:()=>a(y,b,x),redo:()=>i(lodashEs.map(y,"_id"))})},updateBlocks:(y,b,v)=>{let x=[];if(v)x=lodashEs.map(y,E=>({_id:E,...v}));else{const E=lodashEs.keys(b);x=lodashEs.map(y,S=>{const w=n.find(A=>A._id===S),R={_id:S};return lodashEs.each(E,A=>R[A]=w[A]),R})}c(lodashEs.map(y,E=>({_id:E,...b}))),r({undo:()=>c(x),redo:()=>c(lodashEs.map(y,E=>({_id:E,...b})))})},updateBlocksRuntime:(y,b)=>{c(lodashEs.map(y,v=>({_id:v,...b})))},setNewBlocks:y=>{o(y),r({undo:()=>o(n),redo:()=>o(y)})},updateMultipleBlocksProps:y=>{let b=[];b=lodashEs.map(y,v=>{const x=lodashEs.keys(v),E=n.find(w=>w._id===v._id),S={};return lodashEs.each(x,w=>S[w]=E[w]),S}),c(y),r({undo:()=>c(b),redo:()=>c(y)})}}},useAddBlock=()=>{const[r]=useBlocksStore(),[,n]=useSelectedBlockIds(),{addBlocks:o}=useBlocksStoreUndoableActions(),a=React.useCallback((l,c,u)=>{var h;for(let g=0;g<l.length;g++){const{_id:y}=l[g];l[g]._id=iconBase.generateUUID();const b=lodashEs.filter(l,{_parent:y});for(let v=0;v<b.length;v++)b[v]._parent=l[g]._id}const d=lodashEs.first(l);let p,f;return c&&(p=lodashEs.find(r,{_id:c}),l[0]._parent=c,f=c),!(p?canAcceptChildBlock(p==null?void 0:p._type,d._type):!0)&&p&&(l[0]._parent=p._parent,f=p._parent),o(l,f,u),n([(h=lodashEs.first(l))==null?void 0:h._id]),lodashEs.first(l)},[r,n]);return{addCoreBlock:React.useCallback((l,c,u)=>{if(lodashEs.has(l,"blocks")){const v=l.blocks;return a(v,c,u)}const d=iconBase.generateUUID(),p=getBlockDefaultProps(l.props),f=[];lodashEs.forIn(p,(v,x)=>{if(lodashEs.startsWith(v,STRINGS.SLOT_KEY)){const E=v.replace(STRINGS.SLOT_KEY,"");f.push({_id:E,_type:"Slot",_parent:d,_name:l.props[x].name,_styles:l.props[x].styles,_emptyStyles:l.props[x].emptyStyles})}});const m={_type:l.type,_id:d,...p};let h,g;c&&(h=lodashEs.find(r,{_id:c}),m._parent=c,g=c),!canAcceptChildBlock(h==null?void 0:h._type,m._type)&&h&&(m._parent=h._parent,g=h._parent);const b=[m,...f];return o(b,g,u),n([m._id]),m},[a,r,n]),addPredefinedBlock:a}},STANDARD=[0,1,2,3,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96],CLASS_VALUES={columns:[...lodashEs.range(1,13),"auto","3xs","2xs","xs","sm","md","lg","xl",...lodashEs.map(lodashEs.range(2,8),r=>`${r}xl`)],breakAfter:["auto","avoid","all","avoid-page","page","left","right","column"],breakInside:["auto","avoid","avoid-page","avoid-column"],display:["block","flex","grid","inline-block","inline","hidden"],objectFit:["contain","cover","fill","none","scale-down"],objectPosition:["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],overflow:["auto","hidden","clip","visible","scroll"],overscroll:["auto","contain","none"],trbl:[0,"px","0.5",1,1.5,2,2.5,3,3.5,...lodashEs.range(4,13),14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,"auto","1/2","1/3","2/3","1/4","2/4","3/4","full"],flexBasis:[...STANDARD,"auto","px","0.5","1.5","2.5","3.5","1/2","1/3","2/3","1/4","2/4","3/4","1/5","2/5","3/5","4/5","1/6","2/6","3/6","4/6","5/6","1/12","2/12","3/12","4/12","5/12","6/12","7/12","8/12","9/12","10/12","11/12","full"],padding:[...STANDARD,"px","0.5","1.5","2.5","3.5"],margin:["auto",...STANDARD,"px","0.5","1.5","2.5","3.5"],scale:[0,50,75,90,95,100,105,110,125,150],origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],blendEffect:["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],borderWidth:[0,2,4,8],borderRadius:["global","none","sm","md","lg","xl","2xl","3xl","full"],indent:[0,"px","0.5",1,1.5,2,2.5,3,3.5,...lodashEs.range(4,13),14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96],maxHeight:[0,"px","0.5",1,1.5,2,2.5,3,3.5,...lodashEs.range(4,13),14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,"full","screen","min","max","fit"],space:[0,"px","0.5",1,1.5,2,2.5,3,3.5,...lodashEs.range(4,13),14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,"px","reverse"],width:["0","px","0.5","1","1.5","2","2.5","3","3.5","4","5","6","7","8","9","10","11","12","14","16","20","24","28","32","36","40","44","48","52","56","60","64","72","80","96","auto","1/2","1/3","2/3","1/4","2/4","3/4","1/5","2/5","3/5","4/5","1/6","2/6","3/6","4/6","5/6","1/12","2/12","3/12","4/12","5/12","6/12","7/12","8/12","9/12","10/12","11/12"],maxWidth:["0","none","xs","sm","md","lg","xl","2xl","3xl","4xl","5xl","6xl","7xl","full","min","max","fit","prose","screen-sm","screen-md","screen-lg","screen-xl","screen-2xl"],height:["0","px","0.5","1","1.5","2","2.5","3","3.5","4","5","6","7","8","9","10","11","12","14","16","20","24","28","32","36","40","44","48","52","56","60","64","72","80","96","auto","1/2","1/3","2/3","1/4","2/4","3/4","1/5","2/5","3/5","4/5","1/6","2/6","3/6","4/6","5/6","full","screen","min","max","fit"]},CLASSES_LIST={textColor:{classes:[],regExp:"text-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},aspectRatio:{classes:["aspect-auto","aspect-square","aspect-video"],regExp:"aspect-(auto|square|video)"},container:{classes:["container"],regExp:"container"},columns:{classes:lodashEs.map(CLASS_VALUES.columns,r=>`columns-${r}`),regExp:"columns-(auto|[0-9]xl|[0-9]xs|xs|sm|md|lg|xl|\\d+)"},breakAfter:{classes:lodashEs.map(CLASS_VALUES.breakAfter,r=>`break-after-${r}`),regExp:"break-after-\\S+"},breakBefore:{classes:lodashEs.map(CLASS_VALUES.breakAfter,r=>`break-before-${r}`),regExp:"break-before-\\S+"},breakInside:{classes:lodashEs.map(CLASS_VALUES.breakInside,r=>`break-inside-${r}`),regExp:"break-inside-\\S+"},boxDecoration:{classes:["box-decoration-clone","box-decoration-slice"],regExp:"box-decoration-\\S+"},boxSizing:{classes:["box-border","box-content"],regExp:"box-(border|content)"},flexDirection:{classes:["flex-row","flex-row-reverse","flex-col","flex-col-reverse"],regExp:"flex-(row|row-reverse|col|col-reverse)"},flexWrap:{classes:["flex-wrap","flex-wrap-reverse","flex-nowrap"],regExp:"flex-(wrap|wrap-reverse|nowrap)"},flexGrowShrink:{classes:["flex-1","flex-auto","flex-initial","flex-none"],regExp:"flex-1|flex-auto|flex-initial|flex-none"},gridColumns:{classes:lodashEs.map([...lodashEs.range(0,13),"none"],r=>`grid-cols-${r}`),regExp:"grid-cols-(\\d+|none)"},gridFlow:{classes:["grid-flow-row","grid-flow-col","grid-flow-row-dense","grid-flow-col-dense"],regExp:"grid-flow-(row|col|row-dense|col-dense)"},outlineStyle:{classes:lodashEs.map(["none","dashed","dotted","double","hidden"],r=>`outline-${r}`),regExp:"outline-(none|dashed|dotted|double|hidden)"},borderStyle:{classes:lodashEs.map(["solid","dashed","dotted","double","hidden","none"],r=>`border-${r}`),regExp:"border-(solid|dashed|dotted|double|hidden|none)"},overflow:{classes:lodashEs.map(CLASS_VALUES.overflow,r=>`overflow-${r}`),regExp:`overflow-(${CLASS_VALUES.overflow.join("|")})`},overflowX:{classes:lodashEs.map(CLASS_VALUES.overflow,r=>`overflow-x-${r}`),regExp:`overflow-x-(${CLASS_VALUES.overflow.join("|")})`},overflowY:{classes:lodashEs.map(CLASS_VALUES.overflow,r=>`overflow-y-${r}`),regExp:`overflow-y-(${CLASS_VALUES.overflow.join("|")})`},gridRows:{classes:lodashEs.map([1,2,3,4,5,6,"none"],r=>`grid-rows-${r}`),regExp:"grid-rows-(\\d|none)"},display:{classes:lodashEs.map(CLASS_VALUES.display,r=>r.toString()),regExp:`(${CLASS_VALUES.display.join("|")})`},float:{classes:["float-right","float-left","float-none"],regExp:"float-\\S+"},clear:{classes:["clear-right","clear-left","clear-none","clear-both"],regExp:"clear-\\S+"},isolation:{classes:["isolate","isolation-auto"],regExp:"isolate|isolation-auto"},objectFit:{classes:lodashEs.map(CLASS_VALUES.objectFit,r=>`object-${r}`),regExp:"object-(contain|cover|fill|none|scale-down)"},objectPosition:{classes:lodashEs.map(CLASS_VALUES.objectPosition,r=>`object-${r}`),regExp:`object-(${CLASS_VALUES.objectPosition.join("|")})`},overscroll:{classes:lodashEs.map(CLASS_VALUES.overscroll,r=>`overscroll-${r}`),regExp:`overscroll-(${CLASS_VALUES.overscroll.join("|")})`},overscrollX:{classes:lodashEs.map(CLASS_VALUES.overscroll,r=>`overscroll-x-${r}`),regExp:`overscroll-x-(${CLASS_VALUES.overscroll.join("|")})`},overscrollY:{classes:lodashEs.map(CLASS_VALUES.overscroll,r=>`overscroll-y-${r}`),regExp:`overscroll-y-(${CLASS_VALUES.overscroll.join("|")})`},inset:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`inset-${r}`),regExp:"-?inset-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},insetX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`inset-x-${r}`),regExp:"-?inset-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},insetY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`inset-y-${r}`),regExp:"-?inset-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},top:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`top-${r}`),regExp:"-?top-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},topX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`top-x-${r}`),regExp:"-?top-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},topY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`top-y-${r}`),regExp:"-?top-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},right:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`right-${r}`),regExp:"-?right-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},rightX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`right-x-${r}`),regExp:"-?right-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},rightY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`right-y-${r}`),regExp:"-?right-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},bottom:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`bottom-${r}`),regExp:"-?bottom-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},bottomX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`bottom-x-${r}`),regExp:"-?bottom-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},bottomY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`bottom-y-${r}`),regExp:"-?bottom-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},left:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`left-${r}`),regExp:"-?left-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},leftX:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`left-x-${r}`),regExp:"-?left-x-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},leftY:{classes:lodashEs.map(CLASS_VALUES.trbl,r=>`left-y-${r}`),regExp:"-?left-y-(px|\\d\\/\\d|\\d\\.\\d|\\d+|full|auto|\\[.*\\])"},visibility:{classes:["visible","invisible"],regExp:"invisible|visible"},zIndex:{classes:lodashEs.map(["0",10,20,30,40,50,"auto"],r=>`z-${r}`),regExp:"-?z-(\\d+|auto|\\[.*\\])"},flexBasis:{classes:lodashEs.map(CLASS_VALUES.flexBasis,r=>`basis-${r}`),regExp:"basis-(\\d+|\\S+)"},flexGrow:{classes:["grow","grow-0"],regExp:"grow(-0)?"},flexShrink:{classes:["shrink","shrink-0"],regExp:"shrink(-0)?"},gridColSpan:{classes:["col-auto",...lodashEs.map(lodashEs.range(1,13),r=>`col-span-${r}`),"col-span-full"],regExp:"col-(auto|span-(\\d+|full))"},gridColStart:{classes:[...lodashEs.map(lodashEs.range(1,14),r=>`col-start-${r}`),"col-start-auto"],regExp:"col-start-(\\d+|auto)"},gridColEnd:{classes:[...lodashEs.map(lodashEs.range(1,14),r=>`col-end-${r}`),"col-end-auto"],regExp:"col-end-(\\d+|auto)"},gridRowSpan:{classes:["row-auto",...lodashEs.map(lodashEs.range(1,7),r=>`row-span-${r}`),"row-span-full"],regExp:"row-(auto|span-(\\d+|full))"},gridRowStart:{classes:[...lodashEs.map(lodashEs.range(1,8),r=>`row-start-${r}`),"row-start-auto"],regExp:"row-start-(\\d+|auto)"},gridRowEnd:{classes:[...lodashEs.map(lodashEs.range(1,8),r=>`row-end-${r}`),"row-end-auto"],regExp:"row-end-(\\d+|auto)"},gridAutoColumns:{classes:["auto-cols-auto","auto-cols-min","auto-cols-max","auto-cols-fr"],regExp:"auto-cols-(auto|min|max|fr)"},gridAutoRows:{classes:["auto-rows-auto","auto-rows-min","auto-rows-max","auto-rows-fr"],regExp:"auto-rows-(auto|min|max|fr)"},gap:{classes:lodashEs.map(CLASS_VALUES.indent,r=>`gap-${r}`),regExp:"gap-(px|\\d.\\d|\\d|\\[.*\\])"},gapX:{classes:lodashEs.map(CLASS_VALUES.indent,r=>`gap-x-${r}`),regExp:"gap-x-(px|\\d.\\d|\\d|\\[.*\\])"},gapY:{classes:lodashEs.map(CLASS_VALUES.indent,r=>`gap-y-${r}`),regExp:"gap-y-(px|\\d.\\d|\\d|\\[.*\\])"},justifyContent:{classes:["justify-start","justify-end","justify-center","justify-between","justify-around","justify-evenly"],regExp:"justify-(start|end|center|between|around|evenly)"},justifyItems:{classes:["justify-items-start","justify-items-end","justify-items-center","justify-items-stretch"],regExp:"justify-items-(start|end|center|stretch)"},justifySelf:{classes:["justify-self-auto","justify-self-start","justify-self-end","justify-self-center","justify-self-stretch"],regExp:"justify-self-(auto|start|end|center|stretch)"},placeContent:{classes:["place-content-center","place-content-start","place-content-end","place-content-between","place-content-around","place-content-evenly","place-content-stretch"],regExp:"place-content-(center|start|end|between|around|evenly|stretch)"},placeItems:{classes:["place-items-start","place-items-end","place-items-center","place-items-stretch"],regExp:"place-items-(start|end|center|stretch)"},placeSelf:{classes:["place-self-auto","place-self-start","place-self-end","place-self-center","place-self-stretch"],regExp:"place-self-(auto|start|end|center|stretch)"},alignContent:{classes:["content-center","content-start","content-end","content-between","content-around","content-evenly"],regExp:"content-(center|start|end|between|around|evenly)"},alignItems:{classes:["items-start","items-end","items-center","items-baseline","items-stretch"],regExp:"items-(start|end|center|baseline|stretch)"},alignSelf:{classes:["self-auto","self-start","self-end","self-center","self-stretch","self-baseline"],regExp:"self-(auto|start|end|center|stretch|baseline)"},backgroundClip:{classes:["bg-clip-border","bg-clip-padding","bg-clip-content","bg-clip-text"],regExp:"bg-clip-(border|padding|content|text)"},dropShadow:{classes:lodashEs.map(["sm","md","lg","xl","2xl","none"],r=>`drop-shadow-${r}`),regExp:"drop-shadow-(sm|md|lg|xl|2xl|none)"},backdropBlur:{classes:lodashEs.map(["none","sm","md","lg","xl","2xl","3xl"],r=>`backdrop-blur-${r}`),regExp:"backdrop-blur-(none|sm|md|lg|xl|2xl|3xl)"},backdropBrightness:{classes:lodashEs.map([0,50,75,90,95,100,105,110,125,150,200],r=>`backdrop-brightness-${r}`),regExp:"backdrop-brightness-(\\d+)"},backdropContrast:{classes:lodashEs.map([0,50,75,100,125,150,200],r=>`backdrop-contrast-${r}`),regExp:"backdrop-contrast-(\\d+)"},backdropGrayScale:{classes:["backdrop-grayscale-0","backdrop-grayscale"],regExp:"backdrop-grayscale(-0)?"},backdropHueRotate:{classes:lodashEs.map([0,15,30,60,90,180],r=>`backdrop-hue-rotate-${r}`),regExp:"-?backdrop-hue-rotate-(\\d+)"},backdropInvert:{classes:["backdrop-invert-0","backdrop-invert"],regExp:"backdrop-invert(-0)?"},backdropOpacity:{classes:lodashEs.map([0,5,10,20,25,30,40,50,60,70,75,80,90,95,100],r=>`backdrop-opacity-${r}`),regExp:"backdrop-opacity-(\\d+)"},backdropSaturate:{classes:lodashEs.map([0,50,100,150,200],r=>`backdrop-saturate-${r}`),regExp:"backdrop-saturate-(\\d+)"},backdropSepia:{classes:["backdrop-sepia-0, backdrop-sepia"],regExp:"backdrop-sepia(-0)?"},backgroundOrigin:{classes:["bg-origin-border","bg-origin-padding","bg-origin-content"],regExp:"bg-origin-(border|padding|content)"},transformOrigin:{classes:lodashEs.map(CLASS_VALUES.origin,r=>`origin-${r}`),regExp:"origin-(\\d+|\\S+)"},padding:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`p-${r}`),regExp:"p-(\\d+|\\S+|\\[.*\\])"},paddingX:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`px-${r}`),regExp:"px-(\\d+|\\S+|\\[.*\\])"},paddingY:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`py-${r}`),regExp:"py-(\\d+|\\S+|\\[.*\\])"},paddingTop:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`pt-${r}`),regExp:"pt-(\\d+|\\S+|\\[.*\\])"},paddingRight:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`pr-${r}`),regExp:"pr-(\\d+|\\S+|\\[.*\\])"},paddingBottom:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`pb-${r}`),regExp:"pb-(\\d+|\\S+|\\[.*\\])"},paddingLeft:{classes:lodashEs.map(CLASS_VALUES.padding,r=>`pl-${r}`),regExp:"pl-(\\d+|\\S+|\\[.*\\])"},textDecorationStyle:{classes:["decoration-solid","decoration-double","decoration-dotted","decoration-dashed","decoration-wavy"],regExp:"decoration-(solid|double|dotted|dashed|wavy)"},textDecorationThickness:{classes:lodashEs.map(["auto","from-font","0",1,2,4,8],r=>`decoration-${r}`),regExp:"decoration-(auto|from-font|\\d+|\\S+)"},fromColor:{classes:[],regExp:"from-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},margin:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`m-${r}`),regExp:"-?m-(\\d+|\\S+|\\[.*\\])"},marginX:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`mx-${r}`),regExp:"-?mx-(\\d+|\\S+|\\[.*\\])"},marginY:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`my-${r}`),regExp:"-?my-(\\d+|\\S+|\\[.*\\])"},marginTop:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`mt-${r}`),regExp:"-?mt-(\\d+|\\S+|\\[.*\\])"},marginRight:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`mr-${r}`),regExp:"-?mr-(\\d+|\\S+|\\[.*\\])"},marginBottom:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`mb-${r}`),regExp:"-?mb-(\\d+|\\S+|\\[.*\\])"},marginLeft:{classes:lodashEs.map(CLASS_VALUES.margin,r=>`ml-${r}`),regExp:"-?ml-(\\d+|\\S+|\\[.*\\])"},spaceX:{classes:lodashEs.map(CLASS_VALUES.space,r=>`space-x-${r}`),regExp:"-?space-x-(\\d+|\\S+|\\[.*\\])"},spaceY:{classes:lodashEs.map(CLASS_VALUES.space,r=>`space-y-${r}`),regExp:"-?space-y-(\\d+|\\S+|\\[.*\\])"},boxShadow:{classes:lodashEs.map(["sm","md","lg","xl","2xl","inner","none"],r=>`shadow-${r}`),regExp:"shadow-(sm|md|lg|xl|2xl|inner|none)"},minWidth:{classes:["min-w-0","min-w-full","min-w-min","min-w-max","min-w-fit"],regExp:"min-w-(\\d+|\\S+|\\[.*\\])"},maxWidth:{classes:lodashEs.map(CLASS_VALUES.maxWidth,r=>`max-w-${r}`),regExp:"max-w-(\\d+|\\S+|\\[.*\\])"},width:{classes:lodashEs.map([...CLASS_VALUES.width,"full","screen","min","max","fit"],r=>`w-${r}`),regExp:"w-(\\d+.\\d+|\\d+|px|auto|full|screen|min|max|fit|\\[.*\\])"},minHeight:{classes:["min-h-0","min-h-full","min-h-screen","min-h-min","min-h-max","min-h-fit"],regExp:"min-h-(\\d+|\\S+|\\[.*\\])"},maxHeight:{classes:lodashEs.map(CLASS_VALUES.maxHeight,r=>`max-h-${r}`),regExp:"max-h-(\\d+|\\S+|\\[.*\\])"},height:{classes:lodashEs.map(CLASS_VALUES.height,r=>`h-${r}`),regExp:"h-(\\d+.\\d+|\\d+|px|auto|full|screen|min|max|fit|\\[.*\\])"},fontFamily:{classes:["font-heading","font-body","font-sans","font-serif","font-mono"],regExp:"font-(heading|body|sans|serif|mono)"},textAlign:{classes:["text-left","text-center","text-right","text-justify"],regExp:"text-(left|center|right|justify)"},textOverflow:{classes:["truncate","text-ellipsis","text-clip"],regExp:"truncate|text-ellipsis|text-clip"},verticalAlign:{classes:["align-baseline","align-top","align-middle","align-bottom","align-text-top","align-text-bottom","align-sub","align-super"],regExp:"align-(baseline|top|middle|bottom|text-top|text-bottom|sub|super)"},fontSize:{classes:["text-xs","text-sm","text-base","text-lg","text-xl","text-2xl","text-3xl","text-4xl","text-5xl","text-6xl","text-7xl","text-8xl","text-9xl"],regExp:"text-(\\d+|\\S+|\\[.*\\])"},fontSmoothing:{classes:["antialiased","subpixel-antialiased"],regExp:"antialiased|subpixel-antialiased"},fontStyle:{classes:["italic","not-italic"],regExp:"not-italic|italic"},fontWeight:{classes:["font-thin","font-extralight","font-light","font-normal","font-medium","font-semibold","font-bold","font-extrabold","font-black"],regExp:"font-(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)"},fontVariantNum:{classes:["normal-nums","ordinal","diagonal-fractions","stacked-fractions","tabular-nums","oldstyle-nums","proportional-nums","lining-nums","slashed-zero"],regExp:"normal-nums|ordinal|diagonal-fractions|stacked-fractions|tabular-nums|oldstyle-nums|proportional-nums|lining-nums|slashed-zero"},letterSpacing:{classes:["tracking-tighter","tracking-tight","tracking-normal","tracking-wide","tracking-wider","tracking-widest"],regExp:"-?tracking-(tighter|tight|normal|wide|wider|widest|\\[.*\\])"},lineHeight:{classes:["leading-none","leading-tight","leading-snug","leading-normal","leading-relaxed","leading-loose","leading-3","leading-4","leading-5","leading-6","leading-7","leading-8","leading-9","leading-10"],regExp:"leading-(none|tight|snug|normal|relaxed|loose|\\[.*\\]|\\d+)"},listStyleType:{classes:["list-none","list-disc","list-decimal"],regExp:"list-(none|disc|decimal)"},listStylePosition:{classes:["list-inside","list-outside"],regExp:"list-(inside|outside)"},textUnderlineOffset:{classes:["underline-offset-auto","underline-offset-0","underline-offset-1","underline-offset-2","underline-offset-4","underline-offset-8"],regExp:"underline-offset-(auto|\\d+|\\S+)"},textDecoration:{classes:["underline","overline","line-through","no-underline"],regExp:"underline|overline|line-through|no-underline"},textDecorationColor:{classes:[],regExp:"decoration-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},textTransform:{classes:["uppercase","lowercase","capitalize","normal-case"],regExp:"uppercase|lowercase|capitalize|normal-case"},textIndent:{classes:lodashEs.map(CLASS_VALUES.indent,r=>`indent-${r}`),regExp:"-?indent-(\\d+|\\S+)"},whitespace:{classes:["whitespace-normal","whitespace-no-wrap","whitespace-pre","whitespace-pre-line","whitespace-pre-wrap"],regExp:"whitespace-(normal|no-wrap|pre|pre-line|pre-wrap)"},wordBreak:{classes:["break-normal","break-words","break-all"],regExp:"break-(normal|words|all)"},content:{classes:["content-none"],regExp:"content-none"},backgroundColor:{classes:[],regExp:"bg-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},backgroundAttachment:{classes:["bg-fixed","bg-local","bg-scroll"],regExp:"bg-(fixed|local|scroll)"},backgroundPosition:{classes:["bg-bottom","bg-center","bg-left","bg-left-bottom","bg-left-top","bg-right","bg-right-bottom","bg-right-top","bg-top"],regExp:"bg-(bottom|center|left|left-bottom|left-top|right|right-bottom|right-top|top)"},backgroundRepeat:{classes:["bg-repeat","bg-repeat-x","bg-repeat-y","bg-no-repeat","bg-repeat-round","bg-repeat-space"],regExp:"bg-(repeat|repeat-x|repeat-y|no-repeat|repeat-round|repeat-space)"},backgroundSize:{classes:["bg-auto","bg-cover","bg-contain"],regExp:"bg-(auto|cover|contain)"},backgroundGradient:{classes:["bg-gradient-none","bg-gradient-to-t","bg-gradient-to-tr","bg-gradient-to-r","bg-gradient-to-br","bg-gradient-to-b","bg-gradient-to-bl","bg-gradient-to-l","bg-gradient-to-tl"],regExp:"bg-gradient-(none|to-(t|tr|r|br|b|bl|l|tl))"},viaColor:{classes:[],regExp:"via-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},toColor:{classes:[],regExp:"to-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},position:{classes:["static","fixed","absolute","relative","sticky"],regExp:"(static|fixed|absolute|relative|sticky)"},borderRadiusTopLeft:{classes:["rounded-tl",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-tl-${r}`)],regExp:"rounded-tl-?(\\d+|\\S+)?"},borderRadiusTopRight:{classes:["rounded-tr",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-tr-${r}`)],regExp:"rounded-tr-?(\\d+|\\S+)?"},borderRadiusBottomRight:{classes:["rounded-br",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-br-${r}`)],regExp:"rounded-br-?(\\d+|\\S+)?"},borderRadiusBottomLeft:{classes:["rounded-bl",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-bl-${r}`)],regExp:"rounded-bl-?(\\d+|\\S+)?"},borderRadiusTop:{classes:["rounded-t",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-t-${r}`)],regExp:"rounded-t-?(\\d+|\\S+)?"},borderRadiusRight:{classes:["rounded-r",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-r-${r}`)],regExp:"rounded-r-?(\\d+|\\S+)?"},borderRadiusBottom:{classes:["rounded-b",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-b-${r}`)],regExp:"rounded-b-?(\\d+|\\S+)?"},borderRadiusLeft:{classes:["rounded-l",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-l-${r}`)],regExp:`(rounded-l-(${CLASS_VALUES.borderRadius.join("|")})|rounded-l$)`},borderRadius:{classes:["rounded",...lodashEs.map(CLASS_VALUES.borderRadius,r=>`rounded-${r}`)],regExp:`(rounded-(${CLASS_VALUES.borderRadius.join("|")}$)|rounded)`},borderX:{classes:["border-x",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-x-${r}`)],regExp:"border-x-?(\\d+|\\S+|\\[.*\\])?"},borderY:{classes:["border-y",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-y-${r}`)],regExp:"border-y-?(\\d+|\\S+|\\[.*\\])?"},borderTop:{classes:["border-t",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-t-${r}`)],regExp:"border-t-?(\\d+|\\S+|\\[.*\\])?"},borderRight:{classes:["border-r",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-r-${r}`)],regExp:"border-r-?(\\d+|\\S+|\\[.*\\])?"},borderBottom:{classes:["border-b",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-b-${r}`)],regExp:"border-b-?(\\d+|\\S+|\\[.*\\])?"},borderLeft:{classes:["border-l",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-l-${r}`)],regExp:"border-l-?(\\d+|\\S+|\\[.*\\])?"},borderColor:{classes:[],regExp:"border-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},border:{classes:["border",...lodashEs.map(CLASS_VALUES.borderWidth,r=>`border-${r}`)],regExp:"border-?(\\d+|\\S+|\\[.*\\])?"},order:{classes:lodashEs.map([...lodashEs.range(0,13),"first","last","none"],r=>`order-${r}`),regExp:"-?order-(\\d+|first|last|none)"},divideXWidth:{classes:lodashEs.map(["0",2,4,8],r=>`divide-x-${r}`),regExp:"divide-x-(\\d+|\\[.*\\])"},divideYWidth:{classes:lodashEs.map(["0",2,4,8],r=>`divide-y-${r}`),regExp:"divide-y-(\\d+|\\[.*\\])"},divideColor:{classes:[],regExp:"divide-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},divideStyle:{classes:lodashEs.map(["solid","dashed","dotted","double","none"],r=>`divide-${r}`),regExp:"divide-(solid|dashed|dotted|double|none)"},outlineWidth:{classes:lodashEs.map([0,1,2,4,8],r=>`outline-${r}`),regExp:"outline-(\\d+)"},outlineOffset:{classes:lodashEs.map([0,1,2,4,8],r=>`outline-offset-${r}`),regExp:"outline-offset-(\\d+)"},outlineColor:{classes:[],regExp:"outline-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},ringWidth:{classes:lodashEs.map([0,1,2,4,8,"inset"],r=>`ring-${r}`),regExp:"ring-(\\d+|inset)"},ringOffsetWidth:{classes:lodashEs.map([0,1,2,4,8],r=>`ring-offset-${r}`),regExp:"ring-offset-(\\d+)"},ringOffsetColor:{classes:[],regExp:"ring-offset-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},ringColor:{classes:[],regExp:"ring-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},boxShadowColor:{classes:[],regExp:"shadow-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},opacity:{classes:lodashEs.map([0,5,10,20,25,30,40,50,60,70,75,80,90,95,100],r=>`opacity-${r}`),regExp:"opacity-(\\d+|\\[.*\\])"},mixBlendMode:{classes:lodashEs.map(CLASS_VALUES.blendEffect,r=>`mix-blend-${r}`),regExp:"mix-blend-(\\d+|\\S+)"},bgBlendMode:{classes:lodashEs.map(CLASS_VALUES.blendEffect,r=>`bg-blend-${r}`),regExp:"bg-blend-(\\d+|\\S+)"},blur:{classes:lodashEs.map(["none","sm","md","lg","xl","2xl","3xl"],r=>`blur-${r}`),regExp:"blur-(none|sm|md|lg|xl|2xl|3xl)"},brightness:{classes:lodashEs.map([0,50,75,90,95,100,105,110,125,150,200],r=>`brightness-${r}`),regExp:"brightness-(\\d+)"},contrast:{classes:lodashEs.map([0,50,75,100,125,150,200],r=>`contrast-${r}`),regExp:"contrast-(\\d+)"},grayScale:{classes:["grayscale-0","grayscale"],regExp:"grayscale(-0)?"},hueRotate:{classes:lodashEs.map([0,15,30,60,90,180],r=>`hue-rotate-${r}`),regExp:"-?hue-rotate-(\\d+)"},invert:{classes:["invert-0","invert"],regExp:"invert(-0)?"},saturate:{classes:lodashEs.map([0,50,100,150,200],r=>`saturate-${r}`),regExp:"saturate-(\\d+)"},sepia:{classes:["sepia-0","sepia"],regExp:"sepia(-0)?"},transition:{classes:["transition-none","transition-all","transition-colors","transition-opacity","transition-shadow","transition-transform"],regExp:"transition-(none|all|colors|opacity|shadow|transform)"},duration:{classes:lodashEs.map([75,100,150,200,300,500,700,1e3],r=>`duration-${r}`),regExp:"duration-(\\d+|\\[.*\\])"},transitionEase:{classes:["ease-linear","ease-in","ease-out","ease-in-out"],regExp:"eas(e-linear|e-in|e-out|e-in-out)"},transitionDelay:{classes:lodashEs.map([75,100,150,200,300,500,700,1e3],r=>`delay-${r}`),regExp:"delay-(\\d+|\\[.*\\])"},animation:{classes:["animation-none","animation-spin","animation-ping"],regExp:"animation-(none|spin|ping)"},scaleX:{classes:lodashEs.map(CLASS_VALUES.scale,r=>`scale-x-${r}`),regExp:"-?scale-x-(\\d+|\\S+|\\[.*\\])"},scaleY:{classes:lodashEs.map(CLASS_VALUES.scale,r=>`scale-y-${r}`),regExp:"-?scale-y-(\\d+|\\S+|\\[.*\\])"},scale:{classes:lodashEs.map(CLASS_VALUES.scale,r=>`scale-${r}`),regExp:"-?scale-(\\d+|\\S+|\\[.*\\])"},rotate:{classes:lodashEs.map([0,1,2,3,6,12,45,90,180],r=>`rotate-${r}`),regExp:"-?rotate-(\\d+|\\S+|\\[.*\\])"},translateX:{classes:lodashEs.map([0,"px","0.5",1],r=>`translate-x-${r}`),regExp:"-?translate-x-(\\d+|\\S+|\\[.*\\])"},translateY:{classes:lodashEs.map([0,"px","0.5",1],r=>`translate-y-${r}`),regExp:"-?translate-y-(\\d+|\\S+|\\[.*\\])"},skewX:{classes:lodashEs.map([0,1,2,3,6,12],r=>`skew-x-${r}`),regExp:"-?skew-x-(\\d+|\\S+|\\[.*\\])"},skewY:{classes:lodashEs.map([0,1,2,3,6,12],r=>`skew-y-${r}`),regExp:"-?skew-y-(\\d+|\\S+|\\[.*\\])"},accentColor:{classes:[],regExp:"accent-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},appearance:{classes:["appearance-none"],regExp:"appearance-none"},cursor:{classes:["cursor-auto","cursor-default","cursor-pointer","cursor-wait","cursor-text","cursor-move","cursor-help","cursor-not-allowed"],regExp:"cursor-(auto|default|pointer|wait|text|move|help|not-allowed)"},caretColor:{classes:[],regExp:"caret-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},pointerEvents:{classes:["pointer-events-none","pointer-events-auto"],regExp:"pointer-events-(none|auto)"},userSelect:{classes:["select-none","select-text","select-all","select-auto"],regExp:"select-(none|text|all|auto)"},fill:{classes:[],regExp:"caret-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},stroke:{classes:[],regExp:"caret-(black|transparent|current|white|primary(-\\d+)?|secondary(-\\d+)?|\\S+-\\d+)"},strokeWidth:{classes:["stroke-0","stroke-1","stroke-2"],regExp:"stroke-(\\d+|\\[.*\\])"}},colorOptions={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},soloColors=["current","inherit","transparent","black","white","primary","secondary"],chaiColors=["primary","secondary"],shadedColors=["slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"],shades=["50","100","200","300","400","500","600","700","800","900"],colorKeys=lodashEs.map(lodashEs.values(colorOptions),r=>r),ALL_COLORS=lodashEs.flattenDeep([...lodashEs.map(soloColors,r=>lodashEs.flatten(lodashEs.map(colorKeys,n=>`${n}-${r}`))),...lodashEs.map(chaiColors,r=>lodashEs.flattenDeep(lodashEs.map(colorKeys,n=>lodashEs.flattenDeep(lodashEs.map(shades,o=>`${n}-${r}-${o}`))))),...lodashEs.map(shadedColors,r=>lodashEs.flattenDeep(lodashEs.map(colorKeys,n=>lodashEs.flattenDeep(lodashEs.map(shades,o=>`${n}-${r}-${o}`)))))]),ALL_TW_CLASSES=lodashEs.map(lodashEs.flattenDeep(lodashEs.values(CLASSES_LIST).map(r=>r.classes).concat(ALL_COLORS)),r=>({name:r}));function getMqForCls(r){if(lodashEs.isEmpty(r.trim()))return"";const n=r.match(/sm:|md:|lg:|xl:|2xl:/g);return lodashEs.get(n,0,"xs").replace(":","")}function getModForCls(r){const n=lodashEs.map(MODIFIERS,a=>`${a}:`).join("|"),o=new RegExp(n,"g");return lodashEs.get(o.exec(r.trim()),0,"").replace(":","")}function getPureClsName(r){return r.trim().split(":").pop()||""}const memoizedProps={};function getPropertyForClass(r){if(lodashEs.isEmpty(r))return"";if(memoizedProps[r])return memoizedProps[r];let n="";for(const o in CLASSES_LIST){const a=lodashEs.get(CLASSES_LIST,`${o}.regExp`,"");if(new RegExp(a,"g").test(r)){n=o,memoizedProps[r]=n;break}}return n}function constructClassObject(r){return lodashEs.isEmpty(r)?null:{dark:lodashEs.startsWith(r,"dark:"),mq:getMqForCls(r),mod:getModForCls(r),cls:getPureClsName(r),fullCls:r,property:getPropertyForClass(r)}}function generateFullClsName(r){let n="";return r.dark&&(n+="dark:"),r.mq.toLowerCase()!=="xs"&&(n+=`${r.mq}:`),r.mod&&(n+=`${r.mod}:`),n+=r.cls,n}const MEDIA_QUERIES={xs:420,sm:620,md:768,lg:1024,xl:1280,"2xl":1536},breakpoints=["xs","sm","md","lg","xl","2xl"];function getBelongsToForClass(r,n){if(n===null)return"baseClasses";const o=n.mq;if(o==="xs"||n.dark||n.mod!=="")return"classes";let a="baseClasses",i=breakpoints.indexOf(o);for(;i>0;){const l=breakpoints[i-1];if(lodashEs.find(r,{mq:l,property:n.property})){a="classes";break}i--}return a}const IGNORED_BASES_CLASSES_PROPERTIES=[];function getNewClasses(r="",n="",o=[]){r=r.trim().replace(/ +/g,"");let a=lodashEs.filter(lodashEs.map(r.split(" "),constructClassObject),p=>!lodashEs.isNull(p)),i=lodashEs.filter(lodashEs.map(n.split(" "),constructClassObject),p=>!lodashEs.isNull(p));i=lodashEs.filter(i,p=>!lodashEs.includes(IGNORED_BASES_CLASSES_PROPERTIES,p.property));const l=[],c=[];lodashEs.each(o,p=>{const f=constructClassObject(p),m=lodashEs.find(a,lodashEs.pick(f,["dark","mq","mod","property"]));if(m&&(a=lodashEs.filter(a,h=>h.fullCls!==(m==null?void 0:m.fullCls))),l.push(f),f.mq==="xs"&&!f.dark&&f.mod===""&&(i=lodashEs.filter(i,h=>h.property!==f.property)),getBelongsToForClass(a,f)==="baseClasses"&&!lodashEs.includes(IGNORED_BASES_CLASSES_PROPERTIES,f.property)){const h=lodashEs.find(i,lodashEs.pick(f,["property"]));m&&(i=lodashEs.filter(i,g=>g.fullCls!==(h==null?void 0:h.fullCls))),c.push({...f,fullCls:f.cls,mq:"xs"})}});const u=lodashEs.map(lodashEs.sortBy([...a,...l],p=>MEDIA_QUERIES[p.mq]),"fullCls").join(" ");return`${lodashEs.map(lodashEs.sortBy([...i,...c],p=>MEDIA_QUERIES[p.mq]),"fullCls").join(" ").trim()},${u.trim()}`.trim().replace(/ +/g,"")}const selectedStylingBlocksAtom=jotai.atom([]);selectedStylingBlocksAtom.debugLabel="selectedStylingBlocksAtom";const useSelectedStylingBlocks=()=>jotai.useAtom(selectedStylingBlocksAtom),getSplitClasses$1=r=>{const n=r.replace(STRINGS.STYLES_KEY,"").split(",");return{baseClasses:n[0],classes:n[1]}},addClassesToBlocksAtom=jotai.atom(null,(r,n,{blockIds:o,newClasses:a})=>{const i=lodashEs.filter(r(pageBlocksAtomsAtom),c=>o.includes(r(c)._id)),l=lodashEs.first(r(selectedStylingBlocksAtom));return lodashEs.map(i,c=>{const u=r(c),d=lodashEs.get(u,l.prop,`${STRINGS.STYLES_KEY},`),{baseClasses:p,classes:f}=getSplitClasses$1(d);return{ids:[u._id],props:{[l.prop]:`${STRINGS.STYLES_KEY}${getNewClasses(f,p,a)}`}}})}),useAddClassesToBlocks=()=>{const r=jotai.useSetAtom(addClassesToBlocksAtom),{updateBlocks:n,updateBlocksRuntime:o}=useBlocksStoreUndoableActions();return React.useCallback((a,i,l=!1)=>{const c=r({blockIds:a,newClasses:i});if(!l){o(a,c[0].props);return}n(a,c[0].props)},[r])},useStylingBreakpoint=()=>jotai.useAtom(styleBreakpointAtom),canvasWidthAtom=atomWithStorage("canvasWidth",800),canvasBreakpointAtom=jotai.atom(r=>{const n=r(canvasWidthAtom);return iconBase.getBreakpointValue(n).toLowerCase()}),useCanvasWidth=()=>{const[r,n]=jotai.useAtom(canvasWidthAtom),o=jotai.useAtomValue(canvasBreakpointAtom),[a,i]=useStylingBreakpoint();return React.useEffect(()=>{a!=="xs"&&i(o)},[o,a,i]),[r,o,n]},canvasZoomAtom=atomWithStorage("canvasZoom",100),useCanvasZoom=()=>jotai.useAtom(canvasZoomAtom),cutBlockIdsAtom=jotai.atom([]),useCutBlockIds=()=>{const[r,n]=jotai.useAtom(cutBlockIdsAtom),o=jotai.useSetAtom(copiedBlockIdsAtom),a=React.useCallback(i=>{n(i),o([])},[n,o]);return[r,a]},copiedBlockIdsAtom=jotai.atom([]),useCopyBlockIds=()=>{const[r,n]=jotai.useAtom(copiedBlockIdsAtom),o=jotai.useSetAtom(cutBlockIdsAtom),a=React.useCallback(i=>{n(i),o([])},[n,o]);return[r,a]},darkModeAtom=atomWithStorage("darkMode",!1),useDarkMode=()=>{const[r,n]=jotai.useAtom(darkModeAtom);return[r,n]},useDuplicateBlocks=()=>{const[r]=useBlocksStore(),[,n]=useSelectedBlockIds(),{addBlocks:o}=useBlocksStoreUndoableActions();return React.useCallback((a,i=null)=>{const l=[];lodashEs.each(a,c=>{const u=r.find(h=>h._id===c);i||(i=u._parent);const f=lodashEs.filter(r,h=>lodashEs.isString(i)?h._parent===i:!u._parent).indexOf(u)+1,m=getDuplicatedBlocks(r,c,i);o(m,i,f),l.push(lodashEs.get(m,"0._id",""))}),n(l)},[r,n])},hiddenBlockIdsAtom=jotai.atom([]),useHiddenBlockIds=()=>{const[r,n]=jotai.useAtom(hiddenBlockIdsAtom),o=React.useCallback(a=>{n(i=>lodashEs.includes(i,a)?lodashEs.without(i,a):[...i,a])},[n]);return[r,n,o]},highlightBlockIdAtom=jotai.atom(""),useHighlightBlockId=()=>jotai.useAtom(highlightBlockIdAtom),useCanPaste=()=>{const[r]=useBlocksStore();return(n,o)=>{var l;const a=(l=lodashEs.find(r,{_id:o}))==null?void 0:l._type,i=lodashEs.first(n.map(c=>{var u;return(u=lodashEs.find(r,{_id:c}))==null?void 0:u._type}));return canAcceptChildBlock(a,i)}},useMoveCutBlocks=()=>{const r=jotai.useAtomValue(presentBlocksAtom),{moveBlocks:n}=useBlocksStoreUndoableActions();return React.useCallback((o,a)=>{const i=a[0],l=r.find(u=>u._id===a),c=l?l.children.length:0;n(o,i,c)},[n,r])},usePasteBlocks=()=>{const r=jotai.useAtomValue(copiedBlockIdsAtom),[n,o]=useCutBlockIds(),a=useDuplicateBlocks(),i=useMoveCutBlocks(),l=useCanPaste();return{canPaste:React.useCallback(u=>r.length>0?l(r,u):n.length>0?l(n,u):!1,[l,r,n]),pasteBlocks:React.useCallback(u=>{const d=Array.isArray(u)?u[0]:u;lodashEs.isEmpty(r)?i(n,u):a(r,d),o([])},[n,r,a,i,o])}},previewModeAtom=jotai.atom(!1),usePreviewMode=()=>{const[r,n]=jotai.useAtom(previewModeAtom);return[r,n]},getSplitClasses=r=>{const n=r.replace(STRINGS.STYLES_KEY,"").split(",");return{baseClasses:n[0],classes:n[1]}},removeClassFromBlocksAtom=jotai.atom(null,(r,n,{blockIds:o,fullClasses:a})=>{const i=lodashEs.first(r(selectedStylingBlocksAtom)),l=lodashEs.filter(r(pageBlocksAtomsAtom),c=>o.includes(r(c)._id));return lodashEs.map(l,c=>{const u=r(c),d=a;let{classes:p,baseClasses:f}=getSplitClasses(lodashEs.get(u,i.prop,"styles:,"));return lodashEs.each(d,m=>{const h=m.replace(/[\[\]\/\\{}()*+?.^$|]/g,"\\$&"),g=new RegExp(`(^| )${h}($| )`,"g");p=p.replace(g," ").replace(/ +/g," ").trim();const y=lodashEs.first(m.split(":"));lodashEs.includes(["2xl","xl","lg","md","sm"],y)&&d.push(m.split(":").pop().trim())}),lodashEs.each(d,m=>{const h=new RegExp(`(^| )${m.replace("[","\\[").replace("]","\\]")}($| )`,"g");f=f.replace(h," ").replace(/ +/g," ").trim()}),{ids:[u._id],props:{[i.prop]:`${STRINGS.STYLES_KEY}${f},${p}`}}})}),useRemoveClassesFromBlocks=()=>{const{updateBlocks:r}=useBlocksStoreUndoableActions(),n=jotai.useSetAtom(removeClassFromBlocksAtom);return React.useCallback((o,a)=>{const i=n({blockIds:o,fullClasses:a});r(o,i[0].props)},[n])},selectedBlockAllClassesAtom=jotai.atom(r=>{const n=lodashEs.first(r(selectedStylingBlocksAtom)),o=r(selectedBlockAtom);if(!n||n.blockId!==lodashEs.get(o,"_id",null))return[];const i=lodashEs.get(o,n.prop,`${STRINGS.STYLES_KEY},`).replace(STRINGS.STYLES_KEY,"").split(",").join(" ");return lodashEs.filter(lodashEs.map(i.trim().split(" "),constructClassObject),l=>!lodashEs.isNull(l))}),useSelectedBlockAllClasses=()=>jotai.useAtomValue(selectedBlockAllClassesAtom),MQ={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5},selectedBlockCurrentClassesAtom=jotai.atom(r=>{const n=r(canvasBreakpointAtom),o=r(styleStateAtom),a=r(darkModeAtom),i=getQueries(n);let l=lodashEs.filter(r(selectedBlockAllClassesAtom),{mod:o});return lodashEs.startsWith(o,"_")||(l=lodashEs.filter(l,c=>i.includes(c.mq))),l=l.sort((c,u)=>MQ[c.mq]-MQ[u.mq]),a||(l=lodashEs.filter(l,{dark:!1})),l}),getQueries=r=>{let n=[];switch(r){case"xs":n=["xs"];break;case"sm":n=["xs","sm"];break;case"md":n=["xs","sm","md"];break;case"lg":n=["xs","sm","md","lg"];break;case"xl":n=["xs","sm","md","lg","xl"];break;case"2xl":n=["xs","sm","md","lg","xl","2xl"];break;default:n=["xs"];break}return n},useSelectedBlockCurrentClasses=()=>jotai.useAtomValue(selectedBlockCurrentClassesAtom),useStylingState=()=>jotai.useAtom(styleStateAtom),useUpdateBlocksProps=()=>{const{updateBlocks:r}=useBlocksStoreUndoableActions();return React.useCallback((n,o,a)=>{r(n,o,a)},[r])},useUpdateMultipleBlocksProps=()=>{const{updateMultipleBlocksProps:r}=useBlocksStoreUndoableActions();return React.useCallback(n=>{r(n)},[r])},useFakeStreamEffect=()=>{const{updateBlocksRuntime:r}=useBlocksStoreUndoableActions();return React.useCallback(async(n,o,a=30)=>{const i=lodashEs.keys(lodashEs.omit(o,["_id"]));for(const l of i){const c=o[l];if(lodashEs.isString(c)){const u=lodashEs.chunk(c.split(""),12);let d="";r([n],{[l]:""});for(let p=0;p<u.length;p++)d+=u[p].join(""),r([n],{[l]:d}),await new Promise(f=>setTimeout(f,a))}}},[r])},useStreamMultipleBlocksProps=()=>{const{updateMultipleBlocksProps:r}=useBlocksStoreUndoableActions(),n=useFakeStreamEffect();return React.useCallback(async o=>{for(const a of o)await n(a._id,a);r(o)},[r])},useUpdateBlocksPropsRealtime=()=>{const{updateBlocksRuntime:r}=useBlocksStoreUndoableActions();return React.useCallback((n,o)=>{r(n,o)},[r])},selectedBreakpointsAtom=atomWithStorage("selectedBreakpoints",["XS","MD","XL"]),useSelectedBreakpoints=()=>{const[r,n]=jotai.useAtom(selectedBreakpointsAtom);return[r,n]},readOnlyModeAtom=jotai.atom(!1);readOnlyModeAtom.debugLabel="readOnlyModeAtom";const networkModeAtom=jotai.atom("online");networkModeAtom.debugLabel="networkModeAtom";jotai.atom("");const editLayerNameAtom=jotai.atom(!1);editLayerNameAtom.debugLabel="editLayerNameAtom";const activeLanguageAtom=jotai.atom("");activeLanguageAtom.debugLabel="activeLanguageAtom";const primaryLanguageAtom=jotai.atom("");primaryLanguageAtom.debugLabel="primaryLanguageAtom";const canvasIframeAtom=jotai.atom(null);canvasIframeAtom.debugLabel="canvasIframeAtom";const activePanelAtom=jotai.atom("outline");activePanelAtom.debugLabel="activePanelAtom";const showPredefinedBlockCategoryAtom=jotai.atom("");showPredefinedBlockCategoryAtom.debugLabel="showPredefinedBlockCategoryAtom";const historyStatesAtom=jotai.atom({undoCount:0,redoCount:0});historyStatesAtom.debugLabel="historyStatesAtom";const inlineEditingActiveAtom=jotai.atom("");inlineEditingActiveAtom.debugLabel="inlineEditingActiveAtom";const draggingFlagAtom=jotai.atom(!1);draggingFlagAtom.debugLabel="draggingFlagAtom";const treeRefAtom=jotai.atom(null);treeRefAtom.debugLabel="treeRefAtom";const canvasSettingsAtom=jotai.atom({});canvasSettingsAtom.debugLabel="canvasSettingsAtom";const aiAssistantActiveAtom=jotai.atom(!1);aiAssistantActiveAtom.debugLabel="askAiActiveBlockAtom";const codeEditorOpenAtom=jotai.atom(!1);codeEditorOpenAtom.debugLabel="codeEditorOpenAtom";const codeEditorHeightAtom=atomWithStorage("codeEditorHeight",500);codeEditorHeightAtom.debugLabel="codeEditorHeightAtom";const xShowBlocksAtom=jotai.atom([]);xShowBlocksAtom.debugLabel="xShowBlocksAtom";const selectedLibraryAtom=atomWithStorage("_selectedLibrary",null);selectedLibraryAtom.debugLabel="selectedLibraryAtom";const useBuilderReset=()=>{const r=jotai.useSetAtom(historyStatesAtom),{clear:n}=useUndoManager(),[,o]=useSelectedBlockIds(),[,a]=useHighlightBlockId(),[,i]=useSelectedStylingBlocks(),[,l]=useAtom(aiAssistantActiveAtom);return()=>{o([]),i([]),a(""),n(),l(!1),r({undoCount:0,redoCount:0})}},useUILibraryBlocks=()=>({data:useBuilderProp("uiLibraries",[]),isLoading:!1}),useCopyToClipboard=()=>{const[r,n]=React.useState(null),o=React.useCallback(async a=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(a),n(a),!0}catch(i){return console.warn("Copy failed",i),n(null),!1}},[]);return[r,o]},codeEditorAtom=jotai.atom(null),useCodeEditor=()=>jotai.useAtom(codeEditorAtom),layoutVariantAtom=atomWithStorage("_layout_variant_mode","DUAL_SIDE_PANEL"),useLayoutVariant=()=>{const[r,n]=jotai.useAtom(layoutVariantAtom),o=useBuilderProp("layoutVariant","DUAL_SIDE_PANEL");return[r||o,n]},IframeInitialContent=`<!doctype html>
2
2
  <html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
3
3
  <head>
4
4
  <meta charset="UTF-8">
@@ -58,7 +58,7 @@
58
58
  outline: 1px solid ${o.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
59
59
  }`)},[o,m]),React.useEffect(()=>{g.textContent=c?`[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}`:""},[c,g]),React.useEffect(()=>{f&&(f.textContent=i?`[data-style-id="${i}"], [data-block-id="${i}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[i,o,f]),React.useEffect(()=>{h&&(h.textContent=`${lodashEs.map(l,({id:v})=>`[data-style-id="${v}"]`).join(",")}{
60
60
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
61
- }`)},[l,h]),React.useEffect(()=>{d.querySelector("#drop-target-block").innerHTML=u?`[data-block-id="${u}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}`:""},[u]),jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:(y||b)&&jsxRuntime.jsxRuntimeExports.jsx("link",{rel:"stylesheet",href:`https://fonts.googleapis.com/css2?family=${y?`${y.replace(/ /g,"+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900`:""}${y&&b&&y!==b?"&":""}${b&&b!==y?`family=${b.replace(/ /g,"+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900`:""}&display=swap`})})},useChaiExternalData=()=>jotai.useAtom(chaiExternalDataAtom),useCanvasSettings=()=>jotai.useAtom(canvasSettingsAtom),isVisibleAtBreakpoint=(r,n)=>{const o=["xs","sm","md","lg","xl","2xl"],a=o.indexOf(n),i=r.split(" ");let l=new Array(o.length).fill(!1);for(const c of i){let[u,d]=c.split(":");d||(d=u,u="xs");const p=o.indexOf(u);if(p<=a){const f=["block","flex","inline","inline-block","inline-flex","grid","table"],m=["hidden"];if(f.includes(d))for(let h=p;h<o.length;h++)l[h]=!0;else if(m.includes(d))for(let h=p;h<o.length;h++)l[h]=!1}}return l[a]},getSlots=r=>{const n={};return Object.keys(r).forEach(o=>{lodashEs.isString(r[o])&&r[o].startsWith(STRINGS.SLOT_KEY)&&(n[o]=r[o].replace(STRINGS.SLOT_KEY,"").split(","))}),n},generateClassNames=lodashEs.memoize(r=>{const n=r.replace(STRINGS.STYLES_KEY,"").split(",");return tailwindMerge.twMerge(n[0],n[1])});function getElementAttrs(r,n){return lodashEs.get(r,`${n}_attrs`,{})}function getStyleAttrs(r,n){const o={};return Object.keys(r).forEach(a=>{if(lodashEs.isString(r[a])&&r[a].startsWith(STRINGS.STYLES_KEY)){const i=generateClassNames(r[a]),l=getElementAttrs(r,a);o[a]={className:i,"data-style-prop":a,"data-block-parent":r._id,"data-style-id":`${a}-${r._id}`,...l};const c=lodashEs.has(l,"x-show")||lodashEs.has(l,"x-if");c&&(o.__isHidden=c&&!isVisibleAtBreakpoint(i,n))}}),o}function applyBindings(r,n){const o=lodashEs.get(r,"_bindings",{});return lodashEs.isEmpty(o)?{...r}:(lodashEs.each(o,(a,i)=>{lodashEs.isString(a)&&lodashEs.get(n,a,null)&&(r[i]=lodashEs.get(n,a,null))}),r)}function isDescendant(r,n,o){if(!lodashEs.find(o,{_id:r}))return!1;const i=lodashEs.filter(o,{_parent:r});return i.some(l=>l._id===n)?!0:i.some(l=>isDescendant(l._id,n,o))}function BlocksRendererStatic({blocks:r}){const[n]=useBlocksStore(),[o]=jotai.useAtom(xShowBlocksAtom),[a]=useCutBlockIds(),[i]=jotai.useAtom(draggedBlockAtom),[l]=jotai.useAtom(dropTargetBlockIdAtom),[,c]=useCanvasWidth(),[u]=useCanvasSettings(),[d]=useHiddenBlockIds(),p=React.useCallback(g=>getStyleAttrs(g,c),[c]),[f]=useChaiExternalData(),[m]=jotai.useAtom(inlineEditingActiveAtom),h=React.useCallback(g=>g.reduce((y,b)=>{const v=lodashEs.get(u,b,{});return{...y,...v}},{}),[u,n]);return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:React.Children.toArray(r.map((g,y)=>{if(m===g._id||d.includes(g._id))return null;const b=getSlots(g),v={};lodashEs.isEmpty(b)||Object.keys(b).forEach(k=>{v[k]=React.Children.toArray(b[k].map(j=>jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{blocks:[lodashEs.find(n,{_id:j})]})))});const x=lodashEs.filter(n,{_parent:g._id});v.children=x.length?jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{blocks:x}):null;const E=runtime.getBlockComponent(g._type),S=lodashEs.get(E,"builderComponent",lodashEs.get(E,"component",null));if(lodashEs.isNull(S))return jsxRuntime.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${g==null?void 0:g._type} not registered -->`});const w=lodashEs.has(E,"getBlockStateFrom")?E==null?void 0:E.getBlockStateFrom(g,n):[],R=h(w),A=p(g);if(lodashEs.get(A,"__isHidden",!1)&&!lodashEs.includes(o,g._id))return null;const C=i&&isDescendant(i._id,g._id,n);return jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:React.createElement(S,{blockProps:{...lodashEs.includes(o,g._id)?{"force-show":""}:{},"data-block-id":g._id,"data-block-type":g._type,...i?{"data-dnd":canAcceptChildBlock(g._type,i==null?void 0:i._type)?"yes":"no","data-dnd-dragged":i._id===g._id||C?"yes":"no"}:{},...l===g._id&&!C?{"data-drop":"yes"}:{},...lodashEs.includes(a,g._id)?{"data-cut-block":"yes"}:{}},index:y,...applyBindings(g,f),...lodashEs.omit(A,["__isHidden"]),...v,inBuilder:!0,blockState:R})})}))})}const useAllDataProviders=()=>React.useMemo(()=>runtime.getChaiDataProviders(),[]),BlocksExternalDataProvider=({children:r})=>{const[,n]=useChaiExternalData(),[o]=usePageDataProviders(),a=useAllDataProviders();return React.useEffect(()=>(n({}),lodashEs.each(o,i=>{const l=lodashEs.find(a,{providerKey:i.providerKey});if(l){const c=(l==null?void 0:l.mockFn)||(l==null?void 0:l.dataFn);c&&c(i.args).then(u=>n(d=>({...d,[i.providerKey]:u})))}}),()=>{lodashEs.each(o,i=>{n(l=>(delete l[i.providerKey],l))})}),[a,o,n]),jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:r})},StaticBlocksRenderer=()=>{const[r]=useBlocksStore(),n=lodashEs.isEmpty(r)?null:jsxRuntime.jsxRuntimeExports.jsx(BlocksExternalDataProvider,{children:jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{blocks:lodashEs.filter(r,o=>lodashEs.isEmpty(o._parent))})});return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:n})},AddBlockAtBottom=()=>{const{t:r}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsxs("button",{onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK}),className:"mt-1 block w-full rounded-md bg-gray-100 p-2 text-black hover:bg-gray-200 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-700",children:["+ ",r("add_block")]})},ResizableCanvasWrapper=({children:r,onMount:n,onResize:o})=>{const a=React.useRef(null),i=web.useDebouncedCallback(()=>{const{clientWidth:l}=a.current;o(l)},[a.current],100);return web.useResizeObserver(a.current,i,a.current!==null),React.useEffect(()=>{const{clientWidth:l}=a.current;n(l)},[]),jsxRuntime.jsxRuntimeExports.jsx("div",{id:"main-content",className:"h-full w-full p-8 pb-0",ref:a,children:r})},getElementByStyleId=(r,n)=>r.querySelector(`[data-style-id="${n}"]`),StaticCanvas=()=>{const[r]=jotai.useAtom(networkModeAtom),[n]=useCanvasWidth(),[,o]=useSelectedBlockIds(),a=useSelectedBlock(),[,i]=useHighlightBlockId(),l=React.useRef(null),c=React.useRef(null),[u,d]=React.useState({width:0,height:0}),p=useCanvasScale(u),[f,m]=React.useState([]),[,h]=React.useState([]),[,g]=jotai.useAtom(canvasIframeAtom),[y,b]=useSelectedStylingBlocks(),v=useBuilderProp("loading",!1),x=useBuilderProp("htmlDir","ltr"),E=R=>{d(A=>({...A,width:R}))};React.useEffect(()=>{if(!c.current)return;const{clientWidth:R,clientHeight:A}=c.current;d({width:R,height:A})},[c,n]);const S=(R,A=0)=>{const{top:C}=R.getBoundingClientRect();return C+A>=0&&C-A<=window.innerHeight};React.useEffect(()=>{var R,A;if(a&&a.type!=="Multiple"&&l.current){const C=getElementByDataBlockId(l.current.contentDocument,a._id);C&&(S(C)||(A=(R=l.current)==null?void 0:R.contentWindow)==null||A.scrollTo({top:C.offsetTop,behavior:"smooth"}),m([C]))}},[a]),React.useEffect(()=>{if(!lodashEs.isEmpty(y)&&l.current){const R=getElementByStyleId(l.current.contentDocument,lodashEs.first(y).id);h(R?[R]:[null])}else h([null])},[y]);const w=React.useMemo(()=>{let R=IframeInitialContent;return R=R.replace("__HTML_DIR__",x),r==="offline"&&(R=R.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),R=R.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),R=R.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),R},[r,x]);return jsxRuntime.jsxRuntimeExports.jsx(ResizableCanvasWrapper,{onMount:E,onResize:E,children:jsxRuntime.jsxRuntimeExports.jsx("div",{onClick:()=>{o([]),b([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto h-full w-full overflow-hidden",ref:c,children:jsxRuntime.jsxRuntimeExports.jsxs(ChaiFrame,{contentDidMount:()=>g(l.current),ref:l,id:"canvas-iframe",style:{...p,...lodashEs.isEmpty(p)?{width:`${n}px`}:{}},className:"relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:w,children:[jsxRuntime.jsxRuntimeExports.jsx(KeyboardHandler,{}),jsxRuntime.jsxRuntimeExports.jsx(BlockActionsStatic,{block:a,selectedBlockElement:lodashEs.first(f)}),jsxRuntime.jsxRuntimeExports.jsx(HeadTags,{model:"page"}),jsxRuntime.jsxRuntimeExports.jsx(reactWrapBalancer.Provider,{children:jsxRuntime.jsxRuntimeExports.jsxs(Canvas,{children:[v?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"})}):jsxRuntime.jsxRuntimeExports.jsx(StaticBlocksRenderer,{}),jsxRuntime.jsxRuntimeExports.jsx(AddBlockAtBottom,{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})}),jsxRuntime.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})})},StaticCanvas$1=StaticCanvas,FallbackError=()=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center",children:[jsxRuntime.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),jsxRuntime.jsxRuntimeExports.jsx("p",{children:"Please try again."})]})}),TypeIcon=r=>{switch(r.type){case"Image":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ImageIcon,{});case"Heading":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.HeadingIcon,{});case"Text":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{});case"Link":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Link1Icon,{});case"Video":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.VideoIcon,{});case"RichText":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CursorTextIcon,{});case"Button":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{});case"CustomHTML":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CodeIcon,{});case"Divider":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DividerHorizontalIcon,{});case"Icon":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SketchLogoIcon,{});case"List":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{});case"Paragraph":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{});case"Row":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{});case"ListItem":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ColumnsIcon,{});case"LineBreak":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SpaceBetweenVerticallyIcon,{});case"Form":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.GroupIcon,{});case"Checkbox":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CheckboxIcon,{});case"FormButton":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{});case"Input":case"TextArea":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InputIcon,{});case"Radio":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RadiobuttonIcon,{});case"Select":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DropdownMenuIcon,{});case"Table":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TableIcon,{});case"TableHead":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderTopIcon,{});case"TableBody":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderAllIcon,{});case"TableRow":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ViewHorizontalIcon,{});case"TableCell":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DragHandleHorizontalIcon,{});case"DataProvider":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.DatabaseIcon,{size:16});case"Box":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxIcon,{});default:return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxModelIcon,{})}},Breadcrumb=()=>{const r=useSelectedBlockHierarchy(),[,n]=useSelectedBlockIds(),[,o]=useHighlightBlockId();return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mx-2 border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground",children:jsxRuntime.jsxRuntimeExports.jsxs("ol",{className:"flex items-center whitespace-nowrap",children:[jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"inline-flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:()=>n([]),variant:"ghost",className:"h-fit p-1 text-xs font-normal",children:"Body"}),jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronRight,{size:16})]}),lodashEs.reverse(r).map((a,i)=>jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"inline-flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{onMouseEnter:()=>{o(a==null?void 0:a._id)},onClick:()=>n([a==null?void 0:a._id]),variant:"ghost",className:"h-fit gap-x-1 p-1 text-xs font-normal",children:[jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:a==null?void 0:a._type}),a._name||a._type]}),i!==r.length-1&&jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronRight,{size:16})]},i))]})})},CodeEditor$1=React.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-nUyO-Y3p.cjs"))),CanvasArea=()=>{const[r]=useCodeEditor(),n=useBuilderProp("onError",lodashEs.noop);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-full flex-1 flex-col",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2",children:[jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"}),children:jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:n,children:jsxRuntime.jsxRuntimeExports.jsx(StaticCanvas$1,{})})}),r?jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"}),children:jsxRuntime.jsxRuntimeExports.jsx(reResizable.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:jsxRuntime.jsxRuntimeExports.jsx(CodeEditor$1,{})})}):null,jsxRuntime.jsxRuntimeExports.jsx(Breadcrumb,{})]})})},CanvasArea$1=CanvasArea,ColorField=({value:r,onChange:n,id:o,onBlur:a})=>{const i=lodashEs.debounce(n,200),l=c=>i(c.target.value);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:jsxRuntime.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:r,onBlur:({target:{value:c}})=>a(o,c),onChange:l})})})},FONTS=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"},{title:"Bebas Neue",value:"Bebas Neue"},{title:"Manrope",value:"Manrope"}],ThemeConfigPanel=({showHeading:r=!0,className:n=""})=>{const[o,a]=useBrandingOptions(),[i]=useBlocksContainer(),l=React__namespace.useRef(o),{t:c}=reactI18next.useTranslation(),u=({formData:w},R)=>{R&&(a(w),l.current=w)},{bodyFont:d,headingFont:p,primaryColor:f,bodyTextDarkColor:m,bodyTextLightColor:h,bodyBgDarkColor:g,secondaryColor:y,bodyBgLightColor:b,roundedCorners:v}=o;let x={headingFont:iconBase.f({title:c("theme_config.heading_font"),default:p,options:FONTS}),bodyFont:iconBase.f({title:c("theme_config.body_font"),default:d,options:FONTS}),roundedCorners:iconBase.y({title:c("theme_config.rounded_corner"),default:parseInt(v||5,10)}),primaryColor:iconBase.s({title:c("theme_config.primary"),default:f}),secondaryColor:iconBase.s({title:c("theme_config.secondary"),default:y})};i||(x={...x,bodyBgLightColor:iconBase.s({title:c("theme_config.background"),default:b}),bodyTextLightColor:iconBase.s({title:c("theme_config.text_color"),default:m}),bodyBgDarkColor:iconBase.s({title:c("theme_config.background_dark_mode"),default:g}),bodyTextDarkColor:iconBase.s({title:c("theme_config.text_color_dark_mode"),default:h})});const E={type:"object",properties:{}},S={};return Object.keys(x).forEach(w=>{const R=x[w];return E.properties||(E.properties={}),E.properties[w]=R.schema,S[w]=R.uiSchema,!0}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("flex h-full w-full select-none flex-col",n),children:[r?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:jsxRuntime.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:c("Theme Configuration")})}):null,jsxRuntime.jsxRuntimeExports.jsx(Form,{widgets:{color:ColorField},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:S,schema:E,formData:o,validator,onChange:u})]})},ThemeOptions=ThemeConfigPanel,placeholderStyle={display:"flex",alignItems:"center",zIndex:1},DefaultCursor=React.memo(function({top:n,left:o}){const a={position:"absolute",pointerEvents:"none",top:n+"px",left:o+"px",right:0};return jsxRuntime.jsxRuntimeExports.jsx("div",{style:{...placeholderStyle,...a},children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-0.5 flex-1 rounded-[1px] bg-green-500"})})}),Overlay$1=React.memo(function({children:n,isDragging:o}){return o?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pointer-events-none fixed left-0 top-0 z-[100] h-full w-full",children:n}):null}),DefaultDragPreview=React.memo(({id:r,isDragging:n,mouse:o})=>{const[a]=useBlocksStore(),i=React.useMemo(()=>a.find(c=>c._id===r),[a,r]),l=React.useMemo(()=>({transform:`translate(${(o==null?void 0:o.x)-10}px, ${(o==null?void 0:o.y)-10}px)`}),[o]);return o?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx(Overlay$1,{isDragging:n,children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pointer-events-none absolute z-50 rounded border border-border bg-gray-100/80 font-semibold text-blue-600 shadow-md dark:border-gray-700 dark:bg-gray-800",style:l,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex !cursor-grab items-center p-0.5","aria-label":`Type: ${i==null?void 0:i._type}`,children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:i==null?void 0:i._type})}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:(i==null?void 0:i._name)||(i==null?void 0:i._type)})]})})})}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"hidden"})}),CopyPasteBlocks=()=>{const[r]=useSelectedBlockIds(),{canPaste:n,pasteBlocks:o}=usePasteBlocks(),[,a]=useCopyBlockIds(),{t:i}=reactI18next.useTranslation(),l=useSelectedBlock();return jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{disabled:!canDuplicateBlock(l==null?void 0:l._type),onClick:()=>a(r),className:"flex items-center gap-x-4 text-xs",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CopyIcon,{})," Copy"]}),n(r[0])&&jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>{o(r)},children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CardStackIcon,{})," ",i("Paste")]})]})},CutBlocks=()=>{const[r]=useSelectedBlockIds(),[,n]=useCutBlockIds(),{t:o}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(r),children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ScissorsIcon,{})," ",o("Cut")]})},RemoveBlocks=()=>{const[r]=useSelectedBlockIds(),n=useRemoveBlocks(),o=useSelectedBlock(),{t:a}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{disabled:!canDeleteBlock(o==null?void 0:o._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>n(r),children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TrashIcon,{})," ",a("Remove")]})},BlockContextMenuContent=()=>{const{t:r}=reactI18next.useTranslation(),[n]=useSelectedBlockIds(),o=useDuplicateBlocks(),a=useSelectedBlock(),i=React.useCallback(()=>{o(n)},[n,o]);return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuContent,{className:"border-border text-xs",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{disabled:!canAddChildBlock(a==null?void 0:a._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK,data:a}),children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.PlusIcon,{size:"14"})," ",r("Add block")]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{disabled:!canDuplicateBlock(a==null?void 0:a._type),className:"flex items-center gap-x-4 text-xs",onClick:i,children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CardStackPlusIcon,{})," ",r("Duplicate")]}),jsxRuntime.jsxRuntimeExports.jsx(CutBlocks,{}),jsxRuntime.jsxRuntimeExports.jsx(CopyPasteBlocks,{}),jsxRuntime.jsxRuntimeExports.jsx(RemoveBlocks,{})]})},BlockContextMenu=({children:r})=>jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenu,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.ContextMenuTrigger,{asChild:!0,children:r}),jsxRuntime.jsxRuntimeExports.jsx(BlockContextMenuContent,{})]})}),defaultShortcuts=[{key:"ArrowDown",command:"selectNext"},{key:"ArrowUp",command:"selectPrev"},{key:"ArrowLeft",command:"selectParent",when:"isLeaf || isClosed"},{key:"ArrowLeft",command:"close",when:"isOpen"},{key:"ArrowRight",command:"open",when:"isClosed"},{key:"ArrowRight",command:"selectNext",when:"isOpen"},{key:"Home",command:"selectFirst"},{key:"End",command:"selectLast"}];function selectFirst(r){r.firstNode&&r.select(r.firstNode.id)}function selectLast(r){r.lastNode&&r.select(r.lastNode.id)}function selectNext(r){const n=r.selectedNodes[0].next||r.firstNode;r.select(n.id)}function selectPrev(r){const n=r.selectedNodes[0].prev||r.lastNode;r.select(n.id)}const selectParent=(r,n)=>{var a;const o=((a=r.selectedIds[0])==null?void 0:a.parent)||null;o&&n&&r.select(o.id)},open=(r,n)=>{const o=r.selectedNodes[0];o.isInternal&&n&&o.open()},close=(r,n)=>{const o=r.selectedNodes[0];o.isInternal&&n&&o.close()};function VscJson(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.984V2h-.09c-.313 0-.616.062-.909.185a2.33 2.33 0 0 0-.775.53 2.23 2.23 0 0 0-.493.753v.001a3.542 3.542 0 0 0-.198.83v.002a6.08 6.08 0 0 0-.024.863c.012.29.018.58.018.869 0 .203-.04.393-.117.572v.001a1.504 1.504 0 0 1-.765.787 1.376 1.376 0 0 1-.558.115H2v.984h.09c.195 0 .38.04.556.121l.001.001c.178.078.329.184.455.318l.002.002c.13.13.233.285.307.465l.001.002c.078.18.117.368.117.566 0 .29-.006.58-.018.869-.012.296-.004.585.024.87v.001c.033.283.099.558.197.824v.001c.106.273.271.524.494.753.223.23.482.407.775.53.293.123.596.185.91.185H6v-.984h-.09c-.2 0-.387-.038-.563-.115a1.613 1.613 0 0 1-.457-.32 1.659 1.659 0 0 1-.309-.467c-.074-.18-.11-.37-.11-.573 0-.228.003-.453.011-.672.008-.228.008-.45 0-.665a4.639 4.639 0 0 0-.055-.64 2.682 2.682 0 0 0-.168-.609A2.284 2.284 0 0 0 3.522 8a2.284 2.284 0 0 0 .738-.955c.08-.192.135-.393.168-.602.033-.21.051-.423.055-.64.008-.22.008-.442 0-.666-.008-.224-.012-.45-.012-.678a1.47 1.47 0 0 1 .877-1.354 1.33 1.33 0 0 1 .563-.121H6zm4 10.032V14h.09c.313 0 .616-.062.909-.185.293-.123.552-.3.775-.53.223-.23.388-.48.493-.753v-.001c.1-.266.165-.543.198-.83v-.002c.028-.28.036-.567.024-.863-.012-.29-.018-.58-.018-.869 0-.203.04-.393.117-.572v-.001a1.502 1.502 0 0 1 .765-.787 1.38 1.38 0 0 1 .558-.115H14v-.984h-.09c-.196 0-.381-.04-.557-.121l-.001-.001a1.376 1.376 0 0 1-.455-.318l-.002-.002a1.415 1.415 0 0 1-.307-.465v-.002a1.405 1.405 0 0 1-.118-.566c0-.29.006-.58.018-.869a6.174 6.174 0 0 0-.024-.87v-.001a3.537 3.537 0 0 0-.197-.824v-.001a2.23 2.23 0 0 0-.494-.753 2.331 2.331 0 0 0-.775-.53 2.325 2.325 0 0 0-.91-.185H10v.984h.09c.2 0 .387.038.562.115.174.082.326.188.457.32.127.134.23.29.309.467.074.18.11.37.11.573 0 .228-.003.452-.011.672-.008.228-.008.45 0 .665.004.222.022.435.055.64.033.214.089.416.168.609a2.285 2.285 0 0 0 .738.955 2.285 2.285 0 0 0-.738.955 2.689 2.689 0 0 0-.168.602c-.033.21-.051.423-.055.64a9.15 9.15 0 0 0 0 .666c.008.224.012.45.012.678a1.471 1.471 0 0 1-.877 1.354 1.33 1.33 0 0 1-.563.121H10z"},child:[]}]})(r)}function BsLightningFill(r){return iconBase.GenIcon({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M5.52.359A.5.5 0 0 1 6 0h4a.5.5 0 0 1 .474.658L8.694 6H12.5a.5.5 0 0 1 .395.807l-7 9a.5.5 0 0 1-.873-.454L6.823 9.5H3.5a.5.5 0 0 1-.48-.641z"},child:[]}]})(r)}function TbEyeDown(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"},child:[]},{tag:"path",attr:{d:"M12 18c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"},child:[]},{tag:"path",attr:{d:"M19 16v6"},child:[]},{tag:"path",attr:{d:"M22 19l-3 3l-3 -3"},child:[]}]})(r)}function BiCollapseVertical(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 7.59 7.05 2.64 5.64 4.05 12 10.41l6.36-6.36-1.41-1.41L12 7.59zM5.64 19.95l1.41 1.41L12 16.41l4.95 4.95 1.41-1.41L12 13.59l-6.36 6.36z"},child:[]}]})(r)}function BiExpandVertical(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z"},child:[]}]})(r)}const Node=React.memo(({node:r,style:n,dragHandle:o})=>{const a=useBuilderProp("outlineMenuItems",[]),{t:i}=reactI18next.useTranslation(),[l,,c]=useHiddenBlockIds(),[,u]=useHighlightBlockId(),[d]=jotai.useAtom(canvasIframeAtom);let p=null;const f=r.children.length>0,{id:m,data:h,isSelected:g,willReceiveDrop:y,isDragging:b,isEditing:v,handleClick:x}=r,E=k=>{k.stopPropagation(),!l.includes(m)&&r.toggle()},S=k=>{k.isInternal&&(p=k.isOpen,k.isOpen&&k.close())},w=k=>{k.isInternal&&p!==null&&(p?k.open():k.close(),p=null)},R=k=>{k.stopPropagation(),!r.isOpen&&!l.includes(m)&&r.toggle(),x(k)};React.useEffect(()=>{const k=setTimeout(()=>{y&&!r.isOpen&&!b&&!l.includes(m)&&r.toggle()},500);return()=>clearTimeout(k)},[y,r,b]);const A=React.useMemo(()=>{const k=Object.keys(h),j=[];for(let I=0;I<k.length;I++)if(k[I].endsWith("_attrs")){const P=h[k[I]],O=Object.keys(P).join("|");O.match(/x-data/)&&j.push("data"),O.match(/x-on/)&&j.push("event"),O.match(/x-show|x-if/)&&j.push("show")}return j},[h]),C=(k,j)=>{const I=d.contentDocument||d.contentWindow.document,P=I.querySelector(`[data-block-id=${k}]`);P&&P.setAttribute("data-drop",j);const O=P.getBoundingClientRect(),B=d.getBoundingClientRect();O.top>=B.top&&O.left>=B.left&&O.bottom<=B.bottom&&O.right<=B.right||(I.documentElement.scrollTop=P.offsetTop-B.top)};return m===STRINGS.ROOT_TEMP_KEY?jsxRuntime.jsxRuntimeExports.jsxs("button",{onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK}),className:"mb-10 mt-5 w-full rounded bg-gray-100 p-1 hover:bg-gray-200 dark:bg-gray-800",children:["+ ",i("add_block")]}):jsxRuntime.jsxRuntimeExports.jsx(BlockContextMenu,{id:m,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>u(m),onClick:R,style:n,"data-node-id":m,ref:l.includes(m)?null:o,onDragStart:()=>S(r),onDragEnd:()=>w(r),onDragOver:k=>{k.preventDefault(),C(m,"yes")},onDragLeave:k=>{k.preventDefault(),C(m,"no")},onDrop:k=>{k.preventDefault(),C(m,"no")},className:iconBase.cn("group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",g?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800",y&&canAcceptChildBlock(h._type,"Icon")?"bg-green-200":"",b&&"opacity-20",l.includes(m)?"opacity-50":""),children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${r.isOpen?"rotate-90":""}`,children:f&&jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:E,type:"button",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TriangleRightIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:h==null?void 0:h._type})}),v?jsxRuntime.jsxRuntimeExports.jsx(Input$1,{node:r}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"ml-2 flex items-center gap-x-1 truncate text-[11px]",onDoubleClick:k=>{k.stopPropagation(),r.edit(),r.deselect()},children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:(h==null?void 0:h._name)||(h==null?void 0:h._type.split("/").pop())}),A.includes("data")&&jsxRuntime.jsxRuntimeExports.jsx(VscJson,{className:"h-3 w-3 text-orange-600"}),A.includes("event")&&jsxRuntime.jsxRuntimeExports.jsx(BsLightningFill,{className:"h-3 w-3 text-yellow-500"}),A.includes("show")&&jsxRuntime.jsxRuntimeExports.jsx(TbEyeDown,{className:"h-3 w-3 text-orange-600"})]})]})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"invisible flex items-center space-x-1 pr-2 group-hover:visible",children:[!l.includes(m)&&a.map(k=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",asChild:!0,children:React.createElement(k.item,{blockId:m})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-10",children:k.tooltip})]})),canAddChildBlock(h==null?void 0:h._type)&&!l.includes(m)?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK,data:{_id:m}}),className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.PlusIcon,{size:"18"})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:i("Add block")})]}):null,jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{onClick:k=>{k.stopPropagation(),c(m),r.isOpen&&r.toggle()},className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.EyeOff,{size:"15"})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:i("Add block")})]})]})]})})}),Input$1=({node:r})=>{var n,o;return jsxRuntime.jsxRuntimeExports.jsx("input",{autoFocus:!0,className:"ml-2 !h-4 w-full rounded-sm border border-border bg-background px-1 text-[11px] outline-none",type:"text",defaultValue:((n=r.data)==null?void 0:n._name)||((o=r.data)==null?void 0:o._type),onFocus:a=>a.currentTarget.select(),onBlur:a=>r.submit(a.currentTarget.value),onKeyDown:a=>{a.key==="Enter"&&r.submit(a.currentTarget.value)}})},useCanMove=()=>{const[r]=useBlocksStore();return(n,o)=>{var l;const a=(l=lodashEs.find(r,{_id:o}))==null?void 0:l._type,i=lodashEs.first(n.map(c=>{var u;return(u=lodashEs.find(r,{_id:c}))==null?void 0:u._type}));return canAcceptChildBlock(a,i)}},ListTree=()=>{const[treeData]=jotai.useAtom(treeDSBlocks),[ids,setIds]=useSelectedBlockIds(),[cutBlocksIds]=useCutBlockIds(),[,setHiddenBlocks]=useHiddenBlockIds(),updateBlockProps=useUpdateBlocksProps(),[,setStyleBlocks]=useSelectedStylingBlocks(),{moveBlocks}=useBlocksStoreUndoableActions(),canMove=useCanMove(),treeRef=React.useRef(null),[,setTreeRef]=jotai.useAtom(treeRefAtom),{t}=reactI18next.useTranslation(),clearSelection=()=>{setIds([]),setStyleBlocks([])},filteredTreeData=React.useMemo(()=>{const r=(o,a)=>o.filter(i=>!a.includes(i._id)).map(i=>({...i,children:i.children?r(i.children,a):[]}));return[...r(treeData,cutBlocksIds),{_type:STRINGS.ROOT_TEMP_KEY,_id:STRINGS.ROOT_TEMP_KEY,children:[]}]},[treeData,cutBlocksIds]);React.useEffect(()=>{setTreeRef(treeRef.current)},[treeRef.current]);const onRename=({id:r,name:n,node:o})=>{updateBlockProps([r],{_name:n},o.data._name)},onMove=({dragIds:r,parentId:n,index:o})=>{canMove(r,n)&&moveBlocks(r,n,o)},onSelect=r=>{if(r.length===0)return;const n=r[0]?r[0].id:"";setStyleBlocks([]),setIds([n])},onContextMenu=r=>{var a;r.preventDefault();const n=r.target,o=n.getAttribute("data-node-id")||((a=n.closest("[data-node-id]"))==null?void 0:a.getAttribute("data-node-id"));o&&(setStyleBlocks([]),setIds([o]))},debouncedDisableDrop=web.useDebouncedCallback(({parentNode:r,dragNodes:n})=>{var o;return(r==null?void 0:r.data._type)===STRINGS.ROOT_TEMP_KEY||!canAcceptChildBlock(r==null?void 0:r.data._type,(o=n[0])==null?void 0:o.data._type)},[],300),handleKeyDown=e=>{if(!treeRef.current)return;const tree=treeRef.current,selectedNode=tree.selectedNodes[0];if(!selectedNode)return;setIds[selectedNode.id],setStyleBlocks([]);const isLeaf=!selectedNode.isInternal,isClosed=!selectedNode.isOpen,isOpen=selectedNode.isOpen,shortcut=defaultShortcuts.find(s=>s.key===e.key&&(!s.when||eval(s.when)));if(shortcut)switch(e.preventDefault(),shortcut.command){case"selectNext":selectNext(tree);break;case"selectPrev":selectPrev(tree);break;case"selectParent":selectParent(tree,isLeaf||isClosed);break;case"close":close(tree,isOpen);break;case"open":open(tree,isClosed);break;case"selectFirst":selectFirst(tree);break;case"selectLast":selectLast(tree);break}};return lodashEs.isEmpty(treeData)?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-10 flex h-full w-full items-center justify-center p-8 text-center",children:jsxRuntime.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-sm text-gray-400",children:[t("This page is empty"),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK}),variant:"default",size:"sm",children:["+ ",t("add_block")]})]})})}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:iconBase.cn("flex h-full select-none flex-col space-y-1"),onClick:()=>clearSelection(),children:jsxRuntime.jsxRuntimeExports.jsxs("div",{id:"outline-view",className:"no-scrollbar h-full overflow-y-auto text-xs",onKeyDown:r=>{treeRef.current.isEditing||handleKeyDown(r)},children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex items-center justify-end gap-x-2 pb-2 text-xs text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:()=>setHiddenBlocks([]),variant:"outline",className:"h-fit p-1 disabled:cursor-not-allowed disabled:opacity-50",size:"sm",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.EyeOpenIcon,{className:"h-4 w-4"})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:t("Show hidden blocks")})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{className:"h-fit p-1",onClick:()=>{var r;return(r=treeRef==null?void 0:treeRef.current)==null?void 0:r.openAll()},variant:"outline",size:"sm",children:jsxRuntime.jsxRuntimeExports.jsx(BiExpandVertical,{size:"14"})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:t("Expand all")})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{className:"h-fit p-1",onClick:()=>{var r;return(r=treeRef==null?void 0:treeRef.current)==null?void 0:r.closeAll()},variant:"outline",size:"sm",children:jsxRuntime.jsxRuntimeExports.jsx(BiCollapseVertical,{size:"14"})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:t("Collapse all")})]})]}),jsxRuntime.jsxRuntimeExports.jsx(reactArborist.Tree,{ref:treeRef,height:window.innerHeight-160,className:"no-scrollbar !h-full max-w-full !overflow-y-auto !overflow-x-hidden",selection:ids[0]||"",onRename,openByDefault:!1,onMove,rowHeight:25,data:[...filteredTreeData],renderCursor:DefaultCursor,onSelect,childrenAccessor:r=>r.children,width:"100%",renderDragPreview:DefaultDragPreview,indent:10,onContextMenu,disableDrop:debouncedDisableDrop,idAccessor:"_id",children:Node})]})})},Outline$1=ListTree,hasVideoEmbed=r=>{const n=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,o=/(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;return n.test(r)||o.test(r)},getVideoURLFromHTML=r=>{if(lodashEs.isEmpty(r))return r;const n=/<video[^>]+src=['"]([^'">]+)['"]/,o=/<iframe[^>]+src=['"]([^'">]+)['"]/,a=r.match(n),i=r.match(o),l=a?a[1]:i?i[1]:null,c=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,u=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return l&&(c.test(l)||u.test(l))?l:r},NAME_ATTRIBUTE="$name",ATTRIBUTE_MAP={img:{alt:"alt",width:"width",height:"height",src:"image"},video:{src:"url",autoplay:"controls.autoPlay",muted:"controls.muted",loop:"controls.loop",controls:"controls.widgets"},a:{href:"link.href",target:"link.target",type:""},input:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},textarea:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},select:{placeholder:"placeholder",required:"required",multiple:"multiple",name:"fieldName"}},shouldAddText=(r,n)=>r.children.length===1&&lodashEs.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link"],n._type),getTextContent=r=>r.map(n=>n.type==="text"?lodashEs.get(n,"content",""):lodashEs.isEmpty(n.children)?"":getTextContent(n.children)).join(""),getSanitizedValue=r=>r===null?"":r,getAttrs=r=>{if(r.tagName==="svg")return{};const n={},o=ATTRIBUTE_MAP[r.tagName]||{},a=r.attributes;return lodashEs.forEach(a,({key:i,value:l})=>{if(i!==NAME_ATTRIBUTE)if(o[i]){if(r.tagName==="img"&&i==="src"&&!l.startsWith("http")){const c=lodashEs.find(r.attributes,{key:"width"}),u=lodashEs.find(r.attributes,{key:"height"});c&&u?l=`https://via.placeholder.com/${c==null?void 0:c.value}x${u==null?void 0:u.value}`:l="https://via.placeholder.com/150x150"}lodashEs.set(n,o[i],getSanitizedValue(l))}else lodashEs.includes(["style","class","srcset"],i)||(lodashEs.has(n,"styles_attrs")||(n.styles_attrs={}),lodashEs.startsWith(i,"@")&&(i=i.replace("@","x-on:")),n.styles_attrs[`${i}`]=getSanitizedValue(l))}),delete n.class,n},getStyles$1=(r,n="styles")=>{if(!r.attributes)return{[n]:`${STRINGS.STYLES_KEY},`};const o=lodashEs.find(r.attributes,{key:"class"});if(o){const a=o.value;return{[n]:`${STRINGS.STYLES_KEY},${a}`}}return{[n]:`${STRINGS.STYLES_KEY},`}},getBlockProps=r=>{switch(r.tagName){case"img":return{_type:"Image"};case"input":return{_type:"Input",showLabel:!1};case"hr":return{_type:"Divider"};case"br":return{_type:"LineBreak"};case"textarea":return{_type:"TextArea",showLabel:!1};case"audio":return{_type:"Audio"};case"canvas":return{_type:"Canvas"};case"video":case"iframe":return{_type:"CustomHTML"};case"svg":return{_type:"Icon"};case"select":return{_type:"Select",options:[]};case"option":return{_type:"Option"};case"ul":case"ol":case"dl":return{_type:"List",tag:r.tagName,_listType:r.tagName==="ol"?"list-decimal":"list-none"};case"li":case"dt":return{_type:"ListItem",tag:r.tagName};case"span":case"figcaption":case"legend":return{_type:"Span",tag:r.tagName};case"p":return{_type:"Paragraph",content:""};case"a":return{_type:"Link"};case"form":return{_type:"Form"};case"label":return{_type:"Label"};case"button":return{_type:"Button"};case"code":return{_type:"Code"};case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return{_type:"Heading",tag:r.tagName};case"table":return{_type:"Table"};case"tr":return{_type:"TableRow"};case"td":case"th":return{_type:"TableCell",tag:r.tagName};case"thead":return{_type:"TableHead"};case"tbody":return{_type:"TableBody"};case"tfoot":return{_type:"TableFooter"};default:const n=lodashEs.get(r,"children",[]).length>0?"Box":"EmptyBox";return{_type:n,tag:r.tagName,_name:n=="EmptyBox"||r.tagName==="div"?n:lodashEs.capitalize(r.tagName)}}},traverseNodes=(r,n=null)=>lodashEs.flatMapDeep(r,o=>{var l;if(o.type==="comment")return[];let a={_id:iconBase.generateUUID()};if(n&&(a._parent=n.block._id),o.type==="text")return lodashEs.isEmpty(lodashEs.get(o,"content",""))?[]:n&&shouldAddText(n.node,n.block)?(lodashEs.set(n,"block.content",lodashEs.get(o,"content","")),[]):{...a,_type:"Text",content:lodashEs.get(o,"content","")};if(a={...a,...getBlockProps(o),...getAttrs(o),...getStyles$1(o)},o.attributes){const c=o.attributes.find(u=>u.key===NAME_ATTRIBUTE);c&&(a._name=c.value)}if(a._type==="Input"){const c=a.inputType||"text";c==="checkbox"?lodashEs.set(a,"_type","Checkbox"):c==="radio"&&lodashEs.set(a,"_type","Radio")}else if(o.tagName==="video"||o.tagName==="iframe"){const c=himalaya.stringify([o]);return hasVideoEmbed(c)&&(lodashEs.set(a,"_type","Video"),lodashEs.set(a,"url",getVideoURLFromHTML(c)),lodashEs.set(a,"styles",`${STRINGS.STYLES_KEY},absolute top-0 left-0 w-full h-full`),lodashEs.set(a,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),a.content=c,[a]}else if(o.tagName==="svg"){const c=lodashEs.find(o.attributes,{key:"height"}),u=lodashEs.find(o.attributes,{key:"width"}),d=lodashEs.get(c,"value")?`[${lodashEs.get(c,"value")}px]`:"24px",p=lodashEs.get(u,"value")?`[${lodashEs.get(u,"value")}px]`:"24px",f=lodashEs.get(lodashEs.find(o.attributes,{key:"class"}),"value","w-full h-full");return a.styles=`${STRINGS.STYLES_KEY}, ${iconBase.cn(`w-${p} h-${d}`,f)}`.trim(),o.attributes=lodashEs.filter(o.attributes,m=>!lodashEs.includes(["style","width","height","class"],m.key)),a.icon=himalaya.stringify([o]),[a]}else if(o.tagName=="option"&&n&&((l=n.block)==null?void 0:l._type)==="Select")return n.block.options.push({label:getTextContent(o.children),...getAttrs(o)}),[];const i=traverseNodes(o.children,{block:a,node:o});return[a,...i]}),getSanitizedHTML=r=>{const n=r.match(/<body[^>]*>[\s\S]*?<\/body>/);return(n&&n.length>0?n[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):r).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},getBlocksFromHTML=r=>{const n=himalaya.parse(getSanitizedHTML(r));return lodashEs.isEmpty(r)?[]:lodashEs.flatten(traverseNodes(n))},ImportHTML=({parentId:r})=>{const{t:n}=reactI18next.useTranslation(),[o,a]=React.useState(""),{addPredefinedBlock:i}=useAddBlock(),l=()=>{const c=getBlocksFromHTML(o);i([...c],r),a(""),emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK})};return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Card,{className:"border-border/0 p-0 shadow-none",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CardHeader,{className:"p-3",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CardDescription,{children:n("html_snippet_description")})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CardContent,{className:"space-y-2 px-3 py-0",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{htmlFor:"current",className:"text-sm",children:n("tailwind_html_snippet")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{autoFocus:!0,tabIndex:1,ref:c=>c&&c.focus(),onChange:c=>a(c.target.value),rows:12,value:o,placeholder:n("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-background font-mono text-xs font-normal"})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CardFooter,{className:"flex flex-col justify-end p-3",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:o.trim()==="",onClick:()=>l(),size:"sm",className:"w-fit",children:n("Import HTML")})})]})},ImportHTML$1=ImportHTML,isBoolean=r=>typeof r=="boolean"||r instanceof Boolean,isNumber=r=>typeof r=="number"||r instanceof Number,isBigInt=r=>typeof r=="bigint"||r instanceof BigInt,isDate=r=>!!r&&r instanceof Date,isString=r=>typeof r=="string"||r instanceof String,isArray$4=r=>Array.isArray(r),isObject$1=r=>r instanceof Object&&r!==null;function useBool(r){const[n,o]=React.useState(r());return[n,()=>o(i=>!i),o]}let componentId=1;const generateNextId=()=>componentId++;function useComponentId(){const r=React.useRef();return r.current===void 0&&(r.current=`:jsnvw:${generateNextId()}:`),r.current}function ExpandableObject(r){let{field:n,value:o,data:a,lastElement:i,openBracket:l,closeBracket:c,level:u,style:d,shouldExpandNode:p,clickToExpandNode:f}=r;const m=React.useRef(!1),[h,g,y]=useBool(()=>p(u,o,n));React.useEffect(()=>{m.current?y(p(u,o,n)):m.current=!0},[p]);const b=h?d.collapseIcon:d.expandIcon,v=h?"collapse JSON":"expand JSON",x=useComponentId(),E=u+1,S=a.length-1,w=R=>{R.key===" "&&(R.preventDefault(),g())};return React.createElement("div",{className:d.basicChildStyle,role:"list"},React.createElement("span",{className:b,onClick:g,onKeyDown:w,role:"button",tabIndex:0,"aria-label":v,"aria-expanded":h,"aria-controls":h?x:void 0}),n&&(f?React.createElement("span",{className:d.clickableLabel,onClick:g,onKeyDown:w,role:"button",tabIndex:-1},n,":"):React.createElement("span",{className:d.label},n,":")),React.createElement("span",{className:d.punctuation},l),h?React.createElement("div",{id:x},a.map((R,A)=>React.createElement(DataRender,{key:R[0]||A,field:R[0],value:R[1],style:d,lastElement:A===S,level:E,shouldExpandNode:p,clickToExpandNode:f}))):React.createElement("span",{className:d.collapsedContent,onClick:g,onKeyDown:w,role:"button",tabIndex:-1,"aria-hidden":!0,"aria-label":v,"aria-expanded":h}),React.createElement("span",{className:d.punctuation},c),!i&&React.createElement("span",{className:d.punctuation},","))}function JsonObject(r){let{field:n,value:o,style:a,lastElement:i,shouldExpandNode:l,clickToExpandNode:c,level:u}=r;return ExpandableObject({field:n,value:o,lastElement:i||!1,level:u,openBracket:"{",closeBracket:"}",style:a,shouldExpandNode:l,clickToExpandNode:c,data:Object.keys(o).map(d=>[d,o[d]])})}function JsonArray(r){let{field:n,value:o,style:a,lastElement:i,level:l,shouldExpandNode:c,clickToExpandNode:u}=r;return ExpandableObject({field:n,value:o,lastElement:i||!1,level:l,openBracket:"[",closeBracket:"]",style:a,shouldExpandNode:c,clickToExpandNode:u,data:o.map(d=>[void 0,d])})}function JsonPrimitiveValue(r){let{field:n,value:o,style:a,lastElement:i}=r,l=o,c=a.otherValue;return o===null?(l="null",c=a.nullValue):o===void 0?(l="undefined",c=a.undefinedValue):isString(o)?(l=a.noQuotesForStringValues?o:`"${o}"`,c=a.stringValue):isBoolean(o)?(l=o?"true":"false",c=a.booleanValue):isNumber(o)?(l=o.toString(),c=a.numberValue):isBigInt(o)?(l=`${o.toString()}n`,c=a.numberValue):isDate(o)?l=o.toISOString():l=o.toString(),n===""&&(n='""'),React.createElement("div",{className:a.basicChildStyle,role:"listitem"},n&&React.createElement("span",{className:a.label},n,":"),React.createElement("span",{className:c},l),!i&&React.createElement("span",{className:a.punctuation},","))}function DataRender(r){const n=r.value;return isArray$4(n)?React.createElement(JsonArray,Object.assign({},r)):isObject$1(n)&&!isDate(n)?React.createElement(JsonObject,Object.assign({},r)):React.createElement(JsonPrimitiveValue,Object.assign({},r))}var styles$2={"container-base":"_GzYRV","punctuation-base":"_3eOF8",pointer:"_1MFti","expander-base":"_f10Tu _1MFti","expand-icon":"_1UmXx","collapse-icon":"_1LId0","collapsed-content-base":"_1pNG9 _1MFti","container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"};const defaultStyles={container:styles$2["container-light"],basicChildStyle:styles$2["basic-element-style"],label:styles$2["label-light"],clickableLabel:styles$2["clickable-label-light"],nullValue:styles$2["value-null-light"],undefinedValue:styles$2["value-undefined-light"],stringValue:styles$2["value-string-light"],booleanValue:styles$2["value-boolean-light"],numberValue:styles$2["value-number-light"],otherValue:styles$2["value-other-light"],punctuation:styles$2["punctuation-light"],collapseIcon:styles$2["collapse-icon-light"],expandIcon:styles$2["expand-icon-light"],collapsedContent:styles$2["collapsed-content-light"],noQuotesForStringValues:!1},allExpanded=()=>!0,JsonView=r=>{let{data:n,style:o=defaultStyles,shouldExpandNode:a=allExpanded,clickToExpandNode:i=!1}=r;return React.createElement("div",{className:o.container},React.createElement(DataRender,{value:n,style:o,lastElement:!0,level:0,shouldExpandNode:a,clickToExpandNode:i}))};function getPathAndTypes(r){const n=[],o={};function a(i,l){lodashEs.forEach(l,(c,u)=>{const d=i?`${i}.${u}`:u,p=lodashEs.isArray(c)?"list":typeof c;n.push(d),o[d]=p==="string"?"text":p==="object"?"model":p,p==="object"&&!lodashEs.isArray(c)&&a(d,c)})}return a("",lodashEs.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:n,pathsType:o}}const ViewData=({data:r,fullView:n})=>{const o=useBuilderProp("onError",lodashEs.noop);if(!r)return null;const a=typeof r;return n?typeof r=="object"?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-3"}),jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:o,children:jsxRuntime.jsxRuntimeExports.jsx(JsonView,{data:r,shouldExpandNode:allExpanded,style:{...defaultStyles,container:"max-h-[40vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),r]}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:lodashEs.truncate(a==="object"?JSON.stringify(r):r,{length:40})})},DataProvidersSuggester=({type:r,value:n="",setValue:o,data:a,onChange:i,dataType:l,appliedBindings:c})=>{const{paths:u,pathsType:d}=getPathAndTypes(a),p=r==="PROP"?runtime.getBlockComponent(a==null?void 0:a._type):{},f=r==="PROP",[m,h]=React.useState(!1),g=React.useMemo(()=>r==="PROP"?u.filter(y=>!lodashEs.includes(c,y)&&lodashEs.get(p,`props.${lodashEs.first(lodashEs.split(y,"."))}.binding`)):u.filter(y=>l===lodashEs.get(d,y,"")),[r,u,c,l,p]);return React.useEffect(()=>{n&&i(n)},[n,r]),jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:lodashEs.startCase(lodashEs.toLower(r))}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Popover,{open:m,onOpenChange:h,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"outline",size:"sm",className:` ${lodashEs.isEmpty(n)?"w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white":"min-w-[350px] items-center justify-between"}`,children:n?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[f&&jsxRuntime.jsxRuntimeExports.jsx("span",{className:"mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:lodashEs.startCase(l)}),n]}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700",children:"Change"})]}):jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:["+ Set ",lodashEs.startCase(lodashEs.toLower(r))]})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Command,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CommandInput,{placeholder:`Choose ${lodashEs.toLower(r)}...`}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.CommandList,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CommandEmpty,{children:"No results found."}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CommandGroup,{children:lodashEs.map(g,y=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.CommandItem,{value:y,className:`cursor-pointer ${f?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:b=>{o(lodashEs.find(g,v=>v===b)||null),h(!1)},children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Check,{className:`h-4 w-4 text-green-500 ${n===y?"":"opacity-0"}`}),y]}),f?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:lodashEs.startCase(lodashEs.get(d,y,""))})}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pl-6",children:jsxRuntime.jsxRuntimeExports.jsx(ViewData,{data:lodashEs.get(a,y)})})]},y))})]})]})})]})]}),!f&&!lodashEs.isEmpty(n)&&jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pt-2",children:jsxRuntime.jsxRuntimeExports.jsx(ViewData,{data:lodashEs.get(a,n,""),fullView:!0})})]})},AddBindingModalContent=({appliedBindings:r=[],onAddBinding:n,editMode:o,item:a})=>{const[i,l]=React.useState(o?a.key:""),[c,u]=React.useState(o?a.value:""),d=useSelectedBlock(),[p]=useChaiExternalData(),f=React.useCallback((g,y)=>{if(lodashEs.isEmpty(g))return"";{const b=lodashEs.get(y==="PROP"?d:p,g,"");if(lodashEs.isArray(b))return"list";const v=typeof b;return v==="string"?"text":v==="object"?"model":v}},[d,p]),[m,h]=React.useState(o?f(a.key,"PROP"):"");return jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DialogHeader,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTitle,{children:"Add Data Binding"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col gap-1",children:[jsxRuntime.jsxRuntimeExports.jsx(DataProvidersSuggester,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:i,setValue:l,onChange:g=>{const y=f(g,"PROP");l(g),m!==y&&u(""),h(y)},data:d,dataType:m,appliedBindings:r}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-2"}),jsxRuntime.jsxRuntimeExports.jsx(DataProvidersSuggester,{type:"PATH",isDisabled:lodashEs.isEmpty(i),placeholder:"Enter data path",value:c,setValue:u,onChange:g=>{const y=f(g,"PATH");u(m===y?g:"")},data:p,dataType:m,appliedBindings:r})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogFooter,{children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{type:"submit",className:"mt-4",disabled:lodashEs.isEmpty(i)&&lodashEs.isEmpty(c),onClick:()=>n({key:i,value:c}),children:"Save"})})]})},AddBindingModal=({disabled:r,children:n,onAddBinding:o,appliedBindings:a,editMode:i=!0,item:l={}})=>{const[c,u]=React.useState(!1);return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Dialog,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTrigger,{disabled:r,asChild:!0,onClick:()=>u(!0),children:n}),c&&jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogContent,{children:jsxRuntime.jsxRuntimeExports.jsx(AddBindingModalContent,{item:l,editMode:i,appliedBindings:a,onAddBinding:d=>{o(d),u(!1)}})})]})},NewDataBindingPair=({item:r,onAddBinding:n,onRemove:o,selectedBlock:a,dataProvider:i,appliedBindings:l})=>{const[c,u]=React.useState("string"),d=(p,f)=>{if(lodashEs.isEmpty(p))return"";{const m=lodashEs.get(f==="PROP"?a:i,p,"");if(lodashEs.isArray(m))return"list";const h=typeof m;return h==="string"?"text":h==="object"?"model":h}};return React.useEffect(()=>u(()=>d(r.key,"PROP")),[r.key]),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col rounded-md border border-border p-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-sm font-normal text-gray-500",children:r.key}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:r.value}),jsxRuntime.jsxRuntimeExports.jsx(ViewData,{data:lodashEs.get(i,r.value,"")}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx(AddBindingModal,{editMode:!0,onAddBinding:n,appliedBindings:l,item:r,children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.EditIcon,{className:"mt-1 h-6 w-6 cursor-pointer rounded border border-blue-400 p-1 text-blue-400 duration-200 hover:scale-105 hover:bg-blue-400 hover:text-white"})}),jsxRuntime.jsxRuntimeExports.jsx(lucideReact.TrashIcon,{onClick:()=>o(),className:"mt-1 h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 duration-200 hover:scale-105 hover:bg-red-400 hover:text-white"})]}),!lodashEs.isEmpty(c)&&!lodashEs.isEmpty(r.key)&&jsxRuntime.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-1 mt-px flex h-4 items-center rounded-full px-2 text-[10px] font-medium text-purple-600",children:lodashEs.startCase(c)})]})},DataBindingSetting=({bindingData:r,onChange:n})=>{const o=useSelectedBlock(),[a]=useChaiExternalData(),i=runtime.getChaiDataProviders(),[l,c]=React.useState(lodashEs.map(r,(m,h)=>({key:h,value:m})));React.useEffect(()=>{c(lodashEs.map(r,(m,h)=>({key:h,value:m})))},[o==null?void 0:o._id,r]);const u=React.useMemo(()=>{if(lodashEs.isEmpty(a))return!0;if(lodashEs.isEmpty(l))return!1;const m=lodashEs.last(l);return lodashEs.isEmpty(m==null?void 0:m.key)||lodashEs.isEmpty(m==null?void 0:m.value)},[a,l]),d=m=>{const h=lodashEs.filter(l,g=>g.key!==m.key);c([...h,m]),f([...h,m])},p=m=>{const h=lodashEs.filter(l,(g,y)=>m!==y);f([...h])},f=React.useCallback((m=[])=>{if(c(m),lodashEs.isEmpty(m)){n({});return}const h={};lodashEs.forEach(m,g=>{!lodashEs.isEmpty(g==null?void 0:g.key)&&!lodashEs.isEmpty(g==null?void 0:g.value)&&lodashEs.set(h,g.key,g.value)}),n(h)},[n]);return lodashEs.isEmpty(i)?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-center",children:jsxRuntime.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-xs text-gray-500",children:["You have no data providers registered. Please add a data provider to your project. ",jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[lodashEs.map(l,(m,h)=>jsxRuntime.jsxRuntimeExports.jsx(NewDataBindingPair,{item:m,onAddBinding:d,onRemove:()=>p(h),selectedBlock:o,dataProvider:a,appliedBindings:lodashEs.map(l,"key")},m.key)),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{delayDuration:200,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{disabled:lodashEs.isEmpty(a),className:"w-full",children:jsxRuntime.jsxRuntimeExports.jsx(AddBindingModal,{disabled:u,appliedBindings:lodashEs.map(l,"key"),onAddBinding:d,children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${u?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:lodashEs.isEmpty(a)?jsxRuntime.jsxRuntimeExports.jsx("small",{className:"text-[9.5px] text-gray-500",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),u&&jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:lodashEs.isEmpty(a)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},DataBindingSetting$1=DataBindingSetting,BindingWidget=()=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),getSvgMarkup=r=>{try{const n=document.getElementById("icon-picker-field"),o=document.createElement("div");ReactDOM.render(jsxRuntime.jsxRuntimeExports.jsx(IconPicker.IconPickerItem,{value:r}),o),n.appendChild(o),o.hidden=!0;let a=o.innerHTML;setTimeout(()=>n.removeChild(o),100);const l=new DOMParser().parseFromString(a,"image/svg+xml"),c=l.querySelector("svg");return c&&(c.removeAttribute("width"),c.removeAttribute("height")),new XMLSerializer().serializeToString(l)}catch(n){return console.error(n),""}},IconPickerField=({value:r,onChange:n})=>{const{t:o}=reactI18next.useTranslation(),a=i=>{n("<svg />");const l=getSvgMarkup(i);n(l)};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:r?r.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"}),jsxRuntime.jsxRuntimeExports.jsx(IconPicker,{value:r?"BiSolidGrid":null,onChange:a,pickButtonStyle:{position:"relative",height:"48px",width:"48px",border:"1px solid #999",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"}})]}),jsxRuntime.jsxRuntimeExports.jsx("textarea",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",value:r,onChange:i=>n(i.target.value),placeholder:o("choose_icon_or_enter_svg"),className:"no-scrollbar disabled:opacity-50; mt-1 flex 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"})]})},UnsplashImages=React.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-y5dtRWZL.cjs"))),UploadImages=React.lazy(()=>Promise.resolve().then(()=>require("./UploadImages--AV-U7uF.cjs"))),ImagesPanel=({isModalView:r=!1,onSelect:n=()=>{}})=>{const o=useBuilderProp("uploadMediaCallback"),a=useBuilderProp("unsplashAccessKey"),i=o===void 0,l=a===void 0,[c,u]=React.useState(l?"upload":i?"unsplash":"upload");return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:jsxRuntime.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:r&&i?"Unsplash images":r?"Select or upload images":"Images"})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tabs,{value:c,onValueChange:d=>u(d),className:"flex h-full w-full flex-col py-2",children:[!(i||l)&&jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.TabsList,{className:"w-full",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"upload",className:"w-full",children:"Upload"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),c==="unsplash"?jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsContent,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:jsxRuntime.jsxRuntimeExports.jsx(UnsplashImages,{isModalView:r,onSelect:n})})}):jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsContent,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:jsxRuntime.jsxRuntimeExports.jsx(UploadImages,{isModalView:r,onSelect:n})})})]})]})},ImagesPanel$1=ImagesPanel,ImagePickerModal=({children:r,onSelect:n})=>{const[o,a]=React.useState(!1),i=(...l)=>{n.call(void 0,...l),a(!1)};return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Dialog,{open:o,onOpenChange:l=>a(l),children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTrigger,{asChild:!0,children:r}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogContent,{className:"flex h-3/4 max-w-5xl border-border",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:jsxRuntime.jsxRuntimeExports.jsx(ImagesPanel$1,{isModalView:!0,onSelect:i})})})]})},ImagePickerModal$1=ImagePickerModal,ImagePickerField=({value:r,onChange:n,id:o,onBlur:a})=>{const i=useBuilderProp("uploadMediaCallback"),l=useBuilderProp("unsplashAccessKey"),{t:c}=reactI18next.useTranslation(),u=i===void 0,d=l===void 0;return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[r?jsxRuntime.jsxRuntimeExports.jsx("img",{src:r,className:"h-20 w-20 overflow-hidden rounded-md border border-border object-cover",alt:""}):jsxRuntime.jsxRuntimeExports.jsx(ImagePickerModal$1,{onSelect:n,children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]"})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[!(u&&d)&&jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(ImagePickerModal$1,{onSelect:n,children:jsxRuntime.jsxRuntimeExports.jsx("small",{className:"h-6 cursor-pointer rounded-md bg-primary px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:r||!lodashEs.isEmpty(r)?c("Replace image"):c("Choose image")})}),jsxRuntime.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"})]}),jsxRuntime.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",type:"url",className:"text-xs",placeholder:c("enter_image_url"),value:r,onBlur:({target:{value:p}})=>a(o,p),onChange:p=>n(p.target.value)})]})]})},RichTextEditorField=({id:r,placeholder:n,value:o,onChange:a,onBlur:i})=>{const l={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},c=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:jsxRuntime.jsxRuntimeExports.jsx(ReactQuill,{id:r,value:o,onBlur:u=>i(r,u),onChange:u=>a(u),modules:l,formats:c,placeholder:n,className:"mt-1 rounded-md"})},LinkField=({schema:r,formData:n,onChange:o})=>{const[a,i]=React.useState([]),l=useBuilderProp("getPages",()=>[]),{type:c="page",href:u="",target:d="self"}=n;return React.useEffect(()=>{(async()=>{const p=await l();i(p||[])})()},[]),jsxRuntime.jsxRuntimeExports.jsxs("div",{children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(r==null?void 0:r.title)??"Link"}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxRuntimeExports.jsx("select",{name:"type",value:c,onChange:p=>o({...n,type:p.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(p=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:p.const,children:p.title},p.const))}),c==="page"?jsxRuntime.jsxRuntimeExports.jsxs("select",{name:"href",value:u,onChange:p=>o({...n,href:p.target.value||"#"}),children:[jsxRuntime.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),lodashEs.map(a,p=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:p.slug,children:p.name},p.uuid))]}):jsxRuntime.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",name:"href",type:"text",value:u,onChange:p=>o({...n,href:p.target.value||"#"}),placeholder:c==="page"||c==="url"?"Enter URL":c==="scroll"?"#ElementID":"Enter detail"}),(c==="page"||c==="url")&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",type:"checkbox",defaultChecked:d==="_blank",className:"!w-fit cursor-pointer rounded-md border border-border",onChange:()=>o({...n,target:d==="_blank"?"_self":"_blank"})}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})},CodeEditor=({id:r,placeholder:n})=>{const{t:o}=reactI18next.useTranslation(),[,a]=useCodeEditor(),i=useSelectedBlock();if(typeof window>"u")return null;const l=r.replace("root.",""),c=lodashEs.get(i,l,""),u=()=>{const d=i==null?void 0:i._id;a({blockId:d,blockProp:l,placeholder:n,initialCode:lodashEs.get(i,l,c)})};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex flex-col gap-y-1",children:[jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:u,className:"text-pretty w-[90%] max-w-full cursor-default truncate rounded border border-border bg-background p-2 text-left text-[10px]",children:c.trim().length>0?c.substring(0,46):n||"Eg: <script>console.log('Hello, world!');<\/script>"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:u,size:"sm",variant:"outline",className:"w-fit",children:o("Open code editor")})]})},JSONForm=React.memo(({id:r,properties:n,formData:o,onChange:a})=>{const[i,l]=React.useState(o),c={type:"object",properties:{}},u={},{t:d}=reactI18next.useTranslation();Object.keys(n).forEach(f=>{const m=n[f];if(lodashEs.includes(["slot","styles"],m.type))return;const h=f;c.properties[h]=getBlockJSONFromSchemas(m,d),u[h]=getBlockJSONFromUISchemas(m)}),React.useEffect(()=>{l(o)},[r]);const p=web.useThrottledCallback(async({formData:f},m)=>{a({formData:f},m)},[a],1e3);return jsxRuntime.jsxRuntimeExports.jsx(Form,{widgets:{binding:BindingWidget,richtext:RichTextEditorField,icon:IconPickerField,image:ImagePickerField,code:CodeEditor},fields:{link:LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator,uiSchema:u,schema:c,formData:i,onChange:({formData:f},m)=>{m&&(l(f),p({formData:f},m))}})}),CanvasSettings=()=>{const[r,n]=jotai.useAtom(xShowBlocksAtom),o=useSelectedBlock(),[,a]=useSelectedBlockIds(),{t:i}=reactI18next.useTranslation(),l=React.useMemo(()=>(o?JSON.stringify(o):"").includes('"x-show"'),[o]);if(!o||!l)return null;const c=r.includes(o._id);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"py-2 text-xs hover:no-underline",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 border-b border-border bg-background py-2 font-normal text-muted-foreground",children:[o._name||o._type," ",i("visibility settings")]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Switch,{id:"show-on-canvas",checked:c,onCheckedChange:u=>{u?(n(d=>[...d,o._id]),a([o._id])):n(d=>d.filter(p=>p!==o._id))}}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{htmlFor:"show-on-canvas",children:i("Show on canvas")})]})]})};function BlockSettings(){const r=useSelectedBlock(),n=useUpdateBlocksPropsRealtime(),o=useUpdateBlocksProps(),a=runtime.getBlockComponent(r==null?void 0:r._type),i={...r},[l,c]=React.useState(i),u=useBuilderProp("dataBindingSupport",!1),d=({formData:g},y,b)=>{if(y&&(l==null?void 0:l._id)===r._id){const v=y.replace("root.","");o([r._id],{[v]:lodashEs.get(g,v)},b)}},p=React.useCallback(lodashEs.debounce(({formData:g},y,b)=>{d({formData:g},y,b),c(g)},1500),[r==null?void 0:r._id]),f=({formData:g},y)=>{if(y){const b=y.replace("root.","");n([r._id],convertDotNotationToObject(b,lodashEs.get(g,b.split(".")))),p({formData:g},y,{[b]:lodashEs.get(l,b)})}},m=lodashEs.keys(lodashEs.get(i,"_bindings",{})),h=React.useMemo(()=>{const g=lodashEs.cloneDeep(lodashEs.get(a,"props",{}));return u&&lodashEs.each(m,y=>delete g[y]),g},[a,m,u]);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden px-px",children:[u?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:"BINDING",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${lodashEs.isEmpty(lodashEs.get(r,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionContent,{className:"px-4 pt-4",children:jsxRuntime.jsxRuntimeExports.jsx(DataBindingSetting$1,{bindingData:lodashEs.get(r,"_bindings",{}),onChange:g=>{d({formData:{_bindings:g}},"root._bindings")}})})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:"STATIC",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionContent,{className:"pt-4",children:[lodashEs.isEmpty(m)?null:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mx-4 mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500",children:["Data binding is set for ",jsxRuntime.jsxRuntimeExports.jsx("b",{children:lodashEs.map(m,lodashEs.capitalize).join(", ")})," ",m.length===1?"property":"properties",". Remove data binding to edit static content."]}),jsxRuntime.jsxRuntimeExports.jsx(JSONForm,{id:r==null?void 0:r._id,onChange:f,formData:i,properties:h})]})]})]}):jsxRuntime.jsxRuntimeExports.jsx(JSONForm,{id:r==null?void 0:r._id,onChange:f,formData:i,properties:h}),jsxRuntime.jsxRuntimeExports.jsx(CanvasSettings,{})]})}function getChildBlocks(r,n,o){o.push(lodashEs.find(r,{_id:n}));const a=lodashEs.filter(r,{_parent:n});for(const i of a)o.push(...getBlockWithChildren(i._id,r));return o}const getBlockWithChildren=(r,n)=>{let o=[];return o=lodashEs.flattenDeep([...o,...getChildBlocks(n,r,o)]),o},askAiProcessingAtom=jotai.atom(!1),useAskAi=()=>{const[r,n]=jotai.useAtom(askAiProcessingAtom),[o,a]=React.useState(null),i=useBuilderProp("askAiCallBack",null),l=useStreamMultipleBlocksProps(),c=useUpdateMultipleBlocksProps(),[u]=useBlocksStore();return{askAi:React.useCallback(async(d,p,f,m)=>{if(i){n(!0),a(null);try{const h=d==="content"?lodashEs.cloneDeep(getBlockWithChildren(p,u)):[lodashEs.cloneDeep(u.find(v=>v._id===p))];lodashEs.set(h,"0._parent",null);const g=await i(d,f,h),{blocks:y,error:b}=g;if(b){a(b);return}d==="styles"?c(y):l(y),m&&m(g)}catch(h){a(h)}finally{n(!1),m&&m()}}},[i,n,u,c,l]),loading:r,error:o}};function FaMoon(r){return iconBase.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"},child:[]}]})(r)}function FaRecycle(r){return iconBase.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"},child:[]}]})(r)}function FaSpinner(r){return iconBase.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"},child:[]}]})(r)}const SECONDS=10;function Countdown(){const[r,n]=React.useState(SECONDS),[o,a]=React.useState(!1);React.useEffect(()=>{if(o&&r>0){const d=setTimeout(()=>{n(r-.1)},100);return()=>clearTimeout(d)}else r<=0&&(a(!1),n(SECONDS))},[o,r]);const i=()=>{a(!0),n(SECONDS)};React.useEffect(()=>{r===SECONDS&&i()},[r]);const l=18,c=2*Math.PI*l,u=c*(1-(SECONDS-r)/SECONDS);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative h-4 w-4",children:[jsxRuntime.jsxRuntimeExports.jsxs("svg",{className:"h-full w-full",viewBox:"0 0 40 40",children:[jsxRuntime.jsxRuntimeExports.jsx("circle",{className:"text-gray-300",strokeWidth:"4",stroke:"currentColor",fill:"transparent",r:l,cx:"20",cy:"20"}),jsxRuntime.jsxRuntimeExports.jsx("circle",{className:"text-blue-600",strokeWidth:"4",strokeDasharray:c,strokeDashoffset:u,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:l,cx:"20",cy:"20"})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"text-xs font-semibold",children:" "})})]})}const AskAIStyles=({blockId:r})=>{const{t:n}=reactI18next.useTranslation(),{askAi:o,loading:a,error:i}=useAskAi(),[l,c]=React.useState(""),u=React.useRef(null),d=React.useRef(null),[p,f]=React.useState();React.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const m=h=>{const{usage:g}=h||{};!i&&g&&f(g),d.current=setTimeout(()=>f(void 0),1e4),i||c("")};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"",children:[jsxRuntime.jsxRuntimeExports.jsx("h2",{className:"mb-1 text-sm font-semibold leading-none tracking-tight",children:n("ask_ai")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{ref:u,value:l,onChange:h=>c(h.target.value),placeholder:n("ask_ai_to_edit_styles"),className:"w-full border border-border focus:border-0",rows:3,onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),d.current&&clearTimeout(d.current),f(void 0),o("styles",r,l,m))}}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:l.trim().length<5||a,onClick:()=>{d.current&&clearTimeout(d.current),f(void 0),o("styles",r,l,m)},variant:"default",className:"w-fit",size:"sm",children:a?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"h-5 w-5 animate-spin"}),n("generating_please_wait")]}):n("edit_with_ai")}),a?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Skeleton,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[jsxRuntime.jsxRuntimeExports.jsx(FaSpinner,{className:"h-4 w-4 animate-spin text-gray-500"}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs",children:n("generating_please_wait")})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:n("stop")})]}):null]}),p?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:jsxRuntime.jsxRuntimeExports.jsxs("p",{className:"mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500",children:[jsxRuntime.jsxRuntimeExports.jsxs("span",{children:[n("Total tokens used"),": ",p.totalTokens]}),jsxRuntime.jsxRuntimeExports.jsx(Countdown,{})]})}):null,jsxRuntime.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:i&&jsxRuntime.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:i.message})})]})},fuse=new Fuse(ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function ManualClasses(){var R;const{t:r}=reactI18next.useTranslation(),[n]=useSelectedStylingBlocks(),o=useSelectedBlock(),a=useAddClassesToBlocks(),i=useRemoveClassesFromBlocks(),[l]=useSelectedBlockIds(),c=useBuilderProp("askAiCallBack",null),[u,d]=React.useState(""),{toast:p}=contextMenu.useToast(),f=(R=lodashEs.first(n))==null?void 0:R.prop,m=lodashEs.reject((lodashEs.get(o,f,"").replace(STRINGS.STYLES_KEY,"").split(",").pop()||"").split(" "),lodashEs.isEmpty),h=()=>{const A=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");a(l,A,!0),d("")},[g,y]=React.useState([]),b=({value:A})=>{const C=A.trim().toLowerCase(),k=C.match(/.+:/g);let j=[];if(k&&k.length>0){const[I]=k,P=C.replace(I,"");j=fuse.search(P).map(B=>({...B,item:{...B.item,name:I+B.item.name}}))}else j=fuse.search(C);return y(lodashEs.map(j,"item"))},v=()=>{y([])},x=A=>A.name,E=A=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:A.name}),S={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:r("enter_classes_separated_by_space"),value:u,onKeyDown:A=>{A.key==="Enter"&&u.trim()!==""&&h()},onChange:(A,{newValue:C})=>d(C),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"},w=()=>{if(navigator.clipboard===void 0){p({title:r("clipboard_not_supported"),description:r("please_use_chrome_firefox_or_safari"),variant:"destructive"});return}navigator.clipboard.writeText(m.join(" ")),p({title:r("copied"),description:r("classes_copied_to_clipboard")})};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:`flex ${g.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:r("classes")}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CopyIcon,{onClick:w,className:"cursor-pointer"})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:r("copy_classes_to_clipboard")})})]})]}),c?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Popover,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{variant:"default",className:"h-6 w-fit",size:"sm",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.SparklesIcon,{className:"h-4 w-4"}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"ml-2",children:r("Ask AI")})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverContent,{side:"left",className:"p-2",children:jsxRuntime.jsxRuntimeExports.jsx(AskAIStyles,{blockId:o==null?void 0:o._id})})]}):null]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex items-center gap-x-3",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:jsxRuntime.jsxRuntimeExports.jsx(Autosuggest,{suggestions:g,onSuggestionsFetchRequested:b,onSuggestionsClearRequested:v,getSuggestionValue:x,renderSuggestion:E,inputProps:S,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-border"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"!bg-gray-300 dark:!bg-gray-800 cursor-pointer",suggestionsContainerOpen:"absolute bg-background no-scrollbar z-50 max-h-[230px] overflow-y-auto w-full border border-border rounded-md"}})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"outline",className:"h-6 border-border",onClick:h,disabled:u.trim()==="",size:"sm",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.PlusIcon,{})})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-wrap gap-2 overflow-x-hidden",children:React__namespace.Children.toArray(m.map(A=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",children:[A,jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Cross2Icon,{onClick:()=>i(l,[A]),className:"invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},A)))})]})}const BASIC_UNITS=["px","%","em","rem","ch","vh","vw"],FLEX_CHILD_SECTION={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:BASIC_UNITS,property:"flexBasis"},{type:"range",label:"flex.order",property:"order"},{type:"dropdown",label:"flex.flex",property:"flexGrowShrink"},{type:"dropdown",label:"flex.grow",property:"flexGrow"},{type:"dropdown",label:"flex.shrink",property:"flexShrink"}]},GRID_CHILD_SECTION={heading:"grid.heading",items:[{type:"range",label:"grid.col_span",property:"gridColSpan"},{type:"range",label:"grid.col_start",property:"gridColStart"},{type:"range",label:"grid.col_end",property:"gridColEnd"},{type:"range",label:"grid.row_span",property:"gridRowSpan"},{type:"range",label:"grid.row_start",property:"gridRowStart"},{type:"range",label:"grid.row_end",property:"gridRowEnd"},{type:"range",label:"grid.order",property:"order"}]},SETTINGS_SECTIONS=[{heading:"Styles",items:[{component:ManualClasses},{type:"arbitrary",label:"layout.width",units:BASIC_UNITS.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:BASIC_UNITS.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...BASIC_UNITS,"auto"],options:[{key:"margin",label:"layout.margin_all"},{key:"marginX",label:"layout.margin_lr"},{key:"marginY",label:"layout.margin_tb"},{key:"marginTop",label:"layout.margin_top"},{key:"marginRight",label:"layout.margin_right"},{key:"marginBottom",label:"layout.margin_bottom"},{key:"marginLeft",label:"layout.margin_left"}]},{styleType:"multiple",label:"layout.padding",options:[{key:"padding",label:"layout.padding_all"},{key:"paddingX",label:"layout.padding_lr"},{key:"paddingY",label:"layout.padding_tb"},{key:"paddingTop",label:"layout.padding_top"},{key:"paddingRight",label:"layout.padding_right"},{key:"paddingBottom",label:"layout.padding_bottom"},{key:"paddingLeft",label:"layout.padding_left"}]},{styleType:"accordion",heading:"Typography",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:BASIC_UNITS},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:BASIC_UNITS.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"}]},{styleType:"accordion",heading:"Background",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{type:"dropdown",label:"background.attachment",property:"backgroundAttachment"},{type:"dropdown",label:"background.clipping",property:"backgroundClip"},{type:"dropdown",label:"background.origin",property:"backgroundOrigin"},{type:"dropdown",label:"background.position",property:"backgroundPosition"},{type:"dropdown",label:"background.repeat",property:"backgroundRepeat"},{type:"dropdown",label:"background.size",property:"backgroundSize"}]}]}];BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("auto"),[...BASIC_UNITS],BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("-");const EDITOR_ICONS={"not-italic":()=>jsxRuntime.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:reactIcons.EyeOpenIcon,invisible:reactIcons.EyeClosedIcon,hidden:reactIcons.EyeClosedIcon,gap:reactIcons.BorderAllIcon,gapX:reactIcons.WidthIcon,gapY:reactIcons.HeightIcon,spaceX:reactIcons.WidthIcon,spaceY:reactIcons.HeightIcon,overscroll:reactIcons.BorderAllIcon,overscrollX:reactIcons.WidthIcon,overscrollY:reactIcons.HeightIcon,overflow:reactIcons.BorderAllIcon,overflowX:reactIcons.WidthIcon,overflowY:reactIcons.HeightIcon,top:reactIcons.ArrowUpIcon,right:reactIcons.ArrowRightIcon,bottom:reactIcons.ArrowDownIcon,left:reactIcons.ArrowLeftIcon,inset:reactIcons.BorderAllIcon,insetX:reactIcons.WidthIcon,insetY:reactIcons.HeightIcon,border:reactIcons.BorderAllIcon,borderX:reactIcons.WidthIcon,borderY:reactIcons.HeightIcon,borderTop:reactIcons.ArrowUpIcon,borderRight:reactIcons.ArrowRightIcon,borderBottom:reactIcons.ArrowDownIcon,borderLeft:reactIcons.ArrowLeftIcon,borderRadius:reactIcons.BorderAllIcon,borderRadiusX:reactIcons.WidthIcon,borderRadiusY:reactIcons.HeightIcon,borderRadiusTop:reactIcons.ArrowUpIcon,borderRadiusRight:reactIcons.ArrowRightIcon,borderRadiusBottom:reactIcons.ArrowDownIcon,borderRadiusLeft:reactIcons.ArrowLeftIcon,borderRadiusTopLeft:reactIcons.ArrowTopLeftIcon,borderRadiusTopRight:reactIcons.ArrowTopRightIcon,borderRadiusBottomRight:reactIcons.ArrowBottomRightIcon,borderRadiusBottomLeft:reactIcons.ArrowBottomLeftIcon,divideXWidth:reactIcons.WidthIcon,divideYWidth:reactIcons.HeightIcon,scale:reactIcons.BorderAllIcon,scaleX:reactIcons.WidthIcon,scaleY:reactIcons.HeightIcon,skewX:reactIcons.WidthIcon,skewY:reactIcons.HeightIcon,translateX:reactIcons.WidthIcon,translateY:reactIcons.HeightIcon,padding:reactIcons.BorderAllIcon,paddingX:reactIcons.WidthIcon,paddingY:reactIcons.HeightIcon,paddingTop:reactIcons.ArrowUpIcon,paddingRight:reactIcons.ArrowRightIcon,paddingBottom:reactIcons.ArrowDownIcon,paddingLeft:reactIcons.ArrowLeftIcon,margin:reactIcons.BorderAllIcon,marginX:reactIcons.WidthIcon,marginY:reactIcons.HeightIcon,marginTop:reactIcons.ArrowUpIcon,marginRight:reactIcons.ArrowRightIcon,marginBottom:reactIcons.ArrowDownIcon,marginLeft:reactIcons.ArrowLeftIcon,textLeft:reactIcons.AlignLeftIcon,textCenter:reactIcons.AlignCenterHorizontallyIcon,textRight:reactIcons.AlignRightIcon,textJustify:reactIcons.StretchHorizontallyIcon,italic:reactIcons.FontItalicIcon,underline:reactIcons.UnderlineIcon,overline:reactIcons.OverlineIcon,uppercase:reactIcons.LetterCaseUppercaseIcon,block:()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":reactIcons.Cross2Icon,fixed:()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>jsxRuntime.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:reactIcons.Cross1Icon},StyleContext=React.createContext({canReset:!1,canChange:!0}),BlockStyleProvider=({children:r,canReset:n=!1,canChange:o=!0})=>jsxRuntime.jsxRuntimeExports.jsx(StyleContext.Provider,{value:{canReset:n,canChange:o},children:r}),DropDownChoices=({label:r,property:n,onChange:o})=>{const a=React.useMemo(()=>lodashEs.get(CLASSES_LIST,`${n}.classes`,[""]),[n]),i=useCurrentClassByProperty(n),l=React.useMemo(()=>lodashEs.get(i,"cls",""),[i]),{canChange:c}=React.useContext(StyleContext),u=/\[.*\]/g.test(l);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:r?"w-full rounded":"grow",children:u?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:l}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{delayDuration:100,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InfoCircledIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):jsxRuntime.jsxRuntimeExports.jsx(DropDown,{rounded:r,onChange:d=>o(d,n),selected:l,options:a,disabled:!c})})};function DropDown({selected:r,onChange:n,rounded:o=!1,options:a,disabled:i=!1}){const l=r.replace(/.*:/g,"").trim(),{undo:c,redo:u}=useUndoManager();return jsxRuntime.jsxRuntimeExports.jsxs("select",{disabled:!a.length||i,className:`${o?"rounded-md border border-border":"border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:d=>n(d.target.value),onKeyDown:d=>{d.ctrlKey&&(d.key==="z"&&c(),d.key==="y"&&u())},value:l,children:[jsxRuntime.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),React.Children.toArray(a.map(d=>jsxRuntime.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:d,children:d})))]})}const RangeChoices=({property:r,onChange:n})=>{const{canReset:o,canChange:a}=React.useContext(StyleContext),i=useCurrentClassByProperty(r),l=React.useMemo(()=>lodashEs.get(i,"cls",""),[i]),c=React.useMemo(()=>lodashEs.get(CLASSES_LIST,`${r}.classes`,[""]),[r]),u=c.indexOf(l)>-1?c.indexOf(l):0,d=/\[.*\]/g.test(l);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:d?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:l}):jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!a&&(!o||u-1<0),onClick:()=>n(lodashEs.nth(c,u-1),r),children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.MinusIcon,{className:!a&&(!o||u-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:jsxRuntime.jsxRuntimeExports.jsx(DropDownChoices,{label:!1,property:r,onChange:n})}),jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!a&&(!o||u+1>=c.length),onClick:()=>n(lodashEs.nth(c,u+1),r),children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.PlusIcon,{className:!a&&(!o||u+1>=c.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},IconChoices=({property:r,onChange:n})=>{const o=React.useMemo(()=>lodashEs.get(CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:a}=React.useContext(StyleContext),i=useCurrentClassByProperty(r),l=React.useMemo(()=>lodashEs.get(i,"cls",""),[i]);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:lodashEs.map(o,c=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",disabled:!a,onClick:()=>n(c,r),className:`cursor-pointer rounded border border-border p-1 disabled:cursor-not-allowed ${l===c?"bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:React.createElement(lodashEs.get(EDITOR_ICONS,c,reactIcons.BoxIcon))})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:lodashEs.startCase(lodashEs.toLower(c))})]}))})},COLOR_PROP={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},ColorChoice=({property:r,onChange:n})=>{const o=useCurrentClassByProperty(r),a=React.useMemo(()=>lodashEs.get(o,"cls",""),[o]),{canChange:i}=React.useContext(StyleContext),[l,c]=React.useState([]),[u,d]=React.useState({color:"",shade:""}),p=a.split("-"),f=lodashEs.get(p,"1",""),m=lodashEs.get(p,"2",""),h=React.useCallback(y=>{["current","inherit","transparent","black","white"].includes(y)?(c([]),d({color:y})):(c(["50","100","200","300","400","500","600","700","800","900"]),d(b=>({...b,color:y,shade:b.shade?b.shade:"500"})))},[c,d]);React.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(f))return c([]);c(["50","100","200","300","400","500","600","700","800","900"])},[f]);const g=React.useCallback(y=>{d({color:f,shade:y})},[f]);return React.useEffect(()=>{d({color:"",shade:""})},[o]),React.useEffect(()=>{const b=`${lodashEs.get(COLOR_PROP,r,"")}-${u.color}${u.shade?`-${u.shade}`:""}`;b.match(new RegExp(lodashEs.get(CLASSES_LIST,`${r}.regExp`,"")))&&n(b,r)},[u,n,r]),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:jsxRuntime.jsxRuntimeExports.jsx(DropDown,{disabled:!i,rounded:!0,selected:f,onChange:h,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:jsxRuntime.jsxRuntimeExports.jsx(DropDown,{rounded:!0,selected:m,disabled:!f||!i,onChange:g,options:l})})]})},getUserInputValues=(r,n)=>{r=r.toLowerCase();let o=r.trim().replace(/ |\+/g,"");if((o==="auto"||o==="none")&&n.includes(o))return{value:"",unit:o};const a=n.length?new RegExp(n.join("|"),"g"):/XXXXXX/g;o=o.replace(a,"");const i=r.match(a),l=i&&i.length>1,c=!lodashEs.isEmpty(o)&&Number.isNaN(Number(o));return l||c?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:o,unit:i?i[0]:""}},getTwClassValue=r=>{const n=r.startsWith("-")?"-":"",o=r.split("-").pop();if(["auto","none"].includes(o))return{value:"",unit:o};if(o==="px")return{value:"1",unit:"px"};if(o==="screen")return{value:"100",unit:r.indexOf("w-")!==-1?"vw":"vh"};if(o==="full")return{value:"100",unit:"%"};if(lodashEs.includes(r,"skew-"))return{value:`${n}${o}`,unit:"deg"};if(lodashEs.includes(r,"rotate-"))return{value:`${n}${o}`,unit:"deg"};if(lodashEs.includes(r,"opacity-"))return{value:`${o/100}`,unit:"-"};if(lodashEs.includes(r,"duration-")||lodashEs.includes(r,"delay-"))return{value:`${o}`,unit:"ms"};if(lodashEs.includes(r,"translate-")&&!o.includes("/"))return{value:`${n}${`${o/4}`}`,unit:"rem"};if(lodashEs.includes(r,"scale-"))return{value:`${n}${`${o/100}`}`,unit:"-"};if(lodashEs.startsWith(r,"border")){const a=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(a)return{value:a[0].split("-").pop(),unit:"px"};if(r.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(lodashEs.startsWith(r,"max-w-")){if(r==="max-w-screen-sm")return{value:"640",unit:"px"};if(r==="max-w-screen-md")return{value:"768",unit:"px"};if(r==="max-w-screen-lg")return{value:"1024",unit:"px"};if(r==="max-w-screen-xl")return{value:"1280",unit:"px"};if(r==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(o==="xs")return{value:"320",unit:"px"};if(o==="sm")return{value:"384",unit:"px"};if(o==="md")return{value:"448",unit:"px"};if(o==="lg")return{value:"512",unit:"px"};if(o==="xl")return{value:"576",unit:"px"};if(o==="2xl")return{value:"672",unit:"px"};if(o==="3xl")return{value:"768",unit:"px"};if(o==="4xl")return{value:"896",unit:"px"};if(o==="5xl")return{value:"1024",unit:"px"};if(o==="6xl")return{value:"1152",unit:"px"};if(o==="7xl")return{value:"1280",unit:"px"};if(o==="prose")return{value:"65",unit:"ch"}}if(lodashEs.startsWith(r,"text-")){if(o==="xs")return{value:"12",unit:"px"};if(o==="sm")return{value:"14",unit:"px"};if(o==="base")return{value:"16",unit:"px"};if(o==="lg")return{value:"18",unit:"px"};if(o==="xl")return{value:"20",unit:"px"};if(o==="2xl")return{value:"24",unit:"px"};if(o==="3xl")return{value:"30",unit:"px"};if(o==="4xl")return{value:"36",unit:"px"};if(o==="5xl")return{value:"48",unit:"px"};if(o==="6xl")return{value:"60",unit:"px"};if(o==="7xl")return{value:"72",unit:"px"};if(o==="8xl")return{value:"96",unit:"px"};if(o==="9xl")return{value:"128",unit:"px"}}if(lodashEs.startsWith(r,"leading-")){if(o==="none")return{value:"1",unit:"-"};if(o==="tight")return{value:"1.25",unit:"-"};if(o==="snug")return{value:"1.375",unit:"-"};if(o==="normal")return{value:"1.5",unit:"-"};if(o==="relaxed")return{value:"1.625",unit:"-"};if(o==="loose")return{value:"2",unit:"-"}}if(lodashEs.startsWith(r,"tracking-")){if(o==="tighter")return{value:"-0.05",unit:"em"};if(o==="tight")return{value:"-0.025",unit:"em"};if(o==="normal")return{value:"0",unit:"em"};if(o==="wide")return{value:"0.025",unit:"em"};if(o==="wider")return{value:"0.05",unit:"em"};if(o==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(o))return{value:r,unit:"class"};if(o.includes("/")){const[a,i]=lodashEs.map(o.split("/"),l=>parseInt(l,10));return{value:n+(a/i*100).toFixed(2).replace(".00",""),unit:"%"}}return lodashEs.isNumber(parseFloat(o))?{value:`${n+parseFloat(o)*4}`,unit:"px"}:{value:o,unit:"class"}},getClassValueAndUnit=r=>{if(lodashEs.isEmpty(r))return{value:"",unit:""};const n=r.match(/\[.*\]/g);if(n===null)return getValueAndUnitForTWClass(r);const o=lodashEs.get(n,"0","").replace(/\[|\]/g,""),a=r.startsWith("-")?"-":"",i=lodashEs.first(o.match(/\d+.\d+|\d+/g));return{value:`${a}${i}`,unit:o.replace(i,"")}},getValueAndUnitForTWClass=r=>lodashEs.isEmpty(r)?{value:"",unit:""}:getTwClassValue(r),BlockSettingsContext=React.createContext({setDragData:()=>{}}),DragStyleButton=({unit:r,currentValue:n,onDrag:o,onDragEnd:a,onDragStart:i,negative:l,cssProperty:c})=>{const{setDragData:u}=React.useContext(BlockSettingsContext);return jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:d=>{const p={onDrag:o,onDragEnd:a,dragging:!0,dragStartY:d.pageY,dragStartValue:`${n}`,dragUnit:r,negative:l,cssProperty:c};i(p),u(p)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowSpacingIcon,{})})},UnitSelection=({onSelect:r,current:n,units:o})=>jsxRuntime.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:o.map(a=>jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:n===a?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),r(a)},children:a},a))}),THROTTLE_TIME=50,AdvanceChoices=r=>{const[n,o]=React.useState(!1),[a,i]=React.useState(""),{currentClass:l,onChange:c,classPrefix:u,cssProperty:d,units:p,negative:f}=r,[m,h]=React.useState(d!=null&&d.toLowerCase().includes("width")?"%":p[0]),[g,y]=React.useState(!1),[b,v]=React.useState(""),[x,E]=React.useState(!1),[S,w]=React.useState(!1);React.useEffect(()=>{const{value:j,unit:I}=getClassValueAndUnit(l);if(I===""){i(j),h(d!=null&&d.toLowerCase().includes("width")?"%":lodashEs.first(p));return}h(I),i(I==="class"||lodashEs.isEmpty(j)?"":j)},[l,d,p]);const R=web.useThrottledCallback(j=>c(j),[c],THROTTLE_TIME),A=web.useThrottledCallback(j=>c(j,!1),[c],THROTTLE_TIME),C=React.useCallback((j=!1)=>{const I=getUserInputValues(`${a}`,p);if(lodashEs.get(I,"error",!1)){y(!0);return}const P=lodashEs.get(I,"unit")!==""?lodashEs.get(I,"unit"):m;if(P==="auto"||P==="none"){R(`${u}${P}`);return}if(lodashEs.get(I,"value")==="")return;const B=`${lodashEs.get(I,"value","").startsWith("-")?"-":""}${u}[${lodashEs.get(I,"value","").replace("-","")}${P==="-"?"":P}]`;j?A(B):R(B)},[R,A,a,m,u,p]),k=React.useCallback(j=>{const I=getUserInputValues(`${a}`,p);if(lodashEs.get(I,"error",!1)){y(!0);return}if(j==="auto"||j==="none"){R(`${u}${j}`);return}if(lodashEs.get(I,"value")==="")return;const P=lodashEs.get(I,"unit")!==""?lodashEs.get(I,"unit"):j,B=`${lodashEs.get(I,"value","").startsWith("-")?"-":""}${u}[${lodashEs.get(I,"value","").replace("-","")}${P==="-"?"":P}]`;R(B)},[R,a,u,p]);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:m==="class"?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:l}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InfoCircledIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${x?"z-auto":""}`,children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(m)!==-1?null:jsxRuntime.jsxRuntimeExports.jsx("input",{readOnly:m==="class",onKeyPress:j=>{j.key==="Enter"&&C()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),w(!0);const I=lodashEs.parseInt(j.target.value);let P=lodashEs.isNaN(I)?0:I;j.keyCode===38&&(P+=1),j.keyCode===40&&(P-=1);const O=`${P}`,N=`${O.startsWith("-")?"-":""}${u}[${O.replace("-","")}${m==="-"?"":m}]`;A(N)},onKeyUp:j=>{S&&(j.preventDefault(),w(!1))},onBlur:()=>C(),onChange:j=>{y(!1),i(j.target.value)},onClick:j=>{var I;(I=j==null?void 0:j.target)==null||I.select(),o(!1)},value:x?b:a,className:"h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(" ",g?"border-red-500 text-red-500":"border-foreground/20")}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{open:n,delayDuration:100,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>o(!n),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:`inline-block ${p.length===1?"px-2 font-semibold":""}`,children:m}),p.length>1?jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TriangleDownIcon,{}):null]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipPortal,{children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"bg-background",children:jsxRuntime.jsxRuntimeExports.jsx(UnitSelection,{units:p,current:m,onSelect:j=>{o(!1),h(j),k(j)}})})})]})]}),["none","auto"].indexOf(m)!==-1||x?null:jsxRuntime.jsxRuntimeExports.jsx(DragStyleButton,{onDragStart:()=>E(!0),onDragEnd:j=>{if(v(()=>""),E(!1),lodashEs.isEmpty(j))return;const I=`${j}`,O=`${I.startsWith("-")?"-":""}${u}[${I.replace("-","")}${m==="-"?"":m}]`;R(O)},onDrag:j=>{if(lodashEs.isEmpty(j))return;v(j);const I=`${j}`,O=`${I.startsWith("-")?"-":""}${u}[${I.replace("-","")}${m==="-"?"":m}]`;A(O)},currentValue:a,unit:m,negative:f,cssProperty:d})]})})})},useCurrentClassByProperty=r=>{const n=useSelectedBlockCurrentClasses();return lodashEs.findLast(n,{property:r})},canChangeClass=(r,n)=>{const o={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return o[lodashEs.get(r,"mq","xs")]<=o[n]},CLASS_PREFIXES={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},BREAKPOINTS={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},getBreakpoint=r=>`${r.toUpperCase()} ${BREAKPOINTS[r]?`(${BREAKPOINTS[r]} & up)`:""}`,BlockStyle=r=>{const{t:n}=reactI18next.useTranslation(),{type:o="icons",label:a,property:i,onEmitChange:l=()=>{},units:c,negative:u=!1}=r,[d]=useDarkMode(),[p]=useStylingState(),[,f]=useCanvasWidth(),m=useCurrentClassByProperty(i),h=useAddClassesToBlocks(),g=useRemoveClassesFromBlocks(),[y]=useSelectedBlockIds(),b=React.useMemo(()=>lodashEs.get(m,"fullCls",""),[m]),v=React.useCallback((A,C=!0)=>{const k={dark:d,mq:f,mod:p,cls:A,property:i,fullCls:""};(d||p!=="")&&(k.mq="xs");const j=generateFullClsName(k);h(y,[j],C)},[y,d,f,p,i,h]),x=React.useCallback(()=>{g(y,[b])},[y,b,g]),E=React.useMemo(()=>canChangeClass(m,f),[m,f]);React.useEffect(()=>{l(E,m)},[E,l,m]);const[,,S]=useCanvasWidth(),w=React.useCallback(A=>{S({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[A])},[S]),R=lodashEs.get(m,"dark",null)===d&&lodashEs.get(m,"mod",null)===p&&lodashEs.get(m,"mq",null)===f;return jsxRuntime.jsxRuntimeExports.jsx(BlockStyleProvider,{canChange:E,canReset:m&&R,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${m&&!R?"text-foreground":""}`,children:n(a)})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[o==="arbitrary"?jsxRuntime.jsxRuntimeExports.jsx(AdvanceChoices,{currentClass:lodashEs.get(m,"cls",""),classPrefix:lodashEs.get(CLASS_PREFIXES,i,""),units:c||[],onChange:v,negative:u,cssProperty:i}):null,o==="icons"&&jsxRuntime.jsxRuntimeExports.jsx(IconChoices,{property:i,onChange:v}),o==="range"&&jsxRuntime.jsxRuntimeExports.jsx(RangeChoices,{property:i,onChange:v}),o==="color"&&jsxRuntime.jsxRuntimeExports.jsx(ColorChoice,{property:i,onChange:v}),o==="dropdown"&&jsxRuntime.jsxRuntimeExports.jsx(DropDownChoices,{label:a,property:i,onChange:v})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${b?"visible":"invisible"}`,children:R?jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>x(),title:"Reset",className:"flex px-1.5 text-xs",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):E&&m?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{delayDuration:100,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InfoCircledIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-right",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{children:["Current style is set at  ",jsxRuntime.jsxRuntimeExports.jsxs("span",{className:"font-bold",children:[getBreakpoint(lodashEs.get(m,"mq")),d&&!m.dark?"(Light mode)":""]}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>w(lodashEs.get(m,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",lodashEs.get(m,"mq").toUpperCase()]})]})})})]}):null})]})]})})},basicUnits=["px","%","em","rem","ch","vh","vw"],MultipleChoices=({label:r,options:n,borderB:o=!1,borderT:a=!1,type:i="arbitrary",units:l=basicUnits,negative:c=!1})=>{const{t:u}=reactI18next.useTranslation(),[d,p]=React.useState(n[0].key),f=useSelectedBlockCurrentClasses(),m=React.useCallback(h=>lodashEs.map(f,"property").includes(h),[f]);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-border py-2 first:pt-0 last:pb-0 ${o?"border-b":""} ${a?"border-t":""}`,children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[r&&jsxRuntime.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:u(r)}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:React.Children.toArray(n.map(({label:h,key:g})=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>p(g),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${g===d?"bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[React.createElement("div",{className:m(g)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),React.createElement(lodashEs.get(EDITOR_ICONS,g,reactIcons.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:lodashEs.startCase(lodashEs.toLower(h))})]})})))})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:jsxRuntime.jsxRuntimeExports.jsx(BlockStyle,{type:i,units:[...l],label:"",property:d,negative:c})})]})},NestedOptions=({heading:r,items:n})=>{const{t:o}=reactI18next.useTranslation(),a=useSelectedBlockCurrentClasses(),i=React.useMemo(()=>{const l=d=>lodashEs.flatten(d.map(p=>p.styleType==="multiple"?lodashEs.map(p.options,"key"):p.property)),c=lodashEs.flatten(n.map(d=>d.styleType==="accordion"?l(d.items):d.styleType==="multiple"?lodashEs.map(d.options,"key"):d.property)),u=lodashEs.map(a,"property");return lodashEs.intersection(c,u).length>0},[a,n]);return jsxRuntime.jsxRuntimeExports.jsxs("details",{children:[jsxRuntime.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-gray-50 p-px px-2 text-[11px] text-foreground dark:bg-gray-800",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"inline",children:[o(r.toLowerCase()),i?jsxRuntime.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}):null]})}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"p-2",children:n.map(l=>l.styleType==="multiple"?jsxRuntime.jsxRuntimeExports.jsx(MultipleChoices,{...l},l.label):jsxRuntime.jsxRuntimeExports.jsx(BlockStyle,{...l},l.label))})]})},SectionContext=React.createContext({}),StylingGroup=({section:r})=>{const{t:n}=reactI18next.useTranslation(),o=useSelectedBlockCurrentClasses(),a=React.useCallback((l=[])=>{const c={};for(let d=0;d<o.length;d++)c[o[d].property]=o[d].cls;let u=!0;for(const d in l)if(!lodashEs.has(c,d)||c[d]!==l[d]){u=!1;break}return u},[o]),i=React.useMemo(()=>({}),[]);return jsxRuntime.jsxRuntimeExports.jsx(SectionContext.Provider,{value:i,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:r.heading,className:"border-none",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{className:"border-b border-border py-2 text-xs",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-2 text-sm font-bold",children:n(r.heading)})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionContent,{className:"py-2",children:React.Children.toArray(r.items.map(l=>lodashEs.has(l,"component")?React.createElement(l.component,{key:l.label}):lodashEs.has(l,"styleType")?l.styleType==="multiple"?jsxRuntime.jsxRuntimeExports.jsx(MultipleChoices,{...l},l.label):l.styleType==="accordion"&&a(l==null?void 0:l.conditions)?jsxRuntime.jsxRuntimeExports.jsx(NestedOptions,{...l},l.label):null:jsxRuntime.jsxRuntimeExports.jsx(BlockStyle,{...l},l.label)))})]})})},StylingHelpers=()=>{const r=useSelectedBlock(),[n]=useSelectedStylingBlocks(),{t:o}=reactI18next.useTranslation(),a=runtime.useGlobalStylingPresets(),i=useAddClassesToBlocks(),l=runtime.getBlockComponent(r._type),c=lodashEs.get(lodashEs.first(n),"prop"),u=lodashEs.get(l.props,`${c}.presets`,{});if(lodashEs.isEmpty(a)&&(!lodashEs.has(l,"props")||lodashEs.isEmpty(u)))return null;const d=p=>{const f=p.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");i([r._id],f,!0)};return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-10",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenu,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"px-4",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{variant:"default",className:"w-full",size:"sm",children:[o("Apply Presets"),jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CaretDownIcon,{})]})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuContent,{className:"max-h-80 w-56",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ScrollArea,{className:"no-scrollbar h-full",children:[lodashEs.isEmpty(u)?null:jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenuLabel,{children:[l.type," ",o("presets")]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuSeparator,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuGroup,{children:lodashEs.keys(u).map(p=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(u[p]),children:[lodashEs.capitalize(lodashEs.startCase(o(p))),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:o("apply")})]}))})]}),lodashEs.isEmpty(a)?null:jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuLabel,{children:o("Global presets")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuSeparator,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuGroup,{children:lodashEs.keys(a).map(p=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(a[p]),children:[lodashEs.capitalize(lodashEs.startCase(o(p))),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:o("apply")})]}))})]})]})})]})})},MAPPER={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1};function BlockStyling(){const{flexChild:r,gridChild:n}=useSelectedBlocksDisplayChild(),[o]=useSelectedStylingBlocks(),[a,i]=React.useState(""),[l,c]=React.useState({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),u=web.useThrottledCallback(p=>{const f=!lodashEs.get(l,"negative",!1),m=lodashEs.get(l,"cssProperty","");let h=parseFloat(l.dragStartValue);h=isNaN(h)?0:h;let g=MAPPER[l.dragUnit];(lodashEs.startsWith(m,"scale")||m==="opacity")&&(g=10);let b=(l.dragStartY-p.pageY)/g+h;f&&b<0&&(b=0),m==="opacity"&&b>1&&(b=1),l.onDrag(`${b}`),i(`${b}`)},[l],50),d=React.useCallback(()=>{setTimeout(()=>l.onDragEnd(`${a}`),100),c({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[l,a,c]);return lodashEs.isEmpty(o)?null:jsxRuntime.jsxRuntimeExports.jsxs(BlockSettingsContext.Provider,{value:{setDragData:c},children:[l.dragging?jsxRuntime.jsxRuntimeExports.jsx("div",{onMouseMove:u,onMouseUp:()=>d(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx(StylingHelpers,{}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Accordion,{defaultValue:["Styles"],type:"multiple",className:"w-full",children:[r&&jsxRuntime.jsxRuntimeExports.jsx(StylingGroup,{section:FLEX_CHILD_SECTION}),n?jsxRuntime.jsxRuntimeExports.jsx(StylingGroup,{section:GRID_CHILD_SECTION}):null,SETTINGS_SECTIONS.map(p=>jsxRuntime.jsxRuntimeExports.jsx(StylingGroup,{section:p},p.heading))]})]})]})}const ChaiSelect=({defaultValue:r="",onValueChange:n,options:o,placeholder:a="Select",className:i=""})=>{const[l,c]=React.useState(r),u=d=>{const p=d.target.value;c(p),n(p)};return jsxRuntime.jsxRuntimeExports.jsx("div",{className:iconBase.cn("relative inline-block w-full",i),children:jsxRuntime.jsxRuntimeExports.jsxs("select",{className:"mt-1 flex w-full rounded-md border border-border bg-background px-3 py-1 text-sm text-foreground 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",value:l,onChange:u,children:[jsxRuntime.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,children:a}),o.map(d=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:d.value,children:d.label},d.value))]})})},ChaiSelect$1=ChaiSelect;function UILibrariesSelect({uiLibraries:r,library:n,setLibrary:o}){const{t:a}=reactI18next.useTranslation();return n?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"h-12",children:[jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs font-bold text-gray-500",children:a("choose_library")}),jsxRuntime.jsxRuntimeExports.jsx(ChaiSelect$1,{className:"mt-1",options:r.map(i=>({value:i.uuid,label:i.name})),defaultValue:n,onValueChange:i=>o(i)})]}):null}const BlockCard=({block:r,library:n,parentId:o=void 0})=>{const[a,i]=React.useState(!1),l=useBuilderProp("getUILibraryBlock",lodashEs.noop),{addCoreBlock:c,addPredefinedBlock:u}=useAddBlock(),[,d]=useSelectedBlockIds(),[,p]=useHighlightBlockId(),f=lodashEs.get(r,"name",lodashEs.get(r,"label")),m=flagged.useFeature("dnd"),[,h]=jotai.useAtom(draggedBlockAtom),g=v=>{const x=lodashEs.has(v,"styles_attrs.data-page-section");return v._type==="Box"&&x},y=React.useCallback(async v=>{if(v.stopPropagation(),lodashEs.has(r,"component")){c(r,o),emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK});return}i(!0);const x=await l(n,r);lodashEs.isEmpty(x)||u(runtime.syncBlocksWithDefaults(x),o),emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK})},[r]),b=async v=>{const x=await l(n,r);let E=o;if(g(lodashEs.first(x))&&(E=null),!lodashEs.isEmpty(x)){const S={blocks:x,uiLibrary:!0,parent:E};if(v.dataTransfer.setData("text/plain",JSON.stringify(S)),r.preview){const w=new Image;w.src=r.preview,w.onload=()=>{v.dataTransfer.setDragImage(w,0,0)}}else v.dataTransfer.setDragImage(new Image,0,0);h(S),setTimeout(()=>{d([]),p(null),emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK})},200)}};return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{onClick:a?()=>{}:y,draggable:m?"true":"false",onDragStart:b,className:clsx("relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"),children:[a&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black/70",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"animate-spin",size:15,color:"white"}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?jsxRuntime.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[45px] w-full rounded-md",alt:f}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border bg-gray-200",children:jsxRuntime.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:f})})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:f})})]})},libraryBlocksAtom=jotai.atom({}),useLibraryBlocks=r=>{const[n,o]=jotai.useAtom(libraryBlocksAtom),a=useBuilderProp("getUILibraryBlocks",lodashEs.noop),i=lodashEs.get(n,`${r==null?void 0:r.uuid}.blocks`,null),l=lodashEs.get(n,`${r==null?void 0:r.uuid}.loading`,"idle"),c=React.useRef("idle");return React.useEffect(()=>{(async()=>{if(l==="complete"||c.current==="loading")return;c.current="loading",o(d=>({...d,[r==null?void 0:r.uuid]:{loading:"loading",blocks:[]}}));const u=await a(r);c.current="idle",o(d=>({...d,[r==null?void 0:r.uuid]:{loading:"complete",blocks:u||[]}}))})()},[r,i,l,c]),{data:i||[],isLoading:l==="loading"}},UILibrarySection=({parentId:r})=>{const[n,o]=jotai.useAtom(selectedLibraryAtom),a=useBuilderProp("uiLibraries",[]),i=runtime.useChaiBlocks(),l=lodashEs.values(i).filter(E=>E.category==="custom"),c=a.find(E=>E.uuid===n)||lodashEs.first(a),{data:u,isLoading:d}=useLibraryBlocks(c),p=lodashEs.groupBy([...u,...l],"group"),[f,m]=React.useState("Hero"),h=lodashEs.get(p,f,[]),g=React.useRef(null),{t:y}=reactI18next.useTranslation(),b=E=>{g.current&&(clearTimeout(g.current),g.current=null),g.current=setTimeout(()=>{g.current&&m(E)},300)};if(d)return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-4 grid h-full w-full grid-cols-12 gap-2",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"col-span-3 h-full"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"col-span-9 h-full"})]});const v=lodashEs.filter(h,(E,S)=>S%2===0),x=lodashEs.filter(h,(E,S)=>S%2===1);return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"relative mt-2 flex h-full max-h-full overflow-hidden bg-background",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full pt-2",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2",children:[jsxRuntime.jsxRuntimeExports.jsx(UILibrariesSelect,{library:c==null?void 0:c.uuid,setLibrary:o,uiLibraries:a}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex h-full max-h-full w-full flex-1 flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:"text-xs font-bold text-gray-500",children:y("groups")}),jsxRuntime.jsxRuntimeExports.jsx("hr",{className:"mt-1 border-border"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20",children:React.Children.toArray(lodashEs.map(p,(E,S)=>jsxRuntime.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>b(S),onMouseLeave:()=>clearTimeout(g.current),onClick:()=>m(S),className:iconBase.cn("flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",S===f?"bg-blue-500 text-white hover:bg-blue-600":""),children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:lodashEs.capitalize(y(S.toLowerCase()))}),jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CaretRightIcon,{className:"ml-2 h-5 w-5"})]},S)))})]})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ScrollArea,{onMouseEnter:()=>g.current?clearTimeout(g.current):null,className:"z-10 -mt-2 flex h-full max-h-full w-full flex-col gap-2 border-l border-border transition-all ease-linear",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 px-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-1",children:React.Children.toArray(v.map(E=>jsxRuntime.jsxRuntimeExports.jsx(BlockCard,{parentId:r,block:E,library:c})))}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-1",children:React.Children.toArray(x.map(E=>jsxRuntime.jsxRuntimeExports.jsx(BlockCard,{parentId:r,block:E,library:c})))})]}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})]})})})},UILibrariesPanel=({parentId:r})=>jsxRuntime.jsxRuntimeExports.jsx(UILibrarySection,{parentId:r}),UILibraries=UILibrariesPanel,add_block="Add block",enter_paste_tailwind_html="(Enter or paste TailwindCSS HTML snippet)",click_to_add_block="(Click to add block to page)",core="Core",custom_blocks="Custom Blocks",ui_library="UI Library",html_snippet_description="Use HTML snippets from Tailwind CSS component libraries etc. or just copy paste your own HTML code.",tailwind_html_snippet="Tailwind HTML snippet:",enter_code_snippet="Enter your code snippet here...",import_html="Import HTML",note_imported_html="NOTE: Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page.",dark_mode="Dark mode",tree_view_no_blocks="This page has no blocks. Add a block by clicking the + button",canvas_empty="This page is empty",no_block_selected_for_styling="Please select a block to edit settings or styles",no_block_selected_for_ask_ai="Please select a block to ask AI",no_styling_block_selected="Please select a styling block",drop_here_message="Drop your block here",use_setting="Use setting",mobile_xs_title="Mobile (XS)",mobile_xs_content="Styles set here are applied to all screen unless edited at higher breakpoint",mobile_sm_title="Mobile landscape (SM)",mobile_sm_content="Styles set here are applied at 640px and up unless edited at higher breakpoint",tablet_md_title="Tablet (MD)",tablet_md_content="Styles set here are applied at 768px and up",tablet_lg_title="Tablet Landscape (LG)",tablet_lg_content="Styles set here are applied at 1024px and up unless edited at higher breakpoint",desktop_xl_title="Desktop (XL)",desktop_xl_content="Styles set here are applied at 1280px and up unless edited at higher breakpoint",large_desktop_2xl_title="Large Desktop (2XL)",large_desktop_2xl_content="Styles set here are applied at 1536px and up",Breakpoints$1="Breakpoints",clear="Clear",clear_canvas_title="Clear whole canvas?",clear_canvas_description="Are you sure you want to clear the whole canvas?",cancel="Cancel",yes="Yes",preview="Preview",settings="Settings",styling="Styling",data_provider="Data Provider",remove_provider_confirmation="Are you sure you want to remove <span class='text-blue-500'>{name}</span> provider?",remove_provider_warning="Your data provider will be removed from this page and all added data binding will be not visible on blocks.",remove="Remove",no_data_providers="You have no data providers registered. Please add a data provider to your project.",learn_more="Learn more",add_data_providers="Add data providers:",select_provider="Select a provider",choose="Choose",page_data_providers="Page data providers:",view_data="View Data",mark_as_global="Mark as Global",global_block_note="Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks.",global_block_indicator="Global blocks are indicated with",global_block_category="Global blocks are available under 'Global' category",enter_global_block_name="Enter global block name",eg_header_footer="Eg: Header, Footer",blocks_selected="{{length}} blocks selected.",cut="Cut",copy$1="Copy",clear_selection="Clear Selection",dev_mode_message="This is dev mode. Visit",to_see_page_preview="to see page preview",theme_config={heading_font:"Heading Font",body_font:"Body Font",rounded_corner:"Rounded Corners",primary:"Primary",secondary:"Secondary",background:"Background",text_color:"Text Color",background_dark_mode:"Background (Dark Mode)",text_color_dark_mode:"Text Color (Dark Mode)"},web_blocks={box:"box",tag:"Tag",div:"div",level:"Level",header:"header",footer:"footer",section:"section",article:"article",aside:"aside",main:"main",nav:"navigation",figure:"figure",details:"details",summary:"summary",dialog:"dialog",strike:"strike",caption:"caption",legend:"legend",figcaption:"figure caption",mark:"mark",background_image:"Background Image",label:"Label",default:"default",icon_size:"Icon Size",icon_position:"Icon Position",start:"Start",end:"End",button:"Button",custom_html:"Custom HTML",html_code:"HTML Code",default_snippet:"The HTML snippet goes here...",placeholder:"Enter custom HTML code here",custom_script:"Custom Script",dark_mode:"Dark Mode",divider:"Divider",empty_box:"Empty Box",heading:"Heading",image:"Image",alt:"Alt",width:"Width",height:"Height",video:"Video",span:"Span",content:"Content",icon:"Icon",richtext:"Rich Text",list:"List",list_type:"List Type",listitem:"List Item",link:"Link",list_item:"List Item",none:"None",disc:"Disc",number:"Number",paragraph:"Paragraph",lightbox_link:"Lightbox Link",href:"Link",type:"Type",iframe:"iframe",inline:"inline",ajax:"ajax",autoplay:"Video autoplay",max_width:"Max Width",backdrop_color:"Background Color",gallery_name:"Gallery Name",slot:"Slot",empty_slot:"Empty Slot",text:"Text",video_url:"Video URL",controls:"Show Controls",loop:"Loop",muted:"Muted",checkbox:"Checkbox",required:"Required",checked:"Checked",submit_button:"Submit Button",form:"Form",submit_url:"Submit URL",error_message:"Error Message",success_message:"Success Message",input:"Input",value:"Value",show_label:"Show Label",field_name:"Field Name",radio:"Radio",multiple:"Multiple",options:"Options",select:"Select",multiple_choice:"Multiple Choice",textarea:"Textarea",rows:"Rows"},ai_assistant="AI Assistant",close_preview="Close Preview",saved="Saved",unsaved="Unsaved",saving="Saving...",page_is_empty="This page is empty.",Theme="Theme",Outline="Outline",clipboard_not_supported="Not supported",please_use_chrome_firefox_or_safari="Please use Chrome, Firefox or Safari",classes_copied_to_clipboard="Classes copied to clipboard",download_complete="Download complete",copied="Copied",enter_classes_separated_by_space="Enter classes separated by space",copy_classes_to_clipboard="Copy classes to clipboard",classes="Classes",ask_ai="Ask AI",edit_with_ai="Edit with AI",generating_please_wait="Generating... Please wait",stop$1="Stop",eg_this_page_is_about_an_ai_assistant_app_called_chai_studio_it_allows_users_to_create_beautiful_webpages_and_edit_content_with_ai="E.g.: This page is about an AI assistant app called Chai Studio. It allows users to create beautiful webpages and edit content with AI.",ask_ai_to_edit_styles="Ask AI to edit styles",ask_ai_to_edit_content="Ask AI to edit content",ai_context="AI Context",please_select_a_block_to_ask_ai="Select a block to edit with AI",please_select_a_block_to_edit="Please select a block to edit",edit="Edit",tell_about_this_page_eg_this_page_is_about="Describe this page. E.g.: This page is about...",tag="Tag",value="Value",background_image="Background Image",enter_image_url="Enter image URL",replace_image="Replace image",choose_image="Choose image",images="Images",typography="Typography",background="Background",library="Library",blocks="Blocks",basic="Basic",media="Media",advanced="Advanced",form="Form",choose_icon_or_enter_svg="Choose an icon or enter SVG",groups="Groups",ui_libraries="UI Libraries",accordions="Accordions",buttons="Buttons",layouts="Layouts",choose_library="Choose library",no_library_found="No library found.",faq="FAQ",hero="Hero",features="Features",footer="Footer",navbar="Navbar",icons="Icons",testimonials="Testimonials",blog="Blog",ai_quick_prompts={improve_writing:"Improve writing",replace_placeholder_content:"Replace placeholder content",fix_grammar:"Fix grammar",make_longer:"Make longer",make_shorter:"Make shorter",add_emojis:"Add emojis",randomize:"Randomize"},sidebar={outline:"Outline",edit_block:"Edit Block",ai_assistant:"AI Assistant",theme:"Theme"},remove_context="Remove context",yes_delete="Yes, Delete",ai_context_updated="AI Context Updated",you_can_now_ask_ai_to_edit_your_content="You can now ask AI to edit your content.",lngEn={add_block,enter_paste_tailwind_html,click_to_add_block,core,custom_blocks,ui_library,import:"Import",html_snippet_description,tailwind_html_snippet,enter_code_snippet,import_html,note_imported_html,dark_mode,tree_view_no_blocks,canvas_empty,no_block_selected_for_styling,no_block_selected_for_ask_ai,no_styling_block_selected,drop_here_message,use_setting,mobile_xs_title,mobile_xs_content,mobile_sm_title,mobile_sm_content,tablet_md_title,tablet_md_content,tablet_lg_title,tablet_lg_content,desktop_xl_title,desktop_xl_content,large_desktop_2xl_title,large_desktop_2xl_content,Breakpoints:Breakpoints$1,clear,clear_canvas_title,clear_canvas_description,cancel,yes,preview,settings,styling,data_provider,remove_provider_confirmation,remove_provider_warning,remove,no_data_providers,learn_more,add_data_providers,select_provider,choose,page_data_providers,view_data,mark_as_global,global_block_note,global_block_indicator,global_block_category,enter_global_block_name,eg_header_footer,blocks_selected,cut,copy:copy$1,delete:"Delete",clear_selection,dev_mode_message,to_see_page_preview,"flex.heading":"Flex Child","flex.basis":"Basis","flex.order":"Order","flex.flex":"Flex","flex.grow":"Grow","flex.shrink":"Shrink","grid.heading":"Grid Child","grid.col_span":"Col Span","grid.col_start":"Col Start","grid.col_end":"Col End","grid.row_span":"Row Span","grid.row_start":"Row Start","grid.row_end":"Row End","grid.order":"Order","layout.heading":"Layout","layout.width":"Width","layout.height":"Height","layout.margin":"Margin","layout.margin_all":"All","layout.margin_lr":"Left-Right","layout.margin_tb":"Top-Bottom","layout.margin_top":"Top","layout.margin_right":"Right","layout.margin_bottom":"Bottom","layout.margin_left":"Left","layout.padding":"Padding","layout.padding_all":"All","layout.padding_lr":"Left-Right","layout.padding_tb":"Top-Bottom","layout.padding_top":"Top","layout.padding_right":"Right","layout.padding_bottom":"Bottom","layout.padding_left":"Left","layout.space_bt":"Space Bt.","layout.space_lr":"Left-Right","layout.space_tb":"Top-Bottom","size.heading":"Size","size.min_width_height":"Min width & height","size.min_width":"Min Width","size.min_height":"Min Height","size.max_width_height":"Max width & height","size.max_width":"Max Width","size.max_height":"Max Height","size.object_options_aspect_ratio":"Object options & aspect ratio","size.aspect":"Aspect","size.fit":"Fit","size.position":"Position","display.heading":"Display","display.display":"Display","display.flex_options":"Flex options","display.flex_direction":"Direction","display.flex_wrap":"Wrap","display.justify_content":"Justify","display.align_content":"Content","display.align_items":"Items","display.gap":"Gap","display.gap_all":"All","display.gap_lr":"Left-Right","display.gap_tb":"Top-Bottom","display.grid_options":"Grid options","display.grid_columns":"Columns","display.grid_rows":"Rows","display.grid_auto_flow":"Auto Flow","display.grid_auto_cols":"Auto Cols","display.grid_auto_rows":"Auto Rows","display.visibility_opacity":"Visibility & Opacity","display.visibility":"Visibility","display.opacity":"Opacity","position.heading":"Position","position.position":"Position","position.options":"Position options","position.direction":"Direction","position.top":"Top","position.right":"Right","position.bottom":"Bottom","position.left":"Left","position.inset":"Inset","position.all":"All","position.lr":"Left Right","position.tb":"Top Bottom","position.z_index":"Z-Index","position.float_clear":"Float & Clear","position.float":"Float","position.clear":"Clear","position.overflow_overscroll":"Overflow & Overscroll","position.overflow":"Overflow","position.overscroll":"Overscroll","typography.heading":"Typography","typography.font":"Font","typography.size":"Size","typography.height":"Height","typography.weight":"Weight","typography.color":"Color","typography.alignments":"Alignments","typography.align":"Align","typography.valign":"V. Align","typography.spacing_decoration_more":"Spacing, decoration & more","typography.spacing":"Spacing","typography.decoration":"Decoration","typography.thickness":"Thickness","typography.transform":"Transform","typography.whitespace_breaks":"White space & breaks","typography.whitespace":"Whitespace","typography.wordbreak":"Wordbreak","background.heading":"Background","background.bgcolor":"Bg. Color","background.position_size_more":"Position, Size & more","background.attachment":"Attachment","background.clipping":"Clipping","background.origin":"Origin","background.position":"Position","background.repeat":"Repeat","background.size":"Size","background.gradient":"Gradient","background.gradient_colors":"Gradient colors","background.from_color":"From","background.via_color":"Via","background.to_color":"To","border.heading":"Border & Outline","border.width":"Width","border.all":"All","border.lr":"Left Right","border.tb":"Top bottom","border.top":"Top","border.right":"Right","border.bottom":"Bottom","border.left":"Left","border.corners":"Corners","border.top_left":"Top Left","border.top_right":"Top right","border.bottom_right":"Bottom right","border.bottom_left":"Bottom left","border.color":"Color","border.style":"Style","border.divide_options":"Divide options","border.divide_color":"Color","border.divide_style":"Style","border.outline_styling":"Outline styling","border.outline_width":"Width","border.outline_offset":"Offset","border.outline_style":"Style","border.ring_options":"Ring options","border.ring_width":"Width","border.ring_color":"Color","border.ring_offset_width":"Offset","border.ring_offset_color":"Off. color","effect.heading":"Effect & Animation","effect.shadow":"Shadow","effect.color":"Color","effect.cursor":"Cursor","effect.blend_cursor":"Blend & Cursor","effect.mix_blend":"Mix Blend","effect.bg_blend":"Bg. Blend","effect.transform":"Transform","effect.origin":"Origin","effect.scale":"Scale","effect.all":"All","effect.lr":"Left-Right","effect.tb":"Top-Bottom","effect.skew":"Skew","effect.translate":"Translate","effect.rotate":"Rotate","effect.animation":"Animation","effect.transition":"Transition","effect.easing":"Easing","effect.duration":"Duration","effect.delay":"Delay","classes.heading":"Classes",theme_config,web_blocks,ai_assistant,close_preview,saved,unsaved,saving,page_is_empty,Theme,Outline,clipboard_not_supported,please_use_chrome_firefox_or_safari,classes_copied_to_clipboard,download_complete,copied,enter_classes_separated_by_space,copy_classes_to_clipboard,classes,ask_ai,edit_with_ai,generating_please_wait,stop:stop$1,eg_this_page_is_about_an_ai_assistant_app_called_chai_studio_it_allows_users_to_create_beautiful_webpages_and_edit_content_with_ai,ask_ai_to_edit_styles,ask_ai_to_edit_content,ai_context,please_select_a_block_to_ask_ai,please_select_a_block_to_edit,edit,tell_about_this_page_eg_this_page_is_about,tag,value,background_image,enter_image_url,replace_image,choose_image,images,typography,background,library,blocks,basic,media,advanced,form,choose_icon_or_enter_svg,groups,ui_libraries,accordions,buttons,layouts,choose_library,no_library_found,faq,hero,features,footer,navbar,icons,testimonials,blog,ai_quick_prompts,sidebar,remove_context,yes_delete,ai_context_updated,you_can_now_ask_ai_to_edit_your_content};i18n.use(reactI18next.initReactI18next).init({resources:{en:{translation:lngEn}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const CoreBlock=({block:r,disabled:n,parentId:o})=>{const[,a]=jotai.useAtom(draggedBlockAtom),{type:i,icon:l,label:c}=r,{addCoreBlock:u,addPredefinedBlock:d}=useAddBlock(),[,p]=useSelectedBlockIds(),[,f]=useHighlightBlockId(),m=()=>{if(console.log("addBlockToPage",r,o),lodashEs.has(r,"blocks")){const y=lodashEs.isFunction(r.blocks)?r.blocks():r.blocks;d(runtime.syncBlocksWithDefaults(y),o||null)}else u(r,o||null);emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK})},h=flagged.useFeature("dnd"),{t:g}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{disabled:n,onClick:m,type:"button",onDragStart:y=>{y.dataTransfer.setData("text/plain",JSON.stringify(lodashEs.omit(r,["component","icon"]))),y.dataTransfer.setDragImage(new Image,0,0),a(lodashEs.omit(r,["component","icon"])),setTimeout(()=>{p([]),f(null)},200)},draggable:h?"true":"false",className:"cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",children:[React.createElement(l||reactIcons.BoxIcon,{className:"w-4 h-4 mx-auto"}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:lodashEs.capitalize(g(c||i))})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:g(c||i)})})]})})},DefaultChaiBlocks=({parentId:r,gridCols:n="grid-cols-2"})=>{const o=runtime.useChaiBlocks(),a=useBuilderProp("filterChaiBlock",()=>!0),i=lodashEs.filter(o,a),l=lodashEs.groupBy(i,"category"),c=lodashEs.uniq(lodashEs.map(l.core,"group"));return jsxRuntime.jsxRuntimeExports.jsx(ChaiBuilderBlocks,{gridCols:n,parentId:r,groups:c,blocks:l.core})},CORE_GROUPS=["basic","typography","media","layout","form","advanced","other"],ChaiBuilderBlocks=({groups:r,blocks:n,parentId:o,gridCols:a="grid-cols-4"})=>{var u;const{t:i}=reactI18next.useTranslation(),[l]=useBlocksStore(),c=(u=lodashEs.find(l,d=>d._id===o))==null?void 0:u._type;return React.Children.toArray(lodashEs.map(lodashEs.sortBy(r,d=>CORE_GROUPS.indexOf(d)===-1?99:CORE_GROUPS.indexOf(d)),d=>lodashEs.reject(lodashEs.filter(lodashEs.values(n),{group:d}),{hidden:!0}).length?jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Accordion,{type:"single",value:d,collapsible:!0,className:"w-full",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:d,className:"border-border",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{className:"rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline",children:lodashEs.capitalize(i(d.toLowerCase()))}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionContent,{className:"mx-auto max-w-xl p-3",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"grid gap-2 "+a,children:React.Children.toArray(lodashEs.reject(lodashEs.filter(lodashEs.values(n),{group:d}),{hidden:!0}).map(p=>jsxRuntime.jsxRuntimeExports.jsx(CoreBlock,{parentId:o,block:p,disabled:!canAcceptChildBlock(c,p.type)||!canBeNestedInside(c,p.type)})))})})]})}):null))},addBlockTabAtom=atomWithStorage("__add_block_tab","library"),AddBlocksPanel=({className:r,showHeading:n=!0,parentId:o=void 0})=>{const{t:a}=reactI18next.useTranslation(),[i,l]=jotai.useAtom(addBlockTabAtom),[,c]=jotai.useAtom(showPredefinedBlockCategoryAtom),u=useBuilderProp("importHTMLSupport",!0);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("flex h-full w-full flex-col overflow-hidden",r),children:[n?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[jsxRuntime.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:a("Add block")}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:a(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}):null,jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Tabs,{onValueChange:d=>{c(""),l(d)},value:i,className:iconBase.cn("h-max"),children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.TabsList,{className:"grid w-full "+(u?"grid-cols-3":"grid-cols-2"),children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"library",children:a("library")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"core",children:a("blocks")}),u?jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"html",children:a("import")}):null]})}),i==="core"&&jsxRuntime.jsxRuntimeExports.jsx(contextMenu.ScrollArea,{className:"-mx-1.5 h-[calc(100vh-156px)] overflow-y-auto",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:jsxRuntime.jsxRuntimeExports.jsx(DefaultChaiBlocks,{gridCols:"grid-cols-4",parentId:o})})}),i==="library"&&jsxRuntime.jsxRuntimeExports.jsx(UILibraries,{parentId:o}),i==="html"&&u?jsxRuntime.jsxRuntimeExports.jsx(ImportHTML$1,{parentId:o}):null]})},AddBlocksPanel$1=AddBlocksPanel,AddBlocksDialog=()=>{const{t:r}=reactI18next.useTranslation(),[n,o]=React.useState(""),[a,i]=React.useState(!1);return useChaiBuilderMsgListener(({name:l,data:c=void 0})=>{l===CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK&&(o(c==null?void 0:c._id),i(!0)),l===CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK&&(o(""),i(!1))}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialog,{open:a,onOpenChange:()=>a?i(!1):"",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogContent,{className:"max-w-5xl overflow-hidden border-border",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogHeader,{className:"flex flex-row items-center justify-between",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTitle,{className:"text-foreground",children:r("Add blocks")}),jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:()=>i(!1),className:"text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Cross2Icon,{className:"h-6 w-6"})})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-[500px] max-h-full overflow-hidden",children:jsxRuntime.jsxRuntimeExports.jsx(AddBlocksPanel$1,{parentId:n,showHeading:!1})})]})})};function FaCheck(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"},child:[]}]})(r)}function FaFilePen(r){return iconBase.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 32H384V299.6l-94.7 94.7c-8.2 8.2-14 18.5-16.8 29.7l-15 60.1c-2.3 9.4-1.8 19 1.4 27.8H64c-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"},child:[]}]})(r)}const QUICK_PROMPTS=[{name:"Improve writing",icon:FaFilePen,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:FaRecycle,prompt:"Discard current placeholder content and replace with meaningful relevant content."},{name:"Fix grammar",icon:reactIcons.CheckIcon,prompt:"Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors."},{name:"Make longer",icon:reactIcons.ArrowUpIcon,prompt:"Make all text elements longer."},{name:"Make shorter",icon:reactIcons.ArrowDownIcon,prompt:"Make all text elements shorter."},{name:"Add emojis",icon:lucideReact.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:lucideReact.ShuffleIcon,prompt:"Randomize all text elements."}];function QuickPrompts({onClick:r}){const{loading:n}=useAskAi(),{t:o}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsx("div",{className:n?"pointer-events-none opacity-50":"",children:jsxRuntime.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:QUICK_PROMPTS.map(({name:a,icon:i,subMenus:l,prompt:c})=>l?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Popover,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"flex cursor-pointer items-center space-x-2 rounded p-1 pl-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",children:[jsxRuntime.jsxRuntimeExports.jsx(i,{className:"h-4 w-4"}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:a})]},a)}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverContent,{side:"right",children:jsxRuntime.jsxRuntimeExports.jsx("ul",{children:jsxRuntime.jsxRuntimeExports.jsx("li",{children:"Happy"})})})]}):jsxRuntime.jsxRuntimeExports.jsxs("li",{onClick:()=>r(c),className:"flex cursor-pointer items-center space-x-2 rounded p-1 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",children:[jsxRuntime.jsxRuntimeExports.jsx(i,{className:"h-4 w-4"}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:o(a)})]},a))})})}const AIUserPrompt=({blockId:r})=>{const{t:n}=reactI18next.useTranslation(),{askAi:o,loading:a,error:i}=useAskAi(),[l,c]=React.useState(""),[u,d]=React.useState(!0),[p,f]=React.useState(),m=React.useRef(null),h=React.useRef(null);React.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const g=y=>{const{usage:b}=y||{};!i&&b&&f(b),h.current=setTimeout(()=>f(void 0),1e4),i||c("")};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{onClick:()=>d(!u),className:"flex cursor-pointer items-center justify-between border-b border-border py-2 text-sm font-bold text-muted-foreground hover:underline",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:n("Ask AI")}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronDown,{className:"h-4 w-4 text-gray-500 "+(u?"rotate-180":"")})})]}),u&&r?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{ref:m,value:l,onChange:y=>c(y.target.value),placeholder:n("Ask AI to edit content"),className:"w-full",rows:3,onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),h.current&&clearTimeout(h.current),f(void 0),o("content",r,l,g))}}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:l.trim().length<5||a,onClick:()=>{h.current&&clearTimeout(h.current),f(void 0),o("content",r,l,g)},variant:"default",className:"w-fit",size:"sm",children:a?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"h-5 w-5 animate-spin"}),n("generating_please_wait")]}):n("edit_with_ai")}),a?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Skeleton,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[jsxRuntime.jsxRuntimeExports.jsx(FaSpinner,{className:"h-4 w-4 animate-spin text-gray-500"}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs",children:n("Generating... Please wait...")})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:n("Stop")})]}):null]}),p?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:jsxRuntime.jsxRuntimeExports.jsxs("p",{className:"mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500",children:[jsxRuntime.jsxRuntimeExports.jsxs("span",{children:[n("Total tokens used"),": ",p.totalTokens]}),jsxRuntime.jsxRuntimeExports.jsx(Countdown,{})]})}):null,jsxRuntime.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:i&&jsxRuntime.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:i.message})}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx(QuickPrompts,{onClick:y=>{h.current&&clearTimeout(h.current),f(void 0),o("content",r,y,g)}})]}):u?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4 text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.SparklesIcon,{className:"mx-auto text-3xl text-muted-foreground"}),jsxRuntime.jsxRuntimeExports.jsx("h1",{children:n("Please select a block to Ask AI")})]})}):null]})},AISetContext=()=>{const{t:r}=reactI18next.useTranslation(),n=useBuilderProp("aiContext",""),[o,a]=React.useState(n),i=React.useRef(null),l=useBuilderProp("saveAiContextCallback",lodashEs.noop),[c,u]=React.useState(!1),[d,p]=React.useState(null),[,f]=React.useState(!1),{toast:m}=contextMenu.useToast(),h=React.useRef(null);React.useEffect(()=>{n&&a(n)},[n]);const g=async()=>{try{u(!0),p(null),await l(o),m({title:r("Updated AI Context"),description:r("You can now Ask AI to edit your content"),variant:"default"}),h.current.click()}catch(y){p(y)}finally{u(!1)}};return jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Accordion,{onValueChange:y=>{f(y!=="")},type:"single",collapsible:!0,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:"set-context",className:"border-none",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{ref:h,className:"border-b border-border py-2",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-between",children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"font-bold text-muted-foreground",children:r("AI Context")})})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionContent,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{ref:i,value:o,onChange:y=>a(y.target.value),placeholder:r("Tell about this page eg this page is about"),className:"mt-1 w-full",rows:10,onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),g())}}),n.trim().length===0?jsxRuntime.jsxRuntimeExports.jsx("p",{className:"mt-2 text-xs text-gray-500",children:r("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,jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:o.trim().length<5,onClick:()=>g(),variant:"default",className:"w-fit",size:"sm",children:c?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"h-5 w-5 animate-spin"}),r("Generating... Please wait...")]}):r("Save")}),n.trim().length>0?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialog,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:n.trim().length===0,variant:"ghost",className:"w-fit",size:"sm",children:c?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"h-5 w-5 animate-spin"}),r("Generating... Please wait...")]}):r("Delete")})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogContent,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogHeader,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogTitle,{children:[r("Delete context")," ?"]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogDescription,{})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogFooter,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogCancel,{children:r("Cancel")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogAction,{onClick:()=>{a(""),g()},children:r("Yes, Delete")})]})]})]}):null]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-2 max-w-full",children:d&&jsxRuntime.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:d.message})})]})]})})},AskAI=()=>{const[r]=useSelectedBlockIds();return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxRuntimeExports.jsx(AISetContext,{}),jsxRuntime.jsxRuntimeExports.jsx(AIUserPrompt,{blockId:lodashEs.first(r)})]})},AttrsEditor=React.memo(function r({preloadedAttributes:n=[],onAttributesChange:o}){const[a,i]=React.useState([]),[l,c]=React.useState(""),[u,d]=React.useState(""),[p,f]=React.useState(null),[m,h]=React.useState(""),g=React.useRef(null),y=React.useRef(null);React.useEffect(()=>{i(n)},[n]);const b=()=>{if(l.startsWith("@")){h("Attribute keys cannot start with '@'");return}if(l){const w=[...a,{key:l,value:u}];o(w),i(a),c(""),d(""),h("")}},v=w=>{const R=a.filter((A,C)=>C!==w);o(R),i(R)},x=w=>{f(w),c(a[w].key),d(a[w].value)},E=()=>{if(l.startsWith("@")){h("Attribute keys cannot start with '@'");return}if(p!==null&&l){const w=[...a];w[p]={key:l,value:u},o(w),i(w),f(null),c(""),d(""),h("")}},S=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),p!==null?E():b())};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"max-w-full",children:[jsxRuntime.jsxRuntimeExports.jsxs("form",{onSubmit:w=>{w.preventDefault(),p!==null?E():b()},className:"space-y-3",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{htmlFor:"attrKey",className:"text-xs",children:"Key"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Input,{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",id:"attrKey",ref:g,value:l,onChange:w=>c(w.target.value),placeholder:"Key",className:"h-8 text-sm"})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{htmlFor:"attrValue",className:"text-xs",children:"Value"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",id:"attrValue",rows:2,ref:y,value:u,onChange:w=>d(w.target.value),onKeyDown:S,placeholder:"Value",className:"bg-background text-sm"})]})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{type:"submit",variant:"secondary",className:"h-8 w-fit text-sm",children:p!==null?"Save":"Add"}),m&&jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs text-red-500",children:m})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-4 space-y-1 overflow-y-auto",children:a.map((w,R)=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded bg-muted p-1.5 text-sm",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mr-2 flex flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:"truncate font-semibold",children:w.key}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"text-wrap max-w-[200px] text-muted-foreground",children:w.value.toString()})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex-shrink-0",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>x(R),children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Edit2,{className:"h-3 w-3"}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Edit attribute"})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>v(R),children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.X,{className:"h-3 w-3"}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Remove attribute"})]})]})]},R))})]})}),BlockAttributesEditor=React__namespace.memo(()=>{const r=useSelectedBlock(),[n,o]=React.useState([]),[a]=useSelectedStylingBlocks(),i=useUpdateBlocksProps(),l=`${lodashEs.get(a,"0.prop")}_attrs`;React__namespace.useEffect(()=>{const u=lodashEs.map(lodashEs.get(r,l),(d,p)=>({key:p,value:d}));lodashEs.isEmpty(u)?o([]):o(u)},[lodashEs.get(r,l)]);const c=React__namespace.useCallback((u=[])=>{const d={};lodashEs.forEach(u,p=>{lodashEs.isEmpty(p.key)||lodashEs.set(d,p.key,p.value)}),i([lodashEs.get(r,"_id")],{[l]:d})},[r,i,l]);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex-col gap-y-2",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx(AttrsEditor,{preloadedAttributes:n,onAttributesChange:c})})})})});var __create=Object.create,__defProp$1v=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp$1x=Object.prototype.hasOwnProperty,__esm=(r,n)=>function(){return r&&(n=(0,r[__getOwnPropNames(r)[0]])(r=0)),n},__commonJS=(r,n)=>function(){return n||(0,r[__getOwnPropNames(r)[0]])((n={exports:{}}).exports,n),n.exports},__copyProps=(r,n,o,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of __getOwnPropNames(n))!__hasOwnProp$1x.call(r,i)&&i!==o&&__defProp$1v(r,i,{get:()=>n[i],enumerable:!(a=__getOwnPropDesc(n,i))||a.enumerable});return r},__toESM=(r,n,o)=>(o=r!=null?__create(__getProtoOf(r)):{},__copyProps(n||!r||!r.__esModule?__defProp$1v(o,"default",{value:r,enumerable:!0}):o,r)),init_react_shim=__esm({"react-shim.js"(){}});init_react_shim();init_react_shim();var isEqualAtomsValues=(r,n)=>r.size===n.size&&Array.from(r).every(([o,a])=>Object.is(n.get(o),a)),isEqualAtomsDependents=(r,n)=>r.size===n.size&&Array.from(r).every(([o,a])=>{const i=n.get(o);return i&&a.size===i.size&&Array.from(a).every(l=>i.has(l))});function useAtomsSnapshot({shouldShowPrivateAtoms:r=!1,...n}={}){const o=useStore(n),[a,i]=React.useState(()=>({values:new Map,dependents:new Map})),l=React.useRef(!0);return l.current=!0,React.useLayoutEffect(()=>{l.current=!1}),React.useEffect(()=>{const c=(o==null?void 0:o.dev_subscribe_store)||(o==null?void 0:o.dev_subscribe_state);if(!c)return;let u=new Map,d=new Map;"dev_subscribe_store"in o||console.warn("[DEPRECATION-WARNING]: Your Jotai version is out-of-date and contains deprecated properties that will be removed soon. Please update to the latest version of Jotai.");const p=m=>{var b,v,x;typeof m!="object"&&console.warn("[DEPRECATION-WARNING]: Your Jotai version is out-of-date and contains deprecated properties that will be removed soon. Please update to the latest version of Jotai.");const h=new Map,g=new Map;for(const E of((b=o.dev_get_mounted_atoms)==null?void 0:b.call(o))||[]){if(!r&&E.debugPrivate)continue;const S=(v=o.dev_get_atom_state)==null?void 0:v.call(o,E);S&&"v"in S&&h.set(E,S.v);const w=(x=o.dev_get_mounted)==null?void 0:x.call(o,E);if(w){let R=w.t;r||(R=new Set(Array.from(R.values()).filter(A=>!A.debugPrivate))),g.set(E,R)}}if(isEqualAtomsValues(u,h)&&isEqualAtomsDependents(d,g))return;u=h,d=g;const y=()=>i({values:h,dependents:g});l.current?Promise.resolve().then(y):y()},f=c==null?void 0:c(p,2);return p({}),f},[o,r]),a}init_react_shim();function useGotoAtomsSnapshot(r){const n=useStore(r);return React.useCallback(o=>{n.dev_restore_atoms&&n.dev_restore_atoms(o.values)},[n])}init_react_shim();init_react_shim();init_react_shim();init_react_shim();init_react_shim();function sheetForTag(r){if(r.sheet)return r.sheet;for(var n=0;n<document.styleSheets.length;n++)if(document.styleSheets[n].ownerNode===r)return document.styleSheets[n]}function createStyleElement(r){var n=document.createElement("style");return n.setAttribute("data-emotion",r.key),r.nonce!==void 0&&n.setAttribute("nonce",r.nonce),n.appendChild(document.createTextNode("")),n.setAttribute("data-s",""),n}var StyleSheet=function(){function r(o){var a=this;this._insertTag=function(i){var l;a.tags.length===0?a.insertionPoint?l=a.insertionPoint.nextSibling:a.prepend?l=a.container.firstChild:l=a.before:l=a.tags[a.tags.length-1].nextSibling,a.container.insertBefore(i,l),a.tags.push(i)},this.isSpeedy=o.speedy===void 0?process.env.NODE_ENV==="production":o.speedy,this.tags=[],this.ctr=0,this.nonce=o.nonce,this.key=o.key,this.container=o.container,this.prepend=o.prepend,this.insertionPoint=o.insertionPoint,this.before=null}var n=r.prototype;return n.hydrate=function(a){a.forEach(this._insertTag)},n.insert=function(a){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(createStyleElement(this));var i=this.tags[this.tags.length-1];if(process.env.NODE_ENV!=="production"){var l=a.charCodeAt(0)===64&&a.charCodeAt(1)===105;l&&this._alreadyInsertedOrderInsensitiveRule&&console.error(`You're attempting to insert the following rule:
61
+ }`)},[l,h]),React.useEffect(()=>{d.querySelector("#drop-target-block").innerHTML=u?`[data-block-id="${u}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}`:""},[u]),jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:(y||b)&&jsxRuntime.jsxRuntimeExports.jsx("link",{rel:"stylesheet",href:`https://fonts.googleapis.com/css2?family=${y?`${y.replace(/ /g,"+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900`:""}${y&&b&&y!==b?"&":""}${b&&b!==y?`family=${b.replace(/ /g,"+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900`:""}&display=swap`})})},useChaiExternalData=()=>jotai.useAtom(chaiExternalDataAtom),useCanvasSettings=()=>jotai.useAtom(canvasSettingsAtom),isVisibleAtBreakpoint=(r,n)=>{const o=["xs","sm","md","lg","xl","2xl"],a=o.indexOf(n),i=r.split(" ");let l=new Array(o.length).fill(!1);for(const c of i){let[u,d]=c.split(":");d||(d=u,u="xs");const p=o.indexOf(u);if(p<=a){const f=["block","flex","inline","inline-block","inline-flex","grid","table"],m=["hidden"];if(f.includes(d))for(let h=p;h<o.length;h++)l[h]=!0;else if(m.includes(d))for(let h=p;h<o.length;h++)l[h]=!1}}return l[a]},getSlots=r=>{const n={};return Object.keys(r).forEach(o=>{lodashEs.isString(r[o])&&r[o].startsWith(STRINGS.SLOT_KEY)&&(n[o]=r[o].replace(STRINGS.SLOT_KEY,"").split(","))}),n},generateClassNames=lodashEs.memoize(r=>{const n=r.replace(STRINGS.STYLES_KEY,"").split(",");return tailwindMerge.twMerge(n[0],n[1])});function getElementAttrs(r,n){return lodashEs.get(r,`${n}_attrs`,{})}function getStyleAttrs(r,n){const o={};return Object.keys(r).forEach(a=>{if(lodashEs.isString(r[a])&&r[a].startsWith(STRINGS.STYLES_KEY)){const i=generateClassNames(r[a]),l=getElementAttrs(r,a);o[a]={className:i,"data-style-prop":a,"data-block-parent":r._id,"data-style-id":`${a}-${r._id}`,...l};const c=lodashEs.has(l,"x-show")||lodashEs.has(l,"x-if");c&&(o.__isHidden=c&&!isVisibleAtBreakpoint(i,n))}}),o}function applyBindings(r,n){const o=lodashEs.get(r,"_bindings",{});return lodashEs.isEmpty(o)?{...r}:(lodashEs.each(o,(a,i)=>{lodashEs.isString(a)&&lodashEs.get(n,a,null)&&(r[i]=lodashEs.get(n,a,null))}),r)}function isDescendant(r,n,o){if(!lodashEs.find(o,{_id:r}))return!1;const i=lodashEs.filter(o,{_parent:r});return i.some(l=>l._id===n)?!0:i.some(l=>isDescendant(l._id,n,o))}function BlocksRendererStatic({blocks:r}){const[n]=useBlocksStore(),[o]=jotai.useAtom(xShowBlocksAtom),[a]=useCutBlockIds(),[i]=jotai.useAtom(draggedBlockAtom),[l]=jotai.useAtom(dropTargetBlockIdAtom),[,c]=useCanvasWidth(),[u]=useCanvasSettings(),[d]=useHiddenBlockIds(),p=React.useCallback(g=>getStyleAttrs(g,c),[c]),[f]=useChaiExternalData(),[m]=jotai.useAtom(inlineEditingActiveAtom),h=React.useCallback(g=>g.reduce((y,b)=>{const v=lodashEs.get(u,b,{});return{...y,...v}},{}),[u,n]);return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:React.Children.toArray(r.map((g,y)=>{if(m===g._id||d.includes(g._id))return null;const b=getSlots(g),v={};lodashEs.isEmpty(b)||Object.keys(b).forEach(k=>{v[k]=React.Children.toArray(b[k].map(j=>jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{blocks:[lodashEs.find(n,{_id:j})]})))});const x=lodashEs.filter(n,{_parent:g._id});v.children=x.length?jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{blocks:x}):null;const E=runtime.getBlockComponent(g._type),S=lodashEs.get(E,"builderComponent",lodashEs.get(E,"component",null));if(lodashEs.isNull(S))return jsxRuntime.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${g==null?void 0:g._type} not registered -->`});const w=lodashEs.has(E,"getBlockStateFrom")?E==null?void 0:E.getBlockStateFrom(g,n):[],R=h(w),A=p(g);if(lodashEs.get(A,"__isHidden",!1)&&!lodashEs.includes(o,g._id))return null;const C=i&&isDescendant(i._id,g._id,n);return jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:React.createElement(S,{blockProps:{...lodashEs.includes(o,g._id)?{"force-show":""}:{},"data-block-id":g._id,"data-block-type":g._type,...i?{"data-dnd":canAcceptChildBlock(g._type,i==null?void 0:i._type)?"yes":"no","data-dnd-dragged":i._id===g._id||C?"yes":"no"}:{},...l===g._id&&!C?{"data-drop":"yes"}:{},...lodashEs.includes(a,g._id)?{"data-cut-block":"yes"}:{}},index:y,...applyBindings(g,f),...lodashEs.omit(A,["__isHidden"]),...v,inBuilder:!0,blockState:R})})}))})}const useAllDataProviders=()=>React.useMemo(()=>runtime.getChaiDataProviders(),[]),BlocksExternalDataProvider=({children:r})=>{const[,n]=useChaiExternalData(),[o]=usePageDataProviders(),a=useAllDataProviders();return React.useEffect(()=>(n({}),lodashEs.each(o,i=>{const l=lodashEs.find(a,{providerKey:i.providerKey});if(l){const c=(l==null?void 0:l.mockFn)||(l==null?void 0:l.dataFn);c&&c(i.args).then(u=>n(d=>({...d,[i.providerKey]:u})))}}),()=>{lodashEs.each(o,i=>{n(l=>(delete l[i.providerKey],l))})}),[a,o,n]),jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:r})},StaticBlocksRenderer=()=>{const[r]=useBlocksStore(),n=lodashEs.isEmpty(r)?null:jsxRuntime.jsxRuntimeExports.jsx(BlocksExternalDataProvider,{children:jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{blocks:lodashEs.filter(r,o=>lodashEs.isEmpty(o._parent))})});return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:n})},AddBlockAtBottom=()=>{const{t:r}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsxs("button",{onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK}),className:"mt-1 block w-full rounded-md bg-gray-100 p-2 text-black hover:bg-gray-200 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-700",children:["+ ",r("add_block")]})},ResizableCanvasWrapper=({children:r,onMount:n,onResize:o})=>{const a=React.useRef(null),i=web.useDebouncedCallback(()=>{const{clientWidth:l}=a.current;o(l)},[a.current],100);return web.useResizeObserver(a.current,i,a.current!==null),React.useEffect(()=>{const{clientWidth:l}=a.current;n(l)},[]),jsxRuntime.jsxRuntimeExports.jsx("div",{id:"main-content",className:"h-full w-full p-8 pb-0",ref:a,children:r})},getElementByStyleId=(r,n)=>r.querySelector(`[data-style-id="${n}"]`),StaticCanvas=()=>{const[r]=jotai.useAtom(networkModeAtom),[n]=useCanvasWidth(),[,o]=useSelectedBlockIds(),a=useSelectedBlock(),[,i]=useHighlightBlockId(),l=React.useRef(null),c=React.useRef(null),[u,d]=React.useState({width:0,height:0}),p=useCanvasScale(u),[f,m]=React.useState([]),[,h]=React.useState([]),[,g]=jotai.useAtom(canvasIframeAtom),[y,b]=useSelectedStylingBlocks(),v=useBuilderProp("loading",!1),x=useBuilderProp("htmlDir","ltr"),E=R=>{d(A=>({...A,width:R}))};React.useEffect(()=>{if(!c.current)return;const{clientWidth:R,clientHeight:A}=c.current;d({width:R,height:A})},[c,n]);const S=(R,A=0)=>{const{top:C}=R.getBoundingClientRect();return C+A>=0&&C-A<=window.innerHeight};React.useEffect(()=>{var R,A;if(a&&a.type!=="Multiple"&&l.current){const C=getElementByDataBlockId(l.current.contentDocument,a._id);C&&(S(C)||(A=(R=l.current)==null?void 0:R.contentWindow)==null||A.scrollTo({top:C.offsetTop,behavior:"smooth"}),m([C]))}},[a]),React.useEffect(()=>{if(!lodashEs.isEmpty(y)&&l.current){const R=getElementByStyleId(l.current.contentDocument,lodashEs.first(y).id);h(R?[R]:[null])}else h([null])},[y]);const w=React.useMemo(()=>{let R=IframeInitialContent;return R=R.replace("__HTML_DIR__",x),r==="offline"&&(R=R.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),R=R.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),R=R.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),R},[r,x]);return jsxRuntime.jsxRuntimeExports.jsx(ResizableCanvasWrapper,{onMount:E,onResize:E,children:jsxRuntime.jsxRuntimeExports.jsx("div",{onClick:()=>{o([]),b([])},onMouseLeave:()=>setTimeout(()=>i(""),300),className:"relative mx-auto h-full w-full overflow-hidden",ref:c,children:jsxRuntime.jsxRuntimeExports.jsxs(ChaiFrame,{contentDidMount:()=>g(l.current),ref:l,id:"canvas-iframe",style:{...p,...lodashEs.isEmpty(p)?{width:`${n}px`}:{}},className:"relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:w,children:[jsxRuntime.jsxRuntimeExports.jsx(KeyboardHandler,{}),jsxRuntime.jsxRuntimeExports.jsx(BlockActionsStatic,{block:a,selectedBlockElement:lodashEs.first(f)}),jsxRuntime.jsxRuntimeExports.jsx(HeadTags,{model:"page"}),jsxRuntime.jsxRuntimeExports.jsx(reactWrapBalancer.Provider,{children:jsxRuntime.jsxRuntimeExports.jsxs(Canvas,{children:[v?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"})}):jsxRuntime.jsxRuntimeExports.jsx(StaticBlocksRenderer,{}),jsxRuntime.jsxRuntimeExports.jsx(AddBlockAtBottom,{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})}),jsxRuntime.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})})},StaticCanvas$1=StaticCanvas,FallbackError=()=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center",children:[jsxRuntime.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),jsxRuntime.jsxRuntimeExports.jsx("p",{children:"Please try again."})]})}),TypeIcon=r=>{switch(r.type){case"Image":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ImageIcon,{});case"Heading":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.HeadingIcon,{});case"Text":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{});case"Link":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Link1Icon,{});case"Video":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.VideoIcon,{});case"RichText":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CursorTextIcon,{});case"Button":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{});case"CustomHTML":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CodeIcon,{});case"Divider":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DividerHorizontalIcon,{});case"Icon":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SketchLogoIcon,{});case"List":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{});case"Paragraph":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{});case"Row":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{});case"ListItem":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ColumnsIcon,{});case"LineBreak":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SpaceBetweenVerticallyIcon,{});case"Form":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.GroupIcon,{});case"Checkbox":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CheckboxIcon,{});case"FormButton":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{});case"Input":case"TextArea":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InputIcon,{});case"Radio":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RadiobuttonIcon,{});case"Select":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DropdownMenuIcon,{});case"Table":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TableIcon,{});case"TableHead":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderTopIcon,{});case"TableBody":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderAllIcon,{});case"TableRow":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ViewHorizontalIcon,{});case"TableCell":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DragHandleHorizontalIcon,{});case"DataProvider":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.DatabaseIcon,{size:16});case"Box":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxIcon,{});default:return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxModelIcon,{})}},Breadcrumb=()=>{const r=useSelectedBlockHierarchy(),[,n]=useSelectedBlockIds(),[,o]=useHighlightBlockId();return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mx-2 border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground",children:jsxRuntime.jsxRuntimeExports.jsxs("ol",{className:"flex items-center whitespace-nowrap",children:[jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"inline-flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:()=>n([]),variant:"ghost",className:"h-fit p-1 text-xs font-normal",children:"Body"}),jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronRight,{size:16})]}),lodashEs.reverse(r).map((a,i)=>jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"inline-flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{onMouseEnter:()=>{o(a==null?void 0:a._id)},onClick:()=>n([a==null?void 0:a._id]),variant:"ghost",className:"h-fit gap-x-1 p-1 text-xs font-normal",children:[jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:a==null?void 0:a._type}),a._name||a._type]}),i!==r.length-1&&jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronRight,{size:16})]},i))]})})},CodeEditor$1=React.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-gqhS0hpB.cjs"))),CanvasArea=()=>{const[r]=useCodeEditor(),n=useBuilderProp("onError",lodashEs.noop);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-full flex-1 flex-col",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2",children:[jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"}),children:jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:n,children:jsxRuntime.jsxRuntimeExports.jsx(StaticCanvas$1,{})})}),r?jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"}),children:jsxRuntime.jsxRuntimeExports.jsx(reResizable.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:jsxRuntime.jsxRuntimeExports.jsx(CodeEditor$1,{})})}):null,jsxRuntime.jsxRuntimeExports.jsx(Breadcrumb,{})]})})},CanvasArea$1=CanvasArea,ColorField=({value:r,onChange:n,id:o,onBlur:a})=>{const i=lodashEs.debounce(n,200),l=c=>i(c.target.value);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-1.5 flex items-center gap-x-3",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-3/5 flex-col",children:jsxRuntime.jsxRuntimeExports.jsx("input",{type:"color",className:"text-xs p-0",value:r,onBlur:({target:{value:c}})=>a(o,c),onChange:l})})})},FONTS=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"},{title:"Bebas Neue",value:"Bebas Neue"},{title:"Manrope",value:"Manrope"}],ThemeConfigPanel=({showHeading:r=!0,className:n=""})=>{const[o,a]=useBrandingOptions(),[i]=useBlocksContainer(),l=React__namespace.useRef(o),{t:c}=reactI18next.useTranslation(),u=({formData:w},R)=>{R&&(a(w),l.current=w)},{bodyFont:d,headingFont:p,primaryColor:f,bodyTextDarkColor:m,bodyTextLightColor:h,bodyBgDarkColor:g,secondaryColor:y,bodyBgLightColor:b,roundedCorners:v}=o;let x={headingFont:iconBase.f({title:c("theme_config.heading_font"),default:p,options:FONTS}),bodyFont:iconBase.f({title:c("theme_config.body_font"),default:d,options:FONTS}),roundedCorners:iconBase.y({title:c("theme_config.rounded_corner"),default:parseInt(v||5,10)}),primaryColor:iconBase.s({title:c("theme_config.primary"),default:f}),secondaryColor:iconBase.s({title:c("theme_config.secondary"),default:y})};i||(x={...x,bodyBgLightColor:iconBase.s({title:c("theme_config.background"),default:b}),bodyTextLightColor:iconBase.s({title:c("theme_config.text_color"),default:m}),bodyBgDarkColor:iconBase.s({title:c("theme_config.background_dark_mode"),default:g}),bodyTextDarkColor:iconBase.s({title:c("theme_config.text_color_dark_mode"),default:h})});const E={type:"object",properties:{}},S={};return Object.keys(x).forEach(w=>{const R=x[w];return E.properties||(E.properties={}),E.properties[w]=R.schema,S[w]=R.uiSchema,!0}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("flex h-full w-full select-none flex-col",n),children:[r?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 p-1",children:jsxRuntime.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:c("Theme Configuration")})}):null,jsxRuntime.jsxRuntimeExports.jsx(Form,{widgets:{color:ColorField},idSeparator:".",autoComplete:"off",omitExtraData:!0,liveOmit:!0,liveValidate:!0,uiSchema:S,schema:E,formData:o,validator,onChange:u})]})},ThemeOptions=ThemeConfigPanel,placeholderStyle={display:"flex",alignItems:"center",zIndex:1},DefaultCursor=React.memo(function({top:n,left:o}){const a={position:"absolute",pointerEvents:"none",top:n+"px",left:o+"px",right:0};return jsxRuntime.jsxRuntimeExports.jsx("div",{style:{...placeholderStyle,...a},children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-0.5 flex-1 rounded-[1px] bg-green-500"})})}),Overlay$1=React.memo(function({children:n,isDragging:o}){return o?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pointer-events-none fixed left-0 top-0 z-[100] h-full w-full",children:n}):null}),DefaultDragPreview=React.memo(({id:r,isDragging:n,mouse:o})=>{const[a]=useBlocksStore(),i=React.useMemo(()=>a.find(c=>c._id===r),[a,r]),l=React.useMemo(()=>({transform:`translate(${(o==null?void 0:o.x)-10}px, ${(o==null?void 0:o.y)-10}px)`}),[o]);return o?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx(Overlay$1,{isDragging:n,children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pointer-events-none absolute z-50 rounded border border-border bg-gray-100/80 font-semibold text-blue-600 shadow-md dark:border-gray-700 dark:bg-gray-800",style:l,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex !cursor-grab items-center p-0.5","aria-label":`Type: ${i==null?void 0:i._type}`,children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:i==null?void 0:i._type})}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:(i==null?void 0:i._name)||(i==null?void 0:i._type)})]})})})}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"hidden"})}),CopyPasteBlocks=()=>{const[r]=useSelectedBlockIds(),{canPaste:n,pasteBlocks:o}=usePasteBlocks(),[,a]=useCopyBlockIds(),{t:i}=reactI18next.useTranslation(),l=useSelectedBlock();return jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{disabled:!canDuplicateBlock(l==null?void 0:l._type),onClick:()=>a(r),className:"flex items-center gap-x-4 text-xs",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CopyIcon,{})," Copy"]}),n(r[0])&&jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>{o(r)},children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CardStackIcon,{})," ",i("Paste")]})]})},CutBlocks=()=>{const[r]=useSelectedBlockIds(),[,n]=useCutBlockIds(),{t:o}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(r),children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ScissorsIcon,{})," ",o("Cut")]})},RemoveBlocks=()=>{const[r]=useSelectedBlockIds(),n=useRemoveBlocks(),o=useSelectedBlock(),{t:a}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{disabled:!canDeleteBlock(o==null?void 0:o._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>n(r),children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TrashIcon,{})," ",a("Remove")]})},BlockContextMenuContent=()=>{const{t:r}=reactI18next.useTranslation(),[n]=useSelectedBlockIds(),o=useDuplicateBlocks(),a=useSelectedBlock(),i=React.useCallback(()=>{o(n)},[n,o]);return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuContent,{className:"border-border text-xs",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{disabled:!canAddChildBlock(a==null?void 0:a._type),className:"flex items-center gap-x-4 text-xs",onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK,data:a}),children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.PlusIcon,{size:"14"})," ",r("Add block")]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenuItem,{disabled:!canDuplicateBlock(a==null?void 0:a._type),className:"flex items-center gap-x-4 text-xs",onClick:i,children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CardStackPlusIcon,{})," ",r("Duplicate")]}),jsxRuntime.jsxRuntimeExports.jsx(CutBlocks,{}),jsxRuntime.jsxRuntimeExports.jsx(CopyPasteBlocks,{}),jsxRuntime.jsxRuntimeExports.jsx(RemoveBlocks,{})]})},BlockContextMenu=({children:r})=>jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ContextMenu,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.ContextMenuTrigger,{asChild:!0,children:r}),jsxRuntime.jsxRuntimeExports.jsx(BlockContextMenuContent,{})]})}),defaultShortcuts=[{key:"ArrowDown",command:"selectNext"},{key:"ArrowUp",command:"selectPrev"},{key:"ArrowLeft",command:"selectParent",when:"isLeaf || isClosed"},{key:"ArrowLeft",command:"close",when:"isOpen"},{key:"ArrowRight",command:"open",when:"isClosed"},{key:"ArrowRight",command:"selectNext",when:"isOpen"},{key:"Home",command:"selectFirst"},{key:"End",command:"selectLast"}];function selectFirst(r){r.firstNode&&r.select(r.firstNode.id)}function selectLast(r){r.lastNode&&r.select(r.lastNode.id)}function selectNext(r){const n=r.selectedNodes[0].next||r.firstNode;r.select(n.id)}function selectPrev(r){const n=r.selectedNodes[0].prev||r.lastNode;r.select(n.id)}const selectParent=(r,n)=>{var a;const o=((a=r.selectedIds[0])==null?void 0:a.parent)||null;o&&n&&r.select(o.id)},open=(r,n)=>{const o=r.selectedNodes[0];o.isInternal&&n&&o.open()},close=(r,n)=>{const o=r.selectedNodes[0];o.isInternal&&n&&o.close()};function VscJson(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 16 16",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",clipRule:"evenodd",d:"M6 2.984V2h-.09c-.313 0-.616.062-.909.185a2.33 2.33 0 0 0-.775.53 2.23 2.23 0 0 0-.493.753v.001a3.542 3.542 0 0 0-.198.83v.002a6.08 6.08 0 0 0-.024.863c.012.29.018.58.018.869 0 .203-.04.393-.117.572v.001a1.504 1.504 0 0 1-.765.787 1.376 1.376 0 0 1-.558.115H2v.984h.09c.195 0 .38.04.556.121l.001.001c.178.078.329.184.455.318l.002.002c.13.13.233.285.307.465l.001.002c.078.18.117.368.117.566 0 .29-.006.58-.018.869-.012.296-.004.585.024.87v.001c.033.283.099.558.197.824v.001c.106.273.271.524.494.753.223.23.482.407.775.53.293.123.596.185.91.185H6v-.984h-.09c-.2 0-.387-.038-.563-.115a1.613 1.613 0 0 1-.457-.32 1.659 1.659 0 0 1-.309-.467c-.074-.18-.11-.37-.11-.573 0-.228.003-.453.011-.672.008-.228.008-.45 0-.665a4.639 4.639 0 0 0-.055-.64 2.682 2.682 0 0 0-.168-.609A2.284 2.284 0 0 0 3.522 8a2.284 2.284 0 0 0 .738-.955c.08-.192.135-.393.168-.602.033-.21.051-.423.055-.64.008-.22.008-.442 0-.666-.008-.224-.012-.45-.012-.678a1.47 1.47 0 0 1 .877-1.354 1.33 1.33 0 0 1 .563-.121H6zm4 10.032V14h.09c.313 0 .616-.062.909-.185.293-.123.552-.3.775-.53.223-.23.388-.48.493-.753v-.001c.1-.266.165-.543.198-.83v-.002c.028-.28.036-.567.024-.863-.012-.29-.018-.58-.018-.869 0-.203.04-.393.117-.572v-.001a1.502 1.502 0 0 1 .765-.787 1.38 1.38 0 0 1 .558-.115H14v-.984h-.09c-.196 0-.381-.04-.557-.121l-.001-.001a1.376 1.376 0 0 1-.455-.318l-.002-.002a1.415 1.415 0 0 1-.307-.465v-.002a1.405 1.405 0 0 1-.118-.566c0-.29.006-.58.018-.869a6.174 6.174 0 0 0-.024-.87v-.001a3.537 3.537 0 0 0-.197-.824v-.001a2.23 2.23 0 0 0-.494-.753 2.331 2.331 0 0 0-.775-.53 2.325 2.325 0 0 0-.91-.185H10v.984h.09c.2 0 .387.038.562.115.174.082.326.188.457.32.127.134.23.29.309.467.074.18.11.37.11.573 0 .228-.003.452-.011.672-.008.228-.008.45 0 .665.004.222.022.435.055.64.033.214.089.416.168.609a2.285 2.285 0 0 0 .738.955 2.285 2.285 0 0 0-.738.955 2.689 2.689 0 0 0-.168.602c-.033.21-.051.423-.055.64a9.15 9.15 0 0 0 0 .666c.008.224.012.45.012.678a1.471 1.471 0 0 1-.877 1.354 1.33 1.33 0 0 1-.563.121H10z"},child:[]}]})(r)}function BsLightningFill(r){return iconBase.GenIcon({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M5.52.359A.5.5 0 0 1 6 0h4a.5.5 0 0 1 .474.658L8.694 6H12.5a.5.5 0 0 1 .395.807l-7 9a.5.5 0 0 1-.873-.454L6.823 9.5H3.5a.5.5 0 0 1-.48-.641z"},child:[]}]})(r)}function TbEyeDown(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"},child:[]},{tag:"path",attr:{d:"M12 18c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"},child:[]},{tag:"path",attr:{d:"M19 16v6"},child:[]},{tag:"path",attr:{d:"M22 19l-3 3l-3 -3"},child:[]}]})(r)}function BiCollapseVertical(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 7.59 7.05 2.64 5.64 4.05 12 10.41l6.36-6.36-1.41-1.41L12 7.59zM5.64 19.95l1.41 1.41L12 16.41l4.95 4.95 1.41-1.41L12 13.59l-6.36 6.36z"},child:[]}]})(r)}function BiExpandVertical(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z"},child:[]}]})(r)}const Node=React.memo(({node:r,style:n,dragHandle:o})=>{const a=useBuilderProp("outlineMenuItems",[]),{t:i}=reactI18next.useTranslation(),[l,,c]=useHiddenBlockIds(),[,u]=useHighlightBlockId(),[d]=jotai.useAtom(canvasIframeAtom);let p=null;const f=r.children.length>0,{id:m,data:h,isSelected:g,willReceiveDrop:y,isDragging:b,isEditing:v,handleClick:x}=r,E=k=>{k.stopPropagation(),!l.includes(m)&&r.toggle()},S=k=>{k.isInternal&&(p=k.isOpen,k.isOpen&&k.close())},w=k=>{k.isInternal&&p!==null&&(p?k.open():k.close(),p=null)},R=k=>{k.stopPropagation(),!r.isOpen&&!l.includes(m)&&r.toggle(),x(k)};React.useEffect(()=>{const k=setTimeout(()=>{y&&!r.isOpen&&!b&&!l.includes(m)&&r.toggle()},500);return()=>clearTimeout(k)},[y,r,b]);const A=React.useMemo(()=>{const k=Object.keys(h),j=[];for(let I=0;I<k.length;I++)if(k[I].endsWith("_attrs")){const P=h[k[I]],O=Object.keys(P).join("|");O.match(/x-data/)&&j.push("data"),O.match(/x-on/)&&j.push("event"),O.match(/x-show|x-if/)&&j.push("show")}return j},[h]),C=(k,j)=>{const I=d.contentDocument||d.contentWindow.document,P=I.querySelector(`[data-block-id=${k}]`);P&&P.setAttribute("data-drop",j);const O=P.getBoundingClientRect(),B=d.getBoundingClientRect();O.top>=B.top&&O.left>=B.left&&O.bottom<=B.bottom&&O.right<=B.right||(I.documentElement.scrollTop=P.offsetTop-B.top)};return m===STRINGS.ROOT_TEMP_KEY?jsxRuntime.jsxRuntimeExports.jsxs("button",{onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK}),className:"mb-10 mt-5 w-full rounded bg-gray-100 p-1 hover:bg-gray-200 dark:bg-gray-800",children:["+ ",i("add_block")]}):jsxRuntime.jsxRuntimeExports.jsx(BlockContextMenu,{id:m,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>u(m),onClick:R,style:n,"data-node-id":m,ref:l.includes(m)?null:o,onDragStart:()=>S(r),onDragEnd:()=>w(r),onDragOver:k=>{k.preventDefault(),C(m,"yes")},onDragLeave:k=>{k.preventDefault(),C(m,"no")},onDrop:k=>{k.preventDefault(),C(m,"no")},className:iconBase.cn("group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",g?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800",y&&canAcceptChildBlock(h._type,"Icon")?"bg-green-200":"",b&&"opacity-20",l.includes(m)?"opacity-50":""),children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${r.isOpen?"rotate-90":""}`,children:f&&jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:E,type:"button",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TriangleRightIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-0.5 h-3 w-3",children:jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:h==null?void 0:h._type})}),v?jsxRuntime.jsxRuntimeExports.jsx(Input$1,{node:r}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"ml-2 flex items-center gap-x-1 truncate text-[11px]",onDoubleClick:k=>{k.stopPropagation(),r.edit(),r.deselect()},children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:(h==null?void 0:h._name)||(h==null?void 0:h._type.split("/").pop())}),A.includes("data")&&jsxRuntime.jsxRuntimeExports.jsx(VscJson,{className:"h-3 w-3 text-orange-600"}),A.includes("event")&&jsxRuntime.jsxRuntimeExports.jsx(BsLightningFill,{className:"h-3 w-3 text-yellow-500"}),A.includes("show")&&jsxRuntime.jsxRuntimeExports.jsx(TbEyeDown,{className:"h-3 w-3 text-orange-600"})]})]})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"invisible flex items-center space-x-1 pr-2 group-hover:visible",children:[!l.includes(m)&&a.map(k=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",asChild:!0,children:React.createElement(k.item,{blockId:m})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-10",children:k.tooltip})]})),canAddChildBlock(h==null?void 0:h._type)&&!l.includes(m)?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK,data:{_id:m}}),className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.PlusIcon,{size:"18"})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:i("Add block")})]}):null,jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{onClick:k=>{k.stopPropagation(),c(m),r.isOpen&&r.toggle()},className:"cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.EyeOff,{size:"15"})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:i("Add block")})]})]})]})})}),Input$1=({node:r})=>{var n,o;return jsxRuntime.jsxRuntimeExports.jsx("input",{autoFocus:!0,className:"ml-2 !h-4 w-full rounded-sm border border-border bg-background px-1 text-[11px] outline-none",type:"text",defaultValue:((n=r.data)==null?void 0:n._name)||((o=r.data)==null?void 0:o._type),onFocus:a=>a.currentTarget.select(),onBlur:a=>r.submit(a.currentTarget.value),onKeyDown:a=>{a.key==="Enter"&&r.submit(a.currentTarget.value)}})},useCanMove=()=>{const[r]=useBlocksStore();return(n,o)=>{var l;const a=(l=lodashEs.find(r,{_id:o}))==null?void 0:l._type,i=lodashEs.first(n.map(c=>{var u;return(u=lodashEs.find(r,{_id:c}))==null?void 0:u._type}));return canAcceptChildBlock(a,i)}},ListTree=()=>{const[treeData]=jotai.useAtom(treeDSBlocks),[ids,setIds]=useSelectedBlockIds(),[cutBlocksIds]=useCutBlockIds(),[,setHiddenBlocks]=useHiddenBlockIds(),updateBlockProps=useUpdateBlocksProps(),[,setStyleBlocks]=useSelectedStylingBlocks(),{moveBlocks}=useBlocksStoreUndoableActions(),canMove=useCanMove(),treeRef=React.useRef(null),[,setTreeRef]=jotai.useAtom(treeRefAtom),{t}=reactI18next.useTranslation(),clearSelection=()=>{setIds([]),setStyleBlocks([])},filteredTreeData=React.useMemo(()=>{const r=(o,a)=>o.filter(i=>!a.includes(i._id)).map(i=>({...i,children:i.children?r(i.children,a):[]}));return[...r(treeData,cutBlocksIds),{_type:STRINGS.ROOT_TEMP_KEY,_id:STRINGS.ROOT_TEMP_KEY,children:[]}]},[treeData,cutBlocksIds]);React.useEffect(()=>{setTreeRef(treeRef.current)},[treeRef.current]);const onRename=({id:r,name:n,node:o})=>{updateBlockProps([r],{_name:n},o.data._name)},onMove=({dragIds:r,parentId:n,index:o})=>{canMove(r,n)&&moveBlocks(r,n,o)},onSelect=r=>{if(r.length===0)return;const n=r[0]?r[0].id:"";setStyleBlocks([]),setIds([n])},onContextMenu=r=>{var a;r.preventDefault();const n=r.target,o=n.getAttribute("data-node-id")||((a=n.closest("[data-node-id]"))==null?void 0:a.getAttribute("data-node-id"));o&&(setStyleBlocks([]),setIds([o]))},debouncedDisableDrop=web.useDebouncedCallback(({parentNode:r,dragNodes:n})=>{var o;return(r==null?void 0:r.data._type)===STRINGS.ROOT_TEMP_KEY||!canAcceptChildBlock(r==null?void 0:r.data._type,(o=n[0])==null?void 0:o.data._type)},[],300),handleKeyDown=e=>{if(!treeRef.current)return;const tree=treeRef.current,selectedNode=tree.selectedNodes[0];if(!selectedNode)return;setIds[selectedNode.id],setStyleBlocks([]);const isLeaf=!selectedNode.isInternal,isClosed=!selectedNode.isOpen,isOpen=selectedNode.isOpen,shortcut=defaultShortcuts.find(s=>s.key===e.key&&(!s.when||eval(s.when)));if(shortcut)switch(e.preventDefault(),shortcut.command){case"selectNext":selectNext(tree);break;case"selectPrev":selectPrev(tree);break;case"selectParent":selectParent(tree,isLeaf||isClosed);break;case"close":close(tree,isOpen);break;case"open":open(tree,isClosed);break;case"selectFirst":selectFirst(tree);break;case"selectLast":selectLast(tree);break}};return lodashEs.isEmpty(treeData)?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-10 flex h-full w-full items-center justify-center p-8 text-center",children:jsxRuntime.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-sm text-gray-400",children:[t("This page is empty"),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{onClick:()=>emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK}),variant:"default",size:"sm",children:["+ ",t("add_block")]})]})})}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:iconBase.cn("flex h-full select-none flex-col space-y-1"),onClick:()=>clearSelection(),children:jsxRuntime.jsxRuntimeExports.jsxs("div",{id:"outline-view",className:"no-scrollbar h-full overflow-y-auto text-xs",onKeyDown:r=>{treeRef.current.isEditing||handleKeyDown(r)},children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex items-center justify-end gap-x-2 pb-2 text-xs text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:()=>setHiddenBlocks([]),variant:"outline",className:"h-fit p-1 disabled:cursor-not-allowed disabled:opacity-50",size:"sm",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.EyeOpenIcon,{className:"h-4 w-4"})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:t("Show hidden blocks")})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{className:"h-fit p-1",onClick:()=>{var r;return(r=treeRef==null?void 0:treeRef.current)==null?void 0:r.openAll()},variant:"outline",size:"sm",children:jsxRuntime.jsxRuntimeExports.jsx(BiExpandVertical,{size:"14"})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:t("Expand all")})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{className:"h-fit p-1",onClick:()=>{var r;return(r=treeRef==null?void 0:treeRef.current)==null?void 0:r.closeAll()},variant:"outline",size:"sm",children:jsxRuntime.jsxRuntimeExports.jsx(BiCollapseVertical,{size:"14"})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"isolate z-[9999]",children:t("Collapse all")})]})]}),jsxRuntime.jsxRuntimeExports.jsx(reactArborist.Tree,{ref:treeRef,height:window.innerHeight-160,className:"no-scrollbar !h-full max-w-full !overflow-y-auto !overflow-x-hidden",selection:ids[0]||"",onRename,openByDefault:!1,onMove,rowHeight:25,data:[...filteredTreeData],renderCursor:DefaultCursor,onSelect,childrenAccessor:r=>r.children,width:"100%",renderDragPreview:DefaultDragPreview,indent:10,onContextMenu,disableDrop:debouncedDisableDrop,idAccessor:"_id",children:Node})]})})},Outline$1=ListTree,hasVideoEmbed=r=>{const n=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,o=/(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;return n.test(r)||o.test(r)},getVideoURLFromHTML=r=>{if(lodashEs.isEmpty(r))return r;const n=/<video[^>]+src=['"]([^'">]+)['"]/,o=/<iframe[^>]+src=['"]([^'">]+)['"]/,a=r.match(n),i=r.match(o),l=a?a[1]:i?i[1]:null,c=/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,u=/(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;return l&&(c.test(l)||u.test(l))?l:r},NAME_ATTRIBUTE="$name",ATTRIBUTE_MAP={img:{alt:"alt",width:"width",height:"height",src:"image"},video:{src:"url",autoplay:"controls.autoPlay",muted:"controls.muted",loop:"controls.loop",controls:"controls.widgets"},a:{href:"link.href",target:"link.target",type:""},input:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},textarea:{placeholder:"placeholder",required:"required",type:"inputType",name:"fieldName"},select:{placeholder:"placeholder",required:"required",multiple:"multiple",name:"fieldName"}},shouldAddText=(r,n)=>r.children.length===1&&lodashEs.includes(["Heading","Paragraph","Span","ListItem","Button","Label","TableCell","Link"],n._type),getTextContent=r=>r.map(n=>n.type==="text"?lodashEs.get(n,"content",""):lodashEs.isEmpty(n.children)?"":getTextContent(n.children)).join(""),getSanitizedValue=r=>r===null?"":r,getAttrs=r=>{if(r.tagName==="svg")return{};const n={},o=ATTRIBUTE_MAP[r.tagName]||{},a=r.attributes;return lodashEs.forEach(a,({key:i,value:l})=>{if(i!==NAME_ATTRIBUTE)if(o[i]){if(r.tagName==="img"&&i==="src"&&!l.startsWith("http")){const c=lodashEs.find(r.attributes,{key:"width"}),u=lodashEs.find(r.attributes,{key:"height"});c&&u?l=`https://via.placeholder.com/${c==null?void 0:c.value}x${u==null?void 0:u.value}`:l="https://via.placeholder.com/150x150"}lodashEs.set(n,o[i],getSanitizedValue(l))}else lodashEs.includes(["style","class","srcset"],i)||(lodashEs.has(n,"styles_attrs")||(n.styles_attrs={}),lodashEs.startsWith(i,"@")&&(i=i.replace("@","x-on:")),n.styles_attrs[`${i}`]=getSanitizedValue(l))}),delete n.class,n},getStyles$1=(r,n="styles")=>{if(!r.attributes)return{[n]:`${STRINGS.STYLES_KEY},`};const o=lodashEs.find(r.attributes,{key:"class"});if(o){const a=o.value;return{[n]:`${STRINGS.STYLES_KEY},${a}`}}return{[n]:`${STRINGS.STYLES_KEY},`}},getBlockProps=r=>{switch(r.tagName){case"img":return{_type:"Image"};case"input":return{_type:"Input",showLabel:!1};case"hr":return{_type:"Divider"};case"br":return{_type:"LineBreak"};case"textarea":return{_type:"TextArea",showLabel:!1};case"audio":return{_type:"Audio"};case"canvas":return{_type:"Canvas"};case"video":case"iframe":return{_type:"CustomHTML"};case"svg":return{_type:"Icon"};case"select":return{_type:"Select",options:[]};case"option":return{_type:"Option"};case"ul":case"ol":case"dl":return{_type:"List",tag:r.tagName,_listType:r.tagName==="ol"?"list-decimal":"list-none"};case"li":case"dt":return{_type:"ListItem",tag:r.tagName};case"span":case"figcaption":case"legend":return{_type:"Span",tag:r.tagName};case"p":return{_type:"Paragraph",content:""};case"a":return{_type:"Link"};case"form":return{_type:"Form"};case"label":return{_type:"Label"};case"button":return{_type:"Button"};case"code":return{_type:"Code"};case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return{_type:"Heading",tag:r.tagName};case"table":return{_type:"Table"};case"tr":return{_type:"TableRow"};case"td":case"th":return{_type:"TableCell",tag:r.tagName};case"thead":return{_type:"TableHead"};case"tbody":return{_type:"TableBody"};case"tfoot":return{_type:"TableFooter"};default:const n=lodashEs.get(r,"children",[]).length>0?"Box":"EmptyBox";return{_type:n,tag:r.tagName,_name:n=="EmptyBox"||r.tagName==="div"?n:lodashEs.capitalize(r.tagName)}}},traverseNodes=(r,n=null)=>lodashEs.flatMapDeep(r,o=>{var l;if(o.type==="comment")return[];let a={_id:iconBase.generateUUID()};if(n&&(a._parent=n.block._id),o.type==="text")return lodashEs.isEmpty(lodashEs.get(o,"content",""))?[]:n&&shouldAddText(n.node,n.block)?(lodashEs.set(n,"block.content",lodashEs.get(o,"content","")),[]):{...a,_type:"Text",content:lodashEs.get(o,"content","")};if(a={...a,...getBlockProps(o),...getAttrs(o),...getStyles$1(o)},o.attributes){const c=o.attributes.find(u=>u.key===NAME_ATTRIBUTE);c&&(a._name=c.value)}if(a._type==="Input"){const c=a.inputType||"text";c==="checkbox"?lodashEs.set(a,"_type","Checkbox"):c==="radio"&&lodashEs.set(a,"_type","Radio")}else if(o.tagName==="video"||o.tagName==="iframe"){const c=himalaya.stringify([o]);return hasVideoEmbed(c)&&(lodashEs.set(a,"_type","Video"),lodashEs.set(a,"url",getVideoURLFromHTML(c)),lodashEs.set(a,"styles",`${STRINGS.STYLES_KEY},absolute top-0 left-0 w-full h-full`),lodashEs.set(a,"controls",{autoPlay:!1,muted:!0,loop:!1,controls:!1})),a.content=c,[a]}else if(o.tagName==="svg"){const c=lodashEs.find(o.attributes,{key:"height"}),u=lodashEs.find(o.attributes,{key:"width"}),d=lodashEs.get(c,"value")?`[${lodashEs.get(c,"value")}px]`:"24px",p=lodashEs.get(u,"value")?`[${lodashEs.get(u,"value")}px]`:"24px",f=lodashEs.get(lodashEs.find(o.attributes,{key:"class"}),"value","w-full h-full");return a.styles=`${STRINGS.STYLES_KEY}, ${iconBase.cn(`w-${p} h-${d}`,f)}`.trim(),o.attributes=lodashEs.filter(o.attributes,m=>!lodashEs.includes(["style","width","height","class"],m.key)),a.icon=himalaya.stringify([o]),[a]}else if(o.tagName=="option"&&n&&((l=n.block)==null?void 0:l._type)==="Select")return n.block.options.push({label:getTextContent(o.children),...getAttrs(o)}),[];const i=traverseNodes(o.children,{block:a,node:o});return[a,...i]}),getSanitizedHTML=r=>{const n=r.match(/<body[^>]*>[\s\S]*?<\/body>/);return(n&&n.length>0?n[0].replace(/<body/,"<div").replace(/<\/body>/,"</div>"):r).replace(/\s+/g," ").replaceAll("> <","><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").trim()},getBlocksFromHTML=r=>{const n=himalaya.parse(getSanitizedHTML(r));return lodashEs.isEmpty(r)?[]:lodashEs.flatten(traverseNodes(n))},ImportHTML=({parentId:r})=>{const{t:n}=reactI18next.useTranslation(),[o,a]=React.useState(""),{addPredefinedBlock:i}=useAddBlock(),l=()=>{const c=getBlocksFromHTML(o);i([...c],r),a(""),emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK})};return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Card,{className:"border-border/0 p-0 shadow-none",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CardHeader,{className:"p-3",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CardDescription,{children:n("html_snippet_description")})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CardContent,{className:"space-y-2 px-3 py-0",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{htmlFor:"current",className:"text-sm",children:n("tailwind_html_snippet")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{autoFocus:!0,tabIndex:1,ref:c=>c&&c.focus(),onChange:c=>a(c.target.value),rows:12,value:o,placeholder:n("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-background font-mono text-xs font-normal"})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CardFooter,{className:"flex flex-col justify-end p-3",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:o.trim()==="",onClick:()=>l(),size:"sm",className:"w-fit",children:n("Import HTML")})})]})},ImportHTML$1=ImportHTML,isBoolean=r=>typeof r=="boolean"||r instanceof Boolean,isNumber=r=>typeof r=="number"||r instanceof Number,isBigInt=r=>typeof r=="bigint"||r instanceof BigInt,isDate=r=>!!r&&r instanceof Date,isString=r=>typeof r=="string"||r instanceof String,isArray$4=r=>Array.isArray(r),isObject$1=r=>r instanceof Object&&r!==null;function useBool(r){const[n,o]=React.useState(r());return[n,()=>o(i=>!i),o]}let componentId=1;const generateNextId=()=>componentId++;function useComponentId(){const r=React.useRef();return r.current===void 0&&(r.current=`:jsnvw:${generateNextId()}:`),r.current}function ExpandableObject(r){let{field:n,value:o,data:a,lastElement:i,openBracket:l,closeBracket:c,level:u,style:d,shouldExpandNode:p,clickToExpandNode:f}=r;const m=React.useRef(!1),[h,g,y]=useBool(()=>p(u,o,n));React.useEffect(()=>{m.current?y(p(u,o,n)):m.current=!0},[p]);const b=h?d.collapseIcon:d.expandIcon,v=h?"collapse JSON":"expand JSON",x=useComponentId(),E=u+1,S=a.length-1,w=R=>{R.key===" "&&(R.preventDefault(),g())};return React.createElement("div",{className:d.basicChildStyle,role:"list"},React.createElement("span",{className:b,onClick:g,onKeyDown:w,role:"button",tabIndex:0,"aria-label":v,"aria-expanded":h,"aria-controls":h?x:void 0}),n&&(f?React.createElement("span",{className:d.clickableLabel,onClick:g,onKeyDown:w,role:"button",tabIndex:-1},n,":"):React.createElement("span",{className:d.label},n,":")),React.createElement("span",{className:d.punctuation},l),h?React.createElement("div",{id:x},a.map((R,A)=>React.createElement(DataRender,{key:R[0]||A,field:R[0],value:R[1],style:d,lastElement:A===S,level:E,shouldExpandNode:p,clickToExpandNode:f}))):React.createElement("span",{className:d.collapsedContent,onClick:g,onKeyDown:w,role:"button",tabIndex:-1,"aria-hidden":!0,"aria-label":v,"aria-expanded":h}),React.createElement("span",{className:d.punctuation},c),!i&&React.createElement("span",{className:d.punctuation},","))}function JsonObject(r){let{field:n,value:o,style:a,lastElement:i,shouldExpandNode:l,clickToExpandNode:c,level:u}=r;return ExpandableObject({field:n,value:o,lastElement:i||!1,level:u,openBracket:"{",closeBracket:"}",style:a,shouldExpandNode:l,clickToExpandNode:c,data:Object.keys(o).map(d=>[d,o[d]])})}function JsonArray(r){let{field:n,value:o,style:a,lastElement:i,level:l,shouldExpandNode:c,clickToExpandNode:u}=r;return ExpandableObject({field:n,value:o,lastElement:i||!1,level:l,openBracket:"[",closeBracket:"]",style:a,shouldExpandNode:c,clickToExpandNode:u,data:o.map(d=>[void 0,d])})}function JsonPrimitiveValue(r){let{field:n,value:o,style:a,lastElement:i}=r,l=o,c=a.otherValue;return o===null?(l="null",c=a.nullValue):o===void 0?(l="undefined",c=a.undefinedValue):isString(o)?(l=a.noQuotesForStringValues?o:`"${o}"`,c=a.stringValue):isBoolean(o)?(l=o?"true":"false",c=a.booleanValue):isNumber(o)?(l=o.toString(),c=a.numberValue):isBigInt(o)?(l=`${o.toString()}n`,c=a.numberValue):isDate(o)?l=o.toISOString():l=o.toString(),n===""&&(n='""'),React.createElement("div",{className:a.basicChildStyle,role:"listitem"},n&&React.createElement("span",{className:a.label},n,":"),React.createElement("span",{className:c},l),!i&&React.createElement("span",{className:a.punctuation},","))}function DataRender(r){const n=r.value;return isArray$4(n)?React.createElement(JsonArray,Object.assign({},r)):isObject$1(n)&&!isDate(n)?React.createElement(JsonObject,Object.assign({},r)):React.createElement(JsonPrimitiveValue,Object.assign({},r))}var styles$2={"container-base":"_GzYRV","punctuation-base":"_3eOF8",pointer:"_1MFti","expander-base":"_f10Tu _1MFti","expand-icon":"_1UmXx","collapse-icon":"_1LId0","collapsed-content-base":"_1pNG9 _1MFti","container-light":"_2IvMF _GzYRV","basic-element-style":"_2bkNM","label-light":"_1MGIk","clickable-label-light":"_2YKJg _1MGIk _1MFti","punctuation-light":"_3uHL6 _3eOF8","value-null-light":"_2T6PJ","value-undefined-light":"_1Gho6","value-string-light":"_vGjyY","value-number-light":"_1bQdo","value-boolean-light":"_3zQKs","value-other-light":"_1xvuR","collapse-icon-light":"_oLqym _f10Tu _1MFti _1LId0","expand-icon-light":"_2AXVT _f10Tu _1MFti _1UmXx","collapsed-content-light":"_2KJWg _1pNG9 _1MFti","container-dark":"_11RoI _GzYRV","expand-icon-dark":"_17H2C _f10Tu _1MFti _1UmXx","collapse-icon-dark":"_3QHg2 _f10Tu _1MFti _1LId0","collapsed-content-dark":"_3fDAz _1pNG9 _1MFti","label-dark":"_2bSDX","clickable-label-dark":"_1RQEj _2bSDX _1MFti","punctuation-dark":"_gsbQL _3eOF8","value-null-dark":"_LaAZe","value-undefined-dark":"_GTKgm","value-string-dark":"_Chy1W","value-number-dark":"_2bveF","value-boolean-dark":"_2vRm-","value-other-dark":"_1prJR"};const defaultStyles={container:styles$2["container-light"],basicChildStyle:styles$2["basic-element-style"],label:styles$2["label-light"],clickableLabel:styles$2["clickable-label-light"],nullValue:styles$2["value-null-light"],undefinedValue:styles$2["value-undefined-light"],stringValue:styles$2["value-string-light"],booleanValue:styles$2["value-boolean-light"],numberValue:styles$2["value-number-light"],otherValue:styles$2["value-other-light"],punctuation:styles$2["punctuation-light"],collapseIcon:styles$2["collapse-icon-light"],expandIcon:styles$2["expand-icon-light"],collapsedContent:styles$2["collapsed-content-light"],noQuotesForStringValues:!1},allExpanded=()=>!0,JsonView=r=>{let{data:n,style:o=defaultStyles,shouldExpandNode:a=allExpanded,clickToExpandNode:i=!1}=r;return React.createElement("div",{className:o.container},React.createElement(DataRender,{value:n,style:o,lastElement:!0,level:0,shouldExpandNode:a,clickToExpandNode:i}))};function getPathAndTypes(r){const n=[],o={};function a(i,l){lodashEs.forEach(l,(c,u)=>{const d=i?`${i}.${u}`:u,p=lodashEs.isArray(c)?"list":typeof c;n.push(d),o[d]=p==="string"?"text":p==="object"?"model":p,p==="object"&&!lodashEs.isArray(c)&&a(d,c)})}return a("",lodashEs.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:n,pathsType:o}}const ViewData=({data:r,fullView:n})=>{const o=useBuilderProp("onError",lodashEs.noop);if(!r)return null;const a=typeof r;return n?typeof r=="object"?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-3"}),jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:o,children:jsxRuntime.jsxRuntimeExports.jsx(JsonView,{data:r,shouldExpandNode:allExpanded,style:{...defaultStyles,container:"max-h-[40vh] overflow-y-auto text-[12px] leading-[1.5] tracking-wide font-mono",stringValue:"text-orange-600",label:"text-green-900 font-semibold pr-1 tracking-wider"}})})]}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),r]}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:lodashEs.truncate(a==="object"?JSON.stringify(r):r,{length:40})})},DataProvidersSuggester=({type:r,value:n="",setValue:o,data:a,onChange:i,dataType:l,appliedBindings:c})=>{const{paths:u,pathsType:d}=getPathAndTypes(a),p=r==="PROP"?runtime.getBlockComponent(a==null?void 0:a._type):{},f=r==="PROP",[m,h]=React.useState(!1),g=React.useMemo(()=>r==="PROP"?u.filter(y=>!lodashEs.includes(c,y)&&lodashEs.get(p,`props.${lodashEs.first(lodashEs.split(y,"."))}.binding`)):u.filter(y=>l===lodashEs.get(d,y,"")),[r,u,c,l,p]);return React.useEffect(()=>{n&&i(n)},[n,r]),jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:lodashEs.startCase(lodashEs.toLower(r))}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Popover,{open:m,onOpenChange:h,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"outline",size:"sm",className:` ${lodashEs.isEmpty(n)?"w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white":"min-w-[350px] items-center justify-between"}`,children:n?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[f&&jsxRuntime.jsxRuntimeExports.jsx("span",{className:"mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:lodashEs.startCase(l)}),n]}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700",children:"Change"})]}):jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:["+ Set ",lodashEs.startCase(lodashEs.toLower(r))]})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Command,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CommandInput,{placeholder:`Choose ${lodashEs.toLower(r)}...`}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.CommandList,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CommandEmpty,{children:"No results found."}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.CommandGroup,{children:lodashEs.map(g,y=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.CommandItem,{value:y,className:`cursor-pointer ${f?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:b=>{o(lodashEs.find(g,v=>v===b)||null),h(!1)},children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Check,{className:`h-4 w-4 text-green-500 ${n===y?"":"opacity-0"}`}),y]}),f?jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:lodashEs.startCase(lodashEs.get(d,y,""))})}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pl-6",children:jsxRuntime.jsxRuntimeExports.jsx(ViewData,{data:lodashEs.get(a,y)})})]},y))})]})]})})]})]}),!f&&!lodashEs.isEmpty(n)&&jsxRuntime.jsxRuntimeExports.jsx("div",{className:"pt-2",children:jsxRuntime.jsxRuntimeExports.jsx(ViewData,{data:lodashEs.get(a,n,""),fullView:!0})})]})},AddBindingModalContent=({appliedBindings:r=[],onAddBinding:n,editMode:o,item:a})=>{const[i,l]=React.useState(o?a.key:""),[c,u]=React.useState(o?a.value:""),d=useSelectedBlock(),[p]=useChaiExternalData(),f=React.useCallback((g,y)=>{if(lodashEs.isEmpty(g))return"";{const b=lodashEs.get(y==="PROP"?d:p,g,"");if(lodashEs.isArray(b))return"list";const v=typeof b;return v==="string"?"text":v==="object"?"model":v}},[d,p]),[m,h]=React.useState(o?f(a.key,"PROP"):"");return jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DialogHeader,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTitle,{children:"Add Data Binding"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col gap-1",children:[jsxRuntime.jsxRuntimeExports.jsx(DataProvidersSuggester,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:i,setValue:l,onChange:g=>{const y=f(g,"PROP");l(g),m!==y&&u(""),h(y)},data:d,dataType:m,appliedBindings:r}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-2"}),jsxRuntime.jsxRuntimeExports.jsx(DataProvidersSuggester,{type:"PATH",isDisabled:lodashEs.isEmpty(i),placeholder:"Enter data path",value:c,setValue:u,onChange:g=>{const y=f(g,"PATH");u(m===y?g:"")},data:p,dataType:m,appliedBindings:r})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogFooter,{children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{type:"submit",className:"mt-4",disabled:lodashEs.isEmpty(i)&&lodashEs.isEmpty(c),onClick:()=>n({key:i,value:c}),children:"Save"})})]})},AddBindingModal=({disabled:r,children:n,onAddBinding:o,appliedBindings:a,editMode:i=!0,item:l={}})=>{const[c,u]=React.useState(!1);return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Dialog,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTrigger,{disabled:r,asChild:!0,onClick:()=>u(!0),children:n}),c&&jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogContent,{children:jsxRuntime.jsxRuntimeExports.jsx(AddBindingModalContent,{item:l,editMode:i,appliedBindings:a,onAddBinding:d=>{o(d),u(!1)}})})]})},NewDataBindingPair=({item:r,onAddBinding:n,onRemove:o,selectedBlock:a,dataProvider:i,appliedBindings:l})=>{const[c,u]=React.useState("string"),d=(p,f)=>{if(lodashEs.isEmpty(p))return"";{const m=lodashEs.get(f==="PROP"?a:i,p,"");if(lodashEs.isArray(m))return"list";const h=typeof m;return h==="string"?"text":h==="object"?"model":h}};return React.useEffect(()=>u(()=>d(r.key,"PROP")),[r.key]),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col rounded-md border border-border p-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-sm font-normal text-gray-500",children:r.key}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:r.value}),jsxRuntime.jsxRuntimeExports.jsx(ViewData,{data:lodashEs.get(i,r.value,"")}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx(AddBindingModal,{editMode:!0,onAddBinding:n,appliedBindings:l,item:r,children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.EditIcon,{className:"mt-1 h-6 w-6 cursor-pointer rounded border border-blue-400 p-1 text-blue-400 duration-200 hover:scale-105 hover:bg-blue-400 hover:text-white"})}),jsxRuntime.jsxRuntimeExports.jsx(lucideReact.TrashIcon,{onClick:()=>o(),className:"mt-1 h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 duration-200 hover:scale-105 hover:bg-red-400 hover:text-white"})]}),!lodashEs.isEmpty(c)&&!lodashEs.isEmpty(r.key)&&jsxRuntime.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-1 mt-px flex h-4 items-center rounded-full px-2 text-[10px] font-medium text-purple-600",children:lodashEs.startCase(c)})]})},DataBindingSetting=({bindingData:r,onChange:n})=>{const o=useSelectedBlock(),[a]=useChaiExternalData(),i=runtime.getChaiDataProviders(),[l,c]=React.useState(lodashEs.map(r,(m,h)=>({key:h,value:m})));React.useEffect(()=>{c(lodashEs.map(r,(m,h)=>({key:h,value:m})))},[o==null?void 0:o._id,r]);const u=React.useMemo(()=>{if(lodashEs.isEmpty(a))return!0;if(lodashEs.isEmpty(l))return!1;const m=lodashEs.last(l);return lodashEs.isEmpty(m==null?void 0:m.key)||lodashEs.isEmpty(m==null?void 0:m.value)},[a,l]),d=m=>{const h=lodashEs.filter(l,g=>g.key!==m.key);c([...h,m]),f([...h,m])},p=m=>{const h=lodashEs.filter(l,(g,y)=>m!==y);f([...h])},f=React.useCallback((m=[])=>{if(c(m),lodashEs.isEmpty(m)){n({});return}const h={};lodashEs.forEach(m,g=>{!lodashEs.isEmpty(g==null?void 0:g.key)&&!lodashEs.isEmpty(g==null?void 0:g.value)&&lodashEs.set(h,g.key,g.value)}),n(h)},[n]);return lodashEs.isEmpty(i)?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-center",children:jsxRuntime.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 text-xs text-gray-500",children:["You have no data providers registered. Please add a data provider to your project. ",jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[lodashEs.map(l,(m,h)=>jsxRuntime.jsxRuntimeExports.jsx(NewDataBindingPair,{item:m,onAddBinding:d,onRemove:()=>p(h),selectedBlock:o,dataProvider:a,appliedBindings:lodashEs.map(l,"key")},m.key)),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{delayDuration:200,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{disabled:lodashEs.isEmpty(a),className:"w-full",children:jsxRuntime.jsxRuntimeExports.jsx(AddBindingModal,{disabled:u,appliedBindings:lodashEs.map(l,"key"),onAddBinding:d,children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${u?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:lodashEs.isEmpty(a)?jsxRuntime.jsxRuntimeExports.jsx("small",{className:"text-[9.5px] text-gray-500",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),u&&jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:lodashEs.isEmpty(a)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},DataBindingSetting$1=DataBindingSetting,BindingWidget=()=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),getSvgMarkup=r=>{try{const n=document.getElementById("icon-picker-field"),o=document.createElement("div");ReactDOM.render(jsxRuntime.jsxRuntimeExports.jsx(IconPicker.IconPickerItem,{value:r}),o),n.appendChild(o),o.hidden=!0;let a=o.innerHTML;setTimeout(()=>n.removeChild(o),100);const l=new DOMParser().parseFromString(a,"image/svg+xml"),c=l.querySelector("svg");return c&&(c.removeAttribute("width"),c.removeAttribute("height")),new XMLSerializer().serializeToString(l)}catch(n){return console.error(n),""}},IconPickerField=({value:r,onChange:n})=>{const{t:o}=reactI18next.useTranslation(),a=i=>{n("<svg />");const l=getSvgMarkup(i);n(l)};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex h-20 items-center gap-x-2",id:"icon-picker-field",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"group relative h-12 w-12",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:r?r.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"}),jsxRuntime.jsxRuntimeExports.jsx(IconPicker,{value:r?"BiSolidGrid":null,onChange:a,pickButtonStyle:{position:"relative",height:"48px",width:"48px",border:"1px solid #999",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"}})]}),jsxRuntime.jsxRuntimeExports.jsx("textarea",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",value:r,onChange:i=>n(i.target.value),placeholder:o("choose_icon_or_enter_svg"),className:"no-scrollbar disabled:opacity-50; mt-1 flex 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"})]})},UnsplashImages=React.lazy(()=>Promise.resolve().then(()=>require("./UnsplashImages-DRQaQoM-.cjs"))),UploadImages=React.lazy(()=>Promise.resolve().then(()=>require("./UploadImages-CumBJ3oE.cjs"))),ImagesPanel=({isModalView:r=!1,onSelect:n=()=>{}})=>{const o=useBuilderProp("uploadMediaCallback"),a=useBuilderProp("unsplashAccessKey"),i=o===void 0,l=a===void 0,[c,u]=React.useState(l?"upload":i?"unsplash":"upload");return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:jsxRuntime.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:r&&i?"Unsplash images":r?"Select or upload images":"Images"})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tabs,{value:c,onValueChange:d=>u(d),className:"flex h-full w-full flex-col py-2",children:[!(i||l)&&jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.TabsList,{className:"w-full",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"upload",className:"w-full",children:"Upload"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"unsplash",className:"w-full",children:"Unsplash"})]}),c==="unsplash"?jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsContent,{value:"unsplash",className:"flex h-full flex-col overflow-hidden",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:jsxRuntime.jsxRuntimeExports.jsx(UnsplashImages,{isModalView:r,onSelect:n})})}):jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsContent,{value:"upload",className:"flex h-full flex-col overflow-hidden",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-64 w-full animate-pulse bg-gray-100"}),children:jsxRuntime.jsxRuntimeExports.jsx(UploadImages,{isModalView:r,onSelect:n})})})]})]})},ImagesPanel$1=ImagesPanel,ImagePickerModal=({children:r,onSelect:n})=>{const[o,a]=React.useState(!1),i=(...l)=>{n.call(void 0,...l),a(!1)};return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Dialog,{open:o,onOpenChange:l=>a(l),children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTrigger,{asChild:!0,children:r}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogContent,{className:"flex h-3/4 max-w-5xl border-border",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full w-full",children:jsxRuntime.jsxRuntimeExports.jsx(ImagesPanel$1,{isModalView:!0,onSelect:i})})})]})},ImagePickerModal$1=ImagePickerModal,ImagePickerField=({value:r,onChange:n,id:o,onBlur:a})=>{const i=useBuilderProp("uploadMediaCallback"),l=useBuilderProp("unsplashAccessKey"),{t:c}=reactI18next.useTranslation(),u=i===void 0,d=l===void 0;return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-1.5 flex items-center gap-x-3",children:[r?jsxRuntime.jsxRuntimeExports.jsx("img",{src:r,className:"h-20 w-20 overflow-hidden rounded-md border border-border object-cover",alt:""}):jsxRuntime.jsxRuntimeExports.jsx(ImagePickerModal$1,{onSelect:n,children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]"})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex w-3/5 flex-col",children:[!(u&&d)&&jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(ImagePickerModal$1,{onSelect:n,children:jsxRuntime.jsxRuntimeExports.jsx("small",{className:"h-6 cursor-pointer rounded-md bg-primary px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700",children:r||!lodashEs.isEmpty(r)?c("Replace image"):c("Choose image")})}),jsxRuntime.jsxRuntimeExports.jsx("small",{className:"-pl-4 pt-2 text-center text-xs text-gray-600",children:"OR"})]}),jsxRuntime.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",type:"url",className:"text-xs",placeholder:c("enter_image_url"),value:r,onBlur:({target:{value:p}})=>a(o,p),onChange:p=>n(p.target.value)})]})]})},RichTextEditorField=({id:r,placeholder:n,value:o,onChange:a,onBlur:i})=>{const l={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]},{align:[]}],["link","clean"]]},c=["header","font","list","bold","italic","underline","strike","blockquote","color","background","align","link","image"];return typeof window>"u"?null:jsxRuntime.jsxRuntimeExports.jsx(ReactQuill,{id:r,value:o,onBlur:u=>i(r,u),onChange:u=>a(u),modules:l,formats:c,placeholder:n,className:"mt-1 rounded-md"})},LinkField=({schema:r,formData:n,onChange:o})=>{const[a,i]=React.useState([]),l=useBuilderProp("getPages",()=>[]),{type:c="page",href:u="",target:d="self"}=n;return React.useEffect(()=>{(async()=>{const p=await l();i(p||[])})()},[]),jsxRuntime.jsxRuntimeExports.jsxs("div",{children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:(r==null?void 0:r.title)??"Link"}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxRuntimeExports.jsx("select",{name:"type",value:c,onChange:p=>o({...n,type:p.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(p=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:p.const,children:p.title},p.const))}),c==="page"?jsxRuntime.jsxRuntimeExports.jsxs("select",{name:"href",value:u,onChange:p=>o({...n,href:p.target.value||"#"}),children:[jsxRuntime.jsxRuntimeExports.jsx("option",{value:"",children:"Choose page"}),lodashEs.map(a,p=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:p.slug,children:p.name},p.uuid))]}):jsxRuntime.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",name:"href",type:"text",value:u,onChange:p=>o({...n,href:p.target.value||"#"}),placeholder:c==="page"||c==="url"?"Enter URL":c==="scroll"?"#ElementID":"Enter detail"}),(c==="page"||c==="url")&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx("input",{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",type:"checkbox",defaultChecked:d==="_blank",className:"!w-fit cursor-pointer rounded-md border border-border",onChange:()=>o({...n,target:d==="_blank"?"_self":"_blank"})}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"pt-1 text-xs",children:"Open in new tab"})]})]})]})},CodeEditor=({id:r,placeholder:n})=>{const{t:o}=reactI18next.useTranslation(),[,a]=useCodeEditor(),i=useSelectedBlock();if(typeof window>"u")return null;const l=r.replace("root.",""),c=lodashEs.get(i,l,""),u=()=>{const d=i==null?void 0:i._id;a({blockId:d,blockProp:l,placeholder:n,initialCode:lodashEs.get(i,l,c)})};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex flex-col gap-y-1",children:[jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:u,className:"text-pretty w-[90%] max-w-full cursor-default truncate rounded border border-border bg-background p-2 text-left text-[10px]",children:c.trim().length>0?c.substring(0,46):n||"Eg: <script>console.log('Hello, world!');<\/script>"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:u,size:"sm",variant:"outline",className:"w-fit",children:o("Open code editor")})]})},JSONForm=React.memo(({id:r,properties:n,formData:o,onChange:a})=>{const[i,l]=React.useState(o),c={type:"object",properties:{}},u={},{t:d}=reactI18next.useTranslation();Object.keys(n).forEach(f=>{const m=n[f];if(lodashEs.includes(["slot","styles"],m.type))return;const h=f;c.properties[h]=getBlockJSONFromSchemas(m,d),u[h]=getBlockJSONFromUISchemas(m)}),React.useEffect(()=>{l(o)},[r]);const p=web.useThrottledCallback(async({formData:f},m)=>{a({formData:f},m)},[a],1e3);return jsxRuntime.jsxRuntimeExports.jsx(Form,{widgets:{binding:BindingWidget,richtext:RichTextEditorField,icon:IconPickerField,image:ImagePickerField,code:CodeEditor},fields:{link:LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator,uiSchema:u,schema:c,formData:i,onChange:({formData:f},m)=>{m&&(l(f),p({formData:f},m))}})}),CanvasSettings=()=>{const[r,n]=jotai.useAtom(xShowBlocksAtom),o=useSelectedBlock(),[,a]=useSelectedBlockIds(),{t:i}=reactI18next.useTranslation(),l=React.useMemo(()=>(o?JSON.stringify(o):"").includes('"x-show"'),[o]);if(!o||!l)return null;const c=r.includes(o._id);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"py-2 text-xs hover:no-underline",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 border-b border-border bg-background py-2 font-normal text-muted-foreground",children:[o._name||o._type," ",i("visibility settings")]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Switch,{id:"show-on-canvas",checked:c,onCheckedChange:u=>{u?(n(d=>[...d,o._id]),a([o._id])):n(d=>d.filter(p=>p!==o._id))}}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{htmlFor:"show-on-canvas",children:i("Show on canvas")})]})]})};function BlockSettings(){const r=useSelectedBlock(),n=useUpdateBlocksPropsRealtime(),o=useUpdateBlocksProps(),a=runtime.getBlockComponent(r==null?void 0:r._type),i={...r},[l,c]=React.useState(i),u=useBuilderProp("dataBindingSupport",!1),d=({formData:g},y,b)=>{if(y&&(l==null?void 0:l._id)===r._id){const v=y.replace("root.","");o([r._id],{[v]:lodashEs.get(g,v)},b)}},p=React.useCallback(lodashEs.debounce(({formData:g},y,b)=>{d({formData:g},y,b),c(g)},1500),[r==null?void 0:r._id]),f=({formData:g},y)=>{if(y){const b=y.replace("root.","");n([r._id],convertDotNotationToObject(b,lodashEs.get(g,b.split(".")))),p({formData:g},y,{[b]:lodashEs.get(l,b)})}},m=lodashEs.keys(lodashEs.get(i,"_bindings",{})),h=React.useMemo(()=>{const g=lodashEs.cloneDeep(lodashEs.get(a,"props",{}));return u&&lodashEs.each(m,y=>delete g[y]),g},[a,m,u]);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden px-px",children:[u?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:"BINDING",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${lodashEs.isEmpty(lodashEs.get(r,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionContent,{className:"px-4 pt-4",children:jsxRuntime.jsxRuntimeExports.jsx(DataBindingSetting$1,{bindingData:lodashEs.get(r,"_bindings",{}),onChange:g=>{d({formData:{_bindings:g}},"root._bindings")}})})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:"STATIC",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionContent,{className:"pt-4",children:[lodashEs.isEmpty(m)?null:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mx-4 mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500",children:["Data binding is set for ",jsxRuntime.jsxRuntimeExports.jsx("b",{children:lodashEs.map(m,lodashEs.capitalize).join(", ")})," ",m.length===1?"property":"properties",". Remove data binding to edit static content."]}),jsxRuntime.jsxRuntimeExports.jsx(JSONForm,{id:r==null?void 0:r._id,onChange:f,formData:i,properties:h})]})]})]}):jsxRuntime.jsxRuntimeExports.jsx(JSONForm,{id:r==null?void 0:r._id,onChange:f,formData:i,properties:h}),jsxRuntime.jsxRuntimeExports.jsx(CanvasSettings,{})]})}function getChildBlocks(r,n,o){o.push(lodashEs.find(r,{_id:n}));const a=lodashEs.filter(r,{_parent:n});for(const i of a)o.push(...getBlockWithChildren(i._id,r));return o}const getBlockWithChildren=(r,n)=>{let o=[];return o=lodashEs.flattenDeep([...o,...getChildBlocks(n,r,o)]),o},askAiProcessingAtom=jotai.atom(!1),useAskAi=()=>{const[r,n]=jotai.useAtom(askAiProcessingAtom),[o,a]=React.useState(null),i=useBuilderProp("askAiCallBack",null),l=useStreamMultipleBlocksProps(),c=useUpdateMultipleBlocksProps(),[u]=useBlocksStore();return{askAi:React.useCallback(async(d,p,f,m)=>{if(i){n(!0),a(null);try{const h=d==="content"?lodashEs.cloneDeep(getBlockWithChildren(p,u)):[lodashEs.cloneDeep(u.find(v=>v._id===p))];lodashEs.set(h,"0._parent",null);const g=await i(d,f,h),{blocks:y,error:b}=g;if(b){a(b);return}d==="styles"?c(y):l(y),m&&m(g)}catch(h){a(h)}finally{n(!1),m&&m()}}},[i,n,u,c,l]),loading:r,error:o}};function FaMoon(r){return iconBase.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"},child:[]}]})(r)}function FaRecycle(r){return iconBase.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"},child:[]}]})(r)}function FaSpinner(r){return iconBase.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"},child:[]}]})(r)}const SECONDS=10;function Countdown(){const[r,n]=React.useState(SECONDS),[o,a]=React.useState(!1);React.useEffect(()=>{if(o&&r>0){const d=setTimeout(()=>{n(r-.1)},100);return()=>clearTimeout(d)}else r<=0&&(a(!1),n(SECONDS))},[o,r]);const i=()=>{a(!0),n(SECONDS)};React.useEffect(()=>{r===SECONDS&&i()},[r]);const l=18,c=2*Math.PI*l,u=c*(1-(SECONDS-r)/SECONDS);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative h-4 w-4",children:[jsxRuntime.jsxRuntimeExports.jsxs("svg",{className:"h-full w-full",viewBox:"0 0 40 40",children:[jsxRuntime.jsxRuntimeExports.jsx("circle",{className:"text-gray-300",strokeWidth:"4",stroke:"currentColor",fill:"transparent",r:l,cx:"20",cy:"20"}),jsxRuntime.jsxRuntimeExports.jsx("circle",{className:"text-blue-600",strokeWidth:"4",strokeDasharray:c,strokeDashoffset:u,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:l,cx:"20",cy:"20"})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"text-xs font-semibold",children:" "})})]})}const AskAIStyles=({blockId:r})=>{const{t:n}=reactI18next.useTranslation(),{askAi:o,loading:a,error:i}=useAskAi(),[l,c]=React.useState(""),u=React.useRef(null),d=React.useRef(null),[p,f]=React.useState();React.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const m=h=>{const{usage:g}=h||{};!i&&g&&f(g),d.current=setTimeout(()=>f(void 0),1e4),i||c("")};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"",children:[jsxRuntime.jsxRuntimeExports.jsx("h2",{className:"mb-1 text-sm font-semibold leading-none tracking-tight",children:n("ask_ai")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{ref:u,value:l,onChange:h=>c(h.target.value),placeholder:n("ask_ai_to_edit_styles"),className:"w-full border border-border focus:border-0",rows:3,onKeyDown:h=>{h.key==="Enter"&&(h.preventDefault(),d.current&&clearTimeout(d.current),f(void 0),o("styles",r,l,m))}}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:l.trim().length<5||a,onClick:()=>{d.current&&clearTimeout(d.current),f(void 0),o("styles",r,l,m)},variant:"default",className:"w-fit",size:"sm",children:a?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"h-5 w-5 animate-spin"}),n("generating_please_wait")]}):n("edit_with_ai")}),a?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Skeleton,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[jsxRuntime.jsxRuntimeExports.jsx(FaSpinner,{className:"h-4 w-4 animate-spin text-gray-500"}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs",children:n("generating_please_wait")})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:n("stop")})]}):null]}),p?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:jsxRuntime.jsxRuntimeExports.jsxs("p",{className:"mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500",children:[jsxRuntime.jsxRuntimeExports.jsxs("span",{children:[n("Total tokens used"),": ",p.totalTokens]}),jsxRuntime.jsxRuntimeExports.jsx(Countdown,{})]})}):null,jsxRuntime.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:i&&jsxRuntime.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:i.message})})]})},fuse=new Fuse(ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function ManualClasses(){var R;const{t:r}=reactI18next.useTranslation(),[n]=useSelectedStylingBlocks(),o=useSelectedBlock(),a=useAddClassesToBlocks(),i=useRemoveClassesFromBlocks(),[l]=useSelectedBlockIds(),c=useBuilderProp("askAiCallBack",null),[u,d]=React.useState(""),{toast:p}=contextMenu.useToast(),f=(R=lodashEs.first(n))==null?void 0:R.prop,m=lodashEs.reject((lodashEs.get(o,f,"").replace(STRINGS.STYLES_KEY,"").split(",").pop()||"").split(" "),lodashEs.isEmpty),h=()=>{const A=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");a(l,A,!0),d("")},[g,y]=React.useState([]),b=({value:A})=>{const C=A.trim().toLowerCase(),k=C.match(/.+:/g);let j=[];if(k&&k.length>0){const[I]=k,P=C.replace(I,"");j=fuse.search(P).map(B=>({...B,item:{...B.item,name:I+B.item.name}}))}else j=fuse.search(C);return y(lodashEs.map(j,"item"))},v=()=>{y([])},x=A=>A.name,E=A=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:A.name}),S={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:r("enter_classes_separated_by_space"),value:u,onKeyDown:A=>{A.key==="Enter"&&u.trim()!==""&&h()},onChange:(A,{newValue:C})=>d(C),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"},w=()=>{if(navigator.clipboard===void 0){p({title:r("clipboard_not_supported"),description:r("please_use_chrome_firefox_or_safari"),variant:"destructive"});return}navigator.clipboard.writeText(m.join(" ")),p({title:r("copied"),description:r("classes_copied_to_clipboard")})};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:`flex ${g.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:r("classes")}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CopyIcon,{onClick:w,className:"cursor-pointer"})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:r("copy_classes_to_clipboard")})})]})]}),c?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Popover,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{variant:"default",className:"h-6 w-fit",size:"sm",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.SparklesIcon,{className:"h-4 w-4"}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"ml-2",children:r("Ask AI")})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverContent,{side:"left",className:"p-2",children:jsxRuntime.jsxRuntimeExports.jsx(AskAIStyles,{blockId:o==null?void 0:o._id})})]}):null]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex items-center gap-x-3",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:jsxRuntime.jsxRuntimeExports.jsx(Autosuggest,{suggestions:g,onSuggestionsFetchRequested:b,onSuggestionsClearRequested:v,getSuggestionValue:x,renderSuggestion:E,inputProps:S,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-border"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"!bg-gray-300 dark:!bg-gray-800 cursor-pointer",suggestionsContainerOpen:"absolute bg-background no-scrollbar z-50 max-h-[230px] overflow-y-auto w-full border border-border rounded-md"}})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"outline",className:"h-6 border-border",onClick:h,disabled:u.trim()==="",size:"sm",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.PlusIcon,{})})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-wrap gap-2 overflow-x-hidden",children:React__namespace.Children.toArray(m.map(A=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",children:[A,jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Cross2Icon,{onClick:()=>i(l,[A]),className:"invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},A)))})]})}const BASIC_UNITS=["px","%","em","rem","ch","vh","vw"],FLEX_CHILD_SECTION={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:BASIC_UNITS,property:"flexBasis"},{type:"range",label:"flex.order",property:"order"},{type:"dropdown",label:"flex.flex",property:"flexGrowShrink"},{type:"dropdown",label:"flex.grow",property:"flexGrow"},{type:"dropdown",label:"flex.shrink",property:"flexShrink"}]},GRID_CHILD_SECTION={heading:"grid.heading",items:[{type:"range",label:"grid.col_span",property:"gridColSpan"},{type:"range",label:"grid.col_start",property:"gridColStart"},{type:"range",label:"grid.col_end",property:"gridColEnd"},{type:"range",label:"grid.row_span",property:"gridRowSpan"},{type:"range",label:"grid.row_start",property:"gridRowStart"},{type:"range",label:"grid.row_end",property:"gridRowEnd"},{type:"range",label:"grid.order",property:"order"}]},SETTINGS_SECTIONS=[{heading:"Styles",items:[{component:ManualClasses},{type:"arbitrary",label:"layout.width",units:BASIC_UNITS.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:BASIC_UNITS.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...BASIC_UNITS,"auto"],options:[{key:"margin",label:"layout.margin_all"},{key:"marginX",label:"layout.margin_lr"},{key:"marginY",label:"layout.margin_tb"},{key:"marginTop",label:"layout.margin_top"},{key:"marginRight",label:"layout.margin_right"},{key:"marginBottom",label:"layout.margin_bottom"},{key:"marginLeft",label:"layout.margin_left"}]},{styleType:"multiple",label:"layout.padding",options:[{key:"padding",label:"layout.padding_all"},{key:"paddingX",label:"layout.padding_lr"},{key:"paddingY",label:"layout.padding_tb"},{key:"paddingTop",label:"layout.padding_top"},{key:"paddingRight",label:"layout.padding_right"},{key:"paddingBottom",label:"layout.padding_bottom"},{key:"paddingLeft",label:"layout.padding_left"}]},{styleType:"accordion",heading:"Typography",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:BASIC_UNITS},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:BASIC_UNITS.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"}]},{styleType:"accordion",heading:"Background",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{type:"dropdown",label:"background.attachment",property:"backgroundAttachment"},{type:"dropdown",label:"background.clipping",property:"backgroundClip"},{type:"dropdown",label:"background.origin",property:"backgroundOrigin"},{type:"dropdown",label:"background.position",property:"backgroundPosition"},{type:"dropdown",label:"background.repeat",property:"backgroundRepeat"},{type:"dropdown",label:"background.size",property:"backgroundSize"}]}]}];BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("auto"),[...BASIC_UNITS],BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("auto"),BASIC_UNITS.concat("-");const EDITOR_ICONS={"not-italic":()=>jsxRuntime.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:reactIcons.EyeOpenIcon,invisible:reactIcons.EyeClosedIcon,hidden:reactIcons.EyeClosedIcon,gap:reactIcons.BorderAllIcon,gapX:reactIcons.WidthIcon,gapY:reactIcons.HeightIcon,spaceX:reactIcons.WidthIcon,spaceY:reactIcons.HeightIcon,overscroll:reactIcons.BorderAllIcon,overscrollX:reactIcons.WidthIcon,overscrollY:reactIcons.HeightIcon,overflow:reactIcons.BorderAllIcon,overflowX:reactIcons.WidthIcon,overflowY:reactIcons.HeightIcon,top:reactIcons.ArrowUpIcon,right:reactIcons.ArrowRightIcon,bottom:reactIcons.ArrowDownIcon,left:reactIcons.ArrowLeftIcon,inset:reactIcons.BorderAllIcon,insetX:reactIcons.WidthIcon,insetY:reactIcons.HeightIcon,border:reactIcons.BorderAllIcon,borderX:reactIcons.WidthIcon,borderY:reactIcons.HeightIcon,borderTop:reactIcons.ArrowUpIcon,borderRight:reactIcons.ArrowRightIcon,borderBottom:reactIcons.ArrowDownIcon,borderLeft:reactIcons.ArrowLeftIcon,borderRadius:reactIcons.BorderAllIcon,borderRadiusX:reactIcons.WidthIcon,borderRadiusY:reactIcons.HeightIcon,borderRadiusTop:reactIcons.ArrowUpIcon,borderRadiusRight:reactIcons.ArrowRightIcon,borderRadiusBottom:reactIcons.ArrowDownIcon,borderRadiusLeft:reactIcons.ArrowLeftIcon,borderRadiusTopLeft:reactIcons.ArrowTopLeftIcon,borderRadiusTopRight:reactIcons.ArrowTopRightIcon,borderRadiusBottomRight:reactIcons.ArrowBottomRightIcon,borderRadiusBottomLeft:reactIcons.ArrowBottomLeftIcon,divideXWidth:reactIcons.WidthIcon,divideYWidth:reactIcons.HeightIcon,scale:reactIcons.BorderAllIcon,scaleX:reactIcons.WidthIcon,scaleY:reactIcons.HeightIcon,skewX:reactIcons.WidthIcon,skewY:reactIcons.HeightIcon,translateX:reactIcons.WidthIcon,translateY:reactIcons.HeightIcon,padding:reactIcons.BorderAllIcon,paddingX:reactIcons.WidthIcon,paddingY:reactIcons.HeightIcon,paddingTop:reactIcons.ArrowUpIcon,paddingRight:reactIcons.ArrowRightIcon,paddingBottom:reactIcons.ArrowDownIcon,paddingLeft:reactIcons.ArrowLeftIcon,margin:reactIcons.BorderAllIcon,marginX:reactIcons.WidthIcon,marginY:reactIcons.HeightIcon,marginTop:reactIcons.ArrowUpIcon,marginRight:reactIcons.ArrowRightIcon,marginBottom:reactIcons.ArrowDownIcon,marginLeft:reactIcons.ArrowLeftIcon,textLeft:reactIcons.AlignLeftIcon,textCenter:reactIcons.AlignCenterHorizontallyIcon,textRight:reactIcons.AlignRightIcon,textJustify:reactIcons.StretchHorizontallyIcon,italic:reactIcons.FontItalicIcon,underline:reactIcons.UnderlineIcon,overline:reactIcons.OverlineIcon,uppercase:reactIcons.LetterCaseUppercaseIcon,block:()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":reactIcons.Cross2Icon,fixed:()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>jsxRuntime.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>jsxRuntime.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),jsxRuntime.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:reactIcons.Cross1Icon},StyleContext=React.createContext({canReset:!1,canChange:!0}),BlockStyleProvider=({children:r,canReset:n=!1,canChange:o=!0})=>jsxRuntime.jsxRuntimeExports.jsx(StyleContext.Provider,{value:{canReset:n,canChange:o},children:r}),DropDownChoices=({label:r,property:n,onChange:o})=>{const a=React.useMemo(()=>lodashEs.get(CLASSES_LIST,`${n}.classes`,[""]),[n]),i=useCurrentClassByProperty(n),l=React.useMemo(()=>lodashEs.get(i,"cls",""),[i]),{canChange:c}=React.useContext(StyleContext),u=/\[.*\]/g.test(l);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:r?"w-full rounded":"grow",children:u?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:l}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{delayDuration:100,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InfoCircledIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):jsxRuntime.jsxRuntimeExports.jsx(DropDown,{rounded:r,onChange:d=>o(d,n),selected:l,options:a,disabled:!c})})};function DropDown({selected:r,onChange:n,rounded:o=!1,options:a,disabled:i=!1}){const l=r.replace(/.*:/g,"").trim(),{undo:c,redo:u}=useUndoManager();return jsxRuntime.jsxRuntimeExports.jsxs("select",{disabled:!a.length||i,className:`${o?"rounded-md border border-border":"border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:d=>n(d.target.value),onKeyDown:d=>{d.ctrlKey&&(d.key==="z"&&c(),d.key==="y"&&u())},value:l,children:[jsxRuntime.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),React.Children.toArray(a.map(d=>jsxRuntime.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:d,children:d})))]})}const RangeChoices=({property:r,onChange:n})=>{const{canReset:o,canChange:a}=React.useContext(StyleContext),i=useCurrentClassByProperty(r),l=React.useMemo(()=>lodashEs.get(i,"cls",""),[i]),c=React.useMemo(()=>lodashEs.get(CLASSES_LIST,`${r}.classes`,[""]),[r]),u=c.indexOf(l)>-1?c.indexOf(l):0,d=/\[.*\]/g.test(l);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:d?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:l}):jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!a&&(!o||u-1<0),onClick:()=>n(lodashEs.nth(c,u-1),r),children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.MinusIcon,{className:!a&&(!o||u-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:jsxRuntime.jsxRuntimeExports.jsx(DropDownChoices,{label:!1,property:r,onChange:n})}),jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!a&&(!o||u+1>=c.length),onClick:()=>n(lodashEs.nth(c,u+1),r),children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.PlusIcon,{className:!a&&(!o||u+1>=c.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},IconChoices=({property:r,onChange:n})=>{const o=React.useMemo(()=>lodashEs.get(CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:a}=React.useContext(StyleContext),i=useCurrentClassByProperty(r),l=React.useMemo(()=>lodashEs.get(i,"cls",""),[i]);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:lodashEs.map(o,c=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",disabled:!a,onClick:()=>n(c,r),className:`cursor-pointer rounded border border-border p-1 disabled:cursor-not-allowed ${l===c?"bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:React.createElement(lodashEs.get(EDITOR_ICONS,c,reactIcons.BoxIcon))})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:lodashEs.startCase(lodashEs.toLower(c))})]}))})},COLOR_PROP={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},ColorChoice=({property:r,onChange:n})=>{const o=useCurrentClassByProperty(r),a=React.useMemo(()=>lodashEs.get(o,"cls",""),[o]),{canChange:i}=React.useContext(StyleContext),[l,c]=React.useState([]),[u,d]=React.useState({color:"",shade:""}),p=a.split("-"),f=lodashEs.get(p,"1",""),m=lodashEs.get(p,"2",""),h=React.useCallback(y=>{["current","inherit","transparent","black","white"].includes(y)?(c([]),d({color:y})):(c(["50","100","200","300","400","500","600","700","800","900"]),d(b=>({...b,color:y,shade:b.shade?b.shade:"500"})))},[c,d]);React.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(f))return c([]);c(["50","100","200","300","400","500","600","700","800","900"])},[f]);const g=React.useCallback(y=>{d({color:f,shade:y})},[f]);return React.useEffect(()=>{d({color:"",shade:""})},[o]),React.useEffect(()=>{const b=`${lodashEs.get(COLOR_PROP,r,"")}-${u.color}${u.shade?`-${u.shade}`:""}`;b.match(new RegExp(lodashEs.get(CLASSES_LIST,`${r}.regExp`,"")))&&n(b,r)},[u,n,r]),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:jsxRuntime.jsxRuntimeExports.jsx(DropDown,{disabled:!i,rounded:!0,selected:f,onChange:h,options:["current","transparent","primary","secondary","black","white","slate","gray","zinc","neutral","stone","red","orange","amber","yellow","lime","green","emerald","teal","cyan","sky","blue","indigo","violet","purple","fuchsia","pink","rose"]})}),jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:jsxRuntime.jsxRuntimeExports.jsx(DropDown,{rounded:!0,selected:m,disabled:!f||!i,onChange:g,options:l})})]})},getUserInputValues=(r,n)=>{r=r.toLowerCase();let o=r.trim().replace(/ |\+/g,"");if((o==="auto"||o==="none")&&n.includes(o))return{value:"",unit:o};const a=n.length?new RegExp(n.join("|"),"g"):/XXXXXX/g;o=o.replace(a,"");const i=r.match(a),l=i&&i.length>1,c=!lodashEs.isEmpty(o)&&Number.isNaN(Number(o));return l||c?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:o,unit:i?i[0]:""}},getTwClassValue=r=>{const n=r.startsWith("-")?"-":"",o=r.split("-").pop();if(["auto","none"].includes(o))return{value:"",unit:o};if(o==="px")return{value:"1",unit:"px"};if(o==="screen")return{value:"100",unit:r.indexOf("w-")!==-1?"vw":"vh"};if(o==="full")return{value:"100",unit:"%"};if(lodashEs.includes(r,"skew-"))return{value:`${n}${o}`,unit:"deg"};if(lodashEs.includes(r,"rotate-"))return{value:`${n}${o}`,unit:"deg"};if(lodashEs.includes(r,"opacity-"))return{value:`${o/100}`,unit:"-"};if(lodashEs.includes(r,"duration-")||lodashEs.includes(r,"delay-"))return{value:`${o}`,unit:"ms"};if(lodashEs.includes(r,"translate-")&&!o.includes("/"))return{value:`${n}${`${o/4}`}`,unit:"rem"};if(lodashEs.includes(r,"scale-"))return{value:`${n}${`${o/100}`}`,unit:"-"};if(lodashEs.startsWith(r,"border")){const a=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(a)return{value:a[0].split("-").pop(),unit:"px"};if(r.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(lodashEs.startsWith(r,"max-w-")){if(r==="max-w-screen-sm")return{value:"640",unit:"px"};if(r==="max-w-screen-md")return{value:"768",unit:"px"};if(r==="max-w-screen-lg")return{value:"1024",unit:"px"};if(r==="max-w-screen-xl")return{value:"1280",unit:"px"};if(r==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(o==="xs")return{value:"320",unit:"px"};if(o==="sm")return{value:"384",unit:"px"};if(o==="md")return{value:"448",unit:"px"};if(o==="lg")return{value:"512",unit:"px"};if(o==="xl")return{value:"576",unit:"px"};if(o==="2xl")return{value:"672",unit:"px"};if(o==="3xl")return{value:"768",unit:"px"};if(o==="4xl")return{value:"896",unit:"px"};if(o==="5xl")return{value:"1024",unit:"px"};if(o==="6xl")return{value:"1152",unit:"px"};if(o==="7xl")return{value:"1280",unit:"px"};if(o==="prose")return{value:"65",unit:"ch"}}if(lodashEs.startsWith(r,"text-")){if(o==="xs")return{value:"12",unit:"px"};if(o==="sm")return{value:"14",unit:"px"};if(o==="base")return{value:"16",unit:"px"};if(o==="lg")return{value:"18",unit:"px"};if(o==="xl")return{value:"20",unit:"px"};if(o==="2xl")return{value:"24",unit:"px"};if(o==="3xl")return{value:"30",unit:"px"};if(o==="4xl")return{value:"36",unit:"px"};if(o==="5xl")return{value:"48",unit:"px"};if(o==="6xl")return{value:"60",unit:"px"};if(o==="7xl")return{value:"72",unit:"px"};if(o==="8xl")return{value:"96",unit:"px"};if(o==="9xl")return{value:"128",unit:"px"}}if(lodashEs.startsWith(r,"leading-")){if(o==="none")return{value:"1",unit:"-"};if(o==="tight")return{value:"1.25",unit:"-"};if(o==="snug")return{value:"1.375",unit:"-"};if(o==="normal")return{value:"1.5",unit:"-"};if(o==="relaxed")return{value:"1.625",unit:"-"};if(o==="loose")return{value:"2",unit:"-"}}if(lodashEs.startsWith(r,"tracking-")){if(o==="tighter")return{value:"-0.05",unit:"em"};if(o==="tight")return{value:"-0.025",unit:"em"};if(o==="normal")return{value:"0",unit:"em"};if(o==="wide")return{value:"0.025",unit:"em"};if(o==="wider")return{value:"0.05",unit:"em"};if(o==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(o))return{value:r,unit:"class"};if(o.includes("/")){const[a,i]=lodashEs.map(o.split("/"),l=>parseInt(l,10));return{value:n+(a/i*100).toFixed(2).replace(".00",""),unit:"%"}}return lodashEs.isNumber(parseFloat(o))?{value:`${n+parseFloat(o)*4}`,unit:"px"}:{value:o,unit:"class"}},getClassValueAndUnit=r=>{if(lodashEs.isEmpty(r))return{value:"",unit:""};const n=r.match(/\[.*\]/g);if(n===null)return getValueAndUnitForTWClass(r);const o=lodashEs.get(n,"0","").replace(/\[|\]/g,""),a=r.startsWith("-")?"-":"",i=lodashEs.first(o.match(/\d+.\d+|\d+/g));return{value:`${a}${i}`,unit:o.replace(i,"")}},getValueAndUnitForTWClass=r=>lodashEs.isEmpty(r)?{value:"",unit:""}:getTwClassValue(r),BlockSettingsContext=React.createContext({setDragData:()=>{}}),DragStyleButton=({unit:r,currentValue:n,onDrag:o,onDragEnd:a,onDragStart:i,negative:l,cssProperty:c})=>{const{setDragData:u}=React.useContext(BlockSettingsContext);return jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:d=>{const p={onDrag:o,onDragEnd:a,dragging:!0,dragStartY:d.pageY,dragStartValue:`${n}`,dragUnit:r,negative:l,cssProperty:c};i(p),u(p)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowSpacingIcon,{})})},UnitSelection=({onSelect:r,current:n,units:o})=>jsxRuntime.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:o.map(a=>jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:n===a?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),r(a)},children:a},a))}),THROTTLE_TIME=50,AdvanceChoices=r=>{const[n,o]=React.useState(!1),[a,i]=React.useState(""),{currentClass:l,onChange:c,classPrefix:u,cssProperty:d,units:p,negative:f}=r,[m,h]=React.useState(d!=null&&d.toLowerCase().includes("width")?"%":p[0]),[g,y]=React.useState(!1),[b,v]=React.useState(""),[x,E]=React.useState(!1),[S,w]=React.useState(!1);React.useEffect(()=>{const{value:j,unit:I}=getClassValueAndUnit(l);if(I===""){i(j),h(d!=null&&d.toLowerCase().includes("width")?"%":lodashEs.first(p));return}h(I),i(I==="class"||lodashEs.isEmpty(j)?"":j)},[l,d,p]);const R=web.useThrottledCallback(j=>c(j),[c],THROTTLE_TIME),A=web.useThrottledCallback(j=>c(j,!1),[c],THROTTLE_TIME),C=React.useCallback((j=!1)=>{const I=getUserInputValues(`${a}`,p);if(lodashEs.get(I,"error",!1)){y(!0);return}const P=lodashEs.get(I,"unit")!==""?lodashEs.get(I,"unit"):m;if(P==="auto"||P==="none"){R(`${u}${P}`);return}if(lodashEs.get(I,"value")==="")return;const B=`${lodashEs.get(I,"value","").startsWith("-")?"-":""}${u}[${lodashEs.get(I,"value","").replace("-","")}${P==="-"?"":P}]`;j?A(B):R(B)},[R,A,a,m,u,p]),k=React.useCallback(j=>{const I=getUserInputValues(`${a}`,p);if(lodashEs.get(I,"error",!1)){y(!0);return}if(j==="auto"||j==="none"){R(`${u}${j}`);return}if(lodashEs.get(I,"value")==="")return;const P=lodashEs.get(I,"unit")!==""?lodashEs.get(I,"unit"):j,B=`${lodashEs.get(I,"value","").startsWith("-")?"-":""}${u}[${lodashEs.get(I,"value","").replace("-","")}${P==="-"?"":P}]`;R(B)},[R,a,u,p]);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:m==="class"?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:l}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InfoCircledIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${x?"z-auto":""}`,children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(m)!==-1?null:jsxRuntime.jsxRuntimeExports.jsx("input",{readOnly:m==="class",onKeyPress:j=>{j.key==="Enter"&&C()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),w(!0);const I=lodashEs.parseInt(j.target.value);let P=lodashEs.isNaN(I)?0:I;j.keyCode===38&&(P+=1),j.keyCode===40&&(P-=1);const O=`${P}`,N=`${O.startsWith("-")?"-":""}${u}[${O.replace("-","")}${m==="-"?"":m}]`;A(N)},onKeyUp:j=>{S&&(j.preventDefault(),w(!1))},onBlur:()=>C(),onChange:j=>{y(!1),i(j.target.value)},onClick:j=>{var I;(I=j==null?void 0:j.target)==null||I.select(),o(!1)},value:x?b:a,className:"h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(" ",g?"border-red-500 text-red-500":"border-foreground/20")}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{open:n,delayDuration:100,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>o(!n),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:`inline-block ${p.length===1?"px-2 font-semibold":""}`,children:m}),p.length>1?jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TriangleDownIcon,{}):null]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipPortal,{children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{className:"bg-background",children:jsxRuntime.jsxRuntimeExports.jsx(UnitSelection,{units:p,current:m,onSelect:j=>{o(!1),h(j),k(j)}})})})]})]}),["none","auto"].indexOf(m)!==-1||x?null:jsxRuntime.jsxRuntimeExports.jsx(DragStyleButton,{onDragStart:()=>E(!0),onDragEnd:j=>{if(v(()=>""),E(!1),lodashEs.isEmpty(j))return;const I=`${j}`,O=`${I.startsWith("-")?"-":""}${u}[${I.replace("-","")}${m==="-"?"":m}]`;R(O)},onDrag:j=>{if(lodashEs.isEmpty(j))return;v(j);const I=`${j}`,O=`${I.startsWith("-")?"-":""}${u}[${I.replace("-","")}${m==="-"?"":m}]`;A(O)},currentValue:a,unit:m,negative:f,cssProperty:d})]})})})},useCurrentClassByProperty=r=>{const n=useSelectedBlockCurrentClasses();return lodashEs.findLast(n,{property:r})},canChangeClass=(r,n)=>{const o={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return o[lodashEs.get(r,"mq","xs")]<=o[n]},CLASS_PREFIXES={width:"w-",height:"h-",minWidth:"min-w-",minHeight:"min-h-",maxWidth:"max-w-",maxHeight:"max-h-",zIndex:"z-",gap:"gap-",gapX:"gap-x-",gapY:"gap-y-",margin:"m-",marginX:"mx-",marginY:"my-",marginTop:"mt-",marginBottom:"mb-",marginLeft:"ml-",marginRight:"mr-",padding:"p-",paddingX:"px-",paddingY:"py-",paddingTop:"pt-",paddingBottom:"pb-",paddingLeft:"pl-",paddingRight:"pr-",spaceX:"space-x-",spaceY:"space-y-",border:"border-",borderTop:"border-t-",borderBottom:"border-b-",borderLeft:"border-l-",borderRight:"border-r-",borderX:"border-x-",borderY:"border-y-",borderRadius:"rounded-",borderRadiusTop:"rounded-t-",borderRadiusRight:"rounded-r-",borderRadiusBottom:"rounded-b-",borderRadiusLeft:"rounded-l-",borderRadiusTopLeft:"rounded-tl-",borderRadiusTopRight:"rounded-tr-",borderRadiusBottomRight:"rounded-br-",borderRadiusBottomLeft:"rounded-bl-",fontSize:"text-",lineHeight:"leading-",letterSpacing:"tracking-",textIndent:"indent-",rotate:"rotate-",duration:"duration-",transitionDelay:"delay-",scale:"scale-",scaleX:"scale-x-",scaleY:"scale-y-",translateX:"translate-x-",translateY:"translate-y-",skewX:"skew-x-",skewY:"skew-y-",top:"top-",bottom:"bottom-",left:"left-",right:"right-",inset:"inset-",insetX:"inset-x-",insetY:"inset-y-",opacity:"opacity-",flexBasis:"basis-"},BREAKPOINTS={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},getBreakpoint=r=>`${r.toUpperCase()} ${BREAKPOINTS[r]?`(${BREAKPOINTS[r]} & up)`:""}`,BlockStyle=r=>{const{t:n}=reactI18next.useTranslation(),{type:o="icons",label:a,property:i,onEmitChange:l=()=>{},units:c,negative:u=!1}=r,[d]=useDarkMode(),[p]=useStylingState(),[,f]=useCanvasWidth(),m=useCurrentClassByProperty(i),h=useAddClassesToBlocks(),g=useRemoveClassesFromBlocks(),[y]=useSelectedBlockIds(),b=React.useMemo(()=>lodashEs.get(m,"fullCls",""),[m]),v=React.useCallback((A,C=!0)=>{const k={dark:d,mq:f,mod:p,cls:A,property:i,fullCls:""};(d||p!=="")&&(k.mq="xs");const j=generateFullClsName(k);h(y,[j],C)},[y,d,f,p,i,h]),x=React.useCallback(()=>{g(y,[b])},[y,b,g]),E=React.useMemo(()=>canChangeClass(m,f),[m,f]);React.useEffect(()=>{l(E,m)},[E,l,m]);const[,,S]=useCanvasWidth(),w=React.useCallback(A=>{S({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[A])},[S]),R=lodashEs.get(m,"dark",null)===d&&lodashEs.get(m,"mod",null)===p&&lodashEs.get(m,"mq",null)===f;return jsxRuntime.jsxRuntimeExports.jsx(BlockStyleProvider,{canChange:E,canReset:m&&R,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${m&&!R?"text-foreground":""}`,children:n(a)})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[o==="arbitrary"?jsxRuntime.jsxRuntimeExports.jsx(AdvanceChoices,{currentClass:lodashEs.get(m,"cls",""),classPrefix:lodashEs.get(CLASS_PREFIXES,i,""),units:c||[],onChange:v,negative:u,cssProperty:i}):null,o==="icons"&&jsxRuntime.jsxRuntimeExports.jsx(IconChoices,{property:i,onChange:v}),o==="range"&&jsxRuntime.jsxRuntimeExports.jsx(RangeChoices,{property:i,onChange:v}),o==="color"&&jsxRuntime.jsxRuntimeExports.jsx(ColorChoice,{property:i,onChange:v}),o==="dropdown"&&jsxRuntime.jsxRuntimeExports.jsx(DropDownChoices,{label:a,property:i,onChange:v})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${b?"visible":"invisible"}`,children:R?jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>x(),title:"Reset",className:"flex px-1.5 text-xs",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):E&&m?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{delayDuration:100,children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InfoCircledIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-right",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{children:["Current style is set at  ",jsxRuntime.jsxRuntimeExports.jsxs("span",{className:"font-bold",children:[getBreakpoint(lodashEs.get(m,"mq")),d&&!m.dark?"(Light mode)":""]}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>w(lodashEs.get(m,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",lodashEs.get(m,"mq").toUpperCase()]})]})})})]}):null})]})]})})},basicUnits=["px","%","em","rem","ch","vh","vw"],MultipleChoices=({label:r,options:n,borderB:o=!1,borderT:a=!1,type:i="arbitrary",units:l=basicUnits,negative:c=!1})=>{const{t:u}=reactI18next.useTranslation(),[d,p]=React.useState(n[0].key),f=useSelectedBlockCurrentClasses(),m=React.useCallback(h=>lodashEs.map(f,"property").includes(h),[f]);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-border py-2 first:pt-0 last:pb-0 ${o?"border-b":""} ${a?"border-t":""}`,children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[r&&jsxRuntime.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:u(r)}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:React.Children.toArray(n.map(({label:h,key:g})=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>p(g),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${g===d?"bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[React.createElement("div",{className:m(g)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),React.createElement(lodashEs.get(EDITOR_ICONS,g,reactIcons.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:lodashEs.startCase(lodashEs.toLower(h))})]})})))})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:jsxRuntime.jsxRuntimeExports.jsx(BlockStyle,{type:i,units:[...l],label:"",property:d,negative:c})})]})},NestedOptions=({heading:r,items:n})=>{const{t:o}=reactI18next.useTranslation(),a=useSelectedBlockCurrentClasses(),i=React.useMemo(()=>{const l=d=>lodashEs.flatten(d.map(p=>p.styleType==="multiple"?lodashEs.map(p.options,"key"):p.property)),c=lodashEs.flatten(n.map(d=>d.styleType==="accordion"?l(d.items):d.styleType==="multiple"?lodashEs.map(d.options,"key"):d.property)),u=lodashEs.map(a,"property");return lodashEs.intersection(c,u).length>0},[a,n]);return jsxRuntime.jsxRuntimeExports.jsxs("details",{children:[jsxRuntime.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-gray-50 p-px px-2 text-[11px] text-foreground dark:bg-gray-800",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"inline",children:[o(r.toLowerCase()),i?jsxRuntime.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}):null]})}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"p-2",children:n.map(l=>l.styleType==="multiple"?jsxRuntime.jsxRuntimeExports.jsx(MultipleChoices,{...l},l.label):jsxRuntime.jsxRuntimeExports.jsx(BlockStyle,{...l},l.label))})]})},SectionContext=React.createContext({}),StylingGroup=({section:r})=>{const{t:n}=reactI18next.useTranslation(),o=useSelectedBlockCurrentClasses(),a=React.useCallback((l=[])=>{const c={};for(let d=0;d<o.length;d++)c[o[d].property]=o[d].cls;let u=!0;for(const d in l)if(!lodashEs.has(c,d)||c[d]!==l[d]){u=!1;break}return u},[o]),i=React.useMemo(()=>({}),[]);return jsxRuntime.jsxRuntimeExports.jsx(SectionContext.Provider,{value:i,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:r.heading,className:"border-none",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{className:"border-b border-border py-2 text-xs",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-2 text-sm font-bold",children:n(r.heading)})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionContent,{className:"py-2",children:React.Children.toArray(r.items.map(l=>lodashEs.has(l,"component")?React.createElement(l.component,{key:l.label}):lodashEs.has(l,"styleType")?l.styleType==="multiple"?jsxRuntime.jsxRuntimeExports.jsx(MultipleChoices,{...l},l.label):l.styleType==="accordion"&&a(l==null?void 0:l.conditions)?jsxRuntime.jsxRuntimeExports.jsx(NestedOptions,{...l},l.label):null:jsxRuntime.jsxRuntimeExports.jsx(BlockStyle,{...l},l.label)))})]})})},StylingHelpers=()=>{const r=useSelectedBlock(),[n]=useSelectedStylingBlocks(),{t:o}=reactI18next.useTranslation(),a=runtime.useGlobalStylingPresets(),i=useAddClassesToBlocks(),l=runtime.getBlockComponent(r._type),c=lodashEs.get(lodashEs.first(n),"prop"),u=lodashEs.get(l.props,`${c}.presets`,{});if(lodashEs.isEmpty(a)&&(!lodashEs.has(l,"props")||lodashEs.isEmpty(u)))return null;const d=p=>{const f=p.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");i([r._id],f,!0)};return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-10",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenu,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"px-4",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{variant:"default",className:"w-full",size:"sm",children:[o("Apply Presets"),jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CaretDownIcon,{})]})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuContent,{className:"max-h-80 w-56",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ScrollArea,{className:"no-scrollbar h-full",children:[lodashEs.isEmpty(u)?null:jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenuLabel,{children:[l.type," ",o("presets")]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuSeparator,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuGroup,{children:lodashEs.keys(u).map(p=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(u[p]),children:[lodashEs.capitalize(lodashEs.startCase(o(p))),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:o("apply")})]}))})]}),lodashEs.isEmpty(a)?null:jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuLabel,{children:o("Global presets")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuSeparator,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuGroup,{children:lodashEs.keys(a).map(p=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(a[p]),children:[lodashEs.capitalize(lodashEs.startCase(o(p))),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:o("apply")})]}))})]})]})})]})})},MAPPER={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1};function BlockStyling(){const{flexChild:r,gridChild:n}=useSelectedBlocksDisplayChild(),[o]=useSelectedStylingBlocks(),[a,i]=React.useState(""),[l,c]=React.useState({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),u=web.useThrottledCallback(p=>{const f=!lodashEs.get(l,"negative",!1),m=lodashEs.get(l,"cssProperty","");let h=parseFloat(l.dragStartValue);h=isNaN(h)?0:h;let g=MAPPER[l.dragUnit];(lodashEs.startsWith(m,"scale")||m==="opacity")&&(g=10);let b=(l.dragStartY-p.pageY)/g+h;f&&b<0&&(b=0),m==="opacity"&&b>1&&(b=1),l.onDrag(`${b}`),i(`${b}`)},[l],50),d=React.useCallback(()=>{setTimeout(()=>l.onDragEnd(`${a}`),100),c({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[l,a,c]);return lodashEs.isEmpty(o)?null:jsxRuntime.jsxRuntimeExports.jsxs(BlockSettingsContext.Provider,{value:{setDragData:c},children:[l.dragging?jsxRuntime.jsxRuntimeExports.jsx("div",{onMouseMove:u,onMouseUp:()=>d(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx(StylingHelpers,{}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Accordion,{defaultValue:["Styles"],type:"multiple",className:"w-full",children:[r&&jsxRuntime.jsxRuntimeExports.jsx(StylingGroup,{section:FLEX_CHILD_SECTION}),n?jsxRuntime.jsxRuntimeExports.jsx(StylingGroup,{section:GRID_CHILD_SECTION}):null,SETTINGS_SECTIONS.map(p=>jsxRuntime.jsxRuntimeExports.jsx(StylingGroup,{section:p},p.heading))]})]})]})}const ChaiSelect=({defaultValue:r="",onValueChange:n,options:o,placeholder:a="Select",className:i=""})=>{const[l,c]=React.useState(r),u=d=>{const p=d.target.value;c(p),n(p)};return jsxRuntime.jsxRuntimeExports.jsx("div",{className:iconBase.cn("relative inline-block w-full",i),children:jsxRuntime.jsxRuntimeExports.jsxs("select",{className:"mt-1 flex w-full rounded-md border border-border bg-background px-3 py-1 text-sm text-foreground 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",value:l,onChange:u,children:[jsxRuntime.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,children:a}),o.map(d=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:d.value,children:d.label},d.value))]})})},ChaiSelect$1=ChaiSelect;function UILibrariesSelect({uiLibraries:r,library:n,setLibrary:o}){const{t:a}=reactI18next.useTranslation();return n?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"h-12",children:[jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs font-bold text-gray-500",children:a("choose_library")}),jsxRuntime.jsxRuntimeExports.jsx(ChaiSelect$1,{className:"mt-1",options:r.map(i=>({value:i.uuid,label:i.name})),defaultValue:n,onValueChange:i=>o(i)})]}):null}const BlockCard=({block:r,library:n,parentId:o=void 0})=>{const[a,i]=React.useState(!1),l=useBuilderProp("getUILibraryBlock",lodashEs.noop),{addCoreBlock:c,addPredefinedBlock:u}=useAddBlock(),[,d]=useSelectedBlockIds(),[,p]=useHighlightBlockId(),f=lodashEs.get(r,"name",lodashEs.get(r,"label")),m=flagged.useFeature("dnd"),[,h]=jotai.useAtom(draggedBlockAtom),g=v=>{const x=lodashEs.has(v,"styles_attrs.data-page-section");return v._type==="Box"&&x},y=React.useCallback(async v=>{if(v.stopPropagation(),lodashEs.has(r,"component")){c(r,o),emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK});return}i(!0);const x=await l(n,r);lodashEs.isEmpty(x)||u(runtime.syncBlocksWithDefaults(x),o),emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK})},[r]),b=async v=>{const x=await l(n,r);let E=o;if(g(lodashEs.first(x))&&(E=null),!lodashEs.isEmpty(x)){const S={blocks:x,uiLibrary:!0,parent:E};if(v.dataTransfer.setData("text/plain",JSON.stringify(S)),r.preview){const w=new Image;w.src=r.preview,w.onload=()=>{v.dataTransfer.setDragImage(w,0,0)}}else v.dataTransfer.setDragImage(new Image,0,0);h(S),setTimeout(()=>{d([]),p(null),emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK})},200)}};return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{onClick:a?()=>{}:y,draggable:m?"true":"false",onDragStart:b,className:clsx("relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"),children:[a&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"absolute flex h-full w-full items-center justify-center bg-black/70",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"animate-spin",size:15,color:"white"}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"pl-2 text-sm text-white",children:"Adding..."})]}),r.preview?jsxRuntime.jsxRuntimeExports.jsx("img",{src:r.preview,className:"min-h-[45px] w-full rounded-md",alt:f}):jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex h-20 items-center justify-center rounded-md border border-border bg-gray-200",children:jsxRuntime.jsxRuntimeExports.jsx("p",{className:"max-w-xs text-center text-sm text-gray-700",children:f})})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:f})})]})},libraryBlocksAtom=jotai.atom({}),useLibraryBlocks=r=>{const[n,o]=jotai.useAtom(libraryBlocksAtom),a=useBuilderProp("getUILibraryBlocks",lodashEs.noop),i=lodashEs.get(n,`${r==null?void 0:r.uuid}.blocks`,null),l=lodashEs.get(n,`${r==null?void 0:r.uuid}.loading`,"idle"),c=React.useRef("idle");return React.useEffect(()=>{(async()=>{if(l==="complete"||c.current==="loading")return;c.current="loading",o(d=>({...d,[r==null?void 0:r.uuid]:{loading:"loading",blocks:[]}}));const u=await a(r);c.current="idle",o(d=>({...d,[r==null?void 0:r.uuid]:{loading:"complete",blocks:u||[]}}))})()},[r,i,l,c]),{data:i||[],isLoading:l==="loading"}},UILibrarySection=({parentId:r})=>{const[n,o]=jotai.useAtom(selectedLibraryAtom),a=useBuilderProp("uiLibraries",[]),i=runtime.useChaiBlocks(),l=lodashEs.values(i).filter(E=>E.category==="custom"),c=a.find(E=>E.uuid===n)||lodashEs.first(a),{data:u,isLoading:d}=useLibraryBlocks(c),p=lodashEs.groupBy([...u,...l],"group"),[f,m]=React.useState("Hero"),h=lodashEs.get(p,f,[]),g=React.useRef(null),{t:y}=reactI18next.useTranslation(),b=E=>{g.current&&(clearTimeout(g.current),g.current=null),g.current=setTimeout(()=>{g.current&&m(E)},300)};if(d)return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-4 grid h-full w-full grid-cols-12 gap-2",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"col-span-3 h-full"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"col-span-9 h-full"})]});const v=lodashEs.filter(h,(E,S)=>S%2===0),x=lodashEs.filter(h,(E,S)=>S%2===1);return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"relative mt-2 flex h-full max-h-full overflow-hidden bg-background",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full pt-2",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2",children:[jsxRuntime.jsxRuntimeExports.jsx(UILibrariesSelect,{library:c==null?void 0:c.uuid,setLibrary:o,uiLibraries:a}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex h-full max-h-full w-full flex-1 flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:"text-xs font-bold text-gray-500",children:y("groups")}),jsxRuntime.jsxRuntimeExports.jsx("hr",{className:"mt-1 border-border"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20",children:React.Children.toArray(lodashEs.map(p,(E,S)=>jsxRuntime.jsxRuntimeExports.jsxs("div",{onMouseEnter:()=>b(S),onMouseLeave:()=>clearTimeout(g.current),onClick:()=>m(S),className:iconBase.cn("flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",S===f?"bg-blue-500 text-white hover:bg-blue-600":""),children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:lodashEs.capitalize(y(S.toLowerCase()))}),jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CaretRightIcon,{className:"ml-2 h-5 w-5"})]},S)))})]})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.ScrollArea,{onMouseEnter:()=>g.current?clearTimeout(g.current):null,className:"z-10 -mt-2 flex h-full max-h-full w-full flex-col gap-2 border-l border-border transition-all ease-linear",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2 gap-2 px-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-1",children:React.Children.toArray(v.map(E=>jsxRuntime.jsxRuntimeExports.jsx(BlockCard,{parentId:r,block:E,library:c})))}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-1",children:React.Children.toArray(x.map(E=>jsxRuntime.jsxRuntimeExports.jsx(BlockCard,{parentId:r,block:E,library:c})))})]}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})]})})})},UILibrariesPanel=({parentId:r})=>jsxRuntime.jsxRuntimeExports.jsx(UILibrarySection,{parentId:r}),UILibraries=UILibrariesPanel,add_block="Add block",enter_paste_tailwind_html="(Enter or paste TailwindCSS HTML snippet)",click_to_add_block="(Click to add block to page)",core="Core",custom_blocks="Custom Blocks",ui_library="UI Library",html_snippet_description="Use HTML snippets from Tailwind CSS component libraries etc. or just copy paste your own HTML code.",tailwind_html_snippet="Tailwind HTML snippet:",enter_code_snippet="Enter your code snippet here...",import_html="Import HTML",note_imported_html="NOTE: Imported html will be added to the currently selected block. If no block is selected, the html will be added to the page.",dark_mode="Dark mode",tree_view_no_blocks="This page has no blocks. Add a block by clicking the + button",canvas_empty="This page is empty",no_block_selected_for_styling="Please select a block to edit settings or styles",no_block_selected_for_ask_ai="Please select a block to ask AI",no_styling_block_selected="Please select a styling block",drop_here_message="Drop your block here",use_setting="Use setting",mobile_xs_title="Mobile (XS)",mobile_xs_content="Styles set here are applied to all screen unless edited at higher breakpoint",mobile_sm_title="Mobile landscape (SM)",mobile_sm_content="Styles set here are applied at 640px and up unless edited at higher breakpoint",tablet_md_title="Tablet (MD)",tablet_md_content="Styles set here are applied at 768px and up",tablet_lg_title="Tablet Landscape (LG)",tablet_lg_content="Styles set here are applied at 1024px and up unless edited at higher breakpoint",desktop_xl_title="Desktop (XL)",desktop_xl_content="Styles set here are applied at 1280px and up unless edited at higher breakpoint",large_desktop_2xl_title="Large Desktop (2XL)",large_desktop_2xl_content="Styles set here are applied at 1536px and up",Breakpoints$1="Breakpoints",clear="Clear",clear_canvas_title="Clear whole canvas?",clear_canvas_description="Are you sure you want to clear the whole canvas?",cancel="Cancel",yes="Yes",preview="Preview",settings="Settings",styling="Styling",data_provider="Data Provider",remove_provider_confirmation="Are you sure you want to remove <span class='text-blue-500'>{name}</span> provider?",remove_provider_warning="Your data provider will be removed from this page and all added data binding will be not visible on blocks.",remove="Remove",no_data_providers="You have no data providers registered. Please add a data provider to your project.",learn_more="Learn more",add_data_providers="Add data providers:",select_provider="Select a provider",choose="Choose",page_data_providers="Page data providers:",view_data="View Data",mark_as_global="Mark as Global",global_block_note="Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks.",global_block_indicator="Global blocks are indicated with",global_block_category="Global blocks are available under 'Global' category",enter_global_block_name="Enter global block name",eg_header_footer="Eg: Header, Footer",blocks_selected="{{length}} blocks selected.",cut="Cut",copy$1="Copy",clear_selection="Clear Selection",dev_mode_message="This is dev mode. Visit",to_see_page_preview="to see page preview",theme_config={heading_font:"Heading Font",body_font:"Body Font",rounded_corner:"Rounded Corners",primary:"Primary",secondary:"Secondary",background:"Background",text_color:"Text Color",background_dark_mode:"Background (Dark Mode)",text_color_dark_mode:"Text Color (Dark Mode)"},web_blocks={box:"box",tag:"Tag",div:"div",level:"Level",header:"header",footer:"footer",section:"section",article:"article",aside:"aside",main:"main",nav:"navigation",figure:"figure",details:"details",summary:"summary",dialog:"dialog",strike:"strike",caption:"caption",legend:"legend",figcaption:"figure caption",mark:"mark",background_image:"Background Image",label:"Label",default:"default",icon_size:"Icon Size",icon_position:"Icon Position",start:"Start",end:"End",button:"Button",custom_html:"Custom HTML",html_code:"HTML Code",default_snippet:"The HTML snippet goes here...",placeholder:"Enter custom HTML code here",custom_script:"Custom Script",dark_mode:"Dark Mode",divider:"Divider",empty_box:"Empty Box",heading:"Heading",image:"Image",alt:"Alt",width:"Width",height:"Height",video:"Video",span:"Span",content:"Content",icon:"Icon",richtext:"Rich Text",list:"List",list_type:"List Type",listitem:"List Item",link:"Link",list_item:"List Item",none:"None",disc:"Disc",number:"Number",paragraph:"Paragraph",lightbox_link:"Lightbox Link",href:"Link",type:"Type",iframe:"iframe",inline:"inline",ajax:"ajax",autoplay:"Video autoplay",max_width:"Max Width",backdrop_color:"Background Color",gallery_name:"Gallery Name",slot:"Slot",empty_slot:"Empty Slot",text:"Text",video_url:"Video URL",controls:"Show Controls",loop:"Loop",muted:"Muted",checkbox:"Checkbox",required:"Required",checked:"Checked",submit_button:"Submit Button",form:"Form",submit_url:"Submit URL",error_message:"Error Message",success_message:"Success Message",input:"Input",value:"Value",show_label:"Show Label",field_name:"Field Name",radio:"Radio",multiple:"Multiple",options:"Options",select:"Select",multiple_choice:"Multiple Choice",textarea:"Textarea",rows:"Rows"},ai_assistant="AI Assistant",close_preview="Close Preview",saved="Saved",unsaved="Unsaved",saving="Saving...",page_is_empty="This page is empty.",Theme="Theme",Outline="Outline",clipboard_not_supported="Not supported",please_use_chrome_firefox_or_safari="Please use Chrome, Firefox or Safari",classes_copied_to_clipboard="Classes copied to clipboard",download_complete="Download complete",copied="Copied",enter_classes_separated_by_space="Enter classes separated by space",copy_classes_to_clipboard="Copy classes to clipboard",classes="Classes",ask_ai="Ask AI",edit_with_ai="Edit with AI",generating_please_wait="Generating... Please wait",stop$1="Stop",eg_this_page_is_about_an_ai_assistant_app_called_chai_studio_it_allows_users_to_create_beautiful_webpages_and_edit_content_with_ai="E.g.: This page is about an AI assistant app called Chai Studio. It allows users to create beautiful webpages and edit content with AI.",ask_ai_to_edit_styles="Ask AI to edit styles",ask_ai_to_edit_content="Ask AI to edit content",ai_context="AI Context",please_select_a_block_to_ask_ai="Select a block to edit with AI",please_select_a_block_to_edit="Please select a block to edit",edit="Edit",tell_about_this_page_eg_this_page_is_about="Describe this page. E.g.: This page is about...",tag="Tag",value="Value",background_image="Background Image",enter_image_url="Enter image URL",replace_image="Replace image",choose_image="Choose image",images="Images",typography="Typography",background="Background",library="Library",blocks="Blocks",basic="Basic",media="Media",advanced="Advanced",form="Form",choose_icon_or_enter_svg="Choose an icon or enter SVG",groups="Groups",ui_libraries="UI Libraries",accordions="Accordions",buttons="Buttons",layouts="Layouts",choose_library="Choose library",no_library_found="No library found.",faq="FAQ",hero="Hero",features="Features",footer="Footer",navbar="Navbar",icons="Icons",testimonials="Testimonials",blog="Blog",ai_quick_prompts={improve_writing:"Improve writing",replace_placeholder_content:"Replace placeholder content",fix_grammar:"Fix grammar",make_longer:"Make longer",make_shorter:"Make shorter",add_emojis:"Add emojis",randomize:"Randomize"},sidebar={outline:"Outline",edit_block:"Edit Block",ai_assistant:"AI Assistant",theme:"Theme"},remove_context="Remove context",yes_delete="Yes, Delete",ai_context_updated="AI Context Updated",you_can_now_ask_ai_to_edit_your_content="You can now ask AI to edit your content.",lngEn={add_block,enter_paste_tailwind_html,click_to_add_block,core,custom_blocks,ui_library,import:"Import",html_snippet_description,tailwind_html_snippet,enter_code_snippet,import_html,note_imported_html,dark_mode,tree_view_no_blocks,canvas_empty,no_block_selected_for_styling,no_block_selected_for_ask_ai,no_styling_block_selected,drop_here_message,use_setting,mobile_xs_title,mobile_xs_content,mobile_sm_title,mobile_sm_content,tablet_md_title,tablet_md_content,tablet_lg_title,tablet_lg_content,desktop_xl_title,desktop_xl_content,large_desktop_2xl_title,large_desktop_2xl_content,Breakpoints:Breakpoints$1,clear,clear_canvas_title,clear_canvas_description,cancel,yes,preview,settings,styling,data_provider,remove_provider_confirmation,remove_provider_warning,remove,no_data_providers,learn_more,add_data_providers,select_provider,choose,page_data_providers,view_data,mark_as_global,global_block_note,global_block_indicator,global_block_category,enter_global_block_name,eg_header_footer,blocks_selected,cut,copy:copy$1,delete:"Delete",clear_selection,dev_mode_message,to_see_page_preview,"flex.heading":"Flex Child","flex.basis":"Basis","flex.order":"Order","flex.flex":"Flex","flex.grow":"Grow","flex.shrink":"Shrink","grid.heading":"Grid Child","grid.col_span":"Col Span","grid.col_start":"Col Start","grid.col_end":"Col End","grid.row_span":"Row Span","grid.row_start":"Row Start","grid.row_end":"Row End","grid.order":"Order","layout.heading":"Layout","layout.width":"Width","layout.height":"Height","layout.margin":"Margin","layout.margin_all":"All","layout.margin_lr":"Left-Right","layout.margin_tb":"Top-Bottom","layout.margin_top":"Top","layout.margin_right":"Right","layout.margin_bottom":"Bottom","layout.margin_left":"Left","layout.padding":"Padding","layout.padding_all":"All","layout.padding_lr":"Left-Right","layout.padding_tb":"Top-Bottom","layout.padding_top":"Top","layout.padding_right":"Right","layout.padding_bottom":"Bottom","layout.padding_left":"Left","layout.space_bt":"Space Bt.","layout.space_lr":"Left-Right","layout.space_tb":"Top-Bottom","size.heading":"Size","size.min_width_height":"Min width & height","size.min_width":"Min Width","size.min_height":"Min Height","size.max_width_height":"Max width & height","size.max_width":"Max Width","size.max_height":"Max Height","size.object_options_aspect_ratio":"Object options & aspect ratio","size.aspect":"Aspect","size.fit":"Fit","size.position":"Position","display.heading":"Display","display.display":"Display","display.flex_options":"Flex options","display.flex_direction":"Direction","display.flex_wrap":"Wrap","display.justify_content":"Justify","display.align_content":"Content","display.align_items":"Items","display.gap":"Gap","display.gap_all":"All","display.gap_lr":"Left-Right","display.gap_tb":"Top-Bottom","display.grid_options":"Grid options","display.grid_columns":"Columns","display.grid_rows":"Rows","display.grid_auto_flow":"Auto Flow","display.grid_auto_cols":"Auto Cols","display.grid_auto_rows":"Auto Rows","display.visibility_opacity":"Visibility & Opacity","display.visibility":"Visibility","display.opacity":"Opacity","position.heading":"Position","position.position":"Position","position.options":"Position options","position.direction":"Direction","position.top":"Top","position.right":"Right","position.bottom":"Bottom","position.left":"Left","position.inset":"Inset","position.all":"All","position.lr":"Left Right","position.tb":"Top Bottom","position.z_index":"Z-Index","position.float_clear":"Float & Clear","position.float":"Float","position.clear":"Clear","position.overflow_overscroll":"Overflow & Overscroll","position.overflow":"Overflow","position.overscroll":"Overscroll","typography.heading":"Typography","typography.font":"Font","typography.size":"Size","typography.height":"Height","typography.weight":"Weight","typography.color":"Color","typography.alignments":"Alignments","typography.align":"Align","typography.valign":"V. Align","typography.spacing_decoration_more":"Spacing, decoration & more","typography.spacing":"Spacing","typography.decoration":"Decoration","typography.thickness":"Thickness","typography.transform":"Transform","typography.whitespace_breaks":"White space & breaks","typography.whitespace":"Whitespace","typography.wordbreak":"Wordbreak","background.heading":"Background","background.bgcolor":"Bg. Color","background.position_size_more":"Position, Size & more","background.attachment":"Attachment","background.clipping":"Clipping","background.origin":"Origin","background.position":"Position","background.repeat":"Repeat","background.size":"Size","background.gradient":"Gradient","background.gradient_colors":"Gradient colors","background.from_color":"From","background.via_color":"Via","background.to_color":"To","border.heading":"Border & Outline","border.width":"Width","border.all":"All","border.lr":"Left Right","border.tb":"Top bottom","border.top":"Top","border.right":"Right","border.bottom":"Bottom","border.left":"Left","border.corners":"Corners","border.top_left":"Top Left","border.top_right":"Top right","border.bottom_right":"Bottom right","border.bottom_left":"Bottom left","border.color":"Color","border.style":"Style","border.divide_options":"Divide options","border.divide_color":"Color","border.divide_style":"Style","border.outline_styling":"Outline styling","border.outline_width":"Width","border.outline_offset":"Offset","border.outline_style":"Style","border.ring_options":"Ring options","border.ring_width":"Width","border.ring_color":"Color","border.ring_offset_width":"Offset","border.ring_offset_color":"Off. color","effect.heading":"Effect & Animation","effect.shadow":"Shadow","effect.color":"Color","effect.cursor":"Cursor","effect.blend_cursor":"Blend & Cursor","effect.mix_blend":"Mix Blend","effect.bg_blend":"Bg. Blend","effect.transform":"Transform","effect.origin":"Origin","effect.scale":"Scale","effect.all":"All","effect.lr":"Left-Right","effect.tb":"Top-Bottom","effect.skew":"Skew","effect.translate":"Translate","effect.rotate":"Rotate","effect.animation":"Animation","effect.transition":"Transition","effect.easing":"Easing","effect.duration":"Duration","effect.delay":"Delay","classes.heading":"Classes",theme_config,web_blocks,ai_assistant,close_preview,saved,unsaved,saving,page_is_empty,Theme,Outline,clipboard_not_supported,please_use_chrome_firefox_or_safari,classes_copied_to_clipboard,download_complete,copied,enter_classes_separated_by_space,copy_classes_to_clipboard,classes,ask_ai,edit_with_ai,generating_please_wait,stop:stop$1,eg_this_page_is_about_an_ai_assistant_app_called_chai_studio_it_allows_users_to_create_beautiful_webpages_and_edit_content_with_ai,ask_ai_to_edit_styles,ask_ai_to_edit_content,ai_context,please_select_a_block_to_ask_ai,please_select_a_block_to_edit,edit,tell_about_this_page_eg_this_page_is_about,tag,value,background_image,enter_image_url,replace_image,choose_image,images,typography,background,library,blocks,basic,media,advanced,form,choose_icon_or_enter_svg,groups,ui_libraries,accordions,buttons,layouts,choose_library,no_library_found,faq,hero,features,footer,navbar,icons,testimonials,blog,ai_quick_prompts,sidebar,remove_context,yes_delete,ai_context_updated,you_can_now_ask_ai_to_edit_your_content};i18n.use(reactI18next.initReactI18next).init({resources:{en:{translation:lngEn}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1}});const CoreBlock=({block:r,disabled:n,parentId:o})=>{const[,a]=jotai.useAtom(draggedBlockAtom),{type:i,icon:l,label:c}=r,{addCoreBlock:u,addPredefinedBlock:d}=useAddBlock(),[,p]=useSelectedBlockIds(),[,f]=useHighlightBlockId(),m=()=>{if(console.log("addBlockToPage",r,o),lodashEs.has(r,"blocks")){const y=lodashEs.isFunction(r.blocks)?r.blocks():r.blocks;d(runtime.syncBlocksWithDefaults(y),o||null)}else u(r,o||null);emitChaiBuilderMsg({name:CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK})},h=flagged.useFeature("dnd"),{t:g}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("button",{disabled:n,onClick:m,type:"button",onDragStart:y=>{y.dataTransfer.setData("text/plain",JSON.stringify(lodashEs.omit(r,["component","icon"]))),y.dataTransfer.setDragImage(new Image,0,0),a(lodashEs.omit(r,["component","icon"])),setTimeout(()=>{p([]),f(null)},200)},draggable:h?"true":"false",className:"cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",children:[React.createElement(l||reactIcons.BoxIcon,{className:"w-4 h-4 mx-auto"}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"truncate text-xs",children:lodashEs.capitalize(g(c||i))})]})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:g(c||i)})})]})})},DefaultChaiBlocks=({parentId:r,gridCols:n="grid-cols-2"})=>{const o=runtime.useChaiBlocks(),a=useBuilderProp("filterChaiBlock",()=>!0),i=lodashEs.filter(o,a),l=lodashEs.groupBy(i,"category"),c=lodashEs.uniq(lodashEs.map(l.core,"group"));return jsxRuntime.jsxRuntimeExports.jsx(ChaiBuilderBlocks,{gridCols:n,parentId:r,groups:c,blocks:l.core})},CORE_GROUPS=["basic","typography","media","layout","form","advanced","other"],ChaiBuilderBlocks=({groups:r,blocks:n,parentId:o,gridCols:a="grid-cols-4"})=>{var u;const{t:i}=reactI18next.useTranslation(),[l]=useBlocksStore(),c=(u=lodashEs.find(l,d=>d._id===o))==null?void 0:u._type;return React.Children.toArray(lodashEs.map(lodashEs.sortBy(r,d=>CORE_GROUPS.indexOf(d)===-1?99:CORE_GROUPS.indexOf(d)),d=>lodashEs.reject(lodashEs.filter(lodashEs.values(n),{group:d}),{hidden:!0}).length?jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Accordion,{type:"single",value:d,collapsible:!0,className:"w-full",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:d,className:"border-border",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{className:"rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline",children:lodashEs.capitalize(i(d.toLowerCase()))}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionContent,{className:"mx-auto max-w-xl p-3",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"grid gap-2 "+a,children:React.Children.toArray(lodashEs.reject(lodashEs.filter(lodashEs.values(n),{group:d}),{hidden:!0}).map(p=>jsxRuntime.jsxRuntimeExports.jsx(CoreBlock,{parentId:o,block:p,disabled:!canAcceptChildBlock(c,p.type)||!canBeNestedInside(c,p.type)})))})})]})}):null))},addBlockTabAtom=atomWithStorage("__add_block_tab","library"),AddBlocksPanel=({className:r,showHeading:n=!0,parentId:o=void 0})=>{const{t:a}=reactI18next.useTranslation(),[i,l]=jotai.useAtom(addBlockTabAtom),[,c]=jotai.useAtom(showPredefinedBlockCategoryAtom),u=useBuilderProp("importHTMLSupport",!0);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("flex h-full w-full flex-col overflow-hidden",r),children:[n?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[jsxRuntime.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:a("Add block")}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:a(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}):null,jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Tabs,{onValueChange:d=>{c(""),l(d)},value:i,className:iconBase.cn("h-max"),children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.TabsList,{className:"grid w-full "+(u?"grid-cols-3":"grid-cols-2"),children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"library",children:a("library")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"core",children:a("blocks")}),u?jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TabsTrigger,{value:"html",children:a("import")}):null]})}),i==="core"&&jsxRuntime.jsxRuntimeExports.jsx(contextMenu.ScrollArea,{className:"-mx-1.5 h-[calc(100vh-156px)] overflow-y-auto",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:jsxRuntime.jsxRuntimeExports.jsx(DefaultChaiBlocks,{gridCols:"grid-cols-4",parentId:o})})}),i==="library"&&jsxRuntime.jsxRuntimeExports.jsx(UILibraries,{parentId:o}),i==="html"&&u?jsxRuntime.jsxRuntimeExports.jsx(ImportHTML$1,{parentId:o}):null]})},AddBlocksPanel$1=AddBlocksPanel,AddBlocksDialog=()=>{const{t:r}=reactI18next.useTranslation(),[n,o]=React.useState(""),[a,i]=React.useState(!1);return useChaiBuilderMsgListener(({name:l,data:c=void 0})=>{l===CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK&&(o(c==null?void 0:c._id),i(!0)),l===CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK&&(o(""),i(!1))}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialog,{open:a,onOpenChange:()=>a?i(!1):"",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogContent,{className:"max-w-5xl overflow-hidden border-border",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogHeader,{className:"flex flex-row items-center justify-between",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTitle,{className:"text-foreground",children:r("Add blocks")}),jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:()=>i(!1),className:"text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Cross2Icon,{className:"h-6 w-6"})})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar h-[500px] max-h-full overflow-hidden",children:jsxRuntime.jsxRuntimeExports.jsx(AddBlocksPanel$1,{parentId:n,showHeading:!1})})]})})};function FaCheck(r){return iconBase.GenIcon({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"},child:[]}]})(r)}function FaFilePen(r){return iconBase.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 32H384V299.6l-94.7 94.7c-8.2 8.2-14 18.5-16.8 29.7l-15 60.1c-2.3 9.4-1.8 19 1.4 27.8H64c-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"},child:[]}]})(r)}const QUICK_PROMPTS=[{name:"Improve writing",icon:FaFilePen,prompt:"Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."},{name:"Replace placeholder content",icon:FaRecycle,prompt:"Discard current placeholder content and replace with meaningful relevant content."},{name:"Fix grammar",icon:reactIcons.CheckIcon,prompt:"Fix grammar in all text elements. Ensuring the text is grammatically correct and free of errors."},{name:"Make longer",icon:reactIcons.ArrowUpIcon,prompt:"Make all text elements longer."},{name:"Make shorter",icon:reactIcons.ArrowDownIcon,prompt:"Make all text elements shorter."},{name:"Add emojis",icon:lucideReact.SmileIcon,prompt:"Add emojis to text elements if relevant."},{name:"Randomize",icon:lucideReact.ShuffleIcon,prompt:"Randomize all text elements."}];function QuickPrompts({onClick:r}){const{loading:n}=useAskAi(),{t:o}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsx("div",{className:n?"pointer-events-none opacity-50":"",children:jsxRuntime.jsxRuntimeExports.jsx("ul",{className:"space-y-2",children:QUICK_PROMPTS.map(({name:a,icon:i,subMenus:l,prompt:c})=>l?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Popover,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"flex cursor-pointer items-center space-x-2 rounded p-1 pl-2 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",children:[jsxRuntime.jsxRuntimeExports.jsx(i,{className:"h-4 w-4"}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:a})]},a)}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.PopoverContent,{side:"right",children:jsxRuntime.jsxRuntimeExports.jsx("ul",{children:jsxRuntime.jsxRuntimeExports.jsx("li",{children:"Happy"})})})]}):jsxRuntime.jsxRuntimeExports.jsxs("li",{onClick:()=>r(c),className:"flex cursor-pointer items-center space-x-2 rounded p-1 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",children:[jsxRuntime.jsxRuntimeExports.jsx(i,{className:"h-4 w-4"}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:o(a)})]},a))})})}const AIUserPrompt=({blockId:r})=>{const{t:n}=reactI18next.useTranslation(),{askAi:o,loading:a,error:i}=useAskAi(),[l,c]=React.useState(""),[u,d]=React.useState(!0),[p,f]=React.useState(),m=React.useRef(null),h=React.useRef(null);React.useEffect(()=>{var y;(y=m.current)==null||y.focus()},[]);const g=y=>{const{usage:b}=y||{};!i&&b&&f(b),h.current=setTimeout(()=>f(void 0),1e4),i||c("")};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{onClick:()=>d(!u),className:"flex cursor-pointer items-center justify-between border-b border-border py-2 text-sm font-bold text-muted-foreground hover:underline",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:n("Ask AI")}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronDown,{className:"h-4 w-4 text-gray-500 "+(u?"rotate-180":"")})})]}),u&&r?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{ref:m,value:l,onChange:y=>c(y.target.value),placeholder:n("Ask AI to edit content"),className:"w-full",rows:3,onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),h.current&&clearTimeout(h.current),f(void 0),o("content",r,l,g))}}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"my-2 flex items-center gap-2",children:[a?null:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:l.trim().length<5||a,onClick:()=>{h.current&&clearTimeout(h.current),f(void 0),o("content",r,l,g)},variant:"default",className:"w-fit",size:"sm",children:a?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"h-5 w-5 animate-spin"}),n("generating_please_wait")]}):n("edit_with_ai")}),a?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Skeleton,{className:"flex w-full items-center space-x-1 px-4 py-1 pl-2",children:[jsxRuntime.jsxRuntimeExports.jsx(FaSpinner,{className:"h-4 w-4 animate-spin text-gray-500"}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs",children:n("Generating... Please wait...")})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:n("Stop")})]}):null]}),p?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:jsxRuntime.jsxRuntimeExports.jsxs("p",{className:"mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500",children:[jsxRuntime.jsxRuntimeExports.jsxs("span",{children:[n("Total tokens used"),": ",p.totalTokens]}),jsxRuntime.jsxRuntimeExports.jsx(Countdown,{})]})}):null,jsxRuntime.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:i&&jsxRuntime.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:i.message})}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx(QuickPrompts,{onClick:y=>{h.current&&clearTimeout(h.current),f(void 0),o("content",r,y,g)}})]}):u?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4 text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.SparklesIcon,{className:"mx-auto text-3xl text-muted-foreground"}),jsxRuntime.jsxRuntimeExports.jsx("h1",{children:n("Please select a block to Ask AI")})]})}):null]})},AISetContext=()=>{const{t:r}=reactI18next.useTranslation(),n=useBuilderProp("aiContext",""),[o,a]=React.useState(n),i=React.useRef(null),l=useBuilderProp("saveAiContextCallback",lodashEs.noop),[c,u]=React.useState(!1),[d,p]=React.useState(null),[,f]=React.useState(!1),{toast:m}=contextMenu.useToast(),h=React.useRef(null);React.useEffect(()=>{n&&a(n)},[n]);const g=async()=>{try{u(!0),p(null),await l(o),m({title:r("Updated AI Context"),description:r("You can now Ask AI to edit your content"),variant:"default"}),h.current.click()}catch(y){p(y)}finally{u(!1)}};return jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Accordion,{onValueChange:y=>{f(y!=="")},type:"single",collapsible:!0,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionItem,{value:"set-context",className:"border-none",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AccordionTrigger,{ref:h,className:"border-b border-border py-2",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-between",children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"font-bold text-muted-foreground",children:r("AI Context")})})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AccordionContent,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{ref:i,value:o,onChange:y=>a(y.target.value),placeholder:r("Tell about this page eg this page is about"),className:"mt-1 w-full",rows:10,onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),g())}}),n.trim().length===0?jsxRuntime.jsxRuntimeExports.jsx("p",{className:"mt-2 text-xs text-gray-500",children:r("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,jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:o.trim().length<5,onClick:()=>g(),variant:"default",className:"w-fit",size:"sm",children:c?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"h-5 w-5 animate-spin"}),r("Generating... Please wait...")]}):r("Save")}),n.trim().length>0?jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialog,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:n.trim().length===0,variant:"ghost",className:"w-fit",size:"sm",children:c?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Loader,{className:"h-5 w-5 animate-spin"}),r("Generating... Please wait...")]}):r("Delete")})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogContent,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogHeader,{children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogTitle,{children:[r("Delete context")," ?"]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogDescription,{})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogFooter,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogCancel,{children:r("Cancel")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogAction,{onClick:()=>{a(""),g()},children:r("Yes, Delete")})]})]})]}):null]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-2 max-w-full",children:d&&jsxRuntime.jsxRuntimeExports.jsx("p",{className:"break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500",children:d.message})})]})]})})},AskAI=()=>{const[r]=useSelectedBlockIds();return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-2",children:[jsxRuntime.jsxRuntimeExports.jsx(AISetContext,{}),jsxRuntime.jsxRuntimeExports.jsx(AIUserPrompt,{blockId:lodashEs.first(r)})]})},AttrsEditor=React.memo(function r({preloadedAttributes:n=[],onAttributesChange:o}){const[a,i]=React.useState([]),[l,c]=React.useState(""),[u,d]=React.useState(""),[p,f]=React.useState(null),[m,h]=React.useState(""),g=React.useRef(null),y=React.useRef(null);React.useEffect(()=>{i(n)},[n]);const b=()=>{if(l.startsWith("@")){h("Attribute keys cannot start with '@'");return}if(l){const w=[...a,{key:l,value:u}];o(w),i(a),c(""),d(""),h("")}},v=w=>{const R=a.filter((A,C)=>C!==w);o(R),i(R)},x=w=>{f(w),c(a[w].key),d(a[w].value)},E=()=>{if(l.startsWith("@")){h("Attribute keys cannot start with '@'");return}if(p!==null&&l){const w=[...a];w[p]={key:l,value:u},o(w),i(w),f(null),c(""),d(""),h("")}},S=w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),p!==null?E():b())};return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"max-w-full",children:[jsxRuntime.jsxRuntimeExports.jsxs("form",{onSubmit:w=>{w.preventDefault(),p!==null?E():b()},className:"space-y-3",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{htmlFor:"attrKey",className:"text-xs",children:"Key"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Input,{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",id:"attrKey",ref:g,value:l,onChange:w=>c(w.target.value),placeholder:"Key",className:"h-8 text-sm"})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{htmlFor:"attrValue",className:"text-xs",children:"Value"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Textarea,{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",id:"attrValue",rows:2,ref:y,value:u,onChange:w=>d(w.target.value),onKeyDown:S,placeholder:"Value",className:"bg-background text-sm"})]})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{type:"submit",variant:"secondary",className:"h-8 w-fit text-sm",children:p!==null?"Save":"Add"}),m&&jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs text-red-500",children:m})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-4 space-y-1 overflow-y-auto",children:a.map((w,R)=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded bg-muted p-1.5 text-sm",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mr-2 flex flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{className:"truncate font-semibold",children:w.key}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"text-wrap max-w-[200px] text-muted-foreground",children:w.value.toString()})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex-shrink-0",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>x(R),children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Edit2,{className:"h-3 w-3"}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Edit attribute"})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>v(R),children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.X,{className:"h-3 w-3"}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Remove attribute"})]})]})]},R))})]})}),BlockAttributesEditor=React__namespace.memo(()=>{const r=useSelectedBlock(),[n,o]=React.useState([]),[a]=useSelectedStylingBlocks(),i=useUpdateBlocksProps(),l=`${lodashEs.get(a,"0.prop")}_attrs`;React__namespace.useEffect(()=>{const u=lodashEs.map(lodashEs.get(r,l),(d,p)=>({key:p,value:d}));lodashEs.isEmpty(u)?o([]):o(u)},[lodashEs.get(r,l)]);const c=React__namespace.useCallback((u=[])=>{const d={};lodashEs.forEach(u,p=>{lodashEs.isEmpty(p.key)||lodashEs.set(d,p.key,p.value)}),i([lodashEs.get(r,"_id")],{[l]:d})},[r,i,l]);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex-col gap-y-2",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col",children:jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsx(AttrsEditor,{preloadedAttributes:n,onAttributesChange:c})})})})});var __create=Object.create,__defProp$1v=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp$1x=Object.prototype.hasOwnProperty,__esm=(r,n)=>function(){return r&&(n=(0,r[__getOwnPropNames(r)[0]])(r=0)),n},__commonJS=(r,n)=>function(){return n||(0,r[__getOwnPropNames(r)[0]])((n={exports:{}}).exports,n),n.exports},__copyProps=(r,n,o,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of __getOwnPropNames(n))!__hasOwnProp$1x.call(r,i)&&i!==o&&__defProp$1v(r,i,{get:()=>n[i],enumerable:!(a=__getOwnPropDesc(n,i))||a.enumerable});return r},__toESM=(r,n,o)=>(o=r!=null?__create(__getProtoOf(r)):{},__copyProps(n||!r||!r.__esModule?__defProp$1v(o,"default",{value:r,enumerable:!0}):o,r)),init_react_shim=__esm({"react-shim.js"(){}});init_react_shim();init_react_shim();var isEqualAtomsValues=(r,n)=>r.size===n.size&&Array.from(r).every(([o,a])=>Object.is(n.get(o),a)),isEqualAtomsDependents=(r,n)=>r.size===n.size&&Array.from(r).every(([o,a])=>{const i=n.get(o);return i&&a.size===i.size&&Array.from(a).every(l=>i.has(l))});function useAtomsSnapshot({shouldShowPrivateAtoms:r=!1,...n}={}){const o=useStore(n),[a,i]=React.useState(()=>({values:new Map,dependents:new Map})),l=React.useRef(!0);return l.current=!0,React.useLayoutEffect(()=>{l.current=!1}),React.useEffect(()=>{const c=(o==null?void 0:o.dev_subscribe_store)||(o==null?void 0:o.dev_subscribe_state);if(!c)return;let u=new Map,d=new Map;"dev_subscribe_store"in o||console.warn("[DEPRECATION-WARNING]: Your Jotai version is out-of-date and contains deprecated properties that will be removed soon. Please update to the latest version of Jotai.");const p=m=>{var b,v,x;typeof m!="object"&&console.warn("[DEPRECATION-WARNING]: Your Jotai version is out-of-date and contains deprecated properties that will be removed soon. Please update to the latest version of Jotai.");const h=new Map,g=new Map;for(const E of((b=o.dev_get_mounted_atoms)==null?void 0:b.call(o))||[]){if(!r&&E.debugPrivate)continue;const S=(v=o.dev_get_atom_state)==null?void 0:v.call(o,E);S&&"v"in S&&h.set(E,S.v);const w=(x=o.dev_get_mounted)==null?void 0:x.call(o,E);if(w){let R=w.t;r||(R=new Set(Array.from(R.values()).filter(A=>!A.debugPrivate))),g.set(E,R)}}if(isEqualAtomsValues(u,h)&&isEqualAtomsDependents(d,g))return;u=h,d=g;const y=()=>i({values:h,dependents:g});l.current?Promise.resolve().then(y):y()},f=c==null?void 0:c(p,2);return p({}),f},[o,r]),a}init_react_shim();function useGotoAtomsSnapshot(r){const n=useStore(r);return React.useCallback(o=>{n.dev_restore_atoms&&n.dev_restore_atoms(o.values)},[n])}init_react_shim();init_react_shim();init_react_shim();init_react_shim();init_react_shim();function sheetForTag(r){if(r.sheet)return r.sheet;for(var n=0;n<document.styleSheets.length;n++)if(document.styleSheets[n].ownerNode===r)return document.styleSheets[n]}function createStyleElement(r){var n=document.createElement("style");return n.setAttribute("data-emotion",r.key),r.nonce!==void 0&&n.setAttribute("nonce",r.nonce),n.appendChild(document.createTextNode("")),n.setAttribute("data-s",""),n}var StyleSheet=function(){function r(o){var a=this;this._insertTag=function(i){var l;a.tags.length===0?a.insertionPoint?l=a.insertionPoint.nextSibling:a.prepend?l=a.container.firstChild:l=a.before:l=a.tags[a.tags.length-1].nextSibling,a.container.insertBefore(i,l),a.tags.push(i)},this.isSpeedy=o.speedy===void 0?process.env.NODE_ENV==="production":o.speedy,this.tags=[],this.ctr=0,this.nonce=o.nonce,this.key=o.key,this.container=o.container,this.prepend=o.prepend,this.insertionPoint=o.insertionPoint,this.before=null}var n=r.prototype;return n.hydrate=function(a){a.forEach(this._insertTag)},n.insert=function(a){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(createStyleElement(this));var i=this.tags[this.tags.length-1];if(process.env.NODE_ENV!=="production"){var l=a.charCodeAt(0)===64&&a.charCodeAt(1)===105;l&&this._alreadyInsertedOrderInsensitiveRule&&console.error(`You're attempting to insert the following rule:
62
62
  `+a+"\n\n`@import` rules must be before all other types of rules in a stylesheet but other rules have already been inserted. Please ensure that `@import` rules are before all other rules."),this._alreadyInsertedOrderInsensitiveRule=this._alreadyInsertedOrderInsensitiveRule||!l}if(this.isSpeedy){var c=sheetForTag(i);try{c.insertRule(a,c.cssRules.length)}catch(u){process.env.NODE_ENV!=="production"&&!/:(-moz-placeholder|-moz-focus-inner|-moz-focusring|-ms-input-placeholder|-moz-read-write|-moz-read-only|-ms-clear|-ms-expand|-ms-reveal){/.test(a)&&console.error('There was a problem inserting the following rule: "'+a+'"',u)}}else i.appendChild(document.createTextNode(a));this.ctr++},n.flush=function(){this.tags.forEach(function(a){return a.parentNode&&a.parentNode.removeChild(a)}),this.tags=[],this.ctr=0,process.env.NODE_ENV!=="production"&&(this._alreadyInsertedOrderInsensitiveRule=!1)},r}(),MS="-ms-",MOZ="-moz-",WEBKIT="-webkit-",COMMENT="comm",RULESET="rule",DECLARATION="decl",IMPORT="@import",KEYFRAMES="@keyframes",LAYER="@layer",abs=Math.abs,from=String.fromCharCode,assign=Object.assign;function hash(r,n){return charat(r,0)^45?(((n<<2^charat(r,0))<<2^charat(r,1))<<2^charat(r,2))<<2^charat(r,3):0}function trim(r){return r.trim()}function match(r,n){return(r=n.exec(r))?r[0]:r}function replace(r,n,o){return r.replace(n,o)}function indexof(r,n){return r.indexOf(n)}function charat(r,n){return r.charCodeAt(n)|0}function substr(r,n,o){return r.slice(n,o)}function strlen(r){return r.length}function sizeof(r){return r.length}function append(r,n){return n.push(r),r}function combine(r,n){return r.map(n).join("")}var line=1,column=1,length=0,position=0,character=0,characters="";function node(r,n,o,a,i,l,c){return{value:r,root:n,parent:o,type:a,props:i,children:l,line,column,length:c,return:""}}function copy(r,n){return assign(node("",null,null,"",null,null,0),r,{length:-r.length},n)}function char(){return character}function prev(){return character=position>0?charat(characters,--position):0,column--,character===10&&(column=1,line--),character}function next(){return character=position<length?charat(characters,position++):0,column++,character===10&&(column=1,line++),character}function peek(){return charat(characters,position)}function caret(){return position}function slice$1(r,n){return substr(characters,r,n)}function token(r){switch(r){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function alloc(r){return line=column=1,length=strlen(characters=r),position=0,[]}function dealloc(r){return characters="",r}function delimit(r){return trim(slice$1(position-1,delimiter(r===91?r+2:r===40?r+1:r)))}function whitespace(r){for(;(character=peek())&&character<33;)next();return token(r)>2||token(character)>3?"":" "}function escaping(r,n){for(;--n&&next()&&!(character<48||character>102||character>57&&character<65||character>70&&character<97););return slice$1(r,caret()+(n<6&&peek()==32&&next()==32))}function delimiter(r){for(;next();)switch(character){case r:return position;case 34:case 39:r!==34&&r!==39&&delimiter(character);break;case 40:r===41&&delimiter(r);break;case 92:next();break}return position}function commenter(r,n){for(;next()&&r+character!==57;)if(r+character===84&&peek()===47)break;return"/*"+slice$1(n,position-1)+"*"+from(r===47?r:next())}function identifier(r){for(;!token(peek());)next();return slice$1(r,position)}function compile(r){return dealloc(parse("",null,null,null,[""],r=alloc(r),0,[0],r))}function parse(r,n,o,a,i,l,c,u,d){for(var p=0,f=0,m=c,h=0,g=0,y=0,b=1,v=1,x=1,E=0,S="",w=i,R=l,A=a,C=S;v;)switch(y=E,E=next()){case 40:if(y!=108&&charat(C,m-1)==58){indexof(C+=replace(delimit(E),"&","&\f"),"&\f")!=-1&&(x=-1);break}case 34:case 39:case 91:C+=delimit(E);break;case 9:case 10:case 13:case 32:C+=whitespace(y);break;case 92:C+=escaping(caret()-1,7);continue;case 47:switch(peek()){case 42:case 47:append(comment(commenter(next(),caret()),n,o),d);break;default:C+="/"}break;case 123*b:u[p++]=strlen(C)*x;case 125*b:case 59:case 0:switch(E){case 0:case 125:v=0;case 59+f:x==-1&&(C=replace(C,/\f/g,"")),g>0&&strlen(C)-m&&append(g>32?declaration(C+";",a,o,m-1):declaration(replace(C," ","")+";",a,o,m-2),d);break;case 59:C+=";";default:if(append(A=ruleset(C,n,o,p,f,i,u,S,w=[],R=[],m),l),E===123)if(f===0)parse(C,n,A,A,w,l,m,u,R);else switch(h===99&&charat(C,3)===110?100:h){case 100:case 108:case 109:case 115:parse(r,A,A,a&&append(ruleset(r,A,A,0,0,i,u,S,i,w=[],m),R),i,R,m,u,a?w:R);break;default:parse(C,A,A,A,[""],R,0,u,R)}}p=f=g=0,b=x=1,S=C="",m=c;break;case 58:m=1+strlen(C),g=y;default:if(b<1){if(E==123)--b;else if(E==125&&b++==0&&prev()==125)continue}switch(C+=from(E),E*b){case 38:x=f>0?1:(C+="\f",-1);break;case 44:u[p++]=(strlen(C)-1)*x,x=1;break;case 64:peek()===45&&(C+=delimit(next())),h=peek(),f=m=strlen(S=C+=identifier(caret())),E++;break;case 45:y===45&&strlen(C)==2&&(b=0)}}return l}function ruleset(r,n,o,a,i,l,c,u,d,p,f){for(var m=i-1,h=i===0?l:[""],g=sizeof(h),y=0,b=0,v=0;y<a;++y)for(var x=0,E=substr(r,m+1,m=abs(b=c[y])),S=r;x<g;++x)(S=trim(b>0?h[x]+" "+E:replace(E,/&\f/g,h[x])))&&(d[v++]=S);return node(r,n,o,i===0?RULESET:u,d,p,f)}function comment(r,n,o){return node(r,n,o,COMMENT,from(char()),substr(r,2,-2),0)}function declaration(r,n,o,a){return node(r,n,o,DECLARATION,substr(r,0,a),substr(r,a+1,-1),a)}function serialize(r,n){for(var o="",a=sizeof(r),i=0;i<a;i++)o+=n(r[i],i,r,n)||"";return o}function stringify$2(r,n,o,a){switch(r.type){case LAYER:if(r.children.length)break;case IMPORT:case DECLARATION:return r.return=r.return||r.value;case COMMENT:return"";case KEYFRAMES:return r.return=r.value+"{"+serialize(r.children,a)+"}";case RULESET:r.value=r.props.join(",")}return strlen(o=serialize(r.children,a))?r.return=r.value+"{"+o+"}":""}function middleware(r){var n=sizeof(r);return function(o,a,i,l){for(var c="",u=0;u<n;u++)c+=r[u](o,a,i,l)||"";return c}}function rulesheet(r){return function(n){n.root||(n=n.return)&&r(n)}}var weakMemoize=function r(n){var o=new WeakMap;return function(a){if(o.has(a))return o.get(a);var i=n(a);return o.set(a,i),i}};function memoize(r){var n=Object.create(null);return function(o){return n[o]===void 0&&(n[o]=r(o)),n[o]}}var identifierWithPointTracking=function r(n,o,a){for(var i=0,l=0;i=l,l=peek(),i===38&&l===12&&(o[a]=1),!token(l);)next();return slice$1(n,position)},toRules=function r(n,o){var a=-1,i=44;do switch(token(i)){case 0:i===38&&peek()===12&&(o[a]=1),n[a]+=identifierWithPointTracking(position-1,o,a);break;case 2:n[a]+=delimit(i);break;case 4:if(i===44){n[++a]=peek()===58?"&\f":"",o[a]=n[a].length;break}default:n[a]+=from(i)}while(i=next());return n},getRules=function r(n,o){return dealloc(toRules(alloc(n),o))},fixedElements=new WeakMap,compat=function r(n){if(!(n.type!=="rule"||!n.parent||n.length<1)){for(var o=n.value,a=n.parent,i=n.column===a.column&&n.line===a.line;a.type!=="rule";)if(a=a.parent,!a)return;if(!(n.props.length===1&&o.charCodeAt(0)!==58&&!fixedElements.get(a))&&!i){fixedElements.set(n,!0);for(var l=[],c=getRules(o,l),u=a.props,d=0,p=0;d<c.length;d++)for(var f=0;f<u.length;f++,p++)n.props[p]=l[d]?c[d].replace(/&\f/g,u[f]):u[f]+" "+c[d]}}},removeLabel=function r(n){if(n.type==="decl"){var o=n.value;o.charCodeAt(0)===108&&o.charCodeAt(2)===98&&(n.return="",n.value="")}},ignoreFlag="emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason",isIgnoringComment=function r(n){return n.type==="comm"&&n.children.indexOf(ignoreFlag)>-1},createUnsafeSelectorsAlarm=function r(n){return function(o,a,i){if(!(o.type!=="rule"||n.compat)){var l=o.value.match(/(:first|:nth|:nth-last)-child/g);if(l){for(var c=!!o.parent,u=c?o.parent.children:i,d=u.length-1;d>=0;d--){var p=u[d];if(p.line<o.line)break;if(p.column<o.column){if(isIgnoringComment(p))return;break}}l.forEach(function(f){console.error('The pseudo class "'+f+'" is potentially unsafe when doing server-side rendering. Try changing it to "'+f.split("-child")[0]+'-of-type".')})}}}},isImportRule=function r(n){return n.type.charCodeAt(1)===105&&n.type.charCodeAt(0)===64},isPrependedWithRegularRules=function r(n,o){for(var a=n-1;a>=0;a--)if(!isImportRule(o[a]))return!0;return!1},nullifyElement=function r(n){n.type="",n.value="",n.return="",n.children="",n.props=""},incorrectImportAlarm=function r(n,o,a){isImportRule(n)&&(n.parent?(console.error("`@import` rules can't be nested inside other rules. Please move it to the top level and put it before regular rules. Keep in mind that they can only be used within global styles."),nullifyElement(n)):isPrependedWithRegularRules(o,a)&&(console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules."),nullifyElement(n)))};function prefix(r,n){switch(hash(r,n)){case 5103:return WEBKIT+"print-"+r+r;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return WEBKIT+r+r;case 5349:case 4246:case 4810:case 6968:case 2756:return WEBKIT+r+MOZ+r+MS+r+r;case 6828:case 4268:return WEBKIT+r+MS+r+r;case 6165:return WEBKIT+r+MS+"flex-"+r+r;case 5187:return WEBKIT+r+replace(r,/(\w+).+(:[^]+)/,WEBKIT+"box-$1$2"+MS+"flex-$1$2")+r;case 5443:return WEBKIT+r+MS+"flex-item-"+replace(r,/flex-|-self/,"")+r;case 4675:return WEBKIT+r+MS+"flex-line-pack"+replace(r,/align-content|flex-|-self/,"")+r;case 5548:return WEBKIT+r+MS+replace(r,"shrink","negative")+r;case 5292:return WEBKIT+r+MS+replace(r,"basis","preferred-size")+r;case 6060:return WEBKIT+"box-"+replace(r,"-grow","")+WEBKIT+r+MS+replace(r,"grow","positive")+r;case 4554:return WEBKIT+replace(r,/([^-])(transform)/g,"$1"+WEBKIT+"$2")+r;case 6187:return replace(replace(replace(r,/(zoom-|grab)/,WEBKIT+"$1"),/(image-set)/,WEBKIT+"$1"),r,"")+r;case 5495:case 3959:return replace(r,/(image-set\([^]*)/,WEBKIT+"$1$`$1");case 4968:return replace(replace(r,/(.+:)(flex-)?(.*)/,WEBKIT+"box-pack:$3"+MS+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+WEBKIT+r+r;case 4095:case 3583:case 4068:case 2532:return replace(r,/(.+)-inline(.+)/,WEBKIT+"$1$2")+r;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(strlen(r)-1-n>6)switch(charat(r,n+1)){case 109:if(charat(r,n+4)!==45)break;case 102:return replace(r,/(.+:)(.+)-([^]+)/,"$1"+WEBKIT+"$2-$3$1"+MOZ+(charat(r,n+3)==108?"$3":"$2-$3"))+r;case 115:return~indexof(r,"stretch")?prefix(replace(r,"stretch","fill-available"),n)+r:r}break;case 4949:if(charat(r,n+1)!==115)break;case 6444:switch(charat(r,strlen(r)-3-(~indexof(r,"!important")&&10))){case 107:return replace(r,":",":"+WEBKIT)+r;case 101:return replace(r,/(.+:)([^;!]+)(;|!.+)?/,"$1"+WEBKIT+(charat(r,14)===45?"inline-":"")+"box$3$1"+WEBKIT+"$2$3$1"+MS+"$2box$3")+r}break;case 5936:switch(charat(r,n+11)){case 114:return WEBKIT+r+MS+replace(r,/[svh]\w+-[tblr]{2}/,"tb")+r;case 108:return WEBKIT+r+MS+replace(r,/[svh]\w+-[tblr]{2}/,"tb-rl")+r;case 45:return WEBKIT+r+MS+replace(r,/[svh]\w+-[tblr]{2}/,"lr")+r}return WEBKIT+r+MS+r+r}return r}var prefixer=function r(n,o,a,i){if(n.length>-1&&!n.return)switch(n.type){case DECLARATION:n.return=prefix(n.value,n.length);break;case KEYFRAMES:return serialize([copy(n,{value:replace(n.value,"@","@"+WEBKIT)})],i);case RULESET:if(n.length)return combine(n.props,function(l){switch(match(l,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize([copy(n,{props:[replace(l,/:(read-\w+)/,":"+MOZ+"$1")]})],i);case"::placeholder":return serialize([copy(n,{props:[replace(l,/:(plac\w+)/,":"+WEBKIT+"input-$1")]}),copy(n,{props:[replace(l,/:(plac\w+)/,":"+MOZ+"$1")]}),copy(n,{props:[replace(l,/:(plac\w+)/,MS+"input-$1")]})],i)}return""})}},defaultStylisPlugins=[prefixer],createCache=function r(n){var o=n.key;if(process.env.NODE_ENV!=="production"&&!o)throw new Error(`You have to configure \`key\` for your cache. Please make sure it's unique (and not equal to 'css') as it's used for linking styles to your cache.
63
63
  If multiple caches share the same key they might "fight" for each other's style elements.`);if(o==="css"){var a=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(a,function(b){var v=b.getAttribute("data-emotion");v.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var i=n.stylisPlugins||defaultStylisPlugins;if(process.env.NODE_ENV!=="production"&&/[^a-z-]/.test(o))throw new Error('Emotion key must only contain lower case alphabetical characters and - but "'+o+'" was passed');var l={},c,u=[];c=n.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+o+' "]'),function(b){for(var v=b.getAttribute("data-emotion").split(" "),x=1;x<v.length;x++)l[v[x]]=!0;u.push(b)});var d,p=[compat,removeLabel];process.env.NODE_ENV!=="production"&&p.push(createUnsafeSelectorsAlarm({get compat(){return y.compat}}),incorrectImportAlarm);{var f,m=[stringify$2,process.env.NODE_ENV!=="production"?function(b){b.root||(b.return?f.insert(b.return):b.value&&b.type!==COMMENT&&f.insert(b.value+"{}"))}:rulesheet(function(b){f.insert(b)})],h=middleware(p.concat(i,m)),g=function(v){return serialize(compile(v),h)};d=function(v,x,E,S){f=E,process.env.NODE_ENV!=="production"&&x.map!==void 0&&(f={insert:function(R){E.insert(R+x.map)}}),g(v?v+"{"+x.styles+"}":x.styles),S&&(y.inserted[x.name]=!0)}}var y={key:o,sheet:new StyleSheet({key:o,container:c,nonce:n.nonce,speedy:n.speedy,prepend:n.prepend,insertionPoint:n.insertionPoint}),nonce:n.nonce,inserted:l,registered:{},insert:d};return y.sheet.hydrate(u),y};function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(r){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(r[a]=o[a])}return r},_extends$2.apply(this,arguments)}var reactIs$1={exports:{}},reactIs_production_min={};/** @license React v16.13.1
64
64
  * react-is.production.min.js
@@ -220,4 +220,4 @@ object-assign/index.js:
220
220
  (c) Sindre Sorhus
221
221
  @license MIT
222
222
  *)
223
- */init_react_shim();var DevTools=process.env.NODE_ENV!=="production"?InternalDevTools:()=>null;function getDNDSupport(){return new URLSearchParams(window.location.search).has("dnd")}const FEATURE_TOGGLES={dnd:getDNDSupport()},getParentNodeIds=(r,n)=>{const o=[];let a=lodashEs.find(r,{_id:n}),i=lodashEs.get(a,"_parent","");for(;lodashEs.isString(i)&&!lodashEs.isEmpty(i);)o.push(a==null?void 0:a._parent),a=lodashEs.find(r,{_id:i}),i=a==null?void 0:a._parent;return lodashEs.flatten(o)},expandedIdsAtom=jotai.atom([]),useExpandTree=()=>{const[r]=useSelectedBlockIds(),n=jotai.useAtomValue(presentBlocksAtom),[,o]=jotai.useAtom(expandedIdsAtom);React.useEffect(()=>{let a=[];const i=lodashEs.first(r);lodashEs.isString(i)&&(a=[i,...getParentNodeIds(n,i)]),o(a)},[r,n,o])},UndoRedo=()=>{const{hasUndo:r,hasRedo:n,undo:o,redo:a}=useUndoManager();return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:!r(),size:"sm",onClick:o,className:"rounded-full",variant:"ghost",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ResetIcon,{})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:!n(),onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function DarkMode(){const[r,n]=useDarkMode();return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SunIcon,{className:"size-4 shrink-0"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Switch,{id:"dark-mode-switch",checked:r,onCheckedChange:()=>{n(!r)},className:`${r?"bg-violet-600":"bg-violet-300"} relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:jsxRuntime.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${r?"translate-x-5":"translate-x-0"} pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})}),jsxRuntime.jsxRuntimeExports.jsx(FaMoon,{className:"size-4 ml-3 shrink-0"})]})}const TabletIcon=({landscape:r=!1})=>jsxRuntime.jsxRuntimeExports.jsx("svg",{className:r?"rotate-90":"",stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 448 512",height:"14px",width:"14px",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsxRuntimeExports.jsx("path",{d:"M400 0H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zM224 480c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm176-108c0 6.6-5.4 12-12 12H60c-6.6 0-12-5.4-12-12V60c0-6.6 5.4-12 12-12h328c6.6 0 12 5.4 12 12v312z"})}),WEB_BREAKPOINTS=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:jsxRuntime.jsxRuntimeExports.jsx(TabletIcon,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:jsxRuntime.jsxRuntimeExports.jsx(TabletIcon,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DesktopIcon,{}),width:1920}],BreakpointCard=({title:r,content:n,currentBreakpoint:o,breakpoint:a,width:i,icon:l,onClick:c})=>{const{t:u}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.HoverCard,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.HoverCardTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:()=>c(i),size:"sm",variant:a===o?"secondary":"ghost",children:l})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.HoverCardContent,{className:"w-52 border-border",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:u(r)}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs",children:u(n)})]})})})]})},Breakpoints=()=>{const[,r,n]=useCanvasWidth(),[o,a]=useSelectedBreakpoints(),{t:i}=reactI18next.useTranslation(),l=useBuilderProp("breakpoints",WEB_BREAKPOINTS),c=u=>{o.includes(u)?o.length>2&&a(o.filter(d=>d!==u)):a(d=>[...d,u])};return l.length<4?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:lodashEs.map(l,u=>React.createElement(BreakpointCard,{...u,onClick:n,key:u.breakpoint,currentBreakpoint:r}))}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[lodashEs.map(l.filter(u=>lodashEs.includes(o,lodashEs.toUpper(u.breakpoint))),u=>React.createElement(BreakpointCard,{...u,onClick:n,key:u.breakpoint,currentBreakpoint:r})),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenu,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DotsVerticalIcon,{className:"scale-90 transform"})})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuLabel,{children:i("Breakpoints")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuSeparator,{}),lodashEs.map(l,u=>jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuCheckboxItem,{disabled:u.breakpoint==="xs",onCheckedChange:()=>c(lodashEs.toUpper(u.breakpoint)),checked:lodashEs.includes(o,lodashEs.toUpper(u.breakpoint)),children:i(u.title)},u.breakpoint))]})]})]})},ClearCanvas=()=>{const{t:r}=reactI18next.useTranslation(),{setNewBlocks:n}=useBlocksStoreUndoableActions(),[,o]=useSelectedBlockIds(),[,a]=useSelectedStylingBlocks(),i=React.useCallback(()=>{n([]),o([]),a([])},[n]);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialog,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.EraserIcon,{})," ",r("Clear")]})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogContent,{className:"border-border",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogHeader,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTitle,{className:"text-foreground",children:r("Clear Canvas")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogDescription,{children:r("Are you sure you want to clear the page?")})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogFooter,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogCancel,{className:"text-foreground",children:r("Cancel")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogAction,{onClick:i,children:r("Yes")})]})]})]})})},CanvasTopBar=()=>{const r=useBuilderProp("darkMode",!0),[n]=useCanvasZoom();return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-border bg-background/70 px-2",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx(Breakpoints,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Separator,{orientation:"vertical"}),r?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(DarkMode,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Separator,{orientation:"vertical"})]}):null,jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[lodashEs.round(n,0),"%"]})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Separator,{orientation:"vertical"}),jsxRuntime.jsxRuntimeExports.jsx(UndoRedo,{})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex h-full items-center space-x-2",children:jsxRuntime.jsxRuntimeExports.jsx(ClearCanvas,{})})]})},SettingsPanel=()=>{const r=useSelectedBlock(),{t:n}=reactI18next.useTranslation(),[o,a]=React.useState(!0),i=useBuilderProp("onError",lodashEs.noop);return lodashEs.isNull(r)?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4 text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),jsxRuntime.jsxRuntimeExports.jsx("h1",{children:n("please_select_a_block_to_edit")})]})}):jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:i,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex max-h-full w-full flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx(BlockSettings,{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx(BlockStyling,{}),jsxRuntime.jsxRuntimeExports.jsxs("div",{onClick:()=>a(!o),className:"flex cursor-pointer items-center justify-between border-b border-border py-2 text-sm font-bold text-muted-foreground hover:underline",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:n("Attributes")}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronDown,{className:"h-4 w-4 text-gray-500 "+(o?"rotate-180":"")})})]}),o&&jsxRuntime.jsxRuntimeExports.jsx(BlockAttributesEditor,{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})})},SettingsPanel$1=SettingsPanel;function LayoutCard({disabled:r=!1,description:n,title:o,selected:a,onSelect:i,children:l}){const{t:c}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Card,{"aria-disabled":r,className:`cursor-pointer border-border transition-all ${a?"ring-2 ring-secondary":""} ${r?"cursor-not-allowed opacity-50":""}`,onClick:i,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.CardContent,{className:"p-4",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxRuntimeExports.jsx("h3",{className:"text-lg font-semibold",children:o}),a&&jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CheckIcon,{className:"h-6 w-6 rounded-full bg-background p-px text-foreground"})]}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:n}),l,jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:r,className:"mt-4 w-full",variant:a?"default":"outline",children:c(r?"Coming soon":a?"Selected":"Select")})]})})}const ChooseLayout=({open:r,close:n})=>{const{t:o}=reactI18next.useTranslation(),[a,i]=useLayoutVariant(),l=c=>{i(c),n()};return jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialog,{open:r,onOpenChange:()=>r?n():"",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogContent,{className:"max-w-4xl overflow-hidden border-border",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogHeader,{className:"flex flex-row items-center justify-between",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTitle,{className:"text-foreground",children:o("Choose Builder Layout")}),jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:()=>n(),className:"text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Cross2Icon,{className:"h-6 w-6"})})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar max-h-full overflow-hidden",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxRuntime.jsxRuntimeExports.jsx(LayoutCard,{title:o("Single side panel"),description:o("Suitable for smaller screens. Bigger canvas size."),selected:a===LAYOUT_MODE.SINGLE_SIDE_PANEL,onSelect:()=>l(LAYOUT_MODE.SINGLE_SIDE_PANEL),children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col rounded border border-border",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"borde-b h-4 border-b border-border"}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-32",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-3/4 border-l border-border bg-background"})]})]})}),jsxRuntime.jsxRuntimeExports.jsx(LayoutCard,{title:o("Dual side panel"),description:o("Suitable for larger screens. Blocks settings is always visible."),selected:a===LAYOUT_MODE.DUAL_SIDE_PANEL,onSelect:()=>l(LAYOUT_MODE.DUAL_SIDE_PANEL),children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col rounded border border-border",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"borde-b h-4 border-b border-border"}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-32",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-2/4 border-x border-border bg-background"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"})]})]})}),jsxRuntime.jsxRuntimeExports.jsx(LayoutCard,{disabled:!0,title:o("Dual side panel advanced"),description:o("Suitable for heavy styling & block editing. Setting are always visible."),selected:!1,onSelect:()=>{},children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col rounded border border-border",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"borde-b h-4 border-b border-border"}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-32",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-2/4 border-x border-border bg-background"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"})]})]})})]})})]})})},HotKeys=()=>{const{t:r}=reactI18next.useTranslation(),n={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Dialog,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTrigger,{children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"ghost",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.KeyboardIcon,{})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{side:"right",children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:r("Keyboard shortcuts")})})]})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DialogContent,{className:"border-border sm:max-w-[525px]",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogHeader,{children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTitle,{className:"text-foreground",children:r("Keyboard shortcuts")})}),jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-border",children:Object.keys(n).map(a=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Badge,{variant:"outline",className:"border border-border p-1 px-2",children:r(a)}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-muted-foreground",children:r(n[a])})]},a))}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(a=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Badge,{variant:"outline",className:"border border-border p-1 px-2",children:r(a)}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-muted-foreground",children:r(o[a])})]},a))})]})})]})]})},TopBar=React.lazy(()=>Promise.resolve().then(()=>require("./Topbar-z2HUDRQZ.cjs"))),useAutoSave=()=>{const{savePage:r}=useSavePage(),n=useBuilderProp("autoSaveSupport",!0),o=useBuilderProp("autoSaveInterval",60);web.useIntervalEffect(()=>{n&&r()},o*1e3)};function useSidebarMenuItems(r){const n=r===LAYOUT_MODE.SINGLE_SIDE_PANEL;return React.useMemo(()=>{const o=[{icon:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Layers,{size:20}),label:"sidebar.outline",component:()=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-8",children:jsxRuntime.jsxRuntimeExports.jsx(Outline$1,{})})},n?{icon:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.EditIcon,{size:16}),label:"sidebar.edit_block",component:SettingsPanel$1}:null,{icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.LightningBoltIcon,{className:"size-5"}),label:"sidebar.ai_assistant",component:AskAI},{icon:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.PaintBucketIcon,{size:20}),label:"sidebar.theme",component:()=>jsxRuntime.jsxRuntimeExports.jsx(ThemeOptions,{showHeading:!1})}];return lodashEs.compact(o)},[r])}function isDualLayout(r){return r!==LAYOUT_MODE.SINGLE_SIDE_PANEL}const RootLayout=()=>{const[r,n]=React.useState(0),[o]=useLayoutVariant(),[a,i]=React.useState(!1);useChaiBuilderMsgListener(({name:h})=>{h===CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS&&n(1)});const l=useBuilderProp("sideBarComponents.top",[]),c=h=>{h.preventDefault()};jotai.useAtom(selectedLibraryAtom),useKeyEventWatcher(),useExpandTree(),useAutoSave();const u=h=>{n(r===h?null:h)},d=useSidebarMenuItems(o),{t:p}=reactI18next.useTranslation(),f=[...d,...l],m=useBuilderProp("htmlDir","ltr");return jsxRuntime.jsxRuntimeExports.jsx("div",{dir:m,className:"h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.TooltipProvider,{children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{onContextMenu:c,className:"flex h-screen max-h-full flex-col bg-background text-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:jsxRuntime.jsxRuntimeExports.jsx(TopBar,{})})}),jsxRuntime.jsxRuntimeExports.jsxs("main",{className:"relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex w-12 flex-col items-center justify-between border-r border-border py-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col",children:f.map((h,g)=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:r===g?"default":"ghost",className:"mb-2 rounded-lg p-2 transition-colors",onClick:()=>u(g),children:lodashEs.get(h,"icon",null)},g)}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{side:"right",children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:p(h.label)})})]},"button"+g))}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-1",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"ghost",onClick:()=>i(!0),children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.LayoutTemplate,{size:20})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{side:"right",children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:p("Choose Builder Layout")})})]}),jsxRuntime.jsxRuntimeExports.jsx(HotKeys,{})]})]}),jsxRuntime.jsxRuntimeExports.jsx(framerMotion.motion.div,{className:"h-full max-h-full border-r border-border",initial:{width:280},animate:{width:r!==null?280:0},transition:{duration:.3,ease:"easeInOut"},children:r!==null&&jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar overflow h-full overflow-x-hidden",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col p-3",children:[jsxRuntime.jsxRuntimeExports.jsxs("h2",{className:"-mt-1 flex h-10 items-center space-x-1 text-base font-bold",children:[lodashEs.get(f,`${r}.icon`,null),jsxRuntime.jsxRuntimeExports.jsx("span",{children:p(f[r].label)})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex-1",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx("div",{children:"Loading..."}),children:React.createElement(lodashEs.get(f,`${r}.component`,null),{})})})]})})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full max-h-full flex-1 flex-col bg-slate-800/20",children:[jsxRuntime.jsxRuntimeExports.jsx(CanvasTopBar,{}),jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:jsxRuntime.jsxRuntimeExports.jsx(CanvasArea$1,{})})]}),isDualLayout(o)?jsxRuntime.jsxRuntimeExports.jsx(framerMotion.motion.div,{className:"h-full max-h-full border-l border-border",initial:{width:280},animate:{width:280},transition:{duration:.3,ease:"easeInOut"},children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar overflow h-full max-h-full overflow-x-hidden",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex max-h-full flex-col p-3",children:[jsxRuntime.jsxRuntimeExports.jsxs("h2",{className:"-mt-1 flex h-10 items-center space-x-1 text-base font-bold",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.EditIcon,{size:"16"}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:p("Block Settings")})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex-1",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx("div",{children:"Loading..."}),children:jsxRuntime.jsxRuntimeExports.jsx(SettingsPanel$1,{})})})]})})}):null]})]}),jsxRuntime.jsxRuntimeExports.jsx(AddBlocksDialog,{}),jsxRuntime.jsxRuntimeExports.jsx(ChooseLayout,{open:a,close:()=>i(!1)})]})})},builderStore=jotai.getDefaultStore(),SmallScreenMessage=()=>jsxRuntime.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen bg-gray-900 py-12 sm:py-16 lg:py-20 xl:hidden",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mx-auto max-w-md text-center",children:[jsxRuntime.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"}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("h2",{className:"text-4xl font-bold text-white",children:"Screen too small"}),jsxRuntime.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."})]})})}),setDebugLogs=r=>{},PreviewScreen=()=>{const[r,n]=usePreviewMode(),{t:o}=reactI18next.useTranslation(),a=useBuilderProp("previewComponent",null);return r?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("fixed inset-0 z-[999] bg-background",r?"block":"hidden"),children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{size:"sm",className:"absolute right-0 top-0 m-4 space-x-2",onClick:()=>n(!1),children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.EyeClosedIcon,{}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:o("close_preview")})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{children:a?jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-96 w-full"}),children:React.createElement(a)}):null})]}):null},ChaiBuilderComponent=r=>{const[,n]=useBlocksStore(),[,o]=useBrandingOptions(),a=useBuilderReset(),[i]=useAtom(builderSaveStateAtom),l=React.useMemo(()=>r.layout||RootLayout,[r.layout]);return React.useEffect(()=>{builderStore.set(chaiBuilderPropsAtom,lodashEs.omit(r,["blocks","subPages","brandingOptions","dataProviders","customRootLayout","translations"]))},[r]),React.useEffect(()=>{builderStore.set(dataProvidersAtom,r.dataProviders||[])},[r.dataProviders]),React.useEffect(()=>{n(runtime.syncBlocksWithDefaults(r.blocks||[])),a()},[r.blocks]),React.useEffect(()=>{i18n.changeLanguage(r.locale||"en")},[r.locale]),React.useEffect(()=>{setDebugLogs(r.showDebugLogs)},[r.showDebugLogs]),React.useEffect(()=>{r.translations&&lodashEs.each(r.translations,(c,u)=>{i18n.addResourceBundle(u,"translation",c,!0,!0)})},[r.translations]),React.useEffect(()=>{o(r.brandingOptions)},[r.brandingOptions,o]),React.useEffect(()=>(i!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[i]),jsxRuntime.jsxRuntimeExports.jsx(l,{})},ChaiBuilderEditor=r=>{const n=r._flags||{},o=r.onError||lodashEs.noop;return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen",children:jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:o,children:jsxRuntime.jsxRuntimeExports.jsxs(flagged.FlagsProvider,{features:{...FEATURE_TOGGLES,...n},children:[jsxRuntime.jsxRuntimeExports.jsx(DevTools,{}),jsxRuntime.jsxRuntimeExports.jsx(SmallScreenMessage,{}),jsxRuntime.jsxRuntimeExports.jsx(ChaiBuilderComponent,{...r}),jsxRuntime.jsxRuntimeExports.jsx(PreviewScreen,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Toaster,{})]})})})};exports.AISetContext=AISetContext;exports.AIUserPrompt=AIUserPrompt;exports.AddBlocksDialog=AddBlocksDialog;exports.AddBlocksPanel=AddBlocksPanel$1;exports.BlockAttributesEditor=BlockAttributesEditor;exports.BlockSettings=BlockSettings;exports.BlockStyling=BlockStyling;exports.Breakpoints=Breakpoints;exports.CHAI_BUILDER_EVENTS=CHAI_BUILDER_EVENTS;exports.CanvasArea=CanvasArea$1;exports.ChaiBuilderEditor=ChaiBuilderEditor;exports.ChaiSelect=ChaiSelect$1;exports.DarkMode=DarkMode;exports.DefaultChaiBlocks=DefaultChaiBlocks;exports.FaCheck=FaCheck;exports.ImportHTML=ImportHTML$1;exports.Outline=Outline$1;exports.ThemeOptions=ThemeOptions;exports.UILibraries=UILibraries;exports.UndoRedo=UndoRedo;exports.emitChaiBuilderMsg=emitChaiBuilderMsg;exports.getBlocksFromHTML=getBlocksFromHTML;exports.useActiveModal=useActiveModal;exports.useActivePanel=useActivePanel;exports.useAddBlock=useAddBlock;exports.useAddBlockParent=useAddBlockParent;exports.useAddClassesToBlocks=useAddClassesToBlocks;exports.useAllBlocks=useAllBlocks;exports.useBlocksStore=useBlocksStore;exports.useBlocksStoreUndoableActions=useBlocksStoreUndoableActions;exports.useBrandingOptions=useBrandingOptions;exports.useBuilderProp=useBuilderProp;exports.useBuilderReset=useBuilderReset;exports.useCanvasWidth=useCanvasWidth;exports.useCanvasZoom=useCanvasZoom;exports.useChaiBuilderMsgListener=useChaiBuilderMsgListener;exports.useCodeEditor=useCodeEditor;exports.useCopyBlockIds=useCopyBlockIds;exports.useCopyToClipboard=useCopyToClipboard;exports.useCurrentPage=useCurrentPage;exports.useCutBlockIds=useCutBlockIds;exports.useDarkMode=useDarkMode;exports.useDuplicateBlocks=useDuplicateBlocks;exports.useGetPageData=useGetPageData;exports.useHiddenBlockIds=useHiddenBlockIds;exports.useHighlightBlockId=useHighlightBlockId;exports.useLayoutVariant=useLayoutVariant;exports.usePasteBlocks=usePasteBlocks;exports.usePreviewMode=usePreviewMode;exports.useReadOnlyMode=useReadOnlyMode;exports.useRemoveBlocks=useRemoveBlocks;exports.useRemoveClassesFromBlocks=useRemoveClassesFromBlocks;exports.useSavePage=useSavePage;exports.useSelectedBlock=useSelectedBlock;exports.useSelectedBlockAllClasses=useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=useSelectedBreakpoints;exports.useSelectedStylingBlocks=useSelectedStylingBlocks;exports.useStylingBreakpoint=useStylingBreakpoint;exports.useStylingState=useStylingState;exports.useUILibraryBlocks=useUILibraryBlocks;exports.useUndoManager=useUndoManager;exports.useUpdateBlocksProps=useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=useUpdateBlocksPropsRealtime;
223
+ */init_react_shim();var DevTools=process.env.NODE_ENV!=="production"?InternalDevTools:()=>null;function getDNDSupport(){return new URLSearchParams(window.location.search).has("dnd")}const FEATURE_TOGGLES={dnd:getDNDSupport()},getParentNodeIds=(r,n)=>{const o=[];let a=lodashEs.find(r,{_id:n}),i=lodashEs.get(a,"_parent","");for(;lodashEs.isString(i)&&!lodashEs.isEmpty(i);)o.push(a==null?void 0:a._parent),a=lodashEs.find(r,{_id:i}),i=a==null?void 0:a._parent;return lodashEs.flatten(o)},expandedIdsAtom=jotai.atom([]),useExpandTree=()=>{const[r]=useSelectedBlockIds(),n=jotai.useAtomValue(presentBlocksAtom),[,o]=jotai.useAtom(expandedIdsAtom);React.useEffect(()=>{let a=[];const i=lodashEs.first(r);lodashEs.isString(i)&&(a=[i,...getParentNodeIds(n,i)]),o(a)},[r,n,o])},UndoRedo=()=>{const{hasUndo:r,hasRedo:n,undo:o,redo:a}=useUndoManager();return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:!r(),size:"sm",onClick:o,className:"rounded-full",variant:"ghost",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ResetIcon,{})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:!n(),onClick:a,size:"sm",className:"rounded-full",variant:"ghost",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function DarkMode(){const[r,n]=useDarkMode();return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SunIcon,{className:"size-4 shrink-0"}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Switch,{id:"dark-mode-switch",checked:r,onCheckedChange:()=>{n(!r)},className:`${r?"bg-violet-600":"bg-violet-300"} relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:jsxRuntime.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${r?"translate-x-5":"translate-x-0"} pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})}),jsxRuntime.jsxRuntimeExports.jsx(FaMoon,{className:"size-4 ml-3 shrink-0"})]})}const TabletIcon=({landscape:r=!1})=>jsxRuntime.jsxRuntimeExports.jsx("svg",{className:r?"rotate-90":"",stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 448 512",height:"14px",width:"14px",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsxRuntimeExports.jsx("path",{d:"M400 0H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48zM224 480c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm176-108c0 6.6-5.4 12-12 12H60c-6.6 0-12-5.4-12-12V60c0-6.6 5.4-12 12-12h328c6.6 0 12 5.4 12 12v312z"})}),WEB_BREAKPOINTS=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:jsxRuntime.jsxRuntimeExports.jsx(TabletIcon,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:jsxRuntime.jsxRuntimeExports.jsx(TabletIcon,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DesktopIcon,{}),width:1920}],BreakpointCard=({title:r,content:n,currentBreakpoint:o,breakpoint:a,width:i,icon:l,onClick:c})=>{const{t:u}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.HoverCard,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.HoverCardTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:()=>c(i),size:"sm",variant:a===o?"secondary":"ghost",children:l})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.HoverCardContent,{className:"w-52 border-border",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:u(r)}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"text-xs",children:u(n)})]})})})]})},Breakpoints=()=>{const[,r,n]=useCanvasWidth(),[o,a]=useSelectedBreakpoints(),{t:i}=reactI18next.useTranslation(),l=useBuilderProp("breakpoints",WEB_BREAKPOINTS),c=u=>{o.includes(u)?o.length>2&&a(o.filter(d=>d!==u)):a(d=>[...d,u])};return l.length<4?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:lodashEs.map(l,u=>React.createElement(BreakpointCard,{...u,onClick:n,key:u.breakpoint,currentBreakpoint:r}))}):jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[lodashEs.map(l.filter(u=>lodashEs.includes(o,lodashEs.toUpper(u.breakpoint))),u=>React.createElement(BreakpointCard,{...u,onClick:n,key:u.breakpoint,currentBreakpoint:r})),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenu,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DotsVerticalIcon,{className:"scale-90 transform"})})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuLabel,{children:i("Breakpoints")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuSeparator,{}),lodashEs.map(l,u=>jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DropdownMenuCheckboxItem,{disabled:u.breakpoint==="xs",onCheckedChange:()=>c(lodashEs.toUpper(u.breakpoint)),checked:lodashEs.includes(o,lodashEs.toUpper(u.breakpoint)),children:i(u.title)},u.breakpoint))]})]})]})},ClearCanvas=()=>{const{t:r}=reactI18next.useTranslation(),{setNewBlocks:n}=useBlocksStoreUndoableActions(),[,o]=useSelectedBlockIds(),[,a]=useSelectedStylingBlocks(),i=React.useCallback(()=>{n([]),o([]),a([])},[n]);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialog,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.EraserIcon,{})," ",r("Clear")]})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogContent,{className:"border-border",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogHeader,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTitle,{className:"text-foreground",children:r("Clear Canvas")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogDescription,{children:r("Are you sure you want to clear the page?")})]}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogFooter,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogCancel,{className:"text-foreground",children:r("Cancel")}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogAction,{onClick:i,children:r("Yes")})]})]})]})})},CanvasTopBar=()=>{const r=useBuilderProp("darkMode",!0),[n]=useCanvasZoom();return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b border-border bg-background/70 px-2",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx(Breakpoints,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Separator,{orientation:"vertical"}),r?jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx(DarkMode,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Separator,{orientation:"vertical"})]}):null,jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[lodashEs.round(n,0),"%"]})]}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Separator,{orientation:"vertical"}),jsxRuntime.jsxRuntimeExports.jsx(UndoRedo,{})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex h-full items-center space-x-2",children:jsxRuntime.jsxRuntimeExports.jsx(ClearCanvas,{})})]})},SettingsPanel=()=>{const r=useSelectedBlock(),{t:n}=reactI18next.useTranslation(),[o,a]=React.useState(!0),i=useBuilderProp("onError",lodashEs.noop);return lodashEs.isNull(r)?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4 text-muted-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),jsxRuntime.jsxRuntimeExports.jsx("h1",{children:n("please_select_a_block_to_edit")})]})}):jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:i,children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex max-h-full w-full flex-col",children:[jsxRuntime.jsxRuntimeExports.jsx(BlockSettings,{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx(BlockStyling,{}),jsxRuntime.jsxRuntimeExports.jsxs("div",{onClick:()=>a(!o),className:"flex cursor-pointer items-center justify-between border-b border-border py-2 text-sm font-bold text-muted-foreground hover:underline",children:[jsxRuntime.jsxRuntimeExports.jsx("span",{children:n("Attributes")}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronDown,{className:"h-4 w-4 text-gray-500 "+(o?"rotate-180":"")})})]}),o&&jsxRuntime.jsxRuntimeExports.jsx(BlockAttributesEditor,{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})})},SettingsPanel$1=SettingsPanel;function LayoutCard({disabled:r=!1,description:n,title:o,selected:a,onSelect:i,children:l}){const{t:c}=reactI18next.useTranslation();return jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Card,{"aria-disabled":r,className:`cursor-pointer border-border transition-all ${a?"ring-2 ring-secondary":""} ${r?"cursor-not-allowed opacity-50":""}`,onClick:i,children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.CardContent,{className:"p-4",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxRuntimeExports.jsx("h3",{className:"text-lg font-semibold",children:o}),a&&jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CheckIcon,{className:"h-6 w-6 rounded-full bg-background p-px text-foreground"})]}),jsxRuntime.jsxRuntimeExports.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:n}),l,jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{disabled:r,className:"mt-4 w-full",variant:a?"default":"outline",children:c(r?"Coming soon":a?"Selected":"Select")})]})})}const ChooseLayout=({open:r,close:n})=>{const{t:o}=reactI18next.useTranslation(),[a,i]=useLayoutVariant(),l=c=>{i(c),n()};return jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialog,{open:r,onOpenChange:()=>r?n():"",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogContent,{className:"max-w-4xl overflow-hidden border-border",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.AlertDialogHeader,{className:"flex flex-row items-center justify-between",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.AlertDialogTitle,{className:"text-foreground",children:o("Choose Builder Layout")}),jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:()=>n(),className:"text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Cross2Icon,{className:"h-6 w-6"})})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar max-h-full overflow-hidden",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[jsxRuntime.jsxRuntimeExports.jsx(LayoutCard,{title:o("Single side panel"),description:o("Suitable for smaller screens. Bigger canvas size."),selected:a==="SINGLE_SIDE_PANEL",onSelect:()=>l("SINGLE_SIDE_PANEL"),children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col rounded border border-border",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"borde-b h-4 border-b border-border"}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-32",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-3/4 border-l border-border bg-background"})]})]})}),jsxRuntime.jsxRuntimeExports.jsx(LayoutCard,{title:o("Dual side panel"),description:o("Suitable for larger screens. Blocks settings is always visible."),selected:a==="DUAL_SIDE_PANEL",onSelect:()=>l("DUAL_SIDE_PANEL"),children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col rounded border border-border",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"borde-b h-4 border-b border-border"}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-32",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-2/4 border-x border-border bg-background"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"})]})]})}),jsxRuntime.jsxRuntimeExports.jsx(LayoutCard,{disabled:!0,title:o("Dual side panel advanced"),description:o("Suitable for heavy styling & block editing. Setting are always visible."),selected:!1,onSelect:()=>{},children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col rounded border border-border",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"borde-b h-4 border-b border-border"}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-32",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-2/4 border-x border-border bg-background"}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-1/4 bg-secondary"})]})]})})]})})]})})},HotKeys=()=>{const{t:r}=reactI18next.useTranslation(),n={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Dialog,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTrigger,{children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"ghost",children:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.KeyboardIcon,{className:"size-8"})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{side:"right",children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:r("Keyboard shortcuts")})})]})}),jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.DialogContent,{className:"border-border sm:max-w-[525px]",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogHeader,{children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.DialogTitle,{className:"text-foreground",children:r("Keyboard shortcuts")})}),jsxRuntime.jsxRuntimeExports.jsx("div",{children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-border",children:Object.keys(n).map(a=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Badge,{variant:"outline",className:"border border-border p-1 px-2",children:r(a)}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-muted-foreground",children:r(n[a])})]},a))}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(a=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Badge,{variant:"outline",className:"border border-border p-1 px-2",children:r(a)}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"text-muted-foreground",children:r(o[a])})]},a))})]})})]})]})},TopBar=React.lazy(()=>Promise.resolve().then(()=>require("./Topbar-s9YVXp9Z.cjs"))),useAutoSave=()=>{const{savePage:r}=useSavePage(),n=useBuilderProp("autoSaveSupport",!0),o=useBuilderProp("autoSaveInterval",60);web.useIntervalEffect(()=>{n&&r()},o*1e3)};function useSidebarMenuItems(r){const n=r==="SINGLE_SIDE_PANEL";return React.useMemo(()=>{const o=[{icon:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Layers,{size:20}),label:"sidebar.outline",component:()=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mt-8",children:jsxRuntime.jsxRuntimeExports.jsx(Outline$1,{})})},n?{icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.GearIcon,{className:"size-5"}),label:"sidebar.edit_block",component:SettingsPanel$1}:null,{icon:jsxRuntime.jsxRuntimeExports.jsx(reactIcons.LightningBoltIcon,{className:"size-5"}),label:"sidebar.ai_assistant",component:AskAI},{icon:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.PaintBucketIcon,{size:20}),label:"sidebar.theme",component:()=>jsxRuntime.jsxRuntimeExports.jsx(ThemeOptions,{showHeading:!1})}];return lodashEs.compact(o)},[n])}function isDualLayout(r){return r!=="SINGLE_SIDE_PANEL"}const RootLayout=()=>{const[r,n]=React.useState(0),[o]=useLayoutVariant(),[a,i]=React.useState(!1);useChaiBuilderMsgListener(({name:h})=>{h===CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS&&n(1)});const l=useBuilderProp("sideBarComponents.top",[]),c=h=>{h.preventDefault()};jotai.useAtom(selectedLibraryAtom),useKeyEventWatcher(),useExpandTree(),useAutoSave();const u=h=>{n(r===h?null:h)},d=useSidebarMenuItems(o),{t:p}=reactI18next.useTranslation(),f=[...d,...l],m=useBuilderProp("htmlDir","ltr");return jsxRuntime.jsxRuntimeExports.jsx("div",{dir:m,className:"h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground",children:jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.TooltipProvider,{children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{onContextMenu:c,className:"flex h-screen max-h-full flex-col bg-background text-foreground",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-14 w-screen shrink-0 border-b border-border",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:jsxRuntime.jsxRuntimeExports.jsx(TopBar,{})})}),jsxRuntime.jsxRuntimeExports.jsxs("main",{className:"relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex w-12 flex-col items-center justify-between border-r border-border py-2",children:[jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex flex-col",children:f.map((h,g)=>jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:r===g?"default":"ghost",className:"mb-2 rounded-lg p-2 transition-colors",onClick:()=>u(g),children:lodashEs.get(h,"icon",null)},g)}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{side:"right",children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:p(h.label)})})]},"button"+g))}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-1",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Tooltip,{children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipTrigger,{asChild:!0,children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{variant:"ghost",onClick:()=>i(!0),children:jsxRuntime.jsxRuntimeExports.jsx(lucideReact.LayoutTemplate,{size:20})})}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.TooltipContent,{side:"right",children:jsxRuntime.jsxRuntimeExports.jsx("p",{children:p("Choose Builder Layout")})})]}),jsxRuntime.jsxRuntimeExports.jsx(HotKeys,{})]})]}),jsxRuntime.jsxRuntimeExports.jsx(framerMotion.motion.div,{className:"h-full max-h-full border-r border-border",initial:{width:280},animate:{width:r!==null?280:0},transition:{duration:.3,ease:"easeInOut"},children:r!==null&&jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar overflow h-full overflow-x-hidden",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex flex-col p-3",children:[jsxRuntime.jsxRuntimeExports.jsxs("h2",{className:"-mt-1 flex h-10 items-center space-x-1 text-base font-bold",children:[lodashEs.get(f,`${r}.icon`,null),jsxRuntime.jsxRuntimeExports.jsx("span",{children:p(f[r].label)})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex-1",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx("div",{children:"Loading..."}),children:React.createElement(lodashEs.get(f,`${r}.component`,null),{})})})]})})}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full max-h-full flex-1 flex-col bg-slate-800/20",children:[jsxRuntime.jsxRuntimeExports.jsx(CanvasTopBar,{}),jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:jsxRuntime.jsxRuntimeExports.jsx(CanvasArea$1,{})})]}),isDualLayout(o)?jsxRuntime.jsxRuntimeExports.jsx(framerMotion.motion.div,{className:"h-full max-h-full border-l border-border",initial:{width:280},animate:{width:280},transition:{duration:.3,ease:"easeInOut"},children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"no-scrollbar overflow h-full max-h-full overflow-x-hidden",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex max-h-full flex-col p-3",children:[jsxRuntime.jsxRuntimeExports.jsxs("h2",{className:"-mt-1 flex h-10 items-center space-x-1 text-base font-bold",children:[jsxRuntime.jsxRuntimeExports.jsx(lucideReact.EditIcon,{size:"16"}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:p("Block Settings")})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex-1",children:jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx("div",{children:"Loading..."}),children:jsxRuntime.jsxRuntimeExports.jsx(SettingsPanel$1,{})})})]})})}):null]})]}),jsxRuntime.jsxRuntimeExports.jsx(AddBlocksDialog,{}),jsxRuntime.jsxRuntimeExports.jsx(ChooseLayout,{open:a,close:()=>i(!1)})]})})},builderStore=jotai.getDefaultStore(),SmallScreenMessage=()=>jsxRuntime.jsxRuntimeExports.jsx("section",{className:"h-screen w-screen bg-gray-900 py-12 sm:py-16 lg:py-20 xl:hidden",children:jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mx-auto max-w-md text-center",children:[jsxRuntime.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"}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("h2",{className:"text-4xl font-bold text-white",children:"Screen too small"}),jsxRuntime.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."})]})})}),setDebugLogs=r=>{},PreviewScreen=()=>{const[r,n]=usePreviewMode(),{t:o}=reactI18next.useTranslation(),a=useBuilderProp("previewComponent",null);return r?jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("fixed inset-0 z-[999] bg-background",r?"block":"hidden"),children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{size:"sm",className:"absolute right-0 top-0 m-4 space-x-2",onClick:()=>n(!1),children:[jsxRuntime.jsxRuntimeExports.jsx(reactIcons.EyeClosedIcon,{}),jsxRuntime.jsxRuntimeExports.jsx("span",{children:o("close_preview")})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{children:a?jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-96 w-full"}),children:React.createElement(a)}):null})]}):null},ChaiBuilderComponent=r=>{const[,n]=useBlocksStore(),[,o]=useBrandingOptions(),a=useBuilderReset(),[i]=useAtom(builderSaveStateAtom),l=React.useMemo(()=>r.layout||RootLayout,[r.layout]);return React.useEffect(()=>{builderStore.set(chaiBuilderPropsAtom,lodashEs.omit(r,["blocks","subPages","brandingOptions","dataProviders","customRootLayout","translations"]))},[r]),React.useEffect(()=>{builderStore.set(dataProvidersAtom,r.dataProviders||[])},[r.dataProviders]),React.useEffect(()=>{n(runtime.syncBlocksWithDefaults(r.blocks||[])),a()},[r.blocks]),React.useEffect(()=>{i18n.changeLanguage(r.locale||"en")},[r.locale]),React.useEffect(()=>{setDebugLogs(r.showDebugLogs)},[r.showDebugLogs]),React.useEffect(()=>{r.translations&&lodashEs.each(r.translations,(c,u)=>{i18n.addResourceBundle(u,"translation",c,!0,!0)})},[r.translations]),React.useEffect(()=>{o(r.brandingOptions)},[r.brandingOptions,o]),React.useEffect(()=>(i!=="SAVED"?window.onbeforeunload=()=>"":window.onbeforeunload=null,()=>{window.onbeforeunload=null}),[i]),jsxRuntime.jsxRuntimeExports.jsx(l,{})},ChaiBuilderEditor=r=>{const n=r._flags||{},o=r.onError||lodashEs.noop;return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-screen w-screen",children:jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:o,children:jsxRuntime.jsxRuntimeExports.jsxs(flagged.FlagsProvider,{features:{...FEATURE_TOGGLES,...n},children:[jsxRuntime.jsxRuntimeExports.jsx(DevTools,{}),jsxRuntime.jsxRuntimeExports.jsx(SmallScreenMessage,{}),jsxRuntime.jsxRuntimeExports.jsx(ChaiBuilderComponent,{...r}),jsxRuntime.jsxRuntimeExports.jsx(PreviewScreen,{}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Toaster,{})]})})})};exports.AISetContext=AISetContext;exports.AIUserPrompt=AIUserPrompt;exports.AddBlocksDialog=AddBlocksDialog;exports.AddBlocksPanel=AddBlocksPanel$1;exports.BlockAttributesEditor=BlockAttributesEditor;exports.BlockSettings=BlockSettings;exports.BlockStyling=BlockStyling;exports.Breakpoints=Breakpoints;exports.CHAI_BUILDER_EVENTS=CHAI_BUILDER_EVENTS;exports.CanvasArea=CanvasArea$1;exports.ChaiBuilderEditor=ChaiBuilderEditor;exports.ChaiSelect=ChaiSelect$1;exports.DarkMode=DarkMode;exports.DefaultChaiBlocks=DefaultChaiBlocks;exports.FaCheck=FaCheck;exports.ImportHTML=ImportHTML$1;exports.Outline=Outline$1;exports.ThemeOptions=ThemeOptions;exports.UILibraries=UILibraries;exports.UndoRedo=UndoRedo;exports.emitChaiBuilderMsg=emitChaiBuilderMsg;exports.getBlocksFromHTML=getBlocksFromHTML;exports.getClassValueAndUnit=getClassValueAndUnit;exports.useAddBlock=useAddBlock;exports.useAddClassesToBlocks=useAddClassesToBlocks;exports.useBlocksStore=useBlocksStore;exports.useBlocksStoreUndoableActions=useBlocksStoreUndoableActions;exports.useBrandingOptions=useBrandingOptions;exports.useBuilderProp=useBuilderProp;exports.useBuilderReset=useBuilderReset;exports.useCanvasWidth=useCanvasWidth;exports.useCanvasZoom=useCanvasZoom;exports.useChaiBuilderMsgListener=useChaiBuilderMsgListener;exports.useCodeEditor=useCodeEditor;exports.useCopyBlockIds=useCopyBlockIds;exports.useCopyToClipboard=useCopyToClipboard;exports.useCurrentPage=useCurrentPage;exports.useCutBlockIds=useCutBlockIds;exports.useDarkMode=useDarkMode;exports.useDuplicateBlocks=useDuplicateBlocks;exports.useHiddenBlockIds=useHiddenBlockIds;exports.useHighlightBlockId=useHighlightBlockId;exports.useLayoutVariant=useLayoutVariant;exports.usePasteBlocks=usePasteBlocks;exports.usePreviewMode=usePreviewMode;exports.useRemoveBlocks=useRemoveBlocks;exports.useRemoveClassesFromBlocks=useRemoveClassesFromBlocks;exports.useSavePage=useSavePage;exports.useSelectedBlock=useSelectedBlock;exports.useSelectedBlockAllClasses=useSelectedBlockAllClasses;exports.useSelectedBlockCurrentClasses=useSelectedBlockCurrentClasses;exports.useSelectedBlockIds=useSelectedBlockIds;exports.useSelectedBlocksDisplayChild=useSelectedBlocksDisplayChild;exports.useSelectedBreakpoints=useSelectedBreakpoints;exports.useSelectedStylingBlocks=useSelectedStylingBlocks;exports.useStylingBreakpoint=useStylingBreakpoint;exports.useStylingState=useStylingState;exports.useUILibraryBlocks=useUILibraryBlocks;exports.useUndoManager=useUndoManager;exports.useUpdateBlocksProps=useUpdateBlocksProps;exports.useUpdateBlocksPropsRealtime=useUpdateBlocksPropsRealtime;