@dialecte/core 0.0.18 → 0.0.19
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/index.js +576 -579
- package/dist/io/export/main.d.ts +2 -8
- package/dist/io/export/main.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function ra(l) {
|
|
2
2
|
const { contextPromise: c } = l;
|
|
3
3
|
return async function() {
|
|
4
4
|
const u = await c;
|
|
@@ -18,14 +18,14 @@ const uo = [
|
|
|
18
18
|
"children",
|
|
19
19
|
"parent",
|
|
20
20
|
"value"
|
|
21
|
-
], co = [...uo, "status"],
|
|
21
|
+
], co = [...uo, "status"], oa = [...co, "tree"];
|
|
22
22
|
function pr(l, c) {
|
|
23
23
|
if (typeof l != "object" || l === null)
|
|
24
24
|
return !1;
|
|
25
25
|
const u = Object.keys(l);
|
|
26
26
|
return c.every((a) => a in l) && u.every((a) => c.includes(a)) && u.length === c.length;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function aa(l) {
|
|
29
29
|
return Array.isArray(l);
|
|
30
30
|
}
|
|
31
31
|
function rs(l) {
|
|
@@ -35,7 +35,7 @@ function os(l) {
|
|
|
35
35
|
return pr(l, co);
|
|
36
36
|
}
|
|
37
37
|
function as(l) {
|
|
38
|
-
return pr(l,
|
|
38
|
+
return pr(l, oa);
|
|
39
39
|
}
|
|
40
40
|
function Tn(l) {
|
|
41
41
|
return {
|
|
@@ -64,7 +64,7 @@ function Nn(l) {
|
|
|
64
64
|
}
|
|
65
65
|
function lo(l) {
|
|
66
66
|
const { tagName: c, attributes: u, dialecteConfig: a } = l;
|
|
67
|
-
return
|
|
67
|
+
return aa(u) ? u : Object.entries(u).map(
|
|
68
68
|
([d, m]) => ({
|
|
69
69
|
name: d,
|
|
70
70
|
value: m,
|
|
@@ -73,8 +73,8 @@ function lo(l) {
|
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
function fo(l) {
|
|
76
|
-
const { record: c, dialecteConfig: u } = l, { id: a, tagName: d, attributes: m, namespace: g, value: b } = c,
|
|
77
|
-
id:
|
|
76
|
+
const { record: c, dialecteConfig: u } = l, { id: a, tagName: d, attributes: m, namespace: g, value: b } = c, C = a ?? crypto.randomUUID(), I = m ? lo({ tagName: d, attributes: m, dialecteConfig: u }) : [], K = {
|
|
77
|
+
id: C,
|
|
78
78
|
tagName: d,
|
|
79
79
|
attributes: I,
|
|
80
80
|
namespace: g ?? {
|
|
@@ -105,11 +105,11 @@ function fo(l) {
|
|
|
105
105
|
record: F
|
|
106
106
|
})), F;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function ia(l) {
|
|
109
109
|
const { attributes: c, name: u } = l;
|
|
110
110
|
return c.find((m) => m.name === u)?.value || "";
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function sa(l) {
|
|
113
113
|
const { attributes: c } = l;
|
|
114
114
|
return c.reduce(
|
|
115
115
|
(u, a) => {
|
|
@@ -121,14 +121,14 @@ function ua(l) {
|
|
|
121
121
|
}
|
|
122
122
|
async function ho(l) {
|
|
123
123
|
const { context: c, dialecteConfig: u, databaseInstance: a, tagName: d, attributes: m } = l;
|
|
124
|
-
return (await
|
|
124
|
+
return (await ua({
|
|
125
125
|
tagName: d,
|
|
126
126
|
stagedOperations: c.stagedOperations,
|
|
127
127
|
dialecteConfig: u,
|
|
128
128
|
databaseInstance: a,
|
|
129
129
|
type: "chain"
|
|
130
130
|
})).filter(
|
|
131
|
-
(
|
|
131
|
+
(C) => gr({ record: C, attributeFilter: m })
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
134
|
function gr(l) {
|
|
@@ -137,7 +137,7 @@ function gr(l) {
|
|
|
137
137
|
return !0;
|
|
138
138
|
for (const [a, d] of Object.entries(u)) {
|
|
139
139
|
if (d === void 0) continue;
|
|
140
|
-
const m =
|
|
140
|
+
const m = ia({
|
|
141
141
|
attributes: c.attributes,
|
|
142
142
|
name: a
|
|
143
143
|
});
|
|
@@ -161,23 +161,23 @@ async function Qt(l) {
|
|
|
161
161
|
if (b?.status === "deleted") return;
|
|
162
162
|
if (b)
|
|
163
163
|
return g === "raw" ? b.record : Te({ record: b.record, status: b.status });
|
|
164
|
-
const
|
|
164
|
+
const C = d.database.tables.xmlElements.name, I = await m.table(C).get(c);
|
|
165
165
|
if (I)
|
|
166
166
|
return ye(I.tagName === u, "Element tagName mismatch"), g === "raw" ? I : Te({ record: I });
|
|
167
167
|
}
|
|
168
|
-
async function
|
|
169
|
-
const { stagedOperations: c, tagName: u, dialecteConfig: a, databaseInstance: d, type: m = "raw" } = l, g = a.database.tables.xmlElements.name, b = await d.table(g).where({ tagName: u }).toArray(),
|
|
168
|
+
async function ua(l) {
|
|
169
|
+
const { stagedOperations: c, tagName: u, dialecteConfig: a, databaseInstance: d, type: m = "raw" } = l, g = a.database.tables.xmlElements.name, b = await d.table(g).where({ tagName: u }).toArray(), C = new Map(
|
|
170
170
|
b.map((I) => [I.id, m === "raw" ? I : Te({ record: I })])
|
|
171
171
|
);
|
|
172
172
|
for (const I of c)
|
|
173
|
-
(I.status === "created" || I.status === "updated") && I.newRecord.tagName === u && (m === "chain" ?
|
|
173
|
+
(I.status === "created" || I.status === "updated") && I.newRecord.tagName === u && (m === "chain" ? C.set(
|
|
174
174
|
I.newRecord.id,
|
|
175
175
|
Te({ record: I.newRecord, status: I.status })
|
|
176
|
-
) :
|
|
176
|
+
) : C.set(
|
|
177
177
|
I.newRecord.id,
|
|
178
178
|
I.newRecord
|
|
179
|
-
)), I.status === "deleted" && I.oldRecord?.tagName === u &&
|
|
180
|
-
return Array.from(
|
|
179
|
+
)), I.status === "deleted" && I.oldRecord?.tagName === u && C.delete(I.oldRecord.id);
|
|
180
|
+
return Array.from(C.values());
|
|
181
181
|
}
|
|
182
182
|
function yr(l) {
|
|
183
183
|
const { dialecteConfig: c, stagedOperations: u, id: a, tagName: d, throwOnDeleted: m = !0 } = l;
|
|
@@ -185,23 +185,23 @@ function yr(l) {
|
|
|
185
185
|
c.singletonElements?.includes(d) || a,
|
|
186
186
|
`Element ${d} requires an id`
|
|
187
187
|
);
|
|
188
|
-
const g = [...u].reverse().find((
|
|
188
|
+
const g = [...u].reverse().find((C) => a !== void 0 ? C.status === "created" || C.status === "updated" ? C.newRecord.id === a : C.status === "deleted" ? C.oldRecord.id === a : !1 : (C.status === "deleted" ? C.oldRecord : C.newRecord).tagName === d);
|
|
189
189
|
if (!g) return;
|
|
190
190
|
if (g.status === "deleted") {
|
|
191
|
-
const
|
|
192
|
-
if (m) throw new Error(`Element${
|
|
191
|
+
const C = d ? ` ${d}` : "", I = a ? ` with id ${a}` : "";
|
|
192
|
+
if (m) throw new Error(`Element${C}${I} has been deleted`);
|
|
193
193
|
}
|
|
194
194
|
const b = g.status === "deleted" ? g.oldRecord : g.newRecord;
|
|
195
195
|
if (b.tagName !== d) {
|
|
196
|
-
const
|
|
197
|
-
throw new Error(`Element tagName mismatch: expected ${d}, got ${b.tagName}${
|
|
196
|
+
const C = a ? ` for id ${a}` : "";
|
|
197
|
+
throw new Error(`Element tagName mismatch: expected ${d}, got ${b.tagName}${C}`);
|
|
198
198
|
}
|
|
199
199
|
return { record: b, status: g.status };
|
|
200
200
|
}
|
|
201
201
|
function ut(l) {
|
|
202
202
|
const { context: c, status: u, record: a, oldRecord: d, newRecord: m } = l;
|
|
203
|
-
let g, b,
|
|
204
|
-
a && (g = Tn(a)), d && (b = Tn(d)), m && (
|
|
203
|
+
let g, b, C;
|
|
204
|
+
a && (g = Tn(a)), d && (b = Tn(d)), m && (C = Tn(m)), u === "created" ? (ye(g, "record is required for created"), c.stagedOperations.push({ status: u, oldRecord: void 0, newRecord: g })) : u === "updated" ? (ye(b && C, "oldRecord and newRecord are required for updated"), c.stagedOperations.push({ status: u, oldRecord: b, newRecord: C })) : u === "deleted" && g && (ye(g, "record is required for deleted"), c.stagedOperations.push({ status: u, oldRecord: g, newRecord: void 0 }));
|
|
205
205
|
}
|
|
206
206
|
const je = {
|
|
207
207
|
default: {
|
|
@@ -216,7 +216,7 @@ const je = {
|
|
|
216
216
|
uri: "http://dialecte.dev/XML/DEV-EXT",
|
|
217
217
|
prefix: "ext"
|
|
218
218
|
}
|
|
219
|
-
}, is = `xmlns="${je.default.uri}"`, ss = `xmlns:${je.dev.prefix}="${je.dev.uri}"`, us = `xmlns:${je.ext.prefix}="${je.ext.uri}"`,
|
|
219
|
+
}, is = `xmlns="${je.default.uri}"`, ss = `xmlns:${je.dev.prefix}="${je.dev.uri}"`, us = `xmlns:${je.ext.prefix}="${je.ext.uri}"`, ca = "db-id", mo = `${je.dev.prefix}:${ca}`, la = [
|
|
220
220
|
"A",
|
|
221
221
|
"AAAA_1",
|
|
222
222
|
"AAAA_2",
|
|
@@ -248,7 +248,7 @@ const je = {
|
|
|
248
248
|
"CC_2",
|
|
249
249
|
"CC_3",
|
|
250
250
|
"Root"
|
|
251
|
-
],
|
|
251
|
+
], fa = {
|
|
252
252
|
A: { aA: "", bA: "", cA: "" },
|
|
253
253
|
AAAA_1: {
|
|
254
254
|
aAAAA_1: "",
|
|
@@ -352,7 +352,7 @@ const je = {
|
|
|
352
352
|
CC_2: { aCC_2: "", bCC_2: "", cCC_2: "" },
|
|
353
353
|
CC_3: { aCC_3: "", bCC_3: "", cCC_3: "" },
|
|
354
354
|
Root: { root: "", "ext:root": "" }
|
|
355
|
-
},
|
|
355
|
+
}, da = {
|
|
356
356
|
A: ["AA_1", "AA_2", "AA_3"],
|
|
357
357
|
AAAA_1: [],
|
|
358
358
|
AAAA_2: [],
|
|
@@ -384,7 +384,7 @@ const je = {
|
|
|
384
384
|
CC_2: ["CCC_1", "CCC_2", "CCC_3"],
|
|
385
385
|
CC_3: ["CCC_1", "CCC_2", "CCC_3"],
|
|
386
386
|
Root: ["A", "B", "C"]
|
|
387
|
-
},
|
|
387
|
+
}, ha = {
|
|
388
388
|
A: ["Root"],
|
|
389
389
|
AAAA_1: ["AAA_1"],
|
|
390
390
|
AAAA_2: ["AAA_2"],
|
|
@@ -416,7 +416,7 @@ const je = {
|
|
|
416
416
|
CC_2: ["C"],
|
|
417
417
|
CC_3: ["C"],
|
|
418
418
|
Root: []
|
|
419
|
-
},
|
|
419
|
+
}, ma = {
|
|
420
420
|
A: ["AAAA_1", "AAAA_2", "AAAA_3", "AAA_1", "AAA_2", "AAA_3", "AA_1", "AA_2", "AA_3"],
|
|
421
421
|
AAAA_1: [],
|
|
422
422
|
AAAA_2: [],
|
|
@@ -479,7 +479,7 @@ const je = {
|
|
|
479
479
|
"CC_2",
|
|
480
480
|
"CC_3"
|
|
481
481
|
]
|
|
482
|
-
},
|
|
482
|
+
}, pa = {
|
|
483
483
|
A: ["Root"],
|
|
484
484
|
AAAA_1: ["A", "AAA_1", "AA_1", "Root"],
|
|
485
485
|
AAAA_2: ["A", "AAA_2", "AA_2", "Root"],
|
|
@@ -525,13 +525,13 @@ const je = {
|
|
|
525
525
|
maxOccurrence: null,
|
|
526
526
|
assertions: null
|
|
527
527
|
};
|
|
528
|
-
function
|
|
528
|
+
function ga(l) {
|
|
529
529
|
return {
|
|
530
530
|
required: [`a${l}`],
|
|
531
531
|
optional: [`b${l}`, `c${l}`]
|
|
532
532
|
};
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function ya() {
|
|
535
535
|
const l = ["A", "B", "C"], u = {};
|
|
536
536
|
u.Root = {
|
|
537
537
|
tag: "Root",
|
|
@@ -579,13 +579,13 @@ function ba() {
|
|
|
579
579
|
}
|
|
580
580
|
};
|
|
581
581
|
for (const a of l)
|
|
582
|
-
|
|
582
|
+
ba(a, 3, u);
|
|
583
583
|
return u;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
const a =
|
|
585
|
+
function ba(l, c, u) {
|
|
586
|
+
const a = va(l, c);
|
|
587
587
|
for (const d of a) {
|
|
588
|
-
const m = po(d), g =
|
|
588
|
+
const m = po(d), g = _a(d), b = Aa(d, c), I = d.endsWith("_3") ? je.ext : je.default, K = ga(d), $ = [...K.required, ...K.optional], Y = Jr(d), M = {
|
|
589
589
|
...Ye,
|
|
590
590
|
minOccurrence: Y === 1 ? 1 : null,
|
|
591
591
|
maxOccurrence: Y
|
|
@@ -644,15 +644,15 @@ function va(l, c, u) {
|
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function va(l, c) {
|
|
648
648
|
const u = [l];
|
|
649
649
|
let a = [l];
|
|
650
650
|
for (let d = 1; d <= c; d++) {
|
|
651
651
|
const m = [];
|
|
652
652
|
for (const g of a) {
|
|
653
653
|
const b = g.replace(/_\d+/g, "") + l.charAt(0);
|
|
654
|
-
for (let
|
|
655
|
-
const I = `${b}_${
|
|
654
|
+
for (let C = 1; C <= 3; C++) {
|
|
655
|
+
const I = `${b}_${C}`;
|
|
656
656
|
u.push(I), m.push(I);
|
|
657
657
|
}
|
|
658
658
|
}
|
|
@@ -660,7 +660,7 @@ function _a(l, c) {
|
|
|
660
660
|
}
|
|
661
661
|
return u;
|
|
662
662
|
}
|
|
663
|
-
function
|
|
663
|
+
function _a(l) {
|
|
664
664
|
if (l.length === 1) return null;
|
|
665
665
|
const c = l.match(/^([A-Z]+)_(\d+)$/);
|
|
666
666
|
if (!c) return null;
|
|
@@ -681,9 +681,9 @@ function Jr(l) {
|
|
|
681
681
|
const c = l.match(/_(\d+)$/);
|
|
682
682
|
return c ? parseInt(c[1], 10) : 1;
|
|
683
683
|
}
|
|
684
|
-
const
|
|
684
|
+
const Ca = ya(), wa = {
|
|
685
685
|
supportedFileExtensions: [".xml"]
|
|
686
|
-
},
|
|
686
|
+
}, Ba = {
|
|
687
687
|
tables: {
|
|
688
688
|
xmlElements: {
|
|
689
689
|
name: "xmlElements",
|
|
@@ -693,16 +693,16 @@ const wa = ba(), Ba = {
|
|
|
693
693
|
}, go = {
|
|
694
694
|
rootElementName: "Root",
|
|
695
695
|
singletonElements: ["Root", "A", "B", "C", "D"],
|
|
696
|
-
elements:
|
|
696
|
+
elements: la,
|
|
697
697
|
namespaces: je,
|
|
698
|
-
attributes:
|
|
699
|
-
children:
|
|
700
|
-
parents:
|
|
701
|
-
descendants:
|
|
702
|
-
ancestors:
|
|
703
|
-
database:
|
|
704
|
-
io:
|
|
705
|
-
definition:
|
|
698
|
+
attributes: fa,
|
|
699
|
+
children: da,
|
|
700
|
+
parents: ha,
|
|
701
|
+
descendants: ma,
|
|
702
|
+
ancestors: pa,
|
|
703
|
+
database: Ba,
|
|
704
|
+
io: wa,
|
|
705
|
+
definition: Ca,
|
|
706
706
|
hooks: {}
|
|
707
707
|
};
|
|
708
708
|
function cs(l) {
|
|
@@ -721,11 +721,11 @@ function cs(l) {
|
|
|
721
721
|
throw new Error(`Unsupported record type: ${u}`);
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
var
|
|
724
|
+
var Ea = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
725
725
|
function yo(l) {
|
|
726
726
|
return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function Ta(l) {
|
|
729
729
|
if (Object.prototype.hasOwnProperty.call(l, "__esModule")) return l;
|
|
730
730
|
var c = l.default;
|
|
731
731
|
if (typeof c == "function") {
|
|
@@ -749,12 +749,12 @@ function xa(l) {
|
|
|
749
749
|
});
|
|
750
750
|
}), u;
|
|
751
751
|
}
|
|
752
|
-
var xn = { exports: {} },
|
|
753
|
-
function
|
|
752
|
+
var xn = { exports: {} }, xa = xn.exports, eo;
|
|
753
|
+
function Na() {
|
|
754
754
|
return eo || (eo = 1, (function(l, c) {
|
|
755
755
|
(function(u, a) {
|
|
756
756
|
l.exports = a();
|
|
757
|
-
})(
|
|
757
|
+
})(xa, function() {
|
|
758
758
|
var u = function(e, t) {
|
|
759
759
|
return (u = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
760
760
|
n.__proto__ = r;
|
|
@@ -771,8 +771,8 @@ function Ra() {
|
|
|
771
771
|
for (var r, o = 0, i = t.length; o < i; o++) !r && o in t || ((r = r || Array.prototype.slice.call(t, 0, o))[o] = t[o]);
|
|
772
772
|
return e.concat(r || Array.prototype.slice.call(t));
|
|
773
773
|
}
|
|
774
|
-
var m = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window :
|
|
775
|
-
function
|
|
774
|
+
var m = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ea, g = Object.keys, b = Array.isArray;
|
|
775
|
+
function C(e, t) {
|
|
776
776
|
return typeof t != "object" || g(t).forEach(function(n) {
|
|
777
777
|
e[n] = t[n];
|
|
778
778
|
}), e;
|
|
@@ -789,7 +789,7 @@ function Ra() {
|
|
|
789
789
|
}
|
|
790
790
|
var H = Object.defineProperty;
|
|
791
791
|
function M(e, t, n, r) {
|
|
792
|
-
H(e, t,
|
|
792
|
+
H(e, t, C(n && $(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
|
|
793
793
|
}
|
|
794
794
|
function F(e) {
|
|
795
795
|
return { from: function(t) {
|
|
@@ -872,9 +872,9 @@ function Ra() {
|
|
|
872
872
|
function Ve(e) {
|
|
873
873
|
return Ht.call(e).slice(8, -1);
|
|
874
874
|
}
|
|
875
|
-
var
|
|
875
|
+
var At = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", fe = typeof At == "symbol" ? function(e) {
|
|
876
876
|
var t;
|
|
877
|
-
return e != null && (t = e[
|
|
877
|
+
return e != null && (t = e[At]) && t.apply(e);
|
|
878
878
|
} : function() {
|
|
879
879
|
return null;
|
|
880
880
|
};
|
|
@@ -977,9 +977,9 @@ function Ra() {
|
|
|
977
977
|
function qe(e, t) {
|
|
978
978
|
return e === J ? t : function(n) {
|
|
979
979
|
var r = e.apply(this, arguments);
|
|
980
|
-
|
|
980
|
+
C(n, r);
|
|
981
981
|
var o = this.onsuccess, i = this.onerror;
|
|
982
|
-
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), o && (this.onsuccess = this.onsuccess ? ve(o, this.onsuccess) : o), i && (this.onerror = this.onerror ? ve(i, this.onerror) : i), r === void 0 ? n === void 0 ? void 0 : n :
|
|
982
|
+
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), o && (this.onsuccess = this.onsuccess ? ve(o, this.onsuccess) : o), i && (this.onerror = this.onerror ? ve(i, this.onerror) : i), r === void 0 ? n === void 0 ? void 0 : n : C(r, n);
|
|
983
983
|
};
|
|
984
984
|
}
|
|
985
985
|
function Dn(e, t) {
|
|
@@ -987,7 +987,7 @@ function Ra() {
|
|
|
987
987
|
return t.apply(this, arguments) !== !1 && e.apply(this, arguments);
|
|
988
988
|
};
|
|
989
989
|
}
|
|
990
|
-
function
|
|
990
|
+
function Ct(e, t) {
|
|
991
991
|
return e === J ? t : function() {
|
|
992
992
|
var n = e.apply(this, arguments);
|
|
993
993
|
if (n && typeof n.then == "function") {
|
|
@@ -1010,7 +1010,7 @@ function Ra() {
|
|
|
1010
1010
|
var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
1011
1011
|
return [t, I(t), e];
|
|
1012
1012
|
})(), kt = ft[0], Me = ft[1], ft = ft[2], Me = Me && Me.then, dt = kt && kt.constructor, In = !!ft, Mt = function(e, t) {
|
|
1013
|
-
jt.push([e, t]), Zt && (queueMicrotask(
|
|
1013
|
+
jt.push([e, t]), Zt && (queueMicrotask(Po), Zt = !1);
|
|
1014
1014
|
}, Pn = !0, Zt = !0, ht = [], Jt = [], Sn = he, et = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: J, pgp: !1, env: {}, finalize: J }, Q = et, jt = [], mt = 0, en = [];
|
|
1015
1015
|
function X(e) {
|
|
1016
1016
|
if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
|
|
@@ -1028,7 +1028,7 @@ function Ra() {
|
|
|
1028
1028
|
var h = r._lib && wt();
|
|
1029
1029
|
i && typeof i.then == "function" ? n(r, function(p, v) {
|
|
1030
1030
|
i instanceof X ? i._then(p, v) : i.then(p, v);
|
|
1031
|
-
}) : (r._state = !0, r._value = i,
|
|
1031
|
+
}) : (r._state = !0, r._value = i, Cr(r)), h && Bt();
|
|
1032
1032
|
}
|
|
1033
1033
|
}, kn.bind(null, r));
|
|
1034
1034
|
} catch (i) {
|
|
@@ -1039,8 +1039,8 @@ function Ra() {
|
|
|
1039
1039
|
var Fn = { get: function() {
|
|
1040
1040
|
var e = Q, t = on;
|
|
1041
1041
|
function n(r, o) {
|
|
1042
|
-
var i = this, h = !e.global && (e !== Q || t !== on), p = h && !nt(), v = new X(function(
|
|
1043
|
-
Mn(i, new
|
|
1042
|
+
var i = this, h = !e.global && (e !== Q || t !== on), p = h && !nt(), v = new X(function(A, B) {
|
|
1043
|
+
Mn(i, new Ar(Br(r, e, h, p), Br(o, e, h, p), A, B, e));
|
|
1044
1044
|
});
|
|
1045
1045
|
return this._consoleTask && (v._consoleTask = this._consoleTask), v;
|
|
1046
1046
|
}
|
|
@@ -1050,16 +1050,16 @@ function Ra() {
|
|
|
1050
1050
|
return e;
|
|
1051
1051
|
}, set: Fn.set });
|
|
1052
1052
|
} };
|
|
1053
|
-
function
|
|
1053
|
+
function Ar(e, t, n, r, o) {
|
|
1054
1054
|
this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = o;
|
|
1055
1055
|
}
|
|
1056
1056
|
function kn(e, t) {
|
|
1057
1057
|
var n, r;
|
|
1058
1058
|
Jt.push(t), e._state === null && (n = e._lib && wt(), t = Sn(t), e._state = !1, e._value = t, r = e, ht.some(function(o) {
|
|
1059
1059
|
return o._value === r._value;
|
|
1060
|
-
}) || ht.push(r),
|
|
1060
|
+
}) || ht.push(r), Cr(e), n && Bt());
|
|
1061
1061
|
}
|
|
1062
|
-
function
|
|
1062
|
+
function Cr(e) {
|
|
1063
1063
|
var t = e._listeners;
|
|
1064
1064
|
e._listeners = [];
|
|
1065
1065
|
for (var n = 0, r = t.length; n < r; ++n) Mn(e, t[n]);
|
|
@@ -1072,10 +1072,10 @@ function Ra() {
|
|
|
1072
1072
|
if (e._state !== null) {
|
|
1073
1073
|
var n = e._state ? t.onFulfilled : t.onRejected;
|
|
1074
1074
|
if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
|
|
1075
|
-
++t.psd.ref, ++mt, Mt(
|
|
1075
|
+
++t.psd.ref, ++mt, Mt(Io, [n, e, t]);
|
|
1076
1076
|
} else e._listeners.push(t);
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1078
|
+
function Io(e, t, n) {
|
|
1079
1079
|
try {
|
|
1080
1080
|
var r, o = t._value;
|
|
1081
1081
|
!t._state && Jt.length && (Jt = []), r = Pe && t._consoleTask ? t._consoleTask.run(function() {
|
|
@@ -1089,7 +1089,7 @@ function Ra() {
|
|
|
1089
1089
|
--mt == 0 && jn(), --n.psd.ref || n.psd.finalize();
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function Po() {
|
|
1093
1093
|
pt(et, function() {
|
|
1094
1094
|
wt() && Bt();
|
|
1095
1095
|
});
|
|
@@ -1132,7 +1132,7 @@ function Ra() {
|
|
|
1132
1132
|
};
|
|
1133
1133
|
}
|
|
1134
1134
|
Y(X.prototype, { then: Fn, _then: function(e, t) {
|
|
1135
|
-
Mn(this, new
|
|
1135
|
+
Mn(this, new Ar(null, null, e, t, Q));
|
|
1136
1136
|
}, catch: function(e) {
|
|
1137
1137
|
if (arguments.length === 1) return this.then(null, e);
|
|
1138
1138
|
var t = e, n = arguments[1];
|
|
@@ -1203,8 +1203,8 @@ function Ra() {
|
|
|
1203
1203
|
var p, v = this;
|
|
1204
1204
|
p = function() {
|
|
1205
1205
|
v.unhandleds.length === 0 ? o() : i(v.unhandleds[0]);
|
|
1206
|
-
}, en.push(function
|
|
1207
|
-
p(), en.splice(en.indexOf(
|
|
1206
|
+
}, en.push(function A() {
|
|
1207
|
+
p(), en.splice(en.indexOf(A), 1);
|
|
1208
1208
|
}), ++mt, Mt(function() {
|
|
1209
1209
|
--mt == 0 && jn();
|
|
1210
1210
|
}, []);
|
|
@@ -1240,15 +1240,15 @@ function Ra() {
|
|
|
1240
1240
|
});
|
|
1241
1241
|
});
|
|
1242
1242
|
}), dt.withResolvers && (X.withResolvers = dt.withResolvers));
|
|
1243
|
-
var Be = { awaits: 0, echoes: 0, id: 0 },
|
|
1243
|
+
var Be = { awaits: 0, echoes: 0, id: 0 }, So = 0, nn = [], rn = 0, on = 0, Fo = 0;
|
|
1244
1244
|
function tt(e, t, n, r) {
|
|
1245
1245
|
var o = Q, i = Object.create(o);
|
|
1246
|
-
return i.parent = o, i.ref = 0, i.global = !1, i.id = ++
|
|
1246
|
+
return i.parent = o, i.ref = 0, i.global = !1, i.id = ++Fo, et.env, i.env = In ? { Promise: X, PromiseProp: { value: X, configurable: !0, writable: !0 }, all: X.all, race: X.race, allSettled: X.allSettled, any: X.any, resolve: X.resolve, reject: X.reject } : {}, t && C(i, t), ++o.ref, i.finalize = function() {
|
|
1247
1247
|
--this.parent.ref || this.parent.finalize();
|
|
1248
1248
|
}, r = pt(i, e, n, r), i.ref === 0 && i.finalize(), r;
|
|
1249
1249
|
}
|
|
1250
1250
|
function Et() {
|
|
1251
|
-
return Be.id || (Be.id = ++
|
|
1251
|
+
return Be.id || (Be.id = ++So), ++Be.awaits, Be.echoes += _r, Be.id;
|
|
1252
1252
|
}
|
|
1253
1253
|
function nt() {
|
|
1254
1254
|
return !!Be.awaits && (--Be.awaits == 0 && (Be.id = 0), Be.echoes = Be.awaits * _r, !0);
|
|
@@ -1257,10 +1257,10 @@ function Ra() {
|
|
|
1257
1257
|
return Be.echoes && e && e.constructor === dt ? (Et(), e.then(function(t) {
|
|
1258
1258
|
return nt(), t;
|
|
1259
1259
|
}, function(t) {
|
|
1260
|
-
return nt(),
|
|
1260
|
+
return nt(), Ae(t);
|
|
1261
1261
|
})) : e;
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function ko() {
|
|
1264
1264
|
var e = nn[nn.length - 1];
|
|
1265
1265
|
nn.pop(), rt(e, !1);
|
|
1266
1266
|
}
|
|
@@ -1268,7 +1268,7 @@ function Ra() {
|
|
|
1268
1268
|
var n, r = Q;
|
|
1269
1269
|
(t ? !Be.echoes || rn++ && e === Q : !rn || --rn && e === Q) || queueMicrotask(t ? (function(o) {
|
|
1270
1270
|
++on, Be.echoes && --Be.echoes != 0 || (Be.echoes = Be.awaits = Be.id = 0), nn.push(Q), rt(o, !0);
|
|
1271
|
-
}).bind(null, e) :
|
|
1271
|
+
}).bind(null, e) : ko), e !== Q && (Q = e, r === et && (et.env = wr()), In && (n = et.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(m, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
|
|
1272
1272
|
}
|
|
1273
1273
|
function wr() {
|
|
1274
1274
|
var e = m.Promise;
|
|
@@ -1297,7 +1297,7 @@ function Ra() {
|
|
|
1297
1297
|
Promise === dt && Be.echoes === 0 ? rn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
1298
1298
|
}
|
|
1299
1299
|
("" + Me).indexOf("[native code]") === -1 && (Et = nt = J);
|
|
1300
|
-
var
|
|
1300
|
+
var Ae = X.reject, gt = "", Xe = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Er = "String expected.", Tt = [], sn = "__dbnames", qn = "readonly", Ln = "readwrite";
|
|
1301
1301
|
function yt(e, t) {
|
|
1302
1302
|
return e ? t ? function() {
|
|
1303
1303
|
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
@@ -1325,13 +1325,13 @@ function Ra() {
|
|
|
1325
1325
|
return t < e ? 1 : e < t ? -1 : 0;
|
|
1326
1326
|
case "binary":
|
|
1327
1327
|
return (function(o, i) {
|
|
1328
|
-
for (var h = o.length, p = i.length, v = h < p ? h : p,
|
|
1328
|
+
for (var h = o.length, p = i.length, v = h < p ? h : p, A = 0; A < v; ++A) if (o[A] !== i[A]) return o[A] < i[A] ? -1 : 1;
|
|
1329
1329
|
return h === p ? 0 : h < p ? -1 : 1;
|
|
1330
1330
|
})(Rr(e), Rr(t));
|
|
1331
1331
|
case "Array":
|
|
1332
1332
|
return (function(o, i) {
|
|
1333
|
-
for (var h = o.length, p = i.length, v = h < p ? h : p,
|
|
1334
|
-
var B = se(o[
|
|
1333
|
+
for (var h = o.length, p = i.length, v = h < p ? h : p, A = 0; A < v; ++A) {
|
|
1334
|
+
var B = se(o[A], i[A]);
|
|
1335
1335
|
if (B !== 0) return B;
|
|
1336
1336
|
}
|
|
1337
1337
|
return h === p ? 0 : h < p ? -1 : 1;
|
|
@@ -1360,7 +1360,7 @@ function Ra() {
|
|
|
1360
1360
|
}
|
|
1361
1361
|
var Or = (me.prototype._trans = function(e, t, n) {
|
|
1362
1362
|
var r = this._tx || Q.trans, o = this.name, i = Pe && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
|
|
1363
|
-
function h(
|
|
1363
|
+
function h(A, B, y) {
|
|
1364
1364
|
if (!y.schema[o]) throw new O.NotFound("Table " + o + " not part of transaction");
|
|
1365
1365
|
return t(y.idbtrans, y);
|
|
1366
1366
|
}
|
|
@@ -1368,15 +1368,15 @@ function Ra() {
|
|
|
1368
1368
|
try {
|
|
1369
1369
|
var v = r && r.db._novip === this.db._novip ? r === Q.trans ? r._promise(e, h, n) : tt(function() {
|
|
1370
1370
|
return r._promise(e, h, n);
|
|
1371
|
-
}, { trans: r, transless: Q.transless || Q }) : (function
|
|
1371
|
+
}, { trans: r, transless: Q.transless || Q }) : (function A(B, y, N, _) {
|
|
1372
1372
|
if (B.idbdb && (B._state.openComplete || Q.letThrough || B._vip)) {
|
|
1373
1373
|
var w = B._createTransaction(y, N, B._dbSchema);
|
|
1374
1374
|
try {
|
|
1375
1375
|
w.create(), B._state.PR1398_maxLoop = 3;
|
|
1376
1376
|
} catch (x) {
|
|
1377
1377
|
return x.name === f.InvalidState && B.isOpen() && 0 < --B._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), B.close({ disableAutoOpen: !1 }), B.open().then(function() {
|
|
1378
|
-
return
|
|
1379
|
-
})) :
|
|
1378
|
+
return A(B, y, N, _);
|
|
1379
|
+
})) : Ae(x);
|
|
1380
1380
|
}
|
|
1381
1381
|
return w._promise(y, function(x, T) {
|
|
1382
1382
|
return tt(function() {
|
|
@@ -1392,24 +1392,24 @@ function Ra() {
|
|
|
1392
1392
|
});
|
|
1393
1393
|
});
|
|
1394
1394
|
}
|
|
1395
|
-
if (B._state.openComplete) return
|
|
1395
|
+
if (B._state.openComplete) return Ae(new O.DatabaseClosed(B._state.dbOpenError));
|
|
1396
1396
|
if (!B._state.isBeingOpened) {
|
|
1397
|
-
if (!B._state.autoOpen) return
|
|
1397
|
+
if (!B._state.autoOpen) return Ae(new O.DatabaseClosed());
|
|
1398
1398
|
B.open().catch(J);
|
|
1399
1399
|
}
|
|
1400
1400
|
return B._state.dbReadyPromise.then(function() {
|
|
1401
|
-
return
|
|
1401
|
+
return A(B, y, N, _);
|
|
1402
1402
|
});
|
|
1403
1403
|
})(this.db, e, [this.name], h);
|
|
1404
|
-
return i && (v._consoleTask = i, v = v.catch(function(
|
|
1405
|
-
return console.trace(
|
|
1404
|
+
return i && (v._consoleTask = i, v = v.catch(function(A) {
|
|
1405
|
+
return console.trace(A), Ae(A);
|
|
1406
1406
|
})), v;
|
|
1407
1407
|
} finally {
|
|
1408
1408
|
p && Bt();
|
|
1409
1409
|
}
|
|
1410
1410
|
}, me.prototype.get = function(e, t) {
|
|
1411
1411
|
var n = this;
|
|
1412
|
-
return e && e.constructor === Object ? this.where(e).first(t) : e == null ?
|
|
1412
|
+
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? Ae(new O.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(r) {
|
|
1413
1413
|
return n.core.get({ trans: r, key: e }).then(function(o) {
|
|
1414
1414
|
return n.hook.reading.fire(o);
|
|
1415
1415
|
});
|
|
@@ -1420,8 +1420,8 @@ function Ra() {
|
|
|
1420
1420
|
var t = g(e);
|
|
1421
1421
|
if (t.length === 1) return this.where(t[0]).equals(e[t[0]]);
|
|
1422
1422
|
var n = this.schema.indexes.concat(this.schema.primKey).filter(function(p) {
|
|
1423
|
-
if (p.compound && t.every(function(
|
|
1424
|
-
return 0 <= p.keyPath.indexOf(
|
|
1423
|
+
if (p.compound && t.every(function(A) {
|
|
1424
|
+
return 0 <= p.keyPath.indexOf(A);
|
|
1425
1425
|
})) {
|
|
1426
1426
|
for (var v = 0; v < t.length; ++v) if (t.indexOf(p.keyPath[v]) === -1) return !1;
|
|
1427
1427
|
return !0;
|
|
@@ -1442,8 +1442,8 @@ function Ra() {
|
|
|
1442
1442
|
return se(p, v) === 0;
|
|
1443
1443
|
}
|
|
1444
1444
|
var h = t.reduce(function(y, v) {
|
|
1445
|
-
var
|
|
1446
|
-
return [
|
|
1445
|
+
var A = y[0], B = y[1], y = r[v], N = e[v];
|
|
1446
|
+
return [A || y, A || !y ? yt(B, y && y.multi ? function(_) {
|
|
1447
1447
|
return _ = pe(_, v), b(_) && _.some(function(w) {
|
|
1448
1448
|
return o(N, w);
|
|
1449
1449
|
});
|
|
@@ -1475,12 +1475,12 @@ function Ra() {
|
|
|
1475
1475
|
function o() {
|
|
1476
1476
|
return t !== null && t.apply(this, arguments) || this;
|
|
1477
1477
|
}
|
|
1478
|
-
(this.schema.mappedClass = e).prototype instanceof xr && ((function(v,
|
|
1479
|
-
if (typeof
|
|
1478
|
+
(this.schema.mappedClass = e).prototype instanceof xr && ((function(v, A) {
|
|
1479
|
+
if (typeof A != "function" && A !== null) throw new TypeError("Class extends value " + String(A) + " is not a constructor or null");
|
|
1480
1480
|
function B() {
|
|
1481
1481
|
this.constructor = v;
|
|
1482
1482
|
}
|
|
1483
|
-
u(v,
|
|
1483
|
+
u(v, A), v.prototype = A === null ? Object.create(A) : (B.prototype = A.prototype, new B());
|
|
1484
1484
|
})(o, t = e), Object.defineProperty(o.prototype, "db", { get: function() {
|
|
1485
1485
|
return n;
|
|
1486
1486
|
}, enumerable: !1, configurable: !0 }), o.prototype.table = function() {
|
|
@@ -1491,9 +1491,9 @@ function Ra() {
|
|
|
1491
1491
|
});
|
|
1492
1492
|
function p(v) {
|
|
1493
1493
|
if (!v) return v;
|
|
1494
|
-
var
|
|
1495
|
-
for (
|
|
1496
|
-
B[
|
|
1494
|
+
var A, B = Object.create(e.prototype);
|
|
1495
|
+
for (A in v) if (!i.has(A)) try {
|
|
1496
|
+
B[A] = v[A];
|
|
1497
1497
|
} catch {
|
|
1498
1498
|
}
|
|
1499
1499
|
return B;
|
|
@@ -1501,7 +1501,7 @@ function Ra() {
|
|
|
1501
1501
|
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = p, this.hook("reading", p), e;
|
|
1502
1502
|
}, me.prototype.defineClass = function() {
|
|
1503
1503
|
return this.mapToClass(function(e) {
|
|
1504
|
-
|
|
1504
|
+
C(this, e);
|
|
1505
1505
|
});
|
|
1506
1506
|
}, me.prototype.add = function(e, t) {
|
|
1507
1507
|
var n = this, r = this.schema.primKey, o = r.auto, i = r.keyPath, h = e;
|
|
@@ -1517,7 +1517,7 @@ function Ra() {
|
|
|
1517
1517
|
return p;
|
|
1518
1518
|
});
|
|
1519
1519
|
}, me.prototype.update = function(e, t) {
|
|
1520
|
-
return typeof e != "object" || b(e) ? this.where(":id").equals(e).modify(t) : (e = pe(e, this.schema.primKey.keyPath), e === void 0 ?
|
|
1520
|
+
return typeof e != "object" || b(e) ? this.where(":id").equals(e).modify(t) : (e = pe(e, this.schema.primKey.keyPath), e === void 0 ? Ae(new O.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
|
|
1521
1521
|
}, me.prototype.put = function(e, t) {
|
|
1522
1522
|
var n = this, r = this.schema.primKey, o = r.auto, i = r.keyPath, h = e;
|
|
1523
1523
|
return i && o && (h = un(i)(e)), this._trans("readwrite", function(p) {
|
|
@@ -1561,11 +1561,11 @@ function Ra() {
|
|
|
1561
1561
|
}, me.prototype.bulkAdd = function(e, t, n) {
|
|
1562
1562
|
var r = this, o = Array.isArray(t) ? t : void 0, i = (n = n || (o ? void 0 : t)) ? n.allKeys : void 0;
|
|
1563
1563
|
return this._trans("readwrite", function(h) {
|
|
1564
|
-
var
|
|
1565
|
-
if (
|
|
1564
|
+
var A = r.schema.primKey, p = A.auto, A = A.keyPath;
|
|
1565
|
+
if (A && o) throw new O.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
1566
1566
|
if (o && o.length !== e.length) throw new O.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1567
|
-
var v = e.length,
|
|
1568
|
-
return r.core.mutate({ trans: h, type: "add", keys: o, values:
|
|
1567
|
+
var v = e.length, A = A && p ? e.map(un(A)) : e;
|
|
1568
|
+
return r.core.mutate({ trans: h, type: "add", keys: o, values: A, wantResults: i }).then(function(w) {
|
|
1569
1569
|
var y = w.numFailures, N = w.results, _ = w.lastResult, w = w.failures;
|
|
1570
1570
|
if (y === 0) return i ? N : _;
|
|
1571
1571
|
throw new Ze("".concat(r.name, ".bulkAdd(): ").concat(y, " of ").concat(v, " operations failed"), w);
|
|
@@ -1574,11 +1574,11 @@ function Ra() {
|
|
|
1574
1574
|
}, me.prototype.bulkPut = function(e, t, n) {
|
|
1575
1575
|
var r = this, o = Array.isArray(t) ? t : void 0, i = (n = n || (o ? void 0 : t)) ? n.allKeys : void 0;
|
|
1576
1576
|
return this._trans("readwrite", function(h) {
|
|
1577
|
-
var
|
|
1578
|
-
if (
|
|
1577
|
+
var A = r.schema.primKey, p = A.auto, A = A.keyPath;
|
|
1578
|
+
if (A && o) throw new O.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
1579
1579
|
if (o && o.length !== e.length) throw new O.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1580
|
-
var v = e.length,
|
|
1581
|
-
return r.core.mutate({ trans: h, type: "put", keys: o, values:
|
|
1580
|
+
var v = e.length, A = A && p ? e.map(un(A)) : e;
|
|
1581
|
+
return r.core.mutate({ trans: h, type: "put", keys: o, values: A, wantResults: i }).then(function(w) {
|
|
1582
1582
|
var y = w.numFailures, N = w.results, _ = w.lastResult, w = w.failures;
|
|
1583
1583
|
if (y === 0) return i ? N : _;
|
|
1584
1584
|
throw new Ze("".concat(r.name, ".bulkPut(): ").concat(y, " of ").concat(v, " operations failed"), w);
|
|
@@ -1592,7 +1592,7 @@ function Ra() {
|
|
|
1592
1592
|
}), i = [];
|
|
1593
1593
|
return this._trans("readwrite", function(h) {
|
|
1594
1594
|
return n.getMany({ trans: h, keys: r, cache: "clone" }).then(function(p) {
|
|
1595
|
-
var v = [],
|
|
1595
|
+
var v = [], A = [];
|
|
1596
1596
|
e.forEach(function(y, N) {
|
|
1597
1597
|
var _ = y.key, w = y.changes, x = p[N];
|
|
1598
1598
|
if (x) {
|
|
@@ -1602,11 +1602,11 @@ function Ra() {
|
|
|
1602
1602
|
if (se(S, _) !== 0) throw new O.Constraint("Cannot update primary key in bulkUpdate()");
|
|
1603
1603
|
} else ae(x, P, S);
|
|
1604
1604
|
}
|
|
1605
|
-
i.push(N), v.push(_),
|
|
1605
|
+
i.push(N), v.push(_), A.push(x);
|
|
1606
1606
|
}
|
|
1607
1607
|
});
|
|
1608
1608
|
var B = v.length;
|
|
1609
|
-
return n.mutate({ trans: h, type: "put", keys: v, values:
|
|
1609
|
+
return n.mutate({ trans: h, type: "put", keys: v, values: A, updates: { keys: r, changeSpecs: o } }).then(function(y) {
|
|
1610
1610
|
var N = y.numFailures, _ = y.failures;
|
|
1611
1611
|
if (N === 0) return B;
|
|
1612
1612
|
for (var w = 0, x = Object.keys(_); w < x.length; w++) {
|
|
@@ -1634,8 +1634,8 @@ function Ra() {
|
|
|
1634
1634
|
function Kt(e) {
|
|
1635
1635
|
function t(h, p) {
|
|
1636
1636
|
if (p) {
|
|
1637
|
-
for (var v = arguments.length,
|
|
1638
|
-
return n[h].subscribe.apply(null,
|
|
1637
|
+
for (var v = arguments.length, A = new Array(v - 1); --v; ) A[v - 1] = arguments[v];
|
|
1638
|
+
return n[h].subscribe.apply(null, A), e;
|
|
1639
1639
|
}
|
|
1640
1640
|
if (typeof h == "string") return n[h];
|
|
1641
1641
|
}
|
|
@@ -1645,7 +1645,7 @@ function Ra() {
|
|
|
1645
1645
|
return t;
|
|
1646
1646
|
function i(h, p, v) {
|
|
1647
1647
|
if (typeof h != "object") {
|
|
1648
|
-
var
|
|
1648
|
+
var A;
|
|
1649
1649
|
p = p || Dn;
|
|
1650
1650
|
var B = { subscribers: [], fire: v = v || J, subscribe: function(y) {
|
|
1651
1651
|
B.subscribers.indexOf(y) === -1 && (B.subscribers.push(y), B.fire = p(B.fire, y));
|
|
@@ -1656,9 +1656,9 @@ function Ra() {
|
|
|
1656
1656
|
} };
|
|
1657
1657
|
return n[h] = t[h] = B;
|
|
1658
1658
|
}
|
|
1659
|
-
g(
|
|
1660
|
-
var N =
|
|
1661
|
-
if (b(N)) i(y,
|
|
1659
|
+
g(A = h).forEach(function(y) {
|
|
1660
|
+
var N = A[y];
|
|
1661
|
+
if (b(N)) i(y, A[y][0], A[y][1]);
|
|
1662
1662
|
else {
|
|
1663
1663
|
if (N !== "asap") throw new O.InvalidArgument("Invalid event config");
|
|
1664
1664
|
var _ = i(y, he, function() {
|
|
@@ -1701,13 +1701,13 @@ function Ra() {
|
|
|
1701
1701
|
function fn(e, t, n, r) {
|
|
1702
1702
|
var o = e.replayFilter ? yt(e.filter, e.replayFilter()) : e.filter;
|
|
1703
1703
|
if (e.or) {
|
|
1704
|
-
var i = {}, h = function(p, v,
|
|
1704
|
+
var i = {}, h = function(p, v, A) {
|
|
1705
1705
|
var B, y;
|
|
1706
|
-
o && !o(v,
|
|
1706
|
+
o && !o(v, A, function(N) {
|
|
1707
1707
|
return v.stop(N);
|
|
1708
1708
|
}, function(N) {
|
|
1709
1709
|
return v.fail(N);
|
|
1710
|
-
}) || ((y = "" + (B = v.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(B)), $(i, y) || (i[y] = !0, t(p, v,
|
|
1710
|
+
}) || ((y = "" + (B = v.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(B)), $(i, y) || (i[y] = !0, t(p, v, A)));
|
|
1711
1711
|
};
|
|
1712
1712
|
return Promise.all([e.or._iterate(h, n), Ir(Dr(e, r, n), e.algorithm, h, !e.keysOnly && e.valueMapper)]);
|
|
1713
1713
|
}
|
|
@@ -1765,12 +1765,12 @@ function Ra() {
|
|
|
1765
1765
|
function Pr(e) {
|
|
1766
1766
|
this["@@propmod"] = e;
|
|
1767
1767
|
}
|
|
1768
|
-
var
|
|
1768
|
+
var Mo = (le.prototype._read = function(e, t) {
|
|
1769
1769
|
var n = this._ctx;
|
|
1770
|
-
return n.error ? n.table._trans(null,
|
|
1770
|
+
return n.error ? n.table._trans(null, Ae.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
|
|
1771
1771
|
}, le.prototype._write = function(e) {
|
|
1772
1772
|
var t = this._ctx;
|
|
1773
|
-
return t.error ? t.table._trans(null,
|
|
1773
|
+
return t.error ? t.table._trans(null, Ae.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
|
|
1774
1774
|
}, le.prototype._addAlgorithm = function(e) {
|
|
1775
1775
|
var t = this._ctx;
|
|
1776
1776
|
t.algorithm = yt(t.algorithm, e);
|
|
@@ -1778,7 +1778,7 @@ function Ra() {
|
|
|
1778
1778
|
return fn(this._ctx, e, t, this._ctx.table.core);
|
|
1779
1779
|
}, le.prototype.clone = function(e) {
|
|
1780
1780
|
var t = Object.create(this.constructor.prototype), n = Object.create(this._ctx);
|
|
1781
|
-
return e &&
|
|
1781
|
+
return e && C(n, e), t._ctx = n, t;
|
|
1782
1782
|
}, le.prototype.raw = function() {
|
|
1783
1783
|
return this._ctx.valueMapper = null, this;
|
|
1784
1784
|
}, le.prototype.each = function(e) {
|
|
@@ -1802,12 +1802,12 @@ function Ra() {
|
|
|
1802
1802
|
}).then(e);
|
|
1803
1803
|
}, le.prototype.sortBy = function(e, t) {
|
|
1804
1804
|
var n = e.split(".").reverse(), r = n[0], o = n.length - 1;
|
|
1805
|
-
function i(v,
|
|
1806
|
-
return
|
|
1805
|
+
function i(v, A) {
|
|
1806
|
+
return A ? i(v[n[A]], A - 1) : v[r];
|
|
1807
1807
|
}
|
|
1808
1808
|
var h = this._ctx.dir === "next" ? 1 : -1;
|
|
1809
|
-
function p(v,
|
|
1810
|
-
return se(i(v, o), i(
|
|
1809
|
+
function p(v, A) {
|
|
1810
|
+
return se(i(v, o), i(A, o)) * h;
|
|
1811
1811
|
}
|
|
1812
1812
|
return this.toArray(function(v) {
|
|
1813
1813
|
return v.sort(p);
|
|
@@ -1937,7 +1937,7 @@ function Ra() {
|
|
|
1937
1937
|
}
|
|
1938
1938
|
return P;
|
|
1939
1939
|
});
|
|
1940
|
-
var p = n.table.core, y = p.schema.primaryKey, v = y.outbound,
|
|
1940
|
+
var p = n.table.core, y = p.schema.primaryKey, v = y.outbound, A = y.extractKey, B = 200, y = t.db._options.modifyChunkSize;
|
|
1941
1941
|
y && (B = typeof y == "object" ? y[p.name] || y["*"] || 200 : y);
|
|
1942
1942
|
function N(R, k) {
|
|
1943
1943
|
var S = k.failures, k = k.numFailures;
|
|
@@ -1955,7 +1955,7 @@ function Ra() {
|
|
|
1955
1955
|
var L = [], G = [], V = v ? [] : null, W = T ? U : [];
|
|
1956
1956
|
if (!T) for (var oe = 0; oe < j; ++oe) {
|
|
1957
1957
|
var ce = q[oe], ne = { value: Se(ce), primKey: R[k + oe] };
|
|
1958
|
-
h.call(ne, ne.value, ne) !== !1 && (ne.value == null ? W.push(R[k + oe]) : v || se(
|
|
1958
|
+
h.call(ne, ne.value, ne) !== !1 && (ne.value == null ? W.push(R[k + oe]) : v || se(A(ce), A(ne.value)) === 0 ? (G.push(ne.value), v && V.push(R[k + oe])) : (W.push(R[k + oe]), L.push(ne.value)));
|
|
1959
1959
|
}
|
|
1960
1960
|
return Promise.resolve(0 < L.length && p.mutate({ trans: r, type: "add", values: L }).then(function(_e) {
|
|
1961
1961
|
for (var ee in _e.failures) W.splice(parseInt(ee), 1);
|
|
@@ -1989,8 +1989,8 @@ function Ra() {
|
|
|
1989
1989
|
return e.table.core.count({ trans: n, query: { index: r, range: o } }).then(function(i) {
|
|
1990
1990
|
return e.table.core.mutate({ trans: n, type: "deleteRange", range: o }).then(function(v) {
|
|
1991
1991
|
var p = v.failures, v = v.numFailures;
|
|
1992
|
-
if (v) throw new He("Could not delete some values", Object.keys(p).map(function(
|
|
1993
|
-
return p[
|
|
1992
|
+
if (v) throw new He("Could not delete some values", Object.keys(p).map(function(A) {
|
|
1993
|
+
return p[A];
|
|
1994
1994
|
}), i - v);
|
|
1995
1995
|
return i - v;
|
|
1996
1996
|
});
|
|
@@ -2002,10 +2002,10 @@ function Ra() {
|
|
|
2002
2002
|
var Sr = function(e, t) {
|
|
2003
2003
|
return t.value = null;
|
|
2004
2004
|
};
|
|
2005
|
-
function
|
|
2005
|
+
function jo(e, t) {
|
|
2006
2006
|
return e < t ? -1 : e === t ? 0 : 1;
|
|
2007
2007
|
}
|
|
2008
|
-
function
|
|
2008
|
+
function Ko(e, t) {
|
|
2009
2009
|
return t < e ? -1 : e === t ? 0 : 1;
|
|
2010
2010
|
}
|
|
2011
2011
|
function ke(e, t, n) {
|
|
@@ -2017,7 +2017,7 @@ function Ra() {
|
|
|
2017
2017
|
}).limit(0);
|
|
2018
2018
|
}
|
|
2019
2019
|
function dn(e, t, n, r) {
|
|
2020
|
-
var o, i, h, p, v,
|
|
2020
|
+
var o, i, h, p, v, A, B, y = n.length;
|
|
2021
2021
|
if (!n.every(function(w) {
|
|
2022
2022
|
return typeof w == "string";
|
|
2023
2023
|
})) return ke(e, Er);
|
|
@@ -2030,7 +2030,7 @@ function Ra() {
|
|
|
2030
2030
|
return T.toLowerCase();
|
|
2031
2031
|
} : function(T) {
|
|
2032
2032
|
return T.toUpperCase();
|
|
2033
|
-
}, h = w === "next" ?
|
|
2033
|
+
}, h = w === "next" ? jo : Ko;
|
|
2034
2034
|
var x = n.map(function(T) {
|
|
2035
2035
|
return { lower: i(T), upper: o(T) };
|
|
2036
2036
|
}).sort(function(T, R) {
|
|
@@ -2040,7 +2040,7 @@ function Ra() {
|
|
|
2040
2040
|
return T.upper;
|
|
2041
2041
|
}), v = x.map(function(T) {
|
|
2042
2042
|
return T.lower;
|
|
2043
|
-
}), B = (
|
|
2043
|
+
}), B = (A = w) === "next" ? "" : r;
|
|
2044
2044
|
}
|
|
2045
2045
|
N("next"), e = new e.Collection(e, function() {
|
|
2046
2046
|
return ot(p[0], v[y - 1] + r);
|
|
@@ -2061,7 +2061,7 @@ function Ra() {
|
|
|
2061
2061
|
V(U[ne], _e) < 0 && (ce = ne);
|
|
2062
2062
|
}
|
|
2063
2063
|
return oe < G.length && W === "next" ? U + L.substr(U.length) : oe < U.length && W === "prev" ? U.substr(0, L.length) : ce < 0 ? null : U.substr(0, ce) + G[ce] + L.substr(ce + 1);
|
|
2064
|
-
})(R, P, p[k], v[k], h,
|
|
2064
|
+
})(R, P, p[k], v[k], h, A);
|
|
2065
2065
|
j === null && S === null ? _ = k + 1 : (S === null || 0 < h(S, j)) && (S = j);
|
|
2066
2066
|
}
|
|
2067
2067
|
return x(S !== null ? function() {
|
|
@@ -2169,7 +2169,7 @@ function Ra() {
|
|
|
2169
2169
|
if (!R.every(function(P) {
|
|
2170
2170
|
return P[0] !== void 0 && P[1] !== void 0 && o(P[0], P[1]) <= 0;
|
|
2171
2171
|
})) return ke(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", O.InvalidArgument);
|
|
2172
|
-
var v = !t || t.includeLowers !== !1,
|
|
2172
|
+
var v = !t || t.includeLowers !== !1, A = t && t.includeUppers === !0, B, y = o;
|
|
2173
2173
|
function N(P, S) {
|
|
2174
2174
|
return y(P[0], S[0]);
|
|
2175
2175
|
}
|
|
@@ -2187,7 +2187,7 @@ function Ra() {
|
|
|
2187
2187
|
} catch {
|
|
2188
2188
|
return ke(this, Xe);
|
|
2189
2189
|
}
|
|
2190
|
-
var _ = 0, w =
|
|
2190
|
+
var _ = 0, w = A ? function(P) {
|
|
2191
2191
|
return 0 < o(P, B[_][1]);
|
|
2192
2192
|
} : function(P) {
|
|
2193
2193
|
return 0 <= o(P, B[_][1]);
|
|
@@ -2196,7 +2196,7 @@ function Ra() {
|
|
|
2196
2196
|
} : function(P) {
|
|
2197
2197
|
return 0 <= i(P, B[_][0]);
|
|
2198
2198
|
}, T = w, R = new this.Collection(this, function() {
|
|
2199
|
-
return ot(B[0][0], B[B.length - 1][1], !v, !
|
|
2199
|
+
return ot(B[0][0], B[B.length - 1][1], !v, !A);
|
|
2200
2200
|
});
|
|
2201
2201
|
return R._ondirectionchange = function(P) {
|
|
2202
2202
|
y = P === "next" ? (T = w, o) : (T = x, i), B.sort(N);
|
|
@@ -2224,7 +2224,7 @@ function Ra() {
|
|
|
2224
2224
|
function Ut(e) {
|
|
2225
2225
|
e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
|
|
2226
2226
|
}
|
|
2227
|
-
var $t = "storagemutated", Vn = "x-storagemutated-1", at = Kt(null, $t),
|
|
2227
|
+
var $t = "storagemutated", Vn = "x-storagemutated-1", at = Kt(null, $t), qo = ($e.prototype._lock = function() {
|
|
2228
2228
|
return z(!Q.global), ++this._reculock, this._reculock !== 1 || Q.global || (Q.lockOwnerFor = this), this;
|
|
2229
2229
|
}, $e.prototype._unlock = function() {
|
|
2230
2230
|
if (z(!Q.global), --this._reculock == 0) for (Q.global || (Q.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) {
|
|
@@ -2259,8 +2259,8 @@ function Ra() {
|
|
|
2259
2259
|
}), this;
|
|
2260
2260
|
}, $e.prototype._promise = function(e, t, n) {
|
|
2261
2261
|
var r = this;
|
|
2262
|
-
if (e === "readwrite" && this.mode !== "readwrite") return
|
|
2263
|
-
if (!this.active) return
|
|
2262
|
+
if (e === "readwrite" && this.mode !== "readwrite") return Ae(new O.ReadOnly("Transaction is readonly"));
|
|
2263
|
+
if (!this.active) return Ae(new O.TransactionInactive());
|
|
2264
2264
|
if (this._locked()) return new X(function(i, h) {
|
|
2265
2265
|
r._blockedFuncs.push([function() {
|
|
2266
2266
|
r._promise(e, t, n).then(i, h);
|
|
@@ -2351,11 +2351,11 @@ function Ra() {
|
|
|
2351
2351
|
function jr(e) {
|
|
2352
2352
|
return [].slice.call(e);
|
|
2353
2353
|
}
|
|
2354
|
-
var
|
|
2354
|
+
var Lo = 0;
|
|
2355
2355
|
function Gt(e) {
|
|
2356
2356
|
return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
|
|
2357
2357
|
}
|
|
2358
|
-
function
|
|
2358
|
+
function Uo(e, t, v) {
|
|
2359
2359
|
function r(T) {
|
|
2360
2360
|
if (T.type === 3) return null;
|
|
2361
2361
|
if (T.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
|
|
@@ -2414,7 +2414,7 @@ function Ra() {
|
|
|
2414
2414
|
return P(j.target.result);
|
|
2415
2415
|
}, k.onerror = Ue(S);
|
|
2416
2416
|
});
|
|
2417
|
-
}, query: (_ =
|
|
2417
|
+
}, query: (_ = A, function(x) {
|
|
2418
2418
|
return new Promise(function(T, R) {
|
|
2419
2419
|
T = ge(T);
|
|
2420
2420
|
var P, S, k, L = x.trans, j = x.values, U = x.limit, V = x.query, q = U === 1 / 0 ? void 0 : U, G = V.index, V = V.range, L = L.objectStore(w), G = G.isPrimaryKey ? L : L.index(G.name), V = r(V);
|
|
@@ -2433,7 +2433,7 @@ function Ra() {
|
|
|
2433
2433
|
var G = P.index, q = P.range, L = T.objectStore(w), L = G.isPrimaryKey ? L : L.index(G.name), G = S ? k ? "prevunique" : "prev" : k ? "nextunique" : "next", V = !R && "openKeyCursor" in L ? L.openKeyCursor(r(q), G) : L.openCursor(r(q), G);
|
|
2434
2434
|
V.onerror = Ue(U), V.onsuccess = ge(function(W) {
|
|
2435
2435
|
var oe, ce, ne, _e, ee = V.result;
|
|
2436
|
-
ee ? (ee.___id = ++
|
|
2436
|
+
ee ? (ee.___id = ++Lo, ee.done = !1, oe = ee.continue.bind(ee), ce = (ce = ee.continuePrimaryKey) && ce.bind(ee), ne = ee.advance.bind(ee), _e = function() {
|
|
2437
2437
|
throw new Error("Cursor not stopped");
|
|
2438
2438
|
}, ee.trans = T, ee.stop = ee.continue = ee.continuePrimaryKey = ee.advance = function() {
|
|
2439
2439
|
throw new Error("Cursor not started");
|
|
@@ -2488,7 +2488,7 @@ function Ra() {
|
|
|
2488
2488
|
return x[Gt(R)];
|
|
2489
2489
|
} };
|
|
2490
2490
|
return x[":id"] = T.primaryKey, _ != null && (x[Gt(_)] = T.primaryKey), T;
|
|
2491
|
-
}) }, hasGetAll: 0 < p.length && "getAll" in h.objectStore(p[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = B.schema,
|
|
2491
|
+
}) }, hasGetAll: 0 < p.length && "getAll" in h.objectStore(p[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = B.schema, A = B.hasGetAll, B = v.tables.map(o), y = {};
|
|
2492
2492
|
return B.forEach(function(N) {
|
|
2493
2493
|
return y[N.name] = N;
|
|
2494
2494
|
}), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(N) {
|
|
@@ -2496,14 +2496,14 @@ function Ra() {
|
|
|
2496
2496
|
return y[N];
|
|
2497
2497
|
}, MIN_KEY: -1 / 0, MAX_KEY: Vt(t), schema: v };
|
|
2498
2498
|
}
|
|
2499
|
-
function
|
|
2499
|
+
function $o(e, t, n, r) {
|
|
2500
2500
|
var o = n.IDBKeyRange;
|
|
2501
|
-
return n.indexedDB, { dbcore: (r =
|
|
2501
|
+
return n.indexedDB, { dbcore: (r = Uo(t, o, r), e.dbcore.reduce(function(i, h) {
|
|
2502
2502
|
return h = h.create, a(a({}, i), h(i));
|
|
2503
2503
|
}, r)) };
|
|
2504
2504
|
}
|
|
2505
2505
|
function hn(e, r) {
|
|
2506
|
-
var n = r.db, r =
|
|
2506
|
+
var n = r.db, r = $o(e._middlewares, n, e._deps, r);
|
|
2507
2507
|
e.core = r.dbcore, e.tables.forEach(function(o) {
|
|
2508
2508
|
var i = o.name;
|
|
2509
2509
|
e.core.schema.tables.some(function(h) {
|
|
@@ -2515,8 +2515,8 @@ function Ra() {
|
|
|
2515
2515
|
n.forEach(function(o) {
|
|
2516
2516
|
var i = r[o];
|
|
2517
2517
|
t.forEach(function(h) {
|
|
2518
|
-
var p = (function v(
|
|
2519
|
-
return Z(
|
|
2518
|
+
var p = (function v(A, B) {
|
|
2519
|
+
return Z(A, B) || (A = I(A)) && v(A, B);
|
|
2520
2520
|
})(h, o);
|
|
2521
2521
|
(!p || "value" in p && p.value === void 0) && (h === e.Transaction.prototype || h instanceof e.Transaction ? M(h, o, { get: function() {
|
|
2522
2522
|
return this.table(o);
|
|
@@ -2531,19 +2531,19 @@ function Ra() {
|
|
|
2531
2531
|
for (var r in n) n[r] instanceof e.Table && delete n[r];
|
|
2532
2532
|
});
|
|
2533
2533
|
}
|
|
2534
|
-
function
|
|
2534
|
+
function Vo(e, t) {
|
|
2535
2535
|
return e._cfg.version - t._cfg.version;
|
|
2536
2536
|
}
|
|
2537
|
-
function
|
|
2537
|
+
function Go(e, t, n, r) {
|
|
2538
2538
|
var o = e._dbSchema;
|
|
2539
2539
|
n.objectStoreNames.contains("$meta") && !o.$meta && (o.$meta = Xn("$meta", qr("")[0], []), e._storeNames.push("$meta"));
|
|
2540
2540
|
var i = e._createTransaction("readwrite", e._storeNames, o);
|
|
2541
2541
|
i.create(n), i._completion.catch(r);
|
|
2542
2542
|
var h = i._reject.bind(i), p = Q.transless || Q;
|
|
2543
2543
|
tt(function() {
|
|
2544
|
-
return Q.trans = i, Q.transless = p, t !== 0 ? (hn(e, n),
|
|
2545
|
-
return B ??
|
|
2546
|
-
}) : X.resolve(
|
|
2544
|
+
return Q.trans = i, Q.transless = p, t !== 0 ? (hn(e, n), A = t, ((v = i).storeNames.includes("$meta") ? v.table("$meta").get("version").then(function(B) {
|
|
2545
|
+
return B ?? A;
|
|
2546
|
+
}) : X.resolve(A)).then(function(B) {
|
|
2547
2547
|
return N = B, _ = i, w = n, x = [], B = (y = e)._versions, T = y._dbSchema = gn(0, y.idbdb, w), (B = B.filter(function(R) {
|
|
2548
2548
|
return R._cfg.version >= N;
|
|
2549
2549
|
})).length !== 0 ? (B.forEach(function(R) {
|
|
@@ -2600,10 +2600,10 @@ function Ra() {
|
|
|
2600
2600
|
}), hn(e, n), void X.follow(function() {
|
|
2601
2601
|
return e.on.populate.fire(i);
|
|
2602
2602
|
}).catch(h));
|
|
2603
|
-
var v,
|
|
2603
|
+
var v, A;
|
|
2604
2604
|
});
|
|
2605
2605
|
}
|
|
2606
|
-
function
|
|
2606
|
+
function Xo(e, t) {
|
|
2607
2607
|
Kr(e._dbSchema, t), t.db.version % 10 != 0 || t.objectStoreNames.contains("$meta") || t.db.createObjectStore("$meta").add(Math.ceil(t.db.version / 10 - 1), "version");
|
|
2608
2608
|
var n = gn(0, e.idbdb, t);
|
|
2609
2609
|
yn(e, e._dbSchema, t);
|
|
@@ -2627,10 +2627,10 @@ function Ra() {
|
|
|
2627
2627
|
var h = { name: n, def: i, recreate: !1, del: [], add: [], change: [] };
|
|
2628
2628
|
if ("" + (o.primKey.keyPath || "") != "" + (i.primKey.keyPath || "") || o.primKey.auto !== i.primKey.auto) h.recreate = !0, r.change.push(h);
|
|
2629
2629
|
else {
|
|
2630
|
-
var p = o.idxByName, v = i.idxByName,
|
|
2631
|
-
for (
|
|
2632
|
-
for (
|
|
2633
|
-
var B = p[
|
|
2630
|
+
var p = o.idxByName, v = i.idxByName, A = void 0;
|
|
2631
|
+
for (A in p) v[A] || h.del.push(A);
|
|
2632
|
+
for (A in v) {
|
|
2633
|
+
var B = p[A], y = v[A];
|
|
2634
2634
|
B ? B.src !== y.src && h.change.push(y) : h.add.push(y);
|
|
2635
2635
|
}
|
|
2636
2636
|
(0 < h.del.length || 0 < h.add.length || 0 < h.change.length) && r.change.push(h);
|
|
@@ -2656,8 +2656,8 @@ function Ra() {
|
|
|
2656
2656
|
function gn(e, t, n) {
|
|
2657
2657
|
var r = {};
|
|
2658
2658
|
return be(t.objectStoreNames, 0).forEach(function(o) {
|
|
2659
|
-
for (var i = n.objectStore(o), h = Gn(Mr(
|
|
2660
|
-
var B = i.index(i.indexNames[v]),
|
|
2659
|
+
for (var i = n.objectStore(o), h = Gn(Mr(A = i.keyPath), A || "", !0, !1, !!i.autoIncrement, A && typeof A != "string", !0), p = [], v = 0; v < i.indexNames.length; ++v) {
|
|
2660
|
+
var B = i.index(i.indexNames[v]), A = B.keyPath, B = Gn(B.name, A, !!B.unique, !!B.multiEntry, !1, A && typeof A != "string", !1);
|
|
2661
2661
|
p.push(B);
|
|
2662
2662
|
}
|
|
2663
2663
|
r[o] = Xn(o, h, p);
|
|
@@ -2668,8 +2668,8 @@ function Ra() {
|
|
|
2668
2668
|
var i = r[o], h = n.objectStore(i);
|
|
2669
2669
|
e._hasGetAll = "getAll" in h;
|
|
2670
2670
|
for (var p = 0; p < h.indexNames.length; ++p) {
|
|
2671
|
-
var v = h.indexNames[p],
|
|
2672
|
-
!t[i] || (
|
|
2671
|
+
var v = h.indexNames[p], A = h.index(v).keyPath, B = typeof A == "string" ? A : "[" + be(A).join("+") + "]";
|
|
2672
|
+
!t[i] || (A = t[i].idxByName[B]) && (A.name = v, delete t[i].idxByName[B], t[i].idxByName[v] = A);
|
|
2673
2673
|
}
|
|
2674
2674
|
}
|
|
2675
2675
|
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && m.WorkerGlobalScope && m instanceof m.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
|
|
@@ -2680,7 +2680,7 @@ function Ra() {
|
|
|
2680
2680
|
return Gn(o, i || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), b(i), n === 0, r);
|
|
2681
2681
|
});
|
|
2682
2682
|
}
|
|
2683
|
-
var
|
|
2683
|
+
var Wo = (Rt.prototype._createTableSchema = Xn, Rt.prototype._parseIndexSyntax = qr, Rt.prototype._parseStoresSpec = function(e, t) {
|
|
2684
2684
|
var n = this;
|
|
2685
2685
|
g(e).forEach(function(r) {
|
|
2686
2686
|
if (e[r] !== null) {
|
|
@@ -2695,13 +2695,13 @@ function Ra() {
|
|
|
2695
2695
|
});
|
|
2696
2696
|
}, Rt.prototype.stores = function(n) {
|
|
2697
2697
|
var t = this.db;
|
|
2698
|
-
this._cfg.storesSource = this._cfg.storesSource ?
|
|
2698
|
+
this._cfg.storesSource = this._cfg.storesSource ? C(this._cfg.storesSource, n) : n;
|
|
2699
2699
|
var n = t._versions, r = {}, o = {};
|
|
2700
2700
|
return n.forEach(function(i) {
|
|
2701
|
-
|
|
2701
|
+
C(r, i._cfg.storesSource), o = i._cfg.dbschema = {}, i._parseStoresSpec(r, o);
|
|
2702
2702
|
}), t._dbSchema = o, Yn(t, [t._allTables, t, t.Transaction.prototype]), mn(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], g(o), o), t._storeNames = g(o), this;
|
|
2703
2703
|
}, Rt.prototype.upgrade = function(e) {
|
|
2704
|
-
return this._cfg.contentUpgrade =
|
|
2704
|
+
return this._cfg.contentUpgrade = Ct(this._cfg.contentUpgrade || J, e), this;
|
|
2705
2705
|
}, Rt);
|
|
2706
2706
|
function Rt() {
|
|
2707
2707
|
}
|
|
@@ -2723,15 +2723,15 @@ function Ra() {
|
|
|
2723
2723
|
var Ne = function(e, t) {
|
|
2724
2724
|
if (!this) {
|
|
2725
2725
|
var n = new Ne();
|
|
2726
|
-
return e && "d" in e &&
|
|
2726
|
+
return e && "d" in e && C(n, e), n;
|
|
2727
2727
|
}
|
|
2728
|
-
|
|
2728
|
+
C(this, arguments.length ? { d: 1, from: e, to: 1 < arguments.length ? t : e } : { d: 0 });
|
|
2729
2729
|
};
|
|
2730
2730
|
function Xt(e, t, n) {
|
|
2731
2731
|
var r = se(t, n);
|
|
2732
2732
|
if (!isNaN(r)) {
|
|
2733
2733
|
if (0 < r) throw RangeError();
|
|
2734
|
-
if (er(e)) return
|
|
2734
|
+
if (er(e)) return C(e, { from: t, to: n, d: 1 });
|
|
2735
2735
|
var o = e.l, r = e.r;
|
|
2736
2736
|
if (se(n, e.from) < 0) return o ? Xt(o, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null }, Ur(e);
|
|
2737
2737
|
if (0 < se(t, e.to)) return r ? Xt(r, t, n) : e.r = { from: t, to: n, d: 1, l: null, r: null }, Ur(e);
|
|
@@ -2807,7 +2807,7 @@ function Ra() {
|
|
|
2807
2807
|
}, hasKey: function(e) {
|
|
2808
2808
|
var t = bn(this).next(e).value;
|
|
2809
2809
|
return t && se(t.from, e) <= 0 && 0 <= se(t.to, e);
|
|
2810
|
-
} })[
|
|
2810
|
+
} })[At] = function() {
|
|
2811
2811
|
return bn(this);
|
|
2812
2812
|
}, Me));
|
|
2813
2813
|
var bt = {}, nr = {}, rr = !1;
|
|
@@ -2830,23 +2830,23 @@ function Ra() {
|
|
|
2830
2830
|
}
|
|
2831
2831
|
function Vr(e, t, n, r) {
|
|
2832
2832
|
for (var o = [], i = 0, h = Object.entries(e.queries.query); i < h.length; i++) {
|
|
2833
|
-
for (var p = h[i], v = p[0],
|
|
2833
|
+
for (var p = h[i], v = p[0], A = [], B = 0, y = p[1]; B < y.length; B++) {
|
|
2834
2834
|
var N = y[B];
|
|
2835
2835
|
tr(t, N.obsSet) ? N.subscribers.forEach(function(T) {
|
|
2836
2836
|
return n.add(T);
|
|
2837
|
-
}) : r &&
|
|
2837
|
+
}) : r && A.push(N);
|
|
2838
2838
|
}
|
|
2839
|
-
r && o.push([v,
|
|
2839
|
+
r && o.push([v, A]);
|
|
2840
2840
|
}
|
|
2841
2841
|
if (r) for (var _ = 0, w = o; _ < w.length; _++) {
|
|
2842
|
-
var x = w[_], v = x[0],
|
|
2843
|
-
e.queries.query[v] =
|
|
2842
|
+
var x = w[_], v = x[0], A = x[1];
|
|
2843
|
+
e.queries.query[v] = A;
|
|
2844
2844
|
}
|
|
2845
2845
|
}
|
|
2846
|
-
function
|
|
2846
|
+
function Yo(e) {
|
|
2847
2847
|
var t = e._state, n = e._deps.indexedDB;
|
|
2848
2848
|
if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then(function() {
|
|
2849
|
-
return t.dbOpenError ?
|
|
2849
|
+
return t.dbOpenError ? Ae(t.dbOpenError) : e;
|
|
2850
2850
|
});
|
|
2851
2851
|
t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
|
|
2852
2852
|
var r = t.openCanceller, o = Math.round(10 * e.verno), i = !1;
|
|
@@ -2862,7 +2862,7 @@ function Ra() {
|
|
|
2862
2862
|
var R;
|
|
2863
2863
|
B = x.transaction, t.autoSchema && !e._options.allowEmptyDB ? (x.onerror = Ut, B.abort(), x.result.close(), (R = n.deleteDatabase(w)).onsuccess = R.onerror = ge(function() {
|
|
2864
2864
|
_(new O.NoSuchDatabase("Database ".concat(w, " doesnt exist")));
|
|
2865
|
-
})) : (B.onerror = Ue(_), T = T.oldVersion > Math.pow(2, 62) ? 0 : T.oldVersion, y = T < 1, e.idbdb = x.result, i &&
|
|
2865
|
+
})) : (B.onerror = Ue(_), T = T.oldVersion > Math.pow(2, 62) ? 0 : T.oldVersion, y = T < 1, e.idbdb = x.result, i && Xo(e, B), Go(e, T / 10, B, _));
|
|
2866
2866
|
}, _), x.onsuccess = ge(function() {
|
|
2867
2867
|
B = null;
|
|
2868
2868
|
var T, R, P, S, k, j = e.idbdb = x.result, U = be(j.objectStoreNames);
|
|
@@ -2892,7 +2892,7 @@ function Ra() {
|
|
|
2892
2892
|
return X.reject(N);
|
|
2893
2893
|
});
|
|
2894
2894
|
}
|
|
2895
|
-
var v,
|
|
2895
|
+
var v, A = t.dbReadyResolve, B = null, y = !1;
|
|
2896
2896
|
return X.race([r, (typeof navigator > "u" ? X.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(N) {
|
|
2897
2897
|
function _() {
|
|
2898
2898
|
return indexedDB.databases().finally(N);
|
|
@@ -2905,7 +2905,7 @@ function Ra() {
|
|
|
2905
2905
|
return e.on.ready.fire(e.vip);
|
|
2906
2906
|
})).then(function N() {
|
|
2907
2907
|
if (0 < t.onReadyBeingFired.length) {
|
|
2908
|
-
var _ = t.onReadyBeingFired.reduce(
|
|
2908
|
+
var _ = t.onReadyBeingFired.reduce(Ct, J);
|
|
2909
2909
|
return t.onReadyBeingFired = [], X.resolve(Jn(function() {
|
|
2910
2910
|
return _(e.vip);
|
|
2911
2911
|
})).then(N);
|
|
@@ -2919,9 +2919,9 @@ function Ra() {
|
|
|
2919
2919
|
B && B.abort();
|
|
2920
2920
|
} catch {
|
|
2921
2921
|
}
|
|
2922
|
-
return r === t.openCanceller && e._close(),
|
|
2922
|
+
return r === t.openCanceller && e._close(), Ae(N);
|
|
2923
2923
|
}).finally(function() {
|
|
2924
|
-
t.openComplete = !0,
|
|
2924
|
+
t.openComplete = !0, A();
|
|
2925
2925
|
}).then(function() {
|
|
2926
2926
|
var N;
|
|
2927
2927
|
return y && (N = {}, e.tables.forEach(function(_) {
|
|
@@ -2946,11 +2946,11 @@ function Ra() {
|
|
|
2946
2946
|
}
|
|
2947
2947
|
return o(t)();
|
|
2948
2948
|
}
|
|
2949
|
-
function
|
|
2949
|
+
function An(e, t, n) {
|
|
2950
2950
|
for (var r = b(e) ? e.slice() : [e], o = 0; o < n; ++o) r.push(t);
|
|
2951
2951
|
return r;
|
|
2952
2952
|
}
|
|
2953
|
-
var
|
|
2953
|
+
var zo = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
|
|
2954
2954
|
return a(a({}, e), { table: function(t) {
|
|
2955
2955
|
var n = e.table(t), r = n.schema, o = {}, i = [];
|
|
2956
2956
|
function h(y, N, _) {
|
|
@@ -2961,12 +2961,12 @@ function Ra() {
|
|
|
2961
2961
|
}
|
|
2962
2962
|
t = h(r.primaryKey.keyPath, 0, r.primaryKey), o[":id"] = [t];
|
|
2963
2963
|
for (var p = 0, v = r.indexes; p < v.length; p++) {
|
|
2964
|
-
var
|
|
2965
|
-
h(
|
|
2964
|
+
var A = v[p];
|
|
2965
|
+
h(A.keyPath, 0, A);
|
|
2966
2966
|
}
|
|
2967
2967
|
function B(y) {
|
|
2968
2968
|
var N, _ = y.query.index;
|
|
2969
|
-
return _.isVirtual ? a(a({}, y), { query: { index: _.lowLevelIndex, range: (N = y.query.range, _ = _.keyTail, { type: N.type === 1 ? 2 : N.type, lower:
|
|
2969
|
+
return _.isVirtual ? a(a({}, y), { query: { index: _.lowLevelIndex, range: (N = y.query.range, _ = _.keyTail, { type: N.type === 1 ? 2 : N.type, lower: An(N.lower, N.lowerOpen ? e.MAX_KEY : e.MIN_KEY, _), lowerOpen: !0, upper: An(N.upper, N.upperOpen ? e.MIN_KEY : e.MAX_KEY, _), upperOpen: !0 }) } }) : y;
|
|
2970
2970
|
}
|
|
2971
2971
|
return a(a({}, n), { schema: a(a({}, r), { primaryKey: t, indexes: i, getIndexByKeyPath: function(y) {
|
|
2972
2972
|
return (y = o[Gt(y)]) && y[0];
|
|
@@ -2981,9 +2981,9 @@ function Ra() {
|
|
|
2981
2981
|
}) : n.openCursor(y);
|
|
2982
2982
|
function T(R) {
|
|
2983
2983
|
return Object.create(R, { continue: { value: function(P) {
|
|
2984
|
-
P != null ? R.continue(
|
|
2984
|
+
P != null ? R.continue(An(P, y.reverse ? e.MAX_KEY : e.MIN_KEY, _)) : y.unique ? R.continue(R.key.slice(0, x).concat(y.reverse ? e.MIN_KEY : e.MAX_KEY, _)) : R.continue();
|
|
2985
2985
|
} }, continuePrimaryKey: { value: function(P, S) {
|
|
2986
|
-
R.continuePrimaryKey(
|
|
2986
|
+
R.continuePrimaryKey(An(P, e.MAX_KEY, _), S);
|
|
2987
2987
|
} }, primaryKey: { get: function() {
|
|
2988
2988
|
return R.primaryKey;
|
|
2989
2989
|
} }, key: { get: function() {
|
|
@@ -3007,11 +3007,11 @@ function Ra() {
|
|
|
3007
3007
|
function sr(e, t) {
|
|
3008
3008
|
return t.type === "delete" ? t.keys : t.keys || t.values.map(e.extractKey);
|
|
3009
3009
|
}
|
|
3010
|
-
var
|
|
3010
|
+
var Qo = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
|
|
3011
3011
|
return a(a({}, e), { table: function(t) {
|
|
3012
3012
|
var n = e.table(t), r = n.schema.primaryKey;
|
|
3013
3013
|
return a(a({}, n), { mutate: function(o) {
|
|
3014
|
-
var i = Q.trans, h = i.table(t).hook, p = h.deleting, v = h.creating,
|
|
3014
|
+
var i = Q.trans, h = i.table(t).hook, p = h.deleting, v = h.creating, A = h.updating;
|
|
3015
3015
|
switch (o.type) {
|
|
3016
3016
|
case "add":
|
|
3017
3017
|
if (v.fire === J) break;
|
|
@@ -3019,7 +3019,7 @@ function Ra() {
|
|
|
3019
3019
|
return B(o);
|
|
3020
3020
|
}, !0);
|
|
3021
3021
|
case "put":
|
|
3022
|
-
if (v.fire === J &&
|
|
3022
|
+
if (v.fire === J && A.fire === J) break;
|
|
3023
3023
|
return i._promise("readwrite", function() {
|
|
3024
3024
|
return B(o);
|
|
3025
3025
|
}, !0);
|
|
@@ -3048,7 +3048,7 @@ function Ra() {
|
|
|
3048
3048
|
return (y = y.type === "add" || y.type === "put" ? a(a({}, y), { keys: T }) : a({}, y)).type !== "delete" && (y.values = d([], y.values)), y.keys && (y.keys = d([], y.keys)), N = n, w = T, ((_ = y).type === "add" ? Promise.resolve([]) : N.getMany({ trans: _.trans, keys: w, cache: "immutable" })).then(function(R) {
|
|
3049
3049
|
var P = T.map(function(S, k) {
|
|
3050
3050
|
var j, U, q, L = R[k], G = { onerror: null, onsuccess: null };
|
|
3051
|
-
return y.type === "delete" ? p.fire.call(G, S, L, x) : y.type === "add" || L === void 0 ? (j = v.fire.call(G, S, y.values[k], x), S == null && j != null && (y.keys[k] = S = j, r.outbound || ae(y.values[k], r.keyPath, S))) : (j = ir(L, y.values[k]), (U =
|
|
3051
|
+
return y.type === "delete" ? p.fire.call(G, S, L, x) : y.type === "add" || L === void 0 ? (j = v.fire.call(G, S, y.values[k], x), S == null && j != null && (y.keys[k] = S = j, r.outbound || ae(y.values[k], r.keyPath, S))) : (j = ir(L, y.values[k]), (U = A.fire.call(G, j, S, L, x)) && (q = y.values[k], Object.keys(U).forEach(function(V) {
|
|
3052
3052
|
$(q, V) ? q[V] = U[V] : ae(q, V, U[V]);
|
|
3053
3053
|
}))), G;
|
|
3054
3054
|
});
|
|
@@ -3077,7 +3077,7 @@ function Ra() {
|
|
|
3077
3077
|
return null;
|
|
3078
3078
|
}
|
|
3079
3079
|
}
|
|
3080
|
-
var
|
|
3080
|
+
var Ho = { stack: "dbcore", level: -1, create: function(e) {
|
|
3081
3081
|
return { table: function(t) {
|
|
3082
3082
|
var n = e.table(t);
|
|
3083
3083
|
return a(a({}, n), { getMany: function(r) {
|
|
@@ -3105,13 +3105,13 @@ function Ra() {
|
|
|
3105
3105
|
return !1;
|
|
3106
3106
|
}
|
|
3107
3107
|
}
|
|
3108
|
-
var
|
|
3108
|
+
var Zo = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
|
|
3109
3109
|
var t = e.schema.name, n = new Ne(e.MIN_KEY, e.MAX_KEY);
|
|
3110
3110
|
return a(a({}, e), { transaction: function(r, o, i) {
|
|
3111
3111
|
if (Q.subscr && o !== "readonly") throw new O.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(Q.querier));
|
|
3112
3112
|
return e.transaction(r, o, i);
|
|
3113
3113
|
}, table: function(r) {
|
|
3114
|
-
var o = e.table(r), i = o.schema, h = i.primaryKey, y = i.indexes, p = h.extractKey, v = h.outbound,
|
|
3114
|
+
var o = e.table(r), i = o.schema, h = i.primaryKey, y = i.indexes, p = h.extractKey, v = h.outbound, A = h.autoIncrement && y.filter(function(_) {
|
|
3115
3115
|
return _.compound && _.keyPath.includes(h.keyPath);
|
|
3116
3116
|
}), B = a(a({}, o), { mutate: function(_) {
|
|
3117
3117
|
function w(V) {
|
|
@@ -3137,7 +3137,7 @@ function Ra() {
|
|
|
3137
3137
|
}))) : q ? (L = { from: (L = q.lower) !== null && L !== void 0 ? L : e.MIN_KEY, to: (L = q.upper) !== null && L !== void 0 ? L : e.MAX_KEY }, j.add(L), k.add(L)) : (k.add(n), j.add(n), i.indexes.forEach(function(V) {
|
|
3138
3138
|
return w(V.name).add(n);
|
|
3139
3139
|
})), o.mutate(_).then(function(V) {
|
|
3140
|
-
return !q || _.type !== "add" && _.type !== "put" || (k.addKeys(V.results),
|
|
3140
|
+
return !q || _.type !== "add" && _.type !== "put" || (k.addKeys(V.results), A && A.forEach(function(W) {
|
|
3141
3141
|
for (var oe = _.values.map(function(ee) {
|
|
3142
3142
|
return W.extractKey(ee);
|
|
3143
3143
|
}), ce = W.keyPath.findIndex(function(ee) {
|
|
@@ -3209,10 +3209,10 @@ function Ra() {
|
|
|
3209
3209
|
}
|
|
3210
3210
|
function zr(e, t, N, r, o, i) {
|
|
3211
3211
|
if (!N || N.length === 0) return e;
|
|
3212
|
-
var h = t.query.index, p = h.multiEntry, v = t.query.range,
|
|
3212
|
+
var h = t.query.index, p = h.multiEntry, v = t.query.range, A = r.schema.primaryKey.extractKey, B = h.extractKey, y = (h.lowLevelIndex || h).extractKey, N = N.reduce(function(_, w) {
|
|
3213
3213
|
var x = _, T = [];
|
|
3214
3214
|
if (w.type === "add" || w.type === "put") for (var R = new Ne(), P = w.values.length - 1; 0 <= P; --P) {
|
|
3215
|
-
var S, k = w.values[P], j =
|
|
3215
|
+
var S, k = w.values[P], j = A(k);
|
|
3216
3216
|
R.hasKey(j) || (S = B(k), (p && b(S) ? S.some(function(V) {
|
|
3217
3217
|
return ur(V, v);
|
|
3218
3218
|
}) : ur(S, v)) && (R.addKey(j), T.push(k)));
|
|
@@ -3220,47 +3220,47 @@ function Ra() {
|
|
|
3220
3220
|
switch (w.type) {
|
|
3221
3221
|
case "add":
|
|
3222
3222
|
var U = new Ne().addKeys(t.values ? _.map(function(W) {
|
|
3223
|
-
return
|
|
3223
|
+
return A(W);
|
|
3224
3224
|
}) : _), x = _.concat(t.values ? T.filter(function(W) {
|
|
3225
|
-
return W =
|
|
3225
|
+
return W = A(W), !U.hasKey(W) && (U.addKey(W), !0);
|
|
3226
3226
|
}) : T.map(function(W) {
|
|
3227
|
-
return
|
|
3227
|
+
return A(W);
|
|
3228
3228
|
}).filter(function(W) {
|
|
3229
3229
|
return !U.hasKey(W) && (U.addKey(W), !0);
|
|
3230
3230
|
}));
|
|
3231
3231
|
break;
|
|
3232
3232
|
case "put":
|
|
3233
3233
|
var q = new Ne().addKeys(w.values.map(function(W) {
|
|
3234
|
-
return
|
|
3234
|
+
return A(W);
|
|
3235
3235
|
}));
|
|
3236
3236
|
x = _.filter(function(W) {
|
|
3237
|
-
return !q.hasKey(t.values ?
|
|
3237
|
+
return !q.hasKey(t.values ? A(W) : W);
|
|
3238
3238
|
}).concat(t.values ? T : T.map(function(W) {
|
|
3239
|
-
return
|
|
3239
|
+
return A(W);
|
|
3240
3240
|
}));
|
|
3241
3241
|
break;
|
|
3242
3242
|
case "delete":
|
|
3243
3243
|
var L = new Ne().addKeys(w.keys);
|
|
3244
3244
|
x = _.filter(function(W) {
|
|
3245
|
-
return !L.hasKey(t.values ?
|
|
3245
|
+
return !L.hasKey(t.values ? A(W) : W);
|
|
3246
3246
|
});
|
|
3247
3247
|
break;
|
|
3248
3248
|
case "deleteRange":
|
|
3249
3249
|
var G = w.range;
|
|
3250
3250
|
x = _.filter(function(W) {
|
|
3251
|
-
return !ur(
|
|
3251
|
+
return !ur(A(W), G);
|
|
3252
3252
|
});
|
|
3253
3253
|
}
|
|
3254
3254
|
return x;
|
|
3255
3255
|
}, e);
|
|
3256
3256
|
return N === e ? e : (N.sort(function(_, w) {
|
|
3257
|
-
return se(y(_), y(w)) || se(
|
|
3257
|
+
return se(y(_), y(w)) || se(A(_), A(w));
|
|
3258
3258
|
}), t.limit && t.limit < 1 / 0 && (N.length > t.limit ? N.length = t.limit : e.length === t.limit && N.length < t.limit && (o.dirty = !0)), i ? Object.freeze(N) : N);
|
|
3259
3259
|
}
|
|
3260
3260
|
function Qr(e, t) {
|
|
3261
3261
|
return se(e.lower, t.lower) === 0 && se(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
|
|
3262
3262
|
}
|
|
3263
|
-
function
|
|
3263
|
+
function Jo(e, t) {
|
|
3264
3264
|
return (function(n, r, o, i) {
|
|
3265
3265
|
if (n === void 0) return r !== void 0 ? -1 : 0;
|
|
3266
3266
|
if (r === void 0) return 1;
|
|
@@ -3281,7 +3281,7 @@ function Ra() {
|
|
|
3281
3281
|
return r;
|
|
3282
3282
|
})(e.upper, t.upper, e.upperOpen, t.upperOpen);
|
|
3283
3283
|
}
|
|
3284
|
-
function
|
|
3284
|
+
function ea(e, t, n, r) {
|
|
3285
3285
|
e.subscribers.add(n), r.addEventListener("abort", function() {
|
|
3286
3286
|
var o, i;
|
|
3287
3287
|
e.subscribers.delete(n), e.subscribers.size === 0 && (o = e, i = t, setTimeout(function() {
|
|
@@ -3289,35 +3289,35 @@ function Ra() {
|
|
|
3289
3289
|
}, 3e3));
|
|
3290
3290
|
});
|
|
3291
3291
|
}
|
|
3292
|
-
var
|
|
3292
|
+
var ta = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
|
|
3293
3293
|
var t = e.schema.name;
|
|
3294
3294
|
return a(a({}, e), { transaction: function(n, r, o) {
|
|
3295
3295
|
var i, h, p = e.transaction(n, r, o);
|
|
3296
3296
|
return r === "readwrite" && (h = (i = new AbortController()).signal, o = function(v) {
|
|
3297
3297
|
return function() {
|
|
3298
3298
|
if (i.abort(), r === "readwrite") {
|
|
3299
|
-
for (var
|
|
3299
|
+
for (var A = /* @__PURE__ */ new Set(), B = 0, y = n; B < y.length; B++) {
|
|
3300
3300
|
var N = y[B], _ = bt["idb://".concat(t, "/").concat(N)];
|
|
3301
3301
|
if (_) {
|
|
3302
3302
|
var w = e.table(N), x = _.optimisticOps.filter(function(W) {
|
|
3303
3303
|
return W.trans === p;
|
|
3304
3304
|
});
|
|
3305
3305
|
if (p._explicit && v && p.mutatedParts) for (var T = 0, R = Object.values(_.queries.query); T < R.length; T++) for (var P = 0, S = (U = R[T]).slice(); P < S.length; P++) tr((q = S[P]).obsSet, p.mutatedParts) && (Ge(U, q), q.subscribers.forEach(function(W) {
|
|
3306
|
-
return
|
|
3306
|
+
return A.add(W);
|
|
3307
3307
|
}));
|
|
3308
3308
|
else if (0 < x.length) {
|
|
3309
3309
|
_.optimisticOps = _.optimisticOps.filter(function(W) {
|
|
3310
3310
|
return W.trans !== p;
|
|
3311
3311
|
});
|
|
3312
3312
|
for (var k = 0, j = Object.values(_.queries.query); k < j.length; k++) for (var U, q, L, G = 0, V = (U = j[k]).slice(); G < V.length; G++) (q = V[G]).res != null && p.mutatedParts && (v && !q.dirty ? (L = Object.isFrozen(q.res), L = zr(q.res, q.req, x, w, q, L), q.dirty ? (Ge(U, q), q.subscribers.forEach(function(W) {
|
|
3313
|
-
return
|
|
3313
|
+
return A.add(W);
|
|
3314
3314
|
})) : L !== q.res && (q.res = L, q.promise = X.resolve({ result: L }))) : (q.dirty && Ge(U, q), q.subscribers.forEach(function(W) {
|
|
3315
|
-
return
|
|
3315
|
+
return A.add(W);
|
|
3316
3316
|
})));
|
|
3317
3317
|
}
|
|
3318
3318
|
}
|
|
3319
3319
|
}
|
|
3320
|
-
|
|
3320
|
+
A.forEach(function(W) {
|
|
3321
3321
|
return W();
|
|
3322
3322
|
});
|
|
3323
3323
|
}
|
|
@@ -3336,17 +3336,17 @@ function Ra() {
|
|
|
3336
3336
|
}), h.catch(function() {
|
|
3337
3337
|
Ge(p.optimisticOps, i), i.mutatedParts && _n(i.mutatedParts);
|
|
3338
3338
|
})) : h.then(function(v) {
|
|
3339
|
-
var
|
|
3339
|
+
var A = Yr(0, a(a({}, i), { values: i.values.map(function(B, y) {
|
|
3340
3340
|
var N;
|
|
3341
3341
|
return v.failures[y] ? B : (B = (N = o.keyPath) !== null && N !== void 0 && N.includes(".") ? Se(B) : a({}, B), ae(B, o.keyPath, v.results[y]), B);
|
|
3342
3342
|
}) }), v);
|
|
3343
|
-
p.optimisticOps.push(
|
|
3343
|
+
p.optimisticOps.push(A), queueMicrotask(function() {
|
|
3344
3344
|
return i.mutatedParts && _n(i.mutatedParts);
|
|
3345
3345
|
});
|
|
3346
3346
|
}), h) : r.mutate(i);
|
|
3347
3347
|
}, query: function(i) {
|
|
3348
3348
|
if (!Xr(Q, r) || !Wr("query", i)) return r.query(i);
|
|
3349
|
-
var h = ((
|
|
3349
|
+
var h = ((A = Q.trans) === null || A === void 0 ? void 0 : A.db._options.cache) === "immutable", y = Q, p = y.requery, v = y.signal, A = (function(w, x, T, R) {
|
|
3350
3350
|
var P = bt["idb://".concat(w, "/").concat(x)];
|
|
3351
3351
|
if (!P) return [];
|
|
3352
3352
|
if (!(x = P.queries[T])) return [null, !1, P, null];
|
|
@@ -3358,14 +3358,14 @@ function Ra() {
|
|
|
3358
3358
|
return j.req.limit === R.limit && j.req.values === R.values && Qr(j.req.query.range, R.query.range);
|
|
3359
3359
|
});
|
|
3360
3360
|
return k ? [k, !0, P, S] : [S.find(function(j) {
|
|
3361
|
-
return ("limit" in j.req ? j.req.limit : 1 / 0) >= R.limit && (!R.values || j.req.values) &&
|
|
3361
|
+
return ("limit" in j.req ? j.req.limit : 1 / 0) >= R.limit && (!R.values || j.req.values) && Jo(j.req.query.range, R.query.range);
|
|
3362
3362
|
}), !1, P, S];
|
|
3363
3363
|
case "count":
|
|
3364
3364
|
return k = S.find(function(j) {
|
|
3365
3365
|
return Qr(j.req.query.range, R.query.range);
|
|
3366
3366
|
}), [k, !!k, P, S];
|
|
3367
3367
|
}
|
|
3368
|
-
})(t, n, "query", i), B =
|
|
3368
|
+
})(t, n, "query", i), B = A[0], y = A[1], N = A[2], _ = A[3];
|
|
3369
3369
|
return B && y ? B.obsSet = i.obsSet : (y = r.query(i).then(function(w) {
|
|
3370
3370
|
var x = w.result;
|
|
3371
3371
|
if (B && (B.res = x), h) {
|
|
@@ -3375,26 +3375,26 @@ function Ra() {
|
|
|
3375
3375
|
return w;
|
|
3376
3376
|
}).catch(function(w) {
|
|
3377
3377
|
return _ && B && Ge(_, B), Promise.reject(w);
|
|
3378
|
-
}), B = { obsSet: i.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: i, dirty: !1 }, _ ? _.push(B) : (_ = [B], (N = N || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[i.query.index.name || ""] = _)),
|
|
3378
|
+
}), B = { obsSet: i.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: i, dirty: !1 }, _ ? _.push(B) : (_ = [B], (N = N || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[i.query.index.name || ""] = _)), ea(B, _, p, v), B.promise.then(function(w) {
|
|
3379
3379
|
return { result: zr(w.result, i, N?.optimisticOps, r, B, h) };
|
|
3380
3380
|
});
|
|
3381
3381
|
} });
|
|
3382
3382
|
} });
|
|
3383
3383
|
} };
|
|
3384
|
-
function
|
|
3384
|
+
function Cn(e, t) {
|
|
3385
3385
|
return new Proxy(e, { get: function(n, r, o) {
|
|
3386
3386
|
return r === "db" ? t : Reflect.get(n, r, o);
|
|
3387
3387
|
} });
|
|
3388
3388
|
}
|
|
3389
|
-
var We = (
|
|
3389
|
+
var We = (Ce.prototype.version = function(e) {
|
|
3390
3390
|
if (isNaN(e) || e < 0.1) throw new O.Type("Given version is not a positive number");
|
|
3391
3391
|
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new O.Schema("Cannot add version when database is open");
|
|
3392
3392
|
this.verno = Math.max(this.verno, e);
|
|
3393
3393
|
var t = this._versions, n = t.filter(function(r) {
|
|
3394
3394
|
return r._cfg.version === e;
|
|
3395
3395
|
})[0];
|
|
3396
|
-
return n || (n = new this.Version(e), t.push(n), t.sort(
|
|
3397
|
-
},
|
|
3396
|
+
return n || (n = new this.Version(e), t.push(n), t.sort(Vo), n.stores({}), this._state.autoSchema = !1, n);
|
|
3397
|
+
}, Ce.prototype._whenReady = function(e) {
|
|
3398
3398
|
var t = this;
|
|
3399
3399
|
return this.idbdb && (this._state.openComplete || Q.letThrough || this._vip) ? e() : new X(function(n, r) {
|
|
3400
3400
|
if (t._state.openComplete) return r(new O.DatabaseClosed(t._state.dbOpenError));
|
|
@@ -3404,22 +3404,22 @@ function Ra() {
|
|
|
3404
3404
|
}
|
|
3405
3405
|
t._state.dbReadyPromise.then(n, r);
|
|
3406
3406
|
}).then(e);
|
|
3407
|
-
},
|
|
3407
|
+
}, Ce.prototype.use = function(e) {
|
|
3408
3408
|
var t = e.stack, n = e.create, r = e.level, o = e.name;
|
|
3409
3409
|
return o && this.unuse({ stack: t, name: o }), e = this._middlewares[t] || (this._middlewares[t] = []), e.push({ stack: t, create: n, level: r ?? 10, name: o }), e.sort(function(i, h) {
|
|
3410
3410
|
return i.level - h.level;
|
|
3411
3411
|
}), this;
|
|
3412
|
-
},
|
|
3412
|
+
}, Ce.prototype.unuse = function(e) {
|
|
3413
3413
|
var t = e.stack, n = e.name, r = e.create;
|
|
3414
3414
|
return t && this._middlewares[t] && (this._middlewares[t] = this._middlewares[t].filter(function(o) {
|
|
3415
3415
|
return r ? o.create !== r : !!n && o.name !== n;
|
|
3416
3416
|
})), this;
|
|
3417
|
-
},
|
|
3417
|
+
}, Ce.prototype.open = function() {
|
|
3418
3418
|
var e = this;
|
|
3419
3419
|
return pt(et, function() {
|
|
3420
|
-
return
|
|
3420
|
+
return Yo(e);
|
|
3421
3421
|
});
|
|
3422
|
-
},
|
|
3422
|
+
}, Ce.prototype._close = function() {
|
|
3423
3423
|
this.on.close.fire(new CustomEvent("close"));
|
|
3424
3424
|
var e = this._state, t = Tt.indexOf(this);
|
|
3425
3425
|
if (0 <= t && Tt.splice(t, 1), this.idbdb) {
|
|
@@ -3434,10 +3434,10 @@ function Ra() {
|
|
|
3434
3434
|
}), e.openCanceller = new X(function(n, r) {
|
|
3435
3435
|
e.cancelOpen = r;
|
|
3436
3436
|
}));
|
|
3437
|
-
},
|
|
3437
|
+
}, Ce.prototype.close = function(n) {
|
|
3438
3438
|
var t = (n === void 0 ? { disableAutoOpen: !0 } : n).disableAutoOpen, n = this._state;
|
|
3439
3439
|
t ? (n.isBeingOpened && n.cancelOpen(new O.DatabaseClosed()), this._close(), n.autoOpen = !1, n.dbOpenError = new O.DatabaseClosed()) : (this._close(), n.autoOpen = this._options.autoOpen || n.isBeingOpened, n.openComplete = !1, n.dbOpenError = null);
|
|
3440
|
-
},
|
|
3440
|
+
}, Ce.prototype.delete = function(e) {
|
|
3441
3441
|
var t = this;
|
|
3442
3442
|
e === void 0 && (e = { disableAutoOpen: !0 });
|
|
3443
3443
|
var n = 0 < arguments.length && typeof arguments[0] != "object", r = this._state;
|
|
@@ -3446,30 +3446,30 @@ function Ra() {
|
|
|
3446
3446
|
t.close(e);
|
|
3447
3447
|
var p = t._deps.indexedDB.deleteDatabase(t.name);
|
|
3448
3448
|
p.onsuccess = ge(function() {
|
|
3449
|
-
var v,
|
|
3450
|
-
v = t._deps,
|
|
3449
|
+
var v, A, B;
|
|
3450
|
+
v = t._deps, A = t.name, B = v.indexedDB, v = v.IDBKeyRange, Zn(B) || A === sn || Hn(B, v).delete(A).catch(J), o();
|
|
3451
3451
|
}), p.onerror = Ue(i), p.onblocked = t._fireOnBlocked;
|
|
3452
3452
|
}
|
|
3453
3453
|
if (n) throw new O.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
3454
3454
|
r.isBeingOpened ? r.dbReadyPromise.then(h) : h();
|
|
3455
3455
|
});
|
|
3456
|
-
},
|
|
3456
|
+
}, Ce.prototype.backendDB = function() {
|
|
3457
3457
|
return this.idbdb;
|
|
3458
|
-
},
|
|
3458
|
+
}, Ce.prototype.isOpen = function() {
|
|
3459
3459
|
return this.idbdb !== null;
|
|
3460
|
-
},
|
|
3460
|
+
}, Ce.prototype.hasBeenClosed = function() {
|
|
3461
3461
|
var e = this._state.dbOpenError;
|
|
3462
3462
|
return e && e.name === "DatabaseClosed";
|
|
3463
|
-
},
|
|
3463
|
+
}, Ce.prototype.hasFailed = function() {
|
|
3464
3464
|
return this._state.dbOpenError !== null;
|
|
3465
|
-
},
|
|
3465
|
+
}, Ce.prototype.dynamicallyOpened = function() {
|
|
3466
3466
|
return this._state.autoSchema;
|
|
3467
|
-
}, Object.defineProperty(
|
|
3467
|
+
}, Object.defineProperty(Ce.prototype, "tables", { get: function() {
|
|
3468
3468
|
var e = this;
|
|
3469
3469
|
return g(this._allTables).map(function(t) {
|
|
3470
3470
|
return e._allTables[t];
|
|
3471
3471
|
});
|
|
3472
|
-
}, enumerable: !1, configurable: !0 }),
|
|
3472
|
+
}, enumerable: !1, configurable: !0 }), Ce.prototype.transaction = function() {
|
|
3473
3473
|
var e = (function(t, n, r) {
|
|
3474
3474
|
var o = arguments.length;
|
|
3475
3475
|
if (o < 2) throw new O.InvalidArgument("Too few arguments");
|
|
@@ -3477,15 +3477,15 @@ function Ra() {
|
|
|
3477
3477
|
return r = i.pop(), [t, Dt(i), r];
|
|
3478
3478
|
}).apply(this, arguments);
|
|
3479
3479
|
return this._transaction.apply(this, e);
|
|
3480
|
-
},
|
|
3480
|
+
}, Ce.prototype._transaction = function(e, t, n) {
|
|
3481
3481
|
var r = this, o = Q.trans;
|
|
3482
3482
|
o && o.db === this && e.indexOf("!") === -1 || (o = null);
|
|
3483
3483
|
var i, h, p = e.indexOf("?") !== -1;
|
|
3484
3484
|
e = e.replace("!", "").replace("?", "");
|
|
3485
3485
|
try {
|
|
3486
|
-
if (h = t.map(function(
|
|
3487
|
-
if (
|
|
3488
|
-
return
|
|
3486
|
+
if (h = t.map(function(A) {
|
|
3487
|
+
if (A = A instanceof r.Table ? A.name : A, typeof A != "string") throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
3488
|
+
return A;
|
|
3489
3489
|
}), e == "r" || e === qn) i = qn;
|
|
3490
3490
|
else {
|
|
3491
3491
|
if (e != "rw" && e != Ln) throw new O.InvalidArgument("Invalid transaction mode: " + e);
|
|
@@ -3496,19 +3496,19 @@ function Ra() {
|
|
|
3496
3496
|
if (!p) throw new O.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
3497
3497
|
o = null;
|
|
3498
3498
|
}
|
|
3499
|
-
o && h.forEach(function(
|
|
3500
|
-
if (o && o.storeNames.indexOf(
|
|
3501
|
-
if (!p) throw new O.SubTransaction("Table " +
|
|
3499
|
+
o && h.forEach(function(A) {
|
|
3500
|
+
if (o && o.storeNames.indexOf(A) === -1) {
|
|
3501
|
+
if (!p) throw new O.SubTransaction("Table " + A + " not included in parent transaction.");
|
|
3502
3502
|
o = null;
|
|
3503
3503
|
}
|
|
3504
3504
|
}), p && o && !o.active && (o = null);
|
|
3505
3505
|
}
|
|
3506
|
-
} catch (
|
|
3506
|
+
} catch (A) {
|
|
3507
3507
|
return o ? o._promise(null, function(B, y) {
|
|
3508
|
-
y(
|
|
3509
|
-
}) :
|
|
3508
|
+
y(A);
|
|
3509
|
+
}) : Ae(A);
|
|
3510
3510
|
}
|
|
3511
|
-
var v = (function
|
|
3511
|
+
var v = (function A(B, y, N, _, w) {
|
|
3512
3512
|
return X.resolve().then(function() {
|
|
3513
3513
|
var x = Q.transless || Q, T = B._createTransaction(y, N, B._dbSchema, _);
|
|
3514
3514
|
if (T.explicit = !0, x = { trans: T, transless: x }, _) T.idbtrans = _.idbtrans;
|
|
@@ -3516,15 +3516,15 @@ function Ra() {
|
|
|
3516
3516
|
T.create(), T.idbtrans._explicit = !0, B._state.PR1398_maxLoop = 3;
|
|
3517
3517
|
} catch (S) {
|
|
3518
3518
|
return S.name === f.InvalidState && B.isOpen() && 0 < --B._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), B.close({ disableAutoOpen: !1 }), B.open().then(function() {
|
|
3519
|
-
return
|
|
3520
|
-
})) :
|
|
3519
|
+
return A(B, y, N, null, w);
|
|
3520
|
+
})) : Ae(S);
|
|
3521
3521
|
}
|
|
3522
3522
|
var R, P = Ke(w);
|
|
3523
3523
|
return P && Et(), x = X.follow(function() {
|
|
3524
3524
|
var S;
|
|
3525
3525
|
(R = w.call(T, T)) && (P ? (S = nt.bind(null, null), R.then(S, S)) : typeof R.next == "function" && typeof R.throw == "function" && (R = ar(R)));
|
|
3526
3526
|
}, x), (R && typeof R.then == "function" ? X.resolve(R).then(function(S) {
|
|
3527
|
-
return T.active ? S :
|
|
3527
|
+
return T.active ? S : Ae(new O.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
3528
3528
|
}) : x.then(function() {
|
|
3529
3529
|
return R;
|
|
3530
3530
|
})).then(function(S) {
|
|
@@ -3532,28 +3532,28 @@ function Ra() {
|
|
|
3532
3532
|
return S;
|
|
3533
3533
|
});
|
|
3534
3534
|
}).catch(function(S) {
|
|
3535
|
-
return T._reject(S),
|
|
3535
|
+
return T._reject(S), Ae(S);
|
|
3536
3536
|
});
|
|
3537
3537
|
});
|
|
3538
3538
|
}).bind(null, this, i, h, o, n);
|
|
3539
3539
|
return o ? o._promise(i, v, "lock") : Q.trans ? pt(Q.transless, function() {
|
|
3540
3540
|
return r._whenReady(v);
|
|
3541
3541
|
}) : this._whenReady(v);
|
|
3542
|
-
},
|
|
3542
|
+
}, Ce.prototype.table = function(e) {
|
|
3543
3543
|
if (!$(this._allTables, e)) throw new O.InvalidTable("Table ".concat(e, " does not exist"));
|
|
3544
3544
|
return this._allTables[e];
|
|
3545
|
-
},
|
|
3546
|
-
function
|
|
3545
|
+
}, Ce);
|
|
3546
|
+
function Ce(e, t) {
|
|
3547
3547
|
var n = this;
|
|
3548
3548
|
this._middlewares = {}, this.verno = 0;
|
|
3549
|
-
var r =
|
|
3550
|
-
this._options = t = a({ addons:
|
|
3551
|
-
var o, i, h, p, v,
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
}),
|
|
3555
|
-
|
|
3556
|
-
}), this._state =
|
|
3549
|
+
var r = Ce.dependencies;
|
|
3550
|
+
this._options = t = a({ addons: Ce.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, r = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
3551
|
+
var o, i, h, p, v, A = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: J, dbReadyPromise: null, cancelOpen: J, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
|
|
3552
|
+
A.dbReadyPromise = new X(function(y) {
|
|
3553
|
+
A.dbReadyResolve = y;
|
|
3554
|
+
}), A.openCanceller = new X(function(y, N) {
|
|
3555
|
+
A.cancelOpen = N;
|
|
3556
|
+
}), this._state = A, this.name = e, this.on = Kt(this, "populate", "blocked", "versionchange", "close", { ready: [Ct, J] }), this.once = function(y, N) {
|
|
3557
3557
|
var _ = function() {
|
|
3558
3558
|
for (var w = [], x = 0; x < arguments.length; x++) w[x] = arguments[x];
|
|
3559
3559
|
n.on(y).unsubscribe(_), N.apply(n, w);
|
|
@@ -3561,14 +3561,14 @@ function Ra() {
|
|
|
3561
3561
|
return n.on(y, _);
|
|
3562
3562
|
}, this.on.ready.subscribe = te(this.on.ready.subscribe, function(y) {
|
|
3563
3563
|
return function(N, _) {
|
|
3564
|
-
|
|
3564
|
+
Ce.vip(function() {
|
|
3565
3565
|
var w, x = n._state;
|
|
3566
3566
|
x.openComplete ? (x.dbOpenError || X.resolve().then(N), _ && y(N)) : x.onReadyBeingFired ? (x.onReadyBeingFired.push(N), _ && y(N)) : (y(N), w = n, _ || y(function T() {
|
|
3567
3567
|
w.on.ready.unsubscribe(N), w.on.ready.unsubscribe(T);
|
|
3568
3568
|
}));
|
|
3569
3569
|
});
|
|
3570
3570
|
};
|
|
3571
|
-
}), this.Collection = (o = this, qt(
|
|
3571
|
+
}), this.Collection = (o = this, qt(Mo.prototype, function(R, T) {
|
|
3572
3572
|
this.db = o;
|
|
3573
3573
|
var _ = Tr, w = null;
|
|
3574
3574
|
if (T) try {
|
|
@@ -3580,7 +3580,7 @@ function Ra() {
|
|
|
3580
3580
|
this._ctx = { table: T, index: x.index, isPrimKey: !x.index || T.schema.primKey.keyPath && x.index === T.schema.primKey.name, range: _, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: w, or: x.or, valueMapper: R !== he ? R : null };
|
|
3581
3581
|
})), this.Table = (i = this, qt(Or.prototype, function(y, N, _) {
|
|
3582
3582
|
this.db = i, this._tx = _, this.name = y, this.schema = N, this.hook = i._allTables[y] ? i._allTables[y].hook : Kt(null, { creating: [Je, J], reading: [xe, he], updating: [qe, J], deleting: [we, J] });
|
|
3583
|
-
})), this.Transaction = (h = this, qt(
|
|
3583
|
+
})), this.Transaction = (h = this, qt(qo.prototype, function(y, N, _, w, x) {
|
|
3584
3584
|
var T = this;
|
|
3585
3585
|
y !== "readonly" && N.forEach(function(R) {
|
|
3586
3586
|
R = (R = _[R]) === null || R === void 0 ? void 0 : R.yProps, R && (N = N.concat(R.map(function(P) {
|
|
@@ -3592,9 +3592,9 @@ function Ra() {
|
|
|
3592
3592
|
T.active = !1, T.on.complete.fire();
|
|
3593
3593
|
}, function(R) {
|
|
3594
3594
|
var P = T.active;
|
|
3595
|
-
return T.active = !1, T.on.error.fire(R), T.parent ? T.parent._reject(R) : P && T.idbtrans && T.idbtrans.abort(),
|
|
3595
|
+
return T.active = !1, T.on.error.fire(R), T.parent ? T.parent._reject(R) : P && T.idbtrans && T.idbtrans.abort(), Ae(R);
|
|
3596
3596
|
});
|
|
3597
|
-
})), this.Version = (p = this, qt(
|
|
3597
|
+
})), this.Version = (p = this, qt(Wo.prototype, function(y) {
|
|
3598
3598
|
this.db = p, this._cfg = { version: y, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
3599
3599
|
})), this.WhereClause = (v = this, qt(kr.prototype, function(y, N, _) {
|
|
3600
3600
|
if (this.db = v, this._ctx = { table: y, index: N === ":id" ? null : N, or: _ }, this._cmp = this._ascending = se, this._descending = function(w, x) {
|
|
@@ -3616,24 +3616,24 @@ function Ra() {
|
|
|
3616
3616
|
}).map(function(N) {
|
|
3617
3617
|
return N.on("versionchange").fire(y);
|
|
3618
3618
|
});
|
|
3619
|
-
}, this.use(
|
|
3619
|
+
}, this.use(Ho), this.use(ta), this.use(Zo), this.use(zo), this.use(Qo);
|
|
3620
3620
|
var B = new Proxy(this, { get: function(y, N, _) {
|
|
3621
3621
|
if (N === "_vip") return !0;
|
|
3622
3622
|
if (N === "table") return function(x) {
|
|
3623
|
-
return
|
|
3623
|
+
return Cn(n.table(x), B);
|
|
3624
3624
|
};
|
|
3625
3625
|
var w = Reflect.get(y, N, _);
|
|
3626
|
-
return w instanceof Or ?
|
|
3627
|
-
return
|
|
3626
|
+
return w instanceof Or ? Cn(w, B) : N === "tables" ? w.map(function(x) {
|
|
3627
|
+
return Cn(x, B);
|
|
3628
3628
|
}) : N === "_createTransaction" ? function() {
|
|
3629
|
-
return
|
|
3629
|
+
return Cn(w.apply(this, arguments), B);
|
|
3630
3630
|
} : w;
|
|
3631
3631
|
} });
|
|
3632
3632
|
this.vip = B, r.forEach(function(y) {
|
|
3633
3633
|
return y(n);
|
|
3634
3634
|
});
|
|
3635
3635
|
}
|
|
3636
|
-
var wn, Me = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable",
|
|
3636
|
+
var wn, Me = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", na = (cr.prototype.subscribe = function(e, t, n) {
|
|
3637
3637
|
return this._subscribe(e && typeof e != "function" ? e : { next: e, error: t, complete: n });
|
|
3638
3638
|
}, cr.prototype[Me] = function() {
|
|
3639
3639
|
return this;
|
|
@@ -3647,8 +3647,8 @@ function Ra() {
|
|
|
3647
3647
|
wn = { indexedDB: null, IDBKeyRange: null };
|
|
3648
3648
|
}
|
|
3649
3649
|
function Hr(e) {
|
|
3650
|
-
var t, n = !1, r = new
|
|
3651
|
-
var i = Ke(e), h, p = !1, v = {},
|
|
3650
|
+
var t, n = !1, r = new na(function(o) {
|
|
3651
|
+
var i = Ke(e), h, p = !1, v = {}, A = {}, B = { get closed() {
|
|
3652
3652
|
return p;
|
|
3653
3653
|
}, unsubscribe: function() {
|
|
3654
3654
|
p || (p = !0, h && h.abort(), y && at.storagemutated.unsubscribe(_));
|
|
@@ -3657,7 +3657,7 @@ function Ra() {
|
|
|
3657
3657
|
var y = !1, N = function() {
|
|
3658
3658
|
return Kn(w);
|
|
3659
3659
|
}, _ = function(x) {
|
|
3660
|
-
vn(v, x), tr(
|
|
3660
|
+
vn(v, x), tr(A, v) && N();
|
|
3661
3661
|
}, w = function() {
|
|
3662
3662
|
var x, T, R;
|
|
3663
3663
|
!p && wn.indexedDB && (v = {}, x = {}, h && h.abort(), h = new AbortController(), R = (function(P) {
|
|
@@ -3673,7 +3673,7 @@ function Ra() {
|
|
|
3673
3673
|
n = !0, t = P, p || T.signal.aborted || (v = {}, (function(S) {
|
|
3674
3674
|
for (var k in S) if ($(S, k)) return;
|
|
3675
3675
|
return 1;
|
|
3676
|
-
})(
|
|
3676
|
+
})(A = x) || y || (at($t, _), y = !0), Kn(function() {
|
|
3677
3677
|
return !p && o.next && o.next(P);
|
|
3678
3678
|
}));
|
|
3679
3679
|
}, function(P) {
|
|
@@ -3717,12 +3717,12 @@ function Ra() {
|
|
|
3717
3717
|
});
|
|
3718
3718
|
}) : Hn(n, t).toCollection().primaryKeys()).then(e);
|
|
3719
3719
|
} catch {
|
|
3720
|
-
return
|
|
3720
|
+
return Ae(new O.MissingAPI());
|
|
3721
3721
|
}
|
|
3722
3722
|
var t, n;
|
|
3723
3723
|
}, defineClass: function() {
|
|
3724
3724
|
return function(e) {
|
|
3725
|
-
|
|
3725
|
+
C(this, e);
|
|
3726
3726
|
};
|
|
3727
3727
|
}, ignoreTransaction: function(e) {
|
|
3728
3728
|
return Q.trans ? pt(Q.transless, e) : e();
|
|
@@ -3732,7 +3732,7 @@ function Ra() {
|
|
|
3732
3732
|
var t = ar(e.apply(this, arguments));
|
|
3733
3733
|
return t && typeof t.then == "function" ? t : X.resolve(t);
|
|
3734
3734
|
} catch (n) {
|
|
3735
|
-
return
|
|
3735
|
+
return Ae(n);
|
|
3736
3736
|
}
|
|
3737
3737
|
};
|
|
3738
3738
|
}, spawn: function(e, t, n) {
|
|
@@ -3740,7 +3740,7 @@ function Ra() {
|
|
|
3740
3740
|
var r = ar(e.apply(n, t || []));
|
|
3741
3741
|
return r && typeof r.then == "function" ? r : X.resolve(r);
|
|
3742
3742
|
} catch (o) {
|
|
3743
|
-
return
|
|
3743
|
+
return Ae(o);
|
|
3744
3744
|
}
|
|
3745
3745
|
}, currentTransaction: { get: function() {
|
|
3746
3746
|
return Q.trans || null;
|
|
@@ -3750,7 +3750,7 @@ function Ra() {
|
|
|
3750
3750
|
return Pe;
|
|
3751
3751
|
}, set: function(e) {
|
|
3752
3752
|
St(e);
|
|
3753
|
-
} }, derive: F, extend:
|
|
3753
|
+
} }, derive: F, extend: C, props: Y, override: te, Events: Kt, on: at, liveQuery: Hr, extendObservabilitySet: vn, getByKeyPath: pe, setByKeyPath: ae, delByKeyPath: function(e, t) {
|
|
3754
3754
|
typeof t == "string" ? ae(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
|
|
3755
3755
|
ae(e, n, void 0);
|
|
3756
3756
|
});
|
|
@@ -3792,8 +3792,8 @@ function Ra() {
|
|
|
3792
3792
|
});
|
|
3793
3793
|
})(xn)), xn.exports;
|
|
3794
3794
|
}
|
|
3795
|
-
var
|
|
3796
|
-
const hr = /* @__PURE__ */ yo(
|
|
3795
|
+
var Ra = Na();
|
|
3796
|
+
const hr = /* @__PURE__ */ yo(Ra), to = /* @__PURE__ */ Symbol.for("Dexie"), ct = globalThis[to] || (globalThis[to] = hr);
|
|
3797
3797
|
if (hr.semVer !== ct.semVer)
|
|
3798
3798
|
throw new Error(`Two different versions of Dexie loaded in the same app: ${hr.semVer} and ${ct.semVer}`);
|
|
3799
3799
|
const {
|
|
@@ -3814,8 +3814,8 @@ function bo(l) {
|
|
|
3814
3814
|
[a.name]: a.schema
|
|
3815
3815
|
};
|
|
3816
3816
|
if (d)
|
|
3817
|
-
for (const [b,
|
|
3818
|
-
g[b] =
|
|
3817
|
+
for (const [b, C] of Object.entries(d))
|
|
3818
|
+
g[b] = C.schema;
|
|
3819
3819
|
return m.version(1).stores(g), m;
|
|
3820
3820
|
}
|
|
3821
3821
|
const Rn = {
|
|
@@ -3826,33 +3826,33 @@ const Rn = {
|
|
|
3826
3826
|
function lt(l) {
|
|
3827
3827
|
Object.assign(Rn, l);
|
|
3828
3828
|
}
|
|
3829
|
-
function
|
|
3829
|
+
function Oa(l) {
|
|
3830
3830
|
lt({
|
|
3831
3831
|
loading: !0,
|
|
3832
3832
|
error: null,
|
|
3833
3833
|
progress: l ? { phase: "executing", operation: l } : { phase: "starting" }
|
|
3834
3834
|
});
|
|
3835
3835
|
}
|
|
3836
|
-
function
|
|
3836
|
+
function Da() {
|
|
3837
3837
|
lt({
|
|
3838
3838
|
loading: !1,
|
|
3839
3839
|
progress: null
|
|
3840
3840
|
});
|
|
3841
3841
|
}
|
|
3842
|
-
function
|
|
3842
|
+
function Ia(l) {
|
|
3843
3843
|
lt({
|
|
3844
3844
|
loading: !1,
|
|
3845
3845
|
error: l,
|
|
3846
3846
|
progress: null
|
|
3847
3847
|
});
|
|
3848
3848
|
}
|
|
3849
|
-
function
|
|
3849
|
+
function Pa(l) {
|
|
3850
3850
|
lt({
|
|
3851
3851
|
loading: !0,
|
|
3852
3852
|
progress: { phase: "executing", operation: l }
|
|
3853
3853
|
});
|
|
3854
3854
|
}
|
|
3855
|
-
function
|
|
3855
|
+
function Sa(l) {
|
|
3856
3856
|
const { current: c, total: u, operation: a } = l, d = Rn.progress;
|
|
3857
3857
|
!d || d.phase !== "ending" ? lt({
|
|
3858
3858
|
loading: !0,
|
|
@@ -3870,7 +3870,7 @@ function Fa(l) {
|
|
|
3870
3870
|
}
|
|
3871
3871
|
});
|
|
3872
3872
|
}
|
|
3873
|
-
function
|
|
3873
|
+
function Fa() {
|
|
3874
3874
|
const l = Rn.progress;
|
|
3875
3875
|
l?.phase === "ending" && lt({
|
|
3876
3876
|
loading: !1,
|
|
@@ -3881,14 +3881,14 @@ function ka() {
|
|
|
3881
3881
|
});
|
|
3882
3882
|
}
|
|
3883
3883
|
const st = {
|
|
3884
|
-
setLoading:
|
|
3885
|
-
setIdle:
|
|
3886
|
-
setError:
|
|
3887
|
-
setOperation:
|
|
3888
|
-
updateEndingProgress:
|
|
3889
|
-
setComplete:
|
|
3884
|
+
setLoading: Oa,
|
|
3885
|
+
setIdle: Da,
|
|
3886
|
+
setError: Ia,
|
|
3887
|
+
setOperation: Pa,
|
|
3888
|
+
updateEndingProgress: Sa,
|
|
3889
|
+
setComplete: Fa
|
|
3890
3890
|
};
|
|
3891
|
-
function
|
|
3891
|
+
function ka() {
|
|
3892
3892
|
return Rn;
|
|
3893
3893
|
}
|
|
3894
3894
|
function vo() {
|
|
@@ -3898,11 +3898,11 @@ function vo() {
|
|
|
3898
3898
|
progress: null
|
|
3899
3899
|
});
|
|
3900
3900
|
}
|
|
3901
|
-
function
|
|
3901
|
+
function Ma(l) {
|
|
3902
3902
|
vo();
|
|
3903
3903
|
const { dialecteConfig: c, databaseInstance: u, extensions: a } = l, d = c.database.tables.xmlElements.name, m = c.rootElementName, g = Promise.resolve().then(
|
|
3904
3904
|
async () => {
|
|
3905
|
-
await
|
|
3905
|
+
await ja({
|
|
3906
3906
|
databaseInstance: u,
|
|
3907
3907
|
dialecteConfig: c
|
|
3908
3908
|
});
|
|
@@ -3926,7 +3926,7 @@ function ja(l) {
|
|
|
3926
3926
|
focusedTagName: m
|
|
3927
3927
|
});
|
|
3928
3928
|
}
|
|
3929
|
-
async function
|
|
3929
|
+
async function ja(l) {
|
|
3930
3930
|
const { databaseInstance: c, dialecteConfig: u } = l, a = u.database.tables.xmlElements.name, d = u.rootElementName;
|
|
3931
3931
|
await c.open();
|
|
3932
3932
|
const m = c.table(a), g = await m.where({ tagName: d }).count();
|
|
@@ -3936,9 +3936,9 @@ async function Ka(l) {
|
|
|
3936
3936
|
`Expected exactly one root element "${d}", found ${g}`
|
|
3937
3937
|
);
|
|
3938
3938
|
const b = u.definition[d].attributes.details;
|
|
3939
|
-
let
|
|
3939
|
+
let C = [];
|
|
3940
3940
|
for (const [I, K] of Object.entries(b))
|
|
3941
|
-
K.required && K.default &&
|
|
3941
|
+
K.required && K.default && C.push({
|
|
3942
3942
|
name: I,
|
|
3943
3943
|
value: K.default.toString(),
|
|
3944
3944
|
namespace: K.namespace ?? void 0
|
|
@@ -3947,18 +3947,18 @@ async function Ka(l) {
|
|
|
3947
3947
|
id: crypto.randomUUID(),
|
|
3948
3948
|
tagName: d,
|
|
3949
3949
|
namespace: u.definition[d].namespace,
|
|
3950
|
-
attributes:
|
|
3950
|
+
attributes: C,
|
|
3951
3951
|
parent: null,
|
|
3952
3952
|
children: []
|
|
3953
3953
|
});
|
|
3954
3954
|
}
|
|
3955
|
-
function
|
|
3955
|
+
function Ka(l) {
|
|
3956
3956
|
vo();
|
|
3957
3957
|
const { dialecteConfig: c, databaseInstance: u, extensions: a, tagName: d, id: m } = l, g = c.database.tables.xmlElements.name, b = Promise.resolve().then(
|
|
3958
3958
|
async () => {
|
|
3959
|
-
const
|
|
3959
|
+
const C = c.singletonElements?.includes(d);
|
|
3960
3960
|
let I;
|
|
3961
|
-
if (
|
|
3961
|
+
if (C && !m)
|
|
3962
3962
|
I = await u.table(g).where({ tagName: d }).first();
|
|
3963
3963
|
else if (m)
|
|
3964
3964
|
I = await u.table(g).get({ id: m, tagName: d });
|
|
@@ -3981,7 +3981,7 @@ function qa(l) {
|
|
|
3981
3981
|
focusedTagName: d
|
|
3982
3982
|
});
|
|
3983
3983
|
}
|
|
3984
|
-
function
|
|
3984
|
+
function qa(l) {
|
|
3985
3985
|
const { databaseName: c, dialecteConfig: u, extensions: a } = l;
|
|
3986
3986
|
ye(c, "Database name is required to create SDK");
|
|
3987
3987
|
const d = bo({
|
|
@@ -3989,10 +3989,10 @@ function La(l) {
|
|
|
3989
3989
|
dialecteConfig: u
|
|
3990
3990
|
});
|
|
3991
3991
|
return {
|
|
3992
|
-
getState:
|
|
3992
|
+
getState: ka,
|
|
3993
3993
|
getDatabaseInstance: () => d,
|
|
3994
|
-
fromRoot: () =>
|
|
3995
|
-
fromElement: (m) =>
|
|
3994
|
+
fromRoot: () => Ma({ dialecteConfig: u, databaseInstance: d, extensions: a }),
|
|
3995
|
+
fromElement: (m) => Ka({
|
|
3996
3996
|
dialecteConfig: u,
|
|
3997
3997
|
databaseInstance: d,
|
|
3998
3998
|
extensions: a,
|
|
@@ -4000,19 +4000,19 @@ function La(l) {
|
|
|
4000
4000
|
})
|
|
4001
4001
|
};
|
|
4002
4002
|
}
|
|
4003
|
-
async function
|
|
4003
|
+
async function La(l) {
|
|
4004
4004
|
const { databaseInstance: c, elementsTableName: u, records: a } = l, d = c.table(u);
|
|
4005
4005
|
await c.transaction("rw", d, () => d.bulkAdd(a));
|
|
4006
4006
|
}
|
|
4007
|
-
async function
|
|
4007
|
+
async function As(l) {
|
|
4008
4008
|
if (await ct.exists(l))
|
|
4009
4009
|
return await ct.delete(l);
|
|
4010
4010
|
}
|
|
4011
|
-
function
|
|
4011
|
+
function Ua(l) {
|
|
4012
4012
|
return "prefix" in l && "uri" in l && !!l.prefix && !!l.uri;
|
|
4013
4013
|
}
|
|
4014
4014
|
const zt = {};
|
|
4015
|
-
function
|
|
4015
|
+
function $a(l) {
|
|
4016
4016
|
const { parentId: c, child: u } = l;
|
|
4017
4017
|
zt[c] || (zt[c] = []);
|
|
4018
4018
|
const a = {
|
|
@@ -4021,27 +4021,27 @@ function Va(l) {
|
|
|
4021
4021
|
};
|
|
4022
4022
|
zt[c].push(a);
|
|
4023
4023
|
}
|
|
4024
|
-
function
|
|
4024
|
+
function Va(l) {
|
|
4025
4025
|
const { currentBatch: c } = l, u = [...c];
|
|
4026
4026
|
for (const [a, d] of u.entries()) {
|
|
4027
4027
|
const m = zt[d.id] || [];
|
|
4028
|
-
m.length > 0 && (u[a].children.push(...m),
|
|
4028
|
+
m.length > 0 && (u[a].children.push(...m), Ga({
|
|
4029
4029
|
parentId: d.id
|
|
4030
4030
|
}));
|
|
4031
4031
|
}
|
|
4032
4032
|
return u;
|
|
4033
4033
|
}
|
|
4034
|
-
function
|
|
4034
|
+
function Ga(l) {
|
|
4035
4035
|
const { parentId: c } = l;
|
|
4036
4036
|
delete zt[c];
|
|
4037
4037
|
}
|
|
4038
4038
|
var dr = {};
|
|
4039
|
-
const
|
|
4039
|
+
const Xa = {}, Wa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4040
4040
|
__proto__: null,
|
|
4041
|
-
default:
|
|
4042
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4041
|
+
default: Xa
|
|
4042
|
+
}, Symbol.toStringTag, { value: "Module" })), Ya = /* @__PURE__ */ Ta(Wa);
|
|
4043
4043
|
var no;
|
|
4044
|
-
function
|
|
4044
|
+
function za() {
|
|
4045
4045
|
return no || (no = 1, (function(l) {
|
|
4046
4046
|
(function(c) {
|
|
4047
4047
|
c.parser = function(f, s) {
|
|
@@ -4129,7 +4129,7 @@ function Qa() {
|
|
|
4129
4129
|
}
|
|
4130
4130
|
a.prototype = {
|
|
4131
4131
|
end: function() {
|
|
4132
|
-
|
|
4132
|
+
At(this);
|
|
4133
4133
|
},
|
|
4134
4134
|
write: Ze,
|
|
4135
4135
|
resume: function() {
|
|
@@ -4144,14 +4144,14 @@ function Qa() {
|
|
|
4144
4144
|
};
|
|
4145
4145
|
var b;
|
|
4146
4146
|
try {
|
|
4147
|
-
b =
|
|
4147
|
+
b = Ya.Stream;
|
|
4148
4148
|
} catch {
|
|
4149
4149
|
b = function() {
|
|
4150
4150
|
};
|
|
4151
4151
|
}
|
|
4152
4152
|
b || (b = function() {
|
|
4153
4153
|
});
|
|
4154
|
-
var
|
|
4154
|
+
var C = c.EVENTS.filter(function(f) {
|
|
4155
4155
|
return f !== "error" && f !== "end";
|
|
4156
4156
|
});
|
|
4157
4157
|
function I(f, s) {
|
|
@@ -4166,7 +4166,7 @@ function Qa() {
|
|
|
4166
4166
|
O.emit("end");
|
|
4167
4167
|
}, this._parser.onerror = function(E) {
|
|
4168
4168
|
O.emit("error", E), O._parser.error = null;
|
|
4169
|
-
}, this._decoder = null,
|
|
4169
|
+
}, this._decoder = null, C.forEach(function(E) {
|
|
4170
4170
|
Object.defineProperty(O, "on" + E, {
|
|
4171
4171
|
get: function() {
|
|
4172
4172
|
return O._parser["on" + E];
|
|
@@ -4195,7 +4195,7 @@ function Qa() {
|
|
|
4195
4195
|
return this._parser.end(), !0;
|
|
4196
4196
|
}, K.prototype.on = function(f, s) {
|
|
4197
4197
|
var O = this;
|
|
4198
|
-
return !O._parser["on" + f] &&
|
|
4198
|
+
return !O._parser["on" + f] && C.indexOf(f) !== -1 && (O._parser["on" + f] = function() {
|
|
4199
4199
|
var E = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
|
|
4200
4200
|
E.splice(0, 0, f), O.emit.apply(O, E);
|
|
4201
4201
|
}), b.prototype.on.call(O, f, s);
|
|
@@ -4576,7 +4576,7 @@ Line: ` + f.line + `
|
|
|
4576
4576
|
Column: ` + f.column + `
|
|
4577
4577
|
Char: ` + f.c), s = new Error(s), f.error = s, ze(f, "onerror", s), f;
|
|
4578
4578
|
}
|
|
4579
|
-
function
|
|
4579
|
+
function At(f) {
|
|
4580
4580
|
return f.sawRoot && !f.closedRoot && fe(f, "Unclosed root tag"), f.state !== D.BEGIN && f.state !== D.BEGIN_WHITESPACE && f.state !== D.TEXT && Ve(f, "Unexpected end"), Se(f), f.c = "", f.closed = !0, ze(f, "onend"), a.call(f, f.strict, f.opt), f;
|
|
4581
4581
|
}
|
|
4582
4582
|
function fe(f, s) {
|
|
@@ -4640,14 +4640,14 @@ Actual: ` + f.attribValue
|
|
|
4640
4640
|
});
|
|
4641
4641
|
});
|
|
4642
4642
|
for (var J = 0, he = f.attribList.length; J < he; J++) {
|
|
4643
|
-
var xe = f.attribList[J], ve = xe[0], Je = xe[1], we = Le(ve, !0), qe = we.prefix, Dn = we.local,
|
|
4643
|
+
var xe = f.attribList[J], ve = xe[0], Je = xe[1], we = Le(ve, !0), qe = we.prefix, Dn = we.local, Ct = qe === "" ? "" : O.ns[qe] || "", Pe = {
|
|
4644
4644
|
name: ve,
|
|
4645
4645
|
value: Je,
|
|
4646
4646
|
prefix: qe,
|
|
4647
4647
|
local: Dn,
|
|
4648
|
-
uri:
|
|
4648
|
+
uri: Ct
|
|
4649
4649
|
};
|
|
4650
|
-
qe && qe !== "xmlns" && !
|
|
4650
|
+
qe && qe !== "xmlns" && !Ct && (fe(
|
|
4651
4651
|
f,
|
|
4652
4652
|
"Unbound namespace prefix: " + JSON.stringify(qe)
|
|
4653
4653
|
), Pe.uri = qe), f.tag.attributes[ve] = Pe, de(f, "onattribute", Pe);
|
|
@@ -4717,7 +4717,7 @@ Actual: ` + f.attribValue
|
|
|
4717
4717
|
"Cannot write after close. Assign an onready handler."
|
|
4718
4718
|
);
|
|
4719
4719
|
if (f === null)
|
|
4720
|
-
return
|
|
4720
|
+
return At(s);
|
|
4721
4721
|
typeof f == "object" && (f = f.toString());
|
|
4722
4722
|
for (var O = 0, E = ""; E = He(f, O++), s.c = E, !!E; )
|
|
4723
4723
|
switch (s.trackPosition && (s.position++, E === `
|
|
@@ -4937,15 +4937,15 @@ Actual: ` + f.attribValue
|
|
|
4937
4937
|
})(l);
|
|
4938
4938
|
})(dr)), dr;
|
|
4939
4939
|
}
|
|
4940
|
-
var
|
|
4941
|
-
function
|
|
4940
|
+
var Qa = za();
|
|
4941
|
+
function Ha(l) {
|
|
4942
4942
|
const { dialecteConfig: c, useCustomRecordsIds: u } = l;
|
|
4943
4943
|
let d = {
|
|
4944
4944
|
defaultNamespace: null,
|
|
4945
4945
|
stack: [],
|
|
4946
4946
|
recordsBatch: []
|
|
4947
4947
|
};
|
|
4948
|
-
const m =
|
|
4948
|
+
const m = Qa.parser(
|
|
4949
4949
|
!0,
|
|
4950
4950
|
// strict mode
|
|
4951
4951
|
{
|
|
@@ -4961,17 +4961,17 @@ function Za(l) {
|
|
|
4961
4961
|
// Enable namespace handling
|
|
4962
4962
|
}
|
|
4963
4963
|
);
|
|
4964
|
-
m.onopentag = (
|
|
4965
|
-
node:
|
|
4964
|
+
m.onopentag = (C) => d = Za({
|
|
4965
|
+
node: C,
|
|
4966
4966
|
state: d,
|
|
4967
4967
|
dialecteConfig: c,
|
|
4968
4968
|
useCustomRecordsIds: u
|
|
4969
|
-
}), m.ontext = (
|
|
4969
|
+
}), m.ontext = (C) => d = Ja({ text: C, state: d }), m.onclosetag = () => ({ updatedState: d } = ei({
|
|
4970
4970
|
state: d
|
|
4971
|
-
})), m.onerror =
|
|
4971
|
+
})), m.onerror = ti;
|
|
4972
4972
|
function g() {
|
|
4973
|
-
const
|
|
4974
|
-
return d.recordsBatch = [],
|
|
4973
|
+
const C = d.recordsBatch;
|
|
4974
|
+
return d.recordsBatch = [], C;
|
|
4975
4975
|
}
|
|
4976
4976
|
function b() {
|
|
4977
4977
|
return d.recordsBatch.length;
|
|
@@ -4982,18 +4982,18 @@ function Za(l) {
|
|
|
4982
4982
|
getSize: b
|
|
4983
4983
|
};
|
|
4984
4984
|
}
|
|
4985
|
-
function
|
|
4986
|
-
const { node: c, state: u, dialecteConfig: a, useCustomRecordsIds: d } = l, m = { ...u }, g =
|
|
4987
|
-
m.defaultNamespace || (m.defaultNamespace =
|
|
4985
|
+
function Za(l) {
|
|
4986
|
+
const { node: c, state: u, dialecteConfig: a, useCustomRecordsIds: d } = l, m = { ...u }, g = ni(c);
|
|
4987
|
+
m.defaultNamespace || (m.defaultNamespace = ri({
|
|
4988
4988
|
element: c,
|
|
4989
4989
|
defaultNamespace: a.namespaces.default,
|
|
4990
4990
|
rootElementName: a.rootElementName
|
|
4991
4991
|
}));
|
|
4992
|
-
const b =
|
|
4992
|
+
const b = oi(c, m.defaultNamespace), C = si({ attributes: c.attributes, useCustomRecordsIds: d }), I = ui({
|
|
4993
4993
|
attributes: c.attributes,
|
|
4994
4994
|
useCustomRecordsIds: d
|
|
4995
|
-
}), K =
|
|
4996
|
-
id:
|
|
4995
|
+
}), K = ai(I), $ = ii(u.stack), Y = {
|
|
4996
|
+
id: C,
|
|
4997
4997
|
tagName: g,
|
|
4998
4998
|
namespace: b,
|
|
4999
4999
|
attributes: K,
|
|
@@ -5003,11 +5003,11 @@ function Ja(l) {
|
|
|
5003
5003
|
};
|
|
5004
5004
|
return m.stack.push(Y), m;
|
|
5005
5005
|
}
|
|
5006
|
-
function
|
|
5006
|
+
function Ja(l) {
|
|
5007
5007
|
const { text: c, state: u } = l;
|
|
5008
5008
|
return c && u.stack.length > 0 && (u.stack[u.stack.length - 1].value += c), u;
|
|
5009
5009
|
}
|
|
5010
|
-
function
|
|
5010
|
+
function ei(l) {
|
|
5011
5011
|
const { state: c } = l, u = c.stack.at(-1);
|
|
5012
5012
|
let a = c.stack.slice(0, -1);
|
|
5013
5013
|
const d = [...c.recordsBatch];
|
|
@@ -5023,7 +5023,7 @@ function ti(l) {
|
|
|
5023
5023
|
]
|
|
5024
5024
|
} : g
|
|
5025
5025
|
);
|
|
5026
|
-
} else u.parent &&
|
|
5026
|
+
} else u.parent && $a({
|
|
5027
5027
|
parentId: u.parent.id,
|
|
5028
5028
|
child: { id: u.id, tagName: u.tagName }
|
|
5029
5029
|
});
|
|
@@ -5037,13 +5037,13 @@ function ti(l) {
|
|
|
5037
5037
|
}
|
|
5038
5038
|
};
|
|
5039
5039
|
}
|
|
5040
|
-
function
|
|
5040
|
+
function ti(l) {
|
|
5041
5041
|
return new Error(`XML parsing error: ${l}`);
|
|
5042
5042
|
}
|
|
5043
|
-
function
|
|
5043
|
+
function ni(l) {
|
|
5044
5044
|
return l.local;
|
|
5045
5045
|
}
|
|
5046
|
-
function
|
|
5046
|
+
function ri(l) {
|
|
5047
5047
|
const { element: c, defaultNamespace: u, rootElementName: a } = l;
|
|
5048
5048
|
return ye(
|
|
5049
5049
|
c.name === a,
|
|
@@ -5053,13 +5053,13 @@ function oi(l) {
|
|
|
5053
5053
|
uri: c.attributes.xmlns.value
|
|
5054
5054
|
} : u;
|
|
5055
5055
|
}
|
|
5056
|
-
function
|
|
5057
|
-
return
|
|
5056
|
+
function oi(l, c) {
|
|
5057
|
+
return Ua(l) ? {
|
|
5058
5058
|
prefix: l.prefix,
|
|
5059
5059
|
uri: l.uri
|
|
5060
5060
|
} : c;
|
|
5061
5061
|
}
|
|
5062
|
-
function
|
|
5062
|
+
function ai(l) {
|
|
5063
5063
|
return l.map((c) => {
|
|
5064
5064
|
const u = c.prefix && c.uri ? {
|
|
5065
5065
|
prefix: c.prefix,
|
|
@@ -5072,16 +5072,16 @@ function ii(l) {
|
|
|
5072
5072
|
};
|
|
5073
5073
|
});
|
|
5074
5074
|
}
|
|
5075
|
-
function
|
|
5075
|
+
function ii(l) {
|
|
5076
5076
|
if (l.length === 0) return null;
|
|
5077
5077
|
const c = l[l.length - 1];
|
|
5078
5078
|
return c ? { id: c.id, tagName: c.tagName } : null;
|
|
5079
5079
|
}
|
|
5080
|
-
function
|
|
5080
|
+
function si(l) {
|
|
5081
5081
|
const { attributes: c, useCustomRecordsIds: u } = l, a = c[mo];
|
|
5082
5082
|
return u && a && a.value ? a.value : crypto.randomUUID();
|
|
5083
5083
|
}
|
|
5084
|
-
function
|
|
5084
|
+
function ui(l) {
|
|
5085
5085
|
const { attributes: c, useCustomRecordsIds: u } = l;
|
|
5086
5086
|
return u ? Object.values(c).filter((a) => a.name !== mo) : Object.values(c);
|
|
5087
5087
|
}
|
|
@@ -5091,21 +5091,21 @@ const ro = {
|
|
|
5091
5091
|
// 32KB
|
|
5092
5092
|
batchSize: 2e3
|
|
5093
5093
|
};
|
|
5094
|
-
async function
|
|
5094
|
+
async function ci(l) {
|
|
5095
5095
|
const { files: c, dialecteConfig: u, useCustomRecordsIds: a = !1 } = l, d = [];
|
|
5096
5096
|
if (c.length === 0) throw new Error("No files provided for import.");
|
|
5097
5097
|
const { importOptions: m = ro, supportedFileExtensions: g } = u.io, b = {
|
|
5098
5098
|
...ro,
|
|
5099
5099
|
...m
|
|
5100
5100
|
};
|
|
5101
|
-
for (const
|
|
5102
|
-
if (!
|
|
5103
|
-
console.error(`Unsupported file type: ${
|
|
5101
|
+
for (const C of c) {
|
|
5102
|
+
if (!li({ file: C, supportedExtensions: g })) {
|
|
5103
|
+
console.error(`Unsupported file type: ${C.name}`);
|
|
5104
5104
|
continue;
|
|
5105
5105
|
}
|
|
5106
|
-
|
|
5107
|
-
const I = await
|
|
5108
|
-
file:
|
|
5106
|
+
C.size === 0 && console.warn(`File is empty: ${C.name}`);
|
|
5107
|
+
const I = await di({
|
|
5108
|
+
file: C,
|
|
5109
5109
|
dialecteConfig: u,
|
|
5110
5110
|
options: b,
|
|
5111
5111
|
useCustomRecordsIds: a
|
|
@@ -5114,18 +5114,18 @@ async function li(l) {
|
|
|
5114
5114
|
}
|
|
5115
5115
|
return d;
|
|
5116
5116
|
}
|
|
5117
|
-
function
|
|
5117
|
+
function li(l) {
|
|
5118
5118
|
const { file: c, supportedExtensions: u } = l;
|
|
5119
5119
|
return u.some((a) => c.name.toLowerCase().endsWith(a));
|
|
5120
5120
|
}
|
|
5121
|
-
function
|
|
5121
|
+
function fi(l) {
|
|
5122
5122
|
return l.name.replace(/\.[^.]+$/, "");
|
|
5123
5123
|
}
|
|
5124
|
-
async function
|
|
5125
|
-
const { file: c, dialecteConfig: u, options: a, useCustomRecordsIds: d } = l, m =
|
|
5124
|
+
async function di(l) {
|
|
5125
|
+
const { file: c, dialecteConfig: u, options: a, useCustomRecordsIds: d } = l, m = fi(c), g = await bo({ databaseName: m, dialecteConfig: u });
|
|
5126
5126
|
try {
|
|
5127
5127
|
const b = u.database.tables.xmlElements.name;
|
|
5128
|
-
return await g.table(b).clear(), a.useBrowserApi && c.size !== 0 && await
|
|
5128
|
+
return await g.table(b).clear(), a.useBrowserApi && c.size !== 0 && await hi({
|
|
5129
5129
|
file: c,
|
|
5130
5130
|
databaseInstance: g,
|
|
5131
5131
|
elementsTableName: b,
|
|
@@ -5142,23 +5142,23 @@ async function hi(l) {
|
|
|
5142
5142
|
g.close();
|
|
5143
5143
|
}
|
|
5144
5144
|
}
|
|
5145
|
-
async function
|
|
5146
|
-
const { file: c, databaseInstance: u, elementsTableName: a, dialecteConfig: d, options: m } = l, g = c.stream().getReader(), b =
|
|
5145
|
+
async function hi(l) {
|
|
5146
|
+
const { file: c, databaseInstance: u, elementsTableName: a, dialecteConfig: d, options: m } = l, g = c.stream().getReader(), b = Ha({
|
|
5147
5147
|
dialecteConfig: d,
|
|
5148
5148
|
useCustomRecordsIds: m.useCustomRecordsIds
|
|
5149
|
-
}),
|
|
5149
|
+
}), C = new TextDecoder(), I = new Uint8Array(0);
|
|
5150
5150
|
return await mr({
|
|
5151
5151
|
databaseInstance: u,
|
|
5152
5152
|
elementsTableName: a,
|
|
5153
5153
|
reader: g,
|
|
5154
5154
|
sax: b,
|
|
5155
|
-
textDecoder:
|
|
5155
|
+
textDecoder: C,
|
|
5156
5156
|
buffer: I,
|
|
5157
5157
|
options: m
|
|
5158
5158
|
});
|
|
5159
5159
|
}
|
|
5160
5160
|
async function mr(l) {
|
|
5161
|
-
const { databaseInstance: c, elementsTableName: u, reader: a, sax: d, textDecoder: m, buffer: g, options: b } = l, { chunkSize:
|
|
5161
|
+
const { databaseInstance: c, elementsTableName: u, reader: a, sax: d, textDecoder: m, buffer: g, options: b } = l, { chunkSize: C, batchSize: I } = b, { done: K, value: $ } = await a.read();
|
|
5162
5162
|
if (K) {
|
|
5163
5163
|
if (g.length > 0) {
|
|
5164
5164
|
const H = m.decode(g);
|
|
@@ -5174,9 +5174,9 @@ async function mr(l) {
|
|
|
5174
5174
|
if (!$)
|
|
5175
5175
|
return await mr(l);
|
|
5176
5176
|
let Y = new Uint8Array(g.length + $.length);
|
|
5177
|
-
for (Y.set(g), Y.set($, g.length); Y.length >=
|
|
5178
|
-
const H = Y.slice(0,
|
|
5179
|
-
Y = Y.slice(
|
|
5177
|
+
for (Y.set(g), Y.set($, g.length); Y.length >= C; ) {
|
|
5178
|
+
const H = Y.slice(0, C);
|
|
5179
|
+
Y = Y.slice(C);
|
|
5180
5180
|
const M = m.decode(H, { stream: !0 });
|
|
5181
5181
|
d.parser.write(M), await oo({
|
|
5182
5182
|
databaseInstance: c,
|
|
@@ -5190,10 +5190,10 @@ async function mr(l) {
|
|
|
5190
5190
|
async function oo(l) {
|
|
5191
5191
|
const { databaseInstance: c, elementsTableName: u, sax: a, batchSize: d } = l;
|
|
5192
5192
|
if (a.getSize() >= d) {
|
|
5193
|
-
const g = a.drainBatch(), b =
|
|
5193
|
+
const g = a.drainBatch(), b = Va({
|
|
5194
5194
|
currentBatch: g
|
|
5195
5195
|
});
|
|
5196
|
-
await
|
|
5196
|
+
await La({
|
|
5197
5197
|
databaseInstance: c,
|
|
5198
5198
|
elementsTableName: u,
|
|
5199
5199
|
records: b
|
|
@@ -5202,7 +5202,7 @@ async function oo(l) {
|
|
|
5202
5202
|
}
|
|
5203
5203
|
const _o = "_temp-idb-id";
|
|
5204
5204
|
var Yt = { exports: {} }, En = { exports: {} }, ao;
|
|
5205
|
-
function
|
|
5205
|
+
function mi() {
|
|
5206
5206
|
return ao || (ao = 1, (function(l, c) {
|
|
5207
5207
|
Object.defineProperty(c, "__esModule", { value: !0 }), c.ParsingError = void 0;
|
|
5208
5208
|
class u extends Error {
|
|
@@ -5213,10 +5213,10 @@ function pi() {
|
|
|
5213
5213
|
c.ParsingError = u;
|
|
5214
5214
|
let a;
|
|
5215
5215
|
function d() {
|
|
5216
|
-
return
|
|
5216
|
+
return C(!1) || Y() || $() || K() || b();
|
|
5217
5217
|
}
|
|
5218
5218
|
function m() {
|
|
5219
|
-
return F(/\s*/),
|
|
5219
|
+
return F(/\s*/), C(!0) || $() || I() || b();
|
|
5220
5220
|
}
|
|
5221
5221
|
function g() {
|
|
5222
5222
|
const te = b(), z = [];
|
|
@@ -5257,7 +5257,7 @@ function pi() {
|
|
|
5257
5257
|
node: z
|
|
5258
5258
|
};
|
|
5259
5259
|
}
|
|
5260
|
-
function
|
|
5260
|
+
function C(te) {
|
|
5261
5261
|
const z = F(/^<([^?!</>\s]+)\s*/);
|
|
5262
5262
|
if (!z)
|
|
5263
5263
|
return;
|
|
@@ -5384,13 +5384,13 @@ function pi() {
|
|
|
5384
5384
|
})(En, En.exports)), En.exports;
|
|
5385
5385
|
}
|
|
5386
5386
|
var io = Yt.exports, so;
|
|
5387
|
-
function
|
|
5387
|
+
function pi() {
|
|
5388
5388
|
return so || (so = 1, (function(l, c) {
|
|
5389
5389
|
var u = io && io.__importDefault || function(M) {
|
|
5390
5390
|
return M && M.__esModule ? M : { default: M };
|
|
5391
5391
|
};
|
|
5392
5392
|
Object.defineProperty(c, "__esModule", { value: !0 });
|
|
5393
|
-
const a = u(/* @__PURE__ */
|
|
5393
|
+
const a = u(/* @__PURE__ */ mi());
|
|
5394
5394
|
function d(M) {
|
|
5395
5395
|
if (!M.options.indentation && !M.options.lineSeparator)
|
|
5396
5396
|
return;
|
|
@@ -5414,11 +5414,11 @@ function gi() {
|
|
|
5414
5414
|
else if (M.type === "ProcessingInstruction")
|
|
5415
5415
|
Y(M, F);
|
|
5416
5416
|
else if (typeof M.content == "string")
|
|
5417
|
-
|
|
5417
|
+
C(M.content, F, Z);
|
|
5418
5418
|
else
|
|
5419
5419
|
throw new Error("Unknown node type: " + M.type);
|
|
5420
5420
|
}
|
|
5421
|
-
function
|
|
5421
|
+
function C(M, F, Z) {
|
|
5422
5422
|
if (!Z) {
|
|
5423
5423
|
const re = M.trim();
|
|
5424
5424
|
(F.options.lineSeparator || re.length === 0) && (M = re);
|
|
@@ -5479,14 +5479,14 @@ function gi() {
|
|
|
5479
5479
|
H.minify = (M, F = {}) => H(M, Object.assign(Object.assign({}, F), { indentation: "", lineSeparator: "" })), l.exports = H, c.default = H;
|
|
5480
5480
|
})(Yt, Yt.exports)), Yt.exports;
|
|
5481
5481
|
}
|
|
5482
|
-
var
|
|
5483
|
-
const
|
|
5484
|
-
function
|
|
5485
|
-
return
|
|
5482
|
+
var gi = /* @__PURE__ */ pi();
|
|
5483
|
+
const yi = /* @__PURE__ */ yo(gi);
|
|
5484
|
+
function bi(l) {
|
|
5485
|
+
return yi(l);
|
|
5486
5486
|
}
|
|
5487
|
-
async function
|
|
5487
|
+
async function vi(l) {
|
|
5488
5488
|
const { extension: c, xmlDocument: u, filename: a } = l, b = `<?xml version="1.0" encoding="UTF-8"?>
|
|
5489
|
-
` + new XMLSerializer().serializeToString(u),
|
|
5489
|
+
` + new XMLSerializer().serializeToString(u), C = bi(b), I = new Blob([C], { type: "application/xml" });
|
|
5490
5490
|
if ("showSaveFilePicker" in window)
|
|
5491
5491
|
try {
|
|
5492
5492
|
const $ = await (await window.showSaveFilePicker({
|
|
@@ -5507,32 +5507,30 @@ async function _i(l) {
|
|
|
5507
5507
|
$.href = K, $.download = a, document.body.appendChild($), $.click(), $.remove(), URL.revokeObjectURL(K);
|
|
5508
5508
|
}
|
|
5509
5509
|
}
|
|
5510
|
-
async function
|
|
5511
|
-
const {
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
}
|
|
5523
|
-
async function ws(l) {
|
|
5524
|
-
const { databaseName: c, dialecteConfig: u } = l;
|
|
5525
|
-
return Co({
|
|
5526
|
-
databaseName: c,
|
|
5527
|
-
dialecteConfig: u,
|
|
5528
|
-
withDatabaseIds: !0
|
|
5510
|
+
async function Cs(l) {
|
|
5511
|
+
const {
|
|
5512
|
+
dialecteConfig: c,
|
|
5513
|
+
databaseName: u,
|
|
5514
|
+
extension: a,
|
|
5515
|
+
withDownload: d = !1,
|
|
5516
|
+
withDatabaseIds: m = !1
|
|
5517
|
+
} = l, g = await _i({
|
|
5518
|
+
databaseName: u,
|
|
5519
|
+
extension: a,
|
|
5520
|
+
dialecteConfig: c,
|
|
5521
|
+
withDatabaseIds: m
|
|
5529
5522
|
});
|
|
5523
|
+
return d && await vi({
|
|
5524
|
+
extension: a,
|
|
5525
|
+
xmlDocument: g.xmlDocument,
|
|
5526
|
+
filename: g.filename
|
|
5527
|
+
}), g;
|
|
5530
5528
|
}
|
|
5531
|
-
async function
|
|
5529
|
+
async function _i(l) {
|
|
5532
5530
|
const { databaseName: c, extension: u = "xml", dialecteConfig: a, withDatabaseIds: d } = l, m = new ct(c);
|
|
5533
5531
|
await m.open();
|
|
5534
5532
|
try {
|
|
5535
|
-
const g = await
|
|
5533
|
+
const g = await Ai({
|
|
5536
5534
|
databaseInstance: m,
|
|
5537
5535
|
dialecteConfig: a,
|
|
5538
5536
|
withDatabaseIds: d
|
|
@@ -5547,31 +5545,31 @@ async function Co(l) {
|
|
|
5547
5545
|
m.close();
|
|
5548
5546
|
}
|
|
5549
5547
|
}
|
|
5550
|
-
async function
|
|
5548
|
+
async function Ai(l) {
|
|
5551
5549
|
const { databaseInstance: c, dialecteConfig: u, withDatabaseIds: a } = l, { useBrowserApi: d = !0 } = u.io.exportOptions ?? { useBrowserApi: !0 }, m = u.rootElementName, g = u.namespaces.default, b = u.database.tables.xmlElements.name;
|
|
5552
5550
|
if (d) {
|
|
5553
|
-
const
|
|
5551
|
+
const C = document.implementation.createDocument(
|
|
5554
5552
|
g.uri,
|
|
5555
5553
|
null,
|
|
5556
5554
|
null
|
|
5557
5555
|
), I = await c.table(b).where({ tagName: m }).first();
|
|
5558
5556
|
if (!I) throw new Error(`No ${m} root element found in DB`);
|
|
5559
|
-
const K =
|
|
5557
|
+
const K = C.createElementNS(
|
|
5560
5558
|
I.namespace.uri,
|
|
5561
5559
|
I.tagName
|
|
5562
5560
|
);
|
|
5563
|
-
return K.setAttribute("xmlns", I.namespace.uri), I.attributes &&
|
|
5561
|
+
return K.setAttribute("xmlns", I.namespace.uri), I.attributes && Co({
|
|
5564
5562
|
dialecteConfig: u,
|
|
5565
|
-
document:
|
|
5563
|
+
document: C,
|
|
5566
5564
|
element: K,
|
|
5567
5565
|
attributes: I.attributes,
|
|
5568
5566
|
isRoot: !0
|
|
5569
|
-
}),
|
|
5567
|
+
}), Bo({ dialecteConfig: u, rootElement: K, namespace: I.namespace }), I.value && (K.textContent = I.value.trim()), a && K.setAttribute(_o, I.id), C.appendChild(K), await Ao({
|
|
5570
5568
|
databaseInstance: c,
|
|
5571
5569
|
dialecteConfig: u,
|
|
5572
5570
|
elementsTableName: b,
|
|
5573
5571
|
withDatabaseIds: a,
|
|
5574
|
-
xmlDocument:
|
|
5572
|
+
xmlDocument: C,
|
|
5575
5573
|
databaseRecord: I,
|
|
5576
5574
|
parentDomElement: K
|
|
5577
5575
|
});
|
|
@@ -5588,7 +5586,7 @@ async function Ao(l) {
|
|
|
5588
5586
|
parentDomElement: b
|
|
5589
5587
|
} = l;
|
|
5590
5588
|
if (!g.children) return;
|
|
5591
|
-
const
|
|
5589
|
+
const C = g.children.map((Y) => Y.id), K = await c.table(a).bulkGet(C);
|
|
5592
5590
|
Bi({
|
|
5593
5591
|
childrenRecords: K,
|
|
5594
5592
|
parentRecord: g
|
|
@@ -5599,7 +5597,7 @@ async function Ao(l) {
|
|
|
5599
5597
|
childrenRecords: K
|
|
5600
5598
|
});
|
|
5601
5599
|
for (const Y of $) {
|
|
5602
|
-
const H =
|
|
5600
|
+
const H = Ci({
|
|
5603
5601
|
dialecteConfig: u,
|
|
5604
5602
|
document: m,
|
|
5605
5603
|
record: Y,
|
|
@@ -5618,17 +5616,17 @@ async function Ao(l) {
|
|
|
5618
5616
|
}
|
|
5619
5617
|
return l.xmlDocument;
|
|
5620
5618
|
}
|
|
5621
|
-
function
|
|
5619
|
+
function Ci(l) {
|
|
5622
5620
|
const { dialecteConfig: c, document: u, record: a, defaultNamespace: d, withDatabaseIds: m } = l;
|
|
5623
5621
|
let g;
|
|
5624
|
-
return !(a.namespace.uri === d.uri) && a.namespace.prefix && a.namespace.prefix !== "xmlns" ? (
|
|
5622
|
+
return !(a.namespace.uri === d.uri) && a.namespace.prefix && a.namespace.prefix !== "xmlns" ? (wo({
|
|
5625
5623
|
dialecteConfig: c,
|
|
5626
5624
|
document: u,
|
|
5627
5625
|
namespace: a.namespace
|
|
5628
5626
|
}), g = u.createElementNS(
|
|
5629
5627
|
a.namespace.uri,
|
|
5630
5628
|
`${a.namespace.prefix}:${a.tagName}`
|
|
5631
|
-
)) : g = u.createElementNS(a.namespace.uri, a.tagName), a.attributes &&
|
|
5629
|
+
)) : g = u.createElementNS(a.namespace.uri, a.tagName), a.attributes && Co({
|
|
5632
5630
|
dialecteConfig: c,
|
|
5633
5631
|
document: u,
|
|
5634
5632
|
element: g,
|
|
@@ -5636,39 +5634,39 @@ function Ai(l) {
|
|
|
5636
5634
|
isRoot: !1
|
|
5637
5635
|
}), a.value && (g.textContent = a.value.trim()), m && g.setAttribute(_o, a.id), g;
|
|
5638
5636
|
}
|
|
5639
|
-
function
|
|
5637
|
+
function Co(l) {
|
|
5640
5638
|
const { dialecteConfig: c, document: u, element: a, attributes: d, isRoot: m } = l;
|
|
5641
5639
|
for (const g of d)
|
|
5642
5640
|
if (!Ei(g))
|
|
5643
|
-
if (
|
|
5641
|
+
if (Eo(g)) {
|
|
5644
5642
|
const b = g.namespace?.prefix || "";
|
|
5645
|
-
!m && b &&
|
|
5643
|
+
!m && b && wo({
|
|
5646
5644
|
dialecteConfig: c,
|
|
5647
5645
|
document: u,
|
|
5648
5646
|
namespace: g.namespace
|
|
5649
5647
|
});
|
|
5650
|
-
const
|
|
5648
|
+
const C = g.name.includes(":") && g.name.split(":").pop() || g.name, I = b ? `${b}:${C}` : C;
|
|
5651
5649
|
a.setAttributeNS(g.namespace.uri, I, String(g.value));
|
|
5652
5650
|
} else a.setAttribute(g.name, String(g.value));
|
|
5653
5651
|
}
|
|
5654
|
-
function
|
|
5652
|
+
function wo(l) {
|
|
5655
5653
|
const { dialecteConfig: c, document: u, namespace: a } = l, d = u.documentElement;
|
|
5656
5654
|
if (!d || !a.prefix || a.prefix === "xmlns") return;
|
|
5657
5655
|
const m = "http://www.w3.org/2000/xmlns/";
|
|
5658
|
-
d.getAttributeNS(m, a.prefix) === null && (d.setAttributeNS(m, `xmlns:${a.prefix}`, a.uri),
|
|
5656
|
+
d.getAttributeNS(m, a.prefix) === null && (d.setAttributeNS(m, `xmlns:${a.prefix}`, a.uri), Bo({ dialecteConfig: c, rootElement: d, namespace: a }));
|
|
5659
5657
|
}
|
|
5660
|
-
function
|
|
5658
|
+
function Bo(l) {
|
|
5661
5659
|
const { dialecteConfig: c, rootElement: u, namespace: a } = l, d = Object.entries(
|
|
5662
5660
|
c.definition[c.rootElementName].attributes.details
|
|
5663
5661
|
).filter(([g, b]) => a.uri === c.namespaces.default.uri ? b.namespace === null : b.namespace?.prefix === a.prefix && b.namespace?.uri === a.uri);
|
|
5664
5662
|
if (d.length > 0)
|
|
5665
5663
|
for (const [g, b] of d) {
|
|
5666
|
-
const
|
|
5667
|
-
if (!(b.namespace === null ? u.hasAttribute(
|
|
5664
|
+
const C = g.includes(":") && g.split(":").pop() || g;
|
|
5665
|
+
if (!(b.namespace === null ? u.hasAttribute(C) : u.hasAttributeNS(b.namespace.uri, C)))
|
|
5668
5666
|
if (b.namespace === null)
|
|
5669
|
-
u.setAttribute(
|
|
5667
|
+
u.setAttribute(C, b.default || "");
|
|
5670
5668
|
else {
|
|
5671
|
-
const K = `${b.namespace.prefix}:${
|
|
5669
|
+
const K = `${b.namespace.prefix}:${C}`;
|
|
5672
5670
|
u.setAttributeNS(b.namespace.uri, K, b.default || "");
|
|
5673
5671
|
}
|
|
5674
5672
|
}
|
|
@@ -5677,12 +5675,12 @@ function wi(l) {
|
|
|
5677
5675
|
const { parentTagName: c, availableChildren: u, childrenRecords: a } = l, d = [], m = new Set(u[c]);
|
|
5678
5676
|
if (!m.size) return a;
|
|
5679
5677
|
const g = /* @__PURE__ */ new Map(), b = [];
|
|
5680
|
-
for (const
|
|
5681
|
-
g.set(
|
|
5682
|
-
for (const
|
|
5683
|
-
m.has(
|
|
5684
|
-
for (const
|
|
5685
|
-
const I = g.get(
|
|
5678
|
+
for (const C of m)
|
|
5679
|
+
g.set(C, []);
|
|
5680
|
+
for (const C of a)
|
|
5681
|
+
m.has(C.tagName) ? g.get(C.tagName)?.push(C) : b.push(C);
|
|
5682
|
+
for (const C of m) {
|
|
5683
|
+
const I = g.get(C);
|
|
5686
5684
|
I && I.length && d.push(...I);
|
|
5687
5685
|
}
|
|
5688
5686
|
return d.push(...b), d;
|
|
@@ -5699,27 +5697,27 @@ function Bi(l) {
|
|
|
5699
5697
|
);
|
|
5700
5698
|
}
|
|
5701
5699
|
}
|
|
5702
|
-
function
|
|
5700
|
+
function Eo(l) {
|
|
5703
5701
|
return l !== null && typeof l == "object" && "namespace" in l && !!l.namespace;
|
|
5704
5702
|
}
|
|
5705
5703
|
function Ei(l) {
|
|
5706
|
-
return !!(l.name === "xmlns" || l.name.startsWith("xmlns:") ||
|
|
5704
|
+
return !!(l.name === "xmlns" || l.name.startsWith("xmlns:") || Eo(l) && l.namespace?.prefix === "xmlns");
|
|
5707
5705
|
}
|
|
5708
|
-
async function
|
|
5709
|
-
const { xmlString: c, dialecteConfig: u = go, extensions: a = {} } = l, d = `test-${crypto.randomUUID()}.xml`, m = new File([c], d, { type: "text/xml" }), b = (await
|
|
5706
|
+
async function ws(l) {
|
|
5707
|
+
const { xmlString: c, dialecteConfig: u = go, extensions: a = {} } = l, d = `test-${crypto.randomUUID()}.xml`, m = new File([c], d, { type: "text/xml" }), b = (await ci({
|
|
5710
5708
|
files: [m],
|
|
5711
5709
|
dialecteConfig: u,
|
|
5712
5710
|
useCustomRecordsIds: !0
|
|
5713
|
-
}))[0],
|
|
5711
|
+
}))[0], C = await qa({
|
|
5714
5712
|
databaseName: b,
|
|
5715
5713
|
dialecteConfig: u,
|
|
5716
5714
|
extensions: a
|
|
5717
|
-
}), I =
|
|
5718
|
-
return { dialecte:
|
|
5715
|
+
}), I = C.getDatabaseInstance();
|
|
5716
|
+
return { dialecte: C, databaseName: b, cleanup: async () => {
|
|
5719
5717
|
I?.isOpen() && (I.close(), await new Promise(($) => setTimeout($, 20))), await ct.delete(b);
|
|
5720
5718
|
} };
|
|
5721
5719
|
}
|
|
5722
|
-
async function
|
|
5720
|
+
async function Bs(l) {
|
|
5723
5721
|
const { chain: c, operations: u } = l;
|
|
5724
5722
|
let a = c;
|
|
5725
5723
|
for (const m of u)
|
|
@@ -5739,17 +5737,17 @@ async function Es(l) {
|
|
|
5739
5737
|
break;
|
|
5740
5738
|
case "addChild":
|
|
5741
5739
|
m.goTo && (a = a.goToElement(m.goTo));
|
|
5742
|
-
const { id: b, tagName:
|
|
5740
|
+
const { id: b, tagName: C, attributes: I, namespace: K, value: $, setFocus: Y } = m;
|
|
5743
5741
|
Y ? a = a.addChild({
|
|
5744
5742
|
id: b,
|
|
5745
|
-
tagName:
|
|
5743
|
+
tagName: C,
|
|
5746
5744
|
attributes: I,
|
|
5747
5745
|
namespace: K,
|
|
5748
5746
|
value: $,
|
|
5749
5747
|
setFocus: !0
|
|
5750
5748
|
}) : a = a.addChild({
|
|
5751
5749
|
id: b,
|
|
5752
|
-
tagName:
|
|
5750
|
+
tagName: C,
|
|
5753
5751
|
attributes: I,
|
|
5754
5752
|
namespace: K,
|
|
5755
5753
|
value: $,
|
|
@@ -5780,37 +5778,37 @@ function xi(l) {
|
|
|
5780
5778
|
const { contextPromise: c, dialecteConfig: u, databaseInstance: a } = l;
|
|
5781
5779
|
return async function(d) {
|
|
5782
5780
|
const m = await c, g = {};
|
|
5783
|
-
for (const [b,
|
|
5781
|
+
for (const [b, C] of Object.entries(d)) {
|
|
5784
5782
|
const K = (await ho({
|
|
5785
5783
|
context: m,
|
|
5786
5784
|
dialecteConfig: u,
|
|
5787
5785
|
databaseInstance: a,
|
|
5788
5786
|
tagName: b,
|
|
5789
|
-
attributes:
|
|
5787
|
+
attributes: C
|
|
5790
5788
|
})).filter(($) => $.parent?.tagName === m.currentFocus.tagName && $.parent?.id === m.currentFocus.id);
|
|
5791
5789
|
g[b] || (g[b] = []), g[b].push(...K);
|
|
5792
5790
|
}
|
|
5793
5791
|
return g;
|
|
5794
5792
|
};
|
|
5795
5793
|
}
|
|
5796
|
-
function
|
|
5794
|
+
function To(l) {
|
|
5797
5795
|
const { contextPromise: c, dialecteConfig: u, databaseInstance: a } = l;
|
|
5798
5796
|
return async function(d = {}) {
|
|
5799
|
-
const { include: m, exclude: g, unwrap: b } = d,
|
|
5800
|
-
root:
|
|
5801
|
-
context:
|
|
5797
|
+
const { include: m, exclude: g, unwrap: b } = d, C = await c, I = await Ni({
|
|
5798
|
+
root: C.currentFocus,
|
|
5799
|
+
context: C,
|
|
5802
5800
|
dialecteConfig: u,
|
|
5803
5801
|
databaseInstance: a,
|
|
5804
5802
|
include: m,
|
|
5805
5803
|
exclude: g
|
|
5806
5804
|
});
|
|
5807
|
-
return I ? b ? Fi({ tree: I, unwrapTagNames: b }) : I : Nn({ record:
|
|
5805
|
+
return I ? b ? Fi({ tree: I, unwrapTagNames: b }) : I : Nn({ record: C.currentFocus });
|
|
5808
5806
|
};
|
|
5809
5807
|
}
|
|
5810
5808
|
async function Ni(l) {
|
|
5811
5809
|
const { root: c, context: u, dialecteConfig: a, databaseInstance: d, include: m, exclude: g } = l;
|
|
5812
|
-
async function b(
|
|
5813
|
-
const { record: I, includeFilter: K } =
|
|
5810
|
+
async function b(C) {
|
|
5811
|
+
const { record: I, includeFilter: K } = C;
|
|
5814
5812
|
if (Ri({ record: I, excludeFilters: g }))
|
|
5815
5813
|
return Nn({ record: I });
|
|
5816
5814
|
const $ = await Di({
|
|
@@ -5847,7 +5845,7 @@ async function Di(l) {
|
|
|
5847
5845
|
databaseInstance: d,
|
|
5848
5846
|
currentIncludeFilter: m,
|
|
5849
5847
|
excludeFilters: g
|
|
5850
|
-
} = l,
|
|
5848
|
+
} = l, C = (await Ii({
|
|
5851
5849
|
record: c,
|
|
5852
5850
|
context: u,
|
|
5853
5851
|
dialecteConfig: a,
|
|
@@ -5855,7 +5853,7 @@ async function Di(l) {
|
|
|
5855
5853
|
})).filter(
|
|
5856
5854
|
(I) => !Oi({ record: I, excludeFilters: g })
|
|
5857
5855
|
);
|
|
5858
|
-
return Pi({ children:
|
|
5856
|
+
return Pi({ children: C, currentIncludeFilter: m });
|
|
5859
5857
|
}
|
|
5860
5858
|
async function Ii(l) {
|
|
5861
5859
|
const { record: c, context: u, dialecteConfig: a, databaseInstance: d } = l;
|
|
@@ -5929,9 +5927,9 @@ function br(l) {
|
|
|
5929
5927
|
...br(l.descendant)
|
|
5930
5928
|
), c;
|
|
5931
5929
|
}
|
|
5932
|
-
function
|
|
5930
|
+
function xo(l) {
|
|
5933
5931
|
const c = [l.tagName];
|
|
5934
|
-
return l.descendant && c.push(...
|
|
5932
|
+
return l.descendant && c.push(...xo(l.descendant)), c;
|
|
5935
5933
|
}
|
|
5936
5934
|
function ki(l) {
|
|
5937
5935
|
const c = [];
|
|
@@ -5963,7 +5961,7 @@ async function Ki(l) {
|
|
|
5963
5961
|
for (; b && b.id !== u.id; ) {
|
|
5964
5962
|
if (g.push(b), !b.parent)
|
|
5965
5963
|
return [];
|
|
5966
|
-
const
|
|
5964
|
+
const C = await Qt({
|
|
5967
5965
|
id: b.parent.id,
|
|
5968
5966
|
tagName: b.parent.tagName,
|
|
5969
5967
|
stagedOperations: m,
|
|
@@ -5971,13 +5969,13 @@ async function Ki(l) {
|
|
|
5971
5969
|
databaseInstance: d,
|
|
5972
5970
|
type: "chain"
|
|
5973
5971
|
});
|
|
5974
|
-
if (!
|
|
5972
|
+
if (!C)
|
|
5975
5973
|
return [];
|
|
5976
|
-
b =
|
|
5974
|
+
b = C;
|
|
5977
5975
|
}
|
|
5978
5976
|
return !b || b.id !== u.id ? [] : (g.push(b), g);
|
|
5979
5977
|
}
|
|
5980
|
-
function
|
|
5978
|
+
function No(l) {
|
|
5981
5979
|
const { contextPromise: c, dialecteConfig: u, databaseInstance: a } = l;
|
|
5982
5980
|
async function d(m) {
|
|
5983
5981
|
const g = await c;
|
|
@@ -5996,22 +5994,22 @@ function Ro(l) {
|
|
|
5996
5994
|
return d;
|
|
5997
5995
|
}
|
|
5998
5996
|
async function qi(l) {
|
|
5999
|
-
const { contextPromise: c, dialecteConfig: u, databaseInstance: a, currentElement: d } = l, g = await
|
|
6000
|
-
for (const K of
|
|
5997
|
+
const { contextPromise: c, dialecteConfig: u, databaseInstance: a, currentElement: d } = l, g = await To({ contextPromise: c, dialecteConfig: u, databaseInstance: a })(), b = ki(g), C = [d, ...u.descendants[d]], I = {};
|
|
5998
|
+
for (const K of C)
|
|
6001
5999
|
I[K] = [];
|
|
6002
6000
|
for (const K of b)
|
|
6003
6001
|
I[K.tagName] && I[K.tagName].push(K);
|
|
6004
6002
|
return I;
|
|
6005
6003
|
}
|
|
6006
6004
|
async function Li(l) {
|
|
6007
|
-
const { context: c, dialecteConfig: u, databaseInstance: a, filter: d } = l, m = br(d), g = new Set(
|
|
6005
|
+
const { context: c, dialecteConfig: u, databaseInstance: a, filter: d } = l, m = br(d), g = new Set(xo(d)), b = m[m.length - 1], C = await ho({
|
|
6008
6006
|
context: c,
|
|
6009
6007
|
dialecteConfig: u,
|
|
6010
6008
|
databaseInstance: a,
|
|
6011
6009
|
tagName: b.tagName,
|
|
6012
6010
|
attributes: b.attributes
|
|
6013
6011
|
}), I = /* @__PURE__ */ new Map();
|
|
6014
|
-
for (const K of
|
|
6012
|
+
for (const K of C) {
|
|
6015
6013
|
const $ = await Ki({
|
|
6016
6014
|
record: K,
|
|
6017
6015
|
focus: c.currentFocus,
|
|
@@ -6031,17 +6029,17 @@ async function Li(l) {
|
|
|
6031
6029
|
function Ui(l) {
|
|
6032
6030
|
const { contextPromise: c, dialecteConfig: u, databaseInstance: a } = l;
|
|
6033
6031
|
async function d(m) {
|
|
6034
|
-
const b = await
|
|
6032
|
+
const b = await No({
|
|
6035
6033
|
contextPromise: c,
|
|
6036
6034
|
dialecteConfig: u,
|
|
6037
6035
|
databaseInstance: a
|
|
6038
|
-
})(m),
|
|
6036
|
+
})(m), C = /* @__PURE__ */ new Map(), I = Object.values(b);
|
|
6039
6037
|
for (const F of I)
|
|
6040
6038
|
for (const Z of F)
|
|
6041
|
-
|
|
6042
|
-
if (
|
|
6039
|
+
C.set(Z.id, Z);
|
|
6040
|
+
if (C.size === 0) return [];
|
|
6043
6041
|
const K = br(m), $ = K[K.length - 1].tagName, Y = m.tagName;
|
|
6044
|
-
return Array.from(
|
|
6042
|
+
return Array.from(C.values()).filter(
|
|
6045
6043
|
(F) => F.tagName === Y
|
|
6046
6044
|
).map((F) => M(F));
|
|
6047
6045
|
function M(F) {
|
|
@@ -6050,7 +6048,7 @@ function Ui(l) {
|
|
|
6050
6048
|
...F,
|
|
6051
6049
|
tree: []
|
|
6052
6050
|
};
|
|
6053
|
-
const Z = F.children.map((re) =>
|
|
6051
|
+
const Z = F.children.map((re) => C.get(re.id)).filter((re) => re !== void 0).map((re) => M(re));
|
|
6054
6052
|
return {
|
|
6055
6053
|
...F,
|
|
6056
6054
|
tree: Z
|
|
@@ -6063,7 +6061,7 @@ function $i(l) {
|
|
|
6063
6061
|
const { contextPromise: c } = l;
|
|
6064
6062
|
return async function() {
|
|
6065
6063
|
const u = await c;
|
|
6066
|
-
return
|
|
6064
|
+
return sa({ attributes: u.currentFocus.attributes });
|
|
6067
6065
|
};
|
|
6068
6066
|
}
|
|
6069
6067
|
function Vi(l) {
|
|
@@ -6139,13 +6137,13 @@ const Gi = {
|
|
|
6139
6137
|
// 400-499: Validation errors
|
|
6140
6138
|
// 500-599: Flavor configuration errors
|
|
6141
6139
|
};
|
|
6142
|
-
function
|
|
6140
|
+
function Ro(l) {
|
|
6143
6141
|
const { errorKey: c, messageOverride: u, context: a } = l, { code: d, message: m } = Gi[c], g = new Error(u ?? m);
|
|
6144
6142
|
return g.code = d, g.errorKey = c, g.defaultMessage = m, g.context = a, g;
|
|
6145
6143
|
}
|
|
6146
6144
|
function Xi(l) {
|
|
6147
6145
|
return async function() {
|
|
6148
|
-
const { contextPromise: u, dialecteConfig: a, databaseInstance: d } = l, m = a.database.tables.xmlElements.name, g = d.table(m), b = structuredClone(await u), { creates:
|
|
6146
|
+
const { contextPromise: u, dialecteConfig: a, databaseInstance: d } = l, m = a.database.tables.xmlElements.name, g = d.table(m), b = structuredClone(await u), { creates: C, updates: I, deletes: K } = Vi(b.stagedOperations), $ = C.length + I.length + K.length;
|
|
6149
6147
|
st.updateEndingProgress({
|
|
6150
6148
|
current: 0,
|
|
6151
6149
|
total: $,
|
|
@@ -6154,10 +6152,10 @@ function Xi(l) {
|
|
|
6154
6152
|
try {
|
|
6155
6153
|
await d.transaction("rw", g, async () => {
|
|
6156
6154
|
let Y = 0;
|
|
6157
|
-
|
|
6155
|
+
C.length > 0 && (await g.bulkAdd(C.map((H) => H.newRecord)), Y += C.length, st.updateEndingProgress({
|
|
6158
6156
|
current: Y,
|
|
6159
6157
|
total: $,
|
|
6160
|
-
operation: `Created ${
|
|
6158
|
+
operation: `Created ${C.length} elements`
|
|
6161
6159
|
})), I.length > 0 && (await g.bulkPut(I.map((H) => H.newRecord)), Y += I.length, st.updateEndingProgress({
|
|
6162
6160
|
current: Y,
|
|
6163
6161
|
total: $,
|
|
@@ -6169,7 +6167,7 @@ function Xi(l) {
|
|
|
6169
6167
|
}));
|
|
6170
6168
|
}), b.stagedOperations = [], st.setComplete();
|
|
6171
6169
|
} catch (Y) {
|
|
6172
|
-
const H =
|
|
6170
|
+
const H = Ro({
|
|
6173
6171
|
errorKey: "DATABASE_COMMIT_ERROR",
|
|
6174
6172
|
context: {
|
|
6175
6173
|
method: "commit",
|
|
@@ -6185,14 +6183,14 @@ function Xi(l) {
|
|
|
6185
6183
|
function Wi(l) {
|
|
6186
6184
|
const { chain: c, contextPromise: u, dialecteConfig: a, focusedTagName: d } = l;
|
|
6187
6185
|
return function(m) {
|
|
6188
|
-
const { id: g, tagName: b, attributes:
|
|
6186
|
+
const { id: g, tagName: b, attributes: C, namespace: I, value: K, setFocus: $ = !1 } = m, Y = g ?? crypto.randomUUID(), H = u.then((M) => {
|
|
6189
6187
|
try {
|
|
6190
6188
|
st.setOperation(`Creating ${b}`);
|
|
6191
6189
|
const F = fo({
|
|
6192
6190
|
record: {
|
|
6193
6191
|
id: Y,
|
|
6194
6192
|
tagName: b,
|
|
6195
|
-
attributes:
|
|
6193
|
+
attributes: C,
|
|
6196
6194
|
namespace: I,
|
|
6197
6195
|
value: K
|
|
6198
6196
|
},
|
|
@@ -6210,7 +6208,7 @@ function Wi(l) {
|
|
|
6210
6208
|
currentFocus: re
|
|
6211
6209
|
};
|
|
6212
6210
|
} catch (F) {
|
|
6213
|
-
const Z =
|
|
6211
|
+
const Z = Ro({
|
|
6214
6212
|
errorKey: "CREATE_CHILD_ERROR",
|
|
6215
6213
|
context: {
|
|
6216
6214
|
method: "addChild",
|
|
@@ -6261,14 +6259,14 @@ function Yi(l) {
|
|
|
6261
6259
|
parentRecord: m,
|
|
6262
6260
|
context: u
|
|
6263
6261
|
});
|
|
6264
|
-
for (const
|
|
6265
|
-
|
|
6262
|
+
for (const C of b)
|
|
6263
|
+
C.status === "created" ? ut({ context: u, status: "created", record: C.newRecord }) : C.status === "updated" && (ut({
|
|
6266
6264
|
context: u,
|
|
6267
6265
|
status: "updated",
|
|
6268
|
-
oldRecord:
|
|
6269
|
-
newRecord:
|
|
6270
|
-
}),
|
|
6271
|
-
record:
|
|
6266
|
+
oldRecord: C.oldRecord,
|
|
6267
|
+
newRecord: C.newRecord
|
|
6268
|
+
}), C.newRecord.id === m.id && (g = Te({
|
|
6269
|
+
record: C.newRecord,
|
|
6272
6270
|
status: "updated"
|
|
6273
6271
|
})));
|
|
6274
6272
|
return {
|
|
@@ -6284,11 +6282,11 @@ function Yi(l) {
|
|
|
6284
6282
|
function zi(l) {
|
|
6285
6283
|
const { chain: c, contextPromise: u, dialecteConfig: a, focusedTagName: d } = l;
|
|
6286
6284
|
return function(m) {
|
|
6287
|
-
const { record: g, setFocus: b } = m,
|
|
6285
|
+
const { record: g, setFocus: b } = m, C = u.then(async (I) => {
|
|
6288
6286
|
const K = c({
|
|
6289
6287
|
contextPromise: Promise.resolve(I)
|
|
6290
6288
|
});
|
|
6291
|
-
let $ = await
|
|
6289
|
+
let $ = await Oo({
|
|
6292
6290
|
dialecteConfig: a,
|
|
6293
6291
|
clonedRecordRootId: g.id,
|
|
6294
6292
|
parentChain: K,
|
|
@@ -6297,22 +6295,22 @@ function zi(l) {
|
|
|
6297
6295
|
return !b && Y.currentFocus.parent && (Y = await $.goToParent(Y.currentFocus.parent.tagName).getContext()), Y;
|
|
6298
6296
|
});
|
|
6299
6297
|
return c(b ? {
|
|
6300
|
-
contextPromise:
|
|
6298
|
+
contextPromise: C,
|
|
6301
6299
|
newFocusedTagName: g.tagName
|
|
6302
6300
|
} : {
|
|
6303
|
-
contextPromise:
|
|
6301
|
+
contextPromise: C,
|
|
6304
6302
|
newFocusedTagName: d
|
|
6305
6303
|
});
|
|
6306
6304
|
};
|
|
6307
6305
|
}
|
|
6308
|
-
async function
|
|
6306
|
+
async function Oo(l) {
|
|
6309
6307
|
const { dialecteConfig: c, clonedRecordRootId: u, parentChain: a, childRecord: d } = l;
|
|
6310
6308
|
let m = !0, g = d, b = a;
|
|
6311
6309
|
if (c.hooks?.beforeClone) {
|
|
6312
|
-
const
|
|
6310
|
+
const C = c.hooks.beforeClone({
|
|
6313
6311
|
record: d
|
|
6314
6312
|
});
|
|
6315
|
-
m =
|
|
6313
|
+
m = C.shouldBeCloned, g = C.transformedRecord;
|
|
6316
6314
|
}
|
|
6317
6315
|
if (m) {
|
|
6318
6316
|
b = a.addChild({
|
|
@@ -6323,7 +6321,7 @@ async function Do(l) {
|
|
|
6323
6321
|
setFocus: !0
|
|
6324
6322
|
});
|
|
6325
6323
|
for (const I of g.tree)
|
|
6326
|
-
b = await
|
|
6324
|
+
b = await Oo({
|
|
6327
6325
|
dialecteConfig: c,
|
|
6328
6326
|
clonedRecordRootId: u,
|
|
6329
6327
|
parentChain: b,
|
|
@@ -6339,8 +6337,8 @@ async function Do(l) {
|
|
|
6339
6337
|
function Qi(l) {
|
|
6340
6338
|
const { chain: c, contextPromise: u, dialecteConfig: a } = l;
|
|
6341
6339
|
return function(d) {
|
|
6342
|
-
const { attributes: m, value: g } = d, b = u.then(async (
|
|
6343
|
-
const I =
|
|
6340
|
+
const { attributes: m, value: g } = d, b = u.then(async (C) => {
|
|
6341
|
+
const I = C.currentFocus;
|
|
6344
6342
|
let K = I.attributes;
|
|
6345
6343
|
if (m) {
|
|
6346
6344
|
const Y = lo({
|
|
@@ -6358,12 +6356,12 @@ function Qi(l) {
|
|
|
6358
6356
|
value: g !== void 0 ? g : I.value
|
|
6359
6357
|
};
|
|
6360
6358
|
return ut({
|
|
6361
|
-
context:
|
|
6359
|
+
context: C,
|
|
6362
6360
|
status: "updated",
|
|
6363
6361
|
oldRecord: I,
|
|
6364
6362
|
newRecord: $
|
|
6365
6363
|
}), {
|
|
6366
|
-
...
|
|
6364
|
+
...C,
|
|
6367
6365
|
currentFocus: Te({ record: $, status: "updated" })
|
|
6368
6366
|
};
|
|
6369
6367
|
});
|
|
@@ -6375,28 +6373,28 @@ function Qi(l) {
|
|
|
6375
6373
|
function Hi(l) {
|
|
6376
6374
|
const { chain: c, contextPromise: u, dialecteConfig: a, databaseInstance: d } = l;
|
|
6377
6375
|
return function(m) {
|
|
6378
|
-
const { parentTagName: g } = m, b = u.then(async (
|
|
6379
|
-
const I =
|
|
6376
|
+
const { parentTagName: g } = m, b = u.then(async (C) => {
|
|
6377
|
+
const I = C.currentFocus;
|
|
6380
6378
|
ye(I.parent, "Delete: Cannot delete root element"), ye(
|
|
6381
6379
|
I.parent.tagName === g,
|
|
6382
6380
|
"Delete: Focused element parent tag name mismatch"
|
|
6383
6381
|
), ut({
|
|
6384
|
-
context:
|
|
6382
|
+
context: C,
|
|
6385
6383
|
status: "deleted",
|
|
6386
6384
|
record: I
|
|
6387
|
-
}), await
|
|
6388
|
-
context:
|
|
6385
|
+
}), await Do({
|
|
6386
|
+
context: C,
|
|
6389
6387
|
dialecteConfig: a,
|
|
6390
6388
|
databaseInstance: d,
|
|
6391
6389
|
currentChild: I
|
|
6392
6390
|
});
|
|
6393
6391
|
const K = await Zi({
|
|
6394
|
-
context:
|
|
6392
|
+
context: C,
|
|
6395
6393
|
dialecteConfig: a,
|
|
6396
6394
|
databaseInstance: d
|
|
6397
6395
|
});
|
|
6398
6396
|
return {
|
|
6399
|
-
...
|
|
6397
|
+
...C,
|
|
6400
6398
|
currentFocus: K
|
|
6401
6399
|
};
|
|
6402
6400
|
});
|
|
@@ -6406,7 +6404,7 @@ function Hi(l) {
|
|
|
6406
6404
|
});
|
|
6407
6405
|
};
|
|
6408
6406
|
}
|
|
6409
|
-
async function
|
|
6407
|
+
async function Do(l) {
|
|
6410
6408
|
const { context: c, dialecteConfig: u, databaseInstance: a, currentChild: d } = l;
|
|
6411
6409
|
for (const m of d.children) {
|
|
6412
6410
|
const g = await Qt({
|
|
@@ -6416,7 +6414,7 @@ async function Io(l) {
|
|
|
6416
6414
|
dialecteConfig: u,
|
|
6417
6415
|
databaseInstance: a
|
|
6418
6416
|
});
|
|
6419
|
-
g && (g.children?.length > 0 && await
|
|
6417
|
+
g && (g.children?.length > 0 && await Do({
|
|
6420
6418
|
context: c,
|
|
6421
6419
|
dialecteConfig: u,
|
|
6422
6420
|
databaseInstance: a,
|
|
@@ -6456,23 +6454,23 @@ async function Zi(l) {
|
|
|
6456
6454
|
function Ji(l) {
|
|
6457
6455
|
const { chain: c, contextPromise: u, dialecteConfig: a, databaseInstance: d } = l;
|
|
6458
6456
|
return function(g) {
|
|
6459
|
-
const { tagName: b, id:
|
|
6457
|
+
const { tagName: b, id: C } = g, I = a.database.tables.xmlElements.name, K = u.then(async ($) => {
|
|
6460
6458
|
const Y = a.singletonElements?.includes(b), H = yr({
|
|
6461
6459
|
dialecteConfig: a,
|
|
6462
6460
|
stagedOperations: $.stagedOperations,
|
|
6463
6461
|
tagName: b,
|
|
6464
|
-
id:
|
|
6462
|
+
id: C
|
|
6465
6463
|
});
|
|
6466
6464
|
let M = H?.status !== "deleted" ? H?.record : void 0;
|
|
6467
6465
|
if (!M) {
|
|
6468
6466
|
const F = d.table(I);
|
|
6469
|
-
if (!
|
|
6467
|
+
if (!C && !Y)
|
|
6470
6468
|
throw new Error(`Element ${b} requires an id parameter`);
|
|
6471
|
-
M = await (Y && !
|
|
6469
|
+
M = await (Y && !C ? F.where("tagName").equals(b).first() : F.get({ id: C, tagName: b }));
|
|
6472
6470
|
}
|
|
6473
6471
|
return ye(
|
|
6474
6472
|
M,
|
|
6475
|
-
|
|
6473
|
+
C ? `Element "${b}" with id "${C}" not found in database` : `Element "${b}" not found in database`
|
|
6476
6474
|
), ye(
|
|
6477
6475
|
M.tagName === b,
|
|
6478
6476
|
`Element tagName mismatch: expected "${b}", got "${M.tagName}"`
|
|
@@ -6490,15 +6488,15 @@ function Ji(l) {
|
|
|
6490
6488
|
function es(l) {
|
|
6491
6489
|
const { chain: c, contextPromise: u, dialecteConfig: a, databaseInstance: d } = l;
|
|
6492
6490
|
return function(g) {
|
|
6493
|
-
const b = u.then(async (
|
|
6494
|
-
const I =
|
|
6491
|
+
const b = u.then(async (C) => {
|
|
6492
|
+
const I = C.currentFocus.parent;
|
|
6495
6493
|
ye(I, "GoToParent:Current focus parent should be defined here"), ye(
|
|
6496
6494
|
I.tagName === g,
|
|
6497
6495
|
"Parent tag name should match the requested parent"
|
|
6498
6496
|
);
|
|
6499
6497
|
const K = yr({
|
|
6500
6498
|
dialecteConfig: a,
|
|
6501
|
-
stagedOperations:
|
|
6499
|
+
stagedOperations: C.stagedOperations,
|
|
6502
6500
|
id: I.id,
|
|
6503
6501
|
tagName: I.tagName
|
|
6504
6502
|
});
|
|
@@ -6513,7 +6511,7 @@ function es(l) {
|
|
|
6513
6511
|
ye(H, "Parent record should be found in database"), $ = H;
|
|
6514
6512
|
}
|
|
6515
6513
|
return {
|
|
6516
|
-
...
|
|
6514
|
+
...C,
|
|
6517
6515
|
currentFocus: Te({ record: $ })
|
|
6518
6516
|
};
|
|
6519
6517
|
});
|
|
@@ -6545,7 +6543,7 @@ function ts(l) {
|
|
|
6545
6543
|
dialecteConfig: a,
|
|
6546
6544
|
databaseInstance: d
|
|
6547
6545
|
}),
|
|
6548
|
-
findDescendants:
|
|
6546
|
+
findDescendants: No({
|
|
6549
6547
|
contextPromise: u,
|
|
6550
6548
|
dialecteConfig: a,
|
|
6551
6549
|
databaseInstance: d
|
|
@@ -6555,7 +6553,7 @@ function ts(l) {
|
|
|
6555
6553
|
dialecteConfig: a,
|
|
6556
6554
|
databaseInstance: d
|
|
6557
6555
|
}),
|
|
6558
|
-
getTree:
|
|
6556
|
+
getTree: To({
|
|
6559
6557
|
contextPromise: u,
|
|
6560
6558
|
dialecteConfig: a,
|
|
6561
6559
|
databaseInstance: d
|
|
@@ -6588,7 +6586,7 @@ function ts(l) {
|
|
|
6588
6586
|
databaseInstance: d
|
|
6589
6587
|
}),
|
|
6590
6588
|
//== Endings
|
|
6591
|
-
getContext:
|
|
6589
|
+
getContext: ra({
|
|
6592
6590
|
contextPromise: u
|
|
6593
6591
|
}),
|
|
6594
6592
|
getParent: Ti({
|
|
@@ -6606,8 +6604,8 @@ function ts(l) {
|
|
|
6606
6604
|
function ns(l) {
|
|
6607
6605
|
const { extensions: c, focusedTagName: u, chain: a, dialecteConfig: d, contextPromise: m } = l, g = {}, b = c[u];
|
|
6608
6606
|
if (b)
|
|
6609
|
-
for (const [
|
|
6610
|
-
g[
|
|
6607
|
+
for (const [C, I] of Object.entries(b))
|
|
6608
|
+
g[C] = I({
|
|
6611
6609
|
chain: a,
|
|
6612
6610
|
dialecteConfig: d,
|
|
6613
6611
|
contextPromise: m
|
|
@@ -6632,7 +6630,7 @@ function vr(l) {
|
|
|
6632
6630
|
databaseInstance: u,
|
|
6633
6631
|
contextPromise: a,
|
|
6634
6632
|
focusedTagName: m
|
|
6635
|
-
}),
|
|
6633
|
+
}), C = ns({
|
|
6636
6634
|
focusedTagName: m,
|
|
6637
6635
|
extensions: d,
|
|
6638
6636
|
chain: g,
|
|
@@ -6641,15 +6639,15 @@ function vr(l) {
|
|
|
6641
6639
|
});
|
|
6642
6640
|
return {
|
|
6643
6641
|
...b,
|
|
6644
|
-
...
|
|
6642
|
+
...C
|
|
6645
6643
|
};
|
|
6646
6644
|
}
|
|
6647
6645
|
export {
|
|
6648
|
-
|
|
6649
|
-
|
|
6646
|
+
Ba as DATABASE_CONFIG,
|
|
6647
|
+
ca as DEV_CUSTOM_RECORD_ID_ATTRIBUTE_NAME,
|
|
6650
6648
|
mo as DEV_ID,
|
|
6651
6649
|
je as DIALECTE_NAMESPACES,
|
|
6652
|
-
|
|
6650
|
+
wa as IO_CONFIG,
|
|
6653
6651
|
_o as TEMP_IDB_ID_ATTRIBUTE_NAME,
|
|
6654
6652
|
go as TEST_DIALECTE_CONFIG,
|
|
6655
6653
|
is as XMLNS_DEFAULT_NAMESPACE,
|
|
@@ -6657,30 +6655,29 @@ export {
|
|
|
6657
6655
|
us as XMLNS_EXT_NAMESPACE,
|
|
6658
6656
|
ut as addStagedOperation,
|
|
6659
6657
|
ye as assert,
|
|
6660
|
-
|
|
6658
|
+
La as bulkAddRecords,
|
|
6661
6659
|
vr as chain,
|
|
6662
6660
|
bo as createDatabaseInstance,
|
|
6663
|
-
|
|
6664
|
-
|
|
6661
|
+
qa as createDialecte,
|
|
6662
|
+
ws as createTestDialecte,
|
|
6665
6663
|
cs as createTestRecord,
|
|
6666
|
-
|
|
6664
|
+
As as deleteDatabaseIfExists,
|
|
6667
6665
|
st as dialecteState,
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
ca as fetchRecords,
|
|
6666
|
+
Bs as executeTableDrivenTestsChainOperations,
|
|
6667
|
+
Cs as exportXmlFile,
|
|
6668
|
+
ua as fetchRecords,
|
|
6672
6669
|
ho as findByAttributes,
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6670
|
+
bi as formatXml,
|
|
6671
|
+
ia as getAttributeValueByName,
|
|
6672
|
+
sa as getAttributesValuesByName,
|
|
6673
|
+
fi as getDatabaseName,
|
|
6677
6674
|
yr as getLatestStagedRecord,
|
|
6678
6675
|
Qt as getRecord,
|
|
6679
|
-
|
|
6680
|
-
|
|
6676
|
+
ka as getState,
|
|
6677
|
+
ci as importXmlFiles,
|
|
6681
6678
|
os as isChainRecord,
|
|
6682
|
-
|
|
6683
|
-
|
|
6679
|
+
li as isFileSupported,
|
|
6680
|
+
aa as isFullAttributeArray,
|
|
6684
6681
|
rs as isRawRecord,
|
|
6685
6682
|
as as isTreeRecord,
|
|
6686
6683
|
gr as matchesAttributeFilter,
|