@chaibuilder/sdk 2.2.28 → 2.2.29

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
@@ -4,7 +4,7 @@ var H = (o, n, r) => F(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, 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, ResetIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
7
- import { get, find, filter, flatten, has, map, includes, without, compact, reverse, findIndex, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isArray, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, uniq, flatMapDeep, some, sortBy, round } from "lodash-es";
7
+ import { get, find, filter, flatten, has, map, includes, without, compact, reverse, findIndex, isEmpty, isString, each, omit, values, pick, startsWith, isFunction, isObject as isObject$1, memoize, noop, first, keys, range, flattenDeep, set, forEach, unset, chunk, cloneDeep, isNull, isArray, split, reject, take, debounce, startCase, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, toLower, nth, findLast, intersection, toUpper, capitalize, groupBy, uniq, flatMapDeep, some, sortBy, round } from "lodash-es";
8
8
  import * as React from "react";
9
9
  import React__default, { useMemo, useCallback, useEffect, useState, useRef, Component, Children, memo, createElement, createContext, useContext, Suspense, useReducer, useDebugValue } from "react";
10
10
  import { atom, useAtom as useAtom$1, useAtomValue as useAtomValue$1, getDefaultStore as getDefaultStore$1, useSetAtom as useSetAtom$1, Provider } from "jotai";
@@ -299,12 +299,12 @@ class PubSub {
299
299
  }
300
300
  }
301
301
  const pubsub = new PubSub(), AddBlockDropdown = ({ block: o, children: n }) => {
302
- const { t: r } = useTranslation(), [a] = useBlocksStore(), { hasPermission: l } = usePermissions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(a, (h) => c ? get(h, "_parent") === c : !get(h, "_parent")), p = canAddChildBlock(get(o, "_type", "")), u = findIndex(d, { _id: i }), g = (h) => {
303
- if (h === "CHILD")
302
+ const { t: r } = useTranslation(), [a] = useBlocksStore(), { hasPermission: l } = usePermissions(), i = get(o, "_id"), c = get(o, "_parent"), d = filter(a, (m) => c ? get(m, "_parent") === c : !get(m, "_parent")), p = canAddChildBlock(get(o, "_type", "")), u = findIndex(d, { _id: i }), g = (m) => {
303
+ if (m === "CHILD")
304
304
  pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, o);
305
305
  else {
306
- const m = { _id: c || "", position: d == null ? void 0 : d.length };
307
- h === "BEFORE" ? m.position = Math.max(u, 0) : h === "AFTER" && (m.position = u + 1), pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, m);
306
+ const h = { _id: c || "", position: d == null ? void 0 : d.length };
307
+ m === "BEFORE" ? h.position = Math.max(u, 0) : m === "AFTER" && (h.position = u + 1), pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, h);
308
308
  }
309
309
  };
310
310
  return l(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
@@ -339,16 +339,16 @@ function insertBlocksAtPosition(o, n, r, a) {
339
339
  let i = [...o];
340
340
  if (r) {
341
341
  const u = o.find((g) => g._id === r);
342
- if (u && u.content !== void 0 && u.content !== "" && !o.some((h) => h._parent === r)) {
343
- const m = {
342
+ if (u && u.content !== void 0 && u.content !== "" && !o.some((m) => m._parent === r)) {
343
+ const h = {
344
344
  _id: generateUUID(),
345
345
  _parent: r,
346
346
  _type: "Text",
347
347
  content: u.content
348
348
  };
349
349
  Object.keys(u).forEach((f) => {
350
- f.startsWith("content-") && (m[f] = u[f]);
351
- }), l.unshift(m), i = i.map((f) => {
350
+ f.startsWith("content-") && (h[f] = u[f]);
351
+ }), l.unshift(h), i = i.map((f) => {
352
352
  if (f._id === r) {
353
353
  const x = { ...f, content: "" };
354
354
  return Object.keys(x).forEach((y) => {
@@ -388,13 +388,13 @@ function moveNode(o, n, r, a) {
388
388
  const l = findNodeById(o, n), i = findNodeById(o, r);
389
389
  if (!l || !i) return !1;
390
390
  i.children || (i.model.children = []);
391
- let c = (u = i == null ? void 0 : i.children) == null ? void 0 : u.findIndex((h) => h.model._id === n);
391
+ let c = (u = i == null ? void 0 : i.children) == null ? void 0 : u.findIndex((m) => m.model._id === n);
392
392
  l.drop(), c = Math.max(c, 0);
393
393
  const p = (((g = l == null ? void 0 : l.model) == null ? void 0 : g._parent) || "root") === r && c <= a ? a - 1 : a;
394
394
  try {
395
395
  i.addChildAtIndex(l, p);
396
- } catch (h) {
397
- return console.error("Error adding child to parent:", h), !1;
396
+ } catch (m) {
397
+ return console.error("Error adding child to parent:", m), !1;
398
398
  }
399
399
  return !0;
400
400
  }
@@ -435,8 +435,8 @@ function handleNewParentTextBlock(o, n, r) {
435
435
  const d = o.map((u) => {
436
436
  if (u._id === r) {
437
437
  const g = { ...u, content: "" };
438
- return Object.keys(g).forEach((h) => {
439
- h.startsWith("content-") && (g[h] = "");
438
+ return Object.keys(g).forEach((m) => {
439
+ m.startsWith("content-") && (g[m] = "");
440
440
  }), g;
441
441
  }
442
442
  return u;
@@ -453,7 +453,7 @@ function moveBlocksWithChildren(o, n, r, a) {
453
453
  const c = r || "root", p = new TreeModel().parse({ _id: "root", children: getBlocksTree(i) });
454
454
  if (moveNode(p, n, c, a)) {
455
455
  let u = flattenTree(p);
456
- const g = u.find((h) => h._id === n);
456
+ const g = u.find((m) => m._id === n);
457
457
  return g && (g._parent = c === "root" ? null : c), u.shift(), r && (u = handleNewParentTextBlock(u, l, r)), u;
458
458
  }
459
459
  return i;
@@ -477,22 +477,22 @@ const broadcastChannel = new BroadcastChannel("chaibuilder"), useBroadcastChanne
477
477
  }, removeNestedBlocks = (o, n) => {
478
478
  let r = [...o], a = [];
479
479
  n.forEach((d) => {
480
- const p = r.find((h) => h._id === d);
480
+ const p = r.find((m) => m._id === d);
481
481
  if (!p || !p._parent) return;
482
- const u = p._parent, g = r.filter((h) => h._parent === u);
482
+ const u = p._parent, g = r.filter((m) => m._parent === u);
483
483
  if (g.length === 2) {
484
- const h = g.find((m) => m._id !== d);
485
- if (h && h._type === "Text") {
486
- const m = r.find((f) => f._id === u);
487
- m && "content" in m && (r = r.map((f) => {
484
+ const m = g.find((h) => h._id !== d);
485
+ if (m && m._type === "Text") {
486
+ const h = r.find((f) => f._id === u);
487
+ h && "content" in h && (r = r.map((f) => {
488
488
  if (f._id === u) {
489
- const x = { ...f, content: h.content };
490
- return Object.keys(h).forEach((y) => {
491
- y.startsWith("content-") && (x[y] = h[y]);
489
+ const x = { ...f, content: m.content };
490
+ return Object.keys(m).forEach((y) => {
491
+ y.startsWith("content-") && (x[y] = m[y]);
492
492
  }), x;
493
493
  }
494
494
  return f;
495
- }), a.push(h._id));
495
+ }), a.push(m._id));
496
496
  }
497
497
  }
498
498
  });
@@ -574,30 +574,34 @@ const useBlockRepeaterDataAtom = () => useAtom$1(blockRepeaterDataAtom), useAsyn
574
574
  status: "idle",
575
575
  props: {},
576
576
  error: void 0
577
- }), c = useBuilderProp("getBlockAsyncProps", async (m) => ({})), d = useSetAtom$1(blockRepeaterDataAtom), p = JSON.stringify([o == null ? void 0 : o._id, ...values(pick(o, r ?? []))]), u = (o == null ? void 0 : o._type) === "Repeater" && startsWith(o.repeaterItems, `{{${COLLECTION_PREFIX}`), g = (o == null ? void 0 : o._type) !== "Repeater" && n === "live";
577
+ }), 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";
578
578
  return useEffect(() => {
579
579
  if (n === "mock") {
580
580
  if (isFunction(a)) {
581
- i((f) => ({ ...f, status: "loading", props: {} }));
582
- const m = a({ block: o });
583
- if (!isObject(m))
581
+ i((x) => ({ ...x, status: "loading", props: {} }));
582
+ const f = a({ block: o });
583
+ if (!isObject(f))
584
584
  throw new Error("mockDataProvider should return an object");
585
- i((f) => ({ ...f, status: "loaded", props: m }));
585
+ i((x) => ({ ...x, status: "loaded", props: f }));
586
586
  }
587
587
  return;
588
588
  }
589
- n === "live" && (!u && !g || (i((m) => ({ ...m, status: "loading", props: {} })), c({ block: o }).then((m = {}) => {
590
- u ? (d((f) => ({
591
- ...f,
592
- [o._id]: { status: "loaded", props: isArray(m) ? m : [], repeaterItems: o.repeaterItems }
593
- })), i((f) => ({ ...f, status: "loaded" }))) : i((f) => ({ ...f, status: "loaded", props: isObject(m) ? m : {} }));
594
- }).catch((m) => {
595
- u ? (d((f) => ({
596
- ...f,
597
- [o._id]: { status: "error", error: m, props: [] }
598
- })), i((f) => ({ ...f, status: "error", error: m }))) : i((f) => ({ ...f, status: "error", error: m, props: {} }));
589
+ n === "live" && (!g && !m || (i((f) => ({ ...f, status: "loading", props: {} })), d({ block: o }).then((f = {}) => {
590
+ g ? (p((x) => ({
591
+ ...x,
592
+ [o._id]: {
593
+ status: "loaded",
594
+ props: get(f, "items", []),
595
+ repeaterItems: o.repeaterItems
596
+ }
597
+ })), 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 : {} }));
598
+ }).catch((f) => {
599
+ g ? (p((x) => ({
600
+ ...x,
601
+ [o._id]: { status: "error", error: f, props: [] }
602
+ })), i((x) => ({ ...x, status: "error", error: f, props: {} }))) : i((x) => ({ ...x, status: "error", error: f, props: {} }));
599
603
  })));
600
- }, [o == null ? void 0 : o._id, p, u, g, a, n]), {
604
+ }, [o == null ? void 0 : o._id, u, g, m, a, n]), {
601
605
  $loading: get(l, "status") === "loading",
602
606
  ...o ? get(l, "props", {}) : {}
603
607
  };
@@ -862,7 +866,7 @@ const undoRedoStateAtom = atom({
862
866
  }, useAddBlock = () => {
863
867
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
864
868
  (i, c, d) => {
865
- var m;
869
+ var h;
866
870
  for (let f = 0; f < i.length; f++) {
867
871
  const { _id: x } = i[f];
868
872
  i[f]._id = generateUUID();
@@ -872,7 +876,7 @@ const undoRedoStateAtom = atom({
872
876
  }
873
877
  const p = first(i);
874
878
  let u, g;
875
- return c && (u = find(o, { _id: c }), i[0]._parent = c, g = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, g = u._parent), r(i, g, d), n([(m = first(i)) == null ? void 0 : m._id]), first(i);
879
+ return c && (u = find(o, { _id: c }), i[0]._parent = c, g = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, g = u._parent), r(i, g, d), n([(h = first(i)) == null ? void 0 : h._id]), first(i);
876
880
  },
877
881
  [r, o, n]
878
882
  );
@@ -889,8 +893,8 @@ const undoRedoStateAtom = atom({
889
893
  ...has(i, "_name") && { _name: i._name },
890
894
  ...has(i, "partialBlockId") && { partialBlockId: i.partialBlockId }
891
895
  };
892
- let h, m;
893
- return c && (h = find(o, { _id: c }), g._parent = c, m = c), !canAcceptChildBlock(h == null ? void 0 : h._type, g._type) && h && (g._parent = h._parent, m = h._parent), r([g], m, d), n([g._id]), g;
896
+ let m, h;
897
+ return c && (m = find(o, { _id: c }), g._parent = c, h = c), !canAcceptChildBlock(m == null ? void 0 : m._type, g._type) && m && (g._parent = m._parent, h = m._parent), r([g], h, d), n([g._id]), g;
894
898
  },
895
899
  [r, a, o, n]
896
900
  ), addPredefinedBlock: a };
@@ -2330,8 +2334,8 @@ const getBlockWithChildren = (o, n) => {
2330
2334
  return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
2331
2335
  })
2332
2336
  ), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom(!1), useAskAi = () => {
2333
- 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, h = (m, f) => {
2334
- const x = cloneDeep(f.find((y) => y._id === m));
2337
+ 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) => {
2338
+ const x = cloneDeep(f.find((y) => y._id === h));
2335
2339
  for (const y in x) {
2336
2340
  const b = x[y];
2337
2341
  if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
@@ -2344,16 +2348,16 @@ const getBlockWithChildren = (o, n) => {
2344
2348
  };
2345
2349
  return {
2346
2350
  askAi: useCallback(
2347
- async (m, f, x, y) => {
2351
+ async (h, f, x, y) => {
2348
2352
  if (l) {
2349
2353
  n(!0), a(null);
2350
2354
  try {
2351
- const b = p === u ? "" : p, v = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(f, d)), p) : [h(f, d)], B = await l(m, addLangToPrompt(x, g, m), v, b), { blocks: w, error: E } = B;
2355
+ 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: E } = B;
2352
2356
  if (E) {
2353
2357
  a(E);
2354
2358
  return;
2355
2359
  }
2356
- if (m === "styles") {
2360
+ if (h === "styles") {
2357
2361
  const _ = w.map((S) => {
2358
2362
  for (const A in S)
2359
2363
  A !== "_id" && (S[A] = `${STYLES_KEY},${S[A]}`);
@@ -2455,17 +2459,17 @@ const getBlockWithChildren = (o, n) => {
2455
2459
  r(d), a([]);
2456
2460
  const u = {
2457
2461
  _chai_copied_blocks: d.flatMap((g) => {
2458
- const h = getDuplicatedBlocks(o, g, null);
2462
+ const m = getDuplicatedBlocks(o, g, null);
2459
2463
  if (!p)
2460
- return h;
2461
- let m = [];
2462
- for (const f of h)
2464
+ return m;
2465
+ let h = [];
2466
+ for (const f of m)
2463
2467
  if (f._type === "PartialBlock" || f._type === "GlobalBlock") {
2464
2468
  let x = l(f.partialBlockId);
2465
- f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((y) => (isEmpty(y._parent) && set(y, "_parent", f._parent), y))), m = [...m, ...x];
2469
+ f._parent && (x == null ? void 0 : x.length) > 0 && (x = x.map((y) => (isEmpty(y._parent) && set(y, "_parent", f._parent), y))), h = [...h, ...x];
2466
2470
  } else
2467
- m.push(f);
2468
- return m;
2471
+ h.push(f);
2472
+ return h;
2469
2473
  })
2470
2474
  };
2471
2475
  if (!navigator.clipboard) {
@@ -2503,13 +2507,13 @@ const getBlockWithChildren = (o, n) => {
2503
2507
  (a, l = null) => {
2504
2508
  const i = [];
2505
2509
  each(a, (c) => {
2506
- const d = o.find((m) => m._id === c);
2510
+ const d = o.find((h) => h._id === c);
2507
2511
  l ? l === "root" && (l = null) : l = d._parent;
2508
2512
  const g = filter(
2509
2513
  o,
2510
- (m) => isString(l) ? m._parent === l : !m._parent
2511
- ).indexOf(d) + 1, h = getDuplicatedBlocks(o, c, l);
2512
- r(h, l, g), i.push(get(h, "0._id", ""));
2514
+ (h) => isString(l) ? h._parent === l : !h._parent
2515
+ ).indexOf(d) + 1, m = getDuplicatedBlocks(o, c, l);
2516
+ r(m, l, g), i.push(get(m, "0._id", ""));
2513
2517
  }), n(i);
2514
2518
  },
2515
2519
  [o, n]
@@ -2646,13 +2650,13 @@ const getBlockWithChildren = (o, n) => {
2646
2650
  return map(i, (c) => {
2647
2651
  const d = o(c), p = a;
2648
2652
  let { classes: u, baseClasses: g } = getSplitChaiClasses(get(d, l.prop, `${STYLES_KEY},`));
2649
- return each(p, (h) => {
2650
- const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2653
+ return each(p, (m) => {
2654
+ const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2651
2655
  u = u.replace(f, " ").replace(/\s+/g, " ").trim();
2652
- const x = first(h.split(":"));
2653
- includes(["2xl", "xl", "lg", "md", "sm"], x) && p.push(h.split(":").pop().trim());
2654
- }), each(p, (h) => {
2655
- const m = h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${m}(?=\\s|$)`, "g");
2656
+ const x = first(m.split(":"));
2657
+ includes(["2xl", "xl", "lg", "md", "sm"], x) && p.push(m.split(":").pop().trim());
2658
+ }), each(p, (m) => {
2659
+ const h = m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), f = new RegExp(`(^|\\s)${h}(?=\\s|$)`, "g");
2656
2660
  g = g.replace(f, " ").replace(/\s+/g, " ").trim();
2657
2661
  }), {
2658
2662
  ids: [d._id],
@@ -2756,11 +2760,11 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2756
2760
  return "VERTICAL";
2757
2761
  }
2758
2762
  }, isDisabledControl = (o, n, r) => !!(o && (r === "UP" || r === "LEFT") || n && (r === "DOWN" || r === "RIGHT")), useBlockController = (o, n) => {
2759
- 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, h = u + 1 === (d == null ? void 0 : d.length), m = getParentBlockOrientation(c, i, a), f = useCallback(
2763
+ 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(
2760
2764
  (x) => {
2761
- isDisabledControl(g, h, x) || p || (x === "UP" || x === "LEFT" ? l([i], c || null, u - 1) : (x === "DOWN" || x === "RIGHT") && l([i], c || null, u + 2), n());
2765
+ 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());
2762
2766
  },
2763
- [g, h, p, u, i, c, n]
2767
+ [g, m, p, u, i, c, n]
2764
2768
  );
2765
2769
  return useHotkeys(
2766
2770
  "shift+up, shift+down, shift+left, shift+right",
@@ -2770,7 +2774,7 @@ const useSidebarActivePanel = () => useAtom$1(sidebarActivePanelAtom), CONTROLS
2770
2774
  },
2771
2775
  { document: a == null ? void 0 : a.contentDocument },
2772
2776
  [f]
2773
- ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: h, moveBlock: f, orientation: m };
2777
+ ), { isOnlyChild: p, isFirstBlock: g, isLastBlock: m, moveBlock: f, orientation: h };
2774
2778
  }, BlockController = ({ block: o, updateFloatingBar: n }) => {
2775
2779
  const { isOnlyChild: r, isFirstBlock: a, isLastBlock: l, moveBlock: i, orientation: c } = useBlockController(
2776
2780
  o,
@@ -2905,19 +2909,19 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2905
2909
  i([null]);
2906
2910
  }, [r, n]), /* @__PURE__ */ jsx(BlockFloatingSelector, { block: o, selectedBlockElement: a[0] });
2907
2911
  }, BlockFloatingSelector = ({ block: o, selectedBlockElement: n }) => {
2908
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), { hasPermission: d } = usePermissions(), [p] = useAtom$1(inlineEditingActiveAtom), { document: u } = useFrame(), { floatingStyles: g, refs: h, update: m } = useFloating({
2912
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), { hasPermission: d } = usePermissions(), [p] = useAtom$1(inlineEditingActiveAtom), { document: u } = useFrame(), { floatingStyles: g, refs: m, update: h } = useFloating({
2909
2913
  placement: "top-start",
2910
2914
  middleware: [shift(), flip()],
2911
2915
  elements: { reference: n }
2912
2916
  });
2913
- useResizeObserver(n, () => m(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => m(), (u == null ? void 0 : u.body) !== null);
2917
+ useResizeObserver(n, () => h(), n !== null), useResizeObserver(u == null ? void 0 : u.body, () => h(), (u == null ? void 0 : u.body) !== null);
2914
2918
  const f = get(o, "_parent", null), x = isEmpty(get(o, "_name", "")) ? get(o, "_type", "") : get(o, "_name", "");
2915
2919
  return !n || !o || p ? null : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
2916
2920
  "div",
2917
2921
  {
2918
2922
  role: "button",
2919
2923
  tabIndex: 0,
2920
- ref: h.setFloating,
2924
+ ref: m.setFloating,
2921
2925
  style: g,
2922
2926
  onClick: (y) => {
2923
2927
  y.stopPropagation(), y.preventDefault();
@@ -2942,7 +2946,7 @@ const INLINE_EDITABLE_BLOCKS = ["Heading", "Paragraph", "Text", "Link", "Span"],
2942
2946
  /* @__PURE__ */ jsx(AddBlockDropdown, { block: o, children: /* @__PURE__ */ jsx(PlusIcon, { className: "hover:scale-105" }) }),
2943
2947
  canDuplicateBlock(get(o, "_type", "")) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsx(CopyIcon, { className: "hover:scale-105", onClick: () => a([o == null ? void 0 : o._id]) }) : null,
2944
2948
  canDeleteBlock(get(o, "_type", "")) && d(PERMISSIONS.DELETE_BLOCK) ? /* @__PURE__ */ jsx(TrashIcon, { className: "hover:scale-105", onClick: () => r([o == null ? void 0 : o._id]) }) : null,
2945
- d(PERMISSIONS.MOVE_BLOCK) && /* @__PURE__ */ jsx(BlockController, { block: o, updateFloatingBar: m })
2949
+ d(PERMISSIONS.MOVE_BLOCK) && /* @__PURE__ */ jsx(BlockController, { block: o, updateFloatingBar: h })
2946
2950
  ] })
2947
2951
  ]
2948
2952
  }
@@ -3075,15 +3079,15 @@ H(Frame, "defaultProps", {
3075
3079
  initialContent: '<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'
3076
3080
  });
3077
3081
  const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame, { ...o, forwardedRef: n })), useKeyEventWatcher = (o) => {
3078
- const [n, r] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlocks(), { canPaste: g, pasteBlocks: h } = usePasteBlocks(), m = o ? { document: o } : {};
3082
+ const [n, r] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlocks(), { canPaste: g, pasteBlocks: m } = usePasteBlocks(), h = o ? { document: o } : {};
3079
3083
  useHotkeys("ctrl+z,command+z", () => c(), {}, [c]), useHotkeys("ctrl+y,command+y", () => d(), {}, [d]), useHotkeys("ctrl+x,command+x", () => p(n), {}, [n, p]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
3080
3084
  "ctrl+v,command+v",
3081
3085
  () => {
3082
- g(n[0]) && h(n);
3086
+ g(n[0]) && m(n);
3083
3087
  },
3084
- { ...m, preventDefault: !0 },
3085
- [n, g, h]
3086
- ), useHotkeys("esc", () => r([]), m, [r]), useHotkeys("ctrl+d,command+d", () => i(n), { ...m, preventDefault: !0 }, [
3088
+ { ...h, preventDefault: !0 },
3089
+ [n, g, m]
3090
+ ), useHotkeys("esc", () => r([]), h, [r]), useHotkeys("ctrl+d,command+d", () => i(n), { ...h, preventDefault: !0 }, [
3087
3091
  n,
3088
3092
  i
3089
3093
  ]), useHotkeys(
@@ -3091,7 +3095,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3091
3095
  (f) => {
3092
3096
  f.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(n);
3093
3097
  },
3094
- m,
3098
+ h,
3095
3099
  [n, l]
3096
3100
  );
3097
3101
  }, KeyboardHandler = () => {
@@ -3382,7 +3386,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3382
3386
  ],
3383
3387
  onUpdate: ({ editor: u }) => a((u == null ? void 0 : u.getHTML()) || ""),
3384
3388
  onBlur: ({ editor: u, event: g }) => {
3385
- const h = g.relatedTarget, m = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = m == null ? void 0 : m.contains(h), y = f == null ? void 0 : f.contains(h);
3389
+ const m = g.relatedTarget, h = i.querySelector(".ProseMirror"), f = i.querySelector(".tippy-box"), x = h == null ? void 0 : h.contains(m), y = f == null ? void 0 : f.contains(m);
3386
3390
  if (!x && !y) {
3387
3391
  const b = (u == null ? void 0 : u.getHTML()) || "";
3388
3392
  r(b);
@@ -3400,10 +3404,10 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3400
3404
  });
3401
3405
  }, [c]);
3402
3406
  const d = useMemo(() => {
3403
- var h;
3407
+ var m;
3404
3408
  const u = "max-w-none shadow-none outline outline-[2px] outline-green-500 [&_*]:shadow-none";
3405
3409
  if (!n) return u;
3406
- const g = ((h = n == null ? void 0 : n.className) == null ? void 0 : h.replace("sr-only", "")) || "";
3410
+ const g = ((m = n == null ? void 0 : n.className) == null ? void 0 : m.replace("sr-only", "")) || "";
3407
3411
  return `${u} ${g}`;
3408
3412
  }, [n]), p = useCallback(
3409
3413
  (u) => {
@@ -3438,28 +3442,28 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3438
3442
  useEffect(() => {
3439
3443
  if (a.current) {
3440
3444
  a.current.innerText = n, a.current.focus();
3441
- const m = c.createRange(), f = d.getSelection();
3442
- m.selectNodeContents(a.current), m.collapse(!1), f == null || f.removeAllRanges(), f == null || f.addRange(m), a.current.focus();
3445
+ const h = c.createRange(), f = d.getSelection();
3446
+ h.selectNodeContents(a.current), h.collapse(!1), f == null || f.removeAllRanges(), f == null || f.addRange(h), a.current.focus();
3443
3447
  } else
3444
3448
  r();
3445
3449
  }, [c, d]);
3446
3450
  const p = useMemo(() => {
3447
3451
  var f;
3448
- const m = ((f = o == null ? void 0 : o.tagName) == null ? void 0 : f.toLowerCase()) || "div";
3449
- return m === "button" ? "div" : m;
3452
+ const h = ((f = o == null ? void 0 : o.tagName) == null ? void 0 : f.toLowerCase()) || "div";
3453
+ return h === "button" ? "div" : h;
3450
3454
  }, [o]), u = useCallback(
3451
- (m) => {
3452
- (m.key === "Enter" || m.key === "Escape") && i(m);
3455
+ (h) => {
3456
+ (h.key === "Enter" || h.key === "Escape") && i(h);
3453
3457
  },
3454
3458
  [i]
3455
3459
  ), g = useCallback(() => {
3456
3460
  r();
3457
- }, [r]), h = useMemo(() => {
3458
- var m;
3461
+ }, [r]), m = useMemo(() => {
3462
+ var h;
3459
3463
  return {
3460
3464
  id: "active-inline-editing-element",
3461
3465
  contentEditable: !0,
3462
- className: `${((m = o == null ? void 0 : o.className) == null ? void 0 : m.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]`,
3466
+ 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]`,
3463
3467
  style: cloneDeep(o == null ? void 0 : o.style) || {},
3464
3468
  onInput: (f) => {
3465
3469
  const x = f.target;
@@ -3474,38 +3478,38 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3474
3478
  ref: a,
3475
3479
  onBlur: g,
3476
3480
  onKeyDown: u,
3477
- ...h
3481
+ ...m
3478
3482
  }) });
3479
3483
  }
3480
3484
  ), WithBlockTextEditor = memo(
3481
3485
  ({ block: o, children: n }) => {
3482
- const r = "content", { document: a } = useFrame(), [l, i] = useAtom$1(inlineEditingActiveAtom), [c, d] = useState(null), p = useRef(null), { clearHighlight: u } = useBlockHighlight(), g = useUpdateBlocksProps(), { selectedLang: h } = useLanguages(), [, m] = useSelectedBlockIds(), f = useRef(null), x = l, { blockContent: y, blockType: b } = useMemo(() => {
3486
+ const r = "content", { document: a } = useFrame(), [l, i] = useAtom$1(inlineEditingActiveAtom), [c, d] = useState(null), p = useRef(null), { clearHighlight: u } = useBlockHighlight(), g = useUpdateBlocksProps(), { selectedLang: m } = useLanguages(), [, h] = useSelectedBlockIds(), f = useRef(null), x = l, { blockContent: y, blockType: b } = useMemo(() => {
3483
3487
  var C;
3484
3488
  const _ = o._type;
3485
3489
  let S = o[r];
3486
3490
  const A = getRegisteredChaiBlock(o._type);
3487
- return h && ((C = A == null ? void 0 : A.i18nProps) == null ? void 0 : C.includes(r)) && has(o, `${r}-${h}`) && (S = get(o, `${r}-${h}`)), { blockContent: S, blockType: _ };
3488
- }, [o, h]), v = useCallback(
3491
+ return m && ((C = A == null ? void 0 : A.i18nProps) == null ? void 0 : C.includes(r)) && has(o, `${r}-${m}`) && (S = get(o, `${r}-${m}`)), { blockContent: S, blockType: _ };
3492
+ }, [o, m]), v = useCallback(
3489
3493
  (_) => {
3490
3494
  var A;
3491
3495
  const S = _ || ((A = p.current) == null ? void 0 : A.innerText);
3492
- g([x], { [r]: S }), d(null), i(null), m([]);
3496
+ g([x], { [r]: S }), d(null), i(null), h([]);
3493
3497
  },
3494
- [x, g, i, m, h]
3498
+ [x, g, i, h, m]
3495
3499
  ), B = useDebouncedCallback(
3496
3500
  (_) => {
3497
3501
  g([x], { [r]: _ });
3498
3502
  },
3499
- [x, o, g, h],
3503
+ [x, o, g, m],
3500
3504
  1e3
3501
3505
  ), w = useCallback(
3502
3506
  (_) => {
3503
3507
  _.preventDefault(), x && (f.current = x), v(), setTimeout(() => {
3504
3508
  const S = f.current;
3505
- f.current = null, m([S]);
3509
+ f.current = null, h([S]);
3506
3510
  }, 100);
3507
3511
  },
3508
- [m, x, h]
3512
+ [h, x, m]
3509
3513
  );
3510
3514
  useEffect(() => {
3511
3515
  var S;
@@ -3532,7 +3536,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3532
3536
  onChange: B,
3533
3537
  onEscape: w
3534
3538
  }
3535
- )) : null, [c, x, b, y, v, h]);
3539
+ )) : null, [c, x, b, y, v, m]);
3536
3540
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3537
3541
  E,
3538
3542
  n
@@ -3567,12 +3571,12 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3567
3571
  blockAtom: n,
3568
3572
  children: r
3569
3573
  }) => {
3570
- const [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(n), i = useMemo(() => getRegisteredChaiBlock(l._type), [l._type]), { selectedLang: c, fallbackLang: d } = useLanguages(), p = useBlockRuntimeProps(), u = usePageExternalData(), [g] = useHiddenBlockIds(), [h] = useAtom$1(dataBindingActiveAtom), m = get(i, "component", null), { index: f, key: x } = useContext(RepeaterContext), y = useMemo(
3571
- () => h ? applyBindingToBlockProps(applyLanguage(l, c, i), u, {
3574
+ const [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(n), i = useMemo(() => getRegisteredChaiBlock(l._type), [l._type]), { selectedLang: c, fallbackLang: d } = useLanguages(), p = useBlockRuntimeProps(), u = usePageExternalData(), [g] = useHiddenBlockIds(), [m] = useAtom$1(dataBindingActiveAtom), h = get(i, "component", null), { index: f, key: x } = useContext(RepeaterContext), y = useMemo(
3575
+ () => m ? applyBindingToBlockProps(applyLanguage(l, c, i), u, {
3572
3576
  index: f,
3573
3577
  key: x
3574
3578
  }) : applyLanguage(l, c, i),
3575
- [l, c, i, u, h, f, x]
3579
+ [l, c, i, u, m, f, x]
3576
3580
  ), b = useMemo(() => getBlockTagAttributes(l), [l, getBlockTagAttributes]), v = useMemo(
3577
3581
  () => p(l._id, getBlockRuntimeProps(l._type)),
3578
3582
  [l._id, l._type, p, getBlockRuntimeProps]
@@ -3597,8 +3601,8 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3597
3601
  o
3598
3602
  ]
3599
3603
  ), w = useMemo(() => !CORE_BLOCKS.includes(l._type), [l._type]);
3600
- if (isNull(m) || g.includes(l._id)) return null;
3601
- let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(m, {
3604
+ if (isNull(h) || g.includes(l._id)) return null;
3605
+ let E = /* @__PURE__ */ jsx(Suspense, { children: createElement(h, {
3602
3606
  ...B,
3603
3607
  children: r({
3604
3608
  _id: l._id,
@@ -3630,7 +3634,7 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3630
3634
  );
3631
3635
  return map(l, (c) => {
3632
3636
  const d = a(c._id);
3633
- return d ? /* @__PURE__ */ jsx(MayBeAsyncPropsWrapper, { block: c, children: (p) => /* @__PURE__ */ jsx(BlockRenderer, { blockAtom: d, asyncProps: p, children: ({ _id: u, _type: g, partialBlockId: h, repeaterItems: m, $repeaterItemsKey: f }) => g === "Repeater" ? isArray(m) && m.map((x, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) }, `${u}-${y}`)) : g === "GlobalBlock" || g === "PartialBlock" ? /* @__PURE__ */ jsx(Provider, { store: builderStore, children: /* @__PURE__ */ jsx(PartialBlocksRenderer, { partialBlockId: h }) }) : i(u) ? /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) : null }) }, c._id) : null;
3637
+ 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, y) => /* @__PURE__ */ jsx(RepeaterContext.Provider, { value: { index: y, key: f }, children: /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: r, blocks: o, parent: c._id }) }, `${u}-${y}`)) : 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;
3634
3638
  });
3635
3639
  }, PageBlocksRenderer = () => {
3636
3640
  const [o] = useBlocksStore();
@@ -3644,11 +3648,11 @@ const ChaiFrame = React__default.forwardRef((o, n) => /* @__PURE__ */ jsx(Frame,
3644
3648
  if (d < n) {
3645
3649
  const u = parseFloat((d / n).toFixed(2).toString());
3646
3650
  let g = {};
3647
- const h = p * u, m = d * u;
3651
+ const m = p * u, h = d * u;
3648
3652
  p && (g = {
3649
3653
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
3650
- height: 100 + (p - h) / h * 100 + "%",
3651
- width: 100 + (d - m) / m * 100 + "%"
3654
+ height: 100 + (p - m) / m * 100 + "%",
3655
+ width: 100 + (d - h) / h * 100 + "%"
3652
3656
  }), i({
3653
3657
  position: "relative",
3654
3658
  top: 0,
@@ -3697,19 +3701,19 @@ const CanvasEventsWatcher = () => {
3697
3701
  }), null;
3698
3702
  }, StaticCanvas = () => {
3699
3703
  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(
3700
- (m) => {
3701
- i((f) => ({ ...f, width: m }));
3704
+ (h) => {
3705
+ i((f) => ({ ...f, width: h }));
3702
3706
  },
3703
3707
  [i]
3704
3708
  );
3705
3709
  useEffect(() => {
3706
3710
  if (!a.current) return;
3707
- const { clientWidth: m, clientHeight: f } = a.current;
3708
- i({ width: m, height: f });
3711
+ const { clientWidth: h, clientHeight: f } = a.current;
3712
+ i({ width: h, height: f });
3709
3713
  }, [a, o]);
3710
- const h = useMemo(() => {
3711
- let m = IframeInitialContent;
3712
- return m = m.replace("__HTML_DIR__", u), m;
3714
+ const m = useMemo(() => {
3715
+ let h = IframeInitialContent;
3716
+ return h = h.replace("__HTML_DIR__", u), h;
3713
3717
  }, [u]);
3714
3718
  return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: g, onResize: g, children: /* @__PURE__ */ jsx(
3715
3719
  "div",
@@ -3725,7 +3729,7 @@ const CanvasEventsWatcher = () => {
3725
3729
  id: "canvas-iframe",
3726
3730
  style: { ...c, ...isEmpty(c) ? { width: `${o}px` } : {} },
3727
3731
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3728
- initialContent: h,
3732
+ initialContent: m,
3729
3733
  children: [
3730
3734
  /* @__PURE__ */ jsx(KeyboardHandler, {}),
3731
3735
  /* @__PURE__ */ jsx(BlockSelectionHighlighter, {}),
@@ -3820,7 +3824,7 @@ const CanvasEventsWatcher = () => {
3820
3824
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG code to use as an icon") })
3821
3825
  ] });
3822
3826
  }, DefaultMediaManager = ({ close: o, onSelect: n, mode: r = "image" }) => {
3823
- const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), h = async (f) => {
3827
+ const [a, l] = useState(""), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState(null), m = async (f) => {
3824
3828
  if (!f.trim()) {
3825
3829
  p(!1), g("Please enter a URL");
3826
3830
  return;
@@ -3832,9 +3836,9 @@ const CanvasEventsWatcher = () => {
3832
3836
  } finally {
3833
3837
  c(!1);
3834
3838
  }
3835
- }, { t: m } = useTranslation();
3839
+ }, { t: h } = useTranslation();
3836
3840
  return /* @__PURE__ */ jsxs("div", { className: "flex w-96 flex-col gap-4 p-4", children: [
3837
- /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: m(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
3841
+ /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold", children: h(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
3838
3842
  u && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
3839
3843
  /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
3840
3844
  /* @__PURE__ */ jsx(AlertDescription, { children: u })
@@ -3843,20 +3847,20 @@ const CanvasEventsWatcher = () => {
3843
3847
  /* @__PURE__ */ jsx(
3844
3848
  Input$1,
3845
3849
  {
3846
- placeholder: m(`Enter ${r} URL`),
3850
+ placeholder: h(`Enter ${r} URL`),
3847
3851
  value: a,
3848
3852
  onChange: (f) => l(f.target.value),
3849
- onKeyUp: () => h(a)
3853
+ onKeyUp: () => m(a)
3850
3854
  }
3851
3855
  ),
3852
3856
  /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
3853
- /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: o, children: m("Cancel") }),
3857
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: o, children: h("Cancel") }),
3854
3858
  /* @__PURE__ */ jsx(
3855
3859
  Button,
3856
3860
  {
3857
3861
  onClick: () => n({ id: "dam-id", url: a, width: 600, height: 400, description: "This is image description" }),
3858
3862
  disabled: !d || i,
3859
- children: m("Insert")
3863
+ children: h("Insert")
3860
3864
  }
3861
3865
  )
3862
3866
  ] })
@@ -3883,16 +3887,16 @@ const CanvasEventsWatcher = () => {
3883
3887
  MediaManagerModal.displayName = "MediaManagerModal";
3884
3888
  const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
3885
3889
  const { t: l } = useTranslation(), i = useSelectedBlock(), c = useUpdateBlocksProps(), d = (g) => {
3886
- const h = isArray(g) ? first(g) : g;
3887
- if (h) {
3888
- n(h == null ? void 0 : h.url);
3889
- const m = h == null ? void 0 : h.width, f = h == null ? void 0 : h.height;
3890
+ const m = isArray(g) ? first(g) : g;
3891
+ if (m) {
3892
+ n(m == null ? void 0 : m.url);
3893
+ const h = m == null ? void 0 : m.width, f = m == null ? void 0 : m.height;
3890
3894
  if (i != null && i._id) {
3891
3895
  const x = {
3892
- ...m && { width: m },
3896
+ ...h && { width: h },
3893
3897
  ...f && { height: f },
3894
- ...h.description && { alt: h.description },
3895
- ...h.id && { assetId: h.id }
3898
+ ...m.description && { alt: m.description },
3899
+ ...m.id && { assetId: m.id }
3896
3900
  };
3897
3901
  if (isEmpty(x)) return;
3898
3902
  c([i._id], x);
@@ -3937,18 +3941,18 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
3937
3941
  ] })
3938
3942
  ] });
3939
3943
  }, PathDropdown = ({ data: o, onSelect: n, dataType: r }) => {
3940
- const [a, l] = React__default.useState([]), [i, c] = React__default.useState(o), d = (h) => Array.isArray(h) ? "array" : typeof h == "object" && h !== null ? "object" : "value", p = React__default.useCallback(
3941
- (h) => {
3942
- const m = (f) => r === "value" ? f === "value" || f === "object" : r === "array" ? f === "array" : f === r;
3943
- h.type === "object" ? (l((f) => [...f, h.key]), c(h.value)) : m(h.type) && n([...a, h.key].join("."), r);
3944
+ 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(
3945
+ (m) => {
3946
+ const h = (f) => r === "value" ? f === "value" || f === "object" : r === "array" ? f === "array" : f === r;
3947
+ m.type === "object" ? (l((f) => [...f, m.key]), c(m.value)) : h(m.type) && n([...a, m.key].join("."), r);
3944
3948
  },
3945
3949
  [a, n, r]
3946
3950
  ), u = React__default.useCallback(() => {
3947
3951
  if (a.length > 0) {
3948
- const h = a.slice(0, -1);
3949
- l(h), c(h.reduce((m, f) => m[f], o));
3952
+ const m = a.slice(0, -1);
3953
+ l(m), c(m.reduce((h, f) => h[f], o));
3950
3954
  }
3951
- }, [a, o]), g = React__default.useMemo(() => i ? Object.entries(i).map(([h, m]) => ({ key: h, value: m, type: d(m) })).filter((h) => !startsWith(h.key, REPEATER_PREFIX) && h.key.includes("/") ? !1 : r === "value" ? h.type === "value" || h.type === "object" : r === "array" ? h.type === "array" || h.type === "object" : r === "object" ? h.type === "object" : !0) : [], [i, r]);
3955
+ }, [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]);
3952
3956
  return /* @__PURE__ */ jsxs(Command, { className: "fields-command", children: [
3953
3957
  /* @__PURE__ */ jsx(CommandInput, { className: "border-none", placeholder: "Search..." }),
3954
3958
  /* @__PURE__ */ jsxs(CommandList, { children: [
@@ -3958,36 +3962,36 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
3958
3962
  /* @__PURE__ */ jsx(ChevronLeft, { className: "mr-2 h-4 w-4" }),
3959
3963
  "Back"
3960
3964
  ] }),
3961
- g.map((h) => /* @__PURE__ */ jsxs(
3965
+ g.map((m) => /* @__PURE__ */ jsxs(
3962
3966
  CommandItem,
3963
3967
  {
3964
- value: h.key,
3968
+ value: m.key,
3965
3969
  disabled: !1,
3966
- onSelect: () => p(h),
3970
+ onSelect: () => p(m),
3967
3971
  className: "flex items-center justify-between",
3968
3972
  children: [
3969
3973
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-x-2", children: [
3970
- startsWith(h.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(h.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(DatabaseIcon, {}) : null,
3971
- startsWith(h.key, REPEATER_PREFIX) ? "Repeater Data" : startsWith(h.key, COLLECTION_PREFIX) ? h.key.replace(COLLECTION_PREFIX, "") : h.key
3974
+ startsWith(m.key, REPEATER_PREFIX) ? /* @__PURE__ */ jsx(LoopIcon, {}) : startsWith(m.key, COLLECTION_PREFIX) ? /* @__PURE__ */ jsx(DatabaseIcon, {}) : null,
3975
+ startsWith(m.key, REPEATER_PREFIX) ? "Repeater Data" : startsWith(m.key, COLLECTION_PREFIX) ? m.key.replace(COLLECTION_PREFIX, "") : m.key
3972
3976
  ] }),
3973
3977
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3974
- r === "object" && h.type === "object" && /* @__PURE__ */ jsx(
3978
+ r === "object" && m.type === "object" && /* @__PURE__ */ jsx(
3975
3979
  Button,
3976
3980
  {
3977
3981
  size: "sm",
3978
3982
  variant: "ghost",
3979
3983
  className: "h-6 px-2 hover:bg-primary hover:text-primary-foreground",
3980
- onClick: (m) => {
3981
- m.stopPropagation(), n([...a, h.key].join("."), r);
3984
+ onClick: (h) => {
3985
+ h.stopPropagation(), n([...a, m.key].join("."), r);
3982
3986
  },
3983
3987
  children: "Select"
3984
3988
  }
3985
3989
  ),
3986
- h.type === "object" && /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 opacity-50" }) })
3990
+ m.type === "object" && /* @__PURE__ */ jsx("div", { className: "cursor-pointer rounded p-1 hover:bg-muted", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 opacity-50" }) })
3987
3991
  ] })
3988
3992
  ]
3989
3993
  },
3990
- h.key
3994
+ m.key
3991
3995
  ))
3992
3996
  ] })
3993
3997
  ] })
@@ -4039,18 +4043,18 @@ const DataBindingSelector = ({
4039
4043
  }) => {
4040
4044
  const l = usePageExternalData(), i = useSelectedBlockHierarchy(), c = useSelectedBlock(), d = useMemo(() => {
4041
4045
  if (i.length === 1) return "";
4042
- const g = i.find((f) => f._type === "Repeater"), m = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4043
- return `${REPEATER_PREFIX}${startsWith(m, COLLECTION_PREFIX) ? `${m}/${g._id}` : m}`;
4046
+ const g = i.find((f) => f._type === "Repeater"), h = get(g, "repeaterItems", "").replace(/\{\{(.*)\}\}/g, "$1");
4047
+ return `${REPEATER_PREFIX}${startsWith(h, COLLECTION_PREFIX) ? `${h}/${g._id}` : h}`;
4044
4048
  }, [i]), p = useMemo(() => first(get(l, d.replace(REPEATER_PREFIX, ""), [])), [d, l]), u = useCallback(
4045
- (g, h) => {
4046
- if (g = isEmpty(d) ? g : g.replace(`${d}`, "$index"), h === "array" || h === "object") {
4049
+ (g, m) => {
4050
+ if (g = isEmpty(d) ? g : g.replace(`${d}`, "$index"), m === "array" || m === "object") {
4047
4051
  n(`{{${g}}}`, {}, r);
4048
4052
  return;
4049
4053
  }
4050
- const m = (b) => /[.,!?;:]/.test(b), f = (b, v, B) => {
4054
+ const h = (b) => /[.,!?;:]/.test(b), f = (b, v, B) => {
4051
4055
  let w = "", E = "";
4052
4056
  const _ = v > 0 ? b[v - 1] : "", S = v < b.length ? b[v] : "";
4053
- return v > 0 && (_ === "." || !m(_) && _ !== " ") && (w = " "), v < b.length && !m(S) && S !== " " && (E = " "), {
4057
+ return v > 0 && (_ === "." || !h(_) && _ !== " ") && (w = " "), v < b.length && !h(S) && S !== " " && (E = " "), {
4054
4058
  text: w + B + E,
4055
4059
  prefixLength: w.length,
4056
4060
  suffixLength: E.length
@@ -4069,9 +4073,9 @@ const DataBindingSelector = ({
4069
4073
  else {
4070
4074
  const { state: _ } = b, S = _.selection.from, A = _.doc.textBetween(Math.max(0, S - 1), S), N = _.doc.textBetween(S, Math.min(S + 1, _.doc.content.size));
4071
4075
  let C = "";
4072
- S > 0 && A !== " " && !m(A) && (C = " ");
4076
+ S > 0 && A !== " " && !h(A) && (C = " ");
4073
4077
  let k = "";
4074
- N && N !== " " && !m(N) && (k = " "), b.chain().insertContent(C + v + k).run();
4078
+ N && N !== " " && !h(N) && (k = " "), b.chain().insertContent(C + v + k).run();
4075
4079
  }
4076
4080
  setTimeout(() => n(b.getHTML(), {}, r), 100);
4077
4081
  return;
@@ -4106,13 +4110,13 @@ const DataBindingSelector = ({
4106
4110
  onChange: r
4107
4111
  }) => {
4108
4112
  var N;
4109
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [h, m] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((C) => C.key === u)) == null ? void 0 : N.name;
4113
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (C, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [m, h] = useState(""), [f, x] = useState([]), [y, b] = useState(-1), v = useRef(null), B = (N = n == null ? void 0 : n.find((C) => C.key === u)) == null ? void 0 : N.name;
4110
4114
  useEffect(() => {
4111
- if (m(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4115
+ if (h(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4112
4116
  const C = split(o, ":"), k = get(C, 1, "page") || "page";
4113
4117
  g(k), (async () => {
4114
4118
  const j = await l(k, [get(C, 2, "page")]);
4115
- j && Array.isArray(j) && m(get(j, [0, "name"], ""));
4119
+ j && Array.isArray(j) && h(get(j, [0, "name"], ""));
4116
4120
  })();
4117
4121
  }, [o]);
4118
4122
  const w = useDebouncedCallback(
@@ -4129,7 +4133,7 @@ const DataBindingSelector = ({
4129
4133
  300
4130
4134
  ), E = (C) => {
4131
4135
  const k = ["pageType", u, C.id];
4132
- k[1] && (r(k.join(":")), m(C.name), p(!1), x([]), b(-1));
4136
+ k[1] && (r(k.join(":")), h(C.name), p(!1), x([]), b(-1));
4133
4137
  }, _ = (C) => {
4134
4138
  switch (C.key) {
4135
4139
  case "ArrowDown":
@@ -4154,9 +4158,9 @@ const DataBindingSelector = ({
4154
4158
  }
4155
4159
  }, [y]);
4156
4160
  const S = () => {
4157
- m(""), x([]), b(-1), p(!1), r("");
4161
+ h(""), x([]), b(-1), p(!1), r("");
4158
4162
  }, A = (C) => {
4159
- m(C), p(!isEmpty(C)), c(!0), w(C);
4163
+ h(C), p(!isEmpty(C)), c(!0), w(C);
4160
4164
  };
4161
4165
  return /* @__PURE__ */ jsxs("div", { children: [
4162
4166
  /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (C) => g(C.target.value), children: map(n, (C) => /* @__PURE__ */ jsx("option", { value: C.key, children: C.name }, C.key)) }),
@@ -4165,14 +4169,14 @@ const DataBindingSelector = ({
4165
4169
  "input",
4166
4170
  {
4167
4171
  type: "text",
4168
- value: h,
4172
+ value: m,
4169
4173
  onChange: (C) => A(C.target.value),
4170
4174
  onKeyDown: _,
4171
4175
  placeholder: a(`Search ${B ?? ""}`),
4172
4176
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
4173
4177
  }
4174
4178
  ),
4175
- /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsx("button", { onClick: S, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4179
+ /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: m && /* @__PURE__ */ jsx("button", { onClick: S, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4176
4180
  ] }),
4177
4181
  (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: [
4178
4182
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
@@ -4180,7 +4184,7 @@ const DataBindingSelector = ({
4180
4184
  ] }) : d && isEmpty(f) ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
4181
4185
  a("No results found for"),
4182
4186
  ' "',
4183
- h,
4187
+ m,
4184
4188
  '"'
4185
4189
  ] }) : /* @__PURE__ */ jsx("ul", { ref: v, children: map(f == null ? void 0 : f.slice(0, 20), (C, k) => /* @__PURE__ */ jsxs(
4186
4190
  "li",
@@ -4438,16 +4442,16 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4438
4442
  const c = useRef(null), d = useRef(a || ""), p = usePageExternalData();
4439
4443
  useEffect(() => {
4440
4444
  if (o) {
4441
- const h = document.createElement("style");
4442
- return h.id = "rte-modal-styles", h.innerHTML = `
4445
+ const m = document.createElement("style");
4446
+ return m.id = "rte-modal-styles", m.innerHTML = `
4443
4447
  /* Ensure the NestedPathSelector popover appears above the dialog */
4444
4448
  .rte-path-selector + [data-radix-popper-content-wrapper],
4445
4449
  [data-radix-popper-content-wrapper] {
4446
4450
  z-index: 9999 !important;
4447
4451
  }
4448
- `, document.head.appendChild(h), () => {
4449
- const m = document.getElementById("rte-modal-styles");
4450
- m && m.remove();
4452
+ `, document.head.appendChild(m), () => {
4453
+ const h = document.getElementById("rte-modal-styles");
4454
+ h && h.remove();
4451
4455
  };
4452
4456
  }
4453
4457
  }, [o]);
@@ -4472,13 +4476,13 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4472
4476
  })
4473
4477
  ],
4474
4478
  content: a || "",
4475
- onUpdate: ({ editor: h }) => {
4476
- const m = h.getHTML();
4477
- l(m);
4479
+ onUpdate: ({ editor: m }) => {
4480
+ const h = m.getHTML();
4481
+ l(h);
4478
4482
  },
4479
- onBlur: ({ editor: h }) => {
4480
- const m = h.getHTML();
4481
- i(r, m);
4483
+ onBlur: ({ editor: m }) => {
4484
+ const h = m.getHTML();
4485
+ i(r, h);
4482
4486
  },
4483
4487
  editorProps: {
4484
4488
  attributes: {
@@ -4493,22 +4497,22 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4493
4497
  }, [o, u]), useEffect(() => {
4494
4498
  c.current && u && (c.current.__chaiRTE = u);
4495
4499
  }, [u, o]);
4496
- const g = (h) => {
4500
+ const g = (m) => {
4497
4501
  if (!u) return;
4498
- const m = `{{${h}}}`;
4502
+ const h = `{{${m}}}`;
4499
4503
  u.commands.focus();
4500
4504
  const { from: f, to: x } = u.state.selection;
4501
4505
  if (f !== x)
4502
- u.chain().deleteSelection().insertContent(m).run();
4506
+ u.chain().deleteSelection().insertContent(h).run();
4503
4507
  else {
4504
4508
  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));
4505
4509
  let E = "";
4506
4510
  v > 0 && B !== " " && !/[.,!?;:]/.test(B) && (E = " ");
4507
4511
  let _ = "";
4508
- w && w !== " " && !/[.,!?;:]/.test(w) && (_ = " "), u.chain().insertContent(E + m + _).run();
4512
+ w && w !== " " && !/[.,!?;:]/.test(w) && (_ = " "), u.chain().insertContent(E + h + _).run();
4509
4513
  }
4510
4514
  };
4511
- return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (h) => !h && n(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
4515
+ return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (m) => !m && n(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
4512
4516
  /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center justify-between pr-8", children: [
4513
4517
  /* @__PURE__ */ jsx("span", { children: "Rich Text Editor" }),
4514
4518
  Object.keys(p).length > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -4563,9 +4567,9 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4563
4567
  }, [g]), useEffect(() => {
4564
4568
  u(r || "");
4565
4569
  }, [r]);
4566
- const h = (f) => {
4570
+ const m = (f) => {
4567
4571
  a(f);
4568
- }, m = () => {
4572
+ }, h = () => {
4569
4573
  d(!1), g && g.commands.setContent(p);
4570
4574
  };
4571
4575
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -4577,10 +4581,10 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4577
4581
  RTEModal,
4578
4582
  {
4579
4583
  isOpen: c,
4580
- onClose: m,
4584
+ onClose: h,
4581
4585
  id: o,
4582
4586
  value: p,
4583
- onChange: h,
4587
+ onChange: m,
4584
4588
  onBlur: l
4585
4589
  }
4586
4590
  )
@@ -4596,14 +4600,14 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4596
4600
  }, [a]), useEffect(() => {
4597
4601
  u != null && u.length && !find(u, { _id: o == null ? void 0 : o.currentSlide }) && n({ ...o, currentSlide: get(u, "0._id") });
4598
4602
  }, [o, u]);
4599
- const h = () => {
4603
+ const m = () => {
4600
4604
  const x = findIndex(u, { _id: g });
4601
4605
  if (x > -1) {
4602
4606
  const y = (x + 1) % u.length, b = get(u, [y, "_id"]);
4603
4607
  if (!b) return;
4604
4608
  n({ ...o, currentSlide: b }), c([b]);
4605
4609
  }
4606
- }, m = () => {
4610
+ }, h = () => {
4607
4611
  const x = findIndex(u, { _id: g });
4608
4612
  if (x > -1) {
4609
4613
  const y = (x - 1 + u.length) % u.length, b = get(u, [y, "_id"]);
@@ -4619,7 +4623,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4619
4623
  };
4620
4624
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
4621
4625
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 pb-2 text-[12px]", children: [
4622
- /* @__PURE__ */ jsx("button", { onClick: m, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-3 w-3 stroke-[3]" }) }),
4626
+ /* @__PURE__ */ jsx("button", { onClick: h, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronLeft, { className: "h-3 w-3 stroke-[3]" }) }),
4623
4627
  /* @__PURE__ */ jsx("div", { className: "whitespace-nowrap text-center text-[10px] text-slate-500", children: g ? /* @__PURE__ */ jsxs("span", { className: "", children: [
4624
4628
  /* @__PURE__ */ jsxs("b", { className: "text-[12px]", children: [
4625
4629
  " ",
@@ -4628,7 +4632,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4628
4632
  "/",
4629
4633
  u.length
4630
4634
  ] }) : "-" }),
4631
- /* @__PURE__ */ jsx("button", { onClick: h, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 stroke-[3]" }) }),
4635
+ /* @__PURE__ */ jsx("button", { onClick: m, className: "rounded bg-gray-200 p-1.5 hover:opacity-80", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 stroke-[3]" }) }),
4632
4636
  /* @__PURE__ */ jsxs(
4633
4637
  "button",
4634
4638
  {
@@ -4706,7 +4710,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4706
4710
  const r = get(o, "srcsets", []) || [], a = (c, d) => {
4707
4711
  const p = c.target.name, u = c.target.value;
4708
4712
  n({
4709
- srcsets: map(r, (g, h) => h === d ? { ...g, [p]: u } : g)
4713
+ srcsets: map(r, (g, m) => m === d ? { ...g, [p]: u } : g)
4710
4714
  });
4711
4715
  }, l = () => {
4712
4716
  n({ srcsets: [...r, {}] });
@@ -4801,11 +4805,11 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4801
4805
  required: p,
4802
4806
  schema: u,
4803
4807
  formData: g,
4804
- onChange: h
4808
+ onChange: m
4805
4809
  }) => {
4806
- const { selectedLang: m, fallbackLang: f, languages: x } = useLanguages(), y = useMemo(
4807
- () => isEmpty(x) ? "" : isEmpty(m) ? f : m,
4808
- [x, m, f]
4810
+ const { selectedLang: h, fallbackLang: f, languages: x } = useLanguages(), y = useMemo(
4811
+ () => isEmpty(x) ? "" : isEmpty(h) ? f : h,
4812
+ [x, h, f]
4809
4813
  ), b = useMemo(() => get(LANGUAGES, y, y), [y]), v = usePageExternalData(), B = useSelectedBlock(), w = useRegisteredChaiBlocks(), E = useMemo(
4810
4814
  () => get(w, [B == null ? void 0 : B._type, "i18nProps"], []),
4811
4815
  [w, B == null ? void 0 : B._type]
@@ -4856,7 +4860,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4856
4860
  {
4857
4861
  schema: u,
4858
4862
  onChange: (C) => {
4859
- h(C, g, o);
4863
+ m(C, g, o);
4860
4864
  },
4861
4865
  id: o,
4862
4866
  formData: g
@@ -4903,8 +4907,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4903
4907
  /* @__PURE__ */ jsx("span", { children: "Add" })
4904
4908
  ] }) }), JSONForm = memo(({ blockId: o, schema: n, uiSchema: r, formData: a, onChange: l }) => {
4905
4909
  const { selectedLang: i } = useLanguages(), c = useBlockSettingComponents("widget"), d = useBlockSettingComponents("field"), p = useBlockSettingComponents("template"), u = useThrottledCallback(
4906
- async ({ formData: g }, h) => {
4907
- l({ formData: g }, h);
4910
+ async ({ formData: g }, m) => {
4911
+ l({ formData: g }, m);
4908
4912
  },
4909
4913
  [l, i],
4910
4914
  400
@@ -4945,10 +4949,10 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4945
4949
  uiSchema: r,
4946
4950
  schema: n,
4947
4951
  formData: a,
4948
- onChange: ({ formData: g }, h) => {
4949
- if (!h || o !== (g == null ? void 0 : g._id)) return;
4950
- const m = take(h.split("."), 2).join(".").replace("root.", "");
4951
- u({ formData: g }, m);
4952
+ onChange: ({ formData: g }, m) => {
4953
+ if (!m || o !== (g == null ? void 0 : g._id)) return;
4954
+ const h = take(m.split("."), 2).join(".").replace("root.", "");
4955
+ u({ formData: g }, h);
4952
4956
  }
4953
4957
  },
4954
4958
  i
@@ -4960,7 +4964,7 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4960
4964
  }), a;
4961
4965
  };
4962
4966
  function BlockSettings() {
4963
- 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(), h = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, h), f = ({ formData: _ }, S, A) => {
4967
+ 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: _ }, S, A) => {
4964
4968
  S && (c == null ? void 0 : c._id) === n._id && a([n._id], { [S]: get(_, S) }, A);
4965
4969
  }, x = useCallback(
4966
4970
  debounce(({ formData: _ }, S, A) => {
@@ -5016,7 +5020,7 @@ function BlockSettings() {
5016
5020
  {
5017
5021
  blockId: g == null ? void 0 : g._id,
5018
5022
  onChange: b,
5019
- formData: m,
5023
+ formData: h,
5020
5024
  schema: w,
5021
5025
  uiSchema: E
5022
5026
  }
@@ -5206,14 +5210,14 @@ const BlockStylingProps = () => {
5206
5210
  },
5207
5211
  a
5208
5212
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
5209
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [f, x] = useState(!1), [y, b] = useState(""), [v, B] = useState(!1), [w, E] = useState(!1);
5213
+ 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), [y, b] = useState(""), [v, B] = useState(!1), [w, E] = useState(!1);
5210
5214
  useEffect(() => {
5211
5215
  const { value: C, unit: k } = getClassValueAndUnit(i);
5212
5216
  if (k === "") {
5213
- l(C), m(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
5217
+ l(C), h(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
5214
5218
  return;
5215
5219
  }
5216
- m(k), l(k === "class" || isEmpty(C) ? "" : C);
5220
+ h(k), l(k === "class" || isEmpty(C) ? "" : C);
5217
5221
  }, [i, p, u]);
5218
5222
  const _ = useThrottledCallback((C) => c(C), [c], THROTTLE_TIME), S = useThrottledCallback((C) => c(C, !1), [c], THROTTLE_TIME), A = useCallback(
5219
5223
  (C = !1) => {
@@ -5222,17 +5226,17 @@ const BlockStylingProps = () => {
5222
5226
  x(!0);
5223
5227
  return;
5224
5228
  }
5225
- const j = get(k, "unit") !== "" ? get(k, "unit") : h;
5229
+ const j = get(k, "unit") !== "" ? get(k, "unit") : m;
5226
5230
  if (j === "auto" || j === "none") {
5227
5231
  _(`${d}${j}`);
5228
5232
  return;
5229
5233
  }
5230
5234
  if (get(k, "value") === "")
5231
5235
  return;
5232
- const L = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5233
- C ? S(L) : _(L);
5236
+ const I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5237
+ C ? S(I) : _(I);
5234
5238
  },
5235
- [_, S, a, h, d, u]
5239
+ [_, S, a, m, d, u]
5236
5240
  ), N = useCallback(
5237
5241
  (C) => {
5238
5242
  const k = getUserInputValues(`${a}`, u);
@@ -5246,12 +5250,12 @@ const BlockStylingProps = () => {
5246
5250
  }
5247
5251
  if (get(k, "value") === "")
5248
5252
  return;
5249
- const j = get(k, "unit") !== "" ? get(k, "unit") : C, L = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5250
- _(L);
5253
+ const j = get(k, "unit") !== "" ? get(k, "unit") : C, I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${j === "-" ? "" : j}]`;
5254
+ _(I);
5251
5255
  },
5252
5256
  [_, a, d, u]
5253
5257
  );
5254
- return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: h === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5258
+ return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: m === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
5255
5259
  /* @__PURE__ */ jsx(
5256
5260
  "input",
5257
5261
  {
@@ -5266,10 +5270,10 @@ const BlockStylingProps = () => {
5266
5270
  ] })
5267
5271
  ] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
5268
5272
  /* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
5269
- ["none", "auto"].indexOf(h) !== -1 ? null : /* @__PURE__ */ jsx(
5273
+ ["none", "auto"].indexOf(m) !== -1 ? null : /* @__PURE__ */ jsx(
5270
5274
  "input",
5271
5275
  {
5272
- readOnly: h === "class",
5276
+ readOnly: m === "class",
5273
5277
  onKeyPress: (C) => {
5274
5278
  C.key === "Enter" && A();
5275
5279
  },
@@ -5280,7 +5284,7 @@ const BlockStylingProps = () => {
5280
5284
  const k = parseInt$1(C.target.value);
5281
5285
  let j = isNaN$1(k) ? 0 : k;
5282
5286
  C.keyCode === 38 && (j += 1), C.keyCode === 40 && (j -= 1);
5283
- const T = `${j}`, R = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${h === "-" ? "" : h}]`;
5287
+ const T = `${j}`, R = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${m === "-" ? "" : m}]`;
5284
5288
  S(R);
5285
5289
  },
5286
5290
  onKeyUp: (C) => {
@@ -5309,7 +5313,7 @@ const BlockStylingProps = () => {
5309
5313
  onClick: () => r(!n),
5310
5314
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
5311
5315
  children: [
5312
- /* @__PURE__ */ jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: h }),
5316
+ /* @__PURE__ */ jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: m }),
5313
5317
  u.length > 1 ? /* @__PURE__ */ jsx(TriangleDownIcon, {}) : null
5314
5318
  ]
5315
5319
  }
@@ -5318,33 +5322,33 @@ const BlockStylingProps = () => {
5318
5322
  UnitSelection,
5319
5323
  {
5320
5324
  units: u,
5321
- current: h,
5325
+ current: m,
5322
5326
  onSelect: (C) => {
5323
- r(!1), m(C), N(C);
5327
+ r(!1), h(C), N(C);
5324
5328
  }
5325
5329
  }
5326
5330
  ) })
5327
5331
  ] })
5328
5332
  ] }),
5329
- ["none", "auto"].indexOf(h) !== -1 || v ? null : /* @__PURE__ */ jsx(
5333
+ ["none", "auto"].indexOf(m) !== -1 || v ? null : /* @__PURE__ */ jsx(
5330
5334
  DragStyleButton,
5331
5335
  {
5332
5336
  onDragStart: () => B(!0),
5333
5337
  onDragEnd: (C) => {
5334
5338
  if (b(() => ""), B(!1), isEmpty(C))
5335
5339
  return;
5336
- const k = `${C}`, T = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${h === "-" ? "" : h}]`;
5340
+ const k = `${C}`, T = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${m === "-" ? "" : m}]`;
5337
5341
  _(T);
5338
5342
  },
5339
5343
  onDrag: (C) => {
5340
5344
  if (isEmpty(C))
5341
5345
  return;
5342
5346
  b(C);
5343
- const k = `${C}`, T = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${h === "-" ? "" : h}]`;
5347
+ const k = `${C}`, T = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${m === "-" ? "" : m}]`;
5344
5348
  S(T);
5345
5349
  },
5346
5350
  currentValue: a,
5347
- unit: h,
5351
+ unit: m,
5348
5352
  negative: g,
5349
5353
  cssProperty: p
5350
5354
  }
@@ -5404,7 +5408,7 @@ const COLOR_PROP = {
5404
5408
  ringColor: "ring",
5405
5409
  ringOffsetColor: "ring-offset"
5406
5410
  }, ColorChoice = ({ property: o, onChange: n }) => {
5407
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), g = get(u, "1", ""), h = get(u, "2", ""), m = useCallback(
5411
+ const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), g = get(u, "1", ""), m = get(u, "2", ""), h = useCallback(
5408
5412
  // eslint-disable-next-line no-shadow
5409
5413
  (y) => {
5410
5414
  ["current", "inherit", "transparent", "black", "white"].includes(y) ? (c([]), p({ color: y })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((b) => ({ ...b, color: y, shade: b.shade ? b.shade : "500" })));
@@ -5437,7 +5441,7 @@ const COLOR_PROP = {
5437
5441
  disabled: !l,
5438
5442
  rounded: !0,
5439
5443
  selected: g,
5440
- onChange: m,
5444
+ onChange: h,
5441
5445
  options: [
5442
5446
  "current",
5443
5447
  "transparent",
@@ -5470,7 +5474,7 @@ const COLOR_PROP = {
5470
5474
  ]
5471
5475
  }
5472
5476
  ) }),
5473
- /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: h, disabled: !g || !l, onChange: f, options: i }) })
5477
+ /* @__PURE__ */ jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsx(DropDown, { rounded: !0, selected: m, disabled: !g || !l, onChange: f, options: i }) })
5474
5478
  ] });
5475
5479
  }, EDITOR_ICONS = {
5476
5480
  "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" }) }),
@@ -5804,20 +5808,20 @@ const COLOR_PROP = {
5804
5808
  "2xl": "1536px"
5805
5809
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
5806
5810
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
5807
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(h, "fullCls", ""), [h]), b = useCallback(
5811
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), m = useCurrentClassByProperty(l), h = useAddClassesToBlocks(), f = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(m, "fullCls", ""), [m]), b = useCallback(
5808
5812
  (S, A = !0) => {
5809
5813
  const N = { dark: p, mq: g, mod: u, cls: S, property: l, fullCls: "" };
5810
5814
  (p || u !== "") && (N.mq = "xs");
5811
5815
  const C = generateFullClsName(N);
5812
- m(x, [C], A);
5816
+ h(x, [C], A);
5813
5817
  },
5814
- [x, p, g, u, l, m]
5818
+ [x, p, g, u, l, h]
5815
5819
  ), v = useCallback(() => {
5816
5820
  f(x, [y], !0);
5817
- }, [x, y, f]), B = useMemo(() => canChangeClass(h, g), [h, g]);
5821
+ }, [x, y, f]), B = useMemo(() => canChangeClass(m, g), [m, g]);
5818
5822
  useEffect(() => {
5819
- i(B, h);
5820
- }, [B, i, h]);
5823
+ i(B, m);
5824
+ }, [B, i, m]);
5821
5825
  const [, , w] = useScreenSizeWidth(), E = useCallback(
5822
5826
  (S) => {
5823
5827
  w({
@@ -5830,15 +5834,15 @@ const COLOR_PROP = {
5830
5834
  }[S]);
5831
5835
  },
5832
5836
  [w]
5833
- ), _ = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === g;
5834
- return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: h && _, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
5835
- /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${h && !_ ? "text-foreground" : ""}`, children: n(a) }) }),
5837
+ ), _ = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === g;
5838
+ return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: B, canReset: m && _, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
5839
+ /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${m && !_ ? "text-foreground" : ""}`, children: n(a) }) }),
5836
5840
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
5837
5841
  /* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
5838
5842
  r === "arbitrary" ? /* @__PURE__ */ jsx(
5839
5843
  AdvanceChoices,
5840
5844
  {
5841
- currentClass: get(h, "cls", ""),
5845
+ currentClass: get(m, "cls", ""),
5842
5846
  classPrefix: get(CLASS_PREFIXES, l, ""),
5843
5847
  units: c || [],
5844
5848
  onChange: b,
@@ -5851,7 +5855,7 @@ const COLOR_PROP = {
5851
5855
  r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
5852
5856
  r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
5853
5857
  ] }),
5854
- /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && h ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
5858
+ /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && m ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
5855
5859
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
5856
5860
  "button",
5857
5861
  {
@@ -5863,19 +5867,19 @@ const COLOR_PROP = {
5863
5867
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxs("div", { children: [
5864
5868
  "Current style is set at  ",
5865
5869
  /* @__PURE__ */ jsxs("span", { className: "font-bold", children: [
5866
- getBreakpoint(get(h, "mq")),
5867
- p && !h.dark ? "(Light mode)" : ""
5870
+ getBreakpoint(get(m, "mq")),
5871
+ p && !m.dark ? "(Light mode)" : ""
5868
5872
  ] }),
5869
5873
  /* @__PURE__ */ jsx("br", {}),
5870
5874
  /* @__PURE__ */ jsxs(
5871
5875
  "button",
5872
5876
  {
5873
5877
  type: "button",
5874
- onClick: () => E(get(h, "mq")),
5878
+ onClick: () => E(get(m, "mq")),
5875
5879
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
5876
5880
  children: [
5877
5881
  "Switch to ",
5878
- get(h, "mq").toUpperCase()
5882
+ get(m, "mq").toUpperCase()
5879
5883
  ]
5880
5884
  }
5881
5885
  )
@@ -5892,7 +5896,7 @@ const COLOR_PROP = {
5892
5896
  units: i = basicUnits,
5893
5897
  negative: c = !1
5894
5898
  }) => {
5895
- const { t: d } = useTranslation(), [p, u] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), h = useCallback((m) => map(g, "property").includes(m), [g]);
5899
+ const { t: d } = useTranslation(), [p, u] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), m = useCallback((h) => map(g, "property").includes(h), [g]);
5896
5900
  return /* @__PURE__ */ jsxs(
5897
5901
  "div",
5898
5902
  {
@@ -5900,7 +5904,7 @@ const COLOR_PROP = {
5900
5904
  children: [
5901
5905
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-xs", children: [
5902
5906
  o && /* @__PURE__ */ jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
5903
- /* @__PURE__ */ jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: n.map(({ label: m, key: f }, x) => /* @__PURE__ */ jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
5907
+ /* @__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: [
5904
5908
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(
5905
5909
  "button",
5906
5910
  {
@@ -5909,13 +5913,13 @@ const COLOR_PROP = {
5909
5913
  className: `relative cursor-pointer rounded-full p-1 text-[8px] ${f === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
5910
5914
  children: [
5911
5915
  React__default.createElement("div", {
5912
- className: h(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
5916
+ className: m(f) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
5913
5917
  }),
5914
5918
  React__default.createElement(get(EDITOR_ICONS, f, BoxIcon), { className: "text-inherit w-3 h-3" })
5915
5919
  ]
5916
5920
  }
5917
5921
  ) }),
5918
- /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(m)) })
5922
+ /* @__PURE__ */ jsx(TooltipContent, { children: startCase(toLower(h)) })
5919
5923
  ] }) }, `option-${x}`)) })
5920
5924
  ] }),
5921
5925
  /* @__PURE__ */ jsx("div", { className: "mt-0 flex items-center", children: /* @__PURE__ */ jsx(
@@ -6071,12 +6075,12 @@ const COLOR_PROP = {
6071
6075
  canvas: n = !1,
6072
6076
  tooltip: r = !0
6073
6077
  }) => {
6074
- const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: h } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (b) => {
6078
+ const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: m } = useTranslation(), h = useBuilderProp("breakpoints", WEB_BREAKPOINTS), f = (b) => {
6075
6079
  u.includes(b) ? u.length > 2 && g(u.filter((v) => v !== b)) : g((v) => [...v, b]);
6076
6080
  }, x = (b) => {
6077
6081
  n || l(b), c(b);
6078
6082
  }, y = getBreakpointValue(n ? i : a).toLowerCase();
6079
- return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (b) => /* @__PURE__ */ createElement(
6083
+ return h.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(h, (b) => /* @__PURE__ */ createElement(
6080
6084
  BreakpointCard,
6081
6085
  {
6082
6086
  canvas: n,
@@ -6087,7 +6091,7 @@ const COLOR_PROP = {
6087
6091
  }
6088
6092
  )) }) : /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between rounded-md", children: [
6089
6093
  /* @__PURE__ */ jsx("div", { className: "flex items-center", children: map(
6090
- m.filter((b) => includes(u, toUpper(b.breakpoint))),
6094
+ h.filter((b) => includes(u, toUpper(b.breakpoint))),
6091
6095
  (b) => /* @__PURE__ */ createElement(
6092
6096
  BreakpointCard,
6093
6097
  {
@@ -6104,15 +6108,15 @@ const COLOR_PROP = {
6104
6108
  /* @__PURE__ */ jsxs(DropdownMenu, { children: [
6105
6109
  /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("span", { className: "cursor-pointer px-2.5 hover:opacity-80", children: /* @__PURE__ */ jsx(DotsVerticalIcon, { className: "scale-90 transform" }) }) }),
6106
6110
  /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56 border-border text-xs", children: [
6107
- /* @__PURE__ */ jsx(DropdownMenuLabel, { children: h("Screen sizes") }),
6111
+ /* @__PURE__ */ jsx(DropdownMenuLabel, { children: m("Screen sizes") }),
6108
6112
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
6109
- map(m, (b) => /* @__PURE__ */ jsx(
6113
+ map(h, (b) => /* @__PURE__ */ jsx(
6110
6114
  DropdownMenuCheckboxItem,
6111
6115
  {
6112
6116
  disabled: b.breakpoint === "xs",
6113
6117
  onCheckedChange: () => f(toUpper(b.breakpoint)),
6114
6118
  checked: includes(u, toUpper(b.breakpoint)),
6115
- children: h(b.title)
6119
+ children: m(b.title)
6116
6120
  },
6117
6121
  b.breakpoint
6118
6122
  ))
@@ -6191,11 +6195,11 @@ function Countdown() {
6191
6195
  const AskAIStyles = ({ blockId: o }) => {
6192
6196
  const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), [u, g] = useState();
6193
6197
  useEffect(() => {
6194
- var m;
6195
- (m = d.current) == null || m.focus();
6198
+ var h;
6199
+ (h = d.current) == null || h.focus();
6196
6200
  }, []);
6197
- const h = (m) => {
6198
- const { usage: f } = m || {};
6201
+ const m = (h) => {
6202
+ const { usage: f } = h || {};
6199
6203
  !l && f && g(f), p.current = setTimeout(() => g(void 0), 1e4), l || c("");
6200
6204
  };
6201
6205
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
@@ -6205,12 +6209,12 @@ const AskAIStyles = ({ blockId: o }) => {
6205
6209
  {
6206
6210
  ref: d,
6207
6211
  value: i,
6208
- onChange: (m) => c(m.target.value),
6212
+ onChange: (h) => c(h.target.value),
6209
6213
  placeholder: n("Ask AI to edit styles"),
6210
6214
  className: "no-scrollbar my-2 w-full border border-border p-2 text-xs",
6211
6215
  rows: 4,
6212
- onKeyDown: (m) => {
6213
- m.key === "Enter" && (m.preventDefault(), p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, h));
6216
+ onKeyDown: (h) => {
6217
+ h.key === "Enter" && (h.preventDefault(), p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, m));
6214
6218
  }
6215
6219
  }
6216
6220
  ),
@@ -6220,7 +6224,7 @@ const AskAIStyles = ({ blockId: o }) => {
6220
6224
  {
6221
6225
  disabled: i.trim().length < 5 || a,
6222
6226
  onClick: () => {
6223
- p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, h);
6227
+ p.current && clearTimeout(p.current), g(void 0), r("styles", o, i, m);
6224
6228
  },
6225
6229
  variant: "default",
6226
6230
  className: "w-fit",
@@ -6252,14 +6256,14 @@ const AskAIStyles = ({ blockId: o }) => {
6252
6256
  };
6253
6257
  function ManualClasses() {
6254
6258
  var T;
6255
- const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [h] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [f, x] = useState(""), y = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((L) => !isEmpty(L)), B = () => {
6256
- const L = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6257
- u(h, L, !0), x("");
6258
- }, [w, E] = useState([]), _ = ({ value: L }) => {
6259
- const R = L.trim().toLowerCase(), I = R.match(/.+:/g);
6259
+ 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(""), y = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), v = b.split(" ").filter((I) => !isEmpty(I)), B = () => {
6260
+ const I = f.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6261
+ u(m, I, !0), x("");
6262
+ }, [w, E] = useState([]), _ = ({ value: I }) => {
6263
+ const R = I.trim().toLowerCase(), L = R.match(/.+:/g);
6260
6264
  let D = [];
6261
- if (I && I.length > 0) {
6262
- const [O] = I, P = R.replace(O, "");
6265
+ if (L && L.length > 0) {
6266
+ const [O] = L, P = R.replace(O, "");
6263
6267
  D = i.search(P).map((M) => ({
6264
6268
  ...M,
6265
6269
  item: { ...M.item, name: O + M.item.name }
@@ -6269,7 +6273,7 @@ function ManualClasses() {
6269
6273
  return E(map(D, "item"));
6270
6274
  }, S = () => {
6271
6275
  E([]);
6272
- }, A = (L) => L.name, N = (L) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: L.name }), C = useMemo(
6276
+ }, A = (I) => I.name, N = (I) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: I.name }), C = useMemo(
6273
6277
  () => ({
6274
6278
  ref: o,
6275
6279
  autoComplete: "off",
@@ -6278,22 +6282,22 @@ function ManualClasses() {
6278
6282
  spellCheck: !1,
6279
6283
  placeholder: c("Enter classes separated by space"),
6280
6284
  value: f,
6281
- onFocus: (L) => {
6285
+ onFocus: (I) => {
6282
6286
  setTimeout(() => {
6283
- L.target && L.target.select();
6287
+ I.target && I.target.select();
6284
6288
  }, 0);
6285
6289
  },
6286
- onKeyDown: (L) => {
6287
- L.key === "Enter" && f.trim() !== "" && B();
6290
+ onKeyDown: (I) => {
6291
+ I.key === "Enter" && f.trim() !== "" && B();
6288
6292
  },
6289
- onChange: (L, { newValue: R }) => x(R),
6293
+ onChange: (I, { newValue: R }) => x(R),
6290
6294
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
6291
6295
  }),
6292
6296
  [f, c, o]
6293
- ), k = (L) => {
6297
+ ), k = (I) => {
6294
6298
  debugger;
6295
6299
  const R = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6296
- g(h, [L]), u(h, R, !0), r(""), l(-1);
6300
+ g(m, [I]), u(m, R, !0), r(""), l(-1);
6297
6301
  }, j = () => {
6298
6302
  if (navigator.clipboard === void 0) {
6299
6303
  toast.error(c("Clipboard not supported"));
@@ -6310,7 +6314,7 @@ function ManualClasses() {
6310
6314
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
6311
6315
  ] })
6312
6316
  ] }),
6313
- m ? /* @__PURE__ */ jsxs(Popover, { children: [
6317
+ h ? /* @__PURE__ */ jsxs(Popover, { children: [
6314
6318
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxs(Button, { variant: "default", className: "h-6 w-fit", size: "sm", children: [
6315
6319
  /* @__PURE__ */ jsx(SparklesIcon, { className: "h-4 w-4" }),
6316
6320
  /* @__PURE__ */ jsx("span", { className: "ml-2", children: c("Ask AI") })
@@ -6351,47 +6355,47 @@ function ManualClasses() {
6351
6355
  )
6352
6356
  ] }),
6353
6357
  /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: v.map(
6354
- (L, R) => a === R ? /* @__PURE__ */ jsx(
6358
+ (I, R) => a === R ? /* @__PURE__ */ jsx(
6355
6359
  "input",
6356
6360
  {
6357
6361
  ref: o,
6358
6362
  value: n,
6359
- onChange: (I) => r(I.target.value),
6363
+ onChange: (L) => r(L.target.value),
6360
6364
  onBlur: () => {
6361
- k(L);
6365
+ k(I);
6362
6366
  },
6363
- onKeyDown: (I) => {
6364
- I.key === "Enter" && k(L);
6367
+ onKeyDown: (L) => {
6368
+ L.key === "Enter" && k(I);
6365
6369
  },
6366
- onFocus: (I) => {
6370
+ onFocus: (L) => {
6367
6371
  setTimeout(() => {
6368
- I.target.select();
6372
+ L.target.select();
6369
6373
  }, 0);
6370
6374
  },
6371
6375
  className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300"
6372
6376
  },
6373
- L
6377
+ I
6374
6378
  ) : /* @__PURE__ */ jsxs(
6375
6379
  "button",
6376
6380
  {
6377
6381
  onDoubleClick: () => {
6378
- x(L), g(h, [L]), setTimeout(() => {
6382
+ x(I), g(m, [I]), setTimeout(() => {
6379
6383
  o.current && o.current.focus();
6380
6384
  }, 10);
6381
6385
  },
6382
6386
  className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate break-words rounded border border-border bg-gray-200 p-px px-1.5 pr-2 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
6383
6387
  children: [
6384
- L,
6385
- n !== L && /* @__PURE__ */ jsx(
6388
+ I,
6389
+ n !== I && /* @__PURE__ */ jsx(
6386
6390
  Cross2Icon,
6387
6391
  {
6388
- onClick: () => g(h, [L], !0),
6392
+ onClick: () => g(m, [I], !0),
6389
6393
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
6390
6394
  }
6391
6395
  )
6392
6396
  ]
6393
6397
  },
6394
- L
6398
+ I
6395
6399
  )
6396
6400
  ) })
6397
6401
  ] });
@@ -6505,13 +6509,13 @@ function BlockStyling() {
6505
6509
  cssProperty: ""
6506
6510
  }), d = useThrottledCallback(
6507
6511
  (u) => {
6508
- const g = !get(i, "negative", !1), h = get(i, "cssProperty", "");
6509
- let m = parseFloat(i.dragStartValue);
6510
- m = isNaN(m) ? 0 : m;
6512
+ const g = !get(i, "negative", !1), m = get(i, "cssProperty", "");
6513
+ let h = parseFloat(i.dragStartValue);
6514
+ h = isNaN(h) ? 0 : h;
6511
6515
  let f = MAPPER[i.dragUnit];
6512
- (startsWith(h, "scale") || h === "opacity") && (f = 10);
6513
- let y = (i.dragStartY - u.pageY) / f + m;
6514
- g && y < 0 && (y = 0), h === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
6516
+ (startsWith(m, "scale") || m === "opacity") && (f = 10);
6517
+ let y = (i.dragStartY - u.pageY) / f + h;
6518
+ g && y < 0 && (y = 0), m === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
6515
6519
  },
6516
6520
  [i],
6517
6521
  50
@@ -6552,7 +6556,7 @@ const CoreBlock = ({
6552
6556
  parentId: r,
6553
6557
  position: a
6554
6558
  }) => {
6555
- const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), m = () => {
6559
+ const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), h = () => {
6556
6560
  if (has(o, "blocks")) {
6557
6561
  const y = isFunction(o.blocks) ? o.blocks() : o.blocks;
6558
6562
  u(syncBlocksWithDefaults(y), r || null, a);
@@ -6565,11 +6569,11 @@ const CoreBlock = ({
6565
6569
  "button",
6566
6570
  {
6567
6571
  disabled: n,
6568
- onClick: m,
6572
+ onClick: h,
6569
6573
  type: "button",
6570
6574
  onDragStart: (y) => {
6571
6575
  y.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), y.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
6572
- g([]), h();
6576
+ g([]), m();
6573
6577
  }, 200);
6574
6578
  },
6575
6579
  draggable: f ? "true" : "false",
@@ -6768,7 +6772,7 @@ const CoreBlock = ({
6768
6772
  }
6769
6773
  }
6770
6774
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
6771
- var h, m, f, x, y, b, v, B;
6775
+ var m, h, f, x, y, b, v, B;
6772
6776
  if (r.type === "comment") return [];
6773
6777
  let a = { _id: generateUUID() };
6774
6778
  if (n && (a._parent = n.block._id), r.type === "text")
@@ -6808,8 +6812,8 @@ const CoreBlock = ({
6808
6812
  ];
6809
6813
  a = {
6810
6814
  ...a,
6811
- href: ((h = l.find((E) => E.key === "href")) == null ? void 0 : h.value) || "",
6812
- hrefType: ((m = l.find((E) => E.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
6815
+ href: ((m = l.find((E) => E.key === "href")) == null ? void 0 : m.value) || "",
6816
+ hrefType: ((h = l.find((E) => E.key === "data-vbtype")) == null ? void 0 : h.value) || "video",
6813
6817
  autoplay: ((f = l.find((E) => E.key === "data-autoplay")) == null ? void 0 : f.value) === "true" ? "true" : "false",
6814
6818
  maxWidth: ((y = (x = l.find((E) => E.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : y.replace("px", "")) || "",
6815
6819
  backdropColor: ((b = l.find((E) => E.key === "data-overlay")) == null ? void 0 : b.value) || "",
@@ -6952,7 +6956,7 @@ const registerChaiLibrary = (o, n) => {
6952
6956
  parentId: r = void 0,
6953
6957
  position: a = -1
6954
6958
  }) => {
6955
- const [l, i] = useState(!1), c = useMemo(() => (n == null ? void 0 : n.getBlock) || (() => []), [n]), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = get(o, "description", ""), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), y = (B) => {
6959
+ 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), y = (B) => {
6956
6960
  const w = has(B, "styles_attrs.data-page-section");
6957
6961
  return B._type === "Box" && w;
6958
6962
  }, b = useCallback(
@@ -6999,20 +7003,20 @@ const registerChaiLibrary = (o, n) => {
6999
7003
  /* @__PURE__ */ jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
7000
7004
  /* @__PURE__ */ jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
7001
7005
  ] }),
7002
- o.preview ? /* @__PURE__ */ jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: h }) : /* @__PURE__ */ jsxs("div", { className: "flex h-fit w-full flex-col items-center justify-center gap-1 rounded-md border border-border p-6 py-10 text-center", children: [
7003
- /* @__PURE__ */ jsx("p", { className: "font-medium text-gray-800", children: h }),
7004
- m && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: m })
7006
+ o.preview ? /* @__PURE__ */ jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__PURE__ */ jsxs("div", { className: "flex h-fit w-full flex-col items-center justify-center gap-1 rounded-md border border-border p-6 py-10 text-center", children: [
7007
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-gray-800", children: m }),
7008
+ h && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: h })
7005
7009
  ] })
7006
7010
  ]
7007
7011
  }
7008
7012
  ) }),
7009
7013
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsxs("div", { className: "max-w-xs", children: [
7010
- /* @__PURE__ */ jsx("p", { className: "font-medium", children: h }),
7011
- m && o.preview && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-primary-foreground", children: m })
7014
+ /* @__PURE__ */ jsx("p", { className: "font-medium", children: m }),
7015
+ h && o.preview && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-primary-foreground", children: h })
7012
7016
  ] }) })
7013
7017
  ] });
7014
7018
  }, UILibrarySection = ({ parentId: o, position: n }) => {
7015
- const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((k) => k.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [h, m] = useState([]), f = useRef(null);
7019
+ const [r, a] = useSelectedLibrary(), l = useChaiLibraries(), i = l.find((k) => k.id === r) || first(l), { data: c, isLoading: d, resetLibrary: p } = useLibraryBlocks(i), [u, g] = useState(""), [m, h] = useState([]), f = useRef(null);
7016
7020
  useEffect(() => {
7017
7021
  c && c.length > 0 && (f.current = new Fuse(c, {
7018
7022
  keys: ["name", "label", "description", "group"],
@@ -7021,13 +7025,13 @@ const registerChaiLibrary = (o, n) => {
7021
7025
  }));
7022
7026
  }, [c]), useEffect(() => {
7023
7027
  if (!u.trim() || !f.current) {
7024
- m([]);
7028
+ h([]);
7025
7029
  return;
7026
7030
  }
7027
7031
  const k = f.current.search(u).map((j) => j.item);
7028
- m(k);
7032
+ h(k);
7029
7033
  }, [u]);
7030
- const x = u.trim() && !isEmpty(h) ? h : c, y = groupBy(x, "group"), [b, v] = useState(null);
7034
+ const x = u.trim() && !isEmpty(m) ? m : c, y = groupBy(x, "group"), [b, v] = useState(null);
7031
7035
  useEffect(() => {
7032
7036
  if (isEmpty(keys(y))) {
7033
7037
  v(null);
@@ -7167,7 +7171,7 @@ const registerChaiLibrary = (o, n) => {
7167
7171
  error: c
7168
7172
  }), g(!0);
7169
7173
  else if (!l && Object.keys(a || {}).length > 0) {
7170
- const m = Object.entries(a).map(([x, y]) => {
7174
+ const h = Object.entries(a).map(([x, y]) => {
7171
7175
  const b = y, v = b.type || "partial", B = formatReadableName(v);
7172
7176
  return {
7173
7177
  type: "PartialBlock",
@@ -7182,14 +7186,14 @@ const registerChaiLibrary = (o, n) => {
7182
7186
  // Store the original ID as partialBlockId
7183
7187
  _name: b.name
7184
7188
  };
7185
- }), f = uniq(map(m, "group"));
7189
+ }), f = uniq(map(h, "group"));
7186
7190
  p({
7187
- blocks: m,
7191
+ blocks: h,
7188
7192
  groups: f,
7189
7193
  isLoading: !1,
7190
7194
  error: null
7191
7195
  }), g(!0);
7192
- } else l ? p((m) => ({ ...m, isLoading: !0, error: null })) : !l && Object.keys(a || {}).length === 0 && (p({
7196
+ } else l ? p((h) => ({ ...h, isLoading: !0, error: null })) : !l && Object.keys(a || {}).length === 0 && (p({
7193
7197
  blocks: [],
7194
7198
  groups: [],
7195
7199
  isLoading: !1,
@@ -7204,15 +7208,15 @@ const registerChaiLibrary = (o, n) => {
7204
7208
  d.blocks,
7205
7209
  c
7206
7210
  ]);
7207
- const h = () => {
7208
- p((m) => ({ ...m, isLoading: !0, error: null })), g(!1), i();
7211
+ const m = () => {
7212
+ p((h) => ({ ...h, isLoading: !0, error: null })), g(!1), i();
7209
7213
  };
7210
7214
  return d.isLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-8 text-center text-muted-foreground", children: "Loading partial blocks..." }) : d.error || d.blocks.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center gap-4 p-8 text-center text-muted-foreground", children: [
7211
7215
  /* @__PURE__ */ jsx("p", { children: d.error || "No partial blocks available" }),
7212
7216
  /* @__PURE__ */ jsx(
7213
7217
  "button",
7214
7218
  {
7215
- onClick: h,
7219
+ onClick: m,
7216
7220
  className: "rounded-md bg-primary px-3 py-1 text-sm text-primary-foreground hover:bg-primary/90",
7217
7221
  children: "Refresh"
7218
7222
  }
@@ -7231,7 +7235,7 @@ const registerChaiLibrary = (o, n) => {
7231
7235
  has(ADD_BLOCK_TABS, o) && console.warn(`Add block tab with id ${o} already registered`), set(ADD_BLOCK_TABS, o, { id: o, ...n });
7232
7236
  }, 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" }) => {
7233
7237
  var C;
7234
- const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), h = (C = find(c, (k) => k._id === r)) == null ? void 0 : C._type, [m, f] = useState("all"), [x, y] = useState(null), b = useRef(null);
7238
+ const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), m = (C = find(c, (k) => k._id === r)) == null ? void 0 : C._type, [h, f] = useState("all"), [x, y] = useState(null), b = useRef(null);
7235
7239
  useEffect(() => {
7236
7240
  const k = setTimeout(() => {
7237
7241
  var j;
@@ -7267,7 +7271,7 @@ const registerChaiLibrary = (o, n) => {
7267
7271
  ), S = useMemo(
7268
7272
  () => sortBy(_, (k) => CORE_GROUPS.indexOf(k) === -1 ? 99 : CORE_GROUPS.indexOf(k)),
7269
7273
  [_]
7270
- ), A = useMemo(() => m === "all" ? E : filter(values(E), { group: m }), [E, m]), N = useMemo(() => m === "all" ? S : [m], [S, m]);
7274
+ ), A = useMemo(() => h === "all" ? E : filter(values(E), { group: h }), [E, h]), N = useMemo(() => h === "all" ? S : [h], [S, h]);
7271
7275
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
7272
7276
  /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
7273
7277
  Input$1,
@@ -7288,7 +7292,7 @@ const registerChaiLibrary = (o, n) => {
7288
7292
  onClick: () => w("all"),
7289
7293
  onMouseEnter: () => v("all"),
7290
7294
  onMouseLeave: B,
7291
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || x === "all" ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7295
+ 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"}`,
7292
7296
  children: i("All")
7293
7297
  },
7294
7298
  "sidebar-all"
@@ -7299,7 +7303,7 @@ const registerChaiLibrary = (o, n) => {
7299
7303
  onClick: () => w(k),
7300
7304
  onMouseEnter: () => v(k),
7301
7305
  onMouseLeave: B,
7302
- className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === k || x === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7306
+ className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${h === k || x === k ? "bg-primary text-primary-foreground" : "hover:bg-primary/50 hover:text-primary-foreground"}`,
7303
7307
  children: capitalize(i(k.toLowerCase()))
7304
7308
  },
7305
7309
  `sidebar-${k}`
@@ -7313,7 +7317,7 @@ const registerChaiLibrary = (o, n) => {
7313
7317
  ] }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-6 p-4", children: N.map((k) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
7314
7318
  /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(k.toLowerCase())) }),
7315
7319
  /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: reject(
7316
- m === "all" ? filter(values(A), { group: k }) : values(A),
7320
+ h === "all" ? filter(values(A), { group: k }) : values(A),
7317
7321
  { hidden: !0 }
7318
7322
  ).map((j) => /* @__PURE__ */ jsx(
7319
7323
  CoreBlock,
@@ -7321,7 +7325,7 @@ const registerChaiLibrary = (o, n) => {
7321
7325
  parentId: r,
7322
7326
  position: a,
7323
7327
  block: j,
7324
- disabled: !canAcceptChildBlock(h, j.type) || !canBeNestedInside(h, j.type)
7328
+ disabled: !canAcceptChildBlock(m, j.type) || !canBeNestedInside(m, j.type)
7325
7329
  },
7326
7330
  j.type
7327
7331
  )) })
@@ -7334,13 +7338,13 @@ const registerChaiLibrary = (o, n) => {
7334
7338
  parentId: r = void 0,
7335
7339
  position: a = -1
7336
7340
  }) => {
7337
- const { t: l } = useTranslation(), [i, c] = useAtom$1(addBlockTabAtom), [, d] = useAtom$1(showPredefinedBlockCategoryAtom), p = useBuilderProp("importHTMLSupport", !0), { data: u } = usePartialBlocksList(), g = Object.keys(u || {}).length > 0, { hasPermission: h } = usePermissions();
7341
+ const { t: l } = useTranslation(), [i, c] = useAtom$1(addBlockTabAtom), [, d] = useAtom$1(showPredefinedBlockCategoryAtom), p = useBuilderProp("importHTMLSupport", !0), { data: u } = usePartialBlocksList(), g = Object.keys(u || {}).length > 0, { hasPermission: m } = usePermissions();
7338
7342
  useEffect(() => {
7339
7343
  i === "partials" && !g && c("library");
7340
7344
  }, [i, g, c]);
7341
- const m = useCallback(() => {
7345
+ const h = useCallback(() => {
7342
7346
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7343
- }, []), f = useChaiAddBlockTabs(), x = p && h(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7347
+ }, []), f = useChaiAddBlockTabs(), x = p && m(PERMISSIONS.IMPORT_HTML), b = useChaiLibraries().length > 0;
7344
7348
  return useEffect(() => {
7345
7349
  i === "library" && !b && c("core");
7346
7350
  }, [i, b, c]), /* @__PURE__ */ jsxs("div", { className: cn$2("flex h-full w-full flex-col overflow-hidden", o), children: [
@@ -7368,7 +7372,7 @@ const registerChaiLibrary = (o, n) => {
7368
7372
  b && /* @__PURE__ */ jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsx(UILibrariesPanel, { parentId: r, position: a }) }),
7369
7373
  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 }) }) }) }),
7370
7374
  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,
7371
- map(f, (v) => /* @__PURE__ */ jsx(TabsContent, { value: v.id, children: React__default.createElement(v.tabContent, { close: m, parentId: r, position: a }) }, `panel-add-block-${v.id}`))
7375
+ 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}`))
7372
7376
  ]
7373
7377
  }
7374
7378
  )
@@ -7490,7 +7494,7 @@ const registerChaiSaveToLibrary = (o) => {
7490
7494
  }, CANNOT_COPY_BLOCKS = !navigator.clipboard, CopyPasteBlocks = () => {
7491
7495
  const [o] = useBlocksStore(), [n] = useSelectedBlockIds(), { pasteBlocks: r } = usePasteBlocks(), [, a, l] = useCopyBlocks(), { t: i } = useTranslation(), c = useSelectedBlock(), d = useCallback(() => {
7492
7496
  const p = n.map((u) => {
7493
- const g = o.find((h) => h._id === u);
7497
+ const g = o.find((m) => m._id === u);
7494
7498
  return {
7495
7499
  id: u,
7496
7500
  data: g
@@ -7675,37 +7679,37 @@ const Input = ({ node: o }) => {
7675
7679
  var R;
7676
7680
  const { t: a } = useTranslation(), [l, , i] = useHiddenBlockIds(), [c] = useAtom$1(canvasIframeAtom), { hasPermission: d } = usePermissions();
7677
7681
  let p = null;
7678
- const u = o.children.length > 0, { highlightBlock: g, clearHighlight: h } = useBlockHighlight(), { id: m, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (I) => {
7679
- I.stopPropagation(), !l.includes(m) && o.toggle();
7680
- }, E = (I) => {
7681
- I.isInternal && (p = I.isOpen, I.isOpen && I.close());
7682
- }, _ = (I) => {
7683
- I.isInternal && p !== null && (p ? I.open() : I.close(), p = null);
7682
+ const u = o.children.length > 0, { highlightBlock: g, clearHighlight: m } = useBlockHighlight(), { id: h, data: f, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: v, handleClick: B } = o, w = (L) => {
7683
+ L.stopPropagation(), !l.includes(h) && o.toggle();
7684
+ }, E = (L) => {
7685
+ L.isInternal && (p = L.isOpen, L.isOpen && L.close());
7686
+ }, _ = (L) => {
7687
+ L.isInternal && p !== null && (p ? L.open() : L.close(), p = null);
7684
7688
  }, [S, A] = useAtom$1(currentAddSelection), N = () => {
7685
- var I;
7686
- C(), o.parent.isSelected || A((I = o == null ? void 0 : o.parent) == null ? void 0 : I.id);
7689
+ var L;
7690
+ C(), o.parent.isSelected || A((L = o == null ? void 0 : o.parent) == null ? void 0 : L.id);
7687
7691
  }, C = () => {
7688
7692
  A(null);
7689
- }, k = (I) => {
7690
- C(), I.stopPropagation(), !o.isOpen && !l.includes(m) && o.toggle(), B(I);
7693
+ }, k = (L) => {
7694
+ C(), L.stopPropagation(), !o.isOpen && !l.includes(h) && o.toggle(), B(L);
7691
7695
  };
7692
7696
  useEffect(() => {
7693
- const I = setTimeout(() => {
7694
- y && !o.isOpen && !b && !l.includes(m) && o.toggle();
7697
+ const L = setTimeout(() => {
7698
+ y && !o.isOpen && !b && !l.includes(h) && o.toggle();
7695
7699
  }, 500);
7696
- return () => clearTimeout(I);
7700
+ return () => clearTimeout(L);
7697
7701
  }, [y, o, b]);
7698
- const j = (I, D) => {
7699
- const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${I}]`);
7702
+ const j = (L, D) => {
7703
+ const O = c.contentDocument || c.contentWindow.document, P = O.querySelector(`[data-block-id=${L}]`);
7700
7704
  P && P.setAttribute("data-drop", D);
7701
7705
  const $ = P.getBoundingClientRect(), M = c.getBoundingClientRect();
7702
7706
  $.top >= M.top && $.left >= M.left && $.bottom <= M.bottom && $.right <= M.right || (O.documentElement.scrollTop = P.offsetTop - M.top);
7703
- }, T = (I) => {
7707
+ }, T = (L) => {
7704
7708
  C();
7705
7709
  const D = get(o, "parent.id");
7706
- D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: I }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: I });
7710
+ D !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: D, position: L }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: L });
7707
7711
  };
7708
- if (m === ROOT_TEMP_KEY)
7712
+ if (h === ROOT_TEMP_KEY)
7709
7713
  return /* @__PURE__ */ jsxs("div", { className: "group relative w-full cursor-pointer", children: [
7710
7714
  /* @__PURE__ */ jsx("br", {}),
7711
7715
  d(PERMISSIONS.ADD_BLOCK) && /* @__PURE__ */ jsx(
@@ -7723,33 +7727,33 @@ const Input = ({ node: o }) => {
7723
7727
  ),
7724
7728
  /* @__PURE__ */ jsx("br", {})
7725
7729
  ] });
7726
- const L = useMemo(() => has(f, "_libBlockId") && !isEmpty(f._libBlockId) && (d(PERMISSIONS.CREATE_LIBRARY_BLOCK) || d(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [f, d]);
7730
+ const I = useMemo(() => has(f, "_libBlockId") && !isEmpty(f._libBlockId) && (d(PERMISSIONS.CREATE_LIBRARY_BLOCK) || d(PERMISSIONS.EDIT_LIBRARY_BLOCK)), [f, d]);
7727
7731
  return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(
7728
7732
  "div",
7729
7733
  {
7730
- onMouseEnter: () => g(m),
7731
- onMouseLeave: () => h(),
7734
+ onMouseEnter: () => g(h),
7735
+ onMouseLeave: () => m(),
7732
7736
  onClick: k,
7733
7737
  style: n,
7734
- "data-node-id": m,
7735
- ref: l.includes(m) ? null : r,
7738
+ "data-node-id": h,
7739
+ ref: l.includes(h) ? null : r,
7736
7740
  onDragStart: () => E(o),
7737
7741
  onDragEnd: () => _(o),
7738
- onDragOver: (I) => {
7739
- I.preventDefault(), j(m, "yes");
7742
+ onDragOver: (L) => {
7743
+ L.preventDefault(), j(h, "yes");
7740
7744
  },
7741
- onDragLeave: (I) => {
7742
- I.preventDefault(), j(m, "no");
7745
+ onDragLeave: (L) => {
7746
+ L.preventDefault(), j(h, "no");
7743
7747
  },
7744
- onDrop: (I) => {
7745
- I.preventDefault(), j(m, "no");
7748
+ onDrop: (L) => {
7749
+ L.preventDefault(), j(h, "no");
7746
7750
  },
7747
7751
  children: [
7748
7752
  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(
7749
7753
  "div",
7750
7754
  {
7751
- onClick: (I) => {
7752
- I.stopPropagation(), T(o.childIndex);
7755
+ onClick: (L) => {
7756
+ L.stopPropagation(), T(o.childIndex);
7753
7757
  },
7754
7758
  onMouseEnter: N,
7755
7759
  onMouseLeave: C,
@@ -7766,8 +7770,8 @@ const Input = ({ node: o }) => {
7766
7770
  y && canAcceptChildBlock(f._type, "Icon") ? "bg-green-200" : "",
7767
7771
  (o == null ? void 0 : o.id) === S ? "bg-primary/10" : "",
7768
7772
  b && "opacity-20",
7769
- l.includes(m) ? "opacity-50" : "",
7770
- L && x && "bg-primary/20 text-primary"
7773
+ l.includes(h) ? "opacity-50" : "",
7774
+ I && x && "bg-primary/20 text-primary"
7771
7775
  ),
7772
7776
  children: [
7773
7777
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -7783,8 +7787,8 @@ const Input = ({ node: o }) => {
7783
7787
  {
7784
7788
  className: cn(
7785
7789
  "leading-1 flex items-center",
7786
- L && "text-primary/60",
7787
- L && x && "text-primary/80"
7790
+ I && "text-primary/60",
7791
+ I && x && "text-primary/80"
7788
7792
  ),
7789
7793
  children: [
7790
7794
  /* @__PURE__ */ jsx(TypeIcon, { type: f == null ? void 0 : f._type }),
@@ -7792,8 +7796,8 @@ const Input = ({ node: o }) => {
7792
7796
  "div",
7793
7797
  {
7794
7798
  className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
7795
- onDoubleClick: (I) => {
7796
- I.stopPropagation(), o.edit(), o.deselect();
7799
+ onDoubleClick: (L) => {
7800
+ L.stopPropagation(), o.edit(), o.deselect();
7797
7801
  },
7798
7802
  children: /* @__PURE__ */ jsx("span", { children: (f == null ? void 0 : f._name) || (f == null ? void 0 : f._type.split("/").pop()) })
7799
7803
  }
@@ -7803,11 +7807,11 @@ const Input = ({ node: o }) => {
7803
7807
  )
7804
7808
  ] }),
7805
7809
  /* @__PURE__ */ jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
7806
- canAddChildBlock(f == null ? void 0 : f._type) && !l.includes(m) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7810
+ canAddChildBlock(f == null ? void 0 : f._type) && !l.includes(h) && d(PERMISSIONS.ADD_BLOCK) ? /* @__PURE__ */ jsxs(Tooltip, { children: [
7807
7811
  /* @__PURE__ */ jsx(
7808
7812
  TooltipTrigger,
7809
7813
  {
7810
- onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: m }),
7814
+ onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: h }),
7811
7815
  className: "cursor-pointer rounded bg-transparent",
7812
7816
  asChild: !0,
7813
7817
  children: /* @__PURE__ */ jsx(PlusIcon, { className: "h-3 w-3" })
@@ -7819,8 +7823,8 @@ const Input = ({ node: o }) => {
7819
7823
  /* @__PURE__ */ jsx(
7820
7824
  TooltipTrigger,
7821
7825
  {
7822
- onClick: (I) => {
7823
- I.stopPropagation(), i(m), o.isOpen && o.toggle();
7826
+ onClick: (L) => {
7827
+ L.stopPropagation(), i(h), o.isOpen && o.toggle();
7824
7828
  },
7825
7829
  className: "cursor-pointer rounded bg-transparent",
7826
7830
  asChild: !0,
@@ -7829,7 +7833,7 @@ const Input = ({ node: o }) => {
7829
7833
  ),
7830
7834
  /* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", side: "bottom", children: a("Hide block") })
7831
7835
  ] }),
7832
- /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: m, children: /* @__PURE__ */ jsx(MoreVertical, { size: "15" }) })
7836
+ /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: h, children: /* @__PURE__ */ jsx(MoreVertical, { size: "15" }) })
7833
7837
  ] })
7834
7838
  ]
7835
7839
  }
@@ -8094,9 +8098,9 @@ const Input = ({ node: o }) => {
8094
8098
  )
8095
8099
  ] });
8096
8100
  }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
8097
- const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), { hasPermission: c } = usePermissions(), [d, p] = useTheme(), u = useThemeOptions(), { t: g } = useTranslation(), h = (v) => {
8101
+ const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), { hasPermission: c } = usePermissions(), [d, p] = useTheme(), u = useThemeOptions(), { t: g } = useTranslation(), m = (v) => {
8098
8102
  a(v);
8099
- }, m = () => {
8103
+ }, h = () => {
8100
8104
  const v = l.find((B) => Object.keys(B)[0] === r);
8101
8105
  if (v) {
8102
8106
  const B = Object.values(v)[0];
@@ -8161,7 +8165,7 @@ const Input = ({ node: o }) => {
8161
8165
  "select",
8162
8166
  {
8163
8167
  value: r,
8164
- onChange: (v) => h(v.target.value),
8168
+ onChange: (v) => m(v.target.value),
8165
8169
  className: "w-full space-y-0.5 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8166
8170
  children: [
8167
8171
  /* @__PURE__ */ jsx("option", { value: "", children: "Select preset" }),
@@ -8176,7 +8180,7 @@ const Input = ({ node: o }) => {
8176
8180
  className: "w-full text-sm",
8177
8181
  disabled: r === "",
8178
8182
  variant: "default",
8179
- onClick: m,
8183
+ onClick: h,
8180
8184
  children: g("Apply")
8181
8185
  }
8182
8186
  ) })
@@ -8670,14 +8674,14 @@ function QuickPrompts({ onClick: o }) {
8670
8674
  ) }) });
8671
8675
  }
8672
8676
  const AIUserPrompt = ({ blockId: o }) => {
8673
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, g] = useState(), h = useRef(null), m = useRef(null);
8677
+ 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);
8674
8678
  useEffect(() => {
8675
8679
  var x;
8676
- (x = h.current) == null || x.focus();
8680
+ (x = m.current) == null || x.focus();
8677
8681
  }, []);
8678
8682
  const f = (x) => {
8679
8683
  const { usage: y } = x || {};
8680
- !l && y && g(y), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
8684
+ !l && y && g(y), h.current = setTimeout(() => g(void 0), 1e4), l || c("");
8681
8685
  };
8682
8686
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
8683
8687
  /* @__PURE__ */ jsxs(
@@ -8695,14 +8699,14 @@ const AIUserPrompt = ({ blockId: o }) => {
8695
8699
  /* @__PURE__ */ jsx(
8696
8700
  Textarea,
8697
8701
  {
8698
- ref: h,
8702
+ ref: m,
8699
8703
  value: i,
8700
8704
  onChange: (x) => c(x.target.value),
8701
8705
  placeholder: n("Ask AI to edit content"),
8702
8706
  className: "w-full",
8703
8707
  rows: 3,
8704
8708
  onKeyDown: (x) => {
8705
- x.key === "Enter" && (x.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, f));
8709
+ x.key === "Enter" && (x.preventDefault(), h.current && clearTimeout(h.current), g(void 0), r("content", o, i, f));
8706
8710
  }
8707
8711
  }
8708
8712
  ),
@@ -8712,7 +8716,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8712
8716
  {
8713
8717
  disabled: i.trim().length < 5 || a,
8714
8718
  onClick: () => {
8715
- m.current && clearTimeout(m.current), g(void 0), r("content", o, i, f);
8719
+ h.current && clearTimeout(h.current), g(void 0), r("content", o, i, f);
8716
8720
  },
8717
8721
  variant: "default",
8718
8722
  className: "w-fit",
@@ -8745,7 +8749,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8745
8749
  QuickPrompts,
8746
8750
  {
8747
8751
  onClick: (x) => {
8748
- m.current && clearTimeout(m.current), g(void 0), r("content", o, x, f);
8752
+ h.current && clearTimeout(h.current), g(void 0), r("content", o, x, f);
8749
8753
  }
8750
8754
  }
8751
8755
  )
@@ -8755,13 +8759,13 @@ const AIUserPrompt = ({ blockId: o }) => {
8755
8759
  ] }) }) : null
8756
8760
  ] });
8757
8761
  }, AISetContext = () => {
8758
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, g] = useState(!1), h = useRef(null);
8762
+ const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, g] = useState(!1), m = useRef(null);
8759
8763
  useEffect(() => {
8760
8764
  n && a(n);
8761
8765
  }, [n]);
8762
- const m = async () => {
8766
+ const h = async () => {
8763
8767
  try {
8764
- d(!0), u(null), await i(r), toast.success(o("Updated AI Context")), h.current.click();
8768
+ d(!0), u(null), await i(r), toast.success(o("Updated AI Context")), m.current.click();
8765
8769
  } catch (f) {
8766
8770
  u(f);
8767
8771
  } finally {
@@ -8777,7 +8781,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8777
8781
  type: "single",
8778
8782
  collapsible: !0,
8779
8783
  children: /* @__PURE__ */ jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
8780
- /* @__PURE__ */ jsx(AccordionTrigger, { ref: h, className: "border-0 border-border py-2", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: o("AI Context") }) }) }),
8784
+ /* @__PURE__ */ jsx(AccordionTrigger, { ref: m, className: "border-0 border-border py-2", children: /* @__PURE__ */ jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsx("span", { className: "font-medium", children: o("AI Context") }) }) }),
8781
8785
  /* @__PURE__ */ jsxs(AccordionContent, { children: [
8782
8786
  /* @__PURE__ */ jsx(
8783
8787
  Textarea,
@@ -8789,7 +8793,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8789
8793
  className: "mt-1 w-full",
8790
8794
  rows: 10,
8791
8795
  onKeyDown: (f) => {
8792
- f.key === "Enter" && (f.preventDefault(), m());
8796
+ f.key === "Enter" && (f.preventDefault(), h());
8793
8797
  }
8794
8798
  }
8795
8799
  ),
@@ -8801,7 +8805,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8801
8805
  Button,
8802
8806
  {
8803
8807
  disabled: r.trim().length < 5,
8804
- onClick: () => m(),
8808
+ onClick: () => h(),
8805
8809
  variant: "default",
8806
8810
  className: "w-fit",
8807
8811
  size: "sm",
@@ -8830,7 +8834,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8830
8834
  AlertDialogAction,
8831
8835
  {
8832
8836
  onClick: () => {
8833
- a(""), m();
8837
+ a(""), h();
8834
8838
  },
8835
8839
  children: o("Yes, Delete")
8836
8840
  }
@@ -8891,7 +8895,7 @@ function AIChatPanel() {
8891
8895
  }, [o]), useEffect(() => {
8892
8896
  g.current && (g.current.style.height = "auto", g.current.style.height = `${Math.min(g.current.scrollHeight, 120)}px`);
8893
8897
  }, [r]);
8894
- const h = async () => {
8898
+ const m = async () => {
8895
8899
  if (!r.trim() && !c) return;
8896
8900
  const b = {
8897
8901
  id: Date.now().toString(),
@@ -8908,8 +8912,8 @@ function AIChatPanel() {
8908
8912
  };
8909
8913
  n((B) => [...B, v]), i(!1), d(null);
8910
8914
  }, 1500);
8911
- }, m = (b) => {
8912
- b.key === "Enter" && !b.shiftKey && (b.preventDefault(), h());
8915
+ }, h = (b) => {
8916
+ b.key === "Enter" && !b.shiftKey && (b.preventDefault(), m());
8913
8917
  }, f = (b) => {
8914
8918
  var B;
8915
8919
  const v = (B = b.target.files) == null ? void 0 : B[0];
@@ -8982,7 +8986,7 @@ function AIChatPanel() {
8982
8986
  ref: g,
8983
8987
  value: r,
8984
8988
  onChange: (b) => a(b.target.value),
8985
- onKeyDown: m,
8989
+ onKeyDown: h,
8986
8990
  placeholder: "Ask something...",
8987
8991
  className: "max-h-[120px] min-h-[40px] resize-none border-0 bg-muted/50 py-2.5 pr-10 focus-visible:ring-1"
8988
8992
  }
@@ -9004,7 +9008,7 @@ function AIChatPanel() {
9004
9008
  {
9005
9009
  size: "sm",
9006
9010
  className: "h-10 px-3",
9007
- onClick: h,
9011
+ onClick: m,
9008
9012
  disabled: l || !r.trim() && !c,
9009
9013
  children: [
9010
9014
  /* @__PURE__ */ jsx(Send, { className: "mr-1 h-4 w-4" }),
@@ -9112,18 +9116,18 @@ const AiAssistant = () => {
9112
9116
  preloadedAttributes: n = [],
9113
9117
  onAttributesChange: r
9114
9118
  }) {
9115
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [h, m] = useState(""), f = useRef(null), x = useRef(null), y = usePageExternalData();
9119
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [m, h] = useState(""), f = useRef(null), x = useRef(null), y = usePageExternalData();
9116
9120
  useEffect(() => {
9117
9121
  l(n);
9118
9122
  }, [n]);
9119
9123
  const b = () => {
9120
9124
  if (i.startsWith("@")) {
9121
- m("Attribute keys cannot start with '@'");
9125
+ h("Attribute keys cannot start with '@'");
9122
9126
  return;
9123
9127
  }
9124
9128
  if (i) {
9125
9129
  const S = [...a, { key: i, value: d }];
9126
- r(S), l(a), c(""), p(""), m("");
9130
+ r(S), l(a), c(""), p(""), h("");
9127
9131
  }
9128
9132
  }, v = (S) => {
9129
9133
  const A = a.filter((N, C) => C !== S);
@@ -9132,22 +9136,22 @@ const AiAssistant = () => {
9132
9136
  g(S), c(a[S].key), p(a[S].value);
9133
9137
  }, w = () => {
9134
9138
  if (i.startsWith("@")) {
9135
- m("Attribute keys cannot start with '@'");
9139
+ h("Attribute keys cannot start with '@'");
9136
9140
  return;
9137
9141
  }
9138
9142
  if (u !== null && i) {
9139
9143
  const S = [...a];
9140
- S[u] = { key: i, value: d }, r(S), l(S), g(null), c(""), p(""), m("");
9144
+ S[u] = { key: i, value: d }, r(S), l(S), g(null), c(""), p(""), h("");
9141
9145
  }
9142
9146
  }, E = (S) => {
9143
9147
  S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? w() : b());
9144
9148
  }, _ = useCallback((S) => {
9145
9149
  const A = (k) => /[.,!?;:]/.test(k), N = (k, j, T) => {
9146
- let L = "", R = "";
9147
- const I = j > 0 ? k[j - 1] : "", D = j < k.length ? k[j] : "";
9148
- return j > 0 && (I === "." || !A(I) && I !== " ") && (L = " "), j < k.length && !A(D) && D !== " " && (R = " "), {
9149
- text: L + T + R,
9150
- prefixLength: L.length,
9150
+ let I = "", R = "";
9151
+ const L = j > 0 ? k[j - 1] : "", D = j < k.length ? k[j] : "";
9152
+ return j > 0 && (L === "." || !A(L) && L !== " ") && (I = " "), j < k.length && !A(D) && D !== " " && (R = " "), {
9153
+ text: I + T + R,
9154
+ prefixLength: I.length,
9151
9155
  suffixLength: R.length
9152
9156
  };
9153
9157
  }, C = x.current;
@@ -9158,7 +9162,7 @@ const AiAssistant = () => {
9158
9162
  p($);
9159
9163
  return;
9160
9164
  }
9161
- const R = `{{${S}}}`, { text: I } = N(j, k, R), D = j.slice(0, k) + I + j.slice(k);
9165
+ const R = `{{${S}}}`, { text: L } = N(j, k, R), D = j.slice(0, k) + L + j.slice(k);
9162
9166
  p(D);
9163
9167
  }
9164
9168
  }, []);
@@ -9213,7 +9217,7 @@ const AiAssistant = () => {
9213
9217
  ] })
9214
9218
  ] }),
9215
9219
  /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx(Button, { type: "submit", disabled: !i.length, variant: "default", size: "sm", className: "h-8 w-24 text-xs", children: u !== null ? "Save" : "Add" }) }),
9216
- h && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: h })
9220
+ m && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: m })
9217
9221
  ]
9218
9222
  }
9219
9223
  ),
@@ -9344,9 +9348,9 @@ const RootLayout = () => {
9344
9348
  usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
9345
9349
  r("outline");
9346
9350
  });
9347
- const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), h = useCallback((S) => {
9351
+ const p = useSidebarDefaultPanels(), u = useChaiSidebarPanels("top"), g = useChaiSidebarPanels("bottom"), m = useCallback((S) => {
9348
9352
  S.preventDefault();
9349
- }, []), m = useCallback(
9353
+ }, []), h = useCallback(
9350
9354
  (S) => {
9351
9355
  r(n === S ? null : S);
9352
9356
  },
@@ -9375,15 +9379,15 @@ const RootLayout = () => {
9375
9379
  }, [n, x]);
9376
9380
  const _ = useCallback(
9377
9381
  (S) => {
9378
- m(S);
9382
+ h(S);
9379
9383
  },
9380
- [m]
9384
+ [h]
9381
9385
  );
9382
9386
  return /* @__PURE__ */ jsx("div", { dir: y, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
9383
9387
  /* @__PURE__ */ jsxs(
9384
9388
  "div",
9385
9389
  {
9386
- onContextMenu: h,
9390
+ onContextMenu: m,
9387
9391
  className: "flex h-screen max-h-full flex-col bg-background text-foreground",
9388
9392
  children: [
9389
9393
  /* @__PURE__ */ jsx("div", { className: "flex h-[50px] w-screen items-center border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(o, {}) }) }),
@@ -9471,19 +9475,27 @@ const RootLayout = () => {
9471
9475
  }
9472
9476
  ),
9473
9477
  /* @__PURE__ */ jsx(AddBlocksDialog, {}),
9474
- n !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: "p-0 sm:max-w-full", style: { width: `${v}px` }, children: [
9475
- /* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border p-4 pb-2", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
9476
- /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
9477
- /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9478
- ] }) }),
9479
- /* @__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), {
9480
- close: E
9481
- }) }) })
9482
- ] }) }),
9478
+ n !== null && get(b, "view") === "drawer" && /* @__PURE__ */ jsx(Sheet, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(
9479
+ SheetContent,
9480
+ {
9481
+ side: "left",
9482
+ className: "flex flex-col gap-0 p-0 sm:max-w-full",
9483
+ style: { width: `${v}px` },
9484
+ children: [
9485
+ /* @__PURE__ */ jsx(SheetHeader, { className: "border-b border-border px-2 py-2.5", children: /* @__PURE__ */ jsxs(SheetTitle, { className: "flex items-center gap-2", children: [
9486
+ /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
9487
+ /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9488
+ ] }) }),
9489
+ /* @__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), {
9490
+ close: E
9491
+ }) }) })
9492
+ ]
9493
+ }
9494
+ ) }),
9483
9495
  " ",
9484
- n !== null && get(b, "view") === "modal" && /* @__PURE__ */ jsx(Dialog, { open: !0, onOpenChange: () => w(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "p-0", style: { maxWidth: `${v}px` }, children: [
9485
- /* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border p-4 pb-2", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
9486
- /* @__PURE__ */ jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(b, "icon", null) }),
9496
+ 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: [
9497
+ /* @__PURE__ */ jsx(DialogHeader, { className: "border-b border-border px-2 py-3.5", children: /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2", children: [
9498
+ /* @__PURE__ */ jsx("span", { className: "inline-block", children: get(b, "icon", null) }),
9487
9499
  /* @__PURE__ */ jsx("span", { children: f(get(b, "label", "")) })
9488
9500
  ] }) }),
9489
9501
  /* @__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), {
@@ -9546,18 +9558,35 @@ const RootLayout = () => {
9546
9558
  const l = first(o);
9547
9559
  isString(l) && (a = [l, ...getParentNodeIds(n, l)]), r(a);
9548
9560
  }, [o, n, r]);
9549
- }, ScreenTooSmall = () => /* @__PURE__ */ jsx("section", { className: "h-screen w-screen bg-gray-900 py-12 sm:py-16 lg:py-20 xl:hidden", children: /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-7xl px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-md text-center", children: [
9561
+ }, ScreenTooSmall = () => /* @__PURE__ */ jsx("section", { className: "fixed inset-0 z-50 flex h-screen w-screen items-center justify-center bg-white bg-[linear-gradient(to_right,#f3f4f6_1px,transparent_1px),linear-gradient(to_bottom,#f3f4f6_1px,transparent_1px)] bg-[size:10px_10px] py-12 sm:py-16 lg:py-20 xl:hidden", children: /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-7xl px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-md space-y-6 text-center", children: [
9550
9562
  /* @__PURE__ */ jsx(
9551
9563
  "img",
9552
9564
  {
9553
- src: "https://fldwljgzcktqnysdkxnn.supabase.co/storage/v1/object/public/chaibuilder-blob-storage/175ac8d8-37fe-4707-bb4a-3c0cd6a6db75/gVH7O-Ir_400x400.png",
9565
+ src: "https://ucarecdn.com/fbfc3b05-cb73-4e99-92a2-3a367b7c36cd/",
9554
9566
  alt: "Chai Builder",
9555
- className: "mx-auto w-14 rounded-full"
9567
+ className: "mx-auto h-20 w-20 rounded-full shadow-lg transition-transform duration-300 hover:scale-105"
9556
9568
  }
9557
9569
  ),
9558
- /* @__PURE__ */ jsx("br", {}),
9559
- /* @__PURE__ */ jsx("h2", { className: "text-4xl font-bold", children: "Screen too small" }),
9560
- /* @__PURE__ */ jsx("p", { className: "mt-6 text-sm font-medium leading-6 text-white text-opacity-70", children: "Please view this page on greater than 1280px screen width." })
9570
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
9571
+ /* @__PURE__ */ jsx("h2", { className: "text-5xl font-bold tracking-tight text-gray-900", children: "Screen too small" }),
9572
+ /* @__PURE__ */ jsxs("p", { className: "mx-auto max-w-sm text-sm leading-7 text-gray-600", children: [
9573
+ "Please view this page on greater than ",
9574
+ /* @__PURE__ */ jsx("strong", { className: "font-medium", children: "1280px" }),
9575
+ " screen width for the best experience."
9576
+ ] })
9577
+ ] }),
9578
+ /* @__PURE__ */ jsx("div", { className: "pt-4", children: /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center rounded-full bg-gray-100 px-4 py-2 text-sm text-gray-700", children: [
9579
+ /* @__PURE__ */ jsx("svg", { className: "mr-2 h-5 w-5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx(
9580
+ "path",
9581
+ {
9582
+ strokeLinecap: "round",
9583
+ strokeLinejoin: "round",
9584
+ strokeWidth: "2",
9585
+ d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
9586
+ }
9587
+ ) }),
9588
+ "Minimum width: 1280px"
9589
+ ] }) })
9561
9590
  ] }) }) });
9562
9591
  function getFromQueryParams(o) {
9563
9592
  var r;
@@ -9612,17 +9641,17 @@ const FEATURE_TOGGLES = {
9612
9641
  for (const i of n.p)
9613
9642
  l.add(i);
9614
9643
  return l;
9615
- }, 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 = (m, ...f) => m.read(...f), p = (m, ...f) => m.write(...f), u = (m, f) => {
9644
+ }, 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) => {
9616
9645
  var x;
9617
- return (x = m.unstable_onInit) == null ? void 0 : x.call(m, f);
9618
- }, g = (m, f) => {
9646
+ return (x = h.unstable_onInit) == null ? void 0 : x.call(h, f);
9647
+ }, g = (h, f) => {
9619
9648
  var x;
9620
- return (x = m.onMount) == null ? void 0 : x.call(m, f);
9621
- }, ...h) => {
9622
- const m = h[0] || ((A) => {
9649
+ return (x = h.onMount) == null ? void 0 : x.call(h, f);
9650
+ }, ...m) => {
9651
+ const h = m[0] || ((A) => {
9623
9652
  let N = o.get(A);
9624
9653
  return N || (N = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(A, N), u == null || u(A, S)), N;
9625
- }), f = h[1] || (() => {
9654
+ }), f = m[1] || (() => {
9626
9655
  let A, N;
9627
9656
  const C = (k) => {
9628
9657
  try {
@@ -9635,16 +9664,16 @@ const FEATURE_TOGGLES = {
9635
9664
  c.f && C(c.f);
9636
9665
  const k = /* @__PURE__ */ new Set(), j = k.add.bind(k);
9637
9666
  a.forEach((T) => {
9638
- var L;
9639
- return (L = n.get(T)) == null ? void 0 : L.l.forEach(j);
9667
+ var I;
9668
+ return (I = n.get(T)) == null ? void 0 : I.l.forEach(j);
9640
9669
  }), a.clear(), i.forEach(j), i.clear(), l.forEach(j), l.clear(), k.forEach(C), a.size && x();
9641
9670
  } while (a.size || i.size || l.size);
9642
9671
  if (A)
9643
9672
  throw N;
9644
- }), x = h[2] || (() => {
9673
+ }), x = m[2] || (() => {
9645
9674
  const A = [], N = /* @__PURE__ */ new WeakSet(), C = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
9646
9675
  for (; k.length; ) {
9647
- const j = k[k.length - 1], T = m(j);
9676
+ const j = k[k.length - 1], T = h(j);
9648
9677
  if (C.has(j)) {
9649
9678
  k.pop();
9650
9679
  continue;
@@ -9654,22 +9683,22 @@ const FEATURE_TOGGLES = {
9654
9683
  continue;
9655
9684
  }
9656
9685
  N.add(j);
9657
- for (const L of getMountedOrPendingDependents(j, T, n))
9658
- N.has(L) || k.push(L);
9686
+ for (const I of getMountedOrPendingDependents(j, T, n))
9687
+ N.has(I) || k.push(I);
9659
9688
  }
9660
9689
  for (let j = A.length - 1; j >= 0; --j) {
9661
- const [T, L] = A[j];
9690
+ const [T, I] = A[j];
9662
9691
  let R = !1;
9663
- for (const I of L.d.keys())
9664
- if (I !== T && a.has(I)) {
9692
+ for (const L of I.d.keys())
9693
+ if (L !== T && a.has(L)) {
9665
9694
  R = !0;
9666
9695
  break;
9667
9696
  }
9668
9697
  R && (y(T), B(T)), r.delete(T);
9669
9698
  }
9670
- }), y = h[3] || ((A) => {
9699
+ }), y = m[3] || ((A) => {
9671
9700
  var N, C;
9672
- const k = m(A);
9701
+ const k = h(A);
9673
9702
  if (isAtomStateInitialized(k) && (n.has(A) && r.get(A) !== k.n || Array.from(k.d).every(
9674
9703
  ([P, $]) => (
9675
9704
  // Recursively, read the atom state of the dependency, and
@@ -9682,13 +9711,13 @@ const FEATURE_TOGGLES = {
9682
9711
  let j = !0;
9683
9712
  const T = () => {
9684
9713
  n.has(A) && (B(A), x(), f());
9685
- }, L = (P) => {
9714
+ }, I = (P) => {
9686
9715
  var $;
9687
9716
  if (isSelfAtom(A, P)) {
9688
- const U = m(P);
9717
+ const U = h(P);
9689
9718
  if (!isAtomStateInitialized(U))
9690
9719
  if (hasInitialValue(P))
9691
- setAtomStateValueOrPromise(P, P.init, m);
9720
+ setAtomStateValueOrPromise(P, P.init, h);
9692
9721
  else
9693
9722
  throw new Error("no atom init");
9694
9723
  return returnAtomValue(U);
@@ -9700,25 +9729,25 @@ const FEATURE_TOGGLES = {
9700
9729
  k.d.set(P, M.n), isPendingPromise(k.v) && addPendingPromiseToDependency(A, k.v, M), ($ = n.get(P)) == null || $.t.add(A), j || T();
9701
9730
  }
9702
9731
  };
9703
- let R, I;
9732
+ let R, L;
9704
9733
  const D = {
9705
9734
  get signal() {
9706
9735
  return R || (R = new AbortController()), R.signal;
9707
9736
  },
9708
9737
  get setSelf() {
9709
- return !I && isActuallyWritableAtom(A) && (I = (...P) => {
9738
+ return !L && isActuallyWritableAtom(A) && (L = (...P) => {
9710
9739
  if (!j)
9711
9740
  try {
9712
9741
  return v(A, ...P);
9713
9742
  } finally {
9714
9743
  x(), f();
9715
9744
  }
9716
- }), I;
9745
+ }), L;
9717
9746
  }
9718
9747
  }, O = k.n;
9719
9748
  try {
9720
- const P = d(A, L, D);
9721
- return setAtomStateValueOrPromise(A, P, m), isPromiseLike$1(P) && ((N = P.onCancel) == null || N.call(P, () => R == null ? void 0 : R.abort()), P.then(
9749
+ const P = d(A, I, D);
9750
+ return setAtomStateValueOrPromise(A, P, h), isPromiseLike$1(P) && ((N = P.onCancel) == null || N.call(P, () => R == null ? void 0 : R.abort()), P.then(
9722
9751
  T,
9723
9752
  T
9724
9753
  )), k;
@@ -9727,29 +9756,29 @@ const FEATURE_TOGGLES = {
9727
9756
  } finally {
9728
9757
  j = !1, O !== k.n && r.get(A) === O && (r.set(A, k.n), a.add(A), (C = c.c) == null || C.call(c, A));
9729
9758
  }
9730
- }), b = h[4] || ((A) => {
9759
+ }), b = m[4] || ((A) => {
9731
9760
  const N = [A];
9732
9761
  for (; N.length; ) {
9733
- const C = N.pop(), k = m(C);
9762
+ const C = N.pop(), k = h(C);
9734
9763
  for (const j of getMountedOrPendingDependents(C, k, n)) {
9735
- const T = m(j);
9764
+ const T = h(j);
9736
9765
  r.set(j, T.n), N.push(j);
9737
9766
  }
9738
9767
  }
9739
- }), v = h[5] || ((A, ...N) => {
9768
+ }), v = m[5] || ((A, ...N) => {
9740
9769
  let C = !0;
9741
- const k = (T) => returnAtomValue(y(T)), j = (T, ...L) => {
9770
+ const k = (T) => returnAtomValue(y(T)), j = (T, ...I) => {
9742
9771
  var R;
9743
- const I = m(T);
9772
+ const L = h(T);
9744
9773
  try {
9745
9774
  if (isSelfAtom(A, T)) {
9746
9775
  if (!hasInitialValue(T))
9747
9776
  throw new Error("atom not writable");
9748
- const D = I.n, O = L[0];
9749
- setAtomStateValueOrPromise(T, O, m), B(T), D !== I.n && (a.add(T), (R = c.c) == null || R.call(c, T), b(T));
9777
+ const D = L.n, O = I[0];
9778
+ setAtomStateValueOrPromise(T, O, h), B(T), D !== L.n && (a.add(T), (R = c.c) == null || R.call(c, T), b(T));
9750
9779
  return;
9751
9780
  } else
9752
- return v(T, ...L);
9781
+ return v(T, ...I);
9753
9782
  } finally {
9754
9783
  C || (x(), f());
9755
9784
  }
@@ -9759,14 +9788,14 @@ const FEATURE_TOGGLES = {
9759
9788
  } finally {
9760
9789
  C = !1;
9761
9790
  }
9762
- }), B = h[6] || ((A) => {
9791
+ }), B = m[6] || ((A) => {
9763
9792
  var N;
9764
- const C = m(A), k = n.get(A);
9793
+ const C = h(A), k = n.get(A);
9765
9794
  if (k && !isPendingPromise(C.v)) {
9766
9795
  for (const [j, T] of C.d)
9767
9796
  if (!k.d.has(j)) {
9768
- const L = m(j);
9769
- w(j).t.add(A), k.d.add(j), T !== L.n && (a.add(j), (N = c.c) == null || N.call(c, j), b(j));
9797
+ const I = h(j);
9798
+ w(j).t.add(A), k.d.add(j), T !== I.n && (a.add(j), (N = c.c) == null || N.call(c, j), b(j));
9770
9799
  }
9771
9800
  for (const j of k.d || [])
9772
9801
  if (!C.d.has(j)) {
@@ -9775,9 +9804,9 @@ const FEATURE_TOGGLES = {
9775
9804
  T == null || T.t.delete(A);
9776
9805
  }
9777
9806
  }
9778
- }), w = h[7] || ((A) => {
9807
+ }), w = m[7] || ((A) => {
9779
9808
  var N;
9780
- const C = m(A);
9809
+ const C = h(A);
9781
9810
  let k = n.get(A);
9782
9811
  if (!k) {
9783
9812
  y(A);
@@ -9790,7 +9819,7 @@ const FEATURE_TOGGLES = {
9790
9819
  }, n.set(A, k), (N = c.m) == null || N.call(c, A), isActuallyWritableAtom(A)) {
9791
9820
  const j = () => {
9792
9821
  let T = !0;
9793
- const L = (...R) => {
9822
+ const I = (...R) => {
9794
9823
  try {
9795
9824
  return v(A, ...R);
9796
9825
  } finally {
@@ -9798,7 +9827,7 @@ const FEATURE_TOGGLES = {
9798
9827
  }
9799
9828
  };
9800
9829
  try {
9801
- const R = g(A, L);
9830
+ const R = g(A, I);
9802
9831
  R && (k.u = () => {
9803
9832
  T = !0;
9804
9833
  try {
@@ -9815,9 +9844,9 @@ const FEATURE_TOGGLES = {
9815
9844
  }
9816
9845
  }
9817
9846
  return k;
9818
- }), E = h[8] || ((A) => {
9847
+ }), E = m[8] || ((A) => {
9819
9848
  var N;
9820
- const C = m(A);
9849
+ const C = h(A);
9821
9850
  let k = n.get(A);
9822
9851
  if (k && !k.l.size && !Array.from(k.t).some((j) => {
9823
9852
  var T;
@@ -9846,7 +9875,7 @@ const FEATURE_TOGGLES = {
9846
9875
  u,
9847
9876
  g,
9848
9877
  // building-block functions
9849
- m,
9878
+ h,
9850
9879
  f,
9851
9880
  x,
9852
9881
  y,