@chaibuilder/sdk 1.2.111 → 1.2.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  var z = Object.defineProperty;
2
- var W = (o, n, r) => n in o ? z(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
3
- var F = (o, n, r) => (W(o, typeof n != "symbol" ? n + "" : n, r), r);
2
+ var G = (o, n, r) => n in o ? z(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
3
+ var F = (o, n, r) => (G(o, typeof n != "symbol" ? n + "" : n, r), r);
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, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
7
7
  import { aq as Skeleton, B as Button, aA as ContextMenu, aB as ContextMenuTrigger, aC as ContextMenuContent, aD as ContextMenuItem, N as Tooltip, O as TooltipTrigger, P as TooltipContent, C as Card, x as CardHeader, E as CardDescription, F as CardContent, L as Label, T as Textarea, y as CardFooter, D as Dialog, r as DialogTrigger, s as DialogContent, t as DialogHeader, v as DialogTitle, w as DialogDescription, u as DialogFooter, U as Popover, V as PopoverTrigger, W as PopoverContent, ar as Command, at as CommandInput, au as CommandList, av as CommandEmpty, aw as CommandGroup, ax as CommandItem, H as Tabs, J as TabsList, K as TabsTrigger, M as TabsContent, a as Switch, A as Accordion, d as AccordionItem, e as AccordionTrigger, f as AccordionContent, an as useToast, I as Input$1, R as TooltipPortal, a6 as DropdownMenu, a7 as DropdownMenuTrigger, a8 as DropdownMenuContent, S as ScrollArea, ac as DropdownMenuLabel, ad as DropdownMenuSeparator, af as DropdownMenuGroup, a9 as DropdownMenuItem, ae as DropdownMenuShortcut, i as AlertDialog, k as AlertDialogContent, l as AlertDialogHeader, n as AlertDialogTitle, j as AlertDialogTrigger, o as AlertDialogDescription, m as AlertDialogFooter, q as AlertDialogCancel, p as AlertDialogAction, aa as DropdownMenuCheckboxItem, X as HoverCard, Y as HoverCardTrigger, Z as HoverCardContent, al as Separator, g as Badge, _ as Select$1, a1 as SelectTrigger, a0 as SelectValue, a2 as SelectContent, a4 as SelectItem, Q as TooltipProvider, ap as Toaster } from "./context-menu-FPX89OKr.js";
8
- import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, endsWith, isEmpty, forIn, isObject as isObject$1, each, first, noop, merge, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, memoize, forEach, unset, chunk, throttle, cloneDeep, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
8
+ import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, endsWith, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, memoize, forEach, unset, chunk, throttle, cloneDeep, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, reject, nth, isNumber as isNumber$1, 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 { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
@@ -30,7 +30,7 @@ import ReactDOM from "react-dom";
30
30
  import PropTypes from "prop-types";
31
31
  import { ErrorBoundary } from "react-error-boundary";
32
32
  import { Resizable } from "re-resizable";
33
- import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, X, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
33
+ import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, SearchIcon, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, X, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
34
34
  import validator from "@rjsf/validator-ajv8";
35
35
  import Form$1 from "@rjsf/core";
36
36
  import { y, s as s$1, h } from "./controls-lEwMTdPQ.js";
@@ -89,23 +89,23 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
89
89
  const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
90
90
  let a, l, i;
91
91
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
92
- const c = (f) => o.get(f), d = (f, v) => {
93
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(v);
92
+ const c = (f) => o.get(f), d = (f, S) => {
93
+ (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(S);
94
94
  const w = o.get(f);
95
- if (o.set(f, v), r.has(f) || r.set(f, w), w && hasPromiseAtomValue(w)) {
96
- const A = "v" in v ? v.v instanceof Promise ? v.v : Promise.resolve(v.v) : Promise.reject(v.e);
95
+ if (o.set(f, S), r.has(f) || r.set(f, w), w && hasPromiseAtomValue(w)) {
96
+ const A = "v" in S ? S.v instanceof Promise ? S.v : Promise.resolve(S.v) : Promise.reject(S.e);
97
97
  cancelPromise(w.v, A);
98
98
  }
99
- }, u = (f, v, w) => {
99
+ }, u = (f, S, w) => {
100
100
  const A = /* @__PURE__ */ new Map();
101
101
  let I = !1;
102
102
  w.forEach((T, D) => {
103
- !T && D === f && (T = v), T ? (A.set(D, T), v.d.get(D) !== T && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
- }), (I || v.d.size !== A.size) && (v.d = A);
105
- }, p = (f, v, w) => {
103
+ !T && D === f && (T = S), T ? (A.set(D, T), S.d.get(D) !== T && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
+ }), (I || S.d.size !== A.size) && (S.d = A);
105
+ }, p = (f, S, w) => {
106
106
  const A = c(f), I = {
107
107
  d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
108
- v
108
+ v: S
109
109
  };
110
110
  if (w && u(f, I, w), A && isEqualAtomValue(A, I) && A.d === I.d)
111
111
  return A;
@@ -115,12 +115,12 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
115
115
  I.v = A.v;
116
116
  }
117
117
  return d(f, I), I;
118
- }, m = (f, v, w, A) => {
119
- if (isPromiseLike$2(v)) {
118
+ }, m = (f, S, w, A) => {
119
+ if (isPromiseLike$2(S)) {
120
120
  let I;
121
121
  const T = new Promise((D, O) => {
122
122
  let M = !1;
123
- v.then(
123
+ S.then(
124
124
  (V) => {
125
125
  if (!M) {
126
126
  M = !0;
@@ -150,27 +150,27 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
150
150
  ), D(V));
151
151
  };
152
152
  });
153
- return T.orig = v, T.status = "pending", registerCancelPromise(T, (D) => {
153
+ return T.orig = S, T.status = "pending", registerCancelPromise(T, (D) => {
154
154
  D && I(D), A == null || A();
155
155
  }), p(f, T, w);
156
156
  }
157
- return p(f, v, w);
158
- }, g = (f, v, w) => {
157
+ return p(f, S, w);
158
+ }, g = (f, S, w) => {
159
159
  const A = c(f), I = {
160
160
  d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
161
- e: v
161
+ e: S
162
162
  };
163
163
  return w && u(f, I, w), A && isEqualAtomError(A, I) && A.d === I.d ? A : (d(f, I), I);
164
164
  }, x = (f) => {
165
- const v = c(f);
166
- if (v && (v.d.forEach((M, V) => {
165
+ const S = c(f);
166
+ if (S && (S.d.forEach((M, V) => {
167
167
  V !== f && !n.has(V) && x(V);
168
- }), Array.from(v.d).every(([M, V]) => {
168
+ }), Array.from(S.d).every(([M, V]) => {
169
169
  const $ = c(M);
170
170
  return M === f || $ === V || // TODO This is a hack, we should find a better solution.
171
171
  $ && !hasPromiseAtomValue($) && isEqualAtomValue($, V);
172
172
  })))
173
- return v;
173
+ return S;
174
174
  const w = /* @__PURE__ */ new Map();
175
175
  let A = !0;
176
176
  const I = (M) => {
@@ -193,7 +193,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
193
193
  get setSelf() {
194
194
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(f) && console.warn("setSelf function cannot be used with read-only atom"), !D && isActuallyWritableAtom(f) && (D = (...M) => {
195
195
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && A && console.warn("setSelf function cannot be called in sync"), !A)
196
- return _(f, ...M);
196
+ return B(f, ...M);
197
197
  }), D;
198
198
  }
199
199
  };
@@ -211,18 +211,18 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
211
211
  A = !1;
212
212
  }
213
213
  }, j = (f) => returnAtomValue(x(f)), E = (f) => {
214
- let v = n.get(f);
215
- return v || (v = C(f)), v;
216
- }, b = (f, v) => !v.l.size && (!v.t.size || v.t.size === 1 && v.t.has(f)), k = (f) => {
217
- const v = n.get(f);
218
- v && b(f, v) && B(f);
219
- }, S = (f) => {
220
- const v = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), A = (T) => {
214
+ let S = n.get(f);
215
+ return S || (S = R(f)), S;
216
+ }, b = (f, S) => !S.l.size && (!S.t.size || S.t.size === 1 && S.t.has(f)), k = (f) => {
217
+ const S = n.get(f);
218
+ S && b(f, S) && _(f);
219
+ }, v = (f) => {
220
+ const S = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), A = (T) => {
221
221
  const D = n.get(T);
222
222
  D == null || D.t.forEach((O) => {
223
- O !== T && (v.set(
223
+ O !== T && (S.set(
224
224
  O,
225
- (v.get(O) || /* @__PURE__ */ new Set()).add(T)
225
+ (S.get(O) || /* @__PURE__ */ new Set()).add(T)
226
226
  ), w.set(O, (w.get(O) || 0) + 1), A(O));
227
227
  });
228
228
  };
@@ -234,19 +234,19 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
234
234
  if (O !== T) {
235
235
  let V = w.get(O);
236
236
  if (V && w.set(O, --V), !V) {
237
- let $ = !!((M = v.get(O)) != null && M.size);
237
+ let $ = !!((M = S.get(O)) != null && M.size);
238
238
  if ($) {
239
239
  const H = c(O), U = x(O);
240
240
  $ = !H || !isEqualAtomValue(H, U);
241
241
  }
242
- $ || v.forEach((H) => H.delete(O));
242
+ $ || S.forEach((H) => H.delete(O));
243
243
  }
244
244
  I(O);
245
245
  }
246
246
  });
247
247
  };
248
248
  I(f);
249
- }, R = (f, ...v) => {
249
+ }, C = (f, ...S) => {
250
250
  let w = !0;
251
251
  const A = (D) => returnAtomValue(x(D)), I = (D, ...O) => {
252
252
  let M;
@@ -254,9 +254,9 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
254
254
  if (!hasInitialValue(D))
255
255
  throw new Error("atom not writable");
256
256
  const V = c(D), $ = m(D, O[0]);
257
- (!V || !isEqualAtomValue(V, $)) && S(D);
257
+ (!V || !isEqualAtomValue(V, $)) && v(D);
258
258
  } else
259
- M = R(D, ...O);
259
+ M = C(D, ...O);
260
260
  if (!w) {
261
261
  const V = L();
262
262
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
@@ -264,55 +264,55 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
264
264
  );
265
265
  }
266
266
  return M;
267
- }, T = f.write(A, I, ...v);
267
+ }, T = f.write(A, I, ...S);
268
268
  return w = !1, T;
269
- }, _ = (f, ...v) => {
270
- const w = R(f, ...v), A = L();
269
+ }, B = (f, ...S) => {
270
+ const w = C(f, ...S), A = L();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
272
  (I) => I({ type: "write", flushed: A })
273
273
  ), w;
274
- }, C = (f, v) => {
274
+ }, R = (f, S) => {
275
275
  const w = {
276
- t: new Set(v && [v]),
276
+ t: new Set(S && [S]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
279
  if (n.set(f, w), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(f), x(f).d.forEach((A, I) => {
280
280
  const T = n.get(I);
281
- T ? T.t.add(f) : I !== f && C(I, f);
281
+ T ? T.t.add(f) : I !== f && R(I, f);
282
282
  }), x(f), isActuallyWritableAtom(f) && f.onMount) {
283
- const A = f.onMount((...I) => _(f, ...I));
283
+ const A = f.onMount((...I) => B(f, ...I));
284
284
  A && (w.u = A);
285
285
  }
286
286
  return w;
287
- }, B = (f) => {
288
- var v;
289
- const w = (v = n.get(f)) == null ? void 0 : v.u;
287
+ }, _ = (f) => {
288
+ var S;
289
+ const w = (S = n.get(f)) == null ? void 0 : S.u;
290
290
  w && w(), n.delete(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(f);
291
291
  const A = c(f);
292
292
  A ? (hasPromiseAtomValue(A) && cancelPromise(A.v), A.d.forEach((I, T) => {
293
293
  if (T !== f) {
294
294
  const D = n.get(T);
295
- D && (D.t.delete(f), b(T, D) && B(T));
295
+ D && (D.t.delete(f), b(T, D) && _(T));
296
296
  }
297
297
  })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", f);
298
- }, N = (f, v, w) => {
299
- const A = new Set(v.d.keys());
298
+ }, N = (f, S, w) => {
299
+ const A = new Set(S.d.keys());
300
300
  w == null || w.forEach((I, T) => {
301
301
  if (A.has(T)) {
302
302
  A.delete(T);
303
303
  return;
304
304
  }
305
305
  const D = n.get(T);
306
- D && (D.t.delete(f), b(T, D) && B(T));
306
+ D && (D.t.delete(f), b(T, D) && _(T));
307
307
  }), A.forEach((I) => {
308
308
  const T = n.get(I);
309
- T ? T.t.add(f) : n.has(f) && C(I, f);
309
+ T ? T.t.add(f) : n.has(f) && R(I, f);
310
310
  });
311
311
  }, L = () => {
312
312
  let f;
313
313
  for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (f = /* @__PURE__ */ new Set()); r.size; ) {
314
- const v = Array.from(r);
315
- r.clear(), v.forEach(([w, A]) => {
314
+ const S = Array.from(r);
315
+ r.clear(), S.forEach(([w, A]) => {
316
316
  const I = c(w);
317
317
  if (I) {
318
318
  I.d !== (A == null ? void 0 : A.d) && N(w, I, A == null ? void 0 : A.d);
@@ -325,21 +325,21 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
325
325
  });
326
326
  }
327
327
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
328
- return a.forEach((v) => v("state")), f;
329
- }, P = (f, v) => {
328
+ return a.forEach((S) => S("state")), f;
329
+ }, P = (f, S) => {
330
330
  const w = E(f), A = L(), I = w.l;
331
- return I.add(v), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("sub")), l.forEach(
331
+ return I.add(S), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("sub")), l.forEach(
332
332
  (T) => T({ type: "sub", flushed: A })
333
333
  )), () => {
334
- I.delete(v), k(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("unsub")), l.forEach((T) => T({ type: "unsub" })));
334
+ I.delete(S), k(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("unsub")), l.forEach((T) => T({ type: "unsub" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
338
338
  get: j,
339
- set: _,
339
+ set: B,
340
340
  sub: P,
341
341
  // store dev methods (these are tentative and subject to change without notice)
342
- dev_subscribe_store: (f, v) => v !== 2 ? (console.warn(
342
+ dev_subscribe_store: (f, S) => S !== 2 ? (console.warn(
343
343
  "The current StoreListener revision is 2. The older ones are deprecated."
344
344
  ), a.add(f), () => {
345
345
  a.delete(f);
@@ -351,15 +351,15 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
351
351
  dev_get_mounted: (f) => n.get(f),
352
352
  dev_restore_atoms: (f) => {
353
353
  for (const [w, A] of f)
354
- hasInitialValue(w) && (m(w, A), S(w));
355
- const v = L();
354
+ hasInitialValue(w) && (m(w, A), v(w));
355
+ const S = L();
356
356
  l.forEach(
357
- (w) => w({ type: "restore", flushed: v })
357
+ (w) => w({ type: "restore", flushed: S })
358
358
  );
359
359
  }
360
360
  } : {
361
361
  get: j,
362
- set: _,
362
+ set: B,
363
363
  sub: P
364
364
  };
365
365
  };
@@ -386,27 +386,27 @@ function splitAtom(o, n) {
386
386
  m[j] = b;
387
387
  return;
388
388
  }
389
- const k = (R) => {
390
- const _ = R(l), C = R(o), N = a(C, _ == null ? void 0 : _.arr).keyList.indexOf(E);
391
- if (N < 0 || N >= C.length) {
389
+ const k = (C) => {
390
+ const B = C(l), R = C(o), N = a(R, B == null ? void 0 : B.arr).keyList.indexOf(E);
391
+ if (N < 0 || N >= R.length) {
392
392
  const L = c[a(c).keyList.indexOf(E)];
393
393
  if (L)
394
394
  return L;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return C[N];
398
- }, S = (R, _, C) => {
399
- const B = R(l), N = R(o), P = a(N, B == null ? void 0 : B.arr).keyList.indexOf(E);
397
+ return R[N];
398
+ }, v = (C, B, R) => {
399
+ const _ = C(l), N = C(o), P = a(N, _ == null ? void 0 : _.arr).keyList.indexOf(E);
400
400
  if (P < 0 || P >= N.length)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const f = isFunction(C) ? C(N[P]) : C;
403
- _(o, [
402
+ const f = isFunction(R) ? R(N[P]) : R;
403
+ B(o, [
404
404
  ...N.slice(0, P),
405
405
  f,
406
406
  ...N.slice(P + 1)
407
407
  ]);
408
408
  };
409
- m[j] = isWritable(o) ? atom(k, S) : atom(k);
409
+ m[j] = isWritable(o) ? atom(k, v) : atom(k);
410
410
  }), p && p.keyList.length === g.length && p.keyList.every((x, j) => x === g[j]) ? u = p : u = { arr: c, atomList: m, keyList: g }, r.set(c, u), u;
411
411
  }, l = atom((c) => {
412
412
  const d = c(l), u = c(o);
@@ -1066,10 +1066,16 @@ const useSavePage = () => {
1066
1066
  const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (u) => {
1067
1067
  }), a = useBuilderProp("onSaveStateChange", noop), l = useGetPageData(), [i] = usePageDataProviders(), [c] = useBrandingOptions();
1068
1068
  return { savePage: useThrottledCallback(
1069
- async () => {
1069
+ async (u = !1) => {
1070
1070
  n("SAVING"), a("SAVING");
1071
- const u = l();
1072
- return await r({ blocks: u.blocks, providers: i, brandingOptions: c, themeConfiguration: c }), setTimeout(() => {
1071
+ const p = l();
1072
+ return await r({
1073
+ autoSave: u,
1074
+ blocks: p.blocks,
1075
+ providers: i,
1076
+ brandingOptions: c,
1077
+ themeConfiguration: c
1078
+ }), setTimeout(() => {
1073
1079
  n("SAVED"), a("SAVED");
1074
1080
  }, 100), !0;
1075
1081
  },
@@ -1179,7 +1185,7 @@ const useBlocksStoreManager = () => {
1179
1185
  return r.map((l) => {
1180
1186
  if (a.includes(l._id)) {
1181
1187
  const i = find(n, { _id: l._id });
1182
- return merge({}, l, { ...omit(i, "_id") });
1188
+ return { ...l, ...omit(i, "_id") };
1183
1189
  }
1184
1190
  return l;
1185
1191
  });
@@ -1196,13 +1202,13 @@ const useBlocksStoreManager = () => {
1196
1202
  } = useBlocksStoreManager();
1197
1203
  return {
1198
1204
  moveBlocks: (E, b, k) => {
1199
- const S = map(E, (_) => {
1200
- const B = n.find((P) => P._id === _)._parent || null, L = n.filter((P) => B ? P._parent === B : !P._parent).map((P) => P._id).indexOf(_);
1201
- return { _id: _, oldParent: B, oldPosition: L };
1202
- }), R = S.find(({ _id: _ }) => _ === E[0]);
1203
- R && R.oldParent === b && R.oldPosition === k || (i(E, b, k), o({
1204
- undo: () => each(S, ({ _id: _, oldParent: C, oldPosition: B }) => {
1205
- i([_], C, B);
1205
+ const v = map(E, (B) => {
1206
+ const _ = n.find((P) => P._id === B)._parent || null, L = n.filter((P) => _ ? P._parent === _ : !P._parent).map((P) => P._id).indexOf(B);
1207
+ return { _id: B, oldParent: _, oldPosition: L };
1208
+ }), C = v.find(({ _id: B }) => B === E[0]);
1209
+ C && C.oldParent === b && C.oldPosition === k || (i(E, b, k), o({
1210
+ undo: () => each(v, ({ _id: B, oldParent: R, oldPosition: _ }) => {
1211
+ i([B], R, _);
1206
1212
  }),
1207
1213
  redo: () => i(E, b, k)
1208
1214
  }));
@@ -1214,27 +1220,27 @@ const useBlocksStoreManager = () => {
1214
1220
  });
1215
1221
  },
1216
1222
  removeBlocks: (E) => {
1217
- var R;
1218
- const b = (R = first(E)) == null ? void 0 : R._parent, S = n.filter((_) => b ? _._parent === b : !_._parent).indexOf(first(E));
1223
+ var C;
1224
+ const b = (C = first(E)) == null ? void 0 : C._parent, v = n.filter((B) => b ? B._parent === b : !B._parent).indexOf(first(E));
1219
1225
  l(map(E, "_id")), o({
1220
- undo: () => a(E, b, S),
1226
+ undo: () => a(E, b, v),
1221
1227
  redo: () => l(map(E, "_id"))
1222
1228
  });
1223
1229
  },
1224
1230
  updateBlocks: (E, b, k) => {
1225
- let S = [];
1231
+ let v = [];
1226
1232
  if (k)
1227
- S = map(E, (R) => ({ _id: R, ...k }));
1233
+ v = map(E, (C) => ({ _id: C, ...k }));
1228
1234
  else {
1229
- const R = keys(b);
1230
- S = map(E, (_) => {
1231
- const C = n.find((N) => N._id === _), B = { _id: _ };
1232
- return each(R, (N) => B[N] = C[N]), B;
1235
+ const C = keys(b);
1236
+ v = map(E, (B) => {
1237
+ const R = n.find((N) => N._id === B), _ = { _id: B };
1238
+ return each(C, (N) => _[N] = R[N]), _;
1233
1239
  });
1234
1240
  }
1235
- c(map(E, (R) => ({ _id: R, ...b }))), o({
1236
- undo: () => c(S),
1237
- redo: () => c(map(E, (R) => ({ _id: R, ...b })))
1241
+ c(map(E, (C) => ({ _id: C, ...b }))), o({
1242
+ undo: () => c(v),
1243
+ redo: () => c(map(E, (C) => ({ _id: C, ...b })))
1238
1244
  });
1239
1245
  },
1240
1246
  updateBlocksRuntime: (E, b) => {
@@ -1249,8 +1255,8 @@ const useBlocksStoreManager = () => {
1249
1255
  updateMultipleBlocksProps: (E) => {
1250
1256
  let b = [];
1251
1257
  b = map(E, (k) => {
1252
- const S = keys(k), R = n.find((C) => C._id === k._id), _ = {};
1253
- return each(S, (C) => _[C] = R[C]), _;
1258
+ const v = keys(k), C = n.find((R) => R._id === k._id), B = {};
1259
+ return each(v, (R) => B[R] = C[R]), B;
1254
1260
  }), c(E), o({
1255
1261
  undo: () => c(b),
1256
1262
  redo: () => c(E)
@@ -1281,16 +1287,16 @@ const useBlocksStoreManager = () => {
1281
1287
  return a(k, c, d);
1282
1288
  }
1283
1289
  const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
1284
- forIn(p, (k, S) => {
1290
+ forIn(p, (k, v) => {
1285
1291
  if (startsWith(k, SLOT_KEY)) {
1286
- const R = k.replace(SLOT_KEY, "");
1292
+ const C = k.replace(SLOT_KEY, "");
1287
1293
  m.push({
1288
- _id: R,
1294
+ _id: C,
1289
1295
  _type: "Slot",
1290
1296
  _parent: u,
1291
- _name: i.props[S].name,
1292
- _styles: i.props[S].styles,
1293
- _emptyStyles: i.props[S].emptyStyles
1297
+ _name: i.props[v].name,
1298
+ _styles: i.props[v].styles,
1299
+ _emptyStyles: i.props[v].emptyStyles
1294
1300
  });
1295
1301
  }
1296
1302
  });
@@ -3074,20 +3080,20 @@ const useDnd = () => {
3074
3080
  x.preventDefault(), x.stopPropagation(), throttledDragOver(x);
3075
3081
  },
3076
3082
  onDrop: (x) => {
3077
- var C;
3078
- const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((C = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : C.scrollY) : x.clientX;
3083
+ var R;
3084
+ const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : x.clientX;
3079
3085
  dropIndex = calculateDropIndex(b, possiblePositions);
3080
- const k = d, S = j.getAttribute("data-block-id"), R = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3081
- if ((k == null ? void 0 : k._id) === S || !R) {
3086
+ const k = d, v = j.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3087
+ if ((k == null ? void 0 : k._id) === v || !C) {
3082
3088
  g();
3083
3089
  return;
3084
3090
  }
3085
3091
  if (!has(k, "_id")) {
3086
- a(k, S === "canvas" ? null : S, dropIndex), setTimeout(g, 300);
3092
+ a(k, v === "canvas" ? null : v, dropIndex), setTimeout(g, 300);
3087
3093
  return;
3088
3094
  }
3089
- let _ = j.getAttribute("data-block-id");
3090
- _ === null && (_ = x.target.parentElement.getAttribute("data-block-id")), c([k._id], _ === "canvas" ? null : _, dropIndex), g(), setTimeout(removePlaceholder, 300);
3095
+ let B = j.getAttribute("data-block-id");
3096
+ B === null && (B = x.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), g(), setTimeout(removePlaceholder, 300);
3091
3097
  },
3092
3098
  onDragEnter: (x) => {
3093
3099
  const j = x, E = j.target;
@@ -3129,9 +3135,11 @@ const useHandleCanvasDblClick = () => {
3129
3135
  const p = new Quill(u, { placeholder: "Type here..." });
3130
3136
  function m() {
3131
3137
  const x = p.getText(0, p.getLength());
3132
- n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l();
3138
+ n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l(), u.remove();
3133
3139
  }
3134
- u.addEventListener("blur", m, !0), u.addEventListener("keydown", (x) => {
3140
+ u.addEventListener("blur", m, !0), u.addEventListener("click", (x) => {
3141
+ x.stopPropagation();
3142
+ }), u.addEventListener("keydown", (x) => {
3135
3143
  (x.key === "Enter" || x.key === "Escape") && m();
3136
3144
  }), p.focus(), (g = u.querySelector(".ql-clipboard")) == null || g.remove(), a(c.getAttribute("data-block-id"));
3137
3145
  };
@@ -3314,16 +3322,16 @@ const useHandleCanvasDblClick = () => {
3314
3322
  }, [r, c]);
3315
3323
  const x = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
3316
3324
  return useEffect(() => {
3317
- const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), R = get(o, "bodyTextDarkColor", "#000"), _ = get(o, "bodyTextLightColor", "#fff"), C = s({
3325
+ const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), v = get(o, "bodyBgDarkColor", "#000"), C = get(o, "bodyTextDarkColor", "#000"), B = get(o, "bodyTextLightColor", "#fff"), R = s({
3318
3326
  colors: [E, b],
3319
3327
  names: ["primary", "secondary"]
3320
3328
  });
3321
- set(C, "primary.DEFAULT", E), set(C, "secondary.DEFAULT", b);
3322
- const B = {
3329
+ set(R, "primary.DEFAULT", E), set(R, "secondary.DEFAULT", b);
3330
+ const _ = {
3323
3331
  "bg-light": k,
3324
- "bg-dark": S,
3325
- "text-dark": R,
3326
- "text-light": _
3332
+ "bg-dark": v,
3333
+ "text-dark": C,
3334
+ "text-light": B
3327
3335
  }, N = get(o, "roundedCorners", "0");
3328
3336
  !d || !d.tailwind || (d.tailwind.config = {
3329
3337
  darkMode: "class",
@@ -3343,7 +3351,7 @@ const useHandleCanvasDblClick = () => {
3343
3351
  borderRadius: {
3344
3352
  DEFAULT: `${N || "0"}px`
3345
3353
  },
3346
- colors: { ...B, ...C }
3354
+ colors: { ..._, ...R }
3347
3355
  }
3348
3356
  },
3349
3357
  plugins: [
@@ -3505,9 +3513,9 @@ function applyLanguage(o, n, r) {
3505
3513
  }
3506
3514
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3507
3515
  const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), g = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3508
- (b) => b.reduce((k, S) => {
3509
- const R = get(u, S, {});
3510
- return { ...k, ...R };
3516
+ (b) => b.reduce((k, v) => {
3517
+ const C = get(u, v, {});
3518
+ return { ...k, ...C };
3511
3519
  }, {}),
3512
3520
  [u]
3513
3521
  );
@@ -3515,18 +3523,18 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3515
3523
  o.map((b, k) => {
3516
3524
  if (j === b._id || p.includes(b._id))
3517
3525
  return null;
3518
- const S = {}, R = filter(n, { _parent: b._id });
3519
- if (S.children = R.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: R }) : null, b._type === "GlobalBlock") {
3526
+ const v = {}, C = filter(n, { _parent: b._id });
3527
+ if (v.children = C.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: C }) : null, b._type === "GlobalBlock") {
3520
3528
  const w = m(b);
3521
- S.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(w, (A) => !A._parent), allBlocks: w });
3529
+ v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(w, (A) => !A._parent), allBlocks: w });
3522
3530
  }
3523
- const _ = getBlockComponent(b._type), C = get(_, "server", !1), B = C ? RSCBlock : get(_, "builderComponent", get(_, "component", null));
3524
- if (isNull(B))
3531
+ const B = getBlockComponent(b._type), R = get(B, "server", !1), _ = R ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3532
+ if (isNull(_))
3525
3533
  return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
3526
- const N = has(_, "getBlockStateFrom") ? _ == null ? void 0 : _.getBlockStateFrom(b, n) : [], L = E(N), P = g(b);
3534
+ const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(b, n) : [], L = E(N), P = g(b);
3527
3535
  if (get(P, "__isHidden", !1) && !includes(a, b._id))
3528
3536
  return null;
3529
- const f = i && isDescendant(i._id, b._id, n), v = {
3537
+ const f = i && isDescendant(i._id, b._id, n), S = {
3530
3538
  ...includes(a, b._id) ? { "force-show": "" } : {},
3531
3539
  "data-block-id": b._id,
3532
3540
  "data-block-type": b._type,
@@ -3540,12 +3548,12 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3540
3548
  ...c === b._id && !f ? { "data-drop": "yes" } : {},
3541
3549
  ...includes(l, b._id) ? { "data-cut-block": "yes" } : {}
3542
3550
  };
3543
- return C ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: v }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(B, {
3544
- blockProps: v,
3551
+ return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: S }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(_, {
3552
+ blockProps: S,
3545
3553
  index: k,
3546
- ...applyBindings(applyLanguage(b, r, _), x),
3554
+ ...applyBindings(applyLanguage(b, r, B), x),
3547
3555
  ...omit(P, ["__isHidden"]),
3548
- ...S,
3556
+ ...v,
3549
3557
  inBuilder: !0,
3550
3558
  blockState: L
3551
3559
  }) });
@@ -3601,43 +3609,43 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3601
3609
  };
3602
3610
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
3603
3611
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3604
- const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), S = useBuilderProp("htmlDir", "ltr"), R = (B) => {
3605
- u((N) => ({ ...N, width: B }));
3612
+ const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), C = (_) => {
3613
+ u((N) => ({ ...N, width: _ }));
3606
3614
  };
3607
3615
  useEffect(() => {
3608
3616
  if (!c.current)
3609
3617
  return;
3610
- const { clientWidth: B, clientHeight: N } = c.current;
3611
- u({ width: B, height: N });
3618
+ const { clientWidth: _, clientHeight: N } = c.current;
3619
+ u({ width: _, height: N });
3612
3620
  }, [c, n]);
3613
- const _ = (B, N = 0) => {
3614
- const { top: L } = B.getBoundingClientRect();
3621
+ const B = (_, N = 0) => {
3622
+ const { top: L } = _.getBoundingClientRect();
3615
3623
  return L + N >= 0 && L - N <= window.innerHeight;
3616
3624
  };
3617
3625
  useEffect(() => {
3618
- var B, N;
3626
+ var _, N;
3619
3627
  if (a && a.type !== "Multiple" && i.current) {
3620
3628
  const L = getElementByDataBlockId(i.current.contentDocument, a._id);
3621
- L && (_(L) || (N = (B = i.current) == null ? void 0 : B.contentWindow) == null || N.scrollTo({ top: L.offsetTop, behavior: "smooth" }), g([L]));
3629
+ L && (B(L) || (N = (_ = i.current) == null ? void 0 : _.contentWindow) == null || N.scrollTo({ top: L.offsetTop, behavior: "smooth" }), g([L]));
3622
3630
  }
3623
3631
  }, [a]), useEffect(() => {
3624
3632
  if (!isEmpty(E) && i.current) {
3625
- const B = getElementByStyleId(
3633
+ const _ = getElementByStyleId(
3626
3634
  i.current.contentDocument,
3627
3635
  first(E).id
3628
3636
  );
3629
- x(B ? [B] : [null]);
3637
+ x(_ ? [_] : [null]);
3630
3638
  } else
3631
3639
  x([null]);
3632
3640
  }, [E]);
3633
- const C = useMemo(() => {
3634
- let B = IframeInitialContent;
3635
- return B = B.replace("__HTML_DIR__", S), o === "offline" && (B = B.replace(
3641
+ const R = useMemo(() => {
3642
+ let _ = IframeInitialContent;
3643
+ return _ = _.replace("__HTML_DIR__", v), o === "offline" && (_ = _.replace(
3636
3644
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3637
3645
  "/offline/tailwind.cdn.js"
3638
- ), B = B.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), B = B.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), B;
3639
- }, [o, S]);
3640
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: R, onResize: R, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3646
+ ), _ = _.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), _ = _.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), _;
3647
+ }, [o, v]);
3648
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3641
3649
  "div",
3642
3650
  {
3643
3651
  onClick: () => {
@@ -3654,7 +3662,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3654
3662
  id: "canvas-iframe",
3655
3663
  style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
3656
3664
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3657
- initialContent: C,
3665
+ initialContent: R,
3658
3666
  children: [
3659
3667
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3660
3668
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3777,7 +3785,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3777
3785
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3778
3786
  ] }, l))
3779
3787
  ] }) });
3780
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-PpTH-bSI.js")), CanvasArea = () => {
3788
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-ouljm9CI.js")), CanvasArea = () => {
3781
3789
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3782
3790
  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: [
3783
3791
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
@@ -3852,8 +3860,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3852
3860
  showHeading: o = !0,
3853
3861
  className: n = ""
3854
3862
  }) => {
3855
- const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: C }, B) => {
3856
- B && (a(C), i.current = C);
3863
+ const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: R }, _) => {
3864
+ _ && (a(R), i.current = R);
3857
3865
  }, {
3858
3866
  bodyFont: u,
3859
3867
  headingFont: p,
@@ -3865,7 +3873,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3865
3873
  bodyBgLightColor: b,
3866
3874
  roundedCorners: k
3867
3875
  } = r;
3868
- let S = {
3876
+ let v = {
3869
3877
  headingFont: y({
3870
3878
  title: c("Theme Config.Heading Font"),
3871
3879
  default: p,
@@ -3883,8 +3891,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3883
3891
  primaryColor: h({ title: c("Theme Config.Primary"), default: m }),
3884
3892
  secondaryColor: h({ title: c("Theme Config.Secondary"), default: E })
3885
3893
  };
3886
- l || (S = {
3887
- ...S,
3894
+ l || (v = {
3895
+ ...v,
3888
3896
  bodyBgLightColor: h({
3889
3897
  title: c("Theme Config.Background"),
3890
3898
  default: b
@@ -3902,13 +3910,13 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3902
3910
  default: x
3903
3911
  })
3904
3912
  });
3905
- const R = {
3913
+ const C = {
3906
3914
  type: "object",
3907
3915
  properties: {}
3908
- }, _ = {};
3909
- return Object.keys(S).forEach((C) => {
3910
- const B = S[C];
3911
- return R.properties || (R.properties = {}), R.properties[C] = B.schema, _[C] = B.uiSchema, !0;
3916
+ }, B = {};
3917
+ return Object.keys(v).forEach((R) => {
3918
+ const _ = v[R];
3919
+ return C.properties || (C.properties = {}), C.properties[R] = _.schema, B[R] = _.uiSchema, !0;
3912
3920
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3913
3921
  o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: c("Theme Configuration") }) }) : null,
3914
3922
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3920,8 +3928,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3920
3928
  omitExtraData: !0,
3921
3929
  liveOmit: !0,
3922
3930
  liveValidate: !0,
3923
- uiSchema: _,
3924
- schema: R,
3931
+ uiSchema: B,
3932
+ schema: C,
3925
3933
  formData: r,
3926
3934
  validator,
3927
3935
  onChange: d
@@ -4104,14 +4112,14 @@ function BiExpandVertical(o) {
4104
4112
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4105
4113
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4106
4114
  let u = null;
4107
- const p = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: S, handleClick: R } = o, _ = (f) => {
4115
+ const p = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: v, handleClick: C } = o, B = (f) => {
4108
4116
  f.stopPropagation(), !i.includes(x) && o.toggle();
4109
- }, C = (f) => {
4117
+ }, R = (f) => {
4110
4118
  f.isInternal && (u = f.isOpen, f.isOpen && f.close());
4111
- }, B = (f) => {
4119
+ }, _ = (f) => {
4112
4120
  f.isInternal && u !== null && (u ? f.open() : f.close(), u = null);
4113
4121
  }, N = (f) => {
4114
- f.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), R(f);
4122
+ f.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), C(f);
4115
4123
  };
4116
4124
  useEffect(() => {
4117
4125
  const f = setTimeout(() => {
@@ -4120,16 +4128,16 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4120
4128
  return () => clearTimeout(f);
4121
4129
  }, [b, o, k]);
4122
4130
  const L = useMemo(() => {
4123
- const f = Object.keys(j), v = [];
4131
+ const f = Object.keys(j), S = [];
4124
4132
  for (let w = 0; w < f.length; w++)
4125
4133
  if (f[w].endsWith("_attrs")) {
4126
4134
  const A = j[f[w]], I = Object.keys(A).join("|");
4127
- I.match(/x-data/) && v.push("data"), I.match(/x-on/) && v.push("event"), I.match(/x-show|x-if/) && v.push("show");
4135
+ I.match(/x-data/) && S.push("data"), I.match(/x-on/) && S.push("event"), I.match(/x-show|x-if/) && S.push("show");
4128
4136
  }
4129
- return v;
4130
- }, [j]), P = (f, v) => {
4137
+ return S;
4138
+ }, [j]), P = (f, S) => {
4131
4139
  const w = d.contentDocument || d.contentWindow.document, A = w.querySelector(`[data-block-id=${f}]`);
4132
- A && A.setAttribute("data-drop", v);
4140
+ A && A.setAttribute("data-drop", S);
4133
4141
  const I = A.getBoundingClientRect(), T = d.getBoundingClientRect();
4134
4142
  I.top >= T.top && I.left >= T.left && I.bottom <= T.bottom && I.right <= T.right || (w.documentElement.scrollTop = A.offsetTop - T.top);
4135
4143
  };
@@ -4152,8 +4160,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4152
4160
  style: n,
4153
4161
  "data-node-id": x,
4154
4162
  ref: i.includes(x) ? null : r,
4155
- onDragStart: () => C(o),
4156
- onDragEnd: () => B(o),
4163
+ onDragStart: () => R(o),
4164
+ onDragEnd: () => _(o),
4157
4165
  onDragOver: (f) => {
4158
4166
  f.preventDefault(), P(x, "yes");
4159
4167
  },
@@ -4176,12 +4184,12 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4176
4184
  "div",
4177
4185
  {
4178
4186
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
4179
- children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: _, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4187
+ children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: B, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4180
4188
  }
4181
4189
  ),
4182
4190
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4183
4191
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: j == null ? void 0 : j._type }) }),
4184
- S ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4192
+ v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4185
4193
  "div",
4186
4194
  {
4187
4195
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
@@ -4586,7 +4594,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4586
4594
  ...getAttrs(r),
4587
4595
  ...getStyles(r)
4588
4596
  }, r.attributes) {
4589
- const k = r.attributes.find((S) => includes(NAME_ATTRIBUTES, S.key));
4597
+ const k = r.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
4590
4598
  k && (a._name = k.value);
4591
4599
  }
4592
4600
  if (i)
@@ -4604,14 +4612,14 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4604
4612
  ];
4605
4613
  a = {
4606
4614
  ...a,
4607
- href: ((u = l.find((S) => S.key === "href")) == null ? void 0 : u.value) || "",
4608
- hrefType: ((p = l.find((S) => S.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4609
- autoplay: ((m = l.find((S) => S.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
4610
- maxWidth: ((x = (g = l.find((S) => S.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : x.replace("px", "")) || "",
4611
- backdropColor: ((j = l.find((S) => S.key === "data-overlay")) == null ? void 0 : j.value) || "",
4612
- galleryName: ((E = l.find((S) => S.key === "data-gall")) == null ? void 0 : E.value) || ""
4613
- }, forEach(k, (S) => {
4614
- has(a, `styles_attrs.${S}`) && delete a.styles_attrs[S];
4615
+ href: ((u = l.find((v) => v.key === "href")) == null ? void 0 : u.value) || "",
4616
+ hrefType: ((p = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4617
+ autoplay: ((m = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
4618
+ maxWidth: ((x = (g = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : x.replace("px", "")) || "",
4619
+ backdropColor: ((j = l.find((v) => v.key === "data-overlay")) == null ? void 0 : j.value) || "",
4620
+ galleryName: ((E = l.find((v) => v.key === "data-gall")) == null ? void 0 : E.value) || ""
4621
+ }, forEach(k, (v) => {
4622
+ has(a, `styles_attrs.${v}`) && delete a.styles_attrs[v];
4615
4623
  });
4616
4624
  }
4617
4625
  if (a._type === "Input") {
@@ -4621,8 +4629,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4621
4629
  const k = stringify([r]);
4622
4630
  return hasVideoEmbed(k) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(k)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = k, [a];
4623
4631
  } else if (r.tagName === "svg") {
4624
- const k = find(r.attributes, { key: "height" }), S = find(r.attributes, { key: "width" }), R = get(k, "value") ? `[${get(k, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px", C = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4625
- return a.styles = `${STYLES_KEY}, ${cn(`w-${_} h-${R}`, C)}`.trim(), r.attributes = filter(r.attributes, (B) => !includes(["style", "width", "height", "class"], B.key)), a.icon = stringify([r]), [a];
4632
+ const k = find(r.attributes, { key: "height" }), v = find(r.attributes, { key: "width" }), C = get(k, "value") ? `[${get(k, "value")}px]` : "24px", B = get(v, "value") ? `[${get(v, "value")}px]` : "24px", R = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4633
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${B} h-${C}`, R)}`.trim(), r.attributes = filter(r.attributes, (_) => !includes(["style", "width", "height", "class"], _.key)), a.icon = stringify([r]), [a];
4626
4634
  } else if (r.tagName == "option" && n && ((b = n.block) == null ? void 0 : b._type) === "Select")
4627
4635
  return n.block.options.push({
4628
4636
  label: getTextContent(r.children),
@@ -4689,8 +4697,8 @@ function ExpandableObject(o) {
4689
4697
  useEffect(() => {
4690
4698
  g.current ? E(p(d, r, n)) : g.current = !0;
4691
4699
  }, [p]);
4692
- const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", S = useComponentId(), R = d + 1, _ = a.length - 1, C = (B) => {
4693
- B.key === " " && (B.preventDefault(), j());
4700
+ const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", v = useComponentId(), C = d + 1, B = a.length - 1, R = (_) => {
4701
+ _.key === " " && (_.preventDefault(), j());
4694
4702
  };
4695
4703
  return /* @__PURE__ */ createElement("div", {
4696
4704
  className: u.basicChildStyle,
@@ -4698,16 +4706,16 @@ function ExpandableObject(o) {
4698
4706
  }, /* @__PURE__ */ createElement("span", {
4699
4707
  className: b,
4700
4708
  onClick: j,
4701
- onKeyDown: C,
4709
+ onKeyDown: R,
4702
4710
  role: "button",
4703
4711
  tabIndex: 0,
4704
4712
  "aria-label": k,
4705
4713
  "aria-expanded": x,
4706
- "aria-controls": x ? S : void 0
4714
+ "aria-controls": x ? v : void 0
4707
4715
  }), n && (m ? /* @__PURE__ */ createElement("span", {
4708
4716
  className: u.clickableLabel,
4709
4717
  onClick: j,
4710
- onKeyDown: C,
4718
+ onKeyDown: R,
4711
4719
  role: "button",
4712
4720
  tabIndex: -1
4713
4721
  }, n, ":") : /* @__PURE__ */ createElement("span", {
@@ -4715,20 +4723,20 @@ function ExpandableObject(o) {
4715
4723
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4716
4724
  className: u.punctuation
4717
4725
  }, i), x ? /* @__PURE__ */ createElement("div", {
4718
- id: S
4719
- }, a.map((B, N) => /* @__PURE__ */ createElement(DataRender, {
4720
- key: B[0] || N,
4721
- field: B[0],
4722
- value: B[1],
4726
+ id: v
4727
+ }, a.map((_, N) => /* @__PURE__ */ createElement(DataRender, {
4728
+ key: _[0] || N,
4729
+ field: _[0],
4730
+ value: _[1],
4723
4731
  style: u,
4724
- lastElement: N === _,
4725
- level: R,
4732
+ lastElement: N === B,
4733
+ level: C,
4726
4734
  shouldExpandNode: p,
4727
4735
  clickToExpandNode: m
4728
4736
  }))) : /* @__PURE__ */ createElement("span", {
4729
4737
  className: u.collapsedContent,
4730
4738
  onClick: j,
4731
- onKeyDown: C,
4739
+ onKeyDown: R,
4732
4740
  role: "button",
4733
4741
  tabIndex: -1,
4734
4742
  "aria-hidden": !0,
@@ -5202,7 +5210,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5202
5210
  }
5203
5211
  )
5204
5212
  ] });
5205
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-3PCaHZ-A.js")), UploadImages = React__default.lazy(() => import("./UploadImages-Zr4jZDj5.js")), ImagesPanel = ({
5213
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-nDgC7Fr9.js")), UploadImages = React__default.lazy(() => import("./UploadImages-9KvJB0jW.js")), ImagesPanel = ({
5206
5214
  isModalView: o = !1,
5207
5215
  onSelect: n = () => {
5208
5216
  }
@@ -5291,27 +5299,94 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5291
5299
  className: "mt-1 rounded-md"
5292
5300
  }
5293
5301
  );
5294
- }, LinkField = ({ schema: o, formData: n, onChange: r }) => {
5295
- const [a, l] = useState([]), i = useBuilderProp("getPages", () => []), { type: c = "page", href: d = "", target: u = "self" } = n;
5296
- return useEffect(() => {
5297
- (async () => {
5298
- const p = await i();
5299
- l(p || []);
5302
+ }, CollectionField = ({
5303
+ formData: o,
5304
+ collections: n,
5305
+ onChange: r
5306
+ }) => {
5307
+ var k;
5308
+ const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (v, C) => []), [i, c] = useState(""), [d, u] = useState("pages"), [p, m] = useState(""), [g, x] = useState([]), j = (k = n == null ? void 0 : n.find((v) => v.key === d)) == null ? void 0 : k.name;
5309
+ useEffect(() => {
5310
+ const v = split((o == null ? void 0 : o.href) || "", ":"), C = get(v, 1, "pages") || "pages";
5311
+ u(C), m(""), x([]), (async () => {
5312
+ c("FETCHING_INIT_VALUE");
5313
+ const B = await l(C, [get(v, 2, "pages")]);
5314
+ B && Array.isArray(B) && m(get(B, [0, "name"], "")), c("");
5300
5315
  })();
5301
- }, []), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5316
+ }, [o.href]);
5317
+ const E = useCallback(
5318
+ debounce(async (v) => {
5319
+ if (isEmpty(v))
5320
+ x([]);
5321
+ else {
5322
+ const C = await l(d, v);
5323
+ x(C);
5324
+ }
5325
+ c("");
5326
+ }, 300),
5327
+ [d]
5328
+ ), b = (v) => {
5329
+ const C = ["collection", d, v.id];
5330
+ C[1] && r({ ...o, href: C.join(":") });
5331
+ };
5332
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5333
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: d, onChange: (v) => u(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: v.key, children: v.name }, v.key)) }),
5334
+ d && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
5335
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
5336
+ "input",
5337
+ {
5338
+ type: "text",
5339
+ value: p,
5340
+ onChange: (v) => {
5341
+ m(v.target.value), c("FETCHING_COLLECTION_ITEMS"), E(v.target.value);
5342
+ },
5343
+ placeholder: a(`Search ${j}`),
5344
+ disabled: i === "FETCHING_INIT_VALUE",
5345
+ className: "w-full rounded-md border border-gray-300 p-2"
5346
+ }
5347
+ ),
5348
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SearchIcon, { className: "absolute right-2 top-2 hidden h-5 w-5 pt-0.5 text-gray-400 group-hover:block" })
5349
+ ] }),
5350
+ i === "FETCHING_COLLECTION_ITEMS" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 pt-2", children: [
5351
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
5352
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
5353
+ ] }) : !isEmpty(g) && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "mt-2 max-h-40 overflow-y-auto rounded-md border border-gray-300", children: map(g == null ? void 0 : g.slice(0, 20), (v) => {
5354
+ var C;
5355
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
5356
+ "li",
5357
+ {
5358
+ onClick: () => b(v),
5359
+ className: `cursor-pointer p-2 text-xs ${(C = o == null ? void 0 : o.href) != null && C.includes(v.id) ? "bg-blue-200" : "hover:bg-gray-100"}`,
5360
+ children: [
5361
+ v.name,
5362
+ " ",
5363
+ v.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
5364
+ "( ",
5365
+ v.slug,
5366
+ " )"
5367
+ ] })
5368
+ ]
5369
+ },
5370
+ v.id
5371
+ );
5372
+ }) })
5373
+ ] });
5374
+ }, LinkField = ({ schema: o, formData: n, onChange: r }) => {
5375
+ const { t: a } = useTranslation(), { type: l = "page", href: i = "#", target: c = "self" } = n, d = useBuilderProp("collections", []);
5376
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5302
5377
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
5303
5378
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
5304
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: c, onChange: (p) => r({ ...n, type: p.target.value }), children: [
5305
- { const: "page", title: "Open Page" },
5306
- { const: "url", title: "Open URL" },
5307
- { const: "email", title: "Compose Email" },
5308
- { const: "telephone", title: "Call Phone" },
5309
- { const: "scroll", title: "Scroll to element" }
5310
- ].map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)) }),
5311
- c === "page" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("select", { name: "href", value: d, onChange: (p) => r({ ...n, href: p.target.value || "#" }), children: [
5312
- /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", children: "Choose page" }),
5313
- map(a, (p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.slug, children: p.name }, p.uuid))
5314
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
5379
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (u) => r({ ...n, type: u.target.value }), children: map(
5380
+ [
5381
+ ...isEmpty(d) ? [] : [{ const: "collection", title: a("Goto Page") }],
5382
+ { const: "url", title: a("Open URL") },
5383
+ { const: "email", title: a("Compose Email") },
5384
+ { const: "telephone", title: a("Call Phone") },
5385
+ { const: "scroll", title: a("Scroll to element") }
5386
+ ],
5387
+ (u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.const, children: u.title }, u.const)
5388
+ ) }),
5389
+ l === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionField, { formData: n, collections: d, onChange: r }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
5315
5390
  "input",
5316
5391
  {
5317
5392
  autoCapitalize: "off",
@@ -5319,12 +5394,14 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5319
5394
  spellCheck: "false",
5320
5395
  name: "href",
5321
5396
  type: "text",
5322
- value: d,
5323
- onChange: (p) => r({ ...n, href: p.target.value || "#" }),
5324
- placeholder: c === "page" || c === "url" ? "Enter URL" : c === "scroll" ? "#ElementID" : "Enter detail"
5397
+ value: i,
5398
+ onChange: (u) => r({ ...n, href: u.target.value }),
5399
+ placeholder: a(
5400
+ l === "page" || l === "url" ? "Enter URL" : l === "scroll" ? "#ElementID" : "Enter details"
5401
+ )
5325
5402
  }
5326
5403
  ),
5327
- (c === "page" || c === "url") && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5404
+ l === "url" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5328
5405
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5329
5406
  "input",
5330
5407
  {
@@ -5332,12 +5409,12 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5332
5409
  autoCorrect: "off",
5333
5410
  spellCheck: "false",
5334
5411
  type: "checkbox",
5335
- defaultChecked: u === "_blank",
5412
+ defaultChecked: c === "_blank",
5336
5413
  className: "!w-fit cursor-pointer rounded-md border border-border",
5337
- onChange: () => r({ ...n, target: u === "_blank" ? "_self" : "_blank" })
5414
+ onChange: () => r({ ...n, target: c === "_blank" ? "_self" : "_blank" })
5338
5415
  }
5339
5416
  ),
5340
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pt-1 text-xs", children: "Open in new tab" })
5417
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pt-1 text-xs", children: a("Open in new tab") })
5341
5418
  ] })
5342
5419
  ] })
5343
5420
  ] });
@@ -5470,28 +5547,28 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5470
5547
  }), a;
5471
5548
  };
5472
5549
  function BlockSettings() {
5473
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: b }, k, S) => {
5550
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: b }, k, v) => {
5474
5551
  if (k && (c == null ? void 0 : c._id) === n._id) {
5475
- const R = k.replace("root.", "");
5476
- a([n._id], { [R]: get(b, R) }, S);
5552
+ const C = k.replace("root.", "");
5553
+ a([n._id], { [C]: get(b, C) }, v);
5477
5554
  }
5478
5555
  }, m = useCallback(
5479
- debounce(({ formData: b }, k, S) => {
5480
- p({ formData: b }, k, S), d(b);
5556
+ debounce(({ formData: b }, k, v) => {
5557
+ p({ formData: b }, k, v), d(b);
5481
5558
  }, 1500),
5482
5559
  [n == null ? void 0 : n._id, o]
5483
5560
  ), g = ({ formData: b }, k) => {
5484
5561
  if (k) {
5485
- const S = k.replace("root.", "");
5562
+ const v = k.replace("root.", "");
5486
5563
  r(
5487
5564
  [n._id],
5488
- convertDotNotationToObject(S, get(b, S.split(".")))
5489
- ), m({ formData: b }, k, { [S]: get(c, S) });
5565
+ convertDotNotationToObject(v, get(b, v.split(".")))
5566
+ ), m({ formData: b }, k, { [v]: get(c, v) });
5490
5567
  }
5491
5568
  }, x = keys(get(i, "_bindings", {})), j = useMemo(() => {
5492
5569
  const b = cloneDeep(get(l, "props", {}));
5493
- return each(b, (k, S) => {
5494
- get(k, "hidden", !1) && delete b[S];
5570
+ return each(b, (k, v) => {
5571
+ get(k, "hidden", !1) && delete b[v];
5495
5572
  }), u && each(x, (k) => delete b[k]), b;
5496
5573
  }, [l, x, u]), E = get(l, "server", !1);
5497
5574
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
@@ -5581,14 +5658,14 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5581
5658
  if (l) {
5582
5659
  n(!0), a(null);
5583
5660
  try {
5584
- const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((C) => C._id === x))];
5661
+ const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((R) => R._id === x))];
5585
5662
  set(b, "0._parent", null);
5586
- const k = u === p ? "" : u, S = await l(g, promptWithLanguage(j, m, g), b, k), { blocks: R, error: _ } = S;
5587
- if (_) {
5588
- a(_);
5663
+ const k = u === p ? "" : u, v = await l(g, promptWithLanguage(j, m, g), b, k), { blocks: C, error: B } = v;
5664
+ if (B) {
5665
+ a(B);
5589
5666
  return;
5590
5667
  }
5591
- g === "styles" ? c(R) : i(R), E && E(S);
5668
+ g === "styles" ? c(C) : i(C), E && E(v);
5592
5669
  } catch (b) {
5593
5670
  a(b);
5594
5671
  } finally {
@@ -5743,25 +5820,25 @@ const AskAIStyles = ({ blockId: o }) => {
5743
5820
  keys: ["name"]
5744
5821
  });
5745
5822
  function ManualClasses() {
5746
- var B;
5747
- const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (B = first(n)) == null ? void 0 : B.prop, g = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
5823
+ var _;
5824
+ const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (_ = first(n)) == null ? void 0 : _.prop, g = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
5748
5825
  const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5749
5826
  a(i, N, !0), u("");
5750
5827
  }, [j, E] = useState([]), b = ({ value: N }) => {
5751
5828
  const L = N.trim().toLowerCase(), P = L.match(/.+:/g);
5752
5829
  let f = [];
5753
5830
  if (P && P.length > 0) {
5754
- const [v] = P, w = L.replace(v, "");
5831
+ const [S] = P, w = L.replace(S, "");
5755
5832
  f = fuse.search(w).map((I) => ({
5756
5833
  ...I,
5757
- item: { ...I.item, name: v + I.item.name }
5834
+ item: { ...I.item, name: S + I.item.name }
5758
5835
  }));
5759
5836
  } else
5760
5837
  f = fuse.search(L);
5761
5838
  return E(map(f, "item"));
5762
5839
  }, k = () => {
5763
5840
  E([]);
5764
- }, S = (N) => N.name, R = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), _ = {
5841
+ }, v = (N) => N.name, C = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5765
5842
  autoComplete: "off",
5766
5843
  autoCorrect: "off",
5767
5844
  autoCapitalize: "off",
@@ -5773,7 +5850,7 @@ function ManualClasses() {
5773
5850
  },
5774
5851
  onChange: (N, { newValue: L }) => u(L),
5775
5852
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5776
- }, C = () => {
5853
+ }, R = () => {
5777
5854
  if (navigator.clipboard === void 0) {
5778
5855
  p({
5779
5856
  title: o("Clipboard not supported"),
@@ -5796,7 +5873,7 @@ function ManualClasses() {
5796
5873
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5797
5874
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
5798
5875
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5799
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: C, className: "cursor-pointer" }) }),
5876
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: R, className: "cursor-pointer" }) }),
5800
5877
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("Copy classes to clipboard") }) })
5801
5878
  ] })
5802
5879
  ] }),
@@ -5815,9 +5892,9 @@ function ManualClasses() {
5815
5892
  suggestions: j,
5816
5893
  onSuggestionsFetchRequested: b,
5817
5894
  onSuggestionsClearRequested: k,
5818
- getSuggestionValue: S,
5819
- renderSuggestion: R,
5820
- inputProps: _,
5895
+ getSuggestionValue: v,
5896
+ renderSuggestion: C,
5897
+ inputProps: B,
5821
5898
  containerProps: {
5822
5899
  className: "relative h-8 w-full gap-y-1 py-1 border-border"
5823
5900
  },
@@ -6506,50 +6583,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6506
6583
  },
6507
6584
  a
6508
6585
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6509
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [S, R] = useState(!1), [_, C] = useState(!1);
6586
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [v, C] = useState(!1), [B, R] = useState(!1);
6510
6587
  useEffect(() => {
6511
- const { value: f, unit: v } = getClassValueAndUnit(i);
6512
- if (v === "") {
6588
+ const { value: f, unit: S } = getClassValueAndUnit(i);
6589
+ if (S === "") {
6513
6590
  l(f), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6514
6591
  return;
6515
6592
  }
6516
- x(v), l(v === "class" || isEmpty(f) ? "" : f);
6593
+ x(S), l(S === "class" || isEmpty(f) ? "" : f);
6517
6594
  }, [i, u, p]);
6518
- const B = useThrottledCallback((f) => c(f), [c], THROTTLE_TIME), N = useThrottledCallback((f) => c(f, !1), [c], THROTTLE_TIME), L = useCallback(
6595
+ const _ = useThrottledCallback((f) => c(f), [c], THROTTLE_TIME), N = useThrottledCallback((f) => c(f, !1), [c], THROTTLE_TIME), L = useCallback(
6519
6596
  (f = !1) => {
6520
- const v = getUserInputValues(`${a}`, p);
6521
- if (get(v, "error", !1)) {
6597
+ const S = getUserInputValues(`${a}`, p);
6598
+ if (get(S, "error", !1)) {
6522
6599
  E(!0);
6523
6600
  return;
6524
6601
  }
6525
- const w = get(v, "unit") !== "" ? get(v, "unit") : g;
6602
+ const w = get(S, "unit") !== "" ? get(S, "unit") : g;
6526
6603
  if (w === "auto" || w === "none") {
6527
- B(`${d}${w}`);
6604
+ _(`${d}${w}`);
6528
6605
  return;
6529
6606
  }
6530
- if (get(v, "value") === "")
6607
+ if (get(S, "value") === "")
6531
6608
  return;
6532
- const I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6533
- f ? N(I) : B(I);
6609
+ const I = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6610
+ f ? N(I) : _(I);
6534
6611
  },
6535
- [B, N, a, g, d, p]
6612
+ [_, N, a, g, d, p]
6536
6613
  ), P = useCallback(
6537
6614
  (f) => {
6538
- const v = getUserInputValues(`${a}`, p);
6539
- if (get(v, "error", !1)) {
6615
+ const S = getUserInputValues(`${a}`, p);
6616
+ if (get(S, "error", !1)) {
6540
6617
  E(!0);
6541
6618
  return;
6542
6619
  }
6543
6620
  if (f === "auto" || f === "none") {
6544
- B(`${d}${f}`);
6621
+ _(`${d}${f}`);
6545
6622
  return;
6546
6623
  }
6547
- if (get(v, "value") === "")
6624
+ if (get(S, "value") === "")
6548
6625
  return;
6549
- const w = get(v, "unit") !== "" ? get(v, "unit") : f, I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6550
- B(I);
6626
+ const w = get(S, "unit") !== "" ? get(S, "unit") : f, I = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6627
+ _(I);
6551
6628
  },
6552
- [B, a, d, p]
6629
+ [_, a, d, p]
6553
6630
  );
6554
6631
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: g === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6555
6632
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
@@ -6557,7 +6634,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6557
6634
  /* @__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, {}) }) }),
6558
6635
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6559
6636
  ] })
6560
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${S ? "z-auto" : ""}`, children: [
6637
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
6561
6638
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6562
6639
  ["none", "auto"].indexOf(g) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6563
6640
  "input",
@@ -6569,25 +6646,25 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6569
6646
  onKeyDown: (f) => {
6570
6647
  if (f.keyCode !== 38 && f.keyCode !== 40)
6571
6648
  return;
6572
- f.preventDefault(), C(!0);
6573
- const v = parseInt$1(f.target.value);
6574
- let w = isNaN$1(v) ? 0 : v;
6649
+ f.preventDefault(), R(!0);
6650
+ const S = parseInt$1(f.target.value);
6651
+ let w = isNaN$1(S) ? 0 : S;
6575
6652
  f.keyCode === 38 && (w += 1), f.keyCode === 40 && (w -= 1);
6576
6653
  const A = `${w}`, T = `${A.startsWith("-") ? "-" : ""}${d}[${A.replace("-", "")}${g === "-" ? "" : g}]`;
6577
6654
  N(T);
6578
6655
  },
6579
6656
  onKeyUp: (f) => {
6580
- _ && (f.preventDefault(), C(!1));
6657
+ B && (f.preventDefault(), R(!1));
6581
6658
  },
6582
6659
  onBlur: () => L(),
6583
6660
  onChange: (f) => {
6584
6661
  E(!1), l(f.target.value);
6585
6662
  },
6586
6663
  onClick: (f) => {
6587
- var v;
6588
- (v = f == null ? void 0 : f.target) == null || v.select(), r(!1);
6664
+ var S;
6665
+ (S = f == null ? void 0 : f.target) == null || S.select(), r(!1);
6589
6666
  },
6590
- value: S ? b : a,
6667
+ value: v ? b : a,
6591
6668
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6592
6669
  " ",
6593
6670
  j ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -6619,21 +6696,21 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6619
6696
  ) }) })
6620
6697
  ] })
6621
6698
  ] }),
6622
- ["none", "auto"].indexOf(g) !== -1 || S ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6699
+ ["none", "auto"].indexOf(g) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6623
6700
  DragStyleButton,
6624
6701
  {
6625
- onDragStart: () => R(!0),
6702
+ onDragStart: () => C(!0),
6626
6703
  onDragEnd: (f) => {
6627
- if (k(() => ""), R(!1), isEmpty(f))
6704
+ if (k(() => ""), C(!1), isEmpty(f))
6628
6705
  return;
6629
- const v = `${f}`, A = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${g === "-" ? "" : g}]`;
6630
- B(A);
6706
+ const S = `${f}`, A = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${g === "-" ? "" : g}]`;
6707
+ _(A);
6631
6708
  },
6632
6709
  onDrag: (f) => {
6633
6710
  if (isEmpty(f))
6634
6711
  return;
6635
6712
  k(f);
6636
- const v = `${f}`, A = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${g === "-" ? "" : g}]`;
6713
+ const S = `${f}`, A = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${g === "-" ? "" : g}]`;
6637
6714
  N(A);
6638
6715
  },
6639
6716
  currentValue: a,
@@ -6739,15 +6816,15 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6739
6816
  x(E, [f], L);
6740
6817
  },
6741
6818
  [E, u, m, p, l, x]
6742
- ), S = useCallback(() => {
6819
+ ), v = useCallback(() => {
6743
6820
  j(E, [b]);
6744
- }, [E, b, j]), R = useMemo(() => canChangeClass(g, m), [g, m]);
6821
+ }, [E, b, j]), C = useMemo(() => canChangeClass(g, m), [g, m]);
6745
6822
  useEffect(() => {
6746
- i(R, g);
6747
- }, [R, i, g]);
6748
- const [, , _] = useCanvasWidth(), C = useCallback(
6823
+ i(C, g);
6824
+ }, [C, i, g]);
6825
+ const [, , B] = useCanvasWidth(), R = useCallback(
6749
6826
  (N) => {
6750
- _({
6827
+ B({
6751
6828
  xs: 400,
6752
6829
  sm: 640,
6753
6830
  md: 800,
@@ -6756,10 +6833,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6756
6833
  "2xl": 1920
6757
6834
  }[N]);
6758
6835
  },
6759
- [_]
6760
- ), B = get(g, "dark", null) === u && get(g, "mod", null) === p && get(g, "mq", null) === m;
6761
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: R, canReset: g && B, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6762
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !B ? "text-foreground" : ""}`, children: n(a) }) }),
6836
+ [B]
6837
+ ), _ = get(g, "dark", null) === u && get(g, "mod", null) === p && get(g, "mq", null) === m;
6838
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: g && _, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6839
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !_ ? "text-foreground" : ""}`, children: n(a) }) }),
6763
6840
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6764
6841
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6765
6842
  r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -6778,7 +6855,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6778
6855
  r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6779
6856
  r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6780
6857
  ] }),
6781
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: B ? /* @__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" }) }) : R && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6858
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: _ ? /* @__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" }) }) : C && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6782
6859
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6783
6860
  "button",
6784
6861
  {
@@ -6798,7 +6875,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6798
6875
  "button",
6799
6876
  {
6800
6877
  type: "button",
6801
- onClick: () => C(get(g, "mq")),
6878
+ onClick: () => R(get(g, "mq")),
6802
6879
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6803
6880
  children: [
6804
6881
  "Switch to ",
@@ -7056,8 +7133,8 @@ const BlockCard = ({
7056
7133
  parentId: r = void 0
7057
7134
  }) => {
7058
7135
  const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), m = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
7059
- const S = has(k, "styles_attrs.data-page-section");
7060
- return k._type === "Box" && S;
7136
+ const v = has(k, "styles_attrs.data-page-section");
7137
+ return k._type === "Box" && v;
7061
7138
  }, E = useCallback(
7062
7139
  async (k) => {
7063
7140
  if (k.stopPropagation(), has(o, "component")) {
@@ -7065,23 +7142,23 @@ const BlockCard = ({
7065
7142
  return;
7066
7143
  }
7067
7144
  l(!0);
7068
- const S = await i(n, o);
7069
- isEmpty(S) || d(syncBlocksWithDefaults(S), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7145
+ const v = await i(n, o);
7146
+ isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7070
7147
  },
7071
7148
  [o]
7072
7149
  ), b = async (k) => {
7073
- const S = await i(n, o);
7074
- let R = r;
7075
- if (j(first(S)) && (R = null), !isEmpty(S)) {
7076
- const _ = { blocks: S, uiLibrary: !0, parent: R };
7077
- if (k.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
7078
- const C = new Image();
7079
- C.src = o.preview, C.onload = () => {
7080
- k.dataTransfer.setDragImage(C, 0, 0);
7150
+ const v = await i(n, o);
7151
+ let C = r;
7152
+ if (j(first(v)) && (C = null), !isEmpty(v)) {
7153
+ const B = { blocks: v, uiLibrary: !0, parent: C };
7154
+ if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
7155
+ const R = new Image();
7156
+ R.src = o.preview, R.onload = () => {
7157
+ k.dataTransfer.setDragImage(R, 0, 0);
7081
7158
  };
7082
7159
  } else
7083
7160
  k.dataTransfer.setDragImage(new Image(), 0, 0);
7084
- x(_), setTimeout(() => {
7161
+ x(B), setTimeout(() => {
7085
7162
  u([]), p(), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7086
7163
  }, 200);
7087
7164
  }
@@ -7122,9 +7199,9 @@ const BlockCard = ({
7122
7199
  })();
7123
7200
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
7124
7201
  }, UILibrarySection = ({ parentId: o }) => {
7125
- const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((R) => R.category === "custom"), c = a.find((R) => R.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, g] = useState("Hero"), x = get(p, m, []), j = useRef(null), { t: E } = useTranslation(), b = (R) => {
7202
+ const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((C) => C.category === "custom"), c = a.find((C) => C.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, g] = useState("Hero"), x = get(p, m, []), j = useRef(null), { t: E } = useTranslation(), b = (C) => {
7126
7203
  j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
7127
- j.current && g(R);
7204
+ j.current && g(C);
7128
7205
  }, 300);
7129
7206
  };
7130
7207
  if (u)
@@ -7132,7 +7209,7 @@ const BlockCard = ({
7132
7209
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7133
7210
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7134
7211
  ] });
7135
- const k = filter(x, (R, _) => _ % 2 === 0), S = filter(x, (R, _) => _ % 2 === 1);
7212
+ const k = filter(x, (C, B) => B % 2 === 0), v = filter(x, (C, B) => B % 2 === 1);
7136
7213
  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: [
7137
7214
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7138
7215
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
@@ -7140,22 +7217,22 @@ const BlockCard = ({
7140
7217
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: E("Groups") }),
7141
7218
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7142
7219
  /* @__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(
7143
- map(p, (R, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7220
+ map(p, (C, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7144
7221
  "div",
7145
7222
  {
7146
- onMouseEnter: () => b(_),
7223
+ onMouseEnter: () => b(B),
7147
7224
  onMouseLeave: () => clearTimeout(j.current),
7148
- onClick: () => g(_),
7225
+ onClick: () => g(B),
7149
7226
  className: cn(
7150
7227
  "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",
7151
- _ === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7228
+ B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7152
7229
  ),
7153
7230
  children: [
7154
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(_.toLowerCase())) }),
7231
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(B.toLowerCase())) }),
7155
7232
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7156
7233
  ]
7157
7234
  },
7158
- _
7235
+ B
7159
7236
  ))
7160
7237
  ) })
7161
7238
  ] })
@@ -7168,10 +7245,10 @@ const BlockCard = ({
7168
7245
  children: [
7169
7246
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7170
7247
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7171
- k.map((R) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: R, library: c }))
7248
+ k.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7172
7249
  ) }),
7173
7250
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7174
- S.map((R) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: R, library: c }))
7251
+ v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7175
7252
  ) })
7176
7253
  ] }),
7177
7254
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8249,32 +8326,32 @@ const AIUserPrompt = ({ blockId: o }) => {
8249
8326
  return;
8250
8327
  }
8251
8328
  if (i) {
8252
- const C = [...a, { key: i, value: d }];
8253
- r(C), l(a), c(""), u(""), x("");
8329
+ const R = [...a, { key: i, value: d }];
8330
+ r(R), l(a), c(""), u(""), x("");
8254
8331
  }
8255
- }, k = (C) => {
8256
- const B = a.filter((N, L) => L !== C);
8257
- r(B), l(B);
8258
- }, S = (C) => {
8259
- m(C), c(a[C].key), u(a[C].value);
8260
- }, R = () => {
8332
+ }, k = (R) => {
8333
+ const _ = a.filter((N, L) => L !== R);
8334
+ r(_), l(_);
8335
+ }, v = (R) => {
8336
+ m(R), c(a[R].key), u(a[R].value);
8337
+ }, C = () => {
8261
8338
  if (i.startsWith("@")) {
8262
8339
  x("Attribute keys cannot start with '@'");
8263
8340
  return;
8264
8341
  }
8265
8342
  if (p !== null && i) {
8266
- const C = [...a];
8267
- C[p] = { key: i, value: d }, r(C), l(C), m(null), c(""), u(""), x("");
8343
+ const R = [...a];
8344
+ R[p] = { key: i, value: d }, r(R), l(R), m(null), c(""), u(""), x("");
8268
8345
  }
8269
- }, _ = (C) => {
8270
- C.key === "Enter" && !C.shiftKey && (C.preventDefault(), p !== null ? R() : b());
8346
+ }, B = (R) => {
8347
+ R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? C() : b());
8271
8348
  };
8272
8349
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
8273
8350
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8274
8351
  "form",
8275
8352
  {
8276
- onSubmit: (C) => {
8277
- C.preventDefault(), p !== null ? R() : b();
8353
+ onSubmit: (R) => {
8354
+ R.preventDefault(), p !== null ? C() : b();
8278
8355
  },
8279
8356
  className: "space-y-3",
8280
8357
  children: [
@@ -8290,7 +8367,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8290
8367
  id: "attrKey",
8291
8368
  ref: j,
8292
8369
  value: i,
8293
- onChange: (C) => c(C.target.value),
8370
+ onChange: (R) => c(R.target.value),
8294
8371
  placeholder: "Key",
8295
8372
  className: "h-8 text-sm"
8296
8373
  }
@@ -8308,8 +8385,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8308
8385
  rows: 2,
8309
8386
  ref: E,
8310
8387
  value: d,
8311
- onChange: (C) => u(C.target.value),
8312
- onKeyDown: _,
8388
+ onChange: (R) => u(R.target.value),
8389
+ onKeyDown: B,
8313
8390
  placeholder: "Value",
8314
8391
  className: "bg-background text-sm"
8315
8392
  }
@@ -8321,22 +8398,22 @@ const AIUserPrompt = ({ blockId: o }) => {
8321
8398
  ]
8322
8399
  }
8323
8400
  ),
8324
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((C, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8401
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((R, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8325
8402
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
8326
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: C.key }),
8327
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: C.value.toString() })
8403
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: R.key }),
8404
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: R.value.toString() })
8328
8405
  ] }),
8329
8406
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
8330
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(B), children: [
8407
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(_), children: [
8331
8408
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
8332
8409
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
8333
8410
  ] }),
8334
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(B), children: [
8411
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(_), children: [
8335
8412
  /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
8336
8413
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
8337
8414
  ] })
8338
8415
  ] })
8339
- ] }, B)) })
8416
+ ] }, _)) })
8340
8417
  ] });
8341
8418
  }), BlockAttributesEditor = React.memo(() => {
8342
8419
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -8759,9 +8836,9 @@ const PageDataProviders = () => {
8759
8836
  (b) => !isNull(b)
8760
8837
  ), x = (b) => {
8761
8838
  const k = find(n, { providerKey: b });
8762
- c((S) => [...S, k]), a((S) => [...S, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8839
+ c((v) => [...v, k]), a((v) => [...v, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8763
8840
  }, j = (b) => {
8764
- c((k) => filter(k, (S) => S.providerKey !== b.providerKey)), a((k) => filter(k, (S) => S.providerKey !== b.providerKey)), l("UNSAVED");
8841
+ c((k) => filter(k, (v) => v.providerKey !== b.providerKey)), a((k) => filter(k, (v) => v.providerKey !== b.providerKey)), l("UNSAVED");
8765
8842
  }, E = (b) => m(b);
8766
8843
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8767
8844
  o("You have no data providers registered. Please add a data provider to your project."),
@@ -8858,7 +8935,7 @@ const PageDataProviders = () => {
8858
8935
  function AiFillDatabase(o) {
8859
8936
  return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
8860
8937
  }
8861
- const TopBar = lazy(() => import("./Topbar-AVw1fDtS.js"));
8938
+ const TopBar = lazy(() => import("./Topbar-Lvb5K8c2.js"));
8862
8939
  function useSidebarMenuItems(o) {
8863
8940
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8864
8941
  return useMemo(() => {
@@ -9005,7 +9082,7 @@ const RootLayout = () => {
9005
9082
  }, useAutoSave = () => {
9006
9083
  const { savePage: o } = useSavePage(), n = useBuilderProp("autoSaveSupport", !0), r = useBuilderProp("autoSaveInterval", 60);
9007
9084
  useIntervalEffect(() => {
9008
- n && o();
9085
+ n && o(!0);
9009
9086
  }, r * 1e3);
9010
9087
  }, ChaiBuilderComponent = (o) => {
9011
9088
  const [, n] = useBlocksStore(), [, r] = useBrandingOptions(), a = useBuilderReset(), [l] = useAtom(builderSaveStateAtom), i = useMemo(() => o.layout || RootLayout, [o.layout]);