@dialecte/core 0.2.0 → 0.2.2

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.
@@ -1,5 +1,5 @@
1
- import { t as $e, i as Oe } from "./index-C2WRi-6U.js";
2
- import { g as vr, l as ce, o as br, k as pr, s as vo, t as bo, C as gi, m as wo } from "./merge-extensions-DQKNUthU.js";
1
+ import { t as $e, i as we } from "./index-DWV6tSGF.js";
2
+ import { g as vr, l as ce, n as br, k as pr, s as yo, t as vo, C as gi } from "./standardizing-FTZoR5RH.js";
3
3
  function gr(m, r) {
4
4
  if (!m) return {};
5
5
  const s = {};
@@ -13,7 +13,7 @@ function gr(m, r) {
13
13
  }
14
14
  return s;
15
15
  }
16
- function _o(m) {
16
+ function bo(m) {
17
17
  const { stagedOperations: r, tagName: s, id: o } = m;
18
18
  for (let d = r.length - 1; d >= 0; d--) {
19
19
  const f = r[d];
@@ -62,7 +62,7 @@ function _o(m) {
62
62
  }
63
63
  }
64
64
  }
65
- function Eo(m) {
65
+ function wo(m) {
66
66
  const { rawRecords: r, stagedOperations: s, tagName: o } = m, d = new Map(
67
67
  r.map((f) => [f.id, { ...f, status: "unchanged" }])
68
68
  );
@@ -78,7 +78,7 @@ function Eo(m) {
78
78
  async function me(m) {
79
79
  const { context: r, ref: s } = m;
80
80
  if (r.stagedOperations.length > 0) {
81
- const d = _o({
81
+ const d = bo({
82
82
  stagedOperations: r.stagedOperations,
83
83
  tagName: s.tagName,
84
84
  id: s.id
@@ -111,7 +111,7 @@ async function Sn(m) {
111
111
  );
112
112
  for (const d of o)
113
113
  zt(r) && r.recordCache.set(d.id, d);
114
- return Eo({ rawRecords: o, stagedOperations: r.stagedOperations, tagName: s });
114
+ return wo({ rawRecords: o, stagedOperations: r.stagedOperations, tagName: s });
115
115
  }
116
116
  async function yi(m) {
117
117
  const { context: r, ref: s, tagName: o } = m, d = await me({ context: r, ref: s });
@@ -126,14 +126,14 @@ async function yi(m) {
126
126
  for (const D of g) {
127
127
  const I = await me({ context: r, ref: D });
128
128
  if (!I) continue;
129
- const q = I.children.find((M) => M.tagName === o);
129
+ const q = I.children.find((j) => j.tagName === o);
130
130
  if (q) return me({ context: r, ref: q });
131
131
  }
132
132
  }
133
133
  async function vi(m) {
134
134
  const { context: r, ref: s, tagName: o } = m, d = await me({ context: r, ref: s });
135
135
  if (!d) return [];
136
- const f = d.children.filter((M) => M.tagName === o).map((M) => ({ tagName: o, id: M.id }));
136
+ const f = d.children.filter((j) => j.tagName === o).map((j) => ({ tagName: o, id: j.id }));
137
137
  if (f.length)
138
138
  return (await Zt({ context: r, refs: f })).filter(
139
139
  (X) => X !== void 0
@@ -141,12 +141,12 @@ async function vi(m) {
141
141
  const v = r.dialecteConfig.transparentElements;
142
142
  if (!v?.length) return [];
143
143
  const g = d.children.filter(
144
- (M) => v.includes(M.tagName)
144
+ (j) => v.includes(j.tagName)
145
145
  );
146
146
  if (!g.length) return [];
147
- const I = (await Zt({ context: r, refs: g })).filter((M) => M !== void 0).flatMap((M) => M.children.filter((X) => X.tagName === o)).map((M) => ({ tagName: o, id: M.id }));
147
+ const I = (await Zt({ context: r, refs: g })).filter((j) => j !== void 0).flatMap((j) => j.children.filter((X) => X.tagName === o)).map((j) => ({ tagName: o, id: j.id }));
148
148
  return I.length ? (await Zt({ context: r, refs: I })).filter(
149
- (M) => M !== void 0
149
+ (j) => j !== void 0
150
150
  ) : [];
151
151
  }
152
152
  async function bi(m) {
@@ -184,13 +184,13 @@ function xt(m) {
184
184
  return !0;
185
185
  }
186
186
  async function wr(m) {
187
- const { context: r, ref: s, options: o } = m, { collect: d, omit: f } = o, v = xo(f), g = To(d), D = /* @__PURE__ */ new Map();
187
+ const { context: r, ref: s, options: o } = m, { collect: d, omit: f } = o, v = _o(f), g = Eo(d), D = /* @__PURE__ */ new Map();
188
188
  for (const q of g.allTags)
189
189
  D.set(q, /* @__PURE__ */ new Map());
190
190
  const I = await me({ context: r, ref: s });
191
- return I && (g.mode === "flat" ? await Co({ context: r, rootId: I.id, collectSpec: g, omitSpec: v, collected: D }) : await Ei({ context: r, record: I, pathNodes: g.paths, omitSpec: v, collected: D })), ii(D);
191
+ return I && (g.mode === "flat" ? await To({ context: r, rootId: I.id, collectSpec: g, omitSpec: v, collected: D }) : await Ei({ context: r, record: I, pathNodes: g.paths, omitSpec: v, collected: D })), ii(D);
192
192
  }
193
- function xo(m) {
193
+ function _o(m) {
194
194
  const r = /* @__PURE__ */ new Set(), s = [];
195
195
  if (!m) return { unconditional: r, conditional: s };
196
196
  for (const o of m)
@@ -213,7 +213,7 @@ function xr(m) {
213
213
  return !0;
214
214
  return !1;
215
215
  }
216
- function To(m) {
216
+ function Eo(m) {
217
217
  if (typeof m == "string")
218
218
  return { mode: "flat", targets: [{ tagName: m }], allTags: /* @__PURE__ */ new Set([m]) };
219
219
  if (Array.isArray(m)) {
@@ -234,12 +234,12 @@ function wi(m, r) {
234
234
  for (const [o, d] of Object.entries(m)) {
235
235
  if (o === "where") continue;
236
236
  r.add(o);
237
- const f = No({ tagName: o, value: d, allTags: r });
237
+ const f = xo({ tagName: o, value: d, allTags: r });
238
238
  f && s.push(f);
239
239
  }
240
240
  return s;
241
241
  }
242
- function No(m) {
242
+ function xo(m) {
243
243
  const { tagName: r, value: s, allTags: o } = m;
244
244
  if (s === !0)
245
245
  return { tagName: r, where: void 0, children: [], isLeaf: !0 };
@@ -253,7 +253,7 @@ function No(m) {
253
253
  const D = wi(g, o);
254
254
  return { tagName: r, where: f, children: D, isLeaf: !1 };
255
255
  }
256
- async function Co(m) {
256
+ async function To(m) {
257
257
  const { context: r, rootId: s, collectSpec: o, omitSpec: d, collected: f } = m;
258
258
  for (const v of o.targets) {
259
259
  if (d.unconditional.has(v.tagName)) continue;
@@ -262,7 +262,7 @@ async function Co(m) {
262
262
  tagName: v.tagName
263
263
  });
264
264
  for (const D of g)
265
- _i({ record: D, where: v.where }) && (xr({ record: D, omitSpec: d }) || await Oo({ context: r, record: D, rootId: s, omitSpec: d }) && f.get(v.tagName).set(D.id, D));
265
+ _i({ record: D, where: v.where }) && (xr({ record: D, omitSpec: d }) || await No({ context: r, record: D, rootId: s, omitSpec: d }) && f.get(v.tagName).set(D.id, D));
266
266
  }
267
267
  }
268
268
  function _i(m) {
@@ -272,7 +272,7 @@ function _i(m) {
272
272
  attributeFilter: s
273
273
  }) : !0;
274
274
  }
275
- async function Oo(m) {
275
+ async function No(m) {
276
276
  const { context: r, record: s, rootId: o, omitSpec: d } = m;
277
277
  if (s.id === o) return !0;
278
278
  let f = s;
@@ -290,7 +290,7 @@ async function Ei(m) {
290
290
  if (!s.children?.length) return;
291
291
  const v = new Set(o.map((g) => g.tagName));
292
292
  for (const g of o) {
293
- const D = await Ao({
293
+ const D = await Co({
294
294
  context: r,
295
295
  record: s,
296
296
  tagName: g.tagName,
@@ -308,7 +308,7 @@ async function Ei(m) {
308
308
  });
309
309
  }
310
310
  }
311
- async function Ao(m) {
311
+ async function Co(m) {
312
312
  const { context: r, record: s, tagName: o, where: d, omitSpec: f, stopAtTagNames: v } = m, g = [];
313
313
  if (!s.children?.length) return g;
314
314
  const D = [], I = await ri({ context: r, record: s, omitSpec: f });
@@ -319,8 +319,8 @@ async function Ao(m) {
319
319
  continue;
320
320
  }
321
321
  if (!(v.has(q.tagName) && q.tagName !== o) && q.children?.length) {
322
- const M = await ri({ context: r, record: q, omitSpec: f });
323
- D.push(...M);
322
+ const j = await ri({ context: r, record: q, omitSpec: f });
323
+ D.push(...j);
324
324
  }
325
325
  }
326
326
  return g;
@@ -362,20 +362,20 @@ async function Ci(m) {
362
362
  }
363
363
  async function Oi(m) {
364
364
  const { context: r, ref: s, options: o = {}, dialecteConfig: d } = m, { select: f, omit: v, unwrap: g } = o, D = await me({ context: r, ref: s });
365
- Oe(D, {
365
+ we(D, {
366
366
  detail: "No record found for provided ref",
367
367
  key: "ELEMENT_NOT_FOUND"
368
368
  });
369
- const I = Do(v), q = await Ai({
369
+ const I = Oo(v), q = await Ai({
370
370
  context: r,
371
371
  record: D,
372
372
  select: f,
373
373
  compiledOmit: I,
374
374
  dialecteConfig: d
375
375
  });
376
- return q ? g ? qo({ tree: q, unwrapTagNames: g }) : q : br({ record: D });
376
+ return q ? g ? Mo({ tree: q, unwrapTagNames: g }) : q : br({ record: D });
377
377
  }
378
- function Do(m) {
378
+ function Oo(m) {
379
379
  const r = /* @__PURE__ */ new Set(), s = [];
380
380
  if (!m) return { unconditional: r, conditional: s };
381
381
  for (const o of m) {
@@ -398,9 +398,9 @@ function Do(m) {
398
398
  }
399
399
  async function Ai(m) {
400
400
  const { context: r, record: s, select: o, compiledOmit: d, dialecteConfig: f } = m;
401
- if (So({ record: s, compiledOmit: d }))
401
+ if (Ao({ record: s, compiledOmit: d }))
402
402
  return br({ record: s });
403
- const v = await Ro({
403
+ const v = await So({
404
404
  context: r,
405
405
  record: s,
406
406
  select: o,
@@ -415,7 +415,7 @@ async function Ai(m) {
415
415
  );
416
416
  return br({ record: s, tree: D });
417
417
  }
418
- function So(m) {
418
+ function Ao(m) {
419
419
  const { record: r, compiledOmit: s } = m;
420
420
  return s.conditional.some(
421
421
  (o) => o.scope === "children" && o.tagName === r.tagName && xt({
@@ -424,7 +424,7 @@ function So(m) {
424
424
  })
425
425
  );
426
426
  }
427
- function ko(m) {
427
+ function Do(m) {
428
428
  const { record: r, compiledOmit: s } = m;
429
429
  return s.unconditional.has(r.tagName) ? !0 : s.conditional.some(
430
430
  (o) => o.scope === "self" && o.tagName === r.tagName && xt({
@@ -433,42 +433,42 @@ function ko(m) {
433
433
  })
434
434
  );
435
435
  }
436
- async function Ro(m) {
436
+ async function So(m) {
437
437
  const { context: r, record: s, select: o, compiledOmit: d, dialecteConfig: f } = m;
438
438
  if (!s.children?.length) return [];
439
- const v = o ? Fo(o) : void 0;
439
+ const v = o ? Io(o) : void 0;
440
440
  if (v && o && f && o.recursive !== !1) {
441
- const M = s.tagName, X = f.children[M], ie = o[M] !== void 0;
442
- X?.includes(M) && !ie && v.add(M);
441
+ const j = s.tagName, X = f.children[j], oe = o[j] !== void 0;
442
+ X?.includes(j) && !oe && v.add(j);
443
443
  }
444
444
  const g = s.children.filter(
445
- (M) => Io({ tagName: M.tagName, compiledOmit: d, selectKeys: v })
445
+ (j) => ko({ tagName: j.tagName, compiledOmit: d, selectKeys: v })
446
446
  );
447
447
  if (!g.length) return [];
448
448
  const q = (await Promise.all(
449
449
  g.map(
450
- (M) => me({
450
+ (j) => me({
451
451
  context: r,
452
- ref: ce(M)
452
+ ref: ce(j)
453
453
  })
454
454
  )
455
455
  )).filter(
456
- (M) => M !== void 0
457
- ).filter((M) => !ko({ record: M, compiledOmit: d }));
458
- return Bo({ children: q, select: o, record: s, dialecteConfig: f });
456
+ (j) => j !== void 0
457
+ ).filter((j) => !Do({ record: j, compiledOmit: d }));
458
+ return Po({ children: q, select: o, record: s, dialecteConfig: f });
459
459
  }
460
- function Io(m) {
460
+ function ko(m) {
461
461
  const { tagName: r, compiledOmit: s, selectKeys: o } = m;
462
462
  return !(s.unconditional.has(r) || o && !o.has(r));
463
463
  }
464
- const Po = /* @__PURE__ */ new Set(["where", "recursive"]);
465
- function Fo(m) {
464
+ const Ro = /* @__PURE__ */ new Set(["where", "recursive"]);
465
+ function Io(m) {
466
466
  const r = /* @__PURE__ */ new Set();
467
467
  for (const s of Object.keys(m))
468
- Po.has(s) || r.add(s);
468
+ Ro.has(s) || r.add(s);
469
469
  return r;
470
470
  }
471
- function Bo(m) {
471
+ function Po(m) {
472
472
  const { children: r, select: s, record: o, dialecteConfig: d } = m;
473
473
  if (!s)
474
474
  return r.map((v) => ({ record: v, select: void 0 }));
@@ -476,7 +476,7 @@ function Bo(m) {
476
476
  for (const v of r) {
477
477
  const g = s[v.tagName];
478
478
  if (g === void 0 && v.tagName === o.tagName) {
479
- const I = Mo({ child: v, select: s, dialecteConfig: d });
479
+ const I = Fo({ child: v, select: s, dialecteConfig: d });
480
480
  if (I) {
481
481
  f.push(I);
482
482
  continue;
@@ -487,12 +487,12 @@ function Bo(m) {
487
487
  f.push({ record: v, select: void 0 });
488
488
  continue;
489
489
  }
490
- const D = jo({ child: v, entry: g, parentRecord: o });
490
+ const D = Bo({ child: v, entry: g, parentRecord: o });
491
491
  D && f.push(D);
492
492
  }
493
493
  return f;
494
494
  }
495
- function Mo(m) {
495
+ function Fo(m) {
496
496
  const { child: r, select: s, dialecteConfig: o } = m;
497
497
  if (!(!o || s.recursive === !1 || !o.children[r.tagName]?.includes(r.tagName)) && !(s.where && !xt({
498
498
  record: r,
@@ -500,7 +500,7 @@ function Mo(m) {
500
500
  })))
501
501
  return { record: r, select: s };
502
502
  }
503
- function jo(m) {
503
+ function Bo(m) {
504
504
  const { child: r, entry: s, parentRecord: o } = m, d = s;
505
505
  if (!(d.where && !xt({
506
506
  record: r,
@@ -510,14 +510,14 @@ function jo(m) {
510
510
  const f = d.recursive === !0 ? !0 : d.recursive - 1;
511
511
  return f === 0 ? void 0 : { record: r, select: { ...d, recursive: f } };
512
512
  }
513
- return d.recursive ? { record: r, select: Ko(d, r.tagName) } : r.tagName === o.tagName ? { record: r, select: { ...d, recursive: !1 } } : { record: r, select: d };
513
+ return d.recursive ? { record: r, select: jo(d, r.tagName) } : r.tagName === o.tagName ? { record: r, select: { ...d, recursive: !1 } } : { record: r, select: d };
514
514
  }
515
515
  }
516
- function Ko(m, r) {
516
+ function jo(m, r) {
517
517
  const s = m[r];
518
518
  return m;
519
519
  }
520
- function qo(m) {
520
+ function Mo(m) {
521
521
  const { tree: r, unwrapTagNames: s } = m;
522
522
  function o(d) {
523
523
  return d.flatMap((f) => s.includes(f.tagName) ? o(f.tree) : [{ ...f, tree: o(f.tree) }]);
@@ -656,7 +656,7 @@ class Si {
656
656
  context: this.context,
657
657
  ref: { tagName: this.dialecteConfig.rootElementName }
658
658
  });
659
- return Oe(r, {
659
+ return we(r, {
660
660
  key: "ROOT_NOT_FOUND",
661
661
  detail: `Expected tag name: ${this.dialecteConfig.rootElementName}`
662
662
  }), r;
@@ -817,13 +817,13 @@ class Si {
817
817
  function et(m) {
818
818
  const { context: r, status: s, record: o, oldRecord: d, newRecord: f } = m;
819
819
  let v, g, D;
820
- o && (v = pr(o)), d && (g = pr(d)), f && (D = pr(f)), s === "created" ? (Oe(v, {
820
+ o && (v = pr(o)), d && (g = pr(d)), f && (D = pr(f)), s === "created" ? (we(v, {
821
821
  detail: "Record is required for created",
822
822
  key: "ELEMENT_NOT_FOUND"
823
- }), r.stagedOperations.push({ status: s, oldRecord: void 0, newRecord: v })) : s === "updated" ? (Oe(g && D, {
823
+ }), r.stagedOperations.push({ status: s, oldRecord: void 0, newRecord: v })) : s === "updated" ? (we(g && D, {
824
824
  detail: "Old record and new record are required for updated",
825
825
  key: "ELEMENT_NOT_FOUND"
826
- }), r.stagedOperations.push({ status: s, oldRecord: g, newRecord: D })) : s === "deleted" && v && (Oe(v, {
826
+ }), r.stagedOperations.push({ status: s, oldRecord: g, newRecord: D })) : s === "deleted" && v && (we(v, {
827
827
  detail: "Record is required for deleted",
828
828
  key: "ELEMENT_NOT_FOUND"
829
829
  }), r.stagedOperations.push({ status: s, oldRecord: v, newRecord: void 0 }));
@@ -849,13 +849,13 @@ function Tr(m) {
849
849
  }
850
850
  }
851
851
  async function kn(m) {
852
- const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, { id: g, tagName: D, attributes: I, namespace: q, value: M } = v, X = await me({ context: o, ref: f });
853
- Oe(X, {
852
+ const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, { id: g, tagName: D, attributes: I, namespace: q, value: j } = v, X = await me({ context: o, ref: f });
853
+ we(X, {
854
854
  detail: "Parent record not found",
855
855
  key: "ELEMENT_NOT_FOUND",
856
856
  ref: f
857
857
  });
858
- const ie = vo({
858
+ const oe = yo({
859
859
  dialecteConfig: r,
860
860
  hooks: s,
861
861
  record: {
@@ -863,7 +863,7 @@ async function kn(m) {
863
863
  tagName: D,
864
864
  attributes: I,
865
865
  namespace: q,
866
- value: M,
866
+ value: j,
867
867
  parent: { id: X.id, tagName: X.tagName },
868
868
  children: []
869
869
  }
@@ -871,26 +871,26 @@ async function kn(m) {
871
871
  et({
872
872
  context: o,
873
873
  status: "created",
874
- record: ie
874
+ record: oe
875
875
  });
876
- const j = {
876
+ const M = {
877
877
  ...X,
878
- children: [...X.children, { id: ie.id, tagName: ie.tagName }]
878
+ children: [...X.children, { id: oe.id, tagName: oe.tagName }]
879
879
  };
880
880
  if (et({
881
881
  context: o,
882
882
  status: "updated",
883
883
  oldRecord: X,
884
- newRecord: j
884
+ newRecord: M
885
885
  }), s?.afterCreated) {
886
886
  const B = await s.afterCreated({
887
- childRecord: ie,
888
- parentRecord: j,
887
+ childRecord: oe,
888
+ parentRecord: M,
889
889
  query: d
890
890
  });
891
891
  Tr({ context: o, operations: B });
892
892
  }
893
- return ie;
893
+ return oe;
894
894
  }
895
895
  async function ki(m) {
896
896
  const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, record: v, cumulativeCloneMappings: g } = m, D = [], I = await Ri({
@@ -934,9 +934,9 @@ async function Ri(m) {
934
934
  attributes: I.attributes,
935
935
  value: I.value
936
936
  }
937
- }), M = ce(v);
937
+ }), j = ce(v);
938
938
  g.push({
939
- source: Object.assign(M, {
939
+ source: Object.assign(j, {
940
940
  attributes: [...v.attributes]
941
941
  }),
942
942
  target: ce(q)
@@ -955,11 +955,11 @@ async function Ri(m) {
955
955
  }
956
956
  async function Ii(m) {
957
957
  const { hooks: r, context: s, query: o, ref: d } = m, f = await me({ context: s, ref: d });
958
- if (Oe(f, {
958
+ if (we(f, {
959
959
  detail: `Record not found (tagName=${d.tagName}, id=${d.id})`,
960
960
  key: "ELEMENT_NOT_FOUND",
961
961
  ref: d
962
- }), Oe(f.parent, {
962
+ }), we(f.parent, {
963
963
  detail: "Cannot delete root element",
964
964
  key: "PROTECTED_ROOT"
965
965
  }), r?.beforeDelete) {
@@ -968,7 +968,7 @@ async function Ii(m) {
968
968
  }
969
969
  await Pi({ context: s, record: f }), et({ context: s, status: "deleted", record: f });
970
970
  const v = ce(f.parent), g = await me({ context: s, ref: v });
971
- Oe(g, {
971
+ we(g, {
972
972
  detail: `Parent record not found (tagName=${f.parent.tagName}, id=${f.parent.id})`,
973
973
  key: "ELEMENT_NOT_FOUND"
974
974
  });
@@ -986,7 +986,7 @@ async function Pi(m) {
986
986
  }
987
987
  }
988
988
  async function Fi(m) {
989
- const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, g = Lo(v.attributes);
989
+ const { dialecteConfig: r, hooks: s, context: o, query: d, parentRef: f, params: v } = m, g = Ko(v.attributes);
990
990
  if (g) {
991
991
  const [D] = await Er({
992
992
  context: o,
@@ -1007,46 +1007,46 @@ async function Fi(m) {
1007
1007
  params: v
1008
1008
  });
1009
1009
  }
1010
- function Lo(m) {
1010
+ function Ko(m) {
1011
1011
  const r = Array.isArray(m) ? Object.fromEntries(m.map((o) => [o.name, o.value])) : m;
1012
1012
  return Object.values(r).some((o) => o !== void 0 && o !== "") ? r : void 0;
1013
1013
  }
1014
1014
  async function Bi(m) {
1015
1015
  const { dialecteConfig: r, hooks: s, context: o, query: d, ref: f, params: v } = m, { attributes: g, value: D } = v, I = await me({ context: o, ref: f });
1016
- Oe(I, {
1016
+ we(I, {
1017
1017
  detail: `Record not found (tagName=${f.tagName}, id=${f.id})`,
1018
1018
  key: "ELEMENT_NOT_FOUND",
1019
1019
  ref: f
1020
1020
  });
1021
1021
  let q = I.attributes;
1022
1022
  if (g) {
1023
- const X = bo({
1023
+ const X = vo({
1024
1024
  dialecteConfig: r,
1025
1025
  tagName: I.tagName,
1026
1026
  attributes: g
1027
1027
  });
1028
1028
  q = [...I.attributes.filter(
1029
- (j) => !X.some((B) => B.name === j.name)
1029
+ (M) => !X.some((B) => B.name === M.name)
1030
1030
  ), ...X].filter(
1031
- (j) => j.value !== void 0 && j.value !== null
1031
+ (M) => M.value !== void 0 && M.value !== null
1032
1032
  );
1033
1033
  }
1034
- const M = {
1034
+ const j = {
1035
1035
  ...I,
1036
1036
  attributes: q,
1037
1037
  value: D !== void 0 ? D : I.value
1038
1038
  };
1039
- if (et({ context: o, status: "updated", oldRecord: I, newRecord: M }), s?.afterUpdated) {
1039
+ if (et({ context: o, status: "updated", oldRecord: I, newRecord: j }), s?.afterUpdated) {
1040
1040
  const X = await s.afterUpdated({
1041
1041
  oldRecord: I,
1042
- newRecord: M,
1042
+ newRecord: j,
1043
1043
  query: d
1044
1044
  });
1045
1045
  Tr({ context: o, operations: X });
1046
1046
  }
1047
- return M;
1047
+ return j;
1048
1048
  }
1049
- class Uo extends Di {
1049
+ class qo extends Di {
1050
1050
  constructor(r, s, o, d) {
1051
1051
  super(r, s), this.hooks = o, this.query = d;
1052
1052
  }
@@ -1115,7 +1115,7 @@ class Uo extends Di {
1115
1115
  });
1116
1116
  }
1117
1117
  }
1118
- function Vo(m) {
1118
+ function Lo(m) {
1119
1119
  const r = /* @__PURE__ */ new Map();
1120
1120
  for (const o of m) {
1121
1121
  const d = (o.status === "deleted" ? o.oldRecord : o.newRecord).id, f = r.get(d);
@@ -1144,8 +1144,8 @@ function Vo(m) {
1144
1144
  deletes: s.filter((o) => o.status === "deleted")
1145
1145
  };
1146
1146
  }
1147
- async function $o(m) {
1148
- const { stagedOperations: r, store: s, documentId: o, documentState: d } = m, { creates: f, updates: v, deletes: g } = Vo(r), D = f.length + v.length + g.length;
1147
+ async function Uo(m) {
1148
+ const { stagedOperations: r, store: s, documentId: o, documentState: d } = m, { creates: f, updates: v, deletes: g } = Lo(r), D = f.length + v.length + g.length;
1149
1149
  d.loading = !0, d.progress = { message: "Committing changes...", current: 0, total: D };
1150
1150
  try {
1151
1151
  await s.commit({
@@ -1162,13 +1162,13 @@ async function $o(m) {
1162
1162
  }
1163
1163
  d.lastUpdate = Date.now();
1164
1164
  }
1165
- class Go extends Si {
1165
+ class Vo extends Si {
1166
1166
  constructor(r, s, o, d, f) {
1167
1167
  super(r, s, o), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.cumulativeCloneMappings = [], this.documentActivity = d, this.hooks = f;
1168
1168
  }
1169
1169
  //== Untyped namespace
1170
1170
  get any() {
1171
- return this._anyTx ??= new Uo(
1171
+ return this._anyTx ??= new qo(
1172
1172
  () => this.context,
1173
1173
  this.dialecteConfig,
1174
1174
  this.hooks,
@@ -1345,7 +1345,7 @@ class Go extends Si {
1345
1345
  * Merges operations by ID to optimize database writes.
1346
1346
  */
1347
1347
  async commit() {
1348
- await $o({
1348
+ await Uo({
1349
1349
  stagedOperations: this.stagedOperations,
1350
1350
  store: this.store,
1351
1351
  documentId: this.documentId,
@@ -1356,7 +1356,7 @@ class Go extends Si {
1356
1356
  function zt(m) {
1357
1357
  return m.recordCache !== void 0;
1358
1358
  }
1359
- class Yo {
1359
+ class $o {
1360
1360
  constructor(r, s, o, d, f, v) {
1361
1361
  this.state = {
1362
1362
  loading: !1,
@@ -1392,7 +1392,7 @@ class Yo {
1392
1392
  * e.g. SclDocument overrides this to return new SclTransaction(...)
1393
1393
  */
1394
1394
  createTransaction() {
1395
- return new Go(this.store, this.config, this.documentId, this.state, this.hooks);
1395
+ return new Vo(this.store, this.config, this.documentId, this.state, this.hooks);
1396
1396
  }
1397
1397
  async transaction(r, s) {
1398
1398
  this.activeTransactions > 0 && $e("CONCURRENT_TRANSACTION", {
@@ -1498,9 +1498,9 @@ class Yo {
1498
1498
  await this.store.destroy();
1499
1499
  }
1500
1500
  }
1501
- const ft = "_documents", Xe = "_changeLog", He = "_meta", Wo = "xel_";
1502
- function Xo(m) {
1503
- return `${Wo}${m}`;
1501
+ const ft = "_documents", Xe = "_changeLog", He = "_meta", Go = "xel_";
1502
+ function Yo(m) {
1503
+ return `${Go}${m}`;
1504
1504
  }
1505
1505
  const oi = {
1506
1506
  primaryKey: "id",
@@ -1519,11 +1519,11 @@ const oi = {
1519
1519
  compoundIndexes: [],
1520
1520
  arrayIndexes: []
1521
1521
  };
1522
- var Ho = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1523
- function Mi(m) {
1522
+ var Wo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1523
+ function ji(m) {
1524
1524
  return m && m.__esModule && Object.prototype.hasOwnProperty.call(m, "default") ? m.default : m;
1525
1525
  }
1526
- function zo(m) {
1526
+ function Xo(m) {
1527
1527
  if (Object.prototype.hasOwnProperty.call(m, "__esModule")) return m;
1528
1528
  var r = m.default;
1529
1529
  if (typeof r == "function") {
@@ -1547,12 +1547,12 @@ function zo(m) {
1547
1547
  });
1548
1548
  }), s;
1549
1549
  }
1550
- var Dn = { exports: {} }, Qo = Dn.exports, ci;
1551
- function Zo() {
1550
+ var Dn = { exports: {} }, Ho = Dn.exports, ci;
1551
+ function zo() {
1552
1552
  return ci || (ci = 1, (function(m, r) {
1553
1553
  (function(s, o) {
1554
1554
  m.exports = o();
1555
- })(Qo, function() {
1555
+ })(Ho, function() {
1556
1556
  var s = function(e, t) {
1557
1557
  return (s = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
1558
1558
  n.__proto__ = i;
@@ -1569,7 +1569,7 @@ function Zo() {
1569
1569
  for (var i, a = 0, u = t.length; a < u; a++) !i && a in t || ((i = i || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
1570
1570
  return e.concat(i || Array.prototype.slice.call(t));
1571
1571
  }
1572
- var f = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ho, v = Object.keys, g = Array.isArray;
1572
+ var f = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Wo, v = Object.keys, g = Array.isArray;
1573
1573
  function D(e, t) {
1574
1574
  return typeof t != "object" || v(t).forEach(function(n) {
1575
1575
  e[n] = t[n];
@@ -1577,26 +1577,26 @@ function Zo() {
1577
1577
  }
1578
1578
  typeof Promise > "u" || f.Promise || (f.Promise = Promise);
1579
1579
  var I = Object.getPrototypeOf, q = {}.hasOwnProperty;
1580
- function M(e, t) {
1580
+ function j(e, t) {
1581
1581
  return q.call(e, t);
1582
1582
  }
1583
1583
  function X(e, t) {
1584
1584
  typeof t == "function" && (t = t(I(e))), (typeof Reflect > "u" ? v : Reflect.ownKeys)(t).forEach(function(n) {
1585
- j(e, n, t[n]);
1585
+ M(e, n, t[n]);
1586
1586
  });
1587
1587
  }
1588
- var ie = Object.defineProperty;
1589
- function j(e, t, n, i) {
1590
- ie(e, t, D(n && M(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, i));
1588
+ var oe = Object.defineProperty;
1589
+ function M(e, t, n, i) {
1590
+ oe(e, t, D(n && j(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, i));
1591
1591
  }
1592
1592
  function B(e) {
1593
1593
  return { from: function(t) {
1594
- return e.prototype = Object.create(t.prototype), j(e.prototype, "constructor", e), { extend: X.bind(null, e.prototype) };
1594
+ return e.prototype = Object.create(t.prototype), M(e.prototype, "constructor", e), { extend: X.bind(null, e.prototype) };
1595
1595
  } };
1596
1596
  }
1597
- var H = Object.getOwnPropertyDescriptor, oe = [].slice;
1597
+ var H = Object.getOwnPropertyDescriptor, ie = [].slice;
1598
1598
  function ye(e, t, n) {
1599
- return oe.call(e, t, n);
1599
+ return ie.call(e, t, n);
1600
1600
  }
1601
1601
  function ne(e, t) {
1602
1602
  return t(e);
@@ -1608,7 +1608,7 @@ function Zo() {
1608
1608
  f.setImmediate ? setImmediate(e) : setTimeout(e, 0);
1609
1609
  }
1610
1610
  function he(e, t) {
1611
- if (typeof t == "string" && M(e, t)) return e[t];
1611
+ if (typeof t == "string" && j(e, t)) return e[t];
1612
1612
  if (!t) return e;
1613
1613
  if (typeof t != "string") {
1614
1614
  for (var n = [], i = 0, a = t.length; i < a; ++i) {
@@ -1629,12 +1629,12 @@ function Zo() {
1629
1629
  for (var i = 0, a = t.length; i < a; ++i) de(e, t[i], n[i]);
1630
1630
  } else {
1631
1631
  var u, h, p = t.indexOf(".");
1632
- p !== -1 ? (u = t.substr(0, p), (h = t.substr(p + 1)) === "" ? n === void 0 ? g(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : de(p = !(p = e[u]) || !M(e, u) ? e[u] = {} : p, h, n)) : n === void 0 ? g(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
1632
+ p !== -1 ? (u = t.substr(0, p), (h = t.substr(p + 1)) === "" ? n === void 0 ? g(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : de(p = !(p = e[u]) || !j(e, u) ? e[u] = {} : p, h, n)) : n === void 0 ? g(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
1633
1633
  }
1634
1634
  }
1635
1635
  function ve(e) {
1636
1636
  var t, n = {};
1637
- for (t in e) M(e, t) && (n[t] = e[t]);
1637
+ for (t in e) j(e, t) && (n[t] = e[t]);
1638
1638
  return n;
1639
1639
  }
1640
1640
  var In = [].concat;
@@ -1661,18 +1661,18 @@ function Zo() {
1661
1661
  } else if (Bt.has(n.constructor)) i = n;
1662
1662
  else {
1663
1663
  var h, p = I(n);
1664
- for (h in i = p === Object.prototype ? {} : Object.create(p), Ue.set(n, i), n) M(n, h) && (i[h] = t(n[h]));
1664
+ for (h in i = p === Object.prototype ? {} : Object.create(p), Ue.set(n, i), n) j(n, h) && (i[h] = t(n[h]));
1665
1665
  }
1666
1666
  return i;
1667
1667
  })(e), Ue = null, e;
1668
1668
  }
1669
1669
  var Jt = {}.toString;
1670
- function Mt(e) {
1670
+ function jt(e) {
1671
1671
  return Jt.call(e).slice(8, -1);
1672
1672
  }
1673
- var jt = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", we = typeof jt == "symbol" ? function(e) {
1673
+ var Mt = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", _e = typeof Mt == "symbol" ? function(e) {
1674
1674
  var t;
1675
- return e != null && (t = e[jt]) && t.apply(e);
1675
+ return e != null && (t = e[Mt]) && t.apply(e);
1676
1676
  } : function() {
1677
1677
  return null;
1678
1678
  };
@@ -1685,7 +1685,7 @@ function Zo() {
1685
1685
  if (arguments.length === 1) {
1686
1686
  if (g(e)) return e.slice();
1687
1687
  if (this === Qe && typeof e == "string") return [e];
1688
- if (a = we(e)) {
1688
+ if (a = _e(e)) {
1689
1689
  for (n = []; !(i = a.next()).done; ) n.push(i.value);
1690
1690
  return n;
1691
1691
  }
@@ -1716,14 +1716,14 @@ function Zo() {
1716
1716
  function nt(e, t, n, i) {
1717
1717
  this.failures = t, this.failedKeys = i, this.successCount = n, this.message = Nt(e, t);
1718
1718
  }
1719
- function je(e, t) {
1719
+ function Me(e, t) {
1720
1720
  this.name = "BulkError", this.failures = Object.keys(t).map(function(n) {
1721
1721
  return t[n];
1722
1722
  }), this.failuresByPos = t, this.message = Nt(e, this.failures);
1723
1723
  }
1724
1724
  B(tt).from(Error).extend({ toString: function() {
1725
1725
  return this.name + ": " + this.message;
1726
- } }), B(nt).from(tt), B(je).from(tt);
1726
+ } }), B(nt).from(tt), B(Me).from(tt);
1727
1727
  var ht = Le.reduce(function(e, t) {
1728
1728
  return e[t] = t + "Error", e;
1729
1729
  }, {}), Pn = tt, Q = Le.reduce(function(e, t) {
@@ -1772,7 +1772,7 @@ function Zo() {
1772
1772
  this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? E(n, this.onsuccess) : n), i && (this.onerror = this.onerror ? E(i, this.onerror) : i);
1773
1773
  };
1774
1774
  }
1775
- function Ee(e, t) {
1775
+ function xe(e, t) {
1776
1776
  return e === l ? t : function(n) {
1777
1777
  var i = e.apply(this, arguments);
1778
1778
  D(n, i);
@@ -1797,10 +1797,10 @@ function Zo() {
1797
1797
  return t.apply(this, arguments);
1798
1798
  };
1799
1799
  }
1800
- Ot.ModifyError = nt, Ot.DexieError = tt, Ot.BulkError = je;
1801
- var Ne = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
1802
- function Ce(e) {
1803
- Ne = e;
1800
+ Ot.ModifyError = nt, Ot.DexieError = tt, Ot.BulkError = Me;
1801
+ var Ce = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
1802
+ function Oe(e) {
1803
+ Ce = e;
1804
1804
  }
1805
1805
  var Be = {}, en = 100, Ve = typeof Promise > "u" ? [] : (function() {
1806
1806
  var e = Promise.resolve();
@@ -1808,8 +1808,8 @@ function Zo() {
1808
1808
  var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
1809
1809
  return [t, I(t), e];
1810
1810
  })(), rt = Ve[0], Le = Ve[1], Ve = Ve[2], Le = Le && Le.then, Ge = rt && rt.constructor, Fn = !!Ve, Kt = function(e, t) {
1811
- qt.push([e, t]), tn && (queueMicrotask(Wi), tn = !1);
1812
- }, Bn = !0, tn = !0, mt = [], nn = [], Mn = c, it = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: l, pgp: !1, env: {}, finalize: l }, z = it, qt = [], pt = 0, rn = [];
1811
+ qt.push([e, t]), tn && (queueMicrotask(Yi), tn = !1);
1812
+ }, Bn = !0, tn = !0, mt = [], nn = [], jn = c, it = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: l, pgp: !1, env: {}, finalize: l }, z = it, qt = [], pt = 0, rn = [];
1813
1813
  function Y(e) {
1814
1814
  if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
1815
1815
  this._listeners = [], this._lib = !1;
@@ -1834,7 +1834,7 @@ function Zo() {
1834
1834
  }
1835
1835
  })(this, e);
1836
1836
  }
1837
- var jn = { get: function() {
1837
+ var Mn = { get: function() {
1838
1838
  var e = z, t = cn;
1839
1839
  function n(i, a) {
1840
1840
  var u = this, h = !e.global && (e !== z || t !== cn), p = h && !at(), b = new Y(function(_, T) {
@@ -1844,16 +1844,16 @@ function Zo() {
1844
1844
  }
1845
1845
  return n.prototype = Be, n;
1846
1846
  }, set: function(e) {
1847
- j(this, "then", e && e.prototype === Be ? jn : { get: function() {
1847
+ M(this, "then", e && e.prototype === Be ? Mn : { get: function() {
1848
1848
  return e;
1849
- }, set: jn.set });
1849
+ }, set: Mn.set });
1850
1850
  } };
1851
1851
  function Nr(e, t, n, i, a) {
1852
1852
  this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = i, this.psd = a;
1853
1853
  }
1854
1854
  function Kn(e, t) {
1855
1855
  var n, i;
1856
- nn.push(t), e._state === null && (n = e._lib && At(), t = Mn(t), e._state = !1, e._value = t, i = e, mt.some(function(a) {
1856
+ nn.push(t), e._state === null && (n = e._lib && At(), t = jn(t), e._state = !1, e._value = t, i = e, mt.some(function(a) {
1857
1857
  return a._value === i._value;
1858
1858
  }) || mt.push(i), Cr(e), n && Dt());
1859
1859
  }
@@ -1870,13 +1870,13 @@ function Zo() {
1870
1870
  if (e._state !== null) {
1871
1871
  var n = e._state ? t.onFulfilled : t.onRejected;
1872
1872
  if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
1873
- ++t.psd.ref, ++pt, Kt(Yi, [n, e, t]);
1873
+ ++t.psd.ref, ++pt, Kt(Gi, [n, e, t]);
1874
1874
  } else e._listeners.push(t);
1875
1875
  }
1876
- function Yi(e, t, n) {
1876
+ function Gi(e, t, n) {
1877
1877
  try {
1878
1878
  var i, a = t._value;
1879
- !t._state && nn.length && (nn = []), i = Ne && t._consoleTask ? t._consoleTask.run(function() {
1879
+ !t._state && nn.length && (nn = []), i = Ce && t._consoleTask ? t._consoleTask.run(function() {
1880
1880
  return e(a);
1881
1881
  }) : e(a), t._state || nn.indexOf(a) !== -1 || (function(u) {
1882
1882
  for (var h = mt.length; h; ) if (mt[--h]._value === u._value) return mt.splice(h, 1);
@@ -1887,7 +1887,7 @@ function Zo() {
1887
1887
  --pt == 0 && Ln(), --n.psd.ref || n.psd.finalize();
1888
1888
  }
1889
1889
  }
1890
- function Wi() {
1890
+ function Yi() {
1891
1891
  gt(it, function() {
1892
1892
  At() && Dt();
1893
1893
  });
@@ -1929,7 +1929,7 @@ function Zo() {
1929
1929
  }
1930
1930
  };
1931
1931
  }
1932
- X(Y.prototype, { then: jn, _then: function(e, t) {
1932
+ X(Y.prototype, { then: Mn, _then: function(e, t) {
1933
1933
  qn(this, new Nr(null, null, e, t, z));
1934
1934
  }, catch: function(e) {
1935
1935
  if (arguments.length === 1) return this.then(null, e);
@@ -1957,7 +1957,7 @@ function Zo() {
1957
1957
  }, e);
1958
1958
  n.then(i, a).finally(clearTimeout.bind(null, u));
1959
1959
  }) : this;
1960
- } }), typeof Symbol < "u" && Symbol.toStringTag && j(Y.prototype, Symbol.toStringTag, "Dexie.Promise"), it.env = Or(), X(Y, { all: function() {
1960
+ } }), typeof Symbol < "u" && Symbol.toStringTag && M(Y.prototype, Symbol.toStringTag, "Dexie.Promise"), it.env = Or(), X(Y, { all: function() {
1961
1961
  var e = ke.apply(null, arguments).map(un);
1962
1962
  return new Y(function(t, n) {
1963
1963
  e.length === 0 && t([]);
@@ -1990,9 +1990,9 @@ function Zo() {
1990
1990
  }, set: function(e) {
1991
1991
  Kt = e;
1992
1992
  } }, rejectionMapper: { get: function() {
1993
- return Mn;
1993
+ return jn;
1994
1994
  }, set: function(e) {
1995
- Mn = e;
1995
+ jn = e;
1996
1996
  } }, follow: function(e, t) {
1997
1997
  return new Y(function(n, i) {
1998
1998
  return ot(function(a, u) {
@@ -2009,7 +2009,7 @@ function Zo() {
2009
2009
  }, h.finalize), e();
2010
2010
  }, t, n, i);
2011
2011
  });
2012
- } }), Ge && (Ge.allSettled && j(Y, "allSettled", function() {
2012
+ } }), Ge && (Ge.allSettled && M(Y, "allSettled", function() {
2013
2013
  var e = ke.apply(null, arguments).map(un);
2014
2014
  return new Y(function(t) {
2015
2015
  e.length === 0 && t([]);
@@ -2024,7 +2024,7 @@ function Zo() {
2024
2024
  });
2025
2025
  });
2026
2026
  });
2027
- }), Ge.any && typeof AggregateError < "u" && j(Y, "any", function() {
2027
+ }), Ge.any && typeof AggregateError < "u" && M(Y, "any", function() {
2028
2028
  var e = ke.apply(null, arguments).map(un);
2029
2029
  return new Y(function(t, n) {
2030
2030
  e.length === 0 && n(new AggregateError([]));
@@ -2038,15 +2038,15 @@ function Zo() {
2038
2038
  });
2039
2039
  });
2040
2040
  }), Ge.withResolvers && (Y.withResolvers = Ge.withResolvers));
2041
- var De = { awaits: 0, echoes: 0, id: 0 }, Xi = 0, an = [], sn = 0, cn = 0, Hi = 0;
2041
+ var De = { awaits: 0, echoes: 0, id: 0 }, Wi = 0, an = [], sn = 0, cn = 0, Xi = 0;
2042
2042
  function ot(e, t, n, i) {
2043
2043
  var a = z, u = Object.create(a);
2044
- return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Hi, it.env, u.env = Fn ? { Promise: Y, PromiseProp: { value: Y, configurable: !0, writable: !0 }, all: Y.all, race: Y.race, allSettled: Y.allSettled, any: Y.any, resolve: Y.resolve, reject: Y.reject } : {}, t && D(u, t), ++a.ref, u.finalize = function() {
2044
+ return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Xi, it.env, u.env = Fn ? { Promise: Y, PromiseProp: { value: Y, configurable: !0, writable: !0 }, all: Y.all, race: Y.race, allSettled: Y.allSettled, any: Y.any, resolve: Y.resolve, reject: Y.reject } : {}, t && D(u, t), ++a.ref, u.finalize = function() {
2045
2045
  --this.parent.ref || this.parent.finalize();
2046
2046
  }, i = gt(u, e, n, i), u.ref === 0 && u.finalize(), i;
2047
2047
  }
2048
2048
  function St() {
2049
- return De.id || (De.id = ++Xi), ++De.awaits, De.echoes += en, De.id;
2049
+ return De.id || (De.id = ++Wi), ++De.awaits, De.echoes += en, De.id;
2050
2050
  }
2051
2051
  function at() {
2052
2052
  return !!De.awaits && (--De.awaits == 0 && (De.id = 0), De.echoes = De.awaits * en, !0);
@@ -2055,10 +2055,10 @@ function Zo() {
2055
2055
  return De.echoes && e && e.constructor === Ge ? (St(), e.then(function(t) {
2056
2056
  return at(), t;
2057
2057
  }, function(t) {
2058
- return at(), xe(t);
2058
+ return at(), Te(t);
2059
2059
  })) : e;
2060
2060
  }
2061
- function zi() {
2061
+ function Hi() {
2062
2062
  var e = an[an.length - 1];
2063
2063
  an.pop(), st(e, !1);
2064
2064
  }
@@ -2066,7 +2066,7 @@ function Zo() {
2066
2066
  var n, i = z;
2067
2067
  (t ? !De.echoes || sn++ && e === z : !sn || --sn && e === z) || queueMicrotask(t ? (function(a) {
2068
2068
  ++cn, De.echoes && --De.echoes != 0 || (De.echoes = De.awaits = De.id = 0), an.push(z), st(a, !0);
2069
- }).bind(null, e) : zi), e !== z && (z = e, i === it && (it.env = Or()), Fn && (n = it.env.Promise, t = e.env, (i.global || e.global) && (Object.defineProperty(f, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
2069
+ }).bind(null, e) : Hi), e !== z && (z = e, i === it && (it.env = Or()), Fn && (n = it.env.Promise, t = e.env, (i.global || e.global) && (Object.defineProperty(f, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
2070
2070
  }
2071
2071
  function Or() {
2072
2072
  var e = f.Promise;
@@ -2095,7 +2095,7 @@ function Zo() {
2095
2095
  Promise === Ge && De.echoes === 0 ? sn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
2096
2096
  }
2097
2097
  ("" + Le).indexOf("[native code]") === -1 && (St = at = l);
2098
- var xe = Y.reject, yt = "￿", Ze = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Dr = "String expected.", kt = [], ln = "__dbnames", Vn = "readonly", $n = "readwrite";
2098
+ var Te = Y.reject, yt = "￿", Ze = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Dr = "String expected.", kt = [], ln = "__dbnames", Vn = "readonly", $n = "readwrite";
2099
2099
  function vt(e, t) {
2100
2100
  return e ? t ? function() {
2101
2101
  return e.apply(this, arguments) && t.apply(this, arguments);
@@ -2141,7 +2141,7 @@ function Zo() {
2141
2141
  }
2142
2142
  function Rr(e) {
2143
2143
  var t = typeof e;
2144
- return t != "object" ? t : ArrayBuffer.isView(e) ? "binary" : (e = Mt(e), e === "ArrayBuffer" ? "binary" : e);
2144
+ return t != "object" ? t : ArrayBuffer.isView(e) ? "binary" : (e = jt(e), e === "ArrayBuffer" ? "binary" : e);
2145
2145
  }
2146
2146
  function Ir(e) {
2147
2147
  return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
@@ -2157,7 +2157,7 @@ function Zo() {
2157
2157
  })) : n;
2158
2158
  }
2159
2159
  var Pr = (pe.prototype._trans = function(e, t, n) {
2160
- var i = this._tx || z.trans, a = this.name, u = Ne && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
2160
+ var i = this._tx || z.trans, a = this.name, u = Ce && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
2161
2161
  function h(_, T, y) {
2162
2162
  if (!y.schema[a]) throw new Q.NotFound("Table " + a + " not part of transaction");
2163
2163
  return t(y.idbtrans, y);
@@ -2174,7 +2174,7 @@ function Zo() {
2174
2174
  } catch (C) {
2175
2175
  return C.name === ht.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
2176
2176
  return _(T, y, O, w);
2177
- })) : xe(C);
2177
+ })) : Te(C);
2178
2178
  }
2179
2179
  return x._promise(y, function(C, N) {
2180
2180
  return ot(function() {
@@ -2190,9 +2190,9 @@ function Zo() {
2190
2190
  });
2191
2191
  });
2192
2192
  }
2193
- if (T._state.openComplete) return xe(new Q.DatabaseClosed(T._state.dbOpenError));
2193
+ if (T._state.openComplete) return Te(new Q.DatabaseClosed(T._state.dbOpenError));
2194
2194
  if (!T._state.isBeingOpened) {
2195
- if (!T._state.autoOpen) return xe(new Q.DatabaseClosed());
2195
+ if (!T._state.autoOpen) return Te(new Q.DatabaseClosed());
2196
2196
  T.open().catch(l);
2197
2197
  }
2198
2198
  return T._state.dbReadyPromise.then(function() {
@@ -2200,14 +2200,14 @@ function Zo() {
2200
2200
  });
2201
2201
  })(this.db, e, [this.name], h);
2202
2202
  return u && (b._consoleTask = u, b = b.catch(function(_) {
2203
- return console.trace(_), xe(_);
2203
+ return console.trace(_), Te(_);
2204
2204
  })), b;
2205
2205
  } finally {
2206
2206
  p && Dt();
2207
2207
  }
2208
2208
  }, pe.prototype.get = function(e, t) {
2209
2209
  var n = this;
2210
- return e && e.constructor === Object ? this.where(e).first(t) : e == null ? xe(new Q.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(i) {
2210
+ return e && e.constructor === Object ? this.where(e).first(t) : e == null ? Te(new Q.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(i) {
2211
2211
  return n.core.get({ trans: i, key: e }).then(function(a) {
2212
2212
  return n.hook.reading.fire(a);
2213
2213
  });
@@ -2234,7 +2234,7 @@ function Zo() {
2234
2234
  return e[b];
2235
2235
  }));
2236
2236
  }
2237
- !n && Ne && console.warn("The query ".concat(JSON.stringify(e), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(t.join("+"), "]"));
2237
+ !n && Ce && console.warn("The query ".concat(JSON.stringify(e), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(t.join("+"), "]"));
2238
2238
  var i = this.schema.idxByName;
2239
2239
  function a(p, b) {
2240
2240
  return ae(p, b) === 0;
@@ -2315,7 +2315,7 @@ function Zo() {
2315
2315
  return p;
2316
2316
  });
2317
2317
  }, pe.prototype.update = function(e, t) {
2318
- return typeof e != "object" || g(e) ? this.where(":id").equals(e).modify(t) : (e = he(e, this.schema.primKey.keyPath), e === void 0 ? xe(new Q.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
2318
+ return typeof e != "object" || g(e) ? this.where(":id").equals(e).modify(t) : (e = he(e, this.schema.primKey.keyPath), e === void 0 ? Te(new Q.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
2319
2319
  }, pe.prototype.put = function(e, t) {
2320
2320
  var n = this, i = this.schema.primKey, a = i.auto, u = i.keyPath, h = e;
2321
2321
  return u && a && (h = fn(u)(e)), this._trans("readwrite", function(p) {
@@ -2366,7 +2366,7 @@ function Zo() {
2366
2366
  return i.core.mutate({ trans: h, type: "add", keys: a, values: _, wantResults: u }).then(function(x) {
2367
2367
  var y = x.numFailures, O = x.results, w = x.lastResult, x = x.failures;
2368
2368
  if (y === 0) return u ? O : w;
2369
- throw new je("".concat(i.name, ".bulkAdd(): ").concat(y, " of ").concat(b, " operations failed"), x);
2369
+ throw new Me("".concat(i.name, ".bulkAdd(): ").concat(y, " of ").concat(b, " operations failed"), x);
2370
2370
  });
2371
2371
  });
2372
2372
  }, pe.prototype.bulkPut = function(e, t, n) {
@@ -2379,7 +2379,7 @@ function Zo() {
2379
2379
  return i.core.mutate({ trans: h, type: "put", keys: a, values: _, wantResults: u }).then(function(x) {
2380
2380
  var y = x.numFailures, O = x.results, w = x.lastResult, x = x.failures;
2381
2381
  if (y === 0) return u ? O : w;
2382
- throw new je("".concat(i.name, ".bulkPut(): ").concat(y, " of ").concat(b, " operations failed"), x);
2382
+ throw new Me("".concat(i.name, ".bulkPut(): ").concat(y, " of ").concat(b, " operations failed"), x);
2383
2383
  });
2384
2384
  });
2385
2385
  }, pe.prototype.bulkUpdate = function(e) {
@@ -2411,7 +2411,7 @@ function Zo() {
2411
2411
  var N, A = C[x], k = u[Number(A)];
2412
2412
  k != null && (N = w[A], delete w[A], w[k] = N);
2413
2413
  }
2414
- throw new je("".concat(t.name, ".bulkUpdate(): ").concat(O, " of ").concat(T, " operations failed"), w);
2414
+ throw new Me("".concat(t.name, ".bulkUpdate(): ").concat(O, " of ").concat(T, " operations failed"), w);
2415
2415
  });
2416
2416
  });
2417
2417
  });
@@ -2424,7 +2424,7 @@ function Zo() {
2424
2424
  }).then(function(h) {
2425
2425
  var a = h.numFailures, u = h.lastResult, h = h.failures;
2426
2426
  if (a === 0) return u;
2427
- throw new je("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), h);
2427
+ throw new Me("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), h);
2428
2428
  });
2429
2429
  }, pe);
2430
2430
  function pe() {
@@ -2505,7 +2505,7 @@ function Zo() {
2505
2505
  return b.stop(O);
2506
2506
  }, function(O) {
2507
2507
  return b.fail(O);
2508
- }) || ((y = "" + (T = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(T)), M(u, y) || (u[y] = !0, t(p, b, _)));
2508
+ }) || ((y = "" + (T = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(T)), j(u, y) || (u[y] = !0, t(p, b, _)));
2509
2509
  };
2510
2510
  return Promise.all([e.or._iterate(h, n), Br(Fr(e, i, n), e.algorithm, h, !e.keysOnly && e.valueMapper)]);
2511
2511
  }
@@ -2532,7 +2532,7 @@ function Zo() {
2532
2532
  });
2533
2533
  });
2534
2534
  }
2535
- var Vt = (Mr.prototype.execute = function(e) {
2535
+ var Vt = (jr.prototype.execute = function(e) {
2536
2536
  var t = this["@@propmod"];
2537
2537
  if (t.add !== void 0) {
2538
2538
  var n = t.add;
@@ -2559,16 +2559,16 @@ function Zo() {
2559
2559
  throw new TypeError("Invalid subtrahend ".concat(i));
2560
2560
  }
2561
2561
  return n = (n = t.replacePrefix) === null || n === void 0 ? void 0 : n[0], n && typeof e == "string" && e.startsWith(n) ? t.replacePrefix[1] + e.substring(n.length) : e;
2562
- }, Mr);
2563
- function Mr(e) {
2562
+ }, jr);
2563
+ function jr(e) {
2564
2564
  this["@@propmod"] = e;
2565
2565
  }
2566
- var Qi = (ue.prototype._read = function(e, t) {
2566
+ var zi = (ue.prototype._read = function(e, t) {
2567
2567
  var n = this._ctx;
2568
- return n.error ? n.table._trans(null, xe.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
2568
+ return n.error ? n.table._trans(null, Te.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
2569
2569
  }, ue.prototype._write = function(e) {
2570
2570
  var t = this._ctx;
2571
- return t.error ? t.table._trans(null, xe.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
2571
+ return t.error ? t.table._trans(null, Te.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
2572
2572
  }, ue.prototype._addAlgorithm = function(e) {
2573
2573
  var t = this._ctx;
2574
2574
  t.algorithm = vt(t.algorithm, e);
@@ -2721,7 +2721,7 @@ function Zo() {
2721
2721
  if (!e || !e.multi) return this;
2722
2722
  var t = {};
2723
2723
  return Gn(this._ctx, function(a) {
2724
- var i = a.primaryKey.toString(), a = M(t, i);
2724
+ var i = a.primaryKey.toString(), a = j(t, i);
2725
2725
  return t[i] = !0, !a;
2726
2726
  }), this;
2727
2727
  }, ue.prototype.modify = function(e) {
@@ -2745,7 +2745,7 @@ function Zo() {
2745
2745
  w.push(P[L]);
2746
2746
  }
2747
2747
  }
2748
- var w = [], x = 0, C = [], N = e === jr;
2748
+ var w = [], x = 0, C = [], N = e === Mr;
2749
2749
  return t.clone().primaryKeys().then(function(A) {
2750
2750
  function k(F) {
2751
2751
  var K = Math.min(T, A.length - F), V = A.slice(F, F + K);
@@ -2755,18 +2755,18 @@ function Zo() {
2755
2755
  var se = L[re], te = { value: ze(se), primKey: A[F + re] };
2756
2756
  h.call(te, te.value, te) !== !1 && (te.value == null ? W.push(A[F + re]) : b || ae(_(se), _(te.value)) === 0 ? (G.push(te.value), b && $.push(A[F + re])) : (W.push(A[F + re]), U.push(te.value)));
2757
2757
  }
2758
- return Promise.resolve(0 < U.length && p.mutate({ trans: i, type: "add", values: U }).then(function(_e) {
2759
- for (var ee in _e.failures) W.splice(parseInt(ee), 1);
2760
- O(U.length, _e);
2758
+ return Promise.resolve(0 < U.length && p.mutate({ trans: i, type: "add", values: U }).then(function(Ee) {
2759
+ for (var ee in Ee.failures) W.splice(parseInt(ee), 1);
2760
+ O(U.length, Ee);
2761
2761
  })).then(function() {
2762
- return (0 < G.length || P && typeof e == "object") && p.mutate({ trans: i, type: "put", keys: $, values: G, criteria: P, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < F }).then(function(_e) {
2763
- return O(G.length, _e);
2762
+ return (0 < G.length || P && typeof e == "object") && p.mutate({ trans: i, type: "put", keys: $, values: G, criteria: P, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < F }).then(function(Ee) {
2763
+ return O(G.length, Ee);
2764
2764
  });
2765
2765
  }).then(function() {
2766
- return (0 < W.length || P && N) && p.mutate({ trans: i, type: "delete", keys: W, criteria: P, isAdditionalChunk: 0 < F }).then(function(_e) {
2767
- return dn(n.table, W, _e);
2768
- }).then(function(_e) {
2769
- return O(W.length, _e);
2766
+ return (0 < W.length || P && N) && p.mutate({ trans: i, type: "delete", keys: W, criteria: P, isAdditionalChunk: 0 < F }).then(function(Ee) {
2767
+ return dn(n.table, W, Ee);
2768
+ }).then(function(Ee) {
2769
+ return O(W.length, Ee);
2770
2770
  });
2771
2771
  }).then(function() {
2772
2772
  return A.length > F + K && k(F + T);
@@ -2782,7 +2782,7 @@ function Zo() {
2782
2782
  });
2783
2783
  }, ue.prototype.delete = function() {
2784
2784
  var e = this._ctx, t = e.range;
2785
- return !Rt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(jr) : this._write(function(n) {
2785
+ return !Rt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Mr) : this._write(function(n) {
2786
2786
  var i = e.table.core.schema.primaryKey, a = t;
2787
2787
  return e.table.core.count({ trans: n, query: { index: i, range: a } }).then(function(u) {
2788
2788
  return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(b) {
@@ -2797,13 +2797,13 @@ function Zo() {
2797
2797
  }, ue);
2798
2798
  function ue() {
2799
2799
  }
2800
- var jr = function(e, t) {
2800
+ var Mr = function(e, t) {
2801
2801
  return t.value = null;
2802
2802
  };
2803
- function Zi(e, t) {
2803
+ function Qi(e, t) {
2804
2804
  return e < t ? -1 : e === t ? 0 : 1;
2805
2805
  }
2806
- function Ji(e, t) {
2806
+ function Zi(e, t) {
2807
2807
  return t < e ? -1 : e === t ? 0 : 1;
2808
2808
  }
2809
2809
  function qe(e, t, n) {
@@ -2828,7 +2828,7 @@ function Zo() {
2828
2828
  return N.toLowerCase();
2829
2829
  } : function(N) {
2830
2830
  return N.toUpperCase();
2831
- }, h = x === "next" ? Zi : Ji;
2831
+ }, h = x === "next" ? Qi : Zi;
2832
2832
  var C = n.map(function(N) {
2833
2833
  return { lower: u(N), upper: a(N) };
2834
2834
  }).sort(function(N, A) {
@@ -2854,9 +2854,9 @@ function Zo() {
2854
2854
  for (var P = null, F = w; F < y; ++F) {
2855
2855
  var K = (function(V, L, U, G, $, W) {
2856
2856
  for (var re = Math.min(V.length, G.length), se = -1, te = 0; te < re; ++te) {
2857
- var _e = L[te];
2858
- if (_e !== G[te]) return $(V[te], U[te]) < 0 ? V.substr(0, te) + U[te] + U.substr(te + 1) : $(V[te], G[te]) < 0 ? V.substr(0, te) + G[te] + U.substr(te + 1) : 0 <= se ? V.substr(0, se) + L[se] + U.substr(se + 1) : null;
2859
- $(V[te], _e) < 0 && (se = te);
2857
+ var Ee = L[te];
2858
+ if (Ee !== G[te]) return $(V[te], U[te]) < 0 ? V.substr(0, te) + U[te] + U.substr(te + 1) : $(V[te], G[te]) < 0 ? V.substr(0, te) + G[te] + U.substr(te + 1) : 0 <= se ? V.substr(0, se) + L[se] + U.substr(se + 1) : null;
2859
+ $(V[te], Ee) < 0 && (se = te);
2860
2860
  }
2861
2861
  return re < G.length && W === "next" ? V + U.substr(V.length) : re < V.length && W === "prev" ? V.substr(0, U.length) : se < 0 ? null : V.substr(0, se) + G[se] + U.substr(se + 1);
2862
2862
  })(A, k, p[F], b[F], h, _);
@@ -3022,7 +3022,7 @@ function Zo() {
3022
3022
  function $t(e) {
3023
3023
  e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
3024
3024
  }
3025
- var Gt = "storagemutated", Wn = "x-storagemutated-1", ut = Lt(null, Gt), eo = (We.prototype._lock = function() {
3025
+ var Gt = "storagemutated", Wn = "x-storagemutated-1", ut = Lt(null, Gt), Ji = (We.prototype._lock = function() {
3026
3026
  return Z(!z.global), ++this._reculock, this._reculock !== 1 || z.global || (z.lockOwnerFor = this), this;
3027
3027
  }, We.prototype._unlock = function() {
3028
3028
  if (Z(!z.global), --this._reculock == 0) for (z.global || (z.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) {
@@ -3057,8 +3057,8 @@ function Zo() {
3057
3057
  }), this;
3058
3058
  }, We.prototype._promise = function(e, t, n) {
3059
3059
  var i = this;
3060
- if (e === "readwrite" && this.mode !== "readwrite") return xe(new Q.ReadOnly("Transaction is readonly"));
3061
- if (!this.active) return xe(new Q.TransactionInactive());
3060
+ if (e === "readwrite" && this.mode !== "readwrite") return Te(new Q.ReadOnly("Transaction is readonly"));
3061
+ if (!this.active) return Te(new Q.TransactionInactive());
3062
3062
  if (this._locked()) return new Y(function(u, h) {
3063
3063
  i._blockedFuncs.push([function() {
3064
3064
  i._promise(e, t, n).then(u, h);
@@ -3103,7 +3103,7 @@ function Zo() {
3103
3103
  this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new Q.Abort()));
3104
3104
  }, We.prototype.table = function(e) {
3105
3105
  var t = this._memoizedTables || (this._memoizedTables = {});
3106
- if (M(t, e)) return t[e];
3106
+ if (j(t, e)) return t[e];
3107
3107
  var n = this.schema[e];
3108
3108
  if (!n) throw new Q.NotFound("Table " + e + " not part of transaction");
3109
3109
  return n = new this.db.Table(e, n, this), n.core = this.db.core.table(e), t[e] = n;
@@ -3149,11 +3149,11 @@ function Zo() {
3149
3149
  function Ur(e) {
3150
3150
  return [].slice.call(e);
3151
3151
  }
3152
- var to = 0;
3152
+ var eo = 0;
3153
3153
  function Wt(e) {
3154
3154
  return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
3155
3155
  }
3156
- function no(e, t, b) {
3156
+ function to(e, t, b) {
3157
3157
  function i(N) {
3158
3158
  if (N.type === 3) return null;
3159
3159
  if (N.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
@@ -3171,27 +3171,27 @@ function Zo() {
3171
3171
  var $, W = (k || P || { length: 1 }).length;
3172
3172
  if (k && P && k.length !== P.length) throw new Error("Given keys array must have same length as given values array.");
3173
3173
  if (W === 0) return K({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
3174
- function re(Me) {
3175
- ++_e, $t(Me);
3174
+ function re(je) {
3175
+ ++Ee, $t(je);
3176
3176
  }
3177
- var se = [], te = [], _e = 0;
3177
+ var se = [], te = [], Ee = 0;
3178
3178
  if (A === "deleteRange") {
3179
- if (F.type === 4) return K({ numFailures: _e, failures: te, results: [], lastResult: void 0 });
3179
+ if (F.type === 4) return K({ numFailures: Ee, failures: te, results: [], lastResult: void 0 });
3180
3180
  F.type === 3 ? se.push($ = L.clear()) : se.push($ = L.delete(i(F)));
3181
3181
  } else {
3182
3182
  var U = G ? U ? [P, k] : [P, null] : [k, null], ee = U[0], Pe = U[1];
3183
3183
  if (G) for (var Fe = 0; Fe < W; ++Fe) se.push($ = Pe && Pe[Fe] !== void 0 ? L[A](ee[Fe], Pe[Fe]) : L[A](ee[Fe])), $.onerror = re;
3184
3184
  else for (Fe = 0; Fe < W; ++Fe) se.push($ = L[A](ee[Fe])), $.onerror = re;
3185
3185
  }
3186
- function On(Me) {
3187
- Me = Me.target.result, se.forEach(function(_t, mr) {
3186
+ function On(je) {
3187
+ je = je.target.result, se.forEach(function(_t, mr) {
3188
3188
  return _t.error != null && (te[mr] = _t.error);
3189
- }), K({ numFailures: _e, failures: te, results: A === "delete" ? k : se.map(function(_t) {
3189
+ }), K({ numFailures: Ee, failures: te, results: A === "delete" ? k : se.map(function(_t) {
3190
3190
  return _t.result;
3191
- }), lastResult: Me });
3191
+ }), lastResult: je });
3192
3192
  }
3193
- $.onerror = function(Me) {
3194
- re(Me), On(Me);
3193
+ $.onerror = function(je) {
3194
+ re(je), On(je);
3195
3195
  }, $.onsuccess = On;
3196
3196
  });
3197
3197
  }, getMany: function(C) {
@@ -3230,8 +3230,8 @@ function Zo() {
3230
3230
  K = ge(K);
3231
3231
  var G = k.index, L = k.range, U = N.objectStore(x), U = G.isPrimaryKey ? U : U.index(G.name), G = P ? F ? "prevunique" : "prev" : F ? "nextunique" : "next", $ = !A && "openKeyCursor" in U ? U.openKeyCursor(i(L), G) : U.openCursor(i(L), G);
3232
3232
  $.onerror = Ye(V), $.onsuccess = ge(function(W) {
3233
- var re, se, te, _e, ee = $.result;
3234
- ee ? (ee.___id = ++to, ee.done = !1, re = ee.continue.bind(ee), se = (se = ee.continuePrimaryKey) && se.bind(ee), te = ee.advance.bind(ee), _e = function() {
3233
+ var re, se, te, Ee, ee = $.result;
3234
+ ee ? (ee.___id = ++eo, ee.done = !1, re = ee.continue.bind(ee), se = (se = ee.continuePrimaryKey) && se.bind(ee), te = ee.advance.bind(ee), Ee = function() {
3235
3235
  throw new Error("Cursor not stopped");
3236
3236
  }, ee.trans = N, ee.stop = ee.continue = ee.continuePrimaryKey = ee.advance = function() {
3237
3237
  throw new Error("Cursor not started");
@@ -3246,19 +3246,19 @@ function Zo() {
3246
3246
  function Fe() {
3247
3247
  if ($.result) try {
3248
3248
  Pe();
3249
- } catch (Me) {
3250
- ee.fail(Me);
3249
+ } catch (je) {
3250
+ ee.fail(je);
3251
3251
  }
3252
3252
  else ee.done = !0, ee.start = function() {
3253
3253
  throw new Error("Cursor behind last entry");
3254
3254
  }, ee.stop();
3255
3255
  }
3256
- var On = new Promise(function(Me, _t) {
3257
- Me = ge(Me), $.onerror = Ye(_t), ee.fail = _t, ee.stop = function(mr) {
3258
- ee.stop = ee.continue = ee.continuePrimaryKey = ee.advance = _e, Me(mr);
3256
+ var On = new Promise(function(je, _t) {
3257
+ je = ge(je), $.onerror = Ye(_t), ee.fail = _t, ee.stop = function(mr) {
3258
+ ee.stop = ee.continue = ee.continuePrimaryKey = ee.advance = Ee, je(mr);
3259
3259
  };
3260
3260
  });
3261
- return $.onsuccess = ge(function(Me) {
3261
+ return $.onsuccess = ge(function(je) {
3262
3262
  $.onsuccess = Fe, Fe();
3263
3263
  }), ee.continue = re, ee.continuePrimaryKey = se, ee.advance = te, Fe(), On;
3264
3264
  }, K(ee)) : K(null);
@@ -3294,14 +3294,14 @@ function Zo() {
3294
3294
  return y[O];
3295
3295
  }, MIN_KEY: -1 / 0, MAX_KEY: Yt(t), schema: b };
3296
3296
  }
3297
- function ro(e, t, n, i) {
3297
+ function no(e, t, n, i) {
3298
3298
  var a = n.IDBKeyRange;
3299
- return n.indexedDB, { dbcore: (i = no(t, a, i), e.dbcore.reduce(function(u, h) {
3299
+ return n.indexedDB, { dbcore: (i = to(t, a, i), e.dbcore.reduce(function(u, h) {
3300
3300
  return h = h.create, o(o({}, u), h(u));
3301
3301
  }, i)) };
3302
3302
  }
3303
3303
  function gn(e, i) {
3304
- var n = i.db, i = ro(e._middlewares, n, e._deps, i);
3304
+ var n = i.db, i = no(e._middlewares, n, e._deps, i);
3305
3305
  e.core = i.dbcore, e.tables.forEach(function(a) {
3306
3306
  var u = a.name;
3307
3307
  e.core.schema.tables.some(function(h) {
@@ -3316,10 +3316,10 @@ function Zo() {
3316
3316
  var p = (function b(_, T) {
3317
3317
  return H(_, T) || (_ = I(_)) && b(_, T);
3318
3318
  })(h, a);
3319
- (!p || "value" in p && p.value === void 0) && (h === e.Transaction.prototype || h instanceof e.Transaction ? j(h, a, { get: function() {
3319
+ (!p || "value" in p && p.value === void 0) && (h === e.Transaction.prototype || h instanceof e.Transaction ? M(h, a, { get: function() {
3320
3320
  return this.table(a);
3321
3321
  }, set: function(b) {
3322
- ie(this, a, { value: b, writable: !0, configurable: !0, enumerable: !0 });
3322
+ oe(this, a, { value: b, writable: !0, configurable: !0, enumerable: !0 });
3323
3323
  } }) : h[a] = new e.Table(a, u));
3324
3324
  });
3325
3325
  });
@@ -3329,10 +3329,10 @@ function Zo() {
3329
3329
  for (var i in n) n[i] instanceof e.Table && delete n[i];
3330
3330
  });
3331
3331
  }
3332
- function io(e, t) {
3332
+ function ro(e, t) {
3333
3333
  return e._cfg.version - t._cfg.version;
3334
3334
  }
3335
- function oo(e, t, n, i) {
3335
+ function io(e, t, n, i) {
3336
3336
  var a = e._dbSchema;
3337
3337
  n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Hn("$meta", $r("")[0], []), e._storeNames.push("$meta"));
3338
3338
  var u = e._createTransaction("readwrite", e._storeNames, a);
@@ -3401,7 +3401,7 @@ function Zo() {
3401
3401
  var b, _;
3402
3402
  });
3403
3403
  }
3404
- function ao(e, t) {
3404
+ function oo(e, t) {
3405
3405
  Vr(e._dbSchema, t), t.db.version % 10 != 0 || t.objectStoreNames.contains("$meta") || t.db.createObjectStore("$meta").add(Math.ceil(t.db.version / 10 - 1), "version");
3406
3406
  var n = bn(0, e.idbdb, t);
3407
3407
  wn(e, e._dbSchema, t);
@@ -3410,7 +3410,7 @@ function Zo() {
3410
3410
  if (h.change.length || h.recreate) return console.warn("Unable to patch indexes of table ".concat(h.name, " because it has changes on the type of index or primary key.")), { value: void 0 };
3411
3411
  var p = t.objectStore(h.name);
3412
3412
  h.add.forEach(function(b) {
3413
- Ne && console.debug("Dexie upgrade patch: Creating missing index ".concat(h.name, ".").concat(b.src)), vn(p, b);
3413
+ Ce && console.debug("Dexie upgrade patch: Creating missing index ".concat(h.name, ".").concat(b.src)), vn(p, b);
3414
3414
  });
3415
3415
  })(a[i]);
3416
3416
  if (typeof u == "object") return u.value;
@@ -3445,7 +3445,7 @@ function Zo() {
3445
3445
  }
3446
3446
  function Vr(e, t) {
3447
3447
  v(e).forEach(function(n) {
3448
- t.db.objectStoreNames.contains(n) || (Ne && console.debug("Dexie: Creating missing table", n), Jn(t, n, e[n].primKey, e[n].indexes));
3448
+ t.db.objectStoreNames.contains(n) || (Ce && console.debug("Dexie: Creating missing table", n), Jn(t, n, e[n].primKey, e[n].indexes));
3449
3449
  });
3450
3450
  }
3451
3451
  function vn(e, t) {
@@ -3478,7 +3478,7 @@ function Zo() {
3478
3478
  return Xn(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), g(u), n === 0, i);
3479
3479
  });
3480
3480
  }
3481
- var so = (Pt.prototype._createTableSchema = Hn, Pt.prototype._parseIndexSyntax = $r, Pt.prototype._parseStoresSpec = function(e, t) {
3481
+ var ao = (Pt.prototype._createTableSchema = Hn, Pt.prototype._parseIndexSyntax = $r, Pt.prototype._parseStoresSpec = function(e, t) {
3482
3482
  var n = this;
3483
3483
  v(e).forEach(function(i) {
3484
3484
  if (e[i] !== null) {
@@ -3583,7 +3583,7 @@ function Zo() {
3583
3583
  return v(t).forEach(function(n) {
3584
3584
  e[n] ? Ht(e[n], t[n]) : e[n] = (function i(a) {
3585
3585
  var u, h, p = {};
3586
- for (u in a) M(a, u) && (h = a[u], p[u] = !h || typeof h != "object" || Bt.has(h.constructor) ? h : i(h));
3586
+ for (u in a) j(a, u) && (h = a[u], p[u] = !h || typeof h != "object" || Bt.has(h.constructor) ? h : i(h));
3587
3587
  return p;
3588
3588
  })(t[n]);
3589
3589
  }), e;
@@ -3605,7 +3605,7 @@ function Zo() {
3605
3605
  }, hasKey: function(e) {
3606
3606
  var t = _n(this).next(e).value;
3607
3607
  return t && ae(t.from, e) <= 0 && 0 <= ae(t.to, e);
3608
- } })[jt] = function() {
3608
+ } })[Mt] = function() {
3609
3609
  return _n(this);
3610
3610
  }, Le));
3611
3611
  var bt = {}, or = {}, ar = !1;
@@ -3641,10 +3641,10 @@ function Zo() {
3641
3641
  e.queries.query[b] = _;
3642
3642
  }
3643
3643
  }
3644
- function co(e) {
3644
+ function so(e) {
3645
3645
  var t = e._state, n = e._deps.indexedDB;
3646
3646
  if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then(function() {
3647
- return t.dbOpenError ? xe(t.dbOpenError) : e;
3647
+ return t.dbOpenError ? Te(t.dbOpenError) : e;
3648
3648
  });
3649
3649
  t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
3650
3650
  var i = t.openCanceller, a = Math.round(10 * e.verno), u = !1;
@@ -3660,7 +3660,7 @@ function Zo() {
3660
3660
  var A;
3661
3661
  T = C.transaction, t.autoSchema && !e._options.allowEmptyDB ? (C.onerror = $t, T.abort(), C.result.close(), (A = n.deleteDatabase(x)).onsuccess = A.onerror = ge(function() {
3662
3662
  w(new Q.NoSuchDatabase("Database ".concat(x, " doesnt exist")));
3663
- })) : (T.onerror = Ye(w), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, y = N < 1, e.idbdb = C.result, u && ao(e, T), oo(e, N / 10, T, w));
3663
+ })) : (T.onerror = Ye(w), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, y = N < 1, e.idbdb = C.result, u && oo(e, T), io(e, N / 10, T, w));
3664
3664
  }, w), C.onsuccess = ge(function() {
3665
3665
  T = null;
3666
3666
  var N, A, k, P, F, K = e.idbdb = C.result, V = ye(K.objectStoreNames);
@@ -3717,7 +3717,7 @@ function Zo() {
3717
3717
  T && T.abort();
3718
3718
  } catch {
3719
3719
  }
3720
- return i === t.openCanceller && e._close(), xe(O);
3720
+ return i === t.openCanceller && e._close(), Te(O);
3721
3721
  }).finally(function() {
3722
3722
  t.openComplete = !0, _();
3723
3723
  }).then(function() {
@@ -3748,7 +3748,7 @@ function Zo() {
3748
3748
  for (var i = g(e) ? e.slice() : [e], a = 0; a < n; ++a) i.push(t);
3749
3749
  return i;
3750
3750
  }
3751
- var uo = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3751
+ var co = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3752
3752
  return o(o({}, e), { table: function(t) {
3753
3753
  var n = e.table(t), i = n.schema, a = {}, u = [];
3754
3754
  function h(y, O, w) {
@@ -3797,15 +3797,15 @@ function Zo() {
3797
3797
  function ur(e, t, n, i) {
3798
3798
  return n = n || {}, i = i || "", v(e).forEach(function(a) {
3799
3799
  var u, h, p;
3800
- M(t, a) ? (u = e[a], h = t[a], typeof u == "object" && typeof h == "object" && u && h ? (p = Mt(u)) !== Mt(h) ? n[i + a] = t[a] : p === "Object" ? ur(u, h, n, i + a + ".") : u !== h && (n[i + a] = t[a]) : u !== h && (n[i + a] = t[a])) : n[i + a] = void 0;
3800
+ j(t, a) ? (u = e[a], h = t[a], typeof u == "object" && typeof h == "object" && u && h ? (p = jt(u)) !== jt(h) ? n[i + a] = t[a] : p === "Object" ? ur(u, h, n, i + a + ".") : u !== h && (n[i + a] = t[a]) : u !== h && (n[i + a] = t[a])) : n[i + a] = void 0;
3801
3801
  }), v(t).forEach(function(a) {
3802
- M(e, a) || (n[i + a] = t[a]);
3802
+ j(e, a) || (n[i + a] = t[a]);
3803
3803
  }), n;
3804
3804
  }
3805
3805
  function lr(e, t) {
3806
3806
  return t.type === "delete" ? t.keys : t.keys || t.values.map(e.extractKey);
3807
3807
  }
3808
- var lo = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3808
+ var uo = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3809
3809
  return o(o({}, e), { table: function(t) {
3810
3810
  var n = e.table(t), i = n.schema.primaryKey;
3811
3811
  return o(o({}, n), { mutate: function(a) {
@@ -3847,7 +3847,7 @@ function Zo() {
3847
3847
  var k = N.map(function(P, F) {
3848
3848
  var K, V, L, U = A[F], G = { onerror: null, onsuccess: null };
3849
3849
  return y.type === "delete" ? p.fire.call(G, P, U, C) : y.type === "add" || U === void 0 ? (K = b.fire.call(G, P, y.values[F], C), P == null && K != null && (y.keys[F] = P = K, i.outbound || de(y.values[F], i.keyPath, P))) : (K = ur(U, y.values[F]), (V = _.fire.call(G, K, P, U, C)) && (L = y.values[F], Object.keys(V).forEach(function($) {
3850
- M(L, $) ? L[$] = V[$] : de(L, $, V[$]);
3850
+ j(L, $) ? L[$] = V[$] : de(L, $, V[$]);
3851
3851
  }))), G;
3852
3852
  });
3853
3853
  return n.mutate(y).then(function(P) {
@@ -3875,7 +3875,7 @@ function Zo() {
3875
3875
  return null;
3876
3876
  }
3877
3877
  }
3878
- var fo = { stack: "dbcore", level: -1, create: function(e) {
3878
+ var lo = { stack: "dbcore", level: -1, create: function(e) {
3879
3879
  return { table: function(t) {
3880
3880
  var n = e.table(t);
3881
3881
  return o(o({}, n), { getMany: function(i) {
@@ -3903,7 +3903,7 @@ function Zo() {
3903
3903
  return !1;
3904
3904
  }
3905
3905
  }
3906
- var ho = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3906
+ var fo = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3907
3907
  var t = e.schema.name, n = new Ie(e.MIN_KEY, e.MAX_KEY);
3908
3908
  return o(o({}, e), { transaction: function(i, a, u) {
3909
3909
  if (z.subscr && a !== "readonly") throw new Q.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(z.querier));
@@ -3924,8 +3924,8 @@ function Zo() {
3924
3924
  return te != null ? $.extractKey(te) : null;
3925
3925
  }
3926
3926
  function se(te) {
3927
- return $.multiEntry && g(te) ? te.forEach(function(_e) {
3928
- return W.addKey(_e);
3927
+ return $.multiEntry && g(te) ? te.forEach(function(Ee) {
3928
+ return W.addKey(Ee);
3929
3929
  }) : W.addKey(te);
3930
3930
  }
3931
3931
  (N || A).forEach(function(te, Pe) {
@@ -3940,7 +3940,7 @@ function Zo() {
3940
3940
  return W.extractKey(ee);
3941
3941
  }), se = W.keyPath.findIndex(function(ee) {
3942
3942
  return ee === h.keyPath;
3943
- }), te = 0, _e = $.results.length; te < _e; ++te) re[te][se] = $.results[te];
3943
+ }), te = 0, Ee = $.results.length; te < Ee; ++te) re[te][se] = $.results[te];
3944
3944
  x(W.name).addKeys(re);
3945
3945
  })), k.mutatedParts = En(k.mutatedParts || {}, P), $;
3946
3946
  });
@@ -4058,7 +4058,7 @@ function Zo() {
4058
4058
  function ei(e, t) {
4059
4059
  return ae(e.lower, t.lower) === 0 && ae(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
4060
4060
  }
4061
- function mo(e, t) {
4061
+ function ho(e, t) {
4062
4062
  return (function(n, i, a, u) {
4063
4063
  if (n === void 0) return i !== void 0 ? -1 : 0;
4064
4064
  if (i === void 0) return 1;
@@ -4079,7 +4079,7 @@ function Zo() {
4079
4079
  return i;
4080
4080
  })(e.upper, t.upper, e.upperOpen, t.upperOpen);
4081
4081
  }
4082
- function po(e, t, n, i) {
4082
+ function mo(e, t, n, i) {
4083
4083
  e.subscribers.add(n), i.addEventListener("abort", function() {
4084
4084
  var a, u;
4085
4085
  e.subscribers.delete(n), e.subscribers.size === 0 && (a = e, u = t, setTimeout(function() {
@@ -4087,7 +4087,7 @@ function Zo() {
4087
4087
  }, 3e3));
4088
4088
  });
4089
4089
  }
4090
- var go = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
4090
+ var po = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
4091
4091
  var t = e.schema.name;
4092
4092
  return o(o({}, e), { transaction: function(n, i, a) {
4093
4093
  var u, h, p = e.transaction(n, i, a);
@@ -4156,7 +4156,7 @@ function Zo() {
4156
4156
  return K.req.limit === A.limit && K.req.values === A.values && ei(K.req.query.range, A.query.range);
4157
4157
  });
4158
4158
  return F ? [F, !0, k, P] : [P.find(function(K) {
4159
- return ("limit" in K.req ? K.req.limit : 1 / 0) >= A.limit && (!A.values || K.req.values) && mo(K.req.query.range, A.query.range);
4159
+ return ("limit" in K.req ? K.req.limit : 1 / 0) >= A.limit && (!A.values || K.req.values) && ho(K.req.query.range, A.query.range);
4160
4160
  }), !1, k, P];
4161
4161
  case "count":
4162
4162
  return F = P.find(function(K) {
@@ -4173,7 +4173,7 @@ function Zo() {
4173
4173
  return x;
4174
4174
  }).catch(function(x) {
4175
4175
  return w && T && Ke(w, T), Promise.reject(x);
4176
- }), T = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(T) : (w = [T], (O = O || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), po(T, w, p, b), T.promise.then(function(x) {
4176
+ }), T = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(T) : (w = [T], (O = O || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), mo(T, w, p, b), T.promise.then(function(x) {
4177
4177
  return { result: Jr(x.result, u, O?.optimisticOps, i, T, h) };
4178
4178
  });
4179
4179
  } });
@@ -4184,15 +4184,15 @@ function Zo() {
4184
4184
  return i === "db" ? t : Reflect.get(n, i, a);
4185
4185
  } });
4186
4186
  }
4187
- var Je = (Te.prototype.version = function(e) {
4187
+ var Je = (Ne.prototype.version = function(e) {
4188
4188
  if (isNaN(e) || e < 0.1) throw new Q.Type("Given version is not a positive number");
4189
4189
  if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new Q.Schema("Cannot add version when database is open");
4190
4190
  this.verno = Math.max(this.verno, e);
4191
4191
  var t = this._versions, n = t.filter(function(i) {
4192
4192
  return i._cfg.version === e;
4193
4193
  })[0];
4194
- return n || (n = new this.Version(e), t.push(n), t.sort(io), n.stores({}), this._state.autoSchema = !1, n);
4195
- }, Te.prototype._whenReady = function(e) {
4194
+ return n || (n = new this.Version(e), t.push(n), t.sort(ro), n.stores({}), this._state.autoSchema = !1, n);
4195
+ }, Ne.prototype._whenReady = function(e) {
4196
4196
  var t = this;
4197
4197
  return this.idbdb && (this._state.openComplete || z.letThrough || this._vip) ? e() : new Y(function(n, i) {
4198
4198
  if (t._state.openComplete) return i(new Q.DatabaseClosed(t._state.dbOpenError));
@@ -4202,22 +4202,22 @@ function Zo() {
4202
4202
  }
4203
4203
  t._state.dbReadyPromise.then(n, i);
4204
4204
  }).then(e);
4205
- }, Te.prototype.use = function(e) {
4205
+ }, Ne.prototype.use = function(e) {
4206
4206
  var t = e.stack, n = e.create, i = e.level, a = e.name;
4207
4207
  return a && this.unuse({ stack: t, name: a }), e = this._middlewares[t] || (this._middlewares[t] = []), e.push({ stack: t, create: n, level: i ?? 10, name: a }), e.sort(function(u, h) {
4208
4208
  return u.level - h.level;
4209
4209
  }), this;
4210
- }, Te.prototype.unuse = function(e) {
4210
+ }, Ne.prototype.unuse = function(e) {
4211
4211
  var t = e.stack, n = e.name, i = e.create;
4212
4212
  return t && this._middlewares[t] && (this._middlewares[t] = this._middlewares[t].filter(function(a) {
4213
4213
  return i ? a.create !== i : !!n && a.name !== n;
4214
4214
  })), this;
4215
- }, Te.prototype.open = function() {
4215
+ }, Ne.prototype.open = function() {
4216
4216
  var e = this;
4217
4217
  return gt(it, function() {
4218
- return co(e);
4218
+ return so(e);
4219
4219
  });
4220
- }, Te.prototype._close = function() {
4220
+ }, Ne.prototype._close = function() {
4221
4221
  this.on.close.fire(new CustomEvent("close"));
4222
4222
  var e = this._state, t = kt.indexOf(this);
4223
4223
  if (0 <= t && kt.splice(t, 1), this.idbdb) {
@@ -4232,10 +4232,10 @@ function Zo() {
4232
4232
  }), e.openCanceller = new Y(function(n, i) {
4233
4233
  e.cancelOpen = i;
4234
4234
  }));
4235
- }, Te.prototype.close = function(n) {
4235
+ }, Ne.prototype.close = function(n) {
4236
4236
  var t = (n === void 0 ? { disableAutoOpen: !0 } : n).disableAutoOpen, n = this._state;
4237
4237
  t ? (n.isBeingOpened && n.cancelOpen(new Q.DatabaseClosed()), this._close(), n.autoOpen = !1, n.dbOpenError = new Q.DatabaseClosed()) : (this._close(), n.autoOpen = this._options.autoOpen || n.isBeingOpened, n.openComplete = !1, n.dbOpenError = null);
4238
- }, Te.prototype.delete = function(e) {
4238
+ }, Ne.prototype.delete = function(e) {
4239
4239
  var t = this;
4240
4240
  e === void 0 && (e = { disableAutoOpen: !0 });
4241
4241
  var n = 0 < arguments.length && typeof arguments[0] != "object", i = this._state;
@@ -4251,23 +4251,23 @@ function Zo() {
4251
4251
  if (n) throw new Q.InvalidArgument("Invalid closeOptions argument to db.delete()");
4252
4252
  i.isBeingOpened ? i.dbReadyPromise.then(h) : h();
4253
4253
  });
4254
- }, Te.prototype.backendDB = function() {
4254
+ }, Ne.prototype.backendDB = function() {
4255
4255
  return this.idbdb;
4256
- }, Te.prototype.isOpen = function() {
4256
+ }, Ne.prototype.isOpen = function() {
4257
4257
  return this.idbdb !== null;
4258
- }, Te.prototype.hasBeenClosed = function() {
4258
+ }, Ne.prototype.hasBeenClosed = function() {
4259
4259
  var e = this._state.dbOpenError;
4260
4260
  return e && e.name === "DatabaseClosed";
4261
- }, Te.prototype.hasFailed = function() {
4261
+ }, Ne.prototype.hasFailed = function() {
4262
4262
  return this._state.dbOpenError !== null;
4263
- }, Te.prototype.dynamicallyOpened = function() {
4263
+ }, Ne.prototype.dynamicallyOpened = function() {
4264
4264
  return this._state.autoSchema;
4265
- }, Object.defineProperty(Te.prototype, "tables", { get: function() {
4265
+ }, Object.defineProperty(Ne.prototype, "tables", { get: function() {
4266
4266
  var e = this;
4267
4267
  return v(this._allTables).map(function(t) {
4268
4268
  return e._allTables[t];
4269
4269
  });
4270
- }, enumerable: !1, configurable: !0 }), Te.prototype.transaction = function() {
4270
+ }, enumerable: !1, configurable: !0 }), Ne.prototype.transaction = function() {
4271
4271
  var e = (function(t, n, i) {
4272
4272
  var a = arguments.length;
4273
4273
  if (a < 2) throw new Q.InvalidArgument("Too few arguments");
@@ -4275,7 +4275,7 @@ function Zo() {
4275
4275
  return i = u.pop(), [t, S(u), i];
4276
4276
  }).apply(this, arguments);
4277
4277
  return this._transaction.apply(this, e);
4278
- }, Te.prototype._transaction = function(e, t, n) {
4278
+ }, Ne.prototype._transaction = function(e, t, n) {
4279
4279
  var i = this, a = z.trans;
4280
4280
  a && a.db === this && e.indexOf("!") === -1 || (a = null);
4281
4281
  var u, h, p = e.indexOf("?") !== -1;
@@ -4304,7 +4304,7 @@ function Zo() {
4304
4304
  } catch (_) {
4305
4305
  return a ? a._promise(null, function(T, y) {
4306
4306
  y(_);
4307
- }) : xe(_);
4307
+ }) : Te(_);
4308
4308
  }
4309
4309
  var b = (function _(T, y, O, w, x) {
4310
4310
  return Y.resolve().then(function() {
@@ -4315,14 +4315,14 @@ function Zo() {
4315
4315
  } catch (P) {
4316
4316
  return P.name === ht.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
4317
4317
  return _(T, y, O, null, x);
4318
- })) : xe(P);
4318
+ })) : Te(P);
4319
4319
  }
4320
4320
  var A, k = Tt(x);
4321
4321
  return k && St(), C = Y.follow(function() {
4322
4322
  var P;
4323
4323
  (A = x.call(N, N)) && (k ? (P = at.bind(null, null), A.then(P, P)) : typeof A.next == "function" && typeof A.throw == "function" && (A = cr(A)));
4324
4324
  }, C), (A && typeof A.then == "function" ? Y.resolve(A).then(function(P) {
4325
- return N.active ? P : xe(new Q.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
4325
+ return N.active ? P : Te(new Q.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
4326
4326
  }) : C.then(function() {
4327
4327
  return A;
4328
4328
  })).then(function(P) {
@@ -4330,22 +4330,22 @@ function Zo() {
4330
4330
  return P;
4331
4331
  });
4332
4332
  }).catch(function(P) {
4333
- return N._reject(P), xe(P);
4333
+ return N._reject(P), Te(P);
4334
4334
  });
4335
4335
  });
4336
4336
  }).bind(null, this, u, h, a, n);
4337
4337
  return a ? a._promise(u, b, "lock") : z.trans ? gt(z.transless, function() {
4338
4338
  return i._whenReady(b);
4339
4339
  }) : this._whenReady(b);
4340
- }, Te.prototype.table = function(e) {
4341
- if (!M(this._allTables, e)) throw new Q.InvalidTable("Table ".concat(e, " does not exist"));
4340
+ }, Ne.prototype.table = function(e) {
4341
+ if (!j(this._allTables, e)) throw new Q.InvalidTable("Table ".concat(e, " does not exist"));
4342
4342
  return this._allTables[e];
4343
- }, Te);
4344
- function Te(e, t) {
4343
+ }, Ne);
4344
+ function Ne(e, t) {
4345
4345
  var n = this;
4346
4346
  this._middlewares = {}, this.verno = 0;
4347
- var i = Te.dependencies;
4348
- this._options = t = o({ addons: Te.addons, autoOpen: !0, indexedDB: i.indexedDB, IDBKeyRange: i.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, i = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
4347
+ var i = Ne.dependencies;
4348
+ this._options = t = o({ addons: Ne.addons, autoOpen: !0, indexedDB: i.indexedDB, IDBKeyRange: i.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, i = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
4349
4349
  var a, u, h, p, b, _ = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: l, dbReadyPromise: null, cancelOpen: l, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
4350
4350
  _.dbReadyPromise = new Y(function(y) {
4351
4351
  _.dbReadyResolve = y;
@@ -4359,14 +4359,14 @@ function Zo() {
4359
4359
  return n.on(y, w);
4360
4360
  }, this.on.ready.subscribe = ne(this.on.ready.subscribe, function(y) {
4361
4361
  return function(O, w) {
4362
- Te.vip(function() {
4362
+ Ne.vip(function() {
4363
4363
  var x, C = n._state;
4364
4364
  C.openComplete ? (C.dbOpenError || Y.resolve().then(O), w && y(O)) : C.onReadyBeingFired ? (C.onReadyBeingFired.push(O), w && y(O)) : (y(O), x = n, w || y(function N() {
4365
4365
  x.on.ready.unsubscribe(O), x.on.ready.unsubscribe(N);
4366
4366
  }));
4367
4367
  });
4368
4368
  };
4369
- }), this.Collection = (a = this, Ut(Qi.prototype, function(A, N) {
4369
+ }), this.Collection = (a = this, Ut(zi.prototype, function(A, N) {
4370
4370
  this.db = a;
4371
4371
  var w = Sr, x = null;
4372
4372
  if (N) try {
@@ -4377,8 +4377,8 @@ function Zo() {
4377
4377
  var C = A._ctx, N = C.table, A = N.hook.reading.fire;
4378
4378
  this._ctx = { table: N, index: C.index, isPrimKey: !C.index || N.schema.primKey.keyPath && C.index === N.schema.primKey.name, range: w, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: x, or: C.or, valueMapper: A !== c ? A : null };
4379
4379
  })), this.Table = (u = this, Ut(Pr.prototype, function(y, O, w) {
4380
- this.db = u, this._tx = w, this.name = y, this.schema = O, this.hook = u._allTables[y] ? u._allTables[y].hook : Lt(null, { creating: [le, l], reading: [R, c], updating: [Ee, l], deleting: [be, l] });
4381
- })), this.Transaction = (h = this, Ut(eo.prototype, function(y, O, w, x, C) {
4380
+ this.db = u, this._tx = w, this.name = y, this.schema = O, this.hook = u._allTables[y] ? u._allTables[y].hook : Lt(null, { creating: [le, l], reading: [R, c], updating: [xe, l], deleting: [be, l] });
4381
+ })), this.Transaction = (h = this, Ut(Ji.prototype, function(y, O, w, x, C) {
4382
4382
  var N = this;
4383
4383
  y !== "readonly" && O.forEach(function(A) {
4384
4384
  A = (A = w[A]) === null || A === void 0 ? void 0 : A.yProps, A && (O = O.concat(A.map(function(k) {
@@ -4390,9 +4390,9 @@ function Zo() {
4390
4390
  N.active = !1, N.on.complete.fire();
4391
4391
  }, function(A) {
4392
4392
  var k = N.active;
4393
- return N.active = !1, N.on.error.fire(A), N.parent ? N.parent._reject(A) : k && N.idbtrans && N.idbtrans.abort(), xe(A);
4393
+ return N.active = !1, N.on.error.fire(A), N.parent ? N.parent._reject(A) : k && N.idbtrans && N.idbtrans.abort(), Te(A);
4394
4394
  });
4395
- })), this.Version = (p = this, Ut(so.prototype, function(y) {
4395
+ })), this.Version = (p = this, Ut(ao.prototype, function(y) {
4396
4396
  this.db = p, this._cfg = { version: y, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
4397
4397
  })), this.WhereClause = (b = this, Ut(qr.prototype, function(y, O, w) {
4398
4398
  if (this.db = b, this._ctx = { table: y, index: O === ":id" ? null : O, or: w }, this._cmp = this._ascending = ae, this._descending = function(x, C) {
@@ -4414,7 +4414,7 @@ function Zo() {
4414
4414
  }).map(function(O) {
4415
4415
  return O.on("versionchange").fire(y);
4416
4416
  });
4417
- }, this.use(fo), this.use(go), this.use(ho), this.use(uo), this.use(lo);
4417
+ }, this.use(lo), this.use(po), this.use(fo), this.use(co), this.use(uo);
4418
4418
  var T = new Proxy(this, { get: function(y, O, w) {
4419
4419
  if (O === "_vip") return !0;
4420
4420
  if (O === "table") return function(C) {
@@ -4431,7 +4431,7 @@ function Zo() {
4431
4431
  return y(n);
4432
4432
  });
4433
4433
  }
4434
- var Cn, Le = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", yo = (dr.prototype.subscribe = function(e, t, n) {
4434
+ var Cn, Le = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", go = (dr.prototype.subscribe = function(e, t, n) {
4435
4435
  return this._subscribe(e && typeof e != "function" ? e : { next: e, error: t, complete: n });
4436
4436
  }, dr.prototype[Le] = function() {
4437
4437
  return this;
@@ -4445,7 +4445,7 @@ function Zo() {
4445
4445
  Cn = { indexedDB: null, IDBKeyRange: null };
4446
4446
  }
4447
4447
  function ti(e) {
4448
- var t, n = !1, i = new yo(function(a) {
4448
+ var t, n = !1, i = new go(function(a) {
4449
4449
  var u = Tt(e), h, p = !1, b = {}, _ = {}, T = { get closed() {
4450
4450
  return p;
4451
4451
  }, unsubscribe: function() {
@@ -4469,7 +4469,7 @@ function Zo() {
4469
4469
  }
4470
4470
  })(N = { subscr: C, signal: h.signal, requery: O, querier: e, trans: null }), Promise.resolve(A).then(function(k) {
4471
4471
  n = !0, t = k, p || N.signal.aborted || (b = {}, (function(P) {
4472
- for (var F in P) if (M(P, F)) return;
4472
+ for (var F in P) if (j(P, F)) return;
4473
4473
  return 1;
4474
4474
  })(_ = C) || y || (ut(Gt, w), y = !0), Un(function() {
4475
4475
  return !p && a.next && a.next(k);
@@ -4515,7 +4515,7 @@ function Zo() {
4515
4515
  });
4516
4516
  }) : er(n, t).toCollection().primaryKeys()).then(e);
4517
4517
  } catch {
4518
- return xe(new Q.MissingAPI());
4518
+ return Te(new Q.MissingAPI());
4519
4519
  }
4520
4520
  var t, n;
4521
4521
  }, defineClass: function() {
@@ -4530,7 +4530,7 @@ function Zo() {
4530
4530
  var t = cr(e.apply(this, arguments));
4531
4531
  return t && typeof t.then == "function" ? t : Y.resolve(t);
4532
4532
  } catch (n) {
4533
- return xe(n);
4533
+ return Te(n);
4534
4534
  }
4535
4535
  };
4536
4536
  }, spawn: function(e, t, n) {
@@ -4538,16 +4538,16 @@ function Zo() {
4538
4538
  var i = cr(e.apply(n, t || []));
4539
4539
  return i && typeof i.then == "function" ? i : Y.resolve(i);
4540
4540
  } catch (a) {
4541
- return xe(a);
4541
+ return Te(a);
4542
4542
  }
4543
4543
  }, currentTransaction: { get: function() {
4544
4544
  return z.trans || null;
4545
4545
  } }, waitFor: function(e, t) {
4546
4546
  return t = Y.resolve(typeof e == "function" ? wt.ignoreTransaction(e) : e).timeout(t || 6e4), z.trans ? z.trans.waitFor(t) : t;
4547
4547
  }, Promise: Y, debug: { get: function() {
4548
- return Ne;
4548
+ return Ce;
4549
4549
  }, set: function(e) {
4550
- Ce(e);
4550
+ Oe(e);
4551
4551
  } }, derive: B, extend: D, props: X, override: ne, Events: Lt, on: ut, liveQuery: ti, extendObservabilitySet: En, getByKeyPath: he, setByKeyPath: de, delByKeyPath: function(e, t) {
4552
4552
  typeof t == "string" ? de(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
4553
4553
  de(e, n, void 0);
@@ -4571,16 +4571,16 @@ function Zo() {
4571
4571
  lt || Ft.postMessage(e);
4572
4572
  })), typeof addEventListener < "u" && (addEventListener("pagehide", function(e) {
4573
4573
  if (!Je.disableBfCache && e.persisted) {
4574
- Ne && console.debug("Dexie: handling persisted pagehide"), Ft?.close();
4574
+ Ce && console.debug("Dexie: handling persisted pagehide"), Ft?.close();
4575
4575
  for (var t = 0, n = kt; t < n.length; t++) n[t].close({ disableAutoOpen: !1 });
4576
4576
  }
4577
4577
  }), addEventListener("pageshow", function(e) {
4578
- !Je.disableBfCache && e.persisted && (Ne && console.debug("Dexie: handling persisted pageshow"), ni(), hr({ all: new Ie(-1 / 0, [[]]) }));
4578
+ !Je.disableBfCache && e.persisted && (Ce && console.debug("Dexie: handling persisted pageshow"), ni(), hr({ all: new Ie(-1 / 0, [[]]) }));
4579
4579
  })), Y.rejectionMapper = function(e, t) {
4580
- return !e || e instanceof tt || e instanceof TypeError || e instanceof SyntaxError || !e.name || !Ct[e.name] ? e : (t = new Ct[e.name](t || e.message, e), "stack" in e && j(t, "stack", { get: function() {
4580
+ return !e || e instanceof tt || e instanceof TypeError || e instanceof SyntaxError || !e.name || !Ct[e.name] ? e : (t = new Ct[e.name](t || e.message, e), "stack" in e && M(t, "stack", { get: function() {
4581
4581
  return this.inner.stack;
4582
4582
  } }), t);
4583
- }, Ce(Ne), o(Je, Object.freeze({ __proto__: null, Dexie: Je, liveQuery: ti, Entity: kr, cmp: ae, PropModification: Vt, replacePrefix: function(e, t) {
4583
+ }, Oe(Ce), o(Je, Object.freeze({ __proto__: null, Dexie: Je, liveQuery: ti, Entity: kr, cmp: ae, PropModification: Vt, replacePrefix: function(e, t) {
4584
4584
  return new Vt({ replacePrefix: [e, t] });
4585
4585
  }, add: function(e) {
4586
4586
  return new Vt({ add: e });
@@ -4590,22 +4590,22 @@ function Zo() {
4590
4590
  });
4591
4591
  })(Dn)), Dn.exports;
4592
4592
  }
4593
- var Jo = Zo();
4594
- const _r = /* @__PURE__ */ Mi(Jo), ui = /* @__PURE__ */ Symbol.for("Dexie"), dt = globalThis[ui] || (globalThis[ui] = _r);
4593
+ var Qo = zo();
4594
+ const _r = /* @__PURE__ */ ji(Qo), ui = /* @__PURE__ */ Symbol.for("Dexie"), dt = globalThis[ui] || (globalThis[ui] = _r);
4595
4595
  if (_r.semVer !== dt.semVer)
4596
4596
  throw new Error(`Two different versions of Dexie loaded in the same app: ${_r.semVer} and ${dt.semVer}`);
4597
4597
  const {
4598
- liveQuery: Ua,
4599
- mergeRanges: Va,
4600
- rangesOverlap: $a,
4601
- RangeSet: Ga,
4602
- cmp: Ya,
4603
- Entity: Wa,
4604
- PropModification: Xa,
4605
- replacePrefix: Ha,
4606
- add: za,
4607
- remove: Qa,
4608
- DexieYProvider: Za
4598
+ liveQuery: qa,
4599
+ mergeRanges: La,
4600
+ rangesOverlap: Ua,
4601
+ RangeSet: Va,
4602
+ cmp: $a,
4603
+ Entity: Ga,
4604
+ PropModification: Ya,
4605
+ replacePrefix: Wa,
4606
+ add: Xa,
4607
+ remove: Ha,
4608
+ DexieYProvider: za
4609
4609
  } = dt;
4610
4610
  function Et(m) {
4611
4611
  const s = [m.autoIncrement ? `++${m.primaryKey}` : m.primaryKey];
@@ -4617,15 +4617,15 @@ function Et(m) {
4617
4617
  s.push(`*${o}`);
4618
4618
  return s.join(", ");
4619
4619
  }
4620
- const ea = {
4620
+ const Zo = {
4621
4621
  primaryKey: "id",
4622
4622
  indexes: ["tagName"],
4623
4623
  compoundIndexes: [],
4624
4624
  arrayIndexes: []
4625
4625
  };
4626
- class ta {
4626
+ class Jo {
4627
4627
  constructor(r, s) {
4628
- this.schemaVersion = 1, this.knownDocuments = /* @__PURE__ */ new Map(), this.schemaLock = Promise.resolve(), this.name = r, this.dexieRecordSchema = Et(s?.recordSchema ?? ea), this.db = new dt(r);
4628
+ this.schemaVersion = 1, this.knownDocuments = /* @__PURE__ */ new Map(), this.schemaLock = Promise.resolve(), this.name = r, this.dexieRecordSchema = Et(s?.recordSchema ?? Zo), this.db = new dt(r);
4629
4629
  }
4630
4630
  // --- Lifecycle ---
4631
4631
  async open() {
@@ -4701,20 +4701,20 @@ class ta {
4701
4701
  if (!I) continue;
4702
4702
  const q = { ...D };
4703
4703
  if (D.attributes) {
4704
- const M = [...I.attributes];
4704
+ const j = [...I.attributes];
4705
4705
  for (const X of D.attributes) {
4706
- const ie = M.findIndex((j) => j.name === X.name);
4707
- ie >= 0 ? M[ie] = X : M.push(X);
4706
+ const oe = j.findIndex((M) => M.name === X.name);
4707
+ oe >= 0 ? j[oe] = X : j.push(X);
4708
4708
  }
4709
- q.attributes = M;
4709
+ q.attributes = j;
4710
4710
  }
4711
4711
  if (D.children) {
4712
- const M = [...I.children];
4712
+ const j = [...I.children];
4713
4713
  for (const X of D.children) {
4714
- const ie = M.findIndex((j) => j.id === X.id);
4715
- ie >= 0 ? M[ie] = X : M.push(X);
4714
+ const oe = j.findIndex((M) => M.id === X.id);
4715
+ oe >= 0 ? j[oe] = X : j.push(X);
4716
4716
  }
4717
- q.children = M;
4717
+ q.children = j;
4718
4718
  }
4719
4719
  await v.update(g, q);
4720
4720
  }
@@ -4731,7 +4731,7 @@ class ta {
4731
4731
  this.db.table(Xe),
4732
4732
  this.db.table(He),
4733
4733
  async () => {
4734
- const q = d.length > 0 ? await g.bulkGet(d.map((H) => H.id)) : [], M = f.length > 0 ? await g.bulkGet(f) : [];
4734
+ const q = d.length > 0 ? await g.bulkGet(d.map((H) => H.id)) : [], j = f.length > 0 ? await g.bulkGet(f) : [];
4735
4735
  if (o.length > 0)
4736
4736
  try {
4737
4737
  await g.bulkAdd(o), I += o.length, v(I, D);
@@ -4759,22 +4759,22 @@ class ta {
4759
4759
  cause: H instanceof Error ? H : void 0
4760
4760
  });
4761
4761
  }
4762
- const X = await this.getHead(s), ie = await this.db.table(Xe).where({ documentId: s }).filter((H) => H.sequenceNumber > X).toArray();
4763
- ie.length > 0 && await this.db.table(Xe).bulkDelete(ie.map((H) => H.id));
4764
- const j = X + 1, B = {
4762
+ const X = await this.getHead(s), oe = await this.db.table(Xe).where({ documentId: s }).filter((H) => H.sequenceNumber > X).toArray();
4763
+ oe.length > 0 && await this.db.table(Xe).bulkDelete(oe.map((H) => H.id));
4764
+ const M = X + 1, B = {
4765
4765
  documentId: s,
4766
- sequenceNumber: j,
4766
+ sequenceNumber: M,
4767
4767
  timestamp: Date.now(),
4768
4768
  operations: {
4769
4769
  creates: o,
4770
- updates: d.map((H, oe) => ({
4771
- before: q[oe],
4770
+ updates: d.map((H, ie) => ({
4771
+ before: q[ie],
4772
4772
  after: H
4773
4773
  })),
4774
- deletes: M.filter(Boolean)
4774
+ deletes: j.filter(Boolean)
4775
4775
  }
4776
4776
  };
4777
- await this.db.table(Xe).add(B), await this.setHead(s, j);
4777
+ await this.db.table(Xe).add(B), await this.setHead(s, M);
4778
4778
  }
4779
4779
  );
4780
4780
  } catch (q) {
@@ -4810,6 +4810,13 @@ class ta {
4810
4810
  async getChangeLog(r) {
4811
4811
  return this.db.table(Xe).where({ documentId: r }).sortBy("sequenceNumber");
4812
4812
  }
4813
+ /**
4814
+ * Expose the underlying Dexie instance.
4815
+ * Useful for legacy compatibility layers and advanced testing.
4816
+ */
4817
+ getDatabaseInstance() {
4818
+ return this.db;
4819
+ }
4813
4820
  // --- Private helpers ---
4814
4821
  async getHead(r) {
4815
4822
  return (await this.db.table(He).get(`head:${r}`))?.value ?? 0;
@@ -4840,21 +4847,21 @@ class ta {
4840
4847
  * Resolve the Dexie table name for a documentId.
4841
4848
  */
4842
4849
  resolveTableName(r) {
4843
- return Xo(r);
4850
+ return Yo(r);
4844
4851
  }
4845
4852
  }
4846
4853
  function li() {
4847
4854
  return new Promise((m) => setTimeout(m, 0));
4848
4855
  }
4849
- function na(m, r, s) {
4856
+ function ea(m, r, s) {
4850
4857
  if (r.type === "local") {
4851
4858
  const o = { recordSchema: s.database.recordSchema };
4852
- return new ta(m, o);
4859
+ return new Jo(m, o);
4853
4860
  }
4854
4861
  return r.store;
4855
4862
  }
4856
4863
  var Qt = { exports: {} }, An = { exports: {} }, fi;
4857
- function ra() {
4864
+ function ta() {
4858
4865
  return fi || (fi = 1, (function(m, r) {
4859
4866
  Object.defineProperty(r, "__esModule", { value: !0 }), r.ParsingError = void 0;
4860
4867
  class s extends Error {
@@ -4865,10 +4872,10 @@ function ra() {
4865
4872
  r.ParsingError = s;
4866
4873
  let o;
4867
4874
  function d() {
4868
- return D(!1) || X() || M() || q() || g();
4875
+ return D(!1) || X() || j() || q() || g();
4869
4876
  }
4870
4877
  function f() {
4871
- return B(/\s*/), D(!0) || M() || I() || g();
4878
+ return B(/\s*/), D(!0) || j() || I() || g();
4872
4879
  }
4873
4880
  function v() {
4874
4881
  const ne = g(), Z = [];
@@ -4919,8 +4926,8 @@ function ra() {
4919
4926
  attributes: {},
4920
4927
  children: []
4921
4928
  }, he = ne ? !1 : o.options.filter(J) === !1;
4922
- for (; !(H() || oe(">") || oe("?>") || oe("/>")); ) {
4923
- const ve = ie();
4929
+ for (; !(H() || ie(">") || ie("?>") || ie("/>")); ) {
4930
+ const ve = oe();
4924
4931
  if (ve)
4925
4932
  J.attributes[ve.name] = ve.value;
4926
4933
  else
@@ -4976,7 +4983,7 @@ function ra() {
4976
4983
  }
4977
4984
  }
4978
4985
  }
4979
- function M() {
4986
+ function j() {
4980
4987
  const ne = B(/^<!--[\s\S]*?-->/);
4981
4988
  if (ne) {
4982
4989
  const Z = {
@@ -5002,15 +5009,15 @@ function ra() {
5002
5009
  };
5003
5010
  }
5004
5011
  }
5005
- function ie() {
5012
+ function oe() {
5006
5013
  const ne = B(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);
5007
5014
  if (ne)
5008
5015
  return {
5009
5016
  name: ne[1].trim(),
5010
- value: j(ne[2].trim())
5017
+ value: M(ne[2].trim())
5011
5018
  };
5012
5019
  }
5013
- function j(ne) {
5020
+ function M(ne) {
5014
5021
  return ne.replace(/^['"]|['"]$/g, "");
5015
5022
  }
5016
5023
  function B(ne) {
@@ -5021,7 +5028,7 @@ function ra() {
5021
5028
  function H() {
5022
5029
  return o.xml.length === 0;
5023
5030
  }
5024
- function oe(ne) {
5031
+ function ie(ne) {
5025
5032
  return o.xml.indexOf(ne) === 0;
5026
5033
  }
5027
5034
  function ye(ne, Z = {}) {
@@ -5036,114 +5043,114 @@ function ra() {
5036
5043
  })(An, An.exports)), An.exports;
5037
5044
  }
5038
5045
  var di = Qt.exports, hi;
5039
- function ia() {
5046
+ function na() {
5040
5047
  return hi || (hi = 1, (function(m, r) {
5041
- var s = di && di.__importDefault || function(j) {
5042
- return j && j.__esModule ? j : { default: j };
5048
+ var s = di && di.__importDefault || function(M) {
5049
+ return M && M.__esModule ? M : { default: M };
5043
5050
  };
5044
5051
  Object.defineProperty(r, "__esModule", { value: !0 });
5045
- const o = s(/* @__PURE__ */ ra());
5046
- function d(j) {
5047
- if (!j.options.indentation && !j.options.lineSeparator)
5052
+ const o = s(/* @__PURE__ */ ta());
5053
+ function d(M) {
5054
+ if (!M.options.indentation && !M.options.lineSeparator)
5048
5055
  return;
5049
- j.content += j.options.lineSeparator;
5056
+ M.content += M.options.lineSeparator;
5050
5057
  let B;
5051
- for (B = 0; B < j.level; B++)
5052
- j.content += j.options.indentation;
5058
+ for (B = 0; B < M.level; B++)
5059
+ M.content += M.options.indentation;
5053
5060
  }
5054
- function f(j) {
5055
- j.content = j.content.replace(/ +$/, "");
5061
+ function f(M) {
5062
+ M.content = M.content.replace(/ +$/, "");
5056
5063
  let B;
5057
- for (B = 0; B < j.level; B++)
5058
- j.content += j.options.indentation;
5064
+ for (B = 0; B < M.level; B++)
5065
+ M.content += M.options.indentation;
5059
5066
  }
5060
- function v(j, B) {
5061
- j.content += B;
5067
+ function v(M, B) {
5068
+ M.content += B;
5062
5069
  }
5063
- function g(j, B, H) {
5064
- if (j.type === "Element")
5065
- q(j, B, H);
5066
- else if (j.type === "ProcessingInstruction")
5067
- X(j, B);
5068
- else if (typeof j.content == "string")
5069
- D(j.content, B, H);
5070
+ function g(M, B, H) {
5071
+ if (M.type === "Element")
5072
+ q(M, B, H);
5073
+ else if (M.type === "ProcessingInstruction")
5074
+ X(M, B);
5075
+ else if (typeof M.content == "string")
5076
+ D(M.content, B, H);
5070
5077
  else
5071
- throw new Error("Unknown node type: " + j.type);
5078
+ throw new Error("Unknown node type: " + M.type);
5072
5079
  }
5073
- function D(j, B, H) {
5080
+ function D(M, B, H) {
5074
5081
  if (!H) {
5075
- const oe = j.trim();
5076
- (B.options.lineSeparator || oe.length === 0) && (j = oe);
5082
+ const ie = M.trim();
5083
+ (B.options.lineSeparator || ie.length === 0) && (M = ie);
5077
5084
  }
5078
- j.length > 0 && (!H && B.content.length > 0 && d(B), v(B, j));
5085
+ M.length > 0 && (!H && B.content.length > 0 && d(B), v(B, M));
5079
5086
  }
5080
- function I(j, B) {
5081
- const H = "/" + j.join("/"), oe = j[j.length - 1];
5082
- return B.includes(oe) || B.includes(H);
5087
+ function I(M, B) {
5088
+ const H = "/" + M.join("/"), ie = M[M.length - 1];
5089
+ return B.includes(ie) || B.includes(H);
5083
5090
  }
5084
- function q(j, B, H) {
5085
- if (B.path.push(j.name), !H && B.content.length > 0 && d(B), v(B, "<" + j.name), M(B, j.attributes), j.children === null || B.options.forceSelfClosingEmptyTag && j.children.length === 0) {
5086
- const oe = B.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
5087
- v(B, oe);
5088
- } else if (j.children.length === 0)
5089
- v(B, "></" + j.name + ">");
5091
+ function q(M, B, H) {
5092
+ if (B.path.push(M.name), !H && B.content.length > 0 && d(B), v(B, "<" + M.name), j(B, M.attributes), M.children === null || B.options.forceSelfClosingEmptyTag && M.children.length === 0) {
5093
+ const ie = B.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
5094
+ v(B, ie);
5095
+ } else if (M.children.length === 0)
5096
+ v(B, "></" + M.name + ">");
5090
5097
  else {
5091
- const oe = j.children;
5098
+ const ie = M.children;
5092
5099
  v(B, ">"), B.level++;
5093
- let ye = j.attributes["xml:space"] === "preserve" || H, ne = !1;
5100
+ let ye = M.attributes["xml:space"] === "preserve" || H, ne = !1;
5094
5101
  if (!ye && B.options.ignoredPaths && (ne = I(B.path, B.options.ignoredPaths), ye = ne), !ye && B.options.collapseContent) {
5095
5102
  let Z = !1, J = !1, he = !1;
5096
- oe.forEach(function(de, ve) {
5103
+ ie.forEach(function(de, ve) {
5097
5104
  de.type === "Text" ? (de.content.includes(`
5098
- `) ? (J = !0, de.content = de.content.trim()) : (ve === 0 || ve === oe.length - 1) && !H && de.content.trim().length === 0 && (de.content = ""), (de.content.trim().length > 0 || oe.length === 1) && (Z = !0)) : de.type === "CDATA" ? Z = !0 : he = !0;
5105
+ `) ? (J = !0, de.content = de.content.trim()) : (ve === 0 || ve === ie.length - 1) && !H && de.content.trim().length === 0 && (de.content = ""), (de.content.trim().length > 0 || ie.length === 1) && (Z = !0)) : de.type === "CDATA" ? Z = !0 : he = !0;
5099
5106
  }), Z && (!he || !J) && (ye = !0);
5100
5107
  }
5101
- oe.forEach(function(Z) {
5108
+ ie.forEach(function(Z) {
5102
5109
  g(Z, B, H || ye);
5103
- }), B.level--, !H && !ye && d(B), ne && f(B), v(B, "</" + j.name + ">");
5110
+ }), B.level--, !H && !ye && d(B), ne && f(B), v(B, "</" + M.name + ">");
5104
5111
  }
5105
5112
  B.path.pop();
5106
5113
  }
5107
- function M(j, B) {
5114
+ function j(M, B) {
5108
5115
  Object.keys(B).forEach(function(H) {
5109
- if (j.options.attributeQuotes === "single") {
5110
- const oe = B[H].replace(/'/g, "&apos;");
5111
- v(j, " " + H + "='" + oe + "'");
5116
+ if (M.options.attributeQuotes === "single") {
5117
+ const ie = B[H].replace(/'/g, "&apos;");
5118
+ v(M, " " + H + "='" + ie + "'");
5112
5119
  } else {
5113
- const oe = B[H].replace(/"/g, "&quot;");
5114
- v(j, " " + H + '="' + oe + '"');
5120
+ const ie = B[H].replace(/"/g, "&quot;");
5121
+ v(M, " " + H + '="' + ie + '"');
5115
5122
  }
5116
5123
  });
5117
5124
  }
5118
- function X(j, B) {
5119
- B.content.length > 0 && d(B), v(B, "<?" + j.name), v(B, " " + j.content.trim()), v(B, "?>");
5125
+ function X(M, B) {
5126
+ B.content.length > 0 && d(B), v(B, "<?" + M.name), v(B, " " + M.content.trim()), v(B, "?>");
5120
5127
  }
5121
- function ie(j, B = {}) {
5128
+ function oe(M, B = {}) {
5122
5129
  B.indentation = "indentation" in B ? B.indentation : " ", B.collapseContent = B.collapseContent === !0, B.lineSeparator = "lineSeparator" in B ? B.lineSeparator : `\r
5123
5130
  `, B.whiteSpaceAtEndOfSelfclosingTag = B.whiteSpaceAtEndOfSelfclosingTag === !0, B.throwOnFailure = B.throwOnFailure !== !1, B.attributeQuotes = "attributeQuotes" in B ? B.attributeQuotes : "double";
5124
5131
  try {
5125
- const H = (0, o.default)(j, { filter: B.filter, strictMode: B.strictMode }), oe = { content: "", level: 0, options: B, path: [] };
5126
- return H.declaration && X(H.declaration, oe), H.children.forEach(function(ye) {
5127
- g(ye, oe, !1);
5128
- }), B.lineSeparator ? oe.content.replace(/\r\n/g, `
5129
- `).replace(/\n/g, B.lineSeparator) : oe.content;
5132
+ const H = (0, o.default)(M, { filter: B.filter, strictMode: B.strictMode }), ie = { content: "", level: 0, options: B, path: [] };
5133
+ return H.declaration && X(H.declaration, ie), H.children.forEach(function(ye) {
5134
+ g(ye, ie, !1);
5135
+ }), B.lineSeparator ? ie.content.replace(/\r\n/g, `
5136
+ `).replace(/\n/g, B.lineSeparator) : ie.content;
5130
5137
  } catch (H) {
5131
5138
  if (B.throwOnFailure)
5132
5139
  throw H;
5133
- return j;
5140
+ return M;
5134
5141
  }
5135
5142
  }
5136
- ie.minify = (j, B = {}) => ie(j, Object.assign(Object.assign({}, B), { indentation: "", lineSeparator: "" })), m.exports = ie, r.default = ie;
5143
+ oe.minify = (M, B = {}) => oe(M, Object.assign(Object.assign({}, B), { indentation: "", lineSeparator: "" })), m.exports = oe, r.default = oe;
5137
5144
  })(Qt, Qt.exports)), Qt.exports;
5138
5145
  }
5139
- var oa = /* @__PURE__ */ ia();
5140
- const Ja = /* @__PURE__ */ Mi(oa), ji = "_temp-idb-id";
5141
- function aa(m) {
5146
+ var ra = /* @__PURE__ */ na();
5147
+ const Qa = /* @__PURE__ */ ji(ra), Mi = "_temp-idb-id";
5148
+ function ia(m) {
5142
5149
  const { records: r, config: s, withDatabaseIds: o = !1 } = m, d = /* @__PURE__ */ new Map();
5143
5150
  let f;
5144
5151
  for (const I of r)
5145
5152
  d.set(I.id, I), I.tagName === s.rootElementName && (f = I);
5146
- Oe(f, {
5153
+ we(f, {
5147
5154
  detail: `No ${s.rootElementName} root element found in records`,
5148
5155
  key: "EXPORT_ROOT_NOT_FOUND"
5149
5156
  });
@@ -5155,7 +5162,7 @@ function aa(m) {
5155
5162
  attributes: f.attributes,
5156
5163
  tagName: f.tagName,
5157
5164
  isRoot: !0
5158
- }), Ui({ config: s, rootElement: D, namespace: f.namespace }), f.value && (D.textContent = f.value.trim()), o && D.setAttribute(ji, f.id), g.appendChild(D), Ki({
5165
+ }), Ui({ config: s, rootElement: D, namespace: f.namespace }), f.value && (D.textContent = f.value.trim()), o && D.setAttribute(Mi, f.id), g.appendChild(D), Ki({
5159
5166
  index: d,
5160
5167
  config: s,
5161
5168
  withDatabaseIds: o,
@@ -5170,19 +5177,19 @@ function Ki(m) {
5170
5177
  const g = [];
5171
5178
  for (const I of f.children) {
5172
5179
  const q = r.get(I.id);
5173
- Oe(q, {
5180
+ we(q, {
5174
5181
  detail: `Parent '${f.tagName}' references non-existent child '${I.tagName}' (id: ${I.id})`,
5175
5182
  key: "EXPORT_ORPHAN_CHILD_REF",
5176
5183
  ref: { tagName: f.tagName, id: f.id }
5177
5184
  }), g.push(q);
5178
5185
  }
5179
- const D = ca({
5186
+ const D = aa({
5180
5187
  parentTagName: f.tagName,
5181
5188
  availableChildren: s.children,
5182
5189
  childrenRecords: g
5183
5190
  });
5184
5191
  for (const I of D) {
5185
- const q = sa({
5192
+ const q = oa({
5186
5193
  config: s,
5187
5194
  document: d,
5188
5195
  record: I,
@@ -5199,7 +5206,7 @@ function Ki(m) {
5199
5206
  });
5200
5207
  }
5201
5208
  }
5202
- function sa(m) {
5209
+ function oa(m) {
5203
5210
  const { config: r, document: s, record: o, defaultNamespace: d, withDatabaseIds: f } = m, v = o.namespace.uri === d.uri;
5204
5211
  let g;
5205
5212
  return !v && o.namespace.prefix && o.namespace.prefix !== "xmlns" ? (Li({ config: r, document: s, namespace: o.namespace }), g = s.createElementNS(
@@ -5212,12 +5219,12 @@ function sa(m) {
5212
5219
  attributes: o.attributes,
5213
5220
  tagName: o.tagName,
5214
5221
  isRoot: !1
5215
- }), o.value && (g.textContent = o.value.trim()), f && g.setAttribute(ji, o.id), g;
5222
+ }), o.value && (g.textContent = o.value.trim()), f && g.setAttribute(Mi, o.id), g;
5216
5223
  }
5217
5224
  function qi(m) {
5218
5225
  const { config: r, document: s, element: o, attributes: d, tagName: f, isRoot: v } = m;
5219
5226
  for (const g of d) {
5220
- if (ua(g) || !v && la({ config: r, tagName: f, attribute: g })) continue;
5227
+ if (sa(g) || !v && ca({ config: r, tagName: f, attribute: g })) continue;
5221
5228
  if (!$i(g) || !g.namespace.prefix) {
5222
5229
  o.setAttribute(g.name, String(g.value));
5223
5230
  continue;
@@ -5252,7 +5259,7 @@ function Ui(m) {
5252
5259
  s.setAttribute(D, g.default || "");
5253
5260
  }
5254
5261
  }
5255
- function ca(m) {
5262
+ function aa(m) {
5256
5263
  const { parentTagName: r, availableChildren: s, childrenRecords: o } = m, d = new Set(s[r]);
5257
5264
  if (!d.size) return o;
5258
5265
  const f = /* @__PURE__ */ new Map(), v = [];
@@ -5274,10 +5281,10 @@ function Vi(m) {
5274
5281
  function $i(m) {
5275
5282
  return m !== null && typeof m == "object" && "namespace" in m && !!m.namespace;
5276
5283
  }
5277
- function ua(m) {
5284
+ function sa(m) {
5278
5285
  return !!(m.name === "xmlns" || m.name.startsWith("xmlns:") || $i(m) && m.namespace?.prefix === "xmlns");
5279
5286
  }
5280
- function la(m) {
5287
+ function ca(m) {
5281
5288
  const { config: r, tagName: s, attribute: o } = m;
5282
5289
  if (!r.elements.includes(s)) return !1;
5283
5290
  const d = r.definition[s];
@@ -5285,7 +5292,7 @@ function la(m) {
5285
5292
  const f = d.attributes.details[o.name];
5286
5293
  return !(!f || f.required || f.default === void 0 || String(o.value) !== f.default || d.attributes.identityFields?.includes(o.name));
5287
5294
  }
5288
- class fa {
5295
+ class ua {
5289
5296
  constructor() {
5290
5297
  this.pendingChildren = /* @__PURE__ */ new Map();
5291
5298
  }
@@ -5313,21 +5320,21 @@ class fa {
5313
5320
  return this.pendingChildren.size;
5314
5321
  }
5315
5322
  }
5316
- function da(m) {
5323
+ function la(m) {
5317
5324
  return "prefix" in m && "uri" in m && !!m.prefix && !!m.uri;
5318
5325
  }
5319
5326
  var yr = {};
5320
- const ha = {}, ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5327
+ const fa = {}, da = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5321
5328
  __proto__: null,
5322
- default: ha
5323
- }, Symbol.toStringTag, { value: "Module" })), pa = /* @__PURE__ */ zo(ma);
5329
+ default: fa
5330
+ }, Symbol.toStringTag, { value: "Module" })), ha = /* @__PURE__ */ Xo(da);
5324
5331
  var mi;
5325
- function ga() {
5332
+ function ma() {
5326
5333
  return mi || (mi = 1, (function(m) {
5327
5334
  (function(r) {
5328
5335
  r.parser = function(l, c) {
5329
5336
  return new o(l, c);
5330
- }, r.SAXParser = o, r.SAXStream = M, r.createStream = I, r.MAX_BUFFER_LENGTH = 64 * 1024;
5337
+ }, r.SAXParser = o, r.SAXStream = j, r.createStream = I, r.MAX_BUFFER_LENGTH = 64 * 1024;
5331
5338
  var s = [
5332
5339
  "comment",
5333
5340
  "sgmlDecl",
@@ -5388,25 +5395,25 @@ function ga() {
5388
5395
  Ke(l);
5389
5396
  break;
5390
5397
  case "cdata":
5391
- we(l, "oncdata", l.cdata), l.cdata = "";
5398
+ _e(l, "oncdata", l.cdata), l.cdata = "";
5392
5399
  break;
5393
5400
  case "script":
5394
- we(l, "onscript", l.script), l.script = "";
5401
+ _e(l, "onscript", l.script), l.script = "";
5395
5402
  break;
5396
5403
  default:
5397
5404
  ke(l, "Max buffer length exceeded: " + s[E]);
5398
5405
  }
5399
5406
  R = Math.max(R, be);
5400
5407
  }
5401
- var Ee = r.MAX_BUFFER_LENGTH - R;
5402
- l.bufferCheckPosition = Ee + l.position;
5408
+ var xe = r.MAX_BUFFER_LENGTH - R;
5409
+ l.bufferCheckPosition = xe + l.position;
5403
5410
  }
5404
5411
  function f(l) {
5405
5412
  for (var c = 0, R = s.length; c < R; c++)
5406
5413
  l[s[c]] = "";
5407
5414
  }
5408
5415
  function v(l) {
5409
- Ke(l), l.cdata !== "" && (we(l, "oncdata", l.cdata), l.cdata = ""), l.script !== "" && (we(l, "onscript", l.script), l.script = "");
5416
+ Ke(l), l.cdata !== "" && (_e(l, "oncdata", l.cdata), l.cdata = ""), l.script !== "" && (_e(l, "onscript", l.script), l.script = "");
5410
5417
  }
5411
5418
  o.prototype = {
5412
5419
  end: function() {
@@ -5425,7 +5432,7 @@ function ga() {
5425
5432
  };
5426
5433
  var g;
5427
5434
  try {
5428
- g = pa.Stream;
5435
+ g = ha.Stream;
5429
5436
  } catch {
5430
5437
  g = function() {
5431
5438
  };
@@ -5436,7 +5443,7 @@ function ga() {
5436
5443
  return l !== "error" && l !== "end";
5437
5444
  });
5438
5445
  function I(l, c) {
5439
- return new M(l, c);
5446
+ return new j(l, c);
5440
5447
  }
5441
5448
  function q(l, c) {
5442
5449
  if (l.length >= 2) {
@@ -5447,9 +5454,9 @@ function ga() {
5447
5454
  }
5448
5455
  return l.length >= 3 && l[0] === 239 && l[1] === 187 && l[2] === 191 ? "utf8" : l.length >= 4 ? l[0] === 60 && l[1] === 0 && l[2] === 63 && l[3] === 0 ? "utf-16le" : l[0] === 0 && l[1] === 60 && l[2] === 0 && l[3] === 63 ? "utf-16be" : "utf8" : c ? "utf8" : null;
5449
5456
  }
5450
- function M(l, c) {
5451
- if (!(this instanceof M))
5452
- return new M(l, c);
5457
+ function j(l, c) {
5458
+ if (!(this instanceof j))
5459
+ return new j(l, c);
5453
5460
  g.apply(this), this._parser = new o(l, c), this.writable = !0, this.readable = !0;
5454
5461
  var R = this;
5455
5462
  this._parser.onend = function() {
@@ -5471,11 +5478,11 @@ function ga() {
5471
5478
  });
5472
5479
  });
5473
5480
  }
5474
- M.prototype = Object.create(g.prototype, {
5481
+ j.prototype = Object.create(g.prototype, {
5475
5482
  constructor: {
5476
- value: M
5483
+ value: j
5477
5484
  }
5478
- }), M.prototype._decodeBuffer = function(l, c) {
5485
+ }), j.prototype._decodeBuffer = function(l, c) {
5479
5486
  if (this._decoderBuffer && (l = Buffer.concat([this._decoderBuffer, l]), this._decoderBuffer = null), !this._decoder) {
5480
5487
  var R = q(l, c);
5481
5488
  if (!R)
@@ -5483,7 +5490,7 @@ function ga() {
5483
5490
  this._parser.encoding = R, this._decoder = new TextDecoder(R);
5484
5491
  }
5485
5492
  return this._decoder.decode(l, { stream: !c });
5486
- }, M.prototype.write = function(l) {
5493
+ }, j.prototype.write = function(l) {
5487
5494
  if (typeof Buffer == "function" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(l))
5488
5495
  l = this._decodeBuffer(l, !1);
5489
5496
  else if (this._decoderBuffer) {
@@ -5491,7 +5498,7 @@ function ga() {
5491
5498
  c && (this._parser.write(c), this.emit("data", c));
5492
5499
  }
5493
5500
  return this._parser.write(l.toString()), this.emit("data", l), !0;
5494
- }, M.prototype.end = function(l) {
5501
+ }, j.prototype.end = function(l) {
5495
5502
  if (l && l.length && this.write(l), this._decoderBuffer) {
5496
5503
  var c = this._decodeBuffer(Buffer.alloc(0), !0);
5497
5504
  c && (this._parser.write(c), this.emit("data", c));
@@ -5500,14 +5507,14 @@ function ga() {
5500
5507
  R && (this._parser.write(R), this.emit("data", R));
5501
5508
  }
5502
5509
  return this._parser.end(), !0;
5503
- }, M.prototype.on = function(l, c) {
5510
+ }, j.prototype.on = function(l, c) {
5504
5511
  var R = this;
5505
5512
  return !R._parser["on" + l] && D.indexOf(l) !== -1 && (R._parser["on" + l] = function() {
5506
5513
  var E = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
5507
5514
  E.splice(0, 0, l), R.emit.apply(R, E);
5508
5515
  }), g.prototype.on.call(R, l, c);
5509
5516
  };
5510
- var X = "[CDATA[", ie = "DOCTYPE", j = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", H = { xml: j, xmlns: B }, oe = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ye = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, ne = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, Z = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
5517
+ var X = "[CDATA[", oe = "DOCTYPE", M = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", H = { xml: M, xmlns: B }, ie = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, ye = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, ne = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, Z = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
5511
5518
  function J(l) {
5512
5519
  return l === " " || l === `
5513
5520
  ` || l === "\r" || l === " ";
@@ -5875,20 +5882,20 @@ function ga() {
5875
5882
  function Jt(l) {
5876
5883
  return l ? l.toLowerCase().replace(/[^a-z0-9]/g, "") : null;
5877
5884
  }
5878
- function Mt(l, c) {
5885
+ function jt(l, c) {
5879
5886
  const R = Jt(l), E = Jt(c);
5880
5887
  return !R || !E ? !0 : E === "utf16" ? R === "utf16le" || R === "utf16be" : R === E;
5881
5888
  }
5882
- function jt(l, c) {
5889
+ function Mt(l, c) {
5883
5890
  if (!(!l.strict || !l.encoding || !c || c.name !== "xml")) {
5884
5891
  var R = ze(c.body);
5885
- R && !Mt(l.encoding, R) && fe(
5892
+ R && !jt(l.encoding, R) && fe(
5886
5893
  l,
5887
5894
  "XML declaration encoding " + R + " does not match detected stream encoding " + l.encoding.toUpperCase()
5888
5895
  );
5889
5896
  }
5890
5897
  }
5891
- function we(l, c, R) {
5898
+ function _e(l, c, R) {
5892
5899
  l.textNode && Ke(l), Ue(l, c, R);
5893
5900
  }
5894
5901
  function Ke(l) {
@@ -5914,7 +5921,7 @@ Char: ` + l.c), c = new Error(c), l.error = c, Ue(l, "onerror", c), l;
5914
5921
  function tt(l) {
5915
5922
  l.strict || (l.tagName = l.tagName[l.looseCase]());
5916
5923
  var c = l.tags[l.tags.length - 1] || l, R = l.tag = { name: l.tagName, attributes: {} };
5917
- l.opt.xmlns && (R.ns = c.ns), l.attribList.length = 0, we(l, "onopentagstart", R);
5924
+ l.opt.xmlns && (R.ns = c.ns), l.attribList.length = 0, _e(l, "onopentagstart", R);
5918
5925
  }
5919
5926
  function Nt(l, c) {
5920
5927
  var R = l.indexOf(":"), E = R < 0 ? ["", l] : l.split(":"), le = E[0], be = E[1];
@@ -5928,10 +5935,10 @@ Char: ` + l.c), c = new Error(c), l.error = c, Ue(l, "onerror", c), l;
5928
5935
  if (l.opt.xmlns) {
5929
5936
  var c = Nt(l.attribName, !0), R = c.prefix, E = c.local;
5930
5937
  if (R === "xmlns")
5931
- if (E === "xml" && l.attribValue !== j)
5938
+ if (E === "xml" && l.attribValue !== M)
5932
5939
  fe(
5933
5940
  l,
5934
- "xml: prefix must be bound to " + j + `
5941
+ "xml: prefix must be bound to " + M + `
5935
5942
  Actual: ` + l.attribValue
5936
5943
  );
5937
5944
  else if (E === "xmlns" && l.attribValue !== B)
@@ -5946,13 +5953,13 @@ Actual: ` + l.attribValue
5946
5953
  }
5947
5954
  l.attribList.push([l.attribName, l.attribValue]);
5948
5955
  } else
5949
- l.tag.attributes[l.attribName] = l.attribValue, we(l, "onattribute", {
5956
+ l.tag.attributes[l.attribName] = l.attribValue, _e(l, "onattribute", {
5950
5957
  name: l.attribName,
5951
5958
  value: l.attribValue
5952
5959
  });
5953
5960
  l.attribName = l.attribValue = "";
5954
5961
  }
5955
- function je(l, c) {
5962
+ function Me(l, c) {
5956
5963
  if (l.opt.xmlns) {
5957
5964
  var R = l.tag, E = Nt(l.tagName);
5958
5965
  R.prefix = E.prefix, R.local = E.local, R.uri = R.ns[E.prefix] || "", R.prefix && !R.uri && (fe(
@@ -5961,15 +5968,15 @@ Actual: ` + l.attribValue
5961
5968
  ), R.uri = E.prefix);
5962
5969
  var le = l.tags[l.tags.length - 1] || l;
5963
5970
  R.ns && le.ns !== R.ns && Object.keys(R.ns).forEach(function(Ge) {
5964
- we(l, "onopennamespace", {
5971
+ _e(l, "onopennamespace", {
5965
5972
  prefix: Ge,
5966
5973
  uri: R.ns[Ge]
5967
5974
  });
5968
5975
  });
5969
- for (var be = 0, Ee = l.attribList.length; be < Ee; be++) {
5970
- var Re = l.attribList[be], Ae = Re[0], Ne = Re[1], Ce = Nt(Ae, !0), Be = Ce.prefix, en = Ce.local, rt = Be === "" ? "" : R.ns[Be] || "", Ve = {
5976
+ for (var be = 0, xe = l.attribList.length; be < xe; be++) {
5977
+ var Re = l.attribList[be], Ae = Re[0], Ce = Re[1], Oe = Nt(Ae, !0), Be = Oe.prefix, en = Oe.local, rt = Be === "" ? "" : R.ns[Be] || "", Ve = {
5971
5978
  name: Ae,
5972
- value: Ne,
5979
+ value: Ce,
5973
5980
  prefix: Be,
5974
5981
  local: en,
5975
5982
  uri: rt
@@ -5977,11 +5984,11 @@ Actual: ` + l.attribValue
5977
5984
  Be && Be !== "xmlns" && !rt && (fe(
5978
5985
  l,
5979
5986
  "Unbound namespace prefix: " + JSON.stringify(Be)
5980
- ), Ve.uri = Be), l.tag.attributes[Ae] = Ve, we(l, "onattribute", Ve);
5987
+ ), Ve.uri = Be), l.tag.attributes[Ae] = Ve, _e(l, "onattribute", Ve);
5981
5988
  }
5982
5989
  l.attribList.length = 0;
5983
5990
  }
5984
- l.tag.isSelfClosing = !!c, l.sawRoot = !0, l.tags.push(l.tag), we(l, "onopentag", l.tag), c || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state = S.SCRIPT : l.state = S.TEXT, l.tag = null, l.tagName = ""), l.attribName = l.attribValue = "", l.attribList.length = 0;
5991
+ l.tag.isSelfClosing = !!c, l.sawRoot = !0, l.tags.push(l.tag), _e(l, "onopentag", l.tag), c || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state = S.SCRIPT : l.state = S.TEXT, l.tag = null, l.tagName = ""), l.attribName = l.attribValue = "", l.attribList.length = 0;
5985
5992
  }
5986
5993
  function ht(l) {
5987
5994
  if (!l.tagName) {
@@ -5993,7 +6000,7 @@ Actual: ` + l.attribValue
5993
6000
  l.script += "</" + l.tagName + ">", l.tagName = "", l.state = S.SCRIPT;
5994
6001
  return;
5995
6002
  }
5996
- we(l, "onscript", l.script), l.script = "";
6003
+ _e(l, "onscript", l.script), l.script = "";
5997
6004
  }
5998
6005
  var c = l.tags.length, R = l.tagName;
5999
6006
  l.strict || (R = R[l.looseCase]());
@@ -6010,15 +6017,15 @@ Actual: ` + l.attribValue
6010
6017
  }
6011
6018
  l.tagName = R;
6012
6019
  for (var be = l.tags.length; be-- > c; ) {
6013
- var Ee = l.tag = l.tags.pop();
6014
- l.tagName = l.tag.name, we(l, "onclosetag", l.tagName);
6020
+ var xe = l.tag = l.tags.pop();
6021
+ l.tagName = l.tag.name, _e(l, "onclosetag", l.tagName);
6015
6022
  var Re = {};
6016
- for (var Ae in Ee.ns)
6017
- Re[Ae] = Ee.ns[Ae];
6018
- var Ne = l.tags[l.tags.length - 1] || l;
6019
- l.opt.xmlns && Ee.ns !== Ne.ns && Object.keys(Ee.ns).forEach(function(Ce) {
6020
- var Be = Ee.ns[Ce];
6021
- we(l, "onclosenamespace", { prefix: Ce, uri: Be });
6023
+ for (var Ae in xe.ns)
6024
+ Re[Ae] = xe.ns[Ae];
6025
+ var Ce = l.tags[l.tags.length - 1] || l;
6026
+ l.opt.xmlns && xe.ns !== Ce.ns && Object.keys(xe.ns).forEach(function(Oe) {
6027
+ var Be = xe.ns[Oe];
6028
+ _e(l, "onclosenamespace", { prefix: Oe, uri: Be });
6022
6029
  });
6023
6030
  }
6024
6031
  c === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = S.TEXT;
@@ -6075,7 +6082,7 @@ Actual: ` + l.attribValue
6075
6082
  case S.OPEN_WAKA:
6076
6083
  if (E === "!")
6077
6084
  c.state = S.SGML_DECL, c.sgmlDecl = "";
6078
- else if (!J(E)) if (ve(oe, E))
6085
+ else if (!J(E)) if (ve(ie, E))
6079
6086
  c.state = S.OPEN_TAG, c.tagName = E;
6080
6087
  else if (E === "/")
6081
6088
  c.state = S.CLOSE_TAG, c.tagName = "";
@@ -6094,16 +6101,16 @@ Actual: ` + l.attribValue
6094
6101
  c.state = S.COMMENT, c.comment = "", c.sgmlDecl = "";
6095
6102
  continue;
6096
6103
  }
6097
- c.doctype && c.doctype !== !0 && c.sgmlDecl ? (c.state = S.DOCTYPE_DTD, c.doctype += "<!" + c.sgmlDecl + E, c.sgmlDecl = "") : (c.sgmlDecl + E).toUpperCase() === X ? (we(c, "onopencdata"), c.state = S.CDATA, c.sgmlDecl = "", c.cdata = "") : (c.sgmlDecl + E).toUpperCase() === ie ? (c.state = S.DOCTYPE, (c.doctype || c.sawRoot) && fe(
6104
+ c.doctype && c.doctype !== !0 && c.sgmlDecl ? (c.state = S.DOCTYPE_DTD, c.doctype += "<!" + c.sgmlDecl + E, c.sgmlDecl = "") : (c.sgmlDecl + E).toUpperCase() === X ? (_e(c, "onopencdata"), c.state = S.CDATA, c.sgmlDecl = "", c.cdata = "") : (c.sgmlDecl + E).toUpperCase() === oe ? (c.state = S.DOCTYPE, (c.doctype || c.sawRoot) && fe(
6098
6105
  c,
6099
6106
  "Inappropriately located doctype declaration"
6100
- ), c.doctype = "", c.sgmlDecl = "") : E === ">" ? (we(c, "onsgmldeclaration", c.sgmlDecl), c.sgmlDecl = "", c.state = S.TEXT) : (he(E) && (c.state = S.SGML_DECL_QUOTED), c.sgmlDecl += E);
6107
+ ), c.doctype = "", c.sgmlDecl = "") : E === ">" ? (_e(c, "onsgmldeclaration", c.sgmlDecl), c.sgmlDecl = "", c.state = S.TEXT) : (he(E) && (c.state = S.SGML_DECL_QUOTED), c.sgmlDecl += E);
6101
6108
  continue;
6102
6109
  case S.SGML_DECL_QUOTED:
6103
6110
  E === c.q && (c.state = S.SGML_DECL, c.q = ""), c.sgmlDecl += E;
6104
6111
  continue;
6105
6112
  case S.DOCTYPE:
6106
- E === ">" ? (c.state = S.TEXT, we(c, "ondoctype", c.doctype), c.doctype = !0) : (c.doctype += E, E === "[" ? c.state = S.DOCTYPE_DTD : he(E) && (c.state = S.DOCTYPE_QUOTED, c.q = E));
6113
+ E === ">" ? (c.state = S.TEXT, _e(c, "ondoctype", c.doctype), c.doctype = !0) : (c.doctype += E, E === "[" ? c.state = S.DOCTYPE_DTD : he(E) && (c.state = S.DOCTYPE_QUOTED, c.q = E));
6107
6114
  continue;
6108
6115
  case S.DOCTYPE_QUOTED:
6109
6116
  c.doctype += E, E === c.q && (c.q = "", c.state = S.DOCTYPE);
@@ -6118,7 +6125,7 @@ Actual: ` + l.attribValue
6118
6125
  E === "-" ? c.state = S.COMMENT_ENDING : c.comment += E;
6119
6126
  continue;
6120
6127
  case S.COMMENT_ENDING:
6121
- E === "-" ? (c.state = S.COMMENT_ENDED, c.comment = Qe(c.opt, c.comment), c.comment && we(c, "oncomment", c.comment), c.comment = "") : (c.comment += "-" + E, c.state = S.COMMENT);
6128
+ E === "-" ? (c.state = S.COMMENT_ENDED, c.comment = Qe(c.opt, c.comment), c.comment && _e(c, "oncomment", c.comment), c.comment = "") : (c.comment += "-" + E, c.state = S.COMMENT);
6122
6129
  continue;
6123
6130
  case S.COMMENT_ENDED:
6124
6131
  E !== ">" ? (fe(c, "Malformed comment"), c.comment += "--" + E, c.state = S.COMMENT) : c.doctype && c.doctype !== !0 ? c.state = S.DOCTYPE_DTD : c.state = S.TEXT;
@@ -6133,7 +6140,7 @@ Actual: ` + l.attribValue
6133
6140
  E === "]" ? c.state = S.CDATA_ENDING_2 : (c.cdata += "]" + E, c.state = S.CDATA);
6134
6141
  continue;
6135
6142
  case S.CDATA_ENDING_2:
6136
- E === ">" ? (c.cdata && we(c, "oncdata", c.cdata), we(c, "onclosecdata"), c.cdata = "", c.state = S.TEXT) : E === "]" ? c.cdata += "]" : (c.cdata += "]]" + E, c.state = S.CDATA);
6143
+ E === ">" ? (c.cdata && _e(c, "oncdata", c.cdata), _e(c, "onclosecdata"), c.cdata = "", c.state = S.TEXT) : E === "]" ? c.cdata += "]" : (c.cdata += "]]" + E, c.state = S.CDATA);
6137
6144
  continue;
6138
6145
  case S.PROC_INST:
6139
6146
  E === "?" ? c.state = S.PROC_INST_ENDING : J(E) ? c.state = S.PROC_INST_BODY : c.procInstName += E;
@@ -6145,19 +6152,19 @@ Actual: ` + l.attribValue
6145
6152
  continue;
6146
6153
  case S.PROC_INST_ENDING:
6147
6154
  if (E === ">") {
6148
- const Ne = {
6155
+ const Ce = {
6149
6156
  name: c.procInstName,
6150
6157
  body: c.procInstBody
6151
6158
  };
6152
- jt(c, Ne), we(c, "onprocessinginstruction", Ne), c.procInstName = c.procInstBody = "", c.state = S.TEXT;
6159
+ Mt(c, Ce), _e(c, "onprocessinginstruction", Ce), c.procInstName = c.procInstBody = "", c.state = S.TEXT;
6153
6160
  } else
6154
6161
  c.procInstBody += "?" + E, c.state = S.PROC_INST_BODY;
6155
6162
  continue;
6156
6163
  case S.OPEN_TAG:
6157
- ve(ye, E) ? c.tagName += E : (tt(c), E === ">" ? je(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : (J(E) || fe(c, "Invalid character in tag name"), c.state = S.ATTRIB));
6164
+ ve(ye, E) ? c.tagName += E : (tt(c), E === ">" ? Me(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : (J(E) || fe(c, "Invalid character in tag name"), c.state = S.ATTRIB));
6158
6165
  continue;
6159
6166
  case S.OPEN_TAG_SLASH:
6160
- E === ">" ? (je(c, !0), ht(c)) : (fe(
6167
+ E === ">" ? (Me(c, !0), ht(c)) : (fe(
6161
6168
  c,
6162
6169
  "Forward-slash in opening tag not followed by >"
6163
6170
  ), c.state = S.ATTRIB);
@@ -6165,10 +6172,10 @@ Actual: ` + l.attribValue
6165
6172
  case S.ATTRIB:
6166
6173
  if (J(E))
6167
6174
  continue;
6168
- E === ">" ? je(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : ve(oe, E) ? (c.attribName = E, c.attribValue = "", c.state = S.ATTRIB_NAME) : fe(c, "Invalid attribute name");
6175
+ E === ">" ? Me(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : ve(ie, E) ? (c.attribName = E, c.attribValue = "", c.state = S.ATTRIB_NAME) : fe(c, "Invalid attribute name");
6169
6176
  continue;
6170
6177
  case S.ATTRIB_NAME:
6171
- E === "=" ? c.state = S.ATTRIB_VALUE : E === ">" ? (fe(c, "Attribute without value"), c.attribValue = c.attribName, nt(c), je(c)) : J(E) ? c.state = S.ATTRIB_NAME_SAW_WHITE : ve(ye, E) ? c.attribName += E : fe(c, "Invalid attribute name");
6178
+ E === "=" ? c.state = S.ATTRIB_VALUE : E === ">" ? (fe(c, "Attribute without value"), c.attribValue = c.attribName, nt(c), Me(c)) : J(E) ? c.state = S.ATTRIB_NAME_SAW_WHITE : ve(ye, E) ? c.attribName += E : fe(c, "Invalid attribute name");
6172
6179
  continue;
6173
6180
  case S.ATTRIB_NAME_SAW_WHITE:
6174
6181
  if (E === "=")
@@ -6176,10 +6183,10 @@ Actual: ` + l.attribValue
6176
6183
  else {
6177
6184
  if (J(E))
6178
6185
  continue;
6179
- fe(c, "Attribute without value"), c.tag.attributes[c.attribName] = "", c.attribValue = "", we(c, "onattribute", {
6186
+ fe(c, "Attribute without value"), c.tag.attributes[c.attribName] = "", c.attribValue = "", _e(c, "onattribute", {
6180
6187
  name: c.attribName,
6181
6188
  value: ""
6182
- }), c.attribName = "", E === ">" ? je(c) : ve(oe, E) ? (c.attribName = E, c.state = S.ATTRIB_NAME) : (fe(c, "Invalid attribute name"), c.state = S.ATTRIB);
6189
+ }), c.attribName = "", E === ">" ? Me(c) : ve(ie, E) ? (c.attribName = E, c.state = S.ATTRIB_NAME) : (fe(c, "Invalid attribute name"), c.state = S.ATTRIB);
6183
6190
  }
6184
6191
  continue;
6185
6192
  case S.ATTRIB_VALUE:
@@ -6195,14 +6202,14 @@ Actual: ` + l.attribValue
6195
6202
  nt(c), c.q = "", c.state = S.ATTRIB_VALUE_CLOSED;
6196
6203
  continue;
6197
6204
  case S.ATTRIB_VALUE_CLOSED:
6198
- J(E) ? c.state = S.ATTRIB : E === ">" ? je(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : ve(oe, E) ? (fe(c, "No whitespace between attributes"), c.attribName = E, c.attribValue = "", c.state = S.ATTRIB_NAME) : fe(c, "Invalid attribute name");
6205
+ J(E) ? c.state = S.ATTRIB : E === ">" ? Me(c) : E === "/" ? c.state = S.OPEN_TAG_SLASH : ve(ie, E) ? (fe(c, "No whitespace between attributes"), c.attribName = E, c.attribValue = "", c.state = S.ATTRIB_NAME) : fe(c, "Invalid attribute name");
6199
6206
  continue;
6200
6207
  case S.ATTRIB_VALUE_UNQUOTED:
6201
6208
  if (!de(E)) {
6202
6209
  E === "&" ? c.state = S.ATTRIB_VALUE_ENTITY_U : c.attribValue += E;
6203
6210
  continue;
6204
6211
  }
6205
- nt(c), E === ">" ? je(c) : c.state = S.ATTRIB;
6212
+ nt(c), E === ">" ? Me(c) : c.state = S.ATTRIB;
6206
6213
  continue;
6207
6214
  case S.CLOSE_TAG:
6208
6215
  if (c.tagName)
@@ -6210,7 +6217,7 @@ Actual: ` + l.attribValue
6210
6217
  else {
6211
6218
  if (J(E))
6212
6219
  continue;
6213
- In(oe, E) ? c.script ? (c.script += "</" + E, c.state = S.SCRIPT) : fe(c, "Invalid tagname in closing tag.") : c.tagName = E;
6220
+ In(ie, E) ? c.script ? (c.script += "</" + E, c.state = S.SCRIPT) : fe(c, "Invalid tagname in closing tag.") : c.tagName = E;
6214
6221
  }
6215
6222
  continue;
6216
6223
  case S.CLOSE_TAG_SAW_WHITE:
@@ -6221,16 +6228,16 @@ Actual: ` + l.attribValue
6221
6228
  case S.TEXT_ENTITY:
6222
6229
  case S.ATTRIB_VALUE_ENTITY_Q:
6223
6230
  case S.ATTRIB_VALUE_ENTITY_U:
6224
- var Ee, Re;
6231
+ var xe, Re;
6225
6232
  switch (c.state) {
6226
6233
  case S.TEXT_ENTITY:
6227
- Ee = S.TEXT, Re = "textNode";
6234
+ xe = S.TEXT, Re = "textNode";
6228
6235
  break;
6229
6236
  case S.ATTRIB_VALUE_ENTITY_Q:
6230
- Ee = S.ATTRIB_VALUE_QUOTED, Re = "attribValue";
6237
+ xe = S.ATTRIB_VALUE_QUOTED, Re = "attribValue";
6231
6238
  break;
6232
6239
  case S.ATTRIB_VALUE_ENTITY_U:
6233
- Ee = S.ATTRIB_VALUE_UNQUOTED, Re = "attribValue";
6240
+ xe = S.ATTRIB_VALUE_UNQUOTED, Re = "attribValue";
6234
6241
  break;
6235
6242
  }
6236
6243
  if (E === ";") {
@@ -6241,8 +6248,8 @@ Actual: ` + l.attribValue
6241
6248
  ), (c.entityDepth += 1) > c.opt.maxEntityDepth && ke(
6242
6249
  c,
6243
6250
  "Parsed entity depth exceeds max entity depth"
6244
- ), c.entity = "", c.state = Ee, c.write(Ae), c.entityDepth -= 1) : (c[Re] += Ae, c.entity = "", c.state = Ee);
6245
- } else ve(c.entity.length ? Z : ne, E) ? c.entity += E : (fe(c, "Invalid character in entity name"), c[Re] += "&" + c.entity + E, c.entity = "", c.state = Ee);
6251
+ ), c.entity = "", c.state = xe, c.write(Ae), c.entityDepth -= 1) : (c[Re] += Ae, c.entity = "", c.state = xe);
6252
+ } else ve(c.entity.length ? Z : ne, E) ? c.entity += E : (fe(c, "Invalid character in entity name"), c[Re] += "&" + c.entity + E, c.entity = "", c.state = xe);
6246
6253
  continue;
6247
6254
  default:
6248
6255
  throw new Error(c, "Unknown state: " + c.state);
@@ -6251,19 +6258,19 @@ Actual: ` + l.attribValue
6251
6258
  }
6252
6259
  String.fromCodePoint || (function() {
6253
6260
  var l = String.fromCharCode, c = Math.floor, R = function() {
6254
- var E = 16384, le = [], be, Ee, Re = -1, Ae = arguments.length;
6261
+ var E = 16384, le = [], be, xe, Re = -1, Ae = arguments.length;
6255
6262
  if (!Ae)
6256
6263
  return "";
6257
- for (var Ne = ""; ++Re < Ae; ) {
6258
- var Ce = Number(arguments[Re]);
6259
- if (!isFinite(Ce) || // `NaN`, `+Infinity`, or `-Infinity`
6260
- Ce < 0 || // not a valid Unicode code point
6261
- Ce > 1114111 || // not a valid Unicode code point
6262
- c(Ce) !== Ce)
6263
- throw RangeError("Invalid code point: " + Ce);
6264
- Ce <= 65535 ? le.push(Ce) : (Ce -= 65536, be = (Ce >> 10) + 55296, Ee = Ce % 1024 + 56320, le.push(be, Ee)), (Re + 1 === Ae || le.length > E) && (Ne += l.apply(null, le), le.length = 0);
6264
+ for (var Ce = ""; ++Re < Ae; ) {
6265
+ var Oe = Number(arguments[Re]);
6266
+ if (!isFinite(Oe) || // `NaN`, `+Infinity`, or `-Infinity`
6267
+ Oe < 0 || // not a valid Unicode code point
6268
+ Oe > 1114111 || // not a valid Unicode code point
6269
+ c(Oe) !== Oe)
6270
+ throw RangeError("Invalid code point: " + Oe);
6271
+ Oe <= 65535 ? le.push(Oe) : (Oe -= 65536, be = (Oe >> 10) + 55296, xe = Oe % 1024 + 56320, le.push(be, xe)), (Re + 1 === Ae || le.length > E) && (Ce += l.apply(null, le), le.length = 0);
6265
6272
  }
6266
- return Ne;
6273
+ return Ce;
6267
6274
  };
6268
6275
  Object.defineProperty ? Object.defineProperty(String, "fromCodePoint", {
6269
6276
  value: R,
@@ -6274,15 +6281,15 @@ Actual: ` + l.attribValue
6274
6281
  })(m);
6275
6282
  })(yr)), yr;
6276
6283
  }
6277
- var ya = ga();
6278
- function va(m) {
6284
+ var pa = ma();
6285
+ function ga(m) {
6279
6286
  const { dialecteConfig: r, useCustomRecordsIds: s, session: o } = m, d = r.io.hooks;
6280
6287
  let v = {
6281
6288
  defaultNamespace: null,
6282
6289
  stack: [],
6283
6290
  recordsBatch: []
6284
6291
  };
6285
- const g = ya.parser(
6292
+ const g = pa.parser(
6286
6293
  !0,
6287
6294
  // strict mode
6288
6295
  {
@@ -6298,16 +6305,16 @@ function va(m) {
6298
6305
  // Enable namespace handling
6299
6306
  }
6300
6307
  );
6301
- g.onopentag = (q) => v = ba({
6308
+ g.onopentag = (q) => v = ya({
6302
6309
  node: q,
6303
6310
  state: v,
6304
6311
  dialecteConfig: r,
6305
6312
  useCustomRecordsIds: s
6306
- }), g.ontext = (q) => v = wa({ text: q, state: v }), g.onclosetag = () => ({ updatedState: v } = _a({
6313
+ }), g.ontext = (q) => v = va({ text: q, state: v }), g.onclosetag = () => ({ updatedState: v } = ba({
6307
6314
  state: v,
6308
6315
  ioHooks: d,
6309
6316
  session: o
6310
- })), g.onerror = Ea;
6317
+ })), g.onerror = wa;
6311
6318
  function D() {
6312
6319
  const q = v.recordsBatch;
6313
6320
  return v.recordsBatch = [], q;
@@ -6321,32 +6328,32 @@ function va(m) {
6321
6328
  getSize: I
6322
6329
  };
6323
6330
  }
6324
- function ba(m) {
6325
- const { node: r, state: s, dialecteConfig: o, useCustomRecordsIds: d } = m, f = { ...s }, v = xa(r);
6326
- f.defaultNamespace || (f.defaultNamespace = Ta({
6331
+ function ya(m) {
6332
+ const { node: r, state: s, dialecteConfig: o, useCustomRecordsIds: d } = m, f = { ...s }, v = _a(r);
6333
+ f.defaultNamespace || (f.defaultNamespace = Ea({
6327
6334
  element: r,
6328
6335
  defaultNamespace: o.namespaces.default,
6329
6336
  rootElementName: o.rootElementName
6330
6337
  }));
6331
- const g = Na(r, f.defaultNamespace), D = Aa({ attributes: r.attributes, useCustomRecordsIds: d }), I = Da({
6338
+ const g = xa(r, f.defaultNamespace), D = Ca({ attributes: r.attributes, useCustomRecordsIds: d }), I = Oa({
6332
6339
  attributes: r.attributes,
6333
6340
  useCustomRecordsIds: d
6334
- }), q = Ca(I), M = Oa(s.stack), X = {
6341
+ }), q = Ta(I), j = Na(s.stack), X = {
6335
6342
  id: D,
6336
6343
  tagName: v,
6337
6344
  namespace: g,
6338
6345
  attributes: q,
6339
6346
  value: "",
6340
- parent: M,
6347
+ parent: j,
6341
6348
  children: []
6342
6349
  };
6343
6350
  return f.stack.push(X), f;
6344
6351
  }
6345
- function wa(m) {
6352
+ function va(m) {
6346
6353
  const { text: r, state: s } = m;
6347
6354
  return r && s.stack.length > 0 && (s.stack[s.stack.length - 1].value += r), s;
6348
6355
  }
6349
- function _a(m) {
6356
+ function ba(m) {
6350
6357
  const { state: r, ioHooks: s, session: o } = m, d = r.stack.at(-1);
6351
6358
  let f = r.stack.slice(0, -1);
6352
6359
  const v = [...r.recordsBatch];
@@ -6379,28 +6386,28 @@ function _a(m) {
6379
6386
  }
6380
6387
  };
6381
6388
  }
6382
- function Ea(m) {
6389
+ function wa(m) {
6383
6390
  return new Error(`XML parsing error: ${m}`);
6384
6391
  }
6385
- function xa(m) {
6392
+ function _a(m) {
6386
6393
  return m.local;
6387
6394
  }
6388
- function Ta(m) {
6395
+ function Ea(m) {
6389
6396
  const { element: r, defaultNamespace: s, rootElementName: o } = m;
6390
- return Oe(r.name === o, {
6397
+ return we(r.name === o, {
6391
6398
  detail: `Expected root element <${o}>, got <${r.name}>`
6392
6399
  }), r.attributes?.xmlns?.value ? {
6393
6400
  prefix: "",
6394
6401
  uri: r.attributes.xmlns.value
6395
6402
  } : s;
6396
6403
  }
6397
- function Na(m, r) {
6398
- return da(m) ? {
6404
+ function xa(m, r) {
6405
+ return la(m) ? {
6399
6406
  prefix: m.prefix,
6400
6407
  uri: m.uri
6401
6408
  } : r;
6402
6409
  }
6403
- function Ca(m) {
6410
+ function Ta(m) {
6404
6411
  return m.map((r) => {
6405
6412
  const s = r.prefix && r.uri ? {
6406
6413
  prefix: r.prefix,
@@ -6413,64 +6420,64 @@ function Ca(m) {
6413
6420
  };
6414
6421
  });
6415
6422
  }
6416
- function Oa(m) {
6423
+ function Na(m) {
6417
6424
  if (m.length === 0) return null;
6418
6425
  const r = m[m.length - 1];
6419
6426
  return r ? { id: r.id, tagName: r.tagName } : null;
6420
6427
  }
6421
- function Aa(m) {
6428
+ function Ca(m) {
6422
6429
  const { attributes: r, useCustomRecordsIds: s } = m, o = r[gi];
6423
6430
  return s && o && o.value ? o.value : crypto.randomUUID();
6424
6431
  }
6425
- function Da(m) {
6432
+ function Oa(m) {
6426
6433
  const { attributes: r, useCustomRecordsIds: s } = m;
6427
6434
  return s ? Object.values(r).filter((o) => o.name !== gi) : Object.values(r);
6428
6435
  }
6429
- const Sa = 32 * 1024, ka = 2e3;
6430
- async function Ra(m) {
6436
+ const Aa = 32 * 1024, Da = 2e3;
6437
+ async function Sa(m) {
6431
6438
  const { file: r, documentId: s, store: o, config: d, useCustomRecordsIds: f = !1, chunkOptions: v } = m, { supportedFileExtensions: g } = d.io;
6432
- if (Oe(
6433
- g.some((j) => r.name.toLowerCase().endsWith(j)),
6439
+ if (we(
6440
+ g.some((M) => r.name.toLowerCase().endsWith(M)),
6434
6441
  { key: "ASSERTION_FAILED", detail: `Unsupported file type: ${r.name}` }
6435
6442
  ), r.size === 0)
6436
6443
  return { documentId: s, recordCount: 0 };
6437
- const D = v?.chunkSize ?? Sa, I = v?.batchSize ?? ka, q = new fa(), M = va({ dialecteConfig: d, useCustomRecordsIds: f, session: q }), X = await Ia({
6444
+ const D = v?.chunkSize ?? Aa, I = v?.batchSize ?? Da, q = new ua(), j = ga({ dialecteConfig: d, useCustomRecordsIds: f, session: q }), X = await ka({
6438
6445
  file: r,
6439
- sax: M,
6446
+ sax: j,
6440
6447
  session: q,
6441
6448
  store: o,
6442
6449
  documentId: s,
6443
6450
  chunkSize: D,
6444
6451
  batchSize: I
6445
- }), ie = await Pa({ config: d, store: o, documentId: s });
6446
- return { documentId: s, recordCount: X + ie };
6452
+ }), oe = await Ra({ config: d, store: o, documentId: s });
6453
+ return { documentId: s, recordCount: X + oe };
6447
6454
  }
6448
- async function Ia(m) {
6455
+ async function ka(m) {
6449
6456
  const { file: r, sax: s, session: o, store: d, documentId: f, chunkSize: v, batchSize: g } = m;
6450
6457
  let D = 0;
6451
6458
  const I = r.stream().getReader(), q = new TextDecoder();
6452
- let M = new Uint8Array(0), X = !1;
6459
+ let j = new Uint8Array(0), X = !1;
6453
6460
  for (; !X; ) {
6454
- const ie = await I.read();
6455
- if (X = ie.done, X) {
6456
- M.length > 0 && s.parser.write(q.decode(M)), s.parser.close(), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: 0 });
6461
+ const oe = await I.read();
6462
+ if (X = oe.done, X) {
6463
+ j.length > 0 && s.parser.write(q.decode(j)), s.parser.close(), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: 0 });
6457
6464
  break;
6458
6465
  }
6459
- if (ie.value)
6460
- for (M = Fa(M, ie.value); M.length >= v; ) {
6461
- const j = q.decode(M.slice(0, v), { stream: !0 });
6462
- M = M.slice(v), s.parser.write(j), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: g });
6466
+ if (oe.value)
6467
+ for (j = Ia(j, oe.value); j.length >= v; ) {
6468
+ const M = q.decode(j.slice(0, v), { stream: !0 });
6469
+ j = j.slice(v), s.parser.write(M), D += await pi({ sax: s, session: o, store: d, documentId: f, threshold: g });
6463
6470
  }
6464
6471
  }
6465
6472
  return D;
6466
6473
  }
6467
- async function Pa(m) {
6474
+ async function Ra(m) {
6468
6475
  const { config: r, store: s, documentId: o } = m;
6469
6476
  if (!r.io.hooks?.afterImport) return 0;
6470
6477
  const { creates: d, updates: f, deletes: v } = await r.io.hooks.afterImport();
6471
6478
  return d?.length || f?.length || v?.length ? (await s.bulkWrite(o, { creates: d, updates: f, deletes: v }), (d?.length ?? 0) - (v?.length ?? 0)) : 0;
6472
6479
  }
6473
- function Fa(m, r) {
6480
+ function Ia(m, r) {
6474
6481
  const s = new Uint8Array(m.length + r.length);
6475
6482
  return s.set(m), s.set(r, m.length), s;
6476
6483
  }
@@ -6480,18 +6487,18 @@ async function pi(m) {
6480
6487
  const v = r.drainBatch(), g = s.resolveChildrenForBatch(v);
6481
6488
  return await o.bulkWrite(d, { creates: g }), g.length;
6482
6489
  }
6483
- async function Ba(m) {
6490
+ async function Pa(m) {
6484
6491
  const { documentId: r, state: s, configs: o, store: d, projectName: f, options: v } = m, g = s.documents.get(r);
6485
- Oe(g, {
6492
+ we(g, {
6486
6493
  key: "DOCUMENT_NOT_REGISTERED",
6487
6494
  detail: `Document "${r}" not registered in project "${f}"`
6488
6495
  });
6489
- const D = o[g.document.configKey], I = await d.getByDocumentId(r), q = aa({
6496
+ const D = o[g.document.configKey], I = await d.getByDocumentId(r), q = ia({
6490
6497
  records: I,
6491
6498
  config: D,
6492
6499
  withDatabaseIds: v?.withDatabaseIds
6493
- }), M = `${g.document.name}${g.document.extension}`;
6494
- return { xmlDocument: q, filename: M };
6500
+ }), j = `${g.document.name}${g.document.extension}`;
6501
+ return { xmlDocument: q, filename: j };
6495
6502
  }
6496
6503
  function Rn(m) {
6497
6504
  return {
@@ -6505,7 +6512,7 @@ function Rn(m) {
6505
6512
  canRedo: !1
6506
6513
  };
6507
6514
  }
6508
- function Ma(m, r) {
6515
+ function Fa(m, r) {
6509
6516
  const s = new Set(r.map((o) => o.id));
6510
6517
  for (const o of r)
6511
6518
  m.has(o.id) || m.set(o.id, Rn(o));
@@ -6513,13 +6520,13 @@ function Ma(m, r) {
6513
6520
  s.has(o) || m.delete(o);
6514
6521
  return m;
6515
6522
  }
6516
- async function ja(m) {
6523
+ async function Ba(m) {
6517
6524
  const { file: r, store: s, configs: o, defaultConfigKey: d, options: f } = m, v = f?.configKey ?? d, g = o[v];
6518
- Oe(g, {
6525
+ we(g, {
6519
6526
  key: "UNKNOWN_CONFIG_KEY",
6520
6527
  detail: `Unknown configKey: "${v}". Available: ${Object.keys(o).join(", ")}`
6521
6528
  });
6522
- const D = crypto.randomUUID(), I = r.name.includes(".") ? `.${r.name.split(".").pop()}` : g.io.supportedFileExtensions[0], q = r.name.replace(/\.[^.]+$/, "") || "untitled", M = {
6529
+ const D = crypto.randomUUID(), I = r.name.includes(".") ? `.${r.name.split(".").pop()}` : g.io.supportedFileExtensions[0], q = r.name.replace(/\.[^.]+$/, "") || "untitled", j = {
6523
6530
  id: D,
6524
6531
  name: q,
6525
6532
  extension: I,
@@ -6527,8 +6534,8 @@ async function ja(m) {
6527
6534
  createdAt: Date.now(),
6528
6535
  metadata: f?.metadata
6529
6536
  };
6530
- await s.registerDocument(M);
6531
- const { recordCount: X } = await Ra({
6537
+ await s.registerDocument(j);
6538
+ const { recordCount: X } = await Sa({
6532
6539
  file: r,
6533
6540
  documentId: D,
6534
6541
  store: s,
@@ -6538,14 +6545,14 @@ async function ja(m) {
6538
6545
  });
6539
6546
  return {
6540
6547
  documentId: D,
6541
- document: M,
6542
- documentState: Rn(M),
6548
+ document: j,
6549
+ documentState: Rn(j),
6543
6550
  recordCount: X
6544
6551
  };
6545
6552
  }
6546
- async function Ka(m) {
6553
+ async function ja(m) {
6547
6554
  const { store: r, configs: s, defaultConfigKey: o, options: d } = m, f = d?.configKey ?? o, v = s[f];
6548
- Oe(v, {
6555
+ we(v, {
6549
6556
  key: "UNKNOWN_CONFIG_KEY",
6550
6557
  detail: `Unknown configKey: "${f}". Available: ${Object.keys(s).join(", ")}`
6551
6558
  });
@@ -6558,10 +6565,10 @@ async function Ka(m) {
6558
6565
  metadata: d?.metadata
6559
6566
  };
6560
6567
  await r.registerDocument(q);
6561
- const M = v.definition[v.rootElementName], X = (M?.attributes.sequence ?? []).map((j) => ({ name: j, ...M.attributes.details[j] })).filter((j) => j.required && (j.fixed ?? j.default) !== void 0).map(({ name: j, fixed: B, default: H, namespace: oe }) => {
6562
- const ye = { name: j, value: B ?? H };
6563
- return oe && (ye.namespace = oe), ye;
6564
- }), ie = {
6568
+ const j = v.definition[v.rootElementName], X = (j?.attributes.sequence ?? []).map((M) => ({ name: M, ...j.attributes.details[M] })).filter((M) => M.required && (M.fixed ?? M.default) !== void 0).map(({ name: M, fixed: B, default: H, namespace: ie }) => {
6569
+ const ye = { name: M, value: B ?? H };
6570
+ return ie && (ye.namespace = ie), ye;
6571
+ }), oe = {
6565
6572
  id: crypto.randomUUID(),
6566
6573
  tagName: v.rootElementName,
6567
6574
  namespace: v.namespaces.default,
@@ -6570,33 +6577,63 @@ async function Ka(m) {
6570
6577
  parent: null,
6571
6578
  children: []
6572
6579
  };
6573
- return await r.bulkWrite(I, { creates: [ie] }), { documentId: I, document: q, documentState: Rn(q) };
6580
+ return await r.bulkWrite(I, { creates: [oe] }), { documentId: I, document: q, documentState: Rn(q) };
6574
6581
  }
6575
- class Gi {
6576
- constructor(r, s, o, d, f, v) {
6582
+ class Za {
6583
+ constructor(r) {
6577
6584
  this.state = {
6578
6585
  documents: /* @__PURE__ */ new Map(),
6579
6586
  activeTransactions: 0
6580
- }, this.name = r, this.store = s, this.configs = o, this.defaultConfigKey = d, this.extensionsRegistry = f, this.hooks = v, this.channel = new BroadcastChannel(`dialecte::project::${r}`), this.channel.onmessage = (g) => {
6581
- const { type: D } = g.data ?? {};
6582
- (D === "document-created" || D === "document-removed" || D === "document-imported") && this.refreshState();
6583
6587
  };
6588
+ const s = Object.keys(r.configs);
6589
+ this.storage = r.storage, this.configs = r.configs, this.defaultConfigKey = r.defaultConfigKey ?? s[0], this.extensionsRegistry = r.extensionsRegistry, this.hooks = r.hooks;
6590
+ }
6591
+ get name() {
6592
+ return we(this._name !== void 0, {
6593
+ key: "PROJECT_NOT_OPENED",
6594
+ detail: "Call project.open(name) before accessing project properties."
6595
+ }), this._name;
6596
+ }
6597
+ get store() {
6598
+ return we(this._store !== void 0, {
6599
+ key: "PROJECT_NOT_OPENED",
6600
+ detail: "Call project.open(name) before accessing project properties."
6601
+ }), this._store;
6602
+ }
6603
+ get channel() {
6604
+ return we(this._channel !== void 0, {
6605
+ key: "PROJECT_NOT_OPENED",
6606
+ detail: "Call project.open(name) before accessing project properties."
6607
+ }), this._channel;
6584
6608
  }
6585
- // ── Factory ──────────────────────────────────────────────────────────────
6586
- static async open(r) {
6587
- const { name: s, configs: o, storage: d, extensions: f, hooks: v, defaultConfigKey: g } = r, D = wo({ base: f?.base, custom: f?.custom }), I = Object.keys(o), q = g ?? I[0], M = na(s, d, o[q]);
6588
- await M.open();
6589
- const X = new Gi(
6590
- s,
6591
- M,
6592
- o,
6593
- q,
6594
- D,
6595
- v
6596
- ), ie = await M.getDocuments();
6597
- for (const j of ie)
6598
- X.state.documents.set(j.id, Rn(j));
6599
- return X;
6609
+ // ── Lifecycle ────────────────────────────────────────────────────────────
6610
+ /**
6611
+ * Open a named project: resolve store, open DB connection, hydrate state.
6612
+ * Must be called before import/export/openDocument.
6613
+ */
6614
+ async open(r) {
6615
+ this._name = r, this._channel = new BroadcastChannel(`dialecte::project::${r}`), this._channel.onmessage = (d) => {
6616
+ const { type: f } = d.data ?? {};
6617
+ (f === "init-empty-document" || f === "document-removed" || f === "document-imported") && this.refreshState();
6618
+ };
6619
+ const s = ea(r, this.storage, this.configs[this.defaultConfigKey]);
6620
+ await s.open(), this._store = s;
6621
+ const o = await s.getDocuments();
6622
+ for (const d of o)
6623
+ this.state.documents.set(d.id, Rn(d));
6624
+ return this;
6625
+ }
6626
+ /**
6627
+ * Close the store and release resources.
6628
+ */
6629
+ close() {
6630
+ this.channel.close(), this.store.close();
6631
+ }
6632
+ /**
6633
+ * Destroy the project - deletes the database entirely.
6634
+ */
6635
+ async destroy() {
6636
+ this.channel.close(), await this.store.destroy(), this.state.documents.clear();
6600
6637
  }
6601
6638
  // ── File management ──────────────────────────────────────────────────────
6602
6639
  /**
@@ -6604,13 +6641,13 @@ class Gi {
6604
6641
  * Returns the new documentId. Records are added later via import or transactions.
6605
6642
  */
6606
6643
  async initEmptyDocument(r) {
6607
- const s = await Ka({
6644
+ const s = await ja({
6608
6645
  store: this.store,
6609
6646
  configs: this.configs,
6610
6647
  defaultConfigKey: this.defaultConfigKey,
6611
6648
  options: r
6612
6649
  });
6613
- return this.state.documents.set(s.documentId, s.documentState), this.channel.postMessage({ type: "document-created", documentId: s.documentId }), s.documentId;
6650
+ return this.state.documents.set(s.documentId, s.documentState), this.channel.postMessage({ type: "init-empty-document", documentId: s.documentId }), s.documentId;
6614
6651
  }
6615
6652
  /**
6616
6653
  * Remove a file and all its records.
@@ -6623,7 +6660,7 @@ class Gi {
6623
6660
  * Import a File into the project: register, parse XML, persist records.
6624
6661
  */
6625
6662
  async import(r, s) {
6626
- const o = await ja({
6663
+ const o = await Ba({
6627
6664
  file: r,
6628
6665
  store: this.store,
6629
6666
  configs: this.configs,
@@ -6636,7 +6673,7 @@ class Gi {
6636
6673
  * Export a document as an XMLDocument built from stored records.
6637
6674
  */
6638
6675
  async export(r, s) {
6639
- return Ba({
6676
+ return Pa({
6640
6677
  documentId: r,
6641
6678
  state: this.state,
6642
6679
  configs: this.configs,
@@ -6658,12 +6695,12 @@ class Gi {
6658
6695
  */
6659
6696
  openDocument(r) {
6660
6697
  const s = this.state.documents.get(r);
6661
- Oe(s, {
6698
+ we(s, {
6662
6699
  key: "DOCUMENT_NOT_REGISTERED",
6663
6700
  detail: `Document "${r}" not registered in project "${this.name}"`
6664
6701
  });
6665
6702
  const o = this.configs[s.document.configKey];
6666
- return new Yo(
6703
+ return new $o(
6667
6704
  this.store,
6668
6705
  o,
6669
6706
  r,
@@ -6683,69 +6720,56 @@ class Gi {
6683
6720
  // ── Undo / Redo ──────────────────────────────────────────────────────────
6684
6721
  async undo(r) {
6685
6722
  const s = this.state.documents.get(r);
6686
- Oe(s, {
6723
+ we(s, {
6687
6724
  key: "DOCUMENT_NOT_REGISTERED",
6688
6725
  detail: `Document "${r}" not registered in project "${this.name}"`
6689
6726
  }), await this.store.undo(r), this.channel.postMessage({ type: "commit", documentId: r, timestamp: Date.now() });
6690
6727
  }
6691
6728
  async redo(r) {
6692
6729
  const s = this.state.documents.get(r);
6693
- Oe(s, {
6730
+ we(s, {
6694
6731
  key: "DOCUMENT_NOT_REGISTERED",
6695
6732
  detail: `Document "${r}" not registered in project "${this.name}"`
6696
6733
  }), await this.store.redo(r), this.channel.postMessage({ type: "commit", documentId: r, timestamp: Date.now() });
6697
6734
  }
6698
- // ── Lifecycle ────────────────────────────────────────────────────────────
6699
- /**
6700
- * Close the store and release resources.
6701
- */
6702
- close() {
6703
- this.channel.close(), this.store.close();
6704
- }
6705
- /**
6706
- * Destroy the project - deletes the database entirely.
6707
- */
6708
- async destroy() {
6709
- this.channel.close(), await this.store.destroy(), this.state.documents.clear();
6710
- }
6711
6735
  // ── Internal ─────────────────────────────────────────────────────────────
6712
- /** Access the underlying store (for import pipelines, testing) */
6713
- getStore() {
6714
- return this.store;
6736
+ /** Expose the underlying database instance. Return type is inferred from the store (Dexie for local storage). */
6737
+ getDatabaseInstance() {
6738
+ return this.store.getDatabaseInstance();
6715
6739
  }
6716
6740
  async refreshState() {
6717
6741
  const r = await this.store.getDocuments();
6718
- Ma(this.state.documents, r);
6742
+ Fa(this.state.documents, r);
6719
6743
  }
6720
6744
  }
6721
6745
  export {
6722
6746
  Di as A,
6723
- ja as B,
6747
+ Ba as B,
6724
6748
  ai as C,
6725
6749
  oi as D,
6726
- Ka as E,
6750
+ ja as E,
6727
6751
  zt as F,
6728
6752
  xt as G,
6729
- Ra as H,
6730
- Ma as I,
6731
- Xo as J,
6732
- na as K,
6753
+ Sa as H,
6754
+ Fa as I,
6755
+ Yo as J,
6756
+ ea as K,
6733
6757
  si as M,
6734
- fa as P,
6758
+ ua as P,
6735
6759
  Si as Q,
6736
6760
  Xe as T,
6737
- Uo as a,
6738
- ta as b,
6739
- Yo as c,
6740
- Gi as d,
6761
+ qo as a,
6762
+ Jo as b,
6763
+ $o as c,
6764
+ Za as d,
6741
6765
  ft as e,
6742
6766
  He as f,
6743
- Wo as g,
6744
- ji as h,
6745
- Go as i,
6767
+ Go as g,
6768
+ Mi as h,
6769
+ Vo as i,
6746
6770
  Rn as j,
6747
- aa as k,
6748
- Ba as l,
6771
+ ia as k,
6772
+ Pa as l,
6749
6773
  bi as m,
6750
6774
  Er as n,
6751
6775
  wr as o,
@@ -6757,7 +6781,7 @@ export {
6757
6781
  vi as u,
6758
6782
  me as v,
6759
6783
  Zt as w,
6760
- Ja as x,
6784
+ Qa as x,
6761
6785
  Sn as y,
6762
6786
  Oi as z
6763
6787
  };