@chaibuilder/sdk 2.2.35 → 2.2.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js CHANGED
@@ -1,6 +1,6 @@
1
- var V = Object.defineProperty;
2
- var F = (o, n, r) => n in o ? V(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
3
- var H = (o, n, r) => F(o, typeof n != "symbol" ? n + "" : n, r);
1
+ var U = Object.defineProperty;
2
+ var V = (o, n, r) => n in o ? U(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
3
+ var H = (o, n, r) => V(o, typeof n != "symbol" ? n + "" : n, r);
4
4
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
5
  import { useRegisteredChaiBlocks, getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredFonts, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
6
6
  import { BoxModelIcon, PinTopIcon, PinBottomIcon, PinLeftIcon, PinRightIcon, ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, FontBoldIcon, FontItalicIcon, UnderlineIcon, StrikethroughIcon, CodeIcon, Link1Icon, ListBulletIcon, HeadingIcon, QuoteIcon, TextAlignLeftIcon, TextAlignCenterIcon, TextAlignRightIcon, LoopIcon, ResetIcon, InfoCircledIcon, TriangleDownIcon, RowSpacingIcon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross2Icon, Cross1Icon, BoxIcon, MinusIcon, CrossCircledIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, CaretRightIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, CheckIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
@@ -11,7 +11,7 @@ import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultS
11
11
  import { atomWithStorage, splitAtom, useAtomCallback } from "jotai/utils";
12
12
  import { g as generateUUID, a as getBreakpointValue, c as cn$2 } from "./common-functions-BGzDsf1z.js";
13
13
  import { v as Button, ab as DropdownMenu, ap as DropdownMenuTrigger, ad as DropdownMenuContent, af as DropdownMenuItem, b9 as cn$1, aW as Skeleton, d as Alert, e as AlertDescription, at as Input$1, a1 as Dialog, aa as DialogTrigger, a3 as DialogContent, av as Popover, b5 as Tooltip, b8 as TooltipTrigger, ay as PopoverTrigger, b6 as TooltipContent, ax as PopoverContent, F as Command, H as CommandInput, I as CommandList, J as CommandEmpty, K as CommandGroup, L as CommandItem, a6 as DialogHeader, a9 as DialogTitle, B as Badge, 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, b2 as Textarea, A as Accordion, C as Card, D as CardHeader, y as CardDescription, x as CardContent, au as Label, z as CardFooter, az as ScrollArea, a_ as Tabs, b0 as TabsList, b1 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, aZ as Switch, r as Avatar, aL as Separator, b7 as TooltipProvider, aM as Sheet, aO as SheetContent, aR as SheetHeader, aU as SheetTitle, aY as Toaster } from "./toggle-BFR6fqvM.js";
14
- import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, ChevronLeft, DatabaseIcon, Plus, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, PlusCircle, ChevronDown, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Moon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Paintbrush, Layers } from "lucide-react";
14
+ import { ChevronRight, PlusIcon as PlusIcon$1, AlertCircle, X, ChevronLeft, DatabaseIcon, Plus, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, PlusCircle, ChevronDown, File, Database, MoreVertical, Loader, SparklesIcon, Search, RefreshCw, Globe, SaveIcon, UnlinkIcon, PencilIcon, EyeOffIcon, Eye, ChevronsUpDown, ChevronsDownUp, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, SunIcon, Moon, Sparkles, Loader2, Image as Image$1, Send, DatabaseZapIcon, Edit2, Paintbrush, Layers, Settings as Settings$1 } from "lucide-react";
15
15
  import clsx$1, { clsx } from "clsx";
16
16
  import { twMerge } from "tailwind-merge";
17
17
  import TreeModel from "tree-model";
@@ -21,7 +21,7 @@ import { isObject } from "@rjsf/utils";
21
21
  import { useDebouncedCallback, useThrottledCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
22
22
  import { toast } from "sonner";
23
23
  import { useTranslation, initReactI18next } from "react-i18next";
24
- import { useTranslation as Fe } from "react-i18next";
24
+ import { useTranslation as Ve } from "react-i18next";
25
25
  import Fuse from "fuse.js";
26
26
  import UndoManager from "undo-manager";
27
27
  import Link from "@tiptap/extension-link";
@@ -34,7 +34,7 @@ import RjForm from "@rjsf/core";
34
34
  import validator from "@rjsf/validator-ajv8";
35
35
  import "next-themes";
36
36
  import Autosuggest from "react-autosuggest";
37
- import { useFeature, FlagsProvider } from "flagged";
37
+ import { useFeature } from "flagged";
38
38
  import { parse, stringify } from "himalaya";
39
39
  import { Tree } from "react-arborist";
40
40
  import i18n from "i18next";
@@ -344,16 +344,16 @@ function insertBlocksAtPosition(o, n, r, a) {
344
344
  _type: "Text",
345
345
  content: u.content
346
346
  };
347
- Object.keys(u).forEach((f) => {
348
- f.startsWith("content-") && (h[f] = u[f]);
349
- }), l.unshift(h), i = i.map((f) => {
350
- if (f._id === r) {
351
- const x = { ...f, content: "" };
352
- return Object.keys(x).forEach((k) => {
353
- k.startsWith("content-") && (x[k] = "");
354
- }), x;
347
+ Object.keys(u).forEach((x) => {
348
+ x.startsWith("content-") && (h[x] = u[x]);
349
+ }), l.unshift(h), i = i.map((x) => {
350
+ if (x._id === r) {
351
+ const f = { ...x, content: "" };
352
+ return Object.keys(f).forEach((k) => {
353
+ k.startsWith("content-") && (f[k] = "");
354
+ }), f;
355
355
  }
356
- return f;
356
+ return x;
357
357
  });
358
358
  }
359
359
  }
@@ -481,15 +481,15 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
481
481
  if (g.length === 2) {
482
482
  const m = g.find((h) => h._id !== d);
483
483
  if (m && m._type === "Text") {
484
- const h = r.find((f) => f._id === u);
485
- h && "content" in h && (r = r.map((f) => {
486
- if (f._id === u) {
487
- const x = { ...f, content: m.content };
484
+ const h = r.find((x) => x._id === u);
485
+ h && "content" in h && (r = r.map((x) => {
486
+ if (x._id === u) {
487
+ const f = { ...x, content: m.content };
488
488
  return Object.keys(m).forEach((k) => {
489
- k.startsWith("content-") && (x[k] = m[k]);
490
- }), x;
489
+ k.startsWith("content-") && (f[k] = m[k]);
490
+ }), f;
491
491
  }
492
- return f;
492
+ return x;
493
493
  }), a.push(m._id));
494
494
  }
495
495
  }
@@ -572,32 +572,32 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
572
572
  status: "idle",
573
573
  props: {},
574
574
  error: void 0
575
- }), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (f) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), m = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
575
+ }), c = useUpdateBlocksPropsRealtime(), d = useBuilderProp("getBlockAsyncProps", async (x) => ({})), p = useSetAtom$1(blockRepeaterDataAtom), u = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), g = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), m = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
576
576
  return useEffect(() => {
577
577
  if (n === "mock") {
578
578
  if (isFunction(a)) {
579
- i((x) => ({ ...x, status: "loading", props: {} }));
580
- const f = a({ block: o });
581
- if (!isObject(f))
579
+ i((f) => ({ ...f, status: "loading", props: {} }));
580
+ const x = a({ block: o });
581
+ if (!isObject(x))
582
582
  throw new Error("mockDataProvider should return an object");
583
- i((x) => ({ ...x, status: "loaded", props: f }));
583
+ i((f) => ({ ...f, status: "loaded", props: x }));
584
584
  }
585
585
  return;
586
586
  }
587
- n === "live" && (!g && !m || (i((f) => ({ ...f, status: "loading", props: {} })), d({ block: o }).then((f = {}) => {
588
- g ? (p((x) => ({
589
- ...x,
587
+ n === "live" && (!g && !m || (i((x) => ({ ...x, status: "loading", props: {} })), d({ block: o }).then((x = {}) => {
588
+ g ? (p((f) => ({
589
+ ...f,
590
590
  [o._id]: {
591
591
  status: "loaded",
592
- props: get(f, "items", []),
592
+ props: get(x, "items", []),
593
593
  repeaterItems: o.repeaterItems
594
594
  }
595
- })), i((x) => ({ ...x, status: "loaded", props: { totalItems: get(f, "totalItems") } })), c([o._id], { totalItems: get(f, "totalItems") })) : i((x) => ({ ...x, status: "loaded", props: isObject(f) ? f : {} }));
596
- }).catch((f) => {
597
- g ? (p((x) => ({
598
- ...x,
599
- [o._id]: { status: "error", error: f, props: [] }
600
- })), i((x) => ({ ...x, status: "error", error: f, props: {} }))) : i((x) => ({ ...x, status: "error", error: f, props: {} }));
595
+ })), i((f) => ({ ...f, status: "loaded", props: { totalItems: get(x, "totalItems") } })), c([o._id], { totalItems: get(x, "totalItems") })) : i((f) => ({ ...f, status: "loaded", props: isObject(x) ? x : {} }));
596
+ }).catch((x) => {
597
+ g ? (p((f) => ({
598
+ ...f,
599
+ [o._id]: { status: "error", error: x, props: [] }
600
+ })), i((f) => ({ ...f, status: "error", error: x, props: {} }))) : i((f) => ({ ...f, status: "error", error: x, props: {} }));
601
601
  })));
602
602
  }, [o == null ? void 0 : o._id, u, g, m, a, n]), {
603
603
  $loading: get(l, "status") === "loading",
@@ -799,65 +799,65 @@ const undoRedoStateAtom = atom({
799
799
  updateBlocksProps: c
800
800
  } = useBlocksStoreManager();
801
801
  return {
802
- moveBlocks: (x, k, b) => {
803
- const v = map(x, (w) => {
802
+ moveBlocks: (f, k, b) => {
803
+ const v = map(f, (w) => {
804
804
  const E = n.find((N) => N._id === w)._parent || null, A = n.filter((N) => E ? N._parent === E : !N._parent).map((N) => N._id).indexOf(w);
805
805
  return { _id: w, oldParent: E, oldPosition: A };
806
- }), B = v.find(({ _id: w }) => w === x[0]);
807
- B && B.oldParent === k && B.oldPosition === b || (i(x, k, b), o({
806
+ }), B = v.find(({ _id: w }) => w === f[0]);
807
+ B && B.oldParent === k && B.oldPosition === b || (i(f, k, b), o({
808
808
  undo: () => each(v, ({ _id: w, oldParent: _, oldPosition: E }) => {
809
809
  i([w], _, E);
810
810
  }),
811
- redo: () => i(x, k, b)
811
+ redo: () => i(f, k, b)
812
812
  }));
813
813
  },
814
- addBlocks: (x, k, b) => {
815
- a(x, k, b), o({
816
- undo: () => l(map(x, "_id")),
817
- redo: () => a(x, k, b)
814
+ addBlocks: (f, k, b) => {
815
+ a(f, k, b), o({
816
+ undo: () => l(map(f, "_id")),
817
+ redo: () => a(f, k, b)
818
818
  });
819
819
  },
820
- removeBlocks: (x) => {
820
+ removeBlocks: (f) => {
821
821
  var B;
822
- const k = (B = first(x)) == null ? void 0 : B._parent, v = n.filter((w) => k ? w._parent === k : !w._parent).indexOf(first(x));
823
- l(map(x, "_id")), o({
824
- undo: () => a(x, k, v),
825
- redo: () => l(map(x, "_id"))
822
+ const k = (B = first(f)) == null ? void 0 : B._parent, v = n.filter((w) => k ? w._parent === k : !w._parent).indexOf(first(f));
823
+ l(map(f, "_id")), o({
824
+ undo: () => a(f, k, v),
825
+ redo: () => l(map(f, "_id"))
826
826
  });
827
827
  },
828
- updateBlocks: (x, k, b) => {
828
+ updateBlocks: (f, k, b) => {
829
829
  let v = [];
830
830
  if (b)
831
- v = map(x, (B) => ({ _id: B, ...b }));
831
+ v = map(f, (B) => ({ _id: B, ...b }));
832
832
  else {
833
833
  const B = keys(k);
834
- v = map(x, (w) => {
834
+ v = map(f, (w) => {
835
835
  const _ = n.find((C) => C._id === w), E = { _id: w };
836
836
  return each(B, (C) => E[C] = _[C]), E;
837
837
  });
838
838
  }
839
- c(map(x, (B) => ({ _id: B, ...k }))), o({
839
+ c(map(f, (B) => ({ _id: B, ...k }))), o({
840
840
  undo: () => c(v),
841
- redo: () => c(map(x, (B) => ({ _id: B, ...k })))
841
+ redo: () => c(map(f, (B) => ({ _id: B, ...k })))
842
842
  });
843
843
  },
844
- updateBlocksRuntime: (x, k) => {
845
- c(map(x, (b) => ({ _id: b, ...k })));
844
+ updateBlocksRuntime: (f, k) => {
845
+ c(map(f, (b) => ({ _id: b, ...k })));
846
846
  },
847
- setNewBlocks: (x) => {
848
- r(x), o({
847
+ setNewBlocks: (f) => {
848
+ r(f), o({
849
849
  undo: () => r(n),
850
- redo: () => r(x)
850
+ redo: () => r(f)
851
851
  });
852
852
  },
853
- updateMultipleBlocksProps: (x) => {
853
+ updateMultipleBlocksProps: (f) => {
854
854
  let k = [];
855
- k = map(x, (b) => {
855
+ k = map(f, (b) => {
856
856
  const v = keys(b), B = n.find((_) => _._id === b._id), w = {};
857
857
  return each(v, (_) => w[_] = B[_]), w;
858
- }), c(x), o({
858
+ }), c(f), o({
859
859
  undo: () => c(k),
860
- redo: () => c(x)
860
+ redo: () => c(f)
861
861
  });
862
862
  }
863
863
  };
@@ -865,12 +865,12 @@ const undoRedoStateAtom = atom({
865
865
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
866
866
  (i, c, d) => {
867
867
  var h;
868
- for (let f = 0; f < i.length; f++) {
869
- const { _id: x } = i[f];
870
- i[f]._id = generateUUID();
871
- const k = filter(i, { _parent: x });
868
+ for (let x = 0; x < i.length; x++) {
869
+ const { _id: f } = i[x];
870
+ i[x]._id = generateUUID();
871
+ const k = filter(i, { _parent: f });
872
872
  for (let b = 0; b < k.length; b++)
873
- k[b]._parent = i[f]._id;
873
+ k[b]._parent = i[x]._id;
874
874
  }
875
875
  const p = first(i);
876
876
  let u, g;
@@ -2332,25 +2332,25 @@ const getBlockWithChildren = (o, n) => {
2332
2332
  return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
2333
2333
  })
2334
2334
  ), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
2335
- const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, m = (h, f) => {
2336
- const x = cloneDeep(f.find((k) => k._id === h));
2337
- for (const k in x) {
2338
- const b = x[k];
2335
+ const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, m = (h, x) => {
2336
+ const f = cloneDeep(x.find((k) => k._id === h));
2337
+ for (const k in f) {
2338
+ const b = f[k];
2339
2339
  if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
2340
2340
  const { baseClasses: v, classes: B } = getSplitChaiClasses(b);
2341
- x[k] = compact(flattenDeep([v, B])).join(" ");
2341
+ f[k] = compact(flattenDeep([v, B])).join(" ");
2342
2342
  } else
2343
- k !== "_id" && delete x[k];
2343
+ k !== "_id" && delete f[k];
2344
2344
  }
2345
- return x;
2345
+ return f;
2346
2346
  };
2347
2347
  return {
2348
2348
  askAi: useCallback(
2349
- async (h, f, x, k) => {
2349
+ async (h, x, f, k) => {
2350
2350
  if (l) {
2351
2351
  n(!0), a(null);
2352
2352
  try {
2353
- const b = p === u ? "" : p, v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [m(f, d)], B = await l(h, addLangToPrompt(x, g, h), v, b), { blocks: w, error: _ } = B;
2353
+ const b = p === u ? "" : p, v = h === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(x, d)), p) : [m(x, d)], B = await l(h, addLangToPrompt(f, g, h), v, b), { blocks: w, error: _ } = B;
2354
2354
  if (_) {
2355
2355
  a(_);
2356
2356
  return;
@@ -2462,12 +2462,12 @@ const getBlockWithChildren = (o, n) => {
2462
2462
  if (!p)
2463
2463
  return m;
2464
2464
  let h = [];
2465
- for (const f of m)
2466
- if (f._type === "PartialBlock" || f._type === "GlobalBlock") {
2467
- let x = l(f.partialBlockId);
2468
- f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((k) => (isEmpty(k._parent) && set(k, "_parent", f._parent), k))), h = [...h, ...x];
2465
+ for (const x of m)
2466
+ if (x._type === "PartialBlock" || x._type === "GlobalBlock") {
2467
+ let f = l(x.partialBlockId);
2468
+ x._parent && (f == null ? void 0 : f.length) > 0 && (f = f.map((k) => (isEmpty(k._parent) && set(k, "_parent", x._parent), k))), h = [...h, ...f];
2469
2469
  } else
2470
- h.push(f);
2470
+ h.push(x);
2471
2471
  return h;
2472
2472
  })
2473
2473
  };
@@ -2650,13 +2650,13 @@ const getBlockWithChildren = (o, n) => {
2650
2650
  const d = o(c), p = a;
2651
2651
  let { classes: u, baseClasses: g } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
2652
2652
  return each(p, (m) => {
2653
- const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2654
- u = u.replace(f, " ").replace(/\s+/g, " ").trim();
2655
- const x = first(m.split(":"));
2656
- includes(["2xl", "xl", "lg", "md", "sm"], x) && p.push(m.split(":").pop().trim());
2653
+ const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2654
+ u = u.replace(x, " ").replace(/\s+/g, " ").trim();
2655
+ const f = first(m.split(":"));
2656
+ includes(["2xl", "xl", "lg", "md", "sm"], f) && p.push(m.split(":").pop().trim());
2657
2657
  }), each(p, (m) => {
2658
- const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2659
- g = g.replace(f, " ").replace(/\s+/g, " ").trim();
2658
+ const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), x = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2659
+ g = g.replace(x, " ").replace(/\s+/g, " ").trim();
2660
2660
  }), {
2661
2661
  ids: [d._id],
2662
2662
  props: {
@@ -2789,21 +2789,21 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2789
2789
  return "VERTICAL";
2790
2790
  }
2791
2791
  }, isDisabledControl = (o, n, r) => !!(o && (r === "UP" || r === "LEFT") || n && (r === "DOWN" || r === "RIGHT")), useBlockController = (o, n) => {
2792
- const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (x) => c ? get(x, "_parent") === c : !get(x, "_parent")), p = (d == null ? void 0 : d.length) <= 1, u = findIndex(d, { _id: i }), g = u <= 0, m = u + 1 === (d == null ? void 0 : d.length), h = getParentBlockOrientation(c, i, a), f = useCallback(
2793
- (x) => {
2794
- isDisabledControl(g, m, x) || p || (x === "UP" || x === "LEFT" ? l([i], c || null, u - 1) : (x === "DOWN" || x === "RIGHT") && l([i], c || null, u + 2), n());
2792
+ const [r] = useBlocksStore(), { document: a } = useFrame(), { moveBlocks: l } = useBlocksStoreUndoableActions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(r, (f) => c ? get(f, "_parent") === c : !get(f, "_parent")), p = (d == null ? void 0 : d.length) <= 1, u = findIndex(d, { _id: i }), g = u <= 0, m = u + 1 === (d == null ? void 0 : d.length), h = getParentBlockOrientation(c, i, a), x = useCallback(
2793
+ (f) => {
2794
+ isDisabledControl(g, m, f) || p || (f === "UP" || f === "LEFT" ? l([i], c || null, u - 1) : (f === "DOWN" || f === "RIGHT") && l([i], c || null, u + 2), n());
2795
2795
  },
2796
2796
  [g, m, p, u, i, c, n]
2797
2797
  );
2798
2798
  return useHotkeys(
2799
2799
  "shift+up, shift+down, shift+left, shift+right",
2800
- ({ key: x }) => {
2800
+ ({ key: f }) => {
2801
2801
  var k;
2802
- f((k = x == null ? void 0 : x.replace("Arrow", "")) == null ? void 0 : k.toUpperCase());
2802
+ x((k = f == null ? void 0 : f.replace("Arrow", "")) == null ? void 0 : k.toUpperCase());
2803
2803
  },
2804
2804
  { document: a == null ? void 0 : a.contentDocument },
2805
- [f]
2806
- ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: m, moveBlock: f, orientation: h };
2805
+ [x]
2806
+ ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: m, moveBlock: x, orientation: h };
2807
2807
  }, BlockController = ({ block: o, updateFloatingBar: n }) => {
2808
2808
  const { isOnlyChild: r, isFirstBlock: a, isLastBlock: l, moveBlock: i, orientation: c } = useBlockController(
2809
2809
  o,
@@ -2949,7 +2949,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2949
2949
  elements: { reference: n }
2950
2950
  });
2951
2951
  useResizeObserver(n, () => h(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => h(), (u == null ? void 0 : u.body) !== null);
2952
- const f = get(o, "_parent", null), x = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
2952
+ const x = get(o, "_parent", null), f = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
2953
2953
  return !n || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
2954
2954
  "div",
2955
2955
  {
@@ -2966,16 +2966,16 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2966
2966
  onKeyDown: (k) => k.stopPropagation(),
2967
2967
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
2968
2968
  children: [
2969
- f && /* @__PURE__ */ jsx(
2969
+ x && /* @__PURE__ */ jsx(
2970
2970
  ArrowUpIcon,
2971
2971
  {
2972
2972
  className: "hover:scale-105",
2973
2973
  onClick: () => {
2974
- c([]), l([f]);
2974
+ c([]), l([x]);
2975
2975
  }
2976
2976
  }
2977
2977
  ),
2978
- /* @__PURE__ */ jsx(BlockActionLabel, { label: x, block: o }),
2978
+ /* @__PURE__ */ jsx(BlockActionLabel, { label: f, block: o }),
2979
2979
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-1 pr-1.5", children: [
2980
2980
  /* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "hover:scale-105" }) }),
2981
2981
  canDuplicateBlock(get(o, "_type", "")) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsx(CopyIcon, { className: "hover:scale-105", onClick: () => a([o == null ? void 0 : o._id]) }) : null,
@@ -3133,8 +3133,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3133
3133
  i
3134
3134
  ]), useHotkeys(
3135
3135
  "del, backspace",
3136
- (f) => {
3137
- f.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
3136
+ (x) => {
3137
+ x.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
3138
3138
  },
3139
3139
  h,
3140
3140
  [n, l]
@@ -3427,8 +3427,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3427
3427
  ],
3428
3428
  onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
3429
3429
  onBlur: ({ editor: u, event: g }) => {
3430
- const m = g.relatedTarget, h = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = h == null ? void 0 : h.contains(m), k = f == null ? void 0 : f.contains(m);
3431
- if (!x && !k) {
3430
+ const m = g.relatedTarget, h = i.querySelector(".ProseMirror"), x = i.querySelector(".tippy-box"), f = h == null ? void 0 : h.contains(m), k = x == null ? void 0 : x.contains(m);
3431
+ if (!f && !k) {
3432
3432
  const b = (u == null ? void 0 : u.getHTML()) || "";
3433
3433
  r(b);
3434
3434
  }
@@ -3483,14 +3483,14 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3483
3483
  useEffect(() => {
3484
3484
  if (a.current) {
3485
3485
  a.current.innerText = n, a.current.focus();
3486
- const h = c.createRange(), f = d.getSelection();
3487
- h.selectNodeContents(a.current), h.collapse(!1), f == null || f.removeAllRanges(), f == null || f.addRange(h), a.current.focus();
3486
+ const h = c.createRange(), x = d.getSelection();
3487
+ h.selectNodeContents(a.current), h.collapse(!1), x == null || x.removeAllRanges(), x == null || x.addRange(h), a.current.focus();
3488
3488
  } else
3489
3489
  r();
3490
3490
  }, [c, d]);
3491
3491
  const p = useMemo(() => {
3492
- var f;
3493
- const h = ((f = o == null ? void 0 : o.tagName) == null ? void 0 : f.toLowerCase()) || "div";
3492
+ var x;
3493
+ const h = ((x = o == null ? void 0 : o.tagName) == null ? void 0 : x.toLowerCase()) || "div";
3494
3494
  return h === "button" ? "div" : h;
3495
3495
  }, [o]), u = useCallback(
3496
3496
  (h) => {
@@ -3506,12 +3506,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3506
3506
  contentEditable: !0,
3507
3507
  className: `${((h = o == null ? void 0 : o.className) == null ? void 0 : h.replace("sr-only", "")) || ""} outline outline-[2px] outline-green-500 shadow-none empty:before:content-[attr(data-placeholder)] empty:before:text-gray-400 empty:before:absolute empty:before:pointer-events-none empty:before:select-none empty:before:inset-0 empty:before:z-0 relative min-h-[1em]`,
3508
3508
  style: cloneDeep(o == null ? void 0 : o.style) || {},
3509
- onInput: (f) => {
3510
- const x = f.target;
3511
- x && (x.innerText.trim() === "" ? (x.setAttribute("data-placeholder", "Enter text here"), x.children.length > 0 && x.children[0].remove()) : f.target.removeAttribute("data-placeholder"), l(f.target.innerText));
3509
+ onInput: (x) => {
3510
+ const f = x.target;
3511
+ f && (f.innerText.trim() === "" ? (f.setAttribute("data-placeholder", "Enter text here"), f.children.length > 0 && f.children[0].remove()) : x.target.removeAttribute("data-placeholder"), l(x.target.innerText));
3512
3512
  },
3513
- onClick: (f) => {
3514
- f.stopPropagation(), f.preventDefault();
3513
+ onClick: (x) => {
3514
+ x.stopPropagation(), x.preventDefault();
3515
3515
  }
3516
3516
  };
3517
3517
  }, [o == null ? void 0 : o.className, o == null ? void 0 : o.style]);
@@ -3524,33 +3524,33 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3524
3524
  }
3525
3525
  ), WithBlockTextEditor = memo(
3526
3526
  ({ block: o, children: n }) => {
3527
- const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: f } = useLanguages(), [, x] = useSelectedBlockIds(), k = useRef(null), b = l, { blockContent: v, blockType: B } = useMemo(() => {
3527
+ const r = "content", { document: a } = useFrame(), { editingBlockId: l, editingItemIndex: i, setEditingBlockId: c, setEditingItemIndex: d } = useInlineEditing(), [p, u] = useState(null), g = useRef(null), { clearHighlight: m } = useBlockHighlight(), h = useUpdateBlocksProps(), { selectedLang: x } = useLanguages(), [, f] = useSelectedBlockIds(), k = useRef(null), b = l, { blockContent: v, blockType: B } = useMemo(() => {
3528
3528
  var j;
3529
3529
  const A = o._type;
3530
3530
  let N = o[r];
3531
3531
  const S = getRegisteredChaiBlock(o._type);
3532
- return f && ((j = S == null ? void 0 : S.i18nProps) == null ? void 0 : j.includes(r)) && has(o, `${r}-${f}`) && (N = get(o, `${r}-${f}`)), { blockContent: N, blockType: A };
3533
- }, [o, f]), w = useCallback(
3532
+ return x && ((j = S == null ? void 0 : S.i18nProps) == null ? void 0 : j.includes(r)) && has(o, `${r}-${x}`) && (N = get(o, `${r}-${x}`)), { blockContent: N, blockType: A };
3533
+ }, [o, x]), w = useCallback(
3534
3534
  (A) => {
3535
3535
  var S;
3536
3536
  const N = A || ((S = g.current) == null ? void 0 : S.innerText);
3537
- h([b], { [r]: N }), u(null), c(null), d(-1), x([]);
3537
+ h([b], { [r]: N }), u(null), c(null), d(-1), f([]);
3538
3538
  },
3539
- [b, h, c, x, f]
3539
+ [b, h, c, f, x]
3540
3540
  ), _ = useDebouncedCallback(
3541
3541
  (A) => {
3542
3542
  h([b], { [r]: A });
3543
3543
  },
3544
- [b, o, h, f],
3544
+ [b, o, h, x],
3545
3545
  1e3
3546
3546
  ), E = useCallback(
3547
3547
  (A) => {
3548
3548
  A.preventDefault(), b && (k.current = b), w(), setTimeout(() => {
3549
3549
  const N = k.current;
3550
- k.current = null, x([N]);
3550
+ k.current = null, f([N]);
3551
3551
  }, 100);
3552
3552
  },
3553
- [x, b, f]
3553
+ [f, b, x]
3554
3554
  );
3555
3555
  useEffect(() => {
3556
3556
  var y;
@@ -3577,7 +3577,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3577
3577
  onChange: _,
3578
3578
  onEscape: E
3579
3579
  }
3580
- )) : null, [p, b, B, v, w, f]);
3580
+ )) : null, [p, b, B, v, w, x]);
3581
3581
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3582
3582
  C,
3583
3583
  n
@@ -3612,18 +3612,18 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3612
3612
  blockAtom: n,
3613
3613
  children: r
3614
3614
  }) => {
3615
- const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] = useHiddenBlockIds(), [h] = useAtom$1(dataBindingActiveAtom), f = get(c, "component", null), { index: x, key: k } = useContext(RepeaterContext), b = useMemo(
3615
+ const { editingBlockId: a, editingItemIndex: l } = useInlineEditing(), [i] = useAtom$1(n), c = useMemo(() => getRegisteredChaiBlock(i._type), [i._type]), { selectedLang: d, fallbackLang: p } = useLanguages(), u = useBlockRuntimeProps(), g = usePageExternalData(), [m] = useHiddenBlockIds(), [h] = useAtom$1(dataBindingActiveAtom), x = get(c, "component", null), { index: f, key: k } = useContext(RepeaterContext), b = useMemo(
3616
3616
  () => h ? applyBindingToBlockProps(applyLanguage(i, d, c), g, {
3617
- index: x,
3617
+ index: f,
3618
3618
  key: k
3619
3619
  }) : applyLanguage(i, d, c),
3620
- [i, d, c, g, h, x, k]
3620
+ [i, d, c, g, h, f, k]
3621
3621
  ), v = useMemo(() => getBlockTagAttributes(i), [i, getBlockTagAttributes]), B = useMemo(
3622
3622
  () => u(i._id, getBlockRuntimeProps(i._type)),
3623
3623
  [i._id, i._type, u, getBlockRuntimeProps]
3624
3624
  ), w = useMemo(
3625
3625
  () => ({
3626
- blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": x },
3626
+ blockProps: { "data-block-id": i._id, "data-block-type": i._type, "data-block-index": f },
3627
3627
  inBuilder: !0,
3628
3628
  lang: d || p,
3629
3629
  ...b,
@@ -3642,8 +3642,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3642
3642
  o
3643
3643
  ]
3644
3644
  ), _ = useMemo(() => !CORE_BLOCKS.includes(i._type), [i._type]);
3645
- if (isNull(f) || m.includes(i._id)) return null;
3646
- let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(f, {
3645
+ if (isNull(x) || m.includes(i._id)) return null;
3646
+ let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(x, {
3647
3647
  ...w,
3648
3648
  children: r({
3649
3649
  _id: i._id,
@@ -3656,7 +3656,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3656
3656
  ...i.globalBlock ? { partialBlockId: i.globalBlock } : ""
3657
3657
  })
3658
3658
  }) });
3659
- const C = a === i._id && (l === x || x < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: E }) : E;
3659
+ const C = a === i._id && (l === f || f < 0) ? /* @__PURE__ */ jsx(WithBlockTextEditor, { block: i, children: E }) : E;
3660
3660
  return _ ? /* @__PURE__ */ jsx(ErrorBoundary, { fallbackRender: ErrorFallback, children: C }) : C;
3661
3661
  }, PartialWrapper = ({ children: o, partialBlockId: n }) => {
3662
3662
  const r = useBuilderProp("gotoPage", noop), { saveState: a } = useSavePage(), { selectedLang: l, fallbackLang: i } = useLanguages(), c = useCallback(
@@ -3697,7 +3697,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3697
3697
  );
3698
3698
  return map(l, (c) => {
3699
3699
  const d = a(c._id);
3700
- return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: m, repeaterItems: h, $repeaterItemsKey: f }) => g === "Repeater" ? isArray(h) && h.map((x, k) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: k, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) }, `${u}-${k}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: m }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3700
+ return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: m, repeaterItems: h, $repeaterItemsKey: x }) => g === "Repeater" ? isArray(h) && h.map((f, k) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: k, key: x }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) }, `${u}-${k}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: m }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3701
3701
  });
3702
3702
  }, PageBlocksRenderer = () => {
3703
3703
  const [o] = useBlocksStore();
@@ -3765,14 +3765,14 @@ const CanvasEventsWatcher = () => {
3765
3765
  }, StaticCanvas = () => {
3766
3766
  const [o] = useCanvasDisplayWidth(), [, n] = useHighlightBlockId(), r = useRef(null), a = useRef(null), [l, i] = useState({ width: 0, height: 0 }), c = useCanvasScale(l), [, d] = useAtom$1(canvasIframeAtom), p = useBuilderProp("loading", !1), u = useBuilderProp("htmlDir", "ltr"), g = useCallback(
3767
3767
  (h) => {
3768
- i((f) => ({ ...f, width: h }));
3768
+ i((x) => ({ ...x, width: h }));
3769
3769
  },
3770
3770
  [i]
3771
3771
  );
3772
3772
  useEffect(() => {
3773
3773
  if (!a.current) return;
3774
- const { clientWidth: h, clientHeight: f } = a.current;
3775
- i({ width: h, height: f });
3774
+ const { clientWidth: h, clientHeight: x } = a.current;
3775
+ i({ width: h, height: x });
3776
3776
  }, [a, o]);
3777
3777
  const m = useMemo(() => {
3778
3778
  let h = IframeInitialContent;
@@ -3887,8 +3887,8 @@ const CanvasEventsWatcher = () => {
3887
3887
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG code to use as an icon") })
3888
3888
  ] });
3889
3889
  }, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
3890
- const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (f) => {
3891
- if (!f.trim()) {
3890
+ const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (x) => {
3891
+ if (!x.trim()) {
3892
3892
  p(!1), g("Please enter a URL");
3893
3893
  return;
3894
3894
  }
@@ -3912,7 +3912,7 @@ const CanvasEventsWatcher = () => {
3912
3912
  {
3913
3913
  placeholder: h(`Enter ${r} URL`),
3914
3914
  value: a,
3915
- onChange: (f) => l(f.target.value),
3915
+ onChange: (x) => l(x.target.value),
3916
3916
  onKeyUp: () => m(a)
3917
3917
  }
3918
3918
  ),
@@ -3953,16 +3953,16 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
3953
3953
  const m = isArray(g) ? first(g) : g;
3954
3954
  if (m) {
3955
3955
  n(m == null ? void 0 : m.url);
3956
- const h = m == null ? void 0 : m.width, f = m == null ? void 0 : m.height;
3956
+ const h = m == null ? void 0 : m.width, x = m == null ? void 0 : m.height;
3957
3957
  if (i != null && i._id) {
3958
- const x = {
3958
+ const f = {
3959
3959
  ...h && { width: h },
3960
- ...f && { height: f },
3960
+ ...x && { height: x },
3961
3961
  ...m.description && { alt: m.description },
3962
3962
  ...m.id && { assetId: m.id }
3963
3963
  };
3964
- if (isEmpty(x)) return;
3965
- c([i._id], x);
3964
+ if (isEmpty(f)) return;
3965
+ c([i._id], f);
3966
3966
  }
3967
3967
  }
3968
3968
  }, p = useCallback(() => {
@@ -4006,14 +4006,14 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
4006
4006
  }, PathDropdown = ({ data: o, onSelect: n, dataType: r }) => {
4007
4007
  const [a, l] = React__default.useState([]), [i, c] = React__default.useState(o), d = (m) => Array.isArray(m) ? "array" : typeof m == "object" && m !== null ? "object" : "value", p = React__default.useCallback(
4008
4008
  (m) => {
4009
- const h = (f) => r === "value" ? f === "value" || f === "object" : r === "array" ? f === "array" : f === r;
4010
- m.type === "object" ? (l((f) => [...f, m.key]), c(m.value)) : h(m.type) && n([...a, m.key].join("."), r);
4009
+ const h = (x) => r === "value" ? x === "value" || x === "object" : r === "array" ? x === "array" : x === r;
4010
+ m.type === "object" ? (l((x) => [...x, m.key]), c(m.value)) : h(m.type) && n([...a, m.key].join("."), r);
4011
4011
  },
4012
4012
  [a, n, r]
4013
4013
  ), u = React__default.useCallback(() => {
4014
4014
  if (a.length > 0) {
4015
4015
  const m = a.slice(0, -1);
4016
- l(m), c(m.reduce((h, f) => h[f], o));
4016
+ l(m), c(m.reduce((h, x) => h[x], o));
4017
4017
  }
4018
4018
  }, [a, o]), g = React__default.useMemo(() => i ? Object.entries(i).map(([m, h]) => ({ key: m, value: h, type: d(h) })).filter((m) => !startsWith(m.key, REPEATER_PREFIX) && m.key.includes("/") ? !1 : r === "value" ? m.type === "value" || m.type === "object" : r === "array" ? m.type === "array" || m.type === "object" : r === "object" ? m.type === "object" : !0) : [], [i, r]);
4019
4019
  return /* @__PURE__ */ jsxs(Command, { className: "fields-command", children: [
@@ -4106,7 +4106,7 @@ const DataBindingSelector = ({
4106
4106
  }) => {
4107
4107
  const l = usePageExternalData(), i = useSelectedBlockHierarchy(), c = useSelectedBlock(), d = useMemo(() => {
4108
4108
  if (i.length === 1) return "";
4109
- const g = i.find((f) => f._type === "Repeater"), h = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4109
+ const g = i.find((x) => x._type === "Repeater"), h = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4110
4110
  return `${REPEATER_PREFIX}${startsWith(h, COLLECTION_PREFIX) ? `${h}/${g._id}` : h}`;
4111
4111
  }, [i]), p = useMemo(() => first(get(l, d.replace(REPEATER_PREFIX, ""), [])), [d, l]), u = useCallback(
4112
4112
  (g, m) => {
@@ -4114,7 +4114,7 @@ const DataBindingSelector = ({
4114
4114
  n(`{{${g}}}`, {}, r);
4115
4115
  return;
4116
4116
  }
4117
- const h = (b) => /[.,!?;:]/.test(b), f = (b, v, B) => {
4117
+ const h = (b) => /[.,!?;:]/.test(b), x = (b, v, B) => {
4118
4118
  let w = "", _ = "";
4119
4119
  const E = v > 0 ? b[v - 1] : "", C = v < b.length ? b[v] : "";
4120
4120
  return v > 0 && (E === "." || !h(E) && E !== " ") && (w = " "), v < b.length && !h(C) && C !== " " && (_ = " "), {
@@ -4122,8 +4122,8 @@ const DataBindingSelector = ({
4122
4122
  prefixLength: w.length,
4123
4123
  suffixLength: _.length
4124
4124
  };
4125
- }, x = document.getElementById(r);
4126
- if (!x) return;
4125
+ }, f = document.getElementById(r);
4126
+ if (!f) return;
4127
4127
  const k = document.getElementById(`chai-rte-${r}`) || document.getElementById(`chai-rte-modal-${r}`);
4128
4128
  if (k && (k.querySelector(".ProseMirror") || k.__chaiRTE)) {
4129
4129
  const b = k.__chaiRTE;
@@ -4144,13 +4144,13 @@ const DataBindingSelector = ({
4144
4144
  return;
4145
4145
  }
4146
4146
  } else {
4147
- const b = x, v = b.selectionStart || 0, B = b.value || "", w = b.selectionEnd || v;
4147
+ const b = f, v = b.selectionStart || 0, B = b.value || "", w = b.selectionEnd || v;
4148
4148
  if (w > v) {
4149
- const N = `{{${g}}}`, { text: S } = f(B, v, N), y = B.slice(0, v) + S + B.slice(w);
4149
+ const N = `{{${g}}}`, { text: S } = x(B, v, N), y = B.slice(0, v) + S + B.slice(w);
4150
4150
  n(y, {}, r);
4151
4151
  return;
4152
4152
  }
4153
- const E = `{{${g}}}`, { text: C } = f(B, v, E), A = B.slice(0, v) + C + B.slice(v);
4153
+ const E = `{{${g}}}`, { text: C } = x(B, v, E), A = B.slice(0, v) + C + B.slice(v);
4154
4154
  n(A, {}, r);
4155
4155
  }
4156
4156
  },
@@ -4173,9 +4173,9 @@ const DataBindingSelector = ({
4173
4173
  onChange: r
4174
4174
  }) => {
4175
4175
  var N;
4176
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, y) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [f, x] = useState([]), [k, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((S) => S.key === u)) == null ? void 0 : N.name;
4176
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (S, y) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [x, f] = useState([]), [k, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((S) => S.key === u)) == null ? void 0 : N.name;
4177
4177
  useEffect(() => {
4178
- if (h(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4178
+ if (h(""), f([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4179
4179
  const S = split(o, ":"), y = get(S, 1, "page") || "page";
4180
4180
  g(y), (async () => {
4181
4181
  const j = await l(y, [get(S, 2, "page")]);
@@ -4185,10 +4185,10 @@ const DataBindingSelector = ({
4185
4185
  const w = useDebouncedCallback(
4186
4186
  async (S) => {
4187
4187
  if (isEmpty(S))
4188
- x([]);
4188
+ f([]);
4189
4189
  else {
4190
4190
  const y = await l(u, S);
4191
- x(y);
4191
+ f(y);
4192
4192
  }
4193
4193
  c(!1), b(-1);
4194
4194
  },
@@ -4196,18 +4196,18 @@ const DataBindingSelector = ({
4196
4196
  300
4197
4197
  ), _ = (S) => {
4198
4198
  const y = ["pageType", u, S.id];
4199
- y[1] && (r(y.join(":")), h(S.name), p(!1), x([]), b(-1));
4199
+ y[1] && (r(y.join(":")), h(S.name), p(!1), f([]), b(-1));
4200
4200
  }, E = (S) => {
4201
4201
  switch (S.key) {
4202
4202
  case "ArrowDown":
4203
- S.preventDefault(), b((y) => y < f.length - 1 ? y + 1 : y);
4203
+ S.preventDefault(), b((y) => y < x.length - 1 ? y + 1 : y);
4204
4204
  break;
4205
4205
  case "ArrowUp":
4206
4206
  S.preventDefault(), b((y) => y > 0 ? y - 1 : y);
4207
4207
  break;
4208
4208
  case "Enter":
4209
- if (S.preventDefault(), f.length === 0) return;
4210
- k >= 0 && _(f[k]);
4209
+ if (S.preventDefault(), x.length === 0) return;
4210
+ k >= 0 && _(x[k]);
4211
4211
  break;
4212
4212
  case "Escape":
4213
4213
  S.preventDefault(), C();
@@ -4221,7 +4221,7 @@ const DataBindingSelector = ({
4221
4221
  }
4222
4222
  }, [k]);
4223
4223
  const C = () => {
4224
- h(""), x([]), b(-1), p(!1), r("");
4224
+ h(""), f([]), b(-1), p(!1), r("");
4225
4225
  }, A = (S) => {
4226
4226
  h(S), p(!isEmpty(S)), c(!0), w(S);
4227
4227
  };
@@ -4241,15 +4241,15 @@ const DataBindingSelector = ({
4241
4241
  ),
4242
4242
  /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: C, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4243
4243
  ] }),
4244
- (i || !isEmpty(f) || d && isEmpty(f)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
4244
+ (i || !isEmpty(x) || d && isEmpty(x)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
4245
4245
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
4246
4246
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
4247
- ] }) : d && isEmpty(f) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4247
+ ] }) : d && isEmpty(x) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4248
4248
  a("No results found for"),
4249
4249
  ' "',
4250
4250
  m,
4251
4251
  '"'
4252
- ] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(f == null ? void 0 : f.slice(0, 20), (S, y) => /* @__PURE__ */ jsxs(
4252
+ ] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(x == null ? void 0 : x.slice(0, 20), (S, y) => /* @__PURE__ */ jsxs(
4253
4253
  "li",
4254
4254
  {
4255
4255
  onClick: () => _(S),
@@ -4564,8 +4564,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4564
4564
  if (!u) return;
4565
4565
  const h = `{{${m}}}`;
4566
4566
  u.commands.focus();
4567
- const { from: f, to: x } = u.state.selection;
4568
- if (f !== x)
4567
+ const { from: x, to: f } = u.state.selection;
4568
+ if (x !== f)
4569
4569
  u.chain().deleteSelection().insertContent(h).run();
4570
4570
  else {
4571
4571
  const { state: b } = u, v = b.selection.from, B = b.doc.textBetween(Math.max(0, v - 1), v), w = b.doc.textBetween(v, Math.min(v + 1, b.doc.content.size));
@@ -4611,13 +4611,13 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4611
4611
  })
4612
4612
  ],
4613
4613
  content: r || "",
4614
- onUpdate: ({ editor: f }) => {
4615
- const x = f.getHTML();
4616
- a(x), c || u(x);
4614
+ onUpdate: ({ editor: x }) => {
4615
+ const f = x.getHTML();
4616
+ a(f), c || u(f);
4617
4617
  },
4618
- onBlur: ({ editor: f }) => {
4619
- const x = f.getHTML();
4620
- l(o, x);
4618
+ onBlur: ({ editor: x }) => {
4619
+ const f = x.getHTML();
4620
+ l(o, f);
4621
4621
  },
4622
4622
  editorProps: {
4623
4623
  attributes: {
@@ -4630,8 +4630,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4630
4630
  }, [g]), useEffect(() => {
4631
4631
  u(r || "");
4632
4632
  }, [r]);
4633
- const m = (f) => {
4634
- a(f);
4633
+ const m = (x) => {
4634
+ a(x);
4635
4635
  }, h = () => {
4636
4636
  d(!1), g && g.commands.setContent(p);
4637
4637
  };
@@ -4664,24 +4664,24 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4664
4664
  u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && n({ ...o, currentSlide: get(u, "0._id") });
4665
4665
  }, [o, u]);
4666
4666
  const m = () => {
4667
- const x = findIndex(u, { _id: g });
4668
- if (x > -1) {
4669
- const k = (x + 1) % u.length, b = get(u, [k, "_id"]);
4667
+ const f = findIndex(u, { _id: g });
4668
+ if (f > -1) {
4669
+ const k = (f + 1) % u.length, b = get(u, [k, "_id"]);
4670
4670
  if (!b) return;
4671
4671
  n({ ...o, currentSlide: b }), c([b]);
4672
4672
  }
4673
4673
  }, h = () => {
4674
- const x = findIndex(u, { _id: g });
4675
- if (x > -1) {
4676
- const k = (x - 1 + u.length) % u.length, b = get(u, [k, "_id"]);
4674
+ const f = findIndex(u, { _id: g });
4675
+ if (f > -1) {
4676
+ const k = (f - 1 + u.length) % u.length, b = get(u, [k, "_id"]);
4677
4677
  if (!b) return;
4678
4678
  n({ ...o, currentSlide: b }), c([b]);
4679
4679
  }
4680
- }, f = () => {
4681
- const x = i(
4680
+ }, x = () => {
4681
+ const f = i(
4682
4682
  { styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
4683
4683
  p == null ? void 0 : p._id
4684
- ), k = x == null ? void 0 : x._id;
4684
+ ), k = f == null ? void 0 : f._id;
4685
4685
  k && (n({ ...o, currentSlide: k }), c([k]));
4686
4686
  };
4687
4687
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
@@ -4699,7 +4699,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4699
4699
  /* @__PURE__ */ jsxs(
4700
4700
  "button",
4701
4701
  {
4702
- onClick: f,
4702
+ onClick: x,
4703
4703
  className: "flex w-full items-center justify-center gap-x-1 rounded bg-gray-200 p-1.5 text-xs font-medium leading-tight hover:opacity-80",
4704
4704
  children: [
4705
4705
  /* @__PURE__ */ jsx(PlusCircle, { className: "h-3 w-3 stroke-[2]" }),
@@ -4760,8 +4760,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4760
4760
  value: o == null ? void 0 : o.autoplayInterval,
4761
4761
  className: "text-xs",
4762
4762
  pattern: "[0-9]*",
4763
- onChange: (x) => {
4764
- let k = x.target.value;
4763
+ onChange: (f) => {
4764
+ let k = f.target.value;
4765
4765
  k.length && (k = k.replace("-", "")), n({ ...o, autoplayInterval: k });
4766
4766
  }
4767
4767
  }
@@ -4870,9 +4870,9 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4870
4870
  formData: g,
4871
4871
  onChange: m
4872
4872
  }) => {
4873
- const { selectedLang: h, fallbackLang: f, languages: x } = useLanguages(), k = useMemo(
4874
- () => isEmpty(x) ? "" : isEmpty(h) ? f : h,
4875
- [x, h, f]
4873
+ const { selectedLang: h, fallbackLang: x, languages: f } = useLanguages(), k = useMemo(
4874
+ () => isEmpty(f) ? "" : isEmpty(h) ? x : h,
4875
+ [f, h, x]
4876
4876
  ), b = useMemo(() => get(LANGUAGES, k, k), [k]), v = usePageExternalData(), B = useSelectedBlock(), w = useRegisteredChaiBlocks(), _ = useMemo(
4877
4877
  () => get(w, [B == null ? void 0 : B._type, "i18nProps"], []),
4878
4878
  [w, B == null ? void 0 : B._type]
@@ -5027,17 +5027,17 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
5027
5027
  }), a;
5028
5028
  };
5029
5029
  function BlockSettings() {
5030
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), f = ({ formData: E }, C, A) => {
5030
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), m = getRegisteredChaiBlock(g == null ? void 0 : g._type), h = formDataWithSelectedLang(g, o, m), x = ({ formData: E }, C, A) => {
5031
5031
  C && (c == null ? void 0 : c._id) === n._id && a([n._id], { [C]: get(E, C) }, A);
5032
- }, x = useCallback(
5032
+ }, f = useCallback(
5033
5033
  debounce(({ formData: E }, C, A) => {
5034
- f({ formData: E }, C, A), d(E);
5034
+ x({ formData: E }, C, A), d(E);
5035
5035
  }, 1500),
5036
5036
  [n == null ? void 0 : n._id, o]
5037
5037
  ), k = ({ formData: E }, C) => {
5038
- C && (r([n._id], { [C]: get(E, C) }), x({ formData: E }, C, { [C]: get(c, C) }));
5038
+ C && (r([n._id], { [C]: get(E, C) }), f({ formData: E }, C, { [C]: get(c, C) }));
5039
5039
  }, b = ({ formData: E }, C) => {
5040
- C && (r([g._id], { [C]: get(E, C) }), x({ formData: E }, C, { [C]: get(c, C) }));
5040
+ C && (r([g._id], { [C]: get(E, C) }), f({ formData: E }, C, { [C]: get(c, C) }));
5041
5041
  }, { schema: v, uiSchema: B } = useMemo(() => {
5042
5042
  const E = n == null ? void 0 : n._type;
5043
5043
  if (!E)
@@ -5300,7 +5300,7 @@ const BlockStylingProps = () => {
5300
5300
  },
5301
5301
  a
5302
5302
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
5303
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [k, b] = useState(""), [v, B] = useState(!1), [w, _] = useState(!1);
5303
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [m, h] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [x, f] = useState(!1), [k, b] = useState(""), [v, B] = useState(!1), [w, _] = useState(!1);
5304
5304
  useEffect(() => {
5305
5305
  const { value: S, unit: y } = getClassValueAndUnit(i);
5306
5306
  if (y === "") {
@@ -5313,7 +5313,7 @@ const BlockStylingProps = () => {
5313
5313
  (S = !1) => {
5314
5314
  const y = getUserInputValues(`${a}`, u);
5315
5315
  if (get(y, "error", !1)) {
5316
- x(!0);
5316
+ f(!0);
5317
5317
  return;
5318
5318
  }
5319
5319
  const j = get(y, "unit") !== "" ? get(y, "unit") : m;
@@ -5331,7 +5331,7 @@ const BlockStylingProps = () => {
5331
5331
  (S) => {
5332
5332
  const y = getUserInputValues(`${a}`, u);
5333
5333
  if (get(y, "error", !1)) {
5334
- x(!0);
5334
+ f(!0);
5335
5335
  return;
5336
5336
  }
5337
5337
  if (S === "auto" || S === "none") {
@@ -5374,15 +5374,15 @@ const BlockStylingProps = () => {
5374
5374
  const y = parseInt$1(S.target.value);
5375
5375
  let j = isNaN$1(y) ? 0 : y;
5376
5376
  S.keyCode === 38 && (j += 1), S.keyCode === 40 && (j -= 1);
5377
- const I = `${j}`, P = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
5378
- C(P);
5377
+ const I = `${j}`, R = `${I.startsWith("-") ? "-" : ""}${d}[${I.replace("-", "")}${m === "-" ? "" : m}]`;
5378
+ C(R);
5379
5379
  },
5380
5380
  onKeyUp: (S) => {
5381
5381
  w && (S.preventDefault(), _(!1));
5382
5382
  },
5383
5383
  onBlur: () => A(),
5384
5384
  onChange: (S) => {
5385
- x(!1), l(S.target.value);
5385
+ f(!1), l(S.target.value);
5386
5386
  },
5387
5387
  onClick: (S) => {
5388
5388
  var y;
@@ -5391,7 +5391,7 @@ const BlockStylingProps = () => {
5391
5391
  value: v ? k : a,
5392
5392
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
5393
5393
  " ",
5394
- f ? "border-red-500 text-red-500" : "border-foreground/20"
5394
+ x ? "border-red-500 text-red-500" : "border-foreground/20"
5395
5395
  )
5396
5396
  }
5397
5397
  ),
@@ -5510,7 +5510,7 @@ const COLOR_PROP = {
5510
5510
  return c([]);
5511
5511
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
5512
5512
  }, [g]);
5513
- const f = useCallback(
5513
+ const x = useCallback(
5514
5514
  // eslint-disable-next-line no-shadow
5515
5515
  (k) => {
5516
5516
  p({ color: g, shade: k });
@@ -5520,11 +5520,11 @@ const COLOR_PROP = {
5520
5520
  useEffect(() => {
5521
5521
  p({ color: "", shade: "" });
5522
5522
  }, [r]);
5523
- const { match: x } = useTailwindClassList();
5523
+ const { match: f } = useTailwindClassList();
5524
5524
  return useEffect(() => {
5525
5525
  const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
5526
- x(o, b) && n(b, o);
5527
- }, [x, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
5526
+ f(o, b) && n(b, o);
5527
+ }, [f, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
5528
5528
  /* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
5529
5529
  DropDown,
5530
5530
  {
@@ -5564,7 +5564,7 @@ const COLOR_PROP = {
5564
5564
  ]
5565
5565
  }
5566
5566
  ) }),
5567
- /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: f, options: i }) })
5567
+ /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: x, options: i }) })
5568
5568
  ] });
5569
5569
  }, EDITOR_ICONS = {
5570
5570
  "not-italic": () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M9 3H11V5H9V11H11V13H5V11H7V5H5V3H9Z", fill: "white" }) }),
@@ -5898,17 +5898,17 @@ const COLOR_PROP = {
5898
5898
  "2xl": "1536px"
5899
5899
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
5900
5900
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
5901
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), k = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
5901
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), x = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), k = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
5902
5902
  (C, A = !0) => {
5903
5903
  const N = { dark: p, mq: g, mod: u, cls: C, property: l, fullCls: "" };
5904
5904
  (p || u !== "") && (N.mq = "xs");
5905
5905
  const S = generateFullClsName(N);
5906
- h(x, [S], A);
5906
+ h(f, [S], A);
5907
5907
  },
5908
- [x, p, g, u, l, h]
5908
+ [f, p, g, u, l, h]
5909
5909
  ), v = useCallback(() => {
5910
- f(x, [k], !0);
5911
- }, [x, k, f]), B = useMemo(() => canChangeClass(m, g), [m, g]);
5910
+ x(f, [k], !0);
5911
+ }, [f, k, x]), B = useMemo(() => canChangeClass(m, g), [m, g]);
5912
5912
  useEffect(() => {
5913
5913
  i(B, m);
5914
5914
  }, [B, i, m]);
@@ -5994,23 +5994,23 @@ const COLOR_PROP = {
5994
5994
  children: [
5995
5995
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
5996
5996
  o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
5997
- /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: h, key: f }, x) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
5997
+ /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: h, key: x }, f) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
5998
5998
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
5999
5999
  "button",
6000
6000
  {
6001
6001
  type: "button",
6002
- onClick: () => u(f),
6003
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${f === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6002
+ onClick: () => u(x),
6003
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${x === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6004
6004
  children: [
6005
6005
  React__default.createElement("div", {
6006
- className: m(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6006
+ className: m(x) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6007
6007
  }),
6008
- React__default.createElement(get(EDITOR_ICONS, f, BoxIcon), { className: "text-inherit w-3 h-3" })
6008
+ React__default.createElement(get(EDITOR_ICONS, x, BoxIcon), { className: "text-inherit w-3 h-3" })
6009
6009
  ]
6010
6010
  }
6011
6011
  ) }),
6012
6012
  /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(h)) })
6013
- ] }) }, `option-${x}`)) })
6013
+ ] }) }, `option-${f}`)) })
6014
6014
  ] }),
6015
6015
  /* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
6016
6016
  BlockStyle,
@@ -6165,9 +6165,9 @@ const COLOR_PROP = {
6165
6165
  canvas: n = !1,
6166
6166
  tooltip: r = !0
6167
6167
  }) => {
6168
- const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (b) => {
6168
+ const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), x = (b) => {
6169
6169
  u.includes(b) ? u.length > 2 && g(u.filter((v) => v !== b)) : g((v) => [...v, b]);
6170
- }, x = (b) => {
6170
+ }, f = (b) => {
6171
6171
  n || l(b), c(b);
6172
6172
  }, k = getBreakpointValue(n ? i : a).toLowerCase();
6173
6173
  return h.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(h, (b) => /* @__PURE__ */ createElement(
@@ -6175,7 +6175,7 @@ const COLOR_PROP = {
6175
6175
  {
6176
6176
  canvas: n,
6177
6177
  ...b,
6178
- onClick: x,
6178
+ onClick: f,
6179
6179
  key: b.breakpoint,
6180
6180
  currentBreakpoint: k
6181
6181
  }
@@ -6189,7 +6189,7 @@ const COLOR_PROP = {
6189
6189
  openDelay: o,
6190
6190
  tooltip: r,
6191
6191
  ...b,
6192
- onClick: x,
6192
+ onClick: f,
6193
6193
  key: b.breakpoint,
6194
6194
  currentBreakpoint: k
6195
6195
  }
@@ -6204,7 +6204,7 @@ const COLOR_PROP = {
6204
6204
  DropdownMenuCheckboxItem,
6205
6205
  {
6206
6206
  disabled: b.breakpoint === "xs",
6207
- onCheckedChange: () => f(toUpper(b.breakpoint)),
6207
+ onCheckedChange: () => x(toUpper(b.breakpoint)),
6208
6208
  checked: includes(u, toUpper(b.breakpoint)),
6209
6209
  children: m(b.title)
6210
6210
  },
@@ -6289,8 +6289,8 @@ const AskAIStyles = ({ blockId: o }) => {
6289
6289
  (h = d.current) == null || h.focus();
6290
6290
  }, []);
6291
6291
  const m = (h) => {
6292
- const { usage: f } = h || {};
6293
- !l && f && g(f), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
6292
+ const { usage: x } = h || {};
6293
+ !l && x && g(x), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
6294
6294
  };
6295
6295
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
6296
6296
  /* @__PURE__ */ jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
@@ -6346,20 +6346,20 @@ const AskAIStyles = ({ blockId: o }) => {
6346
6346
  };
6347
6347
  function ManualClasses() {
6348
6348
  var I;
6349
- const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), k = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, k, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6350
- const L = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6351
- u(m, L, !0), x("");
6349
+ const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [m] = useSelectedBlockIds(), h = useBuilderProp("askAiCallBack", null), [x, f] = useState(""), k = (I = first(d)) == null ? void 0 : I.prop, { classes: b } = getSplitChaiClasses(get(p, k, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6350
+ const L = x.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6351
+ u(m, L, !0), f("");
6352
6352
  }, [w, _] = useState([]), E = ({ value: L }) => {
6353
- const P = L.trim().toLowerCase(), T = P.match(/.+:/g);
6353
+ const R = L.trim().toLowerCase(), T = R.match(/.+:/g);
6354
6354
  let D = [];
6355
6355
  if (T && T.length > 0) {
6356
- const [O] = T, R = P.replace(O, "");
6357
- D = i.search(R).map((M) => ({
6356
+ const [O] = T, P = R.replace(O, "");
6357
+ D = i.search(P).map((M) => ({
6358
6358
  ...M,
6359
6359
  item: { ...M.item, name: O + M.item.name }
6360
6360
  }));
6361
6361
  } else
6362
- D = i.search(P);
6362
+ D = i.search(R);
6363
6363
  return _(map(D, "item"));
6364
6364
  }, C = () => {
6365
6365
  _([]);
@@ -6371,23 +6371,23 @@ function ManualClasses() {
6371
6371
  autoCapitalize: "off",
6372
6372
  spellCheck: !1,
6373
6373
  placeholder: c("Enter classes separated by space"),
6374
- value: f,
6374
+ value: x,
6375
6375
  onFocus: (L) => {
6376
6376
  setTimeout(() => {
6377
6377
  L.target && L.target.select();
6378
6378
  }, 0);
6379
6379
  },
6380
6380
  onKeyDown: (L) => {
6381
- L.key === "Enter" && f.trim() !== "" && B();
6381
+ L.key === "Enter" && x.trim() !== "" && B();
6382
6382
  },
6383
- onChange: (L, { newValue: P }) => x(P),
6383
+ onChange: (L, { newValue: R }) => f(R),
6384
6384
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
6385
6385
  }),
6386
- [f, c, o]
6386
+ [x, c, o]
6387
6387
  ), y = (L) => {
6388
6388
  debugger;
6389
- const P = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6390
- g(m, [L]), u(m, P, !0), r(""), l(-1);
6389
+ const R = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6390
+ g(m, [L]), u(m, R, !0), r(""), l(-1);
6391
6391
  }, j = () => {
6392
6392
  if (navigator.clipboard === void 0) {
6393
6393
  toast.error(c("Clipboard not supported"));
@@ -6438,14 +6438,14 @@ function ManualClasses() {
6438
6438
  variant: "outline",
6439
6439
  className: "h-6 border-border",
6440
6440
  onClick: B,
6441
- disabled: f.trim() === "",
6441
+ disabled: x.trim() === "",
6442
6442
  size: "sm",
6443
6443
  children: /* @__PURE__ */ jsx(PlusIcon, {})
6444
6444
  }
6445
6445
  )
6446
6446
  ] }),
6447
6447
  /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: v.map(
6448
- (L, P) => a === P ? /* @__PURE__ */ jsx(
6448
+ (L, R) => a === R ? /* @__PURE__ */ jsx(
6449
6449
  "input",
6450
6450
  {
6451
6451
  ref: o,
@@ -6469,7 +6469,7 @@ function ManualClasses() {
6469
6469
  "button",
6470
6470
  {
6471
6471
  onDoubleClick: () => {
6472
- x(L), g(m, [L]), setTimeout(() => {
6472
+ f(L), g(m, [L]), setTimeout(() => {
6473
6473
  o.current && o.current.focus();
6474
6474
  }, 10);
6475
6475
  },
@@ -6602,9 +6602,9 @@ function BlockStyling() {
6602
6602
  const g = !get(i, "negative", !1), m = get(i, "cssProperty", "");
6603
6603
  let h = parseFloat(i.dragStartValue);
6604
6604
  h = isNaN(h) ? 0 : h;
6605
- let f = MAPPER[i.dragUnit];
6606
- (startsWith(m, "scale") || m === "opacity") && (f = 10);
6607
- let k = (i.dragStartY - u.pageY) / f + h;
6605
+ let x = MAPPER[i.dragUnit];
6606
+ (startsWith(m, "scale") || m === "opacity") && (x = 10);
6607
+ let k = (i.dragStartY - u.pageY) / x + h;
6608
6608
  g && k < 0 && (k = 0), m === "opacity" && k > 1 && (k = 1), i.onDrag(`${k}`), l(`${k}`);
6609
6609
  },
6610
6610
  [i],
@@ -6653,7 +6653,7 @@ const CoreBlock = ({
6653
6653
  } else
6654
6654
  p(o, r || null, a);
6655
6655
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
6656
- }, f = useFeature("dnd"), { t: x } = useTranslation();
6656
+ }, x = useFeature("dnd"), { t: f } = useTranslation();
6657
6657
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
6658
6658
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
6659
6659
  "button",
@@ -6666,15 +6666,15 @@ const CoreBlock = ({
6666
6666
  g([]), m();
6667
6667
  }, 200);
6668
6668
  },
6669
- draggable: f ? "true" : "false",
6669
+ draggable: x ? "true" : "false",
6670
6670
  className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
6671
6671
  children: [
6672
6672
  createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
6673
- /* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(x(d || i)) })
6673
+ /* @__PURE__ */ jsx("p", { className: "truncate text-xs", children: capitalize(f(d || i)) })
6674
6674
  ]
6675
6675
  }
6676
6676
  ) }),
6677
- /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: x(d || i) }) })
6677
+ /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: f(d || i) }) })
6678
6678
  ] }) });
6679
6679
  }, DefaultChaiBlocks = ({
6680
6680
  parentId: o,
@@ -6862,7 +6862,7 @@ const CoreBlock = ({
6862
6862
  }
6863
6863
  }
6864
6864
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
6865
- var m, h, f, x, k, b, v, B;
6865
+ var m, h, x, f, k, b, v, B;
6866
6866
  if (r.type === "comment") return [];
6867
6867
  let a = { _id: generateUUID() };
6868
6868
  if (n && (a._parent = n.block._id), r.type === "text")
@@ -6904,8 +6904,8 @@ const CoreBlock = ({
6904
6904
  ...a,
6905
6905
  href: ((m = l.find((_) => _.key === "href")) == null ? void 0 : m.value) || "",
6906
6906
  hrefType: ((h = l.find((_) => _.key === "data-vbtype")) == null ? void 0 : h.value) || "video",
6907
- autoplay: ((f = l.find((_) => _.key === "data-autoplay")) == null ? void 0 : f.value) === "true" ? "true" : "false",
6908
- maxWidth: ((k = (x = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : k.replace("px", "")) || "",
6907
+ autoplay: ((x = l.find((_) => _.key === "data-autoplay")) == null ? void 0 : x.value) === "true" ? "true" : "false",
6908
+ maxWidth: ((k = (f = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : f.value) == null ? void 0 : k.replace("px", "")) || "",
6909
6909
  backdropColor: ((b = l.find((_) => _.key === "data-overlay")) == null ? void 0 : b.value) || "",
6910
6910
  galleryName: ((v = l.find((_) => _.key === "data-gall")) == null ? void 0 : v.value) || ""
6911
6911
  }, forEach(w, (_) => {
@@ -7046,7 +7046,7 @@ const registerChaiLibrary = (o, n) => {
7046
7046
  parentId: r = void 0,
7047
7047
  position: a = -1
7048
7048
  }) => {
7049
- const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), m = get(o, "name", get(o, "label")), h = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), k = (B) => {
7049
+ const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), m = get(o, "name", get(o, "label")), h = get(o, "description", ""), x = useFeature("dnd"), [, f] = useAtom$1(draggedBlockAtom), k = (B) => {
7050
7050
  const w = has(B, "styles_attrs.data-page-section");
7051
7051
  return B._type === "Box" && w;
7052
7052
  }, b = useCallback(
@@ -7067,7 +7067,7 @@ const registerChaiLibrary = (o, n) => {
7067
7067
  {
7068
7068
  onClick: l ? () => {
7069
7069
  } : b,
7070
- draggable: f ? "true" : "false",
7070
+ draggable: x ? "true" : "false",
7071
7071
  onDragStart: async (B) => {
7072
7072
  const w = await c({ library: n, block: o });
7073
7073
  let _ = r;
@@ -7080,7 +7080,7 @@ const registerChaiLibrary = (o, n) => {
7080
7080
  };
7081
7081
  } else
7082
7082
  B.dataTransfer.setDragImage(new Image(), 0, 0);
7083
- x(E), setTimeout(() => {
7083
+ f(E), setTimeout(() => {
7084
7084
  u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7085
7085
  }, 200);
7086
7086
  }
@@ -7106,22 +7106,22 @@ const registerChaiLibrary = (o, n) => {
7106
7106
  ] }) })
7107
7107
  ] });
7108
7108
  }, UILibrarySection = ({ parentId: o, position: n }) => {
7109
- const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((y) => y.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [m, h] = useState([]), f = useRef(null);
7109
+ const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((y) => y.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [m, h] = useState([]), x = useRef(null);
7110
7110
  useEffect(() => {
7111
- c && c.length > 0 && (f.current = new Fuse(c, {
7111
+ c && c.length > 0 && (x.current = new Fuse(c, {
7112
7112
  keys: ["name", "label", "description", "group"],
7113
7113
  threshold: 0.4,
7114
7114
  ignoreLocation: !0
7115
7115
  }));
7116
7116
  }, [c]), useEffect(() => {
7117
- if (!u.trim() || !f.current) {
7117
+ if (!u.trim() || !x.current) {
7118
7118
  h([]);
7119
7119
  return;
7120
7120
  }
7121
- const y = f.current.search(u).map((j) => j.item);
7121
+ const y = x.current.search(u).map((j) => j.item);
7122
7122
  h(y);
7123
7123
  }, [u]);
7124
- const x = u.trim() && !isEmpty(m) ? m : c, k = groupBy(x, "group"), [b, v] = useState(null);
7124
+ const f = u.trim() && !isEmpty(m) ? m : c, k = groupBy(f, "group"), [b, v] = useState(null);
7125
7125
  useEffect(() => {
7126
7126
  if (isEmpty(keys(k))) {
7127
7127
  v(null);
@@ -7261,25 +7261,25 @@ const registerChaiLibrary = (o, n) => {
7261
7261
  error: c
7262
7262
  }), g(!0);
7263
7263
  else if (!l && Object.keys(a || {}).length > 0) {
7264
- const h = Object.entries(a).map(([x, k]) => {
7264
+ const h = Object.entries(a).map(([f, k]) => {
7265
7265
  const b = k, v = b.type || "partial", B = formatReadableName(v);
7266
7266
  return {
7267
7267
  type: "PartialBlock",
7268
7268
  // Set the type to PartialBlock
7269
- label: formatReadableName(b.name || x),
7269
+ label: formatReadableName(b.name || f),
7270
7270
  description: b.description || "",
7271
7271
  icon: Globe,
7272
7272
  group: B,
7273
7273
  // Use formatted type as group
7274
7274
  category: "partial",
7275
- partialBlockId: x,
7275
+ partialBlockId: f,
7276
7276
  // Store the original ID as partialBlockId
7277
7277
  _name: b.name
7278
7278
  };
7279
- }), f = uniq(map(h, "group"));
7279
+ }), x = uniq(map(h, "group"));
7280
7280
  p({
7281
7281
  blocks: h,
7282
- groups: f,
7282
+ groups: x,
7283
7283
  isLoading: !1,
7284
7284
  error: null
7285
7285
  }), g(!0);
@@ -7325,7 +7325,7 @@ const registerChaiLibrary = (o, n) => {
7325
7325
  has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
7326
7326
  }, useChaiAddBlockTabs = () => useMemo(() => values(ADD_BLOCK_TABS), []), CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, position: a, gridCols: l = "grid-cols-4" }) => {
7327
7327
  var S;
7328
- const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (S = find(c, (y) => y._id === r)) == null ? void 0 : S._type, [h, f] = useState("all"), [x, k] = useState(null), b = useRef(null);
7328
+ const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (S = find(c, (y) => y._id === r)) == null ? void 0 : S._type, [h, x] = useState("all"), [f, k] = useState(null), b = useRef(null);
7329
7329
  useEffect(() => {
7330
7330
  const y = setTimeout(() => {
7331
7331
  var j;
@@ -7333,9 +7333,9 @@ const registerChaiLibrary = (o, n) => {
7333
7333
  }, 0);
7334
7334
  return () => clearTimeout(y);
7335
7335
  }, [g]), useEffect(() => {
7336
- d && (f("all"), k(null));
7336
+ d && (x("all"), k(null));
7337
7337
  }, [d]), useEffect(() => (b.current = debounce((y) => {
7338
- f(y);
7338
+ x(y);
7339
7339
  }, 500), () => {
7340
7340
  b.current && b.current.cancel();
7341
7341
  }), []);
@@ -7344,7 +7344,7 @@ const registerChaiLibrary = (o, n) => {
7344
7344
  }, []), B = useCallback(() => {
7345
7345
  k(null), b.current && b.current.cancel();
7346
7346
  }, []), w = useCallback((y) => {
7347
- b.current && b.current.cancel(), f(y), k(null);
7347
+ b.current && b.current.cancel(), x(y), k(null);
7348
7348
  }, []), _ = useMemo(
7349
7349
  () => d ? values(n).filter(
7350
7350
  (y) => {
@@ -7382,7 +7382,7 @@ const registerChaiLibrary = (o, n) => {
7382
7382
  onClick: () => w("all"),
7383
7383
  onMouseEnter: () => v("all"),
7384
7384
  onMouseLeave: B,
7385
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7385
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${h === "all" || f === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7386
7386
  children: i("All")
7387
7387
  },
7388
7388
  "sidebar-all"
@@ -7393,7 +7393,7 @@ const registerChaiLibrary = (o, n) => {
7393
7393
  onClick: () => w(y),
7394
7394
  onMouseEnter: () => v(y),
7395
7395
  onMouseLeave: B,
7396
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === y || x === y ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7396
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === y || f === y ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7397
7397
  children: capitalize(i(y.toLowerCase()))
7398
7398
  },
7399
7399
  `sidebar-${y}`
@@ -7434,7 +7434,7 @@ const registerChaiLibrary = (o, n) => {
7434
7434
  }, [i, g, c]);
7435
7435
  const h = useCallback(() => {
7436
7436
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7437
- }, []), f = useChaiAddBlockTabs(), x = p && m(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7437
+ }, []), x = useChaiAddBlockTabs(), f = p && m(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7438
7438
  return useEffect(() => {
7439
7439
  i === "library" && !b && c("core");
7440
7440
  }, [i, b, c]), /* @__PURE__ */ jsxs("div", { className: cn$2("flex h-full w-full flex-col overflow-hidden", o), children: [
@@ -7455,14 +7455,14 @@ const registerChaiLibrary = (o, n) => {
7455
7455
  b && /* @__PURE__ */ jsx(TabsTrigger, { value: "library", children: l("Library") }),
7456
7456
  /* @__PURE__ */ jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
7457
7457
  g && /* @__PURE__ */ jsx(TabsTrigger, { value: "partials", children: l("Partials") }),
7458
- x ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
7459
- map(f, (v) => /* @__PURE__ */ jsx(TabsTrigger, { value: v.id, children: React__default.createElement(v.tab) }, `tab-add-block-${v.id}`))
7458
+ f ? /* @__PURE__ */ jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
7459
+ map(x, (v) => /* @__PURE__ */ jsx(TabsTrigger, { value: v.id, children: React__default.createElement(v.tab) }, `tab-add-block-${v.id}`))
7460
7460
  ] }),
7461
7461
  /* @__PURE__ */ jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
7462
7462
  b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
7463
7463
  g && /* @__PURE__ */ jsx(TabsContent, { value: "partials", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx("div", { className: "-mx-1.5 h-full max-h-full overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-2 h-full w-full", children: /* @__PURE__ */ jsx(PartialBlocks, { gridCols: "grid-cols-4", parentId: r, position: a }) }) }) }),
7464
- x ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
7465
- map(f, (v) => /* @__PURE__ */ jsx(TabsContent, { value: v.id, children: React__default.createElement(v.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${v.id}`))
7464
+ f ? /* @__PURE__ */ jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(ImportHTML, { parentId: r, position: a }) }) : null,
7465
+ map(x, (v) => /* @__PURE__ */ jsx(TabsContent, { value: v.id, children: React__default.createElement(v.tabContent, { close: h, parentId: r, position: a }) }, `panel-add-block-${v.id}`))
7466
7466
  ]
7467
7467
  }
7468
7468
  )
@@ -7766,10 +7766,10 @@ const Input = ({ node: o }) => {
7766
7766
  }
7767
7767
  );
7768
7768
  }, currentAddSelection = atom(null), Node = memo(({ node: o, style: n, dragHandle: r }) => {
7769
- var P;
7769
+ var R;
7770
7770
  const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
7771
7771
  let p = null;
7772
- const u = o.children.length > 0, { highlightBlock: g, clearHighlight: m } = useBlockHighlight(), { id: h, data: f, isSelected: x, willReceiveDrop: k, isDragging: b, isEditing: v, handleClick: B } = o, w = (T) => {
7772
+ const u = o.children.length > 0, { highlightBlock: g, clearHighlight: m } = useBlockHighlight(), { id: h, data: x, isSelected: f, willReceiveDrop: k, isDragging: b, isEditing: v, handleClick: B } = o, w = (T) => {
7773
7773
  T.stopPropagation(), !l.includes(h) && o.toggle();
7774
7774
  }, _ = (T) => {
7775
7775
  T.isInternal && (p = T.isOpen, T.isOpen && T.close());
@@ -7790,10 +7790,10 @@ const Input = ({ node: o }) => {
7790
7790
  return () => clearTimeout(T);
7791
7791
  }, [k, o, b]);
7792
7792
  const j = (T, D) => {
7793
- const O = c.contentDocument || c.contentWindow.document, R = O.querySelector(`[data-block-id=${T}]`);
7794
- R && R.setAttribute("data-drop", D);
7795
- const $ = R.getBoundingClientRect(), M = c.getBoundingClientRect();
7796
- $.top >= M.top && $.left >= M.left && $.bottom <= M.bottom && $.right <= M.right || (O.documentElement.scrollTop = R.offsetTop - M.top);
7793
+ const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${T}]`);
7794
+ P && P.setAttribute("data-drop", D);
7795
+ const $ = P.getBoundingClientRect(), M = c.getBoundingClientRect();
7796
+ $.top >= M.top && $.left >= M.left && $.bottom <= M.bottom && $.right <= M.right || (O.documentElement.scrollTop = P.offsetTop - M.top);
7797
7797
  }, I = (T) => {
7798
7798
  S();
7799
7799
  const D = get(o, "parent.id");
@@ -7817,7 +7817,7 @@ const Input = ({ node: o }) => {
7817
7817
  ),
7818
7818
  /* @__PURE__ */ jsx("br", {})
7819
7819
  ] });
7820
- const L = useMemo(() => has(f, "_libBlockId") && !isEmpty(f._libBlockId) && (d(PERMISSIONS.CREATE_LIBRARY_BLOCK) || d(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [f, d]);
7820
+ const L = useMemo(() => has(x, "_libBlockId") && !isEmpty(x._libBlockId) && (d(PERMISSIONS.CREATE_LIBRARY_BLOCK) || d(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [x, d]);
7821
7821
  return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
7822
7822
  "div",
7823
7823
  {
@@ -7839,7 +7839,7 @@ const Input = ({ node: o }) => {
7839
7839
  T.preventDefault(), j(h, "no");
7840
7840
  },
7841
7841
  children: [
7842
- d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((P = o == null ? void 0 : o.parent) == null ? void 0 : P.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
7842
+ d(PERMISSIONS.ADD_BLOCK) && (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((R = o == null ? void 0 : o.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(
7843
7843
  "div",
7844
7844
  {
7845
7845
  onClick: (T) => {
@@ -7856,12 +7856,12 @@ const Input = ({ node: o }) => {
7856
7856
  {
7857
7857
  className: cn(
7858
7858
  "group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 outline-none",
7859
- x ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
7860
- k && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
7859
+ f ? "bg-primary text-primary-foreground" : "hover:bg-primary/10 dark:hover:bg-gray-800",
7860
+ k && canAcceptChildBlock(x._type, "Icon") ? "bg-green-200" : "",
7861
7861
  (o == null ? void 0 : o.id) === C ? "bg-primary/10" : "",
7862
7862
  b && "opacity-20",
7863
7863
  l.includes(h) ? "opacity-50" : "",
7864
- L && x && "bg-primary/20 text-primary"
7864
+ L && f && "bg-primary/20 text-primary"
7865
7865
  ),
7866
7866
  children: [
7867
7867
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -7869,7 +7869,7 @@ const Input = ({ node: o }) => {
7869
7869
  "div",
7870
7870
  {
7871
7871
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
7872
- children: u && /* @__PURE__ */ jsx("button", { onClick: w, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-white" : "text-slate-400"}` }) })
7872
+ children: u && /* @__PURE__ */ jsx("button", { onClick: w, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${f ? "text-white" : "text-slate-400"}` }) })
7873
7873
  }
7874
7874
  ),
7875
7875
  /* @__PURE__ */ jsxs(
@@ -7878,10 +7878,10 @@ const Input = ({ node: o }) => {
7878
7878
  className: cn(
7879
7879
  "leading-1 flex items-center",
7880
7880
  L && "text-primary/60",
7881
- L && x && "text-primary/80"
7881
+ L && f && "text-primary/80"
7882
7882
  ),
7883
7883
  children: [
7884
- /* @__PURE__ */ jsx(TypeIcon, { type: f == null ? void 0 : f._type }),
7884
+ /* @__PURE__ */ jsx(TypeIcon, { type: x == null ? void 0 : x._type }),
7885
7885
  v ? /* @__PURE__ */ jsx(Input, { node: o }) : /* @__PURE__ */ jsx(
7886
7886
  "div",
7887
7887
  {
@@ -7889,7 +7889,7 @@ const Input = ({ node: o }) => {
7889
7889
  onDoubleClick: (T) => {
7890
7890
  T.stopPropagation(), o.edit(), o.deselect();
7891
7891
  },
7892
- children: /* @__PURE__ */ jsx("span", { children: (f == null ? void 0 : f._name) || (f == null ? void 0 : f._type.split("/").pop()) })
7892
+ children: /* @__PURE__ */ jsx("span", { children: (x == null ? void 0 : x._name) || (x == null ? void 0 : x._type.split("/").pop()) })
7893
7893
  }
7894
7894
  )
7895
7895
  ]
@@ -7897,7 +7897,7 @@ const Input = ({ node: o }) => {
7897
7897
  )
7898
7898
  ] }),
7899
7899
  /* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
7900
- canAddChildBlock(f == null ? void 0 : f._type) && !l.includes(h) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7900
+ canAddChildBlock(x == null ? void 0 : x._type) && !l.includes(h) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7901
7901
  /* @__PURE__ */ jsx(
7902
7902
  TooltipTrigger,
7903
7903
  {
@@ -8197,7 +8197,7 @@ const Input = ({ node: o }) => {
8197
8197
  B && typeof B == "object" && "fontFamily" in B && "borderRadius" in B && "colors" in B ? p(B) : console.error("Invalid preset structure:", B);
8198
8198
  } else
8199
8199
  console.error("Preset not found:", r);
8200
- }, f = useDebouncedCallback(
8200
+ }, x = useDebouncedCallback(
8201
8201
  (v, B) => {
8202
8202
  p(() => ({
8203
8203
  ...d,
@@ -8209,7 +8209,7 @@ const Input = ({ node: o }) => {
8209
8209
  },
8210
8210
  [d],
8211
8211
  200
8212
- ), x = useDebouncedCallback(
8212
+ ), f = useDebouncedCallback(
8213
8213
  (v) => {
8214
8214
  p(() => ({
8215
8215
  ...d,
@@ -8281,14 +8281,14 @@ const Input = ({ node: o }) => {
8281
8281
  {
8282
8282
  label: v,
8283
8283
  value: d.fontFamily[v.replace(/font-/g, "")] || B[Object.keys(B)[0]],
8284
- onChange: (w) => f(v, w)
8284
+ onChange: (w) => x(v, w)
8285
8285
  },
8286
8286
  v
8287
8287
  )) }),
8288
8288
  (u == null ? void 0 : u.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5 py-3", children: [
8289
8289
  /* @__PURE__ */ jsx(Label, { className: "text-sm", children: g("Border Radius") }),
8290
8290
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 py-2", children: [
8291
- /* @__PURE__ */ jsx(BorderRadiusInput, { value: d.borderRadius, onChange: x }),
8291
+ /* @__PURE__ */ jsx(BorderRadiusInput, { value: d.borderRadius, onChange: f }),
8292
8292
  /* @__PURE__ */ jsx("span", { className: "w-12 text-sm", children: d.borderRadius })
8293
8293
  ] })
8294
8294
  ] }),
@@ -8766,11 +8766,11 @@ function QuickPrompts({ onClick: o }) {
8766
8766
  const AIUserPrompt = ({ blockId: o }) => {
8767
8767
  const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, g] = useState(), m = useRef(null), h = useRef(null);
8768
8768
  useEffect(() => {
8769
- var x;
8770
- (x = m.current) == null || x.focus();
8769
+ var f;
8770
+ (f = m.current) == null || f.focus();
8771
8771
  }, []);
8772
- const f = (x) => {
8773
- const { usage: k } = x || {};
8772
+ const x = (f) => {
8773
+ const { usage: k } = f || {};
8774
8774
  !l && k && g(k), h.current = setTimeout(() => g(void 0), 1e4), l || c("");
8775
8775
  };
8776
8776
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
@@ -8791,12 +8791,12 @@ const AIUserPrompt = ({ blockId: o }) => {
8791
8791
  {
8792
8792
  ref: m,
8793
8793
  value: i,
8794
- onChange: (x) => c(x.target.value),
8794
+ onChange: (f) => c(f.target.value),
8795
8795
  placeholder: n("Ask AI to edit content"),
8796
8796
  className: "w-full",
8797
8797
  rows: 3,
8798
- onKeyDown: (x) => {
8799
- x.key === "Enter" && (x.preventDefault(), h.current && clearTimeout(h.current), g(void 0), r("content", o, i, f));
8798
+ onKeyDown: (f) => {
8799
+ f.key === "Enter" && (f.preventDefault(), h.current && clearTimeout(h.current), g(void 0), r("content", o, i, x));
8800
8800
  }
8801
8801
  }
8802
8802
  ),
@@ -8806,7 +8806,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8806
8806
  {
8807
8807
  disabled: i.trim().length < 5 || a,
8808
8808
  onClick: () => {
8809
- h.current && clearTimeout(h.current), g(void 0), r("content", o, i, f);
8809
+ h.current && clearTimeout(h.current), g(void 0), r("content", o, i, x);
8810
8810
  },
8811
8811
  variant: "default",
8812
8812
  className: "w-fit",
@@ -8838,8 +8838,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8838
8838
  /* @__PURE__ */ jsx(
8839
8839
  QuickPrompts,
8840
8840
  {
8841
- onClick: (x) => {
8842
- h.current && clearTimeout(h.current), g(void 0), r("content", o, x, f);
8841
+ onClick: (f) => {
8842
+ h.current && clearTimeout(h.current), g(void 0), r("content", o, f, x);
8843
8843
  }
8844
8844
  }
8845
8845
  )
@@ -8856,8 +8856,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8856
8856
  const h = async () => {
8857
8857
  try {
8858
8858
  d(!0), u(null), await i(r), toast.success(o("Updated AI Context")), m.current.click();
8859
- } catch (f) {
8860
- u(f);
8859
+ } catch (x) {
8860
+ u(x);
8861
8861
  } finally {
8862
8862
  d(!1);
8863
8863
  }
@@ -8865,8 +8865,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8865
8865
  return /* @__PURE__ */ jsx(
8866
8866
  Accordion,
8867
8867
  {
8868
- onValueChange: (f) => {
8869
- g(f !== "");
8868
+ onValueChange: (x) => {
8869
+ g(x !== "");
8870
8870
  },
8871
8871
  type: "single",
8872
8872
  collapsible: !0,
@@ -8878,12 +8878,12 @@ const AIUserPrompt = ({ blockId: o }) => {
8878
8878
  {
8879
8879
  ref: l,
8880
8880
  value: r,
8881
- onChange: (f) => a(f.target.value),
8881
+ onChange: (x) => a(x.target.value),
8882
8882
  placeholder: o("Tell about this page eg this page is about"),
8883
8883
  className: "mt-1 w-full",
8884
8884
  rows: 10,
8885
- onKeyDown: (f) => {
8886
- f.key === "Enter" && (f.preventDefault(), h());
8885
+ onKeyDown: (x) => {
8886
+ x.key === "Enter" && (x.preventDefault(), h());
8887
8887
  }
8888
8888
  }
8889
8889
  ),
@@ -9004,7 +9004,7 @@ function AIChatPanel() {
9004
9004
  }, 1500);
9005
9005
  }, h = (b) => {
9006
9006
  b.key === "Enter" && !b.shiftKey && (b.preventDefault(), m());
9007
- }, f = (b) => {
9007
+ }, x = (b) => {
9008
9008
  var B;
9009
9009
  const v = (B = b.target.files) == null ? void 0 : B[0];
9010
9010
  if (v) {
@@ -9014,7 +9014,7 @@ function AIChatPanel() {
9014
9014
  d((E = _.target) == null ? void 0 : E.result);
9015
9015
  }, w.readAsDataURL(v);
9016
9016
  }
9017
- }, x = () => {
9017
+ }, f = () => {
9018
9018
  var b;
9019
9019
  (b = p.current) == null || b.click();
9020
9020
  }, k = () => {
@@ -9081,14 +9081,14 @@ function AIChatPanel() {
9081
9081
  className: "max-h-[120px] min-h-[40px] resize-none border-0 bg-muted/50 py-2.5 pr-10 focus-visible:ring-1"
9082
9082
  }
9083
9083
  ),
9084
- /* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange: f, accept: "image/*", className: "hidden" }),
9084
+ /* @__PURE__ */ jsx("input", { type: "file", ref: p, onChange: x, accept: "image/*", className: "hidden" }),
9085
9085
  /* @__PURE__ */ jsx(
9086
9086
  Button,
9087
9087
  {
9088
9088
  size: "icon",
9089
9089
  variant: "ghost",
9090
9090
  className: "absolute bottom-2 right-2 h-6 w-6",
9091
- onClick: x,
9091
+ onClick: f,
9092
9092
  children: /* @__PURE__ */ jsx(Image$1, { className: "h-4 w-4 text-muted-foreground" })
9093
9093
  }
9094
9094
  )
@@ -9206,7 +9206,7 @@ const AiAssistant = () => {
9206
9206
  preloadedAttributes: n = [],
9207
9207
  onAttributesChange: r
9208
9208
  }) {
9209
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""), f = useRef(null), x = useRef(null), k = usePageExternalData();
9209
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""), x = useRef(null), f = useRef(null), k = usePageExternalData();
9210
9210
  useEffect(() => {
9211
9211
  l(n);
9212
9212
  }, [n]);
@@ -9237,22 +9237,22 @@ const AiAssistant = () => {
9237
9237
  C.key === "Enter" && !C.shiftKey && (C.preventDefault(), u !== null ? w() : b());
9238
9238
  }, E = useCallback((C) => {
9239
9239
  const A = (y) => /[.,!?;:]/.test(y), N = (y, j, I) => {
9240
- let L = "", P = "";
9240
+ let L = "", R = "";
9241
9241
  const T = j > 0 ? y[j - 1] : "", D = j < y.length ? y[j] : "";
9242
- return j > 0 && (T === "." || !A(T) && T !== " ") && (L = " "), j < y.length && !A(D) && D !== " " && (P = " "), {
9243
- text: L + I + P,
9242
+ return j > 0 && (T === "." || !A(T) && T !== " ") && (L = " "), j < y.length && !A(D) && D !== " " && (R = " "), {
9243
+ text: L + I + R,
9244
9244
  prefixLength: L.length,
9245
- suffixLength: P.length
9245
+ suffixLength: R.length
9246
9246
  };
9247
- }, S = x.current;
9247
+ }, S = f.current;
9248
9248
  if (S) {
9249
9249
  const y = S.selectionStart || 0, j = S.value || "", I = S.selectionEnd || y;
9250
9250
  if (I > y) {
9251
- const O = `{{${C}}}`, { text: R } = N(j, y, O), $ = j.slice(0, y) + R + j.slice(I);
9251
+ const O = `{{${C}}}`, { text: P } = N(j, y, O), $ = j.slice(0, y) + P + j.slice(I);
9252
9252
  p($);
9253
9253
  return;
9254
9254
  }
9255
- const P = `{{${C}}}`, { text: T } = N(j, y, P), D = j.slice(0, y) + T + j.slice(y);
9255
+ const R = `{{${C}}}`, { text: T } = N(j, y, R), D = j.slice(0, y) + T + j.slice(y);
9256
9256
  p(D);
9257
9257
  }
9258
9258
  }, []);
@@ -9275,7 +9275,7 @@ const AiAssistant = () => {
9275
9275
  autoCorrect: "off",
9276
9276
  spellCheck: "false",
9277
9277
  id: "attrKey",
9278
- ref: f,
9278
+ ref: x,
9279
9279
  value: i,
9280
9280
  onChange: (C) => c(C.target.value),
9281
9281
  placeholder: "Enter Key",
@@ -9296,7 +9296,7 @@ const AiAssistant = () => {
9296
9296
  spellCheck: "false",
9297
9297
  id: "attrValue",
9298
9298
  rows: 2,
9299
- ref: x,
9299
+ ref: f,
9300
9300
  value: d,
9301
9301
  onChange: (C) => p(C.target.value),
9302
9302
  onKeyDown: _,
@@ -9445,28 +9445,28 @@ const RootLayout = () => {
9445
9445
  r(n === C ? null : C);
9446
9446
  },
9447
9447
  [n]
9448
- ), { t: f } = useTranslation(), x = useMemo(
9448
+ ), { t: x } = useTranslation(), f = useMemo(
9449
9449
  () => [...p, ...u, ...g],
9450
9450
  [p, u, g]
9451
- ), k = useBuilderProp("htmlDir", "ltr"), b = find(x, { id: n }) ?? first(x), v = get(b, "width", DEFAULT_PANEL_WIDTH);
9451
+ ), k = useBuilderProp("htmlDir", "ltr"), b = find(f, { id: n }) ?? first(f), v = get(b, "width", DEFAULT_PANEL_WIDTH);
9452
9452
  useEffect(() => {
9453
9453
  if (n !== null) {
9454
- const C = find(x, { id: n });
9454
+ const C = find(f, { id: n });
9455
9455
  C && get(C, "view", "standard") === "standard" && (a.current = n, i(get(C, "width", DEFAULT_PANEL_WIDTH)));
9456
9456
  }
9457
- }, [n, x]);
9457
+ }, [n, f]);
9458
9458
  const B = useMemo(() => {
9459
9459
  if (n === null) return 0;
9460
- const C = find(x, { id: n });
9460
+ const C = find(f, { id: n });
9461
9461
  return get(C, "view", "standard") === "standard" ? v : l;
9462
- }, [n, v, l, x]), w = useCallback(() => {
9462
+ }, [n, v, l, f]), w = useCallback(() => {
9463
9463
  r(a.current);
9464
9464
  }, [r]), _ = useCallback(() => {
9465
9465
  r("outline");
9466
9466
  }, [r]);
9467
9467
  useEffect(() => {
9468
- find(x, { id: n }) || r("outline");
9469
- }, [n, x]);
9468
+ find(f, { id: n }) || r("outline");
9469
+ }, [n, f]);
9470
9470
  const E = useCallback(
9471
9471
  (C) => {
9472
9472
  h(C);
@@ -9490,7 +9490,7 @@ const RootLayout = () => {
9490
9490
  isActive: n === C.id,
9491
9491
  show: () => E(C.id)
9492
9492
  }) }),
9493
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(C.label) }) })
9493
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(C.label) }) })
9494
9494
  ] }, "button-top-" + A)) }),
9495
9495
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
9496
9496
  /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: g == null ? void 0 : g.map((C, A) => /* @__PURE__ */ jsxs(Tooltip, { children: [
@@ -9500,7 +9500,7 @@ const RootLayout = () => {
9500
9500
  isActive: n === C.id,
9501
9501
  show: () => E(C.id)
9502
9502
  }) }),
9503
- /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(C.label) }) })
9503
+ /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: x(C.label) }) })
9504
9504
  ] }, "button-bottom-" + A)) })
9505
9505
  ] }),
9506
9506
  /* @__PURE__ */ jsx(
@@ -9516,7 +9516,7 @@ const RootLayout = () => {
9516
9516
  "div",
9517
9517
  {
9518
9518
  className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${get(b, "isInternal", !1) ? "" : "w-64"}`,
9519
- children: /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9519
+ children: /* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
9520
9520
  }
9521
9521
  ),
9522
9522
  /* @__PURE__ */ jsx("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {}) }) })
@@ -9539,11 +9539,11 @@ const RootLayout = () => {
9539
9539
  /* @__PURE__ */ jsx("h2", { className: "-mt-1 flex items-center space-x-1 text-base font-bold", children: /* @__PURE__ */ jsx("div", { className: "flex grow items-center gap-2", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between gap-2", children: c === "ai" ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
9540
9540
  /* @__PURE__ */ jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
9541
9541
  " ",
9542
- f("AI Assistant")
9542
+ x("AI Assistant")
9543
9543
  ] }) }) : c === "theme" ? /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
9544
9544
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
9545
9545
  /* @__PURE__ */ jsx(Paintbrush, { className: "h-4 w-4 rtl:ml-2" }),
9546
- f("Theme Settings")
9546
+ x("Theme Settings")
9547
9547
  ] }),
9548
9548
  /* @__PURE__ */ jsx(
9549
9549
  Button,
@@ -9574,7 +9574,7 @@ const RootLayout = () => {
9574
9574
  children: [
9575
9575
  /* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
9576
9576
  /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
9577
- /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9577
+ /* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
9578
9578
  ] }) }),
9579
9579
  /* @__PURE__ */ jsx("div", { className: "h-full max-h-full overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
9580
9580
  close: _
@@ -9586,7 +9586,7 @@ const RootLayout = () => {
9586
9586
  n !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "gap-0 p-0", style: { maxWidth: `${v}px` }, children: [
9587
9587
  /* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
9588
9588
  /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
9589
- /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9589
+ /* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
9590
9590
  ] }) }),
9591
9591
  /* @__PURE__ */ jsx("div", { className: "max-h-[70vh] overflow-y-auto p-4", children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "Loading..." }), children: React__default.createElement(get(b, "panel", NoopComponent), {
9592
9592
  close: _
@@ -9612,7 +9612,7 @@ const RootLayout = () => {
9612
9612
  /* @__PURE__ */ jsxs("div", { className: "flex h-[50px] items-center justify-between border-b border-border p-4", children: [
9613
9613
  /* @__PURE__ */ jsxs("div", { className: "-ml-2 flex items-center gap-2 text-lg font-bold", children: [
9614
9614
  /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
9615
- /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9615
+ /* @__PURE__ */ jsx("span", { children: x(get(b, "label", "")) })
9616
9616
  ] }),
9617
9617
  /* @__PURE__ */ jsx(Button, { onClick: () => w(), variant: "ghost", size: "icon", className: "", children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" }) })
9618
9618
  ] }),
@@ -9634,6 +9634,38 @@ const RootLayout = () => {
9634
9634
  ] }),
9635
9635
  /* @__PURE__ */ jsx("div", { children: a ? /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Skeleton, { className: "h-96 w-full" }), children: React__default.createElement(a) }) : null })
9636
9636
  ] }) : null;
9637
+ }, CHAI_FEATURE_FLAGS = {}, useChaiFeatureFlags = () => CHAI_FEATURE_FLAGS, featureFlagsAtom = atomWithStorage("chai-feature-flags", []), useChaiFeatureFlag = (o) => {
9638
+ const [n] = useAtom$1(featureFlagsAtom);
9639
+ return n.includes(o);
9640
+ }, useToggleChaiFeatureFlag = (o) => {
9641
+ const [n, r] = useAtom$1(featureFlagsAtom);
9642
+ return () => {
9643
+ n.includes(o) ? r(n.filter((l) => l !== o)) : r([...n, o]);
9644
+ };
9645
+ }, FeatureToggle = ({
9646
+ featureKey: o,
9647
+ options: n
9648
+ }) => {
9649
+ const r = useToggleChaiFeatureFlag(o), a = useChaiFeatureFlag(o);
9650
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
9651
+ /* @__PURE__ */ jsx(Switch, { checked: a, onCheckedChange: r }),
9652
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
9653
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: n.key }),
9654
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: n.description })
9655
+ ] })
9656
+ ] });
9657
+ }, showFeatureFlagAtom = atomWithStorage("show-feature-flag", !1), ChaiFeatureFlagsWidget = () => {
9658
+ const o = useChaiFeatureFlags(), [n, r] = useAtom$1(showFeatureFlagAtom);
9659
+ return useHotkeys("ctrl+shift+1,command+shift+1", () => r(!n)), n ? /* @__PURE__ */ jsxs(Popover, { open: !0, children: [
9660
+ /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(Settings$1, {}) }),
9661
+ /* @__PURE__ */ jsx(PopoverContent, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-1", children: [
9662
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 px-1", children: [
9663
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: "Feature Flags" }),
9664
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Enable or disable experimental features" })
9665
+ ] }),
9666
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-3 pt-2", children: Object.entries(o).map(([a, l]) => /* @__PURE__ */ jsx(FeatureToggle, { featureKey: a, options: l }, a)) })
9667
+ ] }) })
9668
+ ] }) : null;
9637
9669
  }, setDebugLogs = (o) => {
9638
9670
  }, getParentNodeIds = (o, n) => {
9639
9671
  const r = [];
@@ -9677,15 +9709,7 @@ const RootLayout = () => {
9677
9709
  ) }),
9678
9710
  "Minimum width: 1280px"
9679
9711
  ] }) })
9680
- ] }) }) });
9681
- function getFromQueryParams(o) {
9682
- var r;
9683
- return (r = new URLSearchParams(window.location.search).get("flags")) == null ? void 0 : r.includes(o);
9684
- }
9685
- const FEATURE_TOGGLES = {
9686
- dnd: getFromQueryParams("dnd"),
9687
- aiChat: getFromQueryParams("ai-chat")
9688
- }, isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.write, isAtomStateInitialized = (o) => "v" in o || "e" in o, returnAtomValue = (o) => {
9712
+ ] }) }) }), isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.write, isAtomStateInitialized = (o) => "v" in o || "e" in o, returnAtomValue = (o) => {
9689
9713
  if ("e" in o)
9690
9714
  throw o.e;
9691
9715
  return o.v;
@@ -9731,17 +9755,17 @@ const FEATURE_TOGGLES = {
9731
9755
  for (const i of n.p)
9732
9756
  l.add(i);
9733
9757
  return l;
9734
- }, BUILDING_BLOCKS = Symbol(), buildStore = (o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = {}, d = (h, ...f) => h.read(...f), p = (h, ...f) => h.write(...f), u = (h, f) => {
9735
- var x;
9736
- return (x = h.unstable_onInit) == null ? void 0 : x.call(h, f);
9737
- }, g = (h, f) => {
9738
- var x;
9739
- return (x = h.onMount) == null ? void 0 : x.call(h, f);
9758
+ }, BUILDING_BLOCKS = Symbol(), buildStore = (o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), c = {}, d = (h, ...x) => h.read(...x), p = (h, ...x) => h.write(...x), u = (h, x) => {
9759
+ var f;
9760
+ return (f = h.unstable_onInit) == null ? void 0 : f.call(h, x);
9761
+ }, g = (h, x) => {
9762
+ var f;
9763
+ return (f = h.onMount) == null ? void 0 : f.call(h, x);
9740
9764
  }, ...m) => {
9741
9765
  const h = m[0] || ((A) => {
9742
9766
  let N = o.get(A);
9743
9767
  return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A, C)), N;
9744
- }), f = m[1] || (() => {
9768
+ }), x = m[1] || (() => {
9745
9769
  let A, N;
9746
9770
  const S = (y) => {
9747
9771
  try {
@@ -9756,11 +9780,11 @@ const FEATURE_TOGGLES = {
9756
9780
  a.forEach((I) => {
9757
9781
  var L;
9758
9782
  return (L = n.get(I)) == null ? void 0 : L.l.forEach(j);
9759
- }), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), y.forEach(S), a.size && x();
9783
+ }), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), y.forEach(S), a.size && f();
9760
9784
  } while (a.size || i.size || l.size);
9761
9785
  if (A)
9762
9786
  throw N;
9763
- }), x = m[2] || (() => {
9787
+ }), f = m[2] || (() => {
9764
9788
  const A = [], N = /* @__PURE__ */ new WeakSet(), S = /* @__PURE__ */ new WeakSet(), y = Array.from(a);
9765
9789
  for (; y.length; ) {
9766
9790
  const j = y[y.length - 1], I = h(j);
@@ -9778,71 +9802,71 @@ const FEATURE_TOGGLES = {
9778
9802
  }
9779
9803
  for (let j = A.length - 1; j >= 0; --j) {
9780
9804
  const [I, L] = A[j];
9781
- let P = !1;
9805
+ let R = !1;
9782
9806
  for (const T of L.d.keys())
9783
9807
  if (T !== I && a.has(T)) {
9784
- P = !0;
9808
+ R = !0;
9785
9809
  break;
9786
9810
  }
9787
- P && (k(I), B(I)), r.delete(I);
9811
+ R && (k(I), B(I)), r.delete(I);
9788
9812
  }
9789
9813
  }), k = m[3] || ((A) => {
9790
9814
  var N, S;
9791
9815
  const y = h(A);
9792
9816
  if (isAtomStateInitialized(y) && (n.has(A) && r.get(A) !== y.n || Array.from(y.d).every(
9793
- ([R, $]) => (
9817
+ ([P, $]) => (
9794
9818
  // Recursively, read the atom state of the dependency, and
9795
9819
  // check if the atom epoch number is unchanged
9796
- k(R).n === $
9820
+ k(P).n === $
9797
9821
  )
9798
9822
  )))
9799
9823
  return y;
9800
9824
  y.d.clear();
9801
9825
  let j = !0;
9802
9826
  const I = () => {
9803
- n.has(A) && (B(A), x(), f());
9804
- }, L = (R) => {
9827
+ n.has(A) && (B(A), f(), x());
9828
+ }, L = (P) => {
9805
9829
  var $;
9806
- if (isSelfAtom(A, R)) {
9807
- const U = h(R);
9808
- if (!isAtomStateInitialized(U))
9809
- if (hasInitialValue(R))
9810
- setAtomStateValueOrPromise(R, R.init, h);
9830
+ if (isSelfAtom(A, P)) {
9831
+ const F = h(P);
9832
+ if (!isAtomStateInitialized(F))
9833
+ if (hasInitialValue(P))
9834
+ setAtomStateValueOrPromise(P, P.init, h);
9811
9835
  else
9812
9836
  throw new Error("no atom init");
9813
- return returnAtomValue(U);
9837
+ return returnAtomValue(F);
9814
9838
  }
9815
- const M = k(R);
9839
+ const M = k(P);
9816
9840
  try {
9817
9841
  return returnAtomValue(M);
9818
9842
  } finally {
9819
- y.d.set(R, M.n), isPendingPromise(y.v) && addPendingPromiseToDependency(A, y.v, M), ($ = n.get(R)) == null || $.t.add(A), j || I();
9843
+ y.d.set(P, M.n), isPendingPromise(y.v) && addPendingPromiseToDependency(A, y.v, M), ($ = n.get(P)) == null || $.t.add(A), j || I();
9820
9844
  }
9821
9845
  };
9822
- let P, T;
9846
+ let R, T;
9823
9847
  const D = {
9824
9848
  get signal() {
9825
- return P || (P = new AbortController()), P.signal;
9849
+ return R || (R = new AbortController()), R.signal;
9826
9850
  },
9827
9851
  get setSelf() {
9828
- return !T && isActuallyWritableAtom(A) && (T = (...R) => {
9852
+ return !T && isActuallyWritableAtom(A) && (T = (...P) => {
9829
9853
  if (!j)
9830
9854
  try {
9831
- return v(A, ...R);
9855
+ return v(A, ...P);
9832
9856
  } finally {
9833
- x(), f();
9857
+ f(), x();
9834
9858
  }
9835
9859
  }), T;
9836
9860
  }
9837
9861
  }, O = y.n;
9838
9862
  try {
9839
- const R = d(A, L, D);
9840
- return setAtomStateValueOrPromise(A, R, h), isPromiseLike$1(R) && ((N = R.onCancel) == null || N.call(R, () => P == null ? void 0 : P.abort()), R.then(
9863
+ const P = d(A, L, D);
9864
+ return setAtomStateValueOrPromise(A, P, h), isPromiseLike$1(P) && ((N = P.onCancel) == null || N.call(P, () => R == null ? void 0 : R.abort()), P.then(
9841
9865
  I,
9842
9866
  I
9843
9867
  )), y;
9844
- } catch (R) {
9845
- return delete y.v, y.e = R, ++y.n, y;
9868
+ } catch (P) {
9869
+ return delete y.v, y.e = P, ++y.n, y;
9846
9870
  } finally {
9847
9871
  j = !1, O !== y.n && r.get(A) === O && (r.set(A, y.n), a.add(A), (S = c.c) == null || S.call(c, A));
9848
9872
  }
@@ -9858,19 +9882,19 @@ const FEATURE_TOGGLES = {
9858
9882
  }), v = m[5] || ((A, ...N) => {
9859
9883
  let S = !0;
9860
9884
  const y = (I) => returnAtomValue(k(I)), j = (I, ...L) => {
9861
- var P;
9885
+ var R;
9862
9886
  const T = h(I);
9863
9887
  try {
9864
9888
  if (isSelfAtom(A, I)) {
9865
9889
  if (!hasInitialValue(I))
9866
9890
  throw new Error("atom not writable");
9867
9891
  const D = T.n, O = L[0];
9868
- setAtomStateValueOrPromise(I, O, h), B(I), D !== T.n && (a.add(I), (P = c.c) == null || P.call(c, I), b(I));
9892
+ setAtomStateValueOrPromise(I, O, h), B(I), D !== T.n && (a.add(I), (R = c.c) == null || R.call(c, I), b(I));
9869
9893
  return;
9870
9894
  } else
9871
9895
  return v(I, ...L);
9872
9896
  } finally {
9873
- S || (x(), f());
9897
+ S || (f(), x());
9874
9898
  }
9875
9899
  };
9876
9900
  try {
@@ -9909,19 +9933,19 @@ const FEATURE_TOGGLES = {
9909
9933
  }, n.set(A, y), (N = c.m) == null || N.call(c, A), isActuallyWritableAtom(A)) {
9910
9934
  const j = () => {
9911
9935
  let I = !0;
9912
- const L = (...P) => {
9936
+ const L = (...R) => {
9913
9937
  try {
9914
- return v(A, ...P);
9938
+ return v(A, ...R);
9915
9939
  } finally {
9916
- I || (x(), f());
9940
+ I || (f(), x());
9917
9941
  }
9918
9942
  };
9919
9943
  try {
9920
- const P = g(A, L);
9921
- P && (y.u = () => {
9944
+ const R = g(A, L);
9945
+ R && (y.u = () => {
9922
9946
  I = !0;
9923
9947
  try {
9924
- P();
9948
+ R();
9925
9949
  } finally {
9926
9950
  I = !1;
9927
9951
  }
@@ -9966,8 +9990,8 @@ const FEATURE_TOGGLES = {
9966
9990
  g,
9967
9991
  // building-block functions
9968
9992
  h,
9969
- f,
9970
9993
  x,
9994
+ f,
9971
9995
  k,
9972
9996
  b,
9973
9997
  v,
@@ -9980,13 +10004,13 @@ const FEATURE_TOGGLES = {
9980
10004
  try {
9981
10005
  return v(A, ...N);
9982
10006
  } finally {
9983
- x(), f();
10007
+ f(), x();
9984
10008
  }
9985
10009
  },
9986
10010
  sub: (A, N) => {
9987
10011
  const y = w(A).l;
9988
- return y.add(N), f(), () => {
9989
- y.delete(N), _(A), f();
10012
+ return y.add(N), x(), () => {
10013
+ y.delete(N), _(A), x();
9990
10014
  };
9991
10015
  }
9992
10016
  };
@@ -10102,13 +10126,14 @@ const useAutoSave = () => {
10102
10126
  ] });
10103
10127
  }, ChaiBuilderEditor = (o) => {
10104
10128
  const n = o.onError || noop;
10105
- return /* @__PURE__ */ jsx("div", { className: "h-screen w-screen", children: /* @__PURE__ */ jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxs(FlagsProvider, { features: { ...FEATURE_TOGGLES }, children: [
10129
+ return /* @__PURE__ */ jsx("div", { className: "h-screen w-screen", children: /* @__PURE__ */ jsxs(ErrorBoundary, { fallback: /* @__PURE__ */ jsx(FallbackError, {}), onError: n, children: [
10106
10130
  /* @__PURE__ */ jsx(ScreenTooSmall, {}),
10107
10131
  /* @__PURE__ */ jsx(ChaiBuilderComponent, { ...o }),
10108
10132
  /* @__PURE__ */ jsx(ChaiWatchers, { ...o }),
10109
10133
  /* @__PURE__ */ jsx(PreviewScreen, {}),
10110
- /* @__PURE__ */ jsx(Toaster, { richColors: !0 })
10111
- ] }) }) });
10134
+ /* @__PURE__ */ jsx(Toaster, { richColors: !0 }),
10135
+ /* @__PURE__ */ jsx("div", { className: "fixed bottom-4 left-4 z-50", children: /* @__PURE__ */ jsx(ChaiFeatureFlagsWidget, {}) })
10136
+ ] }) });
10112
10137
  };
10113
10138
  if (typeof window > "u")
10114
10139
  throw new Error("@chaibuilder/sdk is only supported in the browser. Avoid using it in the server side.");
@@ -10193,7 +10218,7 @@ export {
10193
10218
  useStylingState,
10194
10219
  useTheme,
10195
10220
  useThemeOptions,
10196
- Fe as useTranslation,
10221
+ Ve as useTranslation,
10197
10222
  useUndoManager,
10198
10223
  useUpdateBlocksProps,
10199
10224
  useUpdateBlocksPropsRealtime,