@dialecte/core 0.2.3 → 0.2.4
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.
|
@@ -88,14 +88,14 @@ async function me(m) {
|
|
|
88
88
|
}
|
|
89
89
|
let o;
|
|
90
90
|
if (s.id === void 0) {
|
|
91
|
-
const d = `__singleton_${s.tagName}`, f =
|
|
91
|
+
const d = `__singleton_${s.tagName}`, f = Ht(r) ? r.recordCache.get(d) : void 0;
|
|
92
92
|
f ? o = f : (o = (await r.store.getByTagNameInDocument(
|
|
93
93
|
s.tagName,
|
|
94
94
|
r.documentId
|
|
95
|
-
))[0], o &&
|
|
95
|
+
))[0], o && Ht(r) && (r.recordCache.set(o.id, o), r.recordCache.set(d, o)));
|
|
96
96
|
} else {
|
|
97
|
-
const d =
|
|
98
|
-
d ? o = d : (o = await r.store.get(s.id, r.documentId), o &&
|
|
97
|
+
const d = Ht(r) ? r.recordCache.get(s.id) : void 0;
|
|
98
|
+
d ? o = d : (o = await r.store.get(s.id, r.documentId), o && Ht(r) && r.recordCache.set(s.id, o));
|
|
99
99
|
}
|
|
100
100
|
if (o)
|
|
101
101
|
return { ...o, status: "unchanged" };
|
|
@@ -110,7 +110,7 @@ async function Sn(m) {
|
|
|
110
110
|
r.documentId
|
|
111
111
|
);
|
|
112
112
|
for (const d of o)
|
|
113
|
-
|
|
113
|
+
Ht(r) && r.recordCache.set(d.id, d);
|
|
114
114
|
return wo({ rawRecords: o, stagedOperations: r.stagedOperations, tagName: s });
|
|
115
115
|
}
|
|
116
116
|
async function yi(m) {
|
|
@@ -124,38 +124,38 @@ async function yi(m) {
|
|
|
124
124
|
(D) => v.includes(D.tagName)
|
|
125
125
|
);
|
|
126
126
|
for (const D of g) {
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
127
|
+
const R = await me({ context: r, ref: D });
|
|
128
|
+
if (!R) continue;
|
|
129
|
+
const K = R.children.find((B) => B.tagName === o);
|
|
130
|
+
if (K) return me({ context: r, ref: K });
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
async function vi(m) {
|
|
134
134
|
const { context: r, ref: s, tagName: o } = m, d = await me({ context: r, ref: s });
|
|
135
135
|
if (!d) return [];
|
|
136
|
-
const f = d.children.filter((
|
|
136
|
+
const f = d.children.filter((B) => B.tagName === o).map((B) => ({ tagName: o, id: B.id }));
|
|
137
137
|
if (f.length)
|
|
138
138
|
return (await Zt({ context: r, refs: f })).filter(
|
|
139
|
-
(
|
|
139
|
+
(Y) => Y !== void 0
|
|
140
140
|
);
|
|
141
141
|
const v = r.dialecteConfig.transparentElements;
|
|
142
142
|
if (!v?.length) return [];
|
|
143
143
|
const g = d.children.filter(
|
|
144
|
-
(
|
|
144
|
+
(B) => v.includes(B.tagName)
|
|
145
145
|
);
|
|
146
146
|
if (!g.length) return [];
|
|
147
|
-
const
|
|
148
|
-
return
|
|
149
|
-
(
|
|
147
|
+
const R = (await Zt({ context: r, refs: g })).filter((B) => B !== void 0).flatMap((B) => B.children.filter((Y) => Y.tagName === o)).map((B) => ({ tagName: o, id: B.id }));
|
|
148
|
+
return R.length ? (await Zt({ context: r, refs: R })).filter(
|
|
149
|
+
(B) => B !== void 0
|
|
150
150
|
) : [];
|
|
151
151
|
}
|
|
152
152
|
async function bi(m) {
|
|
153
153
|
const { context: r, ref: s, options: o } = m, d = o?.depth ?? 1 / 0, f = o?.stopAtTagName, v = o?.order ?? "bottom-up", g = [];
|
|
154
154
|
let D = await me({ context: r, ref: s });
|
|
155
155
|
for (; D?.parent && g.length < d; ) {
|
|
156
|
-
const
|
|
157
|
-
if (!
|
|
158
|
-
D =
|
|
156
|
+
const R = D.parent, K = await me({ context: r, ref: R });
|
|
157
|
+
if (!K || (g.push(K), f && K.tagName === f)) break;
|
|
158
|
+
D = K;
|
|
159
159
|
}
|
|
160
160
|
return v === "top-down" ? g.reverse() : g;
|
|
161
161
|
}
|
|
@@ -185,10 +185,10 @@ function xt(m) {
|
|
|
185
185
|
}
|
|
186
186
|
async function wr(m) {
|
|
187
187
|
const { context: r, ref: s, options: o } = m, { collect: d, omit: f } = o, v = _o(f), g = Eo(d), D = /* @__PURE__ */ new Map();
|
|
188
|
-
for (const
|
|
189
|
-
D.set(
|
|
190
|
-
const
|
|
191
|
-
return
|
|
188
|
+
for (const K of g.allTags)
|
|
189
|
+
D.set(K, /* @__PURE__ */ new Map());
|
|
190
|
+
const R = await me({ context: r, ref: s });
|
|
191
|
+
return R && (g.mode === "flat" ? await To({ context: r, rootId: R.id, collectSpec: g, omitSpec: v, collected: D }) : await Ei({ context: r, record: R, pathNodes: g.paths, omitSpec: v, collected: D })), ii(D);
|
|
192
192
|
}
|
|
193
193
|
function _o(m) {
|
|
194
194
|
const r = /* @__PURE__ */ new Set(), s = [];
|
|
@@ -244,12 +244,12 @@ function xo(m) {
|
|
|
244
244
|
if (s === !0)
|
|
245
245
|
return { tagName: r, where: void 0, children: [], isLeaf: !0 };
|
|
246
246
|
if (typeof s != "object" || s === null) return;
|
|
247
|
-
const d = s, f = d.where, v = Object.keys(d).filter((
|
|
247
|
+
const d = s, f = d.where, v = Object.keys(d).filter((R) => R !== "where");
|
|
248
248
|
if (v.length === 0)
|
|
249
249
|
return { tagName: r, where: f, children: [], isLeaf: !0 };
|
|
250
250
|
const g = {};
|
|
251
|
-
for (const
|
|
252
|
-
g[
|
|
251
|
+
for (const R of v)
|
|
252
|
+
g[R] = d[R];
|
|
253
253
|
const D = wi(g, o);
|
|
254
254
|
return { tagName: r, where: f, children: D, isLeaf: !1 };
|
|
255
255
|
}
|
|
@@ -298,10 +298,10 @@ async function Ei(m) {
|
|
|
298
298
|
omitSpec: d,
|
|
299
299
|
stopAtTagNames: v
|
|
300
300
|
});
|
|
301
|
-
for (const
|
|
302
|
-
f.get(g.tagName).set(
|
|
301
|
+
for (const R of D)
|
|
302
|
+
f.get(g.tagName).set(R.id, R), !g.isLeaf && g.children.length > 0 && await Ei({
|
|
303
303
|
context: r,
|
|
304
|
-
record:
|
|
304
|
+
record: R,
|
|
305
305
|
pathNodes: g.children,
|
|
306
306
|
omitSpec: d,
|
|
307
307
|
collected: f
|
|
@@ -311,16 +311,16 @@ async function Ei(m) {
|
|
|
311
311
|
async function Co(m) {
|
|
312
312
|
const { context: r, record: s, tagName: o, where: d, omitSpec: f, stopAtTagNames: v } = m, g = [];
|
|
313
313
|
if (!s.children?.length) return g;
|
|
314
|
-
const D = [],
|
|
315
|
-
for (D.push(...
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
318
|
-
_i({ record:
|
|
314
|
+
const D = [], R = await ri({ context: r, record: s, omitSpec: f });
|
|
315
|
+
for (D.push(...R); D.length > 0; ) {
|
|
316
|
+
const K = D.shift();
|
|
317
|
+
if (K.tagName === o) {
|
|
318
|
+
_i({ record: K, where: d }) && g.push(K);
|
|
319
319
|
continue;
|
|
320
320
|
}
|
|
321
|
-
if (!(v.has(
|
|
322
|
-
const
|
|
323
|
-
D.push(...
|
|
321
|
+
if (!(v.has(K.tagName) && K.tagName !== o) && K.children?.length) {
|
|
322
|
+
const B = await ri({ context: r, record: K, omitSpec: f });
|
|
323
|
+
D.push(...B);
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
return g;
|
|
@@ -366,14 +366,14 @@ async function Oi(m) {
|
|
|
366
366
|
detail: "No record found for provided ref",
|
|
367
367
|
key: "ELEMENT_NOT_FOUND"
|
|
368
368
|
});
|
|
369
|
-
const
|
|
369
|
+
const R = Oo(v), K = await Ai({
|
|
370
370
|
context: r,
|
|
371
371
|
record: D,
|
|
372
372
|
select: f,
|
|
373
|
-
compiledOmit:
|
|
373
|
+
compiledOmit: R,
|
|
374
374
|
dialecteConfig: d
|
|
375
375
|
});
|
|
376
|
-
return
|
|
376
|
+
return K ? g ? Mo({ tree: K, unwrapTagNames: g }) : K : br({ record: D });
|
|
377
377
|
}
|
|
378
378
|
function Oo(m) {
|
|
379
379
|
const r = /* @__PURE__ */ new Set(), s = [];
|
|
@@ -408,10 +408,10 @@ async function Ai(m) {
|
|
|
408
408
|
dialecteConfig: f
|
|
409
409
|
}), D = (await Promise.all(
|
|
410
410
|
v.map(
|
|
411
|
-
({ record:
|
|
411
|
+
({ record: R, select: K }) => Ai({ context: r, record: R, select: K, compiledOmit: d, dialecteConfig: f })
|
|
412
412
|
)
|
|
413
413
|
)).filter(
|
|
414
|
-
(
|
|
414
|
+
(R) => R !== null
|
|
415
415
|
);
|
|
416
416
|
return br({ record: s, tree: D });
|
|
417
417
|
}
|
|
@@ -438,24 +438,24 @@ async function So(m) {
|
|
|
438
438
|
if (!s.children?.length) return [];
|
|
439
439
|
const v = o ? Io(o) : void 0;
|
|
440
440
|
if (v && o && f && o.recursive !== !1) {
|
|
441
|
-
const
|
|
442
|
-
|
|
441
|
+
const B = s.tagName, Y = f.children[B], oe = o[B] !== void 0;
|
|
442
|
+
Y?.includes(B) && !oe && v.add(B);
|
|
443
443
|
}
|
|
444
444
|
const g = s.children.filter(
|
|
445
|
-
(
|
|
445
|
+
(B) => ko({ tagName: B.tagName, compiledOmit: d, selectKeys: v })
|
|
446
446
|
);
|
|
447
447
|
if (!g.length) return [];
|
|
448
|
-
const
|
|
448
|
+
const K = (await Promise.all(
|
|
449
449
|
g.map(
|
|
450
|
-
(
|
|
450
|
+
(B) => me({
|
|
451
451
|
context: r,
|
|
452
|
-
ref: ce(
|
|
452
|
+
ref: ce(B)
|
|
453
453
|
})
|
|
454
454
|
)
|
|
455
455
|
)).filter(
|
|
456
|
-
(
|
|
457
|
-
).filter((
|
|
458
|
-
return Po({ children:
|
|
456
|
+
(B) => B !== void 0
|
|
457
|
+
).filter((B) => !Do({ record: B, compiledOmit: d }));
|
|
458
|
+
return Po({ children: K, select: o, record: s, dialecteConfig: f });
|
|
459
459
|
}
|
|
460
460
|
function ko(m) {
|
|
461
461
|
const { tagName: r, compiledOmit: s, selectKeys: o } = m;
|
|
@@ -476,9 +476,9 @@ function Po(m) {
|
|
|
476
476
|
for (const v of r) {
|
|
477
477
|
const g = s[v.tagName];
|
|
478
478
|
if (g === void 0 && v.tagName === o.tagName) {
|
|
479
|
-
const
|
|
480
|
-
if (
|
|
481
|
-
f.push(
|
|
479
|
+
const R = Fo({ child: v, select: s, dialecteConfig: d });
|
|
480
|
+
if (R) {
|
|
481
|
+
f.push(R);
|
|
482
482
|
continue;
|
|
483
483
|
}
|
|
484
484
|
}
|
|
@@ -849,8 +849,8 @@ function Tr(m) {
|
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
async function kn(m) {
|
|
852
|
-
const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, { id: g, tagName: D, attributes:
|
|
853
|
-
we(
|
|
852
|
+
const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, { id: g, tagName: D, attributes: R, namespace: K, value: B } = v, Y = await me({ context: o, ref: f });
|
|
853
|
+
we(Y, {
|
|
854
854
|
detail: "Parent record not found",
|
|
855
855
|
key: "ELEMENT_NOT_FOUND",
|
|
856
856
|
ref: f
|
|
@@ -861,10 +861,10 @@ async function kn(m) {
|
|
|
861
861
|
record: {
|
|
862
862
|
id: g ?? crypto.randomUUID(),
|
|
863
863
|
tagName: D,
|
|
864
|
-
attributes:
|
|
865
|
-
namespace:
|
|
866
|
-
value:
|
|
867
|
-
parent: { id:
|
|
864
|
+
attributes: R,
|
|
865
|
+
namespace: K,
|
|
866
|
+
value: B,
|
|
867
|
+
parent: { id: Y.id, tagName: Y.tagName },
|
|
868
868
|
children: []
|
|
869
869
|
}
|
|
870
870
|
});
|
|
@@ -874,26 +874,26 @@ async function kn(m) {
|
|
|
874
874
|
record: oe
|
|
875
875
|
});
|
|
876
876
|
const M = {
|
|
877
|
-
...
|
|
878
|
-
children: [...
|
|
877
|
+
...Y,
|
|
878
|
+
children: [...Y.children, { id: oe.id, tagName: oe.tagName }]
|
|
879
879
|
};
|
|
880
880
|
if (et({
|
|
881
881
|
context: o,
|
|
882
882
|
status: "updated",
|
|
883
|
-
oldRecord:
|
|
883
|
+
oldRecord: Y,
|
|
884
884
|
newRecord: M
|
|
885
885
|
}), s?.afterCreated) {
|
|
886
|
-
const
|
|
886
|
+
const j = await s.afterCreated({
|
|
887
887
|
childRecord: oe,
|
|
888
888
|
parentRecord: M,
|
|
889
889
|
query: d
|
|
890
890
|
});
|
|
891
|
-
Tr({ context: o, operations:
|
|
891
|
+
Tr({ context: o, operations: j });
|
|
892
892
|
}
|
|
893
893
|
return oe;
|
|
894
894
|
}
|
|
895
895
|
async function ki(m) {
|
|
896
|
-
const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, record: v, cumulativeCloneMappings: g } = m, D = [],
|
|
896
|
+
const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, record: v, cumulativeCloneMappings: g } = m, D = [], R = await Ri({
|
|
897
897
|
dialecteConfig: r,
|
|
898
898
|
hooks: s,
|
|
899
899
|
context: o,
|
|
@@ -903,55 +903,55 @@ async function ki(m) {
|
|
|
903
903
|
mappings: D
|
|
904
904
|
});
|
|
905
905
|
if (g.push(...D), s?.afterDeepClone) {
|
|
906
|
-
const
|
|
906
|
+
const K = await s.afterDeepClone({
|
|
907
907
|
cumulativeCloneMappings: g,
|
|
908
908
|
query: d
|
|
909
909
|
});
|
|
910
|
-
o.stagedOperations.push(...
|
|
910
|
+
o.stagedOperations.push(...K);
|
|
911
911
|
}
|
|
912
912
|
return {
|
|
913
|
-
record:
|
|
913
|
+
record: R,
|
|
914
914
|
mappings: D
|
|
915
915
|
};
|
|
916
916
|
}
|
|
917
917
|
async function Ri(m) {
|
|
918
918
|
const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, record: v, mappings: g } = m;
|
|
919
|
-
let D = !0,
|
|
919
|
+
let D = !0, R = v;
|
|
920
920
|
if (s?.beforeClone) {
|
|
921
|
-
const
|
|
922
|
-
D =
|
|
921
|
+
const Y = s.beforeClone({ record: v });
|
|
922
|
+
D = Y.shouldBeCloned, R = Y.transformedRecord;
|
|
923
923
|
}
|
|
924
|
-
if (!D) return
|
|
925
|
-
const
|
|
924
|
+
if (!D) return R;
|
|
925
|
+
const K = await kn({
|
|
926
926
|
dialecteConfig: r,
|
|
927
927
|
hooks: s,
|
|
928
928
|
context: o,
|
|
929
929
|
query: d,
|
|
930
930
|
parentRef: f,
|
|
931
931
|
params: {
|
|
932
|
-
tagName:
|
|
933
|
-
namespace:
|
|
934
|
-
attributes:
|
|
935
|
-
value:
|
|
932
|
+
tagName: R.tagName,
|
|
933
|
+
namespace: R.namespace,
|
|
934
|
+
attributes: R.attributes,
|
|
935
|
+
value: R.value
|
|
936
936
|
}
|
|
937
|
-
}),
|
|
937
|
+
}), B = ce(v);
|
|
938
938
|
g.push({
|
|
939
|
-
source: Object.assign(
|
|
939
|
+
source: Object.assign(B, {
|
|
940
940
|
attributes: [...v.attributes]
|
|
941
941
|
}),
|
|
942
|
-
target: ce(
|
|
942
|
+
target: ce(K)
|
|
943
943
|
});
|
|
944
|
-
for (const
|
|
944
|
+
for (const Y of R.tree)
|
|
945
945
|
await Ri({
|
|
946
946
|
dialecteConfig: r,
|
|
947
947
|
hooks: s,
|
|
948
948
|
context: o,
|
|
949
949
|
query: d,
|
|
950
|
-
parentRef: ce(
|
|
951
|
-
record:
|
|
950
|
+
parentRef: ce(K),
|
|
951
|
+
record: Y,
|
|
952
952
|
mappings: g
|
|
953
953
|
});
|
|
954
|
-
return
|
|
954
|
+
return K;
|
|
955
955
|
}
|
|
956
956
|
async function Ii(m) {
|
|
957
957
|
const { hooks: r, context: s, query: o, ref: d } = m, f = await me({ context: s, ref: d });
|
|
@@ -963,8 +963,8 @@ async function Ii(m) {
|
|
|
963
963
|
detail: "Cannot delete root element",
|
|
964
964
|
key: "PROTECTED_ROOT"
|
|
965
965
|
}), r?.beforeDelete) {
|
|
966
|
-
const
|
|
967
|
-
Tr({ context: s, operations:
|
|
966
|
+
const R = await r.beforeDelete({ record: f, query: o });
|
|
967
|
+
Tr({ context: s, operations: R });
|
|
968
968
|
}
|
|
969
969
|
await Pi({ context: s, record: f }), et({ context: s, status: "deleted", record: f });
|
|
970
970
|
const v = ce(f.parent), g = await me({ context: s, ref: v });
|
|
@@ -974,7 +974,7 @@ async function Ii(m) {
|
|
|
974
974
|
});
|
|
975
975
|
const D = {
|
|
976
976
|
...g,
|
|
977
|
-
children: g.children.filter((
|
|
977
|
+
children: g.children.filter((R) => R.id !== f.id)
|
|
978
978
|
};
|
|
979
979
|
return et({ context: s, status: "updated", oldRecord: g, newRecord: D }), D;
|
|
980
980
|
}
|
|
@@ -995,8 +995,8 @@ async function Fi(m) {
|
|
|
995
995
|
});
|
|
996
996
|
if (D) return D;
|
|
997
997
|
} else {
|
|
998
|
-
const D = { tagName: v.tagName, id: v.id },
|
|
999
|
-
if (
|
|
998
|
+
const D = { tagName: v.tagName, id: v.id }, R = await me({ context: o, ref: D });
|
|
999
|
+
if (R) return R;
|
|
1000
1000
|
}
|
|
1001
1001
|
return kn({
|
|
1002
1002
|
dialecteConfig: r,
|
|
@@ -1012,39 +1012,39 @@ function Ko(m) {
|
|
|
1012
1012
|
return Object.values(r).some((o) => o !== void 0 && o !== "") ? r : void 0;
|
|
1013
1013
|
}
|
|
1014
1014
|
async function Bi(m) {
|
|
1015
|
-
const { dialecteConfig: r, hooks: s, context: o, query: d, ref: f, params: v } = m, { attributes: g, value: D } = v,
|
|
1016
|
-
we(
|
|
1015
|
+
const { dialecteConfig: r, hooks: s, context: o, query: d, ref: f, params: v } = m, { attributes: g, value: D } = v, R = await me({ context: o, ref: f });
|
|
1016
|
+
we(R, {
|
|
1017
1017
|
detail: `Record not found (tagName=${f.tagName}, id=${f.id})`,
|
|
1018
1018
|
key: "ELEMENT_NOT_FOUND",
|
|
1019
1019
|
ref: f
|
|
1020
1020
|
});
|
|
1021
|
-
let
|
|
1021
|
+
let K = R.attributes;
|
|
1022
1022
|
if (g) {
|
|
1023
|
-
const
|
|
1023
|
+
const Y = vo({
|
|
1024
1024
|
dialecteConfig: r,
|
|
1025
|
-
tagName:
|
|
1025
|
+
tagName: R.tagName,
|
|
1026
1026
|
attributes: g
|
|
1027
1027
|
});
|
|
1028
|
-
|
|
1029
|
-
(M) => !
|
|
1030
|
-
), ...
|
|
1028
|
+
K = [...R.attributes.filter(
|
|
1029
|
+
(M) => !Y.some((j) => j.name === M.name)
|
|
1030
|
+
), ...Y].filter(
|
|
1031
1031
|
(M) => M.value !== void 0 && M.value !== null
|
|
1032
1032
|
);
|
|
1033
1033
|
}
|
|
1034
|
-
const
|
|
1035
|
-
...
|
|
1036
|
-
attributes:
|
|
1037
|
-
value: D !== void 0 ? D :
|
|
1034
|
+
const B = {
|
|
1035
|
+
...R,
|
|
1036
|
+
attributes: K,
|
|
1037
|
+
value: D !== void 0 ? D : R.value
|
|
1038
1038
|
};
|
|
1039
|
-
if (et({ context: o, status: "updated", oldRecord:
|
|
1040
|
-
const
|
|
1041
|
-
oldRecord:
|
|
1042
|
-
newRecord:
|
|
1039
|
+
if (et({ context: o, status: "updated", oldRecord: R, newRecord: B }), s?.afterUpdated) {
|
|
1040
|
+
const Y = await s.afterUpdated({
|
|
1041
|
+
oldRecord: R,
|
|
1042
|
+
newRecord: B,
|
|
1043
1043
|
query: d
|
|
1044
1044
|
});
|
|
1045
|
-
Tr({ context: o, operations:
|
|
1045
|
+
Tr({ context: o, operations: Y });
|
|
1046
1046
|
}
|
|
1047
|
-
return
|
|
1047
|
+
return B;
|
|
1048
1048
|
}
|
|
1049
1049
|
class qo extends Di {
|
|
1050
1050
|
constructor(r, s, o, d) {
|
|
@@ -1150,15 +1150,15 @@ async function Uo(m) {
|
|
|
1150
1150
|
try {
|
|
1151
1151
|
await s.commit({
|
|
1152
1152
|
documentId: o,
|
|
1153
|
-
creates: f.map((
|
|
1154
|
-
updates: v.map((
|
|
1155
|
-
deletes: g.map((
|
|
1156
|
-
onProgress: (
|
|
1157
|
-
d.progress = { message: "Committing changes...", current:
|
|
1153
|
+
creates: f.map((R) => R.newRecord),
|
|
1154
|
+
updates: v.map((R) => R.newRecord),
|
|
1155
|
+
deletes: g.map((R) => R.oldRecord.id),
|
|
1156
|
+
onProgress: (R, K) => {
|
|
1157
|
+
d.progress = { message: "Committing changes...", current: R, total: K };
|
|
1158
1158
|
}
|
|
1159
1159
|
});
|
|
1160
|
-
} catch (
|
|
1161
|
-
throw d.loading = !1, d.progress = null,
|
|
1160
|
+
} catch (R) {
|
|
1161
|
+
throw d.loading = !1, d.progress = null, R;
|
|
1162
1162
|
}
|
|
1163
1163
|
d.lastUpdate = Date.now();
|
|
1164
1164
|
}
|
|
@@ -1353,7 +1353,7 @@ class Vo extends Si {
|
|
|
1353
1353
|
});
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
1356
|
-
function
|
|
1356
|
+
function Ht(m) {
|
|
1357
1357
|
return m.recordCache !== void 0;
|
|
1358
1358
|
}
|
|
1359
1359
|
class $o {
|
|
@@ -1498,8 +1498,8 @@ class $o {
|
|
|
1498
1498
|
await this.store.destroy();
|
|
1499
1499
|
}
|
|
1500
1500
|
}
|
|
1501
|
-
const ft = "_documents",
|
|
1502
|
-
function
|
|
1501
|
+
const ft = "_documents", Ye = "_changeLog", ze = "_meta", Go = "xel_";
|
|
1502
|
+
function Wo(m) {
|
|
1503
1503
|
return `${Go}${m}`;
|
|
1504
1504
|
}
|
|
1505
1505
|
const oi = {
|
|
@@ -1519,11 +1519,11 @@ const oi = {
|
|
|
1519
1519
|
compoundIndexes: [],
|
|
1520
1520
|
arrayIndexes: []
|
|
1521
1521
|
};
|
|
1522
|
-
var
|
|
1522
|
+
var Xo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1523
1523
|
function ji(m) {
|
|
1524
1524
|
return m && m.__esModule && Object.prototype.hasOwnProperty.call(m, "default") ? m.default : m;
|
|
1525
1525
|
}
|
|
1526
|
-
function
|
|
1526
|
+
function Yo(m) {
|
|
1527
1527
|
if (Object.prototype.hasOwnProperty.call(m, "__esModule")) return m;
|
|
1528
1528
|
var r = m.default;
|
|
1529
1529
|
if (typeof r == "function") {
|
|
@@ -1547,12 +1547,12 @@ function Xo(m) {
|
|
|
1547
1547
|
});
|
|
1548
1548
|
}), s;
|
|
1549
1549
|
}
|
|
1550
|
-
var Dn = { exports: {} },
|
|
1551
|
-
function
|
|
1550
|
+
var Dn = { exports: {} }, zo = Dn.exports, ci;
|
|
1551
|
+
function Ho() {
|
|
1552
1552
|
return ci || (ci = 1, (function(m, r) {
|
|
1553
1553
|
(function(s, o) {
|
|
1554
1554
|
m.exports = o();
|
|
1555
|
-
})(
|
|
1555
|
+
})(zo, function() {
|
|
1556
1556
|
var s = function(e, t) {
|
|
1557
1557
|
return (s = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
|
|
1558
1558
|
n.__proto__ = i;
|
|
@@ -1569,32 +1569,32 @@ function zo() {
|
|
|
1569
1569
|
for (var i, a = 0, u = t.length; a < u; a++) !i && a in t || ((i = i || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
|
|
1570
1570
|
return e.concat(i || Array.prototype.slice.call(t));
|
|
1571
1571
|
}
|
|
1572
|
-
var f = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window :
|
|
1572
|
+
var f = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Xo, v = Object.keys, g = Array.isArray;
|
|
1573
1573
|
function D(e, t) {
|
|
1574
1574
|
return typeof t != "object" || v(t).forEach(function(n) {
|
|
1575
1575
|
e[n] = t[n];
|
|
1576
1576
|
}), e;
|
|
1577
1577
|
}
|
|
1578
1578
|
typeof Promise > "u" || f.Promise || (f.Promise = Promise);
|
|
1579
|
-
var
|
|
1580
|
-
function
|
|
1581
|
-
return
|
|
1579
|
+
var R = Object.getPrototypeOf, K = {}.hasOwnProperty;
|
|
1580
|
+
function B(e, t) {
|
|
1581
|
+
return K.call(e, t);
|
|
1582
1582
|
}
|
|
1583
|
-
function
|
|
1584
|
-
typeof t == "function" && (t = t(
|
|
1583
|
+
function Y(e, t) {
|
|
1584
|
+
typeof t == "function" && (t = t(R(e))), (typeof Reflect > "u" ? v : Reflect.ownKeys)(t).forEach(function(n) {
|
|
1585
1585
|
M(e, n, t[n]);
|
|
1586
1586
|
});
|
|
1587
1587
|
}
|
|
1588
1588
|
var oe = Object.defineProperty;
|
|
1589
1589
|
function M(e, t, n, i) {
|
|
1590
|
-
oe(e, t, D(n &&
|
|
1590
|
+
oe(e, t, D(n && B(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, i));
|
|
1591
1591
|
}
|
|
1592
|
-
function
|
|
1592
|
+
function j(e) {
|
|
1593
1593
|
return { from: function(t) {
|
|
1594
|
-
return e.prototype = Object.create(t.prototype), M(e.prototype, "constructor", e), { extend:
|
|
1594
|
+
return e.prototype = Object.create(t.prototype), M(e.prototype, "constructor", e), { extend: Y.bind(null, e.prototype) };
|
|
1595
1595
|
} };
|
|
1596
1596
|
}
|
|
1597
|
-
var
|
|
1597
|
+
var z = Object.getOwnPropertyDescriptor, ie = [].slice;
|
|
1598
1598
|
function ye(e, t, n) {
|
|
1599
1599
|
return ie.call(e, t, n);
|
|
1600
1600
|
}
|
|
@@ -1608,7 +1608,7 @@ function zo() {
|
|
|
1608
1608
|
f.setImmediate ? setImmediate(e) : setTimeout(e, 0);
|
|
1609
1609
|
}
|
|
1610
1610
|
function he(e, t) {
|
|
1611
|
-
if (typeof t == "string" &&
|
|
1611
|
+
if (typeof t == "string" && B(e, t)) return e[t];
|
|
1612
1612
|
if (!t) return e;
|
|
1613
1613
|
if (typeof t != "string") {
|
|
1614
1614
|
for (var n = [], i = 0, a = t.length; i < a; ++i) {
|
|
@@ -1629,12 +1629,12 @@ function zo() {
|
|
|
1629
1629
|
for (var i = 0, a = t.length; i < a; ++i) de(e, t[i], n[i]);
|
|
1630
1630
|
} else {
|
|
1631
1631
|
var u, h, p = t.indexOf(".");
|
|
1632
|
-
p !== -1 ? (u = t.substr(0, p), (h = t.substr(p + 1)) === "" ? n === void 0 ? g(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : de(p = !(p = e[u]) || !
|
|
1632
|
+
p !== -1 ? (u = t.substr(0, p), (h = t.substr(p + 1)) === "" ? n === void 0 ? g(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : de(p = !(p = e[u]) || !B(e, u) ? e[u] = {} : p, h, n)) : n === void 0 ? g(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
|
|
1633
1633
|
}
|
|
1634
1634
|
}
|
|
1635
1635
|
function ve(e) {
|
|
1636
1636
|
var t, n = {};
|
|
1637
|
-
for (t in e)
|
|
1637
|
+
for (t in e) B(e, t) && (n[t] = e[t]);
|
|
1638
1638
|
return n;
|
|
1639
1639
|
}
|
|
1640
1640
|
var In = [].concat;
|
|
@@ -1650,7 +1650,7 @@ function zo() {
|
|
|
1650
1650
|
}), Bt = new Set(Ve.map(function(e) {
|
|
1651
1651
|
return f[e];
|
|
1652
1652
|
})), Ue = null;
|
|
1653
|
-
function
|
|
1653
|
+
function He(e) {
|
|
1654
1654
|
return Ue = /* @__PURE__ */ new WeakMap(), e = (function t(n) {
|
|
1655
1655
|
if (!n || typeof n != "object") return n;
|
|
1656
1656
|
var i = Ue.get(n);
|
|
@@ -1660,8 +1660,8 @@ function zo() {
|
|
|
1660
1660
|
for (var a = 0, u = n.length; a < u; ++a) i.push(t(n[a]));
|
|
1661
1661
|
} else if (Bt.has(n.constructor)) i = n;
|
|
1662
1662
|
else {
|
|
1663
|
-
var h, p =
|
|
1664
|
-
for (h in i = p === Object.prototype ? {} : Object.create(p), Ue.set(n, i), n)
|
|
1663
|
+
var h, p = R(n);
|
|
1664
|
+
for (h in i = p === Object.prototype ? {} : Object.create(p), Ue.set(n, i), n) B(n, h) && (i[h] = t(n[h]));
|
|
1665
1665
|
}
|
|
1666
1666
|
return i;
|
|
1667
1667
|
})(e), Ue = null, e;
|
|
@@ -1721,9 +1721,9 @@ function zo() {
|
|
|
1721
1721
|
return t[n];
|
|
1722
1722
|
}), this.failuresByPos = t, this.message = Nt(e, this.failures);
|
|
1723
1723
|
}
|
|
1724
|
-
|
|
1724
|
+
j(tt).from(Error).extend({ toString: function() {
|
|
1725
1725
|
return this.name + ": " + this.message;
|
|
1726
|
-
} }),
|
|
1726
|
+
} }), j(nt).from(tt), j(Me).from(tt);
|
|
1727
1727
|
var ht = Le.reduce(function(e, t) {
|
|
1728
1728
|
return e[t] = t + "Error", e;
|
|
1729
1729
|
}, {}), Pn = tt, Q = Le.reduce(function(e, t) {
|
|
@@ -1732,7 +1732,7 @@ function zo() {
|
|
|
1732
1732
|
this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(u ? `
|
|
1733
1733
|
` + u : ""), this.inner = u || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = fe[t] || n, this.inner = null);
|
|
1734
1734
|
}
|
|
1735
|
-
return
|
|
1735
|
+
return j(i).from(Pn), e[t] = i, e;
|
|
1736
1736
|
}, {});
|
|
1737
1737
|
Q.Syntax = SyntaxError, Q.Type = TypeError, Q.Range = RangeError;
|
|
1738
1738
|
var Ct = rt.reduce(function(e, t) {
|
|
@@ -1745,7 +1745,7 @@ function zo() {
|
|
|
1745
1745
|
function c(e) {
|
|
1746
1746
|
return e;
|
|
1747
1747
|
}
|
|
1748
|
-
function
|
|
1748
|
+
function I(e, t) {
|
|
1749
1749
|
return e == null || e === c ? t : function(n) {
|
|
1750
1750
|
return t(e(n));
|
|
1751
1751
|
};
|
|
@@ -1804,16 +1804,16 @@ function zo() {
|
|
|
1804
1804
|
}
|
|
1805
1805
|
var Be = {}, en = 100, Ve = typeof Promise > "u" ? [] : (function() {
|
|
1806
1806
|
var e = Promise.resolve();
|
|
1807
|
-
if (typeof crypto > "u" || !crypto.subtle) return [e,
|
|
1807
|
+
if (typeof crypto > "u" || !crypto.subtle) return [e, R(e), e];
|
|
1808
1808
|
var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
1809
|
-
return [t,
|
|
1809
|
+
return [t, R(t), e];
|
|
1810
1810
|
})(), rt = Ve[0], Le = Ve[1], Ve = Ve[2], Le = Le && Le.then, Ge = rt && rt.constructor, Fn = !!Ve, Kt = function(e, t) {
|
|
1811
|
-
qt.push([e, t]), tn && (queueMicrotask(
|
|
1812
|
-
}, Bn = !0, tn = !0, mt = [], nn = [], jn = c, it = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: l, pgp: !1, env: {}, finalize: l },
|
|
1813
|
-
function
|
|
1811
|
+
qt.push([e, t]), tn && (queueMicrotask(Wi), tn = !1);
|
|
1812
|
+
}, Bn = !0, tn = !0, mt = [], nn = [], jn = c, it = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: l, pgp: !1, env: {}, finalize: l }, H = it, qt = [], pt = 0, rn = [];
|
|
1813
|
+
function W(e) {
|
|
1814
1814
|
if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
|
|
1815
1815
|
this._listeners = [], this._lib = !1;
|
|
1816
|
-
var t = this._PSD =
|
|
1816
|
+
var t = this._PSD = H;
|
|
1817
1817
|
if (typeof e != "function") {
|
|
1818
1818
|
if (e !== Be) throw new TypeError("Not a function");
|
|
1819
1819
|
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Kn(this, this._value));
|
|
@@ -1825,7 +1825,7 @@ function zo() {
|
|
|
1825
1825
|
if (u === i) throw new TypeError("A promise cannot be resolved with itself.");
|
|
1826
1826
|
var h = i._lib && At();
|
|
1827
1827
|
u && typeof u.then == "function" ? n(i, function(p, b) {
|
|
1828
|
-
u instanceof
|
|
1828
|
+
u instanceof W ? u._then(p, b) : u.then(p, b);
|
|
1829
1829
|
}) : (i._state = !0, i._value = u, Cr(i)), h && Dt();
|
|
1830
1830
|
}
|
|
1831
1831
|
}, Kn.bind(null, i));
|
|
@@ -1835,9 +1835,9 @@ function zo() {
|
|
|
1835
1835
|
})(this, e);
|
|
1836
1836
|
}
|
|
1837
1837
|
var Mn = { get: function() {
|
|
1838
|
-
var e =
|
|
1838
|
+
var e = H, t = cn;
|
|
1839
1839
|
function n(i, a) {
|
|
1840
|
-
var u = this, h = !e.global && (e !==
|
|
1840
|
+
var u = this, h = !e.global && (e !== H || t !== cn), p = h && !at(), b = new W(function(_, T) {
|
|
1841
1841
|
qn(u, new Nr(Ar(i, e, h, p), Ar(a, e, h, p), _, T, e));
|
|
1842
1842
|
});
|
|
1843
1843
|
return this._consoleTask && (b._consoleTask = this._consoleTask), b;
|
|
@@ -1887,7 +1887,7 @@ function zo() {
|
|
|
1887
1887
|
--pt == 0 && Ln(), --n.psd.ref || n.psd.finalize();
|
|
1888
1888
|
}
|
|
1889
1889
|
}
|
|
1890
|
-
function
|
|
1890
|
+
function Wi() {
|
|
1891
1891
|
gt(it, function() {
|
|
1892
1892
|
At() && Dt();
|
|
1893
1893
|
});
|
|
@@ -1914,12 +1914,12 @@ function zo() {
|
|
|
1914
1914
|
for (var t = rn.slice(0), n = t.length; n; ) t[--n]();
|
|
1915
1915
|
}
|
|
1916
1916
|
function on(e) {
|
|
1917
|
-
return new
|
|
1917
|
+
return new W(Be, !1, e);
|
|
1918
1918
|
}
|
|
1919
1919
|
function ge(e, t) {
|
|
1920
|
-
var n =
|
|
1920
|
+
var n = H;
|
|
1921
1921
|
return function() {
|
|
1922
|
-
var i = At(), a =
|
|
1922
|
+
var i = At(), a = H;
|
|
1923
1923
|
try {
|
|
1924
1924
|
return st(n, !0), e.apply(this, arguments);
|
|
1925
1925
|
} catch (u) {
|
|
@@ -1929,8 +1929,8 @@ function zo() {
|
|
|
1929
1929
|
}
|
|
1930
1930
|
};
|
|
1931
1931
|
}
|
|
1932
|
-
|
|
1933
|
-
qn(this, new Nr(null, null, e, t,
|
|
1932
|
+
Y(W.prototype, { then: Mn, _then: function(e, t) {
|
|
1933
|
+
qn(this, new Nr(null, null, e, t, H));
|
|
1934
1934
|
}, catch: function(e) {
|
|
1935
1935
|
if (arguments.length === 1) return this.then(null, e);
|
|
1936
1936
|
var t = e, n = arguments[1];
|
|
@@ -1941,48 +1941,48 @@ function zo() {
|
|
|
1941
1941
|
});
|
|
1942
1942
|
}, finally: function(e) {
|
|
1943
1943
|
return this.then(function(t) {
|
|
1944
|
-
return
|
|
1944
|
+
return W.resolve(e()).then(function() {
|
|
1945
1945
|
return t;
|
|
1946
1946
|
});
|
|
1947
1947
|
}, function(t) {
|
|
1948
|
-
return
|
|
1948
|
+
return W.resolve(e()).then(function() {
|
|
1949
1949
|
return on(t);
|
|
1950
1950
|
});
|
|
1951
1951
|
});
|
|
1952
1952
|
}, timeout: function(e, t) {
|
|
1953
1953
|
var n = this;
|
|
1954
|
-
return e < 1 / 0 ? new
|
|
1954
|
+
return e < 1 / 0 ? new W(function(i, a) {
|
|
1955
1955
|
var u = setTimeout(function() {
|
|
1956
1956
|
return a(new Q.Timeout(t));
|
|
1957
1957
|
}, e);
|
|
1958
1958
|
n.then(i, a).finally(clearTimeout.bind(null, u));
|
|
1959
1959
|
}) : this;
|
|
1960
|
-
} }), typeof Symbol < "u" && Symbol.toStringTag && M(
|
|
1960
|
+
} }), typeof Symbol < "u" && Symbol.toStringTag && M(W.prototype, Symbol.toStringTag, "Dexie.Promise"), it.env = Or(), Y(W, { all: function() {
|
|
1961
1961
|
var e = ke.apply(null, arguments).map(un);
|
|
1962
|
-
return new
|
|
1962
|
+
return new W(function(t, n) {
|
|
1963
1963
|
e.length === 0 && t([]);
|
|
1964
1964
|
var i = e.length;
|
|
1965
1965
|
e.forEach(function(a, u) {
|
|
1966
|
-
return
|
|
1966
|
+
return W.resolve(a).then(function(h) {
|
|
1967
1967
|
e[u] = h, --i || t(e);
|
|
1968
1968
|
}, n);
|
|
1969
1969
|
});
|
|
1970
1970
|
});
|
|
1971
1971
|
}, resolve: function(e) {
|
|
1972
|
-
return e instanceof
|
|
1972
|
+
return e instanceof W ? e : e && typeof e.then == "function" ? new W(function(t, n) {
|
|
1973
1973
|
e.then(t, n);
|
|
1974
|
-
}) : new
|
|
1974
|
+
}) : new W(Be, !0, e);
|
|
1975
1975
|
}, reject: on, race: function() {
|
|
1976
1976
|
var e = ke.apply(null, arguments).map(un);
|
|
1977
|
-
return new
|
|
1977
|
+
return new W(function(t, n) {
|
|
1978
1978
|
e.map(function(i) {
|
|
1979
|
-
return
|
|
1979
|
+
return W.resolve(i).then(t, n);
|
|
1980
1980
|
});
|
|
1981
1981
|
});
|
|
1982
1982
|
}, PSD: { get: function() {
|
|
1983
|
-
return
|
|
1983
|
+
return H;
|
|
1984
1984
|
}, set: function(e) {
|
|
1985
|
-
return
|
|
1985
|
+
return H = e;
|
|
1986
1986
|
} }, totalEchoes: { get: function() {
|
|
1987
1987
|
return cn;
|
|
1988
1988
|
} }, newPSD: ot, usePSD: gt, scheduler: { get: function() {
|
|
@@ -1994,9 +1994,9 @@ function zo() {
|
|
|
1994
1994
|
}, set: function(e) {
|
|
1995
1995
|
jn = e;
|
|
1996
1996
|
} }, follow: function(e, t) {
|
|
1997
|
-
return new
|
|
1997
|
+
return new W(function(n, i) {
|
|
1998
1998
|
return ot(function(a, u) {
|
|
1999
|
-
var h =
|
|
1999
|
+
var h = H;
|
|
2000
2000
|
h.unhandleds = [], h.onunhandled = u, h.finalize = E(function() {
|
|
2001
2001
|
var p, b = this;
|
|
2002
2002
|
p = function() {
|
|
@@ -2009,13 +2009,13 @@ function zo() {
|
|
|
2009
2009
|
}, h.finalize), e();
|
|
2010
2010
|
}, t, n, i);
|
|
2011
2011
|
});
|
|
2012
|
-
} }), Ge && (Ge.allSettled && M(
|
|
2012
|
+
} }), Ge && (Ge.allSettled && M(W, "allSettled", function() {
|
|
2013
2013
|
var e = ke.apply(null, arguments).map(un);
|
|
2014
|
-
return new
|
|
2014
|
+
return new W(function(t) {
|
|
2015
2015
|
e.length === 0 && t([]);
|
|
2016
2016
|
var n = e.length, i = new Array(n);
|
|
2017
2017
|
e.forEach(function(a, u) {
|
|
2018
|
-
return
|
|
2018
|
+
return W.resolve(a).then(function(h) {
|
|
2019
2019
|
return i[u] = { status: "fulfilled", value: h };
|
|
2020
2020
|
}, function(h) {
|
|
2021
2021
|
return i[u] = { status: "rejected", reason: h };
|
|
@@ -2024,29 +2024,29 @@ function zo() {
|
|
|
2024
2024
|
});
|
|
2025
2025
|
});
|
|
2026
2026
|
});
|
|
2027
|
-
}), Ge.any && typeof AggregateError < "u" && M(
|
|
2027
|
+
}), Ge.any && typeof AggregateError < "u" && M(W, "any", function() {
|
|
2028
2028
|
var e = ke.apply(null, arguments).map(un);
|
|
2029
|
-
return new
|
|
2029
|
+
return new W(function(t, n) {
|
|
2030
2030
|
e.length === 0 && n(new AggregateError([]));
|
|
2031
2031
|
var i = e.length, a = new Array(i);
|
|
2032
2032
|
e.forEach(function(u, h) {
|
|
2033
|
-
return
|
|
2033
|
+
return W.resolve(u).then(function(p) {
|
|
2034
2034
|
return t(p);
|
|
2035
2035
|
}, function(p) {
|
|
2036
2036
|
a[h] = p, --i || n(new AggregateError(a));
|
|
2037
2037
|
});
|
|
2038
2038
|
});
|
|
2039
2039
|
});
|
|
2040
|
-
}), Ge.withResolvers && (
|
|
2041
|
-
var De = { awaits: 0, echoes: 0, id: 0 },
|
|
2040
|
+
}), Ge.withResolvers && (W.withResolvers = Ge.withResolvers));
|
|
2041
|
+
var De = { awaits: 0, echoes: 0, id: 0 }, Xi = 0, an = [], sn = 0, cn = 0, Yi = 0;
|
|
2042
2042
|
function ot(e, t, n, i) {
|
|
2043
|
-
var a =
|
|
2044
|
-
return u.parent = a, u.ref = 0, u.global = !1, u.id = ++
|
|
2043
|
+
var a = H, u = Object.create(a);
|
|
2044
|
+
return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Yi, it.env, u.env = Fn ? { Promise: W, PromiseProp: { value: W, configurable: !0, writable: !0 }, all: W.all, race: W.race, allSettled: W.allSettled, any: W.any, resolve: W.resolve, reject: W.reject } : {}, t && D(u, t), ++a.ref, u.finalize = function() {
|
|
2045
2045
|
--this.parent.ref || this.parent.finalize();
|
|
2046
2046
|
}, i = gt(u, e, n, i), u.ref === 0 && u.finalize(), i;
|
|
2047
2047
|
}
|
|
2048
2048
|
function St() {
|
|
2049
|
-
return De.id || (De.id = ++
|
|
2049
|
+
return De.id || (De.id = ++Xi), ++De.awaits, De.echoes += en, De.id;
|
|
2050
2050
|
}
|
|
2051
2051
|
function at() {
|
|
2052
2052
|
return !!De.awaits && (--De.awaits == 0 && (De.id = 0), De.echoes = De.awaits * en, !0);
|
|
@@ -2058,22 +2058,22 @@ function zo() {
|
|
|
2058
2058
|
return at(), Te(t);
|
|
2059
2059
|
})) : e;
|
|
2060
2060
|
}
|
|
2061
|
-
function
|
|
2061
|
+
function zi() {
|
|
2062
2062
|
var e = an[an.length - 1];
|
|
2063
2063
|
an.pop(), st(e, !1);
|
|
2064
2064
|
}
|
|
2065
2065
|
function st(e, t) {
|
|
2066
|
-
var n, i =
|
|
2067
|
-
(t ? !De.echoes || sn++ && e ===
|
|
2068
|
-
++cn, De.echoes && --De.echoes != 0 || (De.echoes = De.awaits = De.id = 0), an.push(
|
|
2069
|
-
}).bind(null, e) :
|
|
2066
|
+
var n, i = H;
|
|
2067
|
+
(t ? !De.echoes || sn++ && e === H : !sn || --sn && e === H) || queueMicrotask(t ? (function(a) {
|
|
2068
|
+
++cn, De.echoes && --De.echoes != 0 || (De.echoes = De.awaits = De.id = 0), an.push(H), st(a, !0);
|
|
2069
|
+
}).bind(null, e) : zi), e !== H && (H = e, i === it && (it.env = Or()), Fn && (n = it.env.Promise, t = e.env, (i.global || e.global) && (Object.defineProperty(f, "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))));
|
|
2070
2070
|
}
|
|
2071
2071
|
function Or() {
|
|
2072
2072
|
var e = f.Promise;
|
|
2073
2073
|
return Fn ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(f, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
|
|
2074
2074
|
}
|
|
2075
2075
|
function gt(e, t, n, i, a) {
|
|
2076
|
-
var u =
|
|
2076
|
+
var u = H;
|
|
2077
2077
|
try {
|
|
2078
2078
|
return st(e, !0), t(n, i, a);
|
|
2079
2079
|
} finally {
|
|
@@ -2082,7 +2082,7 @@ function zo() {
|
|
|
2082
2082
|
}
|
|
2083
2083
|
function Ar(e, t, n, i) {
|
|
2084
2084
|
return typeof e != "function" ? e : function() {
|
|
2085
|
-
var a =
|
|
2085
|
+
var a = H;
|
|
2086
2086
|
n && St(), st(t, !0);
|
|
2087
2087
|
try {
|
|
2088
2088
|
return e.apply(this, arguments);
|
|
@@ -2095,7 +2095,7 @@ function zo() {
|
|
|
2095
2095
|
Promise === Ge && De.echoes === 0 ? sn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
2096
2096
|
}
|
|
2097
2097
|
("" + Le).indexOf("[native code]") === -1 && (St = at = l);
|
|
2098
|
-
var Te =
|
|
2098
|
+
var Te = W.reject, yt = "", Ze = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Dr = "String expected.", kt = [], ln = "__dbnames", Vn = "readonly", $n = "readwrite";
|
|
2099
2099
|
function vt(e, t) {
|
|
2100
2100
|
return e ? t ? function() {
|
|
2101
2101
|
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
@@ -2106,7 +2106,7 @@ function zo() {
|
|
|
2106
2106
|
return typeof e != "string" || /\./.test(e) ? function(t) {
|
|
2107
2107
|
return t;
|
|
2108
2108
|
} : function(t) {
|
|
2109
|
-
return t[e] === void 0 && e in t && delete (t =
|
|
2109
|
+
return t[e] === void 0 && e in t && delete (t = He(t))[e], t;
|
|
2110
2110
|
};
|
|
2111
2111
|
}
|
|
2112
2112
|
function kr() {
|
|
@@ -2157,17 +2157,17 @@ function zo() {
|
|
|
2157
2157
|
})) : n;
|
|
2158
2158
|
}
|
|
2159
2159
|
var Pr = (pe.prototype._trans = function(e, t, n) {
|
|
2160
|
-
var i = this._tx ||
|
|
2160
|
+
var i = this._tx || H.trans, a = this.name, u = Ce && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
|
|
2161
2161
|
function h(_, T, y) {
|
|
2162
2162
|
if (!y.schema[a]) throw new Q.NotFound("Table " + a + " not part of transaction");
|
|
2163
2163
|
return t(y.idbtrans, y);
|
|
2164
2164
|
}
|
|
2165
2165
|
var p = At();
|
|
2166
2166
|
try {
|
|
2167
|
-
var b = i && i.db._novip === this.db._novip ? i ===
|
|
2167
|
+
var b = i && i.db._novip === this.db._novip ? i === H.trans ? i._promise(e, h, n) : ot(function() {
|
|
2168
2168
|
return i._promise(e, h, n);
|
|
2169
|
-
}, { trans: i, transless:
|
|
2170
|
-
if (T.idbdb && (T._state.openComplete ||
|
|
2169
|
+
}, { trans: i, transless: H.transless || H }) : (function _(T, y, O, w) {
|
|
2170
|
+
if (T.idbdb && (T._state.openComplete || H.letThrough || T._vip)) {
|
|
2171
2171
|
var x = T._createTransaction(y, O, T._dbSchema);
|
|
2172
2172
|
try {
|
|
2173
2173
|
x.create(), T._state.PR1398_maxLoop = 3;
|
|
@@ -2178,7 +2178,7 @@ function zo() {
|
|
|
2178
2178
|
}
|
|
2179
2179
|
return x._promise(y, function(C, N) {
|
|
2180
2180
|
return ot(function() {
|
|
2181
|
-
return
|
|
2181
|
+
return H.trans = x, w(C, N, x);
|
|
2182
2182
|
});
|
|
2183
2183
|
}).then(function(C) {
|
|
2184
2184
|
if (y === "readwrite") try {
|
|
@@ -2284,7 +2284,7 @@ function zo() {
|
|
|
2284
2284
|
}, enumerable: !1, configurable: !0 }), a.prototype.table = function() {
|
|
2285
2285
|
return i;
|
|
2286
2286
|
}, e = a);
|
|
2287
|
-
for (var u = /* @__PURE__ */ new Set(), h = e.prototype; h; h =
|
|
2287
|
+
for (var u = /* @__PURE__ */ new Set(), h = e.prototype; h; h = R(h)) Object.getOwnPropertyNames(h).forEach(function(b) {
|
|
2288
2288
|
return u.add(b);
|
|
2289
2289
|
});
|
|
2290
2290
|
function p(b) {
|
|
@@ -2306,7 +2306,7 @@ function zo() {
|
|
|
2306
2306
|
return u && a && (h = fn(u)(e)), this._trans("readwrite", function(p) {
|
|
2307
2307
|
return n.core.mutate({ trans: p, type: "add", keys: t != null ? [t] : null, values: [h] });
|
|
2308
2308
|
}).then(function(p) {
|
|
2309
|
-
return p.numFailures ?
|
|
2309
|
+
return p.numFailures ? W.reject(p.failures[0]) : p.lastResult;
|
|
2310
2310
|
}).then(function(p) {
|
|
2311
2311
|
if (u) try {
|
|
2312
2312
|
de(e, u, p);
|
|
@@ -2321,7 +2321,7 @@ function zo() {
|
|
|
2321
2321
|
return u && a && (h = fn(u)(e)), this._trans("readwrite", function(p) {
|
|
2322
2322
|
return n.core.mutate({ trans: p, type: "put", values: [h], keys: t != null ? [t] : null });
|
|
2323
2323
|
}).then(function(p) {
|
|
2324
|
-
return p.numFailures ?
|
|
2324
|
+
return p.numFailures ? W.reject(p.failures[0]) : p.lastResult;
|
|
2325
2325
|
}).then(function(p) {
|
|
2326
2326
|
if (u) try {
|
|
2327
2327
|
de(e, u, p);
|
|
@@ -2335,7 +2335,7 @@ function zo() {
|
|
|
2335
2335
|
return t.core.mutate({ trans: n, type: "delete", keys: [e] }).then(function(i) {
|
|
2336
2336
|
return dn(t, [e], i);
|
|
2337
2337
|
}).then(function(i) {
|
|
2338
|
-
return i.numFailures ?
|
|
2338
|
+
return i.numFailures ? W.reject(i.failures[0]) : void 0;
|
|
2339
2339
|
});
|
|
2340
2340
|
});
|
|
2341
2341
|
}, pe.prototype.clear = function() {
|
|
@@ -2345,7 +2345,7 @@ function zo() {
|
|
|
2345
2345
|
return dn(e, null, n);
|
|
2346
2346
|
});
|
|
2347
2347
|
}).then(function(t) {
|
|
2348
|
-
return t.numFailures ?
|
|
2348
|
+
return t.numFailures ? W.reject(t.failures[0]) : void 0;
|
|
2349
2349
|
});
|
|
2350
2350
|
}, pe.prototype.bulkGet = function(e) {
|
|
2351
2351
|
var t = this;
|
|
@@ -2472,7 +2472,7 @@ function zo() {
|
|
|
2472
2472
|
}
|
|
2473
2473
|
}
|
|
2474
2474
|
function Ut(e, t) {
|
|
2475
|
-
return
|
|
2475
|
+
return j(t).from({ prototype: e }), t;
|
|
2476
2476
|
}
|
|
2477
2477
|
function Rt(e, t) {
|
|
2478
2478
|
return !(e.filter || e.algorithm || e.or) && (t ? e.justLimit : !e.replayFilter);
|
|
@@ -2480,7 +2480,7 @@ function zo() {
|
|
|
2480
2480
|
function Gn(e, t) {
|
|
2481
2481
|
e.filter = vt(e.filter, t);
|
|
2482
2482
|
}
|
|
2483
|
-
function
|
|
2483
|
+
function Wn(e, t, n) {
|
|
2484
2484
|
var i = e.replayFilter;
|
|
2485
2485
|
e.replayFilter = i ? function() {
|
|
2486
2486
|
return vt(i(), t());
|
|
@@ -2505,7 +2505,7 @@ function zo() {
|
|
|
2505
2505
|
return b.stop(O);
|
|
2506
2506
|
}, function(O) {
|
|
2507
2507
|
return b.fail(O);
|
|
2508
|
-
}) || ((y = "" + (T = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(T)),
|
|
2508
|
+
}) || ((y = "" + (T = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(T)), B(u, y) || (u[y] = !0, t(p, b, _)));
|
|
2509
2509
|
};
|
|
2510
2510
|
return Promise.all([e.or._iterate(h, n), Br(Fr(e, i, n), e.algorithm, h, !e.keysOnly && e.valueMapper)]);
|
|
2511
2511
|
}
|
|
@@ -2563,7 +2563,7 @@ function zo() {
|
|
|
2563
2563
|
function jr(e) {
|
|
2564
2564
|
this["@@propmod"] = e;
|
|
2565
2565
|
}
|
|
2566
|
-
var
|
|
2566
|
+
var Hi = (ue.prototype._read = function(e, t) {
|
|
2567
2567
|
var n = this._ctx;
|
|
2568
2568
|
return n.error ? n.table._trans(null, Te.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
|
|
2569
2569
|
}, ue.prototype._write = function(e) {
|
|
@@ -2629,21 +2629,21 @@ function zo() {
|
|
|
2629
2629
|
}, e);
|
|
2630
2630
|
}, ue.prototype.offset = function(e) {
|
|
2631
2631
|
var t = this._ctx;
|
|
2632
|
-
return e <= 0 || (t.offset += e, Rt(t) ?
|
|
2632
|
+
return e <= 0 || (t.offset += e, Rt(t) ? Wn(t, function() {
|
|
2633
2633
|
var n = e;
|
|
2634
2634
|
return function(i, a) {
|
|
2635
2635
|
return n === 0 || (n === 1 ? --n : a(function() {
|
|
2636
2636
|
i.advance(n), n = 0;
|
|
2637
2637
|
}), !1);
|
|
2638
2638
|
};
|
|
2639
|
-
}) :
|
|
2639
|
+
}) : Wn(t, function() {
|
|
2640
2640
|
var n = e;
|
|
2641
2641
|
return function() {
|
|
2642
2642
|
return --n < 0;
|
|
2643
2643
|
};
|
|
2644
2644
|
})), this;
|
|
2645
2645
|
}, ue.prototype.limit = function(e) {
|
|
2646
|
-
return this._ctx.limit = Math.min(this._ctx.limit, e),
|
|
2646
|
+
return this._ctx.limit = Math.min(this._ctx.limit, e), Wn(this._ctx, function() {
|
|
2647
2647
|
var t = e;
|
|
2648
2648
|
return function(n, i, a) {
|
|
2649
2649
|
return --t <= 0 && i(a), 0 <= t;
|
|
@@ -2721,7 +2721,7 @@ function zo() {
|
|
|
2721
2721
|
if (!e || !e.multi) return this;
|
|
2722
2722
|
var t = {};
|
|
2723
2723
|
return Gn(this._ctx, function(a) {
|
|
2724
|
-
var i = a.primaryKey.toString(), a =
|
|
2724
|
+
var i = a.primaryKey.toString(), a = B(t, i);
|
|
2725
2725
|
return t[i] = !0, !a;
|
|
2726
2726
|
}), this;
|
|
2727
2727
|
}, ue.prototype.modify = function(e) {
|
|
@@ -2730,8 +2730,8 @@ function zo() {
|
|
|
2730
2730
|
var a, u, h;
|
|
2731
2731
|
h = typeof e == "function" ? e : (a = v(e), u = a.length, function(A) {
|
|
2732
2732
|
for (var k = !1, P = 0; P < u; ++P) {
|
|
2733
|
-
var F = a[P],
|
|
2734
|
-
|
|
2733
|
+
var F = a[P], q = e[F], V = he(A, F);
|
|
2734
|
+
q instanceof Vt ? (de(A, F, q.execute(V)), k = !0) : V !== q && (de(A, F, q), k = !0);
|
|
2735
2735
|
}
|
|
2736
2736
|
return k;
|
|
2737
2737
|
});
|
|
@@ -2740,36 +2740,36 @@ function zo() {
|
|
|
2740
2740
|
function O(A, F) {
|
|
2741
2741
|
var P = F.failures, F = F.numFailures;
|
|
2742
2742
|
x += A - F;
|
|
2743
|
-
for (var
|
|
2744
|
-
var L = V[
|
|
2743
|
+
for (var q = 0, V = v(P); q < V.length; q++) {
|
|
2744
|
+
var L = V[q];
|
|
2745
2745
|
w.push(P[L]);
|
|
2746
2746
|
}
|
|
2747
2747
|
}
|
|
2748
2748
|
var w = [], x = 0, C = [], N = e === Mr;
|
|
2749
2749
|
return t.clone().primaryKeys().then(function(A) {
|
|
2750
2750
|
function k(F) {
|
|
2751
|
-
var
|
|
2751
|
+
var q = Math.min(T, A.length - F), V = A.slice(F, F + q);
|
|
2752
2752
|
return (N ? Promise.resolve([]) : p.getMany({ trans: i, keys: V, cache: "immutable" })).then(function(L) {
|
|
2753
|
-
var U = [], G = [], $ = b ? [] : null,
|
|
2754
|
-
if (!N) for (var re = 0; re <
|
|
2755
|
-
var se = L[re], te = { value:
|
|
2756
|
-
h.call(te, te.value, te) !== !1 && (te.value == null ?
|
|
2753
|
+
var U = [], G = [], $ = b ? [] : null, X = N ? V : [];
|
|
2754
|
+
if (!N) for (var re = 0; re < q; ++re) {
|
|
2755
|
+
var se = L[re], te = { value: He(se), primKey: A[F + re] };
|
|
2756
|
+
h.call(te, te.value, te) !== !1 && (te.value == null ? X.push(A[F + re]) : b || ae(_(se), _(te.value)) === 0 ? (G.push(te.value), b && $.push(A[F + re])) : (X.push(A[F + re]), U.push(te.value)));
|
|
2757
2757
|
}
|
|
2758
2758
|
return Promise.resolve(0 < U.length && p.mutate({ trans: i, type: "add", values: U }).then(function(Ee) {
|
|
2759
|
-
for (var ee in Ee.failures)
|
|
2759
|
+
for (var ee in Ee.failures) X.splice(parseInt(ee), 1);
|
|
2760
2760
|
O(U.length, Ee);
|
|
2761
2761
|
})).then(function() {
|
|
2762
2762
|
return (0 < G.length || P && typeof e == "object") && p.mutate({ trans: i, type: "put", keys: $, values: G, criteria: P, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < F }).then(function(Ee) {
|
|
2763
2763
|
return O(G.length, Ee);
|
|
2764
2764
|
});
|
|
2765
2765
|
}).then(function() {
|
|
2766
|
-
return (0 <
|
|
2767
|
-
return dn(n.table,
|
|
2766
|
+
return (0 < X.length || P && N) && p.mutate({ trans: i, type: "delete", keys: X, criteria: P, isAdditionalChunk: 0 < F }).then(function(Ee) {
|
|
2767
|
+
return dn(n.table, X, Ee);
|
|
2768
2768
|
}).then(function(Ee) {
|
|
2769
|
-
return O(
|
|
2769
|
+
return O(X.length, Ee);
|
|
2770
2770
|
});
|
|
2771
2771
|
}).then(function() {
|
|
2772
|
-
return A.length > F +
|
|
2772
|
+
return A.length > F + q && k(F + T);
|
|
2773
2773
|
});
|
|
2774
2774
|
});
|
|
2775
2775
|
}
|
|
@@ -2852,15 +2852,15 @@ function zo() {
|
|
|
2852
2852
|
var k = u(A);
|
|
2853
2853
|
if (t(k, b, w)) return !0;
|
|
2854
2854
|
for (var P = null, F = w; F < y; ++F) {
|
|
2855
|
-
var
|
|
2855
|
+
var q = (function(V, L, U, G, $, X) {
|
|
2856
2856
|
for (var re = Math.min(V.length, G.length), se = -1, te = 0; te < re; ++te) {
|
|
2857
2857
|
var Ee = L[te];
|
|
2858
2858
|
if (Ee !== G[te]) return $(V[te], U[te]) < 0 ? V.substr(0, te) + U[te] + U.substr(te + 1) : $(V[te], G[te]) < 0 ? V.substr(0, te) + G[te] + U.substr(te + 1) : 0 <= se ? V.substr(0, se) + L[se] + U.substr(se + 1) : null;
|
|
2859
2859
|
$(V[te], Ee) < 0 && (se = te);
|
|
2860
2860
|
}
|
|
2861
|
-
return re < G.length &&
|
|
2861
|
+
return re < G.length && X === "next" ? V + U.substr(V.length) : re < V.length && X === "prev" ? V.substr(0, U.length) : se < 0 ? null : V.substr(0, se) + G[se] + U.substr(se + 1);
|
|
2862
2862
|
})(A, k, p[F], b[F], h, _);
|
|
2863
|
-
|
|
2863
|
+
q === null && P === null ? w = F + 1 : (P === null || 0 < h(P, q)) && (P = q);
|
|
2864
2864
|
}
|
|
2865
2865
|
return C(P !== null ? function() {
|
|
2866
2866
|
x.continue(P + T);
|
|
@@ -2973,14 +2973,14 @@ function zo() {
|
|
|
2973
2973
|
}
|
|
2974
2974
|
try {
|
|
2975
2975
|
(T = A.reduce(function(k, P) {
|
|
2976
|
-
for (var F = 0,
|
|
2976
|
+
for (var F = 0, q = k.length; F < q; ++F) {
|
|
2977
2977
|
var V = k[F];
|
|
2978
2978
|
if (i(P[0], V[1]) < 0 && 0 < i(P[1], V[0])) {
|
|
2979
2979
|
V[0] = h(V[0], P[0]), V[1] = p(V[1], P[1]);
|
|
2980
2980
|
break;
|
|
2981
2981
|
}
|
|
2982
2982
|
}
|
|
2983
|
-
return F ===
|
|
2983
|
+
return F === q && k.push(P), k;
|
|
2984
2984
|
}, [])).sort(O);
|
|
2985
2985
|
} catch {
|
|
2986
2986
|
return qe(this, Ze);
|
|
@@ -2999,8 +2999,8 @@ function zo() {
|
|
|
2999
2999
|
return A._ondirectionchange = function(k) {
|
|
3000
3000
|
y = k === "next" ? (N = x, a) : (N = C, u), T.sort(O);
|
|
3001
3001
|
}, A._addAlgorithm(function(k, P, F) {
|
|
3002
|
-
for (var
|
|
3003
|
-
return !x(
|
|
3002
|
+
for (var q, V = k.key; N(V); ) if (++w === T.length) return P(F), !1;
|
|
3003
|
+
return !x(q = V) && !C(q) || (n._cmp(V, T[w][1]) === 0 || n._cmp(V, T[w][0]) === 0 || P(function() {
|
|
3004
3004
|
y === a ? k.continue(T[w][0]) : k.continue(T[w][1]);
|
|
3005
3005
|
}), !1);
|
|
3006
3006
|
}), A;
|
|
@@ -3014,7 +3014,7 @@ function zo() {
|
|
|
3014
3014
|
}, Se);
|
|
3015
3015
|
function Se() {
|
|
3016
3016
|
}
|
|
3017
|
-
function
|
|
3017
|
+
function We(e) {
|
|
3018
3018
|
return ge(function(t) {
|
|
3019
3019
|
return $t(t), e(t.target.error), !1;
|
|
3020
3020
|
});
|
|
@@ -3022,10 +3022,10 @@ function zo() {
|
|
|
3022
3022
|
function $t(e) {
|
|
3023
3023
|
e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
|
|
3024
3024
|
}
|
|
3025
|
-
var Gt = "storagemutated",
|
|
3026
|
-
return Z(!
|
|
3027
|
-
},
|
|
3028
|
-
if (Z(!
|
|
3025
|
+
var Gt = "storagemutated", Xn = "x-storagemutated-1", ut = Lt(null, Gt), Ji = (Xe.prototype._lock = function() {
|
|
3026
|
+
return Z(!H.global), ++this._reculock, this._reculock !== 1 || H.global || (H.lockOwnerFor = this), this;
|
|
3027
|
+
}, Xe.prototype._unlock = function() {
|
|
3028
|
+
if (Z(!H.global), --this._reculock == 0) for (H.global || (H.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) {
|
|
3029
3029
|
var e = this._blockedFuncs.shift();
|
|
3030
3030
|
try {
|
|
3031
3031
|
gt(e[1], e[0]);
|
|
@@ -3033,9 +3033,9 @@ function zo() {
|
|
|
3033
3033
|
}
|
|
3034
3034
|
}
|
|
3035
3035
|
return this;
|
|
3036
|
-
},
|
|
3037
|
-
return this._reculock &&
|
|
3038
|
-
},
|
|
3036
|
+
}, Xe.prototype._locked = function() {
|
|
3037
|
+
return this._reculock && H.lockOwnerFor !== this;
|
|
3038
|
+
}, Xe.prototype.create = function(e) {
|
|
3039
3039
|
var t = this;
|
|
3040
3040
|
if (!this.mode) return this;
|
|
3041
3041
|
var n = this.db.idbdb, i = this.db._state.dbOpenError;
|
|
@@ -3055,17 +3055,17 @@ function zo() {
|
|
|
3055
3055
|
}), e.oncomplete = ge(function() {
|
|
3056
3056
|
t.active = !1, t._resolve(), "mutatedParts" in e && ut.storagemutated.fire(e.mutatedParts);
|
|
3057
3057
|
}), this;
|
|
3058
|
-
},
|
|
3058
|
+
}, Xe.prototype._promise = function(e, t, n) {
|
|
3059
3059
|
var i = this;
|
|
3060
3060
|
if (e === "readwrite" && this.mode !== "readwrite") return Te(new Q.ReadOnly("Transaction is readonly"));
|
|
3061
3061
|
if (!this.active) return Te(new Q.TransactionInactive());
|
|
3062
|
-
if (this._locked()) return new
|
|
3062
|
+
if (this._locked()) return new W(function(u, h) {
|
|
3063
3063
|
i._blockedFuncs.push([function() {
|
|
3064
3064
|
i._promise(e, t, n).then(u, h);
|
|
3065
|
-
},
|
|
3065
|
+
}, H]);
|
|
3066
3066
|
});
|
|
3067
3067
|
if (n) return ot(function() {
|
|
3068
|
-
var u = new
|
|
3068
|
+
var u = new W(function(h, p) {
|
|
3069
3069
|
i._lock();
|
|
3070
3070
|
var b = t(h, p, i);
|
|
3071
3071
|
b && b.then && b.then(h, p);
|
|
@@ -3074,15 +3074,15 @@ function zo() {
|
|
|
3074
3074
|
return i._unlock();
|
|
3075
3075
|
}), u._lib = !0, u;
|
|
3076
3076
|
});
|
|
3077
|
-
var a = new
|
|
3077
|
+
var a = new W(function(u, h) {
|
|
3078
3078
|
var p = t(u, h, i);
|
|
3079
3079
|
p && p.then && p.then(u, h);
|
|
3080
3080
|
});
|
|
3081
3081
|
return a._lib = !0, a;
|
|
3082
|
-
},
|
|
3082
|
+
}, Xe.prototype._root = function() {
|
|
3083
3083
|
return this.parent ? this.parent._root() : this;
|
|
3084
|
-
},
|
|
3085
|
-
var t, n = this._root(), i =
|
|
3084
|
+
}, Xe.prototype.waitFor = function(e) {
|
|
3085
|
+
var t, n = this._root(), i = W.resolve(e);
|
|
3086
3086
|
n._waitingFor ? n._waitingFor = n._waitingFor.then(function() {
|
|
3087
3087
|
return i;
|
|
3088
3088
|
}) : (n._waitingFor = i, n._waitingQueue = [], t = n.idbtrans.objectStore(n.storeNames[0]), (function u() {
|
|
@@ -3090,7 +3090,7 @@ function zo() {
|
|
|
3090
3090
|
n._waitingFor && (t.get(-1 / 0).onsuccess = u);
|
|
3091
3091
|
})());
|
|
3092
3092
|
var a = n._waitingFor;
|
|
3093
|
-
return new
|
|
3093
|
+
return new W(function(u, h) {
|
|
3094
3094
|
i.then(function(p) {
|
|
3095
3095
|
return n._waitingQueue.push(ge(u.bind(null, p)));
|
|
3096
3096
|
}, function(p) {
|
|
@@ -3099,24 +3099,24 @@ function zo() {
|
|
|
3099
3099
|
n._waitingFor === a && (n._waitingFor = null);
|
|
3100
3100
|
});
|
|
3101
3101
|
});
|
|
3102
|
-
},
|
|
3102
|
+
}, Xe.prototype.abort = function() {
|
|
3103
3103
|
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new Q.Abort()));
|
|
3104
|
-
},
|
|
3104
|
+
}, Xe.prototype.table = function(e) {
|
|
3105
3105
|
var t = this._memoizedTables || (this._memoizedTables = {});
|
|
3106
|
-
if (
|
|
3106
|
+
if (B(t, e)) return t[e];
|
|
3107
3107
|
var n = this.schema[e];
|
|
3108
3108
|
if (!n) throw new Q.NotFound("Table " + e + " not part of transaction");
|
|
3109
3109
|
return n = new this.db.Table(e, n, this), n.core = this.db.core.table(e), t[e] = n;
|
|
3110
|
-
},
|
|
3111
|
-
function
|
|
3110
|
+
}, Xe);
|
|
3111
|
+
function Xe() {
|
|
3112
3112
|
}
|
|
3113
|
-
function
|
|
3113
|
+
function Yn(e, t, n, i, a, u, h, p) {
|
|
3114
3114
|
return { name: e, keyPath: t, unique: n, multi: i, auto: a, compound: u, src: (n && !h ? "&" : "") + (i ? "*" : "") + (a ? "++" : "") + Lr(t), type: p };
|
|
3115
3115
|
}
|
|
3116
3116
|
function Lr(e) {
|
|
3117
3117
|
return typeof e == "string" ? e : e ? "[" + [].join.call(e, "+") + "]" : "";
|
|
3118
3118
|
}
|
|
3119
|
-
function
|
|
3119
|
+
function zn(e, t, n) {
|
|
3120
3120
|
return { name: e, primKey: t, indexes: n, mappedClass: null, idxByName: (i = function(a) {
|
|
3121
3121
|
return [a.name, a];
|
|
3122
3122
|
}, n.reduce(function(a, u, h) {
|
|
@@ -3124,18 +3124,18 @@ function zo() {
|
|
|
3124
3124
|
}, {})) };
|
|
3125
3125
|
var i;
|
|
3126
3126
|
}
|
|
3127
|
-
var
|
|
3127
|
+
var Wt = function(e) {
|
|
3128
3128
|
try {
|
|
3129
|
-
return e.only([[]]),
|
|
3129
|
+
return e.only([[]]), Wt = function() {
|
|
3130
3130
|
return [[]];
|
|
3131
3131
|
}, [[]];
|
|
3132
3132
|
} catch {
|
|
3133
|
-
return
|
|
3133
|
+
return Wt = function() {
|
|
3134
3134
|
return yt;
|
|
3135
3135
|
}, yt;
|
|
3136
3136
|
}
|
|
3137
3137
|
};
|
|
3138
|
-
function
|
|
3138
|
+
function Hn(e) {
|
|
3139
3139
|
return e == null ? function() {
|
|
3140
3140
|
} : typeof e == "string" ? (t = e).split(".").length === 1 ? function(n) {
|
|
3141
3141
|
return n[t];
|
|
@@ -3150,7 +3150,7 @@ function zo() {
|
|
|
3150
3150
|
return [].slice.call(e);
|
|
3151
3151
|
}
|
|
3152
3152
|
var eo = 0;
|
|
3153
|
-
function
|
|
3153
|
+
function Xt(e) {
|
|
3154
3154
|
return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
|
|
3155
3155
|
}
|
|
3156
3156
|
function to(e, t, b) {
|
|
@@ -3164,29 +3164,29 @@ function zo() {
|
|
|
3164
3164
|
var w, x = O.name;
|
|
3165
3165
|
return { name: x, schema: O, mutate: function(C) {
|
|
3166
3166
|
var N = C.trans, A = C.type, k = C.keys, P = C.values, F = C.range;
|
|
3167
|
-
return new Promise(function(
|
|
3168
|
-
|
|
3167
|
+
return new Promise(function(q, V) {
|
|
3168
|
+
q = ge(q);
|
|
3169
3169
|
var L = N.objectStore(x), U = L.keyPath == null, G = A === "put" || A === "add";
|
|
3170
3170
|
if (!G && A !== "delete" && A !== "deleteRange") throw new Error("Invalid operation type: " + A);
|
|
3171
|
-
var $,
|
|
3171
|
+
var $, X = (k || P || { length: 1 }).length;
|
|
3172
3172
|
if (k && P && k.length !== P.length) throw new Error("Given keys array must have same length as given values array.");
|
|
3173
|
-
if (
|
|
3173
|
+
if (X === 0) return q({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
3174
3174
|
function re(je) {
|
|
3175
3175
|
++Ee, $t(je);
|
|
3176
3176
|
}
|
|
3177
3177
|
var se = [], te = [], Ee = 0;
|
|
3178
3178
|
if (A === "deleteRange") {
|
|
3179
|
-
if (F.type === 4) return
|
|
3179
|
+
if (F.type === 4) return q({ numFailures: Ee, failures: te, results: [], lastResult: void 0 });
|
|
3180
3180
|
F.type === 3 ? se.push($ = L.clear()) : se.push($ = L.delete(i(F)));
|
|
3181
3181
|
} else {
|
|
3182
3182
|
var U = G ? U ? [P, k] : [P, null] : [k, null], ee = U[0], Pe = U[1];
|
|
3183
|
-
if (G) for (var Fe = 0; Fe <
|
|
3184
|
-
else for (Fe = 0; Fe <
|
|
3183
|
+
if (G) for (var Fe = 0; Fe < X; ++Fe) se.push($ = Pe && Pe[Fe] !== void 0 ? L[A](ee[Fe], Pe[Fe]) : L[A](ee[Fe])), $.onerror = re;
|
|
3184
|
+
else for (Fe = 0; Fe < X; ++Fe) se.push($ = L[A](ee[Fe])), $.onerror = re;
|
|
3185
3185
|
}
|
|
3186
3186
|
function On(je) {
|
|
3187
3187
|
je = je.target.result, se.forEach(function(_t, mr) {
|
|
3188
3188
|
return _t.error != null && (te[mr] = _t.error);
|
|
3189
|
-
}),
|
|
3189
|
+
}), q({ numFailures: Ee, failures: te, results: A === "delete" ? k : se.map(function(_t) {
|
|
3190
3190
|
return _t.result;
|
|
3191
3191
|
}), lastResult: je });
|
|
3192
3192
|
}
|
|
@@ -3198,9 +3198,9 @@ function zo() {
|
|
|
3198
3198
|
var N = C.trans, A = C.keys;
|
|
3199
3199
|
return new Promise(function(k, P) {
|
|
3200
3200
|
k = ge(k);
|
|
3201
|
-
for (var F,
|
|
3201
|
+
for (var F, q = N.objectStore(x), V = A.length, L = new Array(V), U = 0, G = 0, $ = function(se) {
|
|
3202
3202
|
se = se.target, L[se._pos] = se.result, ++G === U && k(L);
|
|
3203
|
-
},
|
|
3203
|
+
}, X = We(P), re = 0; re < V; ++re) A[re] != null && ((F = q.get(A[re]))._pos = re, F.onsuccess = $, F.onerror = X, ++U);
|
|
3204
3204
|
U === 0 && k(L);
|
|
3205
3205
|
});
|
|
3206
3206
|
}, get: function(C) {
|
|
@@ -3208,28 +3208,28 @@ function zo() {
|
|
|
3208
3208
|
return new Promise(function(k, P) {
|
|
3209
3209
|
k = ge(k);
|
|
3210
3210
|
var F = N.objectStore(x).get(A);
|
|
3211
|
-
F.onsuccess = function(
|
|
3212
|
-
return k(
|
|
3213
|
-
}, F.onerror =
|
|
3211
|
+
F.onsuccess = function(q) {
|
|
3212
|
+
return k(q.target.result);
|
|
3213
|
+
}, F.onerror = We(P);
|
|
3214
3214
|
});
|
|
3215
3215
|
}, query: (w = _, function(C) {
|
|
3216
3216
|
return new Promise(function(N, A) {
|
|
3217
3217
|
N = ge(N);
|
|
3218
|
-
var k, P, F, U = C.trans,
|
|
3218
|
+
var k, P, F, U = C.trans, q = C.values, V = C.limit, $ = C.query, L = V === 1 / 0 ? void 0 : V, G = $.index, $ = $.range, U = U.objectStore(x), G = G.isPrimaryKey ? U : U.index(G.name), $ = i($);
|
|
3219
3219
|
if (V === 0) return N({ result: [] });
|
|
3220
|
-
w ? ((L =
|
|
3221
|
-
return N({ result:
|
|
3222
|
-
}, L.onerror =
|
|
3220
|
+
w ? ((L = q ? G.getAll($, L) : G.getAllKeys($, L)).onsuccess = function(X) {
|
|
3221
|
+
return N({ result: X.target.result });
|
|
3222
|
+
}, L.onerror = We(A)) : (k = 0, P = !q && "openKeyCursor" in G ? G.openKeyCursor($) : G.openCursor($), F = [], P.onsuccess = function(X) {
|
|
3223
3223
|
var re = P.result;
|
|
3224
|
-
return re ? (F.push(
|
|
3225
|
-
}, P.onerror =
|
|
3224
|
+
return re ? (F.push(q ? re.value : re.primaryKey), ++k === V ? N({ result: F }) : void re.continue()) : N({ result: F });
|
|
3225
|
+
}, P.onerror = We(A));
|
|
3226
3226
|
});
|
|
3227
3227
|
}), openCursor: function(C) {
|
|
3228
3228
|
var N = C.trans, A = C.values, k = C.query, P = C.reverse, F = C.unique;
|
|
3229
|
-
return new Promise(function(
|
|
3230
|
-
|
|
3229
|
+
return new Promise(function(q, V) {
|
|
3230
|
+
q = ge(q);
|
|
3231
3231
|
var G = k.index, L = k.range, U = N.objectStore(x), U = G.isPrimaryKey ? U : U.index(G.name), G = P ? F ? "prevunique" : "prev" : F ? "nextunique" : "next", $ = !A && "openKeyCursor" in U ? U.openKeyCursor(i(L), G) : U.openCursor(i(L), G);
|
|
3232
|
-
$.onerror =
|
|
3232
|
+
$.onerror = We(V), $.onsuccess = ge(function(X) {
|
|
3233
3233
|
var re, se, te, Ee, ee = $.result;
|
|
3234
3234
|
ee ? (ee.___id = ++eo, ee.done = !1, re = ee.continue.bind(ee), se = (se = ee.continuePrimaryKey) && se.bind(ee), te = ee.advance.bind(ee), Ee = function() {
|
|
3235
3235
|
throw new Error("Cursor not stopped");
|
|
@@ -3254,45 +3254,45 @@ function zo() {
|
|
|
3254
3254
|
}, ee.stop();
|
|
3255
3255
|
}
|
|
3256
3256
|
var On = new Promise(function(je, _t) {
|
|
3257
|
-
je = ge(je), $.onerror =
|
|
3257
|
+
je = ge(je), $.onerror = We(_t), ee.fail = _t, ee.stop = function(mr) {
|
|
3258
3258
|
ee.stop = ee.continue = ee.continuePrimaryKey = ee.advance = Ee, je(mr);
|
|
3259
3259
|
};
|
|
3260
3260
|
});
|
|
3261
3261
|
return $.onsuccess = ge(function(je) {
|
|
3262
3262
|
$.onsuccess = Fe, Fe();
|
|
3263
3263
|
}), ee.continue = re, ee.continuePrimaryKey = se, ee.advance = te, Fe(), On;
|
|
3264
|
-
},
|
|
3264
|
+
}, q(ee)) : q(null);
|
|
3265
3265
|
}, V);
|
|
3266
3266
|
});
|
|
3267
3267
|
}, count: function(C) {
|
|
3268
3268
|
var N = C.query, A = C.trans, k = N.index, P = N.range;
|
|
3269
|
-
return new Promise(function(F,
|
|
3269
|
+
return new Promise(function(F, q) {
|
|
3270
3270
|
var V = A.objectStore(x), L = k.isPrimaryKey ? V : V.index(k.name), V = i(P), L = V ? L.count(V) : L.count();
|
|
3271
3271
|
L.onsuccess = ge(function(U) {
|
|
3272
3272
|
return F(U.target.result);
|
|
3273
|
-
}), L.onerror =
|
|
3273
|
+
}), L.onerror = We(q);
|
|
3274
3274
|
});
|
|
3275
3275
|
} };
|
|
3276
3276
|
}
|
|
3277
3277
|
var u, h, p, T = (h = b, p = Ur((u = e).objectStoreNames), { schema: { name: u.name, tables: p.map(function(O) {
|
|
3278
3278
|
return h.objectStore(O);
|
|
3279
3279
|
}).map(function(O) {
|
|
3280
|
-
var w = O.keyPath, N = O.autoIncrement, x = g(w), C = {}, N = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: w == null, compound: x, keyPath: w, autoIncrement: N, unique: !0, extractKey:
|
|
3280
|
+
var w = O.keyPath, N = O.autoIncrement, x = g(w), C = {}, N = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: w == null, compound: x, keyPath: w, autoIncrement: N, unique: !0, extractKey: Hn(w) }, indexes: Ur(O.indexNames).map(function(A) {
|
|
3281
3281
|
return O.index(A);
|
|
3282
3282
|
}).map(function(F) {
|
|
3283
|
-
var k = F.name, P = F.unique,
|
|
3284
|
-
return C[
|
|
3283
|
+
var k = F.name, P = F.unique, q = F.multiEntry, F = F.keyPath, q = { name: k, compound: g(F), keyPath: F, unique: P, multiEntry: q, extractKey: Hn(F) };
|
|
3284
|
+
return C[Xt(F)] = q;
|
|
3285
3285
|
}), getIndexByKeyPath: function(A) {
|
|
3286
|
-
return C[
|
|
3286
|
+
return C[Xt(A)];
|
|
3287
3287
|
} };
|
|
3288
|
-
return C[":id"] = N.primaryKey, w != null && (C[
|
|
3288
|
+
return C[":id"] = N.primaryKey, w != null && (C[Xt(w)] = N.primaryKey), N;
|
|
3289
3289
|
}) }, 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) }), b = T.schema, _ = T.hasGetAll, T = b.tables.map(a), y = {};
|
|
3290
3290
|
return T.forEach(function(O) {
|
|
3291
3291
|
return y[O.name] = O;
|
|
3292
3292
|
}), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(O) {
|
|
3293
3293
|
if (!y[O]) throw new Error("Table '".concat(O, "' not found"));
|
|
3294
3294
|
return y[O];
|
|
3295
|
-
}, MIN_KEY: -1 / 0, MAX_KEY:
|
|
3295
|
+
}, MIN_KEY: -1 / 0, MAX_KEY: Wt(t), schema: b };
|
|
3296
3296
|
}
|
|
3297
3297
|
function no(e, t, n, i) {
|
|
3298
3298
|
var a = n.IDBKeyRange;
|
|
@@ -3314,7 +3314,7 @@ function zo() {
|
|
|
3314
3314
|
var u = i[a];
|
|
3315
3315
|
t.forEach(function(h) {
|
|
3316
3316
|
var p = (function b(_, T) {
|
|
3317
|
-
return
|
|
3317
|
+
return z(_, T) || (_ = R(_)) && b(_, T);
|
|
3318
3318
|
})(h, a);
|
|
3319
3319
|
(!p || "value" in p && p.value === void 0) && (h === e.Transaction.prototype || h instanceof e.Transaction ? M(h, a, { get: function() {
|
|
3320
3320
|
return this.table(a);
|
|
@@ -3334,14 +3334,14 @@ function zo() {
|
|
|
3334
3334
|
}
|
|
3335
3335
|
function io(e, t, n, i) {
|
|
3336
3336
|
var a = e._dbSchema;
|
|
3337
|
-
n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta =
|
|
3337
|
+
n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = zn("$meta", $r("")[0], []), e._storeNames.push("$meta"));
|
|
3338
3338
|
var u = e._createTransaction("readwrite", e._storeNames, a);
|
|
3339
3339
|
u.create(n), u._completion.catch(i);
|
|
3340
|
-
var h = u._reject.bind(u), p =
|
|
3340
|
+
var h = u._reject.bind(u), p = H.transless || H;
|
|
3341
3341
|
ot(function() {
|
|
3342
|
-
return
|
|
3342
|
+
return H.trans = u, H.transless = p, t !== 0 ? (gn(e, n), _ = t, ((b = u).storeNames.includes("$meta") ? b.table("$meta").get("version").then(function(T) {
|
|
3343
3343
|
return T ?? _;
|
|
3344
|
-
}) :
|
|
3344
|
+
}) : W.resolve(_)).then(function(T) {
|
|
3345
3345
|
return O = T, w = u, x = n, C = [], T = (y = e)._versions, N = y._dbSchema = bn(0, y.idbdb, x), (T = T.filter(function(A) {
|
|
3346
3346
|
return A._cfg.version >= O;
|
|
3347
3347
|
})).length !== 0 ? (T.forEach(function(A) {
|
|
@@ -3354,32 +3354,32 @@ function zo() {
|
|
|
3354
3354
|
}), F.change.forEach(function(G) {
|
|
3355
3355
|
if (G.recreate) throw new Q.Upgrade("Not yet support for changing primary key");
|
|
3356
3356
|
var $ = x.objectStore(G.name);
|
|
3357
|
-
G.add.forEach(function(
|
|
3358
|
-
return vn($,
|
|
3359
|
-
}), G.change.forEach(function(
|
|
3360
|
-
$.deleteIndex(
|
|
3361
|
-
}), G.del.forEach(function(
|
|
3362
|
-
return $.deleteIndex(
|
|
3357
|
+
G.add.forEach(function(X) {
|
|
3358
|
+
return vn($, X);
|
|
3359
|
+
}), G.change.forEach(function(X) {
|
|
3360
|
+
$.deleteIndex(X.name), vn($, X);
|
|
3361
|
+
}), G.del.forEach(function(X) {
|
|
3362
|
+
return $.deleteIndex(X);
|
|
3363
3363
|
});
|
|
3364
3364
|
});
|
|
3365
|
-
var
|
|
3366
|
-
if (
|
|
3365
|
+
var q = A._cfg.contentUpgrade;
|
|
3366
|
+
if (q && A._cfg.version > O) {
|
|
3367
3367
|
gn(y, x), w._memoizedTables = {};
|
|
3368
3368
|
var V = ve(P);
|
|
3369
3369
|
F.del.forEach(function(G) {
|
|
3370
3370
|
V[G] = k[G];
|
|
3371
3371
|
}), Qn(y, [y.Transaction.prototype]), yn(y, [y.Transaction.prototype], v(V), V), w.schema = V;
|
|
3372
|
-
var L, U = Tt(
|
|
3373
|
-
return U && St(), F =
|
|
3372
|
+
var L, U = Tt(q);
|
|
3373
|
+
return U && St(), F = W.follow(function() {
|
|
3374
3374
|
var G;
|
|
3375
|
-
(L =
|
|
3376
|
-
}), L && typeof L.then == "function" ?
|
|
3375
|
+
(L = q(w)) && U && (G = at.bind(null, null), L.then(G, G));
|
|
3376
|
+
}), L && typeof L.then == "function" ? W.resolve(L) : F.then(function() {
|
|
3377
3377
|
return L;
|
|
3378
3378
|
});
|
|
3379
3379
|
}
|
|
3380
3380
|
}), C.push(function(k) {
|
|
3381
|
-
var P, F,
|
|
3382
|
-
P =
|
|
3381
|
+
var P, F, q = A._cfg.dbschema;
|
|
3382
|
+
P = q, F = k, [].slice.call(F.db.objectStoreNames).forEach(function(V) {
|
|
3383
3383
|
return P[V] == null && F.db.deleteObjectStore(V);
|
|
3384
3384
|
}), Qn(y, [y.Transaction.prototype]), yn(y, [y.Transaction.prototype], y._storeNames, y._dbSchema), w.schema = y._dbSchema;
|
|
3385
3385
|
}), C.push(function(k) {
|
|
@@ -3388,14 +3388,14 @@ function zo() {
|
|
|
3388
3388
|
})) : k.objectStore("$meta").put(A._cfg.version, "version"));
|
|
3389
3389
|
});
|
|
3390
3390
|
}), (function A() {
|
|
3391
|
-
return C.length ?
|
|
3391
|
+
return C.length ? W.resolve(C.shift()(w.idbtrans)).then(A) : W.resolve();
|
|
3392
3392
|
})().then(function() {
|
|
3393
3393
|
Vr(N, x);
|
|
3394
|
-
})) :
|
|
3394
|
+
})) : W.resolve();
|
|
3395
3395
|
var y, O, w, x, C, N;
|
|
3396
3396
|
}).catch(h)) : (v(a).forEach(function(T) {
|
|
3397
3397
|
Jn(n, T, a[T].primKey, a[T].indexes);
|
|
3398
|
-
}), gn(e, n), void
|
|
3398
|
+
}), gn(e, n), void W.follow(function() {
|
|
3399
3399
|
return e.on.populate.fire(u);
|
|
3400
3400
|
}).catch(h));
|
|
3401
3401
|
var b, _;
|
|
@@ -3454,11 +3454,11 @@ function zo() {
|
|
|
3454
3454
|
function bn(e, t, n) {
|
|
3455
3455
|
var i = {};
|
|
3456
3456
|
return ye(t.objectStoreNames, 0).forEach(function(a) {
|
|
3457
|
-
for (var u = n.objectStore(a), h =
|
|
3458
|
-
var T = u.index(u.indexNames[b]), _ = T.keyPath, T =
|
|
3457
|
+
for (var u = n.objectStore(a), h = Yn(Lr(_ = u.keyPath), _ || "", !0, !1, !!u.autoIncrement, _ && typeof _ != "string", !0), p = [], b = 0; b < u.indexNames.length; ++b) {
|
|
3458
|
+
var T = u.index(u.indexNames[b]), _ = T.keyPath, T = Yn(T.name, _, !!T.unique, !!T.multiEntry, !1, _ && typeof _ != "string", !1);
|
|
3459
3459
|
p.push(T);
|
|
3460
3460
|
}
|
|
3461
|
-
i[a] =
|
|
3461
|
+
i[a] = zn(a, h, p);
|
|
3462
3462
|
}), i;
|
|
3463
3463
|
}
|
|
3464
3464
|
function wn(e, t, n) {
|
|
@@ -3475,10 +3475,10 @@ function zo() {
|
|
|
3475
3475
|
function $r(e) {
|
|
3476
3476
|
return e.split(",").map(function(t, n) {
|
|
3477
3477
|
var u = t.split(":"), i = (a = u[1]) === null || a === void 0 ? void 0 : a.trim(), a = (t = u[0].trim()).replace(/([&*]|\+\+)/g, ""), u = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
3478
|
-
return
|
|
3478
|
+
return Yn(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), g(u), n === 0, i);
|
|
3479
3479
|
});
|
|
3480
3480
|
}
|
|
3481
|
-
var ao = (Pt.prototype._createTableSchema =
|
|
3481
|
+
var ao = (Pt.prototype._createTableSchema = zn, Pt.prototype._parseIndexSyntax = $r, Pt.prototype._parseStoresSpec = function(e, t) {
|
|
3482
3482
|
var n = this;
|
|
3483
3483
|
v(e).forEach(function(i) {
|
|
3484
3484
|
if (e[i] !== null) {
|
|
@@ -3512,7 +3512,7 @@ function zo() {
|
|
|
3512
3512
|
}
|
|
3513
3513
|
function nr(e) {
|
|
3514
3514
|
return ot(function() {
|
|
3515
|
-
return
|
|
3515
|
+
return H.letThrough = !0, e();
|
|
3516
3516
|
});
|
|
3517
3517
|
}
|
|
3518
3518
|
function rr(e) {
|
|
@@ -3525,21 +3525,21 @@ function zo() {
|
|
|
3525
3525
|
}
|
|
3526
3526
|
D(this, arguments.length ? { d: 1, from: e, to: 1 < arguments.length ? t : e } : { d: 0 });
|
|
3527
3527
|
};
|
|
3528
|
-
function
|
|
3528
|
+
function Yt(e, t, n) {
|
|
3529
3529
|
var i = ae(t, n);
|
|
3530
3530
|
if (!isNaN(i)) {
|
|
3531
3531
|
if (0 < i) throw RangeError();
|
|
3532
3532
|
if (rr(e)) return D(e, { from: t, to: n, d: 1 });
|
|
3533
3533
|
var a = e.l, i = e.r;
|
|
3534
|
-
if (ae(n, e.from) < 0) return a ?
|
|
3535
|
-
if (0 < ae(t, e.to)) return i ?
|
|
3536
|
-
ae(t, e.from) < 0 && (e.from = t, e.l = null, e.d = i ? i.d + 1 : 1), 0 < ae(n, e.to) && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1), n = !e.r, a && !e.l &&
|
|
3534
|
+
if (ae(n, e.from) < 0) return a ? Yt(a, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null }, Wr(e);
|
|
3535
|
+
if (0 < ae(t, e.to)) return i ? Yt(i, t, n) : e.r = { from: t, to: n, d: 1, l: null, r: null }, Wr(e);
|
|
3536
|
+
ae(t, e.from) < 0 && (e.from = t, e.l = null, e.d = i ? i.d + 1 : 1), 0 < ae(n, e.to) && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1), n = !e.r, a && !e.l && zt(e, a), i && n && zt(e, i);
|
|
3537
3537
|
}
|
|
3538
3538
|
}
|
|
3539
|
-
function
|
|
3539
|
+
function zt(e, t) {
|
|
3540
3540
|
rr(t) || (function n(i, b) {
|
|
3541
3541
|
var u = b.from, h = b.to, p = b.l, b = b.r;
|
|
3542
|
-
|
|
3542
|
+
Yt(i, u, h), p && n(i, p), b && n(i, b);
|
|
3543
3543
|
})(e, t);
|
|
3544
3544
|
}
|
|
3545
3545
|
function Gr(e, t) {
|
|
@@ -3571,19 +3571,19 @@ function zo() {
|
|
|
3571
3571
|
return { done: !0 };
|
|
3572
3572
|
} };
|
|
3573
3573
|
}
|
|
3574
|
-
function
|
|
3574
|
+
function Wr(e) {
|
|
3575
3575
|
var t, n, i = (((t = e.r) === null || t === void 0 ? void 0 : t.d) || 0) - (((n = e.l) === null || n === void 0 ? void 0 : n.d) || 0), a = 1 < i ? "r" : i < -1 ? "l" : "";
|
|
3576
|
-
a && (t = a == "r" ? "l" : "r", n = o({}, e), i = e[a], e.from = i.from, e.to = i.to, e[a] = i[a], n[a] = i[t], (e[t] = n).d =
|
|
3576
|
+
a && (t = a == "r" ? "l" : "r", n = o({}, e), i = e[a], e.from = i.from, e.to = i.to, e[a] = i[a], n[a] = i[t], (e[t] = n).d = Xr(n)), e.d = Xr(e);
|
|
3577
3577
|
}
|
|
3578
|
-
function
|
|
3578
|
+
function Xr(n) {
|
|
3579
3579
|
var t = n.r, n = n.l;
|
|
3580
3580
|
return (t ? n ? Math.max(t.d, n.d) : t.d : n ? n.d : 0) + 1;
|
|
3581
3581
|
}
|
|
3582
3582
|
function En(e, t) {
|
|
3583
3583
|
return v(t).forEach(function(n) {
|
|
3584
|
-
e[n] ?
|
|
3584
|
+
e[n] ? zt(e[n], t[n]) : e[n] = (function i(a) {
|
|
3585
3585
|
var u, h, p = {};
|
|
3586
|
-
for (u in a)
|
|
3586
|
+
for (u in a) B(a, u) && (h = a[u], p[u] = !h || typeof h != "object" || Bt.has(h.constructor) ? h : i(h));
|
|
3587
3587
|
return p;
|
|
3588
3588
|
})(t[n]);
|
|
3589
3589
|
}), e;
|
|
@@ -3593,14 +3593,14 @@ function zo() {
|
|
|
3593
3593
|
return t[n] && Gr(t[n], e[n]);
|
|
3594
3594
|
});
|
|
3595
3595
|
}
|
|
3596
|
-
|
|
3597
|
-
return
|
|
3596
|
+
Y(Ie.prototype, ((Le = { add: function(e) {
|
|
3597
|
+
return zt(this, e), this;
|
|
3598
3598
|
}, addKey: function(e) {
|
|
3599
|
-
return
|
|
3599
|
+
return Yt(this, e, e), this;
|
|
3600
3600
|
}, addKeys: function(e) {
|
|
3601
3601
|
var t = this;
|
|
3602
3602
|
return e.forEach(function(n) {
|
|
3603
|
-
return
|
|
3603
|
+
return Yt(t, n, n);
|
|
3604
3604
|
}), this;
|
|
3605
3605
|
}, hasKey: function(e) {
|
|
3606
3606
|
var t = _n(this).next(e).value;
|
|
@@ -3617,16 +3617,16 @@ function zo() {
|
|
|
3617
3617
|
function sr(e, t) {
|
|
3618
3618
|
t === void 0 && (t = !1);
|
|
3619
3619
|
var n = /* @__PURE__ */ new Set();
|
|
3620
|
-
if (e.all) for (var i = 0, a = Object.values(bt); i < a.length; i++)
|
|
3620
|
+
if (e.all) for (var i = 0, a = Object.values(bt); i < a.length; i++) Yr(h = a[i], e, n, t);
|
|
3621
3621
|
else for (var u in e) {
|
|
3622
3622
|
var h, p = /^idb\:\/\/(.*)\/(.*)\//.exec(u);
|
|
3623
|
-
p && (u = p[1], p = p[2], (h = bt["idb://".concat(u, "/").concat(p)]) &&
|
|
3623
|
+
p && (u = p[1], p = p[2], (h = bt["idb://".concat(u, "/").concat(p)]) && Yr(h, e, n, t));
|
|
3624
3624
|
}
|
|
3625
3625
|
n.forEach(function(b) {
|
|
3626
3626
|
return b();
|
|
3627
3627
|
});
|
|
3628
3628
|
}
|
|
3629
|
-
function
|
|
3629
|
+
function Yr(e, t, n, i) {
|
|
3630
3630
|
for (var a = [], u = 0, h = Object.entries(e.queries.query); u < h.length; u++) {
|
|
3631
3631
|
for (var p = h[u], b = p[0], _ = [], T = 0, y = p[1]; T < y.length; T++) {
|
|
3632
3632
|
var O = y[T];
|
|
@@ -3652,32 +3652,32 @@ function zo() {
|
|
|
3652
3652
|
if (t.openCanceller !== i) throw new Q.DatabaseClosed("db.open() was cancelled");
|
|
3653
3653
|
}
|
|
3654
3654
|
function p() {
|
|
3655
|
-
return new
|
|
3655
|
+
return new W(function(O, w) {
|
|
3656
3656
|
if (h(), !n) throw new Q.MissingAPI();
|
|
3657
3657
|
var x = e.name, C = t.autoSchema || !a ? n.open(x) : n.open(x, a);
|
|
3658
3658
|
if (!C) throw new Q.MissingAPI();
|
|
3659
|
-
C.onerror =
|
|
3659
|
+
C.onerror = We(w), C.onblocked = ge(e._fireOnBlocked), C.onupgradeneeded = ge(function(N) {
|
|
3660
3660
|
var A;
|
|
3661
3661
|
T = C.transaction, t.autoSchema && !e._options.allowEmptyDB ? (C.onerror = $t, T.abort(), C.result.close(), (A = n.deleteDatabase(x)).onsuccess = A.onerror = ge(function() {
|
|
3662
3662
|
w(new Q.NoSuchDatabase("Database ".concat(x, " doesnt exist")));
|
|
3663
|
-
})) : (T.onerror =
|
|
3663
|
+
})) : (T.onerror = We(w), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, y = N < 1, e.idbdb = C.result, u && oo(e, T), io(e, N / 10, T, w));
|
|
3664
3664
|
}, w), C.onsuccess = ge(function() {
|
|
3665
3665
|
T = null;
|
|
3666
|
-
var N, A, k, P, F,
|
|
3666
|
+
var N, A, k, P, F, q = e.idbdb = C.result, V = ye(q.objectStoreNames);
|
|
3667
3667
|
if (0 < V.length) try {
|
|
3668
|
-
var L =
|
|
3669
|
-
if (t.autoSchema) A =
|
|
3668
|
+
var L = q.transaction((P = V).length === 1 ? P[0] : P, "readonly");
|
|
3669
|
+
if (t.autoSchema) A = q, k = L, (N = e).verno = A.version / 10, k = N._dbSchema = bn(0, A, k), N._storeNames = ye(A.objectStoreNames, 0), yn(N, [N._allTables], v(k), k);
|
|
3670
3670
|
else if (wn(e, e._dbSchema, L), ((F = Zn(bn(0, (F = e).idbdb, L), F._dbSchema)).add.length || F.change.some(function(U) {
|
|
3671
3671
|
return U.add.length || U.change.length;
|
|
3672
|
-
})) && !u) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),
|
|
3672
|
+
})) && !u) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), q.close(), a = q.version + 1, u = !0, O(p());
|
|
3673
3673
|
gn(e, L);
|
|
3674
3674
|
} catch {
|
|
3675
3675
|
}
|
|
3676
|
-
kt.push(e),
|
|
3676
|
+
kt.push(e), q.onversionchange = ge(function(U) {
|
|
3677
3677
|
t.vcFired = !0, e.on("versionchange").fire(U);
|
|
3678
|
-
}),
|
|
3678
|
+
}), q.onclose = ge(function(U) {
|
|
3679
3679
|
e.on("close").fire(U);
|
|
3680
|
-
}), y && (F = e._deps, L = x,
|
|
3680
|
+
}), y && (F = e._deps, L = x, q = F.indexedDB, F = F.IDBKeyRange, tr(q) || L === ln || er(q, F).put({ name: L }).catch(l)), O();
|
|
3681
3681
|
}, w);
|
|
3682
3682
|
}).catch(function(O) {
|
|
3683
3683
|
switch (O?.name) {
|
|
@@ -3687,11 +3687,11 @@ function zo() {
|
|
|
3687
3687
|
case "VersionError":
|
|
3688
3688
|
if (0 < a) return a = 0, p();
|
|
3689
3689
|
}
|
|
3690
|
-
return
|
|
3690
|
+
return W.reject(O);
|
|
3691
3691
|
});
|
|
3692
3692
|
}
|
|
3693
3693
|
var b, _ = t.dbReadyResolve, T = null, y = !1;
|
|
3694
|
-
return
|
|
3694
|
+
return W.race([i, (typeof navigator > "u" ? W.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(O) {
|
|
3695
3695
|
function w() {
|
|
3696
3696
|
return indexedDB.databases().finally(O);
|
|
3697
3697
|
}
|
|
@@ -3699,12 +3699,12 @@ function zo() {
|
|
|
3699
3699
|
}).finally(function() {
|
|
3700
3700
|
return clearInterval(b);
|
|
3701
3701
|
}) : Promise.resolve()).then(p)]).then(function() {
|
|
3702
|
-
return h(), t.onReadyBeingFired = [],
|
|
3702
|
+
return h(), t.onReadyBeingFired = [], W.resolve(nr(function() {
|
|
3703
3703
|
return e.on.ready.fire(e.vip);
|
|
3704
3704
|
})).then(function O() {
|
|
3705
3705
|
if (0 < t.onReadyBeingFired.length) {
|
|
3706
3706
|
var w = t.onReadyBeingFired.reduce(Ae, l);
|
|
3707
|
-
return t.onReadyBeingFired = [],
|
|
3707
|
+
return t.onReadyBeingFired = [], W.resolve(nr(function() {
|
|
3708
3708
|
return w(e.vip);
|
|
3709
3709
|
})).then(O);
|
|
3710
3710
|
}
|
|
@@ -3752,7 +3752,7 @@ function zo() {
|
|
|
3752
3752
|
return o(o({}, e), { table: function(t) {
|
|
3753
3753
|
var n = e.table(t), i = n.schema, a = {}, u = [];
|
|
3754
3754
|
function h(y, O, w) {
|
|
3755
|
-
var x =
|
|
3755
|
+
var x = Xt(y), C = a[x] = a[x] || [], N = y == null ? 0 : typeof y == "string" ? 1 : y.length, A = 0 < O, A = o(o({}, w), { name: A ? "".concat(x, "(virtual-from:").concat(w.name, ")") : w.name, lowLevelIndex: w, isVirtual: A, keyTail: O, keyLength: N, extractKey: Hn(y), unique: !A && w.unique });
|
|
3756
3756
|
return C.push(A), A.isPrimaryKey || u.push(A), 1 < N && h(N === 2 ? y[0] : y.slice(0, N - 1), O + 1, w), C.sort(function(k, P) {
|
|
3757
3757
|
return k.keyTail - P.keyTail;
|
|
3758
3758
|
}), A;
|
|
@@ -3767,7 +3767,7 @@ function zo() {
|
|
|
3767
3767
|
return w.isVirtual ? o(o({}, y), { query: { index: w.lowLevelIndex, range: (O = y.query.range, w = w.keyTail, { type: O.type === 1 ? 2 : O.type, lower: Tn(O.lower, O.lowerOpen ? e.MAX_KEY : e.MIN_KEY, w), lowerOpen: !0, upper: Tn(O.upper, O.upperOpen ? e.MIN_KEY : e.MAX_KEY, w), upperOpen: !0 }) } }) : y;
|
|
3768
3768
|
}
|
|
3769
3769
|
return o(o({}, n), { schema: o(o({}, i), { primaryKey: t, indexes: u, getIndexByKeyPath: function(y) {
|
|
3770
|
-
return (y = a[
|
|
3770
|
+
return (y = a[Xt(y)]) && y[0];
|
|
3771
3771
|
} }), count: function(y) {
|
|
3772
3772
|
return n.count(T(y));
|
|
3773
3773
|
}, query: function(y) {
|
|
@@ -3797,9 +3797,9 @@ function zo() {
|
|
|
3797
3797
|
function ur(e, t, n, i) {
|
|
3798
3798
|
return n = n || {}, i = i || "", v(e).forEach(function(a) {
|
|
3799
3799
|
var u, h, p;
|
|
3800
|
-
|
|
3800
|
+
B(t, a) ? (u = e[a], h = t[a], typeof u == "object" && typeof h == "object" && u && h ? (p = jt(u)) !== jt(h) ? n[i + a] = t[a] : p === "Object" ? ur(u, h, n, i + a + ".") : u !== h && (n[i + a] = t[a]) : u !== h && (n[i + a] = t[a])) : n[i + a] = void 0;
|
|
3801
3801
|
}), v(t).forEach(function(a) {
|
|
3802
|
-
|
|
3802
|
+
B(e, a) || (n[i + a] = t[a]);
|
|
3803
3803
|
}), n;
|
|
3804
3804
|
}
|
|
3805
3805
|
function lr(e, t) {
|
|
@@ -3809,7 +3809,7 @@ function zo() {
|
|
|
3809
3809
|
return o(o({}, e), { table: function(t) {
|
|
3810
3810
|
var n = e.table(t), i = n.schema.primaryKey;
|
|
3811
3811
|
return o(o({}, n), { mutate: function(a) {
|
|
3812
|
-
var u =
|
|
3812
|
+
var u = H.trans, h = u.table(t).hook, p = h.deleting, b = h.creating, _ = h.updating;
|
|
3813
3813
|
switch (a.type) {
|
|
3814
3814
|
case "add":
|
|
3815
3815
|
if (b.fire === l) break;
|
|
@@ -3841,21 +3841,21 @@ function zo() {
|
|
|
3841
3841
|
}
|
|
3842
3842
|
return n.mutate(a);
|
|
3843
3843
|
function T(y) {
|
|
3844
|
-
var O, w, x, C =
|
|
3844
|
+
var O, w, x, C = H.trans, N = y.keys || lr(i, y);
|
|
3845
3845
|
if (!N) throw new Error("Keys missing");
|
|
3846
3846
|
return (y = y.type === "add" || y.type === "put" ? o(o({}, y), { keys: N }) : o({}, y)).type !== "delete" && (y.values = d([], y.values)), y.keys && (y.keys = d([], y.keys)), O = n, x = N, ((w = y).type === "add" ? Promise.resolve([]) : O.getMany({ trans: w.trans, keys: x, cache: "immutable" })).then(function(A) {
|
|
3847
3847
|
var k = N.map(function(P, F) {
|
|
3848
|
-
var
|
|
3849
|
-
return y.type === "delete" ? p.fire.call(G, P, U, C) : y.type === "add" || U === void 0 ? (
|
|
3850
|
-
|
|
3848
|
+
var q, V, L, U = A[F], G = { onerror: null, onsuccess: null };
|
|
3849
|
+
return y.type === "delete" ? p.fire.call(G, P, U, C) : y.type === "add" || U === void 0 ? (q = b.fire.call(G, P, y.values[F], C), P == null && q != null && (y.keys[F] = P = q, i.outbound || de(y.values[F], i.keyPath, P))) : (q = ur(U, y.values[F]), (V = _.fire.call(G, q, P, U, C)) && (L = y.values[F], Object.keys(V).forEach(function($) {
|
|
3850
|
+
B(L, $) ? L[$] = V[$] : de(L, $, V[$]);
|
|
3851
3851
|
}))), G;
|
|
3852
3852
|
});
|
|
3853
3853
|
return n.mutate(y).then(function(P) {
|
|
3854
|
-
for (var F = P.failures,
|
|
3855
|
-
var U = (
|
|
3854
|
+
for (var F = P.failures, q = P.results, V = P.numFailures, P = P.lastResult, L = 0; L < N.length; ++L) {
|
|
3855
|
+
var U = (q || N)[L], G = k[L];
|
|
3856
3856
|
U == null ? G.onerror && G.onerror(F[L]) : G.onsuccess && G.onsuccess(y.type === "put" && A[L] ? y.values[L] : U);
|
|
3857
3857
|
}
|
|
3858
|
-
return { failures: F, results:
|
|
3858
|
+
return { failures: F, results: q, numFailures: V, lastResult: P };
|
|
3859
3859
|
}).catch(function(P) {
|
|
3860
3860
|
return k.forEach(function(F) {
|
|
3861
3861
|
return F.onerror && F.onerror(P);
|
|
@@ -3866,10 +3866,10 @@ function zo() {
|
|
|
3866
3866
|
} });
|
|
3867
3867
|
} });
|
|
3868
3868
|
} };
|
|
3869
|
-
function
|
|
3869
|
+
function zr(e, t, n) {
|
|
3870
3870
|
try {
|
|
3871
3871
|
if (!t || t.keys.length < e.length) return null;
|
|
3872
|
-
for (var i = [], a = 0, u = 0; a < t.keys.length && u < e.length; ++a) ae(t.keys[a], e[u]) === 0 && (i.push(n ?
|
|
3872
|
+
for (var i = [], a = 0, u = 0; a < t.keys.length && u < e.length; ++a) ae(t.keys[a], e[u]) === 0 && (i.push(n ? He(t.values[a]) : t.values[a]), ++u);
|
|
3873
3873
|
return i.length === e.length ? i : null;
|
|
3874
3874
|
} catch {
|
|
3875
3875
|
return null;
|
|
@@ -3880,16 +3880,16 @@ function zo() {
|
|
|
3880
3880
|
var n = e.table(t);
|
|
3881
3881
|
return o(o({}, n), { getMany: function(i) {
|
|
3882
3882
|
if (!i.cache) return n.getMany(i);
|
|
3883
|
-
var a =
|
|
3884
|
-
return a ?
|
|
3885
|
-
return i.trans._cache = { keys: i.keys, values: i.cache === "clone" ?
|
|
3883
|
+
var a = zr(i.keys, i.trans._cache, i.cache === "clone");
|
|
3884
|
+
return a ? W.resolve(a) : n.getMany(i).then(function(u) {
|
|
3885
|
+
return i.trans._cache = { keys: i.keys, values: i.cache === "clone" ? He(u) : u }, u;
|
|
3886
3886
|
});
|
|
3887
3887
|
}, mutate: function(i) {
|
|
3888
3888
|
return i.type !== "add" && (i.trans._cache = null), n.mutate(i);
|
|
3889
3889
|
} });
|
|
3890
3890
|
} };
|
|
3891
3891
|
} };
|
|
3892
|
-
function
|
|
3892
|
+
function Hr(e, t) {
|
|
3893
3893
|
return e.trans.mode === "readonly" && !!e.subscr && !e.trans.explicit && e.trans.db._options.cache !== "disabled" && !t.schema.primaryKey.outbound;
|
|
3894
3894
|
}
|
|
3895
3895
|
function Qr(e, t) {
|
|
@@ -3906,7 +3906,7 @@ function zo() {
|
|
|
3906
3906
|
var fo = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
|
|
3907
3907
|
var t = e.schema.name, n = new Ie(e.MIN_KEY, e.MAX_KEY);
|
|
3908
3908
|
return o(o({}, e), { transaction: function(i, a, u) {
|
|
3909
|
-
if (
|
|
3909
|
+
if (H.subscr && a !== "readonly") throw new Q.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(H.querier));
|
|
3910
3910
|
return e.transaction(i, a, u);
|
|
3911
3911
|
}, table: function(i) {
|
|
3912
3912
|
var a = e.table(i), u = a.schema, h = u.primaryKey, y = u.indexes, p = h.extractKey, b = h.outbound, _ = h.autoIncrement && y.filter(function(w) {
|
|
@@ -3915,33 +3915,33 @@ function zo() {
|
|
|
3915
3915
|
function x($) {
|
|
3916
3916
|
return $ = "idb://".concat(t, "/").concat(i, "/").concat($), P[$] || (P[$] = new Ie());
|
|
3917
3917
|
}
|
|
3918
|
-
var C, N, A, k = w.trans, P = w.mutatedParts || (w.mutatedParts = {}), F = x(""),
|
|
3918
|
+
var C, N, A, k = w.trans, P = w.mutatedParts || (w.mutatedParts = {}), F = x(""), q = x(":dels"), V = w.type, G = w.type === "deleteRange" ? [w.range] : w.type === "delete" ? [w.keys] : w.values.length < 50 ? [lr(h, w).filter(function($) {
|
|
3919
3919
|
return $;
|
|
3920
3920
|
}), w.values] : [], L = G[0], U = G[1], G = w.trans._cache;
|
|
3921
|
-
return g(L) ? (F.addKeys(L), (G = V === "delete" || L.length === U.length ?
|
|
3922
|
-
var
|
|
3921
|
+
return g(L) ? (F.addKeys(L), (G = V === "delete" || L.length === U.length ? zr(L, G) : null) || q.addKeys(L), (G || U) && (C = x, N = G, A = U, u.indexes.forEach(function($) {
|
|
3922
|
+
var X = C($.name || "");
|
|
3923
3923
|
function re(te) {
|
|
3924
3924
|
return te != null ? $.extractKey(te) : null;
|
|
3925
3925
|
}
|
|
3926
3926
|
function se(te) {
|
|
3927
3927
|
return $.multiEntry && g(te) ? te.forEach(function(Ee) {
|
|
3928
|
-
return
|
|
3929
|
-
}) :
|
|
3928
|
+
return X.addKey(Ee);
|
|
3929
|
+
}) : X.addKey(te);
|
|
3930
3930
|
}
|
|
3931
3931
|
(N || A).forEach(function(te, Pe) {
|
|
3932
3932
|
var ee = N && re(N[Pe]), Pe = A && re(A[Pe]);
|
|
3933
3933
|
ae(ee, Pe) !== 0 && (ee != null && se(ee), Pe != null && se(Pe));
|
|
3934
3934
|
});
|
|
3935
|
-
}))) : L ? (U = { from: (U = L.lower) !== null && U !== void 0 ? U : e.MIN_KEY, to: (U = L.upper) !== null && U !== void 0 ? U : e.MAX_KEY },
|
|
3935
|
+
}))) : L ? (U = { from: (U = L.lower) !== null && U !== void 0 ? U : e.MIN_KEY, to: (U = L.upper) !== null && U !== void 0 ? U : e.MAX_KEY }, q.add(U), F.add(U)) : (F.add(n), q.add(n), u.indexes.forEach(function($) {
|
|
3936
3936
|
return x($.name).add(n);
|
|
3937
3937
|
})), a.mutate(w).then(function($) {
|
|
3938
|
-
return !L || w.type !== "add" && w.type !== "put" || (F.addKeys($.results), _ && _.forEach(function(
|
|
3938
|
+
return !L || w.type !== "add" && w.type !== "put" || (F.addKeys($.results), _ && _.forEach(function(X) {
|
|
3939
3939
|
for (var re = w.values.map(function(ee) {
|
|
3940
|
-
return
|
|
3941
|
-
}), se =
|
|
3940
|
+
return X.extractKey(ee);
|
|
3941
|
+
}), se = X.keyPath.findIndex(function(ee) {
|
|
3942
3942
|
return ee === h.keyPath;
|
|
3943
3943
|
}), te = 0, Ee = $.results.length; te < Ee; ++te) re[te][se] = $.results[te];
|
|
3944
|
-
x(
|
|
3944
|
+
x(X.name).addKeys(re);
|
|
3945
3945
|
})), k.mutatedParts = En(k.mutatedParts || {}, P), $;
|
|
3946
3946
|
});
|
|
3947
3947
|
} }), y = function(x) {
|
|
@@ -3954,30 +3954,30 @@ function zo() {
|
|
|
3954
3954
|
}, count: y, query: y, openCursor: y };
|
|
3955
3955
|
return v(O).forEach(function(w) {
|
|
3956
3956
|
T[w] = function(x) {
|
|
3957
|
-
var C =
|
|
3957
|
+
var C = H.subscr, N = !!C, A = Hr(H, a) && Qr(w, x) ? x.obsSet = {} : C;
|
|
3958
3958
|
if (N) {
|
|
3959
3959
|
var k = function(U) {
|
|
3960
3960
|
return U = "idb://".concat(t, "/").concat(i, "/").concat(U), A[U] || (A[U] = new Ie());
|
|
3961
3961
|
}, P = k(""), F = k(":dels"), C = O[w](x), N = C[0], C = C[1];
|
|
3962
3962
|
if ((w === "query" && N.isPrimaryKey && !x.values ? F : k(N.name || "")).add(C), !N.isPrimaryKey) {
|
|
3963
3963
|
if (w !== "count") {
|
|
3964
|
-
var
|
|
3964
|
+
var q = w === "query" && b && x.values && a.query(o(o({}, x), { values: !1 }));
|
|
3965
3965
|
return a[w].apply(this, arguments).then(function(U) {
|
|
3966
3966
|
if (w === "query") {
|
|
3967
|
-
if (b && x.values) return
|
|
3967
|
+
if (b && x.values) return q.then(function(re) {
|
|
3968
3968
|
return re = re.result, P.addKeys(re), U;
|
|
3969
3969
|
});
|
|
3970
3970
|
var G = x.values ? U.result.map(p) : U.result;
|
|
3971
3971
|
(x.values ? P : F).addKeys(G);
|
|
3972
3972
|
} else if (w === "openCursor") {
|
|
3973
|
-
var $ = U,
|
|
3973
|
+
var $ = U, X = x.values;
|
|
3974
3974
|
return $ && Object.create($, { key: { get: function() {
|
|
3975
3975
|
return F.addKey($.primaryKey), $.key;
|
|
3976
3976
|
} }, primaryKey: { get: function() {
|
|
3977
3977
|
var re = $.primaryKey;
|
|
3978
3978
|
return F.addKey(re), re;
|
|
3979
3979
|
} }, value: { get: function() {
|
|
3980
|
-
return
|
|
3980
|
+
return X && P.addKey($.primaryKey), $.value;
|
|
3981
3981
|
} } });
|
|
3982
3982
|
}
|
|
3983
3983
|
return U;
|
|
@@ -4010,43 +4010,43 @@ function zo() {
|
|
|
4010
4010
|
var h = t.query.index, p = h.multiEntry, b = t.query.range, _ = i.schema.primaryKey.extractKey, T = h.extractKey, y = (h.lowLevelIndex || h).extractKey, O = O.reduce(function(w, x) {
|
|
4011
4011
|
var C = w, N = [];
|
|
4012
4012
|
if (x.type === "add" || x.type === "put") for (var A = new Ie(), k = x.values.length - 1; 0 <= k; --k) {
|
|
4013
|
-
var P, F = x.values[k],
|
|
4014
|
-
A.hasKey(
|
|
4013
|
+
var P, F = x.values[k], q = _(F);
|
|
4014
|
+
A.hasKey(q) || (P = T(F), (p && g(P) ? P.some(function($) {
|
|
4015
4015
|
return fr($, b);
|
|
4016
|
-
}) : fr(P, b)) && (A.addKey(
|
|
4016
|
+
}) : fr(P, b)) && (A.addKey(q), N.push(F)));
|
|
4017
4017
|
}
|
|
4018
4018
|
switch (x.type) {
|
|
4019
4019
|
case "add":
|
|
4020
|
-
var V = new Ie().addKeys(t.values ? w.map(function(
|
|
4021
|
-
return _(
|
|
4022
|
-
}) : w), C = w.concat(t.values ? N.filter(function(
|
|
4023
|
-
return
|
|
4024
|
-
}) : N.map(function(
|
|
4025
|
-
return _(
|
|
4026
|
-
}).filter(function(
|
|
4027
|
-
return !V.hasKey(
|
|
4020
|
+
var V = new Ie().addKeys(t.values ? w.map(function(X) {
|
|
4021
|
+
return _(X);
|
|
4022
|
+
}) : w), C = w.concat(t.values ? N.filter(function(X) {
|
|
4023
|
+
return X = _(X), !V.hasKey(X) && (V.addKey(X), !0);
|
|
4024
|
+
}) : N.map(function(X) {
|
|
4025
|
+
return _(X);
|
|
4026
|
+
}).filter(function(X) {
|
|
4027
|
+
return !V.hasKey(X) && (V.addKey(X), !0);
|
|
4028
4028
|
}));
|
|
4029
4029
|
break;
|
|
4030
4030
|
case "put":
|
|
4031
|
-
var L = new Ie().addKeys(x.values.map(function(
|
|
4032
|
-
return _(
|
|
4031
|
+
var L = new Ie().addKeys(x.values.map(function(X) {
|
|
4032
|
+
return _(X);
|
|
4033
4033
|
}));
|
|
4034
|
-
C = w.filter(function(
|
|
4035
|
-
return !L.hasKey(t.values ? _(
|
|
4036
|
-
}).concat(t.values ? N : N.map(function(
|
|
4037
|
-
return _(
|
|
4034
|
+
C = w.filter(function(X) {
|
|
4035
|
+
return !L.hasKey(t.values ? _(X) : X);
|
|
4036
|
+
}).concat(t.values ? N : N.map(function(X) {
|
|
4037
|
+
return _(X);
|
|
4038
4038
|
}));
|
|
4039
4039
|
break;
|
|
4040
4040
|
case "delete":
|
|
4041
4041
|
var U = new Ie().addKeys(x.keys);
|
|
4042
|
-
C = w.filter(function(
|
|
4043
|
-
return !U.hasKey(t.values ? _(
|
|
4042
|
+
C = w.filter(function(X) {
|
|
4043
|
+
return !U.hasKey(t.values ? _(X) : X);
|
|
4044
4044
|
});
|
|
4045
4045
|
break;
|
|
4046
4046
|
case "deleteRange":
|
|
4047
4047
|
var G = x.range;
|
|
4048
|
-
C = w.filter(function(
|
|
4049
|
-
return !fr(_(
|
|
4048
|
+
C = w.filter(function(X) {
|
|
4049
|
+
return !fr(_(X), G);
|
|
4050
4050
|
});
|
|
4051
4051
|
}
|
|
4052
4052
|
return C;
|
|
@@ -4097,26 +4097,26 @@ function zo() {
|
|
|
4097
4097
|
for (var _ = /* @__PURE__ */ new Set(), T = 0, y = n; T < y.length; T++) {
|
|
4098
4098
|
var O = y[T], w = bt["idb://".concat(t, "/").concat(O)];
|
|
4099
4099
|
if (w) {
|
|
4100
|
-
var x = e.table(O), C = w.optimisticOps.filter(function(
|
|
4101
|
-
return
|
|
4100
|
+
var x = e.table(O), C = w.optimisticOps.filter(function(X) {
|
|
4101
|
+
return X.trans === p;
|
|
4102
4102
|
});
|
|
4103
|
-
if (p._explicit && b && p.mutatedParts) for (var N = 0, A = Object.values(w.queries.query); N < A.length; N++) for (var k = 0, P = (V = A[N]).slice(); k < P.length; k++) ir((L = P[k]).obsSet, p.mutatedParts) && (Ke(V, L), L.subscribers.forEach(function(
|
|
4104
|
-
return _.add(
|
|
4103
|
+
if (p._explicit && b && p.mutatedParts) for (var N = 0, A = Object.values(w.queries.query); N < A.length; N++) for (var k = 0, P = (V = A[N]).slice(); k < P.length; k++) ir((L = P[k]).obsSet, p.mutatedParts) && (Ke(V, L), L.subscribers.forEach(function(X) {
|
|
4104
|
+
return _.add(X);
|
|
4105
4105
|
}));
|
|
4106
4106
|
else if (0 < C.length) {
|
|
4107
|
-
w.optimisticOps = w.optimisticOps.filter(function(
|
|
4108
|
-
return
|
|
4107
|
+
w.optimisticOps = w.optimisticOps.filter(function(X) {
|
|
4108
|
+
return X.trans !== p;
|
|
4109
4109
|
});
|
|
4110
|
-
for (var F = 0,
|
|
4111
|
-
return _.add(
|
|
4112
|
-
})) : U !== L.res && (L.res = U, L.promise =
|
|
4113
|
-
return _.add(
|
|
4110
|
+
for (var F = 0, q = Object.values(w.queries.query); F < q.length; F++) for (var V, L, U, G = 0, $ = (V = q[F]).slice(); G < $.length; G++) (L = $[G]).res != null && p.mutatedParts && (b && !L.dirty ? (U = Object.isFrozen(L.res), U = Jr(L.res, L.req, C, x, L, U), L.dirty ? (Ke(V, L), L.subscribers.forEach(function(X) {
|
|
4111
|
+
return _.add(X);
|
|
4112
|
+
})) : U !== L.res && (L.res = U, L.promise = W.resolve({ result: U }))) : (L.dirty && Ke(V, L), L.subscribers.forEach(function(X) {
|
|
4113
|
+
return _.add(X);
|
|
4114
4114
|
})));
|
|
4115
4115
|
}
|
|
4116
4116
|
}
|
|
4117
4117
|
}
|
|
4118
|
-
_.forEach(function(
|
|
4119
|
-
return
|
|
4118
|
+
_.forEach(function(X) {
|
|
4119
|
+
return X();
|
|
4120
4120
|
});
|
|
4121
4121
|
}
|
|
4122
4122
|
};
|
|
@@ -4124,7 +4124,7 @@ function zo() {
|
|
|
4124
4124
|
}, table: function(n) {
|
|
4125
4125
|
var i = e.table(n), a = i.schema.primaryKey;
|
|
4126
4126
|
return o(o({}, i), { mutate: function(u) {
|
|
4127
|
-
var h =
|
|
4127
|
+
var h = H.trans;
|
|
4128
4128
|
if (a.outbound || h.db._options.cache === "disabled" || h.explicit || h.idbtrans.mode !== "readwrite") return i.mutate(u);
|
|
4129
4129
|
var p = bt["idb://".concat(t, "/").concat(n)];
|
|
4130
4130
|
return p ? (h = i.mutate(u), u.type !== "add" && u.type !== "put" || !(50 <= u.values.length || lr(a, u).some(function(b) {
|
|
@@ -4136,15 +4136,15 @@ function zo() {
|
|
|
4136
4136
|
})) : h.then(function(b) {
|
|
4137
4137
|
var _ = Zr(0, o(o({}, u), { values: u.values.map(function(T, y) {
|
|
4138
4138
|
var O;
|
|
4139
|
-
return b.failures[y] ? T : (T = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ?
|
|
4139
|
+
return b.failures[y] ? T : (T = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ? He(T) : o({}, T), de(T, a.keyPath, b.results[y]), T);
|
|
4140
4140
|
}) }), b);
|
|
4141
4141
|
p.optimisticOps.push(_), queueMicrotask(function() {
|
|
4142
4142
|
return u.mutatedParts && xn(u.mutatedParts);
|
|
4143
4143
|
});
|
|
4144
4144
|
}), h) : i.mutate(u);
|
|
4145
4145
|
}, query: function(u) {
|
|
4146
|
-
if (!
|
|
4147
|
-
var h = ((_ =
|
|
4146
|
+
if (!Hr(H, i) || !Qr("query", u)) return i.query(u);
|
|
4147
|
+
var h = ((_ = H.trans) === null || _ === void 0 ? void 0 : _.db._options.cache) === "immutable", y = H, p = y.requery, b = y.signal, _ = (function(x, C, N, A) {
|
|
4148
4148
|
var k = bt["idb://".concat(x, "/").concat(C)];
|
|
4149
4149
|
if (!k) return [];
|
|
4150
4150
|
if (!(C = k.queries[N])) return [null, !1, k, null];
|
|
@@ -4152,15 +4152,15 @@ function zo() {
|
|
|
4152
4152
|
if (!P) return [null, !1, k, null];
|
|
4153
4153
|
switch (N) {
|
|
4154
4154
|
case "query":
|
|
4155
|
-
var F = P.find(function(
|
|
4156
|
-
return
|
|
4155
|
+
var F = P.find(function(q) {
|
|
4156
|
+
return q.req.limit === A.limit && q.req.values === A.values && ei(q.req.query.range, A.query.range);
|
|
4157
4157
|
});
|
|
4158
|
-
return F ? [F, !0, k, P] : [P.find(function(
|
|
4159
|
-
return ("limit" in
|
|
4158
|
+
return F ? [F, !0, k, P] : [P.find(function(q) {
|
|
4159
|
+
return ("limit" in q.req ? q.req.limit : 1 / 0) >= A.limit && (!A.values || q.req.values) && ho(q.req.query.range, A.query.range);
|
|
4160
4160
|
}), !1, k, P];
|
|
4161
4161
|
case "count":
|
|
4162
|
-
return F = P.find(function(
|
|
4163
|
-
return ei(
|
|
4162
|
+
return F = P.find(function(q) {
|
|
4163
|
+
return ei(q.req.query.range, A.query.range);
|
|
4164
4164
|
}), [F, !!F, k, P];
|
|
4165
4165
|
}
|
|
4166
4166
|
})(t, n, "query", u), T = _[0], y = _[1], O = _[2], w = _[3];
|
|
@@ -4169,7 +4169,7 @@ function zo() {
|
|
|
4169
4169
|
if (T && (T.res = C), h) {
|
|
4170
4170
|
for (var N = 0, A = C.length; N < A; ++N) Object.freeze(C[N]);
|
|
4171
4171
|
Object.freeze(C);
|
|
4172
|
-
} else x.result =
|
|
4172
|
+
} else x.result = He(C);
|
|
4173
4173
|
return x;
|
|
4174
4174
|
}).catch(function(x) {
|
|
4175
4175
|
return w && T && Ke(w, T), Promise.reject(x);
|
|
@@ -4194,7 +4194,7 @@ function zo() {
|
|
|
4194
4194
|
return n || (n = new this.Version(e), t.push(n), t.sort(ro), n.stores({}), this._state.autoSchema = !1, n);
|
|
4195
4195
|
}, Ne.prototype._whenReady = function(e) {
|
|
4196
4196
|
var t = this;
|
|
4197
|
-
return this.idbdb && (this._state.openComplete ||
|
|
4197
|
+
return this.idbdb && (this._state.openComplete || H.letThrough || this._vip) ? e() : new W(function(n, i) {
|
|
4198
4198
|
if (t._state.openComplete) return i(new Q.DatabaseClosed(t._state.dbOpenError));
|
|
4199
4199
|
if (!t._state.isBeingOpened) {
|
|
4200
4200
|
if (!t._state.autoOpen) return void i(new Q.DatabaseClosed());
|
|
@@ -4227,9 +4227,9 @@ function zo() {
|
|
|
4227
4227
|
}
|
|
4228
4228
|
this.idbdb = null;
|
|
4229
4229
|
}
|
|
4230
|
-
e.isBeingOpened || (e.dbReadyPromise = new
|
|
4230
|
+
e.isBeingOpened || (e.dbReadyPromise = new W(function(n) {
|
|
4231
4231
|
e.dbReadyResolve = n;
|
|
4232
|
-
}), e.openCanceller = new
|
|
4232
|
+
}), e.openCanceller = new W(function(n, i) {
|
|
4233
4233
|
e.cancelOpen = i;
|
|
4234
4234
|
}));
|
|
4235
4235
|
}, Ne.prototype.close = function(n) {
|
|
@@ -4239,14 +4239,14 @@ function zo() {
|
|
|
4239
4239
|
var t = this;
|
|
4240
4240
|
e === void 0 && (e = { disableAutoOpen: !0 });
|
|
4241
4241
|
var n = 0 < arguments.length && typeof arguments[0] != "object", i = this._state;
|
|
4242
|
-
return new
|
|
4242
|
+
return new W(function(a, u) {
|
|
4243
4243
|
function h() {
|
|
4244
4244
|
t.close(e);
|
|
4245
4245
|
var p = t._deps.indexedDB.deleteDatabase(t.name);
|
|
4246
4246
|
p.onsuccess = ge(function() {
|
|
4247
4247
|
var b, _, T;
|
|
4248
4248
|
b = t._deps, _ = t.name, T = b.indexedDB, b = b.IDBKeyRange, tr(T) || _ === ln || er(T, b).delete(_).catch(l), a();
|
|
4249
|
-
}), p.onerror =
|
|
4249
|
+
}), p.onerror = We(u), p.onblocked = t._fireOnBlocked;
|
|
4250
4250
|
}
|
|
4251
4251
|
if (n) throw new Q.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
4252
4252
|
i.isBeingOpened ? i.dbReadyPromise.then(h) : h();
|
|
@@ -4276,7 +4276,7 @@ function zo() {
|
|
|
4276
4276
|
}).apply(this, arguments);
|
|
4277
4277
|
return this._transaction.apply(this, e);
|
|
4278
4278
|
}, Ne.prototype._transaction = function(e, t, n) {
|
|
4279
|
-
var i = this, a =
|
|
4279
|
+
var i = this, a = H.trans;
|
|
4280
4280
|
a && a.db === this && e.indexOf("!") === -1 || (a = null);
|
|
4281
4281
|
var u, h, p = e.indexOf("?") !== -1;
|
|
4282
4282
|
e = e.replace("!", "").replace("?", "");
|
|
@@ -4307,8 +4307,8 @@ function zo() {
|
|
|
4307
4307
|
}) : Te(_);
|
|
4308
4308
|
}
|
|
4309
4309
|
var b = (function _(T, y, O, w, x) {
|
|
4310
|
-
return
|
|
4311
|
-
var C =
|
|
4310
|
+
return W.resolve().then(function() {
|
|
4311
|
+
var C = H.transless || H, N = T._createTransaction(y, O, T._dbSchema, w);
|
|
4312
4312
|
if (N.explicit = !0, C = { trans: N, transless: C }, w) N.idbtrans = w.idbtrans;
|
|
4313
4313
|
else try {
|
|
4314
4314
|
N.create(), N.idbtrans._explicit = !0, T._state.PR1398_maxLoop = 3;
|
|
@@ -4318,10 +4318,10 @@ function zo() {
|
|
|
4318
4318
|
})) : Te(P);
|
|
4319
4319
|
}
|
|
4320
4320
|
var A, k = Tt(x);
|
|
4321
|
-
return k && St(), C =
|
|
4321
|
+
return k && St(), C = W.follow(function() {
|
|
4322
4322
|
var P;
|
|
4323
4323
|
(A = x.call(N, N)) && (k ? (P = at.bind(null, null), A.then(P, P)) : typeof A.next == "function" && typeof A.throw == "function" && (A = cr(A)));
|
|
4324
|
-
}, C), (A && typeof A.then == "function" ?
|
|
4324
|
+
}, C), (A && typeof A.then == "function" ? W.resolve(A).then(function(P) {
|
|
4325
4325
|
return N.active ? P : Te(new Q.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
4326
4326
|
}) : C.then(function() {
|
|
4327
4327
|
return A;
|
|
@@ -4334,11 +4334,11 @@ function zo() {
|
|
|
4334
4334
|
});
|
|
4335
4335
|
});
|
|
4336
4336
|
}).bind(null, this, u, h, a, n);
|
|
4337
|
-
return a ? a._promise(u, b, "lock") :
|
|
4337
|
+
return a ? a._promise(u, b, "lock") : H.trans ? gt(H.transless, function() {
|
|
4338
4338
|
return i._whenReady(b);
|
|
4339
4339
|
}) : this._whenReady(b);
|
|
4340
4340
|
}, Ne.prototype.table = function(e) {
|
|
4341
|
-
if (!
|
|
4341
|
+
if (!B(this._allTables, e)) throw new Q.InvalidTable("Table ".concat(e, " does not exist"));
|
|
4342
4342
|
return this._allTables[e];
|
|
4343
4343
|
}, Ne);
|
|
4344
4344
|
function Ne(e, t) {
|
|
@@ -4347,9 +4347,9 @@ function zo() {
|
|
|
4347
4347
|
var i = Ne.dependencies;
|
|
4348
4348
|
this._options = t = o({ addons: Ne.addons, autoOpen: !0, indexedDB: i.indexedDB, IDBKeyRange: i.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, i = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
4349
4349
|
var a, u, h, p, b, _ = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: l, dbReadyPromise: null, cancelOpen: l, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
|
|
4350
|
-
_.dbReadyPromise = new
|
|
4350
|
+
_.dbReadyPromise = new W(function(y) {
|
|
4351
4351
|
_.dbReadyResolve = y;
|
|
4352
|
-
}), _.openCanceller = new
|
|
4352
|
+
}), _.openCanceller = new W(function(y, O) {
|
|
4353
4353
|
_.cancelOpen = O;
|
|
4354
4354
|
}), this._state = _, this.name = e, this.on = Lt(this, "populate", "blocked", "versionchange", "close", { ready: [Ae, l] }), this.once = function(y, O) {
|
|
4355
4355
|
var w = function() {
|
|
@@ -4361,12 +4361,12 @@ function zo() {
|
|
|
4361
4361
|
return function(O, w) {
|
|
4362
4362
|
Ne.vip(function() {
|
|
4363
4363
|
var x, C = n._state;
|
|
4364
|
-
C.openComplete ? (C.dbOpenError ||
|
|
4364
|
+
C.openComplete ? (C.dbOpenError || W.resolve().then(O), w && y(O)) : C.onReadyBeingFired ? (C.onReadyBeingFired.push(O), w && y(O)) : (y(O), x = n, w || y(function N() {
|
|
4365
4365
|
x.on.ready.unsubscribe(O), x.on.ready.unsubscribe(N);
|
|
4366
4366
|
}));
|
|
4367
4367
|
});
|
|
4368
4368
|
};
|
|
4369
|
-
}), this.Collection = (a = this, Ut(
|
|
4369
|
+
}), this.Collection = (a = this, Ut(Hi.prototype, function(A, N) {
|
|
4370
4370
|
this.db = a;
|
|
4371
4371
|
var w = Sr, x = null;
|
|
4372
4372
|
if (N) try {
|
|
@@ -4377,14 +4377,14 @@ function zo() {
|
|
|
4377
4377
|
var C = A._ctx, N = C.table, A = N.hook.reading.fire;
|
|
4378
4378
|
this._ctx = { table: N, index: C.index, isPrimKey: !C.index || N.schema.primKey.keyPath && C.index === N.schema.primKey.name, range: w, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: x, or: C.or, valueMapper: A !== c ? A : null };
|
|
4379
4379
|
})), this.Table = (u = this, Ut(Pr.prototype, function(y, O, w) {
|
|
4380
|
-
this.db = u, this._tx = w, this.name = y, this.schema = O, this.hook = u._allTables[y] ? u._allTables[y].hook : Lt(null, { creating: [le, l], reading: [
|
|
4380
|
+
this.db = u, this._tx = w, this.name = y, this.schema = O, this.hook = u._allTables[y] ? u._allTables[y].hook : Lt(null, { creating: [le, l], reading: [I, c], updating: [xe, l], deleting: [be, l] });
|
|
4381
4381
|
})), this.Transaction = (h = this, Ut(Ji.prototype, function(y, O, w, x, C) {
|
|
4382
4382
|
var N = this;
|
|
4383
4383
|
y !== "readonly" && O.forEach(function(A) {
|
|
4384
4384
|
A = (A = w[A]) === null || A === void 0 ? void 0 : A.yProps, A && (O = O.concat(A.map(function(k) {
|
|
4385
4385
|
return k.updatesTable;
|
|
4386
4386
|
})));
|
|
4387
|
-
}), this.db = h, this.mode = y, this.storeNames = O, this.schema = w, this.chromeTransactionDurability = x, this.idbtrans = null, this.on = Lt(this, "complete", "error", "abort"), this.parent = C || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new
|
|
4387
|
+
}), this.db = h, this.mode = y, this.storeNames = O, this.schema = w, this.chromeTransactionDurability = x, this.idbtrans = null, this.on = Lt(this, "complete", "error", "abort"), this.parent = C || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new W(function(A, k) {
|
|
4388
4388
|
N._resolve = A, N._reject = k;
|
|
4389
4389
|
}), this._completion.then(function() {
|
|
4390
4390
|
N.active = !1, N.on.complete.fire();
|
|
@@ -4406,7 +4406,7 @@ function zo() {
|
|
|
4406
4406
|
0 < y.newVersion ? console.warn("Another connection wants to upgrade database '".concat(n.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(n.name, "'. Closing db now to resume the delete request.")), n.close({ disableAutoOpen: !1 });
|
|
4407
4407
|
}), this.on("blocked", function(y) {
|
|
4408
4408
|
!y.newVersion || y.newVersion < y.oldVersion ? console.warn("Dexie.delete('".concat(n.name, "') was blocked")) : console.warn("Upgrade '".concat(n.name, "' blocked by other connection holding version ").concat(y.oldVersion / 10));
|
|
4409
|
-
}), this._maxKey =
|
|
4409
|
+
}), this._maxKey = Wt(t.IDBKeyRange), this._createTransaction = function(y, O, w, x) {
|
|
4410
4410
|
return new n.Transaction(y, O, w, n._options.chromeTransactionDurability, x);
|
|
4411
4411
|
}, this._fireOnBlocked = function(y) {
|
|
4412
4412
|
n.on("blocked").fire(y), kt.filter(function(O) {
|
|
@@ -4469,7 +4469,7 @@ function zo() {
|
|
|
4469
4469
|
}
|
|
4470
4470
|
})(N = { subscr: C, signal: h.signal, requery: O, querier: e, trans: null }), Promise.resolve(A).then(function(k) {
|
|
4471
4471
|
n = !0, t = k, p || N.signal.aborted || (b = {}, (function(P) {
|
|
4472
|
-
for (var F in P) if (
|
|
4472
|
+
for (var F in P) if (B(P, F)) return;
|
|
4473
4473
|
return 1;
|
|
4474
4474
|
})(_ = C) || y || (ut(Gt, w), y = !0), Un(function() {
|
|
4475
4475
|
return !p && a.next && a.next(k);
|
|
@@ -4497,7 +4497,7 @@ function zo() {
|
|
|
4497
4497
|
lt = t;
|
|
4498
4498
|
}
|
|
4499
4499
|
}
|
|
4500
|
-
|
|
4500
|
+
Y(wt, o(o({}, Ot), { delete: function(e) {
|
|
4501
4501
|
return new wt(e, { addons: [] }).delete();
|
|
4502
4502
|
}, exists: function(e) {
|
|
4503
4503
|
return new wt(e, { addons: [] }).open().then(function(t) {
|
|
@@ -4523,12 +4523,12 @@ function zo() {
|
|
|
4523
4523
|
D(this, e);
|
|
4524
4524
|
};
|
|
4525
4525
|
}, ignoreTransaction: function(e) {
|
|
4526
|
-
return
|
|
4526
|
+
return H.trans ? gt(H.transless, e) : e();
|
|
4527
4527
|
}, vip: nr, async: function(e) {
|
|
4528
4528
|
return function() {
|
|
4529
4529
|
try {
|
|
4530
4530
|
var t = cr(e.apply(this, arguments));
|
|
4531
|
-
return t && typeof t.then == "function" ? t :
|
|
4531
|
+
return t && typeof t.then == "function" ? t : W.resolve(t);
|
|
4532
4532
|
} catch (n) {
|
|
4533
4533
|
return Te(n);
|
|
4534
4534
|
}
|
|
@@ -4536,35 +4536,35 @@ function zo() {
|
|
|
4536
4536
|
}, spawn: function(e, t, n) {
|
|
4537
4537
|
try {
|
|
4538
4538
|
var i = cr(e.apply(n, t || []));
|
|
4539
|
-
return i && typeof i.then == "function" ? i :
|
|
4539
|
+
return i && typeof i.then == "function" ? i : W.resolve(i);
|
|
4540
4540
|
} catch (a) {
|
|
4541
4541
|
return Te(a);
|
|
4542
4542
|
}
|
|
4543
4543
|
}, currentTransaction: { get: function() {
|
|
4544
|
-
return
|
|
4544
|
+
return H.trans || null;
|
|
4545
4545
|
} }, waitFor: function(e, t) {
|
|
4546
|
-
return t =
|
|
4547
|
-
}, Promise:
|
|
4546
|
+
return t = W.resolve(typeof e == "function" ? wt.ignoreTransaction(e) : e).timeout(t || 6e4), H.trans ? H.trans.waitFor(t) : t;
|
|
4547
|
+
}, Promise: W, debug: { get: function() {
|
|
4548
4548
|
return Ce;
|
|
4549
4549
|
}, set: function(e) {
|
|
4550
4550
|
Oe(e);
|
|
4551
|
-
} }, derive:
|
|
4551
|
+
} }, derive: j, extend: D, props: Y, override: ne, Events: Lt, on: ut, liveQuery: ti, extendObservabilitySet: En, getByKeyPath: he, setByKeyPath: de, delByKeyPath: function(e, t) {
|
|
4552
4552
|
typeof t == "string" ? de(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
|
|
4553
4553
|
de(e, n, void 0);
|
|
4554
4554
|
});
|
|
4555
|
-
}, shallowClone: ve, deepClone:
|
|
4555
|
+
}, shallowClone: ve, deepClone: He, getObjectDiff: ur, cmp: ae, asap: J, minKey: -1 / 0, addons: [], connections: kt, errnames: ht, dependencies: Cn, cache: bt, semVer: "4.2.0", version: "4.2.0".split(".").map(function(e) {
|
|
4556
4556
|
return parseInt(e);
|
|
4557
4557
|
}).reduce(function(e, t, n) {
|
|
4558
4558
|
return e + t / Math.pow(10, 2 * n);
|
|
4559
|
-
}) })), wt.maxKey =
|
|
4560
|
-
lt || (e = new CustomEvent(
|
|
4561
|
-
}), addEventListener(
|
|
4559
|
+
}) })), wt.maxKey = Wt(wt.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (ut(Gt, function(e) {
|
|
4560
|
+
lt || (e = new CustomEvent(Xn, { detail: e }), lt = !0, dispatchEvent(e), lt = !1);
|
|
4561
|
+
}), addEventListener(Xn, function(e) {
|
|
4562
4562
|
e = e.detail, lt || hr(e);
|
|
4563
4563
|
}));
|
|
4564
4564
|
var Ft, lt = !1, ni = function() {
|
|
4565
4565
|
};
|
|
4566
4566
|
return typeof BroadcastChannel < "u" && ((ni = function() {
|
|
4567
|
-
(Ft = new BroadcastChannel(
|
|
4567
|
+
(Ft = new BroadcastChannel(Xn)).onmessage = function(e) {
|
|
4568
4568
|
return e.data && hr(e.data);
|
|
4569
4569
|
};
|
|
4570
4570
|
})(), typeof Ft.unref == "function" && Ft.unref(), ut(Gt, function(e) {
|
|
@@ -4576,7 +4576,7 @@ function zo() {
|
|
|
4576
4576
|
}
|
|
4577
4577
|
}), addEventListener("pageshow", function(e) {
|
|
4578
4578
|
!Je.disableBfCache && e.persisted && (Ce && console.debug("Dexie: handling persisted pageshow"), ni(), hr({ all: new Ie(-1 / 0, [[]]) }));
|
|
4579
|
-
})),
|
|
4579
|
+
})), W.rejectionMapper = function(e, t) {
|
|
4580
4580
|
return !e || e instanceof tt || e instanceof TypeError || e instanceof SyntaxError || !e.name || !Ct[e.name] ? e : (t = new Ct[e.name](t || e.message, e), "stack" in e && M(t, "stack", { get: function() {
|
|
4581
4581
|
return this.inner.stack;
|
|
4582
4582
|
} }), t);
|
|
@@ -4586,26 +4586,26 @@ function zo() {
|
|
|
4586
4586
|
return new Vt({ add: e });
|
|
4587
4587
|
}, remove: function(e) {
|
|
4588
4588
|
return new Vt({ remove: e });
|
|
4589
|
-
}, default: Je, RangeSet: Ie, mergeRanges:
|
|
4589
|
+
}, default: Je, RangeSet: Ie, mergeRanges: zt, rangesOverlap: Gr }), { default: Je }), Je;
|
|
4590
4590
|
});
|
|
4591
4591
|
})(Dn)), Dn.exports;
|
|
4592
4592
|
}
|
|
4593
|
-
var Qo =
|
|
4593
|
+
var Qo = Ho();
|
|
4594
4594
|
const _r = /* @__PURE__ */ ji(Qo), ui = /* @__PURE__ */ Symbol.for("Dexie"), dt = globalThis[ui] || (globalThis[ui] = _r);
|
|
4595
4595
|
if (_r.semVer !== dt.semVer)
|
|
4596
4596
|
throw new Error(`Two different versions of Dexie loaded in the same app: ${_r.semVer} and ${dt.semVer}`);
|
|
4597
4597
|
const {
|
|
4598
|
-
liveQuery:
|
|
4599
|
-
mergeRanges:
|
|
4600
|
-
rangesOverlap:
|
|
4601
|
-
RangeSet:
|
|
4602
|
-
cmp:
|
|
4603
|
-
Entity:
|
|
4604
|
-
PropModification:
|
|
4605
|
-
replacePrefix:
|
|
4606
|
-
add:
|
|
4607
|
-
remove:
|
|
4608
|
-
DexieYProvider:
|
|
4598
|
+
liveQuery: Va,
|
|
4599
|
+
mergeRanges: $a,
|
|
4600
|
+
rangesOverlap: Ga,
|
|
4601
|
+
RangeSet: Wa,
|
|
4602
|
+
cmp: Xa,
|
|
4603
|
+
Entity: Ya,
|
|
4604
|
+
PropModification: za,
|
|
4605
|
+
replacePrefix: Ha,
|
|
4606
|
+
add: Qa,
|
|
4607
|
+
remove: Za,
|
|
4608
|
+
DexieYProvider: Ja
|
|
4609
4609
|
} = dt;
|
|
4610
4610
|
function Et(m) {
|
|
4611
4611
|
const s = [m.autoIncrement ? `++${m.primaryKey}` : m.primaryKey];
|
|
@@ -4632,12 +4632,12 @@ class Jo {
|
|
|
4632
4632
|
const r = new dt(this.name);
|
|
4633
4633
|
r.version(1).stores({
|
|
4634
4634
|
[ft]: Et(oi),
|
|
4635
|
-
[
|
|
4636
|
-
[
|
|
4635
|
+
[Ye]: Et(ai),
|
|
4636
|
+
[ze]: Et(si)
|
|
4637
4637
|
});
|
|
4638
4638
|
try {
|
|
4639
4639
|
await r.open();
|
|
4640
|
-
const s = await r.table(ft).toArray(), o = await r.table(
|
|
4640
|
+
const s = await r.table(ft).toArray(), o = await r.table(ze).get("schemaVersion");
|
|
4641
4641
|
r.close();
|
|
4642
4642
|
for (const d of s)
|
|
4643
4643
|
this.knownDocuments.set(d.id, d);
|
|
@@ -4673,7 +4673,7 @@ class Jo {
|
|
|
4673
4673
|
async removeDocument(r) {
|
|
4674
4674
|
await this.withSchemaLock(async () => {
|
|
4675
4675
|
const s = this.resolveTableName(r);
|
|
4676
|
-
this.db.tables.some((o) => o.name === s) && await this.db.table(s).clear(), await this.db.table(
|
|
4676
|
+
this.db.tables.some((o) => o.name === s) && await this.db.table(s).clear(), await this.db.table(Ye).where({ documentId: r }).delete(), await this.db.table(ze).delete(`head:${r}`), await this.db.table(ft).delete(r), this.knownDocuments.delete(r), await this.reopenWithNewSchema({ drop: r });
|
|
4677
4677
|
});
|
|
4678
4678
|
}
|
|
4679
4679
|
// --- Record access ---
|
|
@@ -4697,92 +4697,92 @@ class Jo {
|
|
|
4697
4697
|
await this.db.transaction("rw", v, async () => {
|
|
4698
4698
|
if (o?.length && await v.bulkAdd(o), d?.length)
|
|
4699
4699
|
for (const { recordId: g, ...D } of d) {
|
|
4700
|
-
const
|
|
4701
|
-
if (!
|
|
4702
|
-
const
|
|
4700
|
+
const R = await v.get(g);
|
|
4701
|
+
if (!R) continue;
|
|
4702
|
+
const K = { ...D };
|
|
4703
4703
|
if (D.attributes) {
|
|
4704
|
-
const
|
|
4705
|
-
for (const
|
|
4706
|
-
const oe =
|
|
4707
|
-
oe >= 0 ?
|
|
4704
|
+
const B = [...R.attributes];
|
|
4705
|
+
for (const Y of D.attributes) {
|
|
4706
|
+
const oe = B.findIndex((M) => M.name === Y.name);
|
|
4707
|
+
oe >= 0 ? B[oe] = Y : B.push(Y);
|
|
4708
4708
|
}
|
|
4709
|
-
|
|
4709
|
+
K.attributes = B;
|
|
4710
4710
|
}
|
|
4711
4711
|
if (D.children) {
|
|
4712
|
-
const
|
|
4713
|
-
for (const
|
|
4714
|
-
const oe =
|
|
4715
|
-
oe >= 0 ?
|
|
4712
|
+
const B = [...R.children];
|
|
4713
|
+
for (const Y of D.children) {
|
|
4714
|
+
const oe = B.findIndex((M) => M.id === Y.id);
|
|
4715
|
+
oe >= 0 ? B[oe] = Y : B.push(Y);
|
|
4716
4716
|
}
|
|
4717
|
-
|
|
4717
|
+
K.children = B;
|
|
4718
4718
|
}
|
|
4719
|
-
await v.update(g,
|
|
4719
|
+
await v.update(g, K);
|
|
4720
4720
|
}
|
|
4721
4721
|
f?.length && await v.bulkDelete(f);
|
|
4722
4722
|
});
|
|
4723
4723
|
}
|
|
4724
4724
|
async commit(r) {
|
|
4725
4725
|
const { documentId: s, creates: o, updates: d, deletes: f, onProgress: v } = r, g = this.db.table(this.resolveTableName(s)), D = o.length + d.length + f.length;
|
|
4726
|
-
let
|
|
4726
|
+
let R = 0;
|
|
4727
4727
|
try {
|
|
4728
4728
|
await this.db.transaction(
|
|
4729
4729
|
"rw",
|
|
4730
4730
|
g,
|
|
4731
|
-
this.db.table(
|
|
4732
|
-
this.db.table(
|
|
4731
|
+
this.db.table(Ye),
|
|
4732
|
+
this.db.table(ze),
|
|
4733
4733
|
async () => {
|
|
4734
|
-
const
|
|
4734
|
+
const K = d.length > 0 ? await g.bulkGet(d.map((z) => z.id)) : [], B = f.length > 0 ? await g.bulkGet(f) : [];
|
|
4735
4735
|
if (o.length > 0)
|
|
4736
4736
|
try {
|
|
4737
|
-
await g.bulkAdd(o),
|
|
4738
|
-
} catch (
|
|
4737
|
+
await g.bulkAdd(o), R += o.length, v(R, D);
|
|
4738
|
+
} catch (z) {
|
|
4739
4739
|
$e("STORE_BULK_ADD_FAILED", {
|
|
4740
|
-
detail:
|
|
4741
|
-
cause:
|
|
4740
|
+
detail: z instanceof Error ? z.message : String(z),
|
|
4741
|
+
cause: z instanceof Error ? z : void 0
|
|
4742
4742
|
});
|
|
4743
4743
|
}
|
|
4744
4744
|
if (d.length > 0)
|
|
4745
4745
|
try {
|
|
4746
|
-
await g.bulkPut(d),
|
|
4747
|
-
} catch (
|
|
4746
|
+
await g.bulkPut(d), R += d.length, v(R, D);
|
|
4747
|
+
} catch (z) {
|
|
4748
4748
|
$e("STORE_BULK_UPDATE_FAILED", {
|
|
4749
|
-
detail:
|
|
4750
|
-
cause:
|
|
4749
|
+
detail: z instanceof Error ? z.message : String(z),
|
|
4750
|
+
cause: z instanceof Error ? z : void 0
|
|
4751
4751
|
});
|
|
4752
4752
|
}
|
|
4753
4753
|
if (f.length > 0)
|
|
4754
4754
|
try {
|
|
4755
|
-
await g.bulkDelete(f),
|
|
4756
|
-
} catch (
|
|
4755
|
+
await g.bulkDelete(f), R += f.length, v(R, D);
|
|
4756
|
+
} catch (z) {
|
|
4757
4757
|
$e("STORE_DELETE_FAILED", {
|
|
4758
|
-
detail:
|
|
4759
|
-
cause:
|
|
4758
|
+
detail: z instanceof Error ? z.message : String(z),
|
|
4759
|
+
cause: z instanceof Error ? z : void 0
|
|
4760
4760
|
});
|
|
4761
4761
|
}
|
|
4762
|
-
const
|
|
4763
|
-
oe.length > 0 && await this.db.table(
|
|
4764
|
-
const M =
|
|
4762
|
+
const Y = await this.getHead(s), oe = await this.db.table(Ye).where({ documentId: s }).filter((z) => z.sequenceNumber > Y).toArray();
|
|
4763
|
+
oe.length > 0 && await this.db.table(Ye).bulkDelete(oe.map((z) => z.id));
|
|
4764
|
+
const M = Y + 1, j = {
|
|
4765
4765
|
documentId: s,
|
|
4766
4766
|
sequenceNumber: M,
|
|
4767
4767
|
timestamp: Date.now(),
|
|
4768
4768
|
operations: {
|
|
4769
4769
|
creates: o,
|
|
4770
|
-
updates: d.map((
|
|
4771
|
-
before:
|
|
4772
|
-
after:
|
|
4770
|
+
updates: d.map((z, ie) => ({
|
|
4771
|
+
before: K[ie],
|
|
4772
|
+
after: z
|
|
4773
4773
|
})),
|
|
4774
|
-
deletes:
|
|
4774
|
+
deletes: B.filter(Boolean)
|
|
4775
4775
|
}
|
|
4776
4776
|
};
|
|
4777
|
-
await this.db.table(
|
|
4777
|
+
await this.db.table(Ye).add(j), await this.setHead(s, M);
|
|
4778
4778
|
}
|
|
4779
4779
|
);
|
|
4780
|
-
} catch (
|
|
4781
|
-
if (
|
|
4782
|
-
throw
|
|
4780
|
+
} catch (K) {
|
|
4781
|
+
if (K instanceof Error && K.message.includes("dialecte"))
|
|
4782
|
+
throw K;
|
|
4783
4783
|
$e("STORE_COMMIT_FAILED", {
|
|
4784
|
-
detail:
|
|
4785
|
-
cause:
|
|
4784
|
+
detail: K instanceof Error ? K.message : String(K),
|
|
4785
|
+
cause: K instanceof Error ? K : void 0
|
|
4786
4786
|
});
|
|
4787
4787
|
}
|
|
4788
4788
|
}
|
|
@@ -4790,25 +4790,25 @@ class Jo {
|
|
|
4790
4790
|
async undo(r) {
|
|
4791
4791
|
const s = await this.getHead(r);
|
|
4792
4792
|
if (s === 0) return;
|
|
4793
|
-
const o = await this.db.table(
|
|
4793
|
+
const o = await this.db.table(Ye).where({ documentId: r, sequenceNumber: s }).first();
|
|
4794
4794
|
if (!o) return;
|
|
4795
4795
|
const d = this.db.table(this.resolveTableName(r));
|
|
4796
|
-
await this.db.transaction("rw", d, this.db.table(
|
|
4796
|
+
await this.db.transaction("rw", d, this.db.table(ze), async () => {
|
|
4797
4797
|
const { creates: f, updates: v, deletes: g } = o.operations;
|
|
4798
4798
|
f.length > 0 && await d.bulkDelete(f.map((D) => D.id)), v.length > 0 && await d.bulkPut(v.map((D) => D.before)), g.length > 0 && await d.bulkAdd(g), await this.setHead(r, s - 1);
|
|
4799
4799
|
});
|
|
4800
4800
|
}
|
|
4801
4801
|
async redo(r) {
|
|
4802
|
-
const o = await this.getHead(r) + 1, d = await this.db.table(
|
|
4802
|
+
const o = await this.getHead(r) + 1, d = await this.db.table(Ye).where({ documentId: r, sequenceNumber: o }).first();
|
|
4803
4803
|
if (!d) return;
|
|
4804
4804
|
const f = this.db.table(this.resolveTableName(r));
|
|
4805
|
-
await this.db.transaction("rw", f, this.db.table(
|
|
4805
|
+
await this.db.transaction("rw", f, this.db.table(ze), async () => {
|
|
4806
4806
|
const { creates: v, updates: g, deletes: D } = d.operations;
|
|
4807
|
-
v.length > 0 && await f.bulkAdd(v), g.length > 0 && await f.bulkPut(g.map((
|
|
4807
|
+
v.length > 0 && await f.bulkAdd(v), g.length > 0 && await f.bulkPut(g.map((R) => R.after)), D.length > 0 && await f.bulkDelete(D.map((R) => R.id)), await this.setHead(r, o);
|
|
4808
4808
|
});
|
|
4809
4809
|
}
|
|
4810
4810
|
async getChangeLog(r) {
|
|
4811
|
-
return this.db.table(
|
|
4811
|
+
return this.db.table(Ye).where({ documentId: r }).sortBy("sequenceNumber");
|
|
4812
4812
|
}
|
|
4813
4813
|
/**
|
|
4814
4814
|
* Expose the underlying Dexie instance.
|
|
@@ -4819,17 +4819,17 @@ class Jo {
|
|
|
4819
4819
|
}
|
|
4820
4820
|
// --- Private helpers ---
|
|
4821
4821
|
async getHead(r) {
|
|
4822
|
-
return (await this.db.table(
|
|
4822
|
+
return (await this.db.table(ze).get(`head:${r}`))?.value ?? 0;
|
|
4823
4823
|
}
|
|
4824
4824
|
async setHead(r, s) {
|
|
4825
|
-
await this.db.table(
|
|
4825
|
+
await this.db.table(ze).put({ key: `head:${r}`, value: s });
|
|
4826
4826
|
}
|
|
4827
4827
|
/** Build Dexie stores object from current knownDocuments */
|
|
4828
4828
|
buildStores(r) {
|
|
4829
4829
|
const s = {
|
|
4830
4830
|
[ft]: Et(oi),
|
|
4831
|
-
[
|
|
4832
|
-
[
|
|
4831
|
+
[Ye]: Et(ai),
|
|
4832
|
+
[ze]: Et(si)
|
|
4833
4833
|
};
|
|
4834
4834
|
for (const o of this.knownDocuments.keys())
|
|
4835
4835
|
s[this.resolveTableName(o)] = this.dexieRecordSchema;
|
|
@@ -4837,7 +4837,7 @@ class Jo {
|
|
|
4837
4837
|
}
|
|
4838
4838
|
/** Close DB, bump version, reopen with updated schema */
|
|
4839
4839
|
async reopenWithNewSchema(r) {
|
|
4840
|
-
this.db.close(), await li(), this.schemaVersion++, this.db = new dt(this.name), this.db.version(this.schemaVersion).stores(this.buildStores(r)), await this.db.open(), await this.db.table(
|
|
4840
|
+
this.db.close(), await li(), this.schemaVersion++, this.db = new dt(this.name), this.db.version(this.schemaVersion).stores(this.buildStores(r)), await this.db.open(), await this.db.table(ze).put({ key: "schemaVersion", value: this.schemaVersion });
|
|
4841
4841
|
}
|
|
4842
4842
|
/** Serialize schema-changing operations */
|
|
4843
4843
|
withSchemaLock(r) {
|
|
@@ -4847,7 +4847,7 @@ class Jo {
|
|
|
4847
4847
|
* Resolve the Dexie table name for a documentId.
|
|
4848
4848
|
*/
|
|
4849
4849
|
resolveTableName(r) {
|
|
4850
|
-
return
|
|
4850
|
+
return Wo(r);
|
|
4851
4851
|
}
|
|
4852
4852
|
}
|
|
4853
4853
|
function li() {
|
|
@@ -4872,10 +4872,10 @@ function ta() {
|
|
|
4872
4872
|
r.ParsingError = s;
|
|
4873
4873
|
let o;
|
|
4874
4874
|
function d() {
|
|
4875
|
-
return D(!1) ||
|
|
4875
|
+
return D(!1) || Y() || B() || K() || g();
|
|
4876
4876
|
}
|
|
4877
4877
|
function f() {
|
|
4878
|
-
return
|
|
4878
|
+
return j(/\s*/), D(!0) || B() || R() || g();
|
|
4879
4879
|
}
|
|
4880
4880
|
function v() {
|
|
4881
4881
|
const ne = g(), Z = [];
|
|
@@ -4899,7 +4899,7 @@ function ta() {
|
|
|
4899
4899
|
};
|
|
4900
4900
|
}
|
|
4901
4901
|
function g() {
|
|
4902
|
-
const ne =
|
|
4902
|
+
const ne = j(/^<\?([\w-:.]+)\s*/);
|
|
4903
4903
|
if (!ne)
|
|
4904
4904
|
return;
|
|
4905
4905
|
const Z = {
|
|
@@ -4911,13 +4911,13 @@ function ta() {
|
|
|
4911
4911
|
Z.content = o.xml.substring(0, J).trim(), o.xml = o.xml.slice(J);
|
|
4912
4912
|
else
|
|
4913
4913
|
throw new s("Failed to parse XML", "ProcessingInstruction closing tag not found");
|
|
4914
|
-
return
|
|
4914
|
+
return j(/\?>/), {
|
|
4915
4915
|
excluded: o.options.filter(Z) === !1,
|
|
4916
4916
|
node: Z
|
|
4917
4917
|
};
|
|
4918
4918
|
}
|
|
4919
4919
|
function D(ne) {
|
|
4920
|
-
const Z =
|
|
4920
|
+
const Z = j(/^<([^?!</>\s]+)\s*/);
|
|
4921
4921
|
if (!Z)
|
|
4922
4922
|
return;
|
|
4923
4923
|
const J = {
|
|
@@ -4926,19 +4926,19 @@ function ta() {
|
|
|
4926
4926
|
attributes: {},
|
|
4927
4927
|
children: []
|
|
4928
4928
|
}, he = ne ? !1 : o.options.filter(J) === !1;
|
|
4929
|
-
for (; !(
|
|
4929
|
+
for (; !(z() || ie(">") || ie("?>") || ie("/>")); ) {
|
|
4930
4930
|
const ve = oe();
|
|
4931
4931
|
if (ve)
|
|
4932
4932
|
J.attributes[ve.name] = ve.value;
|
|
4933
4933
|
else
|
|
4934
4934
|
return;
|
|
4935
4935
|
}
|
|
4936
|
-
if (
|
|
4936
|
+
if (j(/^\s*\/>/))
|
|
4937
4937
|
return J.children = null, {
|
|
4938
4938
|
excluded: he,
|
|
4939
4939
|
node: J
|
|
4940
4940
|
};
|
|
4941
|
-
|
|
4941
|
+
j(/\??>/);
|
|
4942
4942
|
let de = d();
|
|
4943
4943
|
for (; de; )
|
|
4944
4944
|
de.excluded || J.children.push(de.node), de = d();
|
|
@@ -4949,14 +4949,14 @@ function ta() {
|
|
|
4949
4949
|
else
|
|
4950
4950
|
throw new s("Failed to parse XML", `Closing tag not matching "${ve}"`);
|
|
4951
4951
|
} else
|
|
4952
|
-
|
|
4952
|
+
j(/^<\/[\w-:.\u00C0-\u00FF]+\s*>/);
|
|
4953
4953
|
return {
|
|
4954
4954
|
excluded: he,
|
|
4955
4955
|
node: J
|
|
4956
4956
|
};
|
|
4957
4957
|
}
|
|
4958
|
-
function
|
|
4959
|
-
const ne =
|
|
4958
|
+
function R() {
|
|
4959
|
+
const ne = j(/^<!DOCTYPE\s+\S+\s+SYSTEM[^>]*>/) || j(/^<!DOCTYPE\s+\S+\s+PUBLIC[^>]*>/) || j(/^<!DOCTYPE\s+\S+\s*\[[^\]]*]>/) || j(/^<!DOCTYPE\s+\S+\s*>/);
|
|
4960
4960
|
if (ne) {
|
|
4961
4961
|
const Z = {
|
|
4962
4962
|
type: "DocumentType",
|
|
@@ -4968,7 +4968,7 @@ function ta() {
|
|
|
4968
4968
|
};
|
|
4969
4969
|
}
|
|
4970
4970
|
}
|
|
4971
|
-
function
|
|
4971
|
+
function K() {
|
|
4972
4972
|
if (o.xml.startsWith("<![CDATA[")) {
|
|
4973
4973
|
const ne = o.xml.indexOf("]]>");
|
|
4974
4974
|
if (ne > -1) {
|
|
@@ -4983,8 +4983,8 @@ function ta() {
|
|
|
4983
4983
|
}
|
|
4984
4984
|
}
|
|
4985
4985
|
}
|
|
4986
|
-
function
|
|
4987
|
-
const ne =
|
|
4986
|
+
function B() {
|
|
4987
|
+
const ne = j(/^<!--[\s\S]*?-->/);
|
|
4988
4988
|
if (ne) {
|
|
4989
4989
|
const Z = {
|
|
4990
4990
|
type: "Comment",
|
|
@@ -4996,8 +4996,8 @@ function ta() {
|
|
|
4996
4996
|
};
|
|
4997
4997
|
}
|
|
4998
4998
|
}
|
|
4999
|
-
function
|
|
5000
|
-
const ne =
|
|
4999
|
+
function Y() {
|
|
5000
|
+
const ne = j(/^([^<]+)/);
|
|
5001
5001
|
if (ne) {
|
|
5002
5002
|
const Z = {
|
|
5003
5003
|
type: "Text",
|
|
@@ -5010,7 +5010,7 @@ function ta() {
|
|
|
5010
5010
|
}
|
|
5011
5011
|
}
|
|
5012
5012
|
function oe() {
|
|
5013
|
-
const ne =
|
|
5013
|
+
const ne = j(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);
|
|
5014
5014
|
if (ne)
|
|
5015
5015
|
return {
|
|
5016
5016
|
name: ne[1].trim(),
|
|
@@ -5020,12 +5020,12 @@ function ta() {
|
|
|
5020
5020
|
function M(ne) {
|
|
5021
5021
|
return ne.replace(/^['"]|['"]$/g, "");
|
|
5022
5022
|
}
|
|
5023
|
-
function
|
|
5023
|
+
function j(ne) {
|
|
5024
5024
|
const Z = o.xml.match(ne);
|
|
5025
5025
|
if (Z)
|
|
5026
5026
|
return o.xml = o.xml.slice(Z[0].length), Z;
|
|
5027
5027
|
}
|
|
5028
|
-
function
|
|
5028
|
+
function z() {
|
|
5029
5029
|
return o.xml.length === 0;
|
|
5030
5030
|
}
|
|
5031
5031
|
function ie(ne) {
|
|
@@ -5054,102 +5054,129 @@ function na() {
|
|
|
5054
5054
|
if (!M.options.indentation && !M.options.lineSeparator)
|
|
5055
5055
|
return;
|
|
5056
5056
|
M.content += M.options.lineSeparator;
|
|
5057
|
-
let
|
|
5058
|
-
for (
|
|
5057
|
+
let j;
|
|
5058
|
+
for (j = 0; j < M.level; j++)
|
|
5059
5059
|
M.content += M.options.indentation;
|
|
5060
5060
|
}
|
|
5061
5061
|
function f(M) {
|
|
5062
5062
|
M.content = M.content.replace(/ +$/, "");
|
|
5063
|
-
let
|
|
5064
|
-
for (
|
|
5063
|
+
let j;
|
|
5064
|
+
for (j = 0; j < M.level; j++)
|
|
5065
5065
|
M.content += M.options.indentation;
|
|
5066
5066
|
}
|
|
5067
|
-
function v(M,
|
|
5068
|
-
M.content +=
|
|
5067
|
+
function v(M, j) {
|
|
5068
|
+
M.content += j;
|
|
5069
5069
|
}
|
|
5070
|
-
function g(M,
|
|
5070
|
+
function g(M, j, z) {
|
|
5071
5071
|
if (M.type === "Element")
|
|
5072
|
-
|
|
5072
|
+
K(M, j, z);
|
|
5073
5073
|
else if (M.type === "ProcessingInstruction")
|
|
5074
|
-
|
|
5074
|
+
Y(M, j);
|
|
5075
5075
|
else if (typeof M.content == "string")
|
|
5076
|
-
D(M.content,
|
|
5076
|
+
D(M.content, j, z);
|
|
5077
5077
|
else
|
|
5078
5078
|
throw new Error("Unknown node type: " + M.type);
|
|
5079
5079
|
}
|
|
5080
|
-
function D(M,
|
|
5081
|
-
if (!
|
|
5080
|
+
function D(M, j, z) {
|
|
5081
|
+
if (!z) {
|
|
5082
5082
|
const ie = M.trim();
|
|
5083
|
-
(
|
|
5083
|
+
(j.options.lineSeparator || ie.length === 0) && (M = ie);
|
|
5084
5084
|
}
|
|
5085
|
-
M.length > 0 && (!
|
|
5085
|
+
M.length > 0 && (!z && j.content.length > 0 && d(j), v(j, M));
|
|
5086
5086
|
}
|
|
5087
|
-
function
|
|
5088
|
-
const
|
|
5089
|
-
return
|
|
5087
|
+
function R(M, j) {
|
|
5088
|
+
const z = "/" + M.join("/"), ie = M[M.length - 1];
|
|
5089
|
+
return j.includes(ie) || j.includes(z);
|
|
5090
5090
|
}
|
|
5091
|
-
function
|
|
5092
|
-
if (
|
|
5093
|
-
const ie =
|
|
5094
|
-
v(
|
|
5091
|
+
function K(M, j, z) {
|
|
5092
|
+
if (j.path.push(M.name), !z && j.content.length > 0 && d(j), v(j, "<" + M.name), B(j, M.attributes), M.children === null || j.options.forceSelfClosingEmptyTag && M.children.length === 0) {
|
|
5093
|
+
const ie = j.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
|
|
5094
|
+
v(j, ie);
|
|
5095
5095
|
} else if (M.children.length === 0)
|
|
5096
|
-
v(
|
|
5096
|
+
v(j, "></" + M.name + ">");
|
|
5097
5097
|
else {
|
|
5098
5098
|
const ie = M.children;
|
|
5099
|
-
v(
|
|
5100
|
-
let ye = M.attributes["xml:space"] === "preserve" ||
|
|
5101
|
-
if (!ye &&
|
|
5099
|
+
v(j, ">"), j.level++;
|
|
5100
|
+
let ye = M.attributes["xml:space"] === "preserve" || z, ne = !1;
|
|
5101
|
+
if (!ye && j.options.ignoredPaths && (ne = R(j.path, j.options.ignoredPaths), ye = ne), !ye && j.options.collapseContent) {
|
|
5102
5102
|
let Z = !1, J = !1, he = !1;
|
|
5103
5103
|
ie.forEach(function(de, ve) {
|
|
5104
5104
|
de.type === "Text" ? (de.content.includes(`
|
|
5105
|
-
`) ? (J = !0, de.content = de.content.trim()) : (ve === 0 || ve === ie.length - 1) && !
|
|
5105
|
+
`) ? (J = !0, de.content = de.content.trim()) : (ve === 0 || ve === ie.length - 1) && !z && de.content.trim().length === 0 && (de.content = ""), (de.content.trim().length > 0 || ie.length === 1) && (Z = !0)) : de.type === "CDATA" ? Z = !0 : he = !0;
|
|
5106
5106
|
}), Z && (!he || !J) && (ye = !0);
|
|
5107
5107
|
}
|
|
5108
5108
|
ie.forEach(function(Z) {
|
|
5109
|
-
g(Z,
|
|
5110
|
-
}),
|
|
5109
|
+
g(Z, j, z || ye);
|
|
5110
|
+
}), j.level--, !z && !ye && d(j), ne && f(j), v(j, "</" + M.name + ">");
|
|
5111
5111
|
}
|
|
5112
|
-
|
|
5112
|
+
j.path.pop();
|
|
5113
5113
|
}
|
|
5114
|
-
function
|
|
5115
|
-
Object.keys(
|
|
5114
|
+
function B(M, j) {
|
|
5115
|
+
Object.keys(j).forEach(function(z) {
|
|
5116
5116
|
if (M.options.attributeQuotes === "single") {
|
|
5117
|
-
const ie =
|
|
5118
|
-
v(M, " " +
|
|
5117
|
+
const ie = j[z].replace(/'/g, "'");
|
|
5118
|
+
v(M, " " + z + "='" + ie + "'");
|
|
5119
5119
|
} else {
|
|
5120
|
-
const ie =
|
|
5121
|
-
v(M, " " +
|
|
5120
|
+
const ie = j[z].replace(/"/g, """);
|
|
5121
|
+
v(M, " " + z + '="' + ie + '"');
|
|
5122
5122
|
}
|
|
5123
5123
|
});
|
|
5124
5124
|
}
|
|
5125
|
-
function
|
|
5126
|
-
|
|
5125
|
+
function Y(M, j) {
|
|
5126
|
+
j.content.length > 0 && d(j), v(j, "<?" + M.name), v(j, " " + M.content.trim()), v(j, "?>");
|
|
5127
5127
|
}
|
|
5128
|
-
function oe(M,
|
|
5129
|
-
|
|
5130
|
-
`,
|
|
5128
|
+
function oe(M, j = {}) {
|
|
5129
|
+
j.indentation = "indentation" in j ? j.indentation : " ", j.collapseContent = j.collapseContent === !0, j.lineSeparator = "lineSeparator" in j ? j.lineSeparator : `\r
|
|
5130
|
+
`, j.whiteSpaceAtEndOfSelfclosingTag = j.whiteSpaceAtEndOfSelfclosingTag === !0, j.throwOnFailure = j.throwOnFailure !== !1, j.attributeQuotes = "attributeQuotes" in j ? j.attributeQuotes : "double";
|
|
5131
5131
|
try {
|
|
5132
|
-
const
|
|
5133
|
-
return
|
|
5132
|
+
const z = (0, o.default)(M, { filter: j.filter, strictMode: j.strictMode }), ie = { content: "", level: 0, options: j, path: [] };
|
|
5133
|
+
return z.declaration && Y(z.declaration, ie), z.children.forEach(function(ye) {
|
|
5134
5134
|
g(ye, ie, !1);
|
|
5135
|
-
}),
|
|
5136
|
-
`).replace(/\n/g,
|
|
5137
|
-
} catch (
|
|
5138
|
-
if (
|
|
5139
|
-
throw
|
|
5135
|
+
}), j.lineSeparator ? ie.content.replace(/\r\n/g, `
|
|
5136
|
+
`).replace(/\n/g, j.lineSeparator) : ie.content;
|
|
5137
|
+
} catch (z) {
|
|
5138
|
+
if (j.throwOnFailure)
|
|
5139
|
+
throw z;
|
|
5140
5140
|
return M;
|
|
5141
5141
|
}
|
|
5142
5142
|
}
|
|
5143
|
-
oe.minify = (M,
|
|
5143
|
+
oe.minify = (M, j = {}) => oe(M, Object.assign(Object.assign({}, j), { indentation: "", lineSeparator: "" })), m.exports = oe, r.default = oe;
|
|
5144
5144
|
})(Qt, Qt.exports)), Qt.exports;
|
|
5145
5145
|
}
|
|
5146
5146
|
var ra = /* @__PURE__ */ na();
|
|
5147
|
-
const
|
|
5148
|
-
function
|
|
5147
|
+
const ia = /* @__PURE__ */ ji(ra);
|
|
5148
|
+
function oa(m) {
|
|
5149
|
+
return ia(m);
|
|
5150
|
+
}
|
|
5151
|
+
const Mi = "_temp-idb-id";
|
|
5152
|
+
async function aa(m) {
|
|
5153
|
+
const { extension: r, xmlDocument: s, filename: o } = m, g = `<?xml version="1.0" encoding="UTF-8"?>
|
|
5154
|
+
` + new XMLSerializer().serializeToString(s), D = oa(g), R = new Blob([D], { type: "application/xml" });
|
|
5155
|
+
if ("showSaveFilePicker" in window)
|
|
5156
|
+
try {
|
|
5157
|
+
const B = await (await window.showSaveFilePicker({
|
|
5158
|
+
suggestedName: o,
|
|
5159
|
+
types: [
|
|
5160
|
+
{
|
|
5161
|
+
description: `${r.replace(/^\./, "").toUpperCase()} Files`,
|
|
5162
|
+
accept: { "application/xml": [r] }
|
|
5163
|
+
}
|
|
5164
|
+
]
|
|
5165
|
+
})).createWritable();
|
|
5166
|
+
await B.write(R), await B.close();
|
|
5167
|
+
} catch (K) {
|
|
5168
|
+
K.name !== "AbortError" && console.error("Save failed:", K);
|
|
5169
|
+
}
|
|
5170
|
+
else {
|
|
5171
|
+
const K = URL.createObjectURL(R), B = document.createElement("a");
|
|
5172
|
+
B.href = K, B.download = o, document.body.appendChild(B), B.click(), B.remove(), URL.revokeObjectURL(K);
|
|
5173
|
+
}
|
|
5174
|
+
}
|
|
5175
|
+
function sa(m) {
|
|
5149
5176
|
const { records: r, config: s, withDatabaseIds: o = !1 } = m, d = /* @__PURE__ */ new Map();
|
|
5150
5177
|
let f;
|
|
5151
|
-
for (const
|
|
5152
|
-
d.set(
|
|
5178
|
+
for (const R of r)
|
|
5179
|
+
d.set(R.id, R), R.tagName === s.rootElementName && (f = R);
|
|
5153
5180
|
we(f, {
|
|
5154
5181
|
detail: `No ${s.rootElementName} root element found in records`,
|
|
5155
5182
|
key: "EXPORT_ROOT_NOT_FOUND"
|
|
@@ -5175,38 +5202,38 @@ function Ki(m) {
|
|
|
5175
5202
|
const { index: r, config: s, withDatabaseIds: o, xmlDocument: d, parentRecord: f, parentElement: v } = m;
|
|
5176
5203
|
if (!f.children || f.children.length === 0) return;
|
|
5177
5204
|
const g = [];
|
|
5178
|
-
for (const
|
|
5179
|
-
const
|
|
5180
|
-
we(
|
|
5181
|
-
detail: `Parent '${f.tagName}' references non-existent child '${
|
|
5205
|
+
for (const R of f.children) {
|
|
5206
|
+
const K = r.get(R.id);
|
|
5207
|
+
we(K, {
|
|
5208
|
+
detail: `Parent '${f.tagName}' references non-existent child '${R.tagName}' (id: ${R.id})`,
|
|
5182
5209
|
key: "EXPORT_ORPHAN_CHILD_REF",
|
|
5183
5210
|
ref: { tagName: f.tagName, id: f.id }
|
|
5184
|
-
}), g.push(
|
|
5211
|
+
}), g.push(K);
|
|
5185
5212
|
}
|
|
5186
|
-
const D =
|
|
5213
|
+
const D = ua({
|
|
5187
5214
|
parentTagName: f.tagName,
|
|
5188
5215
|
availableChildren: s.children,
|
|
5189
5216
|
childrenRecords: g
|
|
5190
5217
|
});
|
|
5191
|
-
for (const
|
|
5192
|
-
const
|
|
5218
|
+
for (const R of D) {
|
|
5219
|
+
const K = ca({
|
|
5193
5220
|
config: s,
|
|
5194
5221
|
document: d,
|
|
5195
|
-
record:
|
|
5222
|
+
record: R,
|
|
5196
5223
|
defaultNamespace: s.namespaces.default,
|
|
5197
5224
|
withDatabaseIds: o
|
|
5198
5225
|
});
|
|
5199
|
-
v.appendChild(
|
|
5226
|
+
v.appendChild(K), Ki({
|
|
5200
5227
|
index: r,
|
|
5201
5228
|
config: s,
|
|
5202
5229
|
withDatabaseIds: o,
|
|
5203
5230
|
xmlDocument: d,
|
|
5204
|
-
parentRecord:
|
|
5205
|
-
parentElement:
|
|
5231
|
+
parentRecord: R,
|
|
5232
|
+
parentElement: K
|
|
5206
5233
|
});
|
|
5207
5234
|
}
|
|
5208
5235
|
}
|
|
5209
|
-
function
|
|
5236
|
+
function ca(m) {
|
|
5210
5237
|
const { config: r, document: s, record: o, defaultNamespace: d, withDatabaseIds: f } = m, v = o.namespace.uri === d.uri;
|
|
5211
5238
|
let g;
|
|
5212
5239
|
return !v && o.namespace.prefix && o.namespace.prefix !== "xmlns" ? (Li({ config: r, document: s, namespace: o.namespace }), g = s.createElementNS(
|
|
@@ -5224,7 +5251,7 @@ function oa(m) {
|
|
|
5224
5251
|
function qi(m) {
|
|
5225
5252
|
const { config: r, document: s, element: o, attributes: d, tagName: f, isRoot: v } = m;
|
|
5226
5253
|
for (const g of d) {
|
|
5227
|
-
if (
|
|
5254
|
+
if (la(g) || !v && fa({ config: r, tagName: f, attribute: g })) continue;
|
|
5228
5255
|
if (!$i(g) || !g.namespace.prefix) {
|
|
5229
5256
|
o.setAttribute(g.name, String(g.value));
|
|
5230
5257
|
continue;
|
|
@@ -5253,13 +5280,13 @@ function Ui(m) {
|
|
|
5253
5280
|
const D = Vi(v);
|
|
5254
5281
|
if (!(g.namespace ? s.hasAttributeNS(g.namespace.uri, D) : s.hasAttribute(D)))
|
|
5255
5282
|
if (g.namespace) {
|
|
5256
|
-
const
|
|
5257
|
-
s.setAttributeNS(g.namespace.uri,
|
|
5283
|
+
const K = `${g.namespace.prefix}:${D}`;
|
|
5284
|
+
s.setAttributeNS(g.namespace.uri, K, g.default || "");
|
|
5258
5285
|
} else
|
|
5259
5286
|
s.setAttribute(D, g.default || "");
|
|
5260
5287
|
}
|
|
5261
5288
|
}
|
|
5262
|
-
function
|
|
5289
|
+
function ua(m) {
|
|
5263
5290
|
const { parentTagName: r, availableChildren: s, childrenRecords: o } = m, d = new Set(s[r]);
|
|
5264
5291
|
if (!d.size) return o;
|
|
5265
5292
|
const f = /* @__PURE__ */ new Map(), v = [];
|
|
@@ -5269,8 +5296,8 @@ function aa(m) {
|
|
|
5269
5296
|
d.has(D.tagName) ? f.get(D.tagName)?.push(D) : v.push(D);
|
|
5270
5297
|
const g = [];
|
|
5271
5298
|
for (const D of d) {
|
|
5272
|
-
const
|
|
5273
|
-
|
|
5299
|
+
const R = f.get(D);
|
|
5300
|
+
R && R.length && g.push(...R);
|
|
5274
5301
|
}
|
|
5275
5302
|
return g.push(...v), g;
|
|
5276
5303
|
}
|
|
@@ -5281,10 +5308,10 @@ function Vi(m) {
|
|
|
5281
5308
|
function $i(m) {
|
|
5282
5309
|
return m !== null && typeof m == "object" && "namespace" in m && !!m.namespace;
|
|
5283
5310
|
}
|
|
5284
|
-
function
|
|
5311
|
+
function la(m) {
|
|
5285
5312
|
return !!(m.name === "xmlns" || m.name.startsWith("xmlns:") || $i(m) && m.namespace?.prefix === "xmlns");
|
|
5286
5313
|
}
|
|
5287
|
-
function
|
|
5314
|
+
function fa(m) {
|
|
5288
5315
|
const { config: r, tagName: s, attribute: o } = m;
|
|
5289
5316
|
if (!r.elements.includes(s)) return !1;
|
|
5290
5317
|
const d = r.definition[s];
|
|
@@ -5292,7 +5319,7 @@ function ca(m) {
|
|
|
5292
5319
|
const f = d.attributes.details[o.name];
|
|
5293
5320
|
return !(!f || f.required || f.default === void 0 || String(o.value) !== f.default || d.attributes.identityFields?.includes(o.name));
|
|
5294
5321
|
}
|
|
5295
|
-
class
|
|
5322
|
+
class da {
|
|
5296
5323
|
constructor() {
|
|
5297
5324
|
this.pendingChildren = /* @__PURE__ */ new Map();
|
|
5298
5325
|
}
|
|
@@ -5320,21 +5347,21 @@ class ua {
|
|
|
5320
5347
|
return this.pendingChildren.size;
|
|
5321
5348
|
}
|
|
5322
5349
|
}
|
|
5323
|
-
function
|
|
5350
|
+
function ha(m) {
|
|
5324
5351
|
return "prefix" in m && "uri" in m && !!m.prefix && !!m.uri;
|
|
5325
5352
|
}
|
|
5326
5353
|
var yr = {};
|
|
5327
|
-
const
|
|
5354
|
+
const ma = {}, pa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5328
5355
|
__proto__: null,
|
|
5329
|
-
default:
|
|
5330
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
5356
|
+
default: ma
|
|
5357
|
+
}, Symbol.toStringTag, { value: "Module" })), ga = /* @__PURE__ */ Yo(pa);
|
|
5331
5358
|
var mi;
|
|
5332
|
-
function
|
|
5359
|
+
function ya() {
|
|
5333
5360
|
return mi || (mi = 1, (function(m) {
|
|
5334
5361
|
(function(r) {
|
|
5335
5362
|
r.parser = function(l, c) {
|
|
5336
5363
|
return new o(l, c);
|
|
5337
|
-
}, r.SAXParser = o, r.SAXStream =
|
|
5364
|
+
}, r.SAXParser = o, r.SAXStream = B, r.createStream = R, r.MAX_BUFFER_LENGTH = 64 * 1024;
|
|
5338
5365
|
var s = [
|
|
5339
5366
|
"comment",
|
|
5340
5367
|
"sgmlDecl",
|
|
@@ -5372,22 +5399,22 @@ function ma() {
|
|
|
5372
5399
|
function o(l, c) {
|
|
5373
5400
|
if (!(this instanceof o))
|
|
5374
5401
|
return new o(l, c);
|
|
5375
|
-
var
|
|
5376
|
-
f(
|
|
5402
|
+
var I = this;
|
|
5403
|
+
f(I), I.q = I.c = "", I.bufferCheckPosition = r.MAX_BUFFER_LENGTH, I.encoding = null, I.opt = c || {}, I.opt.lowercase = I.opt.lowercase || I.opt.lowercasetags, I.looseCase = I.opt.lowercase ? "toLowerCase" : "toUpperCase", I.opt.maxEntityCount = I.opt.maxEntityCount || 512, I.opt.maxEntityDepth = I.opt.maxEntityDepth || 4, I.entityCount = I.entityDepth = 0, I.tags = [], I.closed = I.closedRoot = I.sawRoot = !1, I.tag = I.error = null, I.strict = !!l, I.noscript = !!(l || I.opt.noscript), I.state = S.BEGIN, I.strictEntities = I.opt.strictEntities, I.ENTITIES = I.strictEntities ? Object.create(r.XML_ENTITIES) : Object.create(r.ENTITIES), I.attribList = [], I.opt.xmlns && (I.ns = Object.create(z)), I.opt.unquotedAttributeValues === void 0 && (I.opt.unquotedAttributeValues = !l), I.trackPosition = I.opt.position !== !1, I.trackPosition && (I.position = I.line = I.column = 0), Ue(I, "onready");
|
|
5377
5404
|
}
|
|
5378
5405
|
Object.create || (Object.create = function(l) {
|
|
5379
5406
|
function c() {
|
|
5380
5407
|
}
|
|
5381
5408
|
c.prototype = l;
|
|
5382
|
-
var
|
|
5383
|
-
return
|
|
5409
|
+
var I = new c();
|
|
5410
|
+
return I;
|
|
5384
5411
|
}), Object.keys || (Object.keys = function(l) {
|
|
5385
5412
|
var c = [];
|
|
5386
|
-
for (var
|
|
5413
|
+
for (var I in l) l.hasOwnProperty(I) && c.push(I);
|
|
5387
5414
|
return c;
|
|
5388
5415
|
});
|
|
5389
5416
|
function d(l) {
|
|
5390
|
-
for (var c = Math.max(r.MAX_BUFFER_LENGTH, 10),
|
|
5417
|
+
for (var c = Math.max(r.MAX_BUFFER_LENGTH, 10), I = 0, E = 0, le = s.length; E < le; E++) {
|
|
5391
5418
|
var be = l[s[E]].length;
|
|
5392
5419
|
if (be > c)
|
|
5393
5420
|
switch (s[E]) {
|
|
@@ -5403,13 +5430,13 @@ function ma() {
|
|
|
5403
5430
|
default:
|
|
5404
5431
|
ke(l, "Max buffer length exceeded: " + s[E]);
|
|
5405
5432
|
}
|
|
5406
|
-
|
|
5433
|
+
I = Math.max(I, be);
|
|
5407
5434
|
}
|
|
5408
|
-
var xe = r.MAX_BUFFER_LENGTH -
|
|
5435
|
+
var xe = r.MAX_BUFFER_LENGTH - I;
|
|
5409
5436
|
l.bufferCheckPosition = xe + l.position;
|
|
5410
5437
|
}
|
|
5411
5438
|
function f(l) {
|
|
5412
|
-
for (var c = 0,
|
|
5439
|
+
for (var c = 0, I = s.length; c < I; c++)
|
|
5413
5440
|
l[s[c]] = "";
|
|
5414
5441
|
}
|
|
5415
5442
|
function v(l) {
|
|
@@ -5432,7 +5459,7 @@ function ma() {
|
|
|
5432
5459
|
};
|
|
5433
5460
|
var g;
|
|
5434
5461
|
try {
|
|
5435
|
-
g =
|
|
5462
|
+
g = ga.Stream;
|
|
5436
5463
|
} catch {
|
|
5437
5464
|
g = function() {
|
|
5438
5465
|
};
|
|
@@ -5442,10 +5469,10 @@ function ma() {
|
|
|
5442
5469
|
var D = r.EVENTS.filter(function(l) {
|
|
5443
5470
|
return l !== "error" && l !== "end";
|
|
5444
5471
|
});
|
|
5445
|
-
function
|
|
5446
|
-
return new
|
|
5472
|
+
function R(l, c) {
|
|
5473
|
+
return new B(l, c);
|
|
5447
5474
|
}
|
|
5448
|
-
function
|
|
5475
|
+
function K(l, c) {
|
|
5449
5476
|
if (l.length >= 2) {
|
|
5450
5477
|
if (l[0] === 255 && l[1] === 254)
|
|
5451
5478
|
return "utf-16le";
|
|
@@ -5454,43 +5481,43 @@ function ma() {
|
|
|
5454
5481
|
}
|
|
5455
5482
|
return l.length >= 3 && l[0] === 239 && l[1] === 187 && l[2] === 191 ? "utf8" : l.length >= 4 ? l[0] === 60 && l[1] === 0 && l[2] === 63 && l[3] === 0 ? "utf-16le" : l[0] === 0 && l[1] === 60 && l[2] === 0 && l[3] === 63 ? "utf-16be" : "utf8" : c ? "utf8" : null;
|
|
5456
5483
|
}
|
|
5457
|
-
function
|
|
5458
|
-
if (!(this instanceof
|
|
5459
|
-
return new
|
|
5484
|
+
function B(l, c) {
|
|
5485
|
+
if (!(this instanceof B))
|
|
5486
|
+
return new B(l, c);
|
|
5460
5487
|
g.apply(this), this._parser = new o(l, c), this.writable = !0, this.readable = !0;
|
|
5461
|
-
var
|
|
5488
|
+
var I = this;
|
|
5462
5489
|
this._parser.onend = function() {
|
|
5463
|
-
|
|
5490
|
+
I.emit("end");
|
|
5464
5491
|
}, this._parser.onerror = function(E) {
|
|
5465
|
-
|
|
5492
|
+
I.emit("error", E), I._parser.error = null;
|
|
5466
5493
|
}, this._decoder = null, this._decoderBuffer = null, D.forEach(function(E) {
|
|
5467
|
-
Object.defineProperty(
|
|
5494
|
+
Object.defineProperty(I, "on" + E, {
|
|
5468
5495
|
get: function() {
|
|
5469
|
-
return
|
|
5496
|
+
return I._parser["on" + E];
|
|
5470
5497
|
},
|
|
5471
5498
|
set: function(le) {
|
|
5472
5499
|
if (!le)
|
|
5473
|
-
return
|
|
5474
|
-
|
|
5500
|
+
return I.removeAllListeners(E), I._parser["on" + E] = le, le;
|
|
5501
|
+
I.on(E, le);
|
|
5475
5502
|
},
|
|
5476
5503
|
enumerable: !0,
|
|
5477
5504
|
configurable: !1
|
|
5478
5505
|
});
|
|
5479
5506
|
});
|
|
5480
5507
|
}
|
|
5481
|
-
|
|
5508
|
+
B.prototype = Object.create(g.prototype, {
|
|
5482
5509
|
constructor: {
|
|
5483
|
-
value:
|
|
5510
|
+
value: B
|
|
5484
5511
|
}
|
|
5485
|
-
}),
|
|
5512
|
+
}), B.prototype._decodeBuffer = function(l, c) {
|
|
5486
5513
|
if (this._decoderBuffer && (l = Buffer.concat([this._decoderBuffer, l]), this._decoderBuffer = null), !this._decoder) {
|
|
5487
|
-
var
|
|
5488
|
-
if (!
|
|
5514
|
+
var I = K(l, c);
|
|
5515
|
+
if (!I)
|
|
5489
5516
|
return this._decoderBuffer = l, "";
|
|
5490
|
-
this._parser.encoding =
|
|
5517
|
+
this._parser.encoding = I, this._decoder = new TextDecoder(I);
|
|
5491
5518
|
}
|
|
5492
5519
|
return this._decoder.decode(l, { stream: !c });
|
|
5493
|
-
},
|
|
5520
|
+
}, B.prototype.write = function(l) {
|
|
5494
5521
|
if (typeof Buffer == "function" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(l))
|
|
5495
5522
|
l = this._decodeBuffer(l, !1);
|
|
5496
5523
|
else if (this._decoderBuffer) {
|
|
@@ -5498,23 +5525,23 @@ function ma() {
|
|
|
5498
5525
|
c && (this._parser.write(c), this.emit("data", c));
|
|
5499
5526
|
}
|
|
5500
5527
|
return this._parser.write(l.toString()), this.emit("data", l), !0;
|
|
5501
|
-
},
|
|
5528
|
+
}, B.prototype.end = function(l) {
|
|
5502
5529
|
if (l && l.length && this.write(l), this._decoderBuffer) {
|
|
5503
5530
|
var c = this._decodeBuffer(Buffer.alloc(0), !0);
|
|
5504
5531
|
c && (this._parser.write(c), this.emit("data", c));
|
|
5505
5532
|
} else if (this._decoder) {
|
|
5506
|
-
var
|
|
5507
|
-
|
|
5533
|
+
var I = this._decoder.decode();
|
|
5534
|
+
I && (this._parser.write(I), this.emit("data", I));
|
|
5508
5535
|
}
|
|
5509
5536
|
return this._parser.end(), !0;
|
|
5510
|
-
},
|
|
5511
|
-
var
|
|
5512
|
-
return !
|
|
5537
|
+
}, B.prototype.on = function(l, c) {
|
|
5538
|
+
var I = this;
|
|
5539
|
+
return !I._parser["on" + l] && D.indexOf(l) !== -1 && (I._parser["on" + l] = function() {
|
|
5513
5540
|
var E = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
|
|
5514
|
-
E.splice(0, 0, l),
|
|
5515
|
-
}), g.prototype.on.call(
|
|
5541
|
+
E.splice(0, 0, l), I.emit.apply(I, E);
|
|
5542
|
+
}), g.prototype.on.call(I, l, c);
|
|
5516
5543
|
};
|
|
5517
|
-
var
|
|
5544
|
+
var Y = "[CDATA[", oe = "DOCTYPE", M = "http://www.w3.org/XML/1998/namespace", j = "http://www.w3.org/2000/xmlns/", z = { xml: M, xmlns: j }, ie = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ye = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, ne = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, Z = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
|
|
5518
5545
|
function J(l) {
|
|
5519
5546
|
return l === " " || l === `
|
|
5520
5547
|
` || l === "\r" || l === " ";
|
|
@@ -5866,16 +5893,16 @@ function ma() {
|
|
|
5866
5893
|
hearts: 9829,
|
|
5867
5894
|
diams: 9830
|
|
5868
5895
|
}, Object.keys(r.ENTITIES).forEach(function(l) {
|
|
5869
|
-
var c = r.ENTITIES[l],
|
|
5870
|
-
r.ENTITIES[l] =
|
|
5896
|
+
var c = r.ENTITIES[l], I = typeof c == "number" ? String.fromCharCode(c) : c;
|
|
5897
|
+
r.ENTITIES[l] = I;
|
|
5871
5898
|
});
|
|
5872
5899
|
for (var Bt in r.STATE)
|
|
5873
5900
|
r.STATE[r.STATE[Bt]] = Bt;
|
|
5874
5901
|
S = r.STATE;
|
|
5875
|
-
function Ue(l, c,
|
|
5876
|
-
l[c] && l[c](
|
|
5902
|
+
function Ue(l, c, I) {
|
|
5903
|
+
l[c] && l[c](I);
|
|
5877
5904
|
}
|
|
5878
|
-
function
|
|
5905
|
+
function He(l) {
|
|
5879
5906
|
var c = l && l.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);
|
|
5880
5907
|
return c ? c[2] : null;
|
|
5881
5908
|
}
|
|
@@ -5883,20 +5910,20 @@ function ma() {
|
|
|
5883
5910
|
return l ? l.toLowerCase().replace(/[^a-z0-9]/g, "") : null;
|
|
5884
5911
|
}
|
|
5885
5912
|
function jt(l, c) {
|
|
5886
|
-
const
|
|
5887
|
-
return !
|
|
5913
|
+
const I = Jt(l), E = Jt(c);
|
|
5914
|
+
return !I || !E ? !0 : E === "utf16" ? I === "utf16le" || I === "utf16be" : I === E;
|
|
5888
5915
|
}
|
|
5889
5916
|
function Mt(l, c) {
|
|
5890
5917
|
if (!(!l.strict || !l.encoding || !c || c.name !== "xml")) {
|
|
5891
|
-
var
|
|
5892
|
-
|
|
5918
|
+
var I = He(c.body);
|
|
5919
|
+
I && !jt(l.encoding, I) && fe(
|
|
5893
5920
|
l,
|
|
5894
|
-
"XML declaration encoding " +
|
|
5921
|
+
"XML declaration encoding " + I + " does not match detected stream encoding " + l.encoding.toUpperCase()
|
|
5895
5922
|
);
|
|
5896
5923
|
}
|
|
5897
5924
|
}
|
|
5898
|
-
function _e(l, c,
|
|
5899
|
-
l.textNode && Ke(l), Ue(l, c,
|
|
5925
|
+
function _e(l, c, I) {
|
|
5926
|
+
l.textNode && Ke(l), Ue(l, c, I);
|
|
5900
5927
|
}
|
|
5901
5928
|
function Ke(l) {
|
|
5902
5929
|
l.textNode = Qe(l.opt, l.textNode), l.textNode && Ue(l, "ontext", l.textNode), l.textNode = "";
|
|
@@ -5920,11 +5947,11 @@ Char: ` + l.c), c = new Error(c), l.error = c, Ue(l, "onerror", c), l;
|
|
|
5920
5947
|
}
|
|
5921
5948
|
function tt(l) {
|
|
5922
5949
|
l.strict || (l.tagName = l.tagName[l.looseCase]());
|
|
5923
|
-
var c = l.tags[l.tags.length - 1] || l,
|
|
5924
|
-
l.opt.xmlns && (
|
|
5950
|
+
var c = l.tags[l.tags.length - 1] || l, I = l.tag = { name: l.tagName, attributes: {} };
|
|
5951
|
+
l.opt.xmlns && (I.ns = c.ns), l.attribList.length = 0, _e(l, "onopentagstart", I);
|
|
5925
5952
|
}
|
|
5926
5953
|
function Nt(l, c) {
|
|
5927
|
-
var
|
|
5954
|
+
var I = l.indexOf(":"), E = I < 0 ? ["", l] : l.split(":"), le = E[0], be = E[1];
|
|
5928
5955
|
return c && l === "xmlns" && (le = "xmlns", be = ""), { prefix: le, local: be };
|
|
5929
5956
|
}
|
|
5930
5957
|
function nt(l) {
|
|
@@ -5933,18 +5960,18 @@ Char: ` + l.c), c = new Error(c), l.error = c, Ue(l, "onerror", c), l;
|
|
|
5933
5960
|
return;
|
|
5934
5961
|
}
|
|
5935
5962
|
if (l.opt.xmlns) {
|
|
5936
|
-
var c = Nt(l.attribName, !0),
|
|
5937
|
-
if (
|
|
5963
|
+
var c = Nt(l.attribName, !0), I = c.prefix, E = c.local;
|
|
5964
|
+
if (I === "xmlns")
|
|
5938
5965
|
if (E === "xml" && l.attribValue !== M)
|
|
5939
5966
|
fe(
|
|
5940
5967
|
l,
|
|
5941
5968
|
"xml: prefix must be bound to " + M + `
|
|
5942
5969
|
Actual: ` + l.attribValue
|
|
5943
5970
|
);
|
|
5944
|
-
else if (E === "xmlns" && l.attribValue !==
|
|
5971
|
+
else if (E === "xmlns" && l.attribValue !== j)
|
|
5945
5972
|
fe(
|
|
5946
5973
|
l,
|
|
5947
|
-
"xmlns: prefix must be bound to " +
|
|
5974
|
+
"xmlns: prefix must be bound to " + j + `
|
|
5948
5975
|
Actual: ` + l.attribValue
|
|
5949
5976
|
);
|
|
5950
5977
|
else {
|
|
@@ -5961,20 +5988,20 @@ Actual: ` + l.attribValue
|
|
|
5961
5988
|
}
|
|
5962
5989
|
function Me(l, c) {
|
|
5963
5990
|
if (l.opt.xmlns) {
|
|
5964
|
-
var
|
|
5965
|
-
|
|
5991
|
+
var I = l.tag, E = Nt(l.tagName);
|
|
5992
|
+
I.prefix = E.prefix, I.local = E.local, I.uri = I.ns[E.prefix] || "", I.prefix && !I.uri && (fe(
|
|
5966
5993
|
l,
|
|
5967
5994
|
"Unbound namespace prefix: " + JSON.stringify(l.tagName)
|
|
5968
|
-
),
|
|
5995
|
+
), I.uri = E.prefix);
|
|
5969
5996
|
var le = l.tags[l.tags.length - 1] || l;
|
|
5970
|
-
|
|
5997
|
+
I.ns && le.ns !== I.ns && Object.keys(I.ns).forEach(function(Ge) {
|
|
5971
5998
|
_e(l, "onopennamespace", {
|
|
5972
5999
|
prefix: Ge,
|
|
5973
|
-
uri:
|
|
6000
|
+
uri: I.ns[Ge]
|
|
5974
6001
|
});
|
|
5975
6002
|
});
|
|
5976
6003
|
for (var be = 0, xe = l.attribList.length; be < xe; be++) {
|
|
5977
|
-
var Re = l.attribList[be], Ae = Re[0], Ce = Re[1], Oe = Nt(Ae, !0), Be = Oe.prefix, en = Oe.local, rt = Be === "" ? "" :
|
|
6004
|
+
var Re = l.attribList[be], Ae = Re[0], Ce = Re[1], Oe = Nt(Ae, !0), Be = Oe.prefix, en = Oe.local, rt = Be === "" ? "" : I.ns[Be] || "", Ve = {
|
|
5978
6005
|
name: Ae,
|
|
5979
6006
|
value: Ce,
|
|
5980
6007
|
prefix: Be,
|
|
@@ -6002,9 +6029,9 @@ Actual: ` + l.attribValue
|
|
|
6002
6029
|
}
|
|
6003
6030
|
_e(l, "onscript", l.script), l.script = "";
|
|
6004
6031
|
}
|
|
6005
|
-
var c = l.tags.length,
|
|
6006
|
-
l.strict || (
|
|
6007
|
-
for (var E =
|
|
6032
|
+
var c = l.tags.length, I = l.tagName;
|
|
6033
|
+
l.strict || (I = I[l.looseCase]());
|
|
6034
|
+
for (var E = I; c--; ) {
|
|
6008
6035
|
var le = l.tags[c];
|
|
6009
6036
|
if (le.name !== E)
|
|
6010
6037
|
fe(l, "Unexpected close tag");
|
|
@@ -6015,7 +6042,7 @@ Actual: ` + l.attribValue
|
|
|
6015
6042
|
fe(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state = S.TEXT;
|
|
6016
6043
|
return;
|
|
6017
6044
|
}
|
|
6018
|
-
l.tagName =
|
|
6045
|
+
l.tagName = I;
|
|
6019
6046
|
for (var be = l.tags.length; be-- > c; ) {
|
|
6020
6047
|
var xe = l.tag = l.tags.pop();
|
|
6021
6048
|
l.tagName = l.tag.name, _e(l, "onclosetag", l.tagName);
|
|
@@ -6031,15 +6058,15 @@ Actual: ` + l.attribValue
|
|
|
6031
6058
|
c === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = S.TEXT;
|
|
6032
6059
|
}
|
|
6033
6060
|
function Pn(l) {
|
|
6034
|
-
var c = l.entity,
|
|
6035
|
-
return l.ENTITIES[c] ? l.ENTITIES[c] : l.ENTITIES[
|
|
6061
|
+
var c = l.entity, I = c.toLowerCase(), E, le = "";
|
|
6062
|
+
return l.ENTITIES[c] ? l.ENTITIES[c] : l.ENTITIES[I] ? l.ENTITIES[I] : (c = I, c.charAt(0) === "#" && (c.charAt(1) === "x" ? (c = c.slice(2), E = parseInt(c, 16), le = E.toString(16)) : (c = c.slice(1), E = parseInt(c, 10), le = E.toString(10))), c = c.replace(/^0+/, ""), isNaN(E) || le.toLowerCase() !== c || E < 0 || E > 1114111 ? (fe(l, "Invalid character entity"), "&" + l.entity + ";") : String.fromCodePoint(E));
|
|
6036
6063
|
}
|
|
6037
6064
|
function Q(l, c) {
|
|
6038
6065
|
c === "<" ? (l.state = S.OPEN_WAKA, l.startTagPosition = l.position) : J(c) || (fe(l, "Non-whitespace before first tag."), l.textNode = c, l.state = S.TEXT);
|
|
6039
6066
|
}
|
|
6040
6067
|
function Ct(l, c) {
|
|
6041
|
-
var
|
|
6042
|
-
return c < l.length && (
|
|
6068
|
+
var I = "";
|
|
6069
|
+
return c < l.length && (I = l.charAt(c)), I;
|
|
6043
6070
|
}
|
|
6044
6071
|
function Ot(l) {
|
|
6045
6072
|
var c = this;
|
|
@@ -6053,7 +6080,7 @@ Actual: ` + l.attribValue
|
|
|
6053
6080
|
if (l === null)
|
|
6054
6081
|
return Tt(c);
|
|
6055
6082
|
typeof l == "object" && (l = l.toString());
|
|
6056
|
-
for (var
|
|
6083
|
+
for (var I = 0, E = ""; E = Ct(l, I++), c.c = E, !!E; )
|
|
6057
6084
|
switch (c.trackPosition && (c.position++, E === `
|
|
6058
6085
|
` ? (c.line++, c.column = 0) : c.column++), c.state) {
|
|
6059
6086
|
case S.BEGIN:
|
|
@@ -6066,10 +6093,10 @@ Actual: ` + l.attribValue
|
|
|
6066
6093
|
continue;
|
|
6067
6094
|
case S.TEXT:
|
|
6068
6095
|
if (c.sawRoot && !c.closedRoot) {
|
|
6069
|
-
for (var be =
|
|
6070
|
-
E = Ct(l,
|
|
6096
|
+
for (var be = I - 1; E && E !== "<" && E !== "&"; )
|
|
6097
|
+
E = Ct(l, I++), E && c.trackPosition && (c.position++, E === `
|
|
6071
6098
|
` ? (c.line++, c.column = 0) : c.column++);
|
|
6072
|
-
c.textNode += l.substring(be,
|
|
6099
|
+
c.textNode += l.substring(be, I - 1);
|
|
6073
6100
|
}
|
|
6074
6101
|
E === "<" && !(c.sawRoot && c.closedRoot && !c.strict) ? (c.state = S.OPEN_WAKA, c.startTagPosition = c.position) : (!J(E) && (!c.sawRoot || c.closedRoot) && fe(c, "Text data outside of root node."), E === "&" ? c.state = S.TEXT_ENTITY : c.textNode += E);
|
|
6075
6102
|
continue;
|
|
@@ -6101,7 +6128,7 @@ Actual: ` + l.attribValue
|
|
|
6101
6128
|
c.state = S.COMMENT, c.comment = "", c.sgmlDecl = "";
|
|
6102
6129
|
continue;
|
|
6103
6130
|
}
|
|
6104
|
-
c.doctype && c.doctype !== !0 && c.sgmlDecl ? (c.state = S.DOCTYPE_DTD, c.doctype += "<!" + c.sgmlDecl + E, c.sgmlDecl = "") : (c.sgmlDecl + E).toUpperCase() ===
|
|
6131
|
+
c.doctype && c.doctype !== !0 && c.sgmlDecl ? (c.state = S.DOCTYPE_DTD, c.doctype += "<!" + c.sgmlDecl + E, c.sgmlDecl = "") : (c.sgmlDecl + E).toUpperCase() === Y ? (_e(c, "onopencdata"), c.state = S.CDATA, c.sgmlDecl = "", c.cdata = "") : (c.sgmlDecl + E).toUpperCase() === oe ? (c.state = S.DOCTYPE, (c.doctype || c.sawRoot) && fe(
|
|
6105
6132
|
c,
|
|
6106
6133
|
"Inappropriately located doctype declaration"
|
|
6107
6134
|
), c.doctype = "", c.sgmlDecl = "") : E === ">" ? (_e(c, "onsgmldeclaration", c.sgmlDecl), c.sgmlDecl = "", c.state = S.TEXT) : (he(E) && (c.state = S.SGML_DECL_QUOTED), c.sgmlDecl += E);
|
|
@@ -6131,10 +6158,10 @@ Actual: ` + l.attribValue
|
|
|
6131
6158
|
E !== ">" ? (fe(c, "Malformed comment"), c.comment += "--" + E, c.state = S.COMMENT) : c.doctype && c.doctype !== !0 ? c.state = S.DOCTYPE_DTD : c.state = S.TEXT;
|
|
6132
6159
|
continue;
|
|
6133
6160
|
case S.CDATA:
|
|
6134
|
-
for (var be =
|
|
6135
|
-
E = Ct(l,
|
|
6161
|
+
for (var be = I - 1; E && E !== "]"; )
|
|
6162
|
+
E = Ct(l, I++), E && c.trackPosition && (c.position++, E === `
|
|
6136
6163
|
` ? (c.line++, c.column = 0) : c.column++);
|
|
6137
|
-
c.cdata += l.substring(be,
|
|
6164
|
+
c.cdata += l.substring(be, I - 1), E === "]" && (c.state = S.CDATA_ENDING);
|
|
6138
6165
|
continue;
|
|
6139
6166
|
case S.CDATA_ENDING:
|
|
6140
6167
|
E === "]" ? c.state = S.CDATA_ENDING_2 : (c.cdata += "]" + E, c.state = S.CDATA);
|
|
@@ -6257,7 +6284,7 @@ Actual: ` + l.attribValue
|
|
|
6257
6284
|
return c.position >= c.bufferCheckPosition && d(c), c;
|
|
6258
6285
|
}
|
|
6259
6286
|
String.fromCodePoint || (function() {
|
|
6260
|
-
var l = String.fromCharCode, c = Math.floor,
|
|
6287
|
+
var l = String.fromCharCode, c = Math.floor, I = function() {
|
|
6261
6288
|
var E = 16384, le = [], be, xe, Re = -1, Ae = arguments.length;
|
|
6262
6289
|
if (!Ae)
|
|
6263
6290
|
return "";
|
|
@@ -6273,23 +6300,23 @@ Actual: ` + l.attribValue
|
|
|
6273
6300
|
return Ce;
|
|
6274
6301
|
};
|
|
6275
6302
|
Object.defineProperty ? Object.defineProperty(String, "fromCodePoint", {
|
|
6276
|
-
value:
|
|
6303
|
+
value: I,
|
|
6277
6304
|
configurable: !0,
|
|
6278
6305
|
writable: !0
|
|
6279
|
-
}) : String.fromCodePoint =
|
|
6306
|
+
}) : String.fromCodePoint = I;
|
|
6280
6307
|
})();
|
|
6281
6308
|
})(m);
|
|
6282
6309
|
})(yr)), yr;
|
|
6283
6310
|
}
|
|
6284
|
-
var
|
|
6285
|
-
function
|
|
6311
|
+
var va = ya();
|
|
6312
|
+
function ba(m) {
|
|
6286
6313
|
const { dialecteConfig: r, useCustomRecordsIds: s, session: o } = m, d = r.io.hooks;
|
|
6287
6314
|
let v = {
|
|
6288
6315
|
defaultNamespace: null,
|
|
6289
6316
|
stack: [],
|
|
6290
6317
|
recordsBatch: []
|
|
6291
6318
|
};
|
|
6292
|
-
const g =
|
|
6319
|
+
const g = va.parser(
|
|
6293
6320
|
!0,
|
|
6294
6321
|
// strict mode
|
|
6295
6322
|
{
|
|
@@ -6305,55 +6332,55 @@ function ga(m) {
|
|
|
6305
6332
|
// Enable namespace handling
|
|
6306
6333
|
}
|
|
6307
6334
|
);
|
|
6308
|
-
g.onopentag = (
|
|
6309
|
-
node:
|
|
6335
|
+
g.onopentag = (K) => v = wa({
|
|
6336
|
+
node: K,
|
|
6310
6337
|
state: v,
|
|
6311
6338
|
dialecteConfig: r,
|
|
6312
6339
|
useCustomRecordsIds: s
|
|
6313
|
-
}), g.ontext = (
|
|
6340
|
+
}), g.ontext = (K) => v = _a({ text: K, state: v }), g.onclosetag = () => ({ updatedState: v } = Ea({
|
|
6314
6341
|
state: v,
|
|
6315
6342
|
ioHooks: d,
|
|
6316
6343
|
session: o
|
|
6317
|
-
})), g.onerror =
|
|
6344
|
+
})), g.onerror = xa;
|
|
6318
6345
|
function D() {
|
|
6319
|
-
const
|
|
6320
|
-
return v.recordsBatch = [],
|
|
6346
|
+
const K = v.recordsBatch;
|
|
6347
|
+
return v.recordsBatch = [], K;
|
|
6321
6348
|
}
|
|
6322
|
-
function
|
|
6349
|
+
function R() {
|
|
6323
6350
|
return v.recordsBatch.length;
|
|
6324
6351
|
}
|
|
6325
6352
|
return {
|
|
6326
6353
|
parser: g,
|
|
6327
6354
|
drainBatch: D,
|
|
6328
|
-
getSize:
|
|
6355
|
+
getSize: R
|
|
6329
6356
|
};
|
|
6330
6357
|
}
|
|
6331
|
-
function
|
|
6332
|
-
const { node: r, state: s, dialecteConfig: o, useCustomRecordsIds: d } = m, f = { ...s }, v =
|
|
6333
|
-
f.defaultNamespace || (f.defaultNamespace =
|
|
6358
|
+
function wa(m) {
|
|
6359
|
+
const { node: r, state: s, dialecteConfig: o, useCustomRecordsIds: d } = m, f = { ...s }, v = Ta(r);
|
|
6360
|
+
f.defaultNamespace || (f.defaultNamespace = Na({
|
|
6334
6361
|
element: r,
|
|
6335
6362
|
defaultNamespace: o.namespaces.default,
|
|
6336
6363
|
rootElementName: o.rootElementName
|
|
6337
6364
|
}));
|
|
6338
|
-
const g =
|
|
6365
|
+
const g = Ca(r, f.defaultNamespace), D = Da({ attributes: r.attributes, useCustomRecordsIds: d }), R = Sa({
|
|
6339
6366
|
attributes: r.attributes,
|
|
6340
6367
|
useCustomRecordsIds: d
|
|
6341
|
-
}),
|
|
6368
|
+
}), K = Oa(R), B = Aa(s.stack), Y = {
|
|
6342
6369
|
id: D,
|
|
6343
6370
|
tagName: v,
|
|
6344
6371
|
namespace: g,
|
|
6345
|
-
attributes:
|
|
6372
|
+
attributes: K,
|
|
6346
6373
|
value: "",
|
|
6347
|
-
parent:
|
|
6374
|
+
parent: B,
|
|
6348
6375
|
children: []
|
|
6349
6376
|
};
|
|
6350
|
-
return f.stack.push(
|
|
6377
|
+
return f.stack.push(Y), f;
|
|
6351
6378
|
}
|
|
6352
|
-
function
|
|
6379
|
+
function _a(m) {
|
|
6353
6380
|
const { text: r, state: s } = m;
|
|
6354
6381
|
return r && s.stack.length > 0 && (s.stack[s.stack.length - 1].value += r), s;
|
|
6355
6382
|
}
|
|
6356
|
-
function
|
|
6383
|
+
function Ea(m) {
|
|
6357
6384
|
const { state: r, ioHooks: s, session: o } = m, d = r.stack.at(-1);
|
|
6358
6385
|
let f = r.stack.slice(0, -1);
|
|
6359
6386
|
const v = [...r.recordsBatch];
|
|
@@ -6364,7 +6391,7 @@ function ba(m) {
|
|
|
6364
6391
|
}), f.length) {
|
|
6365
6392
|
const g = f.length - 1;
|
|
6366
6393
|
f = f.map(
|
|
6367
|
-
(D,
|
|
6394
|
+
(D, R) => R === g ? {
|
|
6368
6395
|
...D,
|
|
6369
6396
|
children: [
|
|
6370
6397
|
...D.children,
|
|
@@ -6386,13 +6413,13 @@ function ba(m) {
|
|
|
6386
6413
|
}
|
|
6387
6414
|
};
|
|
6388
6415
|
}
|
|
6389
|
-
function
|
|
6416
|
+
function xa(m) {
|
|
6390
6417
|
return new Error(`XML parsing error: ${m}`);
|
|
6391
6418
|
}
|
|
6392
|
-
function
|
|
6419
|
+
function Ta(m) {
|
|
6393
6420
|
return m.local;
|
|
6394
6421
|
}
|
|
6395
|
-
function
|
|
6422
|
+
function Na(m) {
|
|
6396
6423
|
const { element: r, defaultNamespace: s, rootElementName: o } = m;
|
|
6397
6424
|
return we(r.name === o, {
|
|
6398
6425
|
detail: `Expected root element <${o}>, got <${r.name}>`
|
|
@@ -6401,13 +6428,13 @@ function Ea(m) {
|
|
|
6401
6428
|
uri: r.attributes.xmlns.value
|
|
6402
6429
|
} : s;
|
|
6403
6430
|
}
|
|
6404
|
-
function
|
|
6405
|
-
return
|
|
6431
|
+
function Ca(m, r) {
|
|
6432
|
+
return ha(m) ? {
|
|
6406
6433
|
prefix: m.prefix,
|
|
6407
6434
|
uri: m.uri
|
|
6408
6435
|
} : r;
|
|
6409
6436
|
}
|
|
6410
|
-
function
|
|
6437
|
+
function Oa(m) {
|
|
6411
6438
|
return m.map((r) => {
|
|
6412
6439
|
const s = r.prefix && r.uri ? {
|
|
6413
6440
|
prefix: r.prefix,
|
|
@@ -6420,64 +6447,64 @@ function Ta(m) {
|
|
|
6420
6447
|
};
|
|
6421
6448
|
});
|
|
6422
6449
|
}
|
|
6423
|
-
function
|
|
6450
|
+
function Aa(m) {
|
|
6424
6451
|
if (m.length === 0) return null;
|
|
6425
6452
|
const r = m[m.length - 1];
|
|
6426
6453
|
return r ? { id: r.id, tagName: r.tagName } : null;
|
|
6427
6454
|
}
|
|
6428
|
-
function
|
|
6455
|
+
function Da(m) {
|
|
6429
6456
|
const { attributes: r, useCustomRecordsIds: s } = m, o = r[gi];
|
|
6430
6457
|
return s && o && o.value ? o.value : crypto.randomUUID();
|
|
6431
6458
|
}
|
|
6432
|
-
function
|
|
6459
|
+
function Sa(m) {
|
|
6433
6460
|
const { attributes: r, useCustomRecordsIds: s } = m;
|
|
6434
6461
|
return s ? Object.values(r).filter((o) => o.name !== gi) : Object.values(r);
|
|
6435
6462
|
}
|
|
6436
|
-
const
|
|
6437
|
-
async function
|
|
6463
|
+
const ka = 32 * 1024, Ra = 2e3;
|
|
6464
|
+
async function Ia(m) {
|
|
6438
6465
|
const { file: r, documentId: s, store: o, config: d, useCustomRecordsIds: f = !1, chunkOptions: v } = m, { supportedFileExtensions: g } = d.io;
|
|
6439
6466
|
if (we(
|
|
6440
6467
|
g.some((M) => r.name.toLowerCase().endsWith(M)),
|
|
6441
6468
|
{ key: "ASSERTION_FAILED", detail: `Unsupported file type: ${r.name}` }
|
|
6442
6469
|
), r.size === 0)
|
|
6443
6470
|
return { documentId: s, recordCount: 0 };
|
|
6444
|
-
const D = v?.chunkSize ??
|
|
6471
|
+
const D = v?.chunkSize ?? ka, R = v?.batchSize ?? Ra, K = new da(), B = ba({ dialecteConfig: d, useCustomRecordsIds: f, session: K }), Y = await Pa({
|
|
6445
6472
|
file: r,
|
|
6446
|
-
sax:
|
|
6447
|
-
session:
|
|
6473
|
+
sax: B,
|
|
6474
|
+
session: K,
|
|
6448
6475
|
store: o,
|
|
6449
6476
|
documentId: s,
|
|
6450
6477
|
chunkSize: D,
|
|
6451
|
-
batchSize:
|
|
6452
|
-
}), oe = await
|
|
6453
|
-
return { documentId: s, recordCount:
|
|
6478
|
+
batchSize: R
|
|
6479
|
+
}), oe = await Fa({ config: d, store: o, documentId: s });
|
|
6480
|
+
return { documentId: s, recordCount: Y + oe };
|
|
6454
6481
|
}
|
|
6455
|
-
async function
|
|
6482
|
+
async function Pa(m) {
|
|
6456
6483
|
const { file: r, sax: s, session: o, store: d, documentId: f, chunkSize: v, batchSize: g } = m;
|
|
6457
6484
|
let D = 0;
|
|
6458
|
-
const
|
|
6459
|
-
let
|
|
6460
|
-
for (; !
|
|
6461
|
-
const oe = await
|
|
6462
|
-
if (
|
|
6463
|
-
|
|
6485
|
+
const R = r.stream().getReader(), K = new TextDecoder();
|
|
6486
|
+
let B = new Uint8Array(0), Y = !1;
|
|
6487
|
+
for (; !Y; ) {
|
|
6488
|
+
const oe = await R.read();
|
|
6489
|
+
if (Y = oe.done, Y) {
|
|
6490
|
+
B.length > 0 && s.parser.write(K.decode(B)), s.parser.close(), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: 0 });
|
|
6464
6491
|
break;
|
|
6465
6492
|
}
|
|
6466
6493
|
if (oe.value)
|
|
6467
|
-
for (
|
|
6468
|
-
const M =
|
|
6469
|
-
|
|
6494
|
+
for (B = Ba(B, oe.value); B.length >= v; ) {
|
|
6495
|
+
const M = K.decode(B.slice(0, v), { stream: !0 });
|
|
6496
|
+
B = B.slice(v), s.parser.write(M), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: g });
|
|
6470
6497
|
}
|
|
6471
6498
|
}
|
|
6472
6499
|
return D;
|
|
6473
6500
|
}
|
|
6474
|
-
async function
|
|
6501
|
+
async function Fa(m) {
|
|
6475
6502
|
const { config: r, store: s, documentId: o } = m;
|
|
6476
6503
|
if (!r.io.hooks?.afterImport) return 0;
|
|
6477
6504
|
const { creates: d, updates: f, deletes: v } = await r.io.hooks.afterImport();
|
|
6478
6505
|
return d?.length || f?.length || v?.length ? (await s.bulkWrite(o, { creates: d, updates: f, deletes: v }), (d?.length ?? 0) - (v?.length ?? 0)) : 0;
|
|
6479
6506
|
}
|
|
6480
|
-
function
|
|
6507
|
+
function Ba(m, r) {
|
|
6481
6508
|
const s = new Uint8Array(m.length + r.length);
|
|
6482
6509
|
return s.set(m), s.set(r, m.length), s;
|
|
6483
6510
|
}
|
|
@@ -6487,18 +6514,22 @@ async function pi(m) {
|
|
|
6487
6514
|
const v = r.drainBatch(), g = s.resolveChildrenForBatch(v);
|
|
6488
6515
|
return await o.bulkWrite(d, { creates: g }), g.length;
|
|
6489
6516
|
}
|
|
6490
|
-
async function
|
|
6517
|
+
async function ja(m) {
|
|
6491
6518
|
const { documentId: r, state: s, configs: o, store: d, projectName: f, options: v } = m, g = s.documents.get(r);
|
|
6492
6519
|
we(g, {
|
|
6493
6520
|
key: "DOCUMENT_NOT_REGISTERED",
|
|
6494
6521
|
detail: `Document "${r}" not registered in project "${f}"`
|
|
6495
6522
|
});
|
|
6496
|
-
const D = o[g.document.configKey],
|
|
6497
|
-
records:
|
|
6523
|
+
const D = o[g.document.configKey], R = await d.getByDocumentId(r), K = sa({
|
|
6524
|
+
records: R,
|
|
6498
6525
|
config: D,
|
|
6499
6526
|
withDatabaseIds: v?.withDatabaseIds
|
|
6500
|
-
}),
|
|
6501
|
-
return
|
|
6527
|
+
}), B = `${g.document.name}${g.document.extension}`;
|
|
6528
|
+
return v?.withDownload && await aa({
|
|
6529
|
+
extension: g.document.extension,
|
|
6530
|
+
xmlDocument: K,
|
|
6531
|
+
filename: B
|
|
6532
|
+
}), { xmlDocument: K, filename: B };
|
|
6502
6533
|
}
|
|
6503
6534
|
function Rn(m) {
|
|
6504
6535
|
return {
|
|
@@ -6512,7 +6543,7 @@ function Rn(m) {
|
|
|
6512
6543
|
canRedo: !1
|
|
6513
6544
|
};
|
|
6514
6545
|
}
|
|
6515
|
-
function
|
|
6546
|
+
function Ma(m, r) {
|
|
6516
6547
|
const s = new Set(r.map((o) => o.id));
|
|
6517
6548
|
for (const o of r)
|
|
6518
6549
|
m.has(o.id) || m.set(o.id, Rn(o));
|
|
@@ -6520,22 +6551,22 @@ function Fa(m, r) {
|
|
|
6520
6551
|
s.has(o) || m.delete(o);
|
|
6521
6552
|
return m;
|
|
6522
6553
|
}
|
|
6523
|
-
async function
|
|
6554
|
+
async function Ka(m) {
|
|
6524
6555
|
const { file: r, store: s, configs: o, defaultConfigKey: d, options: f } = m, v = f?.configKey ?? d, g = o[v];
|
|
6525
6556
|
we(g, {
|
|
6526
6557
|
key: "UNKNOWN_CONFIG_KEY",
|
|
6527
6558
|
detail: `Unknown configKey: "${v}". Available: ${Object.keys(o).join(", ")}`
|
|
6528
6559
|
});
|
|
6529
|
-
const D = crypto.randomUUID(),
|
|
6560
|
+
const D = crypto.randomUUID(), R = r.name.includes(".") ? `.${r.name.split(".").pop()}` : g.io.supportedFileExtensions[0], K = r.name.replace(/\.[^.]+$/, "") || "untitled", B = {
|
|
6530
6561
|
id: D,
|
|
6531
|
-
name:
|
|
6532
|
-
extension:
|
|
6562
|
+
name: K,
|
|
6563
|
+
extension: R,
|
|
6533
6564
|
configKey: v,
|
|
6534
6565
|
createdAt: Date.now(),
|
|
6535
6566
|
metadata: f?.metadata
|
|
6536
6567
|
};
|
|
6537
|
-
await s.registerDocument(
|
|
6538
|
-
const { recordCount:
|
|
6568
|
+
await s.registerDocument(B);
|
|
6569
|
+
const { recordCount: Y } = await Ia({
|
|
6539
6570
|
file: r,
|
|
6540
6571
|
documentId: D,
|
|
6541
6572
|
store: s,
|
|
@@ -6545,41 +6576,41 @@ async function Ba(m) {
|
|
|
6545
6576
|
});
|
|
6546
6577
|
return {
|
|
6547
6578
|
documentId: D,
|
|
6548
|
-
document:
|
|
6549
|
-
documentState: Rn(
|
|
6550
|
-
recordCount:
|
|
6579
|
+
document: B,
|
|
6580
|
+
documentState: Rn(B),
|
|
6581
|
+
recordCount: Y
|
|
6551
6582
|
};
|
|
6552
6583
|
}
|
|
6553
|
-
async function
|
|
6584
|
+
async function qa(m) {
|
|
6554
6585
|
const { store: r, configs: s, defaultConfigKey: o, options: d } = m, f = d?.configKey ?? o, v = s[f];
|
|
6555
6586
|
we(v, {
|
|
6556
6587
|
key: "UNKNOWN_CONFIG_KEY",
|
|
6557
6588
|
detail: `Unknown configKey: "${f}". Available: ${Object.keys(s).join(", ")}`
|
|
6558
6589
|
});
|
|
6559
|
-
const g = d?.extension ?? v.io.supportedFileExtensions[0], D = d?.name ?? "untitled",
|
|
6560
|
-
id:
|
|
6590
|
+
const g = d?.extension ?? v.io.supportedFileExtensions[0], D = d?.name ?? "untitled", R = crypto.randomUUID(), K = {
|
|
6591
|
+
id: R,
|
|
6561
6592
|
name: D,
|
|
6562
6593
|
extension: g,
|
|
6563
6594
|
configKey: f,
|
|
6564
6595
|
createdAt: Date.now(),
|
|
6565
6596
|
metadata: d?.metadata
|
|
6566
6597
|
};
|
|
6567
|
-
await r.registerDocument(
|
|
6568
|
-
const
|
|
6569
|
-
const ye = { name: M, value:
|
|
6598
|
+
await r.registerDocument(K);
|
|
6599
|
+
const B = v.definition[v.rootElementName], Y = (B?.attributes.sequence ?? []).map((M) => ({ name: M, ...B.attributes.details[M] })).filter((M) => M.required && (M.fixed ?? M.default) !== void 0).map(({ name: M, fixed: j, default: z, namespace: ie }) => {
|
|
6600
|
+
const ye = { name: M, value: j ?? z };
|
|
6570
6601
|
return ie && (ye.namespace = ie), ye;
|
|
6571
6602
|
}), oe = {
|
|
6572
6603
|
id: crypto.randomUUID(),
|
|
6573
6604
|
tagName: v.rootElementName,
|
|
6574
6605
|
namespace: v.namespaces.default,
|
|
6575
|
-
attributes:
|
|
6606
|
+
attributes: Y,
|
|
6576
6607
|
value: "",
|
|
6577
6608
|
parent: null,
|
|
6578
6609
|
children: []
|
|
6579
6610
|
};
|
|
6580
|
-
return await r.bulkWrite(
|
|
6611
|
+
return await r.bulkWrite(R, { creates: [oe] }), { documentId: R, document: K, documentState: Rn(K) };
|
|
6581
6612
|
}
|
|
6582
|
-
class
|
|
6613
|
+
class es {
|
|
6583
6614
|
constructor(r) {
|
|
6584
6615
|
this.state = {
|
|
6585
6616
|
documents: /* @__PURE__ */ new Map(),
|
|
@@ -6641,7 +6672,7 @@ class Za {
|
|
|
6641
6672
|
* Returns the new documentId. Records are added later via import or transactions.
|
|
6642
6673
|
*/
|
|
6643
6674
|
async initEmptyDocument(r) {
|
|
6644
|
-
const s = await
|
|
6675
|
+
const s = await qa({
|
|
6645
6676
|
store: this.store,
|
|
6646
6677
|
configs: this.configs,
|
|
6647
6678
|
defaultConfigKey: this.defaultConfigKey,
|
|
@@ -6660,7 +6691,7 @@ class Za {
|
|
|
6660
6691
|
* Import a File into the project: register, parse XML, persist records.
|
|
6661
6692
|
*/
|
|
6662
6693
|
async import(r, s) {
|
|
6663
|
-
const o = await
|
|
6694
|
+
const o = await Ka({
|
|
6664
6695
|
file: r,
|
|
6665
6696
|
store: this.store,
|
|
6666
6697
|
configs: this.configs,
|
|
@@ -6673,7 +6704,7 @@ class Za {
|
|
|
6673
6704
|
* Export a document as an XMLDocument built from stored records.
|
|
6674
6705
|
*/
|
|
6675
6706
|
async export(r, s) {
|
|
6676
|
-
return
|
|
6707
|
+
return ja({
|
|
6677
6708
|
documentId: r,
|
|
6678
6709
|
state: this.state,
|
|
6679
6710
|
configs: this.configs,
|
|
@@ -6739,49 +6770,51 @@ class Za {
|
|
|
6739
6770
|
}
|
|
6740
6771
|
async refreshState() {
|
|
6741
6772
|
const r = await this.store.getDocuments();
|
|
6742
|
-
|
|
6773
|
+
Ma(this.state.documents, r);
|
|
6743
6774
|
}
|
|
6744
6775
|
}
|
|
6745
6776
|
export {
|
|
6746
6777
|
Di as A,
|
|
6747
|
-
|
|
6778
|
+
Sn as B,
|
|
6748
6779
|
ai as C,
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6780
|
+
Jo as D,
|
|
6781
|
+
Oi as E,
|
|
6782
|
+
Ka as F,
|
|
6783
|
+
qa as G,
|
|
6784
|
+
Ht as H,
|
|
6785
|
+
xt as I,
|
|
6786
|
+
Ia as J,
|
|
6787
|
+
Ma as K,
|
|
6788
|
+
Wo as L,
|
|
6757
6789
|
si as M,
|
|
6758
|
-
|
|
6790
|
+
ea as N,
|
|
6791
|
+
es as P,
|
|
6759
6792
|
Si as Q,
|
|
6760
|
-
|
|
6793
|
+
Ye as T,
|
|
6761
6794
|
qo as a,
|
|
6762
|
-
|
|
6795
|
+
oi as b,
|
|
6763
6796
|
$o as c,
|
|
6764
|
-
|
|
6797
|
+
da as d,
|
|
6765
6798
|
ft as e,
|
|
6766
|
-
|
|
6799
|
+
ze as f,
|
|
6767
6800
|
Go as g,
|
|
6768
6801
|
Mi as h,
|
|
6769
6802
|
Vo as i,
|
|
6770
6803
|
Rn as j,
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6804
|
+
sa as k,
|
|
6805
|
+
aa as l,
|
|
6806
|
+
ja as m,
|
|
6807
|
+
bi as n,
|
|
6808
|
+
Er as o,
|
|
6809
|
+
wr as p,
|
|
6810
|
+
oa as q,
|
|
6811
|
+
xi as r,
|
|
6812
|
+
Ti as s,
|
|
6813
|
+
Ni as t,
|
|
6814
|
+
Ci as u,
|
|
6815
|
+
yi as v,
|
|
6816
|
+
vi as w,
|
|
6817
|
+
ia as x,
|
|
6818
|
+
me as y,
|
|
6819
|
+
Zt as z
|
|
6787
6820
|
};
|