@chaibuilder/sdk 1.2.114 → 1.2.115

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  var z = Object.defineProperty;
2
- var G = (o, n, r) => n in o ? z(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
3
- var F = (o, n, r) => (G(o, typeof n != "symbol" ? n + "" : n, r), r);
2
+ var W = (o, n, r) => n in o ? z(o, n, { enumerable: !0, configurable: !0, writable: !0, value: r }) : o[n] = r;
3
+ var F = (o, n, r) => (W(o, typeof n != "symbol" ? n + "" : n, r), r);
4
4
  import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
5
5
  import * as React from "react";
6
6
  import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
@@ -89,249 +89,249 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
89
89
  const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
90
90
  let a, l, i;
91
91
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
92
- const c = (m) => o.get(m), d = (m, v) => {
93
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(v);
94
- const C = o.get(m);
95
- if (o.set(m, v), r.has(m) || r.set(m, C), C && hasPromiseAtomValue(C)) {
96
- const B = "v" in v ? v.v instanceof Promise ? v.v : Promise.resolve(v.v) : Promise.reject(v.e);
97
- cancelPromise(C.v, B);
92
+ const c = (f) => o.get(f), d = (f, C) => {
93
+ (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(C);
94
+ const v = o.get(f);
95
+ if (o.set(f, C), r.has(f) || r.set(f, v), v && hasPromiseAtomValue(v)) {
96
+ const R = "v" in C ? C.v instanceof Promise ? C.v : Promise.resolve(C.v) : Promise.reject(C.e);
97
+ cancelPromise(v.v, R);
98
98
  }
99
- }, u = (m, v, C) => {
100
- const B = /* @__PURE__ */ new Map();
99
+ }, u = (f, C, v) => {
100
+ const R = /* @__PURE__ */ new Map();
101
101
  let I = !1;
102
- C.forEach((N, P) => {
103
- !N && P === m && (N = v), N ? (B.set(P, N), v.d.get(P) !== N && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
- }), (I || v.d.size !== B.size) && (v.d = B);
105
- }, p = (m, v, C) => {
106
- const B = c(m), I = {
107
- d: (B == null ? void 0 : B.d) || /* @__PURE__ */ new Map(),
108
- v
102
+ v.forEach((T, P) => {
103
+ !T && P === f && (T = C), T ? (R.set(P, T), C.d.get(P) !== T && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
+ }), (I || C.d.size !== R.size) && (C.d = R);
105
+ }, p = (f, C, v) => {
106
+ const R = c(f), I = {
107
+ d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
108
+ v: C
109
109
  };
110
- if (C && u(m, I, C), B && isEqualAtomValue(B, I) && B.d === I.d)
111
- return B;
112
- if (B && hasPromiseAtomValue(B) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(B, I)) {
113
- if (B.d === I.d)
114
- return B;
115
- I.v = B.v;
110
+ if (v && u(f, I, v), R && isEqualAtomValue(R, I) && R.d === I.d)
111
+ return R;
112
+ if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(R, I)) {
113
+ if (R.d === I.d)
114
+ return R;
115
+ I.v = R.v;
116
116
  }
117
- return d(m, I), I;
118
- }, g = (m, v, C, B) => {
119
- if (isPromiseLike$2(v)) {
117
+ return d(f, I), I;
118
+ }, m = (f, C, v, R) => {
119
+ if (isPromiseLike$2(C)) {
120
120
  let I;
121
- const N = new Promise((P, O) => {
121
+ const T = new Promise((P, O) => {
122
122
  let M = !1;
123
- v.then(
123
+ C.then(
124
124
  (V) => {
125
125
  if (!M) {
126
126
  M = !0;
127
- const $ = c(m), H = p(
128
- m,
129
- N,
130
- C
127
+ const $ = c(f), H = p(
128
+ f,
129
+ T,
130
+ v
131
131
  );
132
- resolvePromise(N, V), P(V), ($ == null ? void 0 : $.d) !== H.d && T(m, H, $ == null ? void 0 : $.d);
132
+ resolvePromise(T, V), P(V), ($ == null ? void 0 : $.d) !== H.d && N(f, H, $ == null ? void 0 : $.d);
133
133
  }
134
134
  },
135
135
  (V) => {
136
136
  if (!M) {
137
137
  M = !0;
138
- const $ = c(m), H = p(
139
- m,
140
- N,
141
- C
138
+ const $ = c(f), H = p(
139
+ f,
140
+ T,
141
+ v
142
142
  );
143
- rejectPromise(N, V), O(V), ($ == null ? void 0 : $.d) !== H.d && T(m, H, $ == null ? void 0 : $.d);
143
+ rejectPromise(T, V), O(V), ($ == null ? void 0 : $.d) !== H.d && N(f, H, $ == null ? void 0 : $.d);
144
144
  }
145
145
  }
146
146
  ), I = (V) => {
147
147
  M || (M = !0, V.then(
148
- ($) => resolvePromise(N, $),
149
- ($) => rejectPromise(N, $)
148
+ ($) => resolvePromise(T, $),
149
+ ($) => rejectPromise(T, $)
150
150
  ), P(V));
151
151
  };
152
152
  });
153
- return N.orig = v, N.status = "pending", registerCancelPromise(N, (P) => {
154
- P && I(P), B == null || B();
155
- }), p(m, N, C);
153
+ return T.orig = C, T.status = "pending", registerCancelPromise(T, (P) => {
154
+ P && I(P), R == null || R();
155
+ }), p(f, T, v);
156
156
  }
157
- return p(m, v, C);
158
- }, f = (m, v, C) => {
159
- const B = c(m), I = {
160
- d: (B == null ? void 0 : B.d) || /* @__PURE__ */ new Map(),
161
- e: v
157
+ return p(f, C, v);
158
+ }, g = (f, C, v) => {
159
+ const R = c(f), I = {
160
+ d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
161
+ e: C
162
162
  };
163
- return C && u(m, I, C), B && isEqualAtomError(B, I) && B.d === I.d ? B : (d(m, I), I);
164
- }, x = (m) => {
165
- const v = c(m);
166
- if (v && (v.d.forEach((M, V) => {
167
- V !== m && !n.has(V) && x(V);
168
- }), Array.from(v.d).every(([M, V]) => {
163
+ return v && u(f, I, v), R && isEqualAtomError(R, I) && R.d === I.d ? R : (d(f, I), I);
164
+ }, x = (f) => {
165
+ const C = c(f);
166
+ if (C && (C.d.forEach((M, V) => {
167
+ V !== f && !n.has(V) && x(V);
168
+ }), Array.from(C.d).every(([M, V]) => {
169
169
  const $ = c(M);
170
- return M === m || $ === V || // TODO This is a hack, we should find a better solution.
170
+ return M === f || $ === V || // TODO This is a hack, we should find a better solution.
171
171
  $ && !hasPromiseAtomValue($) && isEqualAtomValue($, V);
172
172
  })))
173
- return v;
174
- const C = /* @__PURE__ */ new Map();
175
- let B = !0;
173
+ return C;
174
+ const v = /* @__PURE__ */ new Map();
175
+ let R = !0;
176
176
  const I = (M) => {
177
- if (M === m) {
177
+ if (M === f) {
178
178
  const $ = c(M);
179
179
  if ($)
180
- return C.set(M, $), returnAtomValue($);
180
+ return v.set(M, $), returnAtomValue($);
181
181
  if (hasInitialValue(M))
182
- return C.set(M, void 0), M.init;
182
+ return v.set(M, void 0), M.init;
183
183
  throw new Error("no atom init");
184
184
  }
185
185
  const V = x(M);
186
- return C.set(M, V), returnAtomValue(V);
186
+ return v.set(M, V), returnAtomValue(V);
187
187
  };
188
- let N, P;
188
+ let T, P;
189
189
  const O = {
190
190
  get signal() {
191
- return N || (N = new AbortController()), N.signal;
191
+ return T || (T = new AbortController()), T.signal;
192
192
  },
193
193
  get setSelf() {
194
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(m) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(m) && (P = (...M) => {
195
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && B && console.warn("setSelf function cannot be called in sync"), !B)
196
- return _(m, ...M);
194
+ return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(f) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(f) && (P = (...M) => {
195
+ if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
196
+ return _(f, ...M);
197
197
  }), P;
198
198
  }
199
199
  };
200
200
  try {
201
- const M = m.read(I, O);
202
- return g(
203
- m,
201
+ const M = f.read(I, O);
202
+ return m(
203
+ f,
204
204
  M,
205
- C,
206
- () => N == null ? void 0 : N.abort()
205
+ v,
206
+ () => T == null ? void 0 : T.abort()
207
207
  );
208
208
  } catch (M) {
209
- return f(m, M, C);
209
+ return g(f, M, v);
210
210
  } finally {
211
- B = !1;
211
+ R = !1;
212
212
  }
213
- }, j = (m) => returnAtomValue(x(m)), E = (m) => {
214
- let v = n.get(m);
215
- return v || (v = R(m)), v;
216
- }, b = (m, v) => !v.l.size && (!v.t.size || v.t.size === 1 && v.t.has(m)), k = (m) => {
217
- const v = n.get(m);
218
- v && b(m, v) && A(m);
219
- }, S = (m) => {
220
- const v = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), B = (N) => {
221
- const P = n.get(N);
213
+ }, j = (f) => returnAtomValue(x(f)), E = (f) => {
214
+ let C = n.get(f);
215
+ return C || (C = A(f)), C;
216
+ }, b = (f, C) => !C.l.size && (!C.t.size || C.t.size === 1 && C.t.has(f)), k = (f) => {
217
+ const C = n.get(f);
218
+ C && b(f, C) && B(f);
219
+ }, S = (f) => {
220
+ const C = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new WeakMap(), R = (T) => {
221
+ const P = n.get(T);
222
222
  P == null || P.t.forEach((O) => {
223
- O !== N && (v.set(
223
+ O !== T && (C.set(
224
224
  O,
225
- (v.get(O) || /* @__PURE__ */ new Set()).add(N)
226
- ), C.set(O, (C.get(O) || 0) + 1), B(O));
225
+ (C.get(O) || /* @__PURE__ */ new Set()).add(T)
226
+ ), v.set(O, (v.get(O) || 0) + 1), R(O));
227
227
  });
228
228
  };
229
- B(m);
230
- const I = (N) => {
231
- const P = n.get(N);
229
+ R(f);
230
+ const I = (T) => {
231
+ const P = n.get(T);
232
232
  P == null || P.t.forEach((O) => {
233
233
  var M;
234
- if (O !== N) {
235
- let V = C.get(O);
236
- if (V && C.set(O, --V), !V) {
237
- let $ = !!((M = v.get(O)) != null && M.size);
234
+ if (O !== T) {
235
+ let V = v.get(O);
236
+ if (V && v.set(O, --V), !V) {
237
+ let $ = !!((M = C.get(O)) != null && M.size);
238
238
  if ($) {
239
239
  const H = c(O), U = x(O);
240
240
  $ = !H || !isEqualAtomValue(H, U);
241
241
  }
242
- $ || v.forEach((H) => H.delete(O));
242
+ $ || C.forEach((H) => H.delete(O));
243
243
  }
244
244
  I(O);
245
245
  }
246
246
  });
247
247
  };
248
- I(m);
249
- }, w = (m, ...v) => {
250
- let C = !0;
251
- const B = (P) => returnAtomValue(x(P)), I = (P, ...O) => {
248
+ I(f);
249
+ }, w = (f, ...C) => {
250
+ let v = !0;
251
+ const R = (P) => returnAtomValue(x(P)), I = (P, ...O) => {
252
252
  let M;
253
- if (P === m) {
253
+ if (P === f) {
254
254
  if (!hasInitialValue(P))
255
255
  throw new Error("atom not writable");
256
- const V = c(P), $ = g(P, O[0]);
256
+ const V = c(P), $ = m(P, O[0]);
257
257
  (!V || !isEqualAtomValue(V, $)) && S(P);
258
258
  } else
259
259
  M = w(P, ...O);
260
- if (!C) {
260
+ if (!v) {
261
261
  const V = L();
262
262
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
263
263
  ($) => $({ type: "async-write", flushed: V })
264
264
  );
265
265
  }
266
266
  return M;
267
- }, N = m.write(B, I, ...v);
268
- return C = !1, N;
269
- }, _ = (m, ...v) => {
270
- const C = w(m, ...v), B = L();
267
+ }, T = f.write(R, I, ...C);
268
+ return v = !1, T;
269
+ }, _ = (f, ...C) => {
270
+ const v = w(f, ...C), R = L();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (I) => I({ type: "write", flushed: B })
273
- ), C;
274
- }, R = (m, v) => {
275
- const C = {
276
- t: new Set(v && [v]),
272
+ (I) => I({ type: "write", flushed: R })
273
+ ), v;
274
+ }, A = (f, C) => {
275
+ const v = {
276
+ t: new Set(C && [C]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
- if (n.set(m, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(m), x(m).d.forEach((B, I) => {
280
- const N = n.get(I);
281
- N ? N.t.add(m) : I !== m && R(I, m);
282
- }), x(m), isActuallyWritableAtom(m) && m.onMount) {
283
- const B = m.onMount((...I) => _(m, ...I));
284
- B && (C.u = B);
279
+ if (n.set(f, v), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(f), x(f).d.forEach((R, I) => {
280
+ const T = n.get(I);
281
+ T ? T.t.add(f) : I !== f && A(I, f);
282
+ }), x(f), isActuallyWritableAtom(f) && f.onMount) {
283
+ const R = f.onMount((...I) => _(f, ...I));
284
+ R && (v.u = R);
285
285
  }
286
- return C;
287
- }, A = (m) => {
288
- var v;
289
- const C = (v = n.get(m)) == null ? void 0 : v.u;
290
- C && C(), n.delete(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(m);
291
- const B = c(m);
292
- B ? (hasPromiseAtomValue(B) && cancelPromise(B.v), B.d.forEach((I, N) => {
293
- if (N !== m) {
294
- const P = n.get(N);
295
- P && (P.t.delete(m), b(N, P) && A(N));
286
+ return v;
287
+ }, B = (f) => {
288
+ var C;
289
+ const v = (C = n.get(f)) == null ? void 0 : C.u;
290
+ v && v(), n.delete(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(f);
291
+ const R = c(f);
292
+ R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((I, T) => {
293
+ if (T !== f) {
294
+ const P = n.get(T);
295
+ P && (P.t.delete(f), b(T, P) && B(T));
296
296
  }
297
- })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", m);
298
- }, T = (m, v, C) => {
299
- const B = new Set(v.d.keys());
300
- C == null || C.forEach((I, N) => {
301
- if (B.has(N)) {
302
- B.delete(N);
297
+ })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", f);
298
+ }, N = (f, C, v) => {
299
+ const R = new Set(C.d.keys());
300
+ v == null || v.forEach((I, T) => {
301
+ if (R.has(T)) {
302
+ R.delete(T);
303
303
  return;
304
304
  }
305
- const P = n.get(N);
306
- P && (P.t.delete(m), b(N, P) && A(N));
307
- }), B.forEach((I) => {
308
- const N = n.get(I);
309
- N ? N.t.add(m) : n.has(m) && R(I, m);
305
+ const P = n.get(T);
306
+ P && (P.t.delete(f), b(T, P) && B(T));
307
+ }), R.forEach((I) => {
308
+ const T = n.get(I);
309
+ T ? T.t.add(f) : n.has(f) && A(I, f);
310
310
  });
311
311
  }, L = () => {
312
- let m;
313
- for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (m = /* @__PURE__ */ new Set()); r.size; ) {
314
- const v = Array.from(r);
315
- r.clear(), v.forEach(([C, B]) => {
316
- const I = c(C);
312
+ let f;
313
+ for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (f = /* @__PURE__ */ new Set()); r.size; ) {
314
+ const C = Array.from(r);
315
+ r.clear(), C.forEach(([v, R]) => {
316
+ const I = c(v);
317
317
  if (I) {
318
- I.d !== (B == null ? void 0 : B.d) && T(C, I, B == null ? void 0 : B.d);
319
- const N = n.get(C);
320
- N && !// TODO This seems pretty hacky. Hope to fix it.
318
+ I.d !== (R == null ? void 0 : R.d) && N(v, I, R == null ? void 0 : R.d);
319
+ const T = n.get(v);
320
+ T && !// TODO This seems pretty hacky. Hope to fix it.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
322
- (B && !hasPromiseAtomValue(B) && (isEqualAtomValue(B, I) || isEqualAtomError(B, I))) && (N.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && m.add(C));
322
+ (R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, I) || isEqualAtomError(R, I))) && (T.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && f.add(v));
323
323
  } else
324
324
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
325
325
  });
326
326
  }
327
327
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
328
- return a.forEach((v) => v("state")), m;
329
- }, D = (m, v) => {
330
- const C = E(m), B = L(), I = C.l;
331
- return I.add(v), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((N) => N("sub")), l.forEach(
332
- (N) => N({ type: "sub", flushed: B })
328
+ return a.forEach((C) => C("state")), f;
329
+ }, D = (f, C) => {
330
+ const v = E(f), R = L(), I = v.l;
331
+ return I.add(C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("sub")), l.forEach(
332
+ (T) => T({ type: "sub", flushed: R })
333
333
  )), () => {
334
- I.delete(v), k(m), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((N) => N("unsub")), l.forEach((N) => N({ type: "unsub" })));
334
+ I.delete(C), k(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("unsub")), l.forEach((T) => T({ type: "unsub" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
@@ -339,22 +339,22 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
339
339
  set: _,
340
340
  sub: D,
341
341
  // store dev methods (these are tentative and subject to change without notice)
342
- dev_subscribe_store: (m, v) => v !== 2 ? (console.warn(
342
+ dev_subscribe_store: (f, C) => C !== 2 ? (console.warn(
343
343
  "The current StoreListener revision is 2. The older ones are deprecated."
344
- ), a.add(m), () => {
345
- a.delete(m);
346
- }) : (l.add(m), () => {
347
- l.delete(m);
344
+ ), a.add(f), () => {
345
+ a.delete(f);
346
+ }) : (l.add(f), () => {
347
+ l.delete(f);
348
348
  }),
349
349
  dev_get_mounted_atoms: () => i.values(),
350
- dev_get_atom_state: (m) => o.get(m),
351
- dev_get_mounted: (m) => n.get(m),
352
- dev_restore_atoms: (m) => {
353
- for (const [C, B] of m)
354
- hasInitialValue(C) && (g(C, B), S(C));
355
- const v = L();
350
+ dev_get_atom_state: (f) => o.get(f),
351
+ dev_get_mounted: (f) => n.get(f),
352
+ dev_restore_atoms: (f) => {
353
+ for (const [v, R] of f)
354
+ hasInitialValue(v) && (m(v, R), S(v));
355
+ const C = L();
356
356
  l.forEach(
357
- (C) => C({ type: "restore", flushed: v })
357
+ (v) => v({ type: "restore", flushed: C })
358
358
  );
359
359
  }
360
360
  } : {
@@ -377,37 +377,37 @@ function splitAtom(o, n) {
377
377
  let u = r.get(c);
378
378
  if (u)
379
379
  return u;
380
- const p = d && r.get(d), g = [], f = [];
380
+ const p = d && r.get(d), m = [], g = [];
381
381
  return c.forEach((x, j) => {
382
382
  const E = n ? n(x) : j;
383
- f[j] = E;
383
+ g[j] = E;
384
384
  const b = p && p.atomList[p.keyList.indexOf(E)];
385
385
  if (b) {
386
- g[j] = b;
386
+ m[j] = b;
387
387
  return;
388
388
  }
389
389
  const k = (w) => {
390
- const _ = w(l), R = w(o), T = a(R, _ == null ? void 0 : _.arr).keyList.indexOf(E);
391
- if (T < 0 || T >= R.length) {
390
+ const _ = w(l), A = w(o), N = a(A, _ == null ? void 0 : _.arr).keyList.indexOf(E);
391
+ if (N < 0 || N >= A.length) {
392
392
  const L = c[a(c).keyList.indexOf(E)];
393
393
  if (L)
394
394
  return L;
395
395
  throw new Error("splitAtom: index out of bounds for read");
396
396
  }
397
- return R[T];
398
- }, S = (w, _, R) => {
399
- const A = w(l), T = w(o), D = a(T, A == null ? void 0 : A.arr).keyList.indexOf(E);
400
- if (D < 0 || D >= T.length)
397
+ return A[N];
398
+ }, S = (w, _, A) => {
399
+ const B = w(l), N = w(o), D = a(N, B == null ? void 0 : B.arr).keyList.indexOf(E);
400
+ if (D < 0 || D >= N.length)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const m = isFunction(R) ? R(T[D]) : R;
402
+ const f = isFunction(A) ? A(N[D]) : A;
403
403
  _(o, [
404
- ...T.slice(0, D),
405
- m,
406
- ...T.slice(D + 1)
404
+ ...N.slice(0, D),
405
+ f,
406
+ ...N.slice(D + 1)
407
407
  ]);
408
408
  };
409
- g[j] = isWritable(o) ? atom(k, S) : atom(k);
410
- }), p && p.keyList.length === f.length && p.keyList.every((x, j) => x === f[j]) ? u = p : u = { arr: c, atomList: g, keyList: f }, r.set(c, u), u;
409
+ m[j] = isWritable(o) ? atom(k, S) : atom(k);
410
+ }), p && p.keyList.length === g.length && p.keyList.every((x, j) => x === g[j]) ? u = p : u = { arr: c, atomList: m, keyList: g }, r.set(c, u), u;
411
411
  }, l = atom((c) => {
412
412
  const d = c(l), u = c(o);
413
413
  return a(u, d == null ? void 0 : d.arr);
@@ -420,10 +420,10 @@ function splitAtom(o, n) {
420
420
  case "remove": {
421
421
  const p = c(i).indexOf(u.atom);
422
422
  if (p >= 0) {
423
- const g = c(o);
423
+ const m = c(o);
424
424
  d(o, [
425
- ...g.slice(0, p),
426
- ...g.slice(p + 1)
425
+ ...m.slice(0, p),
426
+ ...m.slice(p + 1)
427
427
  ]);
428
428
  }
429
429
  break;
@@ -431,29 +431,29 @@ function splitAtom(o, n) {
431
431
  case "insert": {
432
432
  const p = u.before ? c(i).indexOf(u.before) : c(i).length;
433
433
  if (p >= 0) {
434
- const g = c(o);
434
+ const m = c(o);
435
435
  d(o, [
436
- ...g.slice(0, p),
436
+ ...m.slice(0, p),
437
437
  u.value,
438
- ...g.slice(p)
438
+ ...m.slice(p)
439
439
  ]);
440
440
  }
441
441
  break;
442
442
  }
443
443
  case "move": {
444
- const p = c(i).indexOf(u.atom), g = u.before ? c(i).indexOf(u.before) : c(i).length;
445
- if (p >= 0 && g >= 0) {
446
- const f = c(o);
447
- p < g ? d(o, [
448
- ...f.slice(0, p),
449
- ...f.slice(p + 1, g),
450
- f[p],
451
- ...f.slice(g)
444
+ const p = c(i).indexOf(u.atom), m = u.before ? c(i).indexOf(u.before) : c(i).length;
445
+ if (p >= 0 && m >= 0) {
446
+ const g = c(o);
447
+ p < m ? d(o, [
448
+ ...g.slice(0, p),
449
+ ...g.slice(p + 1, m),
450
+ g[p],
451
+ ...g.slice(m)
452
452
  ]) : d(o, [
453
- ...f.slice(0, g),
454
- f[p],
455
- ...f.slice(g, p),
456
- ...f.slice(p + 1)
453
+ ...g.slice(0, m),
454
+ g[p],
455
+ ...g.slice(m, p),
456
+ ...g.slice(p + 1)
457
457
  ]);
458
458
  }
459
459
  break;
@@ -473,14 +473,14 @@ function createJSONStorage(o) {
473
473
  const a = {
474
474
  getItem: (l, i) => {
475
475
  var c, d;
476
- const u = (g) => {
477
- if (g = g || "", n !== g) {
476
+ const u = (m) => {
477
+ if (m = m || "", n !== m) {
478
478
  try {
479
- r = JSON.parse(g);
479
+ r = JSON.parse(m);
480
480
  } catch {
481
481
  return i;
482
482
  }
483
- n = g;
483
+ n = m;
484
484
  }
485
485
  return r;
486
486
  }, p = (d = (c = o()) == null ? void 0 : c.getItem(l)) != null ? d : null;
@@ -529,8 +529,8 @@ function atomWithStorage(o, n, r = defaultStorage, a) {
529
529
  }, atom(
530
530
  (d) => d(i),
531
531
  (d, u, p) => {
532
- const g = typeof p == "function" ? p(d(i)) : p;
533
- return g === RESET ? (u(i, n), r.removeItem(o)) : g instanceof Promise ? g.then((f) => (u(i, f), r.setItem(o, f))) : (u(i, g), r.setItem(o, g));
532
+ const m = typeof p == "function" ? p(d(i)) : p;
533
+ return m === RESET ? (u(i, n), r.removeItem(o)) : m instanceof Promise ? m.then((g) => (u(i, g), r.setItem(o, g))) : (u(i, m), r.setItem(o, m));
534
534
  }
535
535
  );
536
536
  }
@@ -555,8 +555,8 @@ const StoreContext = createContext(void 0), useStore = (o) => {
555
555
  function useAtomValue(o, n) {
556
556
  const r = useStore(n), [[a, l, i], c] = useReducer(
557
557
  (p) => {
558
- const g = r.get(o);
559
- return Object.is(p[0], g) && p[1] === r && p[2] === o ? p : [g, r, o];
558
+ const m = r.get(o);
559
+ return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
560
560
  },
561
561
  void 0,
562
562
  () => [r.get(o), r, o]
@@ -640,8 +640,8 @@ const getSlots = (o) => {
640
640
  return map(i, (c) => {
641
641
  const d = c, u = getSlots(d);
642
642
  return Object.keys(u).length > 0 && Object.keys(u).forEach((p) => {
643
- const g = find(i, { oldId: u[p].replace("slot:", "") });
644
- d[p] = `slot:${g._id}`;
643
+ const m = find(i, { oldId: u[p].replace("slot:", "") });
644
+ d[p] = `slot:${m._id}`;
645
645
  }), omit(d, ["global", "oldId"]);
646
646
  });
647
647
  }, presentBlocksAtom = atom$1([]);
@@ -747,7 +747,7 @@ const useSelectedBlocksDisplayChild = () => ({
747
747
  switch (o.type) {
748
748
  case "singular": {
749
749
  const p = o.schema;
750
- return p.title && (p.title = titleWithLang(n(p.title), r, get(o, "i18n"))), p.oneOf && Array.isArray(p.oneOf) && (p.oneOf = p.oneOf.map((g) => (g.title && (g.title = n(g.title)), g))), p;
750
+ return p.title && (p.title = titleWithLang(n(p.title), r, get(o, "i18n"))), p.oneOf && Array.isArray(p.oneOf) && (p.oneOf = p.oneOf.map((m) => (m.title && (m.title = n(m.title)), m))), p;
751
751
  }
752
752
  case "model":
753
753
  const { properties: a, title: l } = o, i = {
@@ -756,11 +756,11 @@ const useSelectedBlocksDisplayChild = () => ({
756
756
  properties: {}
757
757
  };
758
758
  return Object.keys(a).forEach((p) => {
759
- const g = a[p];
760
- if (includes(["slot", "styles"], g.type))
759
+ const m = a[p];
760
+ if (includes(["slot", "styles"], m.type))
761
761
  return;
762
- const f = p;
763
- i.properties[f] = getBlockJSONFromSchemas(g, n, r);
762
+ const g = p;
763
+ i.properties[g] = getBlockJSONFromSchemas(m, n, r);
764
764
  }), i;
765
765
  case "list":
766
766
  const { itemProperties: c, title: d } = o, u = {
@@ -772,14 +772,14 @@ const useSelectedBlocksDisplayChild = () => ({
772
772
  }
773
773
  };
774
774
  return Object.keys(c).forEach((p) => {
775
- const g = c[p];
776
- if (includes(["slot", "styles"], g.type))
775
+ const m = c[p];
776
+ if (includes(["slot", "styles"], m.type))
777
777
  return;
778
- const f = p;
779
- u.items.properties[f] = getBlockJSONFromSchemas(g, n, r), set(
778
+ const g = p;
779
+ u.items.properties[g] = getBlockJSONFromSchemas(m, n, r), set(
780
780
  u.items,
781
781
  "title",
782
- titleWithLang(get(g, "itemTitle", `${n(d)} item`), r, get(g, "i18n"))
782
+ titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
783
783
  );
784
784
  }), u;
785
785
  default:
@@ -833,8 +833,8 @@ var undomanager = { exports: {} };
833
833
  }
834
834
  let r = function() {
835
835
  let a = [], l = -1, i = 0, c = !1, d;
836
- function u(p, g) {
837
- return !p || typeof p[g] != "function" ? this : (c = !0, p[g](), c = !1, this);
836
+ function u(p, m) {
837
+ return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
838
838
  }
839
839
  return {
840
840
  /**
@@ -861,8 +861,8 @@ var undomanager = { exports: {} };
861
861
  let p = a[l];
862
862
  if (!p)
863
863
  return this;
864
- const g = p.groupId;
865
- for (; p.groupId === g && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
864
+ const m = p.groupId;
865
+ for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
866
866
  ;
867
867
  return d && d(), this;
868
868
  },
@@ -873,8 +873,8 @@ var undomanager = { exports: {} };
873
873
  let p = a[l + 1];
874
874
  if (!p)
875
875
  return this;
876
- const g = p.groupId;
877
- for (; p.groupId === g && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
876
+ const m = p.groupId;
877
+ for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
878
878
  ;
879
879
  return d && d(), this;
880
880
  },
@@ -905,7 +905,7 @@ var undomanager = { exports: {} };
905
905
  * @returns {array}
906
906
  */
907
907
  getCommands: function(p) {
908
- return p ? a.filter((g) => g.groupId === p) : a;
908
+ return p ? a.filter((m) => m.groupId === p) : a;
909
909
  },
910
910
  /**
911
911
  * Returns the index of the actions list.
@@ -1203,12 +1203,12 @@ const useBlocksStoreManager = () => {
1203
1203
  return {
1204
1204
  moveBlocks: (E, b, k) => {
1205
1205
  const S = map(E, (_) => {
1206
- const A = n.find((D) => D._id === _)._parent || null, L = n.filter((D) => A ? D._parent === A : !D._parent).map((D) => D._id).indexOf(_);
1207
- return { _id: _, oldParent: A, oldPosition: L };
1206
+ const B = n.find((D) => D._id === _)._parent || null, L = n.filter((D) => B ? D._parent === B : !D._parent).map((D) => D._id).indexOf(_);
1207
+ return { _id: _, oldParent: B, oldPosition: L };
1208
1208
  }), w = S.find(({ _id: _ }) => _ === E[0]);
1209
1209
  w && w.oldParent === b && w.oldPosition === k || (i(E, b, k), o({
1210
- undo: () => each(S, ({ _id: _, oldParent: R, oldPosition: A }) => {
1211
- i([_], R, A);
1210
+ undo: () => each(S, ({ _id: _, oldParent: A, oldPosition: B }) => {
1211
+ i([_], A, B);
1212
1212
  }),
1213
1213
  redo: () => i(E, b, k)
1214
1214
  }));
@@ -1234,8 +1234,8 @@ const useBlocksStoreManager = () => {
1234
1234
  else {
1235
1235
  const w = keys(b);
1236
1236
  S = map(E, (_) => {
1237
- const R = n.find((T) => T._id === _), A = { _id: _ };
1238
- return each(w, (T) => A[T] = R[T]), A;
1237
+ const A = n.find((N) => N._id === _), B = { _id: _ };
1238
+ return each(w, (N) => B[N] = A[N]), B;
1239
1239
  });
1240
1240
  }
1241
1241
  c(map(E, (w) => ({ _id: w, ...b }))), o({
@@ -1255,8 +1255,8 @@ const useBlocksStoreManager = () => {
1255
1255
  updateMultipleBlocksProps: (E) => {
1256
1256
  let b = [];
1257
1257
  b = map(E, (k) => {
1258
- const S = keys(k), w = n.find((R) => R._id === k._id), _ = {};
1259
- return each(S, (R) => _[R] = w[R]), _;
1258
+ const S = keys(k), w = n.find((A) => A._id === k._id), _ = {};
1259
+ return each(S, (A) => _[A] = w[A]), _;
1260
1260
  }), c(E), o({
1261
1261
  undo: () => c(b),
1262
1262
  redo: () => c(E)
@@ -1275,8 +1275,8 @@ const useBlocksStoreManager = () => {
1275
1275
  b[k]._parent = i[j]._id;
1276
1276
  }
1277
1277
  const u = first(i);
1278
- let p, g;
1279
- return c && (p = find(o, { _id: c }), i[0]._parent = c, g = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, g = p._parent), r(i, g, d), n([(x = first(i)) == null ? void 0 : x._id]), first(i);
1278
+ let p, m;
1279
+ return c && (p = find(o, { _id: c }), i[0]._parent = c, m = c), !(p ? canAcceptChildBlock(p == null ? void 0 : p._type, u._type) : !0) && p && (i[0]._parent = p._parent, m = p._parent), r(i, m, d), n([(x = first(i)) == null ? void 0 : x._id]), first(i);
1280
1280
  },
1281
1281
  [o, n]
1282
1282
  );
@@ -1286,11 +1286,11 @@ const useBlocksStoreManager = () => {
1286
1286
  const k = i.blocks;
1287
1287
  return a(k, c, d);
1288
1288
  }
1289
- const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
1289
+ const u = generateUUID(), p = getBlockDefaultProps(i.props), m = [];
1290
1290
  forIn(p, (k, S) => {
1291
1291
  if (startsWith(k, SLOT_KEY)) {
1292
1292
  const w = k.replace(SLOT_KEY, "");
1293
- g.push({
1293
+ m.push({
1294
1294
  _id: w,
1295
1295
  _type: "Slot",
1296
1296
  _parent: u,
@@ -1300,15 +1300,15 @@ const useBlocksStoreManager = () => {
1300
1300
  });
1301
1301
  }
1302
1302
  });
1303
- const f = {
1303
+ const g = {
1304
1304
  _type: i.type,
1305
1305
  _id: u,
1306
1306
  ...p
1307
1307
  };
1308
1308
  let x, j;
1309
- c && (x = find(o, { _id: c }), f._parent = c, j = c), !canAcceptChildBlock(x == null ? void 0 : x._type, f._type) && x && (f._parent = x._parent, j = x._parent);
1310
- const b = [f, ...g];
1311
- return r(b, j, d), n([f._id]), f;
1309
+ c && (x = find(o, { _id: c }), g._parent = c, j = c), !canAcceptChildBlock(x == null ? void 0 : x._type, g._type) && x && (g._parent = x._parent, j = x._parent);
1310
+ const b = [g, ...m];
1311
+ return r(b, j, d), n([g._id]), g;
1312
1312
  },
1313
1313
  [a, o, n]
1314
1314
  ), addPredefinedBlock: a };
@@ -2416,18 +2416,18 @@ function getNewClasses(o = "", n = "", r = []) {
2416
2416
  );
2417
2417
  const i = [], c = [];
2418
2418
  each(r, (p) => {
2419
- const g = constructClassObject(p), f = find(a, pick(g, ["dark", "mq", "mod", "property"]));
2420
- if (f && (a = filter(
2419
+ const m = constructClassObject(p), g = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2420
+ if (g && (a = filter(
2421
2421
  a,
2422
- (x) => x.fullCls !== (f == null ? void 0 : f.fullCls)
2423
- )), i.push(g), g.mq === "xs" && !g.dark && g.mod === "" && (l = filter(l, (x) => x.property !== g.property)), getBelongsToForClass(a, g) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, g.property)) {
2424
- const x = find(l, pick(g, ["property"]));
2425
- f && (l = filter(
2422
+ (x) => x.fullCls !== (g == null ? void 0 : g.fullCls)
2423
+ )), i.push(m), m.mq === "xs" && !m.dark && m.mod === "" && (l = filter(l, (x) => x.property !== m.property)), getBelongsToForClass(a, m) === "baseClasses" && !includes(IGNORED_BASES_CLASSES_PROPERTIES, m.property)) {
2424
+ const x = find(l, pick(m, ["property"]));
2425
+ g && (l = filter(
2426
2426
  l,
2427
2427
  (j) => j.fullCls !== (x == null ? void 0 : x.fullCls)
2428
2428
  )), c.push({
2429
- ...g,
2430
- fullCls: g.cls,
2429
+ ...m,
2430
+ fullCls: m.cls,
2431
2431
  mq: "xs"
2432
2432
  });
2433
2433
  }
@@ -2455,10 +2455,10 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2455
2455
  )
2456
2456
  ), i = first(o(selectedStylingBlocksAtom));
2457
2457
  return map(l, (c) => {
2458
- const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: g } = getSplitClasses$1(u);
2458
+ const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: m } = getSplitClasses$1(u);
2459
2459
  return {
2460
2460
  ids: [d._id],
2461
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(g, p, a)}` }
2461
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
2462
2462
  };
2463
2463
  });
2464
2464
  }), useAddClassesToBlocks = () => {
@@ -2509,11 +2509,11 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2509
2509
  each(a, (c) => {
2510
2510
  const d = o.find((x) => x._id === c);
2511
2511
  l || (l = d._parent);
2512
- const g = filter(
2512
+ const m = filter(
2513
2513
  o,
2514
2514
  (x) => isString$1(l) ? x._parent === l : !d._parent
2515
- ).indexOf(d) + 1, f = getDuplicatedBlocks(o, c, l);
2516
- r(f, l, g), i.push(get(f, "0._id", ""));
2515
+ ).indexOf(d) + 1, g = getDuplicatedBlocks(o, c, l);
2516
+ r(g, l, m), i.push(get(g, "0._id", ""));
2517
2517
  }), n(i);
2518
2518
  },
2519
2519
  [o, n]
@@ -2576,19 +2576,19 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2576
2576
  );
2577
2577
  return map(i, (c) => {
2578
2578
  const d = o(c), u = a;
2579
- let { classes: p, baseClasses: g } = getSplitClasses(get(d, l.prop, "styles:,"));
2580
- return each(u, (f) => {
2581
- const x = f.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${x}($| )`, "g");
2579
+ let { classes: p, baseClasses: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2580
+ return each(u, (g) => {
2581
+ const x = g.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${x}($| )`, "g");
2582
2582
  p = p.replace(j, " ").replace(/ +/g, " ").trim();
2583
- const E = first(f.split(":"));
2584
- includes(["2xl", "xl", "lg", "md", "sm"], E) && u.push(f.split(":").pop().trim());
2585
- }), each(u, (f) => {
2586
- const x = new RegExp(`(^| )${f.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2587
- g = g.replace(x, " ").replace(/ +/g, " ").trim();
2583
+ const E = first(g.split(":"));
2584
+ includes(["2xl", "xl", "lg", "md", "sm"], E) && u.push(g.split(":").pop().trim());
2585
+ }), each(u, (g) => {
2586
+ const x = new RegExp(`(^| )${g.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2587
+ m = m.replace(x, " ").replace(/ +/g, " ").trim();
2588
2588
  }), {
2589
2589
  ids: [d._id],
2590
2590
  props: {
2591
- [l.prop]: `${STYLES_KEY}${g},${p}`
2591
+ [l.prop]: `${STYLES_KEY}${m},${p}`
2592
2592
  }
2593
2593
  };
2594
2594
  });
@@ -2689,7 +2689,7 @@ const useLanguages = () => {
2689
2689
  let u = "";
2690
2690
  o([n], { [i]: "" });
2691
2691
  for (let p = 0; p < d.length; p++)
2692
- u += d[p].join(""), o([n], { [i]: u }), await new Promise((g) => setTimeout(g, a));
2692
+ u += d[p].join(""), o([n], { [i]: u }), await new Promise((m) => setTimeout(m, a));
2693
2693
  }
2694
2694
  }
2695
2695
  },
@@ -2887,18 +2887,18 @@ const useBlockHighlight = () => {
2887
2887
  const { width: d, height: u } = o;
2888
2888
  if (d < n) {
2889
2889
  const p = parseFloat((d / n).toFixed(2).toString());
2890
- let g = {};
2891
- const f = u * p, x = d * p;
2892
- u && (g = {
2890
+ let m = {};
2891
+ const g = u * p, x = d * p;
2892
+ u && (m = {
2893
2893
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
2894
- height: 100 + (u - f) / f * 100 + "%",
2894
+ height: 100 + (u - g) / g * 100 + "%",
2895
2895
  width: 100 + (d - x) / x * 100 + "%"
2896
2896
  }), i({
2897
2897
  position: "relative",
2898
2898
  top: 0,
2899
2899
  transform: `scale(${p})`,
2900
2900
  transformOrigin: a === "rtl" ? "top right" : "top left",
2901
- ...g,
2901
+ ...m,
2902
2902
  maxWidth: "none"
2903
2903
  // TODO: Add max-width to the wrapper
2904
2904
  }), r(p * 100);
@@ -3071,7 +3071,7 @@ const useDnd = () => {
3071
3071
  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);
3072
3072
  if (!useFeature("dnd"))
3073
3073
  return {};
3074
- const f = () => {
3074
+ const g = () => {
3075
3075
  removePlaceholder(), r(!1), u(null), p(null), possiblePositions = [];
3076
3076
  };
3077
3077
  return iframeDocument = o, {
@@ -3080,20 +3080,20 @@ const useDnd = () => {
3080
3080
  x.preventDefault(), x.stopPropagation(), throttledDragOver(x);
3081
3081
  },
3082
3082
  onDrop: (x) => {
3083
- var R;
3084
- const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : x.clientX;
3083
+ var A;
3084
+ const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((A = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : A.scrollY) : x.clientX;
3085
3085
  dropIndex = calculateDropIndex(b, possiblePositions);
3086
3086
  const k = d, S = j.getAttribute("data-block-id"), w = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3087
3087
  if ((k == null ? void 0 : k._id) === S || !w) {
3088
- f();
3088
+ g();
3089
3089
  return;
3090
3090
  }
3091
3091
  if (!has(k, "_id")) {
3092
- a(k, S === "canvas" ? null : S, dropIndex), setTimeout(f, 300);
3092
+ a(k, S === "canvas" ? null : S, dropIndex), setTimeout(g, 300);
3093
3093
  return;
3094
3094
  }
3095
3095
  let _ = j.getAttribute("data-block-id");
3096
- _ === null && (_ = x.target.parentElement.getAttribute("data-block-id")), c([k._id], _ === "canvas" ? null : _, dropIndex), f(), setTimeout(removePlaceholder, 300);
3096
+ _ === null && (_ = x.target.parentElement.getAttribute("data-block-id")), c([k._id], _ === "canvas" ? null : _, dropIndex), g(), setTimeout(removePlaceholder, 300);
3097
3097
  },
3098
3098
  onDragEnter: (x) => {
3099
3099
  const j = x, E = j.target;
@@ -3122,7 +3122,7 @@ function destroyQuill(o) {
3122
3122
  const useHandleCanvasDblClick = () => {
3123
3123
  const o = ["Heading", "Paragraph", "Text", "Link", "Span", "Button"], n = useUpdateBlocksProps(), [r, a] = useAtom$1(inlineEditingActiveAtom), { clearHighlight: l } = useBlockHighlight();
3124
3124
  return (i) => {
3125
- var f;
3125
+ var g;
3126
3126
  if (r)
3127
3127
  return;
3128
3128
  const c = getTargetedBlock(i.target), d = c.getAttribute("data-block-type");
@@ -3133,15 +3133,15 @@ const useHandleCanvasDblClick = () => {
3133
3133
  x.name !== "class" && u.removeAttribute(x.name);
3134
3134
  }), d === "Text" && (u.style.display = "inline-block"), c.parentNode.insertBefore(u, c.nextSibling);
3135
3135
  const p = new Quill(u, { placeholder: "Type here..." });
3136
- function g() {
3136
+ function m() {
3137
3137
  const x = p.getText(0, p.getLength());
3138
- n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", g, !0), destroyQuill(p), a(""), l(), u.remove();
3138
+ n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l(), u.remove();
3139
3139
  }
3140
- u.addEventListener("blur", g, !0), u.addEventListener("click", (x) => {
3140
+ u.addEventListener("blur", m, !0), u.addEventListener("click", (x) => {
3141
3141
  x.stopPropagation();
3142
3142
  }), u.addEventListener("keydown", (x) => {
3143
- (x.key === "Enter" || x.key === "Escape") && g();
3144
- }), p.focus(), (f = u.querySelector(".ql-clipboard")) == null || f.remove(), a(c.getAttribute("data-block-id"));
3143
+ (x.key === "Enter" || x.key === "Escape") && m();
3144
+ }), p.focus(), (g = u.querySelector(".ql-clipboard")) == null || g.remove(), a(c.getAttribute("data-block-id"));
3145
3145
  };
3146
3146
  }, useHandleCanvasClick = () => {
3147
3147
  const [, o] = useSelectedStylingBlocks(), [n, r] = useSelectedBlockIds(), [a] = useAtom$1(inlineEditingActiveAtom), [l] = useAtom$1(treeRefAtom), { clearHighlight: i } = useBlockHighlight();
@@ -3155,8 +3155,8 @@ const useHandleCanvasDblClick = () => {
3155
3155
  return;
3156
3156
  }
3157
3157
  if (d != null && d.getAttribute("data-block-parent")) {
3158
- const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
3159
- n.includes(g) || l == null || l.closeAll(), o([{ id: p, prop: u, blockId: g }]), r([g]);
3158
+ const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), m = d.getAttribute("data-block-parent");
3159
+ n.includes(m) || l == null || l.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
3160
3160
  } else if (d != null && d.getAttribute("data-block-id")) {
3161
3161
  const u = d.getAttribute("data-block-id");
3162
3162
  n.includes(u) || l == null || l.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
@@ -3180,17 +3180,17 @@ const useHandleCanvasDblClick = () => {
3180
3180
  setTimeout(() => {
3181
3181
  if (!isEmpty(a))
3182
3182
  return;
3183
- const f = getElementByDataBlockId(n, first(r));
3184
- if (f) {
3185
- const x = f.getAttribute("data-style-prop");
3183
+ const g = getElementByDataBlockId(n, first(r));
3184
+ if (g) {
3185
+ const x = g.getAttribute("data-style-prop");
3186
3186
  if (x) {
3187
- const j = f.getAttribute("data-style-id"), E = f.getAttribute("data-block-parent");
3187
+ const j = g.getAttribute("data-style-id"), E = g.getAttribute("data-block-parent");
3188
3188
  l([{ id: j, prop: x, blockId: E }]);
3189
3189
  }
3190
3190
  }
3191
3191
  }, 100);
3192
3192
  }, [n, r, l, a]);
3193
- const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(), g = useDnd();
3193
+ const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(), m = useDnd();
3194
3194
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
3195
3195
  "div",
3196
3196
  {
@@ -3200,23 +3200,23 @@ const useHandleCanvasDblClick = () => {
3200
3200
  onDoubleClick: c,
3201
3201
  onMouseMove: u,
3202
3202
  onMouseLeave: p,
3203
- ...omit(g, "isDragging"),
3204
- className: "relative h-full max-w-full p-px " + (g.isDragging ? "dragging" : ""),
3203
+ ...omit(m, "isDragging"),
3204
+ className: "relative h-full max-w-full p-px " + (m.isDragging ? "dragging" : ""),
3205
3205
  children: o
3206
3206
  }
3207
3207
  );
3208
3208
  }, getElementByDataBlockId = (o, n) => o.querySelector(`[data-block-id="${n}"]`), useKeyEventWatcher = (o) => {
3209
- const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: g } = usePasteBlocks();
3209
+ const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: m } = usePasteBlocks();
3210
3210
  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(
3211
3211
  "ctrl+v,command+v",
3212
3212
  () => {
3213
- p(n[0]) && g(n);
3213
+ p(n[0]) && m(n);
3214
3214
  },
3215
3215
  {},
3216
- [n, p, g]
3216
+ [n, p, m]
3217
3217
  );
3218
- const f = o ? { document: o } : {};
3219
- useHotkeys("esc", () => r([]), f, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...f, preventDefault: !0 }, [
3218
+ const g = o ? { document: o } : {};
3219
+ useHotkeys("esc", () => r([]), g, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...g, preventDefault: !0 }, [
3220
3220
  n,
3221
3221
  l
3222
3222
  ]), useHotkeys(
@@ -3224,7 +3224,7 @@ const useHandleCanvasDblClick = () => {
3224
3224
  (x) => {
3225
3225
  x.preventDefault(), a(n);
3226
3226
  },
3227
- f,
3227
+ g,
3228
3228
  [n, a]
3229
3229
  );
3230
3230
  }, KeyboardHandler = () => {
@@ -3253,15 +3253,15 @@ const useHandleCanvasDblClick = () => {
3253
3253
  }
3254
3254
  );
3255
3255
  }, BlockActionsStatic = ({ selectedBlockElement: o, block: n }) => {
3256
- const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: g } = useFloating({
3256
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: m } = useFloating({
3257
3257
  placement: "top-start",
3258
3258
  middleware: [shift(), flip()],
3259
3259
  elements: {
3260
3260
  reference: o
3261
3261
  }
3262
3262
  });
3263
- useResizeObserver(o, () => g(), o !== null);
3264
- const f = get(n, "_parent", null), x = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3263
+ useResizeObserver(o, () => m(), o !== null);
3264
+ const g = get(n, "_parent", null), x = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3265
3265
  return !o || !n || d ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3266
3266
  "div",
3267
3267
  {
@@ -3278,12 +3278,12 @@ const useHandleCanvasDblClick = () => {
3278
3278
  onKeyDown: (j) => j.stopPropagation(),
3279
3279
  className: "isolate z-[999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",
3280
3280
  children: [
3281
- f && /* @__PURE__ */ jsxRuntimeExports.jsx(
3281
+ g && /* @__PURE__ */ jsxRuntimeExports.jsx(
3282
3282
  ArrowUpIcon,
3283
3283
  {
3284
3284
  className: "hover:scale-105",
3285
3285
  onClick: () => {
3286
- c([]), l([f]);
3286
+ c([]), l([g]);
3287
3287
  }
3288
3288
  }
3289
3289
  ),
@@ -3312,9 +3312,9 @@ const useHandleCanvasDblClick = () => {
3312
3312
  }, HeadTags = () => {
3313
3313
  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(
3314
3314
  c == null ? void 0 : c.getElementById("selected-block")
3315
- ), [g] = useState(
3315
+ ), [m] = useState(
3316
3316
  c == null ? void 0 : c.getElementById("selected-styling-block")
3317
- ), [f] = useState(
3317
+ ), [g] = useState(
3318
3318
  c == null ? void 0 : c.getElementById("dragged-block")
3319
3319
  );
3320
3320
  useEffect(() => {
@@ -3322,17 +3322,17 @@ const useHandleCanvasDblClick = () => {
3322
3322
  }, [r, c]);
3323
3323
  const x = get(o, "headingFont", "DM Sans"), j = get(o, "bodyFont", "DM Sans");
3324
3324
  return useEffect(() => {
3325
- const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), w = get(o, "bodyTextDarkColor", "#000"), _ = get(o, "bodyTextLightColor", "#fff"), R = s({
3325
+ const E = get(o, "primaryColor", "#000"), b = get(o, "secondaryColor", "#FFF"), k = get(o, "bodyBgLightColor", "#fff"), S = get(o, "bodyBgDarkColor", "#000"), w = get(o, "bodyTextDarkColor", "#000"), _ = get(o, "bodyTextLightColor", "#fff"), A = s({
3326
3326
  colors: [E, b],
3327
3327
  names: ["primary", "secondary"]
3328
3328
  });
3329
- set(R, "primary.DEFAULT", E), set(R, "secondary.DEFAULT", b);
3330
- const A = {
3329
+ set(A, "primary.DEFAULT", E), set(A, "secondary.DEFAULT", b);
3330
+ const B = {
3331
3331
  "bg-light": k,
3332
3332
  "bg-dark": S,
3333
3333
  "text-dark": w,
3334
3334
  "text-light": _
3335
- }, T = get(o, "roundedCorners", "0");
3335
+ }, N = get(o, "roundedCorners", "0");
3336
3336
  !d || !d.tailwind || (d.tailwind.config = {
3337
3337
  darkMode: "class",
3338
3338
  theme: {
@@ -3349,9 +3349,9 @@ const useHandleCanvasDblClick = () => {
3349
3349
  body: [j]
3350
3350
  },
3351
3351
  borderRadius: {
3352
- DEFAULT: `${T || "0"}px`
3352
+ DEFAULT: `${N || "0"}px`
3353
3353
  },
3354
- colors: { ...A, ...R }
3354
+ colors: { ...B, ...A }
3355
3355
  }
3356
3356
  },
3357
3357
  plugins: [
@@ -3381,14 +3381,14 @@ const useHandleCanvasDblClick = () => {
3381
3381
  outline: 1px solid ${n.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3382
3382
  }`);
3383
3383
  }, [n, p]), useEffect(() => {
3384
- f.textContent = l ? `[data-block-id="${l._id}"], [data-block-id="${l._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3385
- }, [l, f]), useEffect(() => {
3384
+ g.textContent = l ? `[data-block-id="${l._id}"], [data-block-id="${l._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}` : "";
3385
+ }, [l, g]), useEffect(() => {
3386
3386
  u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3387
3387
  }, [u]), useEffect(() => {
3388
- g && (g.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
3388
+ m && (m.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
3389
3389
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3390
3390
  }`);
3391
- }, [a, g]), useEffect(() => {
3391
+ }, [a, m]), useEffect(() => {
3392
3392
  c.querySelector("#drop-target-block").innerHTML = i ? `[data-block-id="${i}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3393
3393
  }, [i]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (x || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3394
3394
  "link",
@@ -3405,11 +3405,11 @@ const useHandleCanvasDblClick = () => {
3405
3405
  u || (u = d, d = "xs");
3406
3406
  const p = r.indexOf(d);
3407
3407
  if (p <= a) {
3408
- const g = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], f = ["hidden"];
3409
- if (g.includes(u))
3408
+ const m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], g = ["hidden"];
3409
+ if (m.includes(u))
3410
3410
  for (let x = p; x < r.length; x++)
3411
3411
  i[x] = !0;
3412
- else if (f.includes(u))
3412
+ else if (g.includes(u))
3413
3413
  for (let x = p; x < r.length; x++)
3414
3414
  i[x] = !1;
3415
3415
  }
@@ -3431,23 +3431,23 @@ const useHandleCanvasDblClick = () => {
3431
3431
  return { getRSCBlockMarkup: a, getRSCBlockState: l, reset: i };
3432
3432
  }, useWatchRSCBlocks = () => {
3433
3433
  const [o] = useBlocksStore(), [n, r] = useAtom(rscBlocksStoreAtom), [a, l] = useAtom(rscBlocksLoadingStateAtom), i = useChaiBlocks(), c = useBuilderProp("getRSCBlock", async (u) => ""), d = useMemo(() => o.filter((p) => {
3434
- var f;
3435
- return (f = get(i, p._type)) == null ? void 0 : f.server;
3434
+ var g;
3435
+ return (g = get(i, p._type)) == null ? void 0 : g.server;
3436
3436
  }).map((p) => p._id), [i, o]);
3437
3437
  useEffect(() => {
3438
3438
  forEach(d, (u) => {
3439
3439
  if (get(n, u, "") || get(a, `${u}.loading`, !1))
3440
3440
  return;
3441
- const p = o.find((g) => g._id === u);
3442
- l((g) => ({ ...g, [u]: { loading: !0, error: null } })), c(p).then((g) => {
3443
- r((f) => ({ ...f, [u]: g })), l((f) => ({
3444
- ...f,
3441
+ const p = o.find((m) => m._id === u);
3442
+ l((m) => ({ ...m, [u]: { loading: !0, error: null } })), c(p).then((m) => {
3443
+ r((g) => ({ ...g, [u]: m })), l((g) => ({
3444
+ ...g,
3445
3445
  [u]: { loading: !1, error: null }
3446
3446
  }));
3447
- }).catch((g) => {
3448
- l((f) => ({
3449
- ...f,
3450
- [u]: { loading: !1, error: g.message }
3447
+ }).catch((m) => {
3448
+ l((g) => ({
3449
+ ...g,
3450
+ [u]: { loading: !1, error: m.message }
3451
3451
  }));
3452
3452
  });
3453
3453
  });
@@ -3512,7 +3512,7 @@ function applyLanguage(o, n, r) {
3512
3512
  }), a;
3513
3513
  }
3514
3514
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3515
- const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: g } = useGlobalBlocksStore(), f = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3515
+ const { selectedLang: r } = useLanguages(), [a] = useAtom$1(xShowBlocksAtom), [l] = useCutBlockIds(), [i] = useAtom$1(draggedBlockAtom), [c] = useAtom$1(dropTargetBlockIdAtom), [, d] = useCanvasWidth(), [u] = useCanvasSettings(), [p] = useHiddenBlockIds(), { getGlobalBlocks: m } = useGlobalBlocksStore(), g = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3516
3516
  (b) => b.reduce((k, S) => {
3517
3517
  const w = get(u, S, {});
3518
3518
  return { ...k, ...w };
@@ -3525,16 +3525,16 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3525
3525
  return null;
3526
3526
  const S = {}, w = filter(n, { _parent: b._id });
3527
3527
  if (S.children = w.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: w }) : null, b._type === "GlobalBlock") {
3528
- const C = g(b);
3529
- S.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (B) => !B._parent), allBlocks: C });
3528
+ const v = m(b);
3529
+ S.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(v, (R) => !R._parent), allBlocks: v });
3530
3530
  }
3531
- const _ = getBlockComponent(b._type), R = get(_, "server", !1), A = R ? RSCBlock : get(_, "builderComponent", get(_, "component", null));
3532
- if (isNull(A))
3531
+ const _ = getBlockComponent(b._type), A = get(_, "server", !1), B = A ? RSCBlock : get(_, "builderComponent", get(_, "component", null));
3532
+ if (isNull(B))
3533
3533
  return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
3534
- const T = has(_, "getBlockStateFrom") ? _ == null ? void 0 : _.getBlockStateFrom(b, n) : [], L = E(T), D = f(b);
3534
+ const N = has(_, "getBlockStateFrom") ? _ == null ? void 0 : _.getBlockStateFrom(b, n) : [], L = E(N), D = g(b);
3535
3535
  if (get(D, "__isHidden", !1) && !includes(a, b._id))
3536
3536
  return null;
3537
- const m = i && isDescendant(i._id, b._id, n), v = {
3537
+ const f = i && isDescendant(i._id, b._id, n), C = {
3538
3538
  ...includes(a, b._id) ? { "force-show": "" } : {},
3539
3539
  "data-block-id": b._id,
3540
3540
  "data-block-type": b._type,
@@ -3542,14 +3542,14 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3542
3542
  // @ts-ignore
3543
3543
  {
3544
3544
  "data-dnd": canAcceptChildBlock(b._type, i == null ? void 0 : i._type) ? "yes" : "no",
3545
- "data-dnd-dragged": i._id === b._id || m ? "yes" : "no"
3545
+ "data-dnd-dragged": i._id === b._id || f ? "yes" : "no"
3546
3546
  }
3547
3547
  ) : {},
3548
- ...c === b._id && !m ? { "data-drop": "yes" } : {},
3548
+ ...c === b._id && !f ? { "data-drop": "yes" } : {},
3549
3549
  ...includes(l, b._id) ? { "data-cut-block": "yes" } : {}
3550
3550
  };
3551
- return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: v }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3552
- blockProps: v,
3551
+ return A ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: C }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(B, {
3552
+ blockProps: C,
3553
3553
  index: k,
3554
3554
  ...applyBindings(applyLanguage(b, r, _), x),
3555
3555
  ...omit(D, ["__isHidden"]),
@@ -3609,41 +3609,41 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3609
3609
  };
3610
3610
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", onClick: d, className: "h-full w-full p-8 pb-0", ref: i, children: o });
3611
3611
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3612
- const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [g, f] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), S = useBuilderProp("htmlDir", "ltr"), w = (A) => {
3613
- u((T) => ({ ...T, width: A }));
3612
+ const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [m, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), S = useBuilderProp("htmlDir", "ltr"), w = (B) => {
3613
+ u((N) => ({ ...N, width: B }));
3614
3614
  };
3615
3615
  useEffect(() => {
3616
3616
  if (!c.current)
3617
3617
  return;
3618
- const { clientWidth: A, clientHeight: T } = c.current;
3619
- u({ width: A, height: T });
3618
+ const { clientWidth: B, clientHeight: N } = c.current;
3619
+ u({ width: B, height: N });
3620
3620
  }, [c, n]);
3621
- const _ = (A, T = 0) => {
3622
- const { top: L } = A.getBoundingClientRect();
3623
- return L + T >= 0 && L - T <= window.innerHeight;
3621
+ const _ = (B, N = 0) => {
3622
+ const { top: L } = B.getBoundingClientRect();
3623
+ return L + N >= 0 && L - N <= window.innerHeight;
3624
3624
  };
3625
3625
  useEffect(() => {
3626
- var A, T;
3626
+ var B, N;
3627
3627
  if (a && a.type !== "Multiple" && i.current) {
3628
3628
  const L = getElementByDataBlockId(i.current.contentDocument, a._id);
3629
- L && (_(L) || (T = (A = i.current) == null ? void 0 : A.contentWindow) == null || T.scrollTo({ top: L.offsetTop, behavior: "smooth" }), f([L]));
3629
+ L && (_(L) || (N = (B = i.current) == null ? void 0 : B.contentWindow) == null || N.scrollTo({ top: L.offsetTop, behavior: "smooth" }), g([L]));
3630
3630
  }
3631
3631
  }, [a]), useEffect(() => {
3632
3632
  if (!isEmpty(E) && i.current) {
3633
- const A = getElementByStyleId(
3633
+ const B = getElementByStyleId(
3634
3634
  i.current.contentDocument,
3635
3635
  first(E).id
3636
3636
  );
3637
- x(A ? [A] : [null]);
3637
+ x(B ? [B] : [null]);
3638
3638
  } else
3639
3639
  x([null]);
3640
3640
  }, [E]);
3641
- const R = useMemo(() => {
3642
- let A = IframeInitialContent;
3643
- return A = A.replace("__HTML_DIR__", S), o === "offline" && (A = A.replace(
3641
+ const A = useMemo(() => {
3642
+ let B = IframeInitialContent;
3643
+ return B = B.replace("__HTML_DIR__", S), o === "offline" && (B = B.replace(
3644
3644
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3645
3645
  "/offline/tailwind.cdn.js"
3646
- ), A = A.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), A = A.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), A;
3646
+ ), B = B.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), B = B.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), B;
3647
3647
  }, [o, S]);
3648
3648
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: w, onResize: w, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3649
3649
  "div",
@@ -3662,14 +3662,14 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3662
3662
  id: "canvas-iframe",
3663
3663
  style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
3664
3664
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3665
- initialContent: R,
3665
+ initialContent: A,
3666
3666
  children: [
3667
3667
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3668
3668
  /* @__PURE__ */ jsxRuntimeExports.jsx(
3669
3669
  BlockActionsStatic,
3670
3670
  {
3671
3671
  block: a,
3672
- selectedBlockElement: first(g)
3672
+ selectedBlockElement: first(m)
3673
3673
  }
3674
3674
  ),
3675
3675
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, {}),
@@ -3785,7 +3785,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3785
3785
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3786
3786
  ] }, l))
3787
3787
  ] }) });
3788
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-q9he9IC8.js")), CanvasArea = () => {
3788
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-lBqxrWBC.js")), CanvasArea = () => {
3789
3789
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3790
3790
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
3791
3791
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas$1, {}) }) }),
@@ -3860,13 +3860,13 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3860
3860
  showHeading: o = !0,
3861
3861
  className: n = ""
3862
3862
  }) => {
3863
- const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: R }, A) => {
3864
- A && (a(R), i.current = R);
3863
+ const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: A }, B) => {
3864
+ B && (a(A), i.current = A);
3865
3865
  }, {
3866
3866
  bodyFont: u,
3867
3867
  headingFont: p,
3868
- primaryColor: g,
3869
- bodyTextDarkColor: f,
3868
+ primaryColor: m,
3869
+ bodyTextDarkColor: g,
3870
3870
  bodyTextLightColor: x,
3871
3871
  bodyBgDarkColor: j,
3872
3872
  secondaryColor: E,
@@ -3888,7 +3888,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3888
3888
  title: c("Theme Config.Rounded Corner"),
3889
3889
  default: parseInt(k || 5, 10)
3890
3890
  }),
3891
- primaryColor: h({ title: c("Theme Config.Primary"), default: g }),
3891
+ primaryColor: h({ title: c("Theme Config.Primary"), default: m }),
3892
3892
  secondaryColor: h({ title: c("Theme Config.Secondary"), default: E })
3893
3893
  };
3894
3894
  l || (S = {
@@ -3899,7 +3899,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3899
3899
  }),
3900
3900
  bodyTextLightColor: h({
3901
3901
  title: c("Theme Config.Text Color"),
3902
- default: f
3902
+ default: g
3903
3903
  }),
3904
3904
  bodyBgDarkColor: h({
3905
3905
  title: c("Theme Config.Background Dark Mode"),
@@ -3914,9 +3914,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3914
3914
  type: "object",
3915
3915
  properties: {}
3916
3916
  }, _ = {};
3917
- return Object.keys(S).forEach((R) => {
3918
- const A = S[R];
3919
- return w.properties || (w.properties = {}), w.properties[R] = A.schema, _[R] = A.uiSchema, !0;
3917
+ return Object.keys(S).forEach((A) => {
3918
+ const B = S[A];
3919
+ return w.properties || (w.properties = {}), w.properties[A] = B.schema, _[A] = B.uiSchema, !0;
3920
3920
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3921
3921
  o ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md bg-background/30 p-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "px-1 font-semibold", children: c("Theme Configuration") }) }) : null,
3922
3922
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4112,34 +4112,34 @@ function BiExpandVertical(o) {
4112
4112
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4113
4113
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [d] = useAtom$1(canvasIframeAtom);
4114
4114
  let u = null;
4115
- const p = o.children.length > 0, { highlightBlock: g, clearHighlight: f } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: S, handleClick: w } = o, _ = (m) => {
4116
- m.stopPropagation(), !i.includes(x) && o.toggle();
4117
- }, R = (m) => {
4118
- m.isInternal && (u = m.isOpen, m.isOpen && m.close());
4119
- }, A = (m) => {
4120
- m.isInternal && u !== null && (u ? m.open() : m.close(), u = null);
4121
- }, T = (m) => {
4122
- m.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), w(m);
4115
+ const p = o.children.length > 0, { highlightBlock: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: S, handleClick: w } = o, _ = (f) => {
4116
+ f.stopPropagation(), !i.includes(x) && o.toggle();
4117
+ }, A = (f) => {
4118
+ f.isInternal && (u = f.isOpen, f.isOpen && f.close());
4119
+ }, B = (f) => {
4120
+ f.isInternal && u !== null && (u ? f.open() : f.close(), u = null);
4121
+ }, N = (f) => {
4122
+ f.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), w(f);
4123
4123
  };
4124
4124
  useEffect(() => {
4125
- const m = setTimeout(() => {
4125
+ const f = setTimeout(() => {
4126
4126
  b && !o.isOpen && !k && !i.includes(x) && o.toggle();
4127
4127
  }, 500);
4128
- return () => clearTimeout(m);
4128
+ return () => clearTimeout(f);
4129
4129
  }, [b, o, k]);
4130
4130
  const L = useMemo(() => {
4131
- const m = Object.keys(j), v = [];
4132
- for (let C = 0; C < m.length; C++)
4133
- if (m[C].endsWith("_attrs")) {
4134
- const B = j[m[C]], I = Object.keys(B).join("|");
4135
- I.match(/x-data/) && v.push("data"), I.match(/x-on/) && v.push("event"), I.match(/x-show|x-if/) && v.push("show");
4131
+ const f = Object.keys(j), C = [];
4132
+ for (let v = 0; v < f.length; v++)
4133
+ if (f[v].endsWith("_attrs")) {
4134
+ const R = j[f[v]], I = Object.keys(R).join("|");
4135
+ I.match(/x-data/) && C.push("data"), I.match(/x-on/) && C.push("event"), I.match(/x-show|x-if/) && C.push("show");
4136
4136
  }
4137
- return v;
4138
- }, [j]), D = (m, v) => {
4139
- const C = d.contentDocument || d.contentWindow.document, B = C.querySelector(`[data-block-id=${m}]`);
4140
- B && B.setAttribute("data-drop", v);
4141
- const I = B.getBoundingClientRect(), N = d.getBoundingClientRect();
4142
- I.top >= N.top && I.left >= N.left && I.bottom <= N.bottom && I.right <= N.right || (C.documentElement.scrollTop = B.offsetTop - N.top);
4137
+ return C;
4138
+ }, [j]), D = (f, C) => {
4139
+ const v = d.contentDocument || d.contentWindow.document, R = v.querySelector(`[data-block-id=${f}]`);
4140
+ R && R.setAttribute("data-drop", C);
4141
+ const I = R.getBoundingClientRect(), T = d.getBoundingClientRect();
4142
+ I.top >= T.top && I.left >= T.left && I.bottom <= T.bottom && I.right <= T.right || (v.documentElement.scrollTop = R.offsetTop - T.top);
4143
4143
  };
4144
4144
  return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4145
4145
  "button",
@@ -4154,22 +4154,22 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4154
4154
  ) : /* @__PURE__ */ jsxRuntimeExports.jsx(BlockContextMenu, { id: x, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
4155
4155
  "div",
4156
4156
  {
4157
- onMouseEnter: () => g(x),
4158
- onMouseLeave: () => f(),
4159
- onClick: T,
4157
+ onMouseEnter: () => m(x),
4158
+ onMouseLeave: () => g(),
4159
+ onClick: N,
4160
4160
  style: n,
4161
4161
  "data-node-id": x,
4162
4162
  ref: i.includes(x) ? null : r,
4163
- onDragStart: () => R(o),
4164
- onDragEnd: () => A(o),
4165
- onDragOver: (m) => {
4166
- m.preventDefault(), D(x, "yes");
4163
+ onDragStart: () => A(o),
4164
+ onDragEnd: () => B(o),
4165
+ onDragOver: (f) => {
4166
+ f.preventDefault(), D(x, "yes");
4167
4167
  },
4168
- onDragLeave: (m) => {
4169
- m.preventDefault(), D(x, "no");
4168
+ onDragLeave: (f) => {
4169
+ f.preventDefault(), D(x, "no");
4170
4170
  },
4171
- onDrop: (m) => {
4172
- m.preventDefault(), D(x, "no");
4171
+ onDrop: (f) => {
4172
+ f.preventDefault(), D(x, "no");
4173
4173
  },
4174
4174
  className: cn(
4175
4175
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
@@ -4193,8 +4193,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4193
4193
  "div",
4194
4194
  {
4195
4195
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
4196
- onDoubleClick: (m) => {
4197
- m.stopPropagation(), o.edit(), o.deselect();
4196
+ onDoubleClick: (f) => {
4197
+ f.stopPropagation(), o.edit(), o.deselect();
4198
4198
  },
4199
4199
  children: [
4200
4200
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: (j == null ? void 0 : j._name) || (j == null ? void 0 : j._type.split("/").pop()) }),
@@ -4207,16 +4207,16 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4207
4207
  ] })
4208
4208
  ] }),
4209
4209
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "invisible flex items-center space-x-1 pr-2 group-hover:visible", children: [
4210
- !i.includes(x) && a.map((m) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4210
+ !i.includes(x) && a.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4211
4211
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4212
4212
  TooltipTrigger,
4213
4213
  {
4214
4214
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-blue-500",
4215
4215
  asChild: !0,
4216
- children: React__default.createElement(m.item, { blockId: x })
4216
+ children: React__default.createElement(f.item, { blockId: x })
4217
4217
  }
4218
4218
  ),
4219
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: m.tooltip })
4219
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: f.tooltip })
4220
4220
  ] })),
4221
4221
  canAddChildBlock(j == null ? void 0 : j._type) && !i.includes(x) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4222
4222
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4234,8 +4234,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4234
4234
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4235
4235
  TooltipTrigger,
4236
4236
  {
4237
- onClick: (m) => {
4238
- m.stopPropagation(), c(x), o.isOpen && o.toggle();
4237
+ onClick: (f) => {
4238
+ f.stopPropagation(), c(x), o.isOpen && o.toggle();
4239
4239
  },
4240
4240
  className: "cursor-pointer rounded bg-transparent hover:bg-white hover:text-black",
4241
4241
  asChild: !0,
@@ -4577,7 +4577,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4577
4577
  }
4578
4578
  }
4579
4579
  }, traverseNodes = (o, n = null) => flatMapDeep(o, (r) => {
4580
- var u, p, g, f, x, j, E, b;
4580
+ var u, p, m, g, x, j, E, b;
4581
4581
  if (r.type === "comment")
4582
4582
  return [];
4583
4583
  let a = { _id: generateUUID() };
@@ -4614,8 +4614,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4614
4614
  ...a,
4615
4615
  href: ((u = l.find((S) => S.key === "href")) == null ? void 0 : u.value) || "",
4616
4616
  hrefType: ((p = l.find((S) => S.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4617
- autoplay: ((g = l.find((S) => S.key === "data-autoplay")) == null ? void 0 : g.value) === "true",
4618
- maxWidth: ((x = (f = l.find((S) => S.key === "data-maxwidth")) == null ? void 0 : f.value) == null ? void 0 : x.replace("px", "")) || "",
4617
+ autoplay: ((m = l.find((S) => S.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
4618
+ maxWidth: ((x = (g = l.find((S) => S.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : x.replace("px", "")) || "",
4619
4619
  backdropColor: ((j = l.find((S) => S.key === "data-overlay")) == null ? void 0 : j.value) || "",
4620
4620
  galleryName: ((E = l.find((S) => S.key === "data-gall")) == null ? void 0 : E.value) || ""
4621
4621
  }, forEach(k, (S) => {
@@ -4629,8 +4629,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4629
4629
  const k = stringify([r]);
4630
4630
  return hasVideoEmbed(k) && (set(a, "_type", "Video"), set(a, "url", getVideoURLFromHTML(k)), set(a, "styles", `${STYLES_KEY},absolute top-0 left-0 w-full h-full`), set(a, "controls", { autoPlay: !1, muted: !0, loop: !1, controls: !1 })), a.content = k, [a];
4631
4631
  } else if (r.tagName === "svg") {
4632
- const k = find(r.attributes, { key: "height" }), S = find(r.attributes, { key: "width" }), w = get(k, "value") ? `[${get(k, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px", R = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4633
- return a.styles = `${STYLES_KEY}, ${cn(`w-${_} h-${w}`, R)}`.trim(), r.attributes = filter(r.attributes, (A) => !includes(["style", "width", "height", "class"], A.key)), a.icon = stringify([r]), [a];
4632
+ const k = find(r.attributes, { key: "height" }), S = find(r.attributes, { key: "width" }), w = get(k, "value") ? `[${get(k, "value")}px]` : "24px", _ = get(S, "value") ? `[${get(S, "value")}px]` : "24px", A = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4633
+ return a.styles = `${STYLES_KEY}, ${cn(`w-${_} h-${w}`, A)}`.trim(), r.attributes = filter(r.attributes, (B) => !includes(["style", "width", "height", "class"], B.key)), a.icon = stringify([r]), [a];
4634
4634
  } else if (r.tagName == "option" && n && ((b = n.block) == null ? void 0 : b._type) === "Select")
4635
4635
  return n.block.options.push({
4636
4636
  label: getTextContent(r.children),
@@ -4691,14 +4691,14 @@ function ExpandableObject(o) {
4691
4691
  level: d,
4692
4692
  style: u,
4693
4693
  shouldExpandNode: p,
4694
- clickToExpandNode: g
4694
+ clickToExpandNode: m
4695
4695
  } = o;
4696
- const f = useRef(!1), [x, j, E] = useBool(() => p(d, r, n));
4696
+ const g = useRef(!1), [x, j, E] = useBool(() => p(d, r, n));
4697
4697
  useEffect(() => {
4698
- f.current ? E(p(d, r, n)) : f.current = !0;
4698
+ g.current ? E(p(d, r, n)) : g.current = !0;
4699
4699
  }, [p]);
4700
- const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", S = useComponentId(), w = d + 1, _ = a.length - 1, R = (A) => {
4701
- A.key === " " && (A.preventDefault(), j());
4700
+ const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", S = useComponentId(), w = d + 1, _ = a.length - 1, A = (B) => {
4701
+ B.key === " " && (B.preventDefault(), j());
4702
4702
  };
4703
4703
  return /* @__PURE__ */ createElement("div", {
4704
4704
  className: u.basicChildStyle,
@@ -4706,16 +4706,16 @@ function ExpandableObject(o) {
4706
4706
  }, /* @__PURE__ */ createElement("span", {
4707
4707
  className: b,
4708
4708
  onClick: j,
4709
- onKeyDown: R,
4709
+ onKeyDown: A,
4710
4710
  role: "button",
4711
4711
  tabIndex: 0,
4712
4712
  "aria-label": k,
4713
4713
  "aria-expanded": x,
4714
4714
  "aria-controls": x ? S : void 0
4715
- }), n && (g ? /* @__PURE__ */ createElement("span", {
4715
+ }), n && (m ? /* @__PURE__ */ createElement("span", {
4716
4716
  className: u.clickableLabel,
4717
4717
  onClick: j,
4718
- onKeyDown: R,
4718
+ onKeyDown: A,
4719
4719
  role: "button",
4720
4720
  tabIndex: -1
4721
4721
  }, n, ":") : /* @__PURE__ */ createElement("span", {
@@ -4724,19 +4724,19 @@ function ExpandableObject(o) {
4724
4724
  className: u.punctuation
4725
4725
  }, i), x ? /* @__PURE__ */ createElement("div", {
4726
4726
  id: S
4727
- }, a.map((A, T) => /* @__PURE__ */ createElement(DataRender, {
4728
- key: A[0] || T,
4729
- field: A[0],
4730
- value: A[1],
4727
+ }, a.map((B, N) => /* @__PURE__ */ createElement(DataRender, {
4728
+ key: B[0] || N,
4729
+ field: B[0],
4730
+ value: B[1],
4731
4731
  style: u,
4732
- lastElement: T === _,
4732
+ lastElement: N === _,
4733
4733
  level: w,
4734
4734
  shouldExpandNode: p,
4735
- clickToExpandNode: g
4735
+ clickToExpandNode: m
4736
4736
  }))) : /* @__PURE__ */ createElement("span", {
4737
4737
  className: u.collapsedContent,
4738
4738
  onClick: j,
4739
- onKeyDown: R,
4739
+ onKeyDown: A,
4740
4740
  role: "button",
4741
4741
  tabIndex: -1,
4742
4742
  "aria-hidden": !0,
@@ -4894,7 +4894,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4894
4894
  dataType: i,
4895
4895
  appliedBindings: c
4896
4896
  }) => {
4897
- const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, g = o === "PROP", [f, x] = useState(!1), j = useMemo(() => o === "PROP" ? d.filter(
4897
+ const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, m = o === "PROP", [g, x] = useState(!1), j = useMemo(() => o === "PROP" ? d.filter(
4898
4898
  (E) => !includes(c, E) && get(p, `props.${first(split(E, "."))}.binding`)
4899
4899
  ) : d.filter((E) => i === get(u, E, "")), [o, d, c, i, p]);
4900
4900
  return useEffect(() => {
@@ -4902,7 +4902,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4902
4902
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4903
4903
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-4", children: [
4904
4904
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: startCase(toLower(o)) }),
4905
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: f, onOpenChange: x, children: [
4905
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: g, onOpenChange: x, children: [
4906
4906
  /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
4907
4907
  Button,
4908
4908
  {
@@ -4911,7 +4911,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4911
4911
  className: ` ${isEmpty(n) ? "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white" : "min-w-[350px] items-center justify-between"}`,
4912
4912
  children: n ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4913
4913
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "pr-8 text-sm", children: [
4914
- g && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
4914
+ m && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(i) }),
4915
4915
  n
4916
4916
  ] }),
4917
4917
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700", children: "Change" })
@@ -4929,7 +4929,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4929
4929
  CommandItem,
4930
4930
  {
4931
4931
  value: E,
4932
- className: `cursor-pointer ${g ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4932
+ className: `cursor-pointer ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4933
4933
  onSelect: (b) => {
4934
4934
  r(find(j, (k) => k === b) || null), x(!1);
4935
4935
  },
@@ -4938,7 +4938,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4938
4938
  /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === E ? "" : "opacity-0"}` }),
4939
4939
  E
4940
4940
  ] }),
4941
- g ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, E, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, E) }) })
4941
+ m ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500", children: startCase(get(u, E, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, E) }) })
4942
4942
  ]
4943
4943
  },
4944
4944
  E
@@ -4947,7 +4947,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4947
4947
  ] }) })
4948
4948
  ] })
4949
4949
  ] }),
4950
- !g && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4950
+ !m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4951
4951
  ] });
4952
4952
  }, AddBindingModalContent = ({
4953
4953
  appliedBindings: o = [],
@@ -4955,7 +4955,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4955
4955
  editMode: r,
4956
4956
  item: a
4957
4957
  }) => {
4958
- const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = useCallback(
4958
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), m = useCallback(
4959
4959
  (j, E) => {
4960
4960
  if (isEmpty(j))
4961
4961
  return "";
@@ -4968,7 +4968,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4968
4968
  }
4969
4969
  },
4970
4970
  [u, p]
4971
- ), [f, x] = useState(r ? g(a.key, "PROP") : "");
4971
+ ), [g, x] = useState(r ? m(a.key, "PROP") : "");
4972
4972
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
4973
4973
  /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogHeader, { children: [
4974
4974
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: "Add Data Binding" }),
@@ -4984,11 +4984,11 @@ const ViewData = ({ data: o, fullView: n }) => {
4984
4984
  value: l,
4985
4985
  setValue: i,
4986
4986
  onChange: (j) => {
4987
- const E = g(j, "PROP");
4988
- i(j), f !== E && d(""), x(E);
4987
+ const E = m(j, "PROP");
4988
+ i(j), g !== E && d(""), x(E);
4989
4989
  },
4990
4990
  data: u,
4991
- dataType: f,
4991
+ dataType: g,
4992
4992
  appliedBindings: o
4993
4993
  }
4994
4994
  ),
@@ -5002,11 +5002,11 @@ const ViewData = ({ data: o, fullView: n }) => {
5002
5002
  value: c,
5003
5003
  setValue: d,
5004
5004
  onChange: (j) => {
5005
- const E = g(j, "PATH");
5006
- d(f === E ? j : "");
5005
+ const E = m(j, "PATH");
5006
+ d(g === E ? j : "");
5007
5007
  },
5008
5008
  data: p,
5009
- dataType: f,
5009
+ dataType: g,
5010
5010
  appliedBindings: o
5011
5011
  }
5012
5012
  )
@@ -5046,14 +5046,14 @@ const ViewData = ({ data: o, fullView: n }) => {
5046
5046
  dataProvider: l,
5047
5047
  appliedBindings: i
5048
5048
  }) => {
5049
- const [c, d] = useState("string"), u = (p, g) => {
5049
+ const [c, d] = useState("string"), u = (p, m) => {
5050
5050
  if (isEmpty(p))
5051
5051
  return "";
5052
5052
  {
5053
- const f = get(g === "PROP" ? a : l, p, "");
5054
- if (isArray$1(f))
5053
+ const g = get(m === "PROP" ? a : l, p, "");
5054
+ if (isArray$1(g))
5055
5055
  return "list";
5056
- const x = typeof f;
5056
+ const x = typeof g;
5057
5057
  return x === "string" ? "text" : x === "object" ? "model" : x;
5058
5058
  }
5059
5059
  };
@@ -5075,32 +5075,32 @@ const ViewData = ({ data: o, fullView: n }) => {
5075
5075
  ] });
5076
5076
  }, DataBindingSetting = ({ bindingData: o, onChange: n }) => {
5077
5077
  const r = useSelectedBlock(), [a] = useChaiExternalData(), l = getChaiDataProviders(), [i, c] = useState(
5078
- map(o, (f, x) => ({ key: x, value: f }))
5078
+ map(o, (g, x) => ({ key: x, value: g }))
5079
5079
  );
5080
5080
  useEffect(() => {
5081
- c(map(o, (f, x) => ({ key: x, value: f })));
5081
+ c(map(o, (g, x) => ({ key: x, value: g })));
5082
5082
  }, [r == null ? void 0 : r._id, o]);
5083
5083
  const d = useMemo(() => {
5084
5084
  if (isEmpty(a))
5085
5085
  return !0;
5086
5086
  if (isEmpty(i))
5087
5087
  return !1;
5088
- const f = last(i);
5089
- return isEmpty(f == null ? void 0 : f.key) || isEmpty(f == null ? void 0 : f.value);
5090
- }, [a, i]), u = (f) => {
5091
- const x = filter(i, (j) => j.key !== f.key);
5092
- c([...x, f]), g([...x, f]);
5093
- }, p = (f) => {
5094
- const x = filter(i, (j, E) => f !== E);
5095
- g([...x]);
5096
- }, g = useCallback(
5097
- (f = []) => {
5098
- if (c(f), isEmpty(f)) {
5088
+ const g = last(i);
5089
+ return isEmpty(g == null ? void 0 : g.key) || isEmpty(g == null ? void 0 : g.value);
5090
+ }, [a, i]), u = (g) => {
5091
+ const x = filter(i, (j) => j.key !== g.key);
5092
+ c([...x, g]), m([...x, g]);
5093
+ }, p = (g) => {
5094
+ const x = filter(i, (j, E) => g !== E);
5095
+ m([...x]);
5096
+ }, m = useCallback(
5097
+ (g = []) => {
5098
+ if (c(g), isEmpty(g)) {
5099
5099
  n({});
5100
5100
  return;
5101
5101
  }
5102
5102
  const x = {};
5103
- forEach(f, (j) => {
5103
+ forEach(g, (j) => {
5104
5104
  !isEmpty(j == null ? void 0 : j.key) && !isEmpty(j == null ? void 0 : j.value) && set(x, j.key, j.value);
5105
5105
  }), n(x);
5106
5106
  },
@@ -5111,17 +5111,17 @@ const ViewData = ({ data: o, fullView: n }) => {
5111
5111
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
5112
5112
  /* @__PURE__ */ jsxRuntimeExports.jsx("a", { className: "text-blue-500", href: "https://chaibuilder.com/docs/registering-data-providers", target: "_blank", children: "Learn more" })
5113
5113
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
5114
- map(i, (f, x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5114
+ map(i, (g, x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5115
5115
  NewDataBindingPair,
5116
5116
  {
5117
- item: f,
5117
+ item: g,
5118
5118
  onAddBinding: u,
5119
5119
  onRemove: () => p(x),
5120
5120
  selectedBlock: r,
5121
5121
  dataProvider: a,
5122
5122
  appliedBindings: map(i, "key")
5123
5123
  },
5124
- f.key
5124
+ g.key
5125
5125
  )),
5126
5126
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 200, children: [
5127
5127
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { disabled: isEmpty(a), className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -5210,7 +5210,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5210
5210
  }
5211
5211
  )
5212
5212
  ] });
5213
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-chQ74Yzq.js")), UploadImages = React__default.lazy(() => import("./UploadImages-Auy8ZPBl.js")), ImagesPanel = ({
5213
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages--HU-110a.js")), UploadImages = React__default.lazy(() => import("./UploadImages-bc0b7i8I.js")), ImagesPanel = ({
5214
5214
  isModalView: o = !1,
5215
5215
  onSelect: n = () => {
5216
5216
  }
@@ -5300,115 +5300,114 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5300
5300
  }
5301
5301
  );
5302
5302
  }, CollectionField = ({
5303
- formData: o,
5303
+ href: o,
5304
5304
  collections: n,
5305
5305
  onChange: r
5306
5306
  }) => {
5307
- var D;
5308
- const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (m, v) => []), [i, c] = useState(""), [d, u] = useState(!1), [p, g] = useState("pages"), [f, x] = useState(""), [j, E] = useState([]), [b, k] = useState(-1), S = useRef(null), w = (D = n == null ? void 0 : n.find((m) => m.key === p)) == null ? void 0 : D.name;
5307
+ var C;
5308
+ const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (v, R) => []), [i, c] = useState(!1), [d, u] = useState(!1), [p, m] = useState(!1), [g, x] = useState("pages"), [j, E] = useState(""), [b, k] = useState([]), [S, w] = useState(-1), _ = useRef(null), A = (C = n == null ? void 0 : n.find((v) => v.key === g)) == null ? void 0 : C.name;
5309
5309
  useEffect(() => {
5310
- const m = split((o == null ? void 0 : o.href) || "", ":"), v = get(m, 1, "pages") || "pages";
5311
- g(v), x(""), E([]), k(-1), (async () => {
5312
- c("FETCHING_INIT_VALUE");
5313
- const C = await l(v, [get(m, 2, "pages")]);
5314
- C && Array.isArray(C) && x(get(C, [0, "name"], "")), c("");
5310
+ if (!o || d || !startsWith(o, "collection:") || i)
5311
+ return;
5312
+ const v = split(o, ":"), R = get(v, 1, "pages") || "pages";
5313
+ x(R), E(""), k([]), w(-1), (async () => {
5314
+ u(!0);
5315
+ const I = await l(R, [get(v, 2, "pages")]);
5316
+ I && Array.isArray(I) && E(get(I, [0, "name"], "")), c(!0), u(!1);
5315
5317
  })();
5316
- }, [o == null ? void 0 : o.href, l]);
5317
- const _ = useCallback(
5318
- debounce(async (m) => {
5319
- if (isEmpty(m))
5320
- E([]);
5318
+ }, [o]);
5319
+ const B = useDebouncedCallback(
5320
+ async (v) => {
5321
+ if (isEmpty(v))
5322
+ k([]);
5321
5323
  else {
5322
- const v = await l(p, m);
5323
- E(v);
5324
+ const R = await l(g, v);
5325
+ k(R);
5324
5326
  }
5325
- c(""), k(-1);
5326
- }, 300),
5327
- [p]
5328
- ), R = (m) => {
5329
- const v = ["collection", p, m.id];
5330
- v[1] && (r({ ...o, href: v.join(":") }), u(!1));
5331
- }, A = (m) => {
5332
- switch (m.key) {
5327
+ u(!1), w(-1);
5328
+ },
5329
+ [g],
5330
+ 300
5331
+ ), N = (v) => {
5332
+ const R = ["collection", g, v.id];
5333
+ R[1] && (r(R.join(":")), E(v.name), m(!1), k([]), w(-1));
5334
+ }, L = (v) => {
5335
+ switch (v.key) {
5333
5336
  case "ArrowDown":
5334
- m.preventDefault(), k((v) => v < j.length - 1 ? v + 1 : v);
5337
+ v.preventDefault(), w((R) => R < b.length - 1 ? R + 1 : R);
5335
5338
  break;
5336
5339
  case "ArrowUp":
5337
- m.preventDefault(), k((v) => v > 0 ? v - 1 : v);
5340
+ v.preventDefault(), w((R) => R > 0 ? R - 1 : R);
5338
5341
  break;
5339
5342
  case "Enter":
5340
- if (m.preventDefault(), j.length === 0)
5343
+ if (v.preventDefault(), b.length === 0)
5341
5344
  return;
5342
- b >= 0 && R(j[b]);
5345
+ S >= 0 && N(b[S]);
5343
5346
  break;
5344
5347
  case "Escape":
5345
- m.preventDefault(), T();
5348
+ v.preventDefault(), D();
5346
5349
  break;
5347
5350
  }
5348
5351
  };
5349
5352
  useEffect(() => {
5350
- if (b >= 0 && S.current) {
5351
- const m = S.current.children[b];
5352
- m == null || m.scrollIntoView({ block: "nearest" });
5353
+ if (S >= 0 && _.current) {
5354
+ const v = _.current.children[S];
5355
+ v == null || v.scrollIntoView({ block: "nearest" });
5353
5356
  }
5354
- }, [b]);
5355
- const T = () => {
5356
- x(""), E([]), k(-1), u(!1), r({ ...o, href: "" });
5357
- }, L = (m) => {
5358
- x(m), u(!isEmpty(m)), c("FETCHING_COLLECTION_ITEMS"), _(m);
5357
+ }, [S]);
5358
+ const D = () => {
5359
+ E(""), k([]), w(-1), m(!1), r("");
5360
+ }, f = (v) => {
5361
+ E(v), m(!isEmpty(v)), u(!0), B(v);
5359
5362
  };
5360
5363
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5361
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: p, onChange: (m) => g(m.target.value), children: map(n, (m) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: m.key, children: m.name }, m.key)) }),
5362
- p && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
5364
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: g, onChange: (v) => x(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: v.key, children: v.name }, v.key)) }),
5365
+ g && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
5363
5366
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5364
5367
  "input",
5365
5368
  {
5366
5369
  type: "text",
5367
- value: f,
5368
- onChange: (m) => L(m.target.value),
5369
- onKeyDown: A,
5370
- placeholder: a(`Search ${w}`),
5371
- disabled: i === "FETCHING_INIT_VALUE",
5370
+ value: j,
5371
+ onChange: (v) => f(v.target.value),
5372
+ onKeyDown: L,
5373
+ placeholder: a(`Search ${A}`),
5372
5374
  className: "w-full rounded-md border border-gray-300 p-2 pr-16"
5373
5375
  }
5374
5376
  ),
5375
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: f && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: T, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
5377
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 top-3 flex items-center gap-1.5", children: j && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: D, className: "text-gray-400 hover:text-gray-600", title: a("Clear search"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-4 w-4" }) }) })
5376
5378
  ] }),
5377
- (i === "FETCHING_COLLECTION_ITEMS" || !isEmpty(j) || d && isEmpty(j)) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute z-40 mt-2 max-h-40 w-full overflow-y-auto rounded-md border border-border bg-background shadow-lg", children: i === "FETCHING_COLLECTION_ITEMS" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 p-2", children: [
5379
+ (d || !isEmpty(b) || p && isEmpty(b)) && /* @__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: [
5378
5380
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
5379
5381
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
5380
- ] }) : d && isEmpty(j) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
5382
+ ] }) : p && isEmpty(b) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
5381
5383
  a("No results found for"),
5382
5384
  ' "',
5383
- f,
5385
+ j,
5384
5386
  '"'
5385
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: S, children: map(j == null ? void 0 : j.slice(0, 20), (m, v) => {
5386
- var C;
5387
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
5388
- "li",
5389
- {
5390
- onClick: () => R(m),
5391
- className: `cursor-pointer p-2 text-xs ${(C = o == null ? void 0 : o.href) != null && C.includes(m.id) ? "bg-blue-200" : v === b ? "bg-gray-100" : "hover:bg-gray-100"}`,
5392
- children: [
5393
- m.name,
5394
- " ",
5395
- m.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
5396
- "( ",
5397
- m.slug,
5398
- " )"
5399
- ] })
5400
- ]
5401
- },
5402
- m.id
5403
- );
5404
- }) }) })
5387
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: _, children: map(b == null ? void 0 : b.slice(0, 20), (v, R) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5388
+ "li",
5389
+ {
5390
+ onClick: () => N(v),
5391
+ className: `cursor-pointer p-2 text-xs ${o != null && o.includes(v.id) ? "bg-blue-200" : R === S ? "bg-gray-100" : "hover:bg-gray-100"}`,
5392
+ children: [
5393
+ v.name,
5394
+ " ",
5395
+ v.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
5396
+ "( ",
5397
+ v.slug,
5398
+ " )"
5399
+ ] })
5400
+ ]
5401
+ },
5402
+ v.id
5403
+ )) }) })
5405
5404
  ] });
5406
5405
  }, LinkField = ({ schema: o, formData: n, onChange: r }) => {
5407
- const { t: a } = useTranslation(), { type: l = "collection", href: i = "#", target: c = "self" } = n, d = useBuilderProp("collections", []);
5406
+ const { t: a } = useTranslation(), { type: l = "collection", href: i = "", target: c = "self" } = n, d = useBuilderProp("collections", []), u = l === "collection" && isEmpty(d) ? "url" : l;
5408
5407
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5409
5408
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
5410
5409
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
5411
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (u) => r({ ...n, type: u.target.value }), children: map(
5410
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (p) => r({ ...n, type: p.target.value }), children: map(
5412
5411
  [
5413
5412
  ...isEmpty(d) ? [] : [{ const: "collection", title: a("Goto Page") }],
5414
5413
  { const: "url", title: a("Open URL") },
@@ -5416,9 +5415,16 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5416
5415
  { const: "telephone", title: a("Call Phone") },
5417
5416
  { const: "scroll", title: a("Scroll to element") }
5418
5417
  ],
5419
- (u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.const, children: u.title }, u.const)
5418
+ (p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)
5420
5419
  ) }),
5421
- l === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionField, { formData: n, collections: d, onChange: r }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
5420
+ u === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
5421
+ CollectionField,
5422
+ {
5423
+ href: i,
5424
+ collections: d,
5425
+ onChange: (p) => r({ ...n, href: p })
5426
+ }
5427
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
5422
5428
  "input",
5423
5429
  {
5424
5430
  autoCapitalize: "off",
@@ -5427,13 +5433,11 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5427
5433
  name: "href",
5428
5434
  type: "text",
5429
5435
  value: i,
5430
- onChange: (u) => r({ ...n, href: u.target.value }),
5431
- placeholder: a(
5432
- l === "page" || l === "url" ? "Enter URL" : l === "scroll" ? "#ElementID" : "Enter details"
5433
- )
5436
+ onChange: (p) => r({ ...n, href: p.target.value }),
5437
+ placeholder: a(l === "url" ? "Enter URL" : l === "scroll" ? "#ElementID" : "Enter details")
5434
5438
  }
5435
5439
  ),
5436
- l === "url" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5440
+ u === "url" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5437
5441
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5438
5442
  "input",
5439
5443
  {
@@ -5470,7 +5474,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5470
5474
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
5471
5475
  ] });
5472
5476
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5473
- const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: g, languages: f } = useLanguages(), x = f.length === 0 ? "" : p.length ? p : g;
5477
+ const [l, i] = useState(r), c = { type: "object", properties: {} }, d = {}, { t: u } = useTranslation(), { selectedLang: p, fallbackLang: m, languages: g } = useLanguages(), x = g.length === 0 ? "" : p.length ? p : m;
5474
5478
  Object.keys(n).forEach((E) => {
5475
5479
  const b = n[E];
5476
5480
  if (includes(["slot", "styles"], b.type))
@@ -5584,18 +5588,18 @@ function BlockSettings() {
5584
5588
  const w = k.replace("root.", "");
5585
5589
  a([n._id], { [w]: get(b, w) }, S);
5586
5590
  }
5587
- }, g = useCallback(
5591
+ }, m = useCallback(
5588
5592
  debounce(({ formData: b }, k, S) => {
5589
5593
  p({ formData: b }, k, S), d(b);
5590
5594
  }, 1500),
5591
5595
  [n == null ? void 0 : n._id, o]
5592
- ), f = ({ formData: b }, k) => {
5596
+ ), g = ({ formData: b }, k) => {
5593
5597
  if (k) {
5594
5598
  const S = k.replace("root.", "");
5595
5599
  r(
5596
5600
  [n._id],
5597
5601
  convertDotNotationToObject(S, get(b, S.split(".")))
5598
- ), g({ formData: b }, k, { [S]: get(c, S) });
5602
+ ), m({ formData: b }, k, { [S]: get(c, S) });
5599
5603
  }
5600
5604
  }, x = keys(get(i, "_bindings", {})), j = useMemo(() => {
5601
5605
  const b = cloneDeep(get(l, "props", {}));
@@ -5642,7 +5646,7 @@ function BlockSettings() {
5642
5646
  JSONForm,
5643
5647
  {
5644
5648
  id: n == null ? void 0 : n._id,
5645
- onChange: f,
5649
+ onChange: g,
5646
5650
  formData: i,
5647
5651
  properties: j
5648
5652
  }
@@ -5653,7 +5657,7 @@ function BlockSettings() {
5653
5657
  JSONForm,
5654
5658
  {
5655
5659
  id: n == null ? void 0 : n._id,
5656
- onChange: f,
5660
+ onChange: g,
5657
5661
  formData: i,
5658
5662
  properties: j
5659
5663
  }
@@ -5683,21 +5687,21 @@ function promptWithLanguage(o, n, r) {
5683
5687
  ${a}`;
5684
5688
  }
5685
5689
  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(), g = u.length ? u : p;
5690
+ 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(), m = u.length ? u : p;
5687
5691
  return {
5688
5692
  askAi: useCallback(
5689
- async (f, x, j, E) => {
5693
+ async (g, x, j, E) => {
5690
5694
  if (l) {
5691
5695
  n(!0), a(null);
5692
5696
  try {
5693
- const b = f === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((R) => R._id === x))];
5697
+ const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((A) => A._id === x))];
5694
5698
  set(b, "0._parent", null);
5695
- const k = u === p ? "" : u, S = await l(f, promptWithLanguage(j, g, f), b, k), { blocks: w, error: _ } = S;
5699
+ const k = u === p ? "" : u, S = await l(g, promptWithLanguage(j, m, g), b, k), { blocks: w, error: _ } = S;
5696
5700
  if (_) {
5697
5701
  a(_);
5698
5702
  return;
5699
5703
  }
5700
- f === "styles" ? c(w) : i(w), E && E(S);
5704
+ g === "styles" ? c(w) : i(w), E && E(S);
5701
5705
  } catch (b) {
5702
5706
  a(b);
5703
5707
  } finally {
@@ -5711,7 +5715,7 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5711
5715
  d,
5712
5716
  u,
5713
5717
  p,
5714
- g,
5718
+ m,
5715
5719
  c,
5716
5720
  i
5717
5721
  ]
@@ -5785,14 +5789,14 @@ function Countdown() {
5785
5789
  ] });
5786
5790
  }
5787
5791
  const AskAIStyles = ({ blockId: o }) => {
5788
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, g] = useState();
5792
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
5789
5793
  useEffect(() => {
5790
5794
  var x;
5791
5795
  (x = d.current) == null || x.focus();
5792
5796
  }, []);
5793
- const f = (x) => {
5797
+ const g = (x) => {
5794
5798
  const { usage: j } = x || {};
5795
- !l && j && g(j), u.current = setTimeout(() => g(void 0), 1e4), l || c("");
5799
+ !l && j && m(j), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
5796
5800
  };
5797
5801
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5798
5802
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
@@ -5806,7 +5810,7 @@ const AskAIStyles = ({ blockId: o }) => {
5806
5810
  className: "w-full border border-border focus:border-0",
5807
5811
  rows: 3,
5808
5812
  onKeyDown: (x) => {
5809
- x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, f));
5813
+ x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g));
5810
5814
  }
5811
5815
  }
5812
5816
  ),
@@ -5816,7 +5820,7 @@ const AskAIStyles = ({ blockId: o }) => {
5816
5820
  {
5817
5821
  disabled: i.trim().length < 5 || a,
5818
5822
  onClick: () => {
5819
- u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, f);
5823
+ u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g);
5820
5824
  },
5821
5825
  variant: "default",
5822
5826
  className: "w-fit",
@@ -5852,37 +5856,37 @@ const AskAIStyles = ({ blockId: o }) => {
5852
5856
  keys: ["name"]
5853
5857
  });
5854
5858
  function ManualClasses() {
5855
- var A;
5856
- const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (A = first(n)) == null ? void 0 : A.prop, f = reject((get(r, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
5857
- const T = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5858
- a(i, T, !0), u("");
5859
- }, [j, E] = useState([]), b = ({ value: T }) => {
5860
- const L = T.trim().toLowerCase(), D = L.match(/.+:/g);
5861
- let m = [];
5859
+ var B;
5860
+ const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (B = first(n)) == null ? void 0 : B.prop, g = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
5861
+ const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5862
+ a(i, N, !0), u("");
5863
+ }, [j, E] = useState([]), b = ({ value: N }) => {
5864
+ const L = N.trim().toLowerCase(), D = L.match(/.+:/g);
5865
+ let f = [];
5862
5866
  if (D && D.length > 0) {
5863
- const [v] = D, C = L.replace(v, "");
5864
- m = fuse.search(C).map((I) => ({
5867
+ const [C] = D, v = L.replace(C, "");
5868
+ f = fuse.search(v).map((I) => ({
5865
5869
  ...I,
5866
- item: { ...I.item, name: v + I.item.name }
5870
+ item: { ...I.item, name: C + I.item.name }
5867
5871
  }));
5868
5872
  } else
5869
- m = fuse.search(L);
5870
- return E(map(m, "item"));
5873
+ f = fuse.search(L);
5874
+ return E(map(f, "item"));
5871
5875
  }, k = () => {
5872
5876
  E([]);
5873
- }, S = (T) => T.name, w = (T) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: T.name }), _ = {
5877
+ }, S = (N) => N.name, w = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), _ = {
5874
5878
  autoComplete: "off",
5875
5879
  autoCorrect: "off",
5876
5880
  autoCapitalize: "off",
5877
5881
  spellCheck: !1,
5878
5882
  placeholder: o("Enter classes separated by space"),
5879
5883
  value: d,
5880
- onKeyDown: (T) => {
5881
- T.key === "Enter" && d.trim() !== "" && x();
5884
+ onKeyDown: (N) => {
5885
+ N.key === "Enter" && d.trim() !== "" && x();
5882
5886
  },
5883
- onChange: (T, { newValue: L }) => u(L),
5887
+ onChange: (N, { newValue: L }) => u(L),
5884
5888
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5885
- }, R = () => {
5889
+ }, A = () => {
5886
5890
  if (navigator.clipboard === void 0) {
5887
5891
  p({
5888
5892
  title: o("Clipboard not supported"),
@@ -5891,7 +5895,7 @@ function ManualClasses() {
5891
5895
  });
5892
5896
  return;
5893
5897
  }
5894
- navigator.clipboard.writeText(f.join(" ")), p({
5898
+ navigator.clipboard.writeText(g.join(" ")), p({
5895
5899
  title: o("Copied"),
5896
5900
  description: o("Classes copied to clipboard")
5897
5901
  });
@@ -5905,7 +5909,7 @@ function ManualClasses() {
5905
5909
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5906
5910
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
5907
5911
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5908
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: R, className: "cursor-pointer" }) }),
5912
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: A, className: "cursor-pointer" }) }),
5909
5913
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("Copy classes to clipboard") }) })
5910
5914
  ] })
5911
5915
  ] }),
@@ -5950,22 +5954,22 @@ function ManualClasses() {
5950
5954
  )
5951
5955
  ] }),
5952
5956
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5953
- f.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5957
+ g.map((N) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5954
5958
  "div",
5955
5959
  {
5956
5960
  className: "group relative flex max-w-[260px] cursor-default items-center gap-x-1 truncate rounded border border-border bg-gray-200 p-px px-1.5 text-[11px] text-gray-600 hover:border-gray-300 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300",
5957
5961
  children: [
5958
- T,
5962
+ N,
5959
5963
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5960
5964
  Cross2Icon,
5961
5965
  {
5962
- onClick: () => l(i, [T]),
5966
+ onClick: () => l(i, [N]),
5963
5967
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
5964
5968
  }
5965
5969
  )
5966
5970
  ]
5967
5971
  },
5968
- T
5972
+ N
5969
5973
  ))
5970
5974
  ) })
5971
5975
  ]
@@ -6356,7 +6360,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6356
6360
  ringColor: "ring",
6357
6361
  ringOffsetColor: "ring-offset"
6358
6362
  }, ColorChoice = ({ property: o, onChange: n }) => {
6359
- const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), g = get(p, "1", ""), f = get(p, "2", ""), x = useCallback(
6363
+ const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), m = get(p, "1", ""), g = get(p, "2", ""), x = useCallback(
6360
6364
  // eslint-disable-next-line no-shadow
6361
6365
  (E) => {
6362
6366
  ["current", "inherit", "transparent", "black", "white"].includes(E) ? (c([]), u({ color: E })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((b) => ({ ...b, color: E, shade: b.shade ? b.shade : "500" })));
@@ -6364,16 +6368,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6364
6368
  [c, u]
6365
6369
  );
6366
6370
  useEffect(() => {
6367
- if (["current", "inherit", "transparent", "black", "white"].includes(g))
6371
+ if (["current", "inherit", "transparent", "black", "white"].includes(m))
6368
6372
  return c([]);
6369
6373
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6370
- }, [g]);
6374
+ }, [m]);
6371
6375
  const j = useCallback(
6372
6376
  // eslint-disable-next-line no-shadow
6373
6377
  (E) => {
6374
- u({ color: g, shade: E });
6378
+ u({ color: m, shade: E });
6375
6379
  },
6376
- [g]
6380
+ [m]
6377
6381
  );
6378
6382
  return useEffect(() => {
6379
6383
  u({ color: "", shade: "" });
@@ -6386,7 +6390,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6386
6390
  {
6387
6391
  disabled: !l,
6388
6392
  rounded: !0,
6389
- selected: g,
6393
+ selected: m,
6390
6394
  onChange: x,
6391
6395
  options: [
6392
6396
  "current",
@@ -6420,7 +6424,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6420
6424
  ]
6421
6425
  }
6422
6426
  ) }),
6423
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: f, disabled: !g || !l, onChange: j, options: i }) })
6427
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropDown, { rounded: !0, selected: g, disabled: !m || !l, onChange: j, options: i }) })
6424
6428
  ] });
6425
6429
  }, getUserInputValues = (o, n) => {
6426
6430
  o = o.toLowerCase();
@@ -6615,52 +6619,52 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6615
6619
  },
6616
6620
  a
6617
6621
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6618
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [f, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [S, w] = useState(!1), [_, R] = useState(!1);
6622
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [S, w] = useState(!1), [_, A] = useState(!1);
6619
6623
  useEffect(() => {
6620
- const { value: m, unit: v } = getClassValueAndUnit(i);
6621
- if (v === "") {
6622
- l(m), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6624
+ const { value: f, unit: C } = getClassValueAndUnit(i);
6625
+ if (C === "") {
6626
+ l(f), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6623
6627
  return;
6624
6628
  }
6625
- x(v), l(v === "class" || isEmpty(m) ? "" : m);
6629
+ x(C), l(C === "class" || isEmpty(f) ? "" : f);
6626
6630
  }, [i, u, p]);
6627
- const A = useThrottledCallback((m) => c(m), [c], THROTTLE_TIME), T = useThrottledCallback((m) => c(m, !1), [c], THROTTLE_TIME), L = useCallback(
6628
- (m = !1) => {
6629
- const v = getUserInputValues(`${a}`, p);
6630
- if (get(v, "error", !1)) {
6631
+ const B = useThrottledCallback((f) => c(f), [c], THROTTLE_TIME), N = useThrottledCallback((f) => c(f, !1), [c], THROTTLE_TIME), L = useCallback(
6632
+ (f = !1) => {
6633
+ const C = getUserInputValues(`${a}`, p);
6634
+ if (get(C, "error", !1)) {
6631
6635
  E(!0);
6632
6636
  return;
6633
6637
  }
6634
- const C = get(v, "unit") !== "" ? get(v, "unit") : f;
6635
- if (C === "auto" || C === "none") {
6636
- A(`${d}${C}`);
6638
+ const v = get(C, "unit") !== "" ? get(C, "unit") : g;
6639
+ if (v === "auto" || v === "none") {
6640
+ B(`${d}${v}`);
6637
6641
  return;
6638
6642
  }
6639
- if (get(v, "value") === "")
6643
+ if (get(C, "value") === "")
6640
6644
  return;
6641
- const I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6642
- m ? T(I) : A(I);
6645
+ const I = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${v === "-" ? "" : v}]`;
6646
+ f ? N(I) : B(I);
6643
6647
  },
6644
- [A, T, a, f, d, p]
6648
+ [B, N, a, g, d, p]
6645
6649
  ), D = useCallback(
6646
- (m) => {
6647
- const v = getUserInputValues(`${a}`, p);
6648
- if (get(v, "error", !1)) {
6650
+ (f) => {
6651
+ const C = getUserInputValues(`${a}`, p);
6652
+ if (get(C, "error", !1)) {
6649
6653
  E(!0);
6650
6654
  return;
6651
6655
  }
6652
- if (m === "auto" || m === "none") {
6653
- A(`${d}${m}`);
6656
+ if (f === "auto" || f === "none") {
6657
+ B(`${d}${f}`);
6654
6658
  return;
6655
6659
  }
6656
- if (get(v, "value") === "")
6660
+ if (get(C, "value") === "")
6657
6661
  return;
6658
- const C = get(v, "unit") !== "" ? get(v, "unit") : m, I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6659
- A(I);
6662
+ const v = get(C, "unit") !== "" ? get(C, "unit") : f, I = `${get(C, "value", "").startsWith("-") ? "-" : ""}${d}[${get(C, "value", "").replace("-", "")}${v === "-" ? "" : v}]`;
6663
+ B(I);
6660
6664
  },
6661
- [A, a, d, p]
6665
+ [B, a, d, p]
6662
6666
  );
6663
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: f === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6667
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: g === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6664
6668
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
6665
6669
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6666
6670
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "invisible ml-3 mt-1 text-blue-600 group-hover:visible", children: /* @__PURE__ */ jsxRuntimeExports.jsx(InfoCircledIcon, {}) }) }),
@@ -6668,33 +6672,33 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6668
6672
  ] })
6669
6673
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${S ? "z-auto" : ""}`, children: [
6670
6674
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6671
- ["none", "auto"].indexOf(f) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6675
+ ["none", "auto"].indexOf(g) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6672
6676
  "input",
6673
6677
  {
6674
- readOnly: f === "class",
6675
- onKeyPress: (m) => {
6676
- m.key === "Enter" && L();
6678
+ readOnly: g === "class",
6679
+ onKeyPress: (f) => {
6680
+ f.key === "Enter" && L();
6677
6681
  },
6678
- onKeyDown: (m) => {
6679
- if (m.keyCode !== 38 && m.keyCode !== 40)
6682
+ onKeyDown: (f) => {
6683
+ if (f.keyCode !== 38 && f.keyCode !== 40)
6680
6684
  return;
6681
- m.preventDefault(), R(!0);
6682
- const v = parseInt$1(m.target.value);
6683
- let C = isNaN$1(v) ? 0 : v;
6684
- m.keyCode === 38 && (C += 1), m.keyCode === 40 && (C -= 1);
6685
- const B = `${C}`, N = `${B.startsWith("-") ? "-" : ""}${d}[${B.replace("-", "")}${f === "-" ? "" : f}]`;
6686
- T(N);
6685
+ f.preventDefault(), A(!0);
6686
+ const C = parseInt$1(f.target.value);
6687
+ let v = isNaN$1(C) ? 0 : C;
6688
+ f.keyCode === 38 && (v += 1), f.keyCode === 40 && (v -= 1);
6689
+ const R = `${v}`, T = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${g === "-" ? "" : g}]`;
6690
+ N(T);
6687
6691
  },
6688
- onKeyUp: (m) => {
6689
- _ && (m.preventDefault(), R(!1));
6692
+ onKeyUp: (f) => {
6693
+ _ && (f.preventDefault(), A(!1));
6690
6694
  },
6691
6695
  onBlur: () => L(),
6692
- onChange: (m) => {
6693
- E(!1), l(m.target.value);
6696
+ onChange: (f) => {
6697
+ E(!1), l(f.target.value);
6694
6698
  },
6695
- onClick: (m) => {
6696
- var v;
6697
- (v = m == null ? void 0 : m.target) == null || v.select(), r(!1);
6699
+ onClick: (f) => {
6700
+ var C;
6701
+ (C = f == null ? void 0 : f.target) == null || C.select(), r(!1);
6698
6702
  },
6699
6703
  value: S ? b : a,
6700
6704
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
@@ -6711,7 +6715,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6711
6715
  onClick: () => r(!n),
6712
6716
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
6713
6717
  children: [
6714
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: f }),
6718
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: g }),
6715
6719
  p.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6716
6720
  ]
6717
6721
  }
@@ -6720,34 +6724,34 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6720
6724
  UnitSelection,
6721
6725
  {
6722
6726
  units: p,
6723
- current: f,
6724
- onSelect: (m) => {
6725
- r(!1), x(m), D(m);
6727
+ current: g,
6728
+ onSelect: (f) => {
6729
+ r(!1), x(f), D(f);
6726
6730
  }
6727
6731
  }
6728
6732
  ) }) })
6729
6733
  ] })
6730
6734
  ] }),
6731
- ["none", "auto"].indexOf(f) !== -1 || S ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6735
+ ["none", "auto"].indexOf(g) !== -1 || S ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6732
6736
  DragStyleButton,
6733
6737
  {
6734
6738
  onDragStart: () => w(!0),
6735
- onDragEnd: (m) => {
6736
- if (k(() => ""), w(!1), isEmpty(m))
6739
+ onDragEnd: (f) => {
6740
+ if (k(() => ""), w(!1), isEmpty(f))
6737
6741
  return;
6738
- const v = `${m}`, B = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${f === "-" ? "" : f}]`;
6739
- A(B);
6742
+ const C = `${f}`, R = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${g === "-" ? "" : g}]`;
6743
+ B(R);
6740
6744
  },
6741
- onDrag: (m) => {
6742
- if (isEmpty(m))
6745
+ onDrag: (f) => {
6746
+ if (isEmpty(f))
6743
6747
  return;
6744
- k(m);
6745
- const v = `${m}`, B = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${f === "-" ? "" : f}]`;
6746
- T(B);
6748
+ k(f);
6749
+ const C = `${f}`, R = `${C.startsWith("-") ? "-" : ""}${d}[${C.replace("-", "")}${g === "-" ? "" : g}]`;
6750
+ N(R);
6747
6751
  },
6748
6752
  currentValue: a,
6749
- unit: f,
6750
- negative: g,
6753
+ unit: g,
6754
+ negative: m,
6751
6755
  cssProperty: u
6752
6756
  }
6753
6757
  )
@@ -6840,22 +6844,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6840
6844
  "2xl": "1536px"
6841
6845
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6842
6846
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6843
- }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), f = useCurrentClassByProperty(l), x = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [E] = useSelectedBlockIds(), b = useMemo(() => get(f, "fullCls", ""), [f]), k = useCallback(
6844
- (T, L = !0) => {
6845
- const D = { dark: u, mq: g, mod: p, cls: T, property: l, fullCls: "" };
6847
+ }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, m] = useCanvasWidth(), g = useCurrentClassByProperty(l), x = useAddClassesToBlocks(), j = useRemoveClassesFromBlocks(), [E] = useSelectedBlockIds(), b = useMemo(() => get(g, "fullCls", ""), [g]), k = useCallback(
6848
+ (N, L = !0) => {
6849
+ const D = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
6846
6850
  (u || p !== "") && (D.mq = "xs");
6847
- const m = generateFullClsName(D);
6848
- x(E, [m], L);
6851
+ const f = generateFullClsName(D);
6852
+ x(E, [f], L);
6849
6853
  },
6850
- [E, u, g, p, l, x]
6854
+ [E, u, m, p, l, x]
6851
6855
  ), S = useCallback(() => {
6852
6856
  j(E, [b]);
6853
- }, [E, b, j]), w = useMemo(() => canChangeClass(f, g), [f, g]);
6857
+ }, [E, b, j]), w = useMemo(() => canChangeClass(g, m), [g, m]);
6854
6858
  useEffect(() => {
6855
- i(w, f);
6856
- }, [w, i, f]);
6857
- const [, , _] = useCanvasWidth(), R = useCallback(
6858
- (T) => {
6859
+ i(w, g);
6860
+ }, [w, i, g]);
6861
+ const [, , _] = useCanvasWidth(), A = useCallback(
6862
+ (N) => {
6859
6863
  _({
6860
6864
  xs: 400,
6861
6865
  sm: 640,
@@ -6863,18 +6867,18 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6863
6867
  lg: 1024,
6864
6868
  xl: 1420,
6865
6869
  "2xl": 1920
6866
- }[T]);
6870
+ }[N]);
6867
6871
  },
6868
6872
  [_]
6869
- ), A = get(f, "dark", null) === u && get(f, "mod", null) === p && get(f, "mq", null) === g;
6870
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: w, canReset: f && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6871
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${f && !A ? "text-foreground" : ""}`, children: n(a) }) }),
6873
+ ), B = get(g, "dark", null) === u && get(g, "mod", null) === p && get(g, "mq", null) === m;
6874
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: w, canReset: g && B, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6875
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !B ? "text-foreground" : ""}`, children: n(a) }) }),
6872
6876
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6873
6877
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6874
6878
  r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
6875
6879
  AdvanceChoices,
6876
6880
  {
6877
- currentClass: get(f, "cls", ""),
6881
+ currentClass: get(g, "cls", ""),
6878
6882
  classPrefix: get(CLASS_PREFIXES, l, ""),
6879
6883
  units: c || [],
6880
6884
  onChange: k,
@@ -6887,7 +6891,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6887
6891
  r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6888
6892
  r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6889
6893
  ] }),
6890
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: A ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => S(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : w && f ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6894
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: B ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => S(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : w && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6891
6895
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6892
6896
  "button",
6893
6897
  {
@@ -6899,19 +6903,19 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6899
6903
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
6900
6904
  "Current style is set at  ",
6901
6905
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
6902
- getBreakpoint(get(f, "mq")),
6903
- u && !f.dark ? "(Light mode)" : ""
6906
+ getBreakpoint(get(g, "mq")),
6907
+ u && !g.dark ? "(Light mode)" : ""
6904
6908
  ] }),
6905
6909
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
6906
6910
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
6907
6911
  "button",
6908
6912
  {
6909
6913
  type: "button",
6910
- onClick: () => R(get(f, "mq")),
6914
+ onClick: () => A(get(g, "mq")),
6911
6915
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6912
6916
  children: [
6913
6917
  "Switch to ",
6914
- get(f, "mq").toUpperCase()
6918
+ get(g, "mq").toUpperCase()
6915
6919
  ]
6916
6920
  }
6917
6921
  )
@@ -6928,7 +6932,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6928
6932
  units: i = basicUnits,
6929
6933
  negative: c = !1
6930
6934
  }) => {
6931
- const { t: d } = useTranslation(), [u, p] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), f = useCallback((x) => map(g, "property").includes(x), [g]);
6935
+ const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), g = useCallback((x) => map(m, "property").includes(x), [m]);
6932
6936
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6933
6937
  "div",
6934
6938
  {
@@ -6946,7 +6950,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6946
6950
  className: `relative cursor-pointer rounded-full p-1 text-[8px] ${j === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6947
6951
  children: [
6948
6952
  React__default.createElement("div", {
6949
- className: f(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6953
+ className: g(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6950
6954
  }),
6951
6955
  React__default.createElement(get(EDITOR_ICONS, j, BoxIcon), { className: "text-inherit w-3 h-3" })
6952
6956
  ]
@@ -7017,8 +7021,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
7017
7021
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
7018
7022
  return null;
7019
7023
  const u = (p) => {
7020
- const g = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
7021
- l([o._id], g, !0);
7024
+ const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
7025
+ l([o._id], m, !0);
7022
7026
  };
7023
7027
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
7024
7028
  /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "default", className: "w-full", size: "sm", children: [
@@ -7072,13 +7076,13 @@ function BlockStyling() {
7072
7076
  cssProperty: ""
7073
7077
  }), d = useThrottledCallback(
7074
7078
  (p) => {
7075
- const g = !get(i, "negative", !1), f = get(i, "cssProperty", "");
7079
+ const m = !get(i, "negative", !1), g = get(i, "cssProperty", "");
7076
7080
  let x = parseFloat(i.dragStartValue);
7077
7081
  x = isNaN(x) ? 0 : x;
7078
7082
  let j = MAPPER[i.dragUnit];
7079
- (startsWith(f, "scale") || f === "opacity") && (j = 10);
7083
+ (startsWith(g, "scale") || g === "opacity") && (j = 10);
7080
7084
  let b = (i.dragStartY - p.pageY) / j + x;
7081
- g && b < 0 && (b = 0), f === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
7085
+ m && b < 0 && (b = 0), g === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
7082
7086
  },
7083
7087
  [i],
7084
7088
  50
@@ -7164,7 +7168,7 @@ const BlockCard = ({
7164
7168
  library: n,
7165
7169
  parentId: r = void 0
7166
7170
  }) => {
7167
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), g = get(o, "name", get(o, "label")), f = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
7171
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), m = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
7168
7172
  const S = has(k, "styles_attrs.data-page-section");
7169
7173
  return k._type === "Box" && S;
7170
7174
  }, E = useCallback(
@@ -7184,9 +7188,9 @@ const BlockCard = ({
7184
7188
  if (j(first(S)) && (w = null), !isEmpty(S)) {
7185
7189
  const _ = { blocks: S, uiLibrary: !0, parent: w };
7186
7190
  if (k.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
7187
- const R = new Image();
7188
- R.src = o.preview, R.onload = () => {
7189
- k.dataTransfer.setDragImage(R, 0, 0);
7191
+ const A = new Image();
7192
+ A.src = o.preview, A.onload = () => {
7193
+ k.dataTransfer.setDragImage(A, 0, 0);
7190
7194
  };
7191
7195
  } else
7192
7196
  k.dataTransfer.setDragImage(new Image(), 0, 0);
@@ -7201,7 +7205,7 @@ const BlockCard = ({
7201
7205
  {
7202
7206
  onClick: a ? () => {
7203
7207
  } : E,
7204
- draggable: f ? "true" : "false",
7208
+ draggable: g ? "true" : "false",
7205
7209
  onDragStart: b,
7206
7210
  className: clsx(
7207
7211
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
@@ -7211,11 +7215,11 @@ const BlockCard = ({
7211
7215
  /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
7212
7216
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
7213
7217
  ] }),
7214
- o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: g }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: g }) })
7218
+ o.preview ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o.preview, className: "min-h-[45px] w-full rounded-md", alt: m }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-20 items-center justify-center rounded-md border border-border bg-gray-200", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "max-w-xs text-center text-sm text-gray-700", children: m }) })
7215
7219
  ]
7216
7220
  }
7217
7221
  ) }),
7218
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g }) })
7222
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
7219
7223
  ] });
7220
7224
  }, libraryBlocksAtom = atom$1(
7221
7225
  {}
@@ -7231,9 +7235,9 @@ const BlockCard = ({
7231
7235
  })();
7232
7236
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
7233
7237
  }, UILibrarySection = ({ parentId: o }) => {
7234
- 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"), [g, f] = useState("Hero"), x = get(p, g, []), j = useRef(null), { t: E } = useTranslation(), b = (w) => {
7238
+ 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"), [m, g] = useState("Hero"), x = get(p, m, []), j = useRef(null), { t: E } = useTranslation(), b = (w) => {
7235
7239
  j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
7236
- j.current && f(w);
7240
+ j.current && g(w);
7237
7241
  }, 300);
7238
7242
  };
7239
7243
  if (u)
@@ -7254,10 +7258,10 @@ const BlockCard = ({
7254
7258
  {
7255
7259
  onMouseEnter: () => b(_),
7256
7260
  onMouseLeave: () => clearTimeout(j.current),
7257
- onClick: () => f(_),
7261
+ onClick: () => g(_),
7258
7262
  className: cn(
7259
7263
  "flex w-full cursor-pointer items-center justify-between rounded-md p-2 text-sm text-foreground transition-all ease-in-out hover:bg-gray-200 dark:hover:bg-gray-800",
7260
- _ === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7264
+ _ === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7261
7265
  ),
7262
7266
  children: [
7263
7267
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(_.toLowerCase())) }),
@@ -7784,7 +7788,7 @@ i18n.use(initReactI18next).init({
7784
7788
  }
7785
7789
  });
7786
7790
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7787
- const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), f = () => {
7791
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = () => {
7788
7792
  if (has(o, "blocks")) {
7789
7793
  const E = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7790
7794
  u(syncBlocksWithDefaults(E), r || null);
@@ -7797,11 +7801,11 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7797
7801
  "button",
7798
7802
  {
7799
7803
  disabled: n,
7800
- onClick: f,
7804
+ onClick: g,
7801
7805
  type: "button",
7802
7806
  onDragStart: (E) => {
7803
7807
  E.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), E.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7804
- p([]), g();
7808
+ p([]), m();
7805
7809
  }, 200);
7806
7810
  },
7807
7811
  draggable: x ? "true" : "false",
@@ -8166,14 +8170,14 @@ function QuickPrompts({ onClick: o }) {
8166
8170
  ) }) });
8167
8171
  }
8168
8172
  const AIUserPrompt = ({ blockId: o }) => {
8169
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, g] = useState(), f = useRef(null), x = useRef(null);
8173
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, m] = useState(), g = useRef(null), x = useRef(null);
8170
8174
  useEffect(() => {
8171
8175
  var E;
8172
- (E = f.current) == null || E.focus();
8176
+ (E = g.current) == null || E.focus();
8173
8177
  }, []);
8174
8178
  const j = (E) => {
8175
8179
  const { usage: b } = E || {};
8176
- !l && b && g(b), x.current = setTimeout(() => g(void 0), 1e4), l || c("");
8180
+ !l && b && m(b), x.current = setTimeout(() => m(void 0), 1e4), l || c("");
8177
8181
  };
8178
8182
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
8179
8183
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -8191,14 +8195,14 @@ const AIUserPrompt = ({ blockId: o }) => {
8191
8195
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8192
8196
  Textarea,
8193
8197
  {
8194
- ref: f,
8198
+ ref: g,
8195
8199
  value: i,
8196
8200
  onChange: (E) => c(E.target.value),
8197
8201
  placeholder: n("Ask AI to edit content"),
8198
8202
  className: "w-full",
8199
8203
  rows: 3,
8200
8204
  onKeyDown: (E) => {
8201
- E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current), g(void 0), r("content", o, i, j));
8205
+ E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j));
8202
8206
  }
8203
8207
  }
8204
8208
  ),
@@ -8208,7 +8212,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8208
8212
  {
8209
8213
  disabled: i.trim().length < 5 || a,
8210
8214
  onClick: () => {
8211
- x.current && clearTimeout(x.current), g(void 0), r("content", o, i, j);
8215
+ x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j);
8212
8216
  },
8213
8217
  variant: "default",
8214
8218
  className: "w-fit",
@@ -8241,7 +8245,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8241
8245
  QuickPrompts,
8242
8246
  {
8243
8247
  onClick: (E) => {
8244
- x.current && clearTimeout(x.current), g(void 0), r("content", o, E, j);
8248
+ x.current && clearTimeout(x.current), m(void 0), r("content", o, E, j);
8245
8249
  }
8246
8250
  }
8247
8251
  )
@@ -8251,13 +8255,13 @@ const AIUserPrompt = ({ blockId: o }) => {
8251
8255
  ] }) }) : null
8252
8256
  ] });
8253
8257
  }, AISetContext = () => {
8254
- const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, g] = useState(!1), { toast: f } = useToast(), x = useRef(null);
8258
+ const { t: o } = useTranslation(), n = useBuilderProp("aiContext", ""), [r, a] = useState(n), l = useRef(null), i = useBuilderProp("saveAiContextCallback", noop), [c, d] = useState(!1), [u, p] = useState(null), [, m] = useState(!1), { toast: g } = useToast(), x = useRef(null);
8255
8259
  useEffect(() => {
8256
8260
  n && a(n);
8257
8261
  }, [n]);
8258
8262
  const j = async () => {
8259
8263
  try {
8260
- d(!0), p(null), await i(r), f({
8264
+ d(!0), p(null), await i(r), g({
8261
8265
  title: o("Updated AI Context"),
8262
8266
  description: o("You can now Ask AI to edit your content"),
8263
8267
  variant: "default"
@@ -8272,7 +8276,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8272
8276
  Accordion,
8273
8277
  {
8274
8278
  onValueChange: (E) => {
8275
- g(E !== "");
8279
+ m(E !== "");
8276
8280
  },
8277
8281
  type: "single",
8278
8282
  collapsible: !0,
@@ -8351,7 +8355,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8351
8355
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
8352
8356
  ] });
8353
8357
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
8354
- const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [f, x] = useState(""), j = useRef(null), E = useRef(null);
8358
+ const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [g, x] = useState(""), j = useRef(null), E = useRef(null);
8355
8359
  useEffect(() => {
8356
8360
  l(n);
8357
8361
  }, [n]);
@@ -8361,32 +8365,32 @@ const AIUserPrompt = ({ blockId: o }) => {
8361
8365
  return;
8362
8366
  }
8363
8367
  if (i) {
8364
- const R = [...a, { key: i, value: d }];
8365
- r(R), l(a), c(""), u(""), x("");
8368
+ const A = [...a, { key: i, value: d }];
8369
+ r(A), l(a), c(""), u(""), x("");
8366
8370
  }
8367
- }, k = (R) => {
8368
- const A = a.filter((T, L) => L !== R);
8369
- r(A), l(A);
8370
- }, S = (R) => {
8371
- g(R), c(a[R].key), u(a[R].value);
8371
+ }, k = (A) => {
8372
+ const B = a.filter((N, L) => L !== A);
8373
+ r(B), l(B);
8374
+ }, S = (A) => {
8375
+ m(A), c(a[A].key), u(a[A].value);
8372
8376
  }, w = () => {
8373
8377
  if (i.startsWith("@")) {
8374
8378
  x("Attribute keys cannot start with '@'");
8375
8379
  return;
8376
8380
  }
8377
8381
  if (p !== null && i) {
8378
- const R = [...a];
8379
- R[p] = { key: i, value: d }, r(R), l(R), g(null), c(""), u(""), x("");
8382
+ const A = [...a];
8383
+ A[p] = { key: i, value: d }, r(A), l(A), m(null), c(""), u(""), x("");
8380
8384
  }
8381
- }, _ = (R) => {
8382
- R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? w() : b());
8385
+ }, _ = (A) => {
8386
+ A.key === "Enter" && !A.shiftKey && (A.preventDefault(), p !== null ? w() : b());
8383
8387
  };
8384
8388
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
8385
8389
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8386
8390
  "form",
8387
8391
  {
8388
- onSubmit: (R) => {
8389
- R.preventDefault(), p !== null ? w() : b();
8392
+ onSubmit: (A) => {
8393
+ A.preventDefault(), p !== null ? w() : b();
8390
8394
  },
8391
8395
  className: "space-y-3",
8392
8396
  children: [
@@ -8402,7 +8406,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8402
8406
  id: "attrKey",
8403
8407
  ref: j,
8404
8408
  value: i,
8405
- onChange: (R) => c(R.target.value),
8409
+ onChange: (A) => c(A.target.value),
8406
8410
  placeholder: "Key",
8407
8411
  className: "h-8 text-sm"
8408
8412
  }
@@ -8420,7 +8424,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8420
8424
  rows: 2,
8421
8425
  ref: E,
8422
8426
  value: d,
8423
- onChange: (R) => u(R.target.value),
8427
+ onChange: (A) => u(A.target.value),
8424
8428
  onKeyDown: _,
8425
8429
  placeholder: "Value",
8426
8430
  className: "bg-background text-sm"
@@ -8429,26 +8433,26 @@ const AIUserPrompt = ({ blockId: o }) => {
8429
8433
  ] })
8430
8434
  ] }),
8431
8435
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: p !== null ? "Save" : "Add" }),
8432
- f && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: f })
8436
+ g && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: g })
8433
8437
  ]
8434
8438
  }
8435
8439
  ),
8436
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((R, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8440
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((A, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8437
8441
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
8438
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: R.key }),
8439
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: R.value.toString() })
8442
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: A.key }),
8443
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: A.value.toString() })
8440
8444
  ] }),
8441
8445
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
8442
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(A), children: [
8446
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(B), children: [
8443
8447
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
8444
8448
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
8445
8449
  ] }),
8446
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(A), children: [
8450
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(B), children: [
8447
8451
  /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
8448
8452
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
8449
8453
  ] })
8450
8454
  ] })
8451
- ] }, A)) })
8455
+ ] }, B)) })
8452
8456
  ] });
8453
8457
  }), BlockAttributesEditor = React.memo(() => {
8454
8458
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -8866,7 +8870,7 @@ function RemoveProviderConfirmation({
8866
8870
  const PageDataProviders = () => {
8867
8871
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8868
8872
  filter(n, (b) => map(r, "providerKey").includes(b.providerKey))
8869
- ), [d, u] = useState(""), [p, g] = useState(null), f = filter(
8873
+ ), [d, u] = useState(""), [p, m] = useState(null), g = filter(
8870
8874
  n.map((b) => map(i, "providerKey").includes(b.providerKey) ? null : { value: b.providerKey, label: b.name }),
8871
8875
  (b) => !isNull(b)
8872
8876
  ), x = (b) => {
@@ -8874,7 +8878,7 @@ const PageDataProviders = () => {
8874
8878
  c((S) => [...S, k]), a((S) => [...S, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8875
8879
  }, j = (b) => {
8876
8880
  c((k) => filter(k, (S) => S.providerKey !== b.providerKey)), a((k) => filter(k, (S) => S.providerKey !== b.providerKey)), l("UNSAVED");
8877
- }, E = (b) => g(b);
8881
+ }, E = (b) => m(b);
8878
8882
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8879
8883
  o("You have no data providers registered. Please add a data provider to your project."),
8880
8884
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8886,7 +8890,7 @@ const PageDataProviders = () => {
8886
8890
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("Select a provider") }) }),
8887
8891
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
8888
8892
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("Choose") }),
8889
- f.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: b.value, children: b.label }, b.value))
8893
+ g.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: b.value, children: b.label }, b.value))
8890
8894
  ] })
8891
8895
  ] }) }),
8892
8896
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8963,14 +8967,14 @@ const PageDataProviders = () => {
8963
8967
  },
8964
8968
  b.providerKey
8965
8969
  )) }),
8966
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
8970
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
8967
8971
  ] })
8968
8972
  ] });
8969
8973
  };
8970
8974
  function AiFillDatabase(o) {
8971
8975
  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);
8972
8976
  }
8973
- const TopBar = lazy(() => import("./Topbar-86JxE7Uw.js"));
8977
+ const TopBar = lazy(() => import("./Topbar-W4Ri5E2K.js"));
8974
8978
  function useSidebarMenuItems(o) {
8975
8979
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8976
8980
  return useMemo(() => {
@@ -9004,8 +9008,8 @@ const RootLayout = () => {
9004
9008
  x.preventDefault();
9005
9009
  }, d = (x) => {
9006
9010
  n(o === x ? null : x);
9007
- }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), g = [...u, ...i], f = useBuilderProp("htmlDir", "ltr");
9008
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: f, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
9011
+ }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], g = useBuilderProp("htmlDir", "ltr");
9012
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dir: g, className: "h-screen max-h-full w-screen overflow-x-hidden bg-background text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TooltipProvider, { children: [
9009
9013
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
9010
9014
  "div",
9011
9015
  {
@@ -9015,7 +9019,7 @@ const RootLayout = () => {
9015
9019
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TopBar, {}) }) }),
9016
9020
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
9017
9021
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
9018
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: g.map((x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
9022
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
9019
9023
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
9020
9024
  Button,
9021
9025
  {
@@ -9045,10 +9049,10 @@ const RootLayout = () => {
9045
9049
  transition: { duration: 0.3, ease: "easeInOut" },
9046
9050
  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: [
9047
9051
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
9048
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(g, `${o}.icon`, null) }),
9049
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(g[o].label) })
9052
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
9053
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
9050
9054
  ] }),
9051
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(g, `${o}.component`, null), {}) }) })
9055
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: React__default.createElement(get(m, `${o}.component`, null), {}) }) })
9052
9056
  ] }) })
9053
9057
  }
9054
9058
  ),