@chaibuilder/sdk 2.0.0-beta.35 → 2.0.0-beta.36

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.
Files changed (36) hide show
  1. package/dist/{ChaiThemeFn--DgGggh_.js → ChaiThemeFn-BUgkaTMi.js} +1 -1
  2. package/dist/{ChaiThemeFn-bugxb1Cl.cjs → ChaiThemeFn-B_ATMTMa.cjs} +3 -3
  3. package/dist/CodeEditor-DCZWTNZX.cjs +1 -0
  4. package/dist/CodeEditor-iLT-zqjH.js +77 -0
  5. package/dist/Topbar-Bk4vqKpP.cjs +1 -0
  6. package/dist/Topbar-DMCtQiUj.js +22 -0
  7. package/dist/{context-menu-EDKTnqIV.js → context-menu-CxioWiWD.js} +1 -1
  8. package/dist/{context-menu-0lRey9QY.cjs → context-menu-t34dYg4a.cjs} +1 -1
  9. package/dist/core.cjs +4 -4
  10. package/dist/core.d.ts +13 -13
  11. package/dist/core.js +1243 -1327
  12. package/dist/{iconBase-Ief2hJUZ.js → iconBase-DHfFLkem.js} +6 -12
  13. package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
  14. package/dist/{jsx-runtime-Sp0orL4X.js → jsx-runtime-DGlMoOmv.js} +241 -242
  15. package/dist/mockServiceWorker.js +39 -24
  16. package/dist/{plugin-GuIj4Ul0.js → plugin-OOaLfdkf.js} +1 -1
  17. package/dist/{plugin-4xaTkTNB.cjs → plugin-fWX0IMr4.cjs} +1 -1
  18. package/dist/render.cjs +1 -1
  19. package/dist/render.js +8 -11
  20. package/dist/style.css +1 -1
  21. package/dist/tailwind.cjs +1 -1
  22. package/dist/tailwind.js +5 -7
  23. package/dist/ui.cjs +1 -1
  24. package/dist/ui.d.ts +2 -47
  25. package/dist/ui.js +199 -356
  26. package/dist/web-blocks.cjs +2 -2
  27. package/dist/web-blocks.js +78 -81
  28. package/package.json +4 -1
  29. package/dist/CodeEditor-50B_qMvG.cjs +0 -1
  30. package/dist/CodeEditor-f8Ud0q2D.js +0 -126
  31. package/dist/Topbar-9IbTAO2f.js +0 -73
  32. package/dist/Topbar-eQjJCLWI.cjs +0 -1
  33. package/dist/jsx-runtime-JYMCiFoE.cjs +0 -27
  34. /package/dist/{STRINGS-BnWT5XcX.js → STRINGS-DtEft2kY.js} +0 -0
  35. /package/dist/{STRINGS-26RPxXyi.cjs → STRINGS-n7COZtKr.cjs} +0 -0
  36. /package/dist/{iconBase-aZzpqff_.cjs → iconBase-Cn2BsTrq.cjs} +0 -0
package/dist/core.js CHANGED
@@ -1,32 +1,32 @@
1
- var U = Object.defineProperty;
2
- var F = (o, r, n) => r in o ? U(o, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[r] = n;
3
- var H = (o, r, n) => (F(o, typeof r != "symbol" ? r + "" : r, n), n);
4
- import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
1
+ var V = Object.defineProperty;
2
+ var U = (o, r, n) => r in o ? V(o, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : o[r] = n;
3
+ var O = (o, r, n) => U(o, typeof r != "symbol" ? r + "" : r, n);
4
+ import { j as jsxRuntimeExports } from "./jsx-runtime-DGlMoOmv.js";
5
5
  import * as React from "react";
6
6
  import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useMemo, useState, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
7
- import { ag as useToast, S as Skeleton, B as Button, L as Label, aj as ContextMenu, ak as ContextMenuTrigger, al as ContextMenuContent, am as ContextMenuItem, O as Tooltip, P as TooltipTrigger, Q as TooltipContent, C as Card, x as CardHeader, E as CardDescription, F as CardContent, T as Textarea, y as CardFooter, D as Dialog, s as DialogTrigger, a as DialogContent, h as Badge, b as Switch, V as Popover, W as PopoverTrigger, X as PopoverContent, I as Input$1, U as TooltipPortal, e as AccordionItem, f as AccordionTrigger, g as AccordionContent, $ as DropdownMenu, a0 as DropdownMenuTrigger, a1 as DropdownMenuContent, G as ScrollArea, a5 as DropdownMenuLabel, a6 as DropdownMenuSeparator, a8 as DropdownMenuGroup, a2 as DropdownMenuItem, a7 as DropdownMenuShortcut, A as Accordion, J as Tabs, K as TabsList, M as TabsTrigger, N as TabsContent, j as AlertDialog, l as AlertDialogContent, m as AlertDialogHeader, o as AlertDialogTitle, k as AlertDialogTrigger, p as AlertDialogDescription, n as AlertDialogFooter, r as AlertDialogCancel, q as AlertDialogAction, a3 as DropdownMenuCheckboxItem, Y as HoverCard, Z as HoverCardTrigger, _ as HoverCardContent, ae as Separator, R as TooltipProvider, ai as Toaster } from "./context-menu-EDKTnqIV.js";
8
- import { has, find, filter, flatten, map, omit, isString, includes, without, get, compact, isObject, each, set, first, isEmpty, noop, keys, range, values, flattenDeep, startsWith, isNull, pick, sortBy, memoize, forEach, unset, chunk, cloneDeep, throttle, reverse, startCase, debounce, capitalize, flatMapDeep, split, reject, nth, toLower, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
7
+ import { ag as useToast, S as Skeleton, B as Button, L as Label, aj as ContextMenu, ak as ContextMenuTrigger, al as ContextMenuContent, am as ContextMenuItem, O as Tooltip, P as TooltipTrigger, Q as TooltipContent, C as Card, x as CardHeader, E as CardDescription, F as CardContent, T as Textarea, y as CardFooter, D as Dialog, s as DialogTrigger, a as DialogContent, h as Badge, b as Switch, V as Popover, W as PopoverTrigger, X as PopoverContent, I as Input$1, U as TooltipPortal, e as AccordionItem, f as AccordionTrigger, g as AccordionContent, $ as DropdownMenu, a0 as DropdownMenuTrigger, a1 as DropdownMenuContent, G as ScrollArea, a5 as DropdownMenuLabel, a6 as DropdownMenuSeparator, a8 as DropdownMenuGroup, a2 as DropdownMenuItem, a7 as DropdownMenuShortcut, A as Accordion, J as Tabs, K as TabsList, M as TabsTrigger, N as TabsContent, j as AlertDialog, l as AlertDialogContent, m as AlertDialogHeader, o as AlertDialogTitle, k as AlertDialogTrigger, p as AlertDialogDescription, n as AlertDialogFooter, r as AlertDialogCancel, q as AlertDialogAction, a3 as DropdownMenuCheckboxItem, Y as HoverCard, Z as HoverCardTrigger, _ as HoverCardContent, ae as Separator, R as TooltipProvider, ai as Toaster } from "./context-menu-CxioWiWD.js";
8
+ import { has, find, filter, flatten, map, omit, isString, includes, without, get, compact, isObject, each, set, first, isEmpty, noop, keys, range, values, flattenDeep, startsWith, isNull, pick, sortBy, memoize, forEach, unset, chunk, cloneDeep, throttle, reverse, startCase, debounce, capitalize, flatMapDeep, some, split, reject, nth, toLower, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
9
9
  import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
10
- import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.js";
10
+ import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-DHfFLkem.js";
11
11
  import { useTranslation, initReactI18next } from "react-i18next";
12
- import { useTranslation as Xe } from "react-i18next";
13
- import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, b as getChaiThemeCssVariables, a as getThemeFontsLinkMarkup } from "./ChaiThemeFn--DgGggh_.js";
12
+ import { useTranslation as Ie } from "react-i18next";
13
+ import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, b as getChaiThemeCssVariables, a as getThemeFontsLinkMarkup } from "./ChaiThemeFn-BUgkaTMi.js";
14
14
  import { useThrottledCallback, useResizeObserver, useDebouncedCallback, useIntervalEffect } from "@react-hookz/web";
15
15
  import TreeModel from "tree-model";
16
16
  import { getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredChaiBlocks, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
17
- import { registerChaiBlock as Ze } from "@chaibuilder/runtime";
17
+ import { registerChaiBlock as De } from "@chaibuilder/runtime";
18
18
  import ReactQuill, { Quill } from "react-quill";
19
19
  import { useFeature, FlagsProvider } from "flagged";
20
20
  import { useHotkeys } from "react-hotkeys-hook";
21
21
  import { flip } from "@floating-ui/dom";
22
22
  import { useFloating, shift } from "@floating-ui/react-dom";
23
- import { ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, ReaderIcon, DropdownMenuIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, TextIcon, RowsIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, Cross2Icon, EyeOpenIcon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
23
+ import { ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, ReaderIcon, DropdownMenuIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, TextIcon, RowsIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackIcon, CardStackPlusIcon, ScissorsIcon, Cross2Icon, EyeOpenIcon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
24
24
  import typography from "@tailwindcss/typography";
25
25
  import forms from "@tailwindcss/forms";
26
26
  import aspectRatio from "@tailwindcss/aspect-ratio";
27
27
  import containerQueries from "@tailwindcss/container-queries";
28
28
  import { twMerge } from "tailwind-merge";
29
- import { S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-BnWT5XcX.js";
29
+ import { S as STYLES_KEY, R as ROOT_TEMP_KEY } from "./STRINGS-DtEft2kY.js";
30
30
  import { Provider } from "react-wrap-balancer";
31
31
  import { PlusIcon as PlusIcon$1, DatabaseIcon, Columns, Rows, GlobeIcon, ChevronRight, EyeOff, Eye, X, Plus, ChevronDown, List, Loader, SparklesIcon, SmileIcon, ShuffleIcon, Edit2, Paintbrush, Layers } from "lucide-react";
32
32
  import ReactDOM from "react-dom";
@@ -42,27 +42,10 @@ import Autosuggest from "react-autosuggest";
42
42
  import Fuse from "fuse.js";
43
43
  import clsx from "clsx";
44
44
  import i18n from "i18next";
45
- import { default as Qe } from "i18next";
45
+ import { default as Me } from "i18next";
46
46
  import { motion } from "framer-motion";
47
- import "@radix-ui/react-switch";
48
- import "@radix-ui/react-accordion";
49
- import "class-variance-authority";
50
- import "@radix-ui/react-alert-dialog";
51
- import "@radix-ui/react-slot";
52
- import "@radix-ui/react-dialog";
53
- import "@radix-ui/react-label";
54
- import "@radix-ui/react-scroll-area";
55
- import "@radix-ui/react-tabs";
56
- import "@radix-ui/react-tooltip";
57
- import "@radix-ui/react-popover";
58
- import "@radix-ui/react-hover-card";
59
- import "@radix-ui/react-dropdown-menu";
60
- import "@radix-ui/react-separator";
61
- import "@radix-ui/react-toast";
62
- import "@radix-ui/react-context-menu";
63
47
  const canAcceptChildBlock = (o, r) => {
64
- if (!o)
65
- return !0;
48
+ if (!o) return !0;
66
49
  const n = getRegisteredChaiBlock(o);
67
50
  return n && has(n, "canAcceptBlock") ? n.canAcceptBlock(r) : !1;
68
51
  }, canAddChildBlock = (o) => {
@@ -78,7 +61,6 @@ const canAcceptChildBlock = (o, r) => {
78
61
  const r = getRegisteredChaiBlock(o);
79
62
  return r && has(r, "canDelete") ? r.canDelete() : !0;
80
63
  };
81
- var define_import_meta_env_default$2 = { VITE_OPENAI_API_KEY: "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", VITE_UNSPASH_ACCESS_KEY: "XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA", VITE_JOTAI_DEVTOOL_ENABLED: "true", BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
82
64
  let keyCount = 0;
83
65
  function atom(o, r) {
84
66
  const n = `atom${++keyCount}`, a = {
@@ -104,287 +86,246 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
104
86
  throw o.e;
105
87
  return o.v;
106
88
  }, createStore = () => {
107
- const o = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map();
108
- let a, l, i;
109
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
110
- const c = (m) => o.get(m), d = (m, E) => {
111
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(E);
112
- const R = o.get(m);
113
- if (o.set(m, E), n.has(m) || n.set(m, R), R && hasPromiseAtomValue(R)) {
114
- const C = "v" in E ? E.v instanceof Promise ? E.v : Promise.resolve(E.v) : Promise.reject(E.e);
115
- cancelPromise(R.v, C);
89
+ const o = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map(), a = (f) => o.get(f), l = (f, j) => {
90
+ const w = o.get(f);
91
+ if (o.set(f, j), n.has(f) || n.set(f, w), w && hasPromiseAtomValue(w)) {
92
+ const b = "v" in j ? j.v instanceof Promise ? j.v : Promise.resolve(j.v) : Promise.reject(j.e);
93
+ cancelPromise(w.v, b);
116
94
  }
117
- }, p = (m, E, R) => {
118
- const C = /* @__PURE__ */ new Map();
119
- let N = !1;
120
- R.forEach((I, w) => {
121
- !I && w === m && (I = E), I ? (C.set(w, I), E.d.get(w) !== I && (N = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
122
- }), (N || E.d.size !== C.size) && (E.d = C);
123
- }, u = (m, E, R) => {
124
- const C = c(m), N = {
125
- d: (C == null ? void 0 : C.d) || /* @__PURE__ */ new Map(),
126
- v: E
95
+ }, i = (f, j, w) => {
96
+ const b = /* @__PURE__ */ new Map();
97
+ let C = !1;
98
+ w.forEach((B, N) => {
99
+ !B && N === f && (B = j), B && (b.set(N, B), j.d.get(N) !== B && (C = !0));
100
+ }), (C || j.d.size !== b.size) && (j.d = b);
101
+ }, c = (f, j, w) => {
102
+ const b = a(f), C = {
103
+ d: (b == null ? void 0 : b.d) || /* @__PURE__ */ new Map(),
104
+ v: j
127
105
  };
128
- if (R && p(m, N, R), C && isEqualAtomValue(C, N) && C.d === N.d)
129
- return C;
130
- if (C && hasPromiseAtomValue(C) && hasPromiseAtomValue(N) && isEqualPromiseAtomValue(C, N)) {
131
- if (C.d === N.d)
132
- return C;
133
- N.v = C.v;
106
+ if (w && i(f, C, w), b && isEqualAtomValue(b, C) && b.d === C.d)
107
+ return b;
108
+ if (b && hasPromiseAtomValue(b) && hasPromiseAtomValue(C) && isEqualPromiseAtomValue(b, C)) {
109
+ if (b.d === C.d)
110
+ return b;
111
+ C.v = b.v;
134
112
  }
135
- return d(m, N), N;
136
- }, x = (m, E, R, C) => {
137
- if (isPromiseLike$2(E)) {
138
- let N;
139
- const I = new Promise((w, $) => {
140
- let L = !1;
141
- E.then(
142
- (M) => {
143
- if (!L) {
144
- L = !0;
145
- const D = c(m), O = u(
146
- m,
147
- I,
148
- R
113
+ return l(f, C), C;
114
+ }, d = (f, j, w, b) => {
115
+ if (isPromiseLike$2(j)) {
116
+ let C;
117
+ const B = new Promise((N, D) => {
118
+ let I = !1;
119
+ j.then(
120
+ (T) => {
121
+ if (!I) {
122
+ I = !0;
123
+ const L = a(f), P = c(
124
+ f,
125
+ B,
126
+ w
149
127
  );
150
- resolvePromise(I, M), w(M), (D == null ? void 0 : D.d) !== O.d && T(m, O, D == null ? void 0 : D.d);
128
+ resolvePromise(B, T), N(T), (L == null ? void 0 : L.d) !== P.d && S(f, P, L == null ? void 0 : L.d);
151
129
  }
152
130
  },
153
- (M) => {
154
- if (!L) {
155
- L = !0;
156
- const D = c(m), O = u(
157
- m,
158
- I,
159
- R
131
+ (T) => {
132
+ if (!I) {
133
+ I = !0;
134
+ const L = a(f), P = c(
135
+ f,
136
+ B,
137
+ w
160
138
  );
161
- rejectPromise(I, M), $(M), (D == null ? void 0 : D.d) !== O.d && T(m, O, D == null ? void 0 : D.d);
139
+ rejectPromise(B, T), D(T), (L == null ? void 0 : L.d) !== P.d && S(f, P, L == null ? void 0 : L.d);
162
140
  }
163
141
  }
164
- ), N = (M) => {
165
- L || (L = !0, M.then(
166
- (D) => resolvePromise(I, D),
167
- (D) => rejectPromise(I, D)
168
- ), w(M));
142
+ ), C = (T) => {
143
+ I || (I = !0, T.then(
144
+ (L) => resolvePromise(B, L),
145
+ (L) => rejectPromise(B, L)
146
+ ), N(T));
169
147
  };
170
148
  });
171
- return I.orig = E, I.status = "pending", registerCancelPromise(I, (w) => {
172
- w && N(w), C == null || C();
173
- }), u(m, I, R);
149
+ return B.orig = j, B.status = "pending", registerCancelPromise(B, (N) => {
150
+ N && C(N), b == null || b();
151
+ }), c(f, B, w);
174
152
  }
175
- return u(m, E, R);
176
- }, h = (m, E, R) => {
177
- const C = c(m), N = {
178
- d: (C == null ? void 0 : C.d) || /* @__PURE__ */ new Map(),
179
- e: E
153
+ return c(f, j, w);
154
+ }, p = (f, j, w) => {
155
+ const b = a(f), C = {
156
+ d: (b == null ? void 0 : b.d) || /* @__PURE__ */ new Map(),
157
+ e: j
180
158
  };
181
- return R && p(m, N, R), C && isEqualAtomError(C, N) && C.d === N.d ? C : (d(m, N), N);
182
- }, g = (m) => {
183
- const E = c(m);
184
- if (E && (E.d.forEach((L, M) => {
185
- M !== m && !r.has(M) && g(M);
186
- }), Array.from(E.d).every(([L, M]) => {
187
- const D = c(L);
188
- return L === m || D === M || // TODO This is a hack, we should find a better solution.
189
- D && !hasPromiseAtomValue(D) && isEqualAtomValue(D, M);
159
+ return w && i(f, C, w), b && isEqualAtomError(b, C) && b.d === C.d ? b : (l(f, C), C);
160
+ }, u = (f) => {
161
+ const j = a(f);
162
+ if (j && (j.d.forEach((I, T) => {
163
+ T !== f && !r.has(T) && u(T);
164
+ }), Array.from(j.d).every(([I, T]) => {
165
+ const L = a(I);
166
+ return I === f || L === T || // TODO This is a hack, we should find a better solution.
167
+ L && !hasPromiseAtomValue(L) && isEqualAtomValue(L, T);
190
168
  })))
191
- return E;
192
- const R = /* @__PURE__ */ new Map();
193
- let C = !0;
194
- const N = (L) => {
195
- if (L === m) {
196
- const D = c(L);
197
- if (D)
198
- return R.set(L, D), returnAtomValue(D);
199
- if (hasInitialValue(L))
200
- return R.set(L, void 0), L.init;
169
+ return j;
170
+ const w = /* @__PURE__ */ new Map();
171
+ let b = !0;
172
+ const C = (I) => {
173
+ if (I === f) {
174
+ const L = a(I);
175
+ if (L)
176
+ return w.set(I, L), returnAtomValue(L);
177
+ if (hasInitialValue(I))
178
+ return w.set(I, void 0), I.init;
201
179
  throw new Error("no atom init");
202
180
  }
203
- const M = g(L);
204
- return R.set(L, M), returnAtomValue(M);
181
+ const T = u(I);
182
+ return w.set(I, T), returnAtomValue(T);
205
183
  };
206
- let I, w;
207
- const $ = {
184
+ let B, N;
185
+ const D = {
208
186
  get signal() {
209
- return I || (I = new AbortController()), I.signal;
187
+ return B || (B = new AbortController()), B.signal;
210
188
  },
211
189
  get setSelf() {
212
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(m) && console.warn("setSelf function cannot be used with read-only atom"), !w && isActuallyWritableAtom(m) && (w = (...L) => {
213
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && C && console.warn("setSelf function cannot be called in sync"), !C)
214
- return A(m, ...L);
215
- }), w;
190
+ return !N && isActuallyWritableAtom(f) && (N = (...I) => {
191
+ if (!b)
192
+ return k(f, ...I);
193
+ }), N;
216
194
  }
217
195
  };
218
196
  try {
219
- const L = m.read(N, $);
220
- return x(
221
- m,
222
- L,
223
- R,
224
- () => I == null ? void 0 : I.abort()
197
+ const I = f.read(C, D);
198
+ return d(
199
+ f,
200
+ I,
201
+ w,
202
+ () => B == null ? void 0 : B.abort()
225
203
  );
226
- } catch (L) {
227
- return h(m, L, R);
204
+ } catch (I) {
205
+ return p(f, I, w);
228
206
  } finally {
229
- C = !1;
207
+ b = !1;
230
208
  }
231
- }, j = (m) => returnAtomValue(g(m)), b = (m) => {
232
- let E = r.get(m);
233
- return E || (E = S(m)), E;
234
- }, f = (m, E) => !E.l.size && (!E.t.size || E.t.size === 1 && E.t.has(m)), y = (m) => {
235
- const E = r.get(m);
236
- E && f(m, E) && k(m);
237
- }, v = (m) => {
238
- const E = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), C = (I) => {
239
- const w = r.get(I);
240
- w == null || w.t.forEach(($) => {
241
- $ !== I && (E.set(
242
- $,
243
- (E.get($) || /* @__PURE__ */ new Set()).add(I)
244
- ), R.set($, (R.get($) || 0) + 1), C($));
209
+ }, x = (f) => returnAtomValue(u(f)), h = (f) => {
210
+ let j = r.get(f);
211
+ return j || (j = _(f)), j;
212
+ }, m = (f, j) => !j.l.size && (!j.t.size || j.t.size === 1 && j.t.has(f)), E = (f) => {
213
+ const j = r.get(f);
214
+ j && m(f, j) && A(f);
215
+ }, y = (f) => {
216
+ const j = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), b = (B) => {
217
+ const N = r.get(B);
218
+ N == null || N.t.forEach((D) => {
219
+ D !== B && (j.set(
220
+ D,
221
+ (j.get(D) || /* @__PURE__ */ new Set()).add(B)
222
+ ), w.set(D, (w.get(D) || 0) + 1), b(D));
245
223
  });
246
224
  };
247
- C(m);
248
- const N = (I) => {
249
- const w = r.get(I);
250
- w == null || w.t.forEach(($) => {
251
- var L;
252
- if ($ !== I) {
253
- let M = R.get($);
254
- if (M && R.set($, --M), !M) {
255
- let D = !!((L = E.get($)) != null && L.size);
256
- if (D) {
257
- const O = c($), V = g($);
258
- D = !O || !isEqualAtomValue(O, V);
225
+ b(f);
226
+ const C = (B) => {
227
+ const N = r.get(B);
228
+ N == null || N.t.forEach((D) => {
229
+ var I;
230
+ if (D !== B) {
231
+ let T = w.get(D);
232
+ if (T && w.set(D, --T), !T) {
233
+ let L = !!((I = j.get(D)) != null && I.size);
234
+ if (L) {
235
+ const P = a(D), M = u(D);
236
+ L = !P || !isEqualAtomValue(P, M);
259
237
  }
260
- D || E.forEach((O) => O.delete($));
238
+ L || j.forEach((P) => P.delete(D));
261
239
  }
262
- N($);
240
+ C(D);
263
241
  }
264
242
  });
265
243
  };
266
- N(m);
267
- }, B = (m, ...E) => {
268
- let R = !0;
269
- const C = (w) => returnAtomValue(g(w)), N = (w, ...$) => {
270
- let L;
271
- if (w === m) {
272
- if (!hasInitialValue(w))
244
+ C(f);
245
+ }, g = (f, ...j) => {
246
+ let w = !0;
247
+ const b = (N) => returnAtomValue(u(N)), C = (N, ...D) => {
248
+ let I;
249
+ if (N === f) {
250
+ if (!hasInitialValue(N))
273
251
  throw new Error("atom not writable");
274
- const M = c(w), D = x(w, $[0]);
275
- (!M || !isEqualAtomValue(M, D)) && v(w);
252
+ const T = a(N), L = d(N, D[0]);
253
+ (!T || !isEqualAtomValue(T, L)) && y(N);
276
254
  } else
277
- L = B(w, ...$);
278
- if (!R) {
279
- const M = _();
280
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
281
- (D) => D({ type: "async-write", flushed: M })
282
- );
283
- }
284
- return L;
285
- }, I = m.write(C, N, ...E);
286
- return R = !1, I;
287
- }, A = (m, ...E) => {
288
- const R = B(m, ...E), C = _();
289
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
290
- (N) => N({ type: "write", flushed: C })
291
- ), R;
292
- }, S = (m, E) => {
293
- const R = {
294
- t: new Set(E && [E]),
255
+ I = g(N, ...D);
256
+ return w || v(), I;
257
+ }, B = f.write(b, C, ...j);
258
+ return w = !1, B;
259
+ }, k = (f, ...j) => {
260
+ const w = g(f, ...j);
261
+ return v(), w;
262
+ }, _ = (f, j) => {
263
+ const w = {
264
+ t: new Set(j && [j]),
295
265
  l: /* @__PURE__ */ new Set()
296
266
  };
297
- if (r.set(m, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(m), g(m).d.forEach((C, N) => {
298
- const I = r.get(N);
299
- I ? I.t.add(m) : N !== m && S(N, m);
300
- }), g(m), isActuallyWritableAtom(m) && m.onMount) {
301
- const C = m.onMount((...N) => A(m, ...N));
302
- C && (R.u = C);
267
+ if (r.set(f, w), u(f).d.forEach((b, C) => {
268
+ const B = r.get(C);
269
+ B ? B.t.add(f) : C !== f && _(C, f);
270
+ }), u(f), isActuallyWritableAtom(f) && f.onMount) {
271
+ const b = f.onMount((...C) => k(f, ...C));
272
+ b && (w.u = b);
303
273
  }
304
- return R;
305
- }, k = (m) => {
306
- var E;
307
- const R = (E = r.get(m)) == null ? void 0 : E.u;
308
- R && R(), r.delete(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(m);
309
- const C = c(m);
310
- C ? (hasPromiseAtomValue(C) && cancelPromise(C.v), C.d.forEach((N, I) => {
311
- if (I !== m) {
312
- const w = r.get(I);
313
- w && (w.t.delete(m), f(I, w) && k(I));
274
+ return w;
275
+ }, A = (f) => {
276
+ var j;
277
+ const w = (j = r.get(f)) == null ? void 0 : j.u;
278
+ w && w(), r.delete(f);
279
+ const b = a(f);
280
+ b && (hasPromiseAtomValue(b) && cancelPromise(b.v), b.d.forEach((C, B) => {
281
+ if (B !== f) {
282
+ const N = r.get(B);
283
+ N && (N.t.delete(f), m(B, N) && A(B));
314
284
  }
315
- })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", m);
316
- }, T = (m, E, R) => {
317
- const C = new Set(E.d.keys());
318
- R == null || R.forEach((N, I) => {
319
- if (C.has(I)) {
320
- C.delete(I);
285
+ }));
286
+ }, S = (f, j, w) => {
287
+ const b = new Set(j.d.keys());
288
+ w == null || w.forEach((C, B) => {
289
+ if (b.has(B)) {
290
+ b.delete(B);
321
291
  return;
322
292
  }
323
- const w = r.get(I);
324
- w && (w.t.delete(m), f(I, w) && k(I));
325
- }), C.forEach((N) => {
326
- const I = r.get(N);
327
- I ? I.t.add(m) : r.has(m) && S(N, m);
293
+ const N = r.get(B);
294
+ N && (N.t.delete(f), m(B, N) && A(B));
295
+ }), b.forEach((C) => {
296
+ const B = r.get(C);
297
+ B ? B.t.add(f) : r.has(f) && _(C, f);
328
298
  });
329
- }, _ = () => {
330
- let m;
331
- for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (m = /* @__PURE__ */ new Set()); n.size; ) {
332
- const E = Array.from(n);
333
- n.clear(), E.forEach(([R, C]) => {
334
- const N = c(R);
335
- if (N) {
336
- N.d !== (C == null ? void 0 : C.d) && T(R, N, C == null ? void 0 : C.d);
337
- const I = r.get(R);
338
- I && !// TODO This seems pretty hacky. Hope to fix it.
299
+ }, v = () => {
300
+ for (; n.size; ) {
301
+ const f = Array.from(n);
302
+ n.clear(), f.forEach(([j, w]) => {
303
+ const b = a(j);
304
+ if (b) {
305
+ b.d !== (w == null ? void 0 : w.d) && S(j, b, w == null ? void 0 : w.d);
306
+ const C = r.get(j);
307
+ C && !// TODO This seems pretty hacky. Hope to fix it.
339
308
  // Maybe we could `mountDependencies` in `setAtomState`?
340
- (C && !hasPromiseAtomValue(C) && (isEqualAtomValue(C, N) || isEqualAtomError(C, N))) && (I.l.forEach((w) => w()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && m.add(R));
341
- } else
342
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
309
+ (w && !hasPromiseAtomValue(w) && (isEqualAtomValue(w, b) || isEqualAtomError(w, b))) && C.l.forEach((B) => B());
310
+ }
343
311
  });
344
312
  }
345
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
346
- return a.forEach((E) => E("state")), m;
347
- }, P = (m, E) => {
348
- const R = b(m), C = _(), N = R.l;
349
- return N.add(E), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((I) => I("sub")), l.forEach(
350
- (I) => I({ type: "sub", flushed: C })
351
- )), () => {
352
- N.delete(E), y(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((I) => I("unsub")), l.forEach((I) => I({ type: "unsub" })));
353
- };
354
313
  };
355
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
356
- get: j,
357
- set: A,
358
- sub: P,
359
- // store dev methods (these are tentative and subject to change without notice)
360
- dev_subscribe_store: (m, E) => E !== 2 ? (console.warn(
361
- "The current StoreListener revision is 2. The older ones are deprecated."
362
- ), a.add(m), () => {
363
- a.delete(m);
364
- }) : (l.add(m), () => {
365
- l.delete(m);
366
- }),
367
- dev_get_mounted_atoms: () => i.values(),
368
- dev_get_atom_state: (m) => o.get(m),
369
- dev_get_mounted: (m) => r.get(m),
370
- dev_restore_atoms: (m) => {
371
- for (const [R, C] of m)
372
- hasInitialValue(R) && (x(R, C), v(R));
373
- const E = _();
374
- l.forEach(
375
- (R) => R({ type: "restore", flushed: E })
376
- );
314
+ return {
315
+ get: x,
316
+ set: k,
317
+ sub: (f, j) => {
318
+ const w = h(f);
319
+ v();
320
+ const b = w.l;
321
+ return b.add(j), () => {
322
+ b.delete(j), E(f);
323
+ };
377
324
  }
378
- } : {
379
- get: j,
380
- set: A,
381
- sub: P
382
325
  };
383
326
  };
384
327
  let defaultStore;
385
- const getDefaultStore = () => (defaultStore || (defaultStore = createStore()), defaultStore);
386
- var define_import_meta_env_default$1 = { VITE_OPENAI_API_KEY: "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", VITE_UNSPASH_ACCESS_KEY: "XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA", VITE_JOTAI_DEVTOOL_ENABLED: "true", BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
387
- const RESET = Symbol(), getCached$1 = (o, r, n) => (r.has(n) ? r : r.set(n, o())).get(n), cache1$2 = /* @__PURE__ */ new WeakMap(), memo2$1 = (o, r, n) => {
328
+ const getDefaultStore = () => (defaultStore || (defaultStore = createStore()), defaultStore), RESET = Symbol(), getCached$1 = (o, r, n) => (r.has(n) ? r : r.set(n, o())).get(n), cache1$2 = /* @__PURE__ */ new WeakMap(), memo2$1 = (o, r, n) => {
388
329
  const a = getCached$1(() => /* @__PURE__ */ new WeakMap(), cache1$2, r);
389
330
  return getCached$1(o, a, n);
390
331
  }, cacheKeyForEmptyKeyExtractor = {}, isWritable = (o) => !!o.write, isFunction = (o) => typeof o == "function";
@@ -396,41 +337,41 @@ function splitAtom(o, r) {
396
337
  if (p)
397
338
  return p;
398
339
  const u = d && n.get(d), x = [], h = [];
399
- return c.forEach((g, j) => {
400
- const b = r ? r(g) : j;
401
- h[j] = b;
402
- const f = u && u.atomList[u.keyList.indexOf(b)];
403
- if (f) {
404
- x[j] = f;
340
+ return c.forEach((m, E) => {
341
+ const y = E;
342
+ h[E] = y;
343
+ const g = u && u.atomList[u.keyList.indexOf(y)];
344
+ if (g) {
345
+ x[E] = g;
405
346
  return;
406
347
  }
407
- const y = (B) => {
408
- const A = B(l), S = B(o), T = a(S, A == null ? void 0 : A.arr).keyList.indexOf(b);
409
- if (T < 0 || T >= S.length) {
410
- const _ = c[a(c).keyList.indexOf(b)];
411
- if (_)
412
- return _;
348
+ const k = (A) => {
349
+ const S = A(l), v = A(o), f = a(v, S == null ? void 0 : S.arr).keyList.indexOf(y);
350
+ if (f < 0 || f >= v.length) {
351
+ const j = c[a(c).keyList.indexOf(y)];
352
+ if (j)
353
+ return j;
413
354
  throw new Error("splitAtom: index out of bounds for read");
414
355
  }
415
- return S[T];
416
- }, v = (B, A, S) => {
417
- const k = B(l), T = B(o), P = a(T, k == null ? void 0 : k.arr).keyList.indexOf(b);
418
- if (P < 0 || P >= T.length)
356
+ return v[f];
357
+ }, _ = (A, S, v) => {
358
+ const R = A(l), f = A(o), w = a(f, R == null ? void 0 : R.arr).keyList.indexOf(y);
359
+ if (w < 0 || w >= f.length)
419
360
  throw new Error("splitAtom: index out of bounds for write");
420
- const m = isFunction(S) ? S(T[P]) : S;
421
- A(o, [
422
- ...T.slice(0, P),
423
- m,
424
- ...T.slice(P + 1)
361
+ const b = isFunction(v) ? v(f[w]) : v;
362
+ S(o, [
363
+ ...f.slice(0, w),
364
+ b,
365
+ ...f.slice(w + 1)
425
366
  ]);
426
367
  };
427
- x[j] = isWritable(o) ? atom(y, v) : atom(y);
428
- }), u && u.keyList.length === h.length && u.keyList.every((g, j) => g === h[j]) ? p = u : p = { arr: c, atomList: x, keyList: h }, n.set(c, p), p;
368
+ x[E] = isWritable(o) ? atom(k, _) : atom(k);
369
+ }), u && u.keyList.length === h.length && u.keyList.every((m, E) => m === h[E]) ? p = u : p = { arr: c, atomList: x, keyList: h }, n.set(c, p), p;
429
370
  }, l = atom((c) => {
430
371
  const d = c(l), p = c(o);
431
372
  return a(p, d == null ? void 0 : d.arr);
432
373
  });
433
- (define_import_meta_env_default$1 ? "production" : void 0) !== "production" && (l.debugPrivate = !0), l.init = void 0;
374
+ l.init = void 0;
434
375
  const i = isWritable(o) ? atom(
435
376
  (c) => c(l).atomList,
436
377
  (c, d, p) => {
@@ -482,7 +423,7 @@ function splitAtom(o, r) {
482
423
  return i;
483
424
  },
484
425
  o,
485
- r || cacheKeyForEmptyKeyExtractor
426
+ cacheKeyForEmptyKeyExtractor
486
427
  );
487
428
  }
488
429
  const isPromiseLike$1 = (o) => typeof (o == null ? void 0 : o.then) == "function";
@@ -537,26 +478,22 @@ const defaultStorage = createJSONStorage(
537
478
  () => typeof window < "u" ? window.localStorage : void 0
538
479
  );
539
480
  function atomWithStorage(o, r, n = defaultStorage, a) {
540
- const l = a == null ? void 0 : a.unstable_getOnInit, i = atom(
541
- l ? n.getItem(o, r) : r
481
+ const l = atom(
482
+ r
542
483
  );
543
- return (define_import_meta_env_default$1 ? "production" : void 0) !== "production" && (i.debugPrivate = !0), i.onMount = (d) => {
544
- l || d(n.getItem(o, r));
545
- let p;
546
- return n.subscribe && (p = n.subscribe(o, d, r)), p;
484
+ return l.onMount = (c) => {
485
+ c(n.getItem(o, r));
486
+ let d;
487
+ return n.subscribe && (d = n.subscribe(o, c, r)), d;
547
488
  }, atom(
548
- (d) => d(i),
549
- (d, p, u) => {
550
- const x = typeof u == "function" ? u(d(i)) : u;
551
- return x === RESET ? (p(i, r), n.removeItem(o)) : x instanceof Promise ? x.then((h) => (p(i, h), n.setItem(o, h))) : (p(i, x), n.setItem(o, x));
489
+ (c) => c(l),
490
+ (c, d, p) => {
491
+ const u = typeof p == "function" ? p(c(l)) : p;
492
+ return u === RESET ? (d(l, r), n.removeItem(o)) : u instanceof Promise ? u.then((x) => (d(l, x), n.setItem(o, x))) : (d(l, u), n.setItem(o, u));
552
493
  }
553
494
  );
554
495
  }
555
- var define_import_meta_env_default = { VITE_OPENAI_API_KEY: "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", VITE_UNSPASH_ACCESS_KEY: "XgYBCm-XCHecRMsbfhw6oZWGkltco1U5TYMEd0LXZeA", VITE_JOTAI_DEVTOOL_ENABLED: "true", BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
556
- const StoreContext = createContext(void 0), useStore = (o) => {
557
- const r = useContext(StoreContext);
558
- return (o == null ? void 0 : o.store) || r || getDefaultStore();
559
- }, isPromiseLike = (o) => typeof (o == null ? void 0 : o.then) == "function", use = React__default.use || ((o) => {
496
+ const StoreContext = createContext(void 0), useStore = (o) => useContext(StoreContext) || getDefaultStore(), isPromiseLike = (o) => typeof (o == null ? void 0 : o.then) == "function", use = React__default.use || ((o) => {
560
497
  if (o.status === "pending")
561
498
  throw o;
562
499
  if (o.status === "fulfilled")
@@ -571,7 +508,7 @@ const StoreContext = createContext(void 0), useStore = (o) => {
571
508
  ), o);
572
509
  });
573
510
  function useAtomValue(o, r) {
574
- const n = useStore(r), [[a, l, i], c] = useReducer(
511
+ const n = useStore(), [[a, l, i], c] = useReducer(
575
512
  (u) => {
576
513
  const x = n.get(o);
577
514
  return Object.is(u[0], x) && u[1] === n && u[2] === o ? u : [x, n, o];
@@ -580,35 +517,25 @@ function useAtomValue(o, r) {
580
517
  () => [n.get(o), n, o]
581
518
  );
582
519
  let d = a;
583
- (l !== n || i !== o) && (c(), d = n.get(o));
584
- const p = r == null ? void 0 : r.delay;
585
- return useEffect(() => {
520
+ return (l !== n || i !== o) && (c(), d = n.get(o)), useEffect(() => {
586
521
  const u = n.sub(o, () => {
587
- if (typeof p == "number") {
588
- setTimeout(c, p);
589
- return;
590
- }
591
522
  c();
592
523
  });
593
524
  return c(), u;
594
- }, [n, o, p]), useDebugValue(d), isPromiseLike(d) ? use(d) : d;
525
+ }, [n, o, void 0]), useDebugValue(d), isPromiseLike(d) ? use(d) : d;
595
526
  }
596
527
  function useSetAtom(o, r) {
597
- const n = useStore(r);
528
+ const n = useStore();
598
529
  return useCallback(
599
- (...l) => {
600
- if ((define_import_meta_env_default ? "production" : void 0) !== "production" && !("write" in o))
601
- throw new Error("not writable atom");
602
- return n.set(o, ...l);
603
- },
530
+ (...l) => n.set(o, ...l),
604
531
  [n, o]
605
532
  );
606
533
  }
607
534
  function useAtom(o, r) {
608
535
  return [
609
- useAtomValue(o, r),
536
+ useAtomValue(o),
610
537
  // We do wrong type assertion here, which results in throwing an error.
611
- useSetAtom(o, r)
538
+ useSetAtom(o)
612
539
  ];
613
540
  }
614
541
  function duplicateBlocks(o, r, n) {
@@ -651,7 +578,7 @@ const getSlots = (o) => {
651
578
  }), r;
652
579
  }, getDuplicatedBlocks = (o, r, n = null) => {
653
580
  let a = find(o, { _id: r });
654
- a = { ...a, oldId: a._id, _id: generateUUID() }, n && (a = { ...a, _parent: n });
581
+ a = { ...a, oldId: a._id, _id: generateUUID() }, n !== (a == null ? void 0 : a._parent) && (a = { ...a, _parent: n });
655
582
  const l = [a];
656
583
  filter(o, { _parent: r }).length > 0 && l.push(flatten(duplicateBlocks(o, r, a._id)));
657
584
  const i = flatten(l);
@@ -940,8 +867,7 @@ function getSingleBlock(o) {
940
867
  }
941
868
  function getPBlocks(o) {
942
869
  const r = find(FLAT_ARRAY, { _id: o._id });
943
- if (!r)
944
- return [];
870
+ if (!r) return [];
945
871
  const n = [r], a = filter(FLAT_ARRAY, { _parent: o._id });
946
872
  return a.length ? flatten([...n, ...flatten(map(a, getPBlocks))]) : flatten(n);
947
873
  }
@@ -1083,8 +1009,7 @@ function moveNode(o, r, n, a) {
1083
1009
  return !1;
1084
1010
  }
1085
1011
  function moveBlocksWithChildren(o, r, n, a) {
1086
- if (!r)
1087
- return o;
1012
+ if (!r) return o;
1088
1013
  n = n || "root";
1089
1014
  const i = new TreeModel().parse({ _id: "root", children: getBlocksTree(o) });
1090
1015
  if (moveNode(i, r, n, a)) {
@@ -1135,98 +1060,98 @@ const useBlocksStoreManager = () => {
1135
1060
  updateBlocksProps: c
1136
1061
  } = useBlocksStoreManager();
1137
1062
  return {
1138
- moveBlocks: (b, f, y) => {
1139
- const v = map(b, (A) => {
1140
- const k = r.find((P) => P._id === A)._parent || null, _ = r.filter((P) => k ? P._parent === k : !P._parent).map((P) => P._id).indexOf(A);
1141
- return { _id: A, oldParent: k, oldPosition: _ };
1142
- }), B = v.find(({ _id: A }) => A === b[0]);
1143
- B && B.oldParent === f && B.oldPosition === y || (i(b, f, y), o({
1144
- undo: () => each(v, ({ _id: A, oldParent: S, oldPosition: k }) => {
1145
- i([A], S, k);
1063
+ moveBlocks: (y, g, k) => {
1064
+ const _ = map(y, (S) => {
1065
+ const R = r.find((w) => w._id === S)._parent || null, j = r.filter((w) => R ? w._parent === R : !w._parent).map((w) => w._id).indexOf(S);
1066
+ return { _id: S, oldParent: R, oldPosition: j };
1067
+ }), A = _.find(({ _id: S }) => S === y[0]);
1068
+ A && A.oldParent === g && A.oldPosition === k || (i(y, g, k), o({
1069
+ undo: () => each(_, ({ _id: S, oldParent: v, oldPosition: R }) => {
1070
+ i([S], v, R);
1146
1071
  }),
1147
- redo: () => i(b, f, y)
1072
+ redo: () => i(y, g, k)
1148
1073
  }));
1149
1074
  },
1150
- addBlocks: (b, f, y) => {
1151
- a(b, f, y), o({
1152
- undo: () => l(map(b, "_id")),
1153
- redo: () => a(b, f, y)
1075
+ addBlocks: (y, g, k) => {
1076
+ a(y, g, k), o({
1077
+ undo: () => l(map(y, "_id")),
1078
+ redo: () => a(y, g, k)
1154
1079
  });
1155
1080
  },
1156
- removeBlocks: (b) => {
1157
- var B;
1158
- const f = (B = first(b)) == null ? void 0 : B._parent, v = r.filter((A) => f ? A._parent === f : !A._parent).indexOf(first(b));
1159
- l(map(b, "_id")), o({
1160
- undo: () => a(b, f, v),
1161
- redo: () => l(map(b, "_id"))
1081
+ removeBlocks: (y) => {
1082
+ var A;
1083
+ const g = (A = first(y)) == null ? void 0 : A._parent, _ = r.filter((S) => g ? S._parent === g : !S._parent).indexOf(first(y));
1084
+ l(map(y, "_id")), o({
1085
+ undo: () => a(y, g, _),
1086
+ redo: () => l(map(y, "_id"))
1162
1087
  });
1163
1088
  },
1164
- updateBlocks: (b, f, y) => {
1165
- let v = [];
1166
- if (y)
1167
- v = map(b, (B) => ({ _id: B, ...y }));
1089
+ updateBlocks: (y, g, k) => {
1090
+ let _ = [];
1091
+ if (k)
1092
+ _ = map(y, (A) => ({ _id: A, ...k }));
1168
1093
  else {
1169
- const B = keys(f);
1170
- v = map(b, (A) => {
1171
- const S = r.find((T) => T._id === A), k = { _id: A };
1172
- return each(B, (T) => k[T] = S[T]), k;
1094
+ const A = keys(g);
1095
+ _ = map(y, (S) => {
1096
+ const v = r.find((f) => f._id === S), R = { _id: S };
1097
+ return each(A, (f) => R[f] = v[f]), R;
1173
1098
  });
1174
1099
  }
1175
- c(map(b, (B) => ({ _id: B, ...f }))), o({
1176
- undo: () => c(v),
1177
- redo: () => c(map(b, (B) => ({ _id: B, ...f })))
1100
+ c(map(y, (A) => ({ _id: A, ...g }))), o({
1101
+ undo: () => c(_),
1102
+ redo: () => c(map(y, (A) => ({ _id: A, ...g })))
1178
1103
  });
1179
1104
  },
1180
- updateBlocksRuntime: (b, f) => {
1181
- c(map(b, (y) => ({ _id: y, ...f })));
1105
+ updateBlocksRuntime: (y, g) => {
1106
+ c(map(y, (k) => ({ _id: k, ...g })));
1182
1107
  },
1183
- setNewBlocks: (b) => {
1184
- n(b), o({
1108
+ setNewBlocks: (y) => {
1109
+ n(y), o({
1185
1110
  undo: () => n(r),
1186
- redo: () => n(b)
1111
+ redo: () => n(y)
1187
1112
  });
1188
1113
  },
1189
- updateMultipleBlocksProps: (b) => {
1190
- let f = [];
1191
- f = map(b, (y) => {
1192
- const v = keys(y), B = r.find((S) => S._id === y._id), A = {};
1193
- return each(v, (S) => A[S] = B[S]), A;
1194
- }), c(b), o({
1195
- undo: () => c(f),
1196
- redo: () => c(b)
1114
+ updateMultipleBlocksProps: (y) => {
1115
+ let g = [];
1116
+ g = map(y, (k) => {
1117
+ const _ = keys(k), A = r.find((v) => v._id === k._id), S = {};
1118
+ return each(_, (v) => S[v] = A[v]), S;
1119
+ }), c(y), o({
1120
+ undo: () => c(g),
1121
+ redo: () => c(y)
1197
1122
  });
1198
1123
  }
1199
1124
  };
1200
1125
  }, useAddBlock = () => {
1201
1126
  const [o] = useBlocksStore(), [, r] = useSelectedBlockIds(), { addBlocks: n } = useBlocksStoreUndoableActions(), a = useCallback(
1202
1127
  (i, c, d) => {
1203
- var g;
1204
- for (let j = 0; j < i.length; j++) {
1205
- const { _id: b } = i[j];
1206
- i[j]._id = generateUUID();
1207
- const f = filter(i, { _parent: b });
1208
- for (let y = 0; y < f.length; y++)
1209
- f[y]._parent = i[j]._id;
1128
+ var m;
1129
+ for (let E = 0; E < i.length; E++) {
1130
+ const { _id: y } = i[E];
1131
+ i[E]._id = generateUUID();
1132
+ const g = filter(i, { _parent: y });
1133
+ for (let k = 0; k < g.length; k++)
1134
+ g[k]._parent = i[E]._id;
1210
1135
  }
1211
1136
  const p = first(i);
1212
1137
  let u, x;
1213
- return c && (u = find(o, { _id: c }), i[0]._parent = c, x = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, x = u._parent), n(i, x, d), r([(g = first(i)) == null ? void 0 : g._id]), first(i);
1138
+ return c && (u = find(o, { _id: c }), i[0]._parent = c, x = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, x = u._parent), n(i, x, d), r([(m = first(i)) == null ? void 0 : m._id]), first(i);
1214
1139
  },
1215
1140
  [n, o, r]
1216
1141
  );
1217
1142
  return { addCoreBlock: useCallback(
1218
1143
  (i, c, d) => {
1219
1144
  if (has(i, "blocks")) {
1220
- const f = i.blocks;
1221
- return a(f, c, d);
1145
+ const g = i.blocks;
1146
+ return a(g, c, d);
1222
1147
  }
1223
1148
  const p = generateUUID(), u = getDefaultBlockProps(i.type), x = {
1224
1149
  _type: i.type,
1225
1150
  _id: p,
1226
1151
  ...u
1227
1152
  };
1228
- let h, g;
1229
- return c && (h = find(o, { _id: c }), x._parent = c, g = c), !canAcceptChildBlock(h == null ? void 0 : h._type, x._type) && h && (x._parent = h._parent, g = h._parent), n([x], g, d), r([x._id]), x;
1153
+ let h, m;
1154
+ return c && (h = find(o, { _id: c }), x._parent = c, m = c), !canAcceptChildBlock(h == null ? void 0 : h._type, x._type) && h && (x._parent = h._parent, m = h._parent), n([x], m, d), r([x._id]), x;
1230
1155
  },
1231
1156
  [n, a, o, r]
1232
1157
  ), addPredefinedBlock: a };
@@ -2285,8 +2210,7 @@ const useBlocksStoreManager = () => {
2285
2210
  return { match: n, getClasses: a };
2286
2211
  };
2287
2212
  function getMqForCls(o) {
2288
- if (isEmpty(o.trim()))
2289
- return "";
2213
+ if (isEmpty(o.trim())) return "";
2290
2214
  const r = o.match(/sm:|md:|lg:|xl:|2xl:/g);
2291
2215
  return get(r, 0, "xs").replace(":", "");
2292
2216
  }
@@ -2299,8 +2223,7 @@ function getPureClsName(o) {
2299
2223
  }
2300
2224
  const memoizedProps = {};
2301
2225
  function getPropertyForClass(o) {
2302
- if (isEmpty(o))
2303
- return "";
2226
+ if (isEmpty(o)) return "";
2304
2227
  if (memoizedProps[o])
2305
2228
  return memoizedProps[o];
2306
2229
  let r = "";
@@ -2371,12 +2294,12 @@ function getNewClasses(o = "", r = "", n = []) {
2371
2294
  const x = constructClassObject(u), h = find(a, pick(x, ["dark", "mq", "mod", "property"]));
2372
2295
  if (h && (a = filter(
2373
2296
  a,
2374
- (g) => g.fullCls !== (h == null ? void 0 : h.fullCls)
2375
- )), i.push(x), x.mq === "xs" && !x.dark && x.mod === "" && (l = filter(l, (g) => g.property !== x.property)), getBelongsToForClass(a, x) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, x.property)) {
2376
- const g = find(l, pick(x, ["property"]));
2297
+ (m) => m.fullCls !== (h == null ? void 0 : h.fullCls)
2298
+ )), i.push(x), x.mq === "xs" && !x.dark && x.mod === "" && (l = filter(l, (m) => m.property !== x.property)), getBelongsToForClass(a, x) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, x.property)) {
2299
+ const m = find(l, pick(x, ["property"]));
2377
2300
  h && (l = filter(
2378
2301
  l,
2379
- (j) => j.fullCls !== (g == null ? void 0 : g.fullCls)
2302
+ (E) => E.fullCls !== (m == null ? void 0 : m.fullCls)
2380
2303
  )), c.push({
2381
2304
  ...x,
2382
2305
  fullCls: x.cls,
@@ -2467,11 +2390,11 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2467
2390
  (a, l = null) => {
2468
2391
  const i = [];
2469
2392
  each(a, (c) => {
2470
- const d = o.find((g) => g._id === c);
2471
- l || (l = d._parent);
2393
+ const d = o.find((m) => m._id === c);
2394
+ l ? l === "root" && (l = null) : l = d._parent;
2472
2395
  const x = filter(
2473
2396
  o,
2474
- (g) => isString(l) ? g._parent === l : !d._parent
2397
+ (m) => isString(l) ? m._parent === l : !m._parent
2475
2398
  ).indexOf(d) + 1, h = getDuplicatedBlocks(o, c, l);
2476
2399
  n(h, l, x), i.push(get(h, "0._id", ""));
2477
2400
  }), r(i);
@@ -2490,7 +2413,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2490
2413
  const [o] = useBlocksStore();
2491
2414
  return (r, n) => {
2492
2415
  var i;
2493
- const a = (i = find(o, { _id: n })) == null ? void 0 : i._type, l = first(r.map((c) => {
2416
+ const a = ((i = find(o, { _id: n })) == null ? void 0 : i._type) || null, l = first(r.map((c) => {
2494
2417
  var d;
2495
2418
  return (d = find(o, { _id: c })) == null ? void 0 : d._type;
2496
2419
  }));
@@ -2500,9 +2423,14 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2500
2423
  const o = useAtomValue$1(presentBlocksAtom), { moveBlocks: r } = useBlocksStoreUndoableActions();
2501
2424
  return useCallback(
2502
2425
  (n, a) => {
2503
- var d;
2504
- const l = Array.isArray(a) ? a[0] : a, i = o.find((p) => p._id === l), c = i && ((d = i.children) == null ? void 0 : d.length) || 0;
2505
- r(n, l, c);
2426
+ const l = Array.isArray(a) ? a[0] : a;
2427
+ if (a === "root") {
2428
+ const i = o == null ? void 0 : o.filter((c) => !c._parent);
2429
+ r(n, null, (i == null ? void 0 : i.length) || 0);
2430
+ } else {
2431
+ const i = o == null ? void 0 : o.filter((c) => c._parent === l);
2432
+ r(n, l, (i == null ? void 0 : i.length) || 0);
2433
+ }
2506
2434
  },
2507
2435
  [r, o]
2508
2436
  );
@@ -2537,7 +2465,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2537
2465
  const u = await navigator.clipboard.readText();
2538
2466
  if (u) {
2539
2467
  const x = JSON.parse(u);
2540
- has(x, "_chai_copied_blocks") ? i(x._chai_copied_blocks, p) : l({ title: "Error", description: "Nothing to paste" });
2468
+ has(x, "_chai_copied_blocks") ? i(x._chai_copied_blocks, p === "root" ? null : p) : l({ title: "Error", description: "Nothing to paste" });
2541
2469
  } else
2542
2470
  l({ title: "Error", description: "Nothing to paste" });
2543
2471
  } catch {
@@ -2565,13 +2493,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2565
2493
  const d = o(c), p = a;
2566
2494
  let { classes: u, baseClasses: x } = getSplitClasses(get(d, l.prop, "styles:,"));
2567
2495
  return each(p, (h) => {
2568
- const g = h.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${g}($| )`, "g");
2569
- u = u.replace(j, " ").replace(/ +/g, " ").trim();
2570
- const b = first(h.split(":"));
2571
- includes(["2xl", "xl", "lg", "md", "sm"], b) && p.push(h.split(":").pop().trim());
2496
+ const m = h.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${m}($| )`, "g");
2497
+ u = u.replace(E, " ").replace(/ +/g, " ").trim();
2498
+ const y = first(h.split(":"));
2499
+ includes(["2xl", "xl", "lg", "md", "sm"], y) && p.push(h.split(":").pop().trim());
2572
2500
  }), each(p, (h) => {
2573
- const g = new RegExp(`(^| )${h.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2574
- x = x.replace(g, " ").replace(/ +/g, " ").trim();
2501
+ const m = new RegExp(`(^| )${h.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2502
+ x = x.replace(m, " ").replace(/ +/g, " ").trim();
2575
2503
  }), {
2576
2504
  ids: [d._id],
2577
2505
  props: {
@@ -2590,8 +2518,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2590
2518
  );
2591
2519
  }, selectedBlockAllClassesAtom = atom$1((o) => {
2592
2520
  const r = first(o(selectedStylingBlocksAtom)), n = o(selectedBlockAtom);
2593
- if (!r || r.blockId !== get(n, "_id", null))
2594
- return [];
2521
+ if (!r || r.blockId !== get(n, "_id", null)) return [];
2595
2522
  const l = get(n, r.prop, `${STYLES_KEY},`).replace(STYLES_KEY, "").split(",").join(" ");
2596
2523
  return filter(map(l.trim().split(" "), constructClassObject), (i) => !isNull(i));
2597
2524
  }), useSelectedBlockAllClasses = () => useAtomValue$1(selectedBlockAllClassesAtom), MQ = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 5 }, selectedBlockCurrentClassesAtom = atom$1((o) => {
@@ -2638,8 +2565,7 @@ const useLanguages = () => {
2638
2565
  };
2639
2566
  }, updatePropsForLanguage = memoize((o, r, n) => {
2640
2567
  const a = getRegisteredChaiBlock(get(n, "_type"));
2641
- if (!a)
2642
- return o;
2568
+ if (!a) return o;
2643
2569
  const l = { ...o };
2644
2570
  return forEach(keys(o), (i) => {
2645
2571
  if (includes(get(a, "i18nProps", []), i) && !isEmpty(r)) {
@@ -3022,39 +2948,39 @@ const getBlockWithChildren = (o, r) => {
3022
2948
  return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
3023
2949
  })
3024
2950
  ), addLangToPrompt = (o, r, n) => !r || n !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, r, r)} language.`, askAiProcessingAtom = atom$1(!1), useAskAi = () => {
3025
- const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), x = p.length ? p : u, h = (g, j) => {
3026
- const b = cloneDeep(j.find((f) => f._id === g));
3027
- for (const f in b) {
3028
- const y = b[f];
3029
- typeof y == "string" && startsWith(y, STYLES_KEY) ? b[f] = compact(flattenDeep(y.replace(STYLES_KEY, "").split(","))).join(" ") : f !== "_id" && delete b[f];
2951
+ const [o, r] = useAtom$1(askAiProcessingAtom), [n, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), x = p.length ? p : u, h = (m, E) => {
2952
+ const y = cloneDeep(E.find((g) => g._id === m));
2953
+ for (const g in y) {
2954
+ const k = y[g];
2955
+ typeof k == "string" && startsWith(k, STYLES_KEY) ? y[g] = compact(flattenDeep(k.replace(STYLES_KEY, "").split(","))).join(" ") : g !== "_id" && delete y[g];
3030
2956
  }
3031
- return b;
2957
+ return y;
3032
2958
  };
3033
2959
  return {
3034
2960
  askAi: useCallback(
3035
- async (g, j, b, f) => {
2961
+ async (m, E, y, g) => {
3036
2962
  if (l) {
3037
2963
  r(!0), a(null);
3038
2964
  try {
3039
- const y = p === u ? "" : p, v = g === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(j, d)), p) : [h(j, d)], B = await l(g, addLangToPrompt(b, x, g), v, y), { blocks: A, error: S } = B;
3040
- if (S) {
3041
- a(S);
2965
+ const k = p === u ? "" : p, _ = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(E, d)), p) : [h(E, d)], A = await l(m, addLangToPrompt(y, x, m), _, k), { blocks: S, error: v } = A;
2966
+ if (v) {
2967
+ a(v);
3042
2968
  return;
3043
2969
  }
3044
- if (g === "styles") {
3045
- const k = A.map((T) => {
3046
- for (const _ in T)
3047
- _ !== "_id" && (T[_] = `${STYLES_KEY},${T[_]}`);
3048
- return T;
2970
+ if (m === "styles") {
2971
+ const R = S.map((f) => {
2972
+ for (const j in f)
2973
+ j !== "_id" && (f[j] = `${STYLES_KEY},${f[j]}`);
2974
+ return f;
3049
2975
  });
3050
- c(k);
2976
+ c(R);
3051
2977
  } else
3052
- i(A);
3053
- f && f(B);
3054
- } catch (y) {
3055
- a(y);
2978
+ i(S);
2979
+ g && g(A);
2980
+ } catch (k) {
2981
+ a(k);
3056
2982
  } finally {
3057
- r(!1), f && f();
2983
+ r(!1), g && g();
3058
2984
  }
3059
2985
  }
3060
2986
  },
@@ -3083,16 +3009,13 @@ const getBlockWithChildren = (o, r) => {
3083
3009
  }, wrapperBlockAtom = atom$1((o) => {
3084
3010
  var c;
3085
3011
  const r = o(presentBlocksAtom), n = o(selectedBlockIdsAtom), a = n.length === 1 ? n[0] : null;
3086
- if (!a)
3087
- return null;
3012
+ if (!a) return null;
3088
3013
  const l = find(r, { _id: a });
3089
- if (!l)
3090
- return null;
3014
+ if (!l) return null;
3091
3015
  let i = l._parent;
3092
3016
  for (; i; ) {
3093
3017
  const d = find(r, { _id: i });
3094
- if (!d)
3095
- return null;
3018
+ if (!d) return null;
3096
3019
  if ((c = getRegisteredChaiBlock(d._type)) != null && c.wrapper)
3097
3020
  return d;
3098
3021
  i = d._parent;
@@ -3165,11 +3088,11 @@ const useWrapperBlock = () => useAtomValue$1(wrapperBlockAtom), layoutVariantAto
3165
3088
  if (d < r) {
3166
3089
  const u = parseFloat((d / r).toFixed(2).toString());
3167
3090
  let x = {};
3168
- const h = p * u, g = d * u;
3091
+ const h = p * u, m = d * u;
3169
3092
  p && (x = {
3170
3093
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
3171
3094
  height: 100 + (p - h) / h * 100 + "%",
3172
- width: 100 + (d - g) / g * 100 + "%"
3095
+ width: 100 + (d - m) / m * 100 + "%"
3173
3096
  }), i({
3174
3097
  position: "relative",
3175
3098
  top: 0,
@@ -3201,7 +3124,7 @@ class Content extends Component {
3201
3124
  return Children.only(this.props.children);
3202
3125
  }
3203
3126
  }
3204
- H(Content, "propTypes", {
3127
+ O(Content, "propTypes", {
3205
3128
  children: PropTypes.element.isRequired,
3206
3129
  contentDidMount: PropTypes.func.isRequired,
3207
3130
  contentDidUpdate: PropTypes.func.isRequired
@@ -3209,17 +3132,17 @@ H(Content, "propTypes", {
3209
3132
  class Frame extends Component {
3210
3133
  constructor(n, a) {
3211
3134
  super(n, a);
3212
- H(this, "setRef", (n) => {
3135
+ O(this, "setRef", (n) => {
3213
3136
  this.nodeRef.current = n;
3214
3137
  const { forwardedRef: a } = this.props;
3215
3138
  typeof a == "function" ? a(n) : a && (a.current = n);
3216
3139
  });
3217
- H(this, "handleLoad", () => {
3140
+ O(this, "handleLoad", () => {
3218
3141
  clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
3219
3142
  });
3220
3143
  // In certain situations on a cold cache DOMContentLoaded never gets called
3221
3144
  // fallback to an interval to check if that's the case
3222
- H(this, "loadCheck", () => setInterval(() => {
3145
+ O(this, "loadCheck", () => setInterval(() => {
3223
3146
  this.handleLoad();
3224
3147
  }, 500));
3225
3148
  this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
@@ -3260,7 +3183,7 @@ class Frame extends Component {
3260
3183
  // also inject into the body and can mess up React. For this reason
3261
3184
  // initialContent is expected to have a div inside of the body
3262
3185
  // element that we render react into.
3263
- H(Frame, "propTypes", {
3186
+ O(Frame, "propTypes", {
3264
3187
  style: PropTypes.object,
3265
3188
  // eslint-disable-line
3266
3189
  head: PropTypes.node,
@@ -3270,7 +3193,7 @@ H(Frame, "propTypes", {
3270
3193
  contentDidMount: PropTypes.func,
3271
3194
  contentDidUpdate: PropTypes.func,
3272
3195
  children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)])
3273
- }), H(Frame, "defaultProps", {
3196
+ }), O(Frame, "defaultProps", {
3274
3197
  style: {},
3275
3198
  head: null,
3276
3199
  children: void 0,
@@ -3297,14 +3220,12 @@ function getOrientation(o) {
3297
3220
  const draggedBlockAtom = atom$1(null), dropTargetBlockIdAtom = atom$1(null);
3298
3221
  let iframeDocument = null, possiblePositions = [], dropTarget = null, dropIndex = null;
3299
3222
  const positionPlaceholder = (o, r, n) => {
3300
- if (!iframeDocument || !o)
3301
- return;
3223
+ if (!iframeDocument || !o) return;
3302
3224
  const a = iframeDocument == null ? void 0 : iframeDocument.getElementById("placeholder"), l = possiblePositions.map(([p]) => p), i = l.reduce(
3303
3225
  (p, u) => Math.abs(u - n) < Math.abs(p - n) ? u : p,
3304
3226
  0
3305
3227
  ), c = l.indexOf(i);
3306
- if (!possiblePositions[c])
3307
- return;
3228
+ if (!possiblePositions[c]) return;
3308
3229
  const d = possiblePositions[c];
3309
3230
  a.style.width = r === "vertical" ? d[2] + "px" : "2px", a.style.height = r === "vertical" ? "2px" : d[2] + "px", a.style.display = "block", r === "vertical" ? (a.style.top = d[0] + "px", a.style.left = d[1] + "px") : (a.style.top = d[1] + "px", a.style.left = d[0] + "px");
3310
3231
  };
@@ -3318,8 +3239,7 @@ function calculateDropIndex(o, r) {
3318
3239
  const calculatePossiblePositions = (o) => {
3319
3240
  const n = getOrientation(o) === "horizontal";
3320
3241
  possiblePositions = [], Array.from(o.children).forEach((a, l) => {
3321
- if (a.classList.contains("pointer-events-none"))
3322
- return;
3242
+ if (a.classList.contains("pointer-events-none")) return;
3323
3243
  const i = n ? a.offsetLeft : a.offsetTop, c = n ? [a.offsetTop, a.clientHeight] : [a.offsetLeft, a.clientWidth];
3324
3244
  if (possiblePositions.push([i, c[0], c[1]]), l === o.children.length - 1) {
3325
3245
  const d = n ? a.offsetLeft + a.clientWidth : a.offsetTop + a.clientHeight;
@@ -3346,40 +3266,39 @@ function removeDataDrop() {
3346
3266
  }
3347
3267
  const useDnd = () => {
3348
3268
  const { document: o } = useFrame(), [r, n] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d, p] = useAtom$1(draggedBlockAtom), [, u] = useAtom$1(dropTargetBlockIdAtom);
3349
- if (!useFeature("dnd"))
3350
- return {};
3269
+ if (!useFeature("dnd")) return {};
3351
3270
  const h = () => {
3352
3271
  removePlaceholder(), n(!1), p(null), u(null), possiblePositions = [];
3353
3272
  };
3354
3273
  return iframeDocument = o, {
3355
3274
  isDragging: r,
3356
- onDragOver: (g) => {
3357
- g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3275
+ onDragOver: (m) => {
3276
+ m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
3358
3277
  },
3359
- onDrop: (g) => {
3360
- var S;
3361
- const j = dropTarget, f = getOrientation(j) === "vertical" ? g.clientY + ((S = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : S.scrollY) : g.clientX;
3362
- dropIndex = calculateDropIndex(f, possiblePositions);
3363
- const y = d, v = j.getAttribute("data-block-id"), B = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3364
- if ((y == null ? void 0 : y._id) === v || !B) {
3278
+ onDrop: (m) => {
3279
+ var v;
3280
+ const E = dropTarget, g = getOrientation(E) === "vertical" ? m.clientY + ((v = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : v.scrollY) : m.clientX;
3281
+ dropIndex = calculateDropIndex(g, possiblePositions);
3282
+ const k = d, _ = E.getAttribute("data-block-id"), A = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3283
+ if ((k == null ? void 0 : k._id) === _ || !A) {
3365
3284
  h();
3366
3285
  return;
3367
3286
  }
3368
- if (!has(y, "_id")) {
3369
- a(y, v === "canvas" ? null : v, dropIndex), setTimeout(h, 300);
3287
+ if (!has(k, "_id")) {
3288
+ a(k, _ === "canvas" ? null : _, dropIndex), setTimeout(h, 300);
3370
3289
  return;
3371
3290
  }
3372
- let A = j.getAttribute("data-block-id");
3373
- A === null && (A = g.target.parentElement.getAttribute("data-block-id")), c([y._id], A === "canvas" ? null : A, dropIndex), h(), setTimeout(removePlaceholder, 300);
3291
+ let S = E.getAttribute("data-block-id");
3292
+ S === null && (S = m.target.parentElement.getAttribute("data-block-id")), c([k._id], S === "canvas" ? null : S, dropIndex), h(), setTimeout(removePlaceholder, 300);
3374
3293
  },
3375
- onDragEnter: (g) => {
3376
- const j = g, b = j.target;
3377
- dropTarget = b;
3378
- const f = b.getAttribute("data-block-id"), y = b.getAttribute("data-dnd-dragged") !== "yes";
3379
- u(f), j.stopPropagation(), j.preventDefault(), possiblePositions = [], y && calculatePossiblePositions(b), n(!0), l(""), i([]);
3294
+ onDragEnter: (m) => {
3295
+ const E = m, y = E.target;
3296
+ dropTarget = y;
3297
+ const g = y.getAttribute("data-block-id"), k = y.getAttribute("data-dnd-dragged") !== "yes";
3298
+ u(g), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(y), n(!0), l(""), i([]);
3380
3299
  },
3381
- onDragLeave: (g) => {
3382
- g.target.getAttribute("data-block-id") === "canvas" && (u(null), n(!1), removePlaceholder(), possiblePositions = []);
3300
+ onDragLeave: (m) => {
3301
+ m.target.getAttribute("data-block-id") === "canvas" && (u(null), n(!1), removePlaceholder(), possiblePositions = []);
3383
3302
  }
3384
3303
  };
3385
3304
  };
@@ -3400,31 +3319,29 @@ const useHandleCanvasDblClick = () => {
3400
3319
  const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], r = useUpdateBlocksProps(), [n, a] = useAtom$1(inlineEditingActiveAtom), { clearHighlight: l } = useBlockHighlight();
3401
3320
  return (i) => {
3402
3321
  var h;
3403
- if (n)
3404
- return;
3322
+ if (n) return;
3405
3323
  const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
3406
3324
  if (!d || !o.includes(d))
3407
3325
  return;
3408
3326
  const p = c.cloneNode(!0);
3409
- c.style.display = "none", Array.from(p.attributes).forEach((g) => {
3410
- g.name !== "class" && p.removeAttribute(g.name);
3327
+ c.style.display = "none", Array.from(p.attributes).forEach((m) => {
3328
+ m.name !== "class" && p.removeAttribute(m.name);
3411
3329
  }), d === "Text" && (p.style.display = "inline-block"), c.parentNode.insertBefore(p, c.nextSibling);
3412
3330
  const u = new Quill(p, { placeholder: "Type here..." });
3413
3331
  function x() {
3414
- const g = u.getText(0, u.getLength());
3415
- r([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), p.removeEventListener("blur", x, !0), destroyQuill(u), a(""), l(), p.remove();
3332
+ const m = u.getText(0, u.getLength());
3333
+ r([c.getAttribute("data-block-id")], { content: m }), c.removeAttribute("style"), p.removeEventListener("blur", x, !0), destroyQuill(u), a(""), l(), p.remove();
3416
3334
  }
3417
- p.addEventListener("blur", x, !0), p.addEventListener("click", (g) => {
3418
- g.stopPropagation();
3419
- }), p.addEventListener("keydown", (g) => {
3420
- (g.key === "Enter" || g.key === "Escape") && x();
3335
+ p.addEventListener("blur", x, !0), p.addEventListener("click", (m) => {
3336
+ m.stopPropagation();
3337
+ }), p.addEventListener("keydown", (m) => {
3338
+ (m.key === "Enter" || m.key === "Escape") && x();
3421
3339
  }), u.focus(), (h = p.querySelector(".ql-clipboard")) == null || h.remove(), a(c.getAttribute("data-block-id"));
3422
3340
  };
3423
3341
  }, useHandleCanvasClick = () => {
3424
3342
  const [, o] = useSelectedStylingBlocks(), [r, n] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
3425
3343
  return (c) => {
3426
- if (a)
3427
- return;
3344
+ if (a) return;
3428
3345
  c.stopPropagation();
3429
3346
  const d = getTargetedBlock(c.target);
3430
3347
  if (d != null && d.getAttribute("data-block-id") && (d == null ? void 0 : d.getAttribute("data-block-id")) === "container") {
@@ -3443,8 +3360,7 @@ const useHandleCanvasDblClick = () => {
3443
3360
  }, useHandleMouseMove = () => {
3444
3361
  const [o] = useAtom$1(inlineEditingActiveAtom), { highlightBlock: r } = useBlockHighlight();
3445
3362
  return throttle((n) => {
3446
- if (o)
3447
- return;
3363
+ if (o) return;
3448
3364
  const a = getTargetedBlock(n.target);
3449
3365
  a && r(a);
3450
3366
  }, 20);
@@ -3459,10 +3375,10 @@ const useHandleCanvasDblClick = () => {
3459
3375
  return;
3460
3376
  const h = getElementByDataBlockId(r, first(n));
3461
3377
  if (h) {
3462
- const g = h.getAttribute("data-style-prop");
3463
- if (g) {
3464
- const j = h.getAttribute("data-style-id"), b = h.getAttribute("data-block-parent");
3465
- l([{ id: j, prop: g, blockId: b }]);
3378
+ const m = h.getAttribute("data-style-prop");
3379
+ if (m) {
3380
+ const E = h.getAttribute("data-style-id"), y = h.getAttribute("data-block-parent");
3381
+ l([{ id: E, prop: m, blockId: y }]);
3466
3382
  }
3467
3383
  }
3468
3384
  }, 100);
@@ -3483,23 +3399,23 @@ const useHandleCanvasDblClick = () => {
3483
3399
  }
3484
3400
  );
3485
3401
  }, getElementByDataBlockId = (o, r) => o.querySelector(`[data-block-id="${r}"]`), useKeyEventWatcher = (o) => {
3486
- const [r, n] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: x, pasteBlocks: h } = usePasteBlocks(), g = o ? { document: o } : {};
3402
+ const [r, n] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: x, pasteBlocks: h } = usePasteBlocks(), m = o ? { document: o } : {};
3487
3403
  useHotkeys("ctrl+z,command+z", () => c(), {}, [c]), useHotkeys("ctrl+y,command+y", () => d(), {}, [d]), useHotkeys("ctrl+x,command+x", () => p(r), {}, [r, p]), useHotkeys("ctrl+c,command+c", () => u(r), {}, [r, u]), useHotkeys(
3488
3404
  "ctrl+v,command+v",
3489
3405
  () => {
3490
3406
  x(r[0]) && h(r);
3491
3407
  },
3492
- { ...g, preventDefault: !0 },
3408
+ { ...m, preventDefault: !0 },
3493
3409
  [r, x, h]
3494
- ), useHotkeys("esc", () => n([]), g, [n]), useHotkeys("ctrl+d,command+d", () => i(r), { ...g, preventDefault: !0 }, [
3410
+ ), useHotkeys("esc", () => n([]), m, [n]), useHotkeys("ctrl+d,command+d", () => i(r), { ...m, preventDefault: !0 }, [
3495
3411
  r,
3496
3412
  i
3497
3413
  ]), useHotkeys(
3498
3414
  "del, backspace",
3499
- (j) => {
3500
- j.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(r);
3415
+ (E) => {
3416
+ E.preventDefault(), canDeleteBlock(get(a, "_type", "")) && l(r);
3501
3417
  },
3502
- g,
3418
+ m,
3503
3419
  [r, l]
3504
3420
  );
3505
3421
  }, KeyboardHandler = () => {
@@ -3512,7 +3428,7 @@ const useHandleCanvasDblClick = () => {
3512
3428
  };
3513
3429
  class PubSub {
3514
3430
  constructor() {
3515
- H(this, "subscribers", /* @__PURE__ */ new Map());
3431
+ O(this, "subscribers", /* @__PURE__ */ new Map());
3516
3432
  }
3517
3433
  subscribe(r, n) {
3518
3434
  return this.subscribers.has(r) || this.subscribers.set(r, /* @__PURE__ */ new Set()), this.subscribers.get(r).add(n), () => {
@@ -3552,7 +3468,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3552
3468
  }
3553
3469
  });
3554
3470
  useResizeObserver(o, () => x(), o !== null);
3555
- const h = get(r, "_parent", null), g = isEmpty(get(r, "_name", "")) ? get(r, "_type", "") : get(r, "_name", "");
3471
+ const h = get(r, "_parent", null), m = isEmpty(get(r, "_name", "")) ? get(r, "_type", "") : get(r, "_name", "");
3556
3472
  return !o || !r || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3557
3473
  "div",
3558
3474
  {
@@ -3560,13 +3476,13 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3560
3476
  tabIndex: 0,
3561
3477
  ref: u.setFloating,
3562
3478
  style: p,
3563
- onClick: (j) => {
3564
- j.stopPropagation(), j.preventDefault();
3479
+ onClick: (E) => {
3480
+ E.stopPropagation(), E.preventDefault();
3565
3481
  },
3566
- onMouseEnter: (j) => {
3567
- j.stopPropagation(), i(null);
3482
+ onMouseEnter: (E) => {
3483
+ E.stopPropagation(), i(null);
3568
3484
  },
3569
- onKeyDown: (j) => j.stopPropagation(),
3485
+ onKeyDown: (E) => E.stopPropagation(),
3570
3486
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3571
3487
  children: [
3572
3488
  h && /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3578,7 +3494,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3578
3494
  }
3579
3495
  }
3580
3496
  ),
3581
- /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: g, block: r }),
3497
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: m, block: r }),
3582
3498
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
3583
3499
  canAddChildBlock(get(r, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3584
3500
  PlusIcon,
@@ -3598,7 +3514,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3598
3514
  d == null ? void 0 : d.getElementById("selected-block")
3599
3515
  ), [h] = useState(
3600
3516
  d == null ? void 0 : d.getElementById("selected-styling-block")
3601
- ), [g] = useState(
3517
+ ), [m] = useState(
3602
3518
  d == null ? void 0 : d.getElementById("dragged-block")
3603
3519
  );
3604
3520
  useEffect(() => {
@@ -3623,42 +3539,42 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3623
3539
  forms,
3624
3540
  aspectRatio,
3625
3541
  containerQueries,
3626
- plugin(function({ addBase: f, theme: y }) {
3627
- f({
3542
+ plugin(function({ addBase: g, theme: k }) {
3543
+ g({
3628
3544
  "h1,h2,h3,h4,h5,h6": {
3629
- fontFamily: y("fontFamily.heading")
3545
+ fontFamily: k("fontFamily.heading")
3630
3546
  },
3631
3547
  body: {
3632
- fontFamily: y("fontFamily.body"),
3633
- color: y("colors.foreground"),
3634
- backgroundColor: y("colors.background")
3548
+ fontFamily: k("fontFamily.body"),
3549
+ color: k("colors.foreground"),
3550
+ backgroundColor: k("colors.background")
3635
3551
  }
3636
3552
  });
3637
3553
  })
3638
3554
  ]
3639
3555
  });
3640
3556
  }, [o, r, p]), useEffect(() => {
3641
- x && (x.textContent = `${map(n, (f) => `[data-block-id="${f}"]`).join(",")}{
3557
+ x && (x.textContent = `${map(n, (g) => `[data-block-id="${g}"]`).join(",")}{
3642
3558
  outline: 1px solid ${n.length === 1 ? "#42a1fc !important" : "orange !important"}; outline-offset: -1px;
3643
3559
  }`);
3644
3560
  }, [n, x]), useEffect(() => {
3645
- g.textContent = i ? `[data-block-id="${i._id}"], [data-block-id="${i._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3646
- }, [i, g]), useEffect(() => {
3561
+ m.textContent = i ? `[data-block-id="${i._id}"], [data-block-id="${i._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3562
+ }, [i, m]), useEffect(() => {
3647
3563
  u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3648
3564
  }, [u]), useEffect(() => {
3649
- h && (h.textContent = `${map(l, ({ id: f }) => `[data-style-id="${f}"]`).join(",")}{
3565
+ h && (h.textContent = `${map(l, ({ id: g }) => `[data-style-id="${g}"]`).join(",")}{
3650
3566
  outline: 1px solid orange !important; outline-offset: -1px;
3651
3567
  }`);
3652
3568
  }, [l, h]), useEffect(() => {
3653
3569
  d.querySelector("#drop-target-block").innerHTML = c ? `[data-block-id="${c}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3654
3570
  }, [c, d]);
3655
- const j = useMemo(
3571
+ const E = useMemo(
3656
3572
  () => getChaiThemeCssVariables(o),
3657
3573
  [o]
3658
- ), b = useMemo(() => getThemeFontsLinkMarkup(pick(o, ["fontFamily"])), [o]);
3574
+ ), y = useMemo(() => getThemeFontsLinkMarkup(pick(o, ["fontFamily"])), [o]);
3659
3575
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
3660
- /* @__PURE__ */ jsxRuntimeExports.jsx("style", { id: "chai-theme", children: j }),
3661
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html: b } })
3576
+ /* @__PURE__ */ jsxRuntimeExports.jsx("style", { id: "chai-theme", children: E }),
3577
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { id: "chai-fonts", dangerouslySetInnerHTML: { __html: y } })
3662
3578
  ] });
3663
3579
  }, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, r) => {
3664
3580
  const n = ["xs", "sm", "md", "lg", "xl", "2xl"], a = n.indexOf(r), l = o.split(" ");
@@ -3670,11 +3586,11 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3670
3586
  if (u <= a) {
3671
3587
  const x = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], h = ["hidden"];
3672
3588
  if (x.includes(p))
3673
- for (let g = u; g < n.length; g++)
3674
- i[g] = !0;
3589
+ for (let m = u; m < n.length; m++)
3590
+ i[m] = !0;
3675
3591
  else if (h.includes(p))
3676
- for (let g = u; g < n.length; g++)
3677
- i[g] = !1;
3592
+ for (let m = u; m < n.length; m++)
3593
+ i[m] = !1;
3678
3594
  }
3679
3595
  }
3680
3596
  return i[a];
@@ -3725,79 +3641,75 @@ const getRuntimeProps = memoize((o) => {
3725
3641
  return Object.fromEntries(Object.entries(n).filter(([, a]) => get(a, "runtime", !1)));
3726
3642
  });
3727
3643
  function isDescendant(o, r, n) {
3728
- if (!find(n, { _id: o }))
3729
- return !1;
3644
+ if (!find(n, { _id: o })) return !1;
3730
3645
  const l = filter(n, { _parent: o });
3731
3646
  return l.some((i) => i._id === r) ? !0 : l.some((i) => isDescendant(i._id, r, n));
3732
3647
  }
3733
3648
  const RenderGlobalBlock = ({ blocks: o, allBlocks: r }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: r, blocks: o });
3734
3649
  function applyLanguage(o, r, n) {
3735
- if (isEmpty(r))
3736
- return o;
3650
+ if (isEmpty(r)) return o;
3737
3651
  const a = cloneDeep(o);
3738
3652
  return forEach(keys(a), (l) => {
3739
3653
  includes(get(n, "i18nProps", []), l) && !isEmpty(r) && (a[l] = get(a, `${l}-${r}`, a[l]));
3740
3654
  }), a;
3741
3655
  }
3742
3656
  function BlocksRendererStatic({ blocks: o, allBlocks: r }) {
3743
- const { selectedLang: n } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [p] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: x } = useGlobalBlocksStore(), h = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), b = useCallback(
3744
- (f) => f.reduce((y, v) => {
3745
- const B = get(p, v, {});
3746
- return { ...y, ...B };
3657
+ const { selectedLang: n } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [p] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: x } = useGlobalBlocksStore(), h = useCallback((g) => getStyleAttrs(g, d), [d]), [m] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), y = useCallback(
3658
+ (g) => g.reduce((k, _) => {
3659
+ const A = get(p, _, {});
3660
+ return { ...k, ...A };
3747
3661
  }, {}),
3748
3662
  [p]
3749
3663
  );
3750
3664
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3751
- o.map((f, y) => {
3752
- if (j === f._id || u.includes(f._id))
3753
- return null;
3754
- const v = {}, B = filter(r, { _parent: f._id });
3755
- if (v.children = B.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: r, blocks: B }) : null, f._type === "GlobalBlock") {
3756
- const C = x(f);
3757
- v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (N) => !N._parent), allBlocks: C });
3665
+ o.map((g, k) => {
3666
+ if (E === g._id || u.includes(g._id)) return null;
3667
+ const _ = {}, A = filter(r, { _parent: g._id });
3668
+ if (_.children = A.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: r, blocks: A }) : null, g._type === "GlobalBlock") {
3669
+ const N = x(g);
3670
+ _.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(N, (D) => !D._parent), allBlocks: N });
3758
3671
  }
3759
- const A = getRegisteredChaiBlock(f._type), S = get(A, "component", null);
3760
- if (isNull(S))
3761
- return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
3762
- const k = has(A, "getBlockStateFrom") ? A == null ? void 0 : A.getBlockStateFrom(f, r) : [], T = b(k), _ = h(f);
3763
- if (get(_, "__isHidden", !1) && !includes(a, f._id))
3672
+ const S = getRegisteredChaiBlock(g._type), v = get(S, "component", null);
3673
+ if (isNull(v)) return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${g == null ? void 0 : g._type} not registered -->` });
3674
+ const R = has(S, "getBlockStateFrom") ? S == null ? void 0 : S.getBlockStateFrom(g, r) : [], f = y(R), j = h(g);
3675
+ if (get(j, "__isHidden", !1) && !includes(a, g._id))
3764
3676
  return null;
3765
- const P = i && isDescendant(i._id, f._id, r), E = {
3677
+ const w = i && isDescendant(i._id, g._id, r), C = {
3766
3678
  blockProps: {
3767
- ...includes(a, f._id) ? { "force-show": "" } : {},
3768
- "data-block-id": f._id,
3769
- "data-block-type": f._type,
3679
+ ...includes(a, g._id) ? { "force-show": "" } : {},
3680
+ "data-block-id": g._id,
3681
+ "data-block-type": g._type,
3770
3682
  ...i ? (
3771
3683
  // @ts-ignore
3772
3684
  {
3773
- "data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
3774
- "data-dnd-dragged": i._id === f._id || P ? "yes" : "no"
3685
+ "data-dnd": canAcceptChildBlock(g._type, i == null ? void 0 : i._type) ? "yes" : "no",
3686
+ "data-dnd-dragged": i._id === g._id || w ? "yes" : "no"
3775
3687
  }
3776
3688
  ) : {},
3777
- ...c === f._id && !P ? { "data-drop": "yes" } : {},
3778
- ...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
3689
+ ...c === g._id && !w ? { "data-drop": "yes" } : {},
3690
+ ...includes(l, g._id) ? { "data-cut-block": "yes" } : {}
3779
3691
  },
3780
- index: y,
3781
- ...applyBindings(applyLanguage(f, n, A), g),
3782
- ...omit(_, ["__isHidden"]),
3783
- ...v,
3692
+ index: k,
3693
+ ...applyBindings(applyLanguage(g, n, S), m),
3694
+ ...omit(j, ["__isHidden"]),
3695
+ ..._,
3784
3696
  inBuilder: !0,
3785
- blockState: T,
3697
+ blockState: f,
3786
3698
  lang: n
3787
3699
  };
3788
- if (has(A, "dataProvider"))
3700
+ if (has(S, "dataProvider"))
3789
3701
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3790
3702
  AsyncPropsBlock,
3791
3703
  {
3792
3704
  lang: n,
3793
- dataProvider: A.dataProvider,
3794
- block: f,
3795
- component: S,
3796
- props: E
3705
+ dataProvider: S.dataProvider,
3706
+ block: g,
3707
+ component: v,
3708
+ props: C
3797
3709
  }
3798
3710
  ) });
3799
- const R = getRuntimeProps(f._type);
3800
- return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RuntimePropsBlock, { runtimeProps: R, block: f, component: S, props: E }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(S, E) });
3711
+ const B = getRuntimeProps(g._type);
3712
+ return B ? /* @__PURE__ */ jsxRuntimeExports.jsx(RuntimePropsBlock, { runtimeProps: B, block: g, component: v, props: C }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(v, C) });
3801
3713
  })
3802
3714
  ) });
3803
3715
  }
@@ -3857,47 +3769,46 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
3857
3769
  };
3858
3770
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
3859
3771
  }, getElementByStyleId = (o, r) => o.querySelector(`[data-style-id="${r}"]`), StaticCanvas = () => {
3860
- const [o] = useAtom$1(networkModeAtom), [r] = useCanvasWidth(), [, n] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [x, h] = useState([]), [, g] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [b, f] = useSelectedStylingBlocks(), y = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), B = (k) => {
3861
- p((T) => ({ ...T, width: k }));
3772
+ const [o] = useAtom$1(networkModeAtom), [r] = useCanvasWidth(), [, n] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [x, h] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [y, g] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), _ = useBuilderProp("htmlDir", "ltr"), A = (R) => {
3773
+ p((f) => ({ ...f, width: R }));
3862
3774
  };
3863
3775
  useEffect(() => {
3864
- if (!c.current)
3865
- return;
3866
- const { clientWidth: k, clientHeight: T } = c.current;
3867
- p({ width: k, height: T });
3776
+ if (!c.current) return;
3777
+ const { clientWidth: R, clientHeight: f } = c.current;
3778
+ p({ width: R, height: f });
3868
3779
  }, [c, r]);
3869
- const A = (k, T = 0) => {
3870
- const { top: _ } = k.getBoundingClientRect();
3871
- return _ + T >= 0 && _ - T <= window.innerHeight;
3780
+ const S = (R, f = 0) => {
3781
+ const { top: j } = R.getBoundingClientRect();
3782
+ return j + f >= 0 && j - f <= window.innerHeight;
3872
3783
  };
3873
3784
  useEffect(() => {
3874
- var k, T;
3785
+ var R, f;
3875
3786
  if (a && a.type !== "Multiple" && i.current) {
3876
- const _ = getElementByDataBlockId(i.current.contentDocument, a._id);
3877
- _ && (A(_) || (T = (k = i.current) == null ? void 0 : k.contentWindow) == null || T.scrollTo({ top: _.offsetTop, behavior: "smooth" }), h([_]));
3787
+ const j = getElementByDataBlockId(i.current.contentDocument, a._id);
3788
+ j && (S(j) || (f = (R = i.current) == null ? void 0 : R.contentWindow) == null || f.scrollTo({ top: j.offsetTop, behavior: "smooth" }), h([j]));
3878
3789
  }
3879
3790
  }, [a]), useEffect(() => {
3880
- if (!isEmpty(b) && i.current) {
3881
- const k = getElementByStyleId(
3791
+ if (!isEmpty(y) && i.current) {
3792
+ const R = getElementByStyleId(
3882
3793
  i.current.contentDocument,
3883
- first(b).id
3794
+ first(y).id
3884
3795
  );
3885
- g(k ? [k] : [null]);
3796
+ m(R ? [R] : [null]);
3886
3797
  } else
3887
- g([null]);
3888
- }, [b]);
3889
- const S = useMemo(() => {
3890
- let k = IframeInitialContent;
3891
- return k = k.replace("__HTML_DIR__", v), o === "offline" && (k = k.replace(
3798
+ m([null]);
3799
+ }, [y]);
3800
+ const v = useMemo(() => {
3801
+ let R = IframeInitialContent;
3802
+ return R = R.replace("__HTML_DIR__", _), o === "offline" && (R = R.replace(
3892
3803
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3893
3804
  "/offline/tailwind.cdn.js"
3894
- ), k = k.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), k = k.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), k;
3895
- }, [o, v]);
3896
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: B, onResize: B, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3805
+ ), R = R.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), R = R.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), R;
3806
+ }, [o, _]);
3807
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: A, onResize: A, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3897
3808
  "div",
3898
3809
  {
3899
3810
  onClick: () => {
3900
- n([]), f([]);
3811
+ n([]), g([]);
3901
3812
  },
3902
3813
  onMouseLeave: () => setTimeout(() => l(""), 300),
3903
3814
  className: "relative mx-auto h-full w-full overflow-hidden",
@@ -3905,12 +3816,12 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
3905
3816
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3906
3817
  ChaiFrame,
3907
3818
  {
3908
- contentDidMount: () => j(i.current),
3819
+ contentDidMount: () => E(i.current),
3909
3820
  ref: i,
3910
3821
  id: "canvas-iframe",
3911
3822
  style: { ...u, ...isEmpty(u) ? { width: `${r}px` } : {} },
3912
3823
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3913
- initialContent: S,
3824
+ initialContent: v,
3914
3825
  children: [
3915
3826
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3916
3827
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3922,7 +3833,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
3922
3833
  ),
3923
3834
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
3924
3835
  /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
3925
- y ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3836
+ k ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3926
3837
  /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
3927
3838
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
3928
3839
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -3940,7 +3851,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
3940
3851
  )
3941
3852
  }
3942
3853
  ) });
3943
- }, StaticCanvas$1 = StaticCanvas, FallbackError = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
3854
+ }, FallbackError = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full rounded-md bg-red-200 p-4 text-red-500", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
3944
3855
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "font-semibold", children: "Oops! Something went wrong." }),
3945
3856
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Please try again." })
3946
3857
  ] }) }), TypeIcon = (o) => {
@@ -4040,14 +3951,14 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4040
3951
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
4041
3952
  ] }, l))
4042
3953
  ] }) });
4043
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-f8Ud0q2D.js")), CanvasArea = () => {
3954
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-iLT-zqjH.js")), CanvasArea = () => {
4044
3955
  const [o] = useCodeEditor(), r = useBuilderProp("onError", noop);
4045
3956
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
4046
- /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
3957
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas, {}) }) }),
4047
3958
  o ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Resizable, { enable: { top: !0, bottom: !1 }, className: "max-h-[400px] min-h-[200px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CodeEditor$1, {}) }) }) : null,
4048
3959
  /* @__PURE__ */ jsxRuntimeExports.jsx(Breadcrumb, {})
4049
3960
  ] }) });
4050
- }, CanvasArea$1 = CanvasArea, FONTS = [
3961
+ }, FONTS = [
4051
3962
  { title: "Roboto", value: "Roboto" },
4052
3963
  { title: "Open Sans", value: "Open Sans" },
4053
3964
  { title: "Montserrat", value: "Montserrat" },
@@ -4114,7 +4025,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4114
4025
  children: FONTS.map((a) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: a.value, children: a.title }, a.value))
4115
4026
  }
4116
4027
  )
4117
- ] }), FontSelector$1 = FontSelector, ColorPickerInput = ({ value: o, onChange: r }) => {
4028
+ ] }), ColorPickerInput = ({ value: o, onChange: r }) => {
4118
4029
  const n = debounce((a) => r(a), 200);
4119
4030
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
4120
4031
  "div",
@@ -4135,7 +4046,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4135
4046
  )
4136
4047
  }
4137
4048
  );
4138
- }, ColorPickerInput$1 = ColorPickerInput, BorderRadiusInput = ({ value: o, onChange: r, disabled: n }) => {
4049
+ }, BorderRadiusInput = ({ value: o, onChange: r, disabled: n }) => {
4139
4050
  const a = debounce((l) => r(l), 200);
4140
4051
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
4141
4052
  "input",
@@ -4150,64 +4061,64 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4150
4061
  className: "flex-1 cursor-pointer"
4151
4062
  }
4152
4063
  );
4153
- }, BorderRadiusInput$1 = BorderRadiusInput, ThemeConfigPanel$1 = React.memo(({ className: o = "" }) => {
4154
- const [r] = useDarkMode(), [n, a] = React.useState(""), l = useBuilderProp("themePresets", []), [i, c] = useTheme(), d = useThemeOptions(), { t: p } = useTranslation(), u = (f) => {
4155
- a(f);
4064
+ }, ThemeConfigPanel$1 = React.memo(({ className: o = "" }) => {
4065
+ const [r] = useDarkMode(), [n, a] = React.useState(""), l = useBuilderProp("themePresets", []), [i, c] = useTheme(), d = useThemeOptions(), { t: p } = useTranslation(), u = (g) => {
4066
+ a(g);
4156
4067
  }, x = () => {
4157
- const f = l.find((y) => Object.keys(y)[0] === n);
4158
- if (f) {
4159
- const y = Object.values(f)[0];
4160
- y && typeof y == "object" && "fontFamily" in y && "borderRadius" in y && "colors" in y ? c(y) : console.error("Invalid preset structure:", y);
4068
+ const g = l.find((k) => Object.keys(k)[0] === n);
4069
+ if (g) {
4070
+ const k = Object.values(g)[0];
4071
+ k && typeof k == "object" && "fontFamily" in k && "borderRadius" in k && "colors" in k ? c(k) : console.error("Invalid preset structure:", k);
4161
4072
  } else
4162
4073
  console.error("Preset not found:", n);
4163
4074
  }, h = useDebouncedCallback(
4164
- (f, y) => {
4075
+ (g, k) => {
4165
4076
  c(() => ({
4166
4077
  ...i,
4167
4078
  fontFamily: {
4168
4079
  ...i.fontFamily,
4169
- [f.replace(/font-/g, "")]: y
4080
+ [g.replace(/font-/g, "")]: k
4170
4081
  }
4171
4082
  }));
4172
4083
  },
4173
4084
  [i],
4174
4085
  200
4175
- ), g = useDebouncedCallback(
4176
- (f) => {
4086
+ ), m = useDebouncedCallback(
4087
+ (g) => {
4177
4088
  c(() => ({
4178
4089
  ...i,
4179
- borderRadius: `${f}px`
4090
+ borderRadius: `${g}px`
4180
4091
  }));
4181
4092
  },
4182
4093
  [i],
4183
4094
  200
4184
- ), j = useDebouncedCallback(
4185
- (f, y) => {
4095
+ ), E = useDebouncedCallback(
4096
+ (g, k) => {
4186
4097
  c(() => {
4187
- const v = get(i, `colors.${f}`);
4188
- return r ? set(v, 1, y) : set(v, 0, y), {
4098
+ const _ = get(i, `colors.${g}`);
4099
+ return r ? set(_, 1, k) : set(_, 0, k), {
4189
4100
  ...i,
4190
4101
  colors: {
4191
4102
  ...i.colors,
4192
- [f]: v
4103
+ [g]: _
4193
4104
  }
4194
4105
  };
4195
4106
  });
4196
4107
  },
4197
4108
  [i],
4198
4109
  200
4199
- ), b = (f) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1", children: Object.entries(f.items).map(([y]) => {
4200
- const v = get(i, `colors.${y}.${r ? 1 : 0}`);
4110
+ ), y = (g) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1", children: Object.entries(g.items).map(([k]) => {
4111
+ const _ = get(i, `colors.${k}.${r ? 1 : 0}`);
4201
4112
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
4202
4113
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4203
- ColorPickerInput$1,
4114
+ ColorPickerInput,
4204
4115
  {
4205
- value: v,
4206
- onChange: (B) => j(y, B)
4116
+ value: _,
4117
+ onChange: (A) => E(k, A)
4207
4118
  }
4208
4119
  ),
4209
- /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: y.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((B) => B.charAt(0).toUpperCase() + B.slice(1)).join(" ") + (!y.toLowerCase().includes("foreground") && !y.toLowerCase().includes("border") && !y.toLowerCase().includes("input") && !y.toLowerCase().includes("ring") && !y.toLowerCase().includes("background") ? " Background" : "") })
4210
- ] }, y);
4120
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: k.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((A) => A.charAt(0).toUpperCase() + A.slice(1)).join(" ") + (!k.toLowerCase().includes("foreground") && !k.toLowerCase().includes("border") && !k.toLowerCase().includes("input") && !k.toLowerCase().includes("ring") && !k.toLowerCase().includes("background") ? " Background" : "") })
4121
+ ] }, k);
4211
4122
  }) });
4212
4123
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("no-scrollbar h-full w-full overflow-y-auto", o), children: [
4213
4124
  l.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 py-2", children: [
@@ -4217,11 +4128,11 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4217
4128
  "select",
4218
4129
  {
4219
4130
  value: n,
4220
- onChange: (f) => u(f.target.value),
4131
+ onChange: (g) => u(g.target.value),
4221
4132
  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",
4222
4133
  children: [
4223
4134
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Select preset" }),
4224
- Array.isArray(l) && l.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: Object.keys(f)[0], children: capitalize(Object.keys(f)[0]) }, Object.keys(f)[0]))
4135
+ Array.isArray(l) && l.map((g) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: Object.keys(g)[0], children: capitalize(Object.keys(g)[0]) }, Object.keys(g)[0]))
4225
4136
  ]
4226
4137
  }
4227
4138
  )
@@ -4229,25 +4140,25 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4229
4140
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-[30%] items-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "w-full text-sm", disabled: n === "", variant: "default", onClick: x, children: p("Apply") }) })
4230
4141
  ] }),
4231
4142
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("space-y-2", o), children: [
4232
- (d == null ? void 0 : d.fontFamily) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-4", children: Object.entries(d.fontFamily).map(([f, y]) => /* @__PURE__ */ jsxRuntimeExports.jsx(
4233
- FontSelector$1,
4143
+ (d == null ? void 0 : d.fontFamily) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-4", children: Object.entries(d.fontFamily).map(([g, k]) => /* @__PURE__ */ jsxRuntimeExports.jsx(
4144
+ FontSelector,
4234
4145
  {
4235
- label: f,
4236
- value: i.fontFamily[f.replace(/font-/g, "")] || y[Object.keys(y)[0]],
4237
- onChange: (v) => h(f, v)
4146
+ label: g,
4147
+ value: i.fontFamily[g.replace(/font-/g, "")] || k[Object.keys(k)[0]],
4148
+ onChange: (_) => h(g, _)
4238
4149
  },
4239
- f
4150
+ g
4240
4151
  )) }),
4241
4152
  (d == null ? void 0 : d.borderRadius) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-0.5 py-3", children: [
4242
4153
  /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: p("Border Radius") }),
4243
4154
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 py-2", children: [
4244
- /* @__PURE__ */ jsxRuntimeExports.jsx(BorderRadiusInput$1, { value: i.borderRadius, onChange: g }),
4155
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BorderRadiusInput, { value: i.borderRadius, onChange: m }),
4245
4156
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "w-12 text-sm", children: i.borderRadius })
4246
4157
  ] })
4247
4158
  ] }),
4248
4159
  (d == null ? void 0 : d.colors) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 space-y-0.5", children: [
4249
4160
  /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: p("Colors") }),
4250
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full space-y-4 pt-2", children: d.colors.map((f) => b(f)) }, r ? "dark" : "light")
4161
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full space-y-4 pt-2", children: d.colors.map((g) => y(g)) }, r ? "dark" : "light")
4251
4162
  ] })
4252
4163
  ] }),
4253
4164
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -4255,9 +4166,9 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4255
4166
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
4256
4167
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
4257
4168
  ] });
4258
- }), ThemeConfigPanel$2 = ThemeConfigPanel$1, ThemeConfigPanel$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4169
+ }), ThemeConfigPanel$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4259
4170
  __proto__: null,
4260
- default: ThemeConfigPanel$2
4171
+ default: ThemeConfigPanel$1
4261
4172
  }, Symbol.toStringTag, { value: "Module" })), placeholderStyle = {
4262
4173
  display: "flex",
4263
4174
  alignItems: "center",
@@ -4291,7 +4202,33 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4291
4202
  ] })
4292
4203
  }
4293
4204
  ) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hidden" });
4294
- }), CopyPasteBlocks = () => {
4205
+ }), PasteAtRootContextMenu = ({ parentContext: o, setParentContext: r }) => {
4206
+ const { t: n } = useTranslation(), { canPaste: a, pasteBlocks: l } = usePasteBlocks();
4207
+ return useEffect(() => {
4208
+ a("root") || r(null);
4209
+ }, [a("root")]), o && a("root") && /* @__PURE__ */ jsxRuntimeExports.jsx(
4210
+ "div",
4211
+ {
4212
+ style: { position: "absolute", top: o.y - 75, left: o.x - 56 },
4213
+ onMouseLeave: () => r(null),
4214
+ className: "w-28 rounded-md border bg-white p-1 shadow-xl",
4215
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
4216
+ "div",
4217
+ {
4218
+ className: "flex cursor-pointer items-center gap-x-4 rounded px-2 py-1 text-xs hover:bg-blue-50",
4219
+ onClick: () => {
4220
+ l("root"), r(null);
4221
+ },
4222
+ children: [
4223
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CardStackIcon, {}),
4224
+ " ",
4225
+ n("Paste")
4226
+ ]
4227
+ }
4228
+ )
4229
+ }
4230
+ );
4231
+ }, CopyPasteBlocks = () => {
4295
4232
  const [o] = useBlocksStore(), [r] = useSelectedBlockIds(), { pasteBlocks: n } = usePasteBlocks(), [, a] = useCopyBlockIds(), { t: l } = useTranslation(), i = useSelectedBlock(), c = useCallback(() => {
4296
4233
  const d = r.map((p) => {
4297
4234
  const u = o.find((x) => x._id === p);
@@ -4445,50 +4382,50 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4445
4382
  var I;
4446
4383
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4447
4384
  let p = null;
4448
- const u = o.children.length > 0, { highlightBlock: x, clearHighlight: h } = useBlockHighlight(), { id: g, data: j, isSelected: b, willReceiveDrop: f, isDragging: y, isEditing: v, handleClick: B } = o, A = (w) => {
4449
- w.stopPropagation(), !i.includes(g) && o.toggle();
4450
- }, S = (w) => {
4451
- w.isInternal && (p = w.isOpen, w.isOpen && w.close());
4452
- }, k = (w) => {
4453
- w.isInternal && p !== null && (p ? w.open() : w.close(), p = null);
4454
- }, [T, _] = useAtom$1(currentAddSelection), P = () => {
4455
- var w;
4456
- m(), o.parent.isSelected || _((w = o == null ? void 0 : o.parent) == null ? void 0 : w.id);
4457
- }, m = () => {
4458
- _(null);
4459
- }, E = (w) => {
4460
- m(), w.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(), B(w);
4385
+ const u = o.children.length > 0, { highlightBlock: x, clearHighlight: h } = useBlockHighlight(), { id: m, data: E, isSelected: y, willReceiveDrop: g, isDragging: k, isEditing: _, handleClick: A } = o, S = (T) => {
4386
+ T.stopPropagation(), !i.includes(m) && o.toggle();
4387
+ }, v = (T) => {
4388
+ T.isInternal && (p = T.isOpen, T.isOpen && T.close());
4389
+ }, R = (T) => {
4390
+ T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
4391
+ }, [f, j] = useAtom$1(currentAddSelection), w = () => {
4392
+ var T;
4393
+ b(), o.parent.isSelected || j((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id);
4394
+ }, b = () => {
4395
+ j(null);
4396
+ }, C = (T) => {
4397
+ b(), T.stopPropagation(), !o.isOpen && !i.includes(m) && o.toggle(), A(T);
4461
4398
  };
4462
4399
  useEffect(() => {
4463
- const w = setTimeout(() => {
4464
- f && !o.isOpen && !y && !i.includes(g) && o.toggle();
4400
+ const T = setTimeout(() => {
4401
+ g && !o.isOpen && !k && !i.includes(m) && o.toggle();
4465
4402
  }, 500);
4466
- return () => clearTimeout(w);
4467
- }, [f, o, y]);
4468
- const R = useMemo(() => {
4469
- const w = Object.keys(j), $ = [];
4470
- for (let L = 0; L < w.length; L++)
4471
- if (w[L].endsWith("_attrs")) {
4472
- const M = j[w[L]], D = Object.keys(M).join("|");
4473
- D.match(/x-data/) && $.push("data"), D.match(/x-on/) && $.push("event"), D.match(/x-show|x-if/) && $.push("show");
4403
+ return () => clearTimeout(T);
4404
+ }, [g, o, k]);
4405
+ const B = useMemo(() => {
4406
+ const T = Object.keys(E), L = [];
4407
+ for (let P = 0; P < T.length; P++)
4408
+ if (T[P].endsWith("_attrs")) {
4409
+ const M = E[T[P]], $ = Object.keys(M).join("|");
4410
+ $.match(/x-data/) && L.push("data"), $.match(/x-on/) && L.push("event"), $.match(/x-show|x-if/) && L.push("show");
4474
4411
  }
4475
- return $;
4476
- }, [j]), C = (w, $) => {
4477
- const L = d.contentDocument || d.contentWindow.document, M = L.querySelector(`[data-block-id=${w}]`);
4478
- M && M.setAttribute("data-drop", $);
4479
- const D = M.getBoundingClientRect(), O = d.getBoundingClientRect();
4480
- D.top >= O.top && D.left >= O.left && D.bottom <= O.bottom && D.right <= O.right || (L.documentElement.scrollTop = M.offsetTop - O.top);
4481
- }, N = (w) => {
4482
- m();
4483
- const $ = get(o, "parent.id");
4484
- $ !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: $, position: w }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: w });
4412
+ return L;
4413
+ }, [E]), N = (T, L) => {
4414
+ const P = d.contentDocument || d.contentWindow.document, M = P.querySelector(`[data-block-id=${T}]`);
4415
+ M && M.setAttribute("data-drop", L);
4416
+ const $ = M.getBoundingClientRect(), H = d.getBoundingClientRect();
4417
+ $.top >= H.top && $.left >= H.left && $.bottom <= H.bottom && $.right <= H.right || (P.documentElement.scrollTop = M.offsetTop - H.top);
4418
+ }, D = (T) => {
4419
+ b();
4420
+ const L = get(o, "parent.id");
4421
+ L !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: L, position: T }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: T });
4485
4422
  };
4486
- return g === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative w-full cursor-pointer", children: [
4423
+ return m === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative w-full cursor-pointer", children: [
4487
4424
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
4488
4425
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4489
4426
  "div",
4490
4427
  {
4491
- onClick: () => N(-1),
4428
+ onClick: () => D(-1),
4492
4429
  className: "h-1 rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
4493
4430
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 transform items-center gap-x-1 rounded-full bg-purple-500 px-3 py-1 text-[9px] leading-tight text-white hover:bg-purple-500", children: [
4494
4431
  /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-2 w-2 stroke-[3]" }),
@@ -4498,35 +4435,35 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4498
4435
  }
4499
4436
  ),
4500
4437
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {})
4501
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id: g, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
4438
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id: m, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
4502
4439
  "div",
4503
4440
  {
4504
- onMouseEnter: () => x(g),
4441
+ onMouseEnter: () => x(m),
4505
4442
  onMouseLeave: () => h(),
4506
- onClick: E,
4443
+ onClick: C,
4507
4444
  style: r,
4508
- "data-node-id": g,
4509
- ref: i.includes(g) ? null : n,
4510
- onDragStart: () => S(o),
4511
- onDragEnd: () => k(o),
4512
- onDragOver: (w) => {
4513
- w.preventDefault(), C(g, "yes");
4445
+ "data-node-id": m,
4446
+ ref: i.includes(m) ? null : n,
4447
+ onDragStart: () => v(o),
4448
+ onDragEnd: () => R(o),
4449
+ onDragOver: (T) => {
4450
+ T.preventDefault(), N(m, "yes");
4514
4451
  },
4515
- onDragLeave: (w) => {
4516
- w.preventDefault(), C(g, "no");
4452
+ onDragLeave: (T) => {
4453
+ T.preventDefault(), N(m, "no");
4517
4454
  },
4518
- onDrop: (w) => {
4519
- w.preventDefault(), C(g, "no");
4455
+ onDrop: (T) => {
4456
+ T.preventDefault(), N(m, "no");
4520
4457
  },
4521
4458
  children: [
4522
4459
  (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((I = o == null ? void 0 : o.parent) == null ? void 0 : I.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4523
4460
  "div",
4524
4461
  {
4525
- onClick: (w) => {
4526
- w.stopPropagation(), N(o.childIndex);
4462
+ onClick: (T) => {
4463
+ T.stopPropagation(), D(o.childIndex);
4527
4464
  },
4528
- onMouseEnter: P,
4529
- onMouseLeave: m,
4465
+ onMouseEnter: w,
4466
+ onMouseLeave: b,
4530
4467
  className: "absolute -top-0.5 h-1 w-[90%] rounded bg-purple-500 opacity-0 delay-200 duration-200 group-hover:opacity-100",
4531
4468
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute left-1/2 top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-purple-500 p-1 outline outline-2 outline-white hover:bg-purple-500", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-3 w-3 stroke-[4] text-white" }) })
4532
4469
  }
@@ -4536,11 +4473,11 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4536
4473
  {
4537
4474
  className: cn(
4538
4475
  "group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 text-foreground/80 outline-none",
4539
- b ? "bg-blue-500 text-white" : "hover:bg-slate-200 dark:hover:bg-gray-800",
4540
- f && canAcceptChildBlock(j._type, "Icon") ? "bg-green-200" : "",
4541
- (o == null ? void 0 : o.id) === T ? "bg-purple-100" : "",
4542
- y && "opacity-20",
4543
- i.includes(g) ? "opacity-50" : ""
4476
+ y ? "bg-blue-500 text-white" : "hover:bg-slate-200 dark:hover:bg-gray-800",
4477
+ g && canAcceptChildBlock(E._type, "Icon") ? "bg-green-200" : "",
4478
+ (o == null ? void 0 : o.id) === f ? "bg-purple-100" : "",
4479
+ k && "opacity-20",
4480
+ i.includes(m) ? "opacity-50" : ""
4544
4481
  ),
4545
4482
  children: [
4546
4483
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
@@ -4548,50 +4485,50 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4548
4485
  "div",
4549
4486
  {
4550
4487
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
4551
- children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: A, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4488
+ children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4552
4489
  ChevronRight,
4553
4490
  {
4554
- className: `h-3 w-3 stroke-[3] ${b ? "text-slate-200" : "text-slate-400"}`
4491
+ className: `h-3 w-3 stroke-[3] ${y ? "text-slate-200" : "text-slate-400"}`
4555
4492
  }
4556
4493
  ) })
4557
4494
  }
4558
4495
  ),
4559
4496
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "leading-1 flex items-center", children: [
4560
- /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: j == null ? void 0 : j._type }),
4561
- v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4497
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: E == null ? void 0 : E._type }),
4498
+ _ ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4562
4499
  "div",
4563
4500
  {
4564
4501
  className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
4565
- onDoubleClick: (w) => {
4566
- w.stopPropagation(), o.edit(), o.deselect();
4502
+ onDoubleClick: (T) => {
4503
+ T.stopPropagation(), o.edit(), o.deselect();
4567
4504
  },
4568
4505
  children: [
4569
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (j == null ? void 0 : j._name) || (j == null ? void 0 : j._type.split("/").pop()) }),
4570
- R.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4571
- R.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4572
- R.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
4506
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (E == null ? void 0 : E._name) || (E == null ? void 0 : E._type.split("/").pop()) }),
4507
+ B.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4508
+ B.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4509
+ B.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
4573
4510
  ]
4574
4511
  }
4575
4512
  )
4576
4513
  ] })
4577
4514
  ] }),
4578
4515
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
4579
- !i.includes(g) && a.map((w) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4516
+ !i.includes(m) && a.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4580
4517
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4581
4518
  TooltipTrigger,
4582
4519
  {
4583
4520
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
4584
4521
  asChild: !0,
4585
- children: React__default.createElement(w.item, { blockId: g })
4522
+ children: React__default.createElement(T.item, { blockId: m })
4586
4523
  }
4587
4524
  ),
4588
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: w.tooltip })
4525
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
4589
4526
  ] })),
4590
- canAddChildBlock(j == null ? void 0 : j._type) && !i.includes(g) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4527
+ canAddChildBlock(E == null ? void 0 : E._type) && !i.includes(m) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4591
4528
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4592
4529
  TooltipTrigger,
4593
4530
  {
4594
- onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: g }),
4531
+ onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: m }),
4595
4532
  className: "cursor-pointer rounded bg-transparent hover:text-black",
4596
4533
  asChild: !0,
4597
4534
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { size: "15" })
@@ -4603,8 +4540,8 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4603
4540
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4604
4541
  TooltipTrigger,
4605
4542
  {
4606
- onClick: (w) => {
4607
- w.stopPropagation(), c(g), o.isOpen && o.toggle();
4543
+ onClick: (T) => {
4544
+ T.stopPropagation(), c(m), o.isOpen && o.toggle();
4608
4545
  },
4609
4546
  className: "cursor-pointer rounded bg-transparent hover:text-black",
4610
4547
  asChild: !0,
@@ -4650,7 +4587,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4650
4587
  return canAcceptChildBlock(a, l);
4651
4588
  };
4652
4589
  }, ListTree = () => {
4653
- const [treeData] = useAtom$1(treeDSBlocks), [ids, setIds] = useSelectedBlockIds(), [cutBlocksIds] = useCutBlockIds(), [, setHiddenBlocks] = useHiddenBlockIds(), updateBlockProps = useUpdateBlocksProps(), [, setStyleBlocks] = useSelectedStylingBlocks(), { moveBlocks } = useBlocksStoreUndoableActions(), canMove = useCanMove(), treeRef = useRef(null), [, setTreeRef] = useAtom$1(treeRefAtom), { t } = useTranslation(), clearSelection = () => {
4590
+ const [treeData] = useAtom$1(treeDSBlocks), [ids, setIds] = useSelectedBlockIds(), [cutBlocksIds] = useCutBlockIds(), [, setHiddenBlocks] = useHiddenBlockIds(), updateBlockProps = useUpdateBlocksProps(), [, setStyleBlocks] = useSelectedStylingBlocks(), { moveBlocks } = useBlocksStoreUndoableActions(), canMove = useCanMove(), treeRef = useRef(null), [, setTreeRef] = useAtom$1(treeRefAtom), { t } = useTranslation(), [parentContext, setParentContext] = useState(null), clearSelection = () => {
4654
4591
  setIds([]), setStyleBlocks([]);
4655
4592
  }, filteredTreeData = useMemo(() => {
4656
4593
  const o = (n, a) => n.filter((l) => !a.includes(l._id)).map((l) => ({
@@ -4663,15 +4600,14 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4663
4600
  }, onMove = ({ dragIds: o, parentId: r, index: n }) => {
4664
4601
  canMove(o, r) && moveBlocks(o, r, n);
4665
4602
  }, onSelect = (o) => {
4666
- if (o.length === 0)
4667
- return;
4603
+ if (o.length === 0) return;
4668
4604
  const r = o[0] ? o[0].id : "";
4669
4605
  setStyleBlocks([]), setIds([r]);
4670
4606
  }, onContextMenu = (o) => {
4671
4607
  var a;
4672
- o.preventDefault();
4608
+ o.preventDefault(), parentContext && setParentContext(null);
4673
4609
  const r = o.target, n = r.getAttribute("data-node-id") || ((a = r.closest("[data-node-id]")) == null ? void 0 : a.getAttribute("data-node-id"));
4674
- n && (setStyleBlocks([]), setIds([n]));
4610
+ n ? (setStyleBlocks([]), setIds([n])) : (setStyleBlocks([]), setIds([]), setParentContext({ x: o.clientX, y: o.clientY }));
4675
4611
  }, debouncedDisableDrop = useDebouncedCallback(
4676
4612
  ({ parentNode: o, dragNodes: r }) => {
4677
4613
  var n;
@@ -4680,11 +4616,9 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4680
4616
  [],
4681
4617
  300
4682
4618
  ), handleKeyDown = (e) => {
4683
- if (!treeRef.current)
4684
- return;
4619
+ if (!treeRef.current) return;
4685
4620
  const tree = treeRef.current, selectedNode = tree.selectedNodes[0];
4686
- if (!selectedNode)
4687
- return;
4621
+ if (!selectedNode) return;
4688
4622
  setIds[selectedNode.id], setStyleBlocks([]);
4689
4623
  const isLeaf = !selectedNode.isInternal, isClosed = !selectedNode.isOpen, isOpen = selectedNode.isOpen, shortcut = defaultShortcuts.find((s) => s.key === e.key && (!s.when || eval(s.when)));
4690
4624
  if (shortcut)
@@ -4727,86 +4661,88 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4727
4661
  "+ ",
4728
4662
  t("Add Block")
4729
4663
  ] })
4730
- ] }) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex h-full select-none flex-col space-y-1"), onClick: () => clearSelection(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
4731
- "div",
4732
- {
4733
- id: "outline-view",
4734
- className: "no-scrollbar h-full overflow-y-auto text-sm",
4735
- onKeyDown: (o) => {
4736
- treeRef.current.isEditing || handleKeyDown(o);
4737
- },
4738
- children: [
4739
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex items-center justify-end gap-x-2 pb-2 text-sm text-muted-foreground", children: [
4740
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4741
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4742
- Button,
4743
- {
4744
- onClick: () => setHiddenBlocks([]),
4745
- variant: "outline",
4746
- className: "h-fit p-1 disabled:cursor-not-allowed disabled:opacity-50",
4747
- size: "sm",
4748
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Eye, { className: "h-4 w-4" })
4749
- }
4750
- ) }),
4751
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Show hidden blocks") })
4752
- ] }),
4753
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4754
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "h-fit p-1", onClick: () => {
4755
- var o;
4756
- return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.openAll();
4757
- }, variant: "outline", size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BiExpandVertical, { size: "14" }) }) }),
4758
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Expand all") })
4664
+ ] }) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4665
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex h-full select-none flex-col space-y-1"), onClick: () => clearSelection(), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
4666
+ "div",
4667
+ {
4668
+ id: "outline-view",
4669
+ className: "no-scrollbar h-full overflow-y-auto text-sm",
4670
+ onKeyDown: (o) => {
4671
+ treeRef.current.isEditing || handleKeyDown(o);
4672
+ },
4673
+ children: [
4674
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex items-center justify-end gap-x-2 pb-2 text-sm text-muted-foreground", children: [
4675
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4676
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4677
+ Button,
4678
+ {
4679
+ onClick: () => setHiddenBlocks([]),
4680
+ variant: "outline",
4681
+ className: "h-fit p-1 disabled:cursor-not-allowed disabled:opacity-50",
4682
+ size: "sm",
4683
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Eye, { className: "h-4 w-4" })
4684
+ }
4685
+ ) }),
4686
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Show hidden blocks") })
4687
+ ] }),
4688
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4689
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "h-fit p-1", onClick: () => {
4690
+ var o;
4691
+ return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.openAll();
4692
+ }, variant: "outline", size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BiExpandVertical, { size: "14" }) }) }),
4693
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Expand all") })
4694
+ ] }),
4695
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4696
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "h-fit p-1", onClick: () => {
4697
+ var o;
4698
+ return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.closeAll();
4699
+ }, variant: "outline", size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BiCollapseVertical, { size: "14" }) }) }),
4700
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Collapse all") })
4701
+ ] })
4759
4702
  ] }),
4760
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4761
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { className: "h-fit p-1", onClick: () => {
4762
- var o;
4763
- return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.closeAll();
4764
- }, variant: "outline", size: "sm", children: /* @__PURE__ */ jsxRuntimeExports.jsx(BiCollapseVertical, { size: "14" }) }) }),
4765
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Collapse all") })
4766
- ] })
4767
- ] }),
4768
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative z-[9999] ml-5 w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4769
- "div",
4770
- {
4771
- onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: 0 }),
4772
- className: "h-1 w-[90%] rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
4773
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute left-[45%] top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-purple-500 p-1 outline outline-2 outline-white hover:bg-purple-500", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-3 w-3 stroke-[3] text-white" }) })
4774
- }
4775
- ) }),
4776
- /* @__PURE__ */ jsxRuntimeExports.jsx(
4777
- Tree,
4778
- {
4779
- ref: treeRef,
4780
- height: window.innerHeight - 160,
4781
- className: "no-scrollbar !h-full max-w-full space-y-1 !overflow-y-auto !overflow-x-hidden",
4782
- rowClassName: "flex items-center h-full border-b border-transparent",
4783
- selection: ids[0] || "",
4784
- onRename,
4785
- openByDefault: !1,
4786
- onMove,
4787
- data: [...filteredTreeData],
4788
- renderCursor: DefaultCursor,
4789
- onSelect,
4790
- childrenAccessor: (o) => o.children,
4791
- width: "100%",
4792
- rowHeight: 28,
4793
- renderDragPreview: DefaultDragPreview,
4794
- indent: 10,
4795
- onContextMenu,
4796
- disableDrop: debouncedDisableDrop,
4797
- idAccessor: "_id",
4798
- children: Node
4799
- }
4800
- )
4801
- ]
4802
- }
4803
- ) });
4804
- }, Outline$1 = ListTree, hasVideoEmbed = (o) => {
4703
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative z-[9999] ml-5 w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4704
+ "div",
4705
+ {
4706
+ onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: 0 }),
4707
+ className: "h-1 w-[90%] rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
4708
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute left-[45%] top-1/2 flex h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform items-center justify-center rounded-full bg-purple-500 p-1 outline outline-2 outline-white hover:bg-purple-500", children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-3 w-3 stroke-[3] text-white" }) })
4709
+ }
4710
+ ) }),
4711
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
4712
+ Tree,
4713
+ {
4714
+ ref: treeRef,
4715
+ height: window.innerHeight - 160,
4716
+ className: "no-scrollbar !h-full max-w-full space-y-1 !overflow-y-auto !overflow-x-hidden",
4717
+ rowClassName: "flex items-center h-full border-b border-transparent",
4718
+ selection: ids[0] || "",
4719
+ onRename,
4720
+ openByDefault: !1,
4721
+ onMove,
4722
+ data: [...filteredTreeData],
4723
+ renderCursor: DefaultCursor,
4724
+ onSelect,
4725
+ childrenAccessor: (o) => o.children,
4726
+ width: "100%",
4727
+ rowHeight: 28,
4728
+ renderDragPreview: DefaultDragPreview,
4729
+ indent: 10,
4730
+ onContextMenu,
4731
+ disableDrop: debouncedDisableDrop,
4732
+ idAccessor: "_id",
4733
+ children: Node
4734
+ }
4735
+ )
4736
+ ]
4737
+ }
4738
+ ) }),
4739
+ /* @__PURE__ */ jsxRuntimeExports.jsx(PasteAtRootContextMenu, { parentContext, setParentContext })
4740
+ ] });
4741
+ }, hasVideoEmbed = (o) => {
4805
4742
  const r = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, n = /(?:https?:\/\/)?(?:www\.)?(player)?.vimeo\.com/;
4806
4743
  return r.test(o) || n.test(o);
4807
4744
  }, getVideoURLFromHTML = (o) => {
4808
- if (isEmpty(o))
4809
- return o;
4745
+ if (isEmpty(o)) return o;
4810
4746
  const r = /<video[^>]+src=['"]([^'">]+)['"]/, n = /<iframe[^>]+src=['"]([^'">]+)['"]/, a = o.match(r), l = o.match(n), i = a ? a[1] : l ? l[1] : null, c = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/, d = /(?:https?:\/\/)?(?:www\.)?player.vimeo\.com/;
4811
4747
  return i && (c.test(i) || d.test(i)) ? i : o;
4812
4748
  }, NAME_ATTRIBUTES = ["chai-name", "data-chai-name"], ATTRIBUTE_MAP = {
@@ -4846,8 +4782,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4846
4782
  ["Heading", "Paragraph", "Span", "ListItem", "Button", "Label", "TableCell", "Link", "RichText"],
4847
4783
  r._type
4848
4784
  ), getTextContent = (o) => o.map((r) => r.type === "text" ? get(r, "content", "") : isEmpty(r.children) ? "" : getTextContent(r.children)).join(""), getSanitizedValue = (o) => o === null ? "" : o, getAttrs = (o) => {
4849
- if (o.tagName === "svg")
4850
- return {};
4785
+ if (o.tagName === "svg") return {};
4851
4786
  const r = {}, n = ATTRIBUTE_MAP[o.tagName] || {}, a = o.attributes;
4852
4787
  return forEach(a, ({ key: l, value: i }) => {
4853
4788
  if (!includes(NAME_ATTRIBUTES, l))
@@ -4857,12 +4792,10 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4857
4792
  c && d ? i = `https://via.placeholder.com/${c == null ? void 0 : c.value}x${d == null ? void 0 : d.value}` : i = "https://via.placeholder.com/150x150";
4858
4793
  }
4859
4794
  set(r, n[l], getSanitizedValue(i));
4860
- } else
4861
- includes(["style", "class", "srcset"], l) || (has(r, "styles_attrs") || (r.styles_attrs = {}), startsWith(l, "@") && (l = l.replace("@", "x-on:")), r.styles_attrs[`${l}`] = getSanitizedValue(i));
4795
+ } else includes(["style", "class", "srcset"], l) || (has(r, "styles_attrs") || (r.styles_attrs = {}), startsWith(l, "@") && (l = l.replace("@", "x-on:")), r.styles_attrs[`${l}`] = getSanitizedValue(i));
4862
4796
  }), delete r.class, r;
4863
4797
  }, getStyles = (o, r = "styles") => {
4864
- if (!o.attributes)
4865
- return { [r]: `${STYLES_KEY},` };
4798
+ if (!o.attributes) return { [r]: `${STYLES_KEY},` };
4866
4799
  const n = find(o.attributes, { key: "class" });
4867
4800
  if (n) {
4868
4801
  const a = n.value;
@@ -4870,7 +4803,17 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4870
4803
  }
4871
4804
  return { [r]: `${STYLES_KEY},` };
4872
4805
  }, getBlockProps = (o) => {
4873
- const r = get(o, "attributes", []), n = r.find((l) => l.key === "data-chai-richtext" || l.key === "chai-richtext"), a = r.find((l) => l.key === "data-chai-lightbox" || l.key === "chai-lightbox");
4806
+ const r = get(o, "attributes", []), n = r.find((d) => d.key === "data-chai-richtext" || d.key === "chai-richtext"), a = r.find((d) => d.key === "data-chai-lightbox" || d.key === "chai-lightbox"), l = r.find((d) => d.key === "data-chai-dropdown" || d.key === "chai-dropdown"), i = r.find(
4807
+ (d) => d.key === "data-chai-dropdown-button" || d.key === "chai-dropdown-button"
4808
+ ), c = r.find(
4809
+ (d) => d.key === "data-chai-dropdown-content" || d.key === "chai-dropdown-content"
4810
+ );
4811
+ if (l)
4812
+ return { _type: "Dropdown" };
4813
+ if (i)
4814
+ return { _type: "DropdownButton" };
4815
+ if (c)
4816
+ return { _type: "DropdownContent" };
4874
4817
  if (n)
4875
4818
  return { _type: "RichText" };
4876
4819
  if (a)
@@ -4947,25 +4890,31 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4947
4890
  case "tfoot":
4948
4891
  return { _type: "TableFooter" };
4949
4892
  default: {
4950
- const l = get(o, "children", []).length > 0 ? "Box" : "EmptyBox";
4893
+ const d = get(o, "children", []).length > 0 ? "Box" : "EmptyBox";
4951
4894
  return {
4952
- _type: l,
4895
+ _type: d,
4953
4896
  tag: o.tagName,
4954
- _name: l == "EmptyBox" || o.tagName === "div" ? l : capitalize(o.tagName)
4897
+ _name: d == "EmptyBox" || o.tagName === "div" ? d : capitalize(o.tagName)
4955
4898
  };
4956
4899
  }
4957
4900
  }
4958
4901
  }, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
4959
- var p, u, x, h, g, j, b, f;
4960
- if (n.type === "comment")
4961
- return [];
4902
+ var h, m, E, y, g, k, _, A;
4903
+ if (n.type === "comment") return [];
4904
+ console.log("node ===>", n);
4962
4905
  let a = { _id: generateUUID() };
4963
4906
  if (r && (a._parent = r.block._id), n.type === "text")
4964
4907
  return isEmpty(get(n, "content", "")) ? [] : r && shouldAddText(r.node, r.block) ? (set(r, "block.content", get(n, "content", "")), []) : { ...a, _type: "Text", content: get(n, "content", "") };
4965
4908
  const l = get(n, "attributes", []), i = l.find(
4966
- (y) => y.key === "data-chai-richtext" || y.key === "chai-richtext"
4909
+ (S) => S.key === "data-chai-richtext" || S.key === "chai-richtext"
4967
4910
  ), c = l.find(
4968
- (y) => y.key === "data-chai-lightbox" || y.key === "chai-lightbox"
4911
+ (S) => S.key === "data-chai-lightbox" || S.key === "chai-lightbox"
4912
+ ), d = l.find(
4913
+ (S) => S.key === "data-chai-dropdown" || S.key === "chai-dropdown"
4914
+ ), p = l.find(
4915
+ (S) => S.key === "data-chai-dropdown-button" || S.key === "chai-dropdown-button"
4916
+ ), u = l.find(
4917
+ (S) => S.key === "data-chai-dropdown-content" || S.key === "chai-dropdown-content"
4969
4918
  );
4970
4919
  if (a = {
4971
4920
  ...a,
@@ -4973,13 +4922,13 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4973
4922
  ...getAttrs(n),
4974
4923
  ...getStyles(n)
4975
4924
  }, n.attributes) {
4976
- const y = n.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
4977
- y && (a._name = y.value);
4925
+ const S = n.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
4926
+ S && (a._name = S.value);
4978
4927
  }
4979
4928
  if (i)
4980
4929
  return a.content = stringify(n.children), has(a, "styles_attrs.data-chai-richtext") && delete a.styles_attrs["data-chai-richtext"], has(a, "styles_attrs.chai-richtext") && delete a.styles_attrs["chai-richtext"], [a];
4981
4930
  if (c) {
4982
- const y = [
4931
+ const S = [
4983
4932
  "data-chai-lightbox",
4984
4933
  "chai-lightbox",
4985
4934
  "data-vbtype",
@@ -4991,33 +4940,57 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4991
4940
  ];
4992
4941
  a = {
4993
4942
  ...a,
4994
- href: ((p = l.find((v) => v.key === "href")) == null ? void 0 : p.value) || "",
4995
- hrefType: ((u = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : u.value) || "video",
4996
- autoplay: ((x = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : x.value) === "true" ? "true" : "false",
4997
- maxWidth: ((g = (h = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : h.value) == null ? void 0 : g.replace("px", "")) || "",
4998
- backdropColor: ((j = l.find((v) => v.key === "data-overlay")) == null ? void 0 : j.value) || "",
4999
- galleryName: ((b = l.find((v) => v.key === "data-gall")) == null ? void 0 : b.value) || ""
5000
- }, forEach(y, (v) => {
4943
+ href: ((h = l.find((v) => v.key === "href")) == null ? void 0 : h.value) || "",
4944
+ hrefType: ((m = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
4945
+ autoplay: ((E = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : E.value) === "true" ? "true" : "false",
4946
+ maxWidth: ((g = (y = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : y.value) == null ? void 0 : g.replace("px", "")) || "",
4947
+ backdropColor: ((k = l.find((v) => v.key === "data-overlay")) == null ? void 0 : k.value) || "",
4948
+ galleryName: ((_ = l.find((v) => v.key === "data-gall")) == null ? void 0 : _.value) || ""
4949
+ }, forEach(S, (v) => {
5001
4950
  has(a, `styles_attrs.${v}`) && delete a.styles_attrs[v];
5002
4951
  });
5003
4952
  }
4953
+ if (d && (delete a.styles_attrs, a.showDropdown = !1), u && delete a.styles_attrs, p) {
4954
+ delete a.styles_attrs;
4955
+ const S = filter(n.children || [], (R) => (R == null ? void 0 : R.tagName) !== "span");
4956
+ a.content = getTextContent(S);
4957
+ const v = find(
4958
+ n.children || [],
4959
+ (R) => (R == null ? void 0 : R.tagName) === "span" && some(R.children || [], (f) => (f == null ? void 0 : f.tagName) === "svg")
4960
+ );
4961
+ if (v) {
4962
+ const R = find(v.children || [], (f) => (f == null ? void 0 : f.tagName) === "svg");
4963
+ if (R) {
4964
+ a.icon = stringify([R]);
4965
+ const { height: f, width: j } = getSvgDimensions(R, "16px", "16px");
4966
+ a.iconHeight = f, a.iconWidth = j;
4967
+ }
4968
+ }
4969
+ return [a];
4970
+ }
5004
4971
  if (a._type === "Input") {
5005
- const y = a.inputType || "text";
5006
- y === "checkbox" ? set(a, "_type", "Checkbox") : y === "radio" && set(a, "_type", "Radio");
4972
+ const S = a.inputType || "text";
4973
+ S === "checkbox" ? set(a, "_type", "Checkbox") : S === "radio" && set(a, "_type", "Radio");
5007
4974
  } else if (n.tagName === "video" || n.tagName === "iframe") {
5008
- const y = stringify([n]);
5009
- return hasVideoEmbed(y) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(y)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = y, [a];
4975
+ const S = stringify([n]);
4976
+ return hasVideoEmbed(S) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(S)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = S, [a];
5010
4977
  } else if (n.tagName === "svg") {
5011
- const y = find(n.attributes, { key: "height" }), v = find(n.attributes, { key: "width" }), B = get(y, "value") ? `[${get(y, "value")}px]` : "24px", A = get(v, "value") ? `[${get(v, "value")}px]` : "24px", S = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
5012
- return a.styles = `${STYLES_KEY}, ${cn(`w-${A} h-${B}`, S)}`.trim(), n.attributes = filter(n.attributes, (k) => !includes(["style", "width", "height", "class"], k.key)), a.icon = stringify([n]), [a];
5013
- } else if (n.tagName == "option" && r && ((f = r.block) == null ? void 0 : f._type) === "Select")
4978
+ const S = find(n.attributes, { key: "height" }), v = find(n.attributes, { key: "width" }), R = get(S, "value") ? `[${get(S, "value")}px]` : "24px", f = get(v, "value") ? `[${get(v, "value")}px]` : "24px", j = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
4979
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${f} h-${R}`, j)}`.trim(), n.attributes = filter(n.attributes, (w) => !includes(["style", "width", "height", "class"], w.key)), a.icon = stringify([n]), [a];
4980
+ } else if (n.tagName == "option" && r && ((A = r.block) == null ? void 0 : A._type) === "Select")
5014
4981
  return r.block.options.push({
5015
4982
  label: getTextContent(n.children),
5016
4983
  ...getAttrs(n)
5017
4984
  }), [];
5018
- const d = traverseNodes(n.children, { block: a, node: n });
5019
- return [a, ...d];
5020
- }), getSanitizedHTML = (o) => {
4985
+ const x = traverseNodes(n.children, { block: a, node: n });
4986
+ return [a, ...x];
4987
+ }), getSvgDimensions = (o, r, n) => {
4988
+ const a = get(o, "attributes", []), l = find(a, { key: "height" }), i = find(a, { key: "width" });
4989
+ return {
4990
+ height: get(l, "value") ? `[${get(l, "value")}px]` : n,
4991
+ width: get(i, "value") ? `[${get(i, "value")}px]` : r
4992
+ };
4993
+ }, getSanitizedHTML = (o) => {
5021
4994
  o = o.replace(/(\w+)=\\?"(.*?)\\?"/g, (a, l, i) => {
5022
4995
  let c = i.replace(/\\"/g, '"');
5023
4996
  return c = c.replace(/{([^}]+)}/g, (d) => d.replace(/"/g, '\\"')), `${l}="${c.replace(/\\"/g, '"')}"`;
@@ -5052,7 +5025,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
5052
5025
  ] }) }),
5053
5026
  /* @__PURE__ */ jsxRuntimeExports.jsx(CardFooter, { className: "flex flex-col justify-end p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { disabled: a.trim() === "", onClick: () => c(), size: "sm", className: "w-fit", children: n("Import HTML") }) })
5054
5027
  ] });
5055
- }, ImportHTML$1 = ImportHTML, BindingWidget = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100", children: "Data binding is set for this field" }), getSvgMarkup = (o) => {
5028
+ }, BindingWidget = () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs border rounded-sm p-1 mt-1 border-orange-500 text-orange-500 bg-orange-100", children: "Data binding is set for this field" }), getSvgMarkup = (o) => {
5056
5029
  try {
5057
5030
  const r = document.getElementById("icon-picker-field"), n = document.createElement("div");
5058
5031
  ReactDOM.render(/* @__PURE__ */ jsxRuntimeExports.jsx(IconPickerItem, { value: o }), n), r.appendChild(n), n.hidden = !0;
@@ -5133,13 +5106,13 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
5133
5106
  ] });
5134
5107
  };
5135
5108
  MediaManagerModal.displayName = "MediaManagerModal";
5136
- const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
5109
+ const ImagePickerField = ({ value: o, onChange: r, id: n, onBlur: a }) => {
5137
5110
  const l = useBuilderProp("mediaManagerComponent", null), { t: i } = useTranslation(), c = l !== null;
5138
5111
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
5139
- o ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o, className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover", alt: "" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MediaManagerModal$1, { onSelect: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
5112
+ o ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o, className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover", alt: "" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MediaManagerModal, { onSelect: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
5140
5113
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-3/5 flex-col", children: [
5141
5114
  c && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
5142
- /* @__PURE__ */ jsxRuntimeExports.jsx(MediaManagerModal$1, { onSelect: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "h-6 cursor-pointer rounded-md bg-primary px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: o || !isEmpty(o) ? i("Replace image") : i("Choose image") }) }),
5115
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MediaManagerModal, { onSelect: r, children: /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "h-6 cursor-pointer rounded-md bg-primary px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: o || !isEmpty(o) ? i("Replace image") : i("Choose image") }) }),
5143
5116
  /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-gray-600", children: "OR" })
5144
5117
  ] }),
5145
5118
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5199,101 +5172,99 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5199
5172
  pageTypes: r,
5200
5173
  onChange: n
5201
5174
  }) => {
5202
- var P;
5203
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (m, E) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, x] = useState("page"), [h, g] = useState(""), [j, b] = useState([]), [f, y] = useState(-1), v = useRef(null), B = (P = r == null ? void 0 : r.find((m) => m.key === u)) == null ? void 0 : P.name;
5175
+ var w;
5176
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (b, C) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, x] = useState("page"), [h, m] = useState(""), [E, y] = useState([]), [g, k] = useState(-1), _ = useRef(null), A = (w = r == null ? void 0 : r.find((b) => b.key === u)) == null ? void 0 : w.name;
5204
5177
  useEffect(() => {
5205
- if (g(""), b([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:"))
5206
- return;
5207
- const m = split(o, ":"), E = get(m, 1, "page") || "page";
5208
- x(E), (async () => {
5209
- const R = await l(E, [get(m, 2, "page")]);
5210
- R && Array.isArray(R) && g(get(R, [0, "name"], ""));
5178
+ if (m(""), y([]), k(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
5179
+ const b = split(o, ":"), C = get(b, 1, "page") || "page";
5180
+ x(C), (async () => {
5181
+ const B = await l(C, [get(b, 2, "page")]);
5182
+ B && Array.isArray(B) && m(get(B, [0, "name"], ""));
5211
5183
  })();
5212
5184
  }, [o]);
5213
- const A = useDebouncedCallback(
5214
- async (m) => {
5215
- if (isEmpty(m))
5216
- b([]);
5185
+ const S = useDebouncedCallback(
5186
+ async (b) => {
5187
+ if (isEmpty(b))
5188
+ y([]);
5217
5189
  else {
5218
- const E = await l(u, m);
5219
- b(E);
5190
+ const C = await l(u, b);
5191
+ y(C);
5220
5192
  }
5221
- c(!1), y(-1);
5193
+ c(!1), k(-1);
5222
5194
  },
5223
5195
  [u],
5224
5196
  300
5225
- ), S = (m) => {
5226
- const E = ["pageType", u, m.id];
5227
- E[1] && (n(E.join(":")), g(m.name), p(!1), b([]), y(-1));
5228
- }, k = (m) => {
5229
- switch (m.key) {
5197
+ ), v = (b) => {
5198
+ const C = ["pageType", u, b.id];
5199
+ C[1] && (n(C.join(":")), m(b.name), p(!1), y([]), k(-1));
5200
+ }, R = (b) => {
5201
+ switch (b.key) {
5230
5202
  case "ArrowDown":
5231
- m.preventDefault(), y((E) => E < j.length - 1 ? E + 1 : E);
5203
+ b.preventDefault(), k((C) => C < E.length - 1 ? C + 1 : C);
5232
5204
  break;
5233
5205
  case "ArrowUp":
5234
- m.preventDefault(), y((E) => E > 0 ? E - 1 : E);
5206
+ b.preventDefault(), k((C) => C > 0 ? C - 1 : C);
5235
5207
  break;
5236
5208
  case "Enter":
5237
- if (m.preventDefault(), j.length === 0)
5238
- return;
5239
- f >= 0 && S(j[f]);
5209
+ if (b.preventDefault(), E.length === 0) return;
5210
+ g >= 0 && v(E[g]);
5240
5211
  break;
5241
5212
  case "Escape":
5242
- m.preventDefault(), T();
5213
+ b.preventDefault(), f();
5243
5214
  break;
5244
5215
  }
5245
5216
  };
5246
5217
  useEffect(() => {
5247
- if (f >= 0 && v.current) {
5248
- const m = v.current.children[f];
5249
- m == null || m.scrollIntoView({ block: "nearest" });
5218
+ if (g >= 0 && _.current) {
5219
+ const b = _.current.children[g];
5220
+ b == null || b.scrollIntoView({ block: "nearest" });
5250
5221
  }
5251
- }, [f]);
5252
- const T = () => {
5253
- g(""), b([]), y(-1), p(!1), n("");
5254
- }, _ = (m) => {
5255
- g(m), p(!isEmpty(m)), c(!0), A(m);
5222
+ }, [g]);
5223
+ const f = () => {
5224
+ m(""), y([]), k(-1), p(!1), n("");
5225
+ }, j = (b) => {
5226
+ m(b), p(!isEmpty(b)), c(!0), S(b);
5256
5227
  };
5257
5228
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5258
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "pageType", value: u, onChange: (m) => x(m.target.value), children: map(r, (m) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: m.key, children: m.name }, m.key)) }),
5229
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "pageType", value: u, onChange: (b) => x(b.target.value), children: map(r, (b) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: b.key, children: b.name }, b.key)) }),
5259
5230
  u && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
5260
5231
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5261
5232
  "input",
5262
5233
  {
5263
5234
  type: "text",
5264
5235
  value: h,
5265
- onChange: (m) => _(m.target.value),
5266
- onKeyDown: k,
5267
- placeholder: a(`Search ${B ?? ""}`),
5236
+ onChange: (b) => j(b.target.value),
5237
+ onKeyDown: R,
5238
+ placeholder: a(`Search ${A ?? ""}`),
5268
5239
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
5269
5240
  }
5270
5241
  ),
5271
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: T, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
5242
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: h && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: f, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
5272
5243
  ] }),
5273
- (i || !isEmpty(j) || d && isEmpty(j)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
5244
+ (i || !isEmpty(E) || d && isEmpty(E)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
5274
5245
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
5275
5246
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
5276
- ] }) : d && isEmpty(j) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
5247
+ ] }) : d && isEmpty(E) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
5277
5248
  a("No results found for"),
5278
5249
  ' "',
5279
5250
  h,
5280
5251
  '"'
5281
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: v, children: map(j == null ? void 0 : j.slice(0, 20), (m, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5252
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: _, children: map(E == null ? void 0 : E.slice(0, 20), (b, C) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5282
5253
  "li",
5283
5254
  {
5284
- onClick: () => S(m),
5285
- className: `cursor-pointer p-2 text-xs ${o != null && o.includes(m.id) ? "bg-blue-200" : E === f ? "bg-gray-100" : "hover:bg-gray-100"}`,
5255
+ onClick: () => v(b),
5256
+ className: `cursor-pointer p-2 text-xs ${o != null && o.includes(b.id) ? "bg-blue-200" : C === g ? "bg-gray-100" : "hover:bg-gray-100"}`,
5286
5257
  children: [
5287
- m.name,
5258
+ b.name,
5288
5259
  " ",
5289
- m.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
5260
+ b.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
5290
5261
  "( ",
5291
- m.slug,
5262
+ b.slug,
5292
5263
  " )"
5293
5264
  ] })
5294
5265
  ]
5295
5266
  },
5296
- m.id
5267
+ b.id
5297
5268
  )) }) })
5298
5269
  ] });
5299
5270
  }, LinkField = ({ schema: o, formData: r, onChange: n }) => {
@@ -5350,8 +5321,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5350
5321
  ] });
5351
5322
  }, RowColField = () => {
5352
5323
  const o = useSelectedBlock(), r = useWrapperBlock(), { addCoreBlock: n } = useAddBlock();
5353
- if (!o && !r)
5354
- return null;
5324
+ if (!o && !r) return null;
5355
5325
  const a = (o == null ? void 0 : o._type) === "Row" ? o : r;
5356
5326
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
5357
5327
  "button",
@@ -5367,8 +5337,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5367
5337
  ) });
5368
5338
  }, CodeEditor = ({ id: o, placeholder: r }) => {
5369
5339
  const { t: n } = useTranslation(), [, a] = useCodeEditor(), l = useSelectedBlock();
5370
- if (typeof window > "u")
5371
- return null;
5340
+ if (typeof window > "u") return null;
5372
5341
  const i = o.replace("root.", ""), c = get(l, i, ""), d = () => {
5373
5342
  const p = l == null ? void 0 : l._id;
5374
5343
  a({ blockId: p, blockProp: i, placeholder: r, initialCode: get(l, i, c) });
@@ -5397,23 +5366,22 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5397
5366
  schema: u,
5398
5367
  formData: x
5399
5368
  }) => {
5400
- const { selectedLang: h, fallbackLang: g, languages: j } = useLanguages(), b = isEmpty(j) ? "" : isEmpty(h) ? g : h, f = get(LANGUAGES, b, b), y = useSelectedBlock(), v = useRegisteredChaiBlocks(), B = get(v, [y == null ? void 0 : y._type, "i18nProps"], []) || [], [A, S] = useState(null);
5369
+ const { selectedLang: h, fallbackLang: m, languages: E } = useLanguages(), y = isEmpty(E) ? "" : isEmpty(h) ? m : h, g = get(LANGUAGES, y, y), k = useSelectedBlock(), _ = useRegisteredChaiBlocks(), A = get(_, [k == null ? void 0 : k._type, "i18nProps"], []) || [], [S, v] = useState(null);
5401
5370
  if (d)
5402
5371
  return null;
5403
- if (u.type === "boolean")
5404
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: r, children: a });
5405
- const T = B == null ? void 0 : B.includes(o.replace("root.", ""));
5372
+ if (u.type === "boolean") return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: r, children: a });
5373
+ const f = A == null ? void 0 : A.includes(o.replace("root.", ""));
5406
5374
  if (u.type === "array") {
5407
- const _ = A === o;
5375
+ const j = S === o;
5408
5376
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${r} relative`, children: [
5409
5377
  u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs(
5410
5378
  "label",
5411
5379
  {
5412
5380
  htmlFor: o,
5413
- onClick: () => S(_ ? null : o),
5381
+ onClick: () => v(j ? null : o),
5414
5382
  className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
5415
5383
  children: [
5416
- _ ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3" }),
5384
+ j ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3" }),
5417
5385
  /* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-3 w-3" }),
5418
5386
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "leading-tight", children: n }),
5419
5387
  " ",
@@ -5421,7 +5389,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5421
5389
  ]
5422
5390
  }
5423
5391
  ),
5424
- (x == null ? void 0 : x.length) === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${_ ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
5392
+ (x == null ? void 0 : x.length) === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-0 overflow-hidden", children: a }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${j ? "pt-0.5" : "h-0 overflow-hidden"}`, children: [
5425
5393
  c,
5426
5394
  a,
5427
5395
  l,
@@ -5433,9 +5401,9 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5433
5401
  u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
5434
5402
  n,
5435
5403
  " ",
5436
- T && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "text-[9px] text-zinc-400", children: [
5404
+ f && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "text-[9px] text-zinc-400", children: [
5437
5405
  " ",
5438
- f
5406
+ g
5439
5407
  ] }),
5440
5408
  p && u.type !== "object" ? " *" : null
5441
5409
  ] }),
@@ -5498,8 +5466,7 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5498
5466
  );
5499
5467
  }), CanvasSettings = () => {
5500
5468
  const [o, r] = useAtom$1(xShowBlocksAtom), n = useSelectedBlock(), [, a] = useSelectedBlockIds(), { t: l } = useTranslation(), i = useMemo(() => (n ? JSON.stringify(n) : "").includes('"x-show"'), [n]);
5501
- if (!n || !i)
5502
- return null;
5469
+ if (!n || !i) return null;
5503
5470
  const c = o.includes(n._id);
5504
5471
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "py-2 text-xs hover:no-underline", children: [
5505
5472
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 border-b border-border bg-background py-2 font-normal text-muted-foreground", children: [
@@ -5562,50 +5529,50 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5562
5529
  return set(n, o, r), n;
5563
5530
  };
5564
5531
  function BlockSettings() {
5565
- const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), x = useWrapperBlock(), h = getRegisteredChaiBlock(x == null ? void 0 : x._type), g = formDataWithSelectedLang(x, o, h), j = ({ formData: k }, T, _) => {
5566
- if (T && (c == null ? void 0 : c._id) === r._id) {
5567
- const P = T.replace("root.", "");
5568
- a([r._id], { [P]: get(k, P) }, _);
5532
+ const { selectedLang: o } = useLanguages(), r = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(r == null ? void 0 : r._type), i = formDataWithSelectedLang(r, o, l), [c, d] = useState(i), [p, u] = useState(!1), x = useWrapperBlock(), h = getRegisteredChaiBlock(x == null ? void 0 : x._type), m = formDataWithSelectedLang(x, o, h), E = ({ formData: R }, f, j) => {
5533
+ if (f && (c == null ? void 0 : c._id) === r._id) {
5534
+ const w = f.replace("root.", "");
5535
+ a([r._id], { [w]: get(R, w) }, j);
5569
5536
  }
5570
- }, b = useCallback(
5571
- debounce(({ formData: k }, T, _) => {
5572
- j({ formData: k }, T, _), d(k);
5537
+ }, y = useCallback(
5538
+ debounce(({ formData: R }, f, j) => {
5539
+ E({ formData: R }, f, j), d(R);
5573
5540
  }, 1500),
5574
5541
  [r == null ? void 0 : r._id, o]
5575
- ), f = ({ formData: k }, T) => {
5576
- if (T) {
5577
- const _ = T.replace("root.", "");
5542
+ ), g = ({ formData: R }, f) => {
5543
+ if (f) {
5544
+ const j = f.replace("root.", "");
5578
5545
  n(
5579
5546
  [r._id],
5580
- convertDotNotationToObject(_, get(k, _.split(".")))
5581
- ), b({ formData: k }, T, { [_]: get(c, _) });
5547
+ convertDotNotationToObject(j, get(R, j.split(".")))
5548
+ ), y({ formData: R }, f, { [j]: get(c, j) });
5582
5549
  }
5583
- }, y = ({ formData: k }, T) => {
5584
- if (T) {
5585
- const _ = T.replace("root.", "");
5550
+ }, k = ({ formData: R }, f) => {
5551
+ if (f) {
5552
+ const j = f.replace("root.", "");
5586
5553
  n(
5587
5554
  [x._id],
5588
- convertDotNotationToObject(_, get(k, _.split(".")))
5589
- ), b({ formData: k }, T, { [_]: get(c, _) });
5555
+ convertDotNotationToObject(j, get(R, j.split(".")))
5556
+ ), y({ formData: R }, f, { [j]: get(c, j) });
5590
5557
  }
5591
5558
  };
5592
5559
  keys(get(i, "_bindings", {}));
5593
- const { schema: v, uiSchema: B } = useMemo(() => {
5594
- const k = r == null ? void 0 : r._type;
5595
- if (k)
5596
- return getBlockFormSchemas(k);
5597
- }, [r]), { wrapperSchema: A, wrapperUiSchema: S } = useMemo(() => {
5560
+ const { schema: _, uiSchema: A } = useMemo(() => {
5561
+ const R = r == null ? void 0 : r._type;
5562
+ if (R)
5563
+ return getBlockFormSchemas(R);
5564
+ }, [r]), { wrapperSchema: S, wrapperUiSchema: v } = useMemo(() => {
5598
5565
  if (!x || !(x != null && x._type))
5599
5566
  return { wrapperSchema: {}, wrapperUiSchema: {} };
5600
- const k = x == null ? void 0 : x._type, { schema: T = {}, uiSchema: _ = {} } = getBlockFormSchemas(k);
5601
- return { wrapperSchema: T, wrapperUiSchema: _ };
5567
+ const R = x == null ? void 0 : x._type, { schema: f = {}, uiSchema: j = {} } = getBlockFormSchemas(R);
5568
+ return { wrapperSchema: f, wrapperUiSchema: j };
5602
5569
  }, [x]);
5603
5570
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
5604
5571
  !isEmpty(x) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
5605
5572
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
5606
5573
  "div",
5607
5574
  {
5608
- onClick: () => u((k) => !k),
5575
+ onClick: () => u((R) => !R),
5609
5576
  className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
5610
5577
  children: [
5611
5578
  p ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-4 w-4 stroke-[3] text-slate-400" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-4 w-4 stroke-[3] text-slate-400" }),
@@ -5624,21 +5591,21 @@ function BlockSettings() {
5624
5591
  JSONForm,
5625
5592
  {
5626
5593
  id: x == null ? void 0 : x._id,
5627
- onChange: y,
5628
- formData: g,
5629
- schema: A,
5630
- uiSchema: S
5594
+ onChange: k,
5595
+ formData: m,
5596
+ schema: S,
5597
+ uiSchema: v
5631
5598
  }
5632
5599
  )
5633
5600
  ] }),
5634
- isEmpty(v) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5601
+ isEmpty(_) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5635
5602
  JSONForm,
5636
5603
  {
5637
5604
  id: r == null ? void 0 : r._id,
5638
- onChange: f,
5605
+ onChange: g,
5639
5606
  formData: i,
5640
- schema: v,
5641
- uiSchema: B
5607
+ schema: _,
5608
+ uiSchema: A
5642
5609
  }
5643
5610
  ),
5644
5611
  (r == null ? void 0 : r._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
@@ -5666,8 +5633,7 @@ function Countdown() {
5666
5633
  r(o - 0.1);
5667
5634
  }, 100);
5668
5635
  return () => clearTimeout(p);
5669
- } else
5670
- o <= 0 && (a(!1), r(SECONDS));
5636
+ } else o <= 0 && (a(!1), r(SECONDS));
5671
5637
  }, [n, o]);
5672
5638
  const l = () => {
5673
5639
  a(!0), r(SECONDS);
@@ -5712,12 +5678,12 @@ function Countdown() {
5712
5678
  const AskAIStyles = ({ blockId: o }) => {
5713
5679
  const { t: r } = useTranslation(), { askAi: n, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), [u, x] = useState();
5714
5680
  useEffect(() => {
5715
- var g;
5716
- (g = d.current) == null || g.focus();
5681
+ var m;
5682
+ (m = d.current) == null || m.focus();
5717
5683
  }, []);
5718
- const h = (g) => {
5719
- const { usage: j } = g || {};
5720
- !l && j && x(j), p.current = setTimeout(() => x(void 0), 1e4), l || c("");
5684
+ const h = (m) => {
5685
+ const { usage: E } = m || {};
5686
+ !l && E && x(E), p.current = setTimeout(() => x(void 0), 1e4), l || c("");
5721
5687
  };
5722
5688
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5723
5689
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: r("Ask AI") }),
@@ -5726,12 +5692,12 @@ const AskAIStyles = ({ blockId: o }) => {
5726
5692
  {
5727
5693
  ref: d,
5728
5694
  value: i,
5729
- onChange: (g) => c(g.target.value),
5695
+ onChange: (m) => c(m.target.value),
5730
5696
  placeholder: r("Ask AI to edit styles"),
5731
5697
  className: "no-scrollbar my-2 w-full border border-border p-2 text-xs",
5732
5698
  rows: 4,
5733
- onKeyDown: (g) => {
5734
- g.key === "Enter" && (g.preventDefault(), p.current && clearTimeout(p.current), x(void 0), n("styles", o, i, h));
5699
+ onKeyDown: (m) => {
5700
+ m.key === "Enter" && (m.preventDefault(), p.current && clearTimeout(p.current), x(void 0), n("styles", o, i, h));
5735
5701
  }
5736
5702
  }
5737
5703
  ),
@@ -5772,37 +5738,37 @@ const AskAIStyles = ({ blockId: o }) => {
5772
5738
  ] });
5773
5739
  };
5774
5740
  function ManualClasses() {
5775
- var T;
5776
- const o = useFuseSearch(), { t: r } = useTranslation(), [n] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [p, u] = useState(""), { toast: x } = useToast(), h = (T = first(n)) == null ? void 0 : T.prop, g = reject((get(a, h, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), j = () => {
5777
- const _ = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5778
- l(c, _, !0), u("");
5779
- }, [b, f] = useState([]), y = ({ value: _ }) => {
5780
- const P = _.trim().toLowerCase(), m = P.match(/.+:/g);
5781
- let E = [];
5782
- if (m && m.length > 0) {
5783
- const [R] = m, C = P.replace(R, "");
5784
- E = o.search(C).map((I) => ({
5741
+ var f;
5742
+ const o = useFuseSearch(), { t: r } = useTranslation(), [n] = useSelectedStylingBlocks(), a = useSelectedBlock(), l = useAddClassesToBlocks(), i = useRemoveClassesFromBlocks(), [c] = useSelectedBlockIds(), d = useBuilderProp("askAiCallBack", null), [p, u] = useState(""), { toast: x } = useToast(), h = (f = first(n)) == null ? void 0 : f.prop, m = reject((get(a, h, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), E = () => {
5743
+ const j = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5744
+ l(c, j, !0), u("");
5745
+ }, [y, g] = useState([]), k = ({ value: j }) => {
5746
+ const w = j.trim().toLowerCase(), b = w.match(/.+:/g);
5747
+ let C = [];
5748
+ if (b && b.length > 0) {
5749
+ const [B] = b, N = w.replace(B, "");
5750
+ C = o.search(N).map((I) => ({
5785
5751
  ...I,
5786
- item: { ...I.item, name: R + I.item.name }
5752
+ item: { ...I.item, name: B + I.item.name }
5787
5753
  }));
5788
5754
  } else
5789
- E = o.search(P);
5790
- return f(map(E, "item"));
5791
- }, v = () => {
5792
- f([]);
5793
- }, B = (_) => _.name, A = (_) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: _.name }), S = {
5755
+ C = o.search(w);
5756
+ return g(map(C, "item"));
5757
+ }, _ = () => {
5758
+ g([]);
5759
+ }, A = (j) => j.name, S = (j) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: j.name }), v = {
5794
5760
  autoComplete: "off",
5795
5761
  autoCorrect: "off",
5796
5762
  autoCapitalize: "off",
5797
5763
  spellCheck: !1,
5798
5764
  placeholder: r("Enter classes separated by space"),
5799
5765
  value: p,
5800
- onKeyDown: (_) => {
5801
- _.key === "Enter" && p.trim() !== "" && j();
5766
+ onKeyDown: (j) => {
5767
+ j.key === "Enter" && p.trim() !== "" && E();
5802
5768
  },
5803
- onChange: (_, { newValue: P }) => u(P),
5769
+ onChange: (j, { newValue: w }) => u(w),
5804
5770
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5805
- }, k = () => {
5771
+ }, R = () => {
5806
5772
  if (navigator.clipboard === void 0) {
5807
5773
  x({
5808
5774
  title: r("Clipboard not supported"),
@@ -5811,7 +5777,7 @@ function ManualClasses() {
5811
5777
  });
5812
5778
  return;
5813
5779
  }
5814
- navigator.clipboard.writeText(g.join(" ")), x({
5780
+ navigator.clipboard.writeText(m.join(" ")), x({
5815
5781
  title: r("Copied"),
5816
5782
  description: r("Classes copied to clipboard")
5817
5783
  });
@@ -5819,13 +5785,13 @@ function ManualClasses() {
5819
5785
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
5820
5786
  "div",
5821
5787
  {
5822
- className: `flex ${b.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5788
+ className: `flex ${y.length > 0 ? "min-h-[300px]" : "min-h-max"} w-full flex-col gap-y-1.5 overflow-y-auto pb-4`,
5823
5789
  children: [
5824
5790
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
5825
5791
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5826
5792
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: r("Classes") }),
5827
5793
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5828
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: k, className: "cursor-pointer" }) }),
5794
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: R, className: "cursor-pointer" }) }),
5829
5795
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: r("Copy classes to clipboard") }) })
5830
5796
  ] })
5831
5797
  ] }),
@@ -5841,12 +5807,12 @@ function ManualClasses() {
5841
5807
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5842
5808
  Autosuggest,
5843
5809
  {
5844
- suggestions: b,
5845
- onSuggestionsFetchRequested: y,
5846
- onSuggestionsClearRequested: v,
5847
- getSuggestionValue: B,
5848
- renderSuggestion: A,
5849
- inputProps: S,
5810
+ suggestions: y,
5811
+ onSuggestionsFetchRequested: k,
5812
+ onSuggestionsClearRequested: _,
5813
+ getSuggestionValue: A,
5814
+ renderSuggestion: S,
5815
+ inputProps: v,
5850
5816
  containerProps: {
5851
5817
  className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
5852
5818
  },
@@ -5862,7 +5828,7 @@ function ManualClasses() {
5862
5828
  {
5863
5829
  variant: "outline",
5864
5830
  className: "h-6 border-border",
5865
- onClick: j,
5831
+ onClick: E,
5866
5832
  disabled: p.trim() === "",
5867
5833
  size: "sm",
5868
5834
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
@@ -5870,22 +5836,22 @@ function ManualClasses() {
5870
5836
  )
5871
5837
  ] }),
5872
5838
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5873
- g.map((_) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5839
+ m.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5874
5840
  "div",
5875
5841
  {
5876
5842
  className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
5877
5843
  children: [
5878
- _,
5844
+ j,
5879
5845
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5880
5846
  Cross2Icon,
5881
5847
  {
5882
- onClick: () => i(c, [_]),
5848
+ onClick: () => i(c, [j]),
5883
5849
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
5884
5850
  }
5885
5851
  )
5886
5852
  ]
5887
5853
  },
5888
- _
5854
+ j
5889
5855
  ))
5890
5856
  ) })
5891
5857
  ]
@@ -6276,10 +6242,10 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6276
6242
  ringColor: "ring",
6277
6243
  ringOffsetColor: "ring-offset"
6278
6244
  }, ColorChoice = ({ property: o, onChange: r }) => {
6279
- const n = useCurrentClassByProperty(o), a = useMemo(() => get(n, "cls", ""), [n]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), x = get(u, "1", ""), h = get(u, "2", ""), g = useCallback(
6245
+ const n = useCurrentClassByProperty(o), a = useMemo(() => get(n, "cls", ""), [n]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), x = get(u, "1", ""), h = get(u, "2", ""), m = useCallback(
6280
6246
  // eslint-disable-next-line no-shadow
6281
- (f) => {
6282
- ["current", "inherit", "transparent", "black", "white"].includes(f) ? (c([]), p({ color: f })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((y) => ({ ...y, color: f, shade: y.shade ? y.shade : "500" })));
6247
+ (g) => {
6248
+ ["current", "inherit", "transparent", "black", "white"].includes(g) ? (c([]), p({ color: g })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((k) => ({ ...k, color: g, shade: k.shade ? k.shade : "500" })));
6283
6249
  },
6284
6250
  [c, p]
6285
6251
  );
@@ -6288,28 +6254,28 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6288
6254
  return c([]);
6289
6255
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6290
6256
  }, [x]);
6291
- const j = useCallback(
6257
+ const E = useCallback(
6292
6258
  // eslint-disable-next-line no-shadow
6293
- (f) => {
6294
- p({ color: x, shade: f });
6259
+ (g) => {
6260
+ p({ color: x, shade: g });
6295
6261
  },
6296
6262
  [x]
6297
6263
  );
6298
6264
  useEffect(() => {
6299
6265
  p({ color: "", shade: "" });
6300
6266
  }, [n]);
6301
- const { match: b } = useTailwindClassList();
6267
+ const { match: y } = useTailwindClassList();
6302
6268
  return useEffect(() => {
6303
- const y = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6304
- b(o, y) && r(y, o);
6305
- }, [b, d, r, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6269
+ const k = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6270
+ y(o, k) && r(k, o);
6271
+ }, [y, d, r, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6306
6272
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6307
6273
  DropDown,
6308
6274
  {
6309
6275
  disabled: !l,
6310
6276
  rounded: !0,
6311
6277
  selected: x,
6312
- onChange: g,
6278
+ onChange: m,
6313
6279
  options: [
6314
6280
  "current",
6315
6281
  "transparent",
@@ -6342,7 +6308,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6342
6308
  ]
6343
6309
  }
6344
6310
  ) }),
6345
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: h, disabled: !x || !l, onChange: j, options: i }) })
6311
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: h, disabled: !x || !l, onChange: E, options: i }) })
6346
6312
  ] });
6347
6313
  }, getUserInputValues = (o, r) => {
6348
6314
  o = o.toLowerCase();
@@ -6357,12 +6323,9 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6357
6323
  const r = o.startsWith("-") ? "-" : "", n = o.split("-").pop();
6358
6324
  if (["auto", "none"].includes(n))
6359
6325
  return { value: "", unit: n };
6360
- if (n === "px")
6361
- return { value: "1", unit: "px" };
6362
- if (n === "screen")
6363
- return { value: "100", unit: o.indexOf("w-") !== -1 ? "vw" : "vh" };
6364
- if (n === "full")
6365
- return { value: "100", unit: "%" };
6326
+ if (n === "px") return { value: "1", unit: "px" };
6327
+ if (n === "screen") return { value: "100", unit: o.indexOf("w-") !== -1 ? "vw" : "vh" };
6328
+ if (n === "full") return { value: "100", unit: "%" };
6366
6329
  if (includes(o, "skew-"))
6367
6330
  return { value: `${r}${n}`, unit: "deg" };
6368
6331
  if (includes(o, "rotate-"))
@@ -6377,105 +6340,60 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6377
6340
  return { value: `${r}${`${n / 100}`}`, unit: "-" };
6378
6341
  if (startsWith(o, "border")) {
6379
6342
  const a = o.match(/border-?(x|y|t|r|b|l)?\d+/g);
6380
- if (a)
6381
- return { value: a[0].split("-").pop(), unit: "px" };
6382
- if (o.match(/border-?(x|y|t|r|b|l)?/g))
6383
- return { value: "1", unit: "px" };
6343
+ if (a) return { value: a[0].split("-").pop(), unit: "px" };
6344
+ if (o.match(/border-?(x|y|t|r|b|l)?/g)) return { value: "1", unit: "px" };
6384
6345
  }
6385
6346
  if (startsWith(o, "max-w-")) {
6386
- if (o === "max-w-screen-sm")
6387
- return { value: "640", unit: "px" };
6388
- if (o === "max-w-screen-md")
6389
- return { value: "768", unit: "px" };
6390
- if (o === "max-w-screen-lg")
6391
- return { value: "1024", unit: "px" };
6392
- if (o === "max-w-screen-xl")
6393
- return { value: "1280", unit: "px" };
6394
- if (o === "max-w-screen-2xl")
6395
- return { value: "1536", unit: "px" };
6396
- if (n === "xs")
6397
- return { value: "320", unit: "px" };
6398
- if (n === "sm")
6399
- return { value: "384", unit: "px" };
6400
- if (n === "md")
6401
- return { value: "448", unit: "px" };
6402
- if (n === "lg")
6403
- return { value: "512", unit: "px" };
6404
- if (n === "xl")
6405
- return { value: "576", unit: "px" };
6406
- if (n === "2xl")
6407
- return { value: "672", unit: "px" };
6408
- if (n === "3xl")
6409
- return { value: "768", unit: "px" };
6410
- if (n === "4xl")
6411
- return { value: "896", unit: "px" };
6412
- if (n === "5xl")
6413
- return { value: "1024", unit: "px" };
6414
- if (n === "6xl")
6415
- return { value: "1152", unit: "px" };
6416
- if (n === "7xl")
6417
- return { value: "1280", unit: "px" };
6418
- if (n === "prose")
6419
- return { value: "65", unit: "ch" };
6347
+ if (o === "max-w-screen-sm") return { value: "640", unit: "px" };
6348
+ if (o === "max-w-screen-md") return { value: "768", unit: "px" };
6349
+ if (o === "max-w-screen-lg") return { value: "1024", unit: "px" };
6350
+ if (o === "max-w-screen-xl") return { value: "1280", unit: "px" };
6351
+ if (o === "max-w-screen-2xl") return { value: "1536", unit: "px" };
6352
+ if (n === "xs") return { value: "320", unit: "px" };
6353
+ if (n === "sm") return { value: "384", unit: "px" };
6354
+ if (n === "md") return { value: "448", unit: "px" };
6355
+ if (n === "lg") return { value: "512", unit: "px" };
6356
+ if (n === "xl") return { value: "576", unit: "px" };
6357
+ if (n === "2xl") return { value: "672", unit: "px" };
6358
+ if (n === "3xl") return { value: "768", unit: "px" };
6359
+ if (n === "4xl") return { value: "896", unit: "px" };
6360
+ if (n === "5xl") return { value: "1024", unit: "px" };
6361
+ if (n === "6xl") return { value: "1152", unit: "px" };
6362
+ if (n === "7xl") return { value: "1280", unit: "px" };
6363
+ if (n === "prose") return { value: "65", unit: "ch" };
6420
6364
  }
6421
6365
  if (startsWith(o, "text-")) {
6422
- if (n === "xs")
6423
- return { value: "12", unit: "px" };
6424
- if (n === "sm")
6425
- return { value: "14", unit: "px" };
6426
- if (n === "base")
6427
- return { value: "16", unit: "px" };
6428
- if (n === "lg")
6429
- return { value: "18", unit: "px" };
6430
- if (n === "xl")
6431
- return { value: "20", unit: "px" };
6432
- if (n === "2xl")
6433
- return { value: "24", unit: "px" };
6434
- if (n === "3xl")
6435
- return { value: "30", unit: "px" };
6436
- if (n === "4xl")
6437
- return { value: "36", unit: "px" };
6438
- if (n === "5xl")
6439
- return { value: "48", unit: "px" };
6440
- if (n === "6xl")
6441
- return { value: "60", unit: "px" };
6442
- if (n === "7xl")
6443
- return { value: "72", unit: "px" };
6444
- if (n === "8xl")
6445
- return { value: "96", unit: "px" };
6446
- if (n === "9xl")
6447
- return { value: "128", unit: "px" };
6366
+ if (n === "xs") return { value: "12", unit: "px" };
6367
+ if (n === "sm") return { value: "14", unit: "px" };
6368
+ if (n === "base") return { value: "16", unit: "px" };
6369
+ if (n === "lg") return { value: "18", unit: "px" };
6370
+ if (n === "xl") return { value: "20", unit: "px" };
6371
+ if (n === "2xl") return { value: "24", unit: "px" };
6372
+ if (n === "3xl") return { value: "30", unit: "px" };
6373
+ if (n === "4xl") return { value: "36", unit: "px" };
6374
+ if (n === "5xl") return { value: "48", unit: "px" };
6375
+ if (n === "6xl") return { value: "60", unit: "px" };
6376
+ if (n === "7xl") return { value: "72", unit: "px" };
6377
+ if (n === "8xl") return { value: "96", unit: "px" };
6378
+ if (n === "9xl") return { value: "128", unit: "px" };
6448
6379
  }
6449
6380
  if (startsWith(o, "leading-")) {
6450
- if (n === "none")
6451
- return { value: "1", unit: "-" };
6452
- if (n === "tight")
6453
- return { value: "1.25", unit: "-" };
6454
- if (n === "snug")
6455
- return { value: "1.375", unit: "-" };
6456
- if (n === "normal")
6457
- return { value: "1.5", unit: "-" };
6458
- if (n === "relaxed")
6459
- return { value: "1.625", unit: "-" };
6460
- if (n === "loose")
6461
- return { value: "2", unit: "-" };
6381
+ if (n === "none") return { value: "1", unit: "-" };
6382
+ if (n === "tight") return { value: "1.25", unit: "-" };
6383
+ if (n === "snug") return { value: "1.375", unit: "-" };
6384
+ if (n === "normal") return { value: "1.5", unit: "-" };
6385
+ if (n === "relaxed") return { value: "1.625", unit: "-" };
6386
+ if (n === "loose") return { value: "2", unit: "-" };
6462
6387
  }
6463
6388
  if (startsWith(o, "tracking-")) {
6464
- if (n === "tighter")
6465
- return { value: "-0.05", unit: "em" };
6466
- if (n === "tight")
6467
- return { value: "-0.025", unit: "em" };
6468
- if (n === "normal")
6469
- return { value: "0", unit: "em" };
6470
- if (n === "wide")
6471
- return { value: "0.025", unit: "em" };
6472
- if (n === "wider")
6473
- return { value: "0.05", unit: "em" };
6474
- if (n === "widest")
6475
- return { value: "0.1", unit: "em" };
6389
+ if (n === "tighter") return { value: "-0.05", unit: "em" };
6390
+ if (n === "tight") return { value: "-0.025", unit: "em" };
6391
+ if (n === "normal") return { value: "0", unit: "em" };
6392
+ if (n === "wide") return { value: "0.025", unit: "em" };
6393
+ if (n === "wider") return { value: "0.05", unit: "em" };
6394
+ if (n === "widest") return { value: "0.1", unit: "em" };
6476
6395
  }
6477
- if (["max", "min", "fit"].includes(n))
6478
- return { value: o, unit: "class" };
6396
+ if (["max", "min", "fit"].includes(n)) return { value: o, unit: "class" };
6479
6397
  if (n.includes("/")) {
6480
6398
  const [a, l] = map(n.split("/"), (i) => parseInt(i, 10));
6481
6399
  return { value: r + (a / l * 100).toFixed(2).replace(".00", ""), unit: "%" };
@@ -6537,50 +6455,50 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6537
6455
  },
6538
6456
  a
6539
6457
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6540
- const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [h, g] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [j, b] = useState(!1), [f, y] = useState(""), [v, B] = useState(!1), [A, S] = useState(!1);
6458
+ const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [h, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [E, y] = useState(!1), [g, k] = useState(""), [_, A] = useState(!1), [S, v] = useState(!1);
6541
6459
  useEffect(() => {
6542
- const { value: m, unit: E } = getClassValueAndUnit(i);
6543
- if (E === "") {
6544
- l(m), g(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
6460
+ const { value: b, unit: C } = getClassValueAndUnit(i);
6461
+ if (C === "") {
6462
+ l(b), m(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
6545
6463
  return;
6546
6464
  }
6547
- g(E), l(E === "class" || isEmpty(m) ? "" : m);
6465
+ m(C), l(C === "class" || isEmpty(b) ? "" : b);
6548
6466
  }, [i, p, u]);
6549
- const k = useThrottledCallback((m) => c(m), [c], THROTTLE_TIME), T = useThrottledCallback((m) => c(m, !1), [c], THROTTLE_TIME), _ = useCallback(
6550
- (m = !1) => {
6551
- const E = getUserInputValues(`${a}`, u);
6552
- if (get(E, "error", !1)) {
6553
- b(!0);
6467
+ const R = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), f = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), j = useCallback(
6468
+ (b = !1) => {
6469
+ const C = getUserInputValues(`${a}`, u);
6470
+ if (get(C, "error", !1)) {
6471
+ y(!0);
6554
6472
  return;
6555
6473
  }
6556
- const R = get(E, "unit") !== "" ? get(E, "unit") : h;
6557
- if (R === "auto" || R === "none") {
6558
- k(`${d}${R}`);
6474
+ const B = get(C, "unit") !== "" ? get(C, "unit") : h;
6475
+ if (B === "auto" || B === "none") {
6476
+ R(`${d}${B}`);
6559
6477
  return;
6560
6478
  }
6561
- if (get(E, "value") === "")
6479
+ if (get(C, "value") === "")
6562
6480
  return;
6563
- const N = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6564
- m ? T(N) : k(N);
6481
+ const D = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${B === "-" ? "" : B}]`;
6482
+ b ? f(D) : R(D);
6565
6483
  },
6566
- [k, T, a, h, d, u]
6567
- ), P = useCallback(
6568
- (m) => {
6569
- const E = getUserInputValues(`${a}`, u);
6570
- if (get(E, "error", !1)) {
6571
- b(!0);
6484
+ [R, f, a, h, d, u]
6485
+ ), w = useCallback(
6486
+ (b) => {
6487
+ const C = getUserInputValues(`${a}`, u);
6488
+ if (get(C, "error", !1)) {
6489
+ y(!0);
6572
6490
  return;
6573
6491
  }
6574
- if (m === "auto" || m === "none") {
6575
- k(`${d}${m}`);
6492
+ if (b === "auto" || b === "none") {
6493
+ R(`${d}${b}`);
6576
6494
  return;
6577
6495
  }
6578
- if (get(E, "value") === "")
6496
+ if (get(C, "value") === "")
6579
6497
  return;
6580
- const R = get(E, "unit") !== "" ? get(E, "unit") : m, N = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6581
- k(N);
6498
+ const B = get(C, "unit") !== "" ? get(C, "unit") : b, D = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${B === "-" ? "" : B}]`;
6499
+ R(D);
6582
6500
  },
6583
- [k, a, d, u]
6501
+ [R, a, d, u]
6584
6502
  );
6585
6503
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: h === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6586
6504
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -6595,40 +6513,40 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6595
6513
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircledIcon, {}) }) }),
6596
6514
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6597
6515
  ] })
6598
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
6516
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${_ ? "z-auto" : ""}`, children: [
6599
6517
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6600
6518
  ["none", "auto"].indexOf(h) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6601
6519
  "input",
6602
6520
  {
6603
6521
  readOnly: h === "class",
6604
- onKeyPress: (m) => {
6605
- m.key === "Enter" && _();
6522
+ onKeyPress: (b) => {
6523
+ b.key === "Enter" && j();
6606
6524
  },
6607
- onKeyDown: (m) => {
6608
- if (m.keyCode !== 38 && m.keyCode !== 40)
6525
+ onKeyDown: (b) => {
6526
+ if (b.keyCode !== 38 && b.keyCode !== 40)
6609
6527
  return;
6610
- m.preventDefault(), S(!0);
6611
- const E = parseInt$1(m.target.value);
6612
- let R = isNaN$1(E) ? 0 : E;
6613
- m.keyCode === 38 && (R += 1), m.keyCode === 40 && (R -= 1);
6614
- const C = `${R}`, I = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
6615
- T(I);
6528
+ b.preventDefault(), v(!0);
6529
+ const C = parseInt$1(b.target.value);
6530
+ let B = isNaN$1(C) ? 0 : C;
6531
+ b.keyCode === 38 && (B += 1), b.keyCode === 40 && (B -= 1);
6532
+ const N = `${B}`, I = `${N.startsWith("-") ? "-" : ""}${d}[${N.replace("-", "")}${h === "-" ? "" : h}]`;
6533
+ f(I);
6616
6534
  },
6617
- onKeyUp: (m) => {
6618
- A && (m.preventDefault(), S(!1));
6535
+ onKeyUp: (b) => {
6536
+ S && (b.preventDefault(), v(!1));
6619
6537
  },
6620
- onBlur: () => _(),
6621
- onChange: (m) => {
6622
- b(!1), l(m.target.value);
6538
+ onBlur: () => j(),
6539
+ onChange: (b) => {
6540
+ y(!1), l(b.target.value);
6623
6541
  },
6624
- onClick: (m) => {
6625
- var E;
6626
- (E = m == null ? void 0 : m.target) == null || E.select(), n(!1);
6542
+ onClick: (b) => {
6543
+ var C;
6544
+ (C = b == null ? void 0 : b.target) == null || C.select(), n(!1);
6627
6545
  },
6628
- value: v ? f : a,
6546
+ value: _ ? g : a,
6629
6547
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6630
6548
  " ",
6631
- j ? "border-red-500 text-red-500" : "border-foreground/20"
6549
+ E ? "border-red-500 text-red-500" : "border-foreground/20"
6632
6550
  )
6633
6551
  }
6634
6552
  ),
@@ -6650,29 +6568,29 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6650
6568
  {
6651
6569
  units: u,
6652
6570
  current: h,
6653
- onSelect: (m) => {
6654
- n(!1), g(m), P(m);
6571
+ onSelect: (b) => {
6572
+ n(!1), m(b), w(b);
6655
6573
  }
6656
6574
  }
6657
6575
  ) }) })
6658
6576
  ] })
6659
6577
  ] }),
6660
- ["none", "auto"].indexOf(h) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6578
+ ["none", "auto"].indexOf(h) !== -1 || _ ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6661
6579
  DragStyleButton,
6662
6580
  {
6663
- onDragStart: () => B(!0),
6664
- onDragEnd: (m) => {
6665
- if (y(() => ""), B(!1), isEmpty(m))
6581
+ onDragStart: () => A(!0),
6582
+ onDragEnd: (b) => {
6583
+ if (k(() => ""), A(!1), isEmpty(b))
6666
6584
  return;
6667
- const E = `${m}`, C = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${h === "-" ? "" : h}]`;
6668
- k(C);
6585
+ const C = `${b}`, N = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
6586
+ R(N);
6669
6587
  },
6670
- onDrag: (m) => {
6671
- if (isEmpty(m))
6588
+ onDrag: (b) => {
6589
+ if (isEmpty(b))
6672
6590
  return;
6673
- y(m);
6674
- const E = `${m}`, C = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${h === "-" ? "" : h}]`;
6675
- T(C);
6591
+ k(b);
6592
+ const C = `${b}`, N = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
6593
+ f(N);
6676
6594
  },
6677
6595
  currentValue: a,
6678
6596
  unit: h,
@@ -6769,35 +6687,35 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6769
6687
  "2xl": "1536px"
6770
6688
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6771
6689
  const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
6772
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(), h = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), f = useMemo(() => get(h, "fullCls", ""), [h]), y = useCallback(
6773
- (T, _ = !0) => {
6774
- const P = { dark: p, mq: x, mod: u, cls: T, property: l, fullCls: "" };
6775
- (p || u !== "") && (P.mq = "xs");
6776
- const m = generateFullClsName(P);
6777
- g(b, [m], _);
6690
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(), h = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [y] = useSelectedBlockIds(), g = useMemo(() => get(h, "fullCls", ""), [h]), k = useCallback(
6691
+ (f, j = !0) => {
6692
+ const w = { dark: p, mq: x, mod: u, cls: f, property: l, fullCls: "" };
6693
+ (p || u !== "") && (w.mq = "xs");
6694
+ const b = generateFullClsName(w);
6695
+ m(y, [b], j);
6778
6696
  },
6779
- [b, p, x, u, l, g]
6780
- ), v = useCallback(() => {
6781
- j(b, [f]);
6782
- }, [b, f, j]), B = useMemo(() => canChangeClass(h, x), [h, x]);
6697
+ [y, p, x, u, l, m]
6698
+ ), _ = useCallback(() => {
6699
+ E(y, [g]);
6700
+ }, [y, g, E]), A = useMemo(() => canChangeClass(h, x), [h, x]);
6783
6701
  useEffect(() => {
6784
- i(B, h);
6785
- }, [B, i, h]);
6786
- const [, , A] = useCanvasWidth(), S = useCallback(
6787
- (T) => {
6788
- A({
6702
+ i(A, h);
6703
+ }, [A, i, h]);
6704
+ const [, , S] = useCanvasWidth(), v = useCallback(
6705
+ (f) => {
6706
+ S({
6789
6707
  xs: 400,
6790
6708
  sm: 640,
6791
6709
  md: 800,
6792
6710
  lg: 1024,
6793
6711
  xl: 1420,
6794
6712
  "2xl": 1920
6795
- }[T]);
6713
+ }[f]);
6796
6714
  },
6797
- [A]
6798
- ), k = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === x;
6799
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: B, canReset: h && k, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6800
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${h && !k ? "text-foreground" : ""}`, children: r(a) }) }),
6715
+ [S]
6716
+ ), R = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === x;
6717
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: A, canReset: h && R, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6718
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${h && !R ? "text-foreground" : ""}`, children: r(a) }) }),
6801
6719
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6802
6720
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6803
6721
  n === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -6806,17 +6724,17 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6806
6724
  currentClass: get(h, "cls", ""),
6807
6725
  classPrefix: get(CLASS_PREFIXES, l, ""),
6808
6726
  units: c || [],
6809
- onChange: y,
6727
+ onChange: k,
6810
6728
  negative: d,
6811
6729
  cssProperty: l
6812
6730
  }
6813
6731
  ) : null,
6814
- n === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: y }),
6815
- n === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: y }),
6816
- n === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: y }),
6817
- n === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: y })
6732
+ n === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: k }),
6733
+ n === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: k }),
6734
+ n === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6735
+ n === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6818
6736
  ] }),
6819
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: k ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : B && h ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6737
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${g ? "visible" : "invisible"}`, children: R ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => _(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : A && h ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6820
6738
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6821
6739
  "button",
6822
6740
  {
@@ -6836,7 +6754,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6836
6754
  "button",
6837
6755
  {
6838
6756
  type: "button",
6839
- onClick: () => S(get(h, "mq")),
6757
+ onClick: () => v(get(h, "mq")),
6840
6758
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6841
6759
  children: [
6842
6760
  "Switch to ",
@@ -6857,7 +6775,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6857
6775
  units: i = basicUnits,
6858
6776
  negative: c = !1
6859
6777
  }) => {
6860
- const { t: d } = useTranslation(), [p, u] = useState(r[0].key), x = useSelectedBlockCurrentClasses(), h = useCallback((g) => map(x, "property").includes(g), [x]);
6778
+ const { t: d } = useTranslation(), [p, u] = useState(r[0].key), x = useSelectedBlockCurrentClasses(), h = useCallback((m) => map(x, "property").includes(m), [x]);
6861
6779
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6862
6780
  "div",
6863
6781
  {
@@ -6866,22 +6784,22 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6866
6784
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
6867
6785
  o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6868
6786
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
6869
- r.map(({ label: g, key: j }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6787
+ r.map(({ label: m, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6870
6788
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
6871
6789
  "button",
6872
6790
  {
6873
6791
  type: "button",
6874
- onClick: () => u(j),
6875
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${j === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6792
+ onClick: () => u(E),
6793
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${E === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6876
6794
  children: [
6877
6795
  React__default.createElement("div", {
6878
- className: h(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6796
+ className: h(E) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6879
6797
  }),
6880
- React__default.createElement(get(EDITOR_ICONS, j, BoxIcon), { className: "text-inherit w-3 h-3" })
6798
+ React__default.createElement(get(EDITOR_ICONS, E, BoxIcon), { className: "text-inherit w-3 h-3" })
6881
6799
  ]
6882
6800
  }
6883
6801
  ) }),
6884
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(g)) })
6802
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(m)) })
6885
6803
  ] }) }))
6886
6804
  ) })
6887
6805
  ] }),
@@ -6971,13 +6889,11 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6971
6889
  ] }) });
6972
6890
  }, BlockStylingProps = () => {
6973
6891
  const o = useSelectedBlock(), [r, n] = useSelectedStylingBlocks(), { t: a } = useTranslation();
6974
- if (!o)
6975
- return null;
6892
+ if (!o) return null;
6976
6893
  const l = Object.keys(o).filter(
6977
6894
  (c) => typeof o[c] == "string" && o[c].startsWith("#styles:")
6978
6895
  );
6979
- if (isEmpty(l) || l.length <= 1)
6980
- return null;
6896
+ if (isEmpty(l) || l.length <= 1) return null;
6981
6897
  const i = (c) => find(r, (d) => d.prop === c);
6982
6898
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-wrap gap-1", children: [
6983
6899
  /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: "block-styling-props", className: "py-1 text-xs", children: [
@@ -7023,12 +6939,12 @@ function BlockStyling() {
7023
6939
  }), d = useThrottledCallback(
7024
6940
  (u) => {
7025
6941
  const x = !get(i, "negative", !1), h = get(i, "cssProperty", "");
7026
- let g = parseFloat(i.dragStartValue);
7027
- g = isNaN(g) ? 0 : g;
7028
- let j = MAPPER[i.dragUnit];
7029
- (startsWith(h, "scale") || h === "opacity") && (j = 10);
7030
- let f = (i.dragStartY - u.pageY) / j + g;
7031
- x && f < 0 && (f = 0), h === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
6942
+ let m = parseFloat(i.dragStartValue);
6943
+ m = isNaN(m) ? 0 : m;
6944
+ let E = MAPPER[i.dragUnit];
6945
+ (startsWith(h, "scale") || h === "opacity") && (E = 10);
6946
+ let g = (i.dragStartY - u.pageY) / E + m;
6947
+ x && g < 0 && (g = 0), h === "opacity" && g > 1 && (g = 1), i.onDrag(`${g}`), l(`${g}`);
7032
6948
  },
7033
6949
  [i],
7034
6950
  50
@@ -7087,7 +7003,7 @@ const ChaiSelect = ({
7087
7003
  ]
7088
7004
  }
7089
7005
  ) });
7090
- }, ChaiSelect$1 = ChaiSelect;
7006
+ };
7091
7007
  function UILibrariesSelect({
7092
7008
  uiLibraries: o,
7093
7009
  library: r,
@@ -7097,7 +7013,7 @@ function UILibrariesSelect({
7097
7013
  return r ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-12", children: [
7098
7014
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs font-bold text-gray-500", children: a("Choose library") }),
7099
7015
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7100
- ChaiSelect$1,
7016
+ ChaiSelect,
7101
7017
  {
7102
7018
  className: "mt-1",
7103
7019
  options: o.map((l) => ({
@@ -7116,33 +7032,33 @@ const BlockCard = ({
7116
7032
  parentId: n = void 0,
7117
7033
  position: a = -1
7118
7034
  }) => {
7119
- const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(), h = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, j] = useAtom$1(draggedBlockAtom), b = (v) => {
7120
- const B = has(v, "styles_attrs.data-page-section");
7121
- return v._type === "Box" && B;
7122
- }, f = useCallback(
7123
- async (v) => {
7124
- if (v.stopPropagation(), has(o, "component")) {
7035
+ const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(), h = get(o, "name", get(o, "label")), m = useFeature("dnd"), [, E] = useAtom$1(draggedBlockAtom), y = (_) => {
7036
+ const A = has(_, "styles_attrs.data-page-section");
7037
+ return _._type === "Box" && A;
7038
+ }, g = useCallback(
7039
+ async (_) => {
7040
+ if (_.stopPropagation(), has(o, "component")) {
7125
7041
  d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7126
7042
  return;
7127
7043
  }
7128
7044
  i(!0);
7129
- const B = await c(r, o);
7130
- isEmpty(B) || p(syncBlocksWithDefaults(B), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7045
+ const A = await c(r, o);
7046
+ isEmpty(A) || p(syncBlocksWithDefaults(A), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7131
7047
  },
7132
7048
  [d, p, o, c, r, n, a]
7133
- ), y = async (v) => {
7134
- const B = await c(r, o);
7135
- let A = n;
7136
- if (b(first(B)) && (A = null), !isEmpty(B)) {
7137
- const S = { blocks: B, uiLibrary: !0, parent: A };
7138
- if (v.dataTransfer.setData("text/plain", JSON.stringify(S)), o.preview) {
7139
- const k = new Image();
7140
- k.src = o.preview, k.onload = () => {
7141
- v.dataTransfer.setDragImage(k, 0, 0);
7049
+ ), k = async (_) => {
7050
+ const A = await c(r, o);
7051
+ let S = n;
7052
+ if (y(first(A)) && (S = null), !isEmpty(A)) {
7053
+ const v = { blocks: A, uiLibrary: !0, parent: S };
7054
+ if (_.dataTransfer.setData("text/plain", JSON.stringify(v)), o.preview) {
7055
+ const R = new Image();
7056
+ R.src = o.preview, R.onload = () => {
7057
+ _.dataTransfer.setDragImage(R, 0, 0);
7142
7058
  };
7143
7059
  } else
7144
- v.dataTransfer.setDragImage(new Image(), 0, 0);
7145
- j(S), setTimeout(() => {
7060
+ _.dataTransfer.setDragImage(new Image(), 0, 0);
7061
+ E(v), setTimeout(() => {
7146
7062
  u([]), x(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7147
7063
  }, 200);
7148
7064
  }
@@ -7152,9 +7068,9 @@ const BlockCard = ({
7152
7068
  "div",
7153
7069
  {
7154
7070
  onClick: l ? () => {
7155
- } : f,
7156
- draggable: g ? "true" : "false",
7157
- onDragStart: y,
7071
+ } : g,
7072
+ draggable: m ? "true" : "false",
7073
+ onDragStart: k,
7158
7074
  className: clsx(
7159
7075
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
7160
7076
  ),
@@ -7175,17 +7091,16 @@ const BlockCard = ({
7175
7091
  const [r, n] = useAtom$1(libraryBlocksAtom), a = useBuilderProp("getUILibraryBlocks", noop), l = get(r, `${o == null ? void 0 : o.uuid}.blocks`, null), i = get(r, `${o == null ? void 0 : o.uuid}.loading`, "idle"), c = useRef("idle");
7176
7092
  return useEffect(() => {
7177
7093
  (async () => {
7178
- if (i === "complete" || c.current === "loading")
7179
- return;
7094
+ if (i === "complete" || c.current === "loading") return;
7180
7095
  c.current = "loading", n((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
7181
7096
  const d = await a(o);
7182
7097
  c.current = "idle", n((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
7183
7098
  })();
7184
7099
  }, [o, l, i, c, n, a]), { data: l || [], isLoading: i === "loading" };
7185
7100
  }, UILibrarySection = ({ parentId: o, position: r }) => {
7186
- const [n, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((A) => A.category === "custom"), d = l.find((A) => A.uuid === n) || first(l), { data: p, isLoading: u } = useLibraryBlocks(d), x = groupBy([...p, ...c], "group"), [h, g] = useState("Hero"), j = get(x, h, []), b = useRef(null), { t: f } = useTranslation(), y = (A) => {
7187
- b.current && (clearTimeout(b.current), b.current = null), b.current = setTimeout(() => {
7188
- b.current && g(A);
7101
+ const [n, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((S) => S.category === "custom"), d = l.find((S) => S.uuid === n) || first(l), { data: p, isLoading: u } = useLibraryBlocks(d), x = groupBy([...p, ...c], "group"), [h, m] = useState("Hero"), E = get(x, h, []), y = useRef(null), { t: g } = useTranslation(), k = (S) => {
7102
+ y.current && (clearTimeout(y.current), y.current = null), y.current = setTimeout(() => {
7103
+ y.current && m(S);
7189
7104
  }, 300);
7190
7105
  };
7191
7106
  if (u)
@@ -7193,30 +7108,30 @@ const BlockCard = ({
7193
7108
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7194
7109
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7195
7110
  ] });
7196
- const v = filter(j, (A, S) => S % 2 === 0), B = filter(j, (A, S) => S % 2 === 1);
7111
+ const _ = filter(E, (S, v) => v % 2 === 0), A = filter(E, (S, v) => v % 2 === 1);
7197
7112
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full pt-2", children: [
7198
7113
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7199
7114
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: d == null ? void 0 : d.uuid, setLibrary: a, uiLibraries: l }),
7200
7115
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
7201
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: f("Groups") }),
7116
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: g("Groups") }),
7202
7117
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7203
7118
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
7204
- map(x, (A, S) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7119
+ map(x, (S, v) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7205
7120
  "div",
7206
7121
  {
7207
- onMouseEnter: () => y(S),
7208
- onMouseLeave: () => clearTimeout(b.current),
7209
- onClick: () => g(S),
7122
+ onMouseEnter: () => k(v),
7123
+ onMouseLeave: () => clearTimeout(y.current),
7124
+ onClick: () => m(v),
7210
7125
  className: cn(
7211
7126
  "flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
7212
- S === h ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7127
+ v === h ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7213
7128
  ),
7214
7129
  children: [
7215
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(f(S.toLowerCase())) }),
7130
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(g(v.toLowerCase())) }),
7216
7131
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7217
7132
  ]
7218
7133
  },
7219
- S
7134
+ v
7220
7135
  ))
7221
7136
  ) })
7222
7137
  ] })
@@ -7224,15 +7139,15 @@ const BlockCard = ({
7224
7139
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7225
7140
  ScrollArea,
7226
7141
  {
7227
- onMouseEnter: () => b.current ? clearTimeout(b.current) : null,
7142
+ onMouseEnter: () => y.current ? clearTimeout(y.current) : null,
7228
7143
  className: "z-10 -mt-2 flex h-full max-h-full w-full flex-col gap-2 border-l border-border transition-all ease-linear",
7229
7144
  children: [
7230
7145
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7231
7146
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7232
- v.map((A) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: r, block: A, library: d }))
7147
+ _.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: r, block: S, library: d }))
7233
7148
  ) }),
7234
7149
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7235
- B.map((A) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: r, block: A, library: d }))
7150
+ A.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: r, block: S, library: d }))
7236
7151
  ) })
7237
7152
  ] }),
7238
7153
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -7242,7 +7157,7 @@ const BlockCard = ({
7242
7157
  }
7243
7158
  )
7244
7159
  ] }) }) });
7245
- }, UILibrariesPanel = ({ parentId: o, position: r }) => /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrarySection, { parentId: o, position: r }), UILibraries = UILibrariesPanel, Core = "Core", Import = "Import", Breakpoints$1 = "Breakpoints", Clear = "Clear", Cancel = "Cancel", Yes = "Yes", Preview = "Preview", Settings = "Settings", Styling = "Styling", Remove = "Remove", Choose = "Choose", Cut = "Cut", Copy = "Copy", Paste = "Paste", Delete = "Delete", classes = "classes", Theme = "Theme", Outline = "Outline", Copied = "Copied", Stop = "Stop", Edit = "Edit", Tag = "Tag", Value = "Value", Images = "Images", Library = "Library", Blocks = "Blocks", Basic = "Basic", Media = "Media", Advanced = "Advanced", Form = "Form", Groups = "Groups", Accordions = "Accordions", Buttons = "Buttons", Layouts = "Layouts", FAQ = "FAQ", Hero = "Hero", Features = "Features", Footer = "Footer", Navbar = "Navbar", Icons = "Icons", Testimonials = "Testimonials", Blog = "Blog", Saved = "Saved", Unsaved = "Unsaved", Randomize = "Randomize", theme_config = {
7160
+ }, UILibrariesPanel = ({ parentId: o, position: r }) => /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrarySection, { parentId: o, position: r }), Core = "Core", Import = "Import", Breakpoints$1 = "Breakpoints", Clear = "Clear", Cancel = "Cancel", Yes = "Yes", Preview = "Preview", Settings = "Settings", Styling = "Styling", Remove = "Remove", Choose = "Choose", Cut = "Cut", Copy = "Copy", Paste = "Paste", Delete = "Delete", classes = "classes", Theme = "Theme", Outline = "Outline", Copied = "Copied", Stop = "Stop", Edit = "Edit", Tag = "Tag", Value = "Value", Images = "Images", Library = "Library", Blocks = "Blocks", Basic = "Basic", Media = "Media", Advanced = "Advanced", Form = "Form", Groups = "Groups", Accordions = "Accordions", Buttons = "Buttons", Layouts = "Layouts", FAQ = "FAQ", Hero = "Hero", Features = "Features", Footer = "Footer", Navbar = "Navbar", Icons = "Icons", Testimonials = "Testimonials", Blog = "Blog", Saved = "Saved", Unsaved = "Unsaved", Randomize = "Randomize", theme_config = {
7246
7161
  heading_font: "Heading Font",
7247
7162
  body_font: "Body Font",
7248
7163
  rounded_corner: "Rounded Corners",
@@ -7741,35 +7656,35 @@ const CoreBlock = ({
7741
7656
  parentId: n,
7742
7657
  position: a
7743
7658
  }) => {
7744
- const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, x] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), g = () => {
7659
+ const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, x] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), m = () => {
7745
7660
  if (has(o, "blocks")) {
7746
- const f = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7747
- u(syncBlocksWithDefaults(f), n || null, a);
7661
+ const g = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7662
+ u(syncBlocksWithDefaults(g), n || null, a);
7748
7663
  } else
7749
7664
  p(o, n || null, a);
7750
7665
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7751
- }, j = useFeature("dnd"), { t: b } = useTranslation();
7666
+ }, E = useFeature("dnd"), { t: y } = useTranslation();
7752
7667
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
7753
7668
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7754
7669
  "button",
7755
7670
  {
7756
7671
  disabled: r,
7757
- onClick: g,
7672
+ onClick: m,
7758
7673
  type: "button",
7759
- onDragStart: (f) => {
7760
- f.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), f.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
7674
+ onDragStart: (g) => {
7675
+ g.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), g.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
7761
7676
  x([]), h();
7762
7677
  }, 200);
7763
7678
  },
7764
- draggable: j ? "true" : "false",
7679
+ draggable: E ? "true" : "false",
7765
7680
  className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
7766
7681
  children: [
7767
7682
  createElement(c || BoxIcon, { className: "w-4 h-4 mx-auto" }),
7768
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(b(d || i)) })
7683
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "truncate text-xs", children: capitalize(y(d || i)) })
7769
7684
  ]
7770
7685
  }
7771
7686
  ) }),
7772
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: b(d || i) }) })
7687
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: y(d || i) }) })
7773
7688
  ] }) });
7774
7689
  }, DefaultChaiBlocks = ({
7775
7690
  parentId: o,
@@ -7839,14 +7754,14 @@ const CoreBlock = ({
7839
7754
  map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: h.key, children: React__default.createElement(h.tab) }))
7840
7755
  ] }),
7841
7756
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "core", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollArea, { className: "-mx-1.5 h-full max-h-full overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultChaiBlocks, { gridCols: "grid-cols-4", parentId: n, position: a }) }) }) }),
7842
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(UILibraries, { parentId: n, position: a }) }),
7843
- p ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ImportHTML$1, { parentId: n, position: a }) }) : null,
7757
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "library", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesPanel, { parentId: n, position: a }) }),
7758
+ p ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "html", className: "h-full max-h-full flex-1 pb-20", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ImportHTML, { parentId: n, position: a }) }) : null,
7844
7759
  map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: h.key, children: React__default.createElement(h.tabContent, { close: x, parentId: n, position: a }) }))
7845
7760
  ]
7846
7761
  }
7847
7762
  )
7848
7763
  ] });
7849
- }, AddBlocksPanel$1 = AddBlocksPanel;
7764
+ };
7850
7765
  function usePubSub(o, r) {
7851
7766
  useEffect(() => {
7852
7767
  const n = pubsub.subscribe(o, r);
@@ -7871,7 +7786,7 @@ const AddBlocksDialog = () => {
7871
7786
  }
7872
7787
  )
7873
7788
  ] }),
7874
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar h-[500px] max-h-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlocksPanel$1, { parentId: r, position: a, showHeading: !1 }) })
7789
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar h-[500px] max-h-full overflow-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlocksPanel, { parentId: r, position: a, showHeading: !1 }) })
7875
7790
  ] }) });
7876
7791
  };
7877
7792
  function FaFilePen(o) {
@@ -7956,14 +7871,14 @@ function QuickPrompts({ onClick: o }) {
7956
7871
  ) }) });
7957
7872
  }
7958
7873
  const AIUserPrompt = ({ blockId: o }) => {
7959
- const { t: r } = useTranslation(), { askAi: n, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, x] = useState(), h = useRef(null), g = useRef(null);
7874
+ const { t: r } = useTranslation(), { askAi: n, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, x] = useState(), h = useRef(null), m = useRef(null);
7960
7875
  useEffect(() => {
7961
- var b;
7962
- (b = h.current) == null || b.focus();
7876
+ var y;
7877
+ (y = h.current) == null || y.focus();
7963
7878
  }, []);
7964
- const j = (b) => {
7965
- const { usage: f } = b || {};
7966
- !l && f && x(f), g.current = setTimeout(() => x(void 0), 1e4), l || c("");
7879
+ const E = (y) => {
7880
+ const { usage: g } = y || {};
7881
+ !l && g && x(g), m.current = setTimeout(() => x(void 0), 1e4), l || c("");
7967
7882
  };
7968
7883
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
7969
7884
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -7983,12 +7898,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7983
7898
  {
7984
7899
  ref: h,
7985
7900
  value: i,
7986
- onChange: (b) => c(b.target.value),
7901
+ onChange: (y) => c(y.target.value),
7987
7902
  placeholder: r("Ask AI to edit content"),
7988
7903
  className: "w-full",
7989
7904
  rows: 3,
7990
- onKeyDown: (b) => {
7991
- b.key === "Enter" && (b.preventDefault(), g.current && clearTimeout(g.current), x(void 0), n("content", o, i, j));
7905
+ onKeyDown: (y) => {
7906
+ y.key === "Enter" && (y.preventDefault(), m.current && clearTimeout(m.current), x(void 0), n("content", o, i, E));
7992
7907
  }
7993
7908
  }
7994
7909
  ),
@@ -7998,7 +7913,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7998
7913
  {
7999
7914
  disabled: i.trim().length < 5 || a,
8000
7915
  onClick: () => {
8001
- g.current && clearTimeout(g.current), x(void 0), n("content", o, i, j);
7916
+ m.current && clearTimeout(m.current), x(void 0), n("content", o, i, E);
8002
7917
  },
8003
7918
  variant: "default",
8004
7919
  className: "w-fit",
@@ -8030,8 +7945,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8030
7945
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8031
7946
  QuickPrompts,
8032
7947
  {
8033
- onClick: (b) => {
8034
- g.current && clearTimeout(g.current), x(void 0), n("content", o, b, j);
7948
+ onClick: (y) => {
7949
+ m.current && clearTimeout(m.current), x(void 0), n("content", o, y, E);
8035
7950
  }
8036
7951
  }
8037
7952
  )
@@ -8041,19 +7956,19 @@ const AIUserPrompt = ({ blockId: o }) => {
8041
7956
  ] }) }) : null
8042
7957
  ] });
8043
7958
  }, AISetContext = () => {
8044
- const { t: o } = useTranslation(), r = useBuilderProp("aiContext", ""), [n, a] = useState(r), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, x] = useState(!1), { toast: h } = useToast(), g = useRef(null);
7959
+ const { t: o } = useTranslation(), r = useBuilderProp("aiContext", ""), [n, a] = useState(r), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, x] = useState(!1), { toast: h } = useToast(), m = useRef(null);
8045
7960
  useEffect(() => {
8046
7961
  r && a(r);
8047
7962
  }, [r]);
8048
- const j = async () => {
7963
+ const E = async () => {
8049
7964
  try {
8050
7965
  d(!0), u(null), await i(n), h({
8051
7966
  title: o("Updated AI Context"),
8052
7967
  description: o("You can now Ask AI to edit your content"),
8053
7968
  variant: "default"
8054
- }), g.current.click();
8055
- } catch (b) {
8056
- u(b);
7969
+ }), m.current.click();
7970
+ } catch (y) {
7971
+ u(y);
8057
7972
  } finally {
8058
7973
  d(!1);
8059
7974
  }
@@ -8061,25 +7976,25 @@ const AIUserPrompt = ({ blockId: o }) => {
8061
7976
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8062
7977
  Accordion,
8063
7978
  {
8064
- onValueChange: (b) => {
8065
- x(b !== "");
7979
+ onValueChange: (y) => {
7980
+ x(y !== "");
8066
7981
  },
8067
7982
  type: "single",
8068
7983
  collapsible: !0,
8069
7984
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
8070
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: g, className: "border-0 border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: o("AI Context") }) }) }),
7985
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: m, className: "border-0 border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: o("AI Context") }) }) }),
8071
7986
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
8072
7987
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8073
7988
  Textarea,
8074
7989
  {
8075
7990
  ref: l,
8076
7991
  value: n,
8077
- onChange: (b) => a(b.target.value),
7992
+ onChange: (y) => a(y.target.value),
8078
7993
  placeholder: o("Tell about this page eg this page is about"),
8079
7994
  className: "mt-1 w-full",
8080
7995
  rows: 10,
8081
- onKeyDown: (b) => {
8082
- b.key === "Enter" && (b.preventDefault(), j());
7996
+ onKeyDown: (y) => {
7997
+ y.key === "Enter" && (y.preventDefault(), E());
8083
7998
  }
8084
7999
  }
8085
8000
  ),
@@ -8091,7 +8006,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8091
8006
  Button,
8092
8007
  {
8093
8008
  disabled: n.trim().length < 5,
8094
- onClick: () => j(),
8009
+ onClick: () => E(),
8095
8010
  variant: "default",
8096
8011
  className: "w-fit",
8097
8012
  size: "sm",
@@ -8120,7 +8035,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8120
8035
  AlertDialogAction,
8121
8036
  {
8122
8037
  onClick: () => {
8123
- a(""), j();
8038
+ a(""), E();
8124
8039
  },
8125
8040
  children: o("Yes, Delete")
8126
8041
  }
@@ -8141,42 +8056,42 @@ const AIUserPrompt = ({ blockId: o }) => {
8141
8056
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
8142
8057
  ] });
8143
8058
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: r = [], onAttributesChange: n }) {
8144
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, x] = useState(null), [h, g] = useState(""), j = useRef(null), b = useRef(null);
8059
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, x] = useState(null), [h, m] = useState(""), E = useRef(null), y = useRef(null);
8145
8060
  useEffect(() => {
8146
8061
  l(r);
8147
8062
  }, [r]);
8148
- const f = () => {
8063
+ const g = () => {
8149
8064
  if (i.startsWith("@")) {
8150
- g("Attribute keys cannot start with '@'");
8065
+ m("Attribute keys cannot start with '@'");
8151
8066
  return;
8152
8067
  }
8153
8068
  if (i) {
8154
- const S = [...a, { key: i, value: d }];
8155
- n(S), l(a), c(""), p(""), g("");
8069
+ const v = [...a, { key: i, value: d }];
8070
+ n(v), l(a), c(""), p(""), m("");
8156
8071
  }
8157
- }, y = (S) => {
8158
- const k = a.filter((T, _) => _ !== S);
8159
- n(k), l(k);
8160
- }, v = (S) => {
8161
- x(S), c(a[S].key), p(a[S].value);
8162
- }, B = () => {
8072
+ }, k = (v) => {
8073
+ const R = a.filter((f, j) => j !== v);
8074
+ n(R), l(R);
8075
+ }, _ = (v) => {
8076
+ x(v), c(a[v].key), p(a[v].value);
8077
+ }, A = () => {
8163
8078
  if (i.startsWith("@")) {
8164
- g("Attribute keys cannot start with '@'");
8079
+ m("Attribute keys cannot start with '@'");
8165
8080
  return;
8166
8081
  }
8167
8082
  if (u !== null && i) {
8168
- const S = [...a];
8169
- S[u] = { key: i, value: d }, n(S), l(S), x(null), c(""), p(""), g("");
8083
+ const v = [...a];
8084
+ v[u] = { key: i, value: d }, n(v), l(v), x(null), c(""), p(""), m("");
8170
8085
  }
8171
- }, A = (S) => {
8172
- S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? B() : f());
8086
+ }, S = (v) => {
8087
+ v.key === "Enter" && !v.shiftKey && (v.preventDefault(), u !== null ? A() : g());
8173
8088
  };
8174
8089
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
8175
8090
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8176
8091
  "form",
8177
8092
  {
8178
- onSubmit: (S) => {
8179
- S.preventDefault(), u !== null ? B() : f();
8093
+ onSubmit: (v) => {
8094
+ v.preventDefault(), u !== null ? A() : g();
8180
8095
  },
8181
8096
  className: "space-y-3",
8182
8097
  children: [
@@ -8190,9 +8105,9 @@ const AIUserPrompt = ({ blockId: o }) => {
8190
8105
  autoCorrect: "off",
8191
8106
  spellCheck: "false",
8192
8107
  id: "attrKey",
8193
- ref: j,
8108
+ ref: E,
8194
8109
  value: i,
8195
- onChange: (S) => c(S.target.value),
8110
+ onChange: (v) => c(v.target.value),
8196
8111
  placeholder: "Enter Key",
8197
8112
  className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
8198
8113
  }
@@ -8208,10 +8123,10 @@ const AIUserPrompt = ({ blockId: o }) => {
8208
8123
  spellCheck: "false",
8209
8124
  id: "attrValue",
8210
8125
  rows: 2,
8211
- ref: b,
8126
+ ref: y,
8212
8127
  value: d,
8213
- onChange: (S) => p(S.target.value),
8214
- onKeyDown: A,
8128
+ onChange: (v) => p(v.target.value),
8129
+ onKeyDown: S,
8215
8130
  placeholder: "Enter Value",
8216
8131
  className: "text-xs font-normal leading-tight placeholder:text-slate-400"
8217
8132
  }
@@ -8223,16 +8138,16 @@ const AIUserPrompt = ({ blockId: o }) => {
8223
8138
  ]
8224
8139
  }
8225
8140
  ),
8226
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1 py-4", children: a.map((S, k) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
8141
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1 py-4", children: a.map((v, R) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
8227
8142
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
8228
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: S.key }),
8229
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] font-normal", children: S.value.toString() })
8143
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: v.key }),
8144
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] font-normal", children: v.value.toString() })
8230
8145
  ] }),
8231
8146
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
8232
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(k), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }) }),
8233
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => y(k), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }) })
8147
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(R), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }) }),
8148
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(R), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }) })
8234
8149
  ] })
8235
- ] }, k)) })
8150
+ ] }, R)) })
8236
8151
  ] });
8237
8152
  }), BlockAttributesEditor = React.memo(() => {
8238
8153
  const o = useSelectedBlock(), [r, n] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -8510,7 +8425,7 @@ const SettingsPanel = () => {
8510
8425
  }
8511
8426
  )
8512
8427
  ] }) });
8513
- }, SettingsPanel$1 = SettingsPanel;
8428
+ };
8514
8429
  function LayoutCard({ disabled: o = !1, description: r, title: n, selected: a, onSelect: l, children: i }) {
8515
8430
  const { t: c } = useTranslation();
8516
8431
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -8602,13 +8517,13 @@ const ChooseLayout = ({ open: o, close: r }) => {
8602
8517
  )
8603
8518
  ] }) })
8604
8519
  ] }) });
8605
- }, TopBar = lazy(() => import("./Topbar-9IbTAO2f.js")), ThemeConfigPanel = lazy(() => Promise.resolve().then(() => ThemeConfigPanel$3));
8520
+ }, TopBar = lazy(() => import("./Topbar-DMCtQiUj.js")), ThemeConfigPanel = lazy(() => Promise.resolve().then(() => ThemeConfigPanel$2));
8606
8521
  function useSidebarMenuItems() {
8607
8522
  return useMemo(() => compact([
8608
8523
  {
8609
8524
  icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Layers, { size: 20 }),
8610
8525
  label: "Outline",
8611
- component: () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Outline$1, {}) })
8526
+ component: () => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-8", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ListTree, {}) })
8612
8527
  }
8613
8528
  ]), []);
8614
8529
  }
@@ -8617,35 +8532,36 @@ const RootLayout = () => {
8617
8532
  usePubSub(CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS, () => {
8618
8533
  r(1);
8619
8534
  });
8620
- const c = useBuilderProp("sideBarComponents.top", []), d = (j) => {
8621
- j.preventDefault();
8622
- }, p = (j) => {
8623
- r(o === j ? null : j);
8624
- }, u = useSidebarMenuItems(), { t: x } = useTranslation(), h = [...u, ...c], g = useBuilderProp("htmlDir", "ltr");
8625
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: g, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
8535
+ const c = useBuilderProp("sideBarComponents.top", []), d = useBuilderProp("sideBarComponents.bottom", []), p = (y) => {
8536
+ y.preventDefault();
8537
+ }, u = (y) => {
8538
+ r(o === y ? null : y);
8539
+ }, x = useSidebarMenuItems(), { t: h } = useTranslation(), m = [...x, ...c], E = useBuilderProp("htmlDir", "ltr");
8540
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: E, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
8626
8541
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8627
8542
  "div",
8628
8543
  {
8629
- onContextMenu: d,
8544
+ onContextMenu: p,
8630
8545
  className: "flex h-screen max-h-full flex-col bg-background text-foreground",
8631
8546
  children: [
8632
8547
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TopBar, {}) }) }),
8633
8548
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8634
8549
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
8635
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: h.map((j, b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8550
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((y, g) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8636
8551
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8637
8552
  Button,
8638
8553
  {
8639
- variant: o === b ? "default" : "ghost",
8554
+ variant: o === g ? "default" : "ghost",
8640
8555
  className: "mb-2 rounded-lg p-2 transition-colors",
8641
- onClick: () => p(b),
8642
- children: get(j, "icon", null)
8556
+ onClick: () => u(g),
8557
+ children: get(y, "icon", null)
8643
8558
  },
8644
- b
8559
+ g
8645
8560
  ) }),
8646
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: x(j.label) }) })
8647
- ] }, "button" + b)) }),
8648
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1" })
8561
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: h(y.label) }) })
8562
+ ] }, "button" + g)) }),
8563
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1" }),
8564
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: d == null ? void 0 : d.map((y, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}), children: React__default.createElement(y, { key: g }) })) })
8649
8565
  ] }),
8650
8566
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8651
8567
  motion.div,
@@ -8656,16 +8572,16 @@ const RootLayout = () => {
8656
8572
  transition: { duration: 0.3, ease: "easeInOut" },
8657
8573
  children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
8658
8574
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8659
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(h, `${o}.icon`, null) }),
8660
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: x(h[o].label) })
8575
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
8576
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: h(m[o].label) })
8661
8577
  ] }),
8662
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(h, `${o}.component`, null), {}) }) })
8578
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
8663
8579
  ] }) })
8664
8580
  }
8665
8581
  ),
8666
8582
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full flex-1 flex-col bg-slate-800/20", children: [
8667
8583
  /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasTopBar, {}),
8668
- /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasArea$1, {}) })
8584
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasArea, {}) })
8669
8585
  ] }),
8670
8586
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8671
8587
  motion.div,
@@ -8678,11 +8594,11 @@ const RootLayout = () => {
8678
8594
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "-mt-1 flex items-center space-x-1 text-base font-bold", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex grow items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between gap-2", children: l === "ai" ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
8679
8595
  /* @__PURE__ */ jsxRuntimeExports.jsx(LightningBoltIcon, { className: "rtl:ml-2" }),
8680
8596
  " ",
8681
- x("AI Assistant")
8597
+ h("AI Assistant")
8682
8598
  ] }) }) : l === "theme" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [
8683
8599
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-2", children: [
8684
8600
  /* @__PURE__ */ jsxRuntimeExports.jsx(Paintbrush, { className: "h-4 w-4 rtl:ml-2" }),
8685
- x("Theme Settings")
8601
+ h("Theme Settings")
8686
8602
  ] }),
8687
8603
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8688
8604
  Button,
@@ -8695,7 +8611,7 @@ const RootLayout = () => {
8695
8611
  }
8696
8612
  )
8697
8613
  ] }) : null }) }) }),
8698
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex max-h-full w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: l === "ai" ? /* @__PURE__ */ jsxRuntimeExports.jsx(AskAI, {}) : l === "theme" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeConfigPanel, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsPanel$1, {}) }) })
8614
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex max-h-full w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: l === "ai" ? /* @__PURE__ */ jsxRuntimeExports.jsx(AskAI, {}) : l === "theme" ? /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeConfigPanel, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsPanel, {}) }) })
8699
8615
  ] }) })
8700
8616
  }
8701
8617
  )
@@ -8780,27 +8696,27 @@ export {
8780
8696
  AISetContext,
8781
8697
  AIUserPrompt,
8782
8698
  AddBlocksDialog,
8783
- AddBlocksPanel$1 as AddBlocksPanel,
8699
+ AddBlocksPanel,
8784
8700
  BlockAttributesEditor,
8785
8701
  BlockSettings as BlockPropsEditor,
8786
8702
  BlockStyling as BlockStyleEditor,
8787
8703
  CHAI_BUILDER_EVENTS,
8788
- CanvasArea$1 as ChaiBuilderCanvas,
8704
+ CanvasArea as ChaiBuilderCanvas,
8789
8705
  ChaiBuilderEditor,
8790
8706
  DarkMode as DarkModeSwitcher,
8791
8707
  DefaultChaiBlocks,
8792
- ImportHTML$1 as ImportHTML,
8793
- Outline$1 as Outline,
8708
+ ImportHTML,
8709
+ ListTree as Outline,
8794
8710
  Breakpoints as ScreenSizes,
8795
- ThemeConfigPanel$2 as ThemeOptions,
8796
- UILibraries,
8711
+ ThemeConfigPanel$1 as ThemeOptions,
8712
+ UILibrariesPanel as UILibraries,
8797
8713
  UndoRedo,
8798
8714
  generateUUID as generateBlockId,
8799
8715
  getBlocksFromHTML,
8800
8716
  getClassValueAndUnit,
8801
- Qe as i18n,
8717
+ Me as i18n,
8802
8718
  cn as mergeClasses,
8803
- Ze as registerChaiBlock,
8719
+ De as registerChaiBlock,
8804
8720
  useAddBlock,
8805
8721
  useAddClassesToBlocks,
8806
8722
  useAskAi,
@@ -8842,7 +8758,7 @@ export {
8842
8758
  useStylingState,
8843
8759
  useTheme,
8844
8760
  useThemeOptions,
8845
- Xe as useTranslation,
8761
+ Ie as useTranslation,
8846
8762
  useUILibraryBlocks,
8847
8763
  useUndoManager,
8848
8764
  useUpdateBlocksProps,