@chaibuilder/sdk 0.1.31 → 1.0.0

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 (85) hide show
  1. package/README.md +2 -2
  2. package/dist/AddBlocks-4f054351.cjs +3 -0
  3. package/dist/{AddBlocks-38b1e517.js → AddBlocks-f6836e71.js} +5 -4
  4. package/dist/{BrandingOptions-ec17d357.js → BrandingOptions-33e6da26.js} +6 -5
  5. package/dist/BrandingOptions-cfa79ffe.cjs +1 -0
  6. package/dist/{CanvasArea-282fbf23.js → CanvasArea-1e5fa968.js} +42 -43
  7. package/dist/CanvasArea-971b3ff8.cjs +46 -0
  8. package/dist/{CurrentPage-ce38e65d.js → CurrentPage-223cc3dd.js} +5 -4
  9. package/dist/CurrentPage-b2d12d83.cjs +1 -0
  10. package/dist/{ImagesPanel-3fb8087f.js → ImagesPanel-47ac13c3.js} +1 -1
  11. package/dist/{ImagesPanel-56ca0618.cjs → ImagesPanel-8b7a989d.cjs} +1 -1
  12. package/dist/Layers-860f5e42.cjs +1 -0
  13. package/dist/{Layers-b4f2a8f7.js → Layers-b2c5aa66.js} +48 -47
  14. package/dist/MarkAsGlobalBlock-1a3d5e53.cjs +1 -0
  15. package/dist/{MarkAsGlobalBlock-497a4830.js → MarkAsGlobalBlock-9b0135aa.js} +8 -7
  16. package/dist/{PagesPanel-b7da8397.js → PagesPanel-034efd4c.js} +8 -7
  17. package/dist/PagesPanel-2a80f9b2.cjs +1 -0
  18. package/dist/{ProjectPanel-c27080e1.js → ProjectPanel-3827a349.js} +7 -6
  19. package/dist/ProjectPanel-5deae7f1.cjs +1 -0
  20. package/dist/Settings-9f61cc69.cjs +1 -0
  21. package/dist/{Settings-d82fb59f.js → Settings-a2d4e9c2.js} +82 -79
  22. package/dist/SidePanels-0d276d29.cjs +1 -0
  23. package/dist/{SidePanels-c59bb181.js → SidePanels-b881185b.js} +33 -34
  24. package/dist/Topbar-68a0d125.cjs +1 -0
  25. package/dist/{Topbar-62ff7df2.js → Topbar-fda7588e.js} +38 -37
  26. package/dist/{UnsplashImages-fe480747.js → UnsplashImages-4edb97e7.js} +6 -5
  27. package/dist/UnsplashImages-98c085c2.cjs +1 -0
  28. package/dist/{UploadImages-b14bd152.js → UploadImages-52181c3e.js} +9 -8
  29. package/dist/UploadImages-61ef83ad.cjs +1 -0
  30. package/dist/{add-page-modal-6614ebd1.js → add-page-modal-38af4548.js} +11 -10
  31. package/dist/add-page-modal-fb51b45b.cjs +1 -0
  32. package/dist/confirm-alert-c1fdf1e4.js +35 -0
  33. package/dist/confirm-alert-e1ea5110.cjs +1 -0
  34. package/dist/core.cjs +1 -1
  35. package/dist/core.d.ts +2 -1
  36. package/dist/core.js +56 -55
  37. package/dist/delete-page-modal-305c49fd.cjs +1 -0
  38. package/dist/{delete-page-modal-9d19662a.js → delete-page-modal-a226ed3a.js} +18 -19
  39. package/dist/{form-046bcdbc.js → form-25e1af37.js} +1 -1
  40. package/dist/{form-2dc05f35.cjs → form-ea21db6c.cjs} +1 -1
  41. package/dist/{index-d3b417e1.cjs → index-6fc652ec.cjs} +41 -41
  42. package/dist/{index-962f7ecb.js → index-914d197c.js} +7239 -7070
  43. package/dist/{link-e71b94f1.cjs → link-24679521.cjs} +1 -1
  44. package/dist/{link-e3a788f7.js → link-57de608a.js} +2 -2
  45. package/dist/{page-viewer-459fd616.js → page-viewer-682940be.js} +17 -16
  46. package/dist/page-viewer-857a82f4.cjs +1 -0
  47. package/dist/{project-general-setting-71692f29.js → project-general-setting-0fa55bb9.js} +9 -8
  48. package/dist/project-general-setting-280ccd16.cjs +1 -0
  49. package/dist/project-seo-setting-6eef8387.cjs +1 -0
  50. package/dist/{project-seo-setting-639e4f33.js → project-seo-setting-d81fc1e3.js} +7 -6
  51. package/dist/server.cjs +1 -1
  52. package/dist/server.d.ts +4 -2
  53. package/dist/server.js +27 -23
  54. package/dist/{single-page-detail-224a0d7b.js → single-page-detail-8b715650.js} +11 -10
  55. package/dist/single-page-detail-b9c4ac1e.cjs +1 -0
  56. package/dist/ui.cjs +1 -1
  57. package/dist/ui.js +105 -106
  58. package/dist/useBuilderProp-21feb2da.js +296 -0
  59. package/dist/useBuilderProp-adacf42f.cjs +1 -0
  60. package/package.json +1 -1
  61. package/dist/AddBlocks-8195c6f3.cjs +0 -3
  62. package/dist/BrandingOptions-cb2e880c.cjs +0 -1
  63. package/dist/CanvasArea-1200639a.cjs +0 -46
  64. package/dist/CurrentPage-b3e9fd38.cjs +0 -1
  65. package/dist/Layers-e1e0edb7.cjs +0 -1
  66. package/dist/MarkAsGlobalBlock-f85fd1cc.cjs +0 -1
  67. package/dist/PagesPanel-04f09ca9.cjs +0 -1
  68. package/dist/ProjectPanel-3453331f.cjs +0 -1
  69. package/dist/Settings-33032723.cjs +0 -1
  70. package/dist/SidePanels-a78dbe46.cjs +0 -1
  71. package/dist/Topbar-e0455c3c.cjs +0 -1
  72. package/dist/UnsplashImages-ef3b6388.cjs +0 -1
  73. package/dist/UploadImages-10439fde.cjs +0 -1
  74. package/dist/add-page-modal-7863000f.cjs +0 -1
  75. package/dist/alert-dialog-4ce6ed22.cjs +0 -1
  76. package/dist/alert-dialog-ee98f47e.js +0 -64
  77. package/dist/confirm-alert-4f50caa7.cjs +0 -1
  78. package/dist/confirm-alert-f2a47cc7.js +0 -36
  79. package/dist/delete-page-modal-57188655.cjs +0 -1
  80. package/dist/page-viewer-ac99531f.cjs +0 -1
  81. package/dist/project-general-setting-317703c0.cjs +0 -1
  82. package/dist/project-seo-setting-6356c72f.cjs +0 -1
  83. package/dist/single-page-detail-9b1efc28.cjs +0 -1
  84. package/dist/useBuilderProp-5e57d0c8.cjs +0 -1
  85. package/dist/useBuilderProp-81a14920.js +0 -238
@@ -1,17 +1,17 @@
1
1
  import { j as e } from "./jsx-runtime-944c88e2.js";
2
2
  import { nth as k, startsWith as P, has as H, map as v, isUndefined as L, find as V, isEmpty as z, includes as F } from "lodash";
3
- import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHorizontalIcon as Y, BorderAllIcon as q, BorderTopIcon as Q, TableIcon as U, DropdownMenuIcon as W, RadiobuttonIcon as X, InputIcon as J, ButtonIcon as B, CheckboxIcon as Z, GroupIcon as ee, SpaceBetweenVerticallyIcon as se, ColumnsIcon as te, RowsIcon as y, TextIcon as C, SketchLogoIcon as ne, DividerHorizontalIcon as oe, CodeIcon as re, CursorTextIcon as ae, VideoIcon as ce, Link1Icon as le, HeadingIcon as ie, ImageIcon as de, TriangleRightIcon as xe, GlobeIcon as ue, CopyIcon as me, ClipboardCopyIcon as pe, ScissorsIcon as ge, ClipboardIcon as je, TrashIcon as he, DoubleArrowDownIcon as fe, StackIcon as Ie } from "@radix-ui/react-icons";
3
+ import { BoxModelIcon as G, BoxIcon as $, DragHandleHorizontalIcon as K, ViewHorizontalIcon as Y, BorderAllIcon as q, BorderTopIcon as Q, TableIcon as U, DropdownMenuIcon as W, RadiobuttonIcon as X, InputIcon as J, ButtonIcon as B, CheckboxIcon as Z, GroupIcon as ee, SpaceBetweenVerticallyIcon as se, ColumnsIcon as te, RowsIcon as y, TextIcon as C, SketchLogoIcon as oe, DividerHorizontalIcon as ne, CodeIcon as re, CursorTextIcon as ae, VideoIcon as ce, Link1Icon as le, HeadingIcon as ie, ImageIcon as de, TriangleRightIcon as xe, GlobeIcon as ue, CopyIcon as me, ClipboardCopyIcon as pe, ScissorsIcon as ge, ClipboardIcon as je, TrashIcon as he, DoubleArrowDownIcon as fe, StackIcon as Ie } from "@radix-ui/react-icons";
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 { A as ve, V as we, i as g, m as Se, q as De, n as Te, o as Ne, t as Me, D as Oe, W as Re, B as Ee, h as Ae, j as _e, d as Pe, X as He, b as Le, Y as Ve } from "./index-962f7ecb.js";
7
+ import { A as ve, V as we, i as g, m as Se, q as De, n as Te, o as Ne, t as Me, D as Oe, W as Re, B as Ee, h as Ae, j as _e, d as Pe, X as He, b as Le, Y as Ve } from "./index-914d197c.js";
8
8
  import { DatabaseIcon as ze } from "lucide-react";
9
9
  import { c as w } from "./utils-ac68b2c8.js";
10
10
  import { useMemo as Fe, lazy as Ge, useState as $e, Suspense as Ke, useCallback as S } from "react";
11
11
  import { S as Ye } from "./MODIFIERS-2f19c314.js";
12
12
  import { D as qe, b as Qe } from "./dialog-18207bef.js";
13
13
  import { C as Ue, a as We, b as Xe, c as d } from "./context-menu-e1c240ce.js";
14
- import { u as D } from "./useBuilderProp-81a14920.js";
14
+ import { u as D } from "./useBuilderProp-21feb2da.js";
15
15
  import { S as Je } from "./scroll-area-83bd9e8f.js";
16
16
  import { useAtom as Ze } from "jotai";
17
17
  import "clsx";
@@ -31,6 +31,7 @@ import "sonner";
31
31
  import "tailwind-merge";
32
32
  import "@radix-ui/react-dialog";
33
33
  import "@radix-ui/react-context-menu";
34
+ import "@radix-ui/react-alert-dialog";
34
35
  import "@radix-ui/react-slot";
35
36
  import "class-variance-authority";
36
37
  import "@radix-ui/react-tooltip";
@@ -54,9 +55,9 @@ const T = (s) => {
54
55
  case "CustomHTML":
55
56
  return /* @__PURE__ */ e.jsx(re, {});
56
57
  case "Divider":
57
- return /* @__PURE__ */ e.jsx(oe, {});
58
- case "Icon":
59
58
  return /* @__PURE__ */ e.jsx(ne, {});
59
+ case "Icon":
60
+ return /* @__PURE__ */ e.jsx(oe, {});
60
61
  case "List":
61
62
  return /* @__PURE__ */ e.jsx(y, {});
62
63
  case "Paragraph":
@@ -123,12 +124,12 @@ function es(s = "") {
123
124
  }
124
125
  const ss = (s) => {
125
126
  let t = "";
126
- return Object.keys(s).forEach((n) => {
127
- P(s[n], Ye) && (t = s[n]);
127
+ return Object.keys(s).forEach((o) => {
128
+ P(s[o], Ye) && (t = s[o]);
128
129
  }), t;
129
130
  }, ts = (s) => {
130
131
  var m;
131
- const [, t] = ve(), [n] = we(), { isSelected: r } = s, { id: a, data: c } = s.node, l = s.depth * 10, x = (i) => {
132
+ const [, t] = ve(), [o] = we(), { isSelected: r } = s, { id: a, data: c } = s.node, l = s.depth * 10, x = (i) => {
132
133
  i.stopPropagation(), s.onToggle(s.node.id);
133
134
  }, j = Be(a, s.isOpen, s.onToggle), u = Fe(() => {
134
135
  const i = ss(s.node.data);
@@ -145,7 +146,7 @@ const ss = (s) => {
145
146
  r ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800"
146
147
  ),
147
148
  onClick: (i) => {
148
- i.stopPropagation(), !n.includes(a) && s.onSelect(a);
149
+ i.stopPropagation(), !o.includes(a) && s.onSelect(a);
149
150
  },
150
151
  onContextMenu: () => s.onSelect(a),
151
152
  style: { paddingInlineStart: l },
@@ -177,17 +178,17 @@ const ss = (s) => {
177
178
  }
178
179
  )
179
180
  );
180
- }, ns = (s) => {
181
- var n;
181
+ }, os = (s) => {
182
+ var o;
182
183
  const { item: t } = s.monitorProps;
183
184
  return /* @__PURE__ */ e.jsxs("div", { className: "flex w-max items-center bg-blue-200 bg-opacity-30 p-1 font-semibold text-blue-700", children: [
184
- /* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(T, { type: (n = t == null ? void 0 : t.data) == null ? void 0 : n._type }) }),
185
+ /* @__PURE__ */ e.jsx("div", { className: "", children: /* @__PURE__ */ e.jsx(T, { type: (o = t == null ? void 0 : t.data) == null ? void 0 : o._type }) }),
185
186
  /* @__PURE__ */ e.jsx("div", { className: "ml-2 truncate text-[11px]", children: t.text })
186
187
  ] });
187
- }, os = (s) => {
188
+ }, ns = (s) => {
188
189
  const t = s.depth * 10 + 16;
189
190
  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 } });
190
- }, rs = Ge(() => import("./MarkAsGlobalBlock-497a4830.js")), as = () => {
191
+ }, rs = Ge(() => import("./MarkAsGlobalBlock-9b0135aa.js")), as = () => {
191
192
  const [s] = g(), [, t] = Te();
192
193
  return /* @__PURE__ */ e.jsxs(d, { className: "flex items-center gap-x-4 text-xs", onClick: () => t(s), children: [
193
194
  /* @__PURE__ */ e.jsx(ge, {}),
@@ -200,11 +201,11 @@ const ss = (s) => {
200
201
  " Copy"
201
202
  ] });
202
203
  }, ls = () => {
203
- const [s] = g(), t = Me(), n = Oe();
204
+ const [s] = g(), t = Me(), o = Oe();
204
205
  return /* @__PURE__ */ e.jsxs(
205
206
  d,
206
207
  {
207
- disabled: (n == null ? void 0 : n._type) === "Slot",
208
+ disabled: (o == null ? void 0 : o._type) === "Slot",
208
209
  className: "flex items-center gap-x-4 text-xs",
209
210
  onClick: () => t(s),
210
211
  children: [
@@ -217,9 +218,9 @@ const ss = (s) => {
217
218
  id: s = null,
218
219
  openMarkAsGlobalModal: t
219
220
  }) => {
220
- const [n] = g(), r = Se(), { pasteBlocks: a, canPaste: c } = De(), l = D("globalBlocksSupport", !1), x = S(() => {
221
- r(n);
222
- }, [n, r]);
221
+ const [o] = g(), r = Se(), { pasteBlocks: a, canPaste: c } = De(), l = D("globalBlocksSupport", !1), x = S(() => {
222
+ r(o);
223
+ }, [o, r]);
223
224
  return /* @__PURE__ */ e.jsxs(Xe, { className: "text-xs", children: [
224
225
  l && /* @__PURE__ */ e.jsx(d, { className: "flex items-center gap-x-4 border-b text-xs", onClick: t, children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-x-4", children: [
225
226
  /* @__PURE__ */ e.jsx(ue, {}),
@@ -246,9 +247,9 @@ const ss = (s) => {
246
247
  /* @__PURE__ */ e.jsx(ls, {})
247
248
  ] });
248
249
  }, ds = ({ children: s, id: t = null }) => {
249
- const [n, r] = $e(!1);
250
+ const [o, r] = $e(!1);
250
251
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
251
- /* @__PURE__ */ e.jsx(qe, { open: n, onOpenChange: r, children: n && /* @__PURE__ */ e.jsx(Qe, { children: /* @__PURE__ */ e.jsx(Ke, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-96 w-full animate-pulse bg-gray-200" }), children: /* @__PURE__ */ e.jsx(rs, { closeModal: () => r(!1), id: t }) }) }) }),
252
+ /* @__PURE__ */ e.jsx(qe, { open: o, onOpenChange: r, children: o && /* @__PURE__ */ e.jsx(Qe, { children: /* @__PURE__ */ e.jsx(Ke, { fallback: /* @__PURE__ */ e.jsx("div", { className: "h-96 w-full animate-pulse bg-gray-200" }), children: /* @__PURE__ */ e.jsx(rs, { closeModal: () => r(!1), id: t }) }) }) }),
252
253
  /* @__PURE__ */ e.jsxs(Ue, { children: [
253
254
  /* @__PURE__ */ e.jsx(We, { children: s }),
254
255
  /* @__PURE__ */ e.jsx(is, { id: t, openMarkAsGlobalModal: () => r(!0) })
@@ -257,8 +258,8 @@ const ss = (s) => {
257
258
  }, xs = () => {
258
259
  const { addCoreBlock: s } = Re(), t = D("getExternalPredefinedBlock");
259
260
  return S(
260
- async (n) => {
261
- const { block: r, dropTargetId: a, relativeIndex: c } = n;
261
+ async (o) => {
262
+ const { block: r, dropTargetId: a, relativeIndex: c } = o;
262
263
  if (H(r, "format")) {
263
264
  const l = await t(r);
264
265
  return s({ blocks: l }, a === 0 ? null : a, c);
@@ -270,46 +271,46 @@ const ss = (s) => {
270
271
  };
271
272
  function us(s) {
272
273
  return v(s, (t) => {
273
- const { data: n } = t;
274
+ const { data: o } = t;
274
275
  return {
275
- ...n,
276
+ ...o,
276
277
  _parent: t.parent === 0 ? null : t.parent
277
278
  };
278
279
  });
279
280
  }
280
- const Ws = () => {
281
- const s = Ee(), [t] = Ae(), [n, r, a] = g(), [, c] = _e(), { t: l } = Ce(), { createSnapshot: x } = Pe(), j = He(), u = xs(), [, m] = Ze(Le), i = async (o, p) => {
282
- const { dragSource: f, destinationIndex: I, relativeIndex: b, dropTargetId: E, monitor: A } = p, _ = us(o);
281
+ const Xs = () => {
282
+ const s = Ee(), [t] = Ae(), [o, r, a] = g(), [, c] = _e(), { t: l } = Ce(), { createSnapshot: x } = Pe(), j = He(), u = xs(), [, m] = Ze(Le), i = async (n, p) => {
283
+ const { dragSource: f, destinationIndex: I, relativeIndex: b, dropTargetId: E, monitor: A } = p, _ = us(n);
283
284
  t(_), f ? x() : (await u({
284
285
  block: A.getItem(),
285
286
  dropTargetId: E,
286
287
  destinationIndex: I,
287
288
  relativeIndex: b
288
289
  }), m(!1));
289
- }, N = v(s, (o) => ({
290
- id: o._id,
291
- text: o._type,
292
- parent: o._parent || 0,
293
- droppable: !L(V(s, { _parent: o._id })),
294
- data: o
290
+ }, N = v(s, (n) => ({
291
+ id: n._id,
292
+ text: n._type,
293
+ parent: n._parent || 0,
294
+ droppable: !L(V(s, { _parent: n._id })),
295
+ data: n
295
296
  })), M = () => {
296
297
  r([]), c([]);
297
298
  }, [{ isOver: h }, O] = be(() => ({
298
299
  accept: ["CHAI_BLOCK"],
299
- collect: (o) => ({
300
- canDrop: o.canDrop(),
301
- isOver: o.isOver()
300
+ collect: (n) => ({
301
+ canDrop: n.canDrop(),
302
+ isOver: n.isOver()
302
303
  }),
303
- drop: (o) => {
304
+ drop: (n) => {
304
305
  (async () => (await u({
305
- block: o,
306
+ block: n,
306
307
  dropTargetId: "",
307
308
  destinationIndex: 0,
308
309
  relativeIndex: 0
309
310
  }), m(!1)))();
310
311
  }
311
- })), { isDragging: R } = ke((o) => ({
312
- isDragging: o.isDragging()
312
+ })), { isDragging: R } = ke((n) => ({
313
+ isDragging: n.isDragging()
313
314
  }));
314
315
  return /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsx(
315
316
  "div",
@@ -336,21 +337,21 @@ const Ws = () => {
336
337
  extraAcceptTypes: ["CHAI_BLOCK"],
337
338
  tree: N,
338
339
  rootId: 0,
339
- render: (o, { depth: p, isOpen: f, onToggle: I }) => /* @__PURE__ */ e.jsx(ds, { id: o.id, children: /* @__PURE__ */ e.jsx(
340
+ render: (n, { depth: p, isOpen: f, onToggle: I }) => /* @__PURE__ */ e.jsx(ds, { id: n.id, children: /* @__PURE__ */ e.jsx(
340
341
  ts,
341
342
  {
342
343
  onSelect: (b) => {
343
344
  c([]), r([b]);
344
345
  },
345
- isSelected: F(n, o.id),
346
- node: o,
346
+ isSelected: F(o, n.id),
347
+ node: n,
347
348
  depth: p,
348
349
  isOpen: f,
349
350
  onToggle: I,
350
351
  toggleIds: a
351
352
  }
352
353
  ) }),
353
- dragPreviewRender: (o) => /* @__PURE__ */ e.jsx(ns, { monitorProps: o }),
354
+ dragPreviewRender: (n) => /* @__PURE__ */ e.jsx(os, { monitorProps: n }),
354
355
  onDrop: i,
355
356
  classes: {
356
357
  root: "h-full pt-2",
@@ -363,12 +364,12 @@ const Ws = () => {
363
364
  canDrop: Ve,
364
365
  dropTargetOffset: 2,
365
366
  enableAnimateExpand: !0,
366
- placeholderRender: (o, { depth: p }) => /* @__PURE__ */ e.jsx(os, { node: o, depth: p })
367
+ placeholderRender: (n, { depth: p }) => /* @__PURE__ */ e.jsx(ns, { node: n, depth: p })
367
368
  }
368
369
  ) })
369
370
  }
370
371
  ) });
371
372
  };
372
373
  export {
373
- Ws as default
374
+ Xs as default
374
375
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),u=require("@radix-ui/react-icons"),o=require("react"),i=require("./useBuilderProp-adacf42f.cjs"),c=require("./index-6fc652ec.cjs");require("react-i18next");const x=require("lodash");require("@radix-ui/react-alert-dialog");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("jotai");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("lucide-react");const m=({id:t=null,closeModal:s})=>{const l=c.useMarkAsGlobalBlock(),[r,a]=o.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(u.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,15 +1,16 @@
1
1
  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
- import { B as e } from "./useBuilderProp-81a14920.js";
5
- import { a1 as c } from "./index-962f7ecb.js";
4
+ import { B as e } from "./useBuilderProp-21feb2da.js";
5
+ import { a1 as c } from "./index-914d197c.js";
6
6
  import "react-i18next";
7
7
  import { capitalize as p } from "lodash";
8
- import "@radix-ui/react-slot";
9
- import "class-variance-authority";
8
+ import "@radix-ui/react-alert-dialog";
10
9
  import "./utils-ac68b2c8.js";
11
10
  import "clsx";
12
11
  import "tailwind-merge";
12
+ import "@radix-ui/react-slot";
13
+ import "class-variance-authority";
13
14
  import "@radix-ui/react-tooltip";
14
15
  import "@radix-ui/react-toast";
15
16
  import "jotai";
@@ -28,9 +29,9 @@ import "himalaya";
28
29
  import "redux-undo";
29
30
  import "@react-hookz/web";
30
31
  import "@chaibuilder/blocks";
31
- import "lucide-react";
32
32
  import "sonner";
33
- const Q = ({ id: o = null, closeModal: i }) => {
33
+ import "lucide-react";
34
+ const T = ({ id: o = null, closeModal: i }) => {
34
35
  const r = c(), [t, a] = n("");
35
36
  return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
36
37
  /* @__PURE__ */ l.jsx("h1", { className: "text-lg font-bold", children: "Mark as Global" }),
@@ -75,5 +76,5 @@ const Q = ({ id: o = null, closeModal: i }) => {
75
76
  ] });
76
77
  };
77
78
  export {
78
- Q as default
79
+ T as default
79
80
  };
@@ -1,7 +1,7 @@
1
1
  import { j as t } from "./jsx-runtime-944c88e2.js";
2
2
  import i, { Suspense as p } from "react";
3
3
  import { sortBy as a, filter as d, get as n } from "lodash";
4
- import { Q as l, R as c } from "./index-962f7ecb.js";
4
+ import { Q as l, R as c } from "./index-914d197c.js";
5
5
  import "./MODIFIERS-2f19c314.js";
6
6
  import "clsx";
7
7
  import "@radix-ui/react-scroll-area";
@@ -13,11 +13,12 @@ import "react-i18next";
13
13
  import "flagged";
14
14
  import "react-dnd";
15
15
  import "@minoru/react-dnd-treeview";
16
- import "./useBuilderProp-81a14920.js";
17
- import "@radix-ui/react-slot";
18
- import "class-variance-authority";
16
+ import "./useBuilderProp-21feb2da.js";
17
+ import "@radix-ui/react-alert-dialog";
19
18
  import "./utils-ac68b2c8.js";
20
19
  import "tailwind-merge";
20
+ import "@radix-ui/react-slot";
21
+ import "class-variance-authority";
21
22
  import "@radix-ui/react-tooltip";
22
23
  import "@radix-ui/react-icons";
23
24
  import "@radix-ui/react-toast";
@@ -28,9 +29,9 @@ import "himalaya";
28
29
  import "redux-undo";
29
30
  import "@react-hookz/web";
30
31
  import "@chaibuilder/blocks";
31
- import "lucide-react";
32
32
  import "sonner";
33
- const x = i.lazy(() => import("./add-page-modal-6614ebd1.js")), g = i.lazy(() => import("./page-viewer-459fd616.js")), O = () => {
33
+ import "lucide-react";
34
+ const x = i.lazy(() => import("./add-page-modal-38af4548.js")), g = i.lazy(() => import("./page-viewer-682940be.js")), U = () => {
34
35
  const { data: o = [], isLoading: e } = l(), { data: r } = c(), m = a(d(o, { type: "STATIC" }), (s) => n(s, "uuid") === (r == null ? void 0 : r.homepage) ? 0 : 1);
35
36
  return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
36
37
  /* @__PURE__ */ t.jsxs("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: [
@@ -42,5 +43,5 @@ const x = i.lazy(() => import("./add-page-modal-6614ebd1.js")), g = i.lazy(() =>
42
43
  ] });
43
44
  };
44
45
  export {
45
- O as default
46
+ U as default
46
47
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),i=require("react"),s=require("lodash"),u=require("./index-6fc652ec.cjs");require("./MODIFIERS-4716c669.cjs");require("clsx");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-adacf42f.cjs");require("@radix-ui/react-alert-dialog");require("./utils-3c452dd0.cjs");require("tailwind-merge");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-icons");require("@radix-ui/react-toast");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("lucide-react");const x=i.lazy(()=>Promise.resolve().then(()=>require("./add-page-modal-fb51b45b.cjs"))),q=i.lazy(()=>Promise.resolve().then(()=>require("./page-viewer-857a82f4.cjs"))),c=()=>{const{data:t=[],isLoading:n}=u.usePages(),{data:r}=u.useProject(),o=s.sortBy(s.filter(t,{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 p } from "./accordion-c0176dc5.js";
5
- import { S as h, R as g } from "./index-962f7ecb.js";
5
+ import { S as h, R as g } from "./index-914d197c.js";
6
6
  import "@radix-ui/react-accordion";
7
7
  import "@radix-ui/react-icons";
8
8
  import "./utils-ac68b2c8.js";
@@ -18,7 +18,8 @@ import "react-i18next";
18
18
  import "flagged";
19
19
  import "react-dnd";
20
20
  import "@minoru/react-dnd-treeview";
21
- import "./useBuilderProp-81a14920.js";
21
+ import "./useBuilderProp-21feb2da.js";
22
+ import "@radix-ui/react-alert-dialog";
22
23
  import "@radix-ui/react-slot";
23
24
  import "class-variance-authority";
24
25
  import "@radix-ui/react-tooltip";
@@ -30,13 +31,13 @@ import "himalaya";
30
31
  import "redux-undo";
31
32
  import "@react-hookz/web";
32
33
  import "@chaibuilder/blocks";
33
- import "lucide-react";
34
34
  import "sonner";
35
- const N = i.lazy(() => import("./project-general-setting-71692f29.js")), S = i.lazy(() => import("./project-seo-setting-639e4f33.js")), d = /* @__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) ? {
35
+ import "lucide-react";
36
+ const N = i.lazy(() => import("./project-general-setting-0fa55bb9.js")), S = i.lazy(() => import("./project-seo-setting-d81fc1e3.js")), d = /* @__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) ? {
36
37
  ...t,
37
38
  seoData: { title: "", description: "", image: "" }
38
39
  } : t;
39
- function re() {
40
+ function se() {
40
41
  const t = h(), { data: o } = g(), [r, a] = i.useState(
41
42
  u(o || {})
42
43
  ), s = x(r);
@@ -65,5 +66,5 @@ function re() {
65
66
  ] });
66
67
  }
67
68
  export {
68
- re as default
69
+ se as default
69
70
  };
@@ -0,0 +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-6fc652ec.cjs");require("@radix-ui/react-accordion");require("@radix-ui/react-icons");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("./MODIFIERS-4716c669.cjs");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("jotai");require("i18next");require("react-i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("./useBuilderProp-adacf42f.cjs");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("react-hotkeys-hook");require("flat-to-nested");require("./html-to-json-aadcbf66.cjs");require("himalaya");require("redux-undo");require("@react-hookz/web");require("@chaibuilder/blocks");require("sonner");require("lucide-react");const d=r.lazy(()=>Promise.resolve().then(()=>require("./project-general-setting-280ccd16.cjs"))),m=r.lazy(()=>Promise.resolve().then(()=>require("./project-seo-setting-6eef8387.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:u}=a.useProject(),[i,o]=r.useState(l(u||{})),n=r.useRef(i);return r.useEffect(()=>()=>{x.isEqual(u,n.current)||t.mutate(n.current,{onSuccess:()=>o(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:o})})})]}),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:o})})})]})]})})]})}exports.default=j;
@@ -0,0 +1 @@
1
+ "use strict";var he=Object.create;var se=Object.defineProperty;var ye=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var je=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var Re=(s,o,r,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of be(o))!fe.call(s,i)&&i!==r&&se(s,i,{get:()=>o[i],enumerable:!(n=ye(o,i))||n.enumerable});return s};var ve=(s,o,r)=>(r=s!=null?he(je(s)):{},Re(o||!s||!s.__esModule?se(r,"default",{value:s,enumerable:!0}):r,s));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-5c3ac4f7.cjs"),x=require("react"),G=require("@react-hookz/web"),t=require("lodash"),ae=require("react-i18next"),u=require("@radix-ui/react-icons"),M=require("./tabs-860e37aa.cjs"),Ee=require("@rjsf/core"),we=require("@rjsf/validator-ajv8"),f=require("./index-6fc652ec.cjs"),z=require("@chaibuilder/blocks"),K=require("lucide-react"),pe=require("./useChaiExternalData-a90e8aac.cjs"),E=require("./useBuilderProp-adacf42f.cjs"),$=require("./dialog-170eaad9.cjs"),Z=require("./popover-7cb9079b.cjs"),P=require("./command-b1103666.cjs"),T=require("./accordion-0afd8143.cjs"),Y=require("./link-24679521.cjs"),Ce=require("jotai"),ke=require("react-autosuggest"),Ne=require("fuse.js"),O=require("./html-to-json-aadcbf66.cjs"),ee=require("./label-167415e5.cjs"),Se=require("./MODIFIERS-4716c669.cjs"),Te=require("./scroll-area-bb343b86.cjs"),C=require("./select-0e32300c.cjs");require("@radix-ui/react-tabs");require("./utils-3c452dd0.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-scroll-area");require("react-dom");require("@floating-ui/react-dom");require("i18next");require("flagged");require("react-dnd");require("@minoru/react-dnd-treeview");require("react-hotkeys-hook");require("flat-to-nested");require("redux-undo");require("sonner");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-slot");require("class-variance-authority");require("@radix-ui/react-tooltip");require("@radix-ui/react-toast");require("@radix-ui/react-dialog");require("@radix-ui/react-popover");require("cmdk");require("@radix-ui/react-accordion");require("react-icons-picker");require("./ImagesPanel-8b7a989d.cjs");require("react-quill");require("himalaya");require("@radix-ui/react-label");require("@radix-ui/react-select");function Ie(s){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(o,r,n.get?n:{enumerable:!0,get:()=>s[r]})}}return o.default=s,Object.freeze(o)}const X=Ie(x),Be=x.lazy(()=>import("react-json-view"));function Ae(s){const o=[],r={};function n(i,a){t.forEach(a,(d,p)=>{const l=i?`${i}.${p}`:p,m=t.isArray(d)?"list":typeof d;o.push(l),r[l]=m==="string"?"text":m==="object"?"model":m,m==="object"&&!t.isArray(d)&&n(l,d)})}return n("",t.omit(s,["styles","_type","_id","_name","_bindings"])),{paths:o,pathsType:r}}const J=({data:s,fullView:o})=>{if(!s)return null;const r=typeof s;return o?typeof s=="object"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"h-3"}),e.jsxRuntimeExports.jsx(f.ErrorBoundary,{children:e.jsxRuntimeExports.jsx(Be,{style:{maxHeight:"40vh",overflowY:"auto"},name:"Content",enableClipboard:!1,displayObjectSize:!1,displayDataTypes:!1,src:s,collapsed:!0})})]}):e.jsxRuntimeExports.jsxs("div",{className:"text-gray-800/50 text-[12px] leading-4 w-full max-h-36 overflow-x-hidden overflow-y-auto",children:[e.jsxRuntimeExports.jsx("span",{className:"font-medium text-gray-800/80",children:"Content: "}),s]}):e.jsxRuntimeExports.jsx("div",{className:"text-[10px] text-gray-800/50 leading-3 whitespace-nowrap overflow-hidden w-full",children:t.truncate(r==="object"?JSON.stringify(s):s,{length:40})})},re=({type:s,value:o="",setValue:r,data:n,onChange:i,dataType:a,appliedBindings:d})=>{const{paths:p,pathsType:l}=Ae(n),m=s==="PROP"?z.getBlockComponent(n==null?void 0:n._type):{},g=s==="PROP",[c,b]=x.useState(!1),y=x.useMemo(()=>s==="PROP"?p.filter(h=>!t.includes(d,h)&&t.get(m,`props.${t.first(t.split(h,"."))}.binding`)):p.filter(h=>a===t.get(l,h,"")),[s,p,d,a,m]);return x.useEffect(()=>{o&&i(o)},[o,s]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:t.startCase(t.toLower(s))}),e.jsxRuntimeExports.jsxs(Z.Popover,{open:c,onOpenChange:b,children:[e.jsxRuntimeExports.jsx(Z.PopoverTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx(E.Button,{variant:"outline",size:"sm",className:` ${t.isEmpty(o)?"bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white w-44 justify-center":"min-w-[350px] justify-between items-center"}`,children:o?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{className:"text-sm pr-8",children:[g&&e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 mr-2 rounded-full",children:t.startCase(a)}),o]}),e.jsxRuntimeExports.jsx("span",{className:"text-[9px] text-blue-400 underline cursor-pointer hover:text-blue-700",children:"Change"})]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["+ Set ",t.startCase(t.toLower(s))]})})}),e.jsxRuntimeExports.jsx(Z.PopoverContent,{className:"p-0 z-[999] min-w-[300px]",side:"right",align:"start",children:e.jsxRuntimeExports.jsxs(P.Command,{children:[e.jsxRuntimeExports.jsx(P.CommandInput,{placeholder:`Choose ${t.toLower(s)}...`}),e.jsxRuntimeExports.jsxs(P.CommandList,{children:[e.jsxRuntimeExports.jsx(P.CommandEmpty,{children:"No results found."}),e.jsxRuntimeExports.jsx(P.CommandGroup,{children:t.map(y,h=>e.jsxRuntimeExports.jsxs(P.CommandItem,{value:h,className:`cursor-pointer ${g?"flex justify-between items-center":"flex flex-col items-start justify-start"}`,onSelect:R=>{r(t.find(y,N=>N===R)||null),b(!1)},children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx(K.Check,{className:`w-4 h-4 text-green-500 ${o===h?"":"opacity-0"}`}),h]}),g?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("span",{className:"text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 rounded-full",children:t.startCase(t.get(l,h,""))})}):e.jsxRuntimeExports.jsx("div",{className:"pl-6",children:e.jsxRuntimeExports.jsx(J,{data:t.get(n,h)})})]},h))})]})]})})]})]}),!g&&!t.isEmpty(o)&&e.jsxRuntimeExports.jsx("div",{className:"pt-2",children:e.jsxRuntimeExports.jsx(J,{data:t.get(n,o,""),fullView:!0})})]})},He=({appliedBindings:s=[],onAddBinding:o,editMode:r,item:n})=>{const[i,a]=x.useState(r?n.key:""),[d,p]=x.useState(r?n.value:""),l=f.useSelectedBlock(),[m]=pe.useChaiExternalData(),g=x.useCallback((y,h)=>{if(t.isEmpty(y))return"";{const R=t.get(h==="PROP"?l:m,y,"");if(t.isArray(R))return"list";const N=typeof R;return N==="string"?"text":N==="object"?"model":N}},[l,m]),[c,b]=x.useState(r?g(n.key,"PROP"):"");return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs($.DialogHeader,{children:[e.jsxRuntimeExports.jsx($.DialogTitle,{children:"Add Data Binding"}),e.jsxRuntimeExports.jsx($.DialogDescription,{className:"text-xs",children:"Add prop and path of binding. Click save when you're done."})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-1 relative",children:[e.jsxRuntimeExports.jsx(re,{type:"PROP",isDisabled:!1,placeholder:"Enter prop key",value:i,setValue:a,onChange:y=>{const h=g(y,"PROP");a(y),c!==h&&p(""),b(h)},data:l,dataType:c,appliedBindings:s}),e.jsxRuntimeExports.jsx("div",{className:"h-2"}),e.jsxRuntimeExports.jsx(re,{type:"PATH",isDisabled:t.isEmpty(i),placeholder:"Enter data path",value:d,setValue:p,onChange:y=>{const h=g(y,"PATH");p(c===h?y:"")},data:m,dataType:c,appliedBindings:s})]}),e.jsxRuntimeExports.jsx($.DialogFooter,{children:e.jsxRuntimeExports.jsx(E.Button,{type:"submit",className:"mt-4",disabled:t.isEmpty(i)&&t.isEmpty(d),onClick:()=>o({key:i,value:d}),children:"Save"})})]})},ue=({children:s,onAddBinding:o,appliedBindings:r,editMode:n=!0,item:i={}})=>{const[a,d]=x.useState(!1);return e.jsxRuntimeExports.jsxs($.Dialog,{children:[e.jsxRuntimeExports.jsx($.DialogTrigger,{asChild:!0,onClick:()=>d(!0),children:s}),a&&e.jsxRuntimeExports.jsx($.DialogContent,{children:e.jsxRuntimeExports.jsx(He,{item:i,editMode:n,appliedBindings:r,onAddBinding:p=>{o(p),d(!1)}})})]})},Ve=({item:s,onAddBinding:o,onRemove:r,selectedBlock:n,dataProvider:i,appliedBindings:a})=>{const[d,p]=x.useState("string"),l=(m,g)=>{if(t.isEmpty(m))return"";{const c=t.get(g==="PROP"?n:i,m,"");if(t.isArray(c))return"list";const b=typeof c;return b==="string"?"text":b==="object"?"model":b}};return x.useEffect(()=>p(()=>l(s.key,"PROP")),[s.key]),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col border border-gray-200 relative rounded-md p-2",children:[e.jsxRuntimeExports.jsx("div",{className:"text-gray-500 font-normal text-sm",children:s.key}),e.jsxRuntimeExports.jsx("div",{className:"font-medium leading-5",children:s.value}),e.jsxRuntimeExports.jsx(J,{data:t.get(i,s.value,"")}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[e.jsxRuntimeExports.jsx(ue,{editMode:!0,onAddBinding:o,appliedBindings:a,item:s,children:e.jsxRuntimeExports.jsx(K.EditIcon,{className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-blue-400 hover:text-white border-blue-400 p-1 text-blue-400 hover:scale-105 duration-200"})}),e.jsxRuntimeExports.jsx(K.TrashIcon,{onClick:()=>r(),className:"h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-red-400 hover:text-white border-red-400 p-1 text-red-400 hover:scale-105 duration-200"})]}),!t.isEmpty(d)&&!t.isEmpty(s.key)&&e.jsxRuntimeExports.jsx("div",{className:"mt-px absolute right-0 top-1 text-purple-600 text-[10px] flex items-center font-medium h-4 px-2 rounded-full",children:t.startCase(d)})]})},De=({bindingData:s,onChange:o})=>{const r=f.useSelectedBlock(),[n]=pe.useChaiExternalData(),i=z.getChaiDataProviders(),[a,d]=x.useState(t.map(s,(c,b)=>({key:b,value:c})));x.useEffect(()=>{d(t.map(s,(c,b)=>({key:b,value:c})))},[r==null?void 0:r._id]);const p=x.useMemo(()=>{if(t.isEmpty(n))return!0;if(t.isEmpty(a))return!1;const c=t.last(a);return t.isEmpty(c==null?void 0:c.key)||t.isEmpty(c==null?void 0:c.value)},[n,a]),l=c=>{const b=t.filter(a,y=>y.key!==c.key);d([...b,c]),g([...b,c])},m=c=>{const b=t.filter(a,(y,h)=>c!==h);g([...b])},g=x.useCallback((c=[])=>{if(d(c),t.isEmpty(c)){o({});return}const b={};t.forEach(c,y=>{!t.isEmpty(y==null?void 0:y.key)&&!t.isEmpty(y==null?void 0:y.value)&&t.set(b,y.key,y.value)}),o(b)},[r]);return t.isEmpty(i)?e.jsxRuntimeExports.jsx("div",{className:"w-full flex items-center justify-center",children:e.jsxRuntimeExports.jsxs("p",{className:"text-gray-500 mb-1.5 text-xs",children:["You have no data providers registered. Please add a data provider to your project. ",e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsx("a",{className:"text-blue-500",href:"https://chaibuilder.com/docs/registering-data-providers",target:"_blank",children:"Learn more"})]})}):e.jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[t.map(a,(c,b)=>e.jsxRuntimeExports.jsx(Ve,{item:c,onAddBinding:l,onRemove:()=>m(b),selectedBlock:r,dataProvider:n,appliedBindings:t.map(a,"key")},c.key)),e.jsxRuntimeExports.jsxs(E.Tooltip,{delayDuration:200,children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{className:"w-full",children:e.jsxRuntimeExports.jsx(ue,{appliedBindings:t.map(a,"key"),onAddBinding:l,children:e.jsxRuntimeExports.jsx("button",{disabled:p,className:`w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${p?"cursor-not-allowed bg-gray-200 text-gray-400":"bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"}`,children:t.isEmpty(n)?e.jsxRuntimeExports.jsx("small",{className:"text-gray-500 text-[9.5px]",children:"No data provider has been set up for this page"}):"+ Add Data Binding"})})}),p&&e.jsxRuntimeExports.jsx(E.TooltipContent,{sideOffset:-55,className:"text-[11px]",children:t.isEmpty(n)?"No data provider has been set up for this page.":"Complete last added data binding to add more"})]})]})},Le=De,Pe=()=>e.jsxRuntimeExports.jsx("div",{className:"text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100",children:"Data binding is set for this field"}),oe=({createHistorySnapshot:s,properties:o,formData:r,onChange:n})=>{const[i]=f.useActiveLanguage(),a={type:"object",properties:{}},d={};return Object.keys(o).forEach(p=>{const l=o[p];if(t.includes(["slot","styles"],l.type))return;const m=t.get(l,"i18n",!1)?`${p}-${i}`:p;a.properties[m]=f.getBlockJSONFromSchemas(l,i),d[m]=f.getBlockJSONFromUISchemas(l,i)}),e.jsxRuntimeExports.jsx(Ee,{widgets:{binding:Pe,richtext:Y.RichTextEditorField,icon:Y.IconPickerField,image:Y.ImagePickerField},fields:{link:Y.LinkField},idSeparator:".",autoComplete:"off",omitExtraData:!1,liveOmit:!1,liveValidate:!0,validator:we,uiSchema:d,onBlur:s,schema:a,formData:r,onChange:n})};function $e(){const s=f.useSelectedBlock(),{createSnapshot:o}=f.useCanvasHistory(),r=f.useUpdateBlocksPropsRealtime(),n=z.getBlockComponent(s._type),i={...s},a=()=>o(),d=({formData:g},c)=>{if(c){const b=c.replace("root.","");r([s._id],{[b]:t.get(g,b)})}},p={_name:z.SingleLineText({title:"Name",default:t.get(s,"_name",s._type)})},l=t.keys(t.get(i,"_bindings",{})),m=x.useMemo(()=>{const g=t.cloneDeep(t.get(n,"props",{}));return t.each(l,c=>{delete g[c]}),g},[n,l]);return e.jsxRuntimeExports.jsxs("div",{className:"overflow-x-hidden",children:[e.jsxRuntimeExports.jsx(oe,{onChange:d,createHistorySnapshot:a,formData:i,properties:p}),e.jsxRuntimeExports.jsx("hr",{className:"mt-4"}),e.jsxRuntimeExports.jsxs(T.Accordion,{type:"multiple",defaultValue:["STATIC","BINDING"],className:"h-full w-full",children:[e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:"BINDING",children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(s,"_bindings",{}))?"bg-gray-300":"bg-blue-500"}`}),"Data Binding"]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"pt-4 px-4",children:e.jsxRuntimeExports.jsx(Le,{bindingData:t.get(i,"_bindings",{}),onChange:g=>{d({formData:{...i,_bindings:g}},"root._bindings")}})})]}),e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:"STATIC",children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline bg-gray-100 ml-1",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:"h-[8px] w-[8px] rounded-full bg-blue-500"}),"Static Content"]})}),e.jsxRuntimeExports.jsxs(T.AccordionContent,{className:"pt-4",children:[t.isEmpty(l)?"":e.jsxRuntimeExports.jsxs("div",{className:"text-xs mx-4 border rounded-sm p-1 mb-1 mt-0 border-orange-500 text-orange-500 bg-orange-100",children:["Data binding is set for ",e.jsxRuntimeExports.jsx("b",{children:t.map(l,t.capitalize).join(", ")})," ",l.length===1?"property":"properties",". Remove data binding to edit static content."]}),e.jsxRuntimeExports.jsx(oe,{onChange:d,createHistorySnapshot:a,formData:i,properties:m})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:"pb-60"})]})}const ne=new Ne(O.ALL_TW_CLASSES,{isCaseSensitive:!1,threshold:.2,minMatchCharLength:2,keys:["name"]});function Me(){var B;const[s]=f.useSelectedStylingBlocks(),o=f.useSelectedBlock(),r=f.useAddClassesToBlocks(),n=f.useRemoveClassesFromBlocks(),[i]=f.useSelectedBlockIds(),[a,d]=x.useState(""),p=(B=t.first(s))==null?void 0:B.prop,l=t.reject((t.get(o,p,"").replace(Se.STYLES_KEY,"").split(",").pop()||"").split(" "),t.isEmpty),m=()=>{const w=a.trim().toLowerCase().replace(/ +(?= )/g,"").split(" ");r(i,w,!0),d("")},[g,c]=x.useState([]),b=({value:w})=>{const V=w.trim().toLowerCase(),A=V.match(/.+:/g);let k=[];if(A&&A.length>0){const[H]=A,L=V.replace(H,"");k=ne.search(L).map(j=>({...j,item:{...j.item,name:H+j.item.name}}))}else k=ne.search(V);c(t.map(k,"item"))},y=()=>{c([])},h=w=>w.name,R=w=>e.jsxRuntimeExports.jsx("div",{className:"rounded-md p-1",children:w.name}),N={autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,placeholder:"Enter class name",value:a,onKeyDown:w=>{w.key==="Enter"&&a.trim()!==""&&m()},onChange:(w,{newValue:V})=>d(V),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(ee.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(ke,{suggestions:g,onSuggestionsFetchRequested:b,onSuggestionsClearRequested:y,getSuggestionValue:h,renderSuggestion:R,inputProps:N,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(E.Button,{variant:"outline",className:"h-6 border-gray-700",onClick:m,disabled:a.trim()==="",size:"sm",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-wrap gap-2",children:[t.isEmpty(l)&&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(l.map(w=>e.jsxRuntimeExports.jsxs("div",{className:"group relative flex cursor-default items-center gap-x-1 rounded-full border border-blue-600 bg-blue-500 p-px px-1.5 text-[11px] text-white hover:border-blue-900",children:[w,e.jsxRuntimeExports.jsx(u.Cross2Icon,{onClick:()=>n(i,[w]),className:"invisible absolute right-1 hover:text-white group-hover:visible group-hover:cursor-pointer"})]},w)))]})]})}const I=["px","%","em","rem","ch","vh","vw"],Oe={heading:"Flex Child",items:[{type:"arbitrary",label:"Basis",units:I,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"}]},qe={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"}]},_e=[{heading:"Display",items:[{type:"dropdown",label:"Display",property:"display",units:I},{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:I},{type:"arbitrary",label:"Opacity",property:"opacity",units:["-"]}]}]},{heading:"Spacing",items:[{styleType:"multiple",label:"Margin",negative:!0,units:[...I,"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:I.concat("auto"),property:"width"},{type:"arbitrary",label:"Height",units:I.concat("auto"),property:"height"},{styleType:"accordion",heading:"Min width & height",items:[{type:"arbitrary",label:"Min Width",units:I.concat("auto"),property:"minWidth"},{type:"arbitrary",label:"Min Height",units:I.concat("auto"),property:"minHeight"}]},{styleType:"accordion",heading:"Max width & height",items:[{type:"arbitrary",label:"Max Width",units:I.concat("auto"),property:"maxWidth"},{type:"arbitrary",label:"Max Height",units:I.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:I},{type:"arbitrary",property:"lineHeight",label:"Height",units:I.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:Me}]}],de={"not-italic":()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z",fill:"white"})}),visible:u.EyeOpenIcon,invisible:u.EyeClosedIcon,hidden:u.EyeClosedIcon,gap:u.BorderAllIcon,gapX:u.WidthIcon,gapY:u.HeightIcon,spaceX:u.WidthIcon,spaceY:u.HeightIcon,overscroll:u.BorderAllIcon,overscrollX:u.WidthIcon,overscrollY:u.HeightIcon,overflow:u.BorderAllIcon,overflowX:u.WidthIcon,overflowY:u.HeightIcon,top:u.ArrowUpIcon,right:u.ArrowRightIcon,bottom:u.ArrowDownIcon,left:u.ArrowLeftIcon,inset:u.BorderAllIcon,insetX:u.WidthIcon,insetY:u.HeightIcon,border:u.BorderAllIcon,borderX:u.WidthIcon,borderY:u.HeightIcon,borderTop:u.ArrowUpIcon,borderRight:u.ArrowRightIcon,borderBottom:u.ArrowDownIcon,borderLeft:u.ArrowLeftIcon,borderRadius:u.BorderAllIcon,borderRadiusX:u.WidthIcon,borderRadiusY:u.HeightIcon,borderRadiusTop:u.ArrowUpIcon,borderRadiusRight:u.ArrowRightIcon,borderRadiusBottom:u.ArrowDownIcon,borderRadiusLeft:u.ArrowLeftIcon,borderRadiusTopLeft:u.ArrowTopLeftIcon,borderRadiusTopRight:u.ArrowTopRightIcon,borderRadiusBottomRight:u.ArrowBottomRightIcon,borderRadiusBottomLeft:u.ArrowBottomLeftIcon,divideXWidth:u.WidthIcon,divideYWidth:u.HeightIcon,scale:u.BorderAllIcon,scaleX:u.WidthIcon,scaleY:u.HeightIcon,skewX:u.WidthIcon,skewY:u.HeightIcon,translateX:u.WidthIcon,translateY:u.HeightIcon,padding:u.BorderAllIcon,paddingX:u.WidthIcon,paddingY:u.HeightIcon,paddingTop:u.ArrowUpIcon,paddingRight:u.ArrowRightIcon,paddingBottom:u.ArrowDownIcon,paddingLeft:u.ArrowLeftIcon,margin:u.BorderAllIcon,marginX:u.WidthIcon,marginY:u.HeightIcon,marginTop:u.ArrowUpIcon,marginRight:u.ArrowRightIcon,marginBottom:u.ArrowDownIcon,marginLeft:u.ArrowLeftIcon,textLeft:u.AlignLeftIcon,textCenter:u.AlignCenterHorizontallyIcon,textRight:u.AlignRightIcon,textJustify:u.StretchHorizontallyIcon,italic:u.FontItalicIcon,underline:u.UnderlineIcon,overline:u.OverlineIcon,uppercase:u.LetterCaseUppercaseIcon,block:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M2 2H14V14H2V2ZM1 1H15V15H1V1Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4H4V12H7V4ZM9 4H12V12H9V4Z",fill:"currentColor"})]}),"float-right":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M8 4H16V12H8V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M0 4H6V6H0V4ZM0 7H6V9H0V7ZM4 10H0V12H4V10Z",fill:"currentColor"})]}),"float-left":()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M0 4H8V12H0V4Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M10 4H16V6H10V4ZM10 7H16V9H10V7ZM14 10H10V12H14V10Z",fill:"currentColor"})]}),"float-none":u.Cross2Icon,fixed:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M15 2H14V4H13V5H14V6H15V2ZM10 5V4H9V2H1V8H2V5H10ZM7 4V3H5V4H7ZM4 4V3H2V4H4ZM1 13H7V14H1V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),absolute:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M14 2H15V6H14V2ZM9 3V2H1V8H2V3H9ZM7 13H1V14H7V13Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H10V3H11V6H12V3H13V2H11ZM2 9H1V12H2V11H7V10H2V9ZM15 7H8V14H15V7Z",fill:"currentColor"})]}),relative:()=>e.jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2H9V3H11V6H12V3H14V2H11ZM2 8H1V13H2V11H7V10H2V8ZM15 7H8V14H15V7Z",fill:"currentColor"})}),sticky:()=>e.jsxRuntimeExports.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{d:"M12.9998 7C13.6558 7 14.2937 6.78498 14.8158 6.38787C15.338 5.99076 15.7156 5.43345 15.8908 4.80128C16.066 4.16912 16.0292 3.49694 15.7859 2.8877C15.5427 2.27846 15.1065 1.76573 14.5441 1.42804C13.9817 1.09034 13.3241 0.946293 12.672 1.01795C12.02 1.08961 11.4094 1.37303 10.9337 1.8248C10.4581 2.27658 10.1436 2.8718 10.0385 3.51932C9.93341 4.16685 10.0434 4.83097 10.3518 5.41L6.88176 8.88C6.80034 8.96122 6.73572 9.05769 6.69158 9.16388C6.64744 9.27008 6.62465 9.38393 6.62451 9.49894C6.62437 9.61395 6.64689 9.72785 6.69077 9.83416C6.73465 9.94046 6.79904 10.0371 6.88026 10.1185C6.96149 10.1999 7.05795 10.2645 7.16415 10.3087C7.27035 10.3528 7.3842 10.3756 7.4992 10.3758C7.61421 10.3759 7.72812 10.3534 7.83442 10.3095C7.94072 10.2656 8.03734 10.2012 8.11876 10.12L11.5888 6.648C12.0088 6.873 12.4888 7 12.9988 7H12.9998Z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{opacity:"0.6",fillRule:"evenodd",clipRule:"evenodd",d:"M9.535 2H1V14H15V7.465C14.69 7.645 14.355 7.783 14 7.875V13H2V5H9.126C8.86504 3.98486 9.01223 2.90789 9.536 2H9.535ZM7 3V4H5V3H7ZM4 3V4H2V3H4Z",fill:"currentColor"})]}),static:u.Cross1Icon},_=x.createContext({canReset:!1,canChange:!0}),We=({children:s,canReset:o=!1,canChange:r=!0})=>e.jsxRuntimeExports.jsx(_.Provider,{value:{canReset:o,canChange:r},children:s}),ce=({label:s,property:o,onChange:r})=>{const n=x.useMemo(()=>t.get(O.CLASSES_LIST,`${o}.classes`,[""]),[o]),i=W(o),a=x.useMemo(()=>t.get(i,"cls",""),[i]),{canChange:d}=x.useContext(_),p=/\[.*\]/g.test(a);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(P.Input,{className:"w-[70%] rounded py-1",readOnly:!0,value:a}),e.jsxRuntimeExports.jsxs(E.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(E.TooltipContent,{children:"Current value is using a Tailwind arbitrary value."})]})]}):e.jsxRuntimeExports.jsx(Q,{rounded:s,onChange:l=>r(l,o),selected:a,options:n,disabled:!d})})};function Q({selected:s,onChange:o,rounded:r=!1,options:n,disabled:i=!1}){const a=s.replace(/.*:/g,"").trim(),{undo:d,redo:p}=f.useCanvasHistory();return e.jsxRuntimeExports.jsxs("select",{disabled:!n.length||i,className:`${r?"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:l=>o(l.target.value),onKeyDown:l=>{l.ctrlKey&&(l.key==="z"&&d(),l.key==="y"&&p())},value:a,children:[e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:""}),x.Children.toArray(n.map(l=>e.jsxRuntimeExports.jsx("option",{className:"bg-transparent",value:l,children:l})))]})}const Fe=({property:s,onChange:o})=>{const{canReset:r,canChange:n}=x.useContext(_),i=W(s),a=x.useMemo(()=>t.get(i,"cls",""),[i]),d=x.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),p=d.indexOf(a)>-1?d.indexOf(a):0,l=/\[.*\]/g.test(a);return e.jsxRuntimeExports.jsx("div",{className:"flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs",children:l?e.jsxRuntimeExports.jsx("div",{className:"py-[5px] px-2",children:a}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("button",{type:"button",className:"box-border w-2/12 rounded-tl rounded-bl bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!n&&(!r||p-1<0),onClick:()=>o(t.nth(d,p-1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.MinusIcon,{className:!n&&(!r||p-1<0)?"text-gray-500":"text-white/60"})})}),e.jsxRuntimeExports.jsx("div",{className:"w-8/12 text-center",children:e.jsxRuntimeExports.jsx(ce,{label:!1,property:s,onChange:o})}),e.jsxRuntimeExports.jsx("button",{type:"button",className:"w-2/12 rounded-tr rounded-br bg-background px-1 text-center hover:bg-bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-600",disabled:!n&&(!r||p+1>=d.length),onClick:()=>o(t.nth(d,p+1),s),children:e.jsxRuntimeExports.jsx("span",{className:"flex items-center justify-center",children:e.jsxRuntimeExports.jsx(u.PlusIcon,{className:!n&&(!r||p+1>=d.length)?"text-gray-500":"text-white/60"})})})]})})},Ye=({property:s,onChange:o})=>{const r=x.useMemo(()=>t.get(O.CLASSES_LIST,`${s}.classes`,[""]),[s]),{canChange:n}=x.useContext(_),i=W(s),a=x.useMemo(()=>t.get(i,"cls",""),[i]);return e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-wrap gap-1",children:t.map(r,d=>e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",disabled:!n,onClick:()=>o(d,s),className:`cursor-pointer rounded border border-gray-600 p-1 disabled:cursor-not-allowed ${a===d?" bg-blue-500 text-white":"disabled:bg-gray-600 disabled:text-gray-400"}`,children:x.createElement(t.get(de,d,u.BoxIcon))})}),e.jsxRuntimeExports.jsx(E.TooltipContent,{children:t.startCase(t.toLower(d))})]}))})},Xe={backgroundColor:"bg",textColor:"text",borderColor:"border",boxShadowColor:"shadow",outlineColor:"outline",divideColor:"divide",fromColor:"from",viaColor:"via",toColor:"to",ringColor:"ring",ringOffsetColor:"ring-offset"},ze=({property:s,onChange:o})=>{const r=W(s),n=x.useMemo(()=>t.get(r,"cls",""),[r]),{canChange:i}=x.useContext(_),[a,d]=x.useState([]),[p,l]=x.useState({color:"",shade:""}),m=n.split("-"),g=t.get(m,"1",""),c=t.get(m,"2",""),b=x.useCallback(h=>{["current","inherit","transparent","black","white"].includes(h)?(d([]),l({color:h})):(d(["50","100","200","300","400","500","600","700","800","900"]),l(R=>({...R,color:h,shade:R.shade?R.shade:"500"})))},[d,l]);x.useEffect(()=>{if(["current","inherit","transparent","black","white"].includes(g))return d([]);d(["50","100","200","300","400","500","600","700","800","900"])},[g]);const y=x.useCallback(h=>{l({color:g,shade:h})},[g]);return x.useEffect(()=>{l({color:"",shade:""})},[r]),x.useEffect(()=>{const R=`${t.get(Xe,s,"")}-${p.color}${p.shade?`-${p.shade}`:""}`;R.match(new RegExp(t.get(O.CLASSES_LIST,`${s}.regExp`,"")))&&o(R,s)},[p,o,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(Q,{disabled:!i,rounded:!0,selected:g,onChange:b,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(Q,{rounded:!0,selected:c,disabled:!g||!i,onChange:y,options:a})})]})},ie=(s,o)=>{s=s.toLowerCase();let r=s.trim().replace(/ |\+/g,"");if((r==="auto"||r==="none")&&o.includes(r))return{value:"",unit:r};const n=o.length?new RegExp(o.join("|"),"g"):/XXXXXX/g;r=r.replace(n,"");const i=s.match(n),a=i&&i.length>1,d=!t.isEmpty(r)&&Number.isNaN(Number(r));return a||d?{error:"Invalid value"}:i&&(i[0]==="auto"||i[0]==="none")?{value:i[0],unit:""}:{value:r,unit:i?i[0]:""}},Ze=s=>{const o=s.startsWith("-")?"-":"",r=s.split("-").pop();if(["auto","none"].includes(r))return{value:"",unit:r};if(r==="px")return{value:"1",unit:"px"};if(r==="screen")return{value:"100",unit:s.indexOf("w-")!==-1?"vw":"vh"};if(r==="full")return{value:"100",unit:"%"};if(t.includes(s,"skew-"))return{value:`${o}${r}`,unit:"deg"};if(t.includes(s,"rotate-"))return{value:`${o}${r}`,unit:"deg"};if(t.includes(s,"opacity-"))return{value:`${r/100}`,unit:"-"};if(t.includes(s,"duration-")||t.includes(s,"delay-"))return{value:`${r}`,unit:"ms"};if(t.includes(s,"translate-")&&!r.includes("/"))return{value:`${o}${`${r/4}`}`,unit:"rem"};if(t.includes(s,"scale-"))return{value:`${o}${`${r/100}`}`,unit:"-"};if(t.startsWith(s,"border")){const n=s.match(/border-?(x|y|t|r|b|l)?\d+/g);if(n)return{value:n[0].split("-").pop(),unit:"px"};if(s.match(/border-?(x|y|t|r|b|l)?/g))return{value:"1",unit:"px"}}if(t.startsWith(s,"max-w-")){if(s==="max-w-screen-sm")return{value:"640",unit:"px"};if(s==="max-w-screen-md")return{value:"768",unit:"px"};if(s==="max-w-screen-lg")return{value:"1024",unit:"px"};if(s==="max-w-screen-xl")return{value:"1280",unit:"px"};if(s==="max-w-screen-2xl")return{value:"1536",unit:"px"};if(r==="xs")return{value:"320",unit:"px"};if(r==="sm")return{value:"384",unit:"px"};if(r==="md")return{value:"448",unit:"px"};if(r==="lg")return{value:"512",unit:"px"};if(r==="xl")return{value:"576",unit:"px"};if(r==="2xl")return{value:"672",unit:"px"};if(r==="3xl")return{value:"768",unit:"px"};if(r==="4xl")return{value:"896",unit:"px"};if(r==="5xl")return{value:"1024",unit:"px"};if(r==="6xl")return{value:"1152",unit:"px"};if(r==="7xl")return{value:"1280",unit:"px"};if(r==="prose")return{value:"65",unit:"ch"}}if(t.startsWith(s,"text-")){if(r==="xs")return{value:"12",unit:"px"};if(r==="sm")return{value:"14",unit:"px"};if(r==="base")return{value:"16",unit:"px"};if(r==="lg")return{value:"18",unit:"px"};if(r==="xl")return{value:"20",unit:"px"};if(r==="2xl")return{value:"24",unit:"px"};if(r==="3xl")return{value:"30",unit:"px"};if(r==="4xl")return{value:"36",unit:"px"};if(r==="5xl")return{value:"48",unit:"px"};if(r==="6xl")return{value:"60",unit:"px"};if(r==="7xl")return{value:"72",unit:"px"};if(r==="8xl")return{value:"96",unit:"px"};if(r==="9xl")return{value:"128",unit:"px"}}if(t.startsWith(s,"leading-")){if(r==="none")return{value:"1",unit:"-"};if(r==="tight")return{value:"1.25",unit:"-"};if(r==="snug")return{value:"1.375",unit:"-"};if(r==="normal")return{value:"1.5",unit:"-"};if(r==="relaxed")return{value:"1.625",unit:"-"};if(r==="loose")return{value:"2",unit:"-"}}if(t.startsWith(s,"tracking-")){if(r==="tighter")return{value:"-0.05",unit:"em"};if(r==="tight")return{value:"-0.025",unit:"em"};if(r==="normal")return{value:"0",unit:"em"};if(r==="wide")return{value:"0.025",unit:"em"};if(r==="wider")return{value:"0.05",unit:"em"};if(r==="widest")return{value:"0.1",unit:"em"}}if(["max","min","fit"].includes(r))return{value:s,unit:"class"};if(r.includes("/")){const[n,i]=t.map(r.split("/"),a=>parseInt(a,10));return{value:o+(n/i*100).toFixed(2).replace(".00",""),unit:"%"}}return t.isNumber(parseFloat(r))?{value:`${o+parseFloat(r)*4}`,unit:"px"}:{value:r,unit:"class"}},Ue=s=>{if(t.isEmpty(s))return{value:"",unit:""};const o=s.match(/\[.*\]/g);if(o===null)return Ge(s);const r=t.get(o,"0","").replace(/\[|\]/g,""),n=s.startsWith("-")?"-":"",i=t.first(r.match(/\d+.\d+|\d+/g));return{value:`${n}${i}`,unit:r.replace(i,"")}},Ge=s=>t.isEmpty(s)?{value:"",unit:""}:Ze(s),xe=x.createContext({setDragData:()=>{}}),Ke=({unit:s,currentValue:o,onDrag:r,onDragEnd:n,onDragStart:i,negative:a,cssProperty:d})=>{const{setDragData:p}=x.useContext(xe);return e.jsxRuntimeExports.jsx("button",{type:"button",onMouseDown:l=>{const m={onDrag:r,onDragEnd:n,dragging:!0,dragStartY:l.pageY,dragStartValue:`${o}`,dragUnit:s,negative:a,cssProperty:d};i(m),p(m)},color:void 0,className:"relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",children:e.jsxRuntimeExports.jsx(u.RowSpacingIcon,{})})},Je=({onSelect:s,current:o,units:r})=>e.jsxRuntimeExports.jsx("div",{"data-theme":"light",className:"-m-[7px] -mx-[13px] flex w-9 flex-col",children:r.map(n=>e.jsxRuntimeExports.jsx(E.Button,{className:"h-max rounded-none px-1 py-1 text-right text-[11px] hover:bg-blue-400",color:o===n?"primary":void 0,size:"sm",onClick:i=>{i.stopPropagation(),s(n)},children:n},n))}),Qe=s=>{const[o,r]=x.useState(!1),[n,i]=x.useState(""),{currentClass:a,onChange:d,classPrefix:p,cssProperty:l,units:m,negative:g}=s,[c,b]=x.useState(l!=null&&l.toLowerCase().includes("width")?"%":m[0]),[y,h]=x.useState(!1),[R,N]=x.useState(""),[B,w]=x.useState(!1),[V,A]=x.useState(!1);x.useEffect(()=>{const{value:j,unit:v}=Ue(a);if(v===""){i(j),b(l!=null&&l.toLowerCase().includes("width")?"%":m[0]);return}b(v),i(v==="class"||t.isEmpty(j)?"":j)},[a,l,m]);const k=G.useThrottledCallback(j=>{d(j)},[d],200),H=G.useThrottledCallback(j=>{d(j,!1)},[d],200),L=x.useCallback((j=!1)=>{const v=ie(`${n}`,m);if(t.get(v,"error",!1)){h(!0);return}const S=t.get(v,"unit")!==""?t.get(v,"unit"):c;if(S==="auto"||S==="none"){k(`${p}${S}`);return}if(t.get(v,"value")==="")return;const q=`${t.get(v,"value","").startsWith("-")?"-":""}${p}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;j?H(q):k(q)},[k,H,n,c,p,m]),F=x.useCallback(j=>{const v=ie(`${n}`,m);if(t.get(v,"error",!1)){h(!0);return}if(j==="auto"||j==="none"){k(`${p}${j}`);return}if(t.get(v,"value")==="")return;const S=t.get(v,"unit")!==""?t.get(v,"unit"):j,q=`${t.get(v,"value","").startsWith("-")?"-":""}${p}[${t.get(v,"value","").replace("-","")}${S==="-"?"":S}]`;k(q)},[k,n,p,m]);return e.jsxRuntimeExports.jsx("div",{className:"flex w-full flex-col",children:e.jsxRuntimeExports.jsx("div",{className:"flex items-center justify-start",children:c==="class"?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("input",{className:"w-20 rounded py-1",readOnly:!0,value:a}),e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 text-blue-600 group-hover:visible",children:e.jsxRuntimeExports.jsx(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(E.TooltipContent,{children:"Current value is using a Tailwind preset class."})]})]}):e.jsxRuntimeExports.jsxs("div",{className:`group relative flex items-center ${B?"z-auto":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md border border-border",children:[["none","auto"].indexOf(c)!==-1?null:e.jsxRuntimeExports.jsx("input",{readOnly:c==="class",onKeyPress:j=>{j.key==="Enter"&&L()},onKeyDown:j=>{if(j.keyCode!==38&&j.keyCode!==40)return;j.preventDefault(),A(!0);const v=t.parseInt(j.target.value);let S=t.isNaN(v)?0:v;j.keyCode===38&&(S+=1),j.keyCode===40&&(S-=1);const D=`${S}`,ge=`${D.startsWith("-")?"-":""}${p}[${D.replace("-","")}${c==="-"?"":c}]`;H(ge)},onKeyUp:j=>{V&&(j.preventDefault(),A(!1))},onBlur:()=>L(),onChange:j=>{h(!1),i(j.target.value)},onClick:j=>{var v;(v=j==null?void 0:j.target)==null||v.select(),r(!1)},value:B?R:n,className:"h-6 w-14 rounded rounded-r-none bg-background pl-2 text-sm focus-visible:outline-0 ".concat(" ",y?"border-red-500 text-red-500":"border-foreground/20")}),e.jsxRuntimeExports.jsxs(E.Tooltip,{open:o,delayDuration:100,children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>r(!o),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 ${m.length===1?"px-2 font-semibold":""}`,children:c}),m.length>1?e.jsxRuntimeExports.jsx(u.TriangleDownIcon,{}):null]})}),e.jsxRuntimeExports.jsx(E.TooltipPortal,{children:e.jsxRuntimeExports.jsx(E.TooltipContent,{className:"bg-background",children:e.jsxRuntimeExports.jsx(Je,{units:m,current:c,onSelect:j=>{r(!1),b(j),F(j)}})})})]})]}),["none","auto"].indexOf(c)!==-1||B?null:e.jsxRuntimeExports.jsx(Ke,{onDragStart:()=>w(!0),onDragEnd:j=>{if(N(()=>""),w(!1),t.isEmpty(j))return;const v=`${j}`,D=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${c==="-"?"":c}]`;k(D)},onDrag:j=>{if(t.isEmpty(j))return;N(j);const v=`${j}`,D=`${v.startsWith("-")?"-":""}${p}[${v.replace("-","")}${c==="-"?"":c}]`;H(D)},currentValue:n,unit:c,negative:g,cssProperty:l})]})})})},W=s=>{const o=f.useSelectedBlockCurrentClasses();return t.findLast(o,{property:s})},et=(s,o)=>{const r={xs:0,sm:1,md:2,lg:3,xl:4,"2xl":5};return r[t.get(s,"mq","xs")]<=r[o]},tt={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-"},le={xs:"",sm:"640px",md:"768px",lg:"1024px",xl:"1280px","2xl":"1536px"},st=s=>`${s.toUpperCase()} ${le[s]?`(${le[s]} & up)`:""}`,te=s=>{const{type:o="icons",label:r,property:n,onEmitChange:i=()=>{},units:a,negative:d=!1}=s,[p]=f.useDarkMode(),[l]=f.useStylingState(),[,m]=f.useCanvasWidth(),g=W(n),c=f.useAddClassesToBlocks(),b=f.useRemoveClassesFromBlocks(),[y]=f.useSelectedBlockIds(),h=x.useMemo(()=>t.get(g,"fullCls",""),[g]),R=x.useCallback((k,H=!0)=>{const L={dark:p,mq:m,mod:l,cls:k,property:n,fullCls:""};(p||l!=="")&&(L.mq="xs");const F=O.generateFullClsName(L);c(y,[F],H)},[y,p,m,l,n,c]),N=x.useCallback(()=>{b(y,[h])},[y,h,b]),B=x.useMemo(()=>et(g,m),[g,m]);x.useEffect(()=>{i(B,g)},[B,i,g]);const[,,w]=f.useCanvasWidth(),V=x.useCallback(k=>{w({xs:400,sm:640,md:800,lg:1024,xl:1420,"2xl":1920}[k])},[w]),A=t.get(g,"dark",null)===p&&t.get(g,"mod",null)===l&&t.get(g,"mq",null)===m;return e.jsxRuntimeExports.jsx(We,{canChange:B,canReset:g&&A,children:e.jsxRuntimeExports.jsxs("div",{className:"group flex flex-row items-center py-2 first:pt-0 last:pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"relative w-[70px] truncate text-xs text-foreground",children:e.jsxRuntimeExports.jsx("span",{className:`text-[11px] ${g&&!A?"text-foreground":""}`,children:r})}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[e.jsxRuntimeExports.jsxs("div",{className:"w-[150px]",children:[o==="arbitrary"?e.jsxRuntimeExports.jsx(Qe,{currentClass:t.get(g,"cls",""),classPrefix:t.get(tt,n,""),units:a||[],onChange:R,negative:d,cssProperty:n}):null,o==="icons"&&e.jsxRuntimeExports.jsx(Ye,{property:n,onChange:R}),o==="range"&&e.jsxRuntimeExports.jsx(Fe,{property:n,onChange:R}),o==="color"&&e.jsxRuntimeExports.jsx(ze,{property:n,onChange:R}),o==="dropdown"&&e.jsxRuntimeExports.jsx(ce,{label:r,property:n,onChange:R})]}),e.jsxRuntimeExports.jsx("div",{className:`w-[30px] cursor-pointer ${h?"visible":"invisible"}`,children:A?e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>N(),title:"Reset",className:"flex px-1.5 text-xs",children:e.jsxRuntimeExports.jsx(u.TrashIcon,{className:"h-5 w-5 text-blue-500 hover:opacity-80"})}):B&&g?e.jsxRuntimeExports.jsxs(E.Tooltip,{delayDuration:100,children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsx("button",{type:"button",className:"invisible ml-3 mt-1 rounded-full bg-blue-500 text-white group-hover:visible",children:e.jsxRuntimeExports.jsx(u.InfoCircledIcon,{})})}),e.jsxRuntimeExports.jsx(E.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:[st(t.get(g,"mq")),p&&!g.dark?"(Light mode)":""]}),e.jsxRuntimeExports.jsx("br",{}),e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>V(t.get(g,"mq")),className:"block w-full cursor-default text-right font-semibold text-blue-500",children:["Switch to ",t.get(g,"mq").toUpperCase()]})]})})})]}):null})]})]})})},rt=["px","%","em","rem","ch","vh","vw"],me=({label:s,options:o,borderB:r=!1,borderT:n=!1,type:i="arbitrary",units:a=rt,negative:d=!1})=>{const[p,l]=x.useState(o[0].key),m=f.useSelectedBlockCurrentClasses(),g=x.useCallback(c=>t.map(m,"property").includes(c),[m]);return e.jsxRuntimeExports.jsxs("div",{className:`mb-2 border-gray-800 py-2 first:pt-0 last:pb-0 ${r?"border-b":""} ${n?"border-t":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row text-xs",children:[s&&e.jsxRuntimeExports.jsx("span",{className:"relative w-[70px] flex-none text-xs text-foreground",children:s}),e.jsxRuntimeExports.jsx("div",{className:"mb-3 flex grow flex-row flex-wrap gap-x-px",children:x.Children.toArray(o.map(({label:c,key:b})=>e.jsxRuntimeExports.jsx("div",{className:"first:rounded-l last:rounded-r",children:e.jsxRuntimeExports.jsxs(E.Tooltip,{children:[e.jsxRuntimeExports.jsx(E.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{type:"button",onClick:()=>l(b),className:`relative cursor-pointer rounded-full p-1 text-[8px] ${b===p?" bg-[#3E57F0] text-white":"text-gray-600 dark:text-gray-300"}`,children:[x.createElement("div",{className:g(b)?"-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full":""}),x.createElement(t.get(de,b,u.BoxIcon),{className:"text-inherit w-3 h-3"})]})}),e.jsxRuntimeExports.jsx(E.TooltipContent,{children:t.startCase(t.toLower(c))})]})})))})]}),e.jsxRuntimeExports.jsx("div",{className:"mt-0 flex items-center",children:e.jsxRuntimeExports.jsx(te,{type:i,units:[...a],label:"",property:p,negative:d})})]})},ot=({heading:s,items:o})=>{const r=f.useSelectedBlockCurrentClasses(),n=x.useMemo(()=>{const i=p=>t.flatten(p.map(l=>l.styleType==="multiple"?t.map(l.options,"key"):l.property)),a=t.flatten(o.map(p=>p.styleType==="accordion"?i(p.items):p.styleType==="multiple"?t.map(p.options,"key"):p.property)),d=t.map(r,"property");return t.intersection(a,d).length>0},[r,o]);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:o.map(i=>i.styleType==="multiple"?e.jsxRuntimeExports.jsx(me,{...i},i.label):e.jsxRuntimeExports.jsx(te,{...i},i.label))})]})},nt=x.createContext({}),U=({section:s})=>{const o=f.useSelectedBlockCurrentClasses(),r=x.useCallback((a=[])=>{const d={};for(let l=0;l<o.length;l++)d[o[l].property]=o[l].cls;let p=!0;for(const l in a)if(!t.has(d,l)||d[l]!==a[l]){p=!1;break}return p},[o]),n=x.useMemo(()=>{if(o.length>0&&s.heading==="Classes")return!0;const a=l=>t.flatten(l.map(m=>m.styleType==="multiple"?t.flatten(t.map(m.options,"key")):m.property)),d=t.flatten(s.items.map(l=>l.styleType==="accordion"?a(l.items):l.styleType==="multiple"?t.flatten(t.map(l.options,"key")):l.property)),p=t.map(o,"property");return t.intersection(d,p).length>0},[o,s.heading,s.items]),i=x.useMemo(()=>({}),[]);return e.jsxRuntimeExports.jsx(nt.Provider,{value:i,children:e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${n?"bg-blue-500":"bg-gray-300"}`}),s.heading]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:x.Children.toArray(s.items.map(a=>t.has(a,"component")?x.createElement(a.component,{key:a.label}):t.has(a,"styleType")?a.styleType==="multiple"?e.jsxRuntimeExports.jsx(me,{...a},a.label):a.styleType==="accordion"&&r(a==null?void 0:a.conditions)?e.jsxRuntimeExports.jsx(ot,{...a},a.label):null:e.jsxRuntimeExports.jsx(te,{...a},a.label)))})]})})},it=({item:s,index:o,canDelete:r,onChange:n,onRemove:i})=>e.jsxRuntimeExports.jsxs("div",{className:`flex flex-col gap-1 border-gray-400 py-2 ${r?"border-b":""}`,children:[e.jsxRuntimeExports.jsx("input",{name:"key",onChange:a=>n(a,o),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:a=>t.isEmpty(s.key)?{}:n(a,o),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(u.TrashIcon,{onClick:i,className:"h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 hover:opacity-80"})]})]}),lt=({section:s})=>{var b;const{setSyncState:o}=f.useSavePage(),r=f.useSelectedBlock(),[n,i]=x.useState([]),[a]=f.useSelectedStylingBlocks(),d=f.useUpdateBlocksPropsRealtime(),p=`${t.get(a,"0.prop")}_attrs`;X.useEffect(()=>{const y=t.map(t.get(r,p),(h,R)=>({key:R,value:h}));t.isEmpty(y)?i([]):i(y)},[t.get(r,p)]);const l=()=>i([...n,{key:"",value:""}]),m=y=>{const h=t.filter(n,(R,N)=>y!==N);c(h)},g=(y,h)=>{const R=[...n];R[h][y.target.name]=y.target.value,c(R)},c=X.useCallback((y=[])=>{const h={};t.forEach(y,R=>{t.isEmpty(R.key)||t.set(h,R.key,R.value)}),d([t.get(r,"_id")],{[p]:h}),o("UNSAVED")},[r,o,d,p]);return e.jsxRuntimeExports.jsxs(T.AccordionItem,{value:s.heading,children:[e.jsxRuntimeExports.jsx(T.AccordionTrigger,{className:"px-3 py-2 text-xs hover:no-underline",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsxRuntimeExports.jsx("div",{className:`h-[8px] w-[8px] rounded-full ${t.isEmpty(t.get(r,p))?"bg-gray-300":"bg-blue-500"}`}),"Attributes"]})}),e.jsxRuntimeExports.jsx(T.AccordionContent,{className:"bg-gray-100 px-3.5 py-2",children:e.jsxRuntimeExports.jsxs("div",{className:"no-scrollbar flex min-h-max flex-col gap-y-2 overflow-y-auto bg-gray-100 p-px",children:[e.jsxRuntimeExports.jsxs(ee.Label,{className:"mt-2 flex w-full items-center justify-between",children:["Add Custom attributes",e.jsxRuntimeExports.jsxs("div",{className:`flex h-6 w-max items-center justify-center gap-x-0.5 rounded-full border p-1 px-2 text-xs ${!t.isEmpty(n)&&t.isEmpty((b=t.last(n))==null?void 0:b.key)?"cursor-not-allowed border-gray-400 text-gray-400":"cursor-pointer border-blue-400 text-blue-400 hover:bg-blue-400 hover:text-white"}`,onClick:()=>{var y;!t.isEmpty(n)&&t.isEmpty((y=t.last(n))==null?void 0:y.key)||l()},children:[e.jsxRuntimeExports.jsx(u.PlusIcon,{width:12,height:12})," Add"]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col",children:[t.isEmpty(n)&&e.jsxRuntimeExports.jsx("div",{className:"flex h-12 items-center justify-center text-sm text-gray-400",children:"Click + Add to add attributes"}),X.Children.toArray(t.map(n,(y,h)=>{const R=n.length>0&&h<n.length-1;return e.jsxRuntimeExports.jsx(it,{item:y,index:h,canDelete:R,onChange:g,onRemove:()=>m(h)})}))]})]})})]})};function at(){const[s,o]=f.useStylingState(),{flexChild:r,gridChild:n}=f.useSelectedBlocksDisplayChild(),[,i]=Ce.useAtom(f.advanceStylingOpenAtom),{t:a}=ae.useTranslation(),[d]=f.useSelectedStylingBlocks();return t.isEmpty(d)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(u.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:a("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(ee.Label,{htmlFor:"",className:"flex gap-x-1.5 text-xs italic",children:"State"}),e.jsxRuntimeExports.jsxs(C.Select,{defaultValue:s,onValueChange:p=>o(p),children:[e.jsxRuntimeExports.jsx(C.SelectTrigger,{className:"h-auto w-fit p-1 px-3",children:e.jsxRuntimeExports.jsx(C.SelectValue,{placeholder:"State"})}),e.jsxRuntimeExports.jsxs(C.SelectContent,{children:[e.jsxRuntimeExports.jsx(C.SelectItem,{value:"",children:"Normal"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"hover",children:"Hover"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"active",children:"Active"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"focus",children:"Focus"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"before",children:"Before"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"after",children:"After"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"only",children:"Only"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"first",children:"First"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"last",children:"Last"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"first-letter",children:"First Letter"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"first-line",children:"First Line"}),e.jsxRuntimeExports.jsx(C.SelectItem,{value:"disabled",children:"Disabled"})]})]})]})}),e.jsxRuntimeExports.jsxs(Te.ScrollArea,{className:"no-scrollbar -mx-1 h-full overflow-x-hidden",children:[e.jsxRuntimeExports.jsxs(T.Accordion,{type:"multiple",className:"h-full w-full",children:[r&&e.jsxRuntimeExports.jsx(U,{section:Oe}),n?e.jsxRuntimeExports.jsx(U,{section:qe}):null,_e.map(p=>e.jsxRuntimeExports.jsx(U,{section:p},p.heading)),e.jsxRuntimeExports.jsx(lt,{section:{heading:"Attributes"}})]}),e.jsxRuntimeExports.jsx("div",{className:"h-60"})]})]})}const pt={px:1,"%":1,em:100,rem:100,ch:1,vw:1,vh:1,"-":1,deg:1,ms:.1},ut=()=>{const s=f.useSelectedBlock(),{t:o}=ae.useTranslation(),[r,n]=x.useState(""),[i,a]=x.useState({onDrag:l=>l,onDragEnd:l=>l,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""}),d=G.useThrottledCallback(l=>{const m=!t.get(i,"negative",!1),g=t.get(i,"cssProperty","");let c=parseFloat(i.dragStartValue);c=t.isNaN(c)?0:c;let b=pt[i.dragUnit];(t.startsWith(g,"scale")||g==="opacity")&&(b=10);let h=(i.dragStartY-l.pageY)/b+c;m&&h<0&&(h=0),g==="opacity"&&h>1&&(h=1),i.onDrag(`${h}`),n(`${h}`)},[i],50),p=x.useCallback(()=>{setTimeout(()=>i.onDragEnd(`${r}`),100),a({onDrag:l=>l,onDragEnd:l=>l,dragStartY:0,dragging:!1,dragStartValue:0,dragUnit:"",negative:!1,cssProperty:""})},[i,r,a]);return t.isNull(s)?e.jsxRuntimeExports.jsx("div",{className:"p-4 text-center",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-4 rounded-xl p-4",children:[e.jsxRuntimeExports.jsx(u.MixerHorizontalIcon,{className:"mx-auto text-3xl"}),e.jsxRuntimeExports.jsx("h1",{children:o("no_block_selected_for_styling")})]})}):e.jsxRuntimeExports.jsxs(xe.Provider,{value:{setDragData:a},children:[i.dragging?e.jsxRuntimeExports.jsx("div",{onMouseMove:d,onMouseUp:()=>p(),className:"absolute inset-0 z-30 cursor-row-resize bg-gray-300/10 "}):null,e.jsxRuntimeExports.jsxs(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($e,{})}),e.jsxRuntimeExports.jsx(M.TabsContent,{value:"styling",className:"flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxRuntimeExports.jsx(at,{})})]})]})};exports.default=ut;