@chaibuilder/sdk 1.2.100 → 1.2.102

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.
@@ -5,7 +5,7 @@ import { j as jsxRuntimeExports } from "./jsx-runtime-Sp0orL4X.js";
5
5
  import * as React from "react";
6
6
  import React__default, { createContext, useReducer, useEffect, useDebugValue, useCallback, useContext, useState, useMemo, Component, Children, Suspense, useRef, memo, createElement, lazy } from "react";
7
7
  import { a as Skeleton, B as Button, aA as ContextMenu, aB as ContextMenuTrigger, aC as ContextMenuContent, aD as ContextMenuItem, P as Tooltip, Q as TooltipTrigger, R as TooltipContent, C as Card, z as CardHeader, G as CardDescription, H as CardContent, L as Label, T as Textarea, E as CardFooter, D as Dialog, t as DialogTrigger, u as DialogContent, v as DialogHeader, x as DialogTitle, y as DialogDescription, w as DialogFooter, W as Popover, X as PopoverTrigger, Y as PopoverContent, ar as Command, at as CommandInput, au as CommandList, av as CommandEmpty, aw as CommandGroup, ax as CommandItem, K as Tabs, M as TabsList, N as TabsTrigger, O as TabsContent, d as Switch, A as Accordion, f as AccordionItem, g as AccordionTrigger, h as AccordionContent, ao as useToast, I as Input$1, V as TooltipPortal, a8 as DropdownMenu, a9 as DropdownMenuTrigger, aa as DropdownMenuContent, S as ScrollArea, ae as DropdownMenuLabel, af as DropdownMenuSeparator, ah as DropdownMenuGroup, ab as DropdownMenuItem, ag as DropdownMenuShortcut, k as AlertDialog, m as AlertDialogContent, n as AlertDialogHeader, p as AlertDialogTitle, l as AlertDialogTrigger, q as AlertDialogDescription, o as AlertDialogFooter, s as AlertDialogCancel, r as AlertDialogAction, ac as DropdownMenuCheckboxItem, Z as HoverCard, _ as HoverCardTrigger, $ as HoverCardContent, b as Separator, i as Badge, a0 as Select, a3 as SelectTrigger, a2 as SelectValue, a4 as SelectContent, a6 as SelectItem, U as TooltipProvider, aq as Toaster } from "./context-menu-YGd09SE1.js";
8
- import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, chunk, forEach, throttle, memoize, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, cloneDeep, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
8
+ import { has, find, filter, flatten, map, omit, isString as isString$1, includes, without, get, compact, set, isEmpty, forIn, isObject as isObject$1, each, first, noop, keys, startsWith, range, values, flattenDeep, isNull, pick, sortBy, memoize, forEach, unset, chunk, throttle, cloneDeep, reverse, debounce, flatMapDeep, capitalize, last, startCase, truncate, isArray as isArray$1, split, toLower, reject, nth, isNumber as isNumber$1, parseInt as parseInt$1, isNaN as isNaN$1, findLast, intersection, groupBy, isFunction as isFunction$1, uniq, toUpper, round } from "lodash-es";
9
9
  import { atom as atom$1, useAtomValue as useAtomValue$1, useAtom as useAtom$1, useSetAtom as useSetAtom$1, getDefaultStore as getDefaultStore$1 } from "jotai";
10
10
  import { g as generateUUID, a as getBreakpointValue, c as cn, G as GenIcon } from "./iconBase-Ief2hJUZ.js";
11
11
  import { getBlockComponent, useChaiBlocks, getChaiDataProviders, useGlobalStylingPresets, syncBlocksWithDefaults } from "@chaibuilder/runtime";
@@ -19,7 +19,7 @@ import { useFeature, FlagsProvider } from "flagged";
19
19
  import { useHotkeys } from "react-hotkeys-hook";
20
20
  import { flip } from "@floating-ui/dom";
21
21
  import { useFloating, shift } from "@floating-ui/react-dom";
22
- import { ArrowUpIcon, PlusIcon, CopyIcon, GearIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, TriangleRightIcon, EyeOpenIcon, Cross2Icon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, ZoomInIcon, MixerHorizontalIcon, KeyboardIcon, LightningBoltIcon } from "@radix-ui/react-icons";
22
+ import { ArrowUpIcon, PlusIcon, CopyIcon, GearIcon, TrashIcon, DragHandleDots2Icon, BoxModelIcon, BoxIcon, DragHandleHorizontalIcon, ViewHorizontalIcon, BorderAllIcon, BorderTopIcon, TableIcon, DropdownMenuIcon, RadiobuttonIcon, InputIcon, ButtonIcon, CheckboxIcon, GroupIcon, SpaceBetweenVerticallyIcon, ColumnsIcon, RowsIcon, TextIcon, SketchLogoIcon, DividerHorizontalIcon, CodeIcon, CursorTextIcon, VideoIcon, Link1Icon, HeadingIcon, ImageIcon, CardStackPlusIcon, CardStackIcon, ScissorsIcon, TriangleRightIcon, EyeOpenIcon, Cross2Icon, EyeClosedIcon, WidthIcon, HeightIcon, ArrowRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowBottomRightIcon, ArrowBottomLeftIcon, AlignLeftIcon, AlignCenterHorizontallyIcon, AlignRightIcon, StretchHorizontallyIcon, FontItalicIcon, UnderlineIcon, OverlineIcon, LetterCaseUppercaseIcon, Cross1Icon, InfoCircledIcon, MinusIcon, TriangleDownIcon, RowSpacingIcon, CrossCircledIcon, CaretDownIcon, CaretRightIcon, CheckIcon, ResetIcon, SunIcon, DotsVerticalIcon, MobileIcon, LaptopIcon, DesktopIcon, EraserIcon, GlobeIcon as GlobeIcon$1, ZoomInIcon, MixerHorizontalIcon, KeyboardIcon, LightningBoltIcon } from "@radix-ui/react-icons";
23
23
  import { createEvent } from "react-event-hook";
24
24
  import typography$1 from "@tailwindcss/typography";
25
25
  import forms from "@tailwindcss/forms";
@@ -90,101 +90,101 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
90
90
  const o = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new Map();
91
91
  let a, l, i;
92
92
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set());
93
- const c = (b) => o.get(b), d = (b, _) => {
94
- (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(_);
95
- const R = o.get(b);
96
- if (o.set(b, _), r.has(b) || r.set(b, R), R && hasPromiseAtomValue(R)) {
97
- const v = "v" in _ ? _.v instanceof Promise ? _.v : Promise.resolve(_.v) : Promise.reject(_.e);
98
- cancelPromise(R.v, v);
93
+ const c = (b) => o.get(b), d = (b, k) => {
94
+ (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && Object.freeze(k);
95
+ const C = o.get(b);
96
+ if (o.set(b, k), r.has(b) || r.set(b, C), C && hasPromiseAtomValue(C)) {
97
+ const R = "v" in k ? k.v instanceof Promise ? k.v : Promise.resolve(k.v) : Promise.reject(k.e);
98
+ cancelPromise(C.v, R);
99
99
  }
100
- }, u = (b, _, R) => {
101
- const v = /* @__PURE__ */ new Map();
100
+ }, u = (b, k, C) => {
101
+ const R = /* @__PURE__ */ new Map();
102
102
  let I = !1;
103
- R.forEach((L, P) => {
104
- !L && P === b && (L = _), L ? (v.set(P, L), _.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
105
- }), (I || _.d.size !== v.size) && (_.d = v);
106
- }, p = (b, _, R) => {
107
- const v = c(b), I = {
108
- d: (v == null ? void 0 : v.d) || /* @__PURE__ */ new Map(),
109
- v: _
103
+ C.forEach((L, P) => {
104
+ !L && P === b && (L = k), L ? (R.set(P, L), k.d.get(P) !== L && (I = !0)) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] atom state not found");
105
+ }), (I || k.d.size !== R.size) && (k.d = R);
106
+ }, p = (b, k, C) => {
107
+ const R = c(b), I = {
108
+ d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
109
+ v: k
110
110
  };
111
- if (R && u(b, I, R), v && isEqualAtomValue(v, I) && v.d === I.d)
112
- return v;
113
- if (v && hasPromiseAtomValue(v) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(v, I)) {
114
- if (v.d === I.d)
115
- return v;
116
- I.v = v.v;
111
+ if (C && u(b, I, C), R && isEqualAtomValue(R, I) && R.d === I.d)
112
+ return R;
113
+ if (R && hasPromiseAtomValue(R) && hasPromiseAtomValue(I) && isEqualPromiseAtomValue(R, I)) {
114
+ if (R.d === I.d)
115
+ return R;
116
+ I.v = R.v;
117
117
  }
118
118
  return d(b, I), I;
119
- }, g = (b, _, R, v) => {
120
- if (isPromiseLike$2(_)) {
119
+ }, g = (b, k, C, R) => {
120
+ if (isPromiseLike$2(k)) {
121
121
  let I;
122
122
  const L = new Promise((P, V) => {
123
- let $ = !1;
124
- _.then(
123
+ let M = !1;
124
+ k.then(
125
125
  (O) => {
126
- if (!$) {
127
- $ = !0;
128
- const M = c(b), H = p(
126
+ if (!M) {
127
+ M = !0;
128
+ const $ = c(b), H = p(
129
129
  b,
130
130
  L,
131
- R
131
+ C
132
132
  );
133
- resolvePromise(L, O), P(O), (M == null ? void 0 : M.d) !== H.d && N(b, H, M == null ? void 0 : M.d);
133
+ resolvePromise(L, O), P(O), ($ == null ? void 0 : $.d) !== H.d && N(b, H, $ == null ? void 0 : $.d);
134
134
  }
135
135
  },
136
136
  (O) => {
137
- if (!$) {
138
- $ = !0;
139
- const M = c(b), H = p(
137
+ if (!M) {
138
+ M = !0;
139
+ const $ = c(b), H = p(
140
140
  b,
141
141
  L,
142
- R
142
+ C
143
143
  );
144
- rejectPromise(L, O), V(O), (M == null ? void 0 : M.d) !== H.d && N(b, H, M == null ? void 0 : M.d);
144
+ rejectPromise(L, O), V(O), ($ == null ? void 0 : $.d) !== H.d && N(b, H, $ == null ? void 0 : $.d);
145
145
  }
146
146
  }
147
147
  ), I = (O) => {
148
- $ || ($ = !0, O.then(
149
- (M) => resolvePromise(L, M),
150
- (M) => rejectPromise(L, M)
148
+ M || (M = !0, O.then(
149
+ ($) => resolvePromise(L, $),
150
+ ($) => rejectPromise(L, $)
151
151
  ), P(O));
152
152
  };
153
153
  });
154
- return L.orig = _, L.status = "pending", registerCancelPromise(L, (P) => {
155
- P && I(P), v == null || v();
156
- }), p(b, L, R);
154
+ return L.orig = k, L.status = "pending", registerCancelPromise(L, (P) => {
155
+ P && I(P), R == null || R();
156
+ }), p(b, L, C);
157
157
  }
158
- return p(b, _, R);
159
- }, x = (b, _, R) => {
160
- const v = c(b), I = {
161
- d: (v == null ? void 0 : v.d) || /* @__PURE__ */ new Map(),
162
- e: _
158
+ return p(b, k, C);
159
+ }, x = (b, k, C) => {
160
+ const R = c(b), I = {
161
+ d: (R == null ? void 0 : R.d) || /* @__PURE__ */ new Map(),
162
+ e: k
163
163
  };
164
- return R && u(b, I, R), v && isEqualAtomError(v, I) && v.d === I.d ? v : (d(b, I), I);
164
+ return C && u(b, I, C), R && isEqualAtomError(R, I) && R.d === I.d ? R : (d(b, I), I);
165
165
  }, m = (b) => {
166
- const _ = c(b);
167
- if (_ && (_.d.forEach(($, O) => {
166
+ const k = c(b);
167
+ if (k && (k.d.forEach((M, O) => {
168
168
  O !== b && !n.has(O) && m(O);
169
- }), Array.from(_.d).every(([$, O]) => {
170
- const M = c($);
171
- return $ === b || M === O || // TODO This is a hack, we should find a better solution.
172
- M && !hasPromiseAtomValue(M) && isEqualAtomValue(M, O);
169
+ }), Array.from(k.d).every(([M, O]) => {
170
+ const $ = c(M);
171
+ return M === b || $ === O || // TODO This is a hack, we should find a better solution.
172
+ $ && !hasPromiseAtomValue($) && isEqualAtomValue($, O);
173
173
  })))
174
- return _;
175
- const R = /* @__PURE__ */ new Map();
176
- let v = !0;
177
- const I = ($) => {
178
- if ($ === b) {
179
- const M = c($);
180
- if (M)
181
- return R.set($, M), returnAtomValue(M);
182
- if (hasInitialValue($))
183
- return R.set($, void 0), $.init;
174
+ return k;
175
+ const C = /* @__PURE__ */ new Map();
176
+ let R = !0;
177
+ const I = (M) => {
178
+ if (M === b) {
179
+ const $ = c(M);
180
+ if ($)
181
+ return C.set(M, $), returnAtomValue($);
182
+ if (hasInitialValue(M))
183
+ return C.set(M, void 0), M.init;
184
184
  throw new Error("no atom init");
185
185
  }
186
- const O = m($);
187
- return R.set($, O), returnAtomValue(O);
186
+ const O = m(M);
187
+ return C.set(M, O), returnAtomValue(O);
188
188
  };
189
189
  let L, P;
190
190
  const V = {
@@ -192,147 +192,147 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
192
192
  return L || (L = new AbortController()), L.signal;
193
193
  },
194
194
  get setSelf() {
195
- return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(b) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(b) && (P = (...$) => {
196
- if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && v && console.warn("setSelf function cannot be called in sync"), !v)
197
- return B(b, ...$);
195
+ return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && !isActuallyWritableAtom(b) && console.warn("setSelf function cannot be used with read-only atom"), !P && isActuallyWritableAtom(b) && (P = (...M) => {
196
+ if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && R && console.warn("setSelf function cannot be called in sync"), !R)
197
+ return B(b, ...M);
198
198
  }), P;
199
199
  }
200
200
  };
201
201
  try {
202
- const $ = b.read(I, V);
202
+ const M = b.read(I, V);
203
203
  return g(
204
204
  b,
205
- $,
206
- R,
205
+ M,
206
+ C,
207
207
  () => L == null ? void 0 : L.abort()
208
208
  );
209
- } catch ($) {
210
- return x(b, $, R);
209
+ } catch (M) {
210
+ return x(b, M, C);
211
211
  } finally {
212
- v = !1;
212
+ R = !1;
213
213
  }
214
- }, E = (b) => returnAtomValue(m(b)), f = (b) => {
215
- let _ = n.get(b);
216
- return _ || (_ = C(b)), _;
217
- }, j = (b, _) => !_.l.size && (!_.t.size || _.t.size === 1 && _.t.has(b)), k = (b) => {
218
- const _ = n.get(b);
219
- _ && j(b, _) && w(b);
220
- }, A = (b) => {
221
- const _ = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new WeakMap(), v = (L) => {
214
+ }, E = (b) => returnAtomValue(m(b)), j = (b) => {
215
+ let k = n.get(b);
216
+ return k || (k = w(b)), k;
217
+ }, f = (b, k) => !k.l.size && (!k.t.size || k.t.size === 1 && k.t.has(b)), _ = (b) => {
218
+ const k = n.get(b);
219
+ k && f(b, k) && A(b);
220
+ }, v = (b) => {
221
+ const k = /* @__PURE__ */ new Map(), C = /* @__PURE__ */ new WeakMap(), R = (L) => {
222
222
  const P = n.get(L);
223
223
  P == null || P.t.forEach((V) => {
224
- V !== L && (_.set(
224
+ V !== L && (k.set(
225
225
  V,
226
- (_.get(V) || /* @__PURE__ */ new Set()).add(L)
227
- ), R.set(V, (R.get(V) || 0) + 1), v(V));
226
+ (k.get(V) || /* @__PURE__ */ new Set()).add(L)
227
+ ), C.set(V, (C.get(V) || 0) + 1), R(V));
228
228
  });
229
229
  };
230
- v(b);
230
+ R(b);
231
231
  const I = (L) => {
232
232
  const P = n.get(L);
233
233
  P == null || P.t.forEach((V) => {
234
- var $;
234
+ var M;
235
235
  if (V !== L) {
236
- let O = R.get(V);
237
- if (O && R.set(V, --O), !O) {
238
- let M = !!(($ = _.get(V)) != null && $.size);
239
- if (M) {
236
+ let O = C.get(V);
237
+ if (O && C.set(V, --O), !O) {
238
+ let $ = !!((M = k.get(V)) != null && M.size);
239
+ if ($) {
240
240
  const H = c(V), F = m(V);
241
- M = !H || !isEqualAtomValue(H, F);
241
+ $ = !H || !isEqualAtomValue(H, F);
242
242
  }
243
- M || _.forEach((H) => H.delete(V));
243
+ $ || k.forEach((H) => H.delete(V));
244
244
  }
245
245
  I(V);
246
246
  }
247
247
  });
248
248
  };
249
249
  I(b);
250
- }, S = (b, ..._) => {
251
- let R = !0;
252
- const v = (P) => returnAtomValue(m(P)), I = (P, ...V) => {
253
- let $;
250
+ }, S = (b, ...k) => {
251
+ let C = !0;
252
+ const R = (P) => returnAtomValue(m(P)), I = (P, ...V) => {
253
+ let M;
254
254
  if (P === b) {
255
255
  if (!hasInitialValue(P))
256
256
  throw new Error("atom not writable");
257
- const O = c(P), M = g(P, V[0]);
258
- (!O || !isEqualAtomValue(O, M)) && A(P);
257
+ const O = c(P), $ = g(P, V[0]);
258
+ (!O || !isEqualAtomValue(O, $)) && v(P);
259
259
  } else
260
- $ = S(P, ...V);
261
- if (!R) {
260
+ M = S(P, ...V);
261
+ if (!C) {
262
262
  const O = D();
263
263
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
264
- (M) => M({ type: "async-write", flushed: O })
264
+ ($) => $({ type: "async-write", flushed: O })
265
265
  );
266
266
  }
267
- return $;
268
- }, L = b.write(v, I, ..._);
269
- return R = !1, L;
270
- }, B = (b, ..._) => {
271
- const R = S(b, ..._), v = D();
267
+ return M;
268
+ }, L = b.write(R, I, ...k);
269
+ return C = !1, L;
270
+ }, B = (b, ...k) => {
271
+ const C = S(b, ...k), R = D();
272
272
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && l.forEach(
273
- (I) => I({ type: "write", flushed: v })
274
- ), R;
275
- }, C = (b, _) => {
276
- const R = {
277
- t: new Set(_ && [_]),
273
+ (I) => I({ type: "write", flushed: R })
274
+ ), C;
275
+ }, w = (b, k) => {
276
+ const C = {
277
+ t: new Set(k && [k]),
278
278
  l: /* @__PURE__ */ new Set()
279
279
  };
280
- if (n.set(b, R), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), m(b).d.forEach((v, I) => {
280
+ if (n.set(b, C), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.add(b), m(b).d.forEach((R, I) => {
281
281
  const L = n.get(I);
282
- L ? L.t.add(b) : I !== b && C(I, b);
282
+ L ? L.t.add(b) : I !== b && w(I, b);
283
283
  }), m(b), isActuallyWritableAtom(b) && b.onMount) {
284
- const v = b.onMount((...I) => B(b, ...I));
285
- v && (R.u = v);
284
+ const R = b.onMount((...I) => B(b, ...I));
285
+ R && (C.u = R);
286
286
  }
287
- return R;
288
- }, w = (b) => {
289
- var _;
290
- const R = (_ = n.get(b)) == null ? void 0 : _.u;
291
- R && R(), n.delete(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(b);
292
- const v = c(b);
293
- v ? (hasPromiseAtomValue(v) && cancelPromise(v.v), v.d.forEach((I, L) => {
287
+ return C;
288
+ }, A = (b) => {
289
+ var k;
290
+ const C = (k = n.get(b)) == null ? void 0 : k.u;
291
+ C && C(), n.delete(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && i.delete(b);
292
+ const R = c(b);
293
+ R ? (hasPromiseAtomValue(R) && cancelPromise(R.v), R.d.forEach((I, L) => {
294
294
  if (L !== b) {
295
295
  const P = n.get(L);
296
- P && (P.t.delete(b), j(L, P) && w(L));
296
+ P && (P.t.delete(b), f(L, P) && A(L));
297
297
  }
298
298
  })) : (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] could not find atom state to unmount", b);
299
- }, N = (b, _, R) => {
300
- const v = new Set(_.d.keys());
301
- R == null || R.forEach((I, L) => {
302
- if (v.has(L)) {
303
- v.delete(L);
299
+ }, N = (b, k, C) => {
300
+ const R = new Set(k.d.keys());
301
+ C == null || C.forEach((I, L) => {
302
+ if (R.has(L)) {
303
+ R.delete(L);
304
304
  return;
305
305
  }
306
306
  const P = n.get(L);
307
- P && (P.t.delete(b), j(L, P) && w(L));
308
- }), v.forEach((I) => {
307
+ P && (P.t.delete(b), f(L, P) && A(L));
308
+ }), R.forEach((I) => {
309
309
  const L = n.get(I);
310
- L ? L.t.add(b) : n.has(b) && C(I, b);
310
+ L ? L.t.add(b) : n.has(b) && w(I, b);
311
311
  });
312
312
  }, D = () => {
313
313
  let b;
314
314
  for ((define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (b = /* @__PURE__ */ new Set()); r.size; ) {
315
- const _ = Array.from(r);
316
- r.clear(), _.forEach(([R, v]) => {
317
- const I = c(R);
315
+ const k = Array.from(r);
316
+ r.clear(), k.forEach(([C, R]) => {
317
+ const I = c(C);
318
318
  if (I) {
319
- I.d !== (v == null ? void 0 : v.d) && N(R, I, v == null ? void 0 : v.d);
320
- const L = n.get(R);
319
+ I.d !== (R == null ? void 0 : R.d) && N(C, I, R == null ? void 0 : R.d);
320
+ const L = n.get(C);
321
321
  L && !// TODO This seems pretty hacky. Hope to fix it.
322
322
  // Maybe we could `mountDependencies` in `setAtomState`?
323
- (v && !hasPromiseAtomValue(v) && (isEqualAtomValue(v, I) || isEqualAtomError(v, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && b.add(R));
323
+ (R && !hasPromiseAtomValue(R) && (isEqualAtomValue(R, I) || isEqualAtomError(R, I))) && (L.l.forEach((P) => P()), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && b.add(C));
324
324
  } else
325
325
  (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && console.warn("[Bug] no atom state to flush");
326
326
  });
327
327
  }
328
328
  if ((define_import_meta_env_default$2 ? "production" : void 0) !== "production")
329
- return a.forEach((_) => _("state")), b;
330
- }, T = (b, _) => {
331
- const R = f(b), v = D(), I = R.l;
332
- return I.add(_), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
333
- (L) => L({ type: "sub", flushed: v })
329
+ return a.forEach((k) => k("state")), b;
330
+ }, T = (b, k) => {
331
+ const C = j(b), R = D(), I = C.l;
332
+ return I.add(k), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("sub")), l.forEach(
333
+ (L) => L({ type: "sub", flushed: R })
334
334
  )), () => {
335
- I.delete(_), k(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
335
+ I.delete(k), _(b), (define_import_meta_env_default$2 ? "production" : void 0) !== "production" && (a.forEach((L) => L("unsub")), l.forEach((L) => L({ type: "unsub" })));
336
336
  };
337
337
  };
338
338
  return (define_import_meta_env_default$2 ? "production" : void 0) !== "production" ? {
@@ -340,7 +340,7 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
340
340
  set: B,
341
341
  sub: T,
342
342
  // store dev methods (these are tentative and subject to change without notice)
343
- dev_subscribe_store: (b, _) => _ !== 2 ? (console.warn(
343
+ dev_subscribe_store: (b, k) => k !== 2 ? (console.warn(
344
344
  "The current StoreListener revision is 2. The older ones are deprecated."
345
345
  ), a.add(b), () => {
346
346
  a.delete(b);
@@ -351,11 +351,11 @@ const hasInitialValue = (o) => "init" in o, isActuallyWritableAtom = (o) => !!o.
351
351
  dev_get_atom_state: (b) => o.get(b),
352
352
  dev_get_mounted: (b) => n.get(b),
353
353
  dev_restore_atoms: (b) => {
354
- for (const [R, v] of b)
355
- hasInitialValue(R) && (g(R, v), A(R));
356
- const _ = D();
354
+ for (const [C, R] of b)
355
+ hasInitialValue(C) && (g(C, R), v(C));
356
+ const k = D();
357
357
  l.forEach(
358
- (R) => R({ type: "restore", flushed: _ })
358
+ (C) => C({ type: "restore", flushed: k })
359
359
  );
360
360
  }
361
361
  } : {
@@ -380,34 +380,34 @@ function splitAtom(o, n) {
380
380
  return u;
381
381
  const p = d && r.get(d), g = [], x = [];
382
382
  return c.forEach((m, E) => {
383
- const f = n ? n(m) : E;
384
- x[E] = f;
385
- const j = p && p.atomList[p.keyList.indexOf(f)];
386
- if (j) {
387
- g[E] = j;
383
+ const j = n ? n(m) : E;
384
+ x[E] = j;
385
+ const f = p && p.atomList[p.keyList.indexOf(j)];
386
+ if (f) {
387
+ g[E] = f;
388
388
  return;
389
389
  }
390
- const k = (S) => {
391
- const B = S(l), C = S(o), N = a(C, B == null ? void 0 : B.arr).keyList.indexOf(f);
392
- if (N < 0 || N >= C.length) {
393
- const D = c[a(c).keyList.indexOf(f)];
390
+ const _ = (S) => {
391
+ const B = S(l), w = S(o), N = a(w, B == null ? void 0 : B.arr).keyList.indexOf(j);
392
+ if (N < 0 || N >= w.length) {
393
+ const D = c[a(c).keyList.indexOf(j)];
394
394
  if (D)
395
395
  return D;
396
396
  throw new Error("splitAtom: index out of bounds for read");
397
397
  }
398
- return C[N];
399
- }, A = (S, B, C) => {
400
- const w = S(l), N = S(o), T = a(N, w == null ? void 0 : w.arr).keyList.indexOf(f);
398
+ return w[N];
399
+ }, v = (S, B, w) => {
400
+ const A = S(l), N = S(o), T = a(N, A == null ? void 0 : A.arr).keyList.indexOf(j);
401
401
  if (T < 0 || T >= N.length)
402
402
  throw new Error("splitAtom: index out of bounds for write");
403
- const b = isFunction(C) ? C(N[T]) : C;
403
+ const b = isFunction(w) ? w(N[T]) : w;
404
404
  B(o, [
405
405
  ...N.slice(0, T),
406
406
  b,
407
407
  ...N.slice(T + 1)
408
408
  ]);
409
409
  };
410
- g[E] = isWritable(o) ? atom(k, A) : atom(k);
410
+ g[E] = isWritable(o) ? atom(_, v) : atom(_);
411
411
  }), p && p.keyList.length === x.length && p.keyList.every((m, E) => m === x[E]) ? u = p : u = { arr: c, atomList: g, keyList: x }, r.set(c, u), u;
412
412
  }, l = atom((c) => {
413
413
  const d = c(l), u = c(o);
@@ -1192,65 +1192,65 @@ const useBlocksStoreManager = () => {
1192
1192
  updateBlocksProps: c
1193
1193
  } = useBlocksStoreManager();
1194
1194
  return {
1195
- moveBlocks: (f, j, k) => {
1196
- const A = map(f, (B) => {
1197
- const w = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => w ? T._parent === w : !T._parent).map((T) => T._id).indexOf(B);
1198
- return { _id: B, oldParent: w, oldPosition: D };
1199
- }), S = A.find(({ _id: B }) => B === f[0]);
1200
- S && S.oldParent === j && S.oldPosition === k || (i(f, j, k), o({
1201
- undo: () => each(A, ({ _id: B, oldParent: C, oldPosition: w }) => {
1202
- i([B], C, w);
1195
+ moveBlocks: (j, f, _) => {
1196
+ const v = map(j, (B) => {
1197
+ const A = n.find((T) => T._id === B)._parent || null, D = n.filter((T) => A ? T._parent === A : !T._parent).map((T) => T._id).indexOf(B);
1198
+ return { _id: B, oldParent: A, oldPosition: D };
1199
+ }), S = v.find(({ _id: B }) => B === j[0]);
1200
+ S && S.oldParent === f && S.oldPosition === _ || (i(j, f, _), o({
1201
+ undo: () => each(v, ({ _id: B, oldParent: w, oldPosition: A }) => {
1202
+ i([B], w, A);
1203
1203
  }),
1204
- redo: () => i(f, j, k)
1204
+ redo: () => i(j, f, _)
1205
1205
  }));
1206
1206
  },
1207
- addBlocks: (f, j, k) => {
1208
- a(f, j, k), o({
1209
- undo: () => l(map(f, "_id")),
1210
- redo: () => a(f, j, k)
1207
+ addBlocks: (j, f, _) => {
1208
+ a(j, f, _), o({
1209
+ undo: () => l(map(j, "_id")),
1210
+ redo: () => a(j, f, _)
1211
1211
  });
1212
1212
  },
1213
- removeBlocks: (f) => {
1213
+ removeBlocks: (j) => {
1214
1214
  var S;
1215
- const j = (S = first(f)) == null ? void 0 : S._parent, A = n.filter((B) => j ? B._parent === j : !B._parent).indexOf(first(f));
1216
- l(map(f, "_id")), o({
1217
- undo: () => a(f, j, A),
1218
- redo: () => l(map(f, "_id"))
1215
+ const f = (S = first(j)) == null ? void 0 : S._parent, v = n.filter((B) => f ? B._parent === f : !B._parent).indexOf(first(j));
1216
+ l(map(j, "_id")), o({
1217
+ undo: () => a(j, f, v),
1218
+ redo: () => l(map(j, "_id"))
1219
1219
  });
1220
1220
  },
1221
- updateBlocks: (f, j, k) => {
1222
- let A = [];
1223
- if (k)
1224
- A = map(f, (S) => ({ _id: S, ...k }));
1221
+ updateBlocks: (j, f, _) => {
1222
+ let v = [];
1223
+ if (_)
1224
+ v = map(j, (S) => ({ _id: S, ..._ }));
1225
1225
  else {
1226
- const S = keys(j);
1227
- A = map(f, (B) => {
1228
- const C = n.find((N) => N._id === B), w = { _id: B };
1229
- return each(S, (N) => w[N] = C[N]), w;
1226
+ const S = keys(f);
1227
+ v = map(j, (B) => {
1228
+ const w = n.find((N) => N._id === B), A = { _id: B };
1229
+ return each(S, (N) => A[N] = w[N]), A;
1230
1230
  });
1231
1231
  }
1232
- c(map(f, (S) => ({ _id: S, ...j }))), o({
1233
- undo: () => c(A),
1234
- redo: () => c(map(f, (S) => ({ _id: S, ...j })))
1232
+ c(map(j, (S) => ({ _id: S, ...f }))), o({
1233
+ undo: () => c(v),
1234
+ redo: () => c(map(j, (S) => ({ _id: S, ...f })))
1235
1235
  });
1236
1236
  },
1237
- updateBlocksRuntime: (f, j) => {
1238
- c(map(f, (k) => ({ _id: k, ...j })));
1237
+ updateBlocksRuntime: (j, f) => {
1238
+ c(map(j, (_) => ({ _id: _, ...f })));
1239
1239
  },
1240
- setNewBlocks: (f) => {
1241
- r(f), o({
1240
+ setNewBlocks: (j) => {
1241
+ r(j), o({
1242
1242
  undo: () => r(n),
1243
- redo: () => r(f)
1243
+ redo: () => r(j)
1244
1244
  });
1245
1245
  },
1246
- updateMultipleBlocksProps: (f) => {
1247
- let j = [];
1248
- j = map(f, (k) => {
1249
- const A = keys(k), S = n.find((C) => C._id === k._id), B = {};
1250
- return each(A, (C) => B[C] = S[C]), B;
1251
- }), c(f), o({
1252
- undo: () => c(j),
1253
- redo: () => c(f)
1246
+ updateMultipleBlocksProps: (j) => {
1247
+ let f = [];
1248
+ f = map(j, (_) => {
1249
+ const v = keys(_), S = n.find((w) => w._id === _._id), B = {};
1250
+ return each(v, (w) => B[w] = S[w]), B;
1251
+ }), c(j), o({
1252
+ undo: () => c(f),
1253
+ redo: () => c(j)
1254
1254
  });
1255
1255
  }
1256
1256
  };
@@ -1259,11 +1259,11 @@ const useBlocksStoreManager = () => {
1259
1259
  (i, c, d) => {
1260
1260
  var m;
1261
1261
  for (let E = 0; E < i.length; E++) {
1262
- const { _id: f } = i[E];
1262
+ const { _id: j } = i[E];
1263
1263
  i[E]._id = generateUUID();
1264
- const j = filter(i, { _parent: f });
1265
- for (let k = 0; k < j.length; k++)
1266
- j[k]._parent = i[E]._id;
1264
+ const f = filter(i, { _parent: j });
1265
+ for (let _ = 0; _ < f.length; _++)
1266
+ f[_]._parent = i[E]._id;
1267
1267
  }
1268
1268
  const u = first(i);
1269
1269
  let p, g;
@@ -1274,20 +1274,20 @@ const useBlocksStoreManager = () => {
1274
1274
  return { addCoreBlock: useCallback(
1275
1275
  (i, c, d) => {
1276
1276
  if (has(i, "blocks")) {
1277
- const k = i.blocks;
1278
- return a(k, c, d);
1277
+ const _ = i.blocks;
1278
+ return a(_, c, d);
1279
1279
  }
1280
1280
  const u = generateUUID(), p = getBlockDefaultProps(i.props), g = [];
1281
- forIn(p, (k, A) => {
1282
- if (startsWith(k, SLOT_KEY)) {
1283
- const S = k.replace(SLOT_KEY, "");
1281
+ forIn(p, (_, v) => {
1282
+ if (startsWith(_, SLOT_KEY)) {
1283
+ const S = _.replace(SLOT_KEY, "");
1284
1284
  g.push({
1285
1285
  _id: S,
1286
1286
  _type: "Slot",
1287
1287
  _parent: u,
1288
- _name: i.props[A].name,
1289
- _styles: i.props[A].styles,
1290
- _emptyStyles: i.props[A].emptyStyles
1288
+ _name: i.props[v].name,
1289
+ _styles: i.props[v].styles,
1290
+ _emptyStyles: i.props[v].emptyStyles
1291
1291
  });
1292
1292
  }
1293
1293
  });
@@ -1298,8 +1298,8 @@ const useBlocksStoreManager = () => {
1298
1298
  };
1299
1299
  let m, E;
1300
1300
  c && (m = find(o, { _id: c }), x._parent = c, E = c), !canAcceptChildBlock(m == null ? void 0 : m._type, x._type) && m && (x._parent = m._parent, E = m._parent);
1301
- const j = [x, ...g];
1302
- return r(j, E, d), n([x._id]), x;
1301
+ const f = [x, ...g];
1302
+ return r(f, E, d), n([x._id]), x;
1303
1303
  },
1304
1304
  [a, o, n]
1305
1305
  ), addPredefinedBlock: a };
@@ -2571,8 +2571,8 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2571
2571
  return each(u, (x) => {
2572
2572
  const m = x.replace(/[\[\]\/\\{}()*+?.^$|]/g, "\\$&"), E = new RegExp(`(^| )${m}($| )`, "g");
2573
2573
  p = p.replace(E, " ").replace(/ +/g, " ").trim();
2574
- const f = first(x.split(":"));
2575
- includes(["2xl", "xl", "lg", "md", "sm"], f) && u.push(x.split(":").pop().trim());
2574
+ const j = first(x.split(":"));
2575
+ includes(["2xl", "xl", "lg", "md", "sm"], j) && u.push(x.split(":").pop().trim());
2576
2576
  }), each(u, (x) => {
2577
2577
  const m = new RegExp(`(^| )${x.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
2578
2578
  g = g.replace(m, " ").replace(/ +/g, " ").trim();
@@ -2628,13 +2628,37 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2628
2628
  break;
2629
2629
  }
2630
2630
  return n;
2631
- }, useSelectedBlockCurrentClasses = () => useAtomValue$1(selectedBlockCurrentClassesAtom), useStylingState = () => useAtom$1(styleStateAtom), useUpdateBlocksProps = () => {
2632
- const { updateBlocks: o } = useBlocksStoreUndoableActions();
2631
+ }, useSelectedBlockCurrentClasses = () => useAtomValue$1(selectedBlockCurrentClassesAtom), useStylingState = () => useAtom$1(styleStateAtom), languageAtom = atom$1("");
2632
+ languageAtom.debugLabel = "selectedLanguageAtom";
2633
+ const useLanguages = () => {
2634
+ const o = useBuilderProp("languages", []), n = useBuilderProp("fallbackLang", "en"), [r, a] = useAtom$1(languageAtom), [, l] = useSelectedBlockIds(), [, i] = useHighlightBlockId(), [, c] = useSelectedStylingBlocks();
2635
+ return {
2636
+ languages: o,
2637
+ fallbackLang: n,
2638
+ selectedLang: r,
2639
+ setSelectedLang: (u) => {
2640
+ r !== (n === u ? "" : u) && (l([]), i(null), c([]), a(n === u ? "" : u));
2641
+ }
2642
+ };
2643
+ }, updatePropsForLanguage = memoize((o, n, r) => {
2644
+ const a = getBlockComponent(get(r, "_type"));
2645
+ if (!a)
2646
+ return o;
2647
+ const l = { ...o };
2648
+ return forEach(keys(o), (i) => {
2649
+ if (get(a, ["props", i, "i18n"]) && !isEmpty(n)) {
2650
+ const c = `${i}-${n}`;
2651
+ set(l, c, o[i]), unset(l, i);
2652
+ }
2653
+ }), l;
2654
+ }), useUpdateBlocksProps = () => {
2655
+ const { updateBlocks: o } = useBlocksStoreUndoableActions(), { selectedLang: n } = useLanguages(), r = useSelectedBlock();
2633
2656
  return useCallback(
2634
- (n, r, a) => {
2635
- o(n, r, a);
2657
+ (a, l, i) => {
2658
+ const c = updatePropsForLanguage(l, n, r);
2659
+ o(a, c, i);
2636
2660
  },
2637
- [o]
2661
+ [o, n]
2638
2662
  );
2639
2663
  }, useUpdateMultipleBlocksProps = () => {
2640
2664
  const { updateMultipleBlocksProps: o } = useBlocksStoreUndoableActions();
@@ -2673,12 +2697,13 @@ const useSelectedStylingBlocks = () => useAtom$1(selectedStylingBlocksAtom), get
2673
2697
  [o]
2674
2698
  );
2675
2699
  }, useUpdateBlocksPropsRealtime = () => {
2676
- const { updateBlocksRuntime: o } = useBlocksStoreUndoableActions();
2700
+ const { updateBlocksRuntime: o } = useBlocksStoreUndoableActions(), { selectedLang: n } = useLanguages(), r = useSelectedBlock();
2677
2701
  return useCallback(
2678
- (n, r) => {
2679
- o(n, r);
2702
+ (a, l) => {
2703
+ const i = updatePropsForLanguage(l, n, r);
2704
+ o(a, i);
2680
2705
  },
2681
- [o]
2706
+ [o, n]
2682
2707
  );
2683
2708
  }, selectedBreakpointsAtom = atomWithStorage("selectedBreakpoints", ["XS", "MD", "XL"]), useSelectedBreakpoints = () => {
2684
2709
  const [o, n] = useAtom$1(selectedBreakpointsAtom);
@@ -3034,26 +3059,26 @@ const useDnd = () => {
3034
3059
  m.preventDefault(), m.stopPropagation(), throttledDragOver(m);
3035
3060
  },
3036
3061
  onDrop: (m) => {
3037
- var C;
3038
- const E = dropTarget, j = getOrientation(E) === "vertical" ? m.clientY + ((C = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : C.scrollY) : m.clientX;
3039
- dropIndex = calculateDropIndex(j, possiblePositions);
3040
- const k = d, A = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3041
- if ((k == null ? void 0 : k._id) === A || !S) {
3062
+ var w;
3063
+ const E = dropTarget, f = getOrientation(E) === "vertical" ? m.clientY + ((w = iframeDocument == null ? void 0 : iframeDocument.defaultView) == null ? void 0 : w.scrollY) : m.clientX;
3064
+ dropIndex = calculateDropIndex(f, possiblePositions);
3065
+ const _ = d, v = E.getAttribute("data-block-id"), S = dropTarget.getAttribute("data-dnd-dragged") !== "yes";
3066
+ if ((_ == null ? void 0 : _._id) === v || !S) {
3042
3067
  x();
3043
3068
  return;
3044
3069
  }
3045
- if (!has(k, "_id")) {
3046
- a(k, A === "canvas" ? null : A, dropIndex), setTimeout(x, 300);
3070
+ if (!has(_, "_id")) {
3071
+ a(_, v === "canvas" ? null : v, dropIndex), setTimeout(x, 300);
3047
3072
  return;
3048
3073
  }
3049
3074
  let B = E.getAttribute("data-block-id");
3050
- B === null && (B = m.target.parentElement.getAttribute("data-block-id")), c([k._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3075
+ B === null && (B = m.target.parentElement.getAttribute("data-block-id")), c([_._id], B === "canvas" ? null : B, dropIndex), x(), setTimeout(removePlaceholder, 300);
3051
3076
  },
3052
3077
  onDragEnter: (m) => {
3053
- const E = m, f = E.target;
3054
- dropTarget = f;
3055
- const j = f.getAttribute("data-block-id"), k = f.getAttribute("data-dnd-dragged") !== "yes";
3056
- p(j), E.stopPropagation(), E.preventDefault(), possiblePositions = [], k && calculatePossiblePositions(f), r(!0), l(""), i([]);
3078
+ const E = m, j = E.target;
3079
+ dropTarget = j;
3080
+ const f = j.getAttribute("data-block-id"), _ = j.getAttribute("data-dnd-dragged") !== "yes";
3081
+ p(f), E.stopPropagation(), E.preventDefault(), possiblePositions = [], _ && calculatePossiblePositions(j), r(!0), l(""), i([]);
3057
3082
  },
3058
3083
  onDragLeave: (m) => {
3059
3084
  m.target.getAttribute("data-block-id") === "canvas" && (p(null), r(!1), removePlaceholder(), possiblePositions = []);
@@ -3065,7 +3090,7 @@ function getTargetedBlock(o) {
3065
3090
  }
3066
3091
  function destroyQuill(o) {
3067
3092
  o.container.innerHTML = "", o.container.parentNode.removeChild(o.container);
3068
- var n = document.querySelector(".ql-toolbar");
3093
+ const n = document.querySelector(".ql-toolbar");
3069
3094
  n && n.parentNode.removeChild(n), o = null;
3070
3095
  }
3071
3096
  const useHandleCanvasDblClick = () => {
@@ -3105,7 +3130,7 @@ const useHandleCanvasDblClick = () => {
3105
3130
  const u = d.getAttribute("data-style-prop"), p = d.getAttribute("data-style-id"), g = d.getAttribute("data-block-parent");
3106
3131
  n.includes(g) || i == null || i.closeAll(), o([{ id: p, prop: u, blockId: g }]), r([g]);
3107
3132
  } else if (d != null && d.getAttribute("data-block-id")) {
3108
- let u = d.getAttribute("data-block-id");
3133
+ const u = d.getAttribute("data-block-id");
3109
3134
  n.includes(u) || i == null || i.closeAll(), o([]), r(u === "canvas" ? [] : [u]);
3110
3135
  }
3111
3136
  a("");
@@ -3263,16 +3288,16 @@ const useHandleCanvasDblClick = () => {
3263
3288
  useEffect(() => {
3264
3289
  a ? u == null || u.documentElement.classList.add("dark") : u == null || u.documentElement.classList.remove("dark");
3265
3290
  }, [a, u]);
3266
- const f = get(n, "headingFont", "DM Sans"), j = get(n, "bodyFont", "DM Sans");
3291
+ const j = get(n, "headingFont", "DM Sans"), f = get(n, "bodyFont", "DM Sans");
3267
3292
  return useEffect(() => {
3268
- const k = get(n, "primaryColor", "#000"), A = get(n, "secondaryColor", "#FFF"), S = get(n, "bodyBgLightColor", "#fff"), B = get(n, "bodyBgDarkColor", "#000"), C = get(n, "bodyTextDarkColor", "#000"), w = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
3269
- { color: k, name: "primary" },
3270
- { color: A, name: "secondary" }
3293
+ const _ = get(n, "primaryColor", "#000"), v = get(n, "secondaryColor", "#FFF"), S = get(n, "bodyBgLightColor", "#fff"), B = get(n, "bodyBgDarkColor", "#000"), w = get(n, "bodyTextDarkColor", "#000"), A = get(n, "bodyTextLightColor", "#fff"), N = getPalette([
3294
+ { color: _, name: "primary" },
3295
+ { color: v, name: "secondary" }
3271
3296
  ]), D = {
3272
3297
  "bg-light": S,
3273
3298
  "bg-dark": B,
3274
- "text-dark": C,
3275
- "text-light": w
3299
+ "text-dark": w,
3300
+ "text-light": A
3276
3301
  }, T = get(n, "roundedCorners", "0");
3277
3302
  !p || !p.tailwind || (p.tailwind.config = {
3278
3303
  darkMode: "class",
@@ -3286,8 +3311,8 @@ const useHandleCanvasDblClick = () => {
3286
3311
  }
3287
3312
  },
3288
3313
  fontFamily: {
3289
- heading: [f],
3290
- body: [j]
3314
+ heading: [j],
3315
+ body: [f]
3291
3316
  },
3292
3317
  borderRadius: {
3293
3318
  DEFAULT: `${T || "0"}px`
@@ -3299,26 +3324,26 @@ const useHandleCanvasDblClick = () => {
3299
3324
  typography$1,
3300
3325
  forms,
3301
3326
  aspectRatio,
3302
- plugin(function({ addBase: b, theme: _ }) {
3327
+ plugin(function({ addBase: b, theme: k }) {
3303
3328
  b({
3304
3329
  "h1,h2,h3,h4,h5,h6": {
3305
- fontFamily: _("fontFamily.heading")
3330
+ fontFamily: k("fontFamily.heading")
3306
3331
  },
3307
3332
  body: {
3308
- fontFamily: _("fontFamily.body"),
3309
- color: _("colors.text-light"),
3310
- backgroundColor: _("colors.bg-light")
3333
+ fontFamily: k("fontFamily.body"),
3334
+ color: k("colors.text-light"),
3335
+ backgroundColor: k("colors.bg-light")
3311
3336
  },
3312
3337
  ".dark body": {
3313
- color: _("colors.text-dark"),
3314
- backgroundColor: _("colors.bg-dark")
3338
+ color: k("colors.text-dark"),
3339
+ backgroundColor: k("colors.bg-dark")
3315
3340
  }
3316
3341
  });
3317
3342
  })
3318
3343
  ]
3319
3344
  });
3320
- }, [n, p, f, j]), useEffect(() => {
3321
- x && (x.textContent = `${map(r, (k) => `[data-block-id="${k}"]`).join(",")}{
3345
+ }, [n, p, j, f]), useEffect(() => {
3346
+ x && (x.textContent = `${map(r, (_) => `[data-block-id="${_}"]`).join(",")}{
3322
3347
  outline: 1px solid ${r.length === 1 ? "#42a1fc" : "orange"} !important; outline-offset: -1px;
3323
3348
  }`);
3324
3349
  }, [r, x]), useEffect(() => {
@@ -3326,16 +3351,16 @@ const useHandleCanvasDblClick = () => {
3326
3351
  }, [c, E]), useEffect(() => {
3327
3352
  g && (g.textContent = l ? `[data-style-id="${l}"], [data-block-id="${l}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}` : "");
3328
3353
  }, [l, r, g]), useEffect(() => {
3329
- m && (m.textContent = `${map(i, ({ id: k }) => `[data-style-id="${k}"]`).join(",")}{
3354
+ m && (m.textContent = `${map(i, ({ id: _ }) => `[data-style-id="${_}"]`).join(",")}{
3330
3355
  outline: 1px solid #42a1fc !important; outline-offset: -1px;
3331
3356
  }`);
3332
3357
  }, [i, m]), useEffect(() => {
3333
3358
  u.querySelector("#drop-target-block").innerHTML = d ? `[data-block-id="${d}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}` : "";
3334
- }, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (f || j) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3359
+ }, [d]), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (j || f) && /* @__PURE__ */ jsxRuntimeExports.jsx(
3335
3360
  "link",
3336
3361
  {
3337
3362
  rel: "stylesheet",
3338
- href: `https://fonts.googleapis.com/css2?family=${f ? `${f.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${f && j && f !== j ? "&" : ""}${j && j !== f ? `family=${j.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
3363
+ href: `https://fonts.googleapis.com/css2?family=${j ? `${j.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}${j && f && j !== f ? "&" : ""}${f && f !== j ? `family=${f.replace(/ /g, "+")}:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900` : ""}&display=swap`
3339
3364
  }
3340
3365
  ) });
3341
3366
  }, useChaiExternalData = () => useAtom$1(chaiExternalDataAtom), useCanvasSettings = () => useAtom$1(canvasSettingsAtom), isVisibleAtBreakpoint = (o, n) => {
@@ -3444,51 +3469,59 @@ function isDescendant(o, n, r) {
3444
3469
  return l.some((i) => i._id === n) ? !0 : l.some((i) => isDescendant(i._id, n, r));
3445
3470
  }
3446
3471
  const RenderGlobalBlock = ({ blocks: o, allBlocks: n }) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: o });
3472
+ function applyLanguage(o, n, r) {
3473
+ if (isEmpty(n))
3474
+ return o;
3475
+ const a = cloneDeep(o);
3476
+ return forEach(keys(a), (l) => {
3477
+ get(r, ["props", l, "i18n"]) && !isEmpty(n) && (a[l] = get(a, `${l}-${n}`, a[l]));
3478
+ }), a;
3479
+ }
3447
3480
  function BlocksRendererStatic({ blocks: o, allBlocks: n }) {
3448
- const [r] = useAtom$1(xShowBlocksAtom), [a] = useCutBlockIds(), [l] = useAtom$1(draggedBlockAtom), [i] = useAtom$1(dropTargetBlockIdAtom), [, c] = useCanvasWidth(), [d] = useCanvasSettings(), [u] = useHiddenBlockIds(), { getGlobalBlocks: p } = useGlobalBlocksStore(), g = useCallback((f) => getStyleAttrs(f, c), [c]), [x] = useChaiExternalData(), [m] = useAtom$1(inlineEditingActiveAtom), E = useCallback(
3449
- (f) => f.reduce((j, k) => {
3450
- const A = get(d, k, {});
3451
- return { ...j, ...A };
3481
+ 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(), x = useCallback((f) => getStyleAttrs(f, d), [d]), [m] = useChaiExternalData(), [E] = useAtom$1(inlineEditingActiveAtom), j = useCallback(
3482
+ (f) => f.reduce((_, v) => {
3483
+ const S = get(u, v, {});
3484
+ return { ..._, ...S };
3452
3485
  }, {}),
3453
- [d]
3486
+ [u]
3454
3487
  );
3455
3488
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: React__default.Children.toArray(
3456
- o.map((f, j) => {
3457
- if (m === f._id || u.includes(f._id))
3489
+ o.map((f, _) => {
3490
+ if (E === f._id || p.includes(f._id))
3458
3491
  return null;
3459
- const k = {}, A = filter(n, { _parent: f._id });
3460
- if (k.children = A.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: A }) : null, f._type === "GlobalBlock") {
3461
- const _ = p(f);
3462
- k.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(_, (R) => !R._parent), allBlocks: _ });
3492
+ const v = {}, S = filter(n, { _parent: f._id });
3493
+ if (v.children = S.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(BlocksRendererStatic, { allBlocks: n, blocks: S }) : null, f._type === "GlobalBlock") {
3494
+ const C = g(f);
3495
+ v.children = /* @__PURE__ */ jsxRuntimeExports.jsx(RenderGlobalBlock, { blocks: filter(C, (R) => !R._parent), allBlocks: C });
3463
3496
  }
3464
- const S = getBlockComponent(f._type), B = get(S, "server", !1), C = B ? RSCBlock : get(S, "builderComponent", get(S, "component", null));
3465
- if (isNull(C))
3497
+ const B = getBlockComponent(f._type), w = get(B, "server", !1), A = w ? RSCBlock : get(B, "builderComponent", get(B, "component", null));
3498
+ if (isNull(A))
3466
3499
  return /* @__PURE__ */ jsxRuntimeExports.jsx("noscript", { children: `<!-- ${f == null ? void 0 : f._type} not registered -->` });
3467
- const w = has(S, "getBlockStateFrom") ? S == null ? void 0 : S.getBlockStateFrom(f, n) : [], N = E(w), D = g(f);
3468
- if (get(D, "__isHidden", !1) && !includes(r, f._id))
3500
+ const N = has(B, "getBlockStateFrom") ? B == null ? void 0 : B.getBlockStateFrom(f, n) : [], D = j(N), T = x(f);
3501
+ if (get(T, "__isHidden", !1) && !includes(a, f._id))
3469
3502
  return null;
3470
- const T = l && isDescendant(l._id, f._id, n), b = {
3471
- ...includes(r, f._id) ? { "force-show": "" } : {},
3503
+ const b = i && isDescendant(i._id, f._id, n), k = {
3504
+ ...includes(a, f._id) ? { "force-show": "" } : {},
3472
3505
  "data-block-id": f._id,
3473
3506
  "data-block-type": f._type,
3474
- ...l ? (
3507
+ ...i ? (
3475
3508
  // @ts-ignore
3476
3509
  {
3477
- "data-dnd": canAcceptChildBlock(f._type, l == null ? void 0 : l._type) ? "yes" : "no",
3478
- "data-dnd-dragged": l._id === f._id || T ? "yes" : "no"
3510
+ "data-dnd": canAcceptChildBlock(f._type, i == null ? void 0 : i._type) ? "yes" : "no",
3511
+ "data-dnd-dragged": i._id === f._id || b ? "yes" : "no"
3479
3512
  }
3480
3513
  ) : {},
3481
- ...i === f._id && !T ? { "data-drop": "yes" } : {},
3482
- ...includes(a, f._id) ? { "data-cut-block": "yes" } : {}
3514
+ ...c === f._id && !b ? { "data-drop": "yes" } : {},
3515
+ ...includes(l, f._id) ? { "data-cut-block": "yes" } : {}
3483
3516
  };
3484
- return B ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: b }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(C, {
3485
- blockProps: b,
3486
- index: j,
3487
- ...applyBindings(f, x),
3488
- ...omit(D, ["__isHidden"]),
3489
- ...k,
3517
+ return w ? /* @__PURE__ */ jsxRuntimeExports.jsx(RSCBlock, { block: f, blockProps: k }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { children: React__default.createElement(A, {
3518
+ blockProps: k,
3519
+ index: _,
3520
+ ...applyBindings(applyLanguage(f, r, B), m),
3521
+ ...omit(T, ["__isHidden"]),
3522
+ ...v,
3490
3523
  inBuilder: !0,
3491
- blockState: N
3524
+ blockState: D
3492
3525
  }) });
3493
3526
  })
3494
3527
  ) });
@@ -3538,47 +3571,47 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3538
3571
  n(i);
3539
3572
  }, []), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { id: "main-content", className: "h-full w-full p-8 pb-0", ref: a, children: o });
3540
3573
  }, getElementByStyleId = (o, n) => o.querySelector(`[data-style-id="${n}"]`), StaticCanvas = () => {
3541
- const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [g, x] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [f, j] = useSelectedStylingBlocks(), k = useBuilderProp("loading", !1), A = useBuilderProp("htmlDir", "ltr"), S = (w) => {
3542
- u((N) => ({ ...N, width: w }));
3574
+ const [o] = useAtom$1(networkModeAtom), [n] = useCanvasWidth(), [, r] = useSelectedBlockIds(), a = useSelectedBlock(), [, l] = useHighlightBlockId(), i = useRef(null), c = useRef(null), [d, u] = useState({ width: 0, height: 0 }), p = useCanvasScale(d), [g, x] = useState([]), [, m] = useState([]), [, E] = useAtom$1(canvasIframeAtom), [j, f] = useSelectedStylingBlocks(), _ = useBuilderProp("loading", !1), v = useBuilderProp("htmlDir", "ltr"), S = (A) => {
3575
+ u((N) => ({ ...N, width: A }));
3543
3576
  };
3544
3577
  useEffect(() => {
3545
3578
  if (!c.current)
3546
3579
  return;
3547
- const { clientWidth: w, clientHeight: N } = c.current;
3548
- u({ width: w, height: N });
3580
+ const { clientWidth: A, clientHeight: N } = c.current;
3581
+ u({ width: A, height: N });
3549
3582
  }, [c, n]);
3550
- const B = (w, N = 0) => {
3551
- const { top: D } = w.getBoundingClientRect();
3583
+ const B = (A, N = 0) => {
3584
+ const { top: D } = A.getBoundingClientRect();
3552
3585
  return D + N >= 0 && D - N <= window.innerHeight;
3553
3586
  };
3554
3587
  useEffect(() => {
3555
- var w, N;
3588
+ var A, N;
3556
3589
  if (a && a.type !== "Multiple" && i.current) {
3557
3590
  const D = getElementByDataBlockId(i.current.contentDocument, a._id);
3558
- D && (B(D) || (N = (w = i.current) == null ? void 0 : w.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
3591
+ D && (B(D) || (N = (A = i.current) == null ? void 0 : A.contentWindow) == null || N.scrollTo({ top: D.offsetTop, behavior: "smooth" }), x([D]));
3559
3592
  }
3560
3593
  }, [a]), useEffect(() => {
3561
- if (!isEmpty(f) && i.current) {
3562
- const w = getElementByStyleId(
3594
+ if (!isEmpty(j) && i.current) {
3595
+ const A = getElementByStyleId(
3563
3596
  i.current.contentDocument,
3564
- first(f).id
3597
+ first(j).id
3565
3598
  );
3566
- m(w ? [w] : [null]);
3599
+ m(A ? [A] : [null]);
3567
3600
  } else
3568
3601
  m([null]);
3569
- }, [f]);
3570
- const C = useMemo(() => {
3571
- let w = IframeInitialContent;
3572
- return w = w.replace("__HTML_DIR__", A), o === "offline" && (w = w.replace(
3602
+ }, [j]);
3603
+ const w = useMemo(() => {
3604
+ let A = IframeInitialContent;
3605
+ return A = A.replace("__HTML_DIR__", v), o === "offline" && (A = A.replace(
3573
3606
  "https://old.chaibuilder.com/offline/tailwind.cdn.js",
3574
3607
  "/offline/tailwind.cdn.js"
3575
- ), w = w.replace("https://unpkg.com/aos@next/dist/aos.css", "/offline/aos.css"), w = w.replace("https://unpkg.com/aos@next/dist/aos.js", "/offline/aos.js")), w;
3576
- }, [o, A]);
3608
+ ), 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;
3609
+ }, [o, v]);
3577
3610
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ResizableCanvasWrapper, { onMount: S, onResize: S, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3578
3611
  "div",
3579
3612
  {
3580
3613
  onClick: () => {
3581
- r([]), j([]);
3614
+ r([]), f([]);
3582
3615
  },
3583
3616
  onMouseLeave: () => setTimeout(() => l(""), 300),
3584
3617
  className: "relative mx-auto h-full w-full overflow-hidden",
@@ -3591,7 +3624,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3591
3624
  id: "canvas-iframe",
3592
3625
  style: { ...p, ...isEmpty(p) ? { width: `${n}px` } : {} },
3593
3626
  className: "relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",
3594
- initialContent: C,
3627
+ initialContent: w,
3595
3628
  children: [
3596
3629
  /* @__PURE__ */ jsxRuntimeExports.jsx(KeyboardHandler, {}),
3597
3630
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -3603,7 +3636,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3603
3636
  ),
3604
3637
  /* @__PURE__ */ jsxRuntimeExports.jsx(HeadTags, { model: "page" }),
3605
3638
  /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Canvas, { children: [
3606
- k ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3639
+ _ ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(StaticBlocksRenderer, {}),
3607
3640
  /* @__PURE__ */ jsxRuntimeExports.jsx(AddBlockAtBottom, {}),
3608
3641
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
3609
3642
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -3714,7 +3747,7 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3714
3747
  l !== o.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3715
3748
  ] }, l))
3716
3749
  ] }) });
3717
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-4u3Q97EK.js")), CanvasArea = () => {
3750
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-7Q9lFDq1.js")), CanvasArea = () => {
3718
3751
  const [o] = useCodeEditor(), n = useBuilderProp("onError", noop);
3719
3752
  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: [
3720
3753
  /* @__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, {}) }) }),
@@ -3789,8 +3822,8 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3789
3822
  showHeading: o = !0,
3790
3823
  className: n = ""
3791
3824
  }) => {
3792
- const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: C }, w) => {
3793
- w && (a(C), i.current = C);
3825
+ const [r, a] = useBrandingOptions(), [l] = useBlocksContainer(), i = React.useRef(r), { t: c } = useTranslation(), d = ({ formData: w }, A) => {
3826
+ A && (a(w), i.current = w);
3794
3827
  }, {
3795
3828
  bodyFont: u,
3796
3829
  headingFont: p,
@@ -3798,11 +3831,11 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3798
3831
  bodyTextDarkColor: x,
3799
3832
  bodyTextLightColor: m,
3800
3833
  bodyBgDarkColor: E,
3801
- secondaryColor: f,
3802
- bodyBgLightColor: j,
3803
- roundedCorners: k
3834
+ secondaryColor: j,
3835
+ bodyBgLightColor: f,
3836
+ roundedCorners: _
3804
3837
  } = r;
3805
- let A = {
3838
+ let v = {
3806
3839
  headingFont: y({
3807
3840
  title: c("theme_config.heading_font"),
3808
3841
  default: p,
@@ -3815,16 +3848,16 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3815
3848
  }),
3816
3849
  roundedCorners: s({
3817
3850
  title: c("theme_config.rounded_corner"),
3818
- default: parseInt(k || 5, 10)
3851
+ default: parseInt(_ || 5, 10)
3819
3852
  }),
3820
3853
  primaryColor: h({ title: c("theme_config.primary"), default: g }),
3821
- secondaryColor: h({ title: c("theme_config.secondary"), default: f })
3854
+ secondaryColor: h({ title: c("theme_config.secondary"), default: j })
3822
3855
  };
3823
- l || (A = {
3824
- ...A,
3856
+ l || (v = {
3857
+ ...v,
3825
3858
  bodyBgLightColor: h({
3826
3859
  title: c("theme_config.background"),
3827
- default: j
3860
+ default: f
3828
3861
  }),
3829
3862
  bodyTextLightColor: h({
3830
3863
  title: c("theme_config.text_color"),
@@ -3843,9 +3876,9 @@ const useAllDataProviders = () => useMemo(() => getChaiDataProviders(), []), Blo
3843
3876
  type: "object",
3844
3877
  properties: {}
3845
3878
  }, B = {};
3846
- return Object.keys(A).forEach((C) => {
3847
- const w = A[C];
3848
- return S.properties || (S.properties = {}), S.properties[C] = w.schema, B[C] = w.uiSchema, !0;
3879
+ return Object.keys(v).forEach((w) => {
3880
+ const A = v[w];
3881
+ return S.properties || (S.properties = {}), S.properties[w] = A.schema, B[w] = A.uiSchema, !0;
3849
3882
  }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn("flex h-full w-full select-none flex-col", n), children: [
3850
3883
  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,
3851
3884
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -4041,34 +4074,34 @@ function BiExpandVertical(o) {
4041
4074
  const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4042
4075
  const a = useBuilderProp("outlineMenuItems", []), { t: l } = useTranslation(), [i, , c] = useHiddenBlockIds(), [, d] = useHighlightBlockId(), [u] = useAtom$1(canvasIframeAtom);
4043
4076
  let p = null;
4044
- const g = o.children.length > 0, { id: x, data: m, isSelected: E, willReceiveDrop: f, isDragging: j, isEditing: k, handleClick: A } = o, S = (T) => {
4077
+ const g = o.children.length > 0, { id: x, data: m, isSelected: E, willReceiveDrop: j, isDragging: f, isEditing: _, handleClick: v } = o, S = (T) => {
4045
4078
  T.stopPropagation(), !i.includes(x) && o.toggle();
4046
4079
  }, B = (T) => {
4047
4080
  T.isInternal && (p = T.isOpen, T.isOpen && T.close());
4048
- }, C = (T) => {
4049
- T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
4050
4081
  }, w = (T) => {
4051
- T.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), A(T);
4082
+ T.isInternal && p !== null && (p ? T.open() : T.close(), p = null);
4083
+ }, A = (T) => {
4084
+ T.stopPropagation(), !o.isOpen && !i.includes(x) && o.toggle(), v(T);
4052
4085
  };
4053
4086
  useEffect(() => {
4054
4087
  const T = setTimeout(() => {
4055
- f && !o.isOpen && !j && !i.includes(x) && o.toggle();
4088
+ j && !o.isOpen && !f && !i.includes(x) && o.toggle();
4056
4089
  }, 500);
4057
4090
  return () => clearTimeout(T);
4058
- }, [f, o, j]);
4091
+ }, [j, o, f]);
4059
4092
  const N = useMemo(() => {
4060
4093
  const T = Object.keys(m), b = [];
4061
- for (let _ = 0; _ < T.length; _++)
4062
- if (T[_].endsWith("_attrs")) {
4063
- const R = m[T[_]], v = Object.keys(R).join("|");
4064
- v.match(/x-data/) && b.push("data"), v.match(/x-on/) && b.push("event"), v.match(/x-show|x-if/) && b.push("show");
4094
+ for (let k = 0; k < T.length; k++)
4095
+ if (T[k].endsWith("_attrs")) {
4096
+ const C = m[T[k]], R = Object.keys(C).join("|");
4097
+ R.match(/x-data/) && b.push("data"), R.match(/x-on/) && b.push("event"), R.match(/x-show|x-if/) && b.push("show");
4065
4098
  }
4066
4099
  return b;
4067
4100
  }, [m]), D = (T, b) => {
4068
- const _ = u.contentDocument || u.contentWindow.document, R = _.querySelector(`[data-block-id=${T}]`);
4069
- R && R.setAttribute("data-drop", b);
4070
- const v = R.getBoundingClientRect(), I = u.getBoundingClientRect();
4071
- v.top >= I.top && v.left >= I.left && v.bottom <= I.bottom && v.right <= I.right || (_.documentElement.scrollTop = R.offsetTop - I.top);
4101
+ const k = u.contentDocument || u.contentWindow.document, C = k.querySelector(`[data-block-id=${T}]`);
4102
+ C && C.setAttribute("data-drop", b);
4103
+ const R = C.getBoundingClientRect(), I = u.getBoundingClientRect();
4104
+ R.top >= I.top && R.left >= I.left && R.bottom <= I.bottom && R.right <= I.right || (k.documentElement.scrollTop = C.offsetTop - I.top);
4072
4105
  };
4073
4106
  return x === ROOT_TEMP_KEY ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
4074
4107
  "button",
@@ -4084,12 +4117,12 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4084
4117
  "div",
4085
4118
  {
4086
4119
  onMouseEnter: () => d(x),
4087
- onClick: w,
4120
+ onClick: A,
4088
4121
  style: n,
4089
4122
  "data-node-id": x,
4090
4123
  ref: i.includes(x) ? null : r,
4091
4124
  onDragStart: () => B(o),
4092
- onDragEnd: () => C(o),
4125
+ onDragEnd: () => w(o),
4093
4126
  onDragOver: (T) => {
4094
4127
  T.preventDefault(), D(x, "yes");
4095
4128
  },
@@ -4102,8 +4135,8 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4102
4135
  className: cn(
4103
4136
  "group flex !h-full w-full items-center justify-between space-x-px !rounded py-px text-foreground/80 outline-none",
4104
4137
  E ? "bg-blue-500 text-white" : "hover:bg-gray-200 dark:hover:bg-gray-800",
4105
- f && canAcceptChildBlock(m._type, "Icon") ? "bg-green-200" : "",
4106
- j && "opacity-20",
4138
+ j && canAcceptChildBlock(m._type, "Icon") ? "bg-green-200" : "",
4139
+ f && "opacity-20",
4107
4140
  i.includes(x) ? "opacity-50" : ""
4108
4141
  ),
4109
4142
  children: [
@@ -4117,7 +4150,7 @@ const Node = memo(({ node: o, style: n, dragHandle: r }) => {
4117
4150
  ),
4118
4151
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center", children: [
4119
4152
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "-mt-0.5 h-3 w-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(TypeIcon, { type: m == null ? void 0 : m._type }) }),
4120
- k ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4153
+ _ ? /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { node: o }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
4121
4154
  "div",
4122
4155
  {
4123
4156
  className: "ml-2 flex items-center gap-x-1 truncate text-[11px]",
@@ -4582,29 +4615,29 @@ function ExpandableObject(o) {
4582
4615
  shouldExpandNode: p,
4583
4616
  clickToExpandNode: g
4584
4617
  } = o;
4585
- const x = useRef(!1), [m, E, f] = useBool(() => p(d, r, n));
4618
+ const x = useRef(!1), [m, E, j] = useBool(() => p(d, r, n));
4586
4619
  useEffect(() => {
4587
- x.current ? f(p(d, r, n)) : x.current = !0;
4620
+ x.current ? j(p(d, r, n)) : x.current = !0;
4588
4621
  }, [p]);
4589
- const j = m ? u.collapseIcon : u.expandIcon, k = m ? "collapse JSON" : "expand JSON", A = useComponentId(), S = d + 1, B = a.length - 1, C = (w) => {
4590
- w.key === " " && (w.preventDefault(), E());
4622
+ const f = m ? u.collapseIcon : u.expandIcon, _ = m ? "collapse JSON" : "expand JSON", v = useComponentId(), S = d + 1, B = a.length - 1, w = (A) => {
4623
+ A.key === " " && (A.preventDefault(), E());
4591
4624
  };
4592
4625
  return /* @__PURE__ */ createElement("div", {
4593
4626
  className: u.basicChildStyle,
4594
4627
  role: "list"
4595
4628
  }, /* @__PURE__ */ createElement("span", {
4596
- className: j,
4629
+ className: f,
4597
4630
  onClick: E,
4598
- onKeyDown: C,
4631
+ onKeyDown: w,
4599
4632
  role: "button",
4600
4633
  tabIndex: 0,
4601
- "aria-label": k,
4634
+ "aria-label": _,
4602
4635
  "aria-expanded": m,
4603
- "aria-controls": m ? A : void 0
4636
+ "aria-controls": m ? v : void 0
4604
4637
  }), n && (g ? /* @__PURE__ */ createElement("span", {
4605
4638
  className: u.clickableLabel,
4606
4639
  onClick: E,
4607
- onKeyDown: C,
4640
+ onKeyDown: w,
4608
4641
  role: "button",
4609
4642
  tabIndex: -1
4610
4643
  }, n, ":") : /* @__PURE__ */ createElement("span", {
@@ -4612,11 +4645,11 @@ function ExpandableObject(o) {
4612
4645
  }, n, ":")), /* @__PURE__ */ createElement("span", {
4613
4646
  className: u.punctuation
4614
4647
  }, i), m ? /* @__PURE__ */ createElement("div", {
4615
- id: A
4616
- }, a.map((w, N) => /* @__PURE__ */ createElement(DataRender, {
4617
- key: w[0] || N,
4618
- field: w[0],
4619
- value: w[1],
4648
+ id: v
4649
+ }, a.map((A, N) => /* @__PURE__ */ createElement(DataRender, {
4650
+ key: A[0] || N,
4651
+ field: A[0],
4652
+ value: A[1],
4620
4653
  style: u,
4621
4654
  lastElement: N === B,
4622
4655
  level: S,
@@ -4625,11 +4658,11 @@ function ExpandableObject(o) {
4625
4658
  }))) : /* @__PURE__ */ createElement("span", {
4626
4659
  className: u.collapsedContent,
4627
4660
  onClick: E,
4628
- onKeyDown: C,
4661
+ onKeyDown: w,
4629
4662
  role: "button",
4630
4663
  tabIndex: -1,
4631
4664
  "aria-hidden": !0,
4632
- "aria-label": k,
4665
+ "aria-label": _,
4633
4666
  "aria-expanded": m
4634
4667
  }), /* @__PURE__ */ createElement("span", {
4635
4668
  className: u.punctuation
@@ -4784,8 +4817,8 @@ const ViewData = ({ data: o, fullView: n }) => {
4784
4817
  appliedBindings: c
4785
4818
  }) => {
4786
4819
  const { paths: d, pathsType: u } = getPathAndTypes(a), p = o === "PROP" ? getBlockComponent(a == null ? void 0 : a._type) : {}, g = o === "PROP", [x, m] = useState(!1), E = useMemo(() => o === "PROP" ? d.filter(
4787
- (f) => !includes(c, f) && get(p, `props.${first(split(f, "."))}.binding`)
4788
- ) : d.filter((f) => i === get(u, f, "")), [o, d, c, i, p]);
4820
+ (j) => !includes(c, j) && get(p, `props.${first(split(j, "."))}.binding`)
4821
+ ) : d.filter((j) => i === get(u, j, "")), [o, d, c, i, p]);
4789
4822
  return useEffect(() => {
4790
4823
  n && l(n);
4791
4824
  }, [n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -4814,23 +4847,23 @@ const ViewData = ({ data: o, fullView: n }) => {
4814
4847
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandInput, { placeholder: `Choose ${toLower(o)}...` }),
4815
4848
  /* @__PURE__ */ jsxRuntimeExports.jsxs(CommandList, { children: [
4816
4849
  /* @__PURE__ */ jsxRuntimeExports.jsx(CommandEmpty, { children: "No results found." }),
4817
- /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4850
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CommandGroup, { children: map(E, (j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
4818
4851
  CommandItem,
4819
4852
  {
4820
- value: f,
4853
+ value: j,
4821
4854
  className: `cursor-pointer ${g ? "flex items-center justify-between" : "flex flex-col items-start justify-start"}`,
4822
- onSelect: (j) => {
4823
- r(find(E, (k) => k === j) || null), m(!1);
4855
+ onSelect: (f) => {
4856
+ r(find(E, (_) => _ === f) || null), m(!1);
4824
4857
  },
4825
4858
  children: [
4826
4859
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
4827
- /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === f ? "" : "opacity-0"}` }),
4828
- f
4860
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: `h-4 w-4 text-green-500 ${n === j ? "" : "opacity-0"}` }),
4861
+ j
4829
4862
  ] }),
4830
- 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, f, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, f) }) })
4863
+ 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, j, "")) }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pl-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ViewData, { data: get(a, j) }) })
4831
4864
  ]
4832
4865
  },
4833
- f
4866
+ j
4834
4867
  )) })
4835
4868
  ] })
4836
4869
  ] }) })
@@ -4845,15 +4878,15 @@ const ViewData = ({ data: o, fullView: n }) => {
4845
4878
  item: a
4846
4879
  }) => {
4847
4880
  const [l, i] = useState(r ? a.key : ""), [c, d] = useState(r ? a.value : ""), u = useSelectedBlock(), [p] = useChaiExternalData(), g = useCallback(
4848
- (E, f) => {
4881
+ (E, j) => {
4849
4882
  if (isEmpty(E))
4850
4883
  return "";
4851
4884
  {
4852
- const j = get(f === "PROP" ? u : p, E, "");
4853
- if (isArray$1(j))
4885
+ const f = get(j === "PROP" ? u : p, E, "");
4886
+ if (isArray$1(f))
4854
4887
  return "list";
4855
- const k = typeof j;
4856
- return k === "string" ? "text" : k === "object" ? "model" : k;
4888
+ const _ = typeof f;
4889
+ return _ === "string" ? "text" : _ === "object" ? "model" : _;
4857
4890
  }
4858
4891
  },
4859
4892
  [u, p]
@@ -4873,8 +4906,8 @@ const ViewData = ({ data: o, fullView: n }) => {
4873
4906
  value: l,
4874
4907
  setValue: i,
4875
4908
  onChange: (E) => {
4876
- const f = g(E, "PROP");
4877
- i(E), x !== f && d(""), m(f);
4909
+ const j = g(E, "PROP");
4910
+ i(E), x !== j && d(""), m(j);
4878
4911
  },
4879
4912
  data: u,
4880
4913
  dataType: x,
@@ -4891,8 +4924,8 @@ const ViewData = ({ data: o, fullView: n }) => {
4891
4924
  value: c,
4892
4925
  setValue: d,
4893
4926
  onChange: (E) => {
4894
- const f = g(E, "PATH");
4895
- d(x === f ? E : "");
4927
+ const j = g(E, "PATH");
4928
+ d(x === j ? E : "");
4896
4929
  },
4897
4930
  data: p,
4898
4931
  dataType: x,
@@ -4980,7 +5013,7 @@ const ViewData = ({ data: o, fullView: n }) => {
4980
5013
  const m = filter(i, (E) => E.key !== x.key);
4981
5014
  c([...m, x]), g([...m, x]);
4982
5015
  }, p = (x) => {
4983
- const m = filter(i, (E, f) => x !== f);
5016
+ const m = filter(i, (E, j) => x !== j);
4984
5017
  g([...m]);
4985
5018
  }, g = useCallback(
4986
5019
  (x = []) => {
@@ -5099,7 +5132,7 @@ const ViewData = ({ data: o, fullView: n }) => {
5099
5132
  }
5100
5133
  )
5101
5134
  ] });
5102
- }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-y0LQATX2.js")), UploadImages = React__default.lazy(() => import("./UploadImages-Nbpt6WL2.js")), ImagesPanel = ({
5135
+ }, UnsplashImages = React__default.lazy(() => import("./UnsplashImages-EGgHjvre.js")), UploadImages = React__default.lazy(() => import("./UploadImages-D43sz4A8.js")), ImagesPanel = ({
5103
5136
  isModalView: o = !1,
5104
5137
  onSelect: n = () => {
5105
5138
  }
@@ -5118,19 +5151,21 @@ const ViewData = ({ data: o, fullView: n }) => {
5118
5151
  ] })
5119
5152
  ] });
5120
5153
  }, ImagesPanel$1 = ImagesPanel, ImagePickerModal = ({ children: o, onSelect: n }) => {
5121
- const [r, a] = useState(!1), l = (...i) => {
5122
- n.call(void 0, ...i), a(!1);
5154
+ const [r, a] = useState(!1), l = useBuilderProp("mediaManagerComponent", ImagesPanel$1), i = (...c) => {
5155
+ n.call(void 0, ...c), a(!1);
5123
5156
  };
5124
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Dialog, { open: r, onOpenChange: (i) => a(i), children: [
5157
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Dialog, { open: r, onOpenChange: (c) => a(c), children: [
5125
5158
  /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTrigger, { asChild: !0, children: o }),
5126
- /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { className: "flex h-3/4 max-w-5xl border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ImagesPanel$1, { isModalView: !0, onSelect: l }) }) })
5159
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContent, { className: "flex h-3/4 max-w-5xl border-border", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(l, { isModalView: !0, onSelect: i }) }) })
5127
5160
  ] });
5128
- }, ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5129
- const l = useBuilderProp("uploadMediaCallback"), i = useBuilderProp("unsplashAccessKey"), { t: c } = useTranslation(), d = l === void 0, u = i === void 0;
5161
+ };
5162
+ ImagePickerModal.displayName = "ImagePickerModal";
5163
+ const ImagePickerModal$1 = ImagePickerModal, ImagePickerField = ({ value: o, onChange: n, id: r, onBlur: a }) => {
5164
+ const l = useBuilderProp("uploadMediaCallback"), i = useBuilderProp("unsplashAccessKey"), { t: c } = useTranslation(), d = l !== void 0 || i !== void 0;
5130
5165
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex items-center gap-x-3", children: [
5131
5166
  o ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: o, className: "h-20 w-20 overflow-hidden rounded-md border border-border object-cover", alt: "" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ImagePickerModal$1, { onSelect: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-20 w-20 cursor-pointer rounded-md border border-border bg-[radial-gradient(#AAA,transparent_1px)] duration-300 [background-size:10px_10px]" }) }),
5132
5167
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex w-3/5 flex-col", children: [
5133
- !(d && u) && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
5168
+ d && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
5134
5169
  /* @__PURE__ */ jsxRuntimeExports.jsx(ImagePickerModal$1, { onSelect: n, children: /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "h-6 cursor-pointer rounded-md bg-primary px-2 py-1 text-center text-xs text-white hover:bg-gray-500 dark:bg-gray-700", children: o || !isEmpty(o) ? c("Replace image") : c("Choose image") }) }),
5135
5170
  /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "-pl-4 pt-2 text-center text-xs text-gray-600", children: "OR" })
5136
5171
  ] }),
@@ -5144,8 +5179,8 @@ const ViewData = ({ data: o, fullView: n }) => {
5144
5179
  className: "text-xs",
5145
5180
  placeholder: c("enter_image_url"),
5146
5181
  value: o,
5147
- onBlur: ({ target: { value: p } }) => a(r, p),
5148
- onChange: (p) => n(p.target.value)
5182
+ onBlur: ({ target: { value: u } }) => a(r, u),
5183
+ onChange: (u) => n(u.target.value)
5149
5184
  }
5150
5185
  )
5151
5186
  ] })
@@ -5357,40 +5392,45 @@ const ViewData = ({ data: o, fullView: n }) => {
5357
5392
  }, ResetRSCBlockButton = ({ blockId: o }) => {
5358
5393
  const { t: n } = useTranslation(), { reset: r } = useRSCBlocksStore();
5359
5394
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "outline", onClick: () => r(o), children: n("Reload") });
5395
+ }, formDataWithSelectedLang = (o, n, r) => {
5396
+ const a = cloneDeep(o);
5397
+ return forEach(keys(o), (l) => {
5398
+ get(r, ["props", l, "i18n"]) && !isEmpty(n) && (a[l] = get(o, `${l}-${n}`));
5399
+ }), a;
5360
5400
  };
5361
5401
  function BlockSettings() {
5362
- const o = useSelectedBlock(), n = useUpdateBlocksPropsRealtime(), r = useUpdateBlocksProps(), a = getBlockComponent(o == null ? void 0 : o._type), l = { ...o }, [i, c] = useState(l), d = useBuilderProp("dataBindingSupport", !1), u = ({ formData: f }, j, k) => {
5363
- if (j && (i == null ? void 0 : i._id) === o._id) {
5364
- const A = j.replace("root.", "");
5365
- r([o._id], { [A]: get(f, A) }, k);
5402
+ const { selectedLang: o } = useLanguages(), n = useSelectedBlock(), r = useUpdateBlocksPropsRealtime(), a = useUpdateBlocksProps(), l = getBlockComponent(n == null ? void 0 : n._type), i = formDataWithSelectedLang(n, o, l), [c, d] = useState(i), u = useBuilderProp("dataBindingSupport", !1), p = ({ formData: f }, _, v) => {
5403
+ if (_ && (c == null ? void 0 : c._id) === n._id) {
5404
+ const S = _.replace("root.", "");
5405
+ a([n._id], { [S]: get(f, S) }, v);
5366
5406
  }
5367
- }, p = useCallback(
5368
- debounce(({ formData: f }, j, k) => {
5369
- u({ formData: f }, j, k), c(f);
5407
+ }, g = useCallback(
5408
+ debounce(({ formData: f }, _, v) => {
5409
+ p({ formData: f }, _, v), d(f);
5370
5410
  }, 1500),
5371
- [o == null ? void 0 : o._id]
5372
- ), g = ({ formData: f }, j) => {
5373
- if (j) {
5374
- const k = j.replace("root.", "");
5375
- n(
5376
- [o._id],
5377
- convertDotNotationToObject(k, get(f, k.split(".")))
5378
- ), p({ formData: f }, j, { [k]: get(i, k) });
5411
+ [n == null ? void 0 : n._id, o]
5412
+ ), x = ({ formData: f }, _) => {
5413
+ if (_) {
5414
+ const v = _.replace("root.", "");
5415
+ r(
5416
+ [n._id],
5417
+ convertDotNotationToObject(v, get(f, v.split(".")))
5418
+ ), g({ formData: f }, _, { [v]: get(c, v) });
5379
5419
  }
5380
- }, x = keys(get(l, "_bindings", {})), m = useMemo(() => {
5381
- const f = cloneDeep(get(a, "props", {}));
5382
- return each(f, (j, k) => {
5383
- get(j, "hidden", !1) && delete f[k];
5384
- }), d && each(x, (j) => delete f[j]), f;
5385
- }, [a, x, d]), E = get(a, "server", !1);
5420
+ }, m = keys(get(i, "_bindings", {})), E = useMemo(() => {
5421
+ const f = cloneDeep(get(l, "props", {}));
5422
+ return each(f, (_, v) => {
5423
+ get(_, "hidden", !1) && delete f[v];
5424
+ }), u && each(m, (_) => delete f[_]), f;
5425
+ }, [l, m, u]), j = get(l, "server", !1);
5386
5426
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "overflow-x-hidden px-px", children: [
5387
- d ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5427
+ u ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Accordion, { type: "multiple", defaultValue: ["STATIC", "BINDING"], className: "mt-4 h-full w-full", children: [
5388
5428
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionItem, { value: "BINDING", children: [
5389
5429
  /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionTrigger, { className: "py-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2", children: [
5390
5430
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5391
5431
  "div",
5392
5432
  {
5393
- className: `h-[8px] w-[8px] rounded-full ${isEmpty(get(o, "_bindings", {})) ? "bg-gray-300" : "bg-blue-500"}`
5433
+ className: `h-[8px] w-[8px] rounded-full ${isEmpty(get(n, "_bindings", {})) ? "bg-gray-300" : "bg-blue-500"}`
5394
5434
  }
5395
5435
  ),
5396
5436
  "Data Binding"
@@ -5398,9 +5438,9 @@ function BlockSettings() {
5398
5438
  /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionContent, { className: "pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
5399
5439
  DataBindingSetting$1,
5400
5440
  {
5401
- bindingData: get(o, "_bindings", {}),
5441
+ bindingData: get(n, "_bindings", {}),
5402
5442
  onChange: (f) => {
5403
- u({ formData: { _bindings: f } }, "root._bindings");
5443
+ p({ formData: { _bindings: f } }, "root._bindings");
5404
5444
  }
5405
5445
  }
5406
5446
  ) })
@@ -5411,35 +5451,35 @@ function BlockSettings() {
5411
5451
  "Static Content"
5412
5452
  ] }) }),
5413
5453
  /* @__PURE__ */ jsxRuntimeExports.jsxs(AccordionContent, { className: "pt-4", children: [
5414
- isEmpty(x) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500", children: [
5454
+ isEmpty(m) ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mb-1 mt-0 rounded-sm border border-orange-500 bg-orange-100 p-1 text-xs text-orange-500", children: [
5415
5455
  "Data binding is set for ",
5416
- /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(x, capitalize).join(", ") }),
5456
+ /* @__PURE__ */ jsxRuntimeExports.jsx("b", { children: map(m, capitalize).join(", ") }),
5417
5457
  " ",
5418
- x.length === 1 ? "property" : "properties",
5458
+ m.length === 1 ? "property" : "properties",
5419
5459
  ". Remove data binding to edit static content."
5420
5460
  ] }),
5421
5461
  /* @__PURE__ */ jsxRuntimeExports.jsx(
5422
5462
  JSONForm,
5423
5463
  {
5424
- id: o == null ? void 0 : o._id,
5425
- onChange: g,
5426
- formData: l,
5427
- properties: m
5464
+ id: n == null ? void 0 : n._id,
5465
+ onChange: x,
5466
+ formData: i,
5467
+ properties: E
5428
5468
  }
5429
5469
  )
5430
5470
  ] })
5431
5471
  ] })
5432
- ] }) : isEmpty(m) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5472
+ ] }) : isEmpty(E) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
5433
5473
  JSONForm,
5434
5474
  {
5435
- id: o == null ? void 0 : o._id,
5436
- onChange: g,
5437
- formData: l,
5438
- properties: m
5475
+ id: n == null ? void 0 : n._id,
5476
+ onChange: x,
5477
+ formData: i,
5478
+ properties: E
5439
5479
  }
5440
5480
  ),
5441
- (o == null ? void 0 : o._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
5442
- E ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: o == null ? void 0 : o._id }) : null,
5481
+ (n == null ? void 0 : n._type) === "GlobalBlock" ? /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalBlockSettings, {}) : null,
5482
+ j ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResetRSCBlockButton, { blockId: n == null ? void 0 : n._id }) : null,
5443
5483
  /* @__PURE__ */ jsxRuntimeExports.jsx(CanvasSettings, {})
5444
5484
  ] });
5445
5485
  }
@@ -5453,26 +5493,35 @@ function getChildBlocks(o, n, r) {
5453
5493
  const getBlockWithChildren = (o, n) => {
5454
5494
  let r = [];
5455
5495
  return r = flattenDeep([...r, ...getChildBlocks(n, o, r)]), r;
5456
- }, askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5457
- const [o, n] = useAtom$1(askAiProcessingAtom), [r, a] = useState(null), l = useBuilderProp("askAiCallBack", null), i = useStreamMultipleBlocksProps(), c = useUpdateMultipleBlocksProps(), [d] = useBlocksStore();
5496
+ };
5497
+ function promptWithLanguage(o, n, r) {
5498
+ if (!n || r !== "content")
5499
+ return o;
5500
+ const a = `Please provide the response in "${n}" language.`;
5501
+ return `${o}
5502
+
5503
+ ${a}`;
5504
+ }
5505
+ const askAiProcessingAtom = atom$1(!1), useAskAi = () => {
5506
+ 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;
5458
5507
  return {
5459
5508
  askAi: useCallback(
5460
- async (u, p, g, x) => {
5509
+ async (x, m, E, j) => {
5461
5510
  if (l) {
5462
5511
  n(!0), a(null);
5463
5512
  try {
5464
- const m = u === "content" ? cloneDeep(getBlockWithChildren(p, d)) : [cloneDeep(d.find((k) => k._id === p))];
5465
- set(m, "0._parent", null);
5466
- const E = await l(u, g, m), { blocks: f, error: j } = E;
5467
- if (j) {
5468
- a(j);
5513
+ const f = x === "content" ? cloneDeep(getBlockWithChildren(m, d)) : [cloneDeep(d.find((B) => B._id === m))];
5514
+ set(f, "0._parent", null);
5515
+ const _ = await l(x, promptWithLanguage(E, g, x), f), { blocks: v, error: S } = _;
5516
+ if (S) {
5517
+ a(S);
5469
5518
  return;
5470
5519
  }
5471
- u === "styles" ? c(f) : i(f), x && x(E);
5472
- } catch (m) {
5473
- a(m);
5520
+ x === "styles" ? c(v) : i(v), j && j(_);
5521
+ } catch (f) {
5522
+ a(f);
5474
5523
  } finally {
5475
- n(!1), x && x();
5524
+ n(!1), j && j();
5476
5525
  }
5477
5526
  }
5478
5527
  },
@@ -5611,25 +5660,25 @@ const AskAIStyles = ({ blockId: o }) => {
5611
5660
  keys: ["name"]
5612
5661
  });
5613
5662
  function ManualClasses() {
5614
- var w;
5615
- 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 = (w = first(n)) == null ? void 0 : w.prop, x = reject((get(r, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), m = () => {
5663
+ var A;
5664
+ const { t: o } = useTranslation(), [n] = useSelectedStylingBlocks(), r = useSelectedBlock(), a = useAddClassesToBlocks(), l = useRemoveClassesFromBlocks(), [i] = useSelectedBlockIds(), c = useBuilderProp("askAiCallBack", null), [d, u] = useState(""), { toast: p } = useToast(), g = (A = first(n)) == null ? void 0 : A.prop, x = reject((get(r, g, "").replace(STYLES_KEY, "").split(",").pop() || "").split(" "), isEmpty), m = () => {
5616
5665
  const N = d.trim().toLowerCase().replace(/ +(?= )/g, "").split(" ");
5617
5666
  a(i, N, !0), u("");
5618
- }, [E, f] = useState([]), j = ({ value: N }) => {
5667
+ }, [E, j] = useState([]), f = ({ value: N }) => {
5619
5668
  const D = N.trim().toLowerCase(), T = D.match(/.+:/g);
5620
5669
  let b = [];
5621
5670
  if (T && T.length > 0) {
5622
- const [_] = T, R = D.replace(_, "");
5623
- b = fuse.search(R).map((I) => ({
5671
+ const [k] = T, C = D.replace(k, "");
5672
+ b = fuse.search(C).map((I) => ({
5624
5673
  ...I,
5625
- item: { ...I.item, name: _ + I.item.name }
5674
+ item: { ...I.item, name: k + I.item.name }
5626
5675
  }));
5627
5676
  } else
5628
5677
  b = fuse.search(D);
5629
- return f(map(b, "item"));
5630
- }, k = () => {
5631
- f([]);
5632
- }, A = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5678
+ return j(map(b, "item"));
5679
+ }, _ = () => {
5680
+ j([]);
5681
+ }, v = (N) => N.name, S = (N) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-md p-1", children: N.name }), B = {
5633
5682
  autoComplete: "off",
5634
5683
  autoCorrect: "off",
5635
5684
  autoCapitalize: "off",
@@ -5641,7 +5690,7 @@ function ManualClasses() {
5641
5690
  },
5642
5691
  onChange: (N, { newValue: D }) => u(D),
5643
5692
  className: "w-full rounded-md text-xs px-2 hover:outline-0 bg-background border-border py-1"
5644
- }, C = () => {
5693
+ }, w = () => {
5645
5694
  if (navigator.clipboard === void 0) {
5646
5695
  p({
5647
5696
  title: o("clipboard_not_supported"),
@@ -5664,7 +5713,7 @@ function ManualClasses() {
5664
5713
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-2 text-muted-foreground", children: [
5665
5714
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: o("classes") }),
5666
5715
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
5667
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: C, className: "cursor-pointer" }) }),
5716
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CopyIcon, { onClick: w, className: "cursor-pointer" }) }),
5668
5717
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: o("copy_classes_to_clipboard") }) })
5669
5718
  ] })
5670
5719
  ] }),
@@ -5681,9 +5730,9 @@ function ManualClasses() {
5681
5730
  Autosuggest,
5682
5731
  {
5683
5732
  suggestions: E,
5684
- onSuggestionsFetchRequested: j,
5685
- onSuggestionsClearRequested: k,
5686
- getSuggestionValue: A,
5733
+ onSuggestionsFetchRequested: f,
5734
+ onSuggestionsClearRequested: _,
5735
+ getSuggestionValue: v,
5687
5736
  renderSuggestion: S,
5688
5737
  inputProps: B,
5689
5738
  containerProps: {
@@ -6117,8 +6166,8 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6117
6166
  }, ColorChoice = ({ property: o, onChange: n }) => {
6118
6167
  const r = useCurrentClassByProperty(o), a = useMemo(() => get(r, "cls", ""), [r]), { canChange: l } = useContext(StyleContext), [i, c] = useState([]), [d, u] = useState({ color: "", shade: "" }), p = a.split("-"), g = get(p, "1", ""), x = get(p, "2", ""), m = useCallback(
6119
6168
  // eslint-disable-next-line no-shadow
6120
- (f) => {
6121
- ["current", "inherit", "transparent", "black", "white"].includes(f) ? (c([]), u({ color: f })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((j) => ({ ...j, color: f, shade: j.shade ? j.shade : "500" })));
6169
+ (j) => {
6170
+ ["current", "inherit", "transparent", "black", "white"].includes(j) ? (c([]), u({ color: j })) : (c(["50", "100", "200", "300", "400", "500", "600", "700", "800", "900"]), u((f) => ({ ...f, color: j, shade: f.shade ? f.shade : "500" })));
6122
6171
  },
6123
6172
  [c, u]
6124
6173
  );
@@ -6129,16 +6178,16 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6129
6178
  }, [g]);
6130
6179
  const E = useCallback(
6131
6180
  // eslint-disable-next-line no-shadow
6132
- (f) => {
6133
- u({ color: g, shade: f });
6181
+ (j) => {
6182
+ u({ color: g, shade: j });
6134
6183
  },
6135
6184
  [g]
6136
6185
  );
6137
6186
  return useEffect(() => {
6138
6187
  u({ color: "", shade: "" });
6139
6188
  }, [r]), useEffect(() => {
6140
- const j = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6141
- j.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(j, o);
6189
+ const f = `${get(COLOR_PROP, o, "")}-${d.color}${d.shade ? `-${d.shade}` : ""}`;
6190
+ f.match(new RegExp(get(CLASSES_LIST, `${o}.regExp`, ""))) && n(f, o);
6142
6191
  }, [d, n, o]), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row divide-x divide-solid divide-border rounded-lg border border-transparent text-xs", children: [
6143
6192
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grow text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6144
6193
  DropDown,
@@ -6374,50 +6423,50 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6374
6423
  },
6375
6424
  a
6376
6425
  )) }), THROTTLE_TIME = 50, AdvanceChoices = (o) => {
6377
- const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [x, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, f] = useState(!1), [j, k] = useState(""), [A, S] = useState(!1), [B, C] = useState(!1);
6426
+ const [n, r] = useState(!1), [a, l] = useState(""), { currentClass: i, onChange: c, classPrefix: d, cssProperty: u, units: p, negative: g } = o, [x, m] = useState(u != null && u.toLowerCase().includes("width") ? "%" : p[0]), [E, j] = useState(!1), [f, _] = useState(""), [v, S] = useState(!1), [B, w] = useState(!1);
6378
6427
  useEffect(() => {
6379
- const { value: b, unit: _ } = getClassValueAndUnit(i);
6380
- if (_ === "") {
6428
+ const { value: b, unit: k } = getClassValueAndUnit(i);
6429
+ if (k === "") {
6381
6430
  l(b), m(u != null && u.toLowerCase().includes("width") ? "%" : first(p));
6382
6431
  return;
6383
6432
  }
6384
- m(_), l(_ === "class" || isEmpty(b) ? "" : b);
6433
+ m(k), l(k === "class" || isEmpty(b) ? "" : b);
6385
6434
  }, [i, u, p]);
6386
- const w = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
6435
+ const A = useThrottledCallback((b) => c(b), [c], THROTTLE_TIME), N = useThrottledCallback((b) => c(b, !1), [c], THROTTLE_TIME), D = useCallback(
6387
6436
  (b = !1) => {
6388
- const _ = getUserInputValues(`${a}`, p);
6389
- if (get(_, "error", !1)) {
6390
- f(!0);
6437
+ const k = getUserInputValues(`${a}`, p);
6438
+ if (get(k, "error", !1)) {
6439
+ j(!0);
6391
6440
  return;
6392
6441
  }
6393
- const R = get(_, "unit") !== "" ? get(_, "unit") : x;
6394
- if (R === "auto" || R === "none") {
6395
- w(`${d}${R}`);
6442
+ const C = get(k, "unit") !== "" ? get(k, "unit") : x;
6443
+ if (C === "auto" || C === "none") {
6444
+ A(`${d}${C}`);
6396
6445
  return;
6397
6446
  }
6398
- if (get(_, "value") === "")
6447
+ if (get(k, "value") === "")
6399
6448
  return;
6400
- const I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6401
- b ? N(I) : w(I);
6449
+ const I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6450
+ b ? N(I) : A(I);
6402
6451
  },
6403
- [w, N, a, x, d, p]
6452
+ [A, N, a, x, d, p]
6404
6453
  ), T = useCallback(
6405
6454
  (b) => {
6406
- const _ = getUserInputValues(`${a}`, p);
6407
- if (get(_, "error", !1)) {
6408
- f(!0);
6455
+ const k = getUserInputValues(`${a}`, p);
6456
+ if (get(k, "error", !1)) {
6457
+ j(!0);
6409
6458
  return;
6410
6459
  }
6411
6460
  if (b === "auto" || b === "none") {
6412
- w(`${d}${b}`);
6461
+ A(`${d}${b}`);
6413
6462
  return;
6414
6463
  }
6415
- if (get(_, "value") === "")
6464
+ if (get(k, "value") === "")
6416
6465
  return;
6417
- const R = get(_, "unit") !== "" ? get(_, "unit") : b, I = `${get(_, "value", "").startsWith("-") ? "-" : ""}${d}[${get(_, "value", "").replace("-", "")}${R === "-" ? "" : R}]`;
6418
- w(I);
6466
+ const C = get(k, "unit") !== "" ? get(k, "unit") : b, I = `${get(k, "value", "").startsWith("-") ? "-" : ""}${d}[${get(k, "value", "").replace("-", "")}${C === "-" ? "" : C}]`;
6467
+ A(I);
6419
6468
  },
6420
- [w, a, d, p]
6469
+ [A, a, d, p]
6421
6470
  );
6422
6471
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex w-full flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-start", children: x === "class" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
6423
6472
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { className: "w-20 rounded py-1", readOnly: !0, value: i }),
@@ -6425,7 +6474,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6425
6474
  /* @__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, {}) }) }),
6426
6475
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "Current value is using a Tailwind preset class." })
6427
6476
  ] })
6428
- ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${A ? "z-auto" : ""}`, children: [
6477
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `group relative flex items-center ${v ? "z-auto" : ""}`, children: [
6429
6478
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center rounded-md border border-border", children: [
6430
6479
  ["none", "auto"].indexOf(x) !== -1 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6431
6480
  "input",
@@ -6437,25 +6486,25 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6437
6486
  onKeyDown: (b) => {
6438
6487
  if (b.keyCode !== 38 && b.keyCode !== 40)
6439
6488
  return;
6440
- b.preventDefault(), C(!0);
6441
- const _ = parseInt$1(b.target.value);
6442
- let R = isNaN$1(_) ? 0 : _;
6443
- b.keyCode === 38 && (R += 1), b.keyCode === 40 && (R -= 1);
6444
- const v = `${R}`, L = `${v.startsWith("-") ? "-" : ""}${d}[${v.replace("-", "")}${x === "-" ? "" : x}]`;
6489
+ b.preventDefault(), w(!0);
6490
+ const k = parseInt$1(b.target.value);
6491
+ let C = isNaN$1(k) ? 0 : k;
6492
+ b.keyCode === 38 && (C += 1), b.keyCode === 40 && (C -= 1);
6493
+ const R = `${C}`, L = `${R.startsWith("-") ? "-" : ""}${d}[${R.replace("-", "")}${x === "-" ? "" : x}]`;
6445
6494
  N(L);
6446
6495
  },
6447
6496
  onKeyUp: (b) => {
6448
- B && (b.preventDefault(), C(!1));
6497
+ B && (b.preventDefault(), w(!1));
6449
6498
  },
6450
6499
  onBlur: () => D(),
6451
6500
  onChange: (b) => {
6452
- f(!1), l(b.target.value);
6501
+ j(!1), l(b.target.value);
6453
6502
  },
6454
6503
  onClick: (b) => {
6455
- var _;
6456
- (_ = b == null ? void 0 : b.target) == null || _.select(), r(!1);
6504
+ var k;
6505
+ (k = b == null ? void 0 : b.target) == null || k.select(), r(!1);
6457
6506
  },
6458
- value: A ? j : a,
6507
+ value: v ? f : a,
6459
6508
  className: "h-6 w-14 rounded rounded-r-none border border-transparent bg-background pl-2 text-sm focus-visible:outline-0".concat(
6460
6509
  " ",
6461
6510
  E ? "border-red-500 text-red-500" : "border-foreground/20"
@@ -6487,22 +6536,22 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6487
6536
  ) }) })
6488
6537
  ] })
6489
6538
  ] }),
6490
- ["none", "auto"].indexOf(x) !== -1 || A ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6539
+ ["none", "auto"].indexOf(x) !== -1 || v ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
6491
6540
  DragStyleButton,
6492
6541
  {
6493
6542
  onDragStart: () => S(!0),
6494
6543
  onDragEnd: (b) => {
6495
- if (k(() => ""), S(!1), isEmpty(b))
6544
+ if (_(() => ""), S(!1), isEmpty(b))
6496
6545
  return;
6497
- const _ = `${b}`, v = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
6498
- w(v);
6546
+ const k = `${b}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6547
+ A(R);
6499
6548
  },
6500
6549
  onDrag: (b) => {
6501
6550
  if (isEmpty(b))
6502
6551
  return;
6503
- k(b);
6504
- const _ = `${b}`, v = `${_.startsWith("-") ? "-" : ""}${d}[${_.replace("-", "")}${x === "-" ? "" : x}]`;
6505
- N(v);
6552
+ _(b);
6553
+ const k = `${b}`, R = `${k.startsWith("-") ? "-" : ""}${d}[${k.replace("-", "")}${x === "-" ? "" : x}]`;
6554
+ N(R);
6506
6555
  },
6507
6556
  currentValue: a,
6508
6557
  unit: x,
@@ -6599,21 +6648,21 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6599
6648
  "2xl": "1536px"
6600
6649
  }, getBreakpoint = (o) => `${o.toUpperCase()} ${BREAKPOINTS[o] ? `(${BREAKPOINTS[o]} & up)` : ""}`, BlockStyle = (o) => {
6601
6650
  const { t: n } = useTranslation(), { type: r = "icons", label: a, property: l, onEmitChange: i = () => {
6602
- }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), x = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [f] = useSelectedBlockIds(), j = useMemo(() => get(x, "fullCls", ""), [x]), k = useCallback(
6651
+ }, units: c, negative: d = !1 } = o, [u] = useDarkMode(), [p] = useStylingState(), [, g] = useCanvasWidth(), x = useCurrentClassByProperty(l), m = useAddClassesToBlocks(), E = useRemoveClassesFromBlocks(), [j] = useSelectedBlockIds(), f = useMemo(() => get(x, "fullCls", ""), [x]), _ = useCallback(
6603
6652
  (N, D = !0) => {
6604
6653
  const T = { dark: u, mq: g, mod: p, cls: N, property: l, fullCls: "" };
6605
6654
  (u || p !== "") && (T.mq = "xs");
6606
6655
  const b = generateFullClsName(T);
6607
- m(f, [b], D);
6656
+ m(j, [b], D);
6608
6657
  },
6609
- [f, u, g, p, l, m]
6610
- ), A = useCallback(() => {
6611
- E(f, [j]);
6612
- }, [f, j, E]), S = useMemo(() => canChangeClass(x, g), [x, g]);
6658
+ [j, u, g, p, l, m]
6659
+ ), v = useCallback(() => {
6660
+ E(j, [f]);
6661
+ }, [j, f, E]), S = useMemo(() => canChangeClass(x, g), [x, g]);
6613
6662
  useEffect(() => {
6614
6663
  i(S, x);
6615
6664
  }, [S, i, x]);
6616
- const [, , B] = useCanvasWidth(), C = useCallback(
6665
+ const [, , B] = useCanvasWidth(), w = useCallback(
6617
6666
  (N) => {
6618
6667
  B({
6619
6668
  xs: 400,
@@ -6625,9 +6674,9 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6625
6674
  }[N]);
6626
6675
  },
6627
6676
  [B]
6628
- ), w = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === g;
6629
- return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && w, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6630
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !w ? "text-foreground" : ""}`, children: n(a) }) }),
6677
+ ), A = get(x, "dark", null) === u && get(x, "mod", null) === p && get(x, "mq", null) === g;
6678
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(BlockStyleProvider, { canChange: S, canReset: x && A, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "group flex flex-row items-center py-2 first:pt-0 last:pb-0", children: [
6679
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative w-[70px] truncate text-xs text-foreground", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `text-[11px] ${x && !A ? "text-foreground" : ""}`, children: n(a) }) }),
6631
6680
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-row items-center", children: [
6632
6681
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-[150px]", children: [
6633
6682
  r === "arbitrary" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -6636,17 +6685,17 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6636
6685
  currentClass: get(x, "cls", ""),
6637
6686
  classPrefix: get(CLASS_PREFIXES, l, ""),
6638
6687
  units: c || [],
6639
- onChange: k,
6688
+ onChange: _,
6640
6689
  negative: d,
6641
6690
  cssProperty: l
6642
6691
  }
6643
6692
  ) : null,
6644
- r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: k }),
6645
- r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: k }),
6646
- r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: k }),
6647
- r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: k })
6693
+ r === "icons" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconChoices, { property: l, onChange: _ }),
6694
+ r === "range" && /* @__PURE__ */ jsxRuntimeExports.jsx(RangeChoices, { property: l, onChange: _ }),
6695
+ r === "color" && /* @__PURE__ */ jsxRuntimeExports.jsx(ColorChoice, { property: l, onChange: _ }),
6696
+ r === "dropdown" && /* @__PURE__ */ jsxRuntimeExports.jsx(DropDownChoices, { label: a, property: l, onChange: _ })
6648
6697
  ] }),
6649
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${j ? "visible" : "invisible"}`, children: w ? /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: () => A(), title: "Reset", className: "flex px-1.5 text-xs", children: /* @__PURE__ */ jsxRuntimeExports.jsx(CrossCircledIcon, { className: "h-5 w-5 text-blue-500 hover:opacity-80" }) }) : S && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6698
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `w-[30px] cursor-pointer ${f ? "visible" : "invisible"}`, children: A ? /* @__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" }) }) : S && x ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { delayDuration: 100, children: [
6650
6699
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6651
6700
  "button",
6652
6701
  {
@@ -6666,7 +6715,7 @@ const RangeChoices = ({ property: o, onChange: n }) => {
6666
6715
  "button",
6667
6716
  {
6668
6717
  type: "button",
6669
- onClick: () => C(get(x, "mq")),
6718
+ onClick: () => w(get(x, "mq")),
6670
6719
  className: "block w-full cursor-default text-right font-semibold text-blue-500",
6671
6720
  children: [
6672
6721
  "Switch to ",
@@ -6836,8 +6885,8 @@ function BlockStyling() {
6836
6885
  m = isNaN(m) ? 0 : m;
6837
6886
  let E = MAPPER[i.dragUnit];
6838
6887
  (startsWith(x, "scale") || x === "opacity") && (E = 10);
6839
- let j = (i.dragStartY - p.pageY) / E + m;
6840
- g && j < 0 && (j = 0), x === "opacity" && j > 1 && (j = 1), i.onDrag(`${j}`), l(`${j}`);
6888
+ let f = (i.dragStartY - p.pageY) / E + m;
6889
+ g && f < 0 && (f = 0), x === "opacity" && f > 1 && (f = 1), i.onDrag(`${f}`), l(`${f}`);
6841
6890
  },
6842
6891
  [i],
6843
6892
  50
@@ -6923,32 +6972,32 @@ const BlockCard = ({
6923
6972
  library: n,
6924
6973
  parentId: r = void 0
6925
6974
  }) => {
6926
- const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), g = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, m] = useAtom$1(draggedBlockAtom), E = (k) => {
6927
- const A = has(k, "styles_attrs.data-page-section");
6928
- return k._type === "Box" && A;
6929
- }, f = useCallback(
6930
- async (k) => {
6931
- if (k.stopPropagation(), has(o, "component")) {
6975
+ const [a, l] = useState(!1), i = useBuilderProp("getUILibraryBlock", noop), { addCoreBlock: c, addPredefinedBlock: d } = useAddBlock(), [, u] = useSelectedBlockIds(), [, p] = useHighlightBlockId(), g = get(o, "name", get(o, "label")), x = useFeature("dnd"), [, m] = useAtom$1(draggedBlockAtom), E = (_) => {
6976
+ const v = has(_, "styles_attrs.data-page-section");
6977
+ return _._type === "Box" && v;
6978
+ }, j = useCallback(
6979
+ async (_) => {
6980
+ if (_.stopPropagation(), has(o, "component")) {
6932
6981
  c(o, r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6933
6982
  return;
6934
6983
  }
6935
6984
  l(!0);
6936
- const A = await i(n, o);
6937
- isEmpty(A) || d(syncBlocksWithDefaults(A), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6985
+ const v = await i(n, o);
6986
+ isEmpty(v) || d(syncBlocksWithDefaults(v), r), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6938
6987
  },
6939
6988
  [o]
6940
- ), j = async (k) => {
6941
- const A = await i(n, o);
6989
+ ), f = async (_) => {
6990
+ const v = await i(n, o);
6942
6991
  let S = r;
6943
- if (E(first(A)) && (S = null), !isEmpty(A)) {
6944
- const B = { blocks: A, uiLibrary: !0, parent: S };
6945
- if (k.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
6946
- const C = new Image();
6947
- C.src = o.preview, C.onload = () => {
6948
- k.dataTransfer.setDragImage(C, 0, 0);
6992
+ if (E(first(v)) && (S = null), !isEmpty(v)) {
6993
+ const B = { blocks: v, uiLibrary: !0, parent: S };
6994
+ if (_.dataTransfer.setData("text/plain", JSON.stringify(B)), o.preview) {
6995
+ const w = new Image();
6996
+ w.src = o.preview, w.onload = () => {
6997
+ _.dataTransfer.setDragImage(w, 0, 0);
6949
6998
  };
6950
6999
  } else
6951
- k.dataTransfer.setDragImage(new Image(), 0, 0);
7000
+ _.dataTransfer.setDragImage(new Image(), 0, 0);
6952
7001
  m(B), setTimeout(() => {
6953
7002
  u([]), p(null), emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
6954
7003
  }, 200);
@@ -6959,9 +7008,9 @@ const BlockCard = ({
6959
7008
  "div",
6960
7009
  {
6961
7010
  onClick: a ? () => {
6962
- } : f,
7011
+ } : j,
6963
7012
  draggable: x ? "true" : "false",
6964
- onDragStart: j,
7013
+ onDragStart: f,
6965
7014
  className: clsx(
6966
7015
  "relative mt-2 cursor-pointer overflow-hidden rounded-md border border-border bg-white duration-200 hover:border-blue-500 hover:shadow-xl"
6967
7016
  ),
@@ -6990,7 +7039,7 @@ const BlockCard = ({
6990
7039
  })();
6991
7040
  }, [o, l, i, c]), { data: l || [], isLoading: i === "loading" };
6992
7041
  }, UILibrarySection = ({ parentId: o }) => {
6993
- const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [g, x] = useState("Hero"), m = get(p, g, []), E = useRef(null), { t: f } = useTranslation(), j = (S) => {
7042
+ const [n, r] = useAtom$1(selectedLibraryAtom), a = useBuilderProp("uiLibraries", []), l = useChaiBlocks(), i = values(l).filter((S) => S.category === "custom"), c = a.find((S) => S.uuid === n) || first(a), { data: d, isLoading: u } = useLibraryBlocks(c), p = groupBy([...d, ...i], "group"), [g, x] = useState("Hero"), m = get(p, g, []), E = useRef(null), { t: j } = useTranslation(), f = (S) => {
6994
7043
  E.current && (clearTimeout(E.current), E.current = null), E.current = setTimeout(() => {
6995
7044
  E.current && x(S);
6996
7045
  }, 300);
@@ -7000,18 +7049,18 @@ const BlockCard = ({
7000
7049
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-3 h-full" }),
7001
7050
  /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "col-span-9 h-full" })
7002
7051
  ] });
7003
- const k = filter(m, (S, B) => B % 2 === 0), A = filter(m, (S, B) => B % 2 === 1);
7052
+ const _ = filter(m, (S, B) => B % 2 === 0), v = filter(m, (S, B) => B % 2 === 1);
7004
7053
  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: [
7005
7054
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full max-h-full w-60 flex-col gap-1 px-1 pr-2", children: [
7006
7055
  /* @__PURE__ */ jsxRuntimeExports.jsx(UILibrariesSelect, { library: c == null ? void 0 : c.uuid, setLibrary: r, uiLibraries: a }),
7007
7056
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex h-full max-h-full w-full flex-1 flex-col", children: [
7008
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: f("groups") }),
7057
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-bold text-gray-500", children: j("groups") }),
7009
7058
  /* @__PURE__ */ jsxRuntimeExports.jsx("hr", { className: "mt-1 border-border" }),
7010
7059
  /* @__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(
7011
7060
  map(p, (S, B) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
7012
7061
  "div",
7013
7062
  {
7014
- onMouseEnter: () => j(B),
7063
+ onMouseEnter: () => f(B),
7015
7064
  onMouseLeave: () => clearTimeout(E.current),
7016
7065
  onClick: () => x(B),
7017
7066
  className: cn(
@@ -7019,7 +7068,7 @@ const BlockCard = ({
7019
7068
  B === g ? "bg-blue-500 text-white hover:bg-blue-600" : ""
7020
7069
  ),
7021
7070
  children: [
7022
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(f(B.toLowerCase())) }),
7071
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: capitalize(j(B.toLowerCase())) }),
7023
7072
  /* @__PURE__ */ jsxRuntimeExports.jsx(CaretRightIcon, { className: "ml-2 h-5 w-5" })
7024
7073
  ]
7025
7074
  },
@@ -7036,10 +7085,10 @@ const BlockCard = ({
7036
7085
  children: [
7037
7086
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-2 px-2", children: [
7038
7087
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7039
- k.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7088
+ _.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7040
7089
  ) }),
7041
7090
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-1", children: React__default.Children.toArray(
7042
- A.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7091
+ v.map((S) => /* @__PURE__ */ jsxRuntimeExports.jsx(BlockCard, { parentId: o, block: S, library: c }))
7043
7092
  ) })
7044
7093
  ] }),
7045
7094
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -7486,8 +7535,8 @@ i18n.use(initReactI18next).init({
7486
7535
  const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7487
7536
  const [, a] = useAtom$1(draggedBlockAtom), { type: l, icon: i, label: c } = o, { addCoreBlock: d, addPredefinedBlock: u } = useAddBlock(), [, p] = useSelectedBlockIds(), [, g] = useHighlightBlockId(), x = () => {
7488
7537
  if (has(o, "blocks")) {
7489
- const f = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7490
- u(syncBlocksWithDefaults(f), r || null);
7538
+ const j = isFunction$1(o.blocks) ? o.blocks() : o.blocks;
7539
+ u(syncBlocksWithDefaults(j), r || null);
7491
7540
  } else
7492
7541
  d(o, r || null);
7493
7542
  emitChaiBuilderMsg({ name: CHAI_BUILDER_EVENTS.CLOSE_ADD_BLOCK });
@@ -7499,8 +7548,8 @@ const CoreBlock = ({ block: o, disabled: n, parentId: r }) => {
7499
7548
  disabled: n,
7500
7549
  onClick: x,
7501
7550
  type: "button",
7502
- onDragStart: (f) => {
7503
- f.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), f.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7551
+ onDragStart: (j) => {
7552
+ j.dataTransfer.setData("text/plain", JSON.stringify(omit(o, ["component", "icon"]))), j.dataTransfer.setDragImage(new Image(), 0, 0), a(omit(o, ["component", "icon"])), setTimeout(() => {
7504
7553
  p([]), g(null);
7505
7554
  }, 200);
7506
7555
  },
@@ -7675,12 +7724,12 @@ function QuickPrompts({ onClick: o }) {
7675
7724
  const AIUserPrompt = ({ blockId: o }) => {
7676
7725
  const { t: n } = useTranslation(), { askAi: r, loading: a, error: l } = useAskAi(), [i, c] = useState(""), [d, u] = useState(!0), [p, g] = useState(), x = useRef(null), m = useRef(null);
7677
7726
  useEffect(() => {
7678
- var f;
7679
- (f = x.current) == null || f.focus();
7727
+ var j;
7728
+ (j = x.current) == null || j.focus();
7680
7729
  }, []);
7681
- const E = (f) => {
7682
- const { usage: j } = f || {};
7683
- !l && j && g(j), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
7730
+ const E = (j) => {
7731
+ const { usage: f } = j || {};
7732
+ !l && f && g(f), m.current = setTimeout(() => g(void 0), 1e4), l || c("");
7684
7733
  };
7685
7734
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "", children: [
7686
7735
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -7700,12 +7749,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7700
7749
  {
7701
7750
  ref: x,
7702
7751
  value: i,
7703
- onChange: (f) => c(f.target.value),
7752
+ onChange: (j) => c(j.target.value),
7704
7753
  placeholder: n("Ask AI to edit content"),
7705
7754
  className: "w-full",
7706
7755
  rows: 3,
7707
- onKeyDown: (f) => {
7708
- f.key === "Enter" && (f.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E));
7756
+ onKeyDown: (j) => {
7757
+ j.key === "Enter" && (j.preventDefault(), m.current && clearTimeout(m.current), g(void 0), r("content", o, i, E));
7709
7758
  }
7710
7759
  }
7711
7760
  ),
@@ -7747,8 +7796,8 @@ const AIUserPrompt = ({ blockId: o }) => {
7747
7796
  /* @__PURE__ */ jsxRuntimeExports.jsx(
7748
7797
  QuickPrompts,
7749
7798
  {
7750
- onClick: (f) => {
7751
- m.current && clearTimeout(m.current), g(void 0), r("content", o, f, E);
7799
+ onClick: (j) => {
7800
+ m.current && clearTimeout(m.current), g(void 0), r("content", o, j, E);
7752
7801
  }
7753
7802
  }
7754
7803
  )
@@ -7769,8 +7818,8 @@ const AIUserPrompt = ({ blockId: o }) => {
7769
7818
  description: o("You can now Ask AI to edit your content"),
7770
7819
  variant: "default"
7771
7820
  }), m.current.click();
7772
- } catch (f) {
7773
- p(f);
7821
+ } catch (j) {
7822
+ p(j);
7774
7823
  } finally {
7775
7824
  d(!1);
7776
7825
  }
@@ -7778,8 +7827,8 @@ const AIUserPrompt = ({ blockId: o }) => {
7778
7827
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
7779
7828
  Accordion,
7780
7829
  {
7781
- onValueChange: (f) => {
7782
- g(f !== "");
7830
+ onValueChange: (j) => {
7831
+ g(j !== "");
7783
7832
  },
7784
7833
  type: "single",
7785
7834
  collapsible: !0,
@@ -7791,12 +7840,12 @@ const AIUserPrompt = ({ blockId: o }) => {
7791
7840
  {
7792
7841
  ref: l,
7793
7842
  value: r,
7794
- onChange: (f) => a(f.target.value),
7843
+ onChange: (j) => a(j.target.value),
7795
7844
  placeholder: o("Tell about this page eg this page is about"),
7796
7845
  className: "mt-1 w-full",
7797
7846
  rows: 10,
7798
- onKeyDown: (f) => {
7799
- f.key === "Enter" && (f.preventDefault(), E());
7847
+ onKeyDown: (j) => {
7848
+ j.key === "Enter" && (j.preventDefault(), E());
7800
7849
  }
7801
7850
  }
7802
7851
  ),
@@ -7858,42 +7907,42 @@ const AIUserPrompt = ({ blockId: o }) => {
7858
7907
  /* @__PURE__ */ jsxRuntimeExports.jsx(AIUserPrompt, { blockId: first(o) })
7859
7908
  ] });
7860
7909
  }, AttrsEditor = React__default.memo(function o({ preloadedAttributes: n = [], onAttributesChange: r }) {
7861
- const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [x, m] = useState(""), E = useRef(null), f = useRef(null);
7910
+ const [a, l] = useState([]), [i, c] = useState(""), [d, u] = useState(""), [p, g] = useState(null), [x, m] = useState(""), E = useRef(null), j = useRef(null);
7862
7911
  useEffect(() => {
7863
7912
  l(n);
7864
7913
  }, [n]);
7865
- const j = () => {
7914
+ const f = () => {
7866
7915
  if (i.startsWith("@")) {
7867
7916
  m("Attribute keys cannot start with '@'");
7868
7917
  return;
7869
7918
  }
7870
7919
  if (i) {
7871
- const C = [...a, { key: i, value: d }];
7872
- r(C), l(a), c(""), u(""), m("");
7920
+ const w = [...a, { key: i, value: d }];
7921
+ r(w), l(a), c(""), u(""), m("");
7873
7922
  }
7874
- }, k = (C) => {
7875
- const w = a.filter((N, D) => D !== C);
7876
- r(w), l(w);
7877
- }, A = (C) => {
7878
- g(C), c(a[C].key), u(a[C].value);
7923
+ }, _ = (w) => {
7924
+ const A = a.filter((N, D) => D !== w);
7925
+ r(A), l(A);
7926
+ }, v = (w) => {
7927
+ g(w), c(a[w].key), u(a[w].value);
7879
7928
  }, S = () => {
7880
7929
  if (i.startsWith("@")) {
7881
7930
  m("Attribute keys cannot start with '@'");
7882
7931
  return;
7883
7932
  }
7884
7933
  if (p !== null && i) {
7885
- const C = [...a];
7886
- C[p] = { key: i, value: d }, r(C), l(C), g(null), c(""), u(""), m("");
7934
+ const w = [...a];
7935
+ w[p] = { key: i, value: d }, r(w), l(w), g(null), c(""), u(""), m("");
7887
7936
  }
7888
- }, B = (C) => {
7889
- C.key === "Enter" && !C.shiftKey && (C.preventDefault(), p !== null ? S() : j());
7937
+ }, B = (w) => {
7938
+ w.key === "Enter" && !w.shiftKey && (w.preventDefault(), p !== null ? S() : f());
7890
7939
  };
7891
7940
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-full", children: [
7892
7941
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
7893
7942
  "form",
7894
7943
  {
7895
- onSubmit: (C) => {
7896
- C.preventDefault(), p !== null ? S() : j();
7944
+ onSubmit: (w) => {
7945
+ w.preventDefault(), p !== null ? S() : f();
7897
7946
  },
7898
7947
  className: "space-y-3",
7899
7948
  children: [
@@ -7909,7 +7958,7 @@ const AIUserPrompt = ({ blockId: o }) => {
7909
7958
  id: "attrKey",
7910
7959
  ref: E,
7911
7960
  value: i,
7912
- onChange: (C) => c(C.target.value),
7961
+ onChange: (w) => c(w.target.value),
7913
7962
  placeholder: "Key",
7914
7963
  className: "h-8 text-sm"
7915
7964
  }
@@ -7925,9 +7974,9 @@ const AIUserPrompt = ({ blockId: o }) => {
7925
7974
  spellCheck: "false",
7926
7975
  id: "attrValue",
7927
7976
  rows: 2,
7928
- ref: f,
7977
+ ref: j,
7929
7978
  value: d,
7930
- onChange: (C) => u(C.target.value),
7979
+ onChange: (w) => u(w.target.value),
7931
7980
  onKeyDown: B,
7932
7981
  placeholder: "Value",
7933
7982
  className: "bg-background text-sm"
@@ -7940,22 +7989,22 @@ const AIUserPrompt = ({ blockId: o }) => {
7940
7989
  ]
7941
7990
  }
7942
7991
  ),
7943
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((C, w) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
7992
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 space-y-1 overflow-y-auto", children: a.map((w, A) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded bg-muted p-1.5 text-sm", children: [
7944
7993
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mr-2 flex flex-col", children: [
7945
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: C.key }),
7946
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: C.value.toString() })
7994
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate font-semibold", children: w.key }),
7995
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-wrap max-w-[200px] text-muted-foreground", children: w.value.toString() })
7947
7996
  ] }),
7948
7997
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-shrink-0", children: [
7949
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => A(w), children: [
7998
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => v(A), children: [
7950
7999
  /* @__PURE__ */ jsxRuntimeExports.jsx(Edit2, { className: "h-3 w-3" }),
7951
8000
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Edit attribute" })
7952
8001
  ] }),
7953
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => k(w), children: [
8002
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "icon", className: "h-6 w-6", onClick: () => _(A), children: [
7954
8003
  /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "h-3 w-3" }),
7955
8004
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sr-only", children: "Remove attribute" })
7956
8005
  ] })
7957
8006
  ] })
7958
- ] }, w)) })
8007
+ ] }, A)) })
7959
8008
  ] });
7960
8009
  }), BlockAttributesEditor = React.memo(() => {
7961
8010
  const o = useSelectedBlock(), [n, r] = useState([]), [a] = useSelectedStylingBlocks(), l = useUpdateBlocksProps(), i = `${get(a, "0.prop")}_attrs`;
@@ -8140,6 +8189,222 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8140
8189
  ] })
8141
8190
  ] })
8142
8191
  ] }) });
8192
+ }, LANGUAGES = {
8193
+ ab: "Abkhazian",
8194
+ aa: "Afar",
8195
+ af: "Afrikaans",
8196
+ ak: "Akan",
8197
+ sq: "Albanian",
8198
+ am: "Amharic",
8199
+ ar: "Arabic",
8200
+ an: "Aragonese",
8201
+ hy: "Armenian",
8202
+ as: "Assamese",
8203
+ av: "Avaric",
8204
+ ae: "Avestan",
8205
+ ay: "Aymara",
8206
+ az: "Azerbaijani",
8207
+ bm: "Bambara",
8208
+ ba: "Bashkir",
8209
+ eu: "Basque",
8210
+ be: "Belarusian",
8211
+ bn: "Bengali",
8212
+ bh: "Bihari",
8213
+ bi: "Bislama",
8214
+ bs: "Bosnian",
8215
+ br: "Breton",
8216
+ bg: "Bulgarian",
8217
+ my: "Burmese",
8218
+ ca: "Catalan",
8219
+ ch: "Chamorro",
8220
+ ce: "Chechen",
8221
+ ny: "Chichewa",
8222
+ zh: "Chinese",
8223
+ "zh-Hans": "Chinese (Simplified)",
8224
+ "zh-Hant": "Chinese (Traditional)",
8225
+ cv: "Chuvash",
8226
+ kw: "Cornish",
8227
+ co: "Corsican",
8228
+ cr: "Cree",
8229
+ hr: "Croatian",
8230
+ cs: "Czech",
8231
+ da: "Danish",
8232
+ dv: "Maldivian",
8233
+ nl: "Dutch",
8234
+ dz: "Dzongkha",
8235
+ en: "English",
8236
+ eo: "Esperanto",
8237
+ et: "Estonian",
8238
+ ee: "Ewe",
8239
+ fo: "Faroese",
8240
+ fj: "Fijian",
8241
+ fi: "Finnish",
8242
+ fr: "French",
8243
+ ff: "Fula, Pular",
8244
+ gl: "Galician",
8245
+ gd: "Gaelic (Scottish)",
8246
+ gv: "Manx",
8247
+ ka: "Georgian",
8248
+ de: "German",
8249
+ el: "Greek",
8250
+ kl: "Kalaallisut",
8251
+ gn: "Guarani",
8252
+ gu: "Gujarati",
8253
+ ht: "Haitian Creole",
8254
+ ha: "Hausa",
8255
+ he: "Hebrew",
8256
+ hz: "Herero",
8257
+ hi: "Hindi",
8258
+ ho: "Hiri Motu",
8259
+ hu: "Hungarian",
8260
+ is: "Icelandic",
8261
+ io: "Ido",
8262
+ ig: "Igbo",
8263
+ id: "Indonesian",
8264
+ ia: "Interlingua",
8265
+ ie: "Interlingue",
8266
+ iu: "Inuktitut",
8267
+ ik: "Inupiak",
8268
+ ga: "Irish",
8269
+ it: "Italian",
8270
+ ja: "Japanese",
8271
+ jv: "Javanese",
8272
+ kn: "Kannada",
8273
+ kr: "Kanuri",
8274
+ ks: "Kashmiri",
8275
+ kk: "Kazakh",
8276
+ km: "Khmer",
8277
+ ki: "Kikuyu",
8278
+ rw: "Kinyarwanda",
8279
+ rn: "Kirundi",
8280
+ ky: "Kyrgyz",
8281
+ kv: "Komi",
8282
+ kg: "Kongo",
8283
+ ko: "Korean",
8284
+ ku: "Kurdish",
8285
+ kj: "Kwanyama",
8286
+ lo: "Lao",
8287
+ la: "Latin",
8288
+ lv: "Latvian",
8289
+ li: "Limburgish",
8290
+ ln: "Lingala",
8291
+ lt: "Lithuanian",
8292
+ lu: "Luga-Katanga",
8293
+ lg: "Luganda, Ganda",
8294
+ lb: "Luxembourgish",
8295
+ mk: "Macedonian",
8296
+ mg: "Malagasy",
8297
+ ms: "Malay",
8298
+ ml: "Malayalam",
8299
+ mt: "Maltese",
8300
+ mi: "Maori",
8301
+ mr: "Marathi",
8302
+ mh: "Marshallese",
8303
+ mo: "Moldavian",
8304
+ mn: "Mongolian",
8305
+ na: "Nauru",
8306
+ nv: "Navajo",
8307
+ ng: "Ndonga",
8308
+ nd: "Northern Ndebele",
8309
+ ne: "Nepali",
8310
+ no: "Norwegian",
8311
+ nb: "Norwegian bokmål",
8312
+ nn: "Norwegian nynorsk",
8313
+ ii: "Sichuan Yi",
8314
+ oc: "Occitan",
8315
+ oj: "Ojibwe",
8316
+ cu: "Old Church Slavonic",
8317
+ or: "Oriya",
8318
+ om: "Oromo",
8319
+ os: "Ossetian",
8320
+ pi: "Pāli",
8321
+ ps: "Pashto, Pushto",
8322
+ fa: "Persian (Farsi)",
8323
+ pl: "Polish",
8324
+ pt: "Portuguese",
8325
+ pa: "Punjabi (Eastern)",
8326
+ qu: "Quechua",
8327
+ rm: "Romansh",
8328
+ ro: "Romanian",
8329
+ ru: "Russian",
8330
+ se: "Sami",
8331
+ sm: "Samoan",
8332
+ sg: "Sango",
8333
+ sa: "Sanskrit",
8334
+ sr: "Serbian",
8335
+ sh: "Serbo-Croatian",
8336
+ st: "Sesotho",
8337
+ tn: "Setswana",
8338
+ sn: "Shona",
8339
+ sd: "Sindhi",
8340
+ si: "Sinhalese",
8341
+ ss: "Swati",
8342
+ sk: "Slovak",
8343
+ sl: "Slovenian",
8344
+ so: "Somali",
8345
+ nr: "Southern Ndebele",
8346
+ es: "Spanish",
8347
+ su: "Sundanese",
8348
+ sw: "Swahili (Kiswahili)",
8349
+ sv: "Swedish",
8350
+ tl: "Tagalog",
8351
+ ty: "Tahitian",
8352
+ tg: "Tajik",
8353
+ ta: "Tamil",
8354
+ tt: "Tatar",
8355
+ te: "Telugu",
8356
+ th: "Thai",
8357
+ bo: "Tibetan",
8358
+ ti: "Tigrinya",
8359
+ to: "Tonga",
8360
+ ts: "Tsonga",
8361
+ tr: "Turkish",
8362
+ tk: "Turkmen",
8363
+ tw: "Twi",
8364
+ ug: "Uyghur",
8365
+ uk: "Ukrainian",
8366
+ ur: "Urdu",
8367
+ uz: "Uzbek",
8368
+ ve: "Venda",
8369
+ vi: "Vietnamese",
8370
+ vo: "Volapük",
8371
+ wa: "Wallon",
8372
+ cy: "Welsh",
8373
+ wo: "Wolof",
8374
+ fy: "Western Frisian",
8375
+ xh: "Xhosa",
8376
+ yi: "Yiddish",
8377
+ yo: "Yoruba",
8378
+ za: "Zhuang, Chuang",
8379
+ zu: "Zulu"
8380
+ }, LanguageSelector = () => {
8381
+ const { fallbackLang: o, languages: n, selectedLang: r, setSelectedLang: a } = useLanguages(), l = (r == null ? void 0 : r.length) > 0 ? r : o, i = useMemo(() => {
8382
+ const c = [];
8383
+ return forEach(uniq([...n, o]), (d) => {
8384
+ const u = get(LANGUAGES, d);
8385
+ u && c.push({ key: d, value: u, default: d === o });
8386
+ }), c;
8387
+ }, [o, n]);
8388
+ return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-x-1 text-sm", children: [
8389
+ /* @__PURE__ */ jsxRuntimeExports.jsx(GlobeIcon$1, { className: "h-4 w-4" }),
8390
+ get(LANGUAGES, l),
8391
+ l === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-green-400", children: "Default" })
8392
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
8393
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: !0, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "outline", className: "flex items-center gap-x-1 text-blue-500 hover:text-blue-600", children: [
8394
+ /* @__PURE__ */ jsxRuntimeExports.jsx(GlobeIcon$1, { className: "h-4 w-4" }),
8395
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-end", children: [
8396
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
8397
+ " ",
8398
+ get(LANGUAGES, l)
8399
+ ] }),
8400
+ l === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-gray-400", children: "Default" })
8401
+ ] })
8402
+ ] }) }),
8403
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuContent, { children: map(i, (c) => /* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { className: "flex cursor-pointer items-end", onClick: () => a(c.key), children: [
8404
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: c.value }),
8405
+ c.key === o && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "h-full pl-1 text-[10px] leading-4 text-green-400", children: "Default" })
8406
+ ] })) })
8407
+ ] });
8143
8408
  }, CanvasTopBar = () => {
8144
8409
  const o = useBuilderProp("darkMode", !0), [n] = useCanvasZoom();
8145
8410
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-10 items-center justify-between border-b border-border bg-background/70 px-2", children: [
@@ -8161,7 +8426,10 @@ const TabletIcon = ({ landscape: o = !1 }) => /* @__PURE__ */ jsxRuntimeExports.
8161
8426
  /* @__PURE__ */ jsxRuntimeExports.jsx(Separator, { orientation: "vertical" }),
8162
8427
  /* @__PURE__ */ jsxRuntimeExports.jsx(UndoRedo, {})
8163
8428
  ] }),
8164
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full items-center space-x-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ClearCanvas, {}) })
8429
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex h-full items-center space-x-2", children: [
8430
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LanguageSelector, {}),
8431
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ClearCanvas, {})
8432
+ ] })
8165
8433
  ] });
8166
8434
  };
8167
8435
  function BlockAttributesToggle() {
@@ -8372,16 +8640,16 @@ function RemoveProviderConfirmation({
8372
8640
  }
8373
8641
  const PageDataProviders = () => {
8374
8642
  const { t: o } = useTranslation(), n = useMemo(() => getChaiDataProviders(), []), [r, a] = usePageDataProviders(), [, l] = useAtom$1(builderSaveStateAtom), [i, c] = useState(
8375
- filter(n, (j) => map(r, "providerKey").includes(j.providerKey))
8643
+ filter(n, (f) => map(r, "providerKey").includes(f.providerKey))
8376
8644
  ), [d, u] = useState(""), [p, g] = useState(null), x = filter(
8377
- n.map((j) => map(i, "providerKey").includes(j.providerKey) ? null : { value: j.providerKey, label: j.name }),
8378
- (j) => !isNull(j)
8379
- ), m = (j) => {
8380
- const k = find(n, { providerKey: j });
8381
- c((A) => [...A, k]), a((A) => [...A, { providerKey: k.providerKey, args: {} }]), u(""), l("UNSAVED");
8382
- }, E = (j) => {
8383
- c((k) => filter(k, (A) => A.providerKey !== j.providerKey)), a((k) => filter(k, (A) => A.providerKey !== j.providerKey)), l("UNSAVED");
8384
- }, f = (j) => g(j);
8645
+ n.map((f) => map(i, "providerKey").includes(f.providerKey) ? null : { value: f.providerKey, label: f.name }),
8646
+ (f) => !isNull(f)
8647
+ ), m = (f) => {
8648
+ const _ = find(n, { providerKey: f });
8649
+ c((v) => [...v, _]), a((v) => [...v, { providerKey: _.providerKey, args: {} }]), u(""), l("UNSAVED");
8650
+ }, E = (f) => {
8651
+ c((_) => filter(_, (v) => v.providerKey !== f.providerKey)), a((_) => filter(_, (v) => v.providerKey !== f.providerKey)), l("UNSAVED");
8652
+ }, j = (f) => g(f);
8385
8653
  return isEmpty(n) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "mb-1.5 p-4 text-xs text-gray-500", children: [
8386
8654
  o("no_data_providers"),
8387
8655
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8389,11 +8657,11 @@ const PageDataProviders = () => {
8389
8657
  ] }) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-1", children: [
8390
8658
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
8391
8659
  /* @__PURE__ */ jsxRuntimeExports.jsx("label", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-1.5 text-xs text-gray-500", children: o("add_data_providers") }) }),
8392
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (j) => m(j), children: [
8660
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center space-x-1", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: d, onValueChange: (f) => m(f), children: [
8393
8661
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: o("select_provider") }) }),
8394
8662
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
8395
8663
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "", children: o("choose") }),
8396
- x.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: j.value, children: j.label }, j.value))
8664
+ x.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: f.value, children: f.label }, f.value))
8397
8665
  ] })
8398
8666
  ] }) }),
8399
8667
  /* @__PURE__ */ jsxRuntimeExports.jsx("br", {}),
@@ -8402,21 +8670,21 @@ const PageDataProviders = () => {
8402
8670
  o("page_data_providers"),
8403
8671
  ":"
8404
8672
  ] }),
8405
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((j) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8673
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-2", children: i.map((f) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
8406
8674
  "div",
8407
8675
  {
8408
8676
  className: "w-full rounded-lg border border-border bg-card text-card-foreground shadow-sm",
8409
8677
  "data-v0-t": "card",
8410
8678
  children: [
8411
8679
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col space-y-1.5 px-4 pt-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
8412
- /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: j.name }),
8413
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: j.description })
8680
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-medium leading-4", children: f.name }),
8681
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "pt-1 text-xs text-gray-400", children: f.description })
8414
8682
  ] }) }) }),
8415
8683
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between p-2 py-2", children: [
8416
8684
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8417
8685
  "button",
8418
8686
  {
8419
- onClick: () => f(j),
8687
+ onClick: () => j(f),
8420
8688
  className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-blue-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
8421
8689
  children: [
8422
8690
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -8442,7 +8710,7 @@ const PageDataProviders = () => {
8442
8710
  ]
8443
8711
  }
8444
8712
  ),
8445
- /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(j), name: j.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8713
+ /* @__PURE__ */ jsxRuntimeExports.jsx(RemoveProviderConfirmation, { onRemove: () => E(f), name: f.name, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "inline-flex h-9 items-center justify-center rounded-md px-3 text-xs font-medium text-red-500 underline-offset-4 ring-offset-background transition-colors hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", children: [
8446
8714
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
8447
8715
  "svg",
8448
8716
  {
@@ -8468,7 +8736,7 @@ const PageDataProviders = () => {
8468
8736
  ] })
8469
8737
  ]
8470
8738
  },
8471
- j.providerKey
8739
+ f.providerKey
8472
8740
  )) }),
8473
8741
  /* @__PURE__ */ jsxRuntimeExports.jsx(ViewProviderData, { onClose: () => g(null), provider: p })
8474
8742
  ] })
@@ -8477,7 +8745,7 @@ const PageDataProviders = () => {
8477
8745
  function AiFillDatabase(o) {
8478
8746
  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);
8479
8747
  }
8480
- const TopBar = lazy(() => import("./Topbar-i55trLGw.js"));
8748
+ const TopBar = lazy(() => import("./Topbar-Uk6diO3g.js"));
8481
8749
  function useSidebarMenuItems(o) {
8482
8750
  const n = o === "SINGLE_SIDE_PANEL", { t: r } = useTranslation(), a = useBuilderProp("dataBindingSupport", !1), l = useBuilderProp("askAiCallBack", null);
8483
8751
  return useMemo(() => {
@@ -8637,7 +8905,7 @@ const RootLayout = () => {
8637
8905
  }, [o]), useEffect(() => {
8638
8906
  builderStore.set(dataProvidersAtom, o.dataProviders || []);
8639
8907
  }, [o.dataProviders]), useEffect(() => {
8640
- n(syncBlocksWithDefaults(o.blocks || [])), a();
8908
+ n(o.blocks || []), a();
8641
8909
  }, [o.blocks]), useEffect(() => {
8642
8910
  i18n.changeLanguage(o.locale || "en");
8643
8911
  }, [o.locale]), useEffect(() => {
@@ -8697,8 +8965,9 @@ export {
8697
8965
  useSelectedBlocksDisplayChild as a4,
8698
8966
  useSelectedBreakpoints as a5,
8699
8967
  useSelectedStylingBlocks as a6,
8700
- useLayoutVariant as a7,
8701
- useBlocksStoreUndoableActions as a8,
8968
+ useLanguages as a7,
8969
+ useLayoutVariant as a8,
8970
+ useBlocksStoreUndoableActions as a9,
8702
8971
  useUpdateBlocksProps as b,
8703
8972
  useUpdateBlocksPropsRealtime as c,
8704
8973
  useBuilderProp as d,