@chaibuilder/sdk 3.1.31 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ import { twMerge } from "tailwind-merge";
13
13
  import TreeModel from "tree-model";
14
14
  import * as React from "react";
15
15
  import React__default, { useEffect, useCallback, useState, useMemo, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, lazy, useReducer, useDebugValue } from "react";
16
- import { C as COLLECTION_PREFIX, S as STYLES_KEY, j as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, k as ROOT_TEMP_KEY } from "./apply-binding-BwPhgnhk.js";
16
+ import { C as COLLECTION_PREFIX, S as STYLES_KEY, j as getSplitChaiClasses, h as getBlocksFromHTML, m as mergeBlocksWithExisting, e as adjustSpacingInContentBlocks, a as applyBindingToBlockProps, b as applyLanguage, g as getBlockTagAttributes, c as getBlockRuntimeProps, d as applyLimit, R as REPEATER_PREFIX, D as DESIGN_TOKEN_PREFIX, k as ROOT_TEMP_KEY } from "./apply-binding-CSWwWMjY.js";
17
17
  import { d as defaultThemeOptions, f as defaultThemeValues, a as getChaiThemeCssVariables, g as getChaiThemeOptions, p as plugin, h as getThemeFontsUrls, i as getThemeCustomFontFace } from "./plugin-BOcGV_IY.js";
18
18
  import { isObject } from "@rjsf/utils";
19
19
  import { toast, Toaster } from "sonner";
@@ -22,7 +22,7 @@ import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useDebou
22
22
  import Fuse from "fuse.js";
23
23
  import UndoManager from "undo-manager";
24
24
  import { ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, at as Input$1, aW as Skeleton, d as Alert, e as AlertDescription, v as Button, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, a9 as DialogTitle, av as Popover, b4 as Tooltip, b7 as TooltipTrigger, ay as PopoverTrigger, b5 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, B as Badge, b6 as TooltipProvider, a as AccordionItem, b as AccordionTrigger, c as AccordionContent, ag as DropdownMenuLabel, ak as DropdownMenuSeparator, ac as DropdownMenuCheckboxItem, aq as HoverCard, as as HoverCardTrigger, ar as HoverCardContent, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, b1 as Textarea, z as CardFooter, aB as Select$1, aJ as SelectTrigger, aK as SelectValue, aC as SelectContent, aE as SelectItem, b8 as cn$2, az as ScrollArea, aZ as Tabs, a$ as TabsList, b0 as TabsTrigger, a_ as TabsContent, g as AlertDialog, q as AlertDialogTrigger, j as AlertDialogContent, m as AlertDialogHeader, p as AlertDialogTitle, k as AlertDialogDescription, l as AlertDialogFooter, i as AlertDialogCancel, h as AlertDialogAction, a6 as DialogHeader, aX as Slider, aL as Separator, aY as Switch, a4 as DialogDescription, a5 as DialogFooter, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle } from "./tooltip-DUosa-uC.js";
25
- import { PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, GearIcon, DragHandleDots2Icon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, CaretDownIcon, Cross1Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, ValueIcon, TextAlignCenterIcon, TextAlignRightIcon, TextAlignLeftIcon, Link2Icon, LinkBreak2Icon, EnterFullScreenIcon, ExclamationTriangleIcon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, ChevronRightIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, FontStyleIcon, CircleIcon, MagnifyingGlassIcon, ReloadIcon, CaretRightIcon, FrameIcon, SquareIcon, EraserIcon, CheckIcon, DownloadIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, StackIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, ZoomInIcon, DotsHorizontalIcon, LightningBoltIcon, Pencil1Icon } from "@radix-ui/react-icons";
25
+ import { PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, GearIcon, DragHandleDots2Icon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, CaretDownIcon, Cross1Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, ListBulletIcon, ValueIcon, TextAlignCenterIcon, TextAlignRightIcon, TextAlignLeftIcon, Link2Icon, LinkBreak2Icon, EnterFullScreenIcon, ExclamationTriangleIcon, Pencil2Icon, ChevronLeftIcon, LoopIcon, IdCardIcon, ChevronRightIcon, PlusCircledIcon, ChevronDownIcon, InfoCircledIcon, FileIcon, DotsVerticalIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, BoxIcon, MinusIcon, CrossCircledIcon, MobileIcon, LaptopIcon, DesktopIcon, FontStyleIcon, CircleIcon, MagnifyingGlassIcon, ReloadIcon, CaretRightIcon, FrameIcon, SquareIcon, EraserIcon, CheckIcon, DownloadIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, StackIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, ZoomInIcon, DotsHorizontalIcon, LightningBoltIcon, GlobeIcon, Pencil1Icon } from "@radix-ui/react-icons";
26
26
  import i18n, { t } from "i18next";
27
27
  import ReactDOM, { createPortal } from "react-dom";
28
28
  import { HexAlphaColorPicker } from "react-colorful";
@@ -1059,13 +1059,13 @@ const undoRedoStateAtom = atom({
1059
1059
  } = useBlocksStoreManager();
1060
1060
  return {
1061
1061
  moveBlocks: (x, b, y) => {
1062
- const C = map(x, (w) => {
1063
- const B = n.find((E) => E._id === w)._parent || null, S = n.filter((E) => B ? E._parent === B : !E._parent).map((E) => E._id).indexOf(w);
1064
- return { _id: w, oldParent: B, oldPosition: S };
1065
- }), k = C.find(({ _id: w }) => w === x[0]);
1062
+ const C = map(x, (v) => {
1063
+ const B = n.find((E) => E._id === v)._parent || null, w = n.filter((E) => B ? E._parent === B : !E._parent).map((E) => E._id).indexOf(v);
1064
+ return { _id: v, oldParent: B, oldPosition: w };
1065
+ }), k = C.find(({ _id: v }) => v === x[0]);
1066
1066
  k && k.oldParent === b && k.oldPosition === y || (l(x, b, y), o({
1067
- undo: () => each(C, ({ _id: w, oldParent: A, oldPosition: B }) => {
1068
- l([w], A, B);
1067
+ undo: () => each(C, ({ _id: v, oldParent: A, oldPosition: B }) => {
1068
+ l([v], A, B);
1069
1069
  }),
1070
1070
  redo: () => l(x, b, y)
1071
1071
  }));
@@ -1078,7 +1078,7 @@ const undoRedoStateAtom = atom({
1078
1078
  },
1079
1079
  removeBlocks: (x) => {
1080
1080
  var k;
1081
- const b = (k = first(x)) == null ? void 0 : k._parent, C = n.filter((w) => b ? w._parent === b : !w._parent).indexOf(first(x));
1081
+ const b = (k = first(x)) == null ? void 0 : k._parent, C = n.filter((v) => b ? v._parent === b : !v._parent).indexOf(first(x));
1082
1082
  i(map(x, "_id")), o({
1083
1083
  undo: () => a(x, b, C),
1084
1084
  redo: () => i(map(x, "_id"))
@@ -1090,8 +1090,8 @@ const undoRedoStateAtom = atom({
1090
1090
  C = map(x, (k) => ({ _id: k, ...y }));
1091
1091
  else {
1092
1092
  const k = keys(b);
1093
- C = map(x, (w) => {
1094
- const A = n.find((_) => _._id === w), B = { _id: w };
1093
+ C = map(x, (v) => {
1094
+ const A = n.find((_) => _._id === v), B = { _id: v };
1095
1095
  return each(k, (_) => B[_] = A[_]), B;
1096
1096
  });
1097
1097
  }
@@ -1112,8 +1112,8 @@ const undoRedoStateAtom = atom({
1112
1112
  updateMultipleBlocksProps: (x) => {
1113
1113
  let b = [];
1114
1114
  b = map(x, (y) => {
1115
- const C = keys(y), k = n.find((A) => A._id === y._id), w = {};
1116
- return each(C, (A) => w[A] = k[A]), w;
1115
+ const C = keys(y), k = n.find((A) => A._id === y._id), v = {};
1116
+ return each(C, (A) => v[A] = k[A]), v;
1117
1117
  }), c(x), o({
1118
1118
  undo: () => c(b),
1119
1119
  redo: () => c(x)
@@ -2602,21 +2602,21 @@ const getBlockWithChildren = (o, n) => {
2602
2602
  if (i) {
2603
2603
  n(!0), a(null);
2604
2604
  try {
2605
- const y = p === u ? "" : p, C = x.toLowerCase().includes("translate the content"), k = f === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(h, d)), p, C) : [m(h, d)], w = await i(f, addLangToPrompt(x, g, f), k, y), { blocks: A, error: B } = w;
2605
+ const y = p === u ? "" : p, C = x.toLowerCase().includes("translate the content"), k = f === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(h, d)), p, C) : [m(h, d)], v = await i(f, addLangToPrompt(x, g, f), k, y), { blocks: A, error: B } = v;
2606
2606
  if (B) {
2607
2607
  a(B);
2608
2608
  return;
2609
2609
  }
2610
2610
  if (f === "styles") {
2611
- const _ = A.map((S) => {
2612
- for (const E in S)
2613
- E !== "_id" && (S[E] = `${STYLES_KEY},${S[E]}`);
2614
- return S;
2611
+ const _ = A.map((w) => {
2612
+ for (const E in w)
2613
+ E !== "_id" && (w[E] = `${STYLES_KEY},${w[E]}`);
2614
+ return w;
2615
2615
  });
2616
2616
  c(_);
2617
2617
  } else
2618
2618
  l(A);
2619
- b && b(w);
2619
+ b && b(v);
2620
2620
  } catch (y) {
2621
2621
  a(y);
2622
2622
  } finally {
@@ -3527,25 +3527,25 @@ function calculateElementZone(o, n, r, a, i) {
3527
3527
  }
3528
3528
  }
3529
3529
  function detectDropZone(o, n, r, a, i) {
3530
- var w, A, B, _;
3530
+ var v, A, B, _;
3531
3531
  const l = o.getAttribute("data-block-id"), c = o.getAttribute("data-block-type") || "Box";
3532
3532
  if (!l)
3533
3533
  return null;
3534
3534
  let d = o.parentElement;
3535
3535
  for (; d && !d.hasAttribute("data-block-id"); )
3536
3536
  d = d.parentElement;
3537
- const p = l === "canvas" ? l : d == null ? void 0 : d.getAttribute("data-block-id"), u = d ? getOrientation(d) : "vertical", g = getOrientation(o), m = isLeafBlock(c), f = !m && canAcceptChildBlock(c, a), h = ((w = i.defaultView) == null ? void 0 : w.scrollY) || 0, x = ((A = i.defaultView) == null ? void 0 : A.scrollX) || 0;
3537
+ const p = l === "canvas" ? l : d == null ? void 0 : d.getAttribute("data-block-id"), u = d ? getOrientation(d) : "vertical", g = getOrientation(o), m = isLeafBlock(c), f = !m && canAcceptChildBlock(c, a), h = ((v = i.defaultView) == null ? void 0 : v.scrollY) || 0, x = ((A = i.defaultView) == null ? void 0 : A.scrollX) || 0;
3538
3538
  if (l === "canvas" && hasChildBlocks(o)) {
3539
- const S = getChildBlocks(o), E = S[S.length - 1];
3539
+ const w = getChildBlocks(o), E = w[w.length - 1];
3540
3540
  if (E) {
3541
- const v = E.getBoundingClientRect(), j = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, R = j.width - I - D, P = j.left + x + I;
3541
+ const S = E.getBoundingClientRect(), j = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, P = j.width - I - D, R = j.left + x + I;
3542
3542
  return {
3543
3543
  position: "after",
3544
3544
  placeholderOrientation: "horizontal",
3545
3545
  rect: {
3546
- top: v.bottom + h,
3547
- left: P,
3548
- width: R,
3546
+ top: S.bottom + h,
3547
+ left: R,
3548
+ width: P,
3549
3549
  height: 4
3550
3550
  },
3551
3551
  targetElement: E,
@@ -3557,11 +3557,11 @@ function detectDropZone(o, n, r, a, i) {
3557
3557
  }
3558
3558
  }
3559
3559
  if (f && !m && hasChildBlocks(o)) {
3560
- const S = detectGapZone(o, n, r, g);
3561
- if (S) {
3562
- const E = S.before.getBoundingClientRect(), v = S.after.getBoundingClientRect(), j = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, R = getChildBlocks(o), P = getSiblingsInSameRow(R, S.before, g);
3560
+ const w = detectGapZone(o, n, r, g);
3561
+ if (w) {
3562
+ const E = w.before.getBoundingClientRect(), S = w.after.getBoundingClientRect(), j = o.getBoundingClientRect(), N = window.getComputedStyle(o), I = parseFloat(N.paddingLeft) || 0, D = parseFloat(N.paddingRight) || 0, P = getChildBlocks(o), R = getSiblingsInSameRow(P, w.before, g);
3563
3563
  let $ = 0;
3564
- if (P.forEach((F) => {
3564
+ if (R.forEach((F) => {
3565
3565
  const O = F.getBoundingClientRect();
3566
3566
  O.height > $ && ($ = O.height);
3567
3567
  }), g === "vertical") {
@@ -3575,15 +3575,15 @@ function detectDropZone(o, n, r, a, i) {
3575
3575
  width: F,
3576
3576
  height: 4
3577
3577
  },
3578
- targetElement: S.before,
3579
- targetBlockId: S.before.getAttribute("data-block-id"),
3578
+ targetElement: w.before,
3579
+ targetBlockId: w.before.getAttribute("data-block-id"),
3580
3580
  targetParentId: l,
3581
3581
  isGapZone: !0,
3582
3582
  confidence: 1
3583
3583
  // High confidence for gap zones
3584
3584
  };
3585
3585
  } else {
3586
- const F = E.top + h, O = $ > 0 ? $ : Math.max(E.height, v.height);
3586
+ const F = E.top + h, O = $ > 0 ? $ : Math.max(E.height, S.height);
3587
3587
  return {
3588
3588
  position: "after",
3589
3589
  placeholderOrientation: "vertical",
@@ -3593,8 +3593,8 @@ function detectDropZone(o, n, r, a, i) {
3593
3593
  width: 4,
3594
3594
  height: O
3595
3595
  },
3596
- targetElement: S.before,
3597
- targetBlockId: S.before.getAttribute("data-block-id"),
3596
+ targetElement: w.before,
3597
+ targetBlockId: w.before.getAttribute("data-block-id"),
3598
3598
  targetParentId: l,
3599
3599
  isGapZone: !0,
3600
3600
  confidence: 1
@@ -3603,20 +3603,20 @@ function detectDropZone(o, n, r, a, i) {
3603
3603
  }
3604
3604
  }
3605
3605
  if (d && p) {
3606
- const S = detectParentEdgeProximity(d, n, r, u);
3607
- if (S) {
3608
- const E = d.getBoundingClientRect(), v = window.getComputedStyle(d), j = parseFloat(v.paddingLeft) || 0, N = parseFloat(v.paddingRight) || 0, I = parseFloat(v.paddingTop) || 0, D = parseFloat(v.paddingBottom) || 0, R = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, P = ((_ = i.defaultView) == null ? void 0 : _.scrollX) || 0, $ = u === "vertical" ? "horizontal" : "vertical", F = getMaxSiblingDimensions(d);
3609
- if (S === "start") {
3606
+ const w = detectParentEdgeProximity(d, n, r, u);
3607
+ if (w) {
3608
+ const E = d.getBoundingClientRect(), S = window.getComputedStyle(d), j = parseFloat(S.paddingLeft) || 0, N = parseFloat(S.paddingRight) || 0, I = parseFloat(S.paddingTop) || 0, D = parseFloat(S.paddingBottom) || 0, P = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, R = ((_ = i.defaultView) == null ? void 0 : _.scrollX) || 0, $ = u === "vertical" ? "horizontal" : "vertical", F = getMaxSiblingDimensions(d);
3609
+ if (w === "start") {
3610
3610
  const O = getChildBlocks(d)[0];
3611
3611
  if (O) {
3612
3612
  const L = O.getBoundingClientRect();
3613
3613
  if (u === "vertical") {
3614
- const T = E.width - j - N, M = E.left + P + j;
3614
+ const T = E.width - j - N, M = E.left + R + j;
3615
3615
  return {
3616
3616
  position: "before",
3617
3617
  placeholderOrientation: $,
3618
3618
  rect: {
3619
- top: L.top + R - 2,
3619
+ top: L.top + P - 2,
3620
3620
  left: M,
3621
3621
  width: T,
3622
3622
  height: 4
@@ -3627,13 +3627,13 @@ function detectDropZone(o, n, r, a, i) {
3627
3627
  confidence: 0.9
3628
3628
  };
3629
3629
  } else {
3630
- const T = E.top + R + I, M = F.maxHeight > 0 ? F.maxHeight : E.height - I - D;
3630
+ const T = E.top + P + I, M = F.maxHeight > 0 ? F.maxHeight : E.height - I - D;
3631
3631
  return {
3632
3632
  position: "before",
3633
3633
  placeholderOrientation: $,
3634
3634
  rect: {
3635
3635
  top: T,
3636
- left: L.left + P - 2,
3636
+ left: L.left + R - 2,
3637
3637
  width: 4,
3638
3638
  height: M
3639
3639
  },
@@ -3649,12 +3649,12 @@ function detectDropZone(o, n, r, a, i) {
3649
3649
  if (L) {
3650
3650
  const T = L.getBoundingClientRect();
3651
3651
  if (u === "vertical") {
3652
- const M = E.width - j - N, H = E.left + P + j;
3652
+ const M = E.width - j - N, H = E.left + R + j;
3653
3653
  return {
3654
3654
  position: "after",
3655
3655
  placeholderOrientation: $,
3656
3656
  rect: {
3657
- top: T.bottom + R - 2,
3657
+ top: T.bottom + P - 2,
3658
3658
  left: H,
3659
3659
  width: M,
3660
3660
  height: 4
@@ -3665,13 +3665,13 @@ function detectDropZone(o, n, r, a, i) {
3665
3665
  confidence: 0.9
3666
3666
  };
3667
3667
  } else {
3668
- const M = E.top + R + I, H = F.maxHeight > 0 ? F.maxHeight : E.height - I - D;
3668
+ const M = E.top + P + I, H = F.maxHeight > 0 ? F.maxHeight : E.height - I - D;
3669
3669
  return {
3670
3670
  position: "after",
3671
3671
  placeholderOrientation: $,
3672
3672
  rect: {
3673
3673
  top: M,
3674
- left: T.right + P - 2,
3674
+ left: T.right + R - 2,
3675
3675
  width: 4,
3676
3676
  height: H
3677
3677
  },
@@ -3687,12 +3687,12 @@ function detectDropZone(o, n, r, a, i) {
3687
3687
  }
3688
3688
  let b = calculateElementZone(o, n, r, f, u);
3689
3689
  if (m && b.position === "inside") {
3690
- const S = o.getBoundingClientRect();
3690
+ const w = o.getBoundingClientRect();
3691
3691
  u === "vertical" ? b = {
3692
- position: (r - S.top) / S.height < 0.5 ? "before" : "after",
3692
+ position: (r - w.top) / w.height < 0.5 ? "before" : "after",
3693
3693
  confidence: b.confidence
3694
3694
  } : b = {
3695
- position: (n - S.left) / S.width < 0.5 ? "before" : "after",
3695
+ position: (n - w.left) / w.width < 0.5 ? "before" : "after",
3696
3696
  confidence: b.confidence
3697
3697
  };
3698
3698
  }
@@ -3760,45 +3760,45 @@ function getSiblingsInSameRow(o, n, r) {
3760
3760
  }
3761
3761
  function calculatePlaceholderRect(o, n, r, a, i) {
3762
3762
  var I, D;
3763
- const l = o.getBoundingClientRect(), c = window.getComputedStyle(o), d = ((I = i.defaultView) == null ? void 0 : I.scrollY) || 0, p = ((D = i.defaultView) == null ? void 0 : D.scrollX) || 0, u = 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, w = 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 }, S = n ? getOrientation(n) : "vertical", E = n ? getChildBlocks(n) : [], v = getSiblingsInSameRow(E, o, S);
3763
+ const l = o.getBoundingClientRect(), c = window.getComputedStyle(o), d = ((I = i.defaultView) == null ? void 0 : I.scrollY) || 0, p = ((D = i.defaultView) == null ? void 0 : D.scrollX) || 0, u = 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, v = 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) : [], S = getSiblingsInSameRow(E, o, w);
3764
3764
  let j = 0, N = 0;
3765
- if (v.forEach((R) => {
3766
- const P = R.getBoundingClientRect();
3767
- P.height > j && (j = P.height), P.width > N && (N = P.width);
3765
+ if (S.forEach((P) => {
3766
+ const R = P.getBoundingClientRect();
3767
+ R.height > j && (j = R.height), R.width > N && (N = R.width);
3768
3768
  }), r === "before")
3769
3769
  if (a === "horizontal") {
3770
- const R = C ? C.width - k - w : l.width, P = C ? C.left + p + k : l.left + p;
3770
+ const P = C ? C.width - k - v : l.width, R = C ? C.left + p + k : l.left + p;
3771
3771
  return {
3772
3772
  top: l.top + d - u - 2,
3773
- left: P,
3774
- width: R,
3773
+ left: R,
3774
+ width: P,
3775
3775
  height: 4
3776
3776
  };
3777
3777
  } else {
3778
- const R = l.top + d, P = S === "horizontal" && j > 0 ? j : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
3778
+ const P = l.top + d, R = w === "horizontal" && j > 0 ? j : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
3779
3779
  return {
3780
- top: R,
3780
+ top: P,
3781
3781
  left: l.left + p - m - 2,
3782
3782
  width: 4,
3783
- height: P
3783
+ height: R
3784
3784
  };
3785
3785
  }
3786
3786
  else if (r === "after")
3787
3787
  if (a === "horizontal") {
3788
- const R = C ? C.width - k - w : l.width, P = C ? C.left + p + k : l.left + p;
3788
+ const P = C ? C.width - k - v : l.width, R = C ? C.left + p + k : l.left + p;
3789
3789
  return {
3790
3790
  top: l.bottom + d + g - 2,
3791
- left: P,
3792
- width: R,
3791
+ left: R,
3792
+ width: P,
3793
3793
  height: 4
3794
3794
  };
3795
3795
  } else {
3796
- const R = l.top + d, P = S === "horizontal" && j > 0 ? j : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
3796
+ const P = l.top + d, R = w === "horizontal" && j > 0 ? j : _.maxHeight > 0 ? _.maxHeight : C ? C.height - A - B : l.height;
3797
3797
  return {
3798
- top: R,
3798
+ top: P,
3799
3799
  left: l.right + p + f - 2,
3800
3800
  width: 4,
3801
- height: P
3801
+ height: R
3802
3802
  };
3803
3803
  }
3804
3804
  else
@@ -3873,23 +3873,23 @@ const LEAF_BLOCK_TYPES = [
3873
3873
  const f = c.defaultView, h = f.innerHeight, x = f.scrollY, b = c.documentElement.scrollHeight;
3874
3874
  p.current = m;
3875
3875
  const y = m, C = h - m;
3876
- let k = !1, w = null, A = 0;
3877
- if (y < AUTO_SCROLL_CONFIG.EDGE_ZONE && x > 0 ? (k = !0, w = "up", A = y) : C < AUTO_SCROLL_CONFIG.EDGE_ZONE && x + h < b && (k = !0, w = "down", A = C), !k && d.current !== null) {
3876
+ let k = !1, v = null, A = 0;
3877
+ if (y < AUTO_SCROLL_CONFIG.EDGE_ZONE && x > 0 ? (k = !0, v = "up", A = y) : C < AUTO_SCROLL_CONFIG.EDGE_ZONE && x + h < b && (k = !0, v = "down", A = C), !k && d.current !== null) {
3878
3878
  cancelAnimationFrame(d.current), d.current = null;
3879
3879
  return;
3880
3880
  }
3881
- if (k && w) {
3882
- const B = 1 - A / AUTO_SCROLL_CONFIG.EDGE_ZONE, _ = AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED + (AUTO_SCROLL_CONFIG.MAX_SCROLL_SPEED - AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED) * B, S = () => {
3881
+ if (k && v) {
3882
+ const B = 1 - A / AUTO_SCROLL_CONFIG.EDGE_ZONE, _ = AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED + (AUTO_SCROLL_CONFIG.MAX_SCROLL_SPEED - AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED) * B, w = () => {
3883
3883
  if (!isDragging || !f) {
3884
3884
  d.current = null;
3885
3885
  return;
3886
3886
  }
3887
- const E = w === "up" ? -_ : _;
3887
+ const E = v === "up" ? -_ : _;
3888
3888
  f.scrollBy(0, E);
3889
- const v = f.scrollY, j = v > 0, N = v + h < b, I = p.current, D = h - p.current;
3890
- w === "up" && j && I < AUTO_SCROLL_CONFIG.EDGE_ZONE || w === "down" && N && D < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(S) : d.current = null;
3889
+ const S = f.scrollY, j = S > 0, N = S + h < b, I = p.current, D = h - p.current;
3890
+ v === "up" && j && I < AUTO_SCROLL_CONFIG.EDGE_ZONE || v === "down" && N && D < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(w) : d.current = null;
3891
3891
  };
3892
- d.current === null && (d.current = requestAnimationFrame(S));
3892
+ d.current === null && (d.current = requestAnimationFrame(w));
3893
3893
  }
3894
3894
  },
3895
3895
  [c]
@@ -3913,23 +3913,23 @@ const LEAF_BLOCK_TYPES = [
3913
3913
  const C = o._type || o.type;
3914
3914
  if (!C)
3915
3915
  return;
3916
- const k = m.clientX, w = m.clientY;
3917
- u(w);
3918
- const A = detectDropZone(h, k, w, C, c);
3916
+ const k = m.clientX, v = m.clientY;
3917
+ u(v);
3918
+ const A = detectDropZone(h, k, v, C, c);
3919
3919
  if (!A)
3920
3920
  return;
3921
3921
  const B = h.getAttribute("data-block-type") || "Box";
3922
3922
  let _ = !1;
3923
- const S = LEAF_BLOCK_TYPES.includes(B);
3923
+ const w = LEAF_BLOCK_TYPES.includes(B);
3924
3924
  if (A.position === "inside") {
3925
- if (S || y && !canDropWithoutCircularReference(y, x, l))
3925
+ if (w || y && !canDropWithoutCircularReference(y, x, l))
3926
3926
  return;
3927
3927
  _ = canAcceptChildBlock(B, C);
3928
3928
  } else {
3929
- let v = h.parentElement, j = "Box";
3930
- for (; v && !v.hasAttribute("data-block-id"); )
3931
- v = v.parentElement;
3932
- if (v && (j = v.getAttribute("data-block-type") || "Box"), y && !canDropAsSiblingWithoutCircularReference(y, x, l))
3929
+ let S = h.parentElement, j = "Box";
3930
+ for (; S && !S.hasAttribute("data-block-id"); )
3931
+ S = S.parentElement;
3932
+ if (S && (j = S.getAttribute("data-block-type") || "Box"), y && !canDropAsSiblingWithoutCircularReference(y, x, l))
3933
3933
  return;
3934
3934
  _ = canAcceptChildBlock(j, C);
3935
3935
  }
@@ -4085,14 +4085,14 @@ const useBlockDragStart = () => {
4085
4085
  const y = r.targetBlockId, C = r.targetParentId;
4086
4086
  if (!y)
4087
4087
  return;
4088
- const { parentId: k, index: w } = calculateInsertionIndex(
4088
+ const { parentId: k, index: v } = calculateInsertionIndex(
4089
4089
  i,
4090
4090
  y,
4091
4091
  C,
4092
4092
  r.position
4093
4093
  );
4094
4094
  if (o._id !== void 0)
4095
- d([o._id], k === null ? void 0 : k, w), g(), u([]), p([o._id]);
4095
+ d([o._id], k === null ? void 0 : k, v), g(), u([]), p([o._id]);
4096
4096
  else {
4097
4097
  const B = o._type || o.type, _ = 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;
4098
4098
  c(
@@ -4100,7 +4100,7 @@ const useBlockDragStart = () => {
4100
4100
  blocks: [{ _type: B, _id: "partial-block", partialBlockId: o.partialBlockId }]
4101
4101
  } : (_ == null ? void 0 : _.length) > 0 ? { blocks: [..._] } : { type: B },
4102
4102
  k,
4103
- w
4103
+ v
4104
4104
  );
4105
4105
  }
4106
4106
  setTimeout(() => {
@@ -4387,9 +4387,9 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
4387
4387
  }),
4388
4388
  size({
4389
4389
  boundary: g == null ? void 0 : g.body,
4390
- apply({ availableWidth: w, availableHeight: A, elements: B }) {
4390
+ apply({ availableWidth: v, availableHeight: A, elements: B }) {
4391
4391
  Object.assign(B.floating.style, {
4392
- maxWidth: `${Math.max(200, w)}px`,
4392
+ maxWidth: `${Math.max(200, v)}px`,
4393
4393
  maxHeight: `${Math.max(100, A)}px`
4394
4394
  });
4395
4395
  }
@@ -4400,11 +4400,11 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
4400
4400
  useResizeObserver(r, () => b(), r !== null), useResizeObserver(g == null ? void 0 : g.body, () => b(), (g == null ? void 0 : g.body) !== null);
4401
4401
  const y = get(o, "_parent", null), C = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
4402
4402
  useEffect(() => {
4403
- let w = null;
4404
- return r ? (w = setTimeout(() => b(), 500), () => {
4405
- w && clearTimeout(w);
4403
+ let v = null;
4404
+ return r ? (v = setTimeout(() => b(), 500), () => {
4405
+ v && clearTimeout(v);
4406
4406
  }) : (b(), () => {
4407
- w && clearTimeout(w);
4407
+ v && clearTimeout(v);
4408
4408
  });
4409
4409
  }, [r, o == null ? void 0 : o._id]);
4410
4410
  const [, k] = useSidebarActivePanel();
@@ -4415,13 +4415,13 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span",
4415
4415
  tabIndex: 0,
4416
4416
  ref: x.setFloating,
4417
4417
  style: h,
4418
- onClick: (w) => {
4419
- w.stopPropagation(), w.preventDefault();
4418
+ onClick: (v) => {
4419
+ v.stopPropagation(), v.preventDefault();
4420
4420
  },
4421
- onMouseEnter: (w) => {
4422
- w.stopPropagation(), c(null);
4421
+ onMouseEnter: (v) => {
4422
+ v.stopPropagation(), c(null);
4423
4423
  },
4424
- onKeyDown: (w) => w.stopPropagation(),
4424
+ onKeyDown: (v) => v.stopPropagation(),
4425
4425
  className: `isolate z-[999] flex h-6 items-center justify-between bg-blue-500 py-2 text-xs text-white ${n ? "opacity-0" : ""}`,
4426
4426
  children: /* @__PURE__ */ jsxs(Fragment, { children: [
4427
4427
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -5063,8 +5063,8 @@ const getActiveClasses$1 = (o, n, r) => {
5063
5063
  )
5064
5064
  ] });
5065
5065
  }, RteColorPicker = ({ editor: o, from: n, menuRef: r }) => {
5066
- var k, w;
5067
- const a = (k = o == null ? void 0 : o.getAttributes("textStyle")) == null ? void 0 : k.color, i = (w = o == null ? void 0 : o.getAttributes("highlight")) == null ? void 0 : w.color, [l, c] = useState(a || "#000000F2"), [d, p] = useState(i || "#00000057"), [u, g] = useDebouncedState(l, 150), [m, f] = useDebouncedState(d, 150), h = (A, B) => {
5066
+ var k, v;
5067
+ const a = (k = o == null ? void 0 : o.getAttributes("textStyle")) == null ? void 0 : k.color, i = (v = o == null ? void 0 : o.getAttributes("highlight")) == null ? void 0 : v.color, [l, c] = useState(a || "#000000F2"), [d, p] = useState(i || "#00000057"), [u, g] = useDebouncedState(l, 150), [m, f] = useDebouncedState(d, 150), h = (A, B) => {
5068
5068
  B ? (c(A), g(A)) : (o == null || o.chain().setColor(A).run(), c(A));
5069
5069
  }, x = (A, B) => {
5070
5070
  B ? (p(A), f(A)) : (o == null || o.chain().setHighlight({ color: A }).run(), p(A));
@@ -5426,8 +5426,8 @@ const RichTextEditor = memo(
5426
5426
  onBlur: ({ editor: u, event: g }) => {
5427
5427
  const m = g == null ? void 0 : g.relatedTarget, f = l.querySelector(".ProseMirror"), h = l.querySelector(".tippy-box"), x = l.querySelector("#chai-rich-text-menu-bar"), b = f == null ? void 0 : f.contains(m), y = h == null ? void 0 : h.contains(m), C = x == null ? void 0 : x.contains(m), k = window.document.getElementById("rte-widget-color-picker");
5428
5428
  if (!b && !y && !C && !k) {
5429
- const w = (u == null ? void 0 : u.getHTML()) || "";
5430
- r(w);
5429
+ const v = (u == null ? void 0 : u.getHTML()) || "";
5430
+ r(v);
5431
5431
  }
5432
5432
  },
5433
5433
  from: "canvas"
@@ -5529,26 +5529,26 @@ const RichTextEditor = memo(
5529
5529
  ({ block: o, children: n }) => {
5530
5530
  const r = "content", { document: a } = useFrame(), { editingBlockId: i, editingItemIndex: l, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = 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(() => {
5531
5531
  var N;
5532
- const S = o._type;
5532
+ const w = o._type;
5533
5533
  let E = o[r];
5534
- const v = getRegisteredChaiBlock(o._type);
5535
- 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: S };
5536
- }, [o, h]), w = useCallback(
5537
- (S) => {
5538
- var v;
5539
- const E = S || ((v = g.current) == null ? void 0 : v.innerText);
5534
+ const S = getRegisteredChaiBlock(o._type);
5535
+ return h && ((N = S == null ? void 0 : S.i18nProps) == null ? void 0 : N.includes(r)) && has(o, `${r}-${h}`) && (E = get(o, `${r}-${h}`)), { blockContent: E, blockType: w };
5536
+ }, [o, h]), v = useCallback(
5537
+ (w) => {
5538
+ var S;
5539
+ const E = w || ((S = g.current) == null ? void 0 : S.innerText);
5540
5540
  f([y], { [r]: E }), u(null), c(null), d(-1), x([]), y && setTimeout(() => x([y]), 100);
5541
5541
  },
5542
5542
  [y, f, c, x, h]
5543
5543
  ), A = useDebouncedCallback(
5544
- (S) => {
5545
- f([y], { [r]: S });
5544
+ (w) => {
5545
+ f([y], { [r]: w });
5546
5546
  },
5547
5547
  [y, o, f, h],
5548
5548
  1e3
5549
5549
  ), B = useCallback(
5550
- (S) => {
5551
- S.preventDefault(), y && (b.current = y), w(), setTimeout(() => {
5550
+ (w) => {
5551
+ w.preventDefault(), y && (b.current = y), v(), setTimeout(() => {
5552
5552
  const E = b.current;
5553
5553
  b.current = null, x([E]);
5554
5554
  }, 100);
@@ -5558,8 +5558,8 @@ const RichTextEditor = memo(
5558
5558
  useEffect(() => {
5559
5559
  var j;
5560
5560
  if (!y) return;
5561
- const S = `[data-block-id="${y}"]`, E = l >= 0 ? `[data-block-index="${l}"]` : "", v = a.querySelector(`${S}${E}`);
5562
- v && ((j = v == null ? void 0 : v.classList) == null || j.add("sr-only"), u(v));
5561
+ const w = `[data-block-id="${y}"]`, E = l >= 0 ? `[data-block-index="${l}"]` : "", S = a.querySelector(`${w}${E}`);
5562
+ S && ((j = S == null ? void 0 : S.classList) == null || j.add("sr-only"), u(S));
5563
5563
  }, [y, k, a, l]);
5564
5564
  const _ = useMemo(() => p ? (m(), ["RichText", "Paragraph"].includes(k) ? /* @__PURE__ */ jsx(
5565
5565
  RichTextEditor,
@@ -5567,7 +5567,7 @@ const RichTextEditor = memo(
5567
5567
  blockContent: C,
5568
5568
  editingElement: p,
5569
5569
  onChange: A,
5570
- onClose: w,
5570
+ onClose: v,
5571
5571
  onEscape: B
5572
5572
  }
5573
5573
  ) : /* @__PURE__ */ jsx(
@@ -5576,11 +5576,11 @@ const RichTextEditor = memo(
5576
5576
  editorRef: g,
5577
5577
  blockContent: C,
5578
5578
  editingElement: p,
5579
- onClose: w,
5579
+ onClose: v,
5580
5580
  onChange: A,
5581
5581
  onEscape: B
5582
5582
  }
5583
- )) : null, [p, y, k, C, w, h]);
5583
+ )) : null, [p, y, k, C, v, h]);
5584
5584
  return /* @__PURE__ */ jsxs(Fragment, { children: [
5585
5585
  _,
5586
5586
  n
@@ -5615,7 +5615,7 @@ const RichTextEditor = memo(
5615
5615
  blockAtom: n,
5616
5616
  children: r
5617
5617
  }) => {
5618
- const { editingBlockId: a, editingItemIndex: i } = useInlineEditing(), [l] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(l._type), [l._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: h, key: x } = useContext(RepeaterContext), { mode: b } = useEditorMode(), y = useAtomValue$1(chaiDesignTokensAtom), C = useIsDragAndDropEnabled(), k = b === "edit", w = useDirectBlockDrag(), A = useMemo(
5618
+ const { editingBlockId: a, editingItemIndex: i } = useInlineEditing(), [l] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(l._type), [l._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: h, key: x } = useContext(RepeaterContext), { mode: b } = useEditorMode(), y = useAtomValue$1(chaiDesignTokensAtom), C = useIsDragAndDropEnabled(), k = b === "edit", v = useDirectBlockDrag(), A = useMemo(
5619
5619
  () => m ? applyBindingToBlockProps(applyLanguage(l, d, c), g, {
5620
5620
  index: h,
5621
5621
  key: x
@@ -5627,7 +5627,7 @@ const RichTextEditor = memo(
5627
5627
  ), _ = useMemo(
5628
5628
  () => u(l._id, getBlockRuntimeProps(l._type)),
5629
5629
  [l._id, l._type, u, getBlockRuntimeProps]
5630
- ), S = useMemo(() => {
5630
+ ), w = useMemo(() => {
5631
5631
  const D = {
5632
5632
  "data-block-id": l._id,
5633
5633
  "data-block-type": l._type,
@@ -5636,13 +5636,13 @@ const RichTextEditor = memo(
5636
5636
  return k && C ? {
5637
5637
  ...D,
5638
5638
  draggable: !0,
5639
- onMouseDown: w.onMouseDown,
5640
- onDragStart: w.onDragStart,
5641
- onDragEnd: w.onDragEnd
5639
+ onMouseDown: v.onMouseDown,
5640
+ onDragStart: v.onDragStart,
5641
+ onDragEnd: v.onDragEnd
5642
5642
  } : D;
5643
- }, [l._id, l._type, h, k, C, w]), E = useMemo(
5643
+ }, [l._id, l._type, h, k, C, v]), E = useMemo(
5644
5644
  () => ({
5645
- blockProps: S,
5645
+ blockProps: w,
5646
5646
  inBuilder: b === "edit",
5647
5647
  lang: d || p,
5648
5648
  ...A,
@@ -5650,8 +5650,8 @@ const RichTextEditor = memo(
5650
5650
  ..._,
5651
5651
  ...o
5652
5652
  }),
5653
- [b, S, d, p, A, B, _, o]
5654
- ), v = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]), j = useMemo(() => get(l, "_show", !0), [l]);
5653
+ [b, w, d, p, A, B, _, o]
5654
+ ), S = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]), j = useMemo(() => get(l, "_show", !0), [l]);
5655
5655
  if (isNull(f) || !j) return null;
5656
5656
  let N = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
5657
5657
  ...E,
@@ -5667,7 +5667,7 @@ const RichTextEditor = memo(
5667
5667
  })
5668
5668
  }) });
5669
5669
  const I = a === l._id && (i === h || h < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: l, children: N }) : N;
5670
- return v ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: I }) : I;
5670
+ return S ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: I }) : I;
5671
5671
  }, PartialWrapper$1 = ({ children: o, partialBlockId: n }) => {
5672
5672
  const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: i, fallbackLang: l } = useLanguages(), c = useCallback(
5673
5673
  (d) => {
@@ -5837,7 +5837,7 @@ const RichTextEditor = memo(
5837
5837
  /* @__PURE__ */ jsx("p", { className: "font-semibold", children: o("Oops! Something went wrong.") }),
5838
5838
  /* @__PURE__ */ jsx("p", { children: o("Please try again.") })
5839
5839
  ] }) });
5840
- }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-Bp42QCHq.js")), CanvasArea = () => {
5840
+ }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-BZMSNYkF.js")), CanvasArea = () => {
5841
5841
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
5842
5842
  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: [
5843
5843
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
@@ -5977,27 +5977,27 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
5977
5977
  }, ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5978
5978
  const { t: i } = useTranslation(), { selectedLang: l } = useLanguages(), c = useSelectedBlock(), d = useUpdateBlocksProps(), p = usePageExternalData(), u = r.split(".").pop() || "", g = l ? `_${u}Id-${l}` : `_${u}Id`, m = isEmpty(l) && (c == null ? void 0 : c._type) === "Image" && has(c, "assetId"), f = get(c, g, m ? c == null ? void 0 : c.assetId : ""), h = useMemo(() => {
5979
5979
  if (!o || !c || !/\{\{.*?\}\}/.test(o)) return o;
5980
- const w = { ...c, [u]: o }, A = applyBindingToBlockProps(w, p, { index: -1, key: "" });
5980
+ const v = { ...c, [u]: o }, A = applyBindingToBlockProps(v, p, { index: -1, key: "" });
5981
5981
  return get(A, u, o);
5982
5982
  }, [o, c, p, u]), x = !!f || h !== PLACEHOLDER_IMAGE, b = (k) => {
5983
- const w = isArray(k) ? first(k) : k;
5984
- if (w) {
5985
- n(w == null ? void 0 : w.url);
5986
- const A = w == null ? void 0 : w.width, B = w == null ? void 0 : w.height, _ = g.includes("mobile");
5983
+ const v = isArray(k) ? first(k) : k;
5984
+ if (v) {
5985
+ n(v == null ? void 0 : v.url);
5986
+ const A = v == null ? void 0 : v.width, B = v == null ? void 0 : v.height, _ = g.includes("mobile");
5987
5987
  if (c != null && c._id) {
5988
- const S = {
5988
+ const w = {
5989
5989
  ...A && { [_ ? "mobileWidth" : "width"]: A },
5990
5990
  ...B && { [_ ? "mobileHeight" : "height"]: B },
5991
- ...w.description && { alt: w.description }
5991
+ ...v.description && { alt: v.description }
5992
5992
  };
5993
- if (set(S, g, w.id), isEmpty(S)) return;
5994
- d([c._id], S);
5993
+ if (set(w, g, v.id), isEmpty(w)) return;
5994
+ d([c._id], w);
5995
5995
  }
5996
5996
  }
5997
5997
  }, y = useCallback(() => {
5998
5998
  if (n(PLACEHOLDER_IMAGE), c != null && c._id) {
5999
- const k = {}, w = g.includes("mobile");
6000
- set(k, g, ""), set(k, w ? "mobileWidth" : "width", ""), set(k, w ? "mobileHeight" : "height", ""), d([c._id], k);
5999
+ const k = {}, v = g.includes("mobile");
6000
+ set(k, g, ""), set(k, v ? "mobileWidth" : "width", ""), set(k, v ? "mobileHeight" : "height", ""), d([c._id], k);
6001
6001
  }
6002
6002
  }, [n, c == null ? void 0 : c._id, d, g]), C = getFileName(h);
6003
6003
  return /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-start gap-x-3", children: [
@@ -6162,11 +6162,11 @@ const DataBindingSelector = ({
6162
6162
  n(`{{${m}}}`, {}, r);
6163
6163
  return;
6164
6164
  }
6165
- const h = (C) => /[.,!?;:]/.test(C), x = (C, k, w) => {
6165
+ const h = (C) => /[.,!?;:]/.test(C), x = (C, k, v) => {
6166
6166
  let A = "", B = "";
6167
- const _ = k > 0 ? C[k - 1] : "", S = k < C.length ? C[k] : "";
6168
- return k > 0 && (_ === "." || !h(_) && _ !== " ") && (A = " "), k < C.length && !h(S) && S !== " " && (B = " "), {
6169
- text: A + w + B,
6167
+ const _ = k > 0 ? C[k - 1] : "", w = k < C.length ? C[k] : "";
6168
+ return k > 0 && (_ === "." || !h(_) && _ !== " ") && (A = " "), k < C.length && !h(w) && w !== " " && (B = " "), {
6169
+ text: A + v + B,
6170
6170
  prefixLength: A.length,
6171
6171
  suffixLength: B.length
6172
6172
  };
@@ -6178,27 +6178,27 @@ const DataBindingSelector = ({
6178
6178
  if (C) {
6179
6179
  const k = `{{${m}}}`;
6180
6180
  C.commands.focus();
6181
- const { from: w, to: A } = C.state.selection;
6182
- if (w !== A)
6181
+ const { from: v, to: A } = C.state.selection;
6182
+ if (v !== A)
6183
6183
  C.chain().deleteSelection().insertContent(k).run();
6184
6184
  else {
6185
- const { state: _ } = C, S = _.selection.from, E = _.doc.textBetween(Math.max(0, S - 1), S), v = _.doc.textBetween(S, Math.min(S + 1, _.doc.content.size));
6185
+ const { state: _ } = C, w = _.selection.from, E = _.doc.textBetween(Math.max(0, w - 1), w), S = _.doc.textBetween(w, Math.min(w + 1, _.doc.content.size));
6186
6186
  let j = "";
6187
- S > 0 && E !== " " && !h(E) && (j = " ");
6187
+ w > 0 && E !== " " && !h(E) && (j = " ");
6188
6188
  let N = "";
6189
- v && v !== " " && !h(v) && (N = " "), C.chain().insertContent(j + k + N).run();
6189
+ S && S !== " " && !h(S) && (N = " "), C.chain().insertContent(j + k + N).run();
6190
6190
  }
6191
6191
  setTimeout(() => n(C.getHTML(), {}, r), 100);
6192
6192
  return;
6193
6193
  }
6194
6194
  } else {
6195
- const C = b, k = C.selectionStart || 0, w = C.value || "", A = C.selectionEnd || k;
6195
+ const C = b, k = C.selectionStart || 0, v = C.value || "", A = C.selectionEnd || k;
6196
6196
  if (A > k) {
6197
- const v = `{{${m}}}`, { text: j } = x(w, k, v), N = w.slice(0, k) + j + w.slice(A);
6197
+ const S = `{{${m}}}`, { text: j } = x(v, k, S), N = v.slice(0, k) + j + v.slice(A);
6198
6198
  n(N, {}, r);
6199
6199
  return;
6200
6200
  }
6201
- const _ = `{{${m}}}`, { text: S } = x(w, k, _), E = w.slice(0, k) + S + w.slice(k);
6201
+ const _ = `{{${m}}}`, { text: w } = x(v, k, _), E = v.slice(0, k) + w + v.slice(k);
6202
6202
  n(E, {}, r);
6203
6203
  }
6204
6204
  },
@@ -6221,67 +6221,67 @@ const DataBindingSelector = ({
6221
6221
  onChange: r
6222
6222
  }) => {
6223
6223
  var E;
6224
- const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (v, j) => []), [l, c] = useState(!1), [d, p] = useState(!1), [u, 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 === u)) == null ? void 0 : E.name;
6224
+ const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (S, j) => []), [l, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, f] = useState(""), [h, x] = useState([]), [b, y] = useState(-1), C = useRef(null), k = (E = n == null ? void 0 : n.find((S) => S.key === u)) == null ? void 0 : E.name;
6225
6225
  useEffect(() => {
6226
6226
  if (f(""), x([]), y(-1), p(!1), !o || l || !startsWith(o, "pageType:")) return;
6227
- const v = split(o, ":"), j = get(v, 1, "page") || "page";
6227
+ const S = split(o, ":"), j = get(S, 1, "page") || "page";
6228
6228
  g(j), (async () => {
6229
- const N = await i(j, [get(v, 2, "page")]);
6229
+ const N = await i(j, [get(S, 2, "page")]);
6230
6230
  N && Array.isArray(N) && f(get(N, [0, "name"], ""));
6231
6231
  })();
6232
6232
  }, [o]);
6233
- const w = useDebouncedCallback(
6234
- async (v) => {
6235
- if (isEmpty(v))
6233
+ const v = useDebouncedCallback(
6234
+ async (S) => {
6235
+ if (isEmpty(S))
6236
6236
  x([]);
6237
6237
  else {
6238
- const j = await i(u, v);
6238
+ const j = await i(u, S);
6239
6239
  x(j);
6240
6240
  }
6241
6241
  c(!1), y(-1);
6242
6242
  },
6243
6243
  [u],
6244
6244
  300
6245
- ), A = (v) => {
6246
- const j = ["pageType", u, v.id];
6247
- j[1] && (r(j.join(":")), f(v.name), p(!1), x([]), y(-1));
6248
- }, B = (v) => {
6249
- switch (v.key) {
6245
+ ), A = (S) => {
6246
+ const j = ["pageType", u, S.id];
6247
+ j[1] && (r(j.join(":")), f(S.name), p(!1), x([]), y(-1));
6248
+ }, B = (S) => {
6249
+ switch (S.key) {
6250
6250
  case "ArrowDown":
6251
- v.preventDefault(), y((j) => j < h.length - 1 ? j + 1 : j);
6251
+ S.preventDefault(), y((j) => j < h.length - 1 ? j + 1 : j);
6252
6252
  break;
6253
6253
  case "ArrowUp":
6254
- v.preventDefault(), y((j) => j > 0 ? j - 1 : j);
6254
+ S.preventDefault(), y((j) => j > 0 ? j - 1 : j);
6255
6255
  break;
6256
6256
  case "Enter":
6257
- if (v.preventDefault(), h.length === 0) return;
6257
+ if (S.preventDefault(), h.length === 0) return;
6258
6258
  b >= 0 && A(h[b]);
6259
6259
  break;
6260
6260
  case "Escape":
6261
- v.preventDefault(), _();
6261
+ S.preventDefault(), _();
6262
6262
  break;
6263
6263
  }
6264
6264
  };
6265
6265
  useEffect(() => {
6266
6266
  if (b >= 0 && C.current) {
6267
- const v = C.current.children[b];
6268
- v == null || v.scrollIntoView({ block: "nearest" });
6267
+ const S = C.current.children[b];
6268
+ S == null || S.scrollIntoView({ block: "nearest" });
6269
6269
  }
6270
6270
  }, [b]);
6271
6271
  const _ = () => {
6272
6272
  f(""), x([]), y(-1), p(!1), r("");
6273
- }, S = (v) => {
6274
- f(v), p(!isEmpty(v)), c(!0), w(v);
6273
+ }, w = (S) => {
6274
+ f(S), p(!isEmpty(S)), c(!0), v(S);
6275
6275
  };
6276
6276
  return /* @__PURE__ */ jsxs("div", { children: [
6277
- /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (v) => g(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsx("option", { value: v.key, children: v.name }, v.key)) }),
6277
+ /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (S) => g(S.target.value), children: map(n, (S) => /* @__PURE__ */ jsx("option", { value: S.key, children: S.name }, S.key)) }),
6278
6278
  u && /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 flex items-center", children: [
6279
6279
  /* @__PURE__ */ jsx(
6280
6280
  "input",
6281
6281
  {
6282
6282
  type: "text",
6283
6283
  value: m,
6284
- onChange: (v) => S(v.target.value),
6284
+ onChange: (S) => w(S.target.value),
6285
6285
  onKeyDown: B,
6286
6286
  placeholder: a(`Search ${k ?? ""}`),
6287
6287
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
@@ -6297,22 +6297,22 @@ const DataBindingSelector = ({
6297
6297
  ' "',
6298
6298
  m,
6299
6299
  '"'
6300
- ] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(h == null ? void 0 : h.slice(0, 20), (v, j) => /* @__PURE__ */ jsxs(
6300
+ ] }) : /* @__PURE__ */ jsx("ul", { ref: C, children: map(h == null ? void 0 : h.slice(0, 20), (S, j) => /* @__PURE__ */ jsxs(
6301
6301
  "li",
6302
6302
  {
6303
- onClick: () => A(v),
6304
- 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"}`,
6303
+ onClick: () => A(S),
6304
+ className: `cursor-pointer p-2 text-xs ${o != null && o.includes(S.id) ? "bg-blue-200" : j === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
6305
6305
  children: [
6306
- v.name,
6306
+ S.name,
6307
6307
  " ",
6308
- v.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
6308
+ S.slug && /* @__PURE__ */ jsxs("small", { className: "font-light text-gray-500", children: [
6309
6309
  "( ",
6310
- v.slug,
6310
+ S.slug,
6311
6311
  " )"
6312
6312
  ] })
6313
6313
  ]
6314
6314
  },
6315
- v.id
6315
+ S.id
6316
6316
  )) }) })
6317
6317
  ] });
6318
6318
  }, LinkField = ({ schema: o, formData: n, onChange: r, name: a }) => {
@@ -6406,7 +6406,7 @@ const DataBindingSelector = ({
6406
6406
  ]
6407
6407
  }
6408
6408
  ) });
6409
- }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-CzmTpyXP.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: i, onBlur: l }) => {
6409
+ }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-DwKI9icC.js")), RichTextEditorFieldComp = ({ blockId: o, id: n, placeholder: r, value: a, onChange: i, onBlur: l }) => {
6410
6410
  const c = useRef(null), [d, p] = useState(!1), u = useRTEditor({
6411
6411
  blockId: o,
6412
6412
  value: a,
@@ -6655,9 +6655,9 @@ const DataBindingSelector = ({
6655
6655
  const { id: n, classNames: r, label: a, children: i, errors: l, help: c, hidden: d, required: p, schema: u, formData: g, onChange: m } = o, { selectedLang: f, fallbackLang: h, languages: x } = useLanguages(), b = useMemo(
6656
6656
  () => isEmpty(x) ? "" : isEmpty(f) ? h : f,
6657
6657
  [x, f, h]
6658
- ), y = useMemo(() => get(LANGUAGES, b, b), [b]), C = usePageExternalData(), k = useSelectedBlock(), w = useRegisteredChaiBlocks(), A = useMemo(
6659
- () => get(w, [k == null ? void 0 : k._type, "i18nProps"], []),
6660
- [w, k == null ? void 0 : k._type]
6658
+ ), y = useMemo(() => get(LANGUAGES, b, b), [b]), C = usePageExternalData(), k = useSelectedBlock(), v = useRegisteredChaiBlocks(), A = useMemo(
6659
+ () => get(v, [k == null ? void 0 : k._type, "i18nProps"], []),
6660
+ [v, k == null ? void 0 : k._type]
6661
6661
  ), [B, _] = useState(null);
6662
6662
  if (d)
6663
6663
  return null;
@@ -6699,7 +6699,7 @@ const DataBindingSelector = ({
6699
6699
  ] })
6700
6700
  ] });
6701
6701
  }
6702
- const v = n.replace("root.", ""), j = A.includes(v) && !isEmpty(f) && isEmpty(g);
6702
+ const S = n.replace("root.", ""), j = A.includes(S) && !isEmpty(f) && isEmpty(g);
6703
6703
  return /* @__PURE__ */ jsxs("div", { className: r, children: [
6704
6704
  u.title && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
6705
6705
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -6857,11 +6857,11 @@ const DataBindingSelector = ({
6857
6857
  }), a;
6858
6858
  };
6859
6859
  function BlockSettings() {
6860
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), i = getRegisteredChaiBlock(n == null ? void 0 : n._type), l = formDataWithSelectedLang(n, o, i), [c, d] = useState(l), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), f = formDataWithSelectedLang(g, o, m), h = ({ formData: B }, _, S) => {
6861
- _ && (c == null ? void 0 : c._id) === n._id && a([n._id], { [_]: get(B, _) }, S);
6860
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), i = getRegisteredChaiBlock(n == null ? void 0 : n._type), l = formDataWithSelectedLang(n, o, i), [c, d] = useState(l), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), f = formDataWithSelectedLang(g, o, m), h = ({ formData: B }, _, w) => {
6861
+ _ && (c == null ? void 0 : c._id) === n._id && a([n._id], { [_]: get(B, _) }, w);
6862
6862
  }, x = useCallback(
6863
- debounce(({ formData: B }, _, S) => {
6864
- h({ formData: B }, _, S), d(B);
6863
+ debounce(({ formData: B }, _, w) => {
6864
+ h({ formData: B }, _, w), d(B);
6865
6865
  }, 1500),
6866
6866
  [n == null ? void 0 : n._id, o]
6867
6867
  ), b = ({ formData: B }, _) => {
@@ -6873,20 +6873,20 @@ function BlockSettings() {
6873
6873
  if (!B)
6874
6874
  return { schema: {}, uiSchema: {} };
6875
6875
  try {
6876
- const { schema: _, uiSchema: S } = getBlockFormSchemas(B);
6876
+ const { schema: _, uiSchema: w } = getBlockFormSchemas(B);
6877
6877
  if (B === "Repeater") {
6878
6878
  const E = get(n, "repeaterItems", "");
6879
- startsWith(E, `{{${COLLECTION_PREFIX}`) ? (set(S, "filter", { "ui:widget": "collectionSelect" }), set(S, "sort", { "ui:widget": "collectionSelect" })) : (set(S, "filter", { "ui:widget": "hidden" }), set(S, "sort", { "ui:widget": "hidden" }));
6879
+ 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" }));
6880
6880
  }
6881
- return { schema: _, uiSchema: S };
6881
+ return { schema: _, uiSchema: w };
6882
6882
  } catch {
6883
6883
  return { schema: {}, uiSchema: {} };
6884
6884
  }
6885
- }, [n]), { wrapperSchema: w, wrapperUiSchema: A } = useMemo(() => {
6885
+ }, [n]), { wrapperSchema: v, wrapperUiSchema: A } = useMemo(() => {
6886
6886
  if (!g || !(g != null && g._type))
6887
6887
  return { wrapperSchema: {}, wrapperUiSchema: {} };
6888
- const B = g == null ? void 0 : g._type, { schema: _ = {}, uiSchema: S = {} } = getBlockFormSchemas(B);
6889
- return { wrapperSchema: _, wrapperUiSchema: S };
6888
+ const B = g == null ? void 0 : g._type, { schema: _ = {}, uiSchema: w = {} } = getBlockFormSchemas(B);
6889
+ return { wrapperSchema: _, wrapperUiSchema: w };
6890
6890
  }, [g]);
6891
6891
  return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
6892
6892
  !isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
@@ -6914,7 +6914,7 @@ function BlockSettings() {
6914
6914
  blockId: g == null ? void 0 : g._id,
6915
6915
  onChange: y,
6916
6916
  formData: f,
6917
- schema: w,
6917
+ schema: v,
6918
6918
  uiSchema: A
6919
6919
  }
6920
6920
  ) })
@@ -7137,17 +7137,17 @@ const BlockStylingProps = () => {
7137
7137
  },
7138
7138
  a
7139
7139
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
7140
- const [n, r] = useState(!1), [a, i] = useState(""), { currentClass: l, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, f] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [h, x] = useState(!1), [b, y] = useState(""), [C, k] = useState(!1), [w, A] = useState(!1);
7140
+ const [n, r] = useState(!1), [a, i] = useState(""), { currentClass: l, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, f] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [h, x] = useState(!1), [b, y] = useState(""), [C, k] = useState(!1), [v, A] = useState(!1);
7141
7141
  useEffect(() => {
7142
- const { value: v, unit: j } = getClassValueAndUnit(l);
7142
+ const { value: S, unit: j } = getClassValueAndUnit(l);
7143
7143
  if (j === "") {
7144
- i(v), f(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
7144
+ i(S), f(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
7145
7145
  return;
7146
7146
  }
7147
- f(j), i(j === "class" || isEmpty(v) ? "" : v);
7147
+ f(j), i(j === "class" || isEmpty(S) ? "" : S);
7148
7148
  }, [l, p, u]);
7149
- const B = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), _ = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), S = useCallback(
7150
- (v = !1) => {
7149
+ const B = useThrottledCallback((S) => c(S), [c], THROTTLE_TIME), _ = useThrottledCallback((S) => c(S, !1), [c], THROTTLE_TIME), w = useCallback(
7150
+ (S = !1) => {
7151
7151
  const j = getUserInputValues(`${a}`, u);
7152
7152
  if (get(j, "error", !1)) {
7153
7153
  x(!0);
@@ -7161,23 +7161,23 @@ const BlockStylingProps = () => {
7161
7161
  if (get(j, "value") === "")
7162
7162
  return;
7163
7163
  const D = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7164
- v ? _(D) : B(D);
7164
+ S ? _(D) : B(D);
7165
7165
  },
7166
7166
  [B, _, a, m, d, u]
7167
7167
  ), E = useCallback(
7168
- (v) => {
7168
+ (S) => {
7169
7169
  const j = getUserInputValues(`${a}`, u);
7170
7170
  if (get(j, "error", !1)) {
7171
7171
  x(!0);
7172
7172
  return;
7173
7173
  }
7174
- if (v === "auto" || v === "none") {
7175
- B(`${d}${v}`);
7174
+ if (S === "auto" || S === "none") {
7175
+ B(`${d}${S}`);
7176
7176
  return;
7177
7177
  }
7178
7178
  if (get(j, "value") === "")
7179
7179
  return;
7180
- const N = get(j, "unit") !== "" ? get(j, "unit") : v, D = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7180
+ const N = get(j, "unit") !== "" ? get(j, "unit") : S, D = `${get(j, "value", "").startsWith("-") ? "-" : ""}${d}[${get(j, "value", "").replace("-", "")}${N === "-" ? "" : N}]`;
7181
7181
  B(D);
7182
7182
  },
7183
7183
  [B, a, d, u]
@@ -7201,29 +7201,29 @@ const BlockStylingProps = () => {
7201
7201
  "input",
7202
7202
  {
7203
7203
  readOnly: m === "class",
7204
- onKeyPress: (v) => {
7205
- v.key === "Enter" && S();
7204
+ onKeyPress: (S) => {
7205
+ S.key === "Enter" && w();
7206
7206
  },
7207
- onKeyDown: (v) => {
7208
- if (v.keyCode !== 38 && v.keyCode !== 40)
7207
+ onKeyDown: (S) => {
7208
+ if (S.keyCode !== 38 && S.keyCode !== 40)
7209
7209
  return;
7210
- v.preventDefault(), A(!0);
7211
- const j = parseInt$1(v.target.value);
7210
+ S.preventDefault(), A(!0);
7211
+ const j = parseInt$1(S.target.value);
7212
7212
  let N = isNaN$1(j) ? 0 : j;
7213
- v.keyCode === 38 && (N += 1), v.keyCode === 40 && (N -= 1);
7214
- const I = `${N}`, R = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
7215
- _(R);
7213
+ S.keyCode === 38 && (N += 1), S.keyCode === 40 && (N -= 1);
7214
+ const I = `${N}`, P = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
7215
+ _(P);
7216
7216
  },
7217
- onKeyUp: (v) => {
7218
- w && (v.preventDefault(), A(!1));
7217
+ onKeyUp: (S) => {
7218
+ v && (S.preventDefault(), A(!1));
7219
7219
  },
7220
- onBlur: () => S(),
7221
- onChange: (v) => {
7222
- x(!1), i(v.target.value);
7220
+ onBlur: () => w(),
7221
+ onChange: (S) => {
7222
+ x(!1), i(S.target.value);
7223
7223
  },
7224
- onClick: (v) => {
7224
+ onClick: (S) => {
7225
7225
  var j;
7226
- (j = v == null ? void 0 : v.target) == null || j.select(), r(!1);
7226
+ (j = S == null ? void 0 : S.target) == null || j.select(), r(!1);
7227
7227
  },
7228
7228
  value: C ? b : a,
7229
7229
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
@@ -7250,8 +7250,8 @@ const BlockStylingProps = () => {
7250
7250
  {
7251
7251
  units: u,
7252
7252
  current: m,
7253
- onSelect: (v) => {
7254
- r(!1), f(v), E(v);
7253
+ onSelect: (S) => {
7254
+ r(!1), f(S), E(S);
7255
7255
  }
7256
7256
  }
7257
7257
  ) })
@@ -7261,17 +7261,17 @@ const BlockStylingProps = () => {
7261
7261
  DragStyleButton,
7262
7262
  {
7263
7263
  onDragStart: () => k(!0),
7264
- onDragEnd: (v) => {
7265
- if (y(() => ""), k(!1), isEmpty(v))
7264
+ onDragEnd: (S) => {
7265
+ if (y(() => ""), k(!1), isEmpty(S))
7266
7266
  return;
7267
- const j = `${v}`, I = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${m === "-" ? "" : m}]`;
7267
+ const j = `${S}`, I = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${m === "-" ? "" : m}]`;
7268
7268
  B(I);
7269
7269
  },
7270
- onDrag: (v) => {
7271
- if (isEmpty(v))
7270
+ onDrag: (S) => {
7271
+ if (isEmpty(S))
7272
7272
  return;
7273
- y(v);
7274
- const j = `${v}`, I = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${m === "-" ? "" : m}]`;
7273
+ y(S);
7274
+ const j = `${S}`, I = `${j.startsWith("-") ? "-" : ""}${d}[${j.replace("-", "")}${m === "-" ? "" : m}]`;
7275
7275
  _(I);
7276
7276
  },
7277
7277
  currentValue: a,
@@ -7736,11 +7736,11 @@ const COLOR_PROP = {
7736
7736
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
7737
7737
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: i, onEmitChange: l = () => {
7738
7738
  }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(i), f = useAddClassesToBlocks(), h = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), b = useMemo(() => get(m, "fullCls", ""), [m]), y = useCallback(
7739
- (_, S = !0) => {
7739
+ (_, w = !0) => {
7740
7740
  const E = { dark: p, mq: g, mod: u, cls: _, property: i, fullCls: "" };
7741
7741
  (p || u !== "") && (E.mq = "xs");
7742
- const v = generateFullClsName(E);
7743
- f(x, [v], S);
7742
+ const S = generateFullClsName(E);
7743
+ f(x, [S], w);
7744
7744
  },
7745
7745
  [x, p, g, u, i, f]
7746
7746
  ), C = useCallback(() => {
@@ -7749,9 +7749,9 @@ const COLOR_PROP = {
7749
7749
  useEffect(() => {
7750
7750
  l(k, m);
7751
7751
  }, [k, l, m]);
7752
- const [, , w] = useScreenSizeWidth(), A = useCallback(
7752
+ const [, , v] = useScreenSizeWidth(), A = useCallback(
7753
7753
  (_) => {
7754
- w({
7754
+ v({
7755
7755
  xs: 400,
7756
7756
  sm: 640,
7757
7757
  md: 800,
@@ -7760,7 +7760,7 @@ const COLOR_PROP = {
7760
7760
  "2xl": 1920
7761
7761
  }[_]);
7762
7762
  },
7763
- [w]
7763
+ [v]
7764
7764
  ), B = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
7765
7765
  return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: k, canReset: m && B, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
7766
7766
  /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !B ? "text-foreground" : ""}`, children: n(a) }) }),
@@ -8005,7 +8005,7 @@ const COLOR_PROP = {
8005
8005
  activeButtonClass: i = ""
8006
8006
  }) => {
8007
8007
  const [l, , c] = useScreenSizeWidth(), [d, p] = useCanvasDisplayWidth(), [u, g] = useSelectedBreakpoints(), m = u, f = g, { t: h } = useTranslation(), x = useBuilderProp("breakpoints", WEB_BREAKPOINTS), b = (k) => {
8008
- m.includes(k) ? m.length > 2 && f(m.filter((w) => w !== k)) : f((w) => [...w, k]);
8008
+ m.includes(k) ? m.length > 2 && f(m.filter((v) => v !== k)) : f((v) => [...v, k]);
8009
8009
  }, y = (k) => {
8010
8010
  n || c(k), p(k);
8011
8011
  }, C = getBreakpointValue(n ? d : l).toLowerCase();
@@ -8047,7 +8047,7 @@ const COLOR_PROP = {
8047
8047
  disabled: k.breakpoint === "xs",
8048
8048
  onCheckedChange: () => b(toUpper(k.breakpoint)),
8049
8049
  checked: includes(m, toUpper(k.breakpoint)),
8050
- onSelect: (w) => w.preventDefault(),
8050
+ onSelect: (v) => v.preventDefault(),
8051
8051
  children: h(k.title)
8052
8052
  },
8053
8053
  k.breakpoint
@@ -8079,31 +8079,31 @@ function BreakpointSelector() {
8079
8079
  const DesignTokensIcon = ({ className: o = "" }) => /* @__PURE__ */ jsx(FontStyleIcon, { className: o });
8080
8080
  function ManualClasses() {
8081
8081
  var O;
8082
- const o = useRef(null), [n, r] = useState(""), [a, i] = useState(-1), [, l] = useRightPanel(), c = useFuseSearch(), { t: d } = useTranslation(), [p] = useSelectedStylingBlocks(), u = useSelectedBlock(), g = useAddClassesToBlocks(), m = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), [h, x] = useState(""), b = useAtomValue$1(chaiDesignTokensAtom), y = (O = first(p)) == null ? void 0 : O.prop, { classes: C } = getSplitChaiClasses(get(u, y, "")), k = C.split(" ").filter((L) => !isEmpty(L)), w = useMemo(() => [...k].sort((L, T) => {
8083
- const M = L.startsWith("dt-"), H = T.startsWith("dt-");
8082
+ const o = useRef(null), [n, r] = useState(""), [a, i] = useState(-1), [, l] = useRightPanel(), c = useFuseSearch(), { t: d } = useTranslation(), [p] = useSelectedStylingBlocks(), u = useSelectedBlock(), g = useAddClassesToBlocks(), m = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), [h, x] = useState(""), b = useAtomValue$1(chaiDesignTokensAtom), y = (O = first(p)) == null ? void 0 : O.prop, { classes: C } = getSplitChaiClasses(get(u, y, "")), k = C.split(" ").filter((L) => !isEmpty(L)), v = useMemo(() => [...k].sort((L, T) => {
8083
+ const M = L.startsWith(DESIGN_TOKEN_PREFIX), H = T.startsWith(DESIGN_TOKEN_PREFIX);
8084
8084
  return M && !H ? -1 : !M && H ? 1 : 0;
8085
8085
  }), [k]), A = useBuilderProp("flags.copyPaste", !0), B = (L) => {
8086
- if (L.startsWith("dt-")) {
8087
- const T = L.substring(3), M = b[T];
8088
- return M ? M.name : L;
8086
+ if (L.startsWith(DESIGN_TOKEN_PREFIX)) {
8087
+ const T = b[L];
8088
+ return T ? T.name : L;
8089
8089
  }
8090
8090
  return L;
8091
8091
  }, _ = (L) => {
8092
8092
  const T = Object.entries(b).find(([M, H]) => H.name === L);
8093
- return T ? `dt-${T[0]}` : L;
8094
- }, S = () => {
8093
+ return T ? `${T[0]}` : L;
8094
+ }, w = () => {
8095
8095
  const L = h.trim().replace(/ +(?= )/g, "").split(" ").map(_);
8096
8096
  g(f, L, !0), x("");
8097
- }, [E, v] = useState([]), j = useBuilderProp("flags.designTokens", !1), N = ({ value: L }) => {
8097
+ }, [E, S] = useState([]), j = useBuilderProp("flags.designTokens", !1), N = ({ value: L }) => {
8098
8098
  const T = L.trim().toLowerCase(), M = T.match(/.+:/g);
8099
8099
  let H = [], W = [];
8100
8100
  if (j && (T === "" ? W = Object.entries(b).map(([V, U]) => ({
8101
8101
  name: U.name,
8102
- id: `dt-${V}`,
8102
+ id: `${V}`,
8103
8103
  isDesignToken: !0
8104
8104
  })) : W = Object.entries(b).filter(([V, U]) => U.name.toLowerCase().includes(T)).map(([V, U]) => ({
8105
8105
  name: U.name,
8106
- id: `dt-${V}`,
8106
+ id: `${V}`,
8107
8107
  isDesignToken: !0
8108
8108
  }))), M && M.length > 0) {
8109
8109
  const [V] = M, U = T.replace(V, "");
@@ -8114,13 +8114,13 @@ function ManualClasses() {
8114
8114
  } else
8115
8115
  H = c.search(T);
8116
8116
  const z = [...W, ...map(H, "item")];
8117
- return v(z);
8117
+ return S(z);
8118
8118
  }, I = () => {
8119
- v([]);
8120
- }, D = (L) => L.name, R = (L) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md p-1", children: [
8119
+ S([]);
8120
+ }, D = (L) => L.name, P = (L) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md p-1", children: [
8121
8121
  L.isDesignToken && /* @__PURE__ */ jsx(DesignTokensIcon, { className: "h-4 w-4 text-gray-600" }),
8122
8122
  /* @__PURE__ */ jsx("span", { children: L.name })
8123
- ] }), P = useMemo(
8123
+ ] }), R = useMemo(
8124
8124
  () => ({
8125
8125
  ref: o,
8126
8126
  autoComplete: "off",
@@ -8135,12 +8135,12 @@ function ManualClasses() {
8135
8135
  }, 0);
8136
8136
  },
8137
8137
  onKeyDown: (L) => {
8138
- L.key === "Enter" && h.trim() !== "" && S();
8138
+ L.key === "Enter" && h.trim() !== "" && E.length === 0 && w();
8139
8139
  },
8140
8140
  onChange: (L, { newValue: T }) => x(T),
8141
8141
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
8142
8142
  }),
8143
- [h, d, o]
8143
+ [h, d, o, E.length]
8144
8144
  ), $ = (L) => {
8145
8145
  const T = n.trim().replace(/ +(?= )/g, "").split(" ").map(_);
8146
8146
  m(f, [L]), g(f, T, !0), r(""), i(-1);
@@ -8170,8 +8170,13 @@ function ManualClasses() {
8170
8170
  onSuggestionsFetchRequested: N,
8171
8171
  onSuggestionsClearRequested: I,
8172
8172
  getSuggestionValue: D,
8173
- renderSuggestion: R,
8174
- inputProps: P,
8173
+ renderSuggestion: P,
8174
+ inputProps: R,
8175
+ highlightFirstSuggestion: !0,
8176
+ onSuggestionSelected: (L, { suggestionValue: T }) => {
8177
+ const M = _(T);
8178
+ g(f, [M], !0), x("");
8179
+ },
8175
8180
  containerProps: {
8176
8181
  className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
8177
8182
  },
@@ -8187,14 +8192,14 @@ function ManualClasses() {
8187
8192
  {
8188
8193
  variant: "outline",
8189
8194
  className: "h-6 border-border",
8190
- onClick: S,
8195
+ onClick: w,
8191
8196
  disabled: h.trim() === "",
8192
8197
  size: "sm",
8193
8198
  children: /* @__PURE__ */ jsx(PlusIcon, {})
8194
8199
  }
8195
8200
  )
8196
8201
  ] }),
8197
- /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: w.map(
8202
+ /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: v.map(
8198
8203
  (L, T) => a === T ? /* @__PURE__ */ jsx(
8199
8204
  "input",
8200
8205
  {
@@ -8233,7 +8238,7 @@ function ManualClasses() {
8233
8238
  className: "hidden h-max w-3.5 cursor-pointer rounded bg-gray-100 p-0.5 text-red-500 hover:bg-gray-50 group-hover:block"
8234
8239
  }
8235
8240
  ),
8236
- L.startsWith("dt-") ? /* @__PURE__ */ jsx(DesignTokensIcon, { className: "text-[rgba(55, 65, 81, 0.4)] h-3.5 w-3.5 group-hover:hidden" }) : /* @__PURE__ */ jsxs(
8241
+ L.startsWith(DESIGN_TOKEN_PREFIX) ? /* @__PURE__ */ jsx(DesignTokensIcon, { className: "text-[rgba(55, 65, 81, 0.4)] h-3.5 w-3.5 group-hover:hidden" }) : /* @__PURE__ */ jsxs(
8237
8242
  "svg",
8238
8243
  {
8239
8244
  className: "h-3.5 w-3.5 group-hover:hidden",
@@ -8590,7 +8595,7 @@ const registerChaiLibrary = (o, n) => {
8590
8595
  ]
8591
8596
  };
8592
8597
  } else if (n) {
8593
- const w = typeof n == "function" ? await n() : n, A = getBlocksFromHTML(w);
8598
+ const v = typeof n == "function" ? await n() : n, A = getBlocksFromHTML(v);
8594
8599
  if (isEmpty(A)) return;
8595
8600
  k = {
8596
8601
  type: "Box",
@@ -8598,16 +8603,16 @@ const registerChaiLibrary = (o, n) => {
8598
8603
  name: get(A, "0._type", "Block")
8599
8604
  };
8600
8605
  } else if (r) {
8601
- const w = typeof r == "function" ? await r() : r;
8602
- if (isEmpty(w)) return;
8606
+ const v = typeof r == "function" ? await r() : r;
8607
+ if (isEmpty(v)) return;
8603
8608
  k = {
8604
8609
  type: "Box",
8605
- blocks: w,
8606
- name: get(w, "0._type", "Block")
8610
+ blocks: v,
8611
+ name: get(v, "0._type", "Block")
8607
8612
  };
8608
8613
  } else if (o) {
8609
- const w = typeof o == "function" ? await o() : o;
8610
- k = typeof w == "object" ? omit(w, ["component", "icon"]) : w;
8614
+ const v = typeof o == "function" ? await o() : o;
8615
+ k = typeof v == "object" ? omit(v, ["component", "icon"]) : v;
8611
8616
  }
8612
8617
  if (!k) return;
8613
8618
  u(C, k, !0), setTimeout(() => {
@@ -8727,13 +8732,13 @@ const BlockCard = ({
8727
8732
  return;
8728
8733
  }
8729
8734
  }, [y, C]);
8730
- const w = get(y, C, []), A = useRef(null), { t: B } = useTranslation(), _ = useRef(null);
8735
+ const v = get(y, C, []), A = useRef(null), { t: B } = useTranslation(), _ = useRef(null);
8731
8736
  useEffect(() => {
8732
8737
  var I;
8733
8738
  const N = (I = _.current) == null ? void 0 : I.querySelector("[data-radix-scroll-area-viewport]");
8734
8739
  N && N.scrollTo({ top: 0, behavior: "smooth" });
8735
8740
  }, [c, C]);
8736
- const S = (N) => {
8741
+ const w = (N) => {
8737
8742
  A.current && (clearTimeout(A.current), A.current = null), A.current = setTimeout(() => {
8738
8743
  A.current && k(N);
8739
8744
  }, 400);
@@ -8745,7 +8750,7 @@ const BlockCard = ({
8745
8750
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
8746
8751
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
8747
8752
  ] });
8748
- const v = filter(w, (N, I) => I % 2 === 0), j = filter(w, (N, I) => I % 2 === 1);
8753
+ const S = filter(v, (N, I) => I % 2 === 0), j = filter(v, (N, I) => I % 2 === 1);
8749
8754
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full flex-col", children: [
8750
8755
  /* @__PURE__ */ jsx(SearchInput, { value: g, setValue: m }),
8751
8756
  /* @__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: [
@@ -8774,7 +8779,7 @@ const BlockCard = ({
8774
8779
  ] }) : map(y, (N, I) => /* @__PURE__ */ jsxs(
8775
8780
  "div",
8776
8781
  {
8777
- onMouseEnter: () => S(I),
8782
+ onMouseEnter: () => w(I),
8778
8783
  onMouseLeave: () => clearTimeout(A.current),
8779
8784
  role: "button",
8780
8785
  onClick: () => k(I),
@@ -8802,8 +8807,8 @@ const BlockCard = ({
8802
8807
  onMouseEnter: () => A.current ? clearTimeout(A.current) : null,
8803
8808
  className: "z-10 flex h-full max-h-full w-full flex-col gap-2 transition-all ease-linear",
8804
8809
  children: [
8805
- 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: B("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: `grid w-full gap-2 ${r ? "grid-cols-1 pb-20" : "grid-cols-2 px-2"}`, children: [
8806
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: v.map((N, I) => /* @__PURE__ */ jsx(
8810
+ isEmpty(v) && !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: B("No blocks found in this group") }) }) : /* @__PURE__ */ jsxs("div", { className: `grid w-full gap-2 ${r ? "grid-cols-1 pb-20" : "grid-cols-2 px-2"}`, children: [
8811
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: S.map((N, I) => /* @__PURE__ */ jsx(
8807
8812
  BlockCard,
8808
8813
  {
8809
8814
  parentId: o,
@@ -8863,14 +8868,14 @@ const BlockCard = ({
8863
8868
  }), m(!0);
8864
8869
  else if (!l && Object.keys(i || {}).length > 0) {
8865
8870
  const h = Object.entries(i).map(([b, y]) => {
8866
- const C = y, k = C.type || "partial", w = formatReadableName(k);
8871
+ const C = y, k = C.type || "partial", v = formatReadableName(k);
8867
8872
  return {
8868
8873
  type: "PartialBlock",
8869
8874
  // Set the type to PartialBlock
8870
8875
  label: formatReadableName(C.name || b),
8871
8876
  description: C.description || "",
8872
8877
  icon: FrameIcon,
8873
- group: w,
8878
+ group: v,
8874
8879
  // Use formatted type as group
8875
8880
  category: "partial",
8876
8881
  partialBlockId: b,
@@ -8948,7 +8953,7 @@ const BlockCard = ({
8948
8953
  }, 500), () => {
8949
8954
  C.current && C.current.cancel();
8950
8955
  }), []);
8951
- const w = useCallback((I) => {
8956
+ const v = useCallback((I) => {
8952
8957
  y(I), C.current && C.current(I);
8953
8958
  }, []), A = useCallback(() => {
8954
8959
  y(null), C.current && C.current.cancel();
@@ -8957,20 +8962,20 @@ const BlockCard = ({
8957
8962
  }, []), _ = useMemo(
8958
8963
  () => p ? values(n).filter(
8959
8964
  (I) => {
8960
- var D, R;
8961
- return (((D = I.label) == null ? void 0 : D.toLowerCase()) + " " + ((R = I.type) == null ? void 0 : R.toLowerCase())).includes(p.toLowerCase());
8965
+ var D, P;
8966
+ return (((D = I.label) == null ? void 0 : D.toLowerCase()) + " " + ((P = I.type) == null ? void 0 : P.toLowerCase())).includes(p.toLowerCase());
8962
8967
  }
8963
8968
  ) : n,
8964
8969
  [n, p]
8965
- ), S = useMemo(
8970
+ ), w = useMemo(
8966
8971
  () => p ? o.filter(
8967
8972
  (I) => reject(filter(values(_), { group: I }), { hidden: !0 }).length > 0
8968
8973
  ) : o.filter((I) => reject(filter(values(n), { group: I }), { hidden: !0 }).length > 0),
8969
8974
  [n, _, o, p]
8970
8975
  ), E = useMemo(
8971
- () => sortBy(S, (I) => CORE_GROUPS.indexOf(I) === -1 ? 99 : CORE_GROUPS.indexOf(I)),
8972
- [S]
8973
- ), v = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), j = useMemo(() => h === "all" ? E : [h], [E, h]);
8976
+ () => sortBy(w, (I) => CORE_GROUPS.indexOf(I) === -1 ? 99 : CORE_GROUPS.indexOf(I)),
8977
+ [w]
8978
+ ), S = useMemo(() => h === "all" ? _ : filter(values(_), { group: h }), [_, h]), j = useMemo(() => h === "all" ? E : [h], [E, h]);
8974
8979
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full flex-col", children: [
8975
8980
  /* @__PURE__ */ jsx(SearchInput, { value: p, setValue: u }),
8976
8981
  /* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden pt-2", children: [
@@ -8979,7 +8984,7 @@ const BlockCard = ({
8979
8984
  "button",
8980
8985
  {
8981
8986
  onClick: () => B("all"),
8982
- onMouseEnter: () => w("all"),
8987
+ onMouseEnter: () => v("all"),
8983
8988
  onMouseLeave: A,
8984
8989
  className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || b === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
8985
8990
  children: c("All")
@@ -8990,7 +8995,7 @@ const BlockCard = ({
8990
8995
  "button",
8991
8996
  {
8992
8997
  onClick: () => B(I),
8993
- onMouseEnter: () => w(I),
8998
+ onMouseEnter: () => v(I),
8994
8999
  onMouseLeave: A,
8995
9000
  className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === I || b === I ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
8996
9001
  children: capitalize(c(I.toLowerCase()))
@@ -9002,7 +9007,7 @@ const BlockCard = ({
9002
9007
  "div",
9003
9008
  {
9004
9009
  className: `h-full flex-1 overflow-hidden ${!l && E.length > 0 ? "w-3/4" : "w-full"}`,
9005
- children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar h-full", children: S.length === 0 && p ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
9010
+ children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar h-full", children: w.length === 0 && p ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
9006
9011
  c("No blocks found matching"),
9007
9012
  ' "',
9008
9013
  p,
@@ -9010,7 +9015,7 @@ const BlockCard = ({
9010
9015
  ] }) }) : /* @__PURE__ */ jsx("div", { className: `${l ? "p-0" : "p-4"} space-y-6`, children: j.map((I) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
9011
9016
  /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(c(I.toLowerCase())) }),
9012
9017
  /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + i, children: reject(
9013
- h === "all" ? filter(values(v), { group: I }) : values(v),
9018
+ h === "all" ? filter(values(S), { group: I }) : values(S),
9014
9019
  { hidden: !0 }
9015
9020
  ).map((D) => /* @__PURE__ */ jsx(
9016
9021
  CoreBlock,
@@ -9497,13 +9502,13 @@ const useStructureValidation = () => {
9497
9502
  var L;
9498
9503
  const { t: a } = useTranslation(), i = useUpdateBlocksProps(), [l] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
9499
9504
  let d = null;
9500
- const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), m = useIsDragAndDropEnabled(), { id: f, data: h, isSelected: x, willReceiveDrop: b, isDragging: y, isEditing: C, handleClick: k } = o, w = useStructureValidation(), A = useMemo(() => w.getBlockErrors(f), [w, f]), B = get(h, "_show", !0), _ = (T) => {
9505
+ const p = o.children.length > 0, { highlightBlock: u, clearHighlight: g } = useBlockHighlight(), m = useIsDragAndDropEnabled(), { id: f, data: h, isSelected: x, willReceiveDrop: b, isDragging: y, isEditing: C, handleClick: k } = o, v = useStructureValidation(), A = useMemo(() => v.getBlockErrors(f), [v, f]), B = get(h, "_show", !0), _ = (T) => {
9501
9506
  T.stopPropagation(), B && o.toggle();
9502
- }, S = (T) => {
9507
+ }, w = (T) => {
9503
9508
  T.isInternal && (d = T.isOpen, T.isOpen && T.close());
9504
9509
  }, E = (T) => {
9505
9510
  T.isInternal && d !== null && (d ? T.open() : T.close(), d = null);
9506
- }, [v, j] = useAtom$1(currentAddSelection), N = () => {
9511
+ }, [S, j] = useAtom$1(currentAddSelection), N = () => {
9507
9512
  var T;
9508
9513
  I(), o.parent.isSelected || j((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
9509
9514
  }, I = () => {
@@ -9517,12 +9522,12 @@ const useStructureValidation = () => {
9517
9522
  }, 500);
9518
9523
  return () => clearTimeout(T);
9519
9524
  }, [b, o, y]);
9520
- const R = (T, M) => {
9525
+ const P = (T, M) => {
9521
9526
  const H = l.contentDocument || l.contentWindow.document, W = H.querySelector(`[data-block-id=${T}]`);
9522
9527
  W && W.setAttribute("data-drop", M);
9523
9528
  const z = W.getBoundingClientRect(), V = l.getBoundingClientRect();
9524
9529
  z.top >= V.top && z.left >= V.left && z.bottom <= V.bottom && z.right <= V.right || (H.documentElement.scrollTop = W.offsetTop - V.top);
9525
- }, P = (T) => {
9530
+ }, R = (T) => {
9526
9531
  I();
9527
9532
  const M = get(o, "parent.id");
9528
9533
  M !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: M, position: T }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: T });
@@ -9534,7 +9539,7 @@ const useStructureValidation = () => {
9534
9539
  "div",
9535
9540
  {
9536
9541
  role: "button",
9537
- onClick: () => P(-1),
9542
+ onClick: () => R(-1),
9538
9543
  className: "h-1 rounded bg-primary opacity-0 duration-200 group-hover:opacity-100",
9539
9544
  children: /* @__PURE__ */ jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-primary px-3 py-1 text-[9px] leading-tight text-white hover:bg-primary", children: [
9540
9545
  /* @__PURE__ */ jsx(PlusIcon, { className: "w-2.4 h-2.5 stroke-[5] text-white" }),
@@ -9555,23 +9560,23 @@ const useStructureValidation = () => {
9555
9560
  style: n,
9556
9561
  "data-node-id": f,
9557
9562
  ref: r,
9558
- onDragStart: () => S(o),
9563
+ onDragStart: () => w(o),
9559
9564
  onDragEnd: () => E(o),
9560
9565
  onDragOver: (T) => {
9561
- T.preventDefault(), R(f, "yes");
9566
+ T.preventDefault(), P(f, "yes");
9562
9567
  },
9563
9568
  onDragLeave: (T) => {
9564
- T.preventDefault(), R(f, "no");
9569
+ T.preventDefault(), P(f, "no");
9565
9570
  },
9566
9571
  onDrop: (T) => {
9567
- T.preventDefault(), R(f, "no");
9572
+ T.preventDefault(), P(f, "no");
9568
9573
  },
9569
9574
  children: [
9570
9575
  c(PERMISSIONS.ADD_BLOCK) && !m && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
9571
9576
  "div",
9572
9577
  {
9573
9578
  onClick: (T) => {
9574
- T.stopPropagation(), P(o.childIndex);
9579
+ T.stopPropagation(), R(o.childIndex);
9575
9580
  },
9576
9581
  onMouseEnter: N,
9577
9582
  onMouseLeave: I,
@@ -9586,7 +9591,7 @@ const useStructureValidation = () => {
9586
9591
  "group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 py-0 outline-none",
9587
9592
  x ? "bg-primary/20" : "hover:bg-primary/10",
9588
9593
  b && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
9589
- (o == null ? void 0 : o.id) === v ? "bg-primary/10" : "",
9594
+ (o == null ? void 0 : o.id) === S ? "bg-primary/10" : "",
9590
9595
  y && "opacity-20",
9591
9596
  B ? "" : "line-through opacity-50",
9592
9597
  F && x && "bg-primary/20 text-primary"
@@ -10097,24 +10102,20 @@ const useStructureValidation = () => {
10097
10102
  }
10098
10103
  }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
10099
10104
  const [n, r] = useDarkMode(), [a, i] = React.useState(""), [l, c] = React.useState(!1), d = useBuilderProp("themePresets", []), p = useBuilderProp("themePanelComponent", null), { hasPermission: u } = usePermissions(), g = useBuilderProp("flags.importTheme", !0), m = useBuilderProp("flags.darkMode", !0), f = useIncrementActionsCount();
10100
- if (d) {
10101
- const E = d.map((v) => Object.keys(v)[0]);
10102
- DEFAULT_THEME_PRESET.forEach((v) => {
10103
- const j = Object.keys(v)[0];
10104
- E.includes(j) || d.push(v);
10105
- });
10106
- }
10105
+ (!d || d.length === 0) && DEFAULT_THEME_PRESET.map((E) => {
10106
+ d.push(E);
10107
+ });
10107
10108
  const [h, x] = useTheme(), b = useThemeOptions(), { t: y } = useTranslation(), C = React.useCallback(
10108
10109
  (E) => {
10109
- const v = { ...h };
10110
- setPreviousTheme(v), x(E), f(), toast.success("Theme updated", {
10110
+ const S = { ...h };
10111
+ setPreviousTheme(S), x(E), f(), toast.success("Theme updated", {
10111
10112
  action: {
10112
10113
  label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
10113
10114
  /* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
10114
10115
  " Undo"
10115
10116
  ] }),
10116
10117
  onClick: () => {
10117
- x(v), clearPreviousTheme(), toast.dismiss();
10118
+ x(S), clearPreviousTheme(), toast.dismiss();
10118
10119
  }
10119
10120
  },
10120
10121
  closeButton: !0,
@@ -10123,21 +10124,21 @@ const useStructureValidation = () => {
10123
10124
  },
10124
10125
  [h, x, f]
10125
10126
  ), k = () => {
10126
- const E = d.find((v) => Object.keys(v)[0] === a);
10127
+ const E = d.find((S) => Object.keys(S)[0] === a);
10127
10128
  if (E) {
10128
- const v = Object.values(E)[0];
10129
- v && typeof v == "object" && "fontFamily" in v && "borderRadius" in v && "colors" in v ? (C(v), i(""), f()) : console.error("Invalid preset structure:", v);
10129
+ const S = Object.values(E)[0];
10130
+ S && typeof S == "object" && "fontFamily" in S && "borderRadius" in S && "colors" in S ? (C(S), i(""), f()) : console.error("Invalid preset structure:", S);
10130
10131
  } else
10131
10132
  console.error("Preset not found:", a);
10132
- }, w = (E) => {
10133
+ }, v = (E) => {
10133
10134
  C(E), i(""), f();
10134
10135
  }, A = useDebouncedCallback(
10135
- (E, v) => {
10136
+ (E, S) => {
10136
10137
  x(() => ({
10137
10138
  ...h,
10138
10139
  fontFamily: {
10139
10140
  ...h.fontFamily,
10140
- [E.replace(/font-/g, "")]: v
10141
+ [E.replace(/font-/g, "")]: S
10141
10142
  }
10142
10143
  })), f();
10143
10144
  },
@@ -10152,10 +10153,10 @@ const useStructureValidation = () => {
10152
10153
  },
10153
10154
  [h, f]
10154
10155
  ), _ = useDebouncedCallback(
10155
- (E, v) => {
10156
+ (E, S) => {
10156
10157
  x(() => {
10157
10158
  const j = get(h, `colors.${E}`);
10158
- return n ? set(j, 1, v) : set(j, 0, v), f(), {
10159
+ return n ? set(j, 1, S) : set(j, 0, S), f(), {
10159
10160
  ...h,
10160
10161
  colors: {
10161
10162
  ...h.colors,
@@ -10166,18 +10167,18 @@ const useStructureValidation = () => {
10166
10167
  },
10167
10168
  [h, f],
10168
10169
  200
10169
- ), S = (E) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(E.items).map(([v]) => {
10170
- const j = get(h, `colors.${v}.${n ? 1 : 0}`);
10171
- return j ? /* @__PURE__ */ jsxs("div", { id: `theme-${v}`, className: "mt-1 flex items-center gap-x-2", children: [
10170
+ ), w = (E) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(E.items).map(([S]) => {
10171
+ const j = get(h, `colors.${S}.${n ? 1 : 0}`);
10172
+ return j ? /* @__PURE__ */ jsxs("div", { id: `theme-${S}`, className: "mt-1 flex items-center gap-x-2", children: [
10172
10173
  /* @__PURE__ */ jsx(
10173
10174
  ColorPickerInput,
10174
10175
  {
10175
10176
  value: j,
10176
- onChange: (N) => _(v, N)
10177
+ onChange: (N) => _(S, N)
10177
10178
  }
10178
10179
  ),
10179
- /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: v.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" ") + (!v.toLowerCase().includes("foreground") && !v.toLowerCase().includes("border") && !v.toLowerCase().includes("input") && !v.toLowerCase().includes("ring") && !v.toLowerCase().includes("background") ? " Background" : "") })
10180
- ] }, v) : null;
10180
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight", children: S.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((N) => N.charAt(0).toUpperCase() + N.slice(1)).join(" ") + (!S.toLowerCase().includes("foreground") && !S.toLowerCase().includes("border") && !S.toLowerCase().includes("input") && !S.toLowerCase().includes("ring") && !S.toLowerCase().includes("background") ? " Background" : "") })
10181
+ ] }, S) : null;
10181
10182
  }) });
10182
10183
  return u("edit_theme") ? /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
10183
10184
  /* @__PURE__ */ jsxs("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto", o), children: [
@@ -10193,8 +10194,8 @@ const useStructureValidation = () => {
10193
10194
  /* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: i, children: [
10194
10195
  /* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: y("Select preset") }) }),
10195
10196
  /* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((E) => {
10196
- const v = Object.keys(E)[0], j = v.replaceAll("_", " ");
10197
- return /* @__PURE__ */ jsx(SelectItem, { value: v, children: capitalize(j) }, v);
10197
+ const S = Object.keys(E)[0], j = S.replaceAll("_", " ");
10198
+ return /* @__PURE__ */ jsx(SelectItem, { value: S, children: capitalize(j) }, S);
10198
10199
  }) })
10199
10200
  ] }) }),
10200
10201
  /* @__PURE__ */ jsx("div", { className: "w-[25%]", children: /* @__PURE__ */ jsx(Button, { className: "w-full text-sm", disabled: !a, onClick: k, children: y("Apply") }) })
@@ -10206,11 +10207,11 @@ const useStructureValidation = () => {
10206
10207
  /* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
10207
10208
  /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: y("Typography") })
10208
10209
  ] }),
10209
- (b == null ? void 0 : b.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(b.fontFamily).map(([E, v]) => /* @__PURE__ */ jsx(
10210
+ (b == null ? void 0 : b.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(b.fontFamily).map(([E, S]) => /* @__PURE__ */ jsx(
10210
10211
  FontSelector,
10211
10212
  {
10212
10213
  label: E,
10213
- value: h.fontFamily[E.replace(/font-/g, "")] || v[Object.keys(v)[0]],
10214
+ value: h.fontFamily[E.replace(/font-/g, "")] || S[Object.keys(S)[0]],
10214
10215
  onChange: (j) => A(E, j)
10215
10216
  },
10216
10217
  E
@@ -10247,14 +10248,14 @@ const useStructureValidation = () => {
10247
10248
  /* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
10248
10249
  ] })
10249
10250
  ] }),
10250
- /* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((E) => S(E)) })
10251
+ /* @__PURE__ */ jsx("div", { className: "space-y-2", children: b.colors.map((E) => w(E)) })
10251
10252
  ] }),
10252
10253
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: y("Loading...") }), children: l && g && /* @__PURE__ */ jsx(
10253
10254
  LazyCssImportModal,
10254
10255
  {
10255
10256
  open: l,
10256
10257
  onOpenChange: c,
10257
- onImport: w
10258
+ onImport: v
10258
10259
  }
10259
10260
  ) })
10260
10261
  ] }),
@@ -11003,43 +11004,43 @@ const UndoRedo = () => {
11003
11004
  return;
11004
11005
  }
11005
11006
  if (l) {
11006
- const S = [...a, { key: l, value: d }];
11007
- r(S), i(a), c(""), p(""), f("");
11007
+ const w = [...a, { key: l, value: d }];
11008
+ r(w), i(a), c(""), p(""), f("");
11008
11009
  }
11009
- }, k = (S) => {
11010
- const E = a.filter((v, j) => j !== S);
11010
+ }, k = (w) => {
11011
+ const E = a.filter((S, j) => j !== w);
11011
11012
  r(E), i(E);
11012
- }, w = (S) => {
11013
- g(S), c(a[S].key), p(a[S].value);
11013
+ }, v = (w) => {
11014
+ g(w), c(a[w].key), p(a[w].value);
11014
11015
  }, A = () => {
11015
11016
  if (l.startsWith("@")) {
11016
11017
  f(y("Attribute keys cannot start with @"));
11017
11018
  return;
11018
11019
  }
11019
11020
  if (u !== null && l) {
11020
- const S = [...a];
11021
- S[u] = { key: l, value: d }, r(S), i(S), g(null), c(""), p(""), f("");
11021
+ const w = [...a];
11022
+ w[u] = { key: l, value: d }, r(w), i(w), g(null), c(""), p(""), f("");
11022
11023
  }
11023
- }, B = (S) => {
11024
- S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? A() : C());
11025
- }, _ = useCallback((S) => {
11026
- const E = (N) => /[.,!?;:]/.test(N), v = (N, I, D) => {
11027
- let R = "", P = "";
11024
+ }, B = (w) => {
11025
+ w.key === "Enter" && !w.shiftKey && (w.preventDefault(), u !== null ? A() : C());
11026
+ }, _ = useCallback((w) => {
11027
+ const E = (N) => /[.,!?;:]/.test(N), S = (N, I, D) => {
11028
+ let P = "", R = "";
11028
11029
  const $ = I > 0 ? N[I - 1] : "", F = I < N.length ? N[I] : "";
11029
- return I > 0 && ($ === "." || !E($) && $ !== " ") && (R = " "), I < N.length && !E(F) && F !== " " && (P = " "), {
11030
- text: R + D + P,
11031
- prefixLength: R.length,
11032
- suffixLength: P.length
11030
+ return I > 0 && ($ === "." || !E($) && $ !== " ") && (P = " "), I < N.length && !E(F) && F !== " " && (R = " "), {
11031
+ text: P + D + R,
11032
+ prefixLength: P.length,
11033
+ suffixLength: R.length
11033
11034
  };
11034
11035
  }, j = x.current;
11035
11036
  if (j) {
11036
11037
  const N = j.selectionStart || 0, I = j.value || "", D = j.selectionEnd || N;
11037
11038
  if (D > N) {
11038
- const O = `{{${S}}}`, { text: L } = v(I, N, O), T = I.slice(0, N) + L + I.slice(D);
11039
+ const O = `{{${w}}}`, { text: L } = S(I, N, O), T = I.slice(0, N) + L + I.slice(D);
11039
11040
  p(T);
11040
11041
  return;
11041
11042
  }
11042
- const P = `{{${S}}}`, { text: $ } = v(I, N, P), F = I.slice(0, N) + $ + I.slice(N);
11043
+ const R = `{{${w}}}`, { text: $ } = S(I, N, R), F = I.slice(0, N) + $ + I.slice(N);
11043
11044
  p(F);
11044
11045
  }
11045
11046
  }, []);
@@ -11047,8 +11048,8 @@ const UndoRedo = () => {
11047
11048
  /* @__PURE__ */ jsxs(
11048
11049
  "form",
11049
11050
  {
11050
- onSubmit: (S) => {
11051
- S.preventDefault(), u !== null ? A() : C();
11051
+ onSubmit: (w) => {
11052
+ w.preventDefault(), u !== null ? A() : C();
11052
11053
  },
11053
11054
  className: "space-y-3",
11054
11055
  children: [
@@ -11064,7 +11065,7 @@ const UndoRedo = () => {
11064
11065
  id: "attrKey",
11065
11066
  ref: h,
11066
11067
  value: l,
11067
- onChange: (S) => c(S.target.value),
11068
+ onChange: (w) => c(w.target.value),
11068
11069
  placeholder: y("Enter key"),
11069
11070
  className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
11070
11071
  }
@@ -11084,7 +11085,7 @@ const UndoRedo = () => {
11084
11085
  id: "attrValue",
11085
11086
  ref: x,
11086
11087
  value: d,
11087
- onChange: (S) => p(S.target.value),
11088
+ onChange: (w) => p(w.target.value),
11088
11089
  onKeyDown: B,
11089
11090
  placeholder: y("Enter value"),
11090
11091
  className: "text-xs font-normal leading-tight placeholder:text-slate-400"
@@ -11097,13 +11098,13 @@ const UndoRedo = () => {
11097
11098
  ]
11098
11099
  }
11099
11100
  ),
11100
- /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((S, E) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
11101
+ /* @__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: [
11101
11102
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
11102
- /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: S.key }),
11103
- /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: S.value.toString() })
11103
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: w.key }),
11104
+ /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: w.value.toString() })
11104
11105
  ] }),
11105
11106
  /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
11106
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => w(E), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
11107
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(E), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
11107
11108
  /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(E), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
11108
11109
  ] })
11109
11110
  ] }, E)) })
@@ -11246,11 +11247,117 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11246
11247
  component: DefaultTopBar
11247
11248
  }, registerChaiTopBar = (o) => {
11248
11249
  TOP_BAR.component = o;
11249
- }, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), ManageDesignTokens = ({}) => {
11250
- const { t: o } = useTranslation(), [n, r] = useAtom$1(chaiDesignTokensAtom), [a, i] = useState(!1), [l, c] = useState(null), [d, p] = useState(!1), [u, g] = useState(!1), [m, f] = useState(""), [h, x] = useState(""), [b, y] = useState(""), [C, k] = useState(""), [w, A] = useState(""), [B, _] = useState(""), S = useIncrementActionsCount(), E = (L) => {
11250
+ }, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), TokenUsageSection = ({ title: o, items: n, emptyLabel: r, onSelect: a, icon: i }) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
11251
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: o }),
11252
+ n.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: n.map((l) => /* @__PURE__ */ jsx(
11253
+ "button",
11254
+ {
11255
+ type: "button",
11256
+ onClick: () => a(l.id),
11257
+ className: cn$2(
11258
+ "group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-2 text-left text-xs transition",
11259
+ "hover:border-muted-foreground/20 hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",
11260
+ l.isSelected && "border-primary/40 bg-primary/10 text-primary"
11261
+ ),
11262
+ children: /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-2", children: [
11263
+ i && i,
11264
+ /* @__PURE__ */ jsx("span", { className: "h-1.5 w-1.5 rounded-full bg-muted-foreground/50 group-hover:bg-primary/60" }),
11265
+ /* @__PURE__ */ jsx("span", { className: "truncate", children: l.label })
11266
+ ] })
11267
+ },
11268
+ l.id
11269
+ )) }) : /* @__PURE__ */ jsx("div", { className: "rounded border border-dashed border-muted px-3 py-2 text-xs text-muted-foreground", children: r })
11270
+ ] }), STYLES_PREFIX = "#styles:", getBlockLabel = (o) => {
11271
+ const r = [
11272
+ typeof o._name == "string" ? o._name : void 0,
11273
+ typeof o._type == "string" ? o._type : void 0
11274
+ ].filter(Boolean).find((a) => a.trim().length > 0);
11275
+ return r ? r.length > 40 ? `${r.slice(0, 37)}...` : r : o._id;
11276
+ }, collectTokenUsageOnPage = (o, n) => {
11277
+ const r = `${DESIGN_TOKEN_PREFIX}${n}`;
11278
+ return o.filter((a) => Object.values(a).some((i) => typeof i != "string" || !i.startsWith(STYLES_PREFIX) ? !1 : i.includes(r))).map((a) => ({
11279
+ id: a._id,
11280
+ label: getBlockLabel(a)
11281
+ }));
11282
+ }, TokenUsagePopover = ({ tokenId: o, tokenName: n }) => {
11283
+ const { t: r } = useTranslation(), [a] = useBlocksStore(), [i, l] = useSelectedBlockIds(), c = useBuilderProp("pageId"), d = useBuilderProp("siteWideUsage"), p = useMemo(() => collectTokenUsageOnPage(a, o), [a, o]), u = useMemo(
11284
+ () => p.map((b) => ({
11285
+ id: b.id,
11286
+ label: b.label,
11287
+ isSelected: i.includes(b.id)
11288
+ })),
11289
+ [p, i]
11290
+ ), g = useMemo(() => d ? Object.entries(d).reduce(
11291
+ (b, [y, C]) => (y === c || !(C != null && C.designTokens) || !Object.keys(C.designTokens).some((v) => typeof v != "string" ? !1 : v === o) || b.push({ id: y, name: C.name || y, isPartial: !!C.isPartial }), b),
11292
+ []
11293
+ ) : [], [d, n, o, c]), m = useMemo(
11294
+ () => g.filter((b) => !b.isPartial).map((b) => ({
11295
+ id: b.id,
11296
+ label: b.name
11297
+ })),
11298
+ [g]
11299
+ ), f = useMemo(
11300
+ () => g.filter((b) => b.isPartial).map((b) => ({
11301
+ id: b.id,
11302
+ label: b.name
11303
+ })),
11304
+ [g]
11305
+ ), h = useCallback(
11306
+ (b) => {
11307
+ l([b]);
11308
+ },
11309
+ [l]
11310
+ ), x = (b) => {
11311
+ if (!b) return;
11312
+ const y = new URL(window.location.href);
11313
+ y.searchParams.set("pageId", b), window.open(y.toString(), "_blank");
11314
+ };
11315
+ return /* @__PURE__ */ jsxs(Popover, { children: [
11316
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", className: "h-6 w-6 p-0", children: /* @__PURE__ */ jsx(EyeOpenIcon, { className: "h-3 w-3" }) }) }),
11317
+ /* @__PURE__ */ jsxs(PopoverContent, { side: "bottom", align: "end", className: "w-80 p-0", children: [
11318
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1 px-4 py-3", children: [
11319
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold", children: n }),
11320
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: r("Usage summary for this design token across your site.") })
11321
+ ] }),
11322
+ /* @__PURE__ */ jsxs("div", { className: "no-scrollbar max-h-64 space-y-4 overflow-y-auto px-4 pb-4", children: [
11323
+ /* @__PURE__ */ jsx(
11324
+ TokenUsageSection,
11325
+ {
11326
+ title: r("Blocks affected on this page"),
11327
+ items: u,
11328
+ emptyLabel: r("None"),
11329
+ onSelect: h,
11330
+ icon: /* @__PURE__ */ jsx(BoxIcon, { fontSize: 8 })
11331
+ }
11332
+ ),
11333
+ /* @__PURE__ */ jsx(
11334
+ TokenUsageSection,
11335
+ {
11336
+ title: r("Blocks affected on other pages"),
11337
+ items: m,
11338
+ emptyLabel: r("None"),
11339
+ onSelect: x,
11340
+ icon: /* @__PURE__ */ jsx(FileIcon, { fontSize: 8 })
11341
+ }
11342
+ ),
11343
+ /* @__PURE__ */ jsx(
11344
+ TokenUsageSection,
11345
+ {
11346
+ title: r("Blocks affected on partial blocks"),
11347
+ items: f,
11348
+ emptyLabel: r("None"),
11349
+ onSelect: x,
11350
+ icon: /* @__PURE__ */ jsx(GlobeIcon, { fontSize: 8 })
11351
+ }
11352
+ )
11353
+ ] })
11354
+ ] })
11355
+ ] });
11356
+ }, ManageDesignTokens = ({}) => {
11357
+ const { t: o } = useTranslation(), [n, r] = useAtom$1(chaiDesignTokensAtom), [a, i] = useState(!1), [l, c] = useState(null), [d, p] = useState(!1), [u, g] = useState(!1), [m, f] = useState(""), [h, x] = useState(""), [b, y] = useState(""), [C, k] = useState(""), [v, A] = useState(""), [B, _] = useState(""), w = useIncrementActionsCount(), E = (L) => {
11251
11358
  const T = L.trim();
11252
11359
  return T.length === 0 || T.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(T);
11253
- }, v = (L, T = !1, M) => {
11360
+ }, S = (L, T = !1, M) => {
11254
11361
  const H = L.trim();
11255
11362
  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(
11256
11363
  ([V, U]) => U.name === H && (!T || V !== M)
@@ -11268,14 +11375,14 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11268
11375
  toast.error(o("Token already exists"));
11269
11376
  return;
11270
11377
  }
11271
- const T = `token_${nanoid(12)}`, M = {
11378
+ const T = `${DESIGN_TOKEN_PREFIX}${nanoid(12)}`, M = {
11272
11379
  ...n,
11273
11380
  [T]: {
11274
11381
  name: m.trim(),
11275
11382
  value: h.trim()
11276
11383
  }
11277
11384
  };
11278
- r(M), f(""), x(""), i(!1), p(!1), S(), toast.success(o("Token added successfully"));
11385
+ r(M), f(""), x(""), i(!1), p(!1), w(), toast.success(o("Token added successfully"));
11279
11386
  }, N = () => {
11280
11387
  if (!b.trim() || !C.trim()) {
11281
11388
  toast.error(o("Please fill in both token name and classes"));
@@ -11300,32 +11407,32 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11300
11407
  value: C.trim()
11301
11408
  }
11302
11409
  };
11303
- r(T), c(null), y(""), k(""), g(!1), S(), toast.success(o("Token updated successfully"));
11410
+ r(T), c(null), y(""), k(""), g(!1), w(), toast.success(o("Token updated successfully"));
11304
11411
  }, I = (L) => {
11305
11412
  const T = { ...n };
11306
- delete T[L], r(T), S(), toast.success(o("Token deleted successfully"));
11413
+ delete T[L], r(T), w(), toast.success(o("Token deleted successfully"));
11307
11414
  }, D = (L) => {
11308
11415
  const T = n[L];
11309
11416
  T && (c(L), y(T.name), k(T.value), i(!1), g(!0));
11310
- }, R = () => {
11311
- i(!0), c(null), f(""), x(""), A(""), p(!0);
11312
11417
  }, P = () => {
11418
+ i(!0), c(null), f(""), x(""), A(""), p(!0);
11419
+ }, R = () => {
11313
11420
  c(null), y(""), k(""), _(""), g(!1);
11314
11421
  }, $ = () => {
11315
11422
  i(!1), f(""), x(""), A(""), p(!1);
11316
11423
  }, F = (L) => {
11317
11424
  const T = L.replace(/\s+/g, "-");
11318
- f(T), A(v(T));
11425
+ f(T), A(S(T));
11319
11426
  }, O = (L) => {
11320
11427
  const T = L.replace(/\s+/g, "-");
11321
- y(T), _(v(T, !0, l || void 0));
11428
+ y(T), _(S(T, !0, l || void 0));
11322
11429
  };
11323
11430
  return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col", children: [
11324
11431
  /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs(
11325
11432
  Button,
11326
11433
  {
11327
11434
  variant: "outline",
11328
- onClick: R,
11435
+ onClick: P,
11329
11436
  disabled: a || l !== null,
11330
11437
  size: "sm",
11331
11438
  className: "h-7 text-xs",
@@ -11345,6 +11452,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11345
11452
  children: [
11346
11453
  /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx("span", { className: "flex items-center break-all pl-1 text-xs font-semibold", children: T.name }) }),
11347
11454
  /* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 items-center opacity-0 group-hover:opacity-100", children: [
11455
+ /* @__PURE__ */ jsx(TokenUsagePopover, { tokenId: L, tokenName: T.name }),
11348
11456
  /* @__PURE__ */ jsx(
11349
11457
  Button,
11350
11458
  {
@@ -11412,7 +11520,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11412
11520
  className: "text-sm"
11413
11521
  }
11414
11522
  ),
11415
- w ? /* @__PURE__ */ jsx("span", { className: "text-sm text-destructive", children: w }) : /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: o("Button-Primary, Card-Header, Text-Large") })
11523
+ v ? /* @__PURE__ */ jsx("span", { className: "text-sm text-destructive", children: v }) : /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: o("Button-Primary, Card-Header, Text-Large") })
11416
11524
  ] }),
11417
11525
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
11418
11526
  /* @__PURE__ */ jsx(Label, { htmlFor: "new-classes", className: "text-sm", children: o("Tailwind Classes") }),
@@ -11433,7 +11541,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11433
11541
  /* @__PURE__ */ jsx(Button, { onClick: j, className: "h-8 text-sm", children: o("Add Token") })
11434
11542
  ] })
11435
11543
  ] }) }),
11436
- /* @__PURE__ */ jsx(Dialog, { open: u, onOpenChange: P, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-md", children: [
11544
+ /* @__PURE__ */ jsx(Dialog, { open: u, onOpenChange: R, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-md", children: [
11437
11545
  /* @__PURE__ */ jsxs(DialogHeader, { children: [
11438
11546
  /* @__PURE__ */ jsx(DialogTitle, { className: "text-base", children: o("Edit Design Token") }),
11439
11547
  /* @__PURE__ */ jsx(DialogDescription, { className: "text-sm", children: o("Update the design token name and classes.") })
@@ -11466,7 +11574,7 @@ const PartialWrapper = ({ partialBlockId: o }) => {
11466
11574
  ] })
11467
11575
  ] }),
11468
11576
  /* @__PURE__ */ jsxs(DialogFooter, { children: [
11469
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: P, className: "h-8 text-sm", children: o("Cancel") }),
11577
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: R, className: "h-8 text-sm", children: o("Cancel") }),
11470
11578
  /* @__PURE__ */ jsx(Button, { onClick: N, className: "h-8 text-sm", children: o("Update Token") })
11471
11579
  ] })
11472
11580
  ] }) })
@@ -11497,24 +11605,24 @@ registerChaiSidebarPanel("outline", {
11497
11605
  panel: () => /* @__PURE__ */ jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsx(ListTree, {}) })
11498
11606
  });
11499
11607
  const RootLayout = () => {
11500
- const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [i, l] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useChaiSidebarPanels("top"), u = useChaiSidebarPanels("bottom"), g = reverse([...u ?? []]), m = useCallback((S) => {
11501
- S.preventDefault();
11608
+ const o = useTopBarComponent(), [n, r] = useSidebarActivePanel(), a = useRef("outline"), [i, l] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), p = useChaiSidebarPanels("top"), u = useChaiSidebarPanels("bottom"), g = reverse([...u ?? []]), m = useCallback((w) => {
11609
+ w.preventDefault();
11502
11610
  }, []), f = useMemo(() => [p].flat(), [p]), h = useCallback(
11503
- (S) => {
11504
- console.log("handleMenuItemClick", S, n), r(n === S ? null : S);
11611
+ (w) => {
11612
+ console.log("handleMenuItemClick", w, n), r(n === w ? null : w);
11505
11613
  },
11506
11614
  [n, r]
11507
11615
  ), { t: x } = useTranslation(), b = useMemo(() => [...p, ...u], [p, u]), y = useBuilderProp("htmlDir", "ltr"), C = find(b, { id: n }) ?? first(b), k = get(C, "width", DEFAULT_PANEL_WIDTH);
11508
11616
  useEffect(() => {
11509
11617
  if (n !== null) {
11510
- const S = find(b, { id: n });
11511
- S && get(S, "view", "standard") === "standard" && (a.current = n, l(get(S, "width", DEFAULT_PANEL_WIDTH)));
11618
+ const w = find(b, { id: n });
11619
+ w && get(w, "view", "standard") === "standard" && (a.current = n, l(get(w, "width", DEFAULT_PANEL_WIDTH)));
11512
11620
  }
11513
11621
  }, [n, b]);
11514
- const w = useMemo(() => {
11622
+ const v = useMemo(() => {
11515
11623
  if (n === null) return 0;
11516
- const S = find(b, { id: n });
11517
- return get(S, "view", "standard") === "standard" ? k : i;
11624
+ const w = find(b, { id: n });
11625
+ return get(w, "view", "standard") === "standard" ? k : i;
11518
11626
  }, [n, k, i, b]), A = useCallback(() => {
11519
11627
  r(a.current);
11520
11628
  }, [r, n]), B = useCallback(() => {
@@ -11524,8 +11632,8 @@ const RootLayout = () => {
11524
11632
  n !== null && !find(b, { id: n }) && r("outline");
11525
11633
  }, [n, b]);
11526
11634
  const _ = useCallback(
11527
- (S) => {
11528
- h(S);
11635
+ (w) => {
11636
+ h(w);
11529
11637
  },
11530
11638
  [h]
11531
11639
  );
@@ -11539,24 +11647,24 @@ const RootLayout = () => {
11539
11647
  /* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
11540
11648
  /* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
11541
11649
  /* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
11542
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((S, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
11543
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
11650
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: f.map((w, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
11651
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
11544
11652
  position: "top",
11545
- panelId: S.id,
11546
- isActive: n === S.id,
11547
- show: () => _(S.id)
11653
+ panelId: w.id,
11654
+ isActive: n === w.id,
11655
+ show: () => _(w.id)
11548
11656
  }) }),
11549
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(S.label) }) })
11657
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
11550
11658
  ] }, "button-top-" + E)) }),
11551
11659
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
11552
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((S, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
11553
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(S, "button", NoopComponent), {
11660
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((w, E) => /* @__PURE__ */ jsxs(Tooltip, { children: [
11661
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
11554
11662
  position: "bottom",
11555
- panelId: S.id,
11556
- isActive: n === S.id,
11557
- show: () => _(S.id)
11663
+ panelId: w.id,
11664
+ isActive: n === w.id,
11665
+ show: () => _(w.id)
11558
11666
  }) }),
11559
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(S.label) }) })
11667
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
11560
11668
  ] }, "button-bottom-" + E)) })
11561
11669
  ] }),
11562
11670
  /* @__PURE__ */ jsx(
@@ -11564,8 +11672,8 @@ const RootLayout = () => {
11564
11672
  {
11565
11673
  id: "left-panel",
11566
11674
  className: "h-full max-h-full border-r border-border",
11567
- initial: { width: w },
11568
- animate: { width: w },
11675
+ initial: { width: v },
11676
+ animate: { width: v },
11569
11677
  transition: { duration: 0.3, ease: "easeInOut" },
11570
11678
  children: n !== null && get(C, "view", "standard") === "standard" && /* @__PURE__ */ jsxs("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
11571
11679
  /* @__PURE__ */ jsx(
@@ -11759,8 +11867,8 @@ const RootLayout = () => {
11759
11867
  });
11760
11868
  }, f = (x) => {
11761
11869
  if (!c) return;
11762
- const b = x.clientX - p.x, y = x.clientY - p.y, C = x.currentTarget, k = C.offsetWidth, w = C.offsetHeight, A = window.innerWidth - k, B = window.innerHeight - w, _ = Math.max(0, Math.min(b, A)), S = Math.max(0, Math.min(y, B));
11763
- r(_, S);
11870
+ const b = x.clientX - p.x, y = x.clientY - p.y, C = x.currentTarget, k = C.offsetWidth, v = C.offsetHeight, A = window.innerWidth - k, B = window.innerHeight - v, _ = Math.max(0, Math.min(b, A)), w = Math.max(0, Math.min(y, B));
11871
+ r(_, w);
11764
11872
  }, h = () => {
11765
11873
  d(!1);
11766
11874
  };
@@ -12002,10 +12110,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
12002
12110
  var r;
12003
12111
  const a = getBuildingBlocks(o), i = a[1], l = a[2], c = a[3], d = a[6], p = a[7], u = a[11], g = a[12], m = a[13], f = a[14], h = a[16], x = a[17], b = u(o, n);
12004
12112
  if (isAtomStateInitialized(b) && (i.has(n) && l.get(n) !== b.n || Array.from(b.d).every(
12005
- ([S, E]) => (
12113
+ ([w, E]) => (
12006
12114
  // Recursively, read the atom state of the dependency, and
12007
12115
  // check if the atom epoch number is unchanged
12008
- f(o, S).n === E
12116
+ f(o, w).n === E
12009
12117
  )
12010
12118
  )))
12011
12119
  return b;
@@ -12014,34 +12122,34 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
12014
12122
  function C() {
12015
12123
  i.has(n) && (x(o, n), m(o), g(o));
12016
12124
  }
12017
- function k(S) {
12125
+ function k(w) {
12018
12126
  var E;
12019
- if (isSelfAtom(n, S)) {
12020
- const j = u(o, S);
12127
+ if (isSelfAtom(n, w)) {
12128
+ const j = u(o, w);
12021
12129
  if (!isAtomStateInitialized(j))
12022
- if (hasInitialValue(S))
12023
- setAtomStateValueOrPromise(o, S, S.init);
12130
+ if (hasInitialValue(w))
12131
+ setAtomStateValueOrPromise(o, w, w.init);
12024
12132
  else
12025
12133
  throw new Error("no atom init");
12026
12134
  return returnAtomValue(j);
12027
12135
  }
12028
- const v = f(o, S);
12136
+ const S = f(o, w);
12029
12137
  try {
12030
- return returnAtomValue(v);
12138
+ return returnAtomValue(S);
12031
12139
  } finally {
12032
- b.d.set(S, v.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, v), (E = i.get(S)) == null || E.t.add(n), y || C();
12140
+ b.d.set(w, S.n), isPendingPromise(b.v) && addPendingPromiseToDependency(n, b.v, S), (E = i.get(w)) == null || E.t.add(n), y || C();
12033
12141
  }
12034
12142
  }
12035
- let w, A;
12143
+ let v, A;
12036
12144
  const B = {
12037
12145
  get signal() {
12038
- return w || (w = new AbortController()), w.signal;
12146
+ return v || (v = new AbortController()), v.signal;
12039
12147
  },
12040
12148
  get setSelf() {
12041
- return !A && isActuallyWritableAtom(n) && (A = (...S) => {
12149
+ return !A && isActuallyWritableAtom(n) && (A = (...w) => {
12042
12150
  if (!y)
12043
12151
  try {
12044
- return h(o, n, ...S);
12152
+ return h(o, n, ...w);
12045
12153
  } finally {
12046
12154
  m(o), g(o);
12047
12155
  }
@@ -12049,10 +12157,10 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
12049
12157
  }
12050
12158
  }, _ = b.n;
12051
12159
  try {
12052
- const S = p(o, n, k, B);
12053
- return setAtomStateValueOrPromise(o, n, S), isPromiseLike$1(S) && (registerAbortHandler(S, () => w == null ? void 0 : w.abort()), S.then(C, C)), b;
12054
- } catch (S) {
12055
- return delete b.v, b.e = S, ++b.n, b;
12160
+ const w = p(o, n, k, B);
12161
+ return setAtomStateValueOrPromise(o, n, w), isPromiseLike$1(w) && (registerAbortHandler(w, () => v == null ? void 0 : v.abort()), w.then(C, C)), b;
12162
+ } catch (w) {
12163
+ return delete b.v, b.e = w, ++b.n, b;
12056
12164
  } finally {
12057
12165
  y = !1, _ !== b.n && l.get(n) === _ && (l.set(n, b.n), c.add(n), (r = d.c) == null || r.call(d, n));
12058
12166
  }
@@ -12070,13 +12178,13 @@ const atomRead = (o, n, ...r) => n.read(...r), atomWrite = (o, n, ...r) => n.wri
12070
12178
  let h = !0;
12071
12179
  const x = (y) => returnAtomValue(g(o, y)), b = (y, ...C) => {
12072
12180
  var k;
12073
- const w = d(o, y);
12181
+ const v = d(o, y);
12074
12182
  try {
12075
12183
  if (isSelfAtom(n, y)) {
12076
12184
  if (!hasInitialValue(y))
12077
12185
  throw new Error("atom not writable");
12078
- const A = w.n, B = C[0];
12079
- setAtomStateValueOrPromise(o, y, B), f(o, y), A !== w.n && (i.add(y), (k = l.c) == null || k.call(l, y), m(o, y));
12186
+ const A = v.n, B = C[0];
12187
+ setAtomStateValueOrPromise(o, y, B), f(o, y), A !== v.n && (i.add(y), (k = l.c) == null || k.call(l, y), m(o, y));
12080
12188
  return;
12081
12189
  } else
12082
12190
  return writeAtomState(o, y, ...C);
@@ -12487,7 +12595,7 @@ function domToJsx(o, n = 0) {
12487
12595
  (x, b) => {
12488
12596
  const [y, C] = b.split(":").map((k) => k.trim());
12489
12597
  if (y && C) {
12490
- const k = y.replace(/-([a-z])/g, (w) => w[1].toUpperCase());
12598
+ const k = y.replace(/-([a-z])/g, (v) => v[1].toUpperCase());
12491
12599
  x[k] = C.replace(/['"]/g, "");
12492
12600
  }
12493
12601
  return x;
@@ -12614,19 +12722,19 @@ ${i})
12614
12722
  u(!1);
12615
12723
  let k = l({ blockId: i == null ? void 0 : i._id, additionalCoreBlocks: ["Icon"] });
12616
12724
  k = k.replace(/\s*bid=["'][^"']*["']/g, "");
12617
- const w = o === "ts", {
12725
+ const v = o === "ts", {
12618
12726
  jsx: A,
12619
12727
  html: B,
12620
12728
  componentName: _
12621
12729
  } = await getExportedCoded({
12622
12730
  selectedBlock: i,
12623
12731
  html: k,
12624
- isTypeScript: w
12732
+ isTypeScript: v
12625
12733
  });
12626
12734
  a({ html: B, jsx: A }), d(_), u(!0);
12627
12735
  } catch {
12628
- const w = "<div>Export failed. Close the modal and try again.</div>";
12629
- a({ html: w, jsx: w }), toast.error(n("Failed to generate export HTML"));
12736
+ const v = "<div>Export failed. Close the modal and try again.</div>";
12737
+ a({ html: v, jsx: v }), toast.error(n("Failed to generate export HTML"));
12630
12738
  }
12631
12739
  }, [n, o, i, l]);
12632
12740
  useEffect(() => {
@@ -12642,17 +12750,17 @@ ${i})
12642
12750
  },
12643
12751
  [n]
12644
12752
  ), x = (k) => {
12645
- const w = new Blob([k], { type: "text/jsx" }), A = URL.createObjectURL(w), B = document.createElement("a");
12753
+ const v = new Blob([k], { type: "text/jsx" }), A = URL.createObjectURL(v), B = document.createElement("a");
12646
12754
  B.href = A, B.download = g(), document.body.appendChild(B), B.click(), URL.revokeObjectURL(A), document.body.removeChild(B), toast.success(n("Export code downloaded successfully!"));
12647
12755
  }, b = /* @__PURE__ */ jsxs("span", { children: [
12648
12756
  "Download ",
12649
12757
  /* @__PURE__ */ jsx("span", { className: "font-mono text-xs font-light text-gray-300", children: g() })
12650
12758
  ] }), y = useMemo(() => {
12651
- const k = { extend: shadcnTheme() }, w = JSON.stringify(k, null, 2);
12759
+ const k = { extend: shadcnTheme() }, v = JSON.stringify(k, null, 2);
12652
12760
  return `{
12653
12761
  // Your tailwind config ...
12654
12762
 
12655
- "theme": ${w == null ? void 0 : w.split(`
12763
+ "theme": ${v == null ? void 0 : v.split(`
12656
12764
  `).join(`
12657
12765
  `)},
12658
12766
  }`;