@dialecte/core 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7,8 +7,8 @@ function eo(l) {
7
7
  }
8
8
  function Ee(l, c) {
9
9
  if (l) return;
10
- const u = "Assertion failed", i = c ? `${u}: ${c}` : u;
11
- throw new Error(i);
10
+ const u = "Assertion failed", o = c ? `${u}: ${c}` : u;
11
+ throw new Error(o);
12
12
  }
13
13
  const sa = [
14
14
  "id",
@@ -23,7 +23,7 @@ function pr(l, c) {
23
23
  if (typeof l != "object" || l === null)
24
24
  return !1;
25
25
  const u = Object.keys(l);
26
- return c.every((i) => i in l) && u.every((i) => c.includes(i)) && u.length === c.length;
26
+ return c.every((o) => o in l) && u.every((o) => c.includes(o)) && u.length === c.length;
27
27
  }
28
28
  function no(l) {
29
29
  return Array.isArray(l);
@@ -49,31 +49,31 @@ function Tn(l) {
49
49
  };
50
50
  }
51
51
  function Pe(l) {
52
- const { record: c, status: u } = l, i = u ?? ("status" in c ? c.status : "unchanged");
52
+ const { record: c, status: u } = l, o = u ?? ("status" in c ? c.status : "unchanged");
53
53
  return {
54
54
  ...Tn(c),
55
- status: i
55
+ status: o
56
56
  };
57
57
  }
58
58
  function Nn(l) {
59
- const { record: c, status: u, tree: i } = l, h = i ?? ("tree" in c ? c.tree : []);
59
+ const { record: c, status: u, tree: o } = l, h = o ?? ("tree" in c ? c.tree : []);
60
60
  return {
61
61
  ...Pe({ record: c, status: u }),
62
62
  tree: h
63
63
  };
64
64
  }
65
65
  function ca(l) {
66
- const { tagName: c, attributes: u, dialecteConfig: i } = l;
66
+ const { tagName: c, attributes: u, dialecteConfig: o } = l;
67
67
  return no(u) ? u : Object.entries(u).map(
68
68
  ([h, p]) => ({
69
69
  name: h,
70
70
  value: p,
71
- namespace: i.definition[c]?.attributes.details[h]?.namespace || void 0
71
+ namespace: o.definition[c]?.attributes.details[h]?.namespace || void 0
72
72
  })
73
73
  );
74
74
  }
75
75
  function la(l) {
76
- const { record: c, dialecteConfig: u } = l, { id: i, tagName: h, attributes: p, namespace: y, value: C } = c, R = i ?? crypto.randomUUID(), P = p ? ca({ tagName: h, attributes: p, dialecteConfig: u }) : [], U = {
76
+ const { record: c, dialecteConfig: u } = l, { id: o, tagName: h, attributes: p, namespace: y, value: C } = c, R = o ?? crypto.randomUUID(), P = p ? ca({ tagName: h, attributes: p, dialecteConfig: u }) : [], U = {
77
77
  id: R,
78
78
  tagName: h,
79
79
  attributes: P,
@@ -112,20 +112,20 @@ function ro(l) {
112
112
  function os(l) {
113
113
  const { attributes: c } = l;
114
114
  return c.reduce(
115
- (u, i) => {
116
- const h = i.value || "";
117
- return u[i.name] = h, u;
115
+ (u, o) => {
116
+ const h = o.value || "";
117
+ return u[o.name] = h, u;
118
118
  },
119
119
  {}
120
120
  );
121
121
  }
122
122
  async function fa(l) {
123
- const { context: c, dialecteConfig: u, databaseInstance: i, tagName: h, attributes: p } = l;
123
+ const { context: c, dialecteConfig: u, databaseInstance: o, tagName: h, attributes: p } = l;
124
124
  return (await ao({
125
125
  tagName: h,
126
126
  stagedOperations: c.stagedOperations,
127
127
  dialecteConfig: u,
128
- databaseInstance: i,
128
+ databaseInstance: o,
129
129
  type: "chain"
130
130
  })).filter(
131
131
  (R) => gr(R, p)
@@ -134,24 +134,24 @@ async function fa(l) {
134
134
  function gr(l, c) {
135
135
  if (!c || Object.keys(c).length === 0)
136
136
  return !0;
137
- for (const [u, i] of Object.entries(c)) {
138
- if (i === void 0) continue;
137
+ for (const [u, o] of Object.entries(c)) {
138
+ if (o === void 0) continue;
139
139
  const h = ro({
140
140
  attributes: l.attributes,
141
141
  name: u
142
142
  });
143
143
  if (h === "") return !1;
144
- if (Array.isArray(i)) {
145
- if (!i.some((p) => h === p))
144
+ if (Array.isArray(o)) {
145
+ if (!o.some((p) => h === p))
146
146
  return !1;
147
- } else if (h !== i)
147
+ } else if (h !== o)
148
148
  return !1;
149
149
  }
150
150
  return !0;
151
151
  }
152
152
  async function We(l) {
153
- const { id: c, tagName: u, stagedOperations: i, dialecteConfig: h, databaseInstance: p, type: y = "raw" } = l, C = yr({
154
- stagedOperations: i,
153
+ const { id: c, tagName: u, stagedOperations: o, dialecteConfig: h, databaseInstance: p, type: y = "raw" } = l, C = yr({
154
+ stagedOperations: o,
155
155
  id: c,
156
156
  tagName: u,
157
157
  throwOnDeleted: !1
@@ -164,7 +164,7 @@ async function We(l) {
164
164
  return Ee(P.tagName === u, "Element tagName mismatch"), y === "raw" ? P : Pe({ record: P });
165
165
  }
166
166
  async function ao(l) {
167
- const { stagedOperations: c, tagName: u, dialecteConfig: i, databaseInstance: h, type: p = "raw" } = l, y = i.database.tables.xmlElements.name, C = await h.table(y).where({ tagName: u }).toArray(), R = new Map(
167
+ const { stagedOperations: c, tagName: u, dialecteConfig: o, databaseInstance: h, type: p = "raw" } = l, y = o.database.tables.xmlElements.name, C = await h.table(y).where({ tagName: u }).toArray(), R = new Map(
168
168
  C.map((P) => [P.id, p === "raw" ? P : Pe({ record: P })])
169
169
  );
170
170
  for (const P of c)
@@ -178,23 +178,23 @@ async function ao(l) {
178
178
  return Array.from(R.values());
179
179
  }
180
180
  function yr(l) {
181
- const { stagedOperations: c, id: u, tagName: i, throwOnDeleted: h = !0 } = l, p = [...c].reverse().find((C) => C.status === "created" || C.status === "updated" ? C.newRecord.id === u : C.status === "deleted" ? C.oldRecord.id === u : !1);
181
+ const { stagedOperations: c, id: u, tagName: o, throwOnDeleted: h = !0 } = l, p = [...c].reverse().find((C) => C.status === "created" || C.status === "updated" ? C.newRecord.id === u : C.status === "deleted" ? C.oldRecord.id === u : !1);
182
182
  if (!p) return;
183
183
  if (p.status === "deleted") {
184
- const C = i ? ` ${i}` : "";
184
+ const C = o ? ` ${o}` : "";
185
185
  if (h) throw new Error(`Element${C} with id ${u} has been deleted`);
186
186
  }
187
187
  const y = p.status === "deleted" ? p.oldRecord : p.newRecord;
188
- if (y.tagName !== i)
188
+ if (y.tagName !== o)
189
189
  throw new Error(
190
- `Element tagName mismatch: expected ${i}, got ${y.tagName} for id ${u}`
190
+ `Element tagName mismatch: expected ${o}, got ${y.tagName} for id ${u}`
191
191
  );
192
192
  return { record: y, status: p.status };
193
193
  }
194
194
  function ut(l) {
195
- const { context: c, status: u, record: i, oldRecord: h, newRecord: p } = l;
195
+ const { context: c, status: u, record: o, oldRecord: h, newRecord: p } = l;
196
196
  let y, C, R;
197
- i && (y = Tn(i)), h && (C = Tn(h)), p && (R = Tn(p)), u === "created" ? (Ee(y, "record is required for created"), c.stagedOperations.push({ status: u, oldRecord: void 0, newRecord: y })) : u === "updated" ? (Ee(C && R, "oldRecord and newRecord are required for updated"), c.stagedOperations.push({ status: u, oldRecord: C, newRecord: R })) : u === "deleted" && y && (Ee(y, "record is required for deleted"), c.stagedOperations.push({ status: u, oldRecord: y, newRecord: void 0 }));
197
+ o && (y = Tn(o)), h && (C = Tn(h)), p && (R = Tn(p)), u === "created" ? (Ee(y, "record is required for created"), c.stagedOperations.push({ status: u, oldRecord: void 0, newRecord: y })) : u === "updated" ? (Ee(C && R, "oldRecord and newRecord are required for updated"), c.stagedOperations.push({ status: u, oldRecord: C, newRecord: R })) : u === "deleted" && y && (Ee(y, "record is required for deleted"), c.stagedOperations.push({ status: u, oldRecord: y, newRecord: void 0 }));
198
198
  }
199
199
  const qe = {
200
200
  default: {
@@ -518,7 +518,7 @@ const qe = {
518
518
  maxOccurrence: null,
519
519
  assertions: null
520
520
  };
521
- function ho(l, c) {
521
+ function ho(l) {
522
522
  return {
523
523
  required: [`a${l}`],
524
524
  optional: [`b${l}`, `c${l}`]
@@ -546,8 +546,8 @@ function mo() {
546
546
  any: !1,
547
547
  sequence: l,
548
548
  details: Object.fromEntries(
549
- l.map((i) => [
550
- i,
549
+ l.map((o) => [
550
+ o,
551
551
  {
552
552
  required: !1,
553
553
  validation: Ct,
@@ -558,13 +558,13 @@ function mo() {
558
558
  choices: []
559
559
  }
560
560
  };
561
- for (const i of l)
562
- po(i, 3, u);
561
+ for (const o of l)
562
+ po(o, 3, u);
563
563
  return u;
564
564
  }
565
565
  function po(l, c, u) {
566
- const i = go(l, c);
567
- for (const h of i) {
566
+ const o = go(l, c);
567
+ for (const h of o) {
568
568
  const p = ha(h), y = yo(h), C = vo(h, c), P = h.endsWith("_3") ? qe.ext : qe.default, U = ho(h), Y = [...U.required, ...U.optional], z = Zr(h), M = {
569
569
  ...Ct,
570
570
  minOccurrence: z === 1 ? 1 : null,
@@ -626,17 +626,17 @@ function po(l, c, u) {
626
626
  }
627
627
  function go(l, c) {
628
628
  const u = [l];
629
- let i = [l];
629
+ let o = [l];
630
630
  for (let h = 1; h <= c; h++) {
631
631
  const p = [];
632
- for (const y of i) {
632
+ for (const y of o) {
633
633
  const C = y.replace(/_\d+/g, "") + l.charAt(0);
634
634
  for (let R = 1; R <= 3; R++) {
635
635
  const P = `${C}_${R}`;
636
636
  u.push(P), p.push(P);
637
637
  }
638
638
  }
639
- i = p;
639
+ o = p;
640
640
  }
641
641
  return u;
642
642
  }
@@ -644,15 +644,15 @@ function yo(l) {
644
644
  if (l.length === 1) return null;
645
645
  const c = l.match(/^([A-Z]+)_(\d+)$/);
646
646
  if (!c) return null;
647
- const [, u, i] = c;
648
- return u.length === 2 ? u.charAt(0) : `${u.slice(0, -1)}_${i}`;
647
+ const [, u, o] = c;
648
+ return u.length === 2 ? u.charAt(0) : `${u.slice(0, -1)}_${o}`;
649
649
  }
650
650
  function vo(l, c) {
651
651
  if (ha(l) > c) return [];
652
- const i = l.match(/^([A-Z]+)(?:_(\d+))?$/);
653
- if (!i) return [];
654
- const [, h, p] = i, y = h + h.charAt(0);
655
- return [`${y}_1`, `${y}_2`, `${y}_3`];
652
+ const o = l.match(/^([A-Z]+)(?:_(\d+))?$/);
653
+ if (!o) return [];
654
+ const [, h] = o, p = h + h.charAt(0);
655
+ return [`${p}_1`, `${p}_2`, `${p}_3`];
656
656
  }
657
657
  function ha(l) {
658
658
  return l.replace(/_\d+/g, "").length;
@@ -687,17 +687,17 @@ const _o = mo(), bo = {
687
687
  extensions: {}
688
688
  };
689
689
  function cs(l) {
690
- const { record: c, type: u = "raw" } = l, i = la({
690
+ const { record: c, type: u = "raw" } = l, o = la({
691
691
  record: c,
692
692
  dialecteConfig: ma
693
693
  });
694
694
  switch (u) {
695
695
  case "raw":
696
- return i;
696
+ return o;
697
697
  case "chain":
698
- return Pe({ record: i });
698
+ return Pe({ record: o });
699
699
  case "tree":
700
- return Nn({ record: i });
700
+ return Nn({ record: o });
701
701
  default:
702
702
  throw new Error(`Unsupported record type: ${u}`);
703
703
  }
@@ -710,22 +710,22 @@ function wo(l) {
710
710
  if (Object.prototype.hasOwnProperty.call(l, "__esModule")) return l;
711
711
  var c = l.default;
712
712
  if (typeof c == "function") {
713
- var u = function i() {
713
+ var u = function o() {
714
714
  var h = !1;
715
715
  try {
716
- h = this instanceof i;
716
+ h = this instanceof o;
717
717
  } catch {
718
718
  }
719
719
  return h ? Reflect.construct(c, arguments, this.constructor) : c.apply(this, arguments);
720
720
  };
721
721
  u.prototype = c.prototype;
722
722
  } else u = {};
723
- return Object.defineProperty(u, "__esModule", { value: !0 }), Object.keys(l).forEach(function(i) {
724
- var h = Object.getOwnPropertyDescriptor(l, i);
725
- Object.defineProperty(u, i, h.get ? h : {
723
+ return Object.defineProperty(u, "__esModule", { value: !0 }), Object.keys(l).forEach(function(o) {
724
+ var h = Object.getOwnPropertyDescriptor(l, o);
725
+ Object.defineProperty(u, o, h.get ? h : {
726
726
  enumerable: !0,
727
727
  get: function() {
728
- return l[i];
728
+ return l[o];
729
729
  }
730
730
  });
731
731
  }), u;
@@ -733,8 +733,8 @@ function wo(l) {
733
733
  var xn = { exports: {} }, Bo = xn.exports, Jr;
734
734
  function Eo() {
735
735
  return Jr || (Jr = 1, (function(l, c) {
736
- (function(u, i) {
737
- l.exports = i();
736
+ (function(u, o) {
737
+ l.exports = o();
738
738
  })(Bo, function() {
739
739
  var u = function(e, t) {
740
740
  return (u = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
@@ -742,14 +742,14 @@ function Eo() {
742
742
  } || function(n, r) {
743
743
  for (var a in r) Object.prototype.hasOwnProperty.call(r, a) && (n[a] = r[a]);
744
744
  })(e, t);
745
- }, i = function() {
746
- return (i = Object.assign || function(e) {
745
+ }, o = function() {
746
+ return (o = Object.assign || function(e) {
747
747
  for (var t, n = 1, r = arguments.length; n < r; n++) for (var a in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, a) && (e[a] = t[a]);
748
748
  return e;
749
749
  }).apply(this, arguments);
750
750
  };
751
751
  function h(e, t, n) {
752
- for (var r, a = 0, o = t.length; a < o; a++) !r && a in t || ((r = r || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
752
+ for (var r, a = 0, i = t.length; a < i; a++) !r && a in t || ((r = r || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
753
753
  return e.concat(r || Array.prototype.slice.call(t));
754
754
  }
755
755
  var p = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ao, y = Object.keys, C = Array.isArray;
@@ -795,8 +795,8 @@ function Eo() {
795
795
  if (!t) return e;
796
796
  if (typeof t != "string") {
797
797
  for (var n = [], r = 0, a = t.length; r < a; ++r) {
798
- var o = pe(e, t[r]);
799
- n.push(o);
798
+ var i = pe(e, t[r]);
799
+ n.push(i);
800
800
  }
801
801
  return n;
802
802
  }
@@ -811,8 +811,8 @@ function Eo() {
811
811
  W(typeof n != "string" && "length" in n);
812
812
  for (var r = 0, a = t.length; r < a; ++r) ae(e, t[r], n[r]);
813
813
  } else {
814
- var o, d, m = t.indexOf(".");
815
- m !== -1 ? (o = t.substr(0, m), (d = t.substr(m + 1)) === "" ? n === void 0 ? C(e) && !isNaN(parseInt(o)) ? e.splice(o, 1) : delete e[o] : e[o] = n : ae(m = !(m = e[o]) || !Y(e, o) ? e[o] = {} : m, d, n)) : n === void 0 ? C(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
814
+ var i, d, m = t.indexOf(".");
815
+ m !== -1 ? (i = t.substr(0, m), (d = t.substr(m + 1)) === "" ? n === void 0 ? C(e) && !isNaN(parseInt(i)) ? e.splice(i, 1) : delete e[i] : e[i] = n : ae(m = !(m = e[i]) || !Y(e, i) ? e[i] = {} : m, d, n)) : n === void 0 ? C(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
816
816
  }
817
817
  }
818
818
  function Re(e) {
@@ -840,7 +840,7 @@ function Eo() {
840
840
  if (r) return r;
841
841
  if (C(n)) {
842
842
  r = [], de.set(n, r);
843
- for (var a = 0, o = n.length; a < o; ++a) r.push(t(n[a]));
843
+ for (var a = 0, i = n.length; a < i; ++a) r.push(t(n[a]));
844
844
  } else if (ze.has(n.constructor)) r = n;
845
845
  else {
846
846
  var d, m = P(n);
@@ -911,9 +911,9 @@ function Eo() {
911
911
  return e[t] = t + "Error", e;
912
912
  }, {}), s = Qe, O = Me.reduce(function(e, t) {
913
913
  var n = t + "Error";
914
- function r(a, o) {
915
- this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(o ? `
916
- ` + o : ""), this.inner = o || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = Pt[t] || n, this.inner = null);
914
+ function r(a, i) {
915
+ this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(i ? `
916
+ ` + i : ""), this.inner = i || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = Pt[t] || n, this.inner = null);
917
917
  }
918
918
  return F(r).from(s), e[t] = r, e;
919
919
  }, {});
@@ -944,8 +944,8 @@ function Eo() {
944
944
  n !== void 0 && (arguments[0] = n);
945
945
  var r = this.onsuccess, a = this.onerror;
946
946
  this.onsuccess = null, this.onerror = null;
947
- var o = t.apply(this, arguments);
948
- return r && (this.onsuccess = this.onsuccess ? ve(r, this.onsuccess) : r), a && (this.onerror = this.onerror ? ve(a, this.onerror) : a), o !== void 0 ? o : n;
947
+ var i = t.apply(this, arguments);
948
+ return r && (this.onsuccess = this.onsuccess ? ve(r, this.onsuccess) : r), a && (this.onerror = this.onerror ? ve(a, this.onerror) : a), i !== void 0 ? i : n;
949
949
  };
950
950
  }
951
951
  function Ae(e, t) {
@@ -959,8 +959,8 @@ function Eo() {
959
959
  return e === Z ? t : function(n) {
960
960
  var r = e.apply(this, arguments);
961
961
  R(n, r);
962
- var a = this.onsuccess, o = this.onerror;
963
- return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? ve(a, this.onsuccess) : a), o && (this.onerror = this.onerror ? ve(o, this.onerror) : o), r === void 0 ? n === void 0 ? void 0 : n : R(r, n);
962
+ var a = this.onsuccess, i = this.onerror;
963
+ return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? ve(a, this.onsuccess) : a), i && (this.onerror = this.onerror ? ve(i, this.onerror) : i), r === void 0 ? n === void 0 ? void 0 : n : R(r, n);
964
964
  };
965
965
  }
966
966
  function In(e, t) {
@@ -972,9 +972,9 @@ function Eo() {
972
972
  return e === Z ? t : function() {
973
973
  var n = e.apply(this, arguments);
974
974
  if (n && typeof n.then == "function") {
975
- for (var r = this, a = arguments.length, o = new Array(a); a--; ) o[a] = arguments[a];
975
+ for (var r = this, a = arguments.length, i = new Array(a); a--; ) i[a] = arguments[a];
976
976
  return n.then(function() {
977
- return t.apply(r, o);
977
+ return t.apply(r, i);
978
978
  });
979
979
  }
980
980
  return t.apply(this, arguments);
@@ -1003,25 +1003,25 @@ function Eo() {
1003
1003
  }
1004
1004
  this._state = null, this._value = null, ++t.ref, (function n(r, a) {
1005
1005
  try {
1006
- a(function(o) {
1006
+ a(function(i) {
1007
1007
  if (r._state === null) {
1008
- if (o === r) throw new TypeError("A promise cannot be resolved with itself.");
1008
+ if (i === r) throw new TypeError("A promise cannot be resolved with itself.");
1009
1009
  var d = r._lib && Bt();
1010
- o && typeof o.then == "function" ? n(r, function(m, v) {
1011
- o instanceof G ? o._then(m, v) : o.then(m, v);
1012
- }) : (r._state = !0, r._value = o, Cr(r)), d && Et();
1010
+ i && typeof i.then == "function" ? n(r, function(m, v) {
1011
+ i instanceof G ? i._then(m, v) : i.then(m, v);
1012
+ }) : (r._state = !0, r._value = i, Cr(r)), d && Et();
1013
1013
  }
1014
1014
  }, Fn.bind(null, r));
1015
- } catch (o) {
1016
- Fn(r, o);
1015
+ } catch (i) {
1016
+ Fn(r, i);
1017
1017
  }
1018
1018
  })(this, e);
1019
1019
  }
1020
1020
  var kn = { get: function() {
1021
1021
  var e = Q, t = an;
1022
1022
  function n(r, a) {
1023
- var o = this, d = !e.global && (e !== Q || t !== an), m = d && !nt(), v = new G(function(b, w) {
1024
- Mn(o, new br(wr(r, e, d, m), wr(a, e, d, m), b, w, e));
1023
+ var i = this, d = !e.global && (e !== Q || t !== an), m = d && !nt(), v = new G(function(b, w) {
1024
+ Mn(i, new br(wr(r, e, d, m), wr(a, e, d, m), b, w, e));
1025
1025
  });
1026
1026
  return this._consoleTask && (v._consoleTask = this._consoleTask), v;
1027
1027
  }
@@ -1061,11 +1061,11 @@ function Eo() {
1061
1061
  var r, a = t._value;
1062
1062
  !t._state && Jt.length && (Jt = []), r = De && t._consoleTask ? t._consoleTask.run(function() {
1063
1063
  return e(a);
1064
- }) : e(a), t._state || Jt.indexOf(a) !== -1 || (function(o) {
1065
- for (var d = ht.length; d; ) if (ht[--d]._value === o._value) return ht.splice(d, 1);
1064
+ }) : e(a), t._state || Jt.indexOf(a) !== -1 || (function(i) {
1065
+ for (var d = ht.length; d; ) if (ht[--d]._value === i._value) return ht.splice(d, 1);
1066
1066
  })(t), n.resolve(r);
1067
- } catch (o) {
1068
- n.reject(o);
1067
+ } catch (i) {
1068
+ n.reject(i);
1069
1069
  } finally {
1070
1070
  --mt == 0 && jn(), --n.psd.ref || n.psd.finalize();
1071
1071
  }
@@ -1105,8 +1105,8 @@ function Eo() {
1105
1105
  var r = Bt(), a = Q;
1106
1106
  try {
1107
1107
  return rt(n, !0), e.apply(this, arguments);
1108
- } catch (o) {
1109
- t && t(o);
1108
+ } catch (i) {
1109
+ t && t(i);
1110
1110
  } finally {
1111
1111
  rt(a, !1), r && Et();
1112
1112
  }
@@ -1135,19 +1135,19 @@ function Eo() {
1135
1135
  }, timeout: function(e, t) {
1136
1136
  var n = this;
1137
1137
  return e < 1 / 0 ? new G(function(r, a) {
1138
- var o = setTimeout(function() {
1138
+ var i = setTimeout(function() {
1139
1139
  return a(new O.Timeout(t));
1140
1140
  }, e);
1141
- n.then(r, a).finally(clearTimeout.bind(null, o));
1141
+ n.then(r, a).finally(clearTimeout.bind(null, i));
1142
1142
  }) : this;
1143
1143
  } }), typeof Symbol < "u" && Symbol.toStringTag && M(G.prototype, Symbol.toStringTag, "Dexie.Promise"), et.env = Ar(), z(G, { all: function() {
1144
1144
  var e = ke.apply(null, arguments).map(on);
1145
1145
  return new G(function(t, n) {
1146
1146
  e.length === 0 && t([]);
1147
1147
  var r = e.length;
1148
- e.forEach(function(a, o) {
1148
+ e.forEach(function(a, i) {
1149
1149
  return G.resolve(a).then(function(d) {
1150
- e[o] = d, --r || t(e);
1150
+ e[i] = d, --r || t(e);
1151
1151
  }, n);
1152
1152
  });
1153
1153
  });
@@ -1178,12 +1178,12 @@ function Eo() {
1178
1178
  Sn = e;
1179
1179
  } }, follow: function(e, t) {
1180
1180
  return new G(function(n, r) {
1181
- return tt(function(a, o) {
1181
+ return tt(function(a, i) {
1182
1182
  var d = Q;
1183
- d.unhandleds = [], d.onunhandled = o, d.finalize = ve(function() {
1183
+ d.unhandleds = [], d.onunhandled = i, d.finalize = ve(function() {
1184
1184
  var m, v = this;
1185
1185
  m = function() {
1186
- v.unhandleds.length === 0 ? a() : o(v.unhandleds[0]);
1186
+ v.unhandleds.length === 0 ? a() : i(v.unhandleds[0]);
1187
1187
  }, en.push(function b() {
1188
1188
  m(), en.splice(en.indexOf(b), 1);
1189
1189
  }), ++mt, jt(function() {
@@ -1197,11 +1197,11 @@ function Eo() {
1197
1197
  return new G(function(t) {
1198
1198
  e.length === 0 && t([]);
1199
1199
  var n = e.length, r = new Array(n);
1200
- e.forEach(function(a, o) {
1200
+ e.forEach(function(a, i) {
1201
1201
  return G.resolve(a).then(function(d) {
1202
- return r[o] = { status: "fulfilled", value: d };
1202
+ return r[i] = { status: "fulfilled", value: d };
1203
1203
  }, function(d) {
1204
- return r[o] = { status: "rejected", reason: d };
1204
+ return r[i] = { status: "rejected", reason: d };
1205
1205
  }).then(function() {
1206
1206
  return --n || t(r);
1207
1207
  });
@@ -1212,8 +1212,8 @@ function Eo() {
1212
1212
  return new G(function(t, n) {
1213
1213
  e.length === 0 && n(new AggregateError([]));
1214
1214
  var r = e.length, a = new Array(r);
1215
- e.forEach(function(o, d) {
1216
- return G.resolve(o).then(function(m) {
1215
+ e.forEach(function(i, d) {
1216
+ return G.resolve(i).then(function(m) {
1217
1217
  return t(m);
1218
1218
  }, function(m) {
1219
1219
  a[d] = m, --r || n(new AggregateError(a));
@@ -1223,10 +1223,10 @@ function Eo() {
1223
1223
  }), dt.withResolvers && (G.withResolvers = dt.withResolvers));
1224
1224
  var we = { awaits: 0, echoes: 0, id: 0 }, Ia = 0, nn = [], rn = 0, an = 0, Da = 0;
1225
1225
  function tt(e, t, n, r) {
1226
- var a = Q, o = Object.create(a);
1227
- return o.parent = a, o.ref = 0, o.global = !1, o.id = ++Da, et.env, o.env = Dn ? { Promise: G, PromiseProp: { value: G, configurable: !0, writable: !0 }, all: G.all, race: G.race, allSettled: G.allSettled, any: G.any, resolve: G.resolve, reject: G.reject } : {}, t && R(o, t), ++a.ref, o.finalize = function() {
1226
+ var a = Q, i = Object.create(a);
1227
+ return i.parent = a, i.ref = 0, i.global = !1, i.id = ++Da, et.env, i.env = Dn ? { Promise: G, PromiseProp: { value: G, configurable: !0, writable: !0 }, all: G.all, race: G.race, allSettled: G.allSettled, any: G.any, resolve: G.resolve, reject: G.reject } : {}, t && R(i, t), ++a.ref, i.finalize = function() {
1228
1228
  --this.parent.ref || this.parent.finalize();
1229
- }, r = pt(o, e, n, r), o.ref === 0 && o.finalize(), r;
1229
+ }, r = pt(i, e, n, r), i.ref === 0 && i.finalize(), r;
1230
1230
  }
1231
1231
  function Tt() {
1232
1232
  return we.id || (we.id = ++Ia), ++we.awaits, we.echoes += _r, we.id;
@@ -1256,11 +1256,11 @@ function Eo() {
1256
1256
  return Dn ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(p, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
1257
1257
  }
1258
1258
  function pt(e, t, n, r, a) {
1259
- var o = Q;
1259
+ var i = Q;
1260
1260
  try {
1261
1261
  return rt(e, !0), t(n, r, a);
1262
1262
  } finally {
1263
- rt(o, !1);
1263
+ rt(i, !1);
1264
1264
  }
1265
1265
  }
1266
1266
  function wr(e, t, n, r) {
@@ -1305,14 +1305,14 @@ function Eo() {
1305
1305
  case "string":
1306
1306
  return t < e ? 1 : e < t ? -1 : 0;
1307
1307
  case "binary":
1308
- return (function(a, o) {
1309
- for (var d = a.length, m = o.length, v = d < m ? d : m, b = 0; b < v; ++b) if (a[b] !== o[b]) return a[b] < o[b] ? -1 : 1;
1308
+ return (function(a, i) {
1309
+ for (var d = a.length, m = i.length, v = d < m ? d : m, b = 0; b < v; ++b) if (a[b] !== i[b]) return a[b] < i[b] ? -1 : 1;
1310
1310
  return d === m ? 0 : d < m ? -1 : 1;
1311
1311
  })(Nr(e), Nr(t));
1312
1312
  case "Array":
1313
- return (function(a, o) {
1314
- for (var d = a.length, m = o.length, v = d < m ? d : m, b = 0; b < v; ++b) {
1315
- var w = se(a[b], o[b]);
1313
+ return (function(a, i) {
1314
+ for (var d = a.length, m = i.length, v = d < m ? d : m, b = 0; b < v; ++b) {
1315
+ var w = se(a[b], i[b]);
1316
1316
  if (w !== 0) return w;
1317
1317
  }
1318
1318
  return d === m ? 0 : d < m ? -1 : 1;
@@ -1331,8 +1331,8 @@ function Eo() {
1331
1331
  }
1332
1332
  function cn(e, t, n) {
1333
1333
  var r = e.schema.yProps;
1334
- return r ? (t && 0 < n.numFailures && (t = t.filter(function(a, o) {
1335
- return !n.failures[o];
1334
+ return r ? (t && 0 < n.numFailures && (t = t.filter(function(a, i) {
1335
+ return !n.failures[i];
1336
1336
  })), Promise.all(r.map(function(a) {
1337
1337
  return a = a.updatesTable, t ? e.db.table(a).where("k").anyOf(t).delete() : e.db.table(a).clear();
1338
1338
  })).then(function() {
@@ -1340,7 +1340,7 @@ function Eo() {
1340
1340
  })) : n;
1341
1341
  }
1342
1342
  var Or = (me.prototype._trans = function(e, t, n) {
1343
- var r = this._tx || Q.trans, a = this.name, o = De && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
1343
+ var r = this._tx || Q.trans, a = this.name, i = De && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
1344
1344
  function d(b, w, g) {
1345
1345
  if (!g.schema[a]) throw new O.NotFound("Table " + a + " not part of transaction");
1346
1346
  return t(g.idbtrans, g);
@@ -1382,7 +1382,7 @@ function Eo() {
1382
1382
  return b(w, g, x, _);
1383
1383
  });
1384
1384
  })(this.db, e, [this.name], d);
1385
- return o && (v._consoleTask = o, v = v.catch(function(b) {
1385
+ return i && (v._consoleTask = i, v = v.catch(function(b) {
1386
1386
  return console.trace(b), be(b);
1387
1387
  })), v;
1388
1388
  } finally {
@@ -1412,8 +1412,8 @@ function Eo() {
1412
1412
  return m.keyPath.length - v.keyPath.length;
1413
1413
  })[0];
1414
1414
  if (n && this.db._maxKey !== gt) {
1415
- var o = n.keyPath.slice(0, t.length);
1416
- return this.where(o).equals(o.map(function(v) {
1415
+ var i = n.keyPath.slice(0, t.length);
1416
+ return this.where(i).equals(i.map(function(v) {
1417
1417
  return e[v];
1418
1418
  }));
1419
1419
  }
@@ -1431,8 +1431,8 @@ function Eo() {
1431
1431
  } : function(_) {
1432
1432
  return a(x, pe(_, v));
1433
1433
  }) : w];
1434
- }, [null, null]), o = d[0], d = d[1];
1435
- return o ? this.where(o.name).equals(e[o.keyPath]).filter(d) : n ? this.filter(d) : this.where(t).equals("");
1434
+ }, [null, null]), i = d[0], d = d[1];
1435
+ return i ? this.where(i.name).equals(e[i.keyPath]).filter(d) : n ? this.filter(d) : this.where(t).equals("");
1436
1436
  }, me.prototype.filter = function(e) {
1437
1437
  return this.toCollection().and(e);
1438
1438
  }, me.prototype.count = function(e) {
@@ -1467,13 +1467,13 @@ function Eo() {
1467
1467
  }, enumerable: !1, configurable: !0 }), a.prototype.table = function() {
1468
1468
  return r;
1469
1469
  }, e = a);
1470
- for (var o = /* @__PURE__ */ new Set(), d = e.prototype; d; d = P(d)) Object.getOwnPropertyNames(d).forEach(function(v) {
1471
- return o.add(v);
1470
+ for (var i = /* @__PURE__ */ new Set(), d = e.prototype; d; d = P(d)) Object.getOwnPropertyNames(d).forEach(function(v) {
1471
+ return i.add(v);
1472
1472
  });
1473
1473
  function m(v) {
1474
1474
  if (!v) return v;
1475
1475
  var b, w = Object.create(e.prototype);
1476
- for (b in v) if (!o.has(b)) try {
1476
+ for (b in v) if (!i.has(b)) try {
1477
1477
  w[b] = v[b];
1478
1478
  } catch {
1479
1479
  }
@@ -1485,14 +1485,14 @@ function Eo() {
1485
1485
  R(this, e);
1486
1486
  });
1487
1487
  }, me.prototype.add = function(e, t) {
1488
- var n = this, r = this.schema.primKey, a = r.auto, o = r.keyPath, d = e;
1489
- return o && a && (d = un(o)(e)), this._trans("readwrite", function(m) {
1488
+ var n = this, r = this.schema.primKey, a = r.auto, i = r.keyPath, d = e;
1489
+ return i && a && (d = un(i)(e)), this._trans("readwrite", function(m) {
1490
1490
  return n.core.mutate({ trans: m, type: "add", keys: t != null ? [t] : null, values: [d] });
1491
1491
  }).then(function(m) {
1492
1492
  return m.numFailures ? G.reject(m.failures[0]) : m.lastResult;
1493
1493
  }).then(function(m) {
1494
- if (o) try {
1495
- ae(e, o, m);
1494
+ if (i) try {
1495
+ ae(e, i, m);
1496
1496
  } catch {
1497
1497
  }
1498
1498
  return m;
@@ -1500,14 +1500,14 @@ function Eo() {
1500
1500
  }, me.prototype.update = function(e, t) {
1501
1501
  return typeof e != "object" || C(e) ? this.where(":id").equals(e).modify(t) : (e = pe(e, this.schema.primKey.keyPath), e === void 0 ? be(new O.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
1502
1502
  }, me.prototype.put = function(e, t) {
1503
- var n = this, r = this.schema.primKey, a = r.auto, o = r.keyPath, d = e;
1504
- return o && a && (d = un(o)(e)), this._trans("readwrite", function(m) {
1503
+ var n = this, r = this.schema.primKey, a = r.auto, i = r.keyPath, d = e;
1504
+ return i && a && (d = un(i)(e)), this._trans("readwrite", function(m) {
1505
1505
  return n.core.mutate({ trans: m, type: "put", values: [d], keys: t != null ? [t] : null });
1506
1506
  }).then(function(m) {
1507
1507
  return m.numFailures ? G.reject(m.failures[0]) : m.lastResult;
1508
1508
  }).then(function(m) {
1509
- if (o) try {
1510
- ae(e, o, m);
1509
+ if (i) try {
1510
+ ae(e, i, m);
1511
1511
  } catch {
1512
1512
  }
1513
1513
  return m;
@@ -1540,28 +1540,28 @@ function Eo() {
1540
1540
  });
1541
1541
  });
1542
1542
  }, me.prototype.bulkAdd = function(e, t, n) {
1543
- var r = this, a = Array.isArray(t) ? t : void 0, o = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
1543
+ var r = this, a = Array.isArray(t) ? t : void 0, i = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
1544
1544
  return this._trans("readwrite", function(d) {
1545
1545
  var b = r.schema.primKey, m = b.auto, b = b.keyPath;
1546
1546
  if (b && a) throw new O.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
1547
1547
  if (a && a.length !== e.length) throw new O.InvalidArgument("Arguments objects and keys must have the same length");
1548
1548
  var v = e.length, b = b && m ? e.map(un(b)) : e;
1549
- return r.core.mutate({ trans: d, type: "add", keys: a, values: b, wantResults: o }).then(function(A) {
1549
+ return r.core.mutate({ trans: d, type: "add", keys: a, values: b, wantResults: i }).then(function(A) {
1550
1550
  var g = A.numFailures, x = A.results, _ = A.lastResult, A = A.failures;
1551
- if (g === 0) return o ? x : _;
1551
+ if (g === 0) return i ? x : _;
1552
1552
  throw new Ze("".concat(r.name, ".bulkAdd(): ").concat(g, " of ").concat(v, " operations failed"), A);
1553
1553
  });
1554
1554
  });
1555
1555
  }, me.prototype.bulkPut = function(e, t, n) {
1556
- var r = this, a = Array.isArray(t) ? t : void 0, o = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
1556
+ var r = this, a = Array.isArray(t) ? t : void 0, i = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
1557
1557
  return this._trans("readwrite", function(d) {
1558
1558
  var b = r.schema.primKey, m = b.auto, b = b.keyPath;
1559
1559
  if (b && a) throw new O.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
1560
1560
  if (a && a.length !== e.length) throw new O.InvalidArgument("Arguments objects and keys must have the same length");
1561
1561
  var v = e.length, b = b && m ? e.map(un(b)) : e;
1562
- return r.core.mutate({ trans: d, type: "put", keys: a, values: b, wantResults: o }).then(function(A) {
1562
+ return r.core.mutate({ trans: d, type: "put", keys: a, values: b, wantResults: i }).then(function(A) {
1563
1563
  var g = A.numFailures, x = A.results, _ = A.lastResult, A = A.failures;
1564
- if (g === 0) return o ? x : _;
1564
+ if (g === 0) return i ? x : _;
1565
1565
  throw new Ze("".concat(r.name, ".bulkPut(): ").concat(g, " of ").concat(v, " operations failed"), A);
1566
1566
  });
1567
1567
  });
@@ -1570,7 +1570,7 @@ function Eo() {
1570
1570
  return d.key;
1571
1571
  }), a = e.map(function(d) {
1572
1572
  return d.changes;
1573
- }), o = [];
1573
+ }), i = [];
1574
1574
  return this._trans("readwrite", function(d) {
1575
1575
  return n.getMany({ trans: d, keys: r, cache: "clone" }).then(function(m) {
1576
1576
  var v = [], b = [];
@@ -1583,7 +1583,7 @@ function Eo() {
1583
1583
  if (se(S, _) !== 0) throw new O.Constraint("Cannot update primary key in bulkUpdate()");
1584
1584
  } else ae(T, D, S);
1585
1585
  }
1586
- o.push(x), v.push(_), b.push(T);
1586
+ i.push(x), v.push(_), b.push(T);
1587
1587
  }
1588
1588
  });
1589
1589
  var w = v.length;
@@ -1591,7 +1591,7 @@ function Eo() {
1591
1591
  var x = g.numFailures, _ = g.failures;
1592
1592
  if (x === 0) return w;
1593
1593
  for (var A = 0, T = Object.keys(_); A < T.length; A++) {
1594
- var E, N = T[A], D = o[Number(N)];
1594
+ var E, N = T[A], D = i[Number(N)];
1595
1595
  D != null && (E = _[N], delete _[N], _[D] = E);
1596
1596
  }
1597
1597
  throw new Ze("".concat(t.name, ".bulkUpdate(): ").concat(x, " of ").concat(w, " operations failed"), _);
@@ -1605,8 +1605,8 @@ function Eo() {
1605
1605
  return cn(t, e, a);
1606
1606
  });
1607
1607
  }).then(function(d) {
1608
- var a = d.numFailures, o = d.lastResult, d = d.failures;
1609
- if (a === 0) return o;
1608
+ var a = d.numFailures, i = d.lastResult, d = d.failures;
1609
+ if (a === 0) return i;
1610
1610
  throw new Ze("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), d);
1611
1611
  });
1612
1612
  }, me);
@@ -1621,10 +1621,10 @@ function Eo() {
1621
1621
  if (typeof d == "string") return n[d];
1622
1622
  }
1623
1623
  var n = {};
1624
- t.addEventType = o;
1625
- for (var r = 1, a = arguments.length; r < a; ++r) o(arguments[r]);
1624
+ t.addEventType = i;
1625
+ for (var r = 1, a = arguments.length; r < a; ++r) i(arguments[r]);
1626
1626
  return t;
1627
- function o(d, m, v) {
1627
+ function i(d, m, v) {
1628
1628
  if (typeof d != "object") {
1629
1629
  var b;
1630
1630
  m = m || In;
@@ -1639,10 +1639,10 @@ function Eo() {
1639
1639
  }
1640
1640
  y(b = d).forEach(function(g) {
1641
1641
  var x = b[g];
1642
- if (C(x)) o(g, b[g][0], b[g][1]);
1642
+ if (C(x)) i(g, b[g][0], b[g][1]);
1643
1643
  else {
1644
1644
  if (x !== "asap") throw new O.InvalidArgument("Invalid event config");
1645
- var _ = o(g, he, function() {
1645
+ var _ = i(g, he, function() {
1646
1646
  for (var A = arguments.length, T = new Array(A); A--; ) T[A] = arguments[A];
1647
1647
  _.subscribers.forEach(function(E) {
1648
1648
  oe(function() {
@@ -1682,34 +1682,34 @@ function Eo() {
1682
1682
  function fn(e, t, n, r) {
1683
1683
  var a = e.replayFilter ? yt(e.filter, e.replayFilter()) : e.filter;
1684
1684
  if (e.or) {
1685
- var o = {}, d = function(m, v, b) {
1685
+ var i = {}, d = function(m, v, b) {
1686
1686
  var w, g;
1687
1687
  a && !a(v, b, function(x) {
1688
1688
  return v.stop(x);
1689
1689
  }, function(x) {
1690
1690
  return v.fail(x);
1691
- }) || ((g = "" + (w = v.primaryKey)) == "[object ArrayBuffer]" && (g = "" + new Uint8Array(w)), Y(o, g) || (o[g] = !0, t(m, v, b)));
1691
+ }) || ((g = "" + (w = v.primaryKey)) == "[object ArrayBuffer]" && (g = "" + new Uint8Array(w)), Y(i, g) || (i[g] = !0, t(m, v, b)));
1692
1692
  };
1693
1693
  return Promise.all([e.or._iterate(d, n), Ir(Rr(e, r, n), e.algorithm, d, !e.keysOnly && e.valueMapper)]);
1694
1694
  }
1695
1695
  return Ir(Rr(e, r, n), yt(e.algorithm, a), t, !e.keysOnly && e.valueMapper);
1696
1696
  }
1697
1697
  function Ir(e, t, n, r) {
1698
- var a = ge(r ? function(o, d, m) {
1699
- return n(r(o), d, m);
1698
+ var a = ge(r ? function(i, d, m) {
1699
+ return n(r(i), d, m);
1700
1700
  } : n);
1701
- return e.then(function(o) {
1702
- if (o) return o.start(function() {
1701
+ return e.then(function(i) {
1702
+ if (i) return i.start(function() {
1703
1703
  var d = function() {
1704
- return o.continue();
1704
+ return i.continue();
1705
1705
  };
1706
- t && !t(o, function(m) {
1706
+ t && !t(i, function(m) {
1707
1707
  return d = m;
1708
1708
  }, function(m) {
1709
- o.stop(m), d = Z;
1709
+ i.stop(m), d = Z;
1710
1710
  }, function(m) {
1711
- o.fail(m), d = Z;
1712
- }) || a(o.value, o, function(m) {
1711
+ i.fail(m), d = Z;
1712
+ }) || a(i.value, i, function(m) {
1713
1713
  return d = m;
1714
1714
  }), d();
1715
1715
  });
@@ -1774,21 +1774,21 @@ function Eo() {
1774
1774
  if (Nt(r, !0)) return a.count({ trans: n, query: { index: ln(r, a.schema), range: r.range } }).then(function(d) {
1775
1775
  return Math.min(d, r.limit);
1776
1776
  });
1777
- var o = 0;
1777
+ var i = 0;
1778
1778
  return fn(r, function() {
1779
- return ++o, !1;
1779
+ return ++i, !1;
1780
1780
  }, n, a).then(function() {
1781
- return o;
1781
+ return i;
1782
1782
  });
1783
1783
  }).then(e);
1784
1784
  }, le.prototype.sortBy = function(e, t) {
1785
1785
  var n = e.split(".").reverse(), r = n[0], a = n.length - 1;
1786
- function o(v, b) {
1787
- return b ? o(v[n[b]], b - 1) : v[r];
1786
+ function i(v, b) {
1787
+ return b ? i(v[n[b]], b - 1) : v[r];
1788
1788
  }
1789
1789
  var d = this._ctx.dir === "next" ? 1 : -1;
1790
1790
  function m(v, b) {
1791
- return se(o(v, a), o(b, a)) * d;
1791
+ return se(i(v, a), i(b, a)) * d;
1792
1792
  }
1793
1793
  return this.toArray(function(v) {
1794
1794
  return v.sort(m);
@@ -1798,8 +1798,8 @@ function Eo() {
1798
1798
  return this._read(function(n) {
1799
1799
  var r = t._ctx;
1800
1800
  if (r.dir === "next" && Nt(r, !0) && 0 < r.limit) {
1801
- var a = r.valueMapper, o = ln(r, r.table.core.schema);
1802
- return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index: o, range: r.range } }).then(function(m) {
1801
+ var a = r.valueMapper, i = ln(r, r.table.core.schema);
1802
+ return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index: i, range: r.range } }).then(function(m) {
1803
1803
  return m = m.result, a ? m.map(a) : m;
1804
1804
  });
1805
1805
  }
@@ -1910,9 +1910,9 @@ function Eo() {
1910
1910
  }, le.prototype.modify = function(e) {
1911
1911
  var t = this, n = this._ctx;
1912
1912
  return this._write(function(r) {
1913
- var a, o, d;
1914
- d = typeof e == "function" ? e : (a = y(e), o = a.length, function(N) {
1915
- for (var D = !1, S = 0; S < o; ++S) {
1913
+ var a, i, d;
1914
+ d = typeof e == "function" ? e : (a = y(e), i = a.length, function(N) {
1915
+ for (var D = !1, S = 0; S < i; ++S) {
1916
1916
  var k = a[S], j = e[k], L = pe(N, k);
1917
1917
  j instanceof Ut ? (ae(N, k, j.execute(L)), D = !0) : L !== j && (ae(N, k, j), D = !0);
1918
1918
  }
@@ -1967,13 +1967,13 @@ function Eo() {
1967
1967
  var e = this._ctx, t = e.range;
1968
1968
  return !Nt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Pr) : this._write(function(n) {
1969
1969
  var r = e.table.core.schema.primaryKey, a = t;
1970
- return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(o) {
1970
+ return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(i) {
1971
1971
  return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(v) {
1972
1972
  var m = v.failures, v = v.numFailures;
1973
1973
  if (v) throw new He("Could not delete some values", Object.keys(m).map(function(b) {
1974
1974
  return m[b];
1975
- }), o - v);
1976
- return o - v;
1975
+ }), i - v);
1976
+ return i - v;
1977
1977
  });
1978
1978
  });
1979
1979
  });
@@ -1998,7 +1998,7 @@ function Eo() {
1998
1998
  }).limit(0);
1999
1999
  }
2000
2000
  function dn(e, t, n, r) {
2001
- var a, o, d, m, v, b, w, g = n.length;
2001
+ var a, i, d, m, v, b, w, g = n.length;
2002
2002
  if (!n.every(function(A) {
2003
2003
  return typeof A == "string";
2004
2004
  })) return Fe(e, Br);
@@ -2007,13 +2007,13 @@ function Eo() {
2007
2007
  return E.toUpperCase();
2008
2008
  } : function(E) {
2009
2009
  return E.toLowerCase();
2010
- }, o = A === "next" ? function(E) {
2010
+ }, i = A === "next" ? function(E) {
2011
2011
  return E.toLowerCase();
2012
2012
  } : function(E) {
2013
2013
  return E.toUpperCase();
2014
2014
  }, d = A === "next" ? ka : Fa;
2015
2015
  var T = n.map(function(E) {
2016
- return { lower: o(E), upper: a(E) };
2016
+ return { lower: i(E), upper: a(E) };
2017
2017
  }).sort(function(E, N) {
2018
2018
  return d(E.lower, N.lower);
2019
2019
  });
@@ -2032,7 +2032,7 @@ function Eo() {
2032
2032
  return e._addAlgorithm(function(A, T, E) {
2033
2033
  var N = A.key;
2034
2034
  if (typeof N != "string") return !1;
2035
- var D = o(N);
2035
+ var D = i(N);
2036
2036
  if (t(D, v, _)) return !0;
2037
2037
  for (var S = null, k = _; k < g; ++k) {
2038
2038
  var j = (function(L, K, q, V, $, X) {
@@ -2120,14 +2120,14 @@ function Eo() {
2120
2120
  var r = new this.Collection(this, function() {
2121
2121
  return at(t[0], t[t.length - 1]);
2122
2122
  });
2123
- r._ondirectionchange = function(o) {
2124
- n = o === "next" ? e._ascending : e._descending, t.sort(n);
2123
+ r._ondirectionchange = function(i) {
2124
+ n = i === "next" ? e._ascending : e._descending, t.sort(n);
2125
2125
  };
2126
2126
  var a = 0;
2127
- return r._addAlgorithm(function(o, d, m) {
2128
- for (var v = o.key; 0 < n(v, t[a]); ) if (++a === t.length) return d(m), !1;
2127
+ return r._addAlgorithm(function(i, d, m) {
2128
+ for (var v = i.key; 0 < n(v, t[a]); ) if (++a === t.length) return d(m), !1;
2129
2129
  return n(v, t[a]) === 0 || (d(function() {
2130
- o.continue(t[a]);
2130
+ i.continue(t[a]);
2131
2131
  }), !1);
2132
2132
  }), r;
2133
2133
  }, Be.prototype.notEqual = function(e) {
@@ -2145,7 +2145,7 @@ function Eo() {
2145
2145
  }, null);
2146
2146
  return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, { includeLowers: !1, includeUppers: !1 });
2147
2147
  }, Be.prototype.inAnyRange = function(N, t) {
2148
- var n = this, r = this._cmp, a = this._ascending, o = this._descending, d = this._min, m = this._max;
2148
+ var n = this, r = this._cmp, a = this._ascending, i = this._descending, d = this._min, m = this._max;
2149
2149
  if (N.length === 0) return Ot(this);
2150
2150
  if (!N.every(function(D) {
2151
2151
  return D[0] !== void 0 && D[1] !== void 0 && a(D[0], D[1]) <= 0;
@@ -2173,14 +2173,14 @@ function Eo() {
2173
2173
  } : function(D) {
2174
2174
  return 0 <= a(D, w[_][1]);
2175
2175
  }, T = v ? function(D) {
2176
- return 0 < o(D, w[_][0]);
2176
+ return 0 < i(D, w[_][0]);
2177
2177
  } : function(D) {
2178
- return 0 <= o(D, w[_][0]);
2178
+ return 0 <= i(D, w[_][0]);
2179
2179
  }, E = A, N = new this.Collection(this, function() {
2180
2180
  return at(w[0][0], w[w.length - 1][1], !v, !b);
2181
2181
  });
2182
2182
  return N._ondirectionchange = function(D) {
2183
- g = D === "next" ? (E = A, a) : (E = T, o), w.sort(x);
2183
+ g = D === "next" ? (E = A, a) : (E = T, i), w.sort(x);
2184
2184
  }, N._addAlgorithm(function(D, S, k) {
2185
2185
  for (var j, L = D.key; E(L); ) if (++_ === w.length) return S(k), !1;
2186
2186
  return !A(j = L) && !T(j) || (n._cmp(L, w[_][1]) === 0 || n._cmp(L, w[_][0]) === 0 || S(function() {
@@ -2242,24 +2242,24 @@ function Eo() {
2242
2242
  var r = this;
2243
2243
  if (e === "readwrite" && this.mode !== "readwrite") return be(new O.ReadOnly("Transaction is readonly"));
2244
2244
  if (!this.active) return be(new O.TransactionInactive());
2245
- if (this._locked()) return new G(function(o, d) {
2245
+ if (this._locked()) return new G(function(i, d) {
2246
2246
  r._blockedFuncs.push([function() {
2247
- r._promise(e, t, n).then(o, d);
2247
+ r._promise(e, t, n).then(i, d);
2248
2248
  }, Q]);
2249
2249
  });
2250
2250
  if (n) return tt(function() {
2251
- var o = new G(function(d, m) {
2251
+ var i = new G(function(d, m) {
2252
2252
  r._lock();
2253
2253
  var v = t(d, m, r);
2254
2254
  v && v.then && v.then(d, m);
2255
2255
  });
2256
- return o.finally(function() {
2256
+ return i.finally(function() {
2257
2257
  return r._unlock();
2258
- }), o._lib = !0, o;
2258
+ }), i._lib = !0, i;
2259
2259
  });
2260
- var a = new G(function(o, d) {
2261
- var m = t(o, d, r);
2262
- m && m.then && m.then(o, d);
2260
+ var a = new G(function(i, d) {
2261
+ var m = t(i, d, r);
2262
+ m && m.then && m.then(i, d);
2263
2263
  });
2264
2264
  return a._lib = !0, a;
2265
2265
  }, $e.prototype._root = function() {
@@ -2268,14 +2268,14 @@ function Eo() {
2268
2268
  var t, n = this._root(), r = G.resolve(e);
2269
2269
  n._waitingFor ? n._waitingFor = n._waitingFor.then(function() {
2270
2270
  return r;
2271
- }) : (n._waitingFor = r, n._waitingQueue = [], t = n.idbtrans.objectStore(n.storeNames[0]), (function o() {
2271
+ }) : (n._waitingFor = r, n._waitingQueue = [], t = n.idbtrans.objectStore(n.storeNames[0]), (function i() {
2272
2272
  for (++n._spinCount; n._waitingQueue.length; ) n._waitingQueue.shift()();
2273
- n._waitingFor && (t.get(-1 / 0).onsuccess = o);
2273
+ n._waitingFor && (t.get(-1 / 0).onsuccess = i);
2274
2274
  })());
2275
2275
  var a = n._waitingFor;
2276
- return new G(function(o, d) {
2276
+ return new G(function(i, d) {
2277
2277
  r.then(function(m) {
2278
- return n._waitingQueue.push(ge(o.bind(null, m)));
2278
+ return n._waitingQueue.push(ge(i.bind(null, m)));
2279
2279
  }, function(m) {
2280
2280
  return n._waitingQueue.push(ge(d.bind(null, m)));
2281
2281
  }).finally(function() {
@@ -2293,8 +2293,8 @@ function Eo() {
2293
2293
  }, $e);
2294
2294
  function $e() {
2295
2295
  }
2296
- function Gn(e, t, n, r, a, o, d, m) {
2297
- return { name: e, keyPath: t, unique: n, multi: r, auto: a, compound: o, src: (n && !d ? "&" : "") + (r ? "*" : "") + (a ? "++" : "") + Fr(t), type: m };
2296
+ function Gn(e, t, n, r, a, i, d, m) {
2297
+ return { name: e, keyPath: t, unique: n, multi: r, auto: a, compound: i, src: (n && !d ? "&" : "") + (r ? "*" : "") + (a ? "++" : "") + Fr(t), type: m };
2298
2298
  }
2299
2299
  function Fr(e) {
2300
2300
  return typeof e == "string" ? e : e ? "[" + [].join.call(e, "+") + "]" : "";
@@ -2302,8 +2302,8 @@ function Eo() {
2302
2302
  function Xn(e, t, n) {
2303
2303
  return { name: e, primKey: t, indexes: n, mappedClass: null, idxByName: (r = function(a) {
2304
2304
  return [a.name, a];
2305
- }, n.reduce(function(a, o, d) {
2306
- return d = r(o, d), d && (a[d[0]] = d[1]), a;
2305
+ }, n.reduce(function(a, i, d) {
2306
+ return d = r(i, d), d && (a[d[0]] = d[1]), a;
2307
2307
  }, {})) };
2308
2308
  var r;
2309
2309
  }
@@ -2457,7 +2457,7 @@ function Eo() {
2457
2457
  });
2458
2458
  } };
2459
2459
  }
2460
- var o, d, m, w = (d = v, m = Mr((o = e).objectStoreNames), { schema: { name: o.name, tables: m.map(function(x) {
2460
+ var i, d, m, w = (d = v, m = Mr((i = e).objectStoreNames), { schema: { name: i.name, tables: m.map(function(x) {
2461
2461
  return d.objectStore(x);
2462
2462
  }).map(function(x) {
2463
2463
  var _ = x.keyPath, E = x.autoIncrement, A = C(_), T = {}, E = { name: x.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: _ == null, compound: A, keyPath: _, autoIncrement: E, unique: !0, extractKey: Yn(_) }, indexes: Mr(x.indexNames).map(function(N) {
@@ -2479,22 +2479,22 @@ function Eo() {
2479
2479
  }
2480
2480
  function qa(e, t, n, r) {
2481
2481
  var a = n.IDBKeyRange;
2482
- return n.indexedDB, { dbcore: (r = Ka(t, a, r), e.dbcore.reduce(function(o, d) {
2483
- return d = d.create, i(i({}, o), d(o));
2482
+ return n.indexedDB, { dbcore: (r = Ka(t, a, r), e.dbcore.reduce(function(i, d) {
2483
+ return d = d.create, o(o({}, i), d(i));
2484
2484
  }, r)) };
2485
2485
  }
2486
2486
  function hn(e, r) {
2487
2487
  var n = r.db, r = qa(e._middlewares, n, e._deps, r);
2488
2488
  e.core = r.dbcore, e.tables.forEach(function(a) {
2489
- var o = a.name;
2489
+ var i = a.name;
2490
2490
  e.core.schema.tables.some(function(d) {
2491
- return d.name === o;
2492
- }) && (a.core = e.core.table(o), e[o] instanceof e.Table && (e[o].core = a.core));
2491
+ return d.name === i;
2492
+ }) && (a.core = e.core.table(i), e[i] instanceof e.Table && (e[i].core = a.core));
2493
2493
  });
2494
2494
  }
2495
2495
  function mn(e, t, n, r) {
2496
2496
  n.forEach(function(a) {
2497
- var o = r[a];
2497
+ var i = r[a];
2498
2498
  t.forEach(function(d) {
2499
2499
  var m = (function v(b, w) {
2500
2500
  return J(b, w) || (b = P(b)) && v(b, w);
@@ -2503,7 +2503,7 @@ function Eo() {
2503
2503
  return this.table(a);
2504
2504
  }, set: function(v) {
2505
2505
  H(this, a, { value: v, writable: !0, configurable: !0, enumerable: !0 });
2506
- } }) : d[a] = new e.Table(a, o));
2506
+ } }) : d[a] = new e.Table(a, i));
2507
2507
  });
2508
2508
  });
2509
2509
  }
@@ -2518,14 +2518,14 @@ function Eo() {
2518
2518
  function Ua(e, t, n, r) {
2519
2519
  var a = e._dbSchema;
2520
2520
  n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Xn("$meta", Kr("")[0], []), e._storeNames.push("$meta"));
2521
- var o = e._createTransaction("readwrite", e._storeNames, a);
2522
- o.create(n), o._completion.catch(r);
2523
- var d = o._reject.bind(o), m = Q.transless || Q;
2521
+ var i = e._createTransaction("readwrite", e._storeNames, a);
2522
+ i.create(n), i._completion.catch(r);
2523
+ var d = i._reject.bind(i), m = Q.transless || Q;
2524
2524
  tt(function() {
2525
- return Q.trans = o, Q.transless = m, t !== 0 ? (hn(e, n), b = t, ((v = o).storeNames.includes("$meta") ? v.table("$meta").get("version").then(function(w) {
2525
+ return Q.trans = i, Q.transless = m, t !== 0 ? (hn(e, n), b = t, ((v = i).storeNames.includes("$meta") ? v.table("$meta").get("version").then(function(w) {
2526
2526
  return w ?? b;
2527
2527
  }) : G.resolve(b)).then(function(w) {
2528
- return x = w, _ = o, A = n, T = [], w = (g = e)._versions, E = g._dbSchema = gn(0, g.idbdb, A), (w = w.filter(function(N) {
2528
+ return x = w, _ = i, A = n, T = [], w = (g = e)._versions, E = g._dbSchema = gn(0, g.idbdb, A), (w = w.filter(function(N) {
2529
2529
  return N._cfg.version >= x;
2530
2530
  })).length !== 0 ? (w.forEach(function(N) {
2531
2531
  T.push(function() {
@@ -2579,7 +2579,7 @@ function Eo() {
2579
2579
  }).catch(d)) : (y(a).forEach(function(w) {
2580
2580
  Qn(n, w, a[w].primKey, a[w].indexes);
2581
2581
  }), hn(e, n), void G.follow(function() {
2582
- return e.on.populate.fire(o);
2582
+ return e.on.populate.fire(i);
2583
2583
  }).catch(d));
2584
2584
  var v, b;
2585
2585
  });
@@ -2589,26 +2589,26 @@ function Eo() {
2589
2589
  var n = gn(0, e.idbdb, t);
2590
2590
  yn(e, e._dbSchema, t);
2591
2591
  for (var r = 0, a = zn(n, e._dbSchema).change; r < a.length; r++) {
2592
- var o = (function(d) {
2592
+ var i = (function(d) {
2593
2593
  if (d.change.length || d.recreate) return console.warn("Unable to patch indexes of table ".concat(d.name, " because it has changes on the type of index or primary key.")), { value: void 0 };
2594
2594
  var m = t.objectStore(d.name);
2595
2595
  d.add.forEach(function(v) {
2596
2596
  De && console.debug("Dexie upgrade patch: Creating missing index ".concat(d.name, ".").concat(v.src)), pn(m, v);
2597
2597
  });
2598
2598
  })(a[r]);
2599
- if (typeof o == "object") return o.value;
2599
+ if (typeof i == "object") return i.value;
2600
2600
  }
2601
2601
  }
2602
2602
  function zn(e, t) {
2603
2603
  var n, r = { del: [], add: [], change: [] };
2604
2604
  for (n in e) t[n] || r.del.push(n);
2605
2605
  for (n in t) {
2606
- var a = e[n], o = t[n];
2606
+ var a = e[n], i = t[n];
2607
2607
  if (a) {
2608
- var d = { name: n, def: o, recreate: !1, del: [], add: [], change: [] };
2609
- if ("" + (a.primKey.keyPath || "") != "" + (o.primKey.keyPath || "") || a.primKey.auto !== o.primKey.auto) d.recreate = !0, r.change.push(d);
2608
+ var d = { name: n, def: i, recreate: !1, del: [], add: [], change: [] };
2609
+ if ("" + (a.primKey.keyPath || "") != "" + (i.primKey.keyPath || "") || a.primKey.auto !== i.primKey.auto) d.recreate = !0, r.change.push(d);
2610
2610
  else {
2611
- var m = a.idxByName, v = o.idxByName, b = void 0;
2611
+ var m = a.idxByName, v = i.idxByName, b = void 0;
2612
2612
  for (b in m) v[b] || d.del.push(b);
2613
2613
  for (b in v) {
2614
2614
  var w = m[b], g = v[b];
@@ -2616,14 +2616,14 @@ function Eo() {
2616
2616
  }
2617
2617
  (0 < d.del.length || 0 < d.add.length || 0 < d.change.length) && r.change.push(d);
2618
2618
  }
2619
- } else r.add.push([n, o]);
2619
+ } else r.add.push([n, i]);
2620
2620
  }
2621
2621
  return r;
2622
2622
  }
2623
2623
  function Qn(e, t, n, r) {
2624
2624
  var a = e.db.createObjectStore(t, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
2625
- return r.forEach(function(o) {
2626
- return pn(a, o);
2625
+ return r.forEach(function(i) {
2626
+ return pn(a, i);
2627
2627
  }), a;
2628
2628
  }
2629
2629
  function jr(e, t) {
@@ -2637,8 +2637,8 @@ function Eo() {
2637
2637
  function gn(e, t, n) {
2638
2638
  var r = {};
2639
2639
  return ye(t.objectStoreNames, 0).forEach(function(a) {
2640
- for (var o = n.objectStore(a), d = Gn(Fr(b = o.keyPath), b || "", !0, !1, !!o.autoIncrement, b && typeof b != "string", !0), m = [], v = 0; v < o.indexNames.length; ++v) {
2641
- var w = o.index(o.indexNames[v]), b = w.keyPath, w = Gn(w.name, b, !!w.unique, !!w.multiEntry, !1, b && typeof b != "string", !1);
2640
+ for (var i = n.objectStore(a), d = Gn(Fr(b = i.keyPath), b || "", !0, !1, !!i.autoIncrement, b && typeof b != "string", !0), m = [], v = 0; v < i.indexNames.length; ++v) {
2641
+ var w = i.index(i.indexNames[v]), b = w.keyPath, w = Gn(w.name, b, !!w.unique, !!w.multiEntry, !1, b && typeof b != "string", !1);
2642
2642
  m.push(w);
2643
2643
  }
2644
2644
  r[a] = Xn(a, d, m);
@@ -2646,40 +2646,40 @@ function Eo() {
2646
2646
  }
2647
2647
  function yn(e, t, n) {
2648
2648
  for (var r = n.db.objectStoreNames, a = 0; a < r.length; ++a) {
2649
- var o = r[a], d = n.objectStore(o);
2649
+ var i = r[a], d = n.objectStore(i);
2650
2650
  e._hasGetAll = "getAll" in d;
2651
2651
  for (var m = 0; m < d.indexNames.length; ++m) {
2652
2652
  var v = d.indexNames[m], b = d.index(v).keyPath, w = typeof b == "string" ? b : "[" + ye(b).join("+") + "]";
2653
- !t[o] || (b = t[o].idxByName[w]) && (b.name = v, delete t[o].idxByName[w], t[o].idxByName[v] = b);
2653
+ !t[i] || (b = t[i].idxByName[w]) && (b.name = v, delete t[i].idxByName[w], t[i].idxByName[v] = b);
2654
2654
  }
2655
2655
  }
2656
2656
  typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && p.WorkerGlobalScope && p instanceof p.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
2657
2657
  }
2658
2658
  function Kr(e) {
2659
2659
  return e.split(",").map(function(t, n) {
2660
- var o = t.split(":"), r = (a = o[1]) === null || a === void 0 ? void 0 : a.trim(), a = (t = o[0].trim()).replace(/([&*]|\+\+)/g, ""), o = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
2661
- return Gn(a, o || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), C(o), n === 0, r);
2660
+ var i = t.split(":"), r = (a = i[1]) === null || a === void 0 ? void 0 : a.trim(), a = (t = i[0].trim()).replace(/([&*]|\+\+)/g, ""), i = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
2661
+ return Gn(a, i || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), C(i), n === 0, r);
2662
2662
  });
2663
2663
  }
2664
2664
  var Va = (Rt.prototype._createTableSchema = Xn, Rt.prototype._parseIndexSyntax = Kr, Rt.prototype._parseStoresSpec = function(e, t) {
2665
2665
  var n = this;
2666
2666
  y(e).forEach(function(r) {
2667
2667
  if (e[r] !== null) {
2668
- var a = n._parseIndexSyntax(e[r]), o = a.shift();
2669
- if (!o) throw new O.Schema("Invalid schema for table " + r + ": " + e[r]);
2670
- if (o.unique = !0, o.multi) throw new O.Schema("Primary key cannot be multiEntry*");
2668
+ var a = n._parseIndexSyntax(e[r]), i = a.shift();
2669
+ if (!i) throw new O.Schema("Invalid schema for table " + r + ": " + e[r]);
2670
+ if (i.unique = !0, i.multi) throw new O.Schema("Primary key cannot be multiEntry*");
2671
2671
  a.forEach(function(d) {
2672
2672
  if (d.auto) throw new O.Schema("Only primary key can be marked as autoIncrement (++)");
2673
2673
  if (!d.keyPath) throw new O.Schema("Index must have a name and cannot be an empty string");
2674
- }), a = n._createTableSchema(r, o, a), t[r] = a;
2674
+ }), a = n._createTableSchema(r, i, a), t[r] = a;
2675
2675
  }
2676
2676
  });
2677
2677
  }, Rt.prototype.stores = function(n) {
2678
2678
  var t = this.db;
2679
2679
  this._cfg.storesSource = this._cfg.storesSource ? R(this._cfg.storesSource, n) : n;
2680
2680
  var n = t._versions, r = {}, a = {};
2681
- return n.forEach(function(o) {
2682
- R(r, o._cfg.storesSource), a = o._cfg.dbschema = {}, o._parseStoresSpec(r, a);
2681
+ return n.forEach(function(i) {
2682
+ R(r, i._cfg.storesSource), a = i._cfg.dbschema = {}, i._parseStoresSpec(r, a);
2683
2683
  }), t._dbSchema = a, Wn(t, [t._allTables, t, t.Transaction.prototype]), mn(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], y(a), a), t._storeNames = y(a), this;
2684
2684
  }, Rt.prototype.upgrade = function(e) {
2685
2685
  return this._cfg.contentUpgrade = wt(this._cfg.contentUpgrade || Z, e), this;
@@ -2721,16 +2721,16 @@ function Eo() {
2721
2721
  }
2722
2722
  function Wt(e, t) {
2723
2723
  er(t) || (function n(r, v) {
2724
- var o = v.from, d = v.to, m = v.l, v = v.r;
2725
- Yt(r, o, d), m && n(r, m), v && n(r, v);
2724
+ var i = v.from, d = v.to, m = v.l, v = v.r;
2725
+ Yt(r, i, d), m && n(r, m), v && n(r, v);
2726
2726
  })(e, t);
2727
2727
  }
2728
2728
  function qr(e, t) {
2729
2729
  var n = vn(t), r = n.next();
2730
2730
  if (r.done) return !1;
2731
- for (var a = r.value, o = vn(e), d = o.next(a.from), m = d.value; !r.done && !d.done; ) {
2731
+ for (var a = r.value, i = vn(e), d = i.next(a.from), m = d.value; !r.done && !d.done; ) {
2732
2732
  if (se(m.from, a.to) <= 0 && 0 <= se(m.to, a.from)) return !0;
2733
- se(a.from, m.from) < 0 ? a = (r = n.next(m.from)).value : m = (d = o.next(a.from)).value;
2733
+ se(a.from, m.from) < 0 ? a = (r = n.next(m.from)).value : m = (d = i.next(a.from)).value;
2734
2734
  }
2735
2735
  return !1;
2736
2736
  }
@@ -2756,7 +2756,7 @@ function Eo() {
2756
2756
  }
2757
2757
  function Lr(e) {
2758
2758
  var t, n, r = (((t = e.r) === null || t === void 0 ? void 0 : t.d) || 0) - (((n = e.l) === null || n === void 0 ? void 0 : n.d) || 0), a = 1 < r ? "r" : r < -1 ? "l" : "";
2759
- a && (t = a == "r" ? "l" : "r", n = i({}, e), r = e[a], e.from = r.from, e.to = r.to, e[a] = r[a], n[a] = r[t], (e[t] = n).d = Ur(n)), e.d = Ur(e);
2759
+ a && (t = a == "r" ? "l" : "r", n = o({}, e), r = e[a], e.from = r.from, e.to = r.to, e[a] = r[a], n[a] = r[t], (e[t] = n).d = Ur(n)), e.d = Ur(e);
2760
2760
  }
2761
2761
  function Ur(n) {
2762
2762
  var t = n.r, n = n.l;
@@ -2765,8 +2765,8 @@ function Eo() {
2765
2765
  function _n(e, t) {
2766
2766
  return y(t).forEach(function(n) {
2767
2767
  e[n] ? Wt(e[n], t[n]) : e[n] = (function r(a) {
2768
- var o, d, m = {};
2769
- for (o in a) Y(a, o) && (d = a[o], m[o] = !d || typeof d != "object" || ze.has(d.constructor) ? d : r(d));
2768
+ var i, d, m = {};
2769
+ for (i in a) Y(a, i) && (d = a[i], m[i] = !d || typeof d != "object" || ze.has(d.constructor) ? d : r(d));
2770
2770
  return m;
2771
2771
  })(t[n]);
2772
2772
  }), e;
@@ -2801,17 +2801,17 @@ function Eo() {
2801
2801
  t === void 0 && (t = !1);
2802
2802
  var n = /* @__PURE__ */ new Set();
2803
2803
  if (e.all) for (var r = 0, a = Object.values(vt); r < a.length; r++) $r(d = a[r], e, n, t);
2804
- else for (var o in e) {
2805
- var d, m = /^idb\:\/\/(.*)\/(.*)\//.exec(o);
2806
- m && (o = m[1], m = m[2], (d = vt["idb://".concat(o, "/").concat(m)]) && $r(d, e, n, t));
2804
+ else for (var i in e) {
2805
+ var d, m = /^idb\:\/\/(.*)\/(.*)\//.exec(i);
2806
+ m && (i = m[1], m = m[2], (d = vt["idb://".concat(i, "/").concat(m)]) && $r(d, e, n, t));
2807
2807
  }
2808
2808
  n.forEach(function(v) {
2809
2809
  return v();
2810
2810
  });
2811
2811
  }
2812
2812
  function $r(e, t, n, r) {
2813
- for (var a = [], o = 0, d = Object.entries(e.queries.query); o < d.length; o++) {
2814
- for (var m = d[o], v = m[0], b = [], w = 0, g = m[1]; w < g.length; w++) {
2813
+ for (var a = [], i = 0, d = Object.entries(e.queries.query); i < d.length; i++) {
2814
+ for (var m = d[i], v = m[0], b = [], w = 0, g = m[1]; w < g.length; w++) {
2815
2815
  var x = g[w];
2816
2816
  tr(t, x.obsSet) ? x.subscribers.forEach(function(E) {
2817
2817
  return n.add(E);
@@ -2830,7 +2830,7 @@ function Eo() {
2830
2830
  return t.dbOpenError ? be(t.dbOpenError) : e;
2831
2831
  });
2832
2832
  t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
2833
- var r = t.openCanceller, a = Math.round(10 * e.verno), o = !1;
2833
+ var r = t.openCanceller, a = Math.round(10 * e.verno), i = !1;
2834
2834
  function d() {
2835
2835
  if (t.openCanceller !== r) throw new O.DatabaseClosed("db.open() was cancelled");
2836
2836
  }
@@ -2843,7 +2843,7 @@ function Eo() {
2843
2843
  var N;
2844
2844
  w = T.transaction, t.autoSchema && !e._options.allowEmptyDB ? (T.onerror = $t, w.abort(), T.result.close(), (N = n.deleteDatabase(A)).onsuccess = N.onerror = ge(function() {
2845
2845
  _(new O.NoSuchDatabase("Database ".concat(A, " doesnt exist")));
2846
- })) : (w.onerror = Ue(_), E = E.oldVersion > Math.pow(2, 62) ? 0 : E.oldVersion, g = E < 1, e.idbdb = T.result, o && $a(e, w), Ua(e, E / 10, w, _));
2846
+ })) : (w.onerror = Ue(_), E = E.oldVersion > Math.pow(2, 62) ? 0 : E.oldVersion, g = E < 1, e.idbdb = T.result, i && $a(e, w), Ua(e, E / 10, w, _));
2847
2847
  }, _), T.onsuccess = ge(function() {
2848
2848
  w = null;
2849
2849
  var E, N, D, S, k, j = e.idbdb = T.result, L = ye(j.objectStoreNames);
@@ -2852,7 +2852,7 @@ function Eo() {
2852
2852
  if (t.autoSchema) N = j, D = K, (E = e).verno = N.version / 10, D = E._dbSchema = gn(0, N, D), E._storeNames = ye(N.objectStoreNames, 0), mn(E, [E._allTables], y(D), D);
2853
2853
  else if (yn(e, e._dbSchema, K), ((k = zn(gn(0, (k = e).idbdb, K), k._dbSchema)).add.length || k.change.some(function(q) {
2854
2854
  return q.add.length || q.change.length;
2855
- })) && !o) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), j.close(), a = j.version + 1, o = !0, x(m());
2855
+ })) && !i) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), j.close(), a = j.version + 1, i = !0, x(m());
2856
2856
  hn(e, K);
2857
2857
  } catch {
2858
2858
  }
@@ -2913,15 +2913,15 @@ function Eo() {
2913
2913
  });
2914
2914
  }
2915
2915
  function or(e) {
2916
- function t(o) {
2917
- return e.next(o);
2916
+ function t(i) {
2917
+ return e.next(i);
2918
2918
  }
2919
- var n = a(t), r = a(function(o) {
2920
- return e.throw(o);
2919
+ var n = a(t), r = a(function(i) {
2920
+ return e.throw(i);
2921
2921
  });
2922
- function a(o) {
2922
+ function a(i) {
2923
2923
  return function(v) {
2924
- var m = o(v), v = m.value;
2924
+ var m = i(v), v = m.value;
2925
2925
  return m.done ? v : v && typeof v.then == "function" ? v.then(n, r) : C(v) ? Promise.all(v).then(n, r) : n(v);
2926
2926
  };
2927
2927
  }
@@ -2932,11 +2932,11 @@ function Eo() {
2932
2932
  return r;
2933
2933
  }
2934
2934
  var Xa = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
2935
- return i(i({}, e), { table: function(t) {
2936
- var n = e.table(t), r = n.schema, a = {}, o = [];
2935
+ return o(o({}, e), { table: function(t) {
2936
+ var n = e.table(t), r = n.schema, a = {}, i = [];
2937
2937
  function d(g, x, _) {
2938
- var A = Xt(g), T = a[A] = a[A] || [], E = g == null ? 0 : typeof g == "string" ? 1 : g.length, N = 0 < x, N = i(i({}, _), { name: N ? "".concat(A, "(virtual-from:").concat(_.name, ")") : _.name, lowLevelIndex: _, isVirtual: N, keyTail: x, keyLength: E, extractKey: Yn(g), unique: !N && _.unique });
2939
- return T.push(N), N.isPrimaryKey || o.push(N), 1 < E && d(E === 2 ? g[0] : g.slice(0, E - 1), x + 1, _), T.sort(function(D, S) {
2938
+ var A = Xt(g), T = a[A] = a[A] || [], E = g == null ? 0 : typeof g == "string" ? 1 : g.length, N = 0 < x, N = o(o({}, _), { name: N ? "".concat(A, "(virtual-from:").concat(_.name, ")") : _.name, lowLevelIndex: _, isVirtual: N, keyTail: x, keyLength: E, extractKey: Yn(g), unique: !N && _.unique });
2939
+ return T.push(N), N.isPrimaryKey || i.push(N), 1 < E && d(E === 2 ? g[0] : g.slice(0, E - 1), x + 1, _), T.sort(function(D, S) {
2940
2940
  return D.keyTail - S.keyTail;
2941
2941
  }), N;
2942
2942
  }
@@ -2947,9 +2947,9 @@ function Eo() {
2947
2947
  }
2948
2948
  function w(g) {
2949
2949
  var x, _ = g.query.index;
2950
- return _.isVirtual ? i(i({}, g), { query: { index: _.lowLevelIndex, range: (x = g.query.range, _ = _.keyTail, { type: x.type === 1 ? 2 : x.type, lower: Cn(x.lower, x.lowerOpen ? e.MAX_KEY : e.MIN_KEY, _), lowerOpen: !0, upper: Cn(x.upper, x.upperOpen ? e.MIN_KEY : e.MAX_KEY, _), upperOpen: !0 }) } }) : g;
2950
+ return _.isVirtual ? o(o({}, g), { query: { index: _.lowLevelIndex, range: (x = g.query.range, _ = _.keyTail, { type: x.type === 1 ? 2 : x.type, lower: Cn(x.lower, x.lowerOpen ? e.MAX_KEY : e.MIN_KEY, _), lowerOpen: !0, upper: Cn(x.upper, x.upperOpen ? e.MIN_KEY : e.MAX_KEY, _), upperOpen: !0 }) } }) : g;
2951
2951
  }
2952
- return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes: o, getIndexByKeyPath: function(g) {
2952
+ return o(o({}, n), { schema: o(o({}, r), { primaryKey: t, indexes: i, getIndexByKeyPath: function(g) {
2953
2953
  return (g = a[Xt(g)]) && g[0];
2954
2954
  } }), count: function(g) {
2955
2955
  return n.count(w(g));
@@ -2979,8 +2979,8 @@ function Eo() {
2979
2979
  } };
2980
2980
  function ir(e, t, n, r) {
2981
2981
  return n = n || {}, r = r || "", y(e).forEach(function(a) {
2982
- var o, d, m;
2983
- Y(t, a) ? (o = e[a], d = t[a], typeof o == "object" && typeof d == "object" && o && d ? (m = Ve(o)) !== Ve(d) ? n[r + a] = t[a] : m === "Object" ? ir(o, d, n, r + a + ".") : o !== d && (n[r + a] = t[a]) : o !== d && (n[r + a] = t[a])) : n[r + a] = void 0;
2982
+ var i, d, m;
2983
+ Y(t, a) ? (i = e[a], d = t[a], typeof i == "object" && typeof d == "object" && i && d ? (m = Ve(i)) !== Ve(d) ? n[r + a] = t[a] : m === "Object" ? ir(i, d, n, r + a + ".") : i !== d && (n[r + a] = t[a]) : i !== d && (n[r + a] = t[a])) : n[r + a] = void 0;
2984
2984
  }), y(t).forEach(function(a) {
2985
2985
  Y(e, a) || (n[r + a] = t[a]);
2986
2986
  }), n;
@@ -2989,34 +2989,34 @@ function Eo() {
2989
2989
  return t.type === "delete" ? t.keys : t.keys || t.values.map(e.extractKey);
2990
2990
  }
2991
2991
  var Ya = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
2992
- return i(i({}, e), { table: function(t) {
2992
+ return o(o({}, e), { table: function(t) {
2993
2993
  var n = e.table(t), r = n.schema.primaryKey;
2994
- return i(i({}, n), { mutate: function(a) {
2995
- var o = Q.trans, d = o.table(t).hook, m = d.deleting, v = d.creating, b = d.updating;
2994
+ return o(o({}, n), { mutate: function(a) {
2995
+ var i = Q.trans, d = i.table(t).hook, m = d.deleting, v = d.creating, b = d.updating;
2996
2996
  switch (a.type) {
2997
2997
  case "add":
2998
2998
  if (v.fire === Z) break;
2999
- return o._promise("readwrite", function() {
2999
+ return i._promise("readwrite", function() {
3000
3000
  return w(a);
3001
3001
  }, !0);
3002
3002
  case "put":
3003
3003
  if (v.fire === Z && b.fire === Z) break;
3004
- return o._promise("readwrite", function() {
3004
+ return i._promise("readwrite", function() {
3005
3005
  return w(a);
3006
3006
  }, !0);
3007
3007
  case "delete":
3008
3008
  if (m.fire === Z) break;
3009
- return o._promise("readwrite", function() {
3009
+ return i._promise("readwrite", function() {
3010
3010
  return w(a);
3011
3011
  }, !0);
3012
3012
  case "deleteRange":
3013
3013
  if (m.fire === Z) break;
3014
- return o._promise("readwrite", function() {
3014
+ return i._promise("readwrite", function() {
3015
3015
  return (function g(x, _, A) {
3016
3016
  return n.query({ trans: x, values: !1, query: { index: r, range: _ }, limit: A }).then(function(T) {
3017
3017
  var E = T.result;
3018
3018
  return w({ type: "delete", keys: E, trans: x }).then(function(N) {
3019
- return 0 < N.numFailures ? Promise.reject(N.failures[0]) : E.length < A ? { failures: [], numFailures: 0, lastResult: void 0 } : g(x, i(i({}, _), { lower: E[E.length - 1], lowerOpen: !0 }), A);
3019
+ return 0 < N.numFailures ? Promise.reject(N.failures[0]) : E.length < A ? { failures: [], numFailures: 0, lastResult: void 0 } : g(x, o(o({}, _), { lower: E[E.length - 1], lowerOpen: !0 }), A);
3020
3020
  });
3021
3021
  });
3022
3022
  })(a.trans, a.range, 1e4);
@@ -3026,7 +3026,7 @@ function Eo() {
3026
3026
  function w(g) {
3027
3027
  var x, _, A, T = Q.trans, E = g.keys || sr(r, g);
3028
3028
  if (!E) throw new Error("Keys missing");
3029
- return (g = g.type === "add" || g.type === "put" ? i(i({}, g), { keys: E }) : i({}, g)).type !== "delete" && (g.values = h([], g.values)), g.keys && (g.keys = h([], g.keys)), x = n, A = E, ((_ = g).type === "add" ? Promise.resolve([]) : x.getMany({ trans: _.trans, keys: A, cache: "immutable" })).then(function(N) {
3029
+ return (g = g.type === "add" || g.type === "put" ? o(o({}, g), { keys: E }) : o({}, g)).type !== "delete" && (g.values = h([], g.values)), g.keys && (g.keys = h([], g.keys)), x = n, A = E, ((_ = g).type === "add" ? Promise.resolve([]) : x.getMany({ trans: _.trans, keys: A, cache: "immutable" })).then(function(N) {
3030
3030
  var D = E.map(function(S, k) {
3031
3031
  var j, L, K, q = N[k], V = { onerror: null, onsuccess: null };
3032
3032
  return g.type === "delete" ? m.fire.call(V, S, q, T) : g.type === "add" || q === void 0 ? (j = v.fire.call(V, S, g.values[k], T), S == null && j != null && (g.keys[k] = S = j, r.outbound || ae(g.values[k], r.keyPath, S))) : (j = ir(q, g.values[k]), (L = b.fire.call(V, j, S, q, T)) && (K = g.values[k], Object.keys(L).forEach(function($) {
@@ -3052,7 +3052,7 @@ function Eo() {
3052
3052
  function Vr(e, t, n) {
3053
3053
  try {
3054
3054
  if (!t || t.keys.length < e.length) return null;
3055
- for (var r = [], a = 0, o = 0; a < t.keys.length && o < e.length; ++a) se(t.keys[a], e[o]) === 0 && (r.push(n ? Se(t.values[a]) : t.values[a]), ++o);
3055
+ for (var r = [], a = 0, i = 0; a < t.keys.length && i < e.length; ++a) se(t.keys[a], e[i]) === 0 && (r.push(n ? Se(t.values[a]) : t.values[a]), ++i);
3056
3056
  return r.length === e.length ? r : null;
3057
3057
  } catch {
3058
3058
  return null;
@@ -3061,11 +3061,11 @@ function Eo() {
3061
3061
  var Wa = { stack: "dbcore", level: -1, create: function(e) {
3062
3062
  return { table: function(t) {
3063
3063
  var n = e.table(t);
3064
- return i(i({}, n), { getMany: function(r) {
3064
+ return o(o({}, n), { getMany: function(r) {
3065
3065
  if (!r.cache) return n.getMany(r);
3066
3066
  var a = Vr(r.keys, r.trans._cache, r.cache === "clone");
3067
- return a ? G.resolve(a) : n.getMany(r).then(function(o) {
3068
- return r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? Se(o) : o }, o;
3067
+ return a ? G.resolve(a) : n.getMany(r).then(function(i) {
3068
+ return r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? Se(i) : i }, i;
3069
3069
  });
3070
3070
  }, mutate: function(r) {
3071
3071
  return r.type !== "add" && (r.trans._cache = null), n.mutate(r);
@@ -3088,20 +3088,20 @@ function Eo() {
3088
3088
  }
3089
3089
  var za = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3090
3090
  var t = e.schema.name, n = new xe(e.MIN_KEY, e.MAX_KEY);
3091
- return i(i({}, e), { transaction: function(r, a, o) {
3091
+ return o(o({}, e), { transaction: function(r, a, i) {
3092
3092
  if (Q.subscr && a !== "readonly") throw new O.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(Q.querier));
3093
- return e.transaction(r, a, o);
3093
+ return e.transaction(r, a, i);
3094
3094
  }, table: function(r) {
3095
- var a = e.table(r), o = a.schema, d = o.primaryKey, g = o.indexes, m = d.extractKey, v = d.outbound, b = d.autoIncrement && g.filter(function(_) {
3095
+ var a = e.table(r), i = a.schema, d = i.primaryKey, g = i.indexes, m = d.extractKey, v = d.outbound, b = d.autoIncrement && g.filter(function(_) {
3096
3096
  return _.compound && _.keyPath.includes(d.keyPath);
3097
- }), w = i(i({}, a), { mutate: function(_) {
3097
+ }), w = o(o({}, a), { mutate: function(_) {
3098
3098
  function A($) {
3099
3099
  return $ = "idb://".concat(t, "/").concat(r, "/").concat($), S[$] || (S[$] = new xe());
3100
3100
  }
3101
3101
  var T, E, N, D = _.trans, S = _.mutatedParts || (_.mutatedParts = {}), k = A(""), j = A(":dels"), L = _.type, V = _.type === "deleteRange" ? [_.range] : _.type === "delete" ? [_.keys] : _.values.length < 50 ? [sr(d, _).filter(function($) {
3102
3102
  return $;
3103
3103
  }), _.values] : [], K = V[0], q = V[1], V = _.trans._cache;
3104
- return C(K) ? (k.addKeys(K), (V = L === "delete" || K.length === q.length ? Vr(K, V) : null) || j.addKeys(K), (V || q) && (T = A, E = V, N = q, o.indexes.forEach(function($) {
3104
+ return C(K) ? (k.addKeys(K), (V = L === "delete" || K.length === q.length ? Vr(K, V) : null) || j.addKeys(K), (V || q) && (T = A, E = V, N = q, i.indexes.forEach(function($) {
3105
3105
  var X = T($.name || "");
3106
3106
  function re(ne) {
3107
3107
  return ne != null ? $.extractKey(ne) : null;
@@ -3115,7 +3115,7 @@ function Eo() {
3115
3115
  var ee = E && re(E[Ne]), Ne = N && re(N[Ne]);
3116
3116
  se(ee, Ne) !== 0 && (ee != null && ce(ee), Ne != null && ce(Ne));
3117
3117
  });
3118
- }))) : K ? (q = { from: (q = K.lower) !== null && q !== void 0 ? q : e.MIN_KEY, to: (q = K.upper) !== null && q !== void 0 ? q : e.MAX_KEY }, j.add(q), k.add(q)) : (k.add(n), j.add(n), o.indexes.forEach(function($) {
3118
+ }))) : K ? (q = { from: (q = K.lower) !== null && q !== void 0 ? q : e.MIN_KEY, to: (q = K.upper) !== null && q !== void 0 ? q : e.MAX_KEY }, j.add(q), k.add(q)) : (k.add(n), j.add(n), i.indexes.forEach(function($) {
3119
3119
  return A($.name).add(n);
3120
3120
  })), a.mutate(_).then(function($) {
3121
3121
  return !K || _.type !== "add" && _.type !== "put" || (k.addKeys($.results), b && b.forEach(function(X) {
@@ -3144,7 +3144,7 @@ function Eo() {
3144
3144
  }, S = D(""), k = D(":dels"), T = x[_](A), E = T[0], T = T[1];
3145
3145
  if ((_ === "query" && E.isPrimaryKey && !A.values ? k : D(E.name || "")).add(T), !E.isPrimaryKey) {
3146
3146
  if (_ !== "count") {
3147
- var j = _ === "query" && v && A.values && a.query(i(i({}, A), { values: !1 }));
3147
+ var j = _ === "query" && v && A.values && a.query(o(o({}, A), { values: !1 }));
3148
3148
  return a[_].apply(this, arguments).then(function(q) {
3149
3149
  if (_ === "query") {
3150
3150
  if (v && A.values) return j.then(function(re) {
@@ -3178,17 +3178,17 @@ function Eo() {
3178
3178
  if (n.numFailures === 0) return t;
3179
3179
  if (t.type === "deleteRange") return null;
3180
3180
  var r = t.keys ? t.keys.length : "values" in t && t.values ? t.values.length : 1;
3181
- return n.numFailures === r ? null : (t = i({}, t), C(t.keys) && (t.keys = t.keys.filter(function(a, o) {
3182
- return !(o in n.failures);
3183
- })), "values" in t && C(t.values) && (t.values = t.values.filter(function(a, o) {
3184
- return !(o in n.failures);
3181
+ return n.numFailures === r ? null : (t = o({}, t), C(t.keys) && (t.keys = t.keys.filter(function(a, i) {
3182
+ return !(i in n.failures);
3183
+ })), "values" in t && C(t.values) && (t.values = t.values.filter(function(a, i) {
3184
+ return !(i in n.failures);
3185
3185
  })), t);
3186
3186
  }
3187
3187
  function ur(e, t) {
3188
3188
  return n = e, ((r = t).lower === void 0 || (r.lowerOpen ? 0 < se(n, r.lower) : 0 <= se(n, r.lower))) && (e = e, (t = t).upper === void 0 || (t.upperOpen ? se(e, t.upper) < 0 : se(e, t.upper) <= 0));
3189
3189
  var n, r;
3190
3190
  }
3191
- function Wr(e, t, x, r, a, o) {
3191
+ function Wr(e, t, x, r, a, i) {
3192
3192
  if (!x || x.length === 0) return e;
3193
3193
  var d = t.query.index, m = d.multiEntry, v = t.query.range, b = r.schema.primaryKey.extractKey, w = d.extractKey, g = (d.lowLevelIndex || d).extractKey, x = x.reduce(function(_, A) {
3194
3194
  var T = _, E = [];
@@ -3236,47 +3236,47 @@ function Eo() {
3236
3236
  }, e);
3237
3237
  return x === e ? e : (x.sort(function(_, A) {
3238
3238
  return se(g(_), g(A)) || se(b(_), b(A));
3239
- }), t.limit && t.limit < 1 / 0 && (x.length > t.limit ? x.length = t.limit : e.length === t.limit && x.length < t.limit && (a.dirty = !0)), o ? Object.freeze(x) : x);
3239
+ }), t.limit && t.limit < 1 / 0 && (x.length > t.limit ? x.length = t.limit : e.length === t.limit && x.length < t.limit && (a.dirty = !0)), i ? Object.freeze(x) : x);
3240
3240
  }
3241
3241
  function zr(e, t) {
3242
3242
  return se(e.lower, t.lower) === 0 && se(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
3243
3243
  }
3244
3244
  function Qa(e, t) {
3245
- return (function(n, r, a, o) {
3245
+ return (function(n, r, a, i) {
3246
3246
  if (n === void 0) return r !== void 0 ? -1 : 0;
3247
3247
  if (r === void 0) return 1;
3248
3248
  if ((r = se(n, r)) === 0) {
3249
- if (a && o) return 0;
3249
+ if (a && i) return 0;
3250
3250
  if (a) return 1;
3251
- if (o) return -1;
3251
+ if (i) return -1;
3252
3252
  }
3253
3253
  return r;
3254
- })(e.lower, t.lower, e.lowerOpen, t.lowerOpen) <= 0 && 0 <= (function(n, r, a, o) {
3254
+ })(e.lower, t.lower, e.lowerOpen, t.lowerOpen) <= 0 && 0 <= (function(n, r, a, i) {
3255
3255
  if (n === void 0) return r !== void 0 ? 1 : 0;
3256
3256
  if (r === void 0) return -1;
3257
3257
  if ((r = se(n, r)) === 0) {
3258
- if (a && o) return 0;
3258
+ if (a && i) return 0;
3259
3259
  if (a) return -1;
3260
- if (o) return 1;
3260
+ if (i) return 1;
3261
3261
  }
3262
3262
  return r;
3263
3263
  })(e.upper, t.upper, e.upperOpen, t.upperOpen);
3264
3264
  }
3265
3265
  function Ha(e, t, n, r) {
3266
3266
  e.subscribers.add(n), r.addEventListener("abort", function() {
3267
- var a, o;
3268
- e.subscribers.delete(n), e.subscribers.size === 0 && (a = e, o = t, setTimeout(function() {
3269
- a.subscribers.size === 0 && Ge(o, a);
3267
+ var a, i;
3268
+ e.subscribers.delete(n), e.subscribers.size === 0 && (a = e, i = t, setTimeout(function() {
3269
+ a.subscribers.size === 0 && Ge(i, a);
3270
3270
  }, 3e3));
3271
3271
  });
3272
3272
  }
3273
3273
  var Za = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
3274
3274
  var t = e.schema.name;
3275
- return i(i({}, e), { transaction: function(n, r, a) {
3276
- var o, d, m = e.transaction(n, r, a);
3277
- return r === "readwrite" && (d = (o = new AbortController()).signal, a = function(v) {
3275
+ return o(o({}, e), { transaction: function(n, r, a) {
3276
+ var i, d, m = e.transaction(n, r, a);
3277
+ return r === "readwrite" && (d = (i = new AbortController()).signal, a = function(v) {
3278
3278
  return function() {
3279
- if (o.abort(), r === "readwrite") {
3279
+ if (i.abort(), r === "readwrite") {
3280
3280
  for (var b = /* @__PURE__ */ new Set(), w = 0, g = n; w < g.length; w++) {
3281
3281
  var x = g[w], _ = vt["idb://".concat(t, "/").concat(x)];
3282
3282
  if (_) {
@@ -3306,27 +3306,27 @@ function Eo() {
3306
3306
  }, m.addEventListener("abort", a(!1), { signal: d }), m.addEventListener("error", a(!1), { signal: d }), m.addEventListener("complete", a(!0), { signal: d })), m;
3307
3307
  }, table: function(n) {
3308
3308
  var r = e.table(n), a = r.schema.primaryKey;
3309
- return i(i({}, r), { mutate: function(o) {
3309
+ return o(o({}, r), { mutate: function(i) {
3310
3310
  var d = Q.trans;
3311
- if (a.outbound || d.db._options.cache === "disabled" || d.explicit || d.idbtrans.mode !== "readwrite") return r.mutate(o);
3311
+ if (a.outbound || d.db._options.cache === "disabled" || d.explicit || d.idbtrans.mode !== "readwrite") return r.mutate(i);
3312
3312
  var m = vt["idb://".concat(t, "/").concat(n)];
3313
- return m ? (d = r.mutate(o), o.type !== "add" && o.type !== "put" || !(50 <= o.values.length || sr(a, o).some(function(v) {
3313
+ return m ? (d = r.mutate(i), i.type !== "add" && i.type !== "put" || !(50 <= i.values.length || sr(a, i).some(function(v) {
3314
3314
  return v == null;
3315
- })) ? (m.optimisticOps.push(o), o.mutatedParts && bn(o.mutatedParts), d.then(function(v) {
3316
- 0 < v.numFailures && (Ge(m.optimisticOps, o), (v = Yr(0, o, v)) && m.optimisticOps.push(v), o.mutatedParts && bn(o.mutatedParts));
3315
+ })) ? (m.optimisticOps.push(i), i.mutatedParts && bn(i.mutatedParts), d.then(function(v) {
3316
+ 0 < v.numFailures && (Ge(m.optimisticOps, i), (v = Yr(0, i, v)) && m.optimisticOps.push(v), i.mutatedParts && bn(i.mutatedParts));
3317
3317
  }), d.catch(function() {
3318
- Ge(m.optimisticOps, o), o.mutatedParts && bn(o.mutatedParts);
3318
+ Ge(m.optimisticOps, i), i.mutatedParts && bn(i.mutatedParts);
3319
3319
  })) : d.then(function(v) {
3320
- var b = Yr(0, i(i({}, o), { values: o.values.map(function(w, g) {
3320
+ var b = Yr(0, o(o({}, i), { values: i.values.map(function(w, g) {
3321
3321
  var x;
3322
- return v.failures[g] ? w : (w = (x = a.keyPath) !== null && x !== void 0 && x.includes(".") ? Se(w) : i({}, w), ae(w, a.keyPath, v.results[g]), w);
3322
+ return v.failures[g] ? w : (w = (x = a.keyPath) !== null && x !== void 0 && x.includes(".") ? Se(w) : o({}, w), ae(w, a.keyPath, v.results[g]), w);
3323
3323
  }) }), v);
3324
3324
  m.optimisticOps.push(b), queueMicrotask(function() {
3325
- return o.mutatedParts && bn(o.mutatedParts);
3325
+ return i.mutatedParts && bn(i.mutatedParts);
3326
3326
  });
3327
- }), d) : r.mutate(o);
3328
- }, query: function(o) {
3329
- if (!Gr(Q, r) || !Xr("query", o)) return r.query(o);
3327
+ }), d) : r.mutate(i);
3328
+ }, query: function(i) {
3329
+ if (!Gr(Q, r) || !Xr("query", i)) return r.query(i);
3330
3330
  var d = ((b = Q.trans) === null || b === void 0 ? void 0 : b.db._options.cache) === "immutable", g = Q, m = g.requery, v = g.signal, b = (function(A, T, E, N) {
3331
3331
  var D = vt["idb://".concat(A, "/").concat(T)];
3332
3332
  if (!D) return [];
@@ -3346,8 +3346,8 @@ function Eo() {
3346
3346
  return zr(j.req.query.range, N.query.range);
3347
3347
  }), [k, !!k, D, S];
3348
3348
  }
3349
- })(t, n, "query", o), w = b[0], g = b[1], x = b[2], _ = b[3];
3350
- return w && g ? w.obsSet = o.obsSet : (g = r.query(o).then(function(A) {
3349
+ })(t, n, "query", i), w = b[0], g = b[1], x = b[2], _ = b[3];
3350
+ return w && g ? w.obsSet = i.obsSet : (g = r.query(i).then(function(A) {
3351
3351
  var T = A.result;
3352
3352
  if (w && (w.res = T), d) {
3353
3353
  for (var E = 0, N = T.length; E < N; ++E) Object.freeze(T[E]);
@@ -3356,8 +3356,8 @@ function Eo() {
3356
3356
  return A;
3357
3357
  }).catch(function(A) {
3358
3358
  return _ && w && Ge(_, w), Promise.reject(A);
3359
- }), w = { obsSet: o.obsSet, promise: g, subscribers: /* @__PURE__ */ new Set(), type: "query", req: o, dirty: !1 }, _ ? _.push(w) : (_ = [w], (x = x || (vt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[o.query.index.name || ""] = _)), Ha(w, _, m, v), w.promise.then(function(A) {
3360
- return { result: Wr(A.result, o, x?.optimisticOps, r, w, d) };
3359
+ }), w = { obsSet: i.obsSet, promise: g, subscribers: /* @__PURE__ */ new Set(), type: "query", req: i, dirty: !1 }, _ ? _.push(w) : (_ = [w], (x = x || (vt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[i.query.index.name || ""] = _)), Ha(w, _, m, v), w.promise.then(function(A) {
3360
+ return { result: Wr(A.result, i, x?.optimisticOps, r, w, d) };
3361
3361
  });
3362
3362
  } });
3363
3363
  } });
@@ -3387,8 +3387,8 @@ function Eo() {
3387
3387
  }).then(e);
3388
3388
  }, Ce.prototype.use = function(e) {
3389
3389
  var t = e.stack, n = e.create, r = e.level, a = e.name;
3390
- return a && this.unuse({ stack: t, name: a }), e = this._middlewares[t] || (this._middlewares[t] = []), e.push({ stack: t, create: n, level: r ?? 10, name: a }), e.sort(function(o, d) {
3391
- return o.level - d.level;
3390
+ return a && this.unuse({ stack: t, name: a }), e = this._middlewares[t] || (this._middlewares[t] = []), e.push({ stack: t, create: n, level: r ?? 10, name: a }), e.sort(function(i, d) {
3391
+ return i.level - d.level;
3392
3392
  }), this;
3393
3393
  }, Ce.prototype.unuse = function(e) {
3394
3394
  var t = e.stack, n = e.name, r = e.create;
@@ -3422,14 +3422,14 @@ function Eo() {
3422
3422
  var t = this;
3423
3423
  e === void 0 && (e = { disableAutoOpen: !0 });
3424
3424
  var n = 0 < arguments.length && typeof arguments[0] != "object", r = this._state;
3425
- return new G(function(a, o) {
3425
+ return new G(function(a, i) {
3426
3426
  function d() {
3427
3427
  t.close(e);
3428
3428
  var m = t._deps.indexedDB.deleteDatabase(t.name);
3429
3429
  m.onsuccess = ge(function() {
3430
3430
  var v, b, w;
3431
3431
  v = t._deps, b = t.name, w = v.indexedDB, v = v.IDBKeyRange, Zn(w) || b === sn || Hn(w, v).delete(b).catch(Z), a();
3432
- }), m.onerror = Ue(o), m.onblocked = t._fireOnBlocked;
3432
+ }), m.onerror = Ue(i), m.onblocked = t._fireOnBlocked;
3433
3433
  }
3434
3434
  if (n) throw new O.InvalidArgument("Invalid closeOptions argument to db.delete()");
3435
3435
  r.isBeingOpened ? r.dbReadyPromise.then(d) : d();
@@ -3454,26 +3454,26 @@ function Eo() {
3454
3454
  var e = (function(t, n, r) {
3455
3455
  var a = arguments.length;
3456
3456
  if (a < 2) throw new O.InvalidArgument("Too few arguments");
3457
- for (var o = new Array(a - 1); --a; ) o[a - 1] = arguments[a];
3458
- return r = o.pop(), [t, Dt(o), r];
3457
+ for (var i = new Array(a - 1); --a; ) i[a - 1] = arguments[a];
3458
+ return r = i.pop(), [t, Dt(i), r];
3459
3459
  }).apply(this, arguments);
3460
3460
  return this._transaction.apply(this, e);
3461
3461
  }, Ce.prototype._transaction = function(e, t, n) {
3462
3462
  var r = this, a = Q.trans;
3463
3463
  a && a.db === this && e.indexOf("!") === -1 || (a = null);
3464
- var o, d, m = e.indexOf("?") !== -1;
3464
+ var i, d, m = e.indexOf("?") !== -1;
3465
3465
  e = e.replace("!", "").replace("?", "");
3466
3466
  try {
3467
3467
  if (d = t.map(function(b) {
3468
3468
  if (b = b instanceof r.Table ? b.name : b, typeof b != "string") throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
3469
3469
  return b;
3470
- }), e == "r" || e === qn) o = qn;
3470
+ }), e == "r" || e === qn) i = qn;
3471
3471
  else {
3472
3472
  if (e != "rw" && e != Ln) throw new O.InvalidArgument("Invalid transaction mode: " + e);
3473
- o = Ln;
3473
+ i = Ln;
3474
3474
  }
3475
3475
  if (a) {
3476
- if (a.mode === qn && o === Ln) {
3476
+ if (a.mode === qn && i === Ln) {
3477
3477
  if (!m) throw new O.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
3478
3478
  a = null;
3479
3479
  }
@@ -3516,8 +3516,8 @@ function Eo() {
3516
3516
  return E._reject(S), be(S);
3517
3517
  });
3518
3518
  });
3519
- }).bind(null, this, o, d, a, n);
3520
- return a ? a._promise(o, v, "lock") : Q.trans ? pt(Q.transless, function() {
3519
+ }).bind(null, this, i, d, a, n);
3520
+ return a ? a._promise(i, v, "lock") : Q.trans ? pt(Q.transless, function() {
3521
3521
  return r._whenReady(v);
3522
3522
  }) : this._whenReady(v);
3523
3523
  }, Ce.prototype.table = function(e) {
@@ -3528,8 +3528,8 @@ function Eo() {
3528
3528
  var n = this;
3529
3529
  this._middlewares = {}, this.verno = 0;
3530
3530
  var r = Ce.dependencies;
3531
- this._options = t = i({ addons: Ce.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, r = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
3532
- var a, o, d, m, v, b = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Z, dbReadyPromise: null, cancelOpen: Z, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
3531
+ this._options = t = o({ addons: Ce.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, r = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
3532
+ var a, i, d, m, v, b = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Z, dbReadyPromise: null, cancelOpen: Z, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
3533
3533
  b.dbReadyPromise = new G(function(g) {
3534
3534
  b.dbReadyResolve = g;
3535
3535
  }), b.openCanceller = new G(function(g, x) {
@@ -3559,8 +3559,8 @@ function Eo() {
3559
3559
  }
3560
3560
  var T = N._ctx, E = T.table, N = E.hook.reading.fire;
3561
3561
  this._ctx = { table: E, index: T.index, isPrimKey: !T.index || E.schema.primKey.keyPath && T.index === E.schema.primKey.name, range: _, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: A, or: T.or, valueMapper: N !== he ? N : null };
3562
- })), this.Table = (o = this, Lt(Or.prototype, function(g, x, _) {
3563
- this.db = o, this._tx = _, this.name = g, this.schema = x, this.hook = o._allTables[g] ? o._allTables[g].hook : qt(null, { creating: [Je, Z], reading: [Te, he], updating: [Ke, Z], deleting: [Ae, Z] });
3562
+ })), this.Table = (i = this, Lt(Or.prototype, function(g, x, _) {
3563
+ this.db = i, this._tx = _, this.name = g, this.schema = x, this.hook = i._allTables[g] ? i._allTables[g].hook : qt(null, { creating: [Je, Z], reading: [Te, he], updating: [Ke, Z], deleting: [Ae, Z] });
3564
3564
  })), this.Transaction = (d = this, Lt(Ma.prototype, function(g, x, _, A, T) {
3565
3565
  var E = this;
3566
3566
  g !== "readonly" && x.forEach(function(N) {
@@ -3629,7 +3629,7 @@ function Eo() {
3629
3629
  }
3630
3630
  function Qr(e) {
3631
3631
  var t, n = !1, r = new Ja(function(a) {
3632
- var o = je(e), d, m = !1, v = {}, b = {}, w = { get closed() {
3632
+ var i = je(e), d, m = !1, v = {}, b = {}, w = { get closed() {
3633
3633
  return m;
3634
3634
  }, unsubscribe: function() {
3635
3635
  m || (m = !0, d && d.abort(), g && ot.storagemutated.unsubscribe(_));
@@ -3644,9 +3644,9 @@ function Eo() {
3644
3644
  !m && wn.indexedDB && (v = {}, T = {}, d && d.abort(), d = new AbortController(), N = (function(D) {
3645
3645
  var S = Bt();
3646
3646
  try {
3647
- o && Tt();
3647
+ i && Tt();
3648
3648
  var k = tt(e, D);
3649
- return k = o ? k.finally(nt) : k;
3649
+ return k = i ? k.finally(nt) : k;
3650
3650
  } finally {
3651
3651
  S && Et();
3652
3652
  }
@@ -3680,7 +3680,7 @@ function Eo() {
3680
3680
  it = t;
3681
3681
  }
3682
3682
  }
3683
- z(_t, i(i({}, ue), { delete: function(e) {
3683
+ z(_t, o(o({}, ue), { delete: function(e) {
3684
3684
  return new _t(e, { addons: [] }).delete();
3685
3685
  }, exists: function(e) {
3686
3686
  return new _t(e, { addons: [] }).open().then(function(t) {
@@ -3763,7 +3763,7 @@ function Eo() {
3763
3763
  return !e || e instanceof Qe || e instanceof TypeError || e instanceof SyntaxError || !e.name || !B[e.name] ? e : (t = new B[e.name](t || e.message, e), "stack" in e && M(t, "stack", { get: function() {
3764
3764
  return this.inner.stack;
3765
3765
  } }), t);
3766
- }, kt(De), i(Ye, Object.freeze({ __proto__: null, Dexie: Ye, liveQuery: Qr, Entity: Tr, cmp: se, PropModification: Ut, replacePrefix: function(e, t) {
3766
+ }, kt(De), o(Ye, Object.freeze({ __proto__: null, Dexie: Ye, liveQuery: Qr, Entity: Tr, cmp: se, PropModification: Ut, replacePrefix: function(e, t) {
3767
3767
  return new Ut({ replacePrefix: [e, t] });
3768
3768
  }, add: function(e) {
3769
3769
  return new Ut({ add: e });
@@ -3791,21 +3791,21 @@ const {
3791
3791
  DexieYProvider: bs
3792
3792
  } = ct;
3793
3793
  async function ga(l) {
3794
- const { databaseName: c, dialecteConfig: u, createRootIfEmpty: i = !1 } = l, { xmlElements: h, additionalTables: p } = u.database.tables, y = new ct(c), C = {
3794
+ const { databaseName: c, dialecteConfig: u, createRootIfEmpty: o = !1 } = l, { xmlElements: h, additionalTables: p } = u.database.tables, y = new ct(c), C = {
3795
3795
  [h.name]: h.schema
3796
3796
  };
3797
3797
  if (p)
3798
3798
  for (const [R, P] of Object.entries(p))
3799
3799
  C[R] = P.schema;
3800
- return y.version(1).stores(C), i && await xo({
3800
+ return y.version(1).stores(C), o && await xo({
3801
3801
  databaseInstance: y,
3802
3802
  dialecteConfig: u
3803
3803
  }), y;
3804
3804
  }
3805
3805
  async function xo(l) {
3806
- const { databaseInstance: c, dialecteConfig: u } = l, i = u.database.tables.xmlElements.name, h = u.rootElementName;
3806
+ const { databaseInstance: c, dialecteConfig: u } = l, o = u.database.tables.xmlElements.name, h = u.rootElementName;
3807
3807
  await c.open();
3808
- const p = c.table(i), y = await p.where({ tagName: h }).count(), C = u.definition[h].attributes.details;
3808
+ const p = c.table(o), y = await p.where({ tagName: h }).count(), C = u.definition[h].attributes.details;
3809
3809
  let R = [];
3810
3810
  for (const [P, U] of Object.entries(C))
3811
3811
  U.required && U.default && R.push({
@@ -3857,20 +3857,20 @@ function Io(l) {
3857
3857
  });
3858
3858
  }
3859
3859
  function Do(l) {
3860
- const { current: c, total: u, operation: i } = l, h = On.progress;
3860
+ const { current: c, total: u, operation: o } = l, h = On.progress;
3861
3861
  !h || h.phase !== "ending" ? lt({
3862
3862
  loading: !0,
3863
3863
  progress: {
3864
3864
  phase: "ending",
3865
3865
  current: 0,
3866
3866
  total: u,
3867
- operation: i || "Ending"
3867
+ operation: o || "Ending"
3868
3868
  }
3869
3869
  }) : lt({
3870
3870
  progress: {
3871
3871
  ...h,
3872
3872
  current: c,
3873
- operation: i ?? h.operation
3873
+ operation: o ?? h.operation
3874
3874
  }
3875
3875
  });
3876
3876
  }
@@ -3904,14 +3904,14 @@ function ya() {
3904
3904
  }
3905
3905
  function ko(l) {
3906
3906
  ya();
3907
- const { dialecteConfig: c, databaseInstance: u } = l, i = c.database.tables.xmlElements.name, h = c.rootElementName, p = Promise.resolve().then(
3907
+ const { dialecteConfig: c, databaseInstance: u } = l, o = c.database.tables.xmlElements.name, h = c.rootElementName, p = Promise.resolve().then(
3908
3908
  async () => {
3909
- const y = await u.table(i).where({ tagName: h }).count();
3909
+ const y = await u.table(o).where({ tagName: h }).count();
3910
3910
  Ee(
3911
3911
  y === 1,
3912
3912
  `Expected exactly one root element "${h}", found ${y}`
3913
3913
  );
3914
- const C = await u.table(i).get({ tagName: h });
3914
+ const C = await u.table(o).get({ tagName: h });
3915
3915
  return Ee(
3916
3916
  C,
3917
3917
  `Root element "${h}" not found in database "${u.name}"`
@@ -3932,49 +3932,49 @@ function ko(l) {
3932
3932
  }
3933
3933
  function Fo(l) {
3934
3934
  ya();
3935
- const { dialecteConfig: c, databaseInstance: u, tagName: i, id: h } = l, p = c.database.tables.xmlElements.name, y = Promise.resolve().then(
3935
+ const { dialecteConfig: c, databaseInstance: u, tagName: o, id: h } = l, p = c.database.tables.xmlElements.name, y = Promise.resolve().then(
3936
3936
  async () => {
3937
- const C = c.singletonElements?.includes(i);
3937
+ const C = c.singletonElements?.includes(o);
3938
3938
  let R;
3939
3939
  if (C && !h)
3940
- R = await u.table(p).where({ tagName: i }).first();
3940
+ R = await u.table(p).where({ tagName: o }).first();
3941
3941
  else if (h)
3942
- R = await u.table(p).get({ id: h, tagName: i });
3942
+ R = await u.table(p).get({ id: h, tagName: o });
3943
3943
  else
3944
- throw new Error(`Element ${i} requires an id parameter`);
3944
+ throw new Error(`Element ${o} requires an id parameter`);
3945
3945
  return Ee(
3946
3946
  R,
3947
- h ? `Element "${i}" with id "${h}" not found in database` : `Element "${i}" not found in database`
3947
+ h ? `Element "${o}" with id "${h}" not found in database` : `Element "${o}" not found in database`
3948
3948
  ), {
3949
3949
  currentFocus: Pe({ record: R }),
3950
3950
  stagedOperations: []
3951
3951
  };
3952
3952
  }
3953
3953
  );
3954
- return vr({ contextPromise: y, dialecteConfig: c, databaseInstance: u, tagName: i });
3954
+ return vr({ contextPromise: y, dialecteConfig: c, databaseInstance: u, tagName: o });
3955
3955
  }
3956
3956
  async function Mo(l) {
3957
3957
  const { databaseName: c, dialecteConfig: u } = l;
3958
3958
  Ee(c, "Database name is required to create SDK");
3959
- const i = await ga({
3959
+ const o = await ga({
3960
3960
  databaseName: c,
3961
3961
  dialecteConfig: u,
3962
3962
  createRootIfEmpty: !0
3963
3963
  });
3964
3964
  return {
3965
3965
  getState: So,
3966
- getDatabaseInstance: () => i,
3967
- fromRoot: () => ko({ dialecteConfig: u, databaseInstance: i }),
3966
+ getDatabaseInstance: () => o,
3967
+ fromRoot: () => ko({ dialecteConfig: u, databaseInstance: o }),
3968
3968
  fromElement: (h) => Fo({
3969
3969
  dialecteConfig: u,
3970
- databaseInstance: i,
3970
+ databaseInstance: o,
3971
3971
  ...h
3972
3972
  })
3973
3973
  };
3974
3974
  }
3975
3975
  async function jo(l) {
3976
- const { databaseInstance: c, elementsTableName: u, records: i } = l, h = c.table(u);
3977
- await c.transaction("rw", h, () => h.bulkAdd(i));
3976
+ const { databaseInstance: c, elementsTableName: u, records: o } = l, h = c.table(u);
3977
+ await c.transaction("rw", h, () => h.bulkAdd(o));
3978
3978
  }
3979
3979
  async function Cs(l) {
3980
3980
  if (await ct.exists(l))
@@ -3987,17 +3987,17 @@ const Qt = {};
3987
3987
  function qo(l) {
3988
3988
  const { parentId: c, child: u } = l;
3989
3989
  Qt[c] || (Qt[c] = []);
3990
- const i = {
3990
+ const o = {
3991
3991
  id: u.id,
3992
3992
  tagName: u.tagName
3993
3993
  };
3994
- Qt[c].push(i);
3994
+ Qt[c].push(o);
3995
3995
  }
3996
3996
  function Lo(l) {
3997
3997
  const { currentBatch: c } = l, u = [...c];
3998
- for (const [i, h] of u.entries()) {
3998
+ for (const [o, h] of u.entries()) {
3999
3999
  const p = Qt[h.id] || [];
4000
- p.length > 0 && (u[i].children.push(...p), Uo({
4000
+ p.length > 0 && (u[o].children.push(...p), Uo({
4001
4001
  parentId: h.id
4002
4002
  }));
4003
4003
  }
@@ -4017,8 +4017,8 @@ function Xo() {
4017
4017
  return ta || (ta = 1, (function(l) {
4018
4018
  (function(c) {
4019
4019
  c.parser = function(f, s) {
4020
- return new i(f, s);
4021
- }, c.SAXParser = i, c.SAXStream = U, c.createStream = P, c.MAX_BUFFER_LENGTH = 64 * 1024;
4020
+ return new o(f, s);
4021
+ }, c.SAXParser = o, c.SAXStream = U, c.createStream = P, c.MAX_BUFFER_LENGTH = 64 * 1024;
4022
4022
  var u = [
4023
4023
  "comment",
4024
4024
  "sgmlDecl",
@@ -4053,9 +4053,9 @@ function Xo() {
4053
4053
  "opennamespace",
4054
4054
  "closenamespace"
4055
4055
  ];
4056
- function i(f, s) {
4057
- if (!(this instanceof i))
4058
- return new i(f, s);
4056
+ function o(f, s) {
4057
+ if (!(this instanceof o))
4058
+ return new o(f, s);
4059
4059
  var O = this;
4060
4060
  p(O), O.q = O.c = "", O.bufferCheckPosition = c.MAX_BUFFER_LENGTH, O.opt = s || {}, O.opt.lowercase = O.opt.lowercase || O.opt.lowercasetags, O.looseCase = O.opt.lowercase ? "toLowerCase" : "toUpperCase", O.tags = [], O.closed = O.closedRoot = O.sawRoot = !1, O.tag = O.error = null, O.strict = !!f, O.noscript = !!(f || O.opt.noscript), O.state = I.BEGIN, O.strictEntities = O.opt.strictEntities, O.ENTITIES = O.strictEntities ? Object.create(c.XML_ENTITIES) : Object.create(c.ENTITIES), O.attribList = [], O.opt.xmlns && (O.ns = Object.create(F)), O.opt.unquotedAttributeValues === void 0 && (O.opt.unquotedAttributeValues = !f), O.trackPosition = O.opt.position !== !1, O.trackPosition && (O.position = O.line = O.column = 0), ze(O, "onready");
4061
4061
  }
@@ -4099,7 +4099,7 @@ function Xo() {
4099
4099
  function y(f) {
4100
4100
  Se(f), f.cdata !== "" && (de(f, "oncdata", f.cdata), f.cdata = ""), f.script !== "" && (de(f, "onscript", f.script), f.script = "");
4101
4101
  }
4102
- i.prototype = {
4102
+ o.prototype = {
4103
4103
  end: function() {
4104
4104
  At(this);
4105
4105
  },
@@ -4132,7 +4132,7 @@ function Xo() {
4132
4132
  function U(f, s) {
4133
4133
  if (!(this instanceof U))
4134
4134
  return new U(f, s);
4135
- C.apply(this), this._parser = new i(f, s), this.writable = !0, this.readable = !0;
4135
+ C.apply(this), this._parser = new o(f, s), this.writable = !0, this.readable = !0;
4136
4136
  var O = this;
4137
4137
  this._parser.onend = function() {
4138
4138
  O.emit("end");
@@ -4549,10 +4549,10 @@ Column: ` + f.column + `
4549
4549
  Char: ` + f.c), s = new Error(s), f.error = s, ze(f, "onerror", s), f;
4550
4550
  }
4551
4551
  function At(f) {
4552
- return f.sawRoot && !f.closedRoot && fe(f, "Unclosed root tag"), f.state !== I.BEGIN && f.state !== I.BEGIN_WHITESPACE && f.state !== I.TEXT && Ve(f, "Unexpected end"), Se(f), f.c = "", f.closed = !0, ze(f, "onend"), i.call(f, f.strict, f.opt), f;
4552
+ return f.sawRoot && !f.closedRoot && fe(f, "Unclosed root tag"), f.state !== I.BEGIN && f.state !== I.BEGIN_WHITESPACE && f.state !== I.TEXT && Ve(f, "Unexpected end"), Se(f), f.c = "", f.closed = !0, ze(f, "onend"), o.call(f, f.strict, f.opt), f;
4553
4553
  }
4554
4554
  function fe(f, s) {
4555
- if (typeof f != "object" || !(f instanceof i))
4555
+ if (typeof f != "object" || !(f instanceof o))
4556
4556
  throw new Error("bad call to strictFail");
4557
4557
  f.strict && Ve(f, s);
4558
4558
  }
@@ -4955,11 +4955,11 @@ function Wo(l) {
4955
4955
  };
4956
4956
  }
4957
4957
  function zo(l) {
4958
- const { node: c, state: u, dialecteConfig: i, useCustomRecordsIds: h } = l, p = { ...u }, y = Jo(c);
4958
+ const { node: c, state: u, dialecteConfig: o, useCustomRecordsIds: h } = l, p = { ...u }, y = Jo(c);
4959
4959
  p.defaultNamespace || (p.defaultNamespace = ei({
4960
4960
  element: c,
4961
- defaultNamespace: i.namespaces.default,
4962
- rootElementName: i.rootElementName
4961
+ defaultNamespace: o.namespaces.default,
4962
+ rootElementName: o.rootElementName
4963
4963
  }));
4964
4964
  const C = ti(c, p.defaultNamespace), R = ai({ attributes: c.attributes, useCustomRecordsIds: h }), P = oi({
4965
4965
  attributes: c.attributes,
@@ -4981,12 +4981,12 @@ function Qo(l) {
4981
4981
  }
4982
4982
  function Ho(l) {
4983
4983
  const { state: c } = l, u = c.stack.at(-1);
4984
- let i = c.stack.slice(0, -1);
4984
+ let o = c.stack.slice(0, -1);
4985
4985
  const h = [...c.recordsBatch];
4986
4986
  if (u) {
4987
- if (i.length) {
4988
- const p = i.length - 1;
4989
- i = i.map(
4987
+ if (o.length) {
4988
+ const p = o.length - 1;
4989
+ o = o.map(
4990
4990
  (y, C) => C === p ? {
4991
4991
  ...y,
4992
4992
  children: [
@@ -5004,7 +5004,7 @@ function Ho(l) {
5004
5004
  return {
5005
5005
  updatedState: {
5006
5006
  defaultNamespace: c.defaultNamespace,
5007
- stack: i,
5007
+ stack: o,
5008
5008
  recordsBatch: h
5009
5009
  }
5010
5010
  };
@@ -5016,10 +5016,10 @@ function Jo(l) {
5016
5016
  return l.local;
5017
5017
  }
5018
5018
  function ei(l) {
5019
- const { element: c, defaultNamespace: u, rootElementName: i } = l;
5019
+ const { element: c, defaultNamespace: u, rootElementName: o } = l;
5020
5020
  return Ee(
5021
- c.name === i,
5022
- `Default namespace can only be set on ${i} element`
5021
+ c.name === o,
5022
+ `Default namespace can only be set on ${o} element`
5023
5023
  ), c.attributes?.xmlns?.value ? {
5024
5024
  prefix: "",
5025
5025
  uri: c.attributes.xmlns.value
@@ -5050,12 +5050,12 @@ function ri(l) {
5050
5050
  return c ? { id: c.id, tagName: c.tagName } : null;
5051
5051
  }
5052
5052
  function ai(l) {
5053
- const { attributes: c, useCustomRecordsIds: u } = l, i = c[da];
5054
- return u && i && i.value ? i.value : crypto.randomUUID();
5053
+ const { attributes: c, useCustomRecordsIds: u } = l, o = c[da];
5054
+ return u && o && o.value ? o.value : crypto.randomUUID();
5055
5055
  }
5056
5056
  function oi(l) {
5057
5057
  const { attributes: c, useCustomRecordsIds: u } = l;
5058
- return u ? Object.values(c).filter((i) => i.name !== da) : Object.values(c);
5058
+ return u ? Object.values(c).filter((o) => o.name !== da) : Object.values(c);
5059
5059
  }
5060
5060
  const na = {
5061
5061
  useBrowserApi: !0,
@@ -5064,7 +5064,7 @@ const na = {
5064
5064
  batchSize: 2e3
5065
5065
  };
5066
5066
  async function ii(l) {
5067
- const { files: c, dialecteConfig: u, useCustomRecordsIds: i = !1 } = l, h = [];
5067
+ const { files: c, dialecteConfig: u, useCustomRecordsIds: o = !1 } = l, h = [];
5068
5068
  if (c.length === 0) throw new Error("No files provided for import.");
5069
5069
  const { importOptions: p = na, supportedFileExtensions: y } = u.io, C = {
5070
5070
  ...na,
@@ -5080,7 +5080,7 @@ async function ii(l) {
5080
5080
  file: R,
5081
5081
  dialecteConfig: u,
5082
5082
  options: C,
5083
- useCustomRecordsIds: i
5083
+ useCustomRecordsIds: o
5084
5084
  });
5085
5085
  h.push(P);
5086
5086
  }
@@ -5088,24 +5088,24 @@ async function ii(l) {
5088
5088
  }
5089
5089
  function si(l) {
5090
5090
  const { file: c, supportedExtensions: u } = l;
5091
- return u.some((i) => c.name.toLowerCase().endsWith(i));
5091
+ return u.some((o) => c.name.toLowerCase().endsWith(o));
5092
5092
  }
5093
5093
  function ui(l) {
5094
5094
  return l.name.replace(/\.[^.]+$/, "");
5095
5095
  }
5096
5096
  async function ci(l) {
5097
- const { file: c, dialecteConfig: u, options: i, useCustomRecordsIds: h } = l, p = ui(c), y = await ga({ databaseName: p, dialecteConfig: u });
5097
+ const { file: c, dialecteConfig: u, options: o, useCustomRecordsIds: h } = l, p = ui(c), y = await ga({ databaseName: p, dialecteConfig: u });
5098
5098
  try {
5099
5099
  const C = u.database.tables.xmlElements.name;
5100
- return await y.table(C).clear(), i.useBrowserApi && c.size !== 0 && await li({
5100
+ return await y.table(C).clear(), o.useBrowserApi && c.size !== 0 && await li({
5101
5101
  file: c,
5102
5102
  databaseInstance: y,
5103
5103
  elementsTableName: C,
5104
5104
  dialecteConfig: u,
5105
5105
  options: {
5106
5106
  useCustomRecordsIds: h,
5107
- chunkSize: i.chunkSize,
5108
- batchSize: i.batchSize
5107
+ chunkSize: o.chunkSize,
5108
+ batchSize: o.batchSize
5109
5109
  }
5110
5110
  }), p;
5111
5111
  } catch (C) {
@@ -5115,13 +5115,13 @@ async function ci(l) {
5115
5115
  }
5116
5116
  }
5117
5117
  async function li(l) {
5118
- const { file: c, databaseInstance: u, elementsTableName: i, dialecteConfig: h, options: p } = l, y = c.stream().getReader(), C = Wo({
5118
+ const { file: c, databaseInstance: u, elementsTableName: o, dialecteConfig: h, options: p } = l, y = c.stream().getReader(), C = Wo({
5119
5119
  dialecteConfig: h,
5120
5120
  useCustomRecordsIds: p.useCustomRecordsIds
5121
5121
  }), R = new TextDecoder(), P = new Uint8Array(0);
5122
5122
  return await mr({
5123
5123
  databaseInstance: u,
5124
- elementsTableName: i,
5124
+ elementsTableName: o,
5125
5125
  reader: y,
5126
5126
  sax: C,
5127
5127
  textDecoder: R,
@@ -5130,7 +5130,7 @@ async function li(l) {
5130
5130
  });
5131
5131
  }
5132
5132
  async function mr(l) {
5133
- const { databaseInstance: c, elementsTableName: u, reader: i, sax: h, textDecoder: p, buffer: y, options: C } = l, { chunkSize: R, batchSize: P } = C, { done: U, value: Y } = await i.read();
5133
+ const { databaseInstance: c, elementsTableName: u, reader: o, sax: h, textDecoder: p, buffer: y, options: C } = l, { chunkSize: R, batchSize: P } = C, { done: U, value: Y } = await o.read();
5134
5134
  if (U) {
5135
5135
  if (y.length > 0) {
5136
5136
  const H = p.decode(y);
@@ -5160,9 +5160,9 @@ async function mr(l) {
5160
5160
  return await mr({ ...l, buffer: z });
5161
5161
  }
5162
5162
  async function ra(l) {
5163
- const { databaseInstance: c, elementsTableName: u, sax: i, batchSize: h } = l;
5164
- if (i.getSize() >= h) {
5165
- const y = i.drainBatch(), C = Lo({
5163
+ const { databaseInstance: c, elementsTableName: u, sax: o, batchSize: h } = l;
5164
+ if (o.getSize() >= h) {
5165
+ const y = o.drainBatch(), C = Lo({
5166
5166
  currentBatch: y
5167
5167
  });
5168
5168
  await jo({
@@ -5174,10 +5174,11 @@ async function ra(l) {
5174
5174
  }
5175
5175
  const va = "_temp-idb-id";
5176
5176
  async function As(l) {
5177
- const { databaseName: c, dialecteConfig: u } = l;
5177
+ const { databaseName: c, extension: u, dialecteConfig: o } = l;
5178
5178
  return _a({
5179
5179
  databaseName: c,
5180
- dialecteConfig: u,
5180
+ extension: u,
5181
+ dialecteConfig: o,
5181
5182
  withDatabaseIds: !1
5182
5183
  });
5183
5184
  }
@@ -5190,26 +5191,26 @@ async function ws(l) {
5190
5191
  });
5191
5192
  }
5192
5193
  async function _a(l) {
5193
- const { databaseName: c, dialecteConfig: u, withDatabaseIds: i } = l, h = new ct(c);
5194
- await h.open();
5194
+ const { databaseName: c, extension: u = "xml", dialecteConfig: o, withDatabaseIds: h } = l, p = new ct(c);
5195
+ await p.open();
5195
5196
  try {
5196
- const p = await fi({
5197
- databaseInstance: h,
5198
- dialecteConfig: u,
5199
- withDatabaseIds: i
5197
+ const y = await fi({
5198
+ databaseInstance: p,
5199
+ dialecteConfig: o,
5200
+ withDatabaseIds: h
5200
5201
  });
5201
- if (!p)
5202
+ if (!y)
5202
5203
  throw new Error("Failed to rebuild XML document from IndexedDB.");
5203
5204
  return {
5204
- xmlDocument: p,
5205
- filename: h.name + ".scd"
5205
+ xmlDocument: y,
5206
+ filename: p.name + u
5206
5207
  };
5207
5208
  } finally {
5208
- h.close();
5209
+ p.close();
5209
5210
  }
5210
5211
  }
5211
5212
  async function fi(l) {
5212
- const { databaseInstance: c, dialecteConfig: u, withDatabaseIds: i } = l, { useBrowserApi: h = !0 } = u.io.exportOptions ?? { useBrowserApi: !0 }, p = u.rootElementName, y = u.namespaces.default, C = u.database.tables.xmlElements.name;
5213
+ const { databaseInstance: c, dialecteConfig: u, withDatabaseIds: o } = l, { useBrowserApi: h = !0 } = u.io.exportOptions ?? { useBrowserApi: !0 }, p = u.rootElementName, y = u.namespaces.default, C = u.database.tables.xmlElements.name;
5213
5214
  if (h) {
5214
5215
  const R = document.implementation.createDocument(
5215
5216
  y.uri,
@@ -5226,11 +5227,11 @@ async function fi(l) {
5226
5227
  element: U,
5227
5228
  attributes: P.attributes,
5228
5229
  isRoot: !0
5229
- }), P.value && (U.textContent = P.value.trim()), i && U.setAttribute(va, P.id), R.appendChild(U), await ba({
5230
+ }), P.value && (U.textContent = P.value.trim()), o && U.setAttribute(va, P.id), R.appendChild(U), await ba({
5230
5231
  databaseInstance: c,
5231
5232
  dialecteConfig: u,
5232
5233
  elementsTableName: C,
5233
- withDatabaseIds: i,
5234
+ withDatabaseIds: o,
5234
5235
  xmlDocument: R,
5235
5236
  databaseRecord: P,
5236
5237
  parentDomElement: U
@@ -5241,14 +5242,14 @@ async function ba(l) {
5241
5242
  const {
5242
5243
  databaseInstance: c,
5243
5244
  dialecteConfig: u,
5244
- elementsTableName: i,
5245
+ elementsTableName: o,
5245
5246
  withDatabaseIds: h,
5246
5247
  xmlDocument: p,
5247
5248
  databaseRecord: y,
5248
5249
  parentDomElement: C
5249
5250
  } = l;
5250
5251
  if (!y.children) return;
5251
- const R = y.children.map((z) => z.id), U = await c.table(i).bulkGet(R);
5252
+ const R = y.children.map((z) => z.id), U = await c.table(o).bulkGet(R);
5252
5253
  mi({
5253
5254
  childrenRecords: U,
5254
5255
  parentRecord: y
@@ -5268,7 +5269,7 @@ async function ba(l) {
5268
5269
  C.appendChild(H), await ba({
5269
5270
  databaseInstance: c,
5270
5271
  dialecteConfig: u,
5271
- elementsTableName: i,
5272
+ elementsTableName: o,
5272
5273
  withDatabaseIds: h,
5273
5274
  xmlDocument: p,
5274
5275
  databaseRecord: z,
@@ -5278,9 +5279,9 @@ async function ba(l) {
5278
5279
  return l.xmlDocument;
5279
5280
  }
5280
5281
  function di(l) {
5281
- const { document: c, record: u, defaultNamespace: i, withDatabaseIds: h } = l;
5282
+ const { document: c, record: u, defaultNamespace: o, withDatabaseIds: h } = l;
5282
5283
  let p;
5283
- return !(u.namespace.uri === i.uri) && u.namespace.prefix && u.namespace.prefix !== "xmlns" ? (Aa({
5284
+ return !(u.namespace.uri === o.uri) && u.namespace.prefix && u.namespace.prefix !== "xmlns" ? (Aa({
5284
5285
  document: c,
5285
5286
  namespace: u.namespace
5286
5287
  }), p = c.createElementNS(
@@ -5289,8 +5290,8 @@ function di(l) {
5289
5290
  )) : p = c.createElementNS(u.namespace.uri, u.tagName), u.attributes && Ca({ document: c, element: p, attributes: u.attributes, isRoot: !1 }), u.value && (p.textContent = u.value.trim()), h && p.setAttribute(va, u.id), p;
5290
5291
  }
5291
5292
  function Ca(l) {
5292
- const { document: c, element: u, attributes: i, isRoot: h } = l;
5293
- for (const p of i)
5293
+ const { document: c, element: u, attributes: o, isRoot: h } = l;
5294
+ for (const p of o)
5294
5295
  if (!pi(p))
5295
5296
  if (wa(p)) {
5296
5297
  const y = p.namespace?.prefix || "";
@@ -5303,18 +5304,18 @@ function Ca(l) {
5303
5304
  } else u.setAttribute(p.name, String(p.value));
5304
5305
  }
5305
5306
  function Aa(l) {
5306
- const { document: c, namespace: u } = l, i = c.documentElement;
5307
- if (!i || !u.prefix || u.prefix === "xmlns") return;
5307
+ const { document: c, namespace: u } = l, o = c.documentElement;
5308
+ if (!o || !u.prefix || u.prefix === "xmlns") return;
5308
5309
  const h = "http://www.w3.org/2000/xmlns/";
5309
- i.getAttributeNS(h, u.prefix) === null && i.setAttributeNS(h, `xmlns:${u.prefix}`, u.uri);
5310
+ o.getAttributeNS(h, u.prefix) === null && o.setAttributeNS(h, `xmlns:${u.prefix}`, u.uri);
5310
5311
  }
5311
5312
  function hi(l) {
5312
- const { parentTagName: c, availableChildren: u, childrenRecords: i } = l, h = [], p = new Set(u[c]);
5313
- if (!p.size) return i;
5313
+ const { parentTagName: c, availableChildren: u, childrenRecords: o } = l, h = [], p = new Set(u[c]);
5314
+ if (!p.size) return o;
5314
5315
  const y = /* @__PURE__ */ new Map(), C = [];
5315
5316
  for (const R of p)
5316
5317
  y.set(R, []);
5317
- for (const R of i)
5318
+ for (const R of o)
5318
5319
  p.has(R.tagName) ? y.get(R.tagName)?.push(R) : C.push(R);
5319
5320
  for (const R of p) {
5320
5321
  const P = y.get(R);
@@ -5323,14 +5324,14 @@ function hi(l) {
5323
5324
  return h.push(...C), h;
5324
5325
  }
5325
5326
  function mi(l) {
5326
- const { childrenRecords: c, parentRecord: u } = l, i = c.map((h, p) => h === void 0 ? p : -1).filter((h) => h !== -1);
5327
- if (i.length > 0) {
5328
- const h = i.map((p) => {
5327
+ const { childrenRecords: c, parentRecord: u } = l, o = c.map((h, p) => h === void 0 ? p : -1).filter((h) => h !== -1);
5328
+ if (o.length > 0) {
5329
+ const h = o.map((p) => {
5329
5330
  const y = u.children[p];
5330
5331
  return `'${y.tagName}' (id: ${y.id})`;
5331
5332
  });
5332
5333
  throw new Error(
5333
- `Database corruption detected: Parent element '${u.tagName}' (id: ${u.id}) references ${i.length} non-existent child record(s): ${h.join(", ")}`
5334
+ `Database corruption detected: Parent element '${u.tagName}' (id: ${u.id}) references ${o.length} non-existent child record(s): ${h.join(", ")}`
5334
5335
  );
5335
5336
  }
5336
5337
  }
@@ -5350,7 +5351,7 @@ function gi() {
5350
5351
  }
5351
5352
  }
5352
5353
  c.ParsingError = u;
5353
- let i;
5354
+ let o;
5354
5355
  function h() {
5355
5356
  return R(!1) || z() || Y() || U() || C();
5356
5357
  }
@@ -5370,7 +5371,7 @@ function gi() {
5370
5371
  }
5371
5372
  if (!oe)
5372
5373
  throw new u("Failed to parse XML", "Root Element not found");
5373
- if (i.xml.length !== 0)
5374
+ if (o.xml.length !== 0)
5374
5375
  throw new u("Failed to parse XML", "Not Well-Formed XML");
5375
5376
  return {
5376
5377
  declaration: te ? te.node : null,
@@ -5386,13 +5387,13 @@ function gi() {
5386
5387
  name: te[1],
5387
5388
  type: "ProcessingInstruction",
5388
5389
  content: ""
5389
- }, oe = i.xml.indexOf("?>");
5390
+ }, oe = o.xml.indexOf("?>");
5390
5391
  if (oe > -1)
5391
- W.content = i.xml.substring(0, oe).trim(), i.xml = i.xml.slice(oe);
5392
+ W.content = o.xml.substring(0, oe).trim(), o.xml = o.xml.slice(oe);
5392
5393
  else
5393
5394
  throw new u("Failed to parse XML", "ProcessingInstruction closing tag not found");
5394
5395
  return F(/\?>/), {
5395
- excluded: i.options.filter(W) === !1,
5396
+ excluded: o.options.filter(W) === !1,
5396
5397
  node: W
5397
5398
  };
5398
5399
  }
@@ -5405,7 +5406,7 @@ function gi() {
5405
5406
  name: W[1],
5406
5407
  attributes: {},
5407
5408
  children: []
5408
- }, pe = te ? !1 : i.options.filter(oe) === !1;
5409
+ }, pe = te ? !1 : o.options.filter(oe) === !1;
5409
5410
  for (; !(J() || ie(">") || ie("?>") || ie("/>")); ) {
5410
5411
  const Re = H();
5411
5412
  if (Re)
@@ -5422,10 +5423,10 @@ function gi() {
5422
5423
  let ae = h();
5423
5424
  for (; ae; )
5424
5425
  ae.excluded || oe.children.push(ae.node), ae = h();
5425
- if (i.options.strictMode) {
5426
+ if (o.options.strictMode) {
5426
5427
  const Re = `</${oe.name}>`;
5427
- if (i.xml.startsWith(Re))
5428
- i.xml = i.xml.slice(Re.length);
5428
+ if (o.xml.startsWith(Re))
5429
+ o.xml = o.xml.slice(Re.length);
5429
5430
  else
5430
5431
  throw new u("Failed to parse XML", `Closing tag not matching "${Re}"`);
5431
5432
  } else
@@ -5443,21 +5444,21 @@ function gi() {
5443
5444
  content: te[0]
5444
5445
  };
5445
5446
  return {
5446
- excluded: i.options.filter(W) === !1,
5447
+ excluded: o.options.filter(W) === !1,
5447
5448
  node: W
5448
5449
  };
5449
5450
  }
5450
5451
  }
5451
5452
  function U() {
5452
- if (i.xml.startsWith("<![CDATA[")) {
5453
- const te = i.xml.indexOf("]]>");
5453
+ if (o.xml.startsWith("<![CDATA[")) {
5454
+ const te = o.xml.indexOf("]]>");
5454
5455
  if (te > -1) {
5455
5456
  const W = te + 3, oe = {
5456
5457
  type: "CDATA",
5457
- content: i.xml.substring(0, W)
5458
+ content: o.xml.substring(0, W)
5458
5459
  };
5459
- return i.xml = i.xml.slice(W), {
5460
- excluded: i.options.filter(oe) === !1,
5460
+ return o.xml = o.xml.slice(W), {
5461
+ excluded: o.options.filter(oe) === !1,
5461
5462
  node: oe
5462
5463
  };
5463
5464
  }
@@ -5471,7 +5472,7 @@ function gi() {
5471
5472
  content: te[0]
5472
5473
  };
5473
5474
  return {
5474
- excluded: i.options.filter(W) === !1,
5475
+ excluded: o.options.filter(W) === !1,
5475
5476
  node: W
5476
5477
  };
5477
5478
  }
@@ -5484,7 +5485,7 @@ function gi() {
5484
5485
  content: te[1]
5485
5486
  };
5486
5487
  return {
5487
- excluded: i.options.filter(W) === !1,
5488
+ excluded: o.options.filter(W) === !1,
5488
5489
  node: W
5489
5490
  };
5490
5491
  }
@@ -5501,20 +5502,20 @@ function gi() {
5501
5502
  return te.replace(/^['"]|['"]$/g, "");
5502
5503
  }
5503
5504
  function F(te) {
5504
- const W = i.xml.match(te);
5505
+ const W = o.xml.match(te);
5505
5506
  if (W)
5506
- return i.xml = i.xml.slice(W[0].length), W;
5507
+ return o.xml = o.xml.slice(W[0].length), W;
5507
5508
  }
5508
5509
  function J() {
5509
- return i.xml.length === 0;
5510
+ return o.xml.length === 0;
5510
5511
  }
5511
5512
  function ie(te) {
5512
- return i.xml.indexOf(te) === 0;
5513
+ return o.xml.indexOf(te) === 0;
5513
5514
  }
5514
5515
  function ye(te, W = {}) {
5515
5516
  te = te.trim();
5516
5517
  const oe = W.filter || (() => !0);
5517
- return i = {
5518
+ return o = {
5518
5519
  xml: te,
5519
5520
  options: Object.assign(Object.assign({}, W), { filter: oe, strictMode: W.strictMode === !0 })
5520
5521
  }, y();
@@ -5529,7 +5530,7 @@ function yi() {
5529
5530
  return M && M.__esModule ? M : { default: M };
5530
5531
  };
5531
5532
  Object.defineProperty(c, "__esModule", { value: !0 });
5532
- const i = u(/* @__PURE__ */ gi());
5533
+ const o = u(/* @__PURE__ */ gi());
5533
5534
  function h(M) {
5534
5535
  if (!M.options.indentation && !M.options.lineSeparator)
5535
5536
  return;
@@ -5604,7 +5605,7 @@ function yi() {
5604
5605
  F.indentation = "indentation" in F ? F.indentation : " ", F.collapseContent = F.collapseContent === !0, F.lineSeparator = "lineSeparator" in F ? F.lineSeparator : `\r
5605
5606
  `, F.whiteSpaceAtEndOfSelfclosingTag = F.whiteSpaceAtEndOfSelfclosingTag === !0, F.throwOnFailure = F.throwOnFailure !== !1;
5606
5607
  try {
5607
- const J = (0, i.default)(M, { filter: F.filter, strictMode: F.strictMode }), ie = { content: "", level: 0, options: F, path: [] };
5608
+ const J = (0, o.default)(M, { filter: F.filter, strictMode: F.strictMode }), ie = { content: "", level: 0, options: F, path: [] };
5608
5609
  return J.declaration && z(J.declaration, ie), J.children.forEach(function(ye) {
5609
5610
  C(ye, ie, !1);
5610
5611
  }), F.lineSeparator ? ie.content.replace(/\r\n/g, `
@@ -5624,7 +5625,7 @@ function Bs(l) {
5624
5625
  return _i(l);
5625
5626
  }
5626
5627
  async function Es(l) {
5627
- const { xmlString: c, dialecteConfig: u = ma } = l, i = `test-${crypto.randomUUID()}.xml`, h = new File([c], i, { type: "text/xml" }), y = (await ii({
5628
+ const { xmlString: c, dialecteConfig: u = ma } = l, o = `test-${crypto.randomUUID()}.xml`, h = new File([c], o, { type: "text/xml" }), y = (await ii({
5628
5629
  files: [h],
5629
5630
  dialecteConfig: u,
5630
5631
  useCustomRecordsIds: !0
@@ -5638,26 +5639,26 @@ async function Es(l) {
5638
5639
  }
5639
5640
  async function Ts(l) {
5640
5641
  const { chain: c, operations: u } = l;
5641
- let i = c;
5642
+ let o = c;
5642
5643
  for (const p of u)
5643
5644
  switch (p.type) {
5644
5645
  case "update":
5645
- i = i.goToElement(p.goTo).update({ attributes: p.attributes, value: p.value });
5646
+ o = o.goToElement(p.goTo).update({ attributes: p.attributes, value: p.value });
5646
5647
  break;
5647
5648
  case "delete":
5648
- i = i.goToElement(p.goTo).delete();
5649
+ o = o.goToElement(p.goTo).delete();
5649
5650
  break;
5650
5651
  case "addChild":
5651
- p.goTo && (i = i.goToElement(p.goTo));
5652
+ p.goTo && (o = o.goToElement(p.goTo));
5652
5653
  const { id: y, tagName: C, attributes: R, namespace: P, value: U, setFocus: Y } = p;
5653
- Y ? i = i.addChild({
5654
+ Y ? o = o.addChild({
5654
5655
  id: y,
5655
5656
  tagName: C,
5656
5657
  attributes: R,
5657
5658
  namespace: P,
5658
5659
  value: U,
5659
5660
  setFocus: !0
5660
- }) : i = i.addChild({
5661
+ }) : o = o.addChild({
5661
5662
  id: y,
5662
5663
  tagName: C,
5663
5664
  attributes: R,
@@ -5667,11 +5668,11 @@ async function Ts(l) {
5667
5668
  });
5668
5669
  break;
5669
5670
  }
5670
- const h = await i.getContext();
5671
- return await i.commit(), h;
5671
+ const h = await o.getContext();
5672
+ return await o.commit(), h;
5672
5673
  }
5673
5674
  function bi(l) {
5674
- const { contextPromise: c, dialecteConfig: u, databaseInstance: i } = l;
5675
+ const { contextPromise: c, dialecteConfig: u, databaseInstance: o } = l;
5675
5676
  return async function() {
5676
5677
  const h = await c;
5677
5678
  Ee(h.currentFocus.parent, "Current element has no parent");
@@ -5680,21 +5681,21 @@ function bi(l) {
5680
5681
  tagName: h.currentFocus.parent.tagName,
5681
5682
  stagedOperations: h.stagedOperations,
5682
5683
  dialecteConfig: u,
5683
- databaseInstance: i,
5684
+ databaseInstance: o,
5684
5685
  type: "chain"
5685
5686
  });
5686
5687
  return Ee(p, "Parent record not found"), p;
5687
5688
  };
5688
5689
  }
5689
5690
  function Ci(l) {
5690
- const { contextPromise: c, dialecteConfig: u, databaseInstance: i } = l;
5691
+ const { contextPromise: c, dialecteConfig: u, databaseInstance: o } = l;
5691
5692
  return async function(h) {
5692
5693
  const p = await c, y = {};
5693
5694
  for (const [C, R] of Object.entries(h)) {
5694
5695
  const U = (await fa({
5695
5696
  context: p,
5696
5697
  dialecteConfig: u,
5697
- databaseInstance: i,
5698
+ databaseInstance: o,
5698
5699
  tagName: C,
5699
5700
  attributes: R
5700
5701
  })).filter((Y) => Y.parent?.tagName === p.currentFocus.tagName && Y.parent?.id === p.currentFocus.id);
@@ -5704,13 +5705,13 @@ function Ci(l) {
5704
5705
  };
5705
5706
  }
5706
5707
  function Ba(l) {
5707
- const { contextPromise: c, dialecteConfig: u, databaseInstance: i } = l;
5708
+ const { contextPromise: c, dialecteConfig: u, databaseInstance: o } = l;
5708
5709
  return async function(h = {}) {
5709
5710
  const { include: p, exclude: y, unwrap: C } = h, R = await c, P = await Ai({
5710
5711
  root: R.currentFocus,
5711
5712
  context: R,
5712
5713
  dialecteConfig: u,
5713
- databaseInstance: i,
5714
+ databaseInstance: o,
5714
5715
  include: p,
5715
5716
  exclude: y
5716
5717
  });
@@ -5718,7 +5719,7 @@ function Ba(l) {
5718
5719
  };
5719
5720
  }
5720
5721
  async function Ai(l) {
5721
- const { root: c, context: u, dialecteConfig: i, databaseInstance: h, include: p, exclude: y } = l;
5722
+ const { root: c, context: u, dialecteConfig: o, databaseInstance: h, include: p, exclude: y } = l;
5722
5723
  async function C(R) {
5723
5724
  const { record: P, includeFilter: U } = R;
5724
5725
  if (wi({ record: P, excludeFilters: y }))
@@ -5726,7 +5727,7 @@ async function Ai(l) {
5726
5727
  const Y = await Ei({
5727
5728
  record: P,
5728
5729
  context: u,
5729
- dialecteConfig: i,
5730
+ dialecteConfig: o,
5730
5731
  databaseInstance: h,
5731
5732
  currentIncludeFilter: U,
5732
5733
  excludeFilters: y
@@ -5743,24 +5744,24 @@ async function Ai(l) {
5743
5744
  }
5744
5745
  function wi(l) {
5745
5746
  const { record: c, excludeFilters: u } = l;
5746
- return u ? u.some((i) => (i.scope ?? "self") !== "children" ? !1 : Rn({ record: c, filter: i })) : !1;
5747
+ return u ? u.some((o) => (o.scope ?? "self") !== "children" ? !1 : Rn({ record: c, filter: o })) : !1;
5747
5748
  }
5748
5749
  function Bi(l) {
5749
5750
  const { record: c, excludeFilters: u } = l;
5750
- return u ? u.some((i) => (i.scope ?? "self") !== "self" ? !1 : Rn({ record: c, filter: i })) : !1;
5751
+ return u ? u.some((o) => (o.scope ?? "self") !== "self" ? !1 : Rn({ record: c, filter: o })) : !1;
5751
5752
  }
5752
5753
  async function Ei(l) {
5753
5754
  const {
5754
5755
  record: c,
5755
5756
  context: u,
5756
- dialecteConfig: i,
5757
+ dialecteConfig: o,
5757
5758
  databaseInstance: h,
5758
5759
  currentIncludeFilter: p,
5759
5760
  excludeFilters: y
5760
5761
  } = l, R = (await Ti({
5761
5762
  record: c,
5762
5763
  context: u,
5763
- dialecteConfig: i,
5764
+ dialecteConfig: o,
5764
5765
  databaseInstance: h
5765
5766
  })).filter(
5766
5767
  (P) => !Bi({ record: P, excludeFilters: y })
@@ -5768,14 +5769,14 @@ async function Ei(l) {
5768
5769
  return xi({ children: R, currentIncludeFilter: p });
5769
5770
  }
5770
5771
  async function Ti(l) {
5771
- const { record: c, context: u, dialecteConfig: i, databaseInstance: h } = l;
5772
+ const { record: c, context: u, dialecteConfig: o, databaseInstance: h } = l;
5772
5773
  return c.children?.length ? (await Promise.all(
5773
5774
  c.children.map(
5774
5775
  (y) => We({
5775
5776
  id: y.id,
5776
5777
  tagName: y.tagName,
5777
5778
  stagedOperations: u.stagedOperations,
5778
- dialecteConfig: i,
5779
+ dialecteConfig: o,
5779
5780
  databaseInstance: h,
5780
5781
  type: "chain"
5781
5782
  })
@@ -5788,12 +5789,12 @@ function xi(l) {
5788
5789
  const { children: c, currentIncludeFilter: u } = l;
5789
5790
  if (!u)
5790
5791
  return c.map((h) => ({ record: h, includeFilter: void 0 }));
5791
- const i = c.filter(
5792
+ const o = c.filter(
5792
5793
  (h) => Rn({ record: h, filter: u })
5793
5794
  );
5794
5795
  if (u.children && u.children.length > 0) {
5795
5796
  const h = [];
5796
- for (const p of i) {
5797
+ for (const p of o) {
5797
5798
  const y = Ni({
5798
5799
  child: p,
5799
5800
  branches: u.children
@@ -5802,11 +5803,11 @@ function xi(l) {
5802
5803
  }
5803
5804
  return h;
5804
5805
  }
5805
- return i.map((h) => ({ record: h, includeFilter: void 0 }));
5806
+ return o.map((h) => ({ record: h, includeFilter: void 0 }));
5806
5807
  }
5807
5808
  function Ni(l) {
5808
5809
  const { child: c, branches: u } = l;
5809
- return u.find((i) => Rn({ record: c, filter: i }));
5810
+ return u.find((o) => Rn({ record: c, filter: o }));
5810
5811
  }
5811
5812
  function Rn(l) {
5812
5813
  const { record: c, filter: u } = l;
@@ -5814,17 +5815,17 @@ function Rn(l) {
5814
5815
  }
5815
5816
  function Oi(l) {
5816
5817
  const { tree: c, unwrapTagNames: u } = l;
5817
- function i(h) {
5818
- return h.flatMap((p) => u.includes(p.tagName) ? i(p.tree) : [
5818
+ function o(h) {
5819
+ return h.flatMap((p) => u.includes(p.tagName) ? o(p.tree) : [
5819
5820
  {
5820
5821
  ...p,
5821
- tree: i(p.tree)
5822
+ tree: o(p.tree)
5822
5823
  }
5823
5824
  ]);
5824
5825
  }
5825
5826
  return {
5826
5827
  ...c,
5827
- tree: i(c.tree)
5828
+ tree: o(c.tree)
5828
5829
  };
5829
5830
  }
5830
5831
  function Ea(l) {
@@ -5842,18 +5843,18 @@ function Ta(l) {
5842
5843
  }
5843
5844
  function Ri(l) {
5844
5845
  const c = [];
5845
- function u(i) {
5846
- if (i.tree?.length)
5847
- for (const h of i.tree)
5846
+ function u(o) {
5847
+ if (o.tree?.length)
5848
+ for (const h of o.tree)
5848
5849
  c.push(h), u(h);
5849
5850
  }
5850
5851
  return u(l), c;
5851
5852
  }
5852
5853
  function Ii(l) {
5853
5854
  const c = /* @__PURE__ */ new Map();
5854
- for (const [u, i] of l.entries()) {
5855
+ for (const [u, o] of l.entries()) {
5855
5856
  const h = /* @__PURE__ */ new Map();
5856
- for (const p of i)
5857
+ for (const p of o)
5857
5858
  h.set(p.id, p);
5858
5859
  c.set(u, Array.from(h.values()));
5859
5860
  }
@@ -5861,19 +5862,19 @@ function Ii(l) {
5861
5862
  }
5862
5863
  function Di(l, c) {
5863
5864
  const u = {};
5864
- for (const i of c)
5865
- u[i] = l.get(i) || [];
5865
+ for (const o of c)
5866
+ u[o] = l.get(o) || [];
5866
5867
  return u;
5867
5868
  }
5868
5869
  async function Pi(l) {
5869
- const { context: c, dialecteConfig: u, databaseInstance: i, candidates: h, focus: p, path: y, collectTags: C } = l, R = /* @__PURE__ */ new Map();
5870
+ const { context: c, dialecteConfig: u, databaseInstance: o, candidates: h, focus: p, path: y, collectTags: C } = l, R = /* @__PURE__ */ new Map();
5870
5871
  for (const U of h) {
5871
5872
  const Y = await Si({
5872
5873
  candidate: U,
5873
5874
  focus: p,
5874
5875
  context: c,
5875
5876
  dialecteConfig: u,
5876
- databaseInstance: i,
5877
+ databaseInstance: o,
5877
5878
  path: y,
5878
5879
  shouldCollect: !0
5879
5880
  });
@@ -5883,11 +5884,11 @@ async function Pi(l) {
5883
5884
  return Di(P, C);
5884
5885
  }
5885
5886
  async function Si(l) {
5886
- const { candidate: c, focus: u, context: i, dialecteConfig: h, databaseInstance: p, path: y, shouldCollect: C } = l;
5887
+ const { candidate: c, focus: u, context: o, dialecteConfig: h, databaseInstance: p, path: y, shouldCollect: C } = l;
5887
5888
  return c.id === u.id ? { valid: !1 } : y ? Fi({
5888
5889
  candidate: c,
5889
5890
  focus: u,
5890
- context: i,
5891
+ context: o,
5891
5892
  dialecteConfig: h,
5892
5893
  databaseInstance: p,
5893
5894
  path: y,
@@ -5895,27 +5896,27 @@ async function Si(l) {
5895
5896
  }) : ki({
5896
5897
  candidate: c,
5897
5898
  focus: u,
5898
- context: i,
5899
+ context: o,
5899
5900
  dialecteConfig: h,
5900
5901
  databaseInstance: p
5901
5902
  });
5902
5903
  }
5903
5904
  async function ki(l) {
5904
- const { candidate: c, focus: u, context: i, dialecteConfig: h, databaseInstance: p } = l;
5905
+ const { candidate: c, focus: u, context: o, dialecteConfig: h, databaseInstance: p } = l;
5905
5906
  let y = c.parent;
5906
5907
  for (; y; ) {
5907
5908
  if (y.id === u.id && y.tagName === u.tagName)
5908
5909
  return { valid: !0, ancestors: await ji({
5909
5910
  from: c,
5910
5911
  toFocus: u,
5911
- context: i,
5912
+ context: o,
5912
5913
  dialecteConfig: h,
5913
5914
  databaseInstance: p
5914
5915
  }) };
5915
5916
  const C = await We({
5916
5917
  id: y.id,
5917
5918
  tagName: y.tagName,
5918
- stagedOperations: i.stagedOperations,
5919
+ stagedOperations: o.stagedOperations,
5919
5920
  dialecteConfig: h,
5920
5921
  databaseInstance: p,
5921
5922
  type: "raw"
@@ -5926,13 +5927,13 @@ async function ki(l) {
5926
5927
  return { valid: !1 };
5927
5928
  }
5928
5929
  async function Fi(l) {
5929
- const { candidate: c, focus: u, context: i, dialecteConfig: h, databaseInstance: p, path: y, shouldCollect: C } = l, R = C ? [c] : [];
5930
+ const { candidate: c, focus: u, context: o, dialecteConfig: h, databaseInstance: p, path: y, shouldCollect: C } = l, R = C ? [c] : [];
5930
5931
  let P = c.parent;
5931
5932
  for (let Y = y.length - 1; Y >= 0; Y--) {
5932
5933
  const z = y[Y], H = await Mi({
5933
5934
  current: P,
5934
5935
  expected: z,
5935
- context: i,
5936
+ context: o,
5936
5937
  dialecteConfig: h,
5937
5938
  databaseInstance: p
5938
5939
  });
@@ -5942,14 +5943,14 @@ async function Fi(l) {
5942
5943
  return { valid: P?.id === u.id && P?.tagName === u.tagName, ancestors: C ? R : void 0 };
5943
5944
  }
5944
5945
  async function Mi(l) {
5945
- const { current: c, expected: u, context: i, dialecteConfig: h, databaseInstance: p } = l;
5946
+ const { current: c, expected: u, context: o, dialecteConfig: h, databaseInstance: p } = l;
5946
5947
  let y = c;
5947
5948
  for (; y; ) {
5948
5949
  if (y.tagName !== u.tagName) {
5949
5950
  y = (await We({
5950
5951
  id: y.id,
5951
5952
  tagName: y.tagName,
5952
- stagedOperations: i.stagedOperations,
5953
+ stagedOperations: o.stagedOperations,
5953
5954
  dialecteConfig: h,
5954
5955
  databaseInstance: p,
5955
5956
  type: "raw"
@@ -5960,7 +5961,7 @@ async function Mi(l) {
5960
5961
  const P = await We({
5961
5962
  id: y.id,
5962
5963
  tagName: y.tagName,
5963
- stagedOperations: i.stagedOperations,
5964
+ stagedOperations: o.stagedOperations,
5964
5965
  dialecteConfig: h,
5965
5966
  databaseInstance: p,
5966
5967
  type: "chain"
@@ -5970,7 +5971,7 @@ async function Mi(l) {
5970
5971
  const R = await We({
5971
5972
  id: y.id,
5972
5973
  tagName: y.tagName,
5973
- stagedOperations: i.stagedOperations,
5974
+ stagedOperations: o.stagedOperations,
5974
5975
  dialecteConfig: h,
5975
5976
  databaseInstance: p,
5976
5977
  type: "chain"
@@ -5980,13 +5981,13 @@ async function Mi(l) {
5980
5981
  return { found: !1 };
5981
5982
  }
5982
5983
  async function ji(l) {
5983
- const { from: c, toFocus: u, context: i, dialecteConfig: h, databaseInstance: p } = l, y = [c];
5984
+ const { from: c, toFocus: u, context: o, dialecteConfig: h, databaseInstance: p } = l, y = [c];
5984
5985
  let C = c.parent;
5985
5986
  for (; C && !(C.id === u.id && C.tagName === u.tagName); ) {
5986
5987
  const R = await We({
5987
5988
  id: C.id,
5988
5989
  tagName: C.tagName,
5989
- stagedOperations: i.stagedOperations,
5990
+ stagedOperations: o.stagedOperations,
5990
5991
  dialecteConfig: h,
5991
5992
  databaseInstance: p,
5992
5993
  type: "chain"
@@ -5999,29 +6000,29 @@ async function ji(l) {
5999
6000
  return y;
6000
6001
  }
6001
6002
  function Ki(l, c, u) {
6002
- for (const i of l)
6003
- c.has(i.tagName) && (u.has(i.tagName) || u.set(i.tagName, []), u.get(i.tagName).push(i));
6003
+ for (const o of l)
6004
+ c.has(o.tagName) && (u.has(o.tagName) || u.set(o.tagName, []), u.get(o.tagName).push(o));
6004
6005
  }
6005
6006
  function qi(l) {
6006
- const { contextPromise: c, dialecteConfig: u, databaseInstance: i } = l;
6007
+ const { contextPromise: c, dialecteConfig: u, databaseInstance: o } = l;
6007
6008
  async function h(p) {
6008
6009
  const y = await c;
6009
6010
  return p ? Ui({
6010
6011
  context: y,
6011
6012
  dialecteConfig: u,
6012
- databaseInstance: i,
6013
+ databaseInstance: o,
6013
6014
  filter: p
6014
6015
  }) : Li({
6015
6016
  contextPromise: c,
6016
6017
  dialecteConfig: u,
6017
- databaseInstance: i,
6018
+ databaseInstance: o,
6018
6019
  currentElement: y.currentFocus.tagName
6019
6020
  });
6020
6021
  }
6021
6022
  return h;
6022
6023
  }
6023
6024
  async function Li(l) {
6024
- const { contextPromise: c, dialecteConfig: u, databaseInstance: i, currentElement: h } = l, y = await Ba({ contextPromise: c, dialecteConfig: u, databaseInstance: i })(), C = Ri(y), R = [h, ...u.descendants[h]], P = {};
6025
+ const { contextPromise: c, dialecteConfig: u, databaseInstance: o, currentElement: h } = l, y = await Ba({ contextPromise: c, dialecteConfig: u, databaseInstance: o })(), C = Ri(y), R = [h, ...u.descendants[h]], P = {};
6025
6026
  for (const U of R)
6026
6027
  P[U] = [];
6027
6028
  for (const U of C)
@@ -6029,17 +6030,17 @@ async function Li(l) {
6029
6030
  return P;
6030
6031
  }
6031
6032
  async function Ui(l) {
6032
- const { context: c, dialecteConfig: u, databaseInstance: i, filter: h } = l, p = new Set(Ta(h)), y = Ea(h), C = y[y.length - 1], R = y.slice(0, -1), P = await fa({
6033
+ const { context: c, dialecteConfig: u, databaseInstance: o, filter: h } = l, p = new Set(Ta(h)), y = Ea(h), C = y[y.length - 1], R = y.slice(0, -1), P = await fa({
6033
6034
  context: c,
6034
6035
  dialecteConfig: u,
6035
- databaseInstance: i,
6036
+ databaseInstance: o,
6036
6037
  tagName: C.tagName,
6037
6038
  attributes: C.attributes
6038
6039
  });
6039
6040
  return await Pi({
6040
6041
  context: c,
6041
6042
  dialecteConfig: u,
6042
- databaseInstance: i,
6043
+ databaseInstance: o,
6043
6044
  candidates: P,
6044
6045
  focus: c.currentFocus,
6045
6046
  path: R.length > 0 ? R : void 0,
@@ -6048,21 +6049,21 @@ async function Ui(l) {
6048
6049
  }
6049
6050
  function $i(l) {
6050
6051
  const c = /* @__PURE__ */ new Map();
6051
- for (const i of l) {
6052
- const h = (i.status === "deleted" ? i.oldRecord : i.newRecord).id, p = c.get(h);
6052
+ for (const o of l) {
6053
+ const h = (o.status === "deleted" ? o.oldRecord : o.newRecord).id, p = c.get(h);
6053
6054
  if (!p) {
6054
- c.set(h, i);
6055
+ c.set(h, o);
6055
6056
  continue;
6056
6057
  }
6057
- p.status === "created" ? i.status === "updated" ? c.set(h, {
6058
+ p.status === "created" ? o.status === "updated" ? c.set(h, {
6058
6059
  status: "created",
6059
6060
  oldRecord: void 0,
6060
- newRecord: i.newRecord
6061
- }) : i.status === "deleted" && c.delete(h) : p.status === "updated" && (i.status === "updated" ? c.set(h, {
6061
+ newRecord: o.newRecord
6062
+ }) : o.status === "deleted" && c.delete(h) : p.status === "updated" && (o.status === "updated" ? c.set(h, {
6062
6063
  status: "updated",
6063
6064
  oldRecord: p.oldRecord,
6064
- newRecord: i.newRecord
6065
- }) : i.status === "deleted" && c.set(h, {
6065
+ newRecord: o.newRecord
6066
+ }) : o.status === "deleted" && c.set(h, {
6066
6067
  status: "deleted",
6067
6068
  oldRecord: p.oldRecord,
6068
6069
  newRecord: void 0
@@ -6070,9 +6071,9 @@ function $i(l) {
6070
6071
  }
6071
6072
  const u = Array.from(c.values());
6072
6073
  return {
6073
- creates: u.filter((i) => i.status === "created"),
6074
- updates: u.filter((i) => i.status === "updated"),
6075
- deletes: u.filter((i) => i.status === "deleted")
6074
+ creates: u.filter((o) => o.status === "created"),
6075
+ updates: u.filter((o) => o.status === "updated"),
6076
+ deletes: u.filter((o) => o.status === "deleted")
6076
6077
  };
6077
6078
  }
6078
6079
  const Vi = {
@@ -6120,12 +6121,12 @@ const Vi = {
6120
6121
  // 500-599: Flavor configuration errors
6121
6122
  };
6122
6123
  function xa(l) {
6123
- const { errorKey: c, messageOverride: u, context: i } = l, { code: h, message: p } = Vi[c], y = new Error(u ?? p);
6124
- return y.code = h, y.errorKey = c, y.defaultMessage = p, y.context = i, y;
6124
+ const { errorKey: c, messageOverride: u, context: o } = l, { code: h, message: p } = Vi[c], y = new Error(u ?? p);
6125
+ return y.code = h, y.errorKey = c, y.defaultMessage = p, y.context = o, y;
6125
6126
  }
6126
6127
  function Gi(l) {
6127
6128
  return async function() {
6128
- const { contextPromise: u, dialecteConfig: i, databaseInstance: h } = l, p = i.database.tables.xmlElements.name, y = h.table(p), C = structuredClone(await u), { creates: R, updates: P, deletes: U } = $i(C.stagedOperations), Y = R.length + P.length + U.length;
6129
+ const { contextPromise: u, dialecteConfig: o, databaseInstance: h } = l, p = o.database.tables.xmlElements.name, y = h.table(p), C = structuredClone(await u), { creates: R, updates: P, deletes: U } = $i(C.stagedOperations), Y = R.length + P.length + U.length;
6129
6130
  st.updateEndingProgress({
6130
6131
  current: 0,
6131
6132
  total: Y,
@@ -6163,7 +6164,7 @@ function Gi(l) {
6163
6164
  };
6164
6165
  }
6165
6166
  function Xi(l) {
6166
- const { chain: c, contextPromise: u, dialecteConfig: i } = l;
6167
+ const { chain: c, contextPromise: u, dialecteConfig: o } = l;
6167
6168
  return function(h) {
6168
6169
  const { id: p, tagName: y, attributes: C, namespace: R, value: P, setFocus: U = !1 } = h, Y = p ?? crypto.randomUUID(), z = u.then((H) => {
6169
6170
  try {
@@ -6176,11 +6177,11 @@ function Xi(l) {
6176
6177
  namespace: R,
6177
6178
  value: P
6178
6179
  },
6179
- dialecteConfig: i
6180
+ dialecteConfig: o
6180
6181
  }), { childRecord: F, updatedParent: J } = Yi({
6181
6182
  record: M,
6182
6183
  context: H,
6183
- dialecteConfig: i
6184
+ dialecteConfig: o
6184
6185
  });
6185
6186
  return U ? {
6186
6187
  ...H,
@@ -6211,7 +6212,7 @@ function Xi(l) {
6211
6212
  };
6212
6213
  }
6213
6214
  function Yi(l) {
6214
- const { record: c, context: u, dialecteConfig: i } = l, h = {
6215
+ const { record: c, context: u, dialecteConfig: o } = l, h = {
6215
6216
  ...c,
6216
6217
  parent: { id: u.currentFocus.id, tagName: u.currentFocus.tagName },
6217
6218
  children: []
@@ -6232,8 +6233,8 @@ function Yi(l) {
6232
6233
  status: "updated",
6233
6234
  oldRecord: u.currentFocus,
6234
6235
  newRecord: p
6235
- }), i.hooks?.afterCreated) {
6236
- const y = i.hooks.afterCreated({
6236
+ }), o.hooks?.afterCreated) {
6237
+ const y = o.hooks.afterCreated({
6237
6238
  childRecord: h,
6238
6239
  parentRecord: u.currentFocus,
6239
6240
  context: u
@@ -6253,8 +6254,8 @@ function Yi(l) {
6253
6254
  }
6254
6255
  function Wi(l) {
6255
6256
  const { chain: c, contextPromise: u } = l;
6256
- return function(i) {
6257
- const { record: h, setFocus: p } = i, y = u.then(async (C) => {
6257
+ return function(o) {
6258
+ const { record: h, setFocus: p } = o, y = u.then(async (C) => {
6258
6259
  const R = c({
6259
6260
  contextPromise: Promise.resolve(C)
6260
6261
  });
@@ -6285,7 +6286,7 @@ function Wi(l) {
6285
6286
  };
6286
6287
  }
6287
6288
  function zi(l) {
6288
- const { chain: c, contextPromise: u, dialecteConfig: i } = l;
6289
+ const { chain: c, contextPromise: u, dialecteConfig: o } = l;
6289
6290
  return function(h) {
6290
6291
  const { attributes: p, value: y } = h, C = u.then(async (R) => {
6291
6292
  const P = R.currentFocus;
@@ -6294,7 +6295,7 @@ function zi(l) {
6294
6295
  const z = ca({
6295
6296
  tagName: P.tagName,
6296
6297
  attributes: p,
6297
- dialecteConfig: i
6298
+ dialecteConfig: o
6298
6299
  });
6299
6300
  U = [...P.attributes.filter(
6300
6301
  (M) => !z.some((F) => F.name === M.name)
@@ -6319,7 +6320,7 @@ function zi(l) {
6319
6320
  };
6320
6321
  }
6321
6322
  function Qi(l) {
6322
- const { chain: c, contextPromise: u, dialecteConfig: i, databaseInstance: h } = l;
6323
+ const { chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h } = l;
6323
6324
  return function() {
6324
6325
  const p = u.then(async (y) => {
6325
6326
  const C = y.currentFocus;
@@ -6329,13 +6330,13 @@ function Qi(l) {
6329
6330
  record: C
6330
6331
  }), await Na({
6331
6332
  context: y,
6332
- dialecteConfig: i,
6333
+ dialecteConfig: o,
6333
6334
  databaseInstance: h,
6334
6335
  currentChild: C
6335
6336
  });
6336
6337
  const R = await Hi({
6337
6338
  context: y,
6338
- dialecteConfig: i,
6339
+ dialecteConfig: o,
6339
6340
  databaseInstance: h
6340
6341
  });
6341
6342
  return {
@@ -6349,19 +6350,19 @@ function Qi(l) {
6349
6350
  };
6350
6351
  }
6351
6352
  async function Na(l) {
6352
- const { context: c, dialecteConfig: u, databaseInstance: i, currentChild: h } = l;
6353
+ const { context: c, dialecteConfig: u, databaseInstance: o, currentChild: h } = l;
6353
6354
  for (const p of h.children) {
6354
6355
  const y = await We({
6355
6356
  id: p.id,
6356
6357
  tagName: p.tagName,
6357
6358
  stagedOperations: c.stagedOperations,
6358
6359
  dialecteConfig: u,
6359
- databaseInstance: i
6360
+ databaseInstance: o
6360
6361
  });
6361
6362
  y && (y.children?.length > 0 && await Na({
6362
6363
  context: c,
6363
6364
  dialecteConfig: u,
6364
- databaseInstance: i,
6365
+ databaseInstance: o,
6365
6366
  currentChild: y
6366
6367
  }), ut({
6367
6368
  context: c,
@@ -6371,14 +6372,14 @@ async function Na(l) {
6371
6372
  }
6372
6373
  }
6373
6374
  async function Hi(l) {
6374
- const { context: c, dialecteConfig: u, databaseInstance: i } = l, h = c.currentFocus.parent;
6375
+ const { context: c, dialecteConfig: u, databaseInstance: o } = l, h = c.currentFocus.parent;
6375
6376
  Ee(h, "Cannot delete root element");
6376
6377
  const p = await We({
6377
6378
  id: h.id,
6378
6379
  tagName: h.tagName,
6379
6380
  stagedOperations: c.stagedOperations,
6380
6381
  dialecteConfig: u,
6381
- databaseInstance: i
6382
+ databaseInstance: o
6382
6383
  });
6383
6384
  Ee(p, "Parent record not found");
6384
6385
  const y = {
@@ -6393,10 +6394,10 @@ async function Hi(l) {
6393
6394
  }), Pe({ record: y, status: "updated" });
6394
6395
  }
6395
6396
  function Zi(l) {
6396
- const { chain: c, contextPromise: u, dialecteConfig: i, databaseInstance: h } = l;
6397
+ const { chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h } = l;
6397
6398
  return function(y) {
6398
- const { tagName: C, id: R } = y, P = i.database.tables.xmlElements.name, U = u.then(async (Y) => {
6399
- const z = i.singletonElements?.includes(C), H = R ? yr({
6399
+ const { tagName: C, id: R } = y, P = o.database.tables.xmlElements.name, U = u.then(async (Y) => {
6400
+ const z = o.singletonElements?.includes(C), H = R ? yr({
6400
6401
  stagedOperations: Y.stagedOperations,
6401
6402
  id: R,
6402
6403
  tagName: C
@@ -6425,7 +6426,7 @@ function Zi(l) {
6425
6426
  };
6426
6427
  }
6427
6428
  function Ji(l) {
6428
- const { chain: c, contextPromise: u, dialecteConfig: i, databaseInstance: h } = l;
6429
+ const { chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h } = l;
6429
6430
  return function() {
6430
6431
  const y = u.then(async (C) => {
6431
6432
  const R = C.currentFocus.parent;
@@ -6439,7 +6440,7 @@ function Ji(l) {
6439
6440
  if (P)
6440
6441
  U = P.record;
6441
6442
  else {
6442
- const Y = i.database.tables.xmlElements.name, z = await h.table(Y).get({
6443
+ const Y = o.database.tables.xmlElements.name, z = await h.table(Y).get({
6443
6444
  id: R.id,
6444
6445
  tagName: R.tagName
6445
6446
  });
@@ -6454,37 +6455,37 @@ function Ji(l) {
6454
6455
  };
6455
6456
  }
6456
6457
  function es(l) {
6457
- const { chain: c, contextPromise: u, dialecteConfig: i, databaseInstance: h } = l;
6458
+ const { chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h } = l;
6458
6459
  return {
6459
6460
  //== Navigation
6460
6461
  goToElement: Zi({
6461
6462
  chain: c,
6462
6463
  contextPromise: u,
6463
- dialecteConfig: i,
6464
+ dialecteConfig: o,
6464
6465
  databaseInstance: h
6465
6466
  }),
6466
- goToParent: Ji({ chain: c, contextPromise: u, dialecteConfig: i, databaseInstance: h }),
6467
+ goToParent: Ji({ chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h }),
6467
6468
  //== Queries
6468
6469
  findChildren: Ci({
6469
6470
  contextPromise: u,
6470
- dialecteConfig: i,
6471
+ dialecteConfig: o,
6471
6472
  databaseInstance: h
6472
6473
  }),
6473
6474
  findDescendants: qi({
6474
6475
  contextPromise: u,
6475
- dialecteConfig: i,
6476
+ dialecteConfig: o,
6476
6477
  databaseInstance: h
6477
6478
  }),
6478
6479
  getTree: Ba({
6479
6480
  contextPromise: u,
6480
- dialecteConfig: i,
6481
+ dialecteConfig: o,
6481
6482
  databaseInstance: h
6482
6483
  }),
6483
6484
  //== Mutations
6484
6485
  addChild: Xi({
6485
6486
  chain: c,
6486
6487
  contextPromise: u,
6487
- dialecteConfig: i
6488
+ dialecteConfig: o
6488
6489
  }),
6489
6490
  deepCloneChild: Wi({
6490
6491
  chain: c,
@@ -6493,12 +6494,12 @@ function es(l) {
6493
6494
  update: zi({
6494
6495
  chain: c,
6495
6496
  contextPromise: u,
6496
- dialecteConfig: i
6497
+ dialecteConfig: o
6497
6498
  }),
6498
6499
  delete: Qi({
6499
6500
  chain: c,
6500
6501
  contextPromise: u,
6501
- dialecteConfig: i,
6502
+ dialecteConfig: o,
6502
6503
  databaseInstance: h
6503
6504
  }),
6504
6505
  //== Endings
@@ -6507,28 +6508,28 @@ function es(l) {
6507
6508
  }),
6508
6509
  getParent: bi({
6509
6510
  contextPromise: u,
6510
- dialecteConfig: i,
6511
+ dialecteConfig: o,
6511
6512
  databaseInstance: h
6512
6513
  }),
6513
6514
  commit: Gi({
6514
6515
  contextPromise: u,
6515
- dialecteConfig: i,
6516
+ dialecteConfig: o,
6516
6517
  databaseInstance: h
6517
6518
  })
6518
6519
  };
6519
6520
  }
6520
6521
  function ts(l) {
6521
- const { coreChain: c, tagName: u, chain: i, dialecteConfig: h, contextPromise: p } = l, y = { ...c }, C = h.extensions[u] || {};
6522
+ const { coreChain: c, tagName: u, chain: o, dialecteConfig: h, contextPromise: p } = l, y = { ...c }, C = h.extensions[u] || {};
6522
6523
  for (const [R, P] of Object.entries(C))
6523
6524
  y[R] = P({
6524
- chain: i,
6525
+ chain: o,
6525
6526
  dialecteConfig: h,
6526
6527
  contextPromise: p
6527
6528
  });
6528
6529
  return y;
6529
6530
  }
6530
6531
  function vr(l) {
6531
- const { dialecteConfig: c, databaseInstance: u, contextPromise: i, tagName: h } = l;
6532
+ const { dialecteConfig: c, databaseInstance: u, contextPromise: o, tagName: h } = l;
6532
6533
  function p(C) {
6533
6534
  const { contextPromise: R } = C;
6534
6535
  return vr({
@@ -6542,14 +6543,14 @@ function vr(l) {
6542
6543
  chain: p,
6543
6544
  dialecteConfig: c,
6544
6545
  databaseInstance: u,
6545
- contextPromise: i
6546
+ contextPromise: o
6546
6547
  });
6547
6548
  return ts({
6548
6549
  coreChain: y,
6549
6550
  tagName: h,
6550
6551
  chain: p,
6551
6552
  dialecteConfig: c,
6552
- contextPromise: i
6553
+ contextPromise: o
6553
6554
  });
6554
6555
  }
6555
6556
  export {