@dialecte/core 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document/query/find/ancestor/find-ancestor.d.ts +2 -1
- package/dist/document/query/find/ancestor/find-ancestor.d.ts.map +1 -1
- package/dist/document/query/find/ancestor/find-ancestor.types.d.ts +1 -0
- package/dist/document/query/find/ancestor/find-ancestor.types.d.ts.map +1 -1
- package/dist/document/transaction/clone/clone.d.ts +2 -1
- package/dist/document/transaction/clone/clone.d.ts.map +1 -1
- package/dist/document/transaction/create/create.d.ts +2 -1
- package/dist/document/transaction/create/create.d.ts.map +1 -1
- package/dist/document/transaction/delete/delete.d.ts +2 -1
- package/dist/document/transaction/delete/delete.d.ts.map +1 -1
- package/dist/document/transaction/ensure/ensure.d.ts +2 -1
- package/dist/document/transaction/ensure/ensure.d.ts.map +1 -1
- package/dist/document/transaction/main.d.ts.map +1 -1
- package/dist/document/transaction/update/update.d.ts +2 -1
- package/dist/document/transaction/update/update.d.ts.map +1 -1
- package/dist/helpers.js +1 -1
- package/dist/{index-BcfPvtox.js → index-DRYqQRsA.js} +932 -920
- package/dist/{index-BCraeB5h.js → index-aALGfPYv.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/test.js +1 -1
- package/dist/types/dialecte-config.d.ts +5 -5
- package/dist/types/dialecte-config.d.ts.map +1 -1
- package/dist/utils/assert.d.ts +3 -3
- package/dist/utils/assert.d.ts.map +1 -1
- package/dist/utils.js +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as je,
|
|
1
|
+
import { t as je, i as Ue } from "./index-aALGfPYv.js";
|
|
2
2
|
import { isRecordOf as lr, toRef as _e, toTreeRecord as fr, toRawRecord as sr, standardizeRecord as Ha, toFullAttributeArray as Za, CUSTOM_RECORD_ID_ATTRIBUTE as ua, mergeExtensions as Ja } from "./helpers.js";
|
|
3
3
|
function ur(m, o) {
|
|
4
4
|
if (!m) return {};
|
|
@@ -6,8 +6,8 @@ function ur(m, o) {
|
|
|
6
6
|
for (const i of Object.keys(m)) {
|
|
7
7
|
const d = m[i], h = {};
|
|
8
8
|
for (const y of Object.keys(d)) {
|
|
9
|
-
const
|
|
10
|
-
h[y] = (...
|
|
9
|
+
const _ = d[y];
|
|
10
|
+
h[y] = (...I) => _(o, ...I);
|
|
11
11
|
}
|
|
12
12
|
c[i] = h;
|
|
13
13
|
}
|
|
@@ -117,20 +117,20 @@ async function ni(m) {
|
|
|
117
117
|
async function ri(m) {
|
|
118
118
|
const { context: o, ref: c, tagName: i } = m, d = await Ee({ context: o, ref: c });
|
|
119
119
|
if (!d) return [];
|
|
120
|
-
const h = d.children.filter((
|
|
120
|
+
const h = d.children.filter((_) => _.tagName === i).map((_) => ({ tagName: i, id: _.id }));
|
|
121
121
|
return (await ca({ context: o, refs: h })).filter(
|
|
122
|
-
(
|
|
122
|
+
(_) => _ !== void 0
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
async function ai(m) {
|
|
126
|
-
const { context: o, ref: c, options: i } = m, d = i?.depth ?? 1 / 0, h = i?.stopAtTagName, y = [];
|
|
127
|
-
let
|
|
128
|
-
for (;
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
131
|
-
|
|
126
|
+
const { context: o, ref: c, options: i } = m, d = i?.depth ?? 1 / 0, h = i?.stopAtTagName, y = i?.order ?? "bottom-up", _ = [];
|
|
127
|
+
let I = await Ee({ context: o, ref: c });
|
|
128
|
+
for (; I?.parent && _.length < d; ) {
|
|
129
|
+
const j = I.parent, V = await Ee({ context: o, ref: j });
|
|
130
|
+
if (!V || (_.push(V), h && V.tagName === h)) break;
|
|
131
|
+
I = V;
|
|
132
132
|
}
|
|
133
|
-
return y;
|
|
133
|
+
return y === "top-down" ? _.reverse() : _;
|
|
134
134
|
}
|
|
135
135
|
async function Nn(m) {
|
|
136
136
|
const { context: o, tagName: c, attributes: i } = m, d = await la({ context: o, tagName: c }), h = [];
|
|
@@ -145,11 +145,11 @@ function pr(m) {
|
|
|
145
145
|
for (const [i, d] of Object.entries(c)) {
|
|
146
146
|
if (d === void 0) continue;
|
|
147
147
|
const y = o.attributes.find(
|
|
148
|
-
(
|
|
148
|
+
(_) => _.name === i
|
|
149
149
|
)?.value ?? "";
|
|
150
150
|
if (y === "") return !1;
|
|
151
151
|
if (Array.isArray(d)) {
|
|
152
|
-
if (!d.some((
|
|
152
|
+
if (!d.some((_) => y === _))
|
|
153
153
|
return !1;
|
|
154
154
|
} else if (y !== d)
|
|
155
155
|
return !1;
|
|
@@ -171,33 +171,33 @@ async function ii(m) {
|
|
|
171
171
|
async function oi(m) {
|
|
172
172
|
const { context: o, dialecteConfig: c, ref: i } = m, d = await ha({ context: o, ref: i });
|
|
173
173
|
if (!d) return {};
|
|
174
|
-
const h = ui(d), y = [i.tagName, ...c.descendants[i.tagName]],
|
|
175
|
-
for (const
|
|
176
|
-
|
|
177
|
-
for (const
|
|
178
|
-
|
|
179
|
-
return
|
|
174
|
+
const h = ui(d), y = [i.tagName, ...c.descendants[i.tagName]], _ = {};
|
|
175
|
+
for (const I of y)
|
|
176
|
+
_[I] = [];
|
|
177
|
+
for (const I of h)
|
|
178
|
+
_[I.tagName] && _[I.tagName].push(I);
|
|
179
|
+
return _;
|
|
180
180
|
}
|
|
181
181
|
async function si(m) {
|
|
182
|
-
const { context: o, ref: c, filter: i } = m, d = fa(i), h = new Set(da(i)), y = d[d.length - 1],
|
|
182
|
+
const { context: o, ref: c, filter: i } = m, d = fa(i), h = new Set(da(i)), y = d[d.length - 1], _ = y.attributes ? await Nn({
|
|
183
183
|
context: o,
|
|
184
184
|
tagName: y.tagName,
|
|
185
185
|
attributes: y.attributes
|
|
186
186
|
}) : await di({
|
|
187
187
|
context: o,
|
|
188
188
|
tagName: y.tagName
|
|
189
|
-
}),
|
|
190
|
-
for (const
|
|
191
|
-
const
|
|
189
|
+
}), I = /* @__PURE__ */ new Map();
|
|
190
|
+
for (const j of _) {
|
|
191
|
+
const V = await ci({
|
|
192
192
|
context: o,
|
|
193
|
-
record:
|
|
193
|
+
record: j,
|
|
194
194
|
targetRef: c
|
|
195
195
|
});
|
|
196
|
-
if (
|
|
197
|
-
for (const W of
|
|
198
|
-
h.has(W.tagName) && (
|
|
196
|
+
if (V.length !== 0 && li({ ancestry: V, conditions: d }))
|
|
197
|
+
for (const W of V)
|
|
198
|
+
h.has(W.tagName) && (I.has(W.tagName) || I.set(W.tagName, /* @__PURE__ */ new Map()), I.get(W.tagName).set(W.id, W));
|
|
199
199
|
}
|
|
200
|
-
return fi({ collected:
|
|
200
|
+
return fi({ collected: I, collectTags: h });
|
|
201
201
|
}
|
|
202
202
|
function ui(m) {
|
|
203
203
|
const o = [];
|
|
@@ -263,11 +263,11 @@ async function di(m) {
|
|
|
263
263
|
}
|
|
264
264
|
async function hi(m) {
|
|
265
265
|
const { context: o, ref: c, name: i } = m;
|
|
266
|
-
return ((await Ee({ context: o, ref: c }))?.attributes ?? []).find((
|
|
266
|
+
return ((await Ee({ context: o, ref: c }))?.attributes ?? []).find((_) => _.name === i)?.value ?? "";
|
|
267
267
|
}
|
|
268
268
|
async function pi(m) {
|
|
269
269
|
const { context: o, ref: c, name: i } = m;
|
|
270
|
-
return ((await Ee({ context: o, ref: c }))?.attributes ?? []).find((
|
|
270
|
+
return ((await Ee({ context: o, ref: c }))?.attributes ?? []).find((_) => _.name === i);
|
|
271
271
|
}
|
|
272
272
|
async function mi(m) {
|
|
273
273
|
const { context: o, ref: c } = m;
|
|
@@ -281,18 +281,18 @@ async function gi(m) {
|
|
|
281
281
|
return (await Ee({ context: o, ref: c }))?.attributes ?? [];
|
|
282
282
|
}
|
|
283
283
|
async function ha(m) {
|
|
284
|
-
const { context: o, ref: c, options: i = {} } = m, { include: d, exclude: h, unwrap: y } = i,
|
|
285
|
-
Ue(
|
|
284
|
+
const { context: o, ref: c, options: i = {} } = m, { include: d, exclude: h, unwrap: y } = i, _ = await Ee({ context: o, ref: c });
|
|
285
|
+
Ue(_, {
|
|
286
286
|
detail: "No record found for provided ref",
|
|
287
287
|
key: "ELEMENT_NOT_FOUND"
|
|
288
288
|
});
|
|
289
|
-
const
|
|
289
|
+
const I = await pa({
|
|
290
290
|
context: o,
|
|
291
|
-
record:
|
|
291
|
+
record: _,
|
|
292
292
|
includeFilters: d ? [d] : void 0,
|
|
293
293
|
exclude: h
|
|
294
294
|
});
|
|
295
|
-
return
|
|
295
|
+
return I ? y ? _i({ tree: I, unwrapTagNames: y }) : I : fr({ record: _ });
|
|
296
296
|
}
|
|
297
297
|
async function pa(m) {
|
|
298
298
|
const { context: o, record: c, includeFilters: i, exclude: d } = m;
|
|
@@ -303,14 +303,14 @@ async function pa(m) {
|
|
|
303
303
|
record: c,
|
|
304
304
|
currentIncludeFilters: i,
|
|
305
305
|
excludeFilters: d
|
|
306
|
-
}),
|
|
306
|
+
}), _ = (await Promise.all(
|
|
307
307
|
h.map(
|
|
308
|
-
({ record:
|
|
308
|
+
({ record: I, includeFilters: j }) => pa({ context: o, record: I, includeFilters: j, exclude: d })
|
|
309
309
|
)
|
|
310
310
|
)).filter(
|
|
311
|
-
(
|
|
311
|
+
(I) => I !== null
|
|
312
312
|
);
|
|
313
|
-
return fr({ record: c, tree:
|
|
313
|
+
return fr({ record: c, tree: _ });
|
|
314
314
|
}
|
|
315
315
|
function yi(m) {
|
|
316
316
|
const { record: o, excludeFilters: c } = m;
|
|
@@ -323,19 +323,19 @@ function vi(m) {
|
|
|
323
323
|
async function bi(m) {
|
|
324
324
|
const { context: o, record: c, currentIncludeFilters: i, excludeFilters: d } = m;
|
|
325
325
|
if (!c.children?.length) return [];
|
|
326
|
-
const
|
|
326
|
+
const _ = (await Promise.all(
|
|
327
327
|
c.children.map(
|
|
328
|
-
(
|
|
328
|
+
(I) => Ee({
|
|
329
329
|
context: o,
|
|
330
|
-
ref: _e(
|
|
330
|
+
ref: _e(I)
|
|
331
331
|
})
|
|
332
332
|
)
|
|
333
333
|
)).filter(
|
|
334
|
-
(
|
|
334
|
+
(I) => I !== void 0
|
|
335
335
|
).filter(
|
|
336
|
-
(
|
|
336
|
+
(I) => !vi({ record: I, excludeFilters: d })
|
|
337
337
|
);
|
|
338
|
-
return wi({ children:
|
|
338
|
+
return wi({ children: _, currentIncludeFilters: i });
|
|
339
339
|
}
|
|
340
340
|
function wi(m) {
|
|
341
341
|
const { children: o, currentIncludeFilters: c } = m;
|
|
@@ -566,14 +566,14 @@ class ma {
|
|
|
566
566
|
}
|
|
567
567
|
function ze(m) {
|
|
568
568
|
const { context: o, status: c, record: i, oldRecord: d, newRecord: h } = m;
|
|
569
|
-
let y,
|
|
570
|
-
i && (y = sr(i)), d && (
|
|
569
|
+
let y, _, I;
|
|
570
|
+
i && (y = sr(i)), d && (_ = sr(d)), h && (I = sr(h)), c === "created" ? (Ue(y, {
|
|
571
571
|
detail: "Record is required for created",
|
|
572
572
|
key: "ELEMENT_NOT_FOUND"
|
|
573
|
-
}), o.stagedOperations.push({ status: c, oldRecord: void 0, newRecord: y })) : c === "updated" ? (Ue(
|
|
573
|
+
}), o.stagedOperations.push({ status: c, oldRecord: void 0, newRecord: y })) : c === "updated" ? (Ue(_ && I, {
|
|
574
574
|
detail: "Old record and new record are required for updated",
|
|
575
575
|
key: "ELEMENT_NOT_FOUND"
|
|
576
|
-
}), o.stagedOperations.push({ status: c, oldRecord:
|
|
576
|
+
}), o.stagedOperations.push({ status: c, oldRecord: _, newRecord: I })) : c === "deleted" && y && (Ue(y, {
|
|
577
577
|
detail: "Record is required for deleted",
|
|
578
578
|
key: "ELEMENT_NOT_FOUND"
|
|
579
579
|
}), o.stagedOperations.push({ status: c, oldRecord: y, newRecord: void 0 }));
|
|
@@ -599,97 +599,103 @@ function gr(m) {
|
|
|
599
599
|
}
|
|
600
600
|
}
|
|
601
601
|
async function yr(m) {
|
|
602
|
-
const { dialecteConfig: o, context: c,
|
|
603
|
-
Ue(
|
|
602
|
+
const { dialecteConfig: o, context: c, query: i, parentRef: d, params: h } = m, { id: y, tagName: _, attributes: I, namespace: j, value: V } = h, W = await Ee({ context: c, ref: d });
|
|
603
|
+
Ue(W, {
|
|
604
604
|
detail: "Parent record not found",
|
|
605
605
|
key: "ELEMENT_NOT_FOUND",
|
|
606
|
-
ref:
|
|
606
|
+
ref: d
|
|
607
607
|
});
|
|
608
|
-
const
|
|
608
|
+
const ee = Ha({
|
|
609
609
|
dialecteConfig: o,
|
|
610
610
|
record: {
|
|
611
|
-
id:
|
|
612
|
-
tagName:
|
|
613
|
-
attributes:
|
|
614
|
-
namespace:
|
|
615
|
-
value:
|
|
616
|
-
parent: { id:
|
|
611
|
+
id: y ?? crypto.randomUUID(),
|
|
612
|
+
tagName: _,
|
|
613
|
+
attributes: I,
|
|
614
|
+
namespace: j,
|
|
615
|
+
value: V,
|
|
616
|
+
parent: { id: W.id, tagName: W.tagName },
|
|
617
617
|
children: []
|
|
618
618
|
}
|
|
619
619
|
});
|
|
620
620
|
ze({
|
|
621
621
|
context: c,
|
|
622
622
|
status: "created",
|
|
623
|
-
record:
|
|
623
|
+
record: ee
|
|
624
624
|
});
|
|
625
|
-
const
|
|
626
|
-
...
|
|
627
|
-
children: [...
|
|
625
|
+
const ce = {
|
|
626
|
+
...W,
|
|
627
|
+
children: [...W.children, { id: ee.id, tagName: ee.tagName }]
|
|
628
628
|
};
|
|
629
629
|
if (ze({
|
|
630
630
|
context: c,
|
|
631
631
|
status: "updated",
|
|
632
|
-
oldRecord:
|
|
633
|
-
newRecord:
|
|
632
|
+
oldRecord: W,
|
|
633
|
+
newRecord: ce
|
|
634
634
|
}), o.hooks?.afterCreated) {
|
|
635
|
-
const
|
|
636
|
-
childRecord:
|
|
637
|
-
parentRecord:
|
|
638
|
-
|
|
635
|
+
const B = await o.hooks.afterCreated({
|
|
636
|
+
childRecord: ee,
|
|
637
|
+
parentRecord: ce,
|
|
638
|
+
query: i
|
|
639
639
|
});
|
|
640
|
-
gr({ context: c, operations:
|
|
640
|
+
gr({ context: c, operations: B });
|
|
641
641
|
}
|
|
642
|
-
return
|
|
642
|
+
return ee;
|
|
643
643
|
}
|
|
644
644
|
async function Ei(m) {
|
|
645
|
-
const { dialecteConfig: o, context: c,
|
|
645
|
+
const { dialecteConfig: o, context: c, query: i, parentRef: d, record: h } = m, y = [], _ = await ga({
|
|
646
646
|
dialecteConfig: o,
|
|
647
647
|
context: c,
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
648
|
+
query: i,
|
|
649
|
+
parentRef: d,
|
|
650
|
+
record: h,
|
|
651
|
+
mappings: y
|
|
651
652
|
});
|
|
652
653
|
if (o.hooks?.afterDeepClone) {
|
|
653
|
-
const
|
|
654
|
-
|
|
654
|
+
const I = await o.hooks.afterDeepClone({
|
|
655
|
+
mappings: y,
|
|
656
|
+
query: i
|
|
657
|
+
});
|
|
658
|
+
c.stagedOperations.push(...I);
|
|
655
659
|
}
|
|
656
660
|
return {
|
|
657
|
-
record:
|
|
658
|
-
mappings:
|
|
661
|
+
record: _,
|
|
662
|
+
mappings: y
|
|
659
663
|
};
|
|
660
664
|
}
|
|
661
665
|
async function ga(m) {
|
|
662
|
-
const { dialecteConfig: o, context: c,
|
|
663
|
-
let
|
|
666
|
+
const { dialecteConfig: o, context: c, query: i, parentRef: d, record: h, mappings: y } = m;
|
|
667
|
+
let _ = !0, I = h;
|
|
664
668
|
if (o.hooks?.beforeClone) {
|
|
665
|
-
const
|
|
666
|
-
|
|
669
|
+
const V = o.hooks.beforeClone({ record: h });
|
|
670
|
+
_ = V.shouldBeCloned, I = V.transformedRecord;
|
|
667
671
|
}
|
|
668
|
-
if (!
|
|
669
|
-
const
|
|
672
|
+
if (!_) return I;
|
|
673
|
+
const j = await yr({
|
|
670
674
|
dialecteConfig: o,
|
|
671
675
|
context: c,
|
|
672
|
-
|
|
676
|
+
query: i,
|
|
677
|
+
parentRef: d,
|
|
673
678
|
params: {
|
|
674
|
-
tagName:
|
|
675
|
-
namespace:
|
|
676
|
-
attributes:
|
|
677
|
-
value:
|
|
679
|
+
tagName: I.tagName,
|
|
680
|
+
namespace: I.namespace,
|
|
681
|
+
attributes: I.attributes,
|
|
682
|
+
value: I.value
|
|
678
683
|
}
|
|
679
684
|
});
|
|
680
|
-
|
|
681
|
-
source: _e(
|
|
682
|
-
target: _e(
|
|
685
|
+
y.push({
|
|
686
|
+
source: _e(h),
|
|
687
|
+
target: _e(j)
|
|
683
688
|
});
|
|
684
|
-
for (const
|
|
689
|
+
for (const V of I.tree)
|
|
685
690
|
await ga({
|
|
686
691
|
dialecteConfig: o,
|
|
687
692
|
context: c,
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
693
|
+
query: i,
|
|
694
|
+
parentRef: _e(j),
|
|
695
|
+
record: V,
|
|
696
|
+
mappings: y
|
|
691
697
|
});
|
|
692
|
-
return
|
|
698
|
+
return j;
|
|
693
699
|
}
|
|
694
700
|
function Ti(m) {
|
|
695
701
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -721,46 +727,46 @@ function Ti(m) {
|
|
|
721
727
|
};
|
|
722
728
|
}
|
|
723
729
|
async function xi(m) {
|
|
724
|
-
const { stagedOperations: o, store: c, documentState: i } = m, { creates: d, updates: h, deletes: y } = Ti(o),
|
|
725
|
-
i.loading = !0, i.progress = { message: "Committing changes...", current: 0, total:
|
|
730
|
+
const { stagedOperations: o, store: c, documentState: i } = m, { creates: d, updates: h, deletes: y } = Ti(o), _ = d.length + h.length + y.length;
|
|
731
|
+
i.loading = !0, i.progress = { message: "Committing changes...", current: 0, total: _ };
|
|
726
732
|
try {
|
|
727
733
|
await c.commit({
|
|
728
|
-
creates: d.map((
|
|
729
|
-
updates: h.map((
|
|
730
|
-
deletes: y.map((
|
|
731
|
-
onProgress: (
|
|
732
|
-
i.progress = { message: "Committing changes...", current:
|
|
734
|
+
creates: d.map((I) => I.newRecord),
|
|
735
|
+
updates: h.map((I) => I.newRecord),
|
|
736
|
+
deletes: y.map((I) => I.oldRecord.id),
|
|
737
|
+
onProgress: (I, j) => {
|
|
738
|
+
i.progress = { message: "Committing changes...", current: I, total: j };
|
|
733
739
|
}
|
|
734
740
|
});
|
|
735
|
-
} catch (
|
|
736
|
-
throw i.loading = !1, i.progress = null,
|
|
741
|
+
} catch (I) {
|
|
742
|
+
throw i.loading = !1, i.progress = null, I;
|
|
737
743
|
}
|
|
738
744
|
i.lastUpdate = Date.now();
|
|
739
745
|
}
|
|
740
746
|
async function Ni(m) {
|
|
741
|
-
const { dialecteConfig: o, context: c,
|
|
742
|
-
if (Ue(
|
|
743
|
-
detail: `Record not found (tagName=${
|
|
747
|
+
const { dialecteConfig: o, context: c, query: i, ref: d } = m, h = await Ee({ context: c, ref: d });
|
|
748
|
+
if (Ue(h, {
|
|
749
|
+
detail: `Record not found (tagName=${d.tagName}, id=${d.id})`,
|
|
744
750
|
key: "ELEMENT_NOT_FOUND",
|
|
745
|
-
ref:
|
|
746
|
-
}), Ue(
|
|
751
|
+
ref: d
|
|
752
|
+
}), Ue(h.parent, {
|
|
747
753
|
detail: "Cannot delete root element",
|
|
748
754
|
key: "PROTECTED_ROOT"
|
|
749
755
|
}), o.hooks?.beforeDelete) {
|
|
750
|
-
const
|
|
751
|
-
gr({ context: c, operations:
|
|
756
|
+
const j = await o.hooks.beforeDelete({ record: h, query: i });
|
|
757
|
+
gr({ context: c, operations: j });
|
|
752
758
|
}
|
|
753
|
-
await ya({ context: c, record:
|
|
754
|
-
const
|
|
755
|
-
Ue(
|
|
756
|
-
detail: `Parent record not found (tagName=${
|
|
759
|
+
await ya({ context: c, record: h }), ze({ context: c, status: "deleted", record: h });
|
|
760
|
+
const y = _e(h.parent), _ = await Ee({ context: c, ref: y });
|
|
761
|
+
Ue(_, {
|
|
762
|
+
detail: `Parent record not found (tagName=${h.parent.tagName}, id=${h.parent.id})`,
|
|
757
763
|
key: "ELEMENT_NOT_FOUND"
|
|
758
764
|
});
|
|
759
|
-
const
|
|
760
|
-
...
|
|
761
|
-
children:
|
|
765
|
+
const I = {
|
|
766
|
+
..._,
|
|
767
|
+
children: _.children.filter((j) => j.id !== h.id)
|
|
762
768
|
};
|
|
763
|
-
return ze({ context: c, status: "updated", oldRecord:
|
|
769
|
+
return ze({ context: c, status: "updated", oldRecord: _, newRecord: I }), I;
|
|
764
770
|
}
|
|
765
771
|
async function ya(m) {
|
|
766
772
|
const { context: o, record: c } = m;
|
|
@@ -770,23 +776,24 @@ async function ya(m) {
|
|
|
770
776
|
}
|
|
771
777
|
}
|
|
772
778
|
async function Oi(m) {
|
|
773
|
-
const { dialecteConfig: o, context: c,
|
|
774
|
-
if (
|
|
775
|
-
const [
|
|
779
|
+
const { dialecteConfig: o, context: c, query: i, parentRef: d, params: h } = m, y = Ai(h.attributes);
|
|
780
|
+
if (y) {
|
|
781
|
+
const [_] = await Nn({
|
|
776
782
|
context: c,
|
|
777
|
-
tagName:
|
|
778
|
-
attributes:
|
|
783
|
+
tagName: h.tagName,
|
|
784
|
+
attributes: y
|
|
779
785
|
});
|
|
780
|
-
if (
|
|
786
|
+
if (_) return _;
|
|
781
787
|
} else {
|
|
782
|
-
const
|
|
783
|
-
if (
|
|
788
|
+
const _ = { tagName: h.tagName, id: h.id }, I = await Ee({ context: c, ref: _ });
|
|
789
|
+
if (I) return I;
|
|
784
790
|
}
|
|
785
791
|
return yr({
|
|
786
792
|
dialecteConfig: o,
|
|
787
793
|
context: c,
|
|
788
|
-
|
|
789
|
-
|
|
794
|
+
query: i,
|
|
795
|
+
parentRef: d,
|
|
796
|
+
params: h
|
|
790
797
|
});
|
|
791
798
|
}
|
|
792
799
|
function Ai(m) {
|
|
@@ -794,39 +801,39 @@ function Ai(m) {
|
|
|
794
801
|
return Object.values(o).some((i) => i !== void 0 && i !== "") ? o : void 0;
|
|
795
802
|
}
|
|
796
803
|
async function Ci(m) {
|
|
797
|
-
const { dialecteConfig: o, context: c,
|
|
798
|
-
Ue(
|
|
799
|
-
detail: `Record not found (tagName=${
|
|
804
|
+
const { dialecteConfig: o, context: c, query: i, ref: d, params: h } = m, { attributes: y, value: _ } = h, I = await Ee({ context: c, ref: d });
|
|
805
|
+
Ue(I, {
|
|
806
|
+
detail: `Record not found (tagName=${d.tagName}, id=${d.id})`,
|
|
800
807
|
key: "ELEMENT_NOT_FOUND",
|
|
801
|
-
ref:
|
|
808
|
+
ref: d
|
|
802
809
|
});
|
|
803
|
-
let
|
|
804
|
-
if (
|
|
805
|
-
const
|
|
810
|
+
let j = I.attributes;
|
|
811
|
+
if (y) {
|
|
812
|
+
const W = Za({
|
|
806
813
|
dialecteConfig: o,
|
|
807
|
-
tagName:
|
|
808
|
-
attributes:
|
|
814
|
+
tagName: I.tagName,
|
|
815
|
+
attributes: y
|
|
809
816
|
});
|
|
810
|
-
|
|
811
|
-
(
|
|
812
|
-
), ...
|
|
813
|
-
(
|
|
817
|
+
j = [...I.attributes.filter(
|
|
818
|
+
(ce) => !W.some((B) => B.name === ce.name)
|
|
819
|
+
), ...W].filter(
|
|
820
|
+
(ce) => ce.value !== void 0 && ce.value !== null
|
|
814
821
|
);
|
|
815
822
|
}
|
|
816
|
-
const
|
|
817
|
-
...
|
|
818
|
-
attributes:
|
|
819
|
-
value:
|
|
823
|
+
const V = {
|
|
824
|
+
...I,
|
|
825
|
+
attributes: j,
|
|
826
|
+
value: _ !== void 0 ? _ : I.value
|
|
820
827
|
};
|
|
821
|
-
if (ze({ context: c, status: "updated", oldRecord:
|
|
822
|
-
const
|
|
823
|
-
oldRecord:
|
|
824
|
-
newRecord:
|
|
825
|
-
|
|
828
|
+
if (ze({ context: c, status: "updated", oldRecord: I, newRecord: V }), o.hooks?.afterUpdated) {
|
|
829
|
+
const W = await o.hooks.afterUpdated({
|
|
830
|
+
oldRecord: I,
|
|
831
|
+
newRecord: V,
|
|
832
|
+
query: i
|
|
826
833
|
});
|
|
827
|
-
gr({ context: c, operations:
|
|
834
|
+
gr({ context: c, operations: W });
|
|
828
835
|
}
|
|
829
|
-
return
|
|
836
|
+
return V;
|
|
830
837
|
}
|
|
831
838
|
class Di extends ma {
|
|
832
839
|
constructor(o, c, i) {
|
|
@@ -872,7 +879,8 @@ class Di extends ma {
|
|
|
872
879
|
context: this.context,
|
|
873
880
|
parentRef: _e(o),
|
|
874
881
|
params: c,
|
|
875
|
-
dialecteConfig: this.dialecteConfig
|
|
882
|
+
dialecteConfig: this.dialecteConfig,
|
|
883
|
+
query: this
|
|
876
884
|
});
|
|
877
885
|
}
|
|
878
886
|
/**
|
|
@@ -901,7 +909,8 @@ class Di extends ma {
|
|
|
901
909
|
context: this.context,
|
|
902
910
|
parentRef: _e(o),
|
|
903
911
|
params: c,
|
|
904
|
-
dialecteConfig: this.dialecteConfig
|
|
912
|
+
dialecteConfig: this.dialecteConfig,
|
|
913
|
+
query: this
|
|
905
914
|
});
|
|
906
915
|
}
|
|
907
916
|
/**
|
|
@@ -923,7 +932,8 @@ class Di extends ma {
|
|
|
923
932
|
context: this.context,
|
|
924
933
|
ref: _e(o),
|
|
925
934
|
params: c,
|
|
926
|
-
dialecteConfig: this.dialecteConfig
|
|
935
|
+
dialecteConfig: this.dialecteConfig,
|
|
936
|
+
query: this
|
|
927
937
|
});
|
|
928
938
|
}
|
|
929
939
|
/**
|
|
@@ -941,7 +951,8 @@ class Di extends ma {
|
|
|
941
951
|
return Ni({
|
|
942
952
|
context: this.context,
|
|
943
953
|
ref: _e(o),
|
|
944
|
-
dialecteConfig: this.dialecteConfig
|
|
954
|
+
dialecteConfig: this.dialecteConfig,
|
|
955
|
+
query: this
|
|
945
956
|
});
|
|
946
957
|
}
|
|
947
958
|
/**
|
|
@@ -962,7 +973,8 @@ class Di extends ma {
|
|
|
962
973
|
dialecteConfig: this.dialecteConfig,
|
|
963
974
|
context: this.context,
|
|
964
975
|
parentRef: _e(o),
|
|
965
|
-
record: c
|
|
976
|
+
record: c,
|
|
977
|
+
query: this
|
|
966
978
|
});
|
|
967
979
|
}
|
|
968
980
|
//== Internal — called by Document, not by consumers
|
|
@@ -1080,17 +1092,17 @@ class Hr {
|
|
|
1080
1092
|
const i = this.createTransaction();
|
|
1081
1093
|
try {
|
|
1082
1094
|
await o(this.withAllExtensions(i));
|
|
1083
|
-
} catch (
|
|
1095
|
+
} catch (_) {
|
|
1084
1096
|
throw this.activeTransactions--, this.state.loading = !1, this.state.error ?? je("UNKNOWN", {
|
|
1085
|
-
detail:
|
|
1086
|
-
cause:
|
|
1097
|
+
detail: _ instanceof Error ? _.message : String(_),
|
|
1098
|
+
cause: _ instanceof Error ? _ : void 0
|
|
1087
1099
|
});
|
|
1088
1100
|
}
|
|
1089
1101
|
this.activeTransactions--, this.state.loading = !1;
|
|
1090
1102
|
const d = i.getStagedOperations(), h = {
|
|
1091
|
-
creates: d.filter((
|
|
1092
|
-
updates: d.filter((
|
|
1093
|
-
deletes: d.filter((
|
|
1103
|
+
creates: d.filter((_) => _.status === "created").length,
|
|
1104
|
+
updates: d.filter((_) => _.status === "updated").length,
|
|
1105
|
+
deletes: d.filter((_) => _.status === "deleted").length
|
|
1094
1106
|
};
|
|
1095
1107
|
let y = !1;
|
|
1096
1108
|
return {
|
|
@@ -1105,10 +1117,10 @@ class Hr {
|
|
|
1105
1117
|
message: c?.label ?? "Changes committed",
|
|
1106
1118
|
timestamp: Date.now()
|
|
1107
1119
|
});
|
|
1108
|
-
} catch (
|
|
1120
|
+
} catch (_) {
|
|
1109
1121
|
throw this.state.error ?? je("UNKNOWN", {
|
|
1110
|
-
detail:
|
|
1111
|
-
cause:
|
|
1122
|
+
detail: _ instanceof Error ? _.message : String(_),
|
|
1123
|
+
cause: _ instanceof Error ? _ : void 0
|
|
1112
1124
|
});
|
|
1113
1125
|
} finally {
|
|
1114
1126
|
this.activeTransactions--, this.state.loading = !1;
|
|
@@ -1206,36 +1218,36 @@ function ki() {
|
|
|
1206
1218
|
for (var r, a = 0, u = t.length; a < u; a++) !r && a in t || ((r = r || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
|
|
1207
1219
|
return e.concat(r || Array.prototype.slice.call(t));
|
|
1208
1220
|
}
|
|
1209
|
-
var h = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ii, y = Object.keys,
|
|
1210
|
-
function
|
|
1221
|
+
var h = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ii, y = Object.keys, _ = Array.isArray;
|
|
1222
|
+
function I(e, t) {
|
|
1211
1223
|
return typeof t != "object" || y(t).forEach(function(n) {
|
|
1212
1224
|
e[n] = t[n];
|
|
1213
1225
|
}), e;
|
|
1214
1226
|
}
|
|
1215
1227
|
typeof Promise > "u" || h.Promise || (h.Promise = Promise);
|
|
1216
|
-
var
|
|
1228
|
+
var j = Object.getPrototypeOf, V = {}.hasOwnProperty;
|
|
1217
1229
|
function W(e, t) {
|
|
1218
|
-
return
|
|
1230
|
+
return V.call(e, t);
|
|
1219
1231
|
}
|
|
1220
|
-
function
|
|
1221
|
-
typeof t == "function" && (t = t(
|
|
1222
|
-
|
|
1232
|
+
function ee(e, t) {
|
|
1233
|
+
typeof t == "function" && (t = t(j(e))), (typeof Reflect > "u" ? y : Reflect.ownKeys)(t).forEach(function(n) {
|
|
1234
|
+
B(e, n, t[n]);
|
|
1223
1235
|
});
|
|
1224
1236
|
}
|
|
1225
|
-
var
|
|
1226
|
-
function
|
|
1227
|
-
|
|
1237
|
+
var ce = Object.defineProperty;
|
|
1238
|
+
function B(e, t, n, r) {
|
|
1239
|
+
ce(e, t, I(n && W(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
|
|
1228
1240
|
}
|
|
1229
1241
|
function F(e) {
|
|
1230
1242
|
return { from: function(t) {
|
|
1231
|
-
return e.prototype = Object.create(t.prototype),
|
|
1243
|
+
return e.prototype = Object.create(t.prototype), B(e.prototype, "constructor", e), { extend: ee.bind(null, e.prototype) };
|
|
1232
1244
|
} };
|
|
1233
1245
|
}
|
|
1234
|
-
var se = Object.getOwnPropertyDescriptor,
|
|
1246
|
+
var se = Object.getOwnPropertyDescriptor, le = [].slice;
|
|
1235
1247
|
function xe(e, t, n) {
|
|
1236
|
-
return
|
|
1248
|
+
return le.call(e, t, n);
|
|
1237
1249
|
}
|
|
1238
|
-
function
|
|
1250
|
+
function J(e, t) {
|
|
1239
1251
|
return t(e);
|
|
1240
1252
|
}
|
|
1241
1253
|
function Y(e) {
|
|
@@ -1266,7 +1278,7 @@ function ki() {
|
|
|
1266
1278
|
for (var r = 0, a = t.length; r < a; ++r) ne(e, t[r], n[r]);
|
|
1267
1279
|
} else {
|
|
1268
1280
|
var u, f, p = t.indexOf(".");
|
|
1269
|
-
p !== -1 ? (u = t.substr(0, p), (f = t.substr(p + 1)) === "" ? n === void 0 ?
|
|
1281
|
+
p !== -1 ? (u = t.substr(0, p), (f = t.substr(p + 1)) === "" ? n === void 0 ? _(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : ne(p = !(p = e[u]) || !W(e, u) ? e[u] = {} : p, f, n)) : n === void 0 ? _(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
|
|
1270
1282
|
}
|
|
1271
1283
|
}
|
|
1272
1284
|
function Re(e) {
|
|
@@ -1274,9 +1286,9 @@ function ki() {
|
|
|
1274
1286
|
for (t in e) W(e, t) && (n[t] = e[t]);
|
|
1275
1287
|
return n;
|
|
1276
1288
|
}
|
|
1277
|
-
var
|
|
1289
|
+
var R = [].concat;
|
|
1278
1290
|
function Dt(e) {
|
|
1279
|
-
return
|
|
1291
|
+
return R.apply([], e);
|
|
1280
1292
|
}
|
|
1281
1293
|
var ct = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(Dt([8, 16, 32, 64].map(function(e) {
|
|
1282
1294
|
return ["Int", "Uint", "Float"].map(function(t) {
|
|
@@ -1292,12 +1304,12 @@ function ki() {
|
|
|
1292
1304
|
if (!n || typeof n != "object") return n;
|
|
1293
1305
|
var r = de.get(n);
|
|
1294
1306
|
if (r) return r;
|
|
1295
|
-
if (
|
|
1307
|
+
if (_(n)) {
|
|
1296
1308
|
r = [], de.set(n, r);
|
|
1297
1309
|
for (var a = 0, u = n.length; a < u; ++a) r.push(t(n[a]));
|
|
1298
1310
|
} else if (He.has(n.constructor)) r = n;
|
|
1299
1311
|
else {
|
|
1300
|
-
var f, p =
|
|
1312
|
+
var f, p = j(n);
|
|
1301
1313
|
for (f in r = p === Object.prototype ? {} : Object.create(p), de.set(n, r), n) W(n, f) && (r[f] = t(n[f]));
|
|
1302
1314
|
}
|
|
1303
1315
|
return r;
|
|
@@ -1307,7 +1319,7 @@ function ki() {
|
|
|
1307
1319
|
function Ke(e) {
|
|
1308
1320
|
return zt.call(e).slice(8, -1);
|
|
1309
1321
|
}
|
|
1310
|
-
var bt = typeof Symbol < "u" ? Symbol.iterator : "@@iterator",
|
|
1322
|
+
var bt = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", fe = typeof bt == "symbol" ? function(e) {
|
|
1311
1323
|
var t;
|
|
1312
1324
|
return e != null && (t = e[bt]) && t.apply(e);
|
|
1313
1325
|
} : function() {
|
|
@@ -1320,9 +1332,9 @@ function ki() {
|
|
|
1320
1332
|
function Fe(e) {
|
|
1321
1333
|
var t, n, r, a;
|
|
1322
1334
|
if (arguments.length === 1) {
|
|
1323
|
-
if (
|
|
1335
|
+
if (_(e)) return e.slice();
|
|
1324
1336
|
if (this === Ve && typeof e == "string") return [e];
|
|
1325
|
-
if (a =
|
|
1337
|
+
if (a = fe(e)) {
|
|
1326
1338
|
for (n = []; !(r = a.next()).done; ) n.push(r.value);
|
|
1327
1339
|
return n;
|
|
1328
1340
|
}
|
|
@@ -1412,9 +1424,9 @@ function ki() {
|
|
|
1412
1424
|
function Le(e, t) {
|
|
1413
1425
|
return e === Q ? t : function(n) {
|
|
1414
1426
|
var r = e.apply(this, arguments);
|
|
1415
|
-
|
|
1427
|
+
I(n, r);
|
|
1416
1428
|
var a = this.onsuccess, u = this.onerror;
|
|
1417
|
-
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? ye(a, this.onsuccess) : a), u && (this.onerror = this.onerror ? ye(u, this.onerror) : u), r === void 0 ? n === void 0 ? void 0 : n :
|
|
1429
|
+
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? ye(a, this.onsuccess) : a), u && (this.onerror = this.onerror ? ye(u, this.onerror) : u), r === void 0 ? n === void 0 ? void 0 : n : I(r, n);
|
|
1418
1430
|
};
|
|
1419
1431
|
}
|
|
1420
1432
|
function On(e, t) {
|
|
@@ -1441,13 +1453,13 @@ function ki() {
|
|
|
1441
1453
|
}
|
|
1442
1454
|
var kt = {}, vr = 100, ct = typeof Promise > "u" ? [] : (function() {
|
|
1443
1455
|
var e = Promise.resolve();
|
|
1444
|
-
if (typeof crypto > "u" || !crypto.subtle) return [e,
|
|
1456
|
+
if (typeof crypto > "u" || !crypto.subtle) return [e, j(e), e];
|
|
1445
1457
|
var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
1446
|
-
return [t,
|
|
1458
|
+
return [t, j(t), e];
|
|
1447
1459
|
})(), Pt = ct[0], Me = ct[1], ct = ct[2], Me = Me && Me.then, lt = Pt && Pt.constructor, An = !!ct, Ft = function(e, t) {
|
|
1448
1460
|
Bt.push([e, t]), Qt && (queueMicrotask(Aa), Qt = !1);
|
|
1449
1461
|
}, Cn = !0, Qt = !0, ft = [], Ht = [], Dn = he, nt = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: Q, pgp: !1, env: {}, finalize: Q }, z = nt, Bt = [], dt = 0, Zt = [];
|
|
1450
|
-
function
|
|
1462
|
+
function $(e) {
|
|
1451
1463
|
if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
|
|
1452
1464
|
this._listeners = [], this._lib = !1;
|
|
1453
1465
|
var t = this._PSD = z;
|
|
@@ -1462,7 +1474,7 @@ function ki() {
|
|
|
1462
1474
|
if (u === r) throw new TypeError("A promise cannot be resolved with itself.");
|
|
1463
1475
|
var f = r._lib && _t();
|
|
1464
1476
|
u && typeof u.then == "function" ? n(r, function(p, v) {
|
|
1465
|
-
u instanceof
|
|
1477
|
+
u instanceof $ ? u._then(p, v) : u.then(p, v);
|
|
1466
1478
|
}) : (r._state = !0, r._value = u, wr(r)), f && Et();
|
|
1467
1479
|
}
|
|
1468
1480
|
}, Rn.bind(null, r));
|
|
@@ -1474,14 +1486,14 @@ function ki() {
|
|
|
1474
1486
|
var In = { get: function() {
|
|
1475
1487
|
var e = z, t = nn;
|
|
1476
1488
|
function n(r, a) {
|
|
1477
|
-
var u = this, f = !e.global && (e !== z || t !== nn), p = f && !at(), v = new
|
|
1478
|
-
Sn(u, new br(Er(r, e, f, p), Er(a, e, f, p),
|
|
1489
|
+
var u = this, f = !e.global && (e !== z || t !== nn), p = f && !at(), v = new $(function(w, T) {
|
|
1490
|
+
Sn(u, new br(Er(r, e, f, p), Er(a, e, f, p), w, T, e));
|
|
1479
1491
|
});
|
|
1480
1492
|
return this._consoleTask && (v._consoleTask = this._consoleTask), v;
|
|
1481
1493
|
}
|
|
1482
1494
|
return n.prototype = kt, n;
|
|
1483
1495
|
}, set: function(e) {
|
|
1484
|
-
|
|
1496
|
+
B(this, "then", e && e.prototype === kt ? In : { get: function() {
|
|
1485
1497
|
return e;
|
|
1486
1498
|
}, set: In.set });
|
|
1487
1499
|
} };
|
|
@@ -1551,7 +1563,7 @@ function ki() {
|
|
|
1551
1563
|
for (var t = Zt.slice(0), n = t.length; n; ) t[--n]();
|
|
1552
1564
|
}
|
|
1553
1565
|
function Jt(e) {
|
|
1554
|
-
return new
|
|
1566
|
+
return new $(kt, !1, e);
|
|
1555
1567
|
}
|
|
1556
1568
|
function ge(e, t) {
|
|
1557
1569
|
var n = z;
|
|
@@ -1566,7 +1578,7 @@ function ki() {
|
|
|
1566
1578
|
}
|
|
1567
1579
|
};
|
|
1568
1580
|
}
|
|
1569
|
-
|
|
1581
|
+
ee($.prototype, { then: In, _then: function(e, t) {
|
|
1570
1582
|
Sn(this, new br(null, null, e, t, z));
|
|
1571
1583
|
}, catch: function(e) {
|
|
1572
1584
|
if (arguments.length === 1) return this.then(null, e);
|
|
@@ -1578,42 +1590,42 @@ function ki() {
|
|
|
1578
1590
|
});
|
|
1579
1591
|
}, finally: function(e) {
|
|
1580
1592
|
return this.then(function(t) {
|
|
1581
|
-
return
|
|
1593
|
+
return $.resolve(e()).then(function() {
|
|
1582
1594
|
return t;
|
|
1583
1595
|
});
|
|
1584
1596
|
}, function(t) {
|
|
1585
|
-
return
|
|
1597
|
+
return $.resolve(e()).then(function() {
|
|
1586
1598
|
return Jt(t);
|
|
1587
1599
|
});
|
|
1588
1600
|
});
|
|
1589
1601
|
}, timeout: function(e, t) {
|
|
1590
1602
|
var n = this;
|
|
1591
|
-
return e < 1 / 0 ? new
|
|
1603
|
+
return e < 1 / 0 ? new $(function(r, a) {
|
|
1592
1604
|
var u = setTimeout(function() {
|
|
1593
1605
|
return a(new C.Timeout(t));
|
|
1594
1606
|
}, e);
|
|
1595
1607
|
n.then(r, a).finally(clearTimeout.bind(null, u));
|
|
1596
1608
|
}) : this;
|
|
1597
|
-
} }), typeof Symbol < "u" && Symbol.toStringTag &&
|
|
1609
|
+
} }), typeof Symbol < "u" && Symbol.toStringTag && B($.prototype, Symbol.toStringTag, "Dexie.Promise"), nt.env = _r(), ee($, { all: function() {
|
|
1598
1610
|
var e = Fe.apply(null, arguments).map(rn);
|
|
1599
|
-
return new
|
|
1611
|
+
return new $(function(t, n) {
|
|
1600
1612
|
e.length === 0 && t([]);
|
|
1601
1613
|
var r = e.length;
|
|
1602
1614
|
e.forEach(function(a, u) {
|
|
1603
|
-
return
|
|
1615
|
+
return $.resolve(a).then(function(f) {
|
|
1604
1616
|
e[u] = f, --r || t(e);
|
|
1605
1617
|
}, n);
|
|
1606
1618
|
});
|
|
1607
1619
|
});
|
|
1608
1620
|
}, resolve: function(e) {
|
|
1609
|
-
return e instanceof
|
|
1621
|
+
return e instanceof $ ? e : e && typeof e.then == "function" ? new $(function(t, n) {
|
|
1610
1622
|
e.then(t, n);
|
|
1611
|
-
}) : new
|
|
1623
|
+
}) : new $(kt, !0, e);
|
|
1612
1624
|
}, reject: Jt, race: function() {
|
|
1613
1625
|
var e = Fe.apply(null, arguments).map(rn);
|
|
1614
|
-
return new
|
|
1626
|
+
return new $(function(t, n) {
|
|
1615
1627
|
e.map(function(r) {
|
|
1616
|
-
return
|
|
1628
|
+
return $.resolve(r).then(t, n);
|
|
1617
1629
|
});
|
|
1618
1630
|
});
|
|
1619
1631
|
}, PSD: { get: function() {
|
|
@@ -1631,28 +1643,28 @@ function ki() {
|
|
|
1631
1643
|
}, set: function(e) {
|
|
1632
1644
|
Dn = e;
|
|
1633
1645
|
} }, follow: function(e, t) {
|
|
1634
|
-
return new
|
|
1646
|
+
return new $(function(n, r) {
|
|
1635
1647
|
return rt(function(a, u) {
|
|
1636
1648
|
var f = z;
|
|
1637
1649
|
f.unhandleds = [], f.onunhandled = u, f.finalize = ye(function() {
|
|
1638
1650
|
var p, v = this;
|
|
1639
1651
|
p = function() {
|
|
1640
1652
|
v.unhandleds.length === 0 ? a() : u(v.unhandleds[0]);
|
|
1641
|
-
}, Zt.push(function
|
|
1642
|
-
p(), Zt.splice(Zt.indexOf(
|
|
1653
|
+
}, Zt.push(function w() {
|
|
1654
|
+
p(), Zt.splice(Zt.indexOf(w), 1);
|
|
1643
1655
|
}), ++dt, Ft(function() {
|
|
1644
1656
|
--dt == 0 && kn();
|
|
1645
1657
|
}, []);
|
|
1646
1658
|
}, f.finalize), e();
|
|
1647
1659
|
}, t, n, r);
|
|
1648
1660
|
});
|
|
1649
|
-
} }), lt && (lt.allSettled &&
|
|
1661
|
+
} }), lt && (lt.allSettled && B($, "allSettled", function() {
|
|
1650
1662
|
var e = Fe.apply(null, arguments).map(rn);
|
|
1651
|
-
return new
|
|
1663
|
+
return new $(function(t) {
|
|
1652
1664
|
e.length === 0 && t([]);
|
|
1653
1665
|
var n = e.length, r = new Array(n);
|
|
1654
1666
|
e.forEach(function(a, u) {
|
|
1655
|
-
return
|
|
1667
|
+
return $.resolve(a).then(function(f) {
|
|
1656
1668
|
return r[u] = { status: "fulfilled", value: f };
|
|
1657
1669
|
}, function(f) {
|
|
1658
1670
|
return r[u] = { status: "rejected", reason: f };
|
|
@@ -1661,24 +1673,24 @@ function ki() {
|
|
|
1661
1673
|
});
|
|
1662
1674
|
});
|
|
1663
1675
|
});
|
|
1664
|
-
}), lt.any && typeof AggregateError < "u" &&
|
|
1676
|
+
}), lt.any && typeof AggregateError < "u" && B($, "any", function() {
|
|
1665
1677
|
var e = Fe.apply(null, arguments).map(rn);
|
|
1666
|
-
return new
|
|
1678
|
+
return new $(function(t, n) {
|
|
1667
1679
|
e.length === 0 && n(new AggregateError([]));
|
|
1668
1680
|
var r = e.length, a = new Array(r);
|
|
1669
1681
|
e.forEach(function(u, f) {
|
|
1670
|
-
return
|
|
1682
|
+
return $.resolve(u).then(function(p) {
|
|
1671
1683
|
return t(p);
|
|
1672
1684
|
}, function(p) {
|
|
1673
1685
|
a[f] = p, --r || n(new AggregateError(a));
|
|
1674
1686
|
});
|
|
1675
1687
|
});
|
|
1676
1688
|
});
|
|
1677
|
-
}), lt.withResolvers && (
|
|
1689
|
+
}), lt.withResolvers && ($.withResolvers = lt.withResolvers));
|
|
1678
1690
|
var Ne = { awaits: 0, echoes: 0, id: 0 }, Ca = 0, en = [], tn = 0, nn = 0, Da = 0;
|
|
1679
1691
|
function rt(e, t, n, r) {
|
|
1680
1692
|
var a = z, u = Object.create(a);
|
|
1681
|
-
return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Da, nt.env, u.env = An ? { Promise:
|
|
1693
|
+
return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Da, nt.env, u.env = An ? { Promise: $, PromiseProp: { value: $, configurable: !0, writable: !0 }, all: $.all, race: $.race, allSettled: $.allSettled, any: $.any, resolve: $.resolve, reject: $.reject } : {}, t && I(u, t), ++a.ref, u.finalize = function() {
|
|
1682
1694
|
--this.parent.ref || this.parent.finalize();
|
|
1683
1695
|
}, r = ht(u, e, n, r), u.ref === 0 && u.finalize(), r;
|
|
1684
1696
|
}
|
|
@@ -1732,7 +1744,7 @@ function ki() {
|
|
|
1732
1744
|
Promise === lt && Ne.echoes === 0 ? tn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
1733
1745
|
}
|
|
1734
1746
|
("" + Me).indexOf("[native code]") === -1 && (Tt = at = Q);
|
|
1735
|
-
var be =
|
|
1747
|
+
var be = $.reject, pt = "", We = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Tr = "String expected.", xt = [], an = "__dbnames", Fn = "readonly", Bn = "readwrite";
|
|
1736
1748
|
function mt(e, t) {
|
|
1737
1749
|
return e ? t ? function() {
|
|
1738
1750
|
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
@@ -1760,13 +1772,13 @@ function ki() {
|
|
|
1760
1772
|
return t < e ? 1 : e < t ? -1 : 0;
|
|
1761
1773
|
case "binary":
|
|
1762
1774
|
return (function(a, u) {
|
|
1763
|
-
for (var f = a.length, p = u.length, v = f < p ? f : p,
|
|
1775
|
+
for (var f = a.length, p = u.length, v = f < p ? f : p, w = 0; w < v; ++w) if (a[w] !== u[w]) return a[w] < u[w] ? -1 : 1;
|
|
1764
1776
|
return f === p ? 0 : f < p ? -1 : 1;
|
|
1765
1777
|
})(Ar(e), Ar(t));
|
|
1766
1778
|
case "Array":
|
|
1767
1779
|
return (function(a, u) {
|
|
1768
|
-
for (var f = a.length, p = u.length, v = f < p ? f : p,
|
|
1769
|
-
var T = re(a[
|
|
1780
|
+
for (var f = a.length, p = u.length, v = f < p ? f : p, w = 0; w < v; ++w) {
|
|
1781
|
+
var T = re(a[w], u[w]);
|
|
1770
1782
|
if (T !== 0) return T;
|
|
1771
1783
|
}
|
|
1772
1784
|
return f === p ? 0 : f < p ? -1 : 1;
|
|
@@ -1795,7 +1807,7 @@ function ki() {
|
|
|
1795
1807
|
}
|
|
1796
1808
|
var Cr = (pe.prototype._trans = function(e, t, n) {
|
|
1797
1809
|
var r = this._tx || z.trans, a = this.name, u = ke && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
|
|
1798
|
-
function f(
|
|
1810
|
+
function f(w, T, g) {
|
|
1799
1811
|
if (!g.schema[a]) throw new C.NotFound("Table " + a + " not part of transaction");
|
|
1800
1812
|
return t(g.idbtrans, g);
|
|
1801
1813
|
}
|
|
@@ -1803,14 +1815,14 @@ function ki() {
|
|
|
1803
1815
|
try {
|
|
1804
1816
|
var v = r && r.db._novip === this.db._novip ? r === z.trans ? r._promise(e, f, n) : rt(function() {
|
|
1805
1817
|
return r._promise(e, f, n);
|
|
1806
|
-
}, { trans: r, transless: z.transless || z }) : (function
|
|
1818
|
+
}, { trans: r, transless: z.transless || z }) : (function w(T, g, A, b) {
|
|
1807
1819
|
if (T.idbdb && (T._state.openComplete || z.letThrough || T._vip)) {
|
|
1808
1820
|
var E = T._createTransaction(g, A, T._dbSchema);
|
|
1809
1821
|
try {
|
|
1810
1822
|
E.create(), T._state.PR1398_maxLoop = 3;
|
|
1811
1823
|
} catch (O) {
|
|
1812
1824
|
return O.name === l.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
|
|
1813
|
-
return
|
|
1825
|
+
return w(T, g, A, b);
|
|
1814
1826
|
})) : be(O);
|
|
1815
1827
|
}
|
|
1816
1828
|
return E._promise(g, function(O, N) {
|
|
@@ -1833,11 +1845,11 @@ function ki() {
|
|
|
1833
1845
|
T.open().catch(Q);
|
|
1834
1846
|
}
|
|
1835
1847
|
return T._state.dbReadyPromise.then(function() {
|
|
1836
|
-
return
|
|
1848
|
+
return w(T, g, A, b);
|
|
1837
1849
|
});
|
|
1838
1850
|
})(this.db, e, [this.name], f);
|
|
1839
|
-
return u && (v._consoleTask = u, v = v.catch(function(
|
|
1840
|
-
return console.trace(
|
|
1851
|
+
return u && (v._consoleTask = u, v = v.catch(function(w) {
|
|
1852
|
+
return console.trace(w), be(w);
|
|
1841
1853
|
})), v;
|
|
1842
1854
|
} finally {
|
|
1843
1855
|
p && Et();
|
|
@@ -1851,12 +1863,12 @@ function ki() {
|
|
|
1851
1863
|
}).then(t);
|
|
1852
1864
|
}, pe.prototype.where = function(e) {
|
|
1853
1865
|
if (typeof e == "string") return new this.db.WhereClause(this, e);
|
|
1854
|
-
if (
|
|
1866
|
+
if (_(e)) return new this.db.WhereClause(this, "[".concat(e.join("+"), "]"));
|
|
1855
1867
|
var t = y(e);
|
|
1856
1868
|
if (t.length === 1) return this.where(t[0]).equals(e[t[0]]);
|
|
1857
1869
|
var n = this.schema.indexes.concat(this.schema.primKey).filter(function(p) {
|
|
1858
|
-
if (p.compound && t.every(function(
|
|
1859
|
-
return 0 <= p.keyPath.indexOf(
|
|
1870
|
+
if (p.compound && t.every(function(w) {
|
|
1871
|
+
return 0 <= p.keyPath.indexOf(w);
|
|
1860
1872
|
})) {
|
|
1861
1873
|
for (var v = 0; v < t.length; ++v) if (t.indexOf(p.keyPath[v]) === -1) return !1;
|
|
1862
1874
|
return !0;
|
|
@@ -1877,9 +1889,9 @@ function ki() {
|
|
|
1877
1889
|
return re(p, v) === 0;
|
|
1878
1890
|
}
|
|
1879
1891
|
var f = t.reduce(function(g, v) {
|
|
1880
|
-
var
|
|
1881
|
-
return [
|
|
1882
|
-
return b = me(b, v),
|
|
1892
|
+
var w = g[0], T = g[1], g = r[v], A = e[v];
|
|
1893
|
+
return [w || g, w || !g ? mt(T, g && g.multi ? function(b) {
|
|
1894
|
+
return b = me(b, v), _(b) && b.some(function(E) {
|
|
1883
1895
|
return a(A, E);
|
|
1884
1896
|
});
|
|
1885
1897
|
} : function(b) {
|
|
@@ -1902,7 +1914,7 @@ function ki() {
|
|
|
1902
1914
|
}, pe.prototype.toCollection = function() {
|
|
1903
1915
|
return new this.db.Collection(new this.db.WhereClause(this));
|
|
1904
1916
|
}, pe.prototype.orderBy = function(e) {
|
|
1905
|
-
return new this.db.Collection(new this.db.WhereClause(this,
|
|
1917
|
+
return new this.db.Collection(new this.db.WhereClause(this, _(e) ? "[".concat(e.join("+"), "]") : e));
|
|
1906
1918
|
}, pe.prototype.reverse = function() {
|
|
1907
1919
|
return this.toCollection().reverse();
|
|
1908
1920
|
}, pe.prototype.mapToClass = function(e) {
|
|
@@ -1910,25 +1922,25 @@ function ki() {
|
|
|
1910
1922
|
function a() {
|
|
1911
1923
|
return t !== null && t.apply(this, arguments) || this;
|
|
1912
1924
|
}
|
|
1913
|
-
(this.schema.mappedClass = e).prototype instanceof Nr && ((function(v,
|
|
1914
|
-
if (typeof
|
|
1925
|
+
(this.schema.mappedClass = e).prototype instanceof Nr && ((function(v, w) {
|
|
1926
|
+
if (typeof w != "function" && w !== null) throw new TypeError("Class extends value " + String(w) + " is not a constructor or null");
|
|
1915
1927
|
function T() {
|
|
1916
1928
|
this.constructor = v;
|
|
1917
1929
|
}
|
|
1918
|
-
c(v,
|
|
1930
|
+
c(v, w), v.prototype = w === null ? Object.create(w) : (T.prototype = w.prototype, new T());
|
|
1919
1931
|
})(a, t = e), Object.defineProperty(a.prototype, "db", { get: function() {
|
|
1920
1932
|
return n;
|
|
1921
1933
|
}, enumerable: !1, configurable: !0 }), a.prototype.table = function() {
|
|
1922
1934
|
return r;
|
|
1923
1935
|
}, e = a);
|
|
1924
|
-
for (var u = /* @__PURE__ */ new Set(), f = e.prototype; f; f =
|
|
1936
|
+
for (var u = /* @__PURE__ */ new Set(), f = e.prototype; f; f = j(f)) Object.getOwnPropertyNames(f).forEach(function(v) {
|
|
1925
1937
|
return u.add(v);
|
|
1926
1938
|
});
|
|
1927
1939
|
function p(v) {
|
|
1928
1940
|
if (!v) return v;
|
|
1929
|
-
var
|
|
1930
|
-
for (
|
|
1931
|
-
T[
|
|
1941
|
+
var w, T = Object.create(e.prototype);
|
|
1942
|
+
for (w in v) if (!u.has(w)) try {
|
|
1943
|
+
T[w] = v[w];
|
|
1932
1944
|
} catch {
|
|
1933
1945
|
}
|
|
1934
1946
|
return T;
|
|
@@ -1936,14 +1948,14 @@ function ki() {
|
|
|
1936
1948
|
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = p, this.hook("reading", p), e;
|
|
1937
1949
|
}, pe.prototype.defineClass = function() {
|
|
1938
1950
|
return this.mapToClass(function(e) {
|
|
1939
|
-
|
|
1951
|
+
I(this, e);
|
|
1940
1952
|
});
|
|
1941
1953
|
}, pe.prototype.add = function(e, t) {
|
|
1942
1954
|
var n = this, r = this.schema.primKey, a = r.auto, u = r.keyPath, f = e;
|
|
1943
1955
|
return u && a && (f = on(u)(e)), this._trans("readwrite", function(p) {
|
|
1944
1956
|
return n.core.mutate({ trans: p, type: "add", keys: t != null ? [t] : null, values: [f] });
|
|
1945
1957
|
}).then(function(p) {
|
|
1946
|
-
return p.numFailures ?
|
|
1958
|
+
return p.numFailures ? $.reject(p.failures[0]) : p.lastResult;
|
|
1947
1959
|
}).then(function(p) {
|
|
1948
1960
|
if (u) try {
|
|
1949
1961
|
ne(e, u, p);
|
|
@@ -1952,13 +1964,13 @@ function ki() {
|
|
|
1952
1964
|
return p;
|
|
1953
1965
|
});
|
|
1954
1966
|
}, pe.prototype.update = function(e, t) {
|
|
1955
|
-
return typeof e != "object" ||
|
|
1967
|
+
return typeof e != "object" || _(e) ? this.where(":id").equals(e).modify(t) : (e = me(e, this.schema.primKey.keyPath), e === void 0 ? be(new C.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
|
|
1956
1968
|
}, pe.prototype.put = function(e, t) {
|
|
1957
1969
|
var n = this, r = this.schema.primKey, a = r.auto, u = r.keyPath, f = e;
|
|
1958
1970
|
return u && a && (f = on(u)(e)), this._trans("readwrite", function(p) {
|
|
1959
1971
|
return n.core.mutate({ trans: p, type: "put", values: [f], keys: t != null ? [t] : null });
|
|
1960
1972
|
}).then(function(p) {
|
|
1961
|
-
return p.numFailures ?
|
|
1973
|
+
return p.numFailures ? $.reject(p.failures[0]) : p.lastResult;
|
|
1962
1974
|
}).then(function(p) {
|
|
1963
1975
|
if (u) try {
|
|
1964
1976
|
ne(e, u, p);
|
|
@@ -1972,7 +1984,7 @@ function ki() {
|
|
|
1972
1984
|
return t.core.mutate({ trans: n, type: "delete", keys: [e] }).then(function(r) {
|
|
1973
1985
|
return sn(t, [e], r);
|
|
1974
1986
|
}).then(function(r) {
|
|
1975
|
-
return r.numFailures ?
|
|
1987
|
+
return r.numFailures ? $.reject(r.failures[0]) : void 0;
|
|
1976
1988
|
});
|
|
1977
1989
|
});
|
|
1978
1990
|
}, pe.prototype.clear = function() {
|
|
@@ -1982,7 +1994,7 @@ function ki() {
|
|
|
1982
1994
|
return sn(e, null, n);
|
|
1983
1995
|
});
|
|
1984
1996
|
}).then(function(t) {
|
|
1985
|
-
return t.numFailures ?
|
|
1997
|
+
return t.numFailures ? $.reject(t.failures[0]) : void 0;
|
|
1986
1998
|
});
|
|
1987
1999
|
}, pe.prototype.bulkGet = function(e) {
|
|
1988
2000
|
var t = this;
|
|
@@ -1996,11 +2008,11 @@ function ki() {
|
|
|
1996
2008
|
}, pe.prototype.bulkAdd = function(e, t, n) {
|
|
1997
2009
|
var r = this, a = Array.isArray(t) ? t : void 0, u = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
1998
2010
|
return this._trans("readwrite", function(f) {
|
|
1999
|
-
var
|
|
2000
|
-
if (
|
|
2011
|
+
var w = r.schema.primKey, p = w.auto, w = w.keyPath;
|
|
2012
|
+
if (w && a) throw new C.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
2001
2013
|
if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
|
|
2002
|
-
var v = e.length,
|
|
2003
|
-
return r.core.mutate({ trans: f, type: "add", keys: a, values:
|
|
2014
|
+
var v = e.length, w = w && p ? e.map(on(w)) : e;
|
|
2015
|
+
return r.core.mutate({ trans: f, type: "add", keys: a, values: w, wantResults: u }).then(function(E) {
|
|
2004
2016
|
var g = E.numFailures, A = E.results, b = E.lastResult, E = E.failures;
|
|
2005
2017
|
if (g === 0) return u ? A : b;
|
|
2006
2018
|
throw new et("".concat(r.name, ".bulkAdd(): ").concat(g, " of ").concat(v, " operations failed"), E);
|
|
@@ -2009,11 +2021,11 @@ function ki() {
|
|
|
2009
2021
|
}, pe.prototype.bulkPut = function(e, t, n) {
|
|
2010
2022
|
var r = this, a = Array.isArray(t) ? t : void 0, u = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
2011
2023
|
return this._trans("readwrite", function(f) {
|
|
2012
|
-
var
|
|
2013
|
-
if (
|
|
2024
|
+
var w = r.schema.primKey, p = w.auto, w = w.keyPath;
|
|
2025
|
+
if (w && a) throw new C.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
2014
2026
|
if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
|
|
2015
|
-
var v = e.length,
|
|
2016
|
-
return r.core.mutate({ trans: f, type: "put", keys: a, values:
|
|
2027
|
+
var v = e.length, w = w && p ? e.map(on(w)) : e;
|
|
2028
|
+
return r.core.mutate({ trans: f, type: "put", keys: a, values: w, wantResults: u }).then(function(E) {
|
|
2017
2029
|
var g = E.numFailures, A = E.results, b = E.lastResult, E = E.failures;
|
|
2018
2030
|
if (g === 0) return u ? A : b;
|
|
2019
2031
|
throw new et("".concat(r.name, ".bulkPut(): ").concat(g, " of ").concat(v, " operations failed"), E);
|
|
@@ -2027,7 +2039,7 @@ function ki() {
|
|
|
2027
2039
|
}), u = [];
|
|
2028
2040
|
return this._trans("readwrite", function(f) {
|
|
2029
2041
|
return n.getMany({ trans: f, keys: r, cache: "clone" }).then(function(p) {
|
|
2030
|
-
var v = [],
|
|
2042
|
+
var v = [], w = [];
|
|
2031
2043
|
e.forEach(function(g, A) {
|
|
2032
2044
|
var b = g.key, E = g.changes, O = p[A];
|
|
2033
2045
|
if (O) {
|
|
@@ -2037,11 +2049,11 @@ function ki() {
|
|
|
2037
2049
|
if (re(k, b) !== 0) throw new C.Constraint("Cannot update primary key in bulkUpdate()");
|
|
2038
2050
|
} else ne(O, S, k);
|
|
2039
2051
|
}
|
|
2040
|
-
u.push(A), v.push(b),
|
|
2052
|
+
u.push(A), v.push(b), w.push(O);
|
|
2041
2053
|
}
|
|
2042
2054
|
});
|
|
2043
2055
|
var T = v.length;
|
|
2044
|
-
return n.mutate({ trans: f, type: "put", keys: v, values:
|
|
2056
|
+
return n.mutate({ trans: f, type: "put", keys: v, values: w, updates: { keys: r, changeSpecs: a } }).then(function(g) {
|
|
2045
2057
|
var A = g.numFailures, b = g.failures;
|
|
2046
2058
|
if (A === 0) return T;
|
|
2047
2059
|
for (var E = 0, O = Object.keys(b); E < O.length; E++) {
|
|
@@ -2069,8 +2081,8 @@ function ki() {
|
|
|
2069
2081
|
function jt(e) {
|
|
2070
2082
|
function t(f, p) {
|
|
2071
2083
|
if (p) {
|
|
2072
|
-
for (var v = arguments.length,
|
|
2073
|
-
return n[f].subscribe.apply(null,
|
|
2084
|
+
for (var v = arguments.length, w = new Array(v - 1); --v; ) w[v - 1] = arguments[v];
|
|
2085
|
+
return n[f].subscribe.apply(null, w), e;
|
|
2074
2086
|
}
|
|
2075
2087
|
if (typeof f == "string") return n[f];
|
|
2076
2088
|
}
|
|
@@ -2080,7 +2092,7 @@ function ki() {
|
|
|
2080
2092
|
return t;
|
|
2081
2093
|
function u(f, p, v) {
|
|
2082
2094
|
if (typeof f != "object") {
|
|
2083
|
-
var
|
|
2095
|
+
var w;
|
|
2084
2096
|
p = p || On;
|
|
2085
2097
|
var T = { subscribers: [], fire: v = v || Q, subscribe: function(g) {
|
|
2086
2098
|
T.subscribers.indexOf(g) === -1 && (T.subscribers.push(g), T.fire = p(T.fire, g));
|
|
@@ -2091,9 +2103,9 @@ function ki() {
|
|
|
2091
2103
|
} };
|
|
2092
2104
|
return n[f] = t[f] = T;
|
|
2093
2105
|
}
|
|
2094
|
-
y(
|
|
2095
|
-
var A =
|
|
2096
|
-
if (
|
|
2106
|
+
y(w = f).forEach(function(g) {
|
|
2107
|
+
var A = w[g];
|
|
2108
|
+
if (_(A)) u(g, w[g][0], w[g][1]);
|
|
2097
2109
|
else {
|
|
2098
2110
|
if (A !== "asap") throw new C.InvalidArgument("Invalid event config");
|
|
2099
2111
|
var b = u(g, he, function() {
|
|
@@ -2136,13 +2148,13 @@ function ki() {
|
|
|
2136
2148
|
function cn(e, t, n, r) {
|
|
2137
2149
|
var a = e.replayFilter ? mt(e.filter, e.replayFilter()) : e.filter;
|
|
2138
2150
|
if (e.or) {
|
|
2139
|
-
var u = {}, f = function(p, v,
|
|
2151
|
+
var u = {}, f = function(p, v, w) {
|
|
2140
2152
|
var T, g;
|
|
2141
|
-
a && !a(v,
|
|
2153
|
+
a && !a(v, w, function(A) {
|
|
2142
2154
|
return v.stop(A);
|
|
2143
2155
|
}, function(A) {
|
|
2144
2156
|
return v.fail(A);
|
|
2145
|
-
}) || ((g = "" + (T = v.primaryKey)) == "[object ArrayBuffer]" && (g = "" + new Uint8Array(T)), W(u, g) || (u[g] = !0, t(p, v,
|
|
2157
|
+
}) || ((g = "" + (T = v.primaryKey)) == "[object ArrayBuffer]" && (g = "" + new Uint8Array(T)), W(u, g) || (u[g] = !0, t(p, v, w)));
|
|
2146
2158
|
};
|
|
2147
2159
|
return Promise.all([e.or._iterate(f, n), Ir(Dr(e, r, n), e.algorithm, f, !e.keysOnly && e.valueMapper)]);
|
|
2148
2160
|
}
|
|
@@ -2173,7 +2185,7 @@ function ki() {
|
|
|
2173
2185
|
var t = this["@@propmod"];
|
|
2174
2186
|
if (t.add !== void 0) {
|
|
2175
2187
|
var n = t.add;
|
|
2176
|
-
if (
|
|
2188
|
+
if (_(n)) return d(d([], _(e) ? e : [], !0), n).sort();
|
|
2177
2189
|
if (typeof n == "number") return (Number(e) || 0) + n;
|
|
2178
2190
|
if (typeof n == "bigint") try {
|
|
2179
2191
|
return BigInt(e) + n;
|
|
@@ -2184,7 +2196,7 @@ function ki() {
|
|
|
2184
2196
|
}
|
|
2185
2197
|
if (t.remove !== void 0) {
|
|
2186
2198
|
var r = t.remove;
|
|
2187
|
-
if (
|
|
2199
|
+
if (_(r)) return _(e) ? e.filter(function(a) {
|
|
2188
2200
|
return !r.includes(a);
|
|
2189
2201
|
}).sort() : [];
|
|
2190
2202
|
if (typeof r == "number") return Number(e) - r;
|
|
@@ -2213,7 +2225,7 @@ function ki() {
|
|
|
2213
2225
|
return cn(this._ctx, e, t, this._ctx.table.core);
|
|
2214
2226
|
}, ue.prototype.clone = function(e) {
|
|
2215
2227
|
var t = Object.create(this.constructor.prototype), n = Object.create(this._ctx);
|
|
2216
|
-
return e &&
|
|
2228
|
+
return e && I(n, e), t._ctx = n, t;
|
|
2217
2229
|
}, ue.prototype.raw = function() {
|
|
2218
2230
|
return this._ctx.valueMapper = null, this;
|
|
2219
2231
|
}, ue.prototype.each = function(e) {
|
|
@@ -2237,12 +2249,12 @@ function ki() {
|
|
|
2237
2249
|
}).then(e);
|
|
2238
2250
|
}, ue.prototype.sortBy = function(e, t) {
|
|
2239
2251
|
var n = e.split(".").reverse(), r = n[0], a = n.length - 1;
|
|
2240
|
-
function u(v,
|
|
2241
|
-
return
|
|
2252
|
+
function u(v, w) {
|
|
2253
|
+
return w ? u(v[n[w]], w - 1) : v[r];
|
|
2242
2254
|
}
|
|
2243
2255
|
var f = this._ctx.dir === "next" ? 1 : -1;
|
|
2244
|
-
function p(v,
|
|
2245
|
-
return re(u(v, a), u(
|
|
2256
|
+
function p(v, w) {
|
|
2257
|
+
return re(u(v, a), u(w, a)) * f;
|
|
2246
2258
|
}
|
|
2247
2259
|
return this.toArray(function(v) {
|
|
2248
2260
|
return v.sort(p);
|
|
@@ -2372,7 +2384,7 @@ function ki() {
|
|
|
2372
2384
|
}
|
|
2373
2385
|
return S;
|
|
2374
2386
|
});
|
|
2375
|
-
var p = n.table.core, g = p.schema.primaryKey, v = g.outbound,
|
|
2387
|
+
var p = n.table.core, g = p.schema.primaryKey, v = g.outbound, w = g.extractKey, T = 200, g = t.db._options.modifyChunkSize;
|
|
2376
2388
|
g && (T = typeof g == "object" ? g[p.name] || g["*"] || 200 : g);
|
|
2377
2389
|
function A(D, P) {
|
|
2378
2390
|
var k = P.failures, P = P.numFailures;
|
|
@@ -2387,23 +2399,23 @@ function ki() {
|
|
|
2387
2399
|
function S(P) {
|
|
2388
2400
|
var M = Math.min(T, D.length - P), L = D.slice(P, P + M);
|
|
2389
2401
|
return (N ? Promise.resolve([]) : p.getMany({ trans: r, keys: L, cache: "immutable" })).then(function(K) {
|
|
2390
|
-
var q = [],
|
|
2402
|
+
var q = [], G = [], U = v ? [] : null, X = N ? L : [];
|
|
2391
2403
|
if (!N) for (var te = 0; te < M; ++te) {
|
|
2392
2404
|
var oe = K[te], Z = { value: Pe(oe), primKey: D[P + te] };
|
|
2393
|
-
f.call(Z, Z.value, Z) !== !1 && (Z.value == null ?
|
|
2405
|
+
f.call(Z, Z.value, Z) !== !1 && (Z.value == null ? X.push(D[P + te]) : v || re(w(oe), w(Z.value)) === 0 ? (G.push(Z.value), v && U.push(D[P + te])) : (X.push(D[P + te]), q.push(Z.value)));
|
|
2394
2406
|
}
|
|
2395
2407
|
return Promise.resolve(0 < q.length && p.mutate({ trans: r, type: "add", values: q }).then(function(ve) {
|
|
2396
|
-
for (var H in ve.failures)
|
|
2408
|
+
for (var H in ve.failures) X.splice(parseInt(H), 1);
|
|
2397
2409
|
A(q.length, ve);
|
|
2398
2410
|
})).then(function() {
|
|
2399
|
-
return (0 <
|
|
2400
|
-
return A(
|
|
2411
|
+
return (0 < G.length || k && typeof e == "object") && p.mutate({ trans: r, type: "put", keys: U, values: G, criteria: k, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < P }).then(function(ve) {
|
|
2412
|
+
return A(G.length, ve);
|
|
2401
2413
|
});
|
|
2402
2414
|
}).then(function() {
|
|
2403
|
-
return (0 <
|
|
2404
|
-
return sn(n.table,
|
|
2415
|
+
return (0 < X.length || k && N) && p.mutate({ trans: r, type: "delete", keys: X, criteria: k, isAdditionalChunk: 0 < P }).then(function(ve) {
|
|
2416
|
+
return sn(n.table, X, ve);
|
|
2405
2417
|
}).then(function(ve) {
|
|
2406
|
-
return A(
|
|
2418
|
+
return A(X.length, ve);
|
|
2407
2419
|
});
|
|
2408
2420
|
}).then(function() {
|
|
2409
2421
|
return D.length > P + M && S(P + T);
|
|
@@ -2424,8 +2436,8 @@ function ki() {
|
|
|
2424
2436
|
return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(u) {
|
|
2425
2437
|
return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(v) {
|
|
2426
2438
|
var p = v.failures, v = v.numFailures;
|
|
2427
|
-
if (v) throw new Je("Could not delete some values", Object.keys(p).map(function(
|
|
2428
|
-
return p[
|
|
2439
|
+
if (v) throw new Je("Could not delete some values", Object.keys(p).map(function(w) {
|
|
2440
|
+
return p[w];
|
|
2429
2441
|
}), u - v);
|
|
2430
2442
|
return u - v;
|
|
2431
2443
|
});
|
|
@@ -2452,7 +2464,7 @@ function ki() {
|
|
|
2452
2464
|
}).limit(0);
|
|
2453
2465
|
}
|
|
2454
2466
|
function ln(e, t, n, r) {
|
|
2455
|
-
var a, u, f, p, v,
|
|
2467
|
+
var a, u, f, p, v, w, T, g = n.length;
|
|
2456
2468
|
if (!n.every(function(E) {
|
|
2457
2469
|
return typeof E == "string";
|
|
2458
2470
|
})) return Be(e, Tr);
|
|
@@ -2475,7 +2487,7 @@ function ki() {
|
|
|
2475
2487
|
return N.upper;
|
|
2476
2488
|
}), v = O.map(function(N) {
|
|
2477
2489
|
return N.lower;
|
|
2478
|
-
}), T = (
|
|
2490
|
+
}), T = (w = E) === "next" ? "" : r;
|
|
2479
2491
|
}
|
|
2480
2492
|
A("next"), e = new e.Collection(e, function() {
|
|
2481
2493
|
return ot(p[0], v[g - 1] + r);
|
|
@@ -2489,14 +2501,14 @@ function ki() {
|
|
|
2489
2501
|
var S = u(D);
|
|
2490
2502
|
if (t(S, v, b)) return !0;
|
|
2491
2503
|
for (var k = null, P = b; P < g; ++P) {
|
|
2492
|
-
var M = (function(L, K, q,
|
|
2493
|
-
for (var te = Math.min(L.length,
|
|
2504
|
+
var M = (function(L, K, q, G, U, X) {
|
|
2505
|
+
for (var te = Math.min(L.length, G.length), oe = -1, Z = 0; Z < te; ++Z) {
|
|
2494
2506
|
var ve = K[Z];
|
|
2495
|
-
if (ve !==
|
|
2507
|
+
if (ve !== G[Z]) return U(L[Z], q[Z]) < 0 ? L.substr(0, Z) + q[Z] + q.substr(Z + 1) : U(L[Z], G[Z]) < 0 ? L.substr(0, Z) + G[Z] + q.substr(Z + 1) : 0 <= oe ? L.substr(0, oe) + K[oe] + q.substr(oe + 1) : null;
|
|
2496
2508
|
U(L[Z], ve) < 0 && (oe = Z);
|
|
2497
2509
|
}
|
|
2498
|
-
return te <
|
|
2499
|
-
})(D, S, p[P], v[P], f,
|
|
2510
|
+
return te < G.length && X === "next" ? L + q.substr(L.length) : te < L.length && X === "prev" ? L.substr(0, q.length) : oe < 0 ? null : L.substr(0, oe) + G[oe] + q.substr(oe + 1);
|
|
2511
|
+
})(D, S, p[P], v[P], f, w);
|
|
2500
2512
|
M === null && k === null ? b = P + 1 : (k === null || 0 < f(k, M)) && (k = M);
|
|
2501
2513
|
}
|
|
2502
2514
|
return O(k !== null ? function() {
|
|
@@ -2604,7 +2616,7 @@ function ki() {
|
|
|
2604
2616
|
if (!D.every(function(S) {
|
|
2605
2617
|
return S[0] !== void 0 && S[1] !== void 0 && a(S[0], S[1]) <= 0;
|
|
2606
2618
|
})) return Be(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", C.InvalidArgument);
|
|
2607
|
-
var v = !t || t.includeLowers !== !1,
|
|
2619
|
+
var v = !t || t.includeLowers !== !1, w = t && t.includeUppers === !0, T, g = a;
|
|
2608
2620
|
function A(S, k) {
|
|
2609
2621
|
return g(S[0], k[0]);
|
|
2610
2622
|
}
|
|
@@ -2622,7 +2634,7 @@ function ki() {
|
|
|
2622
2634
|
} catch {
|
|
2623
2635
|
return Be(this, We);
|
|
2624
2636
|
}
|
|
2625
|
-
var b = 0, E =
|
|
2637
|
+
var b = 0, E = w ? function(S) {
|
|
2626
2638
|
return 0 < a(S, T[b][1]);
|
|
2627
2639
|
} : function(S) {
|
|
2628
2640
|
return 0 <= a(S, T[b][1]);
|
|
@@ -2631,7 +2643,7 @@ function ki() {
|
|
|
2631
2643
|
} : function(S) {
|
|
2632
2644
|
return 0 <= u(S, T[b][0]);
|
|
2633
2645
|
}, N = E, D = new this.Collection(this, function() {
|
|
2634
|
-
return ot(T[0][0], T[T.length - 1][1], !v, !
|
|
2646
|
+
return ot(T[0][0], T[T.length - 1][1], !v, !w);
|
|
2635
2647
|
});
|
|
2636
2648
|
return D._ondirectionchange = function(S) {
|
|
2637
2649
|
g = S === "next" ? (N = E, a) : (N = O, u), T.sort(A);
|
|
@@ -2696,13 +2708,13 @@ function ki() {
|
|
|
2696
2708
|
var r = this;
|
|
2697
2709
|
if (e === "readwrite" && this.mode !== "readwrite") return be(new C.ReadOnly("Transaction is readonly"));
|
|
2698
2710
|
if (!this.active) return be(new C.TransactionInactive());
|
|
2699
|
-
if (this._locked()) return new
|
|
2711
|
+
if (this._locked()) return new $(function(u, f) {
|
|
2700
2712
|
r._blockedFuncs.push([function() {
|
|
2701
2713
|
r._promise(e, t, n).then(u, f);
|
|
2702
2714
|
}, z]);
|
|
2703
2715
|
});
|
|
2704
2716
|
if (n) return rt(function() {
|
|
2705
|
-
var u = new
|
|
2717
|
+
var u = new $(function(f, p) {
|
|
2706
2718
|
r._lock();
|
|
2707
2719
|
var v = t(f, p, r);
|
|
2708
2720
|
v && v.then && v.then(f, p);
|
|
@@ -2711,7 +2723,7 @@ function ki() {
|
|
|
2711
2723
|
return r._unlock();
|
|
2712
2724
|
}), u._lib = !0, u;
|
|
2713
2725
|
});
|
|
2714
|
-
var a = new
|
|
2726
|
+
var a = new $(function(u, f) {
|
|
2715
2727
|
var p = t(u, f, r);
|
|
2716
2728
|
p && p.then && p.then(u, f);
|
|
2717
2729
|
});
|
|
@@ -2719,7 +2731,7 @@ function ki() {
|
|
|
2719
2731
|
}, $e.prototype._root = function() {
|
|
2720
2732
|
return this.parent ? this.parent._root() : this;
|
|
2721
2733
|
}, $e.prototype.waitFor = function(e) {
|
|
2722
|
-
var t, n = this._root(), r =
|
|
2734
|
+
var t, n = this._root(), r = $.resolve(e);
|
|
2723
2735
|
n._waitingFor ? n._waitingFor = n._waitingFor.then(function() {
|
|
2724
2736
|
return r;
|
|
2725
2737
|
}) : (n._waitingFor = r, n._waitingQueue = [], t = n.idbtrans.objectStore(n.storeNames[0]), (function u() {
|
|
@@ -2727,7 +2739,7 @@ function ki() {
|
|
|
2727
2739
|
n._waitingFor && (t.get(-1 / 0).onsuccess = u);
|
|
2728
2740
|
})());
|
|
2729
2741
|
var a = n._waitingFor;
|
|
2730
|
-
return new
|
|
2742
|
+
return new $(function(u, f) {
|
|
2731
2743
|
r.then(function(p) {
|
|
2732
2744
|
return n._waitingQueue.push(ge(u.bind(null, p)));
|
|
2733
2745
|
}, function(p) {
|
|
@@ -2803,11 +2815,11 @@ function ki() {
|
|
|
2803
2815
|
var N = O.trans, D = O.type, S = O.keys, k = O.values, P = O.range;
|
|
2804
2816
|
return new Promise(function(M, L) {
|
|
2805
2817
|
M = ge(M);
|
|
2806
|
-
var K = N.objectStore(E), q = K.keyPath == null,
|
|
2807
|
-
if (!
|
|
2808
|
-
var U,
|
|
2818
|
+
var K = N.objectStore(E), q = K.keyPath == null, G = D === "put" || D === "add";
|
|
2819
|
+
if (!G && D !== "delete" && D !== "deleteRange") throw new Error("Invalid operation type: " + D);
|
|
2820
|
+
var U, X = (S || k || { length: 1 }).length;
|
|
2809
2821
|
if (S && k && S.length !== k.length) throw new Error("Given keys array must have same length as given values array.");
|
|
2810
|
-
if (
|
|
2822
|
+
if (X === 0) return M({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
2811
2823
|
function te(Se) {
|
|
2812
2824
|
++ve, qt(Se);
|
|
2813
2825
|
}
|
|
@@ -2816,9 +2828,9 @@ function ki() {
|
|
|
2816
2828
|
if (P.type === 4) return M({ numFailures: ve, failures: Z, results: [], lastResult: void 0 });
|
|
2817
2829
|
P.type === 3 ? oe.push(U = K.clear()) : oe.push(U = K.delete(r(P)));
|
|
2818
2830
|
} else {
|
|
2819
|
-
var q =
|
|
2820
|
-
if (
|
|
2821
|
-
else for (Ie = 0; Ie <
|
|
2831
|
+
var q = G ? q ? [k, S] : [k, null] : [S, null], H = q[0], De = q[1];
|
|
2832
|
+
if (G) for (var Ie = 0; Ie < X; ++Ie) oe.push(U = De && De[Ie] !== void 0 ? K[D](H[Ie], De[Ie]) : K[D](H[Ie])), U.onerror = te;
|
|
2833
|
+
else for (Ie = 0; Ie < X; ++Ie) oe.push(U = K[D](H[Ie])), U.onerror = te;
|
|
2822
2834
|
}
|
|
2823
2835
|
function En(Se) {
|
|
2824
2836
|
Se = Se.target.result, oe.forEach(function(vt, or) {
|
|
@@ -2835,9 +2847,9 @@ function ki() {
|
|
|
2835
2847
|
var N = O.trans, D = O.keys;
|
|
2836
2848
|
return new Promise(function(S, k) {
|
|
2837
2849
|
S = ge(S);
|
|
2838
|
-
for (var P, M = N.objectStore(E), L = D.length, K = new Array(L), q = 0,
|
|
2839
|
-
oe = oe.target, K[oe._pos] = oe.result, ++
|
|
2840
|
-
},
|
|
2850
|
+
for (var P, M = N.objectStore(E), L = D.length, K = new Array(L), q = 0, G = 0, U = function(oe) {
|
|
2851
|
+
oe = oe.target, K[oe._pos] = oe.result, ++G === q && S(K);
|
|
2852
|
+
}, X = Ge(k), te = 0; te < L; ++te) D[te] != null && ((P = M.get(D[te]))._pos = te, P.onsuccess = U, P.onerror = X, ++q);
|
|
2841
2853
|
q === 0 && S(K);
|
|
2842
2854
|
});
|
|
2843
2855
|
}, get: function(O) {
|
|
@@ -2849,14 +2861,14 @@ function ki() {
|
|
|
2849
2861
|
return S(M.target.result);
|
|
2850
2862
|
}, P.onerror = Ge(k);
|
|
2851
2863
|
});
|
|
2852
|
-
}, query: (b =
|
|
2864
|
+
}, query: (b = w, function(O) {
|
|
2853
2865
|
return new Promise(function(N, D) {
|
|
2854
2866
|
N = ge(N);
|
|
2855
|
-
var S, k, P, q = O.trans, M = O.values, L = O.limit, U = O.query, K = L === 1 / 0 ? void 0 : L,
|
|
2867
|
+
var S, k, P, q = O.trans, M = O.values, L = O.limit, U = O.query, K = L === 1 / 0 ? void 0 : L, G = U.index, U = U.range, q = q.objectStore(E), G = G.isPrimaryKey ? q : q.index(G.name), U = r(U);
|
|
2856
2868
|
if (L === 0) return N({ result: [] });
|
|
2857
|
-
b ? ((K = M ?
|
|
2858
|
-
return N({ result:
|
|
2859
|
-
}, K.onerror = Ge(D)) : (S = 0, k = !M && "openKeyCursor" in
|
|
2869
|
+
b ? ((K = M ? G.getAll(U, K) : G.getAllKeys(U, K)).onsuccess = function(X) {
|
|
2870
|
+
return N({ result: X.target.result });
|
|
2871
|
+
}, K.onerror = Ge(D)) : (S = 0, k = !M && "openKeyCursor" in G ? G.openKeyCursor(U) : G.openCursor(U), P = [], k.onsuccess = function(X) {
|
|
2860
2872
|
var te = k.result;
|
|
2861
2873
|
return te ? (P.push(M ? te.value : te.primaryKey), ++S === L ? N({ result: P }) : void te.continue()) : N({ result: P });
|
|
2862
2874
|
}, k.onerror = Ge(D));
|
|
@@ -2865,8 +2877,8 @@ function ki() {
|
|
|
2865
2877
|
var N = O.trans, D = O.values, S = O.query, k = O.reverse, P = O.unique;
|
|
2866
2878
|
return new Promise(function(M, L) {
|
|
2867
2879
|
M = ge(M);
|
|
2868
|
-
var
|
|
2869
|
-
U.onerror = Ge(L), U.onsuccess = ge(function(
|
|
2880
|
+
var G = S.index, K = S.range, q = N.objectStore(E), q = G.isPrimaryKey ? q : q.index(G.name), G = k ? P ? "prevunique" : "prev" : P ? "nextunique" : "next", U = !D && "openKeyCursor" in q ? q.openKeyCursor(r(K), G) : q.openCursor(r(K), G);
|
|
2881
|
+
U.onerror = Ge(L), U.onsuccess = ge(function(X) {
|
|
2870
2882
|
var te, oe, Z, ve, H = U.result;
|
|
2871
2883
|
H ? (H.___id = ++Fa, H.done = !1, te = H.continue.bind(H), oe = (oe = H.continuePrimaryKey) && oe.bind(H), Z = H.advance.bind(H), ve = function() {
|
|
2872
2884
|
throw new Error("Cursor not stopped");
|
|
@@ -2914,16 +2926,16 @@ function ki() {
|
|
|
2914
2926
|
var u, f, p, T = (f = v, p = Br((u = e).objectStoreNames), { schema: { name: u.name, tables: p.map(function(A) {
|
|
2915
2927
|
return f.objectStore(A);
|
|
2916
2928
|
}).map(function(A) {
|
|
2917
|
-
var b = A.keyPath, N = A.autoIncrement, E =
|
|
2929
|
+
var b = A.keyPath, N = A.autoIncrement, E = _(b), O = {}, N = { name: A.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: E, keyPath: b, autoIncrement: N, unique: !0, extractKey: Un(b) }, indexes: Br(A.indexNames).map(function(D) {
|
|
2918
2930
|
return A.index(D);
|
|
2919
2931
|
}).map(function(P) {
|
|
2920
|
-
var S = P.name, k = P.unique, M = P.multiEntry, P = P.keyPath, M = { name: S, compound:
|
|
2932
|
+
var S = P.name, k = P.unique, M = P.multiEntry, P = P.keyPath, M = { name: S, compound: _(P), keyPath: P, unique: k, multiEntry: M, extractKey: Un(P) };
|
|
2921
2933
|
return O[Vt(P)] = M;
|
|
2922
2934
|
}), getIndexByKeyPath: function(D) {
|
|
2923
2935
|
return O[Vt(D)];
|
|
2924
2936
|
} };
|
|
2925
2937
|
return O[":id"] = N.primaryKey, b != null && (O[Vt(b)] = N.primaryKey), N;
|
|
2926
|
-
}) }, hasGetAll: 0 < p.length && "getAll" in f.objectStore(p[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = T.schema,
|
|
2938
|
+
}) }, hasGetAll: 0 < p.length && "getAll" in f.objectStore(p[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = T.schema, w = T.hasGetAll, T = v.tables.map(a), g = {};
|
|
2927
2939
|
return T.forEach(function(A) {
|
|
2928
2940
|
return g[A.name] = A;
|
|
2929
2941
|
}), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(A) {
|
|
@@ -2950,13 +2962,13 @@ function ki() {
|
|
|
2950
2962
|
n.forEach(function(a) {
|
|
2951
2963
|
var u = r[a];
|
|
2952
2964
|
t.forEach(function(f) {
|
|
2953
|
-
var p = (function v(
|
|
2954
|
-
return se(
|
|
2965
|
+
var p = (function v(w, T) {
|
|
2966
|
+
return se(w, T) || (w = j(w)) && v(w, T);
|
|
2955
2967
|
})(f, a);
|
|
2956
|
-
(!p || "value" in p && p.value === void 0) && (f === e.Transaction.prototype || f instanceof e.Transaction ?
|
|
2968
|
+
(!p || "value" in p && p.value === void 0) && (f === e.Transaction.prototype || f instanceof e.Transaction ? B(f, a, { get: function() {
|
|
2957
2969
|
return this.table(a);
|
|
2958
2970
|
}, set: function(v) {
|
|
2959
|
-
|
|
2971
|
+
ce(this, a, { value: v, writable: !0, configurable: !0, enumerable: !0 });
|
|
2960
2972
|
} }) : f[a] = new e.Table(a, u));
|
|
2961
2973
|
});
|
|
2962
2974
|
});
|
|
@@ -2976,9 +2988,9 @@ function ki() {
|
|
|
2976
2988
|
u.create(n), u._completion.catch(r);
|
|
2977
2989
|
var f = u._reject.bind(u), p = z.transless || z;
|
|
2978
2990
|
rt(function() {
|
|
2979
|
-
return z.trans = u, z.transless = p, t !== 0 ? (fn(e, n),
|
|
2980
|
-
return T ??
|
|
2981
|
-
}) :
|
|
2991
|
+
return z.trans = u, z.transless = p, t !== 0 ? (fn(e, n), w = t, ((v = u).storeNames.includes("$meta") ? v.table("$meta").get("version").then(function(T) {
|
|
2992
|
+
return T ?? w;
|
|
2993
|
+
}) : $.resolve(w)).then(function(T) {
|
|
2982
2994
|
return A = T, b = u, E = n, O = [], T = (g = e)._versions, N = g._dbSchema = pn(0, g.idbdb, E), (T = T.filter(function(D) {
|
|
2983
2995
|
return D._cfg.version >= A;
|
|
2984
2996
|
})).length !== 0 ? (T.forEach(function(D) {
|
|
@@ -2986,31 +2998,31 @@ function ki() {
|
|
|
2986
2998
|
var S = N, k = D._cfg.dbschema;
|
|
2987
2999
|
mn(g, S, E), mn(g, k, E), N = g._dbSchema = k;
|
|
2988
3000
|
var P = Gn(S, k);
|
|
2989
|
-
P.add.forEach(function(
|
|
2990
|
-
$n(E,
|
|
2991
|
-
}), P.change.forEach(function(
|
|
2992
|
-
if (
|
|
2993
|
-
var U = E.objectStore(
|
|
2994
|
-
|
|
2995
|
-
return hn(U,
|
|
2996
|
-
}),
|
|
2997
|
-
U.deleteIndex(
|
|
2998
|
-
}),
|
|
2999
|
-
return U.deleteIndex(
|
|
3001
|
+
P.add.forEach(function(G) {
|
|
3002
|
+
$n(E, G[0], G[1].primKey, G[1].indexes);
|
|
3003
|
+
}), P.change.forEach(function(G) {
|
|
3004
|
+
if (G.recreate) throw new C.Upgrade("Not yet support for changing primary key");
|
|
3005
|
+
var U = E.objectStore(G.name);
|
|
3006
|
+
G.add.forEach(function(X) {
|
|
3007
|
+
return hn(U, X);
|
|
3008
|
+
}), G.change.forEach(function(X) {
|
|
3009
|
+
U.deleteIndex(X.name), hn(U, X);
|
|
3010
|
+
}), G.del.forEach(function(X) {
|
|
3011
|
+
return U.deleteIndex(X);
|
|
3000
3012
|
});
|
|
3001
3013
|
});
|
|
3002
3014
|
var M = D._cfg.contentUpgrade;
|
|
3003
3015
|
if (M && D._cfg.version > A) {
|
|
3004
3016
|
fn(g, E), b._memoizedTables = {};
|
|
3005
3017
|
var L = Re(k);
|
|
3006
|
-
P.del.forEach(function(
|
|
3007
|
-
L[
|
|
3018
|
+
P.del.forEach(function(G) {
|
|
3019
|
+
L[G] = S[G];
|
|
3008
3020
|
}), Vn(g, [g.Transaction.prototype]), dn(g, [g.Transaction.prototype], y(L), L), b.schema = L;
|
|
3009
3021
|
var K, q = qe(M);
|
|
3010
|
-
return q && Tt(), P =
|
|
3011
|
-
var
|
|
3012
|
-
(K = M(b)) && q && (
|
|
3013
|
-
}), K && typeof K.then == "function" ?
|
|
3022
|
+
return q && Tt(), P = $.follow(function() {
|
|
3023
|
+
var G;
|
|
3024
|
+
(K = M(b)) && q && (G = at.bind(null, null), K.then(G, G));
|
|
3025
|
+
}), K && typeof K.then == "function" ? $.resolve(K) : P.then(function() {
|
|
3014
3026
|
return K;
|
|
3015
3027
|
});
|
|
3016
3028
|
}
|
|
@@ -3025,17 +3037,17 @@ function ki() {
|
|
|
3025
3037
|
})) : S.objectStore("$meta").put(D._cfg.version, "version"));
|
|
3026
3038
|
});
|
|
3027
3039
|
}), (function D() {
|
|
3028
|
-
return O.length ?
|
|
3040
|
+
return O.length ? $.resolve(O.shift()(b.idbtrans)).then(D) : $.resolve();
|
|
3029
3041
|
})().then(function() {
|
|
3030
3042
|
jr(N, E);
|
|
3031
|
-
})) :
|
|
3043
|
+
})) : $.resolve();
|
|
3032
3044
|
var g, A, b, E, O, N;
|
|
3033
3045
|
}).catch(f)) : (y(a).forEach(function(T) {
|
|
3034
3046
|
$n(n, T, a[T].primKey, a[T].indexes);
|
|
3035
|
-
}), fn(e, n), void
|
|
3047
|
+
}), fn(e, n), void $.follow(function() {
|
|
3036
3048
|
return e.on.populate.fire(u);
|
|
3037
3049
|
}).catch(f));
|
|
3038
|
-
var v,
|
|
3050
|
+
var v, w;
|
|
3039
3051
|
});
|
|
3040
3052
|
}
|
|
3041
3053
|
function qa(e, t) {
|
|
@@ -3062,10 +3074,10 @@ function ki() {
|
|
|
3062
3074
|
var f = { name: n, def: u, recreate: !1, del: [], add: [], change: [] };
|
|
3063
3075
|
if ("" + (a.primKey.keyPath || "") != "" + (u.primKey.keyPath || "") || a.primKey.auto !== u.primKey.auto) f.recreate = !0, r.change.push(f);
|
|
3064
3076
|
else {
|
|
3065
|
-
var p = a.idxByName, v = u.idxByName,
|
|
3066
|
-
for (
|
|
3067
|
-
for (
|
|
3068
|
-
var T = p[
|
|
3077
|
+
var p = a.idxByName, v = u.idxByName, w = void 0;
|
|
3078
|
+
for (w in p) v[w] || f.del.push(w);
|
|
3079
|
+
for (w in v) {
|
|
3080
|
+
var T = p[w], g = v[w];
|
|
3069
3081
|
T ? T.src !== g.src && f.change.push(g) : f.add.push(g);
|
|
3070
3082
|
}
|
|
3071
3083
|
(0 < f.del.length || 0 < f.add.length || 0 < f.change.length) && r.change.push(f);
|
|
@@ -3091,8 +3103,8 @@ function ki() {
|
|
|
3091
3103
|
function pn(e, t, n) {
|
|
3092
3104
|
var r = {};
|
|
3093
3105
|
return xe(t.objectStoreNames, 0).forEach(function(a) {
|
|
3094
|
-
for (var u = n.objectStore(a), f = qn(Fr(
|
|
3095
|
-
var T = u.index(u.indexNames[v]),
|
|
3106
|
+
for (var u = n.objectStore(a), f = qn(Fr(w = u.keyPath), w || "", !0, !1, !!u.autoIncrement, w && typeof w != "string", !0), p = [], v = 0; v < u.indexNames.length; ++v) {
|
|
3107
|
+
var T = u.index(u.indexNames[v]), w = T.keyPath, T = qn(T.name, w, !!T.unique, !!T.multiEntry, !1, w && typeof w != "string", !1);
|
|
3096
3108
|
p.push(T);
|
|
3097
3109
|
}
|
|
3098
3110
|
r[a] = Ln(a, f, p);
|
|
@@ -3103,8 +3115,8 @@ function ki() {
|
|
|
3103
3115
|
var u = r[a], f = n.objectStore(u);
|
|
3104
3116
|
e._hasGetAll = "getAll" in f;
|
|
3105
3117
|
for (var p = 0; p < f.indexNames.length; ++p) {
|
|
3106
|
-
var v = f.indexNames[p],
|
|
3107
|
-
!t[u] || (
|
|
3118
|
+
var v = f.indexNames[p], w = f.index(v).keyPath, T = typeof w == "string" ? w : "[" + xe(w).join("+") + "]";
|
|
3119
|
+
!t[u] || (w = t[u].idxByName[T]) && (w.name = v, delete t[u].idxByName[T], t[u].idxByName[v] = w);
|
|
3108
3120
|
}
|
|
3109
3121
|
}
|
|
3110
3122
|
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && h.WorkerGlobalScope && h instanceof h.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
|
|
@@ -3112,7 +3124,7 @@ function ki() {
|
|
|
3112
3124
|
function Mr(e) {
|
|
3113
3125
|
return e.split(",").map(function(t, n) {
|
|
3114
3126
|
var u = t.split(":"), r = (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;
|
|
3115
|
-
return qn(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t),
|
|
3127
|
+
return qn(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), _(u), n === 0, r);
|
|
3116
3128
|
});
|
|
3117
3129
|
}
|
|
3118
3130
|
var La = (At.prototype._createTableSchema = Ln, At.prototype._parseIndexSyntax = Mr, At.prototype._parseStoresSpec = function(e, t) {
|
|
@@ -3130,10 +3142,10 @@ function ki() {
|
|
|
3130
3142
|
});
|
|
3131
3143
|
}, At.prototype.stores = function(n) {
|
|
3132
3144
|
var t = this.db;
|
|
3133
|
-
this._cfg.storesSource = this._cfg.storesSource ?
|
|
3145
|
+
this._cfg.storesSource = this._cfg.storesSource ? I(this._cfg.storesSource, n) : n;
|
|
3134
3146
|
var n = t._versions, r = {}, a = {};
|
|
3135
3147
|
return n.forEach(function(u) {
|
|
3136
|
-
|
|
3148
|
+
I(r, u._cfg.storesSource), a = u._cfg.dbschema = {}, u._parseStoresSpec(r, a);
|
|
3137
3149
|
}), t._dbSchema = a, Vn(t, [t._allTables, t, t.Transaction.prototype]), dn(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], y(a), a), t._storeNames = y(a), this;
|
|
3138
3150
|
}, At.prototype.upgrade = function(e) {
|
|
3139
3151
|
return this._cfg.contentUpgrade = wt(this._cfg.contentUpgrade || Q, e), this;
|
|
@@ -3158,15 +3170,15 @@ function ki() {
|
|
|
3158
3170
|
var Ce = function(e, t) {
|
|
3159
3171
|
if (!this) {
|
|
3160
3172
|
var n = new Ce();
|
|
3161
|
-
return e && "d" in e &&
|
|
3173
|
+
return e && "d" in e && I(n, e), n;
|
|
3162
3174
|
}
|
|
3163
|
-
|
|
3175
|
+
I(this, arguments.length ? { d: 1, from: e, to: 1 < arguments.length ? t : e } : { d: 0 });
|
|
3164
3176
|
};
|
|
3165
3177
|
function Gt(e, t, n) {
|
|
3166
3178
|
var r = re(t, n);
|
|
3167
3179
|
if (!isNaN(r)) {
|
|
3168
3180
|
if (0 < r) throw RangeError();
|
|
3169
|
-
if (zn(e)) return
|
|
3181
|
+
if (zn(e)) return I(e, { from: t, to: n, d: 1 });
|
|
3170
3182
|
var a = e.l, r = e.r;
|
|
3171
3183
|
if (re(n, e.from) < 0) return a ? Gt(a, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null }, qr(e);
|
|
3172
3184
|
if (0 < re(t, e.to)) return r ? Gt(r, t, n) : e.r = { from: t, to: n, d: 1, l: null, r: null }, qr(e);
|
|
@@ -3230,7 +3242,7 @@ function ki() {
|
|
|
3230
3242
|
return t[n] && Kr(t[n], e[n]);
|
|
3231
3243
|
});
|
|
3232
3244
|
}
|
|
3233
|
-
|
|
3245
|
+
ee(Ce.prototype, ((Me = { add: function(e) {
|
|
3234
3246
|
return $t(this, e), this;
|
|
3235
3247
|
}, addKey: function(e) {
|
|
3236
3248
|
return Gt(this, e, e), this;
|
|
@@ -3265,17 +3277,17 @@ function ki() {
|
|
|
3265
3277
|
}
|
|
3266
3278
|
function Ur(e, t, n, r) {
|
|
3267
3279
|
for (var a = [], u = 0, f = Object.entries(e.queries.query); u < f.length; u++) {
|
|
3268
|
-
for (var p = f[u], v = p[0],
|
|
3280
|
+
for (var p = f[u], v = p[0], w = [], T = 0, g = p[1]; T < g.length; T++) {
|
|
3269
3281
|
var A = g[T];
|
|
3270
3282
|
Qn(t, A.obsSet) ? A.subscribers.forEach(function(N) {
|
|
3271
3283
|
return n.add(N);
|
|
3272
|
-
}) : r &&
|
|
3284
|
+
}) : r && w.push(A);
|
|
3273
3285
|
}
|
|
3274
|
-
r && a.push([v,
|
|
3286
|
+
r && a.push([v, w]);
|
|
3275
3287
|
}
|
|
3276
3288
|
if (r) for (var b = 0, E = a; b < E.length; b++) {
|
|
3277
|
-
var O = E[b], v = O[0],
|
|
3278
|
-
e.queries.query[v] =
|
|
3289
|
+
var O = E[b], v = O[0], w = O[1];
|
|
3290
|
+
e.queries.query[v] = w;
|
|
3279
3291
|
}
|
|
3280
3292
|
}
|
|
3281
3293
|
function Ua(e) {
|
|
@@ -3289,7 +3301,7 @@ function ki() {
|
|
|
3289
3301
|
if (t.openCanceller !== r) throw new C.DatabaseClosed("db.open() was cancelled");
|
|
3290
3302
|
}
|
|
3291
3303
|
function p() {
|
|
3292
|
-
return new
|
|
3304
|
+
return new $(function(A, b) {
|
|
3293
3305
|
if (f(), !n) throw new C.MissingAPI();
|
|
3294
3306
|
var E = e.name, O = t.autoSchema || !a ? n.open(E) : n.open(E, a);
|
|
3295
3307
|
if (!O) throw new C.MissingAPI();
|
|
@@ -3324,11 +3336,11 @@ function ki() {
|
|
|
3324
3336
|
case "VersionError":
|
|
3325
3337
|
if (0 < a) return a = 0, p();
|
|
3326
3338
|
}
|
|
3327
|
-
return
|
|
3339
|
+
return $.reject(A);
|
|
3328
3340
|
});
|
|
3329
3341
|
}
|
|
3330
|
-
var v,
|
|
3331
|
-
return
|
|
3342
|
+
var v, w = t.dbReadyResolve, T = null, g = !1;
|
|
3343
|
+
return $.race([r, (typeof navigator > "u" ? $.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(A) {
|
|
3332
3344
|
function b() {
|
|
3333
3345
|
return indexedDB.databases().finally(A);
|
|
3334
3346
|
}
|
|
@@ -3336,12 +3348,12 @@ function ki() {
|
|
|
3336
3348
|
}).finally(function() {
|
|
3337
3349
|
return clearInterval(v);
|
|
3338
3350
|
}) : Promise.resolve()).then(p)]).then(function() {
|
|
3339
|
-
return f(), t.onReadyBeingFired = [],
|
|
3351
|
+
return f(), t.onReadyBeingFired = [], $.resolve(Yn(function() {
|
|
3340
3352
|
return e.on.ready.fire(e.vip);
|
|
3341
3353
|
})).then(function A() {
|
|
3342
3354
|
if (0 < t.onReadyBeingFired.length) {
|
|
3343
3355
|
var b = t.onReadyBeingFired.reduce(wt, Q);
|
|
3344
|
-
return t.onReadyBeingFired = [],
|
|
3356
|
+
return t.onReadyBeingFired = [], $.resolve(Yn(function() {
|
|
3345
3357
|
return b(e.vip);
|
|
3346
3358
|
})).then(A);
|
|
3347
3359
|
}
|
|
@@ -3356,7 +3368,7 @@ function ki() {
|
|
|
3356
3368
|
}
|
|
3357
3369
|
return r === t.openCanceller && e._close(), be(A);
|
|
3358
3370
|
}).finally(function() {
|
|
3359
|
-
t.openComplete = !0,
|
|
3371
|
+
t.openComplete = !0, w();
|
|
3360
3372
|
}).then(function() {
|
|
3361
3373
|
var A;
|
|
3362
3374
|
return g && (A = {}, e.tables.forEach(function(b) {
|
|
@@ -3376,13 +3388,13 @@ function ki() {
|
|
|
3376
3388
|
function a(u) {
|
|
3377
3389
|
return function(v) {
|
|
3378
3390
|
var p = u(v), v = p.value;
|
|
3379
|
-
return p.done ? v : v && typeof v.then == "function" ? v.then(n, r) :
|
|
3391
|
+
return p.done ? v : v && typeof v.then == "function" ? v.then(n, r) : _(v) ? Promise.all(v).then(n, r) : n(v);
|
|
3380
3392
|
};
|
|
3381
3393
|
}
|
|
3382
3394
|
return a(t)();
|
|
3383
3395
|
}
|
|
3384
3396
|
function bn(e, t, n) {
|
|
3385
|
-
for (var r =
|
|
3397
|
+
for (var r = _(e) ? e.slice() : [e], a = 0; a < n; ++a) r.push(t);
|
|
3386
3398
|
return r;
|
|
3387
3399
|
}
|
|
3388
3400
|
var Va = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
|
|
@@ -3396,8 +3408,8 @@ function ki() {
|
|
|
3396
3408
|
}
|
|
3397
3409
|
t = f(r.primaryKey.keyPath, 0, r.primaryKey), a[":id"] = [t];
|
|
3398
3410
|
for (var p = 0, v = r.indexes; p < v.length; p++) {
|
|
3399
|
-
var
|
|
3400
|
-
f(
|
|
3411
|
+
var w = v[p];
|
|
3412
|
+
f(w.keyPath, 0, w);
|
|
3401
3413
|
}
|
|
3402
3414
|
function T(g) {
|
|
3403
3415
|
var A, b = g.query.index;
|
|
@@ -3446,7 +3458,7 @@ function ki() {
|
|
|
3446
3458
|
return i(i({}, e), { table: function(t) {
|
|
3447
3459
|
var n = e.table(t), r = n.schema.primaryKey;
|
|
3448
3460
|
return i(i({}, n), { mutate: function(a) {
|
|
3449
|
-
var u = z.trans, f = u.table(t).hook, p = f.deleting, v = f.creating,
|
|
3461
|
+
var u = z.trans, f = u.table(t).hook, p = f.deleting, v = f.creating, w = f.updating;
|
|
3450
3462
|
switch (a.type) {
|
|
3451
3463
|
case "add":
|
|
3452
3464
|
if (v.fire === Q) break;
|
|
@@ -3454,7 +3466,7 @@ function ki() {
|
|
|
3454
3466
|
return T(a);
|
|
3455
3467
|
}, !0);
|
|
3456
3468
|
case "put":
|
|
3457
|
-
if (v.fire === Q &&
|
|
3469
|
+
if (v.fire === Q && w.fire === Q) break;
|
|
3458
3470
|
return u._promise("readwrite", function() {
|
|
3459
3471
|
return T(a);
|
|
3460
3472
|
}, !0);
|
|
@@ -3482,15 +3494,15 @@ function ki() {
|
|
|
3482
3494
|
if (!N) throw new Error("Keys missing");
|
|
3483
3495
|
return (g = g.type === "add" || g.type === "put" ? i(i({}, g), { keys: N }) : i({}, g)).type !== "delete" && (g.values = d([], g.values)), g.keys && (g.keys = d([], g.keys)), A = n, E = N, ((b = g).type === "add" ? Promise.resolve([]) : A.getMany({ trans: b.trans, keys: E, cache: "immutable" })).then(function(D) {
|
|
3484
3496
|
var S = N.map(function(k, P) {
|
|
3485
|
-
var M, L, K, q = D[P],
|
|
3486
|
-
return g.type === "delete" ? p.fire.call(
|
|
3497
|
+
var M, L, K, q = D[P], G = { onerror: null, onsuccess: null };
|
|
3498
|
+
return g.type === "delete" ? p.fire.call(G, k, q, O) : g.type === "add" || q === void 0 ? (M = v.fire.call(G, k, g.values[P], O), k == null && M != null && (g.keys[P] = k = M, r.outbound || ne(g.values[P], r.keyPath, k))) : (M = tr(q, g.values[P]), (L = w.fire.call(G, M, k, q, O)) && (K = g.values[P], Object.keys(L).forEach(function(U) {
|
|
3487
3499
|
W(K, U) ? K[U] = L[U] : ne(K, U, L[U]);
|
|
3488
|
-
}))),
|
|
3500
|
+
}))), G;
|
|
3489
3501
|
});
|
|
3490
3502
|
return n.mutate(g).then(function(k) {
|
|
3491
3503
|
for (var P = k.failures, M = k.results, L = k.numFailures, k = k.lastResult, K = 0; K < N.length; ++K) {
|
|
3492
|
-
var q = (M || N)[K],
|
|
3493
|
-
q == null ?
|
|
3504
|
+
var q = (M || N)[K], G = S[K];
|
|
3505
|
+
q == null ? G.onerror && G.onerror(P[K]) : G.onsuccess && G.onsuccess(g.type === "put" && D[K] ? g.values[K] : q);
|
|
3494
3506
|
}
|
|
3495
3507
|
return { failures: P, results: M, numFailures: L, lastResult: k };
|
|
3496
3508
|
}).catch(function(k) {
|
|
@@ -3518,7 +3530,7 @@ function ki() {
|
|
|
3518
3530
|
return i(i({}, n), { getMany: function(r) {
|
|
3519
3531
|
if (!r.cache) return n.getMany(r);
|
|
3520
3532
|
var a = Vr(r.keys, r.trans._cache, r.cache === "clone");
|
|
3521
|
-
return a ?
|
|
3533
|
+
return a ? $.resolve(a) : n.getMany(r).then(function(u) {
|
|
3522
3534
|
return r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? Pe(u) : u }, u;
|
|
3523
3535
|
});
|
|
3524
3536
|
}, mutate: function(r) {
|
|
@@ -3546,24 +3558,24 @@ function ki() {
|
|
|
3546
3558
|
if (z.subscr && a !== "readonly") throw new C.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(z.querier));
|
|
3547
3559
|
return e.transaction(r, a, u);
|
|
3548
3560
|
}, table: function(r) {
|
|
3549
|
-
var a = e.table(r), u = a.schema, f = u.primaryKey, g = u.indexes, p = f.extractKey, v = f.outbound,
|
|
3561
|
+
var a = e.table(r), u = a.schema, f = u.primaryKey, g = u.indexes, p = f.extractKey, v = f.outbound, w = f.autoIncrement && g.filter(function(b) {
|
|
3550
3562
|
return b.compound && b.keyPath.includes(f.keyPath);
|
|
3551
3563
|
}), T = i(i({}, a), { mutate: function(b) {
|
|
3552
3564
|
function E(U) {
|
|
3553
3565
|
return U = "idb://".concat(t, "/").concat(r, "/").concat(U), k[U] || (k[U] = new Ce());
|
|
3554
3566
|
}
|
|
3555
|
-
var O, N, D, S = b.trans, k = b.mutatedParts || (b.mutatedParts = {}), P = E(""), M = E(":dels"), L = b.type,
|
|
3567
|
+
var O, N, D, S = b.trans, k = b.mutatedParts || (b.mutatedParts = {}), P = E(""), M = E(":dels"), L = b.type, G = b.type === "deleteRange" ? [b.range] : b.type === "delete" ? [b.keys] : b.values.length < 50 ? [nr(f, b).filter(function(U) {
|
|
3556
3568
|
return U;
|
|
3557
|
-
}), b.values] : [], K =
|
|
3558
|
-
return
|
|
3559
|
-
var
|
|
3569
|
+
}), b.values] : [], K = G[0], q = G[1], G = b.trans._cache;
|
|
3570
|
+
return _(K) ? (P.addKeys(K), (G = L === "delete" || K.length === q.length ? Vr(K, G) : null) || M.addKeys(K), (G || q) && (O = E, N = G, D = q, u.indexes.forEach(function(U) {
|
|
3571
|
+
var X = O(U.name || "");
|
|
3560
3572
|
function te(Z) {
|
|
3561
3573
|
return Z != null ? U.extractKey(Z) : null;
|
|
3562
3574
|
}
|
|
3563
3575
|
function oe(Z) {
|
|
3564
|
-
return U.multiEntry &&
|
|
3565
|
-
return
|
|
3566
|
-
}) :
|
|
3576
|
+
return U.multiEntry && _(Z) ? Z.forEach(function(ve) {
|
|
3577
|
+
return X.addKey(ve);
|
|
3578
|
+
}) : X.addKey(Z);
|
|
3567
3579
|
}
|
|
3568
3580
|
(N || D).forEach(function(Z, De) {
|
|
3569
3581
|
var H = N && te(N[De]), De = D && te(D[De]);
|
|
@@ -3572,13 +3584,13 @@ function ki() {
|
|
|
3572
3584
|
}))) : K ? (q = { from: (q = K.lower) !== null && q !== void 0 ? q : e.MIN_KEY, to: (q = K.upper) !== null && q !== void 0 ? q : e.MAX_KEY }, M.add(q), P.add(q)) : (P.add(n), M.add(n), u.indexes.forEach(function(U) {
|
|
3573
3585
|
return E(U.name).add(n);
|
|
3574
3586
|
})), a.mutate(b).then(function(U) {
|
|
3575
|
-
return !K || b.type !== "add" && b.type !== "put" || (P.addKeys(U.results),
|
|
3587
|
+
return !K || b.type !== "add" && b.type !== "put" || (P.addKeys(U.results), w && w.forEach(function(X) {
|
|
3576
3588
|
for (var te = b.values.map(function(H) {
|
|
3577
|
-
return
|
|
3578
|
-
}), oe =
|
|
3589
|
+
return X.extractKey(H);
|
|
3590
|
+
}), oe = X.keyPath.findIndex(function(H) {
|
|
3579
3591
|
return H === f.keyPath;
|
|
3580
3592
|
}), Z = 0, ve = U.results.length; Z < ve; ++Z) te[Z][oe] = U.results[Z];
|
|
3581
|
-
E(
|
|
3593
|
+
E(X.name).addKeys(te);
|
|
3582
3594
|
})), S.mutatedParts = yn(S.mutatedParts || {}, k), U;
|
|
3583
3595
|
});
|
|
3584
3596
|
} }), g = function(E) {
|
|
@@ -3604,17 +3616,17 @@ function ki() {
|
|
|
3604
3616
|
if (v && E.values) return M.then(function(te) {
|
|
3605
3617
|
return te = te.result, k.addKeys(te), q;
|
|
3606
3618
|
});
|
|
3607
|
-
var
|
|
3608
|
-
(E.values ? k : P).addKeys(
|
|
3619
|
+
var G = E.values ? q.result.map(p) : q.result;
|
|
3620
|
+
(E.values ? k : P).addKeys(G);
|
|
3609
3621
|
} else if (b === "openCursor") {
|
|
3610
|
-
var U = q,
|
|
3622
|
+
var U = q, X = E.values;
|
|
3611
3623
|
return U && Object.create(U, { key: { get: function() {
|
|
3612
3624
|
return P.addKey(U.primaryKey), U.key;
|
|
3613
3625
|
} }, primaryKey: { get: function() {
|
|
3614
3626
|
var te = U.primaryKey;
|
|
3615
3627
|
return P.addKey(te), te;
|
|
3616
3628
|
} }, value: { get: function() {
|
|
3617
|
-
return
|
|
3629
|
+
return X && k.addKey(U.primaryKey), U.value;
|
|
3618
3630
|
} } });
|
|
3619
3631
|
}
|
|
3620
3632
|
return q;
|
|
@@ -3632,9 +3644,9 @@ function ki() {
|
|
|
3632
3644
|
if (n.numFailures === 0) return t;
|
|
3633
3645
|
if (t.type === "deleteRange") return null;
|
|
3634
3646
|
var r = t.keys ? t.keys.length : "values" in t && t.values ? t.values.length : 1;
|
|
3635
|
-
return n.numFailures === r ? null : (t = i({}, t),
|
|
3647
|
+
return n.numFailures === r ? null : (t = i({}, t), _(t.keys) && (t.keys = t.keys.filter(function(a, u) {
|
|
3636
3648
|
return !(u in n.failures);
|
|
3637
|
-
})), "values" in t &&
|
|
3649
|
+
})), "values" in t && _(t.values) && (t.values = t.values.filter(function(a, u) {
|
|
3638
3650
|
return !(u in n.failures);
|
|
3639
3651
|
})), t);
|
|
3640
3652
|
}
|
|
@@ -3644,52 +3656,52 @@ function ki() {
|
|
|
3644
3656
|
}
|
|
3645
3657
|
function Wr(e, t, A, r, a, u) {
|
|
3646
3658
|
if (!A || A.length === 0) return e;
|
|
3647
|
-
var f = t.query.index, p = f.multiEntry, v = t.query.range,
|
|
3659
|
+
var f = t.query.index, p = f.multiEntry, v = t.query.range, w = r.schema.primaryKey.extractKey, T = f.extractKey, g = (f.lowLevelIndex || f).extractKey, A = A.reduce(function(b, E) {
|
|
3648
3660
|
var O = b, N = [];
|
|
3649
3661
|
if (E.type === "add" || E.type === "put") for (var D = new Ce(), S = E.values.length - 1; 0 <= S; --S) {
|
|
3650
|
-
var k, P = E.values[S], M =
|
|
3651
|
-
D.hasKey(M) || (k = T(P), (p &&
|
|
3662
|
+
var k, P = E.values[S], M = w(P);
|
|
3663
|
+
D.hasKey(M) || (k = T(P), (p && _(k) ? k.some(function(U) {
|
|
3652
3664
|
return rr(U, v);
|
|
3653
3665
|
}) : rr(k, v)) && (D.addKey(M), N.push(P)));
|
|
3654
3666
|
}
|
|
3655
3667
|
switch (E.type) {
|
|
3656
3668
|
case "add":
|
|
3657
|
-
var L = new Ce().addKeys(t.values ? b.map(function(
|
|
3658
|
-
return
|
|
3659
|
-
}) : b), O = b.concat(t.values ? N.filter(function(
|
|
3660
|
-
return
|
|
3661
|
-
}) : N.map(function(
|
|
3662
|
-
return
|
|
3663
|
-
}).filter(function(
|
|
3664
|
-
return !L.hasKey(
|
|
3669
|
+
var L = new Ce().addKeys(t.values ? b.map(function(X) {
|
|
3670
|
+
return w(X);
|
|
3671
|
+
}) : b), O = b.concat(t.values ? N.filter(function(X) {
|
|
3672
|
+
return X = w(X), !L.hasKey(X) && (L.addKey(X), !0);
|
|
3673
|
+
}) : N.map(function(X) {
|
|
3674
|
+
return w(X);
|
|
3675
|
+
}).filter(function(X) {
|
|
3676
|
+
return !L.hasKey(X) && (L.addKey(X), !0);
|
|
3665
3677
|
}));
|
|
3666
3678
|
break;
|
|
3667
3679
|
case "put":
|
|
3668
|
-
var K = new Ce().addKeys(E.values.map(function(
|
|
3669
|
-
return
|
|
3680
|
+
var K = new Ce().addKeys(E.values.map(function(X) {
|
|
3681
|
+
return w(X);
|
|
3670
3682
|
}));
|
|
3671
|
-
O = b.filter(function(
|
|
3672
|
-
return !K.hasKey(t.values ?
|
|
3673
|
-
}).concat(t.values ? N : N.map(function(
|
|
3674
|
-
return
|
|
3683
|
+
O = b.filter(function(X) {
|
|
3684
|
+
return !K.hasKey(t.values ? w(X) : X);
|
|
3685
|
+
}).concat(t.values ? N : N.map(function(X) {
|
|
3686
|
+
return w(X);
|
|
3675
3687
|
}));
|
|
3676
3688
|
break;
|
|
3677
3689
|
case "delete":
|
|
3678
3690
|
var q = new Ce().addKeys(E.keys);
|
|
3679
|
-
O = b.filter(function(
|
|
3680
|
-
return !q.hasKey(t.values ?
|
|
3691
|
+
O = b.filter(function(X) {
|
|
3692
|
+
return !q.hasKey(t.values ? w(X) : X);
|
|
3681
3693
|
});
|
|
3682
3694
|
break;
|
|
3683
3695
|
case "deleteRange":
|
|
3684
|
-
var
|
|
3685
|
-
O = b.filter(function(
|
|
3686
|
-
return !rr(
|
|
3696
|
+
var G = E.range;
|
|
3697
|
+
O = b.filter(function(X) {
|
|
3698
|
+
return !rr(w(X), G);
|
|
3687
3699
|
});
|
|
3688
3700
|
}
|
|
3689
3701
|
return O;
|
|
3690
3702
|
}, e);
|
|
3691
3703
|
return A === e ? e : (A.sort(function(b, E) {
|
|
3692
|
-
return re(g(b), g(E)) || re(
|
|
3704
|
+
return re(g(b), g(E)) || re(w(b), w(E));
|
|
3693
3705
|
}), t.limit && t.limit < 1 / 0 && (A.length > t.limit ? A.length = t.limit : e.length === t.limit && A.length < t.limit && (a.dirty = !0)), u ? Object.freeze(A) : A);
|
|
3694
3706
|
}
|
|
3695
3707
|
function Yr(e, t) {
|
|
@@ -3731,29 +3743,29 @@ function ki() {
|
|
|
3731
3743
|
return r === "readwrite" && (f = (u = new AbortController()).signal, a = function(v) {
|
|
3732
3744
|
return function() {
|
|
3733
3745
|
if (u.abort(), r === "readwrite") {
|
|
3734
|
-
for (var
|
|
3746
|
+
for (var w = /* @__PURE__ */ new Set(), T = 0, g = n; T < g.length; T++) {
|
|
3735
3747
|
var A = g[T], b = gt["idb://".concat(t, "/").concat(A)];
|
|
3736
3748
|
if (b) {
|
|
3737
|
-
var E = e.table(A), O = b.optimisticOps.filter(function(
|
|
3738
|
-
return
|
|
3749
|
+
var E = e.table(A), O = b.optimisticOps.filter(function(X) {
|
|
3750
|
+
return X.trans === p;
|
|
3739
3751
|
});
|
|
3740
|
-
if (p._explicit && v && p.mutatedParts) for (var N = 0, D = Object.values(b.queries.query); N < D.length; N++) for (var S = 0, k = (L = D[N]).slice(); S < k.length; S++) Qn((K = k[S]).obsSet, p.mutatedParts) && (Xe(L, K), K.subscribers.forEach(function(
|
|
3741
|
-
return
|
|
3752
|
+
if (p._explicit && v && p.mutatedParts) for (var N = 0, D = Object.values(b.queries.query); N < D.length; N++) for (var S = 0, k = (L = D[N]).slice(); S < k.length; S++) Qn((K = k[S]).obsSet, p.mutatedParts) && (Xe(L, K), K.subscribers.forEach(function(X) {
|
|
3753
|
+
return w.add(X);
|
|
3742
3754
|
}));
|
|
3743
3755
|
else if (0 < O.length) {
|
|
3744
|
-
b.optimisticOps = b.optimisticOps.filter(function(
|
|
3745
|
-
return
|
|
3756
|
+
b.optimisticOps = b.optimisticOps.filter(function(X) {
|
|
3757
|
+
return X.trans !== p;
|
|
3746
3758
|
});
|
|
3747
|
-
for (var P = 0, M = Object.values(b.queries.query); P < M.length; P++) for (var L, K, q,
|
|
3748
|
-
return
|
|
3749
|
-
})) : q !== K.res && (K.res = q, K.promise =
|
|
3750
|
-
return
|
|
3759
|
+
for (var P = 0, M = Object.values(b.queries.query); P < M.length; P++) for (var L, K, q, G = 0, U = (L = M[P]).slice(); G < U.length; G++) (K = U[G]).res != null && p.mutatedParts && (v && !K.dirty ? (q = Object.isFrozen(K.res), q = Wr(K.res, K.req, O, E, K, q), K.dirty ? (Xe(L, K), K.subscribers.forEach(function(X) {
|
|
3760
|
+
return w.add(X);
|
|
3761
|
+
})) : q !== K.res && (K.res = q, K.promise = $.resolve({ result: q }))) : (K.dirty && Xe(L, K), K.subscribers.forEach(function(X) {
|
|
3762
|
+
return w.add(X);
|
|
3751
3763
|
})));
|
|
3752
3764
|
}
|
|
3753
3765
|
}
|
|
3754
3766
|
}
|
|
3755
|
-
|
|
3756
|
-
return
|
|
3767
|
+
w.forEach(function(X) {
|
|
3768
|
+
return X();
|
|
3757
3769
|
});
|
|
3758
3770
|
}
|
|
3759
3771
|
};
|
|
@@ -3771,17 +3783,17 @@ function ki() {
|
|
|
3771
3783
|
}), f.catch(function() {
|
|
3772
3784
|
Xe(p.optimisticOps, u), u.mutatedParts && vn(u.mutatedParts);
|
|
3773
3785
|
})) : f.then(function(v) {
|
|
3774
|
-
var
|
|
3786
|
+
var w = Xr(0, i(i({}, u), { values: u.values.map(function(T, g) {
|
|
3775
3787
|
var A;
|
|
3776
3788
|
return v.failures[g] ? T : (T = (A = a.keyPath) !== null && A !== void 0 && A.includes(".") ? Pe(T) : i({}, T), ne(T, a.keyPath, v.results[g]), T);
|
|
3777
3789
|
}) }), v);
|
|
3778
|
-
p.optimisticOps.push(
|
|
3790
|
+
p.optimisticOps.push(w), queueMicrotask(function() {
|
|
3779
3791
|
return u.mutatedParts && vn(u.mutatedParts);
|
|
3780
3792
|
});
|
|
3781
3793
|
}), f) : r.mutate(u);
|
|
3782
3794
|
}, query: function(u) {
|
|
3783
3795
|
if (!Gr(z, r) || !$r("query", u)) return r.query(u);
|
|
3784
|
-
var f = ((
|
|
3796
|
+
var f = ((w = z.trans) === null || w === void 0 ? void 0 : w.db._options.cache) === "immutable", g = z, p = g.requery, v = g.signal, w = (function(E, O, N, D) {
|
|
3785
3797
|
var S = gt["idb://".concat(E, "/").concat(O)];
|
|
3786
3798
|
if (!S) return [];
|
|
3787
3799
|
if (!(O = S.queries[N])) return [null, !1, S, null];
|
|
@@ -3800,7 +3812,7 @@ function ki() {
|
|
|
3800
3812
|
return Yr(M.req.query.range, D.query.range);
|
|
3801
3813
|
}), [P, !!P, S, k];
|
|
3802
3814
|
}
|
|
3803
|
-
})(t, n, "query", u), T =
|
|
3815
|
+
})(t, n, "query", u), T = w[0], g = w[1], A = w[2], b = w[3];
|
|
3804
3816
|
return T && g ? T.obsSet = u.obsSet : (g = r.query(u).then(function(E) {
|
|
3805
3817
|
var O = E.result;
|
|
3806
3818
|
if (T && (T.res = O), f) {
|
|
@@ -3831,7 +3843,7 @@ function ki() {
|
|
|
3831
3843
|
return n || (n = new this.Version(e), t.push(n), t.sort(Ma), n.stores({}), this._state.autoSchema = !1, n);
|
|
3832
3844
|
}, we.prototype._whenReady = function(e) {
|
|
3833
3845
|
var t = this;
|
|
3834
|
-
return this.idbdb && (this._state.openComplete || z.letThrough || this._vip) ? e() : new
|
|
3846
|
+
return this.idbdb && (this._state.openComplete || z.letThrough || this._vip) ? e() : new $(function(n, r) {
|
|
3835
3847
|
if (t._state.openComplete) return r(new C.DatabaseClosed(t._state.dbOpenError));
|
|
3836
3848
|
if (!t._state.isBeingOpened) {
|
|
3837
3849
|
if (!t._state.autoOpen) return void r(new C.DatabaseClosed());
|
|
@@ -3864,9 +3876,9 @@ function ki() {
|
|
|
3864
3876
|
}
|
|
3865
3877
|
this.idbdb = null;
|
|
3866
3878
|
}
|
|
3867
|
-
e.isBeingOpened || (e.dbReadyPromise = new
|
|
3879
|
+
e.isBeingOpened || (e.dbReadyPromise = new $(function(n) {
|
|
3868
3880
|
e.dbReadyResolve = n;
|
|
3869
|
-
}), e.openCanceller = new
|
|
3881
|
+
}), e.openCanceller = new $(function(n, r) {
|
|
3870
3882
|
e.cancelOpen = r;
|
|
3871
3883
|
}));
|
|
3872
3884
|
}, we.prototype.close = function(n) {
|
|
@@ -3876,13 +3888,13 @@ function ki() {
|
|
|
3876
3888
|
var t = this;
|
|
3877
3889
|
e === void 0 && (e = { disableAutoOpen: !0 });
|
|
3878
3890
|
var n = 0 < arguments.length && typeof arguments[0] != "object", r = this._state;
|
|
3879
|
-
return new
|
|
3891
|
+
return new $(function(a, u) {
|
|
3880
3892
|
function f() {
|
|
3881
3893
|
t.close(e);
|
|
3882
3894
|
var p = t._deps.indexedDB.deleteDatabase(t.name);
|
|
3883
3895
|
p.onsuccess = ge(function() {
|
|
3884
|
-
var v,
|
|
3885
|
-
v = t._deps,
|
|
3896
|
+
var v, w, T;
|
|
3897
|
+
v = t._deps, w = t.name, T = v.indexedDB, v = v.IDBKeyRange, Wn(T) || w === an || Xn(T, v).delete(w).catch(Q), a();
|
|
3886
3898
|
}), p.onerror = Ge(u), p.onblocked = t._fireOnBlocked;
|
|
3887
3899
|
}
|
|
3888
3900
|
if (n) throw new C.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
@@ -3918,9 +3930,9 @@ function ki() {
|
|
|
3918
3930
|
var u, f, p = e.indexOf("?") !== -1;
|
|
3919
3931
|
e = e.replace("!", "").replace("?", "");
|
|
3920
3932
|
try {
|
|
3921
|
-
if (f = t.map(function(
|
|
3922
|
-
if (
|
|
3923
|
-
return
|
|
3933
|
+
if (f = t.map(function(w) {
|
|
3934
|
+
if (w = w instanceof r.Table ? w.name : w, typeof w != "string") throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
3935
|
+
return w;
|
|
3924
3936
|
}), e == "r" || e === Fn) u = Fn;
|
|
3925
3937
|
else {
|
|
3926
3938
|
if (e != "rw" && e != Bn) throw new C.InvalidArgument("Invalid transaction mode: " + e);
|
|
@@ -3931,34 +3943,34 @@ function ki() {
|
|
|
3931
3943
|
if (!p) throw new C.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
3932
3944
|
a = null;
|
|
3933
3945
|
}
|
|
3934
|
-
a && f.forEach(function(
|
|
3935
|
-
if (a && a.storeNames.indexOf(
|
|
3936
|
-
if (!p) throw new C.SubTransaction("Table " +
|
|
3946
|
+
a && f.forEach(function(w) {
|
|
3947
|
+
if (a && a.storeNames.indexOf(w) === -1) {
|
|
3948
|
+
if (!p) throw new C.SubTransaction("Table " + w + " not included in parent transaction.");
|
|
3937
3949
|
a = null;
|
|
3938
3950
|
}
|
|
3939
3951
|
}), p && a && !a.active && (a = null);
|
|
3940
3952
|
}
|
|
3941
|
-
} catch (
|
|
3953
|
+
} catch (w) {
|
|
3942
3954
|
return a ? a._promise(null, function(T, g) {
|
|
3943
|
-
g(
|
|
3944
|
-
}) : be(
|
|
3955
|
+
g(w);
|
|
3956
|
+
}) : be(w);
|
|
3945
3957
|
}
|
|
3946
|
-
var v = (function
|
|
3947
|
-
return
|
|
3958
|
+
var v = (function w(T, g, A, b, E) {
|
|
3959
|
+
return $.resolve().then(function() {
|
|
3948
3960
|
var O = z.transless || z, N = T._createTransaction(g, A, T._dbSchema, b);
|
|
3949
3961
|
if (N.explicit = !0, O = { trans: N, transless: O }, b) N.idbtrans = b.idbtrans;
|
|
3950
3962
|
else try {
|
|
3951
3963
|
N.create(), N.idbtrans._explicit = !0, T._state.PR1398_maxLoop = 3;
|
|
3952
3964
|
} catch (k) {
|
|
3953
3965
|
return k.name === l.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
|
|
3954
|
-
return
|
|
3966
|
+
return w(T, g, A, null, E);
|
|
3955
3967
|
})) : be(k);
|
|
3956
3968
|
}
|
|
3957
3969
|
var D, S = qe(E);
|
|
3958
|
-
return S && Tt(), O =
|
|
3970
|
+
return S && Tt(), O = $.follow(function() {
|
|
3959
3971
|
var k;
|
|
3960
3972
|
(D = E.call(N, N)) && (S ? (k = at.bind(null, null), D.then(k, k)) : typeof D.next == "function" && typeof D.throw == "function" && (D = er(D)));
|
|
3961
|
-
}, O), (D && typeof D.then == "function" ?
|
|
3973
|
+
}, O), (D && typeof D.then == "function" ? $.resolve(D).then(function(k) {
|
|
3962
3974
|
return N.active ? k : be(new C.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
3963
3975
|
}) : O.then(function() {
|
|
3964
3976
|
return D;
|
|
@@ -3983,22 +3995,22 @@ function ki() {
|
|
|
3983
3995
|
this._middlewares = {}, this.verno = 0;
|
|
3984
3996
|
var r = we.dependencies;
|
|
3985
3997
|
this._options = t = i({ addons: we.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, r = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
3986
|
-
var a, u, f, p, v,
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
}),
|
|
3990
|
-
|
|
3991
|
-
}), this._state =
|
|
3998
|
+
var a, u, f, p, v, w = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Q, dbReadyPromise: null, cancelOpen: Q, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
|
|
3999
|
+
w.dbReadyPromise = new $(function(g) {
|
|
4000
|
+
w.dbReadyResolve = g;
|
|
4001
|
+
}), w.openCanceller = new $(function(g, A) {
|
|
4002
|
+
w.cancelOpen = A;
|
|
4003
|
+
}), this._state = w, this.name = e, this.on = jt(this, "populate", "blocked", "versionchange", "close", { ready: [wt, Q] }), this.once = function(g, A) {
|
|
3992
4004
|
var b = function() {
|
|
3993
4005
|
for (var E = [], O = 0; O < arguments.length; O++) E[O] = arguments[O];
|
|
3994
4006
|
n.on(g).unsubscribe(b), A.apply(n, E);
|
|
3995
4007
|
};
|
|
3996
4008
|
return n.on(g, b);
|
|
3997
|
-
}, this.on.ready.subscribe =
|
|
4009
|
+
}, this.on.ready.subscribe = J(this.on.ready.subscribe, function(g) {
|
|
3998
4010
|
return function(A, b) {
|
|
3999
4011
|
we.vip(function() {
|
|
4000
4012
|
var E, O = n._state;
|
|
4001
|
-
O.openComplete ? (O.dbOpenError ||
|
|
4013
|
+
O.openComplete ? (O.dbOpenError || $.resolve().then(A), b && g(A)) : O.onReadyBeingFired ? (O.onReadyBeingFired.push(A), b && g(A)) : (g(A), E = n, b || g(function N() {
|
|
4002
4014
|
E.on.ready.unsubscribe(A), E.on.ready.unsubscribe(N);
|
|
4003
4015
|
}));
|
|
4004
4016
|
});
|
|
@@ -4021,7 +4033,7 @@ function ki() {
|
|
|
4021
4033
|
D = (D = b[D]) === null || D === void 0 ? void 0 : D.yProps, D && (A = A.concat(D.map(function(S) {
|
|
4022
4034
|
return S.updatesTable;
|
|
4023
4035
|
})));
|
|
4024
|
-
}), this.db = f, this.mode = g, this.storeNames = A, this.schema = b, this.chromeTransactionDurability = E, this.idbtrans = null, this.on = jt(this, "complete", "error", "abort"), this.parent = O || 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
|
|
4036
|
+
}), this.db = f, this.mode = g, this.storeNames = A, this.schema = b, this.chromeTransactionDurability = E, this.idbtrans = null, this.on = jt(this, "complete", "error", "abort"), this.parent = O || 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 $(function(D, S) {
|
|
4025
4037
|
N._resolve = D, N._reject = S;
|
|
4026
4038
|
}), this._completion.then(function() {
|
|
4027
4039
|
N.active = !1, N.on.complete.fire();
|
|
@@ -4083,7 +4095,7 @@ function ki() {
|
|
|
4083
4095
|
}
|
|
4084
4096
|
function zr(e) {
|
|
4085
4097
|
var t, n = !1, r = new Qa(function(a) {
|
|
4086
|
-
var u = qe(e), f, p = !1, v = {},
|
|
4098
|
+
var u = qe(e), f, p = !1, v = {}, w = {}, T = { get closed() {
|
|
4087
4099
|
return p;
|
|
4088
4100
|
}, unsubscribe: function() {
|
|
4089
4101
|
p || (p = !0, f && f.abort(), g && st.storagemutated.unsubscribe(b));
|
|
@@ -4092,7 +4104,7 @@ function ki() {
|
|
|
4092
4104
|
var g = !1, A = function() {
|
|
4093
4105
|
return Pn(E);
|
|
4094
4106
|
}, b = function(O) {
|
|
4095
|
-
yn(v, O), Qn(
|
|
4107
|
+
yn(v, O), Qn(w, v) && A();
|
|
4096
4108
|
}, E = function() {
|
|
4097
4109
|
var O, N, D;
|
|
4098
4110
|
!p && _n.indexedDB && (v = {}, O = {}, f && f.abort(), f = new AbortController(), D = (function(S) {
|
|
@@ -4108,7 +4120,7 @@ function ki() {
|
|
|
4108
4120
|
n = !0, t = S, p || N.signal.aborted || (v = {}, (function(k) {
|
|
4109
4121
|
for (var P in k) if (W(k, P)) return;
|
|
4110
4122
|
return 1;
|
|
4111
|
-
})(
|
|
4123
|
+
})(w = O) || g || (st(Lt, b), g = !0), Pn(function() {
|
|
4112
4124
|
return !p && a.next && a.next(S);
|
|
4113
4125
|
}));
|
|
4114
4126
|
}, function(S) {
|
|
@@ -4134,7 +4146,7 @@ function ki() {
|
|
|
4134
4146
|
ut = t;
|
|
4135
4147
|
}
|
|
4136
4148
|
}
|
|
4137
|
-
|
|
4149
|
+
ee(yt, i(i({}, ie), { delete: function(e) {
|
|
4138
4150
|
return new yt(e, { addons: [] }).delete();
|
|
4139
4151
|
}, exists: function(e) {
|
|
4140
4152
|
return new yt(e, { addons: [] }).open().then(function(t) {
|
|
@@ -4157,7 +4169,7 @@ function ki() {
|
|
|
4157
4169
|
var t, n;
|
|
4158
4170
|
}, defineClass: function() {
|
|
4159
4171
|
return function(e) {
|
|
4160
|
-
|
|
4172
|
+
I(this, e);
|
|
4161
4173
|
};
|
|
4162
4174
|
}, ignoreTransaction: function(e) {
|
|
4163
4175
|
return z.trans ? ht(z.transless, e) : e();
|
|
@@ -4165,7 +4177,7 @@ function ki() {
|
|
|
4165
4177
|
return function() {
|
|
4166
4178
|
try {
|
|
4167
4179
|
var t = er(e.apply(this, arguments));
|
|
4168
|
-
return t && typeof t.then == "function" ? t :
|
|
4180
|
+
return t && typeof t.then == "function" ? t : $.resolve(t);
|
|
4169
4181
|
} catch (n) {
|
|
4170
4182
|
return be(n);
|
|
4171
4183
|
}
|
|
@@ -4173,19 +4185,19 @@ function ki() {
|
|
|
4173
4185
|
}, spawn: function(e, t, n) {
|
|
4174
4186
|
try {
|
|
4175
4187
|
var r = er(e.apply(n, t || []));
|
|
4176
|
-
return r && typeof r.then == "function" ? r :
|
|
4188
|
+
return r && typeof r.then == "function" ? r : $.resolve(r);
|
|
4177
4189
|
} catch (a) {
|
|
4178
4190
|
return be(a);
|
|
4179
4191
|
}
|
|
4180
4192
|
}, currentTransaction: { get: function() {
|
|
4181
4193
|
return z.trans || null;
|
|
4182
4194
|
} }, waitFor: function(e, t) {
|
|
4183
|
-
return t =
|
|
4184
|
-
}, Promise:
|
|
4195
|
+
return t = $.resolve(typeof e == "function" ? yt.ignoreTransaction(e) : e).timeout(t || 6e4), z.trans ? z.trans.waitFor(t) : t;
|
|
4196
|
+
}, Promise: $, debug: { get: function() {
|
|
4185
4197
|
return ke;
|
|
4186
4198
|
}, set: function(e) {
|
|
4187
4199
|
St(e);
|
|
4188
|
-
} }, derive: F, extend:
|
|
4200
|
+
} }, derive: F, extend: I, props: ee, override: J, Events: jt, on: st, liveQuery: zr, extendObservabilitySet: yn, getByKeyPath: me, setByKeyPath: ne, delByKeyPath: function(e, t) {
|
|
4189
4201
|
typeof t == "string" ? ne(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
|
|
4190
4202
|
ne(e, n, void 0);
|
|
4191
4203
|
});
|
|
@@ -4213,8 +4225,8 @@ function ki() {
|
|
|
4213
4225
|
}
|
|
4214
4226
|
}), addEventListener("pageshow", function(e) {
|
|
4215
4227
|
!Ye.disableBfCache && e.persisted && (ke && console.debug("Dexie: handling persisted pageshow"), Qr(), ir({ all: new Ce(-1 / 0, [[]]) }));
|
|
4216
|
-
})),
|
|
4217
|
-
return !e || e instanceof Ze || e instanceof TypeError || e instanceof SyntaxError || !e.name || !x[e.name] ? e : (t = new x[e.name](t || e.message, e), "stack" in e &&
|
|
4228
|
+
})), $.rejectionMapper = function(e, t) {
|
|
4229
|
+
return !e || e instanceof Ze || e instanceof TypeError || e instanceof SyntaxError || !e.name || !x[e.name] ? e : (t = new x[e.name](t || e.message, e), "stack" in e && B(t, "stack", { get: function() {
|
|
4218
4230
|
return this.inner.stack;
|
|
4219
4231
|
} }), t);
|
|
4220
4232
|
}, St(ke), i(Ye, Object.freeze({ __proto__: null, Dexie: Ye, liveQuery: zr, Entity: Nr, cmp: re, PropModification: Kt, replacePrefix: function(e, t) {
|
|
@@ -4253,8 +4265,8 @@ class Fi {
|
|
|
4253
4265
|
[i.name]: i.schema
|
|
4254
4266
|
};
|
|
4255
4267
|
if (d)
|
|
4256
|
-
for (const [y,
|
|
4257
|
-
h[y] =
|
|
4268
|
+
for (const [y, _] of Object.entries(d))
|
|
4269
|
+
h[y] = _.schema;
|
|
4258
4270
|
h[ea] = "++sequenceNumber, id", h[ta] = "key", this.databaseInstance.version(1).stores(h);
|
|
4259
4271
|
}
|
|
4260
4272
|
async get(o) {
|
|
@@ -4276,8 +4288,8 @@ class Fi {
|
|
|
4276
4288
|
await this.metaTable.put({ key: "head", value: o });
|
|
4277
4289
|
}
|
|
4278
4290
|
async commit(o) {
|
|
4279
|
-
const { creates: c, updates: i, deletes: d, onProgress: h } = o, y = this.databaseInstance.table(this.tableName),
|
|
4280
|
-
let
|
|
4291
|
+
const { creates: c, updates: i, deletes: d, onProgress: h } = o, y = this.databaseInstance.table(this.tableName), _ = c.length + i.length + d.length;
|
|
4292
|
+
let I = 0;
|
|
4281
4293
|
try {
|
|
4282
4294
|
await this.databaseInstance.transaction(
|
|
4283
4295
|
"rw",
|
|
@@ -4285,15 +4297,15 @@ class Fi {
|
|
|
4285
4297
|
this.changeLogTable,
|
|
4286
4298
|
this.metaTable,
|
|
4287
4299
|
async () => {
|
|
4288
|
-
const
|
|
4300
|
+
const j = i.length > 0 ? await y.bulkGet(i.map((B) => B.id)) : [], V = d.length > 0 ? await y.bulkGet(d) : [];
|
|
4289
4301
|
if (c.length > 0)
|
|
4290
4302
|
try {
|
|
4291
|
-
await y.bulkAdd(c),
|
|
4292
|
-
} catch (
|
|
4293
|
-
const F = this.extractFailedRecordFromError(
|
|
4303
|
+
await y.bulkAdd(c), I += c.length, h(I, _);
|
|
4304
|
+
} catch (B) {
|
|
4305
|
+
const F = this.extractFailedRecordFromError(B, c);
|
|
4294
4306
|
je("STORE_BULK_ADD_FAILED", {
|
|
4295
|
-
detail:
|
|
4296
|
-
cause:
|
|
4307
|
+
detail: B instanceof Error ? B.message : String(B),
|
|
4308
|
+
cause: B instanceof Error ? B : void 0,
|
|
4297
4309
|
...F && {
|
|
4298
4310
|
ref: { tagName: F.tagName, id: F.id }
|
|
4299
4311
|
}
|
|
@@ -4301,12 +4313,12 @@ class Fi {
|
|
|
4301
4313
|
}
|
|
4302
4314
|
if (i.length > 0)
|
|
4303
4315
|
try {
|
|
4304
|
-
await y.bulkPut(i),
|
|
4305
|
-
} catch (
|
|
4306
|
-
const F = this.extractFailedRecordFromError(
|
|
4316
|
+
await y.bulkPut(i), I += i.length, h(I, _);
|
|
4317
|
+
} catch (B) {
|
|
4318
|
+
const F = this.extractFailedRecordFromError(B, i);
|
|
4307
4319
|
je("STORE_BULK_UPDATE_FAILED", {
|
|
4308
|
-
detail:
|
|
4309
|
-
cause:
|
|
4320
|
+
detail: B instanceof Error ? B.message : String(B),
|
|
4321
|
+
cause: B instanceof Error ? B : void 0,
|
|
4310
4322
|
...F && {
|
|
4311
4323
|
ref: { tagName: F.tagName, id: F.id }
|
|
4312
4324
|
}
|
|
@@ -4314,37 +4326,37 @@ class Fi {
|
|
|
4314
4326
|
}
|
|
4315
4327
|
if (d.length > 0)
|
|
4316
4328
|
try {
|
|
4317
|
-
await y.bulkDelete(d),
|
|
4318
|
-
} catch (
|
|
4329
|
+
await y.bulkDelete(d), I += d.length, h(I, _);
|
|
4330
|
+
} catch (B) {
|
|
4319
4331
|
je("STORE_DELETE_FAILED", {
|
|
4320
|
-
detail:
|
|
4321
|
-
cause:
|
|
4332
|
+
detail: B instanceof Error ? B.message : String(B),
|
|
4333
|
+
cause: B instanceof Error ? B : void 0
|
|
4322
4334
|
});
|
|
4323
4335
|
}
|
|
4324
4336
|
const W = await this.getHead();
|
|
4325
4337
|
await this.changeLogTable.where("sequenceNumber").above(W).delete();
|
|
4326
|
-
const
|
|
4338
|
+
const ee = W + 1, ce = {
|
|
4327
4339
|
id: crypto.randomUUID(),
|
|
4328
|
-
sequenceNumber:
|
|
4340
|
+
sequenceNumber: ee,
|
|
4329
4341
|
timestamp: Date.now(),
|
|
4330
4342
|
operations: {
|
|
4331
4343
|
creates: c,
|
|
4332
|
-
updates: i.map((
|
|
4333
|
-
before:
|
|
4334
|
-
after:
|
|
4344
|
+
updates: i.map((B, F) => ({
|
|
4345
|
+
before: j[F],
|
|
4346
|
+
after: B
|
|
4335
4347
|
})),
|
|
4336
|
-
deletes:
|
|
4348
|
+
deletes: V.filter(Boolean)
|
|
4337
4349
|
}
|
|
4338
4350
|
};
|
|
4339
|
-
await this.changeLogTable.add(
|
|
4351
|
+
await this.changeLogTable.add(ce), await this.setHead(ee);
|
|
4340
4352
|
}
|
|
4341
4353
|
);
|
|
4342
|
-
} catch (
|
|
4343
|
-
if (
|
|
4344
|
-
throw
|
|
4354
|
+
} catch (j) {
|
|
4355
|
+
if (j instanceof Error && j.message.includes("dialecte"))
|
|
4356
|
+
throw j;
|
|
4345
4357
|
je("STORE_COMMIT_FAILED", {
|
|
4346
|
-
detail:
|
|
4347
|
-
cause:
|
|
4358
|
+
detail: j instanceof Error ? j.message : String(j),
|
|
4359
|
+
cause: j instanceof Error ? j : void 0
|
|
4348
4360
|
});
|
|
4349
4361
|
}
|
|
4350
4362
|
}
|
|
@@ -4371,7 +4383,7 @@ class Fi {
|
|
|
4371
4383
|
const i = this.databaseInstance.table(this.tableName);
|
|
4372
4384
|
await this.databaseInstance.transaction("rw", i, this.metaTable, async () => {
|
|
4373
4385
|
const { creates: d, updates: h, deletes: y } = c.operations;
|
|
4374
|
-
d.length > 0 && await i.bulkDelete(d.map((
|
|
4386
|
+
d.length > 0 && await i.bulkDelete(d.map((_) => _.id)), h.length > 0 && await i.bulkPut(h.map((_) => _.before)), y.length > 0 && await i.bulkAdd(y), await this.setHead(o - 1);
|
|
4375
4387
|
});
|
|
4376
4388
|
}
|
|
4377
4389
|
async redo() {
|
|
@@ -4380,8 +4392,8 @@ class Fi {
|
|
|
4380
4392
|
return;
|
|
4381
4393
|
const d = this.databaseInstance.table(this.tableName);
|
|
4382
4394
|
await this.databaseInstance.transaction("rw", d, this.metaTable, async () => {
|
|
4383
|
-
const { creates: h, updates: y, deletes:
|
|
4384
|
-
h.length > 0 && await d.bulkAdd(h), y.length > 0 && await d.bulkPut(y.map((
|
|
4395
|
+
const { creates: h, updates: y, deletes: _ } = i.operations;
|
|
4396
|
+
h.length > 0 && await d.bulkAdd(h), y.length > 0 && await d.bulkPut(y.map((I) => I.after)), _.length > 0 && await d.bulkDelete(_.map((I) => I.id)), await this.setHead(c);
|
|
4385
4397
|
});
|
|
4386
4398
|
}
|
|
4387
4399
|
async getChangeLog() {
|
|
@@ -4402,8 +4414,8 @@ function Bi(m) {
|
|
|
4402
4414
|
[i.name]: i.schema
|
|
4403
4415
|
};
|
|
4404
4416
|
if (d)
|
|
4405
|
-
for (const [
|
|
4406
|
-
y[
|
|
4417
|
+
for (const [_, I] of Object.entries(d))
|
|
4418
|
+
y[_] = I.schema;
|
|
4407
4419
|
return h.version(1).stores(y), h;
|
|
4408
4420
|
}
|
|
4409
4421
|
async function ba(m) {
|
|
@@ -4416,26 +4428,26 @@ async function ji(m) {
|
|
|
4416
4428
|
const d = o.table(c);
|
|
4417
4429
|
await o.transaction("rw", d, async () => {
|
|
4418
4430
|
for (const { recordId: h, ...y } of i) {
|
|
4419
|
-
const
|
|
4420
|
-
if (!
|
|
4421
|
-
const
|
|
4431
|
+
const _ = await d.get(h);
|
|
4432
|
+
if (!_) continue;
|
|
4433
|
+
const I = { ...y };
|
|
4422
4434
|
if (y.attributes) {
|
|
4423
|
-
const
|
|
4424
|
-
for (const
|
|
4425
|
-
const W =
|
|
4426
|
-
W >= 0 ?
|
|
4435
|
+
const j = [..._.attributes];
|
|
4436
|
+
for (const V of y.attributes) {
|
|
4437
|
+
const W = j.findIndex((ee) => ee.name === V.name);
|
|
4438
|
+
W >= 0 ? j[W] = V : j.push(V);
|
|
4427
4439
|
}
|
|
4428
|
-
|
|
4440
|
+
I.attributes = j;
|
|
4429
4441
|
}
|
|
4430
4442
|
if (y.children) {
|
|
4431
|
-
const
|
|
4432
|
-
for (const
|
|
4433
|
-
const W =
|
|
4434
|
-
W >= 0 ?
|
|
4443
|
+
const j = [..._.children];
|
|
4444
|
+
for (const V of y.children) {
|
|
4445
|
+
const W = j.findIndex((ee) => ee.id === V.id);
|
|
4446
|
+
W >= 0 ? j[W] = V : j.push(V);
|
|
4435
4447
|
}
|
|
4436
|
-
|
|
4448
|
+
I.children = j;
|
|
4437
4449
|
}
|
|
4438
|
-
await d.update(h,
|
|
4450
|
+
await d.update(h, I);
|
|
4439
4451
|
}
|
|
4440
4452
|
});
|
|
4441
4453
|
}
|
|
@@ -4445,14 +4457,14 @@ async function Bo(m) {
|
|
|
4445
4457
|
const d = o.table(c);
|
|
4446
4458
|
await o.transaction("rw", d, async () => {
|
|
4447
4459
|
for (const { recordId: h, attributes: y } of i) {
|
|
4448
|
-
const
|
|
4449
|
-
if (!
|
|
4450
|
-
const
|
|
4451
|
-
for (const
|
|
4452
|
-
const
|
|
4453
|
-
|
|
4454
|
-
}
|
|
4455
|
-
await d.update(h, { attributes:
|
|
4460
|
+
const _ = await d.get(h);
|
|
4461
|
+
if (!_) continue;
|
|
4462
|
+
const I = [..._.attributes];
|
|
4463
|
+
for (const j of y) {
|
|
4464
|
+
const V = I.findIndex((W) => W.name === j.name);
|
|
4465
|
+
V >= 0 ? I[V] = j : I.push(j);
|
|
4466
|
+
}
|
|
4467
|
+
await d.update(h, { attributes: I });
|
|
4456
4468
|
}
|
|
4457
4469
|
});
|
|
4458
4470
|
}
|
|
@@ -4504,7 +4516,7 @@ function Xi() {
|
|
|
4504
4516
|
(function(o) {
|
|
4505
4517
|
o.parser = function(l, s) {
|
|
4506
4518
|
return new i(l, s);
|
|
4507
|
-
}, o.SAXParser = i, o.SAXStream =
|
|
4519
|
+
}, o.SAXParser = i, o.SAXStream = V, o.createStream = j, o.MAX_BUFFER_LENGTH = 64 * 1024;
|
|
4508
4520
|
var c = [
|
|
4509
4521
|
"comment",
|
|
4510
4522
|
"sgmlDecl",
|
|
@@ -4543,7 +4555,7 @@ function Xi() {
|
|
|
4543
4555
|
if (!(this instanceof i))
|
|
4544
4556
|
return new i(l, s);
|
|
4545
4557
|
var C = this;
|
|
4546
|
-
h(C), C.q = C.c = "", C.bufferCheckPosition = o.MAX_BUFFER_LENGTH, C.opt = s || {}, C.opt.lowercase = C.opt.lowercase || C.opt.lowercasetags, C.looseCase = C.opt.lowercase ? "toLowerCase" : "toUpperCase", C.opt.maxEntityCount = C.opt.maxEntityCount || 512, C.opt.maxEntityDepth = C.opt.maxEntityDepth || 4, C.entityCount = C.entityDepth = 0, C.tags = [], C.closed = C.closedRoot = C.sawRoot = !1, C.tag = C.error = null, C.strict = !!l, C.noscript = !!(l || C.opt.noscript), C.state =
|
|
4558
|
+
h(C), C.q = C.c = "", C.bufferCheckPosition = o.MAX_BUFFER_LENGTH, C.opt = s || {}, C.opt.lowercase = C.opt.lowercase || C.opt.lowercasetags, C.looseCase = C.opt.lowercase ? "toLowerCase" : "toUpperCase", C.opt.maxEntityCount = C.opt.maxEntityCount || 512, C.opt.maxEntityDepth = C.opt.maxEntityDepth || 4, C.entityCount = C.entityDepth = 0, C.tags = [], C.closed = C.closedRoot = C.sawRoot = !1, C.tag = C.error = null, C.strict = !!l, C.noscript = !!(l || C.opt.noscript), C.state = R.BEGIN, C.strictEntities = C.opt.strictEntities, C.ENTITIES = C.strictEntities ? Object.create(o.XML_ENTITIES) : Object.create(o.ENTITIES), C.attribList = [], C.opt.xmlns && (C.ns = Object.create(F)), C.opt.unquotedAttributeValues === void 0 && (C.opt.unquotedAttributeValues = !l), C.trackPosition = C.opt.position !== !1, C.trackPosition && (C.position = C.line = C.column = 0), He(C, "onready");
|
|
4547
4559
|
}
|
|
4548
4560
|
Object.create || (Object.create = function(l) {
|
|
4549
4561
|
function s() {
|
|
@@ -4600,31 +4612,31 @@ function Xi() {
|
|
|
4600
4612
|
y(this);
|
|
4601
4613
|
}
|
|
4602
4614
|
};
|
|
4603
|
-
var
|
|
4615
|
+
var _;
|
|
4604
4616
|
try {
|
|
4605
|
-
|
|
4617
|
+
_ = $i.Stream;
|
|
4606
4618
|
} catch {
|
|
4607
|
-
|
|
4619
|
+
_ = function() {
|
|
4608
4620
|
};
|
|
4609
4621
|
}
|
|
4610
|
-
|
|
4622
|
+
_ || (_ = function() {
|
|
4611
4623
|
});
|
|
4612
|
-
var
|
|
4624
|
+
var I = o.EVENTS.filter(function(l) {
|
|
4613
4625
|
return l !== "error" && l !== "end";
|
|
4614
4626
|
});
|
|
4615
|
-
function
|
|
4616
|
-
return new
|
|
4627
|
+
function j(l, s) {
|
|
4628
|
+
return new V(l, s);
|
|
4617
4629
|
}
|
|
4618
|
-
function
|
|
4619
|
-
if (!(this instanceof
|
|
4620
|
-
return new
|
|
4621
|
-
|
|
4630
|
+
function V(l, s) {
|
|
4631
|
+
if (!(this instanceof V))
|
|
4632
|
+
return new V(l, s);
|
|
4633
|
+
_.apply(this), this._parser = new i(l, s), this.writable = !0, this.readable = !0;
|
|
4622
4634
|
var C = this;
|
|
4623
4635
|
this._parser.onend = function() {
|
|
4624
4636
|
C.emit("end");
|
|
4625
4637
|
}, this._parser.onerror = function(x) {
|
|
4626
4638
|
C.emit("error", x), C._parser.error = null;
|
|
4627
|
-
}, this._decoder = null,
|
|
4639
|
+
}, this._decoder = null, I.forEach(function(x) {
|
|
4628
4640
|
Object.defineProperty(C, "on" + x, {
|
|
4629
4641
|
get: function() {
|
|
4630
4642
|
return C._parser["on" + x];
|
|
@@ -4639,26 +4651,26 @@ function Xi() {
|
|
|
4639
4651
|
});
|
|
4640
4652
|
});
|
|
4641
4653
|
}
|
|
4642
|
-
|
|
4654
|
+
V.prototype = Object.create(_.prototype, {
|
|
4643
4655
|
constructor: {
|
|
4644
|
-
value:
|
|
4656
|
+
value: V
|
|
4645
4657
|
}
|
|
4646
|
-
}),
|
|
4658
|
+
}), V.prototype.write = function(l) {
|
|
4647
4659
|
return typeof Buffer == "function" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(l) && (this._decoder || (this._decoder = new TextDecoder("utf8")), l = this._decoder.decode(l, { stream: !0 })), this._parser.write(l.toString()), this.emit("data", l), !0;
|
|
4648
|
-
},
|
|
4660
|
+
}, V.prototype.end = function(l) {
|
|
4649
4661
|
if (l && l.length && this.write(l), this._decoder) {
|
|
4650
4662
|
var s = this._decoder.decode();
|
|
4651
4663
|
s && (this._parser.write(s), this.emit("data", s));
|
|
4652
4664
|
}
|
|
4653
4665
|
return this._parser.end(), !0;
|
|
4654
|
-
},
|
|
4666
|
+
}, V.prototype.on = function(l, s) {
|
|
4655
4667
|
var C = this;
|
|
4656
|
-
return !C._parser["on" + l] &&
|
|
4668
|
+
return !C._parser["on" + l] && I.indexOf(l) !== -1 && (C._parser["on" + l] = function() {
|
|
4657
4669
|
var x = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
|
|
4658
4670
|
x.splice(0, 0, l), C.emit.apply(C, x);
|
|
4659
|
-
}),
|
|
4671
|
+
}), _.prototype.on.call(C, l, s);
|
|
4660
4672
|
};
|
|
4661
|
-
var W = "[CDATA[",
|
|
4673
|
+
var W = "[CDATA[", ee = "DOCTYPE", ce = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", F = { xml: ce, xmlns: B }, se = /[:_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]/, le = /[:_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-]/, xe = /[#:_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]/, J = /[#:_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-]/;
|
|
4662
4674
|
function Y(l) {
|
|
4663
4675
|
return l === " " || l === `
|
|
4664
4676
|
` || l === "\r" || l === " ";
|
|
@@ -4675,79 +4687,79 @@ function Xi() {
|
|
|
4675
4687
|
function Re(l, s) {
|
|
4676
4688
|
return !ne(l, s);
|
|
4677
4689
|
}
|
|
4678
|
-
var
|
|
4690
|
+
var R = 0;
|
|
4679
4691
|
o.STATE = {
|
|
4680
|
-
BEGIN:
|
|
4692
|
+
BEGIN: R++,
|
|
4681
4693
|
// leading byte order mark or whitespace
|
|
4682
|
-
BEGIN_WHITESPACE:
|
|
4694
|
+
BEGIN_WHITESPACE: R++,
|
|
4683
4695
|
// leading whitespace
|
|
4684
|
-
TEXT:
|
|
4696
|
+
TEXT: R++,
|
|
4685
4697
|
// general stuff
|
|
4686
|
-
TEXT_ENTITY:
|
|
4698
|
+
TEXT_ENTITY: R++,
|
|
4687
4699
|
// & and such.
|
|
4688
|
-
OPEN_WAKA:
|
|
4700
|
+
OPEN_WAKA: R++,
|
|
4689
4701
|
// <
|
|
4690
|
-
SGML_DECL:
|
|
4702
|
+
SGML_DECL: R++,
|
|
4691
4703
|
// <!BLARG
|
|
4692
|
-
SGML_DECL_QUOTED:
|
|
4704
|
+
SGML_DECL_QUOTED: R++,
|
|
4693
4705
|
// <!BLARG foo "bar
|
|
4694
|
-
DOCTYPE:
|
|
4706
|
+
DOCTYPE: R++,
|
|
4695
4707
|
// <!DOCTYPE
|
|
4696
|
-
DOCTYPE_QUOTED:
|
|
4708
|
+
DOCTYPE_QUOTED: R++,
|
|
4697
4709
|
// <!DOCTYPE "//blah
|
|
4698
|
-
DOCTYPE_DTD:
|
|
4710
|
+
DOCTYPE_DTD: R++,
|
|
4699
4711
|
// <!DOCTYPE "//blah" [ ...
|
|
4700
|
-
DOCTYPE_DTD_QUOTED:
|
|
4712
|
+
DOCTYPE_DTD_QUOTED: R++,
|
|
4701
4713
|
// <!DOCTYPE "//blah" [ "foo
|
|
4702
|
-
COMMENT_STARTING:
|
|
4714
|
+
COMMENT_STARTING: R++,
|
|
4703
4715
|
// <!-
|
|
4704
|
-
COMMENT:
|
|
4716
|
+
COMMENT: R++,
|
|
4705
4717
|
// <!--
|
|
4706
|
-
COMMENT_ENDING:
|
|
4718
|
+
COMMENT_ENDING: R++,
|
|
4707
4719
|
// <!-- blah -
|
|
4708
|
-
COMMENT_ENDED:
|
|
4720
|
+
COMMENT_ENDED: R++,
|
|
4709
4721
|
// <!-- blah --
|
|
4710
|
-
CDATA:
|
|
4722
|
+
CDATA: R++,
|
|
4711
4723
|
// <![CDATA[ something
|
|
4712
|
-
CDATA_ENDING:
|
|
4724
|
+
CDATA_ENDING: R++,
|
|
4713
4725
|
// ]
|
|
4714
|
-
CDATA_ENDING_2:
|
|
4726
|
+
CDATA_ENDING_2: R++,
|
|
4715
4727
|
// ]]
|
|
4716
|
-
PROC_INST:
|
|
4728
|
+
PROC_INST: R++,
|
|
4717
4729
|
// <?hi
|
|
4718
|
-
PROC_INST_BODY:
|
|
4730
|
+
PROC_INST_BODY: R++,
|
|
4719
4731
|
// <?hi there
|
|
4720
|
-
PROC_INST_ENDING:
|
|
4732
|
+
PROC_INST_ENDING: R++,
|
|
4721
4733
|
// <?hi "there" ?
|
|
4722
|
-
OPEN_TAG:
|
|
4734
|
+
OPEN_TAG: R++,
|
|
4723
4735
|
// <strong
|
|
4724
|
-
OPEN_TAG_SLASH:
|
|
4736
|
+
OPEN_TAG_SLASH: R++,
|
|
4725
4737
|
// <strong /
|
|
4726
|
-
ATTRIB:
|
|
4738
|
+
ATTRIB: R++,
|
|
4727
4739
|
// <a
|
|
4728
|
-
ATTRIB_NAME:
|
|
4740
|
+
ATTRIB_NAME: R++,
|
|
4729
4741
|
// <a foo
|
|
4730
|
-
ATTRIB_NAME_SAW_WHITE:
|
|
4742
|
+
ATTRIB_NAME_SAW_WHITE: R++,
|
|
4731
4743
|
// <a foo _
|
|
4732
|
-
ATTRIB_VALUE:
|
|
4744
|
+
ATTRIB_VALUE: R++,
|
|
4733
4745
|
// <a foo=
|
|
4734
|
-
ATTRIB_VALUE_QUOTED:
|
|
4746
|
+
ATTRIB_VALUE_QUOTED: R++,
|
|
4735
4747
|
// <a foo="bar
|
|
4736
|
-
ATTRIB_VALUE_CLOSED:
|
|
4748
|
+
ATTRIB_VALUE_CLOSED: R++,
|
|
4737
4749
|
// <a foo="bar"
|
|
4738
|
-
ATTRIB_VALUE_UNQUOTED:
|
|
4750
|
+
ATTRIB_VALUE_UNQUOTED: R++,
|
|
4739
4751
|
// <a foo=bar
|
|
4740
|
-
ATTRIB_VALUE_ENTITY_Q:
|
|
4752
|
+
ATTRIB_VALUE_ENTITY_Q: R++,
|
|
4741
4753
|
// <foo bar="""
|
|
4742
|
-
ATTRIB_VALUE_ENTITY_U:
|
|
4754
|
+
ATTRIB_VALUE_ENTITY_U: R++,
|
|
4743
4755
|
// <foo bar="
|
|
4744
|
-
CLOSE_TAG:
|
|
4756
|
+
CLOSE_TAG: R++,
|
|
4745
4757
|
// </a
|
|
4746
|
-
CLOSE_TAG_SAW_WHITE:
|
|
4758
|
+
CLOSE_TAG_SAW_WHITE: R++,
|
|
4747
4759
|
// </a >
|
|
4748
|
-
SCRIPT:
|
|
4760
|
+
SCRIPT: R++,
|
|
4749
4761
|
// <script> ...
|
|
4750
|
-
SCRIPT_ENDING:
|
|
4762
|
+
SCRIPT_ENDING: R++
|
|
4751
4763
|
// <script> ... <
|
|
4752
4764
|
}, o.XML_ENTITIES = {
|
|
4753
4765
|
amp: "&",
|
|
@@ -5015,7 +5027,7 @@ function Xi() {
|
|
|
5015
5027
|
});
|
|
5016
5028
|
for (var Dt in o.STATE)
|
|
5017
5029
|
o.STATE[o.STATE[Dt]] = Dt;
|
|
5018
|
-
|
|
5030
|
+
R = o.STATE;
|
|
5019
5031
|
function He(l, s, C) {
|
|
5020
5032
|
l[s] && l[s](C);
|
|
5021
5033
|
}
|
|
@@ -5035,9 +5047,9 @@ Column: ` + l.column + `
|
|
|
5035
5047
|
Char: ` + l.c), s = new Error(s), l.error = s, He(l, "onerror", s), l;
|
|
5036
5048
|
}
|
|
5037
5049
|
function bt(l) {
|
|
5038
|
-
return l.sawRoot && !l.closedRoot &&
|
|
5050
|
+
return l.sawRoot && !l.closedRoot && fe(l, "Unclosed root tag"), l.state !== R.BEGIN && l.state !== R.BEGIN_WHITESPACE && l.state !== R.TEXT && Ke(l, "Unexpected end"), Pe(l), l.c = "", l.closed = !0, He(l, "onend"), i.call(l, l.strict, l.opt), l;
|
|
5039
5051
|
}
|
|
5040
|
-
function
|
|
5052
|
+
function fe(l, s) {
|
|
5041
5053
|
if (typeof l != "object" || !(l instanceof i))
|
|
5042
5054
|
throw new Error("bad call to strictFail");
|
|
5043
5055
|
l.strict && Ke(l, s);
|
|
@@ -5059,16 +5071,16 @@ Char: ` + l.c), s = new Error(s), l.error = s, He(l, "onerror", s), l;
|
|
|
5059
5071
|
if (l.opt.xmlns) {
|
|
5060
5072
|
var s = Ve(l.attribName, !0), C = s.prefix, x = s.local;
|
|
5061
5073
|
if (C === "xmlns")
|
|
5062
|
-
if (x === "xml" && l.attribValue !==
|
|
5063
|
-
|
|
5074
|
+
if (x === "xml" && l.attribValue !== ce)
|
|
5075
|
+
fe(
|
|
5064
5076
|
l,
|
|
5065
|
-
"xml: prefix must be bound to " +
|
|
5077
|
+
"xml: prefix must be bound to " + ce + `
|
|
5066
5078
|
Actual: ` + l.attribValue
|
|
5067
5079
|
);
|
|
5068
|
-
else if (x === "xmlns" && l.attribValue !==
|
|
5069
|
-
|
|
5080
|
+
else if (x === "xmlns" && l.attribValue !== B)
|
|
5081
|
+
fe(
|
|
5070
5082
|
l,
|
|
5071
|
-
"xmlns: prefix must be bound to " +
|
|
5083
|
+
"xmlns: prefix must be bound to " + B + `
|
|
5072
5084
|
Actual: ` + l.attribValue
|
|
5073
5085
|
);
|
|
5074
5086
|
else {
|
|
@@ -5086,7 +5098,7 @@ Actual: ` + l.attribValue
|
|
|
5086
5098
|
function qe(l, s) {
|
|
5087
5099
|
if (l.opt.xmlns) {
|
|
5088
5100
|
var C = l.tag, x = Ve(l.tagName);
|
|
5089
|
-
C.prefix = x.prefix, C.local = x.local, C.uri = C.ns[x.prefix] || "", C.prefix && !C.uri && (
|
|
5101
|
+
C.prefix = x.prefix, C.local = x.local, C.uri = C.ns[x.prefix] || "", C.prefix && !C.uri && (fe(
|
|
5090
5102
|
l,
|
|
5091
5103
|
"Unbound namespace prefix: " + JSON.stringify(l.tagName)
|
|
5092
5104
|
), C.uri = x.prefix);
|
|
@@ -5105,23 +5117,23 @@ Actual: ` + l.attribValue
|
|
|
5105
5117
|
local: On,
|
|
5106
5118
|
uri: wt
|
|
5107
5119
|
};
|
|
5108
|
-
Le && Le !== "xmlns" && !wt && (
|
|
5120
|
+
Le && Le !== "xmlns" && !wt && (fe(
|
|
5109
5121
|
l,
|
|
5110
5122
|
"Unbound namespace prefix: " + JSON.stringify(Le)
|
|
5111
5123
|
), ke.uri = Le), l.tag.attributes[ye] = ke, de(l, "onattribute", ke);
|
|
5112
5124
|
}
|
|
5113
5125
|
l.attribList.length = 0;
|
|
5114
5126
|
}
|
|
5115
|
-
l.tag.isSelfClosing = !!s, l.sawRoot = !0, l.tags.push(l.tag), de(l, "onopentag", l.tag), s || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state =
|
|
5127
|
+
l.tag.isSelfClosing = !!s, l.sawRoot = !0, l.tags.push(l.tag), de(l, "onopentag", l.tag), s || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state = R.SCRIPT : l.state = R.TEXT, l.tag = null, l.tagName = ""), l.attribName = l.attribValue = "", l.attribList.length = 0;
|
|
5116
5128
|
}
|
|
5117
5129
|
function It(l) {
|
|
5118
5130
|
if (!l.tagName) {
|
|
5119
|
-
|
|
5131
|
+
fe(l, "Weird empty close tag."), l.textNode += "</>", l.state = R.TEXT;
|
|
5120
5132
|
return;
|
|
5121
5133
|
}
|
|
5122
5134
|
if (l.script) {
|
|
5123
5135
|
if (l.tagName !== "script") {
|
|
5124
|
-
l.script += "</" + l.tagName + ">", l.tagName = "", l.state =
|
|
5136
|
+
l.script += "</" + l.tagName + ">", l.tagName = "", l.state = R.SCRIPT;
|
|
5125
5137
|
return;
|
|
5126
5138
|
}
|
|
5127
5139
|
de(l, "onscript", l.script), l.script = "";
|
|
@@ -5131,12 +5143,12 @@ Actual: ` + l.attribValue
|
|
|
5131
5143
|
for (var x = C; s--; ) {
|
|
5132
5144
|
var ie = l.tags[s];
|
|
5133
5145
|
if (ie.name !== x)
|
|
5134
|
-
|
|
5146
|
+
fe(l, "Unexpected close tag");
|
|
5135
5147
|
else
|
|
5136
5148
|
break;
|
|
5137
5149
|
}
|
|
5138
5150
|
if (s < 0) {
|
|
5139
|
-
|
|
5151
|
+
fe(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state = R.TEXT;
|
|
5140
5152
|
return;
|
|
5141
5153
|
}
|
|
5142
5154
|
l.tagName = C;
|
|
@@ -5152,14 +5164,14 @@ Actual: ` + l.attribValue
|
|
|
5152
5164
|
de(l, "onclosenamespace", { prefix: Te, uri: Le });
|
|
5153
5165
|
});
|
|
5154
5166
|
}
|
|
5155
|
-
s === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state =
|
|
5167
|
+
s === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = R.TEXT;
|
|
5156
5168
|
}
|
|
5157
5169
|
function Ze(l) {
|
|
5158
5170
|
var s = l.entity, C = s.toLowerCase(), x, ie = "";
|
|
5159
|
-
return l.ENTITIES[s] ? l.ENTITIES[s] : l.ENTITIES[C] ? l.ENTITIES[C] : (s = C, s.charAt(0) === "#" && (s.charAt(1) === "x" ? (s = s.slice(2), x = parseInt(s, 16), ie = x.toString(16)) : (s = s.slice(1), x = parseInt(s, 10), ie = x.toString(10))), s = s.replace(/^0+/, ""), isNaN(x) || ie.toLowerCase() !== s || x < 0 || x > 1114111 ? (
|
|
5171
|
+
return l.ENTITIES[s] ? l.ENTITIES[s] : l.ENTITIES[C] ? l.ENTITIES[C] : (s = C, s.charAt(0) === "#" && (s.charAt(1) === "x" ? (s = s.slice(2), x = parseInt(s, 16), ie = x.toString(16)) : (s = s.slice(1), x = parseInt(s, 10), ie = x.toString(10))), s = s.replace(/^0+/, ""), isNaN(x) || ie.toLowerCase() !== s || x < 0 || x > 1114111 ? (fe(l, "Invalid character entity"), "&" + l.entity + ";") : String.fromCodePoint(x));
|
|
5160
5172
|
}
|
|
5161
5173
|
function Rt(l, s) {
|
|
5162
|
-
s === "<" ? (l.state =
|
|
5174
|
+
s === "<" ? (l.state = R.OPEN_WAKA, l.startTagPosition = l.position) : Y(s) || (fe(l, "Non-whitespace before first tag."), l.textNode = s, l.state = R.TEXT);
|
|
5163
5175
|
}
|
|
5164
5176
|
function Je(l, s) {
|
|
5165
5177
|
var C = "";
|
|
@@ -5180,184 +5192,184 @@ Actual: ` + l.attribValue
|
|
|
5180
5192
|
for (var C = 0, x = ""; x = Je(l, C++), s.c = x, !!x; )
|
|
5181
5193
|
switch (s.trackPosition && (s.position++, x === `
|
|
5182
5194
|
` ? (s.line++, s.column = 0) : s.column++), s.state) {
|
|
5183
|
-
case
|
|
5184
|
-
if (s.state =
|
|
5195
|
+
case R.BEGIN:
|
|
5196
|
+
if (s.state = R.BEGIN_WHITESPACE, x === "\uFEFF")
|
|
5185
5197
|
continue;
|
|
5186
5198
|
Rt(s, x);
|
|
5187
5199
|
continue;
|
|
5188
|
-
case
|
|
5200
|
+
case R.BEGIN_WHITESPACE:
|
|
5189
5201
|
Rt(s, x);
|
|
5190
5202
|
continue;
|
|
5191
|
-
case
|
|
5203
|
+
case R.TEXT:
|
|
5192
5204
|
if (s.sawRoot && !s.closedRoot) {
|
|
5193
5205
|
for (var Q = C - 1; x && x !== "<" && x !== "&"; )
|
|
5194
5206
|
x = Je(l, C++), x && s.trackPosition && (s.position++, x === `
|
|
5195
5207
|
` ? (s.line++, s.column = 0) : s.column++);
|
|
5196
5208
|
s.textNode += l.substring(Q, C - 1);
|
|
5197
5209
|
}
|
|
5198
|
-
x === "<" && !(s.sawRoot && s.closedRoot && !s.strict) ? (s.state =
|
|
5210
|
+
x === "<" && !(s.sawRoot && s.closedRoot && !s.strict) ? (s.state = R.OPEN_WAKA, s.startTagPosition = s.position) : (!Y(x) && (!s.sawRoot || s.closedRoot) && fe(s, "Text data outside of root node."), x === "&" ? s.state = R.TEXT_ENTITY : s.textNode += x);
|
|
5199
5211
|
continue;
|
|
5200
|
-
case
|
|
5201
|
-
x === "<" ? s.state =
|
|
5212
|
+
case R.SCRIPT:
|
|
5213
|
+
x === "<" ? s.state = R.SCRIPT_ENDING : s.script += x;
|
|
5202
5214
|
continue;
|
|
5203
|
-
case
|
|
5204
|
-
x === "/" ? s.state =
|
|
5215
|
+
case R.SCRIPT_ENDING:
|
|
5216
|
+
x === "/" ? s.state = R.CLOSE_TAG : (s.script += "<" + x, s.state = R.SCRIPT);
|
|
5205
5217
|
continue;
|
|
5206
|
-
case
|
|
5218
|
+
case R.OPEN_WAKA:
|
|
5207
5219
|
if (x === "!")
|
|
5208
|
-
s.state =
|
|
5220
|
+
s.state = R.SGML_DECL, s.sgmlDecl = "";
|
|
5209
5221
|
else if (!Y(x)) if (ne(se, x))
|
|
5210
|
-
s.state =
|
|
5222
|
+
s.state = R.OPEN_TAG, s.tagName = x;
|
|
5211
5223
|
else if (x === "/")
|
|
5212
|
-
s.state =
|
|
5224
|
+
s.state = R.CLOSE_TAG, s.tagName = "";
|
|
5213
5225
|
else if (x === "?")
|
|
5214
|
-
s.state =
|
|
5226
|
+
s.state = R.PROC_INST, s.procInstName = s.procInstBody = "";
|
|
5215
5227
|
else {
|
|
5216
|
-
if (
|
|
5228
|
+
if (fe(s, "Unencoded <"), s.startTagPosition + 1 < s.position) {
|
|
5217
5229
|
var ie = s.position - s.startTagPosition;
|
|
5218
5230
|
x = new Array(ie).join(" ") + x;
|
|
5219
5231
|
}
|
|
5220
|
-
s.textNode += "<" + x, s.state =
|
|
5232
|
+
s.textNode += "<" + x, s.state = R.TEXT;
|
|
5221
5233
|
}
|
|
5222
5234
|
continue;
|
|
5223
|
-
case
|
|
5235
|
+
case R.SGML_DECL:
|
|
5224
5236
|
if (s.sgmlDecl + x === "--") {
|
|
5225
|
-
s.state =
|
|
5237
|
+
s.state = R.COMMENT, s.comment = "", s.sgmlDecl = "";
|
|
5226
5238
|
continue;
|
|
5227
5239
|
}
|
|
5228
|
-
s.doctype && s.doctype !== !0 && s.sgmlDecl ? (s.state =
|
|
5240
|
+
s.doctype && s.doctype !== !0 && s.sgmlDecl ? (s.state = R.DOCTYPE_DTD, s.doctype += "<!" + s.sgmlDecl + x, s.sgmlDecl = "") : (s.sgmlDecl + x).toUpperCase() === W ? (de(s, "onopencdata"), s.state = R.CDATA, s.sgmlDecl = "", s.cdata = "") : (s.sgmlDecl + x).toUpperCase() === ee ? (s.state = R.DOCTYPE, (s.doctype || s.sawRoot) && fe(
|
|
5229
5241
|
s,
|
|
5230
5242
|
"Inappropriately located doctype declaration"
|
|
5231
|
-
), s.doctype = "", s.sgmlDecl = "") : x === ">" ? (de(s, "onsgmldeclaration", s.sgmlDecl), s.sgmlDecl = "", s.state =
|
|
5243
|
+
), s.doctype = "", s.sgmlDecl = "") : x === ">" ? (de(s, "onsgmldeclaration", s.sgmlDecl), s.sgmlDecl = "", s.state = R.TEXT) : (ae(x) && (s.state = R.SGML_DECL_QUOTED), s.sgmlDecl += x);
|
|
5232
5244
|
continue;
|
|
5233
|
-
case
|
|
5234
|
-
x === s.q && (s.state =
|
|
5245
|
+
case R.SGML_DECL_QUOTED:
|
|
5246
|
+
x === s.q && (s.state = R.SGML_DECL, s.q = ""), s.sgmlDecl += x;
|
|
5235
5247
|
continue;
|
|
5236
|
-
case
|
|
5237
|
-
x === ">" ? (s.state =
|
|
5248
|
+
case R.DOCTYPE:
|
|
5249
|
+
x === ">" ? (s.state = R.TEXT, de(s, "ondoctype", s.doctype), s.doctype = !0) : (s.doctype += x, x === "[" ? s.state = R.DOCTYPE_DTD : ae(x) && (s.state = R.DOCTYPE_QUOTED, s.q = x));
|
|
5238
5250
|
continue;
|
|
5239
|
-
case
|
|
5240
|
-
s.doctype += x, x === s.q && (s.q = "", s.state =
|
|
5251
|
+
case R.DOCTYPE_QUOTED:
|
|
5252
|
+
s.doctype += x, x === s.q && (s.q = "", s.state = R.DOCTYPE);
|
|
5241
5253
|
continue;
|
|
5242
|
-
case
|
|
5243
|
-
x === "]" ? (s.doctype += x, s.state =
|
|
5254
|
+
case R.DOCTYPE_DTD:
|
|
5255
|
+
x === "]" ? (s.doctype += x, s.state = R.DOCTYPE) : x === "<" ? (s.state = R.OPEN_WAKA, s.startTagPosition = s.position) : ae(x) ? (s.doctype += x, s.state = R.DOCTYPE_DTD_QUOTED, s.q = x) : s.doctype += x;
|
|
5244
5256
|
continue;
|
|
5245
|
-
case
|
|
5246
|
-
s.doctype += x, x === s.q && (s.state =
|
|
5257
|
+
case R.DOCTYPE_DTD_QUOTED:
|
|
5258
|
+
s.doctype += x, x === s.q && (s.state = R.DOCTYPE_DTD, s.q = "");
|
|
5247
5259
|
continue;
|
|
5248
|
-
case
|
|
5249
|
-
x === "-" ? s.state =
|
|
5260
|
+
case R.COMMENT:
|
|
5261
|
+
x === "-" ? s.state = R.COMMENT_ENDING : s.comment += x;
|
|
5250
5262
|
continue;
|
|
5251
|
-
case
|
|
5252
|
-
x === "-" ? (s.state =
|
|
5263
|
+
case R.COMMENT_ENDING:
|
|
5264
|
+
x === "-" ? (s.state = R.COMMENT_ENDED, s.comment = zt(s.opt, s.comment), s.comment && de(s, "oncomment", s.comment), s.comment = "") : (s.comment += "-" + x, s.state = R.COMMENT);
|
|
5253
5265
|
continue;
|
|
5254
|
-
case
|
|
5255
|
-
x !== ">" ? (
|
|
5266
|
+
case R.COMMENT_ENDED:
|
|
5267
|
+
x !== ">" ? (fe(s, "Malformed comment"), s.comment += "--" + x, s.state = R.COMMENT) : s.doctype && s.doctype !== !0 ? s.state = R.DOCTYPE_DTD : s.state = R.TEXT;
|
|
5256
5268
|
continue;
|
|
5257
|
-
case
|
|
5269
|
+
case R.CDATA:
|
|
5258
5270
|
for (var Q = C - 1; x && x !== "]"; )
|
|
5259
5271
|
x = Je(l, C++), x && s.trackPosition && (s.position++, x === `
|
|
5260
5272
|
` ? (s.line++, s.column = 0) : s.column++);
|
|
5261
|
-
s.cdata += l.substring(Q, C - 1), x === "]" && (s.state =
|
|
5273
|
+
s.cdata += l.substring(Q, C - 1), x === "]" && (s.state = R.CDATA_ENDING);
|
|
5262
5274
|
continue;
|
|
5263
|
-
case
|
|
5264
|
-
x === "]" ? s.state =
|
|
5275
|
+
case R.CDATA_ENDING:
|
|
5276
|
+
x === "]" ? s.state = R.CDATA_ENDING_2 : (s.cdata += "]" + x, s.state = R.CDATA);
|
|
5265
5277
|
continue;
|
|
5266
|
-
case
|
|
5267
|
-
x === ">" ? (s.cdata && de(s, "oncdata", s.cdata), de(s, "onclosecdata"), s.cdata = "", s.state =
|
|
5278
|
+
case R.CDATA_ENDING_2:
|
|
5279
|
+
x === ">" ? (s.cdata && de(s, "oncdata", s.cdata), de(s, "onclosecdata"), s.cdata = "", s.state = R.TEXT) : x === "]" ? s.cdata += "]" : (s.cdata += "]]" + x, s.state = R.CDATA);
|
|
5268
5280
|
continue;
|
|
5269
|
-
case
|
|
5270
|
-
x === "?" ? s.state =
|
|
5281
|
+
case R.PROC_INST:
|
|
5282
|
+
x === "?" ? s.state = R.PROC_INST_ENDING : Y(x) ? s.state = R.PROC_INST_BODY : s.procInstName += x;
|
|
5271
5283
|
continue;
|
|
5272
|
-
case
|
|
5284
|
+
case R.PROC_INST_BODY:
|
|
5273
5285
|
if (!s.procInstBody && Y(x))
|
|
5274
5286
|
continue;
|
|
5275
|
-
x === "?" ? s.state =
|
|
5287
|
+
x === "?" ? s.state = R.PROC_INST_ENDING : s.procInstBody += x;
|
|
5276
5288
|
continue;
|
|
5277
|
-
case
|
|
5289
|
+
case R.PROC_INST_ENDING:
|
|
5278
5290
|
x === ">" ? (de(s, "onprocessinginstruction", {
|
|
5279
5291
|
name: s.procInstName,
|
|
5280
5292
|
body: s.procInstBody
|
|
5281
|
-
}), s.procInstName = s.procInstBody = "", s.state =
|
|
5293
|
+
}), s.procInstName = s.procInstBody = "", s.state = R.TEXT) : (s.procInstBody += "?" + x, s.state = R.PROC_INST_BODY);
|
|
5282
5294
|
continue;
|
|
5283
|
-
case
|
|
5284
|
-
ne(
|
|
5295
|
+
case R.OPEN_TAG:
|
|
5296
|
+
ne(le, x) ? s.tagName += x : (Xe(s), x === ">" ? qe(s) : x === "/" ? s.state = R.OPEN_TAG_SLASH : (Y(x) || fe(s, "Invalid character in tag name"), s.state = R.ATTRIB));
|
|
5285
5297
|
continue;
|
|
5286
|
-
case
|
|
5287
|
-
x === ">" ? (qe(s, !0), It(s)) : (
|
|
5298
|
+
case R.OPEN_TAG_SLASH:
|
|
5299
|
+
x === ">" ? (qe(s, !0), It(s)) : (fe(
|
|
5288
5300
|
s,
|
|
5289
5301
|
"Forward-slash in opening tag not followed by >"
|
|
5290
|
-
), s.state =
|
|
5302
|
+
), s.state = R.ATTRIB);
|
|
5291
5303
|
continue;
|
|
5292
|
-
case
|
|
5304
|
+
case R.ATTRIB:
|
|
5293
5305
|
if (Y(x))
|
|
5294
5306
|
continue;
|
|
5295
|
-
x === ">" ? qe(s) : x === "/" ? s.state =
|
|
5307
|
+
x === ">" ? qe(s) : x === "/" ? s.state = R.OPEN_TAG_SLASH : ne(se, x) ? (s.attribName = x, s.attribValue = "", s.state = R.ATTRIB_NAME) : fe(s, "Invalid attribute name");
|
|
5296
5308
|
continue;
|
|
5297
|
-
case
|
|
5298
|
-
x === "=" ? s.state =
|
|
5309
|
+
case R.ATTRIB_NAME:
|
|
5310
|
+
x === "=" ? s.state = R.ATTRIB_VALUE : x === ">" ? (fe(s, "Attribute without value"), s.attribValue = s.attribName, Fe(s), qe(s)) : Y(x) ? s.state = R.ATTRIB_NAME_SAW_WHITE : ne(le, x) ? s.attribName += x : fe(s, "Invalid attribute name");
|
|
5299
5311
|
continue;
|
|
5300
|
-
case
|
|
5312
|
+
case R.ATTRIB_NAME_SAW_WHITE:
|
|
5301
5313
|
if (x === "=")
|
|
5302
|
-
s.state =
|
|
5314
|
+
s.state = R.ATTRIB_VALUE;
|
|
5303
5315
|
else {
|
|
5304
5316
|
if (Y(x))
|
|
5305
5317
|
continue;
|
|
5306
|
-
|
|
5318
|
+
fe(s, "Attribute without value"), s.tag.attributes[s.attribName] = "", s.attribValue = "", de(s, "onattribute", {
|
|
5307
5319
|
name: s.attribName,
|
|
5308
5320
|
value: ""
|
|
5309
|
-
}), s.attribName = "", x === ">" ? qe(s) : ne(se, x) ? (s.attribName = x, s.state =
|
|
5321
|
+
}), s.attribName = "", x === ">" ? qe(s) : ne(se, x) ? (s.attribName = x, s.state = R.ATTRIB_NAME) : (fe(s, "Invalid attribute name"), s.state = R.ATTRIB);
|
|
5310
5322
|
}
|
|
5311
5323
|
continue;
|
|
5312
|
-
case
|
|
5324
|
+
case R.ATTRIB_VALUE:
|
|
5313
5325
|
if (Y(x))
|
|
5314
5326
|
continue;
|
|
5315
|
-
ae(x) ? (s.q = x, s.state =
|
|
5327
|
+
ae(x) ? (s.q = x, s.state = R.ATTRIB_VALUE_QUOTED) : (s.opt.unquotedAttributeValues || Ke(s, "Unquoted attribute value"), s.state = R.ATTRIB_VALUE_UNQUOTED, s.attribValue = x);
|
|
5316
5328
|
continue;
|
|
5317
|
-
case
|
|
5329
|
+
case R.ATTRIB_VALUE_QUOTED:
|
|
5318
5330
|
if (x !== s.q) {
|
|
5319
|
-
x === "&" ? s.state =
|
|
5331
|
+
x === "&" ? s.state = R.ATTRIB_VALUE_ENTITY_Q : s.attribValue += x;
|
|
5320
5332
|
continue;
|
|
5321
5333
|
}
|
|
5322
|
-
Fe(s), s.q = "", s.state =
|
|
5334
|
+
Fe(s), s.q = "", s.state = R.ATTRIB_VALUE_CLOSED;
|
|
5323
5335
|
continue;
|
|
5324
|
-
case
|
|
5325
|
-
Y(x) ? s.state =
|
|
5336
|
+
case R.ATTRIB_VALUE_CLOSED:
|
|
5337
|
+
Y(x) ? s.state = R.ATTRIB : x === ">" ? qe(s) : x === "/" ? s.state = R.OPEN_TAG_SLASH : ne(se, x) ? (fe(s, "No whitespace between attributes"), s.attribName = x, s.attribValue = "", s.state = R.ATTRIB_NAME) : fe(s, "Invalid attribute name");
|
|
5326
5338
|
continue;
|
|
5327
|
-
case
|
|
5339
|
+
case R.ATTRIB_VALUE_UNQUOTED:
|
|
5328
5340
|
if (!me(x)) {
|
|
5329
|
-
x === "&" ? s.state =
|
|
5341
|
+
x === "&" ? s.state = R.ATTRIB_VALUE_ENTITY_U : s.attribValue += x;
|
|
5330
5342
|
continue;
|
|
5331
5343
|
}
|
|
5332
|
-
Fe(s), x === ">" ? qe(s) : s.state =
|
|
5344
|
+
Fe(s), x === ">" ? qe(s) : s.state = R.ATTRIB;
|
|
5333
5345
|
continue;
|
|
5334
|
-
case
|
|
5346
|
+
case R.CLOSE_TAG:
|
|
5335
5347
|
if (s.tagName)
|
|
5336
|
-
x === ">" ? It(s) : ne(
|
|
5348
|
+
x === ">" ? It(s) : ne(le, x) ? s.tagName += x : s.script ? (s.script += "</" + s.tagName + x, s.tagName = "", s.state = R.SCRIPT) : (Y(x) || fe(s, "Invalid tagname in closing tag"), s.state = R.CLOSE_TAG_SAW_WHITE);
|
|
5337
5349
|
else {
|
|
5338
5350
|
if (Y(x))
|
|
5339
5351
|
continue;
|
|
5340
|
-
Re(se, x) ? s.script ? (s.script += "</" + x, s.state =
|
|
5352
|
+
Re(se, x) ? s.script ? (s.script += "</" + x, s.state = R.SCRIPT) : fe(s, "Invalid tagname in closing tag.") : s.tagName = x;
|
|
5341
5353
|
}
|
|
5342
5354
|
continue;
|
|
5343
|
-
case
|
|
5355
|
+
case R.CLOSE_TAG_SAW_WHITE:
|
|
5344
5356
|
if (Y(x))
|
|
5345
5357
|
continue;
|
|
5346
|
-
x === ">" ? It(s) :
|
|
5358
|
+
x === ">" ? It(s) : fe(s, "Invalid characters in closing tag");
|
|
5347
5359
|
continue;
|
|
5348
|
-
case
|
|
5349
|
-
case
|
|
5350
|
-
case
|
|
5360
|
+
case R.TEXT_ENTITY:
|
|
5361
|
+
case R.ATTRIB_VALUE_ENTITY_Q:
|
|
5362
|
+
case R.ATTRIB_VALUE_ENTITY_U:
|
|
5351
5363
|
var he, Ae;
|
|
5352
5364
|
switch (s.state) {
|
|
5353
|
-
case
|
|
5354
|
-
he =
|
|
5365
|
+
case R.TEXT_ENTITY:
|
|
5366
|
+
he = R.TEXT, Ae = "textNode";
|
|
5355
5367
|
break;
|
|
5356
|
-
case
|
|
5357
|
-
he =
|
|
5368
|
+
case R.ATTRIB_VALUE_ENTITY_Q:
|
|
5369
|
+
he = R.ATTRIB_VALUE_QUOTED, Ae = "attribValue";
|
|
5358
5370
|
break;
|
|
5359
|
-
case
|
|
5360
|
-
he =
|
|
5371
|
+
case R.ATTRIB_VALUE_ENTITY_U:
|
|
5372
|
+
he = R.ATTRIB_VALUE_UNQUOTED, Ae = "attribValue";
|
|
5361
5373
|
break;
|
|
5362
5374
|
}
|
|
5363
5375
|
if (x === ";") {
|
|
@@ -5369,7 +5381,7 @@ Actual: ` + l.attribValue
|
|
|
5369
5381
|
s,
|
|
5370
5382
|
"Parsed entity depth exceeds max entity depth"
|
|
5371
5383
|
), s.entity = "", s.state = he, s.write(ye), s.entityDepth -= 1) : (s[Ae] += ye, s.entity = "", s.state = he);
|
|
5372
|
-
} else ne(s.entity.length ?
|
|
5384
|
+
} else ne(s.entity.length ? J : xe, x) ? s.entity += x : (fe(s, "Invalid character in entity name"), s[Ae] += "&" + s.entity + x, s.entity = "", s.state = he);
|
|
5373
5385
|
continue;
|
|
5374
5386
|
default:
|
|
5375
5387
|
throw new Error(s, "Unknown state: " + s.state);
|
|
@@ -5425,26 +5437,26 @@ function Yi(m) {
|
|
|
5425
5437
|
// Enable namespace handling
|
|
5426
5438
|
}
|
|
5427
5439
|
);
|
|
5428
|
-
y.onopentag = (
|
|
5429
|
-
node:
|
|
5440
|
+
y.onopentag = (j) => h = zi({
|
|
5441
|
+
node: j,
|
|
5430
5442
|
state: h,
|
|
5431
5443
|
dialecteConfig: o,
|
|
5432
5444
|
useCustomRecordsIds: c
|
|
5433
|
-
}), y.ontext = (
|
|
5445
|
+
}), y.ontext = (j) => h = Qi({ text: j, state: h }), y.onclosetag = () => ({ updatedState: h } = Hi({
|
|
5434
5446
|
state: h,
|
|
5435
5447
|
ioHooks: i
|
|
5436
5448
|
})), y.onerror = Zi;
|
|
5437
|
-
function
|
|
5438
|
-
const
|
|
5439
|
-
return h.recordsBatch = [],
|
|
5449
|
+
function _() {
|
|
5450
|
+
const j = h.recordsBatch;
|
|
5451
|
+
return h.recordsBatch = [], j;
|
|
5440
5452
|
}
|
|
5441
|
-
function
|
|
5453
|
+
function I() {
|
|
5442
5454
|
return h.recordsBatch.length;
|
|
5443
5455
|
}
|
|
5444
5456
|
return {
|
|
5445
5457
|
parser: y,
|
|
5446
|
-
drainBatch:
|
|
5447
|
-
getSize:
|
|
5458
|
+
drainBatch: _,
|
|
5459
|
+
getSize: I
|
|
5448
5460
|
};
|
|
5449
5461
|
}
|
|
5450
5462
|
function zi(m) {
|
|
@@ -5454,19 +5466,19 @@ function zi(m) {
|
|
|
5454
5466
|
defaultNamespace: i.namespaces.default,
|
|
5455
5467
|
rootElementName: i.rootElementName
|
|
5456
5468
|
}));
|
|
5457
|
-
const
|
|
5469
|
+
const _ = to(o, h.defaultNamespace), I = ao({ attributes: o.attributes, useCustomRecordsIds: d }), j = io({
|
|
5458
5470
|
attributes: o.attributes,
|
|
5459
5471
|
useCustomRecordsIds: d
|
|
5460
|
-
}),
|
|
5461
|
-
id:
|
|
5472
|
+
}), V = no(j), W = ro(c.stack), ee = {
|
|
5473
|
+
id: I,
|
|
5462
5474
|
tagName: y,
|
|
5463
|
-
namespace:
|
|
5464
|
-
attributes:
|
|
5475
|
+
namespace: _,
|
|
5476
|
+
attributes: V,
|
|
5465
5477
|
value: "",
|
|
5466
5478
|
parent: W,
|
|
5467
5479
|
children: []
|
|
5468
5480
|
};
|
|
5469
|
-
return h.stack.push(
|
|
5481
|
+
return h.stack.push(ee), h;
|
|
5470
5482
|
}
|
|
5471
5483
|
function Qi(m) {
|
|
5472
5484
|
const { text: o, state: c } = m;
|
|
@@ -5483,13 +5495,13 @@ function Hi(m) {
|
|
|
5483
5495
|
}), d.length) {
|
|
5484
5496
|
const y = d.length - 1;
|
|
5485
5497
|
d = d.map(
|
|
5486
|
-
(
|
|
5487
|
-
...
|
|
5498
|
+
(_, I) => I === y ? {
|
|
5499
|
+
..._,
|
|
5488
5500
|
children: [
|
|
5489
|
-
...
|
|
5501
|
+
..._.children,
|
|
5490
5502
|
{ id: i.id, tagName: i.tagName }
|
|
5491
5503
|
]
|
|
5492
|
-
} :
|
|
5504
|
+
} : _
|
|
5493
5505
|
);
|
|
5494
5506
|
} else i.parent && qi({
|
|
5495
5507
|
parentId: i.parent.id,
|
|
@@ -5561,23 +5573,23 @@ const ra = {
|
|
|
5561
5573
|
async function Mo(m) {
|
|
5562
5574
|
const { files: o, dialecteConfig: c, useCustomRecordsIds: i = !1 } = m, d = [];
|
|
5563
5575
|
if (o.length === 0) throw new Error("No files provided for import.");
|
|
5564
|
-
const { importOptions: h = ra, supportedFileExtensions: y } = c.io,
|
|
5576
|
+
const { importOptions: h = ra, supportedFileExtensions: y } = c.io, _ = {
|
|
5565
5577
|
...ra,
|
|
5566
5578
|
...h
|
|
5567
5579
|
};
|
|
5568
|
-
for (const
|
|
5569
|
-
if (!oo({ file:
|
|
5570
|
-
console.error(`Unsupported file type: ${
|
|
5580
|
+
for (const I of o) {
|
|
5581
|
+
if (!oo({ file: I, supportedExtensions: y })) {
|
|
5582
|
+
console.error(`Unsupported file type: ${I.name}`);
|
|
5571
5583
|
continue;
|
|
5572
5584
|
}
|
|
5573
|
-
|
|
5574
|
-
const
|
|
5575
|
-
file:
|
|
5585
|
+
I.size === 0 && console.warn(`File is empty: ${I.name}`);
|
|
5586
|
+
const j = await uo({
|
|
5587
|
+
file: I,
|
|
5576
5588
|
dialecteConfig: c,
|
|
5577
|
-
options:
|
|
5589
|
+
options: _,
|
|
5578
5590
|
useCustomRecordsIds: i
|
|
5579
5591
|
});
|
|
5580
|
-
d.push(
|
|
5592
|
+
d.push(j);
|
|
5581
5593
|
}
|
|
5582
5594
|
return d;
|
|
5583
5595
|
}
|
|
@@ -5591,11 +5603,11 @@ function so(m) {
|
|
|
5591
5603
|
async function uo(m) {
|
|
5592
5604
|
const { file: o, dialecteConfig: c, options: i, useCustomRecordsIds: d } = m, h = so(o), y = await Bi({ databaseName: h, dialecteConfig: c });
|
|
5593
5605
|
try {
|
|
5594
|
-
const
|
|
5595
|
-
if (await y.table(
|
|
5606
|
+
const _ = c.database.tables.xmlElements.name;
|
|
5607
|
+
if (await y.table(_).clear(), i.useBrowserApi && o.size !== 0 && await co({
|
|
5596
5608
|
file: o,
|
|
5597
5609
|
databaseInstance: y,
|
|
5598
|
-
elementsTableName:
|
|
5610
|
+
elementsTableName: _,
|
|
5599
5611
|
dialecteConfig: c,
|
|
5600
5612
|
options: {
|
|
5601
5613
|
useCustomRecordsIds: d,
|
|
@@ -5603,37 +5615,37 @@ async function uo(m) {
|
|
|
5603
5615
|
batchSize: i.batchSize
|
|
5604
5616
|
}
|
|
5605
5617
|
}), c.io.hooks?.afterImport) {
|
|
5606
|
-
const { creates:
|
|
5607
|
-
|
|
5618
|
+
const { creates: I, updates: j, deletes: V } = await c.io.hooks.afterImport();
|
|
5619
|
+
I?.length && await ba({ databaseInstance: y, elementsTableName: _, records: I }), j?.length && await ji({ databaseInstance: y, elementsTableName: _, updates: j }), V?.length && await Mi({ databaseInstance: y, elementsTableName: _, ids: V });
|
|
5608
5620
|
}
|
|
5609
5621
|
return h;
|
|
5610
|
-
} catch (
|
|
5611
|
-
throw console.error(`Error importing file ${o.name}:`,
|
|
5622
|
+
} catch (_) {
|
|
5623
|
+
throw console.error(`Error importing file ${o.name}:`, _), _;
|
|
5612
5624
|
} finally {
|
|
5613
5625
|
y.close();
|
|
5614
5626
|
}
|
|
5615
5627
|
}
|
|
5616
5628
|
async function co(m) {
|
|
5617
|
-
const { file: o, databaseInstance: c, elementsTableName: i, dialecteConfig: d, options: h } = m, y = o.stream().getReader(),
|
|
5629
|
+
const { file: o, databaseInstance: c, elementsTableName: i, dialecteConfig: d, options: h } = m, y = o.stream().getReader(), _ = Yi({
|
|
5618
5630
|
dialecteConfig: d,
|
|
5619
5631
|
useCustomRecordsIds: h.useCustomRecordsIds
|
|
5620
|
-
}),
|
|
5632
|
+
}), I = new TextDecoder(), j = new Uint8Array(0);
|
|
5621
5633
|
return await hr({
|
|
5622
5634
|
databaseInstance: c,
|
|
5623
5635
|
elementsTableName: i,
|
|
5624
5636
|
reader: y,
|
|
5625
|
-
sax:
|
|
5626
|
-
textDecoder:
|
|
5627
|
-
buffer:
|
|
5637
|
+
sax: _,
|
|
5638
|
+
textDecoder: I,
|
|
5639
|
+
buffer: j,
|
|
5628
5640
|
options: h
|
|
5629
5641
|
});
|
|
5630
5642
|
}
|
|
5631
5643
|
async function hr(m) {
|
|
5632
|
-
const { databaseInstance: o, elementsTableName: c, reader: i, sax: d, textDecoder: h, buffer: y, options:
|
|
5633
|
-
if (
|
|
5644
|
+
const { databaseInstance: o, elementsTableName: c, reader: i, sax: d, textDecoder: h, buffer: y, options: _ } = m, { chunkSize: I, batchSize: j } = _, { done: V, value: W } = await i.read();
|
|
5645
|
+
if (V) {
|
|
5634
5646
|
if (y.length > 0) {
|
|
5635
|
-
const
|
|
5636
|
-
d.parser.write(
|
|
5647
|
+
const ce = h.decode(y);
|
|
5648
|
+
d.parser.write(ce);
|
|
5637
5649
|
}
|
|
5638
5650
|
return d.parser.close(), await aa({
|
|
5639
5651
|
databaseInstance: o,
|
|
@@ -5644,30 +5656,30 @@ async function hr(m) {
|
|
|
5644
5656
|
}
|
|
5645
5657
|
if (!W)
|
|
5646
5658
|
return await hr(m);
|
|
5647
|
-
let
|
|
5648
|
-
for (
|
|
5649
|
-
const
|
|
5650
|
-
|
|
5651
|
-
const
|
|
5652
|
-
d.parser.write(
|
|
5659
|
+
let ee = new Uint8Array(y.length + W.length);
|
|
5660
|
+
for (ee.set(y), ee.set(W, y.length); ee.length >= I; ) {
|
|
5661
|
+
const ce = ee.slice(0, I);
|
|
5662
|
+
ee = ee.slice(I);
|
|
5663
|
+
const B = h.decode(ce, { stream: !0 });
|
|
5664
|
+
d.parser.write(B), await aa({
|
|
5653
5665
|
databaseInstance: o,
|
|
5654
5666
|
elementsTableName: c,
|
|
5655
5667
|
sax: d,
|
|
5656
|
-
batchSize:
|
|
5668
|
+
batchSize: j
|
|
5657
5669
|
});
|
|
5658
5670
|
}
|
|
5659
|
-
return await hr({ ...m, buffer:
|
|
5671
|
+
return await hr({ ...m, buffer: ee });
|
|
5660
5672
|
}
|
|
5661
5673
|
async function aa(m) {
|
|
5662
5674
|
const { databaseInstance: o, elementsTableName: c, sax: i, batchSize: d } = m;
|
|
5663
5675
|
if (i.getSize() >= d) {
|
|
5664
|
-
const y = i.drainBatch(),
|
|
5676
|
+
const y = i.drainBatch(), _ = Li({
|
|
5665
5677
|
currentBatch: y
|
|
5666
5678
|
});
|
|
5667
5679
|
await ba({
|
|
5668
5680
|
databaseInstance: o,
|
|
5669
5681
|
elementsTableName: c,
|
|
5670
|
-
records:
|
|
5682
|
+
records: _
|
|
5671
5683
|
});
|
|
5672
5684
|
}
|
|
5673
5685
|
}
|
|
@@ -5684,13 +5696,13 @@ function lo() {
|
|
|
5684
5696
|
o.ParsingError = c;
|
|
5685
5697
|
let i;
|
|
5686
5698
|
function d() {
|
|
5687
|
-
return
|
|
5699
|
+
return I(!1) || ee() || W() || V() || _();
|
|
5688
5700
|
}
|
|
5689
5701
|
function h() {
|
|
5690
|
-
return F(/\s*/),
|
|
5702
|
+
return F(/\s*/), I(!0) || W() || j() || _();
|
|
5691
5703
|
}
|
|
5692
5704
|
function y() {
|
|
5693
|
-
const
|
|
5705
|
+
const J = _(), Y = [];
|
|
5694
5706
|
let ae, me = h();
|
|
5695
5707
|
for (; me; ) {
|
|
5696
5708
|
if (me.node.type === "Element") {
|
|
@@ -5705,17 +5717,17 @@ function lo() {
|
|
|
5705
5717
|
if (i.xml.length !== 0)
|
|
5706
5718
|
throw new c("Failed to parse XML", "Not Well-Formed XML");
|
|
5707
5719
|
return {
|
|
5708
|
-
declaration:
|
|
5720
|
+
declaration: J ? J.node : null,
|
|
5709
5721
|
root: ae,
|
|
5710
5722
|
children: Y
|
|
5711
5723
|
};
|
|
5712
5724
|
}
|
|
5713
|
-
function
|
|
5714
|
-
const
|
|
5715
|
-
if (!
|
|
5725
|
+
function _() {
|
|
5726
|
+
const J = F(/^<\?([\w-:.]+)\s*/);
|
|
5727
|
+
if (!J)
|
|
5716
5728
|
return;
|
|
5717
5729
|
const Y = {
|
|
5718
|
-
name:
|
|
5730
|
+
name: J[1],
|
|
5719
5731
|
type: "ProcessingInstruction",
|
|
5720
5732
|
content: ""
|
|
5721
5733
|
}, ae = i.xml.indexOf("?>");
|
|
@@ -5728,7 +5740,7 @@ function lo() {
|
|
|
5728
5740
|
node: Y
|
|
5729
5741
|
};
|
|
5730
5742
|
}
|
|
5731
|
-
function
|
|
5743
|
+
function I(J) {
|
|
5732
5744
|
const Y = F(/^<([^?!</>\s]+)\s*/);
|
|
5733
5745
|
if (!Y)
|
|
5734
5746
|
return;
|
|
@@ -5737,9 +5749,9 @@ function lo() {
|
|
|
5737
5749
|
name: Y[1],
|
|
5738
5750
|
attributes: {},
|
|
5739
5751
|
children: []
|
|
5740
|
-
}, me =
|
|
5741
|
-
for (; !(se() ||
|
|
5742
|
-
const Re =
|
|
5752
|
+
}, me = J ? !1 : i.options.filter(ae) === !1;
|
|
5753
|
+
for (; !(se() || le(">") || le("?>") || le("/>")); ) {
|
|
5754
|
+
const Re = ce();
|
|
5743
5755
|
if (Re)
|
|
5744
5756
|
ae.attributes[Re.name] = Re.value;
|
|
5745
5757
|
else
|
|
@@ -5767,12 +5779,12 @@ function lo() {
|
|
|
5767
5779
|
node: ae
|
|
5768
5780
|
};
|
|
5769
5781
|
}
|
|
5770
|
-
function
|
|
5771
|
-
const
|
|
5772
|
-
if (
|
|
5782
|
+
function j() {
|
|
5783
|
+
const J = F(/^<!DOCTYPE\s+\S+\s+SYSTEM[^>]*>/) || F(/^<!DOCTYPE\s+\S+\s+PUBLIC[^>]*>/) || F(/^<!DOCTYPE\s+\S+\s*\[[^\]]*]>/) || F(/^<!DOCTYPE\s+\S+\s*>/);
|
|
5784
|
+
if (J) {
|
|
5773
5785
|
const Y = {
|
|
5774
5786
|
type: "DocumentType",
|
|
5775
|
-
content:
|
|
5787
|
+
content: J[0]
|
|
5776
5788
|
};
|
|
5777
5789
|
return {
|
|
5778
5790
|
excluded: i.options.filter(Y) === !1,
|
|
@@ -5780,11 +5792,11 @@ function lo() {
|
|
|
5780
5792
|
};
|
|
5781
5793
|
}
|
|
5782
5794
|
}
|
|
5783
|
-
function
|
|
5795
|
+
function V() {
|
|
5784
5796
|
if (i.xml.startsWith("<![CDATA[")) {
|
|
5785
|
-
const
|
|
5786
|
-
if (
|
|
5787
|
-
const Y =
|
|
5797
|
+
const J = i.xml.indexOf("]]>");
|
|
5798
|
+
if (J > -1) {
|
|
5799
|
+
const Y = J + 3, ae = {
|
|
5788
5800
|
type: "CDATA",
|
|
5789
5801
|
content: i.xml.substring(0, Y)
|
|
5790
5802
|
};
|
|
@@ -5796,11 +5808,11 @@ function lo() {
|
|
|
5796
5808
|
}
|
|
5797
5809
|
}
|
|
5798
5810
|
function W() {
|
|
5799
|
-
const
|
|
5800
|
-
if (
|
|
5811
|
+
const J = F(/^<!--[\s\S]*?-->/);
|
|
5812
|
+
if (J) {
|
|
5801
5813
|
const Y = {
|
|
5802
5814
|
type: "Comment",
|
|
5803
|
-
content:
|
|
5815
|
+
content: J[0]
|
|
5804
5816
|
};
|
|
5805
5817
|
return {
|
|
5806
5818
|
excluded: i.options.filter(Y) === !1,
|
|
@@ -5808,12 +5820,12 @@ function lo() {
|
|
|
5808
5820
|
};
|
|
5809
5821
|
}
|
|
5810
5822
|
}
|
|
5811
|
-
function
|
|
5812
|
-
const
|
|
5813
|
-
if (
|
|
5823
|
+
function ee() {
|
|
5824
|
+
const J = F(/^([^<]+)/);
|
|
5825
|
+
if (J) {
|
|
5814
5826
|
const Y = {
|
|
5815
5827
|
type: "Text",
|
|
5816
|
-
content:
|
|
5828
|
+
content: J[1]
|
|
5817
5829
|
};
|
|
5818
5830
|
return {
|
|
5819
5831
|
excluded: i.options.filter(Y) === !1,
|
|
@@ -5821,33 +5833,33 @@ function lo() {
|
|
|
5821
5833
|
};
|
|
5822
5834
|
}
|
|
5823
5835
|
}
|
|
5824
|
-
function
|
|
5825
|
-
const
|
|
5826
|
-
if (
|
|
5836
|
+
function ce() {
|
|
5837
|
+
const J = F(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);
|
|
5838
|
+
if (J)
|
|
5827
5839
|
return {
|
|
5828
|
-
name:
|
|
5829
|
-
value:
|
|
5840
|
+
name: J[1].trim(),
|
|
5841
|
+
value: B(J[2].trim())
|
|
5830
5842
|
};
|
|
5831
5843
|
}
|
|
5832
|
-
function
|
|
5833
|
-
return
|
|
5844
|
+
function B(J) {
|
|
5845
|
+
return J.replace(/^['"]|['"]$/g, "");
|
|
5834
5846
|
}
|
|
5835
|
-
function F(
|
|
5836
|
-
const Y = i.xml.match(
|
|
5847
|
+
function F(J) {
|
|
5848
|
+
const Y = i.xml.match(J);
|
|
5837
5849
|
if (Y)
|
|
5838
5850
|
return i.xml = i.xml.slice(Y[0].length), Y;
|
|
5839
5851
|
}
|
|
5840
5852
|
function se() {
|
|
5841
5853
|
return i.xml.length === 0;
|
|
5842
5854
|
}
|
|
5843
|
-
function
|
|
5844
|
-
return i.xml.indexOf(
|
|
5855
|
+
function le(J) {
|
|
5856
|
+
return i.xml.indexOf(J) === 0;
|
|
5845
5857
|
}
|
|
5846
|
-
function xe(
|
|
5847
|
-
|
|
5858
|
+
function xe(J, Y = {}) {
|
|
5859
|
+
J = J.trim();
|
|
5848
5860
|
const ae = Y.filter || (() => !0);
|
|
5849
5861
|
return i = {
|
|
5850
|
-
xml:
|
|
5862
|
+
xml: J,
|
|
5851
5863
|
options: Object.assign(Object.assign({}, Y), { filter: ae, strictMode: Y.strictMode === !0 })
|
|
5852
5864
|
}, y();
|
|
5853
5865
|
}
|
|
@@ -5857,97 +5869,97 @@ function lo() {
|
|
|
5857
5869
|
var oa = Wt.exports, sa;
|
|
5858
5870
|
function fo() {
|
|
5859
5871
|
return sa || (sa = 1, (function(m, o) {
|
|
5860
|
-
var c = oa && oa.__importDefault || function(
|
|
5861
|
-
return
|
|
5872
|
+
var c = oa && oa.__importDefault || function(B) {
|
|
5873
|
+
return B && B.__esModule ? B : { default: B };
|
|
5862
5874
|
};
|
|
5863
5875
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
5864
5876
|
const i = c(/* @__PURE__ */ lo());
|
|
5865
|
-
function d(
|
|
5866
|
-
if (!
|
|
5877
|
+
function d(B) {
|
|
5878
|
+
if (!B.options.indentation && !B.options.lineSeparator)
|
|
5867
5879
|
return;
|
|
5868
|
-
|
|
5880
|
+
B.content += B.options.lineSeparator;
|
|
5869
5881
|
let F;
|
|
5870
|
-
for (F = 0; F <
|
|
5871
|
-
|
|
5882
|
+
for (F = 0; F < B.level; F++)
|
|
5883
|
+
B.content += B.options.indentation;
|
|
5872
5884
|
}
|
|
5873
|
-
function h(
|
|
5874
|
-
|
|
5885
|
+
function h(B) {
|
|
5886
|
+
B.content = B.content.replace(/ +$/, "");
|
|
5875
5887
|
let F;
|
|
5876
|
-
for (F = 0; F <
|
|
5877
|
-
|
|
5888
|
+
for (F = 0; F < B.level; F++)
|
|
5889
|
+
B.content += B.options.indentation;
|
|
5878
5890
|
}
|
|
5879
|
-
function y(
|
|
5880
|
-
|
|
5891
|
+
function y(B, F) {
|
|
5892
|
+
B.content += F;
|
|
5881
5893
|
}
|
|
5882
|
-
function
|
|
5883
|
-
if (
|
|
5884
|
-
|
|
5885
|
-
else if (
|
|
5886
|
-
|
|
5887
|
-
else if (typeof
|
|
5888
|
-
|
|
5894
|
+
function _(B, F, se) {
|
|
5895
|
+
if (B.type === "Element")
|
|
5896
|
+
V(B, F, se);
|
|
5897
|
+
else if (B.type === "ProcessingInstruction")
|
|
5898
|
+
ee(B, F);
|
|
5899
|
+
else if (typeof B.content == "string")
|
|
5900
|
+
I(B.content, F, se);
|
|
5889
5901
|
else
|
|
5890
|
-
throw new Error("Unknown node type: " +
|
|
5902
|
+
throw new Error("Unknown node type: " + B.type);
|
|
5891
5903
|
}
|
|
5892
|
-
function
|
|
5904
|
+
function I(B, F, se) {
|
|
5893
5905
|
if (!se) {
|
|
5894
|
-
const
|
|
5895
|
-
(F.options.lineSeparator ||
|
|
5906
|
+
const le = B.trim();
|
|
5907
|
+
(F.options.lineSeparator || le.length === 0) && (B = le);
|
|
5896
5908
|
}
|
|
5897
|
-
|
|
5909
|
+
B.length > 0 && (!se && F.content.length > 0 && d(F), y(F, B));
|
|
5898
5910
|
}
|
|
5899
|
-
function B
|
|
5900
|
-
const se = "/" +
|
|
5901
|
-
return F.includes(
|
|
5911
|
+
function j(B, F) {
|
|
5912
|
+
const se = "/" + B.join("/"), le = B[B.length - 1];
|
|
5913
|
+
return F.includes(le) || F.includes(se);
|
|
5902
5914
|
}
|
|
5903
|
-
function
|
|
5904
|
-
if (F.path.push(
|
|
5905
|
-
const
|
|
5906
|
-
y(F,
|
|
5907
|
-
} else if (
|
|
5908
|
-
y(F, "></" +
|
|
5915
|
+
function V(B, F, se) {
|
|
5916
|
+
if (F.path.push(B.name), !se && F.content.length > 0 && d(F), y(F, "<" + B.name), W(F, B.attributes), B.children === null || F.options.forceSelfClosingEmptyTag && B.children.length === 0) {
|
|
5917
|
+
const le = F.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
|
|
5918
|
+
y(F, le);
|
|
5919
|
+
} else if (B.children.length === 0)
|
|
5920
|
+
y(F, "></" + B.name + ">");
|
|
5909
5921
|
else {
|
|
5910
|
-
const
|
|
5922
|
+
const le = B.children;
|
|
5911
5923
|
y(F, ">"), F.level++;
|
|
5912
|
-
let xe =
|
|
5913
|
-
if (!xe && F.options.ignoredPaths && (
|
|
5924
|
+
let xe = B.attributes["xml:space"] === "preserve" || se, J = !1;
|
|
5925
|
+
if (!xe && F.options.ignoredPaths && (J = j(F.path, F.options.ignoredPaths), xe = J), !xe && F.options.collapseContent) {
|
|
5914
5926
|
let Y = !1, ae = !1, me = !1;
|
|
5915
|
-
|
|
5927
|
+
le.forEach(function(ne, Re) {
|
|
5916
5928
|
ne.type === "Text" ? (ne.content.includes(`
|
|
5917
|
-
`) ? (ae = !0, ne.content = ne.content.trim()) : (Re === 0 || Re ===
|
|
5929
|
+
`) ? (ae = !0, ne.content = ne.content.trim()) : (Re === 0 || Re === le.length - 1) && !se && ne.content.trim().length === 0 && (ne.content = ""), (ne.content.trim().length > 0 || le.length === 1) && (Y = !0)) : ne.type === "CDATA" ? Y = !0 : me = !0;
|
|
5918
5930
|
}), Y && (!me || !ae) && (xe = !0);
|
|
5919
5931
|
}
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
}), F.level--, !se && !xe && d(F),
|
|
5932
|
+
le.forEach(function(Y) {
|
|
5933
|
+
_(Y, F, se || xe);
|
|
5934
|
+
}), F.level--, !se && !xe && d(F), J && h(F), y(F, "</" + B.name + ">");
|
|
5923
5935
|
}
|
|
5924
5936
|
F.path.pop();
|
|
5925
5937
|
}
|
|
5926
|
-
function W(
|
|
5938
|
+
function W(B, F) {
|
|
5927
5939
|
Object.keys(F).forEach(function(se) {
|
|
5928
|
-
const
|
|
5929
|
-
y(
|
|
5940
|
+
const le = F[se].replace(/"/g, """);
|
|
5941
|
+
y(B, " " + se + '="' + le + '"');
|
|
5930
5942
|
});
|
|
5931
5943
|
}
|
|
5932
|
-
function
|
|
5933
|
-
F.content.length > 0 && d(F), y(F, "<?" +
|
|
5944
|
+
function ee(B, F) {
|
|
5945
|
+
F.content.length > 0 && d(F), y(F, "<?" + B.name), y(F, " " + B.content.trim()), y(F, "?>");
|
|
5934
5946
|
}
|
|
5935
|
-
function
|
|
5947
|
+
function ce(B, F = {}) {
|
|
5936
5948
|
F.indentation = "indentation" in F ? F.indentation : " ", F.collapseContent = F.collapseContent === !0, F.lineSeparator = "lineSeparator" in F ? F.lineSeparator : `\r
|
|
5937
5949
|
`, F.whiteSpaceAtEndOfSelfclosingTag = F.whiteSpaceAtEndOfSelfclosingTag === !0, F.throwOnFailure = F.throwOnFailure !== !1;
|
|
5938
5950
|
try {
|
|
5939
|
-
const se = (0, i.default)(
|
|
5940
|
-
return se.declaration &&
|
|
5941
|
-
|
|
5942
|
-
}), F.lineSeparator ?
|
|
5943
|
-
`).replace(/\n/g, F.lineSeparator) :
|
|
5951
|
+
const se = (0, i.default)(B, { filter: F.filter, strictMode: F.strictMode }), le = { content: "", level: 0, options: F, path: [] };
|
|
5952
|
+
return se.declaration && ee(se.declaration, le), se.children.forEach(function(xe) {
|
|
5953
|
+
_(xe, le, !1);
|
|
5954
|
+
}), F.lineSeparator ? le.content.replace(/\r\n/g, `
|
|
5955
|
+
`).replace(/\n/g, F.lineSeparator) : le.content;
|
|
5944
5956
|
} catch (se) {
|
|
5945
5957
|
if (F.throwOnFailure)
|
|
5946
5958
|
throw se;
|
|
5947
|
-
return
|
|
5959
|
+
return B;
|
|
5948
5960
|
}
|
|
5949
5961
|
}
|
|
5950
|
-
|
|
5962
|
+
ce.minify = (B, F = {}) => ce(B, Object.assign(Object.assign({}, F), { indentation: "", lineSeparator: "" })), m.exports = ce, o.default = ce;
|
|
5951
5963
|
})(Wt, Wt.exports)), Wt.exports;
|
|
5952
5964
|
}
|
|
5953
5965
|
var ho = /* @__PURE__ */ fo();
|
|
@@ -5956,8 +5968,8 @@ function mo(m) {
|
|
|
5956
5968
|
return po(m);
|
|
5957
5969
|
}
|
|
5958
5970
|
async function go(m) {
|
|
5959
|
-
const { extension: o, xmlDocument: c, filename: i } = m,
|
|
5960
|
-
` + new XMLSerializer().serializeToString(c),
|
|
5971
|
+
const { extension: o, xmlDocument: c, filename: i } = m, _ = `<?xml version="1.0" encoding="UTF-8"?>
|
|
5972
|
+
` + new XMLSerializer().serializeToString(c), I = mo(_), j = new Blob([I], { type: "application/xml" });
|
|
5961
5973
|
if ("showSaveFilePicker" in window)
|
|
5962
5974
|
try {
|
|
5963
5975
|
const W = await (await window.showSaveFilePicker({
|
|
@@ -5969,13 +5981,13 @@ async function go(m) {
|
|
|
5969
5981
|
}
|
|
5970
5982
|
]
|
|
5971
5983
|
})).createWritable();
|
|
5972
|
-
await W.write(
|
|
5973
|
-
} catch (
|
|
5974
|
-
|
|
5984
|
+
await W.write(j), await W.close();
|
|
5985
|
+
} catch (V) {
|
|
5986
|
+
V.name !== "AbortError" && console.error("Save failed:", V);
|
|
5975
5987
|
}
|
|
5976
5988
|
else {
|
|
5977
|
-
const
|
|
5978
|
-
W.href =
|
|
5989
|
+
const V = URL.createObjectURL(j), W = document.createElement("a");
|
|
5990
|
+
W.href = V, W.download = i, document.body.appendChild(W), W.click(), W.remove(), URL.revokeObjectURL(V);
|
|
5979
5991
|
}
|
|
5980
5992
|
}
|
|
5981
5993
|
async function Ko(m) {
|
|
@@ -6017,32 +6029,32 @@ async function yo(m) {
|
|
|
6017
6029
|
}
|
|
6018
6030
|
}
|
|
6019
6031
|
async function vo(m) {
|
|
6020
|
-
const { databaseInstance: o, dialecteConfig: c, withDatabaseIds: i } = m, { useBrowserApi: d = !0 } = c.io.exportOptions ?? { useBrowserApi: !0 }, h = c.rootElementName, y = c.namespaces.default,
|
|
6032
|
+
const { databaseInstance: o, dialecteConfig: c, withDatabaseIds: i } = m, { useBrowserApi: d = !0 } = c.io.exportOptions ?? { useBrowserApi: !0 }, h = c.rootElementName, y = c.namespaces.default, _ = c.database.tables.xmlElements.name;
|
|
6021
6033
|
if (d) {
|
|
6022
|
-
const
|
|
6034
|
+
const I = document.implementation.createDocument(
|
|
6023
6035
|
y.uri,
|
|
6024
6036
|
null,
|
|
6025
6037
|
null
|
|
6026
|
-
),
|
|
6027
|
-
if (!
|
|
6028
|
-
const
|
|
6029
|
-
|
|
6030
|
-
|
|
6038
|
+
), j = await o.table(_).where({ tagName: h }).first();
|
|
6039
|
+
if (!j) throw new Error(`No ${h} root element found in DB`);
|
|
6040
|
+
const V = I.createElementNS(
|
|
6041
|
+
j.namespace.uri,
|
|
6042
|
+
j.tagName
|
|
6031
6043
|
);
|
|
6032
|
-
return
|
|
6044
|
+
return V.setAttribute("xmlns", j.namespace.uri), j.attributes && Ea({
|
|
6033
6045
|
dialecteConfig: c,
|
|
6034
|
-
document:
|
|
6035
|
-
element:
|
|
6036
|
-
attributes:
|
|
6046
|
+
document: I,
|
|
6047
|
+
element: V,
|
|
6048
|
+
attributes: j.attributes,
|
|
6037
6049
|
isRoot: !0
|
|
6038
|
-
}), xa({ dialecteConfig: c, rootElement:
|
|
6050
|
+
}), xa({ dialecteConfig: c, rootElement: V, namespace: j.namespace }), j.value && (V.textContent = j.value.trim()), i && V.setAttribute(wa, j.id), I.appendChild(V), await _a({
|
|
6039
6051
|
databaseInstance: o,
|
|
6040
6052
|
dialecteConfig: c,
|
|
6041
|
-
elementsTableName:
|
|
6053
|
+
elementsTableName: _,
|
|
6042
6054
|
withDatabaseIds: i,
|
|
6043
|
-
xmlDocument:
|
|
6044
|
-
databaseRecord:
|
|
6045
|
-
parentDomElement:
|
|
6055
|
+
xmlDocument: I,
|
|
6056
|
+
databaseRecord: j,
|
|
6057
|
+
parentDomElement: V
|
|
6046
6058
|
});
|
|
6047
6059
|
}
|
|
6048
6060
|
}
|
|
@@ -6054,35 +6066,35 @@ async function _a(m) {
|
|
|
6054
6066
|
withDatabaseIds: d,
|
|
6055
6067
|
xmlDocument: h,
|
|
6056
6068
|
databaseRecord: y,
|
|
6057
|
-
parentDomElement:
|
|
6069
|
+
parentDomElement: _
|
|
6058
6070
|
} = m;
|
|
6059
6071
|
if (!y.children) return;
|
|
6060
|
-
const
|
|
6072
|
+
const I = y.children.map((ee) => ee.id), V = await o.table(i).bulkGet(I);
|
|
6061
6073
|
_o({
|
|
6062
|
-
childrenRecords:
|
|
6074
|
+
childrenRecords: V,
|
|
6063
6075
|
parentRecord: y
|
|
6064
6076
|
});
|
|
6065
6077
|
const W = wo({
|
|
6066
6078
|
parentTagName: y.tagName,
|
|
6067
6079
|
availableChildren: c.children,
|
|
6068
|
-
childrenRecords:
|
|
6080
|
+
childrenRecords: V
|
|
6069
6081
|
});
|
|
6070
|
-
for (const
|
|
6071
|
-
const
|
|
6082
|
+
for (const ee of W) {
|
|
6083
|
+
const ce = bo({
|
|
6072
6084
|
dialecteConfig: c,
|
|
6073
6085
|
document: h,
|
|
6074
|
-
record:
|
|
6086
|
+
record: ee,
|
|
6075
6087
|
defaultNamespace: c.namespaces.default,
|
|
6076
6088
|
withDatabaseIds: d
|
|
6077
6089
|
});
|
|
6078
|
-
|
|
6090
|
+
_.appendChild(ce), await _a({
|
|
6079
6091
|
databaseInstance: o,
|
|
6080
6092
|
dialecteConfig: c,
|
|
6081
6093
|
elementsTableName: i,
|
|
6082
6094
|
withDatabaseIds: d,
|
|
6083
6095
|
xmlDocument: h,
|
|
6084
|
-
databaseRecord:
|
|
6085
|
-
parentDomElement:
|
|
6096
|
+
databaseRecord: ee,
|
|
6097
|
+
parentDomElement: ce
|
|
6086
6098
|
});
|
|
6087
6099
|
}
|
|
6088
6100
|
return m.xmlDocument;
|
|
@@ -6110,8 +6122,8 @@ function Ea(m) {
|
|
|
6110
6122
|
for (const y of d)
|
|
6111
6123
|
if (!Eo(y))
|
|
6112
6124
|
if (Na(y)) {
|
|
6113
|
-
const
|
|
6114
|
-
if (!
|
|
6125
|
+
const _ = y.namespace?.prefix || "";
|
|
6126
|
+
if (!_) {
|
|
6115
6127
|
i.setAttribute(y.name, String(y.value));
|
|
6116
6128
|
continue;
|
|
6117
6129
|
}
|
|
@@ -6120,8 +6132,8 @@ function Ea(m) {
|
|
|
6120
6132
|
document: c,
|
|
6121
6133
|
namespace: y.namespace
|
|
6122
6134
|
});
|
|
6123
|
-
const
|
|
6124
|
-
i.setAttributeNS(y.namespace.uri,
|
|
6135
|
+
const I = y.name.includes(":") && y.name.split(":").pop() || y.name, j = `${_}:${I}`;
|
|
6136
|
+
i.setAttributeNS(y.namespace.uri, j, String(y.value));
|
|
6125
6137
|
} else i.setAttribute(y.name, String(y.value));
|
|
6126
6138
|
}
|
|
6127
6139
|
function Ta(m) {
|
|
@@ -6133,31 +6145,31 @@ function Ta(m) {
|
|
|
6133
6145
|
function xa(m) {
|
|
6134
6146
|
const { dialecteConfig: o, rootElement: c, namespace: i } = m, d = Object.entries(
|
|
6135
6147
|
o.definition[o.rootElementName].attributes.details
|
|
6136
|
-
).filter(([y,
|
|
6148
|
+
).filter(([y, _]) => i.uri === o.namespaces.default.uri ? !_.namespace : _.namespace?.prefix === i.prefix && _.namespace?.uri === i.uri);
|
|
6137
6149
|
if (d.length > 0)
|
|
6138
|
-
for (const [y,
|
|
6139
|
-
const
|
|
6140
|
-
if (!(
|
|
6141
|
-
if (
|
|
6142
|
-
const
|
|
6143
|
-
c.setAttributeNS(
|
|
6150
|
+
for (const [y, _] of d) {
|
|
6151
|
+
const I = y.includes(":") && y.split(":").pop() || y;
|
|
6152
|
+
if (!(_.namespace ? c.hasAttributeNS(_.namespace.uri, I) : c.hasAttribute(I)))
|
|
6153
|
+
if (_.namespace) {
|
|
6154
|
+
const V = `${_.namespace.prefix}:${I}`;
|
|
6155
|
+
c.setAttributeNS(_.namespace.uri, V, _.default || "");
|
|
6144
6156
|
} else
|
|
6145
|
-
c.setAttribute(
|
|
6157
|
+
c.setAttribute(I, _.default || "");
|
|
6146
6158
|
}
|
|
6147
6159
|
}
|
|
6148
6160
|
function wo(m) {
|
|
6149
6161
|
const { parentTagName: o, availableChildren: c, childrenRecords: i } = m, d = [], h = new Set(c[o]);
|
|
6150
6162
|
if (!h.size) return i;
|
|
6151
|
-
const y = /* @__PURE__ */ new Map(),
|
|
6152
|
-
for (const
|
|
6153
|
-
y.set(
|
|
6154
|
-
for (const
|
|
6155
|
-
h.has(
|
|
6156
|
-
for (const
|
|
6157
|
-
const
|
|
6158
|
-
|
|
6163
|
+
const y = /* @__PURE__ */ new Map(), _ = [];
|
|
6164
|
+
for (const I of h)
|
|
6165
|
+
y.set(I, []);
|
|
6166
|
+
for (const I of i)
|
|
6167
|
+
h.has(I.tagName) ? y.get(I.tagName)?.push(I) : _.push(I);
|
|
6168
|
+
for (const I of h) {
|
|
6169
|
+
const j = y.get(I);
|
|
6170
|
+
j && j.length && d.push(...j);
|
|
6159
6171
|
}
|
|
6160
|
-
return d.push(...
|
|
6172
|
+
return d.push(..._), d;
|
|
6161
6173
|
}
|
|
6162
6174
|
function _o(m) {
|
|
6163
6175
|
const { childrenRecords: o, parentRecord: c } = m, i = o.map((d, h) => d === void 0 ? h : -1).filter((d) => d !== -1);
|