@chaibuilder/sdk 1.2.22 → 1.2.23
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-b0Vk6eqO.js +206 -0
- package/dist/AddBlocks-bgu08YJC.cjs +1 -0
- package/dist/BrandingOptions-AljW1cXz.cjs +1 -0
- package/dist/{BrandingOptions-4961TxX2.js → BrandingOptions-eUSoIgjj.js} +10 -9
- package/dist/CanvasArea-dp1tzDkK.cjs +55 -0
- package/dist/CanvasArea-ulUy_rmB.js +951 -0
- package/dist/{Class-MmCxz2Ay.cjs → Class-PoYusiA5.cjs} +1 -1
- package/dist/{Class-3k8xjeiM.js → Class-lGzsNBOK.js} +1 -1
- package/dist/{CurrentPage-oPZN6Gwj.js → CurrentPage-SFhXzQMy.js} +9 -10
- package/dist/CurrentPage-rWHgPomd.cjs +1 -0
- package/dist/ListTree-5n8U4-IF.cjs +1 -0
- package/dist/ListTree-ZeVWczTF.js +309 -0
- package/dist/MODIFIERS-0g14w5RS.cjs +1 -0
- package/dist/{MODIFIERS-WQdaNvb8.js → MODIFIERS-dytZ-osO.js} +4 -8
- package/dist/{PagesPanel-pRKHw-AZ.js → PagesPanel-IkZjy0Gn.js} +9 -10
- package/dist/PagesPanel-sBN51kKZ.cjs +1 -0
- package/dist/{ProjectPanel-iU6DY-Yp.js → ProjectPanel-e98TJLfI.js} +10 -11
- package/dist/ProjectPanel-lbQH31jc.cjs +1 -0
- package/dist/STRINGS--j49GZJP.js +7 -0
- package/dist/STRINGS-gPz7CUOk.cjs +1 -0
- package/dist/{Settings-BhSrj-cE.js → Settings-FZWm8Fc3.js} +862 -865
- package/dist/Settings-qytQoyTv.cjs +1 -0
- package/dist/SidePanels-YRIM1IPq.cjs +1 -0
- package/dist/{SidePanels-OLOUpKn4.js → SidePanels-wrkkpcGE.js} +119 -123
- package/dist/{Topbar-Ny9T-7Zb.js → Topbar-LUyDFBkK.js} +6 -5
- package/dist/Topbar-NOSnWo7V.cjs +1 -0
- package/dist/{UnsplashImages-Y8RGFVSh.js → UnsplashImages-eZedbK2J.js} +16 -15
- package/dist/UnsplashImages-f-ObKOC-.cjs +1 -0
- package/dist/{UploadImages-dd8LfyFr.js → UploadImages-71QziLbr.js} +11 -10
- package/dist/UploadImages-oOnccvT9.cjs +1 -0
- package/dist/add-page-modal-g3fd00P5.cjs +1 -0
- package/dist/{add-page-modal-Jni6CY1x.js → add-page-modal-yQ6qL6Ui.js} +10 -11
- package/dist/{confirm-alert-sc8RaWvD.js → confirm-alert-3flAvzWH.js} +6 -5
- package/dist/confirm-alert-LQsGNYz8.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +48 -49
- package/dist/defaultTheme-7VqqhOcp.cjs +1 -0
- package/dist/{defaultTheme-gunU_Fe5.js → defaultTheme-D8B4-wHO.js} +1 -1
- package/dist/{delete-page-modal-0WiMZFxr.js → delete-page-modal-iMmkPec0.js} +9 -10
- package/dist/delete-page-modal-tzZmqGzE.cjs +1 -0
- package/dist/email.cjs +1 -1
- package/dist/email.d.ts +1 -0
- package/dist/email.js +16 -16
- package/dist/{form-n1Q6u16z.cjs → form-LBHtTduy.cjs} +1 -1
- package/dist/{form-Nj6Kdn3g.js → form-zKUMQFuB.js} +1 -1
- package/dist/html-to-json-efmv1pCj.cjs +1 -0
- package/dist/{html-to-json-C5sExaSD.js → html-to-json-ngX9ef2u.js} +31 -29
- package/dist/{index-nwAgi0aD.cjs → index--dUsFH1I.cjs} +1 -1
- package/dist/{index-IPJAbzzO.js → index-HD1UKc4P.js} +1091 -1063
- package/dist/{index-0bwkNnA0.cjs → index-bOWwCMRF.cjs} +42 -42
- package/dist/index-fvMaxES9.cjs +1 -0
- package/dist/{index-_VPpjzJu.js → index-m4WGov7e.js} +4 -4
- package/dist/{index-UP_4awU9.js → index-uLtBNl55.js} +4479 -4484
- package/dist/lib.cjs +3 -3
- package/dist/lib.js +17 -16
- package/dist/page-viewer-5gTszT-n.cjs +1 -0
- package/dist/{page-viewer-L1Dmgj-c.js → page-viewer-7AwzWRtB.js} +14 -15
- package/dist/project-general-setting-52CTYL_w.cjs +1 -0
- package/dist/{project-general-setting-sUP7JqWK.js → project-general-setting-pYPoqvqd.js} +10 -11
- package/dist/project-seo-setting-jTweI1DX.cjs +1 -0
- package/dist/{project-seo-setting-NNvAGt4T.js → project-seo-setting-zXKOcjep.js} +7 -6
- package/dist/render.cjs +1 -1
- package/dist/render.js +14 -13
- package/dist/single-page-detail-jy2SPcp1.cjs +1 -0
- package/dist/{single-page-detail-FXg_NebW.js → single-page-detail-q2TDxN-P.js} +11 -12
- package/dist/studio.cjs +1 -1
- package/dist/studio.d.ts +1 -0
- package/dist/studio.js +8 -9
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +138 -137
- package/dist/web-blocks.cjs +6 -1
- package/dist/web-blocks.js +462 -354
- package/package.json +3 -5
- package/dist/AddBlocks-157fSrJX.cjs +0 -1
- package/dist/AddBlocks-WgpssWmQ.js +0 -223
- package/dist/BrandingOptions-nwXR9TMl.cjs +0 -1
- package/dist/CanvasArea-MajWGr9z.js +0 -908
- package/dist/CanvasArea-MmTlc5Vb.cjs +0 -55
- package/dist/CurrentPage-LpLr0lDI.cjs +0 -1
- package/dist/ListTree-dvxHTXs4.js +0 -167
- package/dist/ListTree-gTmusfso.cjs +0 -1
- package/dist/MODIFIERS-9EwxLM8V.cjs +0 -1
- package/dist/Outline-2OxsXs1-.js +0 -294
- package/dist/Outline-7CCnnzmK.cjs +0 -1
- package/dist/PagesPanel-8536oBWB.cjs +0 -1
- package/dist/ProjectPanel-oILsUWOH.cjs +0 -1
- package/dist/Settings-jHiYmt0y.cjs +0 -1
- package/dist/SidePanels-bcJJocSq.cjs +0 -1
- package/dist/Topbar-NMvzqQHW.cjs +0 -1
- package/dist/TypeIcon-ElNNPazl.cjs +0 -1
- package/dist/TypeIcon-qO96rNbV.js +0 -69
- package/dist/UnsplashImages-6tZv1q2_.cjs +0 -1
- package/dist/UploadImages-VLlVg9Ur.cjs +0 -1
- package/dist/add-page-modal-IsqDdK7X.cjs +0 -1
- package/dist/confirm-alert-f26zJ7Js.cjs +0 -1
- package/dist/defaultTheme-7Lk2zq60.cjs +0 -1
- package/dist/delete-page-modal-c3b-GCap.cjs +0 -1
- package/dist/html-to-json-FGufPv9R.cjs +0 -1
- package/dist/index-9PHdn80L.cjs +0 -1
- package/dist/page-viewer-TnxHhq7S.cjs +0 -1
- package/dist/project-general-setting-1Ot1RU43.cjs +0 -1
- package/dist/project-seo-setting-3-vBkx2v.cjs +0 -1
- package/dist/single-page-detail-btEKYXjE.cjs +0 -1
- package/dist/useAddBlockByDrop-V8xo-PNQ.js +0 -20
- package/dist/useAddBlockByDrop-qRHgy8_0.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"),X=require("@react-hookz/web"),t=require("lodash-es"),_=require("react-i18next"),x=require("@radix-ui/react-icons"),o=require("./index-fvMaxES9.cjs"),ae=require("./controls-KK2oLIa8.cjs"),M=require("lucide-react"),$=require("@chaibuilder/runtime"),W=require("./index-bOWwCMRF.cjs"),z=require("./index-gi1LIOCw.cjs"),pe=require("@rjsf/core"),ue=require("@rjsf/validator-ajv8"),de=require("react-autosuggest"),xe=require("fuse.js"),A=require("./Class-PoYusiA5.cjs"),ce=require("./STRINGS-gPz7CUOk.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("./Functions-N3yhPYKY.cjs");require("clsx");require("tailwind-merge");require("jotai");require("./MODIFIERS-0g14w5RS.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("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");function me(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(n,r,a.get?a:{enumerable:!0,get:()=>s[r]})}}return n.default=s,Object.freeze(n)}const O=me(g);function ge(s){const n=[],r={};function a(i,u){t.forEach(u,(l,m)=>{const d=i?`${i}.${m}`:m,c=t.isArray(l)?"list":typeof l;n.push(d),r[d]=c==="string"?"text":c==="object"?"model":c,c==="object"&&!t.isArray(l)&&a(d,l)})}return a("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:n,pathsType:r}}const Z=({data:s,fullView:n})=>{if(!s)return null;const r=typeof s;return n?typeof s=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(W.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})})},K=({type:s,value:n="",setValue:r,data:a,onChange:i,dataType:u,appliedBindings:l})=>{const{paths:m,pathsType:d}=ge(a),c=s==="PROP"?$.getBlockComponent(a==null?void 0:a._type):{},j=s==="PROP",[p,y]=g.useState(!1),b=g.useMemo(()=>s==="PROP"?m.filter(h=>!t.includes(l,h)&&t.get(c,`props.${t.first(t.split(h,"."))}.binding`)):m.filter(h=>u===t.get(d,h,"")),[s,m,l,u,c]);return g.useEffect(()=>{n&&i(n)},[n,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:p,onOpenChange:y,children:[e.jsxRuntimeExports.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(o.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(n)?"w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white":"min-w-[350px] items-center justify-between"}`,children:n?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"pr-8 text-sm",children:[j&&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)}),n]}),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(b,h=>e.jsxRuntimeExports.jsxs(o.CommandItem,{value:h,className:`cursor-pointer ${j?"flex items-center justify-between":"flex flex-col items-start justify-start"}`,onSelect:v=>{r(t.find(b,E=>E===v)||null),y(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(M.Check,{className:`h-4 w-4 text-green-500 ${n===h?"":"opacity-0"}`}),h]}),j?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(d,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(Z,{data:t.get(a,h)})})]},h))})]})]})})]})]}),!j&&!t.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(Z,{data:t.get(a,n,""),fullView:!0})})]})},he=({appliedBindings:s=[],onAddBinding:n,editMode:r,item:a})=>{const[i,u]=g.useState(r?a.key:""),[l,m]=g.useState(r?a.value:""),d=o.useSelectedBlock(),[c]=W.useChaiExternalData(),j=g.useCallback((b,h)=>{if(t.isEmpty(b))return"";{const v=t.get(h==="PROP"?d:c,b,"");if(t.isArray(v))return"list";const E=typeof v;return E==="string"?"text":E==="object"?"model":E}},[d,c]),[p,y]=g.useState(r?j(a.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(K,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:i,setValue:u,onChange:b=>{const h=j(b,"PROP");u(b),p!==h&&m(""),y(h)},data:d,dataType:p,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(K,{type:"PATH",isDisabled:t.isEmpty(i),placeholder:"Enter data path",value:l,setValue:m,onChange:b=>{const h=j(b,"PATH");m(p===h?b:"")},data:c,dataType:p,appliedBindings:s})]}),e.jsxRuntimeExports.jsx(o.DialogFooter,{children:e.jsxRuntimeExports.jsx(o.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(i)&&t.isEmpty(l),onClick:()=>n({key:i,value:l}),children:"Save"})})]})},se=({disabled:s,children:n,onAddBinding:r,appliedBindings:a,editMode:i=!0,item:u={}})=>{const[l,m]=g.useState(!1);return e.jsxRuntimeExports.jsxs(o.Dialog,{children:[e.jsxRuntimeExports.jsx(o.DialogTrigger,{disabled:s,asChild:!0,onClick:()=>m(!0),children:n}),l&&e.jsxRuntimeExports.jsx(o.DialogContent,{children:e.jsxRuntimeExports.jsx(he,{item:u,editMode:i,appliedBindings:a,onAddBinding:d=>{r(d),m(!1)}})})]})},ye=({item:s,onAddBinding:n,onRemove:r,selectedBlock:a,dataProvider:i,appliedBindings:u})=>{const[l,m]=g.useState("string"),d=(c,j)=>{if(t.isEmpty(c))return"";{const p=t.get(j==="PROP"?a:i,c,"");if(t.isArray(p))return"list";const y=typeof p;return y==="string"?"text":y==="object"?"model":y}};return g.useEffect(()=>m(()=>d(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(Z,{data:t.get(i,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(se,{editMode:!0,onAddBinding:n,appliedBindings:u,item:s,children:e.jsxRuntimeExports.jsx(M.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(M.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(l)&&!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(l)})]})},je=({bindingData:s,onChange:n})=>{const r=o.useSelectedBlock(),[a]=W.useChaiExternalData(),i=$.getChaiDataProviders(),[u,l]=g.useState(t.map(s,(p,y)=>({key:y,value:p})));g.useEffect(()=>{l(t.map(s,(p,y)=>({key:y,value:p})))},[r==null?void 0:r._id,s]);const m=g.useMemo(()=>{if(t.isEmpty(a))return!0;if(t.isEmpty(u))return!1;const p=t.last(u);return t.isEmpty(p==null?void 0:p.key)||t.isEmpty(p==null?void 0:p.value)},[a,u]),d=p=>{const y=t.filter(u,b=>b.key!==p.key);l([...y,p]),j([...y,p])},c=p=>{const y=t.filter(u,(b,h)=>p!==h);j([...y])},j=g.useCallback((p=[])=>{if(l(p),t.isEmpty(p)){n({});return}const y={};t.forEach(p,b=>{!t.isEmpty(b==null?void 0:b.key)&&!t.isEmpty(b==null?void 0:b.value)&&t.set(y,b.key,b.value)}),n(y)},[n]);return t.isEmpty(i)?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,(p,y)=>e.jsxRuntimeExports.jsx(ye,{item:p,onAddBinding:d,onRemove:()=>c(y),selectedBlock:r,dataProvider:a,appliedBindings:t.map(u,"key")},p.key)),e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{disabled:t.isEmpty(a),className:"w-full",children:e.jsxRuntimeExports.jsx(se,{disabled:m,appliedBindings:t.map(u,"key"),onAddBinding:d,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(a)?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(a)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},be=()=>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"}),F=g.memo(({id:s,properties:n,formData:r,onChange:a})=>{const[i,u]=g.useState(r),l={type:"object",properties:{}},m={};return Object.keys(n).forEach(d=>{const c=n[d];if(t.includes(["slot","styles"],c.type))return;const j=d;l.properties[j]=o.getBlockJSONFromSchemas(c),m[j]=o.getBlockJSONFromUISchemas(c)}),g.useEffect(()=>{u(r)},[s]),e.jsxRuntimeExports.jsx(pe,{widgets:{binding:be,richtext:o.RichTextEditorField,icon:o.IconPickerField,image:o.ImagePickerField},fields:{link:o.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!1,validator:ue,uiSchema:m,schema:l,formData:i,onChange:({formData:d},c)=>{c&&(u(d),a({formData:d},c))}})});function fe(){const s=o.useSelectedBlock(),n=o.useUpdateBlocksPropsRealtime(),r=o.useUpdateBlocksProps(),a=$.getBlockComponent(s._type),i={...s},[u,l]=g.useState(i),m=o.useBuilderProp("dataBindingSupport",!1),d=({formData:h},v,E)=>{if(v&&(u==null?void 0:u._id)===s._id){const S=v.replace("root.","");r([s._id],{[S]:t.get(h,S)},E)}},c=g.useCallback(t.debounce(({formData:h},v,E)=>{d({formData:h},v,E),l(h)},1500),[s==null?void 0:s._id]),j=({formData:h},v)=>{if(v){const E=v.replace("root.","");n([s._id],{[E]:t.get(h,E)}),c({formData:h},v,{[E]:t.get(u,E)})}},p={_name:ae.u({title:"Name",default:t.get(s,"_name",s._type)})},y=t.keys(t.get(i,"_bindings",{})),b=g.useMemo(()=>{const h=t.cloneDeep(t.get(a,"props",{}));return m&&t.each(y,v=>delete h[v]),h},[a,y,m]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(F,{id:s==null?void 0:s._id,onChange:j,formData:i,properties:p}),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(je,{bindingData:t.get(s,"_bindings",{}),onChange:h=>{d({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(y)?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(y,t.capitalize).join(", ")})," ",y.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(F,{id:s==null?void 0:s._id,onChange:j,formData:i,properties:b})]})]})]}):e.jsxRuntimeExports.jsx(F,{id:s==null?void 0:s._id,onChange:j,formData:i,properties:b}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const J=new xe(A.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function ve(){var S;const[s]=o.useSelectedStylingBlocks(),n=o.useSelectedBlock(),r=o.useAddClassesToBlocks(),a=o.useRemoveClassesFromBlocks(),[i]=o.useSelectedBlockIds(),[u,l]=g.useState(""),m=(S=t.first(s))==null?void 0:S.prop,d=t.reject((t.get(n,m,"").replace(ce.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),c=()=>{const w=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(i,w,!0),l("")},[j,p]=g.useState([]),y=({value:w})=>{const I=w.trim().toLowerCase(),H=I.match(/.+:/g);let C=[];if(H&&H.length>0){const[T]=H,V=I.replace(T,"");C=J.search(V).map(f=>({...f,item:{...f.item,name:T+f.item.name}}))}else C=J.search(I);p(t.map(C,"item"))},b=()=>{p([])},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:I})=>l(I),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 ${j.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(de,{suggestions:j,onSuggestionsFetchRequested:y,onSuggestionsClearRequested:b,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(x.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(d)&&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(d.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(x.Cross2Icon,{onClick:()=>a(i,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const N=["px","%","em","rem","ch","vh","vw"],Re={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"}]},Ee={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"}]},we=[{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:ve}]}],re={"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:x.EyeOpenIcon,invisible:x.EyeClosedIcon,hidden:x.EyeClosedIcon,gap:x.BorderAllIcon,gapX:x.WidthIcon,gapY:x.HeightIcon,spaceX:x.WidthIcon,spaceY:x.HeightIcon,overscroll:x.BorderAllIcon,overscrollX:x.WidthIcon,overscrollY:x.HeightIcon,overflow:x.BorderAllIcon,overflowX:x.WidthIcon,overflowY:x.HeightIcon,top:x.ArrowUpIcon,right:x.ArrowRightIcon,bottom:x.ArrowDownIcon,left:x.ArrowLeftIcon,inset:x.BorderAllIcon,insetX:x.WidthIcon,insetY:x.HeightIcon,border:x.BorderAllIcon,borderX:x.WidthIcon,borderY:x.HeightIcon,borderTop:x.ArrowUpIcon,borderRight:x.ArrowRightIcon,borderBottom:x.ArrowDownIcon,borderLeft:x.ArrowLeftIcon,borderRadius:x.BorderAllIcon,borderRadiusX:x.WidthIcon,borderRadiusY:x.HeightIcon,borderRadiusTop:x.ArrowUpIcon,borderRadiusRight:x.ArrowRightIcon,borderRadiusBottom:x.ArrowDownIcon,borderRadiusLeft:x.ArrowLeftIcon,borderRadiusTopLeft:x.ArrowTopLeftIcon,borderRadiusTopRight:x.ArrowTopRightIcon,borderRadiusBottomRight:x.ArrowBottomRightIcon,borderRadiusBottomLeft:x.ArrowBottomLeftIcon,divideXWidth:x.WidthIcon,divideYWidth:x.HeightIcon,scale:x.BorderAllIcon,scaleX:x.WidthIcon,scaleY:x.HeightIcon,skewX:x.WidthIcon,skewY:x.HeightIcon,translateX:x.WidthIcon,translateY:x.HeightIcon,padding:x.BorderAllIcon,paddingX:x.WidthIcon,paddingY:x.HeightIcon,paddingTop:x.ArrowUpIcon,paddingRight:x.ArrowRightIcon,paddingBottom:x.ArrowDownIcon,paddingLeft:x.ArrowLeftIcon,margin:x.BorderAllIcon,marginX:x.WidthIcon,marginY:x.HeightIcon,marginTop:x.ArrowUpIcon,marginRight:x.ArrowRightIcon,marginBottom:x.ArrowDownIcon,marginLeft:x.ArrowLeftIcon,textLeft:x.AlignLeftIcon,textCenter:x.AlignCenterHorizontallyIcon,textRight:x.AlignRightIcon,textJustify:x.StretchHorizontallyIcon,italic:x.FontItalicIcon,underline:x.UnderlineIcon,overline:x.OverlineIcon,uppercase:x.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":x.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:x.Cross1Icon},L=g.createContext({canReset:!1,canChange:!0}),Ce=({children:s,canReset:n=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(L.Provider,{value:{canReset:n,canChange:r},children:s}),oe=({label:s,property:n,onChange:r})=>{const a=g.useMemo(()=>t.get(A.CLASSES_LIST,`${n}.classes`,[""]),[n]),i=q(n),u=g.useMemo(()=>t.get(i,"cls",""),[i]),{canChange:l}=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(x.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(U,{rounded:s,onChange:d=>r(d,n),selected:u,options:a,disabled:!l})})};function U({selected:s,onChange:n,rounded:r=!1,options:a,disabled:i=!1}){const u=s.replace(/.*:/g,"").trim(),{undo:l,redo:m}=o.useUndoManager();return e.jsxRuntimeExports.jsxs("select",{disabled:!a.length||i,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:d=>n(d.target.value),onKeyDown:d=>{d.ctrlKey&&(d.key==="z"&&l(),d.key==="y"&&m())},value:u,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),g.Children.toArray(a.map(d=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:d,children:d})))]})}const ke=({property:s,onChange:n})=>{const{canReset:r,canChange:a}=g.useContext(L),i=q(s),u=g.useMemo(()=>t.get(i,"cls",""),[i]),l=g.useMemo(()=>t.get(A.CLASSES_LIST,`${s}.classes`,[""]),[s]),m=l.indexOf(u)>-1?l.indexOf(u):0,d=/\[.*\]/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:d?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:!a&&(!r||m-1<0),onClick:()=>n(t.nth(l,m-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(x.MinusIcon,{className:!a&&(!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(oe,{label:!1,property:s,onChange:n})}),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:!a&&(!r||m+1>=l.length),onClick:()=>n(t.nth(l,m+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(x.PlusIcon,{className:!a&&(!r||m+1>=l.length)?"text-gray-500":"text-black/60 dark:text-white/60"})})})]})})},Ne=({property:s,onChange:n})=>{const r=g.useMemo(()=>t.get(A.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:a}=g.useContext(L),i=q(s),u=g.useMemo(()=>t.get(i,"cls",""),[i]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,l=>e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!a,onClick:()=>n(l,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${u===l?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:g.createElement(t.get(re,l,x.BoxIcon))})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(l))})]}))})},Se={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Te=({property:s,onChange:n})=>{const r=q(s),a=g.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:i}=g.useContext(L),[u,l]=g.useState([]),[m,d]=g.useState({color:"",shade:""}),c=a.split("-"),j=t.get(c,"1",""),p=t.get(c,"2",""),y=g.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(l([]),d({color:h})):(l(["50","100","200","300","400","500","600","700","800","900"]),d(v=>({...v,color:h,shade:v.shade?v.shade:"500"})))},[l,d]);g.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(j))return l([]);l(["50","100","200","300","400","500","600","700","800","900"])},[j]);const b=g.useCallback(h=>{d({color:j,shade:h})},[j]);return g.useEffect(()=>{d({color:"",shade:""})},[r]),g.useEffect(()=>{const v=`${t.get(Se,s,"")}-${m.color}${m.shade?`-${m.shade}`:""}`;v.match(new RegExp(t.get(A.CLASSES_LIST,`${s}.regExp`,"")))&&n(v,s)},[m,n,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(U,{disabled:!i,rounded:!0,selected:j,onChange:y,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:p,disabled:!j||!i,onChange:b,options:u})})]})},Q=(s,n)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&n.includes(r))return{value:"",unit:r};const a=n.length?new RegExp(n.join("|"),"g"):/XXXXXX/g;r=r.replace(a,"");const i=s.match(a),u=i&&i.length>1,l=!t.isEmpty(r)&&Number.isNaN(Number(r));return u||l?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:r,unit:i?i[0]:""}};const Ie=s=>{const n=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:`${n}${r}`,unit:"deg"};if(t.includes(s,"rotate-"))return{value:`${n}${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:`${n}${`${r/4}`}`,unit:"rem"};if(t.includes(s,"scale-"))return{value:`${n}${`${r/100}`}`,unit:"-"};if(t.startsWith(s,"border")){const a=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(a)return{value:a[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[a,i]=t.map(r.split("/"),u=>parseInt(u,10));return{value:n+(a/i*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${n+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}};const _e=s=>{if(t.isEmpty(s))return{value:"",unit:""};const n=s.match(/\[.*\]/g);if(n===null)return He(s);const r=t.get(n,"0","").replace(/\[|\]/g,""),a=s.startsWith("-")?"-":"",i=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${a}${i}`,unit:r.replace(i,"")}},He=s=>t.isEmpty(s)?{value:"",unit:""}:Ie(s),ne=g.createContext({setDragData:()=>{}}),Be=({unit:s,currentValue:n,onDrag:r,onDragEnd:a,onDragStart:i,negative:u,cssProperty:l})=>{const{setDragData:m}=g.useContext(ne);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:d=>{const c={onDrag:r,onDragEnd:a,dragging:!0,dragStartY:d.pageY,dragStartValue:`${n}`,dragUnit:s,negative:u,cssProperty:l};i(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(x.RowSpacingIcon,{})})},Ve=({onSelect:s,current:n,units:r})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:r.map(a=>e.jsxRuntimeExports.jsx(o.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:n===a?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),s(a)},children:a},a))}),ee=50,Ae=s=>{const[n,r]=g.useState(!1),[a,i]=g.useState(""),{currentClass:u,onChange:l,classPrefix:m,cssProperty:d,units:c,negative:j}=s,[p,y]=g.useState(d!=null&&d.toLowerCase().includes("width")?"%":c[0]),[b,h]=g.useState(!1),[v,E]=g.useState(""),[S,w]=g.useState(!1),[I,H]=g.useState(!1);g.useEffect(()=>{const{value:f,unit:R}=_e(u);if(R===""){i(f),y(d!=null&&d.toLowerCase().includes("width")?"%":t.first(c));return}y(R),i(R==="class"||t.isEmpty(f)?"":f)},[u,d,c]);const C=X.useThrottledCallback(f=>l(f),[l],ee),T=X.useThrottledCallback(f=>l(f,!1),[l],ee),V=g.useCallback((f=!1)=>{const R=Q(`${a}`,c);if(t.get(R,"error",!1)){h(!0);return}const k=t.get(R,"unit")!==""?t.get(R,"unit"):p;if(k==="auto"||k==="none"){C(`${m}${k}`);return}if(t.get(R,"value")==="")return;const P=`${t.get(R,"value","").startsWith("-")?"-":""}${m}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;f?T(P):C(P)},[C,T,a,p,m,c]),D=g.useCallback(f=>{const R=Q(`${a}`,c);if(t.get(R,"error",!1)){h(!0);return}if(f==="auto"||f==="none"){C(`${m}${f}`);return}if(t.get(R,"value")==="")return;const k=t.get(R,"unit")!==""?t.get(R,"unit"):f,P=`${t.get(R,"value","").startsWith("-")?"-":""}${m}[${t.get(R,"value","").replace("-","")}${k==="-"?"":k}]`;C(P)},[C,a,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:p==="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(x.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 ${S?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(p)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:p==="class",onKeyPress:f=>{f.key==="Enter"&&V()},onKeyDown:f=>{if(f.keyCode!==38&&f.keyCode!==40)return;f.preventDefault(),H(!0);const R=t.parseInt(f.target.value);let k=t.isNaN(R)?0:R;f.keyCode===38&&(k+=1),f.keyCode===40&&(k-=1);const B=`${k}`,le=`${B.startsWith("-")?"-":""}${m}[${B.replace("-","")}${p==="-"?"":p}]`;T(le)},onKeyUp:f=>{I&&(f.preventDefault(),H(!1))},onBlur:()=>V(),onChange:f=>{h(!1),i(f.target.value)},onClick:f=>{var R;(R=f==null?void 0:f.target)==null||R.select(),r(!1)},value:S?v:a,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:n,delayDuration:100,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!n),className:"flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",children:[e.jsxRuntimeExports.jsx("span",{className:`inline-block ${c.length===1?"px-2 font-semibold":""}`,children:p}),c.length>1?e.jsxRuntimeExports.jsx(x.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(o.TooltipPortal,{children:e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Ve,{units:c,current:p,onSelect:f=>{r(!1),y(f),D(f)}})})})]})]}),["none","auto"].indexOf(p)!==-1||S?null:e.jsxRuntimeExports.jsx(Be,{onDragStart:()=>w(!0),onDragEnd:f=>{if(E(()=>""),w(!1),t.isEmpty(f))return;const R=`${f}`,B=`${R.startsWith("-")?"-":""}${m}[${R.replace("-","")}${p==="-"?"":p}]`;C(B)},onDrag:f=>{if(t.isEmpty(f))return;E(f);const R=`${f}`,B=`${R.startsWith("-")?"-":""}${m}[${R.replace("-","")}${p==="-"?"":p}]`;T(B)},currentValue:a,unit:p,negative:j,cssProperty:d})]})})})},q=s=>{const n=o.useSelectedBlockCurrentClasses();return t.findLast(n,{property:s})},De=(s,n)=>{const r={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return r[t.get(s,"mq","xs")]<=r[n]},Pe={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-"},te={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Me=s=>`${s.toUpperCase()} ${te[s]?`(${te[s]} & up)`:""}`,G=s=>{const{t:n}=_.useTranslation(),{type:r="icons",label:a,property:i,onEmitChange:u=()=>{},units:l,negative:m=!1}=s,[d]=o.useDarkMode(),[c]=o.useStylingState(),[,j]=o.useCanvasWidth(),p=q(i),y=o.useAddClassesToBlocks(),b=o.useRemoveClassesFromBlocks(),[h]=o.useSelectedBlockIds(),v=g.useMemo(()=>t.get(p,"fullCls",""),[p]),E=g.useCallback((T,V=!0)=>{const D={dark:d,mq:j,mod:c,cls:T,property:i,fullCls:""};(d||c!=="")&&(D.mq="xs");const f=A.generateFullClsName(D);y(h,[f],V)},[h,d,j,c,i,y]),S=g.useCallback(()=>{b(h,[v])},[h,v,b]),w=g.useMemo(()=>De(p,j),[p,j]);g.useEffect(()=>{u(w,p)},[w,u,p]);const[,,I]=o.useCanvasWidth(),H=g.useCallback(T=>{I({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[T])},[I]),C=t.get(p,"dark",null)===d&&t.get(p,"mod",null)===c&&t.get(p,"mq",null)===j;return e.jsxRuntimeExports.jsx(Ce,{canChange:w,canReset:p&&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] ${p&&!C?"text-foreground":""}`,children:n(a)})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[r==="arbitrary"?e.jsxRuntimeExports.jsx(Ae,{currentClass:t.get(p,"cls",""),classPrefix:t.get(Pe,i,""),units:l||[],onChange:E,negative:m,cssProperty:i}):null,r==="icons"&&e.jsxRuntimeExports.jsx(Ne,{property:i,onChange:E}),r==="range"&&e.jsxRuntimeExports.jsx(ke,{property:i,onChange:E}),r==="color"&&e.jsxRuntimeExports.jsx(Te,{property:i,onChange:E}),r==="dropdown"&&e.jsxRuntimeExports.jsx(oe,{label:a,property:i,onChange:E})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${v?"visible":"invisible"}`,children:C?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>S(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(x.CrossCircledIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):w&&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 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(x.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:[Me(t.get(p,"mq")),d&&!p.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>H(t.get(p,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(p,"mq").toUpperCase()]})]})})})]}):null})]})]})})},$e=["px","%","em","rem","ch","vh","vw"],ie=({label:s,options:n,borderB:r=!1,borderT:a=!1,type:i="arbitrary",units:u=$e,negative:l=!1})=>{const{t:m}=_.useTranslation(),[d,c]=g.useState(n[0].key),j=o.useSelectedBlockCurrentClasses(),p=g.useCallback(y=>t.map(j,"property").includes(y),[j]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${a?"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(n.map(({label:y,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:()=>c(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===d?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[g.createElement("div",{className:p(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),g.createElement(t.get(re,b,x.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{children:t.startCase(t.toLower(y))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(G,{type:i,units:[...u],label:"",property:d,negative:l})})]})},Le=({heading:s,items:n})=>{const{t:r}=_.useTranslation(),a=o.useSelectedBlockCurrentClasses(),i=g.useMemo(()=>{const u=d=>t.flatten(d.map(c=>c.styleType==="multiple"?t.map(c.options,"key"):c.property)),l=t.flatten(n.map(d=>d.styleType==="accordion"?u(d.items):d.styleType==="multiple"?t.map(d.options,"key"):d.property)),m=t.map(a,"property");return t.intersection(l,m).length>0},[a,n]);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),i?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${i?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:n.map(u=>u.styleType==="multiple"?e.jsxRuntimeExports.jsx(ie,{...u},u.label):e.jsxRuntimeExports.jsx(G,{...u},u.label))})]})},qe=g.createContext({}),Y=({section:s})=>{const{t:n}=_.useTranslation(),r=o.useSelectedBlockCurrentClasses(),a=g.useCallback((l=[])=>{const m={};for(let c=0;c<r.length;c++)m[r[c].property]=r[c].cls;let d=!0;for(const c in l)if(!t.has(m,c)||m[c]!==l[c]){d=!1;break}return d},[r]),i=g.useMemo(()=>{if(r.length>0&&s.heading==="classes.heading")return!0;const l=c=>t.flatten(c.map(j=>j.styleType==="multiple"?t.flatten(t.map(j.options,"key")):j.property)),m=t.flatten(s.items.map(c=>c.styleType==="accordion"?l(c.items):c.styleType==="multiple"?t.flatten(t.map(c.options,"key")):c.property)),d=t.map(r,"property");return t.intersection(m,d).length>0},[r,s.heading,s.items]),u=g.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(qe.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 ${i?"bg-blue-500":"bg-gray-300"}`}),n(s.heading)]})}),e.jsxRuntimeExports.jsx(o.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:g.Children.toArray(s.items.map(l=>t.has(l,"component")?g.createElement(l.component,{key:l.label}):t.has(l,"styleType")?l.styleType==="multiple"?e.jsxRuntimeExports.jsx(ie,{...l},l.label):l.styleType==="accordion"&&a(l==null?void 0:l.conditions)?e.jsxRuntimeExports.jsx(Le,{...l},l.label):null:e.jsxRuntimeExports.jsx(G,{...l},l.label)))})]})})},Oe=()=>{const s=o.useSelectedBlock(),[n]=o.useSelectedStylingBlocks(),{t:r}=_.useTranslation(),a=$.useGlobalStylingPresets(),i=o.useAddClassesToBlocks(),u=$.getBlockComponent(s._type),l=t.get(t.first(n),"prop"),m=t.get(u.props,`${l}.presets`,{});if(t.isEmpty(a)&&(!t.has(u,"props")||t.isEmpty(m)))return null;const d=c=>{const j=c.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");i([s._id],j,!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(x.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:[u.type," ",r("presets")]}),e.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),e.jsxRuntimeExports.jsx(o.DropdownMenuGroup,{children:t.keys(m).map(c=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(m[c]),children:[t.capitalize(t.startCase(r(c))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]}),t.isEmpty(a)?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:t.keys(a).map(c=>e.jsxRuntimeExports.jsxs(o.DropdownMenuItem,{className:"group text-xs",onClick:()=>d(a[c]),children:[t.capitalize(t.startCase(r(c))),e.jsxRuntimeExports.jsx(o.DropdownMenuShortcut,{className:"invisible hover:font-bold hover:text-blue-600 group-hover:visible",children:r("apply")})]}))})]})]})})]})})};function We(){const[s,n]=o.useStylingState(),{flexChild:r,gridChild:a}=o.useSelectedBlocksDisplayChild(),{t:i}=_.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(x.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:i("no_styling_block_selected")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx(Oe,{}),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:l=>n(l),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(M.BrushIcon,{className:"w-3"}),e.jsxRuntimeExports.jsx("span",{children:i(`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(Y,{section:Re}),a?e.jsxRuntimeExports.jsx(Y,{section:Ee}):null,we.map(l=>e.jsxRuntimeExports.jsx(Y,{section:l},l.heading))]})})]})}const ze=({onAdd:s})=>{const{t:n}=_.useTranslation(),[r,a]=g.useState({key:"",value:""}),i=()=>{t.isEmpty(r.key)||(s({...r,key:t.kebabCase(r.key)}),a({key:"",value:""}))};return e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 border-gray-200 px-1",children:[e.jsxRuntimeExports.jsx(o.Input,{name:"key",onChange:u=>a({...r,key:u.target.value}),value:r.key,placeholder:n("Name"),autoComplete:"off",autoCapitalize:"off",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),t.isEmpty(r.key)||i())}}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-x-1.5",children:e.jsxRuntimeExports.jsx(o.Input,{name:"value",onChange:u=>a({...r,value:u.target.value}),value:r.value,placeholder:n("Value"),autoComplete:"off",autoCapitalize:"off",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),t.isEmpty(r.key)||i())}})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsxs(o.Button,{disabled:t.isEmpty(r.key),onClick:i,size:"sm",className:"flex items-center",children:[e.jsxRuntimeExports.jsxs("span",{children:[n("Add")," "]}),e.jsxRuntimeExports.jsx(x.PlusIcon,{})]}),t.isEmpty(r.key)?null:e.jsxRuntimeExports.jsx(o.Button,{variant:"ghost",onClick:()=>a({key:"",value:""}),children:n("Cancel")})]})]})},Fe=()=>{const s=o.useSelectedBlock(),[n,r]=g.useState([]),[a]=o.useSelectedStylingBlocks(),i=o.useUpdateBlocksPropsRealtime(),u=o.useUpdateBlocksProps(),{t:l}=_.useTranslation(),m=`${t.get(a,"0.prop")}_attrs`;O.useEffect(()=>{const p=t.map(t.get(s,m),(y,b)=>({key:b,value:y}));t.isEmpty(p)?r([]):r(p)},[t.get(s,m)]);const d=p=>{const y=t.filter(n,(b,h)=>p!==h);j(y)},c=p=>{const y=[...n,p];j(y)},j=O.useCallback((p=[])=>{const y={};t.forEach(p,b=>{t.isEmpty(b.key)||t.set(y,b.key,b.value)}),u([t.get(s,"_id")],{[m]:y})},[s,i,m]);return e.jsxRuntimeExports.jsx("div",{className:"px-2",children:e.jsxRuntimeExports.jsx("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("ul",{className:"overflow-hidden rounded-md bg-gray-100 p-2 text-xs text-gray-700",children:[t.isEmpty(n)?e.jsxRuntimeExports.jsx("li",{className:"flex h-16 items-center justify-center",children:e.jsxRuntimeExports.jsx("p",{children:l("No custom attributes added yet")})}):e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsx("span",{className:"font-bold",children:l("Custom attributes")})}),O.Children.toArray(t.map(n,p=>e.jsxRuntimeExports.jsxs("li",{className:"group flex max-w-full items-center justify-between",children:[e.jsxRuntimeExports.jsxs(o.Tooltip,{delayDuration:1e3,children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("div",{className:"w-[90%] cursor-default truncate px-1 hover:bg-gray-200",children:[p.key," ",e.jsxRuntimeExports.jsx("span",{className:"font-bold text-orange-500",children:"="})," ",p.value]})}),e.jsxRuntimeExports.jsxs(o.TooltipContent,{className:"max-w-[200px]",children:[e.jsxRuntimeExports.jsxs("div",{children:[l("Name"),": ",p.key]}),e.jsxRuntimeExports.jsxs("div",{children:[l("Value"),": ",p.value]})]})]}),e.jsxRuntimeExports.jsxs(o.Tooltip,{children:[e.jsxRuntimeExports.jsx(o.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{className:"invisible group-hover:visible",onClick:()=>d(n.indexOf(p)),children:e.jsxRuntimeExports.jsx(M.DeleteIcon,{className:"w-4 text-gray-500"})})}),e.jsxRuntimeExports.jsx(o.TooltipContent,{className:"max-w-[200px]",children:l("Remove attribute")})]})]})))]})}),e.jsxRuntimeExports.jsx("div",{className:"py-2"}),e.jsxRuntimeExports.jsx(ze,{onAdd:p=>c(p)})]})})})},Ye={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Xe=()=>{const s=o.useSelectedBlock(),{t:n}=_.useTranslation(),[r,a]=g.useState(""),[i,u]=g.useState({onDrag:d=>d,onDragEnd:d=>d,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),l=X.useThrottledCallback(d=>{const c=!t.get(i,"negative",!1),j=t.get(i,"cssProperty","");let p=parseFloat(i.dragStartValue);p=t.isNaN(p)?0:p;let y=Ye[i.dragUnit];(t.startsWith(j,"scale")||j==="opacity")&&(y=10);let h=(i.dragStartY-d.pageY)/y+p;c&&h<0&&(h=0),j==="opacity"&&h>1&&(h=1),i.onDrag(`${h}`),a(`${h}`)},[i],50),m=g.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${r}`),100),u({onDrag:d=>d,onDragEnd:d=>d,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,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(x.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:n("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsx(W.ErrorBoundary,{children:e.jsxRuntimeExports.jsxs(ne.Provider,{value:{setDragData:u},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:l,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 text-xs",children:[e.jsxRuntimeExports.jsxs(o.TabsList,{className:"mx-1 grid grid-cols-3",children:[e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"settings",children:n("settings")}),e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"styling",children:n("styling")}),e.jsxRuntimeExports.jsx(o.TabsTrigger,{value:"attrs",children:n("Attributes")})]}),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(fe,{})})}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"styling",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(We,{})}),e.jsxRuntimeExports.jsx(o.TabsContent,{value:"attrs",className:"h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Fe,{})})]})]})})};exports.default=Xe;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),q=require("@radix-ui/react-icons"),i=require("react"),S=require("jotai"),u=require("lodash-es"),s=require("./index-fvMaxES9.cjs"),R=require("lucide-react"),_=require("@chaibuilder/runtime"),f=require("react-i18next"),w=require("./index-gi1LIOCw.cjs"),D=require("./index-bOWwCMRF.cjs"),l=require("./STRINGS-gPz7CUOk.cjs"),K=require("./Functions-N3yhPYKY.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@react-hookz/web");require("./MODIFIERS-0g14w5RS.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./Class-PoYusiA5.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("i18next");require("@floating-ui/react-dom");require("flagged");require("react-hotkeys-hook");const C=({provider:t,onClose:a})=>{const{t:o}=f.useTranslation(),[n,h]=i.useState(null);return i.useEffect(()=>{t&&(t.mockFn?t.mockFn:t.dataFn)().then(c=>h(c))},[t]),t?e.jsxRuntimeExports.jsx(s.Dialog,{onOpenChange:m=>m?"":a(),defaultOpen:!0,children:e.jsxRuntimeExports.jsxs(s.DialogContent,{children:[e.jsxRuntimeExports.jsxs(s.DialogHeader,{children:[e.jsxRuntimeExports.jsxs(s.DialogTitle,{children:[o("data_provider"),": ",t.name]}),e.jsxRuntimeExports.jsx(s.DialogDescription,{children:t.description})]}),e.jsxRuntimeExports.jsx(D.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(w.JsonView,{data:n,shouldExpandNode:w.allExpanded,style:{...w.defaultStyles,container:"max-h-[80vh] 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"}})})]})}):null};function I({children:t,name:a,onRemove:o}){const{t:n}=f.useTranslation();return e.jsxRuntimeExports.jsxs(s.AlertDialog,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTrigger,{asChild:!0,children:t}),e.jsxRuntimeExports.jsxs(s.AlertDialogContent,{children:[e.jsxRuntimeExports.jsxs(s.AlertDialogHeader,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogTitle,{dangerouslySetInnerHTML:{__html:n("remove_provider_confirmation").replace("{name}",a)}}),e.jsxRuntimeExports.jsx(s.AlertDialogDescription,{children:n("remove_provider_warning")})]}),e.jsxRuntimeExports.jsxs(s.AlertDialogFooter,{children:[e.jsxRuntimeExports.jsx(s.AlertDialogCancel,{children:n("cancel")}),e.jsxRuntimeExports.jsx(s.AlertDialogAction,{onClick:o,className:"bg-red-600 hover:bg-red-700",children:n("remove")})]})]})]})}const P=()=>{const{t}=f.useTranslation(),a=i.useMemo(()=>_.getChaiDataProviders(),[]),[o,n]=s.usePageDataProviders(),[,h]=S.useAtom(s.pageSyncStateAtom),[m,c]=i.useState(u.filter(a,r=>u.map(o,"providerKey").includes(r.providerKey))),[b,E]=i.useState(""),[g,d]=i.useState(null),N=u.filter(a.map(r=>u.map(m,"providerKey").includes(r.providerKey)?null:{value:r.providerKey,label:r.name}),r=>!u.isNull(r)),y=r=>{const p=u.find(a,{providerKey:r});c(j=>[...j,p]),n(j=>[...j,{providerKey:p.providerKey,args:{}}]),E(""),h("UNSAVED")},x=r=>{c(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),n(p=>u.filter(p,j=>j.providerKey!==r.providerKey)),h("UNSAVED")},v=r=>d(r);return u.isEmpty(a)?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("p",{className:"mb-1.5 p-4 text-xs text-gray-500",children:[t("no_data_providers"),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:t("learn_more")})]})}):e.jsxRuntimeExports.jsxs("div",{className:"px-1",children:[e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("label",{children:e.jsxRuntimeExports.jsx("p",{className:"mb-1.5 text-xs text-gray-500",children:t("add_data_providers")})}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-1",children:e.jsxRuntimeExports.jsxs(s.Select,{value:b,onValueChange:r=>y(r),children:[e.jsxRuntimeExports.jsx(s.SelectTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(s.SelectValue,{placeholder:t("select_provider")})}),e.jsxRuntimeExports.jsxs(s.SelectContent,{children:[e.jsxRuntimeExports.jsx(s.SelectItem,{value:"",children:t("choose")}),N.map(r=>e.jsxRuntimeExports.jsx(s.SelectItem,{value:r.value,children:r.label},r.value))]})]})}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("div",{className:`border-t ${m.length?"block":"hidden"}`,children:[e.jsxRuntimeExports.jsxs("p",{className:"flex-1 pb-1.5 pt-4 text-xs font-medium text-gray-500",children:[t("page_data_providers"),":"]}),e.jsxRuntimeExports.jsx("div",{className:"space-y-2",children:m.map(r=>e.jsxRuntimeExports.jsxs("div",{className:"w-full rounded-lg border bg-card text-card-foreground shadow-sm","data-v0-t":"card",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-1.5 px-4 pt-4",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between",children:e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",{className:"font-medium leading-4",children:r.name}),e.jsxRuntimeExports.jsx("p",{className:"pt-1 text-xs text-gray-400",children:r.description})]})})}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between p-2 py-2",children:[e.jsxRuntimeExports.jsxs("button",{onClick:()=>v(r),className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),e.jsxRuntimeExports.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),t("view_data")]}),e.jsxRuntimeExports.jsx(I,{onRemove:()=>x(r),name:r.name,children:e.jsxRuntimeExports.jsxs("button",{className:"inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:[e.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2 h-4 w-4",children:[e.jsxRuntimeExports.jsx("path",{d:"M3 6h18"}),e.jsxRuntimeExports.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),e.jsxRuntimeExports.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]}),t("remove")]})})]})]},r.providerKey))}),e.jsxRuntimeExports.jsx(C,{onClose:()=>d(null),provider:g})]})]})},L=()=>{const{t}=f.useTranslation(),a={"ctrl + Z":"Undo","ctrl + Y":"Redo","ctrl + D":"Duplicate"},o={"ctrl + S":"Save page",esc:"Deselect blocks",del:"Delete block"};return e.jsxRuntimeExports.jsxs(s.Dialog,{children:[e.jsxRuntimeExports.jsx(s.DialogTrigger,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{children:e.jsxRuntimeExports.jsx(s.Button,{size:"sm",className:"w-10",variant:"outline",children:e.jsxRuntimeExports.jsx(q.KeyboardIcon,{})})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:t("Keyboard shortcuts")})})]})}),e.jsxRuntimeExports.jsxs(s.DialogContent,{className:"sm:max-w-[525px]",children:[e.jsxRuntimeExports.jsx(s.DialogHeader,{children:e.jsxRuntimeExports.jsx(s.DialogTitle,{children:t("Keyboard shortcuts")})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs("div",{className:"grid grid-cols-2",children:[e.jsxRuntimeExports.jsx("div",{className:"mr-8 flex flex-col space-y-2 border-r border-gray-200",children:Object.keys(a).map(n=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(n)}),e.jsxRuntimeExports.jsx("div",{children:t(a[n])})]},n))}),e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-y-2",children:Object.keys(o).map(n=>e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx(s.Badge,{variant:"outline",className:"border border-gray-600 p-1 px-2",children:t(n)}),e.jsxRuntimeExports.jsx("div",{children:t(o[n])})]},n))})]})})]})]})},O=i.lazy(()=>Promise.resolve().then(()=>require("./AddBlocks-bgu08YJC.cjs"))),T=i.lazy(()=>Promise.resolve().then(()=>require("./ListTree-5n8U4-IF.cjs"))),A=i.lazy(()=>Promise.resolve().then(()=>require("./BrandingOptions-AljW1cXz.cjs"))),B=i.lazy(()=>Promise.resolve().then(()=>require("./index-fvMaxES9.cjs")).then(t=>t.ImagesPanel));let k=null;const U=()=>{const t=s.useBuilderProp("sideBarComponents.top",[]),a=s.useBuilderProp("sideBarComponents.bottom",[]),[o,n]=S.useAtom(s.activePanelAtom),[h,m]=i.useState(o),[c,b]=i.useState(null),{t:E}=f.useTranslation(),g={"add-blocks":O,[l.OUTLINE_KEY]:T,"branding-options":A,images:B};u.each(t,({name:x,panel:v})=>{g[x]=v});const d=x=>{clearTimeout(k),o!==l.OUTLINE_KEY&&x===l.OUTLINE_KEY?k=setTimeout(()=>n(l.OUTLINE_KEY),500):m(x),n(x)},N=s.useBuilderProp("dataBindingSupport",!1);function y(){const x=setTimeout(()=>{c&&(d(l.OUTLINE_KEY),clearTimeout(c))},500);b(x)}return e.jsxRuntimeExports.jsxs("div",{className:"relative flex",children:[o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{onMouseEnter:y,onClick:()=>d(l.OUTLINE_KEY),className:"fixed inset-0 z-[50] bg-black/20"}):null,e.jsxRuntimeExports.jsxs("div",{className:"z-[100] flex h-full w-fit flex-col items-center justify-between border-b border-r border-border bg-background pt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2",children:[e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>{d("add-blocks")},size:"sm",variant:o==="add-blocks"?"default":"outline",children:e.jsxRuntimeExports.jsx(q.PlusIcon,{className:"text-xl"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(l.OUTLINE_KEY),size:"sm",variant:o===l.OUTLINE_KEY?"default":"outline",children:e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"w-4"})}),e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d("branding-options"),size:"sm",variant:o==="branding-options"?"default":"outline",children:e.jsxRuntimeExports.jsx(q.Half2Icon,{className:"w-4 max-w-[40px] text-xs"})}),i.Children.toArray(t.map(({name:x,icon:v})=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(s.Button,{onClick:()=>d(x),size:"sm",className:"w-10",variant:o===x?"default":"outline",children:e.jsxRuntimeExports.jsx(v,{})})})))]}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100] flex w-14 flex-col items-center space-y-2 pb-2",children:[e.jsxRuntimeExports.jsx(L,{}),i.Children.toArray(a.map(x=>e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx(s.Skeleton,{className:"h-10"}),children:e.jsxRuntimeExports.jsx(x,{})})))]})]}),o!==l.OUTLINE_KEY?e.jsxRuntimeExports.jsx("div",{className:"absolute left-14 z-[50] h-full w-fit translate-x-0 border-r bg-background transition-all duration-500 ease-in-out",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 bg-white p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:e.jsxRuntimeExports.jsx("div",{className:K.cn("relative z-[100] h-full max-h-[98%] overflow-y-auto overflow-x-hidden bg-background p-1"),onMouseEnter:()=>{c&&clearTimeout(c)},children:i.createElement(u.get(g,o,()=>e.jsxRuntimeExports.jsx("div",{})))})})}):null,e.jsxRuntimeExports.jsx("div",{className:"h-full w-60 border-r p-1",children:e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsxs("div",{className:"flex animate-pulse flex-col gap-y-2 p-4",children:[e.jsxRuntimeExports.jsx("div",{className:"h-6 w-1/2 bg-gray-300"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"h-16 w-full bg-gray-200"})]}),children:N?e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(s.TabsList,{className:"mx-1 grid h-10 grid-cols-2",children:[e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]}),e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:"data-provider",children:[e.jsxRuntimeExports.jsx(R.DatabaseIcon,{className:"mr-2 w-3"}),E("Data")]})]}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(T)}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:"data-provider",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(P,{})})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tabs,{defaultValue:l.OUTLINE_KEY,className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsx(s.TabsList,{className:"mx-1 grid h-10 grid-cols-1",children:e.jsxRuntimeExports.jsxs(s.TabsTrigger,{value:l.OUTLINE_KEY,children:[e.jsxRuntimeExports.jsx(R.ListTreeIcon,{className:"mr-2 h-3"})," ",E("Outline")]})}),e.jsxRuntimeExports.jsx(s.TabsContent,{value:l.OUTLINE_KEY,className:"no-scrollbar h-full flex-1 overflow-y-auto overflow-x-hidden",children:i.createElement(T)})]})})})})]})};exports.default=U;
|