@chaibuilder/sdk 3.2.7 → 3.2.9

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.
@@ -1,6 +1,6 @@
1
- var J = Object.defineProperty;
2
- var X = (r, n, o) => n in r ? J(r, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[n] = o;
3
- var G = (r, n, o) => X(r, typeof n != "symbol" ? n + "" : n, o);
1
+ var ne = Object.defineProperty;
2
+ var se = (r, n, o) => n in r ? ne(r, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[n] = o;
3
+ var X = (r, n, o) => se(r, typeof n != "symbol" ? n + "" : n, o);
4
4
  import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
5
5
  import { getRegisteredChaiBlock, getDefaultBlockProps, syncBlocksWithDefaults, useRegisteredFonts, useRegisteredChaiBlocks, getBlockFormSchemas } from "@chaibuilder/runtime";
6
6
  import { has, get, filter, findIndex, find, flatten, map, includes, without, compact, isEmpty, isString, each, omit, values, pick, startsWith, isFunction as isFunction$1, isObject as isObject$1, memoize, noop, first as first$1, keys as keys$1, forEach as forEach$1, range, flattenDeep, set, unset, chunk, cloneDeep, isNull, kebabCase, throttle, some, uniq, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, sortBy, round, reverse, camelCase } from "lodash-es";
@@ -8,12 +8,12 @@ import { g as generateUUID, a as getBreakpointValue, c as cn$1 } from "./common-
8
8
  import { atom, getDefaultStore as getDefaultStore$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
9
9
  import { splitAtom, atomWithStorage, useAtomCallback } from "jotai/utils";
10
10
  import clsx$1, { clsx } from "clsx";
11
- import { nanoid } from "nanoid";
11
+ import "nanoid";
12
12
  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, D as DESIGN_TOKEN_PREFIX, k as ROOT_TEMP_KEY } from "./apply-binding-IFVE37dG.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-DLaiD20q.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";
@@ -21,8 +21,8 @@ import { useTranslation, initReactI18next } from "react-i18next";
21
21
  import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useDebouncedState } from "@react-hookz/web";
22
22
  import Fuse from "fuse.js";
23
23
  import UndoManager from "undo-manager";
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, GlobeIcon, Pencil1Icon } from "@radix-ui/react-icons";
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, au as Label, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, 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, 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, TokensIcon, CheckIcon, CircleIcon, MagnifyingGlassIcon, ReloadIcon, CaretRightIcon, FrameIcon, SquareIcon, EraserIcon, DownloadIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, StackIcon, DoubleArrowDownIcon, DoubleArrowUpIcon, ResetIcon, UploadIcon, TextIcon, CornerTopRightIcon, MixerHorizontalIcon, SunIcon, MoonIcon, FaceIcon, ShuffleIcon, ChatBubbleIcon, StopIcon, ZoomInIcon, DotsHorizontalIcon, LightningBoltIcon } 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";
@@ -95,7 +95,7 @@ import.meta.vitest && describe("canDropBlock Function", () => {
95
95
  });
96
96
  class PubSub {
97
97
  constructor() {
98
- G(this, "subscribers", /* @__PURE__ */ new Map());
98
+ X(this, "subscribers", /* @__PURE__ */ new Map());
99
99
  }
100
100
  subscribe(n, o) {
101
101
  return this.subscribers.has(n) || this.subscribers.set(n, /* @__PURE__ */ new Set()), this.subscribers.get(n).add(o), () => {
@@ -688,7 +688,7 @@ const useSelectedBlocksDisplayChild = () => ({
688
688
  ];
689
689
  class StructureRuleRegistry {
690
690
  constructor() {
691
- G(this, "rules", [...CORE_STRUCTURE_RULES]);
691
+ X(this, "rules", [...CORE_STRUCTURE_RULES]);
692
692
  }
693
693
  addRule(n) {
694
694
  this.rules.push(n);
@@ -1061,8 +1061,8 @@ const undoRedoStateAtom = atom({
1061
1061
  return {
1062
1062
  moveBlocks: (g, b, x) => {
1063
1063
  const y = builderStore.get(presentBlocksAtom), S = map(g, (C) => {
1064
- const B = y.find((A) => A._id === C)._parent || null, w = y.filter((A) => B ? A._parent === B : !A._parent).map((A) => A._id).indexOf(C);
1065
- return { _id: C, oldParent: B, oldPosition: w };
1064
+ const B = y.find((w) => w._id === C)._parent || null, A = y.filter((w) => B ? w._parent === B : !w._parent).map((w) => w._id).indexOf(C);
1065
+ return { _id: C, oldParent: B, oldPosition: A };
1066
1066
  }), k = S.find(({ _id: C }) => C === g[0]);
1067
1067
  k && k.oldParent === b && k.oldPosition === x || (i(g, b, x), r({
1068
1068
  undo: () => each(S, ({ _id: C, oldParent: E, oldPosition: B }) => {
@@ -2612,10 +2612,10 @@ const getBlockWithChildren = (r, n) => {
2612
2612
  return;
2613
2613
  }
2614
2614
  if (m === "styles") {
2615
- const I = E.map((w) => {
2616
- for (const A in w)
2617
- A !== "_id" && (w[A] = `${STYLES_KEY},${w[A]}`);
2618
- return w;
2615
+ const I = E.map((A) => {
2616
+ for (const w in A)
2617
+ w !== "_id" && (A[w] = `${STYLES_KEY},${A[w]}`);
2618
+ return A;
2619
2619
  });
2620
2620
  c(I);
2621
2621
  } else
@@ -3018,6 +3018,9 @@ const useBlockHighlight = () => {
3018
3018
  }, useCanvasDisplayWidth = () => {
3019
3019
  const [r, n] = useAtom$1(canvasDisplayWidthAtom);
3020
3020
  return [r, n];
3021
+ }, getQueries = (r) => {
3022
+ const n = ["xs", "sm", "md", "lg", "xl", "2xl"], o = n.indexOf(r);
3023
+ return o === -1 ? ["xs"] : n.slice(0, o + 1);
3021
3024
  }, selectedBlockAllClassesAtom = atom((r) => {
3022
3025
  const n = first$1(r(selectedStylingBlocksAtom)), o = r(selectedBlockAtom);
3023
3026
  if (!n || n.blockId !== get(o, "_id", null)) return [];
@@ -3027,33 +3030,7 @@ const useBlockHighlight = () => {
3027
3030
  const n = r(canvasBreakpointAtom), o = r(styleStateAtom), a = r(darkModeAtom), i = getQueries(n);
3028
3031
  let l = filter(r(selectedBlockAllClassesAtom), { mod: o });
3029
3032
  return startsWith(o, "_") || (l = filter(l, (c) => i.includes(c.mq))), l = l.sort((c, d) => MQ[c.mq] - MQ[d.mq]), a || (l = filter(l, { dark: !1 })), l;
3030
- }), getQueries = (r) => {
3031
- let n = [];
3032
- switch (r) {
3033
- case "xs":
3034
- n = ["xs"];
3035
- break;
3036
- case "sm":
3037
- n = ["xs", "sm"];
3038
- break;
3039
- case "md":
3040
- n = ["xs", "sm", "md"];
3041
- break;
3042
- case "lg":
3043
- n = ["xs", "sm", "md", "lg"];
3044
- break;
3045
- case "xl":
3046
- n = ["xs", "sm", "md", "lg", "xl"];
3047
- break;
3048
- case "2xl":
3049
- n = ["xs", "sm", "md", "lg", "xl", "2xl"];
3050
- break;
3051
- default:
3052
- n = ["xs"];
3053
- break;
3054
- }
3055
- return n;
3056
- }, useSelectedBlockCurrentClasses = () => useAtomValue$1(selectedBlockCurrentClassesAtom), selectedBreakpointsAtom = atomWithStorage("selectedBreakpoints", ["XS", "MD", "XL"]), useSelectedBreakpoints = () => {
3033
+ }), useSelectedBlockCurrentClasses = () => useAtomValue$1(selectedBlockCurrentClassesAtom), selectedBreakpointsAtom = atomWithStorage("selectedBreakpoints", ["XS", "MD", "XL"]), useSelectedBreakpoints = () => {
3057
3034
  const [r, n] = useAtom$1(selectedBreakpointsAtom);
3058
3035
  return [r, n];
3059
3036
  }, useStylingState = () => useAtom$1(styleStateAtom), wrapperBlockAtom = atom((r) => {
@@ -3555,9 +3532,9 @@ function detectDropZone(r, n, o, a, i) {
3555
3532
  d = d.parentElement;
3556
3533
  const u = l === "canvas" ? l : d == null ? void 0 : d.getAttribute("data-block-id"), p = d ? getOrientation(d) : "vertical", h = getOrientation(r), f = isLeafBlock(c), m = !f && canAcceptChildBlock(c, a), g = ((C = i.defaultView) == null ? void 0 : C.scrollY) || 0, b = ((E = i.defaultView) == null ? void 0 : E.scrollX) || 0;
3557
3534
  if (l === "canvas" && hasChildBlocks(r)) {
3558
- const w = getChildBlocks(r), A = w[w.length - 1];
3559
- if (A) {
3560
- const v = A.getBoundingClientRect(), T = r.getBoundingClientRect(), N = window.getComputedStyle(r), j = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, L = T.width - j - P, D = T.left + b + j;
3535
+ const A = getChildBlocks(r), w = A[A.length - 1];
3536
+ if (w) {
3537
+ const v = w.getBoundingClientRect(), T = r.getBoundingClientRect(), N = window.getComputedStyle(r), j = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, L = T.width - j - P, D = T.left + b + j;
3561
3538
  return {
3562
3539
  position: "after",
3563
3540
  placeholderOrientation: "horizontal",
@@ -3567,8 +3544,8 @@ function detectDropZone(r, n, o, a, i) {
3567
3544
  width: L,
3568
3545
  height: 4
3569
3546
  },
3570
- targetElement: A,
3571
- targetBlockId: A.getAttribute("data-block-id"),
3547
+ targetElement: w,
3548
+ targetBlockId: w.getAttribute("data-block-id"),
3572
3549
  targetParentId: "canvas",
3573
3550
  isEmpty: !1,
3574
3551
  confidence: 1
@@ -3576,44 +3553,44 @@ function detectDropZone(r, n, o, a, i) {
3576
3553
  }
3577
3554
  }
3578
3555
  if (m && !f && hasChildBlocks(r)) {
3579
- const w = detectGapZone(r, n, o, h);
3580
- if (w) {
3581
- const A = w.before.getBoundingClientRect(), v = w.after.getBoundingClientRect(), T = r.getBoundingClientRect(), N = window.getComputedStyle(r), j = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, L = getChildBlocks(r), D = getSiblingsInSameRow(L, w.before, h);
3582
- let F = 0;
3583
- if (D.forEach((H) => {
3584
- const O = H.getBoundingClientRect();
3585
- O.height > F && (F = O.height);
3556
+ const A = detectGapZone(r, n, o, h);
3557
+ if (A) {
3558
+ const w = A.before.getBoundingClientRect(), v = A.after.getBoundingClientRect(), T = r.getBoundingClientRect(), N = window.getComputedStyle(r), j = parseFloat(N.paddingLeft) || 0, P = parseFloat(N.paddingRight) || 0, L = getChildBlocks(r), D = getSiblingsInSameRow(L, A.before, h);
3559
+ let $ = 0;
3560
+ if (D.forEach((M) => {
3561
+ const O = M.getBoundingClientRect();
3562
+ O.height > $ && ($ = O.height);
3586
3563
  }), h === "vertical") {
3587
- const H = T.width - j - P, O = T.left + b + j;
3564
+ const M = T.width - j - P, O = T.left + b + j;
3588
3565
  return {
3589
3566
  position: "after",
3590
3567
  placeholderOrientation: "horizontal",
3591
3568
  rect: {
3592
- top: A.bottom + g,
3569
+ top: w.bottom + g,
3593
3570
  left: O,
3594
- width: H,
3571
+ width: M,
3595
3572
  height: 4
3596
3573
  },
3597
- targetElement: w.before,
3598
- targetBlockId: w.before.getAttribute("data-block-id"),
3574
+ targetElement: A.before,
3575
+ targetBlockId: A.before.getAttribute("data-block-id"),
3599
3576
  targetParentId: l,
3600
3577
  isGapZone: !0,
3601
3578
  confidence: 1
3602
3579
  // High confidence for gap zones
3603
3580
  };
3604
3581
  } else {
3605
- const H = A.top + g, O = F > 0 ? F : Math.max(A.height, v.height);
3582
+ const M = w.top + g, O = $ > 0 ? $ : Math.max(w.height, v.height);
3606
3583
  return {
3607
3584
  position: "after",
3608
3585
  placeholderOrientation: "vertical",
3609
3586
  rect: {
3610
- top: H,
3611
- left: A.right + b,
3587
+ top: M,
3588
+ left: w.right + b,
3612
3589
  width: 4,
3613
3590
  height: O
3614
3591
  },
3615
- targetElement: w.before,
3616
- targetBlockId: w.before.getAttribute("data-block-id"),
3592
+ targetElement: A.before,
3593
+ targetBlockId: A.before.getAttribute("data-block-id"),
3617
3594
  targetParentId: l,
3618
3595
  isGapZone: !0,
3619
3596
  confidence: 1
@@ -3622,22 +3599,22 @@ function detectDropZone(r, n, o, a, i) {
3622
3599
  }
3623
3600
  }
3624
3601
  if (d && u) {
3625
- const w = detectParentEdgeProximity(d, n, o, p);
3626
- if (w) {
3627
- const A = d.getBoundingClientRect(), v = window.getComputedStyle(d), T = parseFloat(v.paddingLeft) || 0, N = parseFloat(v.paddingRight) || 0, j = parseFloat(v.paddingTop) || 0, P = parseFloat(v.paddingBottom) || 0, L = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, D = ((I = i.defaultView) == null ? void 0 : I.scrollX) || 0, F = p === "vertical" ? "horizontal" : "vertical", H = getMaxSiblingDimensions(d);
3628
- if (w === "start") {
3602
+ const A = detectParentEdgeProximity(d, n, o, p);
3603
+ if (A) {
3604
+ const w = d.getBoundingClientRect(), v = window.getComputedStyle(d), T = parseFloat(v.paddingLeft) || 0, N = parseFloat(v.paddingRight) || 0, j = parseFloat(v.paddingTop) || 0, P = parseFloat(v.paddingBottom) || 0, L = ((B = i.defaultView) == null ? void 0 : B.scrollY) || 0, D = ((I = i.defaultView) == null ? void 0 : I.scrollX) || 0, $ = p === "vertical" ? "horizontal" : "vertical", M = getMaxSiblingDimensions(d);
3605
+ if (A === "start") {
3629
3606
  const O = getChildBlocks(d)[0];
3630
3607
  if (O) {
3631
- const R = O.getBoundingClientRect();
3608
+ const H = O.getBoundingClientRect();
3632
3609
  if (p === "vertical") {
3633
- const _ = A.width - T - N, M = A.left + D + T;
3610
+ const R = w.width - T - N, V = w.left + D + T;
3634
3611
  return {
3635
3612
  position: "before",
3636
- placeholderOrientation: F,
3613
+ placeholderOrientation: $,
3637
3614
  rect: {
3638
- top: R.top + L - 2,
3639
- left: M,
3640
- width: _,
3615
+ top: H.top + L - 2,
3616
+ left: V,
3617
+ width: R,
3641
3618
  height: 4
3642
3619
  },
3643
3620
  targetElement: O,
@@ -3646,15 +3623,15 @@ function detectDropZone(r, n, o, a, i) {
3646
3623
  confidence: 0.9
3647
3624
  };
3648
3625
  } else {
3649
- const _ = A.top + L + j, M = H.maxHeight > 0 ? H.maxHeight : A.height - j - P;
3626
+ const R = w.top + L + j, V = M.maxHeight > 0 ? M.maxHeight : w.height - j - P;
3650
3627
  return {
3651
3628
  position: "before",
3652
- placeholderOrientation: F,
3629
+ placeholderOrientation: $,
3653
3630
  rect: {
3654
- top: _,
3655
- left: R.left + D - 2,
3631
+ top: R,
3632
+ left: H.left + D - 2,
3656
3633
  width: 4,
3657
- height: M
3634
+ height: V
3658
3635
  },
3659
3636
  targetElement: O,
3660
3637
  targetBlockId: O.getAttribute("data-block-id"),
@@ -3664,38 +3641,38 @@ function detectDropZone(r, n, o, a, i) {
3664
3641
  }
3665
3642
  }
3666
3643
  } else {
3667
- const O = getChildBlocks(d), R = O[O.length - 1];
3668
- if (R) {
3669
- const _ = R.getBoundingClientRect();
3644
+ const O = getChildBlocks(d), H = O[O.length - 1];
3645
+ if (H) {
3646
+ const R = H.getBoundingClientRect();
3670
3647
  if (p === "vertical") {
3671
- const M = A.width - T - N, $ = A.left + D + T;
3648
+ const V = w.width - T - N, W = w.left + D + T;
3672
3649
  return {
3673
3650
  position: "after",
3674
- placeholderOrientation: F,
3651
+ placeholderOrientation: $,
3675
3652
  rect: {
3676
- top: _.bottom + L - 2,
3677
- left: $,
3678
- width: M,
3653
+ top: R.bottom + L - 2,
3654
+ left: W,
3655
+ width: V,
3679
3656
  height: 4
3680
3657
  },
3681
- targetElement: R,
3682
- targetBlockId: R.getAttribute("data-block-id"),
3658
+ targetElement: H,
3659
+ targetBlockId: H.getAttribute("data-block-id"),
3683
3660
  targetParentId: u,
3684
3661
  confidence: 0.9
3685
3662
  };
3686
3663
  } else {
3687
- const M = A.top + L + j, $ = H.maxHeight > 0 ? H.maxHeight : A.height - j - P;
3664
+ const V = w.top + L + j, W = M.maxHeight > 0 ? M.maxHeight : w.height - j - P;
3688
3665
  return {
3689
3666
  position: "after",
3690
- placeholderOrientation: F,
3667
+ placeholderOrientation: $,
3691
3668
  rect: {
3692
- top: M,
3693
- left: _.right + D - 2,
3669
+ top: V,
3670
+ left: R.right + D - 2,
3694
3671
  width: 4,
3695
- height: $
3672
+ height: W
3696
3673
  },
3697
- targetElement: R,
3698
- targetBlockId: R.getAttribute("data-block-id"),
3674
+ targetElement: H,
3675
+ targetBlockId: H.getAttribute("data-block-id"),
3699
3676
  targetParentId: u,
3700
3677
  confidence: 0.9
3701
3678
  };
@@ -3706,12 +3683,12 @@ function detectDropZone(r, n, o, a, i) {
3706
3683
  }
3707
3684
  let x = calculateElementZone(r, n, o, m, p);
3708
3685
  if (f && x.position === "inside") {
3709
- const w = r.getBoundingClientRect();
3686
+ const A = r.getBoundingClientRect();
3710
3687
  p === "vertical" ? x = {
3711
- position: (o - w.top) / w.height < 0.5 ? "before" : "after",
3688
+ position: (o - A.top) / A.height < 0.5 ? "before" : "after",
3712
3689
  confidence: x.confidence
3713
3690
  } : x = {
3714
- position: (n - w.left) / w.width < 0.5 ? "before" : "after",
3691
+ position: (n - A.left) / A.width < 0.5 ? "before" : "after",
3715
3692
  confidence: x.confidence
3716
3693
  };
3717
3694
  }
@@ -3779,7 +3756,7 @@ function getSiblingsInSameRow(r, n, o) {
3779
3756
  }
3780
3757
  function calculatePlaceholderRect(r, n, o, a, i) {
3781
3758
  var j, P;
3782
- const l = r.getBoundingClientRect(), c = window.getComputedStyle(r), d = ((j = i.defaultView) == null ? void 0 : j.scrollY) || 0, u = ((P = i.defaultView) == null ? void 0 : P.scrollX) || 0, p = parseFloat(c.marginTop) || 0, h = parseFloat(c.marginBottom) || 0, f = parseFloat(c.marginLeft) || 0, m = parseFloat(c.marginRight) || 0, g = parseFloat(c.paddingTop) || 0, b = parseFloat(c.paddingBottom) || 0, x = parseFloat(c.paddingLeft) || 0, y = parseFloat(c.paddingRight) || 0, S = n == null ? void 0 : n.getBoundingClientRect(), k = n && parseFloat(window.getComputedStyle(n).paddingLeft) || 0, C = n && parseFloat(window.getComputedStyle(n).paddingRight) || 0, E = n && parseFloat(window.getComputedStyle(n).paddingTop) || 0, B = n && parseFloat(window.getComputedStyle(n).paddingBottom) || 0, I = n ? getMaxSiblingDimensions(n) : { maxWidth: 0, maxHeight: 0 }, w = n ? getOrientation(n) : "vertical", A = n ? getChildBlocks(n) : [], v = getSiblingsInSameRow(A, r, w);
3759
+ const l = r.getBoundingClientRect(), c = window.getComputedStyle(r), d = ((j = i.defaultView) == null ? void 0 : j.scrollY) || 0, u = ((P = i.defaultView) == null ? void 0 : P.scrollX) || 0, p = parseFloat(c.marginTop) || 0, h = parseFloat(c.marginBottom) || 0, f = parseFloat(c.marginLeft) || 0, m = parseFloat(c.marginRight) || 0, g = parseFloat(c.paddingTop) || 0, b = parseFloat(c.paddingBottom) || 0, x = parseFloat(c.paddingLeft) || 0, y = parseFloat(c.paddingRight) || 0, S = n == null ? void 0 : n.getBoundingClientRect(), k = n && parseFloat(window.getComputedStyle(n).paddingLeft) || 0, C = n && parseFloat(window.getComputedStyle(n).paddingRight) || 0, E = n && parseFloat(window.getComputedStyle(n).paddingTop) || 0, B = n && parseFloat(window.getComputedStyle(n).paddingBottom) || 0, I = n ? getMaxSiblingDimensions(n) : { maxWidth: 0, maxHeight: 0 }, A = n ? getOrientation(n) : "vertical", w = n ? getChildBlocks(n) : [], v = getSiblingsInSameRow(w, r, A);
3783
3760
  let T = 0, N = 0;
3784
3761
  if (v.forEach((L) => {
3785
3762
  const D = L.getBoundingClientRect();
@@ -3794,7 +3771,7 @@ function calculatePlaceholderRect(r, n, o, a, i) {
3794
3771
  height: 4
3795
3772
  };
3796
3773
  } else {
3797
- const L = l.top + d, D = w === "horizontal" && T > 0 ? T : I.maxHeight > 0 ? I.maxHeight : S ? S.height - E - B : l.height;
3774
+ const L = l.top + d, D = A === "horizontal" && T > 0 ? T : I.maxHeight > 0 ? I.maxHeight : S ? S.height - E - B : l.height;
3798
3775
  return {
3799
3776
  top: L,
3800
3777
  left: l.left + u - f - 2,
@@ -3812,7 +3789,7 @@ function calculatePlaceholderRect(r, n, o, a, i) {
3812
3789
  height: 4
3813
3790
  };
3814
3791
  } else {
3815
- const L = l.top + d, D = w === "horizontal" && T > 0 ? T : I.maxHeight > 0 ? I.maxHeight : S ? S.height - E - B : l.height;
3792
+ const L = l.top + d, D = A === "horizontal" && T > 0 ? T : I.maxHeight > 0 ? I.maxHeight : S ? S.height - E - B : l.height;
3816
3793
  return {
3817
3794
  top: L,
3818
3795
  left: l.right + u + m - 2,
@@ -3915,11 +3892,11 @@ const useBlockDrop = () => {
3915
3892
  if (I)
3916
3893
  d([r._id], C === null ? void 0 : C, E), h(), p([]), u([r._id]);
3917
3894
  else {
3918
- const w = r._type || r.type, A = r != null && r.blocks ? isFunction$1(r == null ? void 0 : r.blocks) ? syncBlocksWithDefaults(r == null ? void 0 : r.blocks()) : r == null ? void 0 : r.blocks : null;
3895
+ const A = r._type || r.type, w = r != null && r.blocks ? isFunction$1(r == null ? void 0 : r.blocks) ? syncBlocksWithDefaults(r == null ? void 0 : r.blocks()) : r == null ? void 0 : r.blocks : null;
3919
3896
  c(
3920
- w === "PartialBlock" ? {
3921
- blocks: [{ _type: w, _id: "partial-block", partialBlockId: r.partialBlockId }]
3922
- } : (A == null ? void 0 : A.length) > 0 ? { blocks: [...A] } : { type: w },
3897
+ A === "PartialBlock" ? {
3898
+ blocks: [{ _type: A, _id: "partial-block", partialBlockId: r.partialBlockId }]
3899
+ } : (w == null ? void 0 : w.length) > 0 ? { blocks: [...w] } : { type: A },
3923
3900
  C,
3924
3901
  E
3925
3902
  );
@@ -4032,17 +4009,17 @@ const LEAF_BLOCK_TYPES = [
4032
4009
  return;
4033
4010
  }
4034
4011
  if (k && C) {
4035
- const B = 1 - E / AUTO_SCROLL_CONFIG.EDGE_ZONE, I = AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED + (AUTO_SCROLL_CONFIG.MAX_SCROLL_SPEED - AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED) * B, w = () => {
4012
+ const B = 1 - E / AUTO_SCROLL_CONFIG.EDGE_ZONE, I = AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED + (AUTO_SCROLL_CONFIG.MAX_SCROLL_SPEED - AUTO_SCROLL_CONFIG.MIN_SCROLL_SPEED) * B, A = () => {
4036
4013
  if (!isDragging || !m) {
4037
4014
  d.current = null;
4038
4015
  return;
4039
4016
  }
4040
- const A = C === "up" ? -I : I;
4041
- m.scrollBy(0, A);
4017
+ const w = C === "up" ? -I : I;
4018
+ m.scrollBy(0, w);
4042
4019
  const v = m.scrollY, T = v > 0, N = v + g < x, j = u.current, P = g - u.current;
4043
- C === "up" && T && j < AUTO_SCROLL_CONFIG.EDGE_ZONE || C === "down" && N && P < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(w) : d.current = null;
4020
+ C === "up" && T && j < AUTO_SCROLL_CONFIG.EDGE_ZONE || C === "down" && N && P < AUTO_SCROLL_CONFIG.EDGE_ZONE ? d.current = requestAnimationFrame(A) : d.current = null;
4044
4021
  };
4045
- d.current === null && (d.current = requestAnimationFrame(w));
4022
+ d.current === null && (d.current = requestAnimationFrame(A));
4046
4023
  }
4047
4024
  },
4048
4025
  [c]
@@ -4073,7 +4050,7 @@ const LEAF_BLOCK_TYPES = [
4073
4050
  return;
4074
4051
  const B = g.getAttribute("data-block-type") || "Box";
4075
4052
  let I = !1;
4076
- const w = LEAF_BLOCK_TYPES.includes(B);
4053
+ const A = LEAF_BLOCK_TYPES.includes(B);
4077
4054
  if (B === "Image" && S === "Image" && isDraggingOnlyImageBlock(r)) {
4078
4055
  i(b), o({
4079
4056
  isVisible: !0,
@@ -4091,7 +4068,7 @@ const LEAF_BLOCK_TYPES = [
4091
4068
  return;
4092
4069
  }
4093
4070
  if (E.position === "inside") {
4094
- if (w || y && !canDropWithoutCircularReference(y, b, l))
4071
+ if (A || y && !canDropWithoutCircularReference(y, b, l))
4095
4072
  return;
4096
4073
  I = canAcceptChildBlock(B, S);
4097
4074
  } else {
@@ -4105,7 +4082,7 @@ const LEAF_BLOCK_TYPES = [
4105
4082
  if (!I)
4106
4083
  return;
4107
4084
  i(E.targetParentId);
4108
- const A = E.targetParentId || x;
4085
+ const w = E.targetParentId || x;
4109
4086
  o({
4110
4087
  isVisible: !0,
4111
4088
  isValid: !0,
@@ -4117,7 +4094,7 @@ const LEAF_BLOCK_TYPES = [
4117
4094
  width: E.rect.width,
4118
4095
  height: E.rect.height,
4119
4096
  targetBlockId: E.targetBlockId,
4120
- targetParentId: A
4097
+ targetParentId: w
4121
4098
  }), removeDropTargetAttributes(c), E.targetElement.setAttribute("data-drop-target", "true");
4122
4099
  }, 300),
4123
4100
  [c, r, o, a, i, l, p]
@@ -4663,17 +4640,17 @@ class Content extends Component {
4663
4640
  class Frame extends Component {
4664
4641
  constructor(o, a) {
4665
4642
  super(o, a);
4666
- G(this, "setRef", (o) => {
4643
+ X(this, "setRef", (o) => {
4667
4644
  this.nodeRef.current = o;
4668
4645
  const { forwardedRef: a } = this.props;
4669
4646
  typeof a == "function" ? a(o) : a && (a.current = o);
4670
4647
  });
4671
- G(this, "handleLoad", () => {
4648
+ X(this, "handleLoad", () => {
4672
4649
  clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
4673
4650
  });
4674
4651
  // In certain situations on a cold cache DOMContentLoaded never gets called
4675
4652
  // fallback to an interval to check if that's the case
4676
- G(this, "loadCheck", () => setInterval(() => {
4653
+ X(this, "loadCheck", () => setInterval(() => {
4677
4654
  this.handleLoad();
4678
4655
  }, 500));
4679
4656
  this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
@@ -4710,7 +4687,7 @@ class Frame extends Component {
4710
4687
  return delete o.head, delete o.initialContent, delete o.mountTarget, delete o.contentDidMount, delete o.contentDidUpdate, delete o.forwardedRef, /* @__PURE__ */ jsx("iframe", { ...o, ref: this.setRef, onLoad: this.handleLoad, children: this.state.iframeLoaded && this.renderFrameContents() });
4711
4688
  }
4712
4689
  }
4713
- G(Frame, "defaultProps", {
4690
+ X(Frame, "defaultProps", {
4714
4691
  style: {},
4715
4692
  head: null,
4716
4693
  children: void 0,
@@ -6395,7 +6372,7 @@ class NodeRange {
6395
6372
  }
6396
6373
  }
6397
6374
  const emptyAttrs = /* @__PURE__ */ Object.create(null);
6398
- let Node$2 = class Y {
6375
+ let Node$2 = class ee {
6399
6376
  /**
6400
6377
  @internal
6401
6378
  */
@@ -6520,14 +6497,14 @@ let Node$2 = class Y {
6520
6497
  the given content (or empty, if no content is given).
6521
6498
  */
6522
6499
  copy(n = null) {
6523
- return n == this.content ? this : new Y(this.type, this.attrs, n, this.marks);
6500
+ return n == this.content ? this : new ee(this.type, this.attrs, n, this.marks);
6524
6501
  }
6525
6502
  /**
6526
6503
  Create a copy of this node, with the given set of marks instead
6527
6504
  of the node's own marks.
6528
6505
  */
6529
6506
  mark(n) {
6530
- return n == this.marks ? this : new Y(this.type, this.attrs, this.content, n);
6507
+ return n == this.marks ? this : new ee(this.type, this.attrs, this.content, n);
6531
6508
  }
6532
6509
  /**
6533
6510
  Create a copy of this node with only the content between the
@@ -10610,8 +10587,8 @@ const splitBlock = ({ keepMarks: r = !0 } = {}) => ({ tr: n, state: o, dispatch:
10610
10587
  if (i) {
10611
10588
  let S = Fragment.empty;
10612
10589
  const k = u.index(-1) ? 1 : u.index(-2) ? 2 : 3;
10613
- for (let A = u.depth - k; A >= u.depth - 3; A -= 1)
10614
- S = Fragment.from(u.node(A).copy(S));
10590
+ for (let w = u.depth - k; w >= u.depth - 3; w -= 1)
10591
+ S = Fragment.from(u.node(w).copy(S));
10615
10592
  const C = u.indexAfter(-1) < u.node(-2).childCount ? 1 : u.indexAfter(-2) < u.node(-3).childCount ? 2 : 3, E = {
10616
10593
  ...getSplittedAttributes(m, u.node().type.name, u.node().attrs),
10617
10594
  ...n
@@ -10619,12 +10596,12 @@ const splitBlock = ({ keepMarks: r = !0 } = {}) => ({ tr: n, state: o, dispatch:
10619
10596
  S = S.append(Fragment.from(d.createAndFill(null, B) || void 0));
10620
10597
  const I = u.before(u.depth - (k - 1));
10621
10598
  o.replace(I, u.after(-C), new Slice(S, 4 - k, 0));
10622
- let w = -1;
10623
- o.doc.nodesBetween(I, o.doc.content.size, (A, v) => {
10624
- if (w > -1)
10599
+ let A = -1;
10600
+ o.doc.nodesBetween(I, o.doc.content.size, (w, v) => {
10601
+ if (A > -1)
10625
10602
  return !1;
10626
- A.isTextblock && A.content.size === 0 && (w = v + 1);
10627
- }), w > -1 && o.setSelection(TextSelection.near(o.doc.resolve(w))), o.scrollIntoView();
10603
+ w.isTextblock && w.content.size === 0 && (A = v + 1);
10604
+ }), A > -1 && o.setSelection(TextSelection.near(o.doc.resolve(A))), o.scrollIntoView();
10628
10605
  }
10629
10606
  return !0;
10630
10607
  }
@@ -10680,8 +10657,8 @@ const splitBlock = ({ keepMarks: r = !0 } = {}) => ({ tr: n, state: o, dispatch:
10680
10657
  return u().command(() => (l.setNodeMarkup(B.pos, g), !0)).command(() => joinListBackwards(l, g)).command(() => joinListForwards(l, g)).run();
10681
10658
  }
10682
10659
  return !o || !E || !d ? u().command(() => h().wrapInList(g, a) ? !0 : p.clearNodes()).wrapInList(g, a).command(() => joinListBackwards(l, g)).command(() => joinListForwards(l, g)).run() : u().command(() => {
10683
- const I = h().wrapInList(g, a), w = E.filter((A) => m.includes(A.type.name));
10684
- return l.ensureMarks(w), I ? !0 : p.clearNodes();
10660
+ const I = h().wrapInList(g, a), A = E.filter((w) => m.includes(w.type.name));
10661
+ return l.ensureMarks(A), I ? !0 : p.clearNodes();
10685
10662
  }).wrapInList(g, a).command(() => joinListBackwards(l, g)).command(() => joinListForwards(l, g)).run();
10686
10663
  }, toggleMark = (r, n = {}, o = {}) => ({ state: a, commands: i }) => {
10687
10664
  const { extendEmptyMarkRange: l = !1 } = o, c = getMarkType(r, a.schema);
@@ -11222,28 +11199,28 @@ const RichTextEditor = memo(
11222
11199
  ({ block: r, children: n }) => {
11223
11200
  const o = "content", { document: a } = useFrame(), { editingBlockId: i, editingItemIndex: l, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [u, p] = useState(null), h = useRef(null), { clearHighlight: f } = useBlockHighlight(), m = useUpdateBlocksProps(), { selectedLang: g } = useLanguages(), [, b] = useSelectedBlockIds(), x = useRef(null), y = i, { blockContent: S, blockType: k } = useMemo(() => {
11224
11201
  var N;
11225
- const w = r._type;
11226
- let A = r[o];
11202
+ const A = r._type;
11203
+ let w = r[o];
11227
11204
  const v = getRegisteredChaiBlock(r._type);
11228
- return g && ((N = v == null ? void 0 : v.i18nProps) == null ? void 0 : N.includes(o)) && has(r, `${o}-${g}`) && (A = get(r, `${o}-${g}`)), { blockContent: A, blockType: w };
11205
+ return g && ((N = v == null ? void 0 : v.i18nProps) == null ? void 0 : N.includes(o)) && has(r, `${o}-${g}`) && (w = get(r, `${o}-${g}`)), { blockContent: w, blockType: A };
11229
11206
  }, [r, g]), C = useCallback(
11230
- (w) => {
11207
+ (A) => {
11231
11208
  var v;
11232
- const A = w || ((v = h.current) == null ? void 0 : v.innerText);
11233
- m([y], { [o]: A }), p(null), c(null), d(-1), b([]), y && setTimeout(() => b([y]), 100);
11209
+ const w = A || ((v = h.current) == null ? void 0 : v.innerText);
11210
+ m([y], { [o]: w }), p(null), c(null), d(-1), b([]), y && setTimeout(() => b([y]), 100);
11234
11211
  },
11235
11212
  [y, m, c, b, g]
11236
11213
  ), E = useDebouncedCallback(
11237
- (w) => {
11238
- m([y], { [o]: w });
11214
+ (A) => {
11215
+ m([y], { [o]: A });
11239
11216
  },
11240
11217
  [y, r, m, g],
11241
11218
  1e3
11242
11219
  ), B = useCallback(
11243
- (w) => {
11244
- w.preventDefault(), y && (x.current = y), C(), setTimeout(() => {
11245
- const A = x.current;
11246
- x.current = null, b([A]);
11220
+ (A) => {
11221
+ A.preventDefault(), y && (x.current = y), C(), setTimeout(() => {
11222
+ const w = x.current;
11223
+ x.current = null, b([w]);
11247
11224
  }, 100);
11248
11225
  },
11249
11226
  [b, y, g]
@@ -11251,7 +11228,7 @@ const RichTextEditor = memo(
11251
11228
  useEffect(() => {
11252
11229
  var T;
11253
11230
  if (!y) return;
11254
- const w = `[data-block-id="${y}"]`, A = l >= 0 ? `[data-block-index="${l}"]` : "", v = a.querySelector(`${w}${A}`);
11231
+ const A = `[data-block-id="${y}"]`, w = l >= 0 ? `[data-block-index="${l}"]` : "", v = a.querySelector(`${A}${w}`);
11255
11232
  v && ((T = v == null ? void 0 : v.classList) == null || T.add("sr-only"), p(v));
11256
11233
  }, [y, k, a, l]);
11257
11234
  const I = useMemo(() => u ? (f(), ["RichText", "Paragraph"].includes(k) ? /* @__PURE__ */ jsx(
@@ -11320,7 +11297,7 @@ const RichTextEditor = memo(
11320
11297
  ), I = useMemo(
11321
11298
  () => p(l._id, getBlockRuntimeProps(l._type)),
11322
11299
  [l._id, l._type, p, getBlockRuntimeProps]
11323
- ), w = useMemo(() => {
11300
+ ), A = useMemo(() => {
11324
11301
  const P = {
11325
11302
  "data-block-id": l._id,
11326
11303
  "data-block-type": l._type,
@@ -11333,9 +11310,9 @@ const RichTextEditor = memo(
11333
11310
  onDragStart: C.onDragStart,
11334
11311
  onDragEnd: C.onDragEnd
11335
11312
  } : P;
11336
- }, [l._id, l._type, g, k, S, C, a]), A = useMemo(
11313
+ }, [l._id, l._type, g, k, S, C, a]), w = useMemo(
11337
11314
  () => ({
11338
- blockProps: w,
11315
+ blockProps: A,
11339
11316
  inBuilder: x === "edit",
11340
11317
  lang: d || u,
11341
11318
  pageData: h,
@@ -11344,11 +11321,11 @@ const RichTextEditor = memo(
11344
11321
  ...I,
11345
11322
  ...r
11346
11323
  }),
11347
- [x, w, d, u, E, B, I, r]
11324
+ [x, A, d, u, E, B, I, r]
11348
11325
  ), v = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]), T = useMemo(() => get(l, "_show", !0), [l]);
11349
11326
  if (isNull(m) || !T) return null;
11350
11327
  let N = /* @__PURE__ */ jsx(Suspense, { children: createElement(m, {
11351
- ...A,
11328
+ ...w,
11352
11329
  children: o({
11353
11330
  _id: l._id,
11354
11331
  _type: l._type,
@@ -11531,7 +11508,7 @@ const RichTextEditor = memo(
11531
11508
  /* @__PURE__ */ jsx("p", { className: "font-semibold", children: r("Oops! Something went wrong.") }),
11532
11509
  /* @__PURE__ */ jsx("p", { children: r("Please try again.") })
11533
11510
  ] }) });
11534
- }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-Bbeel8oa.js")), CanvasArea = () => {
11511
+ }, CodeEditor$1 = React__default.lazy(() => import("./code-editor-DPr4HDOV.js")), CanvasArea = () => {
11535
11512
  const [r] = useCodeEditor(), n = useBuilderProp("onError", noop);
11536
11513
  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: [
11537
11514
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsx(StaticCanvas, {}) }) }),
@@ -11679,13 +11656,13 @@ const PLACEHOLDER_IMAGE = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWl
11679
11656
  n(C == null ? void 0 : C.url);
11680
11657
  const E = C == null ? void 0 : C.width, B = C == null ? void 0 : C.height, I = h.includes("mobile");
11681
11658
  if (c != null && c._id) {
11682
- const w = {
11659
+ const A = {
11683
11660
  ...E && { [I ? "mobileWidth" : "width"]: E },
11684
11661
  ...B && { [I ? "mobileHeight" : "height"]: B },
11685
11662
  ...C.description && { alt: C.description }
11686
11663
  };
11687
- if (set(w, h, C.id), isEmpty(w)) return;
11688
- d([c._id], w);
11664
+ if (set(A, h, C.id), isEmpty(A)) return;
11665
+ d([c._id], A);
11689
11666
  }
11690
11667
  }
11691
11668
  }, y = useCallback(() => {
@@ -11858,8 +11835,8 @@ const DataBindingSelector = ({
11858
11835
  }
11859
11836
  const g = (S) => /[.,!?;:]/.test(S), b = (S, k, C) => {
11860
11837
  let E = "", B = "";
11861
- const I = k > 0 ? S[k - 1] : "", w = k < S.length ? S[k] : "";
11862
- return k > 0 && (I === "." || !g(I) && I !== " ") && (E = " "), k < S.length && !g(w) && w !== " " && (B = " "), {
11838
+ const I = k > 0 ? S[k - 1] : "", A = k < S.length ? S[k] : "";
11839
+ return k > 0 && (I === "." || !g(I) && I !== " ") && (E = " "), k < S.length && !g(A) && A !== " " && (B = " "), {
11863
11840
  text: E + C + B,
11864
11841
  prefixLength: E.length,
11865
11842
  suffixLength: B.length
@@ -11876,9 +11853,9 @@ const DataBindingSelector = ({
11876
11853
  if (C !== E)
11877
11854
  S.chain().deleteSelection().insertContent(k).run();
11878
11855
  else {
11879
- const { state: I } = S, w = I.selection.from, A = I.doc.textBetween(Math.max(0, w - 1), w), v = I.doc.textBetween(w, Math.min(w + 1, I.doc.content.size));
11856
+ const { state: I } = S, A = I.selection.from, w = I.doc.textBetween(Math.max(0, A - 1), A), v = I.doc.textBetween(A, Math.min(A + 1, I.doc.content.size));
11880
11857
  let T = "";
11881
- w > 0 && A !== " " && !g(A) && (T = " ");
11858
+ A > 0 && w !== " " && !g(w) && (T = " ");
11882
11859
  let N = "";
11883
11860
  v && v !== " " && !g(v) && (N = " "), S.chain().insertContent(T + k + N).run();
11884
11861
  }
@@ -11892,8 +11869,8 @@ const DataBindingSelector = ({
11892
11869
  n(N, {}, o);
11893
11870
  return;
11894
11871
  }
11895
- const I = `{{${f}}}`, { text: w } = b(C, k, I), A = C.slice(0, k) + w + C.slice(k);
11896
- n(A, {}, o);
11872
+ const I = `{{${f}}}`, { text: A } = b(C, k, I), w = C.slice(0, k) + A + C.slice(k);
11873
+ n(w, {}, o);
11897
11874
  }
11898
11875
  },
11899
11876
  [o, n, a, d == null ? void 0 : d._id, u]
@@ -11914,8 +11891,8 @@ const DataBindingSelector = ({
11914
11891
  pageTypes: n,
11915
11892
  onChange: o
11916
11893
  }) => {
11917
- var A;
11918
- const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (v, T) => []), [l, c] = useState(!1), [d, u] = useState(!1), [p, h] = useState("page"), [f, m] = useState(""), [g, b] = useState([]), [x, y] = useState(-1), S = useRef(null), k = (A = n == null ? void 0 : n.find((v) => v.key === p)) == null ? void 0 : A.name;
11894
+ var w;
11895
+ const { t: a } = useTranslation(), i = useBuilderProp("searchPageTypeItems", (v, T) => []), [l, c] = useState(!1), [d, u] = useState(!1), [p, h] = useState("page"), [f, m] = useState(""), [g, b] = useState([]), [x, y] = useState(-1), S = useRef(null), k = (w = n == null ? void 0 : n.find((v) => v.key === p)) == null ? void 0 : w.name;
11919
11896
  useEffect(() => {
11920
11897
  if (m(""), b([]), y(-1), u(!1), !r || l || !startsWith(r, "pageType:")) return;
11921
11898
  const v = split(r, ":"), T = get(v, 1, "page") || "page";
@@ -11964,7 +11941,7 @@ const DataBindingSelector = ({
11964
11941
  }, [x]);
11965
11942
  const I = () => {
11966
11943
  m(""), b([]), y(-1), u(!1), o("");
11967
- }, w = (v) => {
11944
+ }, A = (v) => {
11968
11945
  m(v), u(!isEmpty(v)), c(!0), C(v);
11969
11946
  };
11970
11947
  return /* @__PURE__ */ jsxs("div", { children: [
@@ -11975,7 +11952,7 @@ const DataBindingSelector = ({
11975
11952
  {
11976
11953
  type: "text",
11977
11954
  value: f,
11978
- onChange: (v) => w(v.target.value),
11955
+ onChange: (v) => A(v.target.value),
11979
11956
  onKeyDown: B,
11980
11957
  placeholder: a(`Search ${k ?? ""}`),
11981
11958
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
@@ -12100,7 +12077,7 @@ const DataBindingSelector = ({
12100
12077
  ]
12101
12078
  }
12102
12079
  ) });
12103
- }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-DbOJAIEv.js")), RichTextEditorFieldComp = ({ blockId: r, id: n, placeholder: o, value: a, onChange: i, onBlur: l }) => {
12080
+ }, RTEModal = React__default.lazy(() => import("./rte-widget-modal-CsBCpJSY.js")), RichTextEditorFieldComp = ({ blockId: r, id: n, placeholder: o, value: a, onChange: i, onBlur: l }) => {
12104
12081
  const c = useRef(null), [d, u] = useState(!1), p = useRTEditor({
12105
12082
  blockId: r,
12106
12083
  value: a,
@@ -12356,7 +12333,7 @@ const DataBindingSelector = ({
12356
12333
  if (d)
12357
12334
  return null;
12358
12335
  if (p.type === "boolean") return /* @__PURE__ */ jsx("div", { className: o, children: i });
12359
- const A = E == null ? void 0 : E.includes(n.replace("root.", ""));
12336
+ const w = E == null ? void 0 : E.includes(n.replace("root.", ""));
12360
12337
  if (p.type === "array") {
12361
12338
  const N = B === n;
12362
12339
  return /* @__PURE__ */ jsxs("div", { className: `${o} relative`, children: [
@@ -12400,7 +12377,7 @@ const DataBindingSelector = ({
12400
12377
  /* @__PURE__ */ jsxs("label", { htmlFor: n, className: p.type === "object" ? "pb-2" : "", children: [
12401
12378
  a,
12402
12379
  " ",
12403
- A && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
12380
+ w && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
12404
12381
  " ",
12405
12382
  y
12406
12383
  ] }),
@@ -12551,11 +12528,11 @@ const DataBindingSelector = ({
12551
12528
  }), a;
12552
12529
  };
12553
12530
  function BlockSettings() {
12554
- const { selectedLang: r } = useLanguages(), n = useSelectedBlock(), o = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), i = getRegisteredChaiBlock(n == null ? void 0 : n._type), l = formDataWithSelectedLang(n, r, i), [c, d] = useState(l), [u, p] = useState(!1), h = useWrapperBlock(), f = getRegisteredChaiBlock(h == null ? void 0 : h._type), m = formDataWithSelectedLang(h, r, f), g = ({ formData: B }, I, w) => {
12555
- I && (c == null ? void 0 : c._id) === n._id && a([n._id], { [I]: get(B, I) }, w);
12531
+ const { selectedLang: r } = useLanguages(), n = useSelectedBlock(), o = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), i = getRegisteredChaiBlock(n == null ? void 0 : n._type), l = formDataWithSelectedLang(n, r, i), [c, d] = useState(l), [u, p] = useState(!1), h = useWrapperBlock(), f = getRegisteredChaiBlock(h == null ? void 0 : h._type), m = formDataWithSelectedLang(h, r, f), g = ({ formData: B }, I, A) => {
12532
+ I && (c == null ? void 0 : c._id) === n._id && a([n._id], { [I]: get(B, I) }, A);
12556
12533
  }, b = useCallback(
12557
- debounce(({ formData: B }, I, w) => {
12558
- g({ formData: B }, I, w), d(B);
12534
+ debounce(({ formData: B }, I, A) => {
12535
+ g({ formData: B }, I, A), d(B);
12559
12536
  }, 1500),
12560
12537
  [n == null ? void 0 : n._id, r]
12561
12538
  ), x = ({ formData: B }, I) => {
@@ -12567,20 +12544,20 @@ function BlockSettings() {
12567
12544
  if (!B)
12568
12545
  return { schema: {}, uiSchema: {} };
12569
12546
  try {
12570
- const { schema: I, uiSchema: w } = getBlockFormSchemas(B);
12547
+ const { schema: I, uiSchema: A } = getBlockFormSchemas(B);
12571
12548
  if (B === "Repeater") {
12572
- const A = get(n, "repeaterItems", "");
12573
- startsWith(A, `{{${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" }));
12549
+ const w = get(n, "repeaterItems", "");
12550
+ startsWith(w, `{{${COLLECTION_PREFIX}`) ? (set(A, "filter", { "ui:widget": "collectionSelect" }), set(A, "sort", { "ui:widget": "collectionSelect" })) : (set(A, "filter", { "ui:widget": "hidden" }), set(A, "sort", { "ui:widget": "hidden" }));
12574
12551
  }
12575
- return { schema: I, uiSchema: w };
12552
+ return { schema: I, uiSchema: A };
12576
12553
  } catch {
12577
12554
  return { schema: {}, uiSchema: {} };
12578
12555
  }
12579
12556
  }, [n]), { wrapperSchema: C, wrapperUiSchema: E } = useMemo(() => {
12580
12557
  if (!h || !(h != null && h._type))
12581
12558
  return { wrapperSchema: {}, wrapperUiSchema: {} };
12582
- const B = h == null ? void 0 : h._type, { schema: I = {}, uiSchema: w = {} } = getBlockFormSchemas(B);
12583
- return { wrapperSchema: I, wrapperUiSchema: w };
12559
+ const B = h == null ? void 0 : h._type, { schema: I = {}, uiSchema: A = {} } = getBlockFormSchemas(B);
12560
+ return { wrapperSchema: I, wrapperUiSchema: A };
12584
12561
  }, [h]);
12585
12562
  return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
12586
12563
  !isEmpty(h) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
@@ -12840,7 +12817,7 @@ const BlockStylingProps = () => {
12840
12817
  }
12841
12818
  m(T), i(T === "class" || isEmpty(v) ? "" : v);
12842
12819
  }, [l, u, p]);
12843
- const B = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), I = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), w = useCallback(
12820
+ const B = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), I = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), A = useCallback(
12844
12821
  (v = !1) => {
12845
12822
  const T = getUserInputValues(`${a}`, p);
12846
12823
  if (get(T, "error", !1)) {
@@ -12858,7 +12835,7 @@ const BlockStylingProps = () => {
12858
12835
  v ? I(P) : B(P);
12859
12836
  },
12860
12837
  [B, I, a, f, d, p]
12861
- ), A = useCallback(
12838
+ ), w = useCallback(
12862
12839
  (v) => {
12863
12840
  const T = getUserInputValues(`${a}`, p);
12864
12841
  if (get(T, "error", !1)) {
@@ -12896,7 +12873,7 @@ const BlockStylingProps = () => {
12896
12873
  {
12897
12874
  readOnly: f === "class",
12898
12875
  onKeyPress: (v) => {
12899
- v.key === "Enter" && w();
12876
+ v.key === "Enter" && A();
12900
12877
  },
12901
12878
  onKeyDown: (v) => {
12902
12879
  if (v.keyCode !== 38 && v.keyCode !== 40)
@@ -12911,7 +12888,7 @@ const BlockStylingProps = () => {
12911
12888
  onKeyUp: (v) => {
12912
12889
  C && (v.preventDefault(), E(!1));
12913
12890
  },
12914
- onBlur: () => w(),
12891
+ onBlur: () => A(),
12915
12892
  onChange: (v) => {
12916
12893
  b(!1), i(v.target.value);
12917
12894
  },
@@ -12945,7 +12922,7 @@ const BlockStylingProps = () => {
12945
12922
  units: p,
12946
12923
  current: f,
12947
12924
  onSelect: (v) => {
12948
- o(!1), m(v), A(v);
12925
+ o(!1), m(v), w(v);
12949
12926
  }
12950
12927
  }
12951
12928
  ) })
@@ -13430,11 +13407,11 @@ const COLOR_PROP = {
13430
13407
  }, getBreakpoint = (r) => `${r.toUpperCase()} ${BREAKPOINTS[r] ? `(${BREAKPOINTS[r]} & up)` : ""}`, BlockStyle = (r) => {
13431
13408
  const { t: n } = useTranslation(), { type: o = "icons", label: a, property: i, onEmitChange: l = () => {
13432
13409
  }, units: c, negative: d = !1 } = r, [u] = useDarkMode(), [p] = useStylingState(), [, h] = useScreenSizeWidth(), f = useCurrentClassByProperty(i), m = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), x = useMemo(() => get(f, "fullCls", ""), [f]), y = useCallback(
13433
- (I, w = !0) => {
13434
- const A = { dark: u, mq: h, mod: p, cls: I, property: i, fullCls: "" };
13435
- (u || p !== "") && (A.mq = "xs");
13436
- const v = generateFullClsName(A);
13437
- m(b, [v], w);
13410
+ (I, A = !0) => {
13411
+ const w = { dark: u, mq: h, mod: p, cls: I, property: i, fullCls: "" };
13412
+ (u || p !== "") && (w.mq = "xs");
13413
+ const v = generateFullClsName(w);
13414
+ m(b, [v], A);
13438
13415
  },
13439
13416
  [b, u, h, p, i, m]
13440
13417
  ), S = useCallback(() => {
@@ -13770,205 +13747,218 @@ function BreakpointSelector() {
13770
13747
  ] }) }) })
13771
13748
  ] });
13772
13749
  }
13773
- const DesignTokensIcon = ({ className: r = "" }) => /* @__PURE__ */ jsx(FontStyleIcon, { className: r });
13774
- function ManualClasses() {
13775
- var O;
13776
- const r = useRef(null), [n, o] = useState(""), [a, i] = useState(-1), [, l] = useRightPanel(), c = useFuseSearch(), { t: d } = useTranslation(), [u] = useSelectedStylingBlocks(), p = useSelectedBlock(), h = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), [g, b] = useState(""), x = useAtomValue$1(chaiDesignTokensAtom), y = (O = first$1(u)) == null ? void 0 : O.prop, { classes: S } = getSplitChaiClasses(get(p, y, "")), k = S.split(" ").filter((R) => !isEmpty(R)), C = useMemo(() => [...k].sort((R, _) => {
13777
- const M = R.startsWith(DESIGN_TOKEN_PREFIX), $ = _.startsWith(DESIGN_TOKEN_PREFIX);
13778
- return M && !$ ? -1 : !M && $ ? 1 : 0;
13779
- }), [k]), E = useBuilderProp("flags.copyPaste", !0), B = (R) => {
13780
- if (R.startsWith(DESIGN_TOKEN_PREFIX)) {
13781
- const _ = x[R];
13782
- return _ ? _.name : R;
13750
+ const DesignTokensIcon = ({ className: r = "" }) => /* @__PURE__ */ jsx(TokensIcon, { className: r });
13751
+ function ManualClasses({
13752
+ from: r = "default",
13753
+ classFromProps: n,
13754
+ onAddNew: o,
13755
+ onRemove: a
13756
+ }) {
13757
+ var G;
13758
+ const i = useRef(null), [l, c] = useState(""), [d, u] = useState(!1), [p, h] = useState(-1), [, f] = useRightPanel(), m = useFuseSearch(), { t: g } = useTranslation(), [b] = useSelectedStylingBlocks(), x = useSelectedBlock(), y = useAddClassesToBlocks(), S = useRemoveClassesFromBlocks(), [k] = useSelectedBlockIds(), [C, E] = useState(""), B = useAtomValue$1(chaiDesignTokensAtom), I = (G = first$1(b)) == null ? void 0 : G.prop, { classes: A } = getSplitChaiClasses(get(x, I, "")), v = (r === "default" ? A : n ?? "").split(" ").filter((_) => !isEmpty(_)), T = useMemo(() => [...v].sort((_, F) => {
13759
+ const z = _.startsWith(DESIGN_TOKEN_PREFIX), U = F.startsWith(DESIGN_TOKEN_PREFIX);
13760
+ return z && !U ? -1 : !z && U ? 1 : 0;
13761
+ }), [v]), N = useBuilderProp("flags.copyPaste", !0), j = (_) => {
13762
+ if (_.startsWith(DESIGN_TOKEN_PREFIX)) {
13763
+ const F = B[_];
13764
+ return F ? F.name : _;
13783
13765
  }
13784
- return R;
13785
- }, I = (R) => {
13786
- const _ = Object.entries(x).find(([M, $]) => $.name === R);
13787
- return _ ? `${_[0]}` : R;
13788
- }, w = () => {
13789
- const R = g.trim().replace(/ +(?= )/g, "").split(" ").map(I);
13790
- h(m, R, !0), b("");
13791
- }, [A, v] = useState([]), T = useBuilderProp("flags.designTokens", !1), N = ({ value: R }) => {
13792
- const _ = R.trim().toLowerCase(), M = _.match(/.+:/g);
13793
- let $ = [], U = [];
13794
- if (T && (_ === "" ? U = Object.entries(x).map(([V, z]) => ({
13795
- name: z.name,
13796
- id: `${V}`,
13766
+ return _;
13767
+ }, P = (_) => {
13768
+ const F = Object.entries(B).find(([z, U]) => U.name === _);
13769
+ return F ? `${F[0]}` : _;
13770
+ }, L = () => {
13771
+ const _ = C.trim().replace(/ +(?= )/g, "").split(" ").map(P);
13772
+ r === "designToken" ? isFunction$1(o) && o(_) : y(k, _, !0), E("");
13773
+ }, [D, $] = useState([]), M = useBuilderProp("flags.designTokens", !1), O = ({ value: _ }) => {
13774
+ const F = _.trim().toLowerCase(), z = F.match(/.+:/g);
13775
+ let U = [], q = [];
13776
+ if (M && (F === "" ? q = Object.entries(B).map(([J, Y]) => ({
13777
+ name: Y.name,
13778
+ id: `${J}`,
13797
13779
  isDesignToken: !0
13798
- })) : U = Object.entries(x).filter(([V, z]) => z.name.toLowerCase().includes(_)).map(([V, z]) => ({
13799
- name: z.name,
13800
- id: `${V}`,
13780
+ })) : q = Object.entries(B).filter(([J, Y]) => Y.name.toLowerCase().includes(F)).map(([J, Y]) => ({
13781
+ name: Y.name,
13782
+ id: `${J}`,
13801
13783
  isDesignToken: !0
13802
- }))), M && M.length > 0) {
13803
- const [V] = M, z = _.replace(V, "");
13804
- $ = c.search(z).map((K) => ({
13805
- ...K,
13806
- item: { ...K.item, name: V + K.item.name }
13784
+ }))), z && z.length > 0) {
13785
+ const [J] = z, Y = F.replace(J, "");
13786
+ U = m.search(Y).map((Q) => ({
13787
+ ...Q,
13788
+ item: { ...Q.item, name: J + Q.item.name }
13807
13789
  }));
13808
13790
  } else
13809
- $ = c.search(_);
13810
- const W = [...U, ...map($, "item")];
13811
- return v(W);
13812
- }, j = () => {
13813
- v([]);
13814
- }, P = (R) => R.name, L = (R) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md p-1", children: [
13815
- R.isDesignToken && /* @__PURE__ */ jsx(DesignTokensIcon, { className: "h-4 w-4 text-gray-600" }),
13816
- /* @__PURE__ */ jsx("span", { children: R.name })
13817
- ] }), D = useMemo(
13791
+ U = m.search(F);
13792
+ const te = [...q, ...map(U, "item")];
13793
+ return $(te);
13794
+ }, H = () => {
13795
+ $([]);
13796
+ }, R = (_) => _.name, V = (_) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md p-1", children: [
13797
+ _.isDesignToken && /* @__PURE__ */ jsx(DesignTokensIcon, { className: "h-4 w-4 text-gray-600" }),
13798
+ /* @__PURE__ */ jsx("span", { children: _.name })
13799
+ ] }), W = useMemo(
13818
13800
  () => ({
13819
- ref: r,
13801
+ ref: i,
13820
13802
  autoComplete: "off",
13821
13803
  autoCorrect: "off",
13822
13804
  autoCapitalize: "off",
13823
13805
  spellCheck: !1,
13824
- placeholder: d("Enter classes separated by space"),
13825
- value: g,
13826
- onFocus: (R) => {
13806
+ placeholder: g("Enter classes separated by space"),
13807
+ value: C,
13808
+ onFocus: (_) => {
13827
13809
  setTimeout(() => {
13828
- R.target && R.target.select();
13810
+ _.target && _.target.select();
13829
13811
  }, 0);
13830
13812
  },
13831
- onKeyDown: (R) => {
13832
- if (R.key === "Enter" && g.trim() !== "" && (R.preventDefault(), w()), R.key === "Tab" && A.length > 0) {
13833
- R.preventDefault();
13834
- const _ = new KeyboardEvent("keydown", {
13813
+ onKeyDown: (_) => {
13814
+ if (_.key === "Enter" && C.trim() !== "" && (_.preventDefault(), L()), _.key === "Tab" && D.length > 0) {
13815
+ _.preventDefault();
13816
+ const F = new KeyboardEvent("keydown", {
13835
13817
  key: "ArrowDown",
13836
13818
  code: "ArrowDown",
13837
13819
  keyCode: 40,
13838
13820
  bubbles: !0
13839
13821
  });
13840
- R.target.dispatchEvent(_);
13822
+ _.target.dispatchEvent(F);
13841
13823
  }
13842
13824
  },
13843
- onChange: (R, { newValue: _ }) => b(_),
13844
- className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
13825
+ onChange: (_, { newValue: F }) => E(F),
13826
+ className: `w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border ${r === "default" ? "py-1" : "py-1.5"}`
13845
13827
  }),
13846
- [g, d, r, A.length]
13847
- ), F = (R) => {
13848
- const _ = n.trim().replace(/ +(?= )/g, "").split(" ").map(I);
13849
- f(m, [R]), h(m, _, !0), o(""), i(-1);
13850
- }, H = () => {
13828
+ [C, g, i, D.length]
13829
+ ), K = (_) => {
13830
+ const F = l.trim().replace(/ +(?= )/g, "").split(" ").map(P);
13831
+ S(k, [_]), y(k, F, !0), c(""), h(-1);
13832
+ }, Z = () => {
13851
13833
  if (navigator.clipboard === void 0) {
13852
- toast.error(d("Clipboard not supported"));
13834
+ toast.error(g("Clipboard not supported"));
13853
13835
  return;
13854
13836
  }
13855
- navigator.clipboard.writeText(k.join(" ")), toast.success(d("Classes copied to clipboard"));
13837
+ navigator.clipboard.writeText(v.join(" ")), toast.success(g("Classes copied to clipboard")), u(!0), setTimeout(() => u(!1), 2e3);
13856
13838
  };
13857
- return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
13858
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-x-2", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-x-2 text-muted-foreground", children: [
13859
- /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-1", children: [
13860
- /* @__PURE__ */ jsx("span", { children: d(T ? "Styles" : "Classes") }),
13861
- E && /* @__PURE__ */ jsxs(Tooltip, { children: [
13862
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: H, className: "cursor-pointer" }) }),
13863
- /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: d("Copy classes to clipboard") }) })
13864
- ] })
13865
- ] }),
13866
- T && /* @__PURE__ */ jsx(Button, { variant: "link", className: "underline", onClick: () => l("design-tokens"), children: d("Design Tokens") })
13867
- ] }) }),
13868
- /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-x-3", children: [
13869
- /* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
13870
- Autosuggest,
13871
- {
13872
- suggestions: A,
13873
- onSuggestionsFetchRequested: N,
13874
- onSuggestionsClearRequested: j,
13875
- getSuggestionValue: P,
13876
- renderSuggestion: L,
13877
- inputProps: D,
13878
- onSuggestionSelected: (R, { suggestionValue: _ }) => {
13879
- const M = I(_);
13880
- h(m, [M], !0), b("");
13881
- },
13882
- containerProps: {
13883
- className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
13884
- },
13885
- theme: {
13886
- suggestion: "bg-transparent",
13887
- suggestionHighlighted: "!bg-gray-300 dark:!bg-gray-800 cursor-pointer",
13888
- suggestionsContainerOpen: "absolute bg-background no-scrollbar z-50 max-h-[230px] overflow-y-auto w-full border border-border rounded-md"
13889
- }
13890
- }
13891
- ) }),
13892
- /* @__PURE__ */ jsx(
13893
- Button,
13894
- {
13895
- variant: "outline",
13896
- className: "h-6 border-border",
13897
- onClick: w,
13898
- disabled: g.trim() === "",
13899
- size: "sm",
13900
- children: /* @__PURE__ */ jsx(PlusIcon, {})
13901
- }
13902
- )
13903
- ] }),
13904
- /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: C.map(
13905
- (R, _) => a === _ ? /* @__PURE__ */ jsx(
13906
- "input",
13907
- {
13908
- ref: r,
13909
- value: n,
13910
- onChange: (M) => o(M.target.value),
13911
- onBlur: () => {
13912
- F(R);
13913
- },
13914
- onKeyDown: (M) => {
13915
- M.key === "Enter" && F(R);
13916
- },
13917
- onFocus: (M) => {
13918
- setTimeout(() => {
13919
- M.target.select();
13920
- }, 0);
13921
- },
13922
- className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"
13923
- },
13924
- R
13925
- ) : /* @__PURE__ */ jsx("div", { className: "group relative flex max-w-[260px] items-center", children: /* @__PURE__ */ jsxs(
13926
- "button",
13927
- {
13928
- onDoubleClick: () => {
13929
- b(B(R)), f(m, [R]), setTimeout(() => {
13930
- r.current && r.current.focus();
13931
- }, 10);
13932
- },
13933
- className: "flex h-max cursor-default items-center gap-x-1 truncate break-words rounded bg-gray-200 py-px pl-0.5 pr-1 text-[11px] text-gray-600 dark:bg-gray-800 dark:text-gray-300",
13934
- children: [
13935
- /* @__PURE__ */ jsxs("div", { className: "z-10 flex h-full w-max items-center justify-center", children: [
13936
- /* @__PURE__ */ jsx(
13937
- Cross2Icon,
13938
- {
13939
- onClick: () => f(m, [R], !0),
13940
- 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"
13941
- }
13942
- ),
13943
- R.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(
13944
- "svg",
13945
- {
13946
- className: "h-3.5 w-3.5 group-hover:hidden",
13947
- fill: "rgba(55, 65, 81, 0.4)",
13948
- viewBox: "0 0 24 24",
13949
- xmlns: "http://www.w3.org/2000/svg",
13950
- xmlSpace: "preserve",
13951
- children: [
13952
- /* @__PURE__ */ jsx("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
13953
- /* @__PURE__ */ jsx("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
13954
- /* @__PURE__ */ jsx("g", { id: "SVGRepo_iconCarrier", children: /* @__PURE__ */ jsx(
13955
- "path",
13956
- {
13957
- fillRule: "evenodd",
13958
- clipRule: "evenodd",
13959
- d: "M12 6.036c-2.667 0-4.333 1.325-5 3.976 1-1.325 2.167-1.822 3.5-1.491.761.189 1.305.738 1.906 1.345C13.387 10.855 14.522 12 17 12c2.667 0 4.333-1.325 5-3.976-1 1.325-2.166 1.822-3.5 1.491-.761-.189-1.305-.738-1.907-1.345-.98-.99-2.114-2.134-4.593-2.134zM7 12c-2.667 0-4.333 1.325-5 3.976 1-1.326 2.167-1.822 3.5-1.491.761.189 1.305.738 1.907 1.345.98.989 2.115 2.134 4.594 2.134 2.667 0 4.333-1.325 5-3.976-1 1.325-2.167 1.822-3.5 1.491-.761-.189-1.305-.738-1.906-1.345C10.613 13.145 9.478 12 7 12z"
13960
- }
13961
- ) })
13962
- ]
13963
- }
13964
- )
13965
- ] }),
13966
- /* @__PURE__ */ jsx("div", { children: B(R) })
13967
- ]
13968
- }
13969
- ) }, R)
13970
- ) })
13971
- ] });
13839
+ return /* @__PURE__ */ jsxs(
13840
+ "div",
13841
+ {
13842
+ className: `flex w-full flex-col gap-y-1.5 pb-4 ${r === "designToken" ? "border-none" : "border-b border-border"}`,
13843
+ children: [
13844
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between gap-x-2", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-x-2 text-muted-foreground", children: [
13845
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-1", children: [
13846
+ /* @__PURE__ */ jsx("span", { children: r === "designToken" ? /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium leading-tight text-gray-900 peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: g("Token Classes") }) : g(M ? "Styles" : "Classes") }),
13847
+ N && /* @__PURE__ */ jsxs(Tooltip, { children: [
13848
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: d ? /* @__PURE__ */ jsx(CheckIcon, { className: "rounded-full border border-green-500 bg-green-500/10 text-green-500" }) : /* @__PURE__ */ jsx(CopyIcon, { onClick: Z, className: "cursor-pointer" }) }),
13849
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: g("Copy classes to clipboard") }) })
13850
+ ] })
13851
+ ] }),
13852
+ M && r === "default" && /* @__PURE__ */ jsx(Button, { variant: "link", className: "underline", onClick: () => f("design-tokens"), children: g("Design Tokens") })
13853
+ ] }) }),
13854
+ /* @__PURE__ */ jsxs("div", { className: "relative flex items-center gap-x-3", children: [
13855
+ /* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
13856
+ Autosuggest,
13857
+ {
13858
+ suggestions: D,
13859
+ onSuggestionsFetchRequested: O,
13860
+ onSuggestionsClearRequested: H,
13861
+ getSuggestionValue: R,
13862
+ renderSuggestion: V,
13863
+ inputProps: W,
13864
+ onSuggestionSelected: (_, { suggestionValue: F }) => {
13865
+ const U = [P(F)];
13866
+ r === "designToken" ? isFunction$1(o) && o(U) : y(k, U, !0), E("");
13867
+ },
13868
+ containerProps: {
13869
+ className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
13870
+ },
13871
+ theme: {
13872
+ suggestion: "bg-transparent",
13873
+ suggestionHighlighted: "!bg-gray-300 dark:!bg-gray-800 cursor-pointer",
13874
+ suggestionsContainerOpen: "absolute bg-background no-scrollbar z-50 max-h-[230px] overflow-y-auto w-full border border-border rounded-md"
13875
+ }
13876
+ }
13877
+ ) }),
13878
+ /* @__PURE__ */ jsx(
13879
+ Button,
13880
+ {
13881
+ variant: "outline",
13882
+ className: `border-border ${r === "default" ? "h-6" : "mt-1 h-7"}`,
13883
+ onClick: L,
13884
+ disabled: C.trim() === "",
13885
+ size: "sm",
13886
+ children: /* @__PURE__ */ jsx(PlusIcon, {})
13887
+ }
13888
+ )
13889
+ ] }),
13890
+ /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: T.map(
13891
+ (_, F) => p === F ? /* @__PURE__ */ jsx(
13892
+ "input",
13893
+ {
13894
+ ref: i,
13895
+ value: l,
13896
+ onChange: (z) => c(z.target.value),
13897
+ onBlur: () => {
13898
+ K(_);
13899
+ },
13900
+ onKeyDown: (z) => {
13901
+ z.key === "Enter" && K(_);
13902
+ },
13903
+ onFocus: (z) => {
13904
+ setTimeout(() => {
13905
+ z.target.select();
13906
+ }, 0);
13907
+ },
13908
+ className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"
13909
+ },
13910
+ _
13911
+ ) : /* @__PURE__ */ jsx("div", { className: "group relative flex max-w-[260px] items-center", children: /* @__PURE__ */ jsxs(
13912
+ "button",
13913
+ {
13914
+ onDoubleClick: () => {
13915
+ E(j(_)), r === "default" ? S(k, [_]) : (isFunction$1(a) && a(_), E(_)), setTimeout(() => {
13916
+ i.current && i.current.focus();
13917
+ }, 10);
13918
+ },
13919
+ className: "flex h-max cursor-default items-center gap-x-1 truncate break-words rounded bg-gray-200 py-px pl-0.5 pr-1 text-[11px] text-gray-600 dark:bg-gray-800 dark:text-gray-300",
13920
+ children: [
13921
+ /* @__PURE__ */ jsxs("div", { className: "z-10 flex h-full w-max items-center justify-center", children: [
13922
+ /* @__PURE__ */ jsx(
13923
+ Cross2Icon,
13924
+ {
13925
+ onClick: () => {
13926
+ r === "default" ? S(k, [_]) : isFunction$1(a) && a(_);
13927
+ },
13928
+ 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"
13929
+ }
13930
+ ),
13931
+ _.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(
13932
+ "svg",
13933
+ {
13934
+ className: "h-3.5 w-3.5 group-hover:hidden",
13935
+ fill: "rgba(55, 65, 81, 0.4)",
13936
+ viewBox: "0 0 24 24",
13937
+ xmlns: "http://www.w3.org/2000/svg",
13938
+ xmlSpace: "preserve",
13939
+ children: [
13940
+ /* @__PURE__ */ jsx("g", { id: "SVGRepo_bgCarrier", strokeWidth: "0" }),
13941
+ /* @__PURE__ */ jsx("g", { id: "SVGRepo_tracerCarrier", strokeLinecap: "round", strokeLinejoin: "round" }),
13942
+ /* @__PURE__ */ jsx("g", { id: "SVGRepo_iconCarrier", children: /* @__PURE__ */ jsx(
13943
+ "path",
13944
+ {
13945
+ fillRule: "evenodd",
13946
+ clipRule: "evenodd",
13947
+ d: "M12 6.036c-2.667 0-4.333 1.325-5 3.976 1-1.325 2.167-1.822 3.5-1.491.761.189 1.305.738 1.906 1.345C13.387 10.855 14.522 12 17 12c2.667 0 4.333-1.325 5-3.976-1 1.325-2.166 1.822-3.5 1.491-.761-.189-1.305-.738-1.907-1.345-.98-.99-2.114-2.134-4.593-2.134zM7 12c-2.667 0-4.333 1.325-5 3.976 1-1.326 2.167-1.822 3.5-1.491.761.189 1.305.738 1.907 1.345.98.989 2.115 2.134 4.594 2.134 2.667 0 4.333-1.325 5-3.976-1 1.325-2.167 1.822-3.5 1.491-.761-.189-1.305-.738-1.906-1.345C10.613 13.145 9.478 12 7 12z"
13948
+ }
13949
+ ) })
13950
+ ]
13951
+ }
13952
+ )
13953
+ ] }),
13954
+ /* @__PURE__ */ jsx("div", { children: j(_) })
13955
+ ]
13956
+ }
13957
+ ) }, _)
13958
+ ) })
13959
+ ]
13960
+ }
13961
+ );
13972
13962
  }
13973
13963
  const BASIC_UNITS = ["px", "%", "em", "rem", "ch", "vh", "vw"], FLEX_CHILD_SECTION = {
13974
13964
  heading: "flex.heading",
@@ -14440,11 +14430,11 @@ const BlockCard = ({
14440
14430
  const N = (j = I.current) == null ? void 0 : j.querySelector("[data-radix-scroll-area-viewport]");
14441
14431
  N && N.scrollTo({ top: 0, behavior: "smooth" });
14442
14432
  }, [c, S]);
14443
- const w = (N) => {
14433
+ const A = (N) => {
14444
14434
  E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
14445
14435
  E.current && k(N);
14446
14436
  }, 400);
14447
- }, A = () => {
14437
+ }, w = () => {
14448
14438
  c != null && c.id && p(c.id);
14449
14439
  };
14450
14440
  if (u)
@@ -14471,7 +14461,7 @@ const BlockCard = ({
14471
14461
  className: `no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto ${o ? "" : "pb-20"}`,
14472
14462
  children: isEmpty(y) ? /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 p-4 text-center", children: h ? /* @__PURE__ */ jsx("p", { className: "text-sm", children: B("No matching blocks found") }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
14473
14463
  /* @__PURE__ */ jsx("p", { className: "text-sm", children: B("Failed to load the UI library. Try again") }),
14474
- /* @__PURE__ */ jsxs(Button, { onClick: A, variant: "outline", size: "sm", className: "gap-2", children: [
14464
+ /* @__PURE__ */ jsxs(Button, { onClick: w, variant: "outline", size: "sm", className: "gap-2", children: [
14475
14465
  /* @__PURE__ */ jsx(ReloadIcon, { className: "h-4 w-4" }),
14476
14466
  B("Retry")
14477
14467
  ] })
@@ -14481,7 +14471,7 @@ const BlockCard = ({
14481
14471
  ] }) : map(y, (N, j) => /* @__PURE__ */ jsxs(
14482
14472
  "div",
14483
14473
  {
14484
- onMouseEnter: () => w(j),
14474
+ onMouseEnter: () => A(j),
14485
14475
  onMouseLeave: () => clearTimeout(E.current),
14486
14476
  role: "button",
14487
14477
  onClick: () => k(j),
@@ -14669,19 +14659,19 @@ const BlockCard = ({
14669
14659
  }
14670
14660
  ) : n,
14671
14661
  [n, u]
14672
- ), w = useMemo(
14662
+ ), A = useMemo(
14673
14663
  () => u ? r.filter(
14674
14664
  (j) => reject(filter(values(I), { group: j }), { hidden: !0 }).length > 0
14675
14665
  ) : r.filter((j) => reject(filter(values(n), { group: j }), { hidden: !0 }).length > 0),
14676
14666
  [n, I, r, u]
14677
- ), A = useMemo(
14678
- () => sortBy(w, (j) => CORE_GROUPS.indexOf(j) === -1 ? 99 : CORE_GROUPS.indexOf(j)),
14679
- [w]
14680
- ), v = useMemo(() => g === "all" ? I : filter(values(I), { group: g }), [I, g]), T = useMemo(() => g === "all" ? A : [g], [A, g]);
14667
+ ), w = useMemo(
14668
+ () => sortBy(A, (j) => CORE_GROUPS.indexOf(j) === -1 ? 99 : CORE_GROUPS.indexOf(j)),
14669
+ [A]
14670
+ ), v = useMemo(() => g === "all" ? I : filter(values(I), { group: g }), [I, g]), T = useMemo(() => g === "all" ? w : [g], [w, g]);
14681
14671
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full flex-col", children: [
14682
14672
  /* @__PURE__ */ jsx(SearchInput, { value: u, setValue: p }),
14683
14673
  /* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden pt-2", children: [
14684
- !l && A.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
14674
+ !l && w.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r border-border", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
14685
14675
  /* @__PURE__ */ jsx(
14686
14676
  "button",
14687
14677
  {
@@ -14693,7 +14683,7 @@ const BlockCard = ({
14693
14683
  },
14694
14684
  "sidebar-all"
14695
14685
  ),
14696
- A.map((j) => /* @__PURE__ */ jsx(
14686
+ w.map((j) => /* @__PURE__ */ jsx(
14697
14687
  "button",
14698
14688
  {
14699
14689
  onClick: () => B(j),
@@ -14708,8 +14698,8 @@ const BlockCard = ({
14708
14698
  /* @__PURE__ */ jsx(
14709
14699
  "div",
14710
14700
  {
14711
- className: `h-full flex-1 overflow-hidden ${!l && A.length > 0 ? "w-3/4" : "w-full"}`,
14712
- children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar h-full", children: w.length === 0 && u ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
14701
+ className: `h-full flex-1 overflow-hidden ${!l && w.length > 0 ? "w-3/4" : "w-full"}`,
14702
+ children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar h-full", children: A.length === 0 && u ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
14713
14703
  c("No blocks found matching"),
14714
14704
  ' "',
14715
14705
  u,
@@ -15201,38 +15191,38 @@ const useStructureValidation = () => {
15201
15191
  var n;
15202
15192
  return r != null && r._name ? r._name : (r == null ? void 0 : r._type) === "Box" && (r != null && r.tag) && (r == null ? void 0 : r.tag) !== "div" ? startCase(r.tag) : ((n = r == null ? void 0 : r._type) == null ? void 0 : n.split("/").pop()) || "";
15203
15193
  }, truncateText = (r, n) => r.length > n ? r.substring(0, n) + "..." : r, Node$1 = memo(({ node: r, style: n, dragHandle: o }) => {
15204
- var R;
15194
+ var H;
15205
15195
  const { t: a } = useTranslation(), i = useUpdateBlocksProps(), [l] = useAtom$1(canvasIframeAtom), { hasPermission: c } = usePermissions();
15206
15196
  let d = null;
15207
- const u = r.children.length > 0, { highlightBlock: p, clearHighlight: h } = useBlockHighlight(), f = useIsDragAndDropEnabled(), { id: m, data: g, isSelected: b, willReceiveDrop: x, isDragging: y, isEditing: S, handleClick: k } = r, C = useStructureValidation(), E = useMemo(() => C.getBlockErrors(m), [C, m]), B = get(g, "_show", !0), I = (_) => {
15208
- _.stopPropagation(), B && r.toggle();
15209
- }, w = (_) => {
15210
- _.isInternal && (d = _.isOpen, _.isOpen && _.close());
15211
- }, A = (_) => {
15212
- _.isInternal && d !== null && (d ? _.open() : _.close(), d = null);
15197
+ const u = r.children.length > 0, { highlightBlock: p, clearHighlight: h } = useBlockHighlight(), f = useIsDragAndDropEnabled(), { id: m, data: g, isSelected: b, willReceiveDrop: x, isDragging: y, isEditing: S, handleClick: k } = r, C = useStructureValidation(), E = useMemo(() => C.getBlockErrors(m), [C, m]), B = get(g, "_show", !0), I = (R) => {
15198
+ R.stopPropagation(), B && r.toggle();
15199
+ }, A = (R) => {
15200
+ R.isInternal && (d = R.isOpen, R.isOpen && R.close());
15201
+ }, w = (R) => {
15202
+ R.isInternal && d !== null && (d ? R.open() : R.close(), d = null);
15213
15203
  }, [v, T] = useAtom$1(currentAddSelection), N = () => {
15214
- var _;
15215
- j(), r.parent.isSelected || T((_ = r == null ? void 0 : r.parent) == null ? void 0 : _.id);
15204
+ var R;
15205
+ j(), r.parent.isSelected || T((R = r == null ? void 0 : r.parent) == null ? void 0 : R.id);
15216
15206
  }, j = () => {
15217
15207
  T(null);
15218
- }, P = (_) => {
15219
- j(), _.stopPropagation(), !r.isOpen && B && r.toggle(), k(_);
15208
+ }, P = (R) => {
15209
+ j(), R.stopPropagation(), !r.isOpen && B && r.toggle(), k(R);
15220
15210
  };
15221
15211
  useEffect(() => {
15222
- const _ = setTimeout(() => {
15212
+ const R = setTimeout(() => {
15223
15213
  x && !r.isOpen && !y && B && r.toggle();
15224
15214
  }, 500);
15225
- return () => clearTimeout(_);
15215
+ return () => clearTimeout(R);
15226
15216
  }, [x, r, y]);
15227
- const L = (_, M) => {
15228
- const $ = l.contentDocument || l.contentWindow.document, U = $.querySelector(`[data-block-id=${_}]`);
15229
- U && U.setAttribute("data-drop", M);
15230
- const W = U.getBoundingClientRect(), V = l.getBoundingClientRect();
15231
- W.top >= V.top && W.left >= V.left && W.bottom <= V.bottom && W.right <= V.right || ($.documentElement.scrollTop = U.offsetTop - V.top);
15232
- }, D = (_) => {
15217
+ const L = (R, V) => {
15218
+ const W = l.contentDocument || l.contentWindow.document, K = W.querySelector(`[data-block-id=${R}]`);
15219
+ K && K.setAttribute("data-drop", V);
15220
+ const Z = K.getBoundingClientRect(), G = l.getBoundingClientRect();
15221
+ Z.top >= G.top && Z.left >= G.left && Z.bottom <= G.bottom && Z.right <= G.right || (W.documentElement.scrollTop = K.offsetTop - G.top);
15222
+ }, D = (R) => {
15233
15223
  j();
15234
- const M = get(r, "parent.id");
15235
- M !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: M, position: _ }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: _ });
15224
+ const V = get(r, "parent.id");
15225
+ V !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: V, position: R }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: R });
15236
15226
  };
15237
15227
  if (m === ROOT_TEMP_KEY)
15238
15228
  return /* @__PURE__ */ jsxs("div", { className: "group relative mt-2 w-full cursor-pointer", children: [
@@ -15252,7 +15242,7 @@ const useStructureValidation = () => {
15252
15242
  ),
15253
15243
  /* @__PURE__ */ jsx("br", {})
15254
15244
  ] });
15255
- const { librarySite: F } = useBuilderProp("flags", { librarySite: !1 }), H = useMemo(() => F && has(g, "_libBlockId") && !isEmpty(g._libBlockId) && (c(PERMISSIONS.CREATE_LIBRARY_BLOCK) || c(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [g, c, F]), O = useMemo(() => (g == null ? void 0 : g._type) === "PartialBlock" || (g == null ? void 0 : g._type) === "GlobalBlock", [g]);
15245
+ const { librarySite: $ } = useBuilderProp("flags", { librarySite: !1 }), M = useMemo(() => $ && has(g, "_libBlockId") && !isEmpty(g._libBlockId) && (c(PERMISSIONS.CREATE_LIBRARY_BLOCK) || c(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [g, c, $]), O = useMemo(() => (g == null ? void 0 : g._type) === "PartialBlock" || (g == null ? void 0 : g._type) === "GlobalBlock", [g]);
15256
15246
  return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
15257
15247
  "div",
15258
15248
  {
@@ -15262,23 +15252,23 @@ const useStructureValidation = () => {
15262
15252
  style: n,
15263
15253
  "data-node-id": m,
15264
15254
  ref: o,
15265
- onDragStart: () => w(r),
15266
- onDragEnd: () => A(r),
15267
- onDragOver: (_) => {
15268
- _.preventDefault(), L(m, "yes");
15255
+ onDragStart: () => A(r),
15256
+ onDragEnd: () => w(r),
15257
+ onDragOver: (R) => {
15258
+ R.preventDefault(), L(m, "yes");
15269
15259
  },
15270
- onDragLeave: (_) => {
15271
- _.preventDefault(), L(m, "no");
15260
+ onDragLeave: (R) => {
15261
+ R.preventDefault(), L(m, "no");
15272
15262
  },
15273
- onDrop: (_) => {
15274
- _.preventDefault(), L(m, "no");
15263
+ onDrop: (R) => {
15264
+ R.preventDefault(), L(m, "no");
15275
15265
  },
15276
15266
  children: [
15277
- c(PERMISSIONS.ADD_BLOCK) && !f && (r == null ? void 0 : r.rowIndex) > 0 && (r.parent.isOpen && canAddChildBlock(get(r, "parent.data._type")) || ((R = r == null ? void 0 : r.parent) == null ? void 0 : R.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
15267
+ c(PERMISSIONS.ADD_BLOCK) && !f && (r == null ? void 0 : r.rowIndex) > 0 && (r.parent.isOpen && canAddChildBlock(get(r, "parent.data._type")) || ((H = r == null ? void 0 : r.parent) == null ? void 0 : H.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
15278
15268
  "div",
15279
15269
  {
15280
- onClick: (_) => {
15281
- _.stopPropagation(), D(r.childIndex);
15270
+ onClick: (R) => {
15271
+ R.stopPropagation(), D(r.childIndex);
15282
15272
  },
15283
15273
  onMouseEnter: N,
15284
15274
  onMouseLeave: j,
@@ -15296,7 +15286,7 @@ const useStructureValidation = () => {
15296
15286
  (r == null ? void 0 : r.id) === v ? "bg-primary/10" : "",
15297
15287
  y && "opacity-20",
15298
15288
  B ? "" : "line-through opacity-50",
15299
- H && b && "bg-primary/20 text-primary"
15289
+ M && b && "bg-primary/20 text-primary"
15300
15290
  ),
15301
15291
  children: [
15302
15292
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -15312,8 +15302,8 @@ const useStructureValidation = () => {
15312
15302
  {
15313
15303
  className: cn(
15314
15304
  "leading-1 flex items-center",
15315
- H && "text-orange-600/90",
15316
- H && b && "text-orange-800",
15305
+ M && "text-orange-600/90",
15306
+ M && b && "text-orange-800",
15317
15307
  O && "text-purple-600/90",
15318
15308
  O && b && "text-purple-800"
15319
15309
  ),
@@ -15323,8 +15313,8 @@ const useStructureValidation = () => {
15323
15313
  "div",
15324
15314
  {
15325
15315
  className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
15326
- onDoubleClick: (_) => {
15327
- _.stopPropagation(), r.edit(), r.deselect();
15316
+ onDoubleClick: (R) => {
15317
+ R.stopPropagation(), r.edit(), r.deselect();
15328
15318
  },
15329
15319
  children: /* @__PURE__ */ jsx("span", { title: getBlockDisplayName(g).length > 17 ? getBlockDisplayName(g) : "", children: truncateText(getBlockDisplayName(g), 17) })
15330
15320
  }
@@ -15350,8 +15340,8 @@ const useStructureValidation = () => {
15350
15340
  /* @__PURE__ */ jsx(
15351
15341
  TooltipTrigger,
15352
15342
  {
15353
- onClick: (_) => {
15354
- _.stopPropagation(), i([m], { _show: !B }), r.isOpen && r.toggle();
15343
+ onClick: (R) => {
15344
+ R.stopPropagation(), i([m], { _show: !B }), r.isOpen && r.toggle();
15355
15345
  },
15356
15346
  className: "cursor-pointer rounded bg-transparent p-0.5 hover:bg-primary/10",
15357
15347
  asChild: !0,
@@ -15804,13 +15794,13 @@ const useStructureValidation = () => {
15804
15794
  }
15805
15795
  }, ThemeConfigPanel = React.memo(({ className: r = "" }) => {
15806
15796
  const [n, o] = useDarkMode(), [a, i] = React.useState(""), [l, c] = React.useState(!1), d = useBuilderProp("themePresets", []), u = useBuilderProp("themePanelComponent", null), { hasPermission: p } = usePermissions(), h = useBuilderProp("flags.importTheme", !0), f = useBuilderProp("flags.darkMode", !0), m = useIncrementActionsCount();
15807
- (!d || d.length === 0) && DEFAULT_THEME_PRESET.map((A) => {
15808
- d.push(A);
15797
+ (!d || d.length === 0) && DEFAULT_THEME_PRESET.map((w) => {
15798
+ d.push(w);
15809
15799
  });
15810
15800
  const [g, b] = useTheme(), x = useThemeOptions(), { t: y } = useTranslation(), S = React.useCallback(
15811
- (A) => {
15801
+ (w) => {
15812
15802
  const v = { ...g };
15813
- setPreviousTheme(v), b(A), m(), toast.success("Theme updated", {
15803
+ setPreviousTheme(v), b(w), m(), toast.success("Theme updated", {
15814
15804
  action: {
15815
15805
  label: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
15816
15806
  /* @__PURE__ */ jsx(ResetIcon, { className: "h-4 w-4" }),
@@ -15826,50 +15816,50 @@ const useStructureValidation = () => {
15826
15816
  },
15827
15817
  [g, b, m]
15828
15818
  ), k = () => {
15829
- const A = d.find((v) => Object.keys(v)[0] === a);
15830
- if (A) {
15831
- const v = Object.values(A)[0];
15819
+ const w = d.find((v) => Object.keys(v)[0] === a);
15820
+ if (w) {
15821
+ const v = Object.values(w)[0];
15832
15822
  v && typeof v == "object" && "fontFamily" in v && "borderRadius" in v && "colors" in v ? (S(v), i(""), m()) : console.error("Invalid preset structure:", v);
15833
15823
  } else
15834
15824
  console.error("Preset not found:", a);
15835
- }, C = (A) => {
15836
- S(A), i(""), m();
15825
+ }, C = (w) => {
15826
+ S(w), i(""), m();
15837
15827
  }, E = useDebouncedCallback(
15838
- (A, v) => {
15828
+ (w, v) => {
15839
15829
  b(() => ({
15840
15830
  ...g,
15841
15831
  fontFamily: {
15842
15832
  ...g.fontFamily,
15843
- [A.replace(/font-/g, "")]: v
15833
+ [w.replace(/font-/g, "")]: v
15844
15834
  }
15845
15835
  })), m();
15846
15836
  },
15847
15837
  [g, m],
15848
15838
  200
15849
15839
  ), B = React.useCallback(
15850
- (A) => {
15840
+ (w) => {
15851
15841
  b(() => ({
15852
15842
  ...g,
15853
- borderRadius: `${A}px`
15843
+ borderRadius: `${w}px`
15854
15844
  })), m();
15855
15845
  },
15856
15846
  [g, m]
15857
15847
  ), I = useDebouncedCallback(
15858
- (A, v) => {
15848
+ (w, v) => {
15859
15849
  b(() => {
15860
- const T = get(g, `colors.${A}`);
15850
+ const T = get(g, `colors.${w}`);
15861
15851
  return n ? set(T, 1, v) : set(T, 0, v), m(), {
15862
15852
  ...g,
15863
15853
  colors: {
15864
15854
  ...g.colors,
15865
- [A]: T
15855
+ [w]: T
15866
15856
  }
15867
15857
  };
15868
15858
  });
15869
15859
  },
15870
15860
  [g, m],
15871
15861
  200
15872
- ), w = (A) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(A.items).map(([v]) => {
15862
+ ), A = (w) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(w.items).map(([v]) => {
15873
15863
  const T = get(g, `colors.${v}.${n ? 1 : 0}`);
15874
15864
  return T ? /* @__PURE__ */ jsxs("div", { id: `theme-${v}`, className: "mt-1 flex items-center gap-x-2", children: [
15875
15865
  /* @__PURE__ */ jsx(
@@ -15895,8 +15885,8 @@ const useStructureValidation = () => {
15895
15885
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-0", children: [
15896
15886
  /* @__PURE__ */ jsx("div", { className: "w-[70%]", children: /* @__PURE__ */ jsxs(Select$1, { value: a, onValueChange: i, children: [
15897
15887
  /* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 w-full text-sm", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: y("Select preset") }) }),
15898
- /* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((A) => {
15899
- const v = Object.keys(A)[0], T = v.replaceAll("_", " ");
15888
+ /* @__PURE__ */ jsx(SelectContent, { children: Array.isArray(d) && d.map((w) => {
15889
+ const v = Object.keys(w)[0], T = v.replaceAll("_", " ");
15900
15890
  return /* @__PURE__ */ jsx(SelectItem, { value: v, children: capitalize(T) }, v);
15901
15891
  }) })
15902
15892
  ] }) }),
@@ -15909,14 +15899,14 @@ const useStructureValidation = () => {
15909
15899
  /* @__PURE__ */ jsx(TextIcon, { className: "h-3 w-3 text-gray-600" }),
15910
15900
  /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-gray-700", children: y("Typography") })
15911
15901
  ] }),
15912
- (x == null ? void 0 : x.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(x.fontFamily).map(([A, v]) => /* @__PURE__ */ jsx(
15902
+ (x == null ? void 0 : x.fontFamily) && /* @__PURE__ */ jsx("div", { className: "space-y-2", children: Object.entries(x.fontFamily).map(([w, v]) => /* @__PURE__ */ jsx(
15913
15903
  FontSelector,
15914
15904
  {
15915
- label: A,
15916
- value: g.fontFamily[A.replace(/font-/g, "")] || v[Object.keys(v)[0]],
15917
- onChange: (T) => E(A, T)
15905
+ label: w,
15906
+ value: g.fontFamily[w.replace(/font-/g, "")] || v[Object.keys(v)[0]],
15907
+ onChange: (T) => E(w, T)
15918
15908
  },
15919
- A
15909
+ w
15920
15910
  )) }),
15921
15911
  /* @__PURE__ */ jsx(Separator, {}),
15922
15912
  (x == null ? void 0 : x.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5", children: [
@@ -15942,7 +15932,7 @@ const useStructureValidation = () => {
15942
15932
  Switch,
15943
15933
  {
15944
15934
  checked: n,
15945
- onCheckedChange: (A) => o(A),
15935
+ onCheckedChange: (w) => o(w),
15946
15936
  "aria-label": y("Toggle dark mode"),
15947
15937
  className: "mx-1"
15948
15938
  }
@@ -15950,7 +15940,7 @@ const useStructureValidation = () => {
15950
15940
  /* @__PURE__ */ jsx(MoonIcon, { className: "h-4 w-4" })
15951
15941
  ] })
15952
15942
  ] }),
15953
- /* @__PURE__ */ jsx("div", { className: "space-y-2", children: x.colors.map((A) => w(A)) })
15943
+ /* @__PURE__ */ jsx("div", { className: "space-y-2", children: x.colors.map((w) => A(w)) })
15954
15944
  ] }),
15955
15945
  /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: y("Loading...") }), children: l && h && /* @__PURE__ */ jsx(
15956
15946
  LazyCssImportModal,
@@ -16706,30 +16696,30 @@ const UndoRedo = () => {
16706
16696
  return;
16707
16697
  }
16708
16698
  if (l) {
16709
- const w = [...a, { key: l, value: d }];
16710
- o(w), i(a), c(""), u(""), m("");
16699
+ const A = [...a, { key: l, value: d }];
16700
+ o(A), i(a), c(""), u(""), m("");
16711
16701
  }
16712
- }, k = (w) => {
16713
- const A = a.filter((v, T) => T !== w);
16714
- o(A), i(A);
16715
- }, C = (w) => {
16716
- h(w), c(a[w].key), u(a[w].value);
16702
+ }, k = (A) => {
16703
+ const w = a.filter((v, T) => T !== A);
16704
+ o(w), i(w);
16705
+ }, C = (A) => {
16706
+ h(A), c(a[A].key), u(a[A].value);
16717
16707
  }, E = () => {
16718
16708
  if (l.startsWith("@")) {
16719
16709
  m(y("Attribute keys cannot start with @"));
16720
16710
  return;
16721
16711
  }
16722
16712
  if (p !== null && l) {
16723
- const w = [...a];
16724
- w[p] = { key: l, value: d }, o(w), i(w), h(null), c(""), u(""), m("");
16713
+ const A = [...a];
16714
+ A[p] = { key: l, value: d }, o(A), i(A), h(null), c(""), u(""), m("");
16725
16715
  }
16726
- }, B = (w) => {
16727
- w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? E() : S());
16728
- }, I = useCallback((w) => {
16729
- const A = (N) => /[.,!?;:]/.test(N), v = (N, j, P) => {
16716
+ }, B = (A) => {
16717
+ A.key === "Enter" && !A.shiftKey && (A.preventDefault(), p !== null ? E() : S());
16718
+ }, I = useCallback((A) => {
16719
+ const w = (N) => /[.,!?;:]/.test(N), v = (N, j, P) => {
16730
16720
  let L = "", D = "";
16731
- const F = j > 0 ? N[j - 1] : "", H = j < N.length ? N[j] : "";
16732
- return j > 0 && (F === "." || !A(F) && F !== " ") && (L = " "), j < N.length && !A(H) && H !== " " && (D = " "), {
16721
+ const $ = j > 0 ? N[j - 1] : "", M = j < N.length ? N[j] : "";
16722
+ return j > 0 && ($ === "." || !w($) && $ !== " ") && (L = " "), j < N.length && !w(M) && M !== " " && (D = " "), {
16733
16723
  text: L + P + D,
16734
16724
  prefixLength: L.length,
16735
16725
  suffixLength: D.length
@@ -16738,20 +16728,20 @@ const UndoRedo = () => {
16738
16728
  if (T) {
16739
16729
  const N = T.selectionStart || 0, j = T.value || "", P = T.selectionEnd || N;
16740
16730
  if (P > N) {
16741
- const O = `{{${w}}}`, { text: R } = v(j, N, O), _ = j.slice(0, N) + R + j.slice(P);
16742
- u(_);
16731
+ const O = `{{${A}}}`, { text: H } = v(j, N, O), R = j.slice(0, N) + H + j.slice(P);
16732
+ u(R);
16743
16733
  return;
16744
16734
  }
16745
- const D = `{{${w}}}`, { text: F } = v(j, N, D), H = j.slice(0, N) + F + j.slice(N);
16746
- u(H);
16735
+ const D = `{{${A}}}`, { text: $ } = v(j, N, D), M = j.slice(0, N) + $ + j.slice(N);
16736
+ u(M);
16747
16737
  }
16748
16738
  }, []);
16749
16739
  return /* @__PURE__ */ jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
16750
16740
  /* @__PURE__ */ jsxs(
16751
16741
  "form",
16752
16742
  {
16753
- onSubmit: (w) => {
16754
- w.preventDefault(), p !== null ? E() : S();
16743
+ onSubmit: (A) => {
16744
+ A.preventDefault(), p !== null ? E() : S();
16755
16745
  },
16756
16746
  className: "space-y-3",
16757
16747
  children: [
@@ -16767,7 +16757,7 @@ const UndoRedo = () => {
16767
16757
  id: "attrKey",
16768
16758
  ref: g,
16769
16759
  value: l,
16770
- onChange: (w) => c(w.target.value),
16760
+ onChange: (A) => c(A.target.value),
16771
16761
  placeholder: y("Enter key"),
16772
16762
  className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
16773
16763
  }
@@ -16787,7 +16777,7 @@ const UndoRedo = () => {
16787
16777
  id: "attrValue",
16788
16778
  ref: b,
16789
16779
  value: d,
16790
- onChange: (w) => u(w.target.value),
16780
+ onChange: (A) => u(A.target.value),
16791
16781
  onKeyDown: B,
16792
16782
  placeholder: y("Enter value"),
16793
16783
  className: "text-xs font-normal leading-tight placeholder:text-slate-400"
@@ -16800,16 +16790,16 @@ const UndoRedo = () => {
16800
16790
  ]
16801
16791
  }
16802
16792
  ),
16803
- /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((w, A) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
16793
+ /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((A, w) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
16804
16794
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
16805
- /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: w.key }),
16806
- /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: w.value.toString() })
16795
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: A.key }),
16796
+ /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: A.value.toString() })
16807
16797
  ] }),
16808
16798
  /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
16809
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => C(A), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
16810
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(A), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
16799
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => C(w), children: /* @__PURE__ */ jsx(Pencil2Icon, { className: "h-3 w-3" }) }),
16800
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(w), children: /* @__PURE__ */ jsx(Cross1Icon, { className: "h-3 w-3" }) })
16811
16801
  ] })
16812
- ] }, A)) })
16802
+ ] }, w)) })
16813
16803
  ] });
16814
16804
  }), BlockAttributesEditor = React.memo(() => {
16815
16805
  const r = useSelectedBlock(), [n, o] = useState([]), [a] = useSelectedStylingBlocks(), i = useUpdateBlocksProps(), l = `${get(a, "0.prop")}_attrs`;
@@ -16951,336 +16941,7 @@ const PartialWrapper = ({ partialBlockId: r }) => {
16951
16941
  component: DefaultTopBar
16952
16942
  }, registerChaiTopBar = (r) => {
16953
16943
  TOP_BAR.component = r;
16954
- }, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), TokenUsageSection = ({ title: r, items: n, emptyLabel: o, onSelect: a, icon: i }) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
16955
- /* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: r }),
16956
- n.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-1", children: n.map((l) => /* @__PURE__ */ jsx(
16957
- "button",
16958
- {
16959
- type: "button",
16960
- onClick: () => a(l.id),
16961
- className: cn$2(
16962
- "group flex w-full items-center justify-between rounded-md border border-transparent bg-muted/40 px-3 py-1 text-left text-xs transition",
16963
- "hover:border-muted-foreground/20 hover:bg-muted/70 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1",
16964
- l.isSelected && "border-primary/40 bg-primary/10 text-primary"
16965
- ),
16966
- children: /* @__PURE__ */ jsxs("span", { className: "flex items-center space-x-2", children: [
16967
- i && i,
16968
- /* @__PURE__ */ jsx("span", { className: "truncate", children: l.label })
16969
- ] })
16970
- },
16971
- l.id
16972
- )) }) : /* @__PURE__ */ jsx("div", { className: "rounded border border-dashed border-muted px-3 py-1 text-xs text-muted-foreground", children: o })
16973
- ] }), STYLES_PREFIX = "#styles:", getBlockLabel = (r) => {
16974
- const o = [
16975
- typeof r._name == "string" ? r._name : void 0,
16976
- typeof r._type == "string" ? r._type : void 0
16977
- ].filter(Boolean).find((a) => a.trim().length > 0);
16978
- return o ? o.length > 40 ? `${o.slice(0, 37)}...` : o : r._id;
16979
- }, collectTokenUsageOnPage = (r, n) => {
16980
- const o = `${n}`;
16981
- return r.filter((a) => Object.values(a).some((i) => typeof i != "string" || !i.startsWith(STYLES_PREFIX) ? !1 : i.includes(o))).map((a) => ({
16982
- id: a._id,
16983
- label: getBlockLabel(a)
16984
- }));
16985
- }, TokenUsagePopover = ({ tokenId: r, tokenName: n }) => {
16986
- const { t: o } = useTranslation(), [a] = useBlocksStore(), [i, l] = useSelectedBlockIds(), c = useBuilderProp("pageId"), d = useBuilderProp("siteWideUsage"), u = useMemo(() => collectTokenUsageOnPage(a, r), [a, r]), p = useMemo(
16987
- () => u.map((C) => ({
16988
- id: C.id,
16989
- label: C.label,
16990
- isSelected: i.includes(C.id)
16991
- })),
16992
- [u, i]
16993
- ), h = useMemo(() => d ? Object.entries(d).reduce(
16994
- (C, [E, B]) => (E === c || !(B != null && B.designTokens) || !Object.keys(B.designTokens).some((w) => typeof w != "string" ? !1 : w === r) || C.push({ id: E, name: B.name || E, isPartial: !!B.isPartial }), C),
16995
- []
16996
- ) : [], [d, n, r, c]), f = useMemo(
16997
- () => h.filter((C) => !C.isPartial).map((C) => ({
16998
- id: C.id,
16999
- label: C.name
17000
- })),
17001
- [h]
17002
- ), m = useMemo(
17003
- () => h.filter((C) => C.isPartial).map((C) => ({
17004
- id: C.id,
17005
- label: C.name
17006
- })),
17007
- [h]
17008
- ), g = useCallback(
17009
- (C) => {
17010
- l([C]);
17011
- },
17012
- [l]
17013
- ), b = useBuilderProp("gotoPage", noop), { selectedLang: x, fallbackLang: y } = useLanguages(), { savePageAsync: S } = useSavePage(), k = async (C) => {
17014
- C && (await S(!0), b({ pageId: C, lang: x || y }));
17015
- };
17016
- return /* @__PURE__ */ jsxs(Popover, { children: [
17017
- /* @__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" }) }) }),
17018
- /* @__PURE__ */ jsxs(PopoverContent, { side: "bottom", align: "end", className: "w-80 p-0", children: [
17019
- /* @__PURE__ */ jsxs("div", { className: "space-y-1 px-4 py-3", children: [
17020
- /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold", children: n }),
17021
- /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground", children: o("Usage summary for this design token across your site.") })
17022
- ] }),
17023
- /* @__PURE__ */ jsxs("div", { className: "no-scrollbar max-h-64 space-y-4 overflow-y-auto px-4 pb-4", children: [
17024
- /* @__PURE__ */ jsx(
17025
- TokenUsageSection,
17026
- {
17027
- title: o("Blocks affected on this page"),
17028
- items: p,
17029
- emptyLabel: o("None"),
17030
- onSelect: g,
17031
- icon: /* @__PURE__ */ jsx(ArrowRightIcon, { fontSize: 4 })
17032
- }
17033
- ),
17034
- /* @__PURE__ */ jsx(
17035
- TokenUsageSection,
17036
- {
17037
- title: o("Blocks affected on other pages"),
17038
- items: f,
17039
- emptyLabel: o("None"),
17040
- onSelect: k,
17041
- icon: /* @__PURE__ */ jsx(FileIcon, { fontSize: 8 })
17042
- }
17043
- ),
17044
- /* @__PURE__ */ jsx(
17045
- TokenUsageSection,
17046
- {
17047
- title: o("Blocks affected on partial blocks"),
17048
- items: m,
17049
- emptyLabel: o("None"),
17050
- onSelect: k,
17051
- icon: /* @__PURE__ */ jsx(GlobeIcon, { fontSize: 8 })
17052
- }
17053
- )
17054
- ] })
17055
- ] })
17056
- ] });
17057
- }, ManageDesignTokens = ({}) => {
17058
- const { t: r } = useTranslation(), [n, o] = useAtom$1(chaiDesignTokensAtom), [a, i] = useState(!1), [l, c] = useState(null), [d, u] = useState(!1), [p, h] = useState(!1), [f, m] = useState(""), [g, b] = useState(""), [x, y] = useState(""), [S, k] = useState(""), [C, E] = useState(""), [B, I] = useState(""), w = useIncrementActionsCount(), A = (R) => {
17059
- const _ = R.trim();
17060
- return _.length === 0 || _.length > 25 ? !1 : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(_);
17061
- }, v = (R, _ = !1, M) => {
17062
- const $ = R.trim();
17063
- return $.length === 0 ? "" : $.length > 25 ? r("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test($) ? Object.entries(n).find(
17064
- ([V, z]) => z.name === $ && (!_ || V !== M)
17065
- ) ? r("Token name already exists") : "" : r("Only alphanumeric characters and hyphens allowed");
17066
- }, T = () => {
17067
- if (!f.trim() || !g.trim()) {
17068
- toast.error(r("Please fill in both token name and classes"));
17069
- return;
17070
- }
17071
- if (!A(f)) {
17072
- toast.error(r("Invalid design token name format"));
17073
- return;
17074
- }
17075
- if (Object.values(n).find(($) => $.name === f.trim())) {
17076
- toast.error(r("Token already exists"));
17077
- return;
17078
- }
17079
- const _ = `${DESIGN_TOKEN_PREFIX}${nanoid(12)}`, M = {
17080
- ...n,
17081
- [_]: {
17082
- name: f.trim(),
17083
- value: g.trim()
17084
- }
17085
- };
17086
- o(M), m(""), b(""), i(!1), u(!1), w(), toast.success(r("Token added successfully"));
17087
- }, N = () => {
17088
- if (!x.trim() || !S.trim()) {
17089
- toast.error(r("Please fill in both token name and classes"));
17090
- return;
17091
- }
17092
- if (!A(x)) {
17093
- toast.error(r("Invalid design token name format"));
17094
- return;
17095
- }
17096
- if (Object.entries(n).find(
17097
- ([M, $]) => $.name === x.trim() && M !== l
17098
- )) {
17099
- toast.error(r("Token already exists"));
17100
- return;
17101
- }
17102
- if (!l)
17103
- return;
17104
- const _ = {
17105
- ...n,
17106
- [l]: {
17107
- name: x.trim(),
17108
- value: S.trim()
17109
- }
17110
- };
17111
- o(_), c(null), y(""), k(""), h(!1), w(), toast.success(r("Token updated successfully"));
17112
- }, j = (R) => {
17113
- const _ = { ...n };
17114
- delete _[R], o(_), w(), toast.success(r("Token deleted successfully"));
17115
- }, P = (R) => {
17116
- const _ = n[R];
17117
- _ && (c(R), y(_.name), k(_.value), i(!1), h(!0));
17118
- }, L = () => {
17119
- i(!0), c(null), m(""), b(""), E(""), u(!0);
17120
- }, D = () => {
17121
- c(null), y(""), k(""), I(""), h(!1);
17122
- }, F = () => {
17123
- i(!1), m(""), b(""), E(""), u(!1);
17124
- }, H = (R) => {
17125
- const _ = R.replace(/\s+/g, "-");
17126
- m(_), E(v(_));
17127
- }, O = (R) => {
17128
- const _ = R.replace(/\s+/g, "-");
17129
- y(_), I(v(_, !0, l || void 0));
17130
- };
17131
- return /* @__PURE__ */ jsxs("div", { className: "flex h-full w-full flex-col", children: [
17132
- /* @__PURE__ */ jsx("div", { className: "", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs(
17133
- Button,
17134
- {
17135
- variant: "outline",
17136
- onClick: L,
17137
- disabled: a || l !== null,
17138
- size: "sm",
17139
- className: "h-7 text-xs",
17140
- children: [
17141
- /* @__PURE__ */ jsx(PlusIcon, { className: "mr-1 h-3 w-3" }),
17142
- r("Add")
17143
- ]
17144
- }
17145
- ) }) }),
17146
- /* @__PURE__ */ jsx("div", { className: "no-scrollbar flex flex-1 flex-col overflow-hidden pt-2", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full flex-1", children: /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(n).length === 0 ? /* @__PURE__ */ jsxs("div", { className: "py-6 text-center text-muted-foreground", children: [
17147
- /* @__PURE__ */ jsx("div", { className: "mb-1 text-2xl", children: "🎨" }),
17148
- /* @__PURE__ */ jsx("p", { className: "text-xs", children: r("No design tokens defined") })
17149
- ] }) : Object.entries(n).map(([R, _]) => /* @__PURE__ */ jsxs(
17150
- "div",
17151
- {
17152
- className: `group flex items-center justify-between hover:bg-muted/90 ${l === R ? "bg-primary/10" : ""}`,
17153
- children: [
17154
- /* @__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: _.name }) }),
17155
- /* @__PURE__ */ jsxs("div", { className: "flex flex-shrink-0 items-center opacity-0 group-hover:opacity-100", children: [
17156
- /* @__PURE__ */ jsx(TokenUsagePopover, { tokenId: R, tokenName: _.name }),
17157
- /* @__PURE__ */ jsx(
17158
- Button,
17159
- {
17160
- variant: "ghost",
17161
- size: "sm",
17162
- onClick: () => P(R),
17163
- disabled: a || l !== null,
17164
- className: "h-6 w-6 p-0",
17165
- children: /* @__PURE__ */ jsx(Pencil1Icon, { className: "h-3 w-3" })
17166
- }
17167
- ),
17168
- /* @__PURE__ */ jsxs(AlertDialog, { children: [
17169
- /* @__PURE__ */ jsx(AlertDialogTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
17170
- Button,
17171
- {
17172
- variant: "ghost",
17173
- size: "sm",
17174
- disabled: a || l !== null,
17175
- className: "h-6 w-6 p-0",
17176
- children: /* @__PURE__ */ jsx(TrashIcon, { className: "h-3 w-3 text-destructive" })
17177
- }
17178
- ) }),
17179
- /* @__PURE__ */ jsxs(AlertDialogContent, { className: "max-w-md", children: [
17180
- /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
17181
- /* @__PURE__ */ jsx(AlertDialogTitle, { className: "text-base", children: r("Delete Token") }),
17182
- /* @__PURE__ */ jsxs(AlertDialogDescription, { className: "text-sm", children: [
17183
- r("Delete this token?"),
17184
- /* @__PURE__ */ jsx("br", {}),
17185
- /* @__PURE__ */ jsx("code", { className: "mt-1 inline-block rounded bg-muted px-1 py-0.5 font-mono text-xs", children: _.name })
17186
- ] })
17187
- ] }),
17188
- /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
17189
- /* @__PURE__ */ jsx(AlertDialogCancel, { className: "h-7 text-xs", children: r("Cancel") }),
17190
- /* @__PURE__ */ jsx(
17191
- AlertDialogAction,
17192
- {
17193
- onClick: () => j(R),
17194
- className: "h-7 bg-destructive text-xs text-destructive-foreground hover:bg-destructive/90",
17195
- children: r("Delete")
17196
- }
17197
- )
17198
- ] })
17199
- ] })
17200
- ] })
17201
- ] })
17202
- ]
17203
- },
17204
- R
17205
- )) }) }) }),
17206
- /* @__PURE__ */ jsx(Dialog, { open: d, onOpenChange: F, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-md", children: [
17207
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
17208
- /* @__PURE__ */ jsx(DialogTitle, { className: "text-base", children: r("Add Design Token") }),
17209
- /* @__PURE__ */ jsx(DialogDescription, { className: "text-sm", children: r("Create a new reusable design token with Tailwind classes.") })
17210
- ] }),
17211
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
17212
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
17213
- /* @__PURE__ */ jsx(Label, { htmlFor: "new-selector", className: "text-sm", children: r("Token Name") }),
17214
- /* @__PURE__ */ jsx(
17215
- Input$1,
17216
- {
17217
- id: "new-selector",
17218
- placeholder: "Button-Primary",
17219
- value: f,
17220
- onChange: (R) => H(R.target.value),
17221
- className: "text-sm"
17222
- }
17223
- ),
17224
- C ? /* @__PURE__ */ jsx("span", { className: "text-sm text-destructive", children: C }) : /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: r("Button-Primary, Card-Header, Text-Large") })
17225
- ] }),
17226
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
17227
- /* @__PURE__ */ jsx(Label, { htmlFor: "new-classes", className: "text-sm", children: r("Tailwind Classes") }),
17228
- /* @__PURE__ */ jsx(
17229
- Textarea,
17230
- {
17231
- id: "new-classes",
17232
- placeholder: "bg-blue-500 text-white px-4 py-2",
17233
- value: g,
17234
- onChange: (R) => b(R.target.value),
17235
- className: "min-h-[80px] resize-none font-mono text-xs"
17236
- }
17237
- )
17238
- ] })
17239
- ] }),
17240
- /* @__PURE__ */ jsxs(DialogFooter, { children: [
17241
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: F, className: "h-8 text-sm", children: r("Cancel") }),
17242
- /* @__PURE__ */ jsx(Button, { onClick: T, className: "h-8 text-sm", children: r("Add Token") })
17243
- ] })
17244
- ] }) }),
17245
- /* @__PURE__ */ jsx(Dialog, { open: p, onOpenChange: D, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-md", children: [
17246
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
17247
- /* @__PURE__ */ jsx(DialogTitle, { className: "text-base", children: r("Edit Design Token") }),
17248
- /* @__PURE__ */ jsx(DialogDescription, { className: "text-sm", children: r("Update the design token name and classes.") })
17249
- ] }),
17250
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
17251
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
17252
- /* @__PURE__ */ jsx(Label, { htmlFor: "edit-selector", className: "text-sm", children: r("Token Name") }),
17253
- /* @__PURE__ */ jsx(
17254
- Input$1,
17255
- {
17256
- id: "edit-selector",
17257
- value: x,
17258
- onChange: (R) => O(R.target.value),
17259
- className: "text-sm"
17260
- }
17261
- ),
17262
- B && /* @__PURE__ */ jsx("span", { className: "text-sm text-destructive", children: B })
17263
- ] }),
17264
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
17265
- /* @__PURE__ */ jsx(Label, { htmlFor: "edit-classes", className: "text-sm", children: r("Classes") }),
17266
- /* @__PURE__ */ jsx(
17267
- Textarea,
17268
- {
17269
- id: "edit-classes",
17270
- value: S,
17271
- onChange: (R) => k(R.target.value),
17272
- className: "min-h-[80px] resize-none font-mono text-xs"
17273
- }
17274
- )
17275
- ] })
17276
- ] }),
17277
- /* @__PURE__ */ jsxs(DialogFooter, { children: [
17278
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: D, className: "h-8 text-sm", children: r("Cancel") }),
17279
- /* @__PURE__ */ jsx(Button, { onClick: N, className: "h-8 text-sm", children: r("Update Token") })
17280
- ] })
17281
- ] }) })
17282
- ] });
17283
- }, DEFAULT_PANEL_WIDTH = 280, OutlineButton = ({ isActive: r, show: n }) => /* @__PURE__ */ jsx(Button, { variant: r ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(StackIcon, { className: "h-5 w-5" }) }), AddBlocksButton = ({ isActive: r, show: n }) => useIsDragAndDropEnabled() && /* @__PURE__ */ jsx(Button, { variant: r ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(PlusCircledIcon, { className: "h-5 w-5" }) }), AskAiButton = ({ isActive: r, show: n }) => /* @__PURE__ */ jsx(Button, { variant: r ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(AiIcon, {}) });
16944
+ }, useTopBarComponent = () => useMemo(() => TOP_BAR.component, []), ManageDesignTokens = React__default.lazy(() => import("./manage-design-tokens-BHCCrWFS.js")), DEFAULT_PANEL_WIDTH = 280, OutlineButton = ({ isActive: r, show: n }) => /* @__PURE__ */ jsx(Button, { variant: r ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(StackIcon, { className: "h-5 w-5" }) }), AddBlocksButton = ({ isActive: r, show: n }) => useIsDragAndDropEnabled() && /* @__PURE__ */ jsx(Button, { variant: r ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(PlusCircledIcon, { className: "h-5 w-5" }) }), AskAiButton = ({ isActive: r, show: n }) => /* @__PURE__ */ jsx(Button, { variant: r ? "default" : "ghost", size: "icon", onClick: n, children: /* @__PURE__ */ jsx(AiIcon, {}) });
17284
16945
  registerChaiSidebarPanel("add-block", {
17285
16946
  button: AddBlocksButton,
17286
16947
  label: "Add Blocks",
@@ -17306,24 +16967,24 @@ registerChaiSidebarPanel("outline", {
17306
16967
  panel: () => /* @__PURE__ */ jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsx(ListTree, {}) })
17307
16968
  });
17308
16969
  const RootLayout = () => {
17309
- const r = useTopBarComponent(), [n, o] = useSidebarActivePanel(), a = useRef("outline"), [i, l] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), [, u] = useActiveSettingsTab(), p = useChaiSidebarPanels("top"), h = useChaiSidebarPanels("bottom"), f = reverse([...h ?? []]), m = useCallback((A) => {
17310
- A.preventDefault();
16970
+ const r = useTopBarComponent(), [n, o] = useSidebarActivePanel(), a = useRef("outline"), [i, l] = useState(DEFAULT_PANEL_WIDTH), [c, d] = useRightPanel(), [, u] = useActiveSettingsTab(), p = useChaiSidebarPanels("top"), h = useChaiSidebarPanels("bottom"), f = reverse([...h ?? []]), m = useCallback((w) => {
16971
+ w.preventDefault();
17311
16972
  }, []), g = useMemo(() => [p].flat(), [p]), b = useCallback(
17312
- (A) => {
17313
- console.log("handleMenuItemClick", A, n), o(n === A ? null : A);
16973
+ (w) => {
16974
+ console.log("handleMenuItemClick", w, n), o(n === w ? null : w);
17314
16975
  },
17315
16976
  [n, o]
17316
16977
  ), { t: x } = useTranslation(), y = useMemo(() => [...p, ...h], [p, h]), S = useBuilderProp("htmlDir", "ltr"), k = find(y, { id: n }) ?? first$1(y), C = get(k, "width", DEFAULT_PANEL_WIDTH);
17317
16978
  useEffect(() => {
17318
16979
  if (n !== null) {
17319
- const A = find(y, { id: n });
17320
- A && get(A, "view", "standard") === "standard" && (a.current = n, l(get(A, "width", DEFAULT_PANEL_WIDTH)));
16980
+ const w = find(y, { id: n });
16981
+ w && get(w, "view", "standard") === "standard" && (a.current = n, l(get(w, "width", DEFAULT_PANEL_WIDTH)));
17321
16982
  }
17322
16983
  }, [n, y]);
17323
16984
  const E = useMemo(() => {
17324
16985
  if (n === null) return 0;
17325
- const A = find(y, { id: n });
17326
- return get(A, "view", "standard") === "standard" ? C : i;
16986
+ const w = find(y, { id: n });
16987
+ return get(w, "view", "standard") === "standard" ? C : i;
17327
16988
  }, [n, C, i, y]), B = useCallback(() => {
17328
16989
  o(a.current);
17329
16990
  }, [o, n]), I = useCallback(() => {
@@ -17332,9 +16993,9 @@ const RootLayout = () => {
17332
16993
  useEffect(() => {
17333
16994
  n !== null && !find(y, { id: n }) && o("outline");
17334
16995
  }, [n, y]);
17335
- const w = useCallback(
17336
- (A) => {
17337
- b(A);
16996
+ const A = useCallback(
16997
+ (w) => {
16998
+ b(w);
17338
16999
  },
17339
17000
  [b]
17340
17001
  );
@@ -17348,24 +17009,24 @@ const RootLayout = () => {
17348
17009
  /* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(r, {}) }) }),
17349
17010
  /* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
17350
17011
  /* @__PURE__ */ jsxs("div", { id: "sidebar", className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
17351
- /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: g.map((A, v) => /* @__PURE__ */ jsxs(Tooltip, { children: [
17352
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(A, "button", NoopComponent), {
17012
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-1", children: g.map((w, v) => /* @__PURE__ */ jsxs(Tooltip, { children: [
17013
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
17353
17014
  position: "top",
17354
- panelId: A.id,
17355
- isActive: n === A.id,
17356
- show: () => w(A.id)
17015
+ panelId: w.id,
17016
+ isActive: n === w.id,
17017
+ show: () => A(w.id)
17357
17018
  }) }),
17358
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(A.label) }) })
17019
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
17359
17020
  ] }, "button-top-" + v)) }),
17360
17021
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
17361
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: f == null ? void 0 : f.map((A, v) => /* @__PURE__ */ jsxs(Tooltip, { children: [
17362
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(A, "button", NoopComponent), {
17022
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: f == null ? void 0 : f.map((w, v) => /* @__PURE__ */ jsxs(Tooltip, { children: [
17023
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: createElement(get(w, "button", NoopComponent), {
17363
17024
  position: "bottom",
17364
- panelId: A.id,
17365
- isActive: n === A.id,
17366
- show: () => w(A.id)
17025
+ panelId: w.id,
17026
+ isActive: n === w.id,
17027
+ show: () => A(w.id)
17367
17028
  }) }),
17368
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(A.label) }) })
17029
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(w.label) }) })
17369
17030
  ] }, "button-bottom-" + v)) })
17370
17031
  ] }),
17371
17032
  /* @__PURE__ */ jsx(
@@ -17438,7 +17099,7 @@ const RootLayout = () => {
17438
17099
  }
17439
17100
  )
17440
17101
  ] }) : null }) }) }),
17441
- /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: c === "ai" ? /* @__PURE__ */ jsx(AskAI, {}) : c === "design-tokens" ? /* @__PURE__ */ jsx(ManageDesignTokens, {}) : c === "theme" ? /* @__PURE__ */ jsx(ThemeConfigPanel, {}) : /* @__PURE__ */ jsx(SettingsPanel, {}) }) })
17102
+ /* @__PURE__ */ jsx("div", { className: "flex h-full max-h-full w-full", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: c === "ai" ? /* @__PURE__ */ jsx(AskAI, {}) : c === "design-tokens" ? /* @__PURE__ */ jsx(React__default.Suspense, { fallback: /* @__PURE__ */ jsx("div", { className: "h-1/2 w-full animate-pulse" }), children: /* @__PURE__ */ jsx(ManageDesignTokens, {}) }) : c === "theme" ? /* @__PURE__ */ jsx(ThemeConfigPanel, {}) : /* @__PURE__ */ jsx(SettingsPanel, {}) }) })
17442
17103
  ] }) })
17443
17104
  }
17444
17105
  )
@@ -17570,8 +17231,8 @@ const RootLayout = () => {
17570
17231
  });
17571
17232
  }, m = (b) => {
17572
17233
  if (!c) return;
17573
- const x = b.clientX - u.x, y = b.clientY - u.y, S = b.currentTarget, k = S.offsetWidth, C = S.offsetHeight, E = window.innerWidth - k, B = window.innerHeight - C, I = Math.max(0, Math.min(x, E)), w = Math.max(0, Math.min(y, B));
17574
- o(I, w);
17234
+ const x = b.clientX - u.x, y = b.clientY - u.y, S = b.currentTarget, k = S.offsetWidth, C = S.offsetHeight, E = window.innerWidth - k, B = window.innerHeight - C, I = Math.max(0, Math.min(x, E)), A = Math.max(0, Math.min(y, B));
17235
+ o(I, A);
17575
17236
  }, g = () => {
17576
17237
  d(!1);
17577
17238
  };
@@ -17816,10 +17477,10 @@ const atomRead = (r, n, ...o) => n.read(...o), atomWrite = (r, n, ...o) => n.wri
17816
17477
  var o;
17817
17478
  const a = getBuildingBlocks(r), i = a[1], l = a[2], c = a[3], d = a[6], u = a[7], p = a[11], h = a[12], f = a[13], m = a[14], g = a[16], b = a[17], x = p(r, n);
17818
17479
  if (isAtomStateInitialized(x) && (i.has(n) && l.get(n) !== x.n || Array.from(x.d).every(
17819
- ([w, A]) => (
17480
+ ([A, w]) => (
17820
17481
  // Recursively, read the atom state of the dependency, and
17821
17482
  // check if the atom epoch number is unchanged
17822
- m(r, w).n === A
17483
+ m(r, A).n === w
17823
17484
  )
17824
17485
  )))
17825
17486
  return x;
@@ -17828,22 +17489,22 @@ const atomRead = (r, n, ...o) => n.read(...o), atomWrite = (r, n, ...o) => n.wri
17828
17489
  function S() {
17829
17490
  i.has(n) && (b(r, n), f(r), h(r));
17830
17491
  }
17831
- function k(w) {
17832
- var A;
17833
- if (isSelfAtom(n, w)) {
17834
- const T = p(r, w);
17492
+ function k(A) {
17493
+ var w;
17494
+ if (isSelfAtom(n, A)) {
17495
+ const T = p(r, A);
17835
17496
  if (!isAtomStateInitialized(T))
17836
- if (hasInitialValue(w))
17837
- setAtomStateValueOrPromise(r, w, w.init);
17497
+ if (hasInitialValue(A))
17498
+ setAtomStateValueOrPromise(r, A, A.init);
17838
17499
  else
17839
17500
  throw new Error("no atom init");
17840
17501
  return returnAtomValue(T);
17841
17502
  }
17842
- const v = m(r, w);
17503
+ const v = m(r, A);
17843
17504
  try {
17844
17505
  return returnAtomValue(v);
17845
17506
  } finally {
17846
- x.d.set(w, v.n), isPendingPromise(x.v) && addPendingPromiseToDependency(n, x.v, v), (A = i.get(w)) == null || A.t.add(n), y || S();
17507
+ x.d.set(A, v.n), isPendingPromise(x.v) && addPendingPromiseToDependency(n, x.v, v), (w = i.get(A)) == null || w.t.add(n), y || S();
17847
17508
  }
17848
17509
  }
17849
17510
  let C, E;
@@ -17852,10 +17513,10 @@ const atomRead = (r, n, ...o) => n.read(...o), atomWrite = (r, n, ...o) => n.wri
17852
17513
  return C || (C = new AbortController()), C.signal;
17853
17514
  },
17854
17515
  get setSelf() {
17855
- return !E && isActuallyWritableAtom(n) && (E = (...w) => {
17516
+ return !E && isActuallyWritableAtom(n) && (E = (...A) => {
17856
17517
  if (!y)
17857
17518
  try {
17858
- return g(r, n, ...w);
17519
+ return g(r, n, ...A);
17859
17520
  } finally {
17860
17521
  f(r), h(r);
17861
17522
  }
@@ -17863,10 +17524,10 @@ const atomRead = (r, n, ...o) => n.read(...o), atomWrite = (r, n, ...o) => n.wri
17863
17524
  }
17864
17525
  }, I = x.n;
17865
17526
  try {
17866
- const w = u(r, n, k, B);
17867
- return setAtomStateValueOrPromise(r, n, w), isPromiseLike$1(w) && (registerAbortHandler(w, () => C == null ? void 0 : C.abort()), w.then(S, S)), x;
17868
- } catch (w) {
17869
- return delete x.v, x.e = w, ++x.n, x;
17527
+ const A = u(r, n, k, B);
17528
+ return setAtomStateValueOrPromise(r, n, A), isPromiseLike$1(A) && (registerAbortHandler(A, () => C == null ? void 0 : C.abort()), A.then(S, S)), x;
17529
+ } catch (A) {
17530
+ return delete x.v, x.e = A, ++x.n, x;
17870
17531
  } finally {
17871
17532
  y = !1, I !== x.n && l.get(n) === I && (l.set(n, x.n), c.add(n), (o = d.c) == null || o.call(d, n));
17872
17533
  }
@@ -18559,103 +18220,108 @@ ${i})
18559
18220
  if (typeof window > "u")
18560
18221
  throw new Error("@chaibuilder/sdk is only supported in the browser. Avoid using it in the server side.");
18561
18222
  export {
18562
- useCanvasZoom as $,
18223
+ useAddBlock as $,
18563
18224
  AddBlocksPanel as A,
18564
18225
  BlockSettings as B,
18565
18226
  CanvasArea as C,
18566
18227
  DarkMode as D,
18567
18228
  ExportCodeModal as E,
18568
- registerChaiFeatureFlag as F,
18569
- registerChaiFeatureFlags as G,
18570
- useChaiFeatureFlag as H,
18229
+ registerBlockSettingWidget as F,
18230
+ registerChaiPreImportHTMLHook as G,
18231
+ registerChaiLibrary as H,
18571
18232
  ImportHTML as I,
18572
- useChaiFeatureFlags as J,
18573
- useToggleChaiFeatureFlag as K,
18233
+ registerChaiMediaManager as J,
18234
+ registerChaiSaveToLibrary as K,
18574
18235
  ListTree as L,
18575
- useMediaManagerComponent as M,
18236
+ ManualClasses as M,
18576
18237
  NestedPathSelector as N,
18577
- useActiveSettingsTab as O,
18578
- PERMISSIONS as P,
18579
- useAddBlock as Q,
18580
- useAddClassesToBlocks as R,
18581
- useAskAi as S,
18238
+ registerChaiSidebarPanel as O,
18239
+ registerChaiTopBar as P,
18240
+ IfChaiFeatureFlag as Q,
18241
+ registerChaiFeatureFlag as R,
18242
+ registerChaiFeatureFlags as S,
18582
18243
  ThemeConfigPanel as T,
18583
18244
  UILibrariesPanel as U,
18584
- useBlockHighlight as V,
18585
- useBlocksHtmlForAi as W,
18586
- useBlocksStore as X,
18587
- useBrandingOptions as Y,
18588
- useBuilderProp as Z,
18589
- useBuilderReset as _,
18245
+ useChaiFeatureFlag as V,
18246
+ useChaiFeatureFlags as W,
18247
+ useToggleChaiFeatureFlag as X,
18248
+ useMediaManagerComponent as Y,
18249
+ PERMISSIONS as Z,
18250
+ useActiveSettingsTab as _,
18590
18251
  useSelectedBlockIds as a,
18591
- useCopyBlocks as a0,
18592
- useCopyToClipboard as a1,
18593
- useCurrentPage as a2,
18594
- useCutBlockIds as a3,
18595
- useDarkMode as a4,
18596
- useDuplicateBlocks as a5,
18597
- useHighlightBlockId as a6,
18598
- useHtmlToBlocks as a7,
18599
- useI18nBlocks as a8,
18600
- useInlineEditing as a9,
18601
- useThemeOptions as aA,
18602
- useUndoManager as aB,
18603
- useWrapperBlock as aC,
18604
- useBlocksStoreUndoableActions as aD,
18605
- useCanvasWidth as aE,
18606
- useCanvasDisplayWidth as aF,
18607
- useScreenSizeWidth as aG,
18608
- useSelectedLibrary as aH,
18609
- useSidebarActivePanel as aI,
18610
- useIsPageLoaded as aa,
18611
- useLanguages as ab,
18612
- useLibraryBlocks as ac,
18613
- usePartialBlocksStore as ad,
18614
- usePartialBlocksList as ae,
18615
- usePasteBlocks as af,
18616
- usePermissions as ag,
18617
- usePreviewMode as ah,
18618
- usePubSub as ai,
18619
- useRemoveAllClassesForBlock as aj,
18620
- useRemoveBlocks as ak,
18621
- useRemoveClassesFromBlocks as al,
18622
- useReplaceBlock as am,
18623
- useResetBlockStyles as an,
18624
- useRightPanel as ao,
18625
- useSavePage as ap,
18626
- useSelectedBlock as aq,
18627
- useSelectedBlockAllClasses as ar,
18628
- useSelectedBlockCurrentClasses as as,
18629
- useSelectedBlocksDisplayChild as at,
18630
- useSelectedBreakpoints as au,
18631
- useSelectedStylingBlocks as av,
18632
- useStreamMultipleBlocksProps as aw,
18633
- useStylingBreakpoint as ax,
18634
- useStylingState as ay,
18635
- useTheme as az,
18252
+ useAddClassesToBlocks as a0,
18253
+ useAskAi as a1,
18254
+ useBlockHighlight as a2,
18255
+ useBlocksHtmlForAi as a3,
18256
+ useBrandingOptions as a4,
18257
+ useBuilderReset as a5,
18258
+ useCanvasZoom as a6,
18259
+ useCopyBlocks as a7,
18260
+ useCopyToClipboard as a8,
18261
+ useCurrentPage as a9,
18262
+ useSelectedStylingBlocks as aA,
18263
+ useStreamMultipleBlocksProps as aB,
18264
+ useStylingBreakpoint as aC,
18265
+ useStylingState as aD,
18266
+ useTheme as aE,
18267
+ useThemeOptions as aF,
18268
+ useUndoManager as aG,
18269
+ useWrapperBlock as aH,
18270
+ useBlocksStoreUndoableActions as aI,
18271
+ useCanvasWidth as aJ,
18272
+ useCanvasDisplayWidth as aK,
18273
+ useScreenSizeWidth as aL,
18274
+ useSelectedLibrary as aM,
18275
+ useSidebarActivePanel as aN,
18276
+ useCutBlockIds as aa,
18277
+ useDarkMode as ab,
18278
+ useDuplicateBlocks as ac,
18279
+ useHighlightBlockId as ad,
18280
+ useHtmlToBlocks as ae,
18281
+ useI18nBlocks as af,
18282
+ useInlineEditing as ag,
18283
+ useIsPageLoaded as ah,
18284
+ useLibraryBlocks as ai,
18285
+ usePartialBlocksStore as aj,
18286
+ usePartialBlocksList as ak,
18287
+ usePasteBlocks as al,
18288
+ usePermissions as am,
18289
+ usePreviewMode as an,
18290
+ usePubSub as ao,
18291
+ useRemoveAllClassesForBlock as ap,
18292
+ useRemoveBlocks as aq,
18293
+ useRemoveClassesFromBlocks as ar,
18294
+ useReplaceBlock as as,
18295
+ useResetBlockStyles as at,
18296
+ useRightPanel as au,
18297
+ useSelectedBlock as av,
18298
+ useSelectedBlockAllClasses as aw,
18299
+ useSelectedBlockCurrentClasses as ax,
18300
+ useSelectedBlocksDisplayChild as ay,
18301
+ useSelectedBreakpoints as az,
18636
18302
  useUpdateBlocksProps as b,
18637
18303
  useUpdateBlocksPropsRealtime as c,
18638
18304
  usePageExternalData as d,
18639
- BlockStyling as e,
18640
- AIUserPrompt as f,
18641
- Breakpoints$1 as g,
18642
- UndoRedo as h,
18643
- ChaiBuilderEditor as i,
18644
- AddBlocksDialog as j,
18645
- BlockAttributesEditor as k,
18646
- DefaultChaiBlocks as l,
18647
- ChaiDraggableBlock as m,
18648
- getClassValueAndUnit as n,
18649
- registerBlockSettingField as o,
18650
- registerBlockSettingTemplate as p,
18651
- registerBlockSettingWidget as q,
18652
- registerChaiAddBlockTab as r,
18653
- registerChaiPreImportHTMLHook as s,
18654
- registerChaiLibrary as t,
18305
+ chaiDesignTokensAtom as e,
18306
+ useIncrementActionsCount as f,
18307
+ useBlocksStore as g,
18308
+ useBuilderProp as h,
18309
+ useLanguages as i,
18310
+ useSavePage as j,
18311
+ BlockStyling as k,
18312
+ AIUserPrompt as l,
18313
+ Breakpoints$1 as m,
18314
+ UndoRedo as n,
18315
+ orderClassesByBreakpoint as o,
18316
+ ChaiBuilderEditor as p,
18317
+ AddBlocksDialog as q,
18318
+ removeDuplicateClasses as r,
18319
+ BlockAttributesEditor as s,
18320
+ DefaultChaiBlocks as t,
18655
18321
  useCodeEditor as u,
18656
- registerChaiMediaManager as v,
18657
- registerChaiSaveToLibrary as w,
18658
- registerChaiSidebarPanel as x,
18659
- registerChaiTopBar as y,
18660
- IfChaiFeatureFlag as z
18322
+ ChaiDraggableBlock as v,
18323
+ getClassValueAndUnit as w,
18324
+ registerChaiAddBlockTab as x,
18325
+ registerBlockSettingField as y,
18326
+ registerBlockSettingTemplate as z
18661
18327
  };