@chaibuilder/sdk 0.1.0

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.
Files changed (80) hide show
  1. package/README.md +41 -0
  2. package/dist/AddBlocks-04c49399.js +258 -0
  3. package/dist/AddBlocks-c27c81fa.cjs +3 -0
  4. package/dist/BrandingOptions-055cf22a.js +157 -0
  5. package/dist/BrandingOptions-c25f6370.cjs +1 -0
  6. package/dist/CONTROLS-031e1de3.cjs +1 -0
  7. package/dist/CONTROLS-442caee5.js +6 -0
  8. package/dist/CanvasArea-97dfbb52.cjs +60 -0
  9. package/dist/CanvasArea-a7901131.js +1455 -0
  10. package/dist/Class-0801d193.cjs +1 -0
  11. package/dist/Class-e6b07b79.js +1138 -0
  12. package/dist/ImagesPanel-160aa664.cjs +1 -0
  13. package/dist/ImagesPanel-815d5e6f.js +27 -0
  14. package/dist/Layers-3aa6aae7.cjs +1 -0
  15. package/dist/Layers-6f1c162e.js +370 -0
  16. package/dist/MarkAsGlobalBlock-209ddfd5.js +73 -0
  17. package/dist/MarkAsGlobalBlock-536770e7.cjs +1 -0
  18. package/dist/Settings-2b1ff1a3.cjs +1 -0
  19. package/dist/Settings-b1afcefe.js +1845 -0
  20. package/dist/SidePanels-f48777bb.js +144 -0
  21. package/dist/SidePanels-f79dbace.cjs +1 -0
  22. package/dist/Topbar-64729901.js +105 -0
  23. package/dist/Topbar-bff765dc.cjs +1 -0
  24. package/dist/UnsplashImages-04fffeed.cjs +1 -0
  25. package/dist/UnsplashImages-315ce7a8.js +160 -0
  26. package/dist/UploadImages-43c16a2d.cjs +1 -0
  27. package/dist/UploadImages-f317eef0.js +107 -0
  28. package/dist/_commonjsHelpers-5a53b418.cjs +1 -0
  29. package/dist/_commonjsHelpers-d4512b9c.js +6 -0
  30. package/dist/accordion-0afd8143.cjs +1 -0
  31. package/dist/accordion-c0176dc5.js +42 -0
  32. package/dist/context-menu-e1c240ce.js +122 -0
  33. package/dist/context-menu-fec580f2.cjs +1 -0
  34. package/dist/core.cjs +1 -0
  35. package/dist/core.d.ts +353 -0
  36. package/dist/core.js +83 -0
  37. package/dist/dialog-170eaad9.cjs +1 -0
  38. package/dist/dialog-3d4e82ed.js +65 -0
  39. package/dist/dropdown-menu-a9b096f9.cjs +1 -0
  40. package/dist/dropdown-menu-d912a52e.js +223 -0
  41. package/dist/html-to-json-d8ac554d.cjs +1 -0
  42. package/dist/html-to-json-fecbbe16.js +178 -0
  43. package/dist/index-aea5c557.cjs +2 -0
  44. package/dist/index-cdd49c4c.js +2651 -0
  45. package/dist/jsx-runtime-5c3ac4f7.cjs +27 -0
  46. package/dist/jsx-runtime-944c88e2.js +631 -0
  47. package/dist/label-167415e5.cjs +1 -0
  48. package/dist/label-e770a087.js +10 -0
  49. package/dist/lib.cjs +1 -0
  50. package/dist/lib.d.ts +29 -0
  51. package/dist/lib.js +223 -0
  52. package/dist/link-43d13383.cjs +1 -0
  53. package/dist/link-8594fd8f.js +211 -0
  54. package/dist/popover-7cb9079b.cjs +1 -0
  55. package/dist/popover-f7addcf4.js +23 -0
  56. package/dist/render.cjs +2 -0
  57. package/dist/render.d.ts +49 -0
  58. package/dist/render.js +1171 -0
  59. package/dist/scroll-area-088530b9.cjs +1 -0
  60. package/dist/scroll-area-9f64a082.js +30 -0
  61. package/dist/select-0e32300c.cjs +1 -0
  62. package/dist/select-7fddd7c3.js +75 -0
  63. package/dist/separator-a597dba7.cjs +1 -0
  64. package/dist/separator-a80d065b.js +18 -0
  65. package/dist/style.css +6 -0
  66. package/dist/tabs-85caa1e8.js +46 -0
  67. package/dist/tabs-860e37aa.cjs +1 -0
  68. package/dist/textarea-0750bcd2.js +73 -0
  69. package/dist/textarea-a338ede6.cjs +1 -0
  70. package/dist/toggle-00c9d11e.js +30 -0
  71. package/dist/toggle-b90fed97.cjs +1 -0
  72. package/dist/ui.cjs +1 -0
  73. package/dist/ui.d.ts +471 -0
  74. package/dist/ui.js +442 -0
  75. package/dist/useBuilderProp-5e57d0c8.cjs +1 -0
  76. package/dist/useBuilderProp-81a14920.js +238 -0
  77. package/dist/utils-3c452dd0.cjs +1 -0
  78. package/dist/utils-ac68b2c8.js +6 -0
  79. package/dist/vite.svg +1 -0
  80. package/package.json +156 -0
@@ -0,0 +1,2651 @@
1
+ import { j as C } from "./jsx-runtime-944c88e2.js";
2
+ import Rr from "i18next";
3
+ import { initReactI18next as Ur } from "react-i18next";
4
+ import { FlagsProvider as qr } from "flagged";
5
+ import Tn, { useCallback as R, useEffect as he, useMemo as Fr, useState as zr, Suspense as ze, lazy as dt } from "react";
6
+ import { DndProvider as Vr } from "react-dnd";
7
+ import { flatten as ne, find as se, filter as F, map as X, omit as pt, isEmpty as de, isString as Nt, set as Se, get as U, has as Tt, includes as Q, without as Mn, forIn as Dn, findIndex as et, last as Wr, startsWith as $n, first as le, isNull as Bt, each as ye, pick as Qt, sortBy as Zt, isObject as Jr } from "lodash";
8
+ import { getBackendOptions as Gr, MultiBackend as Kr } from "@minoru/react-dnd-treeview";
9
+ import { u as He, c as Rn, B as Hr, S as Xr, T as Yr, a as Qr } from "./useBuilderProp-81a14920.js";
10
+ import { atom as b, useAtomValue as V, useAtom as $, useSetAtom as ke, getDefaultStore as Zr } from "jotai";
11
+ import { c as eo } from "./utils-ac68b2c8.js";
12
+ import { useHotkeys as pe } from "react-hotkeys-hook";
13
+ import Un from "flat-to-nested";
14
+ import { g as ve, c as at, B as Pt, a as to } from "./Class-e6b07b79.js";
15
+ import no, { excludeAction as ro, ActionCreators as xt } from "redux-undo";
16
+ import { useThrottledCallback as oo } from "@react-hookz/web";
17
+ import { useChaiBlocks as so, syncBlocksWithDefaults as io } from "chaibuilder-blocks";
18
+ import { S as _e, I as qn, a as Et } from "./CONTROLS-442caee5.js";
19
+ const ao = "Dark mode", co = "This page has no blocks. Add a block by clicking the + button", lo = "This page is empty", uo = "Please select a block to edit settings or styles", po = "Please select a styling block", fo = "Drop your block here", mo = {
20
+ dark_mode: ao,
21
+ tree_view_no_blocks: co,
22
+ canvas_empty: lo,
23
+ no_block_selected_for_styling: uo,
24
+ no_styling_block_selected: po,
25
+ drop_here_message: fo
26
+ };
27
+ Rr.use(Ur).init({
28
+ // the translations
29
+ // (tip move them in a JSON file and import them,
30
+ // or even better, manage them via a UI: https://react.i18next.com/guides/multiple-translation-files#manage-your-translations-with-a-management-gui)
31
+ resources: {
32
+ en: {
33
+ translation: mo
34
+ }
35
+ },
36
+ lng: "en",
37
+ // if you're using a language detector, do not define the lng option
38
+ fallbackLng: "en",
39
+ interpolation: {
40
+ escapeValue: !1
41
+ // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
42
+ }
43
+ });
44
+ const go = "";
45
+ const ho = {};
46
+ class yo extends Tn.Component {
47
+ constructor(t) {
48
+ super(t), this.state = { hasError: !1 };
49
+ }
50
+ /**
51
+ * A static method that returns an object to update the state when an error is caught.
52
+ * @returns {object} An object to update the state when an error is caught.
53
+ */
54
+ static getDerivedStateFromError(t) {
55
+ return console.error(t), { hasError: !0 };
56
+ }
57
+ render() {
58
+ return this.state.hasError ? /* @__PURE__ */ C.jsx("h1", { children: "Something went wrong." }) : this.props.children;
59
+ }
60
+ }
61
+ const vo = (e) => {
62
+ const t = e.replace(_e, "").split(",");
63
+ return { baseClasses: t[0], classes: t[1] };
64
+ };
65
+ let bo = 0;
66
+ function me(e, t) {
67
+ const n = `atom${++bo}`, r = {
68
+ toString: () => n
69
+ };
70
+ return typeof e == "function" ? r.read = e : (r.init = e, r.read = (o) => o(r), r.write = (o, s, i) => s(
71
+ r,
72
+ typeof i == "function" ? i(o(r)) : i
73
+ )), t && (r.write = t), r;
74
+ }
75
+ const ko = Symbol();
76
+ function wo(e, t) {
77
+ const n = me(
78
+ e,
79
+ (r, o, s) => o(n, t(r(n), s))
80
+ );
81
+ return n;
82
+ }
83
+ const en = (e, t, n) => (t.has(n) ? t : t.set(n, e())).get(n), xo = /* @__PURE__ */ new WeakMap(), So = (e, t, n) => {
84
+ const r = en(() => /* @__PURE__ */ new WeakMap(), xo, t);
85
+ return en(e, r, n);
86
+ }, _o = {}, tn = (e) => !!e.write, Io = (e) => typeof e == "function";
87
+ function Ao(e, t) {
88
+ return So(
89
+ () => {
90
+ const n = /* @__PURE__ */ new WeakMap(), r = (i, a) => {
91
+ let u = n.get(i);
92
+ if (u)
93
+ return u;
94
+ const c = a && n.get(a), p = [], f = [];
95
+ return i.forEach((h, m) => {
96
+ const I = t ? t(h) : m;
97
+ f[m] = I;
98
+ const S = c && c.atomList[c.keyList.indexOf(I)];
99
+ if (S) {
100
+ p[m] = S;
101
+ return;
102
+ }
103
+ const x = (B) => {
104
+ const O = B(o), g = B(e), L = r(g, O == null ? void 0 : O.arr).keyList.indexOf(I);
105
+ if (L < 0 || L >= g.length) {
106
+ const M = i[r(i).keyList.indexOf(I)];
107
+ if (M)
108
+ return M;
109
+ throw new Error("splitAtom: index out of bounds for read");
110
+ }
111
+ return g[L];
112
+ }, E = (B, O, g) => {
113
+ const y = B(o), L = B(e), j = r(L, y == null ? void 0 : y.arr).keyList.indexOf(I);
114
+ if (j < 0 || j >= L.length)
115
+ throw new Error("splitAtom: index out of bounds for write");
116
+ const z = Io(g) ? g(L[j]) : g;
117
+ O(e, [
118
+ ...L.slice(0, j),
119
+ z,
120
+ ...L.slice(j + 1)
121
+ ]);
122
+ };
123
+ p[m] = tn(e) ? me(x, E) : me(x);
124
+ }), c && c.keyList.length === f.length && c.keyList.every((h, m) => h === f[m]) ? u = c : u = { arr: i, atomList: p, keyList: f }, n.set(i, u), u;
125
+ }, o = me((i) => {
126
+ const a = i(o), u = i(e);
127
+ return r(u, a == null ? void 0 : a.arr);
128
+ });
129
+ o.init = void 0;
130
+ const s = tn(e) ? me(
131
+ (i) => i(o).atomList,
132
+ (i, a, u) => {
133
+ switch (u.type) {
134
+ case "remove": {
135
+ const c = i(s).indexOf(u.atom);
136
+ if (c >= 0) {
137
+ const p = i(e);
138
+ a(e, [
139
+ ...p.slice(0, c),
140
+ ...p.slice(c + 1)
141
+ ]);
142
+ }
143
+ break;
144
+ }
145
+ case "insert": {
146
+ const c = u.before ? i(s).indexOf(u.before) : i(s).length;
147
+ if (c >= 0) {
148
+ const p = i(e);
149
+ a(e, [
150
+ ...p.slice(0, c),
151
+ u.value,
152
+ ...p.slice(c)
153
+ ]);
154
+ }
155
+ break;
156
+ }
157
+ case "move": {
158
+ const c = i(s).indexOf(u.atom), p = u.before ? i(s).indexOf(u.before) : i(s).length;
159
+ if (c >= 0 && p >= 0) {
160
+ const f = i(e);
161
+ c < p ? a(e, [
162
+ ...f.slice(0, c),
163
+ ...f.slice(c + 1, p),
164
+ f[c],
165
+ ...f.slice(p)
166
+ ]) : a(e, [
167
+ ...f.slice(0, p),
168
+ f[c],
169
+ ...f.slice(p, c),
170
+ ...f.slice(c + 1)
171
+ ]);
172
+ }
173
+ break;
174
+ }
175
+ }
176
+ }
177
+ ) : me((i) => i(o).atomList);
178
+ return s;
179
+ },
180
+ e,
181
+ t || _o
182
+ );
183
+ }
184
+ const Bo = (e) => typeof (e == null ? void 0 : e.then) == "function";
185
+ function Po(e) {
186
+ let t, n;
187
+ const r = {
188
+ getItem: (o, s) => {
189
+ var i, a;
190
+ const u = (p) => {
191
+ if (p = p || "", t !== p) {
192
+ try {
193
+ n = JSON.parse(p);
194
+ } catch {
195
+ return s;
196
+ }
197
+ t = p;
198
+ }
199
+ return n;
200
+ }, c = (a = (i = e()) == null ? void 0 : i.getItem(o)) != null ? a : null;
201
+ return Bo(c) ? c.then(u) : u(c);
202
+ },
203
+ setItem: (o, s) => {
204
+ var i;
205
+ return (i = e()) == null ? void 0 : i.setItem(o, JSON.stringify(s));
206
+ },
207
+ removeItem: (o) => {
208
+ var s;
209
+ return (s = e()) == null ? void 0 : s.removeItem(o);
210
+ }
211
+ };
212
+ return typeof window < "u" && typeof window.addEventListener == "function" && (r.subscribe = (o, s, i) => {
213
+ if (!(e() instanceof window.Storage))
214
+ return () => {
215
+ };
216
+ const a = (u) => {
217
+ if (u.storageArea === e() && u.key === o) {
218
+ let c;
219
+ try {
220
+ c = JSON.parse(u.newValue || "");
221
+ } catch {
222
+ c = i;
223
+ }
224
+ s(c);
225
+ }
226
+ };
227
+ return window.addEventListener("storage", a), () => {
228
+ window.removeEventListener("storage", a);
229
+ };
230
+ }), r;
231
+ }
232
+ const Eo = Po(
233
+ () => typeof window < "u" ? window.localStorage : void 0
234
+ );
235
+ function Pe(e, t, n = Eo, r) {
236
+ const o = r == null ? void 0 : r.unstable_getOnInit, s = me(
237
+ o ? n.getItem(e, t) : t
238
+ );
239
+ return s.onMount = (a) => {
240
+ o || a(n.getItem(e, t));
241
+ let u;
242
+ return n.subscribe && (u = n.subscribe(e, a, t)), u;
243
+ }, me(
244
+ (a) => a(s),
245
+ (a, u, c) => {
246
+ const p = typeof c == "function" ? c(a(s)) : c;
247
+ return p === ko ? (u(s, t), n.removeItem(e)) : p instanceof Promise ? p.then((f) => (u(s, f), n.setItem(e, f))) : (u(s, p), n.setItem(e, p));
248
+ }
249
+ );
250
+ }
251
+ const jo = new Un({ children: "blockNodes" }), Fn = (e, t = null) => ne(
252
+ e.map((n) => {
253
+ if (n = t !== null ? { ...n, parent: t } : n, n.children && n.children.length) {
254
+ const r = [...n.children];
255
+ return delete n.children, ne([n, ...Fn(r, n._id)]);
256
+ }
257
+ return n;
258
+ })
259
+ );
260
+ function zn(e, t, n) {
261
+ const r = F(e, (s) => s._parent === t), o = [];
262
+ for (let s = 0; s < r.length; s++) {
263
+ const i = Vn(r[s]);
264
+ if (Object.keys(i).length > 0 && Object.keys(i).forEach((a) => {
265
+ r[s][a] = `slot:${ve()}`;
266
+ }), F(e, { _parent: r[s]._id }).length > 0) {
267
+ const a = ve();
268
+ o.push({ ...r[s], oldId: r[s]._id, _id: a, _parent: n }), o.push(ne(zn(e, r[s]._id, a)));
269
+ } else
270
+ o.push({
271
+ ...r[s],
272
+ oldId: r[s]._id,
273
+ _id: ve(),
274
+ _parent: n
275
+ });
276
+ }
277
+ return ne(o);
278
+ }
279
+ function Oo(e) {
280
+ let t = jo.convert(e.map((n) => pt(n, ["settings"])));
281
+ return t = !t.type && t.blockNodes ? t.blockNodes : de(t) ? [] : [t], t;
282
+ }
283
+ const Vn = (e) => {
284
+ const t = {};
285
+ return Object.keys(e).forEach((n) => {
286
+ Nt(e[n]) && e[n].startsWith("slot") && (t[n] = e[n].replace("slot:", ""));
287
+ }), t;
288
+ }, Co = (e, t, n = null) => {
289
+ let r = se(e, { _id: t });
290
+ r = { ...r, oldId: r._id, _id: ve() }, n && (r = { ...r, _parent: n });
291
+ const o = [r];
292
+ F(e, { _parent: t }).length > 0 && o.push(ne(zn(e, t, r._id)));
293
+ const s = ne(o);
294
+ return X(s, (i) => {
295
+ const a = i, u = Vn(a);
296
+ return Object.keys(u).length > 0 && Object.keys(u).forEach((c) => {
297
+ const p = se(s, { oldId: u[c].replace("slot:", "") });
298
+ a[c] = `slot:${p._id}`;
299
+ }), pt(a, ["global", "oldId"]);
300
+ });
301
+ }, Lo = no(
302
+ // eslint-disable-next-line default-param-last
303
+ (e = [], t) => {
304
+ switch (t.type) {
305
+ case "add_new_blocks":
306
+ case "add_duplicate_blocks":
307
+ return [...e, ...t.payload];
308
+ case "create_snapshot":
309
+ return [...e];
310
+ case "set_blocks":
311
+ case "set_page_blocks":
312
+ return [...t.payload];
313
+ case "update_props":
314
+ case "update_props_realtime":
315
+ const { payload: n } = t;
316
+ return e.map((r) => (n.ids.includes(r._id) && !de(t.payload.props) && Object.keys(t.payload.props).forEach((o) => {
317
+ Se(r, o, t.payload.props[o]);
318
+ }), r));
319
+ default:
320
+ return e;
321
+ }
322
+ },
323
+ {
324
+ debug: !1,
325
+ ignoreInitialState: !1,
326
+ limit: 30,
327
+ filter: ro(["update_props_realtime", "add_duplicate_blocks", "set_page_blocks"])
328
+ }
329
+ ), ft = wo(
330
+ {
331
+ past: [],
332
+ present: [],
333
+ future: []
334
+ },
335
+ Lo
336
+ );
337
+ ft.debugLabel = "pageBlocksAtom";
338
+ const re = b((e) => {
339
+ var t;
340
+ return (t = e(ft)) == null ? void 0 : t.present;
341
+ });
342
+ re.debugLabel = "presentBlocksAtom";
343
+ const Mt = Ao(re);
344
+ Mt.debugLabel = "pageBlocksAtomsAtom";
345
+ const Wn = b((e) => Oo(e(re)));
346
+ Wn.debugLabel = "pageBlocksTreeAtom";
347
+ const No = b("");
348
+ No.debugLabel = "builderActivePageAtom";
349
+ const To = b(-1);
350
+ To.debugLabel = "destinationDropIndexAtom";
351
+ const Mo = b(!1);
352
+ Mo.debugLabel = "addBlocksModalAtom";
353
+ const oe = () => {
354
+ const [, e] = $(ft);
355
+ return e;
356
+ }, Sa = () => {
357
+ const e = oe(), t = V(Wn), n = R(
358
+ (r) => {
359
+ const o = Fn(r);
360
+ e({ type: "set_page_blocks", payload: o });
361
+ },
362
+ [e]
363
+ );
364
+ return [t, n];
365
+ }, Do = () => {
366
+ const e = oe();
367
+ return [R(
368
+ (n) => {
369
+ e({ type: "set_page_blocks", payload: n });
370
+ },
371
+ [e]
372
+ )];
373
+ }, jt = (e) => ["Box", "Slot", "Form", "DataContext", "Link", "List", "ListItem", "Row", "Column", "Table", "TableCell"].includes(
374
+ e
375
+ ), _a = (e) => !["Slot"].includes(e), Ia = (e) => !["Slot"].includes(e);
376
+ function $o(e, t) {
377
+ return e === "Slot" || t === "List" && e !== "ListItem" || t === "Row" && e !== "Column" ? !1 : jt(t);
378
+ }
379
+ const Aa = (e, { dragSource: t, dropTarget: n }) => {
380
+ const r = U(t, "data._type", ""), o = U(n, "data._type", "");
381
+ return r === "Slot" || U(t, "id") && U(t, "id") === U(n, "id") ? !1 : de(o) ? !0 : $o(r, o);
382
+ }, Jn = b([]);
383
+ Jn.debugLabel = "buildingBlocksAtom";
384
+ const Ro = b((e) => {
385
+ const t = e(Jn);
386
+ return F(t, (n) => Tt(n, "blockId"));
387
+ }), Uo = () => {
388
+ }, Gn = () => {
389
+ const e = so(), t = V(Ro), n = () => {
390
+ }, r = R(() => Uo(), []);
391
+ return [e, t, n, r];
392
+ }, Dt = b([]);
393
+ Dt.debugLabel = "selectedBlockIdsAtom";
394
+ const $t = b((e) => {
395
+ const t = e(re), n = e(Dt);
396
+ return X(
397
+ F(t, ({ _id: r }) => Q(n, r)),
398
+ (r) => ({ ...r })
399
+ );
400
+ });
401
+ $t.debugLabel = "selectedBlocksAtom";
402
+ const Rt = b((e) => {
403
+ const t = e($t);
404
+ return t.length === 0 ? null : t.length === 1 ? t[0] : {
405
+ type: "Multiple",
406
+ id: X(t, "id")
407
+ };
408
+ });
409
+ Rt.debugLabel = "selectedBlockAtom";
410
+ const qo = (e) => U(e, "parent", null), Fo = b((e) => {
411
+ const t = e($t), n = X(t, qo);
412
+ return F(e(re), (r) => Q(n, r._id));
413
+ });
414
+ Fo.debugLabel = "selectedBlocksParentsAtom";
415
+ const Kn = b(() => !1);
416
+ Kn.debugLabel = "selectedBlockFlexChildAtom";
417
+ const Hn = b(() => !1);
418
+ Hn.debugLabel = "selectedBlockGridChildAtom";
419
+ const Ut = b("");
420
+ Ut.debugLabel = "styleStateAtom";
421
+ const Xn = Pe("styleBreakpoint", "xs");
422
+ Xn.debugLabel = "styleBreakpointAtom";
423
+ const Ba = () => ({
424
+ flexChild: V(Kn),
425
+ gridChild: V(Hn)
426
+ }), Pa = () => V(Rt), Ee = () => {
427
+ const [e, t] = $(Dt), n = R(
428
+ (r) => {
429
+ t((o) => Q(o, r) ? Mn(o, r) : [...o, r]);
430
+ },
431
+ [t]
432
+ );
433
+ return [e, t, n];
434
+ }, nn = (e, t = "") => {
435
+ switch (e.type) {
436
+ case "singular":
437
+ return e.uiSchema;
438
+ case "model":
439
+ const { properties: n } = e, r = {};
440
+ return Object.keys(n).forEach((i) => {
441
+ const a = n[i];
442
+ if (Q(["slot", "styles"], a.type))
443
+ return;
444
+ const u = U(a, "i18n", !1) ? `${i}-${t}` : i;
445
+ r[u] = nn(a, t);
446
+ }), r;
447
+ case "list":
448
+ const { itemProperties: o } = e, s = {
449
+ items: {}
450
+ };
451
+ return Object.keys(o).forEach((i) => {
452
+ const a = o[i];
453
+ if (Q(["slot", "styles"], a.type))
454
+ return;
455
+ const u = U(a, "i18n", !1) ? `${i}-${t}` : i;
456
+ s.items[u] = nn(a, t);
457
+ }), s;
458
+ default:
459
+ return {};
460
+ }
461
+ }, rn = (e, t = "") => {
462
+ switch (e.type) {
463
+ case "singular":
464
+ return e.schema;
465
+ case "model":
466
+ const { properties: n, title: r } = e, o = {
467
+ title: r,
468
+ type: "object",
469
+ properties: {}
470
+ };
471
+ return Object.keys(n).forEach((u) => {
472
+ const c = n[u];
473
+ if (Q(["slot", "styles"], c.type))
474
+ return;
475
+ const p = U(c, "i18n", !1) ? `${u}-${t}` : u;
476
+ o.properties[p] = rn(c, t);
477
+ }), o;
478
+ case "list":
479
+ const { itemProperties: s, title: i } = e, a = {
480
+ title: i,
481
+ type: "array",
482
+ items: {
483
+ type: "object",
484
+ properties: {}
485
+ }
486
+ };
487
+ return Object.keys(s).forEach((u) => {
488
+ const c = s[u];
489
+ if (Q(["slot", "styles"], c.type))
490
+ return;
491
+ const p = U(c, "i18n", !1) ? `${u}-${t}` : u;
492
+ a.items.properties[p] = rn(c, t), Se(a.items, "title", U(c, "itemTitle", `${i} item`));
493
+ }), a;
494
+ default:
495
+ return {};
496
+ }
497
+ }, Yn = (e) => {
498
+ const t = {};
499
+ return Object.keys(e).forEach((n) => {
500
+ t[n] = Vo(e[n]);
501
+ }), t;
502
+ }, zo = (e) => {
503
+ if (de(e.default))
504
+ return [];
505
+ const { itemProperties: t } = e;
506
+ return X(e.default, (n) => {
507
+ const r = { ...n };
508
+ return Dn(n, (o, s) => {
509
+ Tt(t, s) && U(t[s], "i18n", !1) && (r[s] = qn);
510
+ }), r;
511
+ });
512
+ }, Vo = (e) => {
513
+ switch (e.type) {
514
+ case "styles":
515
+ return e.default;
516
+ case "slot":
517
+ return `${Et}${ve()}`;
518
+ case "singular":
519
+ const { i18n: t, schema: n } = e;
520
+ return t ? qn : U(n, "default", "");
521
+ case "model":
522
+ return Yn(e.properties);
523
+ case "list":
524
+ return zo(e);
525
+ default:
526
+ return "";
527
+ }
528
+ }, Wo = () => V(re);
529
+ function on(e, t, n, r, o) {
530
+ if (t === null)
531
+ return [...e, ...r];
532
+ if (n !== null) {
533
+ const u = et(e, { _parent: t }), c = (u === -1 ? 0 : u) + n;
534
+ return e.splice(c, 0, ...r), e;
535
+ }
536
+ if (!o) {
537
+ const c = et(e, { _id: t }) + 1;
538
+ return e.splice(c, 0, ...r), e;
539
+ }
540
+ let s = et(e, { _id: t });
541
+ const i = F(e, { _parent: t });
542
+ de(i) || (s = et(e, { _id: Wr(i)._id }));
543
+ const a = s + 1;
544
+ return e.splice(a, 0, ...r), e;
545
+ }
546
+ const Ea = () => {
547
+ const e = oe(), t = Wo(), [, n] = Gn(), [, r] = Ee(), o = R(
548
+ (i, a, u) => {
549
+ if (Tt(i, "blocks")) {
550
+ const x = i.blocks;
551
+ return s(x, a, u);
552
+ }
553
+ const c = ve(), p = Yn(i.props), f = [];
554
+ Dn(p, (x, E) => {
555
+ if ($n(x, Et)) {
556
+ const B = x.replace(Et, "");
557
+ f.push({
558
+ _id: B,
559
+ _type: "Slot",
560
+ _parent: c,
561
+ _name: i.props[E].name,
562
+ _styles: i.props[E].styles,
563
+ _emptyStyles: i.props[E].emptyStyles
564
+ });
565
+ }
566
+ });
567
+ const h = {
568
+ _type: i.type,
569
+ _id: c,
570
+ ...p
571
+ };
572
+ let m;
573
+ a && (m = se(t, { _id: a }), h._parent = a);
574
+ const I = m ? jt(m._type) : !0;
575
+ !I && m && (h._parent = m._parent);
576
+ const S = [h, ...f];
577
+ return e({
578
+ type: "set_blocks",
579
+ payload: on(t, a || null, u || null, S, I)
580
+ }), r([h._id]), h;
581
+ },
582
+ [t, e, r]
583
+ ), s = R(
584
+ (i, a, u) => {
585
+ var f;
586
+ for (let h = 0; h < i.length; h++) {
587
+ const { _id: m } = i[h];
588
+ i[h]._id = ve();
589
+ const I = F(i, { _parent: m });
590
+ for (let S = 0; S < I.length; S++)
591
+ I[S]._parent = i[h]._id;
592
+ }
593
+ let c;
594
+ a && (c = se(t, { _id: a }), i[0]._parent = a);
595
+ const p = c ? jt(c._type) : !0;
596
+ return !p && c && (i[0]._parent = c._parent), e({
597
+ type: "set_blocks",
598
+ payload: on(t, a || null, u || null, i, p)
599
+ }), r([(f = le(i)) == null ? void 0 : f._id]), le(i);
600
+ },
601
+ [t, e, r, n]
602
+ );
603
+ return { addCoreBlock: o, addPredefinedBlock: s };
604
+ }, sn = {
605
+ xs: 420,
606
+ sm: 620,
607
+ md: 768,
608
+ lg: 1024,
609
+ xl: 1280,
610
+ "2xl": 1536
611
+ }, an = ["xs", "sm", "md", "lg", "xl", "2xl"];
612
+ function Jo(e, t) {
613
+ if (t === null)
614
+ return "baseClasses";
615
+ const n = t.mq;
616
+ if (n === "xs" || t.dark || t.mod !== "")
617
+ return "classes";
618
+ let r = "baseClasses", o = an.indexOf(n);
619
+ for (; o > 0; ) {
620
+ const s = an[o - 1];
621
+ if (se(e, {
622
+ mq: s,
623
+ property: t.property
624
+ })) {
625
+ r = "classes";
626
+ break;
627
+ }
628
+ o--;
629
+ }
630
+ return r;
631
+ }
632
+ const cn = [];
633
+ function Go(e = "", t = "", n = []) {
634
+ e = e.trim().replace(/ +/g, "");
635
+ let r = F(
636
+ X(e.split(" "), at),
637
+ (c) => !Bt(c)
638
+ ), o = F(X(t.split(" "), at), (c) => !Bt(c));
639
+ o = F(
640
+ o,
641
+ (c) => !Q(cn, c.property)
642
+ );
643
+ const s = [], i = [];
644
+ ye(n, (c) => {
645
+ const p = at(c), f = se(r, Qt(p, ["dark", "mq", "mod", "property"]));
646
+ if (f && (r = F(
647
+ r,
648
+ (h) => h.fullCls !== (f == null ? void 0 : f.fullCls)
649
+ )), s.push(p), p.mq === "xs" && !p.dark && p.mod === "" && (o = F(o, (h) => h.property !== p.property)), Jo(r, p) === "baseClasses" && !Q(cn, p.property)) {
650
+ const h = se(o, Qt(p, ["property"]));
651
+ f && (o = F(
652
+ o,
653
+ (m) => m.fullCls !== (h == null ? void 0 : h.fullCls)
654
+ )), i.push({
655
+ ...p,
656
+ fullCls: p.cls,
657
+ mq: "xs"
658
+ });
659
+ }
660
+ });
661
+ const a = X(
662
+ Zt([...r, ...s], (c) => sn[c.mq]),
663
+ "fullCls"
664
+ ).join(" ");
665
+ return `${X(
666
+ Zt([...o, ...i], (c) => sn[c.mq]),
667
+ "fullCls"
668
+ ).join(" ").trim()},${a.trim()}`.trim().replace(/ +/g, "");
669
+ }
670
+ const Ye = b([]);
671
+ Ye.debugLabel = "selectedStylingBlocksAtom";
672
+ const Qn = () => $(Ye), Ko = (e) => {
673
+ const t = e.replace(_e, "").split(",");
674
+ return { baseClasses: t[0], classes: t[1] };
675
+ }, Ho = b(null, (e, t, { blockIds: n, newClasses: r, dispatch: o }) => {
676
+ const s = F(
677
+ e(Mt),
678
+ (a) => (
679
+ // @ts-ignore
680
+ n.includes(e(a)._id)
681
+ )
682
+ ), i = le(e(Ye));
683
+ ye(s, (a) => {
684
+ const u = e(a), c = U(u, i.prop, `${_e},`), { baseClasses: p, classes: f } = Ko(c);
685
+ o({
686
+ type: "update_props_realtime",
687
+ payload: {
688
+ ids: [u._id],
689
+ props: { [i.prop]: `${_e}${Go(f, p, r)}` }
690
+ }
691
+ });
692
+ });
693
+ }), ja = () => {
694
+ const e = oe(), t = ke(Ho);
695
+ return R(
696
+ (n, r, o) => {
697
+ t({ blockIds: n, newClasses: r, dispatch: e }), o && setTimeout(() => e({ type: "create_snapshot" }), 500);
698
+ },
699
+ [e, t]
700
+ );
701
+ }, Xo = b(!1), Zn = () => {
702
+ const [e, t] = $(Xo);
703
+ return [e, t];
704
+ }, Yo = b(Pt), er = () => {
705
+ const [e, t] = $(Yo);
706
+ return [
707
+ Jr(e) ? { ...e, ...Pt } : Pt,
708
+ t
709
+ ];
710
+ }, Qo = b(null), Zo = () => ({ currentPage: V(Qo) }), tr = new Un({});
711
+ function es(e) {
712
+ let t = tr.convert(e);
713
+ return t = !t.type && t.children && t.children.length ? t.children : de(t) ? [] : [t], t;
714
+ }
715
+ const qt = (e, t) => ne(
716
+ e.map((n) => {
717
+ if (n = t ? { ...n, parent: t } : { ...n }, n.children) {
718
+ const r = [...n.children];
719
+ return delete n.children, ne([n, ...qt(r, n._id)]);
720
+ }
721
+ return n;
722
+ })
723
+ );
724
+ function Ft(e, t = !1) {
725
+ for (let n = 0; n < e.length; n++) {
726
+ const r = e[n];
727
+ r.global && !t ? e[n] = {
728
+ type: "GlobalBlock",
729
+ _parent: U(r, "parent", null),
730
+ blockId: r.blockId,
731
+ _id: r._id
732
+ } : r.children && r.children.length && Ft(r.children);
733
+ }
734
+ }
735
+ function nr(e) {
736
+ let t = [], n = F(e, { type: "GlobalBlock" });
737
+ return n.length > 0 && (n = X(n, rr), ye(n, (r) => {
738
+ t = [...t, ...ts(r)];
739
+ })), t;
740
+ }
741
+ function ts(e) {
742
+ let t = [];
743
+ const n = U(le(e), "parent", null);
744
+ Se(le(e), "parent", null);
745
+ const r = [tr.convert(or(e))];
746
+ Ft(r, !0);
747
+ let o = qt(r, e[0]._id);
748
+ return o = Se(o, "0.parent", n), t = [...t, o, ...nr(o)], t;
749
+ }
750
+ function rr(e) {
751
+ const t = se(Ot, { _id: e._id });
752
+ if (!t)
753
+ return [];
754
+ const n = [t], r = F(Ot, { _parent: e._id });
755
+ return r.length ? ne([...n, ...ne(X(r, rr))]) : ne(n);
756
+ }
757
+ const or = (e) => JSON.parse(JSON.stringify(e));
758
+ let Ot = [];
759
+ function ns(e) {
760
+ Ot = e;
761
+ const t = es(or(e));
762
+ Ft(t);
763
+ const n = qt(t, null), r = nr(n), o = {};
764
+ return ye(r, (s) => Se(o, le(s).blockId, s)), [n, o];
765
+ }
766
+ const sr = () => {
767
+ const [e] = er(), { currentPage: t } = Zo(), n = V(re);
768
+ return R(() => {
769
+ const r = X(
770
+ n,
771
+ (i) => pt(i, ["expanded", "order", "title", "siblings", "tempClasses"])
772
+ ), [o = [], s = []] = ns(r);
773
+ return {
774
+ currentPage: t,
775
+ blocks: o,
776
+ globalBlocks: s
777
+ };
778
+ }, [e, t, n]);
779
+ };
780
+ Pe("blockStylingActiveTab", 1);
781
+ b([]);
782
+ const ir = b(!1);
783
+ ir.debugLabel = "readOnlyModeAtom";
784
+ const rs = b(!1);
785
+ rs.debugLabel = "inlineEditingActiveAtom";
786
+ const os = b(!1);
787
+ os.debugLabel = "advanceStylingOpenAtom";
788
+ const ss = b("online");
789
+ ss.debugLabel = "networkModeAtom";
790
+ Pe("currentUiLibrary", "");
791
+ const is = b(!1);
792
+ is.debugLabel = "codeEditorOpenAtom";
793
+ const as = b(!1);
794
+ as.debugLabel = "editLayerNameAtom";
795
+ const cs = b("");
796
+ cs.debugLabel = "activeLanguageAtom";
797
+ const ls = b("");
798
+ ls.debugLabel = "primaryLanguageAtom";
799
+ const us = b(null);
800
+ us.debugLabel = "canvasIframeAtom";
801
+ const ds = b("layers");
802
+ ds.debugLabel = "activePanelAtom";
803
+ const ps = b(!1);
804
+ ps.debugLabel = "addBlockOffCanvasAtom";
805
+ const fs = b("");
806
+ fs.debugLabel = "showPredefinedBlockCategoryAtom";
807
+ const mt = b({ undoCount: 0, redoCount: 0 });
808
+ mt.debugLabel = "historyStatesAtom";
809
+ const zt = b("SAVED");
810
+ zt.debugLabel = "pageSyncStateAtom";
811
+ const Oa = () => {
812
+ const [e, t] = $(zt), n = He("onSaveBlocks", async () => {
813
+ }), r = He("onSyncStatusChange", () => {
814
+ }), o = sr(), s = ke(mt), { undoCount: i, redoCount: a } = gt();
815
+ return { savePage: oo(
816
+ async () => {
817
+ t("SAVING"), r("SAVING");
818
+ const c = o();
819
+ return await n({ blocks: c.blocks, globalBlocks: c.globalBlocks }), setTimeout(() => {
820
+ s({ undoCount: i, redoCount: a }), t("SAVED"), r("SAVED");
821
+ }, 100), !0;
822
+ },
823
+ [o, t, r, n],
824
+ 5e3
825
+ // save only every 5 seconds
826
+ ), syncState: e, setSyncState: t };
827
+ }, gt = () => {
828
+ const e = V(ft), [{ undoCount: t, redoCount: n }] = $(mt), r = oe(), [o] = Zn(), [, s] = Ee(), [, i] = Qn(), [, a] = $(zt), u = He("onSyncStatusChange", () => {
829
+ }), c = R(() => {
830
+ r({ type: "create_snapshot" });
831
+ }, [r]);
832
+ return he(() => {
833
+ t !== (e == null ? void 0 : e.past.length) || n !== (e == null ? void 0 : e.future.length) ? (a("UNSAVED"), u("UNSAVED")) : t === (e == null ? void 0 : e.past.length) && n === (e == null ? void 0 : e.future.length) && (a("SAVED"), u("SAVED"));
834
+ }, [e == null ? void 0 : e.past.length, e == null ? void 0 : e.future.length, t, n, u, a]), {
835
+ undoCount: e == null ? void 0 : e.past.length,
836
+ redoCount: e == null ? void 0 : e.future.length,
837
+ undo: R(() => {
838
+ o || (r(xt.undo()), setTimeout(() => {
839
+ i([]), s([]);
840
+ }, 200));
841
+ }, [r, o, a]),
842
+ redo: R(() => {
843
+ o || (r(xt.redo()), setTimeout(() => {
844
+ i([]), s([]);
845
+ }, 200));
846
+ }, [o, r]),
847
+ clear: () => {
848
+ r(xt.clearHistory());
849
+ },
850
+ createSnapshot: c
851
+ };
852
+ }, ms = () => $(Xn), ar = Pe("canvasWidth", 360), cr = b((e) => {
853
+ const t = e(ar);
854
+ return to(t).toLowerCase();
855
+ }), Ca = () => {
856
+ const [e, t] = $(ar), n = V(cr), [r, o] = ms();
857
+ return he(() => {
858
+ r !== "xs" && o(n);
859
+ }, [n, r, o]), [e, n, t];
860
+ }, gs = Pe("canvasZoom", 100), La = () => $(gs), lr = b([]), ur = () => {
861
+ const [e, t] = $(lr), n = ke(Vt), r = R(
862
+ (o) => {
863
+ t(o), n([]);
864
+ },
865
+ [t, n]
866
+ );
867
+ return [e, r];
868
+ }, Vt = b([]), hs = () => {
869
+ const [e, t] = $(Vt), n = ke(lr), r = R(
870
+ (o) => {
871
+ t(o), n([]);
872
+ },
873
+ [t, n]
874
+ );
875
+ return [e, r];
876
+ }, dr = Pe("darkMode", !1), Na = () => {
877
+ const [e, t] = $(dr);
878
+ return [e, t];
879
+ }, ys = b(!1), Ta = () => {
880
+ const [e, t] = $(ys);
881
+ return [e, t];
882
+ }, pr = () => {
883
+ const e = oe(), t = V(re), [, n] = Ee();
884
+ return R(
885
+ (r, o = null) => {
886
+ const s = [];
887
+ ye(r, (i) => {
888
+ const u = Co(t, i, o === i ? null : o);
889
+ s.push(U(u, "0._id", "")), e({ type: "add_duplicate_blocks", payload: u });
890
+ }), n(s), e({ type: "create_snapshot" });
891
+ },
892
+ [t, n, e]
893
+ );
894
+ }, vs = b([]), Ma = () => {
895
+ const [e, t] = $(vs), n = R(
896
+ (r) => {
897
+ t((o) => Q(o, r) ? Mn(o, r) : [...o, r]);
898
+ },
899
+ [t]
900
+ );
901
+ return [e, t, n];
902
+ }, bs = b(""), ks = () => $(bs), Da = () => {
903
+ const e = V(re), t = oe(), n = sr(), [, , r] = Gn();
904
+ return R(
905
+ async (o, s) => {
906
+ const i = ve(16), a = X(e, (u) => (u._id === o && (u._globalBlockId = i, u._name = s), u));
907
+ t({ type: "set_page_blocks", payload: a }), r();
908
+ },
909
+ [e, t, n, r]
910
+ );
911
+ }, $a = () => ({}), ws = () => {
912
+ const e = V(re), t = oe();
913
+ return R(
914
+ (n, r) => {
915
+ const o = X(e, (s) => (Q(n, U(s, "_id")) && Se(s, "_parent", r), s));
916
+ t({ type: "set_blocks", payload: o });
917
+ },
918
+ [e, t]
919
+ );
920
+ }, xs = () => {
921
+ const e = V(Vt), [t, n] = ur(), r = pr(), o = ws();
922
+ return {
923
+ canPaste: Fr(
924
+ () => t.length > 0 || e.length > 0,
925
+ [e, t]
926
+ ),
927
+ pasteBlocks: R(
928
+ (i) => {
929
+ de(e) ? o(t, i) : r(e, i), n(() => []);
930
+ },
931
+ [t, e, r, o, n]
932
+ )
933
+ };
934
+ }, Ss = b(""), Ra = () => {
935
+ const e = V(Ss), t = R(() => {
936
+ }, []), n = R(() => {
937
+ }, []), r = R(() => {
938
+ }, []);
939
+ return { currentProject: e, createProject: r, deleteProject: t, updateProject: n };
940
+ }, fr = (e, t) => {
941
+ const n = [], r = F(e, (o) => Q(t, o._id) || Q(t, o._parent) ? (n.push(o._id), !1) : !0);
942
+ return de(n) ? r : fr(r, n);
943
+ }, _s = () => {
944
+ const e = oe(), t = V(re), [n, r] = Ee();
945
+ return R(
946
+ (o) => {
947
+ var a;
948
+ const s = ((a = se(t, { _id: o[0] })) == null ? void 0 : a._parent) || null, i = fr(t, o);
949
+ e({ type: "set_blocks", payload: i }), r(s ? [s] : []);
950
+ },
951
+ [t, r, e, n]
952
+ );
953
+ }, Is = b(null, (e, t, { blockIds: n, fullClasses: r, dispatch: o }) => {
954
+ const s = le(e(Ye)), i = F(
955
+ e(Mt),
956
+ (a) => (
957
+ // @ts-ignore
958
+ n.includes(e(a)._id)
959
+ )
960
+ );
961
+ ye(i, (a) => {
962
+ const u = e(a), c = r;
963
+ let { classes: p, baseClasses: f } = vo(U(u, s.prop, "styles:,"));
964
+ ye(c, (h) => {
965
+ const m = new RegExp(`(^| )${h.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
966
+ p = p.replace(m, " ").replace(/ +/g, " ").trim();
967
+ const I = le(h.split(":"));
968
+ Q(["2xl", "xl", "lg", "md", "sm"], I) && c.push(h.split(":").pop().trim());
969
+ }), ye(c, (h) => {
970
+ const m = new RegExp(`(^| )${h.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
971
+ f = f.replace(m, " ").replace(/ +/g, " ").trim();
972
+ }), o({
973
+ type: "update_props_realtime",
974
+ payload: {
975
+ ids: [u._id],
976
+ props: {
977
+ [s.prop]: `${_e}${f},${p}`
978
+ }
979
+ }
980
+ });
981
+ });
982
+ }), Ua = () => {
983
+ const e = oe(), t = ke(Is);
984
+ return R(
985
+ (n, r) => {
986
+ t({ blockIds: n, fullClasses: r, dispatch: e }), setTimeout(() => e({ type: "create_snapshot" }));
987
+ },
988
+ [e, t]
989
+ );
990
+ }, mr = b((e) => {
991
+ const t = le(e(Ye)), n = e(Rt);
992
+ if (!t || t.blockId !== U(n, "_id", null))
993
+ return [];
994
+ const o = U(n, t.prop, `${_e},`).replace(_e, "").split(",").join(" ");
995
+ return F(X(o.trim().split(" "), at), (s) => !Bt(s));
996
+ }), qa = () => V(mr), ln = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 5 }, As = b((e) => {
997
+ const t = e(cr), n = e(Ut), r = e(dr), o = Bs(t);
998
+ let s = F(e(mr), { mod: n });
999
+ return $n(n, "_") || (s = F(s, (i) => o.includes(i.mq))), s = s.sort((i, a) => ln[i.mq] - ln[a.mq]), r || (s = F(s, { dark: !1 })), s;
1000
+ }), Bs = (e) => {
1001
+ let t = [];
1002
+ switch (e) {
1003
+ case "xs":
1004
+ t = ["xs"];
1005
+ break;
1006
+ case "sm":
1007
+ t = ["xs", "sm"];
1008
+ break;
1009
+ case "md":
1010
+ t = ["xs", "sm", "md"];
1011
+ break;
1012
+ case "lg":
1013
+ t = ["xs", "sm", "md", "lg"];
1014
+ break;
1015
+ case "xl":
1016
+ t = ["xs", "sm", "md", "lg", "xl"];
1017
+ break;
1018
+ case "2xl":
1019
+ t = ["xs", "sm", "md", "lg", "xl", "2xl"];
1020
+ break;
1021
+ default:
1022
+ t = ["xs"];
1023
+ break;
1024
+ }
1025
+ return t;
1026
+ }, Fa = () => V(As), za = () => $(Ut), gr = b(null, (e, t, { blockIds: n, props: r, dispatch: o }) => {
1027
+ o({
1028
+ type: "update_props_realtime",
1029
+ payload: { ids: n, props: r }
1030
+ });
1031
+ }), Va = () => {
1032
+ const { createSnapshot: e } = gt(), t = oe(), n = ke(gr);
1033
+ return R(
1034
+ (r, o) => {
1035
+ n({ blockIds: r, props: o, dispatch: t }), e();
1036
+ },
1037
+ [e, t, n]
1038
+ );
1039
+ }, Wa = () => {
1040
+ const e = oe(), t = ke(gr);
1041
+ return R(
1042
+ (n, r) => {
1043
+ t({ blockIds: n, props: r, dispatch: e });
1044
+ },
1045
+ [e, t]
1046
+ );
1047
+ }, hr = {
1048
+ name: "",
1049
+ props: {},
1050
+ modalProps: {},
1051
+ backdropClose: !0
1052
+ }, Ps = b(hr), Ja = () => {
1053
+ const [e, t] = $(Ps), n = R(
1054
+ (o, s = {}, i = {}) => {
1055
+ t({ name: o, props: s, modalProps: i });
1056
+ },
1057
+ [t]
1058
+ ), r = R(
1059
+ (...o) => {
1060
+ U(e, "props.onClose", () => {
1061
+ })(...o), t(hr);
1062
+ },
1063
+ [t, e]
1064
+ );
1065
+ return {
1066
+ activeModal: e,
1067
+ openModal: n,
1068
+ closeModal: r
1069
+ };
1070
+ }, Ga = () => V(ir), Es = b(""), js = b(null), Ka = () => $(Es), Ha = () => $(js), Os = Pe("selectedBreakpoints", ["XS", "MD", "XL"]), Xa = () => {
1071
+ const [e, t] = $(Os);
1072
+ return [e, t];
1073
+ }, Cs = () => {
1074
+ const e = ke(mt), { clear: t } = gt(), [, n] = Ee(), [, r] = ks(), [, o] = Qn();
1075
+ return () => {
1076
+ n([]), o([]), r(""), t(), e({ undoCount: 0, redoCount: 0 });
1077
+ };
1078
+ }, Ls = b({ en: {} }), Ya = () => {
1079
+ const [e, t] = $(Ls), n = R(
1080
+ (r, o, s) => {
1081
+ Se(e, `${r}.${o}`, s), t(e);
1082
+ },
1083
+ [e, t]
1084
+ );
1085
+ return [e, n];
1086
+ }, Qa = (e, t) => {
1087
+ const [n] = $(Rn);
1088
+ return U(n, e, t);
1089
+ }, Ns = b([]), Za = () => {
1090
+ const [e, t] = zr(!1), [n, r] = $(Ns), o = He("getUILibraryBlocks", () => []);
1091
+ return he(() => {
1092
+ (async () => n.length > 0 || (t(!0), r(await o()), t(!1)))();
1093
+ }, []), { data: n, isLoading: e };
1094
+ }, Ts = b("en"), Ms = b("en"), Ds = b(["en"]), $s = () => $(Ts), ec = () => $(Ms), tc = () => $(Ds), nc = (e, t) => {
1095
+ const [n] = $s(), r = `${e}${n ? `-${n}` : ""}`;
1096
+ return { content: U(t, r, U(t, e, "")), propKey: e };
1097
+ }, Rs = () => {
1098
+ const [e, t] = Zn(), n = He("previewComponent");
1099
+ return /* @__PURE__ */ C.jsxs("div", { className: eo("fixed inset-0 z-[999] bg-background", e ? "block" : "hidden"), children: [
1100
+ /* @__PURE__ */ C.jsx(Hr, { size: "sm", className: "absolute right-0 top-0 m-4", onClick: () => t(!1), children: "Close Preview" }),
1101
+ /* @__PURE__ */ C.jsx("div", { children: n ? /* @__PURE__ */ C.jsx(ze, { fallback: /* @__PURE__ */ C.jsx(Xr, { className: "h-96 w-full" }), children: Tn.createElement(n) }) : null })
1102
+ ] });
1103
+ }, Us = () => {
1104
+ const [e, t] = Ee(), [, n] = hs(), r = _s(), o = pr(), [, s] = ur(), { pasteBlocks: i } = xs(), { undo: a, redo: u } = gt();
1105
+ pe("esc", () => t([]), {}, [t]), pe("ctrl+c,command+c", () => n(e), {}, [e, n]), pe("ctrl+d,command+d", () => o(e), { preventDefault: !0 }, [e, o]), pe("ctrl+x,command+x", () => s(e), {}, [e, s]), pe("ctrl+v,command+v", () => e.length === 1 ? i(e[0]) : null, {}, [e, i]), pe("ctrl+z,command+z", () => a(), {}, [a]), pe("ctrl+y,command+y", () => u(), {}, [u]), pe(
1106
+ "del, backspace",
1107
+ (c) => {
1108
+ c.preventDefault(), r(e);
1109
+ },
1110
+ {},
1111
+ [e, r]
1112
+ );
1113
+ }, qs = (e, t) => {
1114
+ const n = [];
1115
+ let r = se(e, { _id: t }), o = U(r, "_parent", "");
1116
+ for (; Nt(o) && !de(o); )
1117
+ n.push(r == null ? void 0 : r._parent), r = se(e, { _id: o }), o = r == null ? void 0 : r._parent;
1118
+ return ne(n);
1119
+ }, yr = b([]), Fs = () => {
1120
+ const [e] = Ee(), t = V(re), [, n] = $(yr);
1121
+ he(() => {
1122
+ let r = [];
1123
+ const o = le(e);
1124
+ Nt(o) && (r = [o, ...qs(t, o)]), n(r);
1125
+ }, [e, t, n]);
1126
+ }, rc = () => V(yr), zs = dt(() => import("./SidePanels-f48777bb.js")), Vs = dt(() => import("./Topbar-64729901.js")), Ws = dt(() => import("./CanvasArea-a7901131.js")), Js = dt(() => import("./Settings-b1afcefe.js")), Gs = () => {
1127
+ const e = (t) => {
1128
+ t.preventDefault();
1129
+ };
1130
+ return Us(), Fs(), /* @__PURE__ */ C.jsx("div", { className: "h-screen w-screen bg-background text-foreground", children: /* @__PURE__ */ C.jsxs(Yr, { children: [
1131
+ /* @__PURE__ */ C.jsxs(
1132
+ "div",
1133
+ {
1134
+ onContextMenu: e,
1135
+ className: "flex h-screen flex-col overflow-hidden bg-background text-foreground",
1136
+ children: [
1137
+ /* @__PURE__ */ C.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ C.jsx(ze, { children: /* @__PURE__ */ C.jsx(Vs, {}) }) }),
1138
+ /* @__PURE__ */ C.jsxs("main", { className: "flex h-full flex-row", children: [
1139
+ /* @__PURE__ */ C.jsx("div", { className: "flex h-full w-fit border-border", children: /* @__PURE__ */ C.jsx(ze, { children: /* @__PURE__ */ C.jsx(zs, {}) }) }),
1140
+ /* @__PURE__ */ C.jsx("div", { className: "h-full flex-1 bg-slate-800/20", children: /* @__PURE__ */ C.jsx(ze, { children: /* @__PURE__ */ C.jsx(Ws, {}) }) }),
1141
+ /* @__PURE__ */ C.jsx("div", { className: "flex h-full w-[280px] min-w-[280px] border-l border-border", children: /* @__PURE__ */ C.jsx(ze, { children: /* @__PURE__ */ C.jsx(Js, {}) }) })
1142
+ ] })
1143
+ ]
1144
+ }
1145
+ ),
1146
+ /* @__PURE__ */ C.jsx(Rs, {})
1147
+ ] }) });
1148
+ }, Ks = Zr();
1149
+ b({});
1150
+ function un(e, t, n, r, o) {
1151
+ for (t = t.split ? t.split(".") : t, r = 0; r < t.length; r++)
1152
+ e = e ? e[t[r]] : o;
1153
+ return e === o ? n : e;
1154
+ }
1155
+ var tt = "undefined", dn = "object", vr = "any", br = "*", Ie = "__", lt = typeof process < "u" ? process : {};
1156
+ lt.env && lt.env.NODE_ENV;
1157
+ var ie = typeof document < "u";
1158
+ lt.versions != null && lt.versions.node != null;
1159
+ typeof Deno < "u" && Deno.core;
1160
+ ie && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
1161
+ function kr(e, t) {
1162
+ return t.charAt(0)[e]() + t.slice(1);
1163
+ }
1164
+ var Hs = kr.bind(null, "toUpperCase"), Xs = kr.bind(null, "toLowerCase");
1165
+ function Ys(e) {
1166
+ return wr(e) ? Hs("null") : typeof e == "object" ? ni(e) : Object.prototype.toString.call(e).slice(8, -1);
1167
+ }
1168
+ function ut(e, t) {
1169
+ t === void 0 && (t = !0);
1170
+ var n = Ys(e);
1171
+ return t ? Xs(n) : n;
1172
+ }
1173
+ function Qe(e, t) {
1174
+ return typeof t === e;
1175
+ }
1176
+ var ce = Qe.bind(null, "function"), Ce = Qe.bind(null, "string"), je = Qe.bind(null, "undefined"), Qs = Qe.bind(null, "boolean");
1177
+ Qe.bind(null, "symbol");
1178
+ function wr(e) {
1179
+ return e === null;
1180
+ }
1181
+ function Zs(e) {
1182
+ return ut(e) === "number" && !isNaN(e);
1183
+ }
1184
+ function ei(e) {
1185
+ return ut(e) === "array";
1186
+ }
1187
+ function te(e) {
1188
+ if (!ti(e))
1189
+ return !1;
1190
+ for (var t = e; Object.getPrototypeOf(t) !== null; )
1191
+ t = Object.getPrototypeOf(t);
1192
+ return Object.getPrototypeOf(e) === t;
1193
+ }
1194
+ function ti(e) {
1195
+ return e && (typeof e == "object" || e !== null);
1196
+ }
1197
+ function ni(e) {
1198
+ return ce(e.constructor) ? e.constructor.name : null;
1199
+ }
1200
+ function ri(e) {
1201
+ return e instanceof Error || Ce(e.message) && e.constructor && Zs(e.constructor.stackTraceLimit);
1202
+ }
1203
+ function xr(e, t) {
1204
+ if (typeof t != "object" || wr(t))
1205
+ return !1;
1206
+ if (t instanceof e)
1207
+ return !0;
1208
+ var n = ut(new e(""));
1209
+ if (ri(t))
1210
+ for (; t; ) {
1211
+ if (ut(t) === n)
1212
+ return !0;
1213
+ t = Object.getPrototypeOf(t);
1214
+ }
1215
+ return !1;
1216
+ }
1217
+ xr.bind(null, TypeError);
1218
+ xr.bind(null, SyntaxError);
1219
+ function ht(e, t) {
1220
+ var n = e instanceof Element || e instanceof HTMLDocument;
1221
+ return n && t ? oi(e, t) : n;
1222
+ }
1223
+ function oi(e, t) {
1224
+ return t === void 0 && (t = ""), e && e.nodeName === t.toUpperCase();
1225
+ }
1226
+ function yt(e) {
1227
+ var t = [].slice.call(arguments, 1);
1228
+ return function() {
1229
+ return e.apply(void 0, [].slice.call(arguments).concat(t));
1230
+ };
1231
+ }
1232
+ yt(ht, "form");
1233
+ yt(ht, "button");
1234
+ yt(ht, "input");
1235
+ yt(ht, "select");
1236
+ function pn(e) {
1237
+ try {
1238
+ return decodeURIComponent(e.replace(/\+/g, " "));
1239
+ } catch {
1240
+ return null;
1241
+ }
1242
+ }
1243
+ function si() {
1244
+ if (ie) {
1245
+ var e = navigator, t = e.languages;
1246
+ return e.userLanguage || (t && t.length ? t[0] : e.language);
1247
+ }
1248
+ }
1249
+ function ii() {
1250
+ try {
1251
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
1252
+ } catch {
1253
+ }
1254
+ }
1255
+ function ai(e) {
1256
+ return function(t) {
1257
+ for (var n, r = /* @__PURE__ */ Object.create(null), o = /([^&=]+)=?([^&]*)/g; n = o.exec(t); ) {
1258
+ var s = pn(n[1]), i = pn(n[2]);
1259
+ s.substring(s.length - 2) === "[]" ? (r[s = s.substring(0, s.length - 2)] || (r[s] = [])).push(i) : r[s] = i === "" || i;
1260
+ }
1261
+ for (var a in r) {
1262
+ var u = a.split("[");
1263
+ u.length > 1 && (ci(r, u.map(function(c) {
1264
+ return c.replace(/[?[\]\\ ]/g, "");
1265
+ }), r[a]), delete r[a]);
1266
+ }
1267
+ return r;
1268
+ }(function(t) {
1269
+ if (t) {
1270
+ var n = t.match(/\?(.*)/);
1271
+ return n && n[1] ? n[1].split("#")[0] : "";
1272
+ }
1273
+ return ie && window.location.search.substring(1);
1274
+ }(e));
1275
+ }
1276
+ function ci(e, t, n) {
1277
+ for (var r = t.length - 1, o = 0; o < r; ++o) {
1278
+ var s = t[o];
1279
+ if (s === "__proto__" || s === "constructor")
1280
+ break;
1281
+ s in e || (e[s] = {}), e = e[s];
1282
+ }
1283
+ e[t[r]] = n;
1284
+ }
1285
+ function vt() {
1286
+ for (var e = "", t = 0, n = 4294967295 * Math.random() | 0; t++ < 36; ) {
1287
+ var r = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t - 1], o = 15 & n;
1288
+ e += r == "-" || r == "4" ? r : (r == "x" ? o : 3 & o | 8).toString(16), n = t % 8 == 0 ? 4294967295 * Math.random() | 0 : n >> 4;
1289
+ }
1290
+ return e;
1291
+ }
1292
+ var We = "global", Me = Ie + "global" + Ie, De = typeof self === dn && self.self === self && self || typeof global === dn && global.global === global && global || void 0;
1293
+ function Ae(e) {
1294
+ return De[Me][e];
1295
+ }
1296
+ function Be(e, t) {
1297
+ return De[Me][e] = t;
1298
+ }
1299
+ function Re(e) {
1300
+ delete De[Me][e];
1301
+ }
1302
+ function Ue(e, t, n) {
1303
+ var r;
1304
+ try {
1305
+ if (Wt(e)) {
1306
+ var o = window[e];
1307
+ r = o[t].bind(o);
1308
+ }
1309
+ } catch {
1310
+ }
1311
+ return r || n;
1312
+ }
1313
+ De[Me] || (De[Me] = {});
1314
+ var nt = {};
1315
+ function Wt(e) {
1316
+ if (typeof nt[e] !== tt)
1317
+ return nt[e];
1318
+ try {
1319
+ var t = window[e];
1320
+ t.setItem(tt, tt), t.removeItem(tt);
1321
+ } catch {
1322
+ return nt[e] = !1;
1323
+ }
1324
+ return nt[e] = !0;
1325
+ }
1326
+ function w() {
1327
+ return w = Object.assign || function(e) {
1328
+ for (var t = 1; t < arguments.length; t++) {
1329
+ var n = arguments[t];
1330
+ for (var r in n)
1331
+ Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
1332
+ }
1333
+ return e;
1334
+ }, w.apply(this, arguments);
1335
+ }
1336
+ var ge = "function", ue = "undefined", li = "@@redux/" + Math.random().toString(36), fn = /* @__PURE__ */ function() {
1337
+ return typeof Symbol === ge && Symbol.observable || "@@observable";
1338
+ }(), rt = " != " + ge;
1339
+ function Sr(e, t, n) {
1340
+ var r;
1341
+ if (typeof t === ge && typeof n === ue && (n = t, t = void 0), typeof n !== ue) {
1342
+ if (typeof n !== ge)
1343
+ throw new Error("enhancer" + rt);
1344
+ return n(Sr)(e, t);
1345
+ }
1346
+ if (typeof e !== ge)
1347
+ throw new Error("reducer" + rt);
1348
+ var o = e, s = t, i = [], a = i, u = !1;
1349
+ function c() {
1350
+ a === i && (a = i.slice());
1351
+ }
1352
+ function p() {
1353
+ return s;
1354
+ }
1355
+ function f(m) {
1356
+ if (typeof m !== ge)
1357
+ throw new Error("Listener" + rt);
1358
+ var I = !0;
1359
+ return c(), a.push(m), function() {
1360
+ if (I) {
1361
+ I = !1, c();
1362
+ var S = a.indexOf(m);
1363
+ a.splice(S, 1);
1364
+ }
1365
+ };
1366
+ }
1367
+ function h(m) {
1368
+ if (!te(m))
1369
+ throw new Error("Act != obj");
1370
+ if (typeof m.type === ue)
1371
+ throw new Error("ActType " + ue);
1372
+ if (u)
1373
+ throw new Error("Dispatch in reducer");
1374
+ try {
1375
+ u = !0, s = o(s, m);
1376
+ } finally {
1377
+ u = !1;
1378
+ }
1379
+ for (var I = i = a, S = 0; S < I.length; S++)
1380
+ (0, I[S])();
1381
+ return m;
1382
+ }
1383
+ return h({ type: "@@redux/INIT" }), (r = { dispatch: h, subscribe: f, getState: p, replaceReducer: function(m) {
1384
+ if (typeof m !== ge)
1385
+ throw new Error("next reducer" + rt);
1386
+ o = m, h({ type: "@@redux/INIT" });
1387
+ } })[fn] = function() {
1388
+ var m, I = f;
1389
+ return (m = { subscribe: function(S) {
1390
+ if (typeof S != "object")
1391
+ throw new TypeError("Observer != obj");
1392
+ function x() {
1393
+ S.next && S.next(p());
1394
+ }
1395
+ return x(), { unsubscribe: I(x) };
1396
+ } })[fn] = function() {
1397
+ return this;
1398
+ }, m;
1399
+ }, r;
1400
+ }
1401
+ function ui(e, t) {
1402
+ var n = t && t.type;
1403
+ return "action " + (n && n.toString() || "?") + "reducer " + e + " returns " + ue;
1404
+ }
1405
+ function $e() {
1406
+ var e = [].slice.call(arguments);
1407
+ return e.length === 0 ? function(t) {
1408
+ return t;
1409
+ } : e.length === 1 ? e[0] : e.reduce(function(t, n) {
1410
+ return function() {
1411
+ return t(n.apply(void 0, [].slice.call(arguments)));
1412
+ };
1413
+ });
1414
+ }
1415
+ function di() {
1416
+ var e = arguments;
1417
+ return function(t) {
1418
+ return function(n, r, o) {
1419
+ var s, i = t(n, r, o), a = i.dispatch, u = { getState: i.getState, dispatch: function(c) {
1420
+ return a(c);
1421
+ } };
1422
+ return s = [].slice.call(e).map(function(c) {
1423
+ return c(u);
1424
+ }), w({}, i, { dispatch: a = $e.apply(void 0, s)(i.dispatch) });
1425
+ };
1426
+ };
1427
+ }
1428
+ var be = Ie + "anon_id", xe = Ie + "user_id", Le = Ie + "user_traits", fe = "userId", Oe = "anonymousId", ct = ["bootstrap", "params", "campaign", "initializeStart", "initialize", "initializeEnd", "ready", "resetStart", "reset", "resetEnd", "pageStart", "page", "pageEnd", "pageAborted", "trackStart", "track", "trackEnd", "trackAborted", "identifyStart", "identify", "identifyEnd", "identifyAborted", "userIdChanged", "registerPlugins", "enablePlugin", "disablePlugin", "online", "offline", "setItemStart", "setItem", "setItemEnd", "setItemAborted", "removeItemStart", "removeItem", "removeItemEnd", "removeItemAborted"], Ct = ["name", "EVENTS", "config", "loaded"], k = ct.reduce(function(e, t) {
1429
+ return e[t] = t, e;
1430
+ }, { registerPluginType: function(e) {
1431
+ return "registerPlugin:" + e;
1432
+ }, pluginReadyType: function(e) {
1433
+ return "ready:" + e;
1434
+ } }), mn = /^utm_/, gn = /^an_prop_/, hn = /^an_trait_/;
1435
+ function pi(e) {
1436
+ var t = e.storage.setItem;
1437
+ return function(n) {
1438
+ return function(r) {
1439
+ return function(o) {
1440
+ if (o.type === k.bootstrap) {
1441
+ var s = o.params, i = o.user, a = o.persistedUser, u = o.initialUser, c = a.userId === i.userId;
1442
+ a.anonymousId !== i.anonymousId && t(be, i.anonymousId), c || t(xe, i.userId), u.traits && t(Le, w({}, c && a.traits ? a.traits : {}, u.traits));
1443
+ var p = Object.keys(o.params);
1444
+ if (p.length) {
1445
+ var f = s.an_uid, h = s.an_event, m = p.reduce(function(I, S) {
1446
+ if (S.match(mn) || S.match(/^(d|g)clid/)) {
1447
+ var x = S.replace(mn, "");
1448
+ I.campaign[x === "campaign" ? "name" : x] = s[S];
1449
+ }
1450
+ return S.match(gn) && (I.props[S.replace(gn, "")] = s[S]), S.match(hn) && (I.traits[S.replace(hn, "")] = s[S]), I;
1451
+ }, { campaign: {}, props: {}, traits: {} });
1452
+ n.dispatch(w({ type: k.params, raw: s }, m, f ? { userId: f } : {})), f && setTimeout(function() {
1453
+ return e.identify(f, m.traits);
1454
+ }, 0), h && setTimeout(function() {
1455
+ return e.track(h, m.props);
1456
+ }, 0), Object.keys(m.campaign).length && n.dispatch({ type: k.campaign, campaign: m.campaign });
1457
+ }
1458
+ }
1459
+ return r(o);
1460
+ };
1461
+ };
1462
+ };
1463
+ }
1464
+ function fi(e) {
1465
+ return function(t, n) {
1466
+ if (t === void 0 && (t = {}), n === void 0 && (n = {}), n.type === k.setItemEnd) {
1467
+ if (n.key === be)
1468
+ return w({}, t, { anonymousId: n.value });
1469
+ if (n.key === xe)
1470
+ return w({}, t, { userId: n.value });
1471
+ }
1472
+ switch (n.type) {
1473
+ case k.identify:
1474
+ return Object.assign({}, t, { userId: n.userId, traits: w({}, t.traits, n.traits) });
1475
+ case k.reset:
1476
+ return [xe, be, Le].forEach(function(r) {
1477
+ e.removeItem(r);
1478
+ }), Object.assign({}, t, { userId: null, anonymousId: null, traits: {} });
1479
+ default:
1480
+ return t;
1481
+ }
1482
+ };
1483
+ }
1484
+ function yn(e) {
1485
+ return { userId: e.getItem(xe), anonymousId: e.getItem(be), traits: e.getItem(Le) };
1486
+ }
1487
+ var Lt = function(e) {
1488
+ return Ie + "TEMP" + Ie + e;
1489
+ };
1490
+ function mi(e) {
1491
+ var t = e.storage, n = t.setItem, r = t.removeItem, o = t.getItem;
1492
+ return function(s) {
1493
+ return function(i) {
1494
+ return function(a) {
1495
+ var u = a.userId, c = a.traits, p = a.options;
1496
+ if (a.type === k.reset && ([xe, Le, be].forEach(function(m) {
1497
+ r(m);
1498
+ }), [fe, Oe, "traits"].forEach(function(m) {
1499
+ Re(Lt(m));
1500
+ })), a.type === k.identify) {
1501
+ o(be) || n(be, vt());
1502
+ var f = o(xe), h = o(Le) || {};
1503
+ f && f !== u && s.dispatch({ type: k.userIdChanged, old: { userId: f, traits: h }, new: { userId: u, traits: c }, options: p }), u && n(xe, u), c && n(Le, w({}, h, c));
1504
+ }
1505
+ return i(a);
1506
+ };
1507
+ };
1508
+ };
1509
+ }
1510
+ var Ve = {};
1511
+ function vn(e, t) {
1512
+ Ve[e] && ce(Ve[e]) && (Ve[e](t), delete Ve[e]);
1513
+ }
1514
+ function _r(e, t, n) {
1515
+ return new Promise(function(r, o) {
1516
+ return t() ? r(e) : n < 1 ? o(w({}, e, { queue: !0 })) : new Promise(function(s) {
1517
+ return setTimeout(s, 10);
1518
+ }).then(function(s) {
1519
+ return _r(e, t, n - 10).then(r, o);
1520
+ });
1521
+ });
1522
+ }
1523
+ function Ir(e, t, n) {
1524
+ var r = t(), o = e.getState(), s = o.plugins, i = o.queue, a = o.user;
1525
+ if (!o.context.offline && i && i.actions && i.actions.length) {
1526
+ var u = i.actions.reduce(function(p, f, h) {
1527
+ return s[f.plugin].loaded ? (p.process.push(f), p.processIndex.push(h)) : (p.requeue.push(f), p.requeueIndex.push(h)), p;
1528
+ }, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
1529
+ if (u.processIndex && u.processIndex.length) {
1530
+ u.processIndex.forEach(function(p) {
1531
+ var f = i.actions[p], h = f.plugin, m = f.payload.type, I = r[h][m];
1532
+ if (I && ce(I)) {
1533
+ var S = function(E, B) {
1534
+ return E === void 0 && (E = {}), B === void 0 && (B = {}), [fe, Oe].reduce(function(O, g) {
1535
+ return E.hasOwnProperty(g) && B[g] && B[g] !== E[g] && (O[g] = B[g]), O;
1536
+ }, E);
1537
+ }(f.payload, a);
1538
+ I({ payload: S, config: s[h].config, instance: n });
1539
+ var x = m + ":" + h;
1540
+ e.dispatch(w({}, S, { type: x, _: { called: x, from: "queueDrain" } }));
1541
+ }
1542
+ });
1543
+ var c = i.actions.filter(function(p, f) {
1544
+ return !~u.processIndex.indexOf(f);
1545
+ });
1546
+ i.actions = c;
1547
+ }
1548
+ }
1549
+ }
1550
+ var St = function(e) {
1551
+ var t = e.data, n = e.action, r = e.instance, o = e.state, s = e.allPlugins, i = e.allMatches, a = e.store, u = e.EVENTS;
1552
+ try {
1553
+ var c = o.plugins, p = o.context, f = n.type, h = f.match(Ne), m = t.exact.map(function(x) {
1554
+ return x.pluginName;
1555
+ });
1556
+ h && (m = i.during.map(function(x) {
1557
+ return x.pluginName;
1558
+ }));
1559
+ var I = function(x, E) {
1560
+ return function(B, O, g) {
1561
+ var y = O.config, L = O.name, M = L + "." + B.type;
1562
+ g && (M = g.event);
1563
+ var j = B.type.match(Ne) ? function(z, q, Z, W, ee) {
1564
+ return function(G, _) {
1565
+ var H = W ? W.name : z, Y = _ && Xe(_) ? _ : Z;
1566
+ if (W && (!(Y = _ && Xe(_) ? _ : [z]).includes(z) || Y.length !== 1))
1567
+ throw new Error("Method " + q + " can only abort " + z + " plugin. " + JSON.stringify(Y) + " input valid");
1568
+ return w({}, ee, { abort: { reason: G, plugins: Y, caller: q, _: H } });
1569
+ };
1570
+ }(L, M, E, g, B) : function(z, q) {
1571
+ return function() {
1572
+ throw new Error(z.type + " action not cancellable. Remove abort in " + q);
1573
+ };
1574
+ }(B, M);
1575
+ return { payload: gi(B), instance: x, config: y || {}, abort: j };
1576
+ };
1577
+ }(r, m), S = t.exact.reduce(function(x, E) {
1578
+ var B = E.pluginName, O = E.methodName, g = !1;
1579
+ return O.match(/^initialize/) || O.match(/^reset/) || (g = !c[B].loaded), p.offline && O.match(/^(page|track|identify)/) && (g = !0), x["" + B] = g, x;
1580
+ }, {});
1581
+ return Promise.resolve(t.exact.reduce(function(x, E, B) {
1582
+ try {
1583
+ var O = E.pluginName;
1584
+ return Promise.resolve(x).then(function(g) {
1585
+ function y() {
1586
+ return Promise.resolve(g);
1587
+ }
1588
+ var L = function() {
1589
+ if (t.namespaced && t.namespaced[O])
1590
+ return Promise.resolve(t.namespaced[O].reduce(function(M, j, z) {
1591
+ try {
1592
+ return Promise.resolve(M).then(function(q) {
1593
+ return j.method && ce(j.method) ? (function(G, _) {
1594
+ var H = In(G);
1595
+ if (H && H.name === _) {
1596
+ var Y = In(H.method);
1597
+ throw new Error([_ + " plugin is calling method " + G, "Plugins cant call self", "Use " + H.method + " " + (Y ? "or " + Y.method : "") + " in " + _ + " plugin insteadof " + G].join(`
1598
+ `));
1599
+ }
1600
+ }(j.methodName, j.pluginName), Promise.resolve(j.method({ payload: q, instance: r, abort: (Z = q, W = O, ee = j.pluginName, function(G, _) {
1601
+ return w({}, Z, { abort: { reason: G, plugins: _ || [W], caller: f, from: ee || W } });
1602
+ }), config: wn(j.pluginName, c, s), plugins: c })).then(function(G) {
1603
+ var _ = te(G) ? G : {};
1604
+ return Promise.resolve(w({}, q, _));
1605
+ })) : q;
1606
+ var Z, W, ee;
1607
+ });
1608
+ } catch (q) {
1609
+ return Promise.reject(q);
1610
+ }
1611
+ }, Promise.resolve(n))).then(function(M) {
1612
+ g[O] = M;
1613
+ });
1614
+ g[O] = n;
1615
+ }();
1616
+ return L && L.then ? L.then(y) : y();
1617
+ });
1618
+ } catch (g) {
1619
+ return Promise.reject(g);
1620
+ }
1621
+ }, Promise.resolve({}))).then(function(x) {
1622
+ return Promise.resolve(t.exact.reduce(function(E, B, O) {
1623
+ try {
1624
+ var g = t.exact.length === O + 1, y = B.pluginName, L = s[y];
1625
+ return Promise.resolve(E).then(function(M) {
1626
+ var j = x[y] ? x[y] : {};
1627
+ if (h && (j = M), It(j, y))
1628
+ return _t({ data: j, method: f, instance: r, pluginName: y, store: a }), Promise.resolve(M);
1629
+ if (It(M, y))
1630
+ return g && _t({ data: M, method: f, instance: r, store: a }), Promise.resolve(M);
1631
+ if (S.hasOwnProperty(y) && S[y] === !0)
1632
+ return a.dispatch({ type: "queue", plugin: y, payload: j, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(M);
1633
+ var z = I(x[y], s[y]);
1634
+ return Promise.resolve(L[f]({ abort: z.abort, payload: j, instance: r, config: wn(y, c, s), plugins: c })).then(function(q) {
1635
+ var Z = te(q) ? q : {}, W = w({}, M, Z), ee = x[y];
1636
+ if (It(ee, y))
1637
+ _t({ data: ee, method: f, instance: r, pluginName: y, store: a });
1638
+ else {
1639
+ var G = f + ":" + y;
1640
+ (G.match(/:/g) || []).length < 2 && !f.match(bn) && !f.match(kn) && r.dispatch(w({}, h ? W : j, { type: G, _: { called: G, from: "submethod" } }));
1641
+ }
1642
+ return Promise.resolve(W);
1643
+ });
1644
+ });
1645
+ } catch (M) {
1646
+ return Promise.reject(M);
1647
+ }
1648
+ }, Promise.resolve(n))).then(function(E) {
1649
+ if (!(f.match(Ne) || f.match(/^registerPlugin/) || f.match(kn) || f.match(bn) || f.match(/^params/) || f.match(/^userIdChanged/))) {
1650
+ if (u.plugins.includes(f), E._ && E._.originalAction === f)
1651
+ return E;
1652
+ var B = w({}, E, { _: { originalAction: E.type, called: E.type, from: "engineEnd" } });
1653
+ Ar(E, t.exact.length) && !f.match(/End$/) && (B = w({}, B, { type: E.type + "Aborted" })), a.dispatch(B);
1654
+ }
1655
+ return E;
1656
+ });
1657
+ });
1658
+ } catch (x) {
1659
+ return Promise.reject(x);
1660
+ }
1661
+ }, Ne = /Start$/, bn = /^bootstrap/, kn = /^ready/;
1662
+ function _t(e) {
1663
+ var t = e.pluginName, n = e.method + "Aborted" + (t ? ":" + t : "");
1664
+ e.store.dispatch(w({}, e.data, { type: n, _: { called: n, from: "abort" } }));
1665
+ }
1666
+ function wn(e, t, n) {
1667
+ var r = t[e] || n[e];
1668
+ return r && r.config ? r.config : {};
1669
+ }
1670
+ function xn(e, t) {
1671
+ return t.reduce(function(n, r) {
1672
+ return r[e] ? n.concat({ methodName: e, pluginName: r.name, method: r[e] }) : n;
1673
+ }, []);
1674
+ }
1675
+ function Sn(e, t) {
1676
+ var n = e.replace(Ne, ""), r = t ? ":" + t : "";
1677
+ return ["" + e + r, "" + n + r, n + "End" + r];
1678
+ }
1679
+ function It(e, t) {
1680
+ var n = e.abort;
1681
+ return !!n && (n === !0 || _n(n, t) || n && _n(n.plugins, t));
1682
+ }
1683
+ function Ar(e, t) {
1684
+ var n = e.abort;
1685
+ if (!n)
1686
+ return !1;
1687
+ if (n === !0 || Ce(n))
1688
+ return !0;
1689
+ var r = n.plugins;
1690
+ return Xe(n) && n.length === t || Xe(r) && r.length === t;
1691
+ }
1692
+ function Xe(e) {
1693
+ return Array.isArray(e);
1694
+ }
1695
+ function _n(e, t) {
1696
+ return !(!e || !Xe(e)) && e.includes(t);
1697
+ }
1698
+ function In(e) {
1699
+ var t = e.match(/(.*):(.*)/);
1700
+ return !!t && { method: t[1], name: t[2] };
1701
+ }
1702
+ function gi(e) {
1703
+ return Object.keys(e).reduce(function(t, n) {
1704
+ return n === "type" || (t[n] = te(e[n]) ? Object.assign({}, e[n]) : e[n]), t;
1705
+ }, {});
1706
+ }
1707
+ function hi(e, t, n) {
1708
+ var r = {};
1709
+ return function(o) {
1710
+ return function(s) {
1711
+ return function(i) {
1712
+ try {
1713
+ var a, u = function(g) {
1714
+ return a ? g : s(f);
1715
+ }, c = i.type, p = i.plugins, f = i;
1716
+ if (i.abort)
1717
+ return Promise.resolve(s(i));
1718
+ if (c === k.enablePlugin && o.dispatch({ type: k.initializeStart, plugins: p, disabled: [], fromEnable: !0, meta: i.meta }), c === k.disablePlugin && setTimeout(function() {
1719
+ return vn(i.meta.rid, { payload: i });
1720
+ }, 0), c === k.initializeEnd) {
1721
+ var h = t(), m = Object.keys(h), I = m.filter(function(g) {
1722
+ return p.includes(g);
1723
+ }).map(function(g) {
1724
+ return h[g];
1725
+ }), S = [], x = [], E = i.disabled, B = I.map(function(g) {
1726
+ var y = g.loaded, L = g.name, M = g.config;
1727
+ return _r(g, function() {
1728
+ return y({ config: M });
1729
+ }, 1e4).then(function(j) {
1730
+ return r[L] || (o.dispatch({ type: k.pluginReadyType(L), name: L, events: Object.keys(g).filter(function(z) {
1731
+ return !Ct.includes(z);
1732
+ }) }), r[L] = !0), S = S.concat(L), g;
1733
+ }).catch(function(j) {
1734
+ if (j instanceof Error)
1735
+ throw new Error(j);
1736
+ return x = x.concat(j.name), j;
1737
+ });
1738
+ });
1739
+ Promise.all(B).then(function(g) {
1740
+ var y = { plugins: S, failed: x, disabled: E };
1741
+ setTimeout(function() {
1742
+ m.length === B.length + E.length && o.dispatch(w({}, { type: k.ready }, y));
1743
+ }, 0);
1744
+ });
1745
+ }
1746
+ var O = function() {
1747
+ if (c !== k.bootstrap)
1748
+ return /^ready:([^:]*)$/.test(c) && setTimeout(function() {
1749
+ return Ir(o, t, e);
1750
+ }, 0), Promise.resolve(function(g, y, L, M, j) {
1751
+ try {
1752
+ var z = ce(y) ? y() : y, q = g.type, Z = q.replace(Ne, "");
1753
+ if (g._ && g._.called)
1754
+ return Promise.resolve(g);
1755
+ var W = L.getState(), ee = (H = z, (Y = W.plugins) === void 0 && (Y = {}), (qe = g.options) === void 0 && (qe = {}), Object.keys(H).filter(function(l) {
1756
+ var d = qe.plugins || {};
1757
+ return Qs(d[l]) ? d[l] : d.all !== !1 && (!Y[l] || Y[l].enabled !== !1);
1758
+ }).map(function(l) {
1759
+ return H[l];
1760
+ }));
1761
+ q === k.initializeStart && g.fromEnable && (ee = Object.keys(W.plugins).filter(function(l) {
1762
+ var d = W.plugins[l];
1763
+ return g.plugins.includes(l) && !d.initialized;
1764
+ }).map(function(l) {
1765
+ return z[l];
1766
+ }));
1767
+ var G = ee.map(function(l) {
1768
+ return l.name;
1769
+ }), _ = function(l, d, v) {
1770
+ var A = Sn(l).map(function(P) {
1771
+ return xn(P, d);
1772
+ });
1773
+ return d.reduce(function(P, N) {
1774
+ var K = N.name, D = Sn(l, K).map(function(Fe) {
1775
+ return xn(Fe, d);
1776
+ }), J = D[0], T = D[1], ae = D[2];
1777
+ return J.length && (P.beforeNS[K] = J), T.length && (P.duringNS[K] = T), ae.length && (P.afterNS[K] = ae), P;
1778
+ }, { before: A[0], beforeNS: {}, during: A[1], duringNS: {}, after: A[2], afterNS: {} });
1779
+ }(q, ee);
1780
+ return Promise.resolve(St({ action: g, data: { exact: _.before, namespaced: _.beforeNS }, state: W, allPlugins: z, allMatches: _, instance: L, store: M, EVENTS: j })).then(function(l) {
1781
+ function d() {
1782
+ var P = function() {
1783
+ if (q.match(Ne))
1784
+ return Promise.resolve(St({ action: w({}, v, { type: Z + "End" }), data: { exact: _.after, namespaced: _.afterNS }, state: W, allPlugins: z, allMatches: _, instance: L, store: M, EVENTS: j })).then(function(N) {
1785
+ N.meta && N.meta.hasCallback && vn(N.meta.rid, { payload: N });
1786
+ });
1787
+ }();
1788
+ return P && P.then ? P.then(function() {
1789
+ return l;
1790
+ }) : l;
1791
+ }
1792
+ if (Ar(l, G.length))
1793
+ return l;
1794
+ var v, A = function() {
1795
+ if (q !== Z)
1796
+ return Promise.resolve(St({ action: w({}, l, { type: Z }), data: { exact: _.during, namespaced: _.duringNS }, state: W, allPlugins: z, allMatches: _, instance: L, store: M, EVENTS: j })).then(function(P) {
1797
+ v = P;
1798
+ });
1799
+ v = l;
1800
+ }();
1801
+ return A && A.then ? A.then(d) : d();
1802
+ });
1803
+ } catch (l) {
1804
+ return Promise.reject(l);
1805
+ }
1806
+ var H, Y, qe;
1807
+ }(i, t, e, o, n)).then(function(g) {
1808
+ return a = 1, s(g);
1809
+ });
1810
+ }();
1811
+ return Promise.resolve(O && O.then ? O.then(u) : u(O));
1812
+ } catch (g) {
1813
+ return Promise.reject(g);
1814
+ }
1815
+ };
1816
+ };
1817
+ };
1818
+ }
1819
+ function yi(e) {
1820
+ return function(t) {
1821
+ return function(n) {
1822
+ return function(r) {
1823
+ var o = r.type, s = r.key, i = r.value, a = r.options;
1824
+ if (o === k.setItem || o === k.removeItem) {
1825
+ if (r.abort)
1826
+ return n(r);
1827
+ o === k.setItem ? e.setItem(s, i, a) : e.removeItem(s, a);
1828
+ }
1829
+ return n(r);
1830
+ };
1831
+ };
1832
+ };
1833
+ }
1834
+ var vi = function() {
1835
+ var e = this;
1836
+ this.before = [], this.after = [], this.addMiddleware = function(t, n) {
1837
+ e[n] = e[n].concat(t);
1838
+ }, this.removeMiddleware = function(t, n) {
1839
+ var r = e[n].findIndex(function(o) {
1840
+ return o === t;
1841
+ });
1842
+ r !== -1 && (e[n] = [].concat(e[n].slice(0, r), e[n].slice(r + 1)));
1843
+ }, this.dynamicMiddlewares = function(t) {
1844
+ return function(n) {
1845
+ return function(r) {
1846
+ return function(o) {
1847
+ var s = { getState: n.getState, dispatch: function(a) {
1848
+ return n.dispatch(a);
1849
+ } }, i = e[t].map(function(a) {
1850
+ return a(s);
1851
+ });
1852
+ return $e.apply(void 0, i)(r)(o);
1853
+ };
1854
+ };
1855
+ };
1856
+ };
1857
+ };
1858
+ function bi(e) {
1859
+ return function(t, n) {
1860
+ t === void 0 && (t = {});
1861
+ var r = {};
1862
+ if (n.type === "initialize:aborted")
1863
+ return t;
1864
+ if (/^registerPlugin:([^:]*)$/.test(n.type)) {
1865
+ var o = An(n.type, "registerPlugin"), s = e()[o];
1866
+ if (!s || !o)
1867
+ return t;
1868
+ var i = n.enabled, a = s.config;
1869
+ return r[o] = { enabled: i, initialized: !!i && !s.initialize, loaded: !!i && !!s.loaded({ config: a }), config: a }, w({}, t, r);
1870
+ }
1871
+ if (/^initialize:([^:]*)$/.test(n.type)) {
1872
+ var u = An(n.type, k.initialize), c = e()[u];
1873
+ return c && u ? (r[u] = w({}, t[u], { initialized: !0, loaded: !!c.loaded({ config: c.config }) }), w({}, t, r)) : t;
1874
+ }
1875
+ if (/^ready:([^:]*)$/.test(n.type))
1876
+ return r[n.name] = w({}, t[n.name], { loaded: !0 }), w({}, t, r);
1877
+ switch (n.type) {
1878
+ case k.disablePlugin:
1879
+ return w({}, t, Bn(n.plugins, !1, t));
1880
+ case k.enablePlugin:
1881
+ return w({}, t, Bn(n.plugins, !0, t));
1882
+ default:
1883
+ return t;
1884
+ }
1885
+ };
1886
+ }
1887
+ function An(e, t) {
1888
+ return e.substring(t.length + 1, e.length);
1889
+ }
1890
+ function Bn(e, t, n) {
1891
+ return e.reduce(function(r, o) {
1892
+ return r[o] = w({}, n[o], { enabled: t }), r;
1893
+ }, n);
1894
+ }
1895
+ function Br(e) {
1896
+ try {
1897
+ return JSON.parse(JSON.stringify(e));
1898
+ } catch {
1899
+ }
1900
+ return e;
1901
+ }
1902
+ var ki = { last: {}, history: [] };
1903
+ function wi(e, t) {
1904
+ e === void 0 && (e = ki);
1905
+ var n = t.options, r = t.meta;
1906
+ if (t.type === k.track) {
1907
+ var o = Br(w({ event: t.event, properties: t.properties }, Object.keys(n).length && { options: n }, { meta: r }));
1908
+ return w({}, e, { last: o, history: e.history.concat(o) });
1909
+ }
1910
+ return e;
1911
+ }
1912
+ var xi = { actions: [] };
1913
+ function Si(e, t) {
1914
+ e === void 0 && (e = xi);
1915
+ var n = t.payload;
1916
+ switch (t.type) {
1917
+ case "queue":
1918
+ var r;
1919
+ return r = n && n.type && n.type === k.identify ? [t].concat(e.actions) : e.actions.concat(t), w({}, e, { actions: r });
1920
+ case "dequeue":
1921
+ return [];
1922
+ default:
1923
+ return e;
1924
+ }
1925
+ }
1926
+ var Pr = /#.*$/;
1927
+ function _i(e) {
1928
+ var t = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);
1929
+ return "/" + (t && t[3] ? t[3].split("?")[0].replace(Pr, "") : "");
1930
+ }
1931
+ var Er, jr, Or, Cr, Ii = function(e) {
1932
+ if (e === void 0 && (e = {}), !ie)
1933
+ return e;
1934
+ var t = document, n = t.title, r = t.referrer, o = window, s = o.location, i = o.innerWidth, a = o.innerHeight, u = s.hash, c = s.search, p = function(h) {
1935
+ var m = function() {
1936
+ if (ie) {
1937
+ for (var I, S = document.getElementsByTagName("link"), x = 0; I = S[x]; x++)
1938
+ if (I.getAttribute("rel") === "canonical")
1939
+ return I.getAttribute("href");
1940
+ }
1941
+ }();
1942
+ return m ? m.match(/\?/) ? m : m + h : window.location.href.replace(Pr, "");
1943
+ }(c), f = { title: n, url: p, path: _i(p), hash: u, search: c, width: i, height: a };
1944
+ return r && r !== "" && (f.referrer = r), w({}, f, e);
1945
+ }, Ai = { last: {}, history: [] };
1946
+ function Bi(e, t) {
1947
+ e === void 0 && (e = Ai);
1948
+ var n = t.options;
1949
+ if (t.type === k.page) {
1950
+ var r = Br(w({ properties: t.properties, meta: t.meta }, Object.keys(n).length && { options: n }));
1951
+ return w({}, e, { last: r, history: e.history.concat(r) });
1952
+ }
1953
+ return e;
1954
+ }
1955
+ Er = function() {
1956
+ if (!ie)
1957
+ return !1;
1958
+ var e = navigator.appVersion;
1959
+ return ~e.indexOf("Win") ? "Windows" : ~e.indexOf("Mac") ? "MacOS" : ~e.indexOf("X11") ? "UNIX" : ~e.indexOf("Linux") ? "Linux" : "Unknown OS";
1960
+ }(), jr = ie ? document.referrer : null, Or = si(), Cr = ii();
1961
+ var Pn = { initialized: !1, sessionId: vt(), app: null, version: null, debug: !1, offline: !!ie && !navigator.onLine, os: { name: Er }, userAgent: ie ? navigator.userAgent : "node", library: { name: "analytics", version: "0.12.5" }, timezone: Cr, locale: Or, campaign: {}, referrer: jr };
1962
+ function Pi(e, t) {
1963
+ e === void 0 && (e = Pn);
1964
+ var n = e.initialized, r = t.campaign;
1965
+ switch (t.type) {
1966
+ case k.campaign:
1967
+ return w({}, e, { campaign: r });
1968
+ case k.offline:
1969
+ return w({}, e, { offline: !0 });
1970
+ case k.online:
1971
+ return w({}, e, { offline: !1 });
1972
+ default:
1973
+ return n ? e : w({}, Pn, e, { initialized: !0 });
1974
+ }
1975
+ }
1976
+ var Ei = ["plugins", "reducers", "storage"];
1977
+ function ji(e, t, n) {
1978
+ if (ie) {
1979
+ var r = window[(n ? "add" : "remove") + "EventListener"];
1980
+ e.split(" ").forEach(function(o) {
1981
+ r(o, t);
1982
+ });
1983
+ }
1984
+ }
1985
+ function Oi(e) {
1986
+ var t = ji.bind(null, "online offline", function(n) {
1987
+ return Promise.resolve(!navigator.onLine).then(e);
1988
+ });
1989
+ return t(!0), function(n) {
1990
+ return t(!1);
1991
+ };
1992
+ }
1993
+ function Lr() {
1994
+ return Be("analytics", []), function(e) {
1995
+ return function(t, n, r) {
1996
+ var o = e(t, n, r), s = o.dispatch;
1997
+ return Object.assign(o, { dispatch: function(i) {
1998
+ return De[Me].analytics.push(i.action || i), s(i);
1999
+ } });
2000
+ };
2001
+ };
2002
+ }
2003
+ function En(e) {
2004
+ return function() {
2005
+ return $e($e.apply(null, arguments), Lr());
2006
+ };
2007
+ }
2008
+ function At(e) {
2009
+ return e ? ei(e) ? e : [e] : [];
2010
+ }
2011
+ function jn(e, t, n) {
2012
+ e === void 0 && (e = {});
2013
+ var r, o, s = vt();
2014
+ return t && (Ve[s] = (r = t, o = function(i) {
2015
+ for (var a, u = i || Array.prototype.slice.call(arguments), c = 0; c < u.length; c++)
2016
+ if (ce(u[c])) {
2017
+ a = u[c];
2018
+ break;
2019
+ }
2020
+ return a;
2021
+ }(n), function(i) {
2022
+ o && o(i), r(i);
2023
+ })), w({}, e, { rid: s, ts: (/* @__PURE__ */ new Date()).getTime() }, t ? { hasCallback: !0 } : {});
2024
+ }
2025
+ function Ci(e) {
2026
+ e === void 0 && (e = {});
2027
+ var t = e.reducers || {}, n = e.initialUser || {}, r = (e.plugins || []).reduce(function(l, d) {
2028
+ if (ce(d))
2029
+ return l.middlewares = l.middlewares.concat(d), l;
2030
+ if (d.NAMESPACE && (d.name = d.NAMESPACE), !d.name)
2031
+ throw new Error("https://lytics.dev/errors/1");
2032
+ d.config || (d.config = {});
2033
+ var v = d.EVENTS ? Object.keys(d.EVENTS).map(function(N) {
2034
+ return d.EVENTS[N];
2035
+ }) : [];
2036
+ l.pluginEnabled[d.name] = !(d.enabled === !1 || d.config.enabled === !1), delete d.enabled, d.methods && (l.methods[d.name] = Object.keys(d.methods).reduce(function(N, K) {
2037
+ var D;
2038
+ return N[K] = (D = d.methods[K], function() {
2039
+ for (var J = Array.prototype.slice.call(arguments), T = new Array(D.length), ae = 0; ae < J.length; ae++)
2040
+ T[ae] = J[ae];
2041
+ return T[T.length] = y, D.apply({ instance: y }, T);
2042
+ }), N;
2043
+ }, {}), delete d.methods);
2044
+ var A = Object.keys(d).concat(v), P = new Set(l.events.concat(A));
2045
+ if (l.events = Array.from(P), l.pluginsArray = l.pluginsArray.concat(d), l.plugins[d.name])
2046
+ throw new Error(d.name + "AlreadyLoaded");
2047
+ return l.plugins[d.name] = d, l.plugins[d.name].loaded || (l.plugins[d.name].loaded = function() {
2048
+ return !0;
2049
+ }), l;
2050
+ }, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), o = e.storage ? e.storage : { getItem: Ae, setItem: Be, removeItem: Re }, s = function(l) {
2051
+ return function(d, v, A) {
2052
+ return v.getState("user")[d] || (A && te(A) && A[d] ? A[d] : yn(l)[d] || Ae(Lt(d)) || null);
2053
+ };
2054
+ }(o), i = r.plugins, a = r.events.filter(function(l) {
2055
+ return !Ct.includes(l);
2056
+ }).sort(), u = new Set(a.concat(ct).filter(function(l) {
2057
+ return !Ct.includes(l);
2058
+ })), c = Array.from(u).sort(), p = function() {
2059
+ return i;
2060
+ }, f = new vi(), h = f.addMiddleware, m = f.removeMiddleware, I = f.dynamicMiddlewares, S = function() {
2061
+ throw new Error("Abort disabled inListener");
2062
+ }, x = ai(), E = yn(o), B = w({}, E, n, x.an_uid ? { userId: x.an_uid } : {}, x.an_aid ? { anonymousId: x.an_aid } : {});
2063
+ B.anonymousId || (B.anonymousId = vt());
2064
+ var O = w({ enable: function(l, d) {
2065
+ return new Promise(function(v) {
2066
+ _.dispatch({ type: k.enablePlugin, plugins: At(l), _: { originalAction: k.enablePlugin } }, v, [d]);
2067
+ });
2068
+ }, disable: function(l, d) {
2069
+ return new Promise(function(v) {
2070
+ _.dispatch({ type: k.disablePlugin, plugins: At(l), _: { originalAction: k.disablePlugin } }, v, [d]);
2071
+ });
2072
+ } }, r.methods), g = !1, y = { identify: function(l, d, v, A) {
2073
+ try {
2074
+ var P = Ce(l) ? l : null, N = te(l) ? l : d, K = v || {}, D = y.user();
2075
+ Be(Lt(fe), P);
2076
+ var J = P || N.userId || s(fe, y, N);
2077
+ return Promise.resolve(new Promise(function(T) {
2078
+ _.dispatch(w({ type: k.identifyStart, userId: J, traits: N || {}, options: K, anonymousId: D.anonymousId }, D.id && D.id !== P && { previousId: D.id }), T, [d, v, A]);
2079
+ }));
2080
+ } catch (T) {
2081
+ return Promise.reject(T);
2082
+ }
2083
+ }, track: function(l, d, v, A) {
2084
+ try {
2085
+ var P = te(l) ? l.event : l;
2086
+ if (!P || !Ce(P))
2087
+ throw new Error("EventMissing");
2088
+ var N = te(l) ? l : d || {}, K = te(v) ? v : {};
2089
+ return Promise.resolve(new Promise(function(D) {
2090
+ _.dispatch({ type: k.trackStart, event: P, properties: N, options: K, userId: s(fe, y, d), anonymousId: s(Oe, y, d) }, D, [d, v, A]);
2091
+ }));
2092
+ } catch (D) {
2093
+ return Promise.reject(D);
2094
+ }
2095
+ }, page: function(l, d, v) {
2096
+ try {
2097
+ var A = te(l) ? l : {}, P = te(d) ? d : {};
2098
+ return Promise.resolve(new Promise(function(N) {
2099
+ _.dispatch({ type: k.pageStart, properties: Ii(A), options: P, userId: s(fe, y, A), anonymousId: s(Oe, y, A) }, N, [l, d, v]);
2100
+ }));
2101
+ } catch (N) {
2102
+ return Promise.reject(N);
2103
+ }
2104
+ }, user: function(l) {
2105
+ if (l === fe || l === "id")
2106
+ return s(fe, y);
2107
+ if (l === Oe || l === "anonId")
2108
+ return s(Oe, y);
2109
+ var d = y.getState("user");
2110
+ return l ? un(d, l) : d;
2111
+ }, reset: function(l) {
2112
+ return new Promise(function(d) {
2113
+ _.dispatch({ type: k.resetStart }, d, l);
2114
+ });
2115
+ }, ready: function(l) {
2116
+ return g && l({ plugins: O, instance: y }), y.on(k.ready, function(d) {
2117
+ l(d), g = !0;
2118
+ });
2119
+ }, on: function(l, d) {
2120
+ if (!l || !ce(d))
2121
+ return !1;
2122
+ if (l === k.bootstrap)
2123
+ throw new Error(".on disabled for " + l);
2124
+ var v = /Start$|Start:/;
2125
+ if (l === "*") {
2126
+ var A = function(D) {
2127
+ return function(J) {
2128
+ return function(T) {
2129
+ return T.type.match(v) && d({ payload: T, instance: y, plugins: i }), J(T);
2130
+ };
2131
+ };
2132
+ }, P = function(D) {
2133
+ return function(J) {
2134
+ return function(T) {
2135
+ return T.type.match(v) || d({ payload: T, instance: y, plugins: i }), J(T);
2136
+ };
2137
+ };
2138
+ };
2139
+ return h(A, ot), h(P, st), function() {
2140
+ m(A, ot), m(P, st);
2141
+ };
2142
+ }
2143
+ var N = l.match(v) ? ot : st, K = function(D) {
2144
+ return function(J) {
2145
+ return function(T) {
2146
+ return T.type === l && d({ payload: T, instance: y, plugins: i, abort: S }), J(T);
2147
+ };
2148
+ };
2149
+ };
2150
+ return h(K, N), function() {
2151
+ return m(K, N);
2152
+ };
2153
+ }, once: function(l, d) {
2154
+ if (!l || !ce(d))
2155
+ return !1;
2156
+ if (l === k.bootstrap)
2157
+ throw new Error(".once disabled for " + l);
2158
+ var v = y.on(l, function(A) {
2159
+ d({ payload: A.payload, instance: y, plugins: i, abort: S }), v();
2160
+ });
2161
+ return v;
2162
+ }, getState: function(l) {
2163
+ var d = _.getState();
2164
+ return l ? un(d, l) : Object.assign({}, d);
2165
+ }, dispatch: function(l) {
2166
+ var d = Ce(l) ? { type: l } : l;
2167
+ if (ct.includes(d.type))
2168
+ throw new Error("reserved action " + d.type);
2169
+ var v = w({}, d, { _: w({ originalAction: d.type }, l._ || {}) });
2170
+ _.dispatch(v);
2171
+ }, enablePlugin: O.enable, disablePlugin: O.disable, plugins: O, storage: { getItem: o.getItem, setItem: function(l, d, v) {
2172
+ _.dispatch({ type: k.setItemStart, key: l, value: d, options: v });
2173
+ }, removeItem: function(l, d) {
2174
+ _.dispatch({ type: k.removeItemStart, key: l, options: d });
2175
+ } }, setAnonymousId: function(l, d) {
2176
+ y.storage.setItem(be, l, d);
2177
+ }, events: { core: ct, plugins: a } }, L = r.middlewares.concat([function(l) {
2178
+ return function(d) {
2179
+ return function(v) {
2180
+ return v.meta || (v.meta = jn()), d(v);
2181
+ };
2182
+ };
2183
+ }, I(ot), hi(y, p, { all: c, plugins: a }), yi(o), pi(y), mi(y), I(st)]), M = { context: Pi, user: fi(o), page: Bi, track: wi, plugins: bi(p), queue: Si }, j = $e, z = $e;
2184
+ if (ie && e.debug) {
2185
+ var q = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
2186
+ q && (j = q({ trace: !0, traceLimit: 25 })), z = function() {
2187
+ return arguments.length === 0 ? Lr() : te(typeof arguments[0]) ? En() : En().apply(null, arguments);
2188
+ };
2189
+ }
2190
+ var Z, W = function(l) {
2191
+ return Object.keys(l).reduce(function(d, v) {
2192
+ return Ei.includes(v) || (d[v] = l[v]), d;
2193
+ }, {});
2194
+ }(e), ee = r.pluginsArray.reduce(function(l, d) {
2195
+ var v = d.name, A = d.config, P = d.loaded, N = r.pluginEnabled[v];
2196
+ return l[v] = { enabled: N, initialized: !!N && !d.initialize, loaded: !!P({ config: A }), config: A }, l;
2197
+ }, {}), G = { context: W, user: B, plugins: ee }, _ = Sr(function(l) {
2198
+ for (var d = Object.keys(l), v = {}, A = 0; A < d.length; A++) {
2199
+ var P = d[A];
2200
+ typeof l[P] === ge && (v[P] = l[P]);
2201
+ }
2202
+ var N, K = Object.keys(v);
2203
+ try {
2204
+ (function(D) {
2205
+ Object.keys(D).forEach(function(J) {
2206
+ var T = D[J];
2207
+ if (typeof T(void 0, { type: "@@redux/INIT" }) === ue || typeof T(void 0, { type: li }) === ue)
2208
+ throw new Error("reducer " + J + " " + ue);
2209
+ });
2210
+ })(v);
2211
+ } catch (D) {
2212
+ N = D;
2213
+ }
2214
+ return function(D, J) {
2215
+ if (D === void 0 && (D = {}), N)
2216
+ throw N;
2217
+ for (var T = !1, ae = {}, Fe = 0; Fe < K.length; Fe++) {
2218
+ var Ze = K[Fe], Yt = D[Ze], wt = (0, v[Ze])(Yt, J);
2219
+ if (typeof wt === ue) {
2220
+ var $r = ui(Ze, J);
2221
+ throw new Error($r);
2222
+ }
2223
+ ae[Ze] = wt, T = T || wt !== Yt;
2224
+ }
2225
+ return T ? ae : D;
2226
+ };
2227
+ }(w({}, M, t)), G, z(j(di.apply(void 0, L))));
2228
+ _.dispatch = (Z = _.dispatch, function(l, d, v) {
2229
+ var A = w({}, l, { meta: jn(l.meta, d, At(v)) });
2230
+ return Z.apply(null, [A]);
2231
+ });
2232
+ var H = Object.keys(i);
2233
+ _.dispatch({ type: k.bootstrap, plugins: H, config: W, params: x, user: B, initialUser: n, persistedUser: E });
2234
+ var Y = H.filter(function(l) {
2235
+ return r.pluginEnabled[l];
2236
+ }), qe = H.filter(function(l) {
2237
+ return !r.pluginEnabled[l];
2238
+ });
2239
+ return _.dispatch({ type: k.registerPlugins, plugins: H, enabled: r.pluginEnabled }), r.pluginsArray.map(function(l, d) {
2240
+ var v = l.bootstrap, A = l.config, P = l.name;
2241
+ v && ce(v) && v({ instance: y, config: A, payload: l }), _.dispatch({ type: k.registerPluginType(P), name: P, enabled: r.pluginEnabled[P], plugin: l }), r.pluginsArray.length === d + 1 && _.dispatch({ type: k.initializeStart, plugins: Y, disabled: qe });
2242
+ }), Oi(function(l) {
2243
+ _.dispatch({ type: l ? k.offline : k.online });
2244
+ }), function(l, d, v) {
2245
+ setInterval(function() {
2246
+ return Ir(l, d, v);
2247
+ }, 3e3);
2248
+ }(_, p, y), y;
2249
+ }
2250
+ var ot = "before", st = "after", Je = "cookie", we = Mr(), Nr = bt, Li = bt;
2251
+ function Tr(e) {
2252
+ return we ? bt(e, "", -1) : Re(e);
2253
+ }
2254
+ function Mr() {
2255
+ if (we !== void 0)
2256
+ return we;
2257
+ var e = "cookiecookie";
2258
+ try {
2259
+ bt(e, e), we = document.cookie.indexOf(e) !== -1, Tr(e);
2260
+ } catch {
2261
+ we = !1;
2262
+ }
2263
+ return we;
2264
+ }
2265
+ function bt(e, t, n, r, o, s) {
2266
+ if (typeof window < "u") {
2267
+ var i = arguments.length > 1;
2268
+ return we === !1 && (i ? Be(e, t) : Ae(e)), i ? document.cookie = e + "=" + encodeURIComponent(t) + (n ? "; expires=" + new Date(+/* @__PURE__ */ new Date() + 1e3 * n).toUTCString() + (r ? "; path=" + r : "") + (o ? "; domain=" + o : "") + (s ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + e + "=")[1] || "").split(";")[0]);
2269
+ }
2270
+ }
2271
+ var Ge = "localStorage", Ni = Wt.bind(null, "localStorage");
2272
+ Ue("localStorage", "getItem", Ae);
2273
+ Ue("localStorage", "setItem", Be);
2274
+ Ue("localStorage", "removeItem", Re);
2275
+ var Ke = "sessionStorage", Ti = Wt.bind(null, "sessionStorage");
2276
+ Ue("sessionStorage", "getItem", Ae);
2277
+ Ue("sessionStorage", "setItem", Be);
2278
+ Ue("sessionStorage", "removeItem", Re);
2279
+ function Te(e) {
2280
+ var t = e;
2281
+ try {
2282
+ if ((t = JSON.parse(e)) === "true")
2283
+ return !0;
2284
+ if (t === "false")
2285
+ return !1;
2286
+ if (te(t))
2287
+ return t;
2288
+ parseFloat(t) === t && (t = parseFloat(t));
2289
+ } catch {
2290
+ }
2291
+ if (t !== null && t !== "")
2292
+ return t;
2293
+ }
2294
+ var Mi = Ni(), Di = Ti(), $i = Mr();
2295
+ function Dr(e, t) {
2296
+ if (e) {
2297
+ var n = Jt(t), r = !Xt(n), o = Gt(n) ? Te(localStorage.getItem(e)) : void 0;
2298
+ if (r && !je(o))
2299
+ return o;
2300
+ var s = Kt(n) ? Te(Nr(e)) : void 0;
2301
+ if (r && s)
2302
+ return s;
2303
+ var i = Ht(n) ? Te(sessionStorage.getItem(e)) : void 0;
2304
+ if (r && i)
2305
+ return i;
2306
+ var a = Ae(e);
2307
+ return r ? a : { localStorage: o, sessionStorage: i, cookie: s, global: a };
2308
+ }
2309
+ }
2310
+ function Ri(e, t, n) {
2311
+ if (e && !je(t)) {
2312
+ var r = {}, o = Jt(n), s = JSON.stringify(t), i = !Xt(o);
2313
+ return Gt(o) && (r[Ge] = it(Ge, t, Te(localStorage.getItem(e))), localStorage.setItem(e, s), i) ? r[Ge] : Kt(o) && (r[Je] = it(Je, t, Te(Nr(e))), Li(e, s), i) ? r[Je] : Ht(o) && (r[Ke] = it(Ke, t, Te(sessionStorage.getItem(e))), sessionStorage.setItem(e, s), i) ? r[Ke] : (r[We] = it(We, t, Ae(e)), Be(e, t), i ? r[We] : r);
2314
+ }
2315
+ }
2316
+ function Ui(e, t) {
2317
+ if (e) {
2318
+ var n = Jt(t), r = Dr(e, br), o = {};
2319
+ return !je(r.localStorage) && Gt(n) && (localStorage.removeItem(e), o[Ge] = r.localStorage), !je(r.cookie) && Kt(n) && (Tr(e), o[Je] = r.cookie), !je(r.sessionStorage) && Ht(n) && (sessionStorage.removeItem(e), o[Ke] = r.sessionStorage), !je(r.global) && kt(n, We) && (Re(e), o[We] = r.global), o;
2320
+ }
2321
+ }
2322
+ function Jt(e) {
2323
+ return e ? Ce(e) ? e : e.storage : vr;
2324
+ }
2325
+ function Gt(e) {
2326
+ return Mi && kt(e, Ge);
2327
+ }
2328
+ function Kt(e) {
2329
+ return $i && kt(e, Je);
2330
+ }
2331
+ function Ht(e) {
2332
+ return Di && kt(e, Ke);
2333
+ }
2334
+ function Xt(e) {
2335
+ return e === br || e === "all";
2336
+ }
2337
+ function kt(e, t) {
2338
+ return e === vr || e === t || Xt(e);
2339
+ }
2340
+ function it(e, t, n) {
2341
+ return { location: e, current: t, previous: n };
2342
+ }
2343
+ var qi = { setItem: Ri, getItem: Dr, removeItem: Ui };
2344
+ function Fi(e, t, n) {
2345
+ return t in e ? Object.defineProperty(e, t, {
2346
+ value: n,
2347
+ enumerable: !0,
2348
+ configurable: !0,
2349
+ writable: !0
2350
+ }) : e[t] = n, e;
2351
+ }
2352
+ function On(e, t) {
2353
+ var n = Object.keys(e);
2354
+ if (Object.getOwnPropertySymbols) {
2355
+ var r = Object.getOwnPropertySymbols(e);
2356
+ t && (r = r.filter(function(o) {
2357
+ return Object.getOwnPropertyDescriptor(e, o).enumerable;
2358
+ })), n.push.apply(n, r);
2359
+ }
2360
+ return n;
2361
+ }
2362
+ function Cn(e) {
2363
+ for (var t = 1; t < arguments.length; t++) {
2364
+ var n = arguments[t] != null ? arguments[t] : {};
2365
+ t % 2 ? On(Object(n), !0).forEach(function(r) {
2366
+ Fi(e, r, n[r]);
2367
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : On(Object(n)).forEach(function(r) {
2368
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
2369
+ });
2370
+ }
2371
+ return e;
2372
+ }
2373
+ function zi() {
2374
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = {
2375
+ storage: qi
2376
+ };
2377
+ return Ci(Cn(Cn({}, t), e));
2378
+ }
2379
+ const Vi = "@chaibuilder/sdk", Wi = "0.1.0", Ji = "module", Gi = [
2380
+ "dist"
2381
+ ], Ki = "dist/core.js", Hi = !1, Xi = {
2382
+ ".": {
2383
+ import: "./dist/core.js",
2384
+ require: "./dist/core.cjs",
2385
+ types: "./dist/core.d.ts"
2386
+ },
2387
+ "./render": {
2388
+ import: "./dist/render.js",
2389
+ require: "./dist/render.cjs",
2390
+ types: "./dist/render.d.ts"
2391
+ },
2392
+ "./ui": {
2393
+ import: "./dist/ui.js",
2394
+ require: "./dist/ui.cjs",
2395
+ types: "./dist/ui.d.ts"
2396
+ },
2397
+ "./lib": {
2398
+ import: "./dist/lib.js",
2399
+ require: "./dist/lib.cjs",
2400
+ types: "./dist/lib.d.ts"
2401
+ },
2402
+ "./styles": {
2403
+ import: "./dist/style.css",
2404
+ require: "./dist/style.css"
2405
+ }
2406
+ }, Yi = {
2407
+ dev: "vite",
2408
+ build: "tsc && vite build",
2409
+ lint: "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
2410
+ preview: "vite preview",
2411
+ test: "jest --colors",
2412
+ "test:watch": "jest --watch --colors",
2413
+ "test:coverage": "jest --coverage --colors",
2414
+ e2e: "playwright test",
2415
+ "e2e:report": "playwright show-report",
2416
+ "e2e:ui": "playwright test --ui",
2417
+ docs: "jsdoc -c jsdoc.conf.json"
2418
+ }, Qi = {
2419
+ "@analytics/google-analytics": "^1.0.7",
2420
+ "@bobthered/tailwindcss-palette-generator": "3.1.1",
2421
+ "@floating-ui/dom": "1.4.5",
2422
+ "@floating-ui/react-dom": "2.0.1",
2423
+ "@mhsdesign/jit-browser-tailwindcss": "0.3.0",
2424
+ "@minoru/react-dnd-treeview": "3.4.4",
2425
+ "@radix-ui/react-accordion": "^1.1.2",
2426
+ "@radix-ui/react-alert-dialog": "^1.0.4",
2427
+ "@radix-ui/react-context-menu": "^2.1.4",
2428
+ "@radix-ui/react-dialog": "^1.0.4",
2429
+ "@radix-ui/react-dropdown-menu": "^2.0.5",
2430
+ "@radix-ui/react-hover-card": "^1.0.6",
2431
+ "@radix-ui/react-icons": "^1.3.0",
2432
+ "@radix-ui/react-label": "^2.0.2",
2433
+ "@radix-ui/react-menubar": "^1.0.3",
2434
+ "@radix-ui/react-navigation-menu": "^1.1.3",
2435
+ "@radix-ui/react-popover": "^1.0.6",
2436
+ "@radix-ui/react-scroll-area": "^1.0.4",
2437
+ "@radix-ui/react-select": "^1.2.2",
2438
+ "@radix-ui/react-separator": "^1.0.3",
2439
+ "@radix-ui/react-slot": "^1.0.2",
2440
+ "@radix-ui/react-switch": "^1.0.3",
2441
+ "@radix-ui/react-tabs": "^1.0.4",
2442
+ "@radix-ui/react-toast": "^1.1.4",
2443
+ "@radix-ui/react-toggle": "^1.0.3",
2444
+ "@radix-ui/react-tooltip": "^1.0.6",
2445
+ "@react-hookz/web": "23.1.0",
2446
+ "@rjsf/core": "5.11.2",
2447
+ "@rjsf/utils": "5.11.2",
2448
+ "@rjsf/validator-ajv8": "5.11.2",
2449
+ "@tailwindcss/aspect-ratio": "0.4.2",
2450
+ "@tailwindcss/forms": "^0.5.6",
2451
+ "@tailwindcss/line-clamp": "^0.4.4",
2452
+ "@tailwindcss/typography": "^0.5.10",
2453
+ analytics: "^0.8.9",
2454
+ "chaibuilder-blocks": "0.1.2",
2455
+ "class-variance-authority": "0.6.1",
2456
+ clsx: "1.2.1",
2457
+ cmdk: "0.2.0",
2458
+ "date-fns": "^2.30.0",
2459
+ flagged: "2.0.9",
2460
+ "flat-to-nested": "1.1.1",
2461
+ "focus-trap-react": "^10.2.1",
2462
+ "forgiving-xml-parser": "1.4.0",
2463
+ "framer-motion": "^10.12.18",
2464
+ "fuse.js": "6.6.2",
2465
+ "gray-matter": "^4.0.3",
2466
+ himalaya: "^1.1.0",
2467
+ "html-formatter": "0.1.9",
2468
+ i18next: "^23.2.8",
2469
+ jotai: "2.2.2",
2470
+ lodash: "4.17.21",
2471
+ "lucide-react": "^0.244.0",
2472
+ nanoid: "^4.0.2",
2473
+ "post-robot": "10.0.46",
2474
+ react: "^18.2.0",
2475
+ "react-autosuggest": "10.1.0",
2476
+ "react-colorful": "5.6.1",
2477
+ "react-dnd": "16.0.1",
2478
+ "react-dnd-html5-backend": "16.0.1",
2479
+ "react-dom": "^18.2.0",
2480
+ "react-hotkeys-hook": "4.4.1",
2481
+ "react-i18next": "13.0.1",
2482
+ "react-icons": "^4.10.1",
2483
+ "react-icons-picker": "^1.0.9",
2484
+ "react-quill": "^2.0.0",
2485
+ "react-textarea-autosize": "^8.5.2",
2486
+ "react-wrap-balancer": "^1.0.0",
2487
+ "redux-undo": "1.1.0",
2488
+ "tailwind-merge": "1.13.2",
2489
+ "tailwindcss-animate": "1.0.6",
2490
+ "tippy.js": "^6.3.7",
2491
+ "unist-util-visit": "^4.1.2",
2492
+ "unsplash-js": "^7.0.18"
2493
+ }, Zi = {
2494
+ "@commitlint/cli": "17.7.1",
2495
+ "@commitlint/config-conventional": "17.7.0",
2496
+ "@playwright/test": "^1.39.0",
2497
+ "@types/jest": "^29.5.7",
2498
+ "@types/lodash": "^4.14.200",
2499
+ "@types/node": "^20.8.10",
2500
+ "@types/react": "^18.2.15",
2501
+ "@types/react-dom": "^18.2.7",
2502
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
2503
+ "@typescript-eslint/parser": "^6.0.0",
2504
+ "@vitejs/plugin-react-swc": "^3.3.2",
2505
+ autoprefixer: "^10.4.16",
2506
+ "better-docs": "^2.7.2",
2507
+ eslint: "^8.45.0",
2508
+ "eslint-plugin-react-hooks": "^4.6.0",
2509
+ "eslint-plugin-react-refresh": "^0.4.3",
2510
+ jest: "^29.7.0",
2511
+ "jest-environment-jsdom": "^29.7.0",
2512
+ jsdoc: "^4.0.2",
2513
+ postcss: "^8.4.31",
2514
+ prettier: "^3.0.3",
2515
+ "prettier-plugin-tailwindcss": "^0.5.6",
2516
+ "prop-types": "^15.8.1",
2517
+ tailwindcss: "^3.3.5",
2518
+ "ts-jest": "^29.1.1",
2519
+ typescript: "^5.0.2",
2520
+ vite: "^4.4.5",
2521
+ "vite-plugin-dts": "^3.6.3"
2522
+ }, ea = {
2523
+ name: Vi,
2524
+ private: !1,
2525
+ version: Wi,
2526
+ type: Ji,
2527
+ files: Gi,
2528
+ main: Ki,
2529
+ sideEffects: Hi,
2530
+ exports: Xi,
2531
+ scripts: Yi,
2532
+ dependencies: Qi,
2533
+ devDependencies: Zi
2534
+ }, Ln = "https://api.chaibuilder.com", Nn = () => window.location.href.includes("localhost");
2535
+ function ta() {
2536
+ return {
2537
+ /* All plugins require a name */
2538
+ name: "chaibuilder-analytics",
2539
+ /* Everything else below this is optional depending on your plugin requirements */
2540
+ config: {},
2541
+ initialize: () => {
2542
+ window.chaibuilderAnalyticsLoaded = !0;
2543
+ },
2544
+ page: (e) => {
2545
+ if (Nn())
2546
+ return;
2547
+ const { payload: t } = e;
2548
+ fetch(`${Ln}/v1/log`, { method: "post", body: JSON.stringify(t) }).then((n) => n.json());
2549
+ },
2550
+ track: ({ payload: e }) => {
2551
+ Nn() || fetch(`${Ln}/v1/log`, { method: "post", body: JSON.stringify(e) });
2552
+ },
2553
+ loaded: () => !!window.chaibuilderAnalyticsLoaded
2554
+ };
2555
+ }
2556
+ const na = zi({
2557
+ app: "chaibuilder",
2558
+ version: ea.version,
2559
+ plugins: [ta()]
2560
+ });
2561
+ ({}).NODE_ENV === "development" && console.log("Chai Builder:", go);
2562
+ const ra = (e) => /* @__PURE__ */ C.jsx(C.Fragment, { children: e.children }), oa = (e) => {
2563
+ const { dndOptions: t = { backend: Kr } } = e, [n] = Do(), [, r] = er(), o = Cs();
2564
+ return he(() => {
2565
+ Ks.set(
2566
+ // @ts-ignore
2567
+ Rn,
2568
+ pt(e, ["blocks", "globalBlocks", "brandingOptions"])
2569
+ );
2570
+ }, [e]), he(() => {
2571
+ n(io(e.blocks || [])), o();
2572
+ }, [e.blocks]), he(() => {
2573
+ r(e.brandingOptions);
2574
+ }, [e.brandingOptions]), he(() => {
2575
+ na.page();
2576
+ }, []), /* @__PURE__ */ C.jsx(Vr, { ...t, options: Gr(), children: /* @__PURE__ */ C.jsx(ra, { children: /* @__PURE__ */ C.jsx(Gs, {}) }) });
2577
+ }, oc = (e) => /* @__PURE__ */ C.jsxs(yo, { children: [
2578
+ /* @__PURE__ */ C.jsx(qr, { features: ho, children: /* @__PURE__ */ C.jsx(oa, { ...e }) }),
2579
+ /* @__PURE__ */ C.jsx(Qr, {})
2580
+ ] }), sc = (e) => ({ ...e }), ic = (e) => ({ ...e });
2581
+ export {
2582
+ Gn as $,
2583
+ Pa as A,
2584
+ us as B,
2585
+ Wa as C,
2586
+ $s as D,
2587
+ yo as E,
2588
+ rn as F,
2589
+ nn as G,
2590
+ ja as H,
2591
+ Ua as I,
2592
+ za as J,
2593
+ Fa as K,
2594
+ Ba as L,
2595
+ os as M,
2596
+ Ma as N,
2597
+ Ea as O,
2598
+ rc as P,
2599
+ Aa as Q,
2600
+ Za as R,
2601
+ ps as S,
2602
+ fs as T,
2603
+ Da as U,
2604
+ sc as V,
2605
+ ic as W,
2606
+ oc as X,
2607
+ Cs as Y,
2608
+ Ga as Z,
2609
+ Ja as _,
2610
+ ds as a,
2611
+ Zo as a0,
2612
+ Ta as a1,
2613
+ sr as a2,
2614
+ $a as a3,
2615
+ Ra as a4,
2616
+ Ya as a5,
2617
+ qa as a6,
2618
+ ms as a7,
2619
+ Sa as a8,
2620
+ Va as a9,
2621
+ Ka as aa,
2622
+ Ha as ab,
2623
+ ec as ac,
2624
+ tc as ad,
2625
+ nc as ae,
2626
+ Mo as b,
2627
+ gt as c,
2628
+ Na as d,
2629
+ Ca as e,
2630
+ Xa as f,
2631
+ Do as g,
2632
+ Ee as h,
2633
+ Qn as i,
2634
+ Qa as j,
2635
+ La as k,
2636
+ pr as l,
2637
+ ur as m,
2638
+ hs as n,
2639
+ xs as o,
2640
+ Zn as p,
2641
+ _s as q,
2642
+ rs as r,
2643
+ as as s,
2644
+ _a as t,
2645
+ Oa as u,
2646
+ Ia as v,
2647
+ er as w,
2648
+ ks as x,
2649
+ Wo as y,
2650
+ ss as z
2651
+ };