@chaibuilder/sdk 1.2.19 → 1.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddBlocks-157fSrJX.cjs +1 -0
- package/dist/{AddBlocks-gcTaEIKO.js → AddBlocks-WgpssWmQ.js} +25 -27
- package/dist/{BrandingOptions-bfiFY0VR.js → BrandingOptions-4961TxX2.js} +13 -15
- package/dist/BrandingOptions-nwXR9TMl.cjs +1 -0
- package/dist/CanvasArea-_BFTu_8b.js +908 -0
- package/dist/CanvasArea-eOKWgAXR.cjs +55 -0
- package/dist/{CurrentPage-0Ap2N0uc.js → CurrentPage-VAuh7F6E.js} +13 -16
- package/dist/CurrentPage-iB6nD9Rr.cjs +1 -0
- package/dist/ListTree-dvxHTXs4.js +167 -0
- package/dist/ListTree-gTmusfso.cjs +1 -0
- package/dist/Outline-g8XFGm2t.cjs +1 -0
- package/dist/Outline-jTFv40r5.js +294 -0
- package/dist/PagesPanel-Wx9JG5qR.cjs +1 -0
- package/dist/{PagesPanel-Pk-C1956.js → PagesPanel-oky0X1Ww.js} +5 -8
- package/dist/ProjectPanel-64Xg3Y_p.cjs +1 -0
- package/dist/{ProjectPanel-_KQBhuPO.js → ProjectPanel-WjVBiB-e.js} +15 -18
- package/dist/Settings-Tlqq4mqN.cjs +1 -0
- package/dist/{Settings-XtAatoiu.js → Settings-mNRbprbx.js} +761 -709
- package/dist/SidePanels-ZF4Q2R29.cjs +1 -0
- package/dist/{SidePanels-O52zKXbH.js → SidePanels-pQImwDI6.js} +7 -10
- package/dist/Topbar-NMvzqQHW.cjs +1 -0
- package/dist/{Topbar-oTx7a12r.js → Topbar-Ny9T-7Zb.js} +3 -5
- package/dist/TypeIcon-ElNNPazl.cjs +1 -0
- package/dist/TypeIcon-qO96rNbV.js +69 -0
- package/dist/UnsplashImages-6tZv1q2_.cjs +1 -0
- package/dist/{UnsplashImages-5A21uzMK.js → UnsplashImages-Y8RGFVSh.js} +13 -15
- package/dist/UploadImages-VLlVg9Ur.cjs +1 -0
- package/dist/{UploadImages-V_54lCAO.js → UploadImages-dd8LfyFr.js} +8 -10
- package/dist/{add-page-modal-dKQLw7RQ.js → add-page-modal-1mGGtAB_.js} +16 -19
- package/dist/add-page-modal-xCUKJiZv.cjs +1 -0
- package/dist/confirm-alert-f26zJ7Js.cjs +1 -0
- package/dist/{confirm-alert-8GP3bKH_.js → confirm-alert-sc8RaWvD.js} +3 -5
- package/dist/{controls-Dy1qa8Dc.cjs → controls-KK2oLIa8.cjs} +1 -1
- package/dist/{controls-XPXGHKht.js → controls-OfJWSEqC.js} +29 -28
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +45 -48
- package/dist/delete-page-modal-Qa0YqBRl.cjs +1 -0
- package/dist/{delete-page-modal-Zb5ld6O-.js → delete-page-modal-yAJNstCa.js} +8 -11
- package/dist/email-blocks.cjs +1 -1
- package/dist/email-blocks.js +5 -5
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +1 -0
- package/dist/email.js +4 -7
- package/dist/{form-yyU2x7So.js → form-Nj6Kdn3g.js} +1 -1
- package/dist/{form-o6_55v8F.cjs → form-n1Q6u16z.cjs} +1 -1
- package/dist/index-9PHdn80L.cjs +1 -0
- package/dist/{index-JdnF6lYP.cjs → index-9YNkdni8.cjs} +51 -51
- package/dist/{index-WP7IRkij.js → index-IPJAbzzO.js} +1178 -1133
- package/dist/{index-BMZLAJUV.cjs → index-PlZjGTTr.cjs} +1 -1
- package/dist/{index-lFcrvDFC.js → index-iQEapw2W.js} +3 -3
- package/dist/{index-yILWlilS.js → index-kAjyc_KA.js} +8306 -8170
- package/dist/{page-viewer-3QXwPGpg.js → page-viewer-SU_BqZDK.js} +9 -12
- package/dist/page-viewer-ZA-sJD82.cjs +1 -0
- package/dist/project-general-setting-GuQyvAHS.cjs +1 -0
- package/dist/{project-general-setting-UalRmyHm.js → project-general-setting-eEmhoFvb.js} +7 -10
- package/dist/project-seo-setting-3-vBkx2v.cjs +1 -0
- package/dist/{project-seo-setting-8FsvPSPl.js → project-seo-setting-NNvAGt4T.js} +5 -7
- package/dist/single-page-detail-Z677SWqt.cjs +1 -0
- package/dist/{single-page-detail-GaB85dNv.js → single-page-detail-nxWIy6e7.js} +36 -39
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +1 -0
- package/dist/studio.js +4 -7
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +138 -140
- package/dist/{useAddBlockByDrop-BIK2fdgj.js → useAddBlockByDrop-V8xo-PNQ.js} +1 -1
- package/dist/{useAddBlockByDrop-6EbioQV4.cjs → useAddBlockByDrop-qRHgy8_0.cjs} +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +26 -38
- package/dist/AddBlocks-KeHVFaIr.cjs +0 -1
- package/dist/BrandingOptions-I2I8w6E9.cjs +0 -1
- package/dist/CanvasArea-JfHkTnQD.cjs +0 -60
- package/dist/CanvasArea-xvMCbQDL.js +0 -1404
- package/dist/CurrentPage-vj52UxMA.cjs +0 -1
- package/dist/ListTree-Vq0_s1wC.cjs +0 -1
- package/dist/ListTree-k-QMO740.js +0 -96
- package/dist/Outline-HI6-c9nf.js +0 -359
- package/dist/Outline-fAflJ_lN.cjs +0 -1
- package/dist/PagesPanel-ug8Tmva6.cjs +0 -1
- package/dist/ProjectPanel-o8-6cPX-.cjs +0 -1
- package/dist/Settings-Cc9eV4VG.cjs +0 -1
- package/dist/SidePanels-ugRobm34.cjs +0 -1
- package/dist/Topbar-e5MGWX9n.cjs +0 -1
- package/dist/UnsplashImages-KSbKGs91.cjs +0 -1
- package/dist/UploadImages-V42YSRVO.cjs +0 -1
- package/dist/add-page-modal-xMedOdsp.cjs +0 -1
- package/dist/confirm-alert-KtW-4OjG.cjs +0 -1
- package/dist/delete-page-modal-lebJCBBe.cjs +0 -1
- package/dist/index-thKfFhmr.cjs +0 -1
- package/dist/page-viewer-DTIblLiz.cjs +0 -1
- package/dist/project-general-setting-g7WhM3hc.cjs +0 -1
- package/dist/project-seo-setting-xoeLQVj3.cjs +0 -1
- package/dist/single-page-detail-XdBysrE_.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),g=require("react"),Z=require("@react-hookz/web"),t=require("lodash-es"),A=require("react-i18next"),d=require("@radix-ui/react-icons"),o=require("./index-9PHdn80L.cjs"),pe=require("./controls-KK2oLIa8.cjs"),W=require("lucide-react"),$=require("@chaibuilder/runtime"),F=require("./index-9YNkdni8.cjs"),z=require("./index-gi1LIOCw.cjs"),ue=require("@rjsf/core"),de=require("@rjsf/validator-ajv8"),ce=require("react-autosuggest"),xe=require("fuse.js"),D=require("./Class-MmCxz2Ay.cjs"),me=require("./MODIFIERS-9EwxLM8V.cjs"),N=require("lodash");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("jotai");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("i18next");require("@floating-ui/react-dom");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");function ge(s){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(i,r,n.get?n:{enumerable:!0,get:()=>s[r]})}}return i.default=s,Object.freeze(i)}const O=ge(g);function he(s){const i=[],r={};function n(l,u){t.forEach(u,(a,m)=>{const p=l?`${l}.${m}`:m,c=t.isArray(a)?"list":typeof a;i.push(p),r[p]=c==="string"?"text":c==="object"?"model":c,c==="object"&&!t.isArray(a)&&n(p,a)})}return n("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:i,pathsType:r}}const U=({data:s,fullView:i})=>{if(!s)return null;const r=typeof s;return i?typeof s=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(F.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(z.JsonView,{data:s,shouldExpandNode:z.allExpanded,style:{...z.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: "}),s]}):e.jsxRuntimeExports.jsx("div",{className:"w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50",children:t.truncate(r==="object"?JSON.stringify(s):s,{length:40})})},J=({type:s,value:i="",setValue:r,data:n,onChange:l,dataType:u,appliedBindings:a})=>{const{paths:m,pathsType:p}=he(n),c=s==="PROP"?$.getBlockComponent(n==null?void 0:n._type):{},b=s==="PROP",[x,f]=g.useState(!1),y=g.useMemo(()=>s==="PROP"?m.filter(h=>!t.includes(a,h)&&t.get(c,`props.${t.first(t.split(h,"."))}.binding`)):m.filter(h=>u===t.get(p,h,"")),[s,m,a,u,c]);return g.useEffect(()=>{i&&l(i)},[i,s]),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(s))}),e.jsxRuntimeExports.jsxs(o.Popover,{open:x,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:[b&&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(u)}),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(s))]})})}),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(s)}...`}),e.jsxRuntimeExports.jsxs(o.CommandList,{children:[e.jsxRuntimeExports.jsx(o.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(o.CommandGroup,{children:t.map(y,h=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:h,className:`cursor-pointer ${b?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:v=>{r(t.find(y,E=>E===v)||null),f(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(W.Check,{className:`h-4 w-4 text-green-500 ${i===h?"":"opacity-0"}`}),h]}),b?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(p,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(U,{data:t.get(n,h)})})]},h))})]})]})})]})]}),!b&&!t.isEmpty(i)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(U,{data:t.get(n,i,""),fullView:!0})})]})},ye=({appliedBindings:s=[],onAddBinding:i,editMode:r,item:n})=>{const[l,u]=g.useState(r?n.key:""),[a,m]=g.useState(r?n.value:""),p=o.useSelectedBlock(),[c]=F.useChaiExternalData(),b=g.useCallback((y,h)=>{if(t.isEmpty(y))return"";{const v=t.get(h==="PROP"?p:c,y,"");if(t.isArray(v))return"list";const E=typeof v;return E==="string"?"text":E==="object"?"model":E}},[p,c]),[x,f]=g.useState(r?b(n.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(J,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:l,setValue:u,onChange:y=>{const h=b(y,"PROP");u(y),x!==h&&m(""),f(h)},data:p,dataType:x,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(J,{type:"PATH",isDisabled:t.isEmpty(l),placeholder:"Enter data path",value:a,setValue:m,onChange:y=>{const h=b(y,"PATH");m(x===h?y:"")},data:c,dataType:x,appliedBindings:s})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(l)&&t.isEmpty(a),onClick:()=>i({key:l,value:a}),children:"Save"})})]})},re=({disabled:s,children:i,onAddBinding:r,appliedBindings:n,editMode:l=!0,item:u={}})=>{const[a,m]=g.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:s,asChild:!0,onClick:()=>m(!0),children:i}),a&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(ye,{item:u,editMode:l,appliedBindings:n,onAddBinding:p=>{r(p),m(!1)}})})]})},be=({item:s,onAddBinding:i,onRemove:r,selectedBlock:n,dataProvider:l,appliedBindings:u})=>{const[a,m]=g.useState("string"),p=(c,b)=>{if(t.isEmpty(c))return"";{const x=t.get(b==="PROP"?n:l,c,"");if(t.isArray(x))return"list";const f=typeof x;return f==="string"?"text":f==="object"?"model":f}};return g.useEffect(()=>m(()=>p(s.key,"PROP")),[s.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:s.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:s.value}),e.jsxRuntimeExports.jsx(U,{data:t.get(l,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(re,{editMode:!0,onAddBinding:i,appliedBindings:u,item:s,children:e.jsxRuntimeExports.jsx(W.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(W.TrashIcon,{onClick:()=>r(),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(a)&&!t.isEmpty(s.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(a)})]})},fe=({bindingData:s,onChange:i})=>{const r=o.useSelectedBlock(),[n]=F.useChaiExternalData(),l=$.getChaiDataProviders(),[u,a]=g.useState(t.map(s,(x,f)=>({key:f,value:x})));g.useEffect(()=>{a(t.map(s,(x,f)=>({key:f,value:x})))},[r==null?void 0:r._id,s]);const m=g.useMemo(()=>{if(t.isEmpty(n))return!0;if(t.isEmpty(u))return!1;const x=t.last(u);return t.isEmpty(x==null?void 0:x.key)||t.isEmpty(x==null?void 0:x.value)},[n,u]),p=x=>{const f=t.filter(u,y=>y.key!==x.key);a([...f,x]),b([...f,x])},c=x=>{const f=t.filter(u,(y,h)=>x!==h);b([...f])},b=g.useCallback((x=[])=>{if(a(x),t.isEmpty(x)){i({});return}const f={};t.forEach(x,y=>{!t.isEmpty(y==null?void 0:y.key)&&!t.isEmpty(y==null?void 0:y.value)&&t.set(f,y.key,y.value)}),i(f)},[i]);return t.isEmpty(l)?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(u,(x,f)=>e.jsxRuntimeExports.jsx(be,{item:x,onAddBinding:p,onRemove:()=>c(f),selectedBlock:r,dataProvider:n,appliedBindings:t.map(u,"key")},x.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{disabled:t.isEmpty(n),className:"w-full",children:e.jsxRuntimeExports.jsx(re,{disabled:m,appliedBindings:t.map(u,"key"),onAddBinding:p,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(n)?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(n)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},je=()=>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"}),Y=g.memo(({id:s,properties:i,formData:r,onChange:n})=>{const[l,u]=g.useState(r),a={type:"object",properties:{}},m={};return Object.keys(i).forEach(p=>{const c=i[p];if(t.includes(["slot","styles"],c.type))return;const b=p;a.properties[b]=o.getBlockJSONFromSchemas(c),m[b]=o.getBlockJSONFromUISchemas(c)}),g.useEffect(()=>{u(r)},[s]),e.jsxRuntimeExports.jsx(ue,{widgets:{binding:je,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:de,uiSchema:m,schema:a,formData:l,onChange:({formData:p},c)=>{c&&(u(p),n({formData:p},c))}})});function ve(){const s=o.useSelectedBlock(),i=o.useUpdateBlocksPropsRealtime(),r=o.useUpdateBlocksProps(),n=$.getBlockComponent(s._type),l={...s},[u,a]=g.useState(l),m=o.useBuilderProp("dataBindingSupport",!1),p=({formData:h},v,E)=>{if(v&&(u==null?void 0:u._id)===s._id){const T=v.replace("root.","");r([s._id],{[T]:t.get(h,T)},E)}},c=g.useCallback(t.debounce(({formData:h},v,E)=>{p({formData:h},v,E),a(h)},1500),[s==null?void 0:s._id]),b=({formData:h},v)=>{if(v){const E=v.replace("root.","");i([s._id],{[E]:t.get(h,E)}),c({formData:h},v,{[E]:t.get(u,E)})}},x={_name:pe.u({title:"Name",default:t.get(s,"_name",s._type)})},f=t.keys(t.get(l,"_bindings",{})),y=g.useMemo(()=>{const h=t.cloneDeep(t.get(n,"props",{}));return m&&t.each(f,v=>delete h[v]),h},[n,f,m]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(Y,{id:s==null?void 0:s._id,onChange:b,formData:l,properties:x}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),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(s,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"px-4 pt-4",children:e.jsxRuntimeExports.jsx(fe,{bindingData:t.get(s,"_bindings",{}),onChange:h=>{p({formData:{_bindings:h}},"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(f)?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(f,t.capitalize).join(", ")})," ",f.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(Y,{id:s==null?void 0:s._id,onChange:b,formData:l,properties:y})]})]})]}):e.jsxRuntimeExports.jsx(Y,{id:s==null?void 0:s._id,onChange:b,formData:l,properties:y}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const Q=new xe(D.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Re(){var T;const[s]=o.useSelectedStylingBlocks(),i=o.useSelectedBlock(),r=o.useAddClassesToBlocks(),n=o.useRemoveClassesFromBlocks(),[l]=o.useSelectedBlockIds(),[u,a]=g.useState(""),m=(T=t.first(s))==null?void 0:T.prop,p=t.reject((t.get(i,m,"").replace(me.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),c=()=>{const w=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(l,w,!0),a("")},[b,x]=g.useState([]),f=({value:w})=>{const _=w.trim().toLowerCase(),H=_.match(/.+:/g);let C=[];if(H&&H.length>0){const[I]=H,B=_.replace(I,"");C=Q.search(B).map(j=>({...j,item:{...j.item,name:I+j.item.name}}))}else C=Q.search(_);x(t.map(C,"item"))},y=()=>{x([])},h=w=>w.name,v=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),E={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:u,onKeyDown:w=>{w.key==="Enter"&&u.trim()!==""&&c()},onChange:(w,{newValue:_})=>a(_),className:"w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"};return e.jsxRuntimeExports.jsxs("div",{className:`no-scrollbar flex ${b.length>0?"min-h-[300px]":"min-h-max"} w-full flex-col gap-y-5 overflow-y-auto bg-gray-100 px-px`,children:[e.jsxRuntimeExports.jsx(o.Label,{className:"mt-2",children:"Add Tailwind classes"}),e.jsxRuntimeExports.jsxs("div",{className:"relative -mt-4 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(ce,{suggestions:b,onSuggestionsFetchRequested:f,onSuggestionsClearRequested:y,getSuggestionValue:h,renderSuggestion:v,inputProps:E,containerProps:{className:"relative h-8 w-full gap-y-1 py-1 border-gray-600"},theme:{suggestion:"bg-transparent",suggestionHighlighted:"bg-gray-700 ",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:c,disabled:u.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(p)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-10 w-full items-center justify-center text-center text-sm text-gray-400",children:"No class added"}),O.Children.toArray(p.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[w,e.jsxRuntimeExports.jsx(d.Cross2Icon,{onClick:()=>n(l,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const S=["px","%","em","rem","ch","vh","vw"],Ee={heading:"flex.heading",items:[{type:"arbitrary",label:"flex.basis",units:S,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"}]},we={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"}]},Ce=[{heading:"layout.heading",items:[{type:"arbitrary",label:"layout.width",units:S.concat("auto"),property:"width"},{type:"arbitrary",label:"layout.height",units:S.concat("auto"),property:"height"},{styleType:"multiple",label:"layout.margin",negative:!0,units:[...S,"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:S.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"size.min_height",units:S.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"size.max_width_height",items:[{type:"arbitrary",label:"size.max_width",units:S.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"size.max_height",units:S.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:S},{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:S},{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:S},{type:"arbitrary",property:"lineHeight",label:"typography.height",units:S.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:Re}]}],oe={"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:d.EyeOpenIcon,invisible:d.EyeClosedIcon,hidden:d.EyeClosedIcon,gap:d.BorderAllIcon,gapX:d.WidthIcon,gapY:d.HeightIcon,spaceX:d.WidthIcon,spaceY:d.HeightIcon,overscroll:d.BorderAllIcon,overscrollX:d.WidthIcon,overscrollY:d.HeightIcon,overflow:d.BorderAllIcon,overflowX:d.WidthIcon,overflowY:d.HeightIcon,top:d.ArrowUpIcon,right:d.ArrowRightIcon,bottom:d.ArrowDownIcon,left:d.ArrowLeftIcon,inset:d.BorderAllIcon,insetX:d.WidthIcon,insetY:d.HeightIcon,border:d.BorderAllIcon,borderX:d.WidthIcon,borderY:d.HeightIcon,borderTop:d.ArrowUpIcon,borderRight:d.ArrowRightIcon,borderBottom:d.ArrowDownIcon,borderLeft:d.ArrowLeftIcon,borderRadius:d.BorderAllIcon,borderRadiusX:d.WidthIcon,borderRadiusY:d.HeightIcon,borderRadiusTop:d.ArrowUpIcon,borderRadiusRight:d.ArrowRightIcon,borderRadiusBottom:d.ArrowDownIcon,borderRadiusLeft:d.ArrowLeftIcon,borderRadiusTopLeft:d.ArrowTopLeftIcon,borderRadiusTopRight:d.ArrowTopRightIcon,borderRadiusBottomRight:d.ArrowBottomRightIcon,borderRadiusBottomLeft:d.ArrowBottomLeftIcon,divideXWidth:d.WidthIcon,divideYWidth:d.HeightIcon,scale:d.BorderAllIcon,scaleX:d.WidthIcon,scaleY:d.HeightIcon,skewX:d.WidthIcon,skewY:d.HeightIcon,translateX:d.WidthIcon,translateY:d.HeightIcon,padding:d.BorderAllIcon,paddingX:d.WidthIcon,paddingY:d.HeightIcon,paddingTop:d.ArrowUpIcon,paddingRight:d.ArrowRightIcon,paddingBottom:d.ArrowDownIcon,paddingLeft:d.ArrowLeftIcon,margin:d.BorderAllIcon,marginX:d.WidthIcon,marginY:d.HeightIcon,marginTop:d.ArrowUpIcon,marginRight:d.ArrowRightIcon,marginBottom:d.ArrowDownIcon,marginLeft:d.ArrowLeftIcon,textLeft:d.AlignLeftIcon,textCenter:d.AlignCenterHorizontallyIcon,textRight:d.AlignRightIcon,textJustify:d.StretchHorizontallyIcon,italic:d.FontItalicIcon,underline:d.UnderlineIcon,overline:d.OverlineIcon,uppercase:d.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":d.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:d.Cross1Icon},L=g.createContext({canReset:!1,canChange:!0}),ke=({children:s,canReset:i=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(L.Provider,{value:{canReset:i,canChange:r},children:s}),ne=({label:s,property:i,onChange:r})=>{const n=g.useMemo(()=>t.get(D.CLASSES_LIST,`${i}.classes`,[""]),[i]),l=q(i),u=g.useMemo(()=>t.get(l,"cls",""),[l]),{canChange:a}=g.useContext(L),m=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:s?"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: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 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(d.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(G,{rounded:s,onChange:p=>r(p,i),selected:u,options:n,disabled:!a})})};function G({selected:s,onChange:i,rounded:r=!1,options:n,disabled:l=!1}){const u=s.replace(/.*:/g,"").trim(),{undo:a,redo:m}=o.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!n.length||l,className:`${r?"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:p=>i(p.target.value),onKeyDown:p=>{p.ctrlKey&&(p.key==="z"&&a(),p.key==="y"&&m())},value:u,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),g.Children.toArray(n.map(p=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:p,children:p})))]})}const Ne=({property:s,onChange:i})=>{const{canReset:r,canChange:n}=g.useContext(L),l=q(s),u=g.useMemo(()=>t.get(l,"cls",""),[l]),a=g.useMemo(()=>t.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),m=a.indexOf(u)>-1?a.indexOf(u):0,p=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:p?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:u}):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:!n&&(!r||m-1<0),onClick:()=>i(t.nth(a,m-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.MinusIcon,{className:!n&&(!r||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(ne,{label:!1,property:s,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:!n&&(!r||m+1>=a.length),onClick:()=>i(t.nth(a,m+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(d.PlusIcon,{className:!n&&(!r||m+1>=a.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Se=({property:s,onChange:i})=>{const r=g.useMemo(()=>t.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:n}=g.useContext(L),l=q(s),u=g.useMemo(()=>t.get(l,"cls",""),[l]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,a=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!n,onClick:()=>i(a,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${u===a?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:g.createElement(t.get(oe,a,d.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(a))})]}))})},Te={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Ie=({property:s,onChange:i})=>{const r=q(s),n=g.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:l}=g.useContext(L),[u,a]=g.useState([]),[m,p]=g.useState({color:"",shade:""}),c=n.split("-"),b=t.get(c,"1",""),x=t.get(c,"2",""),f=g.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(a([]),p({color:h})):(a(["50","100","200","300","400","500","600","700","800","900"]),p(v=>({...v,color:h,shade:v.shade?v.shade:"500"})))},[a,p]);g.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(b))return a([]);a(["50","100","200","300","400","500","600","700","800","900"])},[b]);const y=g.useCallback(h=>{p({color:b,shade:h})},[b]);return g.useEffect(()=>{p({color:"",shade:""})},[r]),g.useEffect(()=>{const v=`${t.get(Te,s,"")}-${m.color}${m.shade?`-${m.shade}`:""}`;v.match(new RegExp(t.get(D.CLASSES_LIST,`${s}.regExp`,"")))&&i(v,s)},[m,i,s]),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(G,{disabled:!l,rounded:!0,selected:b,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(G,{rounded:!0,selected:x,disabled:!b||!l,onChange:y,options:u})})]})},ee=(s,i)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&i.includes(r))return{value:"",unit:r};const n=i.length?new RegExp(i.join("|"),"g"):/XXXXXX/g;r=r.replace(n,"");const l=s.match(n),u=l&&l.length>1,a=!t.isEmpty(r)&&Number.isNaN(Number(r));return u||a?{error:"Invalid value"}:l&&(l[0]==="auto"||l[0]==="none")?{value:l[0],unit:""}:{value:r,unit:l?l[0]:""}};const _e=s=>{const i=s.startsWith("-")?"-":"",r=s.split("-").pop();if(["auto","none"].includes(r))return{value:"",unit:r};if(r==="px")return{value:"1",unit:"px"};if(r==="screen")return{value:"100",unit:s.indexOf("w-")!==-1?"vw":"vh"};if(r==="full")return{value:"100",unit:"%"};if(t.includes(s,"skew-"))return{value:`${i}${r}`,unit:"deg"};if(t.includes(s,"rotate-"))return{value:`${i}${r}`,unit:"deg"};if(t.includes(s,"opacity-"))return{value:`${r/100}`,unit:"-"};if(t.includes(s,"duration-")||t.includes(s,"delay-"))return{value:`${r}`,unit:"ms"};if(t.includes(s,"translate-")&&!r.includes("/"))return{value:`${i}${`${r/4}`}`,unit:"rem"};if(t.includes(s,"scale-"))return{value:`${i}${`${r/100}`}`,unit:"-"};if(t.startsWith(s,"border")){const n=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(n)return{value:n[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(r==="xs")return{value:"320",unit:"px"};if(r==="sm")return{value:"384",unit:"px"};if(r==="md")return{value:"448",unit:"px"};if(r==="lg")return{value:"512",unit:"px"};if(r==="xl")return{value:"576",unit:"px"};if(r==="2xl")return{value:"672",unit:"px"};if(r==="3xl")return{value:"768",unit:"px"};if(r==="4xl")return{value:"896",unit:"px"};if(r==="5xl")return{value:"1024",unit:"px"};if(r==="6xl")return{value:"1152",unit:"px"};if(r==="7xl")return{value:"1280",unit:"px"};if(r==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(s,"text-")){if(r==="xs")return{value:"12",unit:"px"};if(r==="sm")return{value:"14",unit:"px"};if(r==="base")return{value:"16",unit:"px"};if(r==="lg")return{value:"18",unit:"px"};if(r==="xl")return{value:"20",unit:"px"};if(r==="2xl")return{value:"24",unit:"px"};if(r==="3xl")return{value:"30",unit:"px"};if(r==="4xl")return{value:"36",unit:"px"};if(r==="5xl")return{value:"48",unit:"px"};if(r==="6xl")return{value:"60",unit:"px"};if(r==="7xl")return{value:"72",unit:"px"};if(r==="8xl")return{value:"96",unit:"px"};if(r==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(s,"leading-")){if(r==="none")return{value:"1",unit:"-"};if(r==="tight")return{value:"1.25",unit:"-"};if(r==="snug")return{value:"1.375",unit:"-"};if(r==="normal")return{value:"1.5",unit:"-"};if(r==="relaxed")return{value:"1.625",unit:"-"};if(r==="loose")return{value:"2",unit:"-"}}if(t.startsWith(s,"tracking-")){if(r==="tighter")return{value:"-0.05",unit:"em"};if(r==="tight")return{value:"-0.025",unit:"em"};if(r==="normal")return{value:"0",unit:"em"};if(r==="wide")return{value:"0.025",unit:"em"};if(r==="wider")return{value:"0.05",unit:"em"};if(r==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(r))return{value:s,unit:"class"};if(r.includes("/")){const[n,l]=t.map(r.split("/"),u=>parseInt(u,10));return{value:i+(n/l*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${i+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}};const He=s=>{if(t.isEmpty(s))return{value:"",unit:""};const i=s.match(/\[.*\]/g);if(i===null)return Ve(s);const r=t.get(i,"0","").replace(/\[|\]/g,""),n=s.startsWith("-")?"-":"",l=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${n}${l}`,unit:r.replace(l,"")}},Ve=s=>t.isEmpty(s)?{value:"",unit:""}:_e(s),ie=g.createContext({setDragData:()=>{}}),Be=({unit:s,currentValue:i,onDrag:r,onDragEnd:n,onDragStart:l,negative:u,cssProperty:a})=>{const{setDragData:m}=g.useContext(ie);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:p=>{const c={onDrag:r,onDragEnd:n,dragging:!0,dragStartY:p.pageY,dragStartValue:`${i}`,dragUnit:s,negative:u,cssProperty:a};l(c),m(c)},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(d.RowSpacingIcon,{})})},Ae=({onSelect:s,current:i,units:r})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:r.map(n=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:i===n?"primary":void 0,size:"sm",onClick:l=>{l.stopPropagation(),s(n)},children:n},n))}),te=50,De=s=>{const[i,r]=g.useState(!1),[n,l]=g.useState(""),{currentClass:u,onChange:a,classPrefix:m,cssProperty:p,units:c,negative:b}=s,[x,f]=g.useState(p!=null&&p.toLowerCase().includes("width")?"%":c[0]),[y,h]=g.useState(!1),[v,E]=g.useState(""),[T,w]=g.useState(!1),[_,H]=g.useState(!1);g.useEffect(()=>{const{value:j,unit:R}=He(u);if(R===""){l(j),f(p!=null&&p.toLowerCase().includes("width")?"%":t.first(c));return}f(R),l(R==="class"||t.isEmpty(j)?"":j)},[u,p,c]);const C=Z.useThrottledCallback(j=>a(j),[a],te),I=Z.useThrottledCallback(j=>a(j,!1),[a],te),B=g.useCallback((j=!1)=>{const R=ee(`${n}`,c);if(t.get(R,"error",!1)){h(!0);return}const k=t.get(R,"unit")!==""?t.get(R,"unit"):x;if(k==="auto"||k==="none"){C(`${m}${k}`);return}if(t.get(R,"value")==="")return;const M=`${t.get(R,"value","").startsWith("-")?"-":""}${m}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;j?I(M):C(M)},[C,I,n,x,m,c]),P=g.useCallback(j=>{const R=ee(`${n}`,c);if(t.get(R,"error",!1)){h(!0);return}if(j==="auto"||j==="none"){C(`${m}${j}`);return}if(t.get(R,"value")==="")return;const k=t.get(R,"unit")!==""?t.get(R,"unit"):j,M=`${t.get(R,"value","").startsWith("-")?"-":""}${m}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;C(M)},[C,n,m,c]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:x==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:u}),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(d.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 ${T?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(x)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:x==="class",onKeyPress:j=>{j.key==="Enter"&&B()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),H(!0);const R=t.parseInt(j.target.value);let k=t.isNaN(R)?0:R;j.keyCode===38&&(k+=1),j.keyCode===40&&(k-=1);const V=`${k}`,ae=`${V.startsWith("-")?"-":""}${m}[${V.replace("-","")}${x==="-"?"":x}]`;I(ae)},onKeyUp:j=>{_&&(j.preventDefault(),H(!1))},onBlur:()=>B(),onChange:j=>{h(!1),l(j.target.value)},onClick:j=>{var R;(R=j==null?void 0:j.target)==null||R.select(),r(!1)},value:T?v:n,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",y?"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:()=>r(!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 ${c.length===1?"px-2 font-semibold":""}`,children:x}),c.length>1?e.jsxRuntimeExports.jsx(d.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Ae,{units:c,current:x,onSelect:j=>{r(!1),f(j),P(j)}})})})]})]}),["none","auto"].indexOf(x)!==-1||T?null:e.jsxRuntimeExports.jsx(Be,{onDragStart:()=>w(!0),onDragEnd:j=>{if(E(()=>""),w(!1),t.isEmpty(j))return;const R=`${j}`,V=`${R.startsWith("-")?"-":""}${m}[${R.replace("-","")}${x==="-"?"":x}]`;C(V)},onDrag:j=>{if(t.isEmpty(j))return;E(j);const R=`${j}`,V=`${R.startsWith("-")?"-":""}${m}[${R.replace("-","")}${x==="-"?"":x}]`;I(V)},currentValue:n,unit:x,negative:b,cssProperty:p})]})})})},q=s=>{const i=o.useSelectedBlockCurrentClasses();return t.findLast(i,{property:s})},Pe=(s,i)=>{const r={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return r[t.get(s,"mq","xs")]<=r[i]},Me={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"},$e=s=>`${s.toUpperCase()} ${se[s]?`(${se[s]} & up)`:""}`,K=s=>{const{t:i}=A.useTranslation(),{type:r="icons",label:n,property:l,onEmitChange:u=()=>{},units:a,negative:m=!1}=s,[p]=o.useDarkMode(),[c]=o.useStylingState(),[,b]=o.useCanvasWidth(),x=q(l),f=o.useAddClassesToBlocks(),y=o.useRemoveClassesFromBlocks(),[h]=o.useSelectedBlockIds(),v=g.useMemo(()=>t.get(x,"fullCls",""),[x]),E=g.useCallback((I,B=!0)=>{const P={dark:p,mq:b,mod:c,cls:I,property:l,fullCls:""};(p||c!=="")&&(P.mq="xs");const j=D.generateFullClsName(P);f(h,[j],B)},[h,p,b,c,l,f]),T=g.useCallback(()=>{y(h,[v])},[h,v,y]),w=g.useMemo(()=>Pe(x,b),[x,b]);g.useEffect(()=>{u(w,x)},[w,u,x]);const[,,_]=o.useCanvasWidth(),H=g.useCallback(I=>{_({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[I])},[_]),C=t.get(x,"dark",null)===p&&t.get(x,"mod",null)===c&&t.get(x,"mq",null)===b;return e.jsxRuntimeExports.jsx(ke,{canChange:w,canReset:x&&C,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] ${x&&!C?"text-foreground":""}`,children:i(n)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[r==="arbitrary"?e.jsxRuntimeExports.jsx(De,{currentClass:t.get(x,"cls",""),classPrefix:t.get(Me,l,""),units:a||[],onChange:E,negative:m,cssProperty:l}):null,r==="icons"&&e.jsxRuntimeExports.jsx(Se,{property:l,onChange:E}),r==="range"&&e.jsxRuntimeExports.jsx(Ne,{property:l,onChange:E}),r==="color"&&e.jsxRuntimeExports.jsx(Ie,{property:l,onChange:E}),r==="dropdown"&&e.jsxRuntimeExports.jsx(ne,{label:n,property:l,onChange:E})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${v?"visible":"invisible"}`,children:C?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>T(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(d.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):w&&x?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(d.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:[$e(t.get(x,"mq")),p&&!x.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>H(t.get(x,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(x,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Le=["px","%","em","rem","ch","vh","vw"],le=({label:s,options:i,borderB:r=!1,borderT:n=!1,type:l="arbitrary",units:u=Le,negative:a=!1})=>{const{t:m}=A.useTranslation(),[p,c]=g.useState(i[0].key),b=o.useSelectedBlockCurrentClasses(),x=g.useCallback(f=>t.map(b,"property").includes(f),[b]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${n?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:m(s)}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:g.Children.toArray(i.map(({label:f,key:y})=>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:()=>c(y),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${y===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[g.createElement("div",{className:x(y)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),g.createElement(t.get(oe,y,d.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:l,units:[...u],label:"",property:p,negative:a})})]})},qe=({heading:s,items:i})=>{const{t:r}=A.useTranslation(),n=o.useSelectedBlockCurrentClasses(),l=g.useMemo(()=>{const u=p=>t.flatten(p.map(c=>c.styleType==="multiple"?t.map(c.options,"key"):c.property)),a=t.flatten(i.map(p=>p.styleType==="accordion"?u(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),m=t.map(n,"property");return t.intersection(a,m).length>0},[n,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:[r(s),l?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${l?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:i.map(u=>u.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...u},u.label):e.jsxRuntimeExports.jsx(K,{...u},u.label))})]})},Oe=g.createContext({}),X=({section:s})=>{const{t:i}=A.useTranslation(),r=o.useSelectedBlockCurrentClasses(),n=g.useCallback((a=[])=>{const m={};for(let c=0;c<r.length;c++)m[r[c].property]=r[c].cls;let p=!0;for(const c in a)if(!t.has(m,c)||m[c]!==a[c]){p=!1;break}return p},[r]),l=g.useMemo(()=>{if(r.length>0&&s.heading==="classes.heading")return!0;const a=c=>t.flatten(c.map(b=>b.styleType==="multiple"?t.flatten(t.map(b.options,"key")):b.property)),m=t.flatten(s.items.map(c=>c.styleType==="accordion"?a(c.items):c.styleType==="multiple"?t.flatten(t.map(c.options,"key")):c.property)),p=t.map(r,"property");return t.intersection(m,p).length>0},[r,s.heading,s.items]),u=g.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Oe.Provider,{value:u,children:e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"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 ${l?"bg-blue-500":"bg-gray-300"}`}),i(s.heading)]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:g.Children.toArray(s.items.map(a=>t.has(a,"component")?g.createElement(a.component,{key:a.label}):t.has(a,"styleType")?a.styleType==="multiple"?e.jsxRuntimeExports.jsx(le,{...a},a.label):a.styleType==="accordion"&&n(a==null?void 0:a.conditions)?e.jsxRuntimeExports.jsx(qe,{...a},a.label):null:e.jsxRuntimeExports.jsx(K,{...a},a.label)))})]})})},We=({item:s,index:i,canDelete:r,onChange:n,onRemove:l})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${r?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:u=>n(u,i),value:s.key,placeholder:"Key",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[e.jsxRuntimeExports.jsx("input",{name:"value",onChange:u=>t.isEmpty(s.key)?{}:n(u,i),value:s.value,placeholder:"Value",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsx(d.TrashIcon,{onClick:l,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),Fe=({section:s})=>{var f;const{setSyncState:i}=o.useSavePage(),r=o.useSelectedBlock(),[n,l]=g.useState([]),[u]=o.useSelectedStylingBlocks(),a=o.useUpdateBlocksPropsRealtime(),m=`${t.get(u,"0.prop")}_attrs`;O.useEffect(()=>{const y=t.map(t.get(r,m),(h,v)=>({key:v,value:h}));t.isEmpty(y)?l([]):l(y)},[t.get(r,m)]);const p=()=>l([...n,{key:"",value:""}]),c=y=>{const h=t.filter(n,(v,E)=>y!==E);x(h)},b=(y,h)=>{const v=[...n];v[h][y.target.name]=y.target.value,x(v)},x=O.useCallback((y=[])=>{const h={};t.forEach(y,v=>{t.isEmpty(v.key)||t.set(h,v.key,v.value)}),a([t.get(r,"_id")],{[m]:h}),i("UNSAVED")},[r,i,a,m]);return e.jsxRuntimeExports.jsxs(o.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(o.AccordionTrigger,{className:"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,m))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsxs(o.Label,{className:"mt-2 flex w-full items-center justify-between",children:["Add Custom attributes",e.jsxRuntimeExports.jsxs("div",{className:`flex h-6 w-max items-center justify-center gap-x-0.5 rounded-full border p-1 px-2 text-xs ${!t.isEmpty(n)&&t.isEmpty((f=t.last(n))==null?void 0:f.key)?"cursor-not-allowed border-gray-400 text-gray-400":"cursor-pointer border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white"}`,onClick:()=>{var y;!t.isEmpty(n)&&t.isEmpty((y=t.last(n))==null?void 0:y.key)||p()},children:[e.jsxRuntimeExports.jsx(d.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),O.Children.toArray(t.map(n,(y,h)=>{const v=n.length>0&&h<n.length-1;return e.jsxRuntimeExports.jsx(We,{item:y,index:h,canDelete:v,onChange:b,onRemove:()=>c(h)})}))]})]})})]})},ze=()=>{const s=o.useSelectedBlock(),[i]=o.useSelectedStylingBlocks(),{t:r}=A.useTranslation(),n=$.useGlobalStylingPresets(),l=o.useAddClassesToBlocks(),u=$.getBlockComponent(s._type),a=N.get(N.first(i),"prop"),m=N.get(u.props,`${a}.presets`,{});if(N.isEmpty(n)&&(!N.has(u,"props")||N.isEmpty(m)))return null;const p=c=>{const b=c.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");l([s._id],b,!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:[r("Apply Presets"),e.jsxRuntimeExports.jsx(d.CaretDownIcon,{})]})})}),e.jsxRuntimeExports.jsx(o.DropdownMenuContent,{className:"max-h-80 w-56",children:e.jsxRuntimeExports.jsxs(o.ScrollArea,{className:"no-scrollbar h-full",children:[N.isEmpty(m)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs(o.DropdownMenuLabel,{children:[u.type," ",r("presets")]}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:N.keys(m).map(c=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>p(m[c]),children:[N.capitalize(N.startCase(r(c))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]}),N.isEmpty(n)?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:r("Global presets")}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:N.keys(n).map(c=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>p(n[c]),children:[N.capitalize(N.startCase(r(c))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]})]})})]})})};function Ye(){const[s,i]=o.useStylingState(),{flexChild:r,gridChild:n}=o.useSelectedBlocksDisplayChild(),{t:l}=A.useTranslation(),[u]=o.useSelectedStylingBlocks();return t.isEmpty(u)?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(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:l("no_styling_block_selected")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(ze,{}),e.jsxRuntimeExports.jsx("div",{className:"flex h-12 flex-col space-x-4 px-4 py-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(o.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(o.Select,{defaultValue:s,onValueChange:a=>i(a),children:[e.jsxRuntimeExports.jsx(o.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(o.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(o.SelectContent,{children:[e.jsxRuntimeExports.jsx(o.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(o.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),s!==""?e.jsxRuntimeExports.jsxs("div",{className:"m-1 flex items-center space-x-1 rounded border border-orange-500 bg-orange-200 p-px px-2 text-xs text-orange-900",children:[e.jsxRuntimeExports.jsx(W.BrushIcon,{className:"w-3"}),e.jsxRuntimeExports.jsx("span",{children:l(`Styles will be applied for (:${s}) state`)})]}):null,e.jsxRuntimeExports.jsx(o.ScrollArea,{className:"no-scrollbar -mx-1 max-h-full flex-1 overflow-x-hidden overflow-y-hidden border-t border-border",children:e.jsxRuntimeExports.jsxs(o.Accordion,{defaultValue:["Layout"],type:"multiple",className:"w-full",children:[r&&e.jsxRuntimeExports.jsx(X,{section:Ee}),n?e.jsxRuntimeExports.jsx(X,{section:we}):null,Ce.map(a=>e.jsxRuntimeExports.jsx(X,{section:a},a.heading)),e.jsxRuntimeExports.jsx(Fe,{section:{heading:"Attributes"}})]})})]})}const Xe={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Ze=()=>{const s=o.useSelectedBlock(),{t:i}=A.useTranslation(),[r,n]=g.useState(""),[l,u]=g.useState({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),a=Z.useThrottledCallback(p=>{const c=!t.get(l,"negative",!1),b=t.get(l,"cssProperty","");let x=parseFloat(l.dragStartValue);x=t.isNaN(x)?0:x;let f=Xe[l.dragUnit];(t.startsWith(b,"scale")||b==="opacity")&&(f=10);let h=(l.dragStartY-p.pageY)/f+x;c&&h<0&&(h=0),b==="opacity"&&h>1&&(h=1),l.onDrag(`${h}`),n(`${h}`)},[l],50),m=g.useCallback(()=>{setTimeout(()=>l.onDragEnd(`${r}`),100),u({onDrag:p=>p,onDragEnd:p=>p,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[l,r,u]);return t.isNull(s)?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(d.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:i("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(F.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(ie.Provider,{value:{setDragData:u},children:[l.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:a,onMouseUp:()=>m(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"}):null,e.jsxRuntimeExports.jsxs(o.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(o.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"settings",children:i("settings")}),e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"styling",children:i("styling")})]}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"settings",className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(o.ScrollArea,{className:"no-scrollbar max-h-full flex-1 overflow-x-hidden overflow-y-hidden pb-5",children:e.jsxRuntimeExports.jsx(ve,{})})}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"styling",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Ye,{})})]})]})})};exports.default=Ze;
|