@chaibuilder/sdk 0.1.13 → 0.1.15

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.
Files changed (41) hide show
  1. package/dist/{AddBlocks-598b655e.js → AddBlocks-12b4bcb1.js} +1 -1
  2. package/dist/{AddBlocks-5df8b221.cjs → AddBlocks-e65160bb.cjs} +1 -1
  3. package/dist/{BrandingOptions-2795be29.cjs → BrandingOptions-2075324b.cjs} +1 -1
  4. package/dist/{BrandingOptions-0acb0974.js → BrandingOptions-d2e86bba.js} +1 -1
  5. package/dist/{CanvasArea-a637ef3a.cjs → CanvasArea-480c053b.cjs} +9 -9
  6. package/dist/{CanvasArea-73b0ec3b.js → CanvasArea-4a600b0b.js} +156 -150
  7. package/dist/CurrentPage-1f8e7c5f.cjs +1 -0
  8. package/dist/{CurrentPage-3a189b02.js → CurrentPage-9de40984.js} +19 -17
  9. package/dist/{Layers-42ba6c2e.js → Layers-048bdcbc.js} +2 -2
  10. package/dist/{Layers-7f3a2335.cjs → Layers-ab013224.cjs} +1 -1
  11. package/dist/{MarkAsGlobalBlock-3e708ff4.js → MarkAsGlobalBlock-0f52dce4.js} +1 -1
  12. package/dist/{MarkAsGlobalBlock-c18910cc.cjs → MarkAsGlobalBlock-1b607a7a.cjs} +1 -1
  13. package/dist/{PagesPanel-86323919.js → PagesPanel-caeb74c0.js} +2 -2
  14. package/dist/{PagesPanel-dfbcc68b.cjs → PagesPanel-f15d3d6d.cjs} +1 -1
  15. package/dist/{ProjectPanel-9f645945.js → ProjectPanel-774b3de7.js} +2 -2
  16. package/dist/{ProjectPanel-4be28a35.cjs → ProjectPanel-8b70ff96.cjs} +1 -1
  17. package/dist/{Settings-57f2a7c2.js → Settings-a12cec46.js} +1 -1
  18. package/dist/{Settings-99916fc1.cjs → Settings-a3eec331.cjs} +1 -1
  19. package/dist/{SidePanels-b0347e28.js → SidePanels-c4420954.js} +2 -2
  20. package/dist/{SidePanels-0e4ab159.cjs → SidePanels-c5482f7f.cjs} +1 -1
  21. package/dist/{Topbar-44c010e3.cjs → Topbar-13c64cdf.cjs} +1 -1
  22. package/dist/{Topbar-87c1c5b2.js → Topbar-d4b46465.js} +1 -1
  23. package/dist/{add-page-modal-b4e12262.cjs → add-page-modal-c169dc4b.cjs} +1 -1
  24. package/dist/{add-page-modal-71c100f9.js → add-page-modal-f8e5b874.js} +1 -1
  25. package/dist/core.cjs +1 -1
  26. package/dist/core.d.ts +3 -1
  27. package/dist/core.js +1 -1
  28. package/dist/{delete-page-modal-9dbe3038.js → delete-page-modal-52feec39.js} +1 -1
  29. package/dist/{delete-page-modal-fe71e66d.cjs → delete-page-modal-cce082dc.cjs} +1 -1
  30. package/dist/{index-0d399aef.js → index-14e86fe3.js} +6 -6
  31. package/dist/{index-d4a18b5d.cjs → index-659e552b.cjs} +2 -2
  32. package/dist/{page-viewer-8a0cd017.js → page-viewer-3b6eb2d0.js} +2 -2
  33. package/dist/{page-viewer-eec3bdfb.cjs → page-viewer-7042768e.cjs} +1 -1
  34. package/dist/{project-general-setting-12172508.cjs → project-general-setting-4e840310.cjs} +1 -1
  35. package/dist/{project-general-setting-155bc3fc.js → project-general-setting-d72ae135.js} +1 -1
  36. package/dist/render.cjs +2 -2
  37. package/dist/render.js +3 -1
  38. package/dist/{single-page-detail-1b3195d1.cjs → single-page-detail-6632db9b.cjs} +1 -1
  39. package/dist/{single-page-detail-fb0fe01b.js → single-page-detail-a151a222.js} +2 -2
  40. package/package.json +1 -1
  41. package/dist/CurrentPage-77baf305.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("./select-0e32300c.cjs"),t=require("lodash"),j=require("sonner"),l=require("react"),n=require("./index-659e552b.cjs");require("react-i18next");const q=require("lucide-react");require("@radix-ui/react-icons");require("@radix-ui/react-select");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");const p=()=>{const{data:s}=n.useProject(),{data:u,isLoading:x}=n.usePages(),{syncState:d}=n.useSavePage(),m=n.useChangePage(),[a,o]=n.useCurrentPage(),c=t.sortBy(t.filter(u,{type:"STATIC"}),r=>t.get(r,"uuid")===(s==null?void 0:s.homepage)?0:1);l.useEffect(()=>{!t.isEmpty(u)&&s.homepage&&!t.find(u,{uuid:a})&&o(s.homepage)},[a,u,s,o]),l.useEffect(()=>()=>o(null),[o]);const g=r=>{if(d!=="SAVED")j.toast.error("You have unsaved changes. Please save before changing the page.");else{const h=t.find(c,{uuid:r});m(h)}};return x||t.isEmpty(a)?null:e.jsxRuntimeExports.jsx("nav",{className:"flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800","aria-label":"Breadcrumb",children:e.jsxRuntimeExports.jsxs("ol",{className:"inline-flex items-center space-x-1 md:space-x-3",children:[e.jsxRuntimeExports.jsx("li",{className:"inline-flex items-center",children:e.jsxRuntimeExports.jsxs("div",{className:"inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400",children:[e.jsxRuntimeExports.jsx(q.BriefcaseIcon,{className:"w-4 h-4 mr-2"}),t.capitalize(s.name)]})}),e.jsxRuntimeExports.jsx("li",{"aria-current":"page",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("svg",{className:"mx-1 h-3 w-3 text-gray-400","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10",children:e.jsxRuntimeExports.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 9 4-4-4-4"})}),e.jsxRuntimeExports.jsxs(i.Select,{value:a||"",onValueChange:g,children:[e.jsxRuntimeExports.jsx(i.SelectTrigger,{className:"h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400",children:e.jsxRuntimeExports.jsx(i.SelectValue,{placeholder:"Page"})}),e.jsxRuntimeExports.jsx(i.SelectContent,{children:t.map(c,r=>e.jsxRuntimeExports.jsx(i.SelectItem,{value:r.uuid,children:r==null?void 0:r.name},r.uuid))})]})]})})]})})};exports.default=p;
@@ -1,9 +1,9 @@
1
1
  import { j as e } from "./jsx-runtime-944c88e2.js";
2
- import { S as u, c as p, b as g, d as x, f as h } from "./select-7fddd7c3.js";
3
- import { sortBy as f, filter as j, get as y, isEmpty as P, capitalize as v, map as b, find as S } from "lodash";
4
- import { toast as w } from "sonner";
5
- import { useEffect as C } from "react";
6
- import { O as N, N as k, u as B, Q as E, R as I } from "./index-0d399aef.js";
2
+ import { S as x, c as h, b as f, d as j, f as y } from "./select-7fddd7c3.js";
3
+ import { sortBy as P, filter as v, get as b, isEmpty as n, find as m, capitalize as S, map as w } from "lodash";
4
+ import { toast as C } from "sonner";
5
+ import { useEffect as l } from "react";
6
+ import { O as N, N as k, u as B, Q as E, R as I } from "./index-14e86fe3.js";
7
7
  import "react-i18next";
8
8
  import { BriefcaseIcon as L } from "lucide-react";
9
9
  import "@radix-ui/react-icons";
@@ -30,17 +30,19 @@ import "redux-undo";
30
30
  import "@react-hookz/web";
31
31
  import "@chaibuilder/blocks";
32
32
  const le = () => {
33
- const { data: t } = N(), { data: o, isLoading: n } = k(), { syncState: m } = B(), l = E(), [a, s] = I(), i = f(j(o, { type: "STATIC" }), (r) => y(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
34
- C(() => () => s(null), [s]);
35
- const c = (r) => {
36
- if (m !== "SAVED")
37
- w.error("You have unsaved changes. Please save before changing the page.");
33
+ const { data: t } = N(), { data: a, isLoading: c } = k(), { syncState: d } = B(), u = E(), [s, i] = I(), o = P(v(a, { type: "STATIC" }), (r) => b(r, "uuid") === (t == null ? void 0 : t.homepage) ? 0 : 1);
34
+ l(() => {
35
+ !n(a) && t.homepage && !m(a, { uuid: s }) && i(t.homepage);
36
+ }, [s, a, t, i]), l(() => () => i(null), [i]);
37
+ const p = (r) => {
38
+ if (d !== "SAVED")
39
+ C.error("You have unsaved changes. Please save before changing the page.");
38
40
  else {
39
- const d = S(i, { uuid: r });
40
- l(d);
41
+ const g = m(o, { uuid: r });
42
+ u(g);
41
43
  }
42
44
  };
43
- return n || P(a) ? null : /* @__PURE__ */ e.jsx(
45
+ return c || n(s) ? null : /* @__PURE__ */ e.jsx(
44
46
  "nav",
45
47
  {
46
48
  className: "flex rounded-lg border border-gray-200 bg-gray-50 px-3 pr-0 py-1 text-gray-700 dark:border-gray-700 dark:bg-gray-800",
@@ -48,7 +50,7 @@ const le = () => {
48
50
  children: /* @__PURE__ */ e.jsxs("ol", { className: "inline-flex items-center space-x-1 md:space-x-3", children: [
49
51
  /* @__PURE__ */ e.jsx("li", { className: "inline-flex items-center", children: /* @__PURE__ */ e.jsxs("div", { className: "inline-flex items-center text-sm font-medium text-gray-500 dark:text-gray-400", children: [
50
52
  /* @__PURE__ */ e.jsx(L, { className: "w-4 h-4 mr-2" }),
51
- v(t.name)
53
+ S(t.name)
52
54
  ] }) }),
53
55
  /* @__PURE__ */ e.jsx("li", { "aria-current": "page", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
54
56
  /* @__PURE__ */ e.jsx(
@@ -71,9 +73,9 @@ const le = () => {
71
73
  )
72
74
  }
73
75
  ),
74
- /* @__PURE__ */ e.jsxs(u, { value: a || "", onValueChange: c, children: [
75
- /* @__PURE__ */ e.jsx(p, { className: "h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400", children: /* @__PURE__ */ e.jsx(g, { placeholder: "Page" }) }),
76
- /* @__PURE__ */ e.jsx(x, { children: b(i, (r) => /* @__PURE__ */ e.jsx(h, { value: r.uuid, children: r == null ? void 0 : r.name }, r.uuid)) })
76
+ /* @__PURE__ */ e.jsxs(x, { value: s || "", onValueChange: p, children: [
77
+ /* @__PURE__ */ e.jsx(h, { className: "h-max border-0 py-0 text-sm font-medium text-gray-600 shadow-none outline-none ring-0 focus:ring-0 dark:text-gray-400", children: /* @__PURE__ */ e.jsx(f, { placeholder: "Page" }) }),
78
+ /* @__PURE__ */ e.jsx(j, { children: w(o, (r) => /* @__PURE__ */ e.jsx(y, { value: r.uuid, children: r == null ? void 0 : r.name }, r.uuid)) })
77
79
  ] })
78
80
  ] }) })
79
81
  ] })
@@ -4,7 +4,7 @@ import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHor
4
4
  import { useDrop as be, useDragLayer as ke } from "react-dnd";
5
5
  import { useDragOver as Be, Tree as ye } from "@minoru/react-dnd-treeview";
6
6
  import { useTranslation as Ce } from "react-i18next";
7
- import { x as ve, S as we, h as g, l as Se, o as Te, m as Ne, n as De, q as Me, A as Oe, T as Re, y as Ee, g as Ae, i as _e, c as He, U as Pe, b as Le, V as Ve } from "./index-0d399aef.js";
7
+ import { x as ve, S as we, h as g, l as Se, o as Te, m as Ne, n as De, q as Me, A as Oe, T as Re, y as Ee, g as Ae, i as _e, c as He, U as Pe, b as Le, V as Ve } from "./index-14e86fe3.js";
8
8
  import { c as w } from "./utils-ac68b2c8.js";
9
9
  import { useMemo as Fe, lazy as ze, useState as Ge, Suspense as $e, useCallback as S } from "react";
10
10
  import { S as Ke } from "./MODIFIERS-c2e02614.js";
@@ -183,7 +183,7 @@ const es = (s) => {
183
183
  }, ns = (s) => {
184
184
  const t = s.depth * 10 + 16;
185
185
  return /* @__PURE__ */ e.jsx("div", { className: "absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500", style: { left: t } });
186
- }, os = ze(() => import("./MarkAsGlobalBlock-3e708ff4.js")), rs = () => {
186
+ }, os = ze(() => import("./MarkAsGlobalBlock-0f52dce4.js")), rs = () => {
187
187
  const [s] = g(), [, t] = Ne();
188
188
  return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => t(s), children: [
189
189
  /* @__PURE__ */ e.jsx(ge, {}),
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),_=require("react-i18next"),x=require("./index-d4a18b5d.cjs"),v=require("./utils-3c452dd0.cjs"),m=require("react"),P=require("./MODIFIERS-70fef873.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),S=require("./useBuilderProp-5e57d0c8.cjs"),H=require("./scroll-area-088530b9.cjs"),L=require("jotai");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");const w=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function F(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const V=s=>{let n="";return Object.keys(s).forEach(r=>{a.startsWith(s[r],P.STYLES_KEY)&&(n=s[r])}),n},z=s=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=s,{id:i,data:l}=s.node,d=s.depth*10,j=p=>{p.stopPropagation(),s.onToggle(s.node.id)},I=y.useDragOver(i,s.isOpen,s.onToggle),g=m.useMemo(()=>{const p=V(s.node.data);return F(p)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&s.onSelect(i)},onContextMenu:()=>s.onSelect(i),style:{paddingInlineStart:d},...I,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(w,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=s.node.data)==null?void 0:R._name)||s.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},G=s=>{var r;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(w,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},$=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},K=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-c18910cc.cjs"))),Q=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},U=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Y=()=>{const[s]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},W=({id:s=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=S.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Y,{})]})},J=({children:s,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(K,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(W,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},X=()=>{const{addCoreBlock:s}=x.useAddBlock(),n=S.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return s({blocks:d},i===0?null:i,l)}return s(c,i===0?null:i,l)},[s])};function Z(s){return a.map(s,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const ee=()=>{const s=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=_.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=X(),[,R]=L.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:f,dropTargetId:N,monitor:O}=E,A=Z(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:f}),R(!1))},q=a.map(s,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(s,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=B.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:[e.jsxRuntimeExports.jsx("div",{className:"mx-1 h-10 rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Tree view"})}),a.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(H.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:q,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(J,{id:o.id,children:e.jsxRuntimeExports.jsx(z,{onSelect:f=>{l([]),c([f])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(G,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx($,{node:o,depth:E})})})]})})};exports.default=ee;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),a=require("lodash"),t=require("@radix-ui/react-icons"),B=require("react-dnd"),y=require("@minoru/react-dnd-treeview"),_=require("react-i18next"),x=require("./index-659e552b.cjs"),v=require("./utils-3c452dd0.cjs"),m=require("react"),P=require("./MODIFIERS-70fef873.cjs"),C=require("./dialog-170eaad9.cjs"),u=require("./context-menu-fec580f2.cjs"),S=require("./useBuilderProp-5e57d0c8.cjs"),H=require("./scroll-area-088530b9.cjs"),L=require("jotai");require("i18next");require("flagged");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");require("clsx");require("tailwind-merge");require("@radix-ui/react-dialog");require("@radix-ui/react-context-menu");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-scroll-area");const w=s=>{switch(s.type){case"Image":return e.jsxRuntimeExports.jsx(t.ImageIcon,{});case"Heading":return e.jsxRuntimeExports.jsx(t.HeadingIcon,{});case"Text":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Link":return e.jsxRuntimeExports.jsx(t.Link1Icon,{});case"Video":return e.jsxRuntimeExports.jsx(t.VideoIcon,{});case"RichText":return e.jsxRuntimeExports.jsx(t.CursorTextIcon,{});case"Button":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"CustomHTML":return e.jsxRuntimeExports.jsx(t.CodeIcon,{});case"Divider":return e.jsxRuntimeExports.jsx(t.DividerHorizontalIcon,{});case"Icon":return e.jsxRuntimeExports.jsx(t.SketchLogoIcon,{});case"List":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"Paragraph":return e.jsxRuntimeExports.jsx(t.TextIcon,{});case"Row":return e.jsxRuntimeExports.jsx(t.RowsIcon,{});case"ListItem":return e.jsxRuntimeExports.jsx(t.ColumnsIcon,{});case"LineBreak":return e.jsxRuntimeExports.jsx(t.SpaceBetweenVerticallyIcon,{});case"Form":return e.jsxRuntimeExports.jsx(t.GroupIcon,{});case"Checkbox":return e.jsxRuntimeExports.jsx(t.CheckboxIcon,{});case"FormButton":return e.jsxRuntimeExports.jsx(t.ButtonIcon,{});case"Input":case"TextArea":return e.jsxRuntimeExports.jsx(t.InputIcon,{});case"Radio":return e.jsxRuntimeExports.jsx(t.RadiobuttonIcon,{});case"Select":return e.jsxRuntimeExports.jsx(t.DropdownMenuIcon,{});case"Table":return e.jsxRuntimeExports.jsx(t.TableIcon,{});case"TableHead":return e.jsxRuntimeExports.jsx(t.BorderTopIcon,{});case"TableBody":return e.jsxRuntimeExports.jsx(t.BorderAllIcon,{});case"TableRow":return e.jsxRuntimeExports.jsx(t.ViewHorizontalIcon,{});case"TableCell":return e.jsxRuntimeExports.jsx(t.DragHandleHorizontalIcon,{});case"Box":return e.jsxRuntimeExports.jsx(t.BoxIcon,{});default:return e.jsxRuntimeExports.jsx(t.BoxModelIcon,{})}};function F(s=""){const n={xs:"390px",sm:"640px",md:"768px",lg:"1024px",xl:"1366px","2xl":"1536px"};if(new RegExp(/\bsr-only\b/).test(s))return"Sr Only";if(new RegExp(/\b(sm|md|lg|xl|2xl):hidden\b/).test(s))return"Visible on mobile";if(s.match(/(^| )hidden( |$)/g)){const i=new RegExp(/\b(sm|md|lg|xl|2xl):(block|grid|flex|inline|inline-grid|inline-flex|inline-block)\b/),l=s.match(i);if(a.nth(l,1))return`Visible >=${n[a.nth(l,1)]}`}return""}const V=s=>{let n="";return Object.keys(s).forEach(r=>{a.startsWith(s[r],P.STYLES_KEY)&&(n=s[r])}),n},z=s=>{var R;const[,n]=x.useHighlightBlockId(),[r]=x.useHiddenBlockIds(),{isSelected:c}=s,{id:i,data:l}=s.node,d=s.depth*10,j=p=>{p.stopPropagation(),s.onToggle(s.node.id)},I=y.useDragOver(i,s.isOpen,s.onToggle),g=m.useMemo(()=>{const p=V(s.node.data);return F(p)},[s.node.data]);return e.jsxRuntimeExports.jsx("div",{onMouseEnter:()=>n(i),className:v.cn("group flex w-full items-center justify-between space-x-px py-px ",c?"bg-blue-500 text-white":"hover:bg-gray-200 dark:hover:bg-gray-800"),onClick:p=>{p.stopPropagation(),!r.includes(i)&&s.onSelect(i)},onContextMenu:()=>s.onSelect(i),style:{paddingInlineStart:d},...I,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${s.isOpen?"rotate-90":""}`,children:s.node.droppable&&e.jsxRuntimeExports.jsx("button",{onClick:j,type:"button",children:e.jsxRuntimeExports.jsx(t.TriangleRightIcon,{})})}),e.jsxRuntimeExports.jsxs("button",{type:"button",className:"flex items-center",children:[e.jsxRuntimeExports.jsx("div",{className:"-mt-1 h-3 w-3",children:e.jsxRuntimeExports.jsx(w,{type:l==null?void 0:l._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:((R=s.node.data)==null?void 0:R._name)||s.node.text}),g?e.jsxRuntimeExports.jsxs("span",{className:"ml-2 flex items-center text-[10px] italic "+(c?"text-gray-200":"text-gray-500"),children:["(",g,")"]}):null]})]})})},G=s=>{var r;const{item:n}=s.monitorProps;return e.jsxRuntimeExports.jsxs("div",{className:"flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsx(w,{type:(r=n==null?void 0:n.data)==null?void 0:r._type})}),e.jsxRuntimeExports.jsx("div",{className:"ml-2 truncate text-[11px]",children:n.text})]})},$=s=>{const n=s.depth*10+16;return e.jsxRuntimeExports.jsx("div",{className:"absolute right-0 top-0 h-0.5 -translate-y-1/2 transform bg-green-500",style:{left:n}})},K=m.lazy(()=>Promise.resolve().then(()=>require("./MarkAsGlobalBlock-1b607a7a.cjs"))),Q=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCutBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ScissorsIcon,{})," Cut"]})},U=()=>{const[s]=x.useSelectedBlockIds(),[,n]=x.useCopyBlockIds();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.ClipboardIcon,{})," Copy"]})},Y=()=>{const[s]=x.useSelectedBlockIds(),n=x.useRemoveBlocks(),r=x.useSelectedBlock();return e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{disabled:(r==null?void 0:r._type)==="Slot",className:"flex items-center gap-x-4 text-xs",onClick:()=>n(s),children:[e.jsxRuntimeExports.jsx(t.TrashIcon,{})," Remove"]})},W=({id:s=null,openMarkAsGlobalModal:n})=>{const[r]=x.useSelectedBlockIds(),c=x.useDuplicateBlocks(),{pasteBlocks:i,canPaste:l}=x.usePasteBlocks(),d=S.useBuilderProp("globalBlocksSupport",!1),j=m.useCallback(()=>{c(r)},[r,c]);return e.jsxRuntimeExports.jsxs(u.ContextMenuContent,{className:"text-xs",children:[d&&e.jsxRuntimeExports.jsx(u.ContextMenuItem,{className:"flex items-center gap-x-4 border-b text-xs",onClick:n,children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-4",children:[e.jsxRuntimeExports.jsx(t.GlobeIcon,{})," Mark as global"]})}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:j,children:[e.jsxRuntimeExports.jsx(t.CopyIcon,{})," Duplicate"]}),e.jsxRuntimeExports.jsx(Q,{}),e.jsxRuntimeExports.jsx(U,{}),e.jsxRuntimeExports.jsxs(u.ContextMenuItem,{className:"flex items-center gap-x-4 text-xs",onClick:()=>i(s),disabled:!l,children:[e.jsxRuntimeExports.jsx(t.ClipboardCopyIcon,{})," Paste"]}),e.jsxRuntimeExports.jsx(Y,{})]})},J=({children:s,id:n=null})=>{const[r,c]=m.useState(!1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(C.Dialog,{open:r,onOpenChange:c,children:r&&e.jsxRuntimeExports.jsx(C.DialogContent,{children:e.jsxRuntimeExports.jsx(m.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"h-96 w-full animate-pulse bg-gray-200"}),children:e.jsxRuntimeExports.jsx(K,{closeModal:()=>c(!1),id:n})})})}),e.jsxRuntimeExports.jsxs(u.ContextMenu,{children:[e.jsxRuntimeExports.jsx(u.ContextMenuTrigger,{children:s}),e.jsxRuntimeExports.jsx(W,{id:n,openMarkAsGlobalModal:()=>c(!0)})]})]})},X=()=>{const{addCoreBlock:s}=x.useAddBlock(),n=S.useBuilderProp("getExternalPredefinedBlock");return m.useCallback(async r=>{const{block:c,dropTargetId:i,relativeIndex:l}=r;if(a.has(c,"format")){const d=await n(c);return s({blocks:d},i===0?null:i,l)}return s(c,i===0?null:i,l)},[s])};function Z(s){return a.map(s,n=>{const{data:r}=n;return{...r,_parent:n.parent===0?null:n.parent}})}const ee=()=>{const s=x.useAllBlocks(),[n]=x.useSetAllBlocks(),[r,c,i]=x.useSelectedBlockIds(),[,l]=x.useSelectedStylingBlocks(),{t:d}=_.useTranslation(),{createSnapshot:j}=x.useCanvasHistory(),I=x.useExpandedIds(),g=X(),[,R]=L.useAtom(x.addBlocksModalAtom),p=async(o,E)=>{const{dragSource:b,destinationIndex:k,relativeIndex:f,dropTargetId:N,monitor:O}=E,A=Z(o);n(A),b?j():(await g({block:O.getItem(),dropTargetId:N,destinationIndex:k,relativeIndex:f}),R(!1))},q=a.map(s,o=>({id:o._id,text:o._type,parent:o._parent||0,droppable:!a.isUndefined(a.find(s,{_parent:o._id})),data:o})),T=()=>{c([]),l([])},[{isOver:h},M]=B.useDrop(()=>({accept:["CHAI_BLOCK"],collect:o=>({canDrop:o.canDrop(),isOver:o.isOver()}),drop:o=>{(async()=>(await g({block:o,dropTargetId:"",destinationIndex:0,relativeIndex:0}),R(!1)))()}})),{isDragging:D}=B.useDragLayer(o=>({isDragging:o.isDragging()}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",{onClick:()=>T(),className:v.cn("-mx-1 -mt-1 flex h-full select-none flex-col space-y-1",D?"bg-green-50/80":"bg-background"),children:[e.jsxRuntimeExports.jsx("div",{className:"mx-1 h-10 rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Tree view"})}),a.isEmpty(s)?e.jsxRuntimeExports.jsxs("div",{ref:M,className:`mx-1 mt-4 h-full p-6 text-center text-sm text-gray-400 ${h?"bg-blue-200":""}`,children:[h?e.jsxRuntimeExports.jsx(t.DoubleArrowDownIcon,{className:"mx-auto h-12 w-12 animate-bounce"}):e.jsxRuntimeExports.jsx(t.StackIcon,{className:"mx-auto h-10 w-10"}),e.jsxRuntimeExports.jsx("p",{className:"mt-2",children:d(h?"drop_here_message":"tree_view_no_blocks")})]}):e.jsxRuntimeExports.jsx(H.ScrollArea,{id:"layers-view",className:"no-scrollbar h-full overflow-y-auto p-1",children:e.jsxRuntimeExports.jsx(y.Tree,{initialOpen:I,extraAcceptTypes:["CHAI_BLOCK"],tree:q,rootId:0,render:(o,{depth:E,isOpen:b,onToggle:k})=>e.jsxRuntimeExports.jsx(J,{id:o.id,children:e.jsxRuntimeExports.jsx(z,{onSelect:f=>{l([]),c([f])},isSelected:a.includes(r,o.id),node:o,depth:E,isOpen:b,onToggle:k,toggleIds:i})}),dragPreviewRender:o=>e.jsxRuntimeExports.jsx(G,{monitorProps:o}),onDrop:p,classes:{root:"h-full pt-2",draggingSource:"opacity-30",dropTarget:"bg-green-100",placeholder:"relative"},sort:!1,insertDroppableFirst:!1,canDrop:x.canDropBlock,dropTargetOffset:2,enableAnimateExpand:!0,placeholderRender:(o,{depth:E})=>e.jsxRuntimeExports.jsx($,{node:o,depth:E})})})]})})};exports.default=ee;
@@ -2,7 +2,7 @@ import { j as l } from "./jsx-runtime-944c88e2.js";
2
2
  import { GlobeIcon as m } from "@radix-ui/react-icons";
3
3
  import { useState as n } from "react";
4
4
  import { B as i } from "./useBuilderProp-81a14920.js";
5
- import { _ as c } from "./index-0d399aef.js";
5
+ import { _ as c } from "./index-14e86fe3.js";
6
6
  import "react-i18next";
7
7
  import { capitalize as p } from "lodash";
8
8
  import "@radix-ui/react-slot";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),u=require("react"),i=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-d4a18b5d.cjs");require("react-i18next");const x=require("lodash");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const m=({id:t=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=u.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(o.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:n=>a(n.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>{l(t,x.capitalize(r)),s()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(i.Button,{variant:"outline",onClick:s,children:"Cancel"})]})]})};exports.default=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),o=require("@radix-ui/react-icons"),u=require("react"),i=require("./useBuilderProp-5e57d0c8.cjs"),c=require("./index-659e552b.cjs");require("react-i18next");const x=require("lodash");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const m=({id:t=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=u.useState("");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("h1",{className:"text-lg font-bold",children:"Mark as Global"}),e.jsxRuntimeExports.jsxs("div",{className:"py-2 text-sm",children:["Note: Global blocks are single instances. Editing global blocks will be reflected on all pages using these blocks. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("ul",{className:"mt-4 list-inside list-disc space-y-1",children:[e.jsxRuntimeExports.jsxs("li",{children:["Global blocks are indicated with ",e.jsxRuntimeExports.jsx(o.GlobeIcon,{className:"inline"})," icon in left sidebar"]}),e.jsxRuntimeExports.jsx("li",{children:'Global blocks are available under "Global" category'})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"my-4",children:[e.jsxRuntimeExports.jsx("label",{className:"block text-sm font-medium text-gray-400",children:"Enter global block name"}),e.jsxRuntimeExports.jsx("input",{placeholder:"Eg: Header, Footer ",className:"mt-2 w-full",value:r,onChange:n=>a(n.target.value)})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-4",children:[e.jsxRuntimeExports.jsx(i.Button,{onClick:()=>{l(t,x.capitalize(r)),s()},disabled:r.length<=2,variant:"default",children:"Mark as Global"}),e.jsxRuntimeExports.jsx(i.Button,{variant:"outline",onClick:s,children:"Cancel"})]})]})};exports.default=m;
@@ -1,7 +1,7 @@
1
1
  import { j as t } from "./jsx-runtime-944c88e2.js";
2
2
  import e, { Suspense as p } from "react";
3
3
  import { sortBy as a, filter as d, get as n } from "lodash";
4
- import { N as l, O as c } from "./index-0d399aef.js";
4
+ import { N as l, O as c } from "./index-14e86fe3.js";
5
5
  import "i18next";
6
6
  import "react-i18next";
7
7
  import "flagged";
@@ -27,7 +27,7 @@ import "@react-hookz/web";
27
27
  import "@chaibuilder/blocks";
28
28
  import "lucide-react";
29
29
  import "sonner";
30
- const x = e.lazy(() => import("./add-page-modal-71c100f9.js")), g = e.lazy(() => import("./page-viewer-8a0cd017.js")), H = () => {
30
+ const x = e.lazy(() => import("./add-page-modal-f8e5b874.js")), g = e.lazy(() => import("./page-viewer-3b6eb2d0.js")), H = () => {
31
31
  const { data: i = [], isLoading: o } = l(), { data: r } = c(), m = a(d(i, { type: "STATIC" }), (s) => n(s, "uuid") === (r == null ? void 0 : r.homepage) ? 0 : 1);
32
32
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
33
33
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),s=require("lodash"),t=require("./index-d4a18b5d.cjs");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const x=i.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-b4e12262.cjs"))),q=i.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-eec3bdfb.cjs"))),c=()=>{const{data:u=[],isLoading:n}=t.usePages(),{data:r}=t.useProject(),o=s.sortBy(s.filter(u,{type:"STATIC"}),a=>s.get(a,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(x,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(q,{isLoading:n,pages:o})})]})};exports.default=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),s=require("lodash"),t=require("./index-659e552b.cjs");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const x=i.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-c169dc4b.cjs"))),q=i.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-7042768e.cjs"))),c=()=>{const{data:u=[],isLoading:n}=t.usePages(),{data:r}=t.useProject(),o=s.sortBy(s.filter(u,{type:"STATIC"}),a=>s.get(a,"uuid")===(r==null?void 0:r.homepage)?0:1);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Pages"}),e.jsxRuntimeExports.jsx(i.Suspense,{fallback:e.jsxRuntimeExports.jsx("div",{className:"text-sm text-blue-500 underline",children:"+ New Page"}),children:e.jsxRuntimeExports.jsx(x,{})})]}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1 divide-y-2",children:e.jsxRuntimeExports.jsx(q,{isLoading:n,pages:o})})]})};exports.default=c;
@@ -2,7 +2,7 @@ import { j as e } from "./jsx-runtime-944c88e2.js";
2
2
  import i, { useRef as x, useEffect as m, Suspense as n } from "react";
3
3
  import { isEqual as j, isEmpty as b } from "lodash";
4
4
  import { A as f, a as l, b as c, c as d } from "./accordion-c0176dc5.js";
5
- import { P as h, O as g } from "./index-0d399aef.js";
5
+ import { P as h, O as g } from "./index-14e86fe3.js";
6
6
  import "@radix-ui/react-accordion";
7
7
  import "@radix-ui/react-icons";
8
8
  import "./utils-ac68b2c8.js";
@@ -29,7 +29,7 @@ import "@react-hookz/web";
29
29
  import "@chaibuilder/blocks";
30
30
  import "lucide-react";
31
31
  import "sonner";
32
- const N = i.lazy(() => import("./project-general-setting-155bc3fc.js")), S = i.lazy(() => import("./project-seo-setting-e9587467.js")), p = /* @__PURE__ */ e.jsx("div", { className: "px-3", children: /* @__PURE__ */ e.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (t) => t && b(t.seoData) ? {
32
+ const N = i.lazy(() => import("./project-general-setting-d72ae135.js")), S = i.lazy(() => import("./project-seo-setting-e9587467.js")), p = /* @__PURE__ */ e.jsx("div", { className: "px-3", children: /* @__PURE__ */ e.jsx("div", { className: "h-52 w-full animate-pulse rounded-md bg-gray-100" }) }), u = (t) => t && b(t.seoData) ? {
33
33
  ...t,
34
34
  seoData: { title: "", description: "", image: "" }
35
35
  } : t;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),r=require("react"),x=require("lodash"),s=require("./accordion-0afd8143.cjs"),a=require("./index-d4a18b5d.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-12172508.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-3f645a02.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function j(){const t=a.useUpdateProject(),{data:o}=a.useProject(),[i,u]=r.useState(l(o||{})),n=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(o,n.current)||t.mutate(n.current,{onSuccess:()=>u(n.current)})},[n]),r.useEffect(()=>{n.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:u})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:u})})})]})]})})]})}exports.default=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),r=require("react"),x=require("lodash"),s=require("./accordion-0afd8143.cjs"),a=require("./index-659e552b.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-5e57d0c8.cjs");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-78bfa1f3.cjs");require("./MODIFIERS-70fef873.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("lucide-react");require("sonner");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-4e840310.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-3f645a02.cjs"))),c=e.jsxRuntimeExports.jsx("div",{className:"px-3",children:e.jsxRuntimeExports.jsx("div",{className:"h-52 w-full animate-pulse rounded-md bg-gray-100"})}),l=t=>t&&x.isEmpty(t.seoData)?{...t,seoData:{title:"",description:"",image:""}}:t;function j(){const t=a.useUpdateProject(),{data:o}=a.useProject(),[i,u]=r.useState(l(o||{})),n=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(o,n.current)||t.mutate(n.current,{onSuccess:()=>u(n.current)})},[n]),r.useEffect(()=>{n.current=i},[i]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-between rounded-md bg-background/30 p-1",children:e.jsxRuntimeExports.jsx("h1",{className:"px-1 font-semibold",children:"Website Settings"})}),e.jsxRuntimeExports.jsx("hr",{className:"-mx-1"}),e.jsxRuntimeExports.jsx("div",{className:"-mx-1",children:e.jsxRuntimeExports.jsxs(s.Accordion,{type:"single",className:"w-full",defaultValue:"GENERAL",children:[e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"GENERAL",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"General Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-2 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(d,{_projectData:i,seany:u})})})]}),e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:"SEO",className:"border-b-2 border-slate-100 dark:border-slate-800",children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"bg-slate-200 px-2.5 py-1.5 font-medium hover:bg-slate-100 hover:no-underline dark:bg-slate-900 dark:hover:bg-slate-800",children:"SEO Settings"}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"px-1 pt-4 text-sm",children:e.jsxRuntimeExports.jsx(r.Suspense,{fallback:c,children:e.jsxRuntimeExports.jsx(m,{_projectData:i,seany:u})})})]})]})})]})}exports.default=j;
@@ -8,7 +8,7 @@ import { PlusIcon as pe, Cross2Icon as Ae, EyeOpenIcon as st, EyeClosedIcon as b
8
8
  import { T as Ct, a as jt, b as fe, c as ve } from "./tabs-85caa1e8.js";
9
9
  import kt from "@rjsf/core";
10
10
  import Nt from "@rjsf/validator-ajv8";
11
- import { A as oe, c as De, C as Me, D as St, F as Rt, G as Tt, i as ge, H as Oe, I as Ee, h as Pe, d as Vt, J as Fe, e as we, K as se, u as Ht, L as Bt, M as At } from "./index-0d399aef.js";
11
+ import { A as oe, c as De, C as Me, D as St, F as Rt, G as Tt, i as ge, H as Oe, I as Ee, h as Pe, d as Vt, J as Fe, e as we, K as se, u as Ht, L as Bt, M as At } from "./index-14e86fe3.js";
12
12
  import { getBlockComponent as $t } from "@chaibuilder/blocks";
13
13
  import { R as Lt, I as It, a as Dt, L as Mt } from "./link-6467eda6.js";
14
14
  import { useAtom as Ot } from "jotai";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),d=require("react"),_=require("@react-hookz/web"),r=require("lodash"),Q=require("react-i18next"),o=require("@radix-ui/react-icons"),M=require("./tabs-860e37aa.cjs"),ne=require("@rjsf/core"),le=require("@rjsf/validator-ajv8"),f=require("./index-d4a18b5d.cjs"),ie=require("@chaibuilder/blocks"),F=require("./link-4585b2d6.cjs"),ae=require("jotai"),ue=require("react-autosuggest"),pe=require("fuse.js"),D=require("./html-to-json-78bfa1f3.cjs"),w=require("./useBuilderProp-5e57d0c8.cjs"),U=require("./label-167415e5.cjs"),de=require("./MODIFIERS-70fef873.cjs"),ce=require("./input-42acea7e.cjs"),$=require("./accordion-0afd8143.cjs"),xe=require("./scroll-area-088530b9.cjs"),E=require("./select-0e32300c.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("lucide-react");require("sonner");require("react-icons-picker");require("react-dom");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("./ImagesPanel-68a11293.cjs");require("react-quill");require("himalaya");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-label");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-select");function me(s){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(l,t,n.get?n:{enumerable:!0,get:()=>s[t]})}}return l.default=s,Object.freeze(l)}const X=me(d);function ge(){const s=f.useSelectedBlock(),{createSnapshot:l}=f.useCanvasHistory(),t=f.useUpdateBlocksPropsRealtime(),[n]=f.useActiveLanguage(),i=ie.getBlockComponent(s._type),u=r.get(i,"props",{}),c={type:"object",properties:{_name:{title:"Name",type:"string",default:r.get(s,"_name",s._type)}}},p={};Object.keys(u).forEach(m=>{const j=u[m];if(r.includes(["slot","styles"],j.type))return;const b=r.get(j,"i18n",!1)?`${m}-${n}`:m;c.properties[b]=f.getBlockJSONFromSchemas(j,n),p[b]=f.getBlockJSONFromUISchemas(j,n)});const a={...s},h=({formData:m},j)=>{if(j){const b=j.replace("root.","");t([s._id],{[b]:r.get(m,b)})}},g=()=>{l()};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(ne,{widgets:{richtext:F.RichTextEditorField,icon:F.IconPickerField,image:F.ImagePickerField},fields:{link:F.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,uiSchema:p,onBlur:g,schema:c,formData:a,validator:le,onChange:h}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const G=new pe(D.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function he(){var N;const[s]=f.useSelectedStylingBlocks(),l=f.useSelectedBlock(),t=f.useAddClassesToBlocks(),n=f.useRemoveClassesFromBlocks(),[i]=f.useSelectedBlockIds(),[u,c]=d.useState(""),p=(N=r.first(s))==null?void 0:N.prop,a=r.reject((r.get(l,p,"").replace(de.STYLES_KEY,"").split(",").pop()||"").split(" "),r.isEmpty),h=()=>{const C=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");t(i,C,!0),c("")},[g,m]=d.useState([]),j=({value:C})=>{const B=C.trim().toLowerCase(),I=B.match(/.+:/g);let k=[];if(I&&I.length>0){const[H]=I,L=B.replace(H,"");k=G.search(L).map(x=>({...x,item:{...x.item,name:H+x.item.name}}))}else k=G.search(B);m(r.map(k,"item"))},b=()=>{m([])},y=C=>C.name,R=C=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:C.name}),V={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:u,onKeyDown:C=>{C.key==="Enter"&&u.trim()!==""&&h()},onChange:(C,{newValue:B})=>c(B),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 ${g.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(ue,{suggestions:g,onSuggestionsFetchRequested:j,onSuggestionsClearRequested:b,getSuggestionValue:y,renderSuggestion:R,inputProps:V,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:h,disabled:u.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(o.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[r.isEmpty(a)&&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"}),X.Children.toArray(a.map(C=>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:[C,e.jsxRuntimeExports.jsx(o.Cross2Icon,{onClick:()=>n(i,[C]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},C)))]})]})}const T=["px","%","em","rem","ch","vh","vw"],ye={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:T,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"}]},be={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"}]},fe=[{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:T},{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:T},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...T,"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:T.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:T.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:T.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:T.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:T.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:T.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:T},{type:"arbitrary",property:"lineHeight",label:"Height",units:T.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:he}]}],ee={"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:o.EyeOpenIcon,invisible:o.EyeClosedIcon,hidden:o.EyeClosedIcon,gap:o.BorderAllIcon,gapX:o.WidthIcon,gapY:o.HeightIcon,spaceX:o.WidthIcon,spaceY:o.HeightIcon,overscroll:o.BorderAllIcon,overscrollX:o.WidthIcon,overscrollY:o.HeightIcon,overflow:o.BorderAllIcon,overflowX:o.WidthIcon,overflowY:o.HeightIcon,top:o.ArrowUpIcon,right:o.ArrowRightIcon,bottom:o.ArrowDownIcon,left:o.ArrowLeftIcon,inset:o.BorderAllIcon,insetX:o.WidthIcon,insetY:o.HeightIcon,border:o.BorderAllIcon,borderX:o.WidthIcon,borderY:o.HeightIcon,borderTop:o.ArrowUpIcon,borderRight:o.ArrowRightIcon,borderBottom:o.ArrowDownIcon,borderLeft:o.ArrowLeftIcon,borderRadius:o.BorderAllIcon,borderRadiusX:o.WidthIcon,borderRadiusY:o.HeightIcon,borderRadiusTop:o.ArrowUpIcon,borderRadiusRight:o.ArrowRightIcon,borderRadiusBottom:o.ArrowDownIcon,borderRadiusLeft:o.ArrowLeftIcon,borderRadiusTopLeft:o.ArrowTopLeftIcon,borderRadiusTopRight:o.ArrowTopRightIcon,borderRadiusBottomRight:o.ArrowBottomRightIcon,borderRadiusBottomLeft:o.ArrowBottomLeftIcon,divideXWidth:o.WidthIcon,divideYWidth:o.HeightIcon,scale:o.BorderAllIcon,scaleX:o.WidthIcon,scaleY:o.HeightIcon,skewX:o.WidthIcon,skewY:o.HeightIcon,translateX:o.WidthIcon,translateY:o.HeightIcon,padding:o.BorderAllIcon,paddingX:o.WidthIcon,paddingY:o.HeightIcon,paddingTop:o.ArrowUpIcon,paddingRight:o.ArrowRightIcon,paddingBottom:o.ArrowDownIcon,paddingLeft:o.ArrowLeftIcon,margin:o.BorderAllIcon,marginX:o.WidthIcon,marginY:o.HeightIcon,marginTop:o.ArrowUpIcon,marginRight:o.ArrowRightIcon,marginBottom:o.ArrowDownIcon,marginLeft:o.ArrowLeftIcon,textLeft:o.AlignLeftIcon,textCenter:o.AlignCenterHorizontallyIcon,textRight:o.AlignRightIcon,textJustify:o.StretchHorizontallyIcon,italic:o.FontItalicIcon,underline:o.UnderlineIcon,overline:o.OverlineIcon,uppercase:o.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":o.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:o.Cross1Icon},O=d.createContext({canReset:!1,canChange:!0}),je=({children:s,canReset:l=!1,canChange:t=!0})=>e.jsxRuntimeExports.jsx(O.Provider,{value:{canReset:l,canChange:t},children:s}),te=({label:s,property:l,onChange:t})=>{const n=d.useMemo(()=>r.get(D.CLASSES_LIST,`${l}.classes`,[""]),[l]),i=W(l),u=d.useMemo(()=>r.get(i,"cls",""),[i]),{canChange:c}=d.useContext(O),p=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded ":"grow",children:p?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(ce.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:u}),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(o.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(Z,{rounded:s,onChange:a=>t(a,l),selected:u,options:n,disabled:!c})})};function Z({selected:s,onChange:l,rounded:t=!1,options:n,disabled:i=!1}){const u=s.replace(/.*:/g,"").trim(),{undo:c,redo:p}=f.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!n.length||i,className:`${t?"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:a=>l(a.target.value),onKeyDown:a=>{a.ctrlKey&&(a.key==="z"&&c(),a.key==="y"&&p())},value:u,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),d.Children.toArray(n.map(a=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:a,children:a})))]})}const ve=({property:s,onChange:l})=>{const{canReset:t,canChange:n}=d.useContext(O),i=W(s),u=d.useMemo(()=>r.get(i,"cls",""),[i]),c=d.useMemo(()=>r.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),p=c.indexOf(u)>-1?c.indexOf(u):0,a=/\[.*\]/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:a?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:u}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!n&&(!t||p-1<0),onClick:()=>l(r.nth(c,p-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(o.MinusIcon,{className:!n&&(!t||p-1<0)?"text-gray-500":"text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(te,{label:!1,property:s,onChange:l})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!n&&(!t||p+1>=c.length),onClick:()=>l(r.nth(c,p+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(o.PlusIcon,{className:!n&&(!t||p+1>=c.length)?"text-gray-500":"text-white/60"})})})]})})},Re=({property:s,onChange:l})=>{const t=d.useMemo(()=>r.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:n}=d.useContext(O),i=W(s),u=d.useMemo(()=>r.get(i,"cls",""),[i]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:r.map(t,c=>e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!n,onClick:()=>l(c,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${u===c?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:d.createElement(r.get(ee,c,o.BoxIcon))})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:r.startCase(r.toLower(c))})]}))})},we={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Ce=({property:s,onChange:l})=>{const t=W(s),n=d.useMemo(()=>r.get(t,"cls",""),[t]),{canChange:i}=d.useContext(O),[u,c]=d.useState([]),[p,a]=d.useState({color:"",shade:""}),h=n.split("-"),g=r.get(h,"1",""),m=r.get(h,"2",""),j=d.useCallback(y=>{["current","inherit","transparent","black","white"].includes(y)?(c([]),a({color:y})):(c(["50","100","200","300","400","500","600","700","800","900"]),a(R=>({...R,color:y,shade:R.shade?R.shade:"500"})))},[c,a]);d.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(g))return c([]);c(["50","100","200","300","400","500","600","700","800","900"])},[g]);const b=d.useCallback(y=>{a({color:g,shade:y})},[g]);return d.useEffect(()=>{a({color:"",shade:""})},[t]),d.useEffect(()=>{const R=`${r.get(we,s,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;R.match(new RegExp(r.get(D.CLASSES_LIST,`${s}.regExp`,"")))&&l(R,s)},[p,l,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(Z,{disabled:!i,rounded:!0,selected:g,onChange:j,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:m,disabled:!g||!i,onChange:b,options:u})})]})},K=(s,l)=>{s=s.toLowerCase();let t=s.trim().replace(/ |\+/g,"");if((t==="auto"||t==="none")&&l.includes(t))return{value:"",unit:t};const n=l.length?new RegExp(l.join("|"),"g"):/XXXXXX/g;t=t.replace(n,"");const i=s.match(n),u=i&&i.length>1,c=!r.isEmpty(t)&&Number.isNaN(Number(t));return u||c?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:t,unit:i?i[0]:""}},Ee=s=>{const l=s.startsWith("-")?"-":"",t=s.split("-").pop();if(["auto","none"].includes(t))return{value:"",unit:t};if(t==="px")return{value:"1",unit:"px"};if(t==="screen")return{value:"100",unit:s.indexOf("w-")!==-1?"vw":"vh"};if(t==="full")return{value:"100",unit:"%"};if(r.includes(s,"skew-"))return{value:`${l}${t}`,unit:"deg"};if(r.includes(s,"rotate-"))return{value:`${l}${t}`,unit:"deg"};if(r.includes(s,"opacity-"))return{value:`${t/100}`,unit:"-"};if(r.includes(s,"duration-")||r.includes(s,"delay-"))return{value:`${t}`,unit:"ms"};if(r.includes(s,"translate-")&&!t.includes("/"))return{value:`${l}${`${t/4}`}`,unit:"rem"};if(r.includes(s,"scale-"))return{value:`${l}${`${t/100}`}`,unit:"-"};if(r.startsWith(s,"border")){const n=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(n)return{value:n[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(r.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(t==="xs")return{value:"320",unit:"px"};if(t==="sm")return{value:"384",unit:"px"};if(t==="md")return{value:"448",unit:"px"};if(t==="lg")return{value:"512",unit:"px"};if(t==="xl")return{value:"576",unit:"px"};if(t==="2xl")return{value:"672",unit:"px"};if(t==="3xl")return{value:"768",unit:"px"};if(t==="4xl")return{value:"896",unit:"px"};if(t==="5xl")return{value:"1024",unit:"px"};if(t==="6xl")return{value:"1152",unit:"px"};if(t==="7xl")return{value:"1280",unit:"px"};if(t==="prose")return{value:"65",unit:"ch"}}if(r.startsWith(s,"text-")){if(t==="xs")return{value:"12",unit:"px"};if(t==="sm")return{value:"14",unit:"px"};if(t==="base")return{value:"16",unit:"px"};if(t==="lg")return{value:"18",unit:"px"};if(t==="xl")return{value:"20",unit:"px"};if(t==="2xl")return{value:"24",unit:"px"};if(t==="3xl")return{value:"30",unit:"px"};if(t==="4xl")return{value:"36",unit:"px"};if(t==="5xl")return{value:"48",unit:"px"};if(t==="6xl")return{value:"60",unit:"px"};if(t==="7xl")return{value:"72",unit:"px"};if(t==="8xl")return{value:"96",unit:"px"};if(t==="9xl")return{value:"128",unit:"px"}}if(r.startsWith(s,"leading-")){if(t==="none")return{value:"1",unit:"-"};if(t==="tight")return{value:"1.25",unit:"-"};if(t==="snug")return{value:"1.375",unit:"-"};if(t==="normal")return{value:"1.5",unit:"-"};if(t==="relaxed")return{value:"1.625",unit:"-"};if(t==="loose")return{value:"2",unit:"-"}}if(r.startsWith(s,"tracking-")){if(t==="tighter")return{value:"-0.05",unit:"em"};if(t==="tight")return{value:"-0.025",unit:"em"};if(t==="normal")return{value:"0",unit:"em"};if(t==="wide")return{value:"0.025",unit:"em"};if(t==="wider")return{value:"0.05",unit:"em"};if(t==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(t))return{value:s,unit:"class"};if(t.includes("/")){const[n,i]=r.map(t.split("/"),u=>parseInt(u,10));return{value:l+(n/i*100).toFixed(2).replace(".00",""),unit:"%"}}return r.isNumber(parseFloat(t))?{value:`${l+parseFloat(t)*4}`,unit:"px"}:{value:t,unit:"class"}},ke=s=>{if(r.isEmpty(s))return{value:"",unit:""};const l=s.match(/\[.*\]/g);if(l===null)return Se(s);const t=r.get(l,"0","").replace(/\[|\]/g,""),n=s.startsWith("-")?"-":"",i=r.first(t.match(/\d+.\d+|\d+/g));return{value:`${n}${i}`,unit:t.replace(i,"")}},Se=s=>r.isEmpty(s)?{value:"",unit:""}:Ee(s),re=d.createContext({setDragData:()=>{}}),Te=({unit:s,currentValue:l,onDrag:t,onDragEnd:n,onDragStart:i,negative:u,cssProperty:c})=>{const{setDragData:p}=d.useContext(re);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:a=>{const h={onDrag:t,onDragEnd:n,dragging:!0,dragStartY:a.pageY,dragStartValue:`${l}`,dragUnit:s,negative:u,cssProperty:c};i(h),p(h)},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(o.RowSpacingIcon,{})})},Ne=({onSelect:s,current:l,units:t})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:t.map(n=>e.jsxRuntimeExports.jsx(w.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:l===n?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),s(n)},children:n},n))}),Ie=s=>{const[l,t]=d.useState(!1),[n,i]=d.useState(""),{currentClass:u,onChange:c,classPrefix:p,cssProperty:a,units:h,negative:g}=s,[m,j]=d.useState(a!=null&&a.toLowerCase().includes("width")?"%":h[0]),[b,y]=d.useState(!1),[R,V]=d.useState(""),[N,C]=d.useState(!1),[B,I]=d.useState(!1);d.useEffect(()=>{const{value:x,unit:v}=ke(u);if(v===""){i(x),j(a!=null&&a.toLowerCase().includes("width")?"%":h[0]);return}j(v),i(v==="class"||r.isEmpty(x)?"":x)},[u,a,h]);const k=_.useThrottledCallback(x=>{c(x)},[c],200),H=_.useThrottledCallback(x=>{c(x,!1)},[c],200),L=d.useCallback((x=!1)=>{const v=K(`${n}`,h);if(r.get(v,"error",!1)){y(!0);return}const S=r.get(v,"unit")!==""?r.get(v,"unit"):m;if(S==="auto"||S==="none"){k(`${p}${S}`);return}if(r.get(v,"value")==="")return;const q=`${r.get(v,"value","").startsWith("-")?"-":""}${p}[${r.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;x?H(q):k(q)},[k,H,n,m,p,h]),P=d.useCallback(x=>{const v=K(`${n}`,h);if(r.get(v,"error",!1)){y(!0);return}if(x==="auto"||x==="none"){k(`${p}${x}`);return}if(r.get(v,"value")==="")return;const S=r.get(v,"unit")!==""?r.get(v,"unit"):x,q=`${r.get(v,"value","").startsWith("-")?"-":""}${p}[${r.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;k(q)},[k,n,p,h]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:m==="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(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(o.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 ${N?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(m)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:m==="class",onKeyPress:x=>{x.key==="Enter"&&L()},onKeyDown:x=>{if(x.keyCode!==38&&x.keyCode!==40)return;x.preventDefault(),I(!0);const v=r.parseInt(x.target.value);let S=r.isNaN(v)?0:v;x.keyCode===38&&(S+=1),x.keyCode===40&&(S-=1);const A=`${S}`,oe=`${A.startsWith("-")?"-":""}${p}[${A.replace("-","")}${m==="-"?"":m}]`;H(oe)},onKeyUp:x=>{B&&(x.preventDefault(),I(!1))},onBlur:()=>L(),onChange:x=>{y(!1),i(x.target.value)},onClick:x=>{var v;(v=x==null?void 0:x.target)==null||v.select(),t(!1)},value:N?R:n,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(w.Tooltip,{open:l,delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>t(!l),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 ${h.length===1?"px-2 font-semibold":""}`,children:m}),h.length>1?e.jsxRuntimeExports.jsx(o.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(w.TooltipPortal,{children:e.jsxRuntimeExports.jsx(w.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Ne,{units:h,current:m,onSelect:x=>{t(!1),j(x),P(x)}})})})]})]}),["none","auto"].indexOf(m)!==-1||N?null:e.jsxRuntimeExports.jsx(Te,{onDragStart:()=>C(!0),onDragEnd:x=>{if(V(()=>""),C(!1),r.isEmpty(x))return;const v=`${x}`,A=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${m==="-"?"":m}]`;k(A)},onDrag:x=>{if(r.isEmpty(x))return;V(x);const v=`${x}`,A=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${m==="-"?"":m}]`;H(A)},currentValue:n,unit:m,negative:g,cssProperty:a})]})})})},W=s=>{const l=f.useSelectedBlockCurrentClasses();return r.findLast(l,{property:s})},He=(s,l)=>{const t={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return t[r.get(s,"mq","xs")]<=t[l]},Be={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-"},J={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Ve=s=>`${s.toUpperCase()} ${J[s]?`(${J[s]} & up)`:""}`,z=s=>{const{type:l="icons",label:t,property:n,onEmitChange:i=()=>{},units:u,negative:c=!1}=s,[p]=f.useDarkMode(),[a]=f.useStylingState(),[,h]=f.useCanvasWidth(),g=W(n),m=f.useAddClassesToBlocks(),j=f.useRemoveClassesFromBlocks(),[b]=f.useSelectedBlockIds(),y=d.useMemo(()=>r.get(g,"fullCls",""),[g]),R=d.useCallback((k,H=!0)=>{const L={dark:p,mq:h,mod:a,cls:k,property:n,fullCls:""};(p||a!=="")&&(L.mq="xs");const P=D.generateFullClsName(L);m(b,[P],H)},[b,p,h,a,n,m]),V=d.useCallback(()=>{j(b,[y])},[b,y,j]),N=d.useMemo(()=>He(g,h),[g,h]);d.useEffect(()=>{i(N,g)},[N,i,g]);const[,,C]=f.useCanvasWidth(),B=d.useCallback(k=>{C({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[k])},[C]),I=r.get(g,"dark",null)===p&&r.get(g,"mod",null)===a&&r.get(g,"mq",null)===h;return e.jsxRuntimeExports.jsx(je,{canChange:N,canReset:g&&I,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] ${g&&!I?"text-foreground":""}`,children:t})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[l==="arbitrary"?e.jsxRuntimeExports.jsx(Ie,{currentClass:r.get(g,"cls",""),classPrefix:r.get(Be,n,""),units:u||[],onChange:R,negative:c,cssProperty:n}):null,l==="icons"&&e.jsxRuntimeExports.jsx(Re,{property:n,onChange:R}),l==="range"&&e.jsxRuntimeExports.jsx(ve,{property:n,onChange:R}),l==="color"&&e.jsxRuntimeExports.jsx(Ce,{property:n,onChange:R}),l==="dropdown"&&e.jsxRuntimeExports.jsx(te,{label:t,property:n,onChange:R})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${y?"visible":"invisible"}`,children:I?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>V(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(o.TrashIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):N&&g?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(o.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:[Ve(r.get(g,"mq")),p&&!g.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>B(r.get(g,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",r.get(g,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Ae=["px","%","em","rem","ch","vh","vw"],se=({label:s,options:l,borderB:t=!1,borderT:n=!1,type:i="arbitrary",units:u=Ae,negative:c=!1})=>{const[p,a]=d.useState(l[0].key),h=f.useSelectedBlockCurrentClasses(),g=d.useCallback(m=>r.map(h,"property").includes(m),[h]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${t?"border-b":""} ${n?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:s}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:d.Children.toArray(l.map(({label:m,key:j})=>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:()=>a(j),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${j===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[d.createElement("div",{className:g(j)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),d.createElement(r.get(ee,j,o.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:r.startCase(r.toLower(m))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(z,{type:i,units:[...u],label:"",property:p,negative:c})})]})},Le=({heading:s,items:l})=>{const t=f.useSelectedBlockCurrentClasses(),n=d.useMemo(()=>{const i=p=>r.flatten(p.map(a=>a.styleType==="multiple"?r.map(a.options,"key"):a.property)),u=r.flatten(l.map(p=>p.styleType==="accordion"?i(p.items):p.styleType==="multiple"?r.map(p.options,"key"):p.property)),c=r.map(t,"property");return r.intersection(u,c).length>0},[t,l]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[s,n?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:l.map(i=>i.styleType==="multiple"?e.jsxRuntimeExports.jsx(se,{...i},i.label):e.jsxRuntimeExports.jsx(z,{...i},i.label))})]})},$e=d.createContext({}),Y=({section:s})=>{const l=f.useSelectedBlockCurrentClasses(),t=d.useCallback((u=[])=>{const c={};for(let a=0;a<l.length;a++)c[l[a].property]=l[a].cls;let p=!0;for(const a in u)if(!r.has(c,a)||c[a]!==u[a]){p=!1;break}return p},[l]),n=d.useMemo(()=>{if(l.length>0&&s.heading==="Classes")return!0;const u=a=>r.flatten(a.map(h=>h.styleType==="multiple"?r.flatten(r.map(h.options,"key")):h.property)),c=r.flatten(s.items.map(a=>a.styleType==="accordion"?u(a.items):a.styleType==="multiple"?r.flatten(r.map(a.options,"key")):a.property)),p=r.map(l,"property");return r.intersection(c,p).length>0},[l,s.heading,s.items]),i=d.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx($e.Provider,{value:i,children:e.jsxRuntimeExports.jsxs($.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx($.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 ${n?"bg-blue-500":"bg-gray-300"}`}),s.heading]})}),e.jsxRuntimeExports.jsx($.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:d.Children.toArray(s.items.map(u=>r.has(u,"component")?d.createElement(u.component,{key:u.label}):r.has(u,"styleType")?u.styleType==="multiple"?e.jsxRuntimeExports.jsx(se,{...u},u.label):u.styleType==="accordion"&&t(u==null?void 0:u.conditions)?e.jsxRuntimeExports.jsx(Le,{...u},u.label):null:e.jsxRuntimeExports.jsx(z,{...u},u.label)))})]})})},Me=({item:s,index:l,canDelete:t,onChange:n,onRemove:i})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${t?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:u=>n(u,l),value:s.key,placeholder:"Key",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[e.jsxRuntimeExports.jsx("input",{name:"value",onChange:u=>r.isEmpty(s.key)?{}:n(u,l),value:s.value,placeholder:"Value",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsx(o.TrashIcon,{onClick:i,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),De=({section:s})=>{var j;const{setSyncState:l}=f.useSavePage(),t=f.useSelectedBlock(),[n,i]=d.useState([]),[u]=f.useSelectedStylingBlocks(),c=f.useUpdateBlocksPropsRealtime(),p=`${r.get(u,"0.prop")}_attrs`;X.useEffect(()=>{const b=r.map(r.get(t,p),(y,R)=>({key:R,value:y}));r.isEmpty(b)?i([]):i(b)},[r.get(t,p)]);const a=()=>i([...n,{key:"",value:""}]),h=b=>{const y=r.filter(n,(R,V)=>b!==V);m(y)},g=(b,y)=>{const R=[...n];R[y][b.target.name]=b.target.value,m(R)},m=X.useCallback((b=[])=>{const y={};r.forEach(b,R=>{r.isEmpty(R.key)||r.set(y,R.key,R.value)}),c([r.get(t,"_id")],{[p]:y}),l("UNSAVED")},[t,l,c,p]);return e.jsxRuntimeExports.jsxs($.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx($.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 ${r.isEmpty(r.get(t,p))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx($.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 ${!r.isEmpty(n)&&r.isEmpty((j=r.last(n))==null?void 0:j.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 b;!r.isEmpty(n)&&r.isEmpty((b=r.last(n))==null?void 0:b.key)||a()},children:[e.jsxRuntimeExports.jsx(o.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[r.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),X.Children.toArray(r.map(n,(b,y)=>{const R=n.length>0&&y<n.length-1;return e.jsxRuntimeExports.jsx(Me,{item:b,index:y,canDelete:R,onChange:g,onRemove:()=>h(y)})}))]})]})})]})};function qe(){const[s,l]=f.useStylingState(),{flexChild:t,gridChild:n}=f.useSelectedBlocksDisplayChild(),[,i]=ae.useAtom(f.advanceStylingOpenAtom),{t:u}=Q.useTranslation(),[c]=f.useSelectedStylingBlocks();return r.isEmpty(c)?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(o.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:u("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:()=>i(!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(E.Select,{defaultValue:s,onValueChange:p=>l(p),children:[e.jsxRuntimeExports.jsx(E.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(E.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(E.SelectContent,{children:[e.jsxRuntimeExports.jsx(E.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(xe.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs($.Accordion,{type:"multiple",className:"h-full w-full",children:[t&&e.jsxRuntimeExports.jsx(Y,{section:ye}),n?e.jsxRuntimeExports.jsx(Y,{section:be}):null,fe.map(p=>e.jsxRuntimeExports.jsx(Y,{section:p},p.heading)),e.jsxRuntimeExports.jsx(De,{section:{heading:"Attributes"}})]}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})}const Oe={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},We=()=>{const s=f.useSelectedBlock(),{t:l}=Q.useTranslation(),[t,n]=d.useState(""),[i,u]=d.useState({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),c=_.useThrottledCallback(a=>{const h=!r.get(i,"negative",!1),g=r.get(i,"cssProperty","");let m=parseFloat(i.dragStartValue);m=r.isNaN(m)?0:m;let j=Oe[i.dragUnit];(r.startsWith(g,"scale")||g==="opacity")&&(j=10);let y=(i.dragStartY-a.pageY)/j+m;h&&y<0&&(y=0),g==="opacity"&&y>1&&(y=1),i.onDrag(`${y}`),n(`${y}`)},[i],50),p=d.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${t}`),100),u({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,t,u]);return r.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(o.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:l("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsxs(re.Provider,{value:{setDragData:u},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:c,onMouseUp:()=>{p()},className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10 "}):null,e.jsxRuntimeExports.jsxs(M.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(M.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"settings",children:"Settings"}),e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"styling",children:"Styling"})]}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(ge,{})}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"styling",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(qe,{})})]})]})};exports.default=We;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),d=require("react"),_=require("@react-hookz/web"),r=require("lodash"),Q=require("react-i18next"),o=require("@radix-ui/react-icons"),M=require("./tabs-860e37aa.cjs"),ne=require("@rjsf/core"),le=require("@rjsf/validator-ajv8"),f=require("./index-659e552b.cjs"),ie=require("@chaibuilder/blocks"),F=require("./link-4585b2d6.cjs"),ae=require("jotai"),ue=require("react-autosuggest"),pe=require("fuse.js"),D=require("./html-to-json-78bfa1f3.cjs"),w=require("./useBuilderProp-5e57d0c8.cjs"),U=require("./label-167415e5.cjs"),de=require("./MODIFIERS-70fef873.cjs"),ce=require("./input-42acea7e.cjs"),$=require("./accordion-0afd8143.cjs"),xe=require("./scroll-area-088530b9.cjs"),E=require("./select-0e32300c.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("lucide-react");require("sonner");require("react-icons-picker");require("react-dom");require("./dialog-170eaad9.cjs");require("@radix-ui/react-dialog");require("./ImagesPanel-68a11293.cjs");require("react-quill");require("himalaya");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-label");require("@radix-ui/react-accordion");require("@radix-ui/react-scroll-area");require("@radix-ui/react-select");function me(s){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(l,t,n.get?n:{enumerable:!0,get:()=>s[t]})}}return l.default=s,Object.freeze(l)}const X=me(d);function ge(){const s=f.useSelectedBlock(),{createSnapshot:l}=f.useCanvasHistory(),t=f.useUpdateBlocksPropsRealtime(),[n]=f.useActiveLanguage(),i=ie.getBlockComponent(s._type),u=r.get(i,"props",{}),c={type:"object",properties:{_name:{title:"Name",type:"string",default:r.get(s,"_name",s._type)}}},p={};Object.keys(u).forEach(m=>{const j=u[m];if(r.includes(["slot","styles"],j.type))return;const b=r.get(j,"i18n",!1)?`${m}-${n}`:m;c.properties[b]=f.getBlockJSONFromSchemas(j,n),p[b]=f.getBlockJSONFromUISchemas(j,n)});const a={...s},h=({formData:m},j)=>{if(j){const b=j.replace("root.","");t([s._id],{[b]:r.get(m,b)})}},g=()=>{l()};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(ne,{widgets:{richtext:F.RichTextEditorField,icon:F.IconPickerField,image:F.ImagePickerField},fields:{link:F.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,uiSchema:p,onBlur:g,schema:c,formData:a,validator:le,onChange:h}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const G=new pe(D.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function he(){var N;const[s]=f.useSelectedStylingBlocks(),l=f.useSelectedBlock(),t=f.useAddClassesToBlocks(),n=f.useRemoveClassesFromBlocks(),[i]=f.useSelectedBlockIds(),[u,c]=d.useState(""),p=(N=r.first(s))==null?void 0:N.prop,a=r.reject((r.get(l,p,"").replace(de.STYLES_KEY,"").split(",").pop()||"").split(" "),r.isEmpty),h=()=>{const C=u.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");t(i,C,!0),c("")},[g,m]=d.useState([]),j=({value:C})=>{const B=C.trim().toLowerCase(),I=B.match(/.+:/g);let k=[];if(I&&I.length>0){const[H]=I,L=B.replace(H,"");k=G.search(L).map(x=>({...x,item:{...x.item,name:H+x.item.name}}))}else k=G.search(B);m(r.map(k,"item"))},b=()=>{m([])},y=C=>C.name,R=C=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:C.name}),V={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:u,onKeyDown:C=>{C.key==="Enter"&&u.trim()!==""&&h()},onChange:(C,{newValue:B})=>c(B),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 ${g.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(ue,{suggestions:g,onSuggestionsFetchRequested:j,onSuggestionsClearRequested:b,getSuggestionValue:y,renderSuggestion:R,inputProps:V,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:h,disabled:u.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(o.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[r.isEmpty(a)&&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"}),X.Children.toArray(a.map(C=>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:[C,e.jsxRuntimeExports.jsx(o.Cross2Icon,{onClick:()=>n(i,[C]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},C)))]})]})}const T=["px","%","em","rem","ch","vh","vw"],ye={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:T,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"}]},be={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"}]},fe=[{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:T},{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:T},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...T,"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:T.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:T.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:T.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:T.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:T.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:T.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:T},{type:"arbitrary",property:"lineHeight",label:"Height",units:T.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:he}]}],ee={"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:o.EyeOpenIcon,invisible:o.EyeClosedIcon,hidden:o.EyeClosedIcon,gap:o.BorderAllIcon,gapX:o.WidthIcon,gapY:o.HeightIcon,spaceX:o.WidthIcon,spaceY:o.HeightIcon,overscroll:o.BorderAllIcon,overscrollX:o.WidthIcon,overscrollY:o.HeightIcon,overflow:o.BorderAllIcon,overflowX:o.WidthIcon,overflowY:o.HeightIcon,top:o.ArrowUpIcon,right:o.ArrowRightIcon,bottom:o.ArrowDownIcon,left:o.ArrowLeftIcon,inset:o.BorderAllIcon,insetX:o.WidthIcon,insetY:o.HeightIcon,border:o.BorderAllIcon,borderX:o.WidthIcon,borderY:o.HeightIcon,borderTop:o.ArrowUpIcon,borderRight:o.ArrowRightIcon,borderBottom:o.ArrowDownIcon,borderLeft:o.ArrowLeftIcon,borderRadius:o.BorderAllIcon,borderRadiusX:o.WidthIcon,borderRadiusY:o.HeightIcon,borderRadiusTop:o.ArrowUpIcon,borderRadiusRight:o.ArrowRightIcon,borderRadiusBottom:o.ArrowDownIcon,borderRadiusLeft:o.ArrowLeftIcon,borderRadiusTopLeft:o.ArrowTopLeftIcon,borderRadiusTopRight:o.ArrowTopRightIcon,borderRadiusBottomRight:o.ArrowBottomRightIcon,borderRadiusBottomLeft:o.ArrowBottomLeftIcon,divideXWidth:o.WidthIcon,divideYWidth:o.HeightIcon,scale:o.BorderAllIcon,scaleX:o.WidthIcon,scaleY:o.HeightIcon,skewX:o.WidthIcon,skewY:o.HeightIcon,translateX:o.WidthIcon,translateY:o.HeightIcon,padding:o.BorderAllIcon,paddingX:o.WidthIcon,paddingY:o.HeightIcon,paddingTop:o.ArrowUpIcon,paddingRight:o.ArrowRightIcon,paddingBottom:o.ArrowDownIcon,paddingLeft:o.ArrowLeftIcon,margin:o.BorderAllIcon,marginX:o.WidthIcon,marginY:o.HeightIcon,marginTop:o.ArrowUpIcon,marginRight:o.ArrowRightIcon,marginBottom:o.ArrowDownIcon,marginLeft:o.ArrowLeftIcon,textLeft:o.AlignLeftIcon,textCenter:o.AlignCenterHorizontallyIcon,textRight:o.AlignRightIcon,textJustify:o.StretchHorizontallyIcon,italic:o.FontItalicIcon,underline:o.UnderlineIcon,overline:o.OverlineIcon,uppercase:o.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":o.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:o.Cross1Icon},O=d.createContext({canReset:!1,canChange:!0}),je=({children:s,canReset:l=!1,canChange:t=!0})=>e.jsxRuntimeExports.jsx(O.Provider,{value:{canReset:l,canChange:t},children:s}),te=({label:s,property:l,onChange:t})=>{const n=d.useMemo(()=>r.get(D.CLASSES_LIST,`${l}.classes`,[""]),[l]),i=W(l),u=d.useMemo(()=>r.get(i,"cls",""),[i]),{canChange:c}=d.useContext(O),p=/\[.*\]/g.test(u);return e.jsxRuntimeExports.jsx("div",{className:s?"w-full rounded ":"grow",children:p?e.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[e.jsxRuntimeExports.jsx(ce.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:u}),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(o.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(Z,{rounded:s,onChange:a=>t(a,l),selected:u,options:n,disabled:!c})})};function Z({selected:s,onChange:l,rounded:t=!1,options:n,disabled:i=!1}){const u=s.replace(/.*:/g,"").trim(),{undo:c,redo:p}=f.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!n.length||i,className:`${t?"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:a=>l(a.target.value),onKeyDown:a=>{a.ctrlKey&&(a.key==="z"&&c(),a.key==="y"&&p())},value:u,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),d.Children.toArray(n.map(a=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:a,children:a})))]})}const ve=({property:s,onChange:l})=>{const{canReset:t,canChange:n}=d.useContext(O),i=W(s),u=d.useMemo(()=>r.get(i,"cls",""),[i]),c=d.useMemo(()=>r.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),p=c.indexOf(u)>-1?c.indexOf(u):0,a=/\[.*\]/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:a?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:u}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!n&&(!t||p-1<0),onClick:()=>l(r.nth(c,p-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(o.MinusIcon,{className:!n&&(!t||p-1<0)?"text-gray-500":"text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(te,{label:!1,property:s,onChange:l})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!n&&(!t||p+1>=c.length),onClick:()=>l(r.nth(c,p+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(o.PlusIcon,{className:!n&&(!t||p+1>=c.length)?"text-gray-500":"text-white/60"})})})]})})},Re=({property:s,onChange:l})=>{const t=d.useMemo(()=>r.get(D.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:n}=d.useContext(O),i=W(s),u=d.useMemo(()=>r.get(i,"cls",""),[i]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:r.map(t,c=>e.jsxRuntimeExports.jsxs(w.Tooltip,{children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!n,onClick:()=>l(c,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${u===c?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:d.createElement(r.get(ee,c,o.BoxIcon))})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:r.startCase(r.toLower(c))})]}))})},we={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},Ce=({property:s,onChange:l})=>{const t=W(s),n=d.useMemo(()=>r.get(t,"cls",""),[t]),{canChange:i}=d.useContext(O),[u,c]=d.useState([]),[p,a]=d.useState({color:"",shade:""}),h=n.split("-"),g=r.get(h,"1",""),m=r.get(h,"2",""),j=d.useCallback(y=>{["current","inherit","transparent","black","white"].includes(y)?(c([]),a({color:y})):(c(["50","100","200","300","400","500","600","700","800","900"]),a(R=>({...R,color:y,shade:R.shade?R.shade:"500"})))},[c,a]);d.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(g))return c([]);c(["50","100","200","300","400","500","600","700","800","900"])},[g]);const b=d.useCallback(y=>{a({color:g,shade:y})},[g]);return d.useEffect(()=>{a({color:"",shade:""})},[t]),d.useEffect(()=>{const R=`${r.get(we,s,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;R.match(new RegExp(r.get(D.CLASSES_LIST,`${s}.regExp`,"")))&&l(R,s)},[p,l,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(Z,{disabled:!i,rounded:!0,selected:g,onChange:j,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:m,disabled:!g||!i,onChange:b,options:u})})]})},K=(s,l)=>{s=s.toLowerCase();let t=s.trim().replace(/ |\+/g,"");if((t==="auto"||t==="none")&&l.includes(t))return{value:"",unit:t};const n=l.length?new RegExp(l.join("|"),"g"):/XXXXXX/g;t=t.replace(n,"");const i=s.match(n),u=i&&i.length>1,c=!r.isEmpty(t)&&Number.isNaN(Number(t));return u||c?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:t,unit:i?i[0]:""}},Ee=s=>{const l=s.startsWith("-")?"-":"",t=s.split("-").pop();if(["auto","none"].includes(t))return{value:"",unit:t};if(t==="px")return{value:"1",unit:"px"};if(t==="screen")return{value:"100",unit:s.indexOf("w-")!==-1?"vw":"vh"};if(t==="full")return{value:"100",unit:"%"};if(r.includes(s,"skew-"))return{value:`${l}${t}`,unit:"deg"};if(r.includes(s,"rotate-"))return{value:`${l}${t}`,unit:"deg"};if(r.includes(s,"opacity-"))return{value:`${t/100}`,unit:"-"};if(r.includes(s,"duration-")||r.includes(s,"delay-"))return{value:`${t}`,unit:"ms"};if(r.includes(s,"translate-")&&!t.includes("/"))return{value:`${l}${`${t/4}`}`,unit:"rem"};if(r.includes(s,"scale-"))return{value:`${l}${`${t/100}`}`,unit:"-"};if(r.startsWith(s,"border")){const n=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(n)return{value:n[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(r.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(t==="xs")return{value:"320",unit:"px"};if(t==="sm")return{value:"384",unit:"px"};if(t==="md")return{value:"448",unit:"px"};if(t==="lg")return{value:"512",unit:"px"};if(t==="xl")return{value:"576",unit:"px"};if(t==="2xl")return{value:"672",unit:"px"};if(t==="3xl")return{value:"768",unit:"px"};if(t==="4xl")return{value:"896",unit:"px"};if(t==="5xl")return{value:"1024",unit:"px"};if(t==="6xl")return{value:"1152",unit:"px"};if(t==="7xl")return{value:"1280",unit:"px"};if(t==="prose")return{value:"65",unit:"ch"}}if(r.startsWith(s,"text-")){if(t==="xs")return{value:"12",unit:"px"};if(t==="sm")return{value:"14",unit:"px"};if(t==="base")return{value:"16",unit:"px"};if(t==="lg")return{value:"18",unit:"px"};if(t==="xl")return{value:"20",unit:"px"};if(t==="2xl")return{value:"24",unit:"px"};if(t==="3xl")return{value:"30",unit:"px"};if(t==="4xl")return{value:"36",unit:"px"};if(t==="5xl")return{value:"48",unit:"px"};if(t==="6xl")return{value:"60",unit:"px"};if(t==="7xl")return{value:"72",unit:"px"};if(t==="8xl")return{value:"96",unit:"px"};if(t==="9xl")return{value:"128",unit:"px"}}if(r.startsWith(s,"leading-")){if(t==="none")return{value:"1",unit:"-"};if(t==="tight")return{value:"1.25",unit:"-"};if(t==="snug")return{value:"1.375",unit:"-"};if(t==="normal")return{value:"1.5",unit:"-"};if(t==="relaxed")return{value:"1.625",unit:"-"};if(t==="loose")return{value:"2",unit:"-"}}if(r.startsWith(s,"tracking-")){if(t==="tighter")return{value:"-0.05",unit:"em"};if(t==="tight")return{value:"-0.025",unit:"em"};if(t==="normal")return{value:"0",unit:"em"};if(t==="wide")return{value:"0.025",unit:"em"};if(t==="wider")return{value:"0.05",unit:"em"};if(t==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(t))return{value:s,unit:"class"};if(t.includes("/")){const[n,i]=r.map(t.split("/"),u=>parseInt(u,10));return{value:l+(n/i*100).toFixed(2).replace(".00",""),unit:"%"}}return r.isNumber(parseFloat(t))?{value:`${l+parseFloat(t)*4}`,unit:"px"}:{value:t,unit:"class"}},ke=s=>{if(r.isEmpty(s))return{value:"",unit:""};const l=s.match(/\[.*\]/g);if(l===null)return Se(s);const t=r.get(l,"0","").replace(/\[|\]/g,""),n=s.startsWith("-")?"-":"",i=r.first(t.match(/\d+.\d+|\d+/g));return{value:`${n}${i}`,unit:t.replace(i,"")}},Se=s=>r.isEmpty(s)?{value:"",unit:""}:Ee(s),re=d.createContext({setDragData:()=>{}}),Te=({unit:s,currentValue:l,onDrag:t,onDragEnd:n,onDragStart:i,negative:u,cssProperty:c})=>{const{setDragData:p}=d.useContext(re);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:a=>{const h={onDrag:t,onDragEnd:n,dragging:!0,dragStartY:a.pageY,dragStartValue:`${l}`,dragUnit:s,negative:u,cssProperty:c};i(h),p(h)},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(o.RowSpacingIcon,{})})},Ne=({onSelect:s,current:l,units:t})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:t.map(n=>e.jsxRuntimeExports.jsx(w.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:l===n?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),s(n)},children:n},n))}),Ie=s=>{const[l,t]=d.useState(!1),[n,i]=d.useState(""),{currentClass:u,onChange:c,classPrefix:p,cssProperty:a,units:h,negative:g}=s,[m,j]=d.useState(a!=null&&a.toLowerCase().includes("width")?"%":h[0]),[b,y]=d.useState(!1),[R,V]=d.useState(""),[N,C]=d.useState(!1),[B,I]=d.useState(!1);d.useEffect(()=>{const{value:x,unit:v}=ke(u);if(v===""){i(x),j(a!=null&&a.toLowerCase().includes("width")?"%":h[0]);return}j(v),i(v==="class"||r.isEmpty(x)?"":x)},[u,a,h]);const k=_.useThrottledCallback(x=>{c(x)},[c],200),H=_.useThrottledCallback(x=>{c(x,!1)},[c],200),L=d.useCallback((x=!1)=>{const v=K(`${n}`,h);if(r.get(v,"error",!1)){y(!0);return}const S=r.get(v,"unit")!==""?r.get(v,"unit"):m;if(S==="auto"||S==="none"){k(`${p}${S}`);return}if(r.get(v,"value")==="")return;const q=`${r.get(v,"value","").startsWith("-")?"-":""}${p}[${r.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;x?H(q):k(q)},[k,H,n,m,p,h]),P=d.useCallback(x=>{const v=K(`${n}`,h);if(r.get(v,"error",!1)){y(!0);return}if(x==="auto"||x==="none"){k(`${p}${x}`);return}if(r.get(v,"value")==="")return;const S=r.get(v,"unit")!==""?r.get(v,"unit"):x,q=`${r.get(v,"value","").startsWith("-")?"-":""}${p}[${r.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;k(q)},[k,n,p,h]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:m==="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(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(o.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 ${N?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(m)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:m==="class",onKeyPress:x=>{x.key==="Enter"&&L()},onKeyDown:x=>{if(x.keyCode!==38&&x.keyCode!==40)return;x.preventDefault(),I(!0);const v=r.parseInt(x.target.value);let S=r.isNaN(v)?0:v;x.keyCode===38&&(S+=1),x.keyCode===40&&(S-=1);const A=`${S}`,oe=`${A.startsWith("-")?"-":""}${p}[${A.replace("-","")}${m==="-"?"":m}]`;H(oe)},onKeyUp:x=>{B&&(x.preventDefault(),I(!1))},onBlur:()=>L(),onChange:x=>{y(!1),i(x.target.value)},onClick:x=>{var v;(v=x==null?void 0:x.target)==null||v.select(),t(!1)},value:N?R:n,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(w.Tooltip,{open:l,delayDuration:100,children:[e.jsxRuntimeExports.jsx(w.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>t(!l),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 ${h.length===1?"px-2 font-semibold":""}`,children:m}),h.length>1?e.jsxRuntimeExports.jsx(o.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(w.TooltipPortal,{children:e.jsxRuntimeExports.jsx(w.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Ne,{units:h,current:m,onSelect:x=>{t(!1),j(x),P(x)}})})})]})]}),["none","auto"].indexOf(m)!==-1||N?null:e.jsxRuntimeExports.jsx(Te,{onDragStart:()=>C(!0),onDragEnd:x=>{if(V(()=>""),C(!1),r.isEmpty(x))return;const v=`${x}`,A=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${m==="-"?"":m}]`;k(A)},onDrag:x=>{if(r.isEmpty(x))return;V(x);const v=`${x}`,A=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${m==="-"?"":m}]`;H(A)},currentValue:n,unit:m,negative:g,cssProperty:a})]})})})},W=s=>{const l=f.useSelectedBlockCurrentClasses();return r.findLast(l,{property:s})},He=(s,l)=>{const t={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return t[r.get(s,"mq","xs")]<=t[l]},Be={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-"},J={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},Ve=s=>`${s.toUpperCase()} ${J[s]?`(${J[s]} & up)`:""}`,z=s=>{const{type:l="icons",label:t,property:n,onEmitChange:i=()=>{},units:u,negative:c=!1}=s,[p]=f.useDarkMode(),[a]=f.useStylingState(),[,h]=f.useCanvasWidth(),g=W(n),m=f.useAddClassesToBlocks(),j=f.useRemoveClassesFromBlocks(),[b]=f.useSelectedBlockIds(),y=d.useMemo(()=>r.get(g,"fullCls",""),[g]),R=d.useCallback((k,H=!0)=>{const L={dark:p,mq:h,mod:a,cls:k,property:n,fullCls:""};(p||a!=="")&&(L.mq="xs");const P=D.generateFullClsName(L);m(b,[P],H)},[b,p,h,a,n,m]),V=d.useCallback(()=>{j(b,[y])},[b,y,j]),N=d.useMemo(()=>He(g,h),[g,h]);d.useEffect(()=>{i(N,g)},[N,i,g]);const[,,C]=f.useCanvasWidth(),B=d.useCallback(k=>{C({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[k])},[C]),I=r.get(g,"dark",null)===p&&r.get(g,"mod",null)===a&&r.get(g,"mq",null)===h;return e.jsxRuntimeExports.jsx(je,{canChange:N,canReset:g&&I,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] ${g&&!I?"text-foreground":""}`,children:t})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[l==="arbitrary"?e.jsxRuntimeExports.jsx(Ie,{currentClass:r.get(g,"cls",""),classPrefix:r.get(Be,n,""),units:u||[],onChange:R,negative:c,cssProperty:n}):null,l==="icons"&&e.jsxRuntimeExports.jsx(Re,{property:n,onChange:R}),l==="range"&&e.jsxRuntimeExports.jsx(ve,{property:n,onChange:R}),l==="color"&&e.jsxRuntimeExports.jsx(Ce,{property:n,onChange:R}),l==="dropdown"&&e.jsxRuntimeExports.jsx(te,{label:t,property:n,onChange:R})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${y?"visible":"invisible"}`,children:I?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>V(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(o.TrashIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):N&&g?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(o.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:[Ve(r.get(g,"mq")),p&&!g.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>B(r.get(g,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",r.get(g,"mq").toUpperCase()]})]})})})]}):null})]})]})})},Ae=["px","%","em","rem","ch","vh","vw"],se=({label:s,options:l,borderB:t=!1,borderT:n=!1,type:i="arbitrary",units:u=Ae,negative:c=!1})=>{const[p,a]=d.useState(l[0].key),h=f.useSelectedBlockCurrentClasses(),g=d.useCallback(m=>r.map(h,"property").includes(m),[h]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${t?"border-b":""} ${n?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:s}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:d.Children.toArray(l.map(({label:m,key:j})=>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:()=>a(j),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${j===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[d.createElement("div",{className:g(j)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),d.createElement(r.get(ee,j,o.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(w.TooltipContent,{children:r.startCase(r.toLower(m))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(z,{type:i,units:[...u],label:"",property:p,negative:c})})]})},Le=({heading:s,items:l})=>{const t=f.useSelectedBlockCurrentClasses(),n=d.useMemo(()=>{const i=p=>r.flatten(p.map(a=>a.styleType==="multiple"?r.map(a.options,"key"):a.property)),u=r.flatten(l.map(p=>p.styleType==="accordion"?i(p.items):p.styleType==="multiple"?r.map(p.options,"key"):p.property)),c=r.map(t,"property");return r.intersection(u,c).length>0},[t,l]);return e.jsxRuntimeExports.jsxs("details",{children:[e.jsxRuntimeExports.jsx("summary",{className:"my-px cursor-default rounded-md bg-background p-px px-2 text-[11px] text-foreground",children:e.jsxRuntimeExports.jsxs("div",{className:"inline",children:[s,n?e.jsxRuntimeExports.jsx("span",{className:`ml-1 mr-2 inline-block h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}):null]})}),e.jsxRuntimeExports.jsx("div",{className:"p-2",children:l.map(i=>i.styleType==="multiple"?e.jsxRuntimeExports.jsx(se,{...i},i.label):e.jsxRuntimeExports.jsx(z,{...i},i.label))})]})},$e=d.createContext({}),Y=({section:s})=>{const l=f.useSelectedBlockCurrentClasses(),t=d.useCallback((u=[])=>{const c={};for(let a=0;a<l.length;a++)c[l[a].property]=l[a].cls;let p=!0;for(const a in u)if(!r.has(c,a)||c[a]!==u[a]){p=!1;break}return p},[l]),n=d.useMemo(()=>{if(l.length>0&&s.heading==="Classes")return!0;const u=a=>r.flatten(a.map(h=>h.styleType==="multiple"?r.flatten(r.map(h.options,"key")):h.property)),c=r.flatten(s.items.map(a=>a.styleType==="accordion"?u(a.items):a.styleType==="multiple"?r.flatten(r.map(a.options,"key")):a.property)),p=r.map(l,"property");return r.intersection(c,p).length>0},[l,s.heading,s.items]),i=d.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx($e.Provider,{value:i,children:e.jsxRuntimeExports.jsxs($.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx($.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 ${n?"bg-blue-500":"bg-gray-300"}`}),s.heading]})}),e.jsxRuntimeExports.jsx($.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:d.Children.toArray(s.items.map(u=>r.has(u,"component")?d.createElement(u.component,{key:u.label}):r.has(u,"styleType")?u.styleType==="multiple"?e.jsxRuntimeExports.jsx(se,{...u},u.label):u.styleType==="accordion"&&t(u==null?void 0:u.conditions)?e.jsxRuntimeExports.jsx(Le,{...u},u.label):null:e.jsxRuntimeExports.jsx(z,{...u},u.label)))})]})})},Me=({item:s,index:l,canDelete:t,onChange:n,onRemove:i})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${t?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:u=>n(u,l),value:s.key,placeholder:"Key",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-1.5",children:[e.jsxRuntimeExports.jsx("input",{name:"value",onChange:u=>r.isEmpty(s.key)?{}:n(u,l),value:s.value,placeholder:"Value",className:"w-full rounded border-gray-300 bg-background p-0.5 pl-2 text-sm focus-visible:outline-0",autoComplete:"off",autoCapitalize:"off"}),e.jsxRuntimeExports.jsx(o.TrashIcon,{onClick:i,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),De=({section:s})=>{var j;const{setSyncState:l}=f.useSavePage(),t=f.useSelectedBlock(),[n,i]=d.useState([]),[u]=f.useSelectedStylingBlocks(),c=f.useUpdateBlocksPropsRealtime(),p=`${r.get(u,"0.prop")}_attrs`;X.useEffect(()=>{const b=r.map(r.get(t,p),(y,R)=>({key:R,value:y}));r.isEmpty(b)?i([]):i(b)},[r.get(t,p)]);const a=()=>i([...n,{key:"",value:""}]),h=b=>{const y=r.filter(n,(R,V)=>b!==V);m(y)},g=(b,y)=>{const R=[...n];R[y][b.target.name]=b.target.value,m(R)},m=X.useCallback((b=[])=>{const y={};r.forEach(b,R=>{r.isEmpty(R.key)||r.set(y,R.key,R.value)}),c([r.get(t,"_id")],{[p]:y}),l("UNSAVED")},[t,l,c,p]);return e.jsxRuntimeExports.jsxs($.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx($.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 ${r.isEmpty(r.get(t,p))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx($.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 ${!r.isEmpty(n)&&r.isEmpty((j=r.last(n))==null?void 0:j.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 b;!r.isEmpty(n)&&r.isEmpty((b=r.last(n))==null?void 0:b.key)||a()},children:[e.jsxRuntimeExports.jsx(o.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[r.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),X.Children.toArray(r.map(n,(b,y)=>{const R=n.length>0&&y<n.length-1;return e.jsxRuntimeExports.jsx(Me,{item:b,index:y,canDelete:R,onChange:g,onRemove:()=>h(y)})}))]})]})})]})};function qe(){const[s,l]=f.useStylingState(),{flexChild:t,gridChild:n}=f.useSelectedBlocksDisplayChild(),[,i]=ae.useAtom(f.advanceStylingOpenAtom),{t:u}=Q.useTranslation(),[c]=f.useSelectedStylingBlocks();return r.isEmpty(c)?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(o.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:u("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:()=>i(!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(E.Select,{defaultValue:s,onValueChange:p=>l(p),children:[e.jsxRuntimeExports.jsx(E.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(E.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(E.SelectContent,{children:[e.jsxRuntimeExports.jsx(E.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(E.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(xe.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs($.Accordion,{type:"multiple",className:"h-full w-full",children:[t&&e.jsxRuntimeExports.jsx(Y,{section:ye}),n?e.jsxRuntimeExports.jsx(Y,{section:be}):null,fe.map(p=>e.jsxRuntimeExports.jsx(Y,{section:p},p.heading)),e.jsxRuntimeExports.jsx(De,{section:{heading:"Attributes"}})]}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})}const Oe={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},We=()=>{const s=f.useSelectedBlock(),{t:l}=Q.useTranslation(),[t,n]=d.useState(""),[i,u]=d.useState({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),c=_.useThrottledCallback(a=>{const h=!r.get(i,"negative",!1),g=r.get(i,"cssProperty","");let m=parseFloat(i.dragStartValue);m=r.isNaN(m)?0:m;let j=Oe[i.dragUnit];(r.startsWith(g,"scale")||g==="opacity")&&(j=10);let y=(i.dragStartY-a.pageY)/j+m;h&&y<0&&(y=0),g==="opacity"&&y>1&&(y=1),i.onDrag(`${y}`),n(`${y}`)},[i],50),p=d.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${t}`),100),u({onDrag:a=>a,onDragEnd:a=>a,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,t,u]);return r.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(o.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:l("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsxs(re.Provider,{value:{setDragData:u},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:c,onMouseUp:()=>{p()},className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10 "}):null,e.jsxRuntimeExports.jsxs(M.Tabs,{defaultValue:"settings",className:"flex h-full w-full flex-col py-1",children:[e.jsxRuntimeExports.jsxs(M.TabsList,{className:"mx-1 grid grid-cols-2",children:[e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"settings",children:"Settings"}),e.jsxRuntimeExports.jsx(M.TabsTrigger,{value:"styling",children:"Styling"})]}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"settings",className:"no-scrollbar -mx-1 -mr-2 h-full flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(ge,{})}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"styling",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(qe,{})})]})]})};exports.default=We;