@septkit/ui 0.0.57 → 0.0.59

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.
Files changed (20) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +17 -11
  2. package/dist/diagram-layout/elk-layout-engine.js +71 -0
  3. package/dist/diagram-layout/index.js +2 -0
  4. package/dist/dialecte/create-document-store.js +3 -3
  5. package/dist/external/.pnpm/{@dialecte_core@0.4.12 → @dialecte_core@0.4.16}/node_modules/@dialecte/core/dist/helpers.js +41 -41
  6. package/dist/external/.pnpm/@dialecte_core@0.4.16/node_modules/@dialecte/core/dist/index.js +3 -0
  7. package/dist/external/.pnpm/{@dialecte_core@0.4.12/node_modules/@dialecte/core/dist/project-DkMkDgld.js → @dialecte_core@0.4.16/node_modules/@dialecte/core/dist/project-nvZv2ie8.js} +797 -745
  8. package/dist/external/.pnpm/{@dialecte_core@0.4.12/node_modules/@dialecte/core/dist/utils-C5_11hqg.js → @dialecte_core@0.4.16/node_modules/@dialecte/core/dist/utils-BiEx1x59.js} +2 -2
  9. package/dist/external/.pnpm/{@dialecte_scl@0.3.15/node_modules/@dialecte/scl/dist/hooks-CLIa7kxj.js → @dialecte_scl@0.3.17/node_modules/@dialecte/scl/dist/hooks-BBGXNK0x.js} +31 -19
  10. package/dist/external/.pnpm/{@dialecte_scl@0.3.15 → @dialecte_scl@0.3.17}/node_modules/@dialecte/scl/dist/v2019C1/index.js +3 -3
  11. package/dist/external/.pnpm/elkjs@0.10.2/node_modules/elkjs/lib/elk.bundled.js +46047 -0
  12. package/dist/index.d.ts +79 -2
  13. package/dist/index.js +3 -1
  14. package/dist/merge/build-view-model.js +17 -17
  15. package/dist/merge/merge-preflight.vue_vue_type_script_setup_true_lang.js +1 -1
  16. package/dist/merge/merge.service.js +16 -20
  17. package/dist/merge/use-merge-session.js +101 -121
  18. package/package.json +4 -3
  19. package/dist/external/.pnpm/@dialecte_core@0.4.12/node_modules/@dialecte/core/dist/index.js +0 -3
  20. package/dist/merge/merge-correlate.js +0 -46
@@ -1,6 +1,6 @@
1
- import { a as e, d as t, f as n, n as r, o as i, p as a, r as o } from "./utils-C5_11hqg.js";
1
+ import { c as e, h as t, m as n, n as r, p as i, r as a, s as o } from "./utils-BiEx1x59.js";
2
2
  import { assertNoFixedViolation as s, isRecordOf as c, standardizeRecord as l, toFullAttributeArray as u, toRawRecord as d, toRef as f, toTreeRecord as p } from "./helpers.js";
3
- //#region node_modules/.pnpm/@dialecte+core@0.4.12/node_modules/@dialecte/core/dist/project-DkMkDgld.js
3
+ //#region node_modules/.pnpm/@dialecte+core@0.4.16/node_modules/@dialecte/core/dist/project-nvZv2ie8.js
4
4
  var m = Object.create, h = Object.defineProperty, g = Object.getOwnPropertyDescriptor, _ = Object.getOwnPropertyNames, v = Object.getPrototypeOf, y = Object.prototype.hasOwnProperty, b = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), x = (e, t, n, r) => {
5
5
  if (t && typeof t == "object" || typeof t == "function") for (var i = _(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !y.call(e, s) && s !== n && h(e, s, {
6
6
  get: ((e) => t[e]).bind(null, s),
@@ -69,63 +69,55 @@ var te = Object.freeze({
69
69
  endPlan() {},
70
70
  forceClear() {}
71
71
  });
72
- function T(e) {
73
- let { stagedOperations: t, tagName: n, id: r } = e;
74
- for (let e = t.length - 1; e >= 0; e--) {
75
- let i = t[e];
76
- if (r === void 0) {
77
- if ((i.status === "created" || i.status === "updated") && c(i.newRecord, n)) return {
78
- ...i.newRecord,
79
- status: i.status
80
- };
81
- if (i.status === "deleted" && c(i.oldRecord, n)) return {
82
- ...i.oldRecord,
83
- status: "deleted"
84
- };
85
- continue;
86
- }
87
- if (i.status === "created" && i.newRecord.id === r) {
88
- let e = i.newRecord.tagName;
89
- return e !== n && a("ELEMENT_TAGNAME_MISMATCH", {
90
- detail: `Expected tagName '${n}', got '${e}' for id '${r}'`,
91
- ref: {
92
- tagName: n,
93
- id: r
94
- }
95
- }), {
96
- ...i.newRecord,
97
- status: "created"
98
- };
99
- }
100
- if (i.status === "updated" && i.newRecord.id === r) {
101
- let e = i.newRecord.tagName;
102
- return e !== n && a("ELEMENT_TAGNAME_MISMATCH", {
103
- detail: `Expected tagName '${n}', got '${e}' for id '${r}'`,
104
- ref: {
105
- tagName: n,
106
- id: r
107
- }
108
- }), {
109
- ...i.newRecord,
110
- status: "updated"
111
- };
112
- }
113
- if (i.status === "deleted" && i.oldRecord.id === r) {
114
- let e = i.oldRecord.tagName;
115
- return e !== n && a("ELEMENT_TAGNAME_MISMATCH", {
116
- detail: `Expected tagName '${n}', got '${e}' for id '${r}'`,
117
- ref: {
118
- tagName: n,
119
- id: r
120
- }
121
- }), {
122
- ...i.oldRecord,
123
- status: "deleted"
124
- };
125
- }
126
- }
72
+ function T() {
73
+ return {
74
+ log: [],
75
+ byId: /* @__PURE__ */ new Map()
76
+ };
127
77
  }
128
78
  function ne(e) {
79
+ let { stagedOperations: t, tagName: n, id: r } = e, { log: i, byId: a } = t;
80
+ if (r !== void 0) {
81
+ let e = a.get(r);
82
+ return e ? re({
83
+ operation: e,
84
+ tagName: n,
85
+ id: r
86
+ }) : void 0;
87
+ }
88
+ for (let e = i.length - 1; e >= 0; e--) {
89
+ let t = i[e];
90
+ if ((t.status === "created" || t.status === "updated") && c(t.newRecord, n)) return {
91
+ ...t.newRecord,
92
+ status: t.status
93
+ };
94
+ if (t.status === "deleted" && c(t.oldRecord, n)) return {
95
+ ...t.oldRecord,
96
+ status: "deleted"
97
+ };
98
+ }
99
+ }
100
+ function re(e) {
101
+ let { operation: t, tagName: n, id: r } = e;
102
+ if ((t.status === "created" || t.status === "updated") && t.newRecord.id === r) return ie(t.newRecord.tagName, n, r), {
103
+ ...t.newRecord,
104
+ status: t.status
105
+ };
106
+ if (t.status === "deleted" && t.oldRecord.id === r) return ie(t.oldRecord.tagName, n, r), {
107
+ ...t.oldRecord,
108
+ status: "deleted"
109
+ };
110
+ }
111
+ function ie(e, n, r) {
112
+ e !== n && t("ELEMENT_TAGNAME_MISMATCH", {
113
+ detail: `Expected tagName '${n}', got '${e}' for id '${r}'`,
114
+ ref: {
115
+ tagName: n,
116
+ id: r
117
+ }
118
+ });
119
+ }
120
+ function ae(e) {
129
121
  let { rawRecords: t, stagedOperations: n, tagName: r } = e, i = new Map(t.map((e) => [e.id, {
130
122
  ...e,
131
123
  status: "unchanged"
@@ -142,30 +134,38 @@ function ne(e) {
142
134
  }
143
135
  return Array.from(i.values());
144
136
  }
145
- function re(e) {
146
- let { rawRecords: t, stagedOperations: n, includeDeleted: r = !1 } = e, i = new Map(t.map((e) => [e.id, {
137
+ function E(e) {
138
+ let { rawRecords: t, stagedOperations: n, includeDeleted: r = !1 } = e, { log: i, byId: a } = n, o = new Map(t.map((e) => [e.id, {
147
139
  ...e,
148
140
  status: "unchanged"
149
- }])), a = [], o = /* @__PURE__ */ new Set();
150
- for (let e of n) {
141
+ }]));
142
+ for (let e of a.values()) {
151
143
  if (e.status === "created" || e.status === "updated") {
152
- e.status === "created" && o.add(e.newRecord.id), i.set(e.newRecord.id, {
144
+ o.set(e.newRecord.id, {
153
145
  ...e.newRecord,
154
146
  status: e.status
155
147
  });
156
148
  continue;
157
149
  }
158
- i.delete(e.oldRecord.id), r && !o.has(e.oldRecord.id) && a.push({
159
- ...e.oldRecord,
160
- status: "deleted"
161
- });
150
+ o.delete(e.oldRecord.id);
162
151
  }
152
+ if (!r) return {
153
+ live: o,
154
+ deleted: []
155
+ };
156
+ let s = /* @__PURE__ */ new Set();
157
+ for (let e of i) e.status === "created" && s.add(e.newRecord.id);
158
+ let c = [];
159
+ for (let e of i) e.status === "deleted" && !s.has(e.oldRecord.id) && c.push({
160
+ ...e.oldRecord,
161
+ status: "deleted"
162
+ });
163
163
  return {
164
- live: i,
165
- deleted: a
164
+ live: o,
165
+ deleted: c
166
166
  };
167
167
  }
168
- function ie(e) {
168
+ function D(e) {
169
169
  let t = /* @__PURE__ */ new Set();
170
170
  for (let n of e) n.status === "created" && t.add(n.newRecord.id);
171
171
  let n = /* @__PURE__ */ new Map();
@@ -183,59 +183,59 @@ function ie(e) {
183
183
  }
184
184
  return n;
185
185
  }
186
- async function E(e) {
187
- let { context: t, ref: n } = e;
188
- if (t.stagedOperations.length > 0) {
189
- let e = T({
190
- stagedOperations: t.stagedOperations,
191
- tagName: n.tagName,
192
- id: n.id
186
+ async function O(e) {
187
+ let { context: n, ref: r } = e;
188
+ if (n.stagedOperations.log.length > 0) {
189
+ let e = ne({
190
+ stagedOperations: n.stagedOperations,
191
+ tagName: r.tagName,
192
+ id: r.id
193
193
  });
194
194
  if (e?.status === "deleted") return;
195
195
  if (e) return e;
196
196
  }
197
- let r;
198
- if (n.id === void 0) {
199
- let e = `__singleton_${n.tagName}`, i = _t(t) ? t.recordCache.get(e) : void 0;
200
- i ? (t.perf.count("core::query::getRecord.cacheHit"), r = i) : (t.perf.count("core::query::getRecord.miss"), t.perf.count("core::store::getByTagName"), r = (await t.store.getByTagNameInDocument(n.tagName, t.documentId))[0], r && _t(t) && (t.recordCache.set(r.id, r), t.recordCache.set(e, r)));
197
+ let i;
198
+ if (r.id === void 0) {
199
+ let e = `__singleton_${r.tagName}`, t = St(n) ? n.recordCache.get(e) : void 0;
200
+ t ? (n.perf.count("core::query::getRecord.cacheHit"), i = t) : (n.perf.count("core::query::getRecord.miss"), n.perf.count("core::store::getByTagName"), i = (await n.store.getByTagNameInDocument(r.tagName, n.documentId))[0], i && St(n) && (n.recordCache.set(i.id, i), n.recordCache.set(e, i)));
201
201
  } else {
202
- let e = _t(t) ? t.recordCache.get(n.id) : void 0;
203
- e ? (t.perf.count("core::query::getRecord.cacheHit"), r = e) : (t.perf.count("core::query::getRecord.miss"), t.perf.count("core::store::get"), r = await t.store.get(n.id, t.documentId), r && _t(t) && t.recordCache.set(n.id, r));
202
+ let e = St(n) ? n.recordCache.get(r.id) : void 0;
203
+ e ? (n.perf.count("core::query::getRecord.cacheHit"), i = e) : (n.perf.count("core::query::getRecord.miss"), n.perf.count("core::store::get"), i = await n.store.get(r.id, n.documentId), i && St(n) && n.recordCache.set(r.id, i));
204
204
  }
205
- if (r) return r.tagName !== n.tagName && a("ELEMENT_TAGNAME_MISMATCH", {
206
- detail: `Expected tagName '${n.tagName}', got '${r.tagName}' for id '${n.id}'`,
207
- ref: n
205
+ if (i) return i.tagName !== r.tagName && t("ELEMENT_TAGNAME_MISMATCH", {
206
+ detail: `Expected tagName '${r.tagName}', got '${i.tagName}' for id '${r.id}'`,
207
+ ref: r
208
208
  }), {
209
- ...r,
209
+ ...i,
210
210
  status: "unchanged"
211
211
  };
212
212
  }
213
- async function D(e) {
213
+ async function k(e) {
214
214
  let { context: t, refs: n } = e;
215
- return Promise.all(n.map((e) => E({
215
+ return Promise.all(n.map((e) => O({
216
216
  context: t,
217
217
  ref: e
218
218
  })));
219
219
  }
220
- async function O(e) {
220
+ async function oe(e) {
221
221
  let { context: t, tagName: n } = e;
222
222
  t.perf.count("core::store::getByTagName");
223
223
  let r = await t.store.getByTagNameInDocument(n, t.documentId);
224
- for (let e of r) _t(t) && t.recordCache.set(e.id, e);
225
- return ne({
224
+ for (let e of r) St(t) && t.recordCache.set(e.id, e);
225
+ return ae({
226
226
  rawRecords: r,
227
- stagedOperations: t.stagedOperations,
227
+ stagedOperations: t.stagedOperations.log,
228
228
  tagName: n
229
229
  });
230
230
  }
231
- async function k(e) {
232
- let { context: t, ref: n, tagName: r } = e, i = await E({
231
+ async function A(e) {
232
+ let { context: t, ref: n, tagName: r } = e, i = await O({
233
233
  context: t,
234
234
  ref: n
235
235
  });
236
236
  if (!i) return;
237
237
  let a = i.children.find((e) => e.tagName === r);
238
- if (a) return E({
238
+ if (a) return O({
239
239
  context: t,
240
240
  ref: a
241
241
  });
@@ -243,20 +243,20 @@ async function k(e) {
243
243
  if (!o?.length) return;
244
244
  let s = i.children.filter((e) => o.includes(e.tagName));
245
245
  for (let e of s) {
246
- let n = await E({
246
+ let n = await O({
247
247
  context: t,
248
248
  ref: e
249
249
  });
250
250
  if (!n) continue;
251
251
  let i = n.children.find((e) => e.tagName === r);
252
- if (i) return E({
252
+ if (i) return O({
253
253
  context: t,
254
254
  ref: i
255
255
  });
256
256
  }
257
257
  }
258
- async function A(e) {
259
- let { context: t, ref: n, tagName: r } = e, i = await E({
258
+ async function j(e) {
259
+ let { context: t, ref: n, tagName: r } = e, i = await O({
260
260
  context: t,
261
261
  ref: n
262
262
  });
@@ -265,7 +265,7 @@ async function A(e) {
265
265
  tagName: r,
266
266
  id: e.id
267
267
  }));
268
- if (a.length) return (await D({
268
+ if (a.length) return (await k({
269
269
  context: t,
270
270
  refs: a
271
271
  })).filter((e) => e !== void 0);
@@ -273,25 +273,25 @@ async function A(e) {
273
273
  if (!o?.length) return [];
274
274
  let s = i.children.filter((e) => o.includes(e.tagName));
275
275
  if (!s.length) return [];
276
- let c = (await D({
276
+ let c = (await k({
277
277
  context: t,
278
278
  refs: s
279
279
  })).filter((e) => e !== void 0).flatMap((e) => e.children.filter((e) => e.tagName === r)).map((e) => ({
280
280
  tagName: r,
281
281
  id: e.id
282
282
  }));
283
- return c.length ? (await D({
283
+ return c.length ? (await k({
284
284
  context: t,
285
285
  refs: c
286
286
  })).filter((e) => e !== void 0) : [];
287
287
  }
288
- async function ae(e) {
289
- let { context: t, ref: n, options: r } = e, i = r?.depth ?? Infinity, a = r?.stopAtTagName, o = r?.order ?? "bottom-up", s = [], c = await E({
288
+ async function se(e) {
289
+ let { context: t, ref: n, options: r } = e, i = r?.depth ?? Infinity, a = r?.stopAtTagName, o = r?.order ?? "bottom-up", s = [], c = await O({
290
290
  context: t,
291
291
  ref: n
292
292
  });
293
293
  for (; c?.parent && s.length < i;) {
294
- let e = c.parent, n = await E({
294
+ let e = c.parent, n = await O({
295
295
  context: t,
296
296
  ref: e
297
297
  });
@@ -300,18 +300,18 @@ async function ae(e) {
300
300
  }
301
301
  return o === "top-down" ? s.reverse() : s;
302
302
  }
303
- async function j(e) {
304
- let { context: t, tagName: n, attributes: r } = e, i = await O({
303
+ async function M(e) {
304
+ let { context: t, tagName: n, attributes: r } = e, i = await oe({
305
305
  context: t,
306
306
  tagName: n
307
307
  }), a = [];
308
- for (let e of i) M({
308
+ for (let e of i) N({
309
309
  record: e,
310
310
  attributeFilter: r
311
311
  }) && a.push(e);
312
312
  return a;
313
313
  }
314
- function M(e) {
314
+ function N(e) {
315
315
  let { record: t, attributeFilter: n } = e;
316
316
  if (!n || Object.keys(n).length === 0) return !0;
317
317
  for (let [e, r] of Object.entries(n)) {
@@ -324,28 +324,28 @@ function M(e) {
324
324
  }
325
325
  return !0;
326
326
  }
327
- async function oe(e) {
328
- let { context: t, ref: n, options: r } = e, { collect: i, omit: a } = r, o = N(a), s = se(i), c = /* @__PURE__ */ new Map();
327
+ async function P(e) {
328
+ let { context: t, ref: n, options: r } = e, { collect: i, omit: a } = r, o = ce(a), s = ue(i), c = /* @__PURE__ */ new Map();
329
329
  for (let e of s.allTags) c.set(e, /* @__PURE__ */ new Map());
330
- let l = await E({
330
+ let l = await O({
331
331
  context: t,
332
332
  ref: n
333
333
  });
334
- return l && (s.mode === "flat" ? await ue({
334
+ return l && (s.mode === "flat" ? await fe({
335
335
  context: t,
336
336
  rootId: l.id,
337
337
  collectSpec: s,
338
338
  omitSpec: o,
339
339
  collected: c
340
- }) : await fe({
340
+ }) : await me({
341
341
  context: t,
342
342
  record: l,
343
343
  pathNodes: s.paths,
344
344
  omitSpec: o,
345
345
  collected: c
346
- })), me(c);
346
+ })), _e(c);
347
347
  }
348
- function N(e) {
348
+ function ce(e) {
349
349
  let t = /* @__PURE__ */ new Set(), n = [];
350
350
  if (!e) return {
351
351
  unconditional: t,
@@ -364,16 +364,16 @@ function N(e) {
364
364
  conditional: n
365
365
  };
366
366
  }
367
- function P(e) {
367
+ function le(e) {
368
368
  let { record: t, omitSpec: n } = e;
369
369
  if (n.unconditional.has(t.tagName)) return !0;
370
- for (let e of n.conditional) if (e.tagName === t.tagName && M({
370
+ for (let e of n.conditional) if (e.tagName === t.tagName && N({
371
371
  record: t,
372
372
  attributeFilter: e.where
373
373
  })) return !0;
374
374
  return !1;
375
375
  }
376
- function se(e) {
376
+ function ue(e) {
377
377
  if (typeof e == "string") return {
378
378
  mode: "flat",
379
379
  targets: [{ tagName: e }],
@@ -395,16 +395,16 @@ function se(e) {
395
395
  let t = /* @__PURE__ */ new Set();
396
396
  return {
397
397
  mode: "path",
398
- paths: ce(e, t),
398
+ paths: F(e, t),
399
399
  allTags: t
400
400
  };
401
401
  }
402
- function ce(e, t) {
402
+ function F(e, t) {
403
403
  let n = [];
404
404
  for (let [r, i] of Object.entries(e)) {
405
405
  if (r === "where") continue;
406
406
  t.add(r);
407
- let e = le({
407
+ let e = de({
408
408
  tagName: r,
409
409
  value: i,
410
410
  allTags: t
@@ -413,7 +413,7 @@ function ce(e, t) {
413
413
  }
414
414
  return n;
415
415
  }
416
- function le(e) {
416
+ function de(e) {
417
417
  let { tagName: t, value: n, allTags: r } = e;
418
418
  if (n === !0) return {
419
419
  tagName: t,
@@ -434,25 +434,25 @@ function le(e) {
434
434
  return {
435
435
  tagName: t,
436
436
  where: a,
437
- children: ce(s, r),
437
+ children: F(s, r),
438
438
  isLeaf: !1
439
439
  };
440
440
  }
441
- async function ue(e) {
441
+ async function fe(e) {
442
442
  let { context: t, rootId: n, collectSpec: r, omitSpec: i, collected: a } = e;
443
443
  for (let e of r.targets) {
444
444
  if (i.unconditional.has(e.tagName)) continue;
445
- let r = await O({
445
+ let r = await oe({
446
446
  context: t,
447
447
  tagName: e.tagName
448
448
  });
449
- for (let o of r) F({
449
+ for (let o of r) I({
450
450
  record: o,
451
451
  where: e.where
452
- }) && (P({
452
+ }) && (le({
453
453
  record: o,
454
454
  omitSpec: i
455
- }) || await de({
455
+ }) || await pe({
456
456
  context: t,
457
457
  record: o,
458
458
  rootId: n,
@@ -460,25 +460,25 @@ async function ue(e) {
460
460
  }) && a.get(e.tagName).set(o.id, o));
461
461
  }
462
462
  }
463
- function F(e) {
463
+ function I(e) {
464
464
  let { record: t, where: n } = e;
465
- return n ? M({
465
+ return n ? N({
466
466
  record: t,
467
467
  attributeFilter: n
468
468
  }) : !0;
469
469
  }
470
- async function de(e) {
470
+ async function pe(e) {
471
471
  let { context: t, record: n, rootId: r, omitSpec: i } = e;
472
472
  if (n.id === r) return !0;
473
473
  let a = n;
474
474
  for (; a;) {
475
475
  if (!a.parent || i.unconditional.has(a.parent.tagName)) return !1;
476
476
  if (a.parent.id === r) return !0;
477
- let e = await E({
477
+ let e = await O({
478
478
  context: t,
479
479
  ref: f(a.parent)
480
480
  });
481
- if (!e || P({
481
+ if (!e || le({
482
482
  record: e,
483
483
  omitSpec: i
484
484
  })) return !1;
@@ -486,12 +486,12 @@ async function de(e) {
486
486
  }
487
487
  return !1;
488
488
  }
489
- async function fe(e) {
489
+ async function me(e) {
490
490
  let { context: t, record: n, pathNodes: r, omitSpec: i, collected: a } = e;
491
491
  if (!n.children?.length) return;
492
492
  let o = new Set(r.map((e) => e.tagName));
493
493
  for (let e of r) {
494
- let r = await I({
494
+ let r = await he({
495
495
  context: t,
496
496
  record: n,
497
497
  tagName: e.tagName,
@@ -499,7 +499,7 @@ async function fe(e) {
499
499
  omitSpec: i,
500
500
  stopAtTagNames: o
501
501
  });
502
- for (let n of r) a.get(e.tagName).set(n.id, n), !e.isLeaf && e.children.length > 0 && await fe({
502
+ for (let n of r) a.get(e.tagName).set(n.id, n), !e.isLeaf && e.children.length > 0 && await me({
503
503
  context: t,
504
504
  record: n,
505
505
  pathNodes: e.children,
@@ -508,10 +508,10 @@ async function fe(e) {
508
508
  });
509
509
  }
510
510
  }
511
- async function I(e) {
511
+ async function he(e) {
512
512
  let { context: t, record: n, tagName: r, where: i, omitSpec: a, stopAtTagNames: o } = e, s = [];
513
513
  if (!n.children?.length) return s;
514
- let c = [], l = await pe({
514
+ let c = [], l = await ge({
515
515
  context: t,
516
516
  record: n,
517
517
  omitSpec: a
@@ -519,14 +519,14 @@ async function I(e) {
519
519
  for (c.push(...l); c.length > 0;) {
520
520
  let e = c.shift();
521
521
  if (e.tagName === r) {
522
- F({
522
+ I({
523
523
  record: e,
524
524
  where: i
525
525
  }) && s.push(e);
526
526
  continue;
527
527
  }
528
528
  if (!(o.has(e.tagName) && e.tagName !== r) && e.children?.length) {
529
- let n = await pe({
529
+ let n = await ge({
530
530
  context: t,
531
531
  record: e,
532
532
  omitSpec: a
@@ -536,28 +536,28 @@ async function I(e) {
536
536
  }
537
537
  return s;
538
538
  }
539
- async function pe(e) {
539
+ async function ge(e) {
540
540
  let { context: t, record: n, omitSpec: r } = e;
541
541
  if (!n.children?.length) return [];
542
542
  let i = n.children.filter((e) => !r.unconditional.has(e.tagName));
543
- return i.length ? (await Promise.all(i.map((e) => E({
543
+ return i.length ? (await Promise.all(i.map((e) => O({
544
544
  context: t,
545
545
  ref: f(e)
546
- })))).filter((e) => e !== void 0 && !P({
546
+ })))).filter((e) => e !== void 0 && !le({
547
547
  record: e,
548
548
  omitSpec: r
549
549
  })) : [];
550
550
  }
551
- function me(e) {
551
+ function _e(e) {
552
552
  let t = {};
553
553
  for (let [n, r] of e.entries()) t[n] = Array.from(r.values());
554
554
  return t;
555
555
  }
556
- async function he(e) {
557
- let { context: t, ref: r, name: i, namespace: a, defaults: o = "optional" } = e, s = await E({
556
+ async function ve(e) {
557
+ let { context: t, ref: r, name: i, namespace: a, defaults: o = "optional" } = e, s = await O({
558
558
  context: t,
559
559
  ref: r
560
- }), c = s?.attributes ?? [], l = _e(t.dialecteConfig, i, a), u = c.find((e) => e.name === l);
560
+ }), c = s?.attributes ?? [], l = be(t.dialecteConfig, i, a), u = c.find((e) => e.name === l);
561
561
  return u ? u.value : (s ? n({
562
562
  dialecteConfig: t.dialecteConfig,
563
563
  tagName: s.tagName,
@@ -565,11 +565,11 @@ async function he(e) {
565
565
  defaults: o
566
566
  }) : void 0) ?? "";
567
567
  }
568
- async function ge(e) {
569
- let { context: t, ref: r, name: a, namespace: o, defaults: s = "optional" } = e, { dialecteConfig: c } = t, l = await E({
570
- context: t,
571
- ref: r
572
- }), u = l?.attributes ?? [], d = _e(c, a, o), f = u.find((e) => e.name === d);
568
+ async function ye(t) {
569
+ let { context: r, ref: i, name: a, namespace: o, defaults: s = "optional" } = t, { dialecteConfig: c } = r, l = await O({
570
+ context: r,
571
+ ref: i
572
+ }), u = l?.attributes ?? [], d = be(c, a, o), f = u.find((e) => e.name === d);
573
573
  if (f) return f;
574
574
  if (!l || s === "none") return;
575
575
  let p = n({
@@ -579,7 +579,7 @@ async function ge(e) {
579
579
  defaults: s
580
580
  });
581
581
  if (p === void 0) return;
582
- let { namespace: m } = i({
582
+ let { namespace: m } = e({
583
583
  dialecteConfig: c,
584
584
  tagName: l.tagName,
585
585
  attributeName: d
@@ -590,23 +590,23 @@ async function ge(e) {
590
590
  namespace: m
591
591
  };
592
592
  }
593
- function _e(e, n, r) {
594
- if (r === void 0) return n;
595
- let i = t(e, r);
596
- return i ? `${i}:${n}` : n;
593
+ function be(e, t, n) {
594
+ if (n === void 0) return t;
595
+ let r = i(e, n);
596
+ return r ? `${r}:${t}` : t;
597
597
  }
598
- async function ve(e) {
599
- let { context: r, ref: i, namespace: a, defaults: o = "optional" } = e, { dialecteConfig: s } = r, c = await E({
600
- context: r,
601
- ref: i
602
- }), l = c?.attributes ?? [], u = a === void 0 ? "" : t(s, a), d = l.reduce((e, t) => {
603
- let { prefix: n, local: r, isXmlns: i } = be(t.name);
598
+ async function L(e) {
599
+ let { context: t, ref: r, namespace: a, defaults: o = "optional" } = e, { dialecteConfig: s } = t, c = await O({
600
+ context: t,
601
+ ref: r
602
+ }), l = c?.attributes ?? [], u = a === void 0 ? "" : i(s, a), d = l.reduce((e, t) => {
603
+ let { prefix: n, local: r, isXmlns: i } = Se(t.name);
604
604
  return i || n !== u || (e[r] = t.value ?? ""), e;
605
605
  }, {});
606
606
  if (c && o !== "none") {
607
607
  let e = s.definition[c.tagName]?.attributes.sequence ?? [];
608
608
  for (let t of e) {
609
- let { prefix: e, local: r, isXmlns: i } = be(t);
609
+ let { prefix: e, local: r, isXmlns: i } = Se(t);
610
610
  if (i || e !== u || r in d) continue;
611
611
  let a = n({
612
612
  dialecteConfig: s,
@@ -619,37 +619,37 @@ async function ve(e) {
619
619
  }
620
620
  return d;
621
621
  }
622
- async function ye(e) {
623
- let { context: t, ref: r, defaults: a = "optional" } = e, { dialecteConfig: o } = t, s = await E({
624
- context: t,
625
- ref: r
622
+ async function xe(t) {
623
+ let { context: r, ref: i, defaults: a = "optional" } = t, { dialecteConfig: o } = r, s = await O({
624
+ context: r,
625
+ ref: i
626
626
  }), c = [...s?.attributes ?? []];
627
627
  if (s && a !== "none") {
628
- let e = new Set(c.map((e) => e.name)), t = o.definition[s.tagName]?.attributes.sequence ?? [];
629
- for (let r of t) {
630
- if (e.has(r)) continue;
631
- let t = n({
628
+ let t = new Set(c.map((e) => e.name)), r = o.definition[s.tagName]?.attributes.sequence ?? [];
629
+ for (let i of r) {
630
+ if (t.has(i)) continue;
631
+ let r = n({
632
632
  dialecteConfig: o,
633
633
  tagName: s.tagName,
634
- attributeName: r,
634
+ attributeName: i,
635
635
  defaults: a
636
636
  });
637
- if (t === void 0) continue;
638
- let { namespace: l } = i({
637
+ if (r === void 0) continue;
638
+ let { namespace: l } = e({
639
639
  dialecteConfig: o,
640
640
  tagName: s.tagName,
641
- attributeName: r
641
+ attributeName: i
642
642
  });
643
643
  c.push({
644
- name: r,
645
- value: t,
644
+ name: i,
645
+ value: r,
646
646
  namespace: l
647
647
  });
648
648
  }
649
649
  }
650
650
  return c;
651
651
  }
652
- function be(e) {
652
+ function Se(e) {
653
653
  if (e === "xmlns" || e.startsWith("xmlns:")) return {
654
654
  prefix: "",
655
655
  local: e,
@@ -666,7 +666,7 @@ function be(e) {
666
666
  isXmlns: !1
667
667
  };
668
668
  }
669
- function L(e) {
669
+ function Ce(e) {
670
670
  let { tree: t, unwrapTagNames: n } = e;
671
671
  function r(e) {
672
672
  return e.flatMap((e) => n.includes(e.tagName) ? r(e.tree) : [{
@@ -679,7 +679,7 @@ function L(e) {
679
679
  tree: r(t.tree)
680
680
  };
681
681
  }
682
- function xe(e) {
682
+ function we(e) {
683
683
  let t = /* @__PURE__ */ new Set(), n = [];
684
684
  if (!e) return {
685
685
  unconditional: t,
@@ -706,32 +706,32 @@ function xe(e) {
706
706
  conditional: n
707
707
  };
708
708
  }
709
- function Se(e) {
709
+ function Te(e) {
710
710
  let { record: t, compiledOmit: n } = e;
711
- return n.unconditional.has(t.tagName) ? !0 : n.conditional.some((e) => e.scope === "self" && e.tagName === t.tagName && M({
711
+ return n.unconditional.has(t.tagName) ? !0 : n.conditional.some((e) => e.scope === "self" && e.tagName === t.tagName && N({
712
712
  record: t,
713
713
  attributeFilter: e.where
714
714
  }));
715
715
  }
716
- function Ce(e) {
716
+ function Ee(e) {
717
717
  let { record: t, compiledOmit: n } = e;
718
- return n.conditional.some((e) => e.scope === "children" && e.tagName === t.tagName && M({
718
+ return n.conditional.some((e) => e.scope === "children" && e.tagName === t.tagName && N({
719
719
  record: t,
720
720
  attributeFilter: e.where
721
721
  }));
722
722
  }
723
- function we(e) {
723
+ function De(e) {
724
724
  let { tree: t, omit: n } = e;
725
725
  if (!n?.length) return t;
726
- let r = xe(n), i = (e) => {
727
- if (Ce({
726
+ let r = we(n), i = (e) => {
727
+ if (Ee({
728
728
  record: e,
729
729
  compiledOmit: r
730
730
  })) return {
731
731
  ...e,
732
732
  tree: []
733
733
  };
734
- let t = e.tree.filter((e) => !Se({
734
+ let t = e.tree.filter((e) => !Te({
735
735
  record: e,
736
736
  compiledOmit: r
737
737
  })).map((e) => i(e));
@@ -742,7 +742,7 @@ function we(e) {
742
742
  };
743
743
  return i(t);
744
744
  }
745
- function Te(e) {
745
+ function Oe(e) {
746
746
  let { tree: t, childrenConfig: n } = e, i = (e) => {
747
747
  if (e.tree.length === 0) return e;
748
748
  let t = r({
@@ -757,78 +757,111 @@ function Te(e) {
757
757
  };
758
758
  return i(t);
759
759
  }
760
- async function Ee(e) {
761
- let { context: t, ref: n, options: r = {}, dialecteConfig: i } = e, { select: a, omit: s, unwrap: c } = r, l = await E({
762
- context: t,
763
- ref: n
764
- });
765
- o(l, {
760
+ async function ke(e) {
761
+ let { context: t, ref: n, options: r = {}, dialecteConfig: i } = e, { select: o, omit: s, unwrap: c, depth: l } = r, u = l !== void 0 && n.id !== void 0 && t.stagedOperations.log.length === 0 ? await je(t, n, l) : await Ae(t), d = Me(u, n);
762
+ a(d, {
766
763
  detail: "No record found for provided ref",
767
764
  key: "ELEMENT_NOT_FOUND"
768
765
  });
769
- let u = xe(s), d = t.dialecteConfig.transparentElements, f = await De({
770
- context: t,
771
- record: l,
772
- select: a,
773
- compiledOmit: u,
766
+ let f = we(s), m = t.dialecteConfig.transparentElements, h = R({
767
+ recordsById: u,
768
+ record: d,
769
+ select: o,
770
+ compiledOmit: f,
774
771
  dialecteConfig: i,
775
- transparentElements: d
772
+ transparentElements: m,
773
+ remainingDepth: l ?? Infinity
776
774
  });
777
- if (!f) return p({ record: l });
778
- let m = c ?? (d?.length ? d : void 0);
779
- return Te({
780
- tree: m ? L({
781
- tree: f,
782
- unwrapTagNames: m
783
- }) : f,
775
+ if (!h) return p({ record: d });
776
+ let g = c ?? (m?.length ? m : void 0);
777
+ return Oe({
778
+ tree: g ? Ce({
779
+ tree: h,
780
+ unwrapTagNames: g
781
+ }) : h,
784
782
  childrenConfig: t.dialecteConfig.children
785
783
  });
786
784
  }
787
- async function De(e) {
788
- let { context: t, record: n, select: r, compiledOmit: i, dialecteConfig: a, transparentElements: o } = e;
789
- if (Ce({
785
+ async function Ae(e) {
786
+ e.perf.count("core::store::getByDocumentId");
787
+ let { live: t } = E({
788
+ rawRecords: await e.store.getByDocumentId(e.documentId),
789
+ stagedOperations: e.stagedOperations
790
+ });
791
+ return t;
792
+ }
793
+ async function je(e, t, n) {
794
+ let r = /* @__PURE__ */ new Map();
795
+ if (t.id === void 0) return r;
796
+ e.perf.count("core::store::get");
797
+ let i = await e.store.get(t.id, e.documentId);
798
+ if (!i) return r;
799
+ let a = [i];
800
+ r.set(i.id, {
801
+ ...i,
802
+ status: "unchanged"
803
+ });
804
+ for (let t = 0; t < n && a.length > 0; t++) {
805
+ let t = a.flatMap((e) => e.children.map((e) => e.id));
806
+ if (t.length === 0) break;
807
+ e.perf.count("core::store::getMany");
808
+ let n = await e.store.getMany(t, e.documentId), i = [];
809
+ for (let e of n) e && (r.set(e.id, {
810
+ ...e,
811
+ status: "unchanged"
812
+ }), i.push(e));
813
+ a = i;
814
+ }
815
+ return r;
816
+ }
817
+ function Me(e, t) {
818
+ if (t.id !== void 0) {
819
+ let n = e.get(t.id);
820
+ return n?.tagName === t.tagName ? n : void 0;
821
+ }
822
+ for (let n of e.values()) if (n.tagName === t.tagName) return n;
823
+ }
824
+ function R(e) {
825
+ let { recordsById: t, record: n, select: r, compiledOmit: i, dialecteConfig: a, transparentElements: o } = e;
826
+ return e.remainingDepth <= 0 || Ee({
790
827
  record: n,
791
828
  compiledOmit: i
792
- })) return p({ record: n });
793
- let s = await Oe({
794
- context: t,
795
- record: n,
796
- select: r,
797
- compiledOmit: i,
798
- dialecteConfig: a,
799
- transparentElements: o
800
- });
801
- return p({
829
+ }) ? p({ record: n }) : p({
802
830
  record: n,
803
- tree: (await Promise.all(s.map(({ record: e, select: n }) => De({
804
- context: t,
805
- record: e,
806
- select: n,
831
+ tree: Ne({
832
+ recordsById: t,
833
+ record: n,
834
+ select: r,
807
835
  compiledOmit: i,
808
836
  dialecteConfig: a,
809
837
  transparentElements: o
810
- })))).filter((e) => e !== null)
838
+ }).map(({ record: n, select: r }) => R({
839
+ recordsById: t,
840
+ record: n,
841
+ select: r,
842
+ compiledOmit: i,
843
+ dialecteConfig: a,
844
+ transparentElements: o,
845
+ remainingDepth: e.remainingDepth - 1
846
+ })).filter((e) => e !== null)
811
847
  });
812
848
  }
813
- async function Oe(e) {
814
- let { context: t, record: n, select: r, compiledOmit: i, dialecteConfig: a, transparentElements: o } = e;
849
+ function Ne(e) {
850
+ let { recordsById: t, record: n, select: r, compiledOmit: i, dialecteConfig: a, transparentElements: o } = e;
815
851
  if (!n.children?.length) return [];
816
- let s = r ? je(r) : void 0;
852
+ let s = r ? z(r) : void 0;
817
853
  if (s && r && a && r.recursive !== !1) {
818
854
  let e = n.tagName, t = a.children[e], i = r[e] !== void 0;
819
855
  t?.includes(e) && !i && s.add(e);
820
856
  }
821
- let c = n.children.filter((e) => ke({
857
+ let c = n.children.filter((e) => Pe({
822
858
  tagName: e.tagName,
823
859
  compiledOmit: i,
824
860
  selectKeys: s,
825
861
  transparentElements: o
826
862
  }));
827
- return c.length ? Me({
828
- children: (await Promise.all(c.map((e) => E({
829
- context: t,
830
- ref: f(e)
831
- })))).filter((e) => e !== void 0).filter((e) => !Se({
863
+ return c.length ? Ie({
864
+ children: c.map((e) => t.get(e.id)).filter((e) => e !== void 0).filter((e) => !Te({
832
865
  record: e,
833
866
  compiledOmit: i
834
867
  })),
@@ -838,17 +871,17 @@ async function Oe(e) {
838
871
  transparentElements: o
839
872
  }) : [];
840
873
  }
841
- function ke(e) {
874
+ function Pe(e) {
842
875
  let { tagName: t, compiledOmit: n, selectKeys: r, transparentElements: i } = e;
843
876
  return n.unconditional.has(t) ? !1 : r && !r.has(t) ? !!i?.includes(t) : !0;
844
877
  }
845
- var Ae = /* @__PURE__ */ new Set(["where", "recursive"]);
846
- function je(e) {
878
+ var Fe = /* @__PURE__ */ new Set(["where", "recursive"]);
879
+ function z(e) {
847
880
  let t = /* @__PURE__ */ new Set();
848
- for (let n of Object.keys(e)) Ae.has(n) || t.add(n);
881
+ for (let n of Object.keys(e)) Fe.has(n) || t.add(n);
849
882
  return t;
850
883
  }
851
- function Me(e) {
884
+ function Ie(e) {
852
885
  let { children: t, select: n, record: r, dialecteConfig: i, transparentElements: a } = e;
853
886
  if (!n) return t.map((e) => ({
854
887
  record: e,
@@ -865,7 +898,7 @@ function Me(e) {
865
898
  continue;
866
899
  }
867
900
  if (t === void 0 && e.tagName === r.tagName) {
868
- let t = R({
901
+ let t = Le({
869
902
  child: e,
870
903
  select: n,
871
904
  dialecteConfig: i
@@ -883,7 +916,7 @@ function Me(e) {
883
916
  });
884
917
  continue;
885
918
  }
886
- let s = Ne({
919
+ let s = Re({
887
920
  child: e,
888
921
  entry: t,
889
922
  parentRecord: r
@@ -892,9 +925,9 @@ function Me(e) {
892
925
  }
893
926
  return o;
894
927
  }
895
- function R(e) {
928
+ function Le(e) {
896
929
  let { child: t, select: n, dialecteConfig: r } = e;
897
- if (!(!r || n.recursive === !1) && r.children[t.tagName]?.includes(t.tagName) && !(n.where && !M({
930
+ if (!(!r || n.recursive === !1) && r.children[t.tagName]?.includes(t.tagName) && !(n.where && !N({
898
931
  record: t,
899
932
  attributeFilter: n.where
900
933
  }))) return {
@@ -902,9 +935,9 @@ function R(e) {
902
935
  select: n
903
936
  };
904
937
  }
905
- function Ne(e) {
938
+ function Re(e) {
906
939
  let { child: t, entry: n, parentRecord: r } = e, i = n;
907
- if (!(i.where && !M({
940
+ if (!(i.where && !N({
908
941
  record: t,
909
942
  attributeFilter: i.where
910
943
  }))) {
@@ -920,7 +953,7 @@ function Ne(e) {
920
953
  }
921
954
  return i.recursive ? {
922
955
  record: t,
923
- select: Pe(i, t.tagName)
956
+ select: ze(i, t.tagName)
924
957
  } : t.tagName === r.tagName ? {
925
958
  record: t,
926
959
  select: {
@@ -933,30 +966,30 @@ function Ne(e) {
933
966
  };
934
967
  }
935
968
  }
936
- function Pe(e, t) {
969
+ function ze(e, t) {
937
970
  return e[t], e;
938
971
  }
939
- async function Fe(e) {
940
- let { context: t, ref: n, ancestors: r = 0, depth: i, includeDeleted: a = !1 } = e;
941
- if (!n && i === void 0) return z({
972
+ async function Be(e) {
973
+ let { context: t, ref: n, ancestors: r = 0, depth: i, includeDeleted: o = !1 } = e;
974
+ if (!n && i === void 0) return Ve({
942
975
  context: t,
943
- includeDeleted: a
976
+ includeDeleted: o
944
977
  });
945
- let s = e.siblings ?? !1, c = s === !0 || typeof s == "object" && !!s, l = typeof s == "object" && !!s && s.expand === !0, u = n ?? { tagName: t.dialecteConfig.rootElementName }, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = a ? ie(t.stagedOperations) : void 0, h = (e) => {
978
+ let s = e.siblings ?? !1, c = s === !0 || typeof s == "object" && !!s, l = typeof s == "object" && !!s && s.expand === !0, u = n ?? { tagName: t.dialecteConfig.rootElementName }, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = o ? D(t.stagedOperations.log) : void 0, h = (e) => {
946
979
  if (m) for (let t of m.get(e) ?? []) p.has(t.id) || (p.set(t.id, t), h(t.id));
947
980
  }, g = async (e, n) => {
948
981
  if (d.set(e.id, e), h(e.id), !(i !== void 0 && n >= i)) for (let r of e.children) {
949
- let e = await E({
982
+ let e = await O({
950
983
  context: t,
951
984
  ref: f(r)
952
985
  });
953
986
  e && await g(e, n + 1);
954
987
  }
955
- }, _ = await E({
988
+ }, _ = await O({
956
989
  context: t,
957
990
  ref: u
958
991
  });
959
- o(_, {
992
+ a(_, {
960
993
  key: "ELEMENT_NOT_FOUND",
961
994
  detail: "No record found for the provided ref"
962
995
  });
@@ -964,7 +997,7 @@ async function Fe(e) {
964
997
  await g(_, 0);
965
998
  let y = Math.max(r, +!!c);
966
999
  if (y > 0) {
967
- let e = await ae({
1000
+ let e = await se({
968
1001
  context: t,
969
1002
  ref: u,
970
1003
  options: {
@@ -979,7 +1012,7 @@ async function Fe(e) {
979
1012
  let r = n[e], i = n[e + 1];
980
1013
  for (let e of i.children) {
981
1014
  if (e.id === r.id) continue;
982
- let n = await E({
1015
+ let n = await O({
983
1016
  context: t,
984
1017
  ref: f(e)
985
1018
  });
@@ -988,32 +1021,32 @@ async function Fe(e) {
988
1021
  }
989
1022
  }
990
1023
  }
991
- return Ie({
1024
+ return He({
992
1025
  live: d,
993
1026
  deletedById: p,
994
1027
  rootId: v
995
1028
  });
996
1029
  }
997
- async function z(e) {
998
- let { context: t, includeDeleted: n = !1 } = e, { live: r, deleted: i } = re({
1030
+ async function Ve(e) {
1031
+ let { context: t, includeDeleted: n = !1 } = e, { live: r, deleted: i } = E({
999
1032
  rawRecords: await t.store.getByDocumentId(t.documentId),
1000
1033
  stagedOperations: t.stagedOperations,
1001
1034
  includeDeleted: n
1002
- }), a;
1035
+ }), o;
1003
1036
  for (let e of r.values()) if (e.tagName === t.dialecteConfig.rootElementName) {
1004
- a = e.id;
1037
+ o = e.id;
1005
1038
  break;
1006
1039
  }
1007
- return o(a, {
1040
+ return a(o, {
1008
1041
  key: "ROOT_NOT_FOUND",
1009
1042
  detail: `No ${t.dialecteConfig.rootElementName} root element found in document`
1010
- }), Ie({
1043
+ }), He({
1011
1044
  live: r,
1012
1045
  deletedById: new Map(i.map((e) => [e.id, e])),
1013
- rootId: a
1046
+ rootId: o
1014
1047
  });
1015
1048
  }
1016
- function Ie(e) {
1049
+ function He(e) {
1017
1050
  let { live: t, deletedById: n, rootId: r } = e, i = new Set(t.keys()), a = Array.from(t.values()).map((e) => ({
1018
1051
  ...e,
1019
1052
  children: e.children.filter((e) => i.has(e.id))
@@ -1027,8 +1060,8 @@ function Ie(e) {
1027
1060
  rootId: r
1028
1061
  };
1029
1062
  }
1030
- function Le(e) {
1031
- let { liveRecords: t, deletedRecords: n, rootId: r } = e, i = new Map(t.map((e) => [e.id, e])), a = new Map(n.map((e) => [e.id, e])), s = /* @__PURE__ */ new Map();
1063
+ function Ue(e) {
1064
+ let { liveRecords: t, deletedRecords: n, rootId: r } = e, i = new Map(t.map((e) => [e.id, e])), o = new Map(n.map((e) => [e.id, e])), s = /* @__PURE__ */ new Map();
1032
1065
  for (let e of n) {
1033
1066
  let t = e.parent?.id;
1034
1067
  if (!t) continue;
@@ -1036,20 +1069,20 @@ function Le(e) {
1036
1069
  n.push(e), s.set(t, n);
1037
1070
  }
1038
1071
  let c = i.get(r);
1039
- o(c, {
1072
+ a(c, {
1040
1073
  key: "ROOT_NOT_FOUND",
1041
1074
  detail: `No record found for rootId "${r}"`
1042
1075
  });
1043
1076
  let l = (e, t) => {
1044
- let n = t === "live" ? i : a, r = e.children.filter((e) => n.has(e.id)).map((e) => l(n.get(e.id), t)), o = t === "live" ? (s.get(e.id) ?? []).map((e) => l(e, "deleted")) : [];
1077
+ let n = t === "live" ? i : o, r = e.children.filter((e) => n.has(e.id)).map((e) => l(n.get(e.id), t)), a = t === "live" ? (s.get(e.id) ?? []).map((e) => l(e, "deleted")) : [];
1045
1078
  return p({
1046
1079
  record: e,
1047
- tree: [...r, ...o]
1080
+ tree: [...r, ...a]
1048
1081
  });
1049
1082
  };
1050
1083
  return l(c, "live");
1051
1084
  }
1052
- var Re = /* @__PURE__ */ b(((e, t) => {
1085
+ var We = /* @__PURE__ */ b(((e, t) => {
1053
1086
  Object.defineProperty(e, "__esModule", { value: !0 }), e.ParsingError = void 0;
1054
1087
  var n = class extends Error {
1055
1088
  constructor(e, t) {
@@ -1213,12 +1246,12 @@ var Re = /* @__PURE__ */ b(((e, t) => {
1213
1246
  }, o();
1214
1247
  }
1215
1248
  t !== void 0 && typeof e == "object" && (t.exports = v), e.default = v;
1216
- })), ze = /* @__PURE__ */ b(((e, t) => {
1249
+ })), Ge = /* @__PURE__ */ b(((e, t) => {
1217
1250
  var n = e && e.__importDefault || function(e) {
1218
1251
  return e && e.__esModule ? e : { default: e };
1219
1252
  };
1220
1253
  Object.defineProperty(e, "__esModule", { value: !0 });
1221
- var r = n(Re());
1254
+ var r = n(We());
1222
1255
  function i(e) {
1223
1256
  if (!e.options.indentation && !e.options.lineSeparator) return;
1224
1257
  e.content += e.options.lineSeparator;
@@ -1307,42 +1340,42 @@ var Re = /* @__PURE__ */ b(((e, t) => {
1307
1340
  indentation: "",
1308
1341
  lineSeparator: ""
1309
1342
  })), t !== void 0 && typeof e == "object" && (t.exports = p), e.default = p;
1310
- })), Be = /* @__PURE__ */ S(ze(), 1);
1311
- function Ve(e) {
1312
- return (0, Be.default)(e);
1343
+ })), Ke = /* @__PURE__ */ S(Ge(), 1);
1344
+ function B(e) {
1345
+ return (0, Ke.default)(e);
1313
1346
  }
1314
- var He = "_temp-idb-id";
1315
- function Ue(e, t = {}) {
1347
+ var V = "_temp-idb-id";
1348
+ function qe(e, t = {}) {
1316
1349
  let { includeXmlDeclaration: n = !0 } = t, r = new XMLSerializer().serializeToString(e);
1317
- return Ve(n ? "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + r : r);
1350
+ return B(n ? "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + r : r);
1318
1351
  }
1319
- function We(e) {
1320
- let { records: t, config: n, withDatabaseIds: r = !1, rootId: i, declareNamespaces: a = !0 } = e, s = /* @__PURE__ */ new Map(), c;
1352
+ function Je(e) {
1353
+ let { records: t, config: n, withDatabaseIds: r = !1, rootId: i, declareNamespaces: o = !0 } = e, s = /* @__PURE__ */ new Map(), c;
1321
1354
  for (let e of t) s.set(e.id, e), e.tagName === n.rootElementName && (c = e);
1322
1355
  let l = i ? s.get(i) : c;
1323
- o(l, {
1356
+ a(l, {
1324
1357
  detail: i ? `No record found for rootId "${i}"` : `No ${n.rootElementName} root element found in records`,
1325
1358
  key: "EXPORT_ROOT_NOT_FOUND"
1326
1359
  });
1327
- let u = l.tagName !== n.rootElementName, d = n.namespaces.default, f = document.implementation.createDocument(d.uri, null, null), p = Ke({
1360
+ let u = l.tagName !== n.rootElementName, d = n.namespaces.default, f = document.implementation.createDocument(d.uri, null, null), p = Xe({
1328
1361
  document: f,
1329
1362
  record: l,
1330
1363
  defaultNamespace: d,
1331
- declareNamespaces: a
1364
+ declareNamespaces: o
1332
1365
  });
1333
- return a && p.setAttribute("xmlns", l.namespace.uri), l.attributes && V({
1366
+ return o && p.setAttribute("xmlns", l.namespace.uri), l.attributes && H({
1334
1367
  config: n,
1335
1368
  document: f,
1336
1369
  element: p,
1337
1370
  attributes: l.attributes,
1338
1371
  isRoot: !0,
1339
1372
  isFragment: u,
1340
- declareNamespaces: a
1341
- }), u || Je({
1373
+ declareNamespaces: o
1374
+ }), u || $e({
1342
1375
  config: n,
1343
1376
  rootElement: p,
1344
1377
  namespace: l.namespace
1345
- }), l.value && (p.textContent = l.value.trim()), r && p.setAttribute("_temp-idb-id", l.id), f.appendChild(p), Ge({
1378
+ }), l.value && (p.textContent = l.value.trim()), r && p.setAttribute("_temp-idb-id", l.id), f.appendChild(p), Ye({
1346
1379
  index: s,
1347
1380
  config: n,
1348
1381
  withDatabaseIds: r,
@@ -1350,16 +1383,16 @@ function We(e) {
1350
1383
  parentRecord: l,
1351
1384
  parentElement: p,
1352
1385
  isFragment: u,
1353
- declareNamespaces: a
1386
+ declareNamespaces: o
1354
1387
  }), f;
1355
1388
  }
1356
- function Ge(e) {
1357
- let { index: t, config: n, withDatabaseIds: i, xmlDocument: a, parentRecord: s, parentElement: c, isFragment: l, declareNamespaces: u } = e;
1389
+ function Ye(e) {
1390
+ let { index: t, config: n, withDatabaseIds: i, xmlDocument: o, parentRecord: s, parentElement: c, isFragment: l, declareNamespaces: u } = e;
1358
1391
  if (!s.children || s.children.length === 0) return;
1359
1392
  let d = [];
1360
1393
  for (let e of s.children) {
1361
1394
  let n = t.get(e.id);
1362
- o(n, {
1395
+ a(n, {
1363
1396
  detail: `Parent '${s.tagName}' references non-existent child '${e.tagName}' (id: ${e.id})`,
1364
1397
  key: "EXPORT_ORPHAN_CHILD_REF",
1365
1398
  ref: {
@@ -1374,20 +1407,20 @@ function Ge(e) {
1374
1407
  childrenConfig: n.children
1375
1408
  });
1376
1409
  for (let e of f) {
1377
- let r = B({
1410
+ let r = Ze({
1378
1411
  config: n,
1379
- document: a,
1412
+ document: o,
1380
1413
  record: e,
1381
1414
  defaultNamespace: n.namespaces.default,
1382
1415
  withDatabaseIds: i,
1383
1416
  isFragment: l,
1384
1417
  declareNamespaces: u
1385
1418
  });
1386
- c.appendChild(r), Ge({
1419
+ c.appendChild(r), Ye({
1387
1420
  index: t,
1388
1421
  config: n,
1389
1422
  withDatabaseIds: i,
1390
- xmlDocument: a,
1423
+ xmlDocument: o,
1391
1424
  parentRecord: e,
1392
1425
  parentElement: r,
1393
1426
  isFragment: l,
@@ -1395,23 +1428,23 @@ function Ge(e) {
1395
1428
  });
1396
1429
  }
1397
1430
  }
1398
- function Ke(e) {
1431
+ function Xe(e) {
1399
1432
  let { document: t, record: n, defaultNamespace: r, declareNamespaces: i } = e, a = n.namespace.uri !== r.uri && n.namespace.prefix && n.namespace.prefix !== "xmlns" ? `${n.namespace.prefix}:${n.tagName}` : n.tagName;
1400
1433
  return i ? t.createElementNS(n.namespace.uri, a) : t.createElement(a);
1401
1434
  }
1402
- function B(e) {
1403
- let { config: t, document: n, record: r, defaultNamespace: i, withDatabaseIds: a, isFragment: o, declareNamespaces: s } = e, c = r.namespace.uri === i.uri, l = Ke({
1435
+ function Ze(e) {
1436
+ let { config: t, document: n, record: r, defaultNamespace: i, withDatabaseIds: a, isFragment: o, declareNamespaces: s } = e, c = r.namespace.uri === i.uri, l = Xe({
1404
1437
  document: n,
1405
1438
  record: r,
1406
1439
  defaultNamespace: i,
1407
1440
  declareNamespaces: s
1408
1441
  });
1409
- return s && !c && r.namespace.prefix && r.namespace.prefix !== "xmlns" && qe({
1442
+ return s && !c && r.namespace.prefix && r.namespace.prefix !== "xmlns" && Qe({
1410
1443
  config: t,
1411
1444
  document: n,
1412
1445
  namespace: r.namespace,
1413
1446
  isFragment: o
1414
- }), r.attributes && V({
1447
+ }), r.attributes && H({
1415
1448
  config: t,
1416
1449
  document: n,
1417
1450
  element: l,
@@ -1419,7 +1452,7 @@ function B(e) {
1419
1452
  isRoot: !1,
1420
1453
  isFragment: o,
1421
1454
  declareNamespaces: s
1422
- }), Ye({
1455
+ }), et({
1423
1456
  config: t,
1424
1457
  document: n,
1425
1458
  element: l,
@@ -1428,85 +1461,85 @@ function B(e) {
1428
1461
  declareNamespaces: s
1429
1462
  }), r.value && (l.textContent = r.value.trim()), a && l.setAttribute("_temp-idb-id", r.id), l;
1430
1463
  }
1431
- function V(t) {
1432
- let { config: n, document: r, element: i, attributes: a, isRoot: o, isFragment: s, declareNamespaces: c } = t;
1433
- for (let t of a) {
1434
- if (Ze(t)) continue;
1435
- if (!Xe(t) || !t.namespace.prefix) {
1436
- i.setAttribute(t.name, String(t.value));
1464
+ function H(e) {
1465
+ let { config: t, document: n, element: r, attributes: i, isRoot: a, isFragment: s, declareNamespaces: c } = e;
1466
+ for (let e of i) {
1467
+ if (nt(e)) continue;
1468
+ if (!tt(e) || !e.namespace.prefix) {
1469
+ r.setAttribute(e.name, String(e.value));
1437
1470
  continue;
1438
1471
  }
1439
- let a = e(t.name);
1472
+ let i = o(e.name);
1440
1473
  if (!c) {
1441
- i.setAttribute(`${t.namespace.prefix}:${a}`, String(t.value));
1474
+ r.setAttribute(`${e.namespace.prefix}:${i}`, String(e.value));
1442
1475
  continue;
1443
1476
  }
1444
- o || qe({
1445
- config: n,
1446
- document: r,
1447
- namespace: t.namespace,
1477
+ a || Qe({
1478
+ config: t,
1479
+ document: n,
1480
+ namespace: e.namespace,
1448
1481
  isFragment: s
1449
- }), i.setAttributeNS(t.namespace.uri, `${t.namespace.prefix}:${a}`, String(t.value));
1482
+ }), r.setAttributeNS(e.namespace.uri, `${e.namespace.prefix}:${i}`, String(e.value));
1450
1483
  }
1451
1484
  }
1452
- function qe(e) {
1485
+ function Qe(e) {
1453
1486
  let { config: t, document: n, namespace: r, isFragment: i } = e, a = n.documentElement;
1454
1487
  if (!a || !r.prefix || r.prefix === "xmlns") return;
1455
1488
  let o = "http://www.w3.org/2000/xmlns/";
1456
- a.getAttributeNS(o, r.prefix) === null && (a.setAttributeNS(o, `xmlns:${r.prefix}`, r.uri), i || Je({
1489
+ a.getAttributeNS(o, r.prefix) === null && (a.setAttributeNS(o, `xmlns:${r.prefix}`, r.uri), i || $e({
1457
1490
  config: t,
1458
1491
  rootElement: a,
1459
1492
  namespace: r
1460
1493
  }));
1461
1494
  }
1462
- function Je(t) {
1463
- let { config: r, rootElement: i, namespace: a } = t, o = Object.entries(r.definition[r.rootElementName].attributes.details).filter(([e, t]) => n({
1464
- dialecteConfig: r,
1465
- tagName: r.rootElementName,
1495
+ function $e(e) {
1496
+ let { config: t, rootElement: r, namespace: i } = e, a = Object.entries(t.definition[t.rootElementName].attributes.details).filter(([e, r]) => n({
1497
+ dialecteConfig: t,
1498
+ tagName: t.rootElementName,
1466
1499
  attributeName: e,
1467
1500
  defaults: "required"
1468
- }) === void 0 ? !1 : a.uri === r.namespaces.default.uri ? !t.namespace : t.namespace?.prefix === a.prefix && t.namespace?.uri === a.uri);
1469
- if (o.length > 0) for (let [t, a] of o) {
1470
- let o = e(t), s = n({
1471
- dialecteConfig: r,
1472
- tagName: r.rootElementName,
1473
- attributeName: t,
1501
+ }) === void 0 ? !1 : i.uri === t.namespaces.default.uri ? !r.namespace : r.namespace?.prefix === i.prefix && r.namespace?.uri === i.uri);
1502
+ if (a.length > 0) for (let [e, i] of a) {
1503
+ let a = o(e), s = n({
1504
+ dialecteConfig: t,
1505
+ tagName: t.rootElementName,
1506
+ attributeName: e,
1474
1507
  defaults: "required"
1475
1508
  }) ?? "";
1476
- if (!(a.namespace ? i.hasAttributeNS(a.namespace.uri, o) : i.hasAttribute(o))) if (a.namespace) {
1477
- let e = `${a.namespace.prefix}:${o}`;
1478
- i.setAttributeNS(a.namespace.uri, e, s);
1479
- } else i.setAttribute(o, s);
1509
+ if (!(i.namespace ? r.hasAttributeNS(i.namespace.uri, a) : r.hasAttribute(a))) if (i.namespace) {
1510
+ let e = `${i.namespace.prefix}:${a}`;
1511
+ r.setAttributeNS(i.namespace.uri, e, s);
1512
+ } else r.setAttribute(a, s);
1480
1513
  }
1481
1514
  }
1482
- function Ye(t) {
1483
- let { config: r, document: i, element: a, tagName: o, isFragment: s, declareNamespaces: c } = t;
1515
+ function et(e) {
1516
+ let { config: t, document: r, element: i, tagName: a, isFragment: s, declareNamespaces: c } = e;
1484
1517
  if (!c) return;
1485
- let l = r.definition[o]?.attributes.details;
1486
- if (l) for (let [t, u] of Object.entries(l)) {
1518
+ let l = t.definition[a]?.attributes.details;
1519
+ if (l) for (let [e, u] of Object.entries(l)) {
1487
1520
  let l = n({
1488
- dialecteConfig: r,
1489
- tagName: o,
1490
- attributeName: t,
1521
+ dialecteConfig: t,
1522
+ tagName: a,
1523
+ attributeName: e,
1491
1524
  defaults: "required"
1492
1525
  });
1493
1526
  if (l === void 0) continue;
1494
- let d = e(t);
1495
- (u.namespace ? a.hasAttributeNS(u.namespace.uri, d) : a.hasAttribute(d)) || (u.namespace && u.namespace.prefix && u.namespace.prefix !== "xmlns" ? (c && qe({
1496
- config: r,
1497
- document: i,
1527
+ let d = o(e);
1528
+ (u.namespace ? i.hasAttributeNS(u.namespace.uri, d) : i.hasAttribute(d)) || (u.namespace && u.namespace.prefix && u.namespace.prefix !== "xmlns" ? (c && Qe({
1529
+ config: t,
1530
+ document: r,
1498
1531
  namespace: u.namespace,
1499
1532
  isFragment: s
1500
- }), a.setAttributeNS(u.namespace.uri, `${u.namespace.prefix}:${d}`, l)) : a.setAttribute(d, l));
1533
+ }), i.setAttributeNS(u.namespace.uri, `${u.namespace.prefix}:${d}`, l)) : i.setAttribute(d, l));
1501
1534
  }
1502
1535
  }
1503
- function Xe(e) {
1536
+ function tt(e) {
1504
1537
  return typeof e == "object" && !!e && "namespace" in e && !!e.namespace;
1505
1538
  }
1506
- function Ze(e) {
1507
- return !!(e.name === "xmlns" || e.name.startsWith("xmlns:") || Xe(e) && e.namespace?.prefix === "xmlns");
1539
+ function nt(e) {
1540
+ return !!(e.name === "xmlns" || e.name.startsWith("xmlns:") || tt(e) && e.namespace?.prefix === "xmlns");
1508
1541
  }
1509
- var Qe = /* @__PURE__ */ b(((e, t) => {
1542
+ var rt = /* @__PURE__ */ b(((e, t) => {
1510
1543
  t.exports = {};
1511
1544
  }));
1512
1545
  (/* @__PURE__ */ b(((e) => {
@@ -1566,15 +1599,15 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
1566
1599
  var s = n[t[a]].length;
1567
1600
  if (s > r) switch (t[a]) {
1568
1601
  case "textNode":
1569
- O(n);
1602
+ D(n);
1570
1603
  break;
1571
1604
  case "cdata":
1572
- D(n, "oncdata", n.cdata), n.cdata = "";
1605
+ E(n, "oncdata", n.cdata), n.cdata = "";
1573
1606
  break;
1574
1607
  case "script":
1575
- D(n, "onscript", n.script), n.script = "";
1608
+ E(n, "onscript", n.script), n.script = "";
1576
1609
  break;
1577
- default: A(n, "Max buffer length exceeded: " + t[a]);
1610
+ default: k(n, "Max buffer length exceeded: " + t[a]);
1578
1611
  }
1579
1612
  i = Math.max(i, s);
1580
1613
  }
@@ -1584,11 +1617,11 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
1584
1617
  for (var n = 0, r = t.length; n < r; n++) e[t[n]] = "";
1585
1618
  }
1586
1619
  function a(e) {
1587
- O(e), e.cdata !== "" && (D(e, "oncdata", e.cdata), e.cdata = ""), e.script !== "" && (D(e, "onscript", e.script), e.script = "");
1620
+ D(e), e.cdata !== "" && (E(e, "oncdata", e.cdata), e.cdata = ""), e.script !== "" && (E(e, "onscript", e.script), e.script = "");
1588
1621
  }
1589
1622
  n.prototype = {
1590
1623
  end: function() {
1591
- ae(this);
1624
+ oe(this);
1592
1625
  },
1593
1626
  write: F,
1594
1627
  resume: function() {
@@ -1603,7 +1636,7 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
1603
1636
  };
1604
1637
  var o;
1605
1638
  try {
1606
- o = Qe().Stream;
1639
+ o = rt().Stream;
1607
1640
  } catch {
1608
1641
  o = function() {};
1609
1642
  }
@@ -2009,94 +2042,94 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2009
2042
  let n = re(e), r = re(t);
2010
2043
  return !n || !r ? !0 : r === "utf16" ? n === "utf16le" || n === "utf16be" : n === r;
2011
2044
  }
2012
- function E(e, t) {
2045
+ function ae(e, t) {
2013
2046
  if (!(!e.strict || !e.encoding || !t || t.name !== "xml")) {
2014
2047
  var n = ne(t.body);
2015
- n && !ie(e.encoding, n) && j(e, "XML declaration encoding " + n + " does not match detected stream encoding " + e.encoding.toUpperCase());
2048
+ n && !ie(e.encoding, n) && A(e, "XML declaration encoding " + n + " does not match detected stream encoding " + e.encoding.toUpperCase());
2016
2049
  }
2017
2050
  }
2018
- function D(e, t, n) {
2019
- e.textNode && O(e), T(e, t, n);
2051
+ function E(e, t, n) {
2052
+ e.textNode && D(e), T(e, t, n);
2020
2053
  }
2021
- function O(e) {
2022
- e.textNode = k(e.opt, e.textNode), e.textNode && T(e, "ontext", e.textNode), e.textNode = "";
2054
+ function D(e) {
2055
+ e.textNode = O(e.opt, e.textNode), e.textNode && T(e, "ontext", e.textNode), e.textNode = "";
2023
2056
  }
2024
- function k(e, t) {
2057
+ function O(e, t) {
2025
2058
  return e.trim && (t = t.trim()), e.normalize && (t = t.replace(/\s+/g, " ")), t;
2026
2059
  }
2027
- function A(e, t) {
2028
- return O(e), e.trackPosition && (t += "\nLine: " + e.line + "\nColumn: " + e.column + "\nChar: " + e.c), t = Error(t), e.error = t, T(e, "onerror", t), e;
2060
+ function k(e, t) {
2061
+ return D(e), e.trackPosition && (t += "\nLine: " + e.line + "\nColumn: " + e.column + "\nChar: " + e.c), t = Error(t), e.error = t, T(e, "onerror", t), e;
2029
2062
  }
2030
- function ae(e) {
2031
- return e.sawRoot && !e.closedRoot && j(e, "Unclosed root tag"), e.state !== w.BEGIN && e.state !== w.BEGIN_WHITESPACE && e.state !== w.TEXT && A(e, "Unexpected end"), O(e), e.c = "", e.closed = !0, T(e, "onend"), n.call(e, e.strict, e.opt), e;
2063
+ function oe(e) {
2064
+ return e.sawRoot && !e.closedRoot && A(e, "Unclosed root tag"), e.state !== w.BEGIN && e.state !== w.BEGIN_WHITESPACE && e.state !== w.TEXT && k(e, "Unexpected end"), D(e), e.c = "", e.closed = !0, T(e, "onend"), n.call(e, e.strict, e.opt), e;
2032
2065
  }
2033
- function j(e, t) {
2066
+ function A(e, t) {
2034
2067
  if (typeof e != "object" || !(e instanceof n)) throw Error("bad call to strictFail");
2035
- e.strict && A(e, t);
2068
+ e.strict && k(e, t);
2036
2069
  }
2037
- function M(e) {
2070
+ function j(e) {
2038
2071
  e.strict || (e.tagName = e.tagName[e.looseCase]());
2039
2072
  var t = e.tags[e.tags.length - 1] || e, n = e.tag = {
2040
2073
  name: e.tagName,
2041
2074
  attributes: {}
2042
2075
  };
2043
- e.opt.xmlns && (n.ns = t.ns), e.attribList.length = 0, D(e, "onopentagstart", n);
2076
+ e.opt.xmlns && (n.ns = t.ns), e.attribList.length = 0, E(e, "onopentagstart", n);
2044
2077
  }
2045
- function oe(e, t) {
2078
+ function se(e, t) {
2046
2079
  var n = e.indexOf(":") < 0 ? ["", e] : e.split(":"), r = n[0], i = n[1];
2047
2080
  return t && e === "xmlns" && (r = "xmlns", i = ""), {
2048
2081
  prefix: r,
2049
2082
  local: i
2050
2083
  };
2051
2084
  }
2052
- function N(e) {
2085
+ function M(e) {
2053
2086
  if (e.strict || (e.attribName = e.attribName[e.looseCase]()), e.attribList.indexOf(e.attribName) !== -1 || e.tag.attributes.hasOwnProperty(e.attribName)) {
2054
2087
  e.attribName = e.attribValue = "";
2055
2088
  return;
2056
2089
  }
2057
2090
  if (e.opt.xmlns) {
2058
- var t = oe(e.attribName, !0), n = t.prefix, r = t.local;
2059
- if (n === "xmlns") if (r === "xml" && e.attribValue !== p) j(e, "xml: prefix must be bound to " + p + "\nActual: " + e.attribValue);
2060
- else if (r === "xmlns" && e.attribValue !== m) j(e, "xmlns: prefix must be bound to " + m + "\nActual: " + e.attribValue);
2091
+ var t = se(e.attribName, !0), n = t.prefix, r = t.local;
2092
+ if (n === "xmlns") if (r === "xml" && e.attribValue !== p) A(e, "xml: prefix must be bound to " + p + "\nActual: " + e.attribValue);
2093
+ else if (r === "xmlns" && e.attribValue !== m) A(e, "xmlns: prefix must be bound to " + m + "\nActual: " + e.attribValue);
2061
2094
  else {
2062
2095
  var i = e.tag, a = e.tags[e.tags.length - 1] || e;
2063
2096
  i.ns === a.ns && (i.ns = Object.create(a.ns)), i.ns[r] = e.attribValue;
2064
2097
  }
2065
2098
  e.attribList.push([e.attribName, e.attribValue]);
2066
- } else e.tag.attributes[e.attribName] = e.attribValue, D(e, "onattribute", {
2099
+ } else e.tag.attributes[e.attribName] = e.attribValue, E(e, "onattribute", {
2067
2100
  name: e.attribName,
2068
2101
  value: e.attribValue
2069
2102
  });
2070
2103
  e.attribName = e.attribValue = "";
2071
2104
  }
2072
- function P(e, t) {
2105
+ function N(e, t) {
2073
2106
  if (e.opt.xmlns) {
2074
- var n = e.tag, r = oe(e.tagName);
2075
- n.prefix = r.prefix, n.local = r.local, n.uri = n.ns[r.prefix] || "", n.prefix && !n.uri && (j(e, "Unbound namespace prefix: " + JSON.stringify(e.tagName)), n.uri = r.prefix);
2107
+ var n = e.tag, r = se(e.tagName);
2108
+ n.prefix = r.prefix, n.local = r.local, n.uri = n.ns[r.prefix] || "", n.prefix && !n.uri && (A(e, "Unbound namespace prefix: " + JSON.stringify(e.tagName)), n.uri = r.prefix);
2076
2109
  var i = e.tags[e.tags.length - 1] || e;
2077
2110
  n.ns && i.ns !== n.ns && Object.keys(n.ns).forEach(function(t) {
2078
- D(e, "onopennamespace", {
2111
+ E(e, "onopennamespace", {
2079
2112
  prefix: t,
2080
2113
  uri: n.ns[t]
2081
2114
  });
2082
2115
  });
2083
2116
  for (var a = 0, o = e.attribList.length; a < o; a++) {
2084
- var s = e.attribList[a], c = s[0], l = s[1], u = oe(c, !0), d = u.prefix, f = u.local, p = d === "" ? "" : n.ns[d] || "", m = {
2117
+ var s = e.attribList[a], c = s[0], l = s[1], u = se(c, !0), d = u.prefix, f = u.local, p = d === "" ? "" : n.ns[d] || "", m = {
2085
2118
  name: c,
2086
2119
  value: l,
2087
2120
  prefix: d,
2088
2121
  local: f,
2089
2122
  uri: p
2090
2123
  };
2091
- d && d !== "xmlns" && !p && (j(e, "Unbound namespace prefix: " + JSON.stringify(d)), m.uri = d), e.tag.attributes[c] = m, D(e, "onattribute", m);
2124
+ d && d !== "xmlns" && !p && (A(e, "Unbound namespace prefix: " + JSON.stringify(d)), m.uri = d), e.tag.attributes[c] = m, E(e, "onattribute", m);
2092
2125
  }
2093
2126
  e.attribList.length = 0;
2094
2127
  }
2095
- e.tag.isSelfClosing = !!t, e.sawRoot = !0, e.tags.push(e.tag), D(e, "onopentag", e.tag), t || (!e.noscript && e.tagName.toLowerCase() === "script" ? e.state = w.SCRIPT : e.state = w.TEXT, e.tag = null, e.tagName = ""), e.attribName = e.attribValue = "", e.attribList.length = 0;
2128
+ e.tag.isSelfClosing = !!t, e.sawRoot = !0, e.tags.push(e.tag), E(e, "onopentag", e.tag), t || (!e.noscript && e.tagName.toLowerCase() === "script" ? e.state = w.SCRIPT : e.state = w.TEXT, e.tag = null, e.tagName = ""), e.attribName = e.attribValue = "", e.attribList.length = 0;
2096
2129
  }
2097
- function se(e) {
2130
+ function P(e) {
2098
2131
  if (!e.tagName) {
2099
- j(e, "Weird empty close tag."), e.textNode += "</>", e.state = w.TEXT;
2132
+ A(e, "Weird empty close tag."), e.textNode += "</>", e.state = w.TEXT;
2100
2133
  return;
2101
2134
  }
2102
2135
  if (e.script) {
@@ -2104,25 +2137,25 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2104
2137
  e.script += "</" + e.tagName + ">", e.tagName = "", e.state = w.SCRIPT;
2105
2138
  return;
2106
2139
  }
2107
- D(e, "onscript", e.script), e.script = "";
2140
+ E(e, "onscript", e.script), e.script = "";
2108
2141
  }
2109
2142
  var t = e.tags.length, n = e.tagName;
2110
2143
  e.strict || (n = n[e.looseCase]());
2111
- for (var r = n; t-- && e.tags[t].name !== r;) j(e, "Unexpected close tag");
2144
+ for (var r = n; t-- && e.tags[t].name !== r;) A(e, "Unexpected close tag");
2112
2145
  if (t < 0) {
2113
- j(e, "Unmatched closing tag: " + e.tagName), e.textNode += "</" + e.tagName + ">", e.state = w.TEXT;
2146
+ A(e, "Unmatched closing tag: " + e.tagName), e.textNode += "</" + e.tagName + ">", e.state = w.TEXT;
2114
2147
  return;
2115
2148
  }
2116
2149
  e.tagName = n;
2117
2150
  for (var i = e.tags.length; i-- > t;) {
2118
2151
  var a = e.tag = e.tags.pop();
2119
- e.tagName = e.tag.name, D(e, "onclosetag", e.tagName);
2152
+ e.tagName = e.tag.name, E(e, "onclosetag", e.tagName);
2120
2153
  var o = {};
2121
2154
  for (var s in a.ns) o[s] = a.ns[s];
2122
2155
  var c = e.tags[e.tags.length - 1] || e;
2123
2156
  e.opt.xmlns && a.ns !== c.ns && Object.keys(a.ns).forEach(function(t) {
2124
2157
  var n = a.ns[t];
2125
- D(e, "onclosenamespace", {
2158
+ E(e, "onclosenamespace", {
2126
2159
  prefix: t,
2127
2160
  uri: n
2128
2161
  });
@@ -2132,10 +2165,10 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2132
2165
  }
2133
2166
  function ce(e) {
2134
2167
  var t = e.entity, n = t.toLowerCase(), r, i = "";
2135
- return e.ENTITIES[t] ? e.ENTITIES[t] : e.ENTITIES[n] ? e.ENTITIES[n] : (t = n, t.charAt(0) === "#" && (t.charAt(1) === "x" ? (t = t.slice(2), r = parseInt(t, 16), i = r.toString(16)) : (t = t.slice(1), r = parseInt(t, 10), i = r.toString(10))), t = t.replace(/^0+/, ""), isNaN(r) || i.toLowerCase() !== t || r < 0 || r > 1114111 ? (j(e, "Invalid character entity"), "&" + e.entity + ";") : String.fromCodePoint(r));
2168
+ return e.ENTITIES[t] ? e.ENTITIES[t] : e.ENTITIES[n] ? e.ENTITIES[n] : (t = n, t.charAt(0) === "#" && (t.charAt(1) === "x" ? (t = t.slice(2), r = parseInt(t, 16), i = r.toString(16)) : (t = t.slice(1), r = parseInt(t, 10), i = r.toString(10))), t = t.replace(/^0+/, ""), isNaN(r) || i.toLowerCase() !== t || r < 0 || r > 1114111 ? (A(e, "Invalid character entity"), "&" + e.entity + ";") : String.fromCodePoint(r));
2136
2169
  }
2137
2170
  function le(e, t) {
2138
- t === "<" ? (e.state = w.OPEN_WAKA, e.startTagPosition = e.position) : b(t) || (j(e, "Non-whitespace before first tag."), e.textNode = t, e.state = w.TEXT);
2171
+ t === "<" ? (e.state = w.OPEN_WAKA, e.startTagPosition = e.position) : b(t) || (A(e, "Non-whitespace before first tag."), e.textNode = t, e.state = w.TEXT);
2139
2172
  }
2140
2173
  function ue(e, t) {
2141
2174
  var n = "";
@@ -2144,8 +2177,8 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2144
2177
  function F(t) {
2145
2178
  var n = this;
2146
2179
  if (this.error) throw this.error;
2147
- if (n.closed) return A(n, "Cannot write after close. Assign an onready handler.");
2148
- if (t === null) return ae(n);
2180
+ if (n.closed) return k(n, "Cannot write after close. Assign an onready handler.");
2181
+ if (t === null) return oe(n);
2149
2182
  typeof t == "object" && (t = t.toString());
2150
2183
  for (var i = 0, a = ""; a = ue(t, i++), n.c = a, a;) switch (n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++), n.state) {
2151
2184
  case w.BEGIN:
@@ -2160,7 +2193,7 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2160
2193
  for (var o = i - 1; a && a !== "<" && a !== "&";) a = ue(t, i++), a && n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++);
2161
2194
  n.textNode += t.substring(o, i - 1);
2162
2195
  }
2163
- a === "<" && !(n.sawRoot && n.closedRoot && !n.strict) ? (n.state = w.OPEN_WAKA, n.startTagPosition = n.position) : (!b(a) && (!n.sawRoot || n.closedRoot) && j(n, "Text data outside of root node."), a === "&" ? n.state = w.TEXT_ENTITY : n.textNode += a);
2196
+ a === "<" && !(n.sawRoot && n.closedRoot && !n.strict) ? (n.state = w.OPEN_WAKA, n.startTagPosition = n.position) : (!b(a) && (!n.sawRoot || n.closedRoot) && A(n, "Text data outside of root node."), a === "&" ? n.state = w.TEXT_ENTITY : n.textNode += a);
2164
2197
  continue;
2165
2198
  case w.SCRIPT:
2166
2199
  a === "<" ? n.state = w.SCRIPT_ENDING : n.script += a;
@@ -2174,7 +2207,7 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2174
2207
  else if (a === "/") n.state = w.CLOSE_TAG, n.tagName = "";
2175
2208
  else if (a === "?") n.state = w.PROC_INST, n.procInstName = n.procInstBody = "";
2176
2209
  else {
2177
- if (j(n, "Unencoded <"), n.startTagPosition + 1 < n.position) {
2210
+ if (A(n, "Unencoded <"), n.startTagPosition + 1 < n.position) {
2178
2211
  var s = n.position - n.startTagPosition;
2179
2212
  a = Array(s).join(" ") + a;
2180
2213
  }
@@ -2186,13 +2219,13 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2186
2219
  n.state = w.COMMENT, n.comment = "", n.sgmlDecl = "";
2187
2220
  continue;
2188
2221
  }
2189
- n.doctype && n.doctype !== !0 && n.sgmlDecl ? (n.state = w.DOCTYPE_DTD, n.doctype += "<!" + n.sgmlDecl + a, n.sgmlDecl = "") : (n.sgmlDecl + a).toUpperCase() === d ? (D(n, "onopencdata"), n.state = w.CDATA, n.sgmlDecl = "", n.cdata = "") : (n.sgmlDecl + a).toUpperCase() === f ? (n.state = w.DOCTYPE, (n.doctype || n.sawRoot) && j(n, "Inappropriately located doctype declaration"), n.doctype = "", n.sgmlDecl = "") : a === ">" ? (D(n, "onsgmldeclaration", n.sgmlDecl), n.sgmlDecl = "", n.state = w.TEXT) : (x(a) && (n.state = w.SGML_DECL_QUOTED), n.sgmlDecl += a);
2222
+ n.doctype && n.doctype !== !0 && n.sgmlDecl ? (n.state = w.DOCTYPE_DTD, n.doctype += "<!" + n.sgmlDecl + a, n.sgmlDecl = "") : (n.sgmlDecl + a).toUpperCase() === d ? (E(n, "onopencdata"), n.state = w.CDATA, n.sgmlDecl = "", n.cdata = "") : (n.sgmlDecl + a).toUpperCase() === f ? (n.state = w.DOCTYPE, (n.doctype || n.sawRoot) && A(n, "Inappropriately located doctype declaration"), n.doctype = "", n.sgmlDecl = "") : a === ">" ? (E(n, "onsgmldeclaration", n.sgmlDecl), n.sgmlDecl = "", n.state = w.TEXT) : (x(a) && (n.state = w.SGML_DECL_QUOTED), n.sgmlDecl += a);
2190
2223
  continue;
2191
2224
  case w.SGML_DECL_QUOTED:
2192
2225
  a === n.q && (n.state = w.SGML_DECL, n.q = ""), n.sgmlDecl += a;
2193
2226
  continue;
2194
2227
  case w.DOCTYPE:
2195
- a === ">" ? (n.state = w.TEXT, D(n, "ondoctype", n.doctype), n.doctype = !0) : (n.doctype += a, a === "[" ? n.state = w.DOCTYPE_DTD : x(a) && (n.state = w.DOCTYPE_QUOTED, n.q = a));
2228
+ a === ">" ? (n.state = w.TEXT, E(n, "ondoctype", n.doctype), n.doctype = !0) : (n.doctype += a, a === "[" ? n.state = w.DOCTYPE_DTD : x(a) && (n.state = w.DOCTYPE_QUOTED, n.q = a));
2196
2229
  continue;
2197
2230
  case w.DOCTYPE_QUOTED:
2198
2231
  n.doctype += a, a === n.q && (n.q = "", n.state = w.DOCTYPE);
@@ -2207,10 +2240,10 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2207
2240
  a === "-" ? n.state = w.COMMENT_ENDING : n.comment += a;
2208
2241
  continue;
2209
2242
  case w.COMMENT_ENDING:
2210
- a === "-" ? (n.state = w.COMMENT_ENDED, n.comment = k(n.opt, n.comment), n.comment && D(n, "oncomment", n.comment), n.comment = "") : (n.comment += "-" + a, n.state = w.COMMENT);
2243
+ a === "-" ? (n.state = w.COMMENT_ENDED, n.comment = O(n.opt, n.comment), n.comment && E(n, "oncomment", n.comment), n.comment = "") : (n.comment += "-" + a, n.state = w.COMMENT);
2211
2244
  continue;
2212
2245
  case w.COMMENT_ENDED:
2213
- a === ">" ? n.doctype && n.doctype !== !0 ? n.state = w.DOCTYPE_DTD : n.state = w.TEXT : (j(n, "Malformed comment"), n.comment += "--" + a, n.state = w.COMMENT);
2246
+ a === ">" ? n.doctype && n.doctype !== !0 ? n.state = w.DOCTYPE_DTD : n.state = w.TEXT : (A(n, "Malformed comment"), n.comment += "--" + a, n.state = w.COMMENT);
2214
2247
  continue;
2215
2248
  case w.CDATA:
2216
2249
  for (var o = i - 1; a && a !== "]";) a = ue(t, i++), a && n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++);
@@ -2220,7 +2253,7 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2220
2253
  a === "]" ? n.state = w.CDATA_ENDING_2 : (n.cdata += "]" + a, n.state = w.CDATA);
2221
2254
  continue;
2222
2255
  case w.CDATA_ENDING_2:
2223
- a === ">" ? (n.cdata && D(n, "oncdata", n.cdata), D(n, "onclosecdata"), n.cdata = "", n.state = w.TEXT) : a === "]" ? n.cdata += "]" : (n.cdata += "]]" + a, n.state = w.CDATA);
2256
+ a === ">" ? (n.cdata && E(n, "oncdata", n.cdata), E(n, "onclosecdata"), n.cdata = "", n.state = w.TEXT) : a === "]" ? n.cdata += "]" : (n.cdata += "]]" + a, n.state = w.CDATA);
2224
2257
  continue;
2225
2258
  case w.PROC_INST:
2226
2259
  a === "?" ? n.state = w.PROC_INST_ENDING : b(a) ? n.state = w.PROC_INST_BODY : n.procInstName += a;
@@ -2235,61 +2268,61 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2235
2268
  name: n.procInstName,
2236
2269
  body: n.procInstBody
2237
2270
  };
2238
- E(n, e), D(n, "onprocessinginstruction", e), n.procInstName = n.procInstBody = "", n.state = w.TEXT;
2271
+ ae(n, e), E(n, "onprocessinginstruction", e), n.procInstName = n.procInstBody = "", n.state = w.TEXT;
2239
2272
  } else n.procInstBody += "?" + a, n.state = w.PROC_INST_BODY;
2240
2273
  continue;
2241
2274
  case w.OPEN_TAG:
2242
- C(_, a) ? n.tagName += a : (M(n), a === ">" ? P(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : (b(a) || j(n, "Invalid character in tag name"), n.state = w.ATTRIB));
2275
+ C(_, a) ? n.tagName += a : (j(n), a === ">" ? N(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : (b(a) || A(n, "Invalid character in tag name"), n.state = w.ATTRIB));
2243
2276
  continue;
2244
2277
  case w.OPEN_TAG_SLASH:
2245
- a === ">" ? (P(n, !0), se(n)) : (j(n, "Forward-slash in opening tag not followed by >"), n.state = w.ATTRIB);
2278
+ a === ">" ? (N(n, !0), P(n)) : (A(n, "Forward-slash in opening tag not followed by >"), n.state = w.ATTRIB);
2246
2279
  continue;
2247
2280
  case w.ATTRIB:
2248
2281
  if (b(a)) continue;
2249
- a === ">" ? P(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : C(g, a) ? (n.attribName = a, n.attribValue = "", n.state = w.ATTRIB_NAME) : j(n, "Invalid attribute name");
2282
+ a === ">" ? N(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : C(g, a) ? (n.attribName = a, n.attribValue = "", n.state = w.ATTRIB_NAME) : A(n, "Invalid attribute name");
2250
2283
  continue;
2251
2284
  case w.ATTRIB_NAME:
2252
- a === "=" ? n.state = w.ATTRIB_VALUE : a === ">" ? (j(n, "Attribute without value"), n.attribValue = n.attribName, N(n), P(n)) : b(a) ? n.state = w.ATTRIB_NAME_SAW_WHITE : C(_, a) ? n.attribName += a : j(n, "Invalid attribute name");
2285
+ a === "=" ? n.state = w.ATTRIB_VALUE : a === ">" ? (A(n, "Attribute without value"), n.attribValue = n.attribName, M(n), N(n)) : b(a) ? n.state = w.ATTRIB_NAME_SAW_WHITE : C(_, a) ? n.attribName += a : A(n, "Invalid attribute name");
2253
2286
  continue;
2254
2287
  case w.ATTRIB_NAME_SAW_WHITE:
2255
2288
  if (a === "=") n.state = w.ATTRIB_VALUE;
2256
2289
  else if (b(a)) continue;
2257
- else j(n, "Attribute without value"), n.tag.attributes[n.attribName] = "", n.attribValue = "", D(n, "onattribute", {
2290
+ else A(n, "Attribute without value"), n.tag.attributes[n.attribName] = "", n.attribValue = "", E(n, "onattribute", {
2258
2291
  name: n.attribName,
2259
2292
  value: ""
2260
- }), n.attribName = "", a === ">" ? P(n) : C(g, a) ? (n.attribName = a, n.state = w.ATTRIB_NAME) : (j(n, "Invalid attribute name"), n.state = w.ATTRIB);
2293
+ }), n.attribName = "", a === ">" ? N(n) : C(g, a) ? (n.attribName = a, n.state = w.ATTRIB_NAME) : (A(n, "Invalid attribute name"), n.state = w.ATTRIB);
2261
2294
  continue;
2262
2295
  case w.ATTRIB_VALUE:
2263
2296
  if (b(a)) continue;
2264
- x(a) ? (n.q = a, n.state = w.ATTRIB_VALUE_QUOTED) : (n.opt.unquotedAttributeValues || A(n, "Unquoted attribute value"), n.state = w.ATTRIB_VALUE_UNQUOTED, n.attribValue = a);
2297
+ x(a) ? (n.q = a, n.state = w.ATTRIB_VALUE_QUOTED) : (n.opt.unquotedAttributeValues || k(n, "Unquoted attribute value"), n.state = w.ATTRIB_VALUE_UNQUOTED, n.attribValue = a);
2265
2298
  continue;
2266
2299
  case w.ATTRIB_VALUE_QUOTED:
2267
2300
  if (a !== n.q) {
2268
2301
  a === "&" ? n.state = w.ATTRIB_VALUE_ENTITY_Q : n.attribValue += a;
2269
2302
  continue;
2270
2303
  }
2271
- N(n), n.q = "", n.state = w.ATTRIB_VALUE_CLOSED;
2304
+ M(n), n.q = "", n.state = w.ATTRIB_VALUE_CLOSED;
2272
2305
  continue;
2273
2306
  case w.ATTRIB_VALUE_CLOSED:
2274
- b(a) ? n.state = w.ATTRIB : a === ">" ? P(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : C(g, a) ? (j(n, "No whitespace between attributes"), n.attribName = a, n.attribValue = "", n.state = w.ATTRIB_NAME) : j(n, "Invalid attribute name");
2307
+ b(a) ? n.state = w.ATTRIB : a === ">" ? N(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : C(g, a) ? (A(n, "No whitespace between attributes"), n.attribName = a, n.attribValue = "", n.state = w.ATTRIB_NAME) : A(n, "Invalid attribute name");
2275
2308
  continue;
2276
2309
  case w.ATTRIB_VALUE_UNQUOTED:
2277
2310
  if (!S(a)) {
2278
2311
  a === "&" ? n.state = w.ATTRIB_VALUE_ENTITY_U : n.attribValue += a;
2279
2312
  continue;
2280
2313
  }
2281
- N(n), a === ">" ? P(n) : n.state = w.ATTRIB;
2314
+ M(n), a === ">" ? N(n) : n.state = w.ATTRIB;
2282
2315
  continue;
2283
2316
  case w.CLOSE_TAG:
2284
- if (n.tagName) a === ">" ? se(n) : C(_, a) ? n.tagName += a : n.script ? (n.script += "</" + n.tagName + a, n.tagName = "", n.state = w.SCRIPT) : (b(a) || j(n, "Invalid tagname in closing tag"), n.state = w.CLOSE_TAG_SAW_WHITE);
2317
+ if (n.tagName) a === ">" ? P(n) : C(_, a) ? n.tagName += a : n.script ? (n.script += "</" + n.tagName + a, n.tagName = "", n.state = w.SCRIPT) : (b(a) || A(n, "Invalid tagname in closing tag"), n.state = w.CLOSE_TAG_SAW_WHITE);
2285
2318
  else {
2286
2319
  if (b(a)) continue;
2287
- ee(g, a) ? n.script ? (n.script += "</" + a, n.state = w.SCRIPT) : j(n, "Invalid tagname in closing tag.") : n.tagName = a;
2320
+ ee(g, a) ? n.script ? (n.script += "</" + a, n.state = w.SCRIPT) : A(n, "Invalid tagname in closing tag.") : n.tagName = a;
2288
2321
  }
2289
2322
  continue;
2290
2323
  case w.CLOSE_TAG_SAW_WHITE:
2291
2324
  if (b(a)) continue;
2292
- a === ">" ? se(n) : j(n, "Invalid characters in closing tag");
2325
+ a === ">" ? P(n) : A(n, "Invalid characters in closing tag");
2293
2326
  continue;
2294
2327
  case w.TEXT_ENTITY:
2295
2328
  case w.ATTRIB_VALUE_ENTITY_Q:
@@ -2308,8 +2341,8 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2308
2341
  }
2309
2342
  if (a === ";") {
2310
2343
  var u = ce(n);
2311
- n.opt.unparsedEntities && !Object.values(e.XML_ENTITIES).includes(u) ? ((n.entityCount += 1) > n.opt.maxEntityCount && A(n, "Parsed entity count exceeds max entity count"), (n.entityDepth += 1) > n.opt.maxEntityDepth && A(n, "Parsed entity depth exceeds max entity depth"), n.entity = "", n.state = c, n.write(u), --n.entityDepth) : (n[l] += u, n.entity = "", n.state = c);
2312
- } else C(n.entity.length ? y : v, a) ? n.entity += a : (j(n, "Invalid character in entity name"), n[l] += "&" + n.entity + a, n.entity = "", n.state = c);
2344
+ n.opt.unparsedEntities && !Object.values(e.XML_ENTITIES).includes(u) ? ((n.entityCount += 1) > n.opt.maxEntityCount && k(n, "Parsed entity count exceeds max entity count"), (n.entityDepth += 1) > n.opt.maxEntityDepth && k(n, "Parsed entity depth exceeds max entity depth"), n.entity = "", n.state = c, n.write(u), --n.entityDepth) : (n[l] += u, n.entity = "", n.state = c);
2345
+ } else C(n.entity.length ? y : v, a) ? n.entity += a : (A(n, "Invalid character in entity name"), n[l] += "&" + n.entity + a, n.entity = "", n.state = c);
2313
2346
  continue;
2314
2347
  default: throw Error(n, "Unknown state: " + n.state);
2315
2348
  }
@@ -2336,10 +2369,13 @@ var Qe = /* @__PURE__ */ b(((e, t) => {
2336
2369
  })();
2337
2370
  })(e === void 0 ? e.sax = {} : e);
2338
2371
  })))();
2339
- var $e = Object.freeze({
2372
+ var U = Object.freeze({
2340
2373
  start() {},
2341
2374
  stop() {},
2342
2375
  count() {},
2376
+ time(e, t) {
2377
+ return t();
2378
+ },
2343
2379
  profile(e, t) {
2344
2380
  return t();
2345
2381
  },
@@ -2349,8 +2385,8 @@ var $e = Object.freeze({
2349
2385
  log() {},
2350
2386
  reset() {}
2351
2387
  });
2352
- async function H(e) {
2353
- let { context: t, options: n = {} } = e, { ref: r, ancestors: i, siblings: a, depth: o, includeDeleted: s, omit: c, unwrap: l, as: u = "tree" } = n, d = await Fe({
2388
+ async function it(e) {
2389
+ let { context: t, options: n = {} } = e, { ref: r, ancestors: i, siblings: a, depth: o, includeDeleted: s, omit: c, unwrap: l, as: u = "tree" } = n, d = await Be({
2354
2390
  context: t,
2355
2391
  ref: r ? f(r) : void 0,
2356
2392
  ancestors: i,
@@ -2358,82 +2394,82 @@ async function H(e) {
2358
2394
  depth: o,
2359
2395
  includeDeleted: s
2360
2396
  });
2361
- if (u === "xml") return tt(t, d, n.declareNamespaces, n.includeXmlDeclaration);
2362
- let p = et(t, d, {
2397
+ if (u === "xml") return W(t, d, n.declareNamespaces, n.includeXmlDeclaration);
2398
+ let p = at(t, d, {
2363
2399
  omit: c,
2364
2400
  unwrap: l
2365
2401
  });
2366
2402
  return u === "tree" ? p : {
2367
2403
  tree: p,
2368
- xmlString: tt(t, d, n.declareNamespaces, n.includeXmlDeclaration)
2404
+ xmlString: W(t, d, n.declareNamespaces, n.includeXmlDeclaration)
2369
2405
  };
2370
2406
  }
2371
- function et(e, t, n) {
2372
- let r = Le(t);
2373
- r = we({
2407
+ function at(e, t, n) {
2408
+ let r = Ue(t);
2409
+ r = De({
2374
2410
  tree: r,
2375
2411
  omit: n.omit
2376
2412
  });
2377
2413
  let i = e.dialecteConfig.transparentElements, a = n.unwrap ?? (i?.length ? [...i] : void 0);
2378
- return a?.length && (r = L({
2414
+ return a?.length && (r = Ce({
2379
2415
  tree: r,
2380
2416
  unwrapTagNames: a
2381
- })), r = Te({
2417
+ })), r = Oe({
2382
2418
  tree: r,
2383
2419
  childrenConfig: e.dialecteConfig.children
2384
2420
  }), r;
2385
2421
  }
2386
- function tt(e, t, n, r) {
2387
- return Ue(We({
2422
+ function W(e, t, n, r) {
2423
+ return qe(Je({
2388
2424
  records: t.liveRecords,
2389
2425
  config: e.dialecteConfig,
2390
2426
  rootId: t.rootId,
2391
2427
  declareNamespaces: n
2392
2428
  }), { includeXmlDeclaration: r });
2393
2429
  }
2394
- var U = class {
2430
+ var ot = class {
2395
2431
  constructor(e, t) {
2396
2432
  this.getContext = e, this.dialecteConfig = t;
2397
2433
  }
2398
2434
  async getRecord(e) {
2399
- return E({
2435
+ return O({
2400
2436
  context: this.getContext(),
2401
2437
  ref: e
2402
2438
  });
2403
2439
  }
2404
2440
  async getRecords(e) {
2405
- return D({
2441
+ return k({
2406
2442
  context: this.getContext(),
2407
2443
  refs: e
2408
2444
  });
2409
2445
  }
2410
2446
  async getChild(e, t) {
2411
- return k({
2447
+ return A({
2412
2448
  context: this.getContext(),
2413
2449
  ref: f(e),
2414
2450
  tagName: t
2415
2451
  });
2416
2452
  }
2417
2453
  async getChildren(e, t) {
2418
- return A({
2454
+ return j({
2419
2455
  context: this.getContext(),
2420
2456
  ref: f(e),
2421
2457
  tagName: t
2422
2458
  });
2423
2459
  }
2424
2460
  async getRecordsByTagName(e) {
2425
- return O({
2461
+ return oe({
2426
2462
  context: this.getContext(),
2427
2463
  tagName: e
2428
2464
  });
2429
2465
  }
2430
2466
  async getAttribute(e, t) {
2431
2467
  let n = f(e), { fullObject: r } = t;
2432
- return r ? ge({
2468
+ return r ? ye({
2433
2469
  context: this.getContext(),
2434
2470
  ref: n,
2435
2471
  ...t
2436
- }) : he({
2472
+ }) : ve({
2437
2473
  context: this.getContext(),
2438
2474
  ref: n,
2439
2475
  ...t
@@ -2441,18 +2477,18 @@ var U = class {
2441
2477
  }
2442
2478
  async getAttributes(e, t) {
2443
2479
  let n = f(e), { fullObject: r } = t || {};
2444
- return r ? ye({
2480
+ return r ? xe({
2445
2481
  context: this.getContext(),
2446
2482
  ref: n,
2447
2483
  ...t
2448
- }) : ve({
2484
+ }) : L({
2449
2485
  context: this.getContext(),
2450
2486
  ref: n,
2451
2487
  ...t
2452
2488
  });
2453
2489
  }
2454
2490
  async getTree(e, t) {
2455
- return Ee({
2491
+ return ke({
2456
2492
  context: this.getContext(),
2457
2493
  ref: f(e),
2458
2494
  options: t,
@@ -2460,44 +2496,44 @@ var U = class {
2460
2496
  });
2461
2497
  }
2462
2498
  async getSnapshot(e) {
2463
- return H({
2499
+ return it({
2464
2500
  context: this.getContext(),
2465
2501
  options: e
2466
2502
  });
2467
2503
  }
2468
2504
  async findDescendants(e) {
2469
2505
  let t = f(e), n = this.dialecteConfig.descendants[t.tagName] ?? [];
2470
- return oe({
2506
+ return P({
2471
2507
  context: this.getContext(),
2472
2508
  ref: t,
2473
2509
  options: { collect: n }
2474
2510
  });
2475
2511
  }
2476
2512
  async findAncestors(e) {
2477
- return e ? ae({
2513
+ return e ? se({
2478
2514
  context: this.getContext(),
2479
2515
  ref: f(e)
2480
2516
  }) : [];
2481
2517
  }
2482
2518
  async findByAttributes(e) {
2483
- return j({
2519
+ return M({
2484
2520
  context: this.getContext(),
2485
2521
  tagName: e.tagName,
2486
2522
  attributes: e.attributes
2487
2523
  });
2488
2524
  }
2489
- }, nt = class {
2490
- constructor(e, t, n, r = $e) {
2525
+ }, G = class {
2526
+ constructor(e, t, n, r = U) {
2491
2527
  this.store = e, this.dialecteConfig = t, this.documentId = n, this._perf = r;
2492
2528
  }
2493
2529
  get perf() {
2494
2530
  return this._perf;
2495
2531
  }
2496
2532
  get any() {
2497
- return this._any ??= new U(() => this.context, this.dialecteConfig);
2533
+ return this._any ??= new ot(() => this.context, this.dialecteConfig);
2498
2534
  }
2499
2535
  getOperations() {
2500
- return [];
2536
+ return T();
2501
2537
  }
2502
2538
  get context() {
2503
2539
  return {
@@ -2512,50 +2548,50 @@ var U = class {
2512
2548
  }
2513
2549
  async getDocumentInfo() {
2514
2550
  let e = await this.store.getDocument(this.documentId);
2515
- return o(e, {
2551
+ return a(e, {
2516
2552
  key: "DOCUMENT_NOT_REGISTERED",
2517
2553
  detail: `Expected document id: ${this.documentId}`
2518
2554
  }), e;
2519
2555
  }
2520
2556
  async getRoot() {
2521
- let e = await E({
2557
+ let e = await O({
2522
2558
  context: this.context,
2523
2559
  ref: { tagName: this.dialecteConfig.rootElementName }
2524
2560
  });
2525
- return o(e, {
2561
+ return a(e, {
2526
2562
  key: "ROOT_NOT_FOUND",
2527
2563
  detail: `Expected tag name: ${this.dialecteConfig.rootElementName}`
2528
2564
  }), e;
2529
2565
  }
2530
2566
  async getRecord(e) {
2531
- return E({
2567
+ return O({
2532
2568
  context: this.context,
2533
2569
  ref: f(e)
2534
2570
  });
2535
2571
  }
2536
2572
  async getRecords(e) {
2537
2573
  let t = e.map((e) => f(e));
2538
- return D({
2574
+ return k({
2539
2575
  context: this.context,
2540
2576
  refs: t
2541
2577
  });
2542
2578
  }
2543
2579
  async getChild(e, t) {
2544
- if (e) return k({
2580
+ if (e) return A({
2545
2581
  context: this.context,
2546
2582
  ref: f(e),
2547
2583
  tagName: t
2548
2584
  });
2549
2585
  }
2550
2586
  async getChildren(e, t) {
2551
- return e ? A({
2587
+ return e ? j({
2552
2588
  context: this.context,
2553
2589
  ref: f(e),
2554
2590
  tagName: t
2555
2591
  }) : [];
2556
2592
  }
2557
2593
  async getRecordsByTagName(e) {
2558
- return O({
2594
+ return oe({
2559
2595
  context: this.context,
2560
2596
  tagName: e
2561
2597
  });
@@ -2564,27 +2600,27 @@ var U = class {
2564
2600
  let n = f(e);
2565
2601
  if (!t) {
2566
2602
  let e = this.dialecteConfig.descendants[n.tagName] ?? [];
2567
- return oe({
2603
+ return P({
2568
2604
  context: this.context,
2569
2605
  ref: n,
2570
2606
  options: { collect: e }
2571
2607
  });
2572
2608
  }
2573
- return oe({
2609
+ return P({
2574
2610
  context: this.context,
2575
2611
  ref: n,
2576
2612
  options: t
2577
2613
  });
2578
2614
  }
2579
2615
  async findAncestors(e, t) {
2580
- return e ? ae({
2616
+ return e ? se({
2581
2617
  context: this.context,
2582
2618
  ref: f(e),
2583
2619
  options: t
2584
2620
  }) : [];
2585
2621
  }
2586
2622
  async getTree(e, t) {
2587
- return Ee({
2623
+ return ke({
2588
2624
  context: this.context,
2589
2625
  ref: f(e),
2590
2626
  options: t,
@@ -2592,18 +2628,18 @@ var U = class {
2592
2628
  });
2593
2629
  }
2594
2630
  async getSnapshot(e) {
2595
- return H({
2631
+ return it({
2596
2632
  context: this.context,
2597
2633
  options: e
2598
2634
  });
2599
2635
  }
2600
2636
  async getAttribute(e, t) {
2601
2637
  let n = f(e), { fullObject: r } = t;
2602
- return r ? ge({
2638
+ return r ? ye({
2603
2639
  context: this.context,
2604
2640
  ref: n,
2605
2641
  ...t
2606
- }) : he({
2642
+ }) : ve({
2607
2643
  context: this.context,
2608
2644
  ref: n,
2609
2645
  ...t
@@ -2611,60 +2647,72 @@ var U = class {
2611
2647
  }
2612
2648
  async getAttributes(e, t) {
2613
2649
  let n = f(e), { fullObject: r } = t || {};
2614
- return r ? ye({
2650
+ return r ? xe({
2615
2651
  context: this.context,
2616
2652
  ref: n,
2617
2653
  ...t
2618
- }) : ve({
2654
+ }) : L({
2619
2655
  context: this.context,
2620
2656
  ref: n,
2621
2657
  ...t
2622
2658
  });
2623
2659
  }
2624
2660
  async findByAttributes(e) {
2625
- return j({
2661
+ return M({
2626
2662
  context: this.context,
2627
2663
  ...e
2628
2664
  });
2629
2665
  }
2630
2666
  };
2631
- function W(e) {
2632
- let { context: t, status: n, record: r, oldRecord: i, newRecord: a } = e, s, c, l;
2633
- r && (s = d(r)), i && (c = d(i)), a && (l = d(a)), n === "created" ? (o(s, {
2634
- detail: "Record is required for created",
2635
- key: "ELEMENT_NOT_FOUND"
2636
- }), t.stagedOperations.push({
2637
- status: n,
2638
- oldRecord: void 0,
2639
- newRecord: s
2640
- })) : n === "updated" ? (o(c && l, {
2641
- detail: "Old record and new record are required for updated",
2642
- key: "ELEMENT_NOT_FOUND"
2643
- }), t.stagedOperations.push({
2644
- status: n,
2645
- oldRecord: c,
2646
- newRecord: l
2647
- })) : n === "deleted" && s && (o(s, {
2648
- detail: "Record is required for deleted",
2649
- key: "ELEMENT_NOT_FOUND"
2650
- }), t.stagedOperations.push({
2651
- status: n,
2652
- oldRecord: s,
2653
- newRecord: void 0
2654
- }));
2667
+ function K(e) {
2668
+ let { context: t, status: n, record: r, oldRecord: i, newRecord: o } = e, s, c, l;
2669
+ if (r && (s = d(r)), i && (c = d(i)), o && (l = d(o)), n === "created") {
2670
+ a(s, {
2671
+ detail: "Record is required for created",
2672
+ key: "ELEMENT_NOT_FOUND"
2673
+ });
2674
+ let e = {
2675
+ status: n,
2676
+ oldRecord: void 0,
2677
+ newRecord: s
2678
+ };
2679
+ t.stagedOperations.log.push(e), t.stagedOperations.byId.set(s.id, e);
2680
+ } else if (n === "updated") {
2681
+ a(c && l, {
2682
+ detail: "Old record and new record are required for updated",
2683
+ key: "ELEMENT_NOT_FOUND"
2684
+ });
2685
+ let e = {
2686
+ status: n,
2687
+ oldRecord: c,
2688
+ newRecord: l
2689
+ };
2690
+ t.stagedOperations.log.push(e), t.stagedOperations.byId.set(l.id, e);
2691
+ } else if (n === "deleted" && s) {
2692
+ a(s, {
2693
+ detail: "Record is required for deleted",
2694
+ key: "ELEMENT_NOT_FOUND"
2695
+ });
2696
+ let e = {
2697
+ status: n,
2698
+ oldRecord: s,
2699
+ newRecord: void 0
2700
+ };
2701
+ t.stagedOperations.log.push(e), t.stagedOperations.byId.set(s.id, e);
2702
+ }
2655
2703
  }
2656
- function rt(e) {
2704
+ function st(e) {
2657
2705
  let { context: t, operations: n } = e;
2658
2706
  for (let e of n) switch (e.status) {
2659
2707
  case "created":
2660
- W({
2708
+ K({
2661
2709
  context: t,
2662
2710
  status: "created",
2663
2711
  record: e.newRecord
2664
2712
  });
2665
2713
  break;
2666
2714
  case "updated":
2667
- W({
2715
+ K({
2668
2716
  context: t,
2669
2717
  status: "updated",
2670
2718
  oldRecord: e.oldRecord,
@@ -2672,7 +2720,7 @@ function rt(e) {
2672
2720
  });
2673
2721
  break;
2674
2722
  case "deleted":
2675
- W({
2723
+ K({
2676
2724
  context: t,
2677
2725
  status: "deleted",
2678
2726
  record: e.oldRecord
@@ -2680,20 +2728,20 @@ function rt(e) {
2680
2728
  break;
2681
2729
  }
2682
2730
  }
2683
- async function it(e) {
2684
- let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, params: c } = e, { id: u, tagName: d, attributes: f, namespace: p, value: m } = c;
2685
- G({
2731
+ async function ct(e) {
2732
+ let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: o, params: c } = e, { id: u, tagName: d, attributes: f, namespace: p, value: m } = c;
2733
+ lt({
2686
2734
  attributes: f,
2687
2735
  tagName: d
2688
2736
  });
2689
- let h = await E({
2737
+ let h = await O({
2690
2738
  context: r,
2691
- ref: a
2739
+ ref: o
2692
2740
  });
2693
- o(h, {
2741
+ a(h, {
2694
2742
  detail: "Parent record not found",
2695
2743
  key: "ELEMENT_NOT_FOUND",
2696
- ref: a
2744
+ ref: o
2697
2745
  });
2698
2746
  let g = l({
2699
2747
  dialecteConfig: t,
@@ -2715,7 +2763,7 @@ async function it(e) {
2715
2763
  dialecteConfig: t,
2716
2764
  tagName: g.tagName,
2717
2765
  attributes: g.attributes
2718
- }), W({
2766
+ }), K({
2719
2767
  context: r,
2720
2768
  status: "created",
2721
2769
  record: g
@@ -2727,12 +2775,12 @@ async function it(e) {
2727
2775
  tagName: g.tagName
2728
2776
  }]
2729
2777
  };
2730
- return W({
2778
+ return K({
2731
2779
  context: r,
2732
2780
  status: "updated",
2733
2781
  oldRecord: h,
2734
2782
  newRecord: _
2735
- }), n?.afterCreated && rt({
2783
+ }), n?.afterCreated && st({
2736
2784
  context: r,
2737
2785
  operations: await n.afterCreated({
2738
2786
  childRecord: g,
@@ -2741,22 +2789,22 @@ async function it(e) {
2741
2789
  })
2742
2790
  }), g;
2743
2791
  }
2744
- function G(t) {
2745
- let { attributes: n, tagName: r } = t;
2746
- if (!(!n || !Array.isArray(n))) for (let t of n) {
2747
- let { name: n, namespace: i } = t;
2748
- n === "xmlns" || n.startsWith("xmlns:") || !n.includes(":") || typeof i == "object" && i?.prefix === n.slice(0, n.indexOf(":")) || a("PREFIXED_ATTRIBUTE_NAME", {
2749
- detail: `Attribute '${n}' on '${r}' is prefixed — pass a local name plus its namespace instead: { name: '${e(n)}', namespace }.`,
2792
+ function lt(e) {
2793
+ let { attributes: n, tagName: r } = e;
2794
+ if (!(!n || !Array.isArray(n))) for (let e of n) {
2795
+ let { name: n, namespace: i } = e;
2796
+ n === "xmlns" || n.startsWith("xmlns:") || !n.includes(":") || typeof i == "object" && i?.prefix === n.slice(0, n.indexOf(":")) || t("PREFIXED_ATTRIBUTE_NAME", {
2797
+ detail: `Attribute '${n}' on '${r}' is prefixed — pass a local name plus its namespace instead: { name: '${o(n)}', namespace }.`,
2750
2798
  ref: { tagName: r }
2751
2799
  });
2752
2800
  }
2753
2801
  }
2754
- async function at(e) {
2802
+ async function ut(e) {
2755
2803
  let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, record: o } = e, s = [];
2756
2804
  r.perf.start("core::deepClone"), r.perf.start("core::deepClone::countNodes");
2757
- let c = K(o);
2805
+ let c = dt(o);
2758
2806
  r.perf.stop("core::deepClone::countNodes"), r.progress.plan({ steps: c });
2759
- let l = await ot({
2807
+ let l = await ft({
2760
2808
  dialecteConfig: t,
2761
2809
  hooks: n,
2762
2810
  context: r,
@@ -2770,19 +2818,19 @@ async function at(e) {
2770
2818
  mappings: s
2771
2819
  };
2772
2820
  }
2773
- function K(e) {
2821
+ function dt(e) {
2774
2822
  let t = 1;
2775
- for (let n of e.tree) t += K(n);
2823
+ for (let n of e.tree) t += dt(n);
2776
2824
  return t;
2777
2825
  }
2778
- async function ot(e) {
2826
+ async function ft(e) {
2779
2827
  let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, record: o, mappings: s } = e, c = !0, l = o;
2780
2828
  if (n?.beforeClone) {
2781
2829
  let e = n.beforeClone({ record: o });
2782
2830
  c = e.shouldBeCloned, l = e.transformedRecord;
2783
2831
  }
2784
2832
  if (!c) return l;
2785
- let u = await it({
2833
+ let u = await ct({
2786
2834
  dialecteConfig: t,
2787
2835
  hooks: n,
2788
2836
  context: r,
@@ -2799,7 +2847,7 @@ async function ot(e) {
2799
2847
  source: Object.assign(d, { attributes: [...o.attributes] }),
2800
2848
  target: f(u)
2801
2849
  }), r.progress.nextStep();
2802
- for (let e of l.tree) await ot({
2850
+ for (let e of l.tree) await ft({
2803
2851
  dialecteConfig: t,
2804
2852
  hooks: n,
2805
2853
  context: r,
@@ -2810,78 +2858,78 @@ async function ot(e) {
2810
2858
  });
2811
2859
  return u;
2812
2860
  }
2813
- async function st(e) {
2814
- let { hooks: t, context: n, query: r, ref: i } = e, a = await E({
2861
+ async function pt(e) {
2862
+ let { hooks: t, context: n, query: r, ref: i } = e, o = await O({
2815
2863
  context: n,
2816
2864
  ref: i
2817
2865
  });
2818
- o(a, {
2866
+ a(o, {
2819
2867
  detail: `Record not found (tagName=${i.tagName}, id=${i.id})`,
2820
2868
  key: "ELEMENT_NOT_FOUND",
2821
2869
  ref: i
2822
- }), o(a.parent, {
2870
+ }), a(o.parent, {
2823
2871
  detail: "Cannot delete root element",
2824
2872
  key: "PROTECTED_ROOT"
2825
- }), t?.beforeDelete && rt({
2873
+ }), t?.beforeDelete && st({
2826
2874
  context: n,
2827
2875
  operations: await t.beforeDelete({
2828
- record: a,
2876
+ record: o,
2829
2877
  query: r
2830
2878
  })
2831
- }), await ct({
2879
+ }), await mt({
2832
2880
  context: n,
2833
- record: a
2834
- }), W({
2881
+ record: o
2882
+ }), K({
2835
2883
  context: n,
2836
2884
  status: "deleted",
2837
- record: a
2885
+ record: o
2838
2886
  });
2839
- let s = await E({
2887
+ let s = await O({
2840
2888
  context: n,
2841
- ref: f(a.parent)
2889
+ ref: f(o.parent)
2842
2890
  });
2843
- o(s, {
2844
- detail: `Parent record not found (tagName=${a.parent.tagName}, id=${a.parent.id})`,
2891
+ a(s, {
2892
+ detail: `Parent record not found (tagName=${o.parent.tagName}, id=${o.parent.id})`,
2845
2893
  key: "ELEMENT_NOT_FOUND"
2846
2894
  });
2847
2895
  let c = {
2848
2896
  ...s,
2849
- children: s.children.filter((e) => e.id !== a.id)
2897
+ children: s.children.filter((e) => e.id !== o.id)
2850
2898
  };
2851
- return W({
2899
+ return K({
2852
2900
  context: n,
2853
2901
  status: "updated",
2854
2902
  oldRecord: s,
2855
2903
  newRecord: c
2856
2904
  }), c;
2857
2905
  }
2858
- async function ct(e) {
2906
+ async function mt(e) {
2859
2907
  let { context: t, record: n } = e;
2860
2908
  for (let e of n.children) {
2861
- let n = await E({
2909
+ let n = await O({
2862
2910
  context: t,
2863
2911
  ref: f(e)
2864
2912
  });
2865
- n && (n.children.length > 0 && await ct({
2913
+ n && (n.children.length > 0 && await mt({
2866
2914
  context: t,
2867
2915
  record: n
2868
- }), W({
2916
+ }), K({
2869
2917
  context: t,
2870
2918
  status: "deleted",
2871
2919
  record: n
2872
2920
  }));
2873
2921
  }
2874
2922
  }
2875
- async function lt(e) {
2876
- let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, params: o } = e, s = ut(o.attributes), c = await A({
2923
+ async function q(e) {
2924
+ let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, params: o } = e, s = ht(o.attributes), c = await j({
2877
2925
  context: r,
2878
2926
  ref: a,
2879
2927
  tagName: o.tagName
2880
2928
  });
2881
- return (s ? c.find((e) => M({
2929
+ return (s ? c.find((e) => N({
2882
2930
  record: e,
2883
2931
  attributeFilter: s
2884
- })) : o.id === void 0 ? c[0] : c.find((e) => e.id === o.id)) || it({
2932
+ })) : o.id === void 0 ? c[0] : c.find((e) => e.id === o.id)) || ct({
2885
2933
  dialecteConfig: t,
2886
2934
  hooks: n,
2887
2935
  context: r,
@@ -2890,20 +2938,20 @@ async function lt(e) {
2890
2938
  params: o
2891
2939
  });
2892
2940
  }
2893
- function ut(e) {
2941
+ function ht(e) {
2894
2942
  if (!e) return;
2895
2943
  let t = Array.isArray(e) ? Object.fromEntries(e.map((e) => [e.name, e.value])) : e;
2896
2944
  return Object.values(t).some((e) => e !== void 0 && e !== "") ? t : void 0;
2897
2945
  }
2898
- async function dt(e) {
2899
- let { dialecteConfig: t, hooks: n, context: r, query: i, ref: a, params: c } = e, { attributes: d, value: f } = c, p = await E({
2946
+ async function gt(e) {
2947
+ let { dialecteConfig: t, hooks: n, context: r, query: i, ref: o, params: c } = e, { attributes: d, value: f } = c, p = await O({
2900
2948
  context: r,
2901
- ref: a
2949
+ ref: o
2902
2950
  });
2903
- o(p, {
2904
- detail: `Record not found (tagName=${a.tagName}, id=${a.id})`,
2951
+ a(p, {
2952
+ detail: `Record not found (tagName=${o.tagName}, id=${o.id})`,
2905
2953
  key: "ELEMENT_NOT_FOUND",
2906
- ref: a
2954
+ ref: o
2907
2955
  });
2908
2956
  let m = p.attributes;
2909
2957
  if (d) {
@@ -2927,12 +2975,12 @@ async function dt(e) {
2927
2975
  value: f === void 0 ? p.value : f
2928
2976
  }
2929
2977
  });
2930
- return ft(p, h) ? h : (W({
2978
+ return _t(p, h) ? h : (K({
2931
2979
  context: r,
2932
2980
  status: "updated",
2933
2981
  oldRecord: p,
2934
2982
  newRecord: h
2935
- }), n?.afterUpdated && rt({
2983
+ }), n?.afterUpdated && st({
2936
2984
  context: r,
2937
2985
  operations: await n.afterUpdated({
2938
2986
  oldRecord: p,
@@ -2941,18 +2989,18 @@ async function dt(e) {
2941
2989
  })
2942
2990
  }), h);
2943
2991
  }
2944
- function ft(e, t) {
2945
- return e.value !== t.value || e.attributes.length !== t.attributes.length ? !1 : e.attributes.every((e, n) => pt(e, t.attributes[n]));
2992
+ function _t(e, t) {
2993
+ return e.value !== t.value || e.attributes.length !== t.attributes.length ? !1 : e.attributes.every((e, n) => vt(e, t.attributes[n]));
2946
2994
  }
2947
- function pt(e, t) {
2995
+ function vt(e, t) {
2948
2996
  return e.name === t.name && e.value === t.value && e.namespace?.uri === t.namespace?.uri && e.namespace?.prefix === t.namespace?.prefix;
2949
2997
  }
2950
- var mt = class extends U {
2998
+ var J = class extends ot {
2951
2999
  constructor(e, t, n, r) {
2952
3000
  super(e, t), this.hooks = n, this.query = r;
2953
3001
  }
2954
3002
  async addChild(e, t) {
2955
- return it({
3003
+ return ct({
2956
3004
  context: this.getContext(),
2957
3005
  parentRef: f(e),
2958
3006
  params: {
@@ -2968,7 +3016,7 @@ var mt = class extends U {
2968
3016
  });
2969
3017
  }
2970
3018
  async ensureChild(e, t) {
2971
- return lt({
3019
+ return q({
2972
3020
  context: this.getContext(),
2973
3021
  parentRef: f(e),
2974
3022
  params: {
@@ -2984,7 +3032,7 @@ var mt = class extends U {
2984
3032
  });
2985
3033
  }
2986
3034
  async update(e, t) {
2987
- return dt({
3035
+ return gt({
2988
3036
  context: this.getContext(),
2989
3037
  ref: f(e),
2990
3038
  params: {
@@ -2997,7 +3045,7 @@ var mt = class extends U {
2997
3045
  });
2998
3046
  }
2999
3047
  async delete(e) {
3000
- return st({
3048
+ return pt({
3001
3049
  context: this.getContext(),
3002
3050
  ref: f(e),
3003
3051
  hooks: this.hooks,
@@ -3005,7 +3053,7 @@ var mt = class extends U {
3005
3053
  });
3006
3054
  }
3007
3055
  async deepClone(e, t) {
3008
- return await at({
3056
+ return await ut({
3009
3057
  dialecteConfig: this.dialecteConfig,
3010
3058
  hooks: this.hooks,
3011
3059
  context: this.getContext(),
@@ -3015,7 +3063,7 @@ var mt = class extends U {
3015
3063
  });
3016
3064
  }
3017
3065
  };
3018
- function q(e) {
3066
+ function yt(e) {
3019
3067
  let t = /* @__PURE__ */ new Map();
3020
3068
  for (let n of e) {
3021
3069
  let e = (n.status === "deleted" ? n.oldRecord : n.newRecord).id, r = t.get(e);
@@ -3044,10 +3092,10 @@ function q(e) {
3044
3092
  deletes: n.filter((e) => e.status === "deleted")
3045
3093
  };
3046
3094
  }
3047
- async function ht(e) {
3048
- let { stagedOperations: t, store: n, documentId: r, documentState: i, progress: a, perf: o = $e } = e;
3095
+ async function bt(e) {
3096
+ let { stagedOperations: t, store: n, documentId: r, documentState: i, progress: a, perf: o = U } = e;
3049
3097
  o.start("core::commit"), o.start("core::commit::merge");
3050
- let { creates: s, updates: c, deletes: l } = q(t);
3098
+ let { creates: s, updates: c, deletes: l } = yt(t);
3051
3099
  o.stop("core::commit::merge");
3052
3100
  let u = s.length + c.length + l.length;
3053
3101
  i.loading = !0, a.plan({ steps: u });
@@ -3069,15 +3117,15 @@ async function ht(e) {
3069
3117
  }
3070
3118
  i.lastUpdate = Date.now(), a.endPlan(), o.stop("core::commit");
3071
3119
  }
3072
- var gt = class extends nt {
3073
- constructor(e, t, n, r, i, a = $e, o = () => {}) {
3074
- super(e, t, n, a), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.documentActivity = r, this.hooks = i, this.progressReporter = w(r, o);
3120
+ var xt = class extends G {
3121
+ constructor(e, t, n, r, i, a = U, o = () => {}) {
3122
+ super(e, t, n, a), this.stagedOperations = T(), this.recordCache = /* @__PURE__ */ new Map(), this.documentActivity = r, this.hooks = i, this.progressReporter = w(r, o);
3075
3123
  }
3076
3124
  get progress() {
3077
3125
  return this.progressReporter;
3078
3126
  }
3079
3127
  get any() {
3080
- return this._anyTx ??= new mt(() => this.context, this.dialecteConfig, this.hooks, this);
3128
+ return this._anyTx ??= new J(() => this.context, this.dialecteConfig, this.hooks, this);
3081
3129
  }
3082
3130
  getOperations() {
3083
3131
  return this.stagedOperations;
@@ -3094,7 +3142,7 @@ var gt = class extends nt {
3094
3142
  };
3095
3143
  }
3096
3144
  async addChild(e, t) {
3097
- return it({
3145
+ return ct({
3098
3146
  context: this.context,
3099
3147
  parentRef: f(e),
3100
3148
  params: t,
@@ -3104,7 +3152,7 @@ var gt = class extends nt {
3104
3152
  });
3105
3153
  }
3106
3154
  async ensureChild(e, t) {
3107
- return lt({
3155
+ return q({
3108
3156
  context: this.context,
3109
3157
  parentRef: f(e),
3110
3158
  params: t,
@@ -3114,7 +3162,7 @@ var gt = class extends nt {
3114
3162
  });
3115
3163
  }
3116
3164
  async update(e, t) {
3117
- return dt({
3165
+ return gt({
3118
3166
  context: this.context,
3119
3167
  ref: f(e),
3120
3168
  params: t,
@@ -3124,7 +3172,7 @@ var gt = class extends nt {
3124
3172
  });
3125
3173
  }
3126
3174
  async delete(e) {
3127
- return st({
3175
+ return pt({
3128
3176
  context: this.context,
3129
3177
  ref: f(e),
3130
3178
  hooks: this.hooks,
@@ -3132,7 +3180,7 @@ var gt = class extends nt {
3132
3180
  });
3133
3181
  }
3134
3182
  async deepClone(e, t) {
3135
- return at({
3183
+ return ut({
3136
3184
  dialecteConfig: this.dialecteConfig,
3137
3185
  hooks: this.hooks,
3138
3186
  context: this.context,
@@ -3142,17 +3190,17 @@ var gt = class extends nt {
3142
3190
  });
3143
3191
  }
3144
3192
  getStagedOperations() {
3145
- return this.stagedOperations;
3193
+ return this.stagedOperations.log;
3146
3194
  }
3147
3195
  clearStagedOperations() {
3148
- this.stagedOperations = [];
3196
+ this.stagedOperations = T();
3149
3197
  }
3150
3198
  clearRecordCache() {
3151
3199
  this.recordCache.clear();
3152
3200
  }
3153
3201
  async commit() {
3154
- await ht({
3155
- stagedOperations: this.stagedOperations,
3202
+ await bt({
3203
+ stagedOperations: this.stagedOperations.log,
3156
3204
  store: this.store,
3157
3205
  documentId: this.documentId,
3158
3206
  documentState: this.documentActivity,
@@ -3161,14 +3209,14 @@ var gt = class extends nt {
3161
3209
  });
3162
3210
  }
3163
3211
  };
3164
- function _t(e) {
3212
+ function St(e) {
3165
3213
  return e.recordCache !== void 0;
3166
3214
  }
3167
- var vt = "xel_";
3168
- function J(e) {
3169
- return `${vt}${e}`;
3215
+ var Ct = "xel_";
3216
+ function wt(e) {
3217
+ return `${Ct}${e}`;
3170
3218
  }
3171
- var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3219
+ var Tt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3172
3220
  (function(n, r) {
3173
3221
  typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).Dexie = r();
3174
3222
  })(e, function() {
@@ -3306,22 +3354,22 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3306
3354
  function ie(e) {
3307
3355
  return re.call(e).slice(8, -1);
3308
3356
  }
3309
- var E = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", D = typeof E == "symbol" ? function(e) {
3357
+ var ae = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", E = typeof ae == "symbol" ? function(e) {
3310
3358
  var t;
3311
- return e != null && (t = e[E]) && t.apply(e);
3359
+ return e != null && (t = e[ae]) && t.apply(e);
3312
3360
  } : function() {
3313
3361
  return null;
3314
3362
  };
3315
- function O(e, t) {
3363
+ function D(e, t) {
3316
3364
  return t = e.indexOf(t), 0 <= t && e.splice(t, 1), 0 <= t;
3317
3365
  }
3318
- var k = {};
3319
- function A(e) {
3366
+ var O = {};
3367
+ function k(e) {
3320
3368
  var t, n, r, i;
3321
3369
  if (arguments.length === 1) {
3322
3370
  if (a(e)) return e.slice();
3323
- if (this === k && typeof e == "string") return [e];
3324
- if (i = D(e)) {
3371
+ if (this === O && typeof e == "string") return [e];
3372
+ if (i = E(e)) {
3325
3373
  for (n = []; !(r = i.next()).done;) n.push(r.value);
3326
3374
  return n;
3327
3375
  }
@@ -3332,11 +3380,11 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3332
3380
  for (t = arguments.length, n = Array(t); t--;) n[t] = arguments[t];
3333
3381
  return n;
3334
3382
  }
3335
- var ae = typeof Symbol < "u" ? function(e) {
3383
+ var oe = typeof Symbol < "u" ? function(e) {
3336
3384
  return e[Symbol.toStringTag] === "AsyncFunction";
3337
3385
  } : function() {
3338
3386
  return !1;
3339
- }, j = [
3387
+ }, A = [
3340
3388
  "Unknown",
3341
3389
  "Constraint",
3342
3390
  "Data",
@@ -3351,7 +3399,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3351
3399
  "QuotaExceeded",
3352
3400
  "Syntax",
3353
3401
  "DataClone"
3354
- ], M = [
3402
+ ], j = [
3355
3403
  "Modify",
3356
3404
  "Bulk",
3357
3405
  "OpenFailed",
@@ -3368,47 +3416,47 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3368
3416
  "DatabaseClosed",
3369
3417
  "PrematureCommit",
3370
3418
  "ForeignAwait"
3371
- ].concat(j), oe = {
3419
+ ].concat(A), se = {
3372
3420
  VersionChanged: "Database version changed by other database connection",
3373
3421
  DatabaseClosed: "Database has been closed",
3374
3422
  Abort: "Transaction aborted",
3375
3423
  TransactionInactive: "Transaction has already completed or failed",
3376
3424
  MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"
3377
3425
  };
3378
- function N(e, t) {
3426
+ function M(e, t) {
3379
3427
  this.name = e, this.message = t;
3380
3428
  }
3381
- function P(e, t) {
3429
+ function N(e, t) {
3382
3430
  return e + ". Errors: " + Object.keys(t).map(function(e) {
3383
3431
  return t[e].toString();
3384
3432
  }).filter(function(e, t, n) {
3385
3433
  return n.indexOf(e) === t;
3386
3434
  }).join("\n");
3387
3435
  }
3388
- function se(e, t, n, r) {
3389
- this.failures = t, this.failedKeys = r, this.successCount = n, this.message = P(e, t);
3436
+ function P(e, t, n, r) {
3437
+ this.failures = t, this.failedKeys = r, this.successCount = n, this.message = N(e, t);
3390
3438
  }
3391
3439
  function ce(e, t) {
3392
3440
  this.name = "BulkError", this.failures = Object.keys(t).map(function(e) {
3393
3441
  return t[e];
3394
- }), this.failuresByPos = t, this.message = P(e, this.failures);
3442
+ }), this.failuresByPos = t, this.message = N(e, this.failures);
3395
3443
  }
3396
- p(N).from(Error).extend({ toString: function() {
3444
+ p(M).from(Error).extend({ toString: function() {
3397
3445
  return this.name + ": " + this.message;
3398
- } }), p(se).from(N), p(ce).from(N);
3399
- var le = M.reduce(function(e, t) {
3446
+ } }), p(P).from(M), p(ce).from(M);
3447
+ var le = j.reduce(function(e, t) {
3400
3448
  return e[t] = t + "Error", e;
3401
- }, {}), ue = N, F = M.reduce(function(e, t) {
3449
+ }, {}), ue = M, F = j.reduce(function(e, t) {
3402
3450
  var n = t + "Error";
3403
3451
  function r(e, r) {
3404
- this.name = n, e ? typeof e == "string" ? (this.message = `${e}${r ? "\n " + r : ""}`, this.inner = r || null) : typeof e == "object" && (this.message = `${e.name} ${e.message}`, this.inner = e) : (this.message = oe[t] || n, this.inner = null);
3452
+ this.name = n, e ? typeof e == "string" ? (this.message = `${e}${r ? "\n " + r : ""}`, this.inner = r || null) : typeof e == "object" && (this.message = `${e.name} ${e.message}`, this.inner = e) : (this.message = se[t] || n, this.inner = null);
3405
3453
  }
3406
3454
  return p(r).from(ue), e[t] = r, e;
3407
3455
  }, {});
3408
3456
  F.Syntax = SyntaxError, F.Type = TypeError, F.Range = RangeError;
3409
- var de = j.reduce(function(e, t) {
3457
+ var de = A.reduce(function(e, t) {
3410
3458
  return e[t + "Error"] = F[t], e;
3411
- }, {}), fe = M.reduce(function(e, t) {
3459
+ }, {}), fe = j.reduce(function(e, t) {
3412
3460
  return [
3413
3461
  "Syntax",
3414
3462
  "Type",
@@ -3471,7 +3519,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3471
3519
  return t.apply(this, arguments);
3472
3520
  };
3473
3521
  }
3474
- fe.ModifyError = se, fe.DexieError = N, fe.BulkError = ce;
3522
+ fe.ModifyError = P, fe.DexieError = M, fe.BulkError = ce;
3475
3523
  var L = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
3476
3524
  function xe(e) {
3477
3525
  L = e;
@@ -3489,7 +3537,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3489
3537
  s(t),
3490
3538
  e
3491
3539
  ];
3492
- }(), j = w[0], M = w[1], w = w[2], M = M && M.then, we = j && j.constructor, Te = !!w, Ee = function(e, t) {
3540
+ }(), A = w[0], j = w[1], w = w[2], j = j && j.then, we = A && A.constructor, Te = !!w, Ee = function(e, t) {
3493
3541
  Ne.push([e, t]), Oe &&= (queueMicrotask(He), !1);
3494
3542
  }, De = !0, Oe = !0, ke = [], Ae = [], je = pe, Me = {
3495
3543
  id: "global",
@@ -3530,8 +3578,8 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3530
3578
  get: function() {
3531
3579
  var e = R, t = Xe;
3532
3580
  function n(n, r) {
3533
- var i = this, a = !e.global && (e !== R || t !== Xe), o = a && !H(), s = new z(function(t, s) {
3534
- Be(i, new Le(rt(n, e, a, o), rt(r, e, a, o), t, s, e));
3581
+ var i = this, a = !e.global && (e !== R || t !== Xe), o = a && !$e(), s = new z(function(t, s) {
3582
+ Be(i, new Le(it(n, e, a, o), it(r, e, a, o), t, s, e));
3535
3583
  });
3536
3584
  return this._consoleTask && (s._consoleTask = this._consoleTask), s;
3537
3585
  }
@@ -3590,7 +3638,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3590
3638
  }
3591
3639
  }
3592
3640
  function He() {
3593
- W(Me, function() {
3641
+ U(Me, function() {
3594
3642
  Ue() && We();
3595
3643
  });
3596
3644
  }
@@ -3623,11 +3671,11 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3623
3671
  return function() {
3624
3672
  var r = Ue(), i = R;
3625
3673
  try {
3626
- return U(n, !0), e.apply(this, arguments);
3674
+ return nt(n, !0), e.apply(this, arguments);
3627
3675
  } catch (e) {
3628
3676
  t && t(e);
3629
3677
  } finally {
3630
- U(i, !1), r && We();
3678
+ nt(i, !1), r && We();
3631
3679
  }
3632
3680
  };
3633
3681
  }
@@ -3665,9 +3713,9 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3665
3713
  n.then(r, i).finally(clearTimeout.bind(null, a));
3666
3714
  }) : this;
3667
3715
  }
3668
- }), typeof Symbol < "u" && Symbol.toStringTag && f(z.prototype, Symbol.toStringTag, "Dexie.Promise"), Me.env = nt(), u(z, {
3716
+ }), typeof Symbol < "u" && Symbol.toStringTag && f(z.prototype, Symbol.toStringTag, "Dexie.Promise"), Me.env = rt(), u(z, {
3669
3717
  all: function() {
3670
- var e = A.apply(null, arguments).map(et);
3718
+ var e = k.apply(null, arguments).map(et);
3671
3719
  return new z(function(t, n) {
3672
3720
  e.length === 0 && t([]);
3673
3721
  var r = e.length;
@@ -3685,7 +3733,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3685
3733
  },
3686
3734
  reject: Ke,
3687
3735
  race: function() {
3688
- var e = A.apply(null, arguments).map(et);
3736
+ var e = k.apply(null, arguments).map(et);
3689
3737
  return new z(function(t, n) {
3690
3738
  e.map(function(e) {
3691
3739
  return z.resolve(e).then(t, n);
@@ -3703,8 +3751,8 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3703
3751
  totalEchoes: { get: function() {
3704
3752
  return Xe;
3705
3753
  } },
3706
- newPSD: Qe,
3707
- usePSD: W,
3754
+ newPSD: H,
3755
+ usePSD: U,
3708
3756
  scheduler: {
3709
3757
  get: function() {
3710
3758
  return Ee;
@@ -3723,7 +3771,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3723
3771
  },
3724
3772
  follow: function(e, t) {
3725
3773
  return new z(function(n, r) {
3726
- return Qe(function(t, n) {
3774
+ return H(function(t, n) {
3727
3775
  var r = R;
3728
3776
  r.unhandleds = [], r.onunhandled = n, r.finalize = he(function() {
3729
3777
  var e, r = this;
@@ -3739,7 +3787,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3739
3787
  });
3740
3788
  }
3741
3789
  }), we && (we.allSettled && f(z, "allSettled", function() {
3742
- var e = A.apply(null, arguments).map(et);
3790
+ var e = k.apply(null, arguments).map(et);
3743
3791
  return new z(function(t) {
3744
3792
  e.length === 0 && t([]);
3745
3793
  var n = e.length, r = Array(n);
@@ -3760,7 +3808,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3760
3808
  });
3761
3809
  });
3762
3810
  }), we.any && typeof AggregateError < "u" && f(z, "any", function() {
3763
- var e = A.apply(null, arguments).map(et);
3811
+ var e = k.apply(null, arguments).map(et);
3764
3812
  return new z(function(t, n) {
3765
3813
  e.length === 0 && n(/* @__PURE__ */ AggregateError([]));
3766
3814
  var r = e.length, i = Array(r);
@@ -3778,7 +3826,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3778
3826
  echoes: 0,
3779
3827
  id: 0
3780
3828
  }, qe = 0, Je = [], Ye = 0, Xe = 0, Ze = 0;
3781
- function Qe(e, t, n, r) {
3829
+ function H(e, t, n, r) {
3782
3830
  var i = R, a = Object.create(i);
3783
3831
  return a.parent = i, a.ref = 0, a.global = !1, a.id = ++Ze, Me.env, a.env = Te ? {
3784
3832
  Promise: z,
@@ -3795,32 +3843,32 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3795
3843
  reject: z.reject
3796
3844
  } : {}, t && o(a, t), ++i.ref, a.finalize = function() {
3797
3845
  --this.parent.ref || this.parent.finalize();
3798
- }, r = W(a, e, n, r), a.ref === 0 && a.finalize(), r;
3846
+ }, r = U(a, e, n, r), a.ref === 0 && a.finalize(), r;
3799
3847
  }
3800
- function $e() {
3848
+ function Qe() {
3801
3849
  return V.id ||= ++qe, ++V.awaits, V.echoes += Ce, V.id;
3802
3850
  }
3803
- function H() {
3851
+ function $e() {
3804
3852
  return !!V.awaits && (--V.awaits == 0 && (V.id = 0), V.echoes = V.awaits * Ce, !0);
3805
3853
  }
3806
3854
  function et(e) {
3807
- return V.echoes && e && e.constructor === we ? ($e(), e.then(function(e) {
3808
- return H(), e;
3855
+ return V.echoes && e && e.constructor === we ? (Qe(), e.then(function(e) {
3856
+ return $e(), e;
3809
3857
  }, function(e) {
3810
- return H(), G(e);
3858
+ return $e(), W(e);
3811
3859
  })) : e;
3812
3860
  }
3813
3861
  function tt() {
3814
3862
  var e = Je[Je.length - 1];
3815
- Je.pop(), U(e, !1);
3863
+ Je.pop(), nt(e, !1);
3816
3864
  }
3817
- function U(e, t) {
3865
+ function nt(e, t) {
3818
3866
  var n, i = R;
3819
3867
  (t ? !V.echoes || Ye++ && e === R : !Ye || --Ye && e === R) || queueMicrotask(t ? function(e) {
3820
- ++Xe, V.echoes && --V.echoes != 0 || (V.echoes = V.awaits = V.id = 0), Je.push(R), U(e, !0);
3821
- }.bind(null, e) : tt), e !== R && (R = e, i === Me && (Me.env = nt()), Te && (n = Me.env.Promise, t = e.env, (i.global || e.global) && (Object.defineProperty(r, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
3868
+ ++Xe, V.echoes && --V.echoes != 0 || (V.echoes = V.awaits = V.id = 0), Je.push(R), nt(e, !0);
3869
+ }.bind(null, e) : tt), e !== R && (R = e, i === Me && (Me.env = rt()), Te && (n = Me.env.Promise, t = e.env, (i.global || e.global) && (Object.defineProperty(r, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
3822
3870
  }
3823
- function nt() {
3871
+ function rt() {
3824
3872
  var e = r.Promise;
3825
3873
  return Te ? {
3826
3874
  Promise: e,
@@ -3833,30 +3881,30 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3833
3881
  reject: e.reject
3834
3882
  } : {};
3835
3883
  }
3836
- function W(e, t, n, r, i) {
3884
+ function U(e, t, n, r, i) {
3837
3885
  var a = R;
3838
3886
  try {
3839
- return U(e, !0), t(n, r, i);
3887
+ return nt(e, !0), t(n, r, i);
3840
3888
  } finally {
3841
- U(a, !1);
3889
+ nt(a, !1);
3842
3890
  }
3843
3891
  }
3844
- function rt(e, t, n, r) {
3892
+ function it(e, t, n, r) {
3845
3893
  return typeof e == "function" ? function() {
3846
3894
  var i = R;
3847
- n && $e(), U(t, !0);
3895
+ n && Qe(), nt(t, !0);
3848
3896
  try {
3849
3897
  return e.apply(this, arguments);
3850
3898
  } finally {
3851
- U(i, !1), r && queueMicrotask(H);
3899
+ nt(i, !1), r && queueMicrotask($e);
3852
3900
  }
3853
3901
  } : e;
3854
3902
  }
3855
- function it(e) {
3903
+ function at(e) {
3856
3904
  Promise === we && V.echoes === 0 ? Ye === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
3857
3905
  }
3858
- ("" + M).indexOf("[native code]") === -1 && ($e = H = I);
3859
- var G = z.reject, at = "￿", K = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", ot = "String expected.", st = [], ct = "__dbnames", lt = "readonly", ut = "readwrite";
3906
+ ("" + j).indexOf("[native code]") === -1 && (Qe = $e = I);
3907
+ var W = z.reject, ot = "￿", G = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", K = "String expected.", st = [], ct = "__dbnames", lt = "readonly", ut = "readwrite";
3860
3908
  function dt(e, t) {
3861
3909
  return e ? t ? function() {
3862
3910
  return e.apply(this, arguments) && t.apply(this, arguments);
@@ -3927,7 +3975,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3927
3975
  }
3928
3976
  var s = Ue();
3929
3977
  try {
3930
- var c = r && r.db._novip === this.db._novip ? r === R.trans ? r._promise(e, o, n) : Qe(function() {
3978
+ var c = r && r.db._novip === this.db._novip ? r === R.trans ? r._promise(e, o, n) : H(function() {
3931
3979
  return r._promise(e, o, n);
3932
3980
  }, {
3933
3981
  trans: r,
@@ -3940,10 +3988,10 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3940
3988
  } catch (a) {
3941
3989
  return a.name === le.InvalidState && t.isOpen() && 0 < --t._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), t.close({ disableAutoOpen: !1 }), t.open().then(function() {
3942
3990
  return e(t, n, r, i);
3943
- })) : G(a);
3991
+ })) : W(a);
3944
3992
  }
3945
3993
  return a._promise(n, function(e, t) {
3946
- return Qe(function() {
3994
+ return H(function() {
3947
3995
  return R.trans = a, i(e, t, a);
3948
3996
  });
3949
3997
  }).then(function(e) {
@@ -3955,9 +4003,9 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3955
4003
  });
3956
4004
  });
3957
4005
  }
3958
- if (t._state.openComplete) return G(new F.DatabaseClosed(t._state.dbOpenError));
4006
+ if (t._state.openComplete) return W(new F.DatabaseClosed(t._state.dbOpenError));
3959
4007
  if (!t._state.isBeingOpened) {
3960
- if (!t._state.autoOpen) return G(new F.DatabaseClosed());
4008
+ if (!t._state.autoOpen) return W(new F.DatabaseClosed());
3961
4009
  t.open().catch(I);
3962
4010
  }
3963
4011
  return t._state.dbReadyPromise.then(function() {
@@ -3965,14 +4013,14 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3965
4013
  });
3966
4014
  }(this.db, e, [this.name], o);
3967
4015
  return a && (c._consoleTask = a, c = c.catch(function(e) {
3968
- return console.trace(e), G(e);
4016
+ return console.trace(e), W(e);
3969
4017
  })), c;
3970
4018
  } finally {
3971
4019
  s && We();
3972
4020
  }
3973
4021
  }, J.prototype.get = function(e, t) {
3974
4022
  var n = this;
3975
- return e && e.constructor === Object ? this.where(e).first(t) : e == null ? G(new F.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(t) {
4023
+ return e && e.constructor === Object ? this.where(e).first(t) : e == null ? W(new F.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(t) {
3976
4024
  return n.core.get({
3977
4025
  trans: t,
3978
4026
  key: e
@@ -3996,7 +4044,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
3996
4044
  }).sort(function(e, t) {
3997
4045
  return e.keyPath.length - t.keyPath.length;
3998
4046
  })[0];
3999
- if (n && this.db._maxKey !== at) {
4047
+ if (n && this.db._maxKey !== ot) {
4000
4048
  var r = n.keyPath.slice(0, t.length);
4001
4049
  return this.where(r).equals(r.map(function(t) {
4002
4050
  return e[t];
@@ -4090,7 +4138,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4090
4138
  return t;
4091
4139
  });
4092
4140
  }, J.prototype.update = function(e, t) {
4093
- return typeof e != "object" || a(e) ? this.where(":id").equals(e).modify(t) : (e = b(e, this.schema.primKey.keyPath), e === void 0 ? G(new F.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
4141
+ return typeof e != "object" || a(e) ? this.where(":id").equals(e).modify(t) : (e = b(e, this.schema.primKey.keyPath), e === void 0 ? W(new F.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
4094
4142
  }, J.prototype.put = function(e, t) {
4095
4143
  var n = this, r = this.schema.primKey, i = r.auto, a = r.keyPath, o = e;
4096
4144
  return a && i && (o = pt(a)(e)), this._trans("readwrite", function(e) {
@@ -4397,10 +4445,10 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4397
4445
  }
4398
4446
  var At = (Y.prototype._read = function(e, t) {
4399
4447
  var n = this._ctx;
4400
- return n.error ? n.table._trans(null, G.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
4448
+ return n.error ? n.table._trans(null, W.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
4401
4449
  }, Y.prototype._write = function(e) {
4402
4450
  var t = this._ctx;
4403
- return t.error ? t.table._trans(null, G.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
4451
+ return t.error ? t.table._trans(null, W.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
4404
4452
  }, Y.prototype._addAlgorithm = function(e) {
4405
4453
  var t = this._ctx;
4406
4454
  t.algorithm = dt(t.algorithm, e);
@@ -4655,7 +4703,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4655
4703
  range: n.range
4656
4704
  };
4657
4705
  return i(0).then(function() {
4658
- if (0 < m.length) throw new se("Error modifying one or more objects", m, h, g);
4706
+ if (0 < m.length) throw new P("Error modifying one or more objects", m, h, g);
4659
4707
  return t.length;
4660
4708
  });
4661
4709
  });
@@ -4677,7 +4725,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4677
4725
  range: i
4678
4726
  }).then(function(e) {
4679
4727
  var n = e.failures, e = e.numFailures;
4680
- if (e) throw new se("Could not delete some values", Object.keys(n).map(function(e) {
4728
+ if (e) throw new P("Could not delete some values", Object.keys(n).map(function(e) {
4681
4729
  return n[e];
4682
4730
  }), t - e);
4683
4731
  return t - e;
@@ -4707,7 +4755,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4707
4755
  var i, a, o, s, c, l, u, d = n.length;
4708
4756
  if (!n.every(function(e) {
4709
4757
  return typeof e == "string";
4710
- })) return X(e, ot);
4758
+ })) return X(e, K);
4711
4759
  function f(e) {
4712
4760
  i = e === "next" ? function(e) {
4713
4761
  return e.toUpperCase();
@@ -4788,56 +4836,56 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4788
4836
  return It(e, t, !n, !r);
4789
4837
  });
4790
4838
  } catch {
4791
- return X(this, K);
4839
+ return X(this, G);
4792
4840
  }
4793
4841
  }, Z.prototype.equals = function(e) {
4794
- return e == null ? X(this, K) : new this.Collection(this, function() {
4842
+ return e == null ? X(this, G) : new this.Collection(this, function() {
4795
4843
  return Lt(e);
4796
4844
  });
4797
4845
  }, Z.prototype.above = function(e) {
4798
- return e == null ? X(this, K) : new this.Collection(this, function() {
4846
+ return e == null ? X(this, G) : new this.Collection(this, function() {
4799
4847
  return It(e, void 0, !0);
4800
4848
  });
4801
4849
  }, Z.prototype.aboveOrEqual = function(e) {
4802
- return e == null ? X(this, K) : new this.Collection(this, function() {
4850
+ return e == null ? X(this, G) : new this.Collection(this, function() {
4803
4851
  return It(e, void 0, !1);
4804
4852
  });
4805
4853
  }, Z.prototype.below = function(e) {
4806
- return e == null ? X(this, K) : new this.Collection(this, function() {
4854
+ return e == null ? X(this, G) : new this.Collection(this, function() {
4807
4855
  return It(void 0, e, !1, !0);
4808
4856
  });
4809
4857
  }, Z.prototype.belowOrEqual = function(e) {
4810
- return e == null ? X(this, K) : new this.Collection(this, function() {
4858
+ return e == null ? X(this, G) : new this.Collection(this, function() {
4811
4859
  return It(void 0, e);
4812
4860
  });
4813
4861
  }, Z.prototype.startsWith = function(e) {
4814
- return typeof e == "string" ? this.between(e, e + at, !0, !0) : X(this, ot);
4862
+ return typeof e == "string" ? this.between(e, e + ot, !0, !0) : X(this, K);
4815
4863
  }, Z.prototype.startsWithIgnoreCase = function(e) {
4816
4864
  return e === "" ? this.startsWith(e) : Ft(this, function(e, t) {
4817
4865
  return e.indexOf(t[0]) === 0;
4818
- }, [e], at);
4866
+ }, [e], ot);
4819
4867
  }, Z.prototype.equalsIgnoreCase = function(e) {
4820
4868
  return Ft(this, function(e, t) {
4821
4869
  return e === t[0];
4822
4870
  }, [e], "");
4823
4871
  }, Z.prototype.anyOfIgnoreCase = function() {
4824
- var e = A.apply(k, arguments);
4872
+ var e = k.apply(O, arguments);
4825
4873
  return e.length === 0 ? Pt(this) : Ft(this, function(e, t) {
4826
4874
  return t.indexOf(e) !== -1;
4827
4875
  }, e, "");
4828
4876
  }, Z.prototype.startsWithAnyOfIgnoreCase = function() {
4829
- var e = A.apply(k, arguments);
4877
+ var e = k.apply(O, arguments);
4830
4878
  return e.length === 0 ? Pt(this) : Ft(this, function(e, t) {
4831
4879
  return t.some(function(t) {
4832
4880
  return e.indexOf(t) === 0;
4833
4881
  });
4834
- }, e, at);
4882
+ }, e, ot);
4835
4883
  }, Z.prototype.anyOf = function() {
4836
- var e = this, t = A.apply(k, arguments), n = this._cmp;
4884
+ var e = this, t = k.apply(O, arguments), n = this._cmp;
4837
4885
  try {
4838
4886
  t.sort(n);
4839
4887
  } catch {
4840
- return X(this, K);
4888
+ return X(this, G);
4841
4889
  }
4842
4890
  if (t.length === 0) return Pt(this);
4843
4891
  var r = new this.Collection(this, function() {
@@ -4859,12 +4907,12 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4859
4907
  includeUppers: !1
4860
4908
  });
4861
4909
  }, Z.prototype.noneOf = function() {
4862
- var e = A.apply(k, arguments);
4910
+ var e = k.apply(O, arguments);
4863
4911
  if (e.length === 0) return new this.Collection(this);
4864
4912
  try {
4865
4913
  e.sort(this._ascending);
4866
4914
  } catch {
4867
- return X(this, K);
4915
+ return X(this, G);
4868
4916
  }
4869
4917
  var t = e.reduce(function(e, t) {
4870
4918
  return e ? e.concat([[e[e.length - 1][1], t]]) : [[-Infinity, t]];
@@ -4895,7 +4943,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4895
4943
  return n === i && e.push(t), e;
4896
4944
  }, [])).sort(f);
4897
4945
  } catch {
4898
- return X(this, K);
4946
+ return X(this, G);
4899
4947
  }
4900
4948
  var p = 0, m = l ? function(e) {
4901
4949
  return 0 < i(e, u[p][1]);
@@ -4917,11 +4965,11 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4917
4965
  }), !1);
4918
4966
  }), e;
4919
4967
  }, Z.prototype.startsWithAnyOf = function() {
4920
- var e = A.apply(k, arguments);
4968
+ var e = k.apply(O, arguments);
4921
4969
  return e.every(function(e) {
4922
4970
  return typeof e == "string";
4923
4971
  }) ? e.length === 0 ? Pt(this) : this.inAnyRange(e.map(function(e) {
4924
- return [e, e + at];
4972
+ return [e, e + ot];
4925
4973
  })) : X(this, "startsWithAnyOf() only works with strings");
4926
4974
  }, Z);
4927
4975
  function Z() {}
@@ -4939,7 +4987,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4939
4987
  if (v(!R.global), --this._reculock == 0) for (R.global || (R.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked();) {
4940
4988
  var e = this._blockedFuncs.shift();
4941
4989
  try {
4942
- W(e[1], e[0]);
4990
+ U(e[1], e[0]);
4943
4991
  } catch {}
4944
4992
  }
4945
4993
  return this;
@@ -4964,14 +5012,14 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
4964
5012
  }), this;
4965
5013
  }, Gt.prototype._promise = function(e, t, n) {
4966
5014
  var r = this;
4967
- if (e === "readwrite" && this.mode !== "readwrite") return G(new F.ReadOnly("Transaction is readonly"));
4968
- if (!this.active) return G(new F.TransactionInactive());
5015
+ if (e === "readwrite" && this.mode !== "readwrite") return W(new F.ReadOnly("Transaction is readonly"));
5016
+ if (!this.active) return W(new F.TransactionInactive());
4969
5017
  if (this._locked()) return new z(function(i, a) {
4970
5018
  r._blockedFuncs.push([function() {
4971
5019
  r._promise(e, t, n).then(i, a);
4972
5020
  }, R]);
4973
5021
  });
4974
- if (n) return Qe(function() {
5022
+ if (n) return H(function() {
4975
5023
  var e = new z(function(e, n) {
4976
5024
  r._lock();
4977
5025
  var i = t(e, n, r);
@@ -5052,8 +5100,8 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
5052
5100
  }, [[]];
5053
5101
  } catch {
5054
5102
  return Yt = function() {
5055
- return at;
5056
- }, at;
5103
+ return ot;
5104
+ }, ot;
5057
5105
  }
5058
5106
  };
5059
5107
  function Xt(e) {
@@ -5324,7 +5372,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
5324
5372
  var o = e._createTransaction("readwrite", e._storeNames, a);
5325
5373
  o.create(n), o._completion.catch(r);
5326
5374
  var s = o._reject.bind(o), c = R.transless || R;
5327
- Qe(function() {
5375
+ H(function() {
5328
5376
  return R.trans = o, R.transless = c, t === 0 ? (i(a).forEach(function(e) {
5329
5377
  un(n, e, a[e].primKey, a[e].indexes);
5330
5378
  }), nn(e, n), void z.follow(function() {
@@ -5359,10 +5407,10 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
5359
5407
  o.del.forEach(function(e) {
5360
5408
  d[e] = t[e];
5361
5409
  }), an(r, [r.Transaction.prototype]), rn(r, [r.Transaction.prototype], i(d), d), s.schema = d;
5362
- var f, p = ae(l);
5363
- return p && $e(), o = z.follow(function() {
5410
+ var f, p = oe(l);
5411
+ return p && Qe(), o = z.follow(function() {
5364
5412
  var e;
5365
- (f = l(s)) && p && (e = H.bind(null, null), f.then(e, e));
5413
+ (f = l(s)) && p && (e = $e.bind(null, null), f.then(e, e));
5366
5414
  }), f && typeof f.then == "function" ? z.resolve(f) : o.then(function() {
5367
5415
  return f;
5368
5416
  });
@@ -5526,7 +5574,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
5526
5574
  return e && typeof e.databases == "function";
5527
5575
  }
5528
5576
  function bn(e) {
5529
- return Qe(function() {
5577
+ return H(function() {
5530
5578
  return R.letThrough = !0, e();
5531
5579
  });
5532
5580
  }
@@ -5642,7 +5690,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
5642
5690
  return t[n] && wn(t[n], e[n]);
5643
5691
  });
5644
5692
  }
5645
- u(Q.prototype, ((M = {
5693
+ u(Q.prototype, ((j = {
5646
5694
  add: function(e) {
5647
5695
  return Cn(this, e), this;
5648
5696
  },
@@ -5659,9 +5707,9 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
5659
5707
  var t = Tn(this).next(e).value;
5660
5708
  return t && q(t.from, e) <= 0 && 0 <= q(t.to, e);
5661
5709
  }
5662
- })[E] = function() {
5710
+ })[ae] = function() {
5663
5711
  return Tn(this);
5664
- }, M));
5712
+ }, j));
5665
5713
  var An = {}, jn = {}, Mn = !1;
5666
5714
  function Nn(e) {
5667
5715
  On(jn, e), Mn || (Mn = !0, setTimeout(function() {
@@ -5698,7 +5746,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
5698
5746
  function In(e) {
5699
5747
  var t = e._state, n = e._deps.indexedDB;
5700
5748
  if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then(function() {
5701
- return t.dbOpenError ? G(t.dbOpenError) : e;
5749
+ return t.dbOpenError ? W(t.dbOpenError) : e;
5702
5750
  });
5703
5751
  t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
5704
5752
  var r = t.openCanceller, a = Math.round(10 * e.verno), o = !1;
@@ -5768,7 +5816,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
5768
5816
  try {
5769
5817
  d && d.abort();
5770
5818
  } catch {}
5771
- return r === t.openCanceller && e._close(), G(n);
5819
+ return r === t.openCanceller && e._close(), W(n);
5772
5820
  }).finally(function() {
5773
5821
  t.openComplete = !0, u();
5774
5822
  }).then(function() {
@@ -6236,7 +6284,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6236
6284
  e.subscribers.add(n), r.addEventListener("abort", function() {
6237
6285
  var r, i;
6238
6286
  e.subscribers.delete(n), e.subscribers.size === 0 && (r = e, i = t, setTimeout(function() {
6239
- r.subscribers.size === 0 && O(i, r);
6287
+ r.subscribers.size === 0 && D(i, r);
6240
6288
  }, 3e3));
6241
6289
  });
6242
6290
  }
@@ -6258,16 +6306,16 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6258
6306
  var f = e.table(u), p = d.optimisticOps.filter(function(e) {
6259
6307
  return e.trans === s;
6260
6308
  });
6261
- if (s._explicit && i && s.mutatedParts) for (var m = 0, h = Object.values(d.queries.query); m < h.length; m++) for (var g = 0, _ = (b = h[m]).slice(); g < _.length; g++) kn((x = _[g]).obsSet, s.mutatedParts) && (O(b, x), x.subscribers.forEach(function(e) {
6309
+ if (s._explicit && i && s.mutatedParts) for (var m = 0, h = Object.values(d.queries.query); m < h.length; m++) for (var g = 0, _ = (b = h[m]).slice(); g < _.length; g++) kn((x = _[g]).obsSet, s.mutatedParts) && (D(b, x), x.subscribers.forEach(function(e) {
6262
6310
  return o.add(e);
6263
6311
  }));
6264
6312
  else if (0 < p.length) {
6265
6313
  d.optimisticOps = d.optimisticOps.filter(function(e) {
6266
6314
  return e.trans !== s;
6267
6315
  });
6268
- for (var v = 0, y = Object.values(d.queries.query); v < y.length; v++) for (var b, x, S, C = 0, ee = (b = y[v]).slice(); C < ee.length; C++) (x = ee[C]).res != null && s.mutatedParts && (i && !x.dirty ? (S = Object.isFrozen(x.res), S = Xn(x.res, x.req, p, f, x, S), x.dirty ? (O(b, x), x.subscribers.forEach(function(e) {
6316
+ for (var v = 0, y = Object.values(d.queries.query); v < y.length; v++) for (var b, x, S, C = 0, ee = (b = y[v]).slice(); C < ee.length; C++) (x = ee[C]).res != null && s.mutatedParts && (i && !x.dirty ? (S = Object.isFrozen(x.res), S = Xn(x.res, x.req, p, f, x, S), x.dirty ? (D(b, x), x.subscribers.forEach(function(e) {
6269
6317
  return o.add(e);
6270
- })) : S !== x.res && (x.res = S, x.promise = z.resolve({ result: S }))) : (x.dirty && O(b, x), x.subscribers.forEach(function(e) {
6318
+ })) : S !== x.res && (x.res = S, x.promise = z.resolve({ result: S }))) : (x.dirty && D(b, x), x.subscribers.forEach(function(e) {
6271
6319
  return o.add(e);
6272
6320
  })));
6273
6321
  }
@@ -6290,9 +6338,9 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6290
6338
  return s ? (o = i.mutate(e), e.type !== "add" && e.type !== "put" || !(50 <= e.values.length || Vn(a, e).some(function(e) {
6291
6339
  return e == null;
6292
6340
  })) ? (s.optimisticOps.push(e), e.mutatedParts && Nn(e.mutatedParts), o.then(function(t) {
6293
- 0 < t.numFailures && (O(s.optimisticOps, e), (t = Jn(0, e, t)) && s.optimisticOps.push(t), e.mutatedParts && Nn(e.mutatedParts));
6341
+ 0 < t.numFailures && (D(s.optimisticOps, e), (t = Jn(0, e, t)) && s.optimisticOps.push(t), e.mutatedParts && Nn(e.mutatedParts));
6294
6342
  }), o.catch(function() {
6295
- O(s.optimisticOps, e), e.mutatedParts && Nn(e.mutatedParts);
6343
+ D(s.optimisticOps, e), e.mutatedParts && Nn(e.mutatedParts);
6296
6344
  })) : o.then(function(n) {
6297
6345
  var r = Jn(0, t(t({}, e), { values: e.values.map(function(e, r) {
6298
6346
  var i;
@@ -6357,7 +6405,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6357
6405
  } else e.result = ne(n);
6358
6406
  return e;
6359
6407
  }).catch(function(e) {
6360
- return d && l && O(d, l), Promise.reject(e);
6408
+ return d && l && D(d, l), Promise.reject(e);
6361
6409
  }), l = {
6362
6410
  obsSet: e.obsSet,
6363
6411
  promise: a,
@@ -6425,7 +6473,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6425
6473
  })), this;
6426
6474
  }, $.prototype.open = function() {
6427
6475
  var e = this;
6428
- return W(Me, function() {
6476
+ return U(Me, function() {
6429
6477
  return In(e);
6430
6478
  });
6431
6479
  }, $.prototype._close = function() {
@@ -6522,7 +6570,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6522
6570
  } catch (e) {
6523
6571
  return i ? i._promise(null, function(t, n) {
6524
6572
  n(e);
6525
- }) : G(e);
6573
+ }) : W(e);
6526
6574
  }
6527
6575
  var c = function e(t, n, r, i, a) {
6528
6576
  return z.resolve().then(function() {
@@ -6536,14 +6584,14 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6536
6584
  } catch (i) {
6537
6585
  return i.name === le.InvalidState && t.isOpen() && 0 < --t._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), t.close({ disableAutoOpen: !1 }), t.open().then(function() {
6538
6586
  return e(t, n, r, null, a);
6539
- })) : G(i);
6587
+ })) : W(i);
6540
6588
  }
6541
- var c, l = ae(a);
6542
- return l && $e(), o = z.follow(function() {
6589
+ var c, l = oe(a);
6590
+ return l && Qe(), o = z.follow(function() {
6543
6591
  var e;
6544
- (c = a.call(s, s)) && (l ? (e = H.bind(null, null), c.then(e, e)) : typeof c.next == "function" && typeof c.throw == "function" && (c = Ln(c)));
6592
+ (c = a.call(s, s)) && (l ? (e = $e.bind(null, null), c.then(e, e)) : typeof c.next == "function" && typeof c.throw == "function" && (c = Ln(c)));
6545
6593
  }, o), (c && typeof c.then == "function" ? z.resolve(c).then(function(e) {
6546
- return s.active ? e : G(new F.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
6594
+ return s.active ? e : W(new F.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
6547
6595
  }) : o.then(function() {
6548
6596
  return c;
6549
6597
  })).then(function(e) {
@@ -6551,11 +6599,11 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6551
6599
  return e;
6552
6600
  });
6553
6601
  }).catch(function(e) {
6554
- return s._reject(e), G(e);
6602
+ return s._reject(e), W(e);
6555
6603
  });
6556
6604
  });
6557
6605
  }.bind(null, this, a, o, i, n);
6558
- return i ? i._promise(a, c, "lock") : R.trans ? W(R.transless, function() {
6606
+ return i ? i._promise(a, c, "lock") : R.trans ? U(R.transless, function() {
6559
6607
  return r._whenReady(c);
6560
6608
  }) : this._whenReady(c);
6561
6609
  }, $.prototype.table = function(e) {
@@ -6655,7 +6703,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6655
6703
  a.active = !1, a.on.complete.fire();
6656
6704
  }, function(e) {
6657
6705
  var t = a.active;
6658
- return a.active = !1, a.on.error.fire(e), a.parent ? a.parent._reject(e) : t && a.idbtrans && a.idbtrans.abort(), G(e);
6706
+ return a.active = !1, a.on.error.fire(e), a.parent ? a.parent._reject(e) : t && a.idbtrans && a.idbtrans.abort(), W(e);
6659
6707
  });
6660
6708
  })), this.Version = (c = this, bt(gn.prototype, function(e) {
6661
6709
  this.db = c, this._cfg = {
@@ -6706,13 +6754,13 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6706
6754
  return e(r);
6707
6755
  });
6708
6756
  }
6709
- var rr, M = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", ir = (ar.prototype.subscribe = function(e, t, n) {
6757
+ var rr, j = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", ir = (ar.prototype.subscribe = function(e, t, n) {
6710
6758
  return this._subscribe(e && typeof e != "function" ? e : {
6711
6759
  next: e,
6712
6760
  error: t,
6713
6761
  complete: n
6714
6762
  });
6715
- }, ar.prototype[M] = function() {
6763
+ }, ar.prototype[j] = function() {
6716
6764
  return this;
6717
6765
  }, ar);
6718
6766
  function ar(e) {
@@ -6731,7 +6779,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6731
6779
  }
6732
6780
  function or(e) {
6733
6781
  var t, n = !1, r = new ir(function(r) {
6734
- var i = ae(e), a, o = !1, s = {}, c = {}, u = {
6782
+ var i = oe(e), a, o = !1, s = {}, c = {}, u = {
6735
6783
  get closed() {
6736
6784
  return o;
6737
6785
  },
@@ -6741,7 +6789,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6741
6789
  };
6742
6790
  r.start && r.start(u);
6743
6791
  var d = !1, f = function() {
6744
- return it(m);
6792
+ return at(m);
6745
6793
  }, p = function(e) {
6746
6794
  On(s, e), kn(c, s) && f();
6747
6795
  }, m = function() {
@@ -6749,9 +6797,9 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6749
6797
  !o && rr.indexedDB && (s = {}, u = {}, a && a.abort(), a = new AbortController(), h = function(t) {
6750
6798
  var n = Ue();
6751
6799
  try {
6752
- i && $e();
6753
- var r = Qe(e, t);
6754
- return r = i ? r.finally(H) : r;
6800
+ i && Qe();
6801
+ var r = H(e, t);
6802
+ return r = i ? r.finally($e) : r;
6755
6803
  } finally {
6756
6804
  n && We();
6757
6805
  }
@@ -6765,11 +6813,11 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6765
6813
  n = !0, t = e, o || m.signal.aborted || (s = {}, function(e) {
6766
6814
  for (var t in e) if (l(e, t)) return;
6767
6815
  return 1;
6768
- }(c = u) || d || (Ut(Vt, p), d = !0), it(function() {
6816
+ }(c = u) || d || (Ut(Vt, p), d = !0), at(function() {
6769
6817
  return !o && r.next && r.next(e);
6770
6818
  }));
6771
6819
  }, function(e) {
6772
- n = !1, ["DatabaseClosedError", "AbortError"].includes(e?.name) || o || it(function() {
6820
+ n = !1, ["DatabaseClosedError", "AbortError"].includes(e?.name) || o || at(function() {
6773
6821
  o || r.error && r.error(e);
6774
6822
  });
6775
6823
  }));
@@ -6812,7 +6860,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6812
6860
  });
6813
6861
  }) : vn(n, t).toCollection().primaryKeys()).then(e);
6814
6862
  } catch {
6815
- return G(new F.MissingAPI());
6863
+ return W(new F.MissingAPI());
6816
6864
  }
6817
6865
  var t, n;
6818
6866
  },
@@ -6822,7 +6870,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6822
6870
  };
6823
6871
  },
6824
6872
  ignoreTransaction: function(e) {
6825
- return R.trans ? W(R.transless, e) : e();
6873
+ return R.trans ? U(R.transless, e) : e();
6826
6874
  },
6827
6875
  vip: bn,
6828
6876
  async: function(e) {
@@ -6831,7 +6879,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6831
6879
  var t = Ln(e.apply(this, arguments));
6832
6880
  return t && typeof t.then == "function" ? t : z.resolve(t);
6833
6881
  } catch (e) {
6834
- return G(e);
6882
+ return W(e);
6835
6883
  }
6836
6884
  };
6837
6885
  },
@@ -6840,7 +6888,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6840
6888
  var r = Ln(e.apply(n, t || []));
6841
6889
  return r && typeof r.then == "function" ? r : z.resolve(r);
6842
6890
  } catch (e) {
6843
- return G(e);
6891
+ return W(e);
6844
6892
  }
6845
6893
  },
6846
6894
  currentTransaction: { get: function() {
@@ -6910,7 +6958,7 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6910
6958
  }), addEventListener("pageshow", function(e) {
6911
6959
  !nr.disableBfCache && e.persisted && (L && console.debug("Dexie: handling persisted pageshow"), dr(), cr({ all: new Q(-Infinity, [[]]) }));
6912
6960
  })), z.rejectionMapper = function(e, t) {
6913
- return !e || e instanceof N || e instanceof TypeError || e instanceof SyntaxError || !e.name || !de[e.name] ? e : (t = new de[e.name](t || e.message, e), "stack" in e && f(t, "stack", { get: function() {
6961
+ return !e || e instanceof M || e instanceof TypeError || e instanceof SyntaxError || !e.name || !de[e.name] ? e : (t = new de[e.name](t || e.message, e), "stack" in e && f(t, "stack", { get: function() {
6914
6962
  return this.inner.stack;
6915
6963
  } }), t);
6916
6964
  }, xe(L), t(nr, Object.freeze({
@@ -6935,9 +6983,9 @@ var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
6935
6983
  rangesOverlap: wn
6936
6984
  }), { default: nr }), nr;
6937
6985
  });
6938
- })))(), 1), bt = Symbol.for("Dexie"), xt = globalThis[bt] || (globalThis[bt] = yt.default);
6939
- if (yt.default.semVer !== xt.semVer) throw Error(`Two different versions of Dexie loaded in the same app: ${yt.default.semVer} and ${xt.semVer}`);
6940
- var { liveQuery: St, mergeRanges: Ct, rangesOverlap: wt, RangeSet: Tt, cmp: Et, Entity: Dt, PropModification: Ot, replacePrefix: kt, add: At, remove: Y, DexieYProvider: jt } = xt;
6986
+ })))(), 1), Et = Symbol.for("Dexie"), Dt = globalThis[Et] || (globalThis[Et] = Tt.default);
6987
+ if (Tt.default.semVer !== Dt.semVer) throw Error(`Two different versions of Dexie loaded in the same app: ${Tt.default.semVer} and ${Dt.semVer}`);
6988
+ var { liveQuery: Ot, mergeRanges: kt, rangesOverlap: At, RangeSet: Y, cmp: jt, Entity: Mt, PropModification: Nt, replacePrefix: X, add: Pt, remove: Ft, DexieYProvider: It } = Dt;
6941
6989
  (class e {
6942
6990
  static {
6943
6991
  this.reconcileWarned = !1;
@@ -6957,7 +7005,7 @@ var { liveQuery: St, mergeRanges: Ct, rangesOverlap: wt, RangeSet: Tt, cmp: Et,
6957
7005
  return this.documents.has(e);
6958
7006
  }
6959
7007
  async registerDocument(e) {
6960
- this.guardWritable(), this.documents.set(e.id, e), this.records.set(J(e.id), /* @__PURE__ */ new Map()), this.blobData.set(e.id, /* @__PURE__ */ new Map());
7008
+ this.guardWritable(), this.documents.set(e.id, e), this.records.set(wt(e.id), /* @__PURE__ */ new Map()), this.blobData.set(e.id, /* @__PURE__ */ new Map());
6961
7009
  }
6962
7010
  async getDocument(e) {
6963
7011
  return this.documents.get(e);
@@ -6974,7 +7022,7 @@ var { liveQuery: St, mergeRanges: Ct, rangesOverlap: wt, RangeSet: Tt, cmp: Et,
6974
7022
  });
6975
7023
  }
6976
7024
  async removeDocument(e) {
6977
- this.guardWritable(), this.documents.delete(e), this.records.delete(J(e)), this.changelog.delete(e), this.heads.delete(e), this.blobData.delete(e);
7025
+ this.guardWritable(), this.documents.delete(e), this.records.delete(wt(e)), this.changelog.delete(e), this.heads.delete(e), this.blobData.delete(e);
6978
7026
  for (let [t, n] of this.blobs) n.documentId === e && this.blobs.delete(t);
6979
7027
  }
6980
7028
  async get(e, t) {
@@ -6992,6 +7040,10 @@ var { liveQuery: St, mergeRanges: Ct, rangesOverlap: wt, RangeSet: Tt, cmp: Et,
6992
7040
  for (let r of this.getTable(t).values()) r.tagName === e && n.push(r);
6993
7041
  return n;
6994
7042
  }
7043
+ async getMany(e, t) {
7044
+ let n = this.getTable(t);
7045
+ return e.map((e) => n.get(e));
7046
+ }
6995
7047
  async bulkWrite(e, t) {
6996
7048
  this.guardWritable();
6997
7049
  let n = this.getTable(e);
@@ -7080,8 +7132,8 @@ var { liveQuery: St, mergeRanges: Ct, rangesOverlap: wt, RangeSet: Tt, cmp: Et,
7080
7132
  getDatabaseInstance() {
7081
7133
  return null;
7082
7134
  }
7083
- async addBlob(e, t) {
7084
- this.guardWritable(), this.documents.has(e.documentId) || a("DOCUMENT_NOT_REGISTERED", { detail: `Cannot add blob: owner document "${e.documentId}" is not registered` }), this.blobs.set(e.id, e), this.getBlobTable(e.documentId).set(e.id, t);
7135
+ async addBlob(e, n) {
7136
+ this.guardWritable(), this.documents.has(e.documentId) || t("DOCUMENT_NOT_REGISTERED", { detail: `Cannot add blob: owner document "${e.documentId}" is not registered` }), this.blobs.set(e.id, e), this.getBlobTable(e.documentId).set(e.id, n);
7085
7137
  }
7086
7138
  async getBlob(e) {
7087
7139
  let t = this.blobs.get(e);
@@ -7101,22 +7153,22 @@ var { liveQuery: St, mergeRanges: Ct, rangesOverlap: wt, RangeSet: Tt, cmp: Et,
7101
7153
  async getStandaloneBlobs() {
7102
7154
  return [...this.blobs.values()].filter((e) => e.attachedTo.length === 0);
7103
7155
  }
7104
- async attachBlob(e, t) {
7156
+ async attachBlob(e, n) {
7105
7157
  this.guardWritable();
7106
- let n = this.blobs.get(e);
7107
- n || a("STORE_BLOB_NOT_FOUND", { detail: `Blob "${e}" not found` }), !n.attachedTo.some((e) => e.documentId === t.documentId && e.recordRef === t.recordRef && e.attribute === t.attribute) && this.blobs.set(e, {
7108
- ...n,
7109
- attachedTo: [...n.attachedTo, t]
7158
+ let r = this.blobs.get(e);
7159
+ r || t("STORE_BLOB_NOT_FOUND", { detail: `Blob "${e}" not found` }), !r.attachedTo.some((e) => e.documentId === n.documentId && e.recordRef === n.recordRef && e.attribute === n.attribute) && this.blobs.set(e, {
7160
+ ...r,
7161
+ attachedTo: [...r.attachedTo, n]
7110
7162
  });
7111
7163
  }
7112
- async detachBlob(e, t) {
7164
+ async detachBlob(e, n) {
7113
7165
  this.guardWritable();
7114
- let n = this.blobs.get(e);
7115
- n || a("STORE_BLOB_NOT_FOUND", { detail: `Blob "${e}" not found` });
7116
- let r = n.attachedTo.filter((e) => !(e.documentId === t.documentId && e.recordRef === t.recordRef));
7166
+ let r = this.blobs.get(e);
7167
+ r || t("STORE_BLOB_NOT_FOUND", { detail: `Blob "${e}" not found` });
7168
+ let i = r.attachedTo.filter((e) => !(e.documentId === n.documentId && e.recordRef === n.recordRef));
7117
7169
  this.blobs.set(e, {
7118
- ...n,
7119
- attachedTo: r
7170
+ ...r,
7171
+ attachedTo: i
7120
7172
  });
7121
7173
  }
7122
7174
  async removeBlob(e) {
@@ -7129,12 +7181,12 @@ var { liveQuery: St, mergeRanges: Ct, rangesOverlap: wt, RangeSet: Tt, cmp: Et,
7129
7181
  return t || (t = /* @__PURE__ */ new Map(), this.blobData.set(e, t)), t;
7130
7182
  }
7131
7183
  getTable(e) {
7132
- let t = J(e), n = this.records.get(t);
7184
+ let t = wt(e), n = this.records.get(t);
7133
7185
  return n || (n = /* @__PURE__ */ new Map(), this.records.set(t, n)), n;
7134
7186
  }
7135
7187
  guardWritable() {
7136
- this.writable || a("STORE_NOT_WRITABLE", { detail: "In-memory store is read-only. Hydrate with a real document before writing." });
7188
+ this.writable || t("STORE_NOT_WRITABLE", { detail: "In-memory store is read-only. Hydrate with a real document before writing." });
7137
7189
  }
7138
7190
  });
7139
7191
  //#endregion
7140
- export { he as $, H as A, Ve as B, J as C, mt as D, gt as E, Te as G, Le as H, We as I, xe as J, we as K, $e as N, nt as O, ye as Q, Ue as R, _t as T, Fe as U, ze as V, Ee as W, L as X, Ce as Y, ve as Z, A as at, D as ct, re as dt, ge as et, w as ft, ae as it, U as k, E as lt, S as mt, j as nt, k as ot, C as pt, Se as q, M as rt, O as st, oe as tt, ie as ut, vt as x, He as z };
7192
+ export { ve as $, it as A, B, wt as C, J as D, xt as E, Oe as G, Ue as H, Je as I, we as J, De as K, U as N, G as O, xe as Q, qe as R, St as T, Be as U, Ge as V, ke as W, Ce as X, Ee as Y, L as Z, j as at, k as ct, E as dt, ye as et, T as ft, S as ht, se as it, ot as k, O as lt, C as mt, M as nt, A as ot, w as pt, Te as q, N as rt, oe as st, P as tt, D as ut, Ct as x, V as z };