@chaibuilder/sdk 2.0.0-beta.111 → 2.0.0-beta.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.js CHANGED
@@ -9,20 +9,20 @@ import { atom as atom$1, useAtom as useAtom$1, useAtomValue as useAtomValue$1, g
9
9
  import { find, filter, flatten, map, omit, isString, has, isObject, memoize, get, compact, isEmpty, noop, includes, without, each, first, keys, range, values, flattenDeep, set, startsWith, forEach, unset, chunk, cloneDeep, pick, isNull, throttle, isFunction as isFunction$1, reverse, startCase, debounce, capitalize, split, findIndex, take, toUpper, toLower, nth, isNumber, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, uniq, flatMapDeep, some, reject, sortBy, round } from "lodash-es";
10
10
  import { Provider as Provider$1 } from "react-wrap-balancer";
11
11
  import { useTranslation, initReactI18next } from "react-i18next";
12
- import { useTranslation as Ve } from "react-i18next";
13
- import { g as generateUUID, a as getBreakpointValue, c as cn$1, G as GenIcon } from "./iconBase-DHfFLkem.js";
12
+ import { useTranslation as He } from "react-i18next";
13
+ import { g as generateUUID, a as getBreakpointValue, c as cn$1 } from "./Functions-BGzDsf1z.js";
14
14
  import { flip } from "@floating-ui/dom";
15
15
  import { useFloating, shift } from "@floating-ui/react-dom";
16
16
  import { ArrowUpIcon, PlusIcon, CopyIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, Cross2Icon, EyeOpenIcon, EyeClosedIcon, BorderAllIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, BoxIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CardStackIcon, CardStackPlusIcon, ScissorsIcon, CheckIcon, SunIcon, ResetIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, LightningBoltIcon } from "@radix-ui/react-icons";
17
17
  import { useThrottledCallback, useDebouncedCallback, useResizeObserver, useIntervalEffect } from "@react-hookz/web";
18
18
  import { useFeature, FlagsProvider } from "flagged";
19
19
  import { getRegisteredChaiBlock, getDefaultBlockProps, useRegisteredChaiBlocks, getBlockFormSchemas, syncBlocksWithDefaults } from "@chaibuilder/runtime";
20
- import { registerChaiBlock as Fe } from "@chaibuilder/runtime";
20
+ import { registerChaiBlock as Ue } from "@chaibuilder/runtime";
21
21
  import { e as getDefaultExportFromCjs, d as defaultThemeOptions, g as getChaiThemeOptions, p as plugin, a as getChaiThemeCssVariables, c as getThemeFontsLinkMarkup } from "./ChaiThemeFn-Cort9tch.js";
22
22
  import TreeModel from "tree-model";
23
23
  import { useHotkeys } from "react-hotkeys-hook";
24
24
  import { toast } from "sonner";
25
- import { PlusIcon as PlusIcon$1, ChevronRight, DatabaseIcon, ChevronLeft, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, X, Plus, PlusCircle, ChevronDown, Loader, SparklesIcon, Globe, PencilIcon, EyeOff, Eye, SmileIcon, ShuffleIcon, DatabaseZapIcon, Edit2, Paintbrush, Layers } from "lucide-react";
25
+ import { PlusIcon as PlusIcon$1, ChevronRight, DatabaseIcon, ChevronLeft, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, AlignLeft, AlignCenter, AlignRight, Link as Link$1, Unlink, Maximize2, X, Plus, PlusCircle, ChevronDown, Loader, SparklesIcon, Globe, PencilIcon, FileJson, Zap, EyeOff, MoreVertical, Eye, ChevronsDown, ChevronsUp, Languages, FileEdit, Recycle, SmileIcon, ShuffleIcon, Moon, DatabaseZapIcon, Edit2, Paintbrush, Layers } from "lucide-react";
26
26
  import { useEditor, EditorContent } from "@tiptap/react";
27
27
  import StarterKit from "@tiptap/starter-kit";
28
28
  import typography from "@tailwindcss/typography";
@@ -40,13 +40,12 @@ import Link from "@tiptap/extension-link";
40
40
  import TextAlign from "@tiptap/extension-text-align";
41
41
  import Underline from "@tiptap/extension-underline";
42
42
  import clsx$1, { clsx } from "clsx";
43
- import IconPicker, { IconPickerItem } from "react-icons-picker";
44
43
  import Autosuggest from "react-autosuggest";
45
44
  import Fuse from "fuse.js";
46
45
  import { parse, stringify } from "himalaya";
47
46
  import { Tree } from "react-arborist";
48
47
  import i18n from "i18next";
49
- import { default as We } from "i18next";
48
+ import { default as ze } from "i18next";
50
49
  import { motion } from "framer-motion";
51
50
  const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.write, isAtomStateInitialized = (o) => "v" in o || "e" in o, returnAtomValue = (o) => {
52
51
  if ("e" in o)
@@ -101,190 +100,190 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
101
100
  var x;
102
101
  return (x = m.onMount) == null ? void 0 : x.call(m, h);
103
102
  }, ...f) => {
104
- const m = f[0] || ((w) => {
105
- let L = o.get(w);
106
- return L || (L = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(w, L), u == null || u(w, _)), L;
103
+ const m = f[0] || ((C) => {
104
+ let L = o.get(C);
105
+ return L || (L = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(C, L), u == null || u(C, S)), L;
107
106
  }), h = f[1] || (() => {
108
- let w, L;
107
+ let C, L;
109
108
  const v = (k) => {
110
109
  try {
111
110
  k();
112
- } catch (E) {
113
- w || (w = !0, L = E);
111
+ } catch (B) {
112
+ C || (C = !0, L = B);
114
113
  }
115
114
  };
116
115
  do {
117
116
  c.f && v(c.f);
118
- const k = /* @__PURE__ */ new Set(), E = k.add.bind(k);
117
+ const k = /* @__PURE__ */ new Set(), B = k.add.bind(k);
119
118
  a.forEach((T) => {
120
119
  var I;
121
- return (I = n.get(T)) == null ? void 0 : I.l.forEach(E);
122
- }), a.clear(), i.forEach(E), i.clear(), l.forEach(E), l.clear(), k.forEach(v), a.size && x();
120
+ return (I = n.get(T)) == null ? void 0 : I.l.forEach(B);
121
+ }), a.clear(), i.forEach(B), i.clear(), l.forEach(B), l.clear(), k.forEach(v), a.size && x();
123
122
  } while (a.size || i.size || l.size);
124
- if (w)
123
+ if (C)
125
124
  throw L;
126
125
  }), x = f[2] || (() => {
127
- const w = [], L = /* @__PURE__ */ new WeakSet(), v = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
126
+ const C = [], L = /* @__PURE__ */ new WeakSet(), v = /* @__PURE__ */ new WeakSet(), k = Array.from(a);
128
127
  for (; k.length; ) {
129
- const E = k[k.length - 1], T = m(E);
130
- if (v.has(E)) {
128
+ const B = k[k.length - 1], T = m(B);
129
+ if (v.has(B)) {
131
130
  k.pop();
132
131
  continue;
133
132
  }
134
- if (L.has(E)) {
135
- r.get(E) === T.n && w.push([E, T]), v.add(E), k.pop();
133
+ if (L.has(B)) {
134
+ r.get(B) === T.n && C.push([B, T]), v.add(B), k.pop();
136
135
  continue;
137
136
  }
138
- L.add(E);
139
- for (const I of getMountedOrPendingDependents(E, T, n))
137
+ L.add(B);
138
+ for (const I of getMountedOrPendingDependents(B, T, n))
140
139
  L.has(I) || k.push(I);
141
140
  }
142
- for (let E = w.length - 1; E >= 0; --E) {
143
- const [T, I] = w[E];
144
- let R = !1;
141
+ for (let B = C.length - 1; B >= 0; --B) {
142
+ const [T, I] = C[B];
143
+ let P = !1;
145
144
  for (const N of I.d.keys())
146
145
  if (N !== T && a.has(N)) {
147
- R = !0;
146
+ P = !0;
148
147
  break;
149
148
  }
150
- R && (b(T), j(T)), r.delete(T);
149
+ P && (y(T), E(T)), r.delete(T);
151
150
  }
152
- }), b = f[3] || ((w) => {
151
+ }), y = f[3] || ((C) => {
153
152
  var L, v;
154
- const k = m(w);
155
- if (isAtomStateInitialized(k) && (n.has(w) && r.get(w) !== k.n || Array.from(k.d).every(
156
- ([P, O]) => (
153
+ const k = m(C);
154
+ if (isAtomStateInitialized(k) && (n.has(C) && r.get(C) !== k.n || Array.from(k.d).every(
155
+ ([R, O]) => (
157
156
  // Recursively, read the atom state of the dependency, and
158
157
  // check if the atom epoch number is unchanged
159
- b(P).n === O
158
+ y(R).n === O
160
159
  )
161
160
  )))
162
161
  return k;
163
162
  k.d.clear();
164
- let E = !0;
163
+ let B = !0;
165
164
  const T = () => {
166
- n.has(w) && (j(w), x(), h());
167
- }, I = (P) => {
165
+ n.has(C) && (E(C), x(), h());
166
+ }, I = (R) => {
168
167
  var O;
169
- if (isSelfAtom(w, P)) {
170
- const H = m(P);
168
+ if (isSelfAtom(C, R)) {
169
+ const H = m(R);
171
170
  if (!isAtomStateInitialized(H))
172
- if (hasInitialValue(P))
173
- setAtomStateValueOrPromise(P, P.init, m);
171
+ if (hasInitialValue(R))
172
+ setAtomStateValueOrPromise(R, R.init, m);
174
173
  else
175
174
  throw new Error("no atom init");
176
175
  return returnAtomValue(H);
177
176
  }
178
- const $ = b(P);
177
+ const M = y(R);
179
178
  try {
180
- return returnAtomValue($);
179
+ return returnAtomValue(M);
181
180
  } finally {
182
- k.d.set(P, $.n), isPendingPromise(k.v) && addPendingPromiseToDependency(w, k.v, $), (O = n.get(P)) == null || O.t.add(w), E || T();
181
+ k.d.set(R, M.n), isPendingPromise(k.v) && addPendingPromiseToDependency(C, k.v, M), (O = n.get(R)) == null || O.t.add(C), B || T();
183
182
  }
184
183
  };
185
- let R, N;
184
+ let P, N;
186
185
  const D = {
187
186
  get signal() {
188
- return R || (R = new AbortController()), R.signal;
187
+ return P || (P = new AbortController()), P.signal;
189
188
  },
190
189
  get setSelf() {
191
- return !N && isActuallyWritableAtom(w) && (N = (...P) => {
192
- if (!E)
190
+ return !N && isActuallyWritableAtom(C) && (N = (...R) => {
191
+ if (!B)
193
192
  try {
194
- return B(w, ...P);
193
+ return A(C, ...R);
195
194
  } finally {
196
195
  x(), h();
197
196
  }
198
197
  }), N;
199
198
  }
200
- }, M = k.n;
199
+ }, $ = k.n;
201
200
  try {
202
- const P = d(w, I, D);
203
- return setAtomStateValueOrPromise(w, P, m), isPromiseLike$2(P) && ((L = P.onCancel) == null || L.call(P, () => R == null ? void 0 : R.abort()), P.then(
201
+ const R = d(C, I, D);
202
+ return setAtomStateValueOrPromise(C, R, m), isPromiseLike$2(R) && ((L = R.onCancel) == null || L.call(R, () => P == null ? void 0 : P.abort()), R.then(
204
203
  T,
205
204
  T
206
205
  )), k;
207
- } catch (P) {
208
- return delete k.v, k.e = P, ++k.n, k;
206
+ } catch (R) {
207
+ return delete k.v, k.e = R, ++k.n, k;
209
208
  } finally {
210
- E = !1, M !== k.n && r.get(w) === M && (r.set(w, k.n), a.add(w), (v = c.c) == null || v.call(c, w));
209
+ B = !1, $ !== k.n && r.get(C) === $ && (r.set(C, k.n), a.add(C), (v = c.c) == null || v.call(c, C));
211
210
  }
212
- }), y = f[4] || ((w) => {
213
- const L = [w];
211
+ }), b = f[4] || ((C) => {
212
+ const L = [C];
214
213
  for (; L.length; ) {
215
214
  const v = L.pop(), k = m(v);
216
- for (const E of getMountedOrPendingDependents(v, k, n)) {
217
- const T = m(E);
218
- r.set(E, T.n), L.push(E);
215
+ for (const B of getMountedOrPendingDependents(v, k, n)) {
216
+ const T = m(B);
217
+ r.set(B, T.n), L.push(B);
219
218
  }
220
219
  }
221
- }), B = f[5] || ((w, ...L) => {
220
+ }), A = f[5] || ((C, ...L) => {
222
221
  let v = !0;
223
- const k = (T) => returnAtomValue(b(T)), E = (T, ...I) => {
224
- var R;
222
+ const k = (T) => returnAtomValue(y(T)), B = (T, ...I) => {
223
+ var P;
225
224
  const N = m(T);
226
225
  try {
227
- if (isSelfAtom(w, T)) {
226
+ if (isSelfAtom(C, T)) {
228
227
  if (!hasInitialValue(T))
229
228
  throw new Error("atom not writable");
230
- const D = N.n, M = I[0];
231
- setAtomStateValueOrPromise(T, M, m), j(T), D !== N.n && (a.add(T), (R = c.c) == null || R.call(c, T), y(T));
229
+ const D = N.n, $ = I[0];
230
+ setAtomStateValueOrPromise(T, $, m), E(T), D !== N.n && (a.add(T), (P = c.c) == null || P.call(c, T), b(T));
232
231
  return;
233
232
  } else
234
- return B(T, ...I);
233
+ return A(T, ...I);
235
234
  } finally {
236
235
  v || (x(), h());
237
236
  }
238
237
  };
239
238
  try {
240
- return p(w, k, E, ...L);
239
+ return p(C, k, B, ...L);
241
240
  } finally {
242
241
  v = !1;
243
242
  }
244
- }), j = f[6] || ((w) => {
243
+ }), E = f[6] || ((C) => {
245
244
  var L;
246
- const v = m(w), k = n.get(w);
245
+ const v = m(C), k = n.get(C);
247
246
  if (k && !isPendingPromise(v.v)) {
248
- for (const [E, T] of v.d)
249
- if (!k.d.has(E)) {
250
- const I = m(E);
251
- C(E).t.add(w), k.d.add(E), T !== I.n && (a.add(E), (L = c.c) == null || L.call(c, E), y(E));
247
+ for (const [B, T] of v.d)
248
+ if (!k.d.has(B)) {
249
+ const I = m(B);
250
+ w(B).t.add(C), k.d.add(B), T !== I.n && (a.add(B), (L = c.c) == null || L.call(c, B), b(B));
252
251
  }
253
- for (const E of k.d || [])
254
- if (!v.d.has(E)) {
255
- k.d.delete(E);
256
- const T = S(E);
257
- T == null || T.t.delete(w);
252
+ for (const B of k.d || [])
253
+ if (!v.d.has(B)) {
254
+ k.d.delete(B);
255
+ const T = _(B);
256
+ T == null || T.t.delete(C);
258
257
  }
259
258
  }
260
- }), C = f[7] || ((w) => {
259
+ }), w = f[7] || ((C) => {
261
260
  var L;
262
- const v = m(w);
263
- let k = n.get(w);
261
+ const v = m(C);
262
+ let k = n.get(C);
264
263
  if (!k) {
265
- b(w);
266
- for (const E of v.d.keys())
267
- C(E).t.add(w);
264
+ y(C);
265
+ for (const B of v.d.keys())
266
+ w(B).t.add(C);
268
267
  if (k = {
269
268
  l: /* @__PURE__ */ new Set(),
270
269
  d: new Set(v.d.keys()),
271
270
  t: /* @__PURE__ */ new Set()
272
- }, n.set(w, k), (L = c.m) == null || L.call(c, w), isActuallyWritableAtom(w)) {
273
- const E = () => {
271
+ }, n.set(C, k), (L = c.m) == null || L.call(c, C), isActuallyWritableAtom(C)) {
272
+ const B = () => {
274
273
  let T = !0;
275
- const I = (...R) => {
274
+ const I = (...P) => {
276
275
  try {
277
- return B(w, ...R);
276
+ return A(C, ...P);
278
277
  } finally {
279
278
  T || (x(), h());
280
279
  }
281
280
  };
282
281
  try {
283
- const R = g(w, I);
284
- R && (k.u = () => {
282
+ const P = g(C, I);
283
+ P && (k.u = () => {
285
284
  T = !0;
286
285
  try {
287
- R();
286
+ P();
288
287
  } finally {
289
288
  T = !1;
290
289
  }
@@ -293,27 +292,27 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
293
292
  T = !1;
294
293
  }
295
294
  };
296
- l.add(E);
295
+ l.add(B);
297
296
  }
298
297
  }
299
298
  return k;
300
- }), S = f[8] || ((w) => {
299
+ }), _ = f[8] || ((C) => {
301
300
  var L;
302
- const v = m(w);
303
- let k = n.get(w);
304
- if (k && !k.l.size && !Array.from(k.t).some((E) => {
301
+ const v = m(C);
302
+ let k = n.get(C);
303
+ if (k && !k.l.size && !Array.from(k.t).some((B) => {
305
304
  var T;
306
- return (T = n.get(E)) == null ? void 0 : T.d.has(w);
305
+ return (T = n.get(B)) == null ? void 0 : T.d.has(C);
307
306
  })) {
308
- k.u && i.add(k.u), k = void 0, n.delete(w), (L = c.u) == null || L.call(c, w);
309
- for (const E of v.d.keys()) {
310
- const T = S(E);
311
- T == null || T.t.delete(w);
307
+ k.u && i.add(k.u), k = void 0, n.delete(C), (L = c.u) == null || L.call(c, C);
308
+ for (const B of v.d.keys()) {
309
+ const T = _(B);
310
+ T == null || T.t.delete(C);
312
311
  }
313
312
  return;
314
313
  }
315
314
  return k;
316
- }), A = [
315
+ }), j = [
317
316
  // store state
318
317
  o,
319
318
  n,
@@ -331,29 +330,29 @@ const isSelfAtom = (o, n) => o.unstable_is ? o.unstable_is(n) : n === o, hasInit
331
330
  m,
332
331
  h,
333
332
  x,
334
- b,
335
333
  y,
336
- B,
337
- j,
338
- C,
339
- S
340
- ], _ = {
341
- get: (w) => returnAtomValue(b(w)),
342
- set: (w, ...L) => {
334
+ b,
335
+ A,
336
+ E,
337
+ w,
338
+ _
339
+ ], S = {
340
+ get: (C) => returnAtomValue(y(C)),
341
+ set: (C, ...L) => {
343
342
  try {
344
- return B(w, ...L);
343
+ return A(C, ...L);
345
344
  } finally {
346
345
  x(), h();
347
346
  }
348
347
  },
349
- sub: (w, L) => {
350
- const k = C(w).l;
348
+ sub: (C, L) => {
349
+ const k = w(C).l;
351
350
  return k.add(L), h(), () => {
352
- k.delete(L), S(w), h();
351
+ k.delete(L), _(C), h();
353
352
  };
354
353
  }
355
354
  };
356
- return Object.defineProperty(_, BUILDING_BLOCKS, { value: A }), _;
355
+ return Object.defineProperty(S, BUILDING_BLOCKS, { value: j }), S;
357
356
  }, INTERNAL_buildStoreRev1 = buildStore;
358
357
  let keyCount = 0;
359
358
  function atom(o, n) {
@@ -392,32 +391,32 @@ function splitAtom(o, n) {
392
391
  return c.forEach((m, h) => {
393
392
  const x = h;
394
393
  f[h] = x;
395
- const b = u && u.atomList[u.keyList.indexOf(x)];
396
- if (b) {
397
- g[h] = b;
394
+ const y = u && u.atomList[u.keyList.indexOf(x)];
395
+ if (y) {
396
+ g[h] = y;
398
397
  return;
399
398
  }
400
- const y = (j) => {
401
- const C = j(l), S = j(o), _ = a(S, C == null ? void 0 : C.arr).keyList.indexOf(x);
402
- if (_ < 0 || _ >= S.length) {
403
- const w = c[a(c).keyList.indexOf(x)];
404
- if (w)
405
- return w;
399
+ const b = (E) => {
400
+ const w = E(l), _ = E(o), S = a(_, w == null ? void 0 : w.arr).keyList.indexOf(x);
401
+ if (S < 0 || S >= _.length) {
402
+ const C = c[a(c).keyList.indexOf(x)];
403
+ if (C)
404
+ return C;
406
405
  throw new Error("splitAtom: index out of bounds for read");
407
406
  }
408
- return S[_];
409
- }, B = (j, C, S) => {
410
- const A = j(l), _ = j(o), L = a(_, A == null ? void 0 : A.arr).keyList.indexOf(x);
411
- if (L < 0 || L >= _.length)
407
+ return _[S];
408
+ }, A = (E, w, _) => {
409
+ const j = E(l), S = E(o), L = a(S, j == null ? void 0 : j.arr).keyList.indexOf(x);
410
+ if (L < 0 || L >= S.length)
412
411
  throw new Error("splitAtom: index out of bounds for write");
413
- const v = isFunction(S) ? S(_[L]) : S;
414
- Object.is(_[L], v) || C(o, [
415
- ..._.slice(0, L),
412
+ const v = isFunction(_) ? _(S[L]) : _;
413
+ Object.is(S[L], v) || w(o, [
414
+ ...S.slice(0, L),
416
415
  v,
417
- ..._.slice(L + 1)
416
+ ...S.slice(L + 1)
418
417
  ]);
419
418
  };
420
- g[h] = isWritable(o) ? atom(y, B) : atom(y);
419
+ g[h] = isWritable(o) ? atom(b, A) : atom(b);
421
420
  }), u && u.keyList.length === f.length && u.keyList.every((m, h) => m === f[h]) ? p = u : p = { arr: c, atomList: g, keyList: f }, r.set(c, p), p;
422
421
  }, l = atom((c) => {
423
422
  const d = c(l), p = c(o);
@@ -1158,8 +1157,8 @@ const useSelectedBlocksDisplayChild = () => ({
1158
1157
  m && "content" in m && (r = r.map((h) => {
1159
1158
  if (h._id === u) {
1160
1159
  const x = { ...h, content: f.content };
1161
- return Object.keys(f).forEach((b) => {
1162
- b.startsWith("content-") && (x[b] = f[b]);
1160
+ return Object.keys(f).forEach((y) => {
1161
+ y.startsWith("content-") && (x[y] = f[y]);
1163
1162
  }), x;
1164
1163
  }
1165
1164
  return h;
@@ -1238,8 +1237,8 @@ function insertBlocksAtPosition(o, n, r, a) {
1238
1237
  }), l.unshift(m), i = i.map((h) => {
1239
1238
  if (h._id === r) {
1240
1239
  const x = { ...h, content: "" };
1241
- return Object.keys(x).forEach((b) => {
1242
- b.startsWith("content-") && (x[b] = "");
1240
+ return Object.keys(x).forEach((y) => {
1241
+ y.startsWith("content-") && (x[y] = "");
1243
1242
  }), x;
1244
1243
  }
1245
1244
  return h;
@@ -1388,50 +1387,50 @@ const useBlocksStoreManager = () => {
1388
1387
  updateBlocksProps: c
1389
1388
  } = useBlocksStoreManager();
1390
1389
  return {
1391
- moveBlocks: (x, b, y) => {
1392
- const B = map(x, (C) => {
1393
- const A = n.find((L) => L._id === C)._parent || null, w = n.filter((L) => A ? L._parent === A : !L._parent).map((L) => L._id).indexOf(C);
1394
- return { _id: C, oldParent: A, oldPosition: w };
1395
- }), j = B.find(({ _id: C }) => C === x[0]);
1396
- j && j.oldParent === b && j.oldPosition === y || (i(x, b, y), o({
1397
- undo: () => each(B, ({ _id: C, oldParent: S, oldPosition: A }) => {
1398
- i([C], S, A);
1390
+ moveBlocks: (x, y, b) => {
1391
+ const A = map(x, (w) => {
1392
+ const j = n.find((L) => L._id === w)._parent || null, C = n.filter((L) => j ? L._parent === j : !L._parent).map((L) => L._id).indexOf(w);
1393
+ return { _id: w, oldParent: j, oldPosition: C };
1394
+ }), E = A.find(({ _id: w }) => w === x[0]);
1395
+ E && E.oldParent === y && E.oldPosition === b || (i(x, y, b), o({
1396
+ undo: () => each(A, ({ _id: w, oldParent: _, oldPosition: j }) => {
1397
+ i([w], _, j);
1399
1398
  }),
1400
- redo: () => i(x, b, y)
1399
+ redo: () => i(x, y, b)
1401
1400
  }));
1402
1401
  },
1403
- addBlocks: (x, b, y) => {
1404
- a(x, b, y), o({
1402
+ addBlocks: (x, y, b) => {
1403
+ a(x, y, b), o({
1405
1404
  undo: () => l(map(x, "_id")),
1406
- redo: () => a(x, b, y)
1405
+ redo: () => a(x, y, b)
1407
1406
  });
1408
1407
  },
1409
1408
  removeBlocks: (x) => {
1410
- var j;
1411
- const b = (j = first(x)) == null ? void 0 : j._parent, B = n.filter((C) => b ? C._parent === b : !C._parent).indexOf(first(x));
1409
+ var E;
1410
+ const y = (E = first(x)) == null ? void 0 : E._parent, A = n.filter((w) => y ? w._parent === y : !w._parent).indexOf(first(x));
1412
1411
  l(map(x, "_id")), o({
1413
- undo: () => a(x, b, B),
1412
+ undo: () => a(x, y, A),
1414
1413
  redo: () => l(map(x, "_id"))
1415
1414
  });
1416
1415
  },
1417
- updateBlocks: (x, b, y) => {
1418
- let B = [];
1419
- if (y)
1420
- B = map(x, (j) => ({ _id: j, ...y }));
1416
+ updateBlocks: (x, y, b) => {
1417
+ let A = [];
1418
+ if (b)
1419
+ A = map(x, (E) => ({ _id: E, ...b }));
1421
1420
  else {
1422
- const j = keys(b);
1423
- B = map(x, (C) => {
1424
- const S = n.find((_) => _._id === C), A = { _id: C };
1425
- return each(j, (_) => A[_] = S[_]), A;
1421
+ const E = keys(y);
1422
+ A = map(x, (w) => {
1423
+ const _ = n.find((S) => S._id === w), j = { _id: w };
1424
+ return each(E, (S) => j[S] = _[S]), j;
1426
1425
  });
1427
1426
  }
1428
- c(map(x, (j) => ({ _id: j, ...b }))), o({
1429
- undo: () => c(B),
1430
- redo: () => c(map(x, (j) => ({ _id: j, ...b })))
1427
+ c(map(x, (E) => ({ _id: E, ...y }))), o({
1428
+ undo: () => c(A),
1429
+ redo: () => c(map(x, (E) => ({ _id: E, ...y })))
1431
1430
  });
1432
1431
  },
1433
- updateBlocksRuntime: (x, b) => {
1434
- c(map(x, (y) => ({ _id: y, ...b })));
1432
+ updateBlocksRuntime: (x, y) => {
1433
+ c(map(x, (b) => ({ _id: b, ...y })));
1435
1434
  },
1436
1435
  setNewBlocks: (x) => {
1437
1436
  r(x), o({
@@ -1440,12 +1439,12 @@ const useBlocksStoreManager = () => {
1440
1439
  });
1441
1440
  },
1442
1441
  updateMultipleBlocksProps: (x) => {
1443
- let b = [];
1444
- b = map(x, (y) => {
1445
- const B = keys(y), j = n.find((S) => S._id === y._id), C = {};
1446
- return each(B, (S) => C[S] = j[S]), C;
1442
+ let y = [];
1443
+ y = map(x, (b) => {
1444
+ const A = keys(b), E = n.find((_) => _._id === b._id), w = {};
1445
+ return each(A, (_) => w[_] = E[_]), w;
1447
1446
  }), c(x), o({
1448
- undo: () => c(b),
1447
+ undo: () => c(y),
1449
1448
  redo: () => c(x)
1450
1449
  });
1451
1450
  }
@@ -1486,9 +1485,9 @@ const useAddBlock = () => {
1486
1485
  for (let h = 0; h < i.length; h++) {
1487
1486
  const { _id: x } = i[h];
1488
1487
  i[h]._id = generateUUID();
1489
- const b = filter(i, { _parent: x });
1490
- for (let y = 0; y < b.length; y++)
1491
- b[y]._parent = i[h]._id;
1488
+ const y = filter(i, { _parent: x });
1489
+ for (let b = 0; b < y.length; b++)
1490
+ y[b]._parent = i[h]._id;
1492
1491
  }
1493
1492
  const p = first(i);
1494
1493
  let u, g;
@@ -1499,8 +1498,8 @@ const useAddBlock = () => {
1499
1498
  return { addCoreBlock: useCallback(
1500
1499
  (i, c, d) => {
1501
1500
  if (has(i, "blocks")) {
1502
- const b = i.blocks;
1503
- return a(b, c, d);
1501
+ const y = i.blocks;
1502
+ return a(y, c, d);
1504
1503
  }
1505
1504
  const p = generateUUID(), u = getDefaultBlockProps(i.type), g = {
1506
1505
  _type: i.type,
@@ -2957,42 +2956,42 @@ const getBlockWithChildren = (o, n) => {
2957
2956
  })
2958
2957
  ), addLangToPrompt = (o, n, r) => !n || r !== "content" ? o : `${o}. Generate content in ${get(LANGUAGES, n, n)} language.`, askAiProcessingAtom = atom$1(!1), useAskAi = () => {
2959
2958
  const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: p, fallbackLang: u } = useLanguages(), g = p.length ? p : u, f = (m, h) => {
2960
- const x = cloneDeep(h.find((b) => b._id === m));
2961
- for (const b in x) {
2962
- const y = x[b];
2963
- if (typeof y == "string" && startsWith(y, STYLES_KEY)) {
2964
- const { baseClasses: B, classes: j } = getSplitChaiClasses(y);
2965
- x[b] = compact(flattenDeep([B, j])).join(" ");
2959
+ const x = cloneDeep(h.find((y) => y._id === m));
2960
+ for (const y in x) {
2961
+ const b = x[y];
2962
+ if (typeof b == "string" && startsWith(b, STYLES_KEY)) {
2963
+ const { baseClasses: A, classes: E } = getSplitChaiClasses(b);
2964
+ x[y] = compact(flattenDeep([A, E])).join(" ");
2966
2965
  } else
2967
- b !== "_id" && delete x[b];
2966
+ y !== "_id" && delete x[y];
2968
2967
  }
2969
2968
  return x;
2970
2969
  };
2971
2970
  return {
2972
2971
  askAi: useCallback(
2973
- async (m, h, x, b) => {
2972
+ async (m, h, x, y) => {
2974
2973
  if (l) {
2975
2974
  n(!0), a(null);
2976
2975
  try {
2977
- const y = p === u ? "" : p, B = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(h, d)), p) : [f(h, d)], j = await l(m, addLangToPrompt(x, g, m), B, y), { blocks: C, error: S } = j;
2978
- if (S) {
2979
- a(S);
2976
+ const b = p === u ? "" : p, A = m === "content" ? pickOnlyAIProps(cloneDeep(getBlockWithChildren(h, d)), p) : [f(h, d)], E = await l(m, addLangToPrompt(x, g, m), A, b), { blocks: w, error: _ } = E;
2977
+ if (_) {
2978
+ a(_);
2980
2979
  return;
2981
2980
  }
2982
2981
  if (m === "styles") {
2983
- const A = C.map((_) => {
2984
- for (const w in _)
2985
- w !== "_id" && (_[w] = `${STYLES_KEY},${_[w]}`);
2986
- return _;
2982
+ const j = w.map((S) => {
2983
+ for (const C in S)
2984
+ C !== "_id" && (S[C] = `${STYLES_KEY},${S[C]}`);
2985
+ return S;
2987
2986
  });
2988
- c(A);
2987
+ c(j);
2989
2988
  } else
2990
- i(C);
2991
- b && b(j);
2992
- } catch (y) {
2993
- a(y);
2989
+ i(w);
2990
+ y && y(E);
2991
+ } catch (b) {
2992
+ a(b);
2994
2993
  } finally {
2995
- n(!1), b && b();
2994
+ n(!1), y && y();
2996
2995
  }
2997
2996
  }
2998
2997
  },
@@ -3576,26 +3575,26 @@ const useDnd = () => {
3576
3575
  m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
3577
3576
  },
3578
3577
  onDrop: (m) => {
3579
- var S;
3580
- const h = dropTarget, b = getOrientation(h) === "vertical" ? m.clientY + ((S = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : S.scrollY) : m.clientX;
3581
- dropIndex = calculateDropIndex(b, possiblePositions);
3582
- const y = d, B = h.getAttribute("data-block-id"), j = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3583
- if ((y == null ? void 0 : y._id) === B || !j) {
3578
+ var _;
3579
+ const h = dropTarget, y = getOrientation(h) === "vertical" ? m.clientY + ((_ = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : _.scrollY) : m.clientX;
3580
+ dropIndex = calculateDropIndex(y, possiblePositions);
3581
+ const b = d, A = h.getAttribute("data-block-id"), E = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3582
+ if ((b == null ? void 0 : b._id) === A || !E) {
3584
3583
  f();
3585
3584
  return;
3586
3585
  }
3587
- if (!has(y, "_id")) {
3588
- a(y, B === "canvas" ? null : B, dropIndex), setTimeout(f, 300);
3586
+ if (!has(b, "_id")) {
3587
+ a(b, A === "canvas" ? null : A, dropIndex), setTimeout(f, 300);
3589
3588
  return;
3590
3589
  }
3591
- let C = h.getAttribute("data-block-id");
3592
- C === null && (C = m.target.parentElement.getAttribute("data-block-id")), c([y._id], C === "canvas" ? null : C, dropIndex), f(), setTimeout(removePlaceholder, 300);
3590
+ let w = h.getAttribute("data-block-id");
3591
+ w === null && (w = m.target.parentElement.getAttribute("data-block-id")), c([b._id], w === "canvas" ? null : w, dropIndex), f(), setTimeout(removePlaceholder, 300);
3593
3592
  },
3594
3593
  onDragEnter: (m) => {
3595
3594
  const h = m, x = h.target;
3596
3595
  dropTarget = x;
3597
- const b = x.getAttribute("data-block-id"), y = x.getAttribute("data-dnd-dragged") !== "yes";
3598
- u(b), h.stopPropagation(), h.preventDefault(), possiblePositions = [], y && calculatePossiblePositions(x), r(!0), l(""), i([]);
3596
+ const y = x.getAttribute("data-block-id"), b = x.getAttribute("data-dnd-dragged") !== "yes";
3597
+ u(y), h.stopPropagation(), h.preventDefault(), possiblePositions = [], b && calculatePossiblePositions(x), r(!0), l(""), i([]);
3599
3598
  },
3600
3599
  onDragLeave: (m) => {
3601
3600
  m.target.getAttribute("data-block-id") === "canvas" && (u(null), r(!1), removePlaceholder(), possiblePositions = []);
@@ -3673,8 +3672,8 @@ const useHandleCanvasDblClick = (o, n) => {
3673
3672
  if (h) {
3674
3673
  const x = h.getAttribute("data-style-prop");
3675
3674
  if (x) {
3676
- const b = h.getAttribute("data-style-id"), y = h.getAttribute("data-block-parent");
3677
- l([{ id: b, prop: x, blockId: y }]);
3675
+ const y = h.getAttribute("data-style-id"), b = h.getAttribute("data-block-parent");
3676
+ l([{ id: y, prop: x, blockId: b }]);
3678
3677
  }
3679
3678
  }
3680
3679
  }, 100);
@@ -3726,22 +3725,22 @@ const useHandleCanvasDblClick = (o, n) => {
3726
3725
  forms,
3727
3726
  aspectRatio,
3728
3727
  containerQueries,
3729
- plugin(function({ addBase: b, theme: y }) {
3730
- b({
3728
+ plugin(function({ addBase: y, theme: b }) {
3729
+ y({
3731
3730
  "h1,h2,h3,h4,h5,h6": {
3732
- fontFamily: y("fontFamily.heading")
3731
+ fontFamily: b("fontFamily.heading")
3733
3732
  },
3734
3733
  body: {
3735
- fontFamily: y("fontFamily.body"),
3736
- color: y("colors.foreground"),
3737
- backgroundColor: y("colors.background")
3734
+ fontFamily: b("fontFamily.body"),
3735
+ color: b("colors.foreground"),
3736
+ backgroundColor: b("colors.background")
3738
3737
  }
3739
3738
  });
3740
3739
  })
3741
3740
  ]
3742
3741
  });
3743
3742
  }, [o, n, p]), useEffect(() => {
3744
- g && (g.textContent = `${map(r, (b) => `[data-block-id="${b}"]`).join(",")}{
3743
+ g && (g.textContent = `${map(r, (y) => `[data-block-id="${y}"]`).join(",")}{
3745
3744
  outline: 1px solid ${r.length === 1 ? "#42a1fc !important" : "orange !important"}; outline-offset: -1px;
3746
3745
  }`);
3747
3746
  }, [r, g]), useEffect(() => {
@@ -3749,7 +3748,7 @@ const useHandleCanvasDblClick = (o, n) => {
3749
3748
  }, [i, m]), useEffect(() => {
3750
3749
  u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3751
3750
  }, [u]), useEffect(() => {
3752
- f && (f.textContent = `${map(l, ({ id: b }) => `[data-style-id="${b}"]`).join(",")}{
3751
+ f && (f.textContent = `${map(l, ({ id: y }) => `[data-style-id="${y}"]`).join(",")}{
3753
3752
  outline: 1px solid orange !important; outline-offset: -1px;
3754
3753
  }`);
3755
3754
  }, [l, f]), useEffect(() => {
@@ -3844,7 +3843,7 @@ const getBlockRuntimeProps = memoize((o) => {
3844
3843
  ), m = useMemo(() => getBlockTagAttributes(r), [r, getBlockTagAttributes]), h = useMemo(
3845
3844
  () => c(r._id, getBlockRuntimeProps(r._type)),
3846
3845
  [r._id, r._type, c, getBlockRuntimeProps]
3847
- ), x = useMemo(() => !has(a, "dataProvider") || !isFunction$1(a.dataProvider) ? {} : a.dataProvider(r, l), [r, l, a]), b = useMemo(
3846
+ ), x = useMemo(() => !has(a, "dataProvider") || !isFunction$1(a.dataProvider) ? {} : a.dataProvider(r, l), [r, l, a]), y = useMemo(
3848
3847
  () => ({
3849
3848
  blockProps: {
3850
3849
  "data-block-id": r._id,
@@ -3868,7 +3867,7 @@ const getBlockRuntimeProps = memoize((o) => {
3868
3867
  x
3869
3868
  ]
3870
3869
  );
3871
- return isNull(g) || p.includes(r._id) ? null : /* @__PURE__ */ jsx(Suspense, { children: createElement(g, { ...b, children: n }) });
3870
+ return isNull(g) || p.includes(r._id) ? null : /* @__PURE__ */ jsx(Suspense, { children: createElement(g, { ...y, children: n }) });
3872
3871
  }, PartialBlocksRenderer = ({ partialBlockId: o }) => {
3873
3872
  const { getPartailBlocks: n } = usePartailBlocksStore(), r = useMemo(() => n(o), [n, o]), a = useMemo(() => splitAtom(atom$1(r)), [r]);
3874
3873
  return isEmpty(r) ? null : /* @__PURE__ */ jsx(BlocksRenderer, { splitAtoms: a, blocks: r });
@@ -3918,43 +3917,43 @@ const getBlockRuntimeProps = memoize((o) => {
3918
3917
  c();
3919
3918
  }, [n, o, r, c]), l;
3920
3919
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3921
- const [o] = useAtom$1(networkModeAtom), [n] = useCanvasDisplayWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [g, f] = useState([]), [, m] = useState([]), [, h] = useAtom$1(canvasIframeAtom), [x, b] = useSelectedStylingBlocks(), y = useBuilderProp("loading", !1), B = useBuilderProp("htmlDir", "ltr"), j = (A) => {
3922
- p((_) => ({ ..._, width: A }));
3920
+ const [o] = useAtom$1(networkModeAtom), [n] = useCanvasDisplayWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, p] = useState({ width: 0, height: 0 }), u = useCanvasScale(d), [g, f] = useState([]), [, m] = useState([]), [, h] = useAtom$1(canvasIframeAtom), [x, y] = useSelectedStylingBlocks(), b = useBuilderProp("loading", !1), A = useBuilderProp("htmlDir", "ltr"), E = (j) => {
3921
+ p((S) => ({ ...S, width: j }));
3923
3922
  };
3924
3923
  useEffect(() => {
3925
3924
  if (!c.current) return;
3926
- const { clientWidth: A, clientHeight: _ } = c.current;
3927
- p({ width: A, height: _ });
3925
+ const { clientWidth: j, clientHeight: S } = c.current;
3926
+ p({ width: j, height: S });
3928
3927
  }, [c, n]);
3929
- const C = (A, _ = 0) => {
3930
- const { top: w } = A.getBoundingClientRect();
3931
- return w + _ >= 0 && w - _ <= window.innerHeight;
3928
+ const w = (j, S = 0) => {
3929
+ const { top: C } = j.getBoundingClientRect();
3930
+ return C + S >= 0 && C - S <= window.innerHeight;
3932
3931
  };
3933
3932
  useEffect(() => {
3934
- var A, _;
3933
+ var j, S;
3935
3934
  if (a && a.type !== "Multiple" && i.current) {
3936
- const w = getElementByDataBlockId(i.current.contentDocument, a._id);
3937
- w && (C(w) || (_ = (A = i.current) == null ? void 0 : A.contentWindow) == null || _.scrollTo({ top: w.offsetTop, behavior: "smooth" }), f([w]));
3935
+ const C = getElementByDataBlockId(i.current.contentDocument, a._id);
3936
+ C && (w(C) || (S = (j = i.current) == null ? void 0 : j.contentWindow) == null || S.scrollTo({ top: C.offsetTop, behavior: "smooth" }), f([C]));
3938
3937
  }
3939
3938
  }, [a]), useEffect(() => {
3940
3939
  if (!isEmpty(x) && i.current) {
3941
- const A = getElementByStyleId(
3940
+ const j = getElementByStyleId(
3942
3941
  i.current.contentDocument,
3943
3942
  first(x).id
3944
3943
  );
3945
- m(A ? [A] : [null]);
3944
+ m(j ? [j] : [null]);
3946
3945
  } else
3947
3946
  m([null]);
3948
3947
  }, [x]);
3949
- const S = useMemo(() => {
3950
- let A = IframeInitialContent;
3951
- return A = A.replace("__HTML_DIR__", B), o === "offline" && (A = A.replace("https://chaibuilder.com/offline/tailwind.cdn.js", "/offline/tailwind.cdn.js")), A;
3952
- }, [o, B]);
3953
- return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: j, onResize: j, children: /* @__PURE__ */ jsx(
3948
+ const _ = useMemo(() => {
3949
+ let j = IframeInitialContent;
3950
+ return j = j.replace("__HTML_DIR__", A), o === "offline" && (j = j.replace("https://chaibuilder.com/offline/tailwind.cdn.js", "/offline/tailwind.cdn.js")), j;
3951
+ }, [o, A]);
3952
+ return /* @__PURE__ */ jsx(ResizableCanvasWrapper, { onMount: E, onResize: E, children: /* @__PURE__ */ jsx(
3954
3953
  "div",
3955
3954
  {
3956
3955
  onClick: () => {
3957
- r([]), b([]);
3956
+ r([]), y([]);
3958
3957
  },
3959
3958
  onMouseLeave: () => setTimeout(() => l(""), 300),
3960
3959
  className: "relative mx-auto h-full w-full overflow-hidden",
@@ -3967,7 +3966,7 @@ const getBlockRuntimeProps = memoize((o) => {
3967
3966
  id: "canvas-iframe",
3968
3967
  style: { ...u, ...isEmpty(u) ? { width: `${n}px` } : {} },
3969
3968
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3970
- initialContent: S,
3969
+ initialContent: _,
3971
3970
  children: [
3972
3971
  /* @__PURE__ */ jsx(KeyboardHandler, {}),
3973
3972
  /* @__PURE__ */ jsx(
@@ -3979,7 +3978,7 @@ const getBlockRuntimeProps = memoize((o) => {
3979
3978
  ),
3980
3979
  /* @__PURE__ */ jsx(HeadTags, {}),
3981
3980
  /* @__PURE__ */ jsx(Provider$1, { children: /* @__PURE__ */ jsxs(Canvas, { children: [
3982
- y ? /* @__PURE__ */ jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsx(StaticBlocksRenderer, {}),
3981
+ b ? /* @__PURE__ */ jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsx(StaticBlocksRenderer, {}),
3983
3982
  /* @__PURE__ */ jsx(AddBlockAtBottom, {}),
3984
3983
  /* @__PURE__ */ jsx("br", {}),
3985
3984
  /* @__PURE__ */ jsx("br", {}),
@@ -4140,63 +4139,63 @@ const getBlockRuntimeProps = memoize((o) => {
4140
4139
  }
4141
4140
  );
4142
4141
  }, ThemeConfigPanel = React.memo(({ className: o = "" }) => {
4143
- const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), [c, d] = useTheme(), p = useThemeOptions(), { t: u } = useTranslation(), g = (y) => {
4144
- a(y);
4142
+ const [n] = useDarkMode(), [r, a] = React.useState(""), l = useBuilderProp("themePresets", []), i = useBuilderProp("themePanelComponent", null), [c, d] = useTheme(), p = useThemeOptions(), { t: u } = useTranslation(), g = (b) => {
4143
+ a(b);
4145
4144
  }, f = () => {
4146
- const y = l.find((B) => Object.keys(B)[0] === r);
4147
- if (y) {
4148
- const B = Object.values(y)[0];
4149
- B && typeof B == "object" && "fontFamily" in B && "borderRadius" in B && "colors" in B ? d(B) : console.error("Invalid preset structure:", B);
4145
+ const b = l.find((A) => Object.keys(A)[0] === r);
4146
+ if (b) {
4147
+ const A = Object.values(b)[0];
4148
+ A && typeof A == "object" && "fontFamily" in A && "borderRadius" in A && "colors" in A ? d(A) : console.error("Invalid preset structure:", A);
4150
4149
  } else
4151
4150
  console.error("Preset not found:", r);
4152
4151
  }, m = useDebouncedCallback(
4153
- (y, B) => {
4152
+ (b, A) => {
4154
4153
  d(() => ({
4155
4154
  ...c,
4156
4155
  fontFamily: {
4157
4156
  ...c.fontFamily,
4158
- [y.replace(/font-/g, "")]: B
4157
+ [b.replace(/font-/g, "")]: A
4159
4158
  }
4160
4159
  }));
4161
4160
  },
4162
4161
  [c],
4163
4162
  200
4164
4163
  ), h = useDebouncedCallback(
4165
- (y) => {
4164
+ (b) => {
4166
4165
  d(() => ({
4167
4166
  ...c,
4168
- borderRadius: `${y}px`
4167
+ borderRadius: `${b}px`
4169
4168
  }));
4170
4169
  },
4171
4170
  [c],
4172
4171
  200
4173
4172
  ), x = useDebouncedCallback(
4174
- (y, B) => {
4173
+ (b, A) => {
4175
4174
  d(() => {
4176
- const j = get(c, `colors.${y}`);
4177
- return n ? set(j, 1, B) : set(j, 0, B), {
4175
+ const E = get(c, `colors.${b}`);
4176
+ return n ? set(E, 1, A) : set(E, 0, A), {
4178
4177
  ...c,
4179
4178
  colors: {
4180
4179
  ...c.colors,
4181
- [y]: j
4180
+ [b]: E
4182
4181
  }
4183
4182
  };
4184
4183
  });
4185
4184
  },
4186
4185
  [c],
4187
4186
  200
4188
- ), b = (y) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(y.items).map(([B]) => {
4189
- const j = get(c, `colors.${B}.${n ? 1 : 0}`);
4187
+ ), y = (b) => /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1", children: Object.entries(b.items).map(([A]) => {
4188
+ const E = get(c, `colors.${A}.${n ? 1 : 0}`);
4190
4189
  return /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-x-2", children: [
4191
4190
  /* @__PURE__ */ jsx(
4192
4191
  ColorPickerInput,
4193
4192
  {
4194
- value: j,
4195
- onChange: (C) => x(B, C)
4193
+ value: E,
4194
+ onChange: (w) => x(A, w)
4196
4195
  }
4197
4196
  ),
4198
- /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: B.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((C) => C.charAt(0).toUpperCase() + C.slice(1)).join(" ") + (!B.toLowerCase().includes("foreground") && !B.toLowerCase().includes("border") && !B.toLowerCase().includes("input") && !B.toLowerCase().includes("ring") && !B.toLowerCase().includes("background") ? " Background" : "") })
4199
- ] }, B);
4197
+ /* @__PURE__ */ jsx(Label, { className: "text-xs font-normal leading-tight text-slate-600", children: A.split(/(?=[A-Z])/).join(" ").replace(/-/g, " ").split(" ").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ") + (!A.toLowerCase().includes("foreground") && !A.toLowerCase().includes("border") && !A.toLowerCase().includes("input") && !A.toLowerCase().includes("ring") && !A.toLowerCase().includes("background") ? " Background" : "") })
4198
+ ] }, A);
4200
4199
  }) });
4201
4200
  return /* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
4202
4201
  /* @__PURE__ */ jsxs("div", { className: cn$1("no-scrollbar h-full w-full overflow-y-auto", o), children: [
@@ -4207,11 +4206,11 @@ const getBlockRuntimeProps = memoize((o) => {
4207
4206
  "select",
4208
4207
  {
4209
4208
  value: r,
4210
- onChange: (y) => g(y.target.value),
4209
+ onChange: (b) => g(b.target.value),
4211
4210
  className: "w-full space-y-0.5 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
4212
4211
  children: [
4213
4212
  /* @__PURE__ */ jsx("option", { value: "", children: "Select preset" }),
4214
- Array.isArray(l) && l.map((y) => /* @__PURE__ */ jsx("option", { value: Object.keys(y)[0], children: capitalize(Object.keys(y)[0]) }, Object.keys(y)[0]))
4213
+ Array.isArray(l) && l.map((b) => /* @__PURE__ */ jsx("option", { value: Object.keys(b)[0], children: capitalize(Object.keys(b)[0]) }, Object.keys(b)[0]))
4215
4214
  ]
4216
4215
  }
4217
4216
  )
@@ -4228,14 +4227,14 @@ const getBlockRuntimeProps = memoize((o) => {
4228
4227
  ) })
4229
4228
  ] }),
4230
4229
  /* @__PURE__ */ jsxs("div", { className: cn$1("space-y-2", o), children: [
4231
- (p == null ? void 0 : p.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(p.fontFamily).map(([y, B]) => /* @__PURE__ */ jsx(
4230
+ (p == null ? void 0 : p.fontFamily) && /* @__PURE__ */ jsx("div", { className: "grid gap-4", children: Object.entries(p.fontFamily).map(([b, A]) => /* @__PURE__ */ jsx(
4232
4231
  FontSelector,
4233
4232
  {
4234
- label: y,
4235
- value: c.fontFamily[y.replace(/font-/g, "")] || B[Object.keys(B)[0]],
4236
- onChange: (j) => m(y, j)
4233
+ label: b,
4234
+ value: c.fontFamily[b.replace(/font-/g, "")] || A[Object.keys(A)[0]],
4235
+ onChange: (E) => m(b, E)
4237
4236
  },
4238
- y
4237
+ b
4239
4238
  )) }),
4240
4239
  (p == null ? void 0 : p.borderRadius) && /* @__PURE__ */ jsxs("div", { className: "space-y-0.5 py-3", children: [
4241
4240
  /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: u("Border Radius") }),
@@ -4246,7 +4245,7 @@ const getBlockRuntimeProps = memoize((o) => {
4246
4245
  ] }),
4247
4246
  (p == null ? void 0 : p.colors) && /* @__PURE__ */ jsxs("div", { className: "mt-4 space-y-0.5", children: [
4248
4247
  /* @__PURE__ */ jsx(Label, { className: "text-sm text-slate-800", children: u("Colors") }),
4249
- /* @__PURE__ */ jsx("div", { className: "w-full space-y-4 pt-2", children: p.colors.map((y) => b(y)) }, n ? "dark" : "light")
4248
+ /* @__PURE__ */ jsx("div", { className: "w-full space-y-4 pt-2", children: p.colors.map((b) => y(b)) }, n ? "dark" : "light")
4250
4249
  ] })
4251
4250
  ] }),
4252
4251
  /* @__PURE__ */ jsx("br", {}),
@@ -4256,91 +4255,41 @@ const getBlockRuntimeProps = memoize((o) => {
4256
4255
  ] }),
4257
4256
  i && /* @__PURE__ */ jsx("div", { className: "absolute bottom-4 w-full", children: React.createElement(i) })
4258
4257
  ] });
4259
- }), ICON_PICKER_CONTAINER_ID = "icon-picker-item-container", removeSizeAttributes = (o) => {
4258
+ }), removeSizeAttributes = (o) => {
4260
4259
  try {
4261
4260
  return o.replace(/<svg([^>]*)\sheight="[^"]*"([^>]*)>/gi, "<svg$1$2>").replace(/<svg([^>]*)\swidth="[^"]*"([^>]*)>/gi, "<svg$1$2>");
4262
4261
  } catch {
4263
4262
  return o;
4264
4263
  }
4265
- }, getSvgMarkup = () => new Promise((o, n) => {
4266
- setTimeout(() => {
4267
- try {
4268
- const r = document.getElementById(ICON_PICKER_CONTAINER_ID);
4269
- let a = (r == null ? void 0 : r.innerHTML) || "";
4270
- a = removeSizeAttributes(a), o(a);
4271
- } catch (r) {
4272
- n(r);
4273
- }
4274
- }, 300);
4275
- }), IconPickerField = ({ value: o, onChange: n, id: r }) => {
4276
- const { t: a } = useTranslation(), [l, i] = useState(null);
4277
- return useEffect(() => {
4278
- i(null);
4279
- }, [o]), /* @__PURE__ */ jsxs("div", { className: "mt-1 flex h-20 items-center gap-x-2", id: "icon-picker-field", children: [
4280
- /* @__PURE__ */ jsxs("div", { className: "relative h-12 w-12 cursor-pointer overflow-hidden rounded-lg border duration-300 hover:bg-gray-100", children: [
4281
- l ? /* @__PURE__ */ jsx(
4282
- "div",
4283
- {
4284
- id: ICON_PICKER_CONTAINER_ID,
4285
- className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform",
4286
- children: /* @__PURE__ */ jsx(IconPickerItem, { value: l })
4287
- }
4288
- ) : o ? /* @__PURE__ */ jsx(
4289
- "div",
4290
- {
4291
- className: "absolute left-1/2 top-1/2 h-4 w-4 -translate-x-1/2 -translate-y-1/2 transform",
4292
- dangerouslySetInnerHTML: { __html: o }
4293
- }
4294
- ) : /* @__PURE__ */ jsx(
4295
- "div",
4296
- {
4297
- id: "icon-picker-item-container",
4298
- className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform",
4299
- children: /* @__PURE__ */ jsx(IconPickerItem, { value: "BiSolidGrid" })
4300
- }
4301
- ),
4264
+ }, IconPickerField = ({ value: o, onChange: n, id: r }) => {
4265
+ const { t: a } = useTranslation(), [l, i] = useState(o || "");
4266
+ useEffect(() => {
4267
+ i(o || "");
4268
+ }, [o]);
4269
+ const c = (d) => {
4270
+ i(d);
4271
+ const p = removeSizeAttributes(d);
4272
+ n(p);
4273
+ };
4274
+ return /* @__PURE__ */ jsxs("div", { className: "mt-1 flex flex-col gap-2", id: "icon-picker-field", children: [
4275
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
4276
+ /* @__PURE__ */ jsx("div", { className: "flex h-12 w-12 items-center justify-center overflow-hidden rounded-lg border bg-gray-50", children: l ? /* @__PURE__ */ jsx("div", { className: "h-6 w-6", dangerouslySetInnerHTML: { __html: l } }) : /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-400", children: "SVG" }) }),
4302
4277
  /* @__PURE__ */ jsx(
4303
- IconPicker,
4278
+ "textarea",
4304
4279
  {
4305
- value: l || o,
4306
- onChange: async (d) => {
4307
- const p = l;
4308
- try {
4309
- i(d);
4310
- const u = await getSvgMarkup();
4311
- n(u);
4312
- } catch {
4313
- i(p);
4314
- }
4315
- },
4316
- pickButtonStyle: {
4317
- height: "48px",
4318
- width: "48px",
4319
- opacity: 0
4320
- },
4321
- searchInputStyle: {
4322
- backgroundColor: "transparent",
4323
- width: "100%",
4324
- border: "1px solid #BBBBBB",
4325
- margin: "0px 10px",
4326
- padding: "10px"
4327
- }
4280
+ id: r,
4281
+ autoCapitalize: "off",
4282
+ autoCorrect: "off",
4283
+ spellCheck: "false",
4284
+ value: l,
4285
+ onChange: (d) => c(d.target.value),
4286
+ placeholder: a("Enter SVG code here"),
4287
+ rows: 2,
4288
+ className: "no-scrollbar w-full rounded-md border border-border bg-background px-3 py-1.5 text-xs shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
4328
4289
  }
4329
4290
  )
4330
4291
  ] }),
4331
- /* @__PURE__ */ jsx(
4332
- "textarea",
4333
- {
4334
- id: r,
4335
- autoCapitalize: "off",
4336
- autoCorrect: "off",
4337
- spellCheck: "false",
4338
- value: o,
4339
- onChange: (d) => n(d.target.value),
4340
- placeholder: a("Choose Icon or SVG"),
4341
- className: "no-scrollbar flex w-full rounded-md border border-border bg-background px-3 py-1.5 text-[10px] leading-4 shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
4342
- }
4343
- )
4292
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: a("Paste SVG code to use as an icon") })
4344
4293
  ] });
4345
4294
  }, MediaManagerModal = ({
4346
4295
  children: o,
@@ -4389,14 +4338,14 @@ function NestedPathSelector({ data: o, onSelect: n, dataType: r = "value" }) {
4389
4338
  }, [a, o]);
4390
4339
  const u = (h) => Array.isArray(h) ? "array" : typeof h == "object" && h !== null ? "object" : "value", g = React.useCallback(
4391
4340
  (h) => {
4392
- const x = (b) => r === "value" ? b === "value" || b === "object" : r === "array" ? b === "array" : b === r;
4393
- h.type === "object" ? (c((b) => [...b, h.key]), p(h.value)) : x(h.type) && (n([...i, h.key].join(".")), l(!1));
4341
+ const x = (y) => r === "value" ? y === "value" || y === "object" : r === "array" ? y === "array" : y === r;
4342
+ h.type === "object" ? (c((y) => [...y, h.key]), p(h.value)) : x(h.type) && (n([...i, h.key].join(".")), l(!1));
4394
4343
  },
4395
4344
  [i, n, r]
4396
4345
  ), f = React.useCallback(() => {
4397
4346
  if (i.length > 0) {
4398
4347
  const h = i.slice(0, -1);
4399
- c(h), p(h.reduce((x, b) => x[b], o));
4348
+ c(h), p(h.reduce((x, y) => x[y], o));
4400
4349
  }
4401
4350
  }, [i, o]), m = React.useMemo(() => Object.entries(d).map(([h, x]) => ({
4402
4351
  key: h,
@@ -4671,11 +4620,11 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4671
4620
  if (h !== x)
4672
4621
  u.chain().deleteSelection().insertContent(m).run();
4673
4622
  else {
4674
- const { state: y } = u, B = y.selection.from, j = y.doc.textBetween(Math.max(0, B - 1), B), C = y.doc.textBetween(B, Math.min(B + 1, y.doc.content.size));
4675
- let S = "";
4676
- B > 0 && j !== " " && !/[.,!?;:]/.test(j) && (S = " ");
4677
- let A = "";
4678
- C && C !== " " && !/[.,!?;:]/.test(C) && (A = " "), u.chain().insertContent(S + m + A).run();
4623
+ const { state: b } = u, A = b.selection.from, E = b.doc.textBetween(Math.max(0, A - 1), A), w = b.doc.textBetween(A, Math.min(A + 1, b.doc.content.size));
4624
+ let _ = "";
4625
+ A > 0 && E !== " " && !/[.,!?;:]/.test(E) && (_ = " ");
4626
+ let j = "";
4627
+ w && w !== " " && !/[.,!?;:]/.test(w) && (j = " "), u.chain().insertContent(_ + m + j).run();
4679
4628
  }
4680
4629
  };
4681
4630
  return /* @__PURE__ */ jsx(Dialog, { open: o, onOpenChange: (f) => !f && n(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto sm:max-w-[800px]", children: [
@@ -4757,16 +4706,16 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4757
4706
  onChange: r
4758
4707
  }) => {
4759
4708
  var L;
4760
- const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [f, m] = useState(""), [h, x] = useState([]), [b, y] = useState(-1), B = useRef(null), j = (L = n == null ? void 0 : n.find((v) => v.key === u)) == null ? void 0 : L.name;
4709
+ const { t: a } = useTranslation(), l = useBuilderProp("searchPageTypeItems", (v, k) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, g] = useState("page"), [f, m] = useState(""), [h, x] = useState([]), [y, b] = useState(-1), A = useRef(null), E = (L = n == null ? void 0 : n.find((v) => v.key === u)) == null ? void 0 : L.name;
4761
4710
  useEffect(() => {
4762
- if (m(""), x([]), y(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4711
+ if (m(""), x([]), b(-1), p(!1), !o || i || !startsWith(o, "pageType:")) return;
4763
4712
  const v = split(o, ":"), k = get(v, 1, "page") || "page";
4764
4713
  g(k), (async () => {
4765
- const E = await l(k, [get(v, 2, "page")]);
4766
- E && Array.isArray(E) && m(get(E, [0, "name"], ""));
4714
+ const B = await l(k, [get(v, 2, "page")]);
4715
+ B && Array.isArray(B) && m(get(B, [0, "name"], ""));
4767
4716
  })();
4768
4717
  }, [o]);
4769
- const C = useDebouncedCallback(
4718
+ const w = useDebouncedCallback(
4770
4719
  async (v) => {
4771
4720
  if (isEmpty(v))
4772
4721
  x([]);
@@ -4774,40 +4723,40 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4774
4723
  const k = await l(u, v);
4775
4724
  x(k);
4776
4725
  }
4777
- c(!1), y(-1);
4726
+ c(!1), b(-1);
4778
4727
  },
4779
4728
  [u],
4780
4729
  300
4781
- ), S = (v) => {
4730
+ ), _ = (v) => {
4782
4731
  const k = ["pageType", u, v.id];
4783
- k[1] && (r(k.join(":")), m(v.name), p(!1), x([]), y(-1));
4784
- }, A = (v) => {
4732
+ k[1] && (r(k.join(":")), m(v.name), p(!1), x([]), b(-1));
4733
+ }, j = (v) => {
4785
4734
  switch (v.key) {
4786
4735
  case "ArrowDown":
4787
- v.preventDefault(), y((k) => k < h.length - 1 ? k + 1 : k);
4736
+ v.preventDefault(), b((k) => k < h.length - 1 ? k + 1 : k);
4788
4737
  break;
4789
4738
  case "ArrowUp":
4790
- v.preventDefault(), y((k) => k > 0 ? k - 1 : k);
4739
+ v.preventDefault(), b((k) => k > 0 ? k - 1 : k);
4791
4740
  break;
4792
4741
  case "Enter":
4793
4742
  if (v.preventDefault(), h.length === 0) return;
4794
- b >= 0 && S(h[b]);
4743
+ y >= 0 && _(h[y]);
4795
4744
  break;
4796
4745
  case "Escape":
4797
- v.preventDefault(), _();
4746
+ v.preventDefault(), S();
4798
4747
  break;
4799
4748
  }
4800
4749
  };
4801
4750
  useEffect(() => {
4802
- if (b >= 0 && B.current) {
4803
- const v = B.current.children[b];
4751
+ if (y >= 0 && A.current) {
4752
+ const v = A.current.children[y];
4804
4753
  v == null || v.scrollIntoView({ block: "nearest" });
4805
4754
  }
4806
- }, [b]);
4807
- const _ = () => {
4808
- m(""), x([]), y(-1), p(!1), r("");
4809
- }, w = (v) => {
4810
- m(v), p(!isEmpty(v)), c(!0), C(v);
4755
+ }, [y]);
4756
+ const S = () => {
4757
+ m(""), x([]), b(-1), p(!1), r("");
4758
+ }, C = (v) => {
4759
+ m(v), p(!isEmpty(v)), c(!0), w(v);
4811
4760
  };
4812
4761
  return /* @__PURE__ */ jsxs("div", { children: [
4813
4762
  /* @__PURE__ */ jsx("select", { name: "pageType", value: u, onChange: (v) => g(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsx("option", { value: v.key, children: v.name }, v.key)) }),
@@ -4817,13 +4766,13 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4817
4766
  {
4818
4767
  type: "text",
4819
4768
  value: f,
4820
- onChange: (v) => w(v.target.value),
4821
- onKeyDown: A,
4822
- placeholder: a(`Search ${j ?? ""}`),
4769
+ onChange: (v) => C(v.target.value),
4770
+ onKeyDown: j,
4771
+ placeholder: a(`Search ${E ?? ""}`),
4823
4772
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
4824
4773
  }
4825
4774
  ),
4826
- /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: f && /* @__PURE__ */ jsx("button", { onClick: _, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4775
+ /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: f && /* @__PURE__ */ jsx("button", { onClick: S, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }) }) })
4827
4776
  ] }),
4828
4777
  (i || !isEmpty(h) || d && isEmpty(h)) && /* @__PURE__ */ jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full max-w-[250px] overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
4829
4778
  /* @__PURE__ */ jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
@@ -4833,11 +4782,11 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4833
4782
  ' "',
4834
4783
  f,
4835
4784
  '"'
4836
- ] }) : /* @__PURE__ */ jsx("ul", { ref: B, children: map(h == null ? void 0 : h.slice(0, 20), (v, k) => /* @__PURE__ */ jsxs(
4785
+ ] }) : /* @__PURE__ */ jsx("ul", { ref: A, children: map(h == null ? void 0 : h.slice(0, 20), (v, k) => /* @__PURE__ */ jsxs(
4837
4786
  "li",
4838
4787
  {
4839
- onClick: () => S(v),
4840
- className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : k === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
4788
+ onClick: () => _(v),
4789
+ className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : k === y ? "bg-gray-100" : "hover:bg-gray-100"}`,
4841
4790
  children: [
4842
4791
  v.name,
4843
4792
  " ",
@@ -4933,23 +4882,23 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
4933
4882
  const f = () => {
4934
4883
  const x = findIndex(u, { _id: g });
4935
4884
  if (x > -1) {
4936
- const b = (x + 1) % u.length, y = get(u, [b, "_id"]);
4937
- if (!y) return;
4938
- n({ ...o, currentSlide: y }), c([y]);
4885
+ const y = (x + 1) % u.length, b = get(u, [y, "_id"]);
4886
+ if (!b) return;
4887
+ n({ ...o, currentSlide: b }), c([b]);
4939
4888
  }
4940
4889
  }, m = () => {
4941
4890
  const x = findIndex(u, { _id: g });
4942
4891
  if (x > -1) {
4943
- const b = (x - 1 + u.length) % u.length, y = get(u, [b, "_id"]);
4944
- if (!y) return;
4945
- n({ ...o, currentSlide: y }), c([y]);
4892
+ const y = (x - 1 + u.length) % u.length, b = get(u, [y, "_id"]);
4893
+ if (!b) return;
4894
+ n({ ...o, currentSlide: b }), c([b]);
4946
4895
  }
4947
4896
  }, h = () => {
4948
4897
  const x = i(
4949
4898
  { styles: "#styles:,h-full w-full min-w-full", type: "Slide" },
4950
4899
  p == null ? void 0 : p._id
4951
- ), b = x == null ? void 0 : x._id;
4952
- b && (n({ ...o, currentSlide: b }), c([b]));
4900
+ ), y = x == null ? void 0 : x._id;
4901
+ y && (n({ ...o, currentSlide: y }), c([y]));
4953
4902
  };
4954
4903
  return /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 px-2", children: [
4955
4904
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 pb-2 text-[12px]", children: [
@@ -5028,8 +4977,8 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
5028
4977
  className: "text-xs",
5029
4978
  pattern: "[0-9]*",
5030
4979
  onChange: (x) => {
5031
- let b = x.target.value;
5032
- b.length && (b = b.replace("-", "")), n({ ...o, autoplayInterval: b });
4980
+ let y = x.target.value;
4981
+ y.length && (y = y.replace("-", "")), n({ ...o, autoplayInterval: y });
5033
4982
  }
5034
4983
  }
5035
4984
  )
@@ -5068,62 +5017,62 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
5068
5017
  formData: g,
5069
5018
  onChange: f
5070
5019
  }) => {
5071
- const { selectedLang: m, fallbackLang: h, languages: x } = useLanguages(), b = isEmpty(x) ? "" : isEmpty(m) ? h : m, y = get(LANGUAGES, b, b), B = usePageExternalData(), j = useSelectedBlock(), C = useRegisteredChaiBlocks(), S = get(C, [j == null ? void 0 : j._type, "i18nProps"], []) || [], [A, _] = useState(null), w = useCallback(
5020
+ const { selectedLang: m, fallbackLang: h, languages: x } = useLanguages(), y = isEmpty(x) ? "" : isEmpty(m) ? h : m, b = get(LANGUAGES, y, y), A = usePageExternalData(), E = useSelectedBlock(), w = useRegisteredChaiBlocks(), _ = get(w, [E == null ? void 0 : E._type, "i18nProps"], []) || [], [j, S] = useState(null), C = useCallback(
5072
5021
  (k) => {
5073
- const E = (N) => /[.,!?;:]/.test(N), T = (N, D, M) => {
5074
- let P = "", O = "";
5075
- const $ = D > 0 ? N[D - 1] : "", H = D < N.length ? N[D] : "";
5076
- return D > 0 && ($ === "." || !E($) && $ !== " ") && (P = " "), D < N.length && !E(H) && H !== " " && (O = " "), {
5077
- text: P + M + O,
5078
- prefixLength: P.length,
5022
+ const B = (N) => /[.,!?;:]/.test(N), T = (N, D, $) => {
5023
+ let R = "", O = "";
5024
+ const M = D > 0 ? N[D - 1] : "", H = D < N.length ? N[D] : "";
5025
+ return D > 0 && (M === "." || !B(M) && M !== " ") && (R = " "), D < N.length && !B(H) && H !== " " && (O = " "), {
5026
+ text: R + $ + O,
5027
+ prefixLength: R.length,
5079
5028
  suffixLength: O.length
5080
5029
  };
5081
5030
  }, I = document.getElementById(o);
5082
5031
  if (!I) return;
5083
- const R = document.getElementById(`chai-rte-${o}`) || document.getElementById(`chai-rte-modal-${o}`);
5084
- if (R && (R.querySelector(".ProseMirror") || R.__chaiRTE)) {
5085
- const N = R.__chaiRTE;
5032
+ const P = document.getElementById(`chai-rte-${o}`) || document.getElementById(`chai-rte-modal-${o}`);
5033
+ if (P && (P.querySelector(".ProseMirror") || P.__chaiRTE)) {
5034
+ const N = P.__chaiRTE;
5086
5035
  if (N) {
5087
5036
  const D = `{{${k}}}`;
5088
5037
  N.commands.focus();
5089
- const { from: M, to: P } = N.state.selection;
5090
- if (M !== P)
5038
+ const { from: $, to: R } = N.state.selection;
5039
+ if ($ !== R)
5091
5040
  N.chain().deleteSelection().insertContent(D).run();
5092
5041
  else {
5093
- const { state: $ } = N, H = $.selection.from, F = $.doc.textBetween(Math.max(0, H - 1), H), U = $.doc.textBetween(H, Math.min(H + 1, $.doc.content.size));
5042
+ const { state: M } = N, H = M.selection.from, F = M.doc.textBetween(Math.max(0, H - 1), H), U = M.doc.textBetween(H, Math.min(H + 1, M.doc.content.size));
5094
5043
  let z = "";
5095
- H > 0 && F !== " " && !E(F) && (z = " ");
5044
+ H > 0 && F !== " " && !B(F) && (z = " ");
5096
5045
  let W = "";
5097
- U && U !== " " && !E(U) && (W = " "), N.chain().insertContent(z + D + W).run();
5046
+ U && U !== " " && !B(U) && (W = " "), N.chain().insertContent(z + D + W).run();
5098
5047
  }
5099
5048
  setTimeout(() => f(N.getHTML(), {}, o), 100);
5100
5049
  return;
5101
5050
  }
5102
5051
  } else {
5103
- const N = I, D = N.selectionStart || 0, M = N.value || "", P = N.selectionEnd || D;
5104
- if (P > D) {
5105
- const U = `{{${k}}}`, { text: z } = T(M, D, U), W = M.slice(0, D) + z + M.slice(P);
5052
+ const N = I, D = N.selectionStart || 0, $ = N.value || "", R = N.selectionEnd || D;
5053
+ if (R > D) {
5054
+ const U = `{{${k}}}`, { text: z } = T($, D, U), W = $.slice(0, D) + z + $.slice(R);
5106
5055
  f(W, {}, o);
5107
5056
  return;
5108
5057
  }
5109
- const $ = `{{${k}}}`, { text: H } = T(M, D, $), F = M.slice(0, D) + H + M.slice(D);
5058
+ const M = `{{${k}}}`, { text: H } = T($, D, M), F = $.slice(0, D) + H + $.slice(D);
5110
5059
  f(F, {}, o);
5111
5060
  }
5112
5061
  },
5113
- [o, f, g, j == null ? void 0 : j._id]
5062
+ [o, f, g, E == null ? void 0 : E._id]
5114
5063
  );
5115
5064
  if (d)
5116
5065
  return null;
5117
5066
  if (u.type === "boolean") return /* @__PURE__ */ jsx("div", { className: n, children: a });
5118
- const v = S == null ? void 0 : S.includes(o.replace("root.", ""));
5067
+ const v = _ == null ? void 0 : _.includes(o.replace("root.", ""));
5119
5068
  if (u.type === "array") {
5120
- const k = A === o;
5069
+ const k = j === o;
5121
5070
  return /* @__PURE__ */ jsxs("div", { className: `${n} relative`, children: [
5122
5071
  u.title && /* @__PURE__ */ jsxs(
5123
5072
  "label",
5124
5073
  {
5125
5074
  htmlFor: o,
5126
- onClick: () => _(k ? null : o),
5075
+ onClick: () => S(k ? null : o),
5127
5076
  className: "flex cursor-pointer items-center gap-x-1 py-1 leading-tight duration-200 hover:bg-slate-100",
5128
5077
  children: [
5129
5078
  k ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3" }),
@@ -5149,11 +5098,11 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
5149
5098
  " ",
5150
5099
  v && /* @__PURE__ */ jsxs("small", { className: "text-[9px] text-zinc-400", children: [
5151
5100
  " ",
5152
- y
5101
+ b
5153
5102
  ] }),
5154
5103
  p && u.type !== "object" ? " *" : null
5155
5104
  ] }),
5156
- u.type === "string" && !u.enum && !u.oneOf && B && /* @__PURE__ */ jsx(NestedPathSelector, { data: B, onSelect: w, dataType: "value" })
5105
+ u.type === "string" && !u.enum && !u.oneOf && A && /* @__PURE__ */ jsx(NestedPathSelector, { data: A, onSelect: C, dataType: "value" })
5157
5106
  ] }),
5158
5107
  c,
5159
5108
  a,
@@ -5252,35 +5201,35 @@ const MenuBar = ({ editor: o, onExpand: n }) => {
5252
5201
  }), a;
5253
5202
  };
5254
5203
  function BlockSettings() {
5255
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), f = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, f), h = ({ formData: A }, _, w) => {
5256
- _ && (c == null ? void 0 : c._id) === n._id && a([n._id], { [_]: get(A, _) }, w);
5204
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getRegisteredChaiBlock(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), [p, u] = useState(!1), g = useWrapperBlock(), f = getRegisteredChaiBlock(g == null ? void 0 : g._type), m = formDataWithSelectedLang(g, o, f), h = ({ formData: j }, S, C) => {
5205
+ S && (c == null ? void 0 : c._id) === n._id && a([n._id], { [S]: get(j, S) }, C);
5257
5206
  }, x = useCallback(
5258
- debounce(({ formData: A }, _, w) => {
5259
- h({ formData: A }, _, w), d(A);
5207
+ debounce(({ formData: j }, S, C) => {
5208
+ h({ formData: j }, S, C), d(j);
5260
5209
  }, 1500),
5261
5210
  [n == null ? void 0 : n._id, o]
5262
- ), b = ({ formData: A }, _) => {
5263
- _ && (r([n._id], { [_]: get(A, _) }), x({ formData: A }, _, { [_]: get(c, _) }));
5264
- }, y = ({ formData: A }, _) => {
5265
- _ && (r([g._id], { [_]: get(A, _) }), x({ formData: A }, _, { [_]: get(c, _) }));
5211
+ ), y = ({ formData: j }, S) => {
5212
+ S && (r([n._id], { [S]: get(j, S) }), x({ formData: j }, S, { [S]: get(c, S) }));
5213
+ }, b = ({ formData: j }, S) => {
5214
+ S && (r([g._id], { [S]: get(j, S) }), x({ formData: j }, S, { [S]: get(c, S) }));
5266
5215
  };
5267
5216
  keys(get(i, "_bindings", {}));
5268
- const { schema: B, uiSchema: j } = useMemo(() => {
5269
- const A = n == null ? void 0 : n._type;
5270
- if (A)
5271
- return getBlockFormSchemas(A);
5272
- }, [n]), { wrapperSchema: C, wrapperUiSchema: S } = useMemo(() => {
5217
+ const { schema: A, uiSchema: E } = useMemo(() => {
5218
+ const j = n == null ? void 0 : n._type;
5219
+ if (j)
5220
+ return getBlockFormSchemas(j);
5221
+ }, [n]), { wrapperSchema: w, wrapperUiSchema: _ } = useMemo(() => {
5273
5222
  if (!g || !(g != null && g._type))
5274
5223
  return { wrapperSchema: {}, wrapperUiSchema: {} };
5275
- const A = g == null ? void 0 : g._type, { schema: _ = {}, uiSchema: w = {} } = getBlockFormSchemas(A);
5276
- return { wrapperSchema: _, wrapperUiSchema: w };
5224
+ const j = g == null ? void 0 : g._type, { schema: S = {}, uiSchema: C = {} } = getBlockFormSchemas(j);
5225
+ return { wrapperSchema: S, wrapperUiSchema: C };
5277
5226
  }, [g]);
5278
5227
  return /* @__PURE__ */ jsxs("div", { className: "no-scrollbar overflow-x-hidden px-px", children: [
5279
5228
  !isEmpty(g) && /* @__PURE__ */ jsxs("div", { className: "mb-4 rounded border bg-zinc-100 px-1", children: [
5280
5229
  /* @__PURE__ */ jsxs(
5281
5230
  "div",
5282
5231
  {
5283
- onClick: () => u((A) => !A),
5232
+ onClick: () => u((j) => !j),
5284
5233
  className: "flex cursor-pointer items-center gap-x-1 py-2 text-xs font-medium leading-tight hover:bg-slate-100",
5285
5234
  children: [
5286
5235
  p ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 stroke-[3] text-slate-400" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 stroke-[3] text-slate-400" }),
@@ -5299,21 +5248,21 @@ function BlockSettings() {
5299
5248
  JSONForm,
5300
5249
  {
5301
5250
  blockId: g == null ? void 0 : g._id,
5302
- onChange: y,
5251
+ onChange: b,
5303
5252
  formData: m,
5304
- schema: C,
5305
- uiSchema: S
5253
+ schema: w,
5254
+ uiSchema: _
5306
5255
  }
5307
5256
  ) })
5308
5257
  ] }),
5309
- isEmpty(B) ? null : /* @__PURE__ */ jsx(
5258
+ isEmpty(A) ? null : /* @__PURE__ */ jsx(
5310
5259
  JSONForm,
5311
5260
  {
5312
5261
  blockId: n == null ? void 0 : n._id,
5313
- onChange: b,
5262
+ onChange: y,
5314
5263
  formData: i,
5315
- schema: B,
5316
- uiSchema: j
5264
+ schema: A,
5265
+ uiSchema: E
5317
5266
  }
5318
5267
  ),
5319
5268
  (n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsx(GlobalBlockSettings, {}) : null
@@ -5418,33 +5367,33 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsx(
5418
5367
  canvas: n = !1,
5419
5368
  tooltip: r = !0
5420
5369
  }) => {
5421
- const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: f } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), h = (y) => {
5422
- u.includes(y) ? u.length > 2 && g(u.filter((B) => B !== y)) : g((B) => [...B, y]);
5423
- }, x = (y) => {
5424
- n || l(y), c(y);
5425
- }, b = getBreakpointValue(n ? i : a).toLowerCase();
5426
- return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (y) => /* @__PURE__ */ createElement(
5370
+ const [a, , l] = useScreenSizeWidth(), [i, c] = useCanvasDisplayWidth(), [d, p] = useSelectedBreakpoints(), u = d, g = p, { t: f } = useTranslation(), m = useBuilderProp("breakpoints", WEB_BREAKPOINTS), h = (b) => {
5371
+ u.includes(b) ? u.length > 2 && g(u.filter((A) => A !== b)) : g((A) => [...A, b]);
5372
+ }, x = (b) => {
5373
+ n || l(b), c(b);
5374
+ }, y = getBreakpointValue(n ? i : a).toLowerCase();
5375
+ return m.length < 4 ? /* @__PURE__ */ jsx("div", { className: "flex items-center rounded-md", children: map(m, (b) => /* @__PURE__ */ createElement(
5427
5376
  BreakpointCard,
5428
5377
  {
5429
5378
  canvas: n,
5430
- ...y,
5379
+ ...b,
5431
5380
  onClick: x,
5432
- key: y.breakpoint,
5433
- currentBreakpoint: b
5381
+ key: b.breakpoint,
5382
+ currentBreakpoint: y
5434
5383
  }
5435
5384
  )) }) : /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between rounded-md", children: [
5436
5385
  /* @__PURE__ */ jsx("div", { className: "flex items-center", children: map(
5437
- m.filter((y) => includes(u, toUpper(y.breakpoint))),
5438
- (y) => /* @__PURE__ */ createElement(
5386
+ m.filter((b) => includes(u, toUpper(b.breakpoint))),
5387
+ (b) => /* @__PURE__ */ createElement(
5439
5388
  BreakpointCard,
5440
5389
  {
5441
5390
  canvas: n,
5442
5391
  openDelay: o,
5443
5392
  tooltip: r,
5444
- ...y,
5393
+ ...b,
5445
5394
  onClick: x,
5446
- key: y.breakpoint,
5447
- currentBreakpoint: b
5395
+ key: b.breakpoint,
5396
+ currentBreakpoint: y
5448
5397
  }
5449
5398
  )
5450
5399
  ) }),
@@ -5453,15 +5402,15 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsx(
5453
5402
  /* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-56 border-border text-xs", children: [
5454
5403
  /* @__PURE__ */ jsx(DropdownMenuLabel, { children: f("Screen sizes") }),
5455
5404
  /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
5456
- map(m, (y) => /* @__PURE__ */ jsx(
5405
+ map(m, (b) => /* @__PURE__ */ jsx(
5457
5406
  DropdownMenuCheckboxItem,
5458
5407
  {
5459
- disabled: y.breakpoint === "xs",
5460
- onCheckedChange: () => h(toUpper(y.breakpoint)),
5461
- checked: includes(u, toUpper(y.breakpoint)),
5462
- children: f(y.title)
5408
+ disabled: b.breakpoint === "xs",
5409
+ onCheckedChange: () => h(toUpper(b.breakpoint)),
5410
+ checked: includes(u, toUpper(b.breakpoint)),
5411
+ children: f(b.title)
5463
5412
  },
5464
- y.breakpoint
5413
+ b.breakpoint
5465
5414
  ))
5466
5415
  ] })
5467
5416
  ] })
@@ -5484,18 +5433,6 @@ function BreakpointSelector() {
5484
5433
  ] }) }) })
5485
5434
  ] });
5486
5435
  }
5487
- function FaLanguage(o) {
5488
- return GenIcon({ tag: "svg", attr: { viewBox: "0 0 640 512" }, child: [{ tag: "path", attr: { d: "M152.1 236.2c-3.5-12.1-7.8-33.2-7.8-33.2h-.5s-4.3 21.1-7.8 33.2l-11.1 37.5H163zM616 96H336v320h280c13.3 0 24-10.7 24-24V120c0-13.3-10.7-24-24-24zm-24 120c0 6.6-5.4 12-12 12h-11.4c-6.9 23.6-21.7 47.4-42.7 69.9 8.4 6.4 17.1 12.5 26.1 18 5.5 3.4 7.3 10.5 4.1 16.2l-7.9 13.9c-3.4 5.9-10.9 7.8-16.7 4.3-12.6-7.8-24.5-16.1-35.4-24.9-10.9 8.7-22.7 17.1-35.4 24.9-5.8 3.5-13.3 1.6-16.7-4.3l-7.9-13.9c-3.2-5.6-1.4-12.8 4.2-16.2 9.3-5.7 18-11.7 26.1-18-7.9-8.4-14.9-17-21-25.7-4-5.7-2.2-13.6 3.7-17.1l6.5-3.9 7.3-4.3c5.4-3.2 12.4-1.7 16 3.4 5 7 10.8 14 17.4 20.9 13.5-14.2 23.8-28.9 30-43.2H412c-6.6 0-12-5.4-12-12v-16c0-6.6 5.4-12 12-12h64v-16c0-6.6 5.4-12 12-12h16c6.6 0 12 5.4 12 12v16h64c6.6 0 12 5.4 12 12zM0 120v272c0 13.3 10.7 24 24 24h280V96H24c-13.3 0-24 10.7-24 24zm58.9 216.1L116.4 167c1.7-4.9 6.2-8.1 11.4-8.1h32.5c5.1 0 9.7 3.3 11.4 8.1l57.5 169.1c2.6 7.8-3.1 15.9-11.4 15.9h-22.9a12 12 0 0 1-11.5-8.6l-9.4-31.9h-60.2l-9.1 31.8c-1.5 5.1-6.2 8.7-11.5 8.7H70.3c-8.2 0-14-8.1-11.4-15.9z" }, child: [] }] })(o);
5489
- }
5490
- function FaMoon(o) {
5491
- return GenIcon({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z" }, child: [] }] })(o);
5492
- }
5493
- function FaRecycle(o) {
5494
- return GenIcon({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M184.561 261.903c3.232 13.997-12.123 24.635-24.068 17.168l-40.736-25.455-50.867 81.402C55.606 356.273 70.96 384 96.012 384H148c6.627 0 12 5.373 12 12v40c0 6.627-5.373 12-12 12H96.115c-75.334 0-121.302-83.048-81.408-146.88l50.822-81.388-40.725-25.448c-12.081-7.547-8.966-25.961 4.879-29.158l110.237-25.45c8.611-1.988 17.201 3.381 19.189 11.99l25.452 110.237zm98.561-182.915l41.289 66.076-40.74 25.457c-12.051 7.528-9 25.953 4.879 29.158l110.237 25.45c8.672 1.999 17.215-3.438 19.189-11.99l25.45-110.237c3.197-13.844-11.99-24.719-24.068-17.168l-40.687 25.424-41.263-66.082c-37.521-60.033-125.209-60.171-162.816 0l-17.963 28.766c-3.51 5.62-1.8 13.021 3.82 16.533l33.919 21.195c5.62 3.512 13.024 1.803 16.536-3.817l17.961-28.743c12.712-20.341 41.973-19.676 54.257-.022zM497.288 301.12l-27.515-44.065c-3.511-5.623-10.916-7.334-16.538-3.821l-33.861 21.159c-5.62 3.512-7.33 10.915-3.818 16.536l27.564 44.112c13.257 21.211-2.057 48.96-27.136 48.96H320V336.02c0-14.213-17.242-21.383-27.313-11.313l-80 79.981c-6.249 6.248-6.249 16.379 0 22.627l80 79.989C302.689 517.308 320 510.3 320 495.989V448h95.88c75.274 0 121.335-82.997 81.408-146.88z" }, child: [] }] })(o);
5495
- }
5496
- function FaSpinner(o) {
5497
- return GenIcon({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z" }, child: [] }] })(o);
5498
- }
5499
5436
  const SECONDS = 10;
5500
5437
  function Countdown() {
5501
5438
  const [o, n] = useState(SECONDS), [r, a] = useState(!1);
@@ -5592,7 +5529,7 @@ const AskAIStyles = ({ blockId: o }) => {
5592
5529
  ),
5593
5530
  a ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
5594
5531
  /* @__PURE__ */ jsxs(Skeleton, { className: "flex w-full items-center space-x-1 px-4 py-1 pl-2", children: [
5595
- /* @__PURE__ */ jsx(FaSpinner, { className: "h-4 w-4 animate-spin text-gray-500" }),
5532
+ /* @__PURE__ */ jsx(Loader, { className: "h-4 w-4 animate-spin text-gray-500", size: 16 }),
5596
5533
  /* @__PURE__ */ jsx("p", { className: "text-xs", children: n("Generating... Please wait...") })
5597
5534
  ] }),
5598
5535
  /* @__PURE__ */ jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
@@ -5611,24 +5548,24 @@ const AskAIStyles = ({ blockId: o }) => {
5611
5548
  };
5612
5549
  function ManualClasses() {
5613
5550
  var T;
5614
- const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [h, x] = useState(""), b = (T = first(d)) == null ? void 0 : T.prop, { classes: y } = getSplitChaiClasses(get(p, b, "")), B = y.split(" ").filter((I) => !isEmpty(I)), j = () => {
5551
+ const o = useRef(null), [n, r] = useState(""), [a, l] = useState(-1), i = useFuseSearch(), { t: c } = useTranslation(), [d] = useSelectedStylingBlocks(), p = useSelectedBlock(), u = useAddClassesToBlocks(), g = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), m = useBuilderProp("askAiCallBack", null), [h, x] = useState(""), y = (T = first(d)) == null ? void 0 : T.prop, { classes: b } = getSplitChaiClasses(get(p, y, "")), A = b.split(" ").filter((I) => !isEmpty(I)), E = () => {
5615
5552
  const I = h.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5616
5553
  u(f, I, !0), x("");
5617
- }, [C, S] = useState([]), A = ({ value: I }) => {
5618
- const R = I.trim().toLowerCase(), N = R.match(/.+:/g);
5554
+ }, [w, _] = useState([]), j = ({ value: I }) => {
5555
+ const P = I.trim().toLowerCase(), N = P.match(/.+:/g);
5619
5556
  let D = [];
5620
5557
  if (N && N.length > 0) {
5621
- const [M] = N, P = R.replace(M, "");
5622
- D = i.search(P).map(($) => ({
5623
- ...$,
5624
- item: { ...$.item, name: M + $.item.name }
5558
+ const [$] = N, R = P.replace($, "");
5559
+ D = i.search(R).map((M) => ({
5560
+ ...M,
5561
+ item: { ...M.item, name: $ + M.item.name }
5625
5562
  }));
5626
5563
  } else
5627
- D = i.search(R);
5628
- return S(map(D, "item"));
5629
- }, _ = () => {
5630
- S([]);
5631
- }, w = (I) => I.name, L = (I) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: I.name }), v = useMemo(
5564
+ D = i.search(P);
5565
+ return _(map(D, "item"));
5566
+ }, S = () => {
5567
+ _([]);
5568
+ }, C = (I) => I.name, L = (I) => /* @__PURE__ */ jsx("div", { className: "rounded-md p-1", children: I.name }), v = useMemo(
5632
5569
  () => ({
5633
5570
  ref: o,
5634
5571
  autoComplete: "off",
@@ -5638,29 +5575,29 @@ function ManualClasses() {
5638
5575
  placeholder: c("Enter classes separated by space"),
5639
5576
  value: h,
5640
5577
  onKeyDown: (I) => {
5641
- I.key === "Enter" && h.trim() !== "" && j();
5578
+ I.key === "Enter" && h.trim() !== "" && E();
5642
5579
  },
5643
- onChange: (I, { newValue: R }) => x(R),
5580
+ onChange: (I, { newValue: P }) => x(P),
5644
5581
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5645
5582
  }),
5646
5583
  [h, c, o]
5647
5584
  ), k = (I) => {
5648
5585
  debugger;
5649
- const R = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5650
- g(f, [I]), u(f, R, !0), r(""), l(-1);
5651
- }, E = () => {
5586
+ const P = n.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5587
+ g(f, [I]), u(f, P, !0), r(""), l(-1);
5588
+ }, B = () => {
5652
5589
  if (navigator.clipboard === void 0) {
5653
5590
  toast.error(c("Clipboard not supported"));
5654
5591
  return;
5655
5592
  }
5656
- navigator.clipboard.writeText(B.join(" ")), toast.success(c("Classes copied to clipboard"));
5593
+ navigator.clipboard.writeText(A.join(" ")), toast.success(c("Classes copied to clipboard"));
5657
5594
  };
5658
5595
  return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-1.5 border-b border-border pb-4", children: [
5659
5596
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-2", children: [
5660
5597
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5661
5598
  /* @__PURE__ */ jsx("span", { children: c("Classes") }),
5662
5599
  /* @__PURE__ */ jsxs(Tooltip, { children: [
5663
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: E, className: "cursor-pointer" }) }),
5600
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(CopyIcon, { onClick: B, className: "cursor-pointer" }) }),
5664
5601
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: c("Copy classes to clipboard") }) })
5665
5602
  ] })
5666
5603
  ] }),
@@ -5676,10 +5613,10 @@ function ManualClasses() {
5676
5613
  /* @__PURE__ */ jsx("div", { className: "relative flex w-full items-center gap-x-3", children: /* @__PURE__ */ jsx(
5677
5614
  Autosuggest,
5678
5615
  {
5679
- suggestions: C,
5680
- onSuggestionsFetchRequested: A,
5681
- onSuggestionsClearRequested: _,
5682
- getSuggestionValue: w,
5616
+ suggestions: w,
5617
+ onSuggestionsFetchRequested: j,
5618
+ onSuggestionsClearRequested: S,
5619
+ getSuggestionValue: C,
5683
5620
  renderSuggestion: L,
5684
5621
  inputProps: v,
5685
5622
  containerProps: {
@@ -5697,15 +5634,15 @@ function ManualClasses() {
5697
5634
  {
5698
5635
  variant: "outline",
5699
5636
  className: "h-6 border-border",
5700
- onClick: j,
5637
+ onClick: E,
5701
5638
  disabled: h.trim() === "",
5702
5639
  size: "sm",
5703
5640
  children: /* @__PURE__ */ jsx(PlusIcon, {})
5704
5641
  }
5705
5642
  )
5706
5643
  ] }),
5707
- /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: B.map(
5708
- (I, R) => a === R ? /* @__PURE__ */ jsx(
5644
+ /* @__PURE__ */ jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: A.map(
5645
+ (I, P) => a === P ? /* @__PURE__ */ jsx(
5709
5646
  "input",
5710
5647
  {
5711
5648
  ref: o,
@@ -6077,8 +6014,8 @@ const COLOR_PROP = {
6077
6014
  }, ColorChoice = ({ property: o, onChange: n }) => {
6078
6015
  const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, p] = useState({ color: "", shade: "" }), u = a.split("-"), g = get(u, "1", ""), f = get(u, "2", ""), m = useCallback(
6079
6016
  // eslint-disable-next-line no-shadow
6080
- (b) => {
6081
- ["current", "inherit", "transparent", "black", "white"].includes(b) ? (c([]), p({ color: b })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((y) => ({ ...y, color: b, shade: y.shade ? y.shade : "500" })));
6017
+ (y) => {
6018
+ ["current", "inherit", "transparent", "black", "white"].includes(y) ? (c([]), p({ color: y })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((b) => ({ ...b, color: y, shade: b.shade ? b.shade : "500" })));
6082
6019
  },
6083
6020
  [c, p]
6084
6021
  );
@@ -6089,8 +6026,8 @@ const COLOR_PROP = {
6089
6026
  }, [g]);
6090
6027
  const h = useCallback(
6091
6028
  // eslint-disable-next-line no-shadow
6092
- (b) => {
6093
- p({ color: g, shade: b });
6029
+ (y) => {
6030
+ p({ color: g, shade: y });
6094
6031
  },
6095
6032
  [g]
6096
6033
  );
@@ -6099,8 +6036,8 @@ const COLOR_PROP = {
6099
6036
  }, [r]);
6100
6037
  const { match: x } = useTailwindClassList();
6101
6038
  return useEffect(() => {
6102
- const y = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6103
- x(o, y) && n(y, o);
6039
+ const b = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6040
+ x(o, b) && n(b, o);
6104
6041
  }, [x, d, n, o]), /* @__PURE__ */ jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6105
6042
  /* @__PURE__ */ jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsx(
6106
6043
  DropDown,
@@ -6338,7 +6275,7 @@ const COLOR_PROP = {
6338
6275
  },
6339
6276
  a
6340
6277
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6341
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [f, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [h, x] = useState(!1), [b, y] = useState(""), [B, j] = useState(!1), [C, S] = useState(!1);
6278
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: g } = o, [f, m] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [h, x] = useState(!1), [y, b] = useState(""), [A, E] = useState(!1), [w, _] = useState(!1);
6342
6279
  useEffect(() => {
6343
6280
  const { value: v, unit: k } = getClassValueAndUnit(i);
6344
6281
  if (k === "") {
@@ -6347,24 +6284,24 @@ const COLOR_PROP = {
6347
6284
  }
6348
6285
  m(k), l(k === "class" || isEmpty(v) ? "" : v);
6349
6286
  }, [i, p, u]);
6350
- const A = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), _ = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), w = useCallback(
6287
+ const j = useThrottledCallback((v) => c(v), [c], THROTTLE_TIME), S = useThrottledCallback((v) => c(v, !1), [c], THROTTLE_TIME), C = useCallback(
6351
6288
  (v = !1) => {
6352
6289
  const k = getUserInputValues(`${a}`, u);
6353
6290
  if (get(k, "error", !1)) {
6354
6291
  x(!0);
6355
6292
  return;
6356
6293
  }
6357
- const E = get(k, "unit") !== "" ? get(k, "unit") : f;
6358
- if (E === "auto" || E === "none") {
6359
- A(`${d}${E}`);
6294
+ const B = get(k, "unit") !== "" ? get(k, "unit") : f;
6295
+ if (B === "auto" || B === "none") {
6296
+ j(`${d}${B}`);
6360
6297
  return;
6361
6298
  }
6362
6299
  if (get(k, "value") === "")
6363
6300
  return;
6364
- const I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${E === "-" ? "" : E}]`;
6365
- v ? _(I) : A(I);
6301
+ const I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${B === "-" ? "" : B}]`;
6302
+ v ? S(I) : j(I);
6366
6303
  },
6367
- [A, _, a, f, d, u]
6304
+ [j, S, a, f, d, u]
6368
6305
  ), L = useCallback(
6369
6306
  (v) => {
6370
6307
  const k = getUserInputValues(`${a}`, u);
@@ -6373,15 +6310,15 @@ const COLOR_PROP = {
6373
6310
  return;
6374
6311
  }
6375
6312
  if (v === "auto" || v === "none") {
6376
- A(`${d}${v}`);
6313
+ j(`${d}${v}`);
6377
6314
  return;
6378
6315
  }
6379
6316
  if (get(k, "value") === "")
6380
6317
  return;
6381
- const E = get(k, "unit") !== "" ? get(k, "unit") : v, I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${E === "-" ? "" : E}]`;
6382
- A(I);
6318
+ const B = get(k, "unit") !== "" ? get(k, "unit") : v, I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${B === "-" ? "" : B}]`;
6319
+ j(I);
6383
6320
  },
6384
- [A, a, d, u]
6321
+ [j, a, d, u]
6385
6322
  );
6386
6323
  return /* @__PURE__ */ jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: f === "class" ? /* @__PURE__ */ jsxs(Fragment, { children: [
6387
6324
  /* @__PURE__ */ jsx(
@@ -6396,29 +6333,29 @@ const COLOR_PROP = {
6396
6333
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsx(InfoCircledIcon, {}) }) }),
6397
6334
  /* @__PURE__ */ jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6398
6335
  ] })
6399
- ] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${B ? "z-auto" : ""}`, children: [
6336
+ ] }) : /* @__PURE__ */ jsxs("div", { className: `group relative flex items-center ${A ? "z-auto" : ""}`, children: [
6400
6337
  /* @__PURE__ */ jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6401
6338
  ["none", "auto"].indexOf(f) !== -1 ? null : /* @__PURE__ */ jsx(
6402
6339
  "input",
6403
6340
  {
6404
6341
  readOnly: f === "class",
6405
6342
  onKeyPress: (v) => {
6406
- v.key === "Enter" && w();
6343
+ v.key === "Enter" && C();
6407
6344
  },
6408
6345
  onKeyDown: (v) => {
6409
6346
  if (v.keyCode !== 38 && v.keyCode !== 40)
6410
6347
  return;
6411
- v.preventDefault(), S(!0);
6348
+ v.preventDefault(), _(!0);
6412
6349
  const k = parseInt$1(v.target.value);
6413
- let E = isNaN$1(k) ? 0 : k;
6414
- v.keyCode === 38 && (E += 1), v.keyCode === 40 && (E -= 1);
6415
- const T = `${E}`, R = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${f === "-" ? "" : f}]`;
6416
- _(R);
6350
+ let B = isNaN$1(k) ? 0 : k;
6351
+ v.keyCode === 38 && (B += 1), v.keyCode === 40 && (B -= 1);
6352
+ const T = `${B}`, P = `${T.startsWith("-") ? "-" : ""}${d}[${T.replace("-", "")}${f === "-" ? "" : f}]`;
6353
+ S(P);
6417
6354
  },
6418
6355
  onKeyUp: (v) => {
6419
- C && (v.preventDefault(), S(!1));
6356
+ w && (v.preventDefault(), _(!1));
6420
6357
  },
6421
- onBlur: () => w(),
6358
+ onBlur: () => C(),
6422
6359
  onChange: (v) => {
6423
6360
  x(!1), l(v.target.value);
6424
6361
  },
@@ -6426,7 +6363,7 @@ const COLOR_PROP = {
6426
6363
  var k;
6427
6364
  (k = v == null ? void 0 : v.target) == null || k.select(), r(!1);
6428
6365
  },
6429
- value: B ? b : a,
6366
+ value: A ? y : a,
6430
6367
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6431
6368
  " ",
6432
6369
  h ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -6458,22 +6395,22 @@ const COLOR_PROP = {
6458
6395
  ) }) })
6459
6396
  ] })
6460
6397
  ] }),
6461
- ["none", "auto"].indexOf(f) !== -1 || B ? null : /* @__PURE__ */ jsx(
6398
+ ["none", "auto"].indexOf(f) !== -1 || A ? null : /* @__PURE__ */ jsx(
6462
6399
  DragStyleButton,
6463
6400
  {
6464
- onDragStart: () => j(!0),
6401
+ onDragStart: () => E(!0),
6465
6402
  onDragEnd: (v) => {
6466
- if (y(() => ""), j(!1), isEmpty(v))
6403
+ if (b(() => ""), E(!1), isEmpty(v))
6467
6404
  return;
6468
6405
  const k = `${v}`, T = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${f === "-" ? "" : f}]`;
6469
- A(T);
6406
+ j(T);
6470
6407
  },
6471
6408
  onDrag: (v) => {
6472
6409
  if (isEmpty(v))
6473
6410
  return;
6474
- y(v);
6411
+ b(v);
6475
6412
  const k = `${v}`, T = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${f === "-" ? "" : f}]`;
6476
- _(T);
6413
+ S(T);
6477
6414
  },
6478
6415
  currentValue: a,
6479
6416
  unit: f,
@@ -6570,35 +6507,35 @@ const COLOR_PROP = {
6570
6507
  "2xl": "1536px"
6571
6508
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6572
6509
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6573
- }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), f = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), h = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), b = useMemo(() => get(f, "fullCls", ""), [f]), y = useCallback(
6574
- (_, w = !0) => {
6575
- const L = { dark: p, mq: g, mod: u, cls: _, property: l, fullCls: "" };
6510
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, g] = useScreenSizeWidth(), f = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), h = useRemoveClassesFromBlocks(), [x] = useSelectedBlockIds(), y = useMemo(() => get(f, "fullCls", ""), [f]), b = useCallback(
6511
+ (S, C = !0) => {
6512
+ const L = { dark: p, mq: g, mod: u, cls: S, property: l, fullCls: "" };
6576
6513
  (p || u !== "") && (L.mq = "xs");
6577
6514
  const v = generateFullClsName(L);
6578
- m(x, [v], w);
6515
+ m(x, [v], C);
6579
6516
  },
6580
6517
  [x, p, g, u, l, m]
6581
- ), B = useCallback(() => {
6582
- h(x, [b], !0);
6583
- }, [x, b, h]), j = useMemo(() => canChangeClass(f, g), [f, g]);
6518
+ ), A = useCallback(() => {
6519
+ h(x, [y], !0);
6520
+ }, [x, y, h]), E = useMemo(() => canChangeClass(f, g), [f, g]);
6584
6521
  useEffect(() => {
6585
- i(j, f);
6586
- }, [j, i, f]);
6587
- const [, , C] = useScreenSizeWidth(), S = useCallback(
6588
- (_) => {
6589
- C({
6522
+ i(E, f);
6523
+ }, [E, i, f]);
6524
+ const [, , w] = useScreenSizeWidth(), _ = useCallback(
6525
+ (S) => {
6526
+ w({
6590
6527
  xs: 400,
6591
6528
  sm: 640,
6592
6529
  md: 800,
6593
6530
  lg: 1024,
6594
6531
  xl: 1420,
6595
6532
  "2xl": 1920
6596
- }[_]);
6533
+ }[S]);
6597
6534
  },
6598
- [C]
6599
- ), A = get(f, "dark", null) === p && get(f, "mod", null) === u && get(f, "mq", null) === g;
6600
- return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: j, canReset: f && A, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6601
- /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${f && !A ? "text-foreground" : ""}`, children: n(a) }) }),
6535
+ [w]
6536
+ ), j = get(f, "dark", null) === p && get(f, "mod", null) === u && get(f, "mq", null) === g;
6537
+ return /* @__PURE__ */ jsx(BlockStyleProvider, { canChange: E, canReset: f && j, children: /* @__PURE__ */ jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6538
+ /* @__PURE__ */ jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsx("span", { className: `text-[11px] ${f && !j ? "text-foreground" : ""}`, children: n(a) }) }),
6602
6539
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center", children: [
6603
6540
  /* @__PURE__ */ jsxs("div", { className: "w-[150px]", children: [
6604
6541
  r === "arbitrary" ? /* @__PURE__ */ jsx(
@@ -6607,17 +6544,17 @@ const COLOR_PROP = {
6607
6544
  currentClass: get(f, "cls", ""),
6608
6545
  classPrefix: get(CLASS_PREFIXES, l, ""),
6609
6546
  units: c || [],
6610
- onChange: y,
6547
+ onChange: b,
6611
6548
  negative: d,
6612
6549
  cssProperty: l
6613
6550
  }
6614
6551
  ) : null,
6615
- r === "icons" && /* @__PURE__ */ jsx(IconChoices, { property: l, onChange: y }),
6616
- r === "range" && /* @__PURE__ */ jsx(RangeChoices, { property: l, onChange: y }),
6617
- r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: y }),
6618
- r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: y })
6552
+ r === "icons" && /* @__PURE__ */ jsx(IconChoices, { property: l, onChange: b }),
6553
+ r === "range" && /* @__PURE__ */ jsx(RangeChoices, { property: l, onChange: b }),
6554
+ r === "color" && /* @__PURE__ */ jsx(ColorChoice, { property: l, onChange: b }),
6555
+ r === "dropdown" && /* @__PURE__ */ jsx(DropDownChoices, { label: a, property: l, onChange: b })
6619
6556
  ] }),
6620
- /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => B(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : j && f ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
6557
+ /* @__PURE__ */ jsx("div", { className: `w-[30px] cursor-pointer ${y ? "visible" : "invisible"}`, children: j ? /* @__PURE__ */ jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : E && f ? /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 100, children: [
6621
6558
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
6622
6559
  "button",
6623
6560
  {
@@ -6637,7 +6574,7 @@ const COLOR_PROP = {
6637
6574
  "button",
6638
6575
  {
6639
6576
  type: "button",
6640
- onClick: () => S(get(f, "mq")),
6577
+ onClick: () => _(get(f, "mq")),
6641
6578
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6642
6579
  children: [
6643
6580
  "Switch to ",
@@ -6826,8 +6763,8 @@ function BlockStyling() {
6826
6763
  m = isNaN(m) ? 0 : m;
6827
6764
  let h = MAPPER[i.dragUnit];
6828
6765
  (startsWith(f, "scale") || f === "opacity") && (h = 10);
6829
- let b = (i.dragStartY - u.pageY) / h + m;
6830
- g && b < 0 && (b = 0), f === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
6766
+ let y = (i.dragStartY - u.pageY) / h + m;
6767
+ g && y < 0 && (y = 0), f === "opacity" && y > 1 && (y = 1), i.onDrag(`${y}`), l(`${y}`);
6831
6768
  },
6832
6769
  [i],
6833
6770
  50
@@ -6871,8 +6808,8 @@ const CoreBlock = ({
6871
6808
  }) => {
6872
6809
  const [, l] = useAtom$1(draggedBlockAtom), { type: i, icon: c, label: d } = o, { addCoreBlock: p, addPredefinedBlock: u } = useAddBlock(), [, g] = useSelectedBlockIds(), { clearHighlight: f } = useBlockHighlight(), m = () => {
6873
6810
  if (console.log("addBlockToPage", o), has(o, "blocks")) {
6874
- const b = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
6875
- u(syncBlocksWithDefaults(b), r || null, a);
6811
+ const y = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
6812
+ u(syncBlocksWithDefaults(y), r || null, a);
6876
6813
  } else
6877
6814
  p(o, r || null, a);
6878
6815
  pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
@@ -6884,8 +6821,8 @@ const CoreBlock = ({
6884
6821
  disabled: n,
6885
6822
  onClick: m,
6886
6823
  type: "button",
6887
- onDragStart: (b) => {
6888
- b.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), b.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
6824
+ onDragStart: (y) => {
6825
+ y.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), y.dataTransfer.setDragImage(new Image(), 0, 0), l(omit(o, ["component", "icon"])), setTimeout(() => {
6889
6826
  g([]), f();
6890
6827
  }, 200);
6891
6828
  },
@@ -7085,22 +7022,22 @@ const CoreBlock = ({
7085
7022
  }
7086
7023
  }
7087
7024
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
7088
- var f, m, h, x, b, y, B, j;
7025
+ var f, m, h, x, y, b, A, E;
7089
7026
  if (r.type === "comment") return [];
7090
7027
  console.log("node ===>", r);
7091
7028
  let a = { _id: generateUUID() };
7092
7029
  if (n && (a._parent = n.block._id), r.type === "text")
7093
7030
  return isEmpty(get(r, "content", "")) ? [] : n && shouldAddText(n.node, n.block) ? (set(n, "block.content", get(r, "content", "")), []) : { ...a, _type: "Text", content: get(r, "content", "") };
7094
7031
  const l = get(r, "attributes", []), i = l.find(
7095
- (C) => C.key === "data-chai-richtext" || C.key === "chai-richtext"
7032
+ (w) => w.key === "data-chai-richtext" || w.key === "chai-richtext"
7096
7033
  ), c = l.find(
7097
- (C) => C.key === "data-chai-lightbox" || C.key === "chai-lightbox"
7034
+ (w) => w.key === "data-chai-lightbox" || w.key === "chai-lightbox"
7098
7035
  ), d = l.find(
7099
- (C) => C.key === "data-chai-dropdown" || C.key === "chai-dropdown"
7036
+ (w) => w.key === "data-chai-dropdown" || w.key === "chai-dropdown"
7100
7037
  ), p = l.find(
7101
- (C) => C.key === "data-chai-dropdown-button" || C.key === "chai-dropdown-button"
7038
+ (w) => w.key === "data-chai-dropdown-button" || w.key === "chai-dropdown-button"
7102
7039
  ), u = l.find(
7103
- (C) => C.key === "data-chai-dropdown-content" || C.key === "chai-dropdown-content"
7040
+ (w) => w.key === "data-chai-dropdown-content" || w.key === "chai-dropdown-content"
7104
7041
  );
7105
7042
  if (a = {
7106
7043
  ...a,
@@ -7108,13 +7045,13 @@ const CoreBlock = ({
7108
7045
  ...getAttrs(r),
7109
7046
  ...getStyles(r)
7110
7047
  }, r.attributes) {
7111
- const C = r.attributes.find((S) => includes(NAME_ATTRIBUTES, S.key));
7112
- C && (a._name = C.value);
7048
+ const w = r.attributes.find((_) => includes(NAME_ATTRIBUTES, _.key));
7049
+ w && (a._name = w.value);
7113
7050
  }
7114
7051
  if (i)
7115
7052
  return a.content = stringify(r.children), has(a, "styles_attrs.data-chai-richtext") && delete a.styles_attrs["data-chai-richtext"], has(a, "styles_attrs.chai-richtext") && delete a.styles_attrs["chai-richtext"], [a];
7116
7053
  if (c) {
7117
- const C = [
7054
+ const w = [
7118
7055
  "data-chai-lightbox",
7119
7056
  "chai-lightbox",
7120
7057
  "data-vbtype",
@@ -7126,44 +7063,44 @@ const CoreBlock = ({
7126
7063
  ];
7127
7064
  a = {
7128
7065
  ...a,
7129
- href: ((f = l.find((S) => S.key === "href")) == null ? void 0 : f.value) || "",
7130
- hrefType: ((m = l.find((S) => S.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
7131
- autoplay: ((h = l.find((S) => S.key === "data-autoplay")) == null ? void 0 : h.value) === "true" ? "true" : "false",
7132
- maxWidth: ((b = (x = l.find((S) => S.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : b.replace("px", "")) || "",
7133
- backdropColor: ((y = l.find((S) => S.key === "data-overlay")) == null ? void 0 : y.value) || "",
7134
- galleryName: ((B = l.find((S) => S.key === "data-gall")) == null ? void 0 : B.value) || ""
7135
- }, forEach(C, (S) => {
7136
- has(a, `styles_attrs.${S}`) && delete a.styles_attrs[S];
7066
+ href: ((f = l.find((_) => _.key === "href")) == null ? void 0 : f.value) || "",
7067
+ hrefType: ((m = l.find((_) => _.key === "data-vbtype")) == null ? void 0 : m.value) || "video",
7068
+ autoplay: ((h = l.find((_) => _.key === "data-autoplay")) == null ? void 0 : h.value) === "true" ? "true" : "false",
7069
+ maxWidth: ((y = (x = l.find((_) => _.key === "data-maxwidth")) == null ? void 0 : x.value) == null ? void 0 : y.replace("px", "")) || "",
7070
+ backdropColor: ((b = l.find((_) => _.key === "data-overlay")) == null ? void 0 : b.value) || "",
7071
+ galleryName: ((A = l.find((_) => _.key === "data-gall")) == null ? void 0 : A.value) || ""
7072
+ }, forEach(w, (_) => {
7073
+ has(a, `styles_attrs.${_}`) && delete a.styles_attrs[_];
7137
7074
  });
7138
7075
  }
7139
7076
  if (d && (delete a.styles_attrs, a.showDropdown = !1), u && delete a.styles_attrs, p) {
7140
7077
  delete a.styles_attrs;
7141
- const C = filter(r.children || [], (A) => (A == null ? void 0 : A.tagName) !== "span");
7142
- a.content = getTextContent(C);
7143
- const S = find(
7078
+ const w = filter(r.children || [], (j) => (j == null ? void 0 : j.tagName) !== "span");
7079
+ a.content = getTextContent(w);
7080
+ const _ = find(
7144
7081
  r.children || [],
7145
- (A) => (A == null ? void 0 : A.tagName) === "span" && some(A.children || [], (_) => (_ == null ? void 0 : _.tagName) === "svg")
7082
+ (j) => (j == null ? void 0 : j.tagName) === "span" && some(j.children || [], (S) => (S == null ? void 0 : S.tagName) === "svg")
7146
7083
  );
7147
- if (S) {
7148
- const A = find(S.children || [], (_) => (_ == null ? void 0 : _.tagName) === "svg");
7149
- if (A) {
7150
- a.icon = stringify([A]);
7151
- const { height: _, width: w } = getSvgDimensions(A, "16px", "16px");
7152
- a.iconHeight = _, a.iconWidth = w;
7084
+ if (_) {
7085
+ const j = find(_.children || [], (S) => (S == null ? void 0 : S.tagName) === "svg");
7086
+ if (j) {
7087
+ a.icon = stringify([j]);
7088
+ const { height: S, width: C } = getSvgDimensions(j, "16px", "16px");
7089
+ a.iconHeight = S, a.iconWidth = C;
7153
7090
  }
7154
7091
  }
7155
7092
  return [a];
7156
7093
  }
7157
7094
  if (a._type === "Input") {
7158
- const C = a.inputType || "text";
7159
- C === "checkbox" ? set(a, "_type", "Checkbox") : C === "radio" && set(a, "_type", "Radio");
7095
+ const w = a.inputType || "text";
7096
+ w === "checkbox" ? set(a, "_type", "Checkbox") : w === "radio" && set(a, "_type", "Radio");
7160
7097
  } else if (r.tagName === "video" || r.tagName === "iframe") {
7161
- const C = stringify([r]);
7162
- return hasVideoEmbed(C) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(C)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = C, [a];
7098
+ const w = stringify([r]);
7099
+ return hasVideoEmbed(w) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(w)), set(a, "styles", `${STYLES_KEY},`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = w, [a];
7163
7100
  } else if (r.tagName === "svg") {
7164
- const C = find(r.attributes, { key: "height" }), S = find(r.attributes, { key: "width" }), A = get(C, "value") ? `[${get(C, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px", w = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
7165
- return a.styles = `${STYLES_KEY}, ${cn$1(`w-${_} h-${A}`, w)}`.trim(), r.attributes = filter(r.attributes, (L) => !includes(["style", "width", "height", "class"], L.key)), a.icon = stringify([r]), [a];
7166
- } else if (r.tagName == "option" && n && ((j = n.block) == null ? void 0 : j._type) === "Select")
7101
+ const w = find(r.attributes, { key: "height" }), _ = find(r.attributes, { key: "width" }), j = get(w, "value") ? `[${get(w, "value")}px]` : "24px", S = get(_, "value") ? `[${get(_, "value")}px]` : "24px", C = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
7102
+ return a.styles = `${STYLES_KEY}, ${cn$1(`w-${S} h-${j}`, C)}`.trim(), r.attributes = filter(r.attributes, (L) => !includes(["style", "width", "height", "class"], L.key)), a.icon = stringify([r]), [a];
7103
+ } else if (r.tagName == "option" && n && ((E = n.block) == null ? void 0 : E._type) === "Select")
7167
7104
  return n.block.options.push({
7168
7105
  label: getTextContent(r.children),
7169
7106
  ...getAttrs(r)
@@ -7236,20 +7173,20 @@ const CoreBlock = ({
7236
7173
  error: c
7237
7174
  }), g(!0);
7238
7175
  else if (!l && Object.keys(a || {}).length > 0) {
7239
- const m = Object.entries(a).map(([x, b]) => {
7240
- const y = b, B = y.type || "partial", j = formatReadableName(B);
7176
+ const m = Object.entries(a).map(([x, y]) => {
7177
+ const b = y, A = b.type || "partial", E = formatReadableName(A);
7241
7178
  return {
7242
7179
  type: "PartialBlock",
7243
7180
  // Set the type to PartialBlock
7244
- label: formatReadableName(y.name || x),
7245
- description: y.description || "",
7181
+ label: formatReadableName(b.name || x),
7182
+ description: b.description || "",
7246
7183
  icon: Globe,
7247
- group: j,
7184
+ group: E,
7248
7185
  // Use formatted type as group
7249
7186
  category: "partial",
7250
7187
  partialBlockId: x,
7251
7188
  // Store the original ID as partialBlockId
7252
- _name: y.name
7189
+ _name: b.name
7253
7190
  };
7254
7191
  }), h = uniq(map(m, "group"));
7255
7192
  p({
@@ -7298,43 +7235,43 @@ const CoreBlock = ({
7298
7235
  );
7299
7236
  }, CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, position: a, gridCols: l = "grid-cols-4" }) => {
7300
7237
  var v;
7301
- const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), f = (v = find(c, (k) => k._id === r)) == null ? void 0 : v._type, [m, h] = useState("all"), [x, b] = useState(null), y = useRef(null);
7238
+ const { t: i } = useTranslation(), [c] = useBlocksStore(), [d, p] = useState(""), u = useRef(null), [g] = useAtom$1(addBlockTabAtom), f = (v = find(c, (k) => k._id === r)) == null ? void 0 : v._type, [m, h] = useState("all"), [x, y] = useState(null), b = useRef(null);
7302
7239
  useEffect(() => {
7303
7240
  const k = setTimeout(() => {
7304
- var E;
7305
- (E = u.current) == null || E.focus();
7241
+ var B;
7242
+ (B = u.current) == null || B.focus();
7306
7243
  }, 0);
7307
7244
  return () => clearTimeout(k);
7308
7245
  }, [g]), useEffect(() => {
7309
- d && (h("all"), b(null));
7310
- }, [d]), useEffect(() => (y.current = debounce((k) => {
7246
+ d && (h("all"), y(null));
7247
+ }, [d]), useEffect(() => (b.current = debounce((k) => {
7311
7248
  h(k);
7312
7249
  }, 500), () => {
7313
- y.current && y.current.cancel();
7250
+ b.current && b.current.cancel();
7314
7251
  }), []);
7315
- const B = useCallback((k) => {
7316
- b(k), y.current && y.current(k);
7317
- }, []), j = useCallback(() => {
7318
- b(null), y.current && y.current.cancel();
7319
- }, []), C = useCallback((k) => {
7320
- y.current && y.current.cancel(), h(k), b(null);
7321
- }, []), S = useMemo(
7252
+ const A = useCallback((k) => {
7253
+ y(k), b.current && b.current(k);
7254
+ }, []), E = useCallback(() => {
7255
+ y(null), b.current && b.current.cancel();
7256
+ }, []), w = useCallback((k) => {
7257
+ b.current && b.current.cancel(), h(k), y(null);
7258
+ }, []), _ = useMemo(
7322
7259
  () => d ? values(n).filter(
7323
7260
  (k) => {
7324
- var E, T;
7325
- return (((E = k.label) == null ? void 0 : E.toLowerCase()) + " " + ((T = k.type) == null ? void 0 : T.toLowerCase())).includes(d.toLowerCase());
7261
+ var B, T;
7262
+ return (((B = k.label) == null ? void 0 : B.toLowerCase()) + " " + ((T = k.type) == null ? void 0 : T.toLowerCase())).includes(d.toLowerCase());
7326
7263
  }
7327
7264
  ) : n,
7328
7265
  [n, d]
7329
- ), A = useMemo(
7266
+ ), j = useMemo(
7330
7267
  () => d ? o.filter(
7331
- (k) => reject(filter(values(S), { group: k }), { hidden: !0 }).length > 0
7268
+ (k) => reject(filter(values(_), { group: k }), { hidden: !0 }).length > 0
7332
7269
  ) : o.filter((k) => reject(filter(values(n), { group: k }), { hidden: !0 }).length > 0),
7333
- [n, S, o, d]
7334
- ), _ = useMemo(
7335
- () => sortBy(A, (k) => CORE_GROUPS.indexOf(k) === -1 ? 99 : CORE_GROUPS.indexOf(k)),
7336
- [A]
7337
- ), w = useMemo(() => m === "all" ? S : filter(values(S), { group: m }), [S, m]), L = useMemo(() => m === "all" ? _ : [m], [_, m]);
7270
+ [n, _, o, d]
7271
+ ), S = useMemo(
7272
+ () => sortBy(j, (k) => CORE_GROUPS.indexOf(k) === -1 ? 99 : CORE_GROUPS.indexOf(k)),
7273
+ [j]
7274
+ ), C = useMemo(() => m === "all" ? _ : filter(values(_), { group: m }), [_, m]), L = useMemo(() => m === "all" ? S : [m], [S, m]);
7338
7275
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full w-full max-w-3xl flex-col", children: [
7339
7276
  /* @__PURE__ */ jsx("div", { className: "sticky top-0 z-10 bg-background/80 px-4 py-2 backdrop-blur-sm", children: /* @__PURE__ */ jsx(
7340
7277
  Input$1,
@@ -7348,31 +7285,31 @@ const CoreBlock = ({
7348
7285
  }
7349
7286
  ) }),
7350
7287
  /* @__PURE__ */ jsxs("div", { className: "sticky top-10 flex h-[calc(100%-48px)] overflow-hidden", children: [
7351
- _.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
7288
+ S.length > 0 && /* @__PURE__ */ jsx("div", { className: "w-1/4 min-w-[120px] border-r", children: /* @__PURE__ */ jsx(ScrollArea, { className: "h-full", children: /* @__PURE__ */ jsxs("div", { className: "space-y-1 p-2", children: [
7352
7289
  /* @__PURE__ */ jsx(
7353
7290
  "button",
7354
7291
  {
7355
- onClick: () => C("all"),
7356
- onMouseEnter: () => B("all"),
7357
- onMouseLeave: j,
7292
+ onClick: () => w("all"),
7293
+ onMouseEnter: () => A("all"),
7294
+ onMouseLeave: E,
7358
7295
  className: `w-full rounded-md px-2 py-1.5 text-left text-sm font-medium ${m === "all" || x === "all" ? "bg-accent text-accent-foreground" : "hover:bg-accent/50 hover:text-accent-foreground"}`,
7359
7296
  children: i("All")
7360
7297
  },
7361
7298
  "sidebar-all"
7362
7299
  ),
7363
- _.map((k) => /* @__PURE__ */ jsx(
7300
+ S.map((k) => /* @__PURE__ */ jsx(
7364
7301
  "button",
7365
7302
  {
7366
- onClick: () => C(k),
7367
- onMouseEnter: () => B(k),
7368
- onMouseLeave: j,
7303
+ onClick: () => w(k),
7304
+ onMouseEnter: () => A(k),
7305
+ onMouseLeave: E,
7369
7306
  className: `w-full rounded-md px-2 py-1.5 text-left text-sm ${m === k || x === k ? "bg-accent text-accent-foreground" : "hover:bg-accent/50 hover:text-accent-foreground"}`,
7370
7307
  children: capitalize(i(k.toLowerCase()))
7371
7308
  },
7372
7309
  `sidebar-${k}`
7373
7310
  ))
7374
7311
  ] }) }) }),
7375
- /* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: A.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
7312
+ /* @__PURE__ */ jsx("div", { className: "h-full w-3/4 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(ScrollArea, { id: "add-blocks-scroll-area", className: "no-scrollbar mr-4 h-full", children: j.length === 0 && d ? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center p-8 text-center text-muted-foreground", children: /* @__PURE__ */ jsxs("p", { children: [
7376
7313
  i("No blocks found matching"),
7377
7314
  ' "',
7378
7315
  d,
@@ -7381,17 +7318,17 @@ const CoreBlock = ({
7381
7318
  /* @__PURE__ */ jsx("h3", { className: "px-1 text-sm font-medium", children: capitalize(i(k.toLowerCase())) }),
7382
7319
  /* @__PURE__ */ jsx("div", { className: "grid gap-2 " + l, children: React__default.Children.toArray(
7383
7320
  reject(
7384
- m === "all" ? filter(values(w), { group: k }) : values(w),
7321
+ m === "all" ? filter(values(C), { group: k }) : values(C),
7385
7322
  { hidden: !0 }
7386
- ).map((E) => /* @__PURE__ */ jsx(
7323
+ ).map((B) => /* @__PURE__ */ jsx(
7387
7324
  CoreBlock,
7388
7325
  {
7389
7326
  parentId: r,
7390
7327
  position: a,
7391
- block: E,
7392
- disabled: !canAcceptChildBlock(f, E.type) || !canBeNestedInside(f, E.type)
7328
+ block: B,
7329
+ disabled: !canAcceptChildBlock(f, B.type) || !canBeNestedInside(f, B.type)
7393
7330
  },
7394
- E.type
7331
+ B.type
7395
7332
  ))
7396
7333
  ) })
7397
7334
  ] }, k)) }) }) })
@@ -7492,18 +7429,18 @@ const BlockCard = ({
7492
7429
  parentId: r = void 0,
7493
7430
  position: a = -1
7494
7431
  }) => {
7495
- const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), f = get(o, "name", get(o, "label")), m = useFeature("dnd"), [, h] = useAtom$1(draggedBlockAtom), x = (B) => {
7496
- const j = has(B, "styles_attrs.data-page-section");
7497
- return B._type === "Box" && j;
7498
- }, b = useCallback(
7499
- async (B) => {
7500
- if (B.stopPropagation(), has(o, "component")) {
7432
+ const [l, i] = useState(!1), c = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), f = get(o, "name", get(o, "label")), m = useFeature("dnd"), [, h] = useAtom$1(draggedBlockAtom), x = (A) => {
7433
+ const E = has(A, "styles_attrs.data-page-section");
7434
+ return A._type === "Box" && E;
7435
+ }, y = useCallback(
7436
+ async (A) => {
7437
+ if (A.stopPropagation(), has(o, "component")) {
7501
7438
  d(o, r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7502
7439
  return;
7503
7440
  }
7504
7441
  i(!0);
7505
- const j = await c(n, o);
7506
- isEmpty(j) || p(syncBlocksWithDefaults(j), r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7442
+ const E = await c(n, o);
7443
+ isEmpty(E) || p(syncBlocksWithDefaults(E), r, a), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7507
7444
  },
7508
7445
  [d, p, o, c, n, r, a]
7509
7446
  );
@@ -7512,21 +7449,21 @@ const BlockCard = ({
7512
7449
  "div",
7513
7450
  {
7514
7451
  onClick: l ? () => {
7515
- } : b,
7452
+ } : y,
7516
7453
  draggable: m ? "true" : "false",
7517
- onDragStart: async (B) => {
7518
- const j = await c(n, o);
7519
- let C = r;
7520
- if (x(first(j)) && (C = null), !isEmpty(j)) {
7521
- const S = { blocks: j, uiLibrary: !0, parent: C };
7522
- if (B.dataTransfer.setData("text/plain", JSON.stringify(S)), o.preview) {
7523
- const A = new Image();
7524
- A.src = o.preview, A.onload = () => {
7525
- B.dataTransfer.setDragImage(A, 0, 0);
7454
+ onDragStart: async (A) => {
7455
+ const E = await c(n, o);
7456
+ let w = r;
7457
+ if (x(first(E)) && (w = null), !isEmpty(E)) {
7458
+ const _ = { blocks: E, uiLibrary: !0, parent: w };
7459
+ if (A.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
7460
+ const j = new Image();
7461
+ j.src = o.preview, j.onload = () => {
7462
+ A.dataTransfer.setDragImage(j, 0, 0);
7526
7463
  };
7527
7464
  } else
7528
- B.dataTransfer.setDragImage(new Image(), 0, 0);
7529
- h(S), setTimeout(() => {
7465
+ A.dataTransfer.setDragImage(new Image(), 0, 0);
7466
+ h(_), setTimeout(() => {
7530
7467
  u([]), g(), pubsub.publish(CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK);
7531
7468
  }, 200);
7532
7469
  }
@@ -7558,9 +7495,9 @@ const BlockCard = ({
7558
7495
  })();
7559
7496
  }, [o, l, i, c, r, a]), { data: l || [], isLoading: i === "loading" };
7560
7497
  }, UILibrarySection = ({ parentId: o, position: n }) => {
7561
- const [r, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((C) => C.category === "custom"), d = l.find((C) => C.uuid === r) || first(l), { data: p, isLoading: u } = useLibraryBlocks(d), g = groupBy([...p, ...c], "group"), [f, m] = useState("Hero"), h = get(g, f, []), x = useRef(null), { t: b } = useTranslation(), y = (C) => {
7498
+ const [r, a] = useAtom$1(selectedLibraryAtom), l = useBuilderProp("uiLibraries", []), i = useRegisteredChaiBlocks(), c = values(i).filter((w) => w.category === "custom"), d = l.find((w) => w.uuid === r) || first(l), { data: p, isLoading: u } = useLibraryBlocks(d), g = groupBy([...p, ...c], "group"), [f, m] = useState("Hero"), h = get(g, f, []), x = useRef(null), { t: y } = useTranslation(), b = (w) => {
7562
7499
  x.current && (clearTimeout(x.current), x.current = null), x.current = setTimeout(() => {
7563
- x.current && m(C);
7500
+ x.current && m(w);
7564
7501
  }, 300);
7565
7502
  };
7566
7503
  if (u)
@@ -7568,30 +7505,30 @@ const BlockCard = ({
7568
7505
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-3 h-full" }),
7569
7506
  /* @__PURE__ */ jsx(Skeleton, { className: "col-span-9 h-full" })
7570
7507
  ] });
7571
- const B = filter(h, (C, S) => S % 2 === 0), j = filter(h, (C, S) => S % 2 === 1);
7508
+ const A = filter(h, (w, _) => _ % 2 === 0), E = filter(h, (w, _) => _ % 2 === 1);
7572
7509
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxs("div", { className: "flex h-full pt-2", children: [
7573
7510
  /* @__PURE__ */ jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7574
7511
  /* @__PURE__ */ jsx(UILibrariesSelect, { library: d == null ? void 0 : d.uuid, setLibrary: a, uiLibraries: l }),
7575
7512
  /* @__PURE__ */ jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
7576
- /* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-gray-500", children: b("Groups") }),
7513
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-gray-500", children: y("Groups") }),
7577
7514
  /* @__PURE__ */ jsx("hr", { className: "mt-1 border-border" }),
7578
7515
  /* @__PURE__ */ jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
7579
- map(g, (C, S) => /* @__PURE__ */ jsxs(
7516
+ map(g, (w, _) => /* @__PURE__ */ jsxs(
7580
7517
  "div",
7581
7518
  {
7582
- onMouseEnter: () => y(S),
7519
+ onMouseEnter: () => b(_),
7583
7520
  onMouseLeave: () => clearTimeout(x.current),
7584
- onClick: () => m(S),
7521
+ onClick: () => m(_),
7585
7522
  className: cn$1(
7586
7523
  "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",
7587
- S === f ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7524
+ _ === f ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7588
7525
  ),
7589
7526
  children: [
7590
- /* @__PURE__ */ jsx("span", { children: capitalize(b(S.toLowerCase())) }),
7527
+ /* @__PURE__ */ jsx("span", { children: capitalize(y(_.toLowerCase())) }),
7591
7528
  /* @__PURE__ */ jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7592
7529
  ]
7593
7530
  },
7594
- S
7531
+ _
7595
7532
  ))
7596
7533
  ) })
7597
7534
  ] })
@@ -7604,10 +7541,10 @@ const BlockCard = ({
7604
7541
  children: [
7605
7542
  /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7606
7543
  /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7607
- B.map((C) => /* @__PURE__ */ jsx(BlockCard, { parentId: o, position: n, block: C, library: d }))
7544
+ A.map((w) => /* @__PURE__ */ jsx(BlockCard, { parentId: o, position: n, block: w, library: d }))
7608
7545
  ) }),
7609
7546
  /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7610
- j.map((C) => /* @__PURE__ */ jsx(BlockCard, { parentId: o, position: n, block: C, library: d }))
7547
+ E.map((w) => /* @__PURE__ */ jsx(BlockCard, { parentId: o, position: n, block: w, library: d }))
7611
7548
  ) })
7612
7549
  ] }),
7613
7550
  /* @__PURE__ */ jsx("br", {}),
@@ -7617,26 +7554,7 @@ const BlockCard = ({
7617
7554
  }
7618
7555
  )
7619
7556
  ] }) }) });
7620
- }, UILibrariesPanel = ({ parentId: o, position: n }) => /* @__PURE__ */ jsx(UILibrarySection, { parentId: o, position: n });
7621
- function BiCollapseVertical(o) {
7622
- return GenIcon({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 7.59 7.05 2.64 5.64 4.05 12 10.41l6.36-6.36-1.41-1.41L12 7.59zM5.64 19.95l1.41 1.41L12 16.41l4.95 4.95 1.41-1.41L12 13.59l-6.36 6.36z" }, child: [] }] })(o);
7623
- }
7624
- function BiExpandVertical(o) {
7625
- return GenIcon({ tag: "svg", attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "m12 19.24-4.95-4.95-1.41 1.42L12 22.07l6.36-6.36-1.41-1.42L12 19.24zM5.64 8.29l1.41 1.42L12 4.76l4.95 4.95 1.41-1.42L12 1.93 5.64 8.29z" }, child: [] }] })(o);
7626
- }
7627
- function BsLightningFill(o) {
7628
- return GenIcon({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M5.52.359A.5.5 0 0 1 6 0h4a.5.5 0 0 1 .474.658L8.694 6H12.5a.5.5 0 0 1 .395.807l-7 9a.5.5 0 0 1-.873-.454L6.823 9.5H3.5a.5.5 0 0 1-.48-.641z" }, child: [] }] })(o);
7629
- }
7630
- function BsThreeDotsVertical(o) {
7631
- return GenIcon({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" }, child: [] }] })(o);
7632
- }
7633
- function TbEyeDown(o) {
7634
- return GenIcon({ tag: "svg", attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" }, child: [] }, { tag: "path", attr: { d: "M12 18c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6" }, child: [] }, { tag: "path", attr: { d: "M19 16v6" }, child: [] }, { tag: "path", attr: { d: "M22 19l-3 3l-3 -3" }, child: [] }] })(o);
7635
- }
7636
- function VscJson(o) {
7637
- return GenIcon({ tag: "svg", attr: { viewBox: "0 0 16 16", fill: "currentColor" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M6 2.984V2h-.09c-.313 0-.616.062-.909.185a2.33 2.33 0 0 0-.775.53 2.23 2.23 0 0 0-.493.753v.001a3.542 3.542 0 0 0-.198.83v.002a6.08 6.08 0 0 0-.024.863c.012.29.018.58.018.869 0 .203-.04.393-.117.572v.001a1.504 1.504 0 0 1-.765.787 1.376 1.376 0 0 1-.558.115H2v.984h.09c.195 0 .38.04.556.121l.001.001c.178.078.329.184.455.318l.002.002c.13.13.233.285.307.465l.001.002c.078.18.117.368.117.566 0 .29-.006.58-.018.869-.012.296-.004.585.024.87v.001c.033.283.099.558.197.824v.001c.106.273.271.524.494.753.223.23.482.407.775.53.293.123.596.185.91.185H6v-.984h-.09c-.2 0-.387-.038-.563-.115a1.613 1.613 0 0 1-.457-.32 1.659 1.659 0 0 1-.309-.467c-.074-.18-.11-.37-.11-.573 0-.228.003-.453.011-.672.008-.228.008-.45 0-.665a4.639 4.639 0 0 0-.055-.64 2.682 2.682 0 0 0-.168-.609A2.284 2.284 0 0 0 3.522 8a2.284 2.284 0 0 0 .738-.955c.08-.192.135-.393.168-.602.033-.21.051-.423.055-.64.008-.22.008-.442 0-.666-.008-.224-.012-.45-.012-.678a1.47 1.47 0 0 1 .877-1.354 1.33 1.33 0 0 1 .563-.121H6zm4 10.032V14h.09c.313 0 .616-.062.909-.185.293-.123.552-.3.775-.53.223-.23.388-.48.493-.753v-.001c.1-.266.165-.543.198-.83v-.002c.028-.28.036-.567.024-.863-.012-.29-.018-.58-.018-.869 0-.203.04-.393.117-.572v-.001a1.502 1.502 0 0 1 .765-.787 1.38 1.38 0 0 1 .558-.115H14v-.984h-.09c-.196 0-.381-.04-.557-.121l-.001-.001a1.376 1.376 0 0 1-.455-.318l-.002-.002a1.415 1.415 0 0 1-.307-.465v-.002a1.405 1.405 0 0 1-.118-.566c0-.29.006-.58.018-.869a6.174 6.174 0 0 0-.024-.87v-.001a3.537 3.537 0 0 0-.197-.824v-.001a2.23 2.23 0 0 0-.494-.753 2.331 2.331 0 0 0-.775-.53 2.325 2.325 0 0 0-.91-.185H10v.984h.09c.2 0 .387.038.562.115.174.082.326.188.457.32.127.134.23.29.309.467.074.18.11.37.11.573 0 .228-.003.452-.011.672-.008.228-.008.45 0 .665.004.222.022.435.055.64.033.214.089.416.168.609a2.285 2.285 0 0 0 .738.955 2.285 2.285 0 0 0-.738.955 2.689 2.689 0 0 0-.168.602c-.033.21-.051.423-.055.64a9.15 9.15 0 0 0 0 .666c.008.224.012.45.012.678a1.471 1.471 0 0 1-.877 1.354 1.33 1.33 0 0 1-.563.121H10z" }, child: [] }] })(o);
7638
- }
7639
- const PasteAtRootContextMenu = ({ parentContext: o, setParentContext: n }) => {
7557
+ }, UILibrariesPanel = ({ parentId: o, position: n }) => /* @__PURE__ */ jsx(UILibrarySection, { parentId: o, position: n }), PasteAtRootContextMenu = ({ parentContext: o, setParentContext: n }) => {
7640
7558
  const { t: r } = useTranslation(), { canPaste: a, pasteBlocks: l } = usePasteBlocks();
7641
7559
  return useEffect(() => {
7642
7560
  a("root") || n(null);
@@ -7853,42 +7771,42 @@ const selectParent = (o, n) => {
7853
7771
  const r = o.selectedNodes[0];
7854
7772
  r.isInternal && n && r.close();
7855
7773
  }, currentAddSelection = atom$1(null), Node = memo(({ node: o, style: n, dragHandle: r }) => {
7856
- var R;
7774
+ var P;
7857
7775
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
7858
7776
  let p = null;
7859
- const u = o.children.length > 0, { highlightBlock: g, clearHighlight: f } = useBlockHighlight(), { id: m, data: h, isSelected: x, willReceiveDrop: b, isDragging: y, isEditing: B, handleClick: j } = o, C = (N) => {
7777
+ const u = o.children.length > 0, { highlightBlock: g, clearHighlight: f } = useBlockHighlight(), { id: m, data: h, isSelected: x, willReceiveDrop: y, isDragging: b, isEditing: A, handleClick: E } = o, w = (N) => {
7860
7778
  N.stopPropagation(), !i.includes(m) && o.toggle();
7861
- }, S = (N) => {
7779
+ }, _ = (N) => {
7862
7780
  N.isInternal && (p = N.isOpen, N.isOpen && N.close());
7863
- }, A = (N) => {
7781
+ }, j = (N) => {
7864
7782
  N.isInternal && p !== null && (p ? N.open() : N.close(), p = null);
7865
- }, [_, w] = useAtom$1(currentAddSelection), L = () => {
7783
+ }, [S, C] = useAtom$1(currentAddSelection), L = () => {
7866
7784
  var N;
7867
- v(), o.parent.isSelected || w((N = o == null ? void 0 : o.parent) == null ? void 0 : N.id);
7785
+ v(), o.parent.isSelected || C((N = o == null ? void 0 : o.parent) == null ? void 0 : N.id);
7868
7786
  }, v = () => {
7869
- w(null);
7787
+ C(null);
7870
7788
  }, k = (N) => {
7871
- v(), N.stopPropagation(), !o.isOpen && !i.includes(m) && o.toggle(), j(N);
7789
+ v(), N.stopPropagation(), !o.isOpen && !i.includes(m) && o.toggle(), E(N);
7872
7790
  };
7873
7791
  useEffect(() => {
7874
7792
  const N = setTimeout(() => {
7875
- b && !o.isOpen && !y && !i.includes(m) && o.toggle();
7793
+ y && !o.isOpen && !b && !i.includes(m) && o.toggle();
7876
7794
  }, 500);
7877
7795
  return () => clearTimeout(N);
7878
- }, [b, o, y]);
7879
- const E = useMemo(() => {
7796
+ }, [y, o, b]);
7797
+ const B = useMemo(() => {
7880
7798
  const N = Object.keys(h), D = [];
7881
- for (let M = 0; M < N.length; M++)
7882
- if (N[M].endsWith("_attrs")) {
7883
- const P = h[N[M]], O = Object.keys(P).join("|");
7799
+ for (let $ = 0; $ < N.length; $++)
7800
+ if (N[$].endsWith("_attrs")) {
7801
+ const R = h[N[$]], O = Object.keys(R).join("|");
7884
7802
  O.match(/x-data/) && D.push("data"), O.match(/x-on/) && D.push("event"), O.match(/x-show|x-if/) && D.push("show");
7885
7803
  }
7886
7804
  return D;
7887
7805
  }, [h]), T = (N, D) => {
7888
- const M = d.contentDocument || d.contentWindow.document, P = M.querySelector(`[data-block-id=${N}]`);
7889
- P && P.setAttribute("data-drop", D);
7890
- const O = P.getBoundingClientRect(), $ = d.getBoundingClientRect();
7891
- O.top >= $.top && O.left >= $.left && O.bottom <= $.bottom && O.right <= $.right || (M.documentElement.scrollTop = P.offsetTop - $.top);
7806
+ const $ = d.contentDocument || d.contentWindow.document, R = $.querySelector(`[data-block-id=${N}]`);
7807
+ R && R.setAttribute("data-drop", D);
7808
+ const O = R.getBoundingClientRect(), M = d.getBoundingClientRect();
7809
+ O.top >= M.top && O.left >= M.left && O.bottom <= M.bottom && O.right <= M.right || ($.documentElement.scrollTop = R.offsetTop - M.top);
7892
7810
  }, I = (N) => {
7893
7811
  v();
7894
7812
  const D = get(o, "parent.id");
@@ -7918,8 +7836,8 @@ const selectParent = (o, n) => {
7918
7836
  style: n,
7919
7837
  "data-node-id": m,
7920
7838
  ref: i.includes(m) ? null : r,
7921
- onDragStart: () => S(o),
7922
- onDragEnd: () => A(o),
7839
+ onDragStart: () => _(o),
7840
+ onDragEnd: () => j(o),
7923
7841
  onDragOver: (N) => {
7924
7842
  N.preventDefault(), T(m, "yes");
7925
7843
  },
@@ -7930,7 +7848,7 @@ const selectParent = (o, n) => {
7930
7848
  N.preventDefault(), T(m, "no");
7931
7849
  },
7932
7850
  children: [
7933
- (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((R = o == null ? void 0 : o.parent) == null ? void 0 : R.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
7851
+ (o == null ? void 0 : o.rowIndex) > 0 && (o.parent.isOpen && canAddChildBlock(get(o, "parent.data._type")) || ((P = o == null ? void 0 : o.parent) == null ? void 0 : P.id) === "__REACT_ARBORIST_INTERNAL_ROOT__") && /* @__PURE__ */ jsx("div", { className: "group relative ml-5 h-full w-full cursor-pointer", children: /* @__PURE__ */ jsx(
7934
7852
  "div",
7935
7853
  {
7936
7854
  onClick: (N) => {
@@ -7948,9 +7866,9 @@ const selectParent = (o, n) => {
7948
7866
  className: cn$1(
7949
7867
  "group flex w-full cursor-pointer items-center justify-between space-x-px !rounded p-1 text-foreground/80 outline-none",
7950
7868
  x ? "bg-blue-500 text-white" : "hover:bg-slate-200 dark:hover:bg-gray-800",
7951
- b && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
7952
- (o == null ? void 0 : o.id) === _ ? "bg-purple-100" : "",
7953
- y && "opacity-20",
7869
+ y && canAcceptChildBlock(h._type, "Icon") ? "bg-green-200" : "",
7870
+ (o == null ? void 0 : o.id) === S ? "bg-purple-100" : "",
7871
+ b && "opacity-20",
7954
7872
  i.includes(m) ? "opacity-50" : ""
7955
7873
  ),
7956
7874
  children: [
@@ -7959,12 +7877,12 @@ const selectParent = (o, n) => {
7959
7877
  "div",
7960
7878
  {
7961
7879
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
7962
- children: u && /* @__PURE__ */ jsx("button", { onClick: C, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-slate-200" : "text-slate-400"}` }) })
7880
+ children: u && /* @__PURE__ */ jsx("button", { onClick: w, type: "button", children: /* @__PURE__ */ jsx(ChevronRight, { className: `h-3 w-3 stroke-[3] ${x ? "text-slate-200" : "text-slate-400"}` }) })
7963
7881
  }
7964
7882
  ),
7965
7883
  /* @__PURE__ */ jsxs("div", { className: "leading-1 flex items-center", children: [
7966
7884
  /* @__PURE__ */ jsx(TypeIcon, { type: h == null ? void 0 : h._type }),
7967
- B ? /* @__PURE__ */ jsx(Input, { node: o }) : /* @__PURE__ */ jsxs(
7885
+ A ? /* @__PURE__ */ jsx(Input, { node: o }) : /* @__PURE__ */ jsxs(
7968
7886
  "div",
7969
7887
  {
7970
7888
  className: "ml-1.5 flex items-center gap-x-1 truncate text-[13px]",
@@ -7973,9 +7891,9 @@ const selectParent = (o, n) => {
7973
7891
  },
7974
7892
  children: [
7975
7893
  /* @__PURE__ */ jsx("span", { children: (h == null ? void 0 : h._name) || (h == null ? void 0 : h._type.split("/").pop()) }),
7976
- E.includes("data") && /* @__PURE__ */ jsx(VscJson, { className: "h-3 w-3 text-orange-600" }),
7977
- E.includes("event") && /* @__PURE__ */ jsx(BsLightningFill, { className: "h-3 w-3 text-yellow-500" }),
7978
- E.includes("show") && /* @__PURE__ */ jsx(TbEyeDown, { className: "h-3 w-3 text-orange-600" })
7894
+ B.includes("data") && /* @__PURE__ */ jsx(FileJson, { className: "h-3 w-3 text-orange-600" }),
7895
+ B.includes("event") && /* @__PURE__ */ jsx(Zap, { className: "h-3 w-3 text-yellow-500" }),
7896
+ B.includes("show") && /* @__PURE__ */ jsx(EyeOff, { className: "h-3 w-3 text-orange-600" })
7979
7897
  ]
7980
7898
  }
7981
7899
  )
@@ -8019,7 +7937,7 @@ const selectParent = (o, n) => {
8019
7937
  ),
8020
7938
  /* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", side: "left", children: l("Hide block") })
8021
7939
  ] }),
8022
- /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: m, children: /* @__PURE__ */ jsx(BsThreeDotsVertical, { size: "15" }) })
7940
+ /* @__PURE__ */ jsx(BlockMoreOptions, { node: o, id: m, children: /* @__PURE__ */ jsx(MoreVertical, { size: "15" }) })
8023
7941
  ] })
8024
7942
  ]
8025
7943
  }
@@ -8159,14 +8077,14 @@ const selectParent = (o, n) => {
8159
8077
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "h-fit p-1", onClick: () => {
8160
8078
  var o;
8161
8079
  return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.openAll();
8162
- }, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(BiExpandVertical, { size: "14" }) }) }),
8080
+ }, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(ChevronsDown, { size: 14 }) }) }),
8163
8081
  /* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Expand all") })
8164
8082
  ] }),
8165
8083
  /* @__PURE__ */ jsxs(Tooltip, { children: [
8166
8084
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(Button, { className: "h-fit p-1", onClick: () => {
8167
8085
  var o;
8168
8086
  return (o = treeRef == null ? void 0 : treeRef.current) == null ? void 0 : o.closeAll();
8169
- }, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(BiCollapseVertical, { size: "14" }) }) }),
8087
+ }, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx(ChevronsUp, { size: 14 }) }) }),
8170
8088
  /* @__PURE__ */ jsx(TooltipContent, { className: "isolate z-[9999]", children: t("Collapse all") })
8171
8089
  ] })
8172
8090
  ] }),
@@ -8589,18 +8507,15 @@ i18n.use(initReactI18next).init({
8589
8507
  // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
8590
8508
  }
8591
8509
  });
8592
- function FaFilePen(o) {
8593
- return GenIcon({ tag: "svg", attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 125.7-86.8 86.8c-10.3 10.3-17.5 23.1-21 37.2l-18.7 74.9c-2.3 9.2-1.8 18.8 1.3 27.5L64 512c-35.3 0-64-28.7-64-64L0 64zm384 64l-128 0L256 0 384 128zM549.8 235.7l14.4 14.4c15.6 15.6 15.6 40.9 0 56.6l-29.4 29.4-71-71 29.4-29.4c15.6-15.6 40.9-15.6 56.6 0zM311.9 417L441.1 287.8l71 71L382.9 487.9c-4.1 4.1-9.2 7-14.9 8.4l-60.1 15c-5.5 1.4-11.2-.2-15.2-4.2s-5.6-9.7-4.2-15.2l15-60.1c1.4-5.6 4.3-10.8 8.4-14.9z" }, child: [] }] })(o);
8594
- }
8595
8510
  const QUICK_PROMPTS = [
8596
8511
  {
8597
8512
  name: "Improve writing",
8598
- icon: FaFilePen,
8513
+ icon: FileEdit,
8599
8514
  prompt: "Improving writing in all text elements. Replacing placeholder content with meaningful relevant content."
8600
8515
  },
8601
8516
  {
8602
8517
  name: "Replace placeholder content",
8603
- icon: FaRecycle,
8518
+ icon: Recycle,
8604
8519
  prompt: "Discard current placeholder content and replace with meaningful relevant content."
8605
8520
  },
8606
8521
  //TODO: Add tone options
@@ -8640,7 +8555,7 @@ function QuickPrompts({ onClick: o }) {
8640
8555
  const { loading: n } = useAskAi(), { t: r } = useTranslation(), { selectedLang: a, fallbackLang: l } = useLanguages(), i = [...QUICK_PROMPTS];
8641
8556
  return a && a !== l && i.splice(0, 0, {
8642
8557
  name: `Translate to ${get(LANGUAGES, a, a)}`,
8643
- icon: FaLanguage,
8558
+ icon: Languages,
8644
8559
  prompt: `Translate the content to ${get(LANGUAGES, a, a)}. Maintain same tone, style and length.`
8645
8560
  }), /* @__PURE__ */ jsx("div", { className: n ? "pointer-events-none opacity-50" : "", children: /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: i.map(
8646
8561
  ({ name: c, icon: d, subMenus: p, prompt: u }) => p ? /* @__PURE__ */ jsxs(Popover, { children: [
@@ -8677,8 +8592,8 @@ const AIUserPrompt = ({ blockId: o }) => {
8677
8592
  (x = f.current) == null || x.focus();
8678
8593
  }, []);
8679
8594
  const h = (x) => {
8680
- const { usage: b } = x || {};
8681
- !l && b && g(b), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
8595
+ const { usage: y } = x || {};
8596
+ !l && y && g(y), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
8682
8597
  };
8683
8598
  return /* @__PURE__ */ jsxs("div", { className: "", children: [
8684
8599
  /* @__PURE__ */ jsxs(
@@ -8726,7 +8641,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8726
8641
  ),
8727
8642
  a ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
8728
8643
  /* @__PURE__ */ jsxs(Skeleton, { className: "flex w-full items-center space-x-1 px-4 py-1 pl-2", children: [
8729
- /* @__PURE__ */ jsx(FaSpinner, { className: "h-4 w-4 animate-spin text-gray-500" }),
8644
+ /* @__PURE__ */ jsx(Loader, { className: "h-4 w-4 animate-spin text-gray-500" }),
8730
8645
  /* @__PURE__ */ jsx("p", { className: "text-xs", children: n("Generating... Please wait...") })
8731
8646
  ] }),
8732
8647
  /* @__PURE__ */ jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
@@ -8874,7 +8789,7 @@ function DarkMode() {
8874
8789
  )
8875
8790
  }
8876
8791
  ),
8877
- /* @__PURE__ */ jsx(FaMoon, { className: "size-4 ml-3 shrink-0" })
8792
+ /* @__PURE__ */ jsx(Moon, { className: "ml-3 size-4 shrink-0", size: 16 })
8878
8793
  ] });
8879
8794
  }
8880
8795
  const UndoRedo = () => {
@@ -8984,8 +8899,11 @@ const AiAssistant = () => {
8984
8899
  /* @__PURE__ */ jsx(AiAssistant, {})
8985
8900
  ] })
8986
8901
  ] });
8987
- }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
8988
- const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [f, m] = useState(""), h = useRef(null), x = useRef(null);
8902
+ }, AttrsEditor = React__default.memo(function o({
8903
+ preloadedAttributes: n = [],
8904
+ onAttributesChange: r
8905
+ }) {
8906
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, g] = useState(null), [f, m] = useState(""), h = useRef(null), x = useRef(null), y = usePageExternalData();
8989
8907
  useEffect(() => {
8990
8908
  l(n);
8991
8909
  }, [n]);
@@ -8998,12 +8916,12 @@ const AiAssistant = () => {
8998
8916
  const S = [...a, { key: i, value: d }];
8999
8917
  r(S), l(a), c(""), p(""), m("");
9000
8918
  }
9001
- }, y = (S) => {
9002
- const A = a.filter((_, w) => w !== S);
9003
- r(A), l(A);
9004
- }, B = (S) => {
8919
+ }, A = (S) => {
8920
+ const C = a.filter((L, v) => v !== S);
8921
+ r(C), l(C);
8922
+ }, E = (S) => {
9005
8923
  g(S), c(a[S].key), p(a[S].value);
9006
- }, j = () => {
8924
+ }, w = () => {
9007
8925
  if (i.startsWith("@")) {
9008
8926
  m("Attribute keys cannot start with '@'");
9009
8927
  return;
@@ -9012,13 +8930,35 @@ const AiAssistant = () => {
9012
8930
  const S = [...a];
9013
8931
  S[u] = { key: i, value: d }, r(S), l(S), g(null), c(""), p(""), m("");
9014
8932
  }
9015
- };
8933
+ }, _ = (S) => {
8934
+ S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? w() : b());
8935
+ }, j = useCallback((S) => {
8936
+ const C = (k) => /[.,!?;:]/.test(k), L = (k, B, T) => {
8937
+ let I = "", P = "";
8938
+ const N = B > 0 ? k[B - 1] : "", D = B < k.length ? k[B] : "";
8939
+ return B > 0 && (N === "." || !C(N) && N !== " ") && (I = " "), B < k.length && !C(D) && D !== " " && (P = " "), {
8940
+ text: I + T + P,
8941
+ prefixLength: I.length,
8942
+ suffixLength: P.length
8943
+ };
8944
+ }, v = x.current;
8945
+ if (v) {
8946
+ const k = v.selectionStart || 0, B = v.value || "", T = v.selectionEnd || k;
8947
+ if (T > k) {
8948
+ const $ = `{{${S}}}`, { text: R } = L(B, k, $), O = B.slice(0, k) + R + B.slice(T);
8949
+ p(O);
8950
+ return;
8951
+ }
8952
+ const P = `{{${S}}}`, { text: N } = L(B, k, P), D = B.slice(0, k) + N + B.slice(k);
8953
+ p(D);
8954
+ }
8955
+ }, []);
9016
8956
  return /* @__PURE__ */ jsxs("div", { className: "flex max-h-full flex-1 flex-col", children: [
9017
8957
  /* @__PURE__ */ jsxs(
9018
8958
  "form",
9019
8959
  {
9020
8960
  onSubmit: (S) => {
9021
- S.preventDefault(), u !== null ? j() : b();
8961
+ S.preventDefault(), u !== null ? w() : b();
9022
8962
  },
9023
8963
  className: "space-y-3",
9024
8964
  children: [
@@ -9041,7 +8981,10 @@ const AiAssistant = () => {
9041
8981
  )
9042
8982
  ] }),
9043
8983
  /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
9044
- /* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
8984
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
8985
+ /* @__PURE__ */ jsx(Label, { htmlFor: "attrValue", className: "text-[11px] font-normal text-slate-600", children: "Value" }),
8986
+ !isEmpty(y) && /* @__PURE__ */ jsx(NestedPathSelector, { data: y, onSelect: j })
8987
+ ] }),
9045
8988
  /* @__PURE__ */ jsx(
9046
8989
  Textarea,
9047
8990
  {
@@ -9053,9 +8996,7 @@ const AiAssistant = () => {
9053
8996
  ref: x,
9054
8997
  value: d,
9055
8998
  onChange: (S) => p(S.target.value),
9056
- onKeyDown: (S) => {
9057
- S.key === "Enter" && !S.shiftKey && (S.preventDefault(), u !== null ? j() : b());
9058
- },
8999
+ onKeyDown: _,
9059
9000
  placeholder: "Enter Value",
9060
9001
  className: "text-xs font-normal leading-tight placeholder:text-slate-400"
9061
9002
  }
@@ -9067,16 +9008,16 @@ const AiAssistant = () => {
9067
9008
  ]
9068
9009
  }
9069
9010
  ),
9070
- /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((S, A) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
9011
+ /* @__PURE__ */ jsx("div", { className: "space-y-1 py-4", children: a.map((S, C) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between rounded border p-2 text-sm", children: [
9071
9012
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col text-xs leading-tight", children: [
9072
9013
  /* @__PURE__ */ jsx("span", { className: "truncate text-[12px] font-light text-muted-foreground", children: S.key }),
9073
- /* @__PURE__ */ jsx("span", { className: "text-wrap max-w-[200px] font-normal", children: S.value.toString() })
9014
+ /* @__PURE__ */ jsx("span", { className: "max-w-[200px] text-wrap font-normal", children: S.value.toString() })
9074
9015
  ] }),
9075
9016
  /* @__PURE__ */ jsxs("div", { className: "flex-shrink-0 text-slate-400", children: [
9076
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => B(A), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
9077
- /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => y(A), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
9017
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => E(C), children: /* @__PURE__ */ jsx(Edit2, { className: "h-3 w-3" }) }),
9018
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(C), children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" }) })
9078
9019
  ] })
9079
- ] }, A)) })
9020
+ ] }, C)) })
9080
9021
  ] });
9081
9022
  }), BlockAttributesEditor = React.memo(() => {
9082
9023
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -9285,21 +9226,21 @@ const RootLayout = () => {
9285
9226
  /* @__PURE__ */ jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(TopBar, {}) }) }),
9286
9227
  /* @__PURE__ */ jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
9287
9228
  /* @__PURE__ */ jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
9288
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m.map((x, b) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9229
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: m.map((x, y) => /* @__PURE__ */ jsxs(Tooltip, { children: [
9289
9230
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsx(
9290
9231
  Button,
9291
9232
  {
9292
- variant: o === b ? "default" : "ghost",
9233
+ variant: o === y ? "default" : "ghost",
9293
9234
  className: "mb-2 rounded-lg p-2 transition-colors",
9294
- onClick: () => u(b),
9235
+ onClick: () => u(y),
9295
9236
  children: get(x, "icon", null)
9296
9237
  },
9297
- b
9238
+ y
9298
9239
  ) }),
9299
9240
  /* @__PURE__ */ jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsx("p", { children: f(x.label) }) })
9300
- ] }, "button" + b)) }),
9241
+ ] }, "button" + y)) }),
9301
9242
  /* @__PURE__ */ jsx("div", { className: "flex flex-col space-y-1" }),
9302
- /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: d == null ? void 0 : d.map((x, b) => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", {}), children: React__default.createElement(x, {}) }, `sidebar-component-${b}`)) })
9243
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col", children: d == null ? void 0 : d.map((x, y) => /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", {}), children: React__default.createElement(x, {}) }, `sidebar-component-${y}`)) })
9303
9244
  ] }),
9304
9245
  /* @__PURE__ */ jsx(
9305
9246
  motion.div,
@@ -9464,9 +9405,9 @@ export {
9464
9405
  generateUUID as generateBlockId,
9465
9406
  getBlocksFromHTML,
9466
9407
  getClassValueAndUnit,
9467
- We as i18n,
9408
+ ze as i18n,
9468
9409
  cn$1 as mergeClasses,
9469
- Fe as registerChaiBlock,
9410
+ Ue as registerChaiBlock,
9470
9411
  useAddBlock,
9471
9412
  useAddClassesToBlocks,
9472
9413
  useAskAi,
@@ -9509,7 +9450,7 @@ export {
9509
9450
  useStylingState,
9510
9451
  useTheme,
9511
9452
  useThemeOptions,
9512
- Ve as useTranslation,
9453
+ He as useTranslation,
9513
9454
  useUILibraryBlocks,
9514
9455
  useUndoManager,
9515
9456
  useUpdateBlocksProps,