@chaibuilder/sdk 0.1.22 → 0.1.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-254892c5.js → AddBlocks-189ba69a.js} +1 -1
- package/dist/{AddBlocks-a86eec32.cjs → AddBlocks-36adcc50.cjs} +1 -1
- package/dist/{BrandingOptions-81fb41d9.js → BrandingOptions-c01e08fc.js} +1 -1
- package/dist/{BrandingOptions-10c05f85.cjs → BrandingOptions-e659a7bf.cjs} +1 -1
- package/dist/{CanvasArea-7e09f98e.js → CanvasArea-9106ecb5.js} +2 -2
- package/dist/{CanvasArea-a261378b.cjs → CanvasArea-933848fb.cjs} +2 -2
- package/dist/{CurrentPage-ce5a51fa.js → CurrentPage-37d2f495.js} +1 -1
- package/dist/{CurrentPage-b67bee36.cjs → CurrentPage-92d8bfe0.cjs} +1 -1
- package/dist/{Layers-4e859d15.cjs → Layers-94aeb9f0.cjs} +1 -1
- package/dist/{Layers-b3a452cc.js → Layers-c08aa961.js} +2 -2
- package/dist/{MarkAsGlobalBlock-1a1039f8.cjs → MarkAsGlobalBlock-07cb6760.cjs} +1 -1
- package/dist/{MarkAsGlobalBlock-7d9f5e11.js → MarkAsGlobalBlock-10422d13.js} +1 -1
- package/dist/{PagesPanel-2559ea9e.js → PagesPanel-be499af0.js} +2 -2
- package/dist/{PagesPanel-163b7771.cjs → PagesPanel-e4807890.cjs} +1 -1
- package/dist/{ProjectPanel-e78931cd.cjs → ProjectPanel-0478c85b.cjs} +1 -1
- package/dist/{ProjectPanel-fab32a4f.js → ProjectPanel-fd948934.js} +2 -2
- package/dist/Settings-6cb217af.cjs +1 -0
- package/dist/{Settings-a2638a6e.js → Settings-94b79852.js} +490 -486
- package/dist/SidePanels-4434d31b.cjs +1 -0
- package/dist/{SidePanels-aa583e71.js → SidePanels-78d8de19.js} +68 -64
- package/dist/{Topbar-ef648e78.js → Topbar-0542b5f4.js} +1 -1
- package/dist/{Topbar-c131ef83.cjs → Topbar-d6382110.cjs} +1 -1
- package/dist/{add-page-modal-8c9dad17.js → add-page-modal-36a6b406.js} +1 -1
- package/dist/{add-page-modal-7d645bf7.cjs → add-page-modal-6132fdff.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{delete-page-modal-ec091c19.js → delete-page-modal-68a4d71e.js} +1 -1
- package/dist/{delete-page-modal-19001f8d.cjs → delete-page-modal-87c48560.cjs} +1 -1
- package/dist/{index-2f61b040.cjs → index-6f5cce76.cjs} +2 -2
- package/dist/{index-e6e838ec.js → index-c49887fe.js} +4 -4
- package/dist/{page-viewer-65e2ca1a.cjs → page-viewer-47098c44.cjs} +1 -1
- package/dist/{page-viewer-dec9a6d2.js → page-viewer-d87e5621.js} +2 -2
- package/dist/{project-general-setting-c7d95cc0.cjs → project-general-setting-869887d5.cjs} +1 -1
- package/dist/{project-general-setting-067afe22.js → project-general-setting-91df16a9.js} +1 -1
- package/dist/{single-page-detail-14e7a650.cjs → single-page-detail-1b276c4f.cjs} +1 -1
- package/dist/{single-page-detail-f110be66.js → single-page-detail-4a424725.js} +2 -2
- package/package.json +1 -1
- package/dist/Settings-d9df3548.cjs +0 -1
- package/dist/SidePanels-1439e695.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),c=require("react"),Z=require("@react-hookz/web"),t=require("lodash"),se=require("react-i18next"),u=require("@radix-ui/react-icons"),P=require("./tabs-860e37aa.cjs"),pe=require("@rjsf/core"),de=require("@rjsf/validator-ajv8"),R=require("./index-6f5cce76.cjs"),Y=require("@chaibuilder/blocks"),re=require("lucide-react"),oe=require("react-autosuggest"),ce=require("./useChaiExternalData-a90e8aac.cjs"),w=require("./useBuilderProp-5e57d0c8.cjs"),T=require("./accordion-0afd8143.cjs"),W=require("./link-86ac8848.cjs"),xe=require("jotai"),me=require("fuse.js"),$=require("./html-to-json-aadcbf66.cjs"),U=require("./label-167415e5.cjs"),ge=require("./MODIFIERS-4716c669.cjs"),he=require("./input-42acea7e.cjs"),ye=require("./scroll-area-bb343b86.cjs"),k=require("./select-0e32300c.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("sonner");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-accordion");require("react-icons-picker");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("./ImagesPanel-0db5c72f.cjs");require("react-quill");require("himalaya");require("@radix-ui/react-label");require("@radix-ui/react-select");function be(r){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const s in r)if(s!=="default"){const a=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:()=>r[s]})}}return n.default=r,Object.freeze(n)}const F=be(c);function fe(r){const n=[],s={};function a(l,i){t.forEach(i,(d,p)=>{const o=l?`${l}.${p}`:p,x=t.isArray(d)?"list":typeof d;n.push(o),s[o]=x==="string"?"text":x==="object"?"model":x,x==="object"&&!t.isArray(d)&&a(o,d)})}return a("",t.omit(r,["styles","_type","_id","_name","_bindings"])),{paths:n,pathsType:s}}const je=({data:r})=>{if(!r)return null;const n=typeof r;return e.jsxRuntimeExports.jsx("div",{className:"text-[10px] text-gray-800/50 leading-3 whitespace-nowrap overflow-hidden w-full",children:t.truncate(n==="object"?JSON.stringify(r):r,{length:40})})},K=({type:r,isDisabled:n=!1,placeholder:s,defaultValue:a="",data:l,onChange:i,dataType:d,appliedBindings:p})=>{const[o,x]=c.useState(a),{paths:m,pathsType:y}=fe(l),g=r==="PROP"?Y.getBlockComponent(l==null?void 0:l._type):{};c.useEffect(()=>{t.isEmpty(o)&&i("")},[o]),c.useEffect(()=>x(a),[a]);const f=()=>m.filter(j=>{const C=t.isEmpty(o)||t.includes(t.toLower(j),t.toLower(o));return r==="PATH"?C&&d===t.get(y,j,""):C&&!t.includes(p,j)&&t.get(g,`props.${t.first(t.split(j,"."))}.binding`)}),[h,v]=c.useState(()=>f());c.useEffect(()=>v(()=>f()),[d]);const H={autoComplete:"off",autoCorrect:"on",autoCapitalize:"off",spellCheck:!1,placeholder:s,value:o,disabled:n,onBlur:()=>{m.includes(o)?i(o):(x(""),i(""))},onChange:(j,{newValue:C})=>x(C),className:`chai-input w-full ${n?"cursor-not-allowed":""}`},I=j=>e.jsxRuntimeExports.jsxs("div",{className:"rounded-md px-1 py-1.5 flex items-center justify-between space-x-2 font-light relative","data-suggest":j,children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 w-full h-full absolute opacity-0 z-20",children:j}),e.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[e.jsxRuntimeExports.jsx("div",{className:"leading-4 text-xs flex items-center text-gray-800",children:c.Children.toArray(t.map(t.split(j,"."),(C,A)=>e.jsxRuntimeExports.jsxs("span",{className:"flex items-end",children:[A>0&&e.jsxRuntimeExports.jsx(re.ChevronRight,{size:14,className:"h-full text-gray-400"}),t.startCase(C)]})))}),r==="PATH"&&e.jsxRuntimeExports.jsx(je,{data:t.get(l,j)})]}),r==="PROP"&&e.jsxRuntimeExports.jsx("div",{className:"bg-purple-100 text-purple-400 text-[9px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(t.get(y,j,""))})]});return e.jsxRuntimeExports.jsx(oe,{suggestions:h,onSuggestionsFetchRequested:()=>v(()=>f()),onSuggestionsClearRequested:()=>v([]),onSuggestionSelected:j=>{if(j.type==="click"){const C=t.get(j.target,"childNodes[0].data","");m.includes(C)&&i(C)}else i(j.target.value)},getSuggestionValue:j=>j,renderSuggestion:I,shouldRenderSuggestions:()=>!0,inputProps:H,containerProps:{className:"w-full"},theme:{suggestion:"text-gray-500 border-b overflow-hidden text-ellipsis",suggestionHighlighted:"bg-blue-100 text-blue-800 font-normal cursor-pointer",suggestionsContainerOpen:"bg-white border border-gray-300 z-50 max-h-52 left-2 overflow-y-auto w-full rounded-md shadow-2xl text-sm font-light w-full"}})},ve=({item:r,onChange:n,onRemove:s,selectedBlock:a,dataProvider:l,appliedBindings:i})=>{const[d,p]=c.useState("string"),o=(x,m)=>{if(t.isEmpty(x))return"";{const y=t.get(m==="PROP"?a:l,x,"");if(t.isArray(y))return"list";const g=typeof y;return g==="string"?"text":g==="object"?"model":g}};return c.useEffect(()=>p(()=>o(r.key,"PROP")),[r.key]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 border border-gray-200 relative rounded-md p-2",children:[!t.isEmpty(d)&&!t.isEmpty(r.key)&&e.jsxRuntimeExports.jsx("div",{className:"mt-px absolute right-2 top-4 text-purple-600 text-[10px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(d)}),e.jsxRuntimeExports.jsx(K,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",defaultValue:r.key,onChange:x=>{const m=o(x,"PROP");n({target:{name:"key",value:x}}),d!==m&&n({target:{name:"value",value:""}}),p(m)},data:a,dataType:d,appliedBindings:i}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-start justify-between gap-x-1.5 w-full relative",children:[e.jsxRuntimeExports.jsx(K,{type:"PATH",isDisabled:t.isEmpty(r.key),placeholder:"Enter data path",defaultValue:r.value,onChange:x=>{const m=o(x,"PATH");n(d!==m?{target:{name:"value",value:""}}:{target:{name:"value",value:x}})},data:l,dataType:d,appliedBindings:i}),e.jsxRuntimeExports.jsx(re.TrashIcon,{onClick:s,className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-red-400 hover:text-white border-red-400 p-1 text-red-400 hover:scale-105 duration-200"})]})]})},Re=({bindingData:r,onChange:n})=>{const s=R.useSelectedBlock(),[a]=ce.useChaiExternalData(),l=Y.getChaiDataProviders(),[i,d]=c.useState(t.map(r,(g,f)=>({key:f,value:g})));c.useEffect(()=>{d(t.map(r,(g,f)=>({key:f,value:g})))},[s==null?void 0:s._id]);const p=c.useMemo(()=>{if(t.isEmpty(i))return!1;const g=t.last(i);return t.isEmpty(g==null?void 0:g.key)||t.isEmpty(g==null?void 0:g.value)},[i]),o=()=>{d([...i,{key:"",value:""}])},x=g=>{const f=t.filter(i,(h,v)=>g!==v);y([...f])},m=(g,f)=>{const h=[...i];h[f][g.target.name]=g.target.value,y(h)},y=c.useCallback((g=[])=>{if(d(g),t.isEmpty(g)){n({});return}const f={};t.forEach(g,h=>{!t.isEmpty(h==null?void 0:h.key)&&!t.isEmpty(h==null?void 0:h.value)&&t.set(f,h.key,h.value)}),n(f)},[s]);return t.isEmpty(l)?e.jsxRuntimeExports.jsx("div",{className:"w-full flex items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs",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(i,(g,f)=>e.jsxRuntimeExports.jsx(ve,{item:g,onChange:h=>m(h,f),onRemove:()=>x(f),selectedBlock:s,dataProvider:a,appliedBindings:t.map(i,"key")},g.key)),e.jsxRuntimeExports.jsxs(w.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx("button",{onClick:o,disabled:p,className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${t.isEmpty(i)?"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30 ":""} ${p?"cursor-not-allowed bg-gray-200 text-gray-400":t.isEmpty(i)?"":"bg-gray-700/20 text-gray-800 hover:bg-blue-700/30"}`,children:"+ Add Data Binding"})}),p&&e.jsxRuntimeExports.jsx(w.TooltipContent,{sideOffset:10,className:"text-[11px]",children:"Complete last added data binding to add more"})]})]})},Ee=Re,we=()=>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"}),J=({createHistorySnapshot:r,properties:n,formData:s,onChange:a})=>{const[l]=R.useActiveLanguage(),i={type:"object",properties:{}},d={};return Object.keys(n).forEach(p=>{const o=n[p];if(t.includes(["slot","styles"],o.type))return;const x=t.get(o,"i18n",!1)?`${p}-${l}`:p;i.properties[x]=R.getBlockJSONFromSchemas(o,l),d[x]=R.getBlockJSONFromUISchemas(o,l)}),e.jsxRuntimeExports.jsx(pe,{widgets:{binding:we,richtext:W.RichTextEditorField,icon:W.IconPickerField,image:W.ImagePickerField},fields:{link:W.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,validator:de,uiSchema:d,onBlur:r,schema:i,formData:s,onChange:a})};function Ce(){const r=R.useSelectedBlock(),{createSnapshot:n}=R.useCanvasHistory(),s=R.useUpdateBlocksPropsRealtime(),a=Y.getBlockComponent(r._type),l={...r},i=()=>n(),d=({formData:m},y)=>{if(y){const g=y.replace("root.","");s([r._id],{[g]:t.get(m,g)})}},p={_name:Y.SingleLineText({title:"Name",default:t.get(r,"_name",r._type)})},o=t.keys(t.get(l,"_bindings",{})),x=c.useMemo(()=>{const m=t.cloneDeep(t.get(a,"props",{}));return t.each(o,y=>{delete m[y]}),m},[a,o]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(J,{onChange:d,createHistorySnapshot:i,formData:l,properties:p}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),e.jsxRuntimeExports.jsxs(T.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(Ee,{bindingData:t.get(l,"_bindings",{}),onChange:m=>{d({formData:{...l,_bindings:m}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",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(T.AccordionContent,{className:"pt-4",children:[t.isEmpty(o)?"":e.jsxRuntimeExports.jsxs("div",{className:"text-xs mx-4 border rounded-sm p-1 mb-1 mt-0 border-orange-500 text-orange-500 bg-orange-100",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(o,t.capitalize).join(", ")})," ",o.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(J,{onChange:d,createHistorySnapshot:i,formData:l,properties:x})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const Q=new me($.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function ke(){var I;const[r]=R.useSelectedStylingBlocks(),n=R.useSelectedBlock(),s=R.useAddClassesToBlocks(),a=R.useRemoveClassesFromBlocks(),[l]=R.useSelectedBlockIds(),[i,d]=c.useState(""),p=(I=t.first(r))==null?void 0:I.prop,o=t.reject((t.get(n,p,"").replace(ge.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),x=()=>{const j=i.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");s(l,j,!0),d("")},[m,y]=c.useState([]),g=({value:j})=>{const C=j.trim().toLowerCase(),A=C.match(/.+:/g);let S=[];if(A&&A.length>0){const[V]=A,L=C.replace(V,"");S=Q.search(L).map(b=>({...b,item:{...b.item,name:V+b.item.name}}))}else S=Q.search(C);y(t.map(S,"item"))},f=()=>{y([])},h=j=>j.name,v=j=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:j.name}),H={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:i,onKeyDown:j=>{j.key==="Enter"&&i.trim()!==""&&x()},onChange:(j,{newValue:C})=>d(C),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 ${m.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(U.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(oe,{suggestions:m,onSuggestionsFetchRequested:g,onSuggestionsClearRequested:f,getSuggestionValue:h,renderSuggestion:v,inputProps:H,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(w.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:x,disabled:i.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(o)&&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"}),F.Children.toArray(o.map(j=>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:[j,e.jsxRuntimeExports.jsx(u.Cross2Icon,{onClick:()=>a(l,[j]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},j)))]})]})}const B=["px","%","em","rem","ch","vh","vw"],Se={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:B,property:"flexBasis"},{type:"range",label:"Order",property:"order"},{type:"dropdown",label:"Flex",property:"flexGrowShrink"},{type:"dropdown",label:"Grow",property:"flexGrow"},{type:"dropdown",label:"Shrink",property:"flexShrink"}]},Ne={heading:"Grid Child",items:[{type:"range",label:"Col Span",property:"gridColSpan"},{type:"range",label:"Col Start",property:"gridColStart"},{type:"range",label:"Col End",property:"gridColEnd"},{type:"range",label:"Row Span",property:"gridRowSpan"},{type:"range",label:"Row Start",property:"gridRowStart"},{type:"range",label:"Row End",property:"gridRowEnd"},{type:"range",label:"Order",property:"order"}]},Te=[{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:B},{styleType:"accordion",heading:"Flex options",items:[{type:"dropdown",label:"Direction",property:"flexDirection"},{type:"dropdown",label:"Wrap",property:"flexWrap"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"flex"}},{styleType:"accordion",heading:"Grid options",items:[{type:"range",label:"Columns",property:"gridColumns"},{type:"range",label:"Rows",property:"gridRows"},{type:"dropdown",label:"Auto Flow",property:"gridAutoFlow"},{type:"dropdown",label:"Auto Cols",property:"gridAutoColumns"},{type:"dropdown",label:"Auto Rows",property:"gridAutoRows"},{type:"dropdown",label:"Justify",property:"justifyContent"},{type:"dropdown",label:"Content",property:"alignContent"},{type:"dropdown",label:"Items",property:"alignItems"},{styleType:"multiple",label:"Gap",units:["px","rem"],options:[{key:"gap",label:"All"},{key:"gapX",label:"Left-Right"},{key:"gapY",label:"Top-Bottom"}]}],conditions:{display:"grid"}},{styleType:"accordion",heading:"Visibility & Opacity",items:[{type:"dropdown",label:"Visibility",property:"visibility",units:B},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...B,"auto"],options:[{key:"margin",label:"All"},{key:"marginX",label:"Left-Right"},{key:"marginY",label:"Top-Bottom"},{key:"marginTop",label:"Top"},{key:"marginRight",label:"Right"},{key:"marginBottom",label:"Bottom"},{key:"marginLeft",label:"Left"}]},{styleType:"multiple",label:"Padding",options:[{key:"padding",label:"All"},{key:"paddingX",label:"Left-Right"},{key:"paddingY",label:"Top-Bottom"},{key:"paddingTop",label:"Top"},{key:"paddingRight",label:"Right"},{key:"paddingBottom",label:"Bottom"},{key:"paddingLeft",label:"Left"}]},{styleType:"multiple",label:"Space Between",options:[{key:"spaceX",label:"Left-Right"},{key:"spaceY",label:"Top-Bottom"}]}]},{heading:"Size",items:[{type:"arbitrary",label:"Width",units:B.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:B.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:B.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:B.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:B.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:B.concat("auto"),property:"maxHeight"}]},{styleType:"accordion",heading:"Object options & aspect ratio",items:[{type:"dropdown",label:"Aspect",property:"aspectRatio"},{type:"dropdown",label:"Fit",property:"objectFit"},{type:"dropdown",label:"Position",property:"objectPosition"}]}]},{heading:"Position",items:[{type:"icons",label:"Position",property:"position"},{styleType:"accordion",heading:"Position options",items:[{styleType:"multiple",label:"Direction",options:[{key:"top",label:"Top"},{key:"right",label:"Right"},{key:"bottom",label:"Bottom"},{key:"left",label:"Left"}]},{styleType:"multiple",label:"Inset",options:[{key:"inset",label:"All"},{key:"insetX",label:"Left Right"},{key:"insetY",label:"Top Bottom"}]},{type:"arbitrary",label:"Z-Chai",units:["-","auto"],property:"zIndex"}]},{styleType:"accordion",heading:"Float & Clear",items:[{type:"icons",label:"Float",property:"float"},{type:"dropdown",label:"Clear",property:"clear"}]},{styleType:"accordion",heading:"Overflow & Overscroll",items:[{styleType:"multiple",type:"dropdown",label:"Overflow",options:[{key:"overflow",label:"All"},{key:"overflowX",label:"Left-Right"},{key:"overflowY",label:"Top-Bottom"}]},{styleType:"multiple",type:"dropdown",label:"Overscroll",options:[{key:"overscroll",label:"All"},{key:"overscrollX",label:"Left-Right"},{key:"overscrollY",label:"Top-Bottom"}]}]}]},{heading:"Typography",items:[{type:"dropdown",property:"fontFamily",label:"Font"},{type:"arbitrary",property:"fontSize",label:"Size",units:B},{type:"arbitrary",property:"lineHeight",label:"Height",units:B.concat("-")},{type:"range",property:"fontWeight",label:"Weight"},{type:"color",property:"textColor",label:"Color"},{styleType:"accordion",heading:"Alignments",items:[{type:"dropdown",property:"textAlign",label:"Align"},{type:"dropdown",property:"verticalAlign",label:"V. Align"}]},{styleType:"accordion",heading:"Spacing, decoration & more",items:[{type:"dropdown",property:"letterSpacing",label:"Spacing"},{type:"dropdown",property:"textDecoration",label:"Decoration"},{type:"range",property:"textDecorationThickness",label:"Thickness"},{type:"dropdown",property:"textTransform",label:"Transform"}]},{styleType:"accordion",heading:"White space & breaks",items:[{type:"dropdown",property:"whitespace",label:"Whitespace"},{type:"dropdown",property:"wordBreak",label:"Wordbreak"}]}]},{heading:"Background",items:[{type:"color",label:"Bg. Color",property:"backgroundColor"},{styleType:"accordion",heading:"Position, Size & more",items:[{type:"dropdown",label:"Attachment",property:"backgroundAttachment"},{type:"dropdown",label:"Clipping",property:"backgroundClip"},{type:"dropdown",label:"Origin",property:"backgroundOrigin"},{type:"dropdown",label:"Position",property:"backgroundPosition"},{type:"dropdown",label:"Repeat",property:"backgroundRepeat"},{type:"dropdown",label:"Size",property:"backgroundSize"}]},{type:"dropdown",label:"Gradient",property:"backgroundGradient"},{styleType:"accordion",heading:"Gradient colors",items:[{type:"color",label:"From",property:"fromColor"},{type:"color",label:"Via",property:"viaColor"},{type:"color",label:"To",property:"toColor"}]}]},{heading:"Border & Outline",items:[{styleType:"multiple",type:"dropdown",label:"Width",options:[{key:"border",label:"All"},{key:"borderX",label:"Left Right"},{key:"borderY",label:"Top bottom"},{key:"borderTop",label:"Top"},{key:"borderRight",label:"Right"},{key:"borderBottom",label:"Bottom"},{key:"borderLeft",label:"Left"}]},{styleType:"multiple",type:"dropdown",label:"Corners",options:[{key:"borderRadius",label:"All"},{key:"borderRadiusTop",label:"Top"},{key:"borderRadiusRight",label:"Right"},{key:"borderRadiusBottom",label:"Bottom"},{key:"borderRadiusLeft",label:"Left"},{key:"borderRadiusTopLeft",label:"Top Left"},{key:"borderRadiusTopRight",label:"Top right"},{key:"borderRadiusBottomRight",label:"Bottom right"},{key:"borderRadiusBottomLeft",label:"Bottom left"}]},{type:"color",label:"Color",property:"borderColor"},{type:"dropdown",label:"Style",property:"borderStyle"},{styleType:"accordion",heading:"Divide options",items:[{styleType:"multiple",type:"range",label:"Width",options:[{key:"divideXWidth",label:"Left Right"},{key:"divideYWidth",label:"Top Bottom"}]},{type:"color",label:"Color",property:"divideColor"},{type:"dropdown",label:"Style",property:"divideStyle"}]},{styleType:"accordion",heading:"Outline styling",items:[{type:"range",label:"Width",property:"outlineWidth"},{type:"range",label:"Offset",property:"outlineOffset"},{type:"dropdown",label:"Style",property:"outlineStyle"}]},{styleType:"accordion",heading:"Ring options",items:[{type:"range",label:"Width",property:"ringWidth"},{type:"color",label:"Color",property:"ringColor"},{type:"range",label:"Offset",property:"ringOffsetWidth"},{type:"color",label:"Off. color",property:"ringOffsetColor"}]}]},{heading:"Effect & Animation",items:[{type:"range",label:"Shadow",property:"boxShadow"},{type:"color",label:"Color",property:"boxShadowColor"},{type:"dropdown",label:"Cursor",property:"cursor"},{styleType:"accordion",heading:"Blend & Cursor",items:[{type:"dropdown",label:"Mix Blend",property:"mixBlendMode"},{type:"dropdown",label:"Bg. Blend",property:"bgBlendMode"}]},{styleType:"accordion",heading:"Transform",items:[{type:"dropdown",label:"Origin",property:"transformOrigin"},{styleType:"multiple",label:"Scale",units:["-"],options:[{key:"scale",label:"All"},{key:"scaleX",label:"Left-Right"},{key:"scaleY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Skew",units:["deg"],options:[{key:"skewX",label:"Left-Right"},{key:"skewY",label:"Top-Bottom"}]},{styleType:"multiple",label:"Translate",negative:!0,options:[{key:"translateX",label:"Left-Right"},{key:"translateY",label:"Top-Bottom"}]},{type:"arbitrary",units:["deg"],negative:!0,label:"Rotate",property:"rotate"}]},{styleType:"accordion",heading:"Animation",items:[{type:"dropdown",label:"Animation",property:"animation"},{type:"dropdown",label:"Transition",property:"transition"},{type:"dropdown",label:"Easing",property:"transitionEase"},{type:"arbitrary",units:["ms"],label:"Duration",property:"duration"},{type:"arbitrary",units:["ms"],label:"Delay",property:"delay"}]}]},{heading:"Classes",items:[{component:ke}]}],ne={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:u.EyeOpenIcon,invisible:u.EyeClosedIcon,hidden:u.EyeClosedIcon,gap:u.BorderAllIcon,gapX:u.WidthIcon,gapY:u.HeightIcon,spaceX:u.WidthIcon,spaceY:u.HeightIcon,overscroll:u.BorderAllIcon,overscrollX:u.WidthIcon,overscrollY:u.HeightIcon,overflow:u.BorderAllIcon,overflowX:u.WidthIcon,overflowY:u.HeightIcon,top:u.ArrowUpIcon,right:u.ArrowRightIcon,bottom:u.ArrowDownIcon,left:u.ArrowLeftIcon,inset:u.BorderAllIcon,insetX:u.WidthIcon,insetY:u.HeightIcon,border:u.BorderAllIcon,borderX:u.WidthIcon,borderY:u.HeightIcon,borderTop:u.ArrowUpIcon,borderRight:u.ArrowRightIcon,borderBottom:u.ArrowDownIcon,borderLeft:u.ArrowLeftIcon,borderRadius:u.BorderAllIcon,borderRadiusX:u.WidthIcon,borderRadiusY:u.HeightIcon,borderRadiusTop:u.ArrowUpIcon,borderRadiusRight:u.ArrowRightIcon,borderRadiusBottom:u.ArrowDownIcon,borderRadiusLeft:u.ArrowLeftIcon,borderRadiusTopLeft:u.ArrowTopLeftIcon,borderRadiusTopRight:u.ArrowTopRightIcon,borderRadiusBottomRight:u.ArrowBottomRightIcon,borderRadiusBottomLeft:u.ArrowBottomLeftIcon,divideXWidth:u.WidthIcon,divideYWidth:u.HeightIcon,scale:u.BorderAllIcon,scaleX:u.WidthIcon,scaleY:u.HeightIcon,skewX:u.WidthIcon,skewY:u.HeightIcon,translateX:u.WidthIcon,translateY:u.HeightIcon,padding:u.BorderAllIcon,paddingX:u.WidthIcon,paddingY:u.HeightIcon,paddingTop:u.ArrowUpIcon,paddingRight:u.ArrowRightIcon,paddingBottom:u.ArrowDownIcon,paddingLeft:u.ArrowLeftIcon,margin:u.BorderAllIcon,marginX:u.WidthIcon,marginY:u.HeightIcon,marginTop:u.ArrowUpIcon,marginRight:u.ArrowRightIcon,marginBottom:u.ArrowDownIcon,marginLeft:u.ArrowLeftIcon,textLeft:u.AlignLeftIcon,textCenter:u.AlignCenterHorizontallyIcon,textRight:u.AlignRightIcon,textJustify:u.StretchHorizontallyIcon,italic:u.FontItalicIcon,underline:u.UnderlineIcon,overline:u.OverlineIcon,uppercase:u.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":u.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:u.Cross1Icon},O=c.createContext({canReset:!1,canChange:!0}),Ie=({children:r,canReset:n=!1,canChange:s=!0})=>e.jsxRuntimeExports.jsx(O.Provider,{value:{canReset:n,canChange:s},children:r}),le=({label:r,property:n,onChange:s})=>{const a=c.useMemo(()=>t.get($.CLASSES_LIST,`${n}.classes`,[""]),[n]),l=q(n),i=c.useMemo(()=>t.get(l,"cls",""),[l]),{canChange:d}=c.useContext(O),p=/\[.*\]/g.test(i);return e.jsxRuntimeExports.jsx("div",{className:r?"w-full rounded ":"grow",children:p?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(he.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:i}),e.jsxRuntimeExports.jsxs(w.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.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(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(z,{rounded:r,onChange:o=>s(o,n),selected:i,options:a,disabled:!d})})};function z({selected:r,onChange:n,rounded:s=!1,options:a,disabled:l=!1}){const i=r.replace(/.*:/g,"").trim(),{undo:d,redo:p}=R.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!a.length||l,className:`${s?"rounded-md border border-border":"border-0"} w-full disable:bg-gray-500 h-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,onChange:o=>n(o.target.value),onKeyDown:o=>{o.ctrlKey&&(o.key==="z"&&d(),o.key==="y"&&p())},value:i,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),c.Children.toArray(a.map(o=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:o,children:o})))]})}const Ae=({property:r,onChange:n})=>{const{canReset:s,canChange:a}=c.useContext(O),l=q(r),i=c.useMemo(()=>t.get(l,"cls",""),[l]),d=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),p=d.indexOf(i)>-1?d.indexOf(i):0,o=/\[.*\]/g.test(i);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:o?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:i}):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&&(!s||p-1<0),onClick:()=>n(t.nth(d,p-1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.MinusIcon,{className:!a&&(!s||p-1<0)?"text-gray-500":"text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(le,{label:!1,property:r,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&&(!s||p+1>=d.length),onClick:()=>n(t.nth(d,p+1),r),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{className:!a&&(!s||p+1>=d.length)?"text-gray-500":"text-white/60"})})})]})})},Be=({property:r,onChange:n})=>{const s=c.useMemo(()=>t.get($.CLASSES_LIST,`${r}.classes`,[""]),[r]),{canChange:a}=c.useContext(O),l=q(r),i=c.useMemo(()=>t.get(l,"cls",""),[l]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(s,d=>e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!a,onClick:()=>n(d,r),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${i===d?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:c.createElement(t.get(ne,d,u.BoxIcon))})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:t.startCase(t.toLower(d))})]}))})},He={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Ve=({property:r,onChange:n})=>{const s=q(r),a=c.useMemo(()=>t.get(s,"cls",""),[s]),{canChange:l}=c.useContext(O),[i,d]=c.useState([]),[p,o]=c.useState({color:"",shade:""}),x=a.split("-"),m=t.get(x,"1",""),y=t.get(x,"2",""),g=c.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(d([]),o({color:h})):(d(["50","100","200","300","400","500","600","700","800","900"]),o(v=>({...v,color:h,shade:v.shade?v.shade:"500"})))},[d,o]);c.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(m))return d([]);d(["50","100","200","300","400","500","600","700","800","900"])},[m]);const f=c.useCallback(h=>{o({color:m,shade:h})},[m]);return c.useEffect(()=>{o({color:"",shade:""})},[s]),c.useEffect(()=>{const v=`${t.get(He,r,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;v.match(new RegExp(t.get($.CLASSES_LIST,`${r}.regExp`,"")))&&n(v,r)},[p,n,r]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row divide-x divide-solid divide-border rounded-lg border border-border text-xs",children:[e.jsxRuntimeExports.jsx("div",{className:"grow text-center",children:e.jsxRuntimeExports.jsx(z,{disabled:!l,rounded:!0,selected:m,onChange:g,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(z,{rounded:!0,selected:y,disabled:!m||!l,onChange:f,options:i})})]})},ee=(r,n)=>{r=r.toLowerCase();let s=r.trim().replace(/ |\+/g,"");if((s==="auto"||s==="none")&&n.includes(s))return{value:"",unit:s};const a=n.length?new RegExp(n.join("|"),"g"):/XXXXXX/g;s=s.replace(a,"");const l=r.match(a),i=l&&l.length>1,d=!t.isEmpty(s)&&Number.isNaN(Number(s));return i||d?{error:"Invalid value"}:l&&(l[0]==="auto"||l[0]==="none")?{value:l[0],unit:""}:{value:s,unit:l?l[0]:""}},De=r=>{const n=r.startsWith("-")?"-":"",s=r.split("-").pop();if(["auto","none"].includes(s))return{value:"",unit:s};if(s==="px")return{value:"1",unit:"px"};if(s==="screen")return{value:"100",unit:r.indexOf("w-")!==-1?"vw":"vh"};if(s==="full")return{value:"100",unit:"%"};if(t.includes(r,"skew-"))return{value:`${n}${s}`,unit:"deg"};if(t.includes(r,"rotate-"))return{value:`${n}${s}`,unit:"deg"};if(t.includes(r,"opacity-"))return{value:`${s/100}`,unit:"-"};if(t.includes(r,"duration-")||t.includes(r,"delay-"))return{value:`${s}`,unit:"ms"};if(t.includes(r,"translate-")&&!s.includes("/"))return{value:`${n}${`${s/4}`}`,unit:"rem"};if(t.includes(r,"scale-"))return{value:`${n}${`${s/100}`}`,unit:"-"};if(t.startsWith(r,"border")){const a=r.match(/border-?(x|y|t|r|b|l)?\d+/g);if(a)return{value:a[0].split("-").pop(),unit:"px"};if(r.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(r,"max-w-")){if(r==="max-w-screen-sm")return{value:"640",unit:"px"};if(r==="max-w-screen-md")return{value:"768",unit:"px"};if(r==="max-w-screen-lg")return{value:"1024",unit:"px"};if(r==="max-w-screen-xl")return{value:"1280",unit:"px"};if(r==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(s==="xs")return{value:"320",unit:"px"};if(s==="sm")return{value:"384",unit:"px"};if(s==="md")return{value:"448",unit:"px"};if(s==="lg")return{value:"512",unit:"px"};if(s==="xl")return{value:"576",unit:"px"};if(s==="2xl")return{value:"672",unit:"px"};if(s==="3xl")return{value:"768",unit:"px"};if(s==="4xl")return{value:"896",unit:"px"};if(s==="5xl")return{value:"1024",unit:"px"};if(s==="6xl")return{value:"1152",unit:"px"};if(s==="7xl")return{value:"1280",unit:"px"};if(s==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(r,"text-")){if(s==="xs")return{value:"12",unit:"px"};if(s==="sm")return{value:"14",unit:"px"};if(s==="base")return{value:"16",unit:"px"};if(s==="lg")return{value:"18",unit:"px"};if(s==="xl")return{value:"20",unit:"px"};if(s==="2xl")return{value:"24",unit:"px"};if(s==="3xl")return{value:"30",unit:"px"};if(s==="4xl")return{value:"36",unit:"px"};if(s==="5xl")return{value:"48",unit:"px"};if(s==="6xl")return{value:"60",unit:"px"};if(s==="7xl")return{value:"72",unit:"px"};if(s==="8xl")return{value:"96",unit:"px"};if(s==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(r,"leading-")){if(s==="none")return{value:"1",unit:"-"};if(s==="tight")return{value:"1.25",unit:"-"};if(s==="snug")return{value:"1.375",unit:"-"};if(s==="normal")return{value:"1.5",unit:"-"};if(s==="relaxed")return{value:"1.625",unit:"-"};if(s==="loose")return{value:"2",unit:"-"}}if(t.startsWith(r,"tracking-")){if(s==="tighter")return{value:"-0.05",unit:"em"};if(s==="tight")return{value:"-0.025",unit:"em"};if(s==="normal")return{value:"0",unit:"em"};if(s==="wide")return{value:"0.025",unit:"em"};if(s==="wider")return{value:"0.05",unit:"em"};if(s==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(s))return{value:r,unit:"class"};if(s.includes("/")){const[a,l]=t.map(s.split("/"),i=>parseInt(i,10));return{value:n+(a/l*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(s))?{value:`${n+parseFloat(s)*4}`,unit:"px"}:{value:s,unit:"class"}},Le=r=>{if(t.isEmpty(r))return{value:"",unit:""};const n=r.match(/\[.*\]/g);if(n===null)return Pe(r);const s=t.get(n,"0","").replace(/\[|\]/g,""),a=r.startsWith("-")?"-":"",l=t.first(s.match(/\d+.\d+|\d+/g));return{value:`${a}${l}`,unit:s.replace(l,"")}},Pe=r=>t.isEmpty(r)?{value:"",unit:""}:De(r),ie=c.createContext({setDragData:()=>{}}),$e=({unit:r,currentValue:n,onDrag:s,onDragEnd:a,onDragStart:l,negative:i,cssProperty:d})=>{const{setDragData:p}=c.useContext(ie);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:o=>{const x={onDrag:s,onDragEnd:a,dragging:!0,dragStartY:o.pageY,dragStartValue:`${n}`,dragUnit:r,negative:i,cssProperty:d};l(x),p(x)},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(u.RowSpacingIcon,{})})},Me=({onSelect:r,current:n,units:s})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:s.map(a=>e.jsxRuntimeExports.jsx(w.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:l=>{l.stopPropagation(),r(a)},children:a},a))}),Oe=r=>{const[n,s]=c.useState(!1),[a,l]=c.useState(""),{currentClass:i,onChange:d,classPrefix:p,cssProperty:o,units:x,negative:m}=r,[y,g]=c.useState(o!=null&&o.toLowerCase().includes("width")?"%":x[0]),[f,h]=c.useState(!1),[v,H]=c.useState(""),[I,j]=c.useState(!1),[C,A]=c.useState(!1);c.useEffect(()=>{const{value:b,unit:E}=Le(i);if(E===""){l(b),g(o!=null&&o.toLowerCase().includes("width")?"%":x[0]);return}g(E),l(E==="class"||t.isEmpty(b)?"":b)},[i,o,x]);const S=Z.useThrottledCallback(b=>{d(b)},[d],200),V=Z.useThrottledCallback(b=>{d(b,!1)},[d],200),L=c.useCallback((b=!1)=>{const E=ee(`${a}`,x);if(t.get(E,"error",!1)){h(!0);return}const N=t.get(E,"unit")!==""?t.get(E,"unit"):y;if(N==="auto"||N==="none"){S(`${p}${N}`);return}if(t.get(E,"value")==="")return;const M=`${t.get(E,"value","").startsWith("-")?"-":""}${p}[${t.get(E,"value","").replace("-","")}${N==="-"?"":N}]`;b?V(M):S(M)},[S,V,a,y,p,x]),_=c.useCallback(b=>{const E=ee(`${a}`,x);if(t.get(E,"error",!1)){h(!0);return}if(b==="auto"||b==="none"){S(`${p}${b}`);return}if(t.get(E,"value")==="")return;const N=t.get(E,"unit")!==""?t.get(E,"unit"):b,M=`${t.get(E,"value","").startsWith("-")?"-":""}${p}[${t.get(E,"value","").replace("-","")}${N==="-"?"":N}]`;S(M)},[S,a,p,x]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:y==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:i}),e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.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(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${I?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(y)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:y==="class",onKeyPress:b=>{b.key==="Enter"&&L()},onKeyDown:b=>{if(b.keyCode!==38&&b.keyCode!==40)return;b.preventDefault(),A(!0);const E=t.parseInt(b.target.value);let N=t.isNaN(E)?0:E;b.keyCode===38&&(N+=1),b.keyCode===40&&(N-=1);const D=`${N}`,ue=`${D.startsWith("-")?"-":""}${p}[${D.replace("-","")}${y==="-"?"":y}]`;V(ue)},onKeyUp:b=>{C&&(b.preventDefault(),A(!1))},onBlur:()=>L(),onChange:b=>{h(!1),l(b.target.value)},onClick:b=>{var E;(E=b==null?void 0:b.target)==null||E.select(),s(!1)},value:I?v:a,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",f?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(w.Tooltip,{open:n,delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>s(!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 ${x.length===1?"px-2 font-semibold":""}`,children:y}),x.length>1?e.jsxRuntimeExports.jsx(u.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(w.TooltipPortal,{children:e.jsxRuntimeExports.jsx(w.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Me,{units:x,current:y,onSelect:b=>{s(!1),g(b),_(b)}})})})]})]}),["none","auto"].indexOf(y)!==-1||I?null:e.jsxRuntimeExports.jsx($e,{onDragStart:()=>j(!0),onDragEnd:b=>{if(H(()=>""),j(!1),t.isEmpty(b))return;const E=`${b}`,D=`${E.startsWith("-")?"-":""}${p}[${E.replace("-","")}${y==="-"?"":y}]`;S(D)},onDrag:b=>{if(t.isEmpty(b))return;H(b);const E=`${b}`,D=`${E.startsWith("-")?"-":""}${p}[${E.replace("-","")}${y==="-"?"":y}]`;V(D)},currentValue:a,unit:y,negative:m,cssProperty:o})]})})})},q=r=>{const n=R.useSelectedBlockCurrentClasses();return t.findLast(n,{property:r})},qe=(r,n)=>{const s={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return s[t.get(r,"mq","xs")]<=s[n]},_e={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"},We=r=>`${r.toUpperCase()} ${te[r]?`(${te[r]} & up)`:""}`,G=r=>{const{type:n="icons",label:s,property:a,onEmitChange:l=()=>{},units:i,negative:d=!1}=r,[p]=R.useDarkMode(),[o]=R.useStylingState(),[,x]=R.useCanvasWidth(),m=q(a),y=R.useAddClassesToBlocks(),g=R.useRemoveClassesFromBlocks(),[f]=R.useSelectedBlockIds(),h=c.useMemo(()=>t.get(m,"fullCls",""),[m]),v=c.useCallback((S,V=!0)=>{const L={dark:p,mq:x,mod:o,cls:S,property:a,fullCls:""};(p||o!=="")&&(L.mq="xs");const _=$.generateFullClsName(L);y(f,[_],V)},[f,p,x,o,a,y]),H=c.useCallback(()=>{g(f,[h])},[f,h,g]),I=c.useMemo(()=>qe(m,x),[m,x]);c.useEffect(()=>{l(I,m)},[I,l,m]);const[,,j]=R.useCanvasWidth(),C=c.useCallback(S=>{j({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[S])},[j]),A=t.get(m,"dark",null)===p&&t.get(m,"mod",null)===o&&t.get(m,"mq",null)===x;return e.jsxRuntimeExports.jsx(Ie,{canChange:I,canReset:m&&A,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] ${m&&!A?"text-foreground":""}`,children:s})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[n==="arbitrary"?e.jsxRuntimeExports.jsx(Oe,{currentClass:t.get(m,"cls",""),classPrefix:t.get(_e,a,""),units:i||[],onChange:v,negative:d,cssProperty:a}):null,n==="icons"&&e.jsxRuntimeExports.jsx(Be,{property:a,onChange:v}),n==="range"&&e.jsxRuntimeExports.jsx(Ae,{property:a,onChange:v}),n==="color"&&e.jsxRuntimeExports.jsx(Ve,{property:a,onChange:v}),n==="dropdown"&&e.jsxRuntimeExports.jsx(le,{label:s,property:a,onChange:v})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${h?"visible":"invisible"}`,children:A?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>H(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(u.TrashIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):I&&m?e.jsxRuntimeExports.jsxs(w.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.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(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:e.jsxRuntimeExports.jsx("div",{className:"text-right",children:e.jsxRuntimeExports.jsxs("div",{children:["Current style is set at ",e.jsxRuntimeExports.jsxs("span",{className:"font-bold ",children:[We(t.get(m,"mq")),p&&!m.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>C(t.get(m,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(m,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Fe=["px","%","em","rem","ch","vh","vw"],ae=({label:r,options:n,borderB:s=!1,borderT:a=!1,type:l="arbitrary",units:i=Fe,negative:d=!1})=>{const[p,o]=c.useState(n[0].key),x=R.useSelectedBlockCurrentClasses(),m=c.useCallback(y=>t.map(x,"property").includes(y),[x]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${s?"border-b":""} ${a?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[r&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:r}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:c.Children.toArray(n.map(({label:y,key:g})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>o(g),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${g===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[c.createElement("div",{className:m(g)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),c.createElement(t.get(ne,g,u.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:t.startCase(t.toLower(y))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(G,{type:l,units:[...i],label:"",property:p,negative:d})})]})},Ye=({heading:r,items:n})=>{const s=R.useSelectedBlockCurrentClasses(),a=c.useMemo(()=>{const l=p=>t.flatten(p.map(o=>o.styleType==="multiple"?t.map(o.options,"key"):o.property)),i=t.flatten(n.map(p=>p.styleType==="accordion"?l(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),d=t.map(s,"property");return t.intersection(i,d).length>0},[s,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,a?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${a?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:n.map(l=>l.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...l},l.label):e.jsxRuntimeExports.jsx(G,{...l},l.label))})]})},Xe=c.createContext({}),X=({section:r})=>{const n=R.useSelectedBlockCurrentClasses(),s=c.useCallback((i=[])=>{const d={};for(let o=0;o<n.length;o++)d[n[o].property]=n[o].cls;let p=!0;for(const o in i)if(!t.has(d,o)||d[o]!==i[o]){p=!1;break}return p},[n]),a=c.useMemo(()=>{if(n.length>0&&r.heading==="Classes")return!0;const i=o=>t.flatten(o.map(x=>x.styleType==="multiple"?t.flatten(t.map(x.options,"key")):x.property)),d=t.flatten(r.items.map(o=>o.styleType==="accordion"?i(o.items):o.styleType==="multiple"?t.flatten(t.map(o.options,"key")):o.property)),p=t.map(n,"property");return t.intersection(d,p).length>0},[n,r.heading,r.items]),l=c.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(Xe.Provider,{value:l,children:e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(T.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 ${a?"bg-blue-500":"bg-gray-300"}`}),r.heading]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:c.Children.toArray(r.items.map(i=>t.has(i,"component")?c.createElement(i.component,{key:i.label}):t.has(i,"styleType")?i.styleType==="multiple"?e.jsxRuntimeExports.jsx(ae,{...i},i.label):i.styleType==="accordion"&&s(i==null?void 0:i.conditions)?e.jsxRuntimeExports.jsx(Ye,{...i},i.label):null:e.jsxRuntimeExports.jsx(G,{...i},i.label)))})]})})},Ze=({item:r,index:n,canDelete:s,onChange:a,onRemove:l})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${s?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:i=>a(i,n),value:r.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:i=>t.isEmpty(r.key)?{}:a(i,n),value:r.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(u.TrashIcon,{onClick:l,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),ze=({section:r})=>{var g;const{setSyncState:n}=R.useSavePage(),s=R.useSelectedBlock(),[a,l]=c.useState([]),[i]=R.useSelectedStylingBlocks(),d=R.useUpdateBlocksPropsRealtime(),p=`${t.get(i,"0.prop")}_attrs`;F.useEffect(()=>{const f=t.map(t.get(s,p),(h,v)=>({key:v,value:h}));t.isEmpty(f)?l([]):l(f)},[t.get(s,p)]);const o=()=>l([...a,{key:"",value:""}]),x=f=>{const h=t.filter(a,(v,H)=>f!==H);y(h)},m=(f,h)=>{const v=[...a];v[h][f.target.name]=f.target.value,y(v)},y=F.useCallback((f=[])=>{const h={};t.forEach(f,v=>{t.isEmpty(v.key)||t.set(h,v.key,v.value)}),d([t.get(s,"_id")],{[p]:h}),n("UNSAVED")},[s,n,d,p]);return e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:r.heading,children:[e.jsxRuntimeExports.jsx(T.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(s,p))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx(T.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(U.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(a)&&t.isEmpty((g=t.last(a))==null?void 0:g.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 f;!t.isEmpty(a)&&t.isEmpty((f=t.last(a))==null?void 0:f.key)||o()},children:[e.jsxRuntimeExports.jsx(u.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(a)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),F.Children.toArray(t.map(a,(f,h)=>{const v=a.length>0&&h<a.length-1;return e.jsxRuntimeExports.jsx(Ze,{item:f,index:h,canDelete:v,onChange:m,onRemove:()=>x(h)})}))]})]})})]})};function Ue(){const[r,n]=R.useStylingState(),{flexChild:s,gridChild:a}=R.useSelectedBlocksDisplayChild(),[,l]=xe.useAtom(R.advanceStylingOpenAtom),{t:i}=se.useTranslation(),[d]=R.useSelectedStylingBlocks();return t.isEmpty(d)?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(u.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:i("no_styling_block_selected")}),e.jsxRuntimeExports.jsxs("p",{className:"text-xs ",children:["Hint: Styling allowed blocks are highlighted with"," ",e.jsxRuntimeExports.jsx("span",{className:"border border-orange-500 p-px",children:"orange"})," border"]})]})}):e.jsxRuntimeExports.jsxs("div",{onClick:()=>l(!1),className:"flex h-full flex-col",children:[e.jsxRuntimeExports.jsx("div",{className:"flex flex-col space-x-4 space-y-3 border-b border-border px-4 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-1.5",children:[e.jsxRuntimeExports.jsx(U.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(k.Select,{defaultValue:r,onValueChange:p=>n(p),children:[e.jsxRuntimeExports.jsx(k.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(k.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(k.SelectContent,{children:[e.jsxRuntimeExports.jsx(k.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(k.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(ye.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs(T.Accordion,{type:"multiple",className:"h-full w-full",children:[s&&e.jsxRuntimeExports.jsx(X,{section:Se}),a?e.jsxRuntimeExports.jsx(X,{section:Ne}):null,Te.map(p=>e.jsxRuntimeExports.jsx(X,{section:p},p.heading)),e.jsxRuntimeExports.jsx(ze,{section:{heading:"Attributes"}})]}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})}const Ge={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},Ke=()=>{const r=R.useSelectedBlock(),{t:n}=se.useTranslation(),[s,a]=c.useState(""),[l,i]=c.useState({onDrag:o=>o,onDragEnd:o=>o,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),d=Z.useThrottledCallback(o=>{const x=!t.get(l,"negative",!1),m=t.get(l,"cssProperty","");let y=parseFloat(l.dragStartValue);y=t.isNaN(y)?0:y;let g=Ge[l.dragUnit];(t.startsWith(m,"scale")||m==="opacity")&&(g=10);let h=(l.dragStartY-o.pageY)/g+y;x&&h<0&&(h=0),m==="opacity"&&h>1&&(h=1),l.onDrag(`${h}`),a(`${h}`)},[l],50),p=c.useCallback(()=>{setTimeout(()=>l.onDragEnd(`${s}`),100),i({onDrag:o=>o,onDragEnd:o=>o,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[l,s,i]);return t.isNull(r)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(u.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:n("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsxs(ie.Provider,{value:{setDragData:i},children:[l.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:d,onMouseUp:()=>p(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10 "}):null,e.jsxRuntimeExports.jsxs(P.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(P.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(P.TabsTrigger,{value:"settings",children:"Settings"}),e.jsxRuntimeExports.jsx(P.TabsTrigger,{value:"styling",children:"Styling"})]}),e.jsxRuntimeExports.jsx(P.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Ce,{})}),e.jsxRuntimeExports.jsx(P.TabsContent,{value:"styling",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(Ue,{})})]})]})};exports.default=Ke;
|