@chaibuilder/sdk 1.2.116 → 1.3.0-beta.1

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.
@@ -149,16 +149,16 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
149
149
  }), c(k, S, A);
150
150
  }
151
151
  return c(k, B, A);
152
- }, u = (k, B, A) => {
152
+ }, p = (k, B, A) => {
153
153
  const E = a(k), _ = {
154
154
  d: (E == null ? void 0 : E.d) || /* @__PURE__ */ new Map(),
155
155
  e: B
156
156
  };
157
157
  return A && i(k, _, A), E && isEqualAtomError(E, _) && E.d === _.d ? E : (l(k, _), _);
158
- }, p = (k) => {
158
+ }, u = (k) => {
159
159
  const B = a(k);
160
160
  if (B && (B.d.forEach((D, M) => {
161
- M !== k && !n.has(M) && p(M);
161
+ M !== k && !n.has(M) && u(M);
162
162
  }), Array.from(B.d).every(([D, M]) => {
163
163
  const P = a(D);
164
164
  return D === k || P === M || // TODO This is a hack, we should find a better solution.
@@ -176,7 +176,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
176
176
  return A.set(D, void 0), D.init;
177
177
  throw new Error("no atom init");
178
178
  }
179
- const M = p(D);
179
+ const M = u(D);
180
180
  return A.set(D, M), returnAtomValue(M);
181
181
  };
182
182
  let S, N;
@@ -200,11 +200,11 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
200
200
  () => S == null ? void 0 : S.abort()
201
201
  );
202
202
  } catch (D) {
203
- return u(k, D, A);
203
+ return p(k, D, A);
204
204
  } finally {
205
205
  E = !1;
206
206
  }
207
- }, x = (k) => returnAtomValue(p(k)), m = (k) => {
207
+ }, x = (k) => returnAtomValue(u(k)), m = (k) => {
208
208
  let B = n.get(k);
209
209
  return B || (B = C(k)), B;
210
210
  }, g = (k, B) => !B.l.size && (!B.t.size || B.t.size === 1 && B.t.has(k)), b = (k) => {
@@ -230,7 +230,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
230
230
  if (M && A.set(L, --M), !M) {
231
231
  let P = !!((D = B.get(L)) != null && D.size);
232
232
  if (P) {
233
- const $ = a(L), H = p(L);
233
+ const $ = a(L), H = u(L);
234
234
  P = !$ || !isEqualAtomValue($, H);
235
235
  }
236
236
  P || B.forEach(($) => $.delete(L));
@@ -242,7 +242,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
242
242
  _(k);
243
243
  }, f = (k, ...B) => {
244
244
  let A = !0;
245
- const E = (N) => returnAtomValue(p(N)), _ = (N, ...L) => {
245
+ const E = (N) => returnAtomValue(u(N)), _ = (N, ...L) => {
246
246
  let D;
247
247
  if (N === k) {
248
248
  if (!hasInitialValue(N))
@@ -262,10 +262,10 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
262
262
  t: new Set(B && [B]),
263
263
  l: /* @__PURE__ */ new Set()
264
264
  };
265
- if (n.set(k, A), p(k).d.forEach((E, _) => {
265
+ if (n.set(k, A), u(k).d.forEach((E, _) => {
266
266
  const S = n.get(_);
267
267
  S ? S.t.add(k) : _ !== k && C(_, k);
268
- }), p(k), isActuallyWritableAtom(k) && k.onMount) {
268
+ }), u(k), isActuallyWritableAtom(k) && k.onMount) {
269
269
  const E = k.onMount((..._) => v(k, ..._));
270
270
  E && (A.u = E);
271
271
  }
@@ -331,14 +331,14 @@ function splitAtom(o, n) {
331
331
  return memo2$1(
332
332
  () => {
333
333
  const r = /* @__PURE__ */ new WeakMap(), a = (c, d) => {
334
- let u = r.get(c);
335
- if (u)
336
- return u;
337
- const p = d && r.get(d), x = [], m = [];
334
+ let p = r.get(c);
335
+ if (p)
336
+ return p;
337
+ const u = d && r.get(d), x = [], m = [];
338
338
  return c.forEach((g, b) => {
339
339
  const j = b;
340
340
  m[b] = j;
341
- const f = p && p.atomList[p.keyList.indexOf(j)];
341
+ const f = u && u.atomList[u.keyList.indexOf(j)];
342
342
  if (f) {
343
343
  x[b] = f;
344
344
  return;
@@ -364,53 +364,53 @@ function splitAtom(o, n) {
364
364
  ]);
365
365
  };
366
366
  x[b] = isWritable(o) ? atom(v, C) : atom(v);
367
- }), p && p.keyList.length === m.length && p.keyList.every((g, b) => g === m[b]) ? u = p : u = { arr: c, atomList: x, keyList: m }, r.set(c, u), u;
367
+ }), u && u.keyList.length === m.length && u.keyList.every((g, b) => g === m[b]) ? p = u : p = { arr: c, atomList: x, keyList: m }, r.set(c, p), p;
368
368
  }, l = atom((c) => {
369
- const d = c(l), u = c(o);
370
- return a(u, d == null ? void 0 : d.arr);
369
+ const d = c(l), p = c(o);
370
+ return a(p, d == null ? void 0 : d.arr);
371
371
  });
372
372
  l.init = void 0;
373
373
  const i = isWritable(o) ? atom(
374
374
  (c) => c(l).atomList,
375
- (c, d, u) => {
376
- switch (u.type) {
375
+ (c, d, p) => {
376
+ switch (p.type) {
377
377
  case "remove": {
378
- const p = c(i).indexOf(u.atom);
379
- if (p >= 0) {
378
+ const u = c(i).indexOf(p.atom);
379
+ if (u >= 0) {
380
380
  const x = c(o);
381
381
  d(o, [
382
- ...x.slice(0, p),
383
- ...x.slice(p + 1)
382
+ ...x.slice(0, u),
383
+ ...x.slice(u + 1)
384
384
  ]);
385
385
  }
386
386
  break;
387
387
  }
388
388
  case "insert": {
389
- const p = u.before ? c(i).indexOf(u.before) : c(i).length;
390
- if (p >= 0) {
389
+ const u = p.before ? c(i).indexOf(p.before) : c(i).length;
390
+ if (u >= 0) {
391
391
  const x = c(o);
392
392
  d(o, [
393
- ...x.slice(0, p),
394
- u.value,
395
- ...x.slice(p)
393
+ ...x.slice(0, u),
394
+ p.value,
395
+ ...x.slice(u)
396
396
  ]);
397
397
  }
398
398
  break;
399
399
  }
400
400
  case "move": {
401
- const p = c(i).indexOf(u.atom), x = u.before ? c(i).indexOf(u.before) : c(i).length;
402
- if (p >= 0 && x >= 0) {
401
+ const u = c(i).indexOf(p.atom), x = p.before ? c(i).indexOf(p.before) : c(i).length;
402
+ if (u >= 0 && x >= 0) {
403
403
  const m = c(o);
404
- p < x ? d(o, [
405
- ...m.slice(0, p),
406
- ...m.slice(p + 1, x),
407
- m[p],
404
+ u < x ? d(o, [
405
+ ...m.slice(0, u),
406
+ ...m.slice(u + 1, x),
407
+ m[u],
408
408
  ...m.slice(x)
409
409
  ]) : d(o, [
410
410
  ...m.slice(0, x),
411
- m[p],
412
- ...m.slice(x, p),
413
- ...m.slice(p + 1)
411
+ m[u],
412
+ ...m.slice(x, u),
413
+ ...m.slice(u + 1)
414
414
  ]);
415
415
  }
416
416
  break;
@@ -430,7 +430,7 @@ function createJSONStorage(o) {
430
430
  const a = {
431
431
  getItem: (l, i) => {
432
432
  var c, d;
433
- const u = (x) => {
433
+ const p = (x) => {
434
434
  if (x = x || "", n !== x) {
435
435
  try {
436
436
  r = JSON.parse(x);
@@ -440,8 +440,8 @@ function createJSONStorage(o) {
440
440
  n = x;
441
441
  }
442
442
  return r;
443
- }, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
444
- return isPromiseLike$1(p) ? p.then(u) : u(p);
443
+ }, u = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
444
+ return isPromiseLike$1(u) ? u.then(p) : p(u);
445
445
  },
446
446
  setItem: (l, i) => {
447
447
  var c;
@@ -456,15 +456,15 @@ function createJSONStorage(o) {
456
456
  if (!(o() instanceof window.Storage))
457
457
  return () => {
458
458
  };
459
- const d = (u) => {
460
- if (u.storageArea === o() && u.key === l) {
461
- let p;
459
+ const d = (p) => {
460
+ if (p.storageArea === o() && p.key === l) {
461
+ let u;
462
462
  try {
463
- p = JSON.parse(u.newValue || "");
463
+ u = JSON.parse(p.newValue || "");
464
464
  } catch {
465
- p = c;
465
+ u = c;
466
466
  }
467
- i(p);
467
+ i(u);
468
468
  }
469
469
  };
470
470
  return window.addEventListener("storage", d), () => {
@@ -485,9 +485,9 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
485
485
  return r.subscribe && (d = r.subscribe(o, c, n)), d;
486
486
  }, atom(
487
487
  (c) => c(l),
488
- (c, d, u) => {
489
- const p = typeof u == "function" ? u(c(l)) : u;
490
- return p === RESET ? (d(l, n), r.removeItem(o)) : p instanceof Promise ? p.then((x) => (d(l, x), r.setItem(o, x))) : (d(l, p), r.setItem(o, p));
488
+ (c, d, p) => {
489
+ const u = typeof p == "function" ? p(c(l)) : p;
490
+ return u === RESET ? (d(l, n), r.removeItem(o)) : u instanceof Promise ? u.then((x) => (d(l, x), r.setItem(o, x))) : (d(l, u), r.setItem(o, u));
491
491
  }
492
492
  );
493
493
  }
@@ -507,19 +507,19 @@ const StoreContext = createContext(void 0), useStore = (o) => useContext(StoreCo
507
507
  });
508
508
  function useAtomValue(o, n) {
509
509
  const r = useStore(), [[a, l, i], c] = useReducer(
510
- (p) => {
510
+ (u) => {
511
511
  const x = r.get(o);
512
- return Object.is(p[0], x) && p[1] === r && p[2] === o ? p : [x, r, o];
512
+ return Object.is(u[0], x) && u[1] === r && u[2] === o ? u : [x, r, o];
513
513
  },
514
514
  void 0,
515
515
  () => [r.get(o), r, o]
516
516
  );
517
517
  let d = a;
518
518
  return (l !== r || i !== o) && (c(), d = r.get(o)), useEffect(() => {
519
- const p = r.sub(o, () => {
519
+ const u = r.sub(o, () => {
520
520
  c();
521
521
  });
522
- return c(), p;
522
+ return c(), u;
523
523
  }, [r, o, void 0]), useDebugValue(d), isPromiseLike(d) ? use(d) : d;
524
524
  }
525
525
  function useSetAtom(o, n) {
@@ -581,10 +581,10 @@ const getSlots = (o) => {
581
581
  filter(o, { _parent: n }).length > 0 && l.push(flatten(duplicateBlocks(o, n, a._id)));
582
582
  const i = flatten(l);
583
583
  return map(i, (c) => {
584
- const d = c, u = getSlots(d);
585
- return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
586
- const x = find(i, { oldId: u[p].replace("slot:", "") });
587
- d[p] = `slot:${x._id}`;
584
+ const d = c, p = getSlots(d);
585
+ return Object.keys(p).length > 0 && Object.keys(p).forEach((u) => {
586
+ const x = find(i, { oldId: p[u].replace("slot:", "") });
587
+ d[u] = `slot:${x._id}`;
588
588
  }), omit(d, ["global", "oldId"]);
589
589
  });
590
590
  }, presentBlocksAtom = atom$1([]);
@@ -687,8 +687,8 @@ const useSelectedBlocksDisplayChild = () => ({
687
687
  }, getBlockJSONFromSchemas = (o, n, r) => {
688
688
  switch (o.type) {
689
689
  case "singular": {
690
- const p = o.schema;
691
- return p.title && (p.title = titleWithLang(n(p.title), r, get(o, "i18n"))), p.oneOf && Array.isArray(p.oneOf) && (p.oneOf = p.oneOf.map((x) => (x.title && (x.title = n(x.title)), x))), p;
690
+ const u = o.schema;
691
+ return u.title && (u.title = titleWithLang(n(u.title), r, get(o, "i18n"))), u.oneOf && Array.isArray(u.oneOf) && (u.oneOf = u.oneOf.map((x) => (x.title && (x.title = n(x.title)), x))), u;
692
692
  }
693
693
  case "model":
694
694
  const { properties: a, title: l } = o, i = {
@@ -696,14 +696,14 @@ const useSelectedBlocksDisplayChild = () => ({
696
696
  type: "object",
697
697
  properties: {}
698
698
  };
699
- return Object.keys(a).forEach((p) => {
700
- const x = a[p];
699
+ return Object.keys(a).forEach((u) => {
700
+ const x = a[u];
701
701
  if (includes(["slot", "styles"], x.type)) return;
702
- const m = p;
702
+ const m = u;
703
703
  i.properties[m] = getBlockJSONFromSchemas(x, n, r);
704
704
  }), i;
705
705
  case "list":
706
- const { itemProperties: c, title: d } = o, u = {
706
+ const { itemProperties: c, title: d } = o, p = {
707
707
  title: titleWithLang(n(d), r, get(o, "i18n")),
708
708
  type: "array",
709
709
  items: {
@@ -711,16 +711,16 @@ const useSelectedBlocksDisplayChild = () => ({
711
711
  properties: {}
712
712
  }
713
713
  };
714
- return Object.keys(c).forEach((p) => {
715
- const x = c[p];
714
+ return Object.keys(c).forEach((u) => {
715
+ const x = c[u];
716
716
  if (includes(["slot", "styles"], x.type)) return;
717
- const m = p;
718
- u.items.properties[m] = getBlockJSONFromSchemas(x, n, r), set(
719
- u.items,
717
+ const m = u;
718
+ p.items.properties[m] = getBlockJSONFromSchemas(x, n, r), set(
719
+ p.items,
720
720
  "title",
721
721
  titleWithLang(get(x, "itemTitle", `${n(d)} item`), r, get(x, "i18n"))
722
722
  );
723
- }), u;
723
+ }), p;
724
724
  default:
725
725
  return {};
726
726
  }
@@ -771,8 +771,8 @@ var undomanager = { exports: {} };
771
771
  }
772
772
  let r = function() {
773
773
  let a = [], l = -1, i = 0, c = !1, d;
774
- function u(p, x) {
775
- return !p || typeof p[x] != "function" ? this : (c = !0, p[x](), c = !1, this);
774
+ function p(u, x) {
775
+ return !u || typeof u[x] != "function" ? this : (c = !0, u[x](), c = !1, this);
776
776
  }
777
777
  return {
778
778
  /**
@@ -782,25 +782,25 @@ var undomanager = { exports: {} };
782
782
  * @property {function} command.redo - Redo function
783
783
  * @property {string} [command.groupId] - Optional group id
784
784
  */
785
- add: function(p) {
786
- return c ? this : (a.splice(l + 1, a.length - l), a.push(p), i && a.length > i && n(a, 0, -(i + 1)), l = a.length - 1, d && d(), this);
785
+ add: function(u) {
786
+ return c ? this : (a.splice(l + 1, a.length - l), a.push(u), i && a.length > i && n(a, 0, -(i + 1)), l = a.length - 1, d && d(), this);
787
787
  },
788
788
  /**
789
789
  * Pass a function to be called on undo and redo actions.
790
790
  * @property {function} callbackFunc - Callback function
791
791
  */
792
- setCallback: function(p) {
793
- d = p;
792
+ setCallback: function(u) {
793
+ d = u;
794
794
  },
795
795
  /**
796
796
  * Performs undo: call the undo function at the current index and decrease the index by 1.
797
797
  */
798
798
  undo: function() {
799
- let p = a[l];
800
- if (!p)
799
+ let u = a[l];
800
+ if (!u)
801
801
  return this;
802
- const x = p.groupId;
803
- for (; p.groupId === x && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
802
+ const x = u.groupId;
803
+ for (; u.groupId === x && (p(u, "undo"), l -= 1, u = a[l], !(!u || !u.groupId)); )
804
804
  ;
805
805
  return d && d(), this;
806
806
  },
@@ -808,11 +808,11 @@ var undomanager = { exports: {} };
808
808
  * Performs redo: call the redo function at the next index and increase the index by 1.
809
809
  */
810
810
  redo: function() {
811
- let p = a[l + 1];
812
- if (!p)
811
+ let u = a[l + 1];
812
+ if (!u)
813
813
  return this;
814
- const x = p.groupId;
815
- for (; p.groupId === x && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
814
+ const x = u.groupId;
815
+ for (; u.groupId === x && (p(u, "redo"), l += 1, u = a[l + 1], !(!u || !u.groupId)); )
816
816
  ;
817
817
  return d && d(), this;
818
818
  },
@@ -820,8 +820,8 @@ var undomanager = { exports: {} };
820
820
  * Clears the memory, losing all stored states. Resets the index.
821
821
  */
822
822
  clear: function() {
823
- let p = a.length;
824
- a = [], l = -1, d && p > 0 && d();
823
+ let u = a.length;
824
+ a = [], l = -1, d && u > 0 && d();
825
825
  },
826
826
  /**
827
827
  * Tests if any undo actions exist.
@@ -842,8 +842,8 @@ var undomanager = { exports: {} };
842
842
  * @param {string} [groupId] - Optionally filter commands by group ID
843
843
  * @returns {array}
844
844
  */
845
- getCommands: function(p) {
846
- return p ? a.filter((x) => x.groupId === p) : a;
845
+ getCommands: function(u) {
846
+ return u ? a.filter((x) => x.groupId === u) : a;
847
847
  },
848
848
  /**
849
849
  * Returns the index of the actions list.
@@ -856,8 +856,8 @@ var undomanager = { exports: {} };
856
856
  * Sets the maximum number of undo steps. Default: 0 (unlimited).
857
857
  * @property {number} max - Maximum number of undo steps
858
858
  */
859
- setLimit: function(p) {
860
- i = p;
859
+ setLimit: function(u) {
860
+ i = u;
861
861
  }
862
862
  };
863
863
  };
@@ -1000,15 +1000,15 @@ dataProvidersAtom.debugLabel = "dataProvidersAtom";
1000
1000
  const usePageDataProviders = () => useAtom$1(dataProvidersAtom), builderSaveStateAtom = atom$1("SAVED");
1001
1001
  builderSaveStateAtom.debugLabel = "builderSaveStateAtom";
1002
1002
  const useSavePage = () => {
1003
- const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (u) => {
1003
+ const [o, n] = useAtom$1(builderSaveStateAtom), r = useBuilderProp("onSave", async (p) => {
1004
1004
  }), a = useBuilderProp("onSaveStateChange", noop), l = useGetPageData(), [i] = usePageDataProviders(), [c] = useBrandingOptions();
1005
1005
  return { savePage: useThrottledCallback(
1006
- async (u = !1) => {
1006
+ async (p = !1) => {
1007
1007
  n("SAVING"), a("SAVING");
1008
- const p = l();
1008
+ const u = l();
1009
1009
  return await r({
1010
- autoSave: u,
1011
- blocks: p.blocks,
1010
+ autoSave: p,
1011
+ blocks: u.blocks,
1012
1012
  providers: i,
1013
1013
  brandingOptions: c,
1014
1014
  themeConfiguration: c
@@ -1055,13 +1055,13 @@ function insertBlocksAtPosition(o, n, r, a) {
1055
1055
  r && (l = o.filter((d) => d._parent === r));
1056
1056
  const i = a !== void 0 ? a : l.length;
1057
1057
  let c = o.length;
1058
- for (let d = 0, u = 0; d < o.length; d++)
1058
+ for (let d = 0, p = 0; d < o.length; d++)
1059
1059
  if (o[d]._parent === r) {
1060
- if (u === i) {
1060
+ if (p === i) {
1061
1061
  c = d;
1062
1062
  break;
1063
1063
  }
1064
- u++;
1064
+ p++;
1065
1065
  }
1066
1066
  return !r && a !== void 0 && a >= l.length && (c = o.length), [...o.slice(0, c), ...n, ...o.slice(c)];
1067
1067
  }
@@ -1073,15 +1073,15 @@ function findNodeById(o, n) {
1073
1073
  return o.first((r) => r.model._id === n) || null;
1074
1074
  }
1075
1075
  function moveNode(o, n, r, a) {
1076
- var p, x;
1076
+ var u, x;
1077
1077
  const l = findNodeById(o, n), i = findNodeById(o, r);
1078
1078
  if (!l || !i) return !1;
1079
1079
  i.children || (i.model.children = []);
1080
- let c = (p = i == null ? void 0 : i.children) == null ? void 0 : p.findIndex((m) => m.model._id === n);
1080
+ let c = (u = i == null ? void 0 : i.children) == null ? void 0 : u.findIndex((m) => m.model._id === n);
1081
1081
  l.drop(), c = Math.max(c, 0);
1082
- const u = (((x = l == null ? void 0 : l.model) == null ? void 0 : x._parent) || "root") === r && c <= a ? a - 1 : a;
1082
+ const p = (((x = l == null ? void 0 : l.model) == null ? void 0 : x._parent) || "root") === r && c <= a ? a - 1 : a;
1083
1083
  try {
1084
- i.addChildAtIndex(l, u);
1084
+ i.addChildAtIndex(l, p);
1085
1085
  } catch {
1086
1086
  return !1;
1087
1087
  }
@@ -1092,7 +1092,7 @@ function moveBlocksWithChildren(o, n, r, a) {
1092
1092
  r = r || "root";
1093
1093
  const i = new TreeModel().parse({ _id: "root", children: getBlocksTree(o) });
1094
1094
  if (moveNode(i, n, r, a)) {
1095
- const c = flattenTree(i), d = c.find((u) => u._id === n);
1095
+ const c = flattenTree(i), d = c.find((p) => p._id === n);
1096
1096
  return d && (d._parent = r === "root" ? null : r), c.shift(), c;
1097
1097
  }
1098
1098
  return o;
@@ -1212,9 +1212,9 @@ const useBlocksStoreManager = () => {
1212
1212
  for (let v = 0; v < f.length; v++)
1213
1213
  f[v]._parent = i[b]._id;
1214
1214
  }
1215
- const u = first(i);
1216
- let p, x;
1217
- return c && (p = find(o, { _id: c }), i[0]._parent = c, x = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, x = p._parent), r(i, x, d), n([(g = first(i)) == null ? void 0 : g._id]), first(i);
1215
+ const p = first(i);
1216
+ let u, x;
1217
+ return c && (u = find(o, { _id: c }), i[0]._parent = c, x = c), !(u ? canAcceptChildBlock(u == null ? void 0 : u._type, p._type) : !0) && u && (i[0]._parent = u._parent, x = u._parent), r(i, x, d), n([(g = first(i)) == null ? void 0 : g._id]), first(i);
1218
1218
  },
1219
1219
  [o, n]
1220
1220
  );
@@ -1224,14 +1224,14 @@ const useBlocksStoreManager = () => {
1224
1224
  const v = i.blocks;
1225
1225
  return a(v, c, d);
1226
1226
  }
1227
- const u = generateUUID(), p = getBlockDefaultProps(i.props), x = [];
1228
- forIn(p, (v, C) => {
1227
+ const p = generateUUID(), u = getBlockDefaultProps(i.props), x = [];
1228
+ forIn(u, (v, C) => {
1229
1229
  if (startsWith(v, SLOT_KEY)) {
1230
1230
  const w = v.replace(SLOT_KEY, "");
1231
1231
  x.push({
1232
1232
  _id: w,
1233
1233
  _type: "Slot",
1234
- _parent: u,
1234
+ _parent: p,
1235
1235
  _name: i.props[C].name,
1236
1236
  _styles: i.props[C].styles,
1237
1237
  _emptyStyles: i.props[C].emptyStyles
@@ -1240,8 +1240,8 @@ const useBlocksStoreManager = () => {
1240
1240
  });
1241
1241
  const m = {
1242
1242
  _type: i.type,
1243
- _id: u,
1244
- ...p
1243
+ _id: p,
1244
+ ...u
1245
1245
  };
1246
1246
  let g, b;
1247
1247
  c && (g = find(o, { _id: c }), m._parent = c, b = c), !canAcceptChildBlock(g == null ? void 0 : g._type, m._type) && g && (m._parent = g._parent, b = g._parent);
@@ -2344,15 +2344,15 @@ function getNewClasses(o = "", n = "", r = []) {
2344
2344
  o = o.trim().replace(/ +/g, "");
2345
2345
  let a = filter(
2346
2346
  map(o.split(" "), constructClassObject),
2347
- (p) => !isNull(p)
2348
- ), l = filter(map(n.split(" "), constructClassObject), (p) => !isNull(p));
2347
+ (u) => !isNull(u)
2348
+ ), l = filter(map(n.split(" "), constructClassObject), (u) => !isNull(u));
2349
2349
  l = filter(
2350
2350
  l,
2351
- (p) => !includes(IGNORED_BASES_CLASSES_PROPERTIES, p.property)
2351
+ (u) => !includes(IGNORED_BASES_CLASSES_PROPERTIES, u.property)
2352
2352
  );
2353
2353
  const i = [], c = [];
2354
- each(r, (p) => {
2355
- const x = constructClassObject(p), m = find(a, pick(x, ["dark", "mq", "mod", "property"]));
2354
+ each(r, (u) => {
2355
+ const x = constructClassObject(u), m = find(a, pick(x, ["dark", "mq", "mod", "property"]));
2356
2356
  if (m && (a = filter(
2357
2357
  a,
2358
2358
  (g) => g.fullCls !== (m == null ? void 0 : m.fullCls)
@@ -2369,11 +2369,11 @@ function getNewClasses(o = "", n = "", r = []) {
2369
2369
  }
2370
2370
  });
2371
2371
  const d = map(
2372
- sortBy([...a, ...i], (p) => MEDIA_QUERIES[p.mq]),
2372
+ sortBy([...a, ...i], (u) => MEDIA_QUERIES[u.mq]),
2373
2373
  "fullCls"
2374
2374
  ).join(" ");
2375
2375
  return `${map(
2376
- sortBy([...l, ...c], (p) => MEDIA_QUERIES[p.mq]),
2376
+ sortBy([...l, ...c], (u) => MEDIA_QUERIES[u.mq]),
2377
2377
  "fullCls"
2378
2378
  ).join(" ").trim()},${d.trim()}`.trim().replace(/ +/g, "");
2379
2379
  }
@@ -2391,10 +2391,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2391
2391
  )
2392
2392
  ), i = first(o(selectedStylingBlocksAtom));
2393
2393
  return map(l, (c) => {
2394
- const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: x } = getSplitClasses$1(u);
2394
+ const d = o(c), p = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: u, classes: x } = getSplitClasses$1(p);
2395
2395
  return {
2396
2396
  ids: [d._id],
2397
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(x, p, a)}` }
2397
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(x, u, a)}` }
2398
2398
  };
2399
2399
  });
2400
2400
  }), useAddClassesToBlocks = () => {
@@ -2482,7 +2482,7 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2482
2482
  const c = o.filter((d) => !d._parent);
2483
2483
  n(r, null, (c == null ? void 0 : c.length) || 0);
2484
2484
  } else {
2485
- const c = o.find((u) => u._id === a), d = c ? (i = c == null ? void 0 : c.children) == null ? void 0 : i.length : 0;
2485
+ const c = o.find((p) => p._id === a), d = c ? (i = c == null ? void 0 : c.children) == null ? void 0 : i.length : 0;
2486
2486
  n(r, l, d);
2487
2487
  }
2488
2488
  },
@@ -2497,8 +2497,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2497
2497
  ),
2498
2498
  pasteBlocks: useCallback(
2499
2499
  (d) => {
2500
- const u = Array.isArray(d) ? d[0] : d;
2501
- isEmpty(o) ? l(n, d) : a(o, u), r([]);
2500
+ const p = Array.isArray(d) ? d[0] : d;
2501
+ isEmpty(o) ? l(n, d) : a(o, p), r([]);
2502
2502
  },
2503
2503
  [n, o, a, l, r]
2504
2504
  )
@@ -2518,20 +2518,20 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2518
2518
  )
2519
2519
  );
2520
2520
  return map(i, (c) => {
2521
- const d = o(c), u = a;
2522
- let { classes: p, baseClasses: x } = getSplitClasses(get(d, l.prop, "styles:,"));
2523
- return each(u, (m) => {
2521
+ const d = o(c), p = a;
2522
+ let { classes: u, baseClasses: x } = getSplitClasses(get(d, l.prop, "styles:,"));
2523
+ return each(p, (m) => {
2524
2524
  const g = m.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), b = new RegExp(`(^| )${g}($| )`, "g");
2525
- p = p.replace(b, " ").replace(/ +/g, " ").trim();
2525
+ u = u.replace(b, " ").replace(/ +/g, " ").trim();
2526
2526
  const j = first(m.split(":"));
2527
- includes(["2xl", "xl", "lg", "md", "sm"], j) && u.push(m.split(":").pop().trim());
2528
- }), each(u, (m) => {
2527
+ includes(["2xl", "xl", "lg", "md", "sm"], j) && p.push(m.split(":").pop().trim());
2528
+ }), each(p, (m) => {
2529
2529
  const g = new RegExp(`(^| )${m.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2530
2530
  x = x.replace(g, " ").replace(/ +/g, " ").trim();
2531
2531
  }), {
2532
2532
  ids: [d._id],
2533
2533
  props: {
2534
- [l.prop]: `${STYLES_KEY}${x},${p}`
2534
+ [l.prop]: `${STYLES_KEY}${x},${u}`
2535
2535
  }
2536
2536
  };
2537
2537
  });
@@ -2627,10 +2627,10 @@ const useLanguages = () => {
2627
2627
  const c = r[i];
2628
2628
  if (isString$1(c)) {
2629
2629
  const d = chunk(c.split(""), 12);
2630
- let u = "";
2630
+ let p = "";
2631
2631
  o([n], { [i]: "" });
2632
- for (let p = 0; p < d.length; p++)
2633
- u += d[p].join(""), o([n], { [i]: u }), await new Promise((x) => setTimeout(x, a));
2632
+ for (let u = 0; u < d.length; u++)
2633
+ p += d[u].join(""), o([n], { [i]: p }), await new Promise((x) => setTimeout(x, a));
2634
2634
  }
2635
2635
  }
2636
2636
  },
@@ -2716,18 +2716,18 @@ const useBlockHighlight = () => {
2716
2716
  }, [n]);
2717
2717
  return { getGlobalBlocks: r, reset: a };
2718
2718
  }, useWatchGlobalBlocks = () => {
2719
- const [o] = useBlocksStore(), [n, r] = useAtom(globalBlocksStoreAtom), [a, l] = useAtom(globalBlocksLoadingStateAtom), i = useBuilderProp("getGlobalBlockBlocks", async (d) => []), c = useMemo(() => o.filter((u) => u._type === "GlobalBlock").filter((u) => u._type === "GlobalBlock").map((u) => u.globalBlock), [o]);
2719
+ const [o] = useBlocksStore(), [n, r] = useAtom(globalBlocksStoreAtom), [a, l] = useAtom(globalBlocksLoadingStateAtom), i = useBuilderProp("getGlobalBlockBlocks", async (d) => []), c = useMemo(() => o.filter((p) => p._type === "GlobalBlock").filter((p) => p._type === "GlobalBlock").map((p) => p.globalBlock), [o]);
2720
2720
  useEffect(() => {
2721
2721
  forEach(c, (d) => {
2722
- has(n, d) || get(a, `${d}.loading`, !1) || (l((u) => ({ ...u, [d]: { loading: !0, error: null } })), i(d).then((u) => {
2723
- r((p) => ({ ...p, [d]: u })), l((p) => ({
2724
- ...p,
2722
+ has(n, d) || get(a, `${d}.loading`, !1) || (l((p) => ({ ...p, [d]: { loading: !0, error: null } })), i(d).then((p) => {
2723
+ r((u) => ({ ...u, [d]: p })), l((u) => ({
2724
+ ...u,
2725
2725
  [d]: { loading: !1, error: null }
2726
2726
  }));
2727
- }).catch((u) => {
2728
- l((p) => ({
2729
- ...p,
2730
- [d]: { loading: !1, error: u.message }
2727
+ }).catch((p) => {
2728
+ l((u) => ({
2729
+ ...u,
2730
+ [d]: { loading: !1, error: p.message }
2731
2731
  }));
2732
2732
  }));
2733
2733
  });
@@ -2825,24 +2825,24 @@ const useBlockHighlight = () => {
2825
2825
  </body>
2826
2826
  </html>`, useCanvasScale = (o) => {
2827
2827
  const [n] = useCanvasWidth(), [, r] = useCanvasZoom(), a = useBuilderProp("htmlDir", "ltr"), [l, i] = useState({}), c = useCallback(() => {
2828
- const { width: d, height: u } = o;
2828
+ const { width: d, height: p } = o;
2829
2829
  if (d < n) {
2830
- const p = parseFloat((d / n).toFixed(2).toString());
2830
+ const u = parseFloat((d / n).toFixed(2).toString());
2831
2831
  let x = {};
2832
- const m = u * p, g = d * p;
2833
- u && (x = {
2832
+ const m = p * u, g = d * u;
2833
+ p && (x = {
2834
2834
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
2835
- height: 100 + (u - m) / m * 100 + "%",
2835
+ height: 100 + (p - m) / m * 100 + "%",
2836
2836
  width: 100 + (d - g) / g * 100 + "%"
2837
2837
  }), i({
2838
2838
  position: "relative",
2839
2839
  top: 0,
2840
- transform: `scale(${p})`,
2840
+ transform: `scale(${u})`,
2841
2841
  transformOrigin: a === "rtl" ? "top right" : "top left",
2842
2842
  ...x,
2843
2843
  maxWidth: "none"
2844
2844
  // TODO: Add max-width to the wrapper
2845
- }), r(p * 100);
2845
+ }), r(u * 100);
2846
2846
  } else
2847
2847
  i({}), r(100);
2848
2848
  }, [n, o, a, r]);
@@ -2967,8 +2967,8 @@ const positionPlaceholder = (o, n, r) => {
2967
2967
  a.style.display = "block", a.style.width = "100%", a.style.height = "5px", a.style.top = "0px", a.style.left = "0px";
2968
2968
  return;
2969
2969
  }
2970
- const l = possiblePositions.map(([u]) => u), i = l.reduce(
2971
- (u, p) => Math.abs(p - r) < Math.abs(u - r) ? p : u,
2970
+ const l = possiblePositions.map(([p]) => p), i = l.reduce(
2971
+ (p, u) => Math.abs(u - r) < Math.abs(p - r) ? u : p,
2972
2972
  0
2973
2973
  ), c = l.indexOf(i);
2974
2974
  if (!possiblePositions[c]) return;
@@ -3034,8 +3034,8 @@ function canDropInTarget(o, n) {
3034
3034
  return canAcceptChildBlock(a, r);
3035
3035
  }
3036
3036
  const useDnd = () => {
3037
- const { document: o } = useFrame(), [n, r] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d, u] = useAtom$1(draggedBlockAtom), [, p] = useAtom$1(dropTargetBlockIdAtom), x = () => {
3038
- removePlaceholder(), r(!1), u(null), p(null), possiblePositions = [], dropTarget = null, dropIndex = null;
3037
+ const { document: o } = useFrame(), [n, r] = useAtom$1(draggingFlagAtom), { addCoreBlock: a } = useAddBlock(), [, l] = useHighlightBlockId(), [, i] = useSelectedBlockIds(), { moveBlocks: c } = useBlocksStoreUndoableActions(), [d, p] = useAtom$1(draggedBlockAtom), [, u] = useAtom$1(dropTargetBlockIdAtom), x = () => {
3038
+ removePlaceholder(), r(!1), p(null), u(null), possiblePositions = [], dropTarget = null, dropIndex = null;
3039
3039
  };
3040
3040
  return useEffect(() => {
3041
3041
  const m = window.document.getElementById("chaibuilder-root-layout-container"), g = (b) => {
@@ -3071,10 +3071,10 @@ const useDnd = () => {
3071
3071
  const g = m, b = g.target;
3072
3072
  dropTarget = b;
3073
3073
  const j = b.getAttribute("data-block-id"), f = b.getAttribute("data-dnd-dragged") !== "yes";
3074
- p(j), g.stopPropagation(), g.preventDefault(), possiblePositions = [], f && canDropInTarget(b, d) && calculatePossiblePositions(b), r(!0), l(""), i([]);
3074
+ u(j), g.stopPropagation(), g.preventDefault(), possiblePositions = [], f && canDropInTarget(b, d) && calculatePossiblePositions(b), r(!0), l(""), i([]);
3075
3075
  },
3076
3076
  onDragLeave: (m) => {
3077
- m.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
3077
+ m.target.getAttribute("data-block-id") === "canvas" && (u(null), r(!1), removePlaceholder(), possiblePositions = []);
3078
3078
  }
3079
3079
  };
3080
3080
  };
@@ -3099,20 +3099,20 @@ const useHandleCanvasDblClick = () => {
3099
3099
  const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
3100
3100
  if (!d || !o.includes(d))
3101
3101
  return;
3102
- const u = c.cloneNode(!0);
3103
- c.style.display = "none", Array.from(u.attributes).forEach((g) => {
3104
- g.name !== "class" && u.removeAttribute(g.name);
3105
- }), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
3106
- const p = new Quill(u, { placeholder: "Type here..." });
3102
+ const p = c.cloneNode(!0);
3103
+ c.style.display = "none", Array.from(p.attributes).forEach((g) => {
3104
+ g.name !== "class" && p.removeAttribute(g.name);
3105
+ }), d === "Text" && (p.style.display = "inline-block"), c.parentNode.insertBefore(p, c.nextSibling);
3106
+ const u = new Quill(p, { placeholder: "Type here..." });
3107
3107
  function x() {
3108
- const g = p.getText(0, p.getLength());
3109
- n([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), u.removeEventListener("blur", x, !0), destroyQuill(p), a(""), l(), u.remove();
3108
+ const g = u.getText(0, u.getLength());
3109
+ n([c.getAttribute("data-block-id")], { content: g }), c.removeAttribute("style"), p.removeEventListener("blur", x, !0), destroyQuill(u), a(""), l(), p.remove();
3110
3110
  }
3111
- u.addEventListener("blur", x, !0), u.addEventListener("click", (g) => {
3111
+ p.addEventListener("blur", x, !0), p.addEventListener("click", (g) => {
3112
3112
  g.stopPropagation();
3113
- }), u.addEventListener("keydown", (g) => {
3113
+ }), p.addEventListener("keydown", (g) => {
3114
3114
  (g.key === "Enter" || g.key === "Escape") && x();
3115
- }), p.focus(), (m = u.querySelector(".ql-clipboard")) == null || m.remove(), a(c.getAttribute("data-block-id"));
3115
+ }), u.focus(), (m = p.querySelector(".ql-clipboard")) == null || m.remove(), a(c.getAttribute("data-block-id"));
3116
3116
  };
3117
3117
  }, useHandleCanvasClick = () => {
3118
3118
  const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
@@ -3125,11 +3125,11 @@ const useHandleCanvasDblClick = () => {
3125
3125
  return;
3126
3126
  }
3127
3127
  if (d != null && d.getAttribute("data-block-parent")) {
3128
- const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), x = d.getAttribute("data-block-parent");
3129
- n.includes(x) || l == null || l.closeAll(), o([{ id: p, prop: u, blockId: x }]), r([x]);
3128
+ const p = d.getAttribute("data-style-prop"), u = d.getAttribute("data-style-id"), x = d.getAttribute("data-block-parent");
3129
+ n.includes(x) || l == null || l.closeAll(), o([{ id: u, prop: p, blockId: x }]), r([x]);
3130
3130
  } else if (d != null && d.getAttribute("data-block-id")) {
3131
- const u = d.getAttribute("data-block-id");
3132
- n.includes(u) || l == null || l.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
3131
+ const p = d.getAttribute("data-block-id");
3132
+ n.includes(p) || l == null || l.closeAll(), o([]), r(p === "canvas" ? [] : [p]);
3133
3133
  }
3134
3134
  i();
3135
3135
  };
@@ -3159,7 +3159,7 @@ const useHandleCanvasDblClick = () => {
3159
3159
  }
3160
3160
  }, 100);
3161
3161
  }, [n, r, l, a]);
3162
- const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(), x = useDnd();
3162
+ const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), p = useHandleMouseMove(), u = useHandleMouseLeave(), x = useDnd();
3163
3163
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3164
3164
  "div",
3165
3165
  {
@@ -3167,22 +3167,22 @@ const useHandleCanvasDblClick = () => {
3167
3167
  id: "canvas",
3168
3168
  onClick: d,
3169
3169
  onDoubleClick: c,
3170
- onMouseMove: u,
3171
- onMouseLeave: p,
3170
+ onMouseMove: p,
3171
+ onMouseLeave: u,
3172
3172
  ...omit(x, "isDragging"),
3173
3173
  className: "relative h-full max-w-full p-px " + (x.isDragging ? "dragging" : ""),
3174
3174
  children: o
3175
3175
  }
3176
3176
  );
3177
3177
  }, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
3178
- const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: x } = usePasteBlocks();
3179
- useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => u(n), {}, [n, u]), useHotkeys(
3178
+ const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, p] = useCopyBlockIds(), { canPaste: u, pasteBlocks: x } = usePasteBlocks();
3179
+ useHotkeys("ctrl+z,command+z", () => i(), {}, [i]), useHotkeys("ctrl+y,command+y", () => c(), {}, [c]), useHotkeys("ctrl+x,command+x", () => d(n), {}, [n, d]), useHotkeys("ctrl+c,command+c", () => p(n), {}, [n, p]), useHotkeys(
3180
3180
  "ctrl+v,command+v",
3181
3181
  () => {
3182
- p(n[0]) && x(n);
3182
+ u(n[0]) && x(n);
3183
3183
  },
3184
3184
  {},
3185
- [n, p, x]
3185
+ [n, u, x]
3186
3186
  );
3187
3187
  const m = o ? { document: o } : {};
3188
3188
  useHotkeys("esc", () => r([]), m, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...m, preventDefault: !0 }, [
@@ -3222,7 +3222,7 @@ const useHandleCanvasDblClick = () => {
3222
3222
  }
3223
3223
  );
3224
3224
  }, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
3225
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: x } = useFloating({
3225
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: p, refs: u, update: x } = useFloating({
3226
3226
  placement: "top-start",
3227
3227
  middleware: [shift(), flip()],
3228
3228
  elements: {
@@ -3236,8 +3236,8 @@ const useHandleCanvasDblClick = () => {
3236
3236
  {
3237
3237
  role: "button",
3238
3238
  tabIndex: 0,
3239
- ref: p.setFloating,
3240
- style: u,
3239
+ ref: u.setFloating,
3240
+ style: p,
3241
3241
  onClick: (b) => {
3242
3242
  b.stopPropagation(), b.preventDefault();
3243
3243
  },
@@ -3279,7 +3279,7 @@ const useHandleCanvasDblClick = () => {
3279
3279
  }
3280
3280
  ) });
3281
3281
  }, HeadTags = () => {
3282
- const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useSelectedStylingBlocks(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), { document: c, window: d } = useFrame(), [u] = useState(c == null ? void 0 : c.getElementById("highlighted-block")), [p] = useState(
3282
+ const [o] = useBrandingOptions(), [n] = useSelectedBlockIds(), [r] = useDarkMode(), [a] = useSelectedStylingBlocks(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), { document: c, window: d } = useFrame(), [p] = useState(c == null ? void 0 : c.getElementById("highlighted-block")), [u] = useState(
3283
3283
  c == null ? void 0 : c.getElementById("selected-block")
3284
3284
  ), [x] = useState(
3285
3285
  c == null ? void 0 : c.getElementById("selected-styling-block")
@@ -3346,14 +3346,14 @@ const useHandleCanvasDblClick = () => {
3346
3346
  ]
3347
3347
  });
3348
3348
  }, [o, d, g, b]), useEffect(() => {
3349
- p && (p.textContent = `${map(n, (j) => `[data-block-id="${j}"]`).join(",")}{
3349
+ u && (u.textContent = `${map(n, (j) => `[data-block-id="${j}"]`).join(",")}{
3350
3350
  outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3351
3351
  }`);
3352
- }, [n, p]), useEffect(() => {
3352
+ }, [n, u]), useEffect(() => {
3353
3353
  m.textContent = l ? `[data-block-id="${l._id}"], [data-block-id="${l._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3354
3354
  }, [l, m]), useEffect(() => {
3355
- u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3356
- }, [u]), useEffect(() => {
3355
+ p && (p.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3356
+ }, [p]), useEffect(() => {
3357
3357
  x && (x.textContent = `${map(a, ({ id: j }) => `[data-style-id="${j}"]`).join(",")}{
3358
3358
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3359
3359
  }`);
@@ -3370,16 +3370,16 @@ const useHandleCanvasDblClick = () => {
3370
3370
  const r = ["xs", "sm", "md", "lg", "xl", "2xl"], a = r.indexOf(n), l = o.split(" ");
3371
3371
  let i = new Array(r.length).fill(!1);
3372
3372
  for (const c of l) {
3373
- let [d, u] = c.split(":");
3374
- u || (u = d, d = "xs");
3375
- const p = r.indexOf(d);
3376
- if (p <= a) {
3373
+ let [d, p] = c.split(":");
3374
+ p || (p = d, d = "xs");
3375
+ const u = r.indexOf(d);
3376
+ if (u <= a) {
3377
3377
  const x = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], m = ["hidden"];
3378
- if (x.includes(u))
3379
- for (let g = p; g < r.length; g++)
3378
+ if (x.includes(p))
3379
+ for (let g = u; g < r.length; g++)
3380
3380
  i[g] = !0;
3381
- else if (m.includes(u))
3382
- for (let g = p; g < r.length; g++)
3381
+ else if (m.includes(p))
3382
+ for (let g = u; g < r.length; g++)
3383
3383
  i[g] = !1;
3384
3384
  }
3385
3385
  }
@@ -3399,24 +3399,24 @@ const useHandleCanvasDblClick = () => {
3399
3399
  );
3400
3400
  return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
3401
3401
  }, useWatchRSCBlocks = () => {
3402
- const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
3402
+ const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (p) => ""), d = useMemo(() => o.filter((u) => {
3403
3403
  var m;
3404
- return (m = get(i, p._type)) == null ? void 0 : m.server;
3405
- }).map((p) => p._id), [i, o]);
3404
+ return (m = get(i, u._type)) == null ? void 0 : m.server;
3405
+ }).map((u) => u._id), [i, o]);
3406
3406
  useEffect(() => {
3407
- forEach(d, (u) => {
3408
- if (get(n, u, "") || get(a, `${u}.loading`, !1))
3407
+ forEach(d, (p) => {
3408
+ if (get(n, p, "") || get(a, `${p}.loading`, !1))
3409
3409
  return;
3410
- const p = o.find((x) => x._id === u);
3411
- l((x) => ({ ...x, [u]: { loading: !0, error: null } })), c(p).then((x) => {
3412
- r((m) => ({ ...m, [u]: x })), l((m) => ({
3410
+ const u = o.find((x) => x._id === p);
3411
+ l((x) => ({ ...x, [p]: { loading: !0, error: null } })), c(u).then((x) => {
3412
+ r((m) => ({ ...m, [p]: x })), l((m) => ({
3413
3413
  ...m,
3414
- [u]: { loading: !1, error: null }
3414
+ [p]: { loading: !1, error: null }
3415
3415
  }));
3416
3416
  }).catch((x) => {
3417
3417
  l((m) => ({
3418
3418
  ...m,
3419
- [u]: { loading: !1, error: x.message }
3419
+ [p]: { loading: !1, error: x.message }
3420
3420
  }));
3421
3421
  });
3422
3422
  });
@@ -3479,16 +3479,16 @@ function applyLanguage(o, n, r) {
3479
3479
  }), a;
3480
3480
  }
3481
3481
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3482
- const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: x } = useGlobalBlocksStore(), m = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [b] = useAtom$1(inlineEditingActiveAtom), j = useCallback(
3482
+ const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [p] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: x } = useGlobalBlocksStore(), m = useCallback((f) => getStyleAttrs(f, d), [d]), [g] = useChaiExternalData(), [b] = useAtom$1(inlineEditingActiveAtom), j = useCallback(
3483
3483
  (f) => f.reduce((v, C) => {
3484
- const w = get(u, C, {});
3484
+ const w = get(p, C, {});
3485
3485
  return { ...v, ...w };
3486
3486
  }, {}),
3487
- [u]
3487
+ [p]
3488
3488
  );
3489
3489
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3490
3490
  o.map((f, v) => {
3491
- if (b === f._id || p.includes(f._id)) return null;
3491
+ if (b === f._id || u.includes(f._id)) return null;
3492
3492
  const C = {}, w = filter(n, { _parent: f._id });
3493
3493
  if (C.children = w.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: w }) : null, f._type === "GlobalBlock") {
3494
3494
  const S = x(f);
@@ -3532,7 +3532,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3532
3532
  if (i) {
3533
3533
  const c = (i == null ? void 0 : i.mockFn) || (i == null ? void 0 : i.dataFn);
3534
3534
  c && c(l.args).then(
3535
- (d) => n((u) => ({ ...u, [l.providerKey]: d }))
3535
+ (d) => n((p) => ({ ...p, [l.providerKey]: d }))
3536
3536
  );
3537
3537
  }
3538
3538
  }), () => {
@@ -3556,22 +3556,22 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3556
3556
  }, ResizableCanvasWrapper = ({ children: o, onMount: n, onResize: r }) => {
3557
3557
  const [, a] = useSelectedBlockIds(), [, l] = useSelectedStylingBlocks(), i = useRef(null), c = useDebouncedCallback(
3558
3558
  () => {
3559
- const { clientWidth: u } = i.current;
3560
- r(u);
3559
+ const { clientWidth: p } = i.current;
3560
+ r(p);
3561
3561
  },
3562
3562
  [i.current],
3563
3563
  100
3564
3564
  );
3565
3565
  useResizeObserver(i.current, c, i.current !== null), useEffect(() => {
3566
- const { clientWidth: u } = i.current;
3567
- n(u);
3566
+ const { clientWidth: p } = i.current;
3567
+ n(p);
3568
3568
  }, []);
3569
3569
  const d = () => {
3570
3570
  a([]), l([]);
3571
3571
  };
3572
3572
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
3573
3573
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3574
- const [o] = useCanvasWidth(), [, n] = useSelectedBlockIds(), r = useSelectedBlock(), [, a] = useHighlightBlockId(), l = useRef(null), i = useRef(null), [c, d] = useState({ width: 0, height: 0 }), u = useCanvasScale(c), [p, x] = useState([]), [, m] = useState([]), [, g] = useAtom$1(canvasIframeAtom), [b, j] = useSelectedStylingBlocks(), f = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), C = (R) => {
3574
+ const [o] = useCanvasWidth(), [, n] = useSelectedBlockIds(), r = useSelectedBlock(), [, a] = useHighlightBlockId(), l = useRef(null), i = useRef(null), [c, d] = useState({ width: 0, height: 0 }), p = useCanvasScale(c), [u, x] = useState([]), [, m] = useState([]), [, g] = useAtom$1(canvasIframeAtom), [b, j] = useSelectedStylingBlocks(), f = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), C = (R) => {
3575
3575
  d((T) => ({ ...T, width: R }));
3576
3576
  };
3577
3577
  useEffect(() => {
@@ -3618,7 +3618,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3618
3618
  contentDidMount: () => g(l.current),
3619
3619
  ref: l,
3620
3620
  id: "canvas-iframe",
3621
- style: { ...u, ...isEmpty(u) ? { width: `${o}px` } : {} },
3621
+ style: { ...p, ...isEmpty(p) ? { width: `${o}px` } : {} },
3622
3622
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3623
3623
  initialContent: I,
3624
3624
  children: [
@@ -3627,7 +3627,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3627
3627
  BlockActionsStatic,
3628
3628
  {
3629
3629
  block: r,
3630
- selectedBlockElement: first(p)
3630
+ selectedBlockElement: first(u)
3631
3631
  }
3632
3632
  ),
3633
3633
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
@@ -3742,7 +3742,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3742
3742
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3743
3743
  ] }, l))
3744
3744
  ] }) });
3745
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-C1ImRmIp.js")), CanvasArea = () => {
3745
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-B4OwhGBq.js")), CanvasArea = () => {
3746
3746
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3747
3747
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
3748
3748
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas, {}) }) }),
@@ -3820,8 +3820,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3820
3820
  const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: R }, T) => {
3821
3821
  T && (a(R), i.current = R);
3822
3822
  }, {
3823
- bodyFont: u,
3824
- headingFont: p,
3823
+ bodyFont: p,
3824
+ headingFont: u,
3825
3825
  primaryColor: x,
3826
3826
  bodyTextDarkColor: m,
3827
3827
  bodyTextLightColor: g,
@@ -3833,12 +3833,12 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3833
3833
  let C = {
3834
3834
  headingFont: y({
3835
3835
  title: c("Theme Config.Heading Font"),
3836
- default: p,
3836
+ default: u,
3837
3837
  options: FONTS
3838
3838
  }),
3839
3839
  bodyFont: y({
3840
3840
  title: c("Theme Config.Body Font"),
3841
- default: u,
3841
+ default: p,
3842
3842
  options: FONTS
3843
3843
  }),
3844
3844
  roundedCorners: s$1({
@@ -4092,13 +4092,13 @@ function BiExpandVertical(o) {
4092
4092
  }
4093
4093
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4094
4094
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4095
- let u = null;
4096
- const p = o.children.length > 0, { highlightBlock: x, clearHighlight: m } = useBlockHighlight(), { id: g, data: b, isSelected: j, willReceiveDrop: f, isDragging: v, isEditing: C, handleClick: w } = o, I = (E) => {
4095
+ let p = null;
4096
+ const u = o.children.length > 0, { highlightBlock: x, clearHighlight: m } = useBlockHighlight(), { id: g, data: b, isSelected: j, willReceiveDrop: f, isDragging: v, isEditing: C, handleClick: w } = o, I = (E) => {
4097
4097
  E.stopPropagation(), !i.includes(g) && o.toggle();
4098
4098
  }, R = (E) => {
4099
- E.isInternal && (u = E.isOpen, E.isOpen && E.close());
4099
+ E.isInternal && (p = E.isOpen, E.isOpen && E.close());
4100
4100
  }, T = (E) => {
4101
- E.isInternal && u !== null && (u ? E.open() : E.close(), u = null);
4101
+ E.isInternal && p !== null && (p ? E.open() : E.close(), p = null);
4102
4102
  }, k = (E) => {
4103
4103
  E.stopPropagation(), !o.isOpen && !i.includes(g) && o.toggle(), w(E);
4104
4104
  };
@@ -4165,7 +4165,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4165
4165
  "div",
4166
4166
  {
4167
4167
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
4168
- children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: I, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4168
+ children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: I, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4169
4169
  }
4170
4170
  ),
4171
4171
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
@@ -4554,7 +4554,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4554
4554
  }
4555
4555
  }
4556
4556
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
4557
- var u, p, x, m, g, b, j, f;
4557
+ var p, u, x, m, g, b, j, f;
4558
4558
  if (r.type === "comment") return [];
4559
4559
  let a = { _id: generateUUID() };
4560
4560
  if (n && (a._parent = n.block._id), r.type === "text")
@@ -4588,8 +4588,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4588
4588
  ];
4589
4589
  a = {
4590
4590
  ...a,
4591
- href: ((u = l.find((C) => C.key === "href")) == null ? void 0 : u.value) || "",
4592
- hrefType: ((p = l.find((C) => C.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4591
+ href: ((p = l.find((C) => C.key === "href")) == null ? void 0 : p.value) || "",
4592
+ hrefType: ((u = l.find((C) => C.key === "data-vbtype")) == null ? void 0 : u.value) || "video",
4593
4593
  autoplay: ((x = l.find((C) => C.key === "data-autoplay")) == null ? void 0 : x.value) === "true",
4594
4594
  maxWidth: ((g = (m = l.find((C) => C.key === "data-maxwidth")) == null ? void 0 : m.value) == null ? void 0 : g.replace("px", "")) || "",
4595
4595
  backdropColor: ((b = l.find((C) => C.key === "data-overlay")) == null ? void 0 : b.value) || "",
@@ -4665,19 +4665,19 @@ function ExpandableObject(o) {
4665
4665
  openBracket: i,
4666
4666
  closeBracket: c,
4667
4667
  level: d,
4668
- style: u,
4669
- shouldExpandNode: p,
4668
+ style: p,
4669
+ shouldExpandNode: u,
4670
4670
  clickToExpandNode: x
4671
4671
  } = o;
4672
- const m = useRef(!1), [g, b, j] = useBool(() => p(d, r, n));
4672
+ const m = useRef(!1), [g, b, j] = useBool(() => u(d, r, n));
4673
4673
  useEffect(() => {
4674
- m.current ? j(p(d, r, n)) : m.current = !0;
4675
- }, [p]);
4676
- const f = g ? u.collapseIcon : u.expandIcon, v = g ? "collapse JSON" : "expand JSON", C = useComponentId(), w = d + 1, I = a.length - 1, R = (T) => {
4674
+ m.current ? j(u(d, r, n)) : m.current = !0;
4675
+ }, [u]);
4676
+ const f = g ? p.collapseIcon : p.expandIcon, v = g ? "collapse JSON" : "expand JSON", C = useComponentId(), w = d + 1, I = a.length - 1, R = (T) => {
4677
4677
  T.key === " " && (T.preventDefault(), b());
4678
4678
  };
4679
4679
  return /* @__PURE__ */ createElement("div", {
4680
- className: u.basicChildStyle,
4680
+ className: p.basicChildStyle,
4681
4681
  role: "list"
4682
4682
  }, /* @__PURE__ */ createElement("span", {
4683
4683
  className: f,
@@ -4689,28 +4689,28 @@ function ExpandableObject(o) {
4689
4689
  "aria-expanded": g,
4690
4690
  "aria-controls": g ? C : void 0
4691
4691
  }), n && (x ? /* @__PURE__ */ createElement("span", {
4692
- className: u.clickableLabel,
4692
+ className: p.clickableLabel,
4693
4693
  onClick: b,
4694
4694
  onKeyDown: R,
4695
4695
  role: "button",
4696
4696
  tabIndex: -1
4697
4697
  }, n, ":") : /* @__PURE__ */ createElement("span", {
4698
- className: u.label
4698
+ className: p.label
4699
4699
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4700
- className: u.punctuation
4700
+ className: p.punctuation
4701
4701
  }, i), g ? /* @__PURE__ */ createElement("div", {
4702
4702
  id: C
4703
4703
  }, a.map((T, k) => /* @__PURE__ */ createElement(DataRender, {
4704
4704
  key: T[0] || k,
4705
4705
  field: T[0],
4706
4706
  value: T[1],
4707
- style: u,
4707
+ style: p,
4708
4708
  lastElement: k === I,
4709
4709
  level: w,
4710
- shouldExpandNode: p,
4710
+ shouldExpandNode: u,
4711
4711
  clickToExpandNode: x
4712
4712
  }))) : /* @__PURE__ */ createElement("span", {
4713
- className: u.collapsedContent,
4713
+ className: p.collapsedContent,
4714
4714
  onClick: b,
4715
4715
  onKeyDown: R,
4716
4716
  role: "button",
@@ -4719,9 +4719,9 @@ function ExpandableObject(o) {
4719
4719
  "aria-label": v,
4720
4720
  "aria-expanded": g
4721
4721
  }), /* @__PURE__ */ createElement("span", {
4722
- className: u.punctuation
4722
+ className: p.punctuation
4723
4723
  }, c), !l && /* @__PURE__ */ createElement("span", {
4724
- className: u.punctuation
4724
+ className: p.punctuation
4725
4725
  }, ","));
4726
4726
  }
4727
4727
  function EmptyObject(o) {
@@ -4771,7 +4771,7 @@ function JsonObject(o) {
4771
4771
  style: a,
4772
4772
  shouldExpandNode: i,
4773
4773
  clickToExpandNode: c,
4774
- data: Object.keys(r).map((u) => [u, r[u]])
4774
+ data: Object.keys(r).map((p) => [p, r[p]])
4775
4775
  });
4776
4776
  }
4777
4777
  function JsonArray(o) {
@@ -4800,7 +4800,7 @@ function JsonArray(o) {
4800
4800
  style: a,
4801
4801
  shouldExpandNode: c,
4802
4802
  clickToExpandNode: d,
4803
- data: r.map((u) => [void 0, u])
4803
+ data: r.map((p) => [void 0, p])
4804
4804
  });
4805
4805
  }
4806
4806
  function JsonPrimitiveValue(o) {
@@ -4864,8 +4864,8 @@ function getPathAndTypes(o) {
4864
4864
  const n = [], r = {};
4865
4865
  function a(l, i) {
4866
4866
  forEach(i, (c, d) => {
4867
- const u = l ? `${l}.${d}` : d, p = isArray$1(c) ? "list" : typeof c;
4868
- n.push(u), r[u] = p === "string" ? "text" : p === "object" ? "model" : p, p === "object" && !isArray$1(c) && a(u, c);
4867
+ const p = l ? `${l}.${d}` : d, u = isArray$1(c) ? "list" : typeof c;
4868
+ n.push(p), r[p] = u === "string" ? "text" : u === "object" ? "model" : u, u === "object" && !isArray$1(c) && a(p, c);
4869
4869
  });
4870
4870
  }
4871
4871
  return a("", omit(o, ["styles", "_type", "_id", "_name", "_bindings"])), { paths: n, pathsType: r };
@@ -4902,9 +4902,9 @@ const ViewData = ({ data: o, fullView: n }) => {
4902
4902
  dataType: i,
4903
4903
  appliedBindings: c
4904
4904
  }) => {
4905
- const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, x = o === "PROP", [m, g] = useState(!1), b = useMemo(() => o === "PROP" ? d.filter(
4906
- (j) => !includes(c, j) && get(p, `props.${first(split(j, "."))}.binding`)
4907
- ) : d.filter((j) => i === get(u, j, "")), [o, d, c, i, p]);
4905
+ const { paths: d, pathsType: p } = getPathAndTypes(a), u = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, x = o === "PROP", [m, g] = useState(!1), b = useMemo(() => o === "PROP" ? d.filter(
4906
+ (j) => !includes(c, j) && get(u, `props.${first(split(j, "."))}.binding`)
4907
+ ) : d.filter((j) => i === get(p, j, "")), [o, d, c, i, u]);
4908
4908
  return useEffect(() => {
4909
4909
  n && l(n);
4910
4910
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -4946,7 +4946,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4946
4946
  /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === j ? "" : "opacity-0"}` }),
4947
4947
  j
4948
4948
  ] }),
4949
- x ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, j, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, j) }) })
4949
+ x ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(p, j, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, j) }) })
4950
4950
  ]
4951
4951
  },
4952
4952
  j
@@ -4963,17 +4963,17 @@ const ViewData = ({ data: o, fullView: n }) => {
4963
4963
  editMode: r,
4964
4964
  item: a
4965
4965
  }) => {
4966
- const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), x = useCallback(
4966
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), p = useSelectedBlock(), [u] = useChaiExternalData(), x = useCallback(
4967
4967
  (b, j) => {
4968
4968
  if (isEmpty(b)) return "";
4969
4969
  {
4970
- const f = get(j === "PROP" ? u : p, b, "");
4970
+ const f = get(j === "PROP" ? p : u, b, "");
4971
4971
  if (isArray$1(f)) return "list";
4972
4972
  const v = typeof f;
4973
4973
  return v === "string" ? "text" : v === "object" ? "model" : v;
4974
4974
  }
4975
4975
  },
4976
- [u, p]
4976
+ [p, u]
4977
4977
  ), [m, g] = useState(r ? x(a.key, "PROP") : "");
4978
4978
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4979
4979
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
@@ -4993,7 +4993,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4993
4993
  const j = x(b, "PROP");
4994
4994
  i(b), m !== j && d(""), g(j);
4995
4995
  },
4996
- data: u,
4996
+ data: p,
4997
4997
  dataType: m,
4998
4998
  appliedBindings: o
4999
4999
  }
@@ -5011,7 +5011,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5011
5011
  const j = x(b, "PATH");
5012
5012
  d(m === j ? b : "");
5013
5013
  },
5014
- data: p,
5014
+ data: u,
5015
5015
  dataType: m,
5016
5016
  appliedBindings: o
5017
5017
  }
@@ -5038,8 +5038,8 @@ const ViewData = ({ data: o, fullView: n }) => {
5038
5038
  item: i,
5039
5039
  editMode: l,
5040
5040
  appliedBindings: a,
5041
- onAddBinding: (u) => {
5042
- r(u), d(!1);
5041
+ onAddBinding: (p) => {
5042
+ r(p), d(!1);
5043
5043
  }
5044
5044
  }
5045
5045
  ) })
@@ -5052,16 +5052,16 @@ const ViewData = ({ data: o, fullView: n }) => {
5052
5052
  dataProvider: l,
5053
5053
  appliedBindings: i
5054
5054
  }) => {
5055
- const [c, d] = useState("string"), u = (p, x) => {
5056
- if (isEmpty(p)) return "";
5055
+ const [c, d] = useState("string"), p = (u, x) => {
5056
+ if (isEmpty(u)) return "";
5057
5057
  {
5058
- const m = get(a, p, "");
5058
+ const m = get(a, u, "");
5059
5059
  if (isArray$1(m)) return "list";
5060
5060
  const g = typeof m;
5061
5061
  return g === "string" ? "text" : g === "object" ? "model" : g;
5062
5062
  }
5063
5063
  };
5064
- return useEffect(() => d(() => u(o.key)), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
5064
+ return useEffect(() => d(() => p(o.key)), [o.key]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex flex-col rounded-md border border-border p-2", children: [
5065
5065
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm font-normal text-gray-500", children: o.key }),
5066
5066
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "font-medium leading-5", children: o.value }),
5067
5067
  /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(l, o.value, "") }),
@@ -5089,10 +5089,10 @@ const ViewData = ({ data: o, fullView: n }) => {
5089
5089
  if (isEmpty(i)) return !1;
5090
5090
  const m = last(i);
5091
5091
  return isEmpty(m == null ? void 0 : m.key) || isEmpty(m == null ? void 0 : m.value);
5092
- }, [a, i]), u = (m) => {
5092
+ }, [a, i]), p = (m) => {
5093
5093
  const g = filter(i, (b) => b.key !== m.key);
5094
5094
  c([...g, m]), x([...g, m]);
5095
- }, p = (m) => {
5095
+ }, u = (m) => {
5096
5096
  const g = filter(i, (b, j) => m !== j);
5097
5097
  x([...g]);
5098
5098
  }, x = useCallback(
@@ -5117,8 +5117,8 @@ const ViewData = ({ data: o, fullView: n }) => {
5117
5117
  NewDataBindingPair,
5118
5118
  {
5119
5119
  item: m,
5120
- onAddBinding: u,
5121
- onRemove: () => p(g),
5120
+ onAddBinding: p,
5121
+ onRemove: () => u(g),
5122
5122
  selectedBlock: r,
5123
5123
  dataProvider: a,
5124
5124
  appliedBindings: map(i, "key")
@@ -5131,7 +5131,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5131
5131
  {
5132
5132
  disabled: d,
5133
5133
  appliedBindings: map(i, "key"),
5134
- onAddBinding: u,
5134
+ onAddBinding: p,
5135
5135
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5136
5136
  "span",
5137
5137
  {
@@ -5212,7 +5212,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5212
5212
  }
5213
5213
  )
5214
5214
  ] });
5215
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-Ds_3IihK.js")), UploadImages = React__default.lazy(() => import("./UploadImages-VZ7-y0rA.js")), ImagesPanel = ({
5215
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-CYTY_ol5.js")), UploadImages = React__default.lazy(() => import("./UploadImages-DjGNkHdG.js")), ImagesPanel = ({
5216
5216
  isModalView: o = !1,
5217
5217
  onSelect: n = () => {
5218
5218
  }
@@ -5222,7 +5222,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5222
5222
  );
5223
5223
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col", children: [
5224
5224
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: o && l ? "Unsplash images" : o ? "Select or upload images" : "Images" }) }),
5225
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: c, onValueChange: (u) => d(u), className: "flex h-full w-full flex-col py-2", children: [
5225
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Tabs, { value: c, onValueChange: (p) => d(p), className: "flex h-full w-full flex-col py-2", children: [
5226
5226
  !(l || i) && /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "w-full", children: [
5227
5227
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "upload", className: "w-full", children: "Upload" }),
5228
5228
  /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "unsplash", className: "w-full", children: "Unsplash" })
@@ -5259,8 +5259,8 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5259
5259
  className: "text-xs",
5260
5260
  placeholder: c("Enter image URL"),
5261
5261
  value: o,
5262
- onBlur: ({ target: { value: u } }) => a(r, u),
5263
- onChange: (u) => n(u.target.value)
5262
+ onBlur: ({ target: { value: p } }) => a(r, p),
5263
+ onChange: (p) => n(p.target.value)
5264
5264
  }
5265
5265
  )
5266
5266
  ] })
@@ -5307,14 +5307,14 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5307
5307
  onChange: r
5308
5308
  }) => {
5309
5309
  var _;
5310
- const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (S, N) => []), [i, c] = useState(!1), [d, u] = useState(!1), [p, x] = useState(!1), [m, g] = useState("pages"), [b, j] = useState(""), [f, v] = useState([]), [C, w] = useState(-1), I = useRef(null), R = (_ = n == null ? void 0 : n.find((S) => S.key === m)) == null ? void 0 : _.name;
5310
+ const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (S, N) => []), [i, c] = useState(!1), [d, p] = useState(!1), [u, x] = useState(!1), [m, g] = useState("pages"), [b, j] = useState(""), [f, v] = useState([]), [C, w] = useState(-1), I = useRef(null), R = (_ = n == null ? void 0 : n.find((S) => S.key === m)) == null ? void 0 : _.name;
5311
5311
  useEffect(() => {
5312
5312
  if (!o || d || !startsWith(o, "collection:") || i) return;
5313
5313
  const S = split(o, ":"), N = get(S, 1, "pages") || "pages";
5314
5314
  g(N), j(""), v([]), w(-1), (async () => {
5315
- u(!0);
5315
+ p(!0);
5316
5316
  const L = await l(N, [get(S, 2, "pages")]);
5317
- L && Array.isArray(L) && j(get(L, [0, "name"], "")), c(!0), u(!1);
5317
+ L && Array.isArray(L) && j(get(L, [0, "name"], "")), c(!0), p(!1);
5318
5318
  })();
5319
5319
  }, [o]);
5320
5320
  const T = useDebouncedCallback(
@@ -5325,7 +5325,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5325
5325
  const N = await l(m, S);
5326
5326
  v(N);
5327
5327
  }
5328
- u(!1), w(-1);
5328
+ p(!1), w(-1);
5329
5329
  },
5330
5330
  [m],
5331
5331
  300
@@ -5358,7 +5358,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5358
5358
  const A = () => {
5359
5359
  j(""), v([]), w(-1), x(!1), r("");
5360
5360
  }, E = (S) => {
5361
- j(S), x(!isEmpty(S)), u(!0), T(S);
5361
+ j(S), x(!isEmpty(S)), p(!0), T(S);
5362
5362
  };
5363
5363
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5364
5364
  /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: m, onChange: (S) => g(S.target.value), children: map(n, (S) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: S.key, children: S.name }, S.key)) }),
@@ -5376,10 +5376,10 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5376
5376
  ),
5377
5377
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: b && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: A, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
5378
5378
  ] }),
5379
- (d || !isEmpty(f) || p && isEmpty(f)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: d ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
5379
+ (d || !isEmpty(f) || u && isEmpty(f)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: d ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
5380
5380
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
5381
5381
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
5382
- ] }) : p && isEmpty(f) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
5382
+ ] }) : u && isEmpty(f) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
5383
5383
  a("No results found for"),
5384
5384
  ' "',
5385
5385
  b,
@@ -5403,11 +5403,11 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5403
5403
  )) }) })
5404
5404
  ] });
5405
5405
  }, LinkField = ({ schema: o, formData: n, onChange: r }) => {
5406
- const { t: a } = useTranslation(), { type: l = "collection", href: i = "", target: c = "self" } = n, d = useBuilderProp("collections", []), u = l === "collection" && isEmpty(d) ? "url" : l;
5406
+ const { t: a } = useTranslation(), { type: l = "collection", href: i = "", target: c = "self" } = n, d = useBuilderProp("collections", []), p = l === "collection" && isEmpty(d) ? "url" : l;
5407
5407
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5408
5408
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
5409
5409
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
5410
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (p) => r({ ...n, type: p.target.value }), children: map(
5410
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (u) => r({ ...n, type: u.target.value }), children: map(
5411
5411
  [
5412
5412
  ...isEmpty(d) ? [] : [{ const: "collection", title: a("Goto Page") }],
5413
5413
  { const: "url", title: a("Open URL") },
@@ -5415,14 +5415,14 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5415
5415
  { const: "telephone", title: a("Call Phone") },
5416
5416
  { const: "scroll", title: a("Scroll to element") }
5417
5417
  ],
5418
- (p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)
5418
+ (u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.const, children: u.title }, u.const)
5419
5419
  ) }),
5420
- u === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
5420
+ p === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
5421
5421
  CollectionField,
5422
5422
  {
5423
5423
  href: i,
5424
5424
  collections: d,
5425
- onChange: (p) => r({ ...n, href: p })
5425
+ onChange: (u) => r({ ...n, href: u })
5426
5426
  }
5427
5427
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
5428
5428
  "input",
@@ -5433,11 +5433,11 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5433
5433
  name: "href",
5434
5434
  type: "text",
5435
5435
  value: i,
5436
- onChange: (p) => r({ ...n, href: p.target.value }),
5436
+ onChange: (u) => r({ ...n, href: u.target.value }),
5437
5437
  placeholder: a(l === "url" ? "Enter URL" : l === "scroll" ? "#ElementID" : "Enter details")
5438
5438
  }
5439
5439
  ),
5440
- u === "url" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5440
+ p === "url" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5441
5441
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5442
5442
  "input",
5443
5443
  {
@@ -5458,8 +5458,8 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5458
5458
  const { t: r } = useTranslation(), [, a] = useCodeEditor(), l = useSelectedBlock();
5459
5459
  if (typeof window > "u") return null;
5460
5460
  const i = o.replace("root.", ""), c = get(l, i, ""), d = () => {
5461
- const u = l == null ? void 0 : l._id;
5462
- a({ blockId: u, blockProp: i, placeholder: n, initialCode: get(l, i, c) });
5461
+ const p = l == null ? void 0 : l._id;
5462
+ a({ blockId: p, blockProp: i, placeholder: n, initialCode: get(l, i, c) });
5463
5463
  };
5464
5464
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex flex-col gap-y-1", children: [
5465
5465
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5473,15 +5473,15 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5473
5473
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
5474
5474
  ] });
5475
5475
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5476
- const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: x, languages: m } = useLanguages(), g = m.length === 0 ? "" : p.length ? p : x;
5476
+ const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: p } = useTranslation(), { selectedLang: u, fallbackLang: x, languages: m } = useLanguages(), g = m.length === 0 ? "" : u.length ? u : x;
5477
5477
  Object.keys(n).forEach((j) => {
5478
5478
  const f = n[j];
5479
5479
  if (includes(["slot", "styles"], f.type)) return;
5480
5480
  const v = j;
5481
- c.properties[v] = getBlockJSONFromSchemas(f, u, g), d[v] = getBlockJSONFromUISchemas(f);
5481
+ c.properties[v] = getBlockJSONFromSchemas(f, p, g), d[v] = getBlockJSONFromUISchemas(f);
5482
5482
  }), useEffect(() => {
5483
5483
  i(r);
5484
- }, [o, p]);
5484
+ }, [o, u]);
5485
5485
  const b = useThrottledCallback(
5486
5486
  async ({ formData: j }, f) => {
5487
5487
  a({ formData: j }, f);
@@ -5532,7 +5532,7 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5532
5532
  id: "show-on-canvas",
5533
5533
  checked: c,
5534
5534
  onCheckedChange: (d) => {
5535
- d ? (n((u) => [...u, r._id]), a([r._id])) : n((u) => u.filter((p) => p !== r._id));
5535
+ d ? (n((p) => [...p, r._id]), a([r._id])) : n((p) => p.filter((u) => u !== r._id));
5536
5536
  }
5537
5537
  }
5538
5538
  ),
@@ -5580,14 +5580,14 @@ const ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5580
5580
  }), a;
5581
5581
  };
5582
5582
  function BlockSettings() {
5583
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: f }, v, C) => {
5583
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), p = useBuilderProp("dataBindingSupport", !1), u = ({ formData: f }, v, C) => {
5584
5584
  if (v && (c == null ? void 0 : c._id) === n._id) {
5585
5585
  const w = v.replace("root.", "");
5586
5586
  a([n._id], { [w]: get(f, w) }, C);
5587
5587
  }
5588
5588
  }, x = useCallback(
5589
5589
  debounce(({ formData: f }, v, C) => {
5590
- p({ formData: f }, v, C), d(f);
5590
+ u({ formData: f }, v, C), d(f);
5591
5591
  }, 1500),
5592
5592
  [n == null ? void 0 : n._id, o]
5593
5593
  ), m = ({ formData: f }, v) => {
@@ -5602,10 +5602,10 @@ function BlockSettings() {
5602
5602
  const f = cloneDeep(get(l, "props", {}));
5603
5603
  return each(f, (v, C) => {
5604
5604
  get(v, "hidden", !1) && delete f[C];
5605
- }), u && each(g, (v) => delete f[v]), f;
5606
- }, [l, g, u]), j = get(l, "server", !1);
5605
+ }), p && each(g, (v) => delete f[v]), f;
5606
+ }, [l, g, p]), j = get(l, "server", !1);
5607
5607
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5608
- u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5608
+ p ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5609
5609
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
5610
5610
  /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
5611
5611
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5621,7 +5621,7 @@ function BlockSettings() {
5621
5621
  {
5622
5622
  bindingData: get(n, "_bindings", {}),
5623
5623
  onChange: (f) => {
5624
- p({ formData: { _bindings: f } }, "root._bindings");
5624
+ u({ formData: { _bindings: f } }, "root._bindings");
5625
5625
  }
5626
5626
  }
5627
5627
  ) })
@@ -5683,7 +5683,7 @@ function promptWithLanguage(o, n, r) {
5683
5683
  ${a}`;
5684
5684
  }
5685
5685
  const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5686
- const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore(), { selectedLang: u, fallbackLang: p } = useLanguages(), x = u.length ? u : p;
5686
+ 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(), x = p.length ? p : u;
5687
5687
  return {
5688
5688
  askAi: useCallback(
5689
5689
  async (m, g, b, j) => {
@@ -5692,7 +5692,7 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5692
5692
  try {
5693
5693
  const f = m === "content" ? cloneDeep(getBlockWithChildren(g, d)) : [cloneDeep(d.find((R) => R._id === g))];
5694
5694
  set(f, "0._parent", null);
5695
- const v = u === p ? "" : u, C = await l(m, promptWithLanguage(b, x, m), f, v), { blocks: w, error: I } = C;
5695
+ const v = p === u ? "" : p, C = await l(m, promptWithLanguage(b, x, m), f, v), { blocks: w, error: I } = C;
5696
5696
  if (I) {
5697
5697
  a(I);
5698
5698
  return;
@@ -5709,8 +5709,8 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5709
5709
  l,
5710
5710
  n,
5711
5711
  d,
5712
- u,
5713
5712
  p,
5713
+ u,
5714
5714
  x,
5715
5715
  c,
5716
5716
  i
@@ -5737,10 +5737,10 @@ function Countdown() {
5737
5737
  const [o, n] = useState(SECONDS), [r, a] = useState(!1);
5738
5738
  useEffect(() => {
5739
5739
  if (r && o > 0) {
5740
- const u = setTimeout(() => {
5740
+ const p = setTimeout(() => {
5741
5741
  n(o - 0.1);
5742
5742
  }, 100);
5743
- return () => clearTimeout(u);
5743
+ return () => clearTimeout(p);
5744
5744
  } else o <= 0 && (a(!1), n(SECONDS));
5745
5745
  }, [r, o]);
5746
5746
  const l = () => {
@@ -5784,14 +5784,14 @@ function Countdown() {
5784
5784
  ] });
5785
5785
  }
5786
5786
  const AskAIStyles = ({ blockId: o }) => {
5787
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, x] = useState();
5787
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), p = useRef(null), [u, x] = useState();
5788
5788
  useEffect(() => {
5789
5789
  var g;
5790
5790
  (g = d.current) == null || g.focus();
5791
5791
  }, []);
5792
5792
  const m = (g) => {
5793
5793
  const { usage: b } = g || {};
5794
- !l && b && x(b), u.current = setTimeout(() => x(void 0), 1e4), l || c("");
5794
+ !l && b && x(b), p.current = setTimeout(() => x(void 0), 1e4), l || c("");
5795
5795
  };
5796
5796
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5797
5797
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
@@ -5805,7 +5805,7 @@ const AskAIStyles = ({ blockId: o }) => {
5805
5805
  className: "w-full border border-border focus:border-0",
5806
5806
  rows: 3,
5807
5807
  onKeyDown: (g) => {
5808
- g.key === "Enter" && (g.preventDefault(), u.current && clearTimeout(u.current), x(void 0), r("styles", o, i, m));
5808
+ g.key === "Enter" && (g.preventDefault(), p.current && clearTimeout(p.current), x(void 0), r("styles", o, i, m));
5809
5809
  }
5810
5810
  }
5811
5811
  ),
@@ -5815,7 +5815,7 @@ const AskAIStyles = ({ blockId: o }) => {
5815
5815
  {
5816
5816
  disabled: i.trim().length < 5 || a,
5817
5817
  onClick: () => {
5818
- u.current && clearTimeout(u.current), x(void 0), r("styles", o, i, m);
5818
+ p.current && clearTimeout(p.current), x(void 0), r("styles", o, i, m);
5819
5819
  },
5820
5820
  variant: "default",
5821
5821
  className: "w-fit",
@@ -5834,11 +5834,11 @@ const AskAIStyles = ({ blockId: o }) => {
5834
5834
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
5835
5835
  ] }) : null
5836
5836
  ] }),
5837
- p ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
5837
+ u ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
5838
5838
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
5839
5839
  n("Total tokens used"),
5840
5840
  ": ",
5841
- p.totalTokens
5841
+ u.totalTokens
5842
5842
  ] }),
5843
5843
  /* @__PURE__ */ jsxRuntimeExports.jsx(Countdown, {})
5844
5844
  ] }) }) : null,
@@ -5852,9 +5852,9 @@ const AskAIStyles = ({ blockId: o }) => {
5852
5852
  });
5853
5853
  function ManualClasses() {
5854
5854
  var T;
5855
- const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), x = (T = first(n)) == null ? void 0 : T.prop, m = reject((get(r, x, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
5855
+ const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, p] = useState(""), { toast: u } = useToast(), x = (T = first(n)) == null ? void 0 : T.prop, m = reject((get(r, x, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), g = () => {
5856
5856
  const k = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5857
- a(i, k, !0), u("");
5857
+ a(i, k, !0), p("");
5858
5858
  }, [b, j] = useState([]), f = ({ value: k }) => {
5859
5859
  const B = k.trim().toLowerCase(), A = B.match(/.+:/g);
5860
5860
  let E = [];
@@ -5879,18 +5879,18 @@ function ManualClasses() {
5879
5879
  onKeyDown: (k) => {
5880
5880
  k.key === "Enter" && d.trim() !== "" && g();
5881
5881
  },
5882
- onChange: (k, { newValue: B }) => u(B),
5882
+ onChange: (k, { newValue: B }) => p(B),
5883
5883
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5884
5884
  }, R = () => {
5885
5885
  if (navigator.clipboard === void 0) {
5886
- p({
5886
+ u({
5887
5887
  title: o("Clipboard not supported"),
5888
5888
  description: o("Please use Chrome, Firefox or Safari"),
5889
5889
  variant: "destructive"
5890
5890
  });
5891
5891
  return;
5892
5892
  }
5893
- navigator.clipboard.writeText(m.join(" ")), p({
5893
+ navigator.clipboard.writeText(m.join(" ")), u({
5894
5894
  title: o("Copied"),
5895
5895
  description: o("Classes copied to clipboard")
5896
5896
  });
@@ -6264,7 +6264,7 @@ const EDITOR_ICONS = {
6264
6264
  DropDown,
6265
6265
  {
6266
6266
  rounded: o,
6267
- onChange: (u) => r(u, n),
6267
+ onChange: (p) => r(p, n),
6268
6268
  selected: i,
6269
6269
  options: a,
6270
6270
  disabled: !c
@@ -6278,23 +6278,23 @@ function DropDown({ selected: o, onChange: n, rounded: r = !1, options: a, disab
6278
6278
  {
6279
6279
  disabled: !a.length || l,
6280
6280
  className: `${r ? "rounded-md border border-border" : "border-0"} disable:bg-gray-500 h-full w-full truncate rounded bg-background px-2 py-1 text-xs outline-none disabled:cursor-not-allowed`,
6281
- onChange: (u) => n(u.target.value),
6282
- onKeyDown: (u) => {
6283
- u.ctrlKey && (u.key === "z" && c(), u.key === "y" && d());
6281
+ onChange: (p) => n(p.target.value),
6282
+ onKeyDown: (p) => {
6283
+ p.ctrlKey && (p.key === "z" && c(), p.key === "y" && d());
6284
6284
  },
6285
6285
  value: i,
6286
6286
  children: [
6287
6287
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: "" }),
6288
6288
  React__default.Children.toArray(
6289
- a.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: u, children: u }))
6289
+ a.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { className: "bg-transparent", value: p, children: p }))
6290
6290
  )
6291
6291
  ]
6292
6292
  }
6293
6293
  );
6294
6294
  }
6295
6295
  const RangeChoices = ({ property: o, onChange: n }) => {
6296
- const { canReset: r, canChange: a } = useContext(StyleContext), l = useCurrentClassByProperty(o), i = useMemo(() => get(l, "cls", ""), [l]), c = useMemo(() => get(CLASSES_LIST, `${o}.classes`, [""]), [o]), d = c.indexOf(i) > -1 ? c.indexOf(i) : 0, u = /\[.*\]/g.test(i);
6297
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs", children: u ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-[5px] px-2", children: i }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6296
+ const { canReset: r, canChange: a } = useContext(StyleContext), l = useCurrentClassByProperty(o), i = useMemo(() => get(l, "cls", ""), [l]), c = useMemo(() => get(CLASSES_LIST, `${o}.classes`, [""]), [o]), d = c.indexOf(i) > -1 ? c.indexOf(i) : 0, p = /\[.*\]/g.test(i);
6297
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-row divide-x divide-solid divide-border rounded border border-border text-xs", children: p ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-[5px] px-2", children: i }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6298
6298
  /* @__PURE__ */ jsxRuntimeExports.jsx(
6299
6299
  "button",
6300
6300
  {
@@ -6355,12 +6355,12 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6355
6355
  ringColor: "ring",
6356
6356
  ringOffsetColor: "ring-offset"
6357
6357
  }, ColorChoice = ({ property: o, onChange: n }) => {
6358
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), x = get(p, "1", ""), m = get(p, "2", ""), g = useCallback(
6358
+ 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("-"), x = get(u, "1", ""), m = get(u, "2", ""), g = useCallback(
6359
6359
  // eslint-disable-next-line no-shadow
6360
6360
  (j) => {
6361
- ["current", "inherit", "transparent", "black", "white"].includes(j) ? (c([]), u({ color: j })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((f) => ({ ...f, color: j, shade: f.shade ? f.shade : "500" })));
6361
+ ["current", "inherit", "transparent", "black", "white"].includes(j) ? (c([]), p({ color: j })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), p((f) => ({ ...f, color: j, shade: f.shade ? f.shade : "500" })));
6362
6362
  },
6363
- [c, u]
6363
+ [c, p]
6364
6364
  );
6365
6365
  useEffect(() => {
6366
6366
  if (["current", "inherit", "transparent", "black", "white"].includes(x))
@@ -6370,12 +6370,12 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6370
6370
  const b = useCallback(
6371
6371
  // eslint-disable-next-line no-shadow
6372
6372
  (j) => {
6373
- u({ color: x, shade: j });
6373
+ p({ color: x, shade: j });
6374
6374
  },
6375
6375
  [x]
6376
6376
  );
6377
6377
  return useEffect(() => {
6378
- u({ color: "", shade: "" });
6378
+ p({ color: "", shade: "" });
6379
6379
  }, [r]), useEffect(() => {
6380
6380
  const f = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6381
6381
  f.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(f, o);
@@ -6535,18 +6535,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6535
6535
  "button",
6536
6536
  {
6537
6537
  type: "button",
6538
- onMouseDown: (u) => {
6539
- const p = {
6538
+ onMouseDown: (p) => {
6539
+ const u = {
6540
6540
  onDrag: r,
6541
6541
  onDragEnd: a,
6542
6542
  dragging: !0,
6543
- dragStartY: u.pageY,
6543
+ dragStartY: p.pageY,
6544
6544
  dragStartValue: `${n}`,
6545
6545
  dragUnit: o,
6546
6546
  negative: i,
6547
6547
  cssProperty: c
6548
6548
  };
6549
- l(p), d(p);
6549
+ l(u), d(u);
6550
6550
  },
6551
6551
  color: void 0,
6552
6552
  className: "relative z-50 ml-1 hidden h-6 cursor-row-resize rounded bg-background/70 px-2 group-hover:inline",
@@ -6566,18 +6566,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6566
6566
  },
6567
6567
  a
6568
6568
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6569
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: x } = o, [m, g] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [b, j] = useState(!1), [f, v] = useState(""), [C, w] = useState(!1), [I, R] = useState(!1);
6569
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: p, units: u, negative: x } = o, [m, g] = useState(p != null && p.toLowerCase().includes("width") ? "%" : u[0]), [b, j] = useState(!1), [f, v] = useState(""), [C, w] = useState(!1), [I, R] = useState(!1);
6570
6570
  useEffect(() => {
6571
6571
  const { value: E, unit: _ } = getClassValueAndUnit(i);
6572
6572
  if (_ === "") {
6573
- l(E), g(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6573
+ l(E), g(p != null && p.toLowerCase().includes("width") ? "%" : first(u));
6574
6574
  return;
6575
6575
  }
6576
6576
  g(_), l(_ === "class" || isEmpty(E) ? "" : E);
6577
- }, [i, u, p]);
6577
+ }, [i, p, u]);
6578
6578
  const T = useThrottledCallback((E) => c(E), [c], THROTTLE_TIME), k = useThrottledCallback((E) => c(E, !1), [c], THROTTLE_TIME), B = useCallback(
6579
6579
  (E = !1) => {
6580
- const _ = getUserInputValues(`${a}`, p);
6580
+ const _ = getUserInputValues(`${a}`, u);
6581
6581
  if (get(_, "error", !1)) {
6582
6582
  j(!0);
6583
6583
  return;
@@ -6592,10 +6592,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6592
6592
  const L = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6593
6593
  E ? k(L) : T(L);
6594
6594
  },
6595
- [T, k, a, m, d, p]
6595
+ [T, k, a, m, d, u]
6596
6596
  ), A = useCallback(
6597
6597
  (E) => {
6598
- const _ = getUserInputValues(`${a}`, p);
6598
+ const _ = getUserInputValues(`${a}`, u);
6599
6599
  if (get(_, "error", !1)) {
6600
6600
  j(!0);
6601
6601
  return;
@@ -6609,7 +6609,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6609
6609
  const S = get(_, "unit") !== "" ? get(_, "unit") : E, L = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${S === "-" ? "" : S}]`;
6610
6610
  T(L);
6611
6611
  },
6612
- [T, a, d, p]
6612
+ [T, a, d, u]
6613
6613
  );
6614
6614
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: m === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6615
6615
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
@@ -6662,15 +6662,15 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6662
6662
  onClick: () => r(!n),
6663
6663
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
6664
6664
  children: [
6665
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: m }),
6666
- p.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6665
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${u.length === 1 ? "px-2 font-semibold" : ""}`, children: m }),
6666
+ u.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6667
6667
  ]
6668
6668
  }
6669
6669
  ) }),
6670
6670
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6671
6671
  UnitSelection,
6672
6672
  {
6673
- units: p,
6673
+ units: u,
6674
6674
  current: m,
6675
6675
  onSelect: (E) => {
6676
6676
  r(!1), g(E), A(E);
@@ -6699,7 +6699,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6699
6699
  currentValue: a,
6700
6700
  unit: m,
6701
6701
  negative: x,
6702
- cssProperty: u
6702
+ cssProperty: p
6703
6703
  }
6704
6704
  )
6705
6705
  ] }) }) });
@@ -6791,14 +6791,14 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6791
6791
  "2xl": "1536px"
6792
6792
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6793
6793
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6794
- }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, x] = useCanvasWidth(), m = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), b = useRemoveClassesFromBlocks(), [j] = useSelectedBlockIds(), f = useMemo(() => get(m, "fullCls", ""), [m]), v = useCallback(
6794
+ }, units: c, negative: d = !1 } = o, [p] = useDarkMode(), [u] = useStylingState(), [, x] = useCanvasWidth(), m = useCurrentClassByProperty(l), g = useAddClassesToBlocks(), b = useRemoveClassesFromBlocks(), [j] = useSelectedBlockIds(), f = useMemo(() => get(m, "fullCls", ""), [m]), v = useCallback(
6795
6795
  (k, B = !0) => {
6796
- const A = { dark: u, mq: x, mod: p, cls: k, property: l, fullCls: "" };
6797
- (u || p !== "") && (A.mq = "xs");
6796
+ const A = { dark: p, mq: x, mod: u, cls: k, property: l, fullCls: "" };
6797
+ (p || u !== "") && (A.mq = "xs");
6798
6798
  const E = generateFullClsName(A);
6799
6799
  g(j, [E], B);
6800
6800
  },
6801
- [j, u, x, p, l, g]
6801
+ [j, p, x, u, l, g]
6802
6802
  ), C = useCallback(() => {
6803
6803
  b(j, [f]);
6804
6804
  }, [j, f, b]), w = useMemo(() => canChangeClass(m, x), [m, x]);
@@ -6817,7 +6817,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6817
6817
  }[k]);
6818
6818
  },
6819
6819
  [I]
6820
- ), T = get(m, "dark", null) === u && get(m, "mod", null) === p && get(m, "mq", null) === x;
6820
+ ), T = get(m, "dark", null) === p && get(m, "mod", null) === u && get(m, "mq", null) === x;
6821
6821
  return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: w, canReset: m && T, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6822
6822
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${m && !T ? "text-foreground" : ""}`, children: n(a) }) }),
6823
6823
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
@@ -6851,7 +6851,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6851
6851
  "Current style is set at  ",
6852
6852
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
6853
6853
  getBreakpoint(get(m, "mq")),
6854
- u && !m.dark ? "(Light mode)" : ""
6854
+ p && !m.dark ? "(Light mode)" : ""
6855
6855
  ] }),
6856
6856
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
6857
6857
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -6879,7 +6879,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6879
6879
  units: i = basicUnits,
6880
6880
  negative: c = !1
6881
6881
  }) => {
6882
- const { t: d } = useTranslation(), [u, p] = useState(n[0].key), x = useSelectedBlockCurrentClasses(), m = useCallback((g) => map(x, "property").includes(g), [x]);
6882
+ const { t: d } = useTranslation(), [p, u] = useState(n[0].key), x = useSelectedBlockCurrentClasses(), m = useCallback((g) => map(x, "property").includes(g), [x]);
6883
6883
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6884
6884
  "div",
6885
6885
  {
@@ -6893,8 +6893,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6893
6893
  "button",
6894
6894
  {
6895
6895
  type: "button",
6896
- onClick: () => p(b),
6897
- className: `relative cursor-pointer rounded-full p-1 text-[8px] ${b === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6896
+ onClick: () => u(b),
6897
+ className: `relative cursor-pointer rounded-full p-1 text-[8px] ${b === p ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6898
6898
  children: [
6899
6899
  React__default.createElement("div", {
6900
6900
  className: m(b) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
@@ -6913,7 +6913,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6913
6913
  type: l,
6914
6914
  units: [...i],
6915
6915
  label: "",
6916
- property: u,
6916
+ property: p,
6917
6917
  negative: c
6918
6918
  }
6919
6919
  ) })
@@ -6922,10 +6922,10 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6922
6922
  );
6923
6923
  }, NestedOptions = ({ heading: o, items: n }) => {
6924
6924
  const { t: r } = useTranslation(), a = useSelectedBlockCurrentClasses(), l = useMemo(() => {
6925
- const i = (u) => flatten(
6926
- u.map((p) => p.styleType === "multiple" ? map(p.options, "key") : p.property)
6925
+ const i = (p) => flatten(
6926
+ p.map((u) => u.styleType === "multiple" ? map(u.options, "key") : u.property)
6927
6927
  ), c = flatten(
6928
- n.map((u) => u.styleType === "accordion" ? i(u.items) : u.styleType === "multiple" ? map(u.options, "key") : u.property)
6928
+ n.map((p) => p.styleType === "accordion" ? i(p.items) : p.styleType === "multiple" ? map(p.options, "key") : p.property)
6929
6929
  ), d = map(a, "property");
6930
6930
  return intersection(c, d).length > 0;
6931
6931
  }, [a, n]);
@@ -6945,11 +6945,11 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6945
6945
  const { t: n } = useTranslation(), r = useSelectedBlockCurrentClasses(), a = useCallback(
6946
6946
  (i = []) => {
6947
6947
  const c = {};
6948
- for (let u = 0; u < r.length; u++)
6949
- c[r[u].property] = r[u].cls;
6948
+ for (let p = 0; p < r.length; p++)
6949
+ c[r[p].property] = r[p].cls;
6950
6950
  let d = !0;
6951
- for (const u in i)
6952
- if (!has(c, u) || c[u] !== i[u]) {
6951
+ for (const p in i)
6952
+ if (!has(c, p) || c[p] !== i[p]) {
6953
6953
  d = !1;
6954
6954
  break;
6955
6955
  }
@@ -6967,8 +6967,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6967
6967
  const o = useSelectedBlock(), [n] = useSelectedStylingBlocks(), { t: r } = useTranslation(), a = useGlobalStylingPresets(), l = useAddClassesToBlocks(), i = getBlockComponent(o._type), c = get(first(n), "prop"), d = get(i.props, `${c}.presets`, {});
6968
6968
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
6969
6969
  return null;
6970
- const u = (p) => {
6971
- const x = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6970
+ const p = (u) => {
6971
+ const x = u.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6972
6972
  l([o._id], x, !0);
6973
6973
  };
6974
6974
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
@@ -6984,16 +6984,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6984
6984
  r("presets")
6985
6985
  ] }),
6986
6986
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
6987
- /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(d).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => u(d[p]), children: [
6988
- capitalize(startCase(r(p))),
6987
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(d).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => p(d[u]), children: [
6988
+ capitalize(startCase(r(u))),
6989
6989
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
6990
6990
  ] })) })
6991
6991
  ] }),
6992
6992
  isEmpty(a) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6993
6993
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuLabel, { children: r("Global presets") }),
6994
6994
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
6995
- /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(a).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => u(a[p]), children: [
6996
- capitalize(startCase(r(p))),
6995
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuGroup, { children: keys(a).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "group text-xs", onClick: () => p(a[u]), children: [
6996
+ capitalize(startCase(r(u))),
6997
6997
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuShortcut, { className: "invisible hover:font-bold hover:text-blue-600 group-hover:visible", children: r("apply") })
6998
6998
  ] })) })
6999
6999
  ] })
@@ -7013,8 +7013,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
7013
7013
  };
7014
7014
  function BlockStyling() {
7015
7015
  const { flexChild: o, gridChild: n } = useSelectedBlocksDisplayChild(), [r] = useSelectedStylingBlocks(), [a, l] = React__default.useState(""), [i, c] = React__default.useState({
7016
- onDrag: (p) => p,
7017
- onDragEnd: (p) => p,
7016
+ onDrag: (u) => u,
7017
+ onDragEnd: (u) => u,
7018
7018
  dragStartY: 0,
7019
7019
  dragging: !1,
7020
7020
  dragStartValue: 0,
@@ -7022,21 +7022,21 @@ function BlockStyling() {
7022
7022
  negative: !1,
7023
7023
  cssProperty: ""
7024
7024
  }), d = useThrottledCallback(
7025
- (p) => {
7025
+ (u) => {
7026
7026
  const x = !get(i, "negative", !1), m = get(i, "cssProperty", "");
7027
7027
  let g = parseFloat(i.dragStartValue);
7028
7028
  g = isNaN(g) ? 0 : g;
7029
7029
  let b = MAPPER[i.dragUnit];
7030
7030
  (startsWith(m, "scale") || m === "opacity") && (b = 10);
7031
- let f = (i.dragStartY - p.pageY) / b + g;
7031
+ let f = (i.dragStartY - u.pageY) / b + g;
7032
7032
  x && f < 0 && (f = 0), m === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
7033
7033
  },
7034
7034
  [i],
7035
7035
  50
7036
- ), u = useCallback(() => {
7036
+ ), p = useCallback(() => {
7037
7037
  setTimeout(() => i.onDragEnd(`${a}`), 100), c({
7038
- onDrag: (p) => p,
7039
- onDragEnd: (p) => p,
7038
+ onDrag: (u) => u,
7039
+ onDragEnd: (u) => u,
7040
7040
  dragStartY: 0,
7041
7041
  dragging: !1,
7042
7042
  dragStartValue: 0,
@@ -7050,7 +7050,7 @@ function BlockStyling() {
7050
7050
  "div",
7051
7051
  {
7052
7052
  onMouseMove: d,
7053
- onMouseUp: () => u(),
7053
+ onMouseUp: () => p(),
7054
7054
  className: "absolute inset-0 z-30 cursor-row-resize bg-gray-300/10"
7055
7055
  }
7056
7056
  ) : null,
@@ -7059,7 +7059,7 @@ function BlockStyling() {
7059
7059
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { defaultValue: ["Styles"], type: "multiple", className: "w-full", children: [
7060
7060
  o && /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: FLEX_CHILD_SECTION }),
7061
7061
  n ? /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: GRID_CHILD_SECTION }) : null,
7062
- SETTINGS_SECTIONS.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: p }, p.heading))
7062
+ SETTINGS_SECTIONS.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx(StylingGroup, { section: u }, u.heading))
7063
7063
  ] })
7064
7064
  ] })
7065
7065
  ] });
@@ -7071,9 +7071,9 @@ const ChaiSelect = ({
7071
7071
  placeholder: a = "Select",
7072
7072
  className: l = ""
7073
7073
  }) => {
7074
- const [i, c] = useState(o), d = (u) => {
7075
- const p = u.target.value;
7076
- c(p), n(p);
7074
+ const [i, c] = useState(o), d = (p) => {
7075
+ const u = p.target.value;
7076
+ c(u), n(u);
7077
7077
  };
7078
7078
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("relative inline-block w-full", l), children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
7079
7079
  "select",
@@ -7083,7 +7083,7 @@ const ChaiSelect = ({
7083
7083
  onChange: d,
7084
7084
  children: [
7085
7085
  /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: "", disabled: !0, children: a }),
7086
- r.map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.value, children: u.label }, u.value))
7086
+ r.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.value, children: p.label }, p.value))
7087
7087
  ]
7088
7088
  }
7089
7089
  ) });
@@ -7115,7 +7115,7 @@ const BlockCard = ({
7115
7115
  library: n,
7116
7116
  parentId: r = void 0
7117
7117
  }) => {
7118
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), x = get(o, "name", get(o, "label")), [, m] = useAtom$1(draggedBlockAtom), g = (f) => {
7118
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: u } = useBlockHighlight(), x = get(o, "name", get(o, "label")), [, m] = useAtom$1(draggedBlockAtom), g = (f) => {
7119
7119
  const v = has(f, "styles_attrs.data-page-section");
7120
7120
  return f._type === "Box" && v;
7121
7121
  }, b = useCallback(
@@ -7142,7 +7142,7 @@ const BlockCard = ({
7142
7142
  } else
7143
7143
  f.dataTransfer.setDragImage(new Image(), 0, 0);
7144
7144
  m(w), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK }), setTimeout(() => {
7145
- u([]), p();
7145
+ p([]), u();
7146
7146
  }, 200);
7147
7147
  }
7148
7148
  };
@@ -7175,18 +7175,18 @@ const BlockCard = ({
7175
7175
  return useEffect(() => {
7176
7176
  (async () => {
7177
7177
  if (i === "complete" || c.current === "loading") return;
7178
- c.current = "loading", r((u) => ({ ...u, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
7178
+ c.current = "loading", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "loading", blocks: [] } }));
7179
7179
  const d = await a(o);
7180
- c.current = "idle", r((u) => ({ ...u, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
7180
+ c.current = "idle", r((p) => ({ ...p, [o == null ? void 0 : o.uuid]: { loading: "complete", blocks: d || [] } }));
7181
7181
  })();
7182
7182
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
7183
7183
  }, UILibrarySection = ({ parentId: o }) => {
7184
- const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((w) => w.category === "custom"), c = a.find((w) => w.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [x, m] = useState("Hero"), g = get(p, x, []), b = useRef(null), { t: j } = useTranslation(), f = (w) => {
7184
+ const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((w) => w.category === "custom"), c = a.find((w) => w.uuid === n) || first(a), { data: d, isLoading: p } = useLibraryBlocks(c), u = groupBy([...d, ...i], "group"), [x, m] = useState("Hero"), g = get(u, x, []), b = useRef(null), { t: j } = useTranslation(), f = (w) => {
7185
7185
  b.current && (clearTimeout(b.current), b.current = null), b.current = setTimeout(() => {
7186
7186
  b.current && m(w);
7187
7187
  }, 300);
7188
7188
  };
7189
- if (u)
7189
+ if (p)
7190
7190
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 grid h-full w-full grid-cols-12 gap-2", children: [
7191
7191
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7192
7192
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
@@ -7199,7 +7199,7 @@ const BlockCard = ({
7199
7199
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: j("Groups") }),
7200
7200
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7201
7201
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
7202
- map(p, (w, I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7202
+ map(u, (w, I) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7203
7203
  "div",
7204
7204
  {
7205
7205
  onMouseEnter: () => f(I),
@@ -7734,16 +7734,16 @@ i18n.use(initReactI18next).init({
7734
7734
  }
7735
7735
  });
7736
7736
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7737
- const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(), m = () => {
7737
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: p } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: x } = useBlockHighlight(), m = () => {
7738
7738
  if (has(o, "blocks")) {
7739
7739
  const j = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7740
- u(syncBlocksWithDefaults(j), r || null);
7740
+ p(syncBlocksWithDefaults(j), r || null);
7741
7741
  } else
7742
7742
  d(o, r || null);
7743
7743
  emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7744
7744
  }, { t: g } = useTranslation(), b = (j) => {
7745
7745
  j.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), a(omit(o, ["component", "icon"])), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK }), setTimeout(() => {
7746
- p([]), x();
7746
+ u([]), x();
7747
7747
  }, 200);
7748
7748
  };
7749
7749
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
@@ -7769,23 +7769,23 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7769
7769
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ChaiBuilderBlocks, { gridCols: n, parentId: o, groups: c, blocks: i.core });
7770
7770
  }, CORE_GROUPS = ["basic", "typography", "media", "layout", "form", "advanced", "other"], ChaiBuilderBlocks = ({ groups: o, blocks: n, parentId: r, gridCols: a = "grid-cols-4" }) => {
7771
7771
  var d;
7772
- const { t: l } = useTranslation(), [i] = useBlocksStore(), c = (d = find(i, (u) => u._id === r)) == null ? void 0 : d._type;
7772
+ const { t: l } = useTranslation(), [i] = useBlocksStore(), c = (d = find(i, (p) => p._id === r)) == null ? void 0 : d._type;
7773
7773
  return React__default.Children.toArray(
7774
7774
  map(
7775
- sortBy(o, (u) => CORE_GROUPS.indexOf(u) === -1 ? 99 : CORE_GROUPS.indexOf(u)),
7776
- (u) => reject(filter(values(n), { group: u }), { hidden: !0 }).length ? /* @__PURE__ */ jsxRuntimeExports.jsx(Accordion, { type: "single", value: u, collapsible: !0, className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: u, className: "border-border", children: [
7777
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline", children: capitalize(l(u.toLowerCase())) }),
7778
- /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { className: "mx-auto max-w-xl p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-2 " + a, children: React__default.Children.toArray(
7779
- reject(filter(values(n), { group: u }), { hidden: !0 }).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(
7775
+ sortBy(o, (p) => CORE_GROUPS.indexOf(p) === -1 ? 99 : CORE_GROUPS.indexOf(p)),
7776
+ (p) => reject(filter(values(n), { group: p }), { hidden: !0 }).length ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-border", children: [
7777
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background px-4 py-2 capitalize text-foreground hover:no-underline font-semibold", children: capitalize(l(p.toLowerCase())) }),
7778
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mx-auto max-w-xl p-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid gap-2 " + a, children: React__default.Children.toArray(
7779
+ reject(filter(values(n), { group: p }), { hidden: !0 }).map((u) => /* @__PURE__ */ jsxRuntimeExports.jsx(
7780
7780
  CoreBlock,
7781
7781
  {
7782
7782
  parentId: r,
7783
- block: p,
7784
- disabled: !canAcceptChildBlock(c, p.type) || !canBeNestedInside(c, p.type)
7783
+ block: u,
7784
+ disabled: !canAcceptChildBlock(c, u.type) || !canBeNestedInside(c, u.type)
7785
7785
  }
7786
7786
  ))
7787
7787
  ) }) })
7788
- ] }) }) : null
7788
+ ] }, p) : null
7789
7789
  )
7790
7790
  );
7791
7791
  }, addBlockTabAtom = atomWithStorage("__add_block_tab", "library"), AddBlocksPanel = ({
@@ -7802,8 +7802,8 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7802
7802
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7803
7803
  Tabs,
7804
7804
  {
7805
- onValueChange: (u) => {
7806
- c(""), i(u);
7805
+ onValueChange: (p) => {
7806
+ c(""), i(p);
7807
7807
  },
7808
7808
  value: l,
7809
7809
  className: cn("h-max"),
@@ -7819,21 +7819,27 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7819
7819
  l === "html" && d ? /* @__PURE__ */ jsxRuntimeExports.jsx(ImportHTML, { parentId: r }) : null
7820
7820
  ] });
7821
7821
  }, ChaiDraggableBlock = ({ block: o, html: n, blocks: r, children: a }) => {
7822
- const [, l] = useAtom$1(draggedBlockAtom), [, i] = useSelectedBlockIds(), { clearHighlight: c } = useBlockHighlight(), d = async (u) => {
7823
- if (isEmpty(n) && isEmpty(o) && isEmpty(r))
7824
- return;
7825
- let p = null;
7826
- if (Array.isArray(r) || !isEmpty(n)) {
7827
- if (p = isEmpty(n) ? r : getBlocksFromHTML(n), isEmpty(p)) return;
7828
- p = {
7829
- uiLibrary: !0,
7830
- blocks: p,
7831
- parent: get(p, "0._parent", null) || null
7832
- };
7833
- } else isObject$1(o) && (p = omit(o, ["component", "icon"]));
7834
- p && (u.dataTransfer.setData("text/plain", JSON.stringify(p)), l(p), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK }), setTimeout(() => {
7835
- i([]), c();
7836
- }, 200));
7822
+ const [, l] = useAtom$1(draggedBlockAtom), [, i] = useSelectedBlockIds(), { clearHighlight: c } = useBlockHighlight(), d = async (p) => {
7823
+ try {
7824
+ if (isEmpty(n) && isEmpty(o) && isEmpty(r))
7825
+ return;
7826
+ let u = null;
7827
+ const x = typeof n == "function" ? (await n()).html : n, m = typeof r == "function" ? (await r()).blocks : r;
7828
+ if (Array.isArray(m) || !isEmpty(x)) {
7829
+ if (u = isEmpty(x) ? m : getBlocksFromHTML(x), isEmpty(u)) return;
7830
+ u = {
7831
+ uiLibrary: !0,
7832
+ blocks: u,
7833
+ parent: get(u, "0._parent", null) || null
7834
+ };
7835
+ } else isObject$1(o) && (u = omit(o, ["component", "icon"]));
7836
+ if (!u) return;
7837
+ p.dataTransfer.setData("text/plain", JSON.stringify(u)), l(u), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK }), setTimeout(() => {
7838
+ i([]), c();
7839
+ }, 200);
7840
+ } catch (u) {
7841
+ console.error("Error in drag start:", u);
7842
+ }
7837
7843
  };
7838
7844
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { draggable: !0, onDragStart: d, className: "cursor-grab", children: a });
7839
7845
  }, AddBlocksDialog = () => {
@@ -8106,7 +8112,7 @@ function QuickPrompts({ onClick: o }) {
8106
8112
  icon: FaLanguage$1,
8107
8113
  prompt: `Translate the content to ${get(LANGUAGES, a, a)}. Maintain same tone, style and length.`
8108
8114
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: n ? "pointer-events-none opacity-50" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-2", children: i.map(
8109
- ({ name: c, icon: d, subMenus: u, prompt: p }) => u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
8115
+ ({ name: c, icon: d, subMenus: p, prompt: u }) => p ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [
8110
8116
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
8111
8117
  "li",
8112
8118
  {
@@ -8122,7 +8128,7 @@ function QuickPrompts({ onClick: o }) {
8122
8128
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
8123
8129
  "li",
8124
8130
  {
8125
- onClick: () => o(p),
8131
+ onClick: () => o(u),
8126
8132
  className: "flex cursor-pointer items-center space-x-2 rounded p-1 text-sm hover:bg-gray-100 dark:hover:bg-gray-800",
8127
8133
  children: [
8128
8134
  /* @__PURE__ */ jsxRuntimeExports.jsx(d, { className: "h-4 w-4" }),
@@ -8134,7 +8140,7 @@ function QuickPrompts({ onClick: o }) {
8134
8140
  ) }) });
8135
8141
  }
8136
8142
  const AIUserPrompt = ({ blockId: o }) => {
8137
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, x] = useState(), m = useRef(null), g = useRef(null);
8143
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, p] = useState(!0), [u, x] = useState(), m = useRef(null), g = useRef(null);
8138
8144
  useEffect(() => {
8139
8145
  var j;
8140
8146
  (j = m.current) == null || j.focus();
@@ -8147,7 +8153,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8147
8153
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8148
8154
  "div",
8149
8155
  {
8150
- onClick: () => u(!d),
8156
+ onClick: () => p(!d),
8151
8157
  className: "flex cursor-pointer items-center justify-between border-b border-border py-2 text-sm font-bold text-muted-foreground hover:underline",
8152
8158
  children: [
8153
8159
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: n("Ask AI") }),
@@ -8195,11 +8201,11 @@ const AIUserPrompt = ({ blockId: o }) => {
8195
8201
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "destructive", onClick: () => stop(), className: "hidden w-fit", size: "sm", children: n("Stop") })
8196
8202
  ] }) : null
8197
8203
  ] }),
8198
- p ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
8204
+ u ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1 flex justify-between break-words rounded border border-blue-500 bg-blue-100 p-1 text-xs text-blue-500", children: [
8199
8205
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
8200
8206
  n("Total tokens used"),
8201
8207
  ": ",
8202
- p.totalTokens
8208
+ u.totalTokens
8203
8209
  ] }),
8204
8210
  /* @__PURE__ */ jsxRuntimeExports.jsx(Countdown, {})
8205
8211
  ] }) }) : null,
@@ -8219,19 +8225,19 @@ const AIUserPrompt = ({ blockId: o }) => {
8219
8225
  ] }) }) : null
8220
8226
  ] });
8221
8227
  }, AISetContext = () => {
8222
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, x] = useState(!1), { toast: m } = useToast(), g = useRef(null);
8228
+ const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [p, u] = useState(null), [, x] = useState(!1), { toast: m } = useToast(), g = useRef(null);
8223
8229
  useEffect(() => {
8224
8230
  n && a(n);
8225
8231
  }, [n]);
8226
8232
  const b = async () => {
8227
8233
  try {
8228
- d(!0), p(null), await i(r), m({
8234
+ d(!0), u(null), await i(r), m({
8229
8235
  title: o("Updated AI Context"),
8230
8236
  description: o("You can now Ask AI to edit your content"),
8231
8237
  variant: "default"
8232
8238
  }), g.current.click();
8233
8239
  } catch (j) {
8234
- p(j);
8240
+ u(j);
8235
8241
  } finally {
8236
8242
  d(!1);
8237
8243
  }
@@ -8307,7 +8313,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8307
8313
  ] })
8308
8314
  ] }) : null
8309
8315
  ] }),
8310
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 max-w-full", children: u && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500", children: u.message }) })
8316
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-2 max-w-full", children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "break-words rounded border border-red-500 bg-red-100 p-1 text-xs text-red-500", children: p.message }) })
8311
8317
  ] })
8312
8318
  ] })
8313
8319
  }
@@ -8319,7 +8325,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8319
8325
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
8320
8326
  ] });
8321
8327
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
8322
- const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, x] = useState(null), [m, g] = useState(""), b = useRef(null), j = useRef(null);
8328
+ const [a, l] = useState([]), [i, c] = useState(""), [d, p] = useState(""), [u, x] = useState(null), [m, g] = useState(""), b = useRef(null), j = useRef(null);
8323
8329
  useEffect(() => {
8324
8330
  l(n);
8325
8331
  }, [n]);
@@ -8330,31 +8336,31 @@ const AIUserPrompt = ({ blockId: o }) => {
8330
8336
  }
8331
8337
  if (i) {
8332
8338
  const R = [...a, { key: i, value: d }];
8333
- r(R), l(a), c(""), u(""), g("");
8339
+ r(R), l(a), c(""), p(""), g("");
8334
8340
  }
8335
8341
  }, v = (R) => {
8336
8342
  const T = a.filter((k, B) => B !== R);
8337
8343
  r(T), l(T);
8338
8344
  }, C = (R) => {
8339
- x(R), c(a[R].key), u(a[R].value);
8345
+ x(R), c(a[R].key), p(a[R].value);
8340
8346
  }, w = () => {
8341
8347
  if (i.startsWith("@")) {
8342
8348
  g("Attribute keys cannot start with '@'");
8343
8349
  return;
8344
8350
  }
8345
- if (p !== null && i) {
8351
+ if (u !== null && i) {
8346
8352
  const R = [...a];
8347
- R[p] = { key: i, value: d }, r(R), l(R), x(null), c(""), u(""), g("");
8353
+ R[u] = { key: i, value: d }, r(R), l(R), x(null), c(""), p(""), g("");
8348
8354
  }
8349
8355
  }, I = (R) => {
8350
- R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? w() : f());
8356
+ R.key === "Enter" && !R.shiftKey && (R.preventDefault(), u !== null ? w() : f());
8351
8357
  };
8352
8358
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
8353
8359
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8354
8360
  "form",
8355
8361
  {
8356
8362
  onSubmit: (R) => {
8357
- R.preventDefault(), p !== null ? w() : f();
8363
+ R.preventDefault(), u !== null ? w() : f();
8358
8364
  },
8359
8365
  className: "space-y-3",
8360
8366
  children: [
@@ -8388,7 +8394,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8388
8394
  rows: 2,
8389
8395
  ref: j,
8390
8396
  value: d,
8391
- onChange: (R) => u(R.target.value),
8397
+ onChange: (R) => p(R.target.value),
8392
8398
  onKeyDown: I,
8393
8399
  placeholder: "Value",
8394
8400
  className: "bg-background text-sm"
@@ -8396,7 +8402,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8396
8402
  )
8397
8403
  ] })
8398
8404
  ] }),
8399
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: p !== null ? "Save" : "Add" }),
8405
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: u !== null ? "Save" : "Add" }),
8400
8406
  m && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: m })
8401
8407
  ]
8402
8408
  }
@@ -8421,15 +8427,15 @@ const AIUserPrompt = ({ blockId: o }) => {
8421
8427
  }), BlockAttributesEditor = React.memo(() => {
8422
8428
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
8423
8429
  React.useEffect(() => {
8424
- const d = map(get(o, i), (u, p) => ({ key: p, value: u }));
8430
+ const d = map(get(o, i), (p, u) => ({ key: u, value: p }));
8425
8431
  isEmpty(d) ? r([]) : r(d);
8426
8432
  }, [get(o, i)]);
8427
8433
  const c = React.useCallback(
8428
8434
  (d = []) => {
8429
- const u = {};
8430
- forEach(d, (p) => {
8431
- isEmpty(p.key) || set(u, p.key, p.value);
8432
- }), l([get(o, "_id")], { [i]: u });
8435
+ const p = {};
8436
+ forEach(d, (u) => {
8437
+ isEmpty(u.key) || set(p, u.key, u.value);
8438
+ }), l([get(o, "_id")], { [i]: p });
8433
8439
  },
8434
8440
  [o, l, i]
8435
8441
  );
@@ -8535,11 +8541,11 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8535
8541
  icon: i,
8536
8542
  onClick: c,
8537
8543
  iconContainerClasses: d,
8538
- iconSelectedClasses: u
8544
+ iconSelectedClasses: p
8539
8545
  }) => {
8540
- const { t: p } = useTranslation();
8546
+ const { t: u } = useTranslation();
8541
8547
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(HoverCard, { children: [
8542
- /* @__PURE__ */ jsxRuntimeExports.jsx(HoverCardTrigger, { className: cn(d, u && a === r ? u : ""), asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8548
+ /* @__PURE__ */ jsxRuntimeExports.jsx(HoverCardTrigger, { className: cn(d, p && a === r ? p : ""), asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8543
8549
  Button,
8544
8550
  {
8545
8551
  onClick: () => c(l),
@@ -8549,8 +8555,8 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8549
8555
  }
8550
8556
  ) }),
8551
8557
  /* @__PURE__ */ jsxRuntimeExports.jsx(HoverCardContent, { className: "w-52 border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
8552
- /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold", children: p(o) }),
8553
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs", children: p(n) })
8558
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold", children: u(o) }),
8559
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs", children: u(n) })
8554
8560
  ] }) }) })
8555
8561
  ] });
8556
8562
  }, Breakpoints = ({
@@ -8558,12 +8564,12 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8558
8564
  iconContainerClasses: n,
8559
8565
  iconSelectedClasses: r
8560
8566
  }) => {
8561
- const [, a, l] = useCanvasWidth(), [i, c] = useSelectedBreakpoints(), { t: d } = useTranslation(), u = useBuilderProp("breakpoints", WEB_BREAKPOINTS), p = (x) => {
8567
+ const [, a, l] = useCanvasWidth(), [i, c] = useSelectedBreakpoints(), { t: d } = useTranslation(), p = useBuilderProp("breakpoints", WEB_BREAKPOINTS), u = (x) => {
8562
8568
  i.includes(x) ? i.length > 2 && c(i.filter((m) => m !== x)) : c((m) => [...m, x]);
8563
8569
  };
8564
- return u.length < 4 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex items-center rounded-md", o), children: map(u, (x) => /* @__PURE__ */ createElement(BreakpointCard, { iconSelectedClasses: r, iconContainerClasses: n, ...x, onClick: l, key: x.breakpoint, currentBreakpoint: a })) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex items-center rounded-md", o), children: [
8570
+ return p.length < 4 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex items-center rounded-md", o), children: map(p, (x) => /* @__PURE__ */ createElement(BreakpointCard, { iconSelectedClasses: r, iconContainerClasses: n, ...x, onClick: l, key: x.breakpoint, currentBreakpoint: a })) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex items-center rounded-md", o), children: [
8565
8571
  map(
8566
- u.filter((x) => includes(i, toUpper(x.breakpoint))),
8572
+ p.filter((x) => includes(i, toUpper(x.breakpoint))),
8567
8573
  (x) => /* @__PURE__ */ createElement(BreakpointCard, { iconSelectedClasses: r, iconContainerClasses: n, ...x, onClick: l, key: x.breakpoint, currentBreakpoint: a })
8568
8574
  ),
8569
8575
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
@@ -8571,11 +8577,11 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8571
8577
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuContent, { className: "w-56 border-border text-xs", children: [
8572
8578
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuLabel, { children: d("Breakpoints") }),
8573
8579
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuSeparator, {}),
8574
- map(u, (x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
8580
+ map(p, (x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
8575
8581
  DropdownMenuCheckboxItem,
8576
8582
  {
8577
8583
  disabled: x.breakpoint === "xs",
8578
- onCheckedChange: () => p(toUpper(x.breakpoint)),
8584
+ onCheckedChange: () => u(toUpper(x.breakpoint)),
8579
8585
  checked: includes(i, toUpper(x.breakpoint)),
8580
8586
  children: d(x.title)
8581
8587
  },
@@ -8838,12 +8844,12 @@ function RemoveProviderConfirmation({
8838
8844
  const PageDataProviders = () => {
8839
8845
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8840
8846
  filter(n, (f) => map(r, "providerKey").includes(f.providerKey))
8841
- ), [d, u] = useState(""), [p, x] = useState(null), m = filter(
8847
+ ), [d, p] = useState(""), [u, x] = useState(null), m = filter(
8842
8848
  n.map((f) => map(i, "providerKey").includes(f.providerKey) ? null : { value: f.providerKey, label: f.name }),
8843
8849
  (f) => !isNull(f)
8844
8850
  ), g = (f) => {
8845
8851
  const v = find(n, { providerKey: f });
8846
- c((C) => [...C, v]), a((C) => [...C, { providerKey: v.providerKey, args: {} }]), u(""), l("UNSAVED");
8852
+ c((C) => [...C, v]), a((C) => [...C, { providerKey: v.providerKey, args: {} }]), p(""), l("UNSAVED");
8847
8853
  }, b = (f) => {
8848
8854
  c((v) => filter(v, (C) => C.providerKey !== f.providerKey)), a((v) => filter(v, (C) => C.providerKey !== f.providerKey)), l("UNSAVED");
8849
8855
  }, j = (f) => x(f);
@@ -8935,14 +8941,14 @@ const PageDataProviders = () => {
8935
8941
  },
8936
8942
  f.providerKey
8937
8943
  )) }),
8938
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => x(null), provider: p })
8944
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => x(null), provider: u })
8939
8945
  ] })
8940
8946
  ] });
8941
8947
  };
8942
8948
  function AiFillDatabase(o) {
8943
8949
  return GenIcon({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M832 64H192c-17.7 0-32 14.3-32 32v224h704V96c0-17.7-14.3-32-32-32zM288 232c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zM160 928c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V704H160v224zm128-136c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zM160 640h704V384H160v256zm128-168c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z" }, child: [] }] })(o);
8944
8950
  }
8945
- const TopBar = lazy(() => import("./Topbar-tRFEAMbG.js"));
8951
+ const TopBar = lazy(() => import("./Topbar-Cc5SldaT.js"));
8946
8952
  function useSidebarMenuItems(o) {
8947
8953
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8948
8954
  return useMemo(() => {
@@ -8976,7 +8982,7 @@ const RootLayout = () => {
8976
8982
  g.preventDefault();
8977
8983
  }, d = (g) => {
8978
8984
  n(o === g ? null : g);
8979
- }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), x = [...u, ...i], m = useBuilderProp("htmlDir", "ltr");
8985
+ }, p = useSidebarMenuItems(r), { t: u } = useTranslation(), x = [...p, ...i], m = useBuilderProp("htmlDir", "ltr");
8980
8986
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: m, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
8981
8987
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8982
8988
  "div",
@@ -8998,12 +9004,12 @@ const RootLayout = () => {
8998
9004
  },
8999
9005
  b
9000
9006
  ) }),
9001
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p(g.label) }) })
9007
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: u(g.label) }) })
9002
9008
  ] }, "button" + b)) }),
9003
9009
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col space-y-1", children: [
9004
9010
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
9005
9011
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", onClick: () => l(!0), children: /* @__PURE__ */ jsxRuntimeExports.jsx(LayoutTemplate, { size: 20 }) }) }),
9006
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: p("Choose Builder Layout") }) })
9012
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "right", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: u("Choose Builder Layout") }) })
9007
9013
  ] }),
9008
9014
  /* @__PURE__ */ jsxRuntimeExports.jsx(HotKeys, {})
9009
9015
  ] })
@@ -9018,7 +9024,7 @@ const RootLayout = () => {
9018
9024
  children: o !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col p-3", children: [
9019
9025
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
9020
9026
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(x, `${o}.icon`, null) }),
9021
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(x[o].label) })
9027
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: u(x[o].label) })
9022
9028
  ] }),
9023
9029
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(x, `${o}.component`, null), {}) }) })
9024
9030
  ] }) })
@@ -9038,7 +9044,7 @@ const RootLayout = () => {
9038
9044
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar overflow h-full max-h-full overflow-x-hidden", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex max-h-full flex-col p-3", children: [
9039
9045
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
9040
9046
  /* @__PURE__ */ jsxRuntimeExports.jsx(EditIcon, { size: "16", className: "rtl:ml-2" }),
9041
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p("Block Settings") })
9047
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: u("Block Settings") })
9042
9048
  ] }),
9043
9049
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsPanel, {}) }) })
9044
9050
  ] }) })