@chaibuilder/sdk 2.2.14 → 2.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js CHANGED
@@ -15,7 +15,7 @@ import { ChevronRight, PlusIcon as PlusIcon$1, DatabaseIcon, ChevronLeft, Chevro
15
15
  import clsx$1, { clsx } from "clsx";
16
16
  import { twMerge } from "tailwind-merge";
17
17
  import TreeModel from "tree-model";
18
- import { S as STYLES_KEY, e as getSplitChaiClasses, a as applyBinding, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as ROOT_TEMP_KEY } from "./new-blocks-render-helpers-BGcG63he.js";
18
+ import { S as STYLES_KEY, f as getSplitChaiClasses, a as applyBinding, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as ROOT_TEMP_KEY } from "./new-blocks-render-helpers-DfAVXxr2.js";
19
19
  import { d as defaultThemeOptions, f as defaultThemeValues, a as getChaiThemeCssVariables, g as getChaiThemeOptions, p as plugin, e as getThemeFontsLinkMarkup, h as getThemeCustomFontFace } from "./plugin-fnBB3TCm.js";
20
20
  import Fuse from "fuse.js";
21
21
  import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
@@ -759,13 +759,13 @@ const useUndoManager = () => {
759
759
  } = useBlocksStoreManager();
760
760
  return {
761
761
  moveBlocks: (x, y, b) => {
762
- const v = map(x, (A) => {
763
- const _ = r.find((T) => T._id === A)._parent || null, B = r.filter((T) => _ ? T._parent === _ : !T._parent).map((T) => T._id).indexOf(A);
764
- return { _id: A, oldParent: _, oldPosition: B };
765
- }), w = v.find(({ _id: A }) => A === x[0]);
766
- w && w.oldParent === y && w.oldPosition === b || (i(x, y, b), o({
767
- undo: () => each(v, ({ _id: A, oldParent: E, oldPosition: _ }) => {
768
- i([A], E, _);
762
+ const v = map(x, (w) => {
763
+ const _ = r.find((T) => T._id === w)._parent || null, B = r.filter((T) => _ ? T._parent === _ : !T._parent).map((T) => T._id).indexOf(w);
764
+ return { _id: w, oldParent: _, oldPosition: B };
765
+ }), A = v.find(({ _id: w }) => w === x[0]);
766
+ A && A.oldParent === y && A.oldPosition === b || (i(x, y, b), o({
767
+ undo: () => each(v, ({ _id: w, oldParent: E, oldPosition: _ }) => {
768
+ i([w], E, _);
769
769
  }),
770
770
  redo: () => i(x, y, b)
771
771
  }));
@@ -777,8 +777,8 @@ const useUndoManager = () => {
777
777
  });
778
778
  },
779
779
  removeBlocks: (x) => {
780
- var w;
781
- const y = (w = first(x)) == null ? void 0 : w._parent, v = r.filter((A) => y ? A._parent === y : !A._parent).indexOf(first(x));
780
+ var A;
781
+ const y = (A = first(x)) == null ? void 0 : A._parent, v = r.filter((w) => y ? w._parent === y : !w._parent).indexOf(first(x));
782
782
  l(map(x, "_id")), o({
783
783
  undo: () => a(x, y, v),
784
784
  redo: () => l(map(x, "_id"))
@@ -787,17 +787,17 @@ const useUndoManager = () => {
787
787
  updateBlocks: (x, y, b) => {
788
788
  let v = [];
789
789
  if (b)
790
- v = map(x, (w) => ({ _id: w, ...b }));
790
+ v = map(x, (A) => ({ _id: A, ...b }));
791
791
  else {
792
- const w = keys(y);
793
- v = map(x, (A) => {
794
- const E = r.find((S) => S._id === A), _ = { _id: A };
795
- return each(w, (S) => _[S] = E[S]), _;
792
+ const A = keys(y);
793
+ v = map(x, (w) => {
794
+ const E = r.find((S) => S._id === w), _ = { _id: w };
795
+ return each(A, (S) => _[S] = E[S]), _;
796
796
  });
797
797
  }
798
- d(map(x, (w) => ({ _id: w, ...y }))), o({
798
+ d(map(x, (A) => ({ _id: A, ...y }))), o({
799
799
  undo: () => d(v),
800
- redo: () => d(map(x, (w) => ({ _id: w, ...y })))
800
+ redo: () => d(map(x, (A) => ({ _id: A, ...y })))
801
801
  });
802
802
  },
803
803
  updateBlocksRuntime: (x, y) => {
@@ -812,8 +812,8 @@ const useUndoManager = () => {
812
812
  updateMultipleBlocksProps: (x) => {
813
813
  let y = [];
814
814
  y = map(x, (b) => {
815
- const v = keys(b), w = r.find((E) => E._id === b._id), A = {};
816
- return each(v, (E) => A[E] = w[E]), A;
815
+ const v = keys(b), A = r.find((E) => E._id === b._id), w = {};
816
+ return each(v, (E) => w[E] = A[E]), w;
817
817
  }), d(x), o({
818
818
  undo: () => d(y),
819
819
  redo: () => d(x)
@@ -2302,8 +2302,8 @@ const getBlockWithChildren = (o, r) => {
2302
2302
  for (const y in x) {
2303
2303
  const b = x[y];
2304
2304
  if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
2305
- const { baseClasses: v, classes: w } = getSplitChaiClasses(b);
2306
- x[y] = compact(flattenDeep([v, w])).join(" ");
2305
+ const { baseClasses: v, classes: A } = getSplitChaiClasses(b);
2306
+ x[y] = compact(flattenDeep([v, A])).join(" ");
2307
2307
  } else
2308
2308
  y !== "_id" && delete x[y];
2309
2309
  }
@@ -2315,21 +2315,21 @@ const getBlockWithChildren = (o, r) => {
2315
2315
  if (l) {
2316
2316
  r(!0), a(null);
2317
2317
  try {
2318
- const b = p === u ? "" : p, v = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, c)), p) : [h(f, c)], w = await l(m, addLangToPrompt(x, g, m), v, b), { blocks: A, error: E } = w;
2318
+ const b = p === u ? "" : p, v = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, c)), p) : [h(f, c)], A = await l(m, addLangToPrompt(x, g, m), v, b), { blocks: w, error: E } = A;
2319
2319
  if (E) {
2320
2320
  a(E);
2321
2321
  return;
2322
2322
  }
2323
2323
  if (m === "styles") {
2324
- const _ = A.map((S) => {
2324
+ const _ = w.map((S) => {
2325
2325
  for (const B in S)
2326
2326
  B !== "_id" && (S[B] = `${STYLES_KEY},${S[B]}`);
2327
2327
  return S;
2328
2328
  });
2329
2329
  d(_);
2330
2330
  } else
2331
- i(A);
2332
- y && y(w);
2331
+ i(w);
2332
+ y && y(A);
2333
2333
  } catch (b) {
2334
2334
  a(b);
2335
2335
  } finally {
@@ -3050,8 +3050,8 @@ const useDnd = () => {
3050
3050
  var E;
3051
3051
  const f = dropTarget, y = getOrientation(f) === "vertical" ? m.clientY + ((E = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : E.scrollY) : m.clientX;
3052
3052
  dropIndex = calculateDropIndex(y, possiblePositions);
3053
- const b = c, v = f.getAttribute("data-block-id"), w = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3054
- if ((b == null ? void 0 : b._id) === v || !w) {
3053
+ const b = c, v = f.getAttribute("data-block-id"), A = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3054
+ if ((b == null ? void 0 : b._id) === v || !A) {
3055
3055
  h();
3056
3056
  return;
3057
3057
  }
@@ -3059,8 +3059,8 @@ const useDnd = () => {
3059
3059
  a(b, v === "canvas" ? null : v, dropIndex), setTimeout(h, 300);
3060
3060
  return;
3061
3061
  }
3062
- let A = f.getAttribute("data-block-id");
3063
- A === null && (A = m.target.parentElement.getAttribute("data-block-id")), d([b._id], A === "canvas" ? null : A, dropIndex), h(), setTimeout(removePlaceholder, 300);
3062
+ let w = f.getAttribute("data-block-id");
3063
+ w === null && (w = m.target.parentElement.getAttribute("data-block-id")), d([b._id], w === "canvas" ? null : w, dropIndex), h(), setTimeout(removePlaceholder, 300);
3064
3064
  },
3065
3065
  onDragEnter: (m) => {
3066
3066
  const f = m, x = f.target;
@@ -3202,15 +3202,15 @@ const useHandleCanvasDblClick = (o, r) => {
3202
3202
  tailwindForms,
3203
3203
  tailwindAspectRatio,
3204
3204
  twContainer,
3205
- plugin(function({ addBase: v, theme: w }) {
3205
+ plugin(function({ addBase: v, theme: A }) {
3206
3206
  v({
3207
3207
  "h1,h2,h3,h4,h5,h6": {
3208
- fontFamily: w("fontFamily.heading")
3208
+ fontFamily: A("fontFamily.heading")
3209
3209
  },
3210
3210
  body: {
3211
- fontFamily: w("fontFamily.body"),
3212
- color: w("colors.foreground"),
3213
- backgroundColor: w("colors.background")
3211
+ fontFamily: A("fontFamily.body"),
3212
+ color: A("colors.foreground"),
3213
+ backgroundColor: A("colors.background")
3214
3214
  }
3215
3215
  });
3216
3216
  })
@@ -3232,11 +3232,11 @@ const useHandleCanvasDblClick = (o, r) => {
3232
3232
  c.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3233
3233
  }, [d, c]);
3234
3234
  const x = useMemo(() => {
3235
- const { heading: v, body: w } = {
3235
+ const { heading: v, body: A } = {
3236
3236
  heading: get(o, "fontFamily.heading"),
3237
3237
  body: get(o, "fontFamily.body")
3238
3238
  };
3239
- return f.filter((A) => A.family === v || A.family === w);
3239
+ return f.filter((w) => w.family === v || w.family === A);
3240
3240
  }, [o == null ? void 0 : o.fontFamily, f]), y = useMemo(() => getThemeFontsLinkMarkup(filter(x, (v) => has(v, "url"))), [x]), b = useMemo(
3241
3241
  () => getThemeCustomFontFace(filter(x, (v) => has(v, "src"))),
3242
3242
  [x]
@@ -3336,9 +3336,9 @@ const useHandleCanvasDblClick = (o, r) => {
3336
3336
  y,
3337
3337
  b
3338
3338
  ]
3339
- ), w = useMemo(() => !CORE_BLOCKS.includes(n._type), [n._type]);
3340
- if (console.log("block", n._type, w), isNull(g) || p.includes(n._id)) return null;
3341
- const A = /* @__PURE__ */ jsx(Suspense, { children: createElement(g, {
3339
+ ), A = useMemo(() => !CORE_BLOCKS.includes(n._type), [n._type]);
3340
+ if (isNull(g) || p.includes(n._id)) return null;
3341
+ const w = /* @__PURE__ */ jsx(Suspense, { children: createElement(g, {
3342
3342
  ...v,
3343
3343
  children: r({
3344
3344
  _id: n._id,
@@ -3351,7 +3351,7 @@ const useHandleCanvasDblClick = (o, r) => {
3351
3351
  ...n.globalBlock ? { partialBlockId: n.globalBlock } : ""
3352
3352
  })
3353
3353
  }) });
3354
- return w ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: A }) : A;
3354
+ return A ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: w }) : w;
3355
3355
  }, PartialBlocksRenderer = ({ partialBlockId: o }) => {
3356
3356
  const { getPartailBlocks: r } = usePartialBlocksStore(), n = useMemo(() => r(o), [r, o]), a = useMemo(() => splitAtom(atom(n)), [n]);
3357
3357
  return isEmpty(n) ? null : /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: a, blocks: n });
@@ -3404,7 +3404,7 @@ const useHandleCanvasDblClick = (o, r) => {
3404
3404
  d();
3405
3405
  }, [r, o, n, d]), l;
3406
3406
  }, getElementByStyleId = (o, r) => o.querySelector(`[data-style-id="${r}"]`), StaticCanvas = () => {
3407
- const [o] = useAtom$1(networkModeAtom), [r] = useCanvasDisplayWidth(), [, n] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), d = useRef(null), [c, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(c), [g, h] = useState([]), [, m] = useState([]), [, f] = useAtom$1(canvasIframeAtom), [x, y] = useSelectedStylingBlocks(), b = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), w = (_) => {
3407
+ const [o] = useAtom$1(networkModeAtom), [r] = useCanvasDisplayWidth(), [, n] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), d = useRef(null), [c, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(c), [g, h] = useState([]), [, m] = useState([]), [, f] = useAtom$1(canvasIframeAtom), [x, y] = useSelectedStylingBlocks(), b = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), A = (_) => {
3408
3408
  p((S) => ({ ...S, width: _ }));
3409
3409
  };
3410
3410
  useEffect(() => {
@@ -3412,7 +3412,7 @@ const useHandleCanvasDblClick = (o, r) => {
3412
3412
  const { clientWidth: _, clientHeight: S } = d.current;
3413
3413
  p({ width: _, height: S });
3414
3414
  }, [d, r]);
3415
- const A = (_, S = 0) => {
3415
+ const w = (_, S = 0) => {
3416
3416
  const { top: B } = _.getBoundingClientRect();
3417
3417
  return B + S >= 0 && B - S <= window.innerHeight;
3418
3418
  };
@@ -3420,7 +3420,7 @@ const useHandleCanvasDblClick = (o, r) => {
3420
3420
  var _, S;
3421
3421
  if (a != null && a._id && a.type !== "Multiple" && i.current) {
3422
3422
  const B = getElementByDataBlockId(i.current.contentDocument, a._id);
3423
- B && (A(B) || (S = (_ = i.current) == null ? void 0 : _.contentWindow) == null || S.scrollTo({ top: B.offsetTop, behavior: "smooth" }), h([B]));
3423
+ B && (w(B) || (S = (_ = i.current) == null ? void 0 : _.contentWindow) == null || S.scrollTo({ top: B.offsetTop, behavior: "smooth" }), h([B]));
3424
3424
  }
3425
3425
  }, [a == null ? void 0 : a._id, a == null ? void 0 : a.type]), useEffect(() => {
3426
3426
  if (!isEmpty(x) && i.current) {
@@ -3436,7 +3436,7 @@ const useHandleCanvasDblClick = (o, r) => {
3436
3436
  let _ = IframeInitialContent;
3437
3437
  return _ = _.replace("__HTML_DIR__", v), o === "offline" && (_ = _.replace("https://chaibuilder.com/offline/tailwind.cdn.js", "/offline/tailwind.cdn.js")), _;
3438
3438
  }, [o, v]);
3439
- return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: w, onResize: w, children: /* @__PURE__ */ jsx(
3439
+ return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: A, onResize: A, children: /* @__PURE__ */ jsx(
3440
3440
  "div",
3441
3441
  {
3442
3442
  onClick: () => {
@@ -3589,7 +3589,7 @@ const JSONFormFieldTemplate = ({
3589
3589
  formData: g,
3590
3590
  onChange: h
3591
3591
  }) => {
3592
- const { selectedLang: m, fallbackLang: f, languages: x } = useLanguages(), y = isEmpty(x) ? "" : isEmpty(m) ? f : m, b = get(LANGUAGES, y, y), v = usePageExternalData(), w = useSelectedBlock(), A = useRegisteredChaiBlocks(), E = get(A, [w == null ? void 0 : w._type, "i18nProps"], []) || [], [_, S] = useState(null), B = useSelectedBlockHierarchy(), T = useMemo(() => B.length === 1 ? "" : `#${get(
3592
+ const { selectedLang: m, fallbackLang: f, languages: x } = useLanguages(), y = isEmpty(x) ? "" : isEmpty(m) ? f : m, b = get(LANGUAGES, y, y), v = usePageExternalData(), A = useSelectedBlock(), w = useRegisteredChaiBlocks(), E = get(w, [A == null ? void 0 : A._type, "i18nProps"], []) || [], [_, S] = useState(null), B = useSelectedBlockHierarchy(), T = useMemo(() => B.length === 1 ? "" : `#${get(
3593
3593
  B.find((L) => L._type === "Repeater"),
3594
3594
  "repeaterItems",
3595
3595
  ""
@@ -3639,7 +3639,7 @@ const JSONFormFieldTemplate = ({
3639
3639
  h(K, {}, o);
3640
3640
  }
3641
3641
  },
3642
- [o, h, g, w == null ? void 0 : w._id, T]
3642
+ [o, h, g, A == null ? void 0 : A._id, T]
3643
3643
  );
3644
3644
  if (c)
3645
3645
  return null;
@@ -3879,7 +3879,7 @@ const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
3879
3879
  onChange: n
3880
3880
  }) => {
3881
3881
  var T;
3882
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, d] = useState(!1), [c, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null), w = (T = r == null ? void 0 : r.find((C) => C.key === u)) == null ? void 0 : T.name;
3882
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, d] = useState(!1), [c, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null), A = (T = r == null ? void 0 : r.find((C) => C.key === u)) == null ? void 0 : T.name;
3883
3883
  useEffect(() => {
3884
3884
  if (m(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
3885
3885
  const C = split(o, ":"), k = get(C, 1, "page") || "page";
@@ -3888,7 +3888,7 @@ const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
3888
3888
  j && Array.isArray(j) && m(get(j, [0, "name"], ""));
3889
3889
  })();
3890
3890
  }, [o]);
3891
- const A = useDebouncedCallback(
3891
+ const w = useDebouncedCallback(
3892
3892
  async (C) => {
3893
3893
  if (isEmpty(C))
3894
3894
  x([]);
@@ -3929,7 +3929,7 @@ const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
3929
3929
  const S = () => {
3930
3930
  m(""), x([]), b(-1), p(!1), n("");
3931
3931
  }, B = (C) => {
3932
- m(C), p(!isEmpty(C)), d(!0), A(C);
3932
+ m(C), p(!isEmpty(C)), d(!0), w(C);
3933
3933
  };
3934
3934
  return /* @__PURE__ */ jsxs("div", { children: [
3935
3935
  /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (C) => g(C.target.value), children: map(r, (C) => /* @__PURE__ */ jsx("option", { value: C.key, children: C.name }, C.key)) }),
@@ -3941,7 +3941,7 @@ const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
3941
3941
  value: h,
3942
3942
  onChange: (C) => B(C.target.value),
3943
3943
  onKeyDown: _,
3944
- placeholder: a(`Search ${w ?? ""}`),
3944
+ placeholder: a(`Search ${A ?? ""}`),
3945
3945
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
3946
3946
  }
3947
3947
  ),
@@ -4253,11 +4253,11 @@ const MenuBar = ({ editor: o, onExpand: r }) => {
4253
4253
  if (f !== x)
4254
4254
  u.chain().deleteSelection().insertContent(m).run();
4255
4255
  else {
4256
- const { state: b } = u, v = b.selection.from, w = b.doc.textBetween(Math.max(0, v - 1), v), A = b.doc.textBetween(v, Math.min(v + 1, b.doc.content.size));
4256
+ const { state: b } = u, v = b.selection.from, A = b.doc.textBetween(Math.max(0, v - 1), v), w = b.doc.textBetween(v, Math.min(v + 1, b.doc.content.size));
4257
4257
  let E = "";
4258
- v > 0 && w !== " " && !/[.,!?;:]/.test(w) && (E = " ");
4258
+ v > 0 && A !== " " && !/[.,!?;:]/.test(A) && (E = " ");
4259
4259
  let _ = "";
4260
- A && A !== " " && !/[.,!?;:]/.test(A) && (_ = " "), u.chain().insertContent(E + m + _).run();
4260
+ w && w !== " " && !/[.,!?;:]/.test(w) && (_ = " "), u.chain().insertContent(E + m + _).run();
4261
4261
  }
4262
4262
  };
4263
4263
  return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (h) => !h && r(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
@@ -4604,7 +4604,7 @@ function BlockSettings() {
4604
4604
  S && (n([r._id], { [S]: get(_, S) }), x({ formData: _ }, S, { [S]: get(d, S) }));
4605
4605
  }, b = ({ formData: _ }, S) => {
4606
4606
  S && (n([g._id], { [S]: get(_, S) }), x({ formData: _ }, S, { [S]: get(d, S) }));
4607
- }, { schema: v, uiSchema: w } = useMemo(() => {
4607
+ }, { schema: v, uiSchema: A } = useMemo(() => {
4608
4608
  const _ = r == null ? void 0 : r._type;
4609
4609
  if (!_)
4610
4610
  return { schema: {}, uiSchema: {} };
@@ -4613,7 +4613,7 @@ function BlockSettings() {
4613
4613
  } catch {
4614
4614
  return { schema: {}, uiSchema: {} };
4615
4615
  }
4616
- }, [r]), { wrapperSchema: A, wrapperUiSchema: E } = useMemo(() => {
4616
+ }, [r]), { wrapperSchema: w, wrapperUiSchema: E } = useMemo(() => {
4617
4617
  if (!g || !(g != null && g._type))
4618
4618
  return { wrapperSchema: {}, wrapperUiSchema: {} };
4619
4619
  const _ = g == null ? void 0 : g._type, { schema: S = {}, uiSchema: B = {} } = getBlockFormSchemas(_);
@@ -4645,7 +4645,7 @@ function BlockSettings() {
4645
4645
  blockId: g == null ? void 0 : g._id,
4646
4646
  onChange: b,
4647
4647
  formData: m,
4648
- schema: A,
4648
+ schema: w,
4649
4649
  uiSchema: E
4650
4650
  }
4651
4651
  ) })
@@ -4657,7 +4657,7 @@ function BlockSettings() {
4657
4657
  onChange: y,
4658
4658
  formData: i,
4659
4659
  schema: v,
4660
- uiSchema: w
4660
+ uiSchema: A
4661
4661
  }
4662
4662
  )
4663
4663
  ] });
@@ -4834,7 +4834,7 @@ const BlockStylingProps = () => {
4834
4834
  },
4835
4835
  a
4836
4836
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
4837
- const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: d, classPrefix: c, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [v, w] = useState(!1), [A, E] = useState(!1);
4837
+ const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: d, classPrefix: c, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [v, A] = useState(!1), [w, E] = useState(!1);
4838
4838
  useEffect(() => {
4839
4839
  const { value: C, unit: k } = getClassValueAndUnit(i);
4840
4840
  if (k === "") {
@@ -4912,7 +4912,7 @@ const BlockStylingProps = () => {
4912
4912
  S(P);
4913
4913
  },
4914
4914
  onKeyUp: (C) => {
4915
- A && (C.preventDefault(), E(!1));
4915
+ w && (C.preventDefault(), E(!1));
4916
4916
  },
4917
4917
  onBlur: () => B(),
4918
4918
  onChange: (C) => {
@@ -4957,9 +4957,9 @@ const BlockStylingProps = () => {
4957
4957
  ["none", "auto"].indexOf(h) !== -1 || v ? null : /* @__PURE__ */ jsx(
4958
4958
  DragStyleButton,
4959
4959
  {
4960
- onDragStart: () => w(!0),
4960
+ onDragStart: () => A(!0),
4961
4961
  onDragEnd: (C) => {
4962
- if (b(() => ""), w(!1), isEmpty(C))
4962
+ if (b(() => ""), A(!1), isEmpty(C))
4963
4963
  return;
4964
4964
  const k = `${C}`, I = `${k.startsWith("-") ? "-" : ""}${c}[${k.replace("-", "")}${h === "-" ? "" : h}]`;
4965
4965
  _(I);
@@ -5442,13 +5442,13 @@ const COLOR_PROP = {
5442
5442
  [x, p, g, u, l, m]
5443
5443
  ), v = useCallback(() => {
5444
5444
  f(x, [y], !0);
5445
- }, [x, y, f]), w = useMemo(() => canChangeClass(h, g), [h, g]);
5445
+ }, [x, y, f]), A = useMemo(() => canChangeClass(h, g), [h, g]);
5446
5446
  useEffect(() => {
5447
- i(w, h);
5448
- }, [w, i, h]);
5449
- const [, , A] = useScreenSizeWidth(), E = useCallback(
5447
+ i(A, h);
5448
+ }, [A, i, h]);
5449
+ const [, , w] = useScreenSizeWidth(), E = useCallback(
5450
5450
  (S) => {
5451
- A({
5451
+ w({
5452
5452
  xs: 400,
5453
5453
  sm: 640,
5454
5454
  md: 800,
@@ -5457,9 +5457,9 @@ const COLOR_PROP = {
5457
5457
  "2xl": 1920
5458
5458
  }[S]);
5459
5459
  },
5460
- [A]
5460
+ [w]
5461
5461
  ), _ = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === g;
5462
- return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: w, canReset: h && _, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
5462
+ return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: A, canReset: h && _, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
5463
5463
  /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${h && !_ ? "text-foreground" : ""}`, children: r(a) }) }),
5464
5464
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
5465
5465
  /* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
@@ -5479,7 +5479,7 @@ const COLOR_PROP = {
5479
5479
  n === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
5480
5480
  n === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
5481
5481
  ] }),
5482
- /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : w && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
5482
+ /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : A && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
5483
5483
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5484
5484
  "button",
5485
5485
  {
@@ -5880,10 +5880,10 @@ const AskAIStyles = ({ blockId: o }) => {
5880
5880
  };
5881
5881
  function ManualClasses() {
5882
5882
  var I;
5883
- const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: d } = useTranslation(), [c] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (I = first(c)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((N) => !isEmpty(N)), w = () => {
5883
+ const o = useRef(null), [r, n] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: d } = useTranslation(), [c] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (I = first(c)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((N) => !isEmpty(N)), A = () => {
5884
5884
  const N = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5885
5885
  u(h, N, !0), x("");
5886
- }, [A, E] = useState([]), _ = ({ value: N }) => {
5886
+ }, [w, E] = useState([]), _ = ({ value: N }) => {
5887
5887
  const P = N.trim().toLowerCase(), L = P.match(/.+:/g);
5888
5888
  let O = [];
5889
5889
  if (L && L.length > 0) {
@@ -5912,7 +5912,7 @@ function ManualClasses() {
5912
5912
  }, 0);
5913
5913
  },
5914
5914
  onKeyDown: (N) => {
5915
- N.key === "Enter" && f.trim() !== "" && w();
5915
+ N.key === "Enter" && f.trim() !== "" && A();
5916
5916
  },
5917
5917
  onChange: (N, { newValue: P }) => x(P),
5918
5918
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
@@ -5950,7 +5950,7 @@ function ManualClasses() {
5950
5950
  /* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
5951
5951
  Autosuggest,
5952
5952
  {
5953
- suggestions: A,
5953
+ suggestions: w,
5954
5954
  onSuggestionsFetchRequested: _,
5955
5955
  onSuggestionsClearRequested: S,
5956
5956
  getSuggestionValue: B,
@@ -5971,7 +5971,7 @@ function ManualClasses() {
5971
5971
  {
5972
5972
  variant: "outline",
5973
5973
  className: "h-6 border-border",
5974
- onClick: w,
5974
+ onClick: A,
5975
5975
  disabled: f.trim() === "",
5976
5976
  size: "sm",
5977
5977
  children: /* @__PURE__ */ jsx(PlusIcon, {})
@@ -6396,22 +6396,22 @@ const CoreBlock = ({
6396
6396
  }
6397
6397
  }
6398
6398
  }, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
6399
- var h, m, f, x, y, b, v, w;
6399
+ var h, m, f, x, y, b, v, A;
6400
6400
  if (n.type === "comment") return [];
6401
6401
  console.log("node ===>", n);
6402
6402
  let a = { _id: generateUUID() };
6403
6403
  if (r && (a._parent = r.block._id), n.type === "text")
6404
6404
  return isEmpty(get(n, "content", "")) ? [] : r && shouldAddText(r.node, r.block) ? (set(r, "block.content", get(n, "content", "")), []) : { ...a, _type: "Text", content: get(n, "content", "") };
6405
6405
  const l = get(n, "attributes", []), i = l.find(
6406
- (A) => A.key === "data-chai-richtext" || A.key === "chai-richtext"
6406
+ (w) => w.key === "data-chai-richtext" || w.key === "chai-richtext"
6407
6407
  ), d = l.find(
6408
- (A) => A.key === "data-chai-lightbox" || A.key === "chai-lightbox"
6408
+ (w) => w.key === "data-chai-lightbox" || w.key === "chai-lightbox"
6409
6409
  ), c = l.find(
6410
- (A) => A.key === "data-chai-dropdown" || A.key === "chai-dropdown"
6410
+ (w) => w.key === "data-chai-dropdown" || w.key === "chai-dropdown"
6411
6411
  ), p = l.find(
6412
- (A) => A.key === "data-chai-dropdown-button" || A.key === "chai-dropdown-button"
6412
+ (w) => w.key === "data-chai-dropdown-button" || w.key === "chai-dropdown-button"
6413
6413
  ), u = l.find(
6414
- (A) => A.key === "data-chai-dropdown-content" || A.key === "chai-dropdown-content"
6414
+ (w) => w.key === "data-chai-dropdown-content" || w.key === "chai-dropdown-content"
6415
6415
  );
6416
6416
  if (a = {
6417
6417
  ...a,
@@ -6419,13 +6419,13 @@ const CoreBlock = ({
6419
6419
  ...getAttrs(n),
6420
6420
  ...getStyles(n)
6421
6421
  }, n.attributes) {
6422
- const A = n.attributes.find((E) => includes(NAME_ATTRIBUTES, E.key));
6423
- A && (a._name = A.value);
6422
+ const w = n.attributes.find((E) => includes(NAME_ATTRIBUTES, E.key));
6423
+ w && (a._name = w.value);
6424
6424
  }
6425
6425
  if (i)
6426
6426
  return a.content = stringify(n.children), has(a, "styles_attrs.data-chai-richtext") && delete a.styles_attrs["data-chai-richtext"], has(a, "styles_attrs.chai-richtext") && delete a.styles_attrs["chai-richtext"], [a];
6427
6427
  if (d) {
6428
- const A = [
6428
+ const w = [
6429
6429
  "data-chai-lightbox",
6430
6430
  "chai-lightbox",
6431
6431
  "data-vbtype",
@@ -6443,14 +6443,14 @@ const CoreBlock = ({
6443
6443
  maxWidth: ((y = (x = l.find((E) => E.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : y.replace("px", "")) || "",
6444
6444
  backdropColor: ((b = l.find((E) => E.key === "data-overlay")) == null ? void 0 : b.value) || "",
6445
6445
  galleryName: ((v = l.find((E) => E.key === "data-gall")) == null ? void 0 : v.value) || ""
6446
- }, forEach(A, (E) => {
6446
+ }, forEach(w, (E) => {
6447
6447
  has(a, `styles_attrs.${E}`) && delete a.styles_attrs[E];
6448
6448
  });
6449
6449
  }
6450
6450
  if (c && (delete a.styles_attrs, a.showDropdown = !1), u && delete a.styles_attrs, p) {
6451
6451
  delete a.styles_attrs;
6452
- const A = filter(n.children || [], (_) => (_ == null ? void 0 : _.tagName) !== "span");
6453
- a.content = getTextContent(A);
6452
+ const w = filter(n.children || [], (_) => (_ == null ? void 0 : _.tagName) !== "span");
6453
+ a.content = getTextContent(w);
6454
6454
  const E = find(
6455
6455
  n.children || [],
6456
6456
  (_) => (_ == null ? void 0 : _.tagName) === "span" && some(_.children || [], (S) => (S == null ? void 0 : S.tagName) === "svg")
@@ -6466,15 +6466,15 @@ const CoreBlock = ({
6466
6466
  return [a];
6467
6467
  }
6468
6468
  if (a._type === "Input") {
6469
- const A = a.inputType || "text";
6470
- A === "checkbox" ? set(a, "_type", "Checkbox") : A === "radio" && set(a, "_type", "Radio");
6469
+ const w = a.inputType || "text";
6470
+ w === "checkbox" ? set(a, "_type", "Checkbox") : w === "radio" && set(a, "_type", "Radio");
6471
6471
  } else if (n.tagName === "video" || n.tagName === "iframe") {
6472
- const A = stringify([n]);
6473
- return hasVideoEmbed(A) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(A)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = A, [a];
6472
+ const w = stringify([n]);
6473
+ return hasVideoEmbed(w) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(w)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = w, [a];
6474
6474
  } else if (n.tagName === "svg") {
6475
- const A = find(n.attributes, { key: "height" }), E = find(n.attributes, { key: "width" }), _ = get(A, "value") ? `[${get(A, "value")}px]` : "24px", S = get(E, "value") ? `[${get(E, "value")}px]` : "24px", B = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
6475
+ const w = find(n.attributes, { key: "height" }), E = find(n.attributes, { key: "width" }), _ = get(w, "value") ? `[${get(w, "value")}px]` : "24px", S = get(E, "value") ? `[${get(E, "value")}px]` : "24px", B = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
6476
6476
  return a.styles = `${STYLES_KEY}, ${cn$1(`w-${S} h-${_}`, B)}`.trim(), n.attributes = filter(n.attributes, (T) => !includes(["style", "width", "height", "class"], T.key)), a.icon = stringify([n]), [a];
6477
- } else if (n.tagName == "option" && r && ((w = r.block) == null ? void 0 : w._type) === "Select")
6477
+ } else if (n.tagName == "option" && r && ((A = r.block) == null ? void 0 : A._type) === "Select")
6478
6478
  return r.block.options.push({
6479
6479
  label: getTextContent(n.children),
6480
6480
  ...getAttrs(n)
@@ -6578,18 +6578,18 @@ const BlockCard = ({
6578
6578
  parentId: n = void 0,
6579
6579
  position: a = -1
6580
6580
  }) => {
6581
- const [l, i] = useState(!1), d = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (w) => {
6582
- const A = has(w, "styles_attrs.data-page-section");
6583
- return w._type === "Box" && A;
6581
+ const [l, i] = useState(!1), d = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (A) => {
6582
+ const w = has(A, "styles_attrs.data-page-section");
6583
+ return A._type === "Box" && w;
6584
6584
  }, b = useCallback(
6585
- async (w) => {
6586
- if (w.stopPropagation(), has(o, "component")) {
6585
+ async (A) => {
6586
+ if (A.stopPropagation(), has(o, "component")) {
6587
6587
  c(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
6588
6588
  return;
6589
6589
  }
6590
6590
  i(!0);
6591
- const A = await d(r, o);
6592
- isEmpty(A) || p(syncBlocksWithDefaults(A), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
6591
+ const w = await d(r, o);
6592
+ isEmpty(w) || p(syncBlocksWithDefaults(w), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
6593
6593
  },
6594
6594
  [c, p, o, d, r, n, a]
6595
6595
  );
@@ -6600,18 +6600,18 @@ const BlockCard = ({
6600
6600
  onClick: l ? () => {
6601
6601
  } : b,
6602
6602
  draggable: f ? "true" : "false",
6603
- onDragStart: async (w) => {
6604
- const A = await d(r, o);
6603
+ onDragStart: async (A) => {
6604
+ const w = await d(r, o);
6605
6605
  let E = n;
6606
- if (y(first(A)) && (E = null), !isEmpty(A)) {
6607
- const _ = { blocks: A, uiLibrary: !0, parent: E };
6608
- if (w.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
6606
+ if (y(first(w)) && (E = null), !isEmpty(w)) {
6607
+ const _ = { blocks: w, uiLibrary: !0, parent: E };
6608
+ if (A.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
6609
6609
  const S = new Image();
6610
6610
  S.src = o.preview, S.onload = () => {
6611
- w.dataTransfer.setDragImage(S, 0, 0);
6611
+ A.dataTransfer.setDragImage(S, 0, 0);
6612
6612
  };
6613
6613
  } else
6614
- w.dataTransfer.setDragImage(new Image(), 0, 0);
6614
+ A.dataTransfer.setDragImage(new Image(), 0, 0);
6615
6615
  x(_), setTimeout(() => {
6616
6616
  u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
6617
6617
  }, 200);
@@ -6664,9 +6664,9 @@ const BlockCard = ({
6664
6664
  return;
6665
6665
  }
6666
6666
  }, [y, b]);
6667
- const w = get(y, b, []), A = useRef(null), { t: E } = useTranslation(), _ = (k) => {
6668
- A.current && (clearTimeout(A.current), A.current = null), A.current = setTimeout(() => {
6669
- A.current && v(k);
6667
+ const A = get(y, b, []), w = useRef(null), { t: E } = useTranslation(), _ = (k) => {
6668
+ w.current && (clearTimeout(w.current), w.current = null), w.current = setTimeout(() => {
6669
+ w.current && v(k);
6670
6670
  }, 400);
6671
6671
  }, S = () => {
6672
6672
  i != null && i.id && p(i.id);
@@ -6678,7 +6678,7 @@ const BlockCard = ({
6678
6678
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
6679
6679
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
6680
6680
  ] });
6681
- const T = filter(w, (k, j) => j % 2 === 0), C = filter(w, (k, j) => j % 2 === 1);
6681
+ const T = filter(A, (k, j) => j % 2 === 0), C = filter(A, (k, j) => j % 2 === 1);
6682
6682
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
6683
6683
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 border-border py-2", children: /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
6684
6684
  /* @__PURE__ */ jsx(Search, { className: "absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }),
@@ -6716,7 +6716,7 @@ const BlockCard = ({
6716
6716
  "div",
6717
6717
  {
6718
6718
  onMouseEnter: () => _(j),
6719
- onMouseLeave: () => clearTimeout(A.current),
6719
+ onMouseLeave: () => clearTimeout(w.current),
6720
6720
  role: "button",
6721
6721
  onClick: () => v(j),
6722
6722
  className: cn$1(
@@ -6735,10 +6735,10 @@ const BlockCard = ({
6735
6735
  /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-col border-l border-border", children: /* @__PURE__ */ jsxs(
6736
6736
  ScrollArea,
6737
6737
  {
6738
- onMouseEnter: () => A.current ? clearTimeout(A.current) : null,
6738
+ onMouseEnter: () => w.current ? clearTimeout(w.current) : null,
6739
6739
  className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
6740
6740
  children: [
6741
- isEmpty(w) && !isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: E("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
6741
+ isEmpty(A) && !isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "flex h-full flex-col items-center justify-center p-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: E("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: "grid w-full grid-cols-2 gap-2 px-2", children: [
6742
6742
  /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: T.map((k, j) => /* @__PURE__ */ jsx(
6743
6743
  BlockCard,
6744
6744
  {
@@ -6794,14 +6794,14 @@ const BlockCard = ({
6794
6794
  }), g(!0);
6795
6795
  else if (!l && Object.keys(a || {}).length > 0) {
6796
6796
  const m = Object.entries(a).map(([x, y]) => {
6797
- const b = y, v = b.type || "partial", w = formatReadableName(v);
6797
+ const b = y, v = b.type || "partial", A = formatReadableName(v);
6798
6798
  return {
6799
6799
  type: "PartialBlock",
6800
6800
  // Set the type to PartialBlock
6801
6801
  label: formatReadableName(b.name || x),
6802
6802
  description: b.description || "",
6803
6803
  icon: Globe,
6804
- group: w,
6804
+ group: A,
6805
6805
  // Use formatted type as group
6806
6806
  category: "partial",
6807
6807
  partialBlockId: x,
@@ -6873,9 +6873,9 @@ const BlockCard = ({
6873
6873
  }), []);
6874
6874
  const v = useCallback((k) => {
6875
6875
  y(k), b.current && b.current(k);
6876
- }, []), w = useCallback(() => {
6876
+ }, []), A = useCallback(() => {
6877
6877
  y(null), b.current && b.current.cancel();
6878
- }, []), A = useCallback((k) => {
6878
+ }, []), w = useCallback((k) => {
6879
6879
  b.current && b.current.cancel(), f(k), y(null);
6880
6880
  }, []), E = useMemo(
6881
6881
  () => c ? values(r).filter(
@@ -6911,9 +6911,9 @@ const BlockCard = ({
6911
6911
  /* @__PURE__ */ jsx(
6912
6912
  "button",
6913
6913
  {
6914
- onClick: () => A("all"),
6914
+ onClick: () => w("all"),
6915
6915
  onMouseEnter: () => v("all"),
6916
- onMouseLeave: w,
6916
+ onMouseLeave: A,
6917
6917
  className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
6918
6918
  children: i("All")
6919
6919
  },
@@ -6922,9 +6922,9 @@ const BlockCard = ({
6922
6922
  S.map((k) => /* @__PURE__ */ jsx(
6923
6923
  "button",
6924
6924
  {
6925
- onClick: () => A(k),
6925
+ onClick: () => w(k),
6926
6926
  onMouseEnter: () => v(k),
6927
- onMouseLeave: w,
6927
+ onMouseLeave: A,
6928
6928
  className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === k || x === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
6929
6929
  children: capitalize(i(k.toLowerCase()))
6930
6930
  },
@@ -7301,7 +7301,7 @@ const Input = ({ node: o }) => {
7301
7301
  var P;
7302
7302
  const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
7303
7303
  let p = null;
7304
- const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: w } = o, A = (L) => {
7304
+ const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: A } = o, w = (L) => {
7305
7305
  L.stopPropagation(), !l.includes(m) && o.toggle();
7306
7306
  }, E = (L) => {
7307
7307
  L.isInternal && (p = L.isOpen, L.isOpen && L.close());
@@ -7313,7 +7313,7 @@ const Input = ({ node: o }) => {
7313
7313
  }, C = () => {
7314
7314
  B(null);
7315
7315
  }, k = (L) => {
7316
- C(), L.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), w(L);
7316
+ C(), L.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), A(L);
7317
7317
  };
7318
7318
  useEffect(() => {
7319
7319
  const L = setTimeout(() => {
@@ -7401,7 +7401,7 @@ const Input = ({ node: o }) => {
7401
7401
  "div",
7402
7402
  {
7403
7403
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
7404
- children: u && /* @__PURE__ */ jsx("button", { onClick: A, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-white" : "text-slate-400"}` }) })
7404
+ children: u && /* @__PURE__ */ jsx("button", { onClick: w, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-white" : "text-slate-400"}` }) })
7405
7405
  }
7406
7406
  ),
7407
7407
  /* @__PURE__ */ jsxs(
@@ -7723,19 +7723,19 @@ const Input = ({ node: o }) => {
7723
7723
  const [r] = useDarkMode(), [n, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), { hasPermission: d } = usePermissions(), [c, p] = useTheme(), u = useThemeOptions(), { t: g } = useTranslation(), h = (v) => {
7724
7724
  a(v);
7725
7725
  }, m = () => {
7726
- const v = l.find((w) => Object.keys(w)[0] === n);
7726
+ const v = l.find((A) => Object.keys(A)[0] === n);
7727
7727
  if (v) {
7728
- const w = Object.values(v)[0];
7729
- w && typeof w == "object" && "fontFamily" in w && "borderRadius" in w && "colors" in w ? p(w) : console.error("Invalid preset structure:", w);
7728
+ const A = Object.values(v)[0];
7729
+ A && typeof A == "object" && "fontFamily" in A && "borderRadius" in A && "colors" in A ? p(A) : console.error("Invalid preset structure:", A);
7730
7730
  } else
7731
7731
  console.error("Preset not found:", n);
7732
7732
  }, f = useDebouncedCallback(
7733
- (v, w) => {
7733
+ (v, A) => {
7734
7734
  p(() => ({
7735
7735
  ...c,
7736
7736
  fontFamily: {
7737
7737
  ...c.fontFamily,
7738
- [v.replace(/font-/g, "")]: w
7738
+ [v.replace(/font-/g, "")]: A
7739
7739
  }
7740
7740
  }));
7741
7741
  },
@@ -7751,32 +7751,32 @@ const Input = ({ node: o }) => {
7751
7751
  [c],
7752
7752
  200
7753
7753
  ), y = useDebouncedCallback(
7754
- (v, w) => {
7754
+ (v, A) => {
7755
7755
  p(() => {
7756
- const A = get(c, `colors.${v}`);
7757
- return r ? set(A, 1, w) : set(A, 0, w), {
7756
+ const w = get(c, `colors.${v}`);
7757
+ return r ? set(w, 1, A) : set(w, 0, A), {
7758
7758
  ...c,
7759
7759
  colors: {
7760
7760
  ...c.colors,
7761
- [v]: A
7761
+ [v]: w
7762
7762
  }
7763
7763
  };
7764
7764
  });
7765
7765
  },
7766
7766
  [c],
7767
7767
  200
7768
- ), b = (v) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(v.items).map(([w]) => {
7769
- const A = get(c, `colors.${w}.${r ? 1 : 0}`);
7768
+ ), b = (v) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(v.items).map(([A]) => {
7769
+ const w = get(c, `colors.${A}.${r ? 1 : 0}`);
7770
7770
  return /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
7771
7771
  /* @__PURE__ */ jsx(
7772
7772
  ColorPickerInput,
7773
7773
  {
7774
- value: A,
7775
- onChange: (E) => y(w, E)
7774
+ value: w,
7775
+ onChange: (E) => y(A, E)
7776
7776
  }
7777
7777
  ),
7778
- /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: w.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" ") + (!w.toLowerCase().includes("foreground") && !w.toLowerCase().includes("border") && !w.toLowerCase().includes("input") && !w.toLowerCase().includes("ring") && !w.toLowerCase().includes("background") ? " Background" : "") })
7779
- ] }, w);
7778
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: A.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((E) => E.charAt(0).toUpperCase() + E.slice(1)).join(" ") + (!A.toLowerCase().includes("foreground") && !A.toLowerCase().includes("border") && !A.toLowerCase().includes("input") && !A.toLowerCase().includes("ring") && !A.toLowerCase().includes("background") ? " Background" : "") })
7779
+ ] }, A);
7780
7780
  }) });
7781
7781
  return d("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
7782
7782
  /* @__PURE__ */ jsxs("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto", o), children: [
@@ -7808,12 +7808,12 @@ const Input = ({ node: o }) => {
7808
7808
  ) })
7809
7809
  ] }),
7810
7810
  /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", o), children: [
7811
- (u == null ? void 0 : u.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(u.fontFamily).map(([v, w]) => /* @__PURE__ */ jsx(
7811
+ (u == null ? void 0 : u.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(u.fontFamily).map(([v, A]) => /* @__PURE__ */ jsx(
7812
7812
  FontSelector,
7813
7813
  {
7814
7814
  label: v,
7815
- value: c.fontFamily[v.replace(/font-/g, "")] || w[Object.keys(w)[0]],
7816
- onChange: (A) => f(v, A)
7815
+ value: c.fontFamily[v.replace(/font-/g, "")] || A[Object.keys(A)[0]],
7816
+ onChange: (w) => f(v, w)
7817
7817
  },
7818
7818
  v
7819
7819
  )) }),
@@ -8532,19 +8532,19 @@ function AIChatPanel() {
8532
8532
  content: "This is a sample response from the AI assistant. In a real implementation, this would be replaced with an actual response from the AI model.",
8533
8533
  timestamp: /* @__PURE__ */ new Date()
8534
8534
  };
8535
- r((w) => [...w, v]), i(!1), c(null);
8535
+ r((A) => [...A, v]), i(!1), c(null);
8536
8536
  }, 1500);
8537
8537
  }, m = (b) => {
8538
8538
  b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
8539
8539
  }, f = (b) => {
8540
- var w;
8541
- const v = (w = b.target.files) == null ? void 0 : w[0];
8540
+ var A;
8541
+ const v = (A = b.target.files) == null ? void 0 : A[0];
8542
8542
  if (v) {
8543
- const A = new FileReader();
8544
- A.onload = (E) => {
8543
+ const w = new FileReader();
8544
+ w.onload = (E) => {
8545
8545
  var _;
8546
8546
  c((_ = E.target) == null ? void 0 : _.result);
8547
- }, A.readAsDataURL(v);
8547
+ }, w.readAsDataURL(v);
8548
8548
  }
8549
8549
  }, x = () => {
8550
8550
  var b;
@@ -8761,9 +8761,9 @@ const AddBlocksDialog = () => {
8761
8761
  }, v = (S) => {
8762
8762
  const B = a.filter((T, C) => C !== S);
8763
8763
  n(B), l(B);
8764
- }, w = (S) => {
8764
+ }, A = (S) => {
8765
8765
  g(S), d(a[S].key), p(a[S].value);
8766
- }, A = () => {
8766
+ }, w = () => {
8767
8767
  if (i.startsWith("@")) {
8768
8768
  m("Attribute keys cannot start with '@'");
8769
8769
  return;
@@ -8773,7 +8773,7 @@ const AddBlocksDialog = () => {
8773
8773
  S[u] = { key: i, value: c }, n(S), l(S), g(null), d(""), p(""), m("");
8774
8774
  }
8775
8775
  }, E = (S) => {
8776
- S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? A() : b());
8776
+ S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? w() : b());
8777
8777
  }, _ = useCallback((S) => {
8778
8778
  const B = (k) => /[.,!?;:]/.test(k), T = (k, j, I) => {
8779
8779
  let N = "", P = "";
@@ -8800,7 +8800,7 @@ const AddBlocksDialog = () => {
8800
8800
  "form",
8801
8801
  {
8802
8802
  onSubmit: (S) => {
8803
- S.preventDefault(), u !== null ? A() : b();
8803
+ S.preventDefault(), u !== null ? w() : b();
8804
8804
  },
8805
8805
  className: "space-y-3",
8806
8806
  children: [
@@ -8856,7 +8856,7 @@ const AddBlocksDialog = () => {
8856
8856
  /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: S.value.toString() })
8857
8857
  ] }),
8858
8858
  /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
8859
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => w(B), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
8859
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(B), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
8860
8860
  /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(B), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
8861
8861
  ] })
8862
8862
  ] }, B)) })
@@ -8988,11 +8988,11 @@ const RootLayout = () => {
8988
8988
  S && get(S, "view", "standard") === "standard" && (a.current = r, i(get(S, "width", DEFAULT_PANEL_WIDTH)));
8989
8989
  }
8990
8990
  }, [r, x]);
8991
- const w = useMemo(() => {
8991
+ const A = useMemo(() => {
8992
8992
  if (r === null) return 0;
8993
8993
  const S = find(x, { id: r });
8994
8994
  return get(S, "view", "standard") === "standard" ? v : l;
8995
- }, [r, v, l, x]), A = () => {
8995
+ }, [r, v, l, x]), w = () => {
8996
8996
  n(a.current);
8997
8997
  }, E = useCallback(() => {
8998
8998
  n("outline");
@@ -9041,8 +9041,8 @@ const RootLayout = () => {
9041
9041
  {
9042
9042
  id: "left-panel",
9043
9043
  className: "h-full max-h-full border-r border-border",
9044
- initial: { width: w },
9045
- animate: { width: w },
9044
+ initial: { width: A },
9045
+ animate: { width: A },
9046
9046
  transition: { duration: 0.3, ease: "easeInOut" },
9047
9047
  children: r !== null && get(b, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
9048
9048
  /* @__PURE__ */ jsx(
@@ -9093,7 +9093,7 @@ const RootLayout = () => {
9093
9093
  ] }) })
9094
9094
  }
9095
9095
  ),
9096
- r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => A(), children: /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "p-0 sm:max-w-full", style: { width: `${v}px` }, children: [
9096
+ r !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "p-0 sm:max-w-full", style: { width: `${v}px` }, children: [
9097
9097
  /* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border p-4 pb-2", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
9098
9098
  /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
9099
9099
  /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
@@ -9103,7 +9103,7 @@ const RootLayout = () => {
9103
9103
  }) }) })
9104
9104
  ] }) }),
9105
9105
  " ",
9106
- r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => A(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "p-0", style: { maxWidth: `${v}px` }, children: [
9106
+ r !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "p-0", style: { maxWidth: `${v}px` }, children: [
9107
9107
  /* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border p-4 pb-2", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
9108
9108
  /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
9109
9109
  /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
@@ -9134,7 +9134,7 @@ const RootLayout = () => {
9134
9134
  /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
9135
9135
  /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9136
9136
  ] }),
9137
- /* @__PURE__ */ jsx(Button, { onClick: () => A(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
9137
+ /* @__PURE__ */ jsx(Button, { onClick: () => w(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
9138
9138
  ] }),
9139
9139
  /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
9140
9140
  close: E
@@ -9292,7 +9292,7 @@ const FEATURE_TOGGLES = {
9292
9292
  P = !0;
9293
9293
  break;
9294
9294
  }
9295
- P && (y(I), w(I)), n.delete(I);
9295
+ P && (y(I), A(I)), n.delete(I);
9296
9296
  }
9297
9297
  }), y = h[3] || ((B) => {
9298
9298
  var T, C;
@@ -9308,7 +9308,7 @@ const FEATURE_TOGGLES = {
9308
9308
  k.d.clear();
9309
9309
  let j = !0;
9310
9310
  const I = () => {
9311
- r.has(B) && (w(B), x(), f());
9311
+ r.has(B) && (A(B), x(), f());
9312
9312
  }, N = (R) => {
9313
9313
  var D;
9314
9314
  if (isSelfAtom(B, R)) {
@@ -9373,7 +9373,7 @@ const FEATURE_TOGGLES = {
9373
9373
  if (!hasInitialValue(I))
9374
9374
  throw new Error("atom not writable");
9375
9375
  const O = L.n, $ = N[0];
9376
- setAtomStateValueOrPromise(I, $, m), w(I), O !== L.n && (a.add(I), (P = d.c) == null || P.call(d, I), b(I));
9376
+ setAtomStateValueOrPromise(I, $, m), A(I), O !== L.n && (a.add(I), (P = d.c) == null || P.call(d, I), b(I));
9377
9377
  return;
9378
9378
  } else
9379
9379
  return v(I, ...N);
@@ -9386,14 +9386,14 @@ const FEATURE_TOGGLES = {
9386
9386
  } finally {
9387
9387
  C = !1;
9388
9388
  }
9389
- }), w = h[6] || ((B) => {
9389
+ }), A = h[6] || ((B) => {
9390
9390
  var T;
9391
9391
  const C = m(B), k = r.get(B);
9392
9392
  if (k && !isPendingPromise(C.v)) {
9393
9393
  for (const [j, I] of C.d)
9394
9394
  if (!k.d.has(j)) {
9395
9395
  const N = m(j);
9396
- A(j).t.add(B), k.d.add(j), I !== N.n && (a.add(j), (T = d.c) == null || T.call(d, j), b(j));
9396
+ w(j).t.add(B), k.d.add(j), I !== N.n && (a.add(j), (T = d.c) == null || T.call(d, j), b(j));
9397
9397
  }
9398
9398
  for (const j of k.d || [])
9399
9399
  if (!C.d.has(j)) {
@@ -9402,14 +9402,14 @@ const FEATURE_TOGGLES = {
9402
9402
  I == null || I.t.delete(B);
9403
9403
  }
9404
9404
  }
9405
- }), A = h[7] || ((B) => {
9405
+ }), w = h[7] || ((B) => {
9406
9406
  var T;
9407
9407
  const C = m(B);
9408
9408
  let k = r.get(B);
9409
9409
  if (!k) {
9410
9410
  y(B);
9411
9411
  for (const j of C.d.keys())
9412
- A(j).t.add(B);
9412
+ w(j).t.add(B);
9413
9413
  if (k = {
9414
9414
  l: /* @__PURE__ */ new Set(),
9415
9415
  d: new Set(C.d.keys()),
@@ -9479,8 +9479,8 @@ const FEATURE_TOGGLES = {
9479
9479
  y,
9480
9480
  b,
9481
9481
  v,
9482
- w,
9483
9482
  A,
9483
+ w,
9484
9484
  E
9485
9485
  ], S = {
9486
9486
  get: (B) => returnAtomValue(y(B)),
@@ -9492,7 +9492,7 @@ const FEATURE_TOGGLES = {
9492
9492
  }
9493
9493
  },
9494
9494
  sub: (B, T) => {
9495
- const k = A(B).l;
9495
+ const k = w(B).l;
9496
9496
  return k.add(T), f(), () => {
9497
9497
  k.delete(T), E(B), f();
9498
9498
  };