@chaibuilder/sdk 1.2.57 → 1.2.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CanvasArea-NLbaLcFM.cjs +59 -0
- package/dist/{CanvasArea-8f_Ki3B7.js → CanvasArea-akw7npWW.js} +385 -366
- package/dist/{CurrentPage-nzo4lszx.js → CurrentPage-cOvRmEIZ.js} +2 -2
- package/dist/{CurrentPage-7aEIhzQ0.cjs → CurrentPage-pwDwQsWa.cjs} +1 -1
- package/dist/{ListTree-KUGhFsb_.js → ListTree-0iy8aBgI.js} +74 -53
- package/dist/{ListTree-A-097CZ-.cjs → ListTree-Njsk1AzL.cjs} +1 -1
- package/dist/{PagesPanel-hleqqZBo.js → PagesPanel-A3du_vDn.js} +3 -3
- package/dist/{PagesPanel-L1mI3y_6.cjs → PagesPanel-bfNUqq2a.cjs} +1 -1
- package/dist/{ProjectPanel-RXEhYr0a.js → ProjectPanel-92EtwSrh.js} +3 -3
- package/dist/{ProjectPanel-HTxa1kHv.cjs → ProjectPanel-QMaTK2Jx.cjs} +1 -1
- package/dist/{Settings-b1ZuIn4y.js → Settings-3ZuMFtd6.js} +2 -2
- package/dist/Settings-8_Twq9DO.cjs +1 -0
- package/dist/{SidePanels-_6WlMWq_.cjs → SidePanels-C8RdCe7y.cjs} +1 -1
- package/dist/{SidePanels-6hZeCR5Z.js → SidePanels-XUVc9jMH.js} +3 -3
- package/dist/{Topbar-WdGZIIZp.cjs → Topbar-EkBS5_nt.cjs} +1 -1
- package/dist/{Topbar-YfsC1DZ2.js → Topbar-VdVqOT-8.js} +1 -1
- package/dist/UILibrariesPanel-CaGLzB9c.cjs +1 -0
- package/dist/UILibrariesPanel-raxCToMd.js +216 -0
- package/dist/{add-page-modal-CtMwNEsW.js → add-page-modal-OH7DL-Yz.js} +2 -2
- package/dist/{add-page-modal-DA5P4pVu.cjs → add-page-modal-VmIvQ5ug.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-TMpN1Dvm.js → delete-page-modal--g92Sj1h.js} +2 -2
- package/dist/{delete-page-modal-AvUZI9Tk.cjs → delete-page-modal-uSFaC2aS.cjs} +1 -1
- package/dist/email.cjs +1 -1
- package/dist/email.js +1 -1
- package/dist/{index-IgLSTkN6.js → index--t_K8Sw6.js} +1 -1
- package/dist/{index-zaKhyTQ6.cjs → index-4C2qT6ju.cjs} +1 -1
- package/dist/{index-sspgZwTk.cjs → index-Phf9F3An.cjs} +1 -1
- package/dist/{index--hN9ZQsP.js → index-yVCgnTlS.js} +2 -2
- package/dist/mockServiceWorker.js +18 -10
- package/dist/{page-viewer-D8nsi13f.js → page-viewer-hBsE440V.js} +3 -3
- package/dist/{page-viewer-2BMSxxfd.cjs → page-viewer-yIl2jRO8.cjs} +1 -1
- package/dist/{project-general-setting-HGjTNFRx.js → project-general-setting-9AGMKDNq.js} +2 -2
- package/dist/{project-general-setting--0hX9Otn.cjs → project-general-setting-NFCzMKqN.cjs} +1 -1
- package/dist/{single-page-detail-eMnjt_Ih.js → single-page-detail-5qDQmlL-.js} +3 -3
- package/dist/{single-page-detail-7BpYAyMO.cjs → single-page-detail-wwJYm5lF.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +2 -2
- package/package.json +1 -1
- package/dist/CanvasArea-UisRL54b.cjs +0 -56
- package/dist/Settings-7EMwx6zL.cjs +0 -1
- package/dist/UILibrariesPanel-5QxxXYg2.js +0 -191
- package/dist/UILibrariesPanel-r8nQzXQ-.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),g=require("react"),c=require("lodash-es"),H=require("@radix-ui/react-icons"),y=require("./index-0FIxW0gR.cjs"),d=require("./controls-rRZhz0vu.cjs"),w=require("sonner"),p=require("./form-G3PqS2Gc.cjs"),h=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),g=require("react"),c=require("lodash-es"),H=require("@radix-ui/react-icons"),y=require("./index-0FIxW0gR.cjs"),d=require("./controls-rRZhz0vu.cjs"),w=require("sonner"),p=require("./form-G3PqS2Gc.cjs"),h=require("./index-4C2qT6ju.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("react-i18next");require("@rjsf/core");require("@rjsf/validator-ajv8");require("./index-Phf9F3An.cjs");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");const z=g.lazy(()=>Promise.resolve().then(()=>require("./delete-page-modal-uSFaC2aS.cjs"))),L=g.lazy(()=>Promise.resolve().then(()=>require("./confirm-alert-rYsxlfR4.cjs"))),E=n=>{if(!c.isString(n)||!(n.includes("/[")&&n.includes("]")))return!1;const s=/^\[((?:\.{3})?[a-zA-Z0-9_-]+)\]$/,q=/^[a-zA-Z0-9_-]+$/;let e=!0;return n.split("/").forEach(u=>{e&&(u.includes("[[")&&u.includes("]]")?e=/^\[\[\.{3}[a-zA-Z0-9_-]+\]\]$/.test(u):u.includes("[")&&u.includes("]")?e=s.test(u):e=q.test(u))}),e},P=n=>n&&c.isEmpty(n.seoData)?{...n,seoData:{title:"",description:"",image:""}}:n,G=(n,o)=>{const s=!c.isEqual(c.omit(n,["seoData"]),c.omit(o,["seoData"])),q=!c.isEqual(P(o).seoData,P(n).seoData);return s||q},Y=({open:n,setOpen:o,pageData:s})=>{const q=h.useQueryClient(),{data:e}=h.useProject(),u=h.useUpdatePage(),m=h.useUpdateProject("Homepage updated successfully."),[i,b]=g.useState(P(s)),[a,A]=g.useState({isHomePage:(e==null?void 0:e.homepage)===s.uuid}),j=G(i,s);g.useEffect(()=>{const l=!c.isEqual(P(s),i),t=(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage;o(l||t?"PENDING":"OPEN")},[e,s,i,a,o]);const C=()=>{if(j){if(s.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")){n==="ALERT"&&o("PENDING");return}u.mutate(i,{onSuccess:()=>{q.invalidateQueries({refetchType:"active",queryKey:["pages",e==null?void 0:e.uuid]}),o("CLOSE"),w.toast.success("Page updated successfully.")}})}a.isHomePage&&(e==null?void 0:e.homepage)!==s.uuid&&m.mutate({...e,homepage:s==null?void 0:s.uuid},{onSuccess:()=>o("CLOSE")})},R=({formData:l},t)=>{b(f=>{var S,N;if(!t)return f;const x={[t]:l[t]};return t==="name"?x.slug=c.kebabCase((S=l[t])==null?void 0:S.replace(/\d/g,"")):t==="slug"?x.slug=(N=l[t])==null?void 0:N.replace(/\d/g,"").replace(/\s+/g,"").replace("--","-").replace("__","_"):t==="seoData"&&(x.seoData={title:l[t].title||"",description:l[t].description||"",image:l[t].image||""}),{...f,...x}})},I=({formData:l},t)=>{A(f=>{const x={[t]:l[t]};return{...f,...x}})},v={name:d.g({title:"Page Name",default:i.name}),slug:d.g({title:"Page Slug",default:i.slug})},T={seoData:d.h({title:"",description:"",default:{title:"",description:"",image:""},properties:{title:d.g({title:"Meta Title",default:i.name}),description:d.r({title:"Meta Description",default:i.slug}),image:d.v({title:"Social Media Image",default:""})}})},M={isHomePage:d.c({title:"Set as homepage",default:a.isHomePage})};return r.jsxRuntimeExports.jsxs(y.ScrollArea,{className:"flex h-full select-none flex-col",children:[r.jsxRuntimeExports.jsx(L,{open:n==="ALERT",title:"Do yo want to save changes?",onCancel:()=>o("CLOSE"),onConfirm:C,disabled:m.isPending||u.isPending}),r.jsxRuntimeExports.jsx("div",{className:"rounded-md bg-background/30 px-2.5 py-1",children:r.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Page Details"})}),r.jsxRuntimeExports.jsx("div",{className:"px-2.5 pt-2",children:r.jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2",children:[r.jsxRuntimeExports.jsx(p.Form,{title:"Basic Details",formData:i,properties:v,onChange:R,disabled:u.isPending||m.isPending}),r.jsxRuntimeExports.jsx("div",{className:"h-2 w-full"}),r.jsxRuntimeExports.jsx(p.Form,{title:"SEO Details",formData:i,properties:T,onChange:R,disabled:u.isPending||m.isPending}),(e==null?void 0:e.homepage)!==s.uuid&&s.type==="STATIC"?r.jsxRuntimeExports.jsx(p.Form,{formData:a,properties:M,onChange:I,disabled:u.isPending||m.isPending}):s.type==="STATIC"&&r.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1 px-1 pt-2 text-xs font-medium text-gray-500",children:[r.jsxRuntimeExports.jsx(H.HomeIcon,{})," This is homepage"," "]}),i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||"")&&r.jsxRuntimeExports.jsxs("small",{className:"px-1 text-red-400",children:["Add dynamic ID in page slug Eg: ",r.jsxRuntimeExports.jsx("i",{className:"underline",children:"some-url/[some-id]"})]}),r.jsxRuntimeExports.jsxs("div",{className:"my-2 flex w-full items-center justify-between gap-x-2 px-1",children:[r.jsxRuntimeExports.jsx(y.Button,{className:"w-full",type:"submit",onClick:C,disabled:(e==null?void 0:e.homepage)!==s.uuid&&a.isHomePage?!1:c.isEmpty(i.name)||c.isEmpty(i.slug)||!j||u.isPending||m.isPending||i.type==="DYNAMIC"&&!E((i==null?void 0:i.slug)||""),children:"Save"}),r.jsxRuntimeExports.jsx(z,{pageData:s,projectData:e})]})]})})]})};exports.default=Y;
|
package/dist/studio.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./jsx-runtime-Z_BpKhVy.cjs");const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./jsx-runtime-Z_BpKhVy.cjs");const e=require("./index-4C2qT6ju.cjs");require("react");require("sonner");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./index-Phf9F3An.cjs");require("i18next");require("react-i18next");require("./index-0FIxW0gR.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("lodash-es");require("./MODIFIERS-mVmfEGgo.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@chaibuilder/runtime");require("jotai");require("@react-hookz/web");require("tree-model");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("lucide-react");require("./index--mLLy7QQ.cjs");require("./html-to-json-ndxaXRT8.cjs");require("himalaya");require("lodash");exports.ChaiBuilderStudio=e.ChaiBuilderStudio;
|
package/dist/studio.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./jsx-runtime-WbnYoNE9.js";
|
|
2
|
-
import { C as _ } from "./index
|
|
2
|
+
import { C as _ } from "./index-yVCgnTlS.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "sonner";
|
|
5
5
|
import "./_commonjsHelpers-UyOWmZb0.js";
|
|
6
|
-
import "./index
|
|
6
|
+
import "./index--t_K8Sw6.js";
|
|
7
7
|
import "i18next";
|
|
8
8
|
import "react-i18next";
|
|
9
9
|
import "./index-uLn8W3eR.js";
|
package/package.json
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";var oe=Object.defineProperty;var re=(o,s,e)=>s in o?oe(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;var _=(o,s,e)=>(re(o,typeof s!="symbol"?s+"":s,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./jsx-runtime-Z_BpKhVy.cjs"),h=require("react"),c=require("lodash-es"),R=require("@radix-ui/react-icons"),i=require("./index-0FIxW0gR.cjs"),F=require("./index-sspgZwTk.cjs"),W=require("react-i18next"),b=require("jotai"),ie=require("lucide-react"),G=require("react-dom"),w=require("prop-types"),le=require("react-quill"),q=require("./atoms-a0H_593V.cjs"),ce=require("@floating-ui/dom"),X=require("@floating-ui/react-dom"),ae=require("@react-hookz/web"),de=require("flagged"),ue=require("@tailwindcss/typography"),pe=require("@tailwindcss/forms"),he=require("@tailwindcss/aspect-ratio"),xe=require("tailwindcss-palette-generator"),me=require("tailwind-merge"),L=require("./MODIFIERS-mVmfEGgo.cjs"),ge=require("@chaibuilder/runtime"),fe=require("react-wrap-balancer"),ve=require("re-resizable");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("./Functions-N3yhPYKY.cjs");require("tree-model");require("i18next");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");const je=()=>{const{hasUndo:o,hasRedo:s,undo:e,redo:t}=i.useUndoManager();return r.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.jsxRuntimeExports.jsx(i.Button,{disabled:!o(),size:"sm",onClick:e,className:"rounded-full",variant:"ghost",children:r.jsxRuntimeExports.jsx(R.ResetIcon,{})}),r.jsxRuntimeExports.jsx(i.Button,{disabled:!s(),onClick:t,size:"sm",className:"rounded-full",variant:"ghost",children:r.jsxRuntimeExports.jsx(R.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function ye(){const[o,s]=i.useDarkMode();return r.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.jsxRuntimeExports.jsx(R.SunIcon,{className:"size-4 shrink-0"}),r.jsxRuntimeExports.jsx(i.Switch,{id:"dark-mode-switch",checked:o,onCheckedChange:()=>{s(!o)},className:`${o?"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:r.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${o?"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`})}),r.jsxRuntimeExports.jsx(F.FaMoon,{className:"size-4 ml-3 shrink-0"})]})}const Z=({landscape:o=!1})=>r.jsxRuntimeExports.jsxs("svg",{className:o?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[r.jsxRuntimeExports.jsx("g",{strokeWidth:0}),r.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),r.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),$e=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:r.jsxRuntimeExports.jsx(R.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:r.jsxRuntimeExports.jsx(R.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:r.jsxRuntimeExports.jsx(Z,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:r.jsxRuntimeExports.jsx(Z,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:r.jsxRuntimeExports.jsx(R.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:r.jsxRuntimeExports.jsx(R.DesktopIcon,{}),width:1920}],Q=({title:o,content:s,currentBreakpoint:e,breakpoint:t,width:n,icon:u,onClick:a})=>{const{t:l}=W.useTranslation();return r.jsxRuntimeExports.jsxs(i.HoverCard,{children:[r.jsxRuntimeExports.jsx(i.HoverCardTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsx(i.Button,{onClick:()=>a(n),size:"sm",variant:t===e?"secondary":"ghost",children:u})}),r.jsxRuntimeExports.jsx(i.HoverCardContent,{className:"w-52 border-border",children:r.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:r.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[r.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:l(o)}),r.jsxRuntimeExports.jsx("p",{className:"text-xs",children:l(s)})]})})})]})},be=()=>{const[,o,s]=i.useCanvasWidth(),[e,t]=i.useSelectedBreakpoints(),{t:n}=W.useTranslation(),u=i.useBuilderProp("breakpoints",$e),a=l=>{e.includes(l)?e.length>2&&t(e.filter(p=>p!==l)):t(p=>[...p,l])};return u.length<4?r.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:c.map(u,l=>h.createElement(Q,{...l,onClick:s,key:l.breakpoint,currentBreakpoint:o}))}):r.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[c.map(u.filter(l=>c.includes(e,c.toUpper(l.breakpoint))),l=>h.createElement(Q,{...l,onClick:s,key:l.breakpoint,currentBreakpoint:o})),r.jsxRuntimeExports.jsxs(i.DropdownMenu,{children:[r.jsxRuntimeExports.jsx(i.DropdownMenuTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:r.jsxRuntimeExports.jsx(R.DotsVerticalIcon,{className:"scale-90 transform"})})}),r.jsxRuntimeExports.jsxs(i.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[r.jsxRuntimeExports.jsx(i.DropdownMenuLabel,{children:n("Breakpoints")}),r.jsxRuntimeExports.jsx(i.DropdownMenuSeparator,{}),c.map(u,l=>r.jsxRuntimeExports.jsx(i.DropdownMenuCheckboxItem,{disabled:l.breakpoint==="xs",onCheckedChange:()=>a(c.toUpper(l.breakpoint)),checked:c.includes(e,c.toUpper(l.breakpoint)),children:n(l.title)},l.breakpoint))]})]})]})},ke=()=>{const{t:o}=W.useTranslation(),{setNewBlocks:s}=i.useBlocksStoreUndoableActions(),[,e]=i.useSelectedBlockIds(),[,t]=i.useSelectedStylingBlocks(),n=h.useCallback(()=>{s([]),e([]),t([])},[s]);return r.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:r.jsxRuntimeExports.jsxs(i.AlertDialog,{children:[r.jsxRuntimeExports.jsx(i.AlertDialogTrigger,{asChild:!0,children:r.jsxRuntimeExports.jsxs(i.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[r.jsxRuntimeExports.jsx(R.EraserIcon,{})," ",o("clear")]})}),r.jsxRuntimeExports.jsxs(i.AlertDialogContent,{className:"border-border",children:[r.jsxRuntimeExports.jsxs(i.AlertDialogHeader,{children:[r.jsxRuntimeExports.jsx(i.AlertDialogTitle,{children:o("clear_canvas_title")}),r.jsxRuntimeExports.jsx(i.AlertDialogDescription,{children:o("clear_canvas_description")})]}),r.jsxRuntimeExports.jsxs(i.AlertDialogFooter,{children:[r.jsxRuntimeExports.jsx(i.AlertDialogCancel,{children:o("cancel")}),r.jsxRuntimeExports.jsx(i.AlertDialogAction,{onClick:n,children:o("yes")})]})]})]})})},Ee=()=>{const[o,s]=b.useAtom(i.aiAssistantActiveAtom);return i.useBuilderProp("askAiCallBack",null)?r.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxRuntimeExports.jsxs(i.Label,{htmlFor:"ai-assistant",className:"flex items-center gap-x-1 text-sm text-yellow-600",children:[r.jsxRuntimeExports.jsx(ie.SparklesIcon,{className:"w-4"}),"AI Assistant"]}),r.jsxRuntimeExports.jsx(i.Switch,{className:"scale-90",checked:o,onCheckedChange:t=>{s(t)},id:"ai-assitantt"})]}):null},Re=()=>{const o=i.useBuilderProp("darkMode",!0),[s]=i.useCanvasZoom();return r.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[r.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[r.jsxRuntimeExports.jsx(be,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),o?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx(ye,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"})]}):null,r.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:[r.jsxRuntimeExports.jsx(R.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",r.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[c.round(s,0),"%"]})]}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(je,{})]}),r.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[r.jsxRuntimeExports.jsx(ke,{}),r.jsxRuntimeExports.jsx(i.Separator,{orientation:"vertical"}),r.jsxRuntimeExports.jsx(Ee,{})]})]})},we=`<!doctype html>
|
|
2
|
-
<html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
|
|
7
|
-
<style>
|
|
8
|
-
html { height: 100%; overflow:auto; }
|
|
9
|
-
body { height: 100%; }
|
|
10
|
-
.air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
|
|
11
|
-
.air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
|
|
12
|
-
body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
|
|
13
|
-
-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
|
14
|
-
html{
|
|
15
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
16
|
-
scrollbar-width: none; /* Firefox */
|
|
17
|
-
}
|
|
18
|
-
/** IMPORTANT: Make fields content editable in SAFARI */
|
|
19
|
-
[contenteditable] {-webkit-user-select: text;user-select: text;}
|
|
20
|
-
|
|
21
|
-
html::-webkit-scrollbar { width: 0 !important }
|
|
22
|
-
.aspect-auto{aspect-ratio: auto;}
|
|
23
|
-
.aspect-square{aspect-ratio: 1/1;}
|
|
24
|
-
.aspect-video{aspect-ratio: 16/9;}
|
|
25
|
-
.dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
|
|
26
|
-
.dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
|
|
27
|
-
a{ pointer-events: none !important; }
|
|
28
|
-
[contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
|
|
29
|
-
[contenteditable="true"] {
|
|
30
|
-
outline: none;
|
|
31
|
-
box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
|
|
32
|
-
-webkit-user-select: text;
|
|
33
|
-
-moz-user-select: text;
|
|
34
|
-
user-select: text;
|
|
35
|
-
}
|
|
36
|
-
.frame-root .frame-content { height: 100%; }
|
|
37
|
-
[data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
|
|
38
|
-
[data-dnd="yes"] { pointer-events: auto !important}
|
|
39
|
-
[data-dnd="no"] { pointer-events: none !important; }
|
|
40
|
-
</style>
|
|
41
|
-
<style id="hidden-blocks"></style>
|
|
42
|
-
<style id="selected-block"></style>
|
|
43
|
-
<style id="selected-styling-block"></style>
|
|
44
|
-
<style id="highlighted-block"></style>
|
|
45
|
-
<style id="dragged-block"></style>
|
|
46
|
-
|
|
47
|
-
</head>
|
|
48
|
-
<body class="font-body antialiased h-full">
|
|
49
|
-
<div class="frame-root h-full"></div>
|
|
50
|
-
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
51
|
-
</body>
|
|
52
|
-
</html>`,Se=o=>{const[s]=i.useCanvasWidth(),[,e]=i.useCanvasZoom(),[t,n]=h.useState({}),u=h.useCallback(()=>{const{width:a,height:l}=o;if(a<s){const p=parseFloat((a/s).toFixed(2).toString());let f={};const d=l*p;l&&(f={height:100+(l-d)/d*100+"%"}),n({position:"relative",top:0,transform:`scale(${p})`,transformOrigin:"top left",...f,maxWidth:"none"}),e(p*100)}else n({}),e(100)},[s,o,e]);return h.useEffect(()=>{u()},[s,o,e,u]),t};let V,ee;typeof document<"u"&&(V=document);typeof window<"u"&&(ee=window);const te=h.createContext({document:V,window:ee}),P=()=>h.useContext(te),{Provider:Be,Consumer:rt}=te;class se extends h.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return h.Children.only(this.props.children)}}_(se,"propTypes",{children:w.element.isRequired,contentDidMount:w.func.isRequired,contentDidUpdate:w.func.isRequired});class z extends h.Component{constructor(e,t){super(e,t);_(this,"setRef",e=>{this.nodeRef.current=e;const{forwardedRef:t}=this.props;typeof t=="function"?t(e):t&&(t.current=e)});_(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});_(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=h.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const e=this.getDoc();return this.props.mountTarget?e.querySelector(this.props.mountTarget):e.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const e=this.getDoc();if(!e)return null;const t=this.props.contentDidMount,n=this.props.contentDidUpdate,u=e.defaultView||e.parentView,a=r.jsxRuntimeExports.jsx(se,{contentDidMount:t,contentDidUpdate:n,children:r.jsxRuntimeExports.jsx(Be,{value:{document:e,window:u},children:r.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),l=this.getMountTarget();return[G.createPortal(this.props.head,this.getDoc().head),G.createPortal(a,l)]}render(){const e={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete e.head,delete e.initialContent,delete e.mountTarget,delete e.contentDidMount,delete e.contentDidUpdate,delete e.forwardedRef,r.jsxRuntimeExports.jsx("iframe",{...e,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}_(z,"propTypes",{style:w.object,head:w.node,initialContent:w.string,mountTarget:w.string,contentDidMount:w.func,contentDidUpdate:w.func,children:w.oneOfType([w.element,w.arrayOf(w.element)])}),_(z,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const Ae=h.forwardRef((o,s)=>r.jsxRuntimeExports.jsx(z,{...o,forwardedRef:s}));function K(o){const s=window.getComputedStyle(o),e=s.display;if(e==="flex"||e==="inline-flex"){const t=s.flexDirection;return t==="column"||t==="column-reverse"?"vertical":"horizontal"}else if(e==="grid"){const t=s.gridAutoFlow,n=s.gridTemplateRows,u=s.gridTemplateColumns;return t.includes("column")||n.split(" ").length>u.split(" ").length?"vertical":"horizontal"}else if(e==="block"||e==="inline-block")return"vertical";return"horizontal"}let $=null,S=[],N=null,H=null;const J=(o,s,e)=>{if(!$||!o)return;const t=$==null?void 0:$.getElementById("placeholder"),n=S.map(([p])=>p),u=n.reduce((p,f)=>Math.abs(f-e)<Math.abs(p-e)?f:p,0),a=n.indexOf(u);if(!S[a])return;const l=S[a];t.style.width=s==="vertical"?l[2]+"px":"2px",t.style.height=s==="vertical"?"2px":l[2]+"px",t.style.display="block",s==="vertical"?(t.style.top=l[0]+"px",t.style.left=l[1]+"px"):(t.style.top=l[1]+"px",t.style.left=l[0]+"px")};function Ce(o,s){let e=0,t=1/0;return s.forEach((n,u)=>{const a=Math.abs(n[0]-o);a<t&&(t=a,e=u)}),e}const Ie=o=>{const e=K(o)==="horizontal";S=[],Array.from(o.children).forEach((t,n)=>{if(t.classList.contains("pointer-events-none"))return;const u=e?t.offsetLeft:t.offsetTop,a=e?[t.offsetTop,t.clientHeight]:[t.offsetLeft,t.clientWidth];if(S.push([u,a[0],a[1]]),n===o.children.length-1){const l=e?t.offsetLeft+t.clientWidth:t.offsetTop+t.clientHeight;S.push([l,a[0],a[1]])}})},_e=c.throttle(o=>{var n;const s=o.target,e=K(s),t=(n=$==null?void 0:$.defaultView)==null?void 0:n.scrollY;e==="vertical"?J(s,e,o.clientY+t):J(s,e,o.clientX)},0);function O(){const o=$==null?void 0:$.getElementById("placeholder");o.style.display="none",De("pointer-none"),Me()}function De(o){($==null?void 0:$.querySelectorAll(`.${o}`)).forEach(e=>{e.classList.remove(o)})}function Me(){const o=$==null?void 0:$.querySelector('[data-drop="yes"]');o&&o.removeAttribute("data-drop")}const Te=()=>{const{document:o}=P(),[s,e]=b.useAtom(i.draggingFlagAtom),{addCoreBlock:t}=i.useAddBlock(),[,n]=i.useHighlightBlockId(),[,u]=i.useSelectedBlockIds(),{moveBlocks:a}=i.useBlocksStoreUndoableActions(),[,l]=b.useAtom(i.draggedBlockIdAtom),[p,f]=b.useAtom(q.draggedBlockAtom),[,d]=b.useAtom(q.dropTargetAtom);return $=o,{isDragging:s,onDragOver:m=>{m.preventDefault(),m.stopPropagation(),_e(m)},onDrop:m=>{var B;N==null||N.classList.remove("drop-target");const x=N,E=K(x)==="vertical"?m.clientY+((B=$==null?void 0:$.defaultView)==null?void 0:B.scrollY):m.clientX;H=Ce(E,S);const v=p,g=x.getAttribute("data-block-id");if(!c.has(v,"_id")){t(v,g==="canvas"?null:g,H),setTimeout(()=>{O()},300),S=[],e(!1),l(""),f(null),d(null);return}let k=x.getAttribute("data-block-id");k===null&&(k=m.target.parentElement.getAttribute("data-block-id")),a([v._id],k,H),O(),e(!1),l(""),S=[],setTimeout(()=>O(),300)},onDragEnter:m=>{const x=m,j=x.target;N=j;const E=j.getAttribute("data-block-id");d(E),x.stopPropagation(),x.preventDefault(),S=[],Ie(j),console.log(S,m.clientY,$.defaultView.scrollY),j.classList.add("drop-target"),e(!0),n(""),u([])}}};function Y(o){return o.getAttribute("data-block-id")?o:o.closest("[data-block-id]")}function Ne(o){o.container.innerHTML="",o.container.parentNode.removeChild(o.container);var s=document.querySelector(".ql-toolbar");s&&s.parentNode.removeChild(s),o=null}const qe=()=>{const o=["Heading","Paragraph","Text","Link","Span","Button"],s=i.useUpdateBlocksProps(),[,e]=i.useHighlightBlockId(),[t,n]=b.useAtom(i.inlineEditingActiveAtom);return u=>{var m;if(t)return;const a=Y(u.target),l=a.getAttribute("data-block-type");if(!l||!o.includes(l))return;const p=a.cloneNode(!0);a.style.display="none",Array.from(p.attributes).forEach(x=>{x.name!=="class"&&p.removeAttribute(x.name)}),l==="Text"&&(p.style.display="inline-block"),a.parentNode.insertBefore(p,a.nextSibling);const f=new le.Quill(p,{placeholder:"Type here..."});function d(){const x=f.getText(0,f.getLength());s([a.getAttribute("data-block-id")],{content:x}),a.removeAttribute("style"),p.removeEventListener("blur",d,!0),Ne(f),n(""),e("")}p.addEventListener("blur",d,!0),p.addEventListener("keydown",x=>{(x.key==="Enter"||x.key==="Escape")&&d()}),f.focus(),(m=p.querySelector(".ql-clipboard"))==null||m.remove(),n(a.getAttribute("data-block-id"))}},Le=()=>{const[,o]=i.useSelectedStylingBlocks(),[s,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[n]=b.useAtom(i.inlineEditingActiveAtom),[u]=b.useAtom(i.treeRefAtom);return a=>{if(n)return;a.stopPropagation();const l=Y(a.target);if(l!=null&&l.getAttribute("data-block-id")&&(l==null?void 0:l.getAttribute("data-block-id"))==="container"){e([]),o([]),t("");return}if(l!=null&&l.getAttribute("data-block-parent")){const p=l.getAttribute("data-style-prop"),f=l.getAttribute("data-style-id"),d=l.getAttribute("data-block-parent");s.includes(d)||u==null||u.closeAll(),o([{id:f,prop:p,blockId:d}]),e([d])}else if(l!=null&&l.getAttribute("data-block-id")){let p=l.getAttribute("data-block-id");s.includes(p)||u==null||u.closeAll(),e([p])}t("")}},Fe=c.throttle((o,s)=>{const e=Y(o.target);e!=null&&e.getAttribute("data-style-id")&&s(e.getAttribute("data-style-id"))},100),Pe=()=>{const[,o]=i.useHighlightBlockId(),[s]=b.useAtom(i.inlineEditingActiveAtom);return e=>{s||Fe(e,o)}},He=({children:o})=>{const{document:s}=P(),[e]=i.useSelectedBlockIds(),[t,n]=i.useSelectedStylingBlocks();h.useEffect(()=>{setTimeout(()=>{if(!c.isEmpty(t))return;const f=ne(s,c.first(e));if(f){const d=f.getAttribute("data-style-prop");if(d){const m=f.getAttribute("data-style-id"),x=f.getAttribute("data-block-parent");n([{id:m,prop:d,blockId:x}])}}},100)},[s,e,n,t]);const u=qe(),a=Le(),l=Pe(),p=Te();return r.jsxRuntimeExports.jsx("div",{"data-block-id":"canvas",id:"canvas",onClick:a,onDoubleClick:u,onMouseMove:l,...c.omit(p,"isDragging"),className:"relative mb-5 h-full max-w-full "+(p.isDragging?"dragging":""),children:o})},ne=(o,s)=>o.querySelector(`[data-block-id="${s}"]`),Oe=()=>{const{window:o}=P(),[s,e]=i.useSelectedBlockIds(),[t]=i.useBlocksStore(),[,n]=i.useSelectedStylingBlocks(),{undo:u,redo:a}=i.useUndoManager(),l=i.useDuplicateBlocks(),[,p]=i.usePreviewMode(),f=i.useRemoveBlocks(),{savePage:d}=i.useSavePage(),[m]=b.useAtom(i.inlineEditingActiveAtom),[,x]=b.useAtom(i.editLayerNameAtom),j=v=>{v.key==="Enter"&&(v.preventDefault(),s.length===1&&x(c.first(s)))},E=v=>{const g=t.find(k=>k._id===v);return g?g._parent:null};return h.useEffect(()=>{const v=g=>{if(g.key==="Escape"){e([]),n([]);return}if(j(g),!m&&(g.key==="Delete"||g.key==="Backspace")&&(g.preventDefault(),f(s)),g.ctrlKey||g.metaKey){if(g.key==="ArrowUp"){g.preventDefault();const k=s.length>0?E(s[0]):null;k&&e([k])}if(["z","y","d","x","c","p","s","v"].includes(g.key)){if(m&&["x","z","v"].includes(g.key))return!0;g.preventDefault()}g.key==="s"&&(g.stopPropagation(),g.preventDefault(),d()),g.key==="z"&&u(),g.key==="y"&&a(),g.key==="d"&&l(s)}};return o.removeEventListener("keydown",v),o.addEventListener("keydown",v),()=>{o.removeEventListener("keydown",v)}},[s,e,u,f,p,a,l,m,d,o]),null},ze=({block:o,label:s})=>{const[,e]=i.useSelectedBlockIds(),[,t]=i.useHighlightBlockId(),[,n]=b.useAtom(q.draggedBlockAtom),u=de.useFeature("dnd");return r.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:u?"true":"false",onDragStart:a=>{a.dataTransfer.setData("text/plain",JSON.stringify(c.pick(o,["_id","_type","_name"]))),n(o),setTimeout(()=>{e([]),t(null)},200)},children:[r.jsxRuntimeExports.jsx(R.DragHandleDots2Icon,{}),s]})},Ue=({selectedBlockElement:o,block:s})=>{const e=i.useRemoveBlocks(),t=i.useDuplicateBlocks(),[,n]=i.useSelectedBlockIds(),[,u]=i.useSelectedStylingBlocks(),[a]=b.useAtom(i.inlineEditingActiveAtom),{floatingStyles:l,refs:p,update:f}=X.useFloating({placement:"top-start",middleware:[X.shift(),ce.flip()],elements:{reference:o}});ae.useResizeObserver(o,()=>f(),o!==null);const d=c.get(s,"_parent",null),m=c.isEmpty(c.get(s,"_name",""))?c.get(s,"_type",""):c.get(s,"_name","");return!o||!s||a?null:r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:r.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:p.setFloating,style:l,onClick:x=>{x.stopPropagation(),x.preventDefault()},onKeyDown:x=>x.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[r.jsxRuntimeExports.jsx(ze,{label:m,block:s}),r.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[d&&r.jsxRuntimeExports.jsx(R.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{u([]),n([d])}}),i.canDuplicateBlock(c.get(s,"_type",""))?r.jsxRuntimeExports.jsx(R.CopyIcon,{className:"hover:scale-105",onClick:()=>t([s==null?void 0:s._id])}):null,i.canDeleteBlock(c.get(s,"_type",""))?r.jsxRuntimeExports.jsx(R.TrashIcon,{className:"hover:scale-105",onClick:()=>e([s==null?void 0:s._id])}):null]})]})})},We=({addVariant:o,e:s})=>{o("hs-dropdown-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open > .${s(`hs-dropdown-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open .hs-dropdown-toggle .${s(`hs-dropdown-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-dropdown.open > .hs-dropdown-menu > .${s(`hs-dropdown-open${t}${n}`)}`)}]),o("hs-removing",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-removing.${s(`hs-removing${t}${n}`)}`)}),o("hs-tooltip-shown",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-tooltip.show .${s(`hs-tooltip-shown${t}${n}`)}`)}),o("hs-accordion-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active.${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-toggle .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle .${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-toggle.${s(`hs-accordion-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion.active > .hs-accordion-heading > .hs-accordion-toggle.${s(`hs-accordion-active${t}${n}`)}`)}]),o("hs-accordion-selected",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-accordion .selected.${s(`hs-accordion-selected${t}${n}`)}`)}),o("hs-collapse-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse.open .${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse.open.${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse-toggle.open .${s(`hs-collapse-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-collapse-toggle.open.${s(`hs-collapse-open${t}${n}`)}`)}]),o("hs-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`[data-hs-tab].active.${s(`hs-tab-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`[data-hs-tab].active .${s(`hs-tab-active${t}${n}`)}`)}]),o("hs-overlay-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.open.${s(`hs-overlay-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.open .${s(`hs-overlay-open${t}${n}`)}`)}]),o("hs-overlay-layout-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-body-open.${s(`hs-overlay-layout-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-body-open .${s(`hs-overlay-layout-open${t}${n}`)}`)}]),o("hs-overlay-backdrop-open",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-backdrop.${s(`hs-overlay-backdrop-open${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.hs-overlay-backdrop .${s(`hs-overlay-backdrop-open${t}${n}`)}`)}]),o("hs-scrollspy-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-scrollspy-active${t}${n}`)}`)}),o("hs-carousel-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-carousel-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-carousel-active${t}${n}`)}`)}]),o("hs-carousel-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-carousel${t}disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-carousel${t}disabled${t}${n}`)}`)}]),o("hs-selected",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected.${s(`hs-selected${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected .${s(`hs-selected${t}${n}`)}`)}]),o("hs-select-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-select-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-select-disabled${t}${n}`)}`)}]),o("hs-select-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-select-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-select-active${t}${n}`)}`)}]),o("hs-input-number-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-input-number-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-input-number-disabled${t}${n}`)}`)}]),o("hs-pin-input-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-pin-input-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-pin-input-active${t}${n}`)}`)}]),o("hs-select-opened",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.opened.${s(`hs-select-opened${t}${n}`)}`)}]),o("hs-password-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-password-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-password-active${t}${n}`)}`)}]),o("hs-stepper-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-stepper-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-stepper-active${t}${n}`)}`)}]),o("hs-stepper-success",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success.${s(`hs-stepper-success${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success .${s(`hs-stepper-success${t}${n}`)}`)}]),o("hs-stepper-completed",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.completed.${s(`hs-stepper-completed${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.completed .${s(`hs-stepper-completed${t}${n}`)}`)}]),o("hs-stepper-error",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error.${s(`hs-stepper-error${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error .${s(`hs-stepper-error${t}${n}`)}`)}]),o("hs-stepper-processed",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.processed.${s(`hs-stepper-processed${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.processed .${s(`hs-stepper-processed${t}${n}`)}`)}]),o("hs-stepper-disabled",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled.${s(`hs-stepper-disabled${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.disabled .${s(`hs-stepper-disabled${t}${n}`)}`)}]),o("hs-stepper-skipped",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.skipped.${s(`hs-stepper-skipped${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.skipped .${s(`hs-stepper-skipped${t}${n}`)}`)}]),o("hs-strong-password",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.passed.${s(`hs-strong-password${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.passed .${s(`hs-strong-password${t}${n}`)}`)}]),o("hs-strong-password-accepted",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.accepted.${s(`hs-strong-password-accepted${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.accepted .${s(`hs-strong-password-accepted${t}${n}`)}`)}]),o("hs-strong-password-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-strong-password-active${t}${n}`)}`)}]),o("hs-combo-box-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active .${s(`hs-combo-box-active${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-combo-box-active${t}${n}`)}`)}]),o("hs-combo-box-selected",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected .${s(`hs-combo-box-selected${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.selected.${s(`hs-combo-box-selected${t}${n}`)}`)}]),o("hs-combo-box-tab-active",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.active.${s(`hs-combo-box-tab-active${t}${n}`)}`)}]),o("hs-apexcharts-tooltip-dark",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.dark.${s(`hs-apexcharts-tooltip-dark${t}${n}`)}`)}]),o("hs-success",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success .${s(`hs-success${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.success.${s(`hs-success${t}${n}`)}`)}]),o("hs-error",[({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error .${s(`hs-error${t}${n}`)}`)},({modifySelectors:e,separator:t})=>{e(({className:n})=>`.error.${s(`hs-error${t}${n}`)}`)}]),o("hs-default-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.default .${s(`hs-default-mode-active${t}${n}`)}`)}),o("hs-dark-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.dark .${s(`hs-dark-mode-active${t}${n}`)}`)}),o("hs-auto-mode-active",({modifySelectors:e,separator:t})=>{e(({className:n})=>`.auto .${s(`hs-auto-mode-active${t}${n}`)}`)})},Ke=({model:o})=>{const[s]=i.useBrandingOptions(),[e]=i.useSelectedBlockIds(),[t]=i.useDarkMode(),[n]=i.useHighlightBlockId(),[u]=i.useSelectedStylingBlocks(),[a]=b.useAtom(i.draggedBlockIdAtom),{document:l,window:p}=P(),[f]=h.useState(l==null?void 0:l.getElementById("highlighted-block")),[d]=h.useState(l==null?void 0:l.getElementById("selected-block")),[m]=h.useState(l==null?void 0:l.getElementById("selected-styling-block")),[x]=h.useState(l==null?void 0:l.getElementById("dragged-block"));h.useEffect(()=>{t?l==null||l.documentElement.classList.add("dark"):l==null||l.documentElement.classList.remove("dark")},[t,l]);const j=c.get(s,"headingFont","DM Sans"),E=c.get(s,"bodyFont","DM Sans");return h.useEffect(()=>{const v=c.get(s,"primaryColor","#000"),g=c.get(s,"secondaryColor","#FFF"),k=c.get(s,"bodyBgLightColor","#fff"),B=c.get(s,"bodyBgDarkColor","#000"),A=c.get(s,"bodyTextDarkColor","#000"),M=c.get(s,"bodyTextLightColor","#fff"),D=xe([{color:v,name:"primary"},{color:g,name:"secondary"}]),T={"bg-light":k,"bg-dark":B,"text-dark":A,"text-light":M},y=c.get(s,"roundedCorners","0");!p||!p.tailwind||(p.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},fontFamily:{heading:[j],body:[E]},borderRadius:{DEFAULT:`${y||"0"}px`},colors:{...T,...D}}},plugins:[ue,pe,he,p.tailwind.plugin.withOptions(()=>We)]})},[s,p,j,E]),h.useEffect(()=>{d&&(d.textContent=`${c.map(e,v=>`[data-block-id="${v}"]`).join(",")}{
|
|
53
|
-
outline: 1px solid ${e.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
54
|
-
}`)},[e,d]),h.useEffect(()=>{if(!a){x.textContent="";return}x.textContent=`[data-block-id="${a}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[a]),h.useEffect(()=>{f&&(f.textContent=n?`[data-style-id="${n}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[n,e,f]),h.useEffect(()=>{m&&(m.textContent=`${c.map(u,({id:v})=>`[data-style-id="${v}"]`).join(",")}{
|
|
55
|
-
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
56
|
-
}`)},[u,m]),h.useEffect(()=>{const v=c.get(s,"bodyTextLightColor","#64748b"),g=c.get(s,"bodyTextDarkColor","#94a3b8"),k=c.get(s,"bodyBgLightColor","#FFFFFF"),B=c.get(s,"bodyBgDarkColor","#0f172a");l.body.className=`font-body antialiased text-[${v}] bg-[${k}] dark:text-[${g}] dark:bg-[${B}]`},[s,l,o]),o==="page"?r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[j&&r.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${j.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),E&&j!==E&&r.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${E.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),j&&r.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${j}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},Ye=()=>b.useAtom(i.canvasSettingsAtom),Ge=o=>{const s={};return Object.keys(o).forEach(e=>{c.isString(o[e])&&o[e].startsWith(L.SLOT_KEY)&&(s[e]=o[e].replace(L.SLOT_KEY,"").split(","))}),s},Xe=c.memoize(o=>{const s=o.replace(L.STYLES_KEY,"").split(",");return me.twMerge(s[0],s[1])});function Ze(o,s){return c.get(o,`${s}_attrs`,{})}function Qe(o){const s={};return Object.keys(o).forEach(e=>{if(c.isString(o[e])&&o[e].startsWith(L.STYLES_KEY)){const t=Xe(o[e]);s.__key=e,s[e]={className:t,"data-style-prop":e,"data-block-parent":o._id,"data-style-id":`${e}-${o._id}`,...Ze(o,e)}}}),s}function Je(o,s){const e=c.get(o,"_bindings",{});return c.isEmpty(e)?{...o}:(c.each(e,(t,n)=>{c.isString(t)&&c.get(s,t,null)&&(o[n]=c.get(s,t,null))}),o)}function U({blocks:o}){const[s]=i.useBlocksStore(),[e]=b.useAtom(i.xShowBlocksAtom),[t]=b.useAtom(q.draggedBlockAtom),[n]=b.useAtom(q.dropTargetAtom),[u]=Ye(),a=h.useCallback(d=>Qe(d),[]),[l]=F.useChaiExternalData(),[p]=b.useAtom(i.inlineEditingActiveAtom),f=h.useCallback(d=>d.reduce((m,x)=>{const j=c.get(u,x,{});return{...m,...j}},{}),[u,s]);return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:h.Children.toArray(o.map((d,m)=>{if(p===d._id)return null;const x=Ge(d),j={};c.isEmpty(x)||Object.keys(x).forEach(D=>{j[D]=h.Children.toArray(x[D].map(T=>r.jsxRuntimeExports.jsx(U,{blocks:[c.find(s,{_id:T})]})))});const E=c.filter(s,{_parent:d._id});j.children=E.length?r.jsxRuntimeExports.jsx(U,{blocks:E}):null;const v=ge.getBlockComponent(d._type),g=c.get(v,"builderComponent",c.get(v,"component",null));if(c.isNull(g))return r.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${d==null?void 0:d._type} not registered -->`});const k=c.has(v,"getBlockStateFrom")?v==null?void 0:v.getBlockStateFrom(d,s):[],B=f(k),A=a(d),M=c.get(A,"__key","styles");return c.has(A,M+".x-show")&&!c.includes(e,d._id)?null:r.jsxRuntimeExports.jsx(h.Suspense,{children:h.createElement(g,{blockProps:{"data-block-id":d._id,"data-block-type":d._type,...t?{"data-dnd":i.canAcceptChildBlock(d._type,t==null?void 0:t._type)?"yes":"no"}:{},...n===d._id?{"data-drop":"yes"}:{}},index:m,...Je(d,l),...c.omit(A,["__key"]),...j,inBuilder:!0,blockState:B})})}))})}const Ve=()=>{const[o]=i.useBlocksStore(),s=c.isEmpty(o)?null:r.jsxRuntimeExports.jsx(F.BlocksExternalDataProvider,{children:r.jsxRuntimeExports.jsx(U,{blocks:c.filter(o,e=>c.isEmpty(e._parent))})});return r.jsxRuntimeExports.jsx(r.jsxRuntimeExports.Fragment,{children:s})},et=(o,s)=>o.querySelector(`[data-style-id="${s}"]`),tt=()=>{const[o]=b.useAtom(i.networkModeAtom),[s]=i.usePreviewMode(),[e]=i.useCanvasWidth(),[,t]=i.useSelectedBlockIds(),n=i.useSelectedBlock(),[,u]=i.useHighlightBlockId(),a=h.useRef(null),l=h.useRef(null),[p,f]=h.useState({width:0,height:0}),d=Se(p),[m,x]=h.useState(0),[j,E]=h.useState([]),[,v]=h.useState([]),[,g]=b.useAtom(i.canvasIframeAtom),[k,B]=i.useSelectedStylingBlocks(),A=i.useBuilderProp("loading",!1),M=i.useBuilderProp("htmlDir","ltr");h.useEffect(()=>{const{clientWidth:y,clientHeight:C}=l.current;f({width:y,height:C}),m===0&&x(y)},[l,e,m]);const D=(y,C=0)=>{const{top:I}=y.getBoundingClientRect();return I+C>=0&&I-C<=window.innerHeight};h.useEffect(()=>{var y,C;if(n&&n.type!=="Multiple"&&a.current){const I=ne(a.current.contentDocument,n._id);I&&(D(I)||(C=(y=a.current)==null?void 0:y.contentWindow)==null||C.scrollTo({top:I.offsetTop,behavior:"smooth"}),E([I]))}},[n]),h.useEffect(()=>{if(!c.isEmpty(k)&&a.current){const y=et(a.current.contentDocument,c.first(k).id);v(y?[y]:[null])}else v([null])},[k]);const T=h.useMemo(()=>{let y=we;return y=y.replace("__HTML_DIR__",M),o==="offline"&&(y=y.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),y=y.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),y=y.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),y},[o]);return r.jsxRuntimeExports.jsx("div",{onClick:()=>{t([]),B([])},onMouseLeave:()=>setTimeout(()=>u(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:m>0&&!c.isEmpty(d)?{width:s?"100%":m}:{},ref:l,children:r.jsxRuntimeExports.jsxs(Ae,{contentDidMount:()=>g(a.current),ref:a,id:"canvas-iframe",style:{width:`${e}px`,...d},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:T,children:[r.jsxRuntimeExports.jsx(Oe,{}),r.jsxRuntimeExports.jsx(Ue,{block:n,selectedBlockElement:c.first(j)}),r.jsxRuntimeExports.jsx(Ke,{model:"page"}),r.jsxRuntimeExports.jsx(fe.Provider,{children:r.jsxRuntimeExports.jsx(He,{children:A?r.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"})}):r.jsxRuntimeExports.jsx(Ve,{})})}),r.jsxRuntimeExports.jsx("br",{}),r.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},st=h.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-vECReGwz.cjs"))),nt=()=>{const[o]=i.useCodeEditor();return r.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[r.jsxRuntimeExports.jsx(Re,{}),r.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden bg-slate-800/90 bg-[linear-gradient(to_right,#222_0.5px,transparent_0.5px),linear-gradient(to_bottom,#222_0.5px,transparent_0.5px)] bg-[size:12px_12px] px-2",children:[r.jsxRuntimeExports.jsx(h.Suspense,{fallback:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"}),children:r.jsxRuntimeExports.jsx(F.ErrorBoundary,{children:r.jsxRuntimeExports.jsx(tt,{})})}),o?r.jsxRuntimeExports.jsx(h.Suspense,{fallback:r.jsxRuntimeExports.jsx(i.Skeleton,{className:"h-full"}),children:r.jsxRuntimeExports.jsx(ve.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:r.jsxRuntimeExports.jsx(st,{})})}):null]})]})};exports.default=nt;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),c=require("react"),W=require("@react-hookz/web"),t=require("lodash-es"),I=require("react-i18next"),g=require("@radix-ui/react-icons"),o=require("./index-0FIxW0gR.cjs"),P=require("lucide-react"),L=require("@chaibuilder/runtime"),M=require("./index-sspgZwTk.cjs"),F=require("./index-gi1LIOCw.cjs"),ue=require("@rjsf/core"),de=require("@rjsf/validator-ajv8"),ce=require("jotai"),xe=require("react-autosuggest"),me=require("fuse.js"),$=require("./utils-D_vtk3zK.cjs"),ge=require("./MODIFIERS-mVmfEGgo.cjs"),X=require("lodash");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("tree-model");require("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");function ye(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(i,s,l.get?l:{enumerable:!0,get:()=>r[s]})}}return i.default=r,Object.freeze(i)}const z=ye(c);function he(r){const i=[],s={};function l(a,p){t.forEach(p,(x,m)=>{const n=a?`${a}.${m}`:m,d=t.isArray(x)?"list":typeof x;i.push(n),s[n]=d==="string"?"text":d==="object"?"model":d,d==="object"&&!t.isArray(x)&&l(n,x)})}return l("",t.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:i,pathsType:s}}const Z=({data:r,fullView:i})=>{if(!r)return null;const s=typeof r;return i?typeof r=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(M.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(F.JsonView,{data:r,shouldExpandNode:F.allExpanded,style:{...F.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"}})})]}):e.jsxRuntimeExports.jsxs("div",{className:"max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),r]}):e.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:t.truncate(s==="object"?JSON.stringify(r):r,{length:40})})},G=({type:r,value:i="",setValue:s,data:l,onChange:a,dataType:p,appliedBindings:x})=>{const{paths:m,pathsType:n}=he(l),d=r==="PROP"?L.getBlockComponent(l==null?void 0:l._type):{},y=r==="PROP",[u,f]=c.useState(!1),b=c.useMemo(()=>r==="PROP"?m.filter(h=>!t.includes(x,h)&&t.get(d,`props.${t.first(t.split(h,"."))}.binding`)):m.filter(h=>p===t.get(n,h,"")),[r,m,x,p,d]);return c.useEffect(()=>{i&&a(i)},[i,r]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:t.startCase(t.toLower(r))}),e.jsxRuntimeExports.jsxs(o.Popover,{open:u,onOpenChange:f,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(i)?"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:i?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[y&&e.jsxRuntimeExports.jsx("span",{className:"mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(p)}),i]}),e.jsxRuntimeExports.jsx("span",{className:"cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(r))]})})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{className:"z-[999] min-w-[300px] p-0",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(o.Command,{children:[e.jsxRuntimeExports.jsx(o.CommandInput,{placeholder:`Choose ${t.toLower(r)}...`}),e.jsxRuntimeExports.jsxs(o.CommandList,{children:[e.jsxRuntimeExports.jsx(o.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(o.CommandGroup,{children:t.map(b,h=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:h,className:`cursor-pointer ${y?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:R=>{s(t.find(b,C=>C===R)||null),f(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(P.Check,{className:`h-4 w-4 text-green-500 ${i===h?"":"opacity-0"}`}),h]}),y?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500",children:t.startCase(t.get(n,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(Z,{data:t.get(l,h)})})]},h))})]})]})})]})]}),!y&&!t.isEmpty(i)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(Z,{data:t.get(l,i,""),fullView:!0})})]})},be=({appliedBindings:r=[],onAddBinding:i,editMode:s,item:l})=>{const[a,p]=c.useState(s?l.key:""),[x,m]=c.useState(s?l.value:""),n=o.useSelectedBlock(),[d]=M.useChaiExternalData(),y=c.useCallback((b,h)=>{if(t.isEmpty(b))return"";{const R=t.get(h==="PROP"?n:d,b,"");if(t.isArray(R))return"list";const C=typeof R;return C==="string"?"text":C==="object"?"model":C}},[n,d]),[u,f]=c.useState(s?y(l.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DialogHeader,{children:[e.jsxRuntimeExports.jsx(o.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx(o.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col gap-1",children:[e.jsxRuntimeExports.jsx(G,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:a,setValue:p,onChange:b=>{const h=y(b,"PROP");p(b),u!==h&&m(""),f(h)},data:n,dataType:u,appliedBindings:r}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(G,{type:"PATH",isDisabled:t.isEmpty(a),placeholder:"Enter data path",value:x,setValue:m,onChange:b=>{const h=y(b,"PATH");m(u===h?b:"")},data:d,dataType:u,appliedBindings:r})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(a)&&t.isEmpty(x),onClick:()=>i({key:a,value:x}),children:"Save"})})]})},re=({disabled:r,children:i,onAddBinding:s,appliedBindings:l,editMode:a=!0,item:p={}})=>{const[x,m]=c.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:r,asChild:!0,onClick:()=>m(!0),children:i}),x&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(be,{item:p,editMode:a,appliedBindings:l,onAddBinding:n=>{s(n),m(!1)}})})]})},fe=({item:r,onAddBinding:i,onRemove:s,selectedBlock:l,dataProvider:a,appliedBindings:p})=>{const[x,m]=c.useState("string"),n=(d,y)=>{if(t.isEmpty(d))return"";{const u=t.get(y==="PROP"?l:a,d,"");if(t.isArray(u))return"list";const f=typeof u;return f==="string"?"text":f==="object"?"model":f}};return c.useEffect(()=>m(()=>n(r.key,"PROP")),[r.key]),e.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col rounded-md border border-gray-200 p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-sm font-normal text-gray-500",children:r.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:r.value}),e.jsxRuntimeExports.jsx(Z,{data:t.get(a,r.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(re,{editMode:!0,onAddBinding:i,appliedBindings:p,item:r,children:e.jsxRuntimeExports.jsx(P.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"})}),e.jsxRuntimeExports.jsx(P.TrashIcon,{onClick:()=>s(),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"})]}),!t.isEmpty(x)&&!t.isEmpty(r.key)&&e.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:t.startCase(x)})]})},je=({bindingData:r,onChange:i})=>{const s=o.useSelectedBlock(),[l]=M.useChaiExternalData(),a=L.getChaiDataProviders(),[p,x]=c.useState(t.map(r,(u,f)=>({key:f,value:u})));c.useEffect(()=>{x(t.map(r,(u,f)=>({key:f,value:u})))},[s==null?void 0:s._id,r]);const m=c.useMemo(()=>{if(t.isEmpty(l))return!0;if(t.isEmpty(p))return!1;const u=t.last(p);return t.isEmpty(u==null?void 0:u.key)||t.isEmpty(u==null?void 0:u.value)},[l,p]),n=u=>{const f=t.filter(p,b=>b.key!==u.key);x([...f,u]),y([...f,u])},d=u=>{const f=t.filter(p,(b,h)=>u!==h);y([...f])},y=c.useCallback((u=[])=>{if(x(u),t.isEmpty(u)){i({});return}const f={};t.forEach(u,b=>{!t.isEmpty(b==null?void 0:b.key)&&!t.isEmpty(b==null?void 0:b.value)&&t.set(f,b.key,b.value)}),i(f)},[i]);return t.isEmpty(a)?e.jsxRuntimeExports.jsx("div",{className:"flex w-full items-center justify-center",children:e.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. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(p,(u,f)=>e.jsxRuntimeExports.jsx(fe,{item:u,onAddBinding:n,onRemove:()=>d(f),selectedBlock:s,dataProvider:l,appliedBindings:t.map(p,"key")},u.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{disabled:t.isEmpty(l),className:"w-full",children:e.jsxRuntimeExports.jsx(re,{disabled:m,appliedBindings:t.map(p,"key"),onAddBinding:n,children:e.jsxRuntimeExports.jsx("span",{className:`w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${m?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(l)?e.jsxRuntimeExports.jsx("small",{className:"text-[9.5px] text-gray-500",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),m&&e.jsxRuntimeExports.jsx(o.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(l)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},ve=()=>e.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"}),Re=({id:r,placeholder:i})=>{const{t:s}=I.useTranslation(),[,l]=o.useCodeEditor(),a=o.useSelectedBlock();if(typeof window>"u")return null;const p=r.replace("root.",""),x=t.get(a,p,""),m=()=>{const n=a==null?void 0:a._id;l({blockId:n,blockProp:p,placeholder:i,initialCode:t.get(a,p,x)})};return e.jsxRuntimeExports.jsxs("div",{className:"mt-2 flex flex-col gap-y-1",children:[e.jsxRuntimeExports.jsx("button",{onClick:m,className:"text-pretty w-[90%] max-w-full cursor-default truncate rounded border bg-white p-2 text-left text-[10px]",children:x.trim().length>0?x.substring(0,46):i||"Eg: <script>console.log('Hello, world!');<\/script>"}),e.jsxRuntimeExports.jsx(o.Button,{onClick:m,size:"sm",variant:"outline",className:"w-fit",children:s("Open code editor")})]})},J=c.memo(({id:r,properties:i,formData:s,onChange:l})=>{const[a,p]=c.useState(s),x={type:"object",properties:{}},m={};Object.keys(i).forEach(d=>{const y=i[d];if(t.includes(["slot","styles"],y.type))return;const u=d;x.properties[u]=o.getBlockJSONFromSchemas(y),m[u]=o.getBlockJSONFromUISchemas(y)}),c.useEffect(()=>{p(s)},[r]);const n=W.useThrottledCallback(async({formData:d},y)=>{l({formData:d},y)},[l],1e3);return e.jsxRuntimeExports.jsx(ue,{widgets:{binding:ve,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField,code:Re},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:de,uiSchema:m,schema:x,formData:a,onChange:({formData:d},y)=>{y&&(p(d),n({formData:d},y))}})}),Ee=()=>{const[r,i]=ce.useAtom(o.xShowBlocksAtom),s=o.useSelectedBlock(),[,l]=o.useSelectedBlockIds(),{t:a}=I.useTranslation(),p=c.useMemo(()=>(s?JSON.stringify(s):"").includes('"x-show"'),[s]);if(!s||!p)return null;const x=r.includes(s._id);return e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-xs hover:no-underline",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2 border-b border-border bg-gray-200 px-4 py-2 font-normal",children:[s._name||s._type," ",a("visibility settings")]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 px-2 pt-2",children:[e.jsxRuntimeExports.jsx(o.Switch,{id:"show-on-canvas",checked:x,onCheckedChange:m=>{m?(i(n=>[...n,s._id]),l([s._id])):i(n=>n.filter(d=>d!==s._id))}}),e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"show-on-canvas",children:a("Show on canvas")})]})]})};function we(){const r=o.useSelectedBlock(),i=o.useUpdateBlocksPropsRealtime(),s=o.useUpdateBlocksProps(),l=L.getBlockComponent(r._type),a={...r},[p,x]=c.useState(a),m=o.useBuilderProp("dataBindingSupport",!1),n=({formData:b},h,R)=>{if(h&&(p==null?void 0:p._id)===r._id){const C=h.replace("root.","");s([r._id],{[C]:t.get(b,C)},R)}},d=c.useCallback(t.debounce(({formData:b},h,R)=>{n({formData:b},h,R),x(b)},1500),[r==null?void 0:r._id]),y=({formData:b},h)=>{if(h){const R=h.replace("root.","");i([r._id],o.convertDotNotationToObject(R,t.get(b,R.split(".")))),d({formData:b},h,{[R]:t.get(p,R)})}},u=t.keys(t.get(a,"_bindings",{})),f=c.useMemo(()=>{const b=t.cloneDeep(t.get(l,"props",{}));return m&&t.each(u,h=>delete b[h]),b},[l,u,m]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[m?e.jsxRuntimeExports.jsxs(o.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"px-4 pt-4",children:e.jsxRuntimeExports.jsx(je,{bindingData:t.get(r,"_bindings",{}),onChange:b=>{n({formData:{_bindings:b}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"bg-gray-100 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(o.AccordionContent,{className:"pt-4",children:[t.isEmpty(u)?null:e.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 ",e.jsxRuntimeExports.jsx("b",{children:t.map(u,t.capitalize).join(", ")})," ",u.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(J,{id:r==null?void 0:r._id,onChange:y,formData:a,properties:f})]})]})]}):e.jsxRuntimeExports.jsx(J,{id:r==null?void 0:r._id,onChange:y,formData:a,properties:f}),e.jsxRuntimeExports.jsx(Ee,{})]})}const Ce=({blockId:r})=>{const{t:i}=I.useTranslation(),{askAi:s,loading:l,error:a}=M.useAskAi(),[p,x]=c.useState(""),m=c.useRef(null);c.useEffect(()=>{var d;(d=m.current)==null||d.focus()},[]);const n=()=>{a||x("")};return e.jsxRuntimeExports.jsxs("div",{className:"",children:[e.jsxRuntimeExports.jsx("h2",{className:"mb-1 text-sm font-semibold leading-none tracking-tight",children:i("Ask AI")}),e.jsxRuntimeExports.jsx(o.Textarea,{ref:m,value:p,onChange:d=>x(d.target.value),placeholder:i("Ask AI to edit styles"),className:"w-full border border-gray-400 focus:border-0",rows:3,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),s("styles",r,p,n))}}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 my-2",children:[l?null:e.jsxRuntimeExports.jsx(o.Button,{disabled:p.trim().length<5||l,onClick:()=>s("styles",r,p,n),variant:"default",className:"w-fit",size:"sm",children:l?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(P.Loader,{className:"w-5 h-5 animate-spin"}),i("Generating... Please wait")]}):i("Edit with AI")}),l?e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxRuntimeExports.jsxs(o.Skeleton,{className:"flex items-center w-full px-4 py-1 pl-2 space-x-1",children:[e.jsxRuntimeExports.jsx(M.FaSpinner,{className:"w-4 h-4 text-gray-500 animate-spin"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:i("Generating... Please wait")})]}),e.jsxRuntimeExports.jsx(o.Button,{variant:"destructive",onClick:()=>stop(),className:"hidden w-fit",size:"sm",children:i("Stop")})]}):null]}),e.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:a&&e.jsxRuntimeExports.jsx("p",{className:"p-1 text-xs text-red-500 break-words bg-red-100 border border-red-500 rounded",children:a.message})})]})},Q=new me($.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function oe(){var k;const{t:r}=I.useTranslation(),[i]=o.useSelectedStylingBlocks(),s=o.useSelectedBlock(),l=o.useAddClassesToBlocks(),a=o.useRemoveClassesFromBlocks(),[p]=o.useSelectedBlockIds(),x=o.useBuilderProp("askAiCallBack",null),[m,n]=c.useState(""),{toast:d}=o.useToast(),y=(k=t.first(i))==null?void 0:k.prop,u=t.reject((t.get(s,y,"").replace(ge.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),f=()=>{const w=m.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");l(p,w,!0),n("")},[b,h]=c.useState([]),R=({value:w})=>{const T=w.trim().toLowerCase(),D=T.match(/.+:/g);let j=[];if(D&&D.length>0){const[v]=D,S=T.replace(v,"");j=Q.search(S).map(H=>({...H,item:{...H.item,name:v+H.item.name}}))}else j=Q.search(T);return h(t.map(j,"item"))},C=()=>{h([])},B=w=>w.name,_=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),V={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:r("Enter classes separated by space"),value:m,onKeyDown:w=>{w.key==="Enter"&&m.trim()!==""&&f()},onChange:(w,{newValue:T})=>n(T),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"},E=()=>{if(navigator.clipboard===void 0){d({title:"Clipboard not supported",description:"Please use Chrome, Firefox or Safari",variant:"destructive"});return}navigator.clipboard.writeText(u.join(" ")),d({title:"Copied",description:"Classes copied to clipboard"})};return e.jsxRuntimeExports.jsxs("div",{className:`flex ${b.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto border-b-2 bg-gray-100 pb-4`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("span",{children:r("Classes")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(g.CopyIcon,{onClick:E,className:"cursor-pointer"})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:r("Copy classes to clipboard")})})]})]}),x?e.jsxRuntimeExports.jsxs(o.Popover,{children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"h-6 w-fit",size:"sm",children:[e.jsxRuntimeExports.jsx(P.SparklesIcon,{className:"h-4 w-4"}),e.jsxRuntimeExports.jsx("span",{className:"ml-2",children:r("Ask AI")})]})}),e.jsxRuntimeExports.jsx(o.PopoverContent,{side:"left",className:"p-2",children:e.jsxRuntimeExports.jsx(Ce,{blockId:s==null?void 0:s._id})})]}):null]}),e.jsxRuntimeExports.jsxs("div",{className:"relative flex items-center gap-x-3",children:[e.jsxRuntimeExports.jsx("div",{className:"relative flex w-full items-center gap-x-3",children:e.jsxRuntimeExports.jsx(xe,{suggestions:b,onSuggestionsFetchRequested:R,onSuggestionsClearRequested:C,getSuggestionValue:B,renderSuggestion:_,inputProps:V,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"!bg-gray-300 ",suggestionsContainerOpen:"absolute bg-gray-100 z-50 max-h-[230px] overflow-y-auto w-full border border-gray-600 rounded-md"}})}),e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:f,disabled:m.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(g.PlusIcon,{})})]}),e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-wrap gap-2 overflow-x-hidden",children:z.Children.toArray(u.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-gray-300 bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300",children:[w,e.jsxRuntimeExports.jsx(g.Cross2Icon,{onClick:()=>a(p,[w]),className:"invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))})]})}const ke=c.memo(function({preloadedAttributes:i=[],onAttributesChange:s}){const[l,a]=c.useState([]),[p,x]=c.useState(""),[m,n]=c.useState(""),[d,y]=c.useState(null),[u,f]=c.useState(""),b=c.useRef(null),h=c.useRef(null);c.useEffect(()=>{b.current&&b.current.focus()},[l]),c.useEffect(()=>{a(i)},[i]);const R=()=>{if(p.startsWith("@")){f("Attribute keys cannot start with '@'");return}if(p){const E=[...l,{key:p,value:m}];s(E),a(l),x(""),n(""),f("")}},C=E=>{const k=l.filter((w,T)=>T!==E);s(k),a(k)},B=E=>{y(E),x(l[E].key),n(l[E].value)},_=()=>{if(p.startsWith("@")){f("Attribute keys cannot start with '@'");return}if(d!==null&&p){const E=[...l];E[d]={key:p,value:m},s(E),a(E),y(null),x(""),n(""),f("")}},V=E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),d!==null?_():R())};return e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsxs("form",{onSubmit:E=>{E.preventDefault(),d!==null?_():R()},className:"space-y-3",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"attrKey",className:"text-xs",children:"Key"}),e.jsxRuntimeExports.jsx(o.Input,{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",id:"attrKey",ref:b,value:p,onChange:E=>x(E.target.value),placeholder:"Key",className:"h-8 text-sm"})]}),e.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"attrValue",className:"text-xs",children:"Value"}),e.jsxRuntimeExports.jsx(o.Textarea,{autoCapitalize:"off",autoCorrect:"off",spellCheck:"false",id:"attrValue",rows:2,ref:h,value:m,onChange:E=>n(E.target.value),onKeyDown:V,placeholder:"Value",className:"bg-background text-sm"})]})]}),e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"h-8 w-full text-sm",children:d!==null?"Save":"Add"}),u&&e.jsxRuntimeExports.jsx("p",{className:"text-xs text-red-500",children:u})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-4 space-y-1 overflow-y-auto",children:l.map((E,k)=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded bg-muted p-1.5 text-sm",children:[e.jsxRuntimeExports.jsxs("div",{className:"mr-2 flex flex-col",children:[e.jsxRuntimeExports.jsx("span",{className:"truncate font-semibold",children:E.key}),e.jsxRuntimeExports.jsx("span",{className:"text-wrap max-w-[200px] text-muted-foreground",children:E.value.toString()})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex-shrink-0",children:[e.jsxRuntimeExports.jsxs(o.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>B(k),children:[e.jsxRuntimeExports.jsx(P.Edit2,{className:"h-3 w-3"}),e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Edit attribute"})]}),e.jsxRuntimeExports.jsxs(o.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>C(k),children:[e.jsxRuntimeExports.jsx(P.X,{className:"h-3 w-3"}),e.jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Remove attribute"})]})]})]},k))})]})}),Ne=z.memo(()=>{const r=o.useSelectedBlock(),[i,s]=c.useState([]),[l]=o.useSelectedStylingBlocks(),a=o.useUpdateBlocksPropsRealtime(),p=o.useUpdateBlocksProps(),x=`${t.get(l,"0.prop")}_attrs`;z.useEffect(()=>{const n=t.map(t.get(r,x),(d,y)=>({key:y,value:d}));t.isEmpty(n)?s([]):s(n)},[t.get(r,x)]);const m=z.useCallback((n=[])=>{const d={};t.forEach(n,y=>{t.isEmpty(y.key)||t.set(d,y.key,y.value)}),p([t.get(r,"_id")],{[x]:d})},[r,a,x]);return e.jsxRuntimeExports.jsx("div",{className:"mb-20 flex min-h-max flex-col gap-y-2 overflow-y-auto",children:e.jsxRuntimeExports.jsx("div",{className:"flex flex-col",children:e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(ke,{preloadedAttributes:i,onAttributesChange:m})})})})}),N=["px","%","em","rem","ch","vh","vw"],Se={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:N,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"}]},Te={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"}]},_e=[{heading:"Styles",items:[{component:oe},{type:"arbitrary",label:"layout.width",units:N.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:N.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...N,"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:N},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:N.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"}]}]},{heading:"Attributes",items:[{component:Ne}]}],Je=[{heading:"layout.heading",items:[{type:"arbitrary",label:"layout.width",units:N.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:N.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...N,"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:"multiple",label:"layout.space_bt",options:[{key:"spaceX",label:"layout.space_lr"},{key:"spaceY",label:"layout.space_tb"}]}]},{heading:"size.heading",items:[{styleType:"accordion",heading:"size.min_width_height",items:[{type:"arbitrary",label:"size.min_width",units:N.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"size.min_height",units:N.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"size.max_width_height",items:[{type:"arbitrary",label:"size.max_width",units:N.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"size.max_height",units:N.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"size.object_options_aspect_ratio",items:[{type:"dropdown",label:"size.aspect",property:"aspectRatio"},{type:"dropdown",label:"size.fit",property:"objectFit"},{type:"dropdown",label:"size.position",property:"objectPosition"}]}]},{heading:"display.heading",items:[{type:"dropdown",label:"display.display",property:"display",units:N},{styleType:"accordion",heading:"display.flex_options",items:[{type:"dropdown",label:"display.flex_direction",property:"flexDirection"},{type:"dropdown",label:"display.flex_wrap",property:"flexWrap"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"display.grid_options",items:[{type:"range",label:"display.grid_columns",property:"gridColumns"},{type:"range",label:"display.grid_rows",property:"gridRows"},{type:"dropdown",label:"display.grid_auto_flow",property:"gridAutoFlow"},{type:"dropdown",label:"display.grid_auto_cols",property:"gridAutoColumns"},{type:"dropdown",label:"display.grid_auto_rows",property:"gridAutoRows"},{type:"dropdown",label:"display.justify_content",property:"justifyContent"},{type:"dropdown",label:"display.align_content",property:"alignContent"},{type:"dropdown",label:"display.align_items",property:"alignItems"},{styleType:"multiple",label:"display.gap",units:["px","rem"],options:[{key:"gap",label:"display.gap_all"},{key:"gapX",label:"display.gap_lr"},{key:"gapY",label:"display.gap_tb"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"display.visibility_opacity",items:[{type:"dropdown",label:"display.visibility",property:"visibility",units:N},{type:"arbitrary",label:"display.opacity",property:"opacity",units:["-"]}]}]},{heading:"position.heading",items:[{type:"icons",label:"position.position",property:"position"},{styleType:"accordion",heading:"position.options",items:[{styleType:"multiple",label:"position.direction",options:[{key:"top",label:"position.top"},{key:"right",label:"position.right"},{key:"bottom",label:"position.bottom"},{key:"left",label:"position.left"}]},{styleType:"multiple",label:"position.inset",options:[{key:"inset",label:"position.all"},{key:"insetX",label:"position.lr"},{key:"insetY",label:"position.tb"}]},{type:"arbitrary",label:"position.z_index",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"position.float_clear",items:[{type:"icons",label:"position.float",property:"float"},{type:"dropdown",label:"position.clear",property:"clear"}]},{styleType:"accordion",heading:"position.overflow_overscroll",items:[{styleType:"multiple",type:"dropdown",label:"position.overflow",options:[{key:"overflow",label:"position.all"},{key:"overflowX",label:"position.lr"},{key:"overflowY",label:"position.tb"}]},{styleType:"multiple",type:"dropdown",label:"position.overscroll",options:[{key:"overscroll",label:"position.all"},{key:"overscrollX",label:"position.lr"},{key:"overscrollY",label:"position.tb"}]}]}]},{heading:"typography.heading",items:[{type:"dropdown",property:"fontFamily",label:"typography.font"},{type:"arbitrary",property:"fontSize",label:"typography.size",units:N},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:N.concat("-")},{type:"range",property:"fontWeight",label:"typography.weight"},{type:"color",property:"textColor",label:"typography.color"},{styleType:"accordion",heading:"typography.alignments",items:[{type:"dropdown",property:"textAlign",label:"typography.align"},{type:"dropdown",property:"verticalAlign",label:"typography.valign"}]},{styleType:"accordion",heading:"typography.spacing_decoration_more",items:[{type:"dropdown",property:"letterSpacing",label:"typography.spacing"},{type:"dropdown",property:"textDecoration",label:"typography.decoration"},{type:"range",property:"textDecorationThickness",label:"typography.thickness"},{type:"dropdown",property:"textTransform",label:"typography.transform"}]},{styleType:"accordion",heading:"typography.whitespace_breaks",items:[{type:"dropdown",property:"whitespace",label:"typography.whitespace"},{type:"dropdown",property:"wordbreak",label:"typography.wordbreak"}]}]},{heading:"background.heading",items:[{type:"color",label:"background.bgcolor",property:"backgroundColor"},{styleType:"accordion",heading:"background.position_size_more",items:[{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"}]},{type:"dropdown",label:"background.gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"background.gradient_colors",items:[{type:"color",label:"background.from_color",property:"fromColor"},{type:"color",label:"background.via_color",property:"viaColor"},{type:"color",label:"background.to_color",property:"toColor"}]}]},{heading:"border.heading",items:[{styleType:"multiple",type:"dropdown",label:"border.width",options:[{key:"border",label:"border.all"},{key:"borderX",label:"border.lr"},{key:"borderY",label:"border.tb"},{key:"borderTop",label:"border.top"},{key:"borderRight",label:"border.right"},{key:"borderBottom",label:"border.bottom"},{key:"borderLeft",label:"border.left"}]},{styleType:"multiple",type:"dropdown",label:"border.corners",options:[{key:"borderRadius",label:"border.all"},{key:"borderRadiusTop",label:"border.top"},{key:"borderRadiusRight",label:"border.right"},{key:"borderRadiusBottom",label:"border.bottom"},{key:"borderRadiusLeft",label:"border.left"},{key:"borderRadiusTopLeft",label:"border.top_left"},{key:"borderRadiusTopRight",label:"border.top_right"},{key:"borderRadiusBottomRight",label:"border.bottom_right"},{key:"borderRadiusBottomLeft",label:"border.bottom_left"}]},{type:"color",label:"border.color",property:"borderColor"},{type:"dropdown",label:"border.style",property:"borderStyle"},{styleType:"accordion",heading:"border.divide_options",items:[{styleType:"multiple",type:"range",label:"border.width",options:[{key:"divideXWidth",label:"border.lr"},{key:"divideYWidth",label:"border.tb"}]},{type:"color",label:"border.divide_color",property:"divideColor"},{type:"dropdown",label:"border.divide_style",property:"divideStyle"}]},{styleType:"accordion",heading:"border.outline_styling",items:[{type:"range",label:"border.outline_width",property:"outlineWidth"},{type:"range",label:"border.outline_offset",property:"outlineOffset"},{type:"dropdown",label:"border.outline_style",property:"outlineStyle"}]},{styleType:"accordion",heading:"border.ring_options",items:[{type:"range",label:"border.ring_width",property:"ringWidth"},{type:"color",label:"border.ring_color",property:"ringColor"},{type:"range",label:"border.ring_offset_width",property:"ringOffsetWidth"},{type:"color",label:"border.ring_offset_color",property:"ringOffsetColor"}]}]},{heading:"effect.heading",items:[{type:"range",label:"effect.shadow",property:"boxShadow"},{type:"color",label:"effect.color",property:"boxShadowColor"},{type:"dropdown",label:"effect.cursor",property:"cursor"},{styleType:"accordion",heading:"effect.blend_cursor",items:[{type:"dropdown",label:"effect.mix_blend",property:"mixBlendMode"},{type:"dropdown",label:"effect.bg_blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"effect.transform",items:[{type:"dropdown",label:"effect.origin",property:"transformOrigin"},{styleType:"multiple",label:"effect.scale",units:["-"],options:[{key:"scale",label:"effect.all"},{key:"scaleX",label:"effect.lr"},{key:"scaleY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.skew",units:["deg"],options:[{key:"skewX",label:"effect.lr"},{key:"skewY",label:"effect.tb"}]},{styleType:"multiple",label:"effect.translate",negative:!0,options:[{key:"translateX",label:"effect.lr"},{key:"translateY",label:"effect.tb"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"effect.rotate",property:"rotate"}]},{styleType:"accordion",heading:"effect.animation",items:[{type:"dropdown",label:"effect.animation",property:"animation"},{type:"dropdown",label:"effect.transition",property:"transition"},{type:"dropdown",label:"effect.easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"effect.duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"effect.delay",property:"delay"}]}]},{heading:"classes.heading",items:[{component:oe}]}],ne={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:g.EyeOpenIcon,invisible:g.EyeClosedIcon,hidden:g.EyeClosedIcon,gap:g.BorderAllIcon,gapX:g.WidthIcon,gapY:g.HeightIcon,spaceX:g.WidthIcon,spaceY:g.HeightIcon,overscroll:g.BorderAllIcon,overscrollX:g.WidthIcon,overscrollY:g.HeightIcon,overflow:g.BorderAllIcon,overflowX:g.WidthIcon,overflowY:g.HeightIcon,top:g.ArrowUpIcon,right:g.ArrowRightIcon,bottom:g.ArrowDownIcon,left:g.ArrowLeftIcon,inset:g.BorderAllIcon,insetX:g.WidthIcon,insetY:g.HeightIcon,border:g.BorderAllIcon,borderX:g.WidthIcon,borderY:g.HeightIcon,borderTop:g.ArrowUpIcon,borderRight:g.ArrowRightIcon,borderBottom:g.ArrowDownIcon,borderLeft:g.ArrowLeftIcon,borderRadius:g.BorderAllIcon,borderRadiusX:g.WidthIcon,borderRadiusY:g.HeightIcon,borderRadiusTop:g.ArrowUpIcon,borderRadiusRight:g.ArrowRightIcon,borderRadiusBottom:g.ArrowDownIcon,borderRadiusLeft:g.ArrowLeftIcon,borderRadiusTopLeft:g.ArrowTopLeftIcon,borderRadiusTopRight:g.ArrowTopRightIcon,borderRadiusBottomRight:g.ArrowBottomRightIcon,borderRadiusBottomLeft:g.ArrowBottomLeftIcon,divideXWidth:g.WidthIcon,divideYWidth:g.HeightIcon,scale:g.BorderAllIcon,scaleX:g.WidthIcon,scaleY:g.HeightIcon,skewX:g.WidthIcon,skewY:g.HeightIcon,translateX:g.WidthIcon,translateY:g.HeightIcon,padding:g.BorderAllIcon,paddingX:g.WidthIcon,paddingY:g.HeightIcon,paddingTop:g.ArrowUpIcon,paddingRight:g.ArrowRightIcon,paddingBottom:g.ArrowDownIcon,paddingLeft:g.ArrowLeftIcon,margin:g.BorderAllIcon,marginX:g.WidthIcon,marginY:g.HeightIcon,marginTop:g.ArrowUpIcon,marginRight:g.ArrowRightIcon,marginBottom:g.ArrowDownIcon,marginLeft:g.ArrowLeftIcon,textLeft:g.AlignLeftIcon,textCenter:g.AlignCenterHorizontallyIcon,textRight:g.AlignRightIcon,textJustify:g.StretchHorizontallyIcon,italic:g.FontItalicIcon,underline:g.UnderlineIcon,overline:g.OverlineIcon,uppercase:g.LetterCaseUppercaseIcon,block:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":g.Cross2Icon,fixed:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.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"}),e.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:g.Cross1Icon},O=c.createContext({canReset:!1,canChange:!0}),Ie=({children:r,canReset:i=!1,canChange:s=!0})=>e.jsxRuntimeExports.jsx(O.Provider,{value:{canReset:i,canChange:s},children:r}),ie=({label:r,property:i,onChange:s})=>{const l=c.useMemo(()=>t.get($.CLASSES_LIST,`${i}.classes`,[""]),[i]),a=q(i),p=c.useMemo(()=>t.get(a,"cls",""),[a]),{canChange:x}=c.useContext(O),m=/\[.*\]/g.test(p);return e.jsxRuntimeExports.jsx("div",{className:r?"w-full rounded":"grow",children:m?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(o.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:p}),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(g.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(U,{rounded:r,onChange:n=>s(n,i),selected:p,options:l,disabled:!x})})};function U({selected:r,onChange:i,rounded:s=!1,options:l,disabled:a=!1}){const p=r.replace(/.*:/g,"").trim(),{undo:x,redo:m}=o.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!l.length||a,className:`${s?"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:n=>i(n.target.value),onKeyDown:n=>{n.ctrlKey&&(n.key==="z"&&x(),n.key==="y"&&m())},value:p,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),c.Children.toArray(l.map(n=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:n,children:n})))]})}const Be=({property:r,onChange:i})=>{const{canReset:s,canChange:l}=c.useContext(O),a=q(r),p=c.useMemo(()=>t.get(a,"cls",""),[a]),x=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),m=x.indexOf(p)>-1?x.indexOf(p):0,n=/\[.*\]/g.test(p);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:n?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:p}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.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:!l&&(!s||m-1<0),onClick:()=>i(t.nth(x,m-1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(g.MinusIcon,{className:!l&&(!s||m-1<0)?"text-gray-500":"text-black/60 dark:text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(ie,{label:!1,property:r,onChange:i})}),e.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:!l&&(!s||m+1>=x.length),onClick:()=>i(t.nth(x,m+1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(g.PlusIcon,{className:!l&&(!s||m+1>=x.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Ae=({property:r,onChange:i})=>{const s=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:l}=c.useContext(O),a=q(r),p=c.useMemo(()=>t.get(a,"cls",""),[a]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(s,x=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!l,onClick:()=>i(x,r),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${p===x?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:c.createElement(t.get(ne,x,g.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(x))})]}))})},He={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Ve=({property:r,onChange:i})=>{const s=q(r),l=c.useMemo(()=>t.get(s,"cls",""),[s]),{canChange:a}=c.useContext(O),[p,x]=c.useState([]),[m,n]=c.useState({color:"",shade:""}),d=l.split("-"),y=t.get(d,"1",""),u=t.get(d,"2",""),f=c.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(x([]),n({color:h})):(x(["50","100","200","300","400","500","600","700","800","900"]),n(R=>({...R,color:h,shade:R.shade?R.shade:"500"})))},[x,n]);c.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(y))return x([]);x(["50","100","200","300","400","500","600","700","800","900"])},[y]);const b=c.useCallback(h=>{n({color:y,shade:h})},[y]);return c.useEffect(()=>{n({color:"",shade:""})},[s]),c.useEffect(()=>{const R=`${t.get(He,r,"")}-${m.color}${m.shade?`-${m.shade}`:""}`;R.match(new RegExp(t.get($.CLASSES_LIST,`${r}.regExp`,"")))&&i(R,r)},[m,i,r]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(U,{disabled:!a,rounded:!0,selected:y,onChange:f,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"]})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"grow text-center",children:e.jsxRuntimeExports.jsx(U,{rounded:!0,selected:u,disabled:!y||!a,onChange:b,options:p})})]})},ee=(r,i)=>{r=r.toLowerCase();let s=r.trim().replace(/ |\+/g,"");if((s==="auto"||s==="none")&&i.includes(s))return{value:"",unit:s};const l=i.length?new RegExp(i.join("|"),"g"):/XXXXXX/g;s=s.replace(l,"");const a=r.match(l),p=a&&a.length>1,x=!t.isEmpty(s)&&Number.isNaN(Number(s));return p||x?{error:"Invalid value"}:a&&(a[0]==="auto"||a[0]==="none")?{value:a[0],unit:""}:{value:s,unit:a?a[0]:""}};const De=r=>{const i=r.startsWith("-")?"-":"",s=r.split("-").pop();if(["auto","none"].includes(s))return{value:"",unit:s};if(s==="px")return{value:"1",unit:"px"};if(s==="screen")return{value:"100",unit:r.indexOf("w-")!==-1?"vw":"vh"};if(s==="full")return{value:"100",unit:"%"};if(t.includes(r,"skew-"))return{value:`${i}${s}`,unit:"deg"};if(t.includes(r,"rotate-"))return{value:`${i}${s}`,unit:"deg"};if(t.includes(r,"opacity-"))return{value:`${s/100}`,unit:"-"};if(t.includes(r,"duration-")||t.includes(r,"delay-"))return{value:`${s}`,unit:"ms"};if(t.includes(r,"translate-")&&!s.includes("/"))return{value:`${i}${`${s/4}`}`,unit:"rem"};if(t.includes(r,"scale-"))return{value:`${i}${`${s/100}`}`,unit:"-"};if(t.startsWith(r,"border")){const l=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(l)return{value:l[0].split("-").pop(),unit:"px"};if(r.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.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(s==="xs")return{value:"320",unit:"px"};if(s==="sm")return{value:"384",unit:"px"};if(s==="md")return{value:"448",unit:"px"};if(s==="lg")return{value:"512",unit:"px"};if(s==="xl")return{value:"576",unit:"px"};if(s==="2xl")return{value:"672",unit:"px"};if(s==="3xl")return{value:"768",unit:"px"};if(s==="4xl")return{value:"896",unit:"px"};if(s==="5xl")return{value:"1024",unit:"px"};if(s==="6xl")return{value:"1152",unit:"px"};if(s==="7xl")return{value:"1280",unit:"px"};if(s==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(r,"text-")){if(s==="xs")return{value:"12",unit:"px"};if(s==="sm")return{value:"14",unit:"px"};if(s==="base")return{value:"16",unit:"px"};if(s==="lg")return{value:"18",unit:"px"};if(s==="xl")return{value:"20",unit:"px"};if(s==="2xl")return{value:"24",unit:"px"};if(s==="3xl")return{value:"30",unit:"px"};if(s==="4xl")return{value:"36",unit:"px"};if(s==="5xl")return{value:"48",unit:"px"};if(s==="6xl")return{value:"60",unit:"px"};if(s==="7xl")return{value:"72",unit:"px"};if(s==="8xl")return{value:"96",unit:"px"};if(s==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(r,"leading-")){if(s==="none")return{value:"1",unit:"-"};if(s==="tight")return{value:"1.25",unit:"-"};if(s==="snug")return{value:"1.375",unit:"-"};if(s==="normal")return{value:"1.5",unit:"-"};if(s==="relaxed")return{value:"1.625",unit:"-"};if(s==="loose")return{value:"2",unit:"-"}}if(t.startsWith(r,"tracking-")){if(s==="tighter")return{value:"-0.05",unit:"em"};if(s==="tight")return{value:"-0.025",unit:"em"};if(s==="normal")return{value:"0",unit:"em"};if(s==="wide")return{value:"0.025",unit:"em"};if(s==="wider")return{value:"0.05",unit:"em"};if(s==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(s))return{value:r,unit:"class"};if(s.includes("/")){const[l,a]=t.map(s.split("/"),p=>parseInt(p,10));return{value:i+(l/a*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(s))?{value:`${i+parseFloat(s)*4}`,unit:"px"}:{value:s,unit:"class"}};const Pe=r=>{if(t.isEmpty(r))return{value:"",unit:""};const i=r.match(/\[.*\]/g);if(i===null)return Me(r);const s=t.get(i,"0","").replace(/\[|\]/g,""),l=r.startsWith("-")?"-":"",a=t.first(s.match(/\d+.\d+|\d+/g));return{value:`${l}${a}`,unit:s.replace(a,"")}},Me=r=>t.isEmpty(r)?{value:"",unit:""}:De(r),le=c.createContext({setDragData:()=>{}}),$e=({unit:r,currentValue:i,onDrag:s,onDragEnd:l,onDragStart:a,negative:p,cssProperty:x})=>{const{setDragData:m}=c.useContext(le);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:n=>{const d={onDrag:s,onDragEnd:l,dragging:!0,dragStartY:n.pageY,dragStartValue:`${i}`,dragUnit:r,negative:p,cssProperty:x};a(d),m(d)},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:e.jsxRuntimeExports.jsx(g.RowSpacingIcon,{})})},Le=({onSelect:r,current:i,units:s})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:s.map(l=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:i===l?"primary":void 0,size:"sm",onClick:a=>{a.stopPropagation(),r(l)},children:l},l))}),te=50,Oe=r=>{const[i,s]=c.useState(!1),[l,a]=c.useState(""),{currentClass:p,onChange:x,classPrefix:m,cssProperty:n,units:d,negative:y}=r,[u,f]=c.useState(n!=null&&n.toLowerCase().includes("width")?"%":d[0]),[b,h]=c.useState(!1),[R,C]=c.useState(""),[B,_]=c.useState(!1),[V,E]=c.useState(!1);c.useEffect(()=>{const{value:j,unit:v}=Pe(p);if(v===""){a(j),f(n!=null&&n.toLowerCase().includes("width")?"%":t.first(d));return}f(v),a(v==="class"||t.isEmpty(j)?"":j)},[p,n,d]);const k=W.useThrottledCallback(j=>x(j),[x],te),w=W.useThrottledCallback(j=>x(j,!1),[x],te),T=c.useCallback((j=!1)=>{const v=ee(`${l}`,d);if(t.get(v,"error",!1)){h(!0);return}const S=t.get(v,"unit")!==""?t.get(v,"unit"):u;if(S==="auto"||S==="none"){k(`${m}${S}`);return}if(t.get(v,"value")==="")return;const H=`${t.get(v,"value","").startsWith("-")?"-":""}${m}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;j?w(H):k(H)},[k,w,l,u,m,d]),D=c.useCallback(j=>{const v=ee(`${l}`,d);if(t.get(v,"error",!1)){h(!0);return}if(j==="auto"||j==="none"){k(`${m}${j}`);return}if(t.get(v,"value")==="")return;const S=t.get(v,"unit")!==""?t.get(v,"unit"):j,H=`${t.get(v,"value","").startsWith("-")?"-":""}${m}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;k(H)},[k,l,m,d]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:u==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:p}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(g.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${B?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(u)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:u==="class",onKeyPress:j=>{j.key==="Enter"&&T()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),E(!0);const v=t.parseInt(j.target.value);let S=t.isNaN(v)?0:v;j.keyCode===38&&(S+=1),j.keyCode===40&&(S-=1);const A=`${S}`,pe=`${A.startsWith("-")?"-":""}${m}[${A.replace("-","")}${u==="-"?"":u}]`;w(pe)},onKeyUp:j=>{V&&(j.preventDefault(),E(!1))},onBlur:()=>T(),onChange:j=>{h(!1),a(j.target.value)},onClick:j=>{var v;(v=j==null?void 0:j.target)==null||v.select(),s(!1)},value:B?R:l,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",b?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(o.Tooltip,{open:i,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>s(!i),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:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${d.length===1?"px-2 font-semibold":""}`,children:u}),d.length>1?e.jsxRuntimeExports.jsx(g.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Le,{units:d,current:u,onSelect:j=>{s(!1),f(j),D(j)}})})})]})]}),["none","auto"].indexOf(u)!==-1||B?null:e.jsxRuntimeExports.jsx($e,{onDragStart:()=>_(!0),onDragEnd:j=>{if(C(()=>""),_(!1),t.isEmpty(j))return;const v=`${j}`,A=`${v.startsWith("-")?"-":""}${m}[${v.replace("-","")}${u==="-"?"":u}]`;k(A)},onDrag:j=>{if(t.isEmpty(j))return;C(j);const v=`${j}`,A=`${v.startsWith("-")?"-":""}${m}[${v.replace("-","")}${u==="-"?"":u}]`;w(A)},currentValue:l,unit:u,negative:y,cssProperty:n})]})})})},q=r=>{const i=o.useSelectedBlockCurrentClasses();return t.findLast(i,{property:r})},qe=(r,i)=>{const s={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return s[t.get(r,"mq","xs")]<=s[i]},ze={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-"},se={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},We=r=>`${r.toUpperCase()} ${se[r]?`(${se[r]} & up)`:""}`,K=r=>{const{t:i}=I.useTranslation(),{type:s="icons",label:l,property:a,onEmitChange:p=()=>{},units:x,negative:m=!1}=r,[n]=o.useDarkMode(),[d]=o.useStylingState(),[,y]=o.useCanvasWidth(),u=q(a),f=o.useAddClassesToBlocks(),b=o.useRemoveClassesFromBlocks(),[h]=o.useSelectedBlockIds(),R=c.useMemo(()=>t.get(u,"fullCls",""),[u]),C=c.useCallback((w,T=!0)=>{const D={dark:n,mq:y,mod:d,cls:w,property:a,fullCls:""};(n||d!=="")&&(D.mq="xs");const j=$.generateFullClsName(D);f(h,[j],T)},[h,n,y,d,a,f]),B=c.useCallback(()=>{b(h,[R])},[h,R,b]),_=c.useMemo(()=>qe(u,y),[u,y]);c.useEffect(()=>{p(_,u)},[_,p,u]);const[,,V]=o.useCanvasWidth(),E=c.useCallback(w=>{V({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[w])},[V]),k=t.get(u,"dark",null)===n&&t.get(u,"mod",null)===d&&t.get(u,"mq",null)===y;return e.jsxRuntimeExports.jsx(Ie,{canChange:_,canReset:u&&k,children:e.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:e.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${u&&!k?"text-foreground":""}`,children:i(l)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[s==="arbitrary"?e.jsxRuntimeExports.jsx(Oe,{currentClass:t.get(u,"cls",""),classPrefix:t.get(ze,a,""),units:x||[],onChange:C,negative:m,cssProperty:a}):null,s==="icons"&&e.jsxRuntimeExports.jsx(Ae,{property:a,onChange:C}),s==="range"&&e.jsxRuntimeExports.jsx(Be,{property:a,onChange:C}),s==="color"&&e.jsxRuntimeExports.jsx(Ve,{property:a,onChange:C}),s==="dropdown"&&e.jsxRuntimeExports.jsx(ie,{label:l,property:a,onChange:C})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${R?"visible":"invisible"}`,children:k?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>B(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(g.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):_&&u?e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(g.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold",children:[We(t.get(u,"mq")),n&&!u.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>E(t.get(u,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(u,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Fe=["px","%","em","rem","ch","vh","vw"],ae=({label:r,options:i,borderB:s=!1,borderT:l=!1,type:a="arbitrary",units:p=Fe,negative:x=!1})=>{const{t:m}=I.useTranslation(),[n,d]=c.useState(i[0].key),y=o.useSelectedBlockCurrentClasses(),u=c.useCallback(f=>t.map(y,"property").includes(f),[y]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${s?"border-b":""} ${l?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[r&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:m(r)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:c.Children.toArray(i.map(({label:f,key:b})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>d(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===n?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[c.createElement("div",{className:u(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),c.createElement(t.get(ne,b,g.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(f))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(K,{type:a,units:[...p],label:"",property:n,negative:x})})]})},Xe=({heading:r,items:i})=>{const{t:s}=I.useTranslation(),l=o.useSelectedBlockCurrentClasses(),a=c.useMemo(()=>{const p=n=>t.flatten(n.map(d=>d.styleType==="multiple"?t.map(d.options,"key"):d.property)),x=t.flatten(i.map(n=>n.styleType==="accordion"?p(n.items):n.styleType==="multiple"?t.map(n.options,"key"):n.property)),m=t.map(l,"property");return t.intersection(x,m).length>0},[l,i]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[s(r),a?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${a?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:i.map(p=>p.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...p},p.label):e.jsxRuntimeExports.jsx(K,{...p},p.label))})]})},Ye=c.createContext({}),Y=({section:r})=>{const{t:i}=I.useTranslation(),s=o.useSelectedBlockCurrentClasses(),l=o.useSelectedBlock(),a=c.useCallback((n=[])=>{const d={};for(let u=0;u<s.length;u++)d[s[u].property]=s[u].cls;let y=!0;for(const u in n)if(!t.has(d,u)||d[u]!==n[u]){y=!1;break}return y},[s]),p=c.useMemo(()=>({}),[]),[x]=o.useSelectedStylingBlocks(),m=c.useMemo(()=>{const n=`${X.get(x,"0.prop")}_attrs`;return!X.isEmpty(X.get(l,n,{}))},[x]);return e.jsxRuntimeExports.jsx(Ye.Provider,{value:p,children:e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"border-b border-gray-300 bg-gray-200 px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[r.heading==="Attributes"&&m?e.jsxRuntimeExports.jsx("span",{className:"mr-2 inline-block h-[8px] w-[8px] rounded-full bg-blue-600"}):null,e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-2",children:i(r.heading)})]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:c.Children.toArray(r.items.map(n=>t.has(n,"component")?c.createElement(n.component,{key:n.label}):t.has(n,"styleType")?n.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...n},n.label):n.styleType==="accordion"&&a(n==null?void 0:n.conditions)?e.jsxRuntimeExports.jsx(Xe,{...n},n.label):null:e.jsxRuntimeExports.jsx(K,{...n},n.label)))})]})})},Ze=()=>{const r=o.useSelectedBlock(),[i]=o.useSelectedStylingBlocks(),{t:s}=I.useTranslation(),l=L.useGlobalStylingPresets(),a=o.useAddClassesToBlocks(),p=L.getBlockComponent(r._type),x=t.get(t.first(i),"prop"),m=t.get(p.props,`${x}.presets`,{});if(t.isEmpty(l)&&(!t.has(p,"props")||t.isEmpty(m)))return null;const n=d=>{const y=d.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");a([r._id],y,!0)};return e.jsxRuntimeExports.jsx("div",{className:"h-10",children:e.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("div",{className:"px-4",children:e.jsxRuntimeExports.jsxs(o.Button,{variant:"default",className:"w-full",size:"sm",children:[s("Apply Presets"),e.jsxRuntimeExports.jsx(g.CaretDownIcon,{})]})})}),e.jsxRuntimeExports.jsx(o.DropdownMenuContent,{className:"max-h-80 w-56",children:e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar h-full",children:[t.isEmpty(m)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DropdownMenuLabel,{children:[p.type," ",s("presets")]}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(m).map(d=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>n(m[d]),children:[t.capitalize(t.startCase(s(d))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]}),t.isEmpty(l)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:s("Global presets")}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(l).map(d=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>n(l[d]),children:[t.capitalize(t.startCase(s(d))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:s("apply")})]}))})]})]})})]})})};function Ue(){const{flexChild:r,gridChild:i}=o.useSelectedBlocksDisplayChild(),[s]=o.useSelectedStylingBlocks();return t.isEmpty(s)?null:e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(Ze,{}),e.jsxRuntimeExports.jsxs(o.Accordion,{defaultValue:["Styles"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(Y,{section:Se}),i?e.jsxRuntimeExports.jsx(Y,{section:Te}):null,_e.map(l=>e.jsxRuntimeExports.jsx(Y,{section:l},l.heading))]})]})}const Ke={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Ge=()=>{const r=o.useSelectedBlock(),{t:i}=I.useTranslation(),[s,l]=c.useState(""),[a,p]=c.useState({onDrag:n=>n,onDragEnd:n=>n,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),x=W.useThrottledCallback(n=>{const d=!t.get(a,"negative",!1),y=t.get(a,"cssProperty","");let u=parseFloat(a.dragStartValue);u=t.isNaN(u)?0:u;let f=Ke[a.dragUnit];(t.startsWith(y,"scale")||y==="opacity")&&(f=10);let h=(a.dragStartY-n.pageY)/f+u;d&&h<0&&(h=0),y==="opacity"&&h>1&&(h=1),a.onDrag(`${h}`),l(`${h}`)},[a],50),m=c.useCallback(()=>{setTimeout(()=>a.onDragEnd(`${s}`),100),p({onDrag:n=>n,onDragEnd:n=>n,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[a,s,p]);return t.isNull(r)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(g.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:i("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(M.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(le.Provider,{value:{setDragData:p},children:[a.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:x,onMouseUp:()=>m(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar max-h-full flex-1 overflow-x-hidden overflow-y-hidden bg-gray-100 pb-5",children:[e.jsxRuntimeExports.jsx(we,{}),e.jsxRuntimeExports.jsx(Ue,{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("br",{})]})]})})};exports.default=Ge;
|