@chaibuilder/sdk 0.1.4 → 0.1.5
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.
- package/dist/{AddBlocks-b6a12d50.js → AddBlocks-5d928d58.js} +20 -19
- package/dist/AddBlocks-df0ea47a.cjs +3 -0
- package/dist/BrandingOptions-b76762a4.cjs +1 -0
- package/dist/{BrandingOptions-1190723a.js → BrandingOptions-bf7e6a38.js} +11 -9
- package/dist/{CanvasArea-15458836.js → CanvasArea-688987d1.js} +226 -224
- package/dist/{CanvasArea-f5d27245.cjs → CanvasArea-9287e1bd.cjs} +2 -2
- package/dist/{Class-e34b2337.js → Class-1fb4c0c4.js} +110 -169
- package/dist/Class-6c695ccb.cjs +1 -0
- package/dist/Layers-11b26a20.cjs +1 -0
- package/dist/{Layers-ff4ef9c0.js → Layers-c053dfb8.js} +12 -10
- package/dist/MODIFIERS-70fef873.cjs +1 -0
- package/dist/MODIFIERS-c2e02614.js +67 -0
- package/dist/{MarkAsGlobalBlock-dea26aa7.js → MarkAsGlobalBlock-111d739d.js} +10 -8
- package/dist/MarkAsGlobalBlock-4c85ba27.cjs +1 -0
- package/dist/{PagesPanel-3e9163c4.js → PagesPanel-48d0f29b.js} +12 -10
- package/dist/PagesPanel-97dbe8c3.cjs +1 -0
- package/dist/ProjectPanel-24543eac.cjs +1 -0
- package/dist/{ProjectPanel-17c5f131.js → ProjectPanel-e19b9778.js} +9 -10
- package/dist/Settings-0358ce2f.cjs +1 -0
- package/dist/{Settings-6f2e86a9.js → Settings-f4118350.js} +7 -5
- package/dist/{SidePanels-96e64da9.js → SidePanels-73e79a7d.js} +8 -6
- package/dist/SidePanels-e48c2ba6.cjs +1 -0
- package/dist/Topbar-26d18e9d.cjs +1 -0
- package/dist/{Topbar-08d10607.js → Topbar-5574394f.js} +7 -5
- package/dist/add-page-modal-61d5bad7.js +93 -0
- package/dist/add-page-modal-6a60b790.cjs +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +13 -11
- package/dist/core.js +63 -61
- package/dist/{delete-page-modal-fa7b4272.js → delete-page-modal-62641e4c.js} +9 -8
- package/dist/delete-page-modal-ecdd890a.cjs +1 -0
- package/dist/html-to-json-01cc5fe0.cjs +1 -0
- package/dist/{html-to-json-9304dbda.js → html-to-json-d20aafdd.js} +2 -2
- package/dist/index-89fce4e7.cjs +2 -0
- package/dist/index-de0f72ce.js +4911 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +4 -4
- package/dist/{page-viewer-f1452439.js → page-viewer-14a69dba.js} +21 -18
- package/dist/page-viewer-e8469cfa.cjs +1 -0
- package/dist/{project-general-setting-0d7715b8.cjs → project-general-setting-decde8d1.cjs} +1 -1
- package/dist/{project-general-setting-e5d14fa6.js → project-general-setting-f7cfce70.js} +7 -5
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +9 -3
- package/dist/render.js +154 -134
- package/dist/{single-page-detail-74f88ed2.js → single-page-detail-16682af2.js} +39 -38
- package/dist/single-page-detail-60edc711.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/useChangePage-5a62d7fc.cjs +1 -0
- package/dist/useChangePage-6b957e49.js +12 -0
- package/dist/usePageActions-32ea32a5.cjs +1 -0
- package/dist/usePageActions-37599b0c.js +38 -0
- package/package.json +3 -2
- package/dist/AddBlocks-1f683caa.cjs +0 -3
- package/dist/BrandingOptions-02e4ebcf.cjs +0 -1
- package/dist/CONTROLS-031e1de3.cjs +0 -1
- package/dist/CONTROLS-442caee5.js +0 -6
- package/dist/Class-7d6aadbc.cjs +0 -1
- package/dist/Layers-06fa708d.cjs +0 -1
- package/dist/MarkAsGlobalBlock-fa0e0543.cjs +0 -1
- package/dist/PagesPanel-b08e1357.cjs +0 -1
- package/dist/ProjectPanel-f0b94e3f.cjs +0 -1
- package/dist/Settings-739cff3b.cjs +0 -1
- package/dist/SidePanels-ce4d41d5.cjs +0 -1
- package/dist/Topbar-b97472fc.cjs +0 -1
- package/dist/add-page-modal-3275cfb2.cjs +0 -1
- package/dist/add-page-modal-bcd9249e.js +0 -93
- package/dist/delete-page-modal-420a17e3.cjs +0 -1
- package/dist/html-to-json-9c9961da.cjs +0 -1
- package/dist/index-133d90a5.cjs +0 -2
- package/dist/index-3f65447f.js +0 -4754
- package/dist/page-viewer-139bfb2a.cjs +0 -1
- package/dist/single-page-detail-54d7feca.cjs +0 -1
- package/dist/useMutation-7d536740.cjs +0 -1
- package/dist/useMutation-97876a40.js +0 -126
- package/dist/usePageActions-ac9ad321.cjs +0 -1
- package/dist/usePageActions-de3b7515.js +0 -37
- package/dist/useProjectActions-3b1dbb5e.js +0 -18
- package/dist/useProjectActions-41af0f70.cjs +0 -1
|
@@ -0,0 +1,4911 @@
|
|
|
1
|
+
var cs = (e, t, n) => {
|
|
2
|
+
if (!t.has(e))
|
|
3
|
+
throw TypeError("Cannot " + n);
|
|
4
|
+
};
|
|
5
|
+
var a = (e, t, n) => (cs(e, t, "read from private field"), n ? n.call(e) : t.get(e)), I = (e, t, n) => {
|
|
6
|
+
if (t.has(e))
|
|
7
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
+
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
9
|
+
}, k = (e, t, n, s) => (cs(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n);
|
|
10
|
+
var On = (e, t, n, s) => ({
|
|
11
|
+
set _(r) {
|
|
12
|
+
k(e, t, r, n);
|
|
13
|
+
},
|
|
14
|
+
get _() {
|
|
15
|
+
return a(e, t, s);
|
|
16
|
+
}
|
|
17
|
+
}), Q = (e, t, n) => (cs(e, t, "access private method"), n);
|
|
18
|
+
import { j as x } from "./jsx-runtime-944c88e2.js";
|
|
19
|
+
import Eo from "i18next";
|
|
20
|
+
import { initReactI18next as Po } from "react-i18next";
|
|
21
|
+
import { FlagsProvider as Oo } from "flagged";
|
|
22
|
+
import * as ae from "react";
|
|
23
|
+
import Ms, { createContext as Co, useReducer as _o, useEffect as Ee, useDebugValue as jo, useCallback as Y, useContext as Io, useMemo as Bo, useState as Ro, Suspense as en, lazy as Gt } from "react";
|
|
24
|
+
import { DndProvider as Do } from "react-dnd";
|
|
25
|
+
import { flatten as Se, find as Pe, filter as te, map as de, omit as Wn, isEmpty as Te, isString as Ls, set as ht, get as ee, includes as he, without as ci, forIn as ui, has as Ns, findIndex as Cn, last as Mo, first as De, startsWith as li, isNull as gs, each as Ze, pick as nr, sortBy as sr, isObject as Lo } from "lodash";
|
|
26
|
+
import { getBackendOptions as No, MultiBackend as To } from "@minoru/react-dnd-treeview";
|
|
27
|
+
import { u as cn, c as di, B as fi, S as Fo, T as Uo, a as qo } from "./useBuilderProp-81a14920.js";
|
|
28
|
+
import { atom as N, useAtomValue as ne, useAtom as Z, useSetAtom as tt, getDefaultStore as $o } from "jotai";
|
|
29
|
+
import { c as Qo } from "./utils-ac68b2c8.js";
|
|
30
|
+
import { useHotkeys as Fe } from "react-hotkeys-hook";
|
|
31
|
+
import hi from "flat-to-nested";
|
|
32
|
+
import { g as Xe, c as Ln, a as Vo } from "./Class-1fb4c0c4.js";
|
|
33
|
+
import Ko, { excludeAction as zo, ActionCreators as us } from "redux-undo";
|
|
34
|
+
import { useThrottledCallback as Go } from "@react-hookz/web";
|
|
35
|
+
import { S as pt, I as pi, a as ys, B as vs } from "./MODIFIERS-c2e02614.js";
|
|
36
|
+
import { useChaiBlocks as Wo, syncBlocksWithDefaults as Ho } from "@chaibuilder/blocks";
|
|
37
|
+
import { FileTextIcon as Jo, GearIcon as Yo } from "@radix-ui/react-icons";
|
|
38
|
+
import { LogOutIcon as Zo } from "lucide-react";
|
|
39
|
+
import { toast as Xo } from "sonner";
|
|
40
|
+
const ea = "Dark mode", ta = "This page has no blocks. Add a block by clicking the + button", na = "This page is empty", sa = "Please select a block to edit settings or styles", ra = "Please select a styling block", ia = "Drop your block here", oa = {
|
|
41
|
+
dark_mode: ea,
|
|
42
|
+
tree_view_no_blocks: ta,
|
|
43
|
+
canvas_empty: na,
|
|
44
|
+
no_block_selected_for_styling: sa,
|
|
45
|
+
no_styling_block_selected: ra,
|
|
46
|
+
drop_here_message: ia
|
|
47
|
+
};
|
|
48
|
+
Eo.use(Po).init({
|
|
49
|
+
// the translations
|
|
50
|
+
// (tip move them in a JSON file and import them,
|
|
51
|
+
// or even better, manage them via a UI: https://react.i18next.com/guides/multiple-translation-files#manage-your-translations-with-a-management-gui)
|
|
52
|
+
resources: {
|
|
53
|
+
en: {
|
|
54
|
+
translation: oa
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
lng: "en",
|
|
58
|
+
// if you're using a language detector, do not define the lng option
|
|
59
|
+
fallbackLng: "en",
|
|
60
|
+
interpolation: {
|
|
61
|
+
escapeValue: !1
|
|
62
|
+
// react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const aa = "";
|
|
66
|
+
const ca = {};
|
|
67
|
+
class ua extends Ms.Component {
|
|
68
|
+
constructor(t) {
|
|
69
|
+
super(t), this.state = { hasError: !1 };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A static method that returns an object to update the state when an error is caught.
|
|
73
|
+
* @returns {object} An object to update the state when an error is caught.
|
|
74
|
+
*/
|
|
75
|
+
static getDerivedStateFromError(t) {
|
|
76
|
+
return console.error(t), { hasError: !0 };
|
|
77
|
+
}
|
|
78
|
+
render() {
|
|
79
|
+
return this.state.hasError ? /* @__PURE__ */ x.jsx("h1", { children: "Something went wrong." }) : this.props.children;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const la = (e) => {
|
|
83
|
+
const t = e.replace(pt, "").split(",");
|
|
84
|
+
return { baseClasses: t[0], classes: t[1] };
|
|
85
|
+
};
|
|
86
|
+
let da = 0;
|
|
87
|
+
function $e(e, t) {
|
|
88
|
+
const n = `atom${++da}`, s = {
|
|
89
|
+
toString: () => n
|
|
90
|
+
};
|
|
91
|
+
return typeof e == "function" ? s.read = e : (s.init = e, s.read = (r) => r(s), s.write = (r, i, o) => i(
|
|
92
|
+
s,
|
|
93
|
+
typeof o == "function" ? o(r(s)) : o
|
|
94
|
+
)), t && (s.write = t), s;
|
|
95
|
+
}
|
|
96
|
+
const rr = (e) => "init" in e, ir = (e) => !!e.write, qn = /* @__PURE__ */ new WeakMap(), fa = (e, t) => {
|
|
97
|
+
qn.set(e, t), e.catch(() => {
|
|
98
|
+
}).finally(() => qn.delete(e));
|
|
99
|
+
}, or = (e, t) => {
|
|
100
|
+
const n = qn.get(e);
|
|
101
|
+
n && (qn.delete(e), n(t));
|
|
102
|
+
}, ar = (e, t) => {
|
|
103
|
+
e.status = "fulfilled", e.value = t;
|
|
104
|
+
}, cr = (e, t) => {
|
|
105
|
+
e.status = "rejected", e.reason = t;
|
|
106
|
+
}, ha = (e) => typeof (e == null ? void 0 : e.then) == "function", Xt = (e, t) => "v" in e && "v" in t && Object.is(e.v, t.v), ur = (e, t) => "e" in e && "e" in t && Object.is(e.e, t.e), wt = (e) => "v" in e && e.v instanceof Promise, pa = (e, t) => "v" in e && "v" in t && e.v.orig && e.v.orig === t.v.orig, _n = (e) => {
|
|
107
|
+
if ("e" in e)
|
|
108
|
+
throw e.e;
|
|
109
|
+
return e.v;
|
|
110
|
+
}, ma = () => {
|
|
111
|
+
const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map();
|
|
112
|
+
let s, r, i;
|
|
113
|
+
const o = (p) => e.get(p), c = (p, v) => {
|
|
114
|
+
const j = e.get(p);
|
|
115
|
+
if (e.set(p, v), n.has(p) || n.set(p, j), j && wt(j)) {
|
|
116
|
+
const b = "v" in v ? v.v instanceof Promise ? v.v : Promise.resolve(v.v) : Promise.reject(v.e);
|
|
117
|
+
or(j.v, b);
|
|
118
|
+
}
|
|
119
|
+
}, l = (p, v, j) => {
|
|
120
|
+
const b = /* @__PURE__ */ new Map();
|
|
121
|
+
let B = !1;
|
|
122
|
+
j.forEach((O, w) => {
|
|
123
|
+
!O && w === p && (O = v), O && (b.set(w, O), v.d.get(w) !== O && (B = !0));
|
|
124
|
+
}), (B || v.d.size !== b.size) && (v.d = b);
|
|
125
|
+
}, u = (p, v, j) => {
|
|
126
|
+
const b = o(p), B = {
|
|
127
|
+
d: (b == null ? void 0 : b.d) || /* @__PURE__ */ new Map(),
|
|
128
|
+
v
|
|
129
|
+
};
|
|
130
|
+
if (j && l(p, B, j), b && Xt(b, B) && b.d === B.d)
|
|
131
|
+
return b;
|
|
132
|
+
if (b && wt(b) && wt(B) && pa(b, B)) {
|
|
133
|
+
if (b.d === B.d)
|
|
134
|
+
return b;
|
|
135
|
+
B.v = b.v;
|
|
136
|
+
}
|
|
137
|
+
return c(p, B), B;
|
|
138
|
+
}, f = (p, v, j, b) => {
|
|
139
|
+
if (ha(v)) {
|
|
140
|
+
let B;
|
|
141
|
+
const O = new Promise((w, V) => {
|
|
142
|
+
let $ = !1;
|
|
143
|
+
v.then(
|
|
144
|
+
(G) => {
|
|
145
|
+
if (!$) {
|
|
146
|
+
$ = !0;
|
|
147
|
+
const d = o(p), h = u(
|
|
148
|
+
p,
|
|
149
|
+
O,
|
|
150
|
+
j
|
|
151
|
+
);
|
|
152
|
+
ar(O, G), w(G), (d == null ? void 0 : d.d) !== h.d && F(p, h, d == null ? void 0 : d.d);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
(G) => {
|
|
156
|
+
if (!$) {
|
|
157
|
+
$ = !0;
|
|
158
|
+
const d = o(p), h = u(
|
|
159
|
+
p,
|
|
160
|
+
O,
|
|
161
|
+
j
|
|
162
|
+
);
|
|
163
|
+
cr(O, G), V(G), (d == null ? void 0 : d.d) !== h.d && F(p, h, d == null ? void 0 : d.d);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
), B = (G) => {
|
|
167
|
+
$ || ($ = !0, G.then(
|
|
168
|
+
(d) => ar(O, d),
|
|
169
|
+
(d) => cr(O, d)
|
|
170
|
+
), w(G));
|
|
171
|
+
};
|
|
172
|
+
});
|
|
173
|
+
return O.orig = v, O.status = "pending", fa(O, (w) => {
|
|
174
|
+
w && B(w), b == null || b();
|
|
175
|
+
}), u(p, O, j);
|
|
176
|
+
}
|
|
177
|
+
return u(p, v, j);
|
|
178
|
+
}, m = (p, v, j) => {
|
|
179
|
+
const b = o(p), B = {
|
|
180
|
+
d: (b == null ? void 0 : b.d) || /* @__PURE__ */ new Map(),
|
|
181
|
+
e: v
|
|
182
|
+
};
|
|
183
|
+
return j && l(p, B, j), b && ur(b, B) && b.d === B.d ? b : (c(p, B), B);
|
|
184
|
+
}, A = (p) => {
|
|
185
|
+
const v = o(p);
|
|
186
|
+
if (v && (v.d.forEach(($, G) => {
|
|
187
|
+
G !== p && !t.has(G) && A(G);
|
|
188
|
+
}), Array.from(v.d).every(([$, G]) => {
|
|
189
|
+
const d = o($);
|
|
190
|
+
return $ === p || d === G || // TODO This is a hack, we should find a better solution.
|
|
191
|
+
d && !wt(d) && Xt(d, G);
|
|
192
|
+
})))
|
|
193
|
+
return v;
|
|
194
|
+
const j = /* @__PURE__ */ new Map();
|
|
195
|
+
let b = !0;
|
|
196
|
+
const B = ($) => {
|
|
197
|
+
if ($ === p) {
|
|
198
|
+
const d = o($);
|
|
199
|
+
if (d)
|
|
200
|
+
return j.set($, d), _n(d);
|
|
201
|
+
if (rr($))
|
|
202
|
+
return j.set($, void 0), $.init;
|
|
203
|
+
throw new Error("no atom init");
|
|
204
|
+
}
|
|
205
|
+
const G = A($);
|
|
206
|
+
return j.set($, G), _n(G);
|
|
207
|
+
};
|
|
208
|
+
let O, w;
|
|
209
|
+
const V = {
|
|
210
|
+
get signal() {
|
|
211
|
+
return O || (O = new AbortController()), O.signal;
|
|
212
|
+
},
|
|
213
|
+
get setSelf() {
|
|
214
|
+
return !w && ir(p) && (w = (...$) => {
|
|
215
|
+
if (!b)
|
|
216
|
+
return R(p, ...$);
|
|
217
|
+
}), w;
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
try {
|
|
221
|
+
const $ = p.read(B, V);
|
|
222
|
+
return f(
|
|
223
|
+
p,
|
|
224
|
+
$,
|
|
225
|
+
j,
|
|
226
|
+
() => O == null ? void 0 : O.abort()
|
|
227
|
+
);
|
|
228
|
+
} catch ($) {
|
|
229
|
+
return m(p, $, j);
|
|
230
|
+
} finally {
|
|
231
|
+
b = !1;
|
|
232
|
+
}
|
|
233
|
+
}, g = (p) => _n(A(p)), C = (p) => {
|
|
234
|
+
let v = t.get(p);
|
|
235
|
+
return v || (v = S(p)), v;
|
|
236
|
+
}, _ = (p, v) => !v.l.size && (!v.t.size || v.t.size === 1 && v.t.has(p)), y = (p) => {
|
|
237
|
+
const v = t.get(p);
|
|
238
|
+
v && _(p, v) && E(p);
|
|
239
|
+
}, P = (p) => {
|
|
240
|
+
const v = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new WeakMap(), b = (O) => {
|
|
241
|
+
const w = t.get(O);
|
|
242
|
+
w == null || w.t.forEach((V) => {
|
|
243
|
+
V !== O && (v.set(
|
|
244
|
+
V,
|
|
245
|
+
(v.get(V) || /* @__PURE__ */ new Set()).add(O)
|
|
246
|
+
), j.set(V, (j.get(V) || 0) + 1), b(V));
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
b(p);
|
|
250
|
+
const B = (O) => {
|
|
251
|
+
const w = t.get(O);
|
|
252
|
+
w == null || w.t.forEach((V) => {
|
|
253
|
+
var $;
|
|
254
|
+
if (V !== O) {
|
|
255
|
+
let G = j.get(V);
|
|
256
|
+
if (G && j.set(V, --G), !G) {
|
|
257
|
+
let d = !!(($ = v.get(V)) != null && $.size);
|
|
258
|
+
if (d) {
|
|
259
|
+
const h = o(V), M = A(V);
|
|
260
|
+
d = !h || !Xt(h, M);
|
|
261
|
+
}
|
|
262
|
+
d || v.forEach((h) => h.delete(V));
|
|
263
|
+
}
|
|
264
|
+
B(V);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
B(p);
|
|
269
|
+
}, L = (p, ...v) => {
|
|
270
|
+
let j = !0;
|
|
271
|
+
const b = (w) => _n(A(w)), B = (w, ...V) => {
|
|
272
|
+
let $;
|
|
273
|
+
if (w === p) {
|
|
274
|
+
if (!rr(w))
|
|
275
|
+
throw new Error("atom not writable");
|
|
276
|
+
const G = o(w), d = f(w, V[0]);
|
|
277
|
+
(!G || !Xt(G, d)) && P(w);
|
|
278
|
+
} else
|
|
279
|
+
$ = L(w, ...V);
|
|
280
|
+
if (!j) {
|
|
281
|
+
const G = T();
|
|
282
|
+
}
|
|
283
|
+
return $;
|
|
284
|
+
}, O = p.write(b, B, ...v);
|
|
285
|
+
return j = !1, O;
|
|
286
|
+
}, R = (p, ...v) => {
|
|
287
|
+
const j = L(p, ...v), b = T();
|
|
288
|
+
return j;
|
|
289
|
+
}, S = (p, v) => {
|
|
290
|
+
const j = {
|
|
291
|
+
t: new Set(v && [v]),
|
|
292
|
+
l: /* @__PURE__ */ new Set()
|
|
293
|
+
};
|
|
294
|
+
if (t.set(p, j), A(p).d.forEach((b, B) => {
|
|
295
|
+
const O = t.get(B);
|
|
296
|
+
O ? O.t.add(p) : B !== p && S(B, p);
|
|
297
|
+
}), A(p), ir(p) && p.onMount) {
|
|
298
|
+
const b = p.onMount((...B) => R(p, ...B));
|
|
299
|
+
b && (j.u = b);
|
|
300
|
+
}
|
|
301
|
+
return j;
|
|
302
|
+
}, E = (p) => {
|
|
303
|
+
var v;
|
|
304
|
+
const j = (v = t.get(p)) == null ? void 0 : v.u;
|
|
305
|
+
j && j(), t.delete(p);
|
|
306
|
+
const b = o(p);
|
|
307
|
+
b && (wt(b) && or(b.v), b.d.forEach((B, O) => {
|
|
308
|
+
if (O !== p) {
|
|
309
|
+
const w = t.get(O);
|
|
310
|
+
w && (w.t.delete(p), _(O, w) && E(O));
|
|
311
|
+
}
|
|
312
|
+
}));
|
|
313
|
+
}, F = (p, v, j) => {
|
|
314
|
+
const b = new Set(v.d.keys());
|
|
315
|
+
j == null || j.forEach((B, O) => {
|
|
316
|
+
if (b.has(O)) {
|
|
317
|
+
b.delete(O);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const w = t.get(O);
|
|
321
|
+
w && (w.t.delete(p), _(O, w) && E(O));
|
|
322
|
+
}), b.forEach((B) => {
|
|
323
|
+
const O = t.get(B);
|
|
324
|
+
O ? O.t.add(p) : t.has(p) && S(B, p);
|
|
325
|
+
});
|
|
326
|
+
}, T = () => {
|
|
327
|
+
let p;
|
|
328
|
+
for (; n.size; ) {
|
|
329
|
+
const v = Array.from(n);
|
|
330
|
+
n.clear(), v.forEach(([j, b]) => {
|
|
331
|
+
const B = o(j);
|
|
332
|
+
if (B) {
|
|
333
|
+
B.d !== (b == null ? void 0 : b.d) && F(j, B, b == null ? void 0 : b.d);
|
|
334
|
+
const O = t.get(j);
|
|
335
|
+
O && !// TODO This seems pretty hacky. Hope to fix it.
|
|
336
|
+
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
337
|
+
(b && !wt(b) && (Xt(b, B) || ur(b, B))) && O.l.forEach((w) => w());
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
return {
|
|
343
|
+
get: g,
|
|
344
|
+
set: R,
|
|
345
|
+
sub: (p, v) => {
|
|
346
|
+
const j = C(p), b = T(), B = j.l;
|
|
347
|
+
return B.add(v), () => {
|
|
348
|
+
B.delete(v), y(p);
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
let ls;
|
|
354
|
+
const ga = () => (ls || (ls = ma()), ls), ya = Symbol();
|
|
355
|
+
function va(e, t) {
|
|
356
|
+
const n = $e(
|
|
357
|
+
e,
|
|
358
|
+
(s, r, i) => r(n, t(s(n), i))
|
|
359
|
+
);
|
|
360
|
+
return n;
|
|
361
|
+
}
|
|
362
|
+
const lr = (e, t, n) => (t.has(n) ? t : t.set(n, e())).get(n), ba = /* @__PURE__ */ new WeakMap(), wa = (e, t, n) => {
|
|
363
|
+
const s = lr(() => /* @__PURE__ */ new WeakMap(), ba, t);
|
|
364
|
+
return lr(e, s, n);
|
|
365
|
+
}, Sa = {}, dr = (e) => !!e.write, xa = (e) => typeof e == "function";
|
|
366
|
+
function ka(e, t) {
|
|
367
|
+
return wa(
|
|
368
|
+
() => {
|
|
369
|
+
const n = /* @__PURE__ */ new WeakMap(), s = (o, c) => {
|
|
370
|
+
let l = n.get(o);
|
|
371
|
+
if (l)
|
|
372
|
+
return l;
|
|
373
|
+
const u = c && n.get(c), f = [], m = [];
|
|
374
|
+
return o.forEach((A, g) => {
|
|
375
|
+
const C = t ? t(A) : g;
|
|
376
|
+
m[g] = C;
|
|
377
|
+
const _ = u && u.atomList[u.keyList.indexOf(C)];
|
|
378
|
+
if (_) {
|
|
379
|
+
f[g] = _;
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
const y = (L) => {
|
|
383
|
+
const R = L(r), S = L(e), F = s(S, R == null ? void 0 : R.arr).keyList.indexOf(C);
|
|
384
|
+
if (F < 0 || F >= S.length) {
|
|
385
|
+
const T = o[s(o).keyList.indexOf(C)];
|
|
386
|
+
if (T)
|
|
387
|
+
return T;
|
|
388
|
+
throw new Error("splitAtom: index out of bounds for read");
|
|
389
|
+
}
|
|
390
|
+
return S[F];
|
|
391
|
+
}, P = (L, R, S) => {
|
|
392
|
+
const E = L(r), F = L(e), D = s(F, E == null ? void 0 : E.arr).keyList.indexOf(C);
|
|
393
|
+
if (D < 0 || D >= F.length)
|
|
394
|
+
throw new Error("splitAtom: index out of bounds for write");
|
|
395
|
+
const p = xa(S) ? S(F[D]) : S;
|
|
396
|
+
R(e, [
|
|
397
|
+
...F.slice(0, D),
|
|
398
|
+
p,
|
|
399
|
+
...F.slice(D + 1)
|
|
400
|
+
]);
|
|
401
|
+
};
|
|
402
|
+
f[g] = dr(e) ? $e(y, P) : $e(y);
|
|
403
|
+
}), u && u.keyList.length === m.length && u.keyList.every((A, g) => A === m[g]) ? l = u : l = { arr: o, atomList: f, keyList: m }, n.set(o, l), l;
|
|
404
|
+
}, r = $e((o) => {
|
|
405
|
+
const c = o(r), l = o(e);
|
|
406
|
+
return s(l, c == null ? void 0 : c.arr);
|
|
407
|
+
});
|
|
408
|
+
r.init = void 0;
|
|
409
|
+
const i = dr(e) ? $e(
|
|
410
|
+
(o) => o(r).atomList,
|
|
411
|
+
(o, c, l) => {
|
|
412
|
+
switch (l.type) {
|
|
413
|
+
case "remove": {
|
|
414
|
+
const u = o(i).indexOf(l.atom);
|
|
415
|
+
if (u >= 0) {
|
|
416
|
+
const f = o(e);
|
|
417
|
+
c(e, [
|
|
418
|
+
...f.slice(0, u),
|
|
419
|
+
...f.slice(u + 1)
|
|
420
|
+
]);
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
case "insert": {
|
|
425
|
+
const u = l.before ? o(i).indexOf(l.before) : o(i).length;
|
|
426
|
+
if (u >= 0) {
|
|
427
|
+
const f = o(e);
|
|
428
|
+
c(e, [
|
|
429
|
+
...f.slice(0, u),
|
|
430
|
+
l.value,
|
|
431
|
+
...f.slice(u)
|
|
432
|
+
]);
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
case "move": {
|
|
437
|
+
const u = o(i).indexOf(l.atom), f = l.before ? o(i).indexOf(l.before) : o(i).length;
|
|
438
|
+
if (u >= 0 && f >= 0) {
|
|
439
|
+
const m = o(e);
|
|
440
|
+
u < f ? c(e, [
|
|
441
|
+
...m.slice(0, u),
|
|
442
|
+
...m.slice(u + 1, f),
|
|
443
|
+
m[u],
|
|
444
|
+
...m.slice(f)
|
|
445
|
+
]) : c(e, [
|
|
446
|
+
...m.slice(0, f),
|
|
447
|
+
m[u],
|
|
448
|
+
...m.slice(f, u),
|
|
449
|
+
...m.slice(u + 1)
|
|
450
|
+
]);
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
) : $e((o) => o(r).atomList);
|
|
457
|
+
return i;
|
|
458
|
+
},
|
|
459
|
+
e,
|
|
460
|
+
t || Sa
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
const Aa = (e) => typeof (e == null ? void 0 : e.then) == "function";
|
|
464
|
+
function Ea(e) {
|
|
465
|
+
let t, n;
|
|
466
|
+
const s = {
|
|
467
|
+
getItem: (r, i) => {
|
|
468
|
+
var o, c;
|
|
469
|
+
const l = (f) => {
|
|
470
|
+
if (f = f || "", t !== f) {
|
|
471
|
+
try {
|
|
472
|
+
n = JSON.parse(f);
|
|
473
|
+
} catch {
|
|
474
|
+
return i;
|
|
475
|
+
}
|
|
476
|
+
t = f;
|
|
477
|
+
}
|
|
478
|
+
return n;
|
|
479
|
+
}, u = (c = (o = e()) == null ? void 0 : o.getItem(r)) != null ? c : null;
|
|
480
|
+
return Aa(u) ? u.then(l) : l(u);
|
|
481
|
+
},
|
|
482
|
+
setItem: (r, i) => {
|
|
483
|
+
var o;
|
|
484
|
+
return (o = e()) == null ? void 0 : o.setItem(r, JSON.stringify(i));
|
|
485
|
+
},
|
|
486
|
+
removeItem: (r) => {
|
|
487
|
+
var i;
|
|
488
|
+
return (i = e()) == null ? void 0 : i.removeItem(r);
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
return typeof window < "u" && typeof window.addEventListener == "function" && (s.subscribe = (r, i, o) => {
|
|
492
|
+
if (!(e() instanceof window.Storage))
|
|
493
|
+
return () => {
|
|
494
|
+
};
|
|
495
|
+
const c = (l) => {
|
|
496
|
+
if (l.storageArea === e() && l.key === r) {
|
|
497
|
+
let u;
|
|
498
|
+
try {
|
|
499
|
+
u = JSON.parse(l.newValue || "");
|
|
500
|
+
} catch {
|
|
501
|
+
u = o;
|
|
502
|
+
}
|
|
503
|
+
i(u);
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
return window.addEventListener("storage", c), () => {
|
|
507
|
+
window.removeEventListener("storage", c);
|
|
508
|
+
};
|
|
509
|
+
}), s;
|
|
510
|
+
}
|
|
511
|
+
const Pa = Ea(
|
|
512
|
+
() => typeof window < "u" ? window.localStorage : void 0
|
|
513
|
+
);
|
|
514
|
+
function vt(e, t, n = Pa, s) {
|
|
515
|
+
const r = s == null ? void 0 : s.unstable_getOnInit, i = $e(
|
|
516
|
+
r ? n.getItem(e, t) : t
|
|
517
|
+
);
|
|
518
|
+
return i.onMount = (c) => {
|
|
519
|
+
r || c(n.getItem(e, t));
|
|
520
|
+
let l;
|
|
521
|
+
return n.subscribe && (l = n.subscribe(e, c, t)), l;
|
|
522
|
+
}, $e(
|
|
523
|
+
(c) => c(i),
|
|
524
|
+
(c, l, u) => {
|
|
525
|
+
const f = typeof u == "function" ? u(c(i)) : u;
|
|
526
|
+
return f === ya ? (l(i, t), n.removeItem(e)) : f instanceof Promise ? f.then((m) => (l(i, m), n.setItem(e, m))) : (l(i, f), n.setItem(e, f));
|
|
527
|
+
}
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
const Oa = Co(void 0), mi = (e) => {
|
|
531
|
+
const t = Io(Oa);
|
|
532
|
+
return (e == null ? void 0 : e.store) || t || ga();
|
|
533
|
+
}, Ca = (e) => typeof (e == null ? void 0 : e.then) == "function", _a = Ms.use || ((e) => {
|
|
534
|
+
if (e.status === "pending")
|
|
535
|
+
throw e;
|
|
536
|
+
if (e.status === "fulfilled")
|
|
537
|
+
return e.value;
|
|
538
|
+
throw e.status === "rejected" ? e.reason : (e.status = "pending", e.then(
|
|
539
|
+
(t) => {
|
|
540
|
+
e.status = "fulfilled", e.value = t;
|
|
541
|
+
},
|
|
542
|
+
(t) => {
|
|
543
|
+
e.status = "rejected", e.reason = t;
|
|
544
|
+
}
|
|
545
|
+
), e);
|
|
546
|
+
});
|
|
547
|
+
function ja(e, t) {
|
|
548
|
+
const n = mi(t), [[s, r, i], o] = _o(
|
|
549
|
+
(u) => {
|
|
550
|
+
const f = n.get(e);
|
|
551
|
+
return Object.is(u[0], f) && u[1] === n && u[2] === e ? u : [f, n, e];
|
|
552
|
+
},
|
|
553
|
+
void 0,
|
|
554
|
+
() => [n.get(e), n, e]
|
|
555
|
+
);
|
|
556
|
+
let c = s;
|
|
557
|
+
(r !== n || i !== e) && (o(), c = n.get(e));
|
|
558
|
+
const l = t == null ? void 0 : t.delay;
|
|
559
|
+
return Ee(() => {
|
|
560
|
+
const u = n.sub(e, () => {
|
|
561
|
+
if (typeof l == "number") {
|
|
562
|
+
setTimeout(o, l);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
o();
|
|
566
|
+
});
|
|
567
|
+
return o(), u;
|
|
568
|
+
}, [n, e, l]), jo(c), Ca(c) ? _a(c) : c;
|
|
569
|
+
}
|
|
570
|
+
function Ia(e, t) {
|
|
571
|
+
const n = mi(t);
|
|
572
|
+
return Y(
|
|
573
|
+
(...r) => n.set(e, ...r),
|
|
574
|
+
[n, e]
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
function Ba(e, t) {
|
|
578
|
+
return [
|
|
579
|
+
ja(e, t),
|
|
580
|
+
// We do wrong type assertion here, which results in throwing an error.
|
|
581
|
+
Ia(e, t)
|
|
582
|
+
];
|
|
583
|
+
}
|
|
584
|
+
const Ra = new hi({ children: "blockNodes" }), gi = (e, t = null) => Se(
|
|
585
|
+
e.map((n) => {
|
|
586
|
+
if (n = t !== null ? { ...n, parent: t } : n, n.children && n.children.length) {
|
|
587
|
+
const s = [...n.children];
|
|
588
|
+
return delete n.children, Se([n, ...gi(s, n._id)]);
|
|
589
|
+
}
|
|
590
|
+
return n;
|
|
591
|
+
})
|
|
592
|
+
);
|
|
593
|
+
function yi(e, t, n) {
|
|
594
|
+
const s = te(e, (i) => i._parent === t), r = [];
|
|
595
|
+
for (let i = 0; i < s.length; i++) {
|
|
596
|
+
const o = vi(s[i]);
|
|
597
|
+
if (Object.keys(o).length > 0 && Object.keys(o).forEach((c) => {
|
|
598
|
+
s[i][c] = `slot:${Xe()}`;
|
|
599
|
+
}), te(e, { _parent: s[i]._id }).length > 0) {
|
|
600
|
+
const c = Xe();
|
|
601
|
+
r.push({ ...s[i], oldId: s[i]._id, _id: c, _parent: n }), r.push(Se(yi(e, s[i]._id, c)));
|
|
602
|
+
} else
|
|
603
|
+
r.push({
|
|
604
|
+
...s[i],
|
|
605
|
+
oldId: s[i]._id,
|
|
606
|
+
_id: Xe(),
|
|
607
|
+
_parent: n
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
return Se(r);
|
|
611
|
+
}
|
|
612
|
+
function Da(e) {
|
|
613
|
+
let t = Ra.convert(e.map((n) => Wn(n, ["settings"])));
|
|
614
|
+
return t = !t.type && t.blockNodes ? t.blockNodes : Te(t) ? [] : [t], t;
|
|
615
|
+
}
|
|
616
|
+
const vi = (e) => {
|
|
617
|
+
const t = {};
|
|
618
|
+
return Object.keys(e).forEach((n) => {
|
|
619
|
+
Ls(e[n]) && e[n].startsWith("slot") && (t[n] = e[n].replace("slot:", ""));
|
|
620
|
+
}), t;
|
|
621
|
+
}, Ma = (e, t, n = null) => {
|
|
622
|
+
let s = Pe(e, { _id: t });
|
|
623
|
+
s = { ...s, oldId: s._id, _id: Xe() }, n && (s = { ...s, _parent: n });
|
|
624
|
+
const r = [s];
|
|
625
|
+
te(e, { _parent: t }).length > 0 && r.push(Se(yi(e, t, s._id)));
|
|
626
|
+
const i = Se(r);
|
|
627
|
+
return de(i, (o) => {
|
|
628
|
+
const c = o, l = vi(c);
|
|
629
|
+
return Object.keys(l).length > 0 && Object.keys(l).forEach((u) => {
|
|
630
|
+
const f = Pe(i, { oldId: l[u].replace("slot:", "") });
|
|
631
|
+
c[u] = `slot:${f._id}`;
|
|
632
|
+
}), Wn(c, ["global", "oldId"]);
|
|
633
|
+
});
|
|
634
|
+
}, La = Ko(
|
|
635
|
+
// eslint-disable-next-line default-param-last
|
|
636
|
+
(e = [], t) => {
|
|
637
|
+
switch (t.type) {
|
|
638
|
+
case "add_new_blocks":
|
|
639
|
+
case "add_duplicate_blocks":
|
|
640
|
+
return [...e, ...t.payload];
|
|
641
|
+
case "create_snapshot":
|
|
642
|
+
return [...e];
|
|
643
|
+
case "set_blocks":
|
|
644
|
+
case "set_page_blocks":
|
|
645
|
+
return [...t.payload];
|
|
646
|
+
case "update_props":
|
|
647
|
+
case "update_props_realtime":
|
|
648
|
+
const { payload: n } = t;
|
|
649
|
+
return e.map((s) => (n.ids.includes(s._id) && !Te(t.payload.props) && Object.keys(t.payload.props).forEach((r) => {
|
|
650
|
+
ht(s, r, t.payload.props[r]);
|
|
651
|
+
}), s));
|
|
652
|
+
default:
|
|
653
|
+
return e;
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
debug: !1,
|
|
658
|
+
ignoreInitialState: !1,
|
|
659
|
+
limit: 30,
|
|
660
|
+
filter: zo(["update_props_realtime", "add_duplicate_blocks", "set_page_blocks"])
|
|
661
|
+
}
|
|
662
|
+
), Hn = va(
|
|
663
|
+
{
|
|
664
|
+
past: [],
|
|
665
|
+
present: [],
|
|
666
|
+
future: []
|
|
667
|
+
},
|
|
668
|
+
La
|
|
669
|
+
);
|
|
670
|
+
Hn.debugLabel = "pageBlocksAtom";
|
|
671
|
+
const xe = N((e) => {
|
|
672
|
+
var t;
|
|
673
|
+
return (t = e(Hn)) == null ? void 0 : t.present;
|
|
674
|
+
});
|
|
675
|
+
xe.debugLabel = "presentBlocksAtom";
|
|
676
|
+
const Ts = ka(xe);
|
|
677
|
+
Ts.debugLabel = "pageBlocksAtomsAtom";
|
|
678
|
+
const bi = N((e) => Da(e(xe)));
|
|
679
|
+
bi.debugLabel = "pageBlocksTreeAtom";
|
|
680
|
+
const Na = N("");
|
|
681
|
+
Na.debugLabel = "builderActivePageAtom";
|
|
682
|
+
const Ta = N(-1);
|
|
683
|
+
Ta.debugLabel = "destinationDropIndexAtom";
|
|
684
|
+
const Fa = N(!1);
|
|
685
|
+
Fa.debugLabel = "addBlocksModalAtom";
|
|
686
|
+
const ke = () => {
|
|
687
|
+
const [, e] = Z(Hn);
|
|
688
|
+
return e;
|
|
689
|
+
}, Ed = () => {
|
|
690
|
+
const e = ke(), t = ne(bi), n = Y(
|
|
691
|
+
(s) => {
|
|
692
|
+
const r = gi(s);
|
|
693
|
+
e({ type: "set_page_blocks", payload: r });
|
|
694
|
+
},
|
|
695
|
+
[e]
|
|
696
|
+
);
|
|
697
|
+
return [t, n];
|
|
698
|
+
}, Ua = () => {
|
|
699
|
+
const e = ke();
|
|
700
|
+
return [Y(
|
|
701
|
+
(n) => {
|
|
702
|
+
e({ type: "set_page_blocks", payload: n });
|
|
703
|
+
},
|
|
704
|
+
[e]
|
|
705
|
+
)];
|
|
706
|
+
}, bs = (e) => ["Box", "Slot", "Form", "DataContext", "Link", "List", "ListItem", "Row", "Column", "Table", "TableCell"].includes(
|
|
707
|
+
e
|
|
708
|
+
), Pd = (e) => !["Slot"].includes(e), Od = (e) => !["Slot"].includes(e);
|
|
709
|
+
function qa(e, t) {
|
|
710
|
+
return e === "Slot" || t === "List" && e !== "ListItem" || t === "Row" && e !== "Column" ? !1 : bs(t);
|
|
711
|
+
}
|
|
712
|
+
const Cd = (e, { dragSource: t, dropTarget: n }) => {
|
|
713
|
+
const s = ee(t, "data._type", ""), r = ee(n, "data._type", "");
|
|
714
|
+
return s === "Slot" || ee(t, "id") && ee(t, "id") === ee(n, "id") ? !1 : Te(r) ? !0 : qa(s, r);
|
|
715
|
+
}, Fs = N([]);
|
|
716
|
+
Fs.debugLabel = "selectedBlockIdsAtom";
|
|
717
|
+
const Us = N((e) => {
|
|
718
|
+
const t = e(xe), n = e(Fs);
|
|
719
|
+
return de(
|
|
720
|
+
te(t, ({ _id: s }) => he(n, s)),
|
|
721
|
+
(s) => ({ ...s })
|
|
722
|
+
);
|
|
723
|
+
});
|
|
724
|
+
Us.debugLabel = "selectedBlocksAtom";
|
|
725
|
+
const qs = N((e) => {
|
|
726
|
+
const t = e(Us);
|
|
727
|
+
return t.length === 0 ? null : t.length === 1 ? t[0] : {
|
|
728
|
+
type: "Multiple",
|
|
729
|
+
id: de(t, "id")
|
|
730
|
+
};
|
|
731
|
+
});
|
|
732
|
+
qs.debugLabel = "selectedBlockAtom";
|
|
733
|
+
const $a = (e) => ee(e, "parent", null), Qa = N((e) => {
|
|
734
|
+
const t = e(Us), n = de(t, $a);
|
|
735
|
+
return te(e(xe), (s) => he(n, s._id));
|
|
736
|
+
});
|
|
737
|
+
Qa.debugLabel = "selectedBlocksParentsAtom";
|
|
738
|
+
const wi = N(() => !1);
|
|
739
|
+
wi.debugLabel = "selectedBlockFlexChildAtom";
|
|
740
|
+
const Si = N(() => !1);
|
|
741
|
+
Si.debugLabel = "selectedBlockGridChildAtom";
|
|
742
|
+
const $s = N("");
|
|
743
|
+
$s.debugLabel = "styleStateAtom";
|
|
744
|
+
const xi = vt("styleBreakpoint", "xs");
|
|
745
|
+
xi.debugLabel = "styleBreakpointAtom";
|
|
746
|
+
const _d = () => ({
|
|
747
|
+
flexChild: ne(wi),
|
|
748
|
+
gridChild: ne(Si)
|
|
749
|
+
}), jd = () => ne(qs), bt = () => {
|
|
750
|
+
const [e, t] = Z(Fs), n = Y(
|
|
751
|
+
(s) => {
|
|
752
|
+
t((r) => he(r, s) ? ci(r, s) : [...r, s]);
|
|
753
|
+
},
|
|
754
|
+
[t]
|
|
755
|
+
);
|
|
756
|
+
return [e, t, n];
|
|
757
|
+
}, fr = (e, t = "") => {
|
|
758
|
+
switch (e.type) {
|
|
759
|
+
case "singular":
|
|
760
|
+
return e.uiSchema;
|
|
761
|
+
case "model":
|
|
762
|
+
const { properties: n } = e, s = {};
|
|
763
|
+
return Object.keys(n).forEach((o) => {
|
|
764
|
+
const c = n[o];
|
|
765
|
+
if (he(["slot", "styles"], c.type))
|
|
766
|
+
return;
|
|
767
|
+
const l = ee(c, "i18n", !1) ? `${o}-${t}` : o;
|
|
768
|
+
s[l] = fr(c, t);
|
|
769
|
+
}), s;
|
|
770
|
+
case "list":
|
|
771
|
+
const { itemProperties: r } = e, i = {
|
|
772
|
+
items: {}
|
|
773
|
+
};
|
|
774
|
+
return Object.keys(r).forEach((o) => {
|
|
775
|
+
const c = r[o];
|
|
776
|
+
if (he(["slot", "styles"], c.type))
|
|
777
|
+
return;
|
|
778
|
+
const l = ee(c, "i18n", !1) ? `${o}-${t}` : o;
|
|
779
|
+
i.items[l] = fr(c, t);
|
|
780
|
+
}), i;
|
|
781
|
+
default:
|
|
782
|
+
return {};
|
|
783
|
+
}
|
|
784
|
+
}, hr = (e, t = "") => {
|
|
785
|
+
switch (e.type) {
|
|
786
|
+
case "singular":
|
|
787
|
+
return e.schema;
|
|
788
|
+
case "model":
|
|
789
|
+
const { properties: n, title: s } = e, r = {
|
|
790
|
+
title: s,
|
|
791
|
+
type: "object",
|
|
792
|
+
properties: {}
|
|
793
|
+
};
|
|
794
|
+
return Object.keys(n).forEach((l) => {
|
|
795
|
+
const u = n[l];
|
|
796
|
+
if (he(["slot", "styles"], u.type))
|
|
797
|
+
return;
|
|
798
|
+
const f = ee(u, "i18n", !1) ? `${l}-${t}` : l;
|
|
799
|
+
r.properties[f] = hr(u, t);
|
|
800
|
+
}), r;
|
|
801
|
+
case "list":
|
|
802
|
+
const { itemProperties: i, title: o } = e, c = {
|
|
803
|
+
title: o,
|
|
804
|
+
type: "array",
|
|
805
|
+
items: {
|
|
806
|
+
type: "object",
|
|
807
|
+
properties: {}
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
return Object.keys(i).forEach((l) => {
|
|
811
|
+
const u = i[l];
|
|
812
|
+
if (he(["slot", "styles"], u.type))
|
|
813
|
+
return;
|
|
814
|
+
const f = ee(u, "i18n", !1) ? `${l}-${t}` : l;
|
|
815
|
+
c.items.properties[f] = hr(u, t), ht(c.items, "title", ee(u, "itemTitle", `${o} item`));
|
|
816
|
+
}), c;
|
|
817
|
+
default:
|
|
818
|
+
return {};
|
|
819
|
+
}
|
|
820
|
+
}, ki = (e) => {
|
|
821
|
+
const t = {};
|
|
822
|
+
return Object.keys(e).forEach((n) => {
|
|
823
|
+
t[n] = Ka(e[n]);
|
|
824
|
+
}), t;
|
|
825
|
+
}, Va = (e) => {
|
|
826
|
+
if (Te(e.default))
|
|
827
|
+
return [];
|
|
828
|
+
const { itemProperties: t } = e;
|
|
829
|
+
return de(e.default, (n) => {
|
|
830
|
+
const s = { ...n };
|
|
831
|
+
return ui(n, (r, i) => {
|
|
832
|
+
Ns(t, i) && ee(t[i], "i18n", !1) && (s[i] = pi);
|
|
833
|
+
}), s;
|
|
834
|
+
});
|
|
835
|
+
}, Ka = (e) => {
|
|
836
|
+
switch (e.type) {
|
|
837
|
+
case "styles":
|
|
838
|
+
return e.default;
|
|
839
|
+
case "slot":
|
|
840
|
+
return `${ys}${Xe()}`;
|
|
841
|
+
case "singular":
|
|
842
|
+
const { i18n: t, schema: n } = e;
|
|
843
|
+
return t ? pi : ee(n, "default", "");
|
|
844
|
+
case "model":
|
|
845
|
+
return ki(e.properties);
|
|
846
|
+
case "list":
|
|
847
|
+
return Va(e);
|
|
848
|
+
default:
|
|
849
|
+
return "";
|
|
850
|
+
}
|
|
851
|
+
}, za = () => ne(xe);
|
|
852
|
+
function pr(e, t, n, s, r) {
|
|
853
|
+
if (t === null)
|
|
854
|
+
return [...e, ...s];
|
|
855
|
+
if (n !== null) {
|
|
856
|
+
const l = Cn(e, { _parent: t }), u = (l === -1 ? 0 : l) + n;
|
|
857
|
+
return e.splice(u, 0, ...s), e;
|
|
858
|
+
}
|
|
859
|
+
if (!r) {
|
|
860
|
+
const u = Cn(e, { _id: t }) + 1;
|
|
861
|
+
return e.splice(u, 0, ...s), e;
|
|
862
|
+
}
|
|
863
|
+
let i = Cn(e, { _id: t });
|
|
864
|
+
const o = te(e, { _parent: t });
|
|
865
|
+
Te(o) || (i = Cn(e, { _id: Mo(o)._id }));
|
|
866
|
+
const c = i + 1;
|
|
867
|
+
return e.splice(c, 0, ...s), e;
|
|
868
|
+
}
|
|
869
|
+
const Id = () => {
|
|
870
|
+
const e = ke(), t = za(), [, n] = bt(), s = Y(
|
|
871
|
+
(i, o, c) => {
|
|
872
|
+
var f;
|
|
873
|
+
for (let m = 0; m < i.length; m++) {
|
|
874
|
+
const { _id: A } = i[m];
|
|
875
|
+
i[m]._id = Xe();
|
|
876
|
+
const g = te(i, { _parent: A });
|
|
877
|
+
for (let C = 0; C < g.length; C++)
|
|
878
|
+
g[C]._parent = i[m]._id;
|
|
879
|
+
}
|
|
880
|
+
let l;
|
|
881
|
+
o && (l = Pe(t, { _id: o }), i[0]._parent = o);
|
|
882
|
+
const u = l ? bs(l._type) : !0;
|
|
883
|
+
return !u && l && (i[0]._parent = l._parent), e({
|
|
884
|
+
type: "set_blocks",
|
|
885
|
+
payload: pr(t, o || null, c || null, i, u)
|
|
886
|
+
}), n([(f = De(i)) == null ? void 0 : f._id]), De(i);
|
|
887
|
+
},
|
|
888
|
+
[t, e, n]
|
|
889
|
+
);
|
|
890
|
+
return { addCoreBlock: Y(
|
|
891
|
+
(i, o, c) => {
|
|
892
|
+
if (Ns(i, "blocks")) {
|
|
893
|
+
const _ = i.blocks;
|
|
894
|
+
return s(_, o, c);
|
|
895
|
+
}
|
|
896
|
+
const l = Xe(), u = ki(i.props), f = [];
|
|
897
|
+
ui(u, (_, y) => {
|
|
898
|
+
if (li(_, ys)) {
|
|
899
|
+
const P = _.replace(ys, "");
|
|
900
|
+
f.push({
|
|
901
|
+
_id: P,
|
|
902
|
+
_type: "Slot",
|
|
903
|
+
_parent: l,
|
|
904
|
+
_name: i.props[y].name,
|
|
905
|
+
_styles: i.props[y].styles,
|
|
906
|
+
_emptyStyles: i.props[y].emptyStyles
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
const m = {
|
|
911
|
+
_type: i.type,
|
|
912
|
+
_id: l,
|
|
913
|
+
...u
|
|
914
|
+
};
|
|
915
|
+
let A;
|
|
916
|
+
o && (A = Pe(t, { _id: o }), m._parent = o);
|
|
917
|
+
const g = A ? bs(A._type) : !0;
|
|
918
|
+
!g && A && (m._parent = A._parent);
|
|
919
|
+
const C = [m, ...f];
|
|
920
|
+
return e({
|
|
921
|
+
type: "set_blocks",
|
|
922
|
+
payload: pr(t, o || null, c || null, C, g)
|
|
923
|
+
}), n([m._id]), m;
|
|
924
|
+
},
|
|
925
|
+
[s, t, e, n]
|
|
926
|
+
), addPredefinedBlock: s };
|
|
927
|
+
}, mr = {
|
|
928
|
+
xs: 420,
|
|
929
|
+
sm: 620,
|
|
930
|
+
md: 768,
|
|
931
|
+
lg: 1024,
|
|
932
|
+
xl: 1280,
|
|
933
|
+
"2xl": 1536
|
|
934
|
+
}, gr = ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
935
|
+
function Ga(e, t) {
|
|
936
|
+
if (t === null)
|
|
937
|
+
return "baseClasses";
|
|
938
|
+
const n = t.mq;
|
|
939
|
+
if (n === "xs" || t.dark || t.mod !== "")
|
|
940
|
+
return "classes";
|
|
941
|
+
let s = "baseClasses", r = gr.indexOf(n);
|
|
942
|
+
for (; r > 0; ) {
|
|
943
|
+
const i = gr[r - 1];
|
|
944
|
+
if (Pe(e, {
|
|
945
|
+
mq: i,
|
|
946
|
+
property: t.property
|
|
947
|
+
})) {
|
|
948
|
+
s = "classes";
|
|
949
|
+
break;
|
|
950
|
+
}
|
|
951
|
+
r--;
|
|
952
|
+
}
|
|
953
|
+
return s;
|
|
954
|
+
}
|
|
955
|
+
const yr = [];
|
|
956
|
+
function Wa(e = "", t = "", n = []) {
|
|
957
|
+
e = e.trim().replace(/ +/g, "");
|
|
958
|
+
let s = te(
|
|
959
|
+
de(e.split(" "), Ln),
|
|
960
|
+
(u) => !gs(u)
|
|
961
|
+
), r = te(de(t.split(" "), Ln), (u) => !gs(u));
|
|
962
|
+
r = te(
|
|
963
|
+
r,
|
|
964
|
+
(u) => !he(yr, u.property)
|
|
965
|
+
);
|
|
966
|
+
const i = [], o = [];
|
|
967
|
+
Ze(n, (u) => {
|
|
968
|
+
const f = Ln(u), m = Pe(s, nr(f, ["dark", "mq", "mod", "property"]));
|
|
969
|
+
if (m && (s = te(
|
|
970
|
+
s,
|
|
971
|
+
(A) => A.fullCls !== (m == null ? void 0 : m.fullCls)
|
|
972
|
+
)), i.push(f), f.mq === "xs" && !f.dark && f.mod === "" && (r = te(r, (A) => A.property !== f.property)), Ga(s, f) === "baseClasses" && !he(yr, f.property)) {
|
|
973
|
+
const A = Pe(r, nr(f, ["property"]));
|
|
974
|
+
m && (r = te(
|
|
975
|
+
r,
|
|
976
|
+
(g) => g.fullCls !== (A == null ? void 0 : A.fullCls)
|
|
977
|
+
)), o.push({
|
|
978
|
+
...f,
|
|
979
|
+
fullCls: f.cls,
|
|
980
|
+
mq: "xs"
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
const c = de(
|
|
985
|
+
sr([...s, ...i], (u) => mr[u.mq]),
|
|
986
|
+
"fullCls"
|
|
987
|
+
).join(" ");
|
|
988
|
+
return `${de(
|
|
989
|
+
sr([...r, ...o], (u) => mr[u.mq]),
|
|
990
|
+
"fullCls"
|
|
991
|
+
).join(" ").trim()},${c.trim()}`.trim().replace(/ +/g, "");
|
|
992
|
+
}
|
|
993
|
+
const An = N([]);
|
|
994
|
+
An.debugLabel = "selectedStylingBlocksAtom";
|
|
995
|
+
const Ai = () => Z(An), Ha = (e) => {
|
|
996
|
+
const t = e.replace(pt, "").split(",");
|
|
997
|
+
return { baseClasses: t[0], classes: t[1] };
|
|
998
|
+
}, Ja = N(null, (e, t, { blockIds: n, newClasses: s, dispatch: r }) => {
|
|
999
|
+
const i = te(
|
|
1000
|
+
e(Ts),
|
|
1001
|
+
(c) => (
|
|
1002
|
+
// @ts-ignore
|
|
1003
|
+
n.includes(e(c)._id)
|
|
1004
|
+
)
|
|
1005
|
+
), o = De(e(An));
|
|
1006
|
+
Ze(i, (c) => {
|
|
1007
|
+
const l = e(c), u = ee(l, o.prop, `${pt},`), { baseClasses: f, classes: m } = Ha(u);
|
|
1008
|
+
r({
|
|
1009
|
+
type: "update_props_realtime",
|
|
1010
|
+
payload: {
|
|
1011
|
+
ids: [l._id],
|
|
1012
|
+
props: { [o.prop]: `${pt}${Wa(m, f, s)}` }
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
1015
|
+
});
|
|
1016
|
+
}), Bd = () => {
|
|
1017
|
+
const e = ke(), t = tt(Ja);
|
|
1018
|
+
return Y(
|
|
1019
|
+
(n, s, r) => {
|
|
1020
|
+
t({ blockIds: n, newClasses: s, dispatch: e }), r && setTimeout(() => e({ type: "create_snapshot" }), 500);
|
|
1021
|
+
},
|
|
1022
|
+
[e, t]
|
|
1023
|
+
);
|
|
1024
|
+
}, Ei = N([]);
|
|
1025
|
+
Ei.debugLabel = "buildingBlocksAtom";
|
|
1026
|
+
const Ya = N((e) => {
|
|
1027
|
+
const t = e(Ei);
|
|
1028
|
+
return te(t, (n) => Ns(n, "blockId"));
|
|
1029
|
+
}), Za = () => {
|
|
1030
|
+
}, Xa = () => {
|
|
1031
|
+
const e = Wo(), t = ne(Ya), n = () => {
|
|
1032
|
+
}, s = Y(() => Za(), []);
|
|
1033
|
+
return [e, t, n, s];
|
|
1034
|
+
}, ec = N(!1), Pi = () => {
|
|
1035
|
+
const [e, t] = Z(ec);
|
|
1036
|
+
return [e, t];
|
|
1037
|
+
}, tc = N(vs), Oi = () => {
|
|
1038
|
+
const [e, t] = Z(tc);
|
|
1039
|
+
return [
|
|
1040
|
+
Lo(e) ? { ...e, ...vs } : vs,
|
|
1041
|
+
t
|
|
1042
|
+
];
|
|
1043
|
+
}, nc = N(null), sc = () => ({ currentPage: ne(nc) }), Ci = new hi({});
|
|
1044
|
+
function rc(e) {
|
|
1045
|
+
let t = Ci.convert(e);
|
|
1046
|
+
return t = !t.type && t.children && t.children.length ? t.children : Te(t) ? [] : [t], t;
|
|
1047
|
+
}
|
|
1048
|
+
const Qs = (e, t) => Se(
|
|
1049
|
+
e.map((n) => {
|
|
1050
|
+
if (n = t ? { ...n, parent: t } : { ...n }, n.children) {
|
|
1051
|
+
const s = [...n.children];
|
|
1052
|
+
return delete n.children, Se([n, ...Qs(s, n._id)]);
|
|
1053
|
+
}
|
|
1054
|
+
return n;
|
|
1055
|
+
})
|
|
1056
|
+
);
|
|
1057
|
+
function Vs(e, t = !1) {
|
|
1058
|
+
for (let n = 0; n < e.length; n++) {
|
|
1059
|
+
const s = e[n];
|
|
1060
|
+
s.global && !t ? e[n] = {
|
|
1061
|
+
type: "GlobalBlock",
|
|
1062
|
+
_parent: ee(s, "parent", null),
|
|
1063
|
+
blockId: s.blockId,
|
|
1064
|
+
_id: s._id
|
|
1065
|
+
} : s.children && s.children.length && Vs(s.children);
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
function _i(e) {
|
|
1069
|
+
let t = [], n = te(e, { type: "GlobalBlock" });
|
|
1070
|
+
return n.length > 0 && (n = de(n, ji), Ze(n, (s) => {
|
|
1071
|
+
t = [...t, ...ic(s)];
|
|
1072
|
+
})), t;
|
|
1073
|
+
}
|
|
1074
|
+
function ic(e) {
|
|
1075
|
+
let t = [];
|
|
1076
|
+
const n = ee(De(e), "parent", null);
|
|
1077
|
+
ht(De(e), "parent", null);
|
|
1078
|
+
const s = [Ci.convert(Ii(e))];
|
|
1079
|
+
Vs(s, !0);
|
|
1080
|
+
let r = Qs(s, e[0]._id);
|
|
1081
|
+
return r = ht(r, "0.parent", n), t = [...t, r, ..._i(r)], t;
|
|
1082
|
+
}
|
|
1083
|
+
function ji(e) {
|
|
1084
|
+
const t = Pe(ws, { _id: e._id });
|
|
1085
|
+
if (!t)
|
|
1086
|
+
return [];
|
|
1087
|
+
const n = [t], s = te(ws, { _parent: e._id });
|
|
1088
|
+
return s.length ? Se([...n, ...Se(de(s, ji))]) : Se(n);
|
|
1089
|
+
}
|
|
1090
|
+
const Ii = (e) => JSON.parse(JSON.stringify(e));
|
|
1091
|
+
let ws = [];
|
|
1092
|
+
function oc(e) {
|
|
1093
|
+
ws = e;
|
|
1094
|
+
const t = rc(Ii(e));
|
|
1095
|
+
Vs(t);
|
|
1096
|
+
const n = Qs(t, null), s = _i(n), r = {};
|
|
1097
|
+
return Ze(s, (i) => ht(r, De(i).blockId, i)), [n, r];
|
|
1098
|
+
}
|
|
1099
|
+
const Bi = () => {
|
|
1100
|
+
const [e] = Oi(), { currentPage: t } = sc(), n = ne(xe);
|
|
1101
|
+
return Y(() => {
|
|
1102
|
+
const s = de(
|
|
1103
|
+
n,
|
|
1104
|
+
(o) => Wn(o, ["expanded", "order", "title", "siblings", "tempClasses"])
|
|
1105
|
+
), [r = [], i = []] = oc(s);
|
|
1106
|
+
return {
|
|
1107
|
+
currentPage: t,
|
|
1108
|
+
blocks: r,
|
|
1109
|
+
globalBlocks: i
|
|
1110
|
+
};
|
|
1111
|
+
}, [e, t, n]);
|
|
1112
|
+
};
|
|
1113
|
+
vt("blockStylingActiveTab", 1);
|
|
1114
|
+
N([]);
|
|
1115
|
+
const Ri = N(!1);
|
|
1116
|
+
Ri.debugLabel = "readOnlyModeAtom";
|
|
1117
|
+
const ac = N(!1);
|
|
1118
|
+
ac.debugLabel = "inlineEditingActiveAtom";
|
|
1119
|
+
const cc = N(!1);
|
|
1120
|
+
cc.debugLabel = "advanceStylingOpenAtom";
|
|
1121
|
+
const uc = N("online");
|
|
1122
|
+
uc.debugLabel = "networkModeAtom";
|
|
1123
|
+
vt("currentUiLibrary", "");
|
|
1124
|
+
const lc = N(!1);
|
|
1125
|
+
lc.debugLabel = "codeEditorOpenAtom";
|
|
1126
|
+
const dc = N(!1);
|
|
1127
|
+
dc.debugLabel = "editLayerNameAtom";
|
|
1128
|
+
const fc = N("");
|
|
1129
|
+
fc.debugLabel = "activeLanguageAtom";
|
|
1130
|
+
const hc = N("");
|
|
1131
|
+
hc.debugLabel = "primaryLanguageAtom";
|
|
1132
|
+
const pc = N(null);
|
|
1133
|
+
pc.debugLabel = "canvasIframeAtom";
|
|
1134
|
+
const mc = N("layers");
|
|
1135
|
+
mc.debugLabel = "activePanelAtom";
|
|
1136
|
+
const gc = N(!1);
|
|
1137
|
+
gc.debugLabel = "addBlockOffCanvasAtom";
|
|
1138
|
+
const yc = N("");
|
|
1139
|
+
yc.debugLabel = "showPredefinedBlockCategoryAtom";
|
|
1140
|
+
const Jn = N({ undoCount: 0, redoCount: 0 });
|
|
1141
|
+
Jn.debugLabel = "historyStatesAtom";
|
|
1142
|
+
const Yn = N("SAVED");
|
|
1143
|
+
Yn.debugLabel = "pageSyncStateAtom";
|
|
1144
|
+
const Rd = () => {
|
|
1145
|
+
const [e, t] = Z(Yn), n = cn("onSaveBlocks", async () => {
|
|
1146
|
+
}), s = cn("onSyncStatusChange", () => {
|
|
1147
|
+
}), r = Bi(), i = tt(Jn), { undoCount: o, redoCount: c } = Zn();
|
|
1148
|
+
return { savePage: Go(
|
|
1149
|
+
async () => {
|
|
1150
|
+
t("SAVING"), s("SAVING");
|
|
1151
|
+
const u = r();
|
|
1152
|
+
return await n({ blocks: u.blocks, identifier: "pageData.id" }), setTimeout(() => {
|
|
1153
|
+
i({ undoCount: o, redoCount: c }), t("SAVED"), s("SAVED");
|
|
1154
|
+
}, 100), !0;
|
|
1155
|
+
},
|
|
1156
|
+
[r, t, s, n],
|
|
1157
|
+
5e3
|
|
1158
|
+
// save only every 5 seconds
|
|
1159
|
+
), syncState: e, setSyncState: t };
|
|
1160
|
+
}, Zn = () => {
|
|
1161
|
+
const e = ne(Hn), [{ undoCount: t, redoCount: n }] = Z(Jn), s = ke(), [r] = Pi(), [, i] = bt(), [, o] = Ai(), [, c] = Z(Yn), l = cn("onSyncStatusChange", () => {
|
|
1162
|
+
}), u = Y(() => {
|
|
1163
|
+
s({ type: "create_snapshot" });
|
|
1164
|
+
}, [s]);
|
|
1165
|
+
return Ee(() => {
|
|
1166
|
+
t !== (e == null ? void 0 : e.past.length) || n !== (e == null ? void 0 : e.future.length) ? (c("UNSAVED"), l("UNSAVED")) : t === (e == null ? void 0 : e.past.length) && n === (e == null ? void 0 : e.future.length) && (c("SAVED"), l("SAVED"));
|
|
1167
|
+
}, [e == null ? void 0 : e.past.length, e == null ? void 0 : e.future.length, t, n, l, c]), {
|
|
1168
|
+
undoCount: e == null ? void 0 : e.past.length,
|
|
1169
|
+
redoCount: e == null ? void 0 : e.future.length,
|
|
1170
|
+
undo: Y(() => {
|
|
1171
|
+
r || (s(us.undo()), setTimeout(() => {
|
|
1172
|
+
o([]), i([]);
|
|
1173
|
+
}, 200));
|
|
1174
|
+
}, [s, r, c]),
|
|
1175
|
+
redo: Y(() => {
|
|
1176
|
+
r || (s(us.redo()), setTimeout(() => {
|
|
1177
|
+
o([]), i([]);
|
|
1178
|
+
}, 200));
|
|
1179
|
+
}, [r, s]),
|
|
1180
|
+
clear: () => {
|
|
1181
|
+
s(us.clearHistory());
|
|
1182
|
+
},
|
|
1183
|
+
createSnapshot: u
|
|
1184
|
+
};
|
|
1185
|
+
}, vc = () => Z(xi), Di = vt("canvasWidth", 360), Mi = N((e) => {
|
|
1186
|
+
const t = e(Di);
|
|
1187
|
+
return Vo(t).toLowerCase();
|
|
1188
|
+
}), Dd = () => {
|
|
1189
|
+
const [e, t] = Z(Di), n = ne(Mi), [s, r] = vc();
|
|
1190
|
+
return Ee(() => {
|
|
1191
|
+
s !== "xs" && r(n);
|
|
1192
|
+
}, [n, s, r]), [e, n, t];
|
|
1193
|
+
}, bc = vt("canvasZoom", 100), Md = () => Z(bc), Li = N([]), Ni = () => {
|
|
1194
|
+
const [e, t] = Z(Li), n = tt(Ks), s = Y(
|
|
1195
|
+
(r) => {
|
|
1196
|
+
t(r), n([]);
|
|
1197
|
+
},
|
|
1198
|
+
[t, n]
|
|
1199
|
+
);
|
|
1200
|
+
return [e, s];
|
|
1201
|
+
}, Ks = N([]), wc = () => {
|
|
1202
|
+
const [e, t] = Z(Ks), n = tt(Li), s = Y(
|
|
1203
|
+
(r) => {
|
|
1204
|
+
t(r), n([]);
|
|
1205
|
+
},
|
|
1206
|
+
[t, n]
|
|
1207
|
+
);
|
|
1208
|
+
return [e, s];
|
|
1209
|
+
}, Ti = vt("darkMode", !1), Ld = () => {
|
|
1210
|
+
const [e, t] = Z(Ti);
|
|
1211
|
+
return [e, t];
|
|
1212
|
+
}, Sc = N(!1), Nd = () => {
|
|
1213
|
+
const [e, t] = Z(Sc);
|
|
1214
|
+
return [e, t];
|
|
1215
|
+
}, Fi = () => {
|
|
1216
|
+
const e = ke(), t = ne(xe), [, n] = bt();
|
|
1217
|
+
return Y(
|
|
1218
|
+
(s, r = null) => {
|
|
1219
|
+
const i = [];
|
|
1220
|
+
Ze(s, (o) => {
|
|
1221
|
+
const l = Ma(t, o, r === o ? null : r);
|
|
1222
|
+
i.push(ee(l, "0._id", "")), e({ type: "add_duplicate_blocks", payload: l });
|
|
1223
|
+
}), n(i), e({ type: "create_snapshot" });
|
|
1224
|
+
},
|
|
1225
|
+
[t, n, e]
|
|
1226
|
+
);
|
|
1227
|
+
}, xc = N([]), Td = () => {
|
|
1228
|
+
const [e, t] = Z(xc), n = Y(
|
|
1229
|
+
(s) => {
|
|
1230
|
+
t((r) => he(r, s) ? ci(r, s) : [...r, s]);
|
|
1231
|
+
},
|
|
1232
|
+
[t]
|
|
1233
|
+
);
|
|
1234
|
+
return [e, t, n];
|
|
1235
|
+
}, kc = N(""), Ac = () => Z(kc), Fd = () => {
|
|
1236
|
+
const e = ne(xe), t = ke(), n = Bi(), [, , s] = Xa();
|
|
1237
|
+
return Y(
|
|
1238
|
+
async (r, i) => {
|
|
1239
|
+
const o = Xe(16), c = de(e, (l) => (l._id === r && (l._globalBlockId = o, l._name = i), l));
|
|
1240
|
+
t({ type: "set_page_blocks", payload: c }), s();
|
|
1241
|
+
},
|
|
1242
|
+
[e, t, n, s]
|
|
1243
|
+
);
|
|
1244
|
+
}, Ud = () => ({}), Ec = () => {
|
|
1245
|
+
const e = ne(xe), t = ke();
|
|
1246
|
+
return Y(
|
|
1247
|
+
(n, s) => {
|
|
1248
|
+
const r = de(e, (i) => (he(n, ee(i, "_id")) && ht(i, "_parent", s), i));
|
|
1249
|
+
t({ type: "set_blocks", payload: r });
|
|
1250
|
+
},
|
|
1251
|
+
[e, t]
|
|
1252
|
+
);
|
|
1253
|
+
}, Pc = () => {
|
|
1254
|
+
const e = ne(Ks), [t, n] = Ni(), s = Fi(), r = Ec();
|
|
1255
|
+
return {
|
|
1256
|
+
canPaste: Bo(
|
|
1257
|
+
() => t.length > 0 || e.length > 0,
|
|
1258
|
+
[e, t]
|
|
1259
|
+
),
|
|
1260
|
+
pasteBlocks: Y(
|
|
1261
|
+
(o) => {
|
|
1262
|
+
Te(e) ? r(t, o) : s(e, o), n(() => []);
|
|
1263
|
+
},
|
|
1264
|
+
[t, e, s, r, n]
|
|
1265
|
+
)
|
|
1266
|
+
};
|
|
1267
|
+
}, Oc = N(""), qd = () => {
|
|
1268
|
+
const e = ne(Oc), t = Y(() => {
|
|
1269
|
+
}, []), n = Y(() => {
|
|
1270
|
+
}, []), s = Y(() => {
|
|
1271
|
+
}, []);
|
|
1272
|
+
return { currentProject: e, createProject: s, deleteProject: t, updateProject: n };
|
|
1273
|
+
}, Ui = (e, t) => {
|
|
1274
|
+
const n = [], s = te(e, (r) => he(t, r._id) || he(t, r._parent) ? (n.push(r._id), !1) : !0);
|
|
1275
|
+
return Te(n) ? s : Ui(s, n);
|
|
1276
|
+
}, Cc = () => {
|
|
1277
|
+
const e = ke(), t = ne(xe), [n, s] = bt();
|
|
1278
|
+
return Y(
|
|
1279
|
+
(r) => {
|
|
1280
|
+
var c;
|
|
1281
|
+
const i = ((c = Pe(t, { _id: r[0] })) == null ? void 0 : c._parent) || null, o = Ui(t, r);
|
|
1282
|
+
e({ type: "set_blocks", payload: o }), s(i ? [i] : []);
|
|
1283
|
+
},
|
|
1284
|
+
[t, s, e, n]
|
|
1285
|
+
);
|
|
1286
|
+
}, _c = N(null, (e, t, { blockIds: n, fullClasses: s, dispatch: r }) => {
|
|
1287
|
+
const i = De(e(An)), o = te(
|
|
1288
|
+
e(Ts),
|
|
1289
|
+
(c) => (
|
|
1290
|
+
// @ts-ignore
|
|
1291
|
+
n.includes(e(c)._id)
|
|
1292
|
+
)
|
|
1293
|
+
);
|
|
1294
|
+
Ze(o, (c) => {
|
|
1295
|
+
const l = e(c), u = s;
|
|
1296
|
+
let { classes: f, baseClasses: m } = la(ee(l, i.prop, "styles:,"));
|
|
1297
|
+
Ze(u, (A) => {
|
|
1298
|
+
const g = new RegExp(`(^| )${A.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
1299
|
+
f = f.replace(g, " ").replace(/ +/g, " ").trim();
|
|
1300
|
+
const C = De(A.split(":"));
|
|
1301
|
+
he(["2xl", "xl", "lg", "md", "sm"], C) && u.push(A.split(":").pop().trim());
|
|
1302
|
+
}), Ze(u, (A) => {
|
|
1303
|
+
const g = new RegExp(`(^| )${A.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
1304
|
+
m = m.replace(g, " ").replace(/ +/g, " ").trim();
|
|
1305
|
+
}), r({
|
|
1306
|
+
type: "update_props_realtime",
|
|
1307
|
+
payload: {
|
|
1308
|
+
ids: [l._id],
|
|
1309
|
+
props: {
|
|
1310
|
+
[i.prop]: `${pt}${m},${f}`
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
});
|
|
1314
|
+
});
|
|
1315
|
+
}), $d = () => {
|
|
1316
|
+
const e = ke(), t = tt(_c);
|
|
1317
|
+
return Y(
|
|
1318
|
+
(n, s) => {
|
|
1319
|
+
t({ blockIds: n, fullClasses: s, dispatch: e }), setTimeout(() => e({ type: "create_snapshot" }));
|
|
1320
|
+
},
|
|
1321
|
+
[e, t]
|
|
1322
|
+
);
|
|
1323
|
+
}, qi = N((e) => {
|
|
1324
|
+
const t = De(e(An)), n = e(qs);
|
|
1325
|
+
if (!t || t.blockId !== ee(n, "_id", null))
|
|
1326
|
+
return [];
|
|
1327
|
+
const r = ee(n, t.prop, `${pt},`).replace(pt, "").split(",").join(" ");
|
|
1328
|
+
return te(de(r.trim().split(" "), Ln), (i) => !gs(i));
|
|
1329
|
+
}), Qd = () => ne(qi), vr = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 5 }, jc = N((e) => {
|
|
1330
|
+
const t = e(Mi), n = e($s), s = e(Ti), r = Ic(t);
|
|
1331
|
+
let i = te(e(qi), { mod: n });
|
|
1332
|
+
return li(n, "_") || (i = te(i, (o) => r.includes(o.mq))), i = i.sort((o, c) => vr[o.mq] - vr[c.mq]), s || (i = te(i, { dark: !1 })), i;
|
|
1333
|
+
}), Ic = (e) => {
|
|
1334
|
+
let t = [];
|
|
1335
|
+
switch (e) {
|
|
1336
|
+
case "xs":
|
|
1337
|
+
t = ["xs"];
|
|
1338
|
+
break;
|
|
1339
|
+
case "sm":
|
|
1340
|
+
t = ["xs", "sm"];
|
|
1341
|
+
break;
|
|
1342
|
+
case "md":
|
|
1343
|
+
t = ["xs", "sm", "md"];
|
|
1344
|
+
break;
|
|
1345
|
+
case "lg":
|
|
1346
|
+
t = ["xs", "sm", "md", "lg"];
|
|
1347
|
+
break;
|
|
1348
|
+
case "xl":
|
|
1349
|
+
t = ["xs", "sm", "md", "lg", "xl"];
|
|
1350
|
+
break;
|
|
1351
|
+
case "2xl":
|
|
1352
|
+
t = ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
1353
|
+
break;
|
|
1354
|
+
default:
|
|
1355
|
+
t = ["xs"];
|
|
1356
|
+
break;
|
|
1357
|
+
}
|
|
1358
|
+
return t;
|
|
1359
|
+
}, Vd = () => ne(jc), Kd = () => Z($s), $i = N(null, (e, t, { blockIds: n, props: s, dispatch: r }) => {
|
|
1360
|
+
r({
|
|
1361
|
+
type: "update_props_realtime",
|
|
1362
|
+
payload: { ids: n, props: s }
|
|
1363
|
+
});
|
|
1364
|
+
}), zd = () => {
|
|
1365
|
+
const { createSnapshot: e } = Zn(), t = ke(), n = tt($i);
|
|
1366
|
+
return Y(
|
|
1367
|
+
(s, r) => {
|
|
1368
|
+
n({ blockIds: s, props: r, dispatch: t }), e();
|
|
1369
|
+
},
|
|
1370
|
+
[e, t, n]
|
|
1371
|
+
);
|
|
1372
|
+
}, Gd = () => {
|
|
1373
|
+
const e = ke(), t = tt($i);
|
|
1374
|
+
return Y(
|
|
1375
|
+
(n, s) => {
|
|
1376
|
+
t({ blockIds: n, props: s, dispatch: e });
|
|
1377
|
+
},
|
|
1378
|
+
[e, t]
|
|
1379
|
+
);
|
|
1380
|
+
}, Qi = {
|
|
1381
|
+
name: "",
|
|
1382
|
+
props: {},
|
|
1383
|
+
modalProps: {},
|
|
1384
|
+
backdropClose: !0
|
|
1385
|
+
}, Bc = N(Qi), Wd = () => {
|
|
1386
|
+
const [e, t] = Z(Bc), n = Y(
|
|
1387
|
+
(r, i = {}, o = {}) => {
|
|
1388
|
+
t({ name: r, props: i, modalProps: o });
|
|
1389
|
+
},
|
|
1390
|
+
[t]
|
|
1391
|
+
), s = Y(
|
|
1392
|
+
(...r) => {
|
|
1393
|
+
ee(e, "props.onClose", () => {
|
|
1394
|
+
})(...r), t(Qi);
|
|
1395
|
+
},
|
|
1396
|
+
[t, e]
|
|
1397
|
+
);
|
|
1398
|
+
return {
|
|
1399
|
+
activeModal: e,
|
|
1400
|
+
openModal: n,
|
|
1401
|
+
closeModal: s
|
|
1402
|
+
};
|
|
1403
|
+
}, Hd = () => ne(Ri), Rc = N(""), Dc = N(null), Jd = () => Z(Rc), Yd = () => Z(Dc), Mc = vt("selectedBreakpoints", ["XS", "MD", "XL"]), Zd = () => {
|
|
1404
|
+
const [e, t] = Z(Mc);
|
|
1405
|
+
return [e, t];
|
|
1406
|
+
}, Lc = () => {
|
|
1407
|
+
const e = tt(Jn), { clear: t } = Zn(), [, n] = bt(), [, s] = Ac(), [, r] = Ai();
|
|
1408
|
+
return () => {
|
|
1409
|
+
n([]), r([]), s(""), t(), e({ undoCount: 0, redoCount: 0 });
|
|
1410
|
+
};
|
|
1411
|
+
}, Nc = N({ en: {} }), Xd = () => {
|
|
1412
|
+
const [e, t] = Z(Nc), n = Y(
|
|
1413
|
+
(s, r, i) => {
|
|
1414
|
+
ht(e, `${s}.${r}`, i), t(e);
|
|
1415
|
+
},
|
|
1416
|
+
[e, t]
|
|
1417
|
+
);
|
|
1418
|
+
return [e, n];
|
|
1419
|
+
}, ef = (e, t) => {
|
|
1420
|
+
const [n] = Z(di);
|
|
1421
|
+
return ee(n, e, t);
|
|
1422
|
+
}, Tc = N([]), tf = () => {
|
|
1423
|
+
const [e, t] = Ro(!1), [n, s] = Z(Tc), r = cn("getUILibraryBlocks", () => []);
|
|
1424
|
+
return Ee(() => {
|
|
1425
|
+
(async () => n.length > 0 || (t(!0), s(await r()), t(!1)))();
|
|
1426
|
+
}, []), { data: n, isLoading: e };
|
|
1427
|
+
}, Fc = N("en"), Uc = N("en"), qc = N(["en"]), $c = () => Z(Fc), nf = () => Z(Uc), sf = () => Z(qc), rf = (e, t) => {
|
|
1428
|
+
const [n] = $c(), s = `${e}${n ? `-${n}` : ""}`;
|
|
1429
|
+
return { content: ee(t, s, ee(t, e, "")), propKey: e };
|
|
1430
|
+
}, Qc = () => {
|
|
1431
|
+
const [e, t] = Pi(), n = cn("previewComponent");
|
|
1432
|
+
return /* @__PURE__ */ x.jsxs("div", { className: Qo("fixed inset-0 z-[999] bg-background", e ? "block" : "hidden"), children: [
|
|
1433
|
+
/* @__PURE__ */ x.jsx(fi, { size: "sm", className: "absolute right-0 top-0 m-4", onClick: () => t(!1), children: "Close Preview" }),
|
|
1434
|
+
/* @__PURE__ */ x.jsx("div", { children: n ? /* @__PURE__ */ x.jsx(en, { fallback: /* @__PURE__ */ x.jsx(Fo, { className: "h-96 w-full" }), children: Ms.createElement(n) }) : null })
|
|
1435
|
+
] });
|
|
1436
|
+
}, Vc = () => {
|
|
1437
|
+
const [e, t] = bt(), [, n] = wc(), s = Cc(), r = Fi(), [, i] = Ni(), { pasteBlocks: o } = Pc(), { undo: c, redo: l } = Zn();
|
|
1438
|
+
Fe("esc", () => t([]), {}, [t]), Fe("ctrl+c,command+c", () => n(e), {}, [e, n]), Fe("ctrl+d,command+d", () => r(e), { preventDefault: !0 }, [e, r]), Fe("ctrl+x,command+x", () => i(e), {}, [e, i]), Fe("ctrl+v,command+v", () => e.length === 1 ? o(e[0]) : null, {}, [e, o]), Fe("ctrl+z,command+z", () => c(), {}, [c]), Fe("ctrl+y,command+y", () => l(), {}, [l]), Fe(
|
|
1439
|
+
"del, backspace",
|
|
1440
|
+
(u) => {
|
|
1441
|
+
u.preventDefault(), s(e);
|
|
1442
|
+
},
|
|
1443
|
+
{},
|
|
1444
|
+
[e, s]
|
|
1445
|
+
);
|
|
1446
|
+
}, Kc = (e, t) => {
|
|
1447
|
+
const n = [];
|
|
1448
|
+
let s = Pe(e, { _id: t }), r = ee(s, "_parent", "");
|
|
1449
|
+
for (; Ls(r) && !Te(r); )
|
|
1450
|
+
n.push(s == null ? void 0 : s._parent), s = Pe(e, { _id: r }), r = s == null ? void 0 : s._parent;
|
|
1451
|
+
return Se(n);
|
|
1452
|
+
}, Vi = N([]), zc = () => {
|
|
1453
|
+
const [e] = bt(), t = ne(xe), [, n] = Z(Vi);
|
|
1454
|
+
Ee(() => {
|
|
1455
|
+
let s = [];
|
|
1456
|
+
const r = De(e);
|
|
1457
|
+
Ls(r) && (s = [r, ...Kc(t, r)]), n(s);
|
|
1458
|
+
}, [e, t, n]);
|
|
1459
|
+
}, of = () => ne(Vi), Gc = Gt(() => import("./SidePanels-73e79a7d.js")), Wc = Gt(() => import("./Topbar-5574394f.js")), Hc = Gt(() => import("./CanvasArea-688987d1.js")), Jc = Gt(() => import("./Settings-f4118350.js")), Yc = () => {
|
|
1460
|
+
const [e] = Ba(Yn), t = (n) => {
|
|
1461
|
+
n.preventDefault();
|
|
1462
|
+
};
|
|
1463
|
+
return Vc(), zc(), Ee(() => (e !== "SAVED" ? window.onbeforeunload = () => "" : window.onbeforeunload = null, () => {
|
|
1464
|
+
window.onbeforeunload = null;
|
|
1465
|
+
}), [e]), /* @__PURE__ */ x.jsx("div", { className: "h-screen w-screen bg-background text-foreground", children: /* @__PURE__ */ x.jsxs(Uo, { children: [
|
|
1466
|
+
/* @__PURE__ */ x.jsxs(
|
|
1467
|
+
"div",
|
|
1468
|
+
{
|
|
1469
|
+
onContextMenu: t,
|
|
1470
|
+
className: "flex h-screen flex-col overflow-hidden bg-background text-foreground",
|
|
1471
|
+
children: [
|
|
1472
|
+
/* @__PURE__ */ x.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ x.jsx(en, { children: /* @__PURE__ */ x.jsx(Wc, {}) }) }),
|
|
1473
|
+
/* @__PURE__ */ x.jsxs("main", { className: "flex h-full flex-row", children: [
|
|
1474
|
+
/* @__PURE__ */ x.jsx("div", { className: "flex h-full w-fit border-border", children: /* @__PURE__ */ x.jsx(en, { children: /* @__PURE__ */ x.jsx(Gc, {}) }) }),
|
|
1475
|
+
/* @__PURE__ */ x.jsx("div", { className: "h-full flex-1 bg-slate-800/20", children: /* @__PURE__ */ x.jsx(en, { children: /* @__PURE__ */ x.jsx(Hc, {}) }) }),
|
|
1476
|
+
/* @__PURE__ */ x.jsx("div", { className: "flex h-full w-[280px] min-w-[280px] border-l border-border", children: /* @__PURE__ */ x.jsx(en, { children: /* @__PURE__ */ x.jsx(Jc, {}) }) })
|
|
1477
|
+
] })
|
|
1478
|
+
]
|
|
1479
|
+
}
|
|
1480
|
+
),
|
|
1481
|
+
/* @__PURE__ */ x.jsx(Qc, {})
|
|
1482
|
+
] }) });
|
|
1483
|
+
}, Zc = $o();
|
|
1484
|
+
N({});
|
|
1485
|
+
function br(e, t, n, s, r) {
|
|
1486
|
+
for (t = t.split ? t.split(".") : t, s = 0; s < t.length; s++)
|
|
1487
|
+
e = e ? e[t[s]] : r;
|
|
1488
|
+
return e === r ? n : e;
|
|
1489
|
+
}
|
|
1490
|
+
var jn = "undefined", wr = "object", Ki = "any", zi = "*", mt = "__", $n = typeof process < "u" ? process : {};
|
|
1491
|
+
$n.env && $n.env.NODE_ENV;
|
|
1492
|
+
var Oe = typeof document < "u";
|
|
1493
|
+
$n.versions != null && $n.versions.node != null;
|
|
1494
|
+
typeof Deno < "u" && Deno.core;
|
|
1495
|
+
Oe && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
1496
|
+
function Gi(e, t) {
|
|
1497
|
+
return t.charAt(0)[e]() + t.slice(1);
|
|
1498
|
+
}
|
|
1499
|
+
var Xc = Gi.bind(null, "toUpperCase"), eu = Gi.bind(null, "toLowerCase");
|
|
1500
|
+
function tu(e) {
|
|
1501
|
+
return Wi(e) ? Xc("null") : typeof e == "object" ? ou(e) : Object.prototype.toString.call(e).slice(8, -1);
|
|
1502
|
+
}
|
|
1503
|
+
function Qn(e, t) {
|
|
1504
|
+
t === void 0 && (t = !0);
|
|
1505
|
+
var n = tu(e);
|
|
1506
|
+
return t ? eu(n) : n;
|
|
1507
|
+
}
|
|
1508
|
+
function En(e, t) {
|
|
1509
|
+
return typeof t === e;
|
|
1510
|
+
}
|
|
1511
|
+
var Re = En.bind(null, "function"), kt = En.bind(null, "string"), St = En.bind(null, "undefined"), nu = En.bind(null, "boolean");
|
|
1512
|
+
En.bind(null, "symbol");
|
|
1513
|
+
function Wi(e) {
|
|
1514
|
+
return e === null;
|
|
1515
|
+
}
|
|
1516
|
+
function su(e) {
|
|
1517
|
+
return Qn(e) === "number" && !isNaN(e);
|
|
1518
|
+
}
|
|
1519
|
+
function ru(e) {
|
|
1520
|
+
return Qn(e) === "array";
|
|
1521
|
+
}
|
|
1522
|
+
function me(e) {
|
|
1523
|
+
if (!iu(e))
|
|
1524
|
+
return !1;
|
|
1525
|
+
for (var t = e; Object.getPrototypeOf(t) !== null; )
|
|
1526
|
+
t = Object.getPrototypeOf(t);
|
|
1527
|
+
return Object.getPrototypeOf(e) === t;
|
|
1528
|
+
}
|
|
1529
|
+
function iu(e) {
|
|
1530
|
+
return e && (typeof e == "object" || e !== null);
|
|
1531
|
+
}
|
|
1532
|
+
function ou(e) {
|
|
1533
|
+
return Re(e.constructor) ? e.constructor.name : null;
|
|
1534
|
+
}
|
|
1535
|
+
function au(e) {
|
|
1536
|
+
return e instanceof Error || kt(e.message) && e.constructor && su(e.constructor.stackTraceLimit);
|
|
1537
|
+
}
|
|
1538
|
+
function Hi(e, t) {
|
|
1539
|
+
if (typeof t != "object" || Wi(t))
|
|
1540
|
+
return !1;
|
|
1541
|
+
if (t instanceof e)
|
|
1542
|
+
return !0;
|
|
1543
|
+
var n = Qn(new e(""));
|
|
1544
|
+
if (au(t))
|
|
1545
|
+
for (; t; ) {
|
|
1546
|
+
if (Qn(t) === n)
|
|
1547
|
+
return !0;
|
|
1548
|
+
t = Object.getPrototypeOf(t);
|
|
1549
|
+
}
|
|
1550
|
+
return !1;
|
|
1551
|
+
}
|
|
1552
|
+
Hi.bind(null, TypeError);
|
|
1553
|
+
Hi.bind(null, SyntaxError);
|
|
1554
|
+
function Xn(e, t) {
|
|
1555
|
+
var n = e instanceof Element || e instanceof HTMLDocument;
|
|
1556
|
+
return n && t ? cu(e, t) : n;
|
|
1557
|
+
}
|
|
1558
|
+
function cu(e, t) {
|
|
1559
|
+
return t === void 0 && (t = ""), e && e.nodeName === t.toUpperCase();
|
|
1560
|
+
}
|
|
1561
|
+
function es(e) {
|
|
1562
|
+
var t = [].slice.call(arguments, 1);
|
|
1563
|
+
return function() {
|
|
1564
|
+
return e.apply(void 0, [].slice.call(arguments).concat(t));
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
es(Xn, "form");
|
|
1568
|
+
es(Xn, "button");
|
|
1569
|
+
es(Xn, "input");
|
|
1570
|
+
es(Xn, "select");
|
|
1571
|
+
function Sr(e) {
|
|
1572
|
+
try {
|
|
1573
|
+
return decodeURIComponent(e.replace(/\+/g, " "));
|
|
1574
|
+
} catch {
|
|
1575
|
+
return null;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
function uu() {
|
|
1579
|
+
if (Oe) {
|
|
1580
|
+
var e = navigator, t = e.languages;
|
|
1581
|
+
return e.userLanguage || (t && t.length ? t[0] : e.language);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
function lu() {
|
|
1585
|
+
try {
|
|
1586
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1587
|
+
} catch {
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
function du(e) {
|
|
1591
|
+
return function(t) {
|
|
1592
|
+
for (var n, s = /* @__PURE__ */ Object.create(null), r = /([^&=]+)=?([^&]*)/g; n = r.exec(t); ) {
|
|
1593
|
+
var i = Sr(n[1]), o = Sr(n[2]);
|
|
1594
|
+
i.substring(i.length - 2) === "[]" ? (s[i = i.substring(0, i.length - 2)] || (s[i] = [])).push(o) : s[i] = o === "" || o;
|
|
1595
|
+
}
|
|
1596
|
+
for (var c in s) {
|
|
1597
|
+
var l = c.split("[");
|
|
1598
|
+
l.length > 1 && (fu(s, l.map(function(u) {
|
|
1599
|
+
return u.replace(/[?[\]\\ ]/g, "");
|
|
1600
|
+
}), s[c]), delete s[c]);
|
|
1601
|
+
}
|
|
1602
|
+
return s;
|
|
1603
|
+
}(function(t) {
|
|
1604
|
+
if (t) {
|
|
1605
|
+
var n = t.match(/\?(.*)/);
|
|
1606
|
+
return n && n[1] ? n[1].split("#")[0] : "";
|
|
1607
|
+
}
|
|
1608
|
+
return Oe && window.location.search.substring(1);
|
|
1609
|
+
}(e));
|
|
1610
|
+
}
|
|
1611
|
+
function fu(e, t, n) {
|
|
1612
|
+
for (var s = t.length - 1, r = 0; r < s; ++r) {
|
|
1613
|
+
var i = t[r];
|
|
1614
|
+
if (i === "__proto__" || i === "constructor")
|
|
1615
|
+
break;
|
|
1616
|
+
i in e || (e[i] = {}), e = e[i];
|
|
1617
|
+
}
|
|
1618
|
+
e[t[s]] = n;
|
|
1619
|
+
}
|
|
1620
|
+
function ts() {
|
|
1621
|
+
for (var e = "", t = 0, n = 4294967295 * Math.random() | 0; t++ < 36; ) {
|
|
1622
|
+
var s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t - 1], r = 15 & n;
|
|
1623
|
+
e += s == "-" || s == "4" ? s : (s == "x" ? r : 3 & r | 8).toString(16), n = t % 8 == 0 ? 4294967295 * Math.random() | 0 : n >> 4;
|
|
1624
|
+
}
|
|
1625
|
+
return e;
|
|
1626
|
+
}
|
|
1627
|
+
var sn = "global", Qt = mt + "global" + mt, Vt = typeof self === wr && self.self === self && self || typeof global === wr && global.global === global && global || void 0;
|
|
1628
|
+
function gt(e) {
|
|
1629
|
+
return Vt[Qt][e];
|
|
1630
|
+
}
|
|
1631
|
+
function yt(e, t) {
|
|
1632
|
+
return Vt[Qt][e] = t;
|
|
1633
|
+
}
|
|
1634
|
+
function Wt(e) {
|
|
1635
|
+
delete Vt[Qt][e];
|
|
1636
|
+
}
|
|
1637
|
+
function Ht(e, t, n) {
|
|
1638
|
+
var s;
|
|
1639
|
+
try {
|
|
1640
|
+
if (zs(e)) {
|
|
1641
|
+
var r = window[e];
|
|
1642
|
+
s = r[t].bind(r);
|
|
1643
|
+
}
|
|
1644
|
+
} catch {
|
|
1645
|
+
}
|
|
1646
|
+
return s || n;
|
|
1647
|
+
}
|
|
1648
|
+
Vt[Qt] || (Vt[Qt] = {});
|
|
1649
|
+
var In = {};
|
|
1650
|
+
function zs(e) {
|
|
1651
|
+
if (typeof In[e] !== jn)
|
|
1652
|
+
return In[e];
|
|
1653
|
+
try {
|
|
1654
|
+
var t = window[e];
|
|
1655
|
+
t.setItem(jn, jn), t.removeItem(jn);
|
|
1656
|
+
} catch {
|
|
1657
|
+
return In[e] = !1;
|
|
1658
|
+
}
|
|
1659
|
+
return In[e] = !0;
|
|
1660
|
+
}
|
|
1661
|
+
function q() {
|
|
1662
|
+
return q = Object.assign || function(e) {
|
|
1663
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
1664
|
+
var n = arguments[t];
|
|
1665
|
+
for (var s in n)
|
|
1666
|
+
Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]);
|
|
1667
|
+
}
|
|
1668
|
+
return e;
|
|
1669
|
+
}, q.apply(this, arguments);
|
|
1670
|
+
}
|
|
1671
|
+
var Qe = "function", Ne = "undefined", hu = "@@redux/" + Math.random().toString(36), xr = /* @__PURE__ */ function() {
|
|
1672
|
+
return typeof Symbol === Qe && Symbol.observable || "@@observable";
|
|
1673
|
+
}(), Bn = " != " + Qe;
|
|
1674
|
+
function Ji(e, t, n) {
|
|
1675
|
+
var s;
|
|
1676
|
+
if (typeof t === Qe && typeof n === Ne && (n = t, t = void 0), typeof n !== Ne) {
|
|
1677
|
+
if (typeof n !== Qe)
|
|
1678
|
+
throw new Error("enhancer" + Bn);
|
|
1679
|
+
return n(Ji)(e, t);
|
|
1680
|
+
}
|
|
1681
|
+
if (typeof e !== Qe)
|
|
1682
|
+
throw new Error("reducer" + Bn);
|
|
1683
|
+
var r = e, i = t, o = [], c = o, l = !1;
|
|
1684
|
+
function u() {
|
|
1685
|
+
c === o && (c = o.slice());
|
|
1686
|
+
}
|
|
1687
|
+
function f() {
|
|
1688
|
+
return i;
|
|
1689
|
+
}
|
|
1690
|
+
function m(g) {
|
|
1691
|
+
if (typeof g !== Qe)
|
|
1692
|
+
throw new Error("Listener" + Bn);
|
|
1693
|
+
var C = !0;
|
|
1694
|
+
return u(), c.push(g), function() {
|
|
1695
|
+
if (C) {
|
|
1696
|
+
C = !1, u();
|
|
1697
|
+
var _ = c.indexOf(g);
|
|
1698
|
+
c.splice(_, 1);
|
|
1699
|
+
}
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
function A(g) {
|
|
1703
|
+
if (!me(g))
|
|
1704
|
+
throw new Error("Act != obj");
|
|
1705
|
+
if (typeof g.type === Ne)
|
|
1706
|
+
throw new Error("ActType " + Ne);
|
|
1707
|
+
if (l)
|
|
1708
|
+
throw new Error("Dispatch in reducer");
|
|
1709
|
+
try {
|
|
1710
|
+
l = !0, i = r(i, g);
|
|
1711
|
+
} finally {
|
|
1712
|
+
l = !1;
|
|
1713
|
+
}
|
|
1714
|
+
for (var C = o = c, _ = 0; _ < C.length; _++)
|
|
1715
|
+
(0, C[_])();
|
|
1716
|
+
return g;
|
|
1717
|
+
}
|
|
1718
|
+
return A({ type: "@@redux/INIT" }), (s = { dispatch: A, subscribe: m, getState: f, replaceReducer: function(g) {
|
|
1719
|
+
if (typeof g !== Qe)
|
|
1720
|
+
throw new Error("next reducer" + Bn);
|
|
1721
|
+
r = g, A({ type: "@@redux/INIT" });
|
|
1722
|
+
} })[xr] = function() {
|
|
1723
|
+
var g, C = m;
|
|
1724
|
+
return (g = { subscribe: function(_) {
|
|
1725
|
+
if (typeof _ != "object")
|
|
1726
|
+
throw new TypeError("Observer != obj");
|
|
1727
|
+
function y() {
|
|
1728
|
+
_.next && _.next(f());
|
|
1729
|
+
}
|
|
1730
|
+
return y(), { unsubscribe: C(y) };
|
|
1731
|
+
} })[xr] = function() {
|
|
1732
|
+
return this;
|
|
1733
|
+
}, g;
|
|
1734
|
+
}, s;
|
|
1735
|
+
}
|
|
1736
|
+
function pu(e, t) {
|
|
1737
|
+
var n = t && t.type;
|
|
1738
|
+
return "action " + (n && n.toString() || "?") + "reducer " + e + " returns " + Ne;
|
|
1739
|
+
}
|
|
1740
|
+
function Kt() {
|
|
1741
|
+
var e = [].slice.call(arguments);
|
|
1742
|
+
return e.length === 0 ? function(t) {
|
|
1743
|
+
return t;
|
|
1744
|
+
} : e.length === 1 ? e[0] : e.reduce(function(t, n) {
|
|
1745
|
+
return function() {
|
|
1746
|
+
return t(n.apply(void 0, [].slice.call(arguments)));
|
|
1747
|
+
};
|
|
1748
|
+
});
|
|
1749
|
+
}
|
|
1750
|
+
function mu() {
|
|
1751
|
+
var e = arguments;
|
|
1752
|
+
return function(t) {
|
|
1753
|
+
return function(n, s, r) {
|
|
1754
|
+
var i, o = t(n, s, r), c = o.dispatch, l = { getState: o.getState, dispatch: function(u) {
|
|
1755
|
+
return c(u);
|
|
1756
|
+
} };
|
|
1757
|
+
return i = [].slice.call(e).map(function(u) {
|
|
1758
|
+
return u(l);
|
|
1759
|
+
}), q({}, o, { dispatch: c = Kt.apply(void 0, i)(o.dispatch) });
|
|
1760
|
+
};
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1763
|
+
var et = mt + "anon_id", ft = mt + "user_id", At = mt + "user_traits", qe = "userId", xt = "anonymousId", Nn = ["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"], Ss = ["name", "EVENTS", "config", "loaded"], U = Nn.reduce(function(e, t) {
|
|
1764
|
+
return e[t] = t, e;
|
|
1765
|
+
}, { registerPluginType: function(e) {
|
|
1766
|
+
return "registerPlugin:" + e;
|
|
1767
|
+
}, pluginReadyType: function(e) {
|
|
1768
|
+
return "ready:" + e;
|
|
1769
|
+
} }), kr = /^utm_/, Ar = /^an_prop_/, Er = /^an_trait_/;
|
|
1770
|
+
function gu(e) {
|
|
1771
|
+
var t = e.storage.setItem;
|
|
1772
|
+
return function(n) {
|
|
1773
|
+
return function(s) {
|
|
1774
|
+
return function(r) {
|
|
1775
|
+
if (r.type === U.bootstrap) {
|
|
1776
|
+
var i = r.params, o = r.user, c = r.persistedUser, l = r.initialUser, u = c.userId === o.userId;
|
|
1777
|
+
c.anonymousId !== o.anonymousId && t(et, o.anonymousId), u || t(ft, o.userId), l.traits && t(At, q({}, u && c.traits ? c.traits : {}, l.traits));
|
|
1778
|
+
var f = Object.keys(r.params);
|
|
1779
|
+
if (f.length) {
|
|
1780
|
+
var m = i.an_uid, A = i.an_event, g = f.reduce(function(C, _) {
|
|
1781
|
+
if (_.match(kr) || _.match(/^(d|g)clid/)) {
|
|
1782
|
+
var y = _.replace(kr, "");
|
|
1783
|
+
C.campaign[y === "campaign" ? "name" : y] = i[_];
|
|
1784
|
+
}
|
|
1785
|
+
return _.match(Ar) && (C.props[_.replace(Ar, "")] = i[_]), _.match(Er) && (C.traits[_.replace(Er, "")] = i[_]), C;
|
|
1786
|
+
}, { campaign: {}, props: {}, traits: {} });
|
|
1787
|
+
n.dispatch(q({ type: U.params, raw: i }, g, m ? { userId: m } : {})), m && setTimeout(function() {
|
|
1788
|
+
return e.identify(m, g.traits);
|
|
1789
|
+
}, 0), A && setTimeout(function() {
|
|
1790
|
+
return e.track(A, g.props);
|
|
1791
|
+
}, 0), Object.keys(g.campaign).length && n.dispatch({ type: U.campaign, campaign: g.campaign });
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
return s(r);
|
|
1795
|
+
};
|
|
1796
|
+
};
|
|
1797
|
+
};
|
|
1798
|
+
}
|
|
1799
|
+
function yu(e) {
|
|
1800
|
+
return function(t, n) {
|
|
1801
|
+
if (t === void 0 && (t = {}), n === void 0 && (n = {}), n.type === U.setItemEnd) {
|
|
1802
|
+
if (n.key === et)
|
|
1803
|
+
return q({}, t, { anonymousId: n.value });
|
|
1804
|
+
if (n.key === ft)
|
|
1805
|
+
return q({}, t, { userId: n.value });
|
|
1806
|
+
}
|
|
1807
|
+
switch (n.type) {
|
|
1808
|
+
case U.identify:
|
|
1809
|
+
return Object.assign({}, t, { userId: n.userId, traits: q({}, t.traits, n.traits) });
|
|
1810
|
+
case U.reset:
|
|
1811
|
+
return [ft, et, At].forEach(function(s) {
|
|
1812
|
+
e.removeItem(s);
|
|
1813
|
+
}), Object.assign({}, t, { userId: null, anonymousId: null, traits: {} });
|
|
1814
|
+
default:
|
|
1815
|
+
return t;
|
|
1816
|
+
}
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
function Pr(e) {
|
|
1820
|
+
return { userId: e.getItem(ft), anonymousId: e.getItem(et), traits: e.getItem(At) };
|
|
1821
|
+
}
|
|
1822
|
+
var xs = function(e) {
|
|
1823
|
+
return mt + "TEMP" + mt + e;
|
|
1824
|
+
};
|
|
1825
|
+
function vu(e) {
|
|
1826
|
+
var t = e.storage, n = t.setItem, s = t.removeItem, r = t.getItem;
|
|
1827
|
+
return function(i) {
|
|
1828
|
+
return function(o) {
|
|
1829
|
+
return function(c) {
|
|
1830
|
+
var l = c.userId, u = c.traits, f = c.options;
|
|
1831
|
+
if (c.type === U.reset && ([ft, At, et].forEach(function(g) {
|
|
1832
|
+
s(g);
|
|
1833
|
+
}), [qe, xt, "traits"].forEach(function(g) {
|
|
1834
|
+
Wt(xs(g));
|
|
1835
|
+
})), c.type === U.identify) {
|
|
1836
|
+
r(et) || n(et, ts());
|
|
1837
|
+
var m = r(ft), A = r(At) || {};
|
|
1838
|
+
m && m !== l && i.dispatch({ type: U.userIdChanged, old: { userId: m, traits: A }, new: { userId: l, traits: u }, options: f }), l && n(ft, l), u && n(At, q({}, A, u));
|
|
1839
|
+
}
|
|
1840
|
+
return o(c);
|
|
1841
|
+
};
|
|
1842
|
+
};
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
var tn = {};
|
|
1846
|
+
function Or(e, t) {
|
|
1847
|
+
tn[e] && Re(tn[e]) && (tn[e](t), delete tn[e]);
|
|
1848
|
+
}
|
|
1849
|
+
function Yi(e, t, n) {
|
|
1850
|
+
return new Promise(function(s, r) {
|
|
1851
|
+
return t() ? s(e) : n < 1 ? r(q({}, e, { queue: !0 })) : new Promise(function(i) {
|
|
1852
|
+
return setTimeout(i, 10);
|
|
1853
|
+
}).then(function(i) {
|
|
1854
|
+
return Yi(e, t, n - 10).then(s, r);
|
|
1855
|
+
});
|
|
1856
|
+
});
|
|
1857
|
+
}
|
|
1858
|
+
function Zi(e, t, n) {
|
|
1859
|
+
var s = t(), r = e.getState(), i = r.plugins, o = r.queue, c = r.user;
|
|
1860
|
+
if (!r.context.offline && o && o.actions && o.actions.length) {
|
|
1861
|
+
var l = o.actions.reduce(function(f, m, A) {
|
|
1862
|
+
return i[m.plugin].loaded ? (f.process.push(m), f.processIndex.push(A)) : (f.requeue.push(m), f.requeueIndex.push(A)), f;
|
|
1863
|
+
}, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
|
|
1864
|
+
if (l.processIndex && l.processIndex.length) {
|
|
1865
|
+
l.processIndex.forEach(function(f) {
|
|
1866
|
+
var m = o.actions[f], A = m.plugin, g = m.payload.type, C = s[A][g];
|
|
1867
|
+
if (C && Re(C)) {
|
|
1868
|
+
var _ = function(P, L) {
|
|
1869
|
+
return P === void 0 && (P = {}), L === void 0 && (L = {}), [qe, xt].reduce(function(R, S) {
|
|
1870
|
+
return P.hasOwnProperty(S) && L[S] && L[S] !== P[S] && (R[S] = L[S]), R;
|
|
1871
|
+
}, P);
|
|
1872
|
+
}(m.payload, c);
|
|
1873
|
+
C({ payload: _, config: i[A].config, instance: n });
|
|
1874
|
+
var y = g + ":" + A;
|
|
1875
|
+
e.dispatch(q({}, _, { type: y, _: { called: y, from: "queueDrain" } }));
|
|
1876
|
+
}
|
|
1877
|
+
});
|
|
1878
|
+
var u = o.actions.filter(function(f, m) {
|
|
1879
|
+
return !~l.processIndex.indexOf(m);
|
|
1880
|
+
});
|
|
1881
|
+
o.actions = u;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
var ds = function(e) {
|
|
1886
|
+
var t = e.data, n = e.action, s = e.instance, r = e.state, i = e.allPlugins, o = e.allMatches, c = e.store, l = e.EVENTS;
|
|
1887
|
+
try {
|
|
1888
|
+
var u = r.plugins, f = r.context, m = n.type, A = m.match(Et), g = t.exact.map(function(y) {
|
|
1889
|
+
return y.pluginName;
|
|
1890
|
+
});
|
|
1891
|
+
A && (g = o.during.map(function(y) {
|
|
1892
|
+
return y.pluginName;
|
|
1893
|
+
}));
|
|
1894
|
+
var C = function(y, P) {
|
|
1895
|
+
return function(L, R, S) {
|
|
1896
|
+
var E = R.config, F = R.name, T = F + "." + L.type;
|
|
1897
|
+
S && (T = S.event);
|
|
1898
|
+
var D = L.type.match(Et) ? function(p, v, j, b, B) {
|
|
1899
|
+
return function(O, w) {
|
|
1900
|
+
var V = b ? b.name : p, $ = w && un(w) ? w : j;
|
|
1901
|
+
if (b && (!($ = w && un(w) ? w : [p]).includes(p) || $.length !== 1))
|
|
1902
|
+
throw new Error("Method " + v + " can only abort " + p + " plugin. " + JSON.stringify($) + " input valid");
|
|
1903
|
+
return q({}, B, { abort: { reason: O, plugins: $, caller: v, _: V } });
|
|
1904
|
+
};
|
|
1905
|
+
}(F, T, P, S, L) : function(p, v) {
|
|
1906
|
+
return function() {
|
|
1907
|
+
throw new Error(p.type + " action not cancellable. Remove abort in " + v);
|
|
1908
|
+
};
|
|
1909
|
+
}(L, T);
|
|
1910
|
+
return { payload: bu(L), instance: y, config: E || {}, abort: D };
|
|
1911
|
+
};
|
|
1912
|
+
}(s, g), _ = t.exact.reduce(function(y, P) {
|
|
1913
|
+
var L = P.pluginName, R = P.methodName, S = !1;
|
|
1914
|
+
return R.match(/^initialize/) || R.match(/^reset/) || (S = !u[L].loaded), f.offline && R.match(/^(page|track|identify)/) && (S = !0), y["" + L] = S, y;
|
|
1915
|
+
}, {});
|
|
1916
|
+
return Promise.resolve(t.exact.reduce(function(y, P, L) {
|
|
1917
|
+
try {
|
|
1918
|
+
var R = P.pluginName;
|
|
1919
|
+
return Promise.resolve(y).then(function(S) {
|
|
1920
|
+
function E() {
|
|
1921
|
+
return Promise.resolve(S);
|
|
1922
|
+
}
|
|
1923
|
+
var F = function() {
|
|
1924
|
+
if (t.namespaced && t.namespaced[R])
|
|
1925
|
+
return Promise.resolve(t.namespaced[R].reduce(function(T, D, p) {
|
|
1926
|
+
try {
|
|
1927
|
+
return Promise.resolve(T).then(function(v) {
|
|
1928
|
+
return D.method && Re(D.method) ? (function(O, w) {
|
|
1929
|
+
var V = Dr(O);
|
|
1930
|
+
if (V && V.name === w) {
|
|
1931
|
+
var $ = Dr(V.method);
|
|
1932
|
+
throw new Error([w + " plugin is calling method " + O, "Plugins cant call self", "Use " + V.method + " " + ($ ? "or " + $.method : "") + " in " + w + " plugin insteadof " + O].join(`
|
|
1933
|
+
`));
|
|
1934
|
+
}
|
|
1935
|
+
}(D.methodName, D.pluginName), Promise.resolve(D.method({ payload: v, instance: s, abort: (j = v, b = R, B = D.pluginName, function(O, w) {
|
|
1936
|
+
return q({}, j, { abort: { reason: O, plugins: w || [b], caller: m, from: B || b } });
|
|
1937
|
+
}), config: jr(D.pluginName, u, i), plugins: u })).then(function(O) {
|
|
1938
|
+
var w = me(O) ? O : {};
|
|
1939
|
+
return Promise.resolve(q({}, v, w));
|
|
1940
|
+
})) : v;
|
|
1941
|
+
var j, b, B;
|
|
1942
|
+
});
|
|
1943
|
+
} catch (v) {
|
|
1944
|
+
return Promise.reject(v);
|
|
1945
|
+
}
|
|
1946
|
+
}, Promise.resolve(n))).then(function(T) {
|
|
1947
|
+
S[R] = T;
|
|
1948
|
+
});
|
|
1949
|
+
S[R] = n;
|
|
1950
|
+
}();
|
|
1951
|
+
return F && F.then ? F.then(E) : E();
|
|
1952
|
+
});
|
|
1953
|
+
} catch (S) {
|
|
1954
|
+
return Promise.reject(S);
|
|
1955
|
+
}
|
|
1956
|
+
}, Promise.resolve({}))).then(function(y) {
|
|
1957
|
+
return Promise.resolve(t.exact.reduce(function(P, L, R) {
|
|
1958
|
+
try {
|
|
1959
|
+
var S = t.exact.length === R + 1, E = L.pluginName, F = i[E];
|
|
1960
|
+
return Promise.resolve(P).then(function(T) {
|
|
1961
|
+
var D = y[E] ? y[E] : {};
|
|
1962
|
+
if (A && (D = T), hs(D, E))
|
|
1963
|
+
return fs({ data: D, method: m, instance: s, pluginName: E, store: c }), Promise.resolve(T);
|
|
1964
|
+
if (hs(T, E))
|
|
1965
|
+
return S && fs({ data: T, method: m, instance: s, store: c }), Promise.resolve(T);
|
|
1966
|
+
if (_.hasOwnProperty(E) && _[E] === !0)
|
|
1967
|
+
return c.dispatch({ type: "queue", plugin: E, payload: D, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(T);
|
|
1968
|
+
var p = C(y[E], i[E]);
|
|
1969
|
+
return Promise.resolve(F[m]({ abort: p.abort, payload: D, instance: s, config: jr(E, u, i), plugins: u })).then(function(v) {
|
|
1970
|
+
var j = me(v) ? v : {}, b = q({}, T, j), B = y[E];
|
|
1971
|
+
if (hs(B, E))
|
|
1972
|
+
fs({ data: B, method: m, instance: s, pluginName: E, store: c });
|
|
1973
|
+
else {
|
|
1974
|
+
var O = m + ":" + E;
|
|
1975
|
+
(O.match(/:/g) || []).length < 2 && !m.match(Cr) && !m.match(_r) && s.dispatch(q({}, A ? b : D, { type: O, _: { called: O, from: "submethod" } }));
|
|
1976
|
+
}
|
|
1977
|
+
return Promise.resolve(b);
|
|
1978
|
+
});
|
|
1979
|
+
});
|
|
1980
|
+
} catch (T) {
|
|
1981
|
+
return Promise.reject(T);
|
|
1982
|
+
}
|
|
1983
|
+
}, Promise.resolve(n))).then(function(P) {
|
|
1984
|
+
if (!(m.match(Et) || m.match(/^registerPlugin/) || m.match(_r) || m.match(Cr) || m.match(/^params/) || m.match(/^userIdChanged/))) {
|
|
1985
|
+
if (l.plugins.includes(m), P._ && P._.originalAction === m)
|
|
1986
|
+
return P;
|
|
1987
|
+
var L = q({}, P, { _: { originalAction: P.type, called: P.type, from: "engineEnd" } });
|
|
1988
|
+
Xi(P, t.exact.length) && !m.match(/End$/) && (L = q({}, L, { type: P.type + "Aborted" })), c.dispatch(L);
|
|
1989
|
+
}
|
|
1990
|
+
return P;
|
|
1991
|
+
});
|
|
1992
|
+
});
|
|
1993
|
+
} catch (y) {
|
|
1994
|
+
return Promise.reject(y);
|
|
1995
|
+
}
|
|
1996
|
+
}, Et = /Start$/, Cr = /^bootstrap/, _r = /^ready/;
|
|
1997
|
+
function fs(e) {
|
|
1998
|
+
var t = e.pluginName, n = e.method + "Aborted" + (t ? ":" + t : "");
|
|
1999
|
+
e.store.dispatch(q({}, e.data, { type: n, _: { called: n, from: "abort" } }));
|
|
2000
|
+
}
|
|
2001
|
+
function jr(e, t, n) {
|
|
2002
|
+
var s = t[e] || n[e];
|
|
2003
|
+
return s && s.config ? s.config : {};
|
|
2004
|
+
}
|
|
2005
|
+
function Ir(e, t) {
|
|
2006
|
+
return t.reduce(function(n, s) {
|
|
2007
|
+
return s[e] ? n.concat({ methodName: e, pluginName: s.name, method: s[e] }) : n;
|
|
2008
|
+
}, []);
|
|
2009
|
+
}
|
|
2010
|
+
function Br(e, t) {
|
|
2011
|
+
var n = e.replace(Et, ""), s = t ? ":" + t : "";
|
|
2012
|
+
return ["" + e + s, "" + n + s, n + "End" + s];
|
|
2013
|
+
}
|
|
2014
|
+
function hs(e, t) {
|
|
2015
|
+
var n = e.abort;
|
|
2016
|
+
return !!n && (n === !0 || Rr(n, t) || n && Rr(n.plugins, t));
|
|
2017
|
+
}
|
|
2018
|
+
function Xi(e, t) {
|
|
2019
|
+
var n = e.abort;
|
|
2020
|
+
if (!n)
|
|
2021
|
+
return !1;
|
|
2022
|
+
if (n === !0 || kt(n))
|
|
2023
|
+
return !0;
|
|
2024
|
+
var s = n.plugins;
|
|
2025
|
+
return un(n) && n.length === t || un(s) && s.length === t;
|
|
2026
|
+
}
|
|
2027
|
+
function un(e) {
|
|
2028
|
+
return Array.isArray(e);
|
|
2029
|
+
}
|
|
2030
|
+
function Rr(e, t) {
|
|
2031
|
+
return !(!e || !un(e)) && e.includes(t);
|
|
2032
|
+
}
|
|
2033
|
+
function Dr(e) {
|
|
2034
|
+
var t = e.match(/(.*):(.*)/);
|
|
2035
|
+
return !!t && { method: t[1], name: t[2] };
|
|
2036
|
+
}
|
|
2037
|
+
function bu(e) {
|
|
2038
|
+
return Object.keys(e).reduce(function(t, n) {
|
|
2039
|
+
return n === "type" || (t[n] = me(e[n]) ? Object.assign({}, e[n]) : e[n]), t;
|
|
2040
|
+
}, {});
|
|
2041
|
+
}
|
|
2042
|
+
function wu(e, t, n) {
|
|
2043
|
+
var s = {};
|
|
2044
|
+
return function(r) {
|
|
2045
|
+
return function(i) {
|
|
2046
|
+
return function(o) {
|
|
2047
|
+
try {
|
|
2048
|
+
var c, l = function(S) {
|
|
2049
|
+
return c ? S : i(m);
|
|
2050
|
+
}, u = o.type, f = o.plugins, m = o;
|
|
2051
|
+
if (o.abort)
|
|
2052
|
+
return Promise.resolve(i(o));
|
|
2053
|
+
if (u === U.enablePlugin && r.dispatch({ type: U.initializeStart, plugins: f, disabled: [], fromEnable: !0, meta: o.meta }), u === U.disablePlugin && setTimeout(function() {
|
|
2054
|
+
return Or(o.meta.rid, { payload: o });
|
|
2055
|
+
}, 0), u === U.initializeEnd) {
|
|
2056
|
+
var A = t(), g = Object.keys(A), C = g.filter(function(S) {
|
|
2057
|
+
return f.includes(S);
|
|
2058
|
+
}).map(function(S) {
|
|
2059
|
+
return A[S];
|
|
2060
|
+
}), _ = [], y = [], P = o.disabled, L = C.map(function(S) {
|
|
2061
|
+
var E = S.loaded, F = S.name, T = S.config;
|
|
2062
|
+
return Yi(S, function() {
|
|
2063
|
+
return E({ config: T });
|
|
2064
|
+
}, 1e4).then(function(D) {
|
|
2065
|
+
return s[F] || (r.dispatch({ type: U.pluginReadyType(F), name: F, events: Object.keys(S).filter(function(p) {
|
|
2066
|
+
return !Ss.includes(p);
|
|
2067
|
+
}) }), s[F] = !0), _ = _.concat(F), S;
|
|
2068
|
+
}).catch(function(D) {
|
|
2069
|
+
if (D instanceof Error)
|
|
2070
|
+
throw new Error(D);
|
|
2071
|
+
return y = y.concat(D.name), D;
|
|
2072
|
+
});
|
|
2073
|
+
});
|
|
2074
|
+
Promise.all(L).then(function(S) {
|
|
2075
|
+
var E = { plugins: _, failed: y, disabled: P };
|
|
2076
|
+
setTimeout(function() {
|
|
2077
|
+
g.length === L.length + P.length && r.dispatch(q({}, { type: U.ready }, E));
|
|
2078
|
+
}, 0);
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
var R = function() {
|
|
2082
|
+
if (u !== U.bootstrap)
|
|
2083
|
+
return /^ready:([^:]*)$/.test(u) && setTimeout(function() {
|
|
2084
|
+
return Zi(r, t, e);
|
|
2085
|
+
}, 0), Promise.resolve(function(S, E, F, T, D) {
|
|
2086
|
+
try {
|
|
2087
|
+
var p = Re(E) ? E() : E, v = S.type, j = v.replace(Et, "");
|
|
2088
|
+
if (S._ && S._.called)
|
|
2089
|
+
return Promise.resolve(S);
|
|
2090
|
+
var b = F.getState(), B = (V = p, ($ = b.plugins) === void 0 && ($ = {}), (G = S.options) === void 0 && (G = {}), Object.keys(V).filter(function(d) {
|
|
2091
|
+
var h = G.plugins || {};
|
|
2092
|
+
return nu(h[d]) ? h[d] : h.all !== !1 && (!$[d] || $[d].enabled !== !1);
|
|
2093
|
+
}).map(function(d) {
|
|
2094
|
+
return V[d];
|
|
2095
|
+
}));
|
|
2096
|
+
v === U.initializeStart && S.fromEnable && (B = Object.keys(b.plugins).filter(function(d) {
|
|
2097
|
+
var h = b.plugins[d];
|
|
2098
|
+
return S.plugins.includes(d) && !h.initialized;
|
|
2099
|
+
}).map(function(d) {
|
|
2100
|
+
return p[d];
|
|
2101
|
+
}));
|
|
2102
|
+
var O = B.map(function(d) {
|
|
2103
|
+
return d.name;
|
|
2104
|
+
}), w = function(d, h, M) {
|
|
2105
|
+
var K = Br(d).map(function(z) {
|
|
2106
|
+
return Ir(z, h);
|
|
2107
|
+
});
|
|
2108
|
+
return h.reduce(function(z, W) {
|
|
2109
|
+
var ce = W.name, J = Br(d, ce).map(function(Zt) {
|
|
2110
|
+
return Ir(Zt, h);
|
|
2111
|
+
}), se = J[0], H = J[1], Ce = J[2];
|
|
2112
|
+
return se.length && (z.beforeNS[ce] = se), H.length && (z.duringNS[ce] = H), Ce.length && (z.afterNS[ce] = Ce), z;
|
|
2113
|
+
}, { before: K[0], beforeNS: {}, during: K[1], duringNS: {}, after: K[2], afterNS: {} });
|
|
2114
|
+
}(v, B);
|
|
2115
|
+
return Promise.resolve(ds({ action: S, data: { exact: w.before, namespaced: w.beforeNS }, state: b, allPlugins: p, allMatches: w, instance: F, store: T, EVENTS: D })).then(function(d) {
|
|
2116
|
+
function h() {
|
|
2117
|
+
var z = function() {
|
|
2118
|
+
if (v.match(Et))
|
|
2119
|
+
return Promise.resolve(ds({ action: q({}, M, { type: j + "End" }), data: { exact: w.after, namespaced: w.afterNS }, state: b, allPlugins: p, allMatches: w, instance: F, store: T, EVENTS: D })).then(function(W) {
|
|
2120
|
+
W.meta && W.meta.hasCallback && Or(W.meta.rid, { payload: W });
|
|
2121
|
+
});
|
|
2122
|
+
}();
|
|
2123
|
+
return z && z.then ? z.then(function() {
|
|
2124
|
+
return d;
|
|
2125
|
+
}) : d;
|
|
2126
|
+
}
|
|
2127
|
+
if (Xi(d, O.length))
|
|
2128
|
+
return d;
|
|
2129
|
+
var M, K = function() {
|
|
2130
|
+
if (v !== j)
|
|
2131
|
+
return Promise.resolve(ds({ action: q({}, d, { type: j }), data: { exact: w.during, namespaced: w.duringNS }, state: b, allPlugins: p, allMatches: w, instance: F, store: T, EVENTS: D })).then(function(z) {
|
|
2132
|
+
M = z;
|
|
2133
|
+
});
|
|
2134
|
+
M = d;
|
|
2135
|
+
}();
|
|
2136
|
+
return K && K.then ? K.then(h) : h();
|
|
2137
|
+
});
|
|
2138
|
+
} catch (d) {
|
|
2139
|
+
return Promise.reject(d);
|
|
2140
|
+
}
|
|
2141
|
+
var V, $, G;
|
|
2142
|
+
}(o, t, e, r, n)).then(function(S) {
|
|
2143
|
+
return c = 1, i(S);
|
|
2144
|
+
});
|
|
2145
|
+
}();
|
|
2146
|
+
return Promise.resolve(R && R.then ? R.then(l) : l(R));
|
|
2147
|
+
} catch (S) {
|
|
2148
|
+
return Promise.reject(S);
|
|
2149
|
+
}
|
|
2150
|
+
};
|
|
2151
|
+
};
|
|
2152
|
+
};
|
|
2153
|
+
}
|
|
2154
|
+
function Su(e) {
|
|
2155
|
+
return function(t) {
|
|
2156
|
+
return function(n) {
|
|
2157
|
+
return function(s) {
|
|
2158
|
+
var r = s.type, i = s.key, o = s.value, c = s.options;
|
|
2159
|
+
if (r === U.setItem || r === U.removeItem) {
|
|
2160
|
+
if (s.abort)
|
|
2161
|
+
return n(s);
|
|
2162
|
+
r === U.setItem ? e.setItem(i, o, c) : e.removeItem(i, c);
|
|
2163
|
+
}
|
|
2164
|
+
return n(s);
|
|
2165
|
+
};
|
|
2166
|
+
};
|
|
2167
|
+
};
|
|
2168
|
+
}
|
|
2169
|
+
var xu = function() {
|
|
2170
|
+
var e = this;
|
|
2171
|
+
this.before = [], this.after = [], this.addMiddleware = function(t, n) {
|
|
2172
|
+
e[n] = e[n].concat(t);
|
|
2173
|
+
}, this.removeMiddleware = function(t, n) {
|
|
2174
|
+
var s = e[n].findIndex(function(r) {
|
|
2175
|
+
return r === t;
|
|
2176
|
+
});
|
|
2177
|
+
s !== -1 && (e[n] = [].concat(e[n].slice(0, s), e[n].slice(s + 1)));
|
|
2178
|
+
}, this.dynamicMiddlewares = function(t) {
|
|
2179
|
+
return function(n) {
|
|
2180
|
+
return function(s) {
|
|
2181
|
+
return function(r) {
|
|
2182
|
+
var i = { getState: n.getState, dispatch: function(c) {
|
|
2183
|
+
return n.dispatch(c);
|
|
2184
|
+
} }, o = e[t].map(function(c) {
|
|
2185
|
+
return c(i);
|
|
2186
|
+
});
|
|
2187
|
+
return Kt.apply(void 0, o)(s)(r);
|
|
2188
|
+
};
|
|
2189
|
+
};
|
|
2190
|
+
};
|
|
2191
|
+
};
|
|
2192
|
+
};
|
|
2193
|
+
function ku(e) {
|
|
2194
|
+
return function(t, n) {
|
|
2195
|
+
t === void 0 && (t = {});
|
|
2196
|
+
var s = {};
|
|
2197
|
+
if (n.type === "initialize:aborted")
|
|
2198
|
+
return t;
|
|
2199
|
+
if (/^registerPlugin:([^:]*)$/.test(n.type)) {
|
|
2200
|
+
var r = Mr(n.type, "registerPlugin"), i = e()[r];
|
|
2201
|
+
if (!i || !r)
|
|
2202
|
+
return t;
|
|
2203
|
+
var o = n.enabled, c = i.config;
|
|
2204
|
+
return s[r] = { enabled: o, initialized: !!o && !i.initialize, loaded: !!o && !!i.loaded({ config: c }), config: c }, q({}, t, s);
|
|
2205
|
+
}
|
|
2206
|
+
if (/^initialize:([^:]*)$/.test(n.type)) {
|
|
2207
|
+
var l = Mr(n.type, U.initialize), u = e()[l];
|
|
2208
|
+
return u && l ? (s[l] = q({}, t[l], { initialized: !0, loaded: !!u.loaded({ config: u.config }) }), q({}, t, s)) : t;
|
|
2209
|
+
}
|
|
2210
|
+
if (/^ready:([^:]*)$/.test(n.type))
|
|
2211
|
+
return s[n.name] = q({}, t[n.name], { loaded: !0 }), q({}, t, s);
|
|
2212
|
+
switch (n.type) {
|
|
2213
|
+
case U.disablePlugin:
|
|
2214
|
+
return q({}, t, Lr(n.plugins, !1, t));
|
|
2215
|
+
case U.enablePlugin:
|
|
2216
|
+
return q({}, t, Lr(n.plugins, !0, t));
|
|
2217
|
+
default:
|
|
2218
|
+
return t;
|
|
2219
|
+
}
|
|
2220
|
+
};
|
|
2221
|
+
}
|
|
2222
|
+
function Mr(e, t) {
|
|
2223
|
+
return e.substring(t.length + 1, e.length);
|
|
2224
|
+
}
|
|
2225
|
+
function Lr(e, t, n) {
|
|
2226
|
+
return e.reduce(function(s, r) {
|
|
2227
|
+
return s[r] = q({}, n[r], { enabled: t }), s;
|
|
2228
|
+
}, n);
|
|
2229
|
+
}
|
|
2230
|
+
function eo(e) {
|
|
2231
|
+
try {
|
|
2232
|
+
return JSON.parse(JSON.stringify(e));
|
|
2233
|
+
} catch {
|
|
2234
|
+
}
|
|
2235
|
+
return e;
|
|
2236
|
+
}
|
|
2237
|
+
var Au = { last: {}, history: [] };
|
|
2238
|
+
function Eu(e, t) {
|
|
2239
|
+
e === void 0 && (e = Au);
|
|
2240
|
+
var n = t.options, s = t.meta;
|
|
2241
|
+
if (t.type === U.track) {
|
|
2242
|
+
var r = eo(q({ event: t.event, properties: t.properties }, Object.keys(n).length && { options: n }, { meta: s }));
|
|
2243
|
+
return q({}, e, { last: r, history: e.history.concat(r) });
|
|
2244
|
+
}
|
|
2245
|
+
return e;
|
|
2246
|
+
}
|
|
2247
|
+
var Pu = { actions: [] };
|
|
2248
|
+
function Ou(e, t) {
|
|
2249
|
+
e === void 0 && (e = Pu);
|
|
2250
|
+
var n = t.payload;
|
|
2251
|
+
switch (t.type) {
|
|
2252
|
+
case "queue":
|
|
2253
|
+
var s;
|
|
2254
|
+
return s = n && n.type && n.type === U.identify ? [t].concat(e.actions) : e.actions.concat(t), q({}, e, { actions: s });
|
|
2255
|
+
case "dequeue":
|
|
2256
|
+
return [];
|
|
2257
|
+
default:
|
|
2258
|
+
return e;
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
var to = /#.*$/;
|
|
2262
|
+
function Cu(e) {
|
|
2263
|
+
var t = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);
|
|
2264
|
+
return "/" + (t && t[3] ? t[3].split("?")[0].replace(to, "") : "");
|
|
2265
|
+
}
|
|
2266
|
+
var no, so, ro, io, _u = function(e) {
|
|
2267
|
+
if (e === void 0 && (e = {}), !Oe)
|
|
2268
|
+
return e;
|
|
2269
|
+
var t = document, n = t.title, s = t.referrer, r = window, i = r.location, o = r.innerWidth, c = r.innerHeight, l = i.hash, u = i.search, f = function(A) {
|
|
2270
|
+
var g = function() {
|
|
2271
|
+
if (Oe) {
|
|
2272
|
+
for (var C, _ = document.getElementsByTagName("link"), y = 0; C = _[y]; y++)
|
|
2273
|
+
if (C.getAttribute("rel") === "canonical")
|
|
2274
|
+
return C.getAttribute("href");
|
|
2275
|
+
}
|
|
2276
|
+
}();
|
|
2277
|
+
return g ? g.match(/\?/) ? g : g + A : window.location.href.replace(to, "");
|
|
2278
|
+
}(u), m = { title: n, url: f, path: Cu(f), hash: l, search: u, width: o, height: c };
|
|
2279
|
+
return s && s !== "" && (m.referrer = s), q({}, m, e);
|
|
2280
|
+
}, ju = { last: {}, history: [] };
|
|
2281
|
+
function Iu(e, t) {
|
|
2282
|
+
e === void 0 && (e = ju);
|
|
2283
|
+
var n = t.options;
|
|
2284
|
+
if (t.type === U.page) {
|
|
2285
|
+
var s = eo(q({ properties: t.properties, meta: t.meta }, Object.keys(n).length && { options: n }));
|
|
2286
|
+
return q({}, e, { last: s, history: e.history.concat(s) });
|
|
2287
|
+
}
|
|
2288
|
+
return e;
|
|
2289
|
+
}
|
|
2290
|
+
no = function() {
|
|
2291
|
+
if (!Oe)
|
|
2292
|
+
return !1;
|
|
2293
|
+
var e = navigator.appVersion;
|
|
2294
|
+
return ~e.indexOf("Win") ? "Windows" : ~e.indexOf("Mac") ? "MacOS" : ~e.indexOf("X11") ? "UNIX" : ~e.indexOf("Linux") ? "Linux" : "Unknown OS";
|
|
2295
|
+
}(), so = Oe ? document.referrer : null, ro = uu(), io = lu();
|
|
2296
|
+
var Nr = { initialized: !1, sessionId: ts(), app: null, version: null, debug: !1, offline: !!Oe && !navigator.onLine, os: { name: no }, userAgent: Oe ? navigator.userAgent : "node", library: { name: "analytics", version: "0.12.5" }, timezone: io, locale: ro, campaign: {}, referrer: so };
|
|
2297
|
+
function Bu(e, t) {
|
|
2298
|
+
e === void 0 && (e = Nr);
|
|
2299
|
+
var n = e.initialized, s = t.campaign;
|
|
2300
|
+
switch (t.type) {
|
|
2301
|
+
case U.campaign:
|
|
2302
|
+
return q({}, e, { campaign: s });
|
|
2303
|
+
case U.offline:
|
|
2304
|
+
return q({}, e, { offline: !0 });
|
|
2305
|
+
case U.online:
|
|
2306
|
+
return q({}, e, { offline: !1 });
|
|
2307
|
+
default:
|
|
2308
|
+
return n ? e : q({}, Nr, e, { initialized: !0 });
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
var Ru = ["plugins", "reducers", "storage"];
|
|
2312
|
+
function Du(e, t, n) {
|
|
2313
|
+
if (Oe) {
|
|
2314
|
+
var s = window[(n ? "add" : "remove") + "EventListener"];
|
|
2315
|
+
e.split(" ").forEach(function(r) {
|
|
2316
|
+
s(r, t);
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
function Mu(e) {
|
|
2321
|
+
var t = Du.bind(null, "online offline", function(n) {
|
|
2322
|
+
return Promise.resolve(!navigator.onLine).then(e);
|
|
2323
|
+
});
|
|
2324
|
+
return t(!0), function(n) {
|
|
2325
|
+
return t(!1);
|
|
2326
|
+
};
|
|
2327
|
+
}
|
|
2328
|
+
function oo() {
|
|
2329
|
+
return yt("analytics", []), function(e) {
|
|
2330
|
+
return function(t, n, s) {
|
|
2331
|
+
var r = e(t, n, s), i = r.dispatch;
|
|
2332
|
+
return Object.assign(r, { dispatch: function(o) {
|
|
2333
|
+
return Vt[Qt].analytics.push(o.action || o), i(o);
|
|
2334
|
+
} });
|
|
2335
|
+
};
|
|
2336
|
+
};
|
|
2337
|
+
}
|
|
2338
|
+
function Tr(e) {
|
|
2339
|
+
return function() {
|
|
2340
|
+
return Kt(Kt.apply(null, arguments), oo());
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2343
|
+
function ps(e) {
|
|
2344
|
+
return e ? ru(e) ? e : [e] : [];
|
|
2345
|
+
}
|
|
2346
|
+
function Fr(e, t, n) {
|
|
2347
|
+
e === void 0 && (e = {});
|
|
2348
|
+
var s, r, i = ts();
|
|
2349
|
+
return t && (tn[i] = (s = t, r = function(o) {
|
|
2350
|
+
for (var c, l = o || Array.prototype.slice.call(arguments), u = 0; u < l.length; u++)
|
|
2351
|
+
if (Re(l[u])) {
|
|
2352
|
+
c = l[u];
|
|
2353
|
+
break;
|
|
2354
|
+
}
|
|
2355
|
+
return c;
|
|
2356
|
+
}(n), function(o) {
|
|
2357
|
+
r && r(o), s(o);
|
|
2358
|
+
})), q({}, e, { rid: i, ts: (/* @__PURE__ */ new Date()).getTime() }, t ? { hasCallback: !0 } : {});
|
|
2359
|
+
}
|
|
2360
|
+
function Lu(e) {
|
|
2361
|
+
e === void 0 && (e = {});
|
|
2362
|
+
var t = e.reducers || {}, n = e.initialUser || {}, s = (e.plugins || []).reduce(function(d, h) {
|
|
2363
|
+
if (Re(h))
|
|
2364
|
+
return d.middlewares = d.middlewares.concat(h), d;
|
|
2365
|
+
if (h.NAMESPACE && (h.name = h.NAMESPACE), !h.name)
|
|
2366
|
+
throw new Error("https://lytics.dev/errors/1");
|
|
2367
|
+
h.config || (h.config = {});
|
|
2368
|
+
var M = h.EVENTS ? Object.keys(h.EVENTS).map(function(W) {
|
|
2369
|
+
return h.EVENTS[W];
|
|
2370
|
+
}) : [];
|
|
2371
|
+
d.pluginEnabled[h.name] = !(h.enabled === !1 || h.config.enabled === !1), delete h.enabled, h.methods && (d.methods[h.name] = Object.keys(h.methods).reduce(function(W, ce) {
|
|
2372
|
+
var J;
|
|
2373
|
+
return W[ce] = (J = h.methods[ce], function() {
|
|
2374
|
+
for (var se = Array.prototype.slice.call(arguments), H = new Array(J.length), Ce = 0; Ce < se.length; Ce++)
|
|
2375
|
+
H[Ce] = se[Ce];
|
|
2376
|
+
return H[H.length] = E, J.apply({ instance: E }, H);
|
|
2377
|
+
}), W;
|
|
2378
|
+
}, {}), delete h.methods);
|
|
2379
|
+
var K = Object.keys(h).concat(M), z = new Set(d.events.concat(K));
|
|
2380
|
+
if (d.events = Array.from(z), d.pluginsArray = d.pluginsArray.concat(h), d.plugins[h.name])
|
|
2381
|
+
throw new Error(h.name + "AlreadyLoaded");
|
|
2382
|
+
return d.plugins[h.name] = h, d.plugins[h.name].loaded || (d.plugins[h.name].loaded = function() {
|
|
2383
|
+
return !0;
|
|
2384
|
+
}), d;
|
|
2385
|
+
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), r = e.storage ? e.storage : { getItem: gt, setItem: yt, removeItem: Wt }, i = function(d) {
|
|
2386
|
+
return function(h, M, K) {
|
|
2387
|
+
return M.getState("user")[h] || (K && me(K) && K[h] ? K[h] : Pr(d)[h] || gt(xs(h)) || null);
|
|
2388
|
+
};
|
|
2389
|
+
}(r), o = s.plugins, c = s.events.filter(function(d) {
|
|
2390
|
+
return !Ss.includes(d);
|
|
2391
|
+
}).sort(), l = new Set(c.concat(Nn).filter(function(d) {
|
|
2392
|
+
return !Ss.includes(d);
|
|
2393
|
+
})), u = Array.from(l).sort(), f = function() {
|
|
2394
|
+
return o;
|
|
2395
|
+
}, m = new xu(), A = m.addMiddleware, g = m.removeMiddleware, C = m.dynamicMiddlewares, _ = function() {
|
|
2396
|
+
throw new Error("Abort disabled inListener");
|
|
2397
|
+
}, y = du(), P = Pr(r), L = q({}, P, n, y.an_uid ? { userId: y.an_uid } : {}, y.an_aid ? { anonymousId: y.an_aid } : {});
|
|
2398
|
+
L.anonymousId || (L.anonymousId = ts());
|
|
2399
|
+
var R = q({ enable: function(d, h) {
|
|
2400
|
+
return new Promise(function(M) {
|
|
2401
|
+
w.dispatch({ type: U.enablePlugin, plugins: ps(d), _: { originalAction: U.enablePlugin } }, M, [h]);
|
|
2402
|
+
});
|
|
2403
|
+
}, disable: function(d, h) {
|
|
2404
|
+
return new Promise(function(M) {
|
|
2405
|
+
w.dispatch({ type: U.disablePlugin, plugins: ps(d), _: { originalAction: U.disablePlugin } }, M, [h]);
|
|
2406
|
+
});
|
|
2407
|
+
} }, s.methods), S = !1, E = { identify: function(d, h, M, K) {
|
|
2408
|
+
try {
|
|
2409
|
+
var z = kt(d) ? d : null, W = me(d) ? d : h, ce = M || {}, J = E.user();
|
|
2410
|
+
yt(xs(qe), z);
|
|
2411
|
+
var se = z || W.userId || i(qe, E, W);
|
|
2412
|
+
return Promise.resolve(new Promise(function(H) {
|
|
2413
|
+
w.dispatch(q({ type: U.identifyStart, userId: se, traits: W || {}, options: ce, anonymousId: J.anonymousId }, J.id && J.id !== z && { previousId: J.id }), H, [h, M, K]);
|
|
2414
|
+
}));
|
|
2415
|
+
} catch (H) {
|
|
2416
|
+
return Promise.reject(H);
|
|
2417
|
+
}
|
|
2418
|
+
}, track: function(d, h, M, K) {
|
|
2419
|
+
try {
|
|
2420
|
+
var z = me(d) ? d.event : d;
|
|
2421
|
+
if (!z || !kt(z))
|
|
2422
|
+
throw new Error("EventMissing");
|
|
2423
|
+
var W = me(d) ? d : h || {}, ce = me(M) ? M : {};
|
|
2424
|
+
return Promise.resolve(new Promise(function(J) {
|
|
2425
|
+
w.dispatch({ type: U.trackStart, event: z, properties: W, options: ce, userId: i(qe, E, h), anonymousId: i(xt, E, h) }, J, [h, M, K]);
|
|
2426
|
+
}));
|
|
2427
|
+
} catch (J) {
|
|
2428
|
+
return Promise.reject(J);
|
|
2429
|
+
}
|
|
2430
|
+
}, page: function(d, h, M) {
|
|
2431
|
+
try {
|
|
2432
|
+
var K = me(d) ? d : {}, z = me(h) ? h : {};
|
|
2433
|
+
return Promise.resolve(new Promise(function(W) {
|
|
2434
|
+
w.dispatch({ type: U.pageStart, properties: _u(K), options: z, userId: i(qe, E, K), anonymousId: i(xt, E, K) }, W, [d, h, M]);
|
|
2435
|
+
}));
|
|
2436
|
+
} catch (W) {
|
|
2437
|
+
return Promise.reject(W);
|
|
2438
|
+
}
|
|
2439
|
+
}, user: function(d) {
|
|
2440
|
+
if (d === qe || d === "id")
|
|
2441
|
+
return i(qe, E);
|
|
2442
|
+
if (d === xt || d === "anonId")
|
|
2443
|
+
return i(xt, E);
|
|
2444
|
+
var h = E.getState("user");
|
|
2445
|
+
return d ? br(h, d) : h;
|
|
2446
|
+
}, reset: function(d) {
|
|
2447
|
+
return new Promise(function(h) {
|
|
2448
|
+
w.dispatch({ type: U.resetStart }, h, d);
|
|
2449
|
+
});
|
|
2450
|
+
}, ready: function(d) {
|
|
2451
|
+
return S && d({ plugins: R, instance: E }), E.on(U.ready, function(h) {
|
|
2452
|
+
d(h), S = !0;
|
|
2453
|
+
});
|
|
2454
|
+
}, on: function(d, h) {
|
|
2455
|
+
if (!d || !Re(h))
|
|
2456
|
+
return !1;
|
|
2457
|
+
if (d === U.bootstrap)
|
|
2458
|
+
throw new Error(".on disabled for " + d);
|
|
2459
|
+
var M = /Start$|Start:/;
|
|
2460
|
+
if (d === "*") {
|
|
2461
|
+
var K = function(J) {
|
|
2462
|
+
return function(se) {
|
|
2463
|
+
return function(H) {
|
|
2464
|
+
return H.type.match(M) && h({ payload: H, instance: E, plugins: o }), se(H);
|
|
2465
|
+
};
|
|
2466
|
+
};
|
|
2467
|
+
}, z = function(J) {
|
|
2468
|
+
return function(se) {
|
|
2469
|
+
return function(H) {
|
|
2470
|
+
return H.type.match(M) || h({ payload: H, instance: E, plugins: o }), se(H);
|
|
2471
|
+
};
|
|
2472
|
+
};
|
|
2473
|
+
};
|
|
2474
|
+
return A(K, Rn), A(z, Dn), function() {
|
|
2475
|
+
g(K, Rn), g(z, Dn);
|
|
2476
|
+
};
|
|
2477
|
+
}
|
|
2478
|
+
var W = d.match(M) ? Rn : Dn, ce = function(J) {
|
|
2479
|
+
return function(se) {
|
|
2480
|
+
return function(H) {
|
|
2481
|
+
return H.type === d && h({ payload: H, instance: E, plugins: o, abort: _ }), se(H);
|
|
2482
|
+
};
|
|
2483
|
+
};
|
|
2484
|
+
};
|
|
2485
|
+
return A(ce, W), function() {
|
|
2486
|
+
return g(ce, W);
|
|
2487
|
+
};
|
|
2488
|
+
}, once: function(d, h) {
|
|
2489
|
+
if (!d || !Re(h))
|
|
2490
|
+
return !1;
|
|
2491
|
+
if (d === U.bootstrap)
|
|
2492
|
+
throw new Error(".once disabled for " + d);
|
|
2493
|
+
var M = E.on(d, function(K) {
|
|
2494
|
+
h({ payload: K.payload, instance: E, plugins: o, abort: _ }), M();
|
|
2495
|
+
});
|
|
2496
|
+
return M;
|
|
2497
|
+
}, getState: function(d) {
|
|
2498
|
+
var h = w.getState();
|
|
2499
|
+
return d ? br(h, d) : Object.assign({}, h);
|
|
2500
|
+
}, dispatch: function(d) {
|
|
2501
|
+
var h = kt(d) ? { type: d } : d;
|
|
2502
|
+
if (Nn.includes(h.type))
|
|
2503
|
+
throw new Error("reserved action " + h.type);
|
|
2504
|
+
var M = q({}, h, { _: q({ originalAction: h.type }, d._ || {}) });
|
|
2505
|
+
w.dispatch(M);
|
|
2506
|
+
}, enablePlugin: R.enable, disablePlugin: R.disable, plugins: R, storage: { getItem: r.getItem, setItem: function(d, h, M) {
|
|
2507
|
+
w.dispatch({ type: U.setItemStart, key: d, value: h, options: M });
|
|
2508
|
+
}, removeItem: function(d, h) {
|
|
2509
|
+
w.dispatch({ type: U.removeItemStart, key: d, options: h });
|
|
2510
|
+
} }, setAnonymousId: function(d, h) {
|
|
2511
|
+
E.storage.setItem(et, d, h);
|
|
2512
|
+
}, events: { core: Nn, plugins: c } }, F = s.middlewares.concat([function(d) {
|
|
2513
|
+
return function(h) {
|
|
2514
|
+
return function(M) {
|
|
2515
|
+
return M.meta || (M.meta = Fr()), h(M);
|
|
2516
|
+
};
|
|
2517
|
+
};
|
|
2518
|
+
}, C(Rn), wu(E, f, { all: u, plugins: c }), Su(r), gu(E), vu(E), C(Dn)]), T = { context: Bu, user: yu(r), page: Iu, track: Eu, plugins: ku(f), queue: Ou }, D = Kt, p = Kt;
|
|
2519
|
+
if (Oe && e.debug) {
|
|
2520
|
+
var v = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
2521
|
+
v && (D = v({ trace: !0, traceLimit: 25 })), p = function() {
|
|
2522
|
+
return arguments.length === 0 ? oo() : me(typeof arguments[0]) ? Tr() : Tr().apply(null, arguments);
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
var j, b = function(d) {
|
|
2526
|
+
return Object.keys(d).reduce(function(h, M) {
|
|
2527
|
+
return Ru.includes(M) || (h[M] = d[M]), h;
|
|
2528
|
+
}, {});
|
|
2529
|
+
}(e), B = s.pluginsArray.reduce(function(d, h) {
|
|
2530
|
+
var M = h.name, K = h.config, z = h.loaded, W = s.pluginEnabled[M];
|
|
2531
|
+
return d[M] = { enabled: W, initialized: !!W && !h.initialize, loaded: !!z({ config: K }), config: K }, d;
|
|
2532
|
+
}, {}), O = { context: b, user: L, plugins: B }, w = Ji(function(d) {
|
|
2533
|
+
for (var h = Object.keys(d), M = {}, K = 0; K < h.length; K++) {
|
|
2534
|
+
var z = h[K];
|
|
2535
|
+
typeof d[z] === Qe && (M[z] = d[z]);
|
|
2536
|
+
}
|
|
2537
|
+
var W, ce = Object.keys(M);
|
|
2538
|
+
try {
|
|
2539
|
+
(function(J) {
|
|
2540
|
+
Object.keys(J).forEach(function(se) {
|
|
2541
|
+
var H = J[se];
|
|
2542
|
+
if (typeof H(void 0, { type: "@@redux/INIT" }) === Ne || typeof H(void 0, { type: hu }) === Ne)
|
|
2543
|
+
throw new Error("reducer " + se + " " + Ne);
|
|
2544
|
+
});
|
|
2545
|
+
})(M);
|
|
2546
|
+
} catch (J) {
|
|
2547
|
+
W = J;
|
|
2548
|
+
}
|
|
2549
|
+
return function(J, se) {
|
|
2550
|
+
if (J === void 0 && (J = {}), W)
|
|
2551
|
+
throw W;
|
|
2552
|
+
for (var H = !1, Ce = {}, Zt = 0; Zt < ce.length; Zt++) {
|
|
2553
|
+
var Pn = ce[Zt], tr = J[Pn], as = (0, M[Pn])(tr, se);
|
|
2554
|
+
if (typeof as === Ne) {
|
|
2555
|
+
var Ao = pu(Pn, se);
|
|
2556
|
+
throw new Error(Ao);
|
|
2557
|
+
}
|
|
2558
|
+
Ce[Pn] = as, H = H || as !== tr;
|
|
2559
|
+
}
|
|
2560
|
+
return H ? Ce : J;
|
|
2561
|
+
};
|
|
2562
|
+
}(q({}, T, t)), O, p(D(mu.apply(void 0, F))));
|
|
2563
|
+
w.dispatch = (j = w.dispatch, function(d, h, M) {
|
|
2564
|
+
var K = q({}, d, { meta: Fr(d.meta, h, ps(M)) });
|
|
2565
|
+
return j.apply(null, [K]);
|
|
2566
|
+
});
|
|
2567
|
+
var V = Object.keys(o);
|
|
2568
|
+
w.dispatch({ type: U.bootstrap, plugins: V, config: b, params: y, user: L, initialUser: n, persistedUser: P });
|
|
2569
|
+
var $ = V.filter(function(d) {
|
|
2570
|
+
return s.pluginEnabled[d];
|
|
2571
|
+
}), G = V.filter(function(d) {
|
|
2572
|
+
return !s.pluginEnabled[d];
|
|
2573
|
+
});
|
|
2574
|
+
return w.dispatch({ type: U.registerPlugins, plugins: V, enabled: s.pluginEnabled }), s.pluginsArray.map(function(d, h) {
|
|
2575
|
+
var M = d.bootstrap, K = d.config, z = d.name;
|
|
2576
|
+
M && Re(M) && M({ instance: E, config: K, payload: d }), w.dispatch({ type: U.registerPluginType(z), name: z, enabled: s.pluginEnabled[z], plugin: d }), s.pluginsArray.length === h + 1 && w.dispatch({ type: U.initializeStart, plugins: $, disabled: G });
|
|
2577
|
+
}), Mu(function(d) {
|
|
2578
|
+
w.dispatch({ type: d ? U.offline : U.online });
|
|
2579
|
+
}), function(d, h, M) {
|
|
2580
|
+
setInterval(function() {
|
|
2581
|
+
return Zi(d, h, M);
|
|
2582
|
+
}, 3e3);
|
|
2583
|
+
}(w, f, E), E;
|
|
2584
|
+
}
|
|
2585
|
+
var Rn = "before", Dn = "after", rn = "cookie", nt = uo(), ao = ns, Nu = ns;
|
|
2586
|
+
function co(e) {
|
|
2587
|
+
return nt ? ns(e, "", -1) : Wt(e);
|
|
2588
|
+
}
|
|
2589
|
+
function uo() {
|
|
2590
|
+
if (nt !== void 0)
|
|
2591
|
+
return nt;
|
|
2592
|
+
var e = "cookiecookie";
|
|
2593
|
+
try {
|
|
2594
|
+
ns(e, e), nt = document.cookie.indexOf(e) !== -1, co(e);
|
|
2595
|
+
} catch {
|
|
2596
|
+
nt = !1;
|
|
2597
|
+
}
|
|
2598
|
+
return nt;
|
|
2599
|
+
}
|
|
2600
|
+
function ns(e, t, n, s, r, i) {
|
|
2601
|
+
if (typeof window < "u") {
|
|
2602
|
+
var o = arguments.length > 1;
|
|
2603
|
+
return nt === !1 && (o ? yt(e, t) : gt(e)), o ? document.cookie = e + "=" + encodeURIComponent(t) + (n ? "; expires=" + new Date(+/* @__PURE__ */ new Date() + 1e3 * n).toUTCString() + (s ? "; path=" + s : "") + (r ? "; domain=" + r : "") + (i ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + e + "=")[1] || "").split(";")[0]);
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
var on = "localStorage", Tu = zs.bind(null, "localStorage");
|
|
2607
|
+
Ht("localStorage", "getItem", gt);
|
|
2608
|
+
Ht("localStorage", "setItem", yt);
|
|
2609
|
+
Ht("localStorage", "removeItem", Wt);
|
|
2610
|
+
var an = "sessionStorage", Fu = zs.bind(null, "sessionStorage");
|
|
2611
|
+
Ht("sessionStorage", "getItem", gt);
|
|
2612
|
+
Ht("sessionStorage", "setItem", yt);
|
|
2613
|
+
Ht("sessionStorage", "removeItem", Wt);
|
|
2614
|
+
function Pt(e) {
|
|
2615
|
+
var t = e;
|
|
2616
|
+
try {
|
|
2617
|
+
if ((t = JSON.parse(e)) === "true")
|
|
2618
|
+
return !0;
|
|
2619
|
+
if (t === "false")
|
|
2620
|
+
return !1;
|
|
2621
|
+
if (me(t))
|
|
2622
|
+
return t;
|
|
2623
|
+
parseFloat(t) === t && (t = parseFloat(t));
|
|
2624
|
+
} catch {
|
|
2625
|
+
}
|
|
2626
|
+
if (t !== null && t !== "")
|
|
2627
|
+
return t;
|
|
2628
|
+
}
|
|
2629
|
+
var Uu = Tu(), qu = Fu(), $u = uo();
|
|
2630
|
+
function lo(e, t) {
|
|
2631
|
+
if (e) {
|
|
2632
|
+
var n = Gs(t), s = !Ys(n), r = Ws(n) ? Pt(localStorage.getItem(e)) : void 0;
|
|
2633
|
+
if (s && !St(r))
|
|
2634
|
+
return r;
|
|
2635
|
+
var i = Hs(n) ? Pt(ao(e)) : void 0;
|
|
2636
|
+
if (s && i)
|
|
2637
|
+
return i;
|
|
2638
|
+
var o = Js(n) ? Pt(sessionStorage.getItem(e)) : void 0;
|
|
2639
|
+
if (s && o)
|
|
2640
|
+
return o;
|
|
2641
|
+
var c = gt(e);
|
|
2642
|
+
return s ? c : { localStorage: r, sessionStorage: o, cookie: i, global: c };
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
function Qu(e, t, n) {
|
|
2646
|
+
if (e && !St(t)) {
|
|
2647
|
+
var s = {}, r = Gs(n), i = JSON.stringify(t), o = !Ys(r);
|
|
2648
|
+
return Ws(r) && (s[on] = Mn(on, t, Pt(localStorage.getItem(e))), localStorage.setItem(e, i), o) ? s[on] : Hs(r) && (s[rn] = Mn(rn, t, Pt(ao(e))), Nu(e, i), o) ? s[rn] : Js(r) && (s[an] = Mn(an, t, Pt(sessionStorage.getItem(e))), sessionStorage.setItem(e, i), o) ? s[an] : (s[sn] = Mn(sn, t, gt(e)), yt(e, t), o ? s[sn] : s);
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
function Vu(e, t) {
|
|
2652
|
+
if (e) {
|
|
2653
|
+
var n = Gs(t), s = lo(e, zi), r = {};
|
|
2654
|
+
return !St(s.localStorage) && Ws(n) && (localStorage.removeItem(e), r[on] = s.localStorage), !St(s.cookie) && Hs(n) && (co(e), r[rn] = s.cookie), !St(s.sessionStorage) && Js(n) && (sessionStorage.removeItem(e), r[an] = s.sessionStorage), !St(s.global) && ss(n, sn) && (Wt(e), r[sn] = s.global), r;
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
function Gs(e) {
|
|
2658
|
+
return e ? kt(e) ? e : e.storage : Ki;
|
|
2659
|
+
}
|
|
2660
|
+
function Ws(e) {
|
|
2661
|
+
return Uu && ss(e, on);
|
|
2662
|
+
}
|
|
2663
|
+
function Hs(e) {
|
|
2664
|
+
return $u && ss(e, rn);
|
|
2665
|
+
}
|
|
2666
|
+
function Js(e) {
|
|
2667
|
+
return qu && ss(e, an);
|
|
2668
|
+
}
|
|
2669
|
+
function Ys(e) {
|
|
2670
|
+
return e === zi || e === "all";
|
|
2671
|
+
}
|
|
2672
|
+
function ss(e, t) {
|
|
2673
|
+
return e === Ki || e === t || Ys(e);
|
|
2674
|
+
}
|
|
2675
|
+
function Mn(e, t, n) {
|
|
2676
|
+
return { location: e, current: t, previous: n };
|
|
2677
|
+
}
|
|
2678
|
+
var Ku = { setItem: Qu, getItem: lo, removeItem: Vu };
|
|
2679
|
+
function zu(e, t, n) {
|
|
2680
|
+
return t in e ? Object.defineProperty(e, t, {
|
|
2681
|
+
value: n,
|
|
2682
|
+
enumerable: !0,
|
|
2683
|
+
configurable: !0,
|
|
2684
|
+
writable: !0
|
|
2685
|
+
}) : e[t] = n, e;
|
|
2686
|
+
}
|
|
2687
|
+
function Ur(e, t) {
|
|
2688
|
+
var n = Object.keys(e);
|
|
2689
|
+
if (Object.getOwnPropertySymbols) {
|
|
2690
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
2691
|
+
t && (s = s.filter(function(r) {
|
|
2692
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
2693
|
+
})), n.push.apply(n, s);
|
|
2694
|
+
}
|
|
2695
|
+
return n;
|
|
2696
|
+
}
|
|
2697
|
+
function qr(e) {
|
|
2698
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
2699
|
+
var n = arguments[t] != null ? arguments[t] : {};
|
|
2700
|
+
t % 2 ? Ur(Object(n), !0).forEach(function(s) {
|
|
2701
|
+
zu(e, s, n[s]);
|
|
2702
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Ur(Object(n)).forEach(function(s) {
|
|
2703
|
+
Object.defineProperty(e, s, Object.getOwnPropertyDescriptor(n, s));
|
|
2704
|
+
});
|
|
2705
|
+
}
|
|
2706
|
+
return e;
|
|
2707
|
+
}
|
|
2708
|
+
function Gu() {
|
|
2709
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = {
|
|
2710
|
+
storage: Ku
|
|
2711
|
+
};
|
|
2712
|
+
return Lu(qr(qr({}, t), e));
|
|
2713
|
+
}
|
|
2714
|
+
const Wu = "@chaibuilder/sdk", Hu = "0.1.4", Ju = "module", Yu = [
|
|
2715
|
+
"dist"
|
|
2716
|
+
], Zu = "dist/core.js", Xu = !1, el = {
|
|
2717
|
+
".": {
|
|
2718
|
+
import: "./dist/core.js",
|
|
2719
|
+
require: "./dist/core.cjs",
|
|
2720
|
+
types: "./dist/core.d.ts"
|
|
2721
|
+
},
|
|
2722
|
+
"./render": {
|
|
2723
|
+
import: "./dist/render.js",
|
|
2724
|
+
require: "./dist/render.cjs",
|
|
2725
|
+
types: "./dist/render.d.ts"
|
|
2726
|
+
},
|
|
2727
|
+
"./ui": {
|
|
2728
|
+
import: "./dist/ui.js",
|
|
2729
|
+
require: "./dist/ui.cjs",
|
|
2730
|
+
types: "./dist/ui.d.ts"
|
|
2731
|
+
},
|
|
2732
|
+
"./lib": {
|
|
2733
|
+
import: "./dist/lib.js",
|
|
2734
|
+
require: "./dist/lib.cjs",
|
|
2735
|
+
types: "./dist/lib.d.ts"
|
|
2736
|
+
},
|
|
2737
|
+
"./server": {
|
|
2738
|
+
import: "./dist/server.js",
|
|
2739
|
+
require: "./dist/server.cjs",
|
|
2740
|
+
types: "./dist/server.d.ts"
|
|
2741
|
+
},
|
|
2742
|
+
"./styles": {
|
|
2743
|
+
import: "./dist/style.css",
|
|
2744
|
+
require: "./dist/style.css"
|
|
2745
|
+
}
|
|
2746
|
+
}, tl = {
|
|
2747
|
+
dev: "vite",
|
|
2748
|
+
build: "tsc && vite build",
|
|
2749
|
+
lint: "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
2750
|
+
preview: "vite preview",
|
|
2751
|
+
test: "jest --colors",
|
|
2752
|
+
"test:watch": "jest --watch --colors",
|
|
2753
|
+
"test:coverage": "jest --coverage --colors",
|
|
2754
|
+
e2e: "playwright test",
|
|
2755
|
+
"e2e:report": "playwright show-report",
|
|
2756
|
+
"e2e:ui": "playwright test --ui",
|
|
2757
|
+
docs: "jsdoc -c jsdoc.conf.json"
|
|
2758
|
+
}, nl = {
|
|
2759
|
+
"@analytics/google-analytics": "^1.0.7",
|
|
2760
|
+
"@bobthered/tailwindcss-palette-generator": "3.1.1",
|
|
2761
|
+
"@chaibuilder/blocks": "^0.1.0",
|
|
2762
|
+
"@floating-ui/dom": "1.4.5",
|
|
2763
|
+
"@floating-ui/react-dom": "2.0.1",
|
|
2764
|
+
"@mhsdesign/jit-browser-tailwindcss": "0.3.0",
|
|
2765
|
+
"@minoru/react-dnd-treeview": "3.4.4",
|
|
2766
|
+
"@radix-ui/react-accordion": "^1.1.2",
|
|
2767
|
+
"@radix-ui/react-alert-dialog": "^1.0.4",
|
|
2768
|
+
"@radix-ui/react-context-menu": "^2.1.4",
|
|
2769
|
+
"@radix-ui/react-dialog": "^1.0.4",
|
|
2770
|
+
"@radix-ui/react-dropdown-menu": "^2.0.5",
|
|
2771
|
+
"@radix-ui/react-hover-card": "^1.0.6",
|
|
2772
|
+
"@radix-ui/react-icons": "^1.3.0",
|
|
2773
|
+
"@radix-ui/react-label": "^2.0.2",
|
|
2774
|
+
"@radix-ui/react-menubar": "^1.0.3",
|
|
2775
|
+
"@radix-ui/react-navigation-menu": "^1.1.3",
|
|
2776
|
+
"@radix-ui/react-popover": "^1.0.6",
|
|
2777
|
+
"@radix-ui/react-scroll-area": "^1.0.4",
|
|
2778
|
+
"@radix-ui/react-select": "^1.2.2",
|
|
2779
|
+
"@radix-ui/react-separator": "^1.0.3",
|
|
2780
|
+
"@radix-ui/react-slot": "^1.0.2",
|
|
2781
|
+
"@radix-ui/react-switch": "^1.0.3",
|
|
2782
|
+
"@radix-ui/react-tabs": "^1.0.4",
|
|
2783
|
+
"@radix-ui/react-toast": "^1.1.4",
|
|
2784
|
+
"@radix-ui/react-toggle": "^1.0.3",
|
|
2785
|
+
"@radix-ui/react-tooltip": "^1.0.6",
|
|
2786
|
+
"@react-hookz/web": "23.1.0",
|
|
2787
|
+
"@rjsf/core": "5.11.2",
|
|
2788
|
+
"@rjsf/utils": "5.11.2",
|
|
2789
|
+
"@rjsf/validator-ajv8": "5.11.2",
|
|
2790
|
+
"@tailwindcss/aspect-ratio": "0.4.2",
|
|
2791
|
+
"@tailwindcss/forms": "^0.5.6",
|
|
2792
|
+
"@tailwindcss/line-clamp": "^0.4.4",
|
|
2793
|
+
"@tailwindcss/typography": "^0.5.10",
|
|
2794
|
+
"@tanstack/react-query": "^5.8.4",
|
|
2795
|
+
analytics: "^0.8.9",
|
|
2796
|
+
"class-variance-authority": "0.6.1",
|
|
2797
|
+
clsx: "1.2.1",
|
|
2798
|
+
cmdk: "0.2.0",
|
|
2799
|
+
"date-fns": "^2.30.0",
|
|
2800
|
+
flagged: "2.0.9",
|
|
2801
|
+
"flat-to-nested": "1.1.1",
|
|
2802
|
+
"focus-trap-react": "^10.2.1",
|
|
2803
|
+
"forgiving-xml-parser": "1.4.0",
|
|
2804
|
+
"framer-motion": "^10.12.18",
|
|
2805
|
+
"fuse.js": "6.6.2",
|
|
2806
|
+
"gray-matter": "^4.0.3",
|
|
2807
|
+
himalaya: "^1.1.0",
|
|
2808
|
+
"html-formatter": "0.1.9",
|
|
2809
|
+
i18next: "^23.2.8",
|
|
2810
|
+
jotai: "2.2.2",
|
|
2811
|
+
lodash: "4.17.21",
|
|
2812
|
+
"lucide-react": "^0.244.0",
|
|
2813
|
+
nanoid: "^4.0.2",
|
|
2814
|
+
"post-robot": "10.0.46",
|
|
2815
|
+
react: "^18.2.0",
|
|
2816
|
+
"react-autosuggest": "10.1.0",
|
|
2817
|
+
"react-colorful": "5.6.1",
|
|
2818
|
+
"react-dnd": "16.0.1",
|
|
2819
|
+
"react-dnd-html5-backend": "16.0.1",
|
|
2820
|
+
"react-dom": "^18.2.0",
|
|
2821
|
+
"react-hotkeys-hook": "4.4.1",
|
|
2822
|
+
"react-i18next": "13.0.1",
|
|
2823
|
+
"react-icons": "^4.10.1",
|
|
2824
|
+
"react-icons-picker": "^1.0.9",
|
|
2825
|
+
"react-quill": "^2.0.0",
|
|
2826
|
+
"react-textarea-autosize": "^8.5.2",
|
|
2827
|
+
"react-wrap-balancer": "^1.0.0",
|
|
2828
|
+
"redux-undo": "1.1.0",
|
|
2829
|
+
sonner: "^1.2.0",
|
|
2830
|
+
"tailwind-merge": "1.13.2",
|
|
2831
|
+
"tailwindcss-animate": "1.0.6",
|
|
2832
|
+
"tippy.js": "^6.3.7",
|
|
2833
|
+
"unist-util-visit": "^4.1.2",
|
|
2834
|
+
"unsplash-js": "^7.0.18"
|
|
2835
|
+
}, sl = {
|
|
2836
|
+
"@commitlint/cli": "17.7.1",
|
|
2837
|
+
"@commitlint/config-conventional": "17.7.0",
|
|
2838
|
+
"@faker-js/faker": "^8.3.1",
|
|
2839
|
+
"@nozbe/watermelondb": "^0.27.1",
|
|
2840
|
+
"@playwright/test": "^1.39.0",
|
|
2841
|
+
"@tanstack/eslint-plugin-query": "^5.8.4",
|
|
2842
|
+
"@types/better-sqlite3": "^7.6.7",
|
|
2843
|
+
"@types/jest": "^29.5.7",
|
|
2844
|
+
"@types/lodash": "^4.14.200",
|
|
2845
|
+
"@types/node": "^20.8.10",
|
|
2846
|
+
"@types/react": "^18.2.15",
|
|
2847
|
+
"@types/react-dom": "^18.2.7",
|
|
2848
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
2849
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
2850
|
+
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
2851
|
+
autoprefixer: "^10.4.16",
|
|
2852
|
+
"better-docs": "^2.7.2",
|
|
2853
|
+
"better-sqlite3": "^9.1.1",
|
|
2854
|
+
"drizzle-kit": "^0.20.4",
|
|
2855
|
+
"drizzle-orm": "^0.29.0",
|
|
2856
|
+
eslint: "^8.45.0",
|
|
2857
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
2858
|
+
"eslint-plugin-react-refresh": "^0.4.3",
|
|
2859
|
+
jest: "^29.7.0",
|
|
2860
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
2861
|
+
jsdoc: "^4.0.2",
|
|
2862
|
+
msw: "^2.0.8",
|
|
2863
|
+
postcss: "^8.4.31",
|
|
2864
|
+
prettier: "^3.0.3",
|
|
2865
|
+
"prettier-plugin-tailwindcss": "^0.5.6",
|
|
2866
|
+
"prop-types": "^15.8.1",
|
|
2867
|
+
"react-router-dom": "^6.19.0",
|
|
2868
|
+
tailwindcss: "^3.3.5",
|
|
2869
|
+
"ts-jest": "^29.1.1",
|
|
2870
|
+
typescript: "^5.0.2",
|
|
2871
|
+
vite: "^4.4.5",
|
|
2872
|
+
"vite-plugin-dts": "^3.6.3"
|
|
2873
|
+
}, rl = {
|
|
2874
|
+
workerDirectory: "public"
|
|
2875
|
+
}, il = {
|
|
2876
|
+
name: Wu,
|
|
2877
|
+
private: !1,
|
|
2878
|
+
version: Hu,
|
|
2879
|
+
type: Ju,
|
|
2880
|
+
files: Yu,
|
|
2881
|
+
main: Zu,
|
|
2882
|
+
sideEffects: Xu,
|
|
2883
|
+
exports: el,
|
|
2884
|
+
scripts: tl,
|
|
2885
|
+
dependencies: nl,
|
|
2886
|
+
devDependencies: sl,
|
|
2887
|
+
msw: rl
|
|
2888
|
+
}, $r = "https://api.chaibuilder.com", Qr = () => typeof window > "u" ? !1 : window.location.href.includes("localhost");
|
|
2889
|
+
function ol() {
|
|
2890
|
+
return {
|
|
2891
|
+
/* All plugins require a name */
|
|
2892
|
+
name: "chaibuilder-analytics",
|
|
2893
|
+
/* Everything else below this is optional depending on your plugin requirements */
|
|
2894
|
+
config: {},
|
|
2895
|
+
initialize: () => {
|
|
2896
|
+
if (typeof window > "u")
|
|
2897
|
+
return !1;
|
|
2898
|
+
window.chaibuilderAnalyticsLoaded = !0;
|
|
2899
|
+
},
|
|
2900
|
+
page: (e) => {
|
|
2901
|
+
if (typeof window > "u")
|
|
2902
|
+
return !1;
|
|
2903
|
+
if (Qr())
|
|
2904
|
+
return;
|
|
2905
|
+
const { payload: t } = e;
|
|
2906
|
+
fetch(`${$r}/v1/log`, { method: "post", body: JSON.stringify(t) }).then((n) => n.json());
|
|
2907
|
+
},
|
|
2908
|
+
track: ({ payload: e }) => {
|
|
2909
|
+
if (typeof window > "u")
|
|
2910
|
+
return !1;
|
|
2911
|
+
Qr() || fetch(`${$r}/v1/log`, { method: "post", body: JSON.stringify(e) });
|
|
2912
|
+
},
|
|
2913
|
+
loaded: () => typeof window > "u" ? !0 : !!window.chaibuilderAnalyticsLoaded
|
|
2914
|
+
};
|
|
2915
|
+
}
|
|
2916
|
+
const al = Gu({
|
|
2917
|
+
app: "chaibuilder",
|
|
2918
|
+
version: il.version,
|
|
2919
|
+
plugins: [ol()]
|
|
2920
|
+
});
|
|
2921
|
+
({}).NODE_ENV === "development" && console.log("Chai Builder:", aa);
|
|
2922
|
+
const cl = (e) => /* @__PURE__ */ x.jsx(x.Fragment, { children: e.children }), ul = (e) => {
|
|
2923
|
+
const { dndOptions: t = { backend: To } } = e, [n] = Ua(), [, s] = Oi(), r = Lc();
|
|
2924
|
+
return Ee(() => {
|
|
2925
|
+
Zc.set(
|
|
2926
|
+
// @ts-ignore
|
|
2927
|
+
di,
|
|
2928
|
+
Wn(e, ["blocks", "globalBlocks", "brandingOptions"])
|
|
2929
|
+
);
|
|
2930
|
+
}, [e]), Ee(() => {
|
|
2931
|
+
n(Ho(e.blocks || [])), r();
|
|
2932
|
+
}, [e.blocks]), Ee(() => {
|
|
2933
|
+
s(e.brandingOptions);
|
|
2934
|
+
}, [e.brandingOptions]), Ee(() => {
|
|
2935
|
+
al.page();
|
|
2936
|
+
}, []), /* @__PURE__ */ x.jsx(Do, { ...t, options: No(), children: /* @__PURE__ */ x.jsx(cl, { children: /* @__PURE__ */ x.jsx(Yc, {}) }) });
|
|
2937
|
+
}, ll = (e) => /* @__PURE__ */ x.jsxs(ua, { children: [
|
|
2938
|
+
/* @__PURE__ */ x.jsx(Oo, { features: ca, children: /* @__PURE__ */ x.jsx(ul, { ...e }) }),
|
|
2939
|
+
/* @__PURE__ */ x.jsx(qo, {})
|
|
2940
|
+
] });
|
|
2941
|
+
var Jt = class {
|
|
2942
|
+
constructor() {
|
|
2943
|
+
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
2944
|
+
}
|
|
2945
|
+
subscribe(e) {
|
|
2946
|
+
return this.listeners.add(e), this.onSubscribe(), () => {
|
|
2947
|
+
this.listeners.delete(e), this.onUnsubscribe();
|
|
2948
|
+
};
|
|
2949
|
+
}
|
|
2950
|
+
hasListeners() {
|
|
2951
|
+
return this.listeners.size > 0;
|
|
2952
|
+
}
|
|
2953
|
+
onSubscribe() {
|
|
2954
|
+
}
|
|
2955
|
+
onUnsubscribe() {
|
|
2956
|
+
}
|
|
2957
|
+
}, zt = typeof window > "u" || "Deno" in window;
|
|
2958
|
+
function we() {
|
|
2959
|
+
}
|
|
2960
|
+
function dl(e, t) {
|
|
2961
|
+
return typeof e == "function" ? e(t) : e;
|
|
2962
|
+
}
|
|
2963
|
+
function ks(e) {
|
|
2964
|
+
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
2965
|
+
}
|
|
2966
|
+
function fo(e, t) {
|
|
2967
|
+
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
2968
|
+
}
|
|
2969
|
+
function Vr(e, t) {
|
|
2970
|
+
const {
|
|
2971
|
+
type: n = "all",
|
|
2972
|
+
exact: s,
|
|
2973
|
+
fetchStatus: r,
|
|
2974
|
+
predicate: i,
|
|
2975
|
+
queryKey: o,
|
|
2976
|
+
stale: c
|
|
2977
|
+
} = e;
|
|
2978
|
+
if (o) {
|
|
2979
|
+
if (s) {
|
|
2980
|
+
if (t.queryHash !== Zs(o, t.options))
|
|
2981
|
+
return !1;
|
|
2982
|
+
} else if (!dn(t.queryKey, o))
|
|
2983
|
+
return !1;
|
|
2984
|
+
}
|
|
2985
|
+
if (n !== "all") {
|
|
2986
|
+
const l = t.isActive();
|
|
2987
|
+
if (n === "active" && !l || n === "inactive" && l)
|
|
2988
|
+
return !1;
|
|
2989
|
+
}
|
|
2990
|
+
return !(typeof c == "boolean" && t.isStale() !== c || typeof r < "u" && r !== t.state.fetchStatus || i && !i(t));
|
|
2991
|
+
}
|
|
2992
|
+
function Kr(e, t) {
|
|
2993
|
+
const { exact: n, status: s, predicate: r, mutationKey: i } = e;
|
|
2994
|
+
if (i) {
|
|
2995
|
+
if (!t.options.mutationKey)
|
|
2996
|
+
return !1;
|
|
2997
|
+
if (n) {
|
|
2998
|
+
if (ln(t.options.mutationKey) !== ln(i))
|
|
2999
|
+
return !1;
|
|
3000
|
+
} else if (!dn(t.options.mutationKey, i))
|
|
3001
|
+
return !1;
|
|
3002
|
+
}
|
|
3003
|
+
return !(s && t.state.status !== s || r && !r(t));
|
|
3004
|
+
}
|
|
3005
|
+
function Zs(e, t) {
|
|
3006
|
+
return ((t == null ? void 0 : t.queryKeyHashFn) || ln)(e);
|
|
3007
|
+
}
|
|
3008
|
+
function ln(e) {
|
|
3009
|
+
return JSON.stringify(
|
|
3010
|
+
e,
|
|
3011
|
+
(t, n) => As(n) ? Object.keys(n).sort().reduce((s, r) => (s[r] = n[r], s), {}) : n
|
|
3012
|
+
);
|
|
3013
|
+
}
|
|
3014
|
+
function dn(e, t) {
|
|
3015
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((n) => !dn(e[n], t[n])) : !1;
|
|
3016
|
+
}
|
|
3017
|
+
function ho(e, t) {
|
|
3018
|
+
if (e === t)
|
|
3019
|
+
return e;
|
|
3020
|
+
const n = zr(e) && zr(t);
|
|
3021
|
+
if (n || As(e) && As(t)) {
|
|
3022
|
+
const s = n ? e.length : Object.keys(e).length, r = n ? t : Object.keys(t), i = r.length, o = n ? [] : {};
|
|
3023
|
+
let c = 0;
|
|
3024
|
+
for (let l = 0; l < i; l++) {
|
|
3025
|
+
const u = n ? l : r[l];
|
|
3026
|
+
o[u] = ho(e[u], t[u]), o[u] === e[u] && c++;
|
|
3027
|
+
}
|
|
3028
|
+
return s === i && c === s ? e : o;
|
|
3029
|
+
}
|
|
3030
|
+
return t;
|
|
3031
|
+
}
|
|
3032
|
+
function Vn(e, t) {
|
|
3033
|
+
if (e && !t || t && !e)
|
|
3034
|
+
return !1;
|
|
3035
|
+
for (const n in e)
|
|
3036
|
+
if (e[n] !== t[n])
|
|
3037
|
+
return !1;
|
|
3038
|
+
return !0;
|
|
3039
|
+
}
|
|
3040
|
+
function zr(e) {
|
|
3041
|
+
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
3042
|
+
}
|
|
3043
|
+
function As(e) {
|
|
3044
|
+
if (!Gr(e))
|
|
3045
|
+
return !1;
|
|
3046
|
+
const t = e.constructor;
|
|
3047
|
+
if (typeof t > "u")
|
|
3048
|
+
return !0;
|
|
3049
|
+
const n = t.prototype;
|
|
3050
|
+
return !(!Gr(n) || !n.hasOwnProperty("isPrototypeOf"));
|
|
3051
|
+
}
|
|
3052
|
+
function Gr(e) {
|
|
3053
|
+
return Object.prototype.toString.call(e) === "[object Object]";
|
|
3054
|
+
}
|
|
3055
|
+
function po(e) {
|
|
3056
|
+
return new Promise((t) => {
|
|
3057
|
+
setTimeout(t, e);
|
|
3058
|
+
});
|
|
3059
|
+
}
|
|
3060
|
+
function Wr(e) {
|
|
3061
|
+
po(0).then(e);
|
|
3062
|
+
}
|
|
3063
|
+
function Es(e, t, n) {
|
|
3064
|
+
return typeof n.structuralSharing == "function" ? n.structuralSharing(e, t) : n.structuralSharing !== !1 ? ho(e, t) : t;
|
|
3065
|
+
}
|
|
3066
|
+
function fl(e, t, n = 0) {
|
|
3067
|
+
const s = [...e, t];
|
|
3068
|
+
return n && s.length > n ? s.slice(1) : s;
|
|
3069
|
+
}
|
|
3070
|
+
function hl(e, t, n = 0) {
|
|
3071
|
+
const s = [t, ...e];
|
|
3072
|
+
return n && s.length > n ? s.slice(0, -1) : s;
|
|
3073
|
+
}
|
|
3074
|
+
var st, Ve, Ot, Zr, pl = (Zr = class extends Jt {
|
|
3075
|
+
constructor() {
|
|
3076
|
+
super();
|
|
3077
|
+
I(this, st, void 0);
|
|
3078
|
+
I(this, Ve, void 0);
|
|
3079
|
+
I(this, Ot, void 0);
|
|
3080
|
+
k(this, Ot, (t) => {
|
|
3081
|
+
if (!zt && window.addEventListener) {
|
|
3082
|
+
const n = () => t();
|
|
3083
|
+
return window.addEventListener("visibilitychange", n, !1), () => {
|
|
3084
|
+
window.removeEventListener("visibilitychange", n);
|
|
3085
|
+
};
|
|
3086
|
+
}
|
|
3087
|
+
});
|
|
3088
|
+
}
|
|
3089
|
+
onSubscribe() {
|
|
3090
|
+
a(this, Ve) || this.setEventListener(a(this, Ot));
|
|
3091
|
+
}
|
|
3092
|
+
onUnsubscribe() {
|
|
3093
|
+
var t;
|
|
3094
|
+
this.hasListeners() || ((t = a(this, Ve)) == null || t.call(this), k(this, Ve, void 0));
|
|
3095
|
+
}
|
|
3096
|
+
setEventListener(t) {
|
|
3097
|
+
var n;
|
|
3098
|
+
k(this, Ot, t), (n = a(this, Ve)) == null || n.call(this), k(this, Ve, t((s) => {
|
|
3099
|
+
typeof s == "boolean" ? this.setFocused(s) : this.onFocus();
|
|
3100
|
+
}));
|
|
3101
|
+
}
|
|
3102
|
+
setFocused(t) {
|
|
3103
|
+
a(this, st) !== t && (k(this, st, t), this.onFocus());
|
|
3104
|
+
}
|
|
3105
|
+
onFocus() {
|
|
3106
|
+
this.listeners.forEach((t) => {
|
|
3107
|
+
t();
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
isFocused() {
|
|
3111
|
+
var t;
|
|
3112
|
+
return typeof a(this, st) == "boolean" ? a(this, st) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
3113
|
+
}
|
|
3114
|
+
}, st = new WeakMap(), Ve = new WeakMap(), Ot = new WeakMap(), Zr), Kn = new pl(), Ct, Ke, _t, Xr, ml = (Xr = class extends Jt {
|
|
3115
|
+
constructor() {
|
|
3116
|
+
super();
|
|
3117
|
+
I(this, Ct, !0);
|
|
3118
|
+
I(this, Ke, void 0);
|
|
3119
|
+
I(this, _t, void 0);
|
|
3120
|
+
k(this, _t, (t) => {
|
|
3121
|
+
if (!zt && window.addEventListener) {
|
|
3122
|
+
const n = () => t(!0), s = () => t(!1);
|
|
3123
|
+
return window.addEventListener("online", n, !1), window.addEventListener("offline", s, !1), () => {
|
|
3124
|
+
window.removeEventListener("online", n), window.removeEventListener("offline", s);
|
|
3125
|
+
};
|
|
3126
|
+
}
|
|
3127
|
+
});
|
|
3128
|
+
}
|
|
3129
|
+
onSubscribe() {
|
|
3130
|
+
a(this, Ke) || this.setEventListener(a(this, _t));
|
|
3131
|
+
}
|
|
3132
|
+
onUnsubscribe() {
|
|
3133
|
+
var t;
|
|
3134
|
+
this.hasListeners() || ((t = a(this, Ke)) == null || t.call(this), k(this, Ke, void 0));
|
|
3135
|
+
}
|
|
3136
|
+
setEventListener(t) {
|
|
3137
|
+
var n;
|
|
3138
|
+
k(this, _t, t), (n = a(this, Ke)) == null || n.call(this), k(this, Ke, t(this.setOnline.bind(this)));
|
|
3139
|
+
}
|
|
3140
|
+
setOnline(t) {
|
|
3141
|
+
a(this, Ct) !== t && (k(this, Ct, t), this.listeners.forEach((s) => {
|
|
3142
|
+
s(t);
|
|
3143
|
+
}));
|
|
3144
|
+
}
|
|
3145
|
+
isOnline() {
|
|
3146
|
+
return a(this, Ct);
|
|
3147
|
+
}
|
|
3148
|
+
}, Ct = new WeakMap(), Ke = new WeakMap(), _t = new WeakMap(), Xr), zn = new ml();
|
|
3149
|
+
function gl(e) {
|
|
3150
|
+
return Math.min(1e3 * 2 ** e, 3e4);
|
|
3151
|
+
}
|
|
3152
|
+
function rs(e) {
|
|
3153
|
+
return (e ?? "online") === "online" ? zn.isOnline() : !0;
|
|
3154
|
+
}
|
|
3155
|
+
var mo = class {
|
|
3156
|
+
constructor(e) {
|
|
3157
|
+
this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
3158
|
+
}
|
|
3159
|
+
};
|
|
3160
|
+
function ms(e) {
|
|
3161
|
+
return e instanceof mo;
|
|
3162
|
+
}
|
|
3163
|
+
function go(e) {
|
|
3164
|
+
let t = !1, n = 0, s = !1, r, i, o;
|
|
3165
|
+
const c = new Promise((y, P) => {
|
|
3166
|
+
i = y, o = P;
|
|
3167
|
+
}), l = (y) => {
|
|
3168
|
+
var P;
|
|
3169
|
+
s || (g(new mo(y)), (P = e.abort) == null || P.call(e));
|
|
3170
|
+
}, u = () => {
|
|
3171
|
+
t = !0;
|
|
3172
|
+
}, f = () => {
|
|
3173
|
+
t = !1;
|
|
3174
|
+
}, m = () => !Kn.isFocused() || e.networkMode !== "always" && !zn.isOnline(), A = (y) => {
|
|
3175
|
+
var P;
|
|
3176
|
+
s || (s = !0, (P = e.onSuccess) == null || P.call(e, y), r == null || r(), i(y));
|
|
3177
|
+
}, g = (y) => {
|
|
3178
|
+
var P;
|
|
3179
|
+
s || (s = !0, (P = e.onError) == null || P.call(e, y), r == null || r(), o(y));
|
|
3180
|
+
}, C = () => new Promise((y) => {
|
|
3181
|
+
var P;
|
|
3182
|
+
r = (L) => {
|
|
3183
|
+
const R = s || !m();
|
|
3184
|
+
return R && y(L), R;
|
|
3185
|
+
}, (P = e.onPause) == null || P.call(e);
|
|
3186
|
+
}).then(() => {
|
|
3187
|
+
var y;
|
|
3188
|
+
r = void 0, s || (y = e.onContinue) == null || y.call(e);
|
|
3189
|
+
}), _ = () => {
|
|
3190
|
+
if (s)
|
|
3191
|
+
return;
|
|
3192
|
+
let y;
|
|
3193
|
+
try {
|
|
3194
|
+
y = e.fn();
|
|
3195
|
+
} catch (P) {
|
|
3196
|
+
y = Promise.reject(P);
|
|
3197
|
+
}
|
|
3198
|
+
Promise.resolve(y).then(A).catch((P) => {
|
|
3199
|
+
var F;
|
|
3200
|
+
if (s)
|
|
3201
|
+
return;
|
|
3202
|
+
const L = e.retry ?? (zt ? 0 : 3), R = e.retryDelay ?? gl, S = typeof R == "function" ? R(n, P) : R, E = L === !0 || typeof L == "number" && n < L || typeof L == "function" && L(n, P);
|
|
3203
|
+
if (t || !E) {
|
|
3204
|
+
g(P);
|
|
3205
|
+
return;
|
|
3206
|
+
}
|
|
3207
|
+
n++, (F = e.onFail) == null || F.call(e, n, P), po(S).then(() => {
|
|
3208
|
+
if (m())
|
|
3209
|
+
return C();
|
|
3210
|
+
}).then(() => {
|
|
3211
|
+
t ? g(P) : _();
|
|
3212
|
+
});
|
|
3213
|
+
});
|
|
3214
|
+
};
|
|
3215
|
+
return rs(e.networkMode) ? _() : C().then(_), {
|
|
3216
|
+
promise: c,
|
|
3217
|
+
cancel: l,
|
|
3218
|
+
continue: () => (r == null ? void 0 : r()) ? c : Promise.resolve(),
|
|
3219
|
+
cancelRetry: u,
|
|
3220
|
+
continueRetry: f
|
|
3221
|
+
};
|
|
3222
|
+
}
|
|
3223
|
+
function yl() {
|
|
3224
|
+
let e = [], t = 0, n = (f) => {
|
|
3225
|
+
f();
|
|
3226
|
+
}, s = (f) => {
|
|
3227
|
+
f();
|
|
3228
|
+
};
|
|
3229
|
+
const r = (f) => {
|
|
3230
|
+
let m;
|
|
3231
|
+
t++;
|
|
3232
|
+
try {
|
|
3233
|
+
m = f();
|
|
3234
|
+
} finally {
|
|
3235
|
+
t--, t || c();
|
|
3236
|
+
}
|
|
3237
|
+
return m;
|
|
3238
|
+
}, i = (f) => {
|
|
3239
|
+
t ? e.push(f) : Wr(() => {
|
|
3240
|
+
n(f);
|
|
3241
|
+
});
|
|
3242
|
+
}, o = (f) => (...m) => {
|
|
3243
|
+
i(() => {
|
|
3244
|
+
f(...m);
|
|
3245
|
+
});
|
|
3246
|
+
}, c = () => {
|
|
3247
|
+
const f = e;
|
|
3248
|
+
e = [], f.length && Wr(() => {
|
|
3249
|
+
s(() => {
|
|
3250
|
+
f.forEach((m) => {
|
|
3251
|
+
n(m);
|
|
3252
|
+
});
|
|
3253
|
+
});
|
|
3254
|
+
});
|
|
3255
|
+
};
|
|
3256
|
+
return {
|
|
3257
|
+
batch: r,
|
|
3258
|
+
batchCalls: o,
|
|
3259
|
+
schedule: i,
|
|
3260
|
+
setNotifyFunction: (f) => {
|
|
3261
|
+
n = f;
|
|
3262
|
+
},
|
|
3263
|
+
setBatchNotifyFunction: (f) => {
|
|
3264
|
+
s = f;
|
|
3265
|
+
}
|
|
3266
|
+
};
|
|
3267
|
+
}
|
|
3268
|
+
var ie = yl(), rt, ei, yo = (ei = class {
|
|
3269
|
+
constructor() {
|
|
3270
|
+
I(this, rt, void 0);
|
|
3271
|
+
}
|
|
3272
|
+
destroy() {
|
|
3273
|
+
this.clearGcTimeout();
|
|
3274
|
+
}
|
|
3275
|
+
scheduleGc() {
|
|
3276
|
+
this.clearGcTimeout(), ks(this.gcTime) && k(this, rt, setTimeout(() => {
|
|
3277
|
+
this.optionalRemove();
|
|
3278
|
+
}, this.gcTime));
|
|
3279
|
+
}
|
|
3280
|
+
updateGcTime(e) {
|
|
3281
|
+
this.gcTime = Math.max(
|
|
3282
|
+
this.gcTime || 0,
|
|
3283
|
+
e ?? (zt ? 1 / 0 : 5 * 60 * 1e3)
|
|
3284
|
+
);
|
|
3285
|
+
}
|
|
3286
|
+
clearGcTimeout() {
|
|
3287
|
+
a(this, rt) && (clearTimeout(a(this, rt)), k(this, rt, void 0));
|
|
3288
|
+
}
|
|
3289
|
+
}, rt = new WeakMap(), ei), jt, It, ge, ze, ye, oe, fn, it, Bt, Tn, Ae, Me, ti, vl = (ti = class extends yo {
|
|
3290
|
+
constructor(t) {
|
|
3291
|
+
super();
|
|
3292
|
+
I(this, Bt);
|
|
3293
|
+
I(this, Ae);
|
|
3294
|
+
I(this, jt, void 0);
|
|
3295
|
+
I(this, It, void 0);
|
|
3296
|
+
I(this, ge, void 0);
|
|
3297
|
+
I(this, ze, void 0);
|
|
3298
|
+
I(this, ye, void 0);
|
|
3299
|
+
I(this, oe, void 0);
|
|
3300
|
+
I(this, fn, void 0);
|
|
3301
|
+
I(this, it, void 0);
|
|
3302
|
+
k(this, it, !1), k(this, fn, t.defaultOptions), Q(this, Bt, Tn).call(this, t.options), k(this, oe, []), k(this, ge, t.cache), this.queryKey = t.queryKey, this.queryHash = t.queryHash, k(this, jt, t.state || bl(this.options)), this.state = a(this, jt), this.scheduleGc();
|
|
3303
|
+
}
|
|
3304
|
+
get meta() {
|
|
3305
|
+
return this.options.meta;
|
|
3306
|
+
}
|
|
3307
|
+
optionalRemove() {
|
|
3308
|
+
!a(this, oe).length && this.state.fetchStatus === "idle" && a(this, ge).remove(this);
|
|
3309
|
+
}
|
|
3310
|
+
setData(t, n) {
|
|
3311
|
+
const s = Es(this.state.data, t, this.options);
|
|
3312
|
+
return Q(this, Ae, Me).call(this, {
|
|
3313
|
+
data: s,
|
|
3314
|
+
type: "success",
|
|
3315
|
+
dataUpdatedAt: n == null ? void 0 : n.updatedAt,
|
|
3316
|
+
manual: n == null ? void 0 : n.manual
|
|
3317
|
+
}), s;
|
|
3318
|
+
}
|
|
3319
|
+
setState(t, n) {
|
|
3320
|
+
Q(this, Ae, Me).call(this, { type: "setState", state: t, setStateOptions: n });
|
|
3321
|
+
}
|
|
3322
|
+
cancel(t) {
|
|
3323
|
+
var s;
|
|
3324
|
+
const n = a(this, ze);
|
|
3325
|
+
return (s = a(this, ye)) == null || s.cancel(t), n ? n.then(we).catch(we) : Promise.resolve();
|
|
3326
|
+
}
|
|
3327
|
+
destroy() {
|
|
3328
|
+
super.destroy(), this.cancel({ silent: !0 });
|
|
3329
|
+
}
|
|
3330
|
+
reset() {
|
|
3331
|
+
this.destroy(), this.setState(a(this, jt));
|
|
3332
|
+
}
|
|
3333
|
+
isActive() {
|
|
3334
|
+
return a(this, oe).some(
|
|
3335
|
+
(t) => t.options.enabled !== !1
|
|
3336
|
+
);
|
|
3337
|
+
}
|
|
3338
|
+
isDisabled() {
|
|
3339
|
+
return this.getObserversCount() > 0 && !this.isActive();
|
|
3340
|
+
}
|
|
3341
|
+
isStale() {
|
|
3342
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || a(this, oe).some((t) => t.getCurrentResult().isStale);
|
|
3343
|
+
}
|
|
3344
|
+
isStaleByTime(t = 0) {
|
|
3345
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || !fo(this.state.dataUpdatedAt, t);
|
|
3346
|
+
}
|
|
3347
|
+
onFocus() {
|
|
3348
|
+
var n;
|
|
3349
|
+
const t = a(this, oe).find((s) => s.shouldFetchOnWindowFocus());
|
|
3350
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (n = a(this, ye)) == null || n.continue();
|
|
3351
|
+
}
|
|
3352
|
+
onOnline() {
|
|
3353
|
+
var n;
|
|
3354
|
+
const t = a(this, oe).find((s) => s.shouldFetchOnReconnect());
|
|
3355
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (n = a(this, ye)) == null || n.continue();
|
|
3356
|
+
}
|
|
3357
|
+
addObserver(t) {
|
|
3358
|
+
a(this, oe).includes(t) || (a(this, oe).push(t), this.clearGcTimeout(), a(this, ge).notify({ type: "observerAdded", query: this, observer: t }));
|
|
3359
|
+
}
|
|
3360
|
+
removeObserver(t) {
|
|
3361
|
+
a(this, oe).includes(t) && (k(this, oe, a(this, oe).filter((n) => n !== t)), a(this, oe).length || (a(this, ye) && (a(this, it) ? a(this, ye).cancel({ revert: !0 }) : a(this, ye).cancelRetry()), this.scheduleGc()), a(this, ge).notify({ type: "observerRemoved", query: this, observer: t }));
|
|
3362
|
+
}
|
|
3363
|
+
getObserversCount() {
|
|
3364
|
+
return a(this, oe).length;
|
|
3365
|
+
}
|
|
3366
|
+
invalidate() {
|
|
3367
|
+
this.state.isInvalidated || Q(this, Ae, Me).call(this, { type: "invalidate" });
|
|
3368
|
+
}
|
|
3369
|
+
fetch(t, n) {
|
|
3370
|
+
var u, f, m, A;
|
|
3371
|
+
if (this.state.fetchStatus !== "idle") {
|
|
3372
|
+
if (this.state.dataUpdatedAt && (n != null && n.cancelRefetch))
|
|
3373
|
+
this.cancel({ silent: !0 });
|
|
3374
|
+
else if (a(this, ze))
|
|
3375
|
+
return (u = a(this, ye)) == null || u.continueRetry(), a(this, ze);
|
|
3376
|
+
}
|
|
3377
|
+
if (t && Q(this, Bt, Tn).call(this, t), !this.options.queryFn) {
|
|
3378
|
+
const g = a(this, oe).find((C) => C.options.queryFn);
|
|
3379
|
+
g && Q(this, Bt, Tn).call(this, g.options);
|
|
3380
|
+
}
|
|
3381
|
+
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
|
|
3382
|
+
"As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"
|
|
3383
|
+
));
|
|
3384
|
+
const s = new AbortController(), r = {
|
|
3385
|
+
queryKey: this.queryKey,
|
|
3386
|
+
meta: this.meta
|
|
3387
|
+
}, i = (g) => {
|
|
3388
|
+
Object.defineProperty(g, "signal", {
|
|
3389
|
+
enumerable: !0,
|
|
3390
|
+
get: () => (k(this, it, !0), s.signal)
|
|
3391
|
+
});
|
|
3392
|
+
};
|
|
3393
|
+
i(r);
|
|
3394
|
+
const o = () => this.options.queryFn ? (k(this, it, !1), this.options.persister ? this.options.persister(
|
|
3395
|
+
this.options.queryFn,
|
|
3396
|
+
r,
|
|
3397
|
+
this
|
|
3398
|
+
) : this.options.queryFn(
|
|
3399
|
+
r
|
|
3400
|
+
)) : Promise.reject(
|
|
3401
|
+
new Error(`Missing queryFn: '${this.options.queryHash}'`)
|
|
3402
|
+
), c = {
|
|
3403
|
+
fetchOptions: n,
|
|
3404
|
+
options: this.options,
|
|
3405
|
+
queryKey: this.queryKey,
|
|
3406
|
+
state: this.state,
|
|
3407
|
+
fetchFn: o
|
|
3408
|
+
};
|
|
3409
|
+
i(c), (f = this.options.behavior) == null || f.onFetch(
|
|
3410
|
+
c,
|
|
3411
|
+
this
|
|
3412
|
+
), k(this, It, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((m = c.fetchOptions) == null ? void 0 : m.meta)) && Q(this, Ae, Me).call(this, { type: "fetch", meta: (A = c.fetchOptions) == null ? void 0 : A.meta });
|
|
3413
|
+
const l = (g) => {
|
|
3414
|
+
var C, _, y, P;
|
|
3415
|
+
ms(g) && g.silent || Q(this, Ae, Me).call(this, {
|
|
3416
|
+
type: "error",
|
|
3417
|
+
error: g
|
|
3418
|
+
}), ms(g) || ((_ = (C = a(this, ge).config).onError) == null || _.call(
|
|
3419
|
+
C,
|
|
3420
|
+
g,
|
|
3421
|
+
this
|
|
3422
|
+
), (P = (y = a(this, ge).config).onSettled) == null || P.call(
|
|
3423
|
+
y,
|
|
3424
|
+
this.state.data,
|
|
3425
|
+
g,
|
|
3426
|
+
this
|
|
3427
|
+
)), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
|
|
3428
|
+
};
|
|
3429
|
+
return k(this, ye, go({
|
|
3430
|
+
fn: c.fetchFn,
|
|
3431
|
+
abort: s.abort.bind(s),
|
|
3432
|
+
onSuccess: (g) => {
|
|
3433
|
+
var C, _, y, P;
|
|
3434
|
+
if (typeof g > "u") {
|
|
3435
|
+
process.env.NODE_ENV !== "production" && console.error(
|
|
3436
|
+
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
3437
|
+
), l(new Error(`${this.queryHash} data is undefined`));
|
|
3438
|
+
return;
|
|
3439
|
+
}
|
|
3440
|
+
this.setData(g), (_ = (C = a(this, ge).config).onSuccess) == null || _.call(C, g, this), (P = (y = a(this, ge).config).onSettled) == null || P.call(
|
|
3441
|
+
y,
|
|
3442
|
+
g,
|
|
3443
|
+
this.state.error,
|
|
3444
|
+
this
|
|
3445
|
+
), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
|
|
3446
|
+
},
|
|
3447
|
+
onError: l,
|
|
3448
|
+
onFail: (g, C) => {
|
|
3449
|
+
Q(this, Ae, Me).call(this, { type: "failed", failureCount: g, error: C });
|
|
3450
|
+
},
|
|
3451
|
+
onPause: () => {
|
|
3452
|
+
Q(this, Ae, Me).call(this, { type: "pause" });
|
|
3453
|
+
},
|
|
3454
|
+
onContinue: () => {
|
|
3455
|
+
Q(this, Ae, Me).call(this, { type: "continue" });
|
|
3456
|
+
},
|
|
3457
|
+
retry: c.options.retry,
|
|
3458
|
+
retryDelay: c.options.retryDelay,
|
|
3459
|
+
networkMode: c.options.networkMode
|
|
3460
|
+
})), k(this, ze, a(this, ye).promise), a(this, ze);
|
|
3461
|
+
}
|
|
3462
|
+
}, jt = new WeakMap(), It = new WeakMap(), ge = new WeakMap(), ze = new WeakMap(), ye = new WeakMap(), oe = new WeakMap(), fn = new WeakMap(), it = new WeakMap(), Bt = new WeakSet(), Tn = function(t) {
|
|
3463
|
+
this.options = { ...a(this, fn), ...t }, this.updateGcTime(this.options.gcTime);
|
|
3464
|
+
}, Ae = new WeakSet(), Me = function(t) {
|
|
3465
|
+
const n = (s) => {
|
|
3466
|
+
switch (t.type) {
|
|
3467
|
+
case "failed":
|
|
3468
|
+
return {
|
|
3469
|
+
...s,
|
|
3470
|
+
fetchFailureCount: t.failureCount,
|
|
3471
|
+
fetchFailureReason: t.error
|
|
3472
|
+
};
|
|
3473
|
+
case "pause":
|
|
3474
|
+
return {
|
|
3475
|
+
...s,
|
|
3476
|
+
fetchStatus: "paused"
|
|
3477
|
+
};
|
|
3478
|
+
case "continue":
|
|
3479
|
+
return {
|
|
3480
|
+
...s,
|
|
3481
|
+
fetchStatus: "fetching"
|
|
3482
|
+
};
|
|
3483
|
+
case "fetch":
|
|
3484
|
+
return {
|
|
3485
|
+
...s,
|
|
3486
|
+
fetchFailureCount: 0,
|
|
3487
|
+
fetchFailureReason: null,
|
|
3488
|
+
fetchMeta: t.meta ?? null,
|
|
3489
|
+
fetchStatus: rs(this.options.networkMode) ? "fetching" : "paused",
|
|
3490
|
+
...!s.dataUpdatedAt && {
|
|
3491
|
+
error: null,
|
|
3492
|
+
status: "pending"
|
|
3493
|
+
}
|
|
3494
|
+
};
|
|
3495
|
+
case "success":
|
|
3496
|
+
return {
|
|
3497
|
+
...s,
|
|
3498
|
+
data: t.data,
|
|
3499
|
+
dataUpdateCount: s.dataUpdateCount + 1,
|
|
3500
|
+
dataUpdatedAt: t.dataUpdatedAt ?? Date.now(),
|
|
3501
|
+
error: null,
|
|
3502
|
+
isInvalidated: !1,
|
|
3503
|
+
status: "success",
|
|
3504
|
+
...!t.manual && {
|
|
3505
|
+
fetchStatus: "idle",
|
|
3506
|
+
fetchFailureCount: 0,
|
|
3507
|
+
fetchFailureReason: null
|
|
3508
|
+
}
|
|
3509
|
+
};
|
|
3510
|
+
case "error":
|
|
3511
|
+
const r = t.error;
|
|
3512
|
+
return ms(r) && r.revert && a(this, It) ? { ...a(this, It), fetchStatus: "idle" } : {
|
|
3513
|
+
...s,
|
|
3514
|
+
error: r,
|
|
3515
|
+
errorUpdateCount: s.errorUpdateCount + 1,
|
|
3516
|
+
errorUpdatedAt: Date.now(),
|
|
3517
|
+
fetchFailureCount: s.fetchFailureCount + 1,
|
|
3518
|
+
fetchFailureReason: r,
|
|
3519
|
+
fetchStatus: "idle",
|
|
3520
|
+
status: "error"
|
|
3521
|
+
};
|
|
3522
|
+
case "invalidate":
|
|
3523
|
+
return {
|
|
3524
|
+
...s,
|
|
3525
|
+
isInvalidated: !0
|
|
3526
|
+
};
|
|
3527
|
+
case "setState":
|
|
3528
|
+
return {
|
|
3529
|
+
...s,
|
|
3530
|
+
...t.state
|
|
3531
|
+
};
|
|
3532
|
+
}
|
|
3533
|
+
};
|
|
3534
|
+
this.state = n(this.state), ie.batch(() => {
|
|
3535
|
+
a(this, oe).forEach((s) => {
|
|
3536
|
+
s.onQueryUpdate();
|
|
3537
|
+
}), a(this, ge).notify({ query: this, type: "updated", action: t });
|
|
3538
|
+
});
|
|
3539
|
+
}, ti);
|
|
3540
|
+
function bl(e) {
|
|
3541
|
+
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, n = typeof t < "u", s = n ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
3542
|
+
return {
|
|
3543
|
+
data: t,
|
|
3544
|
+
dataUpdateCount: 0,
|
|
3545
|
+
dataUpdatedAt: n ? s ?? Date.now() : 0,
|
|
3546
|
+
error: null,
|
|
3547
|
+
errorUpdateCount: 0,
|
|
3548
|
+
errorUpdatedAt: 0,
|
|
3549
|
+
fetchFailureCount: 0,
|
|
3550
|
+
fetchFailureReason: null,
|
|
3551
|
+
fetchMeta: null,
|
|
3552
|
+
isInvalidated: !1,
|
|
3553
|
+
status: n ? "success" : "pending",
|
|
3554
|
+
fetchStatus: "idle"
|
|
3555
|
+
};
|
|
3556
|
+
}
|
|
3557
|
+
var _e, ni, wl = (ni = class extends Jt {
|
|
3558
|
+
constructor(t = {}) {
|
|
3559
|
+
super();
|
|
3560
|
+
I(this, _e, void 0);
|
|
3561
|
+
this.config = t, k(this, _e, /* @__PURE__ */ new Map());
|
|
3562
|
+
}
|
|
3563
|
+
build(t, n, s) {
|
|
3564
|
+
const r = n.queryKey, i = n.queryHash ?? Zs(r, n);
|
|
3565
|
+
let o = this.get(i);
|
|
3566
|
+
return o || (o = new vl({
|
|
3567
|
+
cache: this,
|
|
3568
|
+
queryKey: r,
|
|
3569
|
+
queryHash: i,
|
|
3570
|
+
options: t.defaultQueryOptions(n),
|
|
3571
|
+
state: s,
|
|
3572
|
+
defaultOptions: t.getQueryDefaults(r)
|
|
3573
|
+
}), this.add(o)), o;
|
|
3574
|
+
}
|
|
3575
|
+
add(t) {
|
|
3576
|
+
a(this, _e).has(t.queryHash) || (a(this, _e).set(t.queryHash, t), this.notify({
|
|
3577
|
+
type: "added",
|
|
3578
|
+
query: t
|
|
3579
|
+
}));
|
|
3580
|
+
}
|
|
3581
|
+
remove(t) {
|
|
3582
|
+
const n = a(this, _e).get(t.queryHash);
|
|
3583
|
+
n && (t.destroy(), n === t && a(this, _e).delete(t.queryHash), this.notify({ type: "removed", query: t }));
|
|
3584
|
+
}
|
|
3585
|
+
clear() {
|
|
3586
|
+
ie.batch(() => {
|
|
3587
|
+
this.getAll().forEach((t) => {
|
|
3588
|
+
this.remove(t);
|
|
3589
|
+
});
|
|
3590
|
+
});
|
|
3591
|
+
}
|
|
3592
|
+
get(t) {
|
|
3593
|
+
return a(this, _e).get(t);
|
|
3594
|
+
}
|
|
3595
|
+
getAll() {
|
|
3596
|
+
return [...a(this, _e).values()];
|
|
3597
|
+
}
|
|
3598
|
+
find(t) {
|
|
3599
|
+
const n = { exact: !0, ...t };
|
|
3600
|
+
return this.getAll().find(
|
|
3601
|
+
(s) => Vr(n, s)
|
|
3602
|
+
);
|
|
3603
|
+
}
|
|
3604
|
+
findAll(t = {}) {
|
|
3605
|
+
const n = this.getAll();
|
|
3606
|
+
return Object.keys(t).length > 0 ? n.filter((s) => Vr(t, s)) : n;
|
|
3607
|
+
}
|
|
3608
|
+
notify(t) {
|
|
3609
|
+
ie.batch(() => {
|
|
3610
|
+
this.listeners.forEach((n) => {
|
|
3611
|
+
n(t);
|
|
3612
|
+
});
|
|
3613
|
+
});
|
|
3614
|
+
}
|
|
3615
|
+
onFocus() {
|
|
3616
|
+
ie.batch(() => {
|
|
3617
|
+
this.getAll().forEach((t) => {
|
|
3618
|
+
t.onFocus();
|
|
3619
|
+
});
|
|
3620
|
+
});
|
|
3621
|
+
}
|
|
3622
|
+
onOnline() {
|
|
3623
|
+
ie.batch(() => {
|
|
3624
|
+
this.getAll().forEach((t) => {
|
|
3625
|
+
t.onOnline();
|
|
3626
|
+
});
|
|
3627
|
+
});
|
|
3628
|
+
}
|
|
3629
|
+
}, _e = new WeakMap(), ni), je, hn, pe, Rt, Ie, Ue, si, Sl = (si = class extends yo {
|
|
3630
|
+
constructor(t) {
|
|
3631
|
+
super();
|
|
3632
|
+
I(this, Ie);
|
|
3633
|
+
I(this, je, void 0);
|
|
3634
|
+
I(this, hn, void 0);
|
|
3635
|
+
I(this, pe, void 0);
|
|
3636
|
+
I(this, Rt, void 0);
|
|
3637
|
+
this.mutationId = t.mutationId, k(this, hn, t.defaultOptions), k(this, pe, t.mutationCache), k(this, je, []), this.state = t.state || vo(), this.setOptions(t.options), this.scheduleGc();
|
|
3638
|
+
}
|
|
3639
|
+
setOptions(t) {
|
|
3640
|
+
this.options = { ...a(this, hn), ...t }, this.updateGcTime(this.options.gcTime);
|
|
3641
|
+
}
|
|
3642
|
+
get meta() {
|
|
3643
|
+
return this.options.meta;
|
|
3644
|
+
}
|
|
3645
|
+
addObserver(t) {
|
|
3646
|
+
a(this, je).includes(t) || (a(this, je).push(t), this.clearGcTimeout(), a(this, pe).notify({
|
|
3647
|
+
type: "observerAdded",
|
|
3648
|
+
mutation: this,
|
|
3649
|
+
observer: t
|
|
3650
|
+
}));
|
|
3651
|
+
}
|
|
3652
|
+
removeObserver(t) {
|
|
3653
|
+
k(this, je, a(this, je).filter((n) => n !== t)), this.scheduleGc(), a(this, pe).notify({
|
|
3654
|
+
type: "observerRemoved",
|
|
3655
|
+
mutation: this,
|
|
3656
|
+
observer: t
|
|
3657
|
+
});
|
|
3658
|
+
}
|
|
3659
|
+
optionalRemove() {
|
|
3660
|
+
a(this, je).length || (this.state.status === "pending" ? this.scheduleGc() : a(this, pe).remove(this));
|
|
3661
|
+
}
|
|
3662
|
+
continue() {
|
|
3663
|
+
var t;
|
|
3664
|
+
return ((t = a(this, Rt)) == null ? void 0 : t.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
3665
|
+
this.execute(this.state.variables);
|
|
3666
|
+
}
|
|
3667
|
+
async execute(t) {
|
|
3668
|
+
var r, i, o, c, l, u, f, m, A, g, C, _, y, P, L, R, S, E, F, T;
|
|
3669
|
+
const n = () => (k(this, Rt, go({
|
|
3670
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(t) : Promise.reject(new Error("No mutationFn found")),
|
|
3671
|
+
onFail: (D, p) => {
|
|
3672
|
+
Q(this, Ie, Ue).call(this, { type: "failed", failureCount: D, error: p });
|
|
3673
|
+
},
|
|
3674
|
+
onPause: () => {
|
|
3675
|
+
Q(this, Ie, Ue).call(this, { type: "pause" });
|
|
3676
|
+
},
|
|
3677
|
+
onContinue: () => {
|
|
3678
|
+
Q(this, Ie, Ue).call(this, { type: "continue" });
|
|
3679
|
+
},
|
|
3680
|
+
retry: this.options.retry ?? 0,
|
|
3681
|
+
retryDelay: this.options.retryDelay,
|
|
3682
|
+
networkMode: this.options.networkMode
|
|
3683
|
+
})), a(this, Rt).promise), s = this.state.status === "pending";
|
|
3684
|
+
try {
|
|
3685
|
+
if (!s) {
|
|
3686
|
+
Q(this, Ie, Ue).call(this, { type: "pending", variables: t }), await ((i = (r = a(this, pe).config).onMutate) == null ? void 0 : i.call(
|
|
3687
|
+
r,
|
|
3688
|
+
t,
|
|
3689
|
+
this
|
|
3690
|
+
));
|
|
3691
|
+
const p = await ((c = (o = this.options).onMutate) == null ? void 0 : c.call(o, t));
|
|
3692
|
+
p !== this.state.context && Q(this, Ie, Ue).call(this, {
|
|
3693
|
+
type: "pending",
|
|
3694
|
+
context: p,
|
|
3695
|
+
variables: t
|
|
3696
|
+
});
|
|
3697
|
+
}
|
|
3698
|
+
const D = await n();
|
|
3699
|
+
return await ((u = (l = a(this, pe).config).onSuccess) == null ? void 0 : u.call(
|
|
3700
|
+
l,
|
|
3701
|
+
D,
|
|
3702
|
+
t,
|
|
3703
|
+
this.state.context,
|
|
3704
|
+
this
|
|
3705
|
+
)), await ((m = (f = this.options).onSuccess) == null ? void 0 : m.call(f, D, t, this.state.context)), await ((g = (A = a(this, pe).config).onSettled) == null ? void 0 : g.call(
|
|
3706
|
+
A,
|
|
3707
|
+
D,
|
|
3708
|
+
null,
|
|
3709
|
+
this.state.variables,
|
|
3710
|
+
this.state.context,
|
|
3711
|
+
this
|
|
3712
|
+
)), await ((_ = (C = this.options).onSettled) == null ? void 0 : _.call(C, D, null, t, this.state.context)), Q(this, Ie, Ue).call(this, { type: "success", data: D }), D;
|
|
3713
|
+
} catch (D) {
|
|
3714
|
+
try {
|
|
3715
|
+
throw await ((P = (y = a(this, pe).config).onError) == null ? void 0 : P.call(
|
|
3716
|
+
y,
|
|
3717
|
+
D,
|
|
3718
|
+
t,
|
|
3719
|
+
this.state.context,
|
|
3720
|
+
this
|
|
3721
|
+
)), await ((R = (L = this.options).onError) == null ? void 0 : R.call(
|
|
3722
|
+
L,
|
|
3723
|
+
D,
|
|
3724
|
+
t,
|
|
3725
|
+
this.state.context
|
|
3726
|
+
)), await ((E = (S = a(this, pe).config).onSettled) == null ? void 0 : E.call(
|
|
3727
|
+
S,
|
|
3728
|
+
void 0,
|
|
3729
|
+
D,
|
|
3730
|
+
this.state.variables,
|
|
3731
|
+
this.state.context,
|
|
3732
|
+
this
|
|
3733
|
+
)), await ((T = (F = this.options).onSettled) == null ? void 0 : T.call(
|
|
3734
|
+
F,
|
|
3735
|
+
void 0,
|
|
3736
|
+
D,
|
|
3737
|
+
t,
|
|
3738
|
+
this.state.context
|
|
3739
|
+
)), D;
|
|
3740
|
+
} finally {
|
|
3741
|
+
Q(this, Ie, Ue).call(this, { type: "error", error: D });
|
|
3742
|
+
}
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
}, je = new WeakMap(), hn = new WeakMap(), pe = new WeakMap(), Rt = new WeakMap(), Ie = new WeakSet(), Ue = function(t) {
|
|
3746
|
+
const n = (s) => {
|
|
3747
|
+
switch (t.type) {
|
|
3748
|
+
case "failed":
|
|
3749
|
+
return {
|
|
3750
|
+
...s,
|
|
3751
|
+
failureCount: t.failureCount,
|
|
3752
|
+
failureReason: t.error
|
|
3753
|
+
};
|
|
3754
|
+
case "pause":
|
|
3755
|
+
return {
|
|
3756
|
+
...s,
|
|
3757
|
+
isPaused: !0
|
|
3758
|
+
};
|
|
3759
|
+
case "continue":
|
|
3760
|
+
return {
|
|
3761
|
+
...s,
|
|
3762
|
+
isPaused: !1
|
|
3763
|
+
};
|
|
3764
|
+
case "pending":
|
|
3765
|
+
return {
|
|
3766
|
+
...s,
|
|
3767
|
+
context: t.context,
|
|
3768
|
+
data: void 0,
|
|
3769
|
+
failureCount: 0,
|
|
3770
|
+
failureReason: null,
|
|
3771
|
+
error: null,
|
|
3772
|
+
isPaused: !rs(this.options.networkMode),
|
|
3773
|
+
status: "pending",
|
|
3774
|
+
variables: t.variables,
|
|
3775
|
+
submittedAt: Date.now()
|
|
3776
|
+
};
|
|
3777
|
+
case "success":
|
|
3778
|
+
return {
|
|
3779
|
+
...s,
|
|
3780
|
+
data: t.data,
|
|
3781
|
+
failureCount: 0,
|
|
3782
|
+
failureReason: null,
|
|
3783
|
+
error: null,
|
|
3784
|
+
status: "success",
|
|
3785
|
+
isPaused: !1
|
|
3786
|
+
};
|
|
3787
|
+
case "error":
|
|
3788
|
+
return {
|
|
3789
|
+
...s,
|
|
3790
|
+
data: void 0,
|
|
3791
|
+
error: t.error,
|
|
3792
|
+
failureCount: s.failureCount + 1,
|
|
3793
|
+
failureReason: t.error,
|
|
3794
|
+
isPaused: !1,
|
|
3795
|
+
status: "error"
|
|
3796
|
+
};
|
|
3797
|
+
}
|
|
3798
|
+
};
|
|
3799
|
+
this.state = n(this.state), ie.batch(() => {
|
|
3800
|
+
a(this, je).forEach((s) => {
|
|
3801
|
+
s.onMutationUpdate(t);
|
|
3802
|
+
}), a(this, pe).notify({
|
|
3803
|
+
mutation: this,
|
|
3804
|
+
type: "updated",
|
|
3805
|
+
action: t
|
|
3806
|
+
});
|
|
3807
|
+
});
|
|
3808
|
+
}, si);
|
|
3809
|
+
function vo() {
|
|
3810
|
+
return {
|
|
3811
|
+
context: void 0,
|
|
3812
|
+
data: void 0,
|
|
3813
|
+
error: null,
|
|
3814
|
+
failureCount: 0,
|
|
3815
|
+
failureReason: null,
|
|
3816
|
+
isPaused: !1,
|
|
3817
|
+
status: "idle",
|
|
3818
|
+
variables: void 0,
|
|
3819
|
+
submittedAt: 0
|
|
3820
|
+
};
|
|
3821
|
+
}
|
|
3822
|
+
var ve, pn, ot, ri, xl = (ri = class extends Jt {
|
|
3823
|
+
constructor(t = {}) {
|
|
3824
|
+
super();
|
|
3825
|
+
I(this, ve, void 0);
|
|
3826
|
+
I(this, pn, void 0);
|
|
3827
|
+
I(this, ot, void 0);
|
|
3828
|
+
this.config = t, k(this, ve, []), k(this, pn, 0);
|
|
3829
|
+
}
|
|
3830
|
+
build(t, n, s) {
|
|
3831
|
+
const r = new Sl({
|
|
3832
|
+
mutationCache: this,
|
|
3833
|
+
mutationId: ++On(this, pn)._,
|
|
3834
|
+
options: t.defaultMutationOptions(n),
|
|
3835
|
+
state: s
|
|
3836
|
+
});
|
|
3837
|
+
return this.add(r), r;
|
|
3838
|
+
}
|
|
3839
|
+
add(t) {
|
|
3840
|
+
a(this, ve).push(t), this.notify({ type: "added", mutation: t });
|
|
3841
|
+
}
|
|
3842
|
+
remove(t) {
|
|
3843
|
+
k(this, ve, a(this, ve).filter((n) => n !== t)), this.notify({ type: "removed", mutation: t });
|
|
3844
|
+
}
|
|
3845
|
+
clear() {
|
|
3846
|
+
ie.batch(() => {
|
|
3847
|
+
a(this, ve).forEach((t) => {
|
|
3848
|
+
this.remove(t);
|
|
3849
|
+
});
|
|
3850
|
+
});
|
|
3851
|
+
}
|
|
3852
|
+
getAll() {
|
|
3853
|
+
return a(this, ve);
|
|
3854
|
+
}
|
|
3855
|
+
find(t) {
|
|
3856
|
+
const n = { exact: !0, ...t };
|
|
3857
|
+
return a(this, ve).find(
|
|
3858
|
+
(s) => Kr(n, s)
|
|
3859
|
+
);
|
|
3860
|
+
}
|
|
3861
|
+
findAll(t = {}) {
|
|
3862
|
+
return a(this, ve).filter(
|
|
3863
|
+
(n) => Kr(t, n)
|
|
3864
|
+
);
|
|
3865
|
+
}
|
|
3866
|
+
notify(t) {
|
|
3867
|
+
ie.batch(() => {
|
|
3868
|
+
this.listeners.forEach((n) => {
|
|
3869
|
+
n(t);
|
|
3870
|
+
});
|
|
3871
|
+
});
|
|
3872
|
+
}
|
|
3873
|
+
resumePausedMutations() {
|
|
3874
|
+
return k(this, ot, (a(this, ot) ?? Promise.resolve()).then(() => {
|
|
3875
|
+
const t = a(this, ve).filter((n) => n.state.isPaused);
|
|
3876
|
+
return ie.batch(
|
|
3877
|
+
() => t.reduce(
|
|
3878
|
+
(n, s) => n.then(() => s.continue().catch(we)),
|
|
3879
|
+
Promise.resolve()
|
|
3880
|
+
)
|
|
3881
|
+
);
|
|
3882
|
+
}).then(() => {
|
|
3883
|
+
k(this, ot, void 0);
|
|
3884
|
+
})), a(this, ot);
|
|
3885
|
+
}
|
|
3886
|
+
}, ve = new WeakMap(), pn = new WeakMap(), ot = new WeakMap(), ri);
|
|
3887
|
+
function kl(e) {
|
|
3888
|
+
return {
|
|
3889
|
+
onFetch: (t, n) => {
|
|
3890
|
+
const s = async () => {
|
|
3891
|
+
var C, _, y, P, L;
|
|
3892
|
+
const r = t.options, i = (y = (_ = (C = t.fetchOptions) == null ? void 0 : C.meta) == null ? void 0 : _.fetchMore) == null ? void 0 : y.direction, o = ((P = t.state.data) == null ? void 0 : P.pages) || [], c = ((L = t.state.data) == null ? void 0 : L.pageParams) || [], l = { pages: [], pageParams: [] };
|
|
3893
|
+
let u = !1;
|
|
3894
|
+
const f = (R) => {
|
|
3895
|
+
Object.defineProperty(R, "signal", {
|
|
3896
|
+
enumerable: !0,
|
|
3897
|
+
get: () => (t.signal.aborted ? u = !0 : t.signal.addEventListener("abort", () => {
|
|
3898
|
+
u = !0;
|
|
3899
|
+
}), t.signal)
|
|
3900
|
+
});
|
|
3901
|
+
}, m = t.options.queryFn || (() => Promise.reject(
|
|
3902
|
+
new Error(`Missing queryFn: '${t.options.queryHash}'`)
|
|
3903
|
+
)), A = async (R, S, E) => {
|
|
3904
|
+
if (u)
|
|
3905
|
+
return Promise.reject();
|
|
3906
|
+
if (S == null && R.pages.length)
|
|
3907
|
+
return Promise.resolve(R);
|
|
3908
|
+
const F = {
|
|
3909
|
+
queryKey: t.queryKey,
|
|
3910
|
+
pageParam: S,
|
|
3911
|
+
direction: E ? "backward" : "forward",
|
|
3912
|
+
meta: t.options.meta
|
|
3913
|
+
};
|
|
3914
|
+
f(F);
|
|
3915
|
+
const T = await m(
|
|
3916
|
+
F
|
|
3917
|
+
), { maxPages: D } = t.options, p = E ? hl : fl;
|
|
3918
|
+
return {
|
|
3919
|
+
pages: p(R.pages, T, D),
|
|
3920
|
+
pageParams: p(R.pageParams, S, D)
|
|
3921
|
+
};
|
|
3922
|
+
};
|
|
3923
|
+
let g;
|
|
3924
|
+
if (i && o.length) {
|
|
3925
|
+
const R = i === "backward", S = R ? Al : Hr, E = {
|
|
3926
|
+
pages: o,
|
|
3927
|
+
pageParams: c
|
|
3928
|
+
}, F = S(r, E);
|
|
3929
|
+
g = await A(E, F, R);
|
|
3930
|
+
} else {
|
|
3931
|
+
g = await A(
|
|
3932
|
+
l,
|
|
3933
|
+
c[0] ?? r.initialPageParam
|
|
3934
|
+
);
|
|
3935
|
+
const R = e ?? o.length;
|
|
3936
|
+
for (let S = 1; S < R; S++) {
|
|
3937
|
+
const E = Hr(r, g);
|
|
3938
|
+
g = await A(g, E);
|
|
3939
|
+
}
|
|
3940
|
+
}
|
|
3941
|
+
return g;
|
|
3942
|
+
};
|
|
3943
|
+
t.options.persister ? t.fetchFn = () => {
|
|
3944
|
+
var r, i;
|
|
3945
|
+
return (i = (r = t.options).persister) == null ? void 0 : i.call(
|
|
3946
|
+
r,
|
|
3947
|
+
s,
|
|
3948
|
+
{
|
|
3949
|
+
queryKey: t.queryKey,
|
|
3950
|
+
meta: t.options.meta,
|
|
3951
|
+
signal: t.signal
|
|
3952
|
+
},
|
|
3953
|
+
n
|
|
3954
|
+
);
|
|
3955
|
+
} : t.fetchFn = s;
|
|
3956
|
+
}
|
|
3957
|
+
};
|
|
3958
|
+
}
|
|
3959
|
+
function Hr(e, { pages: t, pageParams: n }) {
|
|
3960
|
+
const s = t.length - 1;
|
|
3961
|
+
return e.getNextPageParam(
|
|
3962
|
+
t[s],
|
|
3963
|
+
t,
|
|
3964
|
+
n[s],
|
|
3965
|
+
n
|
|
3966
|
+
);
|
|
3967
|
+
}
|
|
3968
|
+
function Al(e, { pages: t, pageParams: n }) {
|
|
3969
|
+
var s;
|
|
3970
|
+
return (s = e.getPreviousPageParam) == null ? void 0 : s.call(
|
|
3971
|
+
e,
|
|
3972
|
+
t[0],
|
|
3973
|
+
t,
|
|
3974
|
+
n[0],
|
|
3975
|
+
n
|
|
3976
|
+
);
|
|
3977
|
+
}
|
|
3978
|
+
var re, Ge, We, Dt, Mt, He, Lt, Nt, ii, El = (ii = class {
|
|
3979
|
+
constructor(e = {}) {
|
|
3980
|
+
I(this, re, void 0);
|
|
3981
|
+
I(this, Ge, void 0);
|
|
3982
|
+
I(this, We, void 0);
|
|
3983
|
+
I(this, Dt, void 0);
|
|
3984
|
+
I(this, Mt, void 0);
|
|
3985
|
+
I(this, He, void 0);
|
|
3986
|
+
I(this, Lt, void 0);
|
|
3987
|
+
I(this, Nt, void 0);
|
|
3988
|
+
k(this, re, e.queryCache || new wl()), k(this, Ge, e.mutationCache || new xl()), k(this, We, e.defaultOptions || {}), k(this, Dt, /* @__PURE__ */ new Map()), k(this, Mt, /* @__PURE__ */ new Map()), k(this, He, 0);
|
|
3989
|
+
}
|
|
3990
|
+
mount() {
|
|
3991
|
+
On(this, He)._++, a(this, He) === 1 && (k(this, Lt, Kn.subscribe(() => {
|
|
3992
|
+
Kn.isFocused() && (this.resumePausedMutations(), a(this, re).onFocus());
|
|
3993
|
+
})), k(this, Nt, zn.subscribe(() => {
|
|
3994
|
+
zn.isOnline() && (this.resumePausedMutations(), a(this, re).onOnline());
|
|
3995
|
+
})));
|
|
3996
|
+
}
|
|
3997
|
+
unmount() {
|
|
3998
|
+
var e, t;
|
|
3999
|
+
On(this, He)._--, a(this, He) === 0 && ((e = a(this, Lt)) == null || e.call(this), k(this, Lt, void 0), (t = a(this, Nt)) == null || t.call(this), k(this, Nt, void 0));
|
|
4000
|
+
}
|
|
4001
|
+
isFetching(e) {
|
|
4002
|
+
return a(this, re).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
4003
|
+
}
|
|
4004
|
+
isMutating(e) {
|
|
4005
|
+
return a(this, Ge).findAll({ ...e, status: "pending" }).length;
|
|
4006
|
+
}
|
|
4007
|
+
getQueryData(e) {
|
|
4008
|
+
var t;
|
|
4009
|
+
return (t = a(this, re).find({ queryKey: e })) == null ? void 0 : t.state.data;
|
|
4010
|
+
}
|
|
4011
|
+
ensureQueryData(e) {
|
|
4012
|
+
const t = this.getQueryData(e.queryKey);
|
|
4013
|
+
return t !== void 0 ? Promise.resolve(t) : this.fetchQuery(e);
|
|
4014
|
+
}
|
|
4015
|
+
getQueriesData(e) {
|
|
4016
|
+
return this.getQueryCache().findAll(e).map(({ queryKey: t, state: n }) => {
|
|
4017
|
+
const s = n.data;
|
|
4018
|
+
return [t, s];
|
|
4019
|
+
});
|
|
4020
|
+
}
|
|
4021
|
+
setQueryData(e, t, n) {
|
|
4022
|
+
const s = a(this, re).find({ queryKey: e }), r = s == null ? void 0 : s.state.data, i = dl(t, r);
|
|
4023
|
+
if (typeof i > "u")
|
|
4024
|
+
return;
|
|
4025
|
+
const o = this.defaultQueryOptions({ queryKey: e });
|
|
4026
|
+
return a(this, re).build(this, o).setData(i, { ...n, manual: !0 });
|
|
4027
|
+
}
|
|
4028
|
+
setQueriesData(e, t, n) {
|
|
4029
|
+
return ie.batch(
|
|
4030
|
+
() => this.getQueryCache().findAll(e).map(({ queryKey: s }) => [
|
|
4031
|
+
s,
|
|
4032
|
+
this.setQueryData(s, t, n)
|
|
4033
|
+
])
|
|
4034
|
+
);
|
|
4035
|
+
}
|
|
4036
|
+
getQueryState(e) {
|
|
4037
|
+
var t;
|
|
4038
|
+
return (t = a(this, re).find({ queryKey: e })) == null ? void 0 : t.state;
|
|
4039
|
+
}
|
|
4040
|
+
removeQueries(e) {
|
|
4041
|
+
const t = a(this, re);
|
|
4042
|
+
ie.batch(() => {
|
|
4043
|
+
t.findAll(e).forEach((n) => {
|
|
4044
|
+
t.remove(n);
|
|
4045
|
+
});
|
|
4046
|
+
});
|
|
4047
|
+
}
|
|
4048
|
+
resetQueries(e, t) {
|
|
4049
|
+
const n = a(this, re), s = {
|
|
4050
|
+
type: "active",
|
|
4051
|
+
...e
|
|
4052
|
+
};
|
|
4053
|
+
return ie.batch(() => (n.findAll(e).forEach((r) => {
|
|
4054
|
+
r.reset();
|
|
4055
|
+
}), this.refetchQueries(s, t)));
|
|
4056
|
+
}
|
|
4057
|
+
cancelQueries(e = {}, t = {}) {
|
|
4058
|
+
const n = { revert: !0, ...t }, s = ie.batch(
|
|
4059
|
+
() => a(this, re).findAll(e).map((r) => r.cancel(n))
|
|
4060
|
+
);
|
|
4061
|
+
return Promise.all(s).then(we).catch(we);
|
|
4062
|
+
}
|
|
4063
|
+
invalidateQueries(e = {}, t = {}) {
|
|
4064
|
+
return ie.batch(() => {
|
|
4065
|
+
if (a(this, re).findAll(e).forEach((s) => {
|
|
4066
|
+
s.invalidate();
|
|
4067
|
+
}), e.refetchType === "none")
|
|
4068
|
+
return Promise.resolve();
|
|
4069
|
+
const n = {
|
|
4070
|
+
...e,
|
|
4071
|
+
type: e.refetchType ?? e.type ?? "active"
|
|
4072
|
+
};
|
|
4073
|
+
return this.refetchQueries(n, t);
|
|
4074
|
+
});
|
|
4075
|
+
}
|
|
4076
|
+
refetchQueries(e = {}, t) {
|
|
4077
|
+
const n = {
|
|
4078
|
+
...t,
|
|
4079
|
+
cancelRefetch: (t == null ? void 0 : t.cancelRefetch) ?? !0
|
|
4080
|
+
}, s = ie.batch(
|
|
4081
|
+
() => a(this, re).findAll(e).filter((r) => !r.isDisabled()).map((r) => {
|
|
4082
|
+
let i = r.fetch(void 0, n);
|
|
4083
|
+
return n.throwOnError || (i = i.catch(we)), r.state.fetchStatus === "paused" ? Promise.resolve() : i;
|
|
4084
|
+
})
|
|
4085
|
+
);
|
|
4086
|
+
return Promise.all(s).then(we);
|
|
4087
|
+
}
|
|
4088
|
+
fetchQuery(e) {
|
|
4089
|
+
const t = this.defaultQueryOptions(e);
|
|
4090
|
+
typeof t.retry > "u" && (t.retry = !1);
|
|
4091
|
+
const n = a(this, re).build(this, t);
|
|
4092
|
+
return n.isStaleByTime(t.staleTime) ? n.fetch(t) : Promise.resolve(n.state.data);
|
|
4093
|
+
}
|
|
4094
|
+
prefetchQuery(e) {
|
|
4095
|
+
return this.fetchQuery(e).then(we).catch(we);
|
|
4096
|
+
}
|
|
4097
|
+
fetchInfiniteQuery(e) {
|
|
4098
|
+
return e.behavior = kl(e.pages), this.fetchQuery(e);
|
|
4099
|
+
}
|
|
4100
|
+
prefetchInfiniteQuery(e) {
|
|
4101
|
+
return this.fetchInfiniteQuery(e).then(we).catch(we);
|
|
4102
|
+
}
|
|
4103
|
+
resumePausedMutations() {
|
|
4104
|
+
return a(this, Ge).resumePausedMutations();
|
|
4105
|
+
}
|
|
4106
|
+
getQueryCache() {
|
|
4107
|
+
return a(this, re);
|
|
4108
|
+
}
|
|
4109
|
+
getMutationCache() {
|
|
4110
|
+
return a(this, Ge);
|
|
4111
|
+
}
|
|
4112
|
+
getDefaultOptions() {
|
|
4113
|
+
return a(this, We);
|
|
4114
|
+
}
|
|
4115
|
+
setDefaultOptions(e) {
|
|
4116
|
+
k(this, We, e);
|
|
4117
|
+
}
|
|
4118
|
+
setQueryDefaults(e, t) {
|
|
4119
|
+
a(this, Dt).set(ln(e), {
|
|
4120
|
+
queryKey: e,
|
|
4121
|
+
defaultOptions: t
|
|
4122
|
+
});
|
|
4123
|
+
}
|
|
4124
|
+
getQueryDefaults(e) {
|
|
4125
|
+
const t = [...a(this, Dt).values()];
|
|
4126
|
+
let n = {};
|
|
4127
|
+
return t.forEach((s) => {
|
|
4128
|
+
dn(e, s.queryKey) && (n = { ...n, ...s.defaultOptions });
|
|
4129
|
+
}), n;
|
|
4130
|
+
}
|
|
4131
|
+
setMutationDefaults(e, t) {
|
|
4132
|
+
a(this, Mt).set(ln(e), {
|
|
4133
|
+
mutationKey: e,
|
|
4134
|
+
defaultOptions: t
|
|
4135
|
+
});
|
|
4136
|
+
}
|
|
4137
|
+
getMutationDefaults(e) {
|
|
4138
|
+
const t = [...a(this, Mt).values()];
|
|
4139
|
+
let n = {};
|
|
4140
|
+
return t.forEach((s) => {
|
|
4141
|
+
dn(e, s.mutationKey) && (n = { ...n, ...s.defaultOptions });
|
|
4142
|
+
}), n;
|
|
4143
|
+
}
|
|
4144
|
+
defaultQueryOptions(e) {
|
|
4145
|
+
if (e != null && e._defaulted)
|
|
4146
|
+
return e;
|
|
4147
|
+
const t = {
|
|
4148
|
+
...a(this, We).queries,
|
|
4149
|
+
...(e == null ? void 0 : e.queryKey) && this.getQueryDefaults(e.queryKey),
|
|
4150
|
+
...e,
|
|
4151
|
+
_defaulted: !0
|
|
4152
|
+
};
|
|
4153
|
+
return t.queryHash || (t.queryHash = Zs(
|
|
4154
|
+
t.queryKey,
|
|
4155
|
+
t
|
|
4156
|
+
)), typeof t.refetchOnReconnect > "u" && (t.refetchOnReconnect = t.networkMode !== "always"), typeof t.throwOnError > "u" && (t.throwOnError = !!t.suspense), typeof t.networkMode > "u" && t.persister && (t.networkMode = "offlineFirst"), t;
|
|
4157
|
+
}
|
|
4158
|
+
defaultMutationOptions(e) {
|
|
4159
|
+
return e != null && e._defaulted ? e : {
|
|
4160
|
+
...a(this, We).mutations,
|
|
4161
|
+
...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
|
|
4162
|
+
...e,
|
|
4163
|
+
_defaulted: !0
|
|
4164
|
+
};
|
|
4165
|
+
}
|
|
4166
|
+
clear() {
|
|
4167
|
+
a(this, re).clear(), a(this, Ge).clear();
|
|
4168
|
+
}
|
|
4169
|
+
}, re = new WeakMap(), Ge = new WeakMap(), We = new WeakMap(), Dt = new WeakMap(), Mt = new WeakMap(), He = new WeakMap(), Lt = new WeakMap(), Nt = new WeakMap(), ii), fe, X, Tt, ue, at, Ft, Be, mn, Ut, qt, ct, ut, Je, lt, dt, nn, gn, Ps, yn, Os, vn, Cs, bn, _s, wn, js, Sn, Is, xn, Bs, Gn, bo, oi, Pl = (oi = class extends Jt {
|
|
4170
|
+
constructor(t, n) {
|
|
4171
|
+
super();
|
|
4172
|
+
I(this, dt);
|
|
4173
|
+
I(this, gn);
|
|
4174
|
+
I(this, yn);
|
|
4175
|
+
I(this, vn);
|
|
4176
|
+
I(this, bn);
|
|
4177
|
+
I(this, wn);
|
|
4178
|
+
I(this, Sn);
|
|
4179
|
+
I(this, xn);
|
|
4180
|
+
I(this, Gn);
|
|
4181
|
+
I(this, fe, void 0);
|
|
4182
|
+
I(this, X, void 0);
|
|
4183
|
+
I(this, Tt, void 0);
|
|
4184
|
+
I(this, ue, void 0);
|
|
4185
|
+
I(this, at, void 0);
|
|
4186
|
+
I(this, Ft, void 0);
|
|
4187
|
+
I(this, Be, void 0);
|
|
4188
|
+
I(this, mn, void 0);
|
|
4189
|
+
I(this, Ut, void 0);
|
|
4190
|
+
// This property keeps track of the last query with defined data.
|
|
4191
|
+
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
4192
|
+
I(this, qt, void 0);
|
|
4193
|
+
I(this, ct, void 0);
|
|
4194
|
+
I(this, ut, void 0);
|
|
4195
|
+
I(this, Je, void 0);
|
|
4196
|
+
I(this, lt, void 0);
|
|
4197
|
+
k(this, X, void 0), k(this, Tt, void 0), k(this, ue, void 0), k(this, lt, /* @__PURE__ */ new Set()), k(this, fe, t), this.options = n, k(this, Be, null), this.bindMethods(), this.setOptions(n);
|
|
4198
|
+
}
|
|
4199
|
+
bindMethods() {
|
|
4200
|
+
this.refetch = this.refetch.bind(this);
|
|
4201
|
+
}
|
|
4202
|
+
onSubscribe() {
|
|
4203
|
+
this.listeners.size === 1 && (a(this, X).addObserver(this), Jr(a(this, X), this.options) ? Q(this, dt, nn).call(this) : this.updateResult(), Q(this, bn, _s).call(this));
|
|
4204
|
+
}
|
|
4205
|
+
onUnsubscribe() {
|
|
4206
|
+
this.hasListeners() || this.destroy();
|
|
4207
|
+
}
|
|
4208
|
+
shouldFetchOnReconnect() {
|
|
4209
|
+
return Rs(
|
|
4210
|
+
a(this, X),
|
|
4211
|
+
this.options,
|
|
4212
|
+
this.options.refetchOnReconnect
|
|
4213
|
+
);
|
|
4214
|
+
}
|
|
4215
|
+
shouldFetchOnWindowFocus() {
|
|
4216
|
+
return Rs(
|
|
4217
|
+
a(this, X),
|
|
4218
|
+
this.options,
|
|
4219
|
+
this.options.refetchOnWindowFocus
|
|
4220
|
+
);
|
|
4221
|
+
}
|
|
4222
|
+
destroy() {
|
|
4223
|
+
this.listeners = /* @__PURE__ */ new Set(), Q(this, wn, js).call(this), Q(this, Sn, Is).call(this), a(this, X).removeObserver(this);
|
|
4224
|
+
}
|
|
4225
|
+
setOptions(t, n) {
|
|
4226
|
+
const s = this.options, r = a(this, X);
|
|
4227
|
+
if (this.options = a(this, fe).defaultQueryOptions(t), Vn(s, this.options) || a(this, fe).getQueryCache().notify({
|
|
4228
|
+
type: "observerOptionsUpdated",
|
|
4229
|
+
query: a(this, X),
|
|
4230
|
+
observer: this
|
|
4231
|
+
}), typeof this.options.enabled < "u" && typeof this.options.enabled != "boolean")
|
|
4232
|
+
throw new Error("Expected enabled to be a boolean");
|
|
4233
|
+
this.options.queryKey || (this.options.queryKey = s.queryKey), Q(this, xn, Bs).call(this);
|
|
4234
|
+
const i = this.hasListeners();
|
|
4235
|
+
i && Yr(
|
|
4236
|
+
a(this, X),
|
|
4237
|
+
r,
|
|
4238
|
+
this.options,
|
|
4239
|
+
s
|
|
4240
|
+
) && Q(this, dt, nn).call(this), this.updateResult(n), i && (a(this, X) !== r || this.options.enabled !== s.enabled || this.options.staleTime !== s.staleTime) && Q(this, gn, Ps).call(this);
|
|
4241
|
+
const o = Q(this, yn, Os).call(this);
|
|
4242
|
+
i && (a(this, X) !== r || this.options.enabled !== s.enabled || o !== a(this, Je)) && Q(this, vn, Cs).call(this, o);
|
|
4243
|
+
}
|
|
4244
|
+
getOptimisticResult(t) {
|
|
4245
|
+
const n = a(this, fe).getQueryCache().build(a(this, fe), t), s = this.createResult(n, t);
|
|
4246
|
+
return Cl(this, s) && (k(this, ue, s), k(this, Ft, this.options), k(this, at, a(this, X).state)), s;
|
|
4247
|
+
}
|
|
4248
|
+
getCurrentResult() {
|
|
4249
|
+
return a(this, ue);
|
|
4250
|
+
}
|
|
4251
|
+
trackResult(t) {
|
|
4252
|
+
const n = {};
|
|
4253
|
+
return Object.keys(t).forEach((s) => {
|
|
4254
|
+
Object.defineProperty(n, s, {
|
|
4255
|
+
configurable: !1,
|
|
4256
|
+
enumerable: !0,
|
|
4257
|
+
get: () => (a(this, lt).add(s), t[s])
|
|
4258
|
+
});
|
|
4259
|
+
}), n;
|
|
4260
|
+
}
|
|
4261
|
+
getCurrentQuery() {
|
|
4262
|
+
return a(this, X);
|
|
4263
|
+
}
|
|
4264
|
+
refetch({ ...t } = {}) {
|
|
4265
|
+
return this.fetch({
|
|
4266
|
+
...t
|
|
4267
|
+
});
|
|
4268
|
+
}
|
|
4269
|
+
fetchOptimistic(t) {
|
|
4270
|
+
const n = a(this, fe).defaultQueryOptions(t), s = a(this, fe).getQueryCache().build(a(this, fe), n);
|
|
4271
|
+
return s.isFetchingOptimistic = !0, s.fetch().then(() => this.createResult(s, n));
|
|
4272
|
+
}
|
|
4273
|
+
fetch(t) {
|
|
4274
|
+
return Q(this, dt, nn).call(this, {
|
|
4275
|
+
...t,
|
|
4276
|
+
cancelRefetch: t.cancelRefetch ?? !0
|
|
4277
|
+
}).then(() => (this.updateResult(), a(this, ue)));
|
|
4278
|
+
}
|
|
4279
|
+
createResult(t, n) {
|
|
4280
|
+
var F;
|
|
4281
|
+
const s = a(this, X), r = this.options, i = a(this, ue), o = a(this, at), c = a(this, Ft), u = t !== s ? t.state : a(this, Tt), { state: f } = t;
|
|
4282
|
+
let { error: m, errorUpdatedAt: A, fetchStatus: g, status: C } = f, _ = !1, y;
|
|
4283
|
+
if (n._optimisticResults) {
|
|
4284
|
+
const T = this.hasListeners(), D = !T && Jr(t, n), p = T && Yr(t, s, n, r);
|
|
4285
|
+
(D || p) && (g = rs(t.options.networkMode) ? "fetching" : "paused", f.dataUpdatedAt || (C = "pending")), n._optimisticResults === "isRestoring" && (g = "idle");
|
|
4286
|
+
}
|
|
4287
|
+
if (n.select && typeof f.data < "u")
|
|
4288
|
+
if (i && f.data === (o == null ? void 0 : o.data) && n.select === a(this, mn))
|
|
4289
|
+
y = a(this, Ut);
|
|
4290
|
+
else
|
|
4291
|
+
try {
|
|
4292
|
+
k(this, mn, n.select), y = n.select(f.data), y = Es(i == null ? void 0 : i.data, y, n), k(this, Ut, y), k(this, Be, null);
|
|
4293
|
+
} catch (T) {
|
|
4294
|
+
k(this, Be, T);
|
|
4295
|
+
}
|
|
4296
|
+
else
|
|
4297
|
+
y = f.data;
|
|
4298
|
+
if (typeof n.placeholderData < "u" && typeof y > "u" && C === "pending") {
|
|
4299
|
+
let T;
|
|
4300
|
+
if (i != null && i.isPlaceholderData && n.placeholderData === (c == null ? void 0 : c.placeholderData))
|
|
4301
|
+
T = i.data;
|
|
4302
|
+
else if (T = typeof n.placeholderData == "function" ? n.placeholderData(
|
|
4303
|
+
(F = a(this, qt)) == null ? void 0 : F.state.data,
|
|
4304
|
+
a(this, qt)
|
|
4305
|
+
) : n.placeholderData, n.select && typeof T < "u")
|
|
4306
|
+
try {
|
|
4307
|
+
T = n.select(T), k(this, Be, null);
|
|
4308
|
+
} catch (D) {
|
|
4309
|
+
k(this, Be, D);
|
|
4310
|
+
}
|
|
4311
|
+
typeof T < "u" && (C = "success", y = Es(
|
|
4312
|
+
i == null ? void 0 : i.data,
|
|
4313
|
+
T,
|
|
4314
|
+
n
|
|
4315
|
+
), _ = !0);
|
|
4316
|
+
}
|
|
4317
|
+
a(this, Be) && (m = a(this, Be), y = a(this, Ut), A = Date.now(), C = "error");
|
|
4318
|
+
const P = g === "fetching", L = C === "pending", R = C === "error", S = L && P;
|
|
4319
|
+
return {
|
|
4320
|
+
status: C,
|
|
4321
|
+
fetchStatus: g,
|
|
4322
|
+
isPending: L,
|
|
4323
|
+
isSuccess: C === "success",
|
|
4324
|
+
isError: R,
|
|
4325
|
+
isInitialLoading: S,
|
|
4326
|
+
isLoading: S,
|
|
4327
|
+
data: y,
|
|
4328
|
+
dataUpdatedAt: f.dataUpdatedAt,
|
|
4329
|
+
error: m,
|
|
4330
|
+
errorUpdatedAt: A,
|
|
4331
|
+
failureCount: f.fetchFailureCount,
|
|
4332
|
+
failureReason: f.fetchFailureReason,
|
|
4333
|
+
errorUpdateCount: f.errorUpdateCount,
|
|
4334
|
+
isFetched: f.dataUpdateCount > 0 || f.errorUpdateCount > 0,
|
|
4335
|
+
isFetchedAfterMount: f.dataUpdateCount > u.dataUpdateCount || f.errorUpdateCount > u.errorUpdateCount,
|
|
4336
|
+
isFetching: P,
|
|
4337
|
+
isRefetching: P && !L,
|
|
4338
|
+
isLoadingError: R && f.dataUpdatedAt === 0,
|
|
4339
|
+
isPaused: g === "paused",
|
|
4340
|
+
isPlaceholderData: _,
|
|
4341
|
+
isRefetchError: R && f.dataUpdatedAt !== 0,
|
|
4342
|
+
isStale: Xs(t, n),
|
|
4343
|
+
refetch: this.refetch
|
|
4344
|
+
};
|
|
4345
|
+
}
|
|
4346
|
+
updateResult(t) {
|
|
4347
|
+
const n = a(this, ue), s = this.createResult(a(this, X), this.options);
|
|
4348
|
+
if (k(this, at, a(this, X).state), k(this, Ft, this.options), a(this, at).data !== void 0 && k(this, qt, a(this, X)), Vn(s, n))
|
|
4349
|
+
return;
|
|
4350
|
+
k(this, ue, s);
|
|
4351
|
+
const r = {}, i = () => {
|
|
4352
|
+
if (!n)
|
|
4353
|
+
return !0;
|
|
4354
|
+
const { notifyOnChangeProps: o } = this.options, c = typeof o == "function" ? o() : o;
|
|
4355
|
+
if (c === "all" || !c && !a(this, lt).size)
|
|
4356
|
+
return !0;
|
|
4357
|
+
const l = new Set(
|
|
4358
|
+
c ?? a(this, lt)
|
|
4359
|
+
);
|
|
4360
|
+
return this.options.throwOnError && l.add("error"), Object.keys(a(this, ue)).some((u) => {
|
|
4361
|
+
const f = u;
|
|
4362
|
+
return a(this, ue)[f] !== n[f] && l.has(f);
|
|
4363
|
+
});
|
|
4364
|
+
};
|
|
4365
|
+
(t == null ? void 0 : t.listeners) !== !1 && i() && (r.listeners = !0), Q(this, Gn, bo).call(this, { ...r, ...t });
|
|
4366
|
+
}
|
|
4367
|
+
onQueryUpdate() {
|
|
4368
|
+
this.updateResult(), this.hasListeners() && Q(this, bn, _s).call(this);
|
|
4369
|
+
}
|
|
4370
|
+
}, fe = new WeakMap(), X = new WeakMap(), Tt = new WeakMap(), ue = new WeakMap(), at = new WeakMap(), Ft = new WeakMap(), Be = new WeakMap(), mn = new WeakMap(), Ut = new WeakMap(), qt = new WeakMap(), ct = new WeakMap(), ut = new WeakMap(), Je = new WeakMap(), lt = new WeakMap(), dt = new WeakSet(), nn = function(t) {
|
|
4371
|
+
Q(this, xn, Bs).call(this);
|
|
4372
|
+
let n = a(this, X).fetch(
|
|
4373
|
+
this.options,
|
|
4374
|
+
t
|
|
4375
|
+
);
|
|
4376
|
+
return t != null && t.throwOnError || (n = n.catch(we)), n;
|
|
4377
|
+
}, gn = new WeakSet(), Ps = function() {
|
|
4378
|
+
if (Q(this, wn, js).call(this), zt || a(this, ue).isStale || !ks(this.options.staleTime))
|
|
4379
|
+
return;
|
|
4380
|
+
const n = fo(
|
|
4381
|
+
a(this, ue).dataUpdatedAt,
|
|
4382
|
+
this.options.staleTime
|
|
4383
|
+
) + 1;
|
|
4384
|
+
k(this, ct, setTimeout(() => {
|
|
4385
|
+
a(this, ue).isStale || this.updateResult();
|
|
4386
|
+
}, n));
|
|
4387
|
+
}, yn = new WeakSet(), Os = function() {
|
|
4388
|
+
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(a(this, X)) : this.options.refetchInterval) ?? !1;
|
|
4389
|
+
}, vn = new WeakSet(), Cs = function(t) {
|
|
4390
|
+
Q(this, Sn, Is).call(this), k(this, Je, t), !(zt || this.options.enabled === !1 || !ks(a(this, Je)) || a(this, Je) === 0) && k(this, ut, setInterval(() => {
|
|
4391
|
+
(this.options.refetchIntervalInBackground || Kn.isFocused()) && Q(this, dt, nn).call(this);
|
|
4392
|
+
}, a(this, Je)));
|
|
4393
|
+
}, bn = new WeakSet(), _s = function() {
|
|
4394
|
+
Q(this, gn, Ps).call(this), Q(this, vn, Cs).call(this, Q(this, yn, Os).call(this));
|
|
4395
|
+
}, wn = new WeakSet(), js = function() {
|
|
4396
|
+
a(this, ct) && (clearTimeout(a(this, ct)), k(this, ct, void 0));
|
|
4397
|
+
}, Sn = new WeakSet(), Is = function() {
|
|
4398
|
+
a(this, ut) && (clearInterval(a(this, ut)), k(this, ut, void 0));
|
|
4399
|
+
}, xn = new WeakSet(), Bs = function() {
|
|
4400
|
+
const t = a(this, fe).getQueryCache().build(a(this, fe), this.options);
|
|
4401
|
+
if (t === a(this, X))
|
|
4402
|
+
return;
|
|
4403
|
+
const n = a(this, X);
|
|
4404
|
+
k(this, X, t), k(this, Tt, t.state), this.hasListeners() && (n == null || n.removeObserver(this), t.addObserver(this));
|
|
4405
|
+
}, Gn = new WeakSet(), bo = function(t) {
|
|
4406
|
+
ie.batch(() => {
|
|
4407
|
+
t.listeners && this.listeners.forEach((n) => {
|
|
4408
|
+
n(a(this, ue));
|
|
4409
|
+
}), a(this, fe).getQueryCache().notify({
|
|
4410
|
+
query: a(this, X),
|
|
4411
|
+
type: "observerResultsUpdated"
|
|
4412
|
+
});
|
|
4413
|
+
});
|
|
4414
|
+
}, oi);
|
|
4415
|
+
function Ol(e, t) {
|
|
4416
|
+
return t.enabled !== !1 && !e.state.dataUpdatedAt && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
4417
|
+
}
|
|
4418
|
+
function Jr(e, t) {
|
|
4419
|
+
return Ol(e, t) || e.state.dataUpdatedAt > 0 && Rs(e, t, t.refetchOnMount);
|
|
4420
|
+
}
|
|
4421
|
+
function Rs(e, t, n) {
|
|
4422
|
+
if (t.enabled !== !1) {
|
|
4423
|
+
const s = typeof n == "function" ? n(e) : n;
|
|
4424
|
+
return s === "always" || s !== !1 && Xs(e, t);
|
|
4425
|
+
}
|
|
4426
|
+
return !1;
|
|
4427
|
+
}
|
|
4428
|
+
function Yr(e, t, n, s) {
|
|
4429
|
+
return n.enabled !== !1 && (e !== t || s.enabled === !1) && (!n.suspense || e.state.status !== "error") && Xs(e, n);
|
|
4430
|
+
}
|
|
4431
|
+
function Xs(e, t) {
|
|
4432
|
+
return e.isStaleByTime(t.staleTime);
|
|
4433
|
+
}
|
|
4434
|
+
function Cl(e, t) {
|
|
4435
|
+
return !Vn(e.getCurrentResult(), t);
|
|
4436
|
+
}
|
|
4437
|
+
var Ye, le, be, Le, $t, Fn, kn, Ds, ai, _l = (ai = class extends Jt {
|
|
4438
|
+
constructor(t, n) {
|
|
4439
|
+
super();
|
|
4440
|
+
I(this, $t);
|
|
4441
|
+
I(this, kn);
|
|
4442
|
+
I(this, Ye, void 0);
|
|
4443
|
+
I(this, le, void 0);
|
|
4444
|
+
I(this, be, void 0);
|
|
4445
|
+
I(this, Le, void 0);
|
|
4446
|
+
k(this, le, void 0), k(this, Ye, t), this.setOptions(n), this.bindMethods(), Q(this, $t, Fn).call(this);
|
|
4447
|
+
}
|
|
4448
|
+
bindMethods() {
|
|
4449
|
+
this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
|
|
4450
|
+
}
|
|
4451
|
+
setOptions(t) {
|
|
4452
|
+
var s;
|
|
4453
|
+
const n = this.options;
|
|
4454
|
+
this.options = a(this, Ye).defaultMutationOptions(t), Vn(n, this.options) || a(this, Ye).getMutationCache().notify({
|
|
4455
|
+
type: "observerOptionsUpdated",
|
|
4456
|
+
mutation: a(this, be),
|
|
4457
|
+
observer: this
|
|
4458
|
+
}), (s = a(this, be)) == null || s.setOptions(this.options);
|
|
4459
|
+
}
|
|
4460
|
+
onUnsubscribe() {
|
|
4461
|
+
var t;
|
|
4462
|
+
this.hasListeners() || (t = a(this, be)) == null || t.removeObserver(this);
|
|
4463
|
+
}
|
|
4464
|
+
onMutationUpdate(t) {
|
|
4465
|
+
Q(this, $t, Fn).call(this), Q(this, kn, Ds).call(this, t);
|
|
4466
|
+
}
|
|
4467
|
+
getCurrentResult() {
|
|
4468
|
+
return a(this, le);
|
|
4469
|
+
}
|
|
4470
|
+
reset() {
|
|
4471
|
+
k(this, be, void 0), Q(this, $t, Fn).call(this), Q(this, kn, Ds).call(this);
|
|
4472
|
+
}
|
|
4473
|
+
mutate(t, n) {
|
|
4474
|
+
var s;
|
|
4475
|
+
return k(this, Le, n), (s = a(this, be)) == null || s.removeObserver(this), k(this, be, a(this, Ye).getMutationCache().build(a(this, Ye), this.options)), a(this, be).addObserver(this), a(this, be).execute(t);
|
|
4476
|
+
}
|
|
4477
|
+
}, Ye = new WeakMap(), le = new WeakMap(), be = new WeakMap(), Le = new WeakMap(), $t = new WeakSet(), Fn = function() {
|
|
4478
|
+
var n;
|
|
4479
|
+
const t = ((n = a(this, be)) == null ? void 0 : n.state) ?? vo();
|
|
4480
|
+
k(this, le, {
|
|
4481
|
+
...t,
|
|
4482
|
+
isPending: t.status === "pending",
|
|
4483
|
+
isSuccess: t.status === "success",
|
|
4484
|
+
isError: t.status === "error",
|
|
4485
|
+
isIdle: t.status === "idle",
|
|
4486
|
+
mutate: this.mutate,
|
|
4487
|
+
reset: this.reset
|
|
4488
|
+
});
|
|
4489
|
+
}, kn = new WeakSet(), Ds = function(t) {
|
|
4490
|
+
ie.batch(() => {
|
|
4491
|
+
var n, s, r, i, o, c, l, u;
|
|
4492
|
+
a(this, Le) && this.hasListeners() && ((t == null ? void 0 : t.type) === "success" ? ((s = (n = a(this, Le)).onSuccess) == null || s.call(
|
|
4493
|
+
n,
|
|
4494
|
+
t.data,
|
|
4495
|
+
a(this, le).variables,
|
|
4496
|
+
a(this, le).context
|
|
4497
|
+
), (i = (r = a(this, Le)).onSettled) == null || i.call(
|
|
4498
|
+
r,
|
|
4499
|
+
t.data,
|
|
4500
|
+
null,
|
|
4501
|
+
a(this, le).variables,
|
|
4502
|
+
a(this, le).context
|
|
4503
|
+
)) : (t == null ? void 0 : t.type) === "error" && ((c = (o = a(this, Le)).onError) == null || c.call(
|
|
4504
|
+
o,
|
|
4505
|
+
t.error,
|
|
4506
|
+
a(this, le).variables,
|
|
4507
|
+
a(this, le).context
|
|
4508
|
+
), (u = (l = a(this, Le)).onSettled) == null || u.call(
|
|
4509
|
+
l,
|
|
4510
|
+
void 0,
|
|
4511
|
+
t.error,
|
|
4512
|
+
a(this, le).variables,
|
|
4513
|
+
a(this, le).context
|
|
4514
|
+
))), this.listeners.forEach((f) => {
|
|
4515
|
+
f(a(this, le));
|
|
4516
|
+
});
|
|
4517
|
+
});
|
|
4518
|
+
}, ai), wo = ae.createContext(
|
|
4519
|
+
void 0
|
|
4520
|
+
), Yt = (e) => {
|
|
4521
|
+
const t = ae.useContext(wo);
|
|
4522
|
+
if (e)
|
|
4523
|
+
return e;
|
|
4524
|
+
if (!t)
|
|
4525
|
+
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
4526
|
+
return t;
|
|
4527
|
+
}, jl = ({
|
|
4528
|
+
client: e,
|
|
4529
|
+
children: t
|
|
4530
|
+
}) => (ae.useEffect(() => (e.mount(), () => {
|
|
4531
|
+
e.unmount();
|
|
4532
|
+
}), [e]), /* @__PURE__ */ ae.createElement(wo.Provider, { value: e }, t)), So = ae.createContext(!1), Il = () => ae.useContext(So);
|
|
4533
|
+
So.Provider;
|
|
4534
|
+
function Bl() {
|
|
4535
|
+
let e = !1;
|
|
4536
|
+
return {
|
|
4537
|
+
clearReset: () => {
|
|
4538
|
+
e = !1;
|
|
4539
|
+
},
|
|
4540
|
+
reset: () => {
|
|
4541
|
+
e = !0;
|
|
4542
|
+
},
|
|
4543
|
+
isReset: () => e
|
|
4544
|
+
};
|
|
4545
|
+
}
|
|
4546
|
+
var Rl = ae.createContext(Bl()), Dl = () => ae.useContext(Rl);
|
|
4547
|
+
function xo(e, t) {
|
|
4548
|
+
return typeof e == "function" ? e(...t) : !!e;
|
|
4549
|
+
}
|
|
4550
|
+
var Ml = (e, t) => {
|
|
4551
|
+
(e.suspense || e.throwOnError) && (t.isReset() || (e.retryOnMount = !1));
|
|
4552
|
+
}, Ll = (e) => {
|
|
4553
|
+
ae.useEffect(() => {
|
|
4554
|
+
e.clearReset();
|
|
4555
|
+
}, [e]);
|
|
4556
|
+
}, Nl = ({
|
|
4557
|
+
result: e,
|
|
4558
|
+
errorResetBoundary: t,
|
|
4559
|
+
throwOnError: n,
|
|
4560
|
+
query: s
|
|
4561
|
+
}) => e.isError && !t.isReset() && !e.isFetching && xo(n, [e.error, s]), Tl = (e) => {
|
|
4562
|
+
e.suspense && typeof e.staleTime != "number" && (e.staleTime = 1e3);
|
|
4563
|
+
}, Fl = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending, Ul = (e, t, n) => t.fetchOptimistic(e).catch(() => {
|
|
4564
|
+
n.clearReset();
|
|
4565
|
+
});
|
|
4566
|
+
function ql(e, t, n) {
|
|
4567
|
+
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
4568
|
+
throw new Error(
|
|
4569
|
+
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
4570
|
+
);
|
|
4571
|
+
const s = Yt(n), r = Il(), i = Dl(), o = s.defaultQueryOptions(e);
|
|
4572
|
+
o._optimisticResults = r ? "isRestoring" : "optimistic", Tl(o), Ml(o, i), Ll(i);
|
|
4573
|
+
const [c] = ae.useState(
|
|
4574
|
+
() => new t(
|
|
4575
|
+
s,
|
|
4576
|
+
o
|
|
4577
|
+
)
|
|
4578
|
+
), l = c.getOptimisticResult(o);
|
|
4579
|
+
if (ae.useSyncExternalStore(
|
|
4580
|
+
ae.useCallback(
|
|
4581
|
+
(u) => {
|
|
4582
|
+
const f = r ? () => {
|
|
4583
|
+
} : c.subscribe(ie.batchCalls(u));
|
|
4584
|
+
return c.updateResult(), f;
|
|
4585
|
+
},
|
|
4586
|
+
[c, r]
|
|
4587
|
+
),
|
|
4588
|
+
() => c.getCurrentResult(),
|
|
4589
|
+
() => c.getCurrentResult()
|
|
4590
|
+
), ae.useEffect(() => {
|
|
4591
|
+
c.setOptions(o, { listeners: !1 });
|
|
4592
|
+
}, [o, c]), Fl(o, l))
|
|
4593
|
+
throw Ul(o, c, i);
|
|
4594
|
+
if (Nl({
|
|
4595
|
+
result: l,
|
|
4596
|
+
errorResetBoundary: i,
|
|
4597
|
+
throwOnError: o.throwOnError,
|
|
4598
|
+
query: c.getCurrentQuery()
|
|
4599
|
+
}))
|
|
4600
|
+
throw l.error;
|
|
4601
|
+
return o.notifyOnChangeProps ? l : c.trackResult(l);
|
|
4602
|
+
}
|
|
4603
|
+
function is(e, t) {
|
|
4604
|
+
return ql(e, Pl, t);
|
|
4605
|
+
}
|
|
4606
|
+
function $l(e, t) {
|
|
4607
|
+
const n = Yt(t), [s] = ae.useState(
|
|
4608
|
+
() => new _l(
|
|
4609
|
+
n,
|
|
4610
|
+
e
|
|
4611
|
+
)
|
|
4612
|
+
);
|
|
4613
|
+
ae.useEffect(() => {
|
|
4614
|
+
s.setOptions(e);
|
|
4615
|
+
}, [s, e]);
|
|
4616
|
+
const r = ae.useSyncExternalStore(
|
|
4617
|
+
ae.useCallback(
|
|
4618
|
+
(o) => s.subscribe(ie.batchCalls(o)),
|
|
4619
|
+
[s]
|
|
4620
|
+
),
|
|
4621
|
+
() => s.getCurrentResult(),
|
|
4622
|
+
() => s.getCurrentResult()
|
|
4623
|
+
), i = ae.useCallback(
|
|
4624
|
+
(o, c) => {
|
|
4625
|
+
s.mutate(o, c).catch(Ql);
|
|
4626
|
+
},
|
|
4627
|
+
[s]
|
|
4628
|
+
);
|
|
4629
|
+
if (r.error && xo(s.options.throwOnError, [r.error]))
|
|
4630
|
+
throw r.error;
|
|
4631
|
+
return { ...r, mutate: i, mutateAsync: r.mutate };
|
|
4632
|
+
}
|
|
4633
|
+
function Ql() {
|
|
4634
|
+
}
|
|
4635
|
+
const Vl = () => is({
|
|
4636
|
+
queryKey: ["user"],
|
|
4637
|
+
queryFn: async () => await localStorage.getItem("__nano_id")
|
|
4638
|
+
}), Kl = () => /* @__PURE__ */ x.jsx("section", { className: "py-10 h-screen bg-gray-50 sm:py-16 lg:py-24", children: /* @__PURE__ */ x.jsxs("div", { className: "px-4 mx-auto max-w-7xl sm:px-6 lg:px-8", children: [
|
|
4639
|
+
/* @__PURE__ */ x.jsxs("div", { className: "max-w-2xl mx-auto text-center", children: [
|
|
4640
|
+
/* @__PURE__ */ x.jsx("h2", { className: "text-3xl font-bold leading-tight text-black sm:text-4xl lg:text-5xl", children: "Welcome Back!" }),
|
|
4641
|
+
/* @__PURE__ */ x.jsx("p", { className: "max-w-xl mx-auto mt-4 text-base leading-relaxed text-gray-600", children: "Login to your account" })
|
|
4642
|
+
] }),
|
|
4643
|
+
/* @__PURE__ */ x.jsx("div", { className: "relative max-w-md mx-auto mt-8 md:mt-16", children: /* @__PURE__ */ x.jsx("div", { className: "overflow-hidden bg-white rounded-md shadow-md", children: /* @__PURE__ */ x.jsx("div", { className: "px-4 py-6 sm:px-8 sm:py-7", children: /* @__PURE__ */ x.jsx("form", { action: "#", method: "POST", children: /* @__PURE__ */ x.jsxs("div", { className: "space-y-5", children: [
|
|
4644
|
+
/* @__PURE__ */ x.jsxs("div", { children: [
|
|
4645
|
+
/* @__PURE__ */ x.jsx("label", { htmlFor: "", className: "text-base font-medium text-gray-900", children: "Email address" }),
|
|
4646
|
+
/* @__PURE__ */ x.jsxs("div", { className: "mt-2.5 relative text-gray-400 focus-within:text-gray-600", children: [
|
|
4647
|
+
/* @__PURE__ */ x.jsx("div", { className: "absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none", children: /* @__PURE__ */ x.jsx(
|
|
4648
|
+
"svg",
|
|
4649
|
+
{
|
|
4650
|
+
className: "w-5 h-5",
|
|
4651
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4652
|
+
fill: "none",
|
|
4653
|
+
viewBox: "0 0 24 24",
|
|
4654
|
+
stroke: "currentColor",
|
|
4655
|
+
children: /* @__PURE__ */ x.jsx(
|
|
4656
|
+
"path",
|
|
4657
|
+
{
|
|
4658
|
+
strokeLinecap: "round",
|
|
4659
|
+
strokeLinejoin: "round",
|
|
4660
|
+
strokeWidth: "2",
|
|
4661
|
+
d: "M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207"
|
|
4662
|
+
}
|
|
4663
|
+
)
|
|
4664
|
+
}
|
|
4665
|
+
) }),
|
|
4666
|
+
/* @__PURE__ */ x.jsx(
|
|
4667
|
+
"input",
|
|
4668
|
+
{
|
|
4669
|
+
type: "email",
|
|
4670
|
+
name: "",
|
|
4671
|
+
id: "",
|
|
4672
|
+
placeholder: "Enter email to get started",
|
|
4673
|
+
className: "block w-full py-4 pl-10 pr-4 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"
|
|
4674
|
+
}
|
|
4675
|
+
)
|
|
4676
|
+
] })
|
|
4677
|
+
] }),
|
|
4678
|
+
/* @__PURE__ */ x.jsxs("div", { children: [
|
|
4679
|
+
/* @__PURE__ */ x.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ x.jsx("label", { htmlFor: "", className: "text-base font-medium text-gray-900", children: "Password" }) }),
|
|
4680
|
+
/* @__PURE__ */ x.jsxs("div", { className: "mt-2.5 relative text-gray-400 focus-within:text-gray-600", children: [
|
|
4681
|
+
/* @__PURE__ */ x.jsx("div", { className: "absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none", children: /* @__PURE__ */ x.jsx(
|
|
4682
|
+
"svg",
|
|
4683
|
+
{
|
|
4684
|
+
className: "w-5 h-5",
|
|
4685
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4686
|
+
fill: "none",
|
|
4687
|
+
viewBox: "0 0 24 24",
|
|
4688
|
+
stroke: "currentColor",
|
|
4689
|
+
children: /* @__PURE__ */ x.jsx(
|
|
4690
|
+
"path",
|
|
4691
|
+
{
|
|
4692
|
+
strokeLinecap: "round",
|
|
4693
|
+
strokeLinejoin: "round",
|
|
4694
|
+
strokeWidth: "2",
|
|
4695
|
+
d: "M12 11c0 3.517-1.009 6.799-2.753 9.571m-3.44-2.04l.054-.09A13.916 13.916 0 008 11a4 4 0 118 0c0 1.017-.07 2.019-.203 3m-2.118 6.844A21.88 21.88 0 0015.171 17m3.839 1.132c.645-2.266.99-4.659.99-7.132A8 8 0 008 4.07M3 15.364c.64-1.319 1-2.8 1-4.364 0-1.457.39-2.823 1.07-4"
|
|
4696
|
+
}
|
|
4697
|
+
)
|
|
4698
|
+
}
|
|
4699
|
+
) }),
|
|
4700
|
+
/* @__PURE__ */ x.jsx(
|
|
4701
|
+
"input",
|
|
4702
|
+
{
|
|
4703
|
+
type: "password",
|
|
4704
|
+
name: "",
|
|
4705
|
+
id: "",
|
|
4706
|
+
placeholder: "Enter your password",
|
|
4707
|
+
className: "block w-full py-4 pl-10 pr-4 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"
|
|
4708
|
+
}
|
|
4709
|
+
)
|
|
4710
|
+
] })
|
|
4711
|
+
] }),
|
|
4712
|
+
/* @__PURE__ */ x.jsx("div", { children: /* @__PURE__ */ x.jsx(
|
|
4713
|
+
"button",
|
|
4714
|
+
{
|
|
4715
|
+
type: "submit",
|
|
4716
|
+
className: "inline-flex items-center justify-center w-full px-4 py-4 text-base font-semibold text-white transition-all duration-200 bg-blue-600 border border-transparent rounded-md focus:outline-none hover:bg-blue-700 focus:bg-blue-700",
|
|
4717
|
+
children: "Log in"
|
|
4718
|
+
}
|
|
4719
|
+
) })
|
|
4720
|
+
] }) }) }) }) })
|
|
4721
|
+
] }) });
|
|
4722
|
+
function os() {
|
|
4723
|
+
return Yt().getQueryData(["apiBaseUrl"]) || "/api/chaibuilder";
|
|
4724
|
+
}
|
|
4725
|
+
const ko = () => {
|
|
4726
|
+
const e = Yt();
|
|
4727
|
+
let t = e.getQueryData(["currentPage"]);
|
|
4728
|
+
return t || (t = localStorage.getItem("currentPage")), [
|
|
4729
|
+
t || "",
|
|
4730
|
+
(n) => {
|
|
4731
|
+
localStorage.setItem("currentPage", n || ""), e.setQueryData(["currentPage"], n || "");
|
|
4732
|
+
}
|
|
4733
|
+
];
|
|
4734
|
+
}, er = () => {
|
|
4735
|
+
const [e, t] = ko(), n = os();
|
|
4736
|
+
return is({
|
|
4737
|
+
queryKey: ["project"],
|
|
4738
|
+
queryFn: async () => {
|
|
4739
|
+
const s = await fetch(`${n}/project`).then((r) => r.json());
|
|
4740
|
+
return !e && s && t(s.homepage), s;
|
|
4741
|
+
}
|
|
4742
|
+
});
|
|
4743
|
+
}, zl = () => {
|
|
4744
|
+
const { data: e } = er(), t = os(), n = e == null ? void 0 : e.uuid;
|
|
4745
|
+
return is({
|
|
4746
|
+
queryKey: ["pages", n],
|
|
4747
|
+
queryFn: async () => await fetch(`${t}/pages`).then((r) => r.json()) || [],
|
|
4748
|
+
enabled: !!n
|
|
4749
|
+
});
|
|
4750
|
+
}, Gl = () => {
|
|
4751
|
+
const [e, t] = ko(), { data: n } = er(), s = os();
|
|
4752
|
+
return is({
|
|
4753
|
+
queryKey: ["page_data", e],
|
|
4754
|
+
queryFn: async () => {
|
|
4755
|
+
const r = await fetch(`${s}/page?uuid=${e}`);
|
|
4756
|
+
return r.ok ? r.json() : (t(n.homepage), null);
|
|
4757
|
+
},
|
|
4758
|
+
enabled: !!e
|
|
4759
|
+
});
|
|
4760
|
+
}, Un = () => /* @__PURE__ */ x.jsx("div", { className: "h-screen w-screen", children: /* @__PURE__ */ x.jsx("div", { className: "flex h-full w-full justify-center items-center", children: /* @__PURE__ */ x.jsxs("div", { role: "status", children: [
|
|
4761
|
+
/* @__PURE__ */ x.jsxs(
|
|
4762
|
+
"svg",
|
|
4763
|
+
{
|
|
4764
|
+
"aria-hidden": "true",
|
|
4765
|
+
className: "w-8 mx-auto mb-4 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",
|
|
4766
|
+
viewBox: "0 0 100 101",
|
|
4767
|
+
fill: "none",
|
|
4768
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4769
|
+
children: [
|
|
4770
|
+
/* @__PURE__ */ x.jsx(
|
|
4771
|
+
"path",
|
|
4772
|
+
{
|
|
4773
|
+
d: "M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",
|
|
4774
|
+
fill: "currentColor"
|
|
4775
|
+
}
|
|
4776
|
+
),
|
|
4777
|
+
/* @__PURE__ */ x.jsx(
|
|
4778
|
+
"path",
|
|
4779
|
+
{
|
|
4780
|
+
d: "M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",
|
|
4781
|
+
fill: "currentFill"
|
|
4782
|
+
}
|
|
4783
|
+
)
|
|
4784
|
+
]
|
|
4785
|
+
}
|
|
4786
|
+
),
|
|
4787
|
+
/* @__PURE__ */ x.jsx("p", { children: "Loading... Please wait..." }),
|
|
4788
|
+
/* @__PURE__ */ x.jsx("span", { className: "sr-only", children: "Loading..." })
|
|
4789
|
+
] }) }) }), Wl = (e = "Project updated successfully.") => {
|
|
4790
|
+
const t = Yt(), n = os();
|
|
4791
|
+
return $l({
|
|
4792
|
+
mutationFn: async (s) => await fetch(`${n}/project`, {
|
|
4793
|
+
method: "PUT",
|
|
4794
|
+
body: JSON.stringify(s)
|
|
4795
|
+
}),
|
|
4796
|
+
onSuccess: () => {
|
|
4797
|
+
t.invalidateQueries({ queryKey: ["project"] }), Xo.success(e);
|
|
4798
|
+
}
|
|
4799
|
+
});
|
|
4800
|
+
}, Hl = Gt(() => import("./PagesPanel-48d0f29b.js")), Jl = Gt(() => import("./ProjectPanel-e19b9778.js")), Yl = () => /* @__PURE__ */ x.jsx("h2", { children: "Your Logo" }), Zl = () => /* @__PURE__ */ x.jsx("div", { className: "border-gray-200 rounded-md p-2 mb-2 border", children: /* @__PURE__ */ x.jsx(Zo, { className: "w-4 h-4 text-red-500" }) }), Xl = () => /* @__PURE__ */ x.jsx(fi, { className: "bg-blue-600 text-white", children: "Publish" }), ed = (e) => {
|
|
4801
|
+
const { data: t, isLoading: n } = er(), { data: s, isLoading: r } = zl(), { data: i } = Gl(), { mutate: o } = Wl(), { logo: c = Yl } = e;
|
|
4802
|
+
return n || !t ? /* @__PURE__ */ x.jsx(Un, {}) : r || !s ? /* @__PURE__ */ x.jsx(Un, {}) : i ? /* @__PURE__ */ x.jsx("div", { className: "bg-background text-foreground", children: /* @__PURE__ */ x.jsx(
|
|
4803
|
+
ll,
|
|
4804
|
+
{
|
|
4805
|
+
blocks: i.blocks,
|
|
4806
|
+
brandingOptions: t.brandingOptions,
|
|
4807
|
+
darkMode: e.darkMode || !1,
|
|
4808
|
+
onSaveBlocks: async ({ blocks: l, type: u }) => {
|
|
4809
|
+
console.log(u, l);
|
|
4810
|
+
},
|
|
4811
|
+
onSaveBrandingOptions: async (l) => {
|
|
4812
|
+
o({ brandingOptions: l });
|
|
4813
|
+
},
|
|
4814
|
+
topBarComponents: {
|
|
4815
|
+
left: [c],
|
|
4816
|
+
right: [Xl]
|
|
4817
|
+
},
|
|
4818
|
+
sideBarComponents: {
|
|
4819
|
+
top: [
|
|
4820
|
+
{ icon: Jo, name: "pages", panel: Hl },
|
|
4821
|
+
{ icon: Yo, name: "settings", panel: Jl }
|
|
4822
|
+
],
|
|
4823
|
+
bottom: [Zl]
|
|
4824
|
+
}
|
|
4825
|
+
}
|
|
4826
|
+
) }) : /* @__PURE__ */ x.jsx(Un, {});
|
|
4827
|
+
}, td = (e) => {
|
|
4828
|
+
const { data: t, isLoading: n } = Vl(), s = Yt();
|
|
4829
|
+
return Ee(() => {
|
|
4830
|
+
s.setQueryData(["apiBaseUrl"], e.apiBaseUrl || "/api/chaibuilder");
|
|
4831
|
+
}, [e.apiBaseUrl, s]), n ? /* @__PURE__ */ x.jsx(Un, {}) : t ? /* @__PURE__ */ x.jsx(Kl, {}) : /* @__PURE__ */ x.jsx(ed, { ...e });
|
|
4832
|
+
}, nd = new El(), af = (e) => /* @__PURE__ */ x.jsx(jl, { client: nd, children: /* @__PURE__ */ x.jsx(td, { ...e }) }), cf = (e) => ({ ...e }), uf = (e) => ({ ...e });
|
|
4833
|
+
export {
|
|
4834
|
+
os as $,
|
|
4835
|
+
jd as A,
|
|
4836
|
+
pc as B,
|
|
4837
|
+
Gd as C,
|
|
4838
|
+
$c as D,
|
|
4839
|
+
ua as E,
|
|
4840
|
+
hr as F,
|
|
4841
|
+
fr as G,
|
|
4842
|
+
Bd as H,
|
|
4843
|
+
$d as I,
|
|
4844
|
+
Kd as J,
|
|
4845
|
+
Vd as K,
|
|
4846
|
+
_d as L,
|
|
4847
|
+
cc as M,
|
|
4848
|
+
zl as N,
|
|
4849
|
+
Wl as O,
|
|
4850
|
+
er as P,
|
|
4851
|
+
Td as Q,
|
|
4852
|
+
Id as R,
|
|
4853
|
+
of as S,
|
|
4854
|
+
Cd as T,
|
|
4855
|
+
tf as U,
|
|
4856
|
+
gc as V,
|
|
4857
|
+
yc as W,
|
|
4858
|
+
ko as X,
|
|
4859
|
+
Lc as Y,
|
|
4860
|
+
Fd as Z,
|
|
4861
|
+
Yt as _,
|
|
4862
|
+
mc as a,
|
|
4863
|
+
$l as a0,
|
|
4864
|
+
cf as a1,
|
|
4865
|
+
uf as a2,
|
|
4866
|
+
ll as a3,
|
|
4867
|
+
Hd as a4,
|
|
4868
|
+
Wd as a5,
|
|
4869
|
+
Xa as a6,
|
|
4870
|
+
sc as a7,
|
|
4871
|
+
Nd as a8,
|
|
4872
|
+
Bi as a9,
|
|
4873
|
+
Ud as aa,
|
|
4874
|
+
qd as ab,
|
|
4875
|
+
Xd as ac,
|
|
4876
|
+
Qd as ad,
|
|
4877
|
+
vc as ae,
|
|
4878
|
+
Ed as af,
|
|
4879
|
+
zd as ag,
|
|
4880
|
+
Jd as ah,
|
|
4881
|
+
Yd as ai,
|
|
4882
|
+
nf as aj,
|
|
4883
|
+
sf as ak,
|
|
4884
|
+
rf as al,
|
|
4885
|
+
af as am,
|
|
4886
|
+
Fa as b,
|
|
4887
|
+
Zn as c,
|
|
4888
|
+
Ld as d,
|
|
4889
|
+
Dd as e,
|
|
4890
|
+
Zd as f,
|
|
4891
|
+
Ua as g,
|
|
4892
|
+
bt as h,
|
|
4893
|
+
Ai as i,
|
|
4894
|
+
ef as j,
|
|
4895
|
+
Md as k,
|
|
4896
|
+
Fi as l,
|
|
4897
|
+
Ni as m,
|
|
4898
|
+
wc as n,
|
|
4899
|
+
Pc as o,
|
|
4900
|
+
Pi as p,
|
|
4901
|
+
Cc as q,
|
|
4902
|
+
ac as r,
|
|
4903
|
+
dc as s,
|
|
4904
|
+
Pd as t,
|
|
4905
|
+
Rd as u,
|
|
4906
|
+
Od as v,
|
|
4907
|
+
Oi as w,
|
|
4908
|
+
Ac as x,
|
|
4909
|
+
za as y,
|
|
4910
|
+
uc as z
|
|
4911
|
+
};
|