@nylas/react 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract-provider-efe136bd-2041bdce.js +187 -0
- package/dist/abstract-provider-efe136bd-b4663c02.cjs +1 -0
- package/dist/add-circle-icon_2.entry-5204c48a.cjs +1 -0
- package/dist/add-circle-icon_2.entry-ea1692a4.js +26 -0
- package/dist/archive-icon.entry-0b585dff.js +16 -0
- package/dist/archive-icon.entry-c2c66bca.cjs +1 -0
- package/dist/{arrow-icon.entry-9414299f.js → arrow-icon.entry-2e61394e.js} +5 -5
- package/dist/arrow-icon.entry-9d471162.cjs +1 -0
- package/dist/{bold-icon.entry-c781e9c1.cjs → bold-icon.entry-5c37622f.cjs} +1 -1
- package/dist/{bold-icon.entry-b72aed9f.js → bold-icon.entry-8ef1b653.js} +2 -2
- package/dist/{button-component_2.entry-73f76545.cjs → button-component_2.entry-8335ee1e.cjs} +1 -1
- package/dist/{button-component_2.entry-36e49459.js → button-component_2.entry-c906230f.js} +9 -9
- package/dist/calendar-agenda-fill-icon_36.entry-59c0a997.cjs +6 -0
- package/dist/{calendar-agenda-fill-icon_36.entry-efa7ad26.js → calendar-agenda-fill-icon_36.entry-5f184433.js} +900 -881
- package/dist/{calendar-cancel-icon.entry-01c388eb.cjs → calendar-cancel-icon.entry-65a4a34e.cjs} +1 -1
- package/dist/{calendar-cancel-icon.entry-0f739a8a.js → calendar-cancel-icon.entry-dd6ac4db.js} +5 -5
- package/dist/{calendar-check-icon_2.entry-5febbadf.cjs → calendar-check-icon_2.entry-ded15038.cjs} +1 -1
- package/dist/{calendar-check-icon_2.entry-dfb0036d.js → calendar-check-icon_2.entry-f9b50bb8.js} +3 -3
- package/dist/{calendar-icon.entry-f197396d.js → calendar-icon.entry-a2a1ddbc.js} +2 -2
- package/dist/{calendar-icon.entry-9743e0b7.cjs → calendar-icon.entry-ca512dd6.cjs} +1 -1
- package/dist/checkbox-component_2.entry-d6128246.js +115 -0
- package/dist/checkbox-component_2.entry-d79b5d1d.cjs +1 -0
- package/dist/checkbox-group_4.entry-2946c7ef.cjs +28 -0
- package/dist/{nylas-event-calendar_3.entry-9abd46c2.js → checkbox-group_4.entry-e5145451.js} +1038 -923
- package/dist/{checkmark-icon_15.entry-5c09cff5.js → checkmark-icon_15.entry-6e92e93e.js} +19 -19
- package/dist/{checkmark-icon_15.entry-35dd97b7.cjs → checkmark-icon_15.entry-a75a1825.cjs} +2 -2
- package/dist/{chevron-icon_3.entry-4a72f211.js → chevron-icon_3.entry-6eaa3513.js} +16 -16
- package/dist/{chevron-icon_3.entry-e0608b7c.cjs → chevron-icon_3.entry-9193a885.cjs} +1 -1
- package/dist/{clock-icon_4.entry-0afe79c2.js → clock-icon_4.entry-2c93270e.js} +8 -8
- package/dist/{clock-icon_4.entry-202ce025.cjs → clock-icon_4.entry-ae2272f4.cjs} +1 -1
- package/dist/{customParseFormat-d1de5ed0-c0ef002d.js → customParseFormat-edc38d83-b3722499.js} +1 -1
- package/dist/{customParseFormat-d1de5ed0-65a0bba3.cjs → customParseFormat-edc38d83-fa9c77d9.cjs} +1 -1
- package/dist/{delete-icon.entry-580bfcc9.js → delete-icon.entry-6684eba6.js} +2 -2
- package/dist/{delete-icon.entry-762ac892.cjs → delete-icon.entry-b9e4f2c7.cjs} +1 -1
- package/dist/{document-refresh-icon.entry-4e0f0c61.cjs → document-refresh-icon.entry-7afe6163.cjs} +1 -1
- package/dist/document-refresh-icon.entry-fba9f60b.js +16 -0
- package/dist/{feedbackSync-172f942c-42124493.js → feedbackSync-e4378c0b-23289195.js} +811 -798
- package/dist/{feedbackSync-172f942c-62f72bd2.cjs → feedbackSync-e4378c0b-7876d067.cjs} +26 -26
- package/dist/{folder-icon.entry-54c3cc66.js → folder-icon.entry-430c6b47.js} +4 -4
- package/dist/{folder-icon.entry-2694e253.cjs → folder-icon.entry-b1632bf3.cjs} +1 -1
- package/dist/{forward-icon.entry-5e540f05.js → forward-icon.entry-5e53da76.js} +2 -2
- package/dist/{forward-icon.entry-f07102d8.cjs → forward-icon.entry-7626dcca.cjs} +1 -1
- package/dist/{globe-icon_2.entry-aaceb196.js → globe-icon_2.entry-646eae41.js} +20 -20
- package/dist/{globe-icon_2.entry-14a4c168.cjs → globe-icon_2.entry-bbb0a6ce.cjs} +1 -1
- package/dist/{google-logo-icon_6.entry-00d40db2.js → google-logo-icon_6.entry-5951a546.js} +682 -488
- package/dist/google-logo-icon_6.entry-e39dd9cb.cjs +2 -0
- package/dist/{google-meet-icon_5.entry-f1f05903.js → google-meet-icon_5.entry-a54c83da.js} +14 -14
- package/dist/{google-meet-icon_5.entry-6c20e149.cjs → google-meet-icon_5.entry-c13e0738.cjs} +1 -1
- package/dist/inbox-icon.entry-7bee82b3.js +16 -0
- package/dist/inbox-icon.entry-911b047a.cjs +1 -0
- package/dist/index-71f61ea9.js +24544 -0
- package/dist/index-f769bc2a.cjs +118 -0
- package/dist/index.d.ts +1 -4
- package/dist/index.es-6a9d55cf-122c27e0.js +2724 -0
- package/dist/index.es-6a9d55cf-458ba0e0.cjs +7 -0
- package/dist/{info-icon_2.entry-bbcefb9a.cjs → info-icon_2.entry-471b836b.cjs} +1 -1
- package/dist/{info-icon_2.entry-b3b313ab.js → info-icon_2.entry-6ff2f004.js} +3 -3
- package/dist/{input-component.entry-401b9ba5.js → input-component.entry-781b584c.js} +12 -12
- package/dist/{input-component.entry-ec8e8e7c.cjs → input-component.entry-b6a9b4cb.cjs} +1 -1
- package/dist/{input-dropdown_2.entry-c37f392c.js → input-dropdown_2.entry-1feebcba.js} +3 -3
- package/dist/{input-dropdown_2.entry-8cb11601.cjs → input-dropdown_2.entry-c71d14ff.cjs} +1 -1
- package/dist/{italic-icon.entry-6675558a.cjs → italic-icon.entry-16debde5.cjs} +1 -1
- package/dist/italic-icon.entry-9ef7f4a2.js +16 -0
- package/dist/{elements → lib/elements}/index.d.ts +1 -1
- package/dist/lib/index.d.ts +5 -0
- package/dist/lib/main.d.ts +0 -0
- package/dist/lib/notetaker/CalendarSync/CalendarSync.d.ts +37 -0
- package/dist/lib/notetaker/CalendarSync/CalendarSync.spec.d.ts +0 -0
- package/dist/lib/notetaker/SendNotetaker/SendNotetaker.d.ts +31 -0
- package/dist/lib/notetaker/SendNotetaker/SendNotetaker.spec.d.ts +1 -0
- package/dist/lib/notetaker/Transcript/Transcript.d.ts +23 -0
- package/dist/lib/notetaker/Transcript/Transcript.spec.d.ts +0 -0
- package/dist/lib/notetaker/VideoPlayer/VideoPlayer.d.ts +22 -0
- package/dist/lib/notetaker/VideoPlayer/VideoPlayer.spec.d.ts +1 -0
- package/dist/lib/notetaker/index.d.ts +9 -0
- package/dist/lib/notetaker/lib/constants.d.ts +12 -0
- package/dist/lib/notetaker/lib/http-client.d.ts +2 -0
- package/dist/lib/notetaker/lib/primitives.d.ts +66 -0
- package/dist/lib/notetaker/lib/store.d.ts +7 -0
- package/dist/lib/notetaker/types.d.ts +42 -0
- package/dist/multi-select-dropdown.entry-0a6f9417.cjs +1 -0
- package/dist/multi-select-dropdown.entry-1b27c746.js +121 -0
- package/dist/nylas-booked-event-card_11.entry-74fba802.cjs +1 -0
- package/dist/{nylas-booked-event-card_12.entry-e7464ae7.js → nylas-booked-event-card_11.entry-802671ee.js} +469 -534
- package/dist/{nylas-form-card.entry-cbb00fba.cjs → nylas-form-card.entry-59a837c9.cjs} +1 -1
- package/dist/{nylas-form-card.entry-a3186807.js → nylas-form-card.entry-7da9a312.js} +3 -3
- package/dist/nylas-notification_2.entry-8f8bad34.cjs +1 -0
- package/dist/nylas-notification_2.entry-b16bb805.js +85 -0
- package/dist/{nylas-scheduler-editor.entry-7b188a38.js → nylas-scheduler-editor.entry-cbe3e1e3.js} +160 -136
- package/dist/nylas-scheduler-editor.entry-e33e11fb.cjs +2 -0
- package/dist/nylas-scheduling.entry-4223e50b.cjs +1 -0
- package/dist/{nylas-scheduling.entry-e9929b03.js → nylas-scheduling.entry-6fb094a8.js} +295 -295
- package/dist/{person-icon.entry-d2856f08.js → person-icon.entry-6232e6fd.js} +7 -7
- package/dist/{person-icon.entry-8998fdb8.cjs → person-icon.entry-beb26b48.cjs} +1 -1
- package/dist/play-icon.entry-16a1c1ac.js +16 -0
- package/dist/{play-icon.entry-99eb969b.cjs → play-icon.entry-9060d0d8.cjs} +1 -1
- package/dist/{radio-button-group.entry-bc3b12fd.js → radio-button-group.entry-5a3728cd.js} +2 -2
- package/dist/{radio-button-group.entry-d66edd04.cjs → radio-button-group.entry-6935c39d.cjs} +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +135 -126
- package/dist/{refresh-icon.entry-99d1982d.cjs → refresh-icon.entry-2411b2e1.cjs} +1 -1
- package/dist/{refresh-icon.entry-d6df8b1c.js → refresh-icon.entry-4f56e72b.js} +2 -2
- package/dist/{register-component-62d792d4-448b6a43.js → register-component-a1c3d7b4-774feacc.js} +1 -1
- package/dist/{register-component-62d792d4-c6e7d129.cjs → register-component-a1c3d7b4-97d7a6f5.cjs} +1 -1
- package/dist/{reply-all-icon.entry-d7c44139.cjs → reply-all-icon.entry-b4b6926b.cjs} +1 -1
- package/dist/{reply-all-icon.entry-7ebf01a0.js → reply-all-icon.entry-b4b917ec.js} +2 -2
- package/dist/{reply-icon.entry-d1622d85.js → reply-icon.entry-24f6f4c6.js} +5 -5
- package/dist/{reply-icon.entry-058c00e8.cjs → reply-icon.entry-454545ed.cjs} +1 -1
- package/dist/sent-icon.entry-d9a79336.cjs +1 -0
- package/dist/sent-icon.entry-fa59ce85.js +16 -0
- package/dist/spam-icon.entry-da39987e.cjs +1 -0
- package/dist/spam-icon.entry-fb18a08b.js +16 -0
- package/dist/{star-icon.entry-98b80645.js → star-icon.entry-406472c1.js} +4 -4
- package/dist/{star-icon.entry-4db13fdb.cjs → star-icon.entry-833f35a7.cjs} +1 -1
- package/dist/{stop-icon.entry-0290fd30.js → stop-icon.entry-1b6ae838.js} +2 -2
- package/dist/{stop-icon.entry-9d7b53fd.cjs → stop-icon.entry-3258db59.cjs} +1 -1
- package/dist/style.css +1 -0
- package/dist/test/vitest.setup.d.ts +0 -0
- package/dist/{textarea-component.entry-9b474ab5.cjs → textarea-component.entry-0ae18897.cjs} +1 -1
- package/dist/{textarea-component.entry-a62c257b.js → textarea-component.entry-569a281e.js} +2 -2
- package/dist/{toggle-switch.entry-5dbfcd48.cjs → toggle-switch.entry-60d75f16.cjs} +1 -1
- package/dist/{toggle-switch.entry-e423b793.js → toggle-switch.entry-dc3f796b.js} +4 -4
- package/dist/{translate-icon.entry-60c55a2e.js → translate-icon.entry-297cf20f.js} +4 -4
- package/dist/{translate-icon.entry-f82fa6fc.cjs → translate-icon.entry-c183ecb5.cjs} +1 -1
- package/dist/trash-fill-icon.entry-3d8a2e5e.js +16 -0
- package/dist/trash-fill-icon.entry-94d4f66c.cjs +1 -0
- package/dist/{underline-icon.entry-40028bc6.js → underline-icon.entry-4a9105c7.js} +2 -2
- package/dist/{underline-icon.entry-0807a43d.cjs → underline-icon.entry-50d1e766.cjs} +1 -1
- package/package.json +41 -17
- package/dist/add-circle-icon_2.entry-8a1c55bc.cjs +0 -1
- package/dist/add-circle-icon_2.entry-b4bbcfee.js +0 -26
- package/dist/archive-icon.entry-a2492cf3.js +0 -16
- package/dist/archive-icon.entry-e48d2356.cjs +0 -1
- package/dist/arrow-icon.entry-b1ecb2aa.cjs +0 -1
- package/dist/calendar-agenda-fill-icon_36.entry-e9b92e0e.cjs +0 -6
- package/dist/checkbox-component.entry-1aa5782f.cjs +0 -1
- package/dist/checkbox-component.entry-72a6aa72.js +0 -43
- package/dist/document-refresh-icon.entry-e500b4e3.js +0 -16
- package/dist/google-logo-icon_6.entry-fa76ffe3.cjs +0 -2
- package/dist/inbox-icon.entry-9a4628f2.cjs +0 -1
- package/dist/inbox-icon.entry-aa78ba8c.js +0 -16
- package/dist/index-1e75512f.cjs +0 -57
- package/dist/index-e8380973.js +0 -18492
- package/dist/index.es-fc8588de-034ead51.cjs +0 -7
- package/dist/index.es-fc8588de-c943eef6.js +0 -2908
- package/dist/italic-icon.entry-0e85d0d9.js +0 -16
- package/dist/multi-select-dropdown_2.entry-3eecf18a.js +0 -193
- package/dist/multi-select-dropdown_2.entry-e37c501d.cjs +0 -1
- package/dist/nylas-booked-event-card_12.entry-fddc9ab8.cjs +0 -1
- package/dist/nylas-event-calendar_3.entry-e6669bbf.cjs +0 -11
- package/dist/nylas-scheduler-editor.entry-5c92901a.cjs +0 -2
- package/dist/nylas-scheduling.entry-970240f6.cjs +0 -1
- package/dist/play-icon.entry-f949a80f.js +0 -16
- package/dist/sent-icon.entry-6c604512.cjs +0 -1
- package/dist/sent-icon.entry-fe12bc2f.js +0 -16
- package/dist/spam-icon.entry-45e5292e.cjs +0 -1
- package/dist/spam-icon.entry-b97c7709.js +0 -16
- package/dist/trash-fill-icon.entry-095caae3.cjs +0 -1
- package/dist/trash-fill-icon.entry-825055fd.js +0 -16
- package/dist/warning-icon.entry-24e37759.js +0 -16
- package/dist/warning-icon.entry-fce7c14f.cjs +0 -1
- /package/dist/{elements → lib/elements}/react-component-lib/createComponent.d.ts +0 -0
- /package/dist/{elements → lib/elements}/react-component-lib/createOverlayComponent.d.ts +0 -0
- /package/dist/{elements → lib/elements}/react-component-lib/index.d.ts +0 -0
- /package/dist/{elements → lib/elements}/react-component-lib/interfaces.d.ts +0 -0
- /package/dist/{elements → lib/elements}/react-component-lib/utils/attachProps.d.ts +0 -0
- /package/dist/{elements → lib/elements}/react-component-lib/utils/case.d.ts +0 -0
- /package/dist/{elements → lib/elements}/react-component-lib/utils/dev.d.ts +0 -0
- /package/dist/{elements → lib/elements}/react-component-lib/utils/index.d.ts +0 -0
|
@@ -1,2908 +0,0 @@
|
|
|
1
|
-
import { n as er, b as T, o as tr, q as bt } from "./index-e8380973.js";
|
|
2
|
-
class nr {
|
|
3
|
-
constructor(e, n, r = !0, s) {
|
|
4
|
-
this.automaticComponentRegistration = !0, this.registeredComponents = {}, this.propStateRegistrations = /* @__PURE__ */ new Map(), this.eventListenerRegistrations = /* @__PURE__ */ new Map(), this.host = e, this.stores = n, this.automaticComponentRegistration = r, this.eventOverrides = s, T(`[${this.hostTagName}] Initializing (abstract) provider.`, { eventOverrides: s }), this.registerComponent = this.registerComponent.bind(this), this.getStore = this.getStore.bind(this), Object.keys(this.stores).forEach((i) => {
|
|
5
|
-
this.propStateRegistrations.set(i, /* @__PURE__ */ new Map());
|
|
6
|
-
});
|
|
7
|
-
}
|
|
8
|
-
async componentWillLoad(e) {
|
|
9
|
-
T(`[${this.hostTagName}] Will load`), this.setupStoreListeners(), this.nylasConnector = e;
|
|
10
|
-
const n = Array.from(this.host.querySelectorAll("*")).filter((s) => s.tagName.toLowerCase().startsWith("nylas-"));
|
|
11
|
-
T(`[${this.hostTagName}] Found ${n.length} child component(s).`, { childComponents: n });
|
|
12
|
-
const r = n.map(async (s) => {
|
|
13
|
-
const i = s;
|
|
14
|
-
if (!i) {
|
|
15
|
-
T(`[~${this.hostTagName}] (componentWillLoad) Component ${i.tagName} does not have a name. Skipping.`);
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
if (!i.registerNylasComponent) {
|
|
19
|
-
T(`[~${this.hostTagName}] (componentWillLoad) Component ${i.tagName} is not a component that can be registered. Skipping.`, { component: i });
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const o = {
|
|
23
|
-
element: i,
|
|
24
|
-
name: i.tagName.toLowerCase(),
|
|
25
|
-
getStoresToProp: i.getStoresToProp,
|
|
26
|
-
storeToProps: i.storeToProps,
|
|
27
|
-
stateToProps: i.stateToProps,
|
|
28
|
-
authToProp: i.authToProp,
|
|
29
|
-
eventToProps: i.eventToProps,
|
|
30
|
-
connectorToProp: i.connectorToProp,
|
|
31
|
-
localPropsToProp: i.localPropsToProp
|
|
32
|
-
};
|
|
33
|
-
await this.registerComponent(o);
|
|
34
|
-
});
|
|
35
|
-
await Promise.all(r);
|
|
36
|
-
}
|
|
37
|
-
async componentDidLoad() {
|
|
38
|
-
T(`[~${this.hostTagName}] (componentDidLoad) Did load`);
|
|
39
|
-
}
|
|
40
|
-
async componentDisconnected() {
|
|
41
|
-
Object.values(this.stores).forEach((e) => {
|
|
42
|
-
e.dispose();
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
async registerComponentHandler(e) {
|
|
46
|
-
if (e.stopPropagation(), !this.automaticComponentRegistration) {
|
|
47
|
-
T(`~[${this.hostTagName}] (registerComponentHandler) Automatic component registration disabled. Skipping registration of ${e.detail.name}.`);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
await this.registerComponent(e.detail);
|
|
51
|
-
}
|
|
52
|
-
async unregisterComponentHandler(e) {
|
|
53
|
-
if (e.stopPropagation(), !this.automaticComponentRegistration) {
|
|
54
|
-
T(`~[${this.hostTagName}] (unregisterComponentHandler) Automatic component registration disabled. Skipping unregistration of ${e.detail.name}.`);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
this.unregisterComponent(e.detail);
|
|
58
|
-
}
|
|
59
|
-
async registerComponent(e) {
|
|
60
|
-
T(`~[${this.hostTagName}] (registerComponent) Registering component ${e.name}.`);
|
|
61
|
-
const n = e.element.dataset.nylasId;
|
|
62
|
-
n && this.registeredComponents[n] ? (T(`[${this.hostTagName}] (registerComponent) Component ${e.name} already registered. Updating registration.`), this.cleanupComponentRegistration(n, !1)) : e.element.dataset.nylasId = n || tr();
|
|
63
|
-
const s = e.element.dataset.nylasId;
|
|
64
|
-
s && (this.registeredComponents[s] = e), T(`[${this.hostTagName}] (registerComponent) Waiting for "${e.element.localName}" component to be defined`, { component: e });
|
|
65
|
-
try {
|
|
66
|
-
await customElements.whenDefined(e.element.tagName.toLowerCase()), T(`[${this.hostTagName}] (registerComponent) Component "${e.element.localName}" is now defined`);
|
|
67
|
-
} catch (p) {
|
|
68
|
-
T(`[${this.hostTagName}] (registerComponent) Error waiting for component "${e.element.localName}" to be defined:`, p);
|
|
69
|
-
}
|
|
70
|
-
const i = this.eventOverrides, { stateToProps: o, getStoresToProp: u, eventToProps: a, storeToProps: c, connectorToProp: h, localPropsToProp: l, element: d } = e;
|
|
71
|
-
a == null || a.forEach((p, m) => {
|
|
72
|
-
var b;
|
|
73
|
-
const f = this.nylasConnector, v = async (w) => {
|
|
74
|
-
T(`[${this.hostTagName}] (registerComponent) Handling "${e.name}" prop "${String(m)}" event.`, { event: w }), m in i && (T(`[${this.hostTagName}] (registerComponent) Found event override for "${String(m)}" event. Calling override.`), await i[m](w, f)), w.defaultPrevented || await p(w, f);
|
|
75
|
-
}, y = e.element.dataset.nylasId;
|
|
76
|
-
y && !this.eventListenerRegistrations.has(y) && this.eventListenerRegistrations.set(y, []), y && ((b = this.eventListenerRegistrations.get(y)) == null || b.push([d, m, v])), T(`[${this.hostTagName}] (registerComponent) Setting "${e.name}" event "${String(m)}" to automcially call NylasConnector method.`);
|
|
77
|
-
const g = bt(m.toString());
|
|
78
|
-
T(`[${this.hostTagName}] (registerComponent) Adding event listener for "${g}" on "${d.tagName}"`), d.addEventListener(g, v);
|
|
79
|
-
}), o == null || o.forEach((p, m) => {
|
|
80
|
-
var b, w, C, k;
|
|
81
|
-
const [f, v] = m.split("."), g = this.getStore(f).state[v];
|
|
82
|
-
if (!d.dataset.nylasId) {
|
|
83
|
-
T(`[${this.hostTagName}] (registerComponent) Component "${e.name}" not registered. Skipping.`, { component: e });
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
this.propStateRegistrations.has(f) || this.propStateRegistrations.set(f, /* @__PURE__ */ new Map()), (b = this.propStateRegistrations.get(f)) != null && b.has(v) ? (k = (C = this.propStateRegistrations.get(f)) == null ? void 0 : C.get(v)) == null || k.push({
|
|
87
|
-
elementId: d.dataset.nylasId,
|
|
88
|
-
propKey: p
|
|
89
|
-
}) : (w = this.propStateRegistrations.get(f)) == null || w.set(v, [
|
|
90
|
-
{
|
|
91
|
-
elementId: d.dataset.nylasId,
|
|
92
|
-
propKey: p
|
|
93
|
-
}
|
|
94
|
-
]), d[p.toString()] = g, T(`[${this.hostTagName}] Setting "${e.name}" prop "${p.toString()}" to "${m}" value.`, { stateValue: g });
|
|
95
|
-
}), l == null || l.forEach((p, m) => {
|
|
96
|
-
const f = this.host[m];
|
|
97
|
-
d[p.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${p.toString()}" to the value of "${m}" value.`, { value: m, mappedPropValue: f });
|
|
98
|
-
}), u && (d[u == null ? void 0 : u.toString()] = this.getStore, T(`[${this.hostTagName}] Setting "${e.name}" prop "${u.toString()}" to "getStore" method.`)), c == null || c.forEach((p, m) => {
|
|
99
|
-
const f = this.getStore(m);
|
|
100
|
-
d[p.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${p.toString()}" to "${m}" store.`, { store: f });
|
|
101
|
-
}), h && (d[h == null ? void 0 : h.toString()] = this.nylasConnector, T(`[${this.hostTagName}] Setting "${e.name}" prop "${h.toString()}" to "nylasConnector" value.`, { connectorToProp: h })), typeof d.registerCallback == "function" && (T(`[${this.hostTagName}] (registerComponent) Calling registerCallback method for "${e.name}".`), await d.registerCallback()), T(`[${this.hostTagName}] (registerComponent) Component ${e.name} registered.`);
|
|
102
|
-
}
|
|
103
|
-
cleanupComponentRegistration(e, n = !0) {
|
|
104
|
-
const r = this.eventListenerRegistrations.get(e);
|
|
105
|
-
r && (r.forEach(([s, i, o]) => {
|
|
106
|
-
const u = bt(i.toString());
|
|
107
|
-
T(`[${this.hostTagName}] (cleanupComponentRegistration) Removing event listener for "${u}" on "${s.tagName}"`), s.removeEventListener(u, o);
|
|
108
|
-
}), this.eventListenerRegistrations.delete(e)), this.propStateRegistrations.forEach((s, i) => {
|
|
109
|
-
s.forEach((o, u) => {
|
|
110
|
-
var c;
|
|
111
|
-
const a = o.filter((h) => h.elementId !== e);
|
|
112
|
-
a.length !== o.length && ((c = this.propStateRegistrations.get(i)) == null || c.set(u, a));
|
|
113
|
-
});
|
|
114
|
-
}), n && delete this.registeredComponents[e];
|
|
115
|
-
}
|
|
116
|
-
unregisterComponent(e) {
|
|
117
|
-
T(`[${this.hostTagName}] Unregistering component ${e.name}.`);
|
|
118
|
-
const n = e.element.dataset.nylasId;
|
|
119
|
-
if (!n) {
|
|
120
|
-
T(`[${this.hostTagName}] (unregisterComponent) Unregistering component ${e.name}.`);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (this.registeredComponents[n]) {
|
|
124
|
-
T(`[${this.hostTagName}] (unregisterComponent) Component ${e.name} not registered. Skipping.`);
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
this.propStateRegistrations.forEach((s, i) => {
|
|
128
|
-
s.forEach((o, u) => {
|
|
129
|
-
var h, l;
|
|
130
|
-
const a = (h = this.propStateRegistrations.get(i)) == null ? void 0 : h.get(u), c = a == null ? void 0 : a.filter((d) => d.elementId !== n);
|
|
131
|
-
c && ((l = this.propStateRegistrations.get(i)) == null || l.set(u, c));
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
const r = this.eventListenerRegistrations.get(n);
|
|
135
|
-
r == null || r.forEach(([s, i, o]) => {
|
|
136
|
-
const u = bt(i.toString());
|
|
137
|
-
T(`[${this.hostTagName}] (unregisterComponent) Removing event listener for "${u}" on "${s.tagName}"`), s.removeEventListener(u, o);
|
|
138
|
-
}), delete this.registeredComponents[n];
|
|
139
|
-
}
|
|
140
|
-
getStore(e) {
|
|
141
|
-
const n = this.stores[e];
|
|
142
|
-
if (!n)
|
|
143
|
-
throw new Error(`[${this.hostTagName}] Store "${e.toString()}" not found.`);
|
|
144
|
-
return n;
|
|
145
|
-
}
|
|
146
|
-
async setupStoreListeners() {
|
|
147
|
-
const e = this;
|
|
148
|
-
Object.entries(this.stores).forEach(([n, r]) => {
|
|
149
|
-
T(`[${e.hostTagName}] (setupStoreListeners) Listening for changes in "${n}" store.`), r.use({
|
|
150
|
-
set(s, i, o) {
|
|
151
|
-
var c;
|
|
152
|
-
if (T(`[${e.hostTagName}] (setupStoreListeners) Store "${n}" state "${s.toString()}" changed`, { newValue: i, oldValue: o }), i === o) {
|
|
153
|
-
T(`[${e.hostTagName}] (setupStoreListeners) Store "${n}" state "${s.toString()}" unchanged. Skipping.`);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
const u = e.registeredComponents;
|
|
157
|
-
if (!u) {
|
|
158
|
-
T(`[${e.hostTagName}] (setupStoreListeners) No registered components found. Skipping.`);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const a = ((c = e.propStateRegistrations.get(n)) == null ? void 0 : c.get(s.toString())) || [];
|
|
162
|
-
T(`[${e.hostTagName}] (setupStoreListeners) Found ${a.length} prop(s) registered for "${s.toString()}" store.`, {
|
|
163
|
-
props: a,
|
|
164
|
-
propStateRegistrations: e.propStateRegistrations
|
|
165
|
-
}), a.forEach(({ elementId: h, propKey: l }) => {
|
|
166
|
-
const d = u[h];
|
|
167
|
-
if (!d) {
|
|
168
|
-
T(`[${e.hostTagName}] (setupStoreListeners) Component "${h}" not found. Skipping.`, { component: d });
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
const m = e.getStore(n).state[s];
|
|
172
|
-
d.element[l.toString()] = m, T(`[${e.hostTagName}] (setupStoreListeners) Setting "${d.name}" prop "${l.toString()}" to "${s.toString()}" value.`, { stateValue: m });
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
get hostTagName() {
|
|
179
|
-
var e, n;
|
|
180
|
-
return ((n = (e = this.host) == null ? void 0 : e.tagName) == null ? void 0 : n.toLowerCase()) ?? "nylas-provider";
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
class Xr extends nr {
|
|
184
|
-
}
|
|
185
|
-
var rr = /* @__PURE__ */ ((t) => (t.Error = "error", t.Warning = "warning", t.Info = "info", t.Success = "success", t))(rr || {});
|
|
186
|
-
const Qr = (t) => t !== null && typeof t == "object" && "error" in t, $ = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : er, I = Object.keys, M = Array.isArray;
|
|
187
|
-
function U(t, e) {
|
|
188
|
-
return typeof e != "object" || I(e).forEach(function(n) {
|
|
189
|
-
t[n] = e[n];
|
|
190
|
-
}), t;
|
|
191
|
-
}
|
|
192
|
-
typeof Promise > "u" || $.Promise || ($.Promise = Promise);
|
|
193
|
-
const Be = Object.getPrototypeOf, sr = {}.hasOwnProperty;
|
|
194
|
-
function z(t, e) {
|
|
195
|
-
return sr.call(t, e);
|
|
196
|
-
}
|
|
197
|
-
function Ce(t, e) {
|
|
198
|
-
typeof e == "function" && (e = e(Be(t))), (typeof Reflect > "u" ? I : Reflect.ownKeys)(e).forEach((n) => {
|
|
199
|
-
ee(t, n, e[n]);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
const xn = Object.defineProperty;
|
|
203
|
-
function ee(t, e, n, r) {
|
|
204
|
-
xn(t, e, U(n && z(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
|
|
205
|
-
}
|
|
206
|
-
function _e(t) {
|
|
207
|
-
return { from: function(e) {
|
|
208
|
-
return t.prototype = Object.create(e.prototype), ee(t.prototype, "constructor", t), { extend: Ce.bind(null, t.prototype) };
|
|
209
|
-
} };
|
|
210
|
-
}
|
|
211
|
-
const ir = Object.getOwnPropertyDescriptor;
|
|
212
|
-
function Jt(t, e) {
|
|
213
|
-
let n;
|
|
214
|
-
return ir(t, e) || (n = Be(t)) && Jt(n, e);
|
|
215
|
-
}
|
|
216
|
-
const or = [].slice;
|
|
217
|
-
function ut(t, e, n) {
|
|
218
|
-
return or.call(t, e, n);
|
|
219
|
-
}
|
|
220
|
-
function Sn(t, e) {
|
|
221
|
-
return e(t);
|
|
222
|
-
}
|
|
223
|
-
function Ke(t) {
|
|
224
|
-
if (!t)
|
|
225
|
-
throw new Error("Assertion Failed");
|
|
226
|
-
}
|
|
227
|
-
function Cn(t) {
|
|
228
|
-
$.setImmediate ? setImmediate(t) : setTimeout(t, 0);
|
|
229
|
-
}
|
|
230
|
-
function En(t, e) {
|
|
231
|
-
return t.reduce((n, r, s) => {
|
|
232
|
-
var i = e(r, s);
|
|
233
|
-
return i && (n[i[0]] = i[1]), n;
|
|
234
|
-
}, {});
|
|
235
|
-
}
|
|
236
|
-
function te(t, e) {
|
|
237
|
-
if (z(t, e))
|
|
238
|
-
return t[e];
|
|
239
|
-
if (!e)
|
|
240
|
-
return t;
|
|
241
|
-
if (typeof e != "string") {
|
|
242
|
-
for (var n = [], r = 0, s = e.length; r < s; ++r) {
|
|
243
|
-
var i = te(t, e[r]);
|
|
244
|
-
n.push(i);
|
|
245
|
-
}
|
|
246
|
-
return n;
|
|
247
|
-
}
|
|
248
|
-
var o = e.indexOf(".");
|
|
249
|
-
if (o !== -1) {
|
|
250
|
-
var u = t[e.substr(0, o)];
|
|
251
|
-
return u === void 0 ? void 0 : te(u, e.substr(o + 1));
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
function Y(t, e, n) {
|
|
255
|
-
if (t && e !== void 0 && (!("isFrozen" in Object) || !Object.isFrozen(t)))
|
|
256
|
-
if (typeof e != "string" && "length" in e) {
|
|
257
|
-
Ke(typeof n != "string" && "length" in n);
|
|
258
|
-
for (var r = 0, s = e.length; r < s; ++r)
|
|
259
|
-
Y(t, e[r], n[r]);
|
|
260
|
-
} else {
|
|
261
|
-
var i = e.indexOf(".");
|
|
262
|
-
if (i !== -1) {
|
|
263
|
-
var o = e.substr(0, i), u = e.substr(i + 1);
|
|
264
|
-
if (u === "")
|
|
265
|
-
n === void 0 ? M(t) && !isNaN(parseInt(o)) ? t.splice(o, 1) : delete t[o] : t[o] = n;
|
|
266
|
-
else {
|
|
267
|
-
var a = t[o];
|
|
268
|
-
a && z(t, o) || (a = t[o] = {}), Y(a, u, n);
|
|
269
|
-
}
|
|
270
|
-
} else
|
|
271
|
-
n === void 0 ? M(t) && !isNaN(parseInt(e)) ? t.splice(e, 1) : delete t[e] : t[e] = n;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
function Pn(t) {
|
|
275
|
-
var e = {};
|
|
276
|
-
for (var n in t)
|
|
277
|
-
z(t, n) && (e[n] = t[n]);
|
|
278
|
-
return e;
|
|
279
|
-
}
|
|
280
|
-
const ar = [].concat;
|
|
281
|
-
function Tn(t) {
|
|
282
|
-
return ar.apply([], t);
|
|
283
|
-
}
|
|
284
|
-
const On = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Tn([8, 16, 32, 64].map((t) => ["Int", "Uint", "Float"].map((e) => e + t + "Array")))).filter((t) => $[t]), ur = On.map((t) => $[t]);
|
|
285
|
-
En(On, (t) => [t, !0]);
|
|
286
|
-
let se = null;
|
|
287
|
-
function Ve(t) {
|
|
288
|
-
se = typeof WeakMap < "u" && /* @__PURE__ */ new WeakMap();
|
|
289
|
-
const e = Pt(t);
|
|
290
|
-
return se = null, e;
|
|
291
|
-
}
|
|
292
|
-
function Pt(t) {
|
|
293
|
-
if (!t || typeof t != "object")
|
|
294
|
-
return t;
|
|
295
|
-
let e = se && se.get(t);
|
|
296
|
-
if (e)
|
|
297
|
-
return e;
|
|
298
|
-
if (M(t)) {
|
|
299
|
-
e = [], se && se.set(t, e);
|
|
300
|
-
for (var n = 0, r = t.length; n < r; ++n)
|
|
301
|
-
e.push(Pt(t[n]));
|
|
302
|
-
} else if (ur.indexOf(t.constructor) >= 0)
|
|
303
|
-
e = t;
|
|
304
|
-
else {
|
|
305
|
-
const i = Be(t);
|
|
306
|
-
for (var s in e = i === Object.prototype ? {} : Object.create(i), se && se.set(t, e), t)
|
|
307
|
-
z(t, s) && (e[s] = Pt(t[s]));
|
|
308
|
-
}
|
|
309
|
-
return e;
|
|
310
|
-
}
|
|
311
|
-
const { toString: lr } = {};
|
|
312
|
-
function Tt(t) {
|
|
313
|
-
return lr.call(t).slice(8, -1);
|
|
314
|
-
}
|
|
315
|
-
const Ot = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", cr = typeof Ot == "symbol" ? function(t) {
|
|
316
|
-
var e;
|
|
317
|
-
return t != null && (e = t[Ot]) && e.apply(t);
|
|
318
|
-
} : function() {
|
|
319
|
-
return null;
|
|
320
|
-
}, we = {};
|
|
321
|
-
function J(t) {
|
|
322
|
-
var e, n, r, s;
|
|
323
|
-
if (arguments.length === 1) {
|
|
324
|
-
if (M(t))
|
|
325
|
-
return t.slice();
|
|
326
|
-
if (this === we && typeof t == "string")
|
|
327
|
-
return [t];
|
|
328
|
-
if (s = cr(t)) {
|
|
329
|
-
for (n = []; !(r = s.next()).done; )
|
|
330
|
-
n.push(r.value);
|
|
331
|
-
return n;
|
|
332
|
-
}
|
|
333
|
-
if (t == null)
|
|
334
|
-
return [t];
|
|
335
|
-
if (typeof (e = t.length) == "number") {
|
|
336
|
-
for (n = new Array(e); e--; )
|
|
337
|
-
n[e] = t[e];
|
|
338
|
-
return n;
|
|
339
|
-
}
|
|
340
|
-
return [t];
|
|
341
|
-
}
|
|
342
|
-
for (e = arguments.length, n = new Array(e); e--; )
|
|
343
|
-
n[e] = arguments[e];
|
|
344
|
-
return n;
|
|
345
|
-
}
|
|
346
|
-
const Zt = typeof Symbol < "u" ? (t) => t[Symbol.toStringTag] === "AsyncFunction" : () => !1;
|
|
347
|
-
var G = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
348
|
-
function An(t, e) {
|
|
349
|
-
G = t, Kn = e;
|
|
350
|
-
}
|
|
351
|
-
var Kn = () => !0;
|
|
352
|
-
const hr = !new Error("").stack;
|
|
353
|
-
function Ee() {
|
|
354
|
-
if (hr)
|
|
355
|
-
try {
|
|
356
|
-
throw new Error();
|
|
357
|
-
} catch (t) {
|
|
358
|
-
return t;
|
|
359
|
-
}
|
|
360
|
-
return new Error();
|
|
361
|
-
}
|
|
362
|
-
function At(t, e) {
|
|
363
|
-
var n = t.stack;
|
|
364
|
-
return n ? (e = e || 0, n.indexOf(t.name) === 0 && (e += (t.name + t.message).split(`
|
|
365
|
-
`).length), n.split(`
|
|
366
|
-
`).slice(e).filter(Kn).map((r) => `
|
|
367
|
-
` + r).join("")) : "";
|
|
368
|
-
}
|
|
369
|
-
var $n = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], en = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat($n), dr = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
|
|
370
|
-
function ke(t, e) {
|
|
371
|
-
this._e = Ee(), this.name = t, this.message = e;
|
|
372
|
-
}
|
|
373
|
-
function Nn(t, e) {
|
|
374
|
-
return t + ". Errors: " + Object.keys(e).map((n) => e[n].toString()).filter((n, r, s) => s.indexOf(n) === r).join(`
|
|
375
|
-
`);
|
|
376
|
-
}
|
|
377
|
-
function lt(t, e, n, r) {
|
|
378
|
-
this._e = Ee(), this.failures = e, this.failedKeys = r, this.successCount = n, this.message = Nn(t, e);
|
|
379
|
-
}
|
|
380
|
-
function Ne(t, e) {
|
|
381
|
-
this._e = Ee(), this.name = "BulkError", this.failures = Object.keys(e).map((n) => e[n]), this.failuresByPos = e, this.message = Nn(t, e);
|
|
382
|
-
}
|
|
383
|
-
_e(ke).from(Error).extend({ stack: { get: function() {
|
|
384
|
-
return this._stack || (this._stack = this.name + ": " + this.message + At(this._e, 2));
|
|
385
|
-
} }, toString: function() {
|
|
386
|
-
return this.name + ": " + this.message;
|
|
387
|
-
} }), _e(lt).from(ke), _e(Ne).from(ke);
|
|
388
|
-
var tn = en.reduce((t, e) => (t[e] = e + "Error", t), {});
|
|
389
|
-
const fr = ke;
|
|
390
|
-
var P = en.reduce((t, e) => {
|
|
391
|
-
var n = e + "Error";
|
|
392
|
-
function r(s, i) {
|
|
393
|
-
this._e = Ee(), this.name = n, s ? typeof s == "string" ? (this.message = `${s}${i ? `
|
|
394
|
-
` + i : ""}`, this.inner = i || null) : typeof s == "object" && (this.message = `${s.name} ${s.message}`, this.inner = s) : (this.message = dr[e] || n, this.inner = null);
|
|
395
|
-
}
|
|
396
|
-
return _e(r).from(fr), t[e] = r, t;
|
|
397
|
-
}, {});
|
|
398
|
-
P.Syntax = SyntaxError, P.Type = TypeError, P.Range = RangeError;
|
|
399
|
-
var hn = $n.reduce((t, e) => (t[e + "Error"] = P[e], t), {}), tt = en.reduce((t, e) => (["Syntax", "Type", "Range"].indexOf(e) === -1 && (t[e + "Error"] = P[e]), t), {});
|
|
400
|
-
function K() {
|
|
401
|
-
}
|
|
402
|
-
function Fe(t) {
|
|
403
|
-
return t;
|
|
404
|
-
}
|
|
405
|
-
function pr(t, e) {
|
|
406
|
-
return t == null || t === Fe ? e : function(n) {
|
|
407
|
-
return e(t(n));
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
function pe(t, e) {
|
|
411
|
-
return function() {
|
|
412
|
-
t.apply(this, arguments), e.apply(this, arguments);
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
function mr(t, e) {
|
|
416
|
-
return t === K ? e : function() {
|
|
417
|
-
var n = t.apply(this, arguments);
|
|
418
|
-
n !== void 0 && (arguments[0] = n);
|
|
419
|
-
var r = this.onsuccess, s = this.onerror;
|
|
420
|
-
this.onsuccess = null, this.onerror = null;
|
|
421
|
-
var i = e.apply(this, arguments);
|
|
422
|
-
return r && (this.onsuccess = this.onsuccess ? pe(r, this.onsuccess) : r), s && (this.onerror = this.onerror ? pe(s, this.onerror) : s), i !== void 0 ? i : n;
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
function gr(t, e) {
|
|
426
|
-
return t === K ? e : function() {
|
|
427
|
-
t.apply(this, arguments);
|
|
428
|
-
var n = this.onsuccess, r = this.onerror;
|
|
429
|
-
this.onsuccess = this.onerror = null, e.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? pe(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? pe(r, this.onerror) : r);
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
function yr(t, e) {
|
|
433
|
-
return t === K ? e : function(n) {
|
|
434
|
-
var r = t.apply(this, arguments);
|
|
435
|
-
U(n, r);
|
|
436
|
-
var s = this.onsuccess, i = this.onerror;
|
|
437
|
-
this.onsuccess = null, this.onerror = null;
|
|
438
|
-
var o = e.apply(this, arguments);
|
|
439
|
-
return s && (this.onsuccess = this.onsuccess ? pe(s, this.onsuccess) : s), i && (this.onerror = this.onerror ? pe(i, this.onerror) : i), r === void 0 ? o === void 0 ? void 0 : o : U(r, o);
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
function vr(t, e) {
|
|
443
|
-
return t === K ? e : function() {
|
|
444
|
-
return e.apply(this, arguments) !== !1 && t.apply(this, arguments);
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
function nn(t, e) {
|
|
448
|
-
return t === K ? e : function() {
|
|
449
|
-
var n = t.apply(this, arguments);
|
|
450
|
-
if (n && typeof n.then == "function") {
|
|
451
|
-
for (var r = this, s = arguments.length, i = new Array(s); s--; )
|
|
452
|
-
i[s] = arguments[s];
|
|
453
|
-
return n.then(function() {
|
|
454
|
-
return e.apply(r, i);
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
return e.apply(this, arguments);
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
tt.ModifyError = lt, tt.DexieError = ke, tt.BulkError = Ne;
|
|
461
|
-
var Me = {};
|
|
462
|
-
const Rn = 100, [Kt, ct, $t] = typeof Promise > "u" ? [] : (() => {
|
|
463
|
-
let t = Promise.resolve();
|
|
464
|
-
if (typeof crypto > "u" || !crypto.subtle)
|
|
465
|
-
return [t, Be(t), t];
|
|
466
|
-
const e = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
467
|
-
return [e, Be(e), t];
|
|
468
|
-
})(), jn = ct && ct.then, nt = Kt && Kt.constructor, rn = !!$t;
|
|
469
|
-
var Nt = !1, br = $t ? () => {
|
|
470
|
-
$t.then(He);
|
|
471
|
-
} : $.setImmediate ? setImmediate.bind(null, He) : $.MutationObserver ? () => {
|
|
472
|
-
var t = document.createElement("div");
|
|
473
|
-
new MutationObserver(() => {
|
|
474
|
-
He(), t = null;
|
|
475
|
-
}).observe(t, { attributes: !0 }), t.setAttribute("i", "1");
|
|
476
|
-
} : () => {
|
|
477
|
-
setTimeout(He, 0);
|
|
478
|
-
}, Re = function(t, e) {
|
|
479
|
-
$e.push([t, e]), ht && (br(), ht = !1);
|
|
480
|
-
}, Rt = !0, ht = !0, de = [], rt = [], jt = null, It = Fe, xe = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: pn, pgp: !1, env: {}, finalize: function() {
|
|
481
|
-
this.unhandleds.forEach((t) => {
|
|
482
|
-
try {
|
|
483
|
-
pn(t[0], t[1]);
|
|
484
|
-
} catch {
|
|
485
|
-
}
|
|
486
|
-
});
|
|
487
|
-
} }, E = xe, $e = [], fe = 0, st = [];
|
|
488
|
-
function S(t) {
|
|
489
|
-
if (typeof this != "object")
|
|
490
|
-
throw new TypeError("Promises must be constructed via new");
|
|
491
|
-
this._listeners = [], this.onuncatched = K, this._lib = !1;
|
|
492
|
-
var e = this._PSD = E;
|
|
493
|
-
if (G && (this._stackHolder = Ee(), this._prev = null, this._numPrev = 0), typeof t != "function") {
|
|
494
|
-
if (t !== Me)
|
|
495
|
-
throw new TypeError("Not a function");
|
|
496
|
-
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Bt(this, this._value));
|
|
497
|
-
}
|
|
498
|
-
this._state = null, this._value = null, ++e.ref, Dn(this, t);
|
|
499
|
-
}
|
|
500
|
-
const Dt = { get: function() {
|
|
501
|
-
var t = E, e = dt;
|
|
502
|
-
function n(r, s) {
|
|
503
|
-
var i = !t.global && (t !== E || e !== dt);
|
|
504
|
-
const o = i && !ne();
|
|
505
|
-
var u = new S((a, c) => {
|
|
506
|
-
sn(this, new In(ft(r, t, i, o), ft(s, t, i, o), a, c, t));
|
|
507
|
-
});
|
|
508
|
-
return G && Mn(u, this), u;
|
|
509
|
-
}
|
|
510
|
-
return n.prototype = Me, n;
|
|
511
|
-
}, set: function(t) {
|
|
512
|
-
ee(this, "then", t && t.prototype === Me ? Dt : { get: function() {
|
|
513
|
-
return t;
|
|
514
|
-
}, set: Dt.set });
|
|
515
|
-
} };
|
|
516
|
-
function In(t, e, n, r, s) {
|
|
517
|
-
this.onFulfilled = typeof t == "function" ? t : null, this.onRejected = typeof e == "function" ? e : null, this.resolve = n, this.reject = r, this.psd = s;
|
|
518
|
-
}
|
|
519
|
-
function Dn(t, e) {
|
|
520
|
-
try {
|
|
521
|
-
e((n) => {
|
|
522
|
-
if (t._state === null) {
|
|
523
|
-
if (n === t)
|
|
524
|
-
throw new TypeError("A promise cannot be resolved with itself.");
|
|
525
|
-
var r = t._lib && ze();
|
|
526
|
-
n && typeof n.then == "function" ? Dn(t, (s, i) => {
|
|
527
|
-
n instanceof S ? n._then(s, i) : n.then(s, i);
|
|
528
|
-
}) : (t._state = !0, t._value = n, Bn(t)), r && Ye();
|
|
529
|
-
}
|
|
530
|
-
}, Bt.bind(null, t));
|
|
531
|
-
} catch (n) {
|
|
532
|
-
Bt(t, n);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
function Bt(t, e) {
|
|
536
|
-
if (rt.push(e), t._state === null) {
|
|
537
|
-
var n = t._lib && ze();
|
|
538
|
-
e = It(e), t._state = !1, t._value = e, G && e !== null && typeof e == "object" && !e._promise && function(r, s, i) {
|
|
539
|
-
try {
|
|
540
|
-
r.apply(null, i);
|
|
541
|
-
} catch (o) {
|
|
542
|
-
s && s(o);
|
|
543
|
-
}
|
|
544
|
-
}(() => {
|
|
545
|
-
var r = Jt(e, "stack");
|
|
546
|
-
e._promise = t, ee(e, "stack", { get: () => Nt ? r && (r.get ? r.get.apply(e) : r.value) : t.stack });
|
|
547
|
-
}), function(r) {
|
|
548
|
-
de.some((s) => s._value === r._value) || de.push(r);
|
|
549
|
-
}(t), Bn(t), n && Ye();
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
function Bn(t) {
|
|
553
|
-
var e = t._listeners;
|
|
554
|
-
t._listeners = [];
|
|
555
|
-
for (var n = 0, r = e.length; n < r; ++n)
|
|
556
|
-
sn(t, e[n]);
|
|
557
|
-
var s = t._PSD;
|
|
558
|
-
--s.ref || s.finalize(), fe === 0 && (++fe, Re(() => {
|
|
559
|
-
--fe == 0 && on();
|
|
560
|
-
}, []));
|
|
561
|
-
}
|
|
562
|
-
function sn(t, e) {
|
|
563
|
-
if (t._state !== null) {
|
|
564
|
-
var n = t._state ? e.onFulfilled : e.onRejected;
|
|
565
|
-
if (n === null)
|
|
566
|
-
return (t._state ? e.resolve : e.reject)(t._value);
|
|
567
|
-
++e.psd.ref, ++fe, Re(wr, [n, t, e]);
|
|
568
|
-
} else
|
|
569
|
-
t._listeners.push(e);
|
|
570
|
-
}
|
|
571
|
-
function wr(t, e, n) {
|
|
572
|
-
try {
|
|
573
|
-
jt = e;
|
|
574
|
-
var r, s = e._value;
|
|
575
|
-
e._state ? r = t(s) : (rt.length && (rt = []), r = t(s), rt.indexOf(s) === -1 && function(i) {
|
|
576
|
-
for (var o = de.length; o; )
|
|
577
|
-
if (de[--o]._value === i._value)
|
|
578
|
-
return void de.splice(o, 1);
|
|
579
|
-
}(e)), n.resolve(r);
|
|
580
|
-
} catch (i) {
|
|
581
|
-
n.reject(i);
|
|
582
|
-
} finally {
|
|
583
|
-
jt = null, --fe == 0 && on(), --n.psd.ref || n.psd.finalize();
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
function Fn(t, e, n) {
|
|
587
|
-
if (e.length === n)
|
|
588
|
-
return e;
|
|
589
|
-
var r = "";
|
|
590
|
-
if (t._state === !1) {
|
|
591
|
-
var s, i, o = t._value;
|
|
592
|
-
o != null ? (s = o.name || "Error", i = o.message || o, r = At(o, 0)) : (s = o, i = ""), e.push(s + (i ? ": " + i : "") + r);
|
|
593
|
-
}
|
|
594
|
-
return G && ((r = At(t._stackHolder, 2)) && e.indexOf(r) === -1 && e.push(r), t._prev && Fn(t._prev, e, n)), e;
|
|
595
|
-
}
|
|
596
|
-
function Mn(t, e) {
|
|
597
|
-
var n = e ? e._numPrev + 1 : 0;
|
|
598
|
-
n < 100 && (t._prev = e, t._numPrev = n);
|
|
599
|
-
}
|
|
600
|
-
function He() {
|
|
601
|
-
ze() && Ye();
|
|
602
|
-
}
|
|
603
|
-
function ze() {
|
|
604
|
-
var t = Rt;
|
|
605
|
-
return Rt = !1, ht = !1, t;
|
|
606
|
-
}
|
|
607
|
-
function Ye() {
|
|
608
|
-
var t, e, n;
|
|
609
|
-
do
|
|
610
|
-
for (; $e.length > 0; )
|
|
611
|
-
for (t = $e, $e = [], n = t.length, e = 0; e < n; ++e) {
|
|
612
|
-
var r = t[e];
|
|
613
|
-
r[0].apply(null, r[1]);
|
|
614
|
-
}
|
|
615
|
-
while ($e.length > 0);
|
|
616
|
-
Rt = !0, ht = !0;
|
|
617
|
-
}
|
|
618
|
-
function on() {
|
|
619
|
-
var t = de;
|
|
620
|
-
de = [], t.forEach((r) => {
|
|
621
|
-
r._PSD.onunhandled.call(null, r._value, r);
|
|
622
|
-
});
|
|
623
|
-
for (var e = st.slice(0), n = e.length; n; )
|
|
624
|
-
e[--n]();
|
|
625
|
-
}
|
|
626
|
-
function Ge(t) {
|
|
627
|
-
return new S(Me, !1, t);
|
|
628
|
-
}
|
|
629
|
-
function N(t, e) {
|
|
630
|
-
var n = E;
|
|
631
|
-
return function() {
|
|
632
|
-
var r = ze(), s = E;
|
|
633
|
-
try {
|
|
634
|
-
return ae(n, !0), t.apply(this, arguments);
|
|
635
|
-
} catch (i) {
|
|
636
|
-
e && e(i);
|
|
637
|
-
} finally {
|
|
638
|
-
ae(s, !1), r && Ye();
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
|
-
}
|
|
642
|
-
Ce(S.prototype, { then: Dt, _then: function(t, e) {
|
|
643
|
-
sn(this, new In(null, null, t, e, E));
|
|
644
|
-
}, catch: function(t) {
|
|
645
|
-
if (arguments.length === 1)
|
|
646
|
-
return this.then(null, t);
|
|
647
|
-
var e = arguments[0], n = arguments[1];
|
|
648
|
-
return typeof e == "function" ? this.then(null, (r) => r instanceof e ? n(r) : Ge(r)) : this.then(null, (r) => r && r.name === e ? n(r) : Ge(r));
|
|
649
|
-
}, finally: function(t) {
|
|
650
|
-
return this.then((e) => (t(), e), (e) => (t(), Ge(e)));
|
|
651
|
-
}, stack: { get: function() {
|
|
652
|
-
if (this._stack)
|
|
653
|
-
return this._stack;
|
|
654
|
-
try {
|
|
655
|
-
Nt = !0;
|
|
656
|
-
var t = Fn(this, [], 20).join(`
|
|
657
|
-
From previous: `);
|
|
658
|
-
return this._state !== null && (this._stack = t), t;
|
|
659
|
-
} finally {
|
|
660
|
-
Nt = !1;
|
|
661
|
-
}
|
|
662
|
-
} }, timeout: function(t, e) {
|
|
663
|
-
return t < 1 / 0 ? new S((n, r) => {
|
|
664
|
-
var s = setTimeout(() => r(new P.Timeout(e)), t);
|
|
665
|
-
this.then(n, r).finally(clearTimeout.bind(null, s));
|
|
666
|
-
}) : this;
|
|
667
|
-
} }), typeof Symbol < "u" && Symbol.toStringTag && ee(S.prototype, Symbol.toStringTag, "Dexie.Promise"), xe.env = qn(), Ce(S, { all: function() {
|
|
668
|
-
var t = J.apply(null, arguments).map(Xe);
|
|
669
|
-
return new S(function(e, n) {
|
|
670
|
-
t.length === 0 && e([]);
|
|
671
|
-
var r = t.length;
|
|
672
|
-
t.forEach((s, i) => S.resolve(s).then((o) => {
|
|
673
|
-
t[i] = o, --r || e(t);
|
|
674
|
-
}, n));
|
|
675
|
-
});
|
|
676
|
-
}, resolve: (t) => {
|
|
677
|
-
if (t instanceof S)
|
|
678
|
-
return t;
|
|
679
|
-
if (t && typeof t.then == "function")
|
|
680
|
-
return new S((n, r) => {
|
|
681
|
-
t.then(n, r);
|
|
682
|
-
});
|
|
683
|
-
var e = new S(Me, !0, t);
|
|
684
|
-
return Mn(e, jt), e;
|
|
685
|
-
}, reject: Ge, race: function() {
|
|
686
|
-
var t = J.apply(null, arguments).map(Xe);
|
|
687
|
-
return new S((e, n) => {
|
|
688
|
-
t.map((r) => S.resolve(r).then(e, n));
|
|
689
|
-
});
|
|
690
|
-
}, PSD: { get: () => E, set: (t) => E = t }, totalEchoes: { get: () => dt }, newPSD: oe, usePSD: Te, scheduler: { get: () => Re, set: (t) => {
|
|
691
|
-
Re = t;
|
|
692
|
-
} }, rejectionMapper: { get: () => It, set: (t) => {
|
|
693
|
-
It = t;
|
|
694
|
-
} }, follow: (t, e) => new S((n, r) => oe((s, i) => {
|
|
695
|
-
var o = E;
|
|
696
|
-
o.unhandleds = [], o.onunhandled = i, o.finalize = pe(function() {
|
|
697
|
-
(function(u) {
|
|
698
|
-
function a() {
|
|
699
|
-
u(), st.splice(st.indexOf(a), 1);
|
|
700
|
-
}
|
|
701
|
-
st.push(a), ++fe, Re(() => {
|
|
702
|
-
--fe == 0 && on();
|
|
703
|
-
}, []);
|
|
704
|
-
})(() => {
|
|
705
|
-
this.unhandleds.length === 0 ? s() : i(this.unhandleds[0]);
|
|
706
|
-
});
|
|
707
|
-
}, o.finalize), t();
|
|
708
|
-
}, e, n, r)) }), nt && (nt.allSettled && ee(S, "allSettled", function() {
|
|
709
|
-
const t = J.apply(null, arguments).map(Xe);
|
|
710
|
-
return new S((e) => {
|
|
711
|
-
t.length === 0 && e([]);
|
|
712
|
-
let n = t.length;
|
|
713
|
-
const r = new Array(n);
|
|
714
|
-
t.forEach((s, i) => S.resolve(s).then((o) => r[i] = { status: "fulfilled", value: o }, (o) => r[i] = { status: "rejected", reason: o }).then(() => --n || e(r)));
|
|
715
|
-
});
|
|
716
|
-
}), nt.any && typeof AggregateError < "u" && ee(S, "any", function() {
|
|
717
|
-
const t = J.apply(null, arguments).map(Xe);
|
|
718
|
-
return new S((e, n) => {
|
|
719
|
-
t.length === 0 && n(new AggregateError([]));
|
|
720
|
-
let r = t.length;
|
|
721
|
-
const s = new Array(r);
|
|
722
|
-
t.forEach((i, o) => S.resolve(i).then((u) => e(u), (u) => {
|
|
723
|
-
s[o] = u, --r || n(new AggregateError(s));
|
|
724
|
-
}));
|
|
725
|
-
});
|
|
726
|
-
}));
|
|
727
|
-
const F = { awaits: 0, echoes: 0, id: 0 };
|
|
728
|
-
var _r = 0, it = [], wt = 0, dt = 0, kr = 0;
|
|
729
|
-
function oe(t, e, n, r) {
|
|
730
|
-
var s = E, i = Object.create(s);
|
|
731
|
-
i.parent = s, i.ref = 0, i.global = !1, i.id = ++kr;
|
|
732
|
-
var o = xe.env;
|
|
733
|
-
i.env = rn ? { Promise: S, PromiseProp: { value: S, configurable: !0, writable: !0 }, all: S.all, race: S.race, allSettled: S.allSettled, any: S.any, resolve: S.resolve, reject: S.reject, nthen: dn(o.nthen, i), gthen: dn(o.gthen, i) } : {}, e && U(i, e), ++s.ref, i.finalize = function() {
|
|
734
|
-
--this.parent.ref || this.parent.finalize();
|
|
735
|
-
};
|
|
736
|
-
var u = Te(i, t, n, r);
|
|
737
|
-
return i.ref === 0 && i.finalize(), u;
|
|
738
|
-
}
|
|
739
|
-
function Pe() {
|
|
740
|
-
return F.id || (F.id = ++_r), ++F.awaits, F.echoes += Rn, F.id;
|
|
741
|
-
}
|
|
742
|
-
function ne() {
|
|
743
|
-
return !!F.awaits && (--F.awaits == 0 && (F.id = 0), F.echoes = F.awaits * Rn, !0);
|
|
744
|
-
}
|
|
745
|
-
function Xe(t) {
|
|
746
|
-
return F.echoes && t && t.constructor === nt ? (Pe(), t.then((e) => (ne(), e), (e) => (ne(), D(e)))) : t;
|
|
747
|
-
}
|
|
748
|
-
function xr(t) {
|
|
749
|
-
++dt, F.echoes && --F.echoes != 0 || (F.echoes = F.id = 0), it.push(E), ae(t, !0);
|
|
750
|
-
}
|
|
751
|
-
function Sr() {
|
|
752
|
-
var t = it[it.length - 1];
|
|
753
|
-
it.pop(), ae(t, !1);
|
|
754
|
-
}
|
|
755
|
-
function ae(t, e) {
|
|
756
|
-
var n = E;
|
|
757
|
-
if ((e ? !F.echoes || wt++ && t === E : !wt || --wt && t === E) || Ln(e ? xr.bind(null, t) : Sr), t !== E && (E = t, n === xe && (xe.env = qn()), rn)) {
|
|
758
|
-
var r = xe.env.Promise, s = t.env;
|
|
759
|
-
ct.then = s.nthen, r.prototype.then = s.gthen, (n.global || t.global) && (Object.defineProperty($, "Promise", s.PromiseProp), r.all = s.all, r.race = s.race, r.resolve = s.resolve, r.reject = s.reject, s.allSettled && (r.allSettled = s.allSettled), s.any && (r.any = s.any));
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
function qn() {
|
|
763
|
-
var t = $.Promise;
|
|
764
|
-
return rn ? { Promise: t, PromiseProp: Object.getOwnPropertyDescriptor($, "Promise"), all: t.all, race: t.race, allSettled: t.allSettled, any: t.any, resolve: t.resolve, reject: t.reject, nthen: ct.then, gthen: t.prototype.then } : {};
|
|
765
|
-
}
|
|
766
|
-
function Te(t, e, n, r, s) {
|
|
767
|
-
var i = E;
|
|
768
|
-
try {
|
|
769
|
-
return ae(t, !0), e(n, r, s);
|
|
770
|
-
} finally {
|
|
771
|
-
ae(i, !1);
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
function Ln(t) {
|
|
775
|
-
jn.call(Kt, t);
|
|
776
|
-
}
|
|
777
|
-
function ft(t, e, n, r) {
|
|
778
|
-
return typeof t != "function" ? t : function() {
|
|
779
|
-
var s = E;
|
|
780
|
-
n && Pe(), ae(e, !0);
|
|
781
|
-
try {
|
|
782
|
-
return t.apply(this, arguments);
|
|
783
|
-
} finally {
|
|
784
|
-
ae(s, !1), r && Ln(ne);
|
|
785
|
-
}
|
|
786
|
-
};
|
|
787
|
-
}
|
|
788
|
-
function dn(t, e) {
|
|
789
|
-
return function(n, r) {
|
|
790
|
-
return t.call(this, ft(n, e), ft(r, e));
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
|
-
("" + jn).indexOf("[native code]") === -1 && (Pe = ne = K);
|
|
794
|
-
const fn = "unhandledrejection";
|
|
795
|
-
function pn(t, e) {
|
|
796
|
-
var n;
|
|
797
|
-
try {
|
|
798
|
-
n = e.onuncatched(t);
|
|
799
|
-
} catch {
|
|
800
|
-
}
|
|
801
|
-
if (n !== !1)
|
|
802
|
-
try {
|
|
803
|
-
var r, s = { promise: e, reason: t };
|
|
804
|
-
if ($.document && document.createEvent ? ((r = document.createEvent("Event")).initEvent(fn, !0, !0), U(r, s)) : $.CustomEvent && U(r = new CustomEvent(fn, { detail: s }), s), r && $.dispatchEvent && (dispatchEvent(r), !$.PromiseRejectionEvent && $.onunhandledrejection))
|
|
805
|
-
try {
|
|
806
|
-
$.onunhandledrejection(r);
|
|
807
|
-
} catch {
|
|
808
|
-
}
|
|
809
|
-
G && r && !r.defaultPrevented && console.warn(`Unhandled rejection: ${t.stack || t}`);
|
|
810
|
-
} catch {
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
var D = S.reject;
|
|
814
|
-
function Ft(t, e, n, r) {
|
|
815
|
-
if (t.idbdb && (t._state.openComplete || E.letThrough || t._vip)) {
|
|
816
|
-
var s = t._createTransaction(e, n, t._dbSchema);
|
|
817
|
-
try {
|
|
818
|
-
s.create(), t._state.PR1398_maxLoop = 3;
|
|
819
|
-
} catch (i) {
|
|
820
|
-
return i.name === tn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Ft(t, e, n, r))) : D(i);
|
|
821
|
-
}
|
|
822
|
-
return s._promise(e, (i, o) => oe(() => (E.trans = s, r(i, o, s)))).then((i) => s._completion.then(() => i));
|
|
823
|
-
}
|
|
824
|
-
if (t._state.openComplete)
|
|
825
|
-
return D(new P.DatabaseClosed(t._state.dbOpenError));
|
|
826
|
-
if (!t._state.isBeingOpened) {
|
|
827
|
-
if (!t._options.autoOpen)
|
|
828
|
-
return D(new P.DatabaseClosed());
|
|
829
|
-
t.open().catch(K);
|
|
830
|
-
}
|
|
831
|
-
return t._state.dbReadyPromise.then(() => Ft(t, e, n, r));
|
|
832
|
-
}
|
|
833
|
-
const mn = "3.2.4", he = String.fromCharCode(65535), Mt = -1 / 0, X = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Un = "String expected.", je = [], gt = typeof navigator < "u" && /(MSIE|Trident|Edge)/.test(navigator.userAgent), Cr = gt, Er = gt, Wn = (t) => !/(dexie\.js|dexie\.min\.js)/.test(t), yt = "__dbnames", _t = "readonly", kt = "readwrite";
|
|
834
|
-
function me(t, e) {
|
|
835
|
-
return t ? e ? function() {
|
|
836
|
-
return t.apply(this, arguments) && e.apply(this, arguments);
|
|
837
|
-
} : t : e;
|
|
838
|
-
}
|
|
839
|
-
const Vn = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 };
|
|
840
|
-
function Qe(t) {
|
|
841
|
-
return typeof t != "string" || /\./.test(t) ? (e) => e : (e) => (e[t] === void 0 && t in e && delete (e = Ve(e))[t], e);
|
|
842
|
-
}
|
|
843
|
-
class Pr {
|
|
844
|
-
_trans(e, n, r) {
|
|
845
|
-
const s = this._tx || E.trans, i = this.name;
|
|
846
|
-
function o(a, c, h) {
|
|
847
|
-
if (!h.schema[i])
|
|
848
|
-
throw new P.NotFound("Table " + i + " not part of transaction");
|
|
849
|
-
return n(h.idbtrans, h);
|
|
850
|
-
}
|
|
851
|
-
const u = ze();
|
|
852
|
-
try {
|
|
853
|
-
return s && s.db === this.db ? s === E.trans ? s._promise(e, o, r) : oe(() => s._promise(e, o, r), { trans: s, transless: E.transless || E }) : Ft(this.db, e, [this.name], o);
|
|
854
|
-
} finally {
|
|
855
|
-
u && Ye();
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
get(e, n) {
|
|
859
|
-
return e && e.constructor === Object ? this.where(e).first(n) : this._trans("readonly", (r) => this.core.get({ trans: r, key: e }).then((s) => this.hook.reading.fire(s))).then(n);
|
|
860
|
-
}
|
|
861
|
-
where(e) {
|
|
862
|
-
if (typeof e == "string")
|
|
863
|
-
return new this.db.WhereClause(this, e);
|
|
864
|
-
if (M(e))
|
|
865
|
-
return new this.db.WhereClause(this, `[${e.join("+")}]`);
|
|
866
|
-
const n = I(e);
|
|
867
|
-
if (n.length === 1)
|
|
868
|
-
return this.where(n[0]).equals(e[n[0]]);
|
|
869
|
-
const r = this.schema.indexes.concat(this.schema.primKey).filter((c) => c.compound && n.every((h) => c.keyPath.indexOf(h) >= 0) && c.keyPath.every((h) => n.indexOf(h) >= 0))[0];
|
|
870
|
-
if (r && this.db._maxKey !== he)
|
|
871
|
-
return this.where(r.name).equals(r.keyPath.map((c) => e[c]));
|
|
872
|
-
!r && G && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);
|
|
873
|
-
const { idxByName: s } = this.schema, i = this.db._deps.indexedDB;
|
|
874
|
-
function o(c, h) {
|
|
875
|
-
try {
|
|
876
|
-
return i.cmp(c, h) === 0;
|
|
877
|
-
} catch {
|
|
878
|
-
return !1;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
const [u, a] = n.reduce(([c, h], l) => {
|
|
882
|
-
const d = s[l], p = e[l];
|
|
883
|
-
return [c || d, c || !d ? me(h, d && d.multi ? (m) => {
|
|
884
|
-
const f = te(m, l);
|
|
885
|
-
return M(f) && f.some((v) => o(p, v));
|
|
886
|
-
} : (m) => o(p, te(m, l))) : h];
|
|
887
|
-
}, [null, null]);
|
|
888
|
-
return u ? this.where(u.name).equals(e[u.keyPath]).filter(a) : r ? this.filter(a) : this.where(n).equals("");
|
|
889
|
-
}
|
|
890
|
-
filter(e) {
|
|
891
|
-
return this.toCollection().and(e);
|
|
892
|
-
}
|
|
893
|
-
count(e) {
|
|
894
|
-
return this.toCollection().count(e);
|
|
895
|
-
}
|
|
896
|
-
offset(e) {
|
|
897
|
-
return this.toCollection().offset(e);
|
|
898
|
-
}
|
|
899
|
-
limit(e) {
|
|
900
|
-
return this.toCollection().limit(e);
|
|
901
|
-
}
|
|
902
|
-
each(e) {
|
|
903
|
-
return this.toCollection().each(e);
|
|
904
|
-
}
|
|
905
|
-
toArray(e) {
|
|
906
|
-
return this.toCollection().toArray(e);
|
|
907
|
-
}
|
|
908
|
-
toCollection() {
|
|
909
|
-
return new this.db.Collection(new this.db.WhereClause(this));
|
|
910
|
-
}
|
|
911
|
-
orderBy(e) {
|
|
912
|
-
return new this.db.Collection(new this.db.WhereClause(this, M(e) ? `[${e.join("+")}]` : e));
|
|
913
|
-
}
|
|
914
|
-
reverse() {
|
|
915
|
-
return this.toCollection().reverse();
|
|
916
|
-
}
|
|
917
|
-
mapToClass(e) {
|
|
918
|
-
this.schema.mappedClass = e;
|
|
919
|
-
const n = (r) => {
|
|
920
|
-
if (!r)
|
|
921
|
-
return r;
|
|
922
|
-
const s = Object.create(e.prototype);
|
|
923
|
-
for (var i in r)
|
|
924
|
-
if (z(r, i))
|
|
925
|
-
try {
|
|
926
|
-
s[i] = r[i];
|
|
927
|
-
} catch {
|
|
928
|
-
}
|
|
929
|
-
return s;
|
|
930
|
-
};
|
|
931
|
-
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = n, this.hook("reading", n), e;
|
|
932
|
-
}
|
|
933
|
-
defineClass() {
|
|
934
|
-
return this.mapToClass(function(e) {
|
|
935
|
-
U(this, e);
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
add(e, n) {
|
|
939
|
-
const { auto: r, keyPath: s } = this.schema.primKey;
|
|
940
|
-
let i = e;
|
|
941
|
-
return s && r && (i = Qe(s)(e)), this._trans("readwrite", (o) => this.core.mutate({ trans: o, type: "add", keys: n != null ? [n] : null, values: [i] })).then((o) => o.numFailures ? S.reject(o.failures[0]) : o.lastResult).then((o) => {
|
|
942
|
-
if (s)
|
|
943
|
-
try {
|
|
944
|
-
Y(e, s, o);
|
|
945
|
-
} catch {
|
|
946
|
-
}
|
|
947
|
-
return o;
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
update(e, n) {
|
|
951
|
-
if (typeof e != "object" || M(e))
|
|
952
|
-
return this.where(":id").equals(e).modify(n);
|
|
953
|
-
{
|
|
954
|
-
const r = te(e, this.schema.primKey.keyPath);
|
|
955
|
-
if (r === void 0)
|
|
956
|
-
return D(new P.InvalidArgument("Given object does not contain its primary key"));
|
|
957
|
-
try {
|
|
958
|
-
typeof n != "function" ? I(n).forEach((s) => {
|
|
959
|
-
Y(e, s, n[s]);
|
|
960
|
-
}) : n(e, { value: e, primKey: r });
|
|
961
|
-
} catch {
|
|
962
|
-
}
|
|
963
|
-
return this.where(":id").equals(r).modify(n);
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
put(e, n) {
|
|
967
|
-
const { auto: r, keyPath: s } = this.schema.primKey;
|
|
968
|
-
let i = e;
|
|
969
|
-
return s && r && (i = Qe(s)(e)), this._trans("readwrite", (o) => this.core.mutate({ trans: o, type: "put", values: [i], keys: n != null ? [n] : null })).then((o) => o.numFailures ? S.reject(o.failures[0]) : o.lastResult).then((o) => {
|
|
970
|
-
if (s)
|
|
971
|
-
try {
|
|
972
|
-
Y(e, s, o);
|
|
973
|
-
} catch {
|
|
974
|
-
}
|
|
975
|
-
return o;
|
|
976
|
-
});
|
|
977
|
-
}
|
|
978
|
-
delete(e) {
|
|
979
|
-
return this._trans("readwrite", (n) => this.core.mutate({ trans: n, type: "delete", keys: [e] })).then((n) => n.numFailures ? S.reject(n.failures[0]) : void 0);
|
|
980
|
-
}
|
|
981
|
-
clear() {
|
|
982
|
-
return this._trans("readwrite", (e) => this.core.mutate({ trans: e, type: "deleteRange", range: Vn })).then((e) => e.numFailures ? S.reject(e.failures[0]) : void 0);
|
|
983
|
-
}
|
|
984
|
-
bulkGet(e) {
|
|
985
|
-
return this._trans("readonly", (n) => this.core.getMany({ keys: e, trans: n }).then((r) => r.map((s) => this.hook.reading.fire(s))));
|
|
986
|
-
}
|
|
987
|
-
bulkAdd(e, n, r) {
|
|
988
|
-
const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
|
|
989
|
-
return this._trans("readwrite", (o) => {
|
|
990
|
-
const { auto: u, keyPath: a } = this.schema.primKey;
|
|
991
|
-
if (a && s)
|
|
992
|
-
throw new P.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
993
|
-
if (s && s.length !== e.length)
|
|
994
|
-
throw new P.InvalidArgument("Arguments objects and keys must have the same length");
|
|
995
|
-
const c = e.length;
|
|
996
|
-
let h = a && u ? e.map(Qe(a)) : e;
|
|
997
|
-
return this.core.mutate({ trans: o, type: "add", keys: s, values: h, wantResults: i }).then(({ numFailures: l, results: d, lastResult: p, failures: m }) => {
|
|
998
|
-
if (l === 0)
|
|
999
|
-
return i ? d : p;
|
|
1000
|
-
throw new Ne(`${this.name}.bulkAdd(): ${l} of ${c} operations failed`, m);
|
|
1001
|
-
});
|
|
1002
|
-
});
|
|
1003
|
-
}
|
|
1004
|
-
bulkPut(e, n, r) {
|
|
1005
|
-
const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
|
|
1006
|
-
return this._trans("readwrite", (o) => {
|
|
1007
|
-
const { auto: u, keyPath: a } = this.schema.primKey;
|
|
1008
|
-
if (a && s)
|
|
1009
|
-
throw new P.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
1010
|
-
if (s && s.length !== e.length)
|
|
1011
|
-
throw new P.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1012
|
-
const c = e.length;
|
|
1013
|
-
let h = a && u ? e.map(Qe(a)) : e;
|
|
1014
|
-
return this.core.mutate({ trans: o, type: "put", keys: s, values: h, wantResults: i }).then(({ numFailures: l, results: d, lastResult: p, failures: m }) => {
|
|
1015
|
-
if (l === 0)
|
|
1016
|
-
return i ? d : p;
|
|
1017
|
-
throw new Ne(`${this.name}.bulkPut(): ${l} of ${c} operations failed`, m);
|
|
1018
|
-
});
|
|
1019
|
-
});
|
|
1020
|
-
}
|
|
1021
|
-
bulkDelete(e) {
|
|
1022
|
-
const n = e.length;
|
|
1023
|
-
return this._trans("readwrite", (r) => this.core.mutate({ trans: r, type: "delete", keys: e })).then(({ numFailures: r, lastResult: s, failures: i }) => {
|
|
1024
|
-
if (r === 0)
|
|
1025
|
-
return s;
|
|
1026
|
-
throw new Ne(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`, i);
|
|
1027
|
-
});
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
function Ie(t) {
|
|
1031
|
-
var e = {}, n = function(o, u) {
|
|
1032
|
-
if (u) {
|
|
1033
|
-
for (var a = arguments.length, c = new Array(a - 1); --a; )
|
|
1034
|
-
c[a - 1] = arguments[a];
|
|
1035
|
-
return e[o].subscribe.apply(null, c), t;
|
|
1036
|
-
}
|
|
1037
|
-
if (typeof o == "string")
|
|
1038
|
-
return e[o];
|
|
1039
|
-
};
|
|
1040
|
-
n.addEventType = i;
|
|
1041
|
-
for (var r = 1, s = arguments.length; r < s; ++r)
|
|
1042
|
-
i(arguments[r]);
|
|
1043
|
-
return n;
|
|
1044
|
-
function i(o, u, a) {
|
|
1045
|
-
if (typeof o != "object") {
|
|
1046
|
-
var c;
|
|
1047
|
-
u || (u = vr), a || (a = K);
|
|
1048
|
-
var h = { subscribers: [], fire: a, subscribe: function(l) {
|
|
1049
|
-
h.subscribers.indexOf(l) === -1 && (h.subscribers.push(l), h.fire = u(h.fire, l));
|
|
1050
|
-
}, unsubscribe: function(l) {
|
|
1051
|
-
h.subscribers = h.subscribers.filter(function(d) {
|
|
1052
|
-
return d !== l;
|
|
1053
|
-
}), h.fire = h.subscribers.reduce(u, a);
|
|
1054
|
-
} };
|
|
1055
|
-
return e[o] = n[o] = h, h;
|
|
1056
|
-
}
|
|
1057
|
-
I(c = o).forEach(function(l) {
|
|
1058
|
-
var d = c[l];
|
|
1059
|
-
if (M(d))
|
|
1060
|
-
i(l, c[l][0], c[l][1]);
|
|
1061
|
-
else {
|
|
1062
|
-
if (d !== "asap")
|
|
1063
|
-
throw new P.InvalidArgument("Invalid event config");
|
|
1064
|
-
var p = i(l, Fe, function() {
|
|
1065
|
-
for (var m = arguments.length, f = new Array(m); m--; )
|
|
1066
|
-
f[m] = arguments[m];
|
|
1067
|
-
p.subscribers.forEach(function(v) {
|
|
1068
|
-
Cn(function() {
|
|
1069
|
-
v.apply(null, f);
|
|
1070
|
-
});
|
|
1071
|
-
});
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
});
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
function Ae(t, e) {
|
|
1078
|
-
return _e(e).from({ prototype: t }), e;
|
|
1079
|
-
}
|
|
1080
|
-
function ve(t, e) {
|
|
1081
|
-
return !(t.filter || t.algorithm || t.or) && (e ? t.justLimit : !t.replayFilter);
|
|
1082
|
-
}
|
|
1083
|
-
function xt(t, e) {
|
|
1084
|
-
t.filter = me(t.filter, e);
|
|
1085
|
-
}
|
|
1086
|
-
function St(t, e, n) {
|
|
1087
|
-
var r = t.replayFilter;
|
|
1088
|
-
t.replayFilter = r ? () => me(r(), e()) : e, t.justLimit = n && !r;
|
|
1089
|
-
}
|
|
1090
|
-
function ot(t, e) {
|
|
1091
|
-
if (t.isPrimKey)
|
|
1092
|
-
return e.primaryKey;
|
|
1093
|
-
const n = e.getIndexByKeyPath(t.index);
|
|
1094
|
-
if (!n)
|
|
1095
|
-
throw new P.Schema("KeyPath " + t.index + " on object store " + e.name + " is not indexed");
|
|
1096
|
-
return n;
|
|
1097
|
-
}
|
|
1098
|
-
function gn(t, e, n) {
|
|
1099
|
-
const r = ot(t, e.schema);
|
|
1100
|
-
return e.openCursor({ trans: n, values: !t.keysOnly, reverse: t.dir === "prev", unique: !!t.unique, query: { index: r, range: t.range } });
|
|
1101
|
-
}
|
|
1102
|
-
function Je(t, e, n, r) {
|
|
1103
|
-
const s = t.replayFilter ? me(t.filter, t.replayFilter()) : t.filter;
|
|
1104
|
-
if (t.or) {
|
|
1105
|
-
const i = {}, o = (u, a, c) => {
|
|
1106
|
-
if (!s || s(a, c, (d) => a.stop(d), (d) => a.fail(d))) {
|
|
1107
|
-
var h = a.primaryKey, l = "" + h;
|
|
1108
|
-
l === "[object ArrayBuffer]" && (l = "" + new Uint8Array(h)), z(i, l) || (i[l] = !0, e(u, a, c));
|
|
1109
|
-
}
|
|
1110
|
-
};
|
|
1111
|
-
return Promise.all([t.or._iterate(o, n), yn(gn(t, r, n), t.algorithm, o, !t.keysOnly && t.valueMapper)]);
|
|
1112
|
-
}
|
|
1113
|
-
return yn(gn(t, r, n), me(t.algorithm, s), e, !t.keysOnly && t.valueMapper);
|
|
1114
|
-
}
|
|
1115
|
-
function yn(t, e, n, r) {
|
|
1116
|
-
var s = N(r ? (i, o, u) => n(r(i), o, u) : n);
|
|
1117
|
-
return t.then((i) => {
|
|
1118
|
-
if (i)
|
|
1119
|
-
return i.start(() => {
|
|
1120
|
-
var o = () => i.continue();
|
|
1121
|
-
e && !e(i, (u) => o = u, (u) => {
|
|
1122
|
-
i.stop(u), o = K;
|
|
1123
|
-
}, (u) => {
|
|
1124
|
-
i.fail(u), o = K;
|
|
1125
|
-
}) || s(i.value, i, (u) => o = u), o();
|
|
1126
|
-
});
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
function L(t, e) {
|
|
1130
|
-
try {
|
|
1131
|
-
const n = vn(t), r = vn(e);
|
|
1132
|
-
if (n !== r)
|
|
1133
|
-
return n === "Array" ? 1 : r === "Array" ? -1 : n === "binary" ? 1 : r === "binary" ? -1 : n === "string" ? 1 : r === "string" ? -1 : n === "Date" ? 1 : r !== "Date" ? NaN : -1;
|
|
1134
|
-
switch (n) {
|
|
1135
|
-
case "number":
|
|
1136
|
-
case "Date":
|
|
1137
|
-
case "string":
|
|
1138
|
-
return t > e ? 1 : t < e ? -1 : 0;
|
|
1139
|
-
case "binary":
|
|
1140
|
-
return function(s, i) {
|
|
1141
|
-
const o = s.length, u = i.length, a = o < u ? o : u;
|
|
1142
|
-
for (let c = 0; c < a; ++c)
|
|
1143
|
-
if (s[c] !== i[c])
|
|
1144
|
-
return s[c] < i[c] ? -1 : 1;
|
|
1145
|
-
return o === u ? 0 : o < u ? -1 : 1;
|
|
1146
|
-
}(bn(t), bn(e));
|
|
1147
|
-
case "Array":
|
|
1148
|
-
return function(s, i) {
|
|
1149
|
-
const o = s.length, u = i.length, a = o < u ? o : u;
|
|
1150
|
-
for (let c = 0; c < a; ++c) {
|
|
1151
|
-
const h = L(s[c], i[c]);
|
|
1152
|
-
if (h !== 0)
|
|
1153
|
-
return h;
|
|
1154
|
-
}
|
|
1155
|
-
return o === u ? 0 : o < u ? -1 : 1;
|
|
1156
|
-
}(t, e);
|
|
1157
|
-
}
|
|
1158
|
-
} catch {
|
|
1159
|
-
}
|
|
1160
|
-
return NaN;
|
|
1161
|
-
}
|
|
1162
|
-
function vn(t) {
|
|
1163
|
-
const e = typeof t;
|
|
1164
|
-
if (e !== "object")
|
|
1165
|
-
return e;
|
|
1166
|
-
if (ArrayBuffer.isView(t))
|
|
1167
|
-
return "binary";
|
|
1168
|
-
const n = Tt(t);
|
|
1169
|
-
return n === "ArrayBuffer" ? "binary" : n;
|
|
1170
|
-
}
|
|
1171
|
-
function bn(t) {
|
|
1172
|
-
return t instanceof Uint8Array ? t : ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : new Uint8Array(t);
|
|
1173
|
-
}
|
|
1174
|
-
class Tr {
|
|
1175
|
-
_read(e, n) {
|
|
1176
|
-
var r = this._ctx;
|
|
1177
|
-
return r.error ? r.table._trans(null, D.bind(null, r.error)) : r.table._trans("readonly", e).then(n);
|
|
1178
|
-
}
|
|
1179
|
-
_write(e) {
|
|
1180
|
-
var n = this._ctx;
|
|
1181
|
-
return n.error ? n.table._trans(null, D.bind(null, n.error)) : n.table._trans("readwrite", e, "locked");
|
|
1182
|
-
}
|
|
1183
|
-
_addAlgorithm(e) {
|
|
1184
|
-
var n = this._ctx;
|
|
1185
|
-
n.algorithm = me(n.algorithm, e);
|
|
1186
|
-
}
|
|
1187
|
-
_iterate(e, n) {
|
|
1188
|
-
return Je(this._ctx, e, n, this._ctx.table.core);
|
|
1189
|
-
}
|
|
1190
|
-
clone(e) {
|
|
1191
|
-
var n = Object.create(this.constructor.prototype), r = Object.create(this._ctx);
|
|
1192
|
-
return e && U(r, e), n._ctx = r, n;
|
|
1193
|
-
}
|
|
1194
|
-
raw() {
|
|
1195
|
-
return this._ctx.valueMapper = null, this;
|
|
1196
|
-
}
|
|
1197
|
-
each(e) {
|
|
1198
|
-
var n = this._ctx;
|
|
1199
|
-
return this._read((r) => Je(n, e, r, n.table.core));
|
|
1200
|
-
}
|
|
1201
|
-
count(e) {
|
|
1202
|
-
return this._read((n) => {
|
|
1203
|
-
const r = this._ctx, s = r.table.core;
|
|
1204
|
-
if (ve(r, !0))
|
|
1205
|
-
return s.count({ trans: n, query: { index: ot(r, s.schema), range: r.range } }).then((o) => Math.min(o, r.limit));
|
|
1206
|
-
var i = 0;
|
|
1207
|
-
return Je(r, () => (++i, !1), n, s).then(() => i);
|
|
1208
|
-
}).then(e);
|
|
1209
|
-
}
|
|
1210
|
-
sortBy(e, n) {
|
|
1211
|
-
const r = e.split(".").reverse(), s = r[0], i = r.length - 1;
|
|
1212
|
-
function o(c, h) {
|
|
1213
|
-
return h ? o(c[r[h]], h - 1) : c[s];
|
|
1214
|
-
}
|
|
1215
|
-
var u = this._ctx.dir === "next" ? 1 : -1;
|
|
1216
|
-
function a(c, h) {
|
|
1217
|
-
var l = o(c, i), d = o(h, i);
|
|
1218
|
-
return l < d ? -u : l > d ? u : 0;
|
|
1219
|
-
}
|
|
1220
|
-
return this.toArray(function(c) {
|
|
1221
|
-
return c.sort(a);
|
|
1222
|
-
}).then(n);
|
|
1223
|
-
}
|
|
1224
|
-
toArray(e) {
|
|
1225
|
-
return this._read((n) => {
|
|
1226
|
-
var r = this._ctx;
|
|
1227
|
-
if (r.dir === "next" && ve(r, !0) && r.limit > 0) {
|
|
1228
|
-
const { valueMapper: s } = r, i = ot(r, r.table.core.schema);
|
|
1229
|
-
return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index: i, range: r.range } }).then(({ result: o }) => s ? o.map(s) : o);
|
|
1230
|
-
}
|
|
1231
|
-
{
|
|
1232
|
-
const s = [];
|
|
1233
|
-
return Je(r, (i) => s.push(i), n, r.table.core).then(() => s);
|
|
1234
|
-
}
|
|
1235
|
-
}, e);
|
|
1236
|
-
}
|
|
1237
|
-
offset(e) {
|
|
1238
|
-
var n = this._ctx;
|
|
1239
|
-
return e <= 0 || (n.offset += e, ve(n) ? St(n, () => {
|
|
1240
|
-
var r = e;
|
|
1241
|
-
return (s, i) => r === 0 || (r === 1 ? (--r, !1) : (i(() => {
|
|
1242
|
-
s.advance(r), r = 0;
|
|
1243
|
-
}), !1));
|
|
1244
|
-
}) : St(n, () => {
|
|
1245
|
-
var r = e;
|
|
1246
|
-
return () => --r < 0;
|
|
1247
|
-
})), this;
|
|
1248
|
-
}
|
|
1249
|
-
limit(e) {
|
|
1250
|
-
return this._ctx.limit = Math.min(this._ctx.limit, e), St(this._ctx, () => {
|
|
1251
|
-
var n = e;
|
|
1252
|
-
return function(r, s, i) {
|
|
1253
|
-
return --n <= 0 && s(i), n >= 0;
|
|
1254
|
-
};
|
|
1255
|
-
}, !0), this;
|
|
1256
|
-
}
|
|
1257
|
-
until(e, n) {
|
|
1258
|
-
return xt(this._ctx, function(r, s, i) {
|
|
1259
|
-
return !e(r.value) || (s(i), n);
|
|
1260
|
-
}), this;
|
|
1261
|
-
}
|
|
1262
|
-
first(e) {
|
|
1263
|
-
return this.limit(1).toArray(function(n) {
|
|
1264
|
-
return n[0];
|
|
1265
|
-
}).then(e);
|
|
1266
|
-
}
|
|
1267
|
-
last(e) {
|
|
1268
|
-
return this.reverse().first(e);
|
|
1269
|
-
}
|
|
1270
|
-
filter(e) {
|
|
1271
|
-
var n, r;
|
|
1272
|
-
return xt(this._ctx, function(s) {
|
|
1273
|
-
return e(s.value);
|
|
1274
|
-
}), n = this._ctx, r = e, n.isMatch = me(n.isMatch, r), this;
|
|
1275
|
-
}
|
|
1276
|
-
and(e) {
|
|
1277
|
-
return this.filter(e);
|
|
1278
|
-
}
|
|
1279
|
-
or(e) {
|
|
1280
|
-
return new this.db.WhereClause(this._ctx.table, e, this);
|
|
1281
|
-
}
|
|
1282
|
-
reverse() {
|
|
1283
|
-
return this._ctx.dir = this._ctx.dir === "prev" ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this;
|
|
1284
|
-
}
|
|
1285
|
-
desc() {
|
|
1286
|
-
return this.reverse();
|
|
1287
|
-
}
|
|
1288
|
-
eachKey(e) {
|
|
1289
|
-
var n = this._ctx;
|
|
1290
|
-
return n.keysOnly = !n.isMatch, this.each(function(r, s) {
|
|
1291
|
-
e(s.key, s);
|
|
1292
|
-
});
|
|
1293
|
-
}
|
|
1294
|
-
eachUniqueKey(e) {
|
|
1295
|
-
return this._ctx.unique = "unique", this.eachKey(e);
|
|
1296
|
-
}
|
|
1297
|
-
eachPrimaryKey(e) {
|
|
1298
|
-
var n = this._ctx;
|
|
1299
|
-
return n.keysOnly = !n.isMatch, this.each(function(r, s) {
|
|
1300
|
-
e(s.primaryKey, s);
|
|
1301
|
-
});
|
|
1302
|
-
}
|
|
1303
|
-
keys(e) {
|
|
1304
|
-
var n = this._ctx;
|
|
1305
|
-
n.keysOnly = !n.isMatch;
|
|
1306
|
-
var r = [];
|
|
1307
|
-
return this.each(function(s, i) {
|
|
1308
|
-
r.push(i.key);
|
|
1309
|
-
}).then(function() {
|
|
1310
|
-
return r;
|
|
1311
|
-
}).then(e);
|
|
1312
|
-
}
|
|
1313
|
-
primaryKeys(e) {
|
|
1314
|
-
var n = this._ctx;
|
|
1315
|
-
if (n.dir === "next" && ve(n, !0) && n.limit > 0)
|
|
1316
|
-
return this._read((s) => {
|
|
1317
|
-
var i = ot(n, n.table.core.schema);
|
|
1318
|
-
return n.table.core.query({ trans: s, values: !1, limit: n.limit, query: { index: i, range: n.range } });
|
|
1319
|
-
}).then(({ result: s }) => s).then(e);
|
|
1320
|
-
n.keysOnly = !n.isMatch;
|
|
1321
|
-
var r = [];
|
|
1322
|
-
return this.each(function(s, i) {
|
|
1323
|
-
r.push(i.primaryKey);
|
|
1324
|
-
}).then(function() {
|
|
1325
|
-
return r;
|
|
1326
|
-
}).then(e);
|
|
1327
|
-
}
|
|
1328
|
-
uniqueKeys(e) {
|
|
1329
|
-
return this._ctx.unique = "unique", this.keys(e);
|
|
1330
|
-
}
|
|
1331
|
-
firstKey(e) {
|
|
1332
|
-
return this.limit(1).keys(function(n) {
|
|
1333
|
-
return n[0];
|
|
1334
|
-
}).then(e);
|
|
1335
|
-
}
|
|
1336
|
-
lastKey(e) {
|
|
1337
|
-
return this.reverse().firstKey(e);
|
|
1338
|
-
}
|
|
1339
|
-
distinct() {
|
|
1340
|
-
var e = this._ctx, n = e.index && e.table.schema.idxByName[e.index];
|
|
1341
|
-
if (!n || !n.multi)
|
|
1342
|
-
return this;
|
|
1343
|
-
var r = {};
|
|
1344
|
-
return xt(this._ctx, function(s) {
|
|
1345
|
-
var i = s.primaryKey.toString(), o = z(r, i);
|
|
1346
|
-
return r[i] = !0, !o;
|
|
1347
|
-
}), this;
|
|
1348
|
-
}
|
|
1349
|
-
modify(e) {
|
|
1350
|
-
var n = this._ctx;
|
|
1351
|
-
return this._write((r) => {
|
|
1352
|
-
var s;
|
|
1353
|
-
if (typeof e == "function")
|
|
1354
|
-
s = e;
|
|
1355
|
-
else {
|
|
1356
|
-
var i = I(e), o = i.length;
|
|
1357
|
-
s = function(f) {
|
|
1358
|
-
for (var v = !1, y = 0; y < o; ++y) {
|
|
1359
|
-
var g = i[y], b = e[g];
|
|
1360
|
-
te(f, g) !== b && (Y(f, g, b), v = !0);
|
|
1361
|
-
}
|
|
1362
|
-
return v;
|
|
1363
|
-
};
|
|
1364
|
-
}
|
|
1365
|
-
const u = n.table.core, { outbound: a, extractKey: c } = u.schema.primaryKey, h = this.db._options.modifyChunkSize || 200, l = [];
|
|
1366
|
-
let d = 0;
|
|
1367
|
-
const p = [], m = (f, v) => {
|
|
1368
|
-
const { failures: y, numFailures: g } = v;
|
|
1369
|
-
d += f - g;
|
|
1370
|
-
for (let b of I(y))
|
|
1371
|
-
l.push(y[b]);
|
|
1372
|
-
};
|
|
1373
|
-
return this.clone().primaryKeys().then((f) => {
|
|
1374
|
-
const v = (y) => {
|
|
1375
|
-
const g = Math.min(h, f.length - y);
|
|
1376
|
-
return u.getMany({ trans: r, keys: f.slice(y, y + g), cache: "immutable" }).then((b) => {
|
|
1377
|
-
const w = [], C = [], k = a ? [] : null, _ = [];
|
|
1378
|
-
for (let x = 0; x < g; ++x) {
|
|
1379
|
-
const R = b[x], A = { value: Ve(R), primKey: f[y + x] };
|
|
1380
|
-
s.call(A, A.value, A) !== !1 && (A.value == null ? _.push(f[y + x]) : a || L(c(R), c(A.value)) === 0 ? (C.push(A.value), a && k.push(f[y + x])) : (_.push(f[y + x]), w.push(A.value)));
|
|
1381
|
-
}
|
|
1382
|
-
const O = ve(n) && n.limit === 1 / 0 && (typeof e != "function" || e === Ct) && { index: n.index, range: n.range };
|
|
1383
|
-
return Promise.resolve(w.length > 0 && u.mutate({ trans: r, type: "add", values: w }).then((x) => {
|
|
1384
|
-
for (let R in x.failures)
|
|
1385
|
-
_.splice(parseInt(R), 1);
|
|
1386
|
-
m(w.length, x);
|
|
1387
|
-
})).then(() => (C.length > 0 || O && typeof e == "object") && u.mutate({ trans: r, type: "put", keys: k, values: C, criteria: O, changeSpec: typeof e != "function" && e }).then((x) => m(C.length, x))).then(() => (_.length > 0 || O && e === Ct) && u.mutate({ trans: r, type: "delete", keys: _, criteria: O }).then((x) => m(_.length, x))).then(() => f.length > y + g && v(y + h));
|
|
1388
|
-
});
|
|
1389
|
-
};
|
|
1390
|
-
return v(0).then(() => {
|
|
1391
|
-
if (l.length > 0)
|
|
1392
|
-
throw new lt("Error modifying one or more objects", l, d, p);
|
|
1393
|
-
return f.length;
|
|
1394
|
-
});
|
|
1395
|
-
});
|
|
1396
|
-
});
|
|
1397
|
-
}
|
|
1398
|
-
delete() {
|
|
1399
|
-
var e = this._ctx, n = e.range;
|
|
1400
|
-
return ve(e) && (e.isPrimKey && !Er || n.type === 3) ? this._write((r) => {
|
|
1401
|
-
const { primaryKey: s } = e.table.core.schema, i = n;
|
|
1402
|
-
return e.table.core.count({ trans: r, query: { index: s, range: i } }).then((o) => e.table.core.mutate({ trans: r, type: "deleteRange", range: i }).then(({ failures: u, lastResult: a, results: c, numFailures: h }) => {
|
|
1403
|
-
if (h)
|
|
1404
|
-
throw new lt("Could not delete some values", Object.keys(u).map((l) => u[l]), o - h);
|
|
1405
|
-
return o - h;
|
|
1406
|
-
}));
|
|
1407
|
-
}) : this.modify(Ct);
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
const Ct = (t, e) => e.value = null;
|
|
1411
|
-
function Or(t, e) {
|
|
1412
|
-
return t < e ? -1 : t === e ? 0 : 1;
|
|
1413
|
-
}
|
|
1414
|
-
function Ar(t, e) {
|
|
1415
|
-
return t > e ? -1 : t === e ? 0 : 1;
|
|
1416
|
-
}
|
|
1417
|
-
function V(t, e, n) {
|
|
1418
|
-
var r = t instanceof Yn ? new t.Collection(t) : t;
|
|
1419
|
-
return r._ctx.error = n ? new n(e) : new TypeError(e), r;
|
|
1420
|
-
}
|
|
1421
|
-
function be(t) {
|
|
1422
|
-
return new t.Collection(t, () => zn("")).limit(0);
|
|
1423
|
-
}
|
|
1424
|
-
function Kr(t, e, n, r, s, i) {
|
|
1425
|
-
for (var o = Math.min(t.length, r.length), u = -1, a = 0; a < o; ++a) {
|
|
1426
|
-
var c = e[a];
|
|
1427
|
-
if (c !== r[a])
|
|
1428
|
-
return s(t[a], n[a]) < 0 ? t.substr(0, a) + n[a] + n.substr(a + 1) : s(t[a], r[a]) < 0 ? t.substr(0, a) + r[a] + n.substr(a + 1) : u >= 0 ? t.substr(0, u) + e[u] + n.substr(u + 1) : null;
|
|
1429
|
-
s(t[a], c) < 0 && (u = a);
|
|
1430
|
-
}
|
|
1431
|
-
return o < r.length && i === "next" ? t + n.substr(t.length) : o < t.length && i === "prev" ? t.substr(0, n.length) : u < 0 ? null : t.substr(0, u) + r[u] + n.substr(u + 1);
|
|
1432
|
-
}
|
|
1433
|
-
function Ze(t, e, n, r) {
|
|
1434
|
-
var s, i, o, u, a, c, h, l = n.length;
|
|
1435
|
-
if (!n.every((f) => typeof f == "string"))
|
|
1436
|
-
return V(t, Un);
|
|
1437
|
-
function d(f) {
|
|
1438
|
-
s = function(y) {
|
|
1439
|
-
return y === "next" ? (g) => g.toUpperCase() : (g) => g.toLowerCase();
|
|
1440
|
-
}(f), i = function(y) {
|
|
1441
|
-
return y === "next" ? (g) => g.toLowerCase() : (g) => g.toUpperCase();
|
|
1442
|
-
}(f), o = f === "next" ? Or : Ar;
|
|
1443
|
-
var v = n.map(function(y) {
|
|
1444
|
-
return { lower: i(y), upper: s(y) };
|
|
1445
|
-
}).sort(function(y, g) {
|
|
1446
|
-
return o(y.lower, g.lower);
|
|
1447
|
-
});
|
|
1448
|
-
u = v.map(function(y) {
|
|
1449
|
-
return y.upper;
|
|
1450
|
-
}), a = v.map(function(y) {
|
|
1451
|
-
return y.lower;
|
|
1452
|
-
}), c = f, h = f === "next" ? "" : r;
|
|
1453
|
-
}
|
|
1454
|
-
d("next");
|
|
1455
|
-
var p = new t.Collection(t, () => re(u[0], a[l - 1] + r));
|
|
1456
|
-
p._ondirectionchange = function(f) {
|
|
1457
|
-
d(f);
|
|
1458
|
-
};
|
|
1459
|
-
var m = 0;
|
|
1460
|
-
return p._addAlgorithm(function(f, v, y) {
|
|
1461
|
-
var g = f.key;
|
|
1462
|
-
if (typeof g != "string")
|
|
1463
|
-
return !1;
|
|
1464
|
-
var b = i(g);
|
|
1465
|
-
if (e(b, a, m))
|
|
1466
|
-
return !0;
|
|
1467
|
-
for (var w = null, C = m; C < l; ++C) {
|
|
1468
|
-
var k = Kr(g, b, u[C], a[C], o, c);
|
|
1469
|
-
k === null && w === null ? m = C + 1 : (w === null || o(w, k) > 0) && (w = k);
|
|
1470
|
-
}
|
|
1471
|
-
return v(w !== null ? function() {
|
|
1472
|
-
f.continue(w + h);
|
|
1473
|
-
} : y), !1;
|
|
1474
|
-
}), p;
|
|
1475
|
-
}
|
|
1476
|
-
function re(t, e, n, r) {
|
|
1477
|
-
return { type: 2, lower: t, upper: e, lowerOpen: n, upperOpen: r };
|
|
1478
|
-
}
|
|
1479
|
-
function zn(t) {
|
|
1480
|
-
return { type: 1, lower: t, upper: t };
|
|
1481
|
-
}
|
|
1482
|
-
class Yn {
|
|
1483
|
-
get Collection() {
|
|
1484
|
-
return this._ctx.table.db.Collection;
|
|
1485
|
-
}
|
|
1486
|
-
between(e, n, r, s) {
|
|
1487
|
-
r = r !== !1, s = s === !0;
|
|
1488
|
-
try {
|
|
1489
|
-
return this._cmp(e, n) > 0 || this._cmp(e, n) === 0 && (r || s) && (!r || !s) ? be(this) : new this.Collection(this, () => re(e, n, !r, !s));
|
|
1490
|
-
} catch {
|
|
1491
|
-
return V(this, X);
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
equals(e) {
|
|
1495
|
-
return e == null ? V(this, X) : new this.Collection(this, () => zn(e));
|
|
1496
|
-
}
|
|
1497
|
-
above(e) {
|
|
1498
|
-
return e == null ? V(this, X) : new this.Collection(this, () => re(e, void 0, !0));
|
|
1499
|
-
}
|
|
1500
|
-
aboveOrEqual(e) {
|
|
1501
|
-
return e == null ? V(this, X) : new this.Collection(this, () => re(e, void 0, !1));
|
|
1502
|
-
}
|
|
1503
|
-
below(e) {
|
|
1504
|
-
return e == null ? V(this, X) : new this.Collection(this, () => re(void 0, e, !1, !0));
|
|
1505
|
-
}
|
|
1506
|
-
belowOrEqual(e) {
|
|
1507
|
-
return e == null ? V(this, X) : new this.Collection(this, () => re(void 0, e));
|
|
1508
|
-
}
|
|
1509
|
-
startsWith(e) {
|
|
1510
|
-
return typeof e != "string" ? V(this, Un) : this.between(e, e + he, !0, !0);
|
|
1511
|
-
}
|
|
1512
|
-
startsWithIgnoreCase(e) {
|
|
1513
|
-
return e === "" ? this.startsWith(e) : Ze(this, (n, r) => n.indexOf(r[0]) === 0, [e], he);
|
|
1514
|
-
}
|
|
1515
|
-
equalsIgnoreCase(e) {
|
|
1516
|
-
return Ze(this, (n, r) => n === r[0], [e], "");
|
|
1517
|
-
}
|
|
1518
|
-
anyOfIgnoreCase() {
|
|
1519
|
-
var e = J.apply(we, arguments);
|
|
1520
|
-
return e.length === 0 ? be(this) : Ze(this, (n, r) => r.indexOf(n) !== -1, e, "");
|
|
1521
|
-
}
|
|
1522
|
-
startsWithAnyOfIgnoreCase() {
|
|
1523
|
-
var e = J.apply(we, arguments);
|
|
1524
|
-
return e.length === 0 ? be(this) : Ze(this, (n, r) => r.some((s) => n.indexOf(s) === 0), e, he);
|
|
1525
|
-
}
|
|
1526
|
-
anyOf() {
|
|
1527
|
-
const e = J.apply(we, arguments);
|
|
1528
|
-
let n = this._cmp;
|
|
1529
|
-
try {
|
|
1530
|
-
e.sort(n);
|
|
1531
|
-
} catch {
|
|
1532
|
-
return V(this, X);
|
|
1533
|
-
}
|
|
1534
|
-
if (e.length === 0)
|
|
1535
|
-
return be(this);
|
|
1536
|
-
const r = new this.Collection(this, () => re(e[0], e[e.length - 1]));
|
|
1537
|
-
r._ondirectionchange = (i) => {
|
|
1538
|
-
n = i === "next" ? this._ascending : this._descending, e.sort(n);
|
|
1539
|
-
};
|
|
1540
|
-
let s = 0;
|
|
1541
|
-
return r._addAlgorithm((i, o, u) => {
|
|
1542
|
-
const a = i.key;
|
|
1543
|
-
for (; n(a, e[s]) > 0; )
|
|
1544
|
-
if (++s, s === e.length)
|
|
1545
|
-
return o(u), !1;
|
|
1546
|
-
return n(a, e[s]) === 0 || (o(() => {
|
|
1547
|
-
i.continue(e[s]);
|
|
1548
|
-
}), !1);
|
|
1549
|
-
}), r;
|
|
1550
|
-
}
|
|
1551
|
-
notEqual(e) {
|
|
1552
|
-
return this.inAnyRange([[Mt, e], [e, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 });
|
|
1553
|
-
}
|
|
1554
|
-
noneOf() {
|
|
1555
|
-
const e = J.apply(we, arguments);
|
|
1556
|
-
if (e.length === 0)
|
|
1557
|
-
return new this.Collection(this);
|
|
1558
|
-
try {
|
|
1559
|
-
e.sort(this._ascending);
|
|
1560
|
-
} catch {
|
|
1561
|
-
return V(this, X);
|
|
1562
|
-
}
|
|
1563
|
-
const n = e.reduce((r, s) => r ? r.concat([[r[r.length - 1][1], s]]) : [[Mt, s]], null);
|
|
1564
|
-
return n.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(n, { includeLowers: !1, includeUppers: !1 });
|
|
1565
|
-
}
|
|
1566
|
-
inAnyRange(e, n) {
|
|
1567
|
-
const r = this._cmp, s = this._ascending, i = this._descending, o = this._min, u = this._max;
|
|
1568
|
-
if (e.length === 0)
|
|
1569
|
-
return be(this);
|
|
1570
|
-
if (!e.every((g) => g[0] !== void 0 && g[1] !== void 0 && s(g[0], g[1]) <= 0))
|
|
1571
|
-
return V(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);
|
|
1572
|
-
const a = !n || n.includeLowers !== !1, c = n && n.includeUppers === !0;
|
|
1573
|
-
let h, l = s;
|
|
1574
|
-
function d(g, b) {
|
|
1575
|
-
return l(g[0], b[0]);
|
|
1576
|
-
}
|
|
1577
|
-
try {
|
|
1578
|
-
h = e.reduce(function(g, b) {
|
|
1579
|
-
let w = 0, C = g.length;
|
|
1580
|
-
for (; w < C; ++w) {
|
|
1581
|
-
const k = g[w];
|
|
1582
|
-
if (r(b[0], k[1]) < 0 && r(b[1], k[0]) > 0) {
|
|
1583
|
-
k[0] = o(k[0], b[0]), k[1] = u(k[1], b[1]);
|
|
1584
|
-
break;
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
return w === C && g.push(b), g;
|
|
1588
|
-
}, []), h.sort(d);
|
|
1589
|
-
} catch {
|
|
1590
|
-
return V(this, X);
|
|
1591
|
-
}
|
|
1592
|
-
let p = 0;
|
|
1593
|
-
const m = c ? (g) => s(g, h[p][1]) > 0 : (g) => s(g, h[p][1]) >= 0, f = a ? (g) => i(g, h[p][0]) > 0 : (g) => i(g, h[p][0]) >= 0;
|
|
1594
|
-
let v = m;
|
|
1595
|
-
const y = new this.Collection(this, () => re(h[0][0], h[h.length - 1][1], !a, !c));
|
|
1596
|
-
return y._ondirectionchange = (g) => {
|
|
1597
|
-
g === "next" ? (v = m, l = s) : (v = f, l = i), h.sort(d);
|
|
1598
|
-
}, y._addAlgorithm((g, b, w) => {
|
|
1599
|
-
for (var C = g.key; v(C); )
|
|
1600
|
-
if (++p, p === h.length)
|
|
1601
|
-
return b(w), !1;
|
|
1602
|
-
return !!function(k) {
|
|
1603
|
-
return !m(k) && !f(k);
|
|
1604
|
-
}(C) || (this._cmp(C, h[p][1]) === 0 || this._cmp(C, h[p][0]) === 0 || b(() => {
|
|
1605
|
-
l === s ? g.continue(h[p][0]) : g.continue(h[p][1]);
|
|
1606
|
-
}), !1);
|
|
1607
|
-
}), y;
|
|
1608
|
-
}
|
|
1609
|
-
startsWithAnyOf() {
|
|
1610
|
-
const e = J.apply(we, arguments);
|
|
1611
|
-
return e.every((n) => typeof n == "string") ? e.length === 0 ? be(this) : this.inAnyRange(e.map((n) => [n, n + he])) : V(this, "startsWithAnyOf() only works with strings");
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
function H(t) {
|
|
1615
|
-
return N(function(e) {
|
|
1616
|
-
return qe(e), t(e.target.error), !1;
|
|
1617
|
-
});
|
|
1618
|
-
}
|
|
1619
|
-
function qe(t) {
|
|
1620
|
-
t.stopPropagation && t.stopPropagation(), t.preventDefault && t.preventDefault();
|
|
1621
|
-
}
|
|
1622
|
-
const Le = "storagemutated", ie = "x-storagemutated-1", ue = Ie(null, Le);
|
|
1623
|
-
class $r {
|
|
1624
|
-
_lock() {
|
|
1625
|
-
return Ke(!E.global), ++this._reculock, this._reculock !== 1 || E.global || (E.lockOwnerFor = this), this;
|
|
1626
|
-
}
|
|
1627
|
-
_unlock() {
|
|
1628
|
-
if (Ke(!E.global), --this._reculock == 0)
|
|
1629
|
-
for (E.global || (E.lockOwnerFor = null); this._blockedFuncs.length > 0 && !this._locked(); ) {
|
|
1630
|
-
var e = this._blockedFuncs.shift();
|
|
1631
|
-
try {
|
|
1632
|
-
Te(e[1], e[0]);
|
|
1633
|
-
} catch {
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
return this;
|
|
1637
|
-
}
|
|
1638
|
-
_locked() {
|
|
1639
|
-
return this._reculock && E.lockOwnerFor !== this;
|
|
1640
|
-
}
|
|
1641
|
-
create(e) {
|
|
1642
|
-
if (!this.mode)
|
|
1643
|
-
return this;
|
|
1644
|
-
const n = this.db.idbdb, r = this.db._state.dbOpenError;
|
|
1645
|
-
if (Ke(!this.idbtrans), !e && !n)
|
|
1646
|
-
switch (r && r.name) {
|
|
1647
|
-
case "DatabaseClosedError":
|
|
1648
|
-
throw new P.DatabaseClosed(r);
|
|
1649
|
-
case "MissingAPIError":
|
|
1650
|
-
throw new P.MissingAPI(r.message, r);
|
|
1651
|
-
default:
|
|
1652
|
-
throw new P.OpenFailed(r);
|
|
1653
|
-
}
|
|
1654
|
-
if (!this.active)
|
|
1655
|
-
throw new P.TransactionInactive();
|
|
1656
|
-
return Ke(this._completion._state === null), (e = this.idbtrans = e || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }) : n.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }))).onerror = N((s) => {
|
|
1657
|
-
qe(s), this._reject(e.error);
|
|
1658
|
-
}), e.onabort = N((s) => {
|
|
1659
|
-
qe(s), this.active && this._reject(new P.Abort(e.error)), this.active = !1, this.on("abort").fire(s);
|
|
1660
|
-
}), e.oncomplete = N(() => {
|
|
1661
|
-
this.active = !1, this._resolve(), "mutatedParts" in e && ue.storagemutated.fire(e.mutatedParts);
|
|
1662
|
-
}), this;
|
|
1663
|
-
}
|
|
1664
|
-
_promise(e, n, r) {
|
|
1665
|
-
if (e === "readwrite" && this.mode !== "readwrite")
|
|
1666
|
-
return D(new P.ReadOnly("Transaction is readonly"));
|
|
1667
|
-
if (!this.active)
|
|
1668
|
-
return D(new P.TransactionInactive());
|
|
1669
|
-
if (this._locked())
|
|
1670
|
-
return new S((i, o) => {
|
|
1671
|
-
this._blockedFuncs.push([() => {
|
|
1672
|
-
this._promise(e, n, r).then(i, o);
|
|
1673
|
-
}, E]);
|
|
1674
|
-
});
|
|
1675
|
-
if (r)
|
|
1676
|
-
return oe(() => {
|
|
1677
|
-
var i = new S((o, u) => {
|
|
1678
|
-
this._lock();
|
|
1679
|
-
const a = n(o, u, this);
|
|
1680
|
-
a && a.then && a.then(o, u);
|
|
1681
|
-
});
|
|
1682
|
-
return i.finally(() => this._unlock()), i._lib = !0, i;
|
|
1683
|
-
});
|
|
1684
|
-
var s = new S((i, o) => {
|
|
1685
|
-
var u = n(i, o, this);
|
|
1686
|
-
u && u.then && u.then(i, o);
|
|
1687
|
-
});
|
|
1688
|
-
return s._lib = !0, s;
|
|
1689
|
-
}
|
|
1690
|
-
_root() {
|
|
1691
|
-
return this.parent ? this.parent._root() : this;
|
|
1692
|
-
}
|
|
1693
|
-
waitFor(e) {
|
|
1694
|
-
var n = this._root();
|
|
1695
|
-
const r = S.resolve(e);
|
|
1696
|
-
if (n._waitingFor)
|
|
1697
|
-
n._waitingFor = n._waitingFor.then(() => r);
|
|
1698
|
-
else {
|
|
1699
|
-
n._waitingFor = r, n._waitingQueue = [];
|
|
1700
|
-
var s = n.idbtrans.objectStore(n.storeNames[0]);
|
|
1701
|
-
(function o() {
|
|
1702
|
-
for (++n._spinCount; n._waitingQueue.length; )
|
|
1703
|
-
n._waitingQueue.shift()();
|
|
1704
|
-
n._waitingFor && (s.get(-1 / 0).onsuccess = o);
|
|
1705
|
-
})();
|
|
1706
|
-
}
|
|
1707
|
-
var i = n._waitingFor;
|
|
1708
|
-
return new S((o, u) => {
|
|
1709
|
-
r.then((a) => n._waitingQueue.push(N(o.bind(null, a))), (a) => n._waitingQueue.push(N(u.bind(null, a)))).finally(() => {
|
|
1710
|
-
n._waitingFor === i && (n._waitingFor = null);
|
|
1711
|
-
});
|
|
1712
|
-
});
|
|
1713
|
-
}
|
|
1714
|
-
abort() {
|
|
1715
|
-
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new P.Abort()));
|
|
1716
|
-
}
|
|
1717
|
-
table(e) {
|
|
1718
|
-
const n = this._memoizedTables || (this._memoizedTables = {});
|
|
1719
|
-
if (z(n, e))
|
|
1720
|
-
return n[e];
|
|
1721
|
-
const r = this.schema[e];
|
|
1722
|
-
if (!r)
|
|
1723
|
-
throw new P.NotFound("Table " + e + " not part of transaction");
|
|
1724
|
-
const s = new this.db.Table(e, r, this);
|
|
1725
|
-
return s.core = this.db.core.table(e), n[e] = s, s;
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
function qt(t, e, n, r, s, i, o) {
|
|
1729
|
-
return { name: t, keyPath: e, unique: n, multi: r, auto: s, compound: i, src: (n && !o ? "&" : "") + (r ? "*" : "") + (s ? "++" : "") + Hn(e) };
|
|
1730
|
-
}
|
|
1731
|
-
function Hn(t) {
|
|
1732
|
-
return typeof t == "string" ? t : t ? "[" + [].join.call(t, "+") + "]" : "";
|
|
1733
|
-
}
|
|
1734
|
-
function Gn(t, e, n) {
|
|
1735
|
-
return { name: t, primKey: e, indexes: n, mappedClass: null, idxByName: En(n, (r) => [r.name, r]) };
|
|
1736
|
-
}
|
|
1737
|
-
let Ue = (t) => {
|
|
1738
|
-
try {
|
|
1739
|
-
return t.only([[]]), Ue = () => [[]], [[]];
|
|
1740
|
-
} catch {
|
|
1741
|
-
return Ue = () => he, he;
|
|
1742
|
-
}
|
|
1743
|
-
};
|
|
1744
|
-
function Lt(t) {
|
|
1745
|
-
return t == null ? () => {
|
|
1746
|
-
} : typeof t == "string" ? function(e) {
|
|
1747
|
-
return e.split(".").length === 1 ? (n) => n[e] : (n) => te(n, e);
|
|
1748
|
-
}(t) : (e) => te(e, t);
|
|
1749
|
-
}
|
|
1750
|
-
function wn(t) {
|
|
1751
|
-
return [].slice.call(t);
|
|
1752
|
-
}
|
|
1753
|
-
let Nr = 0;
|
|
1754
|
-
function De(t) {
|
|
1755
|
-
return t == null ? ":id" : typeof t == "string" ? t : `[${t.join("+")}]`;
|
|
1756
|
-
}
|
|
1757
|
-
function Rr(t, e, n) {
|
|
1758
|
-
function r(a) {
|
|
1759
|
-
if (a.type === 3)
|
|
1760
|
-
return null;
|
|
1761
|
-
if (a.type === 4)
|
|
1762
|
-
throw new Error("Cannot convert never type to IDBKeyRange");
|
|
1763
|
-
const { lower: c, upper: h, lowerOpen: l, upperOpen: d } = a;
|
|
1764
|
-
return c === void 0 ? h === void 0 ? null : e.upperBound(h, !!d) : h === void 0 ? e.lowerBound(c, !!l) : e.bound(c, h, !!l, !!d);
|
|
1765
|
-
}
|
|
1766
|
-
const { schema: s, hasGetAll: i } = function(a, c) {
|
|
1767
|
-
const h = wn(a.objectStoreNames);
|
|
1768
|
-
return { schema: { name: a.name, tables: h.map((l) => c.objectStore(l)).map((l) => {
|
|
1769
|
-
const { keyPath: d, autoIncrement: p } = l, m = M(d), f = d == null, v = {}, y = { name: l.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: f, compound: m, keyPath: d, autoIncrement: p, unique: !0, extractKey: Lt(d) }, indexes: wn(l.indexNames).map((g) => l.index(g)).map((g) => {
|
|
1770
|
-
const { name: b, unique: w, multiEntry: C, keyPath: k } = g, _ = { name: b, compound: M(k), keyPath: k, unique: w, multiEntry: C, extractKey: Lt(k) };
|
|
1771
|
-
return v[De(k)] = _, _;
|
|
1772
|
-
}), getIndexByKeyPath: (g) => v[De(g)] };
|
|
1773
|
-
return v[":id"] = y.primaryKey, d != null && (v[De(d)] = y.primaryKey), y;
|
|
1774
|
-
}) }, hasGetAll: h.length > 0 && "getAll" in c.objectStore(h[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) };
|
|
1775
|
-
}(t, n), o = s.tables.map((a) => function(c) {
|
|
1776
|
-
const h = c.name;
|
|
1777
|
-
return { name: h, schema: c, mutate: function({ trans: l, type: d, keys: p, values: m, range: f }) {
|
|
1778
|
-
return new Promise((v, y) => {
|
|
1779
|
-
v = N(v);
|
|
1780
|
-
const g = l.objectStore(h), b = g.keyPath == null, w = d === "put" || d === "add";
|
|
1781
|
-
if (!w && d !== "delete" && d !== "deleteRange")
|
|
1782
|
-
throw new Error("Invalid operation type: " + d);
|
|
1783
|
-
const { length: C } = p || m || { length: 1 };
|
|
1784
|
-
if (p && m && p.length !== m.length)
|
|
1785
|
-
throw new Error("Given keys array must have same length as given values array.");
|
|
1786
|
-
if (C === 0)
|
|
1787
|
-
return v({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
1788
|
-
let k;
|
|
1789
|
-
const _ = [], O = [];
|
|
1790
|
-
let x = 0;
|
|
1791
|
-
const R = (q) => {
|
|
1792
|
-
++x, qe(q);
|
|
1793
|
-
};
|
|
1794
|
-
if (d === "deleteRange") {
|
|
1795
|
-
if (f.type === 4)
|
|
1796
|
-
return v({ numFailures: x, failures: O, results: [], lastResult: void 0 });
|
|
1797
|
-
f.type === 3 ? _.push(k = g.clear()) : _.push(k = g.delete(r(f)));
|
|
1798
|
-
} else {
|
|
1799
|
-
const [q, B] = w ? b ? [m, p] : [m, null] : [p, null];
|
|
1800
|
-
if (w)
|
|
1801
|
-
for (let j = 0; j < C; ++j)
|
|
1802
|
-
_.push(k = B && B[j] !== void 0 ? g[d](q[j], B[j]) : g[d](q[j])), k.onerror = R;
|
|
1803
|
-
else
|
|
1804
|
-
for (let j = 0; j < C; ++j)
|
|
1805
|
-
_.push(k = g[d](q[j])), k.onerror = R;
|
|
1806
|
-
}
|
|
1807
|
-
const A = (q) => {
|
|
1808
|
-
const B = q.target.result;
|
|
1809
|
-
_.forEach((j, ge) => j.error != null && (O[ge] = j.error)), v({ numFailures: x, failures: O, results: d === "delete" ? p : _.map((j) => j.result), lastResult: B });
|
|
1810
|
-
};
|
|
1811
|
-
k.onerror = (q) => {
|
|
1812
|
-
R(q), A(q);
|
|
1813
|
-
}, k.onsuccess = A;
|
|
1814
|
-
});
|
|
1815
|
-
}, getMany: ({ trans: l, keys: d }) => new Promise((p, m) => {
|
|
1816
|
-
p = N(p);
|
|
1817
|
-
const f = l.objectStore(h), v = d.length, y = new Array(v);
|
|
1818
|
-
let g, b = 0, w = 0;
|
|
1819
|
-
const C = (_) => {
|
|
1820
|
-
const O = _.target;
|
|
1821
|
-
y[O._pos] = O.result, ++w === b && p(y);
|
|
1822
|
-
}, k = H(m);
|
|
1823
|
-
for (let _ = 0; _ < v; ++_)
|
|
1824
|
-
d[_] != null && (g = f.get(d[_]), g._pos = _, g.onsuccess = C, g.onerror = k, ++b);
|
|
1825
|
-
b === 0 && p(y);
|
|
1826
|
-
}), get: ({ trans: l, key: d }) => new Promise((p, m) => {
|
|
1827
|
-
p = N(p);
|
|
1828
|
-
const f = l.objectStore(h).get(d);
|
|
1829
|
-
f.onsuccess = (v) => p(v.target.result), f.onerror = H(m);
|
|
1830
|
-
}), query: function(l) {
|
|
1831
|
-
return (d) => new Promise((p, m) => {
|
|
1832
|
-
p = N(p);
|
|
1833
|
-
const { trans: f, values: v, limit: y, query: g } = d, b = y === 1 / 0 ? void 0 : y, { index: w, range: C } = g, k = f.objectStore(h), _ = w.isPrimaryKey ? k : k.index(w.name), O = r(C);
|
|
1834
|
-
if (y === 0)
|
|
1835
|
-
return p({ result: [] });
|
|
1836
|
-
if (l) {
|
|
1837
|
-
const x = v ? _.getAll(O, b) : _.getAllKeys(O, b);
|
|
1838
|
-
x.onsuccess = (R) => p({ result: R.target.result }), x.onerror = H(m);
|
|
1839
|
-
} else {
|
|
1840
|
-
let x = 0;
|
|
1841
|
-
const R = v || !("openKeyCursor" in _) ? _.openCursor(O) : _.openKeyCursor(O), A = [];
|
|
1842
|
-
R.onsuccess = (q) => {
|
|
1843
|
-
const B = R.result;
|
|
1844
|
-
return B ? (A.push(v ? B.value : B.primaryKey), ++x === y ? p({ result: A }) : void B.continue()) : p({ result: A });
|
|
1845
|
-
}, R.onerror = H(m);
|
|
1846
|
-
}
|
|
1847
|
-
});
|
|
1848
|
-
}(i), openCursor: function({ trans: l, values: d, query: p, reverse: m, unique: f }) {
|
|
1849
|
-
return new Promise((v, y) => {
|
|
1850
|
-
v = N(v);
|
|
1851
|
-
const { index: g, range: b } = p, w = l.objectStore(h), C = g.isPrimaryKey ? w : w.index(g.name), k = m ? f ? "prevunique" : "prev" : f ? "nextunique" : "next", _ = d || !("openKeyCursor" in C) ? C.openCursor(r(b), k) : C.openKeyCursor(r(b), k);
|
|
1852
|
-
_.onerror = H(y), _.onsuccess = N((O) => {
|
|
1853
|
-
const x = _.result;
|
|
1854
|
-
if (!x)
|
|
1855
|
-
return void v(null);
|
|
1856
|
-
x.___id = ++Nr, x.done = !1;
|
|
1857
|
-
const R = x.continue.bind(x);
|
|
1858
|
-
let A = x.continuePrimaryKey;
|
|
1859
|
-
A && (A = A.bind(x));
|
|
1860
|
-
const q = x.advance.bind(x), B = () => {
|
|
1861
|
-
throw new Error("Cursor not stopped");
|
|
1862
|
-
};
|
|
1863
|
-
x.trans = l, x.stop = x.continue = x.continuePrimaryKey = x.advance = () => {
|
|
1864
|
-
throw new Error("Cursor not started");
|
|
1865
|
-
}, x.fail = N(y), x.next = function() {
|
|
1866
|
-
let j = 1;
|
|
1867
|
-
return this.start(() => j-- ? this.continue() : this.stop()).then(() => this);
|
|
1868
|
-
}, x.start = (j) => {
|
|
1869
|
-
const ge = new Promise((W, le) => {
|
|
1870
|
-
W = N(W), _.onerror = H(le), x.fail = le, x.stop = (Oe) => {
|
|
1871
|
-
x.stop = x.continue = x.continuePrimaryKey = x.advance = B, W(Oe);
|
|
1872
|
-
};
|
|
1873
|
-
}), ye = () => {
|
|
1874
|
-
if (_.result)
|
|
1875
|
-
try {
|
|
1876
|
-
j();
|
|
1877
|
-
} catch (W) {
|
|
1878
|
-
x.fail(W);
|
|
1879
|
-
}
|
|
1880
|
-
else
|
|
1881
|
-
x.done = !0, x.start = () => {
|
|
1882
|
-
throw new Error("Cursor behind last entry");
|
|
1883
|
-
}, x.stop();
|
|
1884
|
-
};
|
|
1885
|
-
return _.onsuccess = N((W) => {
|
|
1886
|
-
_.onsuccess = ye, ye();
|
|
1887
|
-
}), x.continue = R, x.continuePrimaryKey = A, x.advance = q, ye(), ge;
|
|
1888
|
-
}, v(x);
|
|
1889
|
-
}, y);
|
|
1890
|
-
});
|
|
1891
|
-
}, count({ query: l, trans: d }) {
|
|
1892
|
-
const { index: p, range: m } = l;
|
|
1893
|
-
return new Promise((f, v) => {
|
|
1894
|
-
const y = d.objectStore(h), g = p.isPrimaryKey ? y : y.index(p.name), b = r(m), w = b ? g.count(b) : g.count();
|
|
1895
|
-
w.onsuccess = N((C) => f(C.target.result)), w.onerror = H(v);
|
|
1896
|
-
});
|
|
1897
|
-
} };
|
|
1898
|
-
}(a)), u = {};
|
|
1899
|
-
return o.forEach((a) => u[a.name] = a), { stack: "dbcore", transaction: t.transaction.bind(t), table(a) {
|
|
1900
|
-
if (!u[a])
|
|
1901
|
-
throw new Error(`Table '${a}' not found`);
|
|
1902
|
-
return u[a];
|
|
1903
|
-
}, MIN_KEY: -1 / 0, MAX_KEY: Ue(e), schema: s };
|
|
1904
|
-
}
|
|
1905
|
-
function Ut({ _novip: t }, e) {
|
|
1906
|
-
const n = e.db, r = function(s, i, { IDBKeyRange: o, indexedDB: u }, a) {
|
|
1907
|
-
return { dbcore: function(c, h) {
|
|
1908
|
-
return h.reduce((l, { create: d }) => ({ ...l, ...d(l) }), c);
|
|
1909
|
-
}(Rr(i, o, a), s.dbcore) };
|
|
1910
|
-
}(t._middlewares, n, t._deps, e);
|
|
1911
|
-
t.core = r.dbcore, t.tables.forEach((s) => {
|
|
1912
|
-
const i = s.name;
|
|
1913
|
-
t.core.schema.tables.some((o) => o.name === i) && (s.core = t.core.table(i), t[i] instanceof t.Table && (t[i].core = s.core));
|
|
1914
|
-
});
|
|
1915
|
-
}
|
|
1916
|
-
function pt({ _novip: t }, e, n, r) {
|
|
1917
|
-
n.forEach((s) => {
|
|
1918
|
-
const i = r[s];
|
|
1919
|
-
e.forEach((o) => {
|
|
1920
|
-
const u = Jt(o, s);
|
|
1921
|
-
(!u || "value" in u && u.value === void 0) && (o === t.Transaction.prototype || o instanceof t.Transaction ? ee(o, s, { get() {
|
|
1922
|
-
return this.table(s);
|
|
1923
|
-
}, set(a) {
|
|
1924
|
-
xn(this, s, { value: a, writable: !0, configurable: !0, enumerable: !0 });
|
|
1925
|
-
} }) : o[s] = new t.Table(s, i));
|
|
1926
|
-
});
|
|
1927
|
-
});
|
|
1928
|
-
}
|
|
1929
|
-
function Wt({ _novip: t }, e) {
|
|
1930
|
-
e.forEach((n) => {
|
|
1931
|
-
for (let r in n)
|
|
1932
|
-
n[r] instanceof t.Table && delete n[r];
|
|
1933
|
-
});
|
|
1934
|
-
}
|
|
1935
|
-
function jr(t, e) {
|
|
1936
|
-
return t._cfg.version - e._cfg.version;
|
|
1937
|
-
}
|
|
1938
|
-
function Ir(t, e, n, r) {
|
|
1939
|
-
const s = t._dbSchema, i = t._createTransaction("readwrite", t._storeNames, s);
|
|
1940
|
-
i.create(n), i._completion.catch(r);
|
|
1941
|
-
const o = i._reject.bind(i), u = E.transless || E;
|
|
1942
|
-
oe(() => {
|
|
1943
|
-
E.trans = i, E.transless = u, e === 0 ? (I(s).forEach((a) => {
|
|
1944
|
-
Et(n, a, s[a].primKey, s[a].indexes);
|
|
1945
|
-
}), Ut(t, n), S.follow(() => t.on.populate.fire(i)).catch(o)) : function({ _novip: a }, c, h, l) {
|
|
1946
|
-
const d = [], p = a._versions;
|
|
1947
|
-
let m = a._dbSchema = zt(a, a.idbdb, l), f = !1;
|
|
1948
|
-
const v = p.filter((g) => g._cfg.version >= c);
|
|
1949
|
-
function y() {
|
|
1950
|
-
return d.length ? S.resolve(d.shift()(h.idbtrans)).then(y) : S.resolve();
|
|
1951
|
-
}
|
|
1952
|
-
return v.forEach((g) => {
|
|
1953
|
-
d.push(() => {
|
|
1954
|
-
const b = m, w = g._cfg.dbschema;
|
|
1955
|
-
Yt(a, b, l), Yt(a, w, l), m = a._dbSchema = w;
|
|
1956
|
-
const C = Xn(b, w);
|
|
1957
|
-
C.add.forEach((_) => {
|
|
1958
|
-
Et(l, _[0], _[1].primKey, _[1].indexes);
|
|
1959
|
-
}), C.change.forEach((_) => {
|
|
1960
|
-
if (_.recreate)
|
|
1961
|
-
throw new P.Upgrade("Not yet support for changing primary key");
|
|
1962
|
-
{
|
|
1963
|
-
const O = l.objectStore(_.name);
|
|
1964
|
-
_.add.forEach((x) => Vt(O, x)), _.change.forEach((x) => {
|
|
1965
|
-
O.deleteIndex(x.name), Vt(O, x);
|
|
1966
|
-
}), _.del.forEach((x) => O.deleteIndex(x));
|
|
1967
|
-
}
|
|
1968
|
-
});
|
|
1969
|
-
const k = g._cfg.contentUpgrade;
|
|
1970
|
-
if (k && g._cfg.version > c) {
|
|
1971
|
-
Ut(a, l), h._memoizedTables = {}, f = !0;
|
|
1972
|
-
let _ = Pn(w);
|
|
1973
|
-
C.del.forEach((A) => {
|
|
1974
|
-
_[A] = b[A];
|
|
1975
|
-
}), Wt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], I(_), _), h.schema = _;
|
|
1976
|
-
const O = Zt(k);
|
|
1977
|
-
let x;
|
|
1978
|
-
O && Pe();
|
|
1979
|
-
const R = S.follow(() => {
|
|
1980
|
-
if (x = k(h), x && O) {
|
|
1981
|
-
var A = ne.bind(null, null);
|
|
1982
|
-
x.then(A, A);
|
|
1983
|
-
}
|
|
1984
|
-
});
|
|
1985
|
-
return x && typeof x.then == "function" ? S.resolve(x) : R.then(() => x);
|
|
1986
|
-
}
|
|
1987
|
-
}), d.push((b) => {
|
|
1988
|
-
(!f || !Cr) && function(w, C) {
|
|
1989
|
-
[].slice.call(C.db.objectStoreNames).forEach((k) => w[k] == null && C.db.deleteObjectStore(k));
|
|
1990
|
-
}(g._cfg.dbschema, b), Wt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], a._storeNames, a._dbSchema), h.schema = a._dbSchema;
|
|
1991
|
-
});
|
|
1992
|
-
}), y().then(() => {
|
|
1993
|
-
var g, b;
|
|
1994
|
-
b = l, I(g = m).forEach((w) => {
|
|
1995
|
-
b.db.objectStoreNames.contains(w) || Et(b, w, g[w].primKey, g[w].indexes);
|
|
1996
|
-
});
|
|
1997
|
-
});
|
|
1998
|
-
}(t, e, i, n).catch(o);
|
|
1999
|
-
});
|
|
2000
|
-
}
|
|
2001
|
-
function Xn(t, e) {
|
|
2002
|
-
const n = { del: [], add: [], change: [] };
|
|
2003
|
-
let r;
|
|
2004
|
-
for (r in t)
|
|
2005
|
-
e[r] || n.del.push(r);
|
|
2006
|
-
for (r in e) {
|
|
2007
|
-
const s = t[r], i = e[r];
|
|
2008
|
-
if (s) {
|
|
2009
|
-
const o = { name: r, def: i, recreate: !1, del: [], add: [], change: [] };
|
|
2010
|
-
if ("" + (s.primKey.keyPath || "") != "" + (i.primKey.keyPath || "") || s.primKey.auto !== i.primKey.auto && !gt)
|
|
2011
|
-
o.recreate = !0, n.change.push(o);
|
|
2012
|
-
else {
|
|
2013
|
-
const u = s.idxByName, a = i.idxByName;
|
|
2014
|
-
let c;
|
|
2015
|
-
for (c in u)
|
|
2016
|
-
a[c] || o.del.push(c);
|
|
2017
|
-
for (c in a) {
|
|
2018
|
-
const h = u[c], l = a[c];
|
|
2019
|
-
h ? h.src !== l.src && o.change.push(l) : o.add.push(l);
|
|
2020
|
-
}
|
|
2021
|
-
(o.del.length > 0 || o.add.length > 0 || o.change.length > 0) && n.change.push(o);
|
|
2022
|
-
}
|
|
2023
|
-
} else
|
|
2024
|
-
n.add.push([r, i]);
|
|
2025
|
-
}
|
|
2026
|
-
return n;
|
|
2027
|
-
}
|
|
2028
|
-
function Et(t, e, n, r) {
|
|
2029
|
-
const s = t.db.createObjectStore(e, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
|
|
2030
|
-
return r.forEach((i) => Vt(s, i)), s;
|
|
2031
|
-
}
|
|
2032
|
-
function Vt(t, e) {
|
|
2033
|
-
t.createIndex(e.name, e.keyPath, { unique: e.unique, multiEntry: e.multi });
|
|
2034
|
-
}
|
|
2035
|
-
function zt(t, e, n) {
|
|
2036
|
-
const r = {};
|
|
2037
|
-
return ut(e.objectStoreNames, 0).forEach((s) => {
|
|
2038
|
-
const i = n.objectStore(s);
|
|
2039
|
-
let o = i.keyPath;
|
|
2040
|
-
const u = qt(Hn(o), o || "", !1, !1, !!i.autoIncrement, o && typeof o != "string", !0), a = [];
|
|
2041
|
-
for (let h = 0; h < i.indexNames.length; ++h) {
|
|
2042
|
-
const l = i.index(i.indexNames[h]);
|
|
2043
|
-
o = l.keyPath;
|
|
2044
|
-
var c = qt(l.name, o, !!l.unique, !!l.multiEntry, !1, o && typeof o != "string", !1);
|
|
2045
|
-
a.push(c);
|
|
2046
|
-
}
|
|
2047
|
-
r[s] = Gn(s, u, a);
|
|
2048
|
-
}), r;
|
|
2049
|
-
}
|
|
2050
|
-
function Yt({ _novip: t }, e, n) {
|
|
2051
|
-
const r = n.db.objectStoreNames;
|
|
2052
|
-
for (let s = 0; s < r.length; ++s) {
|
|
2053
|
-
const i = r[s], o = n.objectStore(i);
|
|
2054
|
-
t._hasGetAll = "getAll" in o;
|
|
2055
|
-
for (let u = 0; u < o.indexNames.length; ++u) {
|
|
2056
|
-
const a = o.indexNames[u], c = o.index(a).keyPath, h = typeof c == "string" ? c : "[" + ut(c).join("+") + "]";
|
|
2057
|
-
if (e[i]) {
|
|
2058
|
-
const l = e[i].idxByName[h];
|
|
2059
|
-
l && (l.name = a, delete e[i].idxByName[h], e[i].idxByName[a] = l);
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
|
-
}
|
|
2063
|
-
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && $.WorkerGlobalScope && $ instanceof $.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (t._hasGetAll = !1);
|
|
2064
|
-
}
|
|
2065
|
-
class Dr {
|
|
2066
|
-
_parseStoresSpec(e, n) {
|
|
2067
|
-
I(e).forEach((r) => {
|
|
2068
|
-
if (e[r] !== null) {
|
|
2069
|
-
var s = e[r].split(",").map((o, u) => {
|
|
2070
|
-
const a = (o = o.trim()).replace(/([&*]|\+\+)/g, ""), c = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
2071
|
-
return qt(a, c || null, /\&/.test(o), /\*/.test(o), /\+\+/.test(o), M(c), u === 0);
|
|
2072
|
-
}), i = s.shift();
|
|
2073
|
-
if (i.multi)
|
|
2074
|
-
throw new P.Schema("Primary key cannot be multi-valued");
|
|
2075
|
-
s.forEach((o) => {
|
|
2076
|
-
if (o.auto)
|
|
2077
|
-
throw new P.Schema("Only primary key can be marked as autoIncrement (++)");
|
|
2078
|
-
if (!o.keyPath)
|
|
2079
|
-
throw new P.Schema("Index must have a name and cannot be an empty string");
|
|
2080
|
-
}), n[r] = Gn(r, i, s);
|
|
2081
|
-
}
|
|
2082
|
-
});
|
|
2083
|
-
}
|
|
2084
|
-
stores(e) {
|
|
2085
|
-
const n = this.db;
|
|
2086
|
-
this._cfg.storesSource = this._cfg.storesSource ? U(this._cfg.storesSource, e) : e;
|
|
2087
|
-
const r = n._versions, s = {};
|
|
2088
|
-
let i = {};
|
|
2089
|
-
return r.forEach((o) => {
|
|
2090
|
-
U(s, o._cfg.storesSource), i = o._cfg.dbschema = {}, o._parseStoresSpec(s, i);
|
|
2091
|
-
}), n._dbSchema = i, Wt(n, [n._allTables, n, n.Transaction.prototype]), pt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables], I(i), i), n._storeNames = I(i), this;
|
|
2092
|
-
}
|
|
2093
|
-
upgrade(e) {
|
|
2094
|
-
return this._cfg.contentUpgrade = nn(this._cfg.contentUpgrade || K, e), this;
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2097
|
-
function an(t, e) {
|
|
2098
|
-
let n = t._dbNamesDB;
|
|
2099
|
-
return n || (n = t._dbNamesDB = new Se(yt, { addons: [], indexedDB: t, IDBKeyRange: e }), n.version(1).stores({ dbnames: "name" })), n.table("dbnames");
|
|
2100
|
-
}
|
|
2101
|
-
function un(t) {
|
|
2102
|
-
return t && typeof t.databases == "function";
|
|
2103
|
-
}
|
|
2104
|
-
function Ht(t) {
|
|
2105
|
-
return oe(function() {
|
|
2106
|
-
return E.letThrough = !0, t();
|
|
2107
|
-
});
|
|
2108
|
-
}
|
|
2109
|
-
function Br() {
|
|
2110
|
-
var t;
|
|
2111
|
-
return !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(e) {
|
|
2112
|
-
var n = function() {
|
|
2113
|
-
return indexedDB.databases().finally(e);
|
|
2114
|
-
};
|
|
2115
|
-
t = setInterval(n, 100), n();
|
|
2116
|
-
}).finally(function() {
|
|
2117
|
-
return clearInterval(t);
|
|
2118
|
-
}) : Promise.resolve();
|
|
2119
|
-
}
|
|
2120
|
-
function Fr(t) {
|
|
2121
|
-
const e = t._state, { indexedDB: n } = t._deps;
|
|
2122
|
-
if (e.isBeingOpened || t.idbdb)
|
|
2123
|
-
return e.dbReadyPromise.then(() => e.dbOpenError ? D(e.dbOpenError) : t);
|
|
2124
|
-
G && (e.openCanceller._stackHolder = Ee()), e.isBeingOpened = !0, e.dbOpenError = null, e.openComplete = !1;
|
|
2125
|
-
const r = e.openCanceller;
|
|
2126
|
-
function s() {
|
|
2127
|
-
if (e.openCanceller !== r)
|
|
2128
|
-
throw new P.DatabaseClosed("db.open() was cancelled");
|
|
2129
|
-
}
|
|
2130
|
-
let i = e.dbReadyResolve, o = null, u = !1;
|
|
2131
|
-
return S.race([r, (typeof navigator > "u" ? S.resolve() : Br()).then(() => new S((a, c) => {
|
|
2132
|
-
if (s(), !n)
|
|
2133
|
-
throw new P.MissingAPI();
|
|
2134
|
-
const h = t.name, l = e.autoSchema ? n.open(h) : n.open(h, Math.round(10 * t.verno));
|
|
2135
|
-
if (!l)
|
|
2136
|
-
throw new P.MissingAPI();
|
|
2137
|
-
l.onerror = H(c), l.onblocked = N(t._fireOnBlocked), l.onupgradeneeded = N((d) => {
|
|
2138
|
-
if (o = l.transaction, e.autoSchema && !t._options.allowEmptyDB) {
|
|
2139
|
-
l.onerror = qe, o.abort(), l.result.close();
|
|
2140
|
-
const m = n.deleteDatabase(h);
|
|
2141
|
-
m.onsuccess = m.onerror = N(() => {
|
|
2142
|
-
c(new P.NoSuchDatabase(`Database ${h} doesnt exist`));
|
|
2143
|
-
});
|
|
2144
|
-
} else {
|
|
2145
|
-
o.onerror = H(c);
|
|
2146
|
-
var p = d.oldVersion > Math.pow(2, 62) ? 0 : d.oldVersion;
|
|
2147
|
-
u = p < 1, t._novip.idbdb = l.result, Ir(t, p / 10, o, c);
|
|
2148
|
-
}
|
|
2149
|
-
}, c), l.onsuccess = N(() => {
|
|
2150
|
-
o = null;
|
|
2151
|
-
const d = t._novip.idbdb = l.result, p = ut(d.objectStoreNames);
|
|
2152
|
-
if (p.length > 0)
|
|
2153
|
-
try {
|
|
2154
|
-
const f = d.transaction((m = p).length === 1 ? m[0] : m, "readonly");
|
|
2155
|
-
e.autoSchema ? function({ _novip: v }, y, g) {
|
|
2156
|
-
v.verno = y.version / 10;
|
|
2157
|
-
const b = v._dbSchema = zt(0, y, g);
|
|
2158
|
-
v._storeNames = ut(y.objectStoreNames, 0), pt(v, [v._allTables], I(b), b);
|
|
2159
|
-
}(t, d, f) : (Yt(t, t._dbSchema, f), function(v, y) {
|
|
2160
|
-
const g = Xn(zt(0, v.idbdb, y), v._dbSchema);
|
|
2161
|
-
return !(g.add.length || g.change.some((b) => b.add.length || b.change.length));
|
|
2162
|
-
}(t, f) || console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")), Ut(t, f);
|
|
2163
|
-
} catch {
|
|
2164
|
-
}
|
|
2165
|
-
var m;
|
|
2166
|
-
je.push(t), d.onversionchange = N((f) => {
|
|
2167
|
-
e.vcFired = !0, t.on("versionchange").fire(f);
|
|
2168
|
-
}), d.onclose = N((f) => {
|
|
2169
|
-
t.on("close").fire(f);
|
|
2170
|
-
}), u && function({ indexedDB: f, IDBKeyRange: v }, y) {
|
|
2171
|
-
!un(f) && y !== yt && an(f, v).put({ name: y }).catch(K);
|
|
2172
|
-
}(t._deps, h), a();
|
|
2173
|
-
}, c);
|
|
2174
|
-
}))]).then(() => (s(), e.onReadyBeingFired = [], S.resolve(Ht(() => t.on.ready.fire(t.vip))).then(function a() {
|
|
2175
|
-
if (e.onReadyBeingFired.length > 0) {
|
|
2176
|
-
let c = e.onReadyBeingFired.reduce(nn, K);
|
|
2177
|
-
return e.onReadyBeingFired = [], S.resolve(Ht(() => c(t.vip))).then(a);
|
|
2178
|
-
}
|
|
2179
|
-
}))).finally(() => {
|
|
2180
|
-
e.onReadyBeingFired = null, e.isBeingOpened = !1;
|
|
2181
|
-
}).then(() => t).catch((a) => {
|
|
2182
|
-
e.dbOpenError = a;
|
|
2183
|
-
try {
|
|
2184
|
-
o && o.abort();
|
|
2185
|
-
} catch {
|
|
2186
|
-
}
|
|
2187
|
-
return r === e.openCanceller && t._close(), D(a);
|
|
2188
|
-
}).finally(() => {
|
|
2189
|
-
e.openComplete = !0, i();
|
|
2190
|
-
});
|
|
2191
|
-
}
|
|
2192
|
-
function Gt(t) {
|
|
2193
|
-
var e = (i) => t.next(i), n = s(e), r = s((i) => t.throw(i));
|
|
2194
|
-
function s(i) {
|
|
2195
|
-
return (o) => {
|
|
2196
|
-
var u = i(o), a = u.value;
|
|
2197
|
-
return u.done ? a : a && typeof a.then == "function" ? a.then(n, r) : M(a) ? Promise.all(a).then(n, r) : n(a);
|
|
2198
|
-
};
|
|
2199
|
-
}
|
|
2200
|
-
return s(e)();
|
|
2201
|
-
}
|
|
2202
|
-
function Mr(t, e, n) {
|
|
2203
|
-
var r = arguments.length;
|
|
2204
|
-
if (r < 2)
|
|
2205
|
-
throw new P.InvalidArgument("Too few arguments");
|
|
2206
|
-
for (var s = new Array(r - 1); --r; )
|
|
2207
|
-
s[r - 1] = arguments[r];
|
|
2208
|
-
return n = s.pop(), [t, Tn(s), n];
|
|
2209
|
-
}
|
|
2210
|
-
function Qn(t, e, n, r, s) {
|
|
2211
|
-
return S.resolve().then(() => {
|
|
2212
|
-
const i = E.transless || E, o = t._createTransaction(e, n, t._dbSchema, r), u = { trans: o, transless: i };
|
|
2213
|
-
if (r)
|
|
2214
|
-
o.idbtrans = r.idbtrans;
|
|
2215
|
-
else
|
|
2216
|
-
try {
|
|
2217
|
-
o.create(), t._state.PR1398_maxLoop = 3;
|
|
2218
|
-
} catch (l) {
|
|
2219
|
-
return l.name === tn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Qn(t, e, n, null, s))) : D(l);
|
|
2220
|
-
}
|
|
2221
|
-
const a = Zt(s);
|
|
2222
|
-
let c;
|
|
2223
|
-
a && Pe();
|
|
2224
|
-
const h = S.follow(() => {
|
|
2225
|
-
if (c = s.call(o, o), c)
|
|
2226
|
-
if (a) {
|
|
2227
|
-
var l = ne.bind(null, null);
|
|
2228
|
-
c.then(l, l);
|
|
2229
|
-
} else
|
|
2230
|
-
typeof c.next == "function" && typeof c.throw == "function" && (c = Gt(c));
|
|
2231
|
-
}, u);
|
|
2232
|
-
return (c && typeof c.then == "function" ? S.resolve(c).then((l) => o.active ? l : D(new P.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))) : h.then(() => c)).then((l) => (r && o._resolve(), o._completion.then(() => l))).catch((l) => (o._reject(l), D(l)));
|
|
2233
|
-
});
|
|
2234
|
-
}
|
|
2235
|
-
function et(t, e, n) {
|
|
2236
|
-
const r = M(t) ? t.slice() : [t];
|
|
2237
|
-
for (let s = 0; s < n; ++s)
|
|
2238
|
-
r.push(e);
|
|
2239
|
-
return r;
|
|
2240
|
-
}
|
|
2241
|
-
const qr = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(t) {
|
|
2242
|
-
return { ...t, table(e) {
|
|
2243
|
-
const n = t.table(e), { schema: r } = n, s = {}, i = [];
|
|
2244
|
-
function o(c, h, l) {
|
|
2245
|
-
const d = De(c), p = s[d] = s[d] || [], m = c == null ? 0 : typeof c == "string" ? 1 : c.length, f = h > 0, v = { ...l, isVirtual: f, keyTail: h, keyLength: m, extractKey: Lt(c), unique: !f && l.unique };
|
|
2246
|
-
return p.push(v), v.isPrimaryKey || i.push(v), m > 1 && o(m === 2 ? c[0] : c.slice(0, m - 1), h + 1, l), p.sort((y, g) => y.keyTail - g.keyTail), v;
|
|
2247
|
-
}
|
|
2248
|
-
const u = o(r.primaryKey.keyPath, 0, r.primaryKey);
|
|
2249
|
-
s[":id"] = [u];
|
|
2250
|
-
for (const c of r.indexes)
|
|
2251
|
-
o(c.keyPath, 0, c);
|
|
2252
|
-
function a(c) {
|
|
2253
|
-
const h = c.query.index;
|
|
2254
|
-
return h.isVirtual ? { ...c, query: { index: h, range: (l = c.query.range, d = h.keyTail, { type: l.type === 1 ? 2 : l.type, lower: et(l.lower, l.lowerOpen ? t.MAX_KEY : t.MIN_KEY, d), lowerOpen: !0, upper: et(l.upper, l.upperOpen ? t.MIN_KEY : t.MAX_KEY, d), upperOpen: !0 }) } } : c;
|
|
2255
|
-
var l, d;
|
|
2256
|
-
}
|
|
2257
|
-
return { ...n, schema: { ...r, primaryKey: u, indexes: i, getIndexByKeyPath: function(c) {
|
|
2258
|
-
const h = s[De(c)];
|
|
2259
|
-
return h && h[0];
|
|
2260
|
-
} }, count: (c) => n.count(a(c)), query: (c) => n.query(a(c)), openCursor(c) {
|
|
2261
|
-
const { keyTail: h, isVirtual: l, keyLength: d } = c.query.index;
|
|
2262
|
-
return l ? n.openCursor(a(c)).then((p) => p && function(m) {
|
|
2263
|
-
return Object.create(m, { continue: { value: function(f) {
|
|
2264
|
-
f != null ? m.continue(et(f, c.reverse ? t.MAX_KEY : t.MIN_KEY, h)) : c.unique ? m.continue(m.key.slice(0, d).concat(c.reverse ? t.MIN_KEY : t.MAX_KEY, h)) : m.continue();
|
|
2265
|
-
} }, continuePrimaryKey: { value(f, v) {
|
|
2266
|
-
m.continuePrimaryKey(et(f, t.MAX_KEY, h), v);
|
|
2267
|
-
} }, primaryKey: { get: () => m.primaryKey }, key: { get() {
|
|
2268
|
-
const f = m.key;
|
|
2269
|
-
return d === 1 ? f[0] : f.slice(0, d);
|
|
2270
|
-
} }, value: { get: () => m.value } });
|
|
2271
|
-
}(p)) : n.openCursor(c);
|
|
2272
|
-
} };
|
|
2273
|
-
} };
|
|
2274
|
-
} };
|
|
2275
|
-
function ln(t, e, n, r) {
|
|
2276
|
-
return n = n || {}, r = r || "", I(t).forEach((s) => {
|
|
2277
|
-
if (z(e, s)) {
|
|
2278
|
-
var i = t[s], o = e[s];
|
|
2279
|
-
if (typeof i == "object" && typeof o == "object" && i && o) {
|
|
2280
|
-
const u = Tt(i);
|
|
2281
|
-
u !== Tt(o) ? n[r + s] = e[s] : u === "Object" ? ln(i, o, n, r + s + ".") : i !== o && (n[r + s] = e[s]);
|
|
2282
|
-
} else
|
|
2283
|
-
i !== o && (n[r + s] = e[s]);
|
|
2284
|
-
} else
|
|
2285
|
-
n[r + s] = void 0;
|
|
2286
|
-
}), I(e).forEach((s) => {
|
|
2287
|
-
z(t, s) || (n[r + s] = e[s]);
|
|
2288
|
-
}), n;
|
|
2289
|
-
}
|
|
2290
|
-
const Lr = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (t) => ({ ...t, table(e) {
|
|
2291
|
-
const n = t.table(e), { primaryKey: r } = n.schema;
|
|
2292
|
-
return { ...n, mutate(s) {
|
|
2293
|
-
const i = E.trans, { deleting: o, creating: u, updating: a } = i.table(e).hook;
|
|
2294
|
-
switch (s.type) {
|
|
2295
|
-
case "add":
|
|
2296
|
-
if (u.fire === K)
|
|
2297
|
-
break;
|
|
2298
|
-
return i._promise("readwrite", () => c(s), !0);
|
|
2299
|
-
case "put":
|
|
2300
|
-
if (u.fire === K && a.fire === K)
|
|
2301
|
-
break;
|
|
2302
|
-
return i._promise("readwrite", () => c(s), !0);
|
|
2303
|
-
case "delete":
|
|
2304
|
-
if (o.fire === K)
|
|
2305
|
-
break;
|
|
2306
|
-
return i._promise("readwrite", () => c(s), !0);
|
|
2307
|
-
case "deleteRange":
|
|
2308
|
-
if (o.fire === K)
|
|
2309
|
-
break;
|
|
2310
|
-
return i._promise("readwrite", () => function(l) {
|
|
2311
|
-
return h(l.trans, l.range, 1e4);
|
|
2312
|
-
}(s), !0);
|
|
2313
|
-
}
|
|
2314
|
-
return n.mutate(s);
|
|
2315
|
-
function c(l) {
|
|
2316
|
-
const d = E.trans, p = l.keys || function(m, f) {
|
|
2317
|
-
return f.type === "delete" ? f.keys : f.keys || f.values.map(m.extractKey);
|
|
2318
|
-
}(r, l);
|
|
2319
|
-
if (!p)
|
|
2320
|
-
throw new Error("Keys missing");
|
|
2321
|
-
return (l = l.type === "add" || l.type === "put" ? { ...l, keys: p } : { ...l }).type !== "delete" && (l.values = [...l.values]), l.keys && (l.keys = [...l.keys]), function(m, f, v) {
|
|
2322
|
-
return f.type === "add" ? Promise.resolve([]) : m.getMany({ trans: f.trans, keys: v, cache: "immutable" });
|
|
2323
|
-
}(n, l, p).then((m) => {
|
|
2324
|
-
const f = p.map((v, y) => {
|
|
2325
|
-
const g = m[y], b = { onerror: null, onsuccess: null };
|
|
2326
|
-
if (l.type === "delete")
|
|
2327
|
-
o.fire.call(b, v, g, d);
|
|
2328
|
-
else if (l.type === "add" || g === void 0) {
|
|
2329
|
-
const w = u.fire.call(b, v, l.values[y], d);
|
|
2330
|
-
v == null && w != null && (v = w, l.keys[y] = v, r.outbound || Y(l.values[y], r.keyPath, v));
|
|
2331
|
-
} else {
|
|
2332
|
-
const w = ln(g, l.values[y]), C = a.fire.call(b, w, v, g, d);
|
|
2333
|
-
if (C) {
|
|
2334
|
-
const k = l.values[y];
|
|
2335
|
-
Object.keys(C).forEach((_) => {
|
|
2336
|
-
z(k, _) ? k[_] = C[_] : Y(k, _, C[_]);
|
|
2337
|
-
});
|
|
2338
|
-
}
|
|
2339
|
-
}
|
|
2340
|
-
return b;
|
|
2341
|
-
});
|
|
2342
|
-
return n.mutate(l).then(({ failures: v, results: y, numFailures: g, lastResult: b }) => {
|
|
2343
|
-
for (let w = 0; w < p.length; ++w) {
|
|
2344
|
-
const C = y ? y[w] : p[w], k = f[w];
|
|
2345
|
-
C == null ? k.onerror && k.onerror(v[w]) : k.onsuccess && k.onsuccess(l.type === "put" && m[w] ? l.values[w] : C);
|
|
2346
|
-
}
|
|
2347
|
-
return { failures: v, results: y, numFailures: g, lastResult: b };
|
|
2348
|
-
}).catch((v) => (f.forEach((y) => y.onerror && y.onerror(v)), Promise.reject(v)));
|
|
2349
|
-
});
|
|
2350
|
-
}
|
|
2351
|
-
function h(l, d, p) {
|
|
2352
|
-
return n.query({ trans: l, values: !1, query: { index: r, range: d }, limit: p }).then(({ result: m }) => c({ type: "delete", keys: m, trans: l }).then((f) => f.numFailures > 0 ? Promise.reject(f.failures[0]) : m.length < p ? { failures: [], numFailures: 0, lastResult: void 0 } : h(l, { ...d, lower: m[m.length - 1], lowerOpen: !0 }, p)));
|
|
2353
|
-
}
|
|
2354
|
-
} };
|
|
2355
|
-
} }) };
|
|
2356
|
-
function Jn(t, e, n) {
|
|
2357
|
-
try {
|
|
2358
|
-
if (!e || e.keys.length < t.length)
|
|
2359
|
-
return null;
|
|
2360
|
-
const r = [];
|
|
2361
|
-
for (let s = 0, i = 0; s < e.keys.length && i < t.length; ++s)
|
|
2362
|
-
L(e.keys[s], t[i]) === 0 && (r.push(n ? Ve(e.values[s]) : e.values[s]), ++i);
|
|
2363
|
-
return r.length === t.length ? r : null;
|
|
2364
|
-
} catch {
|
|
2365
|
-
return null;
|
|
2366
|
-
}
|
|
2367
|
-
}
|
|
2368
|
-
const Ur = { stack: "dbcore", level: -1, create: (t) => ({ table: (e) => {
|
|
2369
|
-
const n = t.table(e);
|
|
2370
|
-
return { ...n, getMany: (r) => {
|
|
2371
|
-
if (!r.cache)
|
|
2372
|
-
return n.getMany(r);
|
|
2373
|
-
const s = Jn(r.keys, r.trans._cache, r.cache === "clone");
|
|
2374
|
-
return s ? S.resolve(s) : n.getMany(r).then((i) => (r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? Ve(i) : i }, i));
|
|
2375
|
-
}, mutate: (r) => (r.type !== "add" && (r.trans._cache = null), n.mutate(r)) };
|
|
2376
|
-
} }) };
|
|
2377
|
-
function cn(t) {
|
|
2378
|
-
return !("from" in t);
|
|
2379
|
-
}
|
|
2380
|
-
const Q = function(t, e) {
|
|
2381
|
-
if (!this) {
|
|
2382
|
-
const n = new Q();
|
|
2383
|
-
return t && "d" in t && U(n, t), n;
|
|
2384
|
-
}
|
|
2385
|
-
U(this, arguments.length ? { d: 1, from: t, to: arguments.length > 1 ? e : t } : { d: 0 });
|
|
2386
|
-
};
|
|
2387
|
-
function We(t, e, n) {
|
|
2388
|
-
const r = L(e, n);
|
|
2389
|
-
if (isNaN(r))
|
|
2390
|
-
return;
|
|
2391
|
-
if (r > 0)
|
|
2392
|
-
throw RangeError();
|
|
2393
|
-
if (cn(t))
|
|
2394
|
-
return U(t, { from: e, to: n, d: 1 });
|
|
2395
|
-
const s = t.l, i = t.r;
|
|
2396
|
-
if (L(n, t.from) < 0)
|
|
2397
|
-
return s ? We(s, e, n) : t.l = { from: e, to: n, d: 1, l: null, r: null }, _n(t);
|
|
2398
|
-
if (L(e, t.to) > 0)
|
|
2399
|
-
return i ? We(i, e, n) : t.r = { from: e, to: n, d: 1, l: null, r: null }, _n(t);
|
|
2400
|
-
L(e, t.from) < 0 && (t.from = e, t.l = null, t.d = i ? i.d + 1 : 1), L(n, t.to) > 0 && (t.to = n, t.r = null, t.d = t.l ? t.l.d + 1 : 1);
|
|
2401
|
-
const o = !t.r;
|
|
2402
|
-
s && !t.l && mt(t, s), i && o && mt(t, i);
|
|
2403
|
-
}
|
|
2404
|
-
function mt(t, e) {
|
|
2405
|
-
cn(e) || function n(r, { from: s, to: i, l: o, r: u }) {
|
|
2406
|
-
We(r, s, i), o && n(r, o), u && n(r, u);
|
|
2407
|
-
}(t, e);
|
|
2408
|
-
}
|
|
2409
|
-
function Wr(t, e) {
|
|
2410
|
-
const n = Xt(e);
|
|
2411
|
-
let r = n.next();
|
|
2412
|
-
if (r.done)
|
|
2413
|
-
return !1;
|
|
2414
|
-
let s = r.value;
|
|
2415
|
-
const i = Xt(t);
|
|
2416
|
-
let o = i.next(s.from), u = o.value;
|
|
2417
|
-
for (; !r.done && !o.done; ) {
|
|
2418
|
-
if (L(u.from, s.to) <= 0 && L(u.to, s.from) >= 0)
|
|
2419
|
-
return !0;
|
|
2420
|
-
L(s.from, u.from) < 0 ? s = (r = n.next(u.from)).value : u = (o = i.next(s.from)).value;
|
|
2421
|
-
}
|
|
2422
|
-
return !1;
|
|
2423
|
-
}
|
|
2424
|
-
function Xt(t) {
|
|
2425
|
-
let e = cn(t) ? null : { s: 0, n: t };
|
|
2426
|
-
return { next(n) {
|
|
2427
|
-
const r = arguments.length > 0;
|
|
2428
|
-
for (; e; )
|
|
2429
|
-
switch (e.s) {
|
|
2430
|
-
case 0:
|
|
2431
|
-
if (e.s = 1, r)
|
|
2432
|
-
for (; e.n.l && L(n, e.n.from) < 0; )
|
|
2433
|
-
e = { up: e, n: e.n.l, s: 1 };
|
|
2434
|
-
else
|
|
2435
|
-
for (; e.n.l; )
|
|
2436
|
-
e = { up: e, n: e.n.l, s: 1 };
|
|
2437
|
-
case 1:
|
|
2438
|
-
if (e.s = 2, !r || L(n, e.n.to) <= 0)
|
|
2439
|
-
return { value: e.n, done: !1 };
|
|
2440
|
-
case 2:
|
|
2441
|
-
if (e.n.r) {
|
|
2442
|
-
e.s = 3, e = { up: e, n: e.n.r, s: 0 };
|
|
2443
|
-
continue;
|
|
2444
|
-
}
|
|
2445
|
-
case 3:
|
|
2446
|
-
e = e.up;
|
|
2447
|
-
}
|
|
2448
|
-
return { done: !0 };
|
|
2449
|
-
} };
|
|
2450
|
-
}
|
|
2451
|
-
function _n(t) {
|
|
2452
|
-
var e, n;
|
|
2453
|
-
const r = (((e = t.r) === null || e === void 0 ? void 0 : e.d) || 0) - (((n = t.l) === null || n === void 0 ? void 0 : n.d) || 0), s = r > 1 ? "r" : r < -1 ? "l" : "";
|
|
2454
|
-
if (s) {
|
|
2455
|
-
const i = s === "r" ? "l" : "r", o = { ...t }, u = t[s];
|
|
2456
|
-
t.from = u.from, t.to = u.to, t[s] = u[s], o[s] = u[i], t[i] = o, o.d = kn(o);
|
|
2457
|
-
}
|
|
2458
|
-
t.d = kn(t);
|
|
2459
|
-
}
|
|
2460
|
-
function kn({ r: t, l: e }) {
|
|
2461
|
-
return (t ? e ? Math.max(t.d, e.d) : t.d : e ? e.d : 0) + 1;
|
|
2462
|
-
}
|
|
2463
|
-
Ce(Q.prototype, { add(t) {
|
|
2464
|
-
return mt(this, t), this;
|
|
2465
|
-
}, addKey(t) {
|
|
2466
|
-
return We(this, t, t), this;
|
|
2467
|
-
}, addKeys(t) {
|
|
2468
|
-
return t.forEach((e) => We(this, e, e)), this;
|
|
2469
|
-
}, [Ot]() {
|
|
2470
|
-
return Xt(this);
|
|
2471
|
-
} });
|
|
2472
|
-
const Vr = { stack: "dbcore", level: 0, create: (t) => {
|
|
2473
|
-
const e = t.schema.name, n = new Q(t.MIN_KEY, t.MAX_KEY);
|
|
2474
|
-
return { ...t, table: (r) => {
|
|
2475
|
-
const s = t.table(r), { schema: i } = s, { primaryKey: o } = i, { extractKey: u, outbound: a } = o, c = { ...s, mutate: (d) => {
|
|
2476
|
-
const p = d.trans, m = p.mutatedParts || (p.mutatedParts = {}), f = (k) => {
|
|
2477
|
-
const _ = `idb://${e}/${r}/${k}`;
|
|
2478
|
-
return m[_] || (m[_] = new Q());
|
|
2479
|
-
}, v = f(""), y = f(":dels"), { type: g } = d;
|
|
2480
|
-
let [b, w] = d.type === "deleteRange" ? [d.range] : d.type === "delete" ? [d.keys] : d.values.length < 50 ? [[], d.values] : [];
|
|
2481
|
-
const C = d.trans._cache;
|
|
2482
|
-
return s.mutate(d).then((k) => {
|
|
2483
|
-
if (M(b)) {
|
|
2484
|
-
g !== "delete" && (b = k.results), v.addKeys(b);
|
|
2485
|
-
const _ = Jn(b, C);
|
|
2486
|
-
_ || g === "add" || y.addKeys(b), (_ || w) && function(O, x, R, A) {
|
|
2487
|
-
function q(B) {
|
|
2488
|
-
const j = O(B.name || "");
|
|
2489
|
-
function ge(W) {
|
|
2490
|
-
return W != null ? B.extractKey(W) : null;
|
|
2491
|
-
}
|
|
2492
|
-
const ye = (W) => B.multiEntry && M(W) ? W.forEach((le) => j.addKey(le)) : j.addKey(W);
|
|
2493
|
-
(R || A).forEach((W, le) => {
|
|
2494
|
-
const Oe = R && ge(R[le]), vt = A && ge(A[le]);
|
|
2495
|
-
L(Oe, vt) !== 0 && (Oe != null && ye(Oe), vt != null && ye(vt));
|
|
2496
|
-
});
|
|
2497
|
-
}
|
|
2498
|
-
x.indexes.forEach(q);
|
|
2499
|
-
}(f, i, _, w);
|
|
2500
|
-
} else if (b) {
|
|
2501
|
-
const _ = { from: b.lower, to: b.upper };
|
|
2502
|
-
y.add(_), v.add(_);
|
|
2503
|
-
} else
|
|
2504
|
-
v.add(n), y.add(n), i.indexes.forEach((_) => f(_.name).add(n));
|
|
2505
|
-
return k;
|
|
2506
|
-
});
|
|
2507
|
-
} }, h = ({ query: { index: d, range: p } }) => {
|
|
2508
|
-
var m, f;
|
|
2509
|
-
return [d, new Q((m = p.lower) !== null && m !== void 0 ? m : t.MIN_KEY, (f = p.upper) !== null && f !== void 0 ? f : t.MAX_KEY)];
|
|
2510
|
-
}, l = { get: (d) => [o, new Q(d.key)], getMany: (d) => [o, new Q().addKeys(d.keys)], count: h, query: h, openCursor: h };
|
|
2511
|
-
return I(l).forEach((d) => {
|
|
2512
|
-
c[d] = function(p) {
|
|
2513
|
-
const { subscr: m } = E;
|
|
2514
|
-
if (m) {
|
|
2515
|
-
const f = (w) => {
|
|
2516
|
-
const C = `idb://${e}/${r}/${w}`;
|
|
2517
|
-
return m[C] || (m[C] = new Q());
|
|
2518
|
-
}, v = f(""), y = f(":dels"), [g, b] = l[d](p);
|
|
2519
|
-
if (f(g.name || "").add(b), !g.isPrimaryKey) {
|
|
2520
|
-
if (d !== "count") {
|
|
2521
|
-
const w = d === "query" && a && p.values && s.query({ ...p, values: !1 });
|
|
2522
|
-
return s[d].apply(this, arguments).then((C) => {
|
|
2523
|
-
if (d === "query") {
|
|
2524
|
-
if (a && p.values)
|
|
2525
|
-
return w.then(({ result: _ }) => (v.addKeys(_), C));
|
|
2526
|
-
const k = p.values ? C.result.map(u) : C.result;
|
|
2527
|
-
p.values ? v.addKeys(k) : y.addKeys(k);
|
|
2528
|
-
} else if (d === "openCursor") {
|
|
2529
|
-
const k = C, _ = p.values;
|
|
2530
|
-
return k && Object.create(k, { key: { get: () => (y.addKey(k.primaryKey), k.key) }, primaryKey: { get() {
|
|
2531
|
-
const O = k.primaryKey;
|
|
2532
|
-
return y.addKey(O), O;
|
|
2533
|
-
} }, value: { get: () => (_ && v.addKey(k.primaryKey), k.value) } });
|
|
2534
|
-
}
|
|
2535
|
-
return C;
|
|
2536
|
-
});
|
|
2537
|
-
}
|
|
2538
|
-
y.add(n);
|
|
2539
|
-
}
|
|
2540
|
-
}
|
|
2541
|
-
return s[d].apply(this, arguments);
|
|
2542
|
-
};
|
|
2543
|
-
}), c;
|
|
2544
|
-
} };
|
|
2545
|
-
} };
|
|
2546
|
-
class Se {
|
|
2547
|
-
constructor(e, n) {
|
|
2548
|
-
this._middlewares = {}, this.verno = 0;
|
|
2549
|
-
const r = Se.dependencies;
|
|
2550
|
-
this._options = n = { addons: Se.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, ...n }, this._deps = { indexedDB: n.indexedDB, IDBKeyRange: n.IDBKeyRange };
|
|
2551
|
-
const { addons: s } = n;
|
|
2552
|
-
this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
2553
|
-
const i = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: K, dbReadyPromise: null, cancelOpen: K, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3 };
|
|
2554
|
-
var o;
|
|
2555
|
-
i.dbReadyPromise = new S((u) => {
|
|
2556
|
-
i.dbReadyResolve = u;
|
|
2557
|
-
}), i.openCanceller = new S((u, a) => {
|
|
2558
|
-
i.cancelOpen = a;
|
|
2559
|
-
}), this._state = i, this.name = e, this.on = Ie(this, "populate", "blocked", "versionchange", "close", { ready: [nn, K] }), this.on.ready.subscribe = Sn(this.on.ready.subscribe, (u) => (a, c) => {
|
|
2560
|
-
Se.vip(() => {
|
|
2561
|
-
const h = this._state;
|
|
2562
|
-
if (h.openComplete)
|
|
2563
|
-
h.dbOpenError || S.resolve().then(a), c && u(a);
|
|
2564
|
-
else if (h.onReadyBeingFired)
|
|
2565
|
-
h.onReadyBeingFired.push(a), c && u(a);
|
|
2566
|
-
else {
|
|
2567
|
-
u(a);
|
|
2568
|
-
const l = this;
|
|
2569
|
-
c || u(function d() {
|
|
2570
|
-
l.on.ready.unsubscribe(a), l.on.ready.unsubscribe(d);
|
|
2571
|
-
});
|
|
2572
|
-
}
|
|
2573
|
-
});
|
|
2574
|
-
}), this.Collection = (o = this, Ae(Tr.prototype, function(u, a) {
|
|
2575
|
-
this.db = o;
|
|
2576
|
-
let c = Vn, h = null;
|
|
2577
|
-
if (a)
|
|
2578
|
-
try {
|
|
2579
|
-
c = a();
|
|
2580
|
-
} catch (m) {
|
|
2581
|
-
h = m;
|
|
2582
|
-
}
|
|
2583
|
-
const l = u._ctx, d = l.table, p = d.hook.reading.fire;
|
|
2584
|
-
this._ctx = { table: d, index: l.index, isPrimKey: !l.index || d.schema.primKey.keyPath && l.index === d.schema.primKey.name, range: c, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: h, or: l.or, valueMapper: p !== Fe ? p : null };
|
|
2585
|
-
})), this.Table = function(u) {
|
|
2586
|
-
return Ae(Pr.prototype, function(a, c, h) {
|
|
2587
|
-
this.db = u, this._tx = h, this.name = a, this.schema = c, this.hook = u._allTables[a] ? u._allTables[a].hook : Ie(null, { creating: [mr, K], reading: [pr, Fe], updating: [yr, K], deleting: [gr, K] });
|
|
2588
|
-
});
|
|
2589
|
-
}(this), this.Transaction = function(u) {
|
|
2590
|
-
return Ae($r.prototype, function(a, c, h, l, d) {
|
|
2591
|
-
this.db = u, this.mode = a, this.storeNames = c, this.schema = h, this.chromeTransactionDurability = l, this.idbtrans = null, this.on = Ie(this, "complete", "error", "abort"), this.parent = d || 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 S((p, m) => {
|
|
2592
|
-
this._resolve = p, this._reject = m;
|
|
2593
|
-
}), this._completion.then(() => {
|
|
2594
|
-
this.active = !1, this.on.complete.fire();
|
|
2595
|
-
}, (p) => {
|
|
2596
|
-
var m = this.active;
|
|
2597
|
-
return this.active = !1, this.on.error.fire(p), this.parent ? this.parent._reject(p) : m && this.idbtrans && this.idbtrans.abort(), D(p);
|
|
2598
|
-
});
|
|
2599
|
-
});
|
|
2600
|
-
}(this), this.Version = function(u) {
|
|
2601
|
-
return Ae(Dr.prototype, function(a) {
|
|
2602
|
-
this.db = u, this._cfg = { version: a, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
2603
|
-
});
|
|
2604
|
-
}(this), this.WhereClause = function(u) {
|
|
2605
|
-
return Ae(Yn.prototype, function(a, c, h) {
|
|
2606
|
-
this.db = u, this._ctx = { table: a, index: c === ":id" ? null : c, or: h };
|
|
2607
|
-
const l = u._deps.indexedDB;
|
|
2608
|
-
if (!l)
|
|
2609
|
-
throw new P.MissingAPI();
|
|
2610
|
-
this._cmp = this._ascending = l.cmp.bind(l), this._descending = (d, p) => l.cmp(p, d), this._max = (d, p) => l.cmp(d, p) > 0 ? d : p, this._min = (d, p) => l.cmp(d, p) < 0 ? d : p, this._IDBKeyRange = u._deps.IDBKeyRange;
|
|
2611
|
-
});
|
|
2612
|
-
}(this), this.on("versionchange", (u) => {
|
|
2613
|
-
u.newVersion > 0 ? console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`), this.close();
|
|
2614
|
-
}), this.on("blocked", (u) => {
|
|
2615
|
-
!u.newVersion || u.newVersion < u.oldVersion ? console.warn(`Dexie.delete('${this.name}') was blocked`) : console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${u.oldVersion / 10}`);
|
|
2616
|
-
}), this._maxKey = Ue(n.IDBKeyRange), this._createTransaction = (u, a, c, h) => new this.Transaction(u, a, c, this._options.chromeTransactionDurability, h), this._fireOnBlocked = (u) => {
|
|
2617
|
-
this.on("blocked").fire(u), je.filter((a) => a.name === this.name && a !== this && !a._state.vcFired).map((a) => a.on("versionchange").fire(u));
|
|
2618
|
-
}, this.use(qr), this.use(Lr), this.use(Vr), this.use(Ur), this.vip = Object.create(this, { _vip: { value: !0 } }), s.forEach((u) => u(this));
|
|
2619
|
-
}
|
|
2620
|
-
version(e) {
|
|
2621
|
-
if (isNaN(e) || e < 0.1)
|
|
2622
|
-
throw new P.Type("Given version is not a positive number");
|
|
2623
|
-
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened)
|
|
2624
|
-
throw new P.Schema("Cannot add version when database is open");
|
|
2625
|
-
this.verno = Math.max(this.verno, e);
|
|
2626
|
-
const n = this._versions;
|
|
2627
|
-
var r = n.filter((s) => s._cfg.version === e)[0];
|
|
2628
|
-
return r || (r = new this.Version(e), n.push(r), n.sort(jr), r.stores({}), this._state.autoSchema = !1, r);
|
|
2629
|
-
}
|
|
2630
|
-
_whenReady(e) {
|
|
2631
|
-
return this.idbdb && (this._state.openComplete || E.letThrough || this._vip) ? e() : new S((n, r) => {
|
|
2632
|
-
if (this._state.openComplete)
|
|
2633
|
-
return r(new P.DatabaseClosed(this._state.dbOpenError));
|
|
2634
|
-
if (!this._state.isBeingOpened) {
|
|
2635
|
-
if (!this._options.autoOpen)
|
|
2636
|
-
return void r(new P.DatabaseClosed());
|
|
2637
|
-
this.open().catch(K);
|
|
2638
|
-
}
|
|
2639
|
-
this._state.dbReadyPromise.then(n, r);
|
|
2640
|
-
}).then(e);
|
|
2641
|
-
}
|
|
2642
|
-
use({ stack: e, create: n, level: r, name: s }) {
|
|
2643
|
-
s && this.unuse({ stack: e, name: s });
|
|
2644
|
-
const i = this._middlewares[e] || (this._middlewares[e] = []);
|
|
2645
|
-
return i.push({ stack: e, create: n, level: r ?? 10, name: s }), i.sort((o, u) => o.level - u.level), this;
|
|
2646
|
-
}
|
|
2647
|
-
unuse({ stack: e, name: n, create: r }) {
|
|
2648
|
-
return e && this._middlewares[e] && (this._middlewares[e] = this._middlewares[e].filter((s) => r ? s.create !== r : !!n && s.name !== n)), this;
|
|
2649
|
-
}
|
|
2650
|
-
open() {
|
|
2651
|
-
return Fr(this);
|
|
2652
|
-
}
|
|
2653
|
-
_close() {
|
|
2654
|
-
const e = this._state, n = je.indexOf(this);
|
|
2655
|
-
if (n >= 0 && je.splice(n, 1), this.idbdb) {
|
|
2656
|
-
try {
|
|
2657
|
-
this.idbdb.close();
|
|
2658
|
-
} catch {
|
|
2659
|
-
}
|
|
2660
|
-
this._novip.idbdb = null;
|
|
2661
|
-
}
|
|
2662
|
-
e.dbReadyPromise = new S((r) => {
|
|
2663
|
-
e.dbReadyResolve = r;
|
|
2664
|
-
}), e.openCanceller = new S((r, s) => {
|
|
2665
|
-
e.cancelOpen = s;
|
|
2666
|
-
});
|
|
2667
|
-
}
|
|
2668
|
-
close() {
|
|
2669
|
-
this._close();
|
|
2670
|
-
const e = this._state;
|
|
2671
|
-
this._options.autoOpen = !1, e.dbOpenError = new P.DatabaseClosed(), e.isBeingOpened && e.cancelOpen(e.dbOpenError);
|
|
2672
|
-
}
|
|
2673
|
-
delete() {
|
|
2674
|
-
const e = arguments.length > 0, n = this._state;
|
|
2675
|
-
return new S((r, s) => {
|
|
2676
|
-
const i = () => {
|
|
2677
|
-
this.close();
|
|
2678
|
-
var o = this._deps.indexedDB.deleteDatabase(this.name);
|
|
2679
|
-
o.onsuccess = N(() => {
|
|
2680
|
-
(function({ indexedDB: u, IDBKeyRange: a }, c) {
|
|
2681
|
-
!un(u) && c !== yt && an(u, a).delete(c).catch(K);
|
|
2682
|
-
})(this._deps, this.name), r();
|
|
2683
|
-
}), o.onerror = H(s), o.onblocked = this._fireOnBlocked;
|
|
2684
|
-
};
|
|
2685
|
-
if (e)
|
|
2686
|
-
throw new P.InvalidArgument("Arguments not allowed in db.delete()");
|
|
2687
|
-
n.isBeingOpened ? n.dbReadyPromise.then(i) : i();
|
|
2688
|
-
});
|
|
2689
|
-
}
|
|
2690
|
-
backendDB() {
|
|
2691
|
-
return this.idbdb;
|
|
2692
|
-
}
|
|
2693
|
-
isOpen() {
|
|
2694
|
-
return this.idbdb !== null;
|
|
2695
|
-
}
|
|
2696
|
-
hasBeenClosed() {
|
|
2697
|
-
const e = this._state.dbOpenError;
|
|
2698
|
-
return e && e.name === "DatabaseClosed";
|
|
2699
|
-
}
|
|
2700
|
-
hasFailed() {
|
|
2701
|
-
return this._state.dbOpenError !== null;
|
|
2702
|
-
}
|
|
2703
|
-
dynamicallyOpened() {
|
|
2704
|
-
return this._state.autoSchema;
|
|
2705
|
-
}
|
|
2706
|
-
get tables() {
|
|
2707
|
-
return I(this._allTables).map((e) => this._allTables[e]);
|
|
2708
|
-
}
|
|
2709
|
-
transaction() {
|
|
2710
|
-
const e = Mr.apply(this, arguments);
|
|
2711
|
-
return this._transaction.apply(this, e);
|
|
2712
|
-
}
|
|
2713
|
-
_transaction(e, n, r) {
|
|
2714
|
-
let s = E.trans;
|
|
2715
|
-
s && s.db === this && e.indexOf("!") === -1 || (s = null);
|
|
2716
|
-
const i = e.indexOf("?") !== -1;
|
|
2717
|
-
let o, u;
|
|
2718
|
-
e = e.replace("!", "").replace("?", "");
|
|
2719
|
-
try {
|
|
2720
|
-
if (u = n.map((c) => {
|
|
2721
|
-
var h = c instanceof this.Table ? c.name : c;
|
|
2722
|
-
if (typeof h != "string")
|
|
2723
|
-
throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
2724
|
-
return h;
|
|
2725
|
-
}), e == "r" || e === _t)
|
|
2726
|
-
o = _t;
|
|
2727
|
-
else {
|
|
2728
|
-
if (e != "rw" && e != kt)
|
|
2729
|
-
throw new P.InvalidArgument("Invalid transaction mode: " + e);
|
|
2730
|
-
o = kt;
|
|
2731
|
-
}
|
|
2732
|
-
if (s) {
|
|
2733
|
-
if (s.mode === _t && o === kt) {
|
|
2734
|
-
if (!i)
|
|
2735
|
-
throw new P.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
2736
|
-
s = null;
|
|
2737
|
-
}
|
|
2738
|
-
s && u.forEach((c) => {
|
|
2739
|
-
if (s && s.storeNames.indexOf(c) === -1) {
|
|
2740
|
-
if (!i)
|
|
2741
|
-
throw new P.SubTransaction("Table " + c + " not included in parent transaction.");
|
|
2742
|
-
s = null;
|
|
2743
|
-
}
|
|
2744
|
-
}), i && s && !s.active && (s = null);
|
|
2745
|
-
}
|
|
2746
|
-
} catch (c) {
|
|
2747
|
-
return s ? s._promise(null, (h, l) => {
|
|
2748
|
-
l(c);
|
|
2749
|
-
}) : D(c);
|
|
2750
|
-
}
|
|
2751
|
-
const a = Qn.bind(null, this, o, u, s, r);
|
|
2752
|
-
return s ? s._promise(o, a, "lock") : E.trans ? Te(E.transless, () => this._whenReady(a)) : this._whenReady(a);
|
|
2753
|
-
}
|
|
2754
|
-
table(e) {
|
|
2755
|
-
if (!z(this._allTables, e))
|
|
2756
|
-
throw new P.InvalidTable(`Table ${e} does not exist`);
|
|
2757
|
-
return this._allTables[e];
|
|
2758
|
-
}
|
|
2759
|
-
}
|
|
2760
|
-
const zr = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable";
|
|
2761
|
-
class Yr {
|
|
2762
|
-
constructor(e) {
|
|
2763
|
-
this._subscribe = e;
|
|
2764
|
-
}
|
|
2765
|
-
subscribe(e, n, r) {
|
|
2766
|
-
return this._subscribe(e && typeof e != "function" ? e : { next: e, error: n, complete: r });
|
|
2767
|
-
}
|
|
2768
|
-
[zr]() {
|
|
2769
|
-
return this;
|
|
2770
|
-
}
|
|
2771
|
-
}
|
|
2772
|
-
function Zn(t, e) {
|
|
2773
|
-
return I(e).forEach((n) => {
|
|
2774
|
-
mt(t[n] || (t[n] = new Q()), e[n]);
|
|
2775
|
-
}), t;
|
|
2776
|
-
}
|
|
2777
|
-
function Hr(t) {
|
|
2778
|
-
let e, n = !1;
|
|
2779
|
-
const r = new Yr((s) => {
|
|
2780
|
-
const i = Zt(t);
|
|
2781
|
-
let o = !1, u = {}, a = {};
|
|
2782
|
-
const c = { get closed() {
|
|
2783
|
-
return o;
|
|
2784
|
-
}, unsubscribe: () => {
|
|
2785
|
-
o = !0, ue.storagemutated.unsubscribe(p);
|
|
2786
|
-
} };
|
|
2787
|
-
s.start && s.start(c);
|
|
2788
|
-
let h = !1, l = !1;
|
|
2789
|
-
function d() {
|
|
2790
|
-
return I(a).some((f) => u[f] && Wr(u[f], a[f]));
|
|
2791
|
-
}
|
|
2792
|
-
const p = (f) => {
|
|
2793
|
-
Zn(u, f), d() && m();
|
|
2794
|
-
}, m = () => {
|
|
2795
|
-
if (h || o)
|
|
2796
|
-
return;
|
|
2797
|
-
u = {};
|
|
2798
|
-
const f = {}, v = function(y) {
|
|
2799
|
-
i && Pe();
|
|
2800
|
-
const g = () => oe(t, { subscr: y, trans: null }), b = E.trans ? Te(E.transless, g) : g();
|
|
2801
|
-
return i && b.then(ne, ne), b;
|
|
2802
|
-
}(f);
|
|
2803
|
-
l || (ue(Le, p), l = !0), h = !0, Promise.resolve(v).then((y) => {
|
|
2804
|
-
n = !0, e = y, h = !1, o || (d() ? m() : (u = {}, a = f, s.next && s.next(y)));
|
|
2805
|
-
}, (y) => {
|
|
2806
|
-
h = !1, n = !1, s.error && s.error(y), c.unsubscribe();
|
|
2807
|
-
});
|
|
2808
|
-
};
|
|
2809
|
-
return m(), c;
|
|
2810
|
-
});
|
|
2811
|
-
return r.hasValue = () => n, r.getValue = () => e, r;
|
|
2812
|
-
}
|
|
2813
|
-
let Qt;
|
|
2814
|
-
try {
|
|
2815
|
-
Qt = { indexedDB: $.indexedDB || $.mozIndexedDB || $.webkitIndexedDB || $.msIndexedDB, IDBKeyRange: $.IDBKeyRange || $.webkitIDBKeyRange };
|
|
2816
|
-
} catch {
|
|
2817
|
-
Qt = { indexedDB: null, IDBKeyRange: null };
|
|
2818
|
-
}
|
|
2819
|
-
const ce = Se;
|
|
2820
|
-
function at(t) {
|
|
2821
|
-
let e = Z;
|
|
2822
|
-
try {
|
|
2823
|
-
Z = !0, ue.storagemutated.fire(t);
|
|
2824
|
-
} finally {
|
|
2825
|
-
Z = e;
|
|
2826
|
-
}
|
|
2827
|
-
}
|
|
2828
|
-
Ce(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) => new ce(t, { addons: [] }).open().then((e) => (e.close(), !0)).catch("NoSuchDatabaseError", () => !1), getDatabaseNames(t) {
|
|
2829
|
-
try {
|
|
2830
|
-
return function({ indexedDB: e, IDBKeyRange: n }) {
|
|
2831
|
-
return un(e) ? Promise.resolve(e.databases()).then((r) => r.map((s) => s.name).filter((s) => s !== yt)) : an(e, n).toCollection().primaryKeys();
|
|
2832
|
-
}(ce.dependencies).then(t);
|
|
2833
|
-
} catch {
|
|
2834
|
-
return D(new P.MissingAPI());
|
|
2835
|
-
}
|
|
2836
|
-
}, defineClass: () => function(t) {
|
|
2837
|
-
U(this, t);
|
|
2838
|
-
}, ignoreTransaction: (t) => E.trans ? Te(E.transless, t) : t(), vip: Ht, async: function(t) {
|
|
2839
|
-
return function() {
|
|
2840
|
-
try {
|
|
2841
|
-
var e = Gt(t.apply(this, arguments));
|
|
2842
|
-
return e && typeof e.then == "function" ? e : S.resolve(e);
|
|
2843
|
-
} catch (n) {
|
|
2844
|
-
return D(n);
|
|
2845
|
-
}
|
|
2846
|
-
};
|
|
2847
|
-
}, spawn: function(t, e, n) {
|
|
2848
|
-
try {
|
|
2849
|
-
var r = Gt(t.apply(n, e || []));
|
|
2850
|
-
return r && typeof r.then == "function" ? r : S.resolve(r);
|
|
2851
|
-
} catch (s) {
|
|
2852
|
-
return D(s);
|
|
2853
|
-
}
|
|
2854
|
-
}, currentTransaction: { get: () => E.trans || null }, waitFor: function(t, e) {
|
|
2855
|
-
const n = S.resolve(typeof t == "function" ? ce.ignoreTransaction(t) : t).timeout(e || 6e4);
|
|
2856
|
-
return E.trans ? E.trans.waitFor(n) : n;
|
|
2857
|
-
}, Promise: S, debug: { get: () => G, set: (t) => {
|
|
2858
|
-
An(t, t === "dexie" ? () => !0 : Wn);
|
|
2859
|
-
} }, derive: _e, extend: U, props: Ce, override: Sn, Events: Ie, on: ue, liveQuery: Hr, extendObservabilitySet: Zn, getByKeyPath: te, setByKeyPath: Y, delByKeyPath: function(t, e) {
|
|
2860
|
-
typeof e == "string" ? Y(t, e, void 0) : "length" in e && [].map.call(e, function(n) {
|
|
2861
|
-
Y(t, n, void 0);
|
|
2862
|
-
});
|
|
2863
|
-
}, shallowClone: Pn, deepClone: Ve, getObjectDiff: ln, cmp: L, asap: Cn, minKey: Mt, addons: [], connections: je, errnames: tn, dependencies: Qt, semVer: mn, version: mn.split(".").map((t) => parseInt(t)).reduce((t, e, n) => t + e / Math.pow(10, 2 * n)) }), ce.maxKey = Ue(ce.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (ue(Le, (t) => {
|
|
2864
|
-
if (!Z) {
|
|
2865
|
-
let e;
|
|
2866
|
-
gt ? (e = document.createEvent("CustomEvent"), e.initCustomEvent(ie, !0, !0, t)) : e = new CustomEvent(ie, { detail: t }), Z = !0, dispatchEvent(e), Z = !1;
|
|
2867
|
-
}
|
|
2868
|
-
}), addEventListener(ie, ({ detail: t }) => {
|
|
2869
|
-
Z || at(t);
|
|
2870
|
-
}));
|
|
2871
|
-
let Z = !1;
|
|
2872
|
-
if (typeof BroadcastChannel < "u") {
|
|
2873
|
-
const t = new BroadcastChannel(ie);
|
|
2874
|
-
typeof t.unref == "function" && t.unref(), ue(Le, (e) => {
|
|
2875
|
-
Z || t.postMessage(e);
|
|
2876
|
-
}), t.onmessage = (e) => {
|
|
2877
|
-
e.data && at(e.data);
|
|
2878
|
-
};
|
|
2879
|
-
} else if (typeof self < "u" && typeof navigator < "u") {
|
|
2880
|
-
ue(Le, (e) => {
|
|
2881
|
-
try {
|
|
2882
|
-
Z || (typeof localStorage < "u" && localStorage.setItem(ie, JSON.stringify({ trig: Math.random(), changedParts: e })), typeof self.clients == "object" && [...self.clients.matchAll({ includeUncontrolled: !0 })].forEach((n) => n.postMessage({ type: ie, changedParts: e })));
|
|
2883
|
-
} catch {
|
|
2884
|
-
}
|
|
2885
|
-
}), typeof addEventListener < "u" && addEventListener("storage", (e) => {
|
|
2886
|
-
if (e.key === ie) {
|
|
2887
|
-
const n = JSON.parse(e.newValue);
|
|
2888
|
-
n && at(n.changedParts);
|
|
2889
|
-
}
|
|
2890
|
-
});
|
|
2891
|
-
const t = self.document && navigator.serviceWorker;
|
|
2892
|
-
t && t.addEventListener("message", function({ data: e }) {
|
|
2893
|
-
e && e.type === ie && at(e.changedParts);
|
|
2894
|
-
});
|
|
2895
|
-
}
|
|
2896
|
-
S.rejectionMapper = function(t, e) {
|
|
2897
|
-
if (!t || t instanceof ke || t instanceof TypeError || t instanceof SyntaxError || !t.name || !hn[t.name])
|
|
2898
|
-
return t;
|
|
2899
|
-
var n = new hn[t.name](e || t.message, t);
|
|
2900
|
-
return "stack" in t && ee(n, "stack", { get: function() {
|
|
2901
|
-
return this.inner.stack;
|
|
2902
|
-
} }), n;
|
|
2903
|
-
}, An(G, Wn);
|
|
2904
|
-
export {
|
|
2905
|
-
Xr as N,
|
|
2906
|
-
Qr as X,
|
|
2907
|
-
rr as n
|
|
2908
|
-
};
|