@chaibuilder/sdk 1.2.96 → 1.2.98

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,14 +1,14 @@
1
- var W = Object.defineProperty;
2
- var G = (o, n, r) => n in o ? W(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);
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 U = (o, n, r) => (W(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 { S as Skeleton, B as Button, C as ContextMenu, a as ContextMenuTrigger, b as ContextMenuContent, c as ContextMenuItem, T as Tooltip, d as TooltipTrigger, e as TooltipContent, f as Card, g as CardHeader, h as CardDescription, i as CardContent, L as Label, j as Textarea, k as CardFooter, D as Dialog, l as DialogTrigger, m as DialogContent, n as DialogHeader, o as DialogTitle, p as DialogDescription, q as DialogFooter, P as Popover, r as PopoverTrigger, s as PopoverContent, t as Command, u as CommandInput, v as CommandList, w as CommandEmpty, x as CommandGroup, y as CommandItem, z as Tabs, A as TabsList, E as TabsTrigger, F as TabsContent, G as Switch, H as Accordion, I as AccordionItem, J as AccordionTrigger, K as AccordionContent, M as useToast, N as Input$1, O as TooltipPortal, Q as DropdownMenu, R as DropdownMenuTrigger, U as DropdownMenuContent, V as ScrollArea, W as DropdownMenuLabel, X as DropdownMenuSeparator, Y as DropdownMenuGroup, Z as DropdownMenuItem, _ as DropdownMenuShortcut, $ as AlertDialog, a0 as AlertDialogContent, a1 as AlertDialogHeader, a2 as AlertDialogTitle, a3 as AlertDialogTrigger, a4 as AlertDialogDescription, a5 as AlertDialogFooter, a6 as AlertDialogCancel, a7 as AlertDialogAction, a8 as DropdownMenuCheckboxItem, a9 as HoverCard, aa as HoverCardTrigger, ab as HoverCardContent, ac as Separator, ad as Badge, ae as Select, af as SelectTrigger, ag as SelectValue, ah as SelectContent, ai as SelectItem, aj as TooltipProvider, ak as Toaster } from "./context-menu-9cWJcKdh.js";
8
8
  import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, chunk, forEach, throttle, memoize, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, cloneDeep, 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
- import { g as generateUUID, a as getBreakpointValue, f, y, h, c as cn, G as GenIcon } from "./iconBase-HBZkvN04.js";
11
- import { getBlockComponent, getChaiDataProviders, useGlobalStylingPresets, useChaiBlocks, syncBlocksWithDefaults } from "@chaibuilder/runtime";
10
+ import { g as generateUUID, a as getBreakpointValue, y, s, h, c as cn, G as GenIcon } from "./iconBase-RFUjwZUN.js";
11
+ import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
12
12
  import { useTranslation, initReactI18next } from "react-i18next";
13
13
  import { g as getDefaultExportFromCjs, p as plugin } from "./plugin-ooqqxWRQ.js";
14
14
  import { useThrottledCallback, useResizeObserver, useDebouncedCallback, useIntervalEffect } from "@react-hookz/web";
@@ -89,278 +89,278 @@ 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 = (j) => o.get(j), d = (j, k) => {
93
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(k);
94
- const S = o.get(j);
95
- if (o.set(j, k), r.has(j) || r.set(j, S), S && hasPromiseAtomValue(S)) {
96
- const R = "v" in k ? k.v instanceof Promise ? k.v : Promise.resolve(k.v) : Promise.reject(k.e);
97
- cancelPromise(S.v, R);
92
+ const c = (b) => o.get(b), d = (b, _) => {
93
+ (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(_);
94
+ const R = o.get(b);
95
+ if (o.set(b, _), r.has(b) || r.set(b, R), R && hasPromiseAtomValue(R)) {
96
+ const v = "v" in _ ? _.v instanceof Promise ? _.v : Promise.resolve(_.v) : Promise.reject(_.e);
97
+ cancelPromise(R.v, v);
98
98
  }
99
- }, u = (j, k, S) => {
100
- const R = /* @__PURE__ */ new Map();
101
- let T = !1;
102
- S.forEach((D, $) => {
103
- !D && $ === j && (D = k), D ? (R.set($, D), k.d.get($) !== D && (T = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
- }), (T || k.d.size !== R.size) && (k.d = R);
105
- }, p = (j, k, S) => {
106
- const R = c(j), T = {
107
- d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
108
- v: k
99
+ }, u = (b, _, R) => {
100
+ const v = /* @__PURE__ */ new Map();
101
+ let I = !1;
102
+ R.forEach((L, P) => {
103
+ !L && P === b && (L = _), L ? (v.set(P, L), _.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
+ }), (I || _.d.size !== v.size) && (_.d = v);
105
+ }, p = (b, _, R) => {
106
+ const v = c(b), I = {
107
+ d: (v == null ? void 0 : v.d) || /* @__PURE__ */ new Map(),
108
+ v: _
109
109
  };
110
- if (S && u(j, T, S), R && isEqualAtomValue(R, T) && R.d === T.d)
111
- return R;
112
- if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(T) && isEqualPromiseAtomValue(R, T)) {
113
- if (R.d === T.d)
114
- return R;
115
- T.v = R.v;
110
+ if (R && u(b, I, R), v && isEqualAtomValue(v, I) && v.d === I.d)
111
+ return v;
112
+ if (v && hasPromiseAtomValue(v) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(v, I)) {
113
+ if (v.d === I.d)
114
+ return v;
115
+ I.v = v.v;
116
116
  }
117
- return d(j, T), T;
118
- }, g = (j, k, S, R) => {
119
- if (isPromiseLike$2(k)) {
120
- let T;
121
- const D = new Promise(($, H) => {
122
- let M = !1;
123
- k.then(
124
- (V) => {
125
- if (!M) {
126
- M = !0;
127
- const O = c(j), U = p(
128
- j,
129
- D,
130
- S
117
+ return d(b, I), I;
118
+ }, m = (b, _, R, v) => {
119
+ if (isPromiseLike$2(_)) {
120
+ let I;
121
+ const L = new Promise((P, V) => {
122
+ let $ = !1;
123
+ _.then(
124
+ (O) => {
125
+ if (!$) {
126
+ $ = !0;
127
+ const M = c(b), H = p(
128
+ b,
129
+ L,
130
+ R
131
131
  );
132
- resolvePromise(D, V), $(V), (O == null ? void 0 : O.d) !== U.d && N(j, U, O == null ? void 0 : O.d);
132
+ resolvePromise(L, O), P(O), (M == null ? void 0 : M.d) !== H.d && N(b, H, M == null ? void 0 : M.d);
133
133
  }
134
134
  },
135
- (V) => {
136
- if (!M) {
137
- M = !0;
138
- const O = c(j), U = p(
139
- j,
140
- D,
141
- S
135
+ (O) => {
136
+ if (!$) {
137
+ $ = !0;
138
+ const M = c(b), H = p(
139
+ b,
140
+ L,
141
+ R
142
142
  );
143
- rejectPromise(D, V), H(V), (O == null ? void 0 : O.d) !== U.d && N(j, U, O == null ? void 0 : O.d);
143
+ rejectPromise(L, O), V(O), (M == null ? void 0 : M.d) !== H.d && N(b, H, M == null ? void 0 : M.d);
144
144
  }
145
145
  }
146
- ), T = (V) => {
147
- M || (M = !0, V.then(
148
- (O) => resolvePromise(D, O),
149
- (O) => rejectPromise(D, O)
150
- ), $(V));
146
+ ), I = (O) => {
147
+ $ || ($ = !0, O.then(
148
+ (M) => resolvePromise(L, M),
149
+ (M) => rejectPromise(L, M)
150
+ ), P(O));
151
151
  };
152
152
  });
153
- return D.orig = k, D.status = "pending", registerCancelPromise(D, ($) => {
154
- $ && T($), R == null || R();
155
- }), p(j, D, S);
153
+ return L.orig = _, L.status = "pending", registerCancelPromise(L, (P) => {
154
+ P && I(P), v == null || v();
155
+ }), p(b, L, R);
156
156
  }
157
- return p(j, k, S);
158
- }, x = (j, k, S) => {
159
- const R = c(j), T = {
160
- d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
161
- e: k
157
+ return p(b, _, R);
158
+ }, x = (b, _, R) => {
159
+ const v = c(b), I = {
160
+ d: (v == null ? void 0 : v.d) || /* @__PURE__ */ new Map(),
161
+ e: _
162
162
  };
163
- return S && u(j, T, S), R && isEqualAtomError(R, T) && R.d === T.d ? R : (d(j, T), T);
164
- }, m = (j) => {
165
- const k = c(j);
166
- if (k && (k.d.forEach((M, V) => {
167
- V !== j && !n.has(V) && m(V);
168
- }), Array.from(k.d).every(([M, V]) => {
169
- const O = c(M);
170
- return M === j || O === V || // TODO This is a hack, we should find a better solution.
171
- O && !hasPromiseAtomValue(O) && isEqualAtomValue(O, V);
163
+ return R && u(b, I, R), v && isEqualAtomError(v, I) && v.d === I.d ? v : (d(b, I), I);
164
+ }, g = (b) => {
165
+ const _ = c(b);
166
+ if (_ && (_.d.forEach(($, O) => {
167
+ O !== b && !n.has(O) && g(O);
168
+ }), Array.from(_.d).every(([$, O]) => {
169
+ const M = c($);
170
+ return $ === b || M === O || // TODO This is a hack, we should find a better solution.
171
+ M && !hasPromiseAtomValue(M) && isEqualAtomValue(M, O);
172
172
  })))
173
- return k;
174
- const S = /* @__PURE__ */ new Map();
175
- let R = !0;
176
- const T = (M) => {
177
- if (M === j) {
178
- const O = c(M);
179
- if (O)
180
- return S.set(M, O), returnAtomValue(O);
181
- if (hasInitialValue(M))
182
- return S.set(M, void 0), M.init;
173
+ return _;
174
+ const R = /* @__PURE__ */ new Map();
175
+ let v = !0;
176
+ const I = ($) => {
177
+ if ($ === b) {
178
+ const M = c($);
179
+ if (M)
180
+ return R.set($, M), returnAtomValue(M);
181
+ if (hasInitialValue($))
182
+ return R.set($, void 0), $.init;
183
183
  throw new Error("no atom init");
184
184
  }
185
- const V = m(M);
186
- return S.set(M, V), returnAtomValue(V);
185
+ const O = g($);
186
+ return R.set($, O), returnAtomValue(O);
187
187
  };
188
- let D, $;
189
- const H = {
188
+ let L, P;
189
+ const V = {
190
190
  get signal() {
191
- return D || (D = new AbortController()), D.signal;
191
+ return L || (L = new AbortController()), L.signal;
192
192
  },
193
193
  get setSelf() {
194
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(j) && console.warn("setSelf function cannot be used with read-only atom"), !$ && isActuallyWritableAtom(j) && ($ = (...M) => {
195
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
196
- return I(j, ...M);
197
- }), $;
194
+ return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(b) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(b) && (P = (...$) => {
195
+ if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && v && console.warn("setSelf function cannot be called in sync"), !v)
196
+ return B(b, ...$);
197
+ }), P;
198
198
  }
199
199
  };
200
200
  try {
201
- const M = j.read(T, H);
202
- return g(
203
- j,
204
- M,
205
- S,
206
- () => D == null ? void 0 : D.abort()
201
+ const $ = b.read(I, V);
202
+ return m(
203
+ b,
204
+ $,
205
+ R,
206
+ () => L == null ? void 0 : L.abort()
207
207
  );
208
- } catch (M) {
209
- return x(j, M, S);
208
+ } catch ($) {
209
+ return x(b, $, R);
210
210
  } finally {
211
- R = !1;
211
+ v = !1;
212
212
  }
213
- }, E = (j) => returnAtomValue(m(j)), b = (j) => {
214
- let k = n.get(j);
215
- return k || (k = w(j)), k;
216
- }, _ = (j, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(j)), v = (j) => {
217
- const k = n.get(j);
218
- k && _(j, k) && A(j);
219
- }, B = (j) => {
220
- const k = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new WeakMap(), R = (D) => {
221
- const $ = n.get(D);
222
- $ == null || $.t.forEach((H) => {
223
- H !== D && (k.set(
224
- H,
225
- (k.get(H) || /* @__PURE__ */ new Set()).add(D)
226
- ), S.set(H, (S.get(H) || 0) + 1), R(H));
213
+ }, E = (b) => returnAtomValue(g(b)), f = (b) => {
214
+ let _ = n.get(b);
215
+ return _ || (_ = C(b)), _;
216
+ }, j = (b, _) => !_.l.size && (!_.t.size || _.t.size === 1 && _.t.has(b)), k = (b) => {
217
+ const _ = n.get(b);
218
+ _ && j(b, _) && w(b);
219
+ }, A = (b) => {
220
+ const _ = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), v = (L) => {
221
+ const P = n.get(L);
222
+ P == null || P.t.forEach((V) => {
223
+ V !== L && (_.set(
224
+ V,
225
+ (_.get(V) || /* @__PURE__ */ new Set()).add(L)
226
+ ), R.set(V, (R.get(V) || 0) + 1), v(V));
227
227
  });
228
228
  };
229
- R(j);
230
- const T = (D) => {
231
- const $ = n.get(D);
232
- $ == null || $.t.forEach((H) => {
233
- var M;
234
- if (H !== D) {
235
- let V = S.get(H);
236
- if (V && S.set(H, --V), !V) {
237
- let O = !!((M = k.get(H)) != null && M.size);
238
- if (O) {
239
- const U = c(H), z = m(H);
240
- O = !U || !isEqualAtomValue(U, z);
229
+ v(b);
230
+ const I = (L) => {
231
+ const P = n.get(L);
232
+ P == null || P.t.forEach((V) => {
233
+ var $;
234
+ if (V !== L) {
235
+ let O = R.get(V);
236
+ if (O && R.set(V, --O), !O) {
237
+ let M = !!(($ = _.get(V)) != null && $.size);
238
+ if (M) {
239
+ const H = c(V), F = g(V);
240
+ M = !H || !isEqualAtomValue(H, F);
241
241
  }
242
- O || k.forEach((U) => U.delete(H));
242
+ M || _.forEach((H) => H.delete(V));
243
243
  }
244
- T(H);
244
+ I(V);
245
245
  }
246
246
  });
247
247
  };
248
- T(j);
249
- }, C = (j, ...k) => {
250
- let S = !0;
251
- const R = ($) => returnAtomValue(m($)), T = ($, ...H) => {
252
- let M;
253
- if ($ === j) {
254
- if (!hasInitialValue($))
248
+ I(b);
249
+ }, S = (b, ..._) => {
250
+ let R = !0;
251
+ const v = (P) => returnAtomValue(g(P)), I = (P, ...V) => {
252
+ let $;
253
+ if (P === b) {
254
+ if (!hasInitialValue(P))
255
255
  throw new Error("atom not writable");
256
- const V = c($), O = g($, H[0]);
257
- (!V || !isEqualAtomValue(V, O)) && B($);
256
+ const O = c(P), M = m(P, V[0]);
257
+ (!O || !isEqualAtomValue(O, M)) && A(P);
258
258
  } else
259
- M = C($, ...H);
260
- if (!S) {
261
- const V = P();
259
+ $ = S(P, ...V);
260
+ if (!R) {
261
+ const O = D();
262
262
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
263
- (O) => O({ type: "async-write", flushed: V })
263
+ (M) => M({ type: "async-write", flushed: O })
264
264
  );
265
265
  }
266
- return M;
267
- }, D = j.write(R, T, ...k);
268
- return S = !1, D;
269
- }, I = (j, ...k) => {
270
- const S = C(j, ...k), R = P();
266
+ return $;
267
+ }, L = b.write(v, I, ..._);
268
+ return R = !1, L;
269
+ }, B = (b, ..._) => {
270
+ const R = S(b, ..._), v = D();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (T) => T({ type: "write", flushed: R })
273
- ), S;
274
- }, w = (j, k) => {
275
- const S = {
276
- t: new Set(k && [k]),
272
+ (I) => I({ type: "write", flushed: v })
273
+ ), R;
274
+ }, C = (b, _) => {
275
+ const R = {
276
+ t: new Set(_ && [_]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
- if (n.set(j, S), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(j), m(j).d.forEach((R, T) => {
280
- const D = n.get(T);
281
- D ? D.t.add(j) : T !== j && w(T, j);
282
- }), m(j), isActuallyWritableAtom(j) && j.onMount) {
283
- const R = j.onMount((...T) => I(j, ...T));
284
- R && (S.u = R);
279
+ if (n.set(b, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), g(b).d.forEach((v, I) => {
280
+ const L = n.get(I);
281
+ L ? L.t.add(b) : I !== b && C(I, b);
282
+ }), g(b), isActuallyWritableAtom(b) && b.onMount) {
283
+ const v = b.onMount((...I) => B(b, ...I));
284
+ v && (R.u = v);
285
285
  }
286
- return S;
287
- }, A = (j) => {
288
- var k;
289
- const S = (k = n.get(j)) == null ? void 0 : k.u;
290
- S && S(), n.delete(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(j);
291
- const R = c(j);
292
- R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((T, D) => {
293
- if (D !== j) {
294
- const $ = n.get(D);
295
- $ && ($.t.delete(j), _(D, $) && A(D));
286
+ return R;
287
+ }, w = (b) => {
288
+ var _;
289
+ const R = (_ = n.get(b)) == null ? void 0 : _.u;
290
+ R && R(), n.delete(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(b);
291
+ const v = c(b);
292
+ v ? (hasPromiseAtomValue(v) && cancelPromise(v.v), v.d.forEach((I, L) => {
293
+ if (L !== b) {
294
+ const P = n.get(L);
295
+ P && (P.t.delete(b), j(L, P) && w(L));
296
296
  }
297
- })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", j);
298
- }, N = (j, k, S) => {
299
- const R = new Set(k.d.keys());
300
- S == null || S.forEach((T, D) => {
301
- if (R.has(D)) {
302
- R.delete(D);
297
+ })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", b);
298
+ }, N = (b, _, R) => {
299
+ const v = new Set(_.d.keys());
300
+ R == null || R.forEach((I, L) => {
301
+ if (v.has(L)) {
302
+ v.delete(L);
303
303
  return;
304
304
  }
305
- const $ = n.get(D);
306
- $ && ($.t.delete(j), _(D, $) && A(D));
307
- }), R.forEach((T) => {
308
- const D = n.get(T);
309
- D ? D.t.add(j) : n.has(j) && w(T, j);
305
+ const P = n.get(L);
306
+ P && (P.t.delete(b), j(L, P) && w(L));
307
+ }), v.forEach((I) => {
308
+ const L = n.get(I);
309
+ L ? L.t.add(b) : n.has(b) && C(I, b);
310
310
  });
311
- }, P = () => {
312
- let j;
313
- for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (j = /* @__PURE__ */ new Set()); r.size; ) {
314
- const k = Array.from(r);
315
- r.clear(), k.forEach(([S, R]) => {
316
- const T = c(S);
317
- if (T) {
318
- T.d !== (R == null ? void 0 : R.d) && N(S, T, R == null ? void 0 : R.d);
319
- const D = n.get(S);
320
- D && !// TODO This seems pretty hacky. Hope to fix it.
311
+ }, D = () => {
312
+ let b;
313
+ for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (b = /* @__PURE__ */ new Set()); r.size; ) {
314
+ const _ = Array.from(r);
315
+ r.clear(), _.forEach(([R, v]) => {
316
+ const I = c(R);
317
+ if (I) {
318
+ I.d !== (v == null ? void 0 : v.d) && N(R, I, v == null ? void 0 : v.d);
319
+ const L = n.get(R);
320
+ L && !// TODO This seems pretty hacky. Hope to fix it.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
322
- (R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, T) || isEqualAtomError(R, T))) && (D.l.forEach(($) => $()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && j.add(S));
322
+ (v && !hasPromiseAtomValue(v) && (isEqualAtomValue(v, I) || isEqualAtomError(v, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && b.add(R));
323
323
  } else
324
324
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
325
325
  });
326
326
  }
327
327
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
328
- return a.forEach((k) => k("state")), j;
329
- }, L = (j, k) => {
330
- const S = b(j), R = P(), T = S.l;
331
- return T.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((D) => D("sub")), l.forEach(
332
- (D) => D({ type: "sub", flushed: R })
328
+ return a.forEach((_) => _("state")), b;
329
+ }, T = (b, _) => {
330
+ const R = f(b), v = D(), I = R.l;
331
+ return I.add(_), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
332
+ (L) => L({ type: "sub", flushed: v })
333
333
  )), () => {
334
- T.delete(k), v(j), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((D) => D("unsub")), l.forEach((D) => D({ type: "unsub" })));
334
+ I.delete(_), k(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
338
338
  get: E,
339
- set: I,
340
- sub: L,
339
+ set: B,
340
+ sub: T,
341
341
  // store dev methods (these are tentative and subject to change without notice)
342
- dev_subscribe_store: (j, k) => k !== 2 ? (console.warn(
342
+ dev_subscribe_store: (b, _) => _ !== 2 ? (console.warn(
343
343
  "The current StoreListener revision is 2. The older ones are deprecated."
344
- ), a.add(j), () => {
345
- a.delete(j);
346
- }) : (l.add(j), () => {
347
- l.delete(j);
344
+ ), a.add(b), () => {
345
+ a.delete(b);
346
+ }) : (l.add(b), () => {
347
+ l.delete(b);
348
348
  }),
349
349
  dev_get_mounted_atoms: () => i.values(),
350
- dev_get_atom_state: (j) => o.get(j),
351
- dev_get_mounted: (j) => n.get(j),
352
- dev_restore_atoms: (j) => {
353
- for (const [S, R] of j)
354
- hasInitialValue(S) && (g(S, R), B(S));
355
- const k = P();
350
+ dev_get_atom_state: (b) => o.get(b),
351
+ dev_get_mounted: (b) => n.get(b),
352
+ dev_restore_atoms: (b) => {
353
+ for (const [R, v] of b)
354
+ hasInitialValue(R) && (m(R, v), A(R));
355
+ const _ = D();
356
356
  l.forEach(
357
- (S) => S({ type: "restore", flushed: k })
357
+ (R) => R({ type: "restore", flushed: _ })
358
358
  );
359
359
  }
360
360
  } : {
361
361
  get: E,
362
- set: I,
363
- sub: L
362
+ set: B,
363
+ sub: T
364
364
  };
365
365
  };
366
366
  let defaultStore;
@@ -377,37 +377,37 @@ function splitAtom(o, n) {
377
377
  let u = r.get(c);
378
378
  if (u)
379
379
  return u;
380
- const p = d && r.get(d), g = [], x = [];
381
- return c.forEach((m, E) => {
382
- const b = n ? n(m) : E;
383
- x[E] = b;
384
- const _ = p && p.atomList[p.keyList.indexOf(b)];
385
- if (_) {
386
- g[E] = _;
380
+ const p = d && r.get(d), m = [], x = [];
381
+ return c.forEach((g, E) => {
382
+ const f = n ? n(g) : E;
383
+ x[E] = f;
384
+ const j = p && p.atomList[p.keyList.indexOf(f)];
385
+ if (j) {
386
+ m[E] = j;
387
387
  return;
388
388
  }
389
- const v = (C) => {
390
- const I = C(l), w = C(o), N = a(w, I == null ? void 0 : I.arr).keyList.indexOf(b);
391
- if (N < 0 || N >= w.length) {
392
- const P = c[a(c).keyList.indexOf(b)];
393
- if (P)
394
- return P;
389
+ const k = (S) => {
390
+ const B = S(l), C = S(o), N = a(C, B == null ? void 0 : B.arr).keyList.indexOf(f);
391
+ if (N < 0 || N >= C.length) {
392
+ const D = c[a(c).keyList.indexOf(f)];
393
+ if (D)
394
+ return D;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return w[N];
398
- }, B = (C, I, w) => {
399
- const A = C(l), N = C(o), L = a(N, A == null ? void 0 : A.arr).keyList.indexOf(b);
400
- if (L < 0 || L >= N.length)
397
+ return C[N];
398
+ }, A = (S, B, C) => {
399
+ const w = S(l), N = S(o), T = a(N, w == null ? void 0 : w.arr).keyList.indexOf(f);
400
+ if (T < 0 || T >= N.length)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const j = isFunction(w) ? w(N[L]) : w;
403
- I(o, [
404
- ...N.slice(0, L),
405
- j,
406
- ...N.slice(L + 1)
402
+ const b = isFunction(C) ? C(N[T]) : C;
403
+ B(o, [
404
+ ...N.slice(0, T),
405
+ b,
406
+ ...N.slice(T + 1)
407
407
  ]);
408
408
  };
409
- g[E] = isWritable(o) ? atom(v, B) : atom(v);
410
- }), p && p.keyList.length === x.length && p.keyList.every((m, E) => m === x[E]) ? u = p : u = { arr: c, atomList: g, keyList: x }, r.set(c, u), u;
409
+ m[E] = isWritable(o) ? atom(k, A) : atom(k);
410
+ }), p && p.keyList.length === x.length && p.keyList.every((g, E) => g === x[E]) ? u = p : u = { arr: c, atomList: m, keyList: x }, r.set(c, u), u;
411
411
  }, l = atom((c) => {
412
412
  const d = c(l), u = c(o);
413
413
  return a(u, d == null ? void 0 : d.arr);
@@ -420,10 +420,10 @@ function splitAtom(o, n) {
420
420
  case "remove": {
421
421
  const p = c(i).indexOf(u.atom);
422
422
  if (p >= 0) {
423
- const g = c(o);
423
+ const m = c(o);
424
424
  d(o, [
425
- ...g.slice(0, p),
426
- ...g.slice(p + 1)
425
+ ...m.slice(0, p),
426
+ ...m.slice(p + 1)
427
427
  ]);
428
428
  }
429
429
  break;
@@ -431,28 +431,28 @@ function splitAtom(o, n) {
431
431
  case "insert": {
432
432
  const p = u.before ? c(i).indexOf(u.before) : c(i).length;
433
433
  if (p >= 0) {
434
- const g = c(o);
434
+ const m = c(o);
435
435
  d(o, [
436
- ...g.slice(0, p),
436
+ ...m.slice(0, p),
437
437
  u.value,
438
- ...g.slice(p)
438
+ ...m.slice(p)
439
439
  ]);
440
440
  }
441
441
  break;
442
442
  }
443
443
  case "move": {
444
- const p = c(i).indexOf(u.atom), g = u.before ? c(i).indexOf(u.before) : c(i).length;
445
- if (p >= 0 && g >= 0) {
444
+ const p = c(i).indexOf(u.atom), m = u.before ? c(i).indexOf(u.before) : c(i).length;
445
+ if (p >= 0 && m >= 0) {
446
446
  const x = c(o);
447
- p < g ? d(o, [
447
+ p < m ? d(o, [
448
448
  ...x.slice(0, p),
449
- ...x.slice(p + 1, g),
449
+ ...x.slice(p + 1, m),
450
450
  x[p],
451
- ...x.slice(g)
451
+ ...x.slice(m)
452
452
  ]) : d(o, [
453
- ...x.slice(0, g),
453
+ ...x.slice(0, m),
454
454
  x[p],
455
- ...x.slice(g, p),
455
+ ...x.slice(m, p),
456
456
  ...x.slice(p + 1)
457
457
  ]);
458
458
  }
@@ -473,14 +473,14 @@ function createJSONStorage(o) {
473
473
  const a = {
474
474
  getItem: (l, i) => {
475
475
  var c, d;
476
- const u = (g) => {
477
- if (g = g || "", n !== g) {
476
+ const u = (m) => {
477
+ if (m = m || "", n !== m) {
478
478
  try {
479
- r = JSON.parse(g);
479
+ r = JSON.parse(m);
480
480
  } catch {
481
481
  return i;
482
482
  }
483
- n = g;
483
+ n = m;
484
484
  }
485
485
  return r;
486
486
  }, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
@@ -529,8 +529,8 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
529
529
  }, atom(
530
530
  (d) => d(i),
531
531
  (d, u, p) => {
532
- const g = typeof p == "function" ? p(d(i)) : p;
533
- return g === RESET ? (u(i, n), r.removeItem(o)) : g instanceof Promise ? g.then((x) => (u(i, x), r.setItem(o, x))) : (u(i, g), r.setItem(o, g));
532
+ const m = typeof p == "function" ? p(d(i)) : p;
533
+ return m === RESET ? (u(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((x) => (u(i, x), r.setItem(o, x))) : (u(i, m), r.setItem(o, m));
534
534
  }
535
535
  );
536
536
  }
@@ -555,8 +555,8 @@ const StoreContext = createContext(void 0), useStore = (o) => {
555
555
  function useAtomValue(o, n) {
556
556
  const r = useStore(n), [[a, l, i], c] = useReducer(
557
557
  (p) => {
558
- const g = r.get(o);
559
- return Object.is(p[0], g) && p[1] === r && p[2] === o ? p : [g, r, o];
558
+ const m = r.get(o);
559
+ return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
560
560
  },
561
561
  void 0,
562
562
  () => [r.get(o), r, o]
@@ -640,8 +640,8 @@ const getSlots = (o) => {
640
640
  return map(i, (c) => {
641
641
  const d = c, u = getSlots(d);
642
642
  return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
643
- const g = find(i, { oldId: u[p].replace("slot:", "") });
644
- d[p] = `slot:${g._id}`;
643
+ const m = find(i, { oldId: u[p].replace("slot:", "") });
644
+ d[p] = `slot:${m._id}`;
645
645
  }), omit(d, ["global", "oldId"]);
646
646
  });
647
647
  }, presentBlocksAtom = atom$1([]);
@@ -759,8 +759,8 @@ const useSelectedBlocksDisplayChild = () => ({
759
759
  const p = r[u];
760
760
  if (includes(["slot", "styles"], p.type))
761
761
  return;
762
- const g = u;
763
- l.properties[g] = getBlockJSONFromSchemas(p, n);
762
+ const m = u;
763
+ l.properties[m] = getBlockJSONFromSchemas(p, n);
764
764
  }), l;
765
765
  case "list":
766
766
  const { itemProperties: i, title: c } = o, d = {
@@ -775,8 +775,8 @@ const useSelectedBlocksDisplayChild = () => ({
775
775
  const p = i[u];
776
776
  if (includes(["slot", "styles"], p.type))
777
777
  return;
778
- const g = u;
779
- d.items.properties[g] = getBlockJSONFromSchemas(p, n), set(d.items, "title", get(p, "itemTitle", `${n(c)} item`));
778
+ const m = u;
779
+ d.items.properties[m] = getBlockJSONFromSchemas(p, n), set(d.items, "title", get(p, "itemTitle", `${n(c)} item`));
780
780
  }), d;
781
781
  default:
782
782
  return {};
@@ -829,8 +829,8 @@ var undomanager = { exports: {} };
829
829
  }
830
830
  let r = function() {
831
831
  let a = [], l = -1, i = 0, c = !1, d;
832
- function u(p, g) {
833
- return !p || typeof p[g] != "function" ? this : (c = !0, p[g](), c = !1, this);
832
+ function u(p, m) {
833
+ return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
834
834
  }
835
835
  return {
836
836
  /**
@@ -857,8 +857,8 @@ var undomanager = { exports: {} };
857
857
  let p = a[l];
858
858
  if (!p)
859
859
  return this;
860
- const g = p.groupId;
861
- for (; p.groupId === g && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
860
+ const m = p.groupId;
861
+ for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
862
862
  ;
863
863
  return d && d(), this;
864
864
  },
@@ -869,8 +869,8 @@ var undomanager = { exports: {} };
869
869
  let p = a[l + 1];
870
870
  if (!p)
871
871
  return this;
872
- const g = p.groupId;
873
- for (; p.groupId === g && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
872
+ const m = p.groupId;
873
+ for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
874
874
  ;
875
875
  return d && d(), this;
876
876
  },
@@ -901,7 +901,7 @@ var undomanager = { exports: {} };
901
901
  * @returns {array}
902
902
  */
903
903
  getCommands: function(p) {
904
- return p ? a.filter((g) => g.groupId === p) : a;
904
+ return p ? a.filter((m) => m.groupId === p) : a;
905
905
  },
906
906
  /**
907
907
  * Returns the index of the actions list.
@@ -1191,102 +1191,102 @@ const useBlocksStoreManager = () => {
1191
1191
  updateBlocksProps: c
1192
1192
  } = useBlocksStoreManager();
1193
1193
  return {
1194
- moveBlocks: (b, _, v) => {
1195
- const B = map(b, (I) => {
1196
- const A = n.find((L) => L._id === I)._parent || null, P = n.filter((L) => A ? L._parent === A : !L._parent).map((L) => L._id).indexOf(I);
1197
- return { _id: I, oldParent: A, oldPosition: P };
1198
- }), C = B.find(({ _id: I }) => I === b[0]);
1199
- C && C.oldParent === _ && C.oldPosition === v || (i(b, _, v), o({
1200
- undo: () => each(B, ({ _id: I, oldParent: w, oldPosition: A }) => {
1201
- i([I], w, A);
1194
+ moveBlocks: (f, j, k) => {
1195
+ const A = map(f, (B) => {
1196
+ const w = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => w ? T._parent === w : !T._parent).map((T) => T._id).indexOf(B);
1197
+ return { _id: B, oldParent: w, oldPosition: D };
1198
+ }), S = A.find(({ _id: B }) => B === f[0]);
1199
+ S && S.oldParent === j && S.oldPosition === k || (i(f, j, k), o({
1200
+ undo: () => each(A, ({ _id: B, oldParent: C, oldPosition: w }) => {
1201
+ i([B], C, w);
1202
1202
  }),
1203
- redo: () => i(b, _, v)
1203
+ redo: () => i(f, j, k)
1204
1204
  }));
1205
1205
  },
1206
- addBlocks: (b, _, v) => {
1207
- a(b, _, v), o({
1208
- undo: () => l(map(b, "_id")),
1209
- redo: () => a(b, _, v)
1206
+ addBlocks: (f, j, k) => {
1207
+ a(f, j, k), o({
1208
+ undo: () => l(map(f, "_id")),
1209
+ redo: () => a(f, j, k)
1210
1210
  });
1211
1211
  },
1212
- removeBlocks: (b) => {
1213
- var C;
1214
- const _ = (C = first(b)) == null ? void 0 : C._parent, B = n.filter((I) => _ ? I._parent === _ : !I._parent).indexOf(first(b));
1215
- l(map(b, "_id")), o({
1216
- undo: () => a(b, _, B),
1217
- redo: () => l(map(b, "_id"))
1212
+ removeBlocks: (f) => {
1213
+ var S;
1214
+ const j = (S = first(f)) == null ? void 0 : S._parent, A = n.filter((B) => j ? B._parent === j : !B._parent).indexOf(first(f));
1215
+ l(map(f, "_id")), o({
1216
+ undo: () => a(f, j, A),
1217
+ redo: () => l(map(f, "_id"))
1218
1218
  });
1219
1219
  },
1220
- updateBlocks: (b, _, v) => {
1221
- let B = [];
1222
- if (v)
1223
- B = map(b, (C) => ({ _id: C, ...v }));
1220
+ updateBlocks: (f, j, k) => {
1221
+ let A = [];
1222
+ if (k)
1223
+ A = map(f, (S) => ({ _id: S, ...k }));
1224
1224
  else {
1225
- const C = keys(_);
1226
- B = map(b, (I) => {
1227
- const w = n.find((N) => N._id === I), A = { _id: I };
1228
- return each(C, (N) => A[N] = w[N]), A;
1225
+ const S = keys(j);
1226
+ A = map(f, (B) => {
1227
+ const C = n.find((N) => N._id === B), w = { _id: B };
1228
+ return each(S, (N) => w[N] = C[N]), w;
1229
1229
  });
1230
1230
  }
1231
- c(map(b, (C) => ({ _id: C, ..._ }))), o({
1232
- undo: () => c(B),
1233
- redo: () => c(map(b, (C) => ({ _id: C, ..._ })))
1231
+ c(map(f, (S) => ({ _id: S, ...j }))), o({
1232
+ undo: () => c(A),
1233
+ redo: () => c(map(f, (S) => ({ _id: S, ...j })))
1234
1234
  });
1235
1235
  },
1236
- updateBlocksRuntime: (b, _) => {
1237
- c(map(b, (v) => ({ _id: v, ..._ })));
1236
+ updateBlocksRuntime: (f, j) => {
1237
+ c(map(f, (k) => ({ _id: k, ...j })));
1238
1238
  },
1239
- setNewBlocks: (b) => {
1240
- r(b), o({
1239
+ setNewBlocks: (f) => {
1240
+ r(f), o({
1241
1241
  undo: () => r(n),
1242
- redo: () => r(b)
1242
+ redo: () => r(f)
1243
1243
  });
1244
1244
  },
1245
- updateMultipleBlocksProps: (b) => {
1246
- let _ = [];
1247
- _ = map(b, (v) => {
1248
- const B = keys(v), C = n.find((w) => w._id === v._id), I = {};
1249
- return each(B, (w) => I[w] = C[w]), I;
1250
- }), c(b), o({
1251
- undo: () => c(_),
1252
- redo: () => c(b)
1245
+ updateMultipleBlocksProps: (f) => {
1246
+ let j = [];
1247
+ j = map(f, (k) => {
1248
+ const A = keys(k), S = n.find((C) => C._id === k._id), B = {};
1249
+ return each(A, (C) => B[C] = S[C]), B;
1250
+ }), c(f), o({
1251
+ undo: () => c(j),
1252
+ redo: () => c(f)
1253
1253
  });
1254
1254
  }
1255
1255
  };
1256
1256
  }, useAddBlock = () => {
1257
1257
  const [o] = useBlocksStore(), [, n] = useSelectedBlockIds(), { addBlocks: r } = useBlocksStoreUndoableActions(), a = useCallback(
1258
1258
  (i, c, d) => {
1259
- var m;
1259
+ var g;
1260
1260
  for (let E = 0; E < i.length; E++) {
1261
- const { _id: b } = i[E];
1261
+ const { _id: f } = i[E];
1262
1262
  i[E]._id = generateUUID();
1263
- const _ = filter(i, { _parent: b });
1264
- for (let v = 0; v < _.length; v++)
1265
- _[v]._parent = i[E]._id;
1263
+ const j = filter(i, { _parent: f });
1264
+ for (let k = 0; k < j.length; k++)
1265
+ j[k]._parent = i[E]._id;
1266
1266
  }
1267
1267
  const u = first(i);
1268
- let p, g;
1269
- return c && (p = find(o, { _id: c }), i[0]._parent = c, g = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, g = p._parent), r(i, g, d), n([(m = first(i)) == null ? void 0 : m._id]), first(i);
1268
+ let p, m;
1269
+ return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(g = first(i)) == null ? void 0 : g._id]), first(i);
1270
1270
  },
1271
1271
  [o, n]
1272
1272
  );
1273
1273
  return { addCoreBlock: useCallback(
1274
1274
  (i, c, d) => {
1275
1275
  if (has(i, "blocks")) {
1276
- const v = i.blocks;
1277
- return a(v, c, d);
1276
+ const k = i.blocks;
1277
+ return a(k, c, d);
1278
1278
  }
1279
- const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
1280
- forIn(p, (v, B) => {
1281
- if (startsWith(v, SLOT_KEY)) {
1282
- const C = v.replace(SLOT_KEY, "");
1283
- g.push({
1284
- _id: C,
1279
+ const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
1280
+ forIn(p, (k, A) => {
1281
+ if (startsWith(k, SLOT_KEY)) {
1282
+ const S = k.replace(SLOT_KEY, "");
1283
+ m.push({
1284
+ _id: S,
1285
1285
  _type: "Slot",
1286
1286
  _parent: u,
1287
- _name: i.props[B].name,
1288
- _styles: i.props[B].styles,
1289
- _emptyStyles: i.props[B].emptyStyles
1287
+ _name: i.props[A].name,
1288
+ _styles: i.props[A].styles,
1289
+ _emptyStyles: i.props[A].emptyStyles
1290
1290
  });
1291
1291
  }
1292
1292
  });
@@ -1295,10 +1295,10 @@ const useBlocksStoreManager = () => {
1295
1295
  _id: u,
1296
1296
  ...p
1297
1297
  };
1298
- let m, E;
1299
- c && (m = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(m == null ? void 0 : m._type, x._type) && m && (x._parent = m._parent, E = m._parent);
1300
- const _ = [x, ...g];
1301
- return r(_, E, d), n([x._id]), x;
1298
+ let g, E;
1299
+ c && (g = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(g == null ? void 0 : g._type, x._type) && g && (x._parent = g._parent, E = g._parent);
1300
+ const j = [x, ...m];
1301
+ return r(j, E, d), n([x._id]), x;
1302
1302
  },
1303
1303
  [a, o, n]
1304
1304
  ), addPredefinedBlock: a };
@@ -2406,18 +2406,18 @@ function getNewClasses(o = "", n = "", r = []) {
2406
2406
  );
2407
2407
  const i = [], c = [];
2408
2408
  each(r, (p) => {
2409
- const g = constructClassObject(p), x = find(a, pick(g, ["dark", "mq", "mod", "property"]));
2409
+ const m = constructClassObject(p), x = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2410
2410
  if (x && (a = filter(
2411
2411
  a,
2412
- (m) => m.fullCls !== (x == null ? void 0 : x.fullCls)
2413
- )), i.push(g), g.mq === "xs" && !g.dark && g.mod === "" && (l = filter(l, (m) => m.property !== g.property)), getBelongsToForClass(a, g) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, g.property)) {
2414
- const m = find(l, pick(g, ["property"]));
2412
+ (g) => g.fullCls !== (x == null ? void 0 : x.fullCls)
2413
+ )), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (g) => g.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
2414
+ const g = find(l, pick(m, ["property"]));
2415
2415
  x && (l = filter(
2416
2416
  l,
2417
- (E) => E.fullCls !== (m == null ? void 0 : m.fullCls)
2417
+ (E) => E.fullCls !== (g == null ? void 0 : g.fullCls)
2418
2418
  )), c.push({
2419
- ...g,
2420
- fullCls: g.cls,
2419
+ ...m,
2420
+ fullCls: m.cls,
2421
2421
  mq: "xs"
2422
2422
  });
2423
2423
  }
@@ -2445,10 +2445,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2445
2445
  )
2446
2446
  ), i = first(o(selectedStylingBlocksAtom));
2447
2447
  return map(l, (c) => {
2448
- const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: g } = getSplitClasses$1(u);
2448
+ const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
2449
2449
  return {
2450
2450
  ids: [d._id],
2451
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(g, p, a)}` }
2451
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
2452
2452
  };
2453
2453
  });
2454
2454
  }), useAddClassesToBlocks = () => {
@@ -2497,13 +2497,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2497
2497
  (a, l = null) => {
2498
2498
  const i = [];
2499
2499
  each(a, (c) => {
2500
- const d = o.find((m) => m._id === c);
2500
+ const d = o.find((g) => g._id === c);
2501
2501
  l || (l = d._parent);
2502
- const g = filter(
2502
+ const m = filter(
2503
2503
  o,
2504
- (m) => isString$1(l) ? m._parent === l : !d._parent
2504
+ (g) => isString$1(l) ? g._parent === l : !d._parent
2505
2505
  ).indexOf(d) + 1, x = getDuplicatedBlocks(o, c, l);
2506
- r(x, l, g), i.push(get(x, "0._id", ""));
2506
+ r(x, l, m), i.push(get(x, "0._id", ""));
2507
2507
  }), n(i);
2508
2508
  },
2509
2509
  [o, n]
@@ -2566,19 +2566,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2566
2566
  );
2567
2567
  return map(i, (c) => {
2568
2568
  const d = o(c), u = a;
2569
- let { classes: p, baseClasses: g } = getSplitClasses(get(d, l.prop, "styles:,"));
2569
+ let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2570
2570
  return each(u, (x) => {
2571
- const m = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${m}($| )`, "g");
2571
+ const g = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${g}($| )`, "g");
2572
2572
  p = p.replace(E, " ").replace(/ +/g, " ").trim();
2573
- const b = first(x.split(":"));
2574
- includes(["2xl", "xl", "lg", "md", "sm"], b) && u.push(x.split(":").pop().trim());
2573
+ const f = first(x.split(":"));
2574
+ includes(["2xl", "xl", "lg", "md", "sm"], f) && u.push(x.split(":").pop().trim());
2575
2575
  }), each(u, (x) => {
2576
- const m = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2577
- g = g.replace(m, " ").replace(/ +/g, " ").trim();
2576
+ const g = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2577
+ m = m.replace(g, " ").replace(/ +/g, " ").trim();
2578
2578
  }), {
2579
2579
  ids: [d._id],
2580
2580
  props: {
2581
- [l.prop]: `${STYLES_KEY}${g},${p}`
2581
+ [l.prop]: `${STYLES_KEY}${m},${p}`
2582
2582
  }
2583
2583
  };
2584
2584
  });
@@ -2655,7 +2655,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2655
2655
  let u = "";
2656
2656
  o([n], { [i]: "" });
2657
2657
  for (let p = 0; p < d.length; p++)
2658
- u += d[p].join(""), o([n], { [i]: u }), await new Promise((g) => setTimeout(g, a));
2658
+ u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
2659
2659
  }
2660
2660
  }
2661
2661
  },
@@ -2841,10 +2841,10 @@ const globalBlocksStoreAtom = atom({}), globalBlocksLoadingStateAtom = atom({}),
2841
2841
  if (c < n) {
2842
2842
  const u = parseFloat((c / n).toFixed(2).toString());
2843
2843
  let p = {};
2844
- const g = d * u, x = c * u;
2844
+ const m = d * u, x = c * u;
2845
2845
  d && (p = {
2846
2846
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
2847
- height: 100 + (d - g) / g * 100 + "%",
2847
+ height: 100 + (d - m) / m * 100 + "%",
2848
2848
  width: 100 + (c - x) / x * 100 + "%"
2849
2849
  }), l({
2850
2850
  position: "relative",
@@ -2877,7 +2877,7 @@ class Content extends Component {
2877
2877
  return Children.only(this.props.children);
2878
2878
  }
2879
2879
  }
2880
- F(Content, "propTypes", {
2880
+ U(Content, "propTypes", {
2881
2881
  children: PropTypes.element.isRequired,
2882
2882
  contentDidMount: PropTypes.func.isRequired,
2883
2883
  contentDidUpdate: PropTypes.func.isRequired
@@ -2885,17 +2885,17 @@ F(Content, "propTypes", {
2885
2885
  class Frame extends Component {
2886
2886
  constructor(r, a) {
2887
2887
  super(r, a);
2888
- F(this, "setRef", (r) => {
2888
+ U(this, "setRef", (r) => {
2889
2889
  this.nodeRef.current = r;
2890
2890
  const { forwardedRef: a } = this.props;
2891
2891
  typeof a == "function" ? a(r) : a && (a.current = r);
2892
2892
  });
2893
- F(this, "handleLoad", () => {
2893
+ U(this, "handleLoad", () => {
2894
2894
  clearInterval(this.loadCheck), this.state.iframeLoaded || this.setState({ iframeLoaded: !0 });
2895
2895
  });
2896
2896
  // In certain situations on a cold cache DOMContentLoaded never gets called
2897
2897
  // fallback to an interval to check if that's the case
2898
- F(this, "loadCheck", () => setInterval(() => {
2898
+ U(this, "loadCheck", () => setInterval(() => {
2899
2899
  this.handleLoad();
2900
2900
  }, 500));
2901
2901
  this._isMounted = !1, this.nodeRef = React__default.createRef(), this.state = { iframeLoaded: !1 };
@@ -2936,7 +2936,7 @@ class Frame extends Component {
2936
2936
  // also inject into the body and can mess up React. For this reason
2937
2937
  // initialContent is expected to have a div inside of the body
2938
2938
  // element that we render react into.
2939
- F(Frame, "propTypes", {
2939
+ U(Frame, "propTypes", {
2940
2940
  style: PropTypes.object,
2941
2941
  // eslint-disable-line
2942
2942
  head: PropTypes.node,
@@ -2946,7 +2946,7 @@ F(Frame, "propTypes", {
2946
2946
  contentDidMount: PropTypes.func,
2947
2947
  contentDidUpdate: PropTypes.func,
2948
2948
  children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)])
2949
- }), F(Frame, "defaultProps", {
2949
+ }), U(Frame, "defaultProps", {
2950
2950
  style: {},
2951
2951
  head: null,
2952
2952
  children: void 0,
@@ -3029,33 +3029,33 @@ const useDnd = () => {
3029
3029
  };
3030
3030
  return iframeDocument = o, {
3031
3031
  isDragging: n,
3032
- onDragOver: (m) => {
3033
- m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
3032
+ onDragOver: (g) => {
3033
+ g.preventDefault(), g.stopPropagation(), throttledDragOver(g);
3034
3034
  },
3035
- onDrop: (m) => {
3036
- var w;
3037
- const E = dropTarget, _ = getOrientation(E) === "vertical" ? m.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : m.clientX;
3038
- dropIndex = calculateDropIndex(_, possiblePositions);
3039
- const v = d, B = E.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3040
- if ((v == null ? void 0 : v._id) === B || !C) {
3035
+ onDrop: (g) => {
3036
+ var C;
3037
+ const E = dropTarget, j = getOrientation(E) === "vertical" ? g.clientY + ((C = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : C.scrollY) : g.clientX;
3038
+ dropIndex = calculateDropIndex(j, possiblePositions);
3039
+ const k = d, A = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3040
+ if ((k == null ? void 0 : k._id) === A || !S) {
3041
3041
  x();
3042
3042
  return;
3043
3043
  }
3044
- if (!has(v, "_id")) {
3045
- a(v, B === "canvas" ? null : B, dropIndex), setTimeout(x, 300);
3044
+ if (!has(k, "_id")) {
3045
+ a(k, A === "canvas" ? null : A, dropIndex), setTimeout(x, 300);
3046
3046
  return;
3047
3047
  }
3048
- let I = E.getAttribute("data-block-id");
3049
- I === null && (I = m.target.parentElement.getAttribute("data-block-id")), c([v._id], I === "canvas" ? null : I, dropIndex), x(), setTimeout(removePlaceholder, 300);
3048
+ let B = E.getAttribute("data-block-id");
3049
+ B === null && (B = g.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3050
3050
  },
3051
- onDragEnter: (m) => {
3052
- const E = m, b = E.target;
3053
- dropTarget = b;
3054
- const _ = b.getAttribute("data-block-id"), v = b.getAttribute("data-dnd-dragged") !== "yes";
3055
- p(_), E.stopPropagation(), E.preventDefault(), possiblePositions = [], v && calculatePossiblePositions(b), r(!0), l(""), i([]);
3051
+ onDragEnter: (g) => {
3052
+ const E = g, f = E.target;
3053
+ dropTarget = f;
3054
+ const j = f.getAttribute("data-block-id"), k = f.getAttribute("data-dnd-dragged") !== "yes";
3055
+ p(j), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(f), r(!0), l(""), i([]);
3056
3056
  },
3057
- onDragLeave: (m) => {
3058
- m.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3057
+ onDragLeave: (g) => {
3058
+ g.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3059
3059
  }
3060
3060
  };
3061
3061
  };
@@ -3077,16 +3077,16 @@ const useHandleCanvasDblClick = () => {
3077
3077
  if (!d || !o.includes(d))
3078
3078
  return;
3079
3079
  const u = c.cloneNode(!0);
3080
- c.style.display = "none", Array.from(u.attributes).forEach((m) => {
3081
- m.name !== "class" && u.removeAttribute(m.name);
3080
+ c.style.display = "none", Array.from(u.attributes).forEach((g) => {
3081
+ g.name !== "class" && u.removeAttribute(g.name);
3082
3082
  }), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
3083
3083
  const p = new Quill(u, { placeholder: "Type here..." });
3084
- function g() {
3085
- const m = p.getText(0, p.getLength());
3086
- n([c.getAttribute("data-block-id")], { content: m }), c.removeAttribute("style"), u.removeEventListener("blur", g, !0), destroyQuill(p), l(""), r("");
3084
+ function m() {
3085
+ const g = p.getText(0, p.getLength());
3086
+ n([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), l(""), r("");
3087
3087
  }
3088
- u.addEventListener("blur", g, !0), u.addEventListener("keydown", (m) => {
3089
- (m.key === "Enter" || m.key === "Escape") && g();
3088
+ u.addEventListener("blur", m, !0), u.addEventListener("keydown", (g) => {
3089
+ (g.key === "Enter" || g.key === "Escape") && m();
3090
3090
  }), p.focus(), (x = u.querySelector(".ql-clipboard")) == null || x.remove(), l(c.getAttribute("data-block-id"));
3091
3091
  };
3092
3092
  }, useHandleCanvasClick = () => {
@@ -3101,8 +3101,8 @@ const useHandleCanvasDblClick = () => {
3101
3101
  return;
3102
3102
  }
3103
3103
  if (d != null && d.getAttribute("data-block-parent")) {
3104
- const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
3105
- n.includes(g) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: g }]), r([g]);
3104
+ const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
3105
+ n.includes(m) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
3106
3106
  } else if (d != null && d.getAttribute("data-block-id")) {
3107
3107
  let u = d.getAttribute("data-block-id");
3108
3108
  n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
@@ -3125,10 +3125,10 @@ const useHandleCanvasDblClick = () => {
3125
3125
  return;
3126
3126
  const p = getElementByDataBlockId(n, first(r));
3127
3127
  if (p) {
3128
- const g = p.getAttribute("data-style-prop");
3129
- if (g) {
3130
- const x = p.getAttribute("data-style-id"), m = p.getAttribute("data-block-parent");
3131
- l([{ id: x, prop: g, blockId: m }]);
3128
+ const m = p.getAttribute("data-style-prop");
3129
+ if (m) {
3130
+ const x = p.getAttribute("data-style-id"), g = p.getAttribute("data-block-parent");
3131
+ l([{ id: x, prop: m, blockId: g }]);
3132
3132
  }
3133
3133
  }
3134
3134
  }, 100);
@@ -3148,14 +3148,14 @@ const useHandleCanvasDblClick = () => {
3148
3148
  }
3149
3149
  );
3150
3150
  }, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
3151
- const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: g } = usePasteBlocks();
3151
+ const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
3152
3152
  useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
3153
3153
  "ctrl+v,command+v",
3154
3154
  () => {
3155
- p(n[0]) && g(n);
3155
+ p(n[0]) && m(n);
3156
3156
  },
3157
3157
  {},
3158
- [n, p, g]
3158
+ [n, p, m]
3159
3159
  );
3160
3160
  const x = o ? { document: o } : {};
3161
3161
  useHotkeys("esc", () => r([]), x, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...x, preventDefault: !0 }, [
@@ -3163,8 +3163,8 @@ const useHandleCanvasDblClick = () => {
3163
3163
  l
3164
3164
  ]), useHotkeys(
3165
3165
  "del, backspace",
3166
- (m) => {
3167
- m.preventDefault(), a(n);
3166
+ (g) => {
3167
+ g.preventDefault(), a(n);
3168
3168
  },
3169
3169
  x,
3170
3170
  [n, a]
@@ -3195,15 +3195,15 @@ const useHandleCanvasDblClick = () => {
3195
3195
  }
3196
3196
  );
3197
3197
  }, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
3198
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: g } = useFloating({
3198
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
3199
3199
  placement: "top-start",
3200
3200
  middleware: [shift(), flip()],
3201
3201
  elements: {
3202
3202
  reference: o
3203
3203
  }
3204
3204
  });
3205
- useResizeObserver(o, () => g(), o !== null);
3206
- const x = get(n, "_parent", null), m = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3205
+ useResizeObserver(o, () => m(), o !== null);
3206
+ const x = get(n, "_parent", null), g = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3207
3207
  return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3208
3208
  "div",
3209
3209
  {
@@ -3229,7 +3229,7 @@ const useHandleCanvasDblClick = () => {
3229
3229
  }
3230
3230
  }
3231
3231
  ),
3232
- /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: m, block: n }),
3232
+ /* @__PURE__ */ jsxRuntimeExports.jsx(BlockActionLabel, { label: g, block: n }),
3233
3233
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2 px-1", children: [
3234
3234
  canAddChildBlock(get(n, "_type", "")) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3235
3235
  PlusIcon,
@@ -3252,9 +3252,9 @@ const useHandleCanvasDblClick = () => {
3252
3252
  }
3253
3253
  ) });
3254
3254
  }, HeadTags = ({ model: o }) => {
3255
- const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [g] = useState(u == null ? void 0 : u.getElementById("highlighted-block")), [x] = useState(
3255
+ const [n] = useBrandingOptions(), [r] = useSelectedBlockIds(), [a] = useDarkMode(), [l] = useHighlightBlockId(), [i] = useSelectedStylingBlocks(), [c] = useAtom$1(draggedBlockAtom), [d] = useAtom$1(dropTargetBlockIdAtom), { document: u, window: p } = useFrame(), [m] = useState(u == null ? void 0 : u.getElementById("highlighted-block")), [x] = useState(
3256
3256
  u == null ? void 0 : u.getElementById("selected-block")
3257
- ), [m] = useState(
3257
+ ), [g] = useState(
3258
3258
  u == null ? void 0 : u.getElementById("selected-styling-block")
3259
3259
  ), [E] = useState(
3260
3260
  u == null ? void 0 : u.getElementById("dragged-block")
@@ -3262,17 +3262,17 @@ const useHandleCanvasDblClick = () => {
3262
3262
  useEffect(() => {
3263
3263
  a ? u == null || u.documentElement.classList.add("dark") : u == null || u.documentElement.classList.remove("dark");
3264
3264
  }, [a, u]);
3265
- const b = get(n, "headingFont", "DM Sans"), _ = get(n, "bodyFont", "DM Sans");
3265
+ const f = get(n, "headingFont", "DM Sans"), j = get(n, "bodyFont", "DM Sans");
3266
3266
  return useEffect(() => {
3267
- const v = get(n, "primaryColor", "#000"), B = get(n, "secondaryColor", "#FFF"), C = get(n, "bodyBgLightColor", "#fff"), I = get(n, "bodyBgDarkColor", "#000"), w = get(n, "bodyTextDarkColor", "#000"), A = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
3268
- { color: v, name: "primary" },
3269
- { color: B, name: "secondary" }
3270
- ]), P = {
3271
- "bg-light": C,
3272
- "bg-dark": I,
3273
- "text-dark": w,
3274
- "text-light": A
3275
- }, L = get(n, "roundedCorners", "0");
3267
+ const k = get(n, "primaryColor", "#000"), A = get(n, "secondaryColor", "#FFF"), S = get(n, "bodyBgLightColor", "#fff"), B = get(n, "bodyBgDarkColor", "#000"), C = get(n, "bodyTextDarkColor", "#000"), w = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
3268
+ { color: k, name: "primary" },
3269
+ { color: A, name: "secondary" }
3270
+ ]), D = {
3271
+ "bg-light": S,
3272
+ "bg-dark": B,
3273
+ "text-dark": C,
3274
+ "text-light": w
3275
+ }, T = get(n, "roundedCorners", "0");
3276
3276
  !p || !p.tailwind || (p.tailwind.config = {
3277
3277
  darkMode: "class",
3278
3278
  theme: {
@@ -3285,56 +3285,56 @@ const useHandleCanvasDblClick = () => {
3285
3285
  }
3286
3286
  },
3287
3287
  fontFamily: {
3288
- heading: [b],
3289
- body: [_]
3288
+ heading: [f],
3289
+ body: [j]
3290
3290
  },
3291
3291
  borderRadius: {
3292
- DEFAULT: `${L || "0"}px`
3292
+ DEFAULT: `${T || "0"}px`
3293
3293
  },
3294
- colors: { ...P, ...N }
3294
+ colors: { ...D, ...N }
3295
3295
  }
3296
3296
  },
3297
3297
  plugins: [
3298
3298
  typography$1,
3299
3299
  forms,
3300
3300
  aspectRatio,
3301
- plugin(function({ addBase: j, theme: k }) {
3302
- j({
3301
+ plugin(function({ addBase: b, theme: _ }) {
3302
+ b({
3303
3303
  "h1,h2,h3,h4,h5,h6": {
3304
- fontFamily: k("fontFamily.heading")
3304
+ fontFamily: _("fontFamily.heading")
3305
3305
  },
3306
3306
  body: {
3307
- fontFamily: k("fontFamily.body"),
3308
- color: k("colors.text-light"),
3309
- backgroundColor: k("colors.bg-light")
3307
+ fontFamily: _("fontFamily.body"),
3308
+ color: _("colors.text-light"),
3309
+ backgroundColor: _("colors.bg-light")
3310
3310
  },
3311
3311
  ".dark body": {
3312
- color: k("colors.text-dark"),
3313
- backgroundColor: k("colors.bg-dark")
3312
+ color: _("colors.text-dark"),
3313
+ backgroundColor: _("colors.bg-dark")
3314
3314
  }
3315
3315
  });
3316
3316
  })
3317
3317
  ]
3318
3318
  });
3319
- }, [n, p, b, _]), useEffect(() => {
3320
- x && (x.textContent = `${map(r, (v) => `[data-block-id="${v}"]`).join(",")}{
3319
+ }, [n, p, f, j]), useEffect(() => {
3320
+ x && (x.textContent = `${map(r, (k) => `[data-block-id="${k}"]`).join(",")}{
3321
3321
  outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3322
3322
  }`);
3323
3323
  }, [r, x]), useEffect(() => {
3324
3324
  E.textContent = c ? `[data-block-id="${c._id}"], [data-block-id="${c._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3325
3325
  }, [c, E]), useEffect(() => {
3326
- g && (g.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
3327
- }, [l, r, g]), useEffect(() => {
3328
- m && (m.textContent = `${map(i, ({ id: v }) => `[data-style-id="${v}"]`).join(",")}{
3326
+ m && (m.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
3327
+ }, [l, r, m]), useEffect(() => {
3328
+ g && (g.textContent = `${map(i, ({ id: k }) => `[data-style-id="${k}"]`).join(",")}{
3329
3329
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3330
3330
  }`);
3331
- }, [i, m]), useEffect(() => {
3331
+ }, [i, g]), useEffect(() => {
3332
3332
  u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3333
- }, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (b || _) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3333
+ }, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (f || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3334
3334
  "link",
3335
3335
  {
3336
3336
  rel: "stylesheet",
3337
- href: `https://fonts.googleapis.com/css2?family=${b ? `${b.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${b && _ && b !== _ ? "&" : ""}${_ && _ !== b ? `family=${_.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
3337
+ href: `https://fonts.googleapis.com/css2?family=${f ? `${f.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${f && j && f !== j ? "&" : ""}${j && j !== f ? `family=${j.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
3338
3338
  }
3339
3339
  ) });
3340
3340
  }, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
@@ -3345,16 +3345,67 @@ const useHandleCanvasDblClick = () => {
3345
3345
  u || (u = d, d = "xs");
3346
3346
  const p = r.indexOf(d);
3347
3347
  if (p <= a) {
3348
- const g = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
3349
- if (g.includes(u))
3350
- for (let m = p; m < r.length; m++)
3351
- i[m] = !0;
3348
+ const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], x = ["hidden"];
3349
+ if (m.includes(u))
3350
+ for (let g = p; g < r.length; g++)
3351
+ i[g] = !0;
3352
3352
  else if (x.includes(u))
3353
- for (let m = p; m < r.length; m++)
3354
- i[m] = !1;
3353
+ for (let g = p; g < r.length; g++)
3354
+ i[g] = !1;
3355
3355
  }
3356
3356
  }
3357
3357
  return i[a];
3358
+ }, rscBlocksStoreAtom = atom({}), rscBlocksLoadingStateAtom = atom({}), useRSCBlocksStore = () => {
3359
+ const [o, n] = useAtom(rscBlocksStoreAtom), [r] = useAtom(rscBlocksLoadingStateAtom), a = useCallback(
3360
+ (c) => get(o, c == null ? void 0 : c._id, null),
3361
+ [o]
3362
+ ), l = useCallback(
3363
+ (c) => get(r, `${c}`, { loading: !1, error: null }),
3364
+ [r]
3365
+ ), i = useCallback(
3366
+ (c) => {
3367
+ n((d) => ({ ...d, [c]: "" }));
3368
+ },
3369
+ [n]
3370
+ );
3371
+ return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
3372
+ }, useWatchRSCBlocks = () => {
3373
+ const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
3374
+ var x;
3375
+ return (x = get(i, p._type)) == null ? void 0 : x.server;
3376
+ }).map((p) => p._id), [i, o]);
3377
+ useEffect(() => {
3378
+ forEach(d, (u) => {
3379
+ if (get(n, u, "") || get(a, `${u}.loading`, !1))
3380
+ return;
3381
+ const p = o.find((m) => m._id === u);
3382
+ l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
3383
+ r((x) => ({ ...x, [u]: m })), l((x) => ({
3384
+ ...x,
3385
+ [u]: { loading: !1, error: null }
3386
+ }));
3387
+ }).catch((m) => {
3388
+ l((x) => ({
3389
+ ...x,
3390
+ [u]: { loading: !1, error: m.message }
3391
+ }));
3392
+ });
3393
+ });
3394
+ }, [
3395
+ o,
3396
+ c,
3397
+ n,
3398
+ d,
3399
+ a,
3400
+ r,
3401
+ l
3402
+ ]);
3403
+ }, RSCBlock = ({ blockProps: o, block: n }) => {
3404
+ const { getRSCBlockMarkup: r, getRSCBlockState: a } = useRSCBlocksStore(), l = r(n), { loading: i, error: c } = a(n._id);
3405
+ return i ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...o, className: "h-10 w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full w-full rounded-md border" }) }) : c ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ...o, children: [
3406
+ "Error: ",
3407
+ c
3408
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ...o, dangerouslySetInnerHTML: { __html: l } });
3358
3409
  }, generateClassNames = memoize((o) => {
3359
3410
  const n = o.replace(STYLES_KEY, "").split(",");
3360
3411
  return twMerge(n[0], n[1]);
@@ -3393,50 +3444,50 @@ function isDescendant(o, n, r) {
3393
3444
  }
3394
3445
  const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
3395
3446
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3396
- const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), g = useCallback((b) => getStyleAttrs(b, c), [c]), [x] = useChaiExternalData(), [m] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3397
- (b) => b.reduce((_, v) => {
3398
- const B = get(d, v, {});
3399
- return { ..._, ...B };
3447
+ const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), m = useCallback((f) => getStyleAttrs(f, c), [c]), [x] = useChaiExternalData(), [g] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3448
+ (f) => f.reduce((j, k) => {
3449
+ const A = get(d, k, {});
3450
+ return { ...j, ...A };
3400
3451
  }, {}),
3401
3452
  [d]
3402
3453
  );
3403
3454
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3404
- o.map((b, _) => {
3405
- if (m === b._id || u.includes(b._id))
3455
+ o.map((f, j) => {
3456
+ if (g === f._id || u.includes(f._id))
3406
3457
  return null;
3407
- const v = {}, B = filter(n, { _parent: b._id });
3408
- if (v.children = B.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: B }) : null, b._type === "GlobalBlock") {
3409
- const L = p(b);
3410
- v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(L, (j) => !j._parent), allBlocks: L });
3458
+ const k = {}, A = filter(n, { _parent: f._id });
3459
+ if (k.children = A.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: A }) : null, f._type === "GlobalBlock") {
3460
+ const _ = p(f);
3461
+ k.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(_, (R) => !R._parent), allBlocks: _ });
3411
3462
  }
3412
- const C = getBlockComponent(b._type), I = get(C, "builderComponent", get(C, "component", null));
3413
- if (isNull(I))
3414
- return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
3415
- const w = has(C, "getBlockStateFrom") ? C == null ? void 0 : C.getBlockStateFrom(b, n) : [], A = E(w), N = g(b);
3416
- if (get(N, "__isHidden", !1) && !includes(r, b._id))
3463
+ const S = getBlockComponent(f._type), B = get(S, "server", !1), C = B ? RSCBlock : get(S, "builderComponent", get(S, "component", null));
3464
+ if (isNull(C))
3465
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
3466
+ const w = has(S, "getBlockStateFrom") ? S == null ? void 0 : S.getBlockStateFrom(f, n) : [], N = E(w), D = m(f);
3467
+ if (get(D, "__isHidden", !1) && !includes(r, f._id))
3417
3468
  return null;
3418
- const P = l && isDescendant(l._id, b._id, n);
3419
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(I, {
3420
- blockProps: {
3421
- ...includes(r, b._id) ? { "force-show": "" } : {},
3422
- "data-block-id": b._id,
3423
- "data-block-type": b._type,
3424
- ...l ? (
3425
- // @ts-ignore
3426
- {
3427
- "data-dnd": canAcceptChildBlock(b._type, l == null ? void 0 : l._type) ? "yes" : "no",
3428
- "data-dnd-dragged": l._id === b._id || P ? "yes" : "no"
3429
- }
3430
- ) : {},
3431
- ...i === b._id && !P ? { "data-drop": "yes" } : {},
3432
- ...includes(a, b._id) ? { "data-cut-block": "yes" } : {}
3433
- },
3434
- index: _,
3435
- ...applyBindings(b, x),
3436
- ...omit(N, ["__isHidden"]),
3437
- ...v,
3469
+ const T = l && isDescendant(l._id, f._id, n), b = {
3470
+ ...includes(r, f._id) ? { "force-show": "" } : {},
3471
+ "data-block-id": f._id,
3472
+ "data-block-type": f._type,
3473
+ ...l ? (
3474
+ // @ts-ignore
3475
+ {
3476
+ "data-dnd": canAcceptChildBlock(f._type, l == null ? void 0 : l._type) ? "yes" : "no",
3477
+ "data-dnd-dragged": l._id === f._id || T ? "yes" : "no"
3478
+ }
3479
+ ) : {},
3480
+ ...i === f._id && !T ? { "data-drop": "yes" } : {},
3481
+ ...includes(a, f._id) ? { "data-cut-block": "yes" } : {}
3482
+ };
3483
+ return B ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: b }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(C, {
3484
+ blockProps: b,
3485
+ index: j,
3486
+ ...applyBindings(f, x),
3487
+ ...omit(D, ["__isHidden"]),
3488
+ ...k,
3438
3489
  inBuilder: !0,
3439
- blockState: A
3490
+ blockState: N
3440
3491
  }) });
3441
3492
  })
3442
3493
  ) });
@@ -3486,47 +3537,47 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3486
3537
  n(i);
3487
3538
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
3488
3539
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3489
- 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), [g, x] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [b, _] = useSelectedStylingBlocks(), v = useBuilderProp("loading", !1), B = useBuilderProp("htmlDir", "ltr"), C = (A) => {
3490
- u((N) => ({ ...N, width: A }));
3540
+ 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, x] = useState([]), [, g] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [f, j] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), A = useBuilderProp("htmlDir", "ltr"), S = (w) => {
3541
+ u((N) => ({ ...N, width: w }));
3491
3542
  };
3492
3543
  useEffect(() => {
3493
3544
  if (!c.current)
3494
3545
  return;
3495
- const { clientWidth: A, clientHeight: N } = c.current;
3496
- u({ width: A, height: N });
3546
+ const { clientWidth: w, clientHeight: N } = c.current;
3547
+ u({ width: w, height: N });
3497
3548
  }, [c, n]);
3498
- const I = (A, N = 0) => {
3499
- const { top: P } = A.getBoundingClientRect();
3500
- return P + N >= 0 && P - N <= window.innerHeight;
3549
+ const B = (w, N = 0) => {
3550
+ const { top: D } = w.getBoundingClientRect();
3551
+ return D + N >= 0 && D - N <= window.innerHeight;
3501
3552
  };
3502
3553
  useEffect(() => {
3503
- var A, N;
3554
+ var w, N;
3504
3555
  if (a && a.type !== "Multiple" && i.current) {
3505
- const P = getElementByDataBlockId(i.current.contentDocument, a._id);
3506
- P && (I(P) || (N = (A = i.current) == null ? void 0 : A.contentWindow) == null || N.scrollTo({ top: P.offsetTop, behavior: "smooth" }), x([P]));
3556
+ const D = getElementByDataBlockId(i.current.contentDocument, a._id);
3557
+ D && (B(D) || (N = (w = i.current) == null ? void 0 : w.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
3507
3558
  }
3508
3559
  }, [a]), useEffect(() => {
3509
- if (!isEmpty(b) && i.current) {
3510
- const A = getElementByStyleId(
3560
+ if (!isEmpty(f) && i.current) {
3561
+ const w = getElementByStyleId(
3511
3562
  i.current.contentDocument,
3512
- first(b).id
3563
+ first(f).id
3513
3564
  );
3514
- m(A ? [A] : [null]);
3565
+ g(w ? [w] : [null]);
3515
3566
  } else
3516
- m([null]);
3517
- }, [b]);
3518
- const w = useMemo(() => {
3519
- let A = IframeInitialContent;
3520
- return A = A.replace("__HTML_DIR__", B), o === "offline" && (A = A.replace(
3567
+ g([null]);
3568
+ }, [f]);
3569
+ const C = useMemo(() => {
3570
+ let w = IframeInitialContent;
3571
+ return w = w.replace("__HTML_DIR__", A), o === "offline" && (w = w.replace(
3521
3572
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3522
3573
  "/offline/tailwind.cdn.js"
3523
- ), A = A.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), A = A.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), A;
3524
- }, [o, B]);
3525
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3574
+ ), w = w.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), w = w.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), w;
3575
+ }, [o, A]);
3576
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3526
3577
  "div",
3527
3578
  {
3528
3579
  onClick: () => {
3529
- r([]), _([]);
3580
+ r([]), j([]);
3530
3581
  },
3531
3582
  onMouseLeave: () => setTimeout(() => l(""), 300),
3532
3583
  className: "relative mx-auto h-full w-full overflow-hidden",
@@ -3539,19 +3590,19 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3539
3590
  id: "canvas-iframe",
3540
3591
  style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
3541
3592
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3542
- initialContent: w,
3593
+ initialContent: C,
3543
3594
  children: [
3544
3595
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3545
3596
  /* @__PURE__ */ jsxRuntimeExports.jsx(
3546
3597
  BlockActionsStatic,
3547
3598
  {
3548
3599
  block: a,
3549
- selectedBlockElement: first(g)
3600
+ selectedBlockElement: first(m)
3550
3601
  }
3551
3602
  ),
3552
3603
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
3553
3604
  /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
3554
- v ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3605
+ k ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3555
3606
  /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
3556
3607
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
3557
3608
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -3662,7 +3713,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3662
3713
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { size: 16 })
3663
3714
  ] }, l))
3664
3715
  ] }) });
3665
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-ePAAihqK.js")), CanvasArea = () => {
3716
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-JFNyNUeD.js")), CanvasArea = () => {
3666
3717
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3667
3718
  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: [
3668
3719
  /* @__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, {}) }) }),
@@ -3737,42 +3788,42 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3737
3788
  showHeading: o = !0,
3738
3789
  className: n = ""
3739
3790
  }) => {
3740
- const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: w }, A) => {
3741
- A && (a(w), i.current = w);
3791
+ const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: C }, w) => {
3792
+ w && (a(C), i.current = C);
3742
3793
  }, {
3743
3794
  bodyFont: u,
3744
3795
  headingFont: p,
3745
- primaryColor: g,
3796
+ primaryColor: m,
3746
3797
  bodyTextDarkColor: x,
3747
- bodyTextLightColor: m,
3798
+ bodyTextLightColor: g,
3748
3799
  bodyBgDarkColor: E,
3749
- secondaryColor: b,
3750
- bodyBgLightColor: _,
3751
- roundedCorners: v
3800
+ secondaryColor: f,
3801
+ bodyBgLightColor: j,
3802
+ roundedCorners: k
3752
3803
  } = r;
3753
- let B = {
3754
- headingFont: f({
3804
+ let A = {
3805
+ headingFont: y({
3755
3806
  title: c("theme_config.heading_font"),
3756
3807
  default: p,
3757
3808
  options: FONTS
3758
3809
  }),
3759
- bodyFont: f({
3810
+ bodyFont: y({
3760
3811
  title: c("theme_config.body_font"),
3761
3812
  default: u,
3762
3813
  options: FONTS
3763
3814
  }),
3764
- roundedCorners: y({
3815
+ roundedCorners: s({
3765
3816
  title: c("theme_config.rounded_corner"),
3766
- default: parseInt(v || 5, 10)
3817
+ default: parseInt(k || 5, 10)
3767
3818
  }),
3768
- primaryColor: h({ title: c("theme_config.primary"), default: g }),
3769
- secondaryColor: h({ title: c("theme_config.secondary"), default: b })
3819
+ primaryColor: h({ title: c("theme_config.primary"), default: m }),
3820
+ secondaryColor: h({ title: c("theme_config.secondary"), default: f })
3770
3821
  };
3771
- l || (B = {
3772
- ...B,
3822
+ l || (A = {
3823
+ ...A,
3773
3824
  bodyBgLightColor: h({
3774
3825
  title: c("theme_config.background"),
3775
- default: _
3826
+ default: j
3776
3827
  }),
3777
3828
  bodyTextLightColor: h({
3778
3829
  title: c("theme_config.text_color"),
@@ -3784,16 +3835,16 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3784
3835
  }),
3785
3836
  bodyTextDarkColor: h({
3786
3837
  title: c("theme_config.text_color_dark_mode"),
3787
- default: m
3838
+ default: g
3788
3839
  })
3789
3840
  });
3790
- const C = {
3841
+ const S = {
3791
3842
  type: "object",
3792
3843
  properties: {}
3793
- }, I = {};
3794
- return Object.keys(B).forEach((w) => {
3795
- const A = B[w];
3796
- return C.properties || (C.properties = {}), C.properties[w] = A.schema, I[w] = A.uiSchema, !0;
3844
+ }, B = {};
3845
+ return Object.keys(A).forEach((C) => {
3846
+ const w = A[C];
3847
+ return S.properties || (S.properties = {}), S.properties[C] = w.schema, B[C] = w.uiSchema, !0;
3797
3848
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3798
3849
  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,
3799
3850
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3805,8 +3856,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3805
3856
  omitExtraData: !0,
3806
3857
  liveOmit: !0,
3807
3858
  liveValidate: !0,
3808
- uiSchema: I,
3809
- schema: C,
3859
+ uiSchema: B,
3860
+ schema: S,
3810
3861
  formData: r,
3811
3862
  validator,
3812
3863
  onChange: d
@@ -3989,34 +4040,34 @@ function BiExpandVertical(o) {
3989
4040
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
3990
4041
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
3991
4042
  let p = null;
3992
- const g = o.children.length > 0, { id: x, data: m, isSelected: E, willReceiveDrop: b, isDragging: _, isEditing: v, handleClick: B } = o, C = (L) => {
3993
- L.stopPropagation(), !i.includes(x) && o.toggle();
3994
- }, I = (L) => {
3995
- L.isInternal && (p = L.isOpen, L.isOpen && L.close());
3996
- }, w = (L) => {
3997
- L.isInternal && p !== null && (p ? L.open() : L.close(), p = null);
3998
- }, A = (L) => {
3999
- L.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), B(L);
4043
+ const m = o.children.length > 0, { id: x, data: g, isSelected: E, willReceiveDrop: f, isDragging: j, isEditing: k, handleClick: A } = o, S = (T) => {
4044
+ T.stopPropagation(), !i.includes(x) && o.toggle();
4045
+ }, B = (T) => {
4046
+ T.isInternal && (p = T.isOpen, T.isOpen && T.close());
4047
+ }, C = (T) => {
4048
+ T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
4049
+ }, w = (T) => {
4050
+ T.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), A(T);
4000
4051
  };
4001
4052
  useEffect(() => {
4002
- const L = setTimeout(() => {
4003
- b && !o.isOpen && !_ && !i.includes(x) && o.toggle();
4053
+ const T = setTimeout(() => {
4054
+ f && !o.isOpen && !j && !i.includes(x) && o.toggle();
4004
4055
  }, 500);
4005
- return () => clearTimeout(L);
4006
- }, [b, o, _]);
4056
+ return () => clearTimeout(T);
4057
+ }, [f, o, j]);
4007
4058
  const N = useMemo(() => {
4008
- const L = Object.keys(m), j = [];
4009
- for (let k = 0; k < L.length; k++)
4010
- if (L[k].endsWith("_attrs")) {
4011
- const S = m[L[k]], R = Object.keys(S).join("|");
4012
- R.match(/x-data/) && j.push("data"), R.match(/x-on/) && j.push("event"), R.match(/x-show|x-if/) && j.push("show");
4059
+ const T = Object.keys(g), b = [];
4060
+ for (let _ = 0; _ < T.length; _++)
4061
+ if (T[_].endsWith("_attrs")) {
4062
+ const R = g[T[_]], v = Object.keys(R).join("|");
4063
+ v.match(/x-data/) && b.push("data"), v.match(/x-on/) && b.push("event"), v.match(/x-show|x-if/) && b.push("show");
4013
4064
  }
4014
- return j;
4015
- }, [m]), P = (L, j) => {
4016
- const k = u.contentDocument || u.contentWindow.document, S = k.querySelector(`[data-block-id=${L}]`);
4017
- S && S.setAttribute("data-drop", j);
4018
- const R = S.getBoundingClientRect(), T = u.getBoundingClientRect();
4019
- R.top >= T.top && R.left >= T.left && R.bottom <= T.bottom && R.right <= T.right || (k.documentElement.scrollTop = S.offsetTop - T.top);
4065
+ return b;
4066
+ }, [g]), D = (T, b) => {
4067
+ const _ = u.contentDocument || u.contentWindow.document, R = _.querySelector(`[data-block-id=${T}]`);
4068
+ R && R.setAttribute("data-drop", b);
4069
+ const v = R.getBoundingClientRect(), I = u.getBoundingClientRect();
4070
+ v.top >= I.top && v.left >= I.left && v.bottom <= I.bottom && v.right <= I.right || (_.documentElement.scrollTop = R.offsetTop - I.top);
4020
4071
  };
4021
4072
  return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4022
4073
  "button",
@@ -4032,26 +4083,26 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4032
4083
  "div",
4033
4084
  {
4034
4085
  onMouseEnter: () => d(x),
4035
- onClick: A,
4086
+ onClick: w,
4036
4087
  style: n,
4037
4088
  "data-node-id": x,
4038
4089
  ref: i.includes(x) ? null : r,
4039
- onDragStart: () => I(o),
4040
- onDragEnd: () => w(o),
4041
- onDragOver: (L) => {
4042
- L.preventDefault(), P(x, "yes");
4090
+ onDragStart: () => B(o),
4091
+ onDragEnd: () => C(o),
4092
+ onDragOver: (T) => {
4093
+ T.preventDefault(), D(x, "yes");
4043
4094
  },
4044
- onDragLeave: (L) => {
4045
- L.preventDefault(), P(x, "no");
4095
+ onDragLeave: (T) => {
4096
+ T.preventDefault(), D(x, "no");
4046
4097
  },
4047
- onDrop: (L) => {
4048
- L.preventDefault(), P(x, "no");
4098
+ onDrop: (T) => {
4099
+ T.preventDefault(), D(x, "no");
4049
4100
  },
4050
4101
  className: cn(
4051
4102
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
4052
4103
  E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4053
- b && canAcceptChildBlock(m._type, "Icon") ? "bg-green-200" : "",
4054
- _ && "opacity-20",
4104
+ f && canAcceptChildBlock(g._type, "Icon") ? "bg-green-200" : "",
4105
+ j && "opacity-20",
4055
4106
  i.includes(x) ? "opacity-50" : ""
4056
4107
  ),
4057
4108
  children: [
@@ -4060,20 +4111,20 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4060
4111
  "div",
4061
4112
  {
4062
4113
  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" : ""}`,
4063
- children: g && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: C, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4114
+ children: m && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: S, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4064
4115
  }
4065
4116
  ),
4066
4117
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4067
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: m == null ? void 0 : m._type }) }),
4068
- v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4118
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: g == null ? void 0 : g._type }) }),
4119
+ k ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4069
4120
  "div",
4070
4121
  {
4071
4122
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
4072
- onDoubleClick: (L) => {
4073
- L.stopPropagation(), o.edit(), o.deselect();
4123
+ onDoubleClick: (T) => {
4124
+ T.stopPropagation(), o.edit(), o.deselect();
4074
4125
  },
4075
4126
  children: [
4076
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (m == null ? void 0 : m._name) || (m == null ? void 0 : m._type.split("/").pop()) }),
4127
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (g == null ? void 0 : g._name) || (g == null ? void 0 : g._type.split("/").pop()) }),
4077
4128
  N.includes("data") && /* @__PURE__ */ jsxRuntimeExports.jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
4078
4129
  N.includes("event") && /* @__PURE__ */ jsxRuntimeExports.jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
4079
4130
  N.includes("show") && /* @__PURE__ */ jsxRuntimeExports.jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
@@ -4083,18 +4134,18 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4083
4134
  ] })
4084
4135
  ] }),
4085
4136
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: [
4086
- !i.includes(x) && a.map((L) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4137
+ !i.includes(x) && a.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4087
4138
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4088
4139
  TooltipTrigger,
4089
4140
  {
4090
4141
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
4091
4142
  asChild: !0,
4092
- children: React__default.createElement(L.item, { blockId: x })
4143
+ children: React__default.createElement(T.item, { blockId: x })
4093
4144
  }
4094
4145
  ),
4095
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: L.tooltip })
4146
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: T.tooltip })
4096
4147
  ] })),
4097
- canAddChildBlock(m == null ? void 0 : m._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4148
+ canAddChildBlock(g == null ? void 0 : g._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4098
4149
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4099
4150
  TooltipTrigger,
4100
4151
  {
@@ -4110,8 +4161,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4110
4161
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4111
4162
  TooltipTrigger,
4112
4163
  {
4113
- onClick: (L) => {
4114
- L.stopPropagation(), c(x), o.isOpen && o.toggle();
4164
+ onClick: (T) => {
4165
+ T.stopPropagation(), c(x), o.isOpen && o.toggle();
4115
4166
  },
4116
4167
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",
4117
4168
  asChild: !0,
@@ -4466,8 +4517,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4466
4517
  const c = stringify([r]);
4467
4518
  return hasVideoEmbed(c) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(c)), 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 = c, [a];
4468
4519
  } else if (r.tagName === "svg") {
4469
- const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", g = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4470
- return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, g)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
4520
+ const c = find(r.attributes, { key: "height" }), d = find(r.attributes, { key: "width" }), u = get(c, "value") ? `[${get(c, "value")}px]` : "24px", p = get(d, "value") ? `[${get(d, "value")}px]` : "24px", m = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4521
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${p} h-${u}`, m)}`.trim(), r.attributes = filter(r.attributes, (x) => !includes(["style", "width", "height", "class"], x.key)), a.icon = stringify([r]), [a];
4471
4522
  } else if (r.tagName == "option" && n && ((i = n.block) == null ? void 0 : i._type) === "Select")
4472
4523
  return n.block.options.push({
4473
4524
  label: getTextContent(r.children),
@@ -4528,57 +4579,57 @@ function ExpandableObject(o) {
4528
4579
  level: d,
4529
4580
  style: u,
4530
4581
  shouldExpandNode: p,
4531
- clickToExpandNode: g
4582
+ clickToExpandNode: m
4532
4583
  } = o;
4533
- const x = useRef(!1), [m, E, b] = useBool(() => p(d, r, n));
4584
+ const x = useRef(!1), [g, E, f] = useBool(() => p(d, r, n));
4534
4585
  useEffect(() => {
4535
- x.current ? b(p(d, r, n)) : x.current = !0;
4586
+ x.current ? f(p(d, r, n)) : x.current = !0;
4536
4587
  }, [p]);
4537
- const _ = m ? u.collapseIcon : u.expandIcon, v = m ? "collapse JSON" : "expand JSON", B = useComponentId(), C = d + 1, I = a.length - 1, w = (A) => {
4538
- A.key === " " && (A.preventDefault(), E());
4588
+ const j = g ? u.collapseIcon : u.expandIcon, k = g ? "collapse JSON" : "expand JSON", A = useComponentId(), S = d + 1, B = a.length - 1, C = (w) => {
4589
+ w.key === " " && (w.preventDefault(), E());
4539
4590
  };
4540
4591
  return /* @__PURE__ */ createElement("div", {
4541
4592
  className: u.basicChildStyle,
4542
4593
  role: "list"
4543
4594
  }, /* @__PURE__ */ createElement("span", {
4544
- className: _,
4595
+ className: j,
4545
4596
  onClick: E,
4546
- onKeyDown: w,
4597
+ onKeyDown: C,
4547
4598
  role: "button",
4548
4599
  tabIndex: 0,
4549
- "aria-label": v,
4550
- "aria-expanded": m,
4551
- "aria-controls": m ? B : void 0
4552
- }), n && (g ? /* @__PURE__ */ createElement("span", {
4600
+ "aria-label": k,
4601
+ "aria-expanded": g,
4602
+ "aria-controls": g ? A : void 0
4603
+ }), n && (m ? /* @__PURE__ */ createElement("span", {
4553
4604
  className: u.clickableLabel,
4554
4605
  onClick: E,
4555
- onKeyDown: w,
4606
+ onKeyDown: C,
4556
4607
  role: "button",
4557
4608
  tabIndex: -1
4558
4609
  }, n, ":") : /* @__PURE__ */ createElement("span", {
4559
4610
  className: u.label
4560
4611
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4561
4612
  className: u.punctuation
4562
- }, i), m ? /* @__PURE__ */ createElement("div", {
4563
- id: B
4564
- }, a.map((A, N) => /* @__PURE__ */ createElement(DataRender, {
4565
- key: A[0] || N,
4566
- field: A[0],
4567
- value: A[1],
4613
+ }, i), g ? /* @__PURE__ */ createElement("div", {
4614
+ id: A
4615
+ }, a.map((w, N) => /* @__PURE__ */ createElement(DataRender, {
4616
+ key: w[0] || N,
4617
+ field: w[0],
4618
+ value: w[1],
4568
4619
  style: u,
4569
- lastElement: N === I,
4570
- level: C,
4620
+ lastElement: N === B,
4621
+ level: S,
4571
4622
  shouldExpandNode: p,
4572
- clickToExpandNode: g
4623
+ clickToExpandNode: m
4573
4624
  }))) : /* @__PURE__ */ createElement("span", {
4574
4625
  className: u.collapsedContent,
4575
4626
  onClick: E,
4576
- onKeyDown: w,
4627
+ onKeyDown: C,
4577
4628
  role: "button",
4578
4629
  tabIndex: -1,
4579
4630
  "aria-hidden": !0,
4580
- "aria-label": v,
4581
- "aria-expanded": m
4631
+ "aria-label": k,
4632
+ "aria-expanded": g
4582
4633
  }), /* @__PURE__ */ createElement("span", {
4583
4634
  className: u.punctuation
4584
4635
  }, c), !l && /* @__PURE__ */ createElement("span", {
@@ -4731,15 +4782,15 @@ const ViewData = ({ data: o, fullView: n }) => {
4731
4782
  dataType: i,
4732
4783
  appliedBindings: c
4733
4784
  }) => {
4734
- const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, g = o === "PROP", [x, m] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
4735
- (b) => !includes(c, b) && get(p, `props.${first(split(b, "."))}.binding`)
4736
- ) : d.filter((b) => i === get(u, b, "")), [o, d, c, i, p]);
4785
+ const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [x, g] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
4786
+ (f) => !includes(c, f) && get(p, `props.${first(split(f, "."))}.binding`)
4787
+ ) : d.filter((f) => i === get(u, f, "")), [o, d, c, i, p]);
4737
4788
  return useEffect(() => {
4738
4789
  n && l(n);
4739
4790
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4740
4791
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
4741
4792
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
4742
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: m, children: [
4793
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: x, onOpenChange: g, children: [
4743
4794
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4744
4795
  Button,
4745
4796
  {
@@ -4748,7 +4799,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4748
4799
  className: ` ${isEmpty(n) ? "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white" : "min-w-[350px] items-center justify-between"}`,
4749
4800
  children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4750
4801
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "pr-8 text-sm", children: [
4751
- g && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
4802
+ m && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
4752
4803
  n
4753
4804
  ] }),
4754
4805
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
@@ -4762,29 +4813,29 @@ const ViewData = ({ data: o, fullView: n }) => {
4762
4813
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
4763
4814
  /* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
4764
4815
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
4765
- /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (b) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4816
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4766
4817
  CommandItem,
4767
4818
  {
4768
- value: b,
4769
- className: `cursor-pointer ${g ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4770
- onSelect: (_) => {
4771
- r(find(E, (v) => v === _) || null), m(!1);
4819
+ value: f,
4820
+ className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4821
+ onSelect: (j) => {
4822
+ r(find(E, (k) => k === j) || null), g(!1);
4772
4823
  },
4773
4824
  children: [
4774
4825
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
4775
- /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === b ? "" : "opacity-0"}` }),
4776
- b
4826
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === f ? "" : "opacity-0"}` }),
4827
+ f
4777
4828
  ] }),
4778
- g ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, b, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, b) }) })
4829
+ m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, f, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, f) }) })
4779
4830
  ]
4780
4831
  },
4781
- b
4832
+ f
4782
4833
  )) })
4783
4834
  ] })
4784
4835
  ] }) })
4785
4836
  ] })
4786
4837
  ] }),
4787
- !g && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4838
+ !m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4788
4839
  ] });
4789
4840
  }, AddBindingModalContent = ({
4790
4841
  appliedBindings: o = [],
@@ -4792,20 +4843,20 @@ const ViewData = ({ data: o, fullView: n }) => {
4792
4843
  editMode: r,
4793
4844
  item: a
4794
4845
  }) => {
4795
- const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = useCallback(
4796
- (E, b) => {
4846
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
4847
+ (E, f) => {
4797
4848
  if (isEmpty(E))
4798
4849
  return "";
4799
4850
  {
4800
- const _ = get(b === "PROP" ? u : p, E, "");
4801
- if (isArray$1(_))
4851
+ const j = get(f === "PROP" ? u : p, E, "");
4852
+ if (isArray$1(j))
4802
4853
  return "list";
4803
- const v = typeof _;
4804
- return v === "string" ? "text" : v === "object" ? "model" : v;
4854
+ const k = typeof j;
4855
+ return k === "string" ? "text" : k === "object" ? "model" : k;
4805
4856
  }
4806
4857
  },
4807
4858
  [u, p]
4808
- ), [x, m] = useState(r ? g(a.key, "PROP") : "");
4859
+ ), [x, g] = useState(r ? m(a.key, "PROP") : "");
4809
4860
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4810
4861
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
4811
4862
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
@@ -4821,8 +4872,8 @@ const ViewData = ({ data: o, fullView: n }) => {
4821
4872
  value: l,
4822
4873
  setValue: i,
4823
4874
  onChange: (E) => {
4824
- const b = g(E, "PROP");
4825
- i(E), x !== b && d(""), m(b);
4875
+ const f = m(E, "PROP");
4876
+ i(E), x !== f && d(""), g(f);
4826
4877
  },
4827
4878
  data: u,
4828
4879
  dataType: x,
@@ -4839,8 +4890,8 @@ const ViewData = ({ data: o, fullView: n }) => {
4839
4890
  value: c,
4840
4891
  setValue: d,
4841
4892
  onChange: (E) => {
4842
- const b = g(E, "PATH");
4843
- d(x === b ? E : "");
4893
+ const f = m(E, "PATH");
4894
+ d(x === f ? E : "");
4844
4895
  },
4845
4896
  data: p,
4846
4897
  dataType: x,
@@ -4883,15 +4934,15 @@ const ViewData = ({ data: o, fullView: n }) => {
4883
4934
  dataProvider: l,
4884
4935
  appliedBindings: i
4885
4936
  }) => {
4886
- const [c, d] = useState("string"), u = (p, g) => {
4937
+ const [c, d] = useState("string"), u = (p, m) => {
4887
4938
  if (isEmpty(p))
4888
4939
  return "";
4889
4940
  {
4890
- const x = get(g === "PROP" ? a : l, p, "");
4941
+ const x = get(m === "PROP" ? a : l, p, "");
4891
4942
  if (isArray$1(x))
4892
4943
  return "list";
4893
- const m = typeof x;
4894
- return m === "string" ? "text" : m === "object" ? "model" : m;
4944
+ const g = typeof x;
4945
+ return g === "string" ? "text" : g === "object" ? "model" : g;
4895
4946
  }
4896
4947
  };
4897
4948
  return useEffect(() => d(() => u(o.key, "PROP")), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
@@ -4912,10 +4963,10 @@ const ViewData = ({ data: o, fullView: n }) => {
4912
4963
  ] });
4913
4964
  }, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
4914
4965
  const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
4915
- map(o, (x, m) => ({ key: m, value: x }))
4966
+ map(o, (x, g) => ({ key: g, value: x }))
4916
4967
  );
4917
4968
  useEffect(() => {
4918
- c(map(o, (x, m) => ({ key: m, value: x })));
4969
+ c(map(o, (x, g) => ({ key: g, value: x })));
4919
4970
  }, [r == null ? void 0 : r._id, o]);
4920
4971
  const d = useMemo(() => {
4921
4972
  if (isEmpty(a))
@@ -4925,21 +4976,21 @@ const ViewData = ({ data: o, fullView: n }) => {
4925
4976
  const x = last(i);
4926
4977
  return isEmpty(x == null ? void 0 : x.key) || isEmpty(x == null ? void 0 : x.value);
4927
4978
  }, [a, i]), u = (x) => {
4928
- const m = filter(i, (E) => E.key !== x.key);
4929
- c([...m, x]), g([...m, x]);
4979
+ const g = filter(i, (E) => E.key !== x.key);
4980
+ c([...g, x]), m([...g, x]);
4930
4981
  }, p = (x) => {
4931
- const m = filter(i, (E, b) => x !== b);
4932
- g([...m]);
4933
- }, g = useCallback(
4982
+ const g = filter(i, (E, f) => x !== f);
4983
+ m([...g]);
4984
+ }, m = useCallback(
4934
4985
  (x = []) => {
4935
4986
  if (c(x), isEmpty(x)) {
4936
4987
  n({});
4937
4988
  return;
4938
4989
  }
4939
- const m = {};
4990
+ const g = {};
4940
4991
  forEach(x, (E) => {
4941
- !isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(m, E.key, E.value);
4942
- }), n(m);
4992
+ !isEmpty(E == null ? void 0 : E.key) && !isEmpty(E == null ? void 0 : E.value) && set(g, E.key, E.value);
4993
+ }), n(g);
4943
4994
  },
4944
4995
  [n]
4945
4996
  );
@@ -4948,12 +4999,12 @@ const ViewData = ({ data: o, fullView: n }) => {
4948
4999
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
4949
5000
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
4950
5001
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
4951
- map(i, (x, m) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5002
+ map(i, (x, g) => /* @__PURE__ */ jsxRuntimeExports.jsx(
4952
5003
  NewDataBindingPair,
4953
5004
  {
4954
5005
  item: x,
4955
5006
  onAddBinding: u,
4956
- onRemove: () => p(m),
5007
+ onRemove: () => p(g),
4957
5008
  selectedBlock: r,
4958
5009
  dataProvider: a,
4959
5010
  appliedBindings: map(i, "key")
@@ -5047,7 +5098,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5047
5098
  }
5048
5099
  )
5049
5100
  ] });
5050
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-ypfGqude.js")), UploadImages = React__default.lazy(() => import("./UploadImages-UWFlkqDP.js")), ImagesPanel = ({
5101
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-vR5ig3Lz.js")), UploadImages = React__default.lazy(() => import("./UploadImages-jCqfO33R.js")), ImagesPanel = ({
5051
5102
  isModalView: o = !1,
5052
5103
  onSelect: n = () => {
5053
5104
  }
@@ -5205,18 +5256,18 @@ const ViewData = ({ data: o, fullView: n }) => {
5205
5256
  ] });
5206
5257
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5207
5258
  const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation();
5208
- Object.keys(n).forEach((g) => {
5209
- const x = n[g];
5259
+ Object.keys(n).forEach((m) => {
5260
+ const x = n[m];
5210
5261
  if (includes(["slot", "styles"], x.type))
5211
5262
  return;
5212
- const m = g;
5213
- c.properties[m] = getBlockJSONFromSchemas(x, u), d[m] = getBlockJSONFromUISchemas(x);
5263
+ const g = m;
5264
+ c.properties[g] = getBlockJSONFromSchemas(x, u), d[g] = getBlockJSONFromUISchemas(x);
5214
5265
  }), useEffect(() => {
5215
5266
  i(r);
5216
5267
  }, [o]);
5217
5268
  const p = useThrottledCallback(
5218
- async ({ formData: g }, x) => {
5219
- a({ formData: g }, x);
5269
+ async ({ formData: m }, x) => {
5270
+ a({ formData: m }, x);
5220
5271
  },
5221
5272
  [a],
5222
5273
  1e3
@@ -5242,8 +5293,8 @@ const ViewData = ({ data: o, fullView: n }) => {
5242
5293
  uiSchema: d,
5243
5294
  schema: c,
5244
5295
  formData: l,
5245
- onChange: ({ formData: g }, x) => {
5246
- x && (i(g), p({ formData: g }, x));
5296
+ onChange: ({ formData: m }, x) => {
5297
+ x && (i(m), p({ formData: m }, x));
5247
5298
  }
5248
5299
  }
5249
5300
  );
@@ -5302,32 +5353,35 @@ const ViewData = ({ data: o, fullView: n }) => {
5302
5353
  }
5303
5354
  ) })
5304
5355
  ] });
5356
+ }, ResetRSCBlockButton = ({ blockId: o }) => {
5357
+ const { t: n } = useTranslation(), { reset: r } = useRSCBlocksStore();
5358
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "outline", onClick: () => r(o), children: n("Reload") });
5305
5359
  };
5306
5360
  function BlockSettings() {
5307
- const o = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), r = useUpdateBlocksProps(), a = getBlockComponent(o == null ? void 0 : o._type), l = { ...o }, [i, c] = useState(l), d = useBuilderProp("dataBindingSupport", !1), u = ({ formData: E }, b, _) => {
5308
- if (b && (i == null ? void 0 : i._id) === o._id) {
5309
- const v = b.replace("root.", "");
5310
- r([o._id], { [v]: get(E, v) }, _);
5361
+ const o = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), r = useUpdateBlocksProps(), a = getBlockComponent(o == null ? void 0 : o._type), l = { ...o }, [i, c] = useState(l), d = useBuilderProp("dataBindingSupport", !1), u = ({ formData: f }, j, k) => {
5362
+ if (j && (i == null ? void 0 : i._id) === o._id) {
5363
+ const A = j.replace("root.", "");
5364
+ r([o._id], { [A]: get(f, A) }, k);
5311
5365
  }
5312
5366
  }, p = useCallback(
5313
- debounce(({ formData: E }, b, _) => {
5314
- u({ formData: E }, b, _), c(E);
5367
+ debounce(({ formData: f }, j, k) => {
5368
+ u({ formData: f }, j, k), c(f);
5315
5369
  }, 1500),
5316
5370
  [o == null ? void 0 : o._id]
5317
- ), g = ({ formData: E }, b) => {
5318
- if (b) {
5319
- const _ = b.replace("root.", "");
5371
+ ), m = ({ formData: f }, j) => {
5372
+ if (j) {
5373
+ const k = j.replace("root.", "");
5320
5374
  n(
5321
5375
  [o._id],
5322
- convertDotNotationToObject(_, get(E, _.split(".")))
5323
- ), p({ formData: E }, b, { [_]: get(i, _) });
5376
+ convertDotNotationToObject(k, get(f, k.split(".")))
5377
+ ), p({ formData: f }, j, { [k]: get(i, k) });
5324
5378
  }
5325
- }, x = keys(get(l, "_bindings", {})), m = useMemo(() => {
5326
- const E = cloneDeep(get(a, "props", {}));
5327
- return each(E, (b, _) => {
5328
- get(b, "hidden", !1) && delete E[_];
5329
- }), d && each(x, (b) => delete E[b]), E;
5330
- }, [a, x, d]);
5379
+ }, x = keys(get(l, "_bindings", {})), g = useMemo(() => {
5380
+ const f = cloneDeep(get(a, "props", {}));
5381
+ return each(f, (j, k) => {
5382
+ get(j, "hidden", !1) && delete f[k];
5383
+ }), d && each(x, (j) => delete f[j]), f;
5384
+ }, [a, x, d]), E = get(a, "server", !1);
5331
5385
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5332
5386
  d ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5333
5387
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
@@ -5344,8 +5398,8 @@ function BlockSettings() {
5344
5398
  DataBindingSetting$1,
5345
5399
  {
5346
5400
  bindingData: get(o, "_bindings", {}),
5347
- onChange: (E) => {
5348
- u({ formData: { _bindings: E } }, "root._bindings");
5401
+ onChange: (f) => {
5402
+ u({ formData: { _bindings: f } }, "root._bindings");
5349
5403
  }
5350
5404
  }
5351
5405
  ) })
@@ -5367,23 +5421,24 @@ function BlockSettings() {
5367
5421
  JSONForm,
5368
5422
  {
5369
5423
  id: o == null ? void 0 : o._id,
5370
- onChange: g,
5424
+ onChange: m,
5371
5425
  formData: l,
5372
- properties: m
5426
+ properties: g
5373
5427
  }
5374
5428
  )
5375
5429
  ] })
5376
5430
  ] })
5377
- ] }) : isEmpty(m) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5431
+ ] }) : isEmpty(g) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5378
5432
  JSONForm,
5379
5433
  {
5380
5434
  id: o == null ? void 0 : o._id,
5381
- onChange: g,
5435
+ onChange: m,
5382
5436
  formData: l,
5383
- properties: m
5437
+ properties: g
5384
5438
  }
5385
5439
  ),
5386
5440
  (o == null ? void 0 : o._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
5441
+ E ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: o == null ? void 0 : o._id }) : null,
5387
5442
  /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
5388
5443
  ] });
5389
5444
  }
@@ -5401,20 +5456,20 @@ const getBlockWithChildren = (o, n) => {
5401
5456
  const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore();
5402
5457
  return {
5403
5458
  askAi: useCallback(
5404
- async (u, p, g, x) => {
5459
+ async (u, p, m, x) => {
5405
5460
  if (l) {
5406
5461
  n(!0), a(null);
5407
5462
  try {
5408
- const m = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((v) => v._id === p))];
5409
- set(m, "0._parent", null);
5410
- const E = await l(u, g, m), { blocks: b, error: _ } = E;
5411
- if (_) {
5412
- a(_);
5463
+ const g = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((k) => k._id === p))];
5464
+ set(g, "0._parent", null);
5465
+ const E = await l(u, m, g), { blocks: f, error: j } = E;
5466
+ if (j) {
5467
+ a(j);
5413
5468
  return;
5414
5469
  }
5415
- u === "styles" ? c(b) : i(b), x && x(E);
5416
- } catch (m) {
5417
- a(m);
5470
+ u === "styles" ? c(f) : i(f), x && x(E);
5471
+ } catch (g) {
5472
+ a(g);
5418
5473
  } finally {
5419
5474
  n(!1), x && x();
5420
5475
  }
@@ -5488,14 +5543,14 @@ function Countdown() {
5488
5543
  ] });
5489
5544
  }
5490
5545
  const AskAIStyles = ({ blockId: o }) => {
5491
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, g] = useState();
5546
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
5492
5547
  useEffect(() => {
5493
- var m;
5494
- (m = d.current) == null || m.focus();
5548
+ var g;
5549
+ (g = d.current) == null || g.focus();
5495
5550
  }, []);
5496
- const x = (m) => {
5497
- const { usage: E } = m || {};
5498
- !l && E && g(E), u.current = setTimeout(() => g(void 0), 1e4), l || c("");
5551
+ const x = (g) => {
5552
+ const { usage: E } = g || {};
5553
+ !l && E && m(E), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
5499
5554
  };
5500
5555
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5501
5556
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("ask_ai") }),
@@ -5504,12 +5559,12 @@ const AskAIStyles = ({ blockId: o }) => {
5504
5559
  {
5505
5560
  ref: d,
5506
5561
  value: i,
5507
- onChange: (m) => c(m.target.value),
5562
+ onChange: (g) => c(g.target.value),
5508
5563
  placeholder: n("ask_ai_to_edit_styles"),
5509
5564
  className: "w-full border border-border focus:border-0",
5510
5565
  rows: 3,
5511
- onKeyDown: (m) => {
5512
- m.key === "Enter" && (m.preventDefault(), u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x));
5566
+ onKeyDown: (g) => {
5567
+ g.key === "Enter" && (g.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x));
5513
5568
  }
5514
5569
  }
5515
5570
  ),
@@ -5519,7 +5574,7 @@ const AskAIStyles = ({ blockId: o }) => {
5519
5574
  {
5520
5575
  disabled: i.trim().length < 5 || a,
5521
5576
  onClick: () => {
5522
- u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, x);
5577
+ u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, x);
5523
5578
  },
5524
5579
  variant: "default",
5525
5580
  className: "w-fit",
@@ -5555,25 +5610,25 @@ const AskAIStyles = ({ blockId: o }) => {
5555
5610
  keys: ["name"]
5556
5611
  });
5557
5612
  function ManualClasses() {
5558
- var A;
5559
- const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), m = () => {
5613
+ var w;
5614
+ 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 = (w = first(n)) == null ? void 0 : w.prop, x = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
5560
5615
  const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5561
5616
  a(i, N, !0), u("");
5562
- }, [E, b] = useState([]), _ = ({ value: N }) => {
5563
- const P = N.trim().toLowerCase(), L = P.match(/.+:/g);
5564
- let j = [];
5565
- if (L && L.length > 0) {
5566
- const [k] = L, S = P.replace(k, "");
5567
- j = fuse.search(S).map((T) => ({
5568
- ...T,
5569
- item: { ...T.item, name: k + T.item.name }
5617
+ }, [E, f] = useState([]), j = ({ value: N }) => {
5618
+ const D = N.trim().toLowerCase(), T = D.match(/.+:/g);
5619
+ let b = [];
5620
+ if (T && T.length > 0) {
5621
+ const [_] = T, R = D.replace(_, "");
5622
+ b = fuse.search(R).map((I) => ({
5623
+ ...I,
5624
+ item: { ...I.item, name: _ + I.item.name }
5570
5625
  }));
5571
5626
  } else
5572
- j = fuse.search(P);
5573
- return b(map(j, "item"));
5574
- }, v = () => {
5575
- b([]);
5576
- }, B = (N) => N.name, C = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), I = {
5627
+ b = fuse.search(D);
5628
+ return f(map(b, "item"));
5629
+ }, k = () => {
5630
+ f([]);
5631
+ }, A = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5577
5632
  autoComplete: "off",
5578
5633
  autoCorrect: "off",
5579
5634
  autoCapitalize: "off",
@@ -5581,11 +5636,11 @@ function ManualClasses() {
5581
5636
  placeholder: o("enter_classes_separated_by_space"),
5582
5637
  value: d,
5583
5638
  onKeyDown: (N) => {
5584
- N.key === "Enter" && d.trim() !== "" && m();
5639
+ N.key === "Enter" && d.trim() !== "" && g();
5585
5640
  },
5586
- onChange: (N, { newValue: P }) => u(P),
5641
+ onChange: (N, { newValue: D }) => u(D),
5587
5642
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5588
- }, w = () => {
5643
+ }, C = () => {
5589
5644
  if (navigator.clipboard === void 0) {
5590
5645
  p({
5591
5646
  title: o("clipboard_not_supported"),
@@ -5608,7 +5663,7 @@ function ManualClasses() {
5608
5663
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5609
5664
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
5610
5665
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5611
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: w, className: "cursor-pointer" }) }),
5666
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: C, className: "cursor-pointer" }) }),
5612
5667
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("copy_classes_to_clipboard") }) })
5613
5668
  ] })
5614
5669
  ] }),
@@ -5625,11 +5680,11 @@ function ManualClasses() {
5625
5680
  Autosuggest,
5626
5681
  {
5627
5682
  suggestions: E,
5628
- onSuggestionsFetchRequested: _,
5629
- onSuggestionsClearRequested: v,
5630
- getSuggestionValue: B,
5631
- renderSuggestion: C,
5632
- inputProps: I,
5683
+ onSuggestionsFetchRequested: j,
5684
+ onSuggestionsClearRequested: k,
5685
+ getSuggestionValue: A,
5686
+ renderSuggestion: S,
5687
+ inputProps: B,
5633
5688
  containerProps: {
5634
5689
  className: "relative h-8 w-full gap-y-1 py-1 border-border"
5635
5690
  },
@@ -5645,7 +5700,7 @@ function ManualClasses() {
5645
5700
  {
5646
5701
  variant: "outline",
5647
5702
  className: "h-6 border-border",
5648
- onClick: m,
5703
+ onClick: g,
5649
5704
  disabled: d.trim() === "",
5650
5705
  size: "sm",
5651
5706
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusIcon, {})
@@ -6059,38 +6114,38 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6059
6114
  ringColor: "ring",
6060
6115
  ringOffsetColor: "ring-offset"
6061
6116
  }, ColorChoice = ({ property: o, onChange: n }) => {
6062
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), g = get(p, "1", ""), x = get(p, "2", ""), m = useCallback(
6117
+ const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), x = get(p, "2", ""), g = useCallback(
6063
6118
  // eslint-disable-next-line no-shadow
6064
- (b) => {
6065
- ["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), u({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((_) => ({ ..._, color: b, shade: _.shade ? _.shade : "500" })));
6119
+ (f) => {
6120
+ ["current", "inherit", "transparent", "black", "white"].includes(f) ? (c([]), u({ color: f })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((j) => ({ ...j, color: f, shade: j.shade ? j.shade : "500" })));
6066
6121
  },
6067
6122
  [c, u]
6068
6123
  );
6069
6124
  useEffect(() => {
6070
- if (["current", "inherit", "transparent", "black", "white"].includes(g))
6125
+ if (["current", "inherit", "transparent", "black", "white"].includes(m))
6071
6126
  return c([]);
6072
6127
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6073
- }, [g]);
6128
+ }, [m]);
6074
6129
  const E = useCallback(
6075
6130
  // eslint-disable-next-line no-shadow
6076
- (b) => {
6077
- u({ color: g, shade: b });
6131
+ (f) => {
6132
+ u({ color: m, shade: f });
6078
6133
  },
6079
- [g]
6134
+ [m]
6080
6135
  );
6081
6136
  return useEffect(() => {
6082
6137
  u({ color: "", shade: "" });
6083
6138
  }, [r]), useEffect(() => {
6084
- const _ = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6085
- _.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(_, o);
6139
+ const j = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6140
+ j.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(j, o);
6086
6141
  }, [d, n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6087
6142
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6088
6143
  DropDown,
6089
6144
  {
6090
6145
  disabled: !l,
6091
6146
  rounded: !0,
6092
- selected: g,
6093
- onChange: m,
6147
+ selected: m,
6148
+ onChange: g,
6094
6149
  options: [
6095
6150
  "current",
6096
6151
  "transparent",
@@ -6123,7 +6178,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6123
6178
  ]
6124
6179
  }
6125
6180
  ) }),
6126
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !g || !l, onChange: E, options: i }) })
6181
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: x, disabled: !m || !l, onChange: E, options: i }) })
6127
6182
  ] });
6128
6183
  }, getUserInputValues = (o, n) => {
6129
6184
  o = o.toLowerCase();
@@ -6318,50 +6373,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6318
6373
  },
6319
6374
  a
6320
6375
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6321
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [x, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, b] = useState(!1), [_, v] = useState(""), [B, C] = useState(!1), [I, w] = useState(!1);
6376
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [x, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, f] = useState(!1), [j, k] = useState(""), [A, S] = useState(!1), [B, C] = useState(!1);
6322
6377
  useEffect(() => {
6323
- const { value: j, unit: k } = getClassValueAndUnit(i);
6324
- if (k === "") {
6325
- l(j), m(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6378
+ const { value: b, unit: _ } = getClassValueAndUnit(i);
6379
+ if (_ === "") {
6380
+ l(b), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6326
6381
  return;
6327
6382
  }
6328
- m(k), l(k === "class" || isEmpty(j) ? "" : j);
6383
+ g(_), l(_ === "class" || isEmpty(b) ? "" : b);
6329
6384
  }, [i, u, p]);
6330
- const A = useThrottledCallback((j) => c(j), [c], THROTTLE_TIME), N = useThrottledCallback((j) => c(j, !1), [c], THROTTLE_TIME), P = useCallback(
6331
- (j = !1) => {
6332
- const k = getUserInputValues(`${a}`, p);
6333
- if (get(k, "error", !1)) {
6334
- b(!0);
6385
+ const w = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
6386
+ (b = !1) => {
6387
+ const _ = getUserInputValues(`${a}`, p);
6388
+ if (get(_, "error", !1)) {
6389
+ f(!0);
6335
6390
  return;
6336
6391
  }
6337
- const S = get(k, "unit") !== "" ? get(k, "unit") : x;
6338
- if (S === "auto" || S === "none") {
6339
- A(`${d}${S}`);
6392
+ const R = get(_, "unit") !== "" ? get(_, "unit") : x;
6393
+ if (R === "auto" || R === "none") {
6394
+ w(`${d}${R}`);
6340
6395
  return;
6341
6396
  }
6342
- if (get(k, "value") === "")
6397
+ if (get(_, "value") === "")
6343
6398
  return;
6344
- const T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6345
- j ? N(T) : A(T);
6399
+ const I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6400
+ b ? N(I) : w(I);
6346
6401
  },
6347
- [A, N, a, x, d, p]
6348
- ), L = useCallback(
6349
- (j) => {
6350
- const k = getUserInputValues(`${a}`, p);
6351
- if (get(k, "error", !1)) {
6352
- b(!0);
6402
+ [w, N, a, x, d, p]
6403
+ ), T = useCallback(
6404
+ (b) => {
6405
+ const _ = getUserInputValues(`${a}`, p);
6406
+ if (get(_, "error", !1)) {
6407
+ f(!0);
6353
6408
  return;
6354
6409
  }
6355
- if (j === "auto" || j === "none") {
6356
- A(`${d}${j}`);
6410
+ if (b === "auto" || b === "none") {
6411
+ w(`${d}${b}`);
6357
6412
  return;
6358
6413
  }
6359
- if (get(k, "value") === "")
6414
+ if (get(_, "value") === "")
6360
6415
  return;
6361
- const S = get(k, "unit") !== "" ? get(k, "unit") : j, T = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6362
- A(T);
6416
+ const R = get(_, "unit") !== "" ? get(_, "unit") : b, I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6417
+ w(I);
6363
6418
  },
6364
- [A, a, d, p]
6419
+ [w, a, d, p]
6365
6420
  );
6366
6421
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: x === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6367
6422
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
@@ -6369,37 +6424,37 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6369
6424
  /* @__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, {}) }) }),
6370
6425
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6371
6426
  ] })
6372
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${B ? "z-auto" : ""}`, children: [
6427
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${A ? "z-auto" : ""}`, children: [
6373
6428
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6374
6429
  ["none", "auto"].indexOf(x) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6375
6430
  "input",
6376
6431
  {
6377
6432
  readOnly: x === "class",
6378
- onKeyPress: (j) => {
6379
- j.key === "Enter" && P();
6433
+ onKeyPress: (b) => {
6434
+ b.key === "Enter" && D();
6380
6435
  },
6381
- onKeyDown: (j) => {
6382
- if (j.keyCode !== 38 && j.keyCode !== 40)
6436
+ onKeyDown: (b) => {
6437
+ if (b.keyCode !== 38 && b.keyCode !== 40)
6383
6438
  return;
6384
- j.preventDefault(), w(!0);
6385
- const k = parseInt$1(j.target.value);
6386
- let S = isNaN$1(k) ? 0 : k;
6387
- j.keyCode === 38 && (S += 1), j.keyCode === 40 && (S -= 1);
6388
- const R = `${S}`, D = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
6389
- N(D);
6439
+ b.preventDefault(), C(!0);
6440
+ const _ = parseInt$1(b.target.value);
6441
+ let R = isNaN$1(_) ? 0 : _;
6442
+ b.keyCode === 38 && (R += 1), b.keyCode === 40 && (R -= 1);
6443
+ const v = `${R}`, L = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${x === "-" ? "" : x}]`;
6444
+ N(L);
6390
6445
  },
6391
- onKeyUp: (j) => {
6392
- I && (j.preventDefault(), w(!1));
6446
+ onKeyUp: (b) => {
6447
+ B && (b.preventDefault(), C(!1));
6393
6448
  },
6394
- onBlur: () => P(),
6395
- onChange: (j) => {
6396
- b(!1), l(j.target.value);
6449
+ onBlur: () => D(),
6450
+ onChange: (b) => {
6451
+ f(!1), l(b.target.value);
6397
6452
  },
6398
- onClick: (j) => {
6399
- var k;
6400
- (k = j == null ? void 0 : j.target) == null || k.select(), r(!1);
6453
+ onClick: (b) => {
6454
+ var _;
6455
+ (_ = b == null ? void 0 : b.target) == null || _.select(), r(!1);
6401
6456
  },
6402
- value: B ? _ : a,
6457
+ value: A ? j : a,
6403
6458
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6404
6459
  " ",
6405
6460
  E ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -6424,33 +6479,33 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6424
6479
  {
6425
6480
  units: p,
6426
6481
  current: x,
6427
- onSelect: (j) => {
6428
- r(!1), m(j), L(j);
6482
+ onSelect: (b) => {
6483
+ r(!1), g(b), T(b);
6429
6484
  }
6430
6485
  }
6431
6486
  ) }) })
6432
6487
  ] })
6433
6488
  ] }),
6434
- ["none", "auto"].indexOf(x) !== -1 || B ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6489
+ ["none", "auto"].indexOf(x) !== -1 || A ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6435
6490
  DragStyleButton,
6436
6491
  {
6437
- onDragStart: () => C(!0),
6438
- onDragEnd: (j) => {
6439
- if (v(() => ""), C(!1), isEmpty(j))
6492
+ onDragStart: () => S(!0),
6493
+ onDragEnd: (b) => {
6494
+ if (k(() => ""), S(!1), isEmpty(b))
6440
6495
  return;
6441
- const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6442
- A(R);
6496
+ const _ = `${b}`, v = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
6497
+ w(v);
6443
6498
  },
6444
- onDrag: (j) => {
6445
- if (isEmpty(j))
6499
+ onDrag: (b) => {
6500
+ if (isEmpty(b))
6446
6501
  return;
6447
- v(j);
6448
- const k = `${j}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6449
- N(R);
6502
+ k(b);
6503
+ const _ = `${b}`, v = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
6504
+ N(v);
6450
6505
  },
6451
6506
  currentValue: a,
6452
6507
  unit: x,
6453
- negative: g,
6508
+ negative: m,
6454
6509
  cssProperty: u
6455
6510
  }
6456
6511
  )
@@ -6543,23 +6598,23 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6543
6598
  "2xl": "1536px"
6544
6599
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6545
6600
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6546
- }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), x = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [b] = useSelectedBlockIds(), _ = useMemo(() => get(x, "fullCls", ""), [x]), v = useCallback(
6547
- (N, P = !0) => {
6548
- const L = { dark: u, mq: g, mod: p, cls: N, property: l, fullCls: "" };
6549
- (u || p !== "") && (L.mq = "xs");
6550
- const j = generateFullClsName(L);
6551
- m(b, [j], P);
6601
+ }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), x = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), j = useMemo(() => get(x, "fullCls", ""), [x]), k = useCallback(
6602
+ (N, D = !0) => {
6603
+ const T = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
6604
+ (u || p !== "") && (T.mq = "xs");
6605
+ const b = generateFullClsName(T);
6606
+ g(f, [b], D);
6552
6607
  },
6553
- [b, u, g, p, l, m]
6554
- ), B = useCallback(() => {
6555
- E(b, [_]);
6556
- }, [b, _, E]), C = useMemo(() => canChangeClass(x, g), [x, g]);
6608
+ [f, u, m, p, l, g]
6609
+ ), A = useCallback(() => {
6610
+ E(f, [j]);
6611
+ }, [f, j, E]), S = useMemo(() => canChangeClass(x, m), [x, m]);
6557
6612
  useEffect(() => {
6558
- i(C, x);
6559
- }, [C, i, x]);
6560
- const [, , I] = useCanvasWidth(), w = useCallback(
6613
+ i(S, x);
6614
+ }, [S, i, x]);
6615
+ const [, , B] = useCanvasWidth(), C = useCallback(
6561
6616
  (N) => {
6562
- I({
6617
+ B({
6563
6618
  xs: 400,
6564
6619
  sm: 640,
6565
6620
  md: 800,
@@ -6568,10 +6623,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6568
6623
  "2xl": 1920
6569
6624
  }[N]);
6570
6625
  },
6571
- [I]
6572
- ), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === g;
6573
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: x && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6574
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !A ? "text-foreground" : ""}`, children: n(a) }) }),
6626
+ [B]
6627
+ ), w = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === m;
6628
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && w, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6629
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !w ? "text-foreground" : ""}`, children: n(a) }) }),
6575
6630
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6576
6631
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6577
6632
  r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -6580,17 +6635,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6580
6635
  currentClass: get(x, "cls", ""),
6581
6636
  classPrefix: get(CLASS_PREFIXES, l, ""),
6582
6637
  units: c || [],
6583
- onChange: v,
6638
+ onChange: k,
6584
6639
  negative: d,
6585
6640
  cssProperty: l
6586
6641
  }
6587
6642
  ) : null,
6588
- r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: v }),
6589
- r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: v }),
6590
- r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: v }),
6591
- r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: v })
6643
+ r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: k }),
6644
+ r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: k }),
6645
+ r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6646
+ r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6592
6647
  ] }),
6593
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${_ ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => B(), 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 && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6648
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${j ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => A(), 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" }) }) : S && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6594
6649
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6595
6650
  "button",
6596
6651
  {
@@ -6610,7 +6665,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6610
6665
  "button",
6611
6666
  {
6612
6667
  type: "button",
6613
- onClick: () => w(get(x, "mq")),
6668
+ onClick: () => C(get(x, "mq")),
6614
6669
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6615
6670
  children: [
6616
6671
  "Switch to ",
@@ -6631,7 +6686,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6631
6686
  units: i = basicUnits,
6632
6687
  negative: c = !1
6633
6688
  }) => {
6634
- const { t: d } = useTranslation(), [u, p] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), x = useCallback((m) => map(g, "property").includes(m), [g]);
6689
+ const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), x = useCallback((g) => map(m, "property").includes(g), [m]);
6635
6690
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6636
6691
  "div",
6637
6692
  {
@@ -6640,7 +6695,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6640
6695
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row text-xs", children: [
6641
6696
  o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "relative w-[70px] flex-none text-xs text-foreground", children: d(o) }),
6642
6697
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3 flex grow flex-row flex-wrap gap-x-px", children: React__default.Children.toArray(
6643
- n.map(({ label: m, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6698
+ n.map(({ label: g, key: E }) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "first:rounded-l last:rounded-r", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6644
6699
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
6645
6700
  "button",
6646
6701
  {
@@ -6655,7 +6710,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6655
6710
  ]
6656
6711
  }
6657
6712
  ) }),
6658
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(m)) })
6713
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: startCase(toLower(g)) })
6659
6714
  ] }) }))
6660
6715
  ) })
6661
6716
  ] }),
@@ -6720,8 +6775,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6720
6775
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
6721
6776
  return null;
6722
6777
  const u = (p) => {
6723
- const g = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6724
- l([o._id], g, !0);
6778
+ const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6779
+ l([o._id], m, !0);
6725
6780
  };
6726
6781
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
6727
6782
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
@@ -6775,13 +6830,13 @@ function BlockStyling() {
6775
6830
  cssProperty: ""
6776
6831
  }), d = useThrottledCallback(
6777
6832
  (p) => {
6778
- const g = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6779
- let m = parseFloat(i.dragStartValue);
6780
- m = isNaN(m) ? 0 : m;
6833
+ const m = !get(i, "negative", !1), x = get(i, "cssProperty", "");
6834
+ let g = parseFloat(i.dragStartValue);
6835
+ g = isNaN(g) ? 0 : g;
6781
6836
  let E = MAPPER[i.dragUnit];
6782
6837
  (startsWith(x, "scale") || x === "opacity") && (E = 10);
6783
- let _ = (i.dragStartY - p.pageY) / E + m;
6784
- g && _ < 0 && (_ = 0), x === "opacity" && _ > 1 && (_ = 1), i.onDrag(`${_}`), l(`${_}`);
6838
+ let j = (i.dragStartY - p.pageY) / E + g;
6839
+ m && j < 0 && (j = 0), x === "opacity" && j > 1 && (j = 1), i.onDrag(`${j}`), l(`${j}`);
6785
6840
  },
6786
6841
  [i],
6787
6842
  50
@@ -6867,33 +6922,33 @@ const BlockCard = ({
6867
6922
  library: n,
6868
6923
  parentId: r = void 0
6869
6924
  }) => {
6870
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), g = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, m] = useAtom$1(draggedBlockAtom), E = (v) => {
6871
- const B = has(v, "styles_attrs.data-page-section");
6872
- return v._type === "Box" && B;
6873
- }, b = useCallback(
6874
- async (v) => {
6875
- if (v.stopPropagation(), has(o, "component")) {
6925
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), m = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, g] = useAtom$1(draggedBlockAtom), E = (k) => {
6926
+ const A = has(k, "styles_attrs.data-page-section");
6927
+ return k._type === "Box" && A;
6928
+ }, f = useCallback(
6929
+ async (k) => {
6930
+ if (k.stopPropagation(), has(o, "component")) {
6876
6931
  c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6877
6932
  return;
6878
6933
  }
6879
6934
  l(!0);
6880
- const B = await i(n, o);
6881
- isEmpty(B) || d(syncBlocksWithDefaults(B), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6935
+ const A = await i(n, o);
6936
+ isEmpty(A) || d(syncBlocksWithDefaults(A), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6882
6937
  },
6883
6938
  [o]
6884
- ), _ = async (v) => {
6885
- const B = await i(n, o);
6886
- let C = r;
6887
- if (E(first(B)) && (C = null), !isEmpty(B)) {
6888
- const I = { blocks: B, uiLibrary: !0, parent: C };
6889
- if (v.dataTransfer.setData("text/plain", JSON.stringify(I)), o.preview) {
6890
- const w = new Image();
6891
- w.src = o.preview, w.onload = () => {
6892
- v.dataTransfer.setDragImage(w, 0, 0);
6939
+ ), j = async (k) => {
6940
+ const A = await i(n, o);
6941
+ let S = r;
6942
+ if (E(first(A)) && (S = null), !isEmpty(A)) {
6943
+ const B = { blocks: A, uiLibrary: !0, parent: S };
6944
+ if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
6945
+ const C = new Image();
6946
+ C.src = o.preview, C.onload = () => {
6947
+ k.dataTransfer.setDragImage(C, 0, 0);
6893
6948
  };
6894
6949
  } else
6895
- v.dataTransfer.setDragImage(new Image(), 0, 0);
6896
- m(I), setTimeout(() => {
6950
+ k.dataTransfer.setDragImage(new Image(), 0, 0);
6951
+ g(B), setTimeout(() => {
6897
6952
  u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6898
6953
  }, 200);
6899
6954
  }
@@ -6903,9 +6958,9 @@ const BlockCard = ({
6903
6958
  "div",
6904
6959
  {
6905
6960
  onClick: a ? () => {
6906
- } : b,
6961
+ } : f,
6907
6962
  draggable: x ? "true" : "false",
6908
- onDragStart: _,
6963
+ onDragStart: j,
6909
6964
  className: clsx(
6910
6965
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
6911
6966
  ),
@@ -6914,11 +6969,11 @@ const BlockCard = ({
6914
6969
  /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
6915
6970
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
6916
6971
  ] }),
6917
- o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: g }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: g }) })
6972
+ o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: m }) })
6918
6973
  ]
6919
6974
  }
6920
6975
  ) }),
6921
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g }) })
6976
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
6922
6977
  ] });
6923
6978
  }, libraryBlocksAtom = atom$1(
6924
6979
  {}
@@ -6934,9 +6989,9 @@ const BlockCard = ({
6934
6989
  })();
6935
6990
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
6936
6991
  }, UILibrarySection = ({ parentId: o }) => {
6937
- 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"), [g, x] = useState("Hero"), m = get(p, g, []), E = useRef(null), { t: b } = useTranslation(), _ = (C) => {
6992
+ const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, x] = useState("Hero"), g = get(p, m, []), E = useRef(null), { t: f } = useTranslation(), j = (S) => {
6938
6993
  E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
6939
- E.current && x(C);
6994
+ E.current && x(S);
6940
6995
  }, 300);
6941
6996
  };
6942
6997
  if (u)
@@ -6944,30 +6999,30 @@ const BlockCard = ({
6944
6999
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
6945
7000
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
6946
7001
  ] });
6947
- const v = filter(m, (C, I) => I % 2 === 0), B = filter(m, (C, I) => I % 2 === 1);
7002
+ const k = filter(g, (S, B) => B % 2 === 0), A = filter(g, (S, B) => B % 2 === 1);
6948
7003
  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: [
6949
7004
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
6950
7005
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
6951
7006
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
6952
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: b("groups") }),
7007
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: f("groups") }),
6953
7008
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
6954
7009
  /* @__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(
6955
- map(p, (C, I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7010
+ map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
6956
7011
  "div",
6957
7012
  {
6958
- onMouseEnter: () => _(I),
7013
+ onMouseEnter: () => j(B),
6959
7014
  onMouseLeave: () => clearTimeout(E.current),
6960
- onClick: () => x(I),
7015
+ onClick: () => x(B),
6961
7016
  className: cn(
6962
7017
  "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",
6963
- I === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7018
+ B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
6964
7019
  ),
6965
7020
  children: [
6966
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(b(I.toLowerCase())) }),
7021
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(f(B.toLowerCase())) }),
6967
7022
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
6968
7023
  ]
6969
7024
  },
6970
- I
7025
+ B
6971
7026
  ))
6972
7027
  ) })
6973
7028
  ] })
@@ -6980,10 +7035,10 @@ const BlockCard = ({
6980
7035
  children: [
6981
7036
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
6982
7037
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
6983
- v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7038
+ k.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
6984
7039
  ) }),
6985
7040
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
6986
- B.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7041
+ A.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
6987
7042
  ) })
6988
7043
  ] }),
6989
7044
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -7428,14 +7483,14 @@ i18n.use(initReactI18next).init({
7428
7483
  }
7429
7484
  });
7430
7485
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7431
- const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, g] = useHighlightBlockId(), x = () => {
7486
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, m] = useHighlightBlockId(), x = () => {
7432
7487
  if (console.log("addBlockToPage", o, r), has(o, "blocks")) {
7433
- const b = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7434
- u(syncBlocksWithDefaults(b), r || null);
7488
+ const f = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7489
+ u(syncBlocksWithDefaults(f), r || null);
7435
7490
  } else
7436
7491
  d(o, r || null);
7437
7492
  emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7438
- }, m = useFeature("dnd"), { t: E } = useTranslation();
7493
+ }, g = useFeature("dnd"), { t: E } = useTranslation();
7439
7494
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
7440
7495
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7441
7496
  "button",
@@ -7443,12 +7498,12 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7443
7498
  disabled: n,
7444
7499
  onClick: x,
7445
7500
  type: "button",
7446
- onDragStart: (b) => {
7447
- b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7448
- p([]), g(null);
7501
+ onDragStart: (f) => {
7502
+ f.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), f.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7503
+ p([]), m(null);
7449
7504
  }, 200);
7450
7505
  },
7451
- draggable: m ? "true" : "false",
7506
+ draggable: g ? "true" : "false",
7452
7507
  className: "cursor-pointer space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-400 dark:border-gray-700 dark:text-white dark:hover:bg-slate-800/50 dark:disabled:bg-gray-900 dark:disabled:text-foreground",
7453
7508
  children: [
7454
7509
  createElement(i || BoxIcon, { className: "w-4 h-4 mx-auto" }),
@@ -7617,14 +7672,14 @@ function QuickPrompts({ onClick: o }) {
7617
7672
  ) }) });
7618
7673
  }
7619
7674
  const AIUserPrompt = ({ blockId: o }) => {
7620
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, g] = useState(), x = useRef(null), m = useRef(null);
7675
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), x = useRef(null), g = useRef(null);
7621
7676
  useEffect(() => {
7622
- var b;
7623
- (b = x.current) == null || b.focus();
7677
+ var f;
7678
+ (f = x.current) == null || f.focus();
7624
7679
  }, []);
7625
- const E = (b) => {
7626
- const { usage: _ } = b || {};
7627
- !l && _ && g(_), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
7680
+ const E = (f) => {
7681
+ const { usage: j } = f || {};
7682
+ !l && j && m(j), g.current = setTimeout(() => m(void 0), 1e4), l || c("");
7628
7683
  };
7629
7684
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
7630
7685
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -7644,12 +7699,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7644
7699
  {
7645
7700
  ref: x,
7646
7701
  value: i,
7647
- onChange: (b) => c(b.target.value),
7702
+ onChange: (f) => c(f.target.value),
7648
7703
  placeholder: n("Ask AI to edit content"),
7649
7704
  className: "w-full",
7650
7705
  rows: 3,
7651
- onKeyDown: (b) => {
7652
- b.key === "Enter" && (b.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E));
7706
+ onKeyDown: (f) => {
7707
+ f.key === "Enter" && (f.preventDefault(), g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E));
7653
7708
  }
7654
7709
  }
7655
7710
  ),
@@ -7659,7 +7714,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7659
7714
  {
7660
7715
  disabled: i.trim().length < 5 || a,
7661
7716
  onClick: () => {
7662
- m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E);
7717
+ g.current && clearTimeout(g.current), m(void 0), r("content", o, i, E);
7663
7718
  },
7664
7719
  variant: "default",
7665
7720
  className: "w-fit",
@@ -7691,8 +7746,8 @@ const AIUserPrompt = ({ blockId: o }) => {
7691
7746
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7692
7747
  QuickPrompts,
7693
7748
  {
7694
- onClick: (b) => {
7695
- m.current && clearTimeout(m.current), g(void 0), r("content", o, b, E);
7749
+ onClick: (f) => {
7750
+ g.current && clearTimeout(g.current), m(void 0), r("content", o, f, E);
7696
7751
  }
7697
7752
  }
7698
7753
  )
@@ -7702,7 +7757,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7702
7757
  ] }) }) : null
7703
7758
  ] });
7704
7759
  }, AISetContext = () => {
7705
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, g] = useState(!1), { toast: x } = useToast(), m = useRef(null);
7760
+ const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: x } = useToast(), g = useRef(null);
7706
7761
  useEffect(() => {
7707
7762
  n && a(n);
7708
7763
  }, [n]);
@@ -7712,9 +7767,9 @@ const AIUserPrompt = ({ blockId: o }) => {
7712
7767
  title: o("Updated AI Context"),
7713
7768
  description: o("You can now Ask AI to edit your content"),
7714
7769
  variant: "default"
7715
- }), m.current.click();
7716
- } catch (b) {
7717
- p(b);
7770
+ }), g.current.click();
7771
+ } catch (f) {
7772
+ p(f);
7718
7773
  } finally {
7719
7774
  d(!1);
7720
7775
  }
@@ -7722,25 +7777,25 @@ const AIUserPrompt = ({ blockId: o }) => {
7722
7777
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
7723
7778
  Accordion,
7724
7779
  {
7725
- onValueChange: (b) => {
7726
- g(b !== "");
7780
+ onValueChange: (f) => {
7781
+ m(f !== "");
7727
7782
  },
7728
7783
  type: "single",
7729
7784
  collapsible: !0,
7730
7785
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "set-context", className: "border-none", children: [
7731
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: m, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
7786
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { ref: g, className: "border-b border-border py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-bold text-muted-foreground", children: o("AI Context") }) }) }),
7732
7787
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { children: [
7733
7788
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7734
7789
  Textarea,
7735
7790
  {
7736
7791
  ref: l,
7737
7792
  value: r,
7738
- onChange: (b) => a(b.target.value),
7793
+ onChange: (f) => a(f.target.value),
7739
7794
  placeholder: o("Tell about this page eg this page is about"),
7740
7795
  className: "mt-1 w-full",
7741
7796
  rows: 10,
7742
- onKeyDown: (b) => {
7743
- b.key === "Enter" && (b.preventDefault(), E());
7797
+ onKeyDown: (f) => {
7798
+ f.key === "Enter" && (f.preventDefault(), E());
7744
7799
  }
7745
7800
  }
7746
7801
  ),
@@ -7802,42 +7857,42 @@ const AIUserPrompt = ({ blockId: o }) => {
7802
7857
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
7803
7858
  ] });
7804
7859
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
7805
- const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [x, m] = useState(""), E = useRef(null), b = useRef(null);
7860
+ const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [x, g] = useState(""), E = useRef(null), f = useRef(null);
7806
7861
  useEffect(() => {
7807
7862
  l(n);
7808
7863
  }, [n]);
7809
- const _ = () => {
7864
+ const j = () => {
7810
7865
  if (i.startsWith("@")) {
7811
- m("Attribute keys cannot start with '@'");
7866
+ g("Attribute keys cannot start with '@'");
7812
7867
  return;
7813
7868
  }
7814
7869
  if (i) {
7815
- const w = [...a, { key: i, value: d }];
7816
- r(w), l(a), c(""), u(""), m("");
7870
+ const C = [...a, { key: i, value: d }];
7871
+ r(C), l(a), c(""), u(""), g("");
7817
7872
  }
7818
- }, v = (w) => {
7819
- const A = a.filter((N, P) => P !== w);
7820
- r(A), l(A);
7821
- }, B = (w) => {
7822
- g(w), c(a[w].key), u(a[w].value);
7823
- }, C = () => {
7873
+ }, k = (C) => {
7874
+ const w = a.filter((N, D) => D !== C);
7875
+ r(w), l(w);
7876
+ }, A = (C) => {
7877
+ m(C), c(a[C].key), u(a[C].value);
7878
+ }, S = () => {
7824
7879
  if (i.startsWith("@")) {
7825
- m("Attribute keys cannot start with '@'");
7880
+ g("Attribute keys cannot start with '@'");
7826
7881
  return;
7827
7882
  }
7828
7883
  if (p !== null && i) {
7829
- const w = [...a];
7830
- w[p] = { key: i, value: d }, r(w), l(w), g(null), c(""), u(""), m("");
7884
+ const C = [...a];
7885
+ C[p] = { key: i, value: d }, r(C), l(C), m(null), c(""), u(""), g("");
7831
7886
  }
7832
- }, I = (w) => {
7833
- w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? C() : _());
7887
+ }, B = (C) => {
7888
+ C.key === "Enter" && !C.shiftKey && (C.preventDefault(), p !== null ? S() : j());
7834
7889
  };
7835
7890
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
7836
7891
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7837
7892
  "form",
7838
7893
  {
7839
- onSubmit: (w) => {
7840
- w.preventDefault(), p !== null ? C() : _();
7894
+ onSubmit: (C) => {
7895
+ C.preventDefault(), p !== null ? S() : j();
7841
7896
  },
7842
7897
  className: "space-y-3",
7843
7898
  children: [
@@ -7853,7 +7908,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7853
7908
  id: "attrKey",
7854
7909
  ref: E,
7855
7910
  value: i,
7856
- onChange: (w) => c(w.target.value),
7911
+ onChange: (C) => c(C.target.value),
7857
7912
  placeholder: "Key",
7858
7913
  className: "h-8 text-sm"
7859
7914
  }
@@ -7869,10 +7924,10 @@ const AIUserPrompt = ({ blockId: o }) => {
7869
7924
  spellCheck: "false",
7870
7925
  id: "attrValue",
7871
7926
  rows: 2,
7872
- ref: b,
7927
+ ref: f,
7873
7928
  value: d,
7874
- onChange: (w) => u(w.target.value),
7875
- onKeyDown: I,
7929
+ onChange: (C) => u(C.target.value),
7930
+ onKeyDown: B,
7876
7931
  placeholder: "Value",
7877
7932
  className: "bg-background text-sm"
7878
7933
  }
@@ -7884,22 +7939,22 @@ const AIUserPrompt = ({ blockId: o }) => {
7884
7939
  ]
7885
7940
  }
7886
7941
  ),
7887
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((w, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
7942
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((C, w) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
7888
7943
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
7889
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: w.key }),
7890
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: w.value.toString() })
7944
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: C.key }),
7945
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: C.value.toString() })
7891
7946
  ] }),
7892
7947
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
7893
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(A), children: [
7948
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(w), children: [
7894
7949
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
7895
7950
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
7896
7951
  ] }),
7897
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: [
7952
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(w), children: [
7898
7953
  /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
7899
7954
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
7900
7955
  ] })
7901
7956
  ] })
7902
- ] }, A)) })
7957
+ ] }, w)) })
7903
7958
  ] });
7904
7959
  }), BlockAttributesEditor = React.memo(() => {
7905
7960
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -8316,16 +8371,16 @@ function RemoveProviderConfirmation({
8316
8371
  }
8317
8372
  const PageDataProviders = () => {
8318
8373
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8319
- filter(n, (_) => map(r, "providerKey").includes(_.providerKey))
8320
- ), [d, u] = useState(""), [p, g] = useState(null), x = filter(
8321
- n.map((_) => map(i, "providerKey").includes(_.providerKey) ? null : { value: _.providerKey, label: _.name }),
8322
- (_) => !isNull(_)
8323
- ), m = (_) => {
8324
- const v = find(n, { providerKey: _ });
8325
- c((B) => [...B, v]), a((B) => [...B, { providerKey: v.providerKey, args: {} }]), u(""), l("UNSAVED");
8326
- }, E = (_) => {
8327
- c((v) => filter(v, (B) => B.providerKey !== _.providerKey)), a((v) => filter(v, (B) => B.providerKey !== _.providerKey)), l("UNSAVED");
8328
- }, b = (_) => g(_);
8374
+ filter(n, (j) => map(r, "providerKey").includes(j.providerKey))
8375
+ ), [d, u] = useState(""), [p, m] = useState(null), x = filter(
8376
+ n.map((j) => map(i, "providerKey").includes(j.providerKey) ? null : { value: j.providerKey, label: j.name }),
8377
+ (j) => !isNull(j)
8378
+ ), g = (j) => {
8379
+ const k = find(n, { providerKey: j });
8380
+ c((A) => [...A, k]), a((A) => [...A, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8381
+ }, E = (j) => {
8382
+ c((k) => filter(k, (A) => A.providerKey !== j.providerKey)), a((k) => filter(k, (A) => A.providerKey !== j.providerKey)), l("UNSAVED");
8383
+ }, f = (j) => m(j);
8329
8384
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8330
8385
  o("no_data_providers"),
8331
8386
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8333,11 +8388,11 @@ const PageDataProviders = () => {
8333
8388
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
8334
8389
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
8335
8390
  /* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
8336
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (_) => m(_), children: [
8391
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (j) => g(j), children: [
8337
8392
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
8338
8393
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
8339
8394
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
8340
- x.map((_) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: _.value, children: _.label }, _.value))
8395
+ x.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: j.value, children: j.label }, j.value))
8341
8396
  ] })
8342
8397
  ] }) }),
8343
8398
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8346,21 +8401,21 @@ const PageDataProviders = () => {
8346
8401
  o("page_data_providers"),
8347
8402
  ":"
8348
8403
  ] }),
8349
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((_) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8404
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8350
8405
  "div",
8351
8406
  {
8352
8407
  className: "w-full rounded-lg border border-border bg-card text-card-foreground shadow-sm",
8353
8408
  "data-v0-t": "card",
8354
8409
  children: [
8355
8410
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
8356
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: _.name }),
8357
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: _.description })
8411
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: j.name }),
8412
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: j.description })
8358
8413
  ] }) }) }),
8359
8414
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
8360
8415
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8361
8416
  "button",
8362
8417
  {
8363
- onClick: () => b(_),
8418
+ onClick: () => f(j),
8364
8419
  className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
8365
8420
  children: [
8366
8421
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -8386,7 +8441,7 @@ const PageDataProviders = () => {
8386
8441
  ]
8387
8442
  }
8388
8443
  ),
8389
- /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(_), name: _.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8444
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(j), name: j.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8390
8445
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8391
8446
  "svg",
8392
8447
  {
@@ -8412,16 +8467,16 @@ const PageDataProviders = () => {
8412
8467
  ] })
8413
8468
  ]
8414
8469
  },
8415
- _.providerKey
8470
+ j.providerKey
8416
8471
  )) }),
8417
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
8472
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
8418
8473
  ] })
8419
8474
  ] });
8420
8475
  };
8421
8476
  function AiFillDatabase(o) {
8422
8477
  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);
8423
8478
  }
8424
- const TopBar = lazy(() => import("./Topbar-xeW18bO-.js"));
8479
+ const TopBar = lazy(() => import("./Topbar-bca7NmyC.js"));
8425
8480
  function useSidebarMenuItems(o) {
8426
8481
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8427
8482
  return useMemo(() => {
@@ -8448,14 +8503,14 @@ function isDualLayout(o) {
8448
8503
  }
8449
8504
  const RootLayout = () => {
8450
8505
  const [o, n] = useState(0), [r] = useLayoutVariant(), [a, l] = useState(!1);
8451
- useChaiBuilderMsgListener(({ name: m }) => {
8452
- m === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
8506
+ useChaiBuilderMsgListener(({ name: g }) => {
8507
+ g === CHAI_BUILDER_EVENTS.SHOW_BLOCK_SETTINGS && n(1);
8453
8508
  });
8454
- const i = useBuilderProp("sideBarComponents.top", []), c = (m) => {
8455
- m.preventDefault();
8456
- }, d = (m) => {
8457
- n(o === m ? null : m);
8458
- }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), g = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
8509
+ const i = useBuilderProp("sideBarComponents.top", []), c = (g) => {
8510
+ g.preventDefault();
8511
+ }, d = (g) => {
8512
+ n(o === g ? null : g);
8513
+ }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], x = useBuilderProp("htmlDir", "ltr");
8459
8514
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: x, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
8460
8515
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8461
8516
  "div",
@@ -8466,18 +8521,18 @@ const RootLayout = () => {
8466
8521
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TopBar, {}) }) }),
8467
8522
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8468
8523
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
8469
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: g.map((m, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8524
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((g, E) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8470
8525
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8471
8526
  Button,
8472
8527
  {
8473
8528
  variant: o === E ? "default" : "ghost",
8474
8529
  className: "mb-2 rounded-lg p-2 transition-colors",
8475
8530
  onClick: () => d(E),
8476
- children: get(m, "icon", null)
8531
+ children: get(g, "icon", null)
8477
8532
  },
8478
8533
  E
8479
8534
  ) }),
8480
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(m.label) }) })
8535
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(g.label) }) })
8481
8536
  ] }, "button" + E)) }),
8482
8537
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
8483
8538
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
@@ -8496,10 +8551,10 @@ const RootLayout = () => {
8496
8551
  transition: { duration: 0.3, ease: "easeInOut" },
8497
8552
  children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
8498
8553
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
8499
- get(g, `${o}.icon`, null),
8500
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(g[o].label) })
8554
+ get(m, `${o}.icon`, null),
8555
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
8501
8556
  ] }),
8502
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(g, `${o}.component`, null), {}) }) })
8557
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
8503
8558
  ] }) })
8504
8559
  }
8505
8560
  ),
@@ -8572,7 +8627,7 @@ const RootLayout = () => {
8572
8627
  }, r * 1e3);
8573
8628
  }, ChaiBuilderComponent = (o) => {
8574
8629
  const [, n] = useBlocksStore(), [, r] = useBrandingOptions(), a = useBuilderReset(), [l] = useAtom(builderSaveStateAtom), i = useMemo(() => o.layout || RootLayout, [o.layout]);
8575
- return useAtom(selectedLibraryAtom), useKeyEventWatcher(), useExpandTree(), useAutoSave(), useWatchGlobalBlocks(), useEffect(() => {
8630
+ return useAtom(selectedLibraryAtom), useKeyEventWatcher(), useExpandTree(), useAutoSave(), useWatchGlobalBlocks(), useWatchRSCBlocks(), useEffect(() => {
8576
8631
  builderStore.set(
8577
8632
  // @ts-ignore
8578
8633
  chaiBuilderPropsAtom,