@hiai-gg/docsmint 0.3.0 → 0.3.2
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/README.md +26 -23
- package/{packages/sdk/dist → dist}/client.d.ts +16 -1
- package/{packages/sdk/dist → dist}/client.js +25 -1
- package/dist/frontend/DatePicker-BcMD49PV.js +275 -0
- package/dist/frontend/SettingsDialog-DiAyhzw0.js +4852 -0
- package/dist/frontend/ShareDialog-DaZf1raY.js +1317 -0
- package/dist/frontend/api/categories.d.ts +10 -0
- package/dist/frontend/api/categories.js +2 -0
- package/dist/frontend/api/documents.d.ts +10 -0
- package/dist/frontend/api/documents.js +2 -0
- package/dist/frontend/api/folders.d.ts +10 -0
- package/dist/frontend/api/folders.js +2 -0
- package/dist/frontend/api/settings.d.ts +8 -0
- package/dist/frontend/api/settings.js +2 -0
- package/dist/frontend/api/tags.d.ts +11 -0
- package/dist/frontend/api/tags.js +2 -0
- package/dist/frontend/categories-BE6ZpZl8.js +61 -0
- package/dist/frontend/client-B9hzI0W8.js +76 -0
- package/dist/frontend/client-C6QQGb0e.js +2766 -0
- package/dist/frontend/components/settings.d.ts +2 -0
- package/dist/frontend/components/settings.js +2 -0
- package/dist/frontend/components/sidebar.d.ts +2 -0
- package/dist/frontend/components/sidebar.js +4569 -0
- package/dist/frontend/context-DbnW5yib.js +31 -0
- package/dist/frontend/dashboard.d.ts +2 -0
- package/dist/frontend/dashboard.js +2152 -0
- package/dist/frontend/documents-DFVS9SsL.js +83 -0
- package/dist/frontend/extension.d.ts +2 -0
- package/dist/frontend/extension.js +10 -0
- package/dist/frontend/folders-CGe9diAG.js +91 -0
- package/dist/frontend/frontend.css +2 -0
- package/dist/frontend/i18n.d.ts +5 -0
- package/dist/frontend/i18n.js +8 -0
- package/dist/frontend/input-ieWIt8I7.js +257 -0
- package/dist/frontend/messages-CTGAsqFu.js +1106 -0
- package/dist/frontend/resolve-Bl6xmJl_.js +2068 -0
- package/dist/frontend/schemas-DwtKylCJ.js +3002 -0
- package/dist/frontend/search.d.ts +2 -0
- package/dist/frontend/search.js +1001 -0
- package/dist/frontend/settings-PCrOtied.js +1313 -0
- package/dist/frontend/shared-document.d.ts +3 -0
- package/dist/frontend/shared-document.js +193 -0
- package/dist/frontend/tag-C5xrg-bb.js +53 -0
- package/dist/frontend/tag-store.svelte-B3839FYq.js +6152 -0
- package/dist/frontend/tags-DVXTut0p.js +48 -0
- package/dist/frontend/theme.d.ts +4 -0
- package/dist/frontend/theme.js +8 -0
- package/dist/frontend/theme.svelte-ei0QxXa8.js +49 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3 -0
- package/dist/lifecycle.d.ts +90 -0
- package/dist/lifecycle.js +99 -0
- package/{packages/sdk/dist → dist}/types.d.ts +5 -0
- package/dist/workspace.d.ts +21 -0
- package/dist/workspace.js +66 -0
- package/package.json +70 -36
- package/packages/cli/src/index.ts +1 -1
- package/packages/db/src/schema.ts +41 -0
- package/packages/mcp-server/src/index.ts +1 -1
- package/frontend/src/lib/components/editor/shared-document.ts +0 -237
- package/frontend/src/lib/extensions/context.ts +0 -60
- package/frontend/src/lib/extensions/doc-tabs.ts +0 -18
- package/frontend/src/lib/extensions/resolve.ts +0 -48
- package/frontend/src/lib/extensions/types.ts +0 -202
- package/frontend/src/lib/hosts/DocsmintSharedDocumentHost.svelte +0 -65
- package/frontend/src/lib/hosts/HiaiDocsDashboardHost.svelte +0 -1007
- package/frontend/src/lib/hosts/HiaiDocsExtensionProvider.svelte +0 -20
- package/frontend/src/lib/hosts/HiaiDocsSearchHost.svelte +0 -996
- package/frontend/src/lib/hosts/index.ts +0 -25
- package/frontend/src/lib/index.ts +0 -65
- package/frontend/src/lib/stores/doc-tab-registry.svelte.ts +0 -68
- package/packages/sdk/dist/index.d.ts +0 -3
- package/packages/sdk/dist/index.js +0 -1
- /package/{packages/sdk/dist → dist}/types.js +0 -0
|
@@ -0,0 +1,4852 @@
|
|
|
1
|
+
import { $t as e, Dt as t, Er as n, Gt as r, Jt as i, Kt as a, O as o, Qt as s, Tr as c, Xt as l, Yt as u, Zt as d, an as f, cn as p, dn as m, en as h, in as g, ln as _, nn as v, on as y, qt as b, rn as x, sn as ee, tn as S, un as te, zt as ne } from "./messages-CTGAsqFu.js";
|
|
2
|
+
import { t as re } from "./context-DbnW5yib.js";
|
|
3
|
+
import { $ as C, A as w, C as ie, D as T, H as E, I as D, L as O, M as k, N as A, R as ae, S as j, T as oe, _t as M, d as se, dt as ce, et as N, ft as le, g as ue, gt as P, h as de, i as F, it as I, j as L, k as R, lt as fe, n as pe, nt as me, ot as z, q as B, t as he, tt as V, z as ge } from "./client-C6QQGb0e.js";
|
|
4
|
+
import { i as _e, n as ve, r as ye, t as be } from "./resolve-Bl6xmJl_.js";
|
|
5
|
+
import { a as xe, c as Se, i as Ce, n as we, o as Te, r as Ee, s as De, t as Oe } from "./input-ieWIt8I7.js";
|
|
6
|
+
import { t as H } from "./client-B9hzI0W8.js";
|
|
7
|
+
import { i as ke } from "./categories-BE6ZpZl8.js";
|
|
8
|
+
import { a as Ae, c as je, o as U, r as Me, s as Ne } from "./settings-PCrOtied.js";
|
|
9
|
+
import { t as Pe } from "./theme.svelte-ei0QxXa8.js";
|
|
10
|
+
import { onMount as Fe } from "svelte";
|
|
11
|
+
import { goto as Ie } from "$app/navigation";
|
|
12
|
+
import { page as Le } from "$app/state";
|
|
13
|
+
//#region ../node_modules/.bun/lucide-svelte@1.0.1+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/log-out.svelte
|
|
14
|
+
function Re(e, t) {
|
|
15
|
+
let n = he(t, [
|
|
16
|
+
"children",
|
|
17
|
+
"$$slots",
|
|
18
|
+
"$$events",
|
|
19
|
+
"$$legacy"
|
|
20
|
+
]), r = [
|
|
21
|
+
["path", { d: "m16 17 5-5-5-5" }],
|
|
22
|
+
["path", { d: "M21 12H9" }],
|
|
23
|
+
["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }]
|
|
24
|
+
];
|
|
25
|
+
ye(e, F({ name: "log-out" }, () => n, {
|
|
26
|
+
get iconNode() {
|
|
27
|
+
return r;
|
|
28
|
+
},
|
|
29
|
+
children: (e, n) => {
|
|
30
|
+
var r = k();
|
|
31
|
+
ie(N(r), t, "default", {}, null), L(e, r);
|
|
32
|
+
},
|
|
33
|
+
$$slots: { default: !0 }
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region ../node_modules/.bun/lucide-svelte@1.0.1+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/save.svelte
|
|
38
|
+
function ze(e, t) {
|
|
39
|
+
let n = he(t, [
|
|
40
|
+
"children",
|
|
41
|
+
"$$slots",
|
|
42
|
+
"$$events",
|
|
43
|
+
"$$legacy"
|
|
44
|
+
]), r = [
|
|
45
|
+
["path", { d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z" }],
|
|
46
|
+
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7" }],
|
|
47
|
+
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7" }]
|
|
48
|
+
];
|
|
49
|
+
ye(e, F({ name: "save" }, () => n, {
|
|
50
|
+
get iconNode() {
|
|
51
|
+
return r;
|
|
52
|
+
},
|
|
53
|
+
children: (e, n) => {
|
|
54
|
+
var r = k();
|
|
55
|
+
ie(N(r), t, "default", {}, null), L(e, r);
|
|
56
|
+
},
|
|
57
|
+
$$slots: { default: !0 }
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.0.8+3149ccaa93f654b8/node_modules/@hiai-gg/hiai-ui/dist/components/ui/tabs/tabs.svelte
|
|
62
|
+
var Be = A("<div><!></div>");
|
|
63
|
+
function Ve(e, t) {
|
|
64
|
+
le(t, !0);
|
|
65
|
+
let n = pe(t, "value", 15, "");
|
|
66
|
+
var r = Be(), i = C(r), a = (e) => {
|
|
67
|
+
var n = k();
|
|
68
|
+
R(N(n), () => t.children), L(e, n);
|
|
69
|
+
};
|
|
70
|
+
T(i, (e) => {
|
|
71
|
+
t.children && e(a);
|
|
72
|
+
}), M(r), B((e) => {
|
|
73
|
+
de(r, 1, e), se(r, "data-tabs-value", n());
|
|
74
|
+
}, [() => ue(_e("w-full", t.class))]), L(e, r), ce();
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.0.8+3149ccaa93f654b8/node_modules/@hiai-gg/hiai-ui/dist/components/ui/tabs/tabs-content.svelte
|
|
78
|
+
var He = A("<div role=\"tabpanel\"><!></div>");
|
|
79
|
+
function W(e, t) {
|
|
80
|
+
le(t, !0);
|
|
81
|
+
var n = k(), r = N(n), i = (e) => {
|
|
82
|
+
var n = He(), r = C(n), i = (e) => {
|
|
83
|
+
var n = k();
|
|
84
|
+
R(N(n), () => t.children), L(e, n);
|
|
85
|
+
};
|
|
86
|
+
T(r, (e) => {
|
|
87
|
+
t.children && e(i);
|
|
88
|
+
}), M(n), B((e) => de(n, 1, e), [() => ue(_e("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", t.class))]), L(e, n);
|
|
89
|
+
};
|
|
90
|
+
T(r, (e) => {
|
|
91
|
+
t.currentValue === t.value && e(i);
|
|
92
|
+
}), L(e, n), ce();
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.0.8+3149ccaa93f654b8/node_modules/@hiai-gg/hiai-ui/dist/components/ui/tabs/tabs-list.svelte
|
|
96
|
+
var G = A("<div role=\"tablist\"><!></div>");
|
|
97
|
+
function Ue(e, t) {
|
|
98
|
+
le(t, !0);
|
|
99
|
+
var n = G(), r = C(n), i = (e) => {
|
|
100
|
+
var n = k();
|
|
101
|
+
R(N(n), () => t.children), L(e, n);
|
|
102
|
+
};
|
|
103
|
+
T(r, (e) => {
|
|
104
|
+
t.children && e(i);
|
|
105
|
+
}), M(n), B((e) => de(n, 1, e), [() => ue(_e("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground", t.class))]), L(e, n), ce();
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.0.8+3149ccaa93f654b8/node_modules/@hiai-gg/hiai-ui/dist/components/ui/tabs/tabs-trigger.svelte
|
|
109
|
+
var We = A("<button type=\"button\" role=\"tab\"><!></button>");
|
|
110
|
+
function Ge(e, t) {
|
|
111
|
+
le(t, !0);
|
|
112
|
+
let n = pe(t, "selected", 3, !1);
|
|
113
|
+
function r() {
|
|
114
|
+
t.onclick?.(t.value);
|
|
115
|
+
}
|
|
116
|
+
var i = We(), a = C(i), o = (e) => {
|
|
117
|
+
var n = k();
|
|
118
|
+
R(N(n), () => t.children), L(e, n);
|
|
119
|
+
};
|
|
120
|
+
T(a, (e) => {
|
|
121
|
+
t.children && e(o);
|
|
122
|
+
}), M(i), B((e) => {
|
|
123
|
+
se(i, "aria-selected", n()), se(i, "data-state", n() ? "active" : "inactive"), de(i, 1, e);
|
|
124
|
+
}, [() => ue(_e("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", n() ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:bg-accent hover:text-accent-foreground", t.class))]), ae("click", i, r), L(e, i), ce();
|
|
125
|
+
}
|
|
126
|
+
O(["click"]);
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/lib/api/api-keys.ts
|
|
129
|
+
function Ke() {
|
|
130
|
+
return H("/api/keys");
|
|
131
|
+
}
|
|
132
|
+
function qe(e) {
|
|
133
|
+
return H("/api/keys/global", {
|
|
134
|
+
method: "POST",
|
|
135
|
+
body: { name: e }
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function Je(e, t) {
|
|
139
|
+
return H(`/api/categories/${encodeURIComponent(e)}/keys`, {
|
|
140
|
+
method: "POST",
|
|
141
|
+
body: { name: t }
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function Ye(e) {
|
|
145
|
+
return H(`/api/keys/${encodeURIComponent(e)}`, { method: "DELETE" });
|
|
146
|
+
}
|
|
147
|
+
async function Xe(e) {
|
|
148
|
+
return (await H(`/api/keys/${encodeURIComponent(e)}/secret`)).key;
|
|
149
|
+
}
|
|
150
|
+
function Ze(e) {
|
|
151
|
+
for (let t of e) {
|
|
152
|
+
let e = /^category:([0-9a-f-]{36}):(read|edit|write)$/i.exec(t);
|
|
153
|
+
if (e?.[1]) return e[1];
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
function Qe(e, t) {
|
|
158
|
+
return t ?? e.prefix;
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/lib/components/settings/ApiAccessSettings.svelte
|
|
162
|
+
var $e = A("<div class=\"rounded-lg border border-primary/30 bg-primary/10 p-4 text-primary\"><p class=\"text-sm font-medium\">Copy this key now. It will not be shown again.</p> <code class=\"mt-2 block break-all rounded bg-background/80 p-2 text-xs text-foreground\"> </code> <!></div>"), et = A("<p class=\"text-sm text-destructive\" role=\"alert\"> </p>"), tt = A("<p class=\"text-sm text-muted-foreground\">Loading API access…</p>"), nt = A("<div class=\"flex items-center justify-between rounded-md border p-3 text-sm\"><div><div class=\"font-medium\"> </div><div class=\"text-muted-foreground\"> </div></div> <!></div>"), rt = A("<p class=\"text-sm text-muted-foreground\">No global API keys.</p>"), K = A("<div class=\"flex items-center justify-between gap-3 rounded-md border border-dashed p-3 text-sm\"><div><div class=\"font-medium\"> </div><div class=\"text-muted-foreground\"> </div></div> <div class=\"flex shrink-0 gap-2\"><!> <!></div></div>"), it = A("<p class=\"text-sm text-muted-foreground\">No category API keys.</p>"), at = A("<div class=\"max-h-72 space-y-5 overflow-y-auto pr-1\" aria-label=\"API key management list\"><section class=\"space-y-2\"><h3 class=\"text-sm font-semibold\">Global keys</h3> <!></section> <section class=\"space-y-2\"><h3 class=\"text-sm font-semibold\">Category keys</h3> <!></section></div>"), ot = A("<div class=\"space-y-5 rounded-lg border border-border bg-card p-6\"><div><h2 class=\"text-lg font-medium\">API</h2> <p class=\"text-sm text-muted-foreground\">Create a user-wide key or review category-scoped access. Global keys are shown once.</p></div> <div class=\"flex gap-2\"><!> <!></div> <!> <!> <!></div>");
|
|
163
|
+
function st(e, t) {
|
|
164
|
+
le(t, !0);
|
|
165
|
+
let n = z(me([])), r = z(me([])), i = z("Global API key"), a = z(me({})), o = z(null), s = z(!0), c = z(!1), l = z(null), u = fe(() => E(o) ? E(a)[E(o)] : void 0), d = fe(() => E(n).filter((e) => e.scopes.includes("global"))), f = fe(() => E(n).filter((e) => Ze(e.scopes) !== null));
|
|
166
|
+
function p(e) {
|
|
167
|
+
return E(r).find((t) => t.id === e)?.name ?? "Unknown category";
|
|
168
|
+
}
|
|
169
|
+
async function m() {
|
|
170
|
+
I(s, !0), I(l, null);
|
|
171
|
+
try {
|
|
172
|
+
let [e, t] = await Promise.all([Ke(), ke()]);
|
|
173
|
+
I(n, e.keys, !0), I(r, t, !0);
|
|
174
|
+
} catch (e) {
|
|
175
|
+
I(l, e instanceof Error ? e.message : "Failed to load API access", !0);
|
|
176
|
+
} finally {
|
|
177
|
+
I(s, !1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
Fe(m);
|
|
181
|
+
async function h() {
|
|
182
|
+
I(c, !0), I(l, null);
|
|
183
|
+
try {
|
|
184
|
+
let e = await qe(E(i).trim() || void 0);
|
|
185
|
+
I(a, {
|
|
186
|
+
...E(a),
|
|
187
|
+
[e.id]: e.key
|
|
188
|
+
}, !0), I(o, e.id, !0), await m();
|
|
189
|
+
} catch (e) {
|
|
190
|
+
I(l, e instanceof Error ? e.message : "Failed to create API key", !0);
|
|
191
|
+
} finally {
|
|
192
|
+
I(c, !1);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
async function g(e) {
|
|
196
|
+
I(c, !0);
|
|
197
|
+
try {
|
|
198
|
+
await Ye(e);
|
|
199
|
+
let { [e]: t, ...n } = E(a);
|
|
200
|
+
I(a, n, !0), E(o) === e && I(o, null), await m();
|
|
201
|
+
} finally {
|
|
202
|
+
I(c, !1);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
async function _(e) {
|
|
206
|
+
let t = E(a)[e.id] ?? await Xe(e.id);
|
|
207
|
+
await navigator.clipboard.writeText(Qe(e, t));
|
|
208
|
+
}
|
|
209
|
+
var v = ot(), y = V(C(v), 2), b = C(y);
|
|
210
|
+
Oe(b, {
|
|
211
|
+
"aria-label": "Global API key name",
|
|
212
|
+
get value() {
|
|
213
|
+
return E(i);
|
|
214
|
+
},
|
|
215
|
+
set value(e) {
|
|
216
|
+
I(i, e, !0);
|
|
217
|
+
}
|
|
218
|
+
}), Se(V(b, 2), {
|
|
219
|
+
onclick: h,
|
|
220
|
+
get disabled() {
|
|
221
|
+
return E(c);
|
|
222
|
+
},
|
|
223
|
+
children: (e, t) => {
|
|
224
|
+
P(), L(e, D("Create global key"));
|
|
225
|
+
},
|
|
226
|
+
$$slots: { default: !0 }
|
|
227
|
+
}), M(y);
|
|
228
|
+
var x = V(y, 2), ee = (e) => {
|
|
229
|
+
var t = $e(), n = V(C(t), 2), r = C(n, !0);
|
|
230
|
+
M(n), Se(V(n, 2), {
|
|
231
|
+
class: "mt-2",
|
|
232
|
+
size: "sm",
|
|
233
|
+
variant: "outline",
|
|
234
|
+
onclick: () => navigator.clipboard.writeText(E(u)),
|
|
235
|
+
children: (e, t) => {
|
|
236
|
+
P(), L(e, D("Copy key"));
|
|
237
|
+
},
|
|
238
|
+
$$slots: { default: !0 }
|
|
239
|
+
}), M(t), B(() => w(r, E(u))), L(e, t);
|
|
240
|
+
};
|
|
241
|
+
T(x, (e) => {
|
|
242
|
+
E(u) && e(ee);
|
|
243
|
+
});
|
|
244
|
+
var S = V(x, 2), te = (e) => {
|
|
245
|
+
var t = et(), n = C(t, !0);
|
|
246
|
+
M(t), B(() => w(n, E(l))), L(e, t);
|
|
247
|
+
};
|
|
248
|
+
T(S, (e) => {
|
|
249
|
+
E(l) && e(te);
|
|
250
|
+
});
|
|
251
|
+
var ne = V(S, 2), re = (e) => {
|
|
252
|
+
L(e, tt());
|
|
253
|
+
}, ie = (e) => {
|
|
254
|
+
var t = at(), n = C(t);
|
|
255
|
+
oe(V(C(n), 2), 17, () => E(d), (e) => e.id, (e, t) => {
|
|
256
|
+
var n = nt(), r = C(n), i = C(r), a = C(i, !0);
|
|
257
|
+
M(i);
|
|
258
|
+
var o = V(i), s = C(o);
|
|
259
|
+
M(o), M(r), Se(V(r, 2), {
|
|
260
|
+
size: "sm",
|
|
261
|
+
variant: "destructive",
|
|
262
|
+
onclick: () => g(E(t).id),
|
|
263
|
+
get disabled() {
|
|
264
|
+
return E(c);
|
|
265
|
+
},
|
|
266
|
+
children: (e, t) => {
|
|
267
|
+
P(), L(e, D("Revoke"));
|
|
268
|
+
},
|
|
269
|
+
$$slots: { default: !0 }
|
|
270
|
+
}), M(n), B(() => {
|
|
271
|
+
w(a, E(t).name), w(s, `${E(t).prefix ?? ""}…`);
|
|
272
|
+
}), L(e, n);
|
|
273
|
+
}, (e) => {
|
|
274
|
+
L(e, rt());
|
|
275
|
+
}), M(n);
|
|
276
|
+
var r = V(n, 2);
|
|
277
|
+
oe(V(C(r), 2), 17, () => E(f), (e) => e.id, (e, t) => {
|
|
278
|
+
var n = K(), r = C(n), i = C(r), o = C(i);
|
|
279
|
+
M(i);
|
|
280
|
+
var s = V(i), l = C(s);
|
|
281
|
+
M(s), M(r);
|
|
282
|
+
var u = V(r, 2), d = C(u);
|
|
283
|
+
{
|
|
284
|
+
let e = fe(() => !E(t).recoverable && !E(a)[E(t).id]);
|
|
285
|
+
Se(d, {
|
|
286
|
+
size: "sm",
|
|
287
|
+
variant: "outline",
|
|
288
|
+
onclick: () => _(E(t)),
|
|
289
|
+
get disabled() {
|
|
290
|
+
return E(e);
|
|
291
|
+
},
|
|
292
|
+
children: (e, n) => {
|
|
293
|
+
P();
|
|
294
|
+
var r = D();
|
|
295
|
+
B(() => w(r, E(t).recoverable || E(a)[E(t).id] ? "Copy key" : "Rotate to enable copy")), L(e, r);
|
|
296
|
+
},
|
|
297
|
+
$$slots: { default: !0 }
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
Se(V(d, 2), {
|
|
301
|
+
size: "sm",
|
|
302
|
+
variant: "destructive",
|
|
303
|
+
onclick: () => g(E(t).id),
|
|
304
|
+
get disabled() {
|
|
305
|
+
return E(c);
|
|
306
|
+
},
|
|
307
|
+
children: (e, t) => {
|
|
308
|
+
P(), L(e, D("Revoke"));
|
|
309
|
+
},
|
|
310
|
+
$$slots: { default: !0 }
|
|
311
|
+
}), M(u), M(n), B((e, n) => {
|
|
312
|
+
w(o, `${e ?? ""}: ${E(t).name ?? ""}`), w(l, `${E(t).prefix ?? ""}… · ${n ?? ""}`);
|
|
313
|
+
}, [() => p(Ze(E(t).scopes)), () => E(t).scopes.map((e) => e.split(":").at(-1)).join(" / ")]), L(e, n);
|
|
314
|
+
}, (e) => {
|
|
315
|
+
L(e, it());
|
|
316
|
+
}), M(r), M(t), L(e, t);
|
|
317
|
+
};
|
|
318
|
+
T(ne, (e) => {
|
|
319
|
+
E(s) ? e(re) : e(ie, -1);
|
|
320
|
+
}), M(v), L(e, v), ce();
|
|
321
|
+
}
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region ../node_modules/.bun/dexie@4.4.4/node_modules/dexie/import-wrapper-prod.mjs
|
|
324
|
+
var ct = /* @__PURE__ */ n((/* @__PURE__ */ c(((e, t) => {
|
|
325
|
+
((n, r) => {
|
|
326
|
+
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).Dexie = r();
|
|
327
|
+
})(e, function() {
|
|
328
|
+
var e = function(t, n) {
|
|
329
|
+
return (e = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array ? function(e, t) {
|
|
330
|
+
e.__proto__ = t;
|
|
331
|
+
} : function(e, t) {
|
|
332
|
+
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
333
|
+
}))(t, n);
|
|
334
|
+
}, t = function() {
|
|
335
|
+
return (t = Object.assign || function(e) {
|
|
336
|
+
for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
|
|
337
|
+
return e;
|
|
338
|
+
}).apply(this, arguments);
|
|
339
|
+
};
|
|
340
|
+
function n(e, t, n) {
|
|
341
|
+
if (n || arguments.length === 2) for (var r, i = 0, a = t.length; i < a; i++) !r && i in t || ((r ||= Array.prototype.slice.call(t, 0, i))[i] = t[i]);
|
|
342
|
+
return e.concat(r || Array.prototype.slice.call(t));
|
|
343
|
+
}
|
|
344
|
+
var r = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : global, i = Object.keys, a = Array.isArray;
|
|
345
|
+
function o(e, t) {
|
|
346
|
+
return typeof t == "object" && i(t).forEach(function(n) {
|
|
347
|
+
e[n] = t[n];
|
|
348
|
+
}), e;
|
|
349
|
+
}
|
|
350
|
+
typeof Promise > "u" || r.Promise || (r.Promise = Promise);
|
|
351
|
+
var s = Object.getPrototypeOf, c = {}.hasOwnProperty;
|
|
352
|
+
function l(e, t) {
|
|
353
|
+
return c.call(e, t);
|
|
354
|
+
}
|
|
355
|
+
function u(e, t) {
|
|
356
|
+
typeof t == "function" && (t = t(s(e))), (typeof Reflect > "u" ? i : Reflect.ownKeys)(t).forEach(function(n) {
|
|
357
|
+
f(e, n, t[n]);
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
var d = Object.defineProperty;
|
|
361
|
+
function f(e, t, n, r) {
|
|
362
|
+
d(e, t, o(n && l(n, "get") && typeof n.get == "function" ? {
|
|
363
|
+
get: n.get,
|
|
364
|
+
set: n.set,
|
|
365
|
+
configurable: !0
|
|
366
|
+
} : {
|
|
367
|
+
value: n,
|
|
368
|
+
configurable: !0,
|
|
369
|
+
writable: !0
|
|
370
|
+
}, r));
|
|
371
|
+
}
|
|
372
|
+
function p(e) {
|
|
373
|
+
return { from: function(t) {
|
|
374
|
+
return e.prototype = Object.create(t.prototype), f(e.prototype, "constructor", e), { extend: u.bind(null, e.prototype) };
|
|
375
|
+
} };
|
|
376
|
+
}
|
|
377
|
+
var m = Object.getOwnPropertyDescriptor, h = [].slice;
|
|
378
|
+
function g(e, t, n) {
|
|
379
|
+
return h.call(e, t, n);
|
|
380
|
+
}
|
|
381
|
+
function _(e, t) {
|
|
382
|
+
return t(e);
|
|
383
|
+
}
|
|
384
|
+
function v(e) {
|
|
385
|
+
if (!e) throw Error("Assertion Failed");
|
|
386
|
+
}
|
|
387
|
+
function y(e) {
|
|
388
|
+
r.setImmediate ? setImmediate(e) : setTimeout(e, 0);
|
|
389
|
+
}
|
|
390
|
+
function b(e, t) {
|
|
391
|
+
if (typeof t == "string" && l(e, t)) return e[t];
|
|
392
|
+
if (!t) return e;
|
|
393
|
+
if (typeof t != "string") {
|
|
394
|
+
for (var n = [], r = 0, i = t.length; r < i; ++r) {
|
|
395
|
+
var a = b(e, t[r]);
|
|
396
|
+
n.push(a);
|
|
397
|
+
}
|
|
398
|
+
return n;
|
|
399
|
+
}
|
|
400
|
+
var o, s = t.indexOf(".");
|
|
401
|
+
return s === -1 || (o = e[t.substr(0, s)]) == null ? void 0 : b(o, t.substr(s + 1));
|
|
402
|
+
}
|
|
403
|
+
function x(e, t, n) {
|
|
404
|
+
if (e && t !== void 0 && !("isFrozen" in Object && Object.isFrozen(e))) if (typeof t != "string" && "length" in t) {
|
|
405
|
+
v(typeof n != "string" && "length" in n);
|
|
406
|
+
for (var r = 0, i = t.length; r < i; ++r) x(e, t[r], n[r]);
|
|
407
|
+
} else {
|
|
408
|
+
var o = t.indexOf(".");
|
|
409
|
+
if (o !== -1) {
|
|
410
|
+
var s = t.substr(0, o), o = t.substr(o + 1);
|
|
411
|
+
if (o === "") n === void 0 ? a(e) && !isNaN(parseInt(s)) ? e.splice(s, 1) : delete e[s] : e[s] = n;
|
|
412
|
+
else {
|
|
413
|
+
var c = e[s];
|
|
414
|
+
if (!c || !l(e, s)) {
|
|
415
|
+
if (n === void 0) return;
|
|
416
|
+
c = e[s] = {};
|
|
417
|
+
}
|
|
418
|
+
x(c, o, n);
|
|
419
|
+
}
|
|
420
|
+
} else n === void 0 ? a(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function ee(e) {
|
|
424
|
+
var t, n = {};
|
|
425
|
+
for (t in e) l(e, t) && (n[t] = e[t]);
|
|
426
|
+
return n;
|
|
427
|
+
}
|
|
428
|
+
var S = [].concat;
|
|
429
|
+
function te(e) {
|
|
430
|
+
return S.apply([], e);
|
|
431
|
+
}
|
|
432
|
+
var ne = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(te([
|
|
433
|
+
8,
|
|
434
|
+
16,
|
|
435
|
+
32,
|
|
436
|
+
64
|
|
437
|
+
].map(function(e) {
|
|
438
|
+
return [
|
|
439
|
+
"Int",
|
|
440
|
+
"Uint",
|
|
441
|
+
"Float"
|
|
442
|
+
].map(function(t) {
|
|
443
|
+
return t + e + "Array";
|
|
444
|
+
});
|
|
445
|
+
}))).filter(function(e) {
|
|
446
|
+
return r[e];
|
|
447
|
+
}), re = new Set(ne.map(function(e) {
|
|
448
|
+
return r[e];
|
|
449
|
+
})), C = null;
|
|
450
|
+
function w(e) {
|
|
451
|
+
return C = /* @__PURE__ */ new WeakMap(), e = function e(t) {
|
|
452
|
+
if (!t || typeof t != "object") return t;
|
|
453
|
+
var n = C.get(t);
|
|
454
|
+
if (n) return n;
|
|
455
|
+
if (a(t)) {
|
|
456
|
+
n = [], C.set(t, n);
|
|
457
|
+
for (var r = 0, i = t.length; r < i; ++r) n.push(e(t[r]));
|
|
458
|
+
} else if (re.has(t.constructor)) n = t;
|
|
459
|
+
else {
|
|
460
|
+
var o, c = s(t);
|
|
461
|
+
for (o in n = c === Object.prototype ? {} : Object.create(c), C.set(t, n), t) l(t, o) && (n[o] = e(t[o]));
|
|
462
|
+
}
|
|
463
|
+
return n;
|
|
464
|
+
}(e), C = null, e;
|
|
465
|
+
}
|
|
466
|
+
var ie = {}.toString;
|
|
467
|
+
function T(e) {
|
|
468
|
+
return ie.call(e).slice(8, -1);
|
|
469
|
+
}
|
|
470
|
+
var E = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", D = typeof E == "symbol" ? function(e) {
|
|
471
|
+
var t;
|
|
472
|
+
return e != null && (t = e[E]) && t.apply(e);
|
|
473
|
+
} : function() {
|
|
474
|
+
return null;
|
|
475
|
+
};
|
|
476
|
+
function O(e, t) {
|
|
477
|
+
t = e.indexOf(t), 0 <= t && e.splice(t, 1);
|
|
478
|
+
}
|
|
479
|
+
var k = {};
|
|
480
|
+
function A(e) {
|
|
481
|
+
var t, n, r, i;
|
|
482
|
+
if (arguments.length === 1) {
|
|
483
|
+
if (a(e)) return e.slice();
|
|
484
|
+
if (this === k && typeof e == "string") return [e];
|
|
485
|
+
if (i = D(e)) for (n = []; !(r = i.next()).done;) n.push(r.value);
|
|
486
|
+
else {
|
|
487
|
+
if (e == null || typeof (t = e.length) != "number") return [e];
|
|
488
|
+
for (n = Array(t); t--;) n[t] = e[t];
|
|
489
|
+
}
|
|
490
|
+
} else for (t = arguments.length, n = Array(t); t--;) n[t] = arguments[t];
|
|
491
|
+
return n;
|
|
492
|
+
}
|
|
493
|
+
var ae = typeof Symbol < "u" ? function(e) {
|
|
494
|
+
return e[Symbol.toStringTag] === "AsyncFunction";
|
|
495
|
+
} : function() {
|
|
496
|
+
return !1;
|
|
497
|
+
}, ne = [
|
|
498
|
+
"Unknown",
|
|
499
|
+
"Constraint",
|
|
500
|
+
"Data",
|
|
501
|
+
"TransactionInactive",
|
|
502
|
+
"ReadOnly",
|
|
503
|
+
"Version",
|
|
504
|
+
"NotFound",
|
|
505
|
+
"InvalidState",
|
|
506
|
+
"InvalidAccess",
|
|
507
|
+
"Abort",
|
|
508
|
+
"Timeout",
|
|
509
|
+
"QuotaExceeded",
|
|
510
|
+
"Syntax",
|
|
511
|
+
"DataClone"
|
|
512
|
+
], j = [
|
|
513
|
+
"Modify",
|
|
514
|
+
"Bulk",
|
|
515
|
+
"OpenFailed",
|
|
516
|
+
"VersionChange",
|
|
517
|
+
"Schema",
|
|
518
|
+
"Upgrade",
|
|
519
|
+
"InvalidTable",
|
|
520
|
+
"MissingAPI",
|
|
521
|
+
"NoSuchDatabase",
|
|
522
|
+
"InvalidArgument",
|
|
523
|
+
"SubTransaction",
|
|
524
|
+
"Unsupported",
|
|
525
|
+
"Internal",
|
|
526
|
+
"DatabaseClosed",
|
|
527
|
+
"PrematureCommit",
|
|
528
|
+
"ForeignAwait"
|
|
529
|
+
].concat(ne), oe = {
|
|
530
|
+
VersionChanged: "Database version changed by other database connection",
|
|
531
|
+
DatabaseClosed: "Database has been closed",
|
|
532
|
+
Abort: "Transaction aborted",
|
|
533
|
+
TransactionInactive: "Transaction has already completed or failed",
|
|
534
|
+
MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"
|
|
535
|
+
};
|
|
536
|
+
function M(e, t) {
|
|
537
|
+
this.name = e, this.message = t;
|
|
538
|
+
}
|
|
539
|
+
function se(e, t) {
|
|
540
|
+
return e + ". Errors: " + Object.keys(t).map(function(e) {
|
|
541
|
+
return t[e].toString();
|
|
542
|
+
}).filter(function(e, t, n) {
|
|
543
|
+
return n.indexOf(e) === t;
|
|
544
|
+
}).join("\n");
|
|
545
|
+
}
|
|
546
|
+
function ce(e, t, n, r) {
|
|
547
|
+
this.failures = t, this.failedKeys = r, this.successCount = n, this.message = se(e, t);
|
|
548
|
+
}
|
|
549
|
+
function N(e, t) {
|
|
550
|
+
this.name = "BulkError", this.failures = Object.keys(t).map(function(e) {
|
|
551
|
+
return t[e];
|
|
552
|
+
}), this.failuresByPos = t, this.message = se(e, this.failures);
|
|
553
|
+
}
|
|
554
|
+
p(M).from(Error).extend({ toString: function() {
|
|
555
|
+
return this.name + ": " + this.message;
|
|
556
|
+
} }), p(ce).from(M), p(N).from(M);
|
|
557
|
+
var le = j.reduce(function(e, t) {
|
|
558
|
+
return e[t] = t + "Error", e;
|
|
559
|
+
}, {}), ue = M, P = j.reduce(function(e, t) {
|
|
560
|
+
var n = t + "Error";
|
|
561
|
+
function r(e, r) {
|
|
562
|
+
this.name = n, e ? typeof e == "string" ? (this.message = `${e}${r ? "\n " + r : ""}`, this.inner = r || null) : typeof e == "object" && (this.message = `${e.name} ${e.message}`, this.inner = e) : (this.message = oe[t] || n, this.inner = null);
|
|
563
|
+
}
|
|
564
|
+
return p(r).from(ue), e[t] = r, e;
|
|
565
|
+
}, {}), de = (P.Syntax = SyntaxError, P.Type = TypeError, P.Range = RangeError, ne.reduce(function(e, t) {
|
|
566
|
+
return e[t + "Error"] = P[t], e;
|
|
567
|
+
}, {}));
|
|
568
|
+
ne = j.reduce(function(e, t) {
|
|
569
|
+
return [
|
|
570
|
+
"Syntax",
|
|
571
|
+
"Type",
|
|
572
|
+
"Range"
|
|
573
|
+
].indexOf(t) === -1 && (e[t + "Error"] = P[t]), e;
|
|
574
|
+
}, {});
|
|
575
|
+
function F() {}
|
|
576
|
+
function I(e) {
|
|
577
|
+
return e;
|
|
578
|
+
}
|
|
579
|
+
function L(e, t) {
|
|
580
|
+
return e == null || e === I ? t : function(n) {
|
|
581
|
+
return t(e(n));
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
function R(e, t) {
|
|
585
|
+
return function() {
|
|
586
|
+
e.apply(this, arguments), t.apply(this, arguments);
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function fe(e, t) {
|
|
590
|
+
return e === F ? t : function() {
|
|
591
|
+
var n = e.apply(this, arguments), r = (n !== void 0 && (arguments[0] = n), this.onsuccess), i = this.onerror, a = (this.onsuccess = null, this.onerror = null, t.apply(this, arguments));
|
|
592
|
+
return r && (this.onsuccess = this.onsuccess ? R(r, this.onsuccess) : r), i && (this.onerror = this.onerror ? R(i, this.onerror) : i), a === void 0 ? n : a;
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
function pe(e, t) {
|
|
596
|
+
return e === F ? t : function() {
|
|
597
|
+
e.apply(this, arguments);
|
|
598
|
+
var n = this.onsuccess, r = this.onerror;
|
|
599
|
+
this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? R(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? R(r, this.onerror) : r);
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
function me(e, t) {
|
|
603
|
+
return e === F ? t : function(n) {
|
|
604
|
+
var r = e.apply(this, arguments), n = (o(n, r), this.onsuccess), i = this.onerror, a = (this.onsuccess = null, this.onerror = null, t.apply(this, arguments));
|
|
605
|
+
return n && (this.onsuccess = this.onsuccess ? R(n, this.onsuccess) : n), i && (this.onerror = this.onerror ? R(i, this.onerror) : i), r === void 0 ? a === void 0 ? void 0 : a : o(r, a);
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
function z(e, t) {
|
|
609
|
+
return e === F ? t : function() {
|
|
610
|
+
return !1 !== t.apply(this, arguments) && e.apply(this, arguments);
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function B(e, t) {
|
|
614
|
+
return e === F ? t : function() {
|
|
615
|
+
var n = e.apply(this, arguments);
|
|
616
|
+
if (n && typeof n.then == "function") {
|
|
617
|
+
for (var r = this, i = arguments.length, a = Array(i); i--;) a[i] = arguments[i];
|
|
618
|
+
return n.then(function() {
|
|
619
|
+
return t.apply(r, a);
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
return t.apply(this, arguments);
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
ne.ModifyError = ce, ne.DexieError = M, ne.BulkError = N;
|
|
626
|
+
var he = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
627
|
+
function V(e) {
|
|
628
|
+
he = e;
|
|
629
|
+
}
|
|
630
|
+
var ge = {}, _e = 100, ve = typeof Promise > "u" ? [] : (j = Promise.resolve(), typeof crypto < "u" && crypto.subtle ? [
|
|
631
|
+
ve = crypto.subtle.digest("SHA-512", new Uint8Array([0])),
|
|
632
|
+
s(ve),
|
|
633
|
+
j
|
|
634
|
+
] : [
|
|
635
|
+
j,
|
|
636
|
+
s(j),
|
|
637
|
+
j
|
|
638
|
+
]), j = ve[0], ye = ve[1], ye = ye && ye.then, be = j && j.constructor, xe = !!ve[2], Se = function(e, t) {
|
|
639
|
+
ke.push([e, t]), we &&= (queueMicrotask(Re), !1);
|
|
640
|
+
}, Ce = !0, we = !0, Te = [], Ee = [], De = I, Oe = {
|
|
641
|
+
id: "global",
|
|
642
|
+
global: !0,
|
|
643
|
+
ref: 0,
|
|
644
|
+
unhandleds: [],
|
|
645
|
+
onunhandled: F,
|
|
646
|
+
pgp: !1,
|
|
647
|
+
env: {},
|
|
648
|
+
finalize: F
|
|
649
|
+
}, H = Oe, ke = [], Ae = 0, je = [];
|
|
650
|
+
function U(e) {
|
|
651
|
+
if (typeof this != "object") throw TypeError("Promises must be constructed via new");
|
|
652
|
+
this._listeners = [], this._lib = !1;
|
|
653
|
+
var t = this._PSD = H;
|
|
654
|
+
if (typeof e != "function") {
|
|
655
|
+
if (e !== ge) throw TypeError("Not a function");
|
|
656
|
+
this._state = arguments[1], this._value = arguments[2], !1 === this._state && Pe(this, this._value);
|
|
657
|
+
} else this._state = null, this._value = null, ++t.ref, function e(t, n) {
|
|
658
|
+
try {
|
|
659
|
+
n(function(n) {
|
|
660
|
+
if (t._state === null) {
|
|
661
|
+
if (n === t) throw TypeError("A promise cannot be resolved with itself.");
|
|
662
|
+
var r = t._lib && ze();
|
|
663
|
+
n && typeof n.then == "function" ? e(t, function(e, t) {
|
|
664
|
+
n instanceof U ? n._then(e, t) : n.then(e, t);
|
|
665
|
+
}) : (t._state = !0, t._value = n, Fe(t)), r && Be();
|
|
666
|
+
}
|
|
667
|
+
}, Pe.bind(null, t));
|
|
668
|
+
} catch (e) {
|
|
669
|
+
Pe(t, e);
|
|
670
|
+
}
|
|
671
|
+
}(this, e);
|
|
672
|
+
}
|
|
673
|
+
var Me = {
|
|
674
|
+
get: function() {
|
|
675
|
+
var e = H, t = Ke;
|
|
676
|
+
function n(n, r) {
|
|
677
|
+
var i = this, a = !e.global && (e !== H || t !== Ke), o = a && !Xe(), s = new U(function(t, s) {
|
|
678
|
+
Ie(i, new Ne(nt(n, e, a, o), nt(r, e, a, o), t, s, e));
|
|
679
|
+
});
|
|
680
|
+
return this._consoleTask && (s._consoleTask = this._consoleTask), s;
|
|
681
|
+
}
|
|
682
|
+
return n.prototype = ge, n;
|
|
683
|
+
},
|
|
684
|
+
set: function(e) {
|
|
685
|
+
f(this, "then", e && e.prototype === ge ? Me : {
|
|
686
|
+
get: function() {
|
|
687
|
+
return e;
|
|
688
|
+
},
|
|
689
|
+
set: Me.set
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
function Ne(e, t, n, r, i) {
|
|
694
|
+
this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = i;
|
|
695
|
+
}
|
|
696
|
+
function Pe(e, t) {
|
|
697
|
+
var n, r;
|
|
698
|
+
Ee.push(t), e._state === null && (n = e._lib && ze(), t = De(t), e._state = !1, e._value = t, r = e, Te.some(function(e) {
|
|
699
|
+
return e._value === r._value;
|
|
700
|
+
}) || Te.push(r), Fe(e), n) && Be();
|
|
701
|
+
}
|
|
702
|
+
function Fe(e) {
|
|
703
|
+
var t = e._listeners;
|
|
704
|
+
e._listeners = [];
|
|
705
|
+
for (var n = 0, r = t.length; n < r; ++n) Ie(e, t[n]);
|
|
706
|
+
var i = e._PSD;
|
|
707
|
+
--i.ref || i.finalize(), Ae === 0 && (++Ae, Se(function() {
|
|
708
|
+
--Ae == 0 && Ve();
|
|
709
|
+
}, []));
|
|
710
|
+
}
|
|
711
|
+
function Ie(e, t) {
|
|
712
|
+
if (e._state === null) e._listeners.push(t);
|
|
713
|
+
else {
|
|
714
|
+
var n = e._state ? t.onFulfilled : t.onRejected;
|
|
715
|
+
if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
|
|
716
|
+
++t.psd.ref, ++Ae, Se(Le, [
|
|
717
|
+
n,
|
|
718
|
+
e,
|
|
719
|
+
t
|
|
720
|
+
]);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
function Le(e, t, n) {
|
|
724
|
+
try {
|
|
725
|
+
var r, i = t._value;
|
|
726
|
+
!t._state && Ee.length && (Ee = []), r = he && t._consoleTask ? t._consoleTask.run(function() {
|
|
727
|
+
return e(i);
|
|
728
|
+
}) : e(i), t._state || Ee.indexOf(i) !== -1 || ((e) => {
|
|
729
|
+
for (var t = Te.length; t;) if (Te[--t]._value === e._value) return Te.splice(t, 1);
|
|
730
|
+
})(t), n.resolve(r);
|
|
731
|
+
} catch (e) {
|
|
732
|
+
n.reject(e);
|
|
733
|
+
} finally {
|
|
734
|
+
--Ae == 0 && Ve(), --n.psd.ref || n.psd.finalize();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
function Re() {
|
|
738
|
+
tt(Oe, function() {
|
|
739
|
+
ze() && Be();
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
function ze() {
|
|
743
|
+
var e = Ce;
|
|
744
|
+
return we = Ce = !1, e;
|
|
745
|
+
}
|
|
746
|
+
function Be() {
|
|
747
|
+
var e, t, n;
|
|
748
|
+
do
|
|
749
|
+
for (; 0 < ke.length;) for (e = ke, ke = [], n = e.length, t = 0; t < n; ++t) {
|
|
750
|
+
var r = e[t];
|
|
751
|
+
r[0].apply(null, r[1]);
|
|
752
|
+
}
|
|
753
|
+
while (0 < ke.length);
|
|
754
|
+
we = Ce = !0;
|
|
755
|
+
}
|
|
756
|
+
function Ve() {
|
|
757
|
+
for (var e = Te, t = (Te = [], e.forEach(function(e) {
|
|
758
|
+
e._PSD.onunhandled.call(null, e._value, e);
|
|
759
|
+
}), je.slice(0)), n = t.length; n;) t[--n]();
|
|
760
|
+
}
|
|
761
|
+
function He(e) {
|
|
762
|
+
return new U(ge, !1, e);
|
|
763
|
+
}
|
|
764
|
+
function W(e, t) {
|
|
765
|
+
var n = H;
|
|
766
|
+
return function() {
|
|
767
|
+
var r = ze(), i = H;
|
|
768
|
+
try {
|
|
769
|
+
return $e(n, !0), e.apply(this, arguments);
|
|
770
|
+
} catch (e) {
|
|
771
|
+
t && t(e);
|
|
772
|
+
} finally {
|
|
773
|
+
$e(i, !1), r && Be();
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
u(U.prototype, {
|
|
778
|
+
then: Me,
|
|
779
|
+
_then: function(e, t) {
|
|
780
|
+
Ie(this, new Ne(null, null, e, t, H));
|
|
781
|
+
},
|
|
782
|
+
catch: function(e) {
|
|
783
|
+
var t, n;
|
|
784
|
+
return arguments.length === 1 ? this.then(null, e) : (t = e, n = arguments[1], typeof t == "function" ? this.then(null, function(e) {
|
|
785
|
+
return (e instanceof t ? n : He)(e);
|
|
786
|
+
}) : this.then(null, function(e) {
|
|
787
|
+
return (e && e.name === t ? n : He)(e);
|
|
788
|
+
}));
|
|
789
|
+
},
|
|
790
|
+
finally: function(e) {
|
|
791
|
+
return this.then(function(t) {
|
|
792
|
+
return U.resolve(e()).then(function() {
|
|
793
|
+
return t;
|
|
794
|
+
});
|
|
795
|
+
}, function(t) {
|
|
796
|
+
return U.resolve(e()).then(function() {
|
|
797
|
+
return He(t);
|
|
798
|
+
});
|
|
799
|
+
});
|
|
800
|
+
},
|
|
801
|
+
timeout: function(e, t) {
|
|
802
|
+
var n = this;
|
|
803
|
+
return e < Infinity ? new U(function(r, i) {
|
|
804
|
+
var a = setTimeout(function() {
|
|
805
|
+
return i(new P.Timeout(t));
|
|
806
|
+
}, e);
|
|
807
|
+
n.then(r, i).finally(clearTimeout.bind(null, a));
|
|
808
|
+
}) : this;
|
|
809
|
+
}
|
|
810
|
+
}), typeof Symbol < "u" && Symbol.toStringTag && f(U.prototype, Symbol.toStringTag, "Dexie.Promise"), Oe.env = et(), u(U, {
|
|
811
|
+
all: function() {
|
|
812
|
+
var e = A.apply(null, arguments).map(Ze);
|
|
813
|
+
return new U(function(t, n) {
|
|
814
|
+
e.length === 0 && t([]);
|
|
815
|
+
var r = e.length;
|
|
816
|
+
e.forEach(function(i, a) {
|
|
817
|
+
return U.resolve(i).then(function(n) {
|
|
818
|
+
e[a] = n, --r || t(e);
|
|
819
|
+
}, n);
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
},
|
|
823
|
+
resolve: function(e) {
|
|
824
|
+
return e instanceof U ? e : e && typeof e.then == "function" ? new U(function(t, n) {
|
|
825
|
+
e.then(t, n);
|
|
826
|
+
}) : new U(ge, !0, e);
|
|
827
|
+
},
|
|
828
|
+
reject: He,
|
|
829
|
+
race: function() {
|
|
830
|
+
var e = A.apply(null, arguments).map(Ze);
|
|
831
|
+
return new U(function(t, n) {
|
|
832
|
+
e.map(function(e) {
|
|
833
|
+
return U.resolve(e).then(t, n);
|
|
834
|
+
});
|
|
835
|
+
});
|
|
836
|
+
},
|
|
837
|
+
PSD: {
|
|
838
|
+
get: function() {
|
|
839
|
+
return H;
|
|
840
|
+
},
|
|
841
|
+
set: function(e) {
|
|
842
|
+
return H = e;
|
|
843
|
+
}
|
|
844
|
+
},
|
|
845
|
+
totalEchoes: { get: function() {
|
|
846
|
+
return Ke;
|
|
847
|
+
} },
|
|
848
|
+
newPSD: Je,
|
|
849
|
+
usePSD: tt,
|
|
850
|
+
scheduler: {
|
|
851
|
+
get: function() {
|
|
852
|
+
return Se;
|
|
853
|
+
},
|
|
854
|
+
set: function(e) {
|
|
855
|
+
Se = e;
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
rejectionMapper: {
|
|
859
|
+
get: function() {
|
|
860
|
+
return De;
|
|
861
|
+
},
|
|
862
|
+
set: function(e) {
|
|
863
|
+
De = e;
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
follow: function(e, t) {
|
|
867
|
+
return new U(function(n, r) {
|
|
868
|
+
return Je(function(t, n) {
|
|
869
|
+
var r = H;
|
|
870
|
+
r.unhandleds = [], r.onunhandled = n, r.finalize = R(function() {
|
|
871
|
+
var e, r = this;
|
|
872
|
+
e = function() {
|
|
873
|
+
r.unhandleds.length === 0 ? t() : n(r.unhandleds[0]);
|
|
874
|
+
}, je.push(function t() {
|
|
875
|
+
e(), je.splice(je.indexOf(t), 1);
|
|
876
|
+
}), ++Ae, Se(function() {
|
|
877
|
+
--Ae == 0 && Ve();
|
|
878
|
+
}, []);
|
|
879
|
+
}, r.finalize), e();
|
|
880
|
+
}, t, n, r);
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
}), be && (be.allSettled && f(U, "allSettled", function() {
|
|
884
|
+
var e = A.apply(null, arguments).map(Ze);
|
|
885
|
+
return new U(function(t) {
|
|
886
|
+
e.length === 0 && t([]);
|
|
887
|
+
var n = e.length, r = Array(n);
|
|
888
|
+
e.forEach(function(e, i) {
|
|
889
|
+
return U.resolve(e).then(function(e) {
|
|
890
|
+
return r[i] = {
|
|
891
|
+
status: "fulfilled",
|
|
892
|
+
value: e
|
|
893
|
+
};
|
|
894
|
+
}, function(e) {
|
|
895
|
+
return r[i] = {
|
|
896
|
+
status: "rejected",
|
|
897
|
+
reason: e
|
|
898
|
+
};
|
|
899
|
+
}).then(function() {
|
|
900
|
+
return --n || t(r);
|
|
901
|
+
});
|
|
902
|
+
});
|
|
903
|
+
});
|
|
904
|
+
}), be.any && typeof AggregateError < "u" && f(U, "any", function() {
|
|
905
|
+
var e = A.apply(null, arguments).map(Ze);
|
|
906
|
+
return new U(function(t, n) {
|
|
907
|
+
e.length === 0 && n(/* @__PURE__ */ AggregateError([]));
|
|
908
|
+
var r = e.length, i = Array(r);
|
|
909
|
+
e.forEach(function(e, a) {
|
|
910
|
+
return U.resolve(e).then(function(e) {
|
|
911
|
+
return t(e);
|
|
912
|
+
}, function(e) {
|
|
913
|
+
i[a] = e, --r || n(AggregateError(i));
|
|
914
|
+
});
|
|
915
|
+
});
|
|
916
|
+
});
|
|
917
|
+
}), be.withResolvers) && (U.withResolvers = be.withResolvers);
|
|
918
|
+
var G = {
|
|
919
|
+
awaits: 0,
|
|
920
|
+
echoes: 0,
|
|
921
|
+
id: 0
|
|
922
|
+
}, Ue = 0, We = [], Ge = 0, Ke = 0, qe = 0;
|
|
923
|
+
function Je(e, t, n, r) {
|
|
924
|
+
var i = H, a = Object.create(i), t = (a.parent = i, a.ref = 0, a.global = !1, a.id = ++qe, Oe.env, a.env = xe ? {
|
|
925
|
+
Promise: U,
|
|
926
|
+
PromiseProp: {
|
|
927
|
+
value: U,
|
|
928
|
+
configurable: !0,
|
|
929
|
+
writable: !0
|
|
930
|
+
},
|
|
931
|
+
all: U.all,
|
|
932
|
+
race: U.race,
|
|
933
|
+
allSettled: U.allSettled,
|
|
934
|
+
any: U.any,
|
|
935
|
+
resolve: U.resolve,
|
|
936
|
+
reject: U.reject
|
|
937
|
+
} : {}, t && o(a, t), ++i.ref, a.finalize = function() {
|
|
938
|
+
--this.parent.ref || this.parent.finalize();
|
|
939
|
+
}, tt(a, e, n, r));
|
|
940
|
+
return a.ref === 0 && a.finalize(), t;
|
|
941
|
+
}
|
|
942
|
+
function Ye() {
|
|
943
|
+
return G.id ||= ++Ue, ++G.awaits, G.echoes += _e, G.id;
|
|
944
|
+
}
|
|
945
|
+
function Xe() {
|
|
946
|
+
return !!G.awaits && (--G.awaits == 0 && (G.id = 0), G.echoes = G.awaits * _e, !0);
|
|
947
|
+
}
|
|
948
|
+
function Ze(e) {
|
|
949
|
+
return G.echoes && e && e.constructor === be ? (Ye(), e.then(function(e) {
|
|
950
|
+
return Xe(), e;
|
|
951
|
+
}, function(e) {
|
|
952
|
+
return Xe(), K(e);
|
|
953
|
+
})) : e;
|
|
954
|
+
}
|
|
955
|
+
function Qe() {
|
|
956
|
+
var e = We[We.length - 1];
|
|
957
|
+
We.pop(), $e(e, !1);
|
|
958
|
+
}
|
|
959
|
+
function $e(e, t) {
|
|
960
|
+
var n, i, a = H;
|
|
961
|
+
(t ? !G.echoes || Ge++ && e === H : !Ge || --Ge && e === H) || queueMicrotask(t ? function(e) {
|
|
962
|
+
++Ke, G.echoes && --G.echoes != 0 || (G.echoes = G.awaits = G.id = 0), We.push(H), $e(e, !0);
|
|
963
|
+
}.bind(null, e) : Qe), e !== H && (H = e, a === Oe && (Oe.env = et()), xe) && (n = Oe.env.Promise, i = e.env, a.global || e.global) && (Object.defineProperty(r, "Promise", i.PromiseProp), n.all = i.all, n.race = i.race, n.resolve = i.resolve, n.reject = i.reject, i.allSettled && (n.allSettled = i.allSettled), i.any) && (n.any = i.any);
|
|
964
|
+
}
|
|
965
|
+
function et() {
|
|
966
|
+
var e = r.Promise;
|
|
967
|
+
return xe ? {
|
|
968
|
+
Promise: e,
|
|
969
|
+
PromiseProp: Object.getOwnPropertyDescriptor(r, "Promise"),
|
|
970
|
+
all: e.all,
|
|
971
|
+
race: e.race,
|
|
972
|
+
allSettled: e.allSettled,
|
|
973
|
+
any: e.any,
|
|
974
|
+
resolve: e.resolve,
|
|
975
|
+
reject: e.reject
|
|
976
|
+
} : {};
|
|
977
|
+
}
|
|
978
|
+
function tt(e, t, n, r, i) {
|
|
979
|
+
var a = H;
|
|
980
|
+
try {
|
|
981
|
+
return $e(e, !0), t(n, r, i);
|
|
982
|
+
} finally {
|
|
983
|
+
$e(a, !1);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
function nt(e, t, n, r) {
|
|
987
|
+
return typeof e == "function" ? function() {
|
|
988
|
+
var i = H;
|
|
989
|
+
n && Ye(), $e(t, !0);
|
|
990
|
+
try {
|
|
991
|
+
return e.apply(this, arguments);
|
|
992
|
+
} finally {
|
|
993
|
+
$e(i, !1), r && queueMicrotask(Xe);
|
|
994
|
+
}
|
|
995
|
+
} : e;
|
|
996
|
+
}
|
|
997
|
+
function rt(e) {
|
|
998
|
+
Promise === be && G.echoes === 0 ? Ge === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
999
|
+
}
|
|
1000
|
+
("" + ye).indexOf("[native code]") === -1 && (Ye = Xe = F);
|
|
1001
|
+
var K = U.reject, it = "", at = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", ot = "String expected.", st = "__dbnames", ct = "readonly", lt = "readwrite";
|
|
1002
|
+
function ut(e, t) {
|
|
1003
|
+
return e ? t ? function() {
|
|
1004
|
+
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
1005
|
+
} : e : t;
|
|
1006
|
+
}
|
|
1007
|
+
var dt = {
|
|
1008
|
+
type: 3,
|
|
1009
|
+
lower: -Infinity,
|
|
1010
|
+
lowerOpen: !1,
|
|
1011
|
+
upper: [[]],
|
|
1012
|
+
upperOpen: !1
|
|
1013
|
+
};
|
|
1014
|
+
function ft(e) {
|
|
1015
|
+
return typeof e != "string" || /\./.test(e) ? function(e) {
|
|
1016
|
+
return e;
|
|
1017
|
+
} : function(t) {
|
|
1018
|
+
return t[e] === void 0 && e in t && delete (t = w(t))[e], t;
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
function pt() {
|
|
1022
|
+
throw P.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.");
|
|
1023
|
+
}
|
|
1024
|
+
function q(e, t) {
|
|
1025
|
+
try {
|
|
1026
|
+
var n = mt(e), r = mt(t);
|
|
1027
|
+
if (n !== r) return n === "Array" ? 1 : r === "Array" ? -1 : n === "binary" ? 1 : r === "binary" ? -1 : n === "string" ? 1 : r === "string" ? -1 : n === "Date" ? 1 : r === "Date" ? -1 : NaN;
|
|
1028
|
+
switch (n) {
|
|
1029
|
+
case "number":
|
|
1030
|
+
case "Date":
|
|
1031
|
+
case "string": return t < e ? 1 : e < t ? -1 : 0;
|
|
1032
|
+
case "binary":
|
|
1033
|
+
for (var i = ht(e), a = ht(t), o = i.length, s = a.length, c = o < s ? o : s, l = 0; l < c; ++l) if (i[l] !== a[l]) return i[l] < a[l] ? -1 : 1;
|
|
1034
|
+
return o === s ? 0 : o < s ? -1 : 1;
|
|
1035
|
+
case "Array":
|
|
1036
|
+
for (var u = e, d = t, f = u.length, p = d.length, m = f < p ? f : p, h = 0; h < m; ++h) {
|
|
1037
|
+
var g = q(u[h], d[h]);
|
|
1038
|
+
if (g !== 0) return g;
|
|
1039
|
+
}
|
|
1040
|
+
return f === p ? 0 : f < p ? -1 : 1;
|
|
1041
|
+
}
|
|
1042
|
+
} catch {}
|
|
1043
|
+
return NaN;
|
|
1044
|
+
}
|
|
1045
|
+
function mt(e) {
|
|
1046
|
+
var t = typeof e;
|
|
1047
|
+
return t == "object" && (ArrayBuffer.isView(e) || (t = T(e)) === "ArrayBuffer") ? "binary" : t;
|
|
1048
|
+
}
|
|
1049
|
+
function ht(e) {
|
|
1050
|
+
return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
|
|
1051
|
+
}
|
|
1052
|
+
function gt(e, t, n) {
|
|
1053
|
+
var r = e.schema.yProps;
|
|
1054
|
+
return r ? (t && 0 < n.numFailures && (t = t.filter(function(e, t) {
|
|
1055
|
+
return !n.failures[t];
|
|
1056
|
+
})), Promise.all(r.map(function(n) {
|
|
1057
|
+
return n = n.updatesTable, t ? e.db.table(n).where("k").anyOf(t).delete() : e.db.table(n).clear();
|
|
1058
|
+
})).then(function() {
|
|
1059
|
+
return n;
|
|
1060
|
+
})) : n;
|
|
1061
|
+
}
|
|
1062
|
+
vt.prototype.execute = function(e) {
|
|
1063
|
+
var t = this["@@propmod"];
|
|
1064
|
+
if (t.add !== void 0) {
|
|
1065
|
+
var r = t.add;
|
|
1066
|
+
if (a(r)) return n(n([], a(e) ? e : [], !0), r, !0).sort();
|
|
1067
|
+
if (typeof r == "number") return (Number(e) || 0) + r;
|
|
1068
|
+
if (typeof r == "bigint") try {
|
|
1069
|
+
return BigInt(e) + r;
|
|
1070
|
+
} catch {
|
|
1071
|
+
return BigInt(0) + r;
|
|
1072
|
+
}
|
|
1073
|
+
throw TypeError(`Invalid term ${r}`);
|
|
1074
|
+
}
|
|
1075
|
+
if (t.remove !== void 0) {
|
|
1076
|
+
var i = t.remove;
|
|
1077
|
+
if (a(i)) return a(e) ? e.filter(function(e) {
|
|
1078
|
+
return !i.includes(e);
|
|
1079
|
+
}).sort() : [];
|
|
1080
|
+
if (typeof i == "number") return Number(e) - i;
|
|
1081
|
+
if (typeof i == "bigint") try {
|
|
1082
|
+
return BigInt(e) - i;
|
|
1083
|
+
} catch {
|
|
1084
|
+
return BigInt(0) - i;
|
|
1085
|
+
}
|
|
1086
|
+
throw TypeError(`Invalid subtrahend ${i}`);
|
|
1087
|
+
}
|
|
1088
|
+
return r = (r = t.replacePrefix)?.[0], r && typeof e == "string" && e.startsWith(r) ? t.replacePrefix[1] + e.substring(r.length) : e;
|
|
1089
|
+
};
|
|
1090
|
+
var _t = vt;
|
|
1091
|
+
function vt(e) {
|
|
1092
|
+
this["@@propmod"] = e;
|
|
1093
|
+
}
|
|
1094
|
+
function yt(e, t) {
|
|
1095
|
+
for (var n = i(t), r = n.length, a = !1, o = 0; o < r; ++o) {
|
|
1096
|
+
var s = n[o], c = t[s], l = b(e, s);
|
|
1097
|
+
c instanceof _t ? (x(e, s, c.execute(l)), a = !0) : l !== c && (x(e, s, c), a = !0);
|
|
1098
|
+
}
|
|
1099
|
+
return a;
|
|
1100
|
+
}
|
|
1101
|
+
J.prototype._trans = function(e, t, n) {
|
|
1102
|
+
var r = this._tx || H.trans, i = this.name, a = he && typeof console < "u" && console.createTask && console.createTask(`Dexie: ${e === "readonly" ? "read" : "write"} ${this.name}`);
|
|
1103
|
+
function o(e, n, r) {
|
|
1104
|
+
if (r.schema[i]) return t(r.idbtrans, r);
|
|
1105
|
+
throw new P.NotFound("Table " + i + " not part of transaction");
|
|
1106
|
+
}
|
|
1107
|
+
var s = ze();
|
|
1108
|
+
try {
|
|
1109
|
+
var c = r && r.db._novip === this.db._novip ? r === H.trans ? r._promise(e, o, n) : Je(function() {
|
|
1110
|
+
return r._promise(e, o, n);
|
|
1111
|
+
}, {
|
|
1112
|
+
trans: r,
|
|
1113
|
+
transless: H.transless || H
|
|
1114
|
+
}) : function e(t, n, r, i) {
|
|
1115
|
+
if (t.idbdb && (t._state.openComplete || H.letThrough || t._vip)) {
|
|
1116
|
+
var a = t._createTransaction(n, r, t._dbSchema);
|
|
1117
|
+
try {
|
|
1118
|
+
a.create(), t._state.PR1398_maxLoop = 3;
|
|
1119
|
+
} catch (a) {
|
|
1120
|
+
return a.name === le.InvalidState && t.isOpen() && 0 < --t._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), t.close({ disableAutoOpen: !1 }), t.open().then(function() {
|
|
1121
|
+
return e(t, n, r, i);
|
|
1122
|
+
})) : K(a);
|
|
1123
|
+
}
|
|
1124
|
+
return a._promise(n, function(e, t) {
|
|
1125
|
+
return Je(function() {
|
|
1126
|
+
return H.trans = a, i(e, t, a);
|
|
1127
|
+
});
|
|
1128
|
+
}).then(function(e) {
|
|
1129
|
+
if (n === "readwrite") try {
|
|
1130
|
+
a.idbtrans.commit();
|
|
1131
|
+
} catch {}
|
|
1132
|
+
return n === "readonly" ? e : a._completion.then(function() {
|
|
1133
|
+
return e;
|
|
1134
|
+
});
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
if (t._state.openComplete) return K(new P.DatabaseClosed(t._state.dbOpenError));
|
|
1138
|
+
if (!t._state.isBeingOpened) {
|
|
1139
|
+
if (!t._state.autoOpen) return K(new P.DatabaseClosed());
|
|
1140
|
+
t.open().catch(F);
|
|
1141
|
+
}
|
|
1142
|
+
return t._state.dbReadyPromise.then(function() {
|
|
1143
|
+
return e(t, n, r, i);
|
|
1144
|
+
});
|
|
1145
|
+
}(this.db, e, [this.name], o);
|
|
1146
|
+
return a && (c._consoleTask = a, c = c.catch(function(e) {
|
|
1147
|
+
return console.trace(e), K(e);
|
|
1148
|
+
})), c;
|
|
1149
|
+
} finally {
|
|
1150
|
+
s && Be();
|
|
1151
|
+
}
|
|
1152
|
+
}, J.prototype.get = function(e, t) {
|
|
1153
|
+
var n = this;
|
|
1154
|
+
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? K(new P.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(t) {
|
|
1155
|
+
return n.core.get({
|
|
1156
|
+
trans: t,
|
|
1157
|
+
key: e
|
|
1158
|
+
}).then(function(e) {
|
|
1159
|
+
return n.hook.reading.fire(e);
|
|
1160
|
+
});
|
|
1161
|
+
}).then(t);
|
|
1162
|
+
}, J.prototype.where = function(e) {
|
|
1163
|
+
if (typeof e == "string") return new this.db.WhereClause(this, e);
|
|
1164
|
+
if (a(e)) return new this.db.WhereClause(this, `[${e.join("+")}]`);
|
|
1165
|
+
var t = i(e);
|
|
1166
|
+
if (t.length === 1) return this.where(t[0]).equals(e[t[0]]);
|
|
1167
|
+
var n = this.schema.indexes.concat(this.schema.primKey).filter(function(e) {
|
|
1168
|
+
if (e.compound && t.every(function(t) {
|
|
1169
|
+
return 0 <= e.keyPath.indexOf(t);
|
|
1170
|
+
})) {
|
|
1171
|
+
for (var n = 0; n < t.length; ++n) if (t.indexOf(e.keyPath[n]) === -1) return !1;
|
|
1172
|
+
return !0;
|
|
1173
|
+
}
|
|
1174
|
+
return !1;
|
|
1175
|
+
}).sort(function(e, t) {
|
|
1176
|
+
return e.keyPath.length - t.keyPath.length;
|
|
1177
|
+
})[0];
|
|
1178
|
+
if (n && this.db._maxKey !== it) return s = n.keyPath.slice(0, t.length), this.where(s).equals(s.map(function(t) {
|
|
1179
|
+
return e[t];
|
|
1180
|
+
}));
|
|
1181
|
+
!n && he && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit from a compound index [${t.join("+")}]`);
|
|
1182
|
+
var r = this.schema.idxByName;
|
|
1183
|
+
function o(e, t) {
|
|
1184
|
+
return q(e, t) === 0;
|
|
1185
|
+
}
|
|
1186
|
+
var s = t.reduce(function(t, n) {
|
|
1187
|
+
var i = t[0], t = t[1], s = r[n], c = e[n];
|
|
1188
|
+
return [i || s, i || !s ? ut(t, s && s.multi ? function(e) {
|
|
1189
|
+
return e = b(e, n), a(e) && e.some(function(e) {
|
|
1190
|
+
return o(c, e);
|
|
1191
|
+
});
|
|
1192
|
+
} : function(e) {
|
|
1193
|
+
return o(c, b(e, n));
|
|
1194
|
+
}) : t];
|
|
1195
|
+
}, [null, null]), c = s[0], s = s[1];
|
|
1196
|
+
return c ? this.where(c.name).equals(e[c.keyPath]).filter(s) : n ? this.filter(s) : this.where(t).equals("");
|
|
1197
|
+
}, J.prototype.filter = function(e) {
|
|
1198
|
+
return this.toCollection().and(e);
|
|
1199
|
+
}, J.prototype.count = function(e) {
|
|
1200
|
+
return this.toCollection().count(e);
|
|
1201
|
+
}, J.prototype.offset = function(e) {
|
|
1202
|
+
return this.toCollection().offset(e);
|
|
1203
|
+
}, J.prototype.limit = function(e) {
|
|
1204
|
+
return this.toCollection().limit(e);
|
|
1205
|
+
}, J.prototype.each = function(e) {
|
|
1206
|
+
return this.toCollection().each(e);
|
|
1207
|
+
}, J.prototype.toArray = function(e) {
|
|
1208
|
+
return this.toCollection().toArray(e);
|
|
1209
|
+
}, J.prototype.toCollection = function() {
|
|
1210
|
+
return new this.db.Collection(new this.db.WhereClause(this));
|
|
1211
|
+
}, J.prototype.orderBy = function(e) {
|
|
1212
|
+
return new this.db.Collection(new this.db.WhereClause(this, a(e) ? `[${e.join("+")}]` : e));
|
|
1213
|
+
}, J.prototype.reverse = function() {
|
|
1214
|
+
return this.toCollection().reverse();
|
|
1215
|
+
}, J.prototype.mapToClass = function(t) {
|
|
1216
|
+
for (var n = this.db, r = this.name, i = ((this.schema.mappedClass = t).prototype instanceof pt && (t = ((t) => {
|
|
1217
|
+
var i = s, a = t;
|
|
1218
|
+
if (typeof a != "function" && a !== null) throw TypeError("Class extends value " + String(a) + " is not a constructor or null");
|
|
1219
|
+
function o() {
|
|
1220
|
+
this.constructor = i;
|
|
1221
|
+
}
|
|
1222
|
+
function s() {
|
|
1223
|
+
return t !== null && t.apply(this, arguments) || this;
|
|
1224
|
+
}
|
|
1225
|
+
return e(i, a), i.prototype = a === null ? Object.create(a) : (o.prototype = a.prototype, new o()), Object.defineProperty(s.prototype, "db", {
|
|
1226
|
+
get: function() {
|
|
1227
|
+
return n;
|
|
1228
|
+
},
|
|
1229
|
+
enumerable: !1,
|
|
1230
|
+
configurable: !0
|
|
1231
|
+
}), s.prototype.table = function() {
|
|
1232
|
+
return r;
|
|
1233
|
+
}, s;
|
|
1234
|
+
})(t)), /* @__PURE__ */ new Set()), a = t.prototype; a; a = s(a)) Object.getOwnPropertyNames(a).forEach(function(e) {
|
|
1235
|
+
return i.add(e);
|
|
1236
|
+
});
|
|
1237
|
+
function o(e) {
|
|
1238
|
+
if (!e) return e;
|
|
1239
|
+
var n, r = Object.create(t.prototype);
|
|
1240
|
+
for (n in e) if (!i.has(n)) try {
|
|
1241
|
+
r[n] = e[n];
|
|
1242
|
+
} catch {}
|
|
1243
|
+
return r;
|
|
1244
|
+
}
|
|
1245
|
+
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = o, this.hook("reading", o), t;
|
|
1246
|
+
}, J.prototype.defineClass = function() {
|
|
1247
|
+
return this.mapToClass(function(e) {
|
|
1248
|
+
o(this, e);
|
|
1249
|
+
});
|
|
1250
|
+
}, J.prototype.add = function(e, t) {
|
|
1251
|
+
var n = this, r = this.schema.primKey, i = r.auto, a = r.keyPath, o = e;
|
|
1252
|
+
return a && i && (o = ft(a)(e)), this._trans("readwrite", function(e) {
|
|
1253
|
+
return n.core.mutate({
|
|
1254
|
+
trans: e,
|
|
1255
|
+
type: "add",
|
|
1256
|
+
keys: t == null ? null : [t],
|
|
1257
|
+
values: [o]
|
|
1258
|
+
});
|
|
1259
|
+
}).then(function(e) {
|
|
1260
|
+
return e.numFailures ? U.reject(e.failures[0]) : e.lastResult;
|
|
1261
|
+
}).then(function(t) {
|
|
1262
|
+
if (a) try {
|
|
1263
|
+
x(e, a, t);
|
|
1264
|
+
} catch {}
|
|
1265
|
+
return t;
|
|
1266
|
+
});
|
|
1267
|
+
}, J.prototype.upsert = function(e, t) {
|
|
1268
|
+
var n = this, r = this.schema.primKey.keyPath;
|
|
1269
|
+
return this._trans("readwrite", function(i) {
|
|
1270
|
+
return n.core.get({
|
|
1271
|
+
trans: i,
|
|
1272
|
+
key: e
|
|
1273
|
+
}).then(function(a) {
|
|
1274
|
+
var o = a ?? {};
|
|
1275
|
+
return yt(o, t), r && x(o, r, e), n.core.mutate({
|
|
1276
|
+
trans: i,
|
|
1277
|
+
type: "put",
|
|
1278
|
+
values: [o],
|
|
1279
|
+
keys: [e],
|
|
1280
|
+
upsert: !0,
|
|
1281
|
+
updates: {
|
|
1282
|
+
keys: [e],
|
|
1283
|
+
changeSpecs: [t]
|
|
1284
|
+
}
|
|
1285
|
+
}).then(function(e) {
|
|
1286
|
+
return e.numFailures ? U.reject(e.failures[0]) : !!a;
|
|
1287
|
+
});
|
|
1288
|
+
});
|
|
1289
|
+
});
|
|
1290
|
+
}, J.prototype.update = function(e, t) {
|
|
1291
|
+
return typeof e != "object" || a(e) ? this.where(":id").equals(e).modify(t) : (e = b(e, this.schema.primKey.keyPath)) === void 0 ? K(new P.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t);
|
|
1292
|
+
}, J.prototype.put = function(e, t) {
|
|
1293
|
+
var n = this, r = this.schema.primKey, i = r.auto, a = r.keyPath, o = e;
|
|
1294
|
+
return a && i && (o = ft(a)(e)), this._trans("readwrite", function(e) {
|
|
1295
|
+
return n.core.mutate({
|
|
1296
|
+
trans: e,
|
|
1297
|
+
type: "put",
|
|
1298
|
+
values: [o],
|
|
1299
|
+
keys: t == null ? null : [t]
|
|
1300
|
+
});
|
|
1301
|
+
}).then(function(e) {
|
|
1302
|
+
return e.numFailures ? U.reject(e.failures[0]) : e.lastResult;
|
|
1303
|
+
}).then(function(t) {
|
|
1304
|
+
if (a) try {
|
|
1305
|
+
x(e, a, t);
|
|
1306
|
+
} catch {}
|
|
1307
|
+
return t;
|
|
1308
|
+
});
|
|
1309
|
+
}, J.prototype.delete = function(e) {
|
|
1310
|
+
var t = this;
|
|
1311
|
+
return this._trans("readwrite", function(n) {
|
|
1312
|
+
return t.core.mutate({
|
|
1313
|
+
trans: n,
|
|
1314
|
+
type: "delete",
|
|
1315
|
+
keys: [e]
|
|
1316
|
+
}).then(function(n) {
|
|
1317
|
+
return gt(t, [e], n);
|
|
1318
|
+
}).then(function(e) {
|
|
1319
|
+
return e.numFailures ? U.reject(e.failures[0]) : void 0;
|
|
1320
|
+
});
|
|
1321
|
+
});
|
|
1322
|
+
}, J.prototype.clear = function() {
|
|
1323
|
+
var e = this;
|
|
1324
|
+
return this._trans("readwrite", function(t) {
|
|
1325
|
+
return e.core.mutate({
|
|
1326
|
+
trans: t,
|
|
1327
|
+
type: "deleteRange",
|
|
1328
|
+
range: dt
|
|
1329
|
+
}).then(function(t) {
|
|
1330
|
+
return gt(e, null, t);
|
|
1331
|
+
});
|
|
1332
|
+
}).then(function(e) {
|
|
1333
|
+
return e.numFailures ? U.reject(e.failures[0]) : void 0;
|
|
1334
|
+
});
|
|
1335
|
+
}, J.prototype.bulkGet = function(e) {
|
|
1336
|
+
var t = this;
|
|
1337
|
+
return this._trans("readonly", function(n) {
|
|
1338
|
+
return t.core.getMany({
|
|
1339
|
+
keys: e,
|
|
1340
|
+
trans: n
|
|
1341
|
+
}).then(function(e) {
|
|
1342
|
+
return e.map(function(e) {
|
|
1343
|
+
return t.hook.reading.fire(e);
|
|
1344
|
+
});
|
|
1345
|
+
});
|
|
1346
|
+
});
|
|
1347
|
+
}, J.prototype.bulkAdd = function(e, t, n) {
|
|
1348
|
+
var r = this, i = Array.isArray(t) ? t : void 0, a = (n ||= i ? void 0 : t) ? n.allKeys : void 0;
|
|
1349
|
+
return this._trans("readwrite", function(t) {
|
|
1350
|
+
var n = r.schema.primKey, o = n.auto, n = n.keyPath;
|
|
1351
|
+
if (n && i) throw new P.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
1352
|
+
if (i && i.length !== e.length) throw new P.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1353
|
+
var s = e.length, o = n && o ? e.map(ft(n)) : e;
|
|
1354
|
+
return r.core.mutate({
|
|
1355
|
+
trans: t,
|
|
1356
|
+
type: "add",
|
|
1357
|
+
keys: i,
|
|
1358
|
+
values: o,
|
|
1359
|
+
wantResults: a
|
|
1360
|
+
}).then(function(e) {
|
|
1361
|
+
var t = e.numFailures, n = e.failures;
|
|
1362
|
+
if (t === 0) return a ? e.results : e.lastResult;
|
|
1363
|
+
throw new N(`${r.name}.bulkAdd(): ${t} of ${s} operations failed`, n);
|
|
1364
|
+
});
|
|
1365
|
+
});
|
|
1366
|
+
}, J.prototype.bulkPut = function(e, t, n) {
|
|
1367
|
+
var r = this, i = Array.isArray(t) ? t : void 0, a = (n ||= i ? void 0 : t) ? n.allKeys : void 0;
|
|
1368
|
+
return this._trans("readwrite", function(t) {
|
|
1369
|
+
var n = r.schema.primKey, o = n.auto, n = n.keyPath;
|
|
1370
|
+
if (n && i) throw new P.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
1371
|
+
if (i && i.length !== e.length) throw new P.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1372
|
+
var s = e.length, o = n && o ? e.map(ft(n)) : e;
|
|
1373
|
+
return r.core.mutate({
|
|
1374
|
+
trans: t,
|
|
1375
|
+
type: "put",
|
|
1376
|
+
keys: i,
|
|
1377
|
+
values: o,
|
|
1378
|
+
wantResults: a
|
|
1379
|
+
}).then(function(e) {
|
|
1380
|
+
var t = e.numFailures, n = e.failures;
|
|
1381
|
+
if (t === 0) return a ? e.results : e.lastResult;
|
|
1382
|
+
throw new N(`${r.name}.bulkPut(): ${t} of ${s} operations failed`, n);
|
|
1383
|
+
});
|
|
1384
|
+
});
|
|
1385
|
+
}, J.prototype.bulkUpdate = function(e) {
|
|
1386
|
+
var t = this, n = this.core, r = e.map(function(e) {
|
|
1387
|
+
return e.key;
|
|
1388
|
+
}), i = e.map(function(e) {
|
|
1389
|
+
return e.changes;
|
|
1390
|
+
}), a = [];
|
|
1391
|
+
return this._trans("readwrite", function(o) {
|
|
1392
|
+
return n.getMany({
|
|
1393
|
+
trans: o,
|
|
1394
|
+
keys: r,
|
|
1395
|
+
cache: "clone"
|
|
1396
|
+
}).then(function(s) {
|
|
1397
|
+
var c = [], l = [], u = (e.forEach(function(e, n) {
|
|
1398
|
+
var r = e.key, i = e.changes, o = s[n];
|
|
1399
|
+
if (o) {
|
|
1400
|
+
for (var u = 0, d = Object.keys(i); u < d.length; u++) {
|
|
1401
|
+
var f = d[u], p = i[f];
|
|
1402
|
+
if (f === t.schema.primKey.keyPath) {
|
|
1403
|
+
if (q(p, r) !== 0) throw new P.Constraint("Cannot update primary key in bulkUpdate()");
|
|
1404
|
+
} else x(o, f, p);
|
|
1405
|
+
}
|
|
1406
|
+
a.push(n), c.push(r), l.push(o);
|
|
1407
|
+
}
|
|
1408
|
+
}), c.length);
|
|
1409
|
+
return n.mutate({
|
|
1410
|
+
trans: o,
|
|
1411
|
+
type: "put",
|
|
1412
|
+
keys: c,
|
|
1413
|
+
values: l,
|
|
1414
|
+
updates: {
|
|
1415
|
+
keys: r,
|
|
1416
|
+
changeSpecs: i
|
|
1417
|
+
}
|
|
1418
|
+
}).then(function(e) {
|
|
1419
|
+
var n = e.numFailures, r = e.failures;
|
|
1420
|
+
if (n === 0) return u;
|
|
1421
|
+
for (var i = 0, o = Object.keys(r); i < o.length; i++) {
|
|
1422
|
+
var s, c = o[i], l = a[Number(c)];
|
|
1423
|
+
l != null && (s = r[c], delete r[c], r[l] = s);
|
|
1424
|
+
}
|
|
1425
|
+
throw new N(`${t.name}.bulkUpdate(): ${n} of ${u} operations failed`, r);
|
|
1426
|
+
});
|
|
1427
|
+
});
|
|
1428
|
+
});
|
|
1429
|
+
}, J.prototype.bulkDelete = function(e) {
|
|
1430
|
+
var t = this, n = e.length;
|
|
1431
|
+
return this._trans("readwrite", function(n) {
|
|
1432
|
+
return t.core.mutate({
|
|
1433
|
+
trans: n,
|
|
1434
|
+
type: "delete",
|
|
1435
|
+
keys: e
|
|
1436
|
+
}).then(function(n) {
|
|
1437
|
+
return gt(t, e, n);
|
|
1438
|
+
});
|
|
1439
|
+
}).then(function(e) {
|
|
1440
|
+
var r = e.numFailures, i = e.failures;
|
|
1441
|
+
if (r === 0) return e.lastResult;
|
|
1442
|
+
throw new N(`${t.name}.bulkDelete(): ${r} of ${n} operations failed`, i);
|
|
1443
|
+
});
|
|
1444
|
+
};
|
|
1445
|
+
var bt = J;
|
|
1446
|
+
function J() {}
|
|
1447
|
+
function xt(e) {
|
|
1448
|
+
function t(t, r) {
|
|
1449
|
+
if (r) {
|
|
1450
|
+
for (var i = arguments.length, a = Array(i - 1); --i;) a[i - 1] = arguments[i];
|
|
1451
|
+
return n[t].subscribe.apply(null, a), e;
|
|
1452
|
+
}
|
|
1453
|
+
if (typeof t == "string") return n[t];
|
|
1454
|
+
}
|
|
1455
|
+
var n = {};
|
|
1456
|
+
t.addEventType = s;
|
|
1457
|
+
for (var r = 1, o = arguments.length; r < o; ++r) s(arguments[r]);
|
|
1458
|
+
return t;
|
|
1459
|
+
function s(e, r, o) {
|
|
1460
|
+
var c, l;
|
|
1461
|
+
if (typeof e != "object") return r ||= z, l = {
|
|
1462
|
+
subscribers: [],
|
|
1463
|
+
fire: o ||= F,
|
|
1464
|
+
subscribe: function(e) {
|
|
1465
|
+
l.subscribers.indexOf(e) === -1 && (l.subscribers.push(e), l.fire = r(l.fire, e));
|
|
1466
|
+
},
|
|
1467
|
+
unsubscribe: function(e) {
|
|
1468
|
+
l.subscribers = l.subscribers.filter(function(t) {
|
|
1469
|
+
return t !== e;
|
|
1470
|
+
}), l.fire = l.subscribers.reduce(r, o);
|
|
1471
|
+
}
|
|
1472
|
+
}, n[e] = t[e] = l;
|
|
1473
|
+
i(c = e).forEach(function(e) {
|
|
1474
|
+
var t = c[e];
|
|
1475
|
+
if (a(t)) s(e, c[e][0], c[e][1]);
|
|
1476
|
+
else {
|
|
1477
|
+
if (t !== "asap") throw new P.InvalidArgument("Invalid event config");
|
|
1478
|
+
var n = s(e, I, function() {
|
|
1479
|
+
for (var e = arguments.length, t = Array(e); e--;) t[e] = arguments[e];
|
|
1480
|
+
n.subscribers.forEach(function(e) {
|
|
1481
|
+
y(function() {
|
|
1482
|
+
e.apply(null, t);
|
|
1483
|
+
});
|
|
1484
|
+
});
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
function St(e, t) {
|
|
1491
|
+
return p(t).from({ prototype: e }), t;
|
|
1492
|
+
}
|
|
1493
|
+
function Ct(e, t) {
|
|
1494
|
+
return !(e.filter || e.algorithm || e.or) && (t ? e.justLimit : !e.replayFilter);
|
|
1495
|
+
}
|
|
1496
|
+
function wt(e, t) {
|
|
1497
|
+
e.filter = ut(e.filter, t);
|
|
1498
|
+
}
|
|
1499
|
+
function Tt(e, t, n) {
|
|
1500
|
+
var r = e.replayFilter;
|
|
1501
|
+
e.replayFilter = r ? function() {
|
|
1502
|
+
return ut(r(), t());
|
|
1503
|
+
} : t, e.justLimit = n && !r;
|
|
1504
|
+
}
|
|
1505
|
+
function Et(e, t) {
|
|
1506
|
+
if (e.isPrimKey) return t.primaryKey;
|
|
1507
|
+
var n = t.getIndexByKeyPath(e.index);
|
|
1508
|
+
if (n) return n;
|
|
1509
|
+
throw new P.Schema("KeyPath " + e.index + " on object store " + t.name + " is not indexed");
|
|
1510
|
+
}
|
|
1511
|
+
function Dt(e, t, n) {
|
|
1512
|
+
var r = Et(e, t.schema);
|
|
1513
|
+
return t.openCursor({
|
|
1514
|
+
trans: n,
|
|
1515
|
+
values: !e.keysOnly,
|
|
1516
|
+
reverse: e.dir === "prev",
|
|
1517
|
+
unique: !!e.unique,
|
|
1518
|
+
query: {
|
|
1519
|
+
index: r,
|
|
1520
|
+
range: e.range
|
|
1521
|
+
}
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
1524
|
+
function Ot(e, t, n, r) {
|
|
1525
|
+
var i, a, o = e.replayFilter ? ut(e.filter, e.replayFilter()) : e.filter;
|
|
1526
|
+
return e.or ? (i = {}, a = function(e, n, r) {
|
|
1527
|
+
var a, s;
|
|
1528
|
+
o && !o(n, r, function(e) {
|
|
1529
|
+
return n.stop(e);
|
|
1530
|
+
}, function(e) {
|
|
1531
|
+
return n.fail(e);
|
|
1532
|
+
}) || ((s = "" + (a = n.primaryKey)) == "[object ArrayBuffer]" && (s = "" + new Uint8Array(a)), l(i, s)) || (i[s] = !0, t(e, n, r));
|
|
1533
|
+
}, Promise.all([e.or._iterate(a, n), kt(Dt(e, r, n), e.algorithm, a, !e.keysOnly && e.valueMapper)])) : kt(Dt(e, r, n), ut(e.algorithm, o), t, !e.keysOnly && e.valueMapper);
|
|
1534
|
+
}
|
|
1535
|
+
function kt(e, t, n, r) {
|
|
1536
|
+
var i = W(r ? function(e, t, i) {
|
|
1537
|
+
return n(r(e), t, i);
|
|
1538
|
+
} : n);
|
|
1539
|
+
return e.then(function(e) {
|
|
1540
|
+
if (e) return e.start(function() {
|
|
1541
|
+
var n = function() {
|
|
1542
|
+
return e.continue();
|
|
1543
|
+
};
|
|
1544
|
+
t && !t(e, function(e) {
|
|
1545
|
+
return n = e;
|
|
1546
|
+
}, function(t) {
|
|
1547
|
+
e.stop(t), n = F;
|
|
1548
|
+
}, function(t) {
|
|
1549
|
+
e.fail(t), n = F;
|
|
1550
|
+
}) || i(e.value, e, function(e) {
|
|
1551
|
+
return n = e;
|
|
1552
|
+
}), n();
|
|
1553
|
+
});
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
Y.prototype._read = function(e, t) {
|
|
1557
|
+
var n = this._ctx;
|
|
1558
|
+
return n.error ? n.table._trans(null, K.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
|
|
1559
|
+
}, Y.prototype._write = function(e) {
|
|
1560
|
+
var t = this._ctx;
|
|
1561
|
+
return t.error ? t.table._trans(null, K.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
|
|
1562
|
+
}, Y.prototype._addAlgorithm = function(e) {
|
|
1563
|
+
var t = this._ctx;
|
|
1564
|
+
t.algorithm = ut(t.algorithm, e);
|
|
1565
|
+
}, Y.prototype._iterate = function(e, t) {
|
|
1566
|
+
return Ot(this._ctx, e, t, this._ctx.table.core);
|
|
1567
|
+
}, Y.prototype.clone = function(e) {
|
|
1568
|
+
var t = Object.create(this.constructor.prototype), n = Object.create(this._ctx);
|
|
1569
|
+
return e && o(n, e), t._ctx = n, t;
|
|
1570
|
+
}, Y.prototype.raw = function() {
|
|
1571
|
+
return this._ctx.valueMapper = null, this;
|
|
1572
|
+
}, Y.prototype.each = function(e) {
|
|
1573
|
+
var t = this._ctx;
|
|
1574
|
+
return this._read(function(n) {
|
|
1575
|
+
return Ot(t, e, n, t.table.core);
|
|
1576
|
+
});
|
|
1577
|
+
}, Y.prototype.count = function(e) {
|
|
1578
|
+
var t = this;
|
|
1579
|
+
return this._read(function(e) {
|
|
1580
|
+
var n, r = t._ctx, i = r.table.core;
|
|
1581
|
+
return Ct(r, !0) ? i.count({
|
|
1582
|
+
trans: e,
|
|
1583
|
+
query: {
|
|
1584
|
+
index: Et(r, i.schema),
|
|
1585
|
+
range: r.range
|
|
1586
|
+
}
|
|
1587
|
+
}).then(function(e) {
|
|
1588
|
+
return Math.min(e, r.limit);
|
|
1589
|
+
}) : (n = 0, Ot(r, function() {
|
|
1590
|
+
return ++n, !1;
|
|
1591
|
+
}, e, i).then(function() {
|
|
1592
|
+
return n;
|
|
1593
|
+
}));
|
|
1594
|
+
}).then(e);
|
|
1595
|
+
}, Y.prototype.sortBy = function(e, t) {
|
|
1596
|
+
var n = e.split(".").reverse(), r = n[0], i = n.length - 1;
|
|
1597
|
+
function a(e, t) {
|
|
1598
|
+
return t ? a(e[n[t]], t - 1) : e[r];
|
|
1599
|
+
}
|
|
1600
|
+
var o = this._ctx.dir === "next" ? 1 : -1;
|
|
1601
|
+
function s(e, t) {
|
|
1602
|
+
return q(a(e, i), a(t, i)) * o;
|
|
1603
|
+
}
|
|
1604
|
+
return this.toArray(function(e) {
|
|
1605
|
+
return e.slice().sort(s);
|
|
1606
|
+
}).then(t);
|
|
1607
|
+
}, Y.prototype.toArray = function(e) {
|
|
1608
|
+
var t = this;
|
|
1609
|
+
return this._read(function(e) {
|
|
1610
|
+
var n, r, i, a = t._ctx;
|
|
1611
|
+
return Ct(a, !0) && 0 < a.limit ? (n = a.valueMapper, r = Et(a, a.table.core.schema), a.table.core.query({
|
|
1612
|
+
trans: e,
|
|
1613
|
+
limit: a.limit,
|
|
1614
|
+
values: !0,
|
|
1615
|
+
direction: a.dir === "prev" ? "prev" : void 0,
|
|
1616
|
+
query: {
|
|
1617
|
+
index: r,
|
|
1618
|
+
range: a.range
|
|
1619
|
+
}
|
|
1620
|
+
}).then(function(e) {
|
|
1621
|
+
return e = e.result, n ? e.map(n) : e;
|
|
1622
|
+
})) : (i = [], Ot(a, function(e) {
|
|
1623
|
+
return i.push(e);
|
|
1624
|
+
}, e, a.table.core).then(function() {
|
|
1625
|
+
return i;
|
|
1626
|
+
}));
|
|
1627
|
+
}, e);
|
|
1628
|
+
}, Y.prototype.offset = function(e) {
|
|
1629
|
+
var t = this._ctx;
|
|
1630
|
+
return e <= 0 || (t.offset += e, Ct(t) ? Tt(t, function() {
|
|
1631
|
+
var t = e;
|
|
1632
|
+
return function(e, n) {
|
|
1633
|
+
return t === 0 || (t === 1 ? --t : n(function() {
|
|
1634
|
+
e.advance(t), t = 0;
|
|
1635
|
+
}), !1);
|
|
1636
|
+
};
|
|
1637
|
+
}) : Tt(t, function() {
|
|
1638
|
+
var t = e;
|
|
1639
|
+
return function() {
|
|
1640
|
+
return --t < 0;
|
|
1641
|
+
};
|
|
1642
|
+
})), this;
|
|
1643
|
+
}, Y.prototype.limit = function(e) {
|
|
1644
|
+
return this._ctx.limit = Math.min(this._ctx.limit, e), Tt(this._ctx, function() {
|
|
1645
|
+
var t = e;
|
|
1646
|
+
return function(e, n, r) {
|
|
1647
|
+
return --t <= 0 && n(r), 0 <= t;
|
|
1648
|
+
};
|
|
1649
|
+
}, !0), this;
|
|
1650
|
+
}, Y.prototype.until = function(e, t) {
|
|
1651
|
+
return wt(this._ctx, function(n, r, i) {
|
|
1652
|
+
return !e(n.value) || (r(i), t);
|
|
1653
|
+
}), this;
|
|
1654
|
+
}, Y.prototype.first = function(e) {
|
|
1655
|
+
return this.limit(1).toArray(function(e) {
|
|
1656
|
+
return e[0];
|
|
1657
|
+
}).then(e);
|
|
1658
|
+
}, Y.prototype.last = function(e) {
|
|
1659
|
+
return this.reverse().first(e);
|
|
1660
|
+
}, Y.prototype.filter = function(e) {
|
|
1661
|
+
var t;
|
|
1662
|
+
return wt(this._ctx, function(t) {
|
|
1663
|
+
return e(t.value);
|
|
1664
|
+
}), (t = this._ctx).isMatch = ut(t.isMatch, e), this;
|
|
1665
|
+
}, Y.prototype.and = function(e) {
|
|
1666
|
+
return this.filter(e);
|
|
1667
|
+
}, Y.prototype.or = function(e) {
|
|
1668
|
+
return new this.db.WhereClause(this._ctx.table, e, this);
|
|
1669
|
+
}, Y.prototype.reverse = function() {
|
|
1670
|
+
return this._ctx.dir = this._ctx.dir === "prev" ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this;
|
|
1671
|
+
}, Y.prototype.desc = function() {
|
|
1672
|
+
return this.reverse();
|
|
1673
|
+
}, Y.prototype.eachKey = function(e) {
|
|
1674
|
+
var t = this._ctx;
|
|
1675
|
+
return t.keysOnly = !t.isMatch, this.each(function(t, n) {
|
|
1676
|
+
e(n.key, n);
|
|
1677
|
+
});
|
|
1678
|
+
}, Y.prototype.eachUniqueKey = function(e) {
|
|
1679
|
+
return this._ctx.unique = "unique", this.eachKey(e);
|
|
1680
|
+
}, Y.prototype.eachPrimaryKey = function(e) {
|
|
1681
|
+
var t = this._ctx;
|
|
1682
|
+
return t.keysOnly = !t.isMatch, this.each(function(t, n) {
|
|
1683
|
+
e(n.primaryKey, n);
|
|
1684
|
+
});
|
|
1685
|
+
}, Y.prototype.keys = function(e) {
|
|
1686
|
+
var t = this._ctx, n = (t.keysOnly = !t.isMatch, []);
|
|
1687
|
+
return this.each(function(e, t) {
|
|
1688
|
+
n.push(t.key);
|
|
1689
|
+
}).then(function() {
|
|
1690
|
+
return n;
|
|
1691
|
+
}).then(e);
|
|
1692
|
+
}, Y.prototype.primaryKeys = function(e) {
|
|
1693
|
+
var t = this._ctx;
|
|
1694
|
+
if (Ct(t, !0) && 0 < t.limit) return this._read(function(e) {
|
|
1695
|
+
var n = Et(t, t.table.core.schema);
|
|
1696
|
+
return t.table.core.query({
|
|
1697
|
+
trans: e,
|
|
1698
|
+
values: !1,
|
|
1699
|
+
limit: t.limit,
|
|
1700
|
+
direction: t.dir === "prev" ? "prev" : void 0,
|
|
1701
|
+
query: {
|
|
1702
|
+
index: n,
|
|
1703
|
+
range: t.range
|
|
1704
|
+
}
|
|
1705
|
+
});
|
|
1706
|
+
}).then(function(e) {
|
|
1707
|
+
return e.result;
|
|
1708
|
+
}).then(e);
|
|
1709
|
+
t.keysOnly = !t.isMatch;
|
|
1710
|
+
var n = [];
|
|
1711
|
+
return this.each(function(e, t) {
|
|
1712
|
+
n.push(t.primaryKey);
|
|
1713
|
+
}).then(function() {
|
|
1714
|
+
return n;
|
|
1715
|
+
}).then(e);
|
|
1716
|
+
}, Y.prototype.uniqueKeys = function(e) {
|
|
1717
|
+
return this._ctx.unique = "unique", this.keys(e);
|
|
1718
|
+
}, Y.prototype.firstKey = function(e) {
|
|
1719
|
+
return this.limit(1).keys(function(e) {
|
|
1720
|
+
return e[0];
|
|
1721
|
+
}).then(e);
|
|
1722
|
+
}, Y.prototype.lastKey = function(e) {
|
|
1723
|
+
return this.reverse().firstKey(e);
|
|
1724
|
+
}, Y.prototype.distinct = function() {
|
|
1725
|
+
var e, t = this._ctx, t = t.index && t.table.schema.idxByName[t.index];
|
|
1726
|
+
return t && t.multi && (e = {}, wt(this._ctx, function(t) {
|
|
1727
|
+
var t = t.primaryKey.toString(), n = l(e, t);
|
|
1728
|
+
return e[t] = !0, !n;
|
|
1729
|
+
})), this;
|
|
1730
|
+
}, Y.prototype.modify = function(e) {
|
|
1731
|
+
var t = this, n = this._ctx;
|
|
1732
|
+
return this._write(function(r) {
|
|
1733
|
+
function a(e, t) {
|
|
1734
|
+
var n = t.failures;
|
|
1735
|
+
p += e - t.numFailures;
|
|
1736
|
+
for (var r = 0, a = i(n); r < a.length; r++) {
|
|
1737
|
+
var o = a[r];
|
|
1738
|
+
f.push(n[o]);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
var o = typeof e == "function" ? e : function(t) {
|
|
1742
|
+
return yt(t, e);
|
|
1743
|
+
}, s = n.table.core, c = s.schema.primaryKey, l = c.outbound, u = c.extractKey, d = 200, c = t.db._options.modifyChunkSize, f = (c && (d = typeof c == "object" ? c[s.name] || c["*"] || 200 : c), []), p = 0, m = [], h = e === jt;
|
|
1744
|
+
return t.clone().primaryKeys().then(function(t) {
|
|
1745
|
+
function i(f) {
|
|
1746
|
+
var p = Math.min(d, t.length - f), m = t.slice(f, f + p);
|
|
1747
|
+
return (h ? Promise.resolve([]) : s.getMany({
|
|
1748
|
+
trans: r,
|
|
1749
|
+
keys: m,
|
|
1750
|
+
cache: "immutable"
|
|
1751
|
+
})).then(function(g) {
|
|
1752
|
+
var _ = [], v = [], y = l ? [] : null, b = h ? m : [];
|
|
1753
|
+
if (!h) for (var x = 0; x < p; ++x) {
|
|
1754
|
+
var ee = g[x], S = {
|
|
1755
|
+
value: w(ee),
|
|
1756
|
+
primKey: t[f + x]
|
|
1757
|
+
};
|
|
1758
|
+
!1 !== o.call(S, S.value, S) && (S.value == null ? b.push(t[f + x]) : l || q(u(ee), u(S.value)) === 0 ? (v.push(S.value), l && y.push(t[f + x])) : (b.push(t[f + x]), _.push(S.value)));
|
|
1759
|
+
}
|
|
1760
|
+
return Promise.resolve(0 < _.length && s.mutate({
|
|
1761
|
+
trans: r,
|
|
1762
|
+
type: "add",
|
|
1763
|
+
values: _
|
|
1764
|
+
}).then(function(e) {
|
|
1765
|
+
for (var t in e.failures) b.splice(parseInt(t), 1);
|
|
1766
|
+
a(_.length, e);
|
|
1767
|
+
})).then(function() {
|
|
1768
|
+
return (0 < v.length || c && typeof e == "object") && s.mutate({
|
|
1769
|
+
trans: r,
|
|
1770
|
+
type: "put",
|
|
1771
|
+
keys: y,
|
|
1772
|
+
values: v,
|
|
1773
|
+
criteria: c,
|
|
1774
|
+
changeSpec: typeof e != "function" && e,
|
|
1775
|
+
isAdditionalChunk: 0 < f
|
|
1776
|
+
}).then(function(e) {
|
|
1777
|
+
return a(v.length, e);
|
|
1778
|
+
});
|
|
1779
|
+
}).then(function() {
|
|
1780
|
+
return (0 < b.length || c && h) && s.mutate({
|
|
1781
|
+
trans: r,
|
|
1782
|
+
type: "delete",
|
|
1783
|
+
keys: b,
|
|
1784
|
+
criteria: c,
|
|
1785
|
+
isAdditionalChunk: 0 < f
|
|
1786
|
+
}).then(function(e) {
|
|
1787
|
+
return gt(n.table, b, e);
|
|
1788
|
+
}).then(function(e) {
|
|
1789
|
+
return a(b.length, e);
|
|
1790
|
+
});
|
|
1791
|
+
}).then(function() {
|
|
1792
|
+
return t.length > f + p && i(f + d);
|
|
1793
|
+
});
|
|
1794
|
+
});
|
|
1795
|
+
}
|
|
1796
|
+
var c = Ct(n) && n.limit === Infinity && (typeof e != "function" || h) && {
|
|
1797
|
+
index: n.index,
|
|
1798
|
+
range: n.range
|
|
1799
|
+
};
|
|
1800
|
+
return i(0).then(function() {
|
|
1801
|
+
if (0 < f.length) throw new ce("Error modifying one or more objects", f, p, m);
|
|
1802
|
+
return t.length;
|
|
1803
|
+
});
|
|
1804
|
+
});
|
|
1805
|
+
});
|
|
1806
|
+
}, Y.prototype.delete = function() {
|
|
1807
|
+
var e = this._ctx, t = e.range;
|
|
1808
|
+
return !Ct(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(jt) : this._write(function(n) {
|
|
1809
|
+
var r = e.table.core.schema.primaryKey, i = t;
|
|
1810
|
+
return e.table.core.count({
|
|
1811
|
+
trans: n,
|
|
1812
|
+
query: {
|
|
1813
|
+
index: r,
|
|
1814
|
+
range: i
|
|
1815
|
+
}
|
|
1816
|
+
}).then(function(t) {
|
|
1817
|
+
return e.table.core.mutate({
|
|
1818
|
+
trans: n,
|
|
1819
|
+
type: "deleteRange",
|
|
1820
|
+
range: i
|
|
1821
|
+
}).then(function(e) {
|
|
1822
|
+
var n = e.failures, e = e.numFailures;
|
|
1823
|
+
if (e) throw new ce("Could not delete some values", Object.keys(n).map(function(e) {
|
|
1824
|
+
return n[e];
|
|
1825
|
+
}), t - e);
|
|
1826
|
+
return t - e;
|
|
1827
|
+
});
|
|
1828
|
+
});
|
|
1829
|
+
});
|
|
1830
|
+
};
|
|
1831
|
+
var At = Y;
|
|
1832
|
+
function Y() {}
|
|
1833
|
+
var jt = function(e, t) {
|
|
1834
|
+
return t.value = null;
|
|
1835
|
+
};
|
|
1836
|
+
function Mt(e, t) {
|
|
1837
|
+
return e < t ? -1 : e === t ? 0 : 1;
|
|
1838
|
+
}
|
|
1839
|
+
function Nt(e, t) {
|
|
1840
|
+
return t < e ? -1 : e === t ? 0 : 1;
|
|
1841
|
+
}
|
|
1842
|
+
function Pt(e, t, n) {
|
|
1843
|
+
return e = e instanceof zt ? new e.Collection(e) : e, e._ctx.error = new (n || TypeError)(t), e;
|
|
1844
|
+
}
|
|
1845
|
+
function Ft(e) {
|
|
1846
|
+
return new e.Collection(e, function() {
|
|
1847
|
+
return Rt("");
|
|
1848
|
+
}).limit(0);
|
|
1849
|
+
}
|
|
1850
|
+
function It(e, t, n, r) {
|
|
1851
|
+
var i, a, o, s, c, l, u, d = n.length;
|
|
1852
|
+
if (!n.every(function(e) {
|
|
1853
|
+
return typeof e == "string";
|
|
1854
|
+
})) return Pt(e, ot);
|
|
1855
|
+
function f(e) {
|
|
1856
|
+
i = e === "next" ? function(e) {
|
|
1857
|
+
return e.toUpperCase();
|
|
1858
|
+
} : function(e) {
|
|
1859
|
+
return e.toLowerCase();
|
|
1860
|
+
}, a = e === "next" ? function(e) {
|
|
1861
|
+
return e.toLowerCase();
|
|
1862
|
+
} : function(e) {
|
|
1863
|
+
return e.toUpperCase();
|
|
1864
|
+
}, o = e === "next" ? Mt : Nt;
|
|
1865
|
+
var t = n.map(function(e) {
|
|
1866
|
+
return {
|
|
1867
|
+
lower: a(e),
|
|
1868
|
+
upper: i(e)
|
|
1869
|
+
};
|
|
1870
|
+
}).sort(function(e, t) {
|
|
1871
|
+
return o(e.lower, t.lower);
|
|
1872
|
+
});
|
|
1873
|
+
s = t.map(function(e) {
|
|
1874
|
+
return e.upper;
|
|
1875
|
+
}), c = t.map(function(e) {
|
|
1876
|
+
return e.lower;
|
|
1877
|
+
}), u = (l = e) === "next" ? "" : r;
|
|
1878
|
+
}
|
|
1879
|
+
f("next");
|
|
1880
|
+
var e = new e.Collection(e, function() {
|
|
1881
|
+
return Lt(s[0], c[d - 1] + r);
|
|
1882
|
+
}), p = (e._ondirectionchange = function(e) {
|
|
1883
|
+
f(e);
|
|
1884
|
+
}, 0);
|
|
1885
|
+
return e._addAlgorithm(function(e, n, r) {
|
|
1886
|
+
var i = e.key;
|
|
1887
|
+
if (typeof i == "string") {
|
|
1888
|
+
var f = a(i);
|
|
1889
|
+
if (t(f, c, p)) return !0;
|
|
1890
|
+
for (var m = null, h = p; h < d; ++h) {
|
|
1891
|
+
var g = ((e, t, n, r, i, a) => {
|
|
1892
|
+
for (var o = Math.min(e.length, r.length), s = -1, c = 0; c < o; ++c) {
|
|
1893
|
+
var l = t[c];
|
|
1894
|
+
if (l !== r[c]) return i(e[c], n[c]) < 0 ? e.substr(0, c) + n[c] + n.substr(c + 1) : i(e[c], r[c]) < 0 ? e.substr(0, c) + r[c] + n.substr(c + 1) : 0 <= s ? e.substr(0, s) + t[s] + n.substr(s + 1) : null;
|
|
1895
|
+
i(e[c], l) < 0 && (s = c);
|
|
1896
|
+
}
|
|
1897
|
+
return o < r.length && a === "next" ? e + n.substr(e.length) : o < e.length && a === "prev" ? e.substr(0, n.length) : s < 0 ? null : e.substr(0, s) + r[s] + n.substr(s + 1);
|
|
1898
|
+
})(i, f, s[h], c[h], o, l);
|
|
1899
|
+
g === null && m === null ? p = h + 1 : (m === null || 0 < o(m, g)) && (m = g);
|
|
1900
|
+
}
|
|
1901
|
+
n(m === null ? r : function() {
|
|
1902
|
+
e.continue(m + u);
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
return !1;
|
|
1906
|
+
}), e;
|
|
1907
|
+
}
|
|
1908
|
+
function Lt(e, t, n, r) {
|
|
1909
|
+
return {
|
|
1910
|
+
type: 2,
|
|
1911
|
+
lower: e,
|
|
1912
|
+
upper: t,
|
|
1913
|
+
lowerOpen: n,
|
|
1914
|
+
upperOpen: r
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
function Rt(e) {
|
|
1918
|
+
return {
|
|
1919
|
+
type: 1,
|
|
1920
|
+
lower: e,
|
|
1921
|
+
upper: e
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
Object.defineProperty(X.prototype, "Collection", {
|
|
1925
|
+
get: function() {
|
|
1926
|
+
return this._ctx.table.db.Collection;
|
|
1927
|
+
},
|
|
1928
|
+
enumerable: !1,
|
|
1929
|
+
configurable: !0
|
|
1930
|
+
}), X.prototype.between = function(e, t, n, r) {
|
|
1931
|
+
n = !1 !== n, r = !0 === r;
|
|
1932
|
+
try {
|
|
1933
|
+
return 0 < this._cmp(e, t) || this._cmp(e, t) === 0 && (n || r) && (!n || !r) ? Ft(this) : new this.Collection(this, function() {
|
|
1934
|
+
return Lt(e, t, !n, !r);
|
|
1935
|
+
});
|
|
1936
|
+
} catch {
|
|
1937
|
+
return Pt(this, at);
|
|
1938
|
+
}
|
|
1939
|
+
}, X.prototype.equals = function(e) {
|
|
1940
|
+
return e == null ? Pt(this, at) : new this.Collection(this, function() {
|
|
1941
|
+
return Rt(e);
|
|
1942
|
+
});
|
|
1943
|
+
}, X.prototype.above = function(e) {
|
|
1944
|
+
return e == null ? Pt(this, at) : new this.Collection(this, function() {
|
|
1945
|
+
return Lt(e, void 0, !0);
|
|
1946
|
+
});
|
|
1947
|
+
}, X.prototype.aboveOrEqual = function(e) {
|
|
1948
|
+
return e == null ? Pt(this, at) : new this.Collection(this, function() {
|
|
1949
|
+
return Lt(e, void 0, !1);
|
|
1950
|
+
});
|
|
1951
|
+
}, X.prototype.below = function(e) {
|
|
1952
|
+
return e == null ? Pt(this, at) : new this.Collection(this, function() {
|
|
1953
|
+
return Lt(void 0, e, !1, !0);
|
|
1954
|
+
});
|
|
1955
|
+
}, X.prototype.belowOrEqual = function(e) {
|
|
1956
|
+
return e == null ? Pt(this, at) : new this.Collection(this, function() {
|
|
1957
|
+
return Lt(void 0, e);
|
|
1958
|
+
});
|
|
1959
|
+
}, X.prototype.startsWith = function(e) {
|
|
1960
|
+
return typeof e == "string" ? this.between(e, e + it, !0, !0) : Pt(this, ot);
|
|
1961
|
+
}, X.prototype.startsWithIgnoreCase = function(e) {
|
|
1962
|
+
return e === "" ? this.startsWith(e) : It(this, function(e, t) {
|
|
1963
|
+
return e.indexOf(t[0]) === 0;
|
|
1964
|
+
}, [e], it);
|
|
1965
|
+
}, X.prototype.equalsIgnoreCase = function(e) {
|
|
1966
|
+
return It(this, function(e, t) {
|
|
1967
|
+
return e === t[0];
|
|
1968
|
+
}, [e], "");
|
|
1969
|
+
}, X.prototype.anyOfIgnoreCase = function() {
|
|
1970
|
+
var e = A.apply(k, arguments);
|
|
1971
|
+
return e.length === 0 ? Ft(this) : It(this, function(e, t) {
|
|
1972
|
+
return t.indexOf(e) !== -1;
|
|
1973
|
+
}, e, "");
|
|
1974
|
+
}, X.prototype.startsWithAnyOfIgnoreCase = function() {
|
|
1975
|
+
var e = A.apply(k, arguments);
|
|
1976
|
+
return e.length === 0 ? Ft(this) : It(this, function(e, t) {
|
|
1977
|
+
return t.some(function(t) {
|
|
1978
|
+
return e.indexOf(t) === 0;
|
|
1979
|
+
});
|
|
1980
|
+
}, e, it);
|
|
1981
|
+
}, X.prototype.anyOf = function() {
|
|
1982
|
+
var e, t, n = this, r = A.apply(k, arguments), i = this._cmp;
|
|
1983
|
+
try {
|
|
1984
|
+
r.sort(i);
|
|
1985
|
+
} catch {
|
|
1986
|
+
return Pt(this, at);
|
|
1987
|
+
}
|
|
1988
|
+
return r.length === 0 ? Ft(this) : ((e = new this.Collection(this, function() {
|
|
1989
|
+
return Lt(r[0], r[r.length - 1]);
|
|
1990
|
+
}))._ondirectionchange = function(e) {
|
|
1991
|
+
i = e === "next" ? n._ascending : n._descending, r.sort(i);
|
|
1992
|
+
}, t = 0, e._addAlgorithm(function(e, n, a) {
|
|
1993
|
+
for (var o = e.key; 0 < i(o, r[t]);) if (++t === r.length) return n(a), !1;
|
|
1994
|
+
return i(o, r[t]) === 0 || (n(function() {
|
|
1995
|
+
e.continue(r[t]);
|
|
1996
|
+
}), !1);
|
|
1997
|
+
}), e);
|
|
1998
|
+
}, X.prototype.notEqual = function(e) {
|
|
1999
|
+
return this.inAnyRange([[-Infinity, e], [e, this.db._maxKey]], {
|
|
2000
|
+
includeLowers: !1,
|
|
2001
|
+
includeUppers: !1
|
|
2002
|
+
});
|
|
2003
|
+
}, X.prototype.noneOf = function() {
|
|
2004
|
+
var e = A.apply(k, arguments);
|
|
2005
|
+
if (e.length === 0) return new this.Collection(this);
|
|
2006
|
+
try {
|
|
2007
|
+
e.sort(this._ascending);
|
|
2008
|
+
} catch {
|
|
2009
|
+
return Pt(this, at);
|
|
2010
|
+
}
|
|
2011
|
+
var t = e.reduce(function(e, t) {
|
|
2012
|
+
return e ? e.concat([[e[e.length - 1][1], t]]) : [[-Infinity, t]];
|
|
2013
|
+
}, null);
|
|
2014
|
+
return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, {
|
|
2015
|
+
includeLowers: !1,
|
|
2016
|
+
includeUppers: !1
|
|
2017
|
+
});
|
|
2018
|
+
}, X.prototype.inAnyRange = function(e, t) {
|
|
2019
|
+
var n = this, r = this._cmp, i = this._ascending, a = this._descending, o = this._min, s = this._max;
|
|
2020
|
+
if (e.length === 0) return Ft(this);
|
|
2021
|
+
if (!e.every(function(e) {
|
|
2022
|
+
return e[0] !== void 0 && e[1] !== void 0 && i(e[0], e[1]) <= 0;
|
|
2023
|
+
})) return Pt(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", P.InvalidArgument);
|
|
2024
|
+
var c = !t || !1 !== t.includeLowers, l = t && !0 === t.includeUppers, u, d = i;
|
|
2025
|
+
function f(e, t) {
|
|
2026
|
+
return d(e[0], t[0]);
|
|
2027
|
+
}
|
|
2028
|
+
try {
|
|
2029
|
+
(u = e.reduce(function(e, t) {
|
|
2030
|
+
for (var n = 0, i = e.length; n < i; ++n) {
|
|
2031
|
+
var a = e[n];
|
|
2032
|
+
if (r(t[0], a[1]) < 0 && 0 < r(t[1], a[0])) {
|
|
2033
|
+
a[0] = o(a[0], t[0]), a[1] = s(a[1], t[1]);
|
|
2034
|
+
break;
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
return n === i && e.push(t), e;
|
|
2038
|
+
}, [])).sort(f);
|
|
2039
|
+
} catch {
|
|
2040
|
+
return Pt(this, at);
|
|
2041
|
+
}
|
|
2042
|
+
var p = 0, m = l ? function(e) {
|
|
2043
|
+
return 0 < i(e, u[p][1]);
|
|
2044
|
+
} : function(e) {
|
|
2045
|
+
return 0 <= i(e, u[p][1]);
|
|
2046
|
+
}, h = c ? function(e) {
|
|
2047
|
+
return 0 < a(e, u[p][0]);
|
|
2048
|
+
} : function(e) {
|
|
2049
|
+
return 0 <= a(e, u[p][0]);
|
|
2050
|
+
}, g = m, t = new this.Collection(this, function() {
|
|
2051
|
+
return Lt(u[0][0], u[u.length - 1][1], !c, !l);
|
|
2052
|
+
});
|
|
2053
|
+
return t._ondirectionchange = function(e) {
|
|
2054
|
+
d = e === "next" ? (g = m, i) : (g = h, a), u.sort(f);
|
|
2055
|
+
}, t._addAlgorithm(function(e, t, r) {
|
|
2056
|
+
for (var a, o = e.key; g(o);) if (++p === u.length) return t(r), !1;
|
|
2057
|
+
return !m(a = o) && !h(a) || (n._cmp(o, u[p][1]) === 0 || n._cmp(o, u[p][0]) === 0 || t(function() {
|
|
2058
|
+
d === i ? e.continue(u[p][0]) : e.continue(u[p][1]);
|
|
2059
|
+
}), !1);
|
|
2060
|
+
}), t;
|
|
2061
|
+
}, X.prototype.startsWithAnyOf = function() {
|
|
2062
|
+
var e = A.apply(k, arguments);
|
|
2063
|
+
return e.every(function(e) {
|
|
2064
|
+
return typeof e == "string";
|
|
2065
|
+
}) ? e.length === 0 ? Ft(this) : this.inAnyRange(e.map(function(e) {
|
|
2066
|
+
return [e, e + it];
|
|
2067
|
+
})) : Pt(this, "startsWithAnyOf() only works with strings");
|
|
2068
|
+
};
|
|
2069
|
+
var zt = X;
|
|
2070
|
+
function X() {}
|
|
2071
|
+
function Bt(e) {
|
|
2072
|
+
return W(function(t) {
|
|
2073
|
+
return Vt(t), e(t.target.error), !1;
|
|
2074
|
+
});
|
|
2075
|
+
}
|
|
2076
|
+
function Vt(e) {
|
|
2077
|
+
e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
|
|
2078
|
+
}
|
|
2079
|
+
var Ht = "storagemutated", Ut = "x-storagemutated-1", Z = xt(null, Ht), Wt = (Gt.prototype._lock = function() {
|
|
2080
|
+
return v(!H.global), ++this._reculock, this._reculock !== 1 || H.global || (H.lockOwnerFor = this), this;
|
|
2081
|
+
}, Gt.prototype._unlock = function() {
|
|
2082
|
+
if (v(!H.global), --this._reculock == 0) for (H.global || (H.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked();) {
|
|
2083
|
+
var e = this._blockedFuncs.shift();
|
|
2084
|
+
try {
|
|
2085
|
+
tt(e[1], e[0]);
|
|
2086
|
+
} catch {}
|
|
2087
|
+
}
|
|
2088
|
+
return this;
|
|
2089
|
+
}, Gt.prototype._locked = function() {
|
|
2090
|
+
return this._reculock && H.lockOwnerFor !== this;
|
|
2091
|
+
}, Gt.prototype.create = function(e) {
|
|
2092
|
+
var t = this;
|
|
2093
|
+
if (this.mode) {
|
|
2094
|
+
var n = this.db.idbdb, r = this.db._state.dbOpenError;
|
|
2095
|
+
if (v(!this.idbtrans), !e && !n) switch (r && r.name) {
|
|
2096
|
+
case "DatabaseClosedError": throw new P.DatabaseClosed(r);
|
|
2097
|
+
case "MissingAPIError": throw new P.MissingAPI(r.message, r);
|
|
2098
|
+
default: throw new P.OpenFailed(r);
|
|
2099
|
+
}
|
|
2100
|
+
if (!this.active) throw new P.TransactionInactive();
|
|
2101
|
+
v(this._completion._state === null), (e = this.idbtrans = e || (this.db.core || n).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = W(function(n) {
|
|
2102
|
+
Vt(n), t._reject(e.error);
|
|
2103
|
+
}), e.onabort = W(function(n) {
|
|
2104
|
+
Vt(n), t.active && t._reject(new P.Abort(e.error)), t.active = !1, t.on("abort").fire(n);
|
|
2105
|
+
}), e.oncomplete = W(function() {
|
|
2106
|
+
t.active = !1, t._resolve(), "mutatedParts" in e && Z.storagemutated.fire(e.mutatedParts);
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
return this;
|
|
2110
|
+
}, Gt.prototype._promise = function(e, t, n) {
|
|
2111
|
+
var r, i = this;
|
|
2112
|
+
return e === "readwrite" && this.mode !== "readwrite" ? K(new P.ReadOnly("Transaction is readonly")) : this.active ? this._locked() ? new U(function(r, a) {
|
|
2113
|
+
i._blockedFuncs.push([function() {
|
|
2114
|
+
i._promise(e, t, n).then(r, a);
|
|
2115
|
+
}, H]);
|
|
2116
|
+
}) : n ? Je(function() {
|
|
2117
|
+
var e = new U(function(e, n) {
|
|
2118
|
+
i._lock();
|
|
2119
|
+
var r = t(e, n, i);
|
|
2120
|
+
r && r.then && r.then(e, n);
|
|
2121
|
+
});
|
|
2122
|
+
return e.finally(function() {
|
|
2123
|
+
return i._unlock();
|
|
2124
|
+
}), e._lib = !0, e;
|
|
2125
|
+
}) : ((r = new U(function(e, n) {
|
|
2126
|
+
var r = t(e, n, i);
|
|
2127
|
+
r && r.then && r.then(e, n);
|
|
2128
|
+
}))._lib = !0, r) : K(new P.TransactionInactive());
|
|
2129
|
+
}, Gt.prototype._root = function() {
|
|
2130
|
+
return this.parent ? this.parent._root() : this;
|
|
2131
|
+
}, Gt.prototype.waitFor = function(e) {
|
|
2132
|
+
var t, n = this._root(), r = U.resolve(e), i = (n._waitingFor ? n._waitingFor = n._waitingFor.then(function() {
|
|
2133
|
+
return r;
|
|
2134
|
+
}) : (n._waitingFor = r, n._waitingQueue = [], t = n.idbtrans.objectStore(n.storeNames[0]), function e() {
|
|
2135
|
+
for (++n._spinCount; n._waitingQueue.length;) n._waitingQueue.shift()();
|
|
2136
|
+
n._waitingFor && (t.get(-Infinity).onsuccess = e);
|
|
2137
|
+
}()), n._waitingFor);
|
|
2138
|
+
return new U(function(e, t) {
|
|
2139
|
+
r.then(function(t) {
|
|
2140
|
+
return n._waitingQueue.push(W(e.bind(null, t)));
|
|
2141
|
+
}, function(e) {
|
|
2142
|
+
return n._waitingQueue.push(W(t.bind(null, e)));
|
|
2143
|
+
}).finally(function() {
|
|
2144
|
+
n._waitingFor === i && (n._waitingFor = null);
|
|
2145
|
+
});
|
|
2146
|
+
});
|
|
2147
|
+
}, Gt.prototype.abort = function() {
|
|
2148
|
+
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new P.Abort()));
|
|
2149
|
+
}, Gt.prototype.table = function(e) {
|
|
2150
|
+
var t = this._memoizedTables ||= {};
|
|
2151
|
+
if (l(t, e)) return t[e];
|
|
2152
|
+
var n = this.schema[e];
|
|
2153
|
+
if (n) return (n = new this.db.Table(e, n, this)).core = this.db.core.table(e), t[e] = n;
|
|
2154
|
+
throw new P.NotFound("Table " + e + " not part of transaction");
|
|
2155
|
+
}, Gt);
|
|
2156
|
+
function Gt() {}
|
|
2157
|
+
function Kt(e, t, n, r, i, a, o, s) {
|
|
2158
|
+
return {
|
|
2159
|
+
name: e,
|
|
2160
|
+
keyPath: t,
|
|
2161
|
+
unique: n,
|
|
2162
|
+
multi: r,
|
|
2163
|
+
auto: i,
|
|
2164
|
+
compound: a,
|
|
2165
|
+
src: (n && !o ? "&" : "") + (r ? "*" : "") + (i ? "++" : "") + qt(t),
|
|
2166
|
+
type: s
|
|
2167
|
+
};
|
|
2168
|
+
}
|
|
2169
|
+
function qt(e) {
|
|
2170
|
+
return typeof e == "string" ? e : e ? "[" + [].join.call(e, "+") + "]" : "";
|
|
2171
|
+
}
|
|
2172
|
+
function Jt(e, t, n) {
|
|
2173
|
+
return {
|
|
2174
|
+
name: e,
|
|
2175
|
+
primKey: t,
|
|
2176
|
+
indexes: n,
|
|
2177
|
+
mappedClass: null,
|
|
2178
|
+
idxByName: (r = function(e) {
|
|
2179
|
+
return [e.name, e];
|
|
2180
|
+
}, n.reduce(function(e, t, n) {
|
|
2181
|
+
return t = r(t, n), t && (e[t[0]] = t[1]), e;
|
|
2182
|
+
}, {}))
|
|
2183
|
+
};
|
|
2184
|
+
var r;
|
|
2185
|
+
}
|
|
2186
|
+
var Yt = function(e) {
|
|
2187
|
+
try {
|
|
2188
|
+
return e.only([[]]), Yt = function() {
|
|
2189
|
+
return [[]];
|
|
2190
|
+
}, [[]];
|
|
2191
|
+
} catch {
|
|
2192
|
+
return Yt = function() {
|
|
2193
|
+
return it;
|
|
2194
|
+
}, it;
|
|
2195
|
+
}
|
|
2196
|
+
};
|
|
2197
|
+
function Xt(e) {
|
|
2198
|
+
return e == null ? function() {} : typeof e == "string" ? (t = e).split(".").length === 1 ? function(e) {
|
|
2199
|
+
return e[t];
|
|
2200
|
+
} : function(e) {
|
|
2201
|
+
return b(e, t);
|
|
2202
|
+
} : function(t) {
|
|
2203
|
+
return b(t, e);
|
|
2204
|
+
};
|
|
2205
|
+
var t;
|
|
2206
|
+
}
|
|
2207
|
+
function Zt(e) {
|
|
2208
|
+
return [].slice.call(e);
|
|
2209
|
+
}
|
|
2210
|
+
var Qt = 0;
|
|
2211
|
+
function $t(e) {
|
|
2212
|
+
return e == null ? ":id" : typeof e == "string" ? e : `[${e.join("+")}]`;
|
|
2213
|
+
}
|
|
2214
|
+
function en(e, t, n) {
|
|
2215
|
+
function r(e) {
|
|
2216
|
+
if (e.type === 3) return null;
|
|
2217
|
+
if (e.type === 4) throw Error("Cannot convert never type to IDBKeyRange");
|
|
2218
|
+
var n = e.lower, r = e.upper, i = e.lowerOpen, e = e.upperOpen;
|
|
2219
|
+
return n === void 0 ? r === void 0 ? null : t.upperBound(r, !!e) : r === void 0 ? t.lowerBound(n, !!i) : t.bound(n, r, !!i, !!e);
|
|
2220
|
+
}
|
|
2221
|
+
function i(e) {
|
|
2222
|
+
var t, n, i = e.name;
|
|
2223
|
+
return {
|
|
2224
|
+
name: i,
|
|
2225
|
+
schema: e,
|
|
2226
|
+
mutate: function(e) {
|
|
2227
|
+
var t = e.trans, n = e.type, a = e.keys, o = e.values, s = e.range;
|
|
2228
|
+
return new Promise(function(e, c) {
|
|
2229
|
+
e = W(e);
|
|
2230
|
+
var l = t.objectStore(i), u = l.keyPath == null, d = n === "put" || n === "add";
|
|
2231
|
+
if (!d && n !== "delete" && n !== "deleteRange") throw Error("Invalid operation type: " + n);
|
|
2232
|
+
var f, p = (a || o || { length: 1 }).length;
|
|
2233
|
+
if (a && o && a.length !== o.length) throw Error("Given keys array must have same length as given values array.");
|
|
2234
|
+
if (p === 0) return e({
|
|
2235
|
+
numFailures: 0,
|
|
2236
|
+
failures: {},
|
|
2237
|
+
results: [],
|
|
2238
|
+
lastResult: void 0
|
|
2239
|
+
});
|
|
2240
|
+
function m(e) {
|
|
2241
|
+
++_, Vt(e);
|
|
2242
|
+
}
|
|
2243
|
+
var h = [], g = [], _ = 0;
|
|
2244
|
+
if (n === "deleteRange") {
|
|
2245
|
+
if (s.type === 4) return e({
|
|
2246
|
+
numFailures: _,
|
|
2247
|
+
failures: g,
|
|
2248
|
+
results: [],
|
|
2249
|
+
lastResult: void 0
|
|
2250
|
+
});
|
|
2251
|
+
s.type === 3 ? h.push(f = l.clear()) : h.push(f = l.delete(r(s)));
|
|
2252
|
+
} else {
|
|
2253
|
+
var u = d ? u ? [o, a] : [o, null] : [a, null], v = u[0], y = u[1];
|
|
2254
|
+
if (d) for (var b = 0; b < p; ++b) h.push(f = y && y[b] !== void 0 ? l[n](v[b], y[b]) : l[n](v[b])), f.onerror = m;
|
|
2255
|
+
else for (b = 0; b < p; ++b) h.push(f = l[n](v[b])), f.onerror = m;
|
|
2256
|
+
}
|
|
2257
|
+
function x(t) {
|
|
2258
|
+
t = t.target.result, h.forEach(function(e, t) {
|
|
2259
|
+
return e.error != null && (g[t] = e.error);
|
|
2260
|
+
}), e({
|
|
2261
|
+
numFailures: _,
|
|
2262
|
+
failures: g,
|
|
2263
|
+
results: n === "delete" ? a : h.map(function(e) {
|
|
2264
|
+
return e.result;
|
|
2265
|
+
}),
|
|
2266
|
+
lastResult: t
|
|
2267
|
+
});
|
|
2268
|
+
}
|
|
2269
|
+
f.onerror = function(e) {
|
|
2270
|
+
m(e), x(e);
|
|
2271
|
+
}, f.onsuccess = x;
|
|
2272
|
+
});
|
|
2273
|
+
},
|
|
2274
|
+
getMany: function(e) {
|
|
2275
|
+
var t = e.trans, n = e.keys;
|
|
2276
|
+
return new Promise(function(e, r) {
|
|
2277
|
+
e = W(e);
|
|
2278
|
+
for (var a, o = t.objectStore(i), s = n.length, c = Array(s), l = 0, u = 0, d = function(t) {
|
|
2279
|
+
t = t.target, c[t._pos] = t.result, ++u === l && e(c);
|
|
2280
|
+
}, f = Bt(r), p = 0; p < s; ++p) n[p] != null && ((a = o.get(n[p]))._pos = p, a.onsuccess = d, a.onerror = f, ++l);
|
|
2281
|
+
l === 0 && e(c);
|
|
2282
|
+
});
|
|
2283
|
+
},
|
|
2284
|
+
get: function(e) {
|
|
2285
|
+
var t = e.trans, n = e.key;
|
|
2286
|
+
return new Promise(function(e, r) {
|
|
2287
|
+
e = W(e);
|
|
2288
|
+
var a = t.objectStore(i).get(n);
|
|
2289
|
+
a.onsuccess = function(t) {
|
|
2290
|
+
return e(t.target.result);
|
|
2291
|
+
}, a.onerror = Bt(r);
|
|
2292
|
+
});
|
|
2293
|
+
},
|
|
2294
|
+
query: (t = c, n = l, function(e) {
|
|
2295
|
+
return new Promise(function(a, o) {
|
|
2296
|
+
a = W(a);
|
|
2297
|
+
var s, c, l, u, d = e.trans, f = e.values, p = e.limit, m = e.query, h = (h = e.direction) ?? "next", g = p === Infinity ? void 0 : p, _ = m.index, m = m.range, d = d.objectStore(i), d = _.isPrimaryKey ? d : d.index(_.name), _ = r(m);
|
|
2298
|
+
if (p === 0) return a({ result: [] });
|
|
2299
|
+
n ? (m = {
|
|
2300
|
+
query: _,
|
|
2301
|
+
count: g,
|
|
2302
|
+
direction: h
|
|
2303
|
+
}, (s = f ? d.getAll(m) : d.getAllKeys(m)).onsuccess = function(e) {
|
|
2304
|
+
return a({ result: e.target.result });
|
|
2305
|
+
}, s.onerror = Bt(o)) : t && h === "next" ? ((s = f ? d.getAll(_, g) : d.getAllKeys(_, g)).onsuccess = function(e) {
|
|
2306
|
+
return a({ result: e.target.result });
|
|
2307
|
+
}, s.onerror = Bt(o)) : (c = 0, l = !f && "openKeyCursor" in d ? d.openKeyCursor(_, h) : d.openCursor(_, h), u = [], l.onsuccess = function() {
|
|
2308
|
+
var e = l.result;
|
|
2309
|
+
return !e || (u.push(f ? e.value : e.primaryKey), ++c === p) ? a({ result: u }) : void e.continue();
|
|
2310
|
+
}, l.onerror = Bt(o));
|
|
2311
|
+
});
|
|
2312
|
+
}),
|
|
2313
|
+
openCursor: function(e) {
|
|
2314
|
+
var t = e.trans, n = e.values, a = e.query, o = e.reverse, s = e.unique;
|
|
2315
|
+
return new Promise(function(e, c) {
|
|
2316
|
+
e = W(e);
|
|
2317
|
+
var l = a.index, u = a.range, d = t.objectStore(i), d = l.isPrimaryKey ? d : d.index(l.name), l = o ? s ? "prevunique" : "prev" : s ? "nextunique" : "next", f = !n && "openKeyCursor" in d ? d.openKeyCursor(r(u), l) : d.openCursor(r(u), l);
|
|
2318
|
+
f.onerror = Bt(c), f.onsuccess = W(function(n) {
|
|
2319
|
+
var r, i, a, o, s = f.result;
|
|
2320
|
+
s ? (s.___id = ++Qt, s.done = !1, r = s.continue.bind(s), i = (i = s.continuePrimaryKey) && i.bind(s), a = s.advance.bind(s), o = function() {
|
|
2321
|
+
throw Error("Cursor not stopped");
|
|
2322
|
+
}, s.trans = t, s.stop = s.continue = s.continuePrimaryKey = s.advance = function() {
|
|
2323
|
+
throw Error("Cursor not started");
|
|
2324
|
+
}, s.fail = W(c), s.next = function() {
|
|
2325
|
+
var e = this, t = 1;
|
|
2326
|
+
return this.start(function() {
|
|
2327
|
+
return t-- ? e.continue() : e.stop();
|
|
2328
|
+
}).then(function() {
|
|
2329
|
+
return e;
|
|
2330
|
+
});
|
|
2331
|
+
}, s.start = function(e) {
|
|
2332
|
+
function t() {
|
|
2333
|
+
if (f.result) try {
|
|
2334
|
+
e();
|
|
2335
|
+
} catch (e) {
|
|
2336
|
+
s.fail(e);
|
|
2337
|
+
}
|
|
2338
|
+
else s.done = !0, s.start = function() {
|
|
2339
|
+
throw Error("Cursor behind last entry");
|
|
2340
|
+
}, s.stop();
|
|
2341
|
+
}
|
|
2342
|
+
var n = new Promise(function(e, t) {
|
|
2343
|
+
e = W(e), f.onerror = Bt(t), s.fail = t, s.stop = function(t) {
|
|
2344
|
+
s.stop = s.continue = s.continuePrimaryKey = s.advance = o, e(t);
|
|
2345
|
+
};
|
|
2346
|
+
});
|
|
2347
|
+
return f.onsuccess = W(function(e) {
|
|
2348
|
+
f.onsuccess = t, t();
|
|
2349
|
+
}), s.continue = r, s.continuePrimaryKey = i, s.advance = a, t(), n;
|
|
2350
|
+
}, e(s)) : e(null);
|
|
2351
|
+
}, c);
|
|
2352
|
+
});
|
|
2353
|
+
},
|
|
2354
|
+
count: function(e) {
|
|
2355
|
+
var t = e.query, n = e.trans, a = t.index, o = t.range;
|
|
2356
|
+
return new Promise(function(e, t) {
|
|
2357
|
+
var s = n.objectStore(i), s = a.isPrimaryKey ? s : s.index(a.name), c = r(o), c = c ? s.count(c) : s.count();
|
|
2358
|
+
c.onsuccess = W(function(t) {
|
|
2359
|
+
return e(t.target.result);
|
|
2360
|
+
}), c.onerror = Bt(t);
|
|
2361
|
+
});
|
|
2362
|
+
}
|
|
2363
|
+
};
|
|
2364
|
+
}
|
|
2365
|
+
o = n, s = Zt((n = e).objectStoreNames), u = 0 < s.length ? o.objectStore(s[0]) : {};
|
|
2366
|
+
var o, n = {
|
|
2367
|
+
schema: {
|
|
2368
|
+
name: n.name,
|
|
2369
|
+
tables: s.map(function(e) {
|
|
2370
|
+
return o.objectStore(e);
|
|
2371
|
+
}).map(function(e) {
|
|
2372
|
+
var t = e.keyPath, n = e.autoIncrement, r = a(t), i = {}, r = {
|
|
2373
|
+
name: e.name,
|
|
2374
|
+
primaryKey: {
|
|
2375
|
+
name: null,
|
|
2376
|
+
isPrimaryKey: !0,
|
|
2377
|
+
outbound: t == null,
|
|
2378
|
+
compound: r,
|
|
2379
|
+
keyPath: t,
|
|
2380
|
+
autoIncrement: n,
|
|
2381
|
+
unique: !0,
|
|
2382
|
+
extractKey: Xt(t)
|
|
2383
|
+
},
|
|
2384
|
+
indexes: Zt(e.indexNames).map(function(t) {
|
|
2385
|
+
return e.index(t);
|
|
2386
|
+
}).map(function(e) {
|
|
2387
|
+
var t = e.name, n = e.unique, r = e.multiEntry, e = e.keyPath, t = {
|
|
2388
|
+
name: t,
|
|
2389
|
+
compound: a(e),
|
|
2390
|
+
keyPath: e,
|
|
2391
|
+
unique: n,
|
|
2392
|
+
multiEntry: r,
|
|
2393
|
+
extractKey: Xt(e)
|
|
2394
|
+
};
|
|
2395
|
+
return i[$t(e)] = t;
|
|
2396
|
+
}),
|
|
2397
|
+
getIndexByKeyPath: function(e) {
|
|
2398
|
+
return i[$t(e)];
|
|
2399
|
+
}
|
|
2400
|
+
};
|
|
2401
|
+
return i[":id"] = r.primaryKey, t != null && (i[$t(t)] = r.primaryKey), r;
|
|
2402
|
+
})
|
|
2403
|
+
},
|
|
2404
|
+
hasGetAll: 0 < s.length && "getAll" in u && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604),
|
|
2405
|
+
hasIdb3Features: "getAllRecords" in u
|
|
2406
|
+
}, s = n.schema, c = n.hasGetAll, l = n.hasIdb3Features, u = s.tables.map(i), d = {};
|
|
2407
|
+
return u.forEach(function(e) {
|
|
2408
|
+
return d[e.name] = e;
|
|
2409
|
+
}), {
|
|
2410
|
+
stack: "dbcore",
|
|
2411
|
+
transaction: e.transaction.bind(e),
|
|
2412
|
+
table: function(e) {
|
|
2413
|
+
if (d[e]) return d[e];
|
|
2414
|
+
throw Error(`Table '${e}' not found`);
|
|
2415
|
+
},
|
|
2416
|
+
MIN_KEY: -Infinity,
|
|
2417
|
+
MAX_KEY: Yt(t),
|
|
2418
|
+
schema: s
|
|
2419
|
+
};
|
|
2420
|
+
}
|
|
2421
|
+
function tn(e, n, r, i) {
|
|
2422
|
+
return r = r.IDBKeyRange, n = en(n, r, i), { dbcore: e.dbcore.reduce(function(e, n) {
|
|
2423
|
+
return n = n.create, t(t({}, e), n(e));
|
|
2424
|
+
}, n) };
|
|
2425
|
+
}
|
|
2426
|
+
function nn(e, t) {
|
|
2427
|
+
var n = t.db, n = tn(e._middlewares, n, e._deps, t);
|
|
2428
|
+
e.core = n.dbcore, e.tables.forEach(function(t) {
|
|
2429
|
+
var n = t.name;
|
|
2430
|
+
e.core.schema.tables.some(function(e) {
|
|
2431
|
+
return e.name === n;
|
|
2432
|
+
}) && (t.core = e.core.table(n), e[n] instanceof e.Table) && (e[n].core = t.core);
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2435
|
+
function rn(e, t, n, r) {
|
|
2436
|
+
n.forEach(function(n) {
|
|
2437
|
+
var i = r[n];
|
|
2438
|
+
t.forEach(function(t) {
|
|
2439
|
+
var r = function e(t, n) {
|
|
2440
|
+
return m(t, n) || (t = s(t)) && e(t, n);
|
|
2441
|
+
}(t, n);
|
|
2442
|
+
(!r || "value" in r && r.value === void 0) && (t === e.Transaction.prototype || t instanceof e.Transaction ? f(t, n, {
|
|
2443
|
+
get: function() {
|
|
2444
|
+
return this.table(n);
|
|
2445
|
+
},
|
|
2446
|
+
set: function(e) {
|
|
2447
|
+
d(this, n, {
|
|
2448
|
+
value: e,
|
|
2449
|
+
writable: !0,
|
|
2450
|
+
configurable: !0,
|
|
2451
|
+
enumerable: !0
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
}) : t[n] = new e.Table(n, i));
|
|
2455
|
+
});
|
|
2456
|
+
});
|
|
2457
|
+
}
|
|
2458
|
+
function an(e, t) {
|
|
2459
|
+
t.forEach(function(t) {
|
|
2460
|
+
for (var n in t) t[n] instanceof e.Table && delete t[n];
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2463
|
+
function on(e, t) {
|
|
2464
|
+
return e._cfg.version - t._cfg.version;
|
|
2465
|
+
}
|
|
2466
|
+
function sn(e, t, n, r) {
|
|
2467
|
+
var a = e._dbSchema, o = (n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Jt("$meta", hn("")[0], []), e._storeNames.push("$meta")), e._createTransaction("readwrite", e._storeNames, a)), s = (o.create(n), o._completion.catch(r), o._reject.bind(o)), c = H.transless || H;
|
|
2468
|
+
Je(function() {
|
|
2469
|
+
if (H.trans = o, H.transless = c, t !== 0) return nn(e, n), l = t, ((r = o).storeNames.includes("$meta") ? r.table("$meta").get("version").then(function(e) {
|
|
2470
|
+
return e ?? l;
|
|
2471
|
+
}) : U.resolve(l)).then(function(t) {
|
|
2472
|
+
var r = e, a = t, s = o, c = n, l = [], t = r._versions, u = r._dbSchema = pn(0, r.idbdb, c);
|
|
2473
|
+
return (t = t.filter(function(e) {
|
|
2474
|
+
return e._cfg.version >= a;
|
|
2475
|
+
})).length === 0 ? U.resolve() : (t.forEach(function(e) {
|
|
2476
|
+
l.push(function() {
|
|
2477
|
+
var t, n, o, l = u, d = e._cfg.dbschema, f = (mn(r, l, c), mn(r, d, c), u = r._dbSchema = d, ln(l, d)), p = (f.add.forEach(function(e) {
|
|
2478
|
+
un(c, e[0], e[1].primKey, e[1].indexes);
|
|
2479
|
+
}), f.change.forEach(function(e) {
|
|
2480
|
+
if (e.recreate) throw new P.Upgrade("Not yet support for changing primary key");
|
|
2481
|
+
var t = c.objectStore(e.name);
|
|
2482
|
+
e.add.forEach(function(e) {
|
|
2483
|
+
return fn(t, e);
|
|
2484
|
+
}), e.change.forEach(function(e) {
|
|
2485
|
+
t.deleteIndex(e.name), fn(t, e);
|
|
2486
|
+
}), e.del.forEach(function(e) {
|
|
2487
|
+
return t.deleteIndex(e);
|
|
2488
|
+
});
|
|
2489
|
+
}), e._cfg.contentUpgrade);
|
|
2490
|
+
if (p && e._cfg.version > a) return nn(r, c), s._memoizedTables = {}, t = ee(d), f.del.forEach(function(e) {
|
|
2491
|
+
t[e] = l[e];
|
|
2492
|
+
}), an(r, [r.Transaction.prototype]), rn(r, [r.Transaction.prototype], i(t), t), s.schema = t, (n = ae(p)) && Ye(), d = U.follow(function() {
|
|
2493
|
+
var e;
|
|
2494
|
+
(o = p(s)) && n && (e = Xe.bind(null, null), o.then(e, e));
|
|
2495
|
+
}), o && typeof o.then == "function" ? U.resolve(o) : d.then(function() {
|
|
2496
|
+
return o;
|
|
2497
|
+
});
|
|
2498
|
+
}), l.push(function(t) {
|
|
2499
|
+
var n = e._cfg.dbschema, i = t;
|
|
2500
|
+
[].slice.call(i.db.objectStoreNames).forEach(function(e) {
|
|
2501
|
+
return n[e] == null && i.db.deleteObjectStore(e);
|
|
2502
|
+
}), an(r, [r.Transaction.prototype]), rn(r, [r.Transaction.prototype], r._storeNames, r._dbSchema), s.schema = r._dbSchema;
|
|
2503
|
+
}), l.push(function(t) {
|
|
2504
|
+
r.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(r.idbdb.version / 10) === e._cfg.version ? (r.idbdb.deleteObjectStore("$meta"), delete r._dbSchema.$meta, r._storeNames = r._storeNames.filter(function(e) {
|
|
2505
|
+
return e !== "$meta";
|
|
2506
|
+
})) : t.objectStore("$meta").put(e._cfg.version, "version"));
|
|
2507
|
+
});
|
|
2508
|
+
}), function e() {
|
|
2509
|
+
return l.length ? U.resolve(l.shift()(s.idbtrans)).then(e) : U.resolve();
|
|
2510
|
+
}().then(function() {
|
|
2511
|
+
dn(u, c);
|
|
2512
|
+
}));
|
|
2513
|
+
}).catch(s);
|
|
2514
|
+
var r, l;
|
|
2515
|
+
i(a).forEach(function(e) {
|
|
2516
|
+
un(n, e, a[e].primKey, a[e].indexes);
|
|
2517
|
+
}), nn(e, n), U.follow(function() {
|
|
2518
|
+
return e.on.populate.fire(o);
|
|
2519
|
+
}).catch(s);
|
|
2520
|
+
});
|
|
2521
|
+
}
|
|
2522
|
+
function cn(e, t) {
|
|
2523
|
+
dn(e._dbSchema, t), t.db.version % 10 != 0 || t.objectStoreNames.contains("$meta") || t.db.createObjectStore("$meta").add(Math.ceil(t.db.version / 10 - 1), "version");
|
|
2524
|
+
var n = pn(0, e.idbdb, t);
|
|
2525
|
+
mn(e, e._dbSchema, t);
|
|
2526
|
+
for (var r = 0, i = ln(n, e._dbSchema).change; r < i.length; r++) {
|
|
2527
|
+
var a = ((e) => {
|
|
2528
|
+
if (e.change.length || e.recreate) return console.warn(`Unable to patch indexes of table ${e.name} because it has changes on the type of index or primary key.`), { value: void 0 };
|
|
2529
|
+
var n = t.objectStore(e.name);
|
|
2530
|
+
e.add.forEach(function(t) {
|
|
2531
|
+
he && console.debug(`Dexie upgrade patch: Creating missing index ${e.name}.${t.src}`), fn(n, t);
|
|
2532
|
+
});
|
|
2533
|
+
})(i[r]);
|
|
2534
|
+
if (typeof a == "object") return a.value;
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
function ln(e, t) {
|
|
2538
|
+
var n, r = {
|
|
2539
|
+
del: [],
|
|
2540
|
+
add: [],
|
|
2541
|
+
change: []
|
|
2542
|
+
};
|
|
2543
|
+
for (n in e) t[n] || r.del.push(n);
|
|
2544
|
+
for (n in t) {
|
|
2545
|
+
var i = e[n], a = t[n];
|
|
2546
|
+
if (i) {
|
|
2547
|
+
var o = {
|
|
2548
|
+
name: n,
|
|
2549
|
+
def: a,
|
|
2550
|
+
recreate: !1,
|
|
2551
|
+
del: [],
|
|
2552
|
+
add: [],
|
|
2553
|
+
change: []
|
|
2554
|
+
};
|
|
2555
|
+
if ("" + (i.primKey.keyPath || "") != "" + (a.primKey.keyPath || "") || i.primKey.auto !== a.primKey.auto) o.recreate = !0, r.change.push(o);
|
|
2556
|
+
else {
|
|
2557
|
+
var s = i.idxByName, c = a.idxByName, l = void 0;
|
|
2558
|
+
for (l in s) c[l] || o.del.push(l);
|
|
2559
|
+
for (l in c) {
|
|
2560
|
+
var u = s[l], d = c[l];
|
|
2561
|
+
u ? u.src !== d.src && o.change.push(d) : o.add.push(d);
|
|
2562
|
+
}
|
|
2563
|
+
(0 < o.del.length || 0 < o.add.length || 0 < o.change.length) && r.change.push(o);
|
|
2564
|
+
}
|
|
2565
|
+
} else r.add.push([n, a]);
|
|
2566
|
+
}
|
|
2567
|
+
return r;
|
|
2568
|
+
}
|
|
2569
|
+
function un(e, t, n, r) {
|
|
2570
|
+
var i = e.db.createObjectStore(t, n.keyPath ? {
|
|
2571
|
+
keyPath: n.keyPath,
|
|
2572
|
+
autoIncrement: n.auto
|
|
2573
|
+
} : { autoIncrement: n.auto });
|
|
2574
|
+
r.forEach(function(e) {
|
|
2575
|
+
return fn(i, e);
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2578
|
+
function dn(e, t) {
|
|
2579
|
+
i(e).forEach(function(n) {
|
|
2580
|
+
t.db.objectStoreNames.contains(n) || (he && console.debug("Dexie: Creating missing table", n), un(t, n, e[n].primKey, e[n].indexes));
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
function fn(e, t) {
|
|
2584
|
+
e.createIndex(t.name, t.keyPath, {
|
|
2585
|
+
unique: t.unique,
|
|
2586
|
+
multiEntry: t.multi
|
|
2587
|
+
});
|
|
2588
|
+
}
|
|
2589
|
+
function pn(e, t, n) {
|
|
2590
|
+
var r = {};
|
|
2591
|
+
return g(t.objectStoreNames, 0).forEach(function(e) {
|
|
2592
|
+
for (var t = n.objectStore(e), i = Kt(qt(c = t.keyPath), c || "", !0, !1, !!t.autoIncrement, c && typeof c != "string", !0), a = [], o = 0; o < t.indexNames.length; ++o) {
|
|
2593
|
+
var s = t.index(t.indexNames[o]), c = s.keyPath, s = Kt(s.name, c, !!s.unique, !!s.multiEntry, !1, c && typeof c != "string", !1);
|
|
2594
|
+
a.push(s);
|
|
2595
|
+
}
|
|
2596
|
+
r[e] = Jt(e, i, a);
|
|
2597
|
+
}), r;
|
|
2598
|
+
}
|
|
2599
|
+
function mn(e, t, n) {
|
|
2600
|
+
for (var i = n.db.objectStoreNames, a = 0; a < i.length; ++a) {
|
|
2601
|
+
var o = i[a], s = n.objectStore(o);
|
|
2602
|
+
e._hasGetAll = "getAll" in s;
|
|
2603
|
+
for (var c = 0; c < s.indexNames.length; ++c) {
|
|
2604
|
+
var l, u = s.indexNames[c], d = s.index(u).keyPath, d = typeof d == "string" ? d : "[" + g(d).join("+") + "]";
|
|
2605
|
+
t[o] && (l = t[o].idxByName[d]) && (l.name = u, delete t[o].idxByName[d], t[o].idxByName[u] = l);
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && r.WorkerGlobalScope && r instanceof r.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
|
|
2609
|
+
}
|
|
2610
|
+
function hn(e) {
|
|
2611
|
+
return e.split(",").map(function(e, t) {
|
|
2612
|
+
var n = e.split(":"), r = (r = n[1])?.trim(), n = (e = n[0].trim()).replace(/([&*]|\+\+)/g, ""), i = /^\[/.test(n) ? n.match(/^\[(.*)\]$/)[1].split("+") : n;
|
|
2613
|
+
return Kt(n, i || null, /\&/.test(e), /\*/.test(e), /\+\+/.test(e), a(i), t === 0, r);
|
|
2614
|
+
});
|
|
2615
|
+
}
|
|
2616
|
+
_n.prototype._createTableSchema = Jt, _n.prototype._parseIndexSyntax = hn, _n.prototype._parseStoresSpec = function(e, t) {
|
|
2617
|
+
var n = this;
|
|
2618
|
+
i(e).forEach(function(r) {
|
|
2619
|
+
if (e[r] !== null) {
|
|
2620
|
+
var i = n._parseIndexSyntax(e[r]), a = i.shift();
|
|
2621
|
+
if (!a) throw new P.Schema("Invalid schema for table " + r + ": " + e[r]);
|
|
2622
|
+
if (a.unique = !0, a.multi) throw new P.Schema("Primary key cannot be multiEntry*");
|
|
2623
|
+
i.forEach(function(e) {
|
|
2624
|
+
if (e.auto) throw new P.Schema("Only primary key can be marked as autoIncrement (++)");
|
|
2625
|
+
if (!e.keyPath) throw new P.Schema("Index must have a name and cannot be an empty string");
|
|
2626
|
+
}), a = n._createTableSchema(r, a, i), t[r] = a;
|
|
2627
|
+
}
|
|
2628
|
+
});
|
|
2629
|
+
}, _n.prototype.stores = function(e) {
|
|
2630
|
+
var t = this.db, e = (this._cfg.storesSource = this._cfg.storesSource ? o(this._cfg.storesSource, e) : e, t._versions), n = {}, r = {};
|
|
2631
|
+
return e.forEach(function(e) {
|
|
2632
|
+
o(n, e._cfg.storesSource), r = e._cfg.dbschema = {}, e._parseStoresSpec(n, r);
|
|
2633
|
+
}), t._dbSchema = r, an(t, [
|
|
2634
|
+
t._allTables,
|
|
2635
|
+
t,
|
|
2636
|
+
t.Transaction.prototype
|
|
2637
|
+
]), rn(t, [
|
|
2638
|
+
t._allTables,
|
|
2639
|
+
t,
|
|
2640
|
+
t.Transaction.prototype,
|
|
2641
|
+
this._cfg.tables
|
|
2642
|
+
], i(r), r), t._storeNames = i(r), this;
|
|
2643
|
+
}, _n.prototype.upgrade = function(e) {
|
|
2644
|
+
return this._cfg.contentUpgrade = B(this._cfg.contentUpgrade || F, e), this;
|
|
2645
|
+
};
|
|
2646
|
+
var gn = _n;
|
|
2647
|
+
function _n() {}
|
|
2648
|
+
var vn = (() => {
|
|
2649
|
+
var e, t, n;
|
|
2650
|
+
return typeof FinalizationRegistry < "u" && typeof WeakRef < "u" ? (e = /* @__PURE__ */ new Set(), t = new FinalizationRegistry(function(t) {
|
|
2651
|
+
e.delete(t);
|
|
2652
|
+
}), {
|
|
2653
|
+
toArray: function() {
|
|
2654
|
+
return Array.from(e).map(function(e) {
|
|
2655
|
+
return e.deref();
|
|
2656
|
+
}).filter(function(e) {
|
|
2657
|
+
return e !== void 0;
|
|
2658
|
+
});
|
|
2659
|
+
},
|
|
2660
|
+
add: function(n) {
|
|
2661
|
+
var r = new WeakRef(n._novip);
|
|
2662
|
+
e.add(r), t.register(n._novip, r, r), e.size > n._options.maxConnections && (r = e.values().next().value, e.delete(r), t.unregister(r));
|
|
2663
|
+
},
|
|
2664
|
+
remove: function(n) {
|
|
2665
|
+
if (n) for (var r = e.values(), i = r.next(); !i.done;) {
|
|
2666
|
+
var a = i.value;
|
|
2667
|
+
if (a.deref() === n._novip) return e.delete(a), void t.unregister(a);
|
|
2668
|
+
i = r.next();
|
|
2669
|
+
}
|
|
2670
|
+
}
|
|
2671
|
+
}) : (n = [], {
|
|
2672
|
+
toArray: function() {
|
|
2673
|
+
return n;
|
|
2674
|
+
},
|
|
2675
|
+
add: function(e) {
|
|
2676
|
+
n.push(e._novip);
|
|
2677
|
+
},
|
|
2678
|
+
remove: function(e) {
|
|
2679
|
+
e && (e = n.indexOf(e._novip)) !== -1 && n.splice(e, 1);
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
})();
|
|
2683
|
+
function yn(e, t) {
|
|
2684
|
+
var n = e._dbNamesDB;
|
|
2685
|
+
return n || (n = e._dbNamesDB = new rr(st, {
|
|
2686
|
+
addons: [],
|
|
2687
|
+
indexedDB: e,
|
|
2688
|
+
IDBKeyRange: t
|
|
2689
|
+
})).version(1).stores({ dbnames: "name" }), n.table("dbnames");
|
|
2690
|
+
}
|
|
2691
|
+
function bn(e) {
|
|
2692
|
+
return e && typeof e.databases == "function";
|
|
2693
|
+
}
|
|
2694
|
+
function xn(e) {
|
|
2695
|
+
return Je(function() {
|
|
2696
|
+
return H.letThrough = !0, e();
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2699
|
+
function Sn(e) {
|
|
2700
|
+
return !("from" in e);
|
|
2701
|
+
}
|
|
2702
|
+
var Q = function(e, t) {
|
|
2703
|
+
var n;
|
|
2704
|
+
if (!this) return n = new Q(), e && "d" in e && o(n, e), n;
|
|
2705
|
+
o(this, arguments.length ? {
|
|
2706
|
+
d: 1,
|
|
2707
|
+
from: e,
|
|
2708
|
+
to: 1 < arguments.length ? t : e
|
|
2709
|
+
} : { d: 0 });
|
|
2710
|
+
};
|
|
2711
|
+
function Cn(e, t, n) {
|
|
2712
|
+
var r = q(t, n);
|
|
2713
|
+
if (!isNaN(r)) {
|
|
2714
|
+
if (0 < r) throw RangeError();
|
|
2715
|
+
if (Sn(e)) return o(e, {
|
|
2716
|
+
from: t,
|
|
2717
|
+
to: n,
|
|
2718
|
+
d: 1
|
|
2719
|
+
});
|
|
2720
|
+
var r = e.l, i = e.r;
|
|
2721
|
+
if (q(n, e.from) < 0) return r ? Cn(r, t, n) : e.l = {
|
|
2722
|
+
from: t,
|
|
2723
|
+
to: n,
|
|
2724
|
+
d: 1,
|
|
2725
|
+
l: null,
|
|
2726
|
+
r: null
|
|
2727
|
+
}, Dn(e);
|
|
2728
|
+
if (0 < q(t, e.to)) return i ? Cn(i, t, n) : e.r = {
|
|
2729
|
+
from: t,
|
|
2730
|
+
to: n,
|
|
2731
|
+
d: 1,
|
|
2732
|
+
l: null,
|
|
2733
|
+
r: null
|
|
2734
|
+
}, Dn(e);
|
|
2735
|
+
q(t, e.from) < 0 && (e.from = t, e.l = null, e.d = i ? i.d + 1 : 1), 0 < q(n, e.to) && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1), t = !e.r, r && !e.l && wn(e, r), i && t && wn(e, i);
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
function wn(e, t) {
|
|
2739
|
+
Sn(t) || function e(t, n) {
|
|
2740
|
+
var r = n.from, i = n.l, a = n.r;
|
|
2741
|
+
Cn(t, r, n.to), i && e(t, i), a && e(t, a);
|
|
2742
|
+
}(e, t);
|
|
2743
|
+
}
|
|
2744
|
+
function Tn(e, t) {
|
|
2745
|
+
var n = En(t), r = n.next();
|
|
2746
|
+
if (!r.done) for (var i = r.value, a = En(e), o = a.next(i.from), s = o.value; !r.done && !o.done;) {
|
|
2747
|
+
if (q(s.from, i.to) <= 0 && 0 <= q(s.to, i.from)) return !0;
|
|
2748
|
+
q(i.from, s.from) < 0 ? i = (r = n.next(s.from)).value : s = (o = a.next(i.from)).value;
|
|
2749
|
+
}
|
|
2750
|
+
return !1;
|
|
2751
|
+
}
|
|
2752
|
+
function En(e) {
|
|
2753
|
+
var t = Sn(e) ? null : {
|
|
2754
|
+
s: 0,
|
|
2755
|
+
n: e
|
|
2756
|
+
};
|
|
2757
|
+
return { next: function(e) {
|
|
2758
|
+
for (var n = 0 < arguments.length; t;) switch (t.s) {
|
|
2759
|
+
case 0: if (t.s = 1, n) for (; t.n.l && q(e, t.n.from) < 0;) t = {
|
|
2760
|
+
up: t,
|
|
2761
|
+
n: t.n.l,
|
|
2762
|
+
s: 1
|
|
2763
|
+
};
|
|
2764
|
+
else for (; t.n.l;) t = {
|
|
2765
|
+
up: t,
|
|
2766
|
+
n: t.n.l,
|
|
2767
|
+
s: 1
|
|
2768
|
+
};
|
|
2769
|
+
case 1: if (t.s = 2, !n || q(e, t.n.to) <= 0) return {
|
|
2770
|
+
value: t.n,
|
|
2771
|
+
done: !1
|
|
2772
|
+
};
|
|
2773
|
+
case 2: if (t.n.r) {
|
|
2774
|
+
t.s = 3, t = {
|
|
2775
|
+
up: t,
|
|
2776
|
+
n: t.n.r,
|
|
2777
|
+
s: 0
|
|
2778
|
+
};
|
|
2779
|
+
continue;
|
|
2780
|
+
}
|
|
2781
|
+
case 3: t = t.up;
|
|
2782
|
+
}
|
|
2783
|
+
return { done: !0 };
|
|
2784
|
+
} };
|
|
2785
|
+
}
|
|
2786
|
+
function Dn(e) {
|
|
2787
|
+
var n, r, i, a = ((a = e.r)?.d || 0) - ((a = e.l)?.d || 0), a = 1 < a ? "r" : a < -1 ? "l" : "";
|
|
2788
|
+
a && (n = a == "r" ? "l" : "r", r = t({}, e), i = e[a], e.from = i.from, e.to = i.to, e[a] = i[a], r[a] = i[n], (e[n] = r).d = On(r)), e.d = On(e);
|
|
2789
|
+
}
|
|
2790
|
+
function On(e) {
|
|
2791
|
+
var t = e.r, e = e.l;
|
|
2792
|
+
return (t ? e ? Math.max(t.d, e.d) : t.d : e ? e.d : 0) + 1;
|
|
2793
|
+
}
|
|
2794
|
+
function kn(e, t) {
|
|
2795
|
+
return i(t).forEach(function(n) {
|
|
2796
|
+
e[n] ? wn(e[n], t[n]) : e[n] = function e(t) {
|
|
2797
|
+
var n, r, i = {};
|
|
2798
|
+
for (n in t) l(t, n) && (r = t[n], i[n] = !r || typeof r != "object" || re.has(r.constructor) ? r : e(r));
|
|
2799
|
+
return i;
|
|
2800
|
+
}(t[n]);
|
|
2801
|
+
}), e;
|
|
2802
|
+
}
|
|
2803
|
+
function An(e, t) {
|
|
2804
|
+
return e.all || t.all || Object.keys(e).some(function(n) {
|
|
2805
|
+
return t[n] && Tn(t[n], e[n]);
|
|
2806
|
+
});
|
|
2807
|
+
}
|
|
2808
|
+
u(Q.prototype, ((j = {
|
|
2809
|
+
add: function(e) {
|
|
2810
|
+
return wn(this, e), this;
|
|
2811
|
+
},
|
|
2812
|
+
addKey: function(e) {
|
|
2813
|
+
return Cn(this, e, e), this;
|
|
2814
|
+
},
|
|
2815
|
+
addKeys: function(e) {
|
|
2816
|
+
var t = this;
|
|
2817
|
+
return e.forEach(function(e) {
|
|
2818
|
+
return Cn(t, e, e);
|
|
2819
|
+
}), this;
|
|
2820
|
+
},
|
|
2821
|
+
hasKey: function(e) {
|
|
2822
|
+
var t = En(this).next(e).value;
|
|
2823
|
+
return t && q(t.from, e) <= 0 && 0 <= q(t.to, e);
|
|
2824
|
+
}
|
|
2825
|
+
})[E] = function() {
|
|
2826
|
+
return En(this);
|
|
2827
|
+
}, j));
|
|
2828
|
+
var jn = {}, Mn = {}, Nn = !1;
|
|
2829
|
+
function Pn(e) {
|
|
2830
|
+
kn(Mn, e), Nn || (Nn = !0, setTimeout(function() {
|
|
2831
|
+
Nn = !1, Fn(Mn, !(Mn = {}));
|
|
2832
|
+
}, 0));
|
|
2833
|
+
}
|
|
2834
|
+
function Fn(e, t) {
|
|
2835
|
+
t === void 0 && (t = !1);
|
|
2836
|
+
var n = /* @__PURE__ */ new Set();
|
|
2837
|
+
if (e.all) for (var r = 0, i = Object.values(jn); r < i.length; r++) In(s = i[r], e, n, t);
|
|
2838
|
+
else for (var a in e) {
|
|
2839
|
+
var o, s, a = /^idb\:\/\/(.*)\/(.*)\//.exec(a);
|
|
2840
|
+
a && (o = a[1], a = a[2], s = jn[`idb://${o}/${a}`]) && In(s, e, n, t);
|
|
2841
|
+
}
|
|
2842
|
+
n.forEach(function(e) {
|
|
2843
|
+
return e();
|
|
2844
|
+
});
|
|
2845
|
+
}
|
|
2846
|
+
function In(e, t, n, r) {
|
|
2847
|
+
for (var i = [], a = 0, o = Object.entries(e.queries.query); a < o.length; a++) {
|
|
2848
|
+
for (var s = o[a], c = s[0], l = [], u = 0, d = s[1]; u < d.length; u++) {
|
|
2849
|
+
var f = d[u];
|
|
2850
|
+
An(t, f.obsSet) ? f.subscribers.forEach(function(e) {
|
|
2851
|
+
return n.add(e);
|
|
2852
|
+
}) : r && l.push(f);
|
|
2853
|
+
}
|
|
2854
|
+
r && i.push([c, l]);
|
|
2855
|
+
}
|
|
2856
|
+
if (r) for (var p = 0, m = i; p < m.length; p++) {
|
|
2857
|
+
var h = m[p], c = h[0], l = h[1];
|
|
2858
|
+
e.queries.query[c] = l;
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
function Ln(e) {
|
|
2862
|
+
var t = e._state, n = e._deps.indexedDB;
|
|
2863
|
+
if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then(function() {
|
|
2864
|
+
return t.dbOpenError ? K(t.dbOpenError) : e;
|
|
2865
|
+
});
|
|
2866
|
+
t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
|
|
2867
|
+
var r = t.openCanceller, a = Math.round(10 * e.verno), o = !1;
|
|
2868
|
+
function s() {
|
|
2869
|
+
if (t.openCanceller !== r) throw new P.DatabaseClosed("db.open() was cancelled");
|
|
2870
|
+
}
|
|
2871
|
+
function c() {
|
|
2872
|
+
return new U(function(r, l) {
|
|
2873
|
+
if (s(), !n) throw new P.MissingAPI();
|
|
2874
|
+
var u = e.name, p = t.autoSchema || !a ? n.open(u) : n.open(u, a);
|
|
2875
|
+
if (!p) throw new P.MissingAPI();
|
|
2876
|
+
p.onerror = Bt(l), p.onblocked = W(e._fireOnBlocked), p.onupgradeneeded = W(function(r) {
|
|
2877
|
+
var i;
|
|
2878
|
+
d = p.transaction, t.autoSchema && !e._options.allowEmptyDB ? (p.onerror = Vt, d.abort(), p.result.close(), (i = n.deleteDatabase(u)).onsuccess = i.onerror = W(function() {
|
|
2879
|
+
l(new P.NoSuchDatabase(`Database ${u} doesnt exist`));
|
|
2880
|
+
})) : (d.onerror = Bt(l), i = r.oldVersion > 2 ** 62 ? 0 : r.oldVersion, f = i < 1, e.idbdb = p.result, o && cn(e, d), sn(e, i / 10, d, l));
|
|
2881
|
+
}, l), p.onsuccess = W(function() {
|
|
2882
|
+
d = null;
|
|
2883
|
+
var n, s, l, m, h, _, v = e.idbdb = p.result, y = g(v.objectStoreNames);
|
|
2884
|
+
if (0 < y.length) try {
|
|
2885
|
+
var b = v.transaction((h = y).length === 1 ? h[0] : h, "readonly");
|
|
2886
|
+
if (t.autoSchema) _ = v, m = b, (l = e).verno = _.version / 10, m = l._dbSchema = pn(0, _, m), l._storeNames = g(_.objectStoreNames, 0), rn(l, [l._allTables], i(m), m);
|
|
2887
|
+
else if (mn(e, e._dbSchema, b), s = b, ((s = ln(pn(0, (n = e).idbdb, s), n._dbSchema)).add.length || s.change.some(function(e) {
|
|
2888
|
+
return e.add.length || e.change.length;
|
|
2889
|
+
})) && !o) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), v.close(), a = v.version + 1, o = !0, r(c());
|
|
2890
|
+
nn(e, b);
|
|
2891
|
+
} catch {}
|
|
2892
|
+
vn.add(e), v.onversionchange = W(function(n) {
|
|
2893
|
+
t.vcFired = !0, e.on("versionchange").fire(n);
|
|
2894
|
+
}), v.onclose = W(function() {
|
|
2895
|
+
e.close({ disableAutoOpen: !1 });
|
|
2896
|
+
}), f && (y = e._deps, h = u, bn(_ = y.indexedDB) || h === st || yn(_, y.IDBKeyRange).put({ name: h }).catch(F)), r();
|
|
2897
|
+
}, l);
|
|
2898
|
+
}).catch(function(e) {
|
|
2899
|
+
switch (e?.name) {
|
|
2900
|
+
case "UnknownError":
|
|
2901
|
+
if (0 < t.PR1398_maxLoop) return t.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"), c();
|
|
2902
|
+
break;
|
|
2903
|
+
case "VersionError": if (0 < a) return a = 0, c();
|
|
2904
|
+
}
|
|
2905
|
+
return U.reject(e);
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
var l, u = t.dbReadyResolve, d = null, f = !1;
|
|
2909
|
+
return U.race([r, (typeof navigator > "u" ? U.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(e) {
|
|
2910
|
+
function t() {
|
|
2911
|
+
return indexedDB.databases().finally(e);
|
|
2912
|
+
}
|
|
2913
|
+
l = setInterval(t, 100), t();
|
|
2914
|
+
}).finally(function() {
|
|
2915
|
+
return clearInterval(l);
|
|
2916
|
+
}) : Promise.resolve()).then(c)]).then(function() {
|
|
2917
|
+
return s(), t.onReadyBeingFired = [], U.resolve(xn(function() {
|
|
2918
|
+
return e.on.ready.fire(e.vip);
|
|
2919
|
+
})).then(function n() {
|
|
2920
|
+
var r;
|
|
2921
|
+
if (0 < t.onReadyBeingFired.length) return r = t.onReadyBeingFired.reduce(B, F), t.onReadyBeingFired = [], U.resolve(xn(function() {
|
|
2922
|
+
return r(e.vip);
|
|
2923
|
+
})).then(n);
|
|
2924
|
+
});
|
|
2925
|
+
}).finally(function() {
|
|
2926
|
+
t.openCanceller === r && (t.onReadyBeingFired = null, t.isBeingOpened = !1);
|
|
2927
|
+
}).catch(function(n) {
|
|
2928
|
+
t.dbOpenError = n;
|
|
2929
|
+
try {
|
|
2930
|
+
d && d.abort();
|
|
2931
|
+
} catch {}
|
|
2932
|
+
return r === t.openCanceller && e._close(), K(n);
|
|
2933
|
+
}).finally(function() {
|
|
2934
|
+
t.openComplete = !0, u();
|
|
2935
|
+
}).then(function() {
|
|
2936
|
+
var t;
|
|
2937
|
+
return f && (t = {}, e.tables.forEach(function(n) {
|
|
2938
|
+
n.schema.indexes.forEach(function(r) {
|
|
2939
|
+
r.name && (t[`idb://${e.name}/${n.name}/${r.name}`] = new Q(-Infinity, [[[]]]));
|
|
2940
|
+
}), t[`idb://${e.name}/${n.name}/`] = t[`idb://${e.name}/${n.name}/:dels`] = new Q(-Infinity, [[[]]]);
|
|
2941
|
+
}), Z(Ht).fire(t), Fn(t, !0)), e;
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
function Rn(e) {
|
|
2945
|
+
function t(t) {
|
|
2946
|
+
return e.next(t);
|
|
2947
|
+
}
|
|
2948
|
+
var n = i(t), r = i(function(t) {
|
|
2949
|
+
return e.throw(t);
|
|
2950
|
+
});
|
|
2951
|
+
function i(e) {
|
|
2952
|
+
return function(t) {
|
|
2953
|
+
var t = e(t), i = t.value;
|
|
2954
|
+
return t.done ? i : i && typeof i.then == "function" ? i.then(n, r) : a(i) ? Promise.all(i).then(n, r) : n(i);
|
|
2955
|
+
};
|
|
2956
|
+
}
|
|
2957
|
+
return i(t)();
|
|
2958
|
+
}
|
|
2959
|
+
function zn(e, t, n) {
|
|
2960
|
+
for (var r = a(e) ? e.slice() : [e], i = 0; i < n; ++i) r.push(t);
|
|
2961
|
+
return r;
|
|
2962
|
+
}
|
|
2963
|
+
var Bn = {
|
|
2964
|
+
stack: "dbcore",
|
|
2965
|
+
name: "VirtualIndexMiddleware",
|
|
2966
|
+
level: 1,
|
|
2967
|
+
create: function(e) {
|
|
2968
|
+
return t(t({}, e), { table: function(n) {
|
|
2969
|
+
var r = e.table(n), n = r.schema, i = {}, a = [];
|
|
2970
|
+
function o(e, n, r) {
|
|
2971
|
+
var s = $t(e), c = i[s] = i[s] || [], l = e == null ? 0 : typeof e == "string" ? 1 : e.length, u = 0 < n, s = t(t({}, r), {
|
|
2972
|
+
name: u ? `${s}(virtual-from:${r.name})` : r.name,
|
|
2973
|
+
lowLevelIndex: r,
|
|
2974
|
+
isVirtual: u,
|
|
2975
|
+
keyTail: n,
|
|
2976
|
+
keyLength: l,
|
|
2977
|
+
extractKey: Xt(e),
|
|
2978
|
+
unique: !u && r.unique
|
|
2979
|
+
});
|
|
2980
|
+
return c.push(s), s.isPrimaryKey || a.push(s), 1 < l && o(l === 2 ? e[0] : e.slice(0, l - 1), n + 1, r), c.sort(function(e, t) {
|
|
2981
|
+
return e.keyTail - t.keyTail;
|
|
2982
|
+
}), s;
|
|
2983
|
+
}
|
|
2984
|
+
var s = o(n.primaryKey.keyPath, 0, n.primaryKey);
|
|
2985
|
+
i[":id"] = [s];
|
|
2986
|
+
for (var c = 0, l = n.indexes; c < l.length; c++) {
|
|
2987
|
+
var u = l[c];
|
|
2988
|
+
o(u.keyPath, 0, u);
|
|
2989
|
+
}
|
|
2990
|
+
function d(n) {
|
|
2991
|
+
var r, i = n.query.index;
|
|
2992
|
+
return i.isVirtual ? t(t({}, n), { query: {
|
|
2993
|
+
index: i.lowLevelIndex,
|
|
2994
|
+
range: (r = n.query.range, i = i.keyTail, {
|
|
2995
|
+
type: r.type === 1 ? 2 : r.type,
|
|
2996
|
+
lower: zn(r.lower, r.lowerOpen ? e.MAX_KEY : e.MIN_KEY, i),
|
|
2997
|
+
lowerOpen: !0,
|
|
2998
|
+
upper: zn(r.upper, r.upperOpen ? e.MIN_KEY : e.MAX_KEY, i),
|
|
2999
|
+
upperOpen: !0
|
|
3000
|
+
})
|
|
3001
|
+
} }) : n;
|
|
3002
|
+
}
|
|
3003
|
+
return t(t({}, r), {
|
|
3004
|
+
schema: t(t({}, n), {
|
|
3005
|
+
primaryKey: s,
|
|
3006
|
+
indexes: a,
|
|
3007
|
+
getIndexByKeyPath: function(e) {
|
|
3008
|
+
return (e = i[$t(e)]) && e[0];
|
|
3009
|
+
}
|
|
3010
|
+
}),
|
|
3011
|
+
count: function(e) {
|
|
3012
|
+
return r.count(d(e));
|
|
3013
|
+
},
|
|
3014
|
+
query: function(e) {
|
|
3015
|
+
return r.query(d(e));
|
|
3016
|
+
},
|
|
3017
|
+
openCursor: function(t) {
|
|
3018
|
+
var n = t.query.index, i = n.keyTail, a = n.keyLength;
|
|
3019
|
+
return n.isVirtual ? r.openCursor(d(t)).then(function(e) {
|
|
3020
|
+
return e && o(e);
|
|
3021
|
+
}) : r.openCursor(t);
|
|
3022
|
+
function o(n) {
|
|
3023
|
+
return Object.create(n, {
|
|
3024
|
+
continue: { value: function(r) {
|
|
3025
|
+
r == null ? t.unique ? n.continue(n.key.slice(0, a).concat(t.reverse ? e.MIN_KEY : e.MAX_KEY, i)) : n.continue() : n.continue(zn(r, t.reverse ? e.MAX_KEY : e.MIN_KEY, i));
|
|
3026
|
+
} },
|
|
3027
|
+
continuePrimaryKey: { value: function(t, r) {
|
|
3028
|
+
n.continuePrimaryKey(zn(t, e.MAX_KEY, i), r);
|
|
3029
|
+
} },
|
|
3030
|
+
primaryKey: { get: function() {
|
|
3031
|
+
return n.primaryKey;
|
|
3032
|
+
} },
|
|
3033
|
+
key: { get: function() {
|
|
3034
|
+
var e = n.key;
|
|
3035
|
+
return a === 1 ? e[0] : e.slice(0, a);
|
|
3036
|
+
} },
|
|
3037
|
+
value: { get: function() {
|
|
3038
|
+
return n.value;
|
|
3039
|
+
} }
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
});
|
|
3044
|
+
} });
|
|
3045
|
+
}
|
|
3046
|
+
};
|
|
3047
|
+
function Vn(e, t, n, r) {
|
|
3048
|
+
return n ||= {}, r ||= "", i(e).forEach(function(i) {
|
|
3049
|
+
var a, o, s;
|
|
3050
|
+
l(t, i) ? (a = e[i], o = t[i], typeof a == "object" && typeof o == "object" && a && o ? (s = T(a)) === T(o) ? s === "Object" ? Vn(a, o, n, r + i + ".") : a !== o && (n[r + i] = t[i]) : n[r + i] = t[i] : a !== o && (n[r + i] = t[i])) : n[r + i] = void 0;
|
|
3051
|
+
}), i(t).forEach(function(i) {
|
|
3052
|
+
l(e, i) || (n[r + i] = t[i]);
|
|
3053
|
+
}), n;
|
|
3054
|
+
}
|
|
3055
|
+
function Hn(e, t) {
|
|
3056
|
+
return t.type === "delete" ? t.keys : t.keys || t.values.map(e.extractKey);
|
|
3057
|
+
}
|
|
3058
|
+
var Un = {
|
|
3059
|
+
stack: "dbcore",
|
|
3060
|
+
name: "HooksMiddleware",
|
|
3061
|
+
level: 2,
|
|
3062
|
+
create: function(e) {
|
|
3063
|
+
return t(t({}, e), { table: function(r) {
|
|
3064
|
+
var i = e.table(r), a = i.schema.primaryKey;
|
|
3065
|
+
return t(t({}, i), { mutate: function(e) {
|
|
3066
|
+
var o = H.trans, s = o.table(r).hook, c = s.deleting, u = s.creating, d = s.updating;
|
|
3067
|
+
switch (e.type) {
|
|
3068
|
+
case "add":
|
|
3069
|
+
if (u.fire === F) break;
|
|
3070
|
+
return o._promise("readwrite", function() {
|
|
3071
|
+
return f(e);
|
|
3072
|
+
}, !0);
|
|
3073
|
+
case "put":
|
|
3074
|
+
if (u.fire === F && d.fire === F) break;
|
|
3075
|
+
return o._promise("readwrite", function() {
|
|
3076
|
+
return f(e);
|
|
3077
|
+
}, !0);
|
|
3078
|
+
case "delete":
|
|
3079
|
+
if (c.fire === F) break;
|
|
3080
|
+
return o._promise("readwrite", function() {
|
|
3081
|
+
return f(e);
|
|
3082
|
+
}, !0);
|
|
3083
|
+
case "deleteRange":
|
|
3084
|
+
if (c.fire === F) break;
|
|
3085
|
+
return o._promise("readwrite", function() {
|
|
3086
|
+
return function e(n, r, o) {
|
|
3087
|
+
return i.query({
|
|
3088
|
+
trans: n,
|
|
3089
|
+
values: !1,
|
|
3090
|
+
query: {
|
|
3091
|
+
index: a,
|
|
3092
|
+
range: r
|
|
3093
|
+
},
|
|
3094
|
+
limit: o
|
|
3095
|
+
}).then(function(i) {
|
|
3096
|
+
var a = i.result;
|
|
3097
|
+
return f({
|
|
3098
|
+
type: "delete",
|
|
3099
|
+
keys: a,
|
|
3100
|
+
trans: n
|
|
3101
|
+
}).then(function(i) {
|
|
3102
|
+
return 0 < i.numFailures ? Promise.reject(i.failures[0]) : a.length < o ? {
|
|
3103
|
+
failures: [],
|
|
3104
|
+
numFailures: 0,
|
|
3105
|
+
lastResult: void 0
|
|
3106
|
+
} : e(n, t(t({}, r), {
|
|
3107
|
+
lower: a[a.length - 1],
|
|
3108
|
+
lowerOpen: !0
|
|
3109
|
+
}), o);
|
|
3110
|
+
});
|
|
3111
|
+
});
|
|
3112
|
+
}(e.trans, e.range, 1e4);
|
|
3113
|
+
}, !0);
|
|
3114
|
+
}
|
|
3115
|
+
return i.mutate(e);
|
|
3116
|
+
function f(e) {
|
|
3117
|
+
var r, o, s, f = H.trans, p = e.keys || Hn(a, e);
|
|
3118
|
+
if (p) return (e = e.type === "add" || e.type === "put" ? t(t({}, e), { keys: p }) : t({}, e)).type !== "delete" && (e.values = n([], e.values, !0)), e.keys &&= n([], e.keys, !0), r = i, s = p, ((o = e).type === "add" ? Promise.resolve([]) : r.getMany({
|
|
3119
|
+
trans: o.trans,
|
|
3120
|
+
keys: s,
|
|
3121
|
+
cache: "immutable"
|
|
3122
|
+
})).then(function(t) {
|
|
3123
|
+
var n = p.map(function(n, r) {
|
|
3124
|
+
var i, o, s, p = t[r], m = {
|
|
3125
|
+
onerror: null,
|
|
3126
|
+
onsuccess: null
|
|
3127
|
+
};
|
|
3128
|
+
return e.type === "delete" ? c.fire.call(m, n, p, f) : e.type === "add" || p === void 0 ? (i = u.fire.call(m, n, e.values[r], f), n == null && i != null && (e.keys[r] = n = i, a.outbound || x(e.values[r], a.keyPath, n))) : (i = Vn(p, e.values[r]), (o = d.fire.call(m, i, n, p, f)) && (s = e.values[r], Object.keys(o).forEach(function(e) {
|
|
3129
|
+
l(s, e) ? s[e] = o[e] : x(s, e, o[e]);
|
|
3130
|
+
}))), m;
|
|
3131
|
+
});
|
|
3132
|
+
return i.mutate(e).then(function(r) {
|
|
3133
|
+
for (var i = r.failures, a = r.results, o = r.numFailures, r = r.lastResult, s = 0; s < p.length; ++s) {
|
|
3134
|
+
var c = (a || p)[s], l = n[s];
|
|
3135
|
+
c == null ? l.onerror && l.onerror(i[s]) : l.onsuccess && l.onsuccess(e.type === "put" && t[s] ? e.values[s] : c);
|
|
3136
|
+
}
|
|
3137
|
+
return {
|
|
3138
|
+
failures: i,
|
|
3139
|
+
results: a,
|
|
3140
|
+
numFailures: o,
|
|
3141
|
+
lastResult: r
|
|
3142
|
+
};
|
|
3143
|
+
}).catch(function(e) {
|
|
3144
|
+
return n.forEach(function(t) {
|
|
3145
|
+
return t.onerror && t.onerror(e);
|
|
3146
|
+
}), Promise.reject(e);
|
|
3147
|
+
});
|
|
3148
|
+
});
|
|
3149
|
+
throw Error("Keys missing");
|
|
3150
|
+
}
|
|
3151
|
+
} });
|
|
3152
|
+
} });
|
|
3153
|
+
}
|
|
3154
|
+
};
|
|
3155
|
+
function Wn(e, t, n) {
|
|
3156
|
+
try {
|
|
3157
|
+
if (!t || t.keys.length < e.length) return null;
|
|
3158
|
+
for (var r = [], i = 0, a = 0; i < t.keys.length && a < e.length; ++i) q(t.keys[i], e[a]) === 0 && (r.push(n ? w(t.values[i]) : t.values[i]), ++a);
|
|
3159
|
+
return r.length === e.length ? r : null;
|
|
3160
|
+
} catch {
|
|
3161
|
+
return null;
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
var Gn = {
|
|
3165
|
+
stack: "dbcore",
|
|
3166
|
+
level: -1,
|
|
3167
|
+
create: function(e) {
|
|
3168
|
+
return { table: function(n) {
|
|
3169
|
+
var r = e.table(n);
|
|
3170
|
+
return t(t({}, r), {
|
|
3171
|
+
getMany: function(e) {
|
|
3172
|
+
var t;
|
|
3173
|
+
return e.cache ? (t = Wn(e.keys, e.trans._cache, e.cache === "clone")) ? U.resolve(t) : r.getMany(e).then(function(t) {
|
|
3174
|
+
return e.trans._cache = {
|
|
3175
|
+
keys: e.keys,
|
|
3176
|
+
values: e.cache === "clone" ? w(t) : t
|
|
3177
|
+
}, t;
|
|
3178
|
+
}) : r.getMany(e);
|
|
3179
|
+
},
|
|
3180
|
+
mutate: function(e) {
|
|
3181
|
+
return e.type !== "add" && (e.trans._cache = null), r.mutate(e);
|
|
3182
|
+
}
|
|
3183
|
+
});
|
|
3184
|
+
} };
|
|
3185
|
+
}
|
|
3186
|
+
};
|
|
3187
|
+
function Kn(e, t) {
|
|
3188
|
+
return e.trans.mode === "readonly" && !!e.subscr && !e.trans.explicit && e.trans.db._options.cache !== "disabled" && !t.schema.primaryKey.outbound;
|
|
3189
|
+
}
|
|
3190
|
+
function qn(e, t) {
|
|
3191
|
+
switch (e) {
|
|
3192
|
+
case "query": return t.values && !t.unique;
|
|
3193
|
+
case "get":
|
|
3194
|
+
case "getMany":
|
|
3195
|
+
case "count":
|
|
3196
|
+
case "openCursor": return !1;
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
3199
|
+
var Jn = {
|
|
3200
|
+
stack: "dbcore",
|
|
3201
|
+
level: 0,
|
|
3202
|
+
name: "Observability",
|
|
3203
|
+
create: function(e) {
|
|
3204
|
+
var n = e.schema.name, r = new Q(e.MIN_KEY, e.MAX_KEY);
|
|
3205
|
+
return t(t({}, e), {
|
|
3206
|
+
transaction: function(t, n, r) {
|
|
3207
|
+
if (H.subscr && n !== "readonly") throw new P.ReadOnly(`Readwrite transaction in liveQuery context. Querier source: ${H.querier}`);
|
|
3208
|
+
return e.transaction(t, n, r);
|
|
3209
|
+
},
|
|
3210
|
+
table: function(o) {
|
|
3211
|
+
function s(t) {
|
|
3212
|
+
var t = t.query;
|
|
3213
|
+
return [t.index, new Q((t = t.range).lower ?? e.MIN_KEY, t.upper ?? e.MAX_KEY)];
|
|
3214
|
+
}
|
|
3215
|
+
var c = e.table(o), l = c.schema, u = l.primaryKey, d = l.indexes, f = u.extractKey, p = u.outbound, m = u.autoIncrement && d.filter(function(e) {
|
|
3216
|
+
return e.compound && e.keyPath.includes(u.keyPath);
|
|
3217
|
+
}), h = t(t({}, c), { mutate: function(t) {
|
|
3218
|
+
function i(e) {
|
|
3219
|
+
return e = `idb://${n}/${o}/${e}`, h[e] || (h[e] = new Q());
|
|
3220
|
+
}
|
|
3221
|
+
var s, d, f, p = t.trans, h = t.mutatedParts ||= {}, g = i(""), _ = i(":dels"), v = t.type, y = t.type === "deleteRange" ? [t.range] : t.type === "delete" ? [t.keys] : t.values.length < 50 ? [Hn(u, t).filter(function(e) {
|
|
3222
|
+
return e;
|
|
3223
|
+
}), t.values] : [], b = y[0], y = y[1], x = t.trans._cache;
|
|
3224
|
+
return a(b) ? (g.addKeys(b), (v = v === "delete" || b.length === y.length ? Wn(b, x) : null) || _.addKeys(b), (v || y) && (s = i, d = v, f = y, l.indexes.forEach(function(e) {
|
|
3225
|
+
var t = s(e.name || "");
|
|
3226
|
+
function n(t) {
|
|
3227
|
+
return t == null ? null : e.extractKey(t);
|
|
3228
|
+
}
|
|
3229
|
+
function r(n) {
|
|
3230
|
+
e.multiEntry && a(n) ? n.forEach(function(e) {
|
|
3231
|
+
return t.addKey(e);
|
|
3232
|
+
}) : t.addKey(n);
|
|
3233
|
+
}
|
|
3234
|
+
(d || f).forEach(function(e, t) {
|
|
3235
|
+
var i = d && n(d[t]), t = f && n(f[t]);
|
|
3236
|
+
q(i, t) !== 0 && (i != null && r(i), t != null) && r(t);
|
|
3237
|
+
});
|
|
3238
|
+
}))) : b ? (y = {
|
|
3239
|
+
from: (x = b.lower) ?? e.MIN_KEY,
|
|
3240
|
+
to: (v = b.upper) ?? e.MAX_KEY
|
|
3241
|
+
}, _.add(y), g.add(y)) : (g.add(r), _.add(r), l.indexes.forEach(function(e) {
|
|
3242
|
+
return i(e.name).add(r);
|
|
3243
|
+
})), c.mutate(t).then(function(e) {
|
|
3244
|
+
return !b || t.type !== "add" && t.type !== "put" || (g.addKeys(e.results), m && m.forEach(function(n) {
|
|
3245
|
+
for (var r = t.values.map(function(e) {
|
|
3246
|
+
return n.extractKey(e);
|
|
3247
|
+
}), a = n.keyPath.findIndex(function(e) {
|
|
3248
|
+
return e === u.keyPath;
|
|
3249
|
+
}), o = 0, s = e.results.length; o < s; ++o) r[o][a] = e.results[o];
|
|
3250
|
+
i(n.name).addKeys(r);
|
|
3251
|
+
})), p.mutatedParts = kn(p.mutatedParts || {}, h), e;
|
|
3252
|
+
});
|
|
3253
|
+
} }), g = {
|
|
3254
|
+
get: function(e) {
|
|
3255
|
+
return [u, new Q(e.key)];
|
|
3256
|
+
},
|
|
3257
|
+
getMany: function(e) {
|
|
3258
|
+
return [u, new Q().addKeys(e.keys)];
|
|
3259
|
+
},
|
|
3260
|
+
count: s,
|
|
3261
|
+
query: s,
|
|
3262
|
+
openCursor: s
|
|
3263
|
+
};
|
|
3264
|
+
return i(g).forEach(function(e) {
|
|
3265
|
+
h[e] = function(i) {
|
|
3266
|
+
var a = H.subscr, s = !!a, l = Kn(H, c) && qn(e, i) ? i.obsSet = {} : a;
|
|
3267
|
+
if (s) {
|
|
3268
|
+
var u, a = function(e) {
|
|
3269
|
+
return e = `idb://${n}/${o}/${e}`, l[e] || (l[e] = new Q());
|
|
3270
|
+
}, d = a(""), m = a(":dels"), s = g[e](i), h = s[0], s = s[1];
|
|
3271
|
+
if ((e === "query" && h.isPrimaryKey && !i.values ? m : a(h.name || "")).add(s), !h.isPrimaryKey) {
|
|
3272
|
+
if (e !== "count") return u = e === "query" && p && i.values && c.query(t(t({}, i), { values: !1 })), c[e].apply(this, arguments).then(function(t) {
|
|
3273
|
+
if (e === "query") {
|
|
3274
|
+
if (p && i.values) return u.then(function(e) {
|
|
3275
|
+
return e = e.result, d.addKeys(e), t;
|
|
3276
|
+
});
|
|
3277
|
+
var n = i.values ? t.result.map(f) : t.result;
|
|
3278
|
+
(i.values ? d : m).addKeys(n);
|
|
3279
|
+
} else {
|
|
3280
|
+
var r, a;
|
|
3281
|
+
if (e === "openCursor") return a = i.values, (r = t) && Object.create(r, {
|
|
3282
|
+
key: { get: function() {
|
|
3283
|
+
return m.addKey(r.primaryKey), r.key;
|
|
3284
|
+
} },
|
|
3285
|
+
primaryKey: { get: function() {
|
|
3286
|
+
var e = r.primaryKey;
|
|
3287
|
+
return m.addKey(e), e;
|
|
3288
|
+
} },
|
|
3289
|
+
value: { get: function() {
|
|
3290
|
+
return a && d.addKey(r.primaryKey), r.value;
|
|
3291
|
+
} }
|
|
3292
|
+
});
|
|
3293
|
+
}
|
|
3294
|
+
return t;
|
|
3295
|
+
});
|
|
3296
|
+
m.add(r);
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
return c[e].apply(this, arguments);
|
|
3300
|
+
};
|
|
3301
|
+
}), h;
|
|
3302
|
+
}
|
|
3303
|
+
});
|
|
3304
|
+
}
|
|
3305
|
+
};
|
|
3306
|
+
function Yn(e, n, r) {
|
|
3307
|
+
var i;
|
|
3308
|
+
return r.numFailures === 0 ? n : n.type === "deleteRange" || (i = n.keys ? n.keys.length : "values" in n && n.values ? n.values.length : 1, r.numFailures === i) ? null : (i = t({}, n), a(i.keys) && (i.keys = i.keys.filter(function(e, t) {
|
|
3309
|
+
return !(t in r.failures);
|
|
3310
|
+
})), "values" in i && a(i.values) && (i.values = i.values.filter(function(e, t) {
|
|
3311
|
+
return !(t in r.failures);
|
|
3312
|
+
})), i);
|
|
3313
|
+
}
|
|
3314
|
+
function Xn(e, t) {
|
|
3315
|
+
return n = e, ((r = t).lower === void 0 || (r.lowerOpen ? 0 < q(n, r.lower) : 0 <= q(n, r.lower))) && (n = e, (r = t).upper === void 0 || (r.upperOpen ? q(n, r.upper) < 0 : q(n, r.upper) <= 0));
|
|
3316
|
+
var n, r;
|
|
3317
|
+
}
|
|
3318
|
+
function Zn(e, t, n, r, i, o) {
|
|
3319
|
+
var s, c, l, u, d, f, p;
|
|
3320
|
+
return !n || n.length === 0 || (s = t.query.index, c = s.multiEntry, l = t.query.range, u = r.schema.primaryKey.extractKey, d = s.extractKey, f = (s.lowLevelIndex || s).extractKey, (r = n.reduce(function(e, n) {
|
|
3321
|
+
var r = e, i = [];
|
|
3322
|
+
if (n.type === "add" || n.type === "put") for (var o = new Q(), s = n.values.length - 1; 0 <= s; --s) {
|
|
3323
|
+
var f, p = n.values[s], m = u(p);
|
|
3324
|
+
!o.hasKey(m) && (f = d(p), c && a(f) ? f.some(function(e) {
|
|
3325
|
+
return Xn(e, l);
|
|
3326
|
+
}) : Xn(f, l)) && (o.addKey(m), i.push(p));
|
|
3327
|
+
}
|
|
3328
|
+
switch (n.type) {
|
|
3329
|
+
case "add":
|
|
3330
|
+
var h = new Q().addKeys(t.values ? e.map(function(e) {
|
|
3331
|
+
return u(e);
|
|
3332
|
+
}) : e), r = e.concat(t.values ? i.filter(function(e) {
|
|
3333
|
+
return e = u(e), !h.hasKey(e) && (h.addKey(e), !0);
|
|
3334
|
+
}) : i.map(function(e) {
|
|
3335
|
+
return u(e);
|
|
3336
|
+
}).filter(function(e) {
|
|
3337
|
+
return !h.hasKey(e) && (h.addKey(e), !0);
|
|
3338
|
+
}));
|
|
3339
|
+
break;
|
|
3340
|
+
case "put":
|
|
3341
|
+
var g = new Q().addKeys(n.values.map(function(e) {
|
|
3342
|
+
return u(e);
|
|
3343
|
+
}));
|
|
3344
|
+
r = e.filter(function(e) {
|
|
3345
|
+
return !g.hasKey(t.values ? u(e) : e);
|
|
3346
|
+
}).concat(t.values ? i : i.map(function(e) {
|
|
3347
|
+
return u(e);
|
|
3348
|
+
}));
|
|
3349
|
+
break;
|
|
3350
|
+
case "delete":
|
|
3351
|
+
var _ = new Q().addKeys(n.keys);
|
|
3352
|
+
r = e.filter(function(e) {
|
|
3353
|
+
return !_.hasKey(t.values ? u(e) : e);
|
|
3354
|
+
});
|
|
3355
|
+
break;
|
|
3356
|
+
case "deleteRange":
|
|
3357
|
+
var v = n.range;
|
|
3358
|
+
r = e.filter(function(e) {
|
|
3359
|
+
return !Xn(u(e), v);
|
|
3360
|
+
});
|
|
3361
|
+
}
|
|
3362
|
+
return r;
|
|
3363
|
+
}, e)) === e) ? e : (p = function(e, t) {
|
|
3364
|
+
return q(f(e), f(t)) || q(u(e), u(t));
|
|
3365
|
+
}, r.sort(t.direction === "prev" || t.direction === "prevunique" ? function(e, t) {
|
|
3366
|
+
return p(t, e);
|
|
3367
|
+
} : p), t.limit && t.limit < Infinity && (r.length > t.limit ? r.length = t.limit : e.length === t.limit && r.length < t.limit && (i.dirty = !0)), o ? Object.freeze(r) : r);
|
|
3368
|
+
}
|
|
3369
|
+
function Qn(e, t) {
|
|
3370
|
+
return q(e.lower, t.lower) === 0 && q(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
|
|
3371
|
+
}
|
|
3372
|
+
function $n(e, t) {
|
|
3373
|
+
return ((e, t, n, r) => {
|
|
3374
|
+
if (e === void 0) return t === void 0 ? 0 : -1;
|
|
3375
|
+
if (t === void 0) return 1;
|
|
3376
|
+
if ((e = q(e, t)) === 0) {
|
|
3377
|
+
if (n && r) return 0;
|
|
3378
|
+
if (n) return 1;
|
|
3379
|
+
if (r) return -1;
|
|
3380
|
+
}
|
|
3381
|
+
return e;
|
|
3382
|
+
})(e.lower, t.lower, e.lowerOpen, t.lowerOpen) <= 0 && 0 <= ((e, t, n, r) => {
|
|
3383
|
+
if (e === void 0) return t === void 0 ? 0 : 1;
|
|
3384
|
+
if (t === void 0) return -1;
|
|
3385
|
+
if ((e = q(e, t)) === 0) {
|
|
3386
|
+
if (n && r) return 0;
|
|
3387
|
+
if (n) return -1;
|
|
3388
|
+
if (r) return 1;
|
|
3389
|
+
}
|
|
3390
|
+
return e;
|
|
3391
|
+
})(e.upper, t.upper, e.upperOpen, t.upperOpen);
|
|
3392
|
+
}
|
|
3393
|
+
function er(e, t, n, r) {
|
|
3394
|
+
e.subscribers.add(n), r.addEventListener("abort", function() {
|
|
3395
|
+
var r, i;
|
|
3396
|
+
e.subscribers.delete(n), e.subscribers.size === 0 && (r = e, i = t, setTimeout(function() {
|
|
3397
|
+
r.subscribers.size === 0 && O(i, r);
|
|
3398
|
+
}, 3e3));
|
|
3399
|
+
});
|
|
3400
|
+
}
|
|
3401
|
+
var tr = {
|
|
3402
|
+
stack: "dbcore",
|
|
3403
|
+
level: 0,
|
|
3404
|
+
name: "Cache",
|
|
3405
|
+
create: function(e) {
|
|
3406
|
+
var n = e.schema.name;
|
|
3407
|
+
return t(t({}, e), {
|
|
3408
|
+
transaction: function(t, r, i) {
|
|
3409
|
+
var a, o, s = e.transaction(t, r, i);
|
|
3410
|
+
return r === "readwrite" && (i = (a = new AbortController()).signal, s.addEventListener("abort", (o = function(i) {
|
|
3411
|
+
return function() {
|
|
3412
|
+
if (a.abort(), r === "readwrite") {
|
|
3413
|
+
for (var o = /* @__PURE__ */ new Set(), c = 0, l = t; c < l.length; c++) {
|
|
3414
|
+
var u = l[c], d = jn[`idb://${n}/${u}`];
|
|
3415
|
+
if (d) {
|
|
3416
|
+
var f = e.table(u), p = d.optimisticOps.filter(function(e) {
|
|
3417
|
+
return e.trans === s;
|
|
3418
|
+
});
|
|
3419
|
+
if (s._explicit && i && s.mutatedParts) for (var m = 0, h = Object.values(d.queries.query); m < h.length; m++) for (var g = 0, _ = (b = h[m]).slice(); g < _.length; g++) An((x = _[g]).obsSet, s.mutatedParts) && (O(b, x), x.subscribers.forEach(function(e) {
|
|
3420
|
+
return o.add(e);
|
|
3421
|
+
}));
|
|
3422
|
+
else if (0 < p.length) {
|
|
3423
|
+
d.optimisticOps = d.optimisticOps.filter(function(e) {
|
|
3424
|
+
return e.trans !== s;
|
|
3425
|
+
});
|
|
3426
|
+
for (var v = 0, y = Object.values(d.queries.query); v < y.length; v++) for (var b, x, ee, S = 0, te = (b = y[v]).slice(); S < te.length; S++) (x = te[S]).res != null && s.mutatedParts && (i && !x.dirty ? (ee = Object.isFrozen(x.res), ee = Zn(x.res, x.req, p, f, x, ee), x.dirty ? (O(b, x), x.subscribers.forEach(function(e) {
|
|
3427
|
+
return o.add(e);
|
|
3428
|
+
})) : ee !== x.res && (x.res = ee, x.promise = U.resolve({ result: ee }))) : (x.dirty && O(b, x), x.subscribers.forEach(function(e) {
|
|
3429
|
+
return o.add(e);
|
|
3430
|
+
})));
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
o.forEach(function(e) {
|
|
3435
|
+
return e();
|
|
3436
|
+
});
|
|
3437
|
+
}
|
|
3438
|
+
};
|
|
3439
|
+
})(!1), { signal: i }), s.addEventListener("error", o(!1), { signal: i }), s.addEventListener("complete", o(!0), { signal: i })), s;
|
|
3440
|
+
},
|
|
3441
|
+
table: function(r) {
|
|
3442
|
+
var i = e.table(r), a = i.schema.primaryKey;
|
|
3443
|
+
return t(t({}, i), {
|
|
3444
|
+
mutate: function(e) {
|
|
3445
|
+
var o, s = H.trans;
|
|
3446
|
+
return !a.outbound && s.db._options.cache !== "disabled" && !s.explicit && s.idbtrans.mode === "readwrite" && (o = jn[`idb://${n}/${r}`]) ? (s = i.mutate(e), e.type !== "add" && e.type !== "put" || !(50 <= e.values.length || Hn(a, e).some(function(e) {
|
|
3447
|
+
return e == null;
|
|
3448
|
+
})) ? (o.optimisticOps.push(e), e.mutatedParts && Pn(e.mutatedParts), s.then(function(t) {
|
|
3449
|
+
0 < t.numFailures && (O(o.optimisticOps, e), (t = Yn(0, e, t)) && o.optimisticOps.push(t), e.mutatedParts) && Pn(e.mutatedParts);
|
|
3450
|
+
}), s.catch(function() {
|
|
3451
|
+
O(o.optimisticOps, e), e.mutatedParts && Pn(e.mutatedParts);
|
|
3452
|
+
})) : s.then(function(n) {
|
|
3453
|
+
var r = Yn(0, t(t({}, e), { values: e.values.map(function(e, r) {
|
|
3454
|
+
var i;
|
|
3455
|
+
return n.failures[r] ? e : (x(i = (i = a.keyPath) != null && i.includes(".") ? w(e) : t({}, e), a.keyPath, n.results[r]), i);
|
|
3456
|
+
}) }), n);
|
|
3457
|
+
o.optimisticOps.push(r), queueMicrotask(function() {
|
|
3458
|
+
return e.mutatedParts && Pn(e.mutatedParts);
|
|
3459
|
+
});
|
|
3460
|
+
}), s) : i.mutate(e);
|
|
3461
|
+
},
|
|
3462
|
+
query: function(e) {
|
|
3463
|
+
var t, a, o, s, c, l, u;
|
|
3464
|
+
return Kn(H, i) && qn("query", e) ? (t = (o = H.trans)?.db._options.cache === "immutable", a = (o = H).requery, o = o.signal, l = ((e, t, n, r) => {
|
|
3465
|
+
var i = jn[`idb://${e}/${t}`];
|
|
3466
|
+
if (!i) return [];
|
|
3467
|
+
if (!(e = i.queries[n])) return [
|
|
3468
|
+
null,
|
|
3469
|
+
!1,
|
|
3470
|
+
i,
|
|
3471
|
+
null
|
|
3472
|
+
];
|
|
3473
|
+
var a = e[(r.query ? r.query.index.name : null) || ""];
|
|
3474
|
+
if (!a) return [
|
|
3475
|
+
null,
|
|
3476
|
+
!1,
|
|
3477
|
+
i,
|
|
3478
|
+
null
|
|
3479
|
+
];
|
|
3480
|
+
switch (n) {
|
|
3481
|
+
case "query":
|
|
3482
|
+
var o = (s = r.direction) ?? "next", s = a.find(function(e) {
|
|
3483
|
+
return e.req.limit === r.limit && e.req.values === r.values && (e.req.direction ?? "next") === o && Qn(e.req.query.range, r.query.range);
|
|
3484
|
+
});
|
|
3485
|
+
return s ? [
|
|
3486
|
+
s,
|
|
3487
|
+
!0,
|
|
3488
|
+
i,
|
|
3489
|
+
a
|
|
3490
|
+
] : [
|
|
3491
|
+
a.find(function(e) {
|
|
3492
|
+
return ("limit" in e.req ? e.req.limit : Infinity) >= r.limit && (e.req.direction ?? "next") === o && (!r.values || e.req.values) && $n(e.req.query.range, r.query.range);
|
|
3493
|
+
}),
|
|
3494
|
+
!1,
|
|
3495
|
+
i,
|
|
3496
|
+
a
|
|
3497
|
+
];
|
|
3498
|
+
case "count": return s = a.find(function(e) {
|
|
3499
|
+
return Qn(e.req.query.range, r.query.range);
|
|
3500
|
+
}), [
|
|
3501
|
+
s,
|
|
3502
|
+
!!s,
|
|
3503
|
+
i,
|
|
3504
|
+
a
|
|
3505
|
+
];
|
|
3506
|
+
}
|
|
3507
|
+
})(n, r, "query", e), u = l[0], s = l[2], c = l[3], u && l[1] ? u.obsSet = e.obsSet : (l = i.query(e).then(function(e) {
|
|
3508
|
+
var n = e.result;
|
|
3509
|
+
if (u && (u.res = n), t) {
|
|
3510
|
+
for (var r = 0, i = n.length; r < i; ++r) Object.freeze(n[r]);
|
|
3511
|
+
Object.freeze(n);
|
|
3512
|
+
}
|
|
3513
|
+
return e;
|
|
3514
|
+
}).catch(function(e) {
|
|
3515
|
+
return c && u && O(c, u), Promise.reject(e);
|
|
3516
|
+
}), u = {
|
|
3517
|
+
obsSet: e.obsSet,
|
|
3518
|
+
promise: l,
|
|
3519
|
+
subscribers: /* @__PURE__ */ new Set(),
|
|
3520
|
+
type: "query",
|
|
3521
|
+
req: e,
|
|
3522
|
+
dirty: !1
|
|
3523
|
+
}, c ? c.push(u) : (c = [u], (s ||= jn[`idb://${n}/${r}`] = {
|
|
3524
|
+
queries: {
|
|
3525
|
+
query: {},
|
|
3526
|
+
count: {}
|
|
3527
|
+
},
|
|
3528
|
+
objs: /* @__PURE__ */ new Map(),
|
|
3529
|
+
optimisticOps: [],
|
|
3530
|
+
unsignaledParts: {}
|
|
3531
|
+
}).queries.query[e.query.index.name || ""] = c)), er(u, c, a, o), u.promise.then(function(n) {
|
|
3532
|
+
return n = Zn(n.result, e, s?.optimisticOps, i, u, t), { result: t ? n : w(n) };
|
|
3533
|
+
})) : i.query(e);
|
|
3534
|
+
}
|
|
3535
|
+
});
|
|
3536
|
+
}
|
|
3537
|
+
});
|
|
3538
|
+
}
|
|
3539
|
+
};
|
|
3540
|
+
function nr(e, t) {
|
|
3541
|
+
return new Proxy(e, { get: function(e, n, r) {
|
|
3542
|
+
return n === "db" ? t : Reflect.get(e, n, r);
|
|
3543
|
+
} });
|
|
3544
|
+
}
|
|
3545
|
+
$.prototype.version = function(e) {
|
|
3546
|
+
if (isNaN(e) || e < .1) throw new P.Type("Given version is not a positive number");
|
|
3547
|
+
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new P.Schema("Cannot add version when database is open");
|
|
3548
|
+
this.verno = Math.max(this.verno, e);
|
|
3549
|
+
var t = this._versions, n = t.filter(function(t) {
|
|
3550
|
+
return t._cfg.version === e;
|
|
3551
|
+
})[0];
|
|
3552
|
+
return n || (n = new this.Version(e), t.push(n), t.sort(on), n.stores({}), this._state.autoSchema = !1), n;
|
|
3553
|
+
}, $.prototype._whenReady = function(e) {
|
|
3554
|
+
var t = this;
|
|
3555
|
+
return this.idbdb && (this._state.openComplete || H.letThrough || this._vip) ? e() : new U(function(e, n) {
|
|
3556
|
+
if (t._state.openComplete) return n(new P.DatabaseClosed(t._state.dbOpenError));
|
|
3557
|
+
if (!t._state.isBeingOpened) {
|
|
3558
|
+
if (!t._state.autoOpen) return void n(new P.DatabaseClosed());
|
|
3559
|
+
t.open().catch(F);
|
|
3560
|
+
}
|
|
3561
|
+
t._state.dbReadyPromise.then(e, n);
|
|
3562
|
+
}).then(e);
|
|
3563
|
+
}, $.prototype.use = function(e) {
|
|
3564
|
+
var t = e.stack, n = e.create, r = e.level, e = e.name, i = (e && this.unuse({
|
|
3565
|
+
stack: t,
|
|
3566
|
+
name: e
|
|
3567
|
+
}), this._middlewares[t] || (this._middlewares[t] = []));
|
|
3568
|
+
return i.push({
|
|
3569
|
+
stack: t,
|
|
3570
|
+
create: n,
|
|
3571
|
+
level: r ?? 10,
|
|
3572
|
+
name: e
|
|
3573
|
+
}), i.sort(function(e, t) {
|
|
3574
|
+
return e.level - t.level;
|
|
3575
|
+
}), this;
|
|
3576
|
+
}, $.prototype.unuse = function(e) {
|
|
3577
|
+
var t = e.stack, n = e.name, r = e.create;
|
|
3578
|
+
return t && this._middlewares[t] && (this._middlewares[t] = this._middlewares[t].filter(function(e) {
|
|
3579
|
+
return r ? e.create !== r : !!n && e.name !== n;
|
|
3580
|
+
})), this;
|
|
3581
|
+
}, $.prototype.open = function() {
|
|
3582
|
+
var e = this;
|
|
3583
|
+
return tt(Oe, function() {
|
|
3584
|
+
return Ln(e);
|
|
3585
|
+
});
|
|
3586
|
+
}, $.prototype._close = function() {
|
|
3587
|
+
this.on.close.fire(new CustomEvent("close"));
|
|
3588
|
+
var e = this._state;
|
|
3589
|
+
if (vn.remove(this), this.idbdb) {
|
|
3590
|
+
try {
|
|
3591
|
+
this.idbdb.close();
|
|
3592
|
+
} catch {}
|
|
3593
|
+
this.idbdb = null;
|
|
3594
|
+
}
|
|
3595
|
+
e.isBeingOpened || (e.dbReadyPromise = new U(function(t) {
|
|
3596
|
+
e.dbReadyResolve = t;
|
|
3597
|
+
}), e.openCanceller = new U(function(t, n) {
|
|
3598
|
+
e.cancelOpen = n;
|
|
3599
|
+
}));
|
|
3600
|
+
}, $.prototype.close = function(e) {
|
|
3601
|
+
var e = (e === void 0 ? { disableAutoOpen: !0 } : e).disableAutoOpen, t = this._state;
|
|
3602
|
+
e ? (t.isBeingOpened && t.cancelOpen(new P.DatabaseClosed()), this._close(), t.autoOpen = !1, t.dbOpenError = new P.DatabaseClosed()) : (this._close(), t.autoOpen = this._options.autoOpen || t.isBeingOpened, t.openComplete = !1, t.dbOpenError = null);
|
|
3603
|
+
}, $.prototype.delete = function(e) {
|
|
3604
|
+
var t = this, n = (e === void 0 && (e = { disableAutoOpen: !0 }), 0 < arguments.length && typeof arguments[0] != "object"), r = this._state;
|
|
3605
|
+
return new U(function(i, a) {
|
|
3606
|
+
function o() {
|
|
3607
|
+
t.close(e);
|
|
3608
|
+
var n = t._deps.indexedDB.deleteDatabase(t.name);
|
|
3609
|
+
n.onsuccess = W(function() {
|
|
3610
|
+
var e = t._deps, n = t.name, r;
|
|
3611
|
+
bn(r = e.indexedDB) || n === st || yn(r, e.IDBKeyRange).delete(n).catch(F), i();
|
|
3612
|
+
}), n.onerror = Bt(a), n.onblocked = t._fireOnBlocked;
|
|
3613
|
+
}
|
|
3614
|
+
if (n) throw new P.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
3615
|
+
r.isBeingOpened ? r.dbReadyPromise.then(o) : o();
|
|
3616
|
+
});
|
|
3617
|
+
}, $.prototype.backendDB = function() {
|
|
3618
|
+
return this.idbdb;
|
|
3619
|
+
}, $.prototype.isOpen = function() {
|
|
3620
|
+
return this.idbdb !== null;
|
|
3621
|
+
}, $.prototype.hasBeenClosed = function() {
|
|
3622
|
+
var e = this._state.dbOpenError;
|
|
3623
|
+
return e && e.name === "DatabaseClosed";
|
|
3624
|
+
}, $.prototype.hasFailed = function() {
|
|
3625
|
+
return this._state.dbOpenError !== null;
|
|
3626
|
+
}, $.prototype.dynamicallyOpened = function() {
|
|
3627
|
+
return this._state.autoSchema;
|
|
3628
|
+
}, Object.defineProperty($.prototype, "tables", {
|
|
3629
|
+
get: function() {
|
|
3630
|
+
var e = this;
|
|
3631
|
+
return i(this._allTables).map(function(t) {
|
|
3632
|
+
return e._allTables[t];
|
|
3633
|
+
});
|
|
3634
|
+
},
|
|
3635
|
+
enumerable: !1,
|
|
3636
|
+
configurable: !0
|
|
3637
|
+
}), $.prototype.transaction = function() {
|
|
3638
|
+
var e = function(e, t, n) {
|
|
3639
|
+
var r = arguments.length;
|
|
3640
|
+
if (r < 2) throw new P.InvalidArgument("Too few arguments");
|
|
3641
|
+
for (var i = Array(r - 1); --r;) i[r - 1] = arguments[r];
|
|
3642
|
+
return n = i.pop(), [
|
|
3643
|
+
e,
|
|
3644
|
+
te(i),
|
|
3645
|
+
n
|
|
3646
|
+
];
|
|
3647
|
+
}.apply(this, arguments);
|
|
3648
|
+
return this._transaction.apply(this, e);
|
|
3649
|
+
}, $.prototype._transaction = function(e, t, n) {
|
|
3650
|
+
var r, i, a = this, o = H.trans, s = (o && o.db === this && e.indexOf("!") === -1 || (o = null), e.indexOf("?") !== -1);
|
|
3651
|
+
e = e.replace("!", "").replace("?", "");
|
|
3652
|
+
try {
|
|
3653
|
+
if (i = t.map(function(e) {
|
|
3654
|
+
if (e = e instanceof a.Table ? e.name : e, typeof e != "string") throw TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
3655
|
+
return e;
|
|
3656
|
+
}), e == "r" || e === ct) r = ct;
|
|
3657
|
+
else {
|
|
3658
|
+
if (e != "rw" && e != lt) throw new P.InvalidArgument("Invalid transaction mode: " + e);
|
|
3659
|
+
r = lt;
|
|
3660
|
+
}
|
|
3661
|
+
if (o) {
|
|
3662
|
+
if (o.mode === ct && r === lt) {
|
|
3663
|
+
if (!s) throw new P.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
3664
|
+
o = null;
|
|
3665
|
+
}
|
|
3666
|
+
o && i.forEach(function(e) {
|
|
3667
|
+
if (o && o.storeNames.indexOf(e) === -1) {
|
|
3668
|
+
if (!s) throw new P.SubTransaction("Table " + e + " not included in parent transaction.");
|
|
3669
|
+
o = null;
|
|
3670
|
+
}
|
|
3671
|
+
}), s && o && !o.active && (o = null);
|
|
3672
|
+
}
|
|
3673
|
+
} catch (e) {
|
|
3674
|
+
return o ? o._promise(null, function(t, n) {
|
|
3675
|
+
n(e);
|
|
3676
|
+
}) : K(e);
|
|
3677
|
+
}
|
|
3678
|
+
var c = function e(t, n, r, i, a) {
|
|
3679
|
+
return U.resolve().then(function() {
|
|
3680
|
+
var o = H.transless || H, s = t._createTransaction(n, r, t._dbSchema, i), o = (s.explicit = !0, {
|
|
3681
|
+
trans: s,
|
|
3682
|
+
transless: o
|
|
3683
|
+
});
|
|
3684
|
+
if (i) s.idbtrans = i.idbtrans;
|
|
3685
|
+
else try {
|
|
3686
|
+
s.create(), s.idbtrans._explicit = !0, t._state.PR1398_maxLoop = 3;
|
|
3687
|
+
} catch (i) {
|
|
3688
|
+
return i.name === le.InvalidState && t.isOpen() && 0 < --t._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), t.close({ disableAutoOpen: !1 }), t.open().then(function() {
|
|
3689
|
+
return e(t, n, r, null, a);
|
|
3690
|
+
})) : K(i);
|
|
3691
|
+
}
|
|
3692
|
+
var c, l = ae(a), o = (l && Ye(), U.follow(function() {
|
|
3693
|
+
var e;
|
|
3694
|
+
(c = a.call(s, s)) && (l ? (e = Xe.bind(null, null), c.then(e, e)) : typeof c.next == "function" && typeof c.throw == "function" && (c = Rn(c)));
|
|
3695
|
+
}, o));
|
|
3696
|
+
return (c && typeof c.then == "function" ? U.resolve(c).then(function(e) {
|
|
3697
|
+
return s.active ? e : K(new P.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
3698
|
+
}) : o.then(function() {
|
|
3699
|
+
return c;
|
|
3700
|
+
})).then(function(e) {
|
|
3701
|
+
return i && s._resolve(), s._completion.then(function() {
|
|
3702
|
+
return e;
|
|
3703
|
+
});
|
|
3704
|
+
}).catch(function(e) {
|
|
3705
|
+
return s._reject(e), K(e);
|
|
3706
|
+
});
|
|
3707
|
+
});
|
|
3708
|
+
}.bind(null, this, r, i, o, n);
|
|
3709
|
+
return o ? o._promise(r, c, "lock") : H.trans ? tt(H.transless, function() {
|
|
3710
|
+
return a._whenReady(c);
|
|
3711
|
+
}) : this._whenReady(c);
|
|
3712
|
+
}, $.prototype.table = function(e) {
|
|
3713
|
+
if (l(this._allTables, e)) return this._allTables[e];
|
|
3714
|
+
throw new P.InvalidTable(`Table ${e} does not exist`);
|
|
3715
|
+
};
|
|
3716
|
+
var rr = $;
|
|
3717
|
+
function $(e, n) {
|
|
3718
|
+
var r, i, a, o, s, c = this, l = (this._middlewares = {}, this.verno = 0, $.dependencies), l = (this._options = n = t({
|
|
3719
|
+
addons: $.addons,
|
|
3720
|
+
autoOpen: !0,
|
|
3721
|
+
indexedDB: l.indexedDB,
|
|
3722
|
+
IDBKeyRange: l.IDBKeyRange,
|
|
3723
|
+
cache: "cloned",
|
|
3724
|
+
maxConnections: 1e3
|
|
3725
|
+
}, n), this._deps = {
|
|
3726
|
+
indexedDB: n.indexedDB,
|
|
3727
|
+
IDBKeyRange: n.IDBKeyRange
|
|
3728
|
+
}, n.addons), u = (this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this, {
|
|
3729
|
+
dbOpenError: null,
|
|
3730
|
+
isBeingOpened: !1,
|
|
3731
|
+
onReadyBeingFired: null,
|
|
3732
|
+
openComplete: !1,
|
|
3733
|
+
dbReadyResolve: F,
|
|
3734
|
+
dbReadyPromise: null,
|
|
3735
|
+
cancelOpen: F,
|
|
3736
|
+
openCanceller: null,
|
|
3737
|
+
autoSchema: !0,
|
|
3738
|
+
PR1398_maxLoop: 3,
|
|
3739
|
+
autoOpen: n.autoOpen
|
|
3740
|
+
}), d = (u.dbReadyPromise = new U(function(e) {
|
|
3741
|
+
u.dbReadyResolve = e;
|
|
3742
|
+
}), u.openCanceller = new U(function(e, t) {
|
|
3743
|
+
u.cancelOpen = t;
|
|
3744
|
+
}), this._state = u, this.name = e, this.on = xt(this, "populate", "blocked", "versionchange", "close", { ready: [B, F] }), this.once = function(e, t) {
|
|
3745
|
+
var n = function() {
|
|
3746
|
+
var r = [...arguments];
|
|
3747
|
+
c.on(e).unsubscribe(n), t.apply(c, r);
|
|
3748
|
+
};
|
|
3749
|
+
return c.on(e, n);
|
|
3750
|
+
}, this.on.ready.subscribe = _(this.on.ready.subscribe, function(e) {
|
|
3751
|
+
return function(t, n) {
|
|
3752
|
+
$.vip(function() {
|
|
3753
|
+
var r, i = c._state;
|
|
3754
|
+
i.openComplete ? (i.dbOpenError || U.resolve().then(t), n && e(t)) : i.onReadyBeingFired ? (i.onReadyBeingFired.push(t), n && e(t)) : (e(t), r = c, n || e(function e() {
|
|
3755
|
+
r.on.ready.unsubscribe(t), r.on.ready.unsubscribe(e);
|
|
3756
|
+
}));
|
|
3757
|
+
});
|
|
3758
|
+
};
|
|
3759
|
+
}), this.Collection = (r = this, St(At.prototype, function(e, t) {
|
|
3760
|
+
this.db = r;
|
|
3761
|
+
var n = dt, i = null;
|
|
3762
|
+
if (t) try {
|
|
3763
|
+
n = t();
|
|
3764
|
+
} catch (e) {
|
|
3765
|
+
i = e;
|
|
3766
|
+
}
|
|
3767
|
+
var t = e._ctx, e = t.table, a = e.hook.reading.fire;
|
|
3768
|
+
this._ctx = {
|
|
3769
|
+
table: e,
|
|
3770
|
+
index: t.index,
|
|
3771
|
+
isPrimKey: !t.index || e.schema.primKey.keyPath && t.index === e.schema.primKey.name,
|
|
3772
|
+
range: n,
|
|
3773
|
+
keysOnly: !1,
|
|
3774
|
+
dir: "next",
|
|
3775
|
+
unique: "",
|
|
3776
|
+
algorithm: null,
|
|
3777
|
+
filter: null,
|
|
3778
|
+
replayFilter: null,
|
|
3779
|
+
justLimit: !0,
|
|
3780
|
+
isMatch: null,
|
|
3781
|
+
offset: 0,
|
|
3782
|
+
limit: Infinity,
|
|
3783
|
+
error: i,
|
|
3784
|
+
or: t.or,
|
|
3785
|
+
valueMapper: a === I ? null : a
|
|
3786
|
+
};
|
|
3787
|
+
})), this.Table = (i = this, St(bt.prototype, function(e, t, n) {
|
|
3788
|
+
this.db = i, this._tx = n, this.name = e, this.schema = t, this.hook = i._allTables[e] ? i._allTables[e].hook : xt(null, {
|
|
3789
|
+
creating: [fe, F],
|
|
3790
|
+
reading: [L, I],
|
|
3791
|
+
updating: [me, F],
|
|
3792
|
+
deleting: [pe, F]
|
|
3793
|
+
});
|
|
3794
|
+
})), this.Transaction = (a = this, St(Wt.prototype, function(e, t, n, r, i) {
|
|
3795
|
+
var o = this;
|
|
3796
|
+
e !== "readonly" && t.forEach(function(e) {
|
|
3797
|
+
e = (e = n[e])?.yProps, e && (t = t.concat(e.map(function(e) {
|
|
3798
|
+
return e.updatesTable;
|
|
3799
|
+
})));
|
|
3800
|
+
}), this.db = a, this.mode = e, this.storeNames = t, this.schema = n, this.chromeTransactionDurability = r, this.idbtrans = null, this.on = xt(this, "complete", "error", "abort"), this.parent = i || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new U(function(e, t) {
|
|
3801
|
+
o._resolve = e, o._reject = t;
|
|
3802
|
+
}), this._completion.then(function() {
|
|
3803
|
+
o.active = !1, o.on.complete.fire();
|
|
3804
|
+
}, function(e) {
|
|
3805
|
+
var t = o.active;
|
|
3806
|
+
return o.active = !1, o.on.error.fire(e), o.parent ? o.parent._reject(e) : t && o.idbtrans && o.idbtrans.abort(), K(e);
|
|
3807
|
+
});
|
|
3808
|
+
})), this.Version = (o = this, St(gn.prototype, function(e) {
|
|
3809
|
+
this.db = o, this._cfg = {
|
|
3810
|
+
version: e,
|
|
3811
|
+
storesSource: null,
|
|
3812
|
+
dbschema: {},
|
|
3813
|
+
tables: {},
|
|
3814
|
+
contentUpgrade: null
|
|
3815
|
+
};
|
|
3816
|
+
})), this.WhereClause = (s = this, St(zt.prototype, function(e, t, n) {
|
|
3817
|
+
if (this.db = s, this._ctx = {
|
|
3818
|
+
table: e,
|
|
3819
|
+
index: t === ":id" ? null : t,
|
|
3820
|
+
or: n
|
|
3821
|
+
}, this._cmp = this._ascending = q, this._descending = function(e, t) {
|
|
3822
|
+
return q(t, e);
|
|
3823
|
+
}, this._max = function(e, t) {
|
|
3824
|
+
return 0 < q(e, t) ? e : t;
|
|
3825
|
+
}, this._min = function(e, t) {
|
|
3826
|
+
return q(e, t) < 0 ? e : t;
|
|
3827
|
+
}, this._IDBKeyRange = s._deps.IDBKeyRange, !this._IDBKeyRange) throw new P.MissingAPI();
|
|
3828
|
+
})), this.on("versionchange", function(e) {
|
|
3829
|
+
0 < e.newVersion ? console.warn(`Another connection wants to upgrade database '${c.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${c.name}'. Closing db now to resume the delete request.`), c.close({ disableAutoOpen: !1 });
|
|
3830
|
+
}), this.on("blocked", function(e) {
|
|
3831
|
+
!e.newVersion || e.newVersion < e.oldVersion ? console.warn(`Dexie.delete('${c.name}') was blocked`) : console.warn(`Upgrade '${c.name}' blocked by other connection holding version ${e.oldVersion / 10}`);
|
|
3832
|
+
}), this._maxKey = Yt(n.IDBKeyRange), this._createTransaction = function(e, t, n, r) {
|
|
3833
|
+
return new c.Transaction(e, t, n, c._options.chromeTransactionDurability, r);
|
|
3834
|
+
}, this._fireOnBlocked = function(e) {
|
|
3835
|
+
c.on("blocked").fire(e), vn.toArray().filter(function(e) {
|
|
3836
|
+
return e.name === c.name && e !== c && !e._state.vcFired;
|
|
3837
|
+
}).map(function(t) {
|
|
3838
|
+
return t.on("versionchange").fire(e);
|
|
3839
|
+
});
|
|
3840
|
+
}, this.use(Gn), this.use(tr), this.use(Jn), this.use(Bn), this.use(Un), new Proxy(this, { get: function(e, t, n) {
|
|
3841
|
+
var r;
|
|
3842
|
+
return t === "_vip" || (t === "table" ? function(e) {
|
|
3843
|
+
return nr(c.table(e), d);
|
|
3844
|
+
} : (r = Reflect.get(e, t, n)) instanceof bt ? nr(r, d) : t === "tables" ? r.map(function(e) {
|
|
3845
|
+
return nr(e, d);
|
|
3846
|
+
}) : t === "_createTransaction" ? function() {
|
|
3847
|
+
return nr(r.apply(this, arguments), d);
|
|
3848
|
+
} : r);
|
|
3849
|
+
} }));
|
|
3850
|
+
this.vip = d, l.forEach(function(e) {
|
|
3851
|
+
return e(c);
|
|
3852
|
+
});
|
|
3853
|
+
}
|
|
3854
|
+
var ir, ye = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", ar = (or.prototype.subscribe = function(e, t, n) {
|
|
3855
|
+
return this._subscribe(e && typeof e != "function" ? e : {
|
|
3856
|
+
next: e,
|
|
3857
|
+
error: t,
|
|
3858
|
+
complete: n
|
|
3859
|
+
});
|
|
3860
|
+
}, or.prototype[ye] = function() {
|
|
3861
|
+
return this;
|
|
3862
|
+
}, or);
|
|
3863
|
+
function or(e) {
|
|
3864
|
+
this._subscribe = e;
|
|
3865
|
+
}
|
|
3866
|
+
try {
|
|
3867
|
+
ir = {
|
|
3868
|
+
indexedDB: r.indexedDB || r.mozIndexedDB || r.webkitIndexedDB || r.msIndexedDB,
|
|
3869
|
+
IDBKeyRange: r.IDBKeyRange || r.webkitIDBKeyRange
|
|
3870
|
+
};
|
|
3871
|
+
} catch {
|
|
3872
|
+
ir = {
|
|
3873
|
+
indexedDB: null,
|
|
3874
|
+
IDBKeyRange: null
|
|
3875
|
+
};
|
|
3876
|
+
}
|
|
3877
|
+
function sr(e) {
|
|
3878
|
+
var t, n = !1, r = new ar(function(r) {
|
|
3879
|
+
var i = ae(e), a, o = !1, s = {}, c = {}, l = {
|
|
3880
|
+
get closed() {
|
|
3881
|
+
return o;
|
|
3882
|
+
},
|
|
3883
|
+
unsubscribe: function() {
|
|
3884
|
+
o || (o = !0, a && a.abort(), u && Z.storagemutated.unsubscribe(p));
|
|
3885
|
+
}
|
|
3886
|
+
}, u = (r.start && r.start(l), !1), d = function() {
|
|
3887
|
+
return rt(m);
|
|
3888
|
+
};
|
|
3889
|
+
function f() {
|
|
3890
|
+
return An(c, s);
|
|
3891
|
+
}
|
|
3892
|
+
var p = function(e) {
|
|
3893
|
+
kn(s, e), f() && d();
|
|
3894
|
+
}, m = function() {
|
|
3895
|
+
var l, m, h;
|
|
3896
|
+
!o && ir.indexedDB && (s = {}, l = {}, a && a.abort(), a = new AbortController(), h = ((t) => {
|
|
3897
|
+
var n = ze();
|
|
3898
|
+
try {
|
|
3899
|
+
i && Ye();
|
|
3900
|
+
var r = Je(e, t);
|
|
3901
|
+
return r = i ? r.finally(Xe) : r;
|
|
3902
|
+
} finally {
|
|
3903
|
+
n && Be();
|
|
3904
|
+
}
|
|
3905
|
+
})(m = {
|
|
3906
|
+
subscr: l,
|
|
3907
|
+
signal: a.signal,
|
|
3908
|
+
requery: d,
|
|
3909
|
+
querier: e,
|
|
3910
|
+
trans: null
|
|
3911
|
+
}), u ||= (Z.storagemutated.subscribe(p), !0), Promise.resolve(h).then(function(e) {
|
|
3912
|
+
n = !0, t = e, o || m.signal.aborted || (f() || (c = l, f()) ? d() : (s = {}, rt(function() {
|
|
3913
|
+
return !o && r.next && r.next(e);
|
|
3914
|
+
})));
|
|
3915
|
+
}, function(e) {
|
|
3916
|
+
n = !1, ["DatabaseClosedError", "AbortError"].includes(e?.name) || o || rt(function() {
|
|
3917
|
+
o || r.error && r.error(e);
|
|
3918
|
+
});
|
|
3919
|
+
}));
|
|
3920
|
+
};
|
|
3921
|
+
return setTimeout(d, 0), l;
|
|
3922
|
+
});
|
|
3923
|
+
return r.hasValue = function() {
|
|
3924
|
+
return n;
|
|
3925
|
+
}, r.getValue = function() {
|
|
3926
|
+
return t;
|
|
3927
|
+
}, r;
|
|
3928
|
+
}
|
|
3929
|
+
var cr = rr;
|
|
3930
|
+
function lr(e) {
|
|
3931
|
+
var t = dr;
|
|
3932
|
+
try {
|
|
3933
|
+
dr = !0, Z.storagemutated.fire(e), Fn(e, !0);
|
|
3934
|
+
} finally {
|
|
3935
|
+
dr = t;
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
u(cr, t(t({}, ne), {
|
|
3939
|
+
delete: function(e) {
|
|
3940
|
+
return new cr(e, { addons: [] }).delete();
|
|
3941
|
+
},
|
|
3942
|
+
exists: function(e) {
|
|
3943
|
+
return new cr(e, { addons: [] }).open().then(function(e) {
|
|
3944
|
+
return e.close(), !0;
|
|
3945
|
+
}).catch("NoSuchDatabaseError", function() {
|
|
3946
|
+
return !1;
|
|
3947
|
+
});
|
|
3948
|
+
},
|
|
3949
|
+
getDatabaseNames: function(e) {
|
|
3950
|
+
try {
|
|
3951
|
+
return t = cr.dependencies, n = t.indexedDB, t = t.IDBKeyRange, (bn(n) ? Promise.resolve(n.databases()).then(function(e) {
|
|
3952
|
+
return e.map(function(e) {
|
|
3953
|
+
return e.name;
|
|
3954
|
+
}).filter(function(e) {
|
|
3955
|
+
return e !== st;
|
|
3956
|
+
});
|
|
3957
|
+
}) : yn(n, t).toCollection().primaryKeys()).then(e);
|
|
3958
|
+
} catch {
|
|
3959
|
+
return K(new P.MissingAPI());
|
|
3960
|
+
}
|
|
3961
|
+
var t, n;
|
|
3962
|
+
},
|
|
3963
|
+
defineClass: function() {
|
|
3964
|
+
return function(e) {
|
|
3965
|
+
o(this, e);
|
|
3966
|
+
};
|
|
3967
|
+
},
|
|
3968
|
+
ignoreTransaction: function(e) {
|
|
3969
|
+
return H.trans ? tt(H.transless || Oe, e) : e();
|
|
3970
|
+
},
|
|
3971
|
+
vip: xn,
|
|
3972
|
+
async: function(e) {
|
|
3973
|
+
return function() {
|
|
3974
|
+
try {
|
|
3975
|
+
var t = Rn(e.apply(this, arguments));
|
|
3976
|
+
return t && typeof t.then == "function" ? t : U.resolve(t);
|
|
3977
|
+
} catch (e) {
|
|
3978
|
+
return K(e);
|
|
3979
|
+
}
|
|
3980
|
+
};
|
|
3981
|
+
},
|
|
3982
|
+
spawn: function(e, t, n) {
|
|
3983
|
+
try {
|
|
3984
|
+
var r = Rn(e.apply(n, t || []));
|
|
3985
|
+
return r && typeof r.then == "function" ? r : U.resolve(r);
|
|
3986
|
+
} catch (e) {
|
|
3987
|
+
return K(e);
|
|
3988
|
+
}
|
|
3989
|
+
},
|
|
3990
|
+
currentTransaction: { get: function() {
|
|
3991
|
+
return H.trans || null;
|
|
3992
|
+
} },
|
|
3993
|
+
waitFor: function(e, t) {
|
|
3994
|
+
return e = U.resolve(typeof e == "function" ? cr.ignoreTransaction(e) : e).timeout(t || 6e4), H.trans ? H.trans.waitFor(e) : e;
|
|
3995
|
+
},
|
|
3996
|
+
Promise: U,
|
|
3997
|
+
debug: {
|
|
3998
|
+
get: function() {
|
|
3999
|
+
return he;
|
|
4000
|
+
},
|
|
4001
|
+
set: function(e) {
|
|
4002
|
+
V(e);
|
|
4003
|
+
}
|
|
4004
|
+
},
|
|
4005
|
+
derive: p,
|
|
4006
|
+
extend: o,
|
|
4007
|
+
props: u,
|
|
4008
|
+
override: _,
|
|
4009
|
+
Events: xt,
|
|
4010
|
+
on: Z,
|
|
4011
|
+
liveQuery: sr,
|
|
4012
|
+
extendObservabilitySet: kn,
|
|
4013
|
+
getByKeyPath: b,
|
|
4014
|
+
setByKeyPath: x,
|
|
4015
|
+
delByKeyPath: function(e, t) {
|
|
4016
|
+
typeof t == "string" ? x(e, t, void 0) : "length" in t && [].map.call(t, function(t) {
|
|
4017
|
+
x(e, t, void 0);
|
|
4018
|
+
});
|
|
4019
|
+
},
|
|
4020
|
+
shallowClone: ee,
|
|
4021
|
+
deepClone: w,
|
|
4022
|
+
getObjectDiff: Vn,
|
|
4023
|
+
cmp: q,
|
|
4024
|
+
asap: y,
|
|
4025
|
+
minKey: -Infinity,
|
|
4026
|
+
addons: [],
|
|
4027
|
+
connections: { get: vn.toArray },
|
|
4028
|
+
errnames: le,
|
|
4029
|
+
dependencies: ir,
|
|
4030
|
+
cache: jn,
|
|
4031
|
+
semVer: "4.4.4",
|
|
4032
|
+
version: "4.4.4".split(".").map(function(e) {
|
|
4033
|
+
return parseInt(e);
|
|
4034
|
+
}).reduce(function(e, t, n) {
|
|
4035
|
+
return e + t / 10 ** (2 * n);
|
|
4036
|
+
})
|
|
4037
|
+
})), cr.maxKey = Yt(cr.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (Z(Ht, function(e) {
|
|
4038
|
+
dr ||= (e = new CustomEvent(Ut, { detail: e }), dr = !0, dispatchEvent(e), !1);
|
|
4039
|
+
}), addEventListener(Ut, function(e) {
|
|
4040
|
+
e = e.detail, dr || lr(e);
|
|
4041
|
+
}));
|
|
4042
|
+
var ur, dr = !1, fr = function() {};
|
|
4043
|
+
return typeof BroadcastChannel < "u" && ((fr = function() {
|
|
4044
|
+
(ur = new BroadcastChannel(Ut)).onmessage = function(e) {
|
|
4045
|
+
return e.data && lr(e.data);
|
|
4046
|
+
};
|
|
4047
|
+
})(), typeof ur.unref == "function" && ur.unref(), Z(Ht, function(e) {
|
|
4048
|
+
dr || ur.postMessage(e);
|
|
4049
|
+
})), typeof addEventListener < "u" && (addEventListener("pagehide", function(e) {
|
|
4050
|
+
if (!rr.disableBfCache && e.persisted) {
|
|
4051
|
+
he && console.debug("Dexie: handling persisted pagehide"), ur?.close();
|
|
4052
|
+
for (var t = 0, n = vn.toArray(); t < n.length; t++) n[t].close({ disableAutoOpen: !1 });
|
|
4053
|
+
}
|
|
4054
|
+
}), addEventListener("pageshow", function(e) {
|
|
4055
|
+
!rr.disableBfCache && e.persisted && (he && console.debug("Dexie: handling persisted pageshow"), fr(), lr({ all: new Q(-Infinity, [[]]) }));
|
|
4056
|
+
})), U.rejectionMapper = function(e, t) {
|
|
4057
|
+
return !e || e instanceof M || e instanceof TypeError || e instanceof SyntaxError || !e.name || !de[e.name] ? e : (t = new de[e.name](t || e.message, e), "stack" in e && f(t, "stack", { get: function() {
|
|
4058
|
+
return this.inner.stack;
|
|
4059
|
+
} }), t);
|
|
4060
|
+
}, V(he), t(rr, Object.freeze({
|
|
4061
|
+
__proto__: null,
|
|
4062
|
+
DEFAULT_MAX_CONNECTIONS: 1e3,
|
|
4063
|
+
Dexie: rr,
|
|
4064
|
+
Entity: pt,
|
|
4065
|
+
PropModification: _t,
|
|
4066
|
+
RangeSet: Q,
|
|
4067
|
+
add: function(e) {
|
|
4068
|
+
return new _t({ add: e });
|
|
4069
|
+
},
|
|
4070
|
+
cmp: q,
|
|
4071
|
+
default: rr,
|
|
4072
|
+
liveQuery: sr,
|
|
4073
|
+
mergeRanges: wn,
|
|
4074
|
+
rangesOverlap: Tn,
|
|
4075
|
+
remove: function(e) {
|
|
4076
|
+
return new _t({ remove: e });
|
|
4077
|
+
},
|
|
4078
|
+
replacePrefix: function(e, t) {
|
|
4079
|
+
return new _t({ replacePrefix: [e, t] });
|
|
4080
|
+
}
|
|
4081
|
+
}), { default: rr }), rr;
|
|
4082
|
+
});
|
|
4083
|
+
})))(), 1), lt = Symbol.for("Dexie"), ut = globalThis[lt] || (globalThis[lt] = ct.default);
|
|
4084
|
+
if (ct.default.semVer !== ut.semVer) throw Error(`Two different versions of Dexie loaded in the same app: ${ct.default.semVer} and ${ut.semVer}`);
|
|
4085
|
+
var { liveQuery: dt, mergeRanges: ft, rangesOverlap: pt, RangeSet: q, cmp: mt, Entity: ht, PropModification: gt, replacePrefix: _t, add: vt, remove: yt, DexieYProvider: bt } = ut, J = "hiai-docs:offline-owner-id", xt = "hiai-docs:offline-binding", St = "hiai-docs:offline-access-enabled", Ct = 10080 * 60 * 1e3;
|
|
4086
|
+
function wt() {
|
|
4087
|
+
return {
|
|
4088
|
+
appId: "hiai-docs",
|
|
4089
|
+
deploymentId: "hiai-docs-pwa-local"
|
|
4090
|
+
};
|
|
4091
|
+
}
|
|
4092
|
+
function Tt(e) {
|
|
4093
|
+
return e instanceof TypeError || typeof navigator < "u" && !navigator.onLine;
|
|
4094
|
+
}
|
|
4095
|
+
function Et() {
|
|
4096
|
+
return typeof localStorage < "u" && localStorage.getItem(St) === "1";
|
|
4097
|
+
}
|
|
4098
|
+
function Dt(e) {
|
|
4099
|
+
typeof localStorage > "u" || (localStorage.setItem(St, "1"), localStorage.setItem(xt, JSON.stringify({
|
|
4100
|
+
identity: e,
|
|
4101
|
+
verifiedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4102
|
+
})));
|
|
4103
|
+
}
|
|
4104
|
+
function Ot() {
|
|
4105
|
+
typeof localStorage > "u" || (localStorage.removeItem(St), localStorage.removeItem(xt), localStorage.removeItem(J));
|
|
4106
|
+
}
|
|
4107
|
+
function kt() {
|
|
4108
|
+
if (!Et() || typeof localStorage > "u") return null;
|
|
4109
|
+
try {
|
|
4110
|
+
let e = JSON.parse(localStorage.getItem(xt) ?? "null");
|
|
4111
|
+
return !e?.identity?.ownerId || !e.verifiedAt || Date.now() - Date.parse(e.verifiedAt) > Ct ? null : {
|
|
4112
|
+
identity: e.identity,
|
|
4113
|
+
verifiedAt: e.verifiedAt
|
|
4114
|
+
};
|
|
4115
|
+
} catch {
|
|
4116
|
+
return null;
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
function At(e) {
|
|
4120
|
+
return `hiai-docs-offline::${e.appId}::${e.deploymentId}::${e.ownerId}::${e.tenantId ?? "none"}`;
|
|
4121
|
+
}
|
|
4122
|
+
async function Y() {
|
|
4123
|
+
let { appId: e, deploymentId: t } = wt();
|
|
4124
|
+
try {
|
|
4125
|
+
let { data: n } = await Ne();
|
|
4126
|
+
if (!n?.user?.id) return Ot(), { kind: "verified-unauthenticated" };
|
|
4127
|
+
let r = {
|
|
4128
|
+
appId: e,
|
|
4129
|
+
deploymentId: t,
|
|
4130
|
+
ownerId: n.user.id,
|
|
4131
|
+
tenantId: void 0
|
|
4132
|
+
};
|
|
4133
|
+
return typeof localStorage < "u" && localStorage.setItem(J, r.ownerId), Et() && Dt(r), {
|
|
4134
|
+
kind: "verified-authenticated",
|
|
4135
|
+
identity: r
|
|
4136
|
+
};
|
|
4137
|
+
} catch (e) {
|
|
4138
|
+
let t = Tt(e) ? kt() : null;
|
|
4139
|
+
return t ? {
|
|
4140
|
+
kind: "offline-bound",
|
|
4141
|
+
...t
|
|
4142
|
+
} : { kind: "unavailable" };
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
4145
|
+
async function jt() {
|
|
4146
|
+
let e = await Y();
|
|
4147
|
+
if (e.kind === "verified-authenticated" || e.kind === "offline-bound") return e.identity;
|
|
4148
|
+
throw Error("Offline identity unavailable");
|
|
4149
|
+
}
|
|
4150
|
+
//#endregion
|
|
4151
|
+
//#region src/lib/db/index.ts
|
|
4152
|
+
var Mt = class extends ut {
|
|
4153
|
+
documents;
|
|
4154
|
+
folders;
|
|
4155
|
+
drafts;
|
|
4156
|
+
mutationQueue;
|
|
4157
|
+
metadata;
|
|
4158
|
+
constructor(e) {
|
|
4159
|
+
super(At(e)), this.version(1).stores({
|
|
4160
|
+
documents: "id, ownerId, tenantId, folderId, updatedAt",
|
|
4161
|
+
folders: "id, ownerId, tenantId, parentId, name",
|
|
4162
|
+
drafts: "docId, ownerId, tenantId, updatedAt",
|
|
4163
|
+
mutationQueue: "++id, docId, op, status",
|
|
4164
|
+
metadata: "key"
|
|
4165
|
+
}), this.version(2).stores({
|
|
4166
|
+
documents: "id, ownerId, tenantId, folderId, updatedAt",
|
|
4167
|
+
folders: "id, ownerId, tenantId, parentId, name",
|
|
4168
|
+
drafts: "docId, ownerId, tenantId, updatedAt",
|
|
4169
|
+
mutationQueue: "++id, docId, op, status, createdAt",
|
|
4170
|
+
metadata: "key"
|
|
4171
|
+
}), this.version(3).stores({
|
|
4172
|
+
documents: "id, ownerId, tenantId, folderId, updatedAt",
|
|
4173
|
+
folders: "id, ownerId, tenantId, parentId, name",
|
|
4174
|
+
drafts: "docId, ownerId, tenantId, updatedAt",
|
|
4175
|
+
mutationQueue: null,
|
|
4176
|
+
metadata: "key"
|
|
4177
|
+
});
|
|
4178
|
+
}
|
|
4179
|
+
}, Nt = /* @__PURE__ */ new Map();
|
|
4180
|
+
function Pt(e) {
|
|
4181
|
+
let t = At(e), n = Nt.get(t);
|
|
4182
|
+
return n || (n = new Mt(e), Nt.set(t, n)), n;
|
|
4183
|
+
}
|
|
4184
|
+
async function Ft(e) {
|
|
4185
|
+
let t = At(e), n = Nt.get(t);
|
|
4186
|
+
if (n) {
|
|
4187
|
+
await n.delete(), Nt.delete(t);
|
|
4188
|
+
return;
|
|
4189
|
+
}
|
|
4190
|
+
await ut.delete(t);
|
|
4191
|
+
}
|
|
4192
|
+
//#endregion
|
|
4193
|
+
//#region src/lib/offline/cleanup.ts
|
|
4194
|
+
async function It() {
|
|
4195
|
+
let e = null;
|
|
4196
|
+
try {
|
|
4197
|
+
e = await jt();
|
|
4198
|
+
} catch {} finally {
|
|
4199
|
+
Ot();
|
|
4200
|
+
}
|
|
4201
|
+
let t = "hiai-docs::hiai-docs-pwa-local::pwa-v1";
|
|
4202
|
+
try {
|
|
4203
|
+
if (e) try {
|
|
4204
|
+
let t = Pt(e);
|
|
4205
|
+
await Promise.allSettled([
|
|
4206
|
+
t.documents.clear(),
|
|
4207
|
+
t.folders.clear(),
|
|
4208
|
+
t.drafts.clear(),
|
|
4209
|
+
t.mutationQueue?.clear(),
|
|
4210
|
+
t.metadata.clear()
|
|
4211
|
+
]);
|
|
4212
|
+
} finally {
|
|
4213
|
+
await Ft(e).catch(() => void 0);
|
|
4214
|
+
}
|
|
4215
|
+
let n = await caches.keys();
|
|
4216
|
+
await Promise.all(n.filter((e) => e.startsWith(`${t}::`) || e.startsWith(`${t}-`)).map((e) => caches.delete(e))), "serviceWorker" in navigator && (await navigator.serviceWorker.getRegistration("/"))?.active?.postMessage({
|
|
4217
|
+
type: "CLEAR_HOST_CACHES",
|
|
4218
|
+
cachePrefix: t
|
|
4219
|
+
});
|
|
4220
|
+
} catch {}
|
|
4221
|
+
}
|
|
4222
|
+
//#endregion
|
|
4223
|
+
//#region src/lib/stores/editor-preferences.ts
|
|
4224
|
+
var Lt = {
|
|
4225
|
+
showVisualMode: !0,
|
|
4226
|
+
showMarkdownMode: !0,
|
|
4227
|
+
minimalToolbar: !1,
|
|
4228
|
+
showScrollToTop: !0
|
|
4229
|
+
};
|
|
4230
|
+
function Rt(e) {
|
|
4231
|
+
if (!e || typeof e != "object") return { ...Lt };
|
|
4232
|
+
let t = e, n = typeof t.showVisualMode == "boolean" ? t.showVisualMode : Lt.showVisualMode, r = typeof t.showMarkdownMode == "boolean" ? t.showMarkdownMode : Lt.showMarkdownMode;
|
|
4233
|
+
return {
|
|
4234
|
+
showVisualMode: n || !r,
|
|
4235
|
+
showMarkdownMode: r,
|
|
4236
|
+
minimalToolbar: typeof t.minimalToolbar == "boolean" ? t.minimalToolbar : Lt.minimalToolbar,
|
|
4237
|
+
showScrollToTop: typeof t.showScrollToTop == "boolean" ? t.showScrollToTop : Lt.showScrollToTop
|
|
4238
|
+
};
|
|
4239
|
+
}
|
|
4240
|
+
//#endregion
|
|
4241
|
+
//#region src/lib/stores/editor-preferences.svelte.ts
|
|
4242
|
+
var zt = "docsmint-editor-preferences", X = z(me({ ...Lt })), Bt = !1;
|
|
4243
|
+
function Vt() {
|
|
4244
|
+
return typeof window < "u" && typeof localStorage < "u";
|
|
4245
|
+
}
|
|
4246
|
+
function Ht() {
|
|
4247
|
+
if (!(!Vt() || Bt)) {
|
|
4248
|
+
Bt = !0;
|
|
4249
|
+
try {
|
|
4250
|
+
I(X, Rt(JSON.parse(localStorage.getItem(zt) ?? "null")), !0);
|
|
4251
|
+
} catch {
|
|
4252
|
+
I(X, { ...Lt }, !0);
|
|
4253
|
+
}
|
|
4254
|
+
}
|
|
4255
|
+
}
|
|
4256
|
+
function Ut(e) {
|
|
4257
|
+
I(X, Rt({
|
|
4258
|
+
...E(X),
|
|
4259
|
+
...e
|
|
4260
|
+
}), !0), Vt() && localStorage.setItem(zt, JSON.stringify(E(X)));
|
|
4261
|
+
}
|
|
4262
|
+
var Z = {
|
|
4263
|
+
get value() {
|
|
4264
|
+
return E(X);
|
|
4265
|
+
},
|
|
4266
|
+
get showMarkdownMode() {
|
|
4267
|
+
return E(X).showMarkdownMode;
|
|
4268
|
+
},
|
|
4269
|
+
get showVisualMode() {
|
|
4270
|
+
return E(X).showVisualMode;
|
|
4271
|
+
},
|
|
4272
|
+
get minimalToolbar() {
|
|
4273
|
+
return E(X).minimalToolbar;
|
|
4274
|
+
},
|
|
4275
|
+
get showScrollToTop() {
|
|
4276
|
+
return E(X).showScrollToTop;
|
|
4277
|
+
},
|
|
4278
|
+
init: Ht,
|
|
4279
|
+
update: Ut
|
|
4280
|
+
}, Wt = A("<!> <!>", 1), Gt = A("<!> <!> <!> <!> <!>", 1), Kt = A("<p class=\"text-xs text-muted-foreground\">Verification is required before the new address becomes active.</p>"), qt = A("<p class=\"text-sm text-destructive\"> </p>"), Jt = A("<!> ", 1), Yt = A("<form class=\"space-y-4\"><div class=\"space-y-2\"><!> <!></div> <div class=\"space-y-2\"><!> <!> <p class=\"text-xs text-muted-foreground\"> </p> <!></div> <!> <!></form>"), Xt = A("<form class=\"space-y-4\"><div class=\"space-y-2\"><!> <!></div> <div class=\"space-y-2\"><!> <!></div> <div class=\"space-y-2\"><!> <!></div> <!> <!></form>"), Zt = A("<button type=\"button\"> </button>"), Qt = A("<div class=\"space-y-6\"><div class=\"space-y-2\"><!> <p class=\"text-xs text-muted-foreground\"> </p></div> <div class=\"grid grid-cols-3 gap-2\"></div> <details class=\"editor-settings border-t pt-5 svelte-1eaqpj\"><summary class=\"flex cursor-pointer items-center justify-between gap-3 rounded-md px-1 py-2 svelte-1eaqpj\"><span><span class=\"block text-sm font-medium\">Editor modes</span> <span class=\"block text-xs text-muted-foreground\">Source views and toolbar layout</span></span> <span class=\"editor-settings-chevron svelte-1eaqpj\" aria-hidden=\"true\">⌄</span></summary> <div class=\"mt-3 space-y-3\"><div class=\"flex items-center justify-between gap-4 rounded-md border p-3\"><span><span class=\"block text-sm font-medium\">Visual editor</span> <span class=\"block text-xs text-muted-foreground\">Show the standard WYSIWYG editor mode.</span></span> <button type=\"button\" role=\"switch\" aria-label=\"Show visual editor\"><span class=\"svelte-1eaqpj\"></span></button></div> <div class=\"flex items-center justify-between gap-4 rounded-md border p-3\"><span><span class=\"block text-sm font-medium\">Raw Markdown</span> <span class=\"block text-xs text-muted-foreground\">Show the Markdown source button in documents.</span></span> <button type=\"button\" role=\"switch\" aria-label=\"Show Raw Markdown\"><span class=\"svelte-1eaqpj\"></span></button></div> <div class=\"flex items-center justify-between gap-4 rounded-md border p-3\"><span><span class=\"block text-sm font-medium\">Minimal toolbar</span> <span class=\"block text-xs text-muted-foreground\">Bold, italic, underline, lists, highlight, and copy.</span></span> <button type=\"button\" role=\"switch\" aria-label=\"Use minimal toolbar\"><span class=\"svelte-1eaqpj\"></span></button></div> <div class=\"flex items-center justify-between gap-4 rounded-md border p-3\"><span><span class=\"block text-sm font-medium\">Scroll to top</span> <span class=\"block text-xs text-muted-foreground\">Show the floating arrow after scrolling down.</span></span> <button type=\"button\" role=\"switch\" aria-label=\"Show scroll to top\"><span class=\"svelte-1eaqpj\"></span></button></div></div></details></div>"), $t = A("<!> <!> <!> <!> <!> <!>", 1), en = A("<!> <!> <!>", 1);
|
|
4281
|
+
function tn(n, c) {
|
|
4282
|
+
le(c, !0);
|
|
4283
|
+
let ie = pe(c, "open", 15, !1), O = z("profile"), A = re(), F = fe(() => be(A.settingsSections, { pathname: Le.url.pathname })), R = z(""), me = z(""), he = z(""), _e = z(""), ye = z("idle"), H = z(""), ke = z(""), Ne = z(""), Be = z(""), He = z("idle"), G = z("");
|
|
4284
|
+
Fe(async () => {
|
|
4285
|
+
Z.init();
|
|
4286
|
+
try {
|
|
4287
|
+
let e = await Me();
|
|
4288
|
+
e.name && I(R, e.name, !0), e.email && (I(me, e.email, !0), I(he, e.email, !0));
|
|
4289
|
+
} catch {}
|
|
4290
|
+
});
|
|
4291
|
+
async function We() {
|
|
4292
|
+
I(ye, "saving"), I(H, "");
|
|
4293
|
+
try {
|
|
4294
|
+
if (await Ae({ name: E(R) }), E(me).trim() !== "" && E(me).trim().toLowerCase() !== E(he).toLowerCase()) {
|
|
4295
|
+
let { error: e } = await U.changeEmail({
|
|
4296
|
+
newEmail: E(me).trim(),
|
|
4297
|
+
callbackURL: "/"
|
|
4298
|
+
});
|
|
4299
|
+
if (e) throw Error(e.message ?? r());
|
|
4300
|
+
I(_e, E(me).trim(), !0);
|
|
4301
|
+
}
|
|
4302
|
+
I(ye, "saved"), setTimeout(() => {
|
|
4303
|
+
I(ye, "idle");
|
|
4304
|
+
}, 2e3);
|
|
4305
|
+
} catch (e) {
|
|
4306
|
+
I(ye, "error"), I(H, e instanceof Error ? e.message : o(), !0);
|
|
4307
|
+
}
|
|
4308
|
+
}
|
|
4309
|
+
async function Ke() {
|
|
4310
|
+
if (I(G, ""), E(Ne) !== E(Be)) {
|
|
4311
|
+
I(He, "error"), I(G, i(), !0);
|
|
4312
|
+
return;
|
|
4313
|
+
}
|
|
4314
|
+
if (E(Ne).length < 8) {
|
|
4315
|
+
I(He, "error"), I(G, b(), !0);
|
|
4316
|
+
return;
|
|
4317
|
+
}
|
|
4318
|
+
I(He, "saving");
|
|
4319
|
+
try {
|
|
4320
|
+
let { error: e } = await U.changePassword({
|
|
4321
|
+
currentPassword: E(ke),
|
|
4322
|
+
newPassword: E(Ne),
|
|
4323
|
+
revokeOtherSessions: !0
|
|
4324
|
+
});
|
|
4325
|
+
if (e) {
|
|
4326
|
+
I(He, "error"), I(G, e.message ?? r(), !0);
|
|
4327
|
+
return;
|
|
4328
|
+
}
|
|
4329
|
+
I(He, "saved"), I(ke, ""), I(Ne, ""), I(Be, ""), setTimeout(() => {
|
|
4330
|
+
I(He, "idle");
|
|
4331
|
+
}, 2e3);
|
|
4332
|
+
} catch (e) {
|
|
4333
|
+
I(He, "error"), I(G, e instanceof Error ? e.message : r(), !0);
|
|
4334
|
+
}
|
|
4335
|
+
}
|
|
4336
|
+
function qe(e) {
|
|
4337
|
+
Pe.set(e);
|
|
4338
|
+
}
|
|
4339
|
+
let Je = [
|
|
4340
|
+
{
|
|
4341
|
+
value: "light",
|
|
4342
|
+
label: y(),
|
|
4343
|
+
key: "light"
|
|
4344
|
+
},
|
|
4345
|
+
{
|
|
4346
|
+
value: "dark",
|
|
4347
|
+
label: f(),
|
|
4348
|
+
key: "dark"
|
|
4349
|
+
},
|
|
4350
|
+
{
|
|
4351
|
+
value: "system",
|
|
4352
|
+
label: g(),
|
|
4353
|
+
key: "system"
|
|
4354
|
+
}
|
|
4355
|
+
], Ye = z(!1);
|
|
4356
|
+
async function Xe() {
|
|
4357
|
+
I(Ye, !0);
|
|
4358
|
+
try {
|
|
4359
|
+
await It(), await je(), ie(!1), Ie("/login");
|
|
4360
|
+
} catch {
|
|
4361
|
+
I(Ye, !1);
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
function Ze() {
|
|
4365
|
+
ie(!1);
|
|
4366
|
+
}
|
|
4367
|
+
var Qe = k();
|
|
4368
|
+
j(N(Qe), () => Te, (n, r) => {
|
|
4369
|
+
r(n, {
|
|
4370
|
+
get open() {
|
|
4371
|
+
return ie();
|
|
4372
|
+
},
|
|
4373
|
+
set open(e) {
|
|
4374
|
+
ie(e);
|
|
4375
|
+
},
|
|
4376
|
+
children: (n, r) => {
|
|
4377
|
+
var i = en(), o = N(i);
|
|
4378
|
+
j(o, () => Ee, (e, t) => {
|
|
4379
|
+
t(e, {
|
|
4380
|
+
children: (e, t) => {
|
|
4381
|
+
var n = Wt(), r = N(n);
|
|
4382
|
+
j(r, () => we, (e, t) => {
|
|
4383
|
+
t(e, {
|
|
4384
|
+
children: (e, t) => {
|
|
4385
|
+
P();
|
|
4386
|
+
var n = D();
|
|
4387
|
+
B((e) => w(n, e), [() => m()]), L(e, n);
|
|
4388
|
+
},
|
|
4389
|
+
$$slots: { default: !0 }
|
|
4390
|
+
});
|
|
4391
|
+
}), j(V(r, 2), () => xe, (e, t) => {
|
|
4392
|
+
t(e, {
|
|
4393
|
+
children: (e, t) => {
|
|
4394
|
+
P();
|
|
4395
|
+
var n = D();
|
|
4396
|
+
B((e) => w(n, e), [() => _()]), L(e, n);
|
|
4397
|
+
},
|
|
4398
|
+
$$slots: { default: !0 }
|
|
4399
|
+
});
|
|
4400
|
+
}), L(e, n);
|
|
4401
|
+
},
|
|
4402
|
+
$$slots: { default: !0 }
|
|
4403
|
+
});
|
|
4404
|
+
});
|
|
4405
|
+
var c = V(o, 2);
|
|
4406
|
+
j(c, () => Ve, (n, r) => {
|
|
4407
|
+
r(n, {
|
|
4408
|
+
class: "w-full",
|
|
4409
|
+
get value() {
|
|
4410
|
+
return E(O);
|
|
4411
|
+
},
|
|
4412
|
+
set value(e) {
|
|
4413
|
+
I(O, e, !0);
|
|
4414
|
+
},
|
|
4415
|
+
children: (n, r) => {
|
|
4416
|
+
var i = $t(), a = N(i);
|
|
4417
|
+
j(a, () => Ue, (t, n) => {
|
|
4418
|
+
n(t, {
|
|
4419
|
+
class: "grid w-full grid-cols-[repeat(auto-fit,minmax(0,1fr))] gap-1",
|
|
4420
|
+
children: (t, n) => {
|
|
4421
|
+
var r = Gt(), i = N(r);
|
|
4422
|
+
{
|
|
4423
|
+
let e = fe(() => E(O) === "profile");
|
|
4424
|
+
j(i, () => Ge, (t, n) => {
|
|
4425
|
+
n(t, {
|
|
4426
|
+
value: "profile",
|
|
4427
|
+
get selected() {
|
|
4428
|
+
return E(e);
|
|
4429
|
+
},
|
|
4430
|
+
onclick: (e) => I(O, e, !0),
|
|
4431
|
+
children: (e, t) => {
|
|
4432
|
+
P();
|
|
4433
|
+
var n = D();
|
|
4434
|
+
B((e) => w(n, e), [() => te()]), L(e, n);
|
|
4435
|
+
},
|
|
4436
|
+
$$slots: { default: !0 }
|
|
4437
|
+
});
|
|
4438
|
+
});
|
|
4439
|
+
}
|
|
4440
|
+
var a = V(i, 2);
|
|
4441
|
+
{
|
|
4442
|
+
let t = fe(() => E(O) === "password");
|
|
4443
|
+
j(a, () => Ge, (n, r) => {
|
|
4444
|
+
r(n, {
|
|
4445
|
+
value: "password",
|
|
4446
|
+
get selected() {
|
|
4447
|
+
return E(t);
|
|
4448
|
+
},
|
|
4449
|
+
onclick: (e) => I(O, e, !0),
|
|
4450
|
+
children: (t, n) => {
|
|
4451
|
+
P();
|
|
4452
|
+
var r = D();
|
|
4453
|
+
B((e) => w(r, e), [() => e()]), L(t, r);
|
|
4454
|
+
},
|
|
4455
|
+
$$slots: { default: !0 }
|
|
4456
|
+
});
|
|
4457
|
+
});
|
|
4458
|
+
}
|
|
4459
|
+
var o = V(a, 2);
|
|
4460
|
+
{
|
|
4461
|
+
let e = fe(() => E(O) === "api");
|
|
4462
|
+
j(o, () => Ge, (t, n) => {
|
|
4463
|
+
n(t, {
|
|
4464
|
+
value: "api",
|
|
4465
|
+
get selected() {
|
|
4466
|
+
return E(e);
|
|
4467
|
+
},
|
|
4468
|
+
onclick: (e) => I(O, e, !0),
|
|
4469
|
+
children: (e, t) => {
|
|
4470
|
+
P(), L(e, D("API"));
|
|
4471
|
+
},
|
|
4472
|
+
$$slots: { default: !0 }
|
|
4473
|
+
});
|
|
4474
|
+
});
|
|
4475
|
+
}
|
|
4476
|
+
var s = V(o, 2);
|
|
4477
|
+
{
|
|
4478
|
+
let e = fe(() => E(O) === "appearance");
|
|
4479
|
+
j(s, () => Ge, (t, n) => {
|
|
4480
|
+
n(t, {
|
|
4481
|
+
value: "appearance",
|
|
4482
|
+
get selected() {
|
|
4483
|
+
return E(e);
|
|
4484
|
+
},
|
|
4485
|
+
onclick: (e) => I(O, e, !0),
|
|
4486
|
+
children: (e, t) => {
|
|
4487
|
+
P(), L(e, D("Style"));
|
|
4488
|
+
},
|
|
4489
|
+
$$slots: { default: !0 }
|
|
4490
|
+
});
|
|
4491
|
+
});
|
|
4492
|
+
}
|
|
4493
|
+
oe(V(s, 2), 17, () => E(F), (e) => e.id, (e, t) => {
|
|
4494
|
+
var n = k(), r = N(n);
|
|
4495
|
+
{
|
|
4496
|
+
let e = fe(() => E(O) === E(t).id);
|
|
4497
|
+
j(r, () => Ge, (n, r) => {
|
|
4498
|
+
r(n, {
|
|
4499
|
+
get value() {
|
|
4500
|
+
return E(t).id;
|
|
4501
|
+
},
|
|
4502
|
+
get selected() {
|
|
4503
|
+
return E(e);
|
|
4504
|
+
},
|
|
4505
|
+
onclick: (e) => I(O, e, !0),
|
|
4506
|
+
children: (e, n) => {
|
|
4507
|
+
P();
|
|
4508
|
+
var r = D();
|
|
4509
|
+
B(() => w(r, E(t).label)), L(e, r);
|
|
4510
|
+
},
|
|
4511
|
+
$$slots: { default: !0 }
|
|
4512
|
+
});
|
|
4513
|
+
});
|
|
4514
|
+
}
|
|
4515
|
+
L(e, n);
|
|
4516
|
+
}), L(t, r);
|
|
4517
|
+
},
|
|
4518
|
+
$$slots: { default: !0 }
|
|
4519
|
+
});
|
|
4520
|
+
});
|
|
4521
|
+
var o = V(a, 2);
|
|
4522
|
+
j(o, () => W, (e, n) => {
|
|
4523
|
+
n(e, {
|
|
4524
|
+
value: "profile",
|
|
4525
|
+
get currentValue() {
|
|
4526
|
+
return E(O);
|
|
4527
|
+
},
|
|
4528
|
+
children: (e, n) => {
|
|
4529
|
+
var r = Yt(), i = C(r), a = C(i);
|
|
4530
|
+
De(a, {
|
|
4531
|
+
for: "settings-name",
|
|
4532
|
+
children: (e, t) => {
|
|
4533
|
+
P();
|
|
4534
|
+
var n = D();
|
|
4535
|
+
B((e) => w(n, e), [() => S()]), L(e, n);
|
|
4536
|
+
},
|
|
4537
|
+
$$slots: { default: !0 }
|
|
4538
|
+
}), Oe(V(a, 2), {
|
|
4539
|
+
id: "settings-name",
|
|
4540
|
+
type: "text",
|
|
4541
|
+
name: "name",
|
|
4542
|
+
autocomplete: "name",
|
|
4543
|
+
get value() {
|
|
4544
|
+
return E(R);
|
|
4545
|
+
},
|
|
4546
|
+
set value(e) {
|
|
4547
|
+
I(R, e, !0);
|
|
4548
|
+
}
|
|
4549
|
+
}), M(i);
|
|
4550
|
+
var o = V(i, 2), s = C(o);
|
|
4551
|
+
De(s, {
|
|
4552
|
+
for: "settings-email",
|
|
4553
|
+
children: (e, t) => {
|
|
4554
|
+
P();
|
|
4555
|
+
var n = D();
|
|
4556
|
+
B((e) => w(n, e), [() => x()]), L(e, n);
|
|
4557
|
+
},
|
|
4558
|
+
$$slots: { default: !0 }
|
|
4559
|
+
});
|
|
4560
|
+
var c = V(s, 2);
|
|
4561
|
+
Oe(c, {
|
|
4562
|
+
id: "settings-email",
|
|
4563
|
+
type: "email",
|
|
4564
|
+
name: "email",
|
|
4565
|
+
autocomplete: "email",
|
|
4566
|
+
get value() {
|
|
4567
|
+
return E(me);
|
|
4568
|
+
},
|
|
4569
|
+
set value(e) {
|
|
4570
|
+
I(me, e, !0);
|
|
4571
|
+
}
|
|
4572
|
+
});
|
|
4573
|
+
var l = V(c, 2), u = C(l, !0);
|
|
4574
|
+
M(l);
|
|
4575
|
+
var d = V(l, 2), f = (e) => {
|
|
4576
|
+
L(e, Kt());
|
|
4577
|
+
};
|
|
4578
|
+
T(d, (e) => {
|
|
4579
|
+
E(_e) && e(f);
|
|
4580
|
+
}), M(o);
|
|
4581
|
+
var p = V(o, 2), m = (e) => {
|
|
4582
|
+
var t = qt(), n = C(t, !0);
|
|
4583
|
+
M(t), B(() => w(n, E(H))), L(e, t);
|
|
4584
|
+
};
|
|
4585
|
+
T(p, (e) => {
|
|
4586
|
+
E(H) && e(m);
|
|
4587
|
+
});
|
|
4588
|
+
var g = V(p, 2);
|
|
4589
|
+
{
|
|
4590
|
+
let e = fe(() => E(ye) === "saving");
|
|
4591
|
+
Se(g, {
|
|
4592
|
+
type: "submit",
|
|
4593
|
+
get disabled() {
|
|
4594
|
+
return E(e);
|
|
4595
|
+
},
|
|
4596
|
+
class: "w-full sm:w-auto",
|
|
4597
|
+
children: (e, n) => {
|
|
4598
|
+
var r = Jt(), i = N(r), a = (e) => {
|
|
4599
|
+
ve(e, { class: "mr-2 size-4 animate-spin" });
|
|
4600
|
+
}, o = (e) => {
|
|
4601
|
+
ze(e, { class: "mr-2 size-4" });
|
|
4602
|
+
};
|
|
4603
|
+
T(i, (e) => {
|
|
4604
|
+
E(ye) === "saving" ? e(a) : e(o, -1);
|
|
4605
|
+
});
|
|
4606
|
+
var s = V(i);
|
|
4607
|
+
B((e) => w(s, ` ${e ?? ""}`), [() => E(ye) === "saved" ? t() : h()]), L(e, r);
|
|
4608
|
+
},
|
|
4609
|
+
$$slots: { default: !0 }
|
|
4610
|
+
});
|
|
4611
|
+
}
|
|
4612
|
+
M(r), B((e) => w(u, e), [() => v()]), ge("submit", r, (e) => {
|
|
4613
|
+
e.preventDefault(), We();
|
|
4614
|
+
}), L(e, r);
|
|
4615
|
+
},
|
|
4616
|
+
$$slots: { default: !0 }
|
|
4617
|
+
});
|
|
4618
|
+
});
|
|
4619
|
+
var c = V(o, 2);
|
|
4620
|
+
j(c, () => W, (e, n) => {
|
|
4621
|
+
n(e, {
|
|
4622
|
+
value: "password",
|
|
4623
|
+
get currentValue() {
|
|
4624
|
+
return E(O);
|
|
4625
|
+
},
|
|
4626
|
+
children: (e, n) => {
|
|
4627
|
+
var r = Xt(), i = C(r), a = C(i);
|
|
4628
|
+
De(a, {
|
|
4629
|
+
for: "settings-current-password",
|
|
4630
|
+
children: (e, t) => {
|
|
4631
|
+
P();
|
|
4632
|
+
var n = D();
|
|
4633
|
+
B((e) => w(n, e), [() => u()]), L(e, n);
|
|
4634
|
+
},
|
|
4635
|
+
$$slots: { default: !0 }
|
|
4636
|
+
}), Oe(V(a, 2), {
|
|
4637
|
+
id: "settings-current-password",
|
|
4638
|
+
type: "password",
|
|
4639
|
+
name: "current-password",
|
|
4640
|
+
autocomplete: "current-password",
|
|
4641
|
+
get value() {
|
|
4642
|
+
return E(ke);
|
|
4643
|
+
},
|
|
4644
|
+
set value(e) {
|
|
4645
|
+
I(ke, e, !0);
|
|
4646
|
+
}
|
|
4647
|
+
}), M(i);
|
|
4648
|
+
var o = V(i, 2), c = C(o);
|
|
4649
|
+
De(c, {
|
|
4650
|
+
for: "settings-new-password",
|
|
4651
|
+
children: (e, t) => {
|
|
4652
|
+
P();
|
|
4653
|
+
var n = D();
|
|
4654
|
+
B((e) => w(n, e), [() => s()]), L(e, n);
|
|
4655
|
+
},
|
|
4656
|
+
$$slots: { default: !0 }
|
|
4657
|
+
}), Oe(V(c, 2), {
|
|
4658
|
+
id: "settings-new-password",
|
|
4659
|
+
type: "password",
|
|
4660
|
+
name: "new-password",
|
|
4661
|
+
autocomplete: "new-password",
|
|
4662
|
+
get value() {
|
|
4663
|
+
return E(Ne);
|
|
4664
|
+
},
|
|
4665
|
+
set value(e) {
|
|
4666
|
+
I(Ne, e, !0);
|
|
4667
|
+
}
|
|
4668
|
+
}), M(o);
|
|
4669
|
+
var f = V(o, 2), p = C(f);
|
|
4670
|
+
De(p, {
|
|
4671
|
+
for: "settings-confirm-password",
|
|
4672
|
+
children: (e, t) => {
|
|
4673
|
+
P();
|
|
4674
|
+
var n = D();
|
|
4675
|
+
B((e) => w(n, e), [() => d()]), L(e, n);
|
|
4676
|
+
},
|
|
4677
|
+
$$slots: { default: !0 }
|
|
4678
|
+
}), Oe(V(p, 2), {
|
|
4679
|
+
id: "settings-confirm-password",
|
|
4680
|
+
type: "password",
|
|
4681
|
+
name: "confirm-password",
|
|
4682
|
+
autocomplete: "new-password",
|
|
4683
|
+
get value() {
|
|
4684
|
+
return E(Be);
|
|
4685
|
+
},
|
|
4686
|
+
set value(e) {
|
|
4687
|
+
I(Be, e, !0);
|
|
4688
|
+
}
|
|
4689
|
+
}), M(f);
|
|
4690
|
+
var m = V(f, 2), h = (e) => {
|
|
4691
|
+
var t = qt(), n = C(t, !0);
|
|
4692
|
+
M(t), B(() => w(n, E(G))), L(e, t);
|
|
4693
|
+
};
|
|
4694
|
+
T(m, (e) => {
|
|
4695
|
+
E(G) && e(h);
|
|
4696
|
+
});
|
|
4697
|
+
var g = V(m, 2);
|
|
4698
|
+
{
|
|
4699
|
+
let e = fe(() => E(He) === "saving");
|
|
4700
|
+
Se(g, {
|
|
4701
|
+
type: "submit",
|
|
4702
|
+
get disabled() {
|
|
4703
|
+
return E(e);
|
|
4704
|
+
},
|
|
4705
|
+
class: "w-full sm:w-auto",
|
|
4706
|
+
children: (e, n) => {
|
|
4707
|
+
var r = Jt(), i = N(r), a = (e) => {
|
|
4708
|
+
ve(e, { class: "mr-2 size-4 animate-spin" });
|
|
4709
|
+
};
|
|
4710
|
+
T(i, (e) => {
|
|
4711
|
+
E(He) === "saving" && e(a);
|
|
4712
|
+
});
|
|
4713
|
+
var o = V(i);
|
|
4714
|
+
B((e) => w(o, ` ${e ?? ""}`), [() => E(He) === "saved" ? t() : l()]), L(e, r);
|
|
4715
|
+
},
|
|
4716
|
+
$$slots: { default: !0 }
|
|
4717
|
+
});
|
|
4718
|
+
}
|
|
4719
|
+
M(r), ge("submit", r, (e) => {
|
|
4720
|
+
e.preventDefault(), Ke();
|
|
4721
|
+
}), L(e, r);
|
|
4722
|
+
},
|
|
4723
|
+
$$slots: { default: !0 }
|
|
4724
|
+
});
|
|
4725
|
+
});
|
|
4726
|
+
var f = V(c, 2);
|
|
4727
|
+
j(f, () => W, (e, t) => {
|
|
4728
|
+
t(e, {
|
|
4729
|
+
value: "appearance",
|
|
4730
|
+
get currentValue() {
|
|
4731
|
+
return E(O);
|
|
4732
|
+
},
|
|
4733
|
+
children: (e, t) => {
|
|
4734
|
+
var n = Qt(), r = C(n), i = C(r);
|
|
4735
|
+
De(i, {
|
|
4736
|
+
children: (e, t) => {
|
|
4737
|
+
P();
|
|
4738
|
+
var n = D();
|
|
4739
|
+
B((e) => w(n, e), [() => ee()]), L(e, n);
|
|
4740
|
+
},
|
|
4741
|
+
$$slots: { default: !0 }
|
|
4742
|
+
});
|
|
4743
|
+
var a = V(i, 2), o = C(a, !0);
|
|
4744
|
+
M(a), M(r);
|
|
4745
|
+
var s = V(r, 2);
|
|
4746
|
+
oe(s, 21, () => Je, (e) => e.key, (e, t) => {
|
|
4747
|
+
var n = Zt(), r = C(n, !0);
|
|
4748
|
+
M(n), B((e) => {
|
|
4749
|
+
de(n, 1, e, "svelte-1eaqpj"), w(r, E(t).label);
|
|
4750
|
+
}, [() => ue(["rounded-md border px-3 py-2 text-sm font-medium transition-colors", Pe.value === E(t).value ? "border-primary bg-primary text-primary-foreground" : "border-border text-muted-foreground hover:bg-accent hover:text-accent-foreground"].join(" "))]), ae("click", n, () => qe(E(t).value)), L(e, n);
|
|
4751
|
+
}), M(s);
|
|
4752
|
+
var c = V(s, 2), l = V(C(c), 2), u = C(l), d = V(C(u), 2);
|
|
4753
|
+
let f;
|
|
4754
|
+
M(u);
|
|
4755
|
+
var m = V(u, 2), h = V(C(m), 2);
|
|
4756
|
+
let g;
|
|
4757
|
+
M(m);
|
|
4758
|
+
var _ = V(m, 2), v = V(C(_), 2);
|
|
4759
|
+
let y;
|
|
4760
|
+
M(_);
|
|
4761
|
+
var b = V(_, 2), x = V(C(b), 2);
|
|
4762
|
+
let S;
|
|
4763
|
+
M(b), M(l), M(c), M(n), B((e) => {
|
|
4764
|
+
w(o, e), f = de(d, 1, "preference-switch svelte-1eaqpj", null, f, { enabled: Z.showVisualMode }), se(d, "aria-checked", Z.showVisualMode), d.disabled = !Z.showMarkdownMode, g = de(h, 1, "preference-switch svelte-1eaqpj", null, g, { enabled: Z.showMarkdownMode }), se(h, "aria-checked", Z.showMarkdownMode), h.disabled = !Z.showVisualMode, y = de(v, 1, "preference-switch svelte-1eaqpj", null, y, { enabled: Z.minimalToolbar }), se(v, "aria-checked", Z.minimalToolbar), S = de(x, 1, "preference-switch svelte-1eaqpj", null, S, { enabled: Z.showScrollToTop }), se(x, "aria-checked", Z.showScrollToTop);
|
|
4765
|
+
}, [() => p()]), ae("click", d, () => Z.update({ showVisualMode: !Z.showVisualMode })), ae("click", h, () => Z.update({ showMarkdownMode: !Z.showMarkdownMode })), ae("click", v, () => Z.update({ minimalToolbar: !Z.minimalToolbar })), ae("click", x, () => Z.update({ showScrollToTop: !Z.showScrollToTop })), L(e, n);
|
|
4766
|
+
},
|
|
4767
|
+
$$slots: { default: !0 }
|
|
4768
|
+
});
|
|
4769
|
+
});
|
|
4770
|
+
var m = V(f, 2);
|
|
4771
|
+
j(m, () => W, (e, t) => {
|
|
4772
|
+
t(e, {
|
|
4773
|
+
value: "api",
|
|
4774
|
+
get currentValue() {
|
|
4775
|
+
return E(O);
|
|
4776
|
+
},
|
|
4777
|
+
children: (e, t) => {
|
|
4778
|
+
st(e, {});
|
|
4779
|
+
},
|
|
4780
|
+
$$slots: { default: !0 }
|
|
4781
|
+
});
|
|
4782
|
+
}), oe(V(m, 2), 17, () => E(F), (e) => e.id, (e, t) => {
|
|
4783
|
+
var n = k();
|
|
4784
|
+
j(N(n), () => W, (e, n) => {
|
|
4785
|
+
n(e, {
|
|
4786
|
+
get value() {
|
|
4787
|
+
return E(t).id;
|
|
4788
|
+
},
|
|
4789
|
+
get currentValue() {
|
|
4790
|
+
return E(O);
|
|
4791
|
+
},
|
|
4792
|
+
children: (e, n) => {
|
|
4793
|
+
let r = fe(() => E(t).component);
|
|
4794
|
+
var i = k();
|
|
4795
|
+
j(N(i), () => E(r), (e, t) => {
|
|
4796
|
+
t(e, {});
|
|
4797
|
+
}), L(e, i);
|
|
4798
|
+
},
|
|
4799
|
+
$$slots: { default: !0 }
|
|
4800
|
+
});
|
|
4801
|
+
}), L(e, n);
|
|
4802
|
+
}), L(n, i);
|
|
4803
|
+
},
|
|
4804
|
+
$$slots: { default: !0 }
|
|
4805
|
+
});
|
|
4806
|
+
}), j(V(c, 2), () => Ce, (e, t) => {
|
|
4807
|
+
t(e, {
|
|
4808
|
+
class: "settings-dialog-footer gap-4 max-sm:flex-col max-sm:items-stretch",
|
|
4809
|
+
children: (e, t) => {
|
|
4810
|
+
var n = Wt(), r = N(n), i = (e) => {
|
|
4811
|
+
Se(e, {
|
|
4812
|
+
id: "logout-button",
|
|
4813
|
+
variant: "ghost",
|
|
4814
|
+
onclick: Xe,
|
|
4815
|
+
get disabled() {
|
|
4816
|
+
return E(Ye);
|
|
4817
|
+
},
|
|
4818
|
+
class: "mr-auto text-muted-foreground hover:text-destructive max-sm:mr-0",
|
|
4819
|
+
children: (e, t) => {
|
|
4820
|
+
var n = Jt(), r = N(n);
|
|
4821
|
+
Re(r, { class: "mr-2 size-4" });
|
|
4822
|
+
var i = V(r);
|
|
4823
|
+
B((e) => w(i, ` ${e ?? ""}`), [() => E(Ye) ? "…" : a()]), L(e, n);
|
|
4824
|
+
},
|
|
4825
|
+
$$slots: { default: !0 }
|
|
4826
|
+
});
|
|
4827
|
+
};
|
|
4828
|
+
T(r, (e) => {
|
|
4829
|
+
E(O) === "profile" && e(i);
|
|
4830
|
+
}), Se(V(r, 2), {
|
|
4831
|
+
variant: "outline",
|
|
4832
|
+
onclick: Ze,
|
|
4833
|
+
class: "w-full sm:w-auto",
|
|
4834
|
+
children: (e, t) => {
|
|
4835
|
+
P();
|
|
4836
|
+
var n = D();
|
|
4837
|
+
B((e) => w(n, e), [() => ne()]), L(e, n);
|
|
4838
|
+
},
|
|
4839
|
+
$$slots: { default: !0 }
|
|
4840
|
+
}), L(e, n);
|
|
4841
|
+
},
|
|
4842
|
+
$$slots: { default: !0 }
|
|
4843
|
+
});
|
|
4844
|
+
}), L(n, i);
|
|
4845
|
+
},
|
|
4846
|
+
$$slots: { default: !0 }
|
|
4847
|
+
});
|
|
4848
|
+
}), L(n, Qe), ce();
|
|
4849
|
+
}
|
|
4850
|
+
O(["click"]);
|
|
4851
|
+
//#endregion
|
|
4852
|
+
export { Ke as a, Je as i, Qe as n, Xe as o, Ze as r, Ye as s, tn as t };
|