@chaibuilder/sdk 3.2.4 → 3.2.5

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.
@@ -1060,7 +1060,7 @@ const undoRedoStateAtom = atom({
1060
1060
  return {
1061
1061
  moveBlocks: (x, b, y) => {
1062
1062
  const C = map(x, (S) => {
1063
- const B = n.find((j) => j._id === S)._parent || null, w = n.filter((j) => B ? j._parent === B : !j._parent).map((j) => j._id).indexOf(S);
1063
+ const B = n.find((E) => E._id === S)._parent || null, w = n.filter((E) => B ? E._parent === B : !E._parent).map((E) => E._id).indexOf(S);
1064
1064
  return { _id: S, oldParent: B, oldPosition: w };
1065
1065
  }), k = C.find(({ _id: S }) => S === x[0]);
1066
1066
  k && k.oldParent === b && k.oldPosition === y || (l(x, b, y), o({
@@ -2609,8 +2609,8 @@ const getBlockWithChildren = (o, n) => {
2609
2609
  }
2610
2610
  if (f === "styles") {
2611
2611
  const _ = A.map((w) => {
2612
- for (const j in w)
2613
- j !== "_id" && (w[j] = `${STYLES_KEY},${w[j]}`);
2612
+ for (const E in w)
2613
+ E !== "_id" && (w[E] = `${STYLES_KEY},${w[E]}`);
2614
2614
  return w;
2615
2615
  });
2616
2616
  c(_);
@@ -3536,9 +3536,9 @@ function detectDropZone(o, n, r, a, i) {
3536
3536
  d = d.parentElement;
3537
3537
  const u = l === "canvas" ? l : d == null ? void 0 : d.getAttribute("data-block-id"), p = d ? getOrientation(d) : "vertical", g = getOrientation(o), m = isLeafBlock(c), f = !m && canAcceptChildBlock(c, a), h = ((S = i.defaultView) == null ? void 0 : S.scrollY) || 0, x = ((A = i.defaultView) == null ? void 0 : A.scrollX) || 0;
3538
3538
  if (l === "canvas" && hasChildBlocks(o)) {
3539
- const w = getChildBlocks(o), j = w[w.length - 1];
3540
- if (j) {
3541
- const v = j.getBoundingClientRect(), E = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, D = E.width - I - P, R = E.left + x + I;
3539
+ const w = getChildBlocks(o), E = w[w.length - 1];
3540
+ if (E) {
3541
+ const v = E.getBoundingClientRect(), j = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, D = j.width - I - P, R = j.left + x + I;
3542
3542
  return {
3543
3543
  position: "after",
3544
3544
  placeholderOrientation: "horizontal",
@@ -3548,8 +3548,8 @@ function detectDropZone(o, n, r, a, i) {
3548
3548
  width: D,
3549
3549
  height: 4
3550
3550
  },
3551
- targetElement: j,
3552
- targetBlockId: j.getAttribute("data-block-id"),
3551
+ targetElement: E,
3552
+ targetBlockId: E.getAttribute("data-block-id"),
3553
3553
  targetParentId: "canvas",
3554
3554
  isEmpty: !1,
3555
3555
  confidence: 1
@@ -3559,18 +3559,18 @@ function detectDropZone(o, n, r, a, i) {
3559
3559
  if (f && !m && hasChildBlocks(o)) {
3560
3560
  const w = detectGapZone(o, n, r, g);
3561
3561
  if (w) {
3562
- const j = w.before.getBoundingClientRect(), v = w.after.getBoundingClientRect(), E = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, D = getChildBlocks(o), R = getSiblingsInSameRow(D, w.before, g);
3562
+ const E = w.before.getBoundingClientRect(), v = w.after.getBoundingClientRect(), j = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, D = getChildBlocks(o), R = getSiblingsInSameRow(D, w.before, g);
3563
3563
  let $ = 0;
3564
3564
  if (R.forEach((F) => {
3565
3565
  const O = F.getBoundingClientRect();
3566
3566
  O.height > $ && ($ = O.height);
3567
3567
  }), g === "vertical") {
3568
- const F = E.width - I - P, O = E.left + x + I;
3568
+ const F = j.width - I - P, O = j.left + x + I;
3569
3569
  return {
3570
3570
  position: "after",
3571
3571
  placeholderOrientation: "horizontal",
3572
3572
  rect: {
3573
- top: j.bottom + h,
3573
+ top: E.bottom + h,
3574
3574
  left: O,
3575
3575
  width: F,
3576
3576
  height: 4
@@ -3583,13 +3583,13 @@ function detectDropZone(o, n, r, a, i) {
3583
3583
  // High confidence for gap zones
3584
3584
  };
3585
3585
  } else {
3586
- const F = j.top + h, O = $ > 0 ? $ : Math.max(j.height, v.height);
3586
+ const F = E.top + h, O = $ > 0 ? $ : Math.max(E.height, v.height);
3587
3587
  return {
3588
3588
  position: "after",
3589
3589
  placeholderOrientation: "vertical",
3590
3590
  rect: {
3591
3591
  top: F,
3592
- left: j.right + x,
3592
+ left: E.right + x,
3593
3593
  width: 4,
3594
3594
  height: O
3595
3595
  },
@@ -3605,13 +3605,13 @@ function detectDropZone(o, n, r, a, i) {
3605
3605
  if (d && u) {
3606
3606
  const w = detectParentEdgeProximity(d, n, r, p);
3607
3607
  if (w) {
3608
- const j = d.getBoundingClientRect(), v = window.getComputedStyle(d), E = parseFloat(v.paddingLeft) || 0, N = parseFloat(v.paddingRight) || 0, I = parseFloat(v.paddingTop) || 0, P = parseFloat(v.paddingBottom) || 0, D = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, R = ((_ = i.defaultView) == null ? void 0 : _.scrollX) || 0, $ = p === "vertical" ? "horizontal" : "vertical", F = getMaxSiblingDimensions(d);
3608
+ const E = d.getBoundingClientRect(), v = window.getComputedStyle(d), j = parseFloat(v.paddingLeft) || 0, N = parseFloat(v.paddingRight) || 0, I = parseFloat(v.paddingTop) || 0, P = parseFloat(v.paddingBottom) || 0, D = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, R = ((_ = i.defaultView) == null ? void 0 : _.scrollX) || 0, $ = p === "vertical" ? "horizontal" : "vertical", F = getMaxSiblingDimensions(d);
3609
3609
  if (w === "start") {
3610
3610
  const O = getChildBlocks(d)[0];
3611
3611
  if (O) {
3612
3612
  const L = O.getBoundingClientRect();
3613
3613
  if (p === "vertical") {
3614
- const T = j.width - E - N, M = j.left + R + E;
3614
+ const T = E.width - j - N, M = E.left + R + j;
3615
3615
  return {
3616
3616
  position: "before",
3617
3617
  placeholderOrientation: $,
@@ -3627,7 +3627,7 @@ function detectDropZone(o, n, r, a, i) {
3627
3627
  confidence: 0.9
3628
3628
  };
3629
3629
  } else {
3630
- const T = j.top + D + I, M = F.maxHeight > 0 ? F.maxHeight : j.height - I - P;
3630
+ const T = E.top + D + I, M = F.maxHeight > 0 ? F.maxHeight : E.height - I - P;
3631
3631
  return {
3632
3632
  position: "before",
3633
3633
  placeholderOrientation: $,
@@ -3649,7 +3649,7 @@ function detectDropZone(o, n, r, a, i) {
3649
3649
  if (L) {
3650
3650
  const T = L.getBoundingClientRect();
3651
3651
  if (p === "vertical") {
3652
- const M = j.width - E - N, H = j.left + R + E;
3652
+ const M = E.width - j - N, H = E.left + R + j;
3653
3653
  return {
3654
3654
  position: "after",
3655
3655
  placeholderOrientation: $,
@@ -3665,7 +3665,7 @@ function detectDropZone(o, n, r, a, i) {
3665
3665
  confidence: 0.9
3666
3666
  };
3667
3667
  } else {
3668
- const M = j.top + D + I, H = F.maxHeight > 0 ? F.maxHeight : j.height - I - P;
3668
+ const M = E.top + D + I, H = F.maxHeight > 0 ? F.maxHeight : E.height - I - P;
3669
3669
  return {
3670
3670
  position: "after",
3671
3671
  placeholderOrientation: $,
@@ -3760,11 +3760,11 @@ function getSiblingsInSameRow(o, n, r) {
3760
3760
  }
3761
3761
  function calculatePlaceholderRect(o, n, r, a, i) {
3762
3762
  var I, P;
3763
- const l = o.getBoundingClientRect(), c = window.getComputedStyle(o), d = ((I = i.defaultView) == null ? void 0 : I.scrollY) || 0, u = ((P = i.defaultView) == null ? void 0 : P.scrollX) || 0, p = parseFloat(c.marginTop) || 0, g = parseFloat(c.marginBottom) || 0, m = parseFloat(c.marginLeft) || 0, f = parseFloat(c.marginRight) || 0, h = parseFloat(c.paddingTop) || 0, x = parseFloat(c.paddingBottom) || 0, b = parseFloat(c.paddingLeft) || 0, y = parseFloat(c.paddingRight) || 0, C = n == null ? void 0 : n.getBoundingClientRect(), k = n && parseFloat(window.getComputedStyle(n).paddingLeft) || 0, S = n && parseFloat(window.getComputedStyle(n).paddingRight) || 0, A = n && parseFloat(window.getComputedStyle(n).paddingTop) || 0, B = n && parseFloat(window.getComputedStyle(n).paddingBottom) || 0, _ = n ? getMaxSiblingDimensions(n) : { maxWidth: 0, maxHeight: 0 }, w = n ? getOrientation(n) : "vertical", j = n ? getChildBlocks(n) : [], v = getSiblingsInSameRow(j, o, w);
3764
- let E = 0, N = 0;
3763
+ const l = o.getBoundingClientRect(), c = window.getComputedStyle(o), d = ((I = i.defaultView) == null ? void 0 : I.scrollY) || 0, u = ((P = i.defaultView) == null ? void 0 : P.scrollX) || 0, p = parseFloat(c.marginTop) || 0, g = parseFloat(c.marginBottom) || 0, m = parseFloat(c.marginLeft) || 0, f = parseFloat(c.marginRight) || 0, h = parseFloat(c.paddingTop) || 0, x = parseFloat(c.paddingBottom) || 0, b = parseFloat(c.paddingLeft) || 0, y = parseFloat(c.paddingRight) || 0, C = n == null ? void 0 : n.getBoundingClientRect(), k = n && parseFloat(window.getComputedStyle(n).paddingLeft) || 0, S = n && parseFloat(window.getComputedStyle(n).paddingRight) || 0, A = n && parseFloat(window.getComputedStyle(n).paddingTop) || 0, B = n && parseFloat(window.getComputedStyle(n).paddingBottom) || 0, _ = n ? getMaxSiblingDimensions(n) : { maxWidth: 0, maxHeight: 0 }, w = n ? getOrientation(n) : "vertical", E = n ? getChildBlocks(n) : [], v = getSiblingsInSameRow(E, o, w);
3764
+ let j = 0, N = 0;
3765
3765
  if (v.forEach((D) => {
3766
3766
  const R = D.getBoundingClientRect();
3767
- R.height > E && (E = R.height), R.width > N && (N = R.width);
3767
+ R.height > j && (j = R.height), R.width > N && (N = R.width);
3768
3768
  }), r === "before")
3769
3769
  if (a === "horizontal") {
3770
3770
  const D = C ? C.width - k - S : l.width, R = C ? C.left + u + k : l.left + u;
@@ -3775,7 +3775,7 @@ function calculatePlaceholderRect(o, n, r, a, i) {
3775
3775
  height: 4
3776
3776
  };
3777
3777
  } else {
3778
- const D = l.top + d, R = w === "horizontal" && E > 0 ? E : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
3778
+ const D = l.top + d, R = w === "horizontal" && j > 0 ? j : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
3779
3779
  return {
3780
3780
  top: D,
3781
3781
  left: l.left + u - m - 2,
@@ -3793,7 +3793,7 @@ function calculatePlaceholderRect(o, n, r, a, i) {
3793
3793
  height: 4
3794
3794
  };
3795
3795
  } else {
3796
- const D = l.top + d, R = w === "horizontal" && E > 0 ? E : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
3796
+ const D = l.top + d, R = w === "horizontal" && j > 0 ? j : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
3797
3797
  return {
3798
3798
  top: D,
3799
3799
  left: l.right + u + f - 2,
@@ -3896,11 +3896,11 @@ const useBlockDrop = () => {
3896
3896
  if (_)
3897
3897
  d([o._id], S === null ? void 0 : S, A), g(), p([]), u([o._id]);
3898
3898
  else {
3899
- const w = o._type || o.type, j = o != null && o.blocks ? isFunction(o == null ? void 0 : o.blocks) ? syncBlocksWithDefaults(o == null ? void 0 : o.blocks()) : o == null ? void 0 : o.blocks : null;
3899
+ const w = o._type || o.type, E = o != null && o.blocks ? isFunction(o == null ? void 0 : o.blocks) ? syncBlocksWithDefaults(o == null ? void 0 : o.blocks()) : o == null ? void 0 : o.blocks : null;
3900
3900
  c(
3901
3901
  w === "PartialBlock" ? {
3902
3902
  blocks: [{ _type: w, _id: "partial-block", partialBlockId: o.partialBlockId }]
3903
- } : (j == null ? void 0 : j.length) > 0 ? { blocks: [...j] } : { type: w },
3903
+ } : (E == null ? void 0 : E.length) > 0 ? { blocks: [...E] } : { type: w },
3904
3904
  S,
3905
3905
  A
3906
3906
  );
@@ -4018,10 +4018,10 @@ const LEAF_BLOCK_TYPES = [
4018
4018
  d.current = null;
4019
4019
  return;
4020
4020
  }
4021
- const j = S === "up" ? -_ : _;
4022
- f.scrollBy(0, j);
4023
- const v = f.scrollY, E = v > 0, N = v + h < b, I = u.current, P = h - u.current;
4024
- S === "up" && E && I < AUTO_SCROLL_CONFIG.EDGE_ZONE || S === "down" && N && P < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(w) : d.current = null;
4021
+ const E = S === "up" ? -_ : _;
4022
+ f.scrollBy(0, E);
4023
+ const v = f.scrollY, j = v > 0, N = v + h < b, I = u.current, P = h - u.current;
4024
+ S === "up" && j && I < AUTO_SCROLL_CONFIG.EDGE_ZONE || S === "down" && N && P < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(w) : d.current = null;
4025
4025
  };
4026
4026
  d.current === null && (d.current = requestAnimationFrame(w));
4027
4027
  }
@@ -4076,17 +4076,17 @@ const LEAF_BLOCK_TYPES = [
4076
4076
  return;
4077
4077
  _ = canAcceptChildBlock(B, C);
4078
4078
  } else {
4079
- let v = h.parentElement, E = "Box";
4079
+ let v = h.parentElement, j = "Box";
4080
4080
  for (; v && !v.hasAttribute("data-block-id"); )
4081
4081
  v = v.parentElement;
4082
- if (v && (E = v.getAttribute("data-block-type") || "Box"), y && !canDropAsSiblingWithoutCircularReference(y, x, l))
4082
+ if (v && (j = v.getAttribute("data-block-type") || "Box"), y && !canDropAsSiblingWithoutCircularReference(y, x, l))
4083
4083
  return;
4084
- _ = canAcceptChildBlock(E, C);
4084
+ _ = canAcceptChildBlock(j, C);
4085
4085
  }
4086
4086
  if (!_)
4087
4087
  return;
4088
4088
  i(A.targetParentId);
4089
- const j = A.targetParentId || b;
4089
+ const E = A.targetParentId || b;
4090
4090
  r({
4091
4091
  isVisible: !0,
4092
4092
  isValid: !0,
@@ -4098,7 +4098,7 @@ const LEAF_BLOCK_TYPES = [
4098
4098
  width: A.rect.width,
4099
4099
  height: A.rect.height,
4100
4100
  targetBlockId: A.targetBlockId,
4101
- targetParentId: j
4101
+ targetParentId: E
4102
4102
  }), removeDropTargetAttributes(c), A.targetElement.setAttribute("data-drop-target", "true");
4103
4103
  }, 300),
4104
4104
  [c, o, r, a, i, l, p]
@@ -5561,14 +5561,14 @@ const RichTextEditor = memo(
5561
5561
  const r = "content", { document: a } = useFrame(), { editingBlockId: i, editingItemIndex: l, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [u, p] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), f = useUpdateBlocksProps(), { selectedLang: h } = useLanguages(), [, x] = useSelectedBlockIds(), b = useRef(null), y = i, { blockContent: C, blockType: k } = useMemo(() => {
5562
5562
  var N;
5563
5563
  const w = o._type;
5564
- let j = o[r];
5564
+ let E = o[r];
5565
5565
  const v = getRegisteredChaiBlock(o._type);
5566
- return h && ((N = v == null ? void 0 : v.i18nProps) == null ? void 0 : N.includes(r)) && has(o, `${r}-${h}`) && (j = get(o, `${r}-${h}`)), { blockContent: j, blockType: w };
5566
+ return h && ((N = v == null ? void 0 : v.i18nProps) == null ? void 0 : N.includes(r)) && has(o, `${r}-${h}`) && (E = get(o, `${r}-${h}`)), { blockContent: E, blockType: w };
5567
5567
  }, [o, h]), S = useCallback(
5568
5568
  (w) => {
5569
5569
  var v;
5570
- const j = w || ((v = g.current) == null ? void 0 : v.innerText);
5571
- f([y], { [r]: j }), p(null), c(null), d(-1), x([]), y && setTimeout(() => x([y]), 100);
5570
+ const E = w || ((v = g.current) == null ? void 0 : v.innerText);
5571
+ f([y], { [r]: E }), p(null), c(null), d(-1), x([]), y && setTimeout(() => x([y]), 100);
5572
5572
  },
5573
5573
  [y, f, c, x, h]
5574
5574
  ), A = useDebouncedCallback(
@@ -5580,17 +5580,17 @@ const RichTextEditor = memo(
5580
5580
  ), B = useCallback(
5581
5581
  (w) => {
5582
5582
  w.preventDefault(), y && (b.current = y), S(), setTimeout(() => {
5583
- const j = b.current;
5584
- b.current = null, x([j]);
5583
+ const E = b.current;
5584
+ b.current = null, x([E]);
5585
5585
  }, 100);
5586
5586
  },
5587
5587
  [x, y, h]
5588
5588
  );
5589
5589
  useEffect(() => {
5590
- var E;
5590
+ var j;
5591
5591
  if (!y) return;
5592
- const w = `[data-block-id="${y}"]`, j = l >= 0 ? `[data-block-index="${l}"]` : "", v = a.querySelector(`${w}${j}`);
5593
- v && ((E = v == null ? void 0 : v.classList) == null || E.add("sr-only"), p(v));
5592
+ const w = `[data-block-id="${y}"]`, E = l >= 0 ? `[data-block-index="${l}"]` : "", v = a.querySelector(`${w}${E}`);
5593
+ v && ((j = v == null ? void 0 : v.classList) == null || j.add("sr-only"), p(v));
5594
5594
  }, [y, k, a, l]);
5595
5595
  const _ = useMemo(() => u ? (m(), ["RichText", "Paragraph"].includes(k) ? /* @__PURE__ */ jsx(
5596
5596
  RichTextEditor,
@@ -5671,7 +5671,7 @@ const RichTextEditor = memo(
5671
5671
  onDragStart: S.onDragStart,
5672
5672
  onDragEnd: S.onDragEnd
5673
5673
  } : P;
5674
- }, [l._id, l._type, h, k, C, S, a]), j = useMemo(
5674
+ }, [l._id, l._type, h, k, C, S, a]), E = useMemo(
5675
5675
  () => ({
5676
5676
  blockProps: w,
5677
5677
  inBuilder: b === "edit",
@@ -5682,10 +5682,10 @@ const RichTextEditor = memo(
5682
5682
  ...o
5683
5683
  }),
5684
5684
  [b, w, d, u, A, B, _, o]
5685
- ), v = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]), E = useMemo(() => get(l, "_show", !0), [l]);
5686
- if (isNull(f) || !E) return null;
5685
+ ), v = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]), j = useMemo(() => get(l, "_show", !0), [l]);
5686
+ if (isNull(f) || !j) return null;
5687
5687
  let N = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
5688
- ...j,
5688
+ ...E,
5689
5689
  children: r({
5690
5690
  _id: l._id,
5691
5691
  _type: l._type,
@@ -5868,7 +5868,7 @@ const RichTextEditor = memo(
5868
5868
  /* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
5869
5869
  /* @__PURE__ */ jsx("p", { children: o("Please try again.") })
5870
5870
  ] }) });
5871
- }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-CelZf2Qf.js")), CanvasArea = () => {
5871
+ }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-Dnh6rQUv.js")), CanvasArea = () => {
5872
5872
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
5873
5873
  return /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40", children: [
5874
5874
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
@@ -6213,11 +6213,11 @@ const DataBindingSelector = ({
6213
6213
  if (S !== A)
6214
6214
  C.chain().deleteSelection().insertContent(k).run();
6215
6215
  else {
6216
- const { state: _ } = C, w = _.selection.from, j = _.doc.textBetween(Math.max(0, w - 1), w), v = _.doc.textBetween(w, Math.min(w + 1, _.doc.content.size));
6217
- let E = "";
6218
- w > 0 && j !== " " && !h(j) && (E = " ");
6216
+ const { state: _ } = C, w = _.selection.from, E = _.doc.textBetween(Math.max(0, w - 1), w), v = _.doc.textBetween(w, Math.min(w + 1, _.doc.content.size));
6217
+ let j = "";
6218
+ w > 0 && E !== " " && !h(E) && (j = " ");
6219
6219
  let N = "";
6220
- v && v !== " " && !h(v) && (N = " "), C.chain().insertContent(E + k + N).run();
6220
+ v && v !== " " && !h(v) && (N = " "), C.chain().insertContent(j + k + N).run();
6221
6221
  }
6222
6222
  setTimeout(() => n(C.getHTML(), {}, r), 100);
6223
6223
  return;
@@ -6225,12 +6225,12 @@ const DataBindingSelector = ({
6225
6225
  } else {
6226
6226
  const C = b, k = C.selectionStart || 0, S = C.value || "", A = C.selectionEnd || k;
6227
6227
  if (A > k) {
6228
- const v = `{{${m}}}`, { text: E } = x(S, k, v), N = S.slice(0, k) + E + S.slice(A);
6228
+ const v = `{{${m}}}`, { text: j } = x(S, k, v), N = S.slice(0, k) + j + S.slice(A);
6229
6229
  n(N, {}, r);
6230
6230
  return;
6231
6231
  }
6232
- const _ = `{{${m}}}`, { text: w } = x(S, k, _), j = S.slice(0, k) + w + S.slice(k);
6233
- n(j, {}, r);
6232
+ const _ = `{{${m}}}`, { text: w } = x(S, k, _), E = S.slice(0, k) + w + S.slice(k);
6233
+ n(E, {}, r);
6234
6234
  }
6235
6235
  },
6236
6236
  [r, n, a, d == null ? void 0 : d._id, u]
@@ -6251,13 +6251,13 @@ const DataBindingSelector = ({
6251
6251
  pageTypes: n,
6252
6252
  onChange: r
6253
6253
  }) => {
6254
- var j;
6255
- const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (v, E) => []), [l, c] = useState(!1), [d, u] = useState(!1), [p, g] = useState("page"), [m, f] = useState(""), [h, x] = useState([]), [b, y] = useState(-1), C = useRef(null), k = (j = n == null ? void 0 : n.find((v) => v.key === p)) == null ? void 0 : j.name;
6254
+ var E;
6255
+ const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (v, j) => []), [l, c] = useState(!1), [d, u] = useState(!1), [p, g] = useState("page"), [m, f] = useState(""), [h, x] = useState([]), [b, y] = useState(-1), C = useRef(null), k = (E = n == null ? void 0 : n.find((v) => v.key === p)) == null ? void 0 : E.name;
6256
6256
  useEffect(() => {
6257
6257
  if (f(""), x([]), y(-1), u(!1), !o || l || !startsWith(o, "pageType:")) return;
6258
- const v = split(o, ":"), E = get(v, 1, "page") || "page";
6259
- g(E), (async () => {
6260
- const N = await i(E, [get(v, 2, "page")]);
6258
+ const v = split(o, ":"), j = get(v, 1, "page") || "page";
6259
+ g(j), (async () => {
6260
+ const N = await i(j, [get(v, 2, "page")]);
6261
6261
  N && Array.isArray(N) && f(get(N, [0, "name"], ""));
6262
6262
  })();
6263
6263
  }, [o]);
@@ -6266,23 +6266,23 @@ const DataBindingSelector = ({
6266
6266
  if (isEmpty(v))
6267
6267
  x([]);
6268
6268
  else {
6269
- const E = await i(p, v);
6270
- x(E);
6269
+ const j = await i(p, v);
6270
+ x(j);
6271
6271
  }
6272
6272
  c(!1), y(-1);
6273
6273
  },
6274
6274
  [p],
6275
6275
  300
6276
6276
  ), A = (v) => {
6277
- const E = ["pageType", p, v.id];
6278
- E[1] && (r(E.join(":")), f(v.name), u(!1), x([]), y(-1));
6277
+ const j = ["pageType", p, v.id];
6278
+ j[1] && (r(j.join(":")), f(v.name), u(!1), x([]), y(-1));
6279
6279
  }, B = (v) => {
6280
6280
  switch (v.key) {
6281
6281
  case "ArrowDown":
6282
- v.preventDefault(), y((E) => E < h.length - 1 ? E + 1 : E);
6282
+ v.preventDefault(), y((j) => j < h.length - 1 ? j + 1 : j);
6283
6283
  break;
6284
6284
  case "ArrowUp":
6285
- v.preventDefault(), y((E) => E > 0 ? E - 1 : E);
6285
+ v.preventDefault(), y((j) => j > 0 ? j - 1 : j);
6286
6286
  break;
6287
6287
  case "Enter":
6288
6288
  if (v.preventDefault(), h.length === 0) return;
@@ -6328,11 +6328,11 @@ const DataBindingSelector = ({
6328
6328
  ' "',
6329
6329
  m,
6330
6330
  '"'
6331
- ] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(h == null ? void 0 : h.slice(0, 20), (v, E) => /* @__PURE__ */ jsxs(
6331
+ ] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(h == null ? void 0 : h.slice(0, 20), (v, j) => /* @__PURE__ */ jsxs(
6332
6332
  "li",
6333
6333
  {
6334
6334
  onClick: () => A(v),
6335
- className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : E === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
6335
+ className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : j === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
6336
6336
  children: [
6337
6337
  v.name,
6338
6338
  " ",
@@ -6437,7 +6437,7 @@ const DataBindingSelector = ({
6437
6437
  ]
6438
6438
  }
6439
6439
  ) });
6440
- }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-MLnVHEnQ.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: i, onBlur: l }) => {
6440
+ }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-BGHSjMUE.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: i, onBlur: l }) => {
6441
6441
  const c = useRef(null), [d, u] = useState(!1), p = useRTEditor({
6442
6442
  blockId: o,
6443
6443
  value: a,
@@ -6693,7 +6693,7 @@ const DataBindingSelector = ({
6693
6693
  if (d)
6694
6694
  return null;
6695
6695
  if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: r, children: i });
6696
- const j = A == null ? void 0 : A.includes(n.replace("root.", ""));
6696
+ const E = A == null ? void 0 : A.includes(n.replace("root.", ""));
6697
6697
  if (p.type === "array") {
6698
6698
  const N = B === n;
6699
6699
  return /* @__PURE__ */ jsxs("div", { className: `${r} relative`, children: [
@@ -6730,14 +6730,14 @@ const DataBindingSelector = ({
6730
6730
  ] })
6731
6731
  ] });
6732
6732
  }
6733
- const v = n.replace("root.", ""), E = A.includes(v) && !isEmpty(f) && isEmpty(g);
6733
+ const v = n.replace("root.", ""), j = A.includes(v) && !isEmpty(f) && isEmpty(g);
6734
6734
  return /* @__PURE__ */ jsxs("div", { className: r, children: [
6735
6735
  p.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
6736
6736
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
6737
6737
  /* @__PURE__ */ jsxs("label", { htmlFor: n, className: p.type === "object" ? "pb-2" : "", children: [
6738
6738
  a,
6739
6739
  " ",
6740
- j && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
6740
+ E && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
6741
6741
  " ",
6742
6742
  y
6743
6743
  ] }),
@@ -6749,7 +6749,7 @@ const DataBindingSelector = ({
6749
6749
  ] }) })
6750
6750
  ] }),
6751
6751
  !p.enum && !p.oneOf && C && /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-1", children: [
6752
- E ? /* @__PURE__ */ jsxs(Tooltip, { children: [
6752
+ j ? /* @__PURE__ */ jsxs(Tooltip, { children: [
6753
6753
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
6754
6754
  "svg",
6755
6755
  {
@@ -6906,8 +6906,8 @@ function BlockSettings() {
6906
6906
  try {
6907
6907
  const { schema: _, uiSchema: w } = getBlockFormSchemas(B);
6908
6908
  if (B === "Repeater") {
6909
- const j = get(n, "repeaterItems", "");
6910
- startsWith(j, `{{${COLLECTION_PREFIX}`) ? (set(w, "filter", { "ui:widget": "collectionSelect" }), set(w, "sort", { "ui:widget": "collectionSelect" })) : (set(w, "filter", { "ui:widget": "hidden" }), set(w, "sort", { "ui:widget": "hidden" }));
6909
+ const E = get(n, "repeaterItems", "");
6910
+ startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(w, "filter", { "ui:widget": "collectionSelect" }), set(w, "sort", { "ui:widget": "collectionSelect" })) : (set(w, "filter", { "ui:widget": "hidden" }), set(w, "sort", { "ui:widget": "hidden" }));
6911
6911
  }
6912
6912
  return { schema: _, uiSchema: w };
6913
6913
  } catch {
@@ -7170,35 +7170,35 @@ const BlockStylingProps = () => {
7170
7170
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
7171
7171
  const [n, r] = useState(!1), [a, i] = useState(""), { currentClass: l, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [m, f] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [h, x] = useState(!1), [b, y] = useState(""), [C, k] = useState(!1), [S, A] = useState(!1);
7172
7172
  useEffect(() => {
7173
- const { value: v, unit: E } = getClassValueAndUnit(l);
7174
- if (E === "") {
7173
+ const { value: v, unit: j } = getClassValueAndUnit(l);
7174
+ if (j === "") {
7175
7175
  i(v), f(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
7176
7176
  return;
7177
7177
  }
7178
- f(E), i(E === "class" || isEmpty(v) ? "" : v);
7178
+ f(j), i(j === "class" || isEmpty(v) ? "" : v);
7179
7179
  }, [l, u, p]);
7180
7180
  const B = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), _ = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), w = useCallback(
7181
7181
  (v = !1) => {
7182
- const E = getUserInputValues(`${a}`, p);
7183
- if (get(E, "error", !1)) {
7182
+ const j = getUserInputValues(`${a}`, p);
7183
+ if (get(j, "error", !1)) {
7184
7184
  x(!0);
7185
7185
  return;
7186
7186
  }
7187
- const N = get(E, "unit") !== "" ? get(E, "unit") : m;
7187
+ const N = get(j, "unit") !== "" ? get(j, "unit") : m;
7188
7188
  if (N === "auto" || N === "none") {
7189
7189
  B(`${d}${N}`);
7190
7190
  return;
7191
7191
  }
7192
- if (get(E, "value") === "")
7192
+ if (get(j, "value") === "")
7193
7193
  return;
7194
- const P = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7194
+ const P = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7195
7195
  v ? _(P) : B(P);
7196
7196
  },
7197
7197
  [B, _, a, m, d, p]
7198
- ), j = useCallback(
7198
+ ), E = useCallback(
7199
7199
  (v) => {
7200
- const E = getUserInputValues(`${a}`, p);
7201
- if (get(E, "error", !1)) {
7200
+ const j = getUserInputValues(`${a}`, p);
7201
+ if (get(j, "error", !1)) {
7202
7202
  x(!0);
7203
7203
  return;
7204
7204
  }
@@ -7206,9 +7206,9 @@ const BlockStylingProps = () => {
7206
7206
  B(`${d}${v}`);
7207
7207
  return;
7208
7208
  }
7209
- if (get(E, "value") === "")
7209
+ if (get(j, "value") === "")
7210
7210
  return;
7211
- const N = get(E, "unit") !== "" ? get(E, "unit") : v, P = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7211
+ const N = get(j, "unit") !== "" ? get(j, "unit") : v, P = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7212
7212
  B(P);
7213
7213
  },
7214
7214
  [B, a, d, p]
@@ -7239,8 +7239,8 @@ const BlockStylingProps = () => {
7239
7239
  if (v.keyCode !== 38 && v.keyCode !== 40)
7240
7240
  return;
7241
7241
  v.preventDefault(), A(!0);
7242
- const E = parseInt$1(v.target.value);
7243
- let N = isNaN$1(E) ? 0 : E;
7242
+ const j = parseInt$1(v.target.value);
7243
+ let N = isNaN$1(j) ? 0 : j;
7244
7244
  v.keyCode === 38 && (N += 1), v.keyCode === 40 && (N -= 1);
7245
7245
  const I = `${N}`, D = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
7246
7246
  _(D);
@@ -7253,8 +7253,8 @@ const BlockStylingProps = () => {
7253
7253
  x(!1), i(v.target.value);
7254
7254
  },
7255
7255
  onClick: (v) => {
7256
- var E;
7257
- (E = v == null ? void 0 : v.target) == null || E.select(), r(!1);
7256
+ var j;
7257
+ (j = v == null ? void 0 : v.target) == null || j.select(), r(!1);
7258
7258
  },
7259
7259
  value: C ? b : a,
7260
7260
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
@@ -7282,7 +7282,7 @@ const BlockStylingProps = () => {
7282
7282
  units: p,
7283
7283
  current: m,
7284
7284
  onSelect: (v) => {
7285
- r(!1), f(v), j(v);
7285
+ r(!1), f(v), E(v);
7286
7286
  }
7287
7287
  }
7288
7288
  ) })
@@ -7295,14 +7295,14 @@ const BlockStylingProps = () => {
7295
7295
  onDragEnd: (v) => {
7296
7296
  if (y(() => ""), k(!1), isEmpty(v))
7297
7297
  return;
7298
- const E = `${v}`, I = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${m === "-" ? "" : m}]`;
7298
+ const j = `${v}`, I = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${m === "-" ? "" : m}]`;
7299
7299
  B(I);
7300
7300
  },
7301
7301
  onDrag: (v) => {
7302
7302
  if (isEmpty(v))
7303
7303
  return;
7304
7304
  y(v);
7305
- const E = `${v}`, I = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${m === "-" ? "" : m}]`;
7305
+ const j = `${v}`, I = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${m === "-" ? "" : m}]`;
7306
7306
  _(I);
7307
7307
  },
7308
7308
  currentValue: a,
@@ -7768,9 +7768,9 @@ const COLOR_PROP = {
7768
7768
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: i, onEmitChange: l = () => {
7769
7769
  }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(i), f = useAddClassesToBlocks(), h = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), b = useMemo(() => get(m, "fullCls", ""), [m]), y = useCallback(
7770
7770
  (_, w = !0) => {
7771
- const j = { dark: u, mq: g, mod: p, cls: _, property: i, fullCls: "" };
7772
- (u || p !== "") && (j.mq = "xs");
7773
- const v = generateFullClsName(j);
7771
+ const E = { dark: u, mq: g, mod: p, cls: _, property: i, fullCls: "" };
7772
+ (u || p !== "") && (E.mq = "xs");
7773
+ const v = generateFullClsName(E);
7774
7774
  f(x, [v], w);
7775
7775
  },
7776
7776
  [x, u, g, p, i, f]
@@ -8125,10 +8125,10 @@ function ManualClasses() {
8125
8125
  }, w = () => {
8126
8126
  const L = h.trim().replace(/ +(?= )/g, "").split(" ").map(_);
8127
8127
  g(f, L, !0), x("");
8128
- }, [j, v] = useState([]), E = useBuilderProp("flags.designTokens", !1), N = ({ value: L }) => {
8128
+ }, [E, v] = useState([]), j = useBuilderProp("flags.designTokens", !1), N = ({ value: L }) => {
8129
8129
  const T = L.trim().toLowerCase(), M = T.match(/.+:/g);
8130
8130
  let H = [], W = [];
8131
- if (E && (T === "" ? W = Object.entries(b).map(([V, U]) => ({
8131
+ if (j && (T === "" ? W = Object.entries(b).map(([V, U]) => ({
8132
8132
  name: U.name,
8133
8133
  id: `${V}`,
8134
8134
  isDesignToken: !0
@@ -8166,12 +8166,21 @@ function ManualClasses() {
8166
8166
  }, 0);
8167
8167
  },
8168
8168
  onKeyDown: (L) => {
8169
- L.key === "Enter" && h.trim() !== "" && j.length === 0 && w();
8169
+ if (L.key === "Enter" && h.trim() !== "" && (L.preventDefault(), w()), L.key === "Tab" && E.length > 0) {
8170
+ L.preventDefault();
8171
+ const T = new KeyboardEvent("keydown", {
8172
+ key: "ArrowDown",
8173
+ code: "ArrowDown",
8174
+ keyCode: 40,
8175
+ bubbles: !0
8176
+ });
8177
+ L.target.dispatchEvent(T);
8178
+ }
8170
8179
  },
8171
8180
  onChange: (L, { newValue: T }) => x(T),
8172
8181
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
8173
8182
  }),
8174
- [h, d, o, j.length]
8183
+ [h, d, o, E.length]
8175
8184
  ), $ = (L) => {
8176
8185
  const T = n.trim().replace(/ +(?= )/g, "").split(" ").map(_);
8177
8186
  m(f, [L]), g(f, T, !0), r(""), i(-1);
@@ -8185,25 +8194,24 @@ function ManualClasses() {
8185
8194
  return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
8186
8195
  /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-x-2", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-x-2 text-muted-foreground", children: [
8187
8196
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-1", children: [
8188
- /* @__PURE__ */ jsx("span", { children: d(E ? "Styles" : "Classes") }),
8197
+ /* @__PURE__ */ jsx("span", { children: d(j ? "Styles" : "Classes") }),
8189
8198
  A && /* @__PURE__ */ jsxs(Tooltip, { children: [
8190
8199
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: F, className: "cursor-pointer" }) }),
8191
8200
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: d("Copy classes to clipboard") }) })
8192
8201
  ] })
8193
8202
  ] }),
8194
- E && /* @__PURE__ */ jsx(Button, { variant: "link", className: "underline", onClick: () => l("design-tokens"), children: d("Design Tokens") })
8203
+ j && /* @__PURE__ */ jsx(Button, { variant: "link", className: "underline", onClick: () => l("design-tokens"), children: d("Design Tokens") })
8195
8204
  ] }) }),
8196
8205
  /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-x-3", children: [
8197
8206
  /* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
8198
8207
  Autosuggest,
8199
8208
  {
8200
- suggestions: j,
8209
+ suggestions: E,
8201
8210
  onSuggestionsFetchRequested: N,
8202
8211
  onSuggestionsClearRequested: I,
8203
8212
  getSuggestionValue: P,
8204
8213
  renderSuggestion: D,
8205
8214
  inputProps: R,
8206
- highlightFirstSuggestion: !0,
8207
8215
  onSuggestionSelected: (L, { suggestionValue: T }) => {
8208
8216
  const M = _(T);
8209
8217
  g(f, [M], !0), x("");
@@ -8773,7 +8781,7 @@ const BlockCard = ({
8773
8781
  A.current && (clearTimeout(A.current), A.current = null), A.current = setTimeout(() => {
8774
8782
  A.current && k(N);
8775
8783
  }, 400);
8776
- }, j = () => {
8784
+ }, E = () => {
8777
8785
  c != null && c.id && p(c.id);
8778
8786
  };
8779
8787
  if (u)
@@ -8781,7 +8789,7 @@ const BlockCard = ({
8781
8789
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
8782
8790
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
8783
8791
  ] });
8784
- const v = filter(S, (N, I) => I % 2 === 0), E = filter(S, (N, I) => I % 2 === 1);
8792
+ const v = filter(S, (N, I) => I % 2 === 0), j = filter(S, (N, I) => I % 2 === 1);
8785
8793
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
8786
8794
  /* @__PURE__ */ jsx(SearchInput, { value: g, setValue: m }),
8787
8795
  /* @__PURE__ */ jsx("div", { className: "relative flex h-full max-h-full flex-1 overflow-hidden bg-background", children: /* @__PURE__ */ jsxs("div", { className: `flex h-full flex-1 pt-2 ${r ? "flex-col" : ""}`, children: [
@@ -8800,7 +8808,7 @@ const BlockCard = ({
8800
8808
  className: `no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto ${r ? "" : "pb-20"}`,
8801
8809
  children: isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: g ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: B("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment, { children: [
8802
8810
  /* @__PURE__ */ jsx("p", { className: "text-sm", children: B("Failed to load the UI library. Try again") }),
8803
- /* @__PURE__ */ jsxs(Button, { onClick: j, variant: "outline", size: "sm", className: "gap-2", children: [
8811
+ /* @__PURE__ */ jsxs(Button, { onClick: E, variant: "outline", size: "sm", className: "gap-2", children: [
8804
8812
  /* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
8805
8813
  B("Retry")
8806
8814
  ] })
@@ -8849,7 +8857,7 @@ const BlockCard = ({
8849
8857
  },
8850
8858
  `block-${I}`
8851
8859
  )) }),
8852
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: E.map((N, I) => /* @__PURE__ */ jsx(
8860
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: j.map((N, I) => /* @__PURE__ */ jsx(
8853
8861
  BlockCard,
8854
8862
  {
8855
8863
  parentId: o,
@@ -9003,14 +9011,14 @@ const BlockCard = ({
9003
9011
  (I) => reject(filter(values(_), { group: I }), { hidden: !0 }).length > 0
9004
9012
  ) : o.filter((I) => reject(filter(values(n), { group: I }), { hidden: !0 }).length > 0),
9005
9013
  [n, _, o, u]
9006
- ), j = useMemo(
9014
+ ), E = useMemo(
9007
9015
  () => sortBy(w, (I) => CORE_GROUPS.indexOf(I) === -1 ? 99 : CORE_GROUPS.indexOf(I)),
9008
9016
  [w]
9009
- ), v = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), E = useMemo(() => h === "all" ? j : [h], [j, h]);
9017
+ ), v = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), j = useMemo(() => h === "all" ? E : [h], [E, h]);
9010
9018
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full flex-col", children: [
9011
9019
  /* @__PURE__ */ jsx(SearchInput, { value: u, setValue: p }),
9012
9020
  /* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden pt-2", children: [
9013
- !l && j.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
9021
+ !l && E.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
9014
9022
  /* @__PURE__ */ jsx(
9015
9023
  "button",
9016
9024
  {
@@ -9022,7 +9030,7 @@ const BlockCard = ({
9022
9030
  },
9023
9031
  "sidebar-all"
9024
9032
  ),
9025
- j.map((I) => /* @__PURE__ */ jsx(
9033
+ E.map((I) => /* @__PURE__ */ jsx(
9026
9034
  "button",
9027
9035
  {
9028
9036
  onClick: () => B(I),
@@ -9037,13 +9045,13 @@ const BlockCard = ({
9037
9045
  /* @__PURE__ */ jsx(
9038
9046
  "div",
9039
9047
  {
9040
- className: `h-full flex-1 overflow-hidden ${!l && j.length > 0 ? "w-3/4" : "w-full"}`,
9048
+ className: `h-full flex-1 overflow-hidden ${!l && E.length > 0 ? "w-3/4" : "w-full"}`,
9041
9049
  children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar h-full", children: w.length === 0 && u ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
9042
9050
  c("No blocks found matching"),
9043
9051
  ' "',
9044
9052
  u,
9045
9053
  '"'
9046
- ] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children: E.map((I, P) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
9054
+ ] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children: j.map((I, P) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
9047
9055
  /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(c(I.toLowerCase())) }),
9048
9056
  /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + i, children: reject(
9049
9057
  h === "all" ? filter(values(v), { group: I }) : values(v),
@@ -9537,13 +9545,13 @@ const useStructureValidation = () => {
9537
9545
  T.stopPropagation(), B && o.toggle();
9538
9546
  }, w = (T) => {
9539
9547
  T.isInternal && (d = T.isOpen, T.isOpen && T.close());
9540
- }, j = (T) => {
9548
+ }, E = (T) => {
9541
9549
  T.isInternal && d !== null && (d ? T.open() : T.close(), d = null);
9542
- }, [v, E] = useAtom$1(currentAddSelection), N = () => {
9550
+ }, [v, j] = useAtom$1(currentAddSelection), N = () => {
9543
9551
  var T;
9544
- I(), o.parent.isSelected || E((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
9552
+ I(), o.parent.isSelected || j((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
9545
9553
  }, I = () => {
9546
- E(null);
9554
+ j(null);
9547
9555
  }, P = (T) => {
9548
9556
  I(), T.stopPropagation(), !o.isOpen && B && o.toggle(), k(T);
9549
9557
  };
@@ -9592,7 +9600,7 @@ const useStructureValidation = () => {
9592
9600
  "data-node-id": f,
9593
9601
  ref: r,
9594
9602
  onDragStart: () => w(o),
9595
- onDragEnd: () => j(o),
9603
+ onDragEnd: () => E(o),
9596
9604
  onDragOver: (T) => {
9597
9605
  T.preventDefault(), D(f, "yes");
9598
9606
  },
@@ -10133,13 +10141,13 @@ const useStructureValidation = () => {
10133
10141
  }
10134
10142
  }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
10135
10143
  const [n, r] = useDarkMode(), [a, i] = React.useState(""), [l, c] = React.useState(!1), d = useBuilderProp("themePresets", []), u = useBuilderProp("themePanelComponent", null), { hasPermission: p } = usePermissions(), g = useBuilderProp("flags.importTheme", !0), m = useBuilderProp("flags.darkMode", !0), f = useIncrementActionsCount();
10136
- (!d || d.length === 0) && DEFAULT_THEME_PRESET.map((j) => {
10137
- d.push(j);
10144
+ (!d || d.length === 0) && DEFAULT_THEME_PRESET.map((E) => {
10145
+ d.push(E);
10138
10146
  });
10139
10147
  const [h, x] = useTheme(), b = useThemeOptions(), { t: y } = useTranslation(), C = React.useCallback(
10140
- (j) => {
10148
+ (E) => {
10141
10149
  const v = { ...h };
10142
- setPreviousTheme(v), x(j), f(), toast.success("Theme updated", {
10150
+ setPreviousTheme(v), x(E), f(), toast.success("Theme updated", {
10143
10151
  action: {
10144
10152
  label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
10145
10153
  /* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
@@ -10155,56 +10163,56 @@ const useStructureValidation = () => {
10155
10163
  },
10156
10164
  [h, x, f]
10157
10165
  ), k = () => {
10158
- const j = d.find((v) => Object.keys(v)[0] === a);
10159
- if (j) {
10160
- const v = Object.values(j)[0];
10166
+ const E = d.find((v) => Object.keys(v)[0] === a);
10167
+ if (E) {
10168
+ const v = Object.values(E)[0];
10161
10169
  v && typeof v == "object" && "fontFamily" in v && "borderRadius" in v && "colors" in v ? (C(v), i(""), f()) : console.error("Invalid preset structure:", v);
10162
10170
  } else
10163
10171
  console.error("Preset not found:", a);
10164
- }, S = (j) => {
10165
- C(j), i(""), f();
10172
+ }, S = (E) => {
10173
+ C(E), i(""), f();
10166
10174
  }, A = useDebouncedCallback(
10167
- (j, v) => {
10175
+ (E, v) => {
10168
10176
  x(() => ({
10169
10177
  ...h,
10170
10178
  fontFamily: {
10171
10179
  ...h.fontFamily,
10172
- [j.replace(/font-/g, "")]: v
10180
+ [E.replace(/font-/g, "")]: v
10173
10181
  }
10174
10182
  })), f();
10175
10183
  },
10176
10184
  [h, f],
10177
10185
  200
10178
10186
  ), B = React.useCallback(
10179
- (j) => {
10187
+ (E) => {
10180
10188
  x(() => ({
10181
10189
  ...h,
10182
- borderRadius: `${j}px`
10190
+ borderRadius: `${E}px`
10183
10191
  })), f();
10184
10192
  },
10185
10193
  [h, f]
10186
10194
  ), _ = useDebouncedCallback(
10187
- (j, v) => {
10195
+ (E, v) => {
10188
10196
  x(() => {
10189
- const E = get(h, `colors.${j}`);
10190
- return n ? set(E, 1, v) : set(E, 0, v), f(), {
10197
+ const j = get(h, `colors.${E}`);
10198
+ return n ? set(j, 1, v) : set(j, 0, v), f(), {
10191
10199
  ...h,
10192
10200
  colors: {
10193
10201
  ...h.colors,
10194
- [j]: E
10202
+ [E]: j
10195
10203
  }
10196
10204
  };
10197
10205
  });
10198
10206
  },
10199
10207
  [h, f],
10200
10208
  200
10201
- ), w = (j) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(j.items).map(([v]) => {
10202
- const E = get(h, `colors.${v}.${n ? 1 : 0}`);
10203
- return E ? /* @__PURE__ */ jsxs("div", { id: `theme-${v}`, className: "mt-1 flex items-center gap-x-2", children: [
10209
+ ), w = (E) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(E.items).map(([v]) => {
10210
+ const j = get(h, `colors.${v}.${n ? 1 : 0}`);
10211
+ return j ? /* @__PURE__ */ jsxs("div", { id: `theme-${v}`, className: "mt-1 flex items-center gap-x-2", children: [
10204
10212
  /* @__PURE__ */ jsx(
10205
10213
  ColorPickerInput,
10206
10214
  {
10207
- value: E,
10215
+ value: j,
10208
10216
  onChange: (N) => _(v, N)
10209
10217
  }
10210
10218
  ),
@@ -10224,9 +10232,9 @@ const useStructureValidation = () => {
10224
10232
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
10225
10233
  /* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: i, children: [
10226
10234
  /* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: y("Select preset") }) }),
10227
- /* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((j) => {
10228
- const v = Object.keys(j)[0], E = v.replaceAll("_", " ");
10229
- return /* @__PURE__ */ jsx(SelectItem, { value: v, children: capitalize(E) }, v);
10235
+ /* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((E) => {
10236
+ const v = Object.keys(E)[0], j = v.replaceAll("_", " ");
10237
+ return /* @__PURE__ */ jsx(SelectItem, { value: v, children: capitalize(j) }, v);
10230
10238
  }) })
10231
10239
  ] }) }),
10232
10240
  /* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: k, children: y("Apply") }) })
@@ -10238,14 +10246,14 @@ const useStructureValidation = () => {
10238
10246
  /* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
10239
10247
  /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: y("Typography") })
10240
10248
  ] }),
10241
- (b == null ? void 0 : b.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(b.fontFamily).map(([j, v]) => /* @__PURE__ */ jsx(
10249
+ (b == null ? void 0 : b.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(b.fontFamily).map(([E, v]) => /* @__PURE__ */ jsx(
10242
10250
  FontSelector,
10243
10251
  {
10244
- label: j,
10245
- value: h.fontFamily[j.replace(/font-/g, "")] || v[Object.keys(v)[0]],
10246
- onChange: (E) => A(j, E)
10252
+ label: E,
10253
+ value: h.fontFamily[E.replace(/font-/g, "")] || v[Object.keys(v)[0]],
10254
+ onChange: (j) => A(E, j)
10247
10255
  },
10248
- j
10256
+ E
10249
10257
  )) }),
10250
10258
  /* @__PURE__ */ jsx(Separator, {}),
10251
10259
  (b == null ? void 0 : b.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
@@ -10271,7 +10279,7 @@ const useStructureValidation = () => {
10271
10279
  Switch,
10272
10280
  {
10273
10281
  checked: n,
10274
- onCheckedChange: (j) => r(j),
10282
+ onCheckedChange: (E) => r(E),
10275
10283
  "aria-label": y("Toggle dark mode"),
10276
10284
  className: "mx-1"
10277
10285
  }
@@ -10279,7 +10287,7 @@ const useStructureValidation = () => {
10279
10287
  /* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
10280
10288
  ] })
10281
10289
  ] }),
10282
- /* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((j) => w(j)) })
10290
+ /* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((E) => w(E)) })
10283
10291
  ] }),
10284
10292
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: y("Loading...") }), children: l && g && /* @__PURE__ */ jsx(
10285
10293
  LazyCssImportModal,
@@ -11039,8 +11047,8 @@ const UndoRedo = () => {
11039
11047
  r(w), i(a), c(""), u(""), f("");
11040
11048
  }
11041
11049
  }, k = (w) => {
11042
- const j = a.filter((v, E) => E !== w);
11043
- r(j), i(j);
11050
+ const E = a.filter((v, j) => j !== w);
11051
+ r(E), i(E);
11044
11052
  }, S = (w) => {
11045
11053
  g(w), c(a[w].key), u(a[w].value);
11046
11054
  }, A = () => {
@@ -11055,17 +11063,17 @@ const UndoRedo = () => {
11055
11063
  }, B = (w) => {
11056
11064
  w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? A() : C());
11057
11065
  }, _ = useCallback((w) => {
11058
- const j = (N) => /[.,!?;:]/.test(N), v = (N, I, P) => {
11066
+ const E = (N) => /[.,!?;:]/.test(N), v = (N, I, P) => {
11059
11067
  let D = "", R = "";
11060
11068
  const $ = I > 0 ? N[I - 1] : "", F = I < N.length ? N[I] : "";
11061
- return I > 0 && ($ === "." || !j($) && $ !== " ") && (D = " "), I < N.length && !j(F) && F !== " " && (R = " "), {
11069
+ return I > 0 && ($ === "." || !E($) && $ !== " ") && (D = " "), I < N.length && !E(F) && F !== " " && (R = " "), {
11062
11070
  text: D + P + R,
11063
11071
  prefixLength: D.length,
11064
11072
  suffixLength: R.length
11065
11073
  };
11066
- }, E = x.current;
11067
- if (E) {
11068
- const N = E.selectionStart || 0, I = E.value || "", P = E.selectionEnd || N;
11074
+ }, j = x.current;
11075
+ if (j) {
11076
+ const N = j.selectionStart || 0, I = j.value || "", P = j.selectionEnd || N;
11069
11077
  if (P > N) {
11070
11078
  const O = `{{${w}}}`, { text: L } = v(I, N, O), T = I.slice(0, N) + L + I.slice(P);
11071
11079
  u(T);
@@ -11129,16 +11137,16 @@ const UndoRedo = () => {
11129
11137
  ]
11130
11138
  }
11131
11139
  ),
11132
- /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((w, j) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
11140
+ /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((w, E) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
11133
11141
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
11134
11142
  /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: w.key }),
11135
11143
  /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: w.value.toString() })
11136
11144
  ] }),
11137
11145
  /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
11138
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(j), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
11139
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(j), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
11146
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(E), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
11147
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(E), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
11140
11148
  ] })
11141
- ] }, j)) })
11149
+ ] }, E)) })
11142
11150
  ] });
11143
11151
  }), BlockAttributesEditor = React.memo(() => {
11144
11152
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), i = useUpdateBlocksProps(), l = `${get(a, "0.prop")}_attrs`;
@@ -11382,7 +11390,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11382
11390
  ] })
11383
11391
  ] });
11384
11392
  }, ManageDesignTokens = ({}) => {
11385
- const { t: o } = useTranslation(), [n, r] = useAtom$1(chaiDesignTokensAtom), [a, i] = useState(!1), [l, c] = useState(null), [d, u] = useState(!1), [p, g] = useState(!1), [m, f] = useState(""), [h, x] = useState(""), [b, y] = useState(""), [C, k] = useState(""), [S, A] = useState(""), [B, _] = useState(""), w = useIncrementActionsCount(), j = (L) => {
11393
+ const { t: o } = useTranslation(), [n, r] = useAtom$1(chaiDesignTokensAtom), [a, i] = useState(!1), [l, c] = useState(null), [d, u] = useState(!1), [p, g] = useState(!1), [m, f] = useState(""), [h, x] = useState(""), [b, y] = useState(""), [C, k] = useState(""), [S, A] = useState(""), [B, _] = useState(""), w = useIncrementActionsCount(), E = (L) => {
11386
11394
  const T = L.trim();
11387
11395
  return T.length === 0 || T.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(T);
11388
11396
  }, v = (L, T = !1, M) => {
@@ -11390,12 +11398,12 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11390
11398
  return H.length === 0 ? "" : H.length > 25 ? o("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(H) ? Object.entries(n).find(
11391
11399
  ([V, U]) => U.name === H && (!T || V !== M)
11392
11400
  ) ? o("Token name already exists") : "" : o("Only alphanumeric characters and hyphens allowed");
11393
- }, E = () => {
11401
+ }, j = () => {
11394
11402
  if (!m.trim() || !h.trim()) {
11395
11403
  toast.error(o("Please fill in both token name and classes"));
11396
11404
  return;
11397
11405
  }
11398
- if (!j(m)) {
11406
+ if (!E(m)) {
11399
11407
  toast.error(o("Invalid design token name format"));
11400
11408
  return;
11401
11409
  }
@@ -11416,7 +11424,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11416
11424
  toast.error(o("Please fill in both token name and classes"));
11417
11425
  return;
11418
11426
  }
11419
- if (!j(b)) {
11427
+ if (!E(b)) {
11420
11428
  toast.error(o("Invalid design token name format"));
11421
11429
  return;
11422
11430
  }
@@ -11566,7 +11574,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11566
11574
  ] }),
11567
11575
  /* @__PURE__ */ jsxs(DialogFooter, { children: [
11568
11576
  /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: $, className: "h-8 text-sm", children: o("Cancel") }),
11569
- /* @__PURE__ */ jsx(Button, { onClick: E, className: "h-8 text-sm", children: o("Add Token") })
11577
+ /* @__PURE__ */ jsx(Button, { onClick: j, className: "h-8 text-sm", children: o("Add Token") })
11570
11578
  ] })
11571
11579
  ] }) }),
11572
11580
  /* @__PURE__ */ jsx(Dialog, { open: p, onOpenChange: R, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-md", children: [
@@ -11675,7 +11683,7 @@ const RootLayout = () => {
11675
11683
  /* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
11676
11684
  /* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
11677
11685
  /* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
11678
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((w, j) => /* @__PURE__ */ jsxs(Tooltip, { children: [
11686
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((w, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
11679
11687
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
11680
11688
  position: "top",
11681
11689
  panelId: w.id,
@@ -11683,9 +11691,9 @@ const RootLayout = () => {
11683
11691
  show: () => _(w.id)
11684
11692
  }) }),
11685
11693
  /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
11686
- ] }, "button-top-" + j)) }),
11694
+ ] }, "button-top-" + E)) }),
11687
11695
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
11688
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((w, j) => /* @__PURE__ */ jsxs(Tooltip, { children: [
11696
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((w, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
11689
11697
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
11690
11698
  position: "bottom",
11691
11699
  panelId: w.id,
@@ -11693,7 +11701,7 @@ const RootLayout = () => {
11693
11701
  show: () => _(w.id)
11694
11702
  }) }),
11695
11703
  /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
11696
- ] }, "button-bottom-" + j)) })
11704
+ ] }, "button-bottom-" + E)) })
11697
11705
  ] }),
11698
11706
  /* @__PURE__ */ jsx(
11699
11707
  motion.div,
@@ -12141,10 +12149,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
12141
12149
  var r;
12142
12150
  const a = getBuildingBlocks(o), i = a[1], l = a[2], c = a[3], d = a[6], u = a[7], p = a[11], g = a[12], m = a[13], f = a[14], h = a[16], x = a[17], b = p(o, n);
12143
12151
  if (isAtomStateInitialized(b) && (i.has(n) && l.get(n) !== b.n || Array.from(b.d).every(
12144
- ([w, j]) => (
12152
+ ([w, E]) => (
12145
12153
  // Recursively, read the atom state of the dependency, and
12146
12154
  // check if the atom epoch number is unchanged
12147
- f(o, w).n === j
12155
+ f(o, w).n === E
12148
12156
  )
12149
12157
  )))
12150
12158
  return b;
@@ -12154,21 +12162,21 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
12154
12162
  i.has(n) && (x(o, n), m(o), g(o));
12155
12163
  }
12156
12164
  function k(w) {
12157
- var j;
12165
+ var E;
12158
12166
  if (isSelfAtom(n, w)) {
12159
- const E = p(o, w);
12160
- if (!isAtomStateInitialized(E))
12167
+ const j = p(o, w);
12168
+ if (!isAtomStateInitialized(j))
12161
12169
  if (hasInitialValue(w))
12162
12170
  setAtomStateValueOrPromise(o, w, w.init);
12163
12171
  else
12164
12172
  throw new Error("no atom init");
12165
- return returnAtomValue(E);
12173
+ return returnAtomValue(j);
12166
12174
  }
12167
12175
  const v = f(o, w);
12168
12176
  try {
12169
12177
  return returnAtomValue(v);
12170
12178
  } finally {
12171
- b.d.set(w, v.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, v), (j = i.get(w)) == null || j.t.add(n), y || C();
12179
+ b.d.set(w, v.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, v), (E = i.get(w)) == null || E.t.add(n), y || C();
12172
12180
  }
12173
12181
  }
12174
12182
  let S, A;