@chaibuilder/sdk 1.2.113 → 1.2.114-beta.3

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.
@@ -30,7 +30,7 @@ import ReactDOM from "react-dom";
30
30
  import PropTypes from "prop-types";
31
31
  import { ErrorBoundary } from "react-error-boundary";
32
32
  import { Resizable } from "re-resizable";
33
- import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, SearchIcon, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, X, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
33
+ import { DatabaseIcon, GlobeIcon, ChevronRight, PlusIcon as PlusIcon$1, EyeOff, EditIcon, TrashIcon as TrashIcon$1, Check, X, Loader, SparklesIcon, SmileIcon, ShuffleIcon, ChevronDown, Edit2, LayoutTemplate, Layers, PaintBucketIcon } from "lucide-react";
34
34
  import validator from "@rjsf/validator-ajv8";
35
35
  import Form$1 from "@rjsf/core";
36
36
  import { y, s as s$1, h } from "./controls-lEwMTdPQ.js";
@@ -89,278 +89,278 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
89
89
  const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
90
90
  let a, l, i;
91
91
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
92
- const c = (f) => o.get(f), d = (f, S) => {
93
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(S);
94
- const w = o.get(f);
95
- if (o.set(f, S), r.has(f) || r.set(f, w), w && hasPromiseAtomValue(w)) {
96
- const A = "v" in S ? S.v instanceof Promise ? S.v : Promise.resolve(S.v) : Promise.reject(S.e);
97
- cancelPromise(w.v, A);
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);
98
98
  }
99
- }, u = (f, S, w) => {
100
- const A = /* @__PURE__ */ new Map();
99
+ }, u = (m, v, C) => {
100
+ const B = /* @__PURE__ */ new Map();
101
101
  let I = !1;
102
- w.forEach((T, D) => {
103
- !T && D === f && (T = S), T ? (A.set(D, T), S.d.get(D) !== T && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
104
- }), (I || S.d.size !== A.size) && (S.d = A);
105
- }, p = (f, S, w) => {
106
- const A = c(f), I = {
107
- d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
108
- v: S
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
109
109
  };
110
- if (w && u(f, I, w), A && isEqualAtomValue(A, I) && A.d === I.d)
111
- return A;
112
- if (A && hasPromiseAtomValue(A) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(A, I)) {
113
- if (A.d === I.d)
114
- return A;
115
- I.v = A.v;
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;
116
116
  }
117
- return d(f, I), I;
118
- }, m = (f, S, w, A) => {
119
- if (isPromiseLike$2(S)) {
117
+ return d(m, I), I;
118
+ }, g = (m, v, C, B) => {
119
+ if (isPromiseLike$2(v)) {
120
120
  let I;
121
- const T = new Promise((D, O) => {
121
+ const N = new Promise((P, O) => {
122
122
  let M = !1;
123
- S.then(
123
+ v.then(
124
124
  (V) => {
125
125
  if (!M) {
126
126
  M = !0;
127
- const $ = c(f), H = p(
128
- f,
129
- T,
130
- w
127
+ const $ = c(m), H = p(
128
+ m,
129
+ N,
130
+ C
131
131
  );
132
- resolvePromise(T, V), D(V), ($ == null ? void 0 : $.d) !== H.d && N(f, H, $ == null ? void 0 : $.d);
132
+ resolvePromise(N, V), P(V), ($ == null ? void 0 : $.d) !== H.d && T(m, H, $ == null ? void 0 : $.d);
133
133
  }
134
134
  },
135
135
  (V) => {
136
136
  if (!M) {
137
137
  M = !0;
138
- const $ = c(f), H = p(
139
- f,
140
- T,
141
- w
138
+ const $ = c(m), H = p(
139
+ m,
140
+ N,
141
+ C
142
142
  );
143
- rejectPromise(T, V), O(V), ($ == null ? void 0 : $.d) !== H.d && N(f, H, $ == null ? void 0 : $.d);
143
+ rejectPromise(N, V), O(V), ($ == null ? void 0 : $.d) !== H.d && T(m, H, $ == null ? void 0 : $.d);
144
144
  }
145
145
  }
146
146
  ), I = (V) => {
147
147
  M || (M = !0, V.then(
148
- ($) => resolvePromise(T, $),
149
- ($) => rejectPromise(T, $)
150
- ), D(V));
148
+ ($) => resolvePromise(N, $),
149
+ ($) => rejectPromise(N, $)
150
+ ), P(V));
151
151
  };
152
152
  });
153
- return T.orig = S, T.status = "pending", registerCancelPromise(T, (D) => {
154
- D && I(D), A == null || A();
155
- }), p(f, T, w);
153
+ return N.orig = v, N.status = "pending", registerCancelPromise(N, (P) => {
154
+ P && I(P), B == null || B();
155
+ }), p(m, N, C);
156
156
  }
157
- return p(f, S, w);
158
- }, g = (f, S, w) => {
159
- const A = c(f), I = {
160
- d: (A == null ? void 0 : A.d) || /* @__PURE__ */ new Map(),
161
- e: S
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
162
162
  };
163
- return w && u(f, I, w), A && isEqualAtomError(A, I) && A.d === I.d ? A : (d(f, I), I);
164
- }, x = (f) => {
165
- const S = c(f);
166
- if (S && (S.d.forEach((M, V) => {
167
- V !== f && !n.has(V) && x(V);
168
- }), Array.from(S.d).every(([M, V]) => {
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]) => {
169
169
  const $ = c(M);
170
- return M === f || $ === V || // TODO This is a hack, we should find a better solution.
170
+ return M === m || $ === V || // TODO This is a hack, we should find a better solution.
171
171
  $ && !hasPromiseAtomValue($) && isEqualAtomValue($, V);
172
172
  })))
173
- return S;
174
- const w = /* @__PURE__ */ new Map();
175
- let A = !0;
173
+ return v;
174
+ const C = /* @__PURE__ */ new Map();
175
+ let B = !0;
176
176
  const I = (M) => {
177
- if (M === f) {
177
+ if (M === m) {
178
178
  const $ = c(M);
179
179
  if ($)
180
- return w.set(M, $), returnAtomValue($);
180
+ return C.set(M, $), returnAtomValue($);
181
181
  if (hasInitialValue(M))
182
- return w.set(M, void 0), M.init;
182
+ return C.set(M, void 0), M.init;
183
183
  throw new Error("no atom init");
184
184
  }
185
185
  const V = x(M);
186
- return w.set(M, V), returnAtomValue(V);
186
+ return C.set(M, V), returnAtomValue(V);
187
187
  };
188
- let T, D;
188
+ let N, P;
189
189
  const O = {
190
190
  get signal() {
191
- return T || (T = new AbortController()), T.signal;
191
+ return N || (N = new AbortController()), N.signal;
192
192
  },
193
193
  get setSelf() {
194
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(f) && console.warn("setSelf function cannot be used with read-only atom"), !D && isActuallyWritableAtom(f) && (D = (...M) => {
195
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && A && console.warn("setSelf function cannot be called in sync"), !A)
196
- return B(f, ...M);
197
- }), D;
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);
197
+ }), P;
198
198
  }
199
199
  };
200
200
  try {
201
- const M = f.read(I, O);
202
- return m(
203
- f,
201
+ const M = m.read(I, O);
202
+ return g(
203
+ m,
204
204
  M,
205
- w,
206
- () => T == null ? void 0 : T.abort()
205
+ C,
206
+ () => N == null ? void 0 : N.abort()
207
207
  );
208
208
  } catch (M) {
209
- return g(f, M, w);
209
+ return f(m, M, C);
210
210
  } finally {
211
- A = !1;
211
+ B = !1;
212
212
  }
213
- }, j = (f) => returnAtomValue(x(f)), E = (f) => {
214
- let S = n.get(f);
215
- return S || (S = R(f)), S;
216
- }, b = (f, S) => !S.l.size && (!S.t.size || S.t.size === 1 && S.t.has(f)), k = (f) => {
217
- const S = n.get(f);
218
- S && b(f, S) && _(f);
219
- }, v = (f) => {
220
- const S = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new WeakMap(), A = (T) => {
221
- const D = n.get(T);
222
- D == null || D.t.forEach((O) => {
223
- O !== T && (S.set(
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);
222
+ P == null || P.t.forEach((O) => {
223
+ O !== N && (v.set(
224
224
  O,
225
- (S.get(O) || /* @__PURE__ */ new Set()).add(T)
226
- ), w.set(O, (w.get(O) || 0) + 1), A(O));
225
+ (v.get(O) || /* @__PURE__ */ new Set()).add(N)
226
+ ), C.set(O, (C.get(O) || 0) + 1), B(O));
227
227
  });
228
228
  };
229
- A(f);
230
- const I = (T) => {
231
- const D = n.get(T);
232
- D == null || D.t.forEach((O) => {
229
+ B(m);
230
+ const I = (N) => {
231
+ const P = n.get(N);
232
+ P == null || P.t.forEach((O) => {
233
233
  var M;
234
- if (O !== T) {
235
- let V = w.get(O);
236
- if (V && w.set(O, --V), !V) {
237
- let $ = !!((M = S.get(O)) != null && M.size);
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);
238
238
  if ($) {
239
239
  const H = c(O), U = x(O);
240
240
  $ = !H || !isEqualAtomValue(H, U);
241
241
  }
242
- $ || S.forEach((H) => H.delete(O));
242
+ $ || v.forEach((H) => H.delete(O));
243
243
  }
244
244
  I(O);
245
245
  }
246
246
  });
247
247
  };
248
- I(f);
249
- }, C = (f, ...S) => {
250
- let w = !0;
251
- const A = (D) => returnAtomValue(x(D)), I = (D, ...O) => {
248
+ I(m);
249
+ }, w = (m, ...v) => {
250
+ let C = !0;
251
+ const B = (P) => returnAtomValue(x(P)), I = (P, ...O) => {
252
252
  let M;
253
- if (D === f) {
254
- if (!hasInitialValue(D))
253
+ if (P === m) {
254
+ if (!hasInitialValue(P))
255
255
  throw new Error("atom not writable");
256
- const V = c(D), $ = m(D, O[0]);
257
- (!V || !isEqualAtomValue(V, $)) && v(D);
256
+ const V = c(P), $ = g(P, O[0]);
257
+ (!V || !isEqualAtomValue(V, $)) && S(P);
258
258
  } else
259
- M = C(D, ...O);
260
- if (!w) {
259
+ M = w(P, ...O);
260
+ if (!C) {
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
- }, T = f.write(A, I, ...S);
268
- return w = !1, T;
269
- }, B = (f, ...S) => {
270
- const w = C(f, ...S), A = L();
267
+ }, N = m.write(B, I, ...v);
268
+ return C = !1, N;
269
+ }, _ = (m, ...v) => {
270
+ const C = w(m, ...v), B = L();
271
271
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
272
- (I) => I({ type: "write", flushed: A })
273
- ), w;
274
- }, R = (f, S) => {
275
- const w = {
276
- t: new Set(S && [S]),
272
+ (I) => I({ type: "write", flushed: B })
273
+ ), C;
274
+ }, R = (m, v) => {
275
+ const C = {
276
+ t: new Set(v && [v]),
277
277
  l: /* @__PURE__ */ new Set()
278
278
  };
279
- if (n.set(f, w), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(f), x(f).d.forEach((A, I) => {
280
- const T = n.get(I);
281
- T ? T.t.add(f) : I !== f && R(I, f);
282
- }), x(f), isActuallyWritableAtom(f) && f.onMount) {
283
- const A = f.onMount((...I) => B(f, ...I));
284
- A && (w.u = A);
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);
285
285
  }
286
- return w;
287
- }, _ = (f) => {
288
- var S;
289
- const w = (S = n.get(f)) == null ? void 0 : S.u;
290
- w && w(), n.delete(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(f);
291
- const A = c(f);
292
- A ? (hasPromiseAtomValue(A) && cancelPromise(A.v), A.d.forEach((I, T) => {
293
- if (T !== f) {
294
- const D = n.get(T);
295
- D && (D.t.delete(f), b(T, D) && _(T));
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));
296
296
  }
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, S, w) => {
299
- const A = new Set(S.d.keys());
300
- w == null || w.forEach((I, T) => {
301
- if (A.has(T)) {
302
- A.delete(T);
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);
303
303
  return;
304
304
  }
305
- const D = n.get(T);
306
- D && (D.t.delete(f), b(T, D) && _(T));
307
- }), A.forEach((I) => {
308
- const T = n.get(I);
309
- T ? T.t.add(f) : n.has(f) && R(I, f);
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);
310
310
  });
311
311
  }, L = () => {
312
- let f;
313
- for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (f = /* @__PURE__ */ new Set()); r.size; ) {
314
- const S = Array.from(r);
315
- r.clear(), S.forEach(([w, A]) => {
316
- const I = c(w);
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);
317
317
  if (I) {
318
- I.d !== (A == null ? void 0 : A.d) && N(w, I, A == null ? void 0 : A.d);
319
- const T = n.get(w);
320
- T && !// TODO This seems pretty hacky. Hope to fix it.
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.
321
321
  // Maybe we could `mountDependencies` in `setAtomState`?
322
- (A && !hasPromiseAtomValue(A) && (isEqualAtomValue(A, I) || isEqualAtomError(A, I))) && (T.l.forEach((D) => D()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && f.add(w));
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));
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((S) => S("state")), f;
329
- }, P = (f, S) => {
330
- const w = E(f), A = L(), I = w.l;
331
- return I.add(S), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("sub")), l.forEach(
332
- (T) => T({ type: "sub", flushed: A })
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 })
333
333
  )), () => {
334
- I.delete(S), k(f), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((T) => T("unsub")), l.forEach((T) => T({ type: "unsub" })));
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" })));
335
335
  };
336
336
  };
337
337
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
338
338
  get: j,
339
- set: B,
340
- sub: P,
339
+ set: _,
340
+ sub: D,
341
341
  // store dev methods (these are tentative and subject to change without notice)
342
- dev_subscribe_store: (f, S) => S !== 2 ? (console.warn(
342
+ dev_subscribe_store: (m, v) => v !== 2 ? (console.warn(
343
343
  "The current StoreListener revision is 2. The older ones are deprecated."
344
- ), a.add(f), () => {
345
- a.delete(f);
346
- }) : (l.add(f), () => {
347
- l.delete(f);
344
+ ), a.add(m), () => {
345
+ a.delete(m);
346
+ }) : (l.add(m), () => {
347
+ l.delete(m);
348
348
  }),
349
349
  dev_get_mounted_atoms: () => i.values(),
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 [w, A] of f)
354
- hasInitialValue(w) && (m(w, A), v(w));
355
- const S = L();
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();
356
356
  l.forEach(
357
- (w) => w({ type: "restore", flushed: S })
357
+ (C) => C({ type: "restore", flushed: v })
358
358
  );
359
359
  }
360
360
  } : {
361
361
  get: j,
362
- set: B,
363
- sub: P
362
+ set: _,
363
+ sub: D
364
364
  };
365
365
  };
366
366
  let defaultStore;
@@ -377,37 +377,37 @@ function splitAtom(o, n) {
377
377
  let u = r.get(c);
378
378
  if (u)
379
379
  return u;
380
- const p = d && r.get(d), m = [], g = [];
380
+ const p = d && r.get(d), g = [], f = [];
381
381
  return c.forEach((x, j) => {
382
382
  const E = n ? n(x) : j;
383
- g[j] = E;
383
+ f[j] = E;
384
384
  const b = p && p.atomList[p.keyList.indexOf(E)];
385
385
  if (b) {
386
- m[j] = b;
386
+ g[j] = b;
387
387
  return;
388
388
  }
389
- const k = (C) => {
390
- const B = C(l), R = C(o), N = a(R, B == null ? void 0 : B.arr).keyList.indexOf(E);
391
- if (N < 0 || N >= R.length) {
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) {
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[N];
398
- }, v = (C, B, R) => {
399
- const _ = C(l), N = C(o), P = a(N, _ == null ? void 0 : _.arr).keyList.indexOf(E);
400
- if (P < 0 || P >= N.length)
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)
401
401
  throw new Error("splitAtom: index out of bounds for write");
402
- const f = isFunction(R) ? R(N[P]) : R;
403
- B(o, [
404
- ...N.slice(0, P),
405
- f,
406
- ...N.slice(P + 1)
402
+ const m = isFunction(R) ? R(T[D]) : R;
403
+ _(o, [
404
+ ...T.slice(0, D),
405
+ m,
406
+ ...T.slice(D + 1)
407
407
  ]);
408
408
  };
409
- m[j] = isWritable(o) ? atom(k, v) : 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;
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;
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 m = c(o);
423
+ const g = c(o);
424
424
  d(o, [
425
- ...m.slice(0, p),
426
- ...m.slice(p + 1)
425
+ ...g.slice(0, p),
426
+ ...g.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 m = c(o);
434
+ const g = c(o);
435
435
  d(o, [
436
- ...m.slice(0, p),
436
+ ...g.slice(0, p),
437
437
  u.value,
438
- ...m.slice(p)
438
+ ...g.slice(p)
439
439
  ]);
440
440
  }
441
441
  break;
442
442
  }
443
443
  case "move": {
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)
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)
452
452
  ]) : d(o, [
453
- ...g.slice(0, m),
454
- g[p],
455
- ...g.slice(m, p),
456
- ...g.slice(p + 1)
453
+ ...f.slice(0, g),
454
+ f[p],
455
+ ...f.slice(g, p),
456
+ ...f.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 = (m) => {
477
- if (m = m || "", n !== m) {
476
+ const u = (g) => {
477
+ if (g = g || "", n !== g) {
478
478
  try {
479
- r = JSON.parse(m);
479
+ r = JSON.parse(g);
480
480
  } catch {
481
481
  return i;
482
482
  }
483
- n = m;
483
+ n = g;
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 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));
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));
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 m = r.get(o);
559
- return Object.is(p[0], m) && p[1] === r && p[2] === o ? p : [m, r, o];
558
+ const g = r.get(o);
559
+ return Object.is(p[0], g) && p[1] === r && p[2] === o ? p : [g, 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 m = find(i, { oldId: u[p].replace("slot:", "") });
644
- d[p] = `slot:${m._id}`;
643
+ const g = find(i, { oldId: u[p].replace("slot:", "") });
644
+ d[p] = `slot:${g._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((m) => (m.title && (m.title = n(m.title)), m))), 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((g) => (g.title && (g.title = n(g.title)), g))), 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 m = a[p];
760
- if (includes(["slot", "styles"], m.type))
759
+ const g = a[p];
760
+ if (includes(["slot", "styles"], g.type))
761
761
  return;
762
- const g = p;
763
- i.properties[g] = getBlockJSONFromSchemas(m, n, r);
762
+ const f = p;
763
+ i.properties[f] = getBlockJSONFromSchemas(g, 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 m = c[p];
776
- if (includes(["slot", "styles"], m.type))
775
+ const g = c[p];
776
+ if (includes(["slot", "styles"], g.type))
777
777
  return;
778
- const g = p;
779
- u.items.properties[g] = getBlockJSONFromSchemas(m, n, r), set(
778
+ const f = p;
779
+ u.items.properties[f] = getBlockJSONFromSchemas(g, n, r), set(
780
780
  u.items,
781
781
  "title",
782
- titleWithLang(get(m, "itemTitle", `${n(d)} item`), r, get(m, "i18n"))
782
+ titleWithLang(get(g, "itemTitle", `${n(d)} item`), r, get(g, "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, m) {
837
- return !p || typeof p[m] != "function" ? this : (c = !0, p[m](), c = !1, this);
836
+ function u(p, g) {
837
+ return !p || typeof p[g] != "function" ? this : (c = !0, p[g](), 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 m = p.groupId;
865
- for (; p.groupId === m && (u(p, "undo"), l -= 1, p = a[l], !(!p || !p.groupId)); )
864
+ const g = p.groupId;
865
+ for (; p.groupId === g && (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 m = p.groupId;
877
- for (; p.groupId === m && (u(p, "redo"), l += 1, p = a[l + 1], !(!p || !p.groupId)); )
876
+ const g = p.groupId;
877
+ for (; p.groupId === g && (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((m) => m.groupId === p) : a;
908
+ return p ? a.filter((g) => g.groupId === p) : a;
909
909
  },
910
910
  /**
911
911
  * Returns the index of the actions list.
@@ -1202,13 +1202,13 @@ const useBlocksStoreManager = () => {
1202
1202
  } = useBlocksStoreManager();
1203
1203
  return {
1204
1204
  moveBlocks: (E, b, k) => {
1205
- const v = map(E, (B) => {
1206
- const _ = n.find((P) => P._id === B)._parent || null, L = n.filter((P) => _ ? P._parent === _ : !P._parent).map((P) => P._id).indexOf(B);
1207
- return { _id: B, oldParent: _, oldPosition: L };
1208
- }), C = v.find(({ _id: B }) => B === E[0]);
1209
- C && C.oldParent === b && C.oldPosition === k || (i(E, b, k), o({
1210
- undo: () => each(v, ({ _id: B, oldParent: R, oldPosition: _ }) => {
1211
- i([B], R, _);
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 };
1208
+ }), w = S.find(({ _id: _ }) => _ === E[0]);
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);
1212
1212
  }),
1213
1213
  redo: () => i(E, b, k)
1214
1214
  }));
@@ -1220,27 +1220,27 @@ const useBlocksStoreManager = () => {
1220
1220
  });
1221
1221
  },
1222
1222
  removeBlocks: (E) => {
1223
- var C;
1224
- const b = (C = first(E)) == null ? void 0 : C._parent, v = n.filter((B) => b ? B._parent === b : !B._parent).indexOf(first(E));
1223
+ var w;
1224
+ const b = (w = first(E)) == null ? void 0 : w._parent, S = n.filter((_) => b ? _._parent === b : !_._parent).indexOf(first(E));
1225
1225
  l(map(E, "_id")), o({
1226
- undo: () => a(E, b, v),
1226
+ undo: () => a(E, b, S),
1227
1227
  redo: () => l(map(E, "_id"))
1228
1228
  });
1229
1229
  },
1230
1230
  updateBlocks: (E, b, k) => {
1231
- let v = [];
1231
+ let S = [];
1232
1232
  if (k)
1233
- v = map(E, (C) => ({ _id: C, ...k }));
1233
+ S = map(E, (w) => ({ _id: w, ...k }));
1234
1234
  else {
1235
- const C = keys(b);
1236
- v = map(E, (B) => {
1237
- const R = n.find((N) => N._id === B), _ = { _id: B };
1238
- return each(C, (N) => _[N] = R[N]), _;
1235
+ const w = keys(b);
1236
+ S = map(E, (_) => {
1237
+ const R = n.find((T) => T._id === _), A = { _id: _ };
1238
+ return each(w, (T) => A[T] = R[T]), A;
1239
1239
  });
1240
1240
  }
1241
- c(map(E, (C) => ({ _id: C, ...b }))), o({
1242
- undo: () => c(v),
1243
- redo: () => c(map(E, (C) => ({ _id: C, ...b })))
1241
+ c(map(E, (w) => ({ _id: w, ...b }))), o({
1242
+ undo: () => c(S),
1243
+ redo: () => c(map(E, (w) => ({ _id: w, ...b })))
1244
1244
  });
1245
1245
  },
1246
1246
  updateBlocksRuntime: (E, b) => {
@@ -1255,8 +1255,8 @@ const useBlocksStoreManager = () => {
1255
1255
  updateMultipleBlocksProps: (E) => {
1256
1256
  let b = [];
1257
1257
  b = map(E, (k) => {
1258
- const v = keys(k), C = n.find((R) => R._id === k._id), B = {};
1259
- return each(v, (R) => B[R] = C[R]), B;
1258
+ const S = keys(k), w = n.find((R) => R._id === k._id), _ = {};
1259
+ return each(S, (R) => _[R] = w[R]), _;
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, 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);
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);
1280
1280
  },
1281
1281
  [o, n]
1282
1282
  );
@@ -1286,29 +1286,29 @@ 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), m = [];
1290
- forIn(p, (k, v) => {
1289
+ const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
1290
+ forIn(p, (k, S) => {
1291
1291
  if (startsWith(k, SLOT_KEY)) {
1292
- const C = k.replace(SLOT_KEY, "");
1293
- m.push({
1294
- _id: C,
1292
+ const w = k.replace(SLOT_KEY, "");
1293
+ g.push({
1294
+ _id: w,
1295
1295
  _type: "Slot",
1296
1296
  _parent: u,
1297
- _name: i.props[v].name,
1298
- _styles: i.props[v].styles,
1299
- _emptyStyles: i.props[v].emptyStyles
1297
+ _name: i.props[S].name,
1298
+ _styles: i.props[S].styles,
1299
+ _emptyStyles: i.props[S].emptyStyles
1300
1300
  });
1301
1301
  }
1302
1302
  });
1303
- const g = {
1303
+ const f = {
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 }), 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;
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;
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 m = constructClassObject(p), g = find(a, pick(m, ["dark", "mq", "mod", "property"]));
2420
- if (g && (a = filter(
2419
+ const g = constructClassObject(p), f = find(a, pick(g, ["dark", "mq", "mod", "property"]));
2420
+ if (f && (a = filter(
2421
2421
  a,
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(
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(
2426
2426
  l,
2427
2427
  (j) => j.fullCls !== (x == null ? void 0 : x.fullCls)
2428
2428
  )), c.push({
2429
- ...m,
2430
- fullCls: m.cls,
2429
+ ...g,
2430
+ fullCls: g.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: m } = getSplitClasses$1(u);
2458
+ const d = o(c), u = get(d, i.prop, `${STYLES_KEY},`), { baseClasses: p, classes: g } = getSplitClasses$1(u);
2459
2459
  return {
2460
2460
  ids: [d._id],
2461
- props: { [i.prop]: `${STYLES_KEY}${getNewClasses(m, p, a)}` }
2461
+ props: { [i.prop]: `${STYLES_KEY}${getNewClasses(g, 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 m = filter(
2512
+ const g = filter(
2513
2513
  o,
2514
2514
  (x) => isString$1(l) ? x._parent === l : !d._parent
2515
- ).indexOf(d) + 1, g = getDuplicatedBlocks(o, c, l);
2516
- r(g, l, m), i.push(get(g, "0._id", ""));
2515
+ ).indexOf(d) + 1, f = getDuplicatedBlocks(o, c, l);
2516
+ r(f, l, g), i.push(get(f, "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: m } = getSplitClasses(get(d, l.prop, "styles:,"));
2580
- return each(u, (g) => {
2581
- const x = g.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), j = new RegExp(`(^| )${x}($| )`, "g");
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");
2582
2582
  p = p.replace(j, " ").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();
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();
2588
2588
  }), {
2589
2589
  ids: [d._id],
2590
2590
  props: {
2591
- [l.prop]: `${STYLES_KEY}${m},${p}`
2591
+ [l.prop]: `${STYLES_KEY}${g},${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((m) => setTimeout(m, a));
2692
+ u += d[p].join(""), o([n], { [i]: u }), await new Promise((g) => setTimeout(g, 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 m = {};
2891
- const g = u * p, x = d * p;
2892
- u && (m = {
2890
+ let g = {};
2891
+ const f = u * p, x = d * p;
2892
+ u && (g = {
2893
2893
  // Eureka! This is the formula to calculate the height of the scaled element. Thank you ChatGPT 4
2894
- height: 100 + (u - g) / g * 100 + "%",
2894
+ height: 100 + (u - f) / f * 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
- ...m,
2901
+ ...g,
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 g = () => {
3074
+ const f = () => {
3075
3075
  removePlaceholder(), r(!1), u(null), p(null), possiblePositions = [];
3076
3076
  };
3077
3077
  return iframeDocument = o, {
@@ -3083,17 +3083,17 @@ const useDnd = () => {
3083
3083
  var R;
3084
3084
  const j = dropTarget, b = getOrientation(j) === "vertical" ? x.clientY + ((R = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : R.scrollY) : x.clientX;
3085
3085
  dropIndex = calculateDropIndex(b, possiblePositions);
3086
- const k = d, v = j.getAttribute("data-block-id"), C = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3087
- if ((k == null ? void 0 : k._id) === v || !C) {
3088
- g();
3086
+ const k = d, S = j.getAttribute("data-block-id"), w = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3087
+ if ((k == null ? void 0 : k._id) === S || !w) {
3088
+ f();
3089
3089
  return;
3090
3090
  }
3091
3091
  if (!has(k, "_id")) {
3092
- a(k, v === "canvas" ? null : v, dropIndex), setTimeout(g, 300);
3092
+ a(k, S === "canvas" ? null : S, dropIndex), setTimeout(f, 300);
3093
3093
  return;
3094
3094
  }
3095
- let B = j.getAttribute("data-block-id");
3096
- B === null && (B = x.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), g(), setTimeout(removePlaceholder, 300);
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);
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 g;
3125
+ var f;
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 m() {
3136
+ function g() {
3137
3137
  const x = p.getText(0, p.getLength());
3138
- n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", m, !0), destroyQuill(p), a(""), l(), u.remove();
3138
+ n([c.getAttribute("data-block-id")], { content: x }), c.removeAttribute("style"), u.removeEventListener("blur", g, !0), destroyQuill(p), a(""), l(), u.remove();
3139
3139
  }
3140
- u.addEventListener("blur", m, !0), u.addEventListener("click", (x) => {
3140
+ u.addEventListener("blur", g, !0), u.addEventListener("click", (x) => {
3141
3141
  x.stopPropagation();
3142
3142
  }), u.addEventListener("keydown", (x) => {
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"));
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"));
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"), m = d.getAttribute("data-block-parent");
3159
- n.includes(m) || l == null || l.closeAll(), o([{ id: p, prop: u, blockId: m }]), r([m]);
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]);
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 g = getElementByDataBlockId(n, first(r));
3184
- if (g) {
3185
- const x = g.getAttribute("data-style-prop");
3183
+ const f = getElementByDataBlockId(n, first(r));
3184
+ if (f) {
3185
+ const x = f.getAttribute("data-style-prop");
3186
3186
  if (x) {
3187
- const j = g.getAttribute("data-style-id"), E = g.getAttribute("data-block-parent");
3187
+ const j = f.getAttribute("data-style-id"), E = f.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(), m = useDnd();
3193
+ const c = useHandleCanvasDblClick(), d = useHandleCanvasClick(), u = useHandleMouseMove(), p = useHandleMouseLeave(), g = 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(m, "isDragging"),
3204
- className: "relative h-full max-w-full p-px " + (m.isDragging ? "dragging" : ""),
3203
+ ...omit(g, "isDragging"),
3204
+ className: "relative h-full max-w-full p-px " + (g.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: m } = usePasteBlocks();
3209
+ const [n, r] = useSelectedBlockIds(), a = useRemoveBlocks(), l = useDuplicateBlocks(), { undo: i, redo: c } = useUndoManager(), [, d] = useCutBlockIds(), [, u] = useCopyBlockIds(), { canPaste: p, pasteBlocks: g } = 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]) && m(n);
3213
+ p(n[0]) && g(n);
3214
3214
  },
3215
3215
  {},
3216
- [n, p, m]
3216
+ [n, p, g]
3217
3217
  );
3218
- const g = o ? { document: o } : {};
3219
- useHotkeys("esc", () => r([]), g, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...g, preventDefault: !0 }, [
3218
+ const f = o ? { document: o } : {};
3219
+ useHotkeys("esc", () => r([]), f, [r]), useHotkeys("ctrl+d,command+d", () => l(n), { ...f, 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
- g,
3227
+ f,
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: m } = useFloating({
3256
+ const r = useRemoveBlocks(), a = useDuplicateBlocks(), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks(), [d] = useAtom$1(inlineEditingActiveAtom), { floatingStyles: u, refs: p, update: g } = 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, () => m(), o !== null);
3264
- const g = get(n, "_parent", null), x = isEmpty(get(n, "_name", "")) ? get(n, "_type", "") : get(n, "_name", "");
3263
+ useResizeObserver(o, () => g(), o !== null);
3264
+ const f = 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
- g && /* @__PURE__ */ jsxRuntimeExports.jsx(
3281
+ f && /* @__PURE__ */ jsxRuntimeExports.jsx(
3282
3282
  ArrowUpIcon,
3283
3283
  {
3284
3284
  className: "hover:scale-105",
3285
3285
  onClick: () => {
3286
- c([]), l([g]);
3286
+ c([]), l([f]);
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
- ), [m] = useState(
3316
- c == null ? void 0 : c.getElementById("selected-styling-block")
3317
3315
  ), [g] = useState(
3316
+ c == null ? void 0 : c.getElementById("selected-styling-block")
3317
+ ), [f] = 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"), v = get(o, "bodyBgDarkColor", "#000"), C = get(o, "bodyTextDarkColor", "#000"), B = 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"), R = s({
3326
3326
  colors: [E, b],
3327
3327
  names: ["primary", "secondary"]
3328
3328
  });
3329
3329
  set(R, "primary.DEFAULT", E), set(R, "secondary.DEFAULT", b);
3330
- const _ = {
3330
+ const A = {
3331
3331
  "bg-light": k,
3332
- "bg-dark": v,
3333
- "text-dark": C,
3334
- "text-light": B
3335
- }, N = get(o, "roundedCorners", "0");
3332
+ "bg-dark": S,
3333
+ "text-dark": w,
3334
+ "text-light": _
3335
+ }, T = get(o, "roundedCorners", "0");
3336
3336
  !d || !d.tailwind || (d.tailwind.config = {
3337
3337
  darkMode: "class",
3338
3338
  theme: {
@@ -3349,28 +3349,28 @@ const useHandleCanvasDblClick = () => {
3349
3349
  body: [j]
3350
3350
  },
3351
3351
  borderRadius: {
3352
- DEFAULT: `${N || "0"}px`
3352
+ DEFAULT: `${T || "0"}px`
3353
3353
  },
3354
- colors: { ..._, ...R }
3354
+ colors: { ...A, ...R }
3355
3355
  }
3356
3356
  },
3357
3357
  plugins: [
3358
3358
  typography,
3359
3359
  forms,
3360
3360
  aspectRatio,
3361
- plugin(function({ addBase: L, theme: P }) {
3361
+ plugin(function({ addBase: L, theme: D }) {
3362
3362
  L({
3363
3363
  "h1,h2,h3,h4,h5,h6": {
3364
- fontFamily: P("fontFamily.heading")
3364
+ fontFamily: D("fontFamily.heading")
3365
3365
  },
3366
3366
  body: {
3367
- fontFamily: P("fontFamily.body"),
3368
- color: P("colors.text-light"),
3369
- backgroundColor: P("colors.bg-light")
3367
+ fontFamily: D("fontFamily.body"),
3368
+ color: D("colors.text-light"),
3369
+ backgroundColor: D("colors.bg-light")
3370
3370
  },
3371
3371
  ".dark body": {
3372
- color: P("colors.text-dark"),
3373
- backgroundColor: P("colors.bg-dark")
3372
+ color: D("colors.text-dark"),
3373
+ backgroundColor: D("colors.bg-dark")
3374
3374
  }
3375
3375
  });
3376
3376
  })
@@ -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
- 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(() => {
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(() => {
3386
3386
  u && (u.textContent = '[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}');
3387
3387
  }, [u]), useEffect(() => {
3388
- m && (m.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
3388
+ g && (g.textContent = `${map(a, ({ id: E }) => `[data-style-id="${E}"]`).join(",")}{
3389
3389
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3390
3390
  }`);
3391
- }, [a, m]), useEffect(() => {
3391
+ }, [a, g]), 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 m = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], g = ["hidden"];
3409
- if (m.includes(u))
3408
+ const g = ["block", "flex", "inline", "inline-block", "inline-flex", "grid", "table"], f = ["hidden"];
3409
+ if (g.includes(u))
3410
3410
  for (let x = p; x < r.length; x++)
3411
3411
  i[x] = !0;
3412
- else if (g.includes(u))
3412
+ else if (f.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 g;
3435
- return (g = get(i, p._type)) == null ? void 0 : g.server;
3434
+ var f;
3435
+ return (f = get(i, p._type)) == null ? void 0 : f.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((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,
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,
3445
3445
  [u]: { loading: !1, error: null }
3446
3446
  }));
3447
- }).catch((m) => {
3448
- l((g) => ({
3449
- ...g,
3450
- [u]: { loading: !1, error: m.message }
3447
+ }).catch((g) => {
3448
+ l((f) => ({
3449
+ ...f,
3450
+ [u]: { loading: !1, error: g.message }
3451
3451
  }));
3452
3452
  });
3453
3453
  });
@@ -3512,10 +3512,10 @@ 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: m } = useGlobalBlocksStore(), g = useCallback((b) => getStyleAttrs(b, d), [d]), [x] = useChaiExternalData(), [j] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3516
- (b) => b.reduce((k, v) => {
3517
- const C = get(u, v, {});
3518
- return { ...k, ...C };
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(
3516
+ (b) => b.reduce((k, S) => {
3517
+ const w = get(u, S, {});
3518
+ return { ...k, ...w };
3519
3519
  }, {}),
3520
3520
  [u]
3521
3521
  );
@@ -3523,18 +3523,18 @@ function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3523
3523
  o.map((b, k) => {
3524
3524
  if (j === b._id || p.includes(b._id))
3525
3525
  return null;
3526
- const v = {}, C = filter(n, { _parent: b._id });
3527
- if (v.children = C.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: C }) : null, b._type === "GlobalBlock") {
3528
- const w = m(b);
3529
- v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(w, (A) => !A._parent), allBlocks: w });
3526
+ const S = {}, w = filter(n, { _parent: b._id });
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 });
3530
3530
  }
3531
- const B = getBlockComponent(b._type), R = get(B, "server", !1), _ = R ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3532
- if (isNull(_))
3531
+ const _ = getBlockComponent(b._type), R = get(_, "server", !1), A = R ? RSCBlock : get(_, "builderComponent", get(_, "component", null));
3532
+ if (isNull(A))
3533
3533
  return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${b == null ? void 0 : b._type} not registered -->` });
3534
- const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(b, n) : [], L = E(N), P = g(b);
3535
- if (get(P, "__isHidden", !1) && !includes(a, b._id))
3534
+ const T = has(_, "getBlockStateFrom") ? _ == null ? void 0 : _.getBlockStateFrom(b, n) : [], L = E(T), D = f(b);
3535
+ if (get(D, "__isHidden", !1) && !includes(a, b._id))
3536
3536
  return null;
3537
- const f = i && isDescendant(i._id, b._id, n), S = {
3537
+ const m = i && isDescendant(i._id, b._id, n), v = {
3538
3538
  ...includes(a, b._id) ? { "force-show": "" } : {},
3539
3539
  "data-block-id": b._id,
3540
3540
  "data-block-type": b._type,
@@ -3542,18 +3542,18 @@ 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 || f ? "yes" : "no"
3545
+ "data-dnd-dragged": i._id === b._id || m ? "yes" : "no"
3546
3546
  }
3547
3547
  ) : {},
3548
- ...c === b._id && !f ? { "data-drop": "yes" } : {},
3548
+ ...c === b._id && !m ? { "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: S }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(_, {
3552
- blockProps: S,
3551
+ return R ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: b, blockProps: v }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3552
+ blockProps: v,
3553
3553
  index: k,
3554
- ...applyBindings(applyLanguage(b, r, B), x),
3555
- ...omit(P, ["__isHidden"]),
3556
- ...v,
3554
+ ...applyBindings(applyLanguage(b, r, _), x),
3555
+ ...omit(D, ["__isHidden"]),
3556
+ ...S,
3557
3557
  inBuilder: !0,
3558
3558
  blockState: L
3559
3559
  }) });
@@ -3609,43 +3609,43 @@ 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), [m, g] = useState([]), [, x] = useState([]), [, j] = useAtom$1(canvasIframeAtom), [E, b] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), C = (_) => {
3613
- u((N) => ({ ...N, width: _ }));
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 }));
3614
3614
  };
3615
3615
  useEffect(() => {
3616
3616
  if (!c.current)
3617
3617
  return;
3618
- const { clientWidth: _, clientHeight: N } = c.current;
3619
- u({ width: _, height: N });
3618
+ const { clientWidth: A, clientHeight: T } = c.current;
3619
+ u({ width: A, height: T });
3620
3620
  }, [c, n]);
3621
- const B = (_, N = 0) => {
3622
- const { top: L } = _.getBoundingClientRect();
3623
- return L + N >= 0 && L - N <= window.innerHeight;
3621
+ const _ = (A, T = 0) => {
3622
+ const { top: L } = A.getBoundingClientRect();
3623
+ return L + T >= 0 && L - T <= window.innerHeight;
3624
3624
  };
3625
3625
  useEffect(() => {
3626
- var _, N;
3626
+ var A, T;
3627
3627
  if (a && a.type !== "Multiple" && i.current) {
3628
3628
  const L = getElementByDataBlockId(i.current.contentDocument, a._id);
3629
- L && (B(L) || (N = (_ = i.current) == null ? void 0 : _.contentWindow) == null || N.scrollTo({ top: L.offsetTop, behavior: "smooth" }), g([L]));
3629
+ L && (_(L) || (T = (A = i.current) == null ? void 0 : A.contentWindow) == null || T.scrollTo({ top: L.offsetTop, behavior: "smooth" }), f([L]));
3630
3630
  }
3631
3631
  }, [a]), useEffect(() => {
3632
3632
  if (!isEmpty(E) && i.current) {
3633
- const _ = getElementByStyleId(
3633
+ const A = getElementByStyleId(
3634
3634
  i.current.contentDocument,
3635
3635
  first(E).id
3636
3636
  );
3637
- x(_ ? [_] : [null]);
3637
+ x(A ? [A] : [null]);
3638
3638
  } else
3639
3639
  x([null]);
3640
3640
  }, [E]);
3641
3641
  const R = useMemo(() => {
3642
- let _ = IframeInitialContent;
3643
- return _ = _.replace("__HTML_DIR__", v), o === "offline" && (_ = _.replace(
3642
+ let A = IframeInitialContent;
3643
+ return A = A.replace("__HTML_DIR__", S), o === "offline" && (A = A.replace(
3644
3644
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3645
3645
  "/offline/tailwind.cdn.js"
3646
- ), _ = _.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), _ = _.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), _;
3647
- }, [o, v]);
3648
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: C, onResize: C, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
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;
3647
+ }, [o, S]);
3648
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: w, onResize: w, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3649
3649
  "div",
3650
3650
  {
3651
3651
  onClick: () => {
@@ -3669,7 +3669,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3669
3669
  BlockActionsStatic,
3670
3670
  {
3671
3671
  block: a,
3672
- selectedBlockElement: first(m)
3672
+ selectedBlockElement: first(g)
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-ouljm9CI.js")), CanvasArea = () => {
3788
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-boaZFqJd.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,20 +3860,20 @@ 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 }, _) => {
3864
- _ && (a(R), i.current = R);
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);
3865
3865
  }, {
3866
3866
  bodyFont: u,
3867
3867
  headingFont: p,
3868
- primaryColor: m,
3869
- bodyTextDarkColor: g,
3868
+ primaryColor: g,
3869
+ bodyTextDarkColor: f,
3870
3870
  bodyTextLightColor: x,
3871
3871
  bodyBgDarkColor: j,
3872
3872
  secondaryColor: E,
3873
3873
  bodyBgLightColor: b,
3874
3874
  roundedCorners: k
3875
3875
  } = r;
3876
- let v = {
3876
+ let S = {
3877
3877
  headingFont: y({
3878
3878
  title: c("Theme Config.Heading Font"),
3879
3879
  default: p,
@@ -3888,18 +3888,18 @@ 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: m }),
3891
+ primaryColor: h({ title: c("Theme Config.Primary"), default: g }),
3892
3892
  secondaryColor: h({ title: c("Theme Config.Secondary"), default: E })
3893
3893
  };
3894
- l || (v = {
3895
- ...v,
3894
+ l || (S = {
3895
+ ...S,
3896
3896
  bodyBgLightColor: h({
3897
3897
  title: c("Theme Config.Background"),
3898
3898
  default: b
3899
3899
  }),
3900
3900
  bodyTextLightColor: h({
3901
3901
  title: c("Theme Config.Text Color"),
3902
- default: g
3902
+ default: f
3903
3903
  }),
3904
3904
  bodyBgDarkColor: h({
3905
3905
  title: c("Theme Config.Background Dark Mode"),
@@ -3910,13 +3910,13 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3910
3910
  default: x
3911
3911
  })
3912
3912
  });
3913
- const C = {
3913
+ const w = {
3914
3914
  type: "object",
3915
3915
  properties: {}
3916
- }, B = {};
3917
- return Object.keys(v).forEach((R) => {
3918
- const _ = v[R];
3919
- return C.properties || (C.properties = {}), C.properties[R] = _.schema, B[R] = _.uiSchema, !0;
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;
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(
@@ -3928,8 +3928,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3928
3928
  omitExtraData: !0,
3929
3929
  liveOmit: !0,
3930
3930
  liveValidate: !0,
3931
- uiSchema: B,
3932
- schema: C,
3931
+ uiSchema: _,
3932
+ schema: w,
3933
3933
  formData: r,
3934
3934
  validator,
3935
3935
  onChange: d
@@ -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: m, clearHighlight: g } = useBlockHighlight(), { id: x, data: j, isSelected: E, willReceiveDrop: b, isDragging: k, isEditing: v, handleClick: C } = o, B = (f) => {
4116
- f.stopPropagation(), !i.includes(x) && o.toggle();
4117
- }, R = (f) => {
4118
- f.isInternal && (u = f.isOpen, f.isOpen && f.close());
4119
- }, _ = (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(), C(f);
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);
4123
4123
  };
4124
4124
  useEffect(() => {
4125
- const f = setTimeout(() => {
4125
+ const m = setTimeout(() => {
4126
4126
  b && !o.isOpen && !k && !i.includes(x) && o.toggle();
4127
4127
  }, 500);
4128
- return () => clearTimeout(f);
4128
+ return () => clearTimeout(m);
4129
4129
  }, [b, o, k]);
4130
4130
  const L = useMemo(() => {
4131
- const f = Object.keys(j), S = [];
4132
- for (let w = 0; w < f.length; w++)
4133
- if (f[w].endsWith("_attrs")) {
4134
- const A = j[f[w]], I = Object.keys(A).join("|");
4135
- I.match(/x-data/) && S.push("data"), I.match(/x-on/) && S.push("event"), I.match(/x-show|x-if/) && S.push("show");
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");
4136
4136
  }
4137
- return S;
4138
- }, [j]), P = (f, S) => {
4139
- const w = d.contentDocument || d.contentWindow.document, A = w.querySelector(`[data-block-id=${f}]`);
4140
- A && A.setAttribute("data-drop", S);
4141
- const I = A.getBoundingClientRect(), T = d.getBoundingClientRect();
4142
- I.top >= T.top && I.left >= T.left && I.bottom <= T.bottom && I.right <= T.right || (w.documentElement.scrollTop = A.offsetTop - T.top);
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);
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: () => m(x),
4158
- onMouseLeave: () => g(),
4159
- onClick: N,
4157
+ onMouseEnter: () => g(x),
4158
+ onMouseLeave: () => f(),
4159
+ onClick: T,
4160
4160
  style: n,
4161
4161
  "data-node-id": x,
4162
4162
  ref: i.includes(x) ? null : r,
4163
4163
  onDragStart: () => R(o),
4164
- onDragEnd: () => _(o),
4165
- onDragOver: (f) => {
4166
- f.preventDefault(), P(x, "yes");
4164
+ onDragEnd: () => A(o),
4165
+ onDragOver: (m) => {
4166
+ m.preventDefault(), D(x, "yes");
4167
4167
  },
4168
- onDragLeave: (f) => {
4169
- f.preventDefault(), P(x, "no");
4168
+ onDragLeave: (m) => {
4169
+ m.preventDefault(), D(x, "no");
4170
4170
  },
4171
- onDrop: (f) => {
4172
- f.preventDefault(), P(x, "no");
4171
+ onDrop: (m) => {
4172
+ m.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",
@@ -4184,17 +4184,17 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4184
4184
  "div",
4185
4185
  {
4186
4186
  className: `flex h-4 w-4 rotate-0 transform cursor-pointer items-center justify-center text-xs transition-transform duration-100 ${o.isOpen ? "rotate-90" : ""}`,
4187
- children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: B, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4187
+ children: p && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { onClick: _, type: "button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleRightIcon, {}) })
4188
4188
  }
4189
4189
  ),
4190
4190
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4191
4191
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: j == null ? void 0 : j._type }) }),
4192
- v ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4192
+ S ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4193
4193
  "div",
4194
4194
  {
4195
4195
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
4196
- onDoubleClick: (f) => {
4197
- f.stopPropagation(), o.edit(), o.deselect();
4196
+ onDoubleClick: (m) => {
4197
+ m.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((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
4210
+ !i.includes(x) && a.map((m) => /* @__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(f.item, { blockId: x })
4216
+ children: React__default.createElement(m.item, { blockId: x })
4217
4217
  }
4218
4218
  ),
4219
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: f.tooltip })
4219
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { className: "isolate z-10", children: m.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: (f) => {
4238
- f.stopPropagation(), c(x), o.isOpen && o.toggle();
4237
+ onClick: (m) => {
4238
+ m.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, m, g, x, j, E, b;
4580
+ var u, p, g, f, x, j, E, b;
4581
4581
  if (r.type === "comment")
4582
4582
  return [];
4583
4583
  let a = { _id: generateUUID() };
@@ -4594,7 +4594,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4594
4594
  ...getAttrs(r),
4595
4595
  ...getStyles(r)
4596
4596
  }, r.attributes) {
4597
- const k = r.attributes.find((v) => includes(NAME_ATTRIBUTES, v.key));
4597
+ const k = r.attributes.find((S) => includes(NAME_ATTRIBUTES, S.key));
4598
4598
  k && (a._name = k.value);
4599
4599
  }
4600
4600
  if (i)
@@ -4612,14 +4612,14 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4612
4612
  ];
4613
4613
  a = {
4614
4614
  ...a,
4615
- href: ((u = l.find((v) => v.key === "href")) == null ? void 0 : u.value) || "",
4616
- hrefType: ((p = l.find((v) => v.key === "data-vbtype")) == null ? void 0 : p.value) || "video",
4617
- autoplay: ((m = l.find((v) => v.key === "data-autoplay")) == null ? void 0 : m.value) === "true",
4618
- maxWidth: ((x = (g = l.find((v) => v.key === "data-maxwidth")) == null ? void 0 : g.value) == null ? void 0 : x.replace("px", "")) || "",
4619
- backdropColor: ((j = l.find((v) => v.key === "data-overlay")) == null ? void 0 : j.value) || "",
4620
- galleryName: ((E = l.find((v) => v.key === "data-gall")) == null ? void 0 : E.value) || ""
4621
- }, forEach(k, (v) => {
4622
- has(a, `styles_attrs.${v}`) && delete a.styles_attrs[v];
4615
+ href: ((u = l.find((S) => S.key === "href")) == null ? void 0 : u.value) || "",
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", "")) || "",
4619
+ backdropColor: ((j = l.find((S) => S.key === "data-overlay")) == null ? void 0 : j.value) || "",
4620
+ galleryName: ((E = l.find((S) => S.key === "data-gall")) == null ? void 0 : E.value) || ""
4621
+ }, forEach(k, (S) => {
4622
+ has(a, `styles_attrs.${S}`) && delete a.styles_attrs[S];
4623
4623
  });
4624
4624
  }
4625
4625
  if (a._type === "Input") {
@@ -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" }), v = find(r.attributes, { key: "width" }), C = get(k, "value") ? `[${get(k, "value")}px]` : "24px", B = get(v, "value") ? `[${get(v, "value")}px]` : "24px", R = get(find(r.attributes, { key: "class" }), "value", "w-full h-full");
4633
- return a.styles = `${STYLES_KEY}, ${cn(`w-${B} h-${C}`, R)}`.trim(), r.attributes = filter(r.attributes, (_) => !includes(["style", "width", "height", "class"], _.key)), a.icon = stringify([r]), [a];
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];
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: m
4694
+ clickToExpandNode: g
4695
4695
  } = o;
4696
- const g = useRef(!1), [x, j, E] = useBool(() => p(d, r, n));
4696
+ const f = useRef(!1), [x, j, E] = useBool(() => p(d, r, n));
4697
4697
  useEffect(() => {
4698
- g.current ? E(p(d, r, n)) : g.current = !0;
4698
+ f.current ? E(p(d, r, n)) : f.current = !0;
4699
4699
  }, [p]);
4700
- const b = x ? u.collapseIcon : u.expandIcon, k = x ? "collapse JSON" : "expand JSON", v = useComponentId(), C = d + 1, B = a.length - 1, R = (_) => {
4701
- _.key === " " && (_.preventDefault(), j());
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());
4702
4702
  };
4703
4703
  return /* @__PURE__ */ createElement("div", {
4704
4704
  className: u.basicChildStyle,
@@ -4711,8 +4711,8 @@ function ExpandableObject(o) {
4711
4711
  tabIndex: 0,
4712
4712
  "aria-label": k,
4713
4713
  "aria-expanded": x,
4714
- "aria-controls": x ? v : void 0
4715
- }), n && (m ? /* @__PURE__ */ createElement("span", {
4714
+ "aria-controls": x ? S : void 0
4715
+ }), n && (g ? /* @__PURE__ */ createElement("span", {
4716
4716
  className: u.clickableLabel,
4717
4717
  onClick: j,
4718
4718
  onKeyDown: R,
@@ -4723,16 +4723,16 @@ function ExpandableObject(o) {
4723
4723
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4724
4724
  className: u.punctuation
4725
4725
  }, i), x ? /* @__PURE__ */ createElement("div", {
4726
- id: v
4727
- }, a.map((_, N) => /* @__PURE__ */ createElement(DataRender, {
4728
- key: _[0] || N,
4729
- field: _[0],
4730
- value: _[1],
4726
+ id: S
4727
+ }, a.map((A, T) => /* @__PURE__ */ createElement(DataRender, {
4728
+ key: A[0] || T,
4729
+ field: A[0],
4730
+ value: A[1],
4731
4731
  style: u,
4732
- lastElement: N === B,
4733
- level: C,
4732
+ lastElement: T === _,
4733
+ level: w,
4734
4734
  shouldExpandNode: p,
4735
- clickToExpandNode: m
4735
+ clickToExpandNode: g
4736
4736
  }))) : /* @__PURE__ */ createElement("span", {
4737
4737
  className: u.collapsedContent,
4738
4738
  onClick: j,
@@ -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) : {}, m = o === "PROP", [g, 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) : {}, g = o === "PROP", [f, 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: g, onOpenChange: x, children: [
4905
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { open: f, 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
- 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) }),
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) }),
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 ${m ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4932
+ className: `cursor-pointer ${g ? "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
- 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) }) })
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) }) })
4942
4942
  ]
4943
4943
  },
4944
4944
  E
@@ -4947,7 +4947,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4947
4947
  ] }) })
4948
4948
  ] })
4949
4949
  ] }),
4950
- !m && !isEmpty(n) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, n, ""), fullView: !0 }) })
4950
+ !g && !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(), m = useCallback(
4958
+ const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = 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
- ), [g, x] = useState(r ? m(a.key, "PROP") : "");
4971
+ ), [f, x] = useState(r ? g(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 = m(j, "PROP");
4988
- i(j), g !== E && d(""), x(E);
4987
+ const E = g(j, "PROP");
4988
+ i(j), f !== E && d(""), x(E);
4989
4989
  },
4990
4990
  data: u,
4991
- dataType: g,
4991
+ dataType: f,
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 = m(j, "PATH");
5006
- d(g === E ? j : "");
5005
+ const E = g(j, "PATH");
5006
+ d(f === E ? j : "");
5007
5007
  },
5008
5008
  data: p,
5009
- dataType: g,
5009
+ dataType: f,
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, m) => {
5049
+ const [c, d] = useState("string"), u = (p, g) => {
5050
5050
  if (isEmpty(p))
5051
5051
  return "";
5052
5052
  {
5053
- const g = get(m === "PROP" ? a : l, p, "");
5054
- if (isArray$1(g))
5053
+ const f = get(g === "PROP" ? a : l, p, "");
5054
+ if (isArray$1(f))
5055
5055
  return "list";
5056
- const x = typeof g;
5056
+ const x = typeof f;
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, (g, x) => ({ key: x, value: g }))
5078
+ map(o, (f, x) => ({ key: x, value: f }))
5079
5079
  );
5080
5080
  useEffect(() => {
5081
- c(map(o, (g, x) => ({ key: x, value: g })));
5081
+ c(map(o, (f, x) => ({ key: x, value: f })));
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 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)) {
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)) {
5099
5099
  n({});
5100
5100
  return;
5101
5101
  }
5102
5102
  const x = {};
5103
- forEach(g, (j) => {
5103
+ forEach(f, (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, (g, x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5114
+ map(i, (f, x) => /* @__PURE__ */ jsxRuntimeExports.jsx(
5115
5115
  NewDataBindingPair,
5116
5116
  {
5117
- item: g,
5117
+ item: f,
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
- g.key
5124
+ f.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-nDgC7Fr9.js")), UploadImages = React__default.lazy(() => import("./UploadImages-9KvJB0jW.js")), ImagesPanel = ({
5213
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-HB4yl97_.js")), UploadImages = React__default.lazy(() => import("./UploadImages--hbSU70S.js")), ImagesPanel = ({
5214
5214
  isModalView: o = !1,
5215
5215
  onSelect: n = () => {
5216
5216
  }
@@ -5304,79 +5304,112 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5304
5304
  collections: n,
5305
5305
  onChange: r
5306
5306
  }) => {
5307
- var k;
5308
- const { t: a } = useTranslation(), l = useBuilderProp("searchCollectionItems", (v, C) => []), [i, c] = useState(""), [d, u] = useState("pages"), [p, m] = useState(""), [g, x] = useState([]), j = (k = n == null ? void 0 : n.find((v) => v.key === d)) == null ? void 0 : k.name;
5307
+ var D;
5308
+ console.log(o, "formData");
5309
+ 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;
5309
5310
  useEffect(() => {
5310
- const v = split((o == null ? void 0 : o.href) || "", ":"), C = get(v, 1, "pages") || "pages";
5311
- u(C), m(""), x([]), (async () => {
5311
+ const m = split((o == null ? void 0 : o.href) || "", ":"), v = get(m, 1, "pages") || "pages";
5312
+ g(v), x(""), E([]), k(-1), (async () => {
5312
5313
  c("FETCHING_INIT_VALUE");
5313
- const B = await l(C, [get(v, 2, "pages")]);
5314
- B && Array.isArray(B) && m(get(B, [0, "name"], "")), c("");
5314
+ const C = await l(v, [get(m, 2, "pages")]);
5315
+ C && Array.isArray(C) && x(get(C, [0, "name"], "")), c("");
5315
5316
  })();
5316
- }, [o.href]);
5317
- const E = useCallback(
5318
- debounce(async (v) => {
5319
- if (isEmpty(v))
5320
- x([]);
5317
+ }, [o == null ? void 0 : o.href]);
5318
+ const _ = useCallback(
5319
+ debounce(async (m) => {
5320
+ if (isEmpty(m))
5321
+ E([]);
5321
5322
  else {
5322
- const C = await l(d, v);
5323
- x(C);
5323
+ const v = await l(p, m);
5324
+ E(v);
5324
5325
  }
5325
- c("");
5326
+ c(""), k(-1);
5326
5327
  }, 300),
5327
- [d]
5328
- ), b = (v) => {
5329
- const C = ["collection", d, v.id];
5330
- C[1] && r({ ...o, href: C.join(":") });
5328
+ [p]
5329
+ ), R = (m) => {
5330
+ const v = ["collection", p, m.id];
5331
+ v[1] && (r({ ...o, href: v.join(":") }), u(!1));
5332
+ }, A = (m) => {
5333
+ switch (m.key) {
5334
+ case "ArrowDown":
5335
+ m.preventDefault(), k((v) => v < j.length - 1 ? v + 1 : v);
5336
+ break;
5337
+ case "ArrowUp":
5338
+ m.preventDefault(), k((v) => v > 0 ? v - 1 : v);
5339
+ break;
5340
+ case "Enter":
5341
+ if (m.preventDefault(), j.length === 0)
5342
+ return;
5343
+ b >= 0 && R(j[b]);
5344
+ break;
5345
+ case "Escape":
5346
+ m.preventDefault(), T();
5347
+ break;
5348
+ }
5349
+ };
5350
+ useEffect(() => {
5351
+ if (b >= 0 && S.current) {
5352
+ const m = S.current.children[b];
5353
+ m == null || m.scrollIntoView({ block: "nearest" });
5354
+ }
5355
+ }, [b]);
5356
+ const T = () => {
5357
+ x(""), E([]), k(-1), u(!1), r({ ...o, href: "" });
5358
+ }, L = (m) => {
5359
+ x(m), u(!isEmpty(m)), c("FETCHING_COLLECTION_ITEMS"), _(m);
5331
5360
  };
5332
5361
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5333
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "collection", value: d, onChange: (v) => u(v.target.value), children: map(n, (v) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: v.key, children: v.name }, v.key)) }),
5334
- d && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
5362
+ /* @__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)) }),
5363
+ p && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group relative mt-2 flex items-center", children: [
5335
5364
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5336
5365
  "input",
5337
5366
  {
5338
5367
  type: "text",
5339
- value: p,
5340
- onChange: (v) => {
5341
- m(v.target.value), c("FETCHING_COLLECTION_ITEMS"), E(v.target.value);
5342
- },
5343
- placeholder: a(`Search ${j}`),
5368
+ value: f,
5369
+ onChange: (m) => L(m.target.value),
5370
+ onKeyDown: A,
5371
+ placeholder: a(`Search ${w}`),
5344
5372
  disabled: i === "FETCHING_INIT_VALUE",
5345
- className: "w-full rounded-md border border-gray-300 p-2"
5373
+ className: "w-full rounded-md border border-gray-300 p-2 pr-16"
5346
5374
  }
5347
5375
  ),
5348
- /* @__PURE__ */ jsxRuntimeExports.jsx(SearchIcon, { className: "absolute right-2 top-2 hidden h-5 w-5 pt-0.5 text-gray-400 group-hover:block" })
5376
+ /* @__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" }) }) })
5349
5377
  ] }),
5350
- i === "FETCHING_COLLECTION_ITEMS" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1 pt-2", children: [
5378
+ (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: [
5351
5379
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
5352
5380
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
5353
- ] }) : !isEmpty(g) && /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "mt-2 max-h-40 overflow-y-auto rounded-md border border-gray-300", children: map(g == null ? void 0 : g.slice(0, 20), (v) => {
5381
+ ] }) : d && isEmpty(j) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center p-4 text-sm text-gray-500", children: [
5382
+ a("No results found for"),
5383
+ ' "',
5384
+ f,
5385
+ '"'
5386
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { ref: S, children: map(j == null ? void 0 : j.slice(0, 20), (m, v) => {
5354
5387
  var C;
5355
5388
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
5356
5389
  "li",
5357
5390
  {
5358
- onClick: () => b(v),
5359
- className: `cursor-pointer p-2 text-xs ${(C = o == null ? void 0 : o.href) != null && C.includes(v.id) ? "bg-blue-200" : "hover:bg-gray-100"}`,
5391
+ onClick: () => R(m),
5392
+ 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"}`,
5360
5393
  children: [
5361
- v.name,
5394
+ m.name,
5362
5395
  " ",
5363
- v.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
5396
+ m.slug && /* @__PURE__ */ jsxRuntimeExports.jsxs("small", { className: "font-light text-gray-500", children: [
5364
5397
  "( ",
5365
- v.slug,
5398
+ m.slug,
5366
5399
  " )"
5367
5400
  ] })
5368
5401
  ]
5369
5402
  },
5370
- v.id
5403
+ m.id
5371
5404
  );
5372
- }) })
5405
+ }) }) })
5373
5406
  ] });
5374
5407
  }, LinkField = ({ schema: o, formData: n, onChange: r }) => {
5375
- const { t: a } = useTranslation(), { type: l = "page", href: i = "#", target: c = "self" } = n, d = useBuilderProp("collections", []);
5408
+ const { t: a } = useTranslation(), { type: l = "collection", href: i = "", target: c = "self" } = n, d = useBuilderProp("collections", []), u = l === "collection" && isEmpty(d) ? "url" : l;
5376
5409
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
5377
5410
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium", children: (o == null ? void 0 : o.title) ?? "Link" }),
5378
5411
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-y-1.5", children: [
5379
- /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (u) => r({ ...n, type: u.target.value }), children: map(
5412
+ /* @__PURE__ */ jsxRuntimeExports.jsx("select", { name: "type", value: l, onChange: (p) => r({ ...n, type: p.target.value }), children: map(
5380
5413
  [
5381
5414
  ...isEmpty(d) ? [] : [{ const: "collection", title: a("Goto Page") }],
5382
5415
  { const: "url", title: a("Open URL") },
@@ -5384,9 +5417,9 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5384
5417
  { const: "telephone", title: a("Call Phone") },
5385
5418
  { const: "scroll", title: a("Scroll to element") }
5386
5419
  ],
5387
- (u) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: u.const, children: u.title }, u.const)
5420
+ (p) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: p.const, children: p.title }, p.const)
5388
5421
  ) }),
5389
- l === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionField, { formData: n, collections: d, onChange: r }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
5422
+ u === "collection" && !isEmpty(d) ? /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionField, { formData: n, collections: d, onChange: r }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
5390
5423
  "input",
5391
5424
  {
5392
5425
  autoCapitalize: "off",
@@ -5395,13 +5428,13 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5395
5428
  name: "href",
5396
5429
  type: "text",
5397
5430
  value: i,
5398
- onChange: (u) => r({ ...n, href: u.target.value }),
5431
+ onChange: (p) => r({ ...n, href: p.target.value }),
5399
5432
  placeholder: a(
5400
5433
  l === "page" || l === "url" ? "Enter URL" : l === "scroll" ? "#ElementID" : "Enter details"
5401
5434
  )
5402
5435
  }
5403
5436
  ),
5404
- l === "url" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5437
+ u === "url" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5405
5438
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5406
5439
  "input",
5407
5440
  {
@@ -5438,7 +5471,7 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5438
5471
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { onClick: d, size: "sm", variant: "outline", className: "w-fit", children: r("Open code editor") })
5439
5472
  ] });
5440
5473
  }, JSONForm = memo(({ id: o, properties: n, formData: r, onChange: a }) => {
5441
- 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
+ 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;
5442
5475
  Object.keys(n).forEach((E) => {
5443
5476
  const b = n[E];
5444
5477
  if (includes(["slot", "styles"], b.type))
@@ -5547,28 +5580,28 @@ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onC
5547
5580
  }), a;
5548
5581
  };
5549
5582
  function BlockSettings() {
5550
- const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: b }, k, v) => {
5583
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: b }, k, S) => {
5551
5584
  if (k && (c == null ? void 0 : c._id) === n._id) {
5552
- const C = k.replace("root.", "");
5553
- a([n._id], { [C]: get(b, C) }, v);
5585
+ const w = k.replace("root.", "");
5586
+ a([n._id], { [w]: get(b, w) }, S);
5554
5587
  }
5555
- }, m = useCallback(
5556
- debounce(({ formData: b }, k, v) => {
5557
- p({ formData: b }, k, v), d(b);
5588
+ }, g = useCallback(
5589
+ debounce(({ formData: b }, k, S) => {
5590
+ p({ formData: b }, k, S), d(b);
5558
5591
  }, 1500),
5559
5592
  [n == null ? void 0 : n._id, o]
5560
- ), g = ({ formData: b }, k) => {
5593
+ ), f = ({ formData: b }, k) => {
5561
5594
  if (k) {
5562
- const v = k.replace("root.", "");
5595
+ const S = k.replace("root.", "");
5563
5596
  r(
5564
5597
  [n._id],
5565
- convertDotNotationToObject(v, get(b, v.split(".")))
5566
- ), m({ formData: b }, k, { [v]: get(c, v) });
5598
+ convertDotNotationToObject(S, get(b, S.split(".")))
5599
+ ), g({ formData: b }, k, { [S]: get(c, S) });
5567
5600
  }
5568
5601
  }, x = keys(get(i, "_bindings", {})), j = useMemo(() => {
5569
5602
  const b = cloneDeep(get(l, "props", {}));
5570
- return each(b, (k, v) => {
5571
- get(k, "hidden", !1) && delete b[v];
5603
+ return each(b, (k, S) => {
5604
+ get(k, "hidden", !1) && delete b[S];
5572
5605
  }), u && each(x, (k) => delete b[k]), b;
5573
5606
  }, [l, x, u]), E = get(l, "server", !1);
5574
5607
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
@@ -5610,7 +5643,7 @@ function BlockSettings() {
5610
5643
  JSONForm,
5611
5644
  {
5612
5645
  id: n == null ? void 0 : n._id,
5613
- onChange: g,
5646
+ onChange: f,
5614
5647
  formData: i,
5615
5648
  properties: j
5616
5649
  }
@@ -5621,7 +5654,7 @@ function BlockSettings() {
5621
5654
  JSONForm,
5622
5655
  {
5623
5656
  id: n == null ? void 0 : n._id,
5624
- onChange: g,
5657
+ onChange: f,
5625
5658
  formData: i,
5626
5659
  properties: j
5627
5660
  }
@@ -5651,21 +5684,21 @@ function promptWithLanguage(o, n, r) {
5651
5684
  ${a}`;
5652
5685
  }
5653
5686
  const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5654
- 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
+ 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;
5655
5688
  return {
5656
5689
  askAi: useCallback(
5657
- async (g, x, j, E) => {
5690
+ async (f, x, j, E) => {
5658
5691
  if (l) {
5659
5692
  n(!0), a(null);
5660
5693
  try {
5661
- const b = g === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((R) => R._id === x))];
5694
+ const b = f === "content" ? cloneDeep(getBlockWithChildren(x, d)) : [cloneDeep(d.find((R) => R._id === x))];
5662
5695
  set(b, "0._parent", null);
5663
- const k = u === p ? "" : u, v = await l(g, promptWithLanguage(j, m, g), b, k), { blocks: C, error: B } = v;
5664
- if (B) {
5665
- a(B);
5696
+ const k = u === p ? "" : u, S = await l(f, promptWithLanguage(j, g, f), b, k), { blocks: w, error: _ } = S;
5697
+ if (_) {
5698
+ a(_);
5666
5699
  return;
5667
5700
  }
5668
- g === "styles" ? c(C) : i(C), E && E(v);
5701
+ f === "styles" ? c(w) : i(w), E && E(S);
5669
5702
  } catch (b) {
5670
5703
  a(b);
5671
5704
  } finally {
@@ -5679,7 +5712,7 @@ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5679
5712
  d,
5680
5713
  u,
5681
5714
  p,
5682
- m,
5715
+ g,
5683
5716
  c,
5684
5717
  i
5685
5718
  ]
@@ -5753,14 +5786,14 @@ function Countdown() {
5753
5786
  ] });
5754
5787
  }
5755
5788
  const AskAIStyles = ({ blockId: o }) => {
5756
- const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, m] = useState();
5789
+ const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), d = useRef(null), u = useRef(null), [p, g] = useState();
5757
5790
  useEffect(() => {
5758
5791
  var x;
5759
5792
  (x = d.current) == null || x.focus();
5760
5793
  }, []);
5761
- const g = (x) => {
5794
+ const f = (x) => {
5762
5795
  const { usage: j } = x || {};
5763
- !l && j && m(j), u.current = setTimeout(() => m(void 0), 1e4), l || c("");
5796
+ !l && j && g(j), u.current = setTimeout(() => g(void 0), 1e4), l || c("");
5764
5797
  };
5765
5798
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
5766
5799
  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "mb-1 text-sm font-semibold leading-none tracking-tight", children: n("Ask AI") }),
@@ -5774,7 +5807,7 @@ const AskAIStyles = ({ blockId: o }) => {
5774
5807
  className: "w-full border border-border focus:border-0",
5775
5808
  rows: 3,
5776
5809
  onKeyDown: (x) => {
5777
- x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g));
5810
+ x.key === "Enter" && (x.preventDefault(), u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, f));
5778
5811
  }
5779
5812
  }
5780
5813
  ),
@@ -5784,7 +5817,7 @@ const AskAIStyles = ({ blockId: o }) => {
5784
5817
  {
5785
5818
  disabled: i.trim().length < 5 || a,
5786
5819
  onClick: () => {
5787
- u.current && clearTimeout(u.current), m(void 0), r("styles", o, i, g);
5820
+ u.current && clearTimeout(u.current), g(void 0), r("styles", o, i, f);
5788
5821
  },
5789
5822
  variant: "default",
5790
5823
  className: "w-fit",
@@ -5820,35 +5853,35 @@ const AskAIStyles = ({ blockId: o }) => {
5820
5853
  keys: ["name"]
5821
5854
  });
5822
5855
  function ManualClasses() {
5823
- var _;
5824
- const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), m = (_ = first(n)) == null ? void 0 : _.prop, g = reject((get(r, m, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), x = () => {
5825
- const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5826
- a(i, N, !0), u("");
5827
- }, [j, E] = useState([]), b = ({ value: N }) => {
5828
- const L = N.trim().toLowerCase(), P = L.match(/.+:/g);
5829
- let f = [];
5830
- if (P && P.length > 0) {
5831
- const [S] = P, w = L.replace(S, "");
5832
- f = fuse.search(w).map((I) => ({
5856
+ var A;
5857
+ 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 = () => {
5858
+ const T = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5859
+ a(i, T, !0), u("");
5860
+ }, [j, E] = useState([]), b = ({ value: T }) => {
5861
+ const L = T.trim().toLowerCase(), D = L.match(/.+:/g);
5862
+ let m = [];
5863
+ if (D && D.length > 0) {
5864
+ const [v] = D, C = L.replace(v, "");
5865
+ m = fuse.search(C).map((I) => ({
5833
5866
  ...I,
5834
- item: { ...I.item, name: S + I.item.name }
5867
+ item: { ...I.item, name: v + I.item.name }
5835
5868
  }));
5836
5869
  } else
5837
- f = fuse.search(L);
5838
- return E(map(f, "item"));
5870
+ m = fuse.search(L);
5871
+ return E(map(m, "item"));
5839
5872
  }, k = () => {
5840
5873
  E([]);
5841
- }, v = (N) => N.name, C = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5874
+ }, S = (T) => T.name, w = (T) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: T.name }), _ = {
5842
5875
  autoComplete: "off",
5843
5876
  autoCorrect: "off",
5844
5877
  autoCapitalize: "off",
5845
5878
  spellCheck: !1,
5846
5879
  placeholder: o("Enter classes separated by space"),
5847
5880
  value: d,
5848
- onKeyDown: (N) => {
5849
- N.key === "Enter" && d.trim() !== "" && x();
5881
+ onKeyDown: (T) => {
5882
+ T.key === "Enter" && d.trim() !== "" && x();
5850
5883
  },
5851
- onChange: (N, { newValue: L }) => u(L),
5884
+ onChange: (T, { newValue: L }) => u(L),
5852
5885
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5853
5886
  }, R = () => {
5854
5887
  if (navigator.clipboard === void 0) {
@@ -5859,7 +5892,7 @@ function ManualClasses() {
5859
5892
  });
5860
5893
  return;
5861
5894
  }
5862
- navigator.clipboard.writeText(g.join(" ")), p({
5895
+ navigator.clipboard.writeText(f.join(" ")), p({
5863
5896
  title: o("Copied"),
5864
5897
  description: o("Classes copied to clipboard")
5865
5898
  });
@@ -5892,9 +5925,9 @@ function ManualClasses() {
5892
5925
  suggestions: j,
5893
5926
  onSuggestionsFetchRequested: b,
5894
5927
  onSuggestionsClearRequested: k,
5895
- getSuggestionValue: v,
5896
- renderSuggestion: C,
5897
- inputProps: B,
5928
+ getSuggestionValue: S,
5929
+ renderSuggestion: w,
5930
+ inputProps: _,
5898
5931
  containerProps: {
5899
5932
  className: "relative h-8 w-full gap-y-1 py-1 border-border"
5900
5933
  },
@@ -5918,22 +5951,22 @@ function ManualClasses() {
5918
5951
  )
5919
5952
  ] }),
5920
5953
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-wrap gap-2 overflow-x-hidden", children: React.Children.toArray(
5921
- g.map((N) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5954
+ f.map((T) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
5922
5955
  "div",
5923
5956
  {
5924
5957
  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",
5925
5958
  children: [
5926
- N,
5959
+ T,
5927
5960
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5928
5961
  Cross2Icon,
5929
5962
  {
5930
- onClick: () => l(i, [N]),
5963
+ onClick: () => l(i, [T]),
5931
5964
  className: "invisible absolute right-1 rounded-full bg-red-400 hover:text-white group-hover:visible group-hover:cursor-pointer"
5932
5965
  }
5933
5966
  )
5934
5967
  ]
5935
5968
  },
5936
- N
5969
+ T
5937
5970
  ))
5938
5971
  ) })
5939
5972
  ]
@@ -6324,7 +6357,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6324
6357
  ringColor: "ring",
6325
6358
  ringOffsetColor: "ring-offset"
6326
6359
  }, ColorChoice = ({ property: o, onChange: n }) => {
6327
- 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
+ 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(
6328
6361
  // eslint-disable-next-line no-shadow
6329
6362
  (E) => {
6330
6363
  ["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" })));
@@ -6332,16 +6365,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6332
6365
  [c, u]
6333
6366
  );
6334
6367
  useEffect(() => {
6335
- if (["current", "inherit", "transparent", "black", "white"].includes(m))
6368
+ if (["current", "inherit", "transparent", "black", "white"].includes(g))
6336
6369
  return c([]);
6337
6370
  c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]);
6338
- }, [m]);
6371
+ }, [g]);
6339
6372
  const j = useCallback(
6340
6373
  // eslint-disable-next-line no-shadow
6341
6374
  (E) => {
6342
- u({ color: m, shade: E });
6375
+ u({ color: g, shade: E });
6343
6376
  },
6344
- [m]
6377
+ [g]
6345
6378
  );
6346
6379
  return useEffect(() => {
6347
6380
  u({ color: "", shade: "" });
@@ -6354,7 +6387,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6354
6387
  {
6355
6388
  disabled: !l,
6356
6389
  rounded: !0,
6357
- selected: m,
6390
+ selected: g,
6358
6391
  onChange: x,
6359
6392
  options: [
6360
6393
  "current",
@@ -6388,7 +6421,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6388
6421
  ]
6389
6422
  }
6390
6423
  ) }),
6391
- /* @__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
+ /* @__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 }) })
6392
6425
  ] });
6393
6426
  }, getUserInputValues = (o, n) => {
6394
6427
  o = o.toLowerCase();
@@ -6583,88 +6616,88 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6583
6616
  },
6584
6617
  a
6585
6618
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6586
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: m } = o, [g, x] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [j, E] = useState(!1), [b, k] = useState(""), [v, C] = useState(!1), [B, R] = useState(!1);
6619
+ 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);
6587
6620
  useEffect(() => {
6588
- const { value: f, unit: S } = getClassValueAndUnit(i);
6589
- if (S === "") {
6590
- l(f), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6621
+ const { value: m, unit: v } = getClassValueAndUnit(i);
6622
+ if (v === "") {
6623
+ l(m), x(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6591
6624
  return;
6592
6625
  }
6593
- x(S), l(S === "class" || isEmpty(f) ? "" : f);
6626
+ x(v), l(v === "class" || isEmpty(m) ? "" : m);
6594
6627
  }, [i, u, p]);
6595
- const _ = useThrottledCallback((f) => c(f), [c], THROTTLE_TIME), N = useThrottledCallback((f) => c(f, !1), [c], THROTTLE_TIME), L = useCallback(
6596
- (f = !1) => {
6597
- const S = getUserInputValues(`${a}`, p);
6598
- if (get(S, "error", !1)) {
6628
+ const A = useThrottledCallback((m) => c(m), [c], THROTTLE_TIME), T = useThrottledCallback((m) => c(m, !1), [c], THROTTLE_TIME), L = useCallback(
6629
+ (m = !1) => {
6630
+ const v = getUserInputValues(`${a}`, p);
6631
+ if (get(v, "error", !1)) {
6599
6632
  E(!0);
6600
6633
  return;
6601
6634
  }
6602
- const w = get(S, "unit") !== "" ? get(S, "unit") : g;
6603
- if (w === "auto" || w === "none") {
6604
- _(`${d}${w}`);
6635
+ const C = get(v, "unit") !== "" ? get(v, "unit") : f;
6636
+ if (C === "auto" || C === "none") {
6637
+ A(`${d}${C}`);
6605
6638
  return;
6606
6639
  }
6607
- if (get(S, "value") === "")
6640
+ if (get(v, "value") === "")
6608
6641
  return;
6609
- const I = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6610
- f ? N(I) : _(I);
6642
+ const I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6643
+ m ? T(I) : A(I);
6611
6644
  },
6612
- [_, N, a, g, d, p]
6613
- ), P = useCallback(
6614
- (f) => {
6615
- const S = getUserInputValues(`${a}`, p);
6616
- if (get(S, "error", !1)) {
6645
+ [A, T, a, f, d, p]
6646
+ ), D = useCallback(
6647
+ (m) => {
6648
+ const v = getUserInputValues(`${a}`, p);
6649
+ if (get(v, "error", !1)) {
6617
6650
  E(!0);
6618
6651
  return;
6619
6652
  }
6620
- if (f === "auto" || f === "none") {
6621
- _(`${d}${f}`);
6653
+ if (m === "auto" || m === "none") {
6654
+ A(`${d}${m}`);
6622
6655
  return;
6623
6656
  }
6624
- if (get(S, "value") === "")
6657
+ if (get(v, "value") === "")
6625
6658
  return;
6626
- const w = get(S, "unit") !== "" ? get(S, "unit") : f, I = `${get(S, "value", "").startsWith("-") ? "-" : ""}${d}[${get(S, "value", "").replace("-", "")}${w === "-" ? "" : w}]`;
6627
- _(I);
6659
+ const C = get(v, "unit") !== "" ? get(v, "unit") : m, I = `${get(v, "value", "").startsWith("-") ? "-" : ""}${d}[${get(v, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6660
+ A(I);
6628
6661
  },
6629
- [_, a, d, p]
6662
+ [A, a, d, p]
6630
6663
  );
6631
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: g === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6664
+ 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: [
6632
6665
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
6633
6666
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
6634
6667
  /* @__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, {}) }) }),
6635
6668
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6636
6669
  ] })
6637
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
6670
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${S ? "z-auto" : ""}`, children: [
6638
6671
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6639
- ["none", "auto"].indexOf(g) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6672
+ ["none", "auto"].indexOf(f) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6640
6673
  "input",
6641
6674
  {
6642
- readOnly: g === "class",
6643
- onKeyPress: (f) => {
6644
- f.key === "Enter" && L();
6675
+ readOnly: f === "class",
6676
+ onKeyPress: (m) => {
6677
+ m.key === "Enter" && L();
6645
6678
  },
6646
- onKeyDown: (f) => {
6647
- if (f.keyCode !== 38 && f.keyCode !== 40)
6679
+ onKeyDown: (m) => {
6680
+ if (m.keyCode !== 38 && m.keyCode !== 40)
6648
6681
  return;
6649
- f.preventDefault(), R(!0);
6650
- const S = parseInt$1(f.target.value);
6651
- let w = isNaN$1(S) ? 0 : S;
6652
- f.keyCode === 38 && (w += 1), f.keyCode === 40 && (w -= 1);
6653
- const A = `${w}`, T = `${A.startsWith("-") ? "-" : ""}${d}[${A.replace("-", "")}${g === "-" ? "" : g}]`;
6654
- N(T);
6682
+ m.preventDefault(), R(!0);
6683
+ const v = parseInt$1(m.target.value);
6684
+ let C = isNaN$1(v) ? 0 : v;
6685
+ m.keyCode === 38 && (C += 1), m.keyCode === 40 && (C -= 1);
6686
+ const B = `${C}`, N = `${B.startsWith("-") ? "-" : ""}${d}[${B.replace("-", "")}${f === "-" ? "" : f}]`;
6687
+ T(N);
6655
6688
  },
6656
- onKeyUp: (f) => {
6657
- B && (f.preventDefault(), R(!1));
6689
+ onKeyUp: (m) => {
6690
+ _ && (m.preventDefault(), R(!1));
6658
6691
  },
6659
6692
  onBlur: () => L(),
6660
- onChange: (f) => {
6661
- E(!1), l(f.target.value);
6693
+ onChange: (m) => {
6694
+ E(!1), l(m.target.value);
6662
6695
  },
6663
- onClick: (f) => {
6664
- var S;
6665
- (S = f == null ? void 0 : f.target) == null || S.select(), r(!1);
6696
+ onClick: (m) => {
6697
+ var v;
6698
+ (v = m == null ? void 0 : m.target) == null || v.select(), r(!1);
6666
6699
  },
6667
- value: v ? b : a,
6700
+ value: S ? b : a,
6668
6701
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6669
6702
  " ",
6670
6703
  j ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -6679,7 +6712,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6679
6712
  onClick: () => r(!n),
6680
6713
  className: "flex h-6 cursor-pointer items-center gap-x-1 rounded rounded-l-none bg-background p-px px-1 text-[11px] uppercase",
6681
6714
  children: [
6682
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: g }),
6715
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `inline-block ${p.length === 1 ? "px-2 font-semibold" : ""}`, children: f }),
6683
6716
  p.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleDownIcon, {}) : null
6684
6717
  ]
6685
6718
  }
@@ -6688,34 +6721,34 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6688
6721
  UnitSelection,
6689
6722
  {
6690
6723
  units: p,
6691
- current: g,
6692
- onSelect: (f) => {
6693
- r(!1), x(f), P(f);
6724
+ current: f,
6725
+ onSelect: (m) => {
6726
+ r(!1), x(m), D(m);
6694
6727
  }
6695
6728
  }
6696
6729
  ) }) })
6697
6730
  ] })
6698
6731
  ] }),
6699
- ["none", "auto"].indexOf(g) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6732
+ ["none", "auto"].indexOf(f) !== -1 || S ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6700
6733
  DragStyleButton,
6701
6734
  {
6702
- onDragStart: () => C(!0),
6703
- onDragEnd: (f) => {
6704
- if (k(() => ""), C(!1), isEmpty(f))
6735
+ onDragStart: () => w(!0),
6736
+ onDragEnd: (m) => {
6737
+ if (k(() => ""), w(!1), isEmpty(m))
6705
6738
  return;
6706
- const S = `${f}`, A = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${g === "-" ? "" : g}]`;
6707
- _(A);
6739
+ const v = `${m}`, B = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${f === "-" ? "" : f}]`;
6740
+ A(B);
6708
6741
  },
6709
- onDrag: (f) => {
6710
- if (isEmpty(f))
6742
+ onDrag: (m) => {
6743
+ if (isEmpty(m))
6711
6744
  return;
6712
- k(f);
6713
- const S = `${f}`, A = `${S.startsWith("-") ? "-" : ""}${d}[${S.replace("-", "")}${g === "-" ? "" : g}]`;
6714
- N(A);
6745
+ k(m);
6746
+ const v = `${m}`, B = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${f === "-" ? "" : f}]`;
6747
+ T(B);
6715
6748
  },
6716
6749
  currentValue: a,
6717
- unit: g,
6718
- negative: m,
6750
+ unit: f,
6751
+ negative: g,
6719
6752
  cssProperty: u
6720
6753
  }
6721
6754
  )
@@ -6808,41 +6841,41 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6808
6841
  "2xl": "1536px"
6809
6842
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6810
6843
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6811
- }, 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(
6812
- (N, L = !0) => {
6813
- const P = { dark: u, mq: m, mod: p, cls: N, property: l, fullCls: "" };
6814
- (u || p !== "") && (P.mq = "xs");
6815
- const f = generateFullClsName(P);
6816
- x(E, [f], L);
6844
+ }, 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(
6845
+ (T, L = !0) => {
6846
+ const D = { dark: u, mq: g, mod: p, cls: T, property: l, fullCls: "" };
6847
+ (u || p !== "") && (D.mq = "xs");
6848
+ const m = generateFullClsName(D);
6849
+ x(E, [m], L);
6817
6850
  },
6818
- [E, u, m, p, l, x]
6819
- ), v = useCallback(() => {
6851
+ [E, u, g, p, l, x]
6852
+ ), S = useCallback(() => {
6820
6853
  j(E, [b]);
6821
- }, [E, b, j]), C = useMemo(() => canChangeClass(g, m), [g, m]);
6854
+ }, [E, b, j]), w = useMemo(() => canChangeClass(f, g), [f, g]);
6822
6855
  useEffect(() => {
6823
- i(C, g);
6824
- }, [C, i, g]);
6825
- const [, , B] = useCanvasWidth(), R = useCallback(
6826
- (N) => {
6827
- B({
6856
+ i(w, f);
6857
+ }, [w, i, f]);
6858
+ const [, , _] = useCanvasWidth(), R = useCallback(
6859
+ (T) => {
6860
+ _({
6828
6861
  xs: 400,
6829
6862
  sm: 640,
6830
6863
  md: 800,
6831
6864
  lg: 1024,
6832
6865
  xl: 1420,
6833
6866
  "2xl": 1920
6834
- }[N]);
6867
+ }[T]);
6835
6868
  },
6836
- [B]
6837
- ), _ = get(g, "dark", null) === u && get(g, "mod", null) === p && get(g, "mq", null) === m;
6838
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: C, canReset: g && _, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6839
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${g && !_ ? "text-foreground" : ""}`, children: n(a) }) }),
6869
+ [_]
6870
+ ), A = get(f, "dark", null) === u && get(f, "mod", null) === p && get(f, "mq", null) === g;
6871
+ 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: [
6872
+ /* @__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) }) }),
6840
6873
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6841
6874
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6842
6875
  r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
6843
6876
  AdvanceChoices,
6844
6877
  {
6845
- currentClass: get(g, "cls", ""),
6878
+ currentClass: get(f, "cls", ""),
6846
6879
  classPrefix: get(CLASS_PREFIXES, l, ""),
6847
6880
  units: c || [],
6848
6881
  onChange: k,
@@ -6855,7 +6888,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6855
6888
  r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6856
6889
  r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6857
6890
  ] }),
6858
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${b ? "visible" : "invisible"}`, children: _ ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => v(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : C && g ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6891
+ /* @__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: [
6859
6892
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6860
6893
  "button",
6861
6894
  {
@@ -6867,19 +6900,19 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6867
6900
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-right", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
6868
6901
  "Current style is set at  ",
6869
6902
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-bold", children: [
6870
- getBreakpoint(get(g, "mq")),
6871
- u && !g.dark ? "(Light mode)" : ""
6903
+ getBreakpoint(get(f, "mq")),
6904
+ u && !f.dark ? "(Light mode)" : ""
6872
6905
  ] }),
6873
6906
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
6874
6907
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
6875
6908
  "button",
6876
6909
  {
6877
6910
  type: "button",
6878
- onClick: () => R(get(g, "mq")),
6911
+ onClick: () => R(get(f, "mq")),
6879
6912
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6880
6913
  children: [
6881
6914
  "Switch to ",
6882
- get(g, "mq").toUpperCase()
6915
+ get(f, "mq").toUpperCase()
6883
6916
  ]
6884
6917
  }
6885
6918
  )
@@ -6896,7 +6929,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6896
6929
  units: i = basicUnits,
6897
6930
  negative: c = !1
6898
6931
  }) => {
6899
- const { t: d } = useTranslation(), [u, p] = useState(n[0].key), m = useSelectedBlockCurrentClasses(), g = useCallback((x) => map(m, "property").includes(x), [m]);
6932
+ const { t: d } = useTranslation(), [u, p] = useState(n[0].key), g = useSelectedBlockCurrentClasses(), f = useCallback((x) => map(g, "property").includes(x), [g]);
6900
6933
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
6901
6934
  "div",
6902
6935
  {
@@ -6914,7 +6947,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6914
6947
  className: `relative cursor-pointer rounded-full p-1 text-[8px] ${j === u ? "bg-[#3E57F0] text-white" : "text-gray-600 dark:text-gray-300"}`,
6915
6948
  children: [
6916
6949
  React__default.createElement("div", {
6917
- className: g(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6950
+ className: f(j) ? "-bottom-1.5 absolute bg-[#3E57F0] h-[2px] left-0 w-full" : ""
6918
6951
  }),
6919
6952
  React__default.createElement(get(EDITOR_ICONS, j, BoxIcon), { className: "text-inherit w-3 h-3" })
6920
6953
  ]
@@ -6985,8 +7018,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6985
7018
  if (isEmpty(a) && (!has(i, "props") || isEmpty(d)))
6986
7019
  return null;
6987
7020
  const u = (p) => {
6988
- const m = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
6989
- l([o._id], m, !0);
7021
+ const g = p.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
7022
+ l([o._id], g, !0);
6990
7023
  };
6991
7024
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
6992
7025
  /* @__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: [
@@ -7040,13 +7073,13 @@ function BlockStyling() {
7040
7073
  cssProperty: ""
7041
7074
  }), d = useThrottledCallback(
7042
7075
  (p) => {
7043
- const m = !get(i, "negative", !1), g = get(i, "cssProperty", "");
7076
+ const g = !get(i, "negative", !1), f = get(i, "cssProperty", "");
7044
7077
  let x = parseFloat(i.dragStartValue);
7045
7078
  x = isNaN(x) ? 0 : x;
7046
7079
  let j = MAPPER[i.dragUnit];
7047
- (startsWith(g, "scale") || g === "opacity") && (j = 10);
7080
+ (startsWith(f, "scale") || f === "opacity") && (j = 10);
7048
7081
  let b = (i.dragStartY - p.pageY) / j + x;
7049
- m && b < 0 && (b = 0), g === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
7082
+ g && b < 0 && (b = 0), f === "opacity" && b > 1 && (b = 1), i.onDrag(`${b}`), l(`${b}`);
7050
7083
  },
7051
7084
  [i],
7052
7085
  50
@@ -7132,9 +7165,9 @@ const BlockCard = ({
7132
7165
  library: n,
7133
7166
  parentId: r = void 0
7134
7167
  }) => {
7135
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), { clearHighlight: p } = useBlockHighlight(), m = get(o, "name", get(o, "label")), g = useFeature("dnd"), [, x] = useAtom$1(draggedBlockAtom), j = (k) => {
7136
- const v = has(k, "styles_attrs.data-page-section");
7137
- return k._type === "Box" && v;
7168
+ 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) => {
7169
+ const S = has(k, "styles_attrs.data-page-section");
7170
+ return k._type === "Box" && S;
7138
7171
  }, E = useCallback(
7139
7172
  async (k) => {
7140
7173
  if (k.stopPropagation(), has(o, "component")) {
@@ -7142,23 +7175,23 @@ const BlockCard = ({
7142
7175
  return;
7143
7176
  }
7144
7177
  l(!0);
7145
- const v = await i(n, o);
7146
- isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7178
+ const S = await i(n, o);
7179
+ isEmpty(S) || d(syncBlocksWithDefaults(S), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7147
7180
  },
7148
7181
  [o]
7149
7182
  ), b = async (k) => {
7150
- const v = await i(n, o);
7151
- let C = r;
7152
- if (j(first(v)) && (C = null), !isEmpty(v)) {
7153
- const B = { blocks: v, uiLibrary: !0, parent: C };
7154
- if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
7183
+ const S = await i(n, o);
7184
+ let w = r;
7185
+ if (j(first(S)) && (w = null), !isEmpty(S)) {
7186
+ const _ = { blocks: S, uiLibrary: !0, parent: w };
7187
+ if (k.dataTransfer.setData("text/plain", JSON.stringify(_)), o.preview) {
7155
7188
  const R = new Image();
7156
7189
  R.src = o.preview, R.onload = () => {
7157
7190
  k.dataTransfer.setDragImage(R, 0, 0);
7158
7191
  };
7159
7192
  } else
7160
7193
  k.dataTransfer.setDragImage(new Image(), 0, 0);
7161
- x(B), setTimeout(() => {
7194
+ x(_), setTimeout(() => {
7162
7195
  u([]), p(), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
7163
7196
  }, 200);
7164
7197
  }
@@ -7169,7 +7202,7 @@ const BlockCard = ({
7169
7202
  {
7170
7203
  onClick: a ? () => {
7171
7204
  } : E,
7172
- draggable: g ? "true" : "false",
7205
+ draggable: f ? "true" : "false",
7173
7206
  onDragStart: b,
7174
7207
  className: clsx(
7175
7208
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
@@ -7179,11 +7212,11 @@ const BlockCard = ({
7179
7212
  /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { className: "animate-spin", size: 15, color: "white" }),
7180
7213
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "pl-2 text-sm text-white", children: "Adding..." })
7181
7214
  ] }),
7182
- 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
+ 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 }) })
7183
7216
  ]
7184
7217
  }
7185
7218
  ) }),
7186
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: m }) })
7219
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: g }) })
7187
7220
  ] });
7188
7221
  }, libraryBlocksAtom = atom$1(
7189
7222
  {}
@@ -7199,9 +7232,9 @@ const BlockCard = ({
7199
7232
  })();
7200
7233
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
7201
7234
  }, UILibrarySection = ({ parentId: o }) => {
7202
- const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((C) => C.category === "custom"), c = a.find((C) => C.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [m, g] = useState("Hero"), x = get(p, m, []), j = useRef(null), { t: E } = useTranslation(), b = (C) => {
7235
+ 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) => {
7203
7236
  j.current && (clearTimeout(j.current), j.current = null), j.current = setTimeout(() => {
7204
- j.current && g(C);
7237
+ j.current && f(w);
7205
7238
  }, 300);
7206
7239
  };
7207
7240
  if (u)
@@ -7209,7 +7242,7 @@ const BlockCard = ({
7209
7242
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7210
7243
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7211
7244
  ] });
7212
- const k = filter(x, (C, B) => B % 2 === 0), v = filter(x, (C, B) => B % 2 === 1);
7245
+ const k = filter(x, (w, _) => _ % 2 === 0), S = filter(x, (w, _) => _ % 2 === 1);
7213
7246
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative mt-2 flex h-full max-h-full overflow-hidden bg-background", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full pt-2", children: [
7214
7247
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7215
7248
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
@@ -7217,22 +7250,22 @@ const BlockCard = ({
7217
7250
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: E("Groups") }),
7218
7251
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7219
7252
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "no-scrollbar mt-2 h-full max-h-full flex-1 overflow-y-auto pb-20", children: React__default.Children.toArray(
7220
- map(p, (C, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7253
+ map(p, (w, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7221
7254
  "div",
7222
7255
  {
7223
- onMouseEnter: () => b(B),
7256
+ onMouseEnter: () => b(_),
7224
7257
  onMouseLeave: () => clearTimeout(j.current),
7225
- onClick: () => g(B),
7258
+ onClick: () => f(_),
7226
7259
  className: cn(
7227
7260
  "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",
7228
- B === m ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7261
+ _ === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7229
7262
  ),
7230
7263
  children: [
7231
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(B.toLowerCase())) }),
7264
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(E(_.toLowerCase())) }),
7232
7265
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7233
7266
  ]
7234
7267
  },
7235
- B
7268
+ _
7236
7269
  ))
7237
7270
  ) })
7238
7271
  ] })
@@ -7245,10 +7278,10 @@ const BlockCard = ({
7245
7278
  children: [
7246
7279
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7247
7280
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7248
- k.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7281
+ k.map((w) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: w, library: c }))
7249
7282
  ) }),
7250
7283
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7251
- v.map((C) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: C, library: c }))
7284
+ S.map((w) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: w, library: c }))
7252
7285
  ) })
7253
7286
  ] }),
7254
7287
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -7729,7 +7762,10 @@ const BlockCard = ({
7729
7762
  "Fetching...": "Fetching...",
7730
7763
  "No images found": "No images found",
7731
7764
  "It looks like you haven't uploaded any images yet. Start by clicking the upload button above.": "It looks like you haven't uploaded any images yet. Start by clicking the upload button above.",
7732
- "Open Code Editor": "Open Code Editor"
7765
+ "Open Code Editor": "Open Code Editor",
7766
+ "Clear search": "Clear search",
7767
+ "No results found for": "No results found for",
7768
+ "Search {collectionName}": "Search {collectionName}"
7733
7769
  };
7734
7770
  i18n.use(initReactI18next).init({
7735
7771
  // the translations
@@ -7749,7 +7785,7 @@ i18n.use(initReactI18next).init({
7749
7785
  }
7750
7786
  });
7751
7787
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7752
- const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: m } = useBlockHighlight(), g = () => {
7788
+ const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), { clearHighlight: g } = useBlockHighlight(), f = () => {
7753
7789
  if (has(o, "blocks")) {
7754
7790
  const E = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7755
7791
  u(syncBlocksWithDefaults(E), r || null);
@@ -7762,11 +7798,11 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7762
7798
  "button",
7763
7799
  {
7764
7800
  disabled: n,
7765
- onClick: g,
7801
+ onClick: f,
7766
7802
  type: "button",
7767
7803
  onDragStart: (E) => {
7768
7804
  E.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), E.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7769
- p([]), m();
7805
+ p([]), g();
7770
7806
  }, 200);
7771
7807
  },
7772
7808
  draggable: x ? "true" : "false",
@@ -7823,9 +7859,9 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7823
7859
  value: l,
7824
7860
  className: cn("h-max"),
7825
7861
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "grid w-full " + (d ? "grid-cols-3" : "grid-cols-2"), children: [
7826
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "library", children: a("library") }),
7827
- /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "core", children: a("blocks") }),
7828
- d ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "html", children: a("import") }) : null
7862
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "library", children: a("Library") }),
7863
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "core", children: a("Blocks") }),
7864
+ d ? /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTrigger, { value: "html", children: a("Import") }) : null
7829
7865
  ] })
7830
7866
  }
7831
7867
  ),
@@ -8131,14 +8167,14 @@ function QuickPrompts({ onClick: o }) {
8131
8167
  ) }) });
8132
8168
  }
8133
8169
  const AIUserPrompt = ({ blockId: o }) => {
8134
- 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
+ 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);
8135
8171
  useEffect(() => {
8136
8172
  var E;
8137
- (E = g.current) == null || E.focus();
8173
+ (E = f.current) == null || E.focus();
8138
8174
  }, []);
8139
8175
  const j = (E) => {
8140
8176
  const { usage: b } = E || {};
8141
- !l && b && m(b), x.current = setTimeout(() => m(void 0), 1e4), l || c("");
8177
+ !l && b && g(b), x.current = setTimeout(() => g(void 0), 1e4), l || c("");
8142
8178
  };
8143
8179
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
8144
8180
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -8156,14 +8192,14 @@ const AIUserPrompt = ({ blockId: o }) => {
8156
8192
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8157
8193
  Textarea,
8158
8194
  {
8159
- ref: g,
8195
+ ref: f,
8160
8196
  value: i,
8161
8197
  onChange: (E) => c(E.target.value),
8162
8198
  placeholder: n("Ask AI to edit content"),
8163
8199
  className: "w-full",
8164
8200
  rows: 3,
8165
8201
  onKeyDown: (E) => {
8166
- E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j));
8202
+ E.key === "Enter" && (E.preventDefault(), x.current && clearTimeout(x.current), g(void 0), r("content", o, i, j));
8167
8203
  }
8168
8204
  }
8169
8205
  ),
@@ -8173,7 +8209,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8173
8209
  {
8174
8210
  disabled: i.trim().length < 5 || a,
8175
8211
  onClick: () => {
8176
- x.current && clearTimeout(x.current), m(void 0), r("content", o, i, j);
8212
+ x.current && clearTimeout(x.current), g(void 0), r("content", o, i, j);
8177
8213
  },
8178
8214
  variant: "default",
8179
8215
  className: "w-fit",
@@ -8206,7 +8242,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8206
8242
  QuickPrompts,
8207
8243
  {
8208
8244
  onClick: (E) => {
8209
- x.current && clearTimeout(x.current), m(void 0), r("content", o, E, j);
8245
+ x.current && clearTimeout(x.current), g(void 0), r("content", o, E, j);
8210
8246
  }
8211
8247
  }
8212
8248
  )
@@ -8216,13 +8252,13 @@ const AIUserPrompt = ({ blockId: o }) => {
8216
8252
  ] }) }) : null
8217
8253
  ] });
8218
8254
  }, AISetContext = () => {
8219
- 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
+ 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);
8220
8256
  useEffect(() => {
8221
8257
  n && a(n);
8222
8258
  }, [n]);
8223
8259
  const j = async () => {
8224
8260
  try {
8225
- d(!0), p(null), await i(r), g({
8261
+ d(!0), p(null), await i(r), f({
8226
8262
  title: o("Updated AI Context"),
8227
8263
  description: o("You can now Ask AI to edit your content"),
8228
8264
  variant: "default"
@@ -8237,7 +8273,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8237
8273
  Accordion,
8238
8274
  {
8239
8275
  onValueChange: (E) => {
8240
- m(E !== "");
8276
+ g(E !== "");
8241
8277
  },
8242
8278
  type: "single",
8243
8279
  collapsible: !0,
@@ -8316,7 +8352,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8316
8352
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
8317
8353
  ] });
8318
8354
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
8319
- const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, m] = useState(null), [g, x] = useState(""), j = useRef(null), E = useRef(null);
8355
+ const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [f, x] = useState(""), j = useRef(null), E = useRef(null);
8320
8356
  useEffect(() => {
8321
8357
  l(n);
8322
8358
  }, [n]);
@@ -8330,28 +8366,28 @@ const AIUserPrompt = ({ blockId: o }) => {
8330
8366
  r(R), l(a), c(""), u(""), x("");
8331
8367
  }
8332
8368
  }, k = (R) => {
8333
- const _ = a.filter((N, L) => L !== R);
8334
- r(_), l(_);
8335
- }, v = (R) => {
8336
- m(R), c(a[R].key), u(a[R].value);
8337
- }, C = () => {
8369
+ const A = a.filter((T, L) => L !== R);
8370
+ r(A), l(A);
8371
+ }, S = (R) => {
8372
+ g(R), c(a[R].key), u(a[R].value);
8373
+ }, w = () => {
8338
8374
  if (i.startsWith("@")) {
8339
8375
  x("Attribute keys cannot start with '@'");
8340
8376
  return;
8341
8377
  }
8342
8378
  if (p !== null && i) {
8343
8379
  const R = [...a];
8344
- R[p] = { key: i, value: d }, r(R), l(R), m(null), c(""), u(""), x("");
8380
+ R[p] = { key: i, value: d }, r(R), l(R), g(null), c(""), u(""), x("");
8345
8381
  }
8346
- }, B = (R) => {
8347
- R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? C() : b());
8382
+ }, _ = (R) => {
8383
+ R.key === "Enter" && !R.shiftKey && (R.preventDefault(), p !== null ? w() : b());
8348
8384
  };
8349
8385
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
8350
8386
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8351
8387
  "form",
8352
8388
  {
8353
8389
  onSubmit: (R) => {
8354
- R.preventDefault(), p !== null ? C() : b();
8390
+ R.preventDefault(), p !== null ? w() : b();
8355
8391
  },
8356
8392
  className: "space-y-3",
8357
8393
  children: [
@@ -8386,7 +8422,7 @@ const AIUserPrompt = ({ blockId: o }) => {
8386
8422
  ref: E,
8387
8423
  value: d,
8388
8424
  onChange: (R) => u(R.target.value),
8389
- onKeyDown: B,
8425
+ onKeyDown: _,
8390
8426
  placeholder: "Value",
8391
8427
  className: "bg-background text-sm"
8392
8428
  }
@@ -8394,26 +8430,26 @@ const AIUserPrompt = ({ blockId: o }) => {
8394
8430
  ] })
8395
8431
  ] }),
8396
8432
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "submit", variant: "secondary", className: "h-8 w-fit text-sm", children: p !== null ? "Save" : "Add" }),
8397
- g && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: g })
8433
+ f && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-red-500", children: f })
8398
8434
  ]
8399
8435
  }
8400
8436
  ),
8401
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((R, _) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
8437
+ /* @__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: [
8402
8438
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
8403
8439
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: R.key }),
8404
8440
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: R.value.toString() })
8405
8441
  ] }),
8406
8442
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
8407
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(_), children: [
8443
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => S(A), children: [
8408
8444
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
8409
8445
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
8410
8446
  ] }),
8411
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(_), children: [
8447
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(A), children: [
8412
8448
  /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
8413
8449
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
8414
8450
  ] })
8415
8451
  ] })
8416
- ] }, _)) })
8452
+ ] }, A)) })
8417
8453
  ] });
8418
8454
  }), BlockAttributesEditor = React.memo(() => {
8419
8455
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -8831,15 +8867,15 @@ function RemoveProviderConfirmation({
8831
8867
  const PageDataProviders = () => {
8832
8868
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8833
8869
  filter(n, (b) => map(r, "providerKey").includes(b.providerKey))
8834
- ), [d, u] = useState(""), [p, m] = useState(null), g = filter(
8870
+ ), [d, u] = useState(""), [p, g] = useState(null), f = filter(
8835
8871
  n.map((b) => map(i, "providerKey").includes(b.providerKey) ? null : { value: b.providerKey, label: b.name }),
8836
8872
  (b) => !isNull(b)
8837
8873
  ), x = (b) => {
8838
8874
  const k = find(n, { providerKey: b });
8839
- c((v) => [...v, k]), a((v) => [...v, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8875
+ c((S) => [...S, k]), a((S) => [...S, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8840
8876
  }, j = (b) => {
8841
- c((k) => filter(k, (v) => v.providerKey !== b.providerKey)), a((k) => filter(k, (v) => v.providerKey !== b.providerKey)), l("UNSAVED");
8842
- }, E = (b) => m(b);
8877
+ c((k) => filter(k, (S) => S.providerKey !== b.providerKey)), a((k) => filter(k, (S) => S.providerKey !== b.providerKey)), l("UNSAVED");
8878
+ }, E = (b) => g(b);
8843
8879
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8844
8880
  o("You have no data providers registered. Please add a data provider to your project."),
8845
8881
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8851,7 +8887,7 @@ const PageDataProviders = () => {
8851
8887
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("Select a provider") }) }),
8852
8888
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
8853
8889
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("Choose") }),
8854
- g.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: b.value, children: b.label }, b.value))
8890
+ f.map((b) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: b.value, children: b.label }, b.value))
8855
8891
  ] })
8856
8892
  ] }) }),
8857
8893
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8928,14 +8964,14 @@ const PageDataProviders = () => {
8928
8964
  },
8929
8965
  b.providerKey
8930
8966
  )) }),
8931
- /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => m(null), provider: p })
8967
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
8932
8968
  ] })
8933
8969
  ] });
8934
8970
  };
8935
8971
  function AiFillDatabase(o) {
8936
8972
  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);
8937
8973
  }
8938
- const TopBar = lazy(() => import("./Topbar-Lvb5K8c2.js"));
8974
+ const TopBar = lazy(() => import("./Topbar-0pmugPN3.js"));
8939
8975
  function useSidebarMenuItems(o) {
8940
8976
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8941
8977
  return useMemo(() => {
@@ -8969,8 +9005,8 @@ const RootLayout = () => {
8969
9005
  x.preventDefault();
8970
9006
  }, d = (x) => {
8971
9007
  n(o === x ? null : x);
8972
- }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), m = [...u, ...i], g = useBuilderProp("htmlDir", "ltr");
8973
- 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: [
9008
+ }, u = useSidebarMenuItems(r), { t: p } = useTranslation(), g = [...u, ...i], f = useBuilderProp("htmlDir", "ltr");
9009
+ 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: [
8974
9010
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8975
9011
  "div",
8976
9012
  {
@@ -8980,7 +9016,7 @@ const RootLayout = () => {
8980
9016
  /* @__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, {}) }) }),
8981
9017
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "relative flex h-[calc(100vh-56px)] max-w-full flex-1 flex-row", children: [
8982
9018
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-12 flex-col items-center justify-between border-r border-border py-2", children: [
8983
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: m.map((x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
9019
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: g.map((x, j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
8984
9020
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8985
9021
  Button,
8986
9022
  {
@@ -9010,10 +9046,10 @@ const RootLayout = () => {
9010
9046
  transition: { duration: 0.3, ease: "easeInOut" },
9011
9047
  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: [
9012
9048
  /* @__PURE__ */ jsxRuntimeExports.jsxs("h2", { className: "-mt-1 flex h-10 items-center space-x-1 text-base font-bold", children: [
9013
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(m, `${o}.icon`, null) }),
9014
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(m[o].label) })
9049
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "rtl:ml-2 rtl:inline-block", children: get(g, `${o}.icon`, null) }),
9050
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: p(g[o].label) })
9015
9051
  ] }),
9016
- /* @__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
+ /* @__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), {}) }) })
9017
9053
  ] }) })
9018
9054
  }
9019
9055
  ),