@chaibuilder/sdk 2.0.0-beta.26 → 2.0.0-beta.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js CHANGED
@@ -4,23 +4,23 @@ var H = (o, r, n) => (F(o, typeof r != "symbol" ? r + "" : r, n), n);
4
4
  import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.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, 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, h as Badge, 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";
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
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";
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
10
  import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.js";
11
11
  import { useTranslation, initReactI18next } from "react-i18next";
12
- import { useTranslation as Ke } from "react-i18next";
12
+ import { useTranslation as Xe } from "react-i18next";
13
13
  import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, b as getChaiThemeCssVariables, a as getThemeFontsLinkMarkup } from "./ChaiThemeFn--DgGggh_.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 qe } from "@chaibuilder/runtime";
17
+ import { registerChaiBlock as Ze } 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, RowsIcon, TextIcon, 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, 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";
24
24
  import typography from "@tailwindcss/typography";
25
25
  import forms from "@tailwindcss/forms";
26
26
  import aspectRatio from "@tailwindcss/aspect-ratio";
@@ -31,17 +31,18 @@ import ReactDOM from "react-dom";
31
31
  import PropTypes from "prop-types";
32
32
  import { ErrorBoundary } from "react-error-boundary";
33
33
  import { Resizable } from "re-resizable";
34
- import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, Eye, X, ChevronDown, List, Plus, Loader, SparklesIcon, SmileIcon, ShuffleIcon, Edit2, Paintbrush, Layers } from "lucide-react";
34
+ import { DatabaseIcon, Columns, Rows, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, Eye, X, Plus, ChevronDown, List, Loader, SparklesIcon, SmileIcon, ShuffleIcon, Edit2, Paintbrush, Layers } from "lucide-react";
35
35
  import { Tree } from "react-arborist";
36
36
  import { parse, stringify } from "himalaya";
37
37
  import RjForm from "@rjsf/core";
38
38
  import validator from "@rjsf/validator-ajv8";
39
39
  import IconPicker, { IconPickerItem } from "react-icons-picker";
40
+ import { size } from "lodash";
40
41
  import Autosuggest from "react-autosuggest";
41
42
  import Fuse from "fuse.js";
42
43
  import clsx from "clsx";
43
44
  import i18n from "i18next";
44
- import { default as Je } from "i18next";
45
+ import { default as Qe } from "i18next";
45
46
  import { motion } from "framer-motion";
46
47
  import "@radix-ui/react-switch";
47
48
  import "@radix-ui/react-accordion";
@@ -110,251 +111,251 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
110
111
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(E);
111
112
  const R = o.get(m);
112
113
  if (o.set(m, E), n.has(m) || n.set(m, R), R && hasPromiseAtomValue(R)) {
113
- const w = "v" in E ? E.v instanceof Promise ? E.v : Promise.resolve(E.v) : Promise.reject(E.e);
114
- cancelPromise(R.v, w);
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);
115
116
  }
116
117
  }, p = (m, E, R) => {
117
- const w = /* @__PURE__ */ new Map();
118
- let T = !1;
119
- R.forEach((k, N) => {
120
- !k && N === m && (k = E), k ? (w.set(N, k), E.d.get(N) !== k && (T = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
121
- }), (T || E.d.size !== w.size) && (E.d = w);
118
+ const C = /* @__PURE__ */ new Map();
119
+ let N = !1;
120
+ R.forEach((T, w) => {
121
+ !T && w === m && (T = E), T ? (C.set(w, T), E.d.get(w) !== T && (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);
122
123
  }, u = (m, E, R) => {
123
- const w = c(m), T = {
124
- d: (w == null ? void 0 : w.d) || /* @__PURE__ */ new Map(),
124
+ const C = c(m), N = {
125
+ d: (C == null ? void 0 : C.d) || /* @__PURE__ */ new Map(),
125
126
  v: E
126
127
  };
127
- if (R && p(m, T, R), w && isEqualAtomValue(w, T) && w.d === T.d)
128
- return w;
129
- if (w && hasPromiseAtomValue(w) && hasPromiseAtomValue(T) && isEqualPromiseAtomValue(w, T)) {
130
- if (w.d === T.d)
131
- return w;
132
- T.v = w.v;
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;
133
134
  }
134
- return d(m, T), T;
135
- }, x = (m, E, R, w) => {
135
+ return d(m, N), N;
136
+ }, x = (m, E, R, C) => {
136
137
  if (isPromiseLike$2(E)) {
137
- let T;
138
- const k = new Promise((N, $) => {
138
+ let N;
139
+ const T = new Promise((w, $) => {
139
140
  let L = !1;
140
141
  E.then(
141
- (P) => {
142
+ (M) => {
142
143
  if (!L) {
143
144
  L = !0;
144
- const M = c(m), O = u(
145
+ const D = c(m), O = u(
145
146
  m,
146
- k,
147
+ T,
147
148
  R
148
149
  );
149
- resolvePromise(k, P), N(P), (M == null ? void 0 : M.d) !== O.d && _(m, O, M == null ? void 0 : M.d);
150
+ resolvePromise(T, M), w(M), (D == null ? void 0 : D.d) !== O.d && I(m, O, D == null ? void 0 : D.d);
150
151
  }
151
152
  },
152
- (P) => {
153
+ (M) => {
153
154
  if (!L) {
154
155
  L = !0;
155
- const M = c(m), O = u(
156
+ const D = c(m), O = u(
156
157
  m,
157
- k,
158
+ T,
158
159
  R
159
160
  );
160
- rejectPromise(k, P), $(P), (M == null ? void 0 : M.d) !== O.d && _(m, O, M == null ? void 0 : M.d);
161
+ rejectPromise(T, M), $(M), (D == null ? void 0 : D.d) !== O.d && I(m, O, D == null ? void 0 : D.d);
161
162
  }
162
163
  }
163
- ), T = (P) => {
164
- L || (L = !0, P.then(
165
- (M) => resolvePromise(k, M),
166
- (M) => rejectPromise(k, M)
167
- ), N(P));
164
+ ), N = (M) => {
165
+ L || (L = !0, M.then(
166
+ (D) => resolvePromise(T, D),
167
+ (D) => rejectPromise(T, D)
168
+ ), w(M));
168
169
  };
169
170
  });
170
- return k.orig = E, k.status = "pending", registerCancelPromise(k, (N) => {
171
- N && T(N), w == null || w();
172
- }), u(m, k, R);
171
+ return T.orig = E, T.status = "pending", registerCancelPromise(T, (w) => {
172
+ w && N(w), C == null || C();
173
+ }), u(m, T, R);
173
174
  }
174
175
  return u(m, E, R);
175
- }, f = (m, E, R) => {
176
- const w = c(m), T = {
177
- d: (w == null ? void 0 : w.d) || /* @__PURE__ */ new Map(),
176
+ }, h = (m, E, R) => {
177
+ const C = c(m), N = {
178
+ d: (C == null ? void 0 : C.d) || /* @__PURE__ */ new Map(),
178
179
  e: E
179
180
  };
180
- return R && p(m, T, R), w && isEqualAtomError(w, T) && w.d === T.d ? w : (d(m, T), T);
181
+ return R && p(m, N, R), C && isEqualAtomError(C, N) && C.d === N.d ? C : (d(m, N), N);
181
182
  }, g = (m) => {
182
183
  const E = c(m);
183
- if (E && (E.d.forEach((L, P) => {
184
- P !== m && !r.has(P) && g(P);
185
- }), Array.from(E.d).every(([L, P]) => {
186
- const M = c(L);
187
- return L === m || M === P || // TODO This is a hack, we should find a better solution.
188
- M && !hasPromiseAtomValue(M) && isEqualAtomValue(M, P);
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);
189
190
  })))
190
191
  return E;
191
192
  const R = /* @__PURE__ */ new Map();
192
- let w = !0;
193
- const T = (L) => {
193
+ let C = !0;
194
+ const N = (L) => {
194
195
  if (L === m) {
195
- const M = c(L);
196
- if (M)
197
- return R.set(L, M), returnAtomValue(M);
196
+ const D = c(L);
197
+ if (D)
198
+ return R.set(L, D), returnAtomValue(D);
198
199
  if (hasInitialValue(L))
199
200
  return R.set(L, void 0), L.init;
200
201
  throw new Error("no atom init");
201
202
  }
202
- const P = g(L);
203
- return R.set(L, P), returnAtomValue(P);
203
+ const M = g(L);
204
+ return R.set(L, M), returnAtomValue(M);
204
205
  };
205
- let k, N;
206
+ let T, w;
206
207
  const $ = {
207
208
  get signal() {
208
- return k || (k = new AbortController()), k.signal;
209
+ return T || (T = new AbortController()), T.signal;
209
210
  },
210
211
  get setSelf() {
211
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(m) && console.warn("setSelf function cannot be used with read-only atom"), !N && isActuallyWritableAtom(m) && (N = (...L) => {
212
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && w && console.warn("setSelf function cannot be called in sync"), !w)
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)
213
214
  return A(m, ...L);
214
- }), N;
215
+ }), w;
215
216
  }
216
217
  };
217
218
  try {
218
- const L = m.read(T, $);
219
+ const L = m.read(N, $);
219
220
  return x(
220
221
  m,
221
222
  L,
222
223
  R,
223
- () => k == null ? void 0 : k.abort()
224
+ () => T == null ? void 0 : T.abort()
224
225
  );
225
226
  } catch (L) {
226
- return f(m, L, R);
227
+ return h(m, L, R);
227
228
  } finally {
228
- w = !1;
229
+ C = !1;
229
230
  }
230
231
  }, j = (m) => returnAtomValue(g(m)), b = (m) => {
231
232
  let E = r.get(m);
232
- return E || (E = C(m)), E;
233
- }, h = (m, E) => !E.l.size && (!E.t.size || E.t.size === 1 && E.t.has(m)), y = (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) => {
234
235
  const E = r.get(m);
235
- E && h(m, E) && v(m);
236
- }, S = (m) => {
237
- const E = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), w = (k) => {
238
- const N = r.get(k);
239
- N == null || N.t.forEach(($) => {
240
- $ !== k && (E.set(
236
+ E && f(m, E) && k(m);
237
+ }, v = (m) => {
238
+ const E = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), C = (T) => {
239
+ const w = r.get(T);
240
+ w == null || w.t.forEach(($) => {
241
+ $ !== T && (E.set(
241
242
  $,
242
- (E.get($) || /* @__PURE__ */ new Set()).add(k)
243
- ), R.set($, (R.get($) || 0) + 1), w($));
243
+ (E.get($) || /* @__PURE__ */ new Set()).add(T)
244
+ ), R.set($, (R.get($) || 0) + 1), C($));
244
245
  });
245
246
  };
246
- w(m);
247
- const T = (k) => {
248
- const N = r.get(k);
249
- N == null || N.t.forEach(($) => {
247
+ C(m);
248
+ const N = (T) => {
249
+ const w = r.get(T);
250
+ w == null || w.t.forEach(($) => {
250
251
  var L;
251
- if ($ !== k) {
252
- let P = R.get($);
253
- if (P && R.set($, --P), !P) {
254
- let M = !!((L = E.get($)) != null && L.size);
255
- if (M) {
252
+ if ($ !== T) {
253
+ let M = R.get($);
254
+ if (M && R.set($, --M), !M) {
255
+ let D = !!((L = E.get($)) != null && L.size);
256
+ if (D) {
256
257
  const O = c($), V = g($);
257
- M = !O || !isEqualAtomValue(O, V);
258
+ D = !O || !isEqualAtomValue(O, V);
258
259
  }
259
- M || E.forEach((O) => O.delete($));
260
+ D || E.forEach((O) => O.delete($));
260
261
  }
261
- T($);
262
+ N($);
262
263
  }
263
264
  });
264
265
  };
265
- T(m);
266
+ N(m);
266
267
  }, B = (m, ...E) => {
267
268
  let R = !0;
268
- const w = (N) => returnAtomValue(g(N)), T = (N, ...$) => {
269
+ const C = (w) => returnAtomValue(g(w)), N = (w, ...$) => {
269
270
  let L;
270
- if (N === m) {
271
- if (!hasInitialValue(N))
271
+ if (w === m) {
272
+ if (!hasInitialValue(w))
272
273
  throw new Error("atom not writable");
273
- const P = c(N), M = x(N, $[0]);
274
- (!P || !isEqualAtomValue(P, M)) && S(N);
274
+ const M = c(w), D = x(w, $[0]);
275
+ (!M || !isEqualAtomValue(M, D)) && v(w);
275
276
  } else
276
- L = B(N, ...$);
277
+ L = B(w, ...$);
277
278
  if (!R) {
278
- const P = I();
279
+ const M = _();
279
280
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
280
- (M) => M({ type: "async-write", flushed: P })
281
+ (D) => D({ type: "async-write", flushed: M })
281
282
  );
282
283
  }
283
284
  return L;
284
- }, k = m.write(w, T, ...E);
285
- return R = !1, k;
285
+ }, T = m.write(C, N, ...E);
286
+ return R = !1, T;
286
287
  }, A = (m, ...E) => {
287
- const R = B(m, ...E), w = I();
288
+ const R = B(m, ...E), C = _();
288
289
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
289
- (T) => T({ type: "write", flushed: w })
290
+ (N) => N({ type: "write", flushed: C })
290
291
  ), R;
291
- }, C = (m, E) => {
292
+ }, S = (m, E) => {
292
293
  const R = {
293
294
  t: new Set(E && [E]),
294
295
  l: /* @__PURE__ */ new Set()
295
296
  };
296
- if (r.set(m, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(m), g(m).d.forEach((w, T) => {
297
- const k = r.get(T);
298
- k ? k.t.add(m) : T !== m && C(T, m);
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 T = r.get(N);
299
+ T ? T.t.add(m) : N !== m && S(N, m);
299
300
  }), g(m), isActuallyWritableAtom(m) && m.onMount) {
300
- const w = m.onMount((...T) => A(m, ...T));
301
- w && (R.u = w);
301
+ const C = m.onMount((...N) => A(m, ...N));
302
+ C && (R.u = C);
302
303
  }
303
304
  return R;
304
- }, v = (m) => {
305
+ }, k = (m) => {
305
306
  var E;
306
307
  const R = (E = r.get(m)) == null ? void 0 : E.u;
307
308
  R && R(), r.delete(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(m);
308
- const w = c(m);
309
- w ? (hasPromiseAtomValue(w) && cancelPromise(w.v), w.d.forEach((T, k) => {
310
- if (k !== m) {
311
- const N = r.get(k);
312
- N && (N.t.delete(m), h(k, N) && v(k));
309
+ const C = c(m);
310
+ C ? (hasPromiseAtomValue(C) && cancelPromise(C.v), C.d.forEach((N, T) => {
311
+ if (T !== m) {
312
+ const w = r.get(T);
313
+ w && (w.t.delete(m), f(T, w) && k(T));
313
314
  }
314
315
  })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", m);
315
- }, _ = (m, E, R) => {
316
- const w = new Set(E.d.keys());
317
- R == null || R.forEach((T, k) => {
318
- if (w.has(k)) {
319
- w.delete(k);
316
+ }, I = (m, E, R) => {
317
+ const C = new Set(E.d.keys());
318
+ R == null || R.forEach((N, T) => {
319
+ if (C.has(T)) {
320
+ C.delete(T);
320
321
  return;
321
322
  }
322
- const N = r.get(k);
323
- N && (N.t.delete(m), h(k, N) && v(k));
324
- }), w.forEach((T) => {
325
- const k = r.get(T);
326
- k ? k.t.add(m) : r.has(m) && C(T, m);
323
+ const w = r.get(T);
324
+ w && (w.t.delete(m), f(T, w) && k(T));
325
+ }), C.forEach((N) => {
326
+ const T = r.get(N);
327
+ T ? T.t.add(m) : r.has(m) && S(N, m);
327
328
  });
328
- }, I = () => {
329
+ }, _ = () => {
329
330
  let m;
330
331
  for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (m = /* @__PURE__ */ new Set()); n.size; ) {
331
332
  const E = Array.from(n);
332
- n.clear(), E.forEach(([R, w]) => {
333
- const T = c(R);
334
- if (T) {
335
- T.d !== (w == null ? void 0 : w.d) && _(R, T, w == null ? void 0 : w.d);
336
- const k = r.get(R);
337
- k && !// TODO This seems pretty hacky. Hope to fix it.
333
+ n.clear(), E.forEach(([R, C]) => {
334
+ const N = c(R);
335
+ if (N) {
336
+ N.d !== (C == null ? void 0 : C.d) && I(R, N, C == null ? void 0 : C.d);
337
+ const T = r.get(R);
338
+ T && !// TODO This seems pretty hacky. Hope to fix it.
338
339
  // Maybe we could `mountDependencies` in `setAtomState`?
339
- (w && !hasPromiseAtomValue(w) && (isEqualAtomValue(w, T) || isEqualAtomError(w, T))) && (k.l.forEach((N) => N()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && m.add(R));
340
+ (C && !hasPromiseAtomValue(C) && (isEqualAtomValue(C, N) || isEqualAtomError(C, N))) && (T.l.forEach((w) => w()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && m.add(R));
340
341
  } else
341
342
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
342
343
  });
343
344
  }
344
345
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
345
346
  return a.forEach((E) => E("state")), m;
346
- }, D = (m, E) => {
347
- const R = b(m), w = I(), T = R.l;
348
- return T.add(E), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((k) => k("sub")), l.forEach(
349
- (k) => k({ type: "sub", flushed: w })
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((T) => T("sub")), l.forEach(
350
+ (T) => T({ type: "sub", flushed: C })
350
351
  )), () => {
351
- T.delete(E), y(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((k) => k("unsub")), l.forEach((k) => k({ type: "unsub" })));
352
+ N.delete(E), y(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("unsub")), l.forEach((T) => T({ type: "unsub" })));
352
353
  };
353
354
  };
354
355
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
355
356
  get: j,
356
357
  set: A,
357
- sub: D,
358
+ sub: P,
358
359
  // store dev methods (these are tentative and subject to change without notice)
359
360
  dev_subscribe_store: (m, E) => E !== 2 ? (console.warn(
360
361
  "The current StoreListener revision is 2. The older ones are deprecated."
@@ -367,9 +368,9 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
367
368
  dev_get_atom_state: (m) => o.get(m),
368
369
  dev_get_mounted: (m) => r.get(m),
369
370
  dev_restore_atoms: (m) => {
370
- for (const [R, w] of m)
371
- hasInitialValue(R) && (x(R, w), S(R));
372
- const E = I();
371
+ for (const [R, C] of m)
372
+ hasInitialValue(R) && (x(R, C), v(R));
373
+ const E = _();
373
374
  l.forEach(
374
375
  (R) => R({ type: "restore", flushed: E })
375
376
  );
@@ -377,7 +378,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
377
378
  } : {
378
379
  get: j,
379
380
  set: A,
380
- sub: D
381
+ sub: P
381
382
  };
382
383
  };
383
384
  let defaultStore;
@@ -394,37 +395,37 @@ function splitAtom(o, r) {
394
395
  let p = n.get(c);
395
396
  if (p)
396
397
  return p;
397
- const u = d && n.get(d), x = [], f = [];
398
+ const u = d && n.get(d), x = [], h = [];
398
399
  return c.forEach((g, j) => {
399
400
  const b = r ? r(g) : j;
400
- f[j] = b;
401
- const h = u && u.atomList[u.keyList.indexOf(b)];
402
- if (h) {
403
- x[j] = h;
401
+ h[j] = b;
402
+ const f = u && u.atomList[u.keyList.indexOf(b)];
403
+ if (f) {
404
+ x[j] = f;
404
405
  return;
405
406
  }
406
407
  const y = (B) => {
407
- const A = B(l), C = B(o), _ = a(C, A == null ? void 0 : A.arr).keyList.indexOf(b);
408
- if (_ < 0 || _ >= C.length) {
409
- const I = c[a(c).keyList.indexOf(b)];
410
- if (I)
411
- return I;
408
+ const A = B(l), S = B(o), I = a(S, A == null ? void 0 : A.arr).keyList.indexOf(b);
409
+ if (I < 0 || I >= S.length) {
410
+ const _ = c[a(c).keyList.indexOf(b)];
411
+ if (_)
412
+ return _;
412
413
  throw new Error("splitAtom: index out of bounds for read");
413
414
  }
414
- return C[_];
415
- }, S = (B, A, C) => {
416
- const v = B(l), _ = B(o), D = a(_, v == null ? void 0 : v.arr).keyList.indexOf(b);
417
- if (D < 0 || D >= _.length)
415
+ return S[I];
416
+ }, v = (B, A, S) => {
417
+ const k = B(l), I = B(o), P = a(I, k == null ? void 0 : k.arr).keyList.indexOf(b);
418
+ if (P < 0 || P >= I.length)
418
419
  throw new Error("splitAtom: index out of bounds for write");
419
- const m = isFunction(C) ? C(_[D]) : C;
420
+ const m = isFunction(S) ? S(I[P]) : S;
420
421
  A(o, [
421
- ..._.slice(0, D),
422
+ ...I.slice(0, P),
422
423
  m,
423
- ..._.slice(D + 1)
424
+ ...I.slice(P + 1)
424
425
  ]);
425
426
  };
426
- x[j] = isWritable(o) ? atom(y, S) : atom(y);
427
- }), u && u.keyList.length === f.length && u.keyList.every((g, j) => g === f[j]) ? p = u : p = { arr: c, atomList: x, keyList: f }, n.set(c, p), p;
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;
428
429
  }, l = atom((c) => {
429
430
  const d = c(l), p = c(o);
430
431
  return a(p, d == null ? void 0 : d.arr);
@@ -460,17 +461,17 @@ function splitAtom(o, r) {
460
461
  case "move": {
461
462
  const u = c(i).indexOf(p.atom), x = p.before ? c(i).indexOf(p.before) : c(i).length;
462
463
  if (u >= 0 && x >= 0) {
463
- const f = c(o);
464
+ const h = c(o);
464
465
  u < x ? d(o, [
465
- ...f.slice(0, u),
466
- ...f.slice(u + 1, x),
467
- f[u],
468
- ...f.slice(x)
466
+ ...h.slice(0, u),
467
+ ...h.slice(u + 1, x),
468
+ h[u],
469
+ ...h.slice(x)
469
470
  ]) : d(o, [
470
- ...f.slice(0, x),
471
- f[u],
472
- ...f.slice(x, u),
473
- ...f.slice(u + 1)
471
+ ...h.slice(0, x),
472
+ h[u],
473
+ ...h.slice(x, u),
474
+ ...h.slice(u + 1)
474
475
  ]);
475
476
  }
476
477
  break;
@@ -547,7 +548,7 @@ function atomWithStorage(o, r, n = defaultStorage, a) {
547
548
  (d) => d(i),
548
549
  (d, p, u) => {
549
550
  const x = typeof u == "function" ? u(d(i)) : u;
550
- return x === RESET ? (p(i, r), n.removeItem(o)) : x instanceof Promise ? x.then((f) => (p(i, f), n.setItem(o, f))) : (p(i, x), n.setItem(o, x));
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));
551
552
  }
552
553
  );
553
554
  }
@@ -1134,50 +1135,50 @@ const useBlocksStoreManager = () => {
1134
1135
  updateBlocksProps: c
1135
1136
  } = useBlocksStoreManager();
1136
1137
  return {
1137
- moveBlocks: (b, h, y) => {
1138
- const S = map(b, (A) => {
1139
- const v = r.find((D) => D._id === A)._parent || null, I = r.filter((D) => v ? D._parent === v : !D._parent).map((D) => D._id).indexOf(A);
1140
- return { _id: A, oldParent: v, oldPosition: I };
1141
- }), B = S.find(({ _id: A }) => A === b[0]);
1142
- B && B.oldParent === h && B.oldPosition === y || (i(b, h, y), o({
1143
- undo: () => each(S, ({ _id: A, oldParent: C, oldPosition: v }) => {
1144
- i([A], C, v);
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);
1145
1146
  }),
1146
- redo: () => i(b, h, y)
1147
+ redo: () => i(b, f, y)
1147
1148
  }));
1148
1149
  },
1149
- addBlocks: (b, h, y) => {
1150
- a(b, h, y), o({
1150
+ addBlocks: (b, f, y) => {
1151
+ a(b, f, y), o({
1151
1152
  undo: () => l(map(b, "_id")),
1152
- redo: () => a(b, h, y)
1153
+ redo: () => a(b, f, y)
1153
1154
  });
1154
1155
  },
1155
1156
  removeBlocks: (b) => {
1156
1157
  var B;
1157
- const h = (B = first(b)) == null ? void 0 : B._parent, S = r.filter((A) => h ? A._parent === h : !A._parent).indexOf(first(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));
1158
1159
  l(map(b, "_id")), o({
1159
- undo: () => a(b, h, S),
1160
+ undo: () => a(b, f, v),
1160
1161
  redo: () => l(map(b, "_id"))
1161
1162
  });
1162
1163
  },
1163
- updateBlocks: (b, h, y) => {
1164
- let S = [];
1164
+ updateBlocks: (b, f, y) => {
1165
+ let v = [];
1165
1166
  if (y)
1166
- S = map(b, (B) => ({ _id: B, ...y }));
1167
+ v = map(b, (B) => ({ _id: B, ...y }));
1167
1168
  else {
1168
- const B = keys(h);
1169
- S = map(b, (A) => {
1170
- const C = r.find((_) => _._id === A), v = { _id: A };
1171
- return each(B, (_) => v[_] = C[_]), v;
1169
+ const B = keys(f);
1170
+ v = map(b, (A) => {
1171
+ const S = r.find((I) => I._id === A), k = { _id: A };
1172
+ return each(B, (I) => k[I] = S[I]), k;
1172
1173
  });
1173
1174
  }
1174
- c(map(b, (B) => ({ _id: B, ...h }))), o({
1175
- undo: () => c(S),
1176
- redo: () => c(map(b, (B) => ({ _id: B, ...h })))
1175
+ c(map(b, (B) => ({ _id: B, ...f }))), o({
1176
+ undo: () => c(v),
1177
+ redo: () => c(map(b, (B) => ({ _id: B, ...f })))
1177
1178
  });
1178
1179
  },
1179
- updateBlocksRuntime: (b, h) => {
1180
- c(map(b, (y) => ({ _id: y, ...h })));
1180
+ updateBlocksRuntime: (b, f) => {
1181
+ c(map(b, (y) => ({ _id: y, ...f })));
1181
1182
  },
1182
1183
  setNewBlocks: (b) => {
1183
1184
  n(b), o({
@@ -1186,12 +1187,12 @@ const useBlocksStoreManager = () => {
1186
1187
  });
1187
1188
  },
1188
1189
  updateMultipleBlocksProps: (b) => {
1189
- let h = [];
1190
- h = map(b, (y) => {
1191
- const S = keys(y), B = r.find((C) => C._id === y._id), A = {};
1192
- return each(S, (C) => A[C] = B[C]), A;
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;
1193
1194
  }), c(b), o({
1194
- undo: () => c(h),
1195
+ undo: () => c(f),
1195
1196
  redo: () => c(b)
1196
1197
  });
1197
1198
  }
@@ -1203,9 +1204,9 @@ const useBlocksStoreManager = () => {
1203
1204
  for (let j = 0; j < i.length; j++) {
1204
1205
  const { _id: b } = i[j];
1205
1206
  i[j]._id = generateUUID();
1206
- const h = filter(i, { _parent: b });
1207
- for (let y = 0; y < h.length; y++)
1208
- h[y]._parent = i[j]._id;
1207
+ const f = filter(i, { _parent: b });
1208
+ for (let y = 0; y < f.length; y++)
1209
+ f[y]._parent = i[j]._id;
1209
1210
  }
1210
1211
  const p = first(i);
1211
1212
  let u, x;
@@ -1216,16 +1217,16 @@ const useBlocksStoreManager = () => {
1216
1217
  return { addCoreBlock: useCallback(
1217
1218
  (i, c, d) => {
1218
1219
  if (has(i, "blocks")) {
1219
- const h = i.blocks;
1220
- return a(h, c, d);
1220
+ const f = i.blocks;
1221
+ return a(f, c, d);
1221
1222
  }
1222
1223
  const p = generateUUID(), u = getDefaultBlockProps(i.type), x = {
1223
1224
  _type: i.type,
1224
1225
  _id: p,
1225
1226
  ...u
1226
1227
  };
1227
- let f, g;
1228
- return c && (f = find(o, { _id: c }), x._parent = c, g = c), !canAcceptChildBlock(f == null ? void 0 : f._type, x._type) && f && (x._parent = f._parent, g = f._parent), n([x], g, d), r([x._id]), x;
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;
1229
1230
  },
1230
1231
  [n, a, o, r]
1231
1232
  ), addPredefinedBlock: a };
@@ -2367,13 +2368,13 @@ function getNewClasses(o = "", r = "", n = []) {
2367
2368
  );
2368
2369
  const i = [], c = [];
2369
2370
  each(n, (u) => {
2370
- const x = constructClassObject(u), f = find(a, pick(x, ["dark", "mq", "mod", "property"]));
2371
- if (f && (a = filter(
2371
+ const x = constructClassObject(u), h = find(a, pick(x, ["dark", "mq", "mod", "property"]));
2372
+ if (h && (a = filter(
2372
2373
  a,
2373
- (g) => g.fullCls !== (f == null ? void 0 : f.fullCls)
2374
+ (g) => g.fullCls !== (h == null ? void 0 : h.fullCls)
2374
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)) {
2375
2376
  const g = find(l, pick(x, ["property"]));
2376
- f && (l = filter(
2377
+ h && (l = filter(
2377
2378
  l,
2378
2379
  (j) => j.fullCls !== (g == null ? void 0 : g.fullCls)
2379
2380
  )), c.push({
@@ -2471,8 +2472,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2471
2472
  const x = filter(
2472
2473
  o,
2473
2474
  (g) => isString(l) ? g._parent === l : !d._parent
2474
- ).indexOf(d) + 1, f = getDuplicatedBlocks(o, c, l);
2475
- n(f, l, x), i.push(get(f, "0._id", ""));
2475
+ ).indexOf(d) + 1, h = getDuplicatedBlocks(o, c, l);
2476
+ n(h, l, x), i.push(get(h, "0._id", ""));
2476
2477
  }), r(i);
2477
2478
  },
2478
2479
  [o, r]
@@ -2563,13 +2564,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2563
2564
  return map(i, (c) => {
2564
2565
  const d = o(c), p = a;
2565
2566
  let { classes: u, baseClasses: x } = getSplitClasses(get(d, l.prop, "styles:,"));
2566
- return each(p, (f) => {
2567
- const g = f.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${g}($| )`, "g");
2567
+ return each(p, (h) => {
2568
+ const g = h.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${g}($| )`, "g");
2568
2569
  u = u.replace(j, " ").replace(/ +/g, " ").trim();
2569
- const b = first(f.split(":"));
2570
- includes(["2xl", "xl", "lg", "md", "sm"], b) && p.push(f.split(":").pop().trim());
2571
- }), each(p, (f) => {
2572
- const g = new RegExp(`(^| )${f.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2570
+ const b = first(h.split(":"));
2571
+ includes(["2xl", "xl", "lg", "md", "sm"], b) && p.push(h.split(":").pop().trim());
2572
+ }), each(p, (h) => {
2573
+ const g = new RegExp(`(^| )${h.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2573
2574
  x = x.replace(g, " ").replace(/ +/g, " ").trim();
2574
2575
  }), {
2575
2576
  ids: [d._id],
@@ -3021,39 +3022,39 @@ const getBlockWithChildren = (o, r) => {
3021
3022
  return isEmpty(c) ? !1 : (has(l, "_parent") && isEmpty(l._parent) && delete l._parent, { ...l, ...c });
3022
3023
  })
3023
3024
  ), addLangToPrompt = (o, r, n) => !r || n !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, r, r)} language.`, askAiProcessingAtom = atom$1(!1), useAskAi = () => {
3024
- 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, f = (g, j) => {
3025
- const b = cloneDeep(j.find((h) => h._id === g));
3026
- for (const h in b) {
3027
- const y = b[h];
3028
- typeof y == "string" && startsWith(y, STYLES_KEY) ? b[h] = compact(flattenDeep(y.replace(STYLES_KEY, "").split(","))).join(" ") : h !== "_id" && delete b[h];
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];
3029
3030
  }
3030
3031
  return b;
3031
3032
  };
3032
3033
  return {
3033
3034
  askAi: useCallback(
3034
- async (g, j, b, h) => {
3035
+ async (g, j, b, f) => {
3035
3036
  if (l) {
3036
3037
  r(!0), a(null);
3037
3038
  try {
3038
- const y = p === u ? "" : p, S = g === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(j, d)), p) : [f(j, d)], B = await l(g, addLangToPrompt(b, x, g), S, y), { blocks: A, error: C } = B;
3039
- if (C) {
3040
- a(C);
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);
3041
3042
  return;
3042
3043
  }
3043
3044
  if (g === "styles") {
3044
- const v = A.map((_) => {
3045
- for (const I in _)
3046
- I !== "_id" && (_[I] = `${STYLES_KEY},${_[I]}`);
3047
- return _;
3045
+ const k = A.map((I) => {
3046
+ for (const _ in I)
3047
+ _ !== "_id" && (I[_] = `${STYLES_KEY},${I[_]}`);
3048
+ return I;
3048
3049
  });
3049
- c(v);
3050
+ c(k);
3050
3051
  } else
3051
3052
  i(A);
3052
- h && h(B);
3053
+ f && f(B);
3053
3054
  } catch (y) {
3054
3055
  a(y);
3055
3056
  } finally {
3056
- r(!1), h && h();
3057
+ r(!1), f && f();
3057
3058
  }
3058
3059
  }
3059
3060
  },
@@ -3164,10 +3165,10 @@ const useWrapperBlock = () => useAtomValue$1(wrapperBlockAtom), layoutVariantAto
3164
3165
  if (d < r) {
3165
3166
  const u = parseFloat((d / r).toFixed(2).toString());
3166
3167
  let x = {};
3167
- const f = p * u, g = d * u;
3168
+ const h = p * u, g = d * u;
3168
3169
  p && (x = {
3169
3170
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
3170
- height: 100 + (p - f) / f * 100 + "%",
3171
+ height: 100 + (p - h) / h * 100 + "%",
3171
3172
  width: 100 + (d - g) / g * 100 + "%"
3172
3173
  }), i({
3173
3174
  position: "relative",
@@ -3347,7 +3348,7 @@ const useDnd = () => {
3347
3348
  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);
3348
3349
  if (!useFeature("dnd"))
3349
3350
  return {};
3350
- const f = () => {
3351
+ const h = () => {
3351
3352
  removePlaceholder(), n(!1), p(null), u(null), possiblePositions = [];
3352
3353
  };
3353
3354
  return iframeDocument = o, {
@@ -3356,26 +3357,26 @@ const useDnd = () => {
3356
3357
  g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3357
3358
  },
3358
3359
  onDrop: (g) => {
3359
- var C;
3360
- const j = dropTarget, h = getOrientation(j) === "vertical" ? g.clientY + ((C = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : C.scrollY) : g.clientX;
3361
- dropIndex = calculateDropIndex(h, possiblePositions);
3362
- const y = d, S = j.getAttribute("data-block-id"), B = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3363
- if ((y == null ? void 0 : y._id) === S || !B) {
3364
- f();
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) {
3365
+ h();
3365
3366
  return;
3366
3367
  }
3367
3368
  if (!has(y, "_id")) {
3368
- a(y, S === "canvas" ? null : S, dropIndex), setTimeout(f, 300);
3369
+ a(y, v === "canvas" ? null : v, dropIndex), setTimeout(h, 300);
3369
3370
  return;
3370
3371
  }
3371
3372
  let A = j.getAttribute("data-block-id");
3372
- A === null && (A = g.target.parentElement.getAttribute("data-block-id")), c([y._id], A === "canvas" ? null : A, dropIndex), f(), setTimeout(removePlaceholder, 300);
3373
+ A === null && (A = g.target.parentElement.getAttribute("data-block-id")), c([y._id], A === "canvas" ? null : A, dropIndex), h(), setTimeout(removePlaceholder, 300);
3373
3374
  },
3374
3375
  onDragEnter: (g) => {
3375
3376
  const j = g, b = j.target;
3376
3377
  dropTarget = b;
3377
- const h = b.getAttribute("data-block-id"), y = b.getAttribute("data-dnd-dragged") !== "yes";
3378
- u(h), j.stopPropagation(), j.preventDefault(), possiblePositions = [], y && calculatePossiblePositions(b), n(!0), l(""), i([]);
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([]);
3379
3380
  },
3380
3381
  onDragLeave: (g) => {
3381
3382
  g.target.getAttribute("data-block-id") === "canvas" && (u(null), n(!1), removePlaceholder(), possiblePositions = []);
@@ -3398,7 +3399,7 @@ function destroyQuill(o) {
3398
3399
  const useHandleCanvasDblClick = () => {
3399
3400
  const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], r = useUpdateBlocksProps(), [n, a] = useAtom$1(inlineEditingActiveAtom), { clearHighlight: l } = useBlockHighlight();
3400
3401
  return (i) => {
3401
- var f;
3402
+ var h;
3402
3403
  if (n)
3403
3404
  return;
3404
3405
  const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
@@ -3417,7 +3418,7 @@ const useHandleCanvasDblClick = () => {
3417
3418
  g.stopPropagation();
3418
3419
  }), p.addEventListener("keydown", (g) => {
3419
3420
  (g.key === "Enter" || g.key === "Escape") && x();
3420
- }), u.focus(), (f = p.querySelector(".ql-clipboard")) == null || f.remove(), a(c.getAttribute("data-block-id"));
3421
+ }), u.focus(), (h = p.querySelector(".ql-clipboard")) == null || h.remove(), a(c.getAttribute("data-block-id"));
3421
3422
  };
3422
3423
  }, useHandleCanvasClick = () => {
3423
3424
  const [, o] = useSelectedStylingBlocks(), [r, n] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
@@ -3456,11 +3457,11 @@ const useHandleCanvasDblClick = () => {
3456
3457
  setTimeout(() => {
3457
3458
  if (!isEmpty(a))
3458
3459
  return;
3459
- const f = getElementByDataBlockId(r, first(n));
3460
- if (f) {
3461
- const g = f.getAttribute("data-style-prop");
3460
+ const h = getElementByDataBlockId(r, first(n));
3461
+ if (h) {
3462
+ const g = h.getAttribute("data-style-prop");
3462
3463
  if (g) {
3463
- const j = f.getAttribute("data-style-id"), b = f.getAttribute("data-block-parent");
3464
+ const j = h.getAttribute("data-style-id"), b = h.getAttribute("data-block-parent");
3464
3465
  l([{ id: j, prop: g, blockId: b }]);
3465
3466
  }
3466
3467
  }
@@ -3482,14 +3483,14 @@ const useHandleCanvasDblClick = () => {
3482
3483
  }
3483
3484
  );
3484
3485
  }, getElementByDataBlockId = (o, r) => o.querySelector(`[data-block-id="${r}"]`), useKeyEventWatcher = (o) => {
3485
- const [r, n] = useSelectedBlockIds(), a = useSelectedBlock(), l = useRemoveBlocks(), i = useDuplicateBlocks(), { undo: c, redo: d } = useUndoManager(), [, p] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: x, pasteBlocks: f } = usePasteBlocks();
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();
3486
3487
  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(
3487
3488
  "ctrl+v,command+v",
3488
3489
  () => {
3489
- x(r[0]) && f(r);
3490
+ x(r[0]) && h(r);
3490
3491
  },
3491
3492
  {},
3492
- [r, x, f]
3493
+ [r, x, h]
3493
3494
  );
3494
3495
  const g = o ? { document: o } : {};
3495
3496
  useHotkeys("esc", () => n([]), g, [n]), useHotkeys("ctrl+d,command+d", () => i(r), { ...g, preventDefault: !0 }, [
@@ -3553,7 +3554,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3553
3554
  }
3554
3555
  });
3555
3556
  useResizeObserver(o, () => x(), o !== null);
3556
- const f = get(r, "_parent", null), g = isEmpty(get(r, "_name", "")) ? get(r, "_type", "") : get(r, "_name", "");
3557
+ const h = get(r, "_parent", null), g = isEmpty(get(r, "_name", "")) ? get(r, "_type", "") : get(r, "_name", "");
3557
3558
  return !o || !r || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3558
3559
  "div",
3559
3560
  {
@@ -3570,12 +3571,12 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3570
3571
  onKeyDown: (j) => j.stopPropagation(),
3571
3572
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3572
3573
  children: [
3573
- f && /* @__PURE__ */ jsxRuntimeExports.jsx(
3574
+ h && /* @__PURE__ */ jsxRuntimeExports.jsx(
3574
3575
  ArrowUpIcon,
3575
3576
  {
3576
3577
  className: "hover:scale-105",
3577
3578
  onClick: () => {
3578
- c([]), l([f]);
3579
+ c([]), l([h]);
3579
3580
  }
3580
3581
  }
3581
3582
  ),
@@ -3597,7 +3598,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3597
3598
  }, HeadTags = () => {
3598
3599
  const [o] = useTheme(), r = useThemeOptions(), [n] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useSelectedStylingBlocks(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), { document: d, window: p } = useFrame(), [u] = useState(d == null ? void 0 : d.getElementById("highlighted-block")), [x] = useState(
3599
3600
  d == null ? void 0 : d.getElementById("selected-block")
3600
- ), [f] = useState(
3601
+ ), [h] = useState(
3601
3602
  d == null ? void 0 : d.getElementById("selected-styling-block")
3602
3603
  ), [g] = useState(
3603
3604
  d == null ? void 0 : d.getElementById("dragged-block")
@@ -3623,8 +3624,8 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3623
3624
  typography,
3624
3625
  forms,
3625
3626
  aspectRatio,
3626
- plugin(function({ addBase: h, theme: y }) {
3627
- h({
3627
+ plugin(function({ addBase: f, theme: y }) {
3628
+ f({
3628
3629
  "h1,h2,h3,h4,h5,h6": {
3629
3630
  fontFamily: y("fontFamily.heading")
3630
3631
  },
@@ -3638,7 +3639,7 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3638
3639
  ]
3639
3640
  });
3640
3641
  }, [o, r, p]), useEffect(() => {
3641
- x && (x.textContent = `${map(n, (h) => `[data-block-id="${h}"]`).join(",")}{
3642
+ x && (x.textContent = `${map(n, (f) => `[data-block-id="${f}"]`).join(",")}{
3642
3643
  outline: 1px solid ${n.length === 1 ? "#42a1fc !important" : "orange !important"}; outline-offset: -1px;
3643
3644
  }`);
3644
3645
  }, [n, x]), useEffect(() => {
@@ -3646,10 +3647,10 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3646
3647
  }, [i, g]), useEffect(() => {
3647
3648
  u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3648
3649
  }, [u]), useEffect(() => {
3649
- f && (f.textContent = `${map(l, ({ id: h }) => `[data-style-id="${h}"]`).join(",")}{
3650
+ h && (h.textContent = `${map(l, ({ id: f }) => `[data-style-id="${f}"]`).join(",")}{
3650
3651
  outline: 1px solid orange !important; outline-offset: -1px;
3651
3652
  }`);
3652
- }, [l, f]), useEffect(() => {
3653
+ }, [l, h]), useEffect(() => {
3653
3654
  d.querySelector("#drop-target-block").innerHTML = c ? `[data-block-id="${c}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3654
3655
  }, [c, d]);
3655
3656
  const j = useMemo(
@@ -3668,11 +3669,11 @@ const pubsub = new PubSub(), BlockActionLabel = ({ block: o, label: r }) => {
3668
3669
  p || (p = d, d = "xs");
3669
3670
  const u = n.indexOf(d);
3670
3671
  if (u <= a) {
3671
- const x = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], f = ["hidden"];
3672
+ const x = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], h = ["hidden"];
3672
3673
  if (x.includes(p))
3673
3674
  for (let g = u; g < n.length; g++)
3674
3675
  i[g] = !0;
3675
- else if (f.includes(p))
3676
+ else if (h.includes(p))
3676
3677
  for (let g = u; g < n.length; g++)
3677
3678
  i[g] = !1;
3678
3679
  }
@@ -3740,62 +3741,62 @@ function applyLanguage(o, r, n) {
3740
3741
  }), a;
3741
3742
  }
3742
3743
  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(), f = useCallback((h) => getStyleAttrs(h, d), [d]), [g] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), b = useCallback(
3744
- (h) => h.reduce((y, S) => {
3745
- const B = get(p, S, {});
3744
+ 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(
3745
+ (f) => f.reduce((y, v) => {
3746
+ const B = get(p, v, {});
3746
3747
  return { ...y, ...B };
3747
3748
  }, {}),
3748
3749
  [p]
3749
3750
  );
3750
3751
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3751
- o.map((h, y) => {
3752
- if (j === h._id || u.includes(h._id))
3752
+ o.map((f, y) => {
3753
+ if (j === f._id || u.includes(f._id))
3753
3754
  return null;
3754
- const S = {}, B = filter(r, { _parent: h._id });
3755
- if (S.children = B.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: r, blocks: B }) : null, h._type === "GlobalBlock") {
3756
- const w = x(h);
3757
- S.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(w, (T) => !T._parent), allBlocks: w });
3755
+ const v = {}, B = filter(r, { _parent: f._id });
3756
+ if (v.children = B.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: r, blocks: B }) : null, f._type === "GlobalBlock") {
3757
+ const C = x(f);
3758
+ v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (N) => !N._parent), allBlocks: C });
3758
3759
  }
3759
- const A = getRegisteredChaiBlock(h._type), C = get(A, "component", null);
3760
- if (isNull(C))
3761
- return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${h == null ? void 0 : h._type} not registered -->` });
3762
- const v = has(A, "getBlockStateFrom") ? A == null ? void 0 : A.getBlockStateFrom(h, r) : [], _ = b(v), I = f(h);
3763
- if (get(I, "__isHidden", !1) && !includes(a, h._id))
3760
+ const A = getRegisteredChaiBlock(f._type), S = get(A, "component", null);
3761
+ if (isNull(S))
3762
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
3763
+ const k = has(A, "getBlockStateFrom") ? A == null ? void 0 : A.getBlockStateFrom(f, r) : [], I = b(k), _ = h(f);
3764
+ if (get(_, "__isHidden", !1) && !includes(a, f._id))
3764
3765
  return null;
3765
- const D = i && isDescendant(i._id, h._id, r), E = {
3766
+ const P = i && isDescendant(i._id, f._id, r), E = {
3766
3767
  blockProps: {
3767
- ...includes(a, h._id) ? { "force-show": "" } : {},
3768
- "data-block-id": h._id,
3769
- "data-block-type": h._type,
3768
+ ...includes(a, f._id) ? { "force-show": "" } : {},
3769
+ "data-block-id": f._id,
3770
+ "data-block-type": f._type,
3770
3771
  ...i ? (
3771
3772
  // @ts-ignore
3772
3773
  {
3773
- "data-dnd": canAcceptChildBlock(h._type, i == null ? void 0 : i._type) ? "yes" : "no",
3774
- "data-dnd-dragged": i._id === h._id || D ? "yes" : "no"
3774
+ "data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
3775
+ "data-dnd-dragged": i._id === f._id || P ? "yes" : "no"
3775
3776
  }
3776
3777
  ) : {},
3777
- ...c === h._id && !D ? { "data-drop": "yes" } : {},
3778
- ...includes(l, h._id) ? { "data-cut-block": "yes" } : {}
3778
+ ...c === f._id && !P ? { "data-drop": "yes" } : {},
3779
+ ...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
3779
3780
  },
3780
3781
  index: y,
3781
- ...applyBindings(applyLanguage(h, n, A), g),
3782
- ...omit(I, ["__isHidden"]),
3783
- ...S,
3782
+ ...applyBindings(applyLanguage(f, n, A), g),
3783
+ ...omit(_, ["__isHidden"]),
3784
+ ...v,
3784
3785
  inBuilder: !0,
3785
- blockState: _
3786
+ blockState: I
3786
3787
  };
3787
3788
  if (has(A, "dataProvider"))
3788
3789
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3789
3790
  AsyncPropsBlock,
3790
3791
  {
3791
3792
  dataProvider: A.dataProvider,
3792
- block: h,
3793
- component: C,
3793
+ block: f,
3794
+ component: S,
3794
3795
  props: E
3795
3796
  }
3796
3797
  ) });
3797
- const R = getRuntimeProps(h._type);
3798
- return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RuntimePropsBlock, { runtimeProps: R, block: h, component: C, props: E }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(C, E) });
3798
+ const R = getRuntimeProps(f._type);
3799
+ return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RuntimePropsBlock, { runtimeProps: R, block: f, component: S, props: E }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(S, E) });
3799
3800
  })
3800
3801
  ) });
3801
3802
  }
@@ -3850,47 +3851,47 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
3850
3851
  };
3851
3852
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
3852
3853
  }, getElementByStyleId = (o, r) => o.querySelector(`[data-style-id="${r}"]`), StaticCanvas = () => {
3853
- 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, f] = useState([]), [, g] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [b, h] = useSelectedStylingBlocks(), y = useBuilderProp("loading", !1), S = useBuilderProp("htmlDir", "ltr"), B = (v) => {
3854
- p((_) => ({ ..._, width: v }));
3854
+ 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) => {
3855
+ p((I) => ({ ...I, width: k }));
3855
3856
  };
3856
3857
  useEffect(() => {
3857
3858
  if (!c.current)
3858
3859
  return;
3859
- const { clientWidth: v, clientHeight: _ } = c.current;
3860
- p({ width: v, height: _ });
3860
+ const { clientWidth: k, clientHeight: I } = c.current;
3861
+ p({ width: k, height: I });
3861
3862
  }, [c, r]);
3862
- const A = (v, _ = 0) => {
3863
- const { top: I } = v.getBoundingClientRect();
3864
- return I + _ >= 0 && I - _ <= window.innerHeight;
3863
+ const A = (k, I = 0) => {
3864
+ const { top: _ } = k.getBoundingClientRect();
3865
+ return _ + I >= 0 && _ - I <= window.innerHeight;
3865
3866
  };
3866
3867
  useEffect(() => {
3867
- var v, _;
3868
+ var k, I;
3868
3869
  if (a && a.type !== "Multiple" && i.current) {
3869
- const I = getElementByDataBlockId(i.current.contentDocument, a._id);
3870
- I && (A(I) || (_ = (v = i.current) == null ? void 0 : v.contentWindow) == null || _.scrollTo({ top: I.offsetTop, behavior: "smooth" }), f([I]));
3870
+ const _ = getElementByDataBlockId(i.current.contentDocument, a._id);
3871
+ _ && (A(_) || (I = (k = i.current) == null ? void 0 : k.contentWindow) == null || I.scrollTo({ top: _.offsetTop, behavior: "smooth" }), h([_]));
3871
3872
  }
3872
3873
  }, [a]), useEffect(() => {
3873
3874
  if (!isEmpty(b) && i.current) {
3874
- const v = getElementByStyleId(
3875
+ const k = getElementByStyleId(
3875
3876
  i.current.contentDocument,
3876
3877
  first(b).id
3877
3878
  );
3878
- g(v ? [v] : [null]);
3879
+ g(k ? [k] : [null]);
3879
3880
  } else
3880
3881
  g([null]);
3881
3882
  }, [b]);
3882
- const C = useMemo(() => {
3883
- let v = IframeInitialContent;
3884
- return v = v.replace("__HTML_DIR__", S), o === "offline" && (v = v.replace(
3883
+ const S = useMemo(() => {
3884
+ let k = IframeInitialContent;
3885
+ return k = k.replace("__HTML_DIR__", v), o === "offline" && (k = k.replace(
3885
3886
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3886
3887
  "/offline/tailwind.cdn.js"
3887
- ), v = v.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), v = v.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), v;
3888
- }, [o, S]);
3888
+ ), 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;
3889
+ }, [o, v]);
3889
3890
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: B, onResize: B, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3890
3891
  "div",
3891
3892
  {
3892
3893
  onClick: () => {
3893
- n([]), h([]);
3894
+ n([]), f([]);
3894
3895
  },
3895
3896
  onMouseLeave: () => setTimeout(() => l(""), 300),
3896
3897
  className: "relative mx-auto h-full w-full overflow-hidden",
@@ -3903,7 +3904,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
3903
3904
  id: "canvas-iframe",
3904
3905
  style: { ...u, ...isEmpty(u) ? { width: `${r}px` } : {} },
3905
3906
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3906
- initialContent: C,
3907
+ initialContent: S,
3907
3908
  children: [
3908
3909
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3909
3910
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3966,7 +3967,9 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
3966
3967
  case "Paragraph":
3967
3968
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TextIcon, { className: "h-3 w-3 stroke-[2]" });
3968
3969
  case "Row":
3969
- return /* @__PURE__ */ jsxRuntimeExports.jsx(RowsIcon, { className: "h-3 w-3 stroke-[2]" });
3970
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Rows, { className: "h-3 w-3 stroke-[2]" });
3971
+ case "Column":
3972
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Columns, { className: "h-3 w-3 stroke-[2]" });
3970
3973
  case "ListItem":
3971
3974
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ColumnsIcon, { className: "h-3 w-3 stroke-[2]" });
3972
3975
  case "LineBreak":
@@ -4031,7 +4034,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4031
4034
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
4032
4035
  ] }, l))
4033
4036
  ] }) });
4034
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-NoUXWcBN.js")), CanvasArea = () => {
4037
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-ZGLfJqiA.js")), CanvasArea = () => {
4035
4038
  const [o] = useCodeEditor(), r = useBuilderProp("onError", noop);
4036
4039
  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: [
4037
4040
  /* @__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, {}) }) }),
@@ -4142,58 +4145,58 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4142
4145
  }
4143
4146
  );
4144
4147
  }, BorderRadiusInput$1 = BorderRadiusInput, ThemeConfigPanel$1 = React.memo(({ className: o = "" }) => {
4145
- const [r] = useDarkMode(), [n, a] = React.useState(""), l = useBuilderProp("themePresets", []), [i, c] = useTheme(), d = useThemeOptions(), { t: p } = useTranslation(), u = (h) => {
4146
- a(h);
4148
+ const [r] = useDarkMode(), [n, a] = React.useState(""), l = useBuilderProp("themePresets", []), [i, c] = useTheme(), d = useThemeOptions(), { t: p } = useTranslation(), u = (f) => {
4149
+ a(f);
4147
4150
  }, x = () => {
4148
- const h = l.find((y) => Object.keys(y)[0] === n);
4149
- if (h) {
4150
- const y = Object.values(h)[0];
4151
+ const f = l.find((y) => Object.keys(y)[0] === n);
4152
+ if (f) {
4153
+ const y = Object.values(f)[0];
4151
4154
  y && typeof y == "object" && "fontFamily" in y && "borderRadius" in y && "colors" in y ? c(y) : console.error("Invalid preset structure:", y);
4152
4155
  } else
4153
4156
  console.error("Preset not found:", n);
4154
- }, f = useDebouncedCallback(
4155
- (h, y) => {
4157
+ }, h = useDebouncedCallback(
4158
+ (f, y) => {
4156
4159
  c(() => ({
4157
4160
  ...i,
4158
4161
  fontFamily: {
4159
4162
  ...i.fontFamily,
4160
- [h.replace(/font-/g, "")]: y
4163
+ [f.replace(/font-/g, "")]: y
4161
4164
  }
4162
4165
  }));
4163
4166
  },
4164
4167
  [i],
4165
4168
  200
4166
4169
  ), g = useDebouncedCallback(
4167
- (h) => {
4170
+ (f) => {
4168
4171
  c(() => ({
4169
4172
  ...i,
4170
- borderRadius: `${h}px`
4173
+ borderRadius: `${f}px`
4171
4174
  }));
4172
4175
  },
4173
4176
  [i],
4174
4177
  200
4175
4178
  ), j = useDebouncedCallback(
4176
- (h, y) => {
4179
+ (f, y) => {
4177
4180
  c(() => {
4178
- const S = get(i, `colors.${h}`);
4179
- return r ? set(S, 1, y) : set(S, 0, y), {
4181
+ const v = get(i, `colors.${f}`);
4182
+ return r ? set(v, 1, y) : set(v, 0, y), {
4180
4183
  ...i,
4181
4184
  colors: {
4182
4185
  ...i.colors,
4183
- [h]: S
4186
+ [f]: v
4184
4187
  }
4185
4188
  };
4186
4189
  });
4187
4190
  },
4188
4191
  [i],
4189
4192
  200
4190
- ), b = (h) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1", children: Object.entries(h.items).map(([y]) => {
4191
- const S = get(i, `colors.${y}.${r ? 1 : 0}`);
4193
+ ), b = (f) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1", children: Object.entries(f.items).map(([y]) => {
4194
+ const v = get(i, `colors.${y}.${r ? 1 : 0}`);
4192
4195
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
4193
4196
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4194
4197
  ColorPickerInput$1,
4195
4198
  {
4196
- value: S,
4199
+ value: v,
4197
4200
  onChange: (B) => j(y, B)
4198
4201
  }
4199
4202
  ),
@@ -4208,11 +4211,11 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4208
4211
  "select",
4209
4212
  {
4210
4213
  value: n,
4211
- onChange: (h) => u(h.target.value),
4214
+ onChange: (f) => u(f.target.value),
4212
4215
  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",
4213
4216
  children: [
4214
4217
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Select preset" }),
4215
- Array.isArray(l) && l.map((h) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: Object.keys(h)[0], children: capitalize(Object.keys(h)[0]) }, Object.keys(h)[0]))
4218
+ 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]))
4216
4219
  ]
4217
4220
  }
4218
4221
  )
@@ -4220,14 +4223,14 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4220
4223
  /* @__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") }) })
4221
4224
  ] }),
4222
4225
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("space-y-2", o), children: [
4223
- (d == null ? void 0 : d.fontFamily) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-4", children: Object.entries(d.fontFamily).map(([h, y]) => /* @__PURE__ */ jsxRuntimeExports.jsx(
4226
+ (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(
4224
4227
  FontSelector$1,
4225
4228
  {
4226
- label: h,
4227
- value: i.fontFamily[h.replace(/font-/g, "")] || y[Object.keys(y)[0]],
4228
- onChange: (S) => f(h, S)
4229
+ label: f,
4230
+ value: i.fontFamily[f.replace(/font-/g, "")] || y[Object.keys(y)[0]],
4231
+ onChange: (v) => h(f, v)
4229
4232
  },
4230
- h
4233
+ f
4231
4234
  )) }),
4232
4235
  (d == null ? void 0 : d.borderRadius) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-0.5 py-3", children: [
4233
4236
  /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: p("Border Radius") }),
@@ -4238,7 +4241,7 @@ const usePageDataProviders = () => useAtom$1(dataProvidersAtom), useAllDataProvi
4238
4241
  ] }),
4239
4242
  (d == null ? void 0 : d.colors) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 space-y-0.5", children: [
4240
4243
  /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm text-slate-800", children: p("Colors") }),
4241
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full space-y-4 pt-2", children: d.colors.map((h) => b(h)) }, r ? "dark" : "light")
4244
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full space-y-4 pt-2", children: d.colors.map((f) => b(f)) }, r ? "dark" : "light")
4242
4245
  ] })
4243
4246
  ] }),
4244
4247
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -4433,52 +4436,53 @@ function BiExpandVertical(o) {
4433
4436
  return GenIcon({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z" }, child: [] }] })(o);
4434
4437
  }
4435
4438
  const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, dragHandle: n }) => {
4439
+ var T;
4436
4440
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4437
4441
  let p = null;
4438
- const u = o.children.length > 0, { highlightBlock: x, clearHighlight: f } = useBlockHighlight(), { id: g, data: j, isSelected: b, willReceiveDrop: h, isDragging: y, isEditing: S, handleClick: B } = o, A = (k) => {
4439
- k.stopPropagation(), !i.includes(g) && o.toggle();
4440
- }, C = (k) => {
4441
- k.isInternal && (p = k.isOpen, k.isOpen && k.close());
4442
- }, v = (k) => {
4443
- k.isInternal && p !== null && (p ? k.open() : k.close(), p = null);
4444
- }, [_, I] = useAtom$1(currentAddSelection), D = () => {
4445
- var N, $;
4446
- m(), document.getElementById(`tree-node-${(N = o == null ? void 0 : o.parent) == null ? void 0 : N.id}`) && !o.parent.isSelected && I(($ = o == null ? void 0 : o.parent) == null ? void 0 : $.id);
4442
+ 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) => {
4443
+ w.stopPropagation(), !i.includes(g) && o.toggle();
4444
+ }, S = (w) => {
4445
+ w.isInternal && (p = w.isOpen, w.isOpen && w.close());
4446
+ }, k = (w) => {
4447
+ w.isInternal && p !== null && (p ? w.open() : w.close(), p = null);
4448
+ }, [I, _] = useAtom$1(currentAddSelection), P = () => {
4449
+ var w;
4450
+ m(), o.parent.isSelected || _((w = o == null ? void 0 : o.parent) == null ? void 0 : w.id);
4447
4451
  }, m = () => {
4448
- I(null);
4449
- }, E = (k) => {
4450
- m(), k.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(), B(k);
4452
+ _(null);
4453
+ }, E = (w) => {
4454
+ m(), w.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(), B(w);
4451
4455
  };
4452
4456
  useEffect(() => {
4453
- const k = setTimeout(() => {
4454
- h && !o.isOpen && !y && !i.includes(g) && o.toggle();
4457
+ const w = setTimeout(() => {
4458
+ f && !o.isOpen && !y && !i.includes(g) && o.toggle();
4455
4459
  }, 500);
4456
- return () => clearTimeout(k);
4457
- }, [h, o, y]);
4460
+ return () => clearTimeout(w);
4461
+ }, [f, o, y]);
4458
4462
  const R = useMemo(() => {
4459
- const k = Object.keys(j), N = [];
4460
- for (let $ = 0; $ < k.length; $++)
4461
- if (k[$].endsWith("_attrs")) {
4462
- const L = j[k[$]], P = Object.keys(L).join("|");
4463
- P.match(/x-data/) && N.push("data"), P.match(/x-on/) && N.push("event"), P.match(/x-show|x-if/) && N.push("show");
4463
+ const w = Object.keys(j), $ = [];
4464
+ for (let L = 0; L < w.length; L++)
4465
+ if (w[L].endsWith("_attrs")) {
4466
+ const M = j[w[L]], D = Object.keys(M).join("|");
4467
+ D.match(/x-data/) && $.push("data"), D.match(/x-on/) && $.push("event"), D.match(/x-show|x-if/) && $.push("show");
4464
4468
  }
4465
- return N;
4466
- }, [j]), w = (k, N) => {
4467
- const $ = d.contentDocument || d.contentWindow.document, L = $.querySelector(`[data-block-id=${k}]`);
4468
- L && L.setAttribute("data-drop", N);
4469
- const P = L.getBoundingClientRect(), M = d.getBoundingClientRect();
4470
- P.top >= M.top && P.left >= M.left && P.bottom <= M.bottom && P.right <= M.right || ($.documentElement.scrollTop = L.offsetTop - M.top);
4471
- }, T = (k) => {
4469
+ return $;
4470
+ }, [j]), C = (w, $) => {
4471
+ const L = d.contentDocument || d.contentWindow.document, M = L.querySelector(`[data-block-id=${w}]`);
4472
+ M && M.setAttribute("data-drop", $);
4473
+ const D = M.getBoundingClientRect(), O = d.getBoundingClientRect();
4474
+ D.top >= O.top && D.left >= O.left && D.bottom <= O.bottom && D.right <= O.right || (L.documentElement.scrollTop = M.offsetTop - O.top);
4475
+ }, N = (w) => {
4472
4476
  m();
4473
- const N = get(o, "parent.id");
4474
- N !== "__REACT_ARBORIST_INTERNAL_ROOT__" ? pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { _id: N, position: k }) : pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK);
4477
+ const $ = get(o, "parent.id");
4478
+ $ !== "__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 });
4475
4479
  };
4476
4480
  return g === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative w-full cursor-pointer", children: [
4477
4481
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
4478
4482
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4479
4483
  "div",
4480
4484
  {
4481
- onClick: () => T(-1),
4485
+ onClick: () => N(-1),
4482
4486
  className: "h-1 rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
4483
4487
  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: [
4484
4488
  /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-2 w-2 stroke-[3]" }),
@@ -4492,42 +4496,43 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4492
4496
  "div",
4493
4497
  {
4494
4498
  onMouseEnter: () => x(g),
4495
- onMouseLeave: () => f(),
4499
+ onMouseLeave: () => h(),
4496
4500
  onClick: E,
4497
4501
  style: r,
4498
4502
  "data-node-id": g,
4499
4503
  ref: i.includes(g) ? null : n,
4500
- onDragStart: () => C(o),
4501
- onDragEnd: () => v(o),
4502
- onDragOver: (k) => {
4503
- k.preventDefault(), w(g, "yes");
4504
+ onDragStart: () => S(o),
4505
+ onDragEnd: () => k(o),
4506
+ onDragOver: (w) => {
4507
+ w.preventDefault(), C(g, "yes");
4504
4508
  },
4505
- onDragLeave: (k) => {
4506
- k.preventDefault(), w(g, "no");
4509
+ onDragLeave: (w) => {
4510
+ w.preventDefault(), C(g, "no");
4507
4511
  },
4508
- onDrop: (k) => {
4509
- k.preventDefault(), w(g, "no");
4512
+ onDrop: (w) => {
4513
+ w.preventDefault(), C(g, "no");
4510
4514
  },
4511
4515
  children: [
4512
- (o == null ? void 0 : o.rowIndex) > 0 && o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4516
+ (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((T = o == null ? void 0 : o.parent) == null ? void 0 : T.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4513
4517
  "div",
4514
4518
  {
4515
- onClick: () => T(o.childIndex),
4516
- onMouseEnter: D,
4519
+ onClick: (w) => {
4520
+ w.stopPropagation(), N(o.childIndex);
4521
+ },
4522
+ onMouseEnter: P,
4517
4523
  onMouseLeave: m,
4518
4524
  className: "absolute -top-0.5 h-1 w-[90%] rounded bg-purple-500 opacity-0 delay-200 duration-200 group-hover:opacity-100",
4519
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute left-1/2 top-1/2 flex h-5 w-5 -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-4 w-4 stroke-[3] text-white" }) })
4525
+ 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" }) })
4520
4526
  }
4521
4527
  ) }),
4522
4528
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
4523
4529
  "div",
4524
4530
  {
4525
- id: `tree-node-${o.id}`,
4526
4531
  className: cn(
4527
4532
  "group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 text-foreground/80 outline-none",
4528
4533
  b ? "bg-blue-500 text-white" : "hover:bg-slate-200 dark:hover:bg-gray-800",
4529
- h && canAcceptChildBlock(j._type, "Icon") ? "bg-green-200" : "",
4530
- (o == null ? void 0 : o.id) === _ ? "bg-purple-50" : "",
4534
+ f && canAcceptChildBlock(j._type, "Icon") ? "bg-green-200" : "",
4535
+ (o == null ? void 0 : o.id) === I ? "bg-purple-100" : "",
4531
4536
  y && "opacity-20",
4532
4537
  i.includes(g) ? "opacity-50" : ""
4533
4538
  ),
@@ -4547,12 +4552,12 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4547
4552
  ),
4548
4553
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "leading-1 flex items-center", children: [
4549
4554
  /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: j == null ? void 0 : j._type }),
4550
- S ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4555
+ v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4551
4556
  "div",
4552
4557
  {
4553
4558
  className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
4554
- onDoubleClick: (k) => {
4555
- k.stopPropagation(), o.edit(), o.deselect();
4559
+ onDoubleClick: (w) => {
4560
+ w.stopPropagation(), o.edit(), o.deselect();
4556
4561
  },
4557
4562
  children: [
4558
4563
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (j == null ? void 0 : j._name) || (j == null ? void 0 : j._type.split("/").pop()) }),
@@ -4565,16 +4570,16 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4565
4570
  ] })
4566
4571
  ] }),
4567
4572
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1.5 pr-2 group-hover:visible", children: [
4568
- !i.includes(g) && a.map((k) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4573
+ !i.includes(g) && a.map((w) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4569
4574
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4570
4575
  TooltipTrigger,
4571
4576
  {
4572
4577
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
4573
4578
  asChild: !0,
4574
- children: React__default.createElement(k.item, { blockId: g })
4579
+ children: React__default.createElement(w.item, { blockId: g })
4575
4580
  }
4576
4581
  ),
4577
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: k.tooltip })
4582
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: w.tooltip })
4578
4583
  ] })),
4579
4584
  canAddChildBlock(j == null ? void 0 : j._type) && !i.includes(g) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4580
4585
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4592,8 +4597,8 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4592
4597
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4593
4598
  TooltipTrigger,
4594
4599
  {
4595
- onClick: (k) => {
4596
- k.stopPropagation(), c(g), o.isOpen && o.toggle();
4600
+ onClick: (w) => {
4601
+ w.stopPropagation(), c(g), o.isOpen && o.toggle();
4597
4602
  },
4598
4603
  className: "cursor-pointer rounded bg-transparent hover:text-black",
4599
4604
  asChild: !0,
@@ -4751,16 +4756,12 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4751
4756
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Collapse all") })
4752
4757
  ] })
4753
4758
  ] }),
4754
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative z-[9999] w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4759
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "group relative z-[9999] ml-5 w-full cursor-pointer", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4755
4760
  "div",
4756
4761
  {
4757
4762
  onClick: () => pubsub.publish(CHAI_BUILDER_EVENTS.OPEN_ADD_BLOCK, { position: 0 }),
4758
- className: "h-1 rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
4759
- 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: [
4760
- /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon$1, { className: "h-2 w-2 stroke-[3]" }),
4761
- " ",
4762
- t("Add block")
4763
- ] })
4763
+ className: "h-1 w-[90%] rounded bg-purple-500 opacity-0 duration-200 group-hover:opacity-100",
4764
+ 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" }) })
4764
4765
  }
4765
4766
  ) }),
4766
4767
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4946,7 +4947,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4946
4947
  }
4947
4948
  }
4948
4949
  }, traverseNodes = (o, r = null) => flatMapDeep(o, (n) => {
4949
- var p, u, x, f, g, j, b, h;
4950
+ var p, u, x, h, g, j, b, f;
4950
4951
  if (n.type === "comment")
4951
4952
  return [];
4952
4953
  let a = { _id: generateUUID() };
@@ -4963,7 +4964,7 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4963
4964
  ...getAttrs(n),
4964
4965
  ...getStyles(n)
4965
4966
  }, n.attributes) {
4966
- const y = n.attributes.find((S) => includes(NAME_ATTRIBUTES, S.key));
4967
+ const y = n.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
4967
4968
  y && (a._name = y.value);
4968
4969
  }
4969
4970
  if (i)
@@ -4981,14 +4982,14 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4981
4982
  ];
4982
4983
  a = {
4983
4984
  ...a,
4984
- href: ((p = l.find((S) => S.key === "href")) == null ? void 0 : p.value) || "",
4985
- hrefType: ((u = l.find((S) => S.key === "data-vbtype")) == null ? void 0 : u.value) || "video",
4986
- autoplay: ((x = l.find((S) => S.key === "data-autoplay")) == null ? void 0 : x.value) === "true" ? "true" : "false",
4987
- maxWidth: ((g = (f = l.find((S) => S.key === "data-maxwidth")) == null ? void 0 : f.value) == null ? void 0 : g.replace("px", "")) || "",
4988
- backdropColor: ((j = l.find((S) => S.key === "data-overlay")) == null ? void 0 : j.value) || "",
4989
- galleryName: ((b = l.find((S) => S.key === "data-gall")) == null ? void 0 : b.value) || ""
4990
- }, forEach(y, (S) => {
4991
- has(a, `styles_attrs.${S}`) && delete a.styles_attrs[S];
4985
+ href: ((p = l.find((v) => v.key === "href")) == null ? void 0 : p.value) || "",
4986
+ hrefType: ((u = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : u.value) || "video",
4987
+ autoplay: ((x = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : x.value) === "true" ? "true" : "false",
4988
+ maxWidth: ((g = (h = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : h.value) == null ? void 0 : g.replace("px", "")) || "",
4989
+ backdropColor: ((j = l.find((v) => v.key === "data-overlay")) == null ? void 0 : j.value) || "",
4990
+ galleryName: ((b = l.find((v) => v.key === "data-gall")) == null ? void 0 : b.value) || ""
4991
+ }, forEach(y, (v) => {
4992
+ has(a, `styles_attrs.${v}`) && delete a.styles_attrs[v];
4992
4993
  });
4993
4994
  }
4994
4995
  if (a._type === "Input") {
@@ -4998,9 +4999,9 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
4998
4999
  const y = stringify([n]);
4999
5000
  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];
5000
5001
  } else if (n.tagName === "svg") {
5001
- const y = find(n.attributes, { key: "height" }), S = find(n.attributes, { key: "width" }), B = get(y, "value") ? `[${get(y, "value")}px]` : "24px", A = get(S, "value") ? `[${get(S, "value")}px]` : "24px", C = get(find(n.attributes, { key: "class" }), "value", "w-full h-full");
5002
- return a.styles = `${STYLES_KEY}, ${cn(`w-${A} h-${B}`, C)}`.trim(), n.attributes = filter(n.attributes, (v) => !includes(["style", "width", "height", "class"], v.key)), a.icon = stringify([n]), [a];
5003
- } else if (n.tagName == "option" && r && ((h = r.block) == null ? void 0 : h._type) === "Select")
5002
+ 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");
5003
+ 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];
5004
+ } else if (n.tagName == "option" && r && ((f = r.block) == null ? void 0 : f._type) === "Select")
5004
5005
  return r.block.options.push({
5005
5006
  label: getTextContent(n.children),
5006
5007
  ...getAttrs(n)
@@ -5008,6 +5009,10 @@ const currentAddSelection = atom$1(null), Node = memo(({ node: o, style: r, drag
5008
5009
  const d = traverseNodes(n.children, { block: a, node: n });
5009
5010
  return [a, ...d];
5010
5011
  }), getSanitizedHTML = (o) => {
5012
+ o = o.replace(/(\w+)=\\?"(.*?)\\?"/g, (a, l, i) => {
5013
+ let c = i.replace(/\\"/g, '"');
5014
+ return c = c.replace(/{([^}]+)}/g, (d) => d.replace(/"/g, '\\"')), `${l}="${c.replace(/\\"/g, '"')}"`;
5015
+ }), o = o.replace(/\\n/g, "").replace(/\\\\/g, "").replace(/\\([/<>])/g, "$1").replace(/\\./g, "").replace(/[\n\r\t\f\v]/g, "");
5011
5016
  const r = o.match(/<body[^>]*>[\s\S]*?<\/body>/);
5012
5017
  return (r && r.length > 0 ? r[0].replace(/<body/, "<div").replace(/<\/body>/, "</div>") : o).replace(/\s+/g, " ").replaceAll("> <", "><").replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").trim();
5013
5018
  }, getBlocksFromHTML = (o) => {
@@ -5185,8 +5190,8 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5185
5190
  collections: r,
5186
5191
  onChange: n
5187
5192
  }) => {
5188
- var D;
5189
- const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (m, E) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, x] = useState("page"), [f, g] = useState(""), [j, b] = useState([]), [h, y] = useState(-1), S = useRef(null), B = (D = r == null ? void 0 : r.find((m) => m.key === u)) == null ? void 0 : D.name;
5193
+ var P;
5194
+ const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (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;
5190
5195
  useEffect(() => {
5191
5196
  if (g(""), b([]), y(-1), p(!1), !o || i || !startsWith(o, "collection:"))
5192
5197
  return;
@@ -5208,10 +5213,10 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5208
5213
  },
5209
5214
  [u],
5210
5215
  300
5211
- ), C = (m) => {
5216
+ ), S = (m) => {
5212
5217
  const E = ["collection", u, m.id];
5213
5218
  E[1] && (n(E.join(":")), g(m.name), p(!1), b([]), y(-1));
5214
- }, v = (m) => {
5219
+ }, k = (m) => {
5215
5220
  switch (m.key) {
5216
5221
  case "ArrowDown":
5217
5222
  m.preventDefault(), y((E) => E < j.length - 1 ? E + 1 : E);
@@ -5222,22 +5227,22 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5222
5227
  case "Enter":
5223
5228
  if (m.preventDefault(), j.length === 0)
5224
5229
  return;
5225
- h >= 0 && C(j[h]);
5230
+ f >= 0 && S(j[f]);
5226
5231
  break;
5227
5232
  case "Escape":
5228
- m.preventDefault(), _();
5233
+ m.preventDefault(), I();
5229
5234
  break;
5230
5235
  }
5231
5236
  };
5232
5237
  useEffect(() => {
5233
- if (h >= 0 && S.current) {
5234
- const m = S.current.children[h];
5238
+ if (f >= 0 && v.current) {
5239
+ const m = v.current.children[f];
5235
5240
  m == null || m.scrollIntoView({ block: "nearest" });
5236
5241
  }
5237
- }, [h]);
5238
- const _ = () => {
5242
+ }, [f]);
5243
+ const I = () => {
5239
5244
  g(""), b([]), y(-1), p(!1), n("");
5240
- }, I = (m) => {
5245
+ }, _ = (m) => {
5241
5246
  g(m), p(!isEmpty(m)), c(!0), A(m);
5242
5247
  };
5243
5248
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
@@ -5247,14 +5252,14 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5247
5252
  "input",
5248
5253
  {
5249
5254
  type: "text",
5250
- value: f,
5251
- onChange: (m) => I(m.target.value),
5252
- onKeyDown: v,
5255
+ value: h,
5256
+ onChange: (m) => _(m.target.value),
5257
+ onKeyDown: k,
5253
5258
  placeholder: a(`Search ${B}`),
5254
5259
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
5255
5260
  }
5256
5261
  ),
5257
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: f && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: _, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
5262
+ /* @__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: I, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
5258
5263
  ] }),
5259
5264
  (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: [
5260
5265
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
@@ -5262,13 +5267,13 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5262
5267
  ] }) : d && isEmpty(j) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
5263
5268
  a("No results found for"),
5264
5269
  ' "',
5265
- f,
5270
+ h,
5266
5271
  '"'
5267
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: S, children: map(j == null ? void 0 : j.slice(0, 20), (m, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5272
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: v, children: map(j == null ? void 0 : j.slice(0, 20), (m, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5268
5273
  "li",
5269
5274
  {
5270
- onClick: () => C(m),
5271
- className: `cursor-pointer p-2 text-xs ${o != null && o.includes(m.id) ? "bg-blue-200" : E === h ? "bg-gray-100" : "hover:bg-gray-100"}`,
5275
+ onClick: () => S(m),
5276
+ 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"}`,
5272
5277
  children: [
5273
5278
  m.name,
5274
5279
  " ",
@@ -5334,6 +5339,24 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5334
5339
  ] })
5335
5340
  ] })
5336
5341
  ] });
5342
+ }, RowColField = () => {
5343
+ const o = useSelectedBlock(), r = useWrapperBlock(), [n] = useBlocksStore(), { addCoreBlock: a } = useAddBlock();
5344
+ if (!o && !r)
5345
+ return null;
5346
+ const l = (o == null ? void 0 : o._type) === "Row" ? o : r, i = size(filter(n, { _parent: l == null ? void 0 : l._id }));
5347
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-x-2 pt-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
5348
+ "button",
5349
+ {
5350
+ type: "button",
5351
+ disabled: i > 11,
5352
+ className: `duratiom-300 flex items-center gap-x-1 rounded px-3 py-1 text-[11px] font-medium leading-tight ${i > 11 ? "cursor-not-allowed bg-gray-300 text-gray-500" : "border border-gray-400 bg-gray-100 hover:bg-slate-200"}`,
5353
+ onClick: () => a({ type: "Column", styles: "#styles:," }, l == null ? void 0 : l._id),
5354
+ children: [
5355
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Plus, { className: "h-4 w-4" }),
5356
+ " Add Column"
5357
+ ]
5358
+ }
5359
+ ) }) });
5337
5360
  }, CodeEditor = ({ id: o, placeholder: r }) => {
5338
5361
  const { t: n } = useTranslation(), [, a] = useCodeEditor(), l = useSelectedBlock();
5339
5362
  if (typeof window > "u")
@@ -5363,41 +5386,48 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5363
5386
  description: c,
5364
5387
  hidden: d,
5365
5388
  required: p,
5366
- schema: u
5389
+ schema: u,
5390
+ formData: x
5367
5391
  }) => {
5368
- const { selectedLang: x, fallbackLang: f, languages: g } = useLanguages(), j = isEmpty(g) ? "" : isEmpty(x) ? f : x, b = get(LANGUAGES, j, j), h = useSelectedBlock(), y = useRegisteredChaiBlocks(), S = get(y, [h == null ? void 0 : h._type, "i18nProps"], []) || [], [B, A] = useState(null);
5392
+ 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
5393
  if (d)
5370
5394
  return null;
5371
5395
  if (u.type === "boolean")
5372
5396
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: r, children: a });
5373
- const v = S == null ? void 0 : S.includes(o.replace("root.", ""));
5374
- return u.type === "array" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${r} relative`, children: [
5375
- u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs(
5376
- "label",
5377
- {
5378
- htmlFor: o,
5379
- onClick: () => A(B ? null : o),
5380
- className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
5381
- children: [
5382
- B ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3" }),
5383
- /* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-3 w-3" }),
5384
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "leading-tight", children: n })
5385
- ]
5386
- }
5387
- ),
5388
- B && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-2", children: [
5389
- c,
5390
- a,
5391
- l,
5392
- i
5393
- ] })
5394
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: r, children: [
5397
+ const I = B == null ? void 0 : B.includes(o.replace("root.", ""));
5398
+ if (u.type === "array") {
5399
+ const _ = A === o;
5400
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${r} relative`, children: [
5401
+ u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs(
5402
+ "label",
5403
+ {
5404
+ htmlFor: o,
5405
+ onClick: () => S(_ ? null : o),
5406
+ className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
5407
+ children: [
5408
+ _ ? /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3 w-3" }),
5409
+ /* @__PURE__ */ jsxRuntimeExports.jsx(List, { className: "h-3 w-3" }),
5410
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "leading-tight", children: n }),
5411
+ " ",
5412
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { className: "m-0 bg-gray-200 px-2 leading-tight text-gray-500 hover:bg-gray-200 hover:text-gray-500", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[9px] font-medium text-slate-600", children: x == null ? void 0 : x.length }) })
5413
+ ]
5414
+ }
5415
+ ),
5416
+ (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: [
5417
+ c,
5418
+ a,
5419
+ l,
5420
+ i
5421
+ ] })
5422
+ ] });
5423
+ }
5424
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: r, children: [
5395
5425
  u.title && /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: o, className: u.type === "object" ? "pb-2" : "", children: [
5396
5426
  n,
5397
5427
  " ",
5398
- v && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "text-[9px] text-zinc-400", children: [
5428
+ I && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "text-[9px] text-zinc-400", children: [
5399
5429
  " ",
5400
- b
5430
+ f
5401
5431
  ] }),
5402
5432
  p && u.type !== "object" ? " *" : null
5403
5433
  ] }),
@@ -5431,7 +5461,8 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5431
5461
  richtext: RichTextEditorField,
5432
5462
  icon: IconPickerField,
5433
5463
  image: ImagePickerField,
5434
- code: CodeEditor
5464
+ code: CodeEditor,
5465
+ colCount: RowColField
5435
5466
  },
5436
5467
  fields: {
5437
5468
  link: LinkField
@@ -5523,50 +5554,50 @@ const MediaManagerModal$1 = MediaManagerModal, ImagePickerField = ({ value: o, o
5523
5554
  return set(n, o, r), n;
5524
5555
  };
5525
5556
  function BlockSettings() {
5526
- 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(), f = getRegisteredChaiBlock(x == null ? void 0 : x._type), g = formDataWithSelectedLang(x, o, f), j = ({ formData: v }, _, I) => {
5527
- if (_ && (c == null ? void 0 : c._id) === r._id) {
5528
- const D = _.replace("root.", "");
5529
- a([r._id], { [D]: get(v, D) }, I);
5557
+ 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 }, I, _) => {
5558
+ if (I && (c == null ? void 0 : c._id) === r._id) {
5559
+ const P = I.replace("root.", "");
5560
+ a([r._id], { [P]: get(k, P) }, _);
5530
5561
  }
5531
5562
  }, b = useCallback(
5532
- debounce(({ formData: v }, _, I) => {
5533
- j({ formData: v }, _, I), d(v);
5563
+ debounce(({ formData: k }, I, _) => {
5564
+ j({ formData: k }, I, _), d(k);
5534
5565
  }, 1500),
5535
5566
  [r == null ? void 0 : r._id, o]
5536
- ), h = ({ formData: v }, _) => {
5537
- if (_) {
5538
- const I = _.replace("root.", "");
5567
+ ), f = ({ formData: k }, I) => {
5568
+ if (I) {
5569
+ const _ = I.replace("root.", "");
5539
5570
  n(
5540
5571
  [r._id],
5541
- convertDotNotationToObject(I, get(v, I.split(".")))
5542
- ), b({ formData: v }, _, { [I]: get(c, I) });
5572
+ convertDotNotationToObject(_, get(k, _.split(".")))
5573
+ ), b({ formData: k }, I, { [_]: get(c, _) });
5543
5574
  }
5544
- }, y = ({ formData: v }, _) => {
5545
- if (_) {
5546
- const I = _.replace("root.", "");
5575
+ }, y = ({ formData: k }, I) => {
5576
+ if (I) {
5577
+ const _ = I.replace("root.", "");
5547
5578
  n(
5548
5579
  [x._id],
5549
- convertDotNotationToObject(I, get(v, I.split(".")))
5550
- ), b({ formData: v }, _, { [I]: get(c, I) });
5580
+ convertDotNotationToObject(_, get(k, _.split(".")))
5581
+ ), b({ formData: k }, I, { [_]: get(c, _) });
5551
5582
  }
5552
5583
  };
5553
5584
  keys(get(i, "_bindings", {}));
5554
- const { schema: S, uiSchema: B } = useMemo(() => {
5555
- const v = r == null ? void 0 : r._type;
5556
- if (v)
5557
- return getBlockFormSchemas(v);
5558
- }, [r]), { wrapperSchema: A, wrapperUiSchema: C } = useMemo(() => {
5585
+ const { schema: v, uiSchema: B } = useMemo(() => {
5586
+ const k = r == null ? void 0 : r._type;
5587
+ if (k)
5588
+ return getBlockFormSchemas(k);
5589
+ }, [r]), { wrapperSchema: A, wrapperUiSchema: S } = useMemo(() => {
5559
5590
  if (!x || !(x != null && x._type))
5560
5591
  return { wrapperSchema: {}, wrapperUiSchema: {} };
5561
- const v = x == null ? void 0 : x._type, { schema: _ = {}, uiSchema: I = {} } = getBlockFormSchemas(v);
5562
- return { wrapperSchema: _, wrapperUiSchema: I };
5592
+ const k = x == null ? void 0 : x._type, { schema: I = {}, uiSchema: _ = {} } = getBlockFormSchemas(k);
5593
+ return { wrapperSchema: I, wrapperUiSchema: _ };
5563
5594
  }, [x]);
5564
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5595
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
5565
5596
  !isEmpty(x) && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
5566
5597
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
5567
5598
  "div",
5568
5599
  {
5569
- onClick: () => u((v) => !v),
5600
+ onClick: () => u((k) => !k),
5570
5601
  className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
5571
5602
  children: [
5572
5603
  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" }),
@@ -5588,17 +5619,17 @@ function BlockSettings() {
5588
5619
  onChange: y,
5589
5620
  formData: g,
5590
5621
  schema: A,
5591
- uiSchema: C
5622
+ uiSchema: S
5592
5623
  }
5593
5624
  )
5594
5625
  ] }),
5595
- isEmpty(S) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5626
+ isEmpty(v) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5596
5627
  JSONForm,
5597
5628
  {
5598
5629
  id: r == null ? void 0 : r._id,
5599
- onChange: h,
5630
+ onChange: f,
5600
5631
  formData: i,
5601
- schema: S,
5632
+ schema: v,
5602
5633
  uiSchema: B
5603
5634
  }
5604
5635
  ),
@@ -5676,7 +5707,7 @@ const AskAIStyles = ({ blockId: o }) => {
5676
5707
  var g;
5677
5708
  (g = d.current) == null || g.focus();
5678
5709
  }, []);
5679
- const f = (g) => {
5710
+ const h = (g) => {
5680
5711
  const { usage: j } = g || {};
5681
5712
  !l && j && x(j), p.current = setTimeout(() => x(void 0), 1e4), l || c("");
5682
5713
  };
@@ -5692,7 +5723,7 @@ const AskAIStyles = ({ blockId: o }) => {
5692
5723
  className: "no-scrollbar my-2 w-full border border-border p-2 text-xs",
5693
5724
  rows: 4,
5694
5725
  onKeyDown: (g) => {
5695
- g.key === "Enter" && (g.preventDefault(), p.current && clearTimeout(p.current), x(void 0), n("styles", o, i, f));
5726
+ g.key === "Enter" && (g.preventDefault(), p.current && clearTimeout(p.current), x(void 0), n("styles", o, i, h));
5696
5727
  }
5697
5728
  }
5698
5729
  ),
@@ -5702,7 +5733,7 @@ const AskAIStyles = ({ blockId: o }) => {
5702
5733
  {
5703
5734
  disabled: i.trim().length < 5 || a,
5704
5735
  onClick: () => {
5705
- p.current && clearTimeout(p.current), x(void 0), n("styles", o, i, f);
5736
+ p.current && clearTimeout(p.current), x(void 0), n("styles", o, i, h);
5706
5737
  },
5707
5738
  variant: "default",
5708
5739
  className: "w-fit",
@@ -5733,37 +5764,37 @@ const AskAIStyles = ({ blockId: o }) => {
5733
5764
  ] });
5734
5765
  };
5735
5766
  function ManualClasses() {
5736
- var _;
5737
- 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(), f = (_ = first(n)) == null ? void 0 : _.prop, g = reject((get(a, f, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), j = () => {
5738
- const I = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5739
- l(c, I, !0), u("");
5740
- }, [b, h] = useState([]), y = ({ value: I }) => {
5741
- const D = I.trim().toLowerCase(), m = D.match(/.+:/g);
5767
+ var I;
5768
+ 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 = (I = first(n)) == null ? void 0 : I.prop, g = reject((get(a, h, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), j = () => {
5769
+ const _ = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5770
+ l(c, _, !0), u("");
5771
+ }, [b, f] = useState([]), y = ({ value: _ }) => {
5772
+ const P = _.trim().toLowerCase(), m = P.match(/.+:/g);
5742
5773
  let E = [];
5743
5774
  if (m && m.length > 0) {
5744
- const [R] = m, w = D.replace(R, "");
5745
- E = o.search(w).map((k) => ({
5746
- ...k,
5747
- item: { ...k.item, name: R + k.item.name }
5775
+ const [R] = m, C = P.replace(R, "");
5776
+ E = o.search(C).map((T) => ({
5777
+ ...T,
5778
+ item: { ...T.item, name: R + T.item.name }
5748
5779
  }));
5749
5780
  } else
5750
- E = o.search(D);
5751
- return h(map(E, "item"));
5752
- }, S = () => {
5753
- h([]);
5754
- }, B = (I) => I.name, A = (I) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: I.name }), C = {
5781
+ E = o.search(P);
5782
+ return f(map(E, "item"));
5783
+ }, v = () => {
5784
+ f([]);
5785
+ }, B = (_) => _.name, A = (_) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: _.name }), S = {
5755
5786
  autoComplete: "off",
5756
5787
  autoCorrect: "off",
5757
5788
  autoCapitalize: "off",
5758
5789
  spellCheck: !1,
5759
5790
  placeholder: r("Enter classes separated by space"),
5760
5791
  value: p,
5761
- onKeyDown: (I) => {
5762
- I.key === "Enter" && p.trim() !== "" && j();
5792
+ onKeyDown: (_) => {
5793
+ _.key === "Enter" && p.trim() !== "" && j();
5763
5794
  },
5764
- onChange: (I, { newValue: D }) => u(D),
5795
+ onChange: (_, { newValue: P }) => u(P),
5765
5796
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5766
- }, v = () => {
5797
+ }, k = () => {
5767
5798
  if (navigator.clipboard === void 0) {
5768
5799
  x({
5769
5800
  title: r("Clipboard not supported"),
@@ -5786,7 +5817,7 @@ function ManualClasses() {
5786
5817
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5787
5818
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: r("Classes") }),
5788
5819
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5789
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: v, className: "cursor-pointer" }) }),
5820
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: k, className: "cursor-pointer" }) }),
5790
5821
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: r("Copy classes to clipboard") }) })
5791
5822
  ] })
5792
5823
  ] }),
@@ -5804,10 +5835,10 @@ function ManualClasses() {
5804
5835
  {
5805
5836
  suggestions: b,
5806
5837
  onSuggestionsFetchRequested: y,
5807
- onSuggestionsClearRequested: S,
5838
+ onSuggestionsClearRequested: v,
5808
5839
  getSuggestionValue: B,
5809
5840
  renderSuggestion: A,
5810
- inputProps: C,
5841
+ inputProps: S,
5811
5842
  containerProps: {
5812
5843
  className: "relative h-8 w-full gap-y-1 py-1 border-border text-xs"
5813
5844
  },
@@ -5831,22 +5862,22 @@ function ManualClasses() {
5831
5862
  )
5832
5863
  ] }),
5833
5864
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5834
- g.map((I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5865
+ g.map((_) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5835
5866
  "div",
5836
5867
  {
5837
5868
  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",
5838
5869
  children: [
5839
- I,
5870
+ _,
5840
5871
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5841
5872
  Cross2Icon,
5842
5873
  {
5843
- onClick: () => i(c, [I]),
5874
+ onClick: () => i(c, [_]),
5844
5875
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
5845
5876
  }
5846
5877
  )
5847
5878
  ]
5848
5879
  },
5849
- I
5880
+ _
5850
5881
  ))
5851
5882
  ) })
5852
5883
  ]
@@ -6237,10 +6268,10 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6237
6268
  ringColor: "ring",
6238
6269
  ringOffsetColor: "ring-offset"
6239
6270
  }, ColorChoice = ({ property: o, onChange: r }) => {
6240
- 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", ""), f = get(u, "2", ""), g = useCallback(
6271
+ 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(
6241
6272
  // eslint-disable-next-line no-shadow
6242
- (h) => {
6243
- ["current", "inherit", "transparent", "black", "white"].includes(h) ? (c([]), p({ color: h })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((y) => ({ ...y, color: h, shade: y.shade ? y.shade : "500" })));
6273
+ (f) => {
6274
+ ["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" })));
6244
6275
  },
6245
6276
  [c, p]
6246
6277
  );
@@ -6251,8 +6282,8 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6251
6282
  }, [x]);
6252
6283
  const j = useCallback(
6253
6284
  // eslint-disable-next-line no-shadow
6254
- (h) => {
6255
- p({ color: x, shade: h });
6285
+ (f) => {
6286
+ p({ color: x, shade: f });
6256
6287
  },
6257
6288
  [x]
6258
6289
  );
@@ -6303,7 +6334,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6303
6334
  ]
6304
6335
  }
6305
6336
  ) }),
6306
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: f, disabled: !x || !l, onChange: j, options: i }) })
6337
+ /* @__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 }) })
6307
6338
  ] });
6308
6339
  }, getUserInputValues = (o, r) => {
6309
6340
  o = o.toLowerCase();
@@ -6498,7 +6529,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6498
6529
  },
6499
6530
  a
6500
6531
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6501
- const [r, n] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [f, g] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [j, b] = useState(!1), [h, y] = useState(""), [S, B] = useState(!1), [A, C] = useState(!1);
6532
+ 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);
6502
6533
  useEffect(() => {
6503
6534
  const { value: m, unit: E } = getClassValueAndUnit(i);
6504
6535
  if (E === "") {
@@ -6507,25 +6538,25 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6507
6538
  }
6508
6539
  g(E), l(E === "class" || isEmpty(m) ? "" : m);
6509
6540
  }, [i, p, u]);
6510
- const v = useThrottledCallback((m) => c(m), [c], THROTTLE_TIME), _ = useThrottledCallback((m) => c(m, !1), [c], THROTTLE_TIME), I = useCallback(
6541
+ const k = useThrottledCallback((m) => c(m), [c], THROTTLE_TIME), I = useThrottledCallback((m) => c(m, !1), [c], THROTTLE_TIME), _ = useCallback(
6511
6542
  (m = !1) => {
6512
6543
  const E = getUserInputValues(`${a}`, u);
6513
6544
  if (get(E, "error", !1)) {
6514
6545
  b(!0);
6515
6546
  return;
6516
6547
  }
6517
- const R = get(E, "unit") !== "" ? get(E, "unit") : f;
6548
+ const R = get(E, "unit") !== "" ? get(E, "unit") : h;
6518
6549
  if (R === "auto" || R === "none") {
6519
- v(`${d}${R}`);
6550
+ k(`${d}${R}`);
6520
6551
  return;
6521
6552
  }
6522
6553
  if (get(E, "value") === "")
6523
6554
  return;
6524
- const T = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6525
- m ? _(T) : v(T);
6555
+ const N = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6556
+ m ? I(N) : k(N);
6526
6557
  },
6527
- [v, _, a, f, d, u]
6528
- ), D = useCallback(
6558
+ [k, I, a, h, d, u]
6559
+ ), P = useCallback(
6529
6560
  (m) => {
6530
6561
  const E = getUserInputValues(`${a}`, u);
6531
6562
  if (get(E, "error", !1)) {
@@ -6533,45 +6564,52 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6533
6564
  return;
6534
6565
  }
6535
6566
  if (m === "auto" || m === "none") {
6536
- v(`${d}${m}`);
6567
+ k(`${d}${m}`);
6537
6568
  return;
6538
6569
  }
6539
6570
  if (get(E, "value") === "")
6540
6571
  return;
6541
- const R = get(E, "unit") !== "" ? get(E, "unit") : m, T = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6542
- v(T);
6572
+ const R = get(E, "unit") !== "" ? get(E, "unit") : m, N = `${get(E, "value", "").startsWith("-") ? "-" : ""}${d}[${get(E, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6573
+ k(N);
6543
6574
  },
6544
- [v, a, d, u]
6575
+ [k, a, d, u]
6545
6576
  );
6546
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: f === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6547
- /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
6577
+ 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: [
6578
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
6579
+ "input",
6580
+ {
6581
+ className: "h-6 w-24 rounded border border-foreground/20 bg-background px-2 py-0.5 text-sm focus-visible:outline-0",
6582
+ readOnly: !0,
6583
+ value: i
6584
+ }
6585
+ ),
6548
6586
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6549
6587
  /* @__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, {}) }) }),
6550
6588
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6551
6589
  ] })
6552
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${S ? "z-auto" : ""}`, children: [
6590
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
6553
6591
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6554
- ["none", "auto"].indexOf(f) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6592
+ ["none", "auto"].indexOf(h) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6555
6593
  "input",
6556
6594
  {
6557
- readOnly: f === "class",
6595
+ readOnly: h === "class",
6558
6596
  onKeyPress: (m) => {
6559
- m.key === "Enter" && I();
6597
+ m.key === "Enter" && _();
6560
6598
  },
6561
6599
  onKeyDown: (m) => {
6562
6600
  if (m.keyCode !== 38 && m.keyCode !== 40)
6563
6601
  return;
6564
- m.preventDefault(), C(!0);
6602
+ m.preventDefault(), S(!0);
6565
6603
  const E = parseInt$1(m.target.value);
6566
6604
  let R = isNaN$1(E) ? 0 : E;
6567
6605
  m.keyCode === 38 && (R += 1), m.keyCode === 40 && (R -= 1);
6568
- const w = `${R}`, k = `${w.startsWith("-") ? "-" : ""}${d}[${w.replace("-", "")}${f === "-" ? "" : f}]`;
6569
- _(k);
6606
+ const C = `${R}`, T = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${h === "-" ? "" : h}]`;
6607
+ I(T);
6570
6608
  },
6571
6609
  onKeyUp: (m) => {
6572
- A && (m.preventDefault(), C(!1));
6610
+ A && (m.preventDefault(), S(!1));
6573
6611
  },
6574
- onBlur: () => I(),
6612
+ onBlur: () => _(),
6575
6613
  onChange: (m) => {
6576
6614
  b(!1), l(m.target.value);
6577
6615
  },
@@ -6579,7 +6617,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6579
6617
  var E;
6580
6618
  (E = m == null ? void 0 : m.target) == null || E.select(), n(!1);
6581
6619
  },
6582
- value: S ? h : a,
6620
+ value: v ? f : a,
6583
6621
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6584
6622
  " ",
6585
6623
  j ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -6594,7 +6632,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6594
6632
  onClick: () => n(!r),
6595
6633
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
6596
6634
  children: [
6597
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: f }),
6635
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: h }),
6598
6636
  u.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6599
6637
  ]
6600
6638
  }
@@ -6603,33 +6641,33 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6603
6641
  UnitSelection,
6604
6642
  {
6605
6643
  units: u,
6606
- current: f,
6644
+ current: h,
6607
6645
  onSelect: (m) => {
6608
- n(!1), g(m), D(m);
6646
+ n(!1), g(m), P(m);
6609
6647
  }
6610
6648
  }
6611
6649
  ) }) })
6612
6650
  ] })
6613
6651
  ] }),
6614
- ["none", "auto"].indexOf(f) !== -1 || S ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6652
+ ["none", "auto"].indexOf(h) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6615
6653
  DragStyleButton,
6616
6654
  {
6617
6655
  onDragStart: () => B(!0),
6618
6656
  onDragEnd: (m) => {
6619
6657
  if (y(() => ""), B(!1), isEmpty(m))
6620
6658
  return;
6621
- const E = `${m}`, w = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${f === "-" ? "" : f}]`;
6622
- v(w);
6659
+ const E = `${m}`, C = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${h === "-" ? "" : h}]`;
6660
+ k(C);
6623
6661
  },
6624
6662
  onDrag: (m) => {
6625
6663
  if (isEmpty(m))
6626
6664
  return;
6627
6665
  y(m);
6628
- const E = `${m}`, w = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${f === "-" ? "" : f}]`;
6629
- _(w);
6666
+ const E = `${m}`, C = `${E.startsWith("-") ? "-" : ""}${d}[${E.replace("-", "")}${h === "-" ? "" : h}]`;
6667
+ I(C);
6630
6668
  },
6631
6669
  currentValue: a,
6632
- unit: f,
6670
+ unit: h,
6633
6671
  negative: x,
6634
6672
  cssProperty: p
6635
6673
  }
@@ -6723,22 +6761,22 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6723
6761
  "2xl": "1536px"
6724
6762
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6725
6763
  const { t: r } = useTranslation(), { type: n = "icons", label: a, property: l, onEmitChange: i = () => {
6726
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(), f = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), h = useMemo(() => get(f, "fullCls", ""), [f]), y = useCallback(
6727
- (_, I = !0) => {
6728
- const D = { dark: p, mq: x, mod: u, cls: _, property: l, fullCls: "" };
6729
- (p || u !== "") && (D.mq = "xs");
6730
- const m = generateFullClsName(D);
6731
- g(b, [m], I);
6764
+ }, 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(
6765
+ (I, _ = !0) => {
6766
+ const P = { dark: p, mq: x, mod: u, cls: I, property: l, fullCls: "" };
6767
+ (p || u !== "") && (P.mq = "xs");
6768
+ const m = generateFullClsName(P);
6769
+ g(b, [m], _);
6732
6770
  },
6733
6771
  [b, p, x, u, l, g]
6734
- ), S = useCallback(() => {
6735
- j(b, [h]);
6736
- }, [b, h, j]), B = useMemo(() => canChangeClass(f, x), [f, x]);
6772
+ ), v = useCallback(() => {
6773
+ j(b, [f]);
6774
+ }, [b, f, j]), B = useMemo(() => canChangeClass(h, x), [h, x]);
6737
6775
  useEffect(() => {
6738
- i(B, f);
6739
- }, [B, i, f]);
6740
- const [, , A] = useCanvasWidth(), C = useCallback(
6741
- (_) => {
6776
+ i(B, h);
6777
+ }, [B, i, h]);
6778
+ const [, , A] = useCanvasWidth(), S = useCallback(
6779
+ (I) => {
6742
6780
  A({
6743
6781
  xs: 400,
6744
6782
  sm: 640,
@@ -6746,18 +6784,18 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6746
6784
  lg: 1024,
6747
6785
  xl: 1420,
6748
6786
  "2xl": 1920
6749
- }[_]);
6787
+ }[I]);
6750
6788
  },
6751
6789
  [A]
6752
- ), v = get(f, "dark", null) === p && get(f, "mod", null) === u && get(f, "mq", null) === x;
6753
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: B, canReset: f && v, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6754
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${f && !v ? "text-foreground" : ""}`, children: r(a) }) }),
6790
+ ), k = get(h, "dark", null) === p && get(h, "mod", null) === u && get(h, "mq", null) === x;
6791
+ 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: [
6792
+ /* @__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) }) }),
6755
6793
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6756
6794
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6757
6795
  n === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
6758
6796
  AdvanceChoices,
6759
6797
  {
6760
- currentClass: get(f, "cls", ""),
6798
+ currentClass: get(h, "cls", ""),
6761
6799
  classPrefix: get(CLASS_PREFIXES, l, ""),
6762
6800
  units: c || [],
6763
6801
  onChange: y,
@@ -6770,7 +6808,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6770
6808
  n === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: y }),
6771
6809
  n === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: y })
6772
6810
  ] }),
6773
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${h ? "visible" : "invisible"}`, children: v ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => S(), 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 && f ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6811
+ /* @__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: [
6774
6812
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6775
6813
  "button",
6776
6814
  {
@@ -6782,19 +6820,19 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6782
6820
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
6783
6821
  "Current style is set at  ",
6784
6822
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
6785
- getBreakpoint(get(f, "mq")),
6786
- p && !f.dark ? "(Light mode)" : ""
6823
+ getBreakpoint(get(h, "mq")),
6824
+ p && !h.dark ? "(Light mode)" : ""
6787
6825
  ] }),
6788
6826
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
6789
6827
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
6790
6828
  "button",
6791
6829
  {
6792
6830
  type: "button",
6793
- onClick: () => C(get(f, "mq")),
6831
+ onClick: () => S(get(h, "mq")),
6794
6832
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6795
6833
  children: [
6796
6834
  "Switch to ",
6797
- get(f, "mq").toUpperCase()
6835
+ get(h, "mq").toUpperCase()
6798
6836
  ]
6799
6837
  }
6800
6838
  )
@@ -6811,7 +6849,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6811
6849
  units: i = basicUnits,
6812
6850
  negative: c = !1
6813
6851
  }) => {
6814
- const { t: d } = useTranslation(), [p, u] = useState(r[0].key), x = useSelectedBlockCurrentClasses(), f = useCallback((g) => map(x, "property").includes(g), [x]);
6852
+ const { t: d } = useTranslation(), [p, u] = useState(r[0].key), x = useSelectedBlockCurrentClasses(), h = useCallback((g) => map(x, "property").includes(g), [x]);
6815
6853
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6816
6854
  "div",
6817
6855
  {
@@ -6829,7 +6867,7 @@ const RangeChoices = ({ property: o, onChange: r }) => {
6829
6867
  className: `relative cursor-pointer rounded-full p-1 text-[8px] ${j === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6830
6868
  children: [
6831
6869
  React__default.createElement("div", {
6832
- className: f(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6870
+ className: h(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6833
6871
  }),
6834
6872
  React__default.createElement(get(EDITOR_ICONS, j, BoxIcon), { className: "text-inherit w-3 h-3" })
6835
6873
  ]
@@ -6976,13 +7014,13 @@ function BlockStyling() {
6976
7014
  cssProperty: ""
6977
7015
  }), d = useThrottledCallback(
6978
7016
  (u) => {
6979
- const x = !get(i, "negative", !1), f = get(i, "cssProperty", "");
7017
+ const x = !get(i, "negative", !1), h = get(i, "cssProperty", "");
6980
7018
  let g = parseFloat(i.dragStartValue);
6981
7019
  g = isNaN(g) ? 0 : g;
6982
7020
  let j = MAPPER[i.dragUnit];
6983
- (startsWith(f, "scale") || f === "opacity") && (j = 10);
6984
- let h = (i.dragStartY - u.pageY) / j + g;
6985
- x && h < 0 && (h = 0), f === "opacity" && h > 1 && (h = 1), i.onDrag(`${h}`), l(`${h}`);
7021
+ (startsWith(h, "scale") || h === "opacity") && (j = 10);
7022
+ let f = (i.dragStartY - u.pageY) / j + g;
7023
+ x && f < 0 && (f = 0), h === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
6986
7024
  },
6987
7025
  [i],
6988
7026
  50
@@ -7070,12 +7108,12 @@ const BlockCard = ({
7070
7108
  parentId: n = void 0,
7071
7109
  position: a = -1
7072
7110
  }) => {
7073
- const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(), f = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, j] = useAtom$1(draggedBlockAtom), b = (S) => {
7074
- const B = has(S, "styles_attrs.data-page-section");
7075
- return S._type === "Box" && B;
7076
- }, h = useCallback(
7077
- async (S) => {
7078
- if (S.stopPropagation(), has(o, "component")) {
7111
+ 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) => {
7112
+ const B = has(v, "styles_attrs.data-page-section");
7113
+ return v._type === "Box" && B;
7114
+ }, f = useCallback(
7115
+ async (v) => {
7116
+ if (v.stopPropagation(), has(o, "component")) {
7079
7117
  d(o, n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7080
7118
  return;
7081
7119
  }
@@ -7084,19 +7122,19 @@ const BlockCard = ({
7084
7122
  isEmpty(B) || p(syncBlocksWithDefaults(B), n, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7085
7123
  },
7086
7124
  [d, p, o, c, r, n, a]
7087
- ), y = async (S) => {
7125
+ ), y = async (v) => {
7088
7126
  const B = await c(r, o);
7089
7127
  let A = n;
7090
7128
  if (b(first(B)) && (A = null), !isEmpty(B)) {
7091
- const C = { blocks: B, uiLibrary: !0, parent: A };
7092
- if (S.dataTransfer.setData("text/plain", JSON.stringify(C)), o.preview) {
7093
- const v = new Image();
7094
- v.src = o.preview, v.onload = () => {
7095
- S.dataTransfer.setDragImage(v, 0, 0);
7129
+ const S = { blocks: B, uiLibrary: !0, parent: A };
7130
+ if (v.dataTransfer.setData("text/plain", JSON.stringify(S)), o.preview) {
7131
+ const k = new Image();
7132
+ k.src = o.preview, k.onload = () => {
7133
+ v.dataTransfer.setDragImage(k, 0, 0);
7096
7134
  };
7097
7135
  } else
7098
- S.dataTransfer.setDragImage(new Image(), 0, 0);
7099
- j(C), setTimeout(() => {
7136
+ v.dataTransfer.setDragImage(new Image(), 0, 0);
7137
+ j(S), setTimeout(() => {
7100
7138
  u([]), x(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7101
7139
  }, 200);
7102
7140
  }
@@ -7106,7 +7144,7 @@ const BlockCard = ({
7106
7144
  "div",
7107
7145
  {
7108
7146
  onClick: l ? () => {
7109
- } : h,
7147
+ } : f,
7110
7148
  draggable: g ? "true" : "false",
7111
7149
  onDragStart: y,
7112
7150
  className: clsx(
@@ -7117,11 +7155,11 @@ const BlockCard = ({
7117
7155
  /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
7118
7156
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
7119
7157
  ] }),
7120
- o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: f }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: f }) })
7158
+ o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: h }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: h }) })
7121
7159
  ]
7122
7160
  }
7123
7161
  ) }),
7124
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: f }) })
7162
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: h }) })
7125
7163
  ] });
7126
7164
  }, libraryBlocksAtom = atom$1(
7127
7165
  {}
@@ -7137,7 +7175,7 @@ const BlockCard = ({
7137
7175
  })();
7138
7176
  }, [o, l, i, c, n, a]), { data: l || [], isLoading: i === "loading" };
7139
7177
  }, UILibrarySection = ({ parentId: o, position: r }) => {
7140
- 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"), [f, g] = useState("Hero"), j = get(x, f, []), b = useRef(null), { t: h } = useTranslation(), y = (A) => {
7178
+ 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) => {
7141
7179
  b.current && (clearTimeout(b.current), b.current = null), b.current = setTimeout(() => {
7142
7180
  b.current && g(A);
7143
7181
  }, 300);
@@ -7147,30 +7185,30 @@ const BlockCard = ({
7147
7185
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7148
7186
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7149
7187
  ] });
7150
- const S = filter(j, (A, C) => C % 2 === 0), B = filter(j, (A, C) => C % 2 === 1);
7188
+ const v = filter(j, (A, S) => S % 2 === 0), B = filter(j, (A, S) => S % 2 === 1);
7151
7189
  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: [
7152
7190
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7153
7191
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: d == null ? void 0 : d.uuid, setLibrary: a, uiLibraries: l }),
7154
7192
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
7155
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: h("Groups") }),
7193
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: f("Groups") }),
7156
7194
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7157
7195
  /* @__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(
7158
- map(x, (A, C) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7196
+ map(x, (A, S) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7159
7197
  "div",
7160
7198
  {
7161
- onMouseEnter: () => y(C),
7199
+ onMouseEnter: () => y(S),
7162
7200
  onMouseLeave: () => clearTimeout(b.current),
7163
- onClick: () => g(C),
7201
+ onClick: () => g(S),
7164
7202
  className: cn(
7165
7203
  "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",
7166
- C === f ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7204
+ S === h ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7167
7205
  ),
7168
7206
  children: [
7169
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(h(C.toLowerCase())) }),
7207
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(f(S.toLowerCase())) }),
7170
7208
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7171
7209
  ]
7172
7210
  },
7173
- C
7211
+ S
7174
7212
  ))
7175
7213
  ) })
7176
7214
  ] })
@@ -7183,7 +7221,7 @@ const BlockCard = ({
7183
7221
  children: [
7184
7222
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7185
7223
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7186
- S.map((A) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: r, block: A, library: d }))
7224
+ v.map((A) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: r, block: A, library: d }))
7187
7225
  ) }),
7188
7226
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7189
7227
  B.map((A) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, position: r, block: A, library: d }))
@@ -7695,10 +7733,10 @@ const CoreBlock = ({
7695
7733
  parentId: n,
7696
7734
  position: a
7697
7735
  }) => {
7698
- const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, x] = useSelectedBlockIds(), { clearHighlight: f } = useBlockHighlight(), g = () => {
7736
+ const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, x] = useSelectedBlockIds(), { clearHighlight: h } = useBlockHighlight(), g = () => {
7699
7737
  if (has(o, "blocks")) {
7700
- const h = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7701
- u(syncBlocksWithDefaults(h), n || null, a);
7738
+ const f = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7739
+ u(syncBlocksWithDefaults(f), n || null, a);
7702
7740
  } else
7703
7741
  p(o, n || null, a);
7704
7742
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
@@ -7710,9 +7748,9 @@ const CoreBlock = ({
7710
7748
  disabled: r,
7711
7749
  onClick: g,
7712
7750
  type: "button",
7713
- onDragStart: (h) => {
7714
- h.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), h.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
7715
- x([]), f();
7751
+ onDragStart: (f) => {
7752
+ f.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), f.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
7753
+ x([]), h();
7716
7754
  }, 200);
7717
7755
  },
7718
7756
  draggable: j ? "true" : "false",
@@ -7769,7 +7807,9 @@ const CoreBlock = ({
7769
7807
  parentId: n = void 0,
7770
7808
  position: a = -1
7771
7809
  }) => {
7772
- const { t: l } = useTranslation(), [i, c] = useAtom$1(addBlockTabAtom), [, d] = useAtom$1(showPredefinedBlockCategoryAtom), p = useBuilderProp("importHTMLSupport", !0), u = useBuilderProp("addBlocksDialogTabs", []);
7810
+ const { t: l } = useTranslation(), [i, c] = useAtom$1(addBlockTabAtom), [, d] = useAtom$1(showPredefinedBlockCategoryAtom), p = useBuilderProp("importHTMLSupport", !0), u = useBuilderProp("addBlocksDialogTabs", []), x = useCallback(() => {
7811
+ pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7812
+ }, []);
7773
7813
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full flex-col overflow-hidden", o), children: [
7774
7814
  r ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1", children: [
7775
7815
  /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col", children: l("Add block") }),
@@ -7778,8 +7818,8 @@ const CoreBlock = ({
7778
7818
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7779
7819
  Tabs,
7780
7820
  {
7781
- onValueChange: (x) => {
7782
- d(""), c(x);
7821
+ onValueChange: (h) => {
7822
+ d(""), c(h);
7783
7823
  },
7784
7824
  value: i,
7785
7825
  className: "flex h-full max-h-full flex-col overflow-hidden",
@@ -7788,12 +7828,12 @@ const CoreBlock = ({
7788
7828
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "library", children: l("Library") }),
7789
7829
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "core", children: l("Blocks") }),
7790
7830
  p ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "html", children: l("Import") }) : null,
7791
- map(u, (x) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: x.key, children: React__default.createElement(x.tab) }))
7831
+ map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: h.key, children: React__default.createElement(h.tab) }))
7792
7832
  ] }),
7793
7833
  /* @__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 }) }) }) }),
7794
7834
  /* @__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 }) }),
7795
7835
  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,
7796
- map(u, (x) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: x.key, children: React__default.createElement(x.tabContent) }))
7836
+ map(u, (h) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: h.key, children: React__default.createElement(h.tabContent, { close: x }) }))
7797
7837
  ]
7798
7838
  }
7799
7839
  )
@@ -7908,14 +7948,14 @@ function QuickPrompts({ onClick: o }) {
7908
7948
  ) }) });
7909
7949
  }
7910
7950
  const AIUserPrompt = ({ blockId: o }) => {
7911
- const { t: r } = useTranslation(), { askAi: n, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, x] = useState(), f = useRef(null), g = useRef(null);
7951
+ 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);
7912
7952
  useEffect(() => {
7913
7953
  var b;
7914
- (b = f.current) == null || b.focus();
7954
+ (b = h.current) == null || b.focus();
7915
7955
  }, []);
7916
7956
  const j = (b) => {
7917
- const { usage: h } = b || {};
7918
- !l && h && x(h), g.current = setTimeout(() => x(void 0), 1e4), l || c("");
7957
+ const { usage: f } = b || {};
7958
+ !l && f && x(f), g.current = setTimeout(() => x(void 0), 1e4), l || c("");
7919
7959
  };
7920
7960
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
7921
7961
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -7933,7 +7973,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7933
7973
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7934
7974
  Textarea,
7935
7975
  {
7936
- ref: f,
7976
+ ref: h,
7937
7977
  value: i,
7938
7978
  onChange: (b) => c(b.target.value),
7939
7979
  placeholder: r("Ask AI to edit content"),
@@ -7993,13 +8033,13 @@ const AIUserPrompt = ({ blockId: o }) => {
7993
8033
  ] }) }) : null
7994
8034
  ] });
7995
8035
  }, AISetContext = () => {
7996
- 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: f } = useToast(), g = useRef(null);
8036
+ 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);
7997
8037
  useEffect(() => {
7998
8038
  r && a(r);
7999
8039
  }, [r]);
8000
8040
  const j = async () => {
8001
8041
  try {
8002
- d(!0), u(null), await i(n), f({
8042
+ d(!0), u(null), await i(n), h({
8003
8043
  title: o("Updated AI Context"),
8004
8044
  description: o("You can now Ask AI to edit your content"),
8005
8045
  variant: "default"
@@ -8093,42 +8133,42 @@ const AIUserPrompt = ({ blockId: o }) => {
8093
8133
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
8094
8134
  ] });
8095
8135
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: r = [], onAttributesChange: n }) {
8096
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, x] = useState(null), [f, g] = useState(""), j = useRef(null), b = useRef(null);
8136
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, x] = useState(null), [h, g] = useState(""), j = useRef(null), b = useRef(null);
8097
8137
  useEffect(() => {
8098
8138
  l(r);
8099
8139
  }, [r]);
8100
- const h = () => {
8140
+ const f = () => {
8101
8141
  if (i.startsWith("@")) {
8102
8142
  g("Attribute keys cannot start with '@'");
8103
8143
  return;
8104
8144
  }
8105
8145
  if (i) {
8106
- const C = [...a, { key: i, value: d }];
8107
- n(C), l(a), c(""), p(""), g("");
8146
+ const S = [...a, { key: i, value: d }];
8147
+ n(S), l(a), c(""), p(""), g("");
8108
8148
  }
8109
- }, y = (C) => {
8110
- const v = a.filter((_, I) => I !== C);
8111
- n(v), l(v);
8112
- }, S = (C) => {
8113
- x(C), c(a[C].key), p(a[C].value);
8149
+ }, y = (S) => {
8150
+ const k = a.filter((I, _) => _ !== S);
8151
+ n(k), l(k);
8152
+ }, v = (S) => {
8153
+ x(S), c(a[S].key), p(a[S].value);
8114
8154
  }, B = () => {
8115
8155
  if (i.startsWith("@")) {
8116
8156
  g("Attribute keys cannot start with '@'");
8117
8157
  return;
8118
8158
  }
8119
8159
  if (u !== null && i) {
8120
- const C = [...a];
8121
- C[u] = { key: i, value: d }, n(C), l(C), x(null), c(""), p(""), g("");
8160
+ const S = [...a];
8161
+ S[u] = { key: i, value: d }, n(S), l(S), x(null), c(""), p(""), g("");
8122
8162
  }
8123
- }, A = (C) => {
8124
- C.key === "Enter" && !C.shiftKey && (C.preventDefault(), u !== null ? B() : h());
8163
+ }, A = (S) => {
8164
+ S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? B() : f());
8125
8165
  };
8126
8166
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
8127
8167
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8128
8168
  "form",
8129
8169
  {
8130
- onSubmit: (C) => {
8131
- C.preventDefault(), u !== null ? B() : h();
8170
+ onSubmit: (S) => {
8171
+ S.preventDefault(), u !== null ? B() : f();
8132
8172
  },
8133
8173
  className: "space-y-3",
8134
8174
  children: [
@@ -8144,7 +8184,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8144
8184
  id: "attrKey",
8145
8185
  ref: j,
8146
8186
  value: i,
8147
- onChange: (C) => c(C.target.value),
8187
+ onChange: (S) => c(S.target.value),
8148
8188
  placeholder: "Enter Key",
8149
8189
  className: "py-0 text-xs font-normal leading-tight placeholder:text-slate-400"
8150
8190
  }
@@ -8162,7 +8202,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8162
8202
  rows: 2,
8163
8203
  ref: b,
8164
8204
  value: d,
8165
- onChange: (C) => p(C.target.value),
8205
+ onChange: (S) => p(S.target.value),
8166
8206
  onKeyDown: A,
8167
8207
  placeholder: "Enter Value",
8168
8208
  className: "text-xs font-normal leading-tight placeholder:text-slate-400"
@@ -8171,20 +8211,20 @@ const AIUserPrompt = ({ blockId: o }) => {
8171
8211
  ] })
8172
8212
  ] }),
8173
8213
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", disabled: !i.length, variant: "default", size: "sm", className: "h-8 w-24 text-xs", children: u !== null ? "Save" : "Add" }) }),
8174
- f && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: f })
8214
+ h && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: h })
8175
8215
  ]
8176
8216
  }
8177
8217
  ),
8178
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1 py-4", children: a.map((C, v) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
8218
+ /* @__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: [
8179
8219
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
8180
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: C.key }),
8181
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] font-normal", children: C.value.toString() })
8220
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: S.key }),
8221
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] font-normal", children: S.value.toString() })
8182
8222
  ] }),
8183
8223
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
8184
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(v), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }) }),
8185
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => y(v), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }) })
8224
+ /* @__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" }) }),
8225
+ /* @__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" }) })
8186
8226
  ] })
8187
- ] }, v)) })
8227
+ ] }, k)) })
8188
8228
  ] });
8189
8229
  }), BlockAttributesEditor = React.memo(() => {
8190
8230
  const o = useSelectedBlock(), [r, n] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -8554,7 +8594,7 @@ const ChooseLayout = ({ open: o, close: r }) => {
8554
8594
  )
8555
8595
  ] }) })
8556
8596
  ] }) });
8557
- }, TopBar = lazy(() => import("./Topbar-XOJDIb13.js")), ThemeConfigPanel = lazy(() => Promise.resolve().then(() => ThemeConfigPanel$3));
8597
+ }, TopBar = lazy(() => import("./Topbar-JSWVqeRj.js")), ThemeConfigPanel = lazy(() => Promise.resolve().then(() => ThemeConfigPanel$3));
8558
8598
  function useSidebarMenuItems() {
8559
8599
  return useMemo(() => compact([
8560
8600
  {
@@ -8573,7 +8613,7 @@ const RootLayout = () => {
8573
8613
  j.preventDefault();
8574
8614
  }, p = (j) => {
8575
8615
  r(o === j ? null : j);
8576
- }, u = useSidebarMenuItems(), { t: x } = useTranslation(), f = [...u, ...c], g = useBuilderProp("htmlDir", "ltr");
8616
+ }, u = useSidebarMenuItems(), { t: x } = useTranslation(), h = [...u, ...c], g = useBuilderProp("htmlDir", "ltr");
8577
8617
  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: [
8578
8618
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8579
8619
  "div",
@@ -8584,7 +8624,7 @@ const RootLayout = () => {
8584
8624
  /* @__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, {}) }) }),
8585
8625
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8586
8626
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
8587
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: f.map((j, b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8627
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: h.map((j, b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8588
8628
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8589
8629
  Button,
8590
8630
  {
@@ -8608,10 +8648,10 @@ const RootLayout = () => {
8608
8648
  transition: { duration: 0.3, ease: "easeInOut" },
8609
8649
  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: [
8610
8650
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8611
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(f, `${o}.icon`, null) }),
8612
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: x(f[o].label) })
8651
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(h, `${o}.icon`, null) }),
8652
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: x(h[o].label) })
8613
8653
  ] }),
8614
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(f, `${o}.component`, null), {}) }) })
8654
+ /* @__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), {}) }) })
8615
8655
  ] }) })
8616
8656
  }
8617
8657
  ),
@@ -8750,9 +8790,9 @@ export {
8750
8790
  generateUUID as generateBlockId,
8751
8791
  getBlocksFromHTML,
8752
8792
  getClassValueAndUnit,
8753
- Je as i18n,
8793
+ Qe as i18n,
8754
8794
  cn as mergeClasses,
8755
- qe as registerChaiBlock,
8795
+ Ze as registerChaiBlock,
8756
8796
  useAddBlock,
8757
8797
  useAddClassesToBlocks,
8758
8798
  useAskAi,
@@ -8794,7 +8834,7 @@ export {
8794
8834
  useStylingState,
8795
8835
  useTheme,
8796
8836
  useThemeOptions,
8797
- Ke as useTranslation,
8837
+ Xe as useTranslation,
8798
8838
  useUILibraryBlocks,
8799
8839
  useUndoManager,
8800
8840
  useUpdateBlocksProps,