@dialecte/core 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,23 +1,23 @@
1
1
  import { t as qe, i as Ge } from "./index-B1qiHOqL.js";
2
- import { g as fr, l as me, o as dr, k as ur, s as ai, t as ii, C as da, m as ha } from "./merge-extensions-D-JNgVJ8.js";
2
+ import { g as fr, l as me, o as dr, k as ur, s as ii, t as oi, C as ha, m as pa } from "./merge-extensions-D-JNgVJ8.js";
3
3
  function cr(p, o) {
4
4
  if (!p) return {};
5
5
  const c = {};
6
- for (const i of Object.keys(p)) {
7
- const f = p[i], d = {};
6
+ for (const a of Object.keys(p)) {
7
+ const f = p[a], d = {};
8
8
  for (const g of Object.keys(f)) {
9
9
  const v = f[g];
10
10
  d[g] = (...D) => v(o, ...D);
11
11
  }
12
- c[i] = d;
12
+ c[a] = d;
13
13
  }
14
14
  return c;
15
15
  }
16
- function oi(p) {
17
- const { stagedOperations: o, tagName: c, id: i } = p;
16
+ function si(p) {
17
+ const { stagedOperations: o, tagName: c, id: a } = p;
18
18
  for (let f = o.length - 1; f >= 0; f--) {
19
19
  const d = o[f];
20
- if (i === void 0) {
20
+ if (a === void 0) {
21
21
  if ((d.status === "created" || d.status === "updated") && fr(d.newRecord, c))
22
22
  return {
23
23
  ...d.newRecord,
@@ -30,31 +30,31 @@ function oi(p) {
30
30
  };
31
31
  continue;
32
32
  }
33
- if (d.status === "created" && d.newRecord.id === i) {
33
+ if (d.status === "created" && d.newRecord.id === a) {
34
34
  const g = d.newRecord.tagName;
35
35
  return g !== c && qe("ELEMENT_TAGNAME_MISMATCH", {
36
- detail: `Expected tagName '${c}', got '${g}' for id '${i}'`,
37
- ref: { tagName: c, id: i }
36
+ detail: `Expected tagName '${c}', got '${g}' for id '${a}'`,
37
+ ref: { tagName: c, id: a }
38
38
  }), {
39
39
  ...d.newRecord,
40
40
  status: "created"
41
41
  };
42
42
  }
43
- if (d.status === "updated" && d.newRecord.id === i) {
43
+ if (d.status === "updated" && d.newRecord.id === a) {
44
44
  const g = d.newRecord.tagName;
45
45
  return g !== c && qe("ELEMENT_TAGNAME_MISMATCH", {
46
- detail: `Expected tagName '${c}', got '${g}' for id '${i}'`,
47
- ref: { tagName: c, id: i }
46
+ detail: `Expected tagName '${c}', got '${g}' for id '${a}'`,
47
+ ref: { tagName: c, id: a }
48
48
  }), {
49
49
  ...d.newRecord,
50
50
  status: "updated"
51
51
  };
52
52
  }
53
- if (d.status === "deleted" && d.oldRecord.id === i) {
53
+ if (d.status === "deleted" && d.oldRecord.id === a) {
54
54
  const g = d.oldRecord.tagName;
55
55
  return g !== c && qe("ELEMENT_TAGNAME_MISMATCH", {
56
- detail: `Expected tagName '${c}', got '${g}' for id '${i}'`,
57
- ref: { tagName: c, id: i }
56
+ detail: `Expected tagName '${c}', got '${g}' for id '${a}'`,
57
+ ref: { tagName: c, id: a }
58
58
  }), {
59
59
  ...d.oldRecord,
60
60
  status: "deleted"
@@ -62,23 +62,23 @@ function oi(p) {
62
62
  }
63
63
  }
64
64
  }
65
- function si(p) {
66
- const { rawRecords: o, stagedOperations: c, tagName: i } = p, f = new Map(
65
+ function ui(p) {
66
+ const { rawRecords: o, stagedOperations: c, tagName: a } = p, f = new Map(
67
67
  o.map((d) => [d.id, { ...d, status: "unchanged" }])
68
68
  );
69
69
  for (const d of c) {
70
70
  if (d.status === "created" || d.status === "updated") {
71
- if (!fr(d.newRecord, i)) continue;
71
+ if (!fr(d.newRecord, a)) continue;
72
72
  f.set(d.newRecord.id, { ...d.newRecord, status: d.status });
73
73
  }
74
- d.status === "deleted" && d.oldRecord.tagName === i && f.delete(d.oldRecord.id);
74
+ d.status === "deleted" && d.oldRecord.tagName === a && f.delete(d.oldRecord.id);
75
75
  }
76
76
  return Array.from(f.values());
77
77
  }
78
78
  async function ve(p) {
79
79
  const { context: o, ref: c } = p;
80
80
  if (o.stagedOperations.length > 0) {
81
- const f = oi({
81
+ const f = si({
82
82
  stagedOperations: o.stagedOperations,
83
83
  tagName: c.tagName,
84
84
  id: c.id
@@ -86,44 +86,44 @@ async function ve(p) {
86
86
  if (f?.status === "deleted") return;
87
87
  if (f) return f;
88
88
  }
89
- let i;
89
+ let a;
90
90
  if (c.id === void 0) {
91
91
  const f = `__singleton_${c.tagName}`, d = $t(o) ? o.recordCache.get(f) : void 0;
92
- d ? i = d : (i = (await o.store.getByTagName(c.tagName))[0], i && $t(o) && (o.recordCache.set(i.id, i), o.recordCache.set(f, i)));
92
+ d ? a = d : (a = (await o.store.getByTagName(c.tagName))[0], a && $t(o) && (o.recordCache.set(a.id, a), o.recordCache.set(f, a)));
93
93
  } else {
94
94
  const f = $t(o) ? o.recordCache.get(c.id) : void 0;
95
- f ? i = f : (i = await o.store.get(c.id), i && $t(o) && o.recordCache.set(c.id, i));
95
+ f ? a = f : (a = await o.store.get(c.id), a && $t(o) && o.recordCache.set(c.id, a));
96
96
  }
97
- if (i)
98
- return { ...i, status: "unchanged" };
97
+ if (a)
98
+ return { ...a, status: "unchanged" };
99
99
  }
100
- async function pa(p) {
100
+ async function ma(p) {
101
101
  const { context: o, refs: c } = p;
102
- return Promise.all(c.map((i) => ve({ context: o, ref: i })));
102
+ return Promise.all(c.map((a) => ve({ context: o, ref: a })));
103
103
  }
104
104
  async function mr(p) {
105
- const { context: o, tagName: c } = p, i = await o.store.getByTagName(c);
106
- for (const f of i)
105
+ const { context: o, tagName: c } = p, a = await o.store.getByTagName(c);
106
+ for (const f of a)
107
107
  $t(o) && o.recordCache.set(f.id, f);
108
- return si({ rawRecords: i, stagedOperations: o.stagedOperations, tagName: c });
108
+ return ui({ rawRecords: a, stagedOperations: o.stagedOperations, tagName: c });
109
109
  }
110
- async function ui(p) {
111
- const { context: o, ref: c, tagName: i } = p, f = await ve({ context: o, ref: c });
110
+ async function ci(p) {
111
+ const { context: o, ref: c, tagName: a } = p, f = await ve({ context: o, ref: c });
112
112
  if (!f) return;
113
- const d = f.children.find((g) => g.tagName === i);
113
+ const d = f.children.find((g) => g.tagName === a);
114
114
  if (d)
115
115
  return ve({ context: o, ref: d });
116
116
  }
117
- async function ci(p) {
118
- const { context: o, ref: c, tagName: i } = p, f = await ve({ context: o, ref: c });
117
+ async function li(p) {
118
+ const { context: o, ref: c, tagName: a } = p, f = await ve({ context: o, ref: c });
119
119
  if (!f) return [];
120
- const d = f.children.filter((v) => v.tagName === i).map((v) => ({ tagName: i, id: v.id }));
121
- return (await pa({ context: o, refs: d })).filter(
120
+ const d = f.children.filter((v) => v.tagName === a).map((v) => ({ tagName: a, id: v.id }));
121
+ return (await ma({ context: o, refs: d })).filter(
122
122
  (v) => v !== void 0
123
123
  );
124
124
  }
125
- async function li(p) {
126
- const { context: o, ref: c, options: i } = p, f = i?.depth ?? 1 / 0, d = i?.stopAtTagName, g = i?.order ?? "bottom-up", v = [];
125
+ async function fi(p) {
126
+ const { context: o, ref: c, options: a } = p, f = a?.depth ?? 1 / 0, d = a?.stopAtTagName, g = a?.order ?? "bottom-up", v = [];
127
127
  let D = await ve({ context: o, ref: c });
128
128
  for (; D?.parent && v.length < f; ) {
129
129
  const R = D.parent, q = await ve({ context: o, ref: R });
@@ -132,20 +132,20 @@ async function li(p) {
132
132
  }
133
133
  return g === "top-down" ? v.reverse() : v;
134
134
  }
135
- async function ma(p) {
136
- const { context: o, tagName: c, attributes: i } = p, f = await mr({ context: o, tagName: c }), d = [];
135
+ async function ga(p) {
136
+ const { context: o, tagName: c, attributes: a } = p, f = await mr({ context: o, tagName: c }), d = [];
137
137
  for (const g of f)
138
- Wt({ record: g, attributeFilter: i }) && d.push(g);
138
+ Wt({ record: g, attributeFilter: a }) && d.push(g);
139
139
  return d;
140
140
  }
141
141
  function Wt(p) {
142
142
  const { record: o, attributeFilter: c } = p;
143
143
  if (!c || Object.keys(c).length === 0)
144
144
  return !0;
145
- for (const [i, f] of Object.entries(c)) {
145
+ for (const [a, f] of Object.entries(c)) {
146
146
  if (f === void 0) continue;
147
147
  const g = o.attributes.find(
148
- (v) => v.name === i
148
+ (v) => v.name === a
149
149
  )?.value ?? "";
150
150
  if (g === "") return !1;
151
151
  if (Array.isArray(f)) {
@@ -156,41 +156,41 @@ function Wt(p) {
156
156
  }
157
157
  return !0;
158
158
  }
159
- async function fi(p) {
160
- const { context: o, ref: c, options: i } = p, { collect: f, omit: d } = i, g = new Set(d ?? []), v = di(f), D = /* @__PURE__ */ new Map();
159
+ async function Qr(p) {
160
+ const { context: o, ref: c, options: a } = p, { collect: f, omit: d } = a, g = new Set(d ?? []), v = di(f), D = /* @__PURE__ */ new Map();
161
161
  for (const q of v.allTags)
162
162
  D.set(q, /* @__PURE__ */ new Map());
163
163
  const R = await ve({ context: o, ref: c });
164
- return R && (v.mode === "flat" ? await pi({ context: o, rootId: R.id, collectSpec: v, omitSet: g, collected: D }) : await va({ context: o, record: R, pathNodes: v.paths, omitSet: g, collected: D })), Hr(D);
164
+ return R && (v.mode === "flat" ? await pi({ context: o, rootId: R.id, collectSpec: v, omitSet: g, collected: D }) : await ba({ context: o, record: R, pathNodes: v.paths, omitSet: g, collected: D })), Zr(D);
165
165
  }
166
166
  function di(p) {
167
167
  if (typeof p == "string")
168
168
  return { mode: "flat", targets: [{ tagName: p }], allTags: /* @__PURE__ */ new Set([p]) };
169
169
  if (Array.isArray(p)) {
170
- const i = [], f = /* @__PURE__ */ new Set();
170
+ const a = [], f = /* @__PURE__ */ new Set();
171
171
  for (const d of p)
172
172
  if (typeof d == "string")
173
- i.push({ tagName: d }), f.add(d);
173
+ a.push({ tagName: d }), f.add(d);
174
174
  else
175
175
  for (const [g, v] of Object.entries(d))
176
- i.push({ tagName: g, where: v?.where }), f.add(g);
177
- return { mode: "flat", targets: i, allTags: f };
176
+ a.push({ tagName: g, where: v?.where }), f.add(g);
177
+ return { mode: "flat", targets: a, allTags: f };
178
178
  }
179
179
  const o = /* @__PURE__ */ new Set();
180
- return { mode: "path", paths: ga(p, o), allTags: o };
180
+ return { mode: "path", paths: ya(p, o), allTags: o };
181
181
  }
182
- function ga(p, o) {
182
+ function ya(p, o) {
183
183
  const c = [];
184
- for (const [i, f] of Object.entries(p)) {
185
- if (i === "where") continue;
186
- o.add(i);
187
- const d = hi({ tagName: i, value: f, allTags: o });
184
+ for (const [a, f] of Object.entries(p)) {
185
+ if (a === "where") continue;
186
+ o.add(a);
187
+ const d = hi({ tagName: a, value: f, allTags: o });
188
188
  d && c.push(d);
189
189
  }
190
190
  return c;
191
191
  }
192
192
  function hi(p) {
193
- const { tagName: o, value: c, allTags: i } = p;
193
+ const { tagName: o, value: c, allTags: a } = p;
194
194
  if (c === !0)
195
195
  return { tagName: o, where: void 0, children: [], isLeaf: !0 };
196
196
  if (typeof c != "object" || c === null) return;
@@ -200,22 +200,22 @@ function hi(p) {
200
200
  const v = {};
201
201
  for (const R of g)
202
202
  v[R] = f[R];
203
- const D = ga(v, i);
203
+ const D = ya(v, a);
204
204
  return { tagName: o, where: d, children: D, isLeaf: !1 };
205
205
  }
206
206
  async function pi(p) {
207
- const { context: o, rootId: c, collectSpec: i, omitSet: f, collected: d } = p;
208
- for (const g of i.targets) {
207
+ const { context: o, rootId: c, collectSpec: a, omitSet: f, collected: d } = p;
208
+ for (const g of a.targets) {
209
209
  if (f.has(g.tagName)) continue;
210
210
  const v = await mr({
211
211
  context: o,
212
212
  tagName: g.tagName
213
213
  });
214
214
  for (const D of v)
215
- ya({ record: D, where: g.where }) && await mi({ context: o, record: D, rootId: c, omitSet: f }) && d.get(g.tagName).set(D.id, D);
215
+ va({ record: D, where: g.where }) && await mi({ context: o, record: D, rootId: c, omitSet: f }) && d.get(g.tagName).set(D.id, D);
216
216
  }
217
217
  }
218
- function ya(p) {
218
+ function va(p) {
219
219
  const { record: o, where: c } = p;
220
220
  return c ? Wt({
221
221
  record: o,
@@ -223,23 +223,23 @@ function ya(p) {
223
223
  }) : !0;
224
224
  }
225
225
  async function mi(p) {
226
- const { context: o, record: c, rootId: i, omitSet: f } = p;
227
- if (c.id === i) return !0;
226
+ const { context: o, record: c, rootId: a, omitSet: f } = p;
227
+ if (c.id === a) return !0;
228
228
  let d = c;
229
229
  for (; d; ) {
230
230
  if (!d.parent || f.has(d.parent.tagName)) return !1;
231
- if (d.parent.id === i) return !0;
231
+ if (d.parent.id === a) return !0;
232
232
  const g = await ve({ context: o, ref: me(d.parent) });
233
233
  if (!g) return !1;
234
234
  d = g;
235
235
  }
236
236
  return !1;
237
237
  }
238
- async function va(p) {
239
- const { context: o, record: c, pathNodes: i, omitSet: f, collected: d } = p;
238
+ async function ba(p) {
239
+ const { context: o, record: c, pathNodes: a, omitSet: f, collected: d } = p;
240
240
  if (!c.children?.length) return;
241
- const g = new Set(i.map((v) => v.tagName));
242
- for (const v of i) {
241
+ const g = new Set(a.map((v) => v.tagName));
242
+ for (const v of a) {
243
243
  const D = await gi({
244
244
  context: o,
245
245
  record: c,
@@ -249,7 +249,7 @@ async function va(p) {
249
249
  stopAtTagNames: g
250
250
  });
251
251
  for (const R of D)
252
- d.get(v.tagName).set(R.id, R), !v.isLeaf && v.children.length > 0 && await va({
252
+ d.get(v.tagName).set(R.id, R), !v.isLeaf && v.children.length > 0 && await ba({
253
253
  context: o,
254
254
  record: R,
255
255
  pathNodes: v.children,
@@ -259,64 +259,64 @@ async function va(p) {
259
259
  }
260
260
  }
261
261
  async function gi(p) {
262
- const { context: o, record: c, tagName: i, where: f, omitSet: d, stopAtTagNames: g } = p, v = [];
262
+ const { context: o, record: c, tagName: a, where: f, omitSet: d, stopAtTagNames: g } = p, v = [];
263
263
  if (!c.children?.length) return v;
264
- const D = [], R = await Qr({ context: o, record: c, omitSet: d });
264
+ const D = [], R = await Hr({ context: o, record: c, omitSet: d });
265
265
  for (D.push(...R); D.length > 0; ) {
266
266
  const q = D.shift();
267
- if (q.tagName === i) {
268
- ya({ record: q, where: f }) && v.push(q);
267
+ if (q.tagName === a) {
268
+ va({ record: q, where: f }) && v.push(q);
269
269
  continue;
270
270
  }
271
- if (!(g.has(q.tagName) && q.tagName !== i) && q.children?.length) {
272
- const Y = await Qr({ context: o, record: q, omitSet: d });
271
+ if (!(g.has(q.tagName) && q.tagName !== a) && q.children?.length) {
272
+ const Y = await Hr({ context: o, record: q, omitSet: d });
273
273
  D.push(...Y);
274
274
  }
275
275
  }
276
276
  return v;
277
277
  }
278
- async function Qr(p) {
279
- const { context: o, record: c, omitSet: i } = p;
278
+ async function Hr(p) {
279
+ const { context: o, record: c, omitSet: a } = p;
280
280
  if (!c.children?.length) return [];
281
- const f = c.children.filter((g) => !i.has(g.tagName));
281
+ const f = c.children.filter((g) => !a.has(g.tagName));
282
282
  return f.length ? (await Promise.all(
283
283
  f.map((g) => ve({ context: o, ref: me(g) }))
284
284
  )).filter(
285
285
  (g) => g !== void 0
286
286
  ) : [];
287
287
  }
288
- function Hr(p) {
288
+ function Zr(p) {
289
289
  const o = {};
290
- for (const [c, i] of p.entries())
291
- o[c] = Array.from(i.values());
290
+ for (const [c, a] of p.entries())
291
+ o[c] = Array.from(a.values());
292
292
  return o;
293
293
  }
294
- async function Zr(p) {
295
- const { context: o, ref: c, name: i } = p;
296
- return ((await ve({ context: o, ref: c }))?.attributes ?? []).find((v) => v.name === i)?.value ?? "";
297
- }
298
294
  async function Jr(p) {
299
- const { context: o, ref: c, name: i } = p;
300
- return ((await ve({ context: o, ref: c }))?.attributes ?? []).find((v) => v.name === i);
295
+ const { context: o, ref: c, name: a } = p;
296
+ return ((await ve({ context: o, ref: c }))?.attributes ?? []).find((v) => v.name === a)?.value ?? "";
301
297
  }
302
298
  async function ea(p) {
299
+ const { context: o, ref: c, name: a } = p;
300
+ return ((await ve({ context: o, ref: c }))?.attributes ?? []).find((v) => v.name === a);
301
+ }
302
+ async function ta(p) {
303
303
  const { context: o, ref: c } = p;
304
304
  return ((await ve({ context: o, ref: c }))?.attributes ?? []).reduce(
305
305
  (d, g) => (d[g.name] = g.value ?? "", d),
306
306
  {}
307
307
  );
308
308
  }
309
- async function ta(p) {
309
+ async function na(p) {
310
310
  const { context: o, ref: c } = p;
311
311
  return (await ve({ context: o, ref: c }))?.attributes ?? [];
312
312
  }
313
313
  async function yi(p) {
314
- const { context: o, ref: c, options: i = {} } = p, { select: f, omit: d, unwrap: g } = i, v = await ve({ context: o, ref: c });
314
+ const { context: o, ref: c, options: a = {} } = p, { select: f, omit: d, unwrap: g } = a, v = await ve({ context: o, ref: c });
315
315
  Ge(v, {
316
316
  detail: "No record found for provided ref",
317
317
  key: "ELEMENT_NOT_FOUND"
318
318
  });
319
- const D = vi(d), R = await ba({
319
+ const D = vi(d), R = await wa({
320
320
  context: o,
321
321
  record: v,
322
322
  select: f,
@@ -327,26 +327,26 @@ async function yi(p) {
327
327
  function vi(p) {
328
328
  const o = /* @__PURE__ */ new Set(), c = [];
329
329
  if (!p) return { unconditional: o, conditional: c };
330
- for (const i of p)
331
- typeof i == "string" ? o.add(i) : i.where ? c.push({
332
- tagName: i.tagName,
333
- where: i.where,
334
- scope: i.scope ?? "self"
335
- }) : o.add(i.tagName);
330
+ for (const a of p)
331
+ typeof a == "string" ? o.add(a) : a.where ? c.push({
332
+ tagName: a.tagName,
333
+ where: a.where,
334
+ scope: a.scope ?? "self"
335
+ }) : o.add(a.tagName);
336
336
  return { unconditional: o, conditional: c };
337
337
  }
338
- async function ba(p) {
339
- const { context: o, record: c, select: i, compiledOmit: f } = p;
338
+ async function wa(p) {
339
+ const { context: o, record: c, select: a, compiledOmit: f } = p;
340
340
  if (bi({ record: c, compiledOmit: f }))
341
341
  return dr({ record: c });
342
342
  const d = await _i({
343
343
  context: o,
344
344
  record: c,
345
- select: i,
345
+ select: a,
346
346
  compiledOmit: f
347
347
  }), v = (await Promise.all(
348
348
  d.map(
349
- ({ record: D, select: R }) => ba({ context: o, record: D, select: R, compiledOmit: f })
349
+ ({ record: D, select: R }) => wa({ context: o, record: D, select: R, compiledOmit: f })
350
350
  )
351
351
  )).filter(
352
352
  (D) => D !== null
@@ -356,25 +356,25 @@ async function ba(p) {
356
356
  function bi(p) {
357
357
  const { record: o, compiledOmit: c } = p;
358
358
  return c.conditional.some(
359
- (i) => i.scope === "children" && i.tagName === o.tagName && Wt({
359
+ (a) => a.scope === "children" && a.tagName === o.tagName && Wt({
360
360
  record: o,
361
- attributeFilter: i.where
361
+ attributeFilter: a.where
362
362
  })
363
363
  );
364
364
  }
365
365
  function wi(p) {
366
366
  const { record: o, compiledOmit: c } = p;
367
367
  return c.unconditional.has(o.tagName) ? !0 : c.conditional.some(
368
- (i) => i.scope === "self" && i.tagName === o.tagName && Wt({
368
+ (a) => a.scope === "self" && a.tagName === o.tagName && Wt({
369
369
  record: o,
370
- attributeFilter: i.where
370
+ attributeFilter: a.where
371
371
  })
372
372
  );
373
373
  }
374
374
  async function _i(p) {
375
- const { context: o, record: c, select: i, compiledOmit: f } = p;
375
+ const { context: o, record: c, select: a, compiledOmit: f } = p;
376
376
  if (!c.children?.length) return [];
377
- const d = i ? xi(i) : void 0, g = c.children.filter(
377
+ const d = a ? Ti(a) : void 0, g = c.children.filter(
378
378
  (q) => Ei({ tagName: q.tagName, compiledOmit: f, selectKeys: d })
379
379
  );
380
380
  if (!g.length) return [];
@@ -388,21 +388,21 @@ async function _i(p) {
388
388
  )).filter(
389
389
  (q) => q !== void 0
390
390
  ).filter((q) => !wi({ record: q, compiledOmit: f }));
391
- return Ni({ children: R, select: i, record: c });
391
+ return Ni({ children: R, select: a, record: c });
392
392
  }
393
393
  function Ei(p) {
394
- const { tagName: o, compiledOmit: c, selectKeys: i } = p;
395
- return !(c.unconditional.has(o) || i && !i.has(o));
394
+ const { tagName: o, compiledOmit: c, selectKeys: a } = p;
395
+ return !(c.unconditional.has(o) || a && !a.has(o));
396
396
  }
397
- const Ti = /* @__PURE__ */ new Set(["where", "recursive"]);
398
- function xi(p) {
397
+ const xi = /* @__PURE__ */ new Set(["where", "recursive"]);
398
+ function Ti(p) {
399
399
  const o = /* @__PURE__ */ new Set();
400
400
  for (const c of Object.keys(p))
401
- Ti.has(c) || o.add(c);
401
+ xi.has(c) || o.add(c);
402
402
  return o;
403
403
  }
404
404
  function Ni(p) {
405
- const { children: o, select: c, record: i } = p;
405
+ const { children: o, select: c, record: a } = p;
406
406
  if (!c)
407
407
  return o.map((d) => ({ record: d, select: void 0 }));
408
408
  const f = [];
@@ -413,18 +413,18 @@ function Ni(p) {
413
413
  f.push({ record: d, select: void 0 });
414
414
  continue;
415
415
  }
416
- const v = Oi({ child: d, entry: g, parentRecord: i });
416
+ const v = Oi({ child: d, entry: g, parentRecord: a });
417
417
  v && f.push(v);
418
418
  }
419
419
  return f;
420
420
  }
421
421
  function Oi(p) {
422
- const { child: o, entry: c, parentRecord: i } = p, f = c;
422
+ const { child: o, entry: c, parentRecord: a } = p, f = c;
423
423
  if (!(f.where && !Wt({
424
424
  record: o,
425
425
  attributeFilter: f.where
426
426
  }))) {
427
- if (f.recursive && o.tagName === i.tagName) {
427
+ if (f.recursive && o.tagName === a.tagName) {
428
428
  const d = f.recursive === !0 ? !0 : f.recursive - 1;
429
429
  return d === 0 ? void 0 : { record: o, select: { ...f, recursive: d } };
430
430
  }
@@ -437,12 +437,12 @@ function Ai(p, o) {
437
437
  }
438
438
  function Ci(p) {
439
439
  const { tree: o, unwrapTagNames: c } = p;
440
- function i(f) {
441
- return f.flatMap((d) => c.includes(d.tagName) ? i(d.tree) : [{ ...d, tree: i(d.tree) }]);
440
+ function a(f) {
441
+ return f.flatMap((d) => c.includes(d.tagName) ? a(d.tree) : [{ ...d, tree: a(d.tree) }]);
442
442
  }
443
- return { ...o, tree: i(o.tree) };
443
+ return { ...o, tree: a(o.tree) };
444
444
  }
445
- class wa {
445
+ class _a {
446
446
  constructor(o, c) {
447
447
  this.store = o, this.dialecteConfig = c;
448
448
  }
@@ -526,8 +526,8 @@ class wa {
526
526
  * ```
527
527
  */
528
528
  async getRecords(o) {
529
- const c = o.map((i) => me(i));
530
- return pa({ context: this.context, refs: c });
529
+ const c = o.map((a) => me(a));
530
+ return ma({ context: this.context, refs: c });
531
531
  }
532
532
  /**
533
533
  * Get the first direct child of an element matching a given tag name.
@@ -543,7 +543,7 @@ class wa {
543
543
  */
544
544
  async getChild(o, c) {
545
545
  if (o)
546
- return ui({ context: this.context, ref: me(o), tagName: c });
546
+ return ci({ context: this.context, ref: me(o), tagName: c });
547
547
  }
548
548
  /**
549
549
  * Get all direct children of an element matching a given tag name.
@@ -558,7 +558,7 @@ class wa {
558
558
  * ```
559
559
  */
560
560
  async getChildren(o, c) {
561
- return o ? ci({ context: this.context, ref: me(o), tagName: c }) : [];
561
+ return o ? li({ context: this.context, ref: me(o), tagName: c }) : [];
562
562
  }
563
563
  /**
564
564
  * Get all records of a given tag name.
@@ -574,22 +574,19 @@ class wa {
574
574
  async getRecordsByTagName(o) {
575
575
  return mr({ context: this.context, tagName: o });
576
576
  }
577
- /**
578
- * Find all descendants of an element, grouped by tag name.
579
- *
580
- * @param refOrRecord - The ancestor element.
581
- * @param options - Collect spec and optional omit list.
582
- * @returns Object keyed by tag name, each value an array of tracked records.
583
- *
584
- * @example
585
- * ```ts
586
- * const { AA_1 } = await query.findDescendants(a, { collect: 'AA_1' })
587
- * ```
588
- */
589
577
  async findDescendants(o, c) {
590
- return fi({
578
+ const a = me(o);
579
+ if (!c) {
580
+ const f = this.dialecteConfig.descendants[a.tagName] ?? [];
581
+ return Qr({
582
+ context: this.context,
583
+ ref: a,
584
+ options: { collect: f }
585
+ });
586
+ }
587
+ return Qr({
591
588
  context: this.context,
592
- ref: me(o),
589
+ ref: a,
593
590
  options: c
594
591
  });
595
592
  }
@@ -607,7 +604,7 @@ class wa {
607
604
  * ```
608
605
  */
609
606
  async findAncestors(o, c) {
610
- return o ? li({ context: this.context, ref: me(o), options: c }) : [];
607
+ return o ? fi({ context: this.context, ref: me(o), options: c }) : [];
611
608
  }
612
609
  /**
613
610
  * Build a full tree structure from an element down.
@@ -625,20 +622,20 @@ class wa {
625
622
  return yi({ context: this.context, ref: me(o), options: c });
626
623
  }
627
624
  async getAttribute(o, c) {
628
- const i = me(o), { fullObject: f } = c;
629
- return f ? Jr({ context: this.context, ref: i, ...c }) : Zr({ context: this.context, ref: i, ...c });
625
+ const a = me(o), { fullObject: f } = c;
626
+ return f ? ea({ context: this.context, ref: a, ...c }) : Jr({ context: this.context, ref: a, ...c });
630
627
  }
631
628
  async getAttributes(o, c) {
632
- const i = me(o), { fullObject: f } = c || {};
633
- return f ? ta({ context: this.context, ref: i, ...c }) : ea({ context: this.context, ref: i, ...c });
629
+ const a = me(o), { fullObject: f } = c || {};
630
+ return f ? na({ context: this.context, ref: a, ...c }) : ta({ context: this.context, ref: a, ...c });
634
631
  }
635
632
  async getAnyAttribute(o, c) {
636
- const i = me(o), { fullObject: f } = c;
637
- return f ? Jr({ context: this.context, ref: i, ...c }) : Zr({ context: this.context, ref: i, ...c });
633
+ const a = me(o), { fullObject: f } = c;
634
+ return f ? ea({ context: this.context, ref: a, ...c }) : Jr({ context: this.context, ref: a, ...c });
638
635
  }
639
636
  async getAnyAttributes(o, c) {
640
- const i = me(o), { fullObject: f } = c || {};
641
- return f ? ta({ context: this.context, ref: i, ...c }) : ea({ context: this.context, ref: i, ...c });
637
+ const a = me(o), { fullObject: f } = c || {};
638
+ return f ? na({ context: this.context, ref: a, ...c }) : ta({ context: this.context, ref: a, ...c });
642
639
  }
643
640
  /**
644
641
  * Get the first direct child matching a tag name without element-type constraint.
@@ -676,13 +673,13 @@ class wa {
676
673
  * ```
677
674
  */
678
675
  async findByAttributes(o) {
679
- return ma({ context: this.context, ...o });
676
+ return ga({ context: this.context, ...o });
680
677
  }
681
678
  }
682
679
  function Ze(p) {
683
- const { context: o, status: c, record: i, oldRecord: f, newRecord: d } = p;
680
+ const { context: o, status: c, record: a, oldRecord: f, newRecord: d } = p;
684
681
  let g, v, D;
685
- i && (g = ur(i)), f && (v = ur(f)), d && (D = ur(d)), c === "created" ? (Ge(g, {
682
+ a && (g = ur(a)), f && (v = ur(f)), d && (D = ur(d)), c === "created" ? (Ge(g, {
686
683
  detail: "Record is required for created",
687
684
  key: "ELEMENT_NOT_FOUND"
688
685
  }), o.stagedOperations.push({ status: c, oldRecord: void 0, newRecord: g })) : c === "updated" ? (Ge(v && D, {
@@ -695,32 +692,32 @@ function Ze(p) {
695
692
  }
696
693
  function gr(p) {
697
694
  const { context: o, operations: c } = p;
698
- for (const i of c)
699
- switch (i.status) {
695
+ for (const a of c)
696
+ switch (a.status) {
700
697
  case "created":
701
- Ze({ context: o, status: "created", record: i.newRecord });
698
+ Ze({ context: o, status: "created", record: a.newRecord });
702
699
  break;
703
700
  case "updated":
704
701
  Ze({
705
702
  context: o,
706
703
  status: "updated",
707
- oldRecord: i.oldRecord,
708
- newRecord: i.newRecord
704
+ oldRecord: a.oldRecord,
705
+ newRecord: a.newRecord
709
706
  });
710
707
  break;
711
708
  case "deleted":
712
- Ze({ context: o, status: "deleted", record: i.oldRecord });
709
+ Ze({ context: o, status: "deleted", record: a.oldRecord });
713
710
  break;
714
711
  }
715
712
  }
716
713
  async function yr(p) {
717
- const { dialecteConfig: o, hooks: c, context: i, query: f, parentRef: d, params: g } = p, { id: v, tagName: D, attributes: R, namespace: q, value: Y } = g, Q = await ve({ context: i, ref: d });
714
+ const { dialecteConfig: o, hooks: c, context: a, query: f, parentRef: d, params: g } = p, { id: v, tagName: D, attributes: R, namespace: q, value: Y } = g, Q = await ve({ context: a, ref: d });
718
715
  Ge(Q, {
719
716
  detail: "Parent record not found",
720
717
  key: "ELEMENT_NOT_FOUND",
721
718
  ref: d
722
719
  });
723
- const fe = ai({
720
+ const fe = ii({
724
721
  dialecteConfig: o,
725
722
  hooks: c,
726
723
  record: {
@@ -734,7 +731,7 @@ async function yr(p) {
734
731
  }
735
732
  });
736
733
  Ze({
737
- context: i,
734
+ context: a,
738
735
  status: "created",
739
736
  record: fe
740
737
  });
@@ -743,7 +740,7 @@ async function yr(p) {
743
740
  children: [...Q.children, { id: fe.id, tagName: fe.tagName }]
744
741
  };
745
742
  if (Ze({
746
- context: i,
743
+ context: a,
747
744
  status: "updated",
748
745
  oldRecord: Q,
749
746
  newRecord: j
@@ -753,15 +750,15 @@ async function yr(p) {
753
750
  parentRecord: j,
754
751
  query: f
755
752
  });
756
- gr({ context: i, operations: B });
753
+ gr({ context: a, operations: B });
757
754
  }
758
755
  return fe;
759
756
  }
760
757
  async function Di(p) {
761
- const { dialecteConfig: o, hooks: c, context: i, query: f, parentRef: d, record: g, cumulativeCloneMappings: v } = p, D = [], R = await _a({
758
+ const { dialecteConfig: o, hooks: c, context: a, query: f, parentRef: d, record: g, cumulativeCloneMappings: v } = p, D = [], R = await Ea({
762
759
  dialecteConfig: o,
763
760
  hooks: c,
764
- context: i,
761
+ context: a,
765
762
  query: f,
766
763
  parentRef: d,
767
764
  record: g,
@@ -772,15 +769,15 @@ async function Di(p) {
772
769
  cumulativeCloneMappings: v,
773
770
  query: f
774
771
  });
775
- i.stagedOperations.push(...q);
772
+ a.stagedOperations.push(...q);
776
773
  }
777
774
  return {
778
775
  record: R,
779
776
  mappings: D
780
777
  };
781
778
  }
782
- async function _a(p) {
783
- const { dialecteConfig: o, hooks: c, context: i, query: f, parentRef: d, record: g, mappings: v } = p;
779
+ async function Ea(p) {
780
+ const { dialecteConfig: o, hooks: c, context: a, query: f, parentRef: d, record: g, mappings: v } = p;
784
781
  let D = !0, R = g;
785
782
  if (c?.beforeClone) {
786
783
  const Q = c.beforeClone({ record: g });
@@ -790,7 +787,7 @@ async function _a(p) {
790
787
  const q = await yr({
791
788
  dialecteConfig: o,
792
789
  hooks: c,
793
- context: i,
790
+ context: a,
794
791
  query: f,
795
792
  parentRef: d,
796
793
  params: {
@@ -807,10 +804,10 @@ async function _a(p) {
807
804
  target: me(q)
808
805
  });
809
806
  for (const Q of R.tree)
810
- await _a({
807
+ await Ea({
811
808
  dialecteConfig: o,
812
809
  hooks: c,
813
- context: i,
810
+ context: a,
814
811
  query: f,
815
812
  parentRef: me(q),
816
813
  record: Q,
@@ -820,21 +817,21 @@ async function _a(p) {
820
817
  }
821
818
  function Si(p) {
822
819
  const o = /* @__PURE__ */ new Map();
823
- for (const i of p) {
824
- const f = (i.status === "deleted" ? i.oldRecord : i.newRecord).id, d = o.get(f);
820
+ for (const a of p) {
821
+ const f = (a.status === "deleted" ? a.oldRecord : a.newRecord).id, d = o.get(f);
825
822
  if (!d) {
826
- o.set(f, i);
823
+ o.set(f, a);
827
824
  continue;
828
825
  }
829
- d.status === "created" ? i.status === "updated" ? o.set(f, {
826
+ d.status === "created" ? a.status === "updated" ? o.set(f, {
830
827
  status: "created",
831
828
  oldRecord: void 0,
832
- newRecord: i.newRecord
833
- }) : i.status === "deleted" && o.delete(f) : d.status === "updated" && (i.status === "updated" ? o.set(f, {
829
+ newRecord: a.newRecord
830
+ }) : a.status === "deleted" && o.delete(f) : d.status === "updated" && (a.status === "updated" ? o.set(f, {
834
831
  status: "updated",
835
832
  oldRecord: d.oldRecord,
836
- newRecord: i.newRecord
837
- }) : i.status === "deleted" && o.set(f, {
833
+ newRecord: a.newRecord
834
+ }) : a.status === "deleted" && o.set(f, {
838
835
  status: "deleted",
839
836
  oldRecord: d.oldRecord,
840
837
  newRecord: void 0
@@ -842,30 +839,30 @@ function Si(p) {
842
839
  }
843
840
  const c = Array.from(o.values());
844
841
  return {
845
- creates: c.filter((i) => i.status === "created"),
846
- updates: c.filter((i) => i.status === "updated"),
847
- deletes: c.filter((i) => i.status === "deleted")
842
+ creates: c.filter((a) => a.status === "created"),
843
+ updates: c.filter((a) => a.status === "updated"),
844
+ deletes: c.filter((a) => a.status === "deleted")
848
845
  };
849
846
  }
850
847
  async function Ii(p) {
851
- const { stagedOperations: o, store: c, documentState: i } = p, { creates: f, updates: d, deletes: g } = Si(o), v = f.length + d.length + g.length;
852
- i.loading = !0, i.progress = { message: "Committing changes...", current: 0, total: v };
848
+ const { stagedOperations: o, store: c, documentState: a } = p, { creates: f, updates: d, deletes: g } = Si(o), v = f.length + d.length + g.length;
849
+ a.loading = !0, a.progress = { message: "Committing changes...", current: 0, total: v };
853
850
  try {
854
851
  await c.commit({
855
852
  creates: f.map((D) => D.newRecord),
856
853
  updates: d.map((D) => D.newRecord),
857
854
  deletes: g.map((D) => D.oldRecord.id),
858
855
  onProgress: (D, R) => {
859
- i.progress = { message: "Committing changes...", current: D, total: R };
856
+ a.progress = { message: "Committing changes...", current: D, total: R };
860
857
  }
861
858
  });
862
859
  } catch (D) {
863
- throw i.loading = !1, i.progress = null, D;
860
+ throw a.loading = !1, a.progress = null, D;
864
861
  }
865
- i.lastUpdate = Date.now();
862
+ a.lastUpdate = Date.now();
866
863
  }
867
864
  async function Ri(p) {
868
- const { hooks: o, context: c, query: i, ref: f } = p, d = await ve({ context: c, ref: f });
865
+ const { hooks: o, context: c, query: a, ref: f } = p, d = await ve({ context: c, ref: f });
869
866
  if (Ge(d, {
870
867
  detail: `Record not found (tagName=${f.tagName}, id=${f.id})`,
871
868
  key: "ELEMENT_NOT_FOUND",
@@ -874,10 +871,10 @@ async function Ri(p) {
874
871
  detail: "Cannot delete root element",
875
872
  key: "PROTECTED_ROOT"
876
873
  }), o?.beforeDelete) {
877
- const R = await o.beforeDelete({ record: d, query: i });
874
+ const R = await o.beforeDelete({ record: d, query: a });
878
875
  gr({ context: c, operations: R });
879
876
  }
880
- await Ea({ context: c, record: d }), Ze({ context: c, status: "deleted", record: d });
877
+ await xa({ context: c, record: d }), Ze({ context: c, status: "deleted", record: d });
881
878
  const g = me(d.parent), v = await ve({ context: c, ref: g });
882
879
  Ge(v, {
883
880
  detail: `Parent record not found (tagName=${d.parent.tagName}, id=${d.parent.id})`,
@@ -889,41 +886,41 @@ async function Ri(p) {
889
886
  };
890
887
  return Ze({ context: c, status: "updated", oldRecord: v, newRecord: D }), D;
891
888
  }
892
- async function Ea(p) {
889
+ async function xa(p) {
893
890
  const { context: o, record: c } = p;
894
- for (const i of c.children) {
895
- const f = me(i), d = await ve({ context: o, ref: f });
896
- d && (d.children.length > 0 && await Ea({ context: o, record: d }), Ze({ context: o, status: "deleted", record: d }));
891
+ for (const a of c.children) {
892
+ const f = me(a), d = await ve({ context: o, ref: f });
893
+ d && (d.children.length > 0 && await xa({ context: o, record: d }), Ze({ context: o, status: "deleted", record: d }));
897
894
  }
898
895
  }
899
896
  async function ki(p) {
900
- const { dialecteConfig: o, hooks: c, context: i, query: f, parentRef: d, params: g } = p, v = Pi(g.attributes);
897
+ const { dialecteConfig: o, hooks: c, context: a, query: f, parentRef: d, params: g } = p, v = Pi(g.attributes);
901
898
  if (v) {
902
- const [D] = await ma({
903
- context: i,
899
+ const [D] = await ga({
900
+ context: a,
904
901
  tagName: g.tagName,
905
902
  attributes: v
906
903
  });
907
904
  if (D) return D;
908
905
  } else {
909
- const D = { tagName: g.tagName, id: g.id }, R = await ve({ context: i, ref: D });
906
+ const D = { tagName: g.tagName, id: g.id }, R = await ve({ context: a, ref: D });
910
907
  if (R) return R;
911
908
  }
912
909
  return yr({
913
910
  dialecteConfig: o,
914
911
  hooks: c,
915
- context: i,
912
+ context: a,
916
913
  query: f,
917
914
  parentRef: d,
918
915
  params: g
919
916
  });
920
917
  }
921
918
  function Pi(p) {
922
- const o = Array.isArray(p) ? Object.fromEntries(p.map((i) => [i.name, i.value])) : p;
923
- return Object.values(o).some((i) => i !== void 0 && i !== "") ? o : void 0;
919
+ const o = Array.isArray(p) ? Object.fromEntries(p.map((a) => [a.name, a.value])) : p;
920
+ return Object.values(o).some((a) => a !== void 0 && a !== "") ? o : void 0;
924
921
  }
925
922
  async function Fi(p) {
926
- const { dialecteConfig: o, hooks: c, context: i, query: f, ref: d, params: g } = p, { attributes: v, value: D } = g, R = await ve({ context: i, ref: d });
923
+ const { dialecteConfig: o, hooks: c, context: a, query: f, ref: d, params: g } = p, { attributes: v, value: D } = g, R = await ve({ context: a, ref: d });
927
924
  Ge(R, {
928
925
  detail: `Record not found (tagName=${d.tagName}, id=${d.id})`,
929
926
  key: "ELEMENT_NOT_FOUND",
@@ -931,7 +928,7 @@ async function Fi(p) {
931
928
  });
932
929
  let q = R.attributes;
933
930
  if (v) {
934
- const Q = ii({
931
+ const Q = oi({
935
932
  dialecteConfig: o,
936
933
  tagName: R.tagName,
937
934
  attributes: v
@@ -947,19 +944,19 @@ async function Fi(p) {
947
944
  attributes: q,
948
945
  value: D !== void 0 ? D : R.value
949
946
  };
950
- if (Ze({ context: i, status: "updated", oldRecord: R, newRecord: Y }), c?.afterUpdated) {
947
+ if (Ze({ context: a, status: "updated", oldRecord: R, newRecord: Y }), c?.afterUpdated) {
951
948
  const Q = await c.afterUpdated({
952
949
  oldRecord: R,
953
950
  newRecord: Y,
954
951
  query: f
955
952
  });
956
- gr({ context: i, operations: Q });
953
+ gr({ context: a, operations: Q });
957
954
  }
958
955
  return Y;
959
956
  }
960
- class Bi extends wa {
961
- constructor(o, c, i, f) {
962
- super(o, c), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.cumulativeCloneMappings = [], this.documentState = i, this.hooks = f;
957
+ class Bi extends _a {
958
+ constructor(o, c, a, f) {
959
+ super(o, c), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.cumulativeCloneMappings = [], this.documentState = a, this.hooks = f;
963
960
  }
964
961
  //== Mutations (sync — stage operations, return Refs)
965
962
  /**
@@ -1140,14 +1137,14 @@ function $t(p) {
1140
1137
  return p.recordCache !== void 0;
1141
1138
  }
1142
1139
  class Ta {
1143
- constructor(o, c, i, f) {
1140
+ constructor(o, c, a, f) {
1144
1141
  this.state = {
1145
1142
  loading: !1,
1146
1143
  error: null,
1147
1144
  progress: null,
1148
1145
  history: [],
1149
1146
  lastUpdate: null
1150
- }, this.activeTransactions = 0, this.store = o, this.config = c, this.hooks = f, this.extensionsRegistry = i, this.channel = new BroadcastChannel(`core::${o.name}`), this.channel.onmessage = (d) => {
1147
+ }, this.activeTransactions = 0, this.store = o, this.config = c, this.hooks = f, this.extensionsRegistry = a, this.channel = new BroadcastChannel(`core::${o.name}`), this.channel.onmessage = (d) => {
1151
1148
  this.state.lastUpdate = d.data;
1152
1149
  };
1153
1150
  }
@@ -1157,14 +1154,14 @@ class Ta {
1157
1154
  return Object.assign(o, c);
1158
1155
  }
1159
1156
  withAllExtensions(o) {
1160
- const c = cr(this.extensionsRegistry?.query, o), i = cr(this.extensionsRegistry?.transaction, o);
1161
- return Object.assign(o, c, i);
1157
+ const c = cr(this.extensionsRegistry?.query, o), a = cr(this.extensionsRegistry?.transaction, o);
1158
+ return Object.assign(o, c, a);
1162
1159
  }
1163
1160
  /**
1164
1161
  * Override in dialecte subclass to return a domain-specific Query.
1165
1162
  */
1166
1163
  createQuery() {
1167
- return new wa(this.store, this.config);
1164
+ return new _a(this.store, this.config);
1168
1165
  }
1169
1166
  get query() {
1170
1167
  return this.withQueryExtensions(this.createQuery());
@@ -1181,10 +1178,10 @@ class Ta {
1181
1178
  this.activeTransactions > 0 && qe("CONCURRENT_TRANSACTION", {
1182
1179
  detail: `${this.activeTransactions} transaction(s) already active. Concurrent transactions risk lost updates — serialize them or implement a transaction queue.`
1183
1180
  }), this.activeTransactions++, this.state.loading = !0, this.state.error = null;
1184
- const i = this.withAllExtensions(this.createTransaction());
1181
+ const a = this.withAllExtensions(this.createTransaction());
1185
1182
  try {
1186
- const f = await o(i);
1187
- return await i.commit(), this.channel.postMessage(this.state.lastUpdate), i.clearStagedOperations(), i.clearRecordCache(), i.clearCumulativeCloneMappings(), this.state.history.push({
1183
+ const f = await o(a);
1184
+ return await a.commit(), this.channel.postMessage(this.state.lastUpdate), a.clearStagedOperations(), a.clearRecordCache(), a.clearCumulativeCloneMappings(), this.state.history.push({
1188
1185
  method: "commit",
1189
1186
  message: c?.label ?? "Changes committed",
1190
1187
  timestamp: Date.now()
@@ -1220,9 +1217,9 @@ class Ta {
1220
1217
  */
1221
1218
  async prepare(o, c) {
1222
1219
  this.activeTransactions++, this.state.loading = !0, this.state.error = null;
1223
- const i = this.createTransaction();
1220
+ const a = this.createTransaction();
1224
1221
  try {
1225
- await o(this.withAllExtensions(i));
1222
+ await o(this.withAllExtensions(a));
1226
1223
  } catch (v) {
1227
1224
  throw this.activeTransactions--, this.state.loading = !1, this.state.error ?? qe("UNKNOWN", {
1228
1225
  detail: v instanceof Error ? v.message : String(v),
@@ -1230,7 +1227,7 @@ class Ta {
1230
1227
  });
1231
1228
  }
1232
1229
  this.activeTransactions--, this.state.loading = !1;
1233
- const f = i.getStagedOperations(), d = {
1230
+ const f = a.getStagedOperations(), d = {
1234
1231
  creates: f.filter((v) => v.status === "created").length,
1235
1232
  updates: f.filter((v) => v.status === "updated").length,
1236
1233
  deletes: f.filter((v) => v.status === "deleted").length
@@ -1243,7 +1240,7 @@ class Ta {
1243
1240
  if (!g) {
1244
1241
  g = !0, this.activeTransactions++, this.state.loading = !0;
1245
1242
  try {
1246
- await i.commit(), this.channel.postMessage(this.state.lastUpdate), i.clearStagedOperations(), i.clearRecordCache(), i.clearCumulativeCloneMappings(), this.state.history.push({
1243
+ await a.commit(), this.channel.postMessage(this.state.lastUpdate), a.clearStagedOperations(), a.clearRecordCache(), a.clearCumulativeCloneMappings(), this.state.history.push({
1247
1244
  method: "commit",
1248
1245
  message: c?.label ?? "Changes committed",
1249
1246
  timestamp: Date.now()
@@ -1259,7 +1256,7 @@ class Ta {
1259
1256
  }
1260
1257
  },
1261
1258
  discard: () => {
1262
- g || (g = !0, i.clearStagedOperations(), i.clearRecordCache(), i.clearCumulativeCloneMappings());
1259
+ g || (g = !0, a.clearStagedOperations(), a.clearRecordCache(), a.clearCumulativeCloneMappings());
1263
1260
  }
1264
1261
  };
1265
1262
  }
@@ -1300,53 +1297,53 @@ class Ta {
1300
1297
  }
1301
1298
  }
1302
1299
  var ji = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1303
- function xa(p) {
1300
+ function Na(p) {
1304
1301
  return p && p.__esModule && Object.prototype.hasOwnProperty.call(p, "default") ? p.default : p;
1305
1302
  }
1306
1303
  function Mi(p) {
1307
1304
  if (Object.prototype.hasOwnProperty.call(p, "__esModule")) return p;
1308
1305
  var o = p.default;
1309
1306
  if (typeof o == "function") {
1310
- var c = function i() {
1307
+ var c = function a() {
1311
1308
  var f = !1;
1312
1309
  try {
1313
- f = this instanceof i;
1310
+ f = this instanceof a;
1314
1311
  } catch {
1315
1312
  }
1316
1313
  return f ? Reflect.construct(o, arguments, this.constructor) : o.apply(this, arguments);
1317
1314
  };
1318
1315
  c.prototype = o.prototype;
1319
1316
  } else c = {};
1320
- return Object.defineProperty(c, "__esModule", { value: !0 }), Object.keys(p).forEach(function(i) {
1321
- var f = Object.getOwnPropertyDescriptor(p, i);
1322
- Object.defineProperty(c, i, f.get ? f : {
1317
+ return Object.defineProperty(c, "__esModule", { value: !0 }), Object.keys(p).forEach(function(a) {
1318
+ var f = Object.getOwnPropertyDescriptor(p, a);
1319
+ Object.defineProperty(c, a, f.get ? f : {
1323
1320
  enumerable: !0,
1324
1321
  get: function() {
1325
- return p[i];
1322
+ return p[a];
1326
1323
  }
1327
1324
  });
1328
1325
  }), c;
1329
1326
  }
1330
- var Nn = { exports: {} }, Ki = Nn.exports, na;
1327
+ var Nn = { exports: {} }, Ki = Nn.exports, ra;
1331
1328
  function qi() {
1332
- return na || (na = 1, (function(p, o) {
1333
- (function(c, i) {
1334
- p.exports = i();
1329
+ return ra || (ra = 1, (function(p, o) {
1330
+ (function(c, a) {
1331
+ p.exports = a();
1335
1332
  })(Ki, function() {
1336
1333
  var c = function(e, t) {
1337
1334
  return (c = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
1338
1335
  n.__proto__ = r;
1339
1336
  } || function(n, r) {
1340
- for (var a in r) Object.prototype.hasOwnProperty.call(r, a) && (n[a] = r[a]);
1337
+ for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (n[i] = r[i]);
1341
1338
  })(e, t);
1342
- }, i = function() {
1343
- return (i = Object.assign || function(e) {
1344
- 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]);
1339
+ }, a = function() {
1340
+ return (a = Object.assign || function(e) {
1341
+ for (var t, n = 1, r = arguments.length; n < r; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
1345
1342
  return e;
1346
1343
  }).apply(this, arguments);
1347
1344
  };
1348
1345
  function f(e, t, n) {
1349
- for (var r, a = 0, u = t.length; a < u; a++) !r && a in t || ((r = r || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
1346
+ for (var r, i = 0, u = t.length; i < u; i++) !r && i in t || ((r = r || Array.prototype.slice.call(t, 0, i))[i] = t[i]);
1350
1347
  return e.concat(r || Array.prototype.slice.call(t));
1351
1348
  }
1352
1349
  var d = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : ji, g = Object.keys, v = Array.isArray;
@@ -1375,7 +1372,7 @@ function qi() {
1375
1372
  } };
1376
1373
  }
1377
1374
  var ue = Object.getOwnPropertyDescriptor, ie = [].slice;
1378
- function xe(e, t, n) {
1375
+ function Te(e, t, n) {
1379
1376
  return ie.call(e, t, n);
1380
1377
  }
1381
1378
  function te(e, t) {
@@ -1391,7 +1388,7 @@ function qi() {
1391
1388
  if (typeof t == "string" && Y(e, t)) return e[t];
1392
1389
  if (!t) return e;
1393
1390
  if (typeof t != "string") {
1394
- for (var n = [], r = 0, a = t.length; r < a; ++r) {
1391
+ for (var n = [], r = 0, i = t.length; r < i; ++r) {
1395
1392
  var u = de(e, t[r]);
1396
1393
  n.push(u);
1397
1394
  }
@@ -1406,7 +1403,7 @@ function qi() {
1406
1403
  function le(e, t, n) {
1407
1404
  if (e && t !== void 0 && !("isFrozen" in Object && Object.isFrozen(e))) if (typeof t != "string" && "length" in t) {
1408
1405
  H(typeof n != "string" && "length" in n);
1409
- for (var r = 0, a = t.length; r < a; ++r) le(e, t[r], n[r]);
1406
+ for (var r = 0, i = t.length; r < i; ++r) le(e, t[r], n[r]);
1410
1407
  } else {
1411
1408
  var u, h, m = t.indexOf(".");
1412
1409
  m !== -1 ? (u = t.substr(0, m), (h = t.substr(m + 1)) === "" ? n === void 0 ? v(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : le(m = !(m = e[u]) || !Y(e, u) ? e[u] = {} : m, h, n)) : n === void 0 ? v(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
@@ -1437,7 +1434,7 @@ function qi() {
1437
1434
  if (r) return r;
1438
1435
  if (v(n)) {
1439
1436
  r = [], Ue.set(n, r);
1440
- for (var a = 0, u = n.length; a < u; ++a) r.push(t(n[a]));
1437
+ for (var i = 0, u = n.length; i < u; ++i) r.push(t(n[i]));
1441
1438
  } else if (It.has(n.constructor)) r = n;
1442
1439
  else {
1443
1440
  var h, m = R(n);
@@ -1461,12 +1458,12 @@ function qi() {
1461
1458
  }
1462
1459
  var ze = {};
1463
1460
  function Se(e) {
1464
- var t, n, r, a;
1461
+ var t, n, r, i;
1465
1462
  if (arguments.length === 1) {
1466
1463
  if (v(e)) return e.slice();
1467
1464
  if (this === ze && typeof e == "string") return [e];
1468
- if (a = be(e)) {
1469
- for (n = []; !(r = a.next()).done; ) n.push(r.value);
1465
+ if (i = be(e)) {
1466
+ for (n = []; !(r = i.next()).done; ) n.push(r.value);
1470
1467
  return n;
1471
1468
  }
1472
1469
  if (e == null) return [e];
@@ -1488,8 +1485,8 @@ function qi() {
1488
1485
  function wt(e, t) {
1489
1486
  return e + ". Errors: " + Object.keys(t).map(function(n) {
1490
1487
  return t[n].toString();
1491
- }).filter(function(n, r, a) {
1492
- return a.indexOf(n) === r;
1488
+ }).filter(function(n, r, i) {
1489
+ return i.indexOf(n) === r;
1493
1490
  }).join(`
1494
1491
  `);
1495
1492
  }
@@ -1508,9 +1505,9 @@ function qi() {
1508
1505
  return e[t] = t + "Error", e;
1509
1506
  }, {}), An = et, z = Le.reduce(function(e, t) {
1510
1507
  var n = t + "Error";
1511
- function r(a, u) {
1512
- this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(u ? `
1513
- ` + u : ""), this.inner = u || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = ce[t] || n, this.inner = null);
1508
+ function r(i, u) {
1509
+ this.name = n, i ? typeof i == "string" ? (this.message = "".concat(i).concat(u ? `
1510
+ ` + u : ""), this.inner = u || null) : typeof i == "object" && (this.message = "".concat(i.name, " ").concat(i.message), this.inner = i) : (this.message = ce[t] || n, this.inner = null);
1514
1511
  }
1515
1512
  return B(r).from(An), e[t] = r, e;
1516
1513
  }, {});
@@ -1539,10 +1536,10 @@ function qi() {
1539
1536
  return e === l ? t : function() {
1540
1537
  var n = e.apply(this, arguments);
1541
1538
  n !== void 0 && (arguments[0] = n);
1542
- var r = this.onsuccess, a = this.onerror;
1539
+ var r = this.onsuccess, i = this.onerror;
1543
1540
  this.onsuccess = null, this.onerror = null;
1544
1541
  var u = t.apply(this, arguments);
1545
- return r && (this.onsuccess = this.onsuccess ? E(r, this.onsuccess) : r), a && (this.onerror = this.onerror ? E(a, this.onerror) : a), u !== void 0 ? u : n;
1542
+ return r && (this.onsuccess = this.onsuccess ? E(r, this.onsuccess) : r), i && (this.onerror = this.onerror ? E(i, this.onerror) : i), u !== void 0 ? u : n;
1546
1543
  };
1547
1544
  }
1548
1545
  function ye(e, t) {
@@ -1556,8 +1553,8 @@ function qi() {
1556
1553
  return e === l ? t : function(n) {
1557
1554
  var r = e.apply(this, arguments);
1558
1555
  D(n, r);
1559
- var a = this.onsuccess, u = this.onerror;
1560
- return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? E(a, this.onsuccess) : a), u && (this.onerror = this.onerror ? E(u, this.onerror) : u), r === void 0 ? n === void 0 ? void 0 : n : D(r, n);
1556
+ var i = this.onsuccess, u = this.onerror;
1557
+ return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), i && (this.onsuccess = this.onsuccess ? E(i, this.onsuccess) : i), u && (this.onerror = this.onerror ? E(u, this.onerror) : u), r === void 0 ? n === void 0 ? void 0 : n : D(r, n);
1561
1558
  };
1562
1559
  }
1563
1560
  function Ie(e, t) {
@@ -1569,7 +1566,7 @@ function qi() {
1569
1566
  return e === l ? t : function() {
1570
1567
  var n = e.apply(this, arguments);
1571
1568
  if (n && typeof n.then == "function") {
1572
- for (var r = this, a = arguments.length, u = new Array(a); a--; ) u[a] = arguments[a];
1569
+ for (var r = this, i = arguments.length, u = new Array(i); i--; ) u[i] = arguments[i];
1573
1570
  return n.then(function() {
1574
1571
  return t.apply(r, u);
1575
1572
  });
@@ -1588,7 +1585,7 @@ function qi() {
1588
1585
  var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
1589
1586
  return [t, R(t), e];
1590
1587
  })(), nt = Ve[0], Le = Ve[1], Ve = Ve[2], Le = Le && Le.then, $e = nt && nt.constructor, Cn = !!Ve, Pt = function(e, t) {
1591
- Ft.push([e, t]), Ht && (queueMicrotask(Pa), Ht = !1);
1588
+ Ft.push([e, t]), Ht && (queueMicrotask(Fa), Ht = !1);
1592
1589
  }, Dn = !0, Ht = !0, ft = [], Zt = [], Sn = s, rt = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: l, pgp: !1, env: {}, finalize: l }, W = rt, Ft = [], dt = 0, Jt = [];
1593
1590
  function $(e) {
1594
1591
  if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
@@ -1598,15 +1595,15 @@ function qi() {
1598
1595
  if (e !== Fe) throw new TypeError("Not a function");
1599
1596
  return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Rn(this, this._value));
1600
1597
  }
1601
- this._state = null, this._value = null, ++t.ref, (function n(r, a) {
1598
+ this._state = null, this._value = null, ++t.ref, (function n(r, i) {
1602
1599
  try {
1603
- a(function(u) {
1600
+ i(function(u) {
1604
1601
  if (r._state === null) {
1605
1602
  if (u === r) throw new TypeError("A promise cannot be resolved with itself.");
1606
- var h = r._lib && Tt();
1603
+ var h = r._lib && xt();
1607
1604
  u && typeof u.then == "function" ? n(r, function(m, b) {
1608
1605
  u instanceof $ ? u._then(m, b) : u.then(m, b);
1609
- }) : (r._state = !0, r._value = u, br(r)), h && xt();
1606
+ }) : (r._state = !0, r._value = u, br(r)), h && Tt();
1610
1607
  }
1611
1608
  }, Rn.bind(null, r));
1612
1609
  } catch (u) {
@@ -1616,9 +1613,9 @@ function qi() {
1616
1613
  }
1617
1614
  var In = { get: function() {
1618
1615
  var e = W, t = rn;
1619
- function n(r, a) {
1620
- var u = this, h = !e.global && (e !== W || t !== rn), m = h && !it(), b = new $(function(_, x) {
1621
- kn(u, new vr(_r(r, e, h, m), _r(a, e, h, m), _, x, e));
1616
+ function n(r, i) {
1617
+ var u = this, h = !e.global && (e !== W || t !== rn), m = h && !it(), b = new $(function(_, T) {
1618
+ kn(u, new vr(_r(r, e, h, m), _r(i, e, h, m), _, T, e));
1622
1619
  });
1623
1620
  return this._consoleTask && (b._consoleTask = this._consoleTask), b;
1624
1621
  }
@@ -1628,21 +1625,21 @@ function qi() {
1628
1625
  return e;
1629
1626
  }, set: In.set });
1630
1627
  } };
1631
- function vr(e, t, n, r, a) {
1632
- this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = a;
1628
+ function vr(e, t, n, r, i) {
1629
+ this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = i;
1633
1630
  }
1634
1631
  function Rn(e, t) {
1635
1632
  var n, r;
1636
- Zt.push(t), e._state === null && (n = e._lib && Tt(), t = Sn(t), e._state = !1, e._value = t, r = e, ft.some(function(a) {
1637
- return a._value === r._value;
1638
- }) || ft.push(r), br(e), n && xt());
1633
+ Zt.push(t), e._state === null && (n = e._lib && xt(), t = Sn(t), e._state = !1, e._value = t, r = e, ft.some(function(i) {
1634
+ return i._value === r._value;
1635
+ }) || ft.push(r), br(e), n && Tt());
1639
1636
  }
1640
1637
  function br(e) {
1641
1638
  var t = e._listeners;
1642
1639
  e._listeners = [];
1643
1640
  for (var n = 0, r = t.length; n < r; ++n) kn(e, t[n]);
1644
- var a = e._PSD;
1645
- --a.ref || a.finalize(), dt === 0 && (++dt, Pt(function() {
1641
+ var i = e._PSD;
1642
+ --i.ref || i.finalize(), dt === 0 && (++dt, Pt(function() {
1646
1643
  --dt == 0 && Pn();
1647
1644
  }, []));
1648
1645
  }
@@ -1650,15 +1647,15 @@ function qi() {
1650
1647
  if (e._state !== null) {
1651
1648
  var n = e._state ? t.onFulfilled : t.onRejected;
1652
1649
  if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
1653
- ++t.psd.ref, ++dt, Pt(ka, [n, e, t]);
1650
+ ++t.psd.ref, ++dt, Pt(Pa, [n, e, t]);
1654
1651
  } else e._listeners.push(t);
1655
1652
  }
1656
- function ka(e, t, n) {
1653
+ function Pa(e, t, n) {
1657
1654
  try {
1658
- var r, a = t._value;
1655
+ var r, i = t._value;
1659
1656
  !t._state && Zt.length && (Zt = []), r = Ne && t._consoleTask ? t._consoleTask.run(function() {
1660
- return e(a);
1661
- }) : e(a), t._state || Zt.indexOf(a) !== -1 || (function(u) {
1657
+ return e(i);
1658
+ }) : e(i), t._state || Zt.indexOf(i) !== -1 || (function(u) {
1662
1659
  for (var h = ft.length; h; ) if (ft[--h]._value === u._value) return ft.splice(h, 1);
1663
1660
  })(t), n.resolve(r);
1664
1661
  } catch (u) {
@@ -1667,16 +1664,16 @@ function qi() {
1667
1664
  --dt == 0 && Pn(), --n.psd.ref || n.psd.finalize();
1668
1665
  }
1669
1666
  }
1670
- function Pa() {
1667
+ function Fa() {
1671
1668
  ht(rt, function() {
1672
- Tt() && xt();
1669
+ xt() && Tt();
1673
1670
  });
1674
1671
  }
1675
- function Tt() {
1672
+ function xt() {
1676
1673
  var e = Dn;
1677
1674
  return Ht = Dn = !1, e;
1678
1675
  }
1679
- function xt() {
1676
+ function Tt() {
1680
1677
  var e, t, n;
1681
1678
  do
1682
1679
  for (; 0 < Ft.length; ) for (e = Ft, Ft = [], n = e.length, t = 0; t < n; ++t) {
@@ -1699,13 +1696,13 @@ function qi() {
1699
1696
  function pe(e, t) {
1700
1697
  var n = W;
1701
1698
  return function() {
1702
- var r = Tt(), a = W;
1699
+ var r = xt(), i = W;
1703
1700
  try {
1704
1701
  return ot(n, !0), e.apply(this, arguments);
1705
1702
  } catch (u) {
1706
1703
  t && t(u);
1707
1704
  } finally {
1708
- ot(a, !1), r && xt();
1705
+ ot(i, !1), r && Tt();
1709
1706
  }
1710
1707
  };
1711
1708
  }
@@ -1731,19 +1728,19 @@ function qi() {
1731
1728
  });
1732
1729
  }, timeout: function(e, t) {
1733
1730
  var n = this;
1734
- return e < 1 / 0 ? new $(function(r, a) {
1731
+ return e < 1 / 0 ? new $(function(r, i) {
1735
1732
  var u = setTimeout(function() {
1736
- return a(new z.Timeout(t));
1733
+ return i(new z.Timeout(t));
1737
1734
  }, e);
1738
- n.then(r, a).finally(clearTimeout.bind(null, u));
1735
+ n.then(r, i).finally(clearTimeout.bind(null, u));
1739
1736
  }) : this;
1740
1737
  } }), typeof Symbol < "u" && Symbol.toStringTag && j($.prototype, Symbol.toStringTag, "Dexie.Promise"), rt.env = wr(), Q($, { all: function() {
1741
1738
  var e = Se.apply(null, arguments).map(an);
1742
1739
  return new $(function(t, n) {
1743
1740
  e.length === 0 && t([]);
1744
1741
  var r = e.length;
1745
- e.forEach(function(a, u) {
1746
- return $.resolve(a).then(function(h) {
1742
+ e.forEach(function(i, u) {
1743
+ return $.resolve(i).then(function(h) {
1747
1744
  e[u] = h, --r || t(e);
1748
1745
  }, n);
1749
1746
  });
@@ -1775,12 +1772,12 @@ function qi() {
1775
1772
  Sn = e;
1776
1773
  } }, follow: function(e, t) {
1777
1774
  return new $(function(n, r) {
1778
- return at(function(a, u) {
1775
+ return at(function(i, u) {
1779
1776
  var h = W;
1780
1777
  h.unhandleds = [], h.onunhandled = u, h.finalize = E(function() {
1781
1778
  var m, b = this;
1782
1779
  m = function() {
1783
- b.unhandleds.length === 0 ? a() : u(b.unhandleds[0]);
1780
+ b.unhandleds.length === 0 ? i() : u(b.unhandleds[0]);
1784
1781
  }, Jt.push(function _() {
1785
1782
  m(), Jt.splice(Jt.indexOf(_), 1);
1786
1783
  }), ++dt, Pt(function() {
@@ -1794,8 +1791,8 @@ function qi() {
1794
1791
  return new $(function(t) {
1795
1792
  e.length === 0 && t([]);
1796
1793
  var n = e.length, r = new Array(n);
1797
- e.forEach(function(a, u) {
1798
- return $.resolve(a).then(function(h) {
1794
+ e.forEach(function(i, u) {
1795
+ return $.resolve(i).then(function(h) {
1799
1796
  return r[u] = { status: "fulfilled", value: h };
1800
1797
  }, function(h) {
1801
1798
  return r[u] = { status: "rejected", reason: h };
@@ -1808,25 +1805,25 @@ function qi() {
1808
1805
  var e = Se.apply(null, arguments).map(an);
1809
1806
  return new $(function(t, n) {
1810
1807
  e.length === 0 && n(new AggregateError([]));
1811
- var r = e.length, a = new Array(r);
1808
+ var r = e.length, i = new Array(r);
1812
1809
  e.forEach(function(u, h) {
1813
1810
  return $.resolve(u).then(function(m) {
1814
1811
  return t(m);
1815
1812
  }, function(m) {
1816
- a[h] = m, --r || n(new AggregateError(a));
1813
+ i[h] = m, --r || n(new AggregateError(i));
1817
1814
  });
1818
1815
  });
1819
1816
  });
1820
1817
  }), $e.withResolvers && ($.withResolvers = $e.withResolvers));
1821
- var Ce = { awaits: 0, echoes: 0, id: 0 }, Fa = 0, tn = [], nn = 0, rn = 0, Ba = 0;
1818
+ var Ce = { awaits: 0, echoes: 0, id: 0 }, Ba = 0, tn = [], nn = 0, rn = 0, ja = 0;
1822
1819
  function at(e, t, n, r) {
1823
- var a = W, u = Object.create(a);
1824
- return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Ba, rt.env, u.env = Cn ? { Promise: $, PromiseProp: { value: $, configurable: !0, writable: !0 }, all: $.all, race: $.race, allSettled: $.allSettled, any: $.any, resolve: $.resolve, reject: $.reject } : {}, t && D(u, t), ++a.ref, u.finalize = function() {
1820
+ var i = W, u = Object.create(i);
1821
+ return u.parent = i, u.ref = 0, u.global = !1, u.id = ++ja, rt.env, u.env = Cn ? { Promise: $, PromiseProp: { value: $, configurable: !0, writable: !0 }, all: $.all, race: $.race, allSettled: $.allSettled, any: $.any, resolve: $.resolve, reject: $.reject } : {}, t && D(u, t), ++i.ref, u.finalize = function() {
1825
1822
  --this.parent.ref || this.parent.finalize();
1826
1823
  }, r = ht(u, e, n, r), u.ref === 0 && u.finalize(), r;
1827
1824
  }
1828
1825
  function Nt() {
1829
- return Ce.id || (Ce.id = ++Fa), ++Ce.awaits, Ce.echoes += Qt, Ce.id;
1826
+ return Ce.id || (Ce.id = ++Ba), ++Ce.awaits, Ce.echoes += Qt, Ce.id;
1830
1827
  }
1831
1828
  function it() {
1832
1829
  return !!Ce.awaits && (--Ce.awaits == 0 && (Ce.id = 0), Ce.echoes = Ce.awaits * Qt, !0);
@@ -1838,36 +1835,36 @@ function qi() {
1838
1835
  return it(), Ee(t);
1839
1836
  })) : e;
1840
1837
  }
1841
- function ja() {
1838
+ function Ma() {
1842
1839
  var e = tn[tn.length - 1];
1843
1840
  tn.pop(), ot(e, !1);
1844
1841
  }
1845
1842
  function ot(e, t) {
1846
1843
  var n, r = W;
1847
- (t ? !Ce.echoes || nn++ && e === W : !nn || --nn && e === W) || queueMicrotask(t ? (function(a) {
1848
- ++rn, Ce.echoes && --Ce.echoes != 0 || (Ce.echoes = Ce.awaits = Ce.id = 0), tn.push(W), ot(a, !0);
1849
- }).bind(null, e) : ja), e !== W && (W = e, r === rt && (rt.env = wr()), Cn && (n = rt.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(d, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
1844
+ (t ? !Ce.echoes || nn++ && e === W : !nn || --nn && e === W) || queueMicrotask(t ? (function(i) {
1845
+ ++rn, Ce.echoes && --Ce.echoes != 0 || (Ce.echoes = Ce.awaits = Ce.id = 0), tn.push(W), ot(i, !0);
1846
+ }).bind(null, e) : Ma), e !== W && (W = e, r === rt && (rt.env = wr()), Cn && (n = rt.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(d, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
1850
1847
  }
1851
1848
  function wr() {
1852
1849
  var e = d.Promise;
1853
1850
  return Cn ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(d, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
1854
1851
  }
1855
- function ht(e, t, n, r, a) {
1852
+ function ht(e, t, n, r, i) {
1856
1853
  var u = W;
1857
1854
  try {
1858
- return ot(e, !0), t(n, r, a);
1855
+ return ot(e, !0), t(n, r, i);
1859
1856
  } finally {
1860
1857
  ot(u, !1);
1861
1858
  }
1862
1859
  }
1863
1860
  function _r(e, t, n, r) {
1864
1861
  return typeof e != "function" ? e : function() {
1865
- var a = W;
1862
+ var i = W;
1866
1863
  n && Nt(), ot(t, !0);
1867
1864
  try {
1868
1865
  return e.apply(this, arguments);
1869
1866
  } finally {
1870
- ot(a, !1), r && queueMicrotask(it);
1867
+ ot(i, !1), r && queueMicrotask(it);
1871
1868
  }
1872
1869
  };
1873
1870
  }
@@ -1881,7 +1878,7 @@ function qi() {
1881
1878
  return e.apply(this, arguments) && t.apply(this, arguments);
1882
1879
  } : e : t;
1883
1880
  }
1884
- var Tr = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 };
1881
+ var xr = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 };
1885
1882
  function sn(e) {
1886
1883
  return typeof e != "string" || /\./.test(e) ? function(t) {
1887
1884
  return t;
@@ -1889,7 +1886,7 @@ function qi() {
1889
1886
  return t[e] === void 0 && e in t && delete (t = We(t))[e], t;
1890
1887
  };
1891
1888
  }
1892
- function xr() {
1889
+ function Tr() {
1893
1890
  throw z.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.");
1894
1891
  }
1895
1892
  function re(e, t) {
@@ -1902,15 +1899,15 @@ function qi() {
1902
1899
  case "string":
1903
1900
  return t < e ? 1 : e < t ? -1 : 0;
1904
1901
  case "binary":
1905
- return (function(a, u) {
1906
- for (var h = a.length, m = u.length, b = h < m ? h : m, _ = 0; _ < b; ++_) if (a[_] !== u[_]) return a[_] < u[_] ? -1 : 1;
1902
+ return (function(i, u) {
1903
+ for (var h = i.length, m = u.length, b = h < m ? h : m, _ = 0; _ < b; ++_) if (i[_] !== u[_]) return i[_] < u[_] ? -1 : 1;
1907
1904
  return h === m ? 0 : h < m ? -1 : 1;
1908
1905
  })(Or(e), Or(t));
1909
1906
  case "Array":
1910
- return (function(a, u) {
1911
- for (var h = a.length, m = u.length, b = h < m ? h : m, _ = 0; _ < b; ++_) {
1912
- var x = re(a[_], u[_]);
1913
- if (x !== 0) return x;
1907
+ return (function(i, u) {
1908
+ for (var h = i.length, m = u.length, b = h < m ? h : m, _ = 0; _ < b; ++_) {
1909
+ var T = re(i[_], u[_]);
1910
+ if (T !== 0) return T;
1914
1911
  }
1915
1912
  return h === m ? 0 : h < m ? -1 : 1;
1916
1913
  })(e, t);
@@ -1928,68 +1925,68 @@ function qi() {
1928
1925
  }
1929
1926
  function un(e, t, n) {
1930
1927
  var r = e.schema.yProps;
1931
- return r ? (t && 0 < n.numFailures && (t = t.filter(function(a, u) {
1928
+ return r ? (t && 0 < n.numFailures && (t = t.filter(function(i, u) {
1932
1929
  return !n.failures[u];
1933
- })), Promise.all(r.map(function(a) {
1934
- return a = a.updatesTable, t ? e.db.table(a).where("k").anyOf(t).delete() : e.db.table(a).clear();
1930
+ })), Promise.all(r.map(function(i) {
1931
+ return i = i.updatesTable, t ? e.db.table(i).where("k").anyOf(t).delete() : e.db.table(i).clear();
1935
1932
  })).then(function() {
1936
1933
  return n;
1937
1934
  })) : n;
1938
1935
  }
1939
1936
  var Ar = (he.prototype._trans = function(e, t, n) {
1940
- var r = this._tx || W.trans, a = this.name, u = Ne && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
1941
- function h(_, x, y) {
1942
- if (!y.schema[a]) throw new z.NotFound("Table " + a + " not part of transaction");
1937
+ var r = this._tx || W.trans, i = this.name, u = Ne && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
1938
+ function h(_, T, y) {
1939
+ if (!y.schema[i]) throw new z.NotFound("Table " + i + " not part of transaction");
1943
1940
  return t(y.idbtrans, y);
1944
1941
  }
1945
- var m = Tt();
1942
+ var m = xt();
1946
1943
  try {
1947
1944
  var b = r && r.db._novip === this.db._novip ? r === W.trans ? r._promise(e, h, n) : at(function() {
1948
1945
  return r._promise(e, h, n);
1949
- }, { trans: r, transless: W.transless || W }) : (function _(x, y, A, w) {
1950
- if (x.idbdb && (x._state.openComplete || W.letThrough || x._vip)) {
1951
- var T = x._createTransaction(y, A, x._dbSchema);
1946
+ }, { trans: r, transless: W.transless || W }) : (function _(T, y, A, w) {
1947
+ if (T.idbdb && (T._state.openComplete || W.letThrough || T._vip)) {
1948
+ var x = T._createTransaction(y, A, T._dbSchema);
1952
1949
  try {
1953
- T.create(), x._state.PR1398_maxLoop = 3;
1950
+ x.create(), T._state.PR1398_maxLoop = 3;
1954
1951
  } catch (O) {
1955
- return O.name === lt.InvalidState && x.isOpen() && 0 < --x._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), x.close({ disableAutoOpen: !1 }), x.open().then(function() {
1956
- return _(x, y, A, w);
1952
+ return O.name === lt.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
1953
+ return _(T, y, A, w);
1957
1954
  })) : Ee(O);
1958
1955
  }
1959
- return T._promise(y, function(O, N) {
1956
+ return x._promise(y, function(O, N) {
1960
1957
  return at(function() {
1961
- return W.trans = T, w(O, N, T);
1958
+ return W.trans = x, w(O, N, x);
1962
1959
  });
1963
1960
  }).then(function(O) {
1964
1961
  if (y === "readwrite") try {
1965
- T.idbtrans.commit();
1962
+ x.idbtrans.commit();
1966
1963
  } catch {
1967
1964
  }
1968
- return y === "readonly" ? O : T._completion.then(function() {
1965
+ return y === "readonly" ? O : x._completion.then(function() {
1969
1966
  return O;
1970
1967
  });
1971
1968
  });
1972
1969
  }
1973
- if (x._state.openComplete) return Ee(new z.DatabaseClosed(x._state.dbOpenError));
1974
- if (!x._state.isBeingOpened) {
1975
- if (!x._state.autoOpen) return Ee(new z.DatabaseClosed());
1976
- x.open().catch(l);
1970
+ if (T._state.openComplete) return Ee(new z.DatabaseClosed(T._state.dbOpenError));
1971
+ if (!T._state.isBeingOpened) {
1972
+ if (!T._state.autoOpen) return Ee(new z.DatabaseClosed());
1973
+ T.open().catch(l);
1977
1974
  }
1978
- return x._state.dbReadyPromise.then(function() {
1979
- return _(x, y, A, w);
1975
+ return T._state.dbReadyPromise.then(function() {
1976
+ return _(T, y, A, w);
1980
1977
  });
1981
1978
  })(this.db, e, [this.name], h);
1982
1979
  return u && (b._consoleTask = u, b = b.catch(function(_) {
1983
1980
  return console.trace(_), Ee(_);
1984
1981
  })), b;
1985
1982
  } finally {
1986
- m && xt();
1983
+ m && Tt();
1987
1984
  }
1988
1985
  }, he.prototype.get = function(e, t) {
1989
1986
  var n = this;
1990
1987
  return e && e.constructor === Object ? this.where(e).first(t) : e == null ? Ee(new z.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(r) {
1991
- return n.core.get({ trans: r, key: e }).then(function(a) {
1992
- return n.hook.reading.fire(a);
1988
+ return n.core.get({ trans: r, key: e }).then(function(i) {
1989
+ return n.hook.reading.fire(i);
1993
1990
  });
1994
1991
  }).then(t);
1995
1992
  }, he.prototype.where = function(e) {
@@ -2016,18 +2013,18 @@ function qi() {
2016
2013
  }
2017
2014
  !n && Ne && console.warn("The query ".concat(JSON.stringify(e), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(t.join("+"), "]"));
2018
2015
  var r = this.schema.idxByName;
2019
- function a(m, b) {
2016
+ function i(m, b) {
2020
2017
  return re(m, b) === 0;
2021
2018
  }
2022
2019
  var h = t.reduce(function(y, b) {
2023
- var _ = y[0], x = y[1], y = r[b], A = e[b];
2024
- return [_ || y, _ || !y ? mt(x, y && y.multi ? function(w) {
2025
- return w = de(w, b), v(w) && w.some(function(T) {
2026
- return a(A, T);
2020
+ var _ = y[0], T = y[1], y = r[b], A = e[b];
2021
+ return [_ || y, _ || !y ? mt(T, y && y.multi ? function(w) {
2022
+ return w = de(w, b), v(w) && w.some(function(x) {
2023
+ return i(A, x);
2027
2024
  });
2028
2025
  } : function(w) {
2029
- return a(A, de(w, b));
2030
- }) : x];
2026
+ return i(A, de(w, b));
2027
+ }) : T];
2031
2028
  }, [null, null]), u = h[0], h = h[1];
2032
2029
  return u ? this.where(u.name).equals(e[u.keyPath]).filter(h) : n ? this.filter(h) : this.where(t).equals("");
2033
2030
  }, he.prototype.filter = function(e) {
@@ -2050,31 +2047,31 @@ function qi() {
2050
2047
  return this.toCollection().reverse();
2051
2048
  }, he.prototype.mapToClass = function(e) {
2052
2049
  var t, n = this.db, r = this.name;
2053
- function a() {
2050
+ function i() {
2054
2051
  return t !== null && t.apply(this, arguments) || this;
2055
2052
  }
2056
- (this.schema.mappedClass = e).prototype instanceof xr && ((function(b, _) {
2053
+ (this.schema.mappedClass = e).prototype instanceof Tr && ((function(b, _) {
2057
2054
  if (typeof _ != "function" && _ !== null) throw new TypeError("Class extends value " + String(_) + " is not a constructor or null");
2058
- function x() {
2055
+ function T() {
2059
2056
  this.constructor = b;
2060
2057
  }
2061
- c(b, _), b.prototype = _ === null ? Object.create(_) : (x.prototype = _.prototype, new x());
2062
- })(a, t = e), Object.defineProperty(a.prototype, "db", { get: function() {
2058
+ c(b, _), b.prototype = _ === null ? Object.create(_) : (T.prototype = _.prototype, new T());
2059
+ })(i, t = e), Object.defineProperty(i.prototype, "db", { get: function() {
2063
2060
  return n;
2064
- }, enumerable: !1, configurable: !0 }), a.prototype.table = function() {
2061
+ }, enumerable: !1, configurable: !0 }), i.prototype.table = function() {
2065
2062
  return r;
2066
- }, e = a);
2063
+ }, e = i);
2067
2064
  for (var u = /* @__PURE__ */ new Set(), h = e.prototype; h; h = R(h)) Object.getOwnPropertyNames(h).forEach(function(b) {
2068
2065
  return u.add(b);
2069
2066
  });
2070
2067
  function m(b) {
2071
2068
  if (!b) return b;
2072
- var _, x = Object.create(e.prototype);
2069
+ var _, T = Object.create(e.prototype);
2073
2070
  for (_ in b) if (!u.has(_)) try {
2074
- x[_] = b[_];
2071
+ T[_] = b[_];
2075
2072
  } catch {
2076
2073
  }
2077
- return x;
2074
+ return T;
2078
2075
  }
2079
2076
  return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = m, this.hook("reading", m), e;
2080
2077
  }, he.prototype.defineClass = function() {
@@ -2082,8 +2079,8 @@ function qi() {
2082
2079
  D(this, e);
2083
2080
  });
2084
2081
  }, he.prototype.add = function(e, t) {
2085
- var n = this, r = this.schema.primKey, a = r.auto, u = r.keyPath, h = e;
2086
- return u && a && (h = sn(u)(e)), this._trans("readwrite", function(m) {
2082
+ var n = this, r = this.schema.primKey, i = r.auto, u = r.keyPath, h = e;
2083
+ return u && i && (h = sn(u)(e)), this._trans("readwrite", function(m) {
2087
2084
  return n.core.mutate({ trans: m, type: "add", keys: t != null ? [t] : null, values: [h] });
2088
2085
  }).then(function(m) {
2089
2086
  return m.numFailures ? $.reject(m.failures[0]) : m.lastResult;
@@ -2097,8 +2094,8 @@ function qi() {
2097
2094
  }, he.prototype.update = function(e, t) {
2098
2095
  return typeof e != "object" || v(e) ? this.where(":id").equals(e).modify(t) : (e = de(e, this.schema.primKey.keyPath), e === void 0 ? Ee(new z.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
2099
2096
  }, he.prototype.put = function(e, t) {
2100
- var n = this, r = this.schema.primKey, a = r.auto, u = r.keyPath, h = e;
2101
- return u && a && (h = sn(u)(e)), this._trans("readwrite", function(m) {
2097
+ var n = this, r = this.schema.primKey, i = r.auto, u = r.keyPath, h = e;
2098
+ return u && i && (h = sn(u)(e)), this._trans("readwrite", function(m) {
2102
2099
  return n.core.mutate({ trans: m, type: "put", values: [h], keys: t != null ? [t] : null });
2103
2100
  }).then(function(m) {
2104
2101
  return m.numFailures ? $.reject(m.failures[0]) : m.lastResult;
@@ -2121,7 +2118,7 @@ function qi() {
2121
2118
  }, he.prototype.clear = function() {
2122
2119
  var e = this;
2123
2120
  return this._trans("readwrite", function(t) {
2124
- return e.core.mutate({ trans: t, type: "deleteRange", range: Tr }).then(function(n) {
2121
+ return e.core.mutate({ trans: t, type: "deleteRange", range: xr }).then(function(n) {
2125
2122
  return un(e, null, n);
2126
2123
  });
2127
2124
  }).then(function(t) {
@@ -2131,51 +2128,51 @@ function qi() {
2131
2128
  var t = this;
2132
2129
  return this._trans("readonly", function(n) {
2133
2130
  return t.core.getMany({ keys: e, trans: n }).then(function(r) {
2134
- return r.map(function(a) {
2135
- return t.hook.reading.fire(a);
2131
+ return r.map(function(i) {
2132
+ return t.hook.reading.fire(i);
2136
2133
  });
2137
2134
  });
2138
2135
  });
2139
2136
  }, he.prototype.bulkAdd = function(e, t, n) {
2140
- var r = this, a = Array.isArray(t) ? t : void 0, u = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
2137
+ var r = this, i = Array.isArray(t) ? t : void 0, u = (n = n || (i ? void 0 : t)) ? n.allKeys : void 0;
2141
2138
  return this._trans("readwrite", function(h) {
2142
2139
  var _ = r.schema.primKey, m = _.auto, _ = _.keyPath;
2143
- if (_ && a) throw new z.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
2144
- if (a && a.length !== e.length) throw new z.InvalidArgument("Arguments objects and keys must have the same length");
2140
+ if (_ && i) throw new z.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
2141
+ if (i && i.length !== e.length) throw new z.InvalidArgument("Arguments objects and keys must have the same length");
2145
2142
  var b = e.length, _ = _ && m ? e.map(sn(_)) : e;
2146
- return r.core.mutate({ trans: h, type: "add", keys: a, values: _, wantResults: u }).then(function(T) {
2147
- var y = T.numFailures, A = T.results, w = T.lastResult, T = T.failures;
2143
+ return r.core.mutate({ trans: h, type: "add", keys: i, values: _, wantResults: u }).then(function(x) {
2144
+ var y = x.numFailures, A = x.results, w = x.lastResult, x = x.failures;
2148
2145
  if (y === 0) return u ? A : w;
2149
- throw new je("".concat(r.name, ".bulkAdd(): ").concat(y, " of ").concat(b, " operations failed"), T);
2146
+ throw new je("".concat(r.name, ".bulkAdd(): ").concat(y, " of ").concat(b, " operations failed"), x);
2150
2147
  });
2151
2148
  });
2152
2149
  }, he.prototype.bulkPut = function(e, t, n) {
2153
- var r = this, a = Array.isArray(t) ? t : void 0, u = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
2150
+ var r = this, i = Array.isArray(t) ? t : void 0, u = (n = n || (i ? void 0 : t)) ? n.allKeys : void 0;
2154
2151
  return this._trans("readwrite", function(h) {
2155
2152
  var _ = r.schema.primKey, m = _.auto, _ = _.keyPath;
2156
- if (_ && a) throw new z.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
2157
- if (a && a.length !== e.length) throw new z.InvalidArgument("Arguments objects and keys must have the same length");
2153
+ if (_ && i) throw new z.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
2154
+ if (i && i.length !== e.length) throw new z.InvalidArgument("Arguments objects and keys must have the same length");
2158
2155
  var b = e.length, _ = _ && m ? e.map(sn(_)) : e;
2159
- return r.core.mutate({ trans: h, type: "put", keys: a, values: _, wantResults: u }).then(function(T) {
2160
- var y = T.numFailures, A = T.results, w = T.lastResult, T = T.failures;
2156
+ return r.core.mutate({ trans: h, type: "put", keys: i, values: _, wantResults: u }).then(function(x) {
2157
+ var y = x.numFailures, A = x.results, w = x.lastResult, x = x.failures;
2161
2158
  if (y === 0) return u ? A : w;
2162
- throw new je("".concat(r.name, ".bulkPut(): ").concat(y, " of ").concat(b, " operations failed"), T);
2159
+ throw new je("".concat(r.name, ".bulkPut(): ").concat(y, " of ").concat(b, " operations failed"), x);
2163
2160
  });
2164
2161
  });
2165
2162
  }, he.prototype.bulkUpdate = function(e) {
2166
2163
  var t = this, n = this.core, r = e.map(function(h) {
2167
2164
  return h.key;
2168
- }), a = e.map(function(h) {
2165
+ }), i = e.map(function(h) {
2169
2166
  return h.changes;
2170
2167
  }), u = [];
2171
2168
  return this._trans("readwrite", function(h) {
2172
2169
  return n.getMany({ trans: h, keys: r, cache: "clone" }).then(function(m) {
2173
2170
  var b = [], _ = [];
2174
2171
  e.forEach(function(y, A) {
2175
- var w = y.key, T = y.changes, O = m[A];
2172
+ var w = y.key, x = y.changes, O = m[A];
2176
2173
  if (O) {
2177
- for (var N = 0, C = Object.keys(T); N < C.length; N++) {
2178
- var I = C[N], P = T[I];
2174
+ for (var N = 0, C = Object.keys(x); N < C.length; N++) {
2175
+ var I = C[N], P = x[I];
2179
2176
  if (I === t.schema.primKey.keyPath) {
2180
2177
  if (re(P, w) !== 0) throw new z.Constraint("Cannot update primary key in bulkUpdate()");
2181
2178
  } else le(O, I, P);
@@ -2183,28 +2180,28 @@ function qi() {
2183
2180
  u.push(A), b.push(w), _.push(O);
2184
2181
  }
2185
2182
  });
2186
- var x = b.length;
2187
- return n.mutate({ trans: h, type: "put", keys: b, values: _, updates: { keys: r, changeSpecs: a } }).then(function(y) {
2183
+ var T = b.length;
2184
+ return n.mutate({ trans: h, type: "put", keys: b, values: _, updates: { keys: r, changeSpecs: i } }).then(function(y) {
2188
2185
  var A = y.numFailures, w = y.failures;
2189
- if (A === 0) return x;
2190
- for (var T = 0, O = Object.keys(w); T < O.length; T++) {
2191
- var N, C = O[T], I = u[Number(C)];
2186
+ if (A === 0) return T;
2187
+ for (var x = 0, O = Object.keys(w); x < O.length; x++) {
2188
+ var N, C = O[x], I = u[Number(C)];
2192
2189
  I != null && (N = w[C], delete w[C], w[I] = N);
2193
2190
  }
2194
- throw new je("".concat(t.name, ".bulkUpdate(): ").concat(A, " of ").concat(x, " operations failed"), w);
2191
+ throw new je("".concat(t.name, ".bulkUpdate(): ").concat(A, " of ").concat(T, " operations failed"), w);
2195
2192
  });
2196
2193
  });
2197
2194
  });
2198
2195
  }, he.prototype.bulkDelete = function(e) {
2199
2196
  var t = this, n = e.length;
2200
2197
  return this._trans("readwrite", function(r) {
2201
- return t.core.mutate({ trans: r, type: "delete", keys: e }).then(function(a) {
2202
- return un(t, e, a);
2198
+ return t.core.mutate({ trans: r, type: "delete", keys: e }).then(function(i) {
2199
+ return un(t, e, i);
2203
2200
  });
2204
2201
  }).then(function(h) {
2205
- var a = h.numFailures, u = h.lastResult, h = h.failures;
2206
- if (a === 0) return u;
2207
- throw new je("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), h);
2202
+ var i = h.numFailures, u = h.lastResult, h = h.failures;
2203
+ if (i === 0) return u;
2204
+ throw new je("".concat(t.name, ".bulkDelete(): ").concat(i, " of ").concat(n, " operations failed"), h);
2208
2205
  });
2209
2206
  }, he);
2210
2207
  function he() {
@@ -2219,20 +2216,20 @@ function qi() {
2219
2216
  }
2220
2217
  var n = {};
2221
2218
  t.addEventType = u;
2222
- for (var r = 1, a = arguments.length; r < a; ++r) u(arguments[r]);
2219
+ for (var r = 1, i = arguments.length; r < i; ++r) u(arguments[r]);
2223
2220
  return t;
2224
2221
  function u(h, m, b) {
2225
2222
  if (typeof h != "object") {
2226
2223
  var _;
2227
2224
  m = m || Ie;
2228
- var x = { subscribers: [], fire: b = b || l, subscribe: function(y) {
2229
- x.subscribers.indexOf(y) === -1 && (x.subscribers.push(y), x.fire = m(x.fire, y));
2225
+ var T = { subscribers: [], fire: b = b || l, subscribe: function(y) {
2226
+ T.subscribers.indexOf(y) === -1 && (T.subscribers.push(y), T.fire = m(T.fire, y));
2230
2227
  }, unsubscribe: function(y) {
2231
- x.subscribers = x.subscribers.filter(function(A) {
2228
+ T.subscribers = T.subscribers.filter(function(A) {
2232
2229
  return A !== y;
2233
- }), x.fire = x.subscribers.reduce(m, b);
2230
+ }), T.fire = T.subscribers.reduce(m, b);
2234
2231
  } };
2235
- return n[h] = t[h] = x;
2232
+ return n[h] = t[h] = T;
2236
2233
  }
2237
2234
  g(_ = h).forEach(function(y) {
2238
2235
  var A = _[y];
@@ -2240,7 +2237,7 @@ function qi() {
2240
2237
  else {
2241
2238
  if (A !== "asap") throw new z.InvalidArgument("Invalid event config");
2242
2239
  var w = u(y, s, function() {
2243
- for (var T = arguments.length, O = new Array(T); T--; ) O[T] = arguments[T];
2240
+ for (var x = arguments.length, O = new Array(x); x--; ) O[x] = arguments[x];
2244
2241
  w.subscribers.forEach(function(N) {
2245
2242
  Z(function() {
2246
2243
  N.apply(null, O);
@@ -2277,22 +2274,22 @@ function qi() {
2277
2274
  return t.openCursor({ trans: n, values: !e.keysOnly, reverse: e.dir === "prev", unique: !!e.unique, query: { index: r, range: e.range } });
2278
2275
  }
2279
2276
  function ln(e, t, n, r) {
2280
- var a = e.replayFilter ? mt(e.filter, e.replayFilter()) : e.filter;
2277
+ var i = e.replayFilter ? mt(e.filter, e.replayFilter()) : e.filter;
2281
2278
  if (e.or) {
2282
2279
  var u = {}, h = function(m, b, _) {
2283
- var x, y;
2284
- a && !a(b, _, function(A) {
2280
+ var T, y;
2281
+ i && !i(b, _, function(A) {
2285
2282
  return b.stop(A);
2286
2283
  }, function(A) {
2287
2284
  return b.fail(A);
2288
- }) || ((y = "" + (x = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(x)), Y(u, y) || (u[y] = !0, t(m, b, _)));
2285
+ }) || ((y = "" + (T = b.primaryKey)) == "[object ArrayBuffer]" && (y = "" + new Uint8Array(T)), Y(u, y) || (u[y] = !0, t(m, b, _)));
2289
2286
  };
2290
2287
  return Promise.all([e.or._iterate(h, n), Dr(Cr(e, r, n), e.algorithm, h, !e.keysOnly && e.valueMapper)]);
2291
2288
  }
2292
- return Dr(Cr(e, r, n), mt(e.algorithm, a), t, !e.keysOnly && e.valueMapper);
2289
+ return Dr(Cr(e, r, n), mt(e.algorithm, i), t, !e.keysOnly && e.valueMapper);
2293
2290
  }
2294
2291
  function Dr(e, t, n, r) {
2295
- var a = pe(r ? function(u, h, m) {
2292
+ var i = pe(r ? function(u, h, m) {
2296
2293
  return n(r(u), h, m);
2297
2294
  } : n);
2298
2295
  return e.then(function(u) {
@@ -2306,7 +2303,7 @@ function qi() {
2306
2303
  u.stop(m), h = l;
2307
2304
  }, function(m) {
2308
2305
  u.fail(m), h = l;
2309
- }) || a(u.value, u, function(m) {
2306
+ }) || i(u.value, u, function(m) {
2310
2307
  return h = m;
2311
2308
  }), h();
2312
2309
  });
@@ -2327,8 +2324,8 @@ function qi() {
2327
2324
  }
2328
2325
  if (t.remove !== void 0) {
2329
2326
  var r = t.remove;
2330
- if (v(r)) return v(e) ? e.filter(function(a) {
2331
- return !r.includes(a);
2327
+ if (v(r)) return v(e) ? e.filter(function(i) {
2328
+ return !r.includes(i);
2332
2329
  }).sort() : [];
2333
2330
  if (typeof r == "number") return Number(e) - r;
2334
2331
  if (typeof r == "bigint") try {
@@ -2343,7 +2340,7 @@ function qi() {
2343
2340
  function Sr(e) {
2344
2341
  this["@@propmod"] = e;
2345
2342
  }
2346
- var Ma = (oe.prototype._read = function(e, t) {
2343
+ var Ka = (oe.prototype._read = function(e, t) {
2347
2344
  var n = this._ctx;
2348
2345
  return n.error ? n.table._trans(null, Ee.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
2349
2346
  }, oe.prototype._write = function(e) {
@@ -2367,25 +2364,25 @@ function qi() {
2367
2364
  }, oe.prototype.count = function(e) {
2368
2365
  var t = this;
2369
2366
  return this._read(function(n) {
2370
- var r = t._ctx, a = r.table.core;
2371
- if (At(r, !0)) return a.count({ trans: n, query: { index: cn(r, a.schema), range: r.range } }).then(function(h) {
2367
+ var r = t._ctx, i = r.table.core;
2368
+ if (At(r, !0)) return i.count({ trans: n, query: { index: cn(r, i.schema), range: r.range } }).then(function(h) {
2372
2369
  return Math.min(h, r.limit);
2373
2370
  });
2374
2371
  var u = 0;
2375
2372
  return ln(r, function() {
2376
2373
  return ++u, !1;
2377
- }, n, a).then(function() {
2374
+ }, n, i).then(function() {
2378
2375
  return u;
2379
2376
  });
2380
2377
  }).then(e);
2381
2378
  }, oe.prototype.sortBy = function(e, t) {
2382
- var n = e.split(".").reverse(), r = n[0], a = n.length - 1;
2379
+ var n = e.split(".").reverse(), r = n[0], i = n.length - 1;
2383
2380
  function u(b, _) {
2384
2381
  return _ ? u(b[n[_]], _ - 1) : b[r];
2385
2382
  }
2386
2383
  var h = this._ctx.dir === "next" ? 1 : -1;
2387
2384
  function m(b, _) {
2388
- return re(u(b, a), u(_, a)) * h;
2385
+ return re(u(b, i), u(_, i)) * h;
2389
2386
  }
2390
2387
  return this.toArray(function(b) {
2391
2388
  return b.sort(m);
@@ -2395,9 +2392,9 @@ function qi() {
2395
2392
  return this._read(function(n) {
2396
2393
  var r = t._ctx;
2397
2394
  if (r.dir === "next" && At(r, !0) && 0 < r.limit) {
2398
- var a = r.valueMapper, u = cn(r, r.table.core.schema);
2395
+ var i = r.valueMapper, u = cn(r, r.table.core.schema);
2399
2396
  return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index: u, range: r.range } }).then(function(m) {
2400
- return m = m.result, a ? m.map(a) : m;
2397
+ return m = m.result, i ? m.map(i) : m;
2401
2398
  });
2402
2399
  }
2403
2400
  var h = [];
@@ -2411,8 +2408,8 @@ function qi() {
2411
2408
  var t = this._ctx;
2412
2409
  return e <= 0 || (t.offset += e, At(t) ? Kn(t, function() {
2413
2410
  var n = e;
2414
- return function(r, a) {
2415
- return n === 0 || (n === 1 ? --n : a(function() {
2411
+ return function(r, i) {
2412
+ return n === 0 || (n === 1 ? --n : i(function() {
2416
2413
  r.advance(n), n = 0;
2417
2414
  }), !1);
2418
2415
  };
@@ -2425,13 +2422,13 @@ function qi() {
2425
2422
  }, oe.prototype.limit = function(e) {
2426
2423
  return this._ctx.limit = Math.min(this._ctx.limit, e), Kn(this._ctx, function() {
2427
2424
  var t = e;
2428
- return function(n, r, a) {
2429
- return --t <= 0 && r(a), 0 <= t;
2425
+ return function(n, r, i) {
2426
+ return --t <= 0 && r(i), 0 <= t;
2430
2427
  };
2431
2428
  }, !0), this;
2432
2429
  }, oe.prototype.until = function(e, t) {
2433
- return Mn(this._ctx, function(n, r, a) {
2434
- return !e(n.value) || (r(a), t);
2430
+ return Mn(this._ctx, function(n, r, i) {
2431
+ return !e(n.value) || (r(i), t);
2435
2432
  }), this;
2436
2433
  }, oe.prototype.first = function(e) {
2437
2434
  return this.limit(1).toArray(function(t) {
@@ -2468,23 +2465,23 @@ function qi() {
2468
2465
  var t = this._ctx;
2469
2466
  t.keysOnly = !t.isMatch;
2470
2467
  var n = [];
2471
- return this.each(function(r, a) {
2472
- n.push(a.key);
2468
+ return this.each(function(r, i) {
2469
+ n.push(i.key);
2473
2470
  }).then(function() {
2474
2471
  return n;
2475
2472
  }).then(e);
2476
2473
  }, oe.prototype.primaryKeys = function(e) {
2477
2474
  var t = this._ctx;
2478
2475
  if (t.dir === "next" && At(t, !0) && 0 < t.limit) return this._read(function(r) {
2479
- var a = cn(t, t.table.core.schema);
2480
- return t.table.core.query({ trans: r, values: !1, limit: t.limit, query: { index: a, range: t.range } });
2476
+ var i = cn(t, t.table.core.schema);
2477
+ return t.table.core.query({ trans: r, values: !1, limit: t.limit, query: { index: i, range: t.range } });
2481
2478
  }).then(function(r) {
2482
2479
  return r.result;
2483
2480
  }).then(e);
2484
2481
  t.keysOnly = !t.isMatch;
2485
2482
  var n = [];
2486
- return this.each(function(r, a) {
2487
- n.push(a.primaryKey);
2483
+ return this.each(function(r, i) {
2484
+ n.push(i.primaryKey);
2488
2485
  }).then(function() {
2489
2486
  return n;
2490
2487
  }).then(e);
@@ -2500,35 +2497,35 @@ function qi() {
2500
2497
  var e = this._ctx, e = e.index && e.table.schema.idxByName[e.index];
2501
2498
  if (!e || !e.multi) return this;
2502
2499
  var t = {};
2503
- return Mn(this._ctx, function(a) {
2504
- var r = a.primaryKey.toString(), a = Y(t, r);
2505
- return t[r] = !0, !a;
2500
+ return Mn(this._ctx, function(i) {
2501
+ var r = i.primaryKey.toString(), i = Y(t, r);
2502
+ return t[r] = !0, !i;
2506
2503
  }), this;
2507
2504
  }, oe.prototype.modify = function(e) {
2508
2505
  var t = this, n = this._ctx;
2509
2506
  return this._write(function(r) {
2510
- var a, u, h;
2511
- h = typeof e == "function" ? e : (a = g(e), u = a.length, function(C) {
2507
+ var i, u, h;
2508
+ h = typeof e == "function" ? e : (i = g(e), u = i.length, function(C) {
2512
2509
  for (var I = !1, P = 0; P < u; ++P) {
2513
- var F = a[P], M = e[F], U = de(C, F);
2510
+ var F = i[P], M = e[F], U = de(C, F);
2514
2511
  M instanceof Mt ? (le(C, F, M.execute(U)), I = !0) : U !== M && (le(C, F, M), I = !0);
2515
2512
  }
2516
2513
  return I;
2517
2514
  });
2518
- var m = n.table.core, y = m.schema.primaryKey, b = y.outbound, _ = y.extractKey, x = 200, y = t.db._options.modifyChunkSize;
2519
- y && (x = typeof y == "object" ? y[m.name] || y["*"] || 200 : y);
2515
+ var m = n.table.core, y = m.schema.primaryKey, b = y.outbound, _ = y.extractKey, T = 200, y = t.db._options.modifyChunkSize;
2516
+ y && (T = typeof y == "object" ? y[m.name] || y["*"] || 200 : y);
2520
2517
  function A(C, F) {
2521
2518
  var P = F.failures, F = F.numFailures;
2522
- T += C - F;
2519
+ x += C - F;
2523
2520
  for (var M = 0, U = g(P); M < U.length; M++) {
2524
2521
  var K = U[M];
2525
2522
  w.push(P[K]);
2526
2523
  }
2527
2524
  }
2528
- var w = [], T = 0, O = [], N = e === Ir;
2525
+ var w = [], x = 0, O = [], N = e === Ir;
2529
2526
  return t.clone().primaryKeys().then(function(C) {
2530
2527
  function I(F) {
2531
- var M = Math.min(x, C.length - F), U = C.slice(F, F + M);
2528
+ var M = Math.min(T, C.length - F), U = C.slice(F, F + M);
2532
2529
  return (N ? Promise.resolve([]) : m.getMany({ trans: r, keys: U, cache: "immutable" })).then(function(K) {
2533
2530
  var L = [], G = [], V = b ? [] : null, X = N ? U : [];
2534
2531
  if (!N) for (var ne = 0; ne < M; ++ne) {
@@ -2549,13 +2546,13 @@ function qi() {
2549
2546
  return A(X.length, we);
2550
2547
  });
2551
2548
  }).then(function() {
2552
- return C.length > F + M && I(F + x);
2549
+ return C.length > F + M && I(F + T);
2553
2550
  });
2554
2551
  });
2555
2552
  }
2556
2553
  var P = At(n) && n.limit === 1 / 0 && (typeof e != "function" || N) && { index: n.index, range: n.range };
2557
2554
  return I(0).then(function() {
2558
- if (0 < w.length) throw new tt("Error modifying one or more objects", w, T, O);
2555
+ if (0 < w.length) throw new tt("Error modifying one or more objects", w, x, O);
2559
2556
  return C.length;
2560
2557
  });
2561
2558
  });
@@ -2563,9 +2560,9 @@ function qi() {
2563
2560
  }, oe.prototype.delete = function() {
2564
2561
  var e = this._ctx, t = e.range;
2565
2562
  return !At(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Ir) : this._write(function(n) {
2566
- var r = e.table.core.schema.primaryKey, a = t;
2567
- return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(u) {
2568
- return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(b) {
2563
+ var r = e.table.core.schema.primaryKey, i = t;
2564
+ return e.table.core.count({ trans: n, query: { index: r, range: i } }).then(function(u) {
2565
+ return e.table.core.mutate({ trans: n, type: "deleteRange", range: i }).then(function(b) {
2569
2566
  var m = b.failures, b = b.numFailures;
2570
2567
  if (b) throw new tt("Could not delete some values", Object.keys(m).map(function(_) {
2571
2568
  return m[_];
@@ -2580,10 +2577,10 @@ function qi() {
2580
2577
  var Ir = function(e, t) {
2581
2578
  return t.value = null;
2582
2579
  };
2583
- function Ka(e, t) {
2580
+ function qa(e, t) {
2584
2581
  return e < t ? -1 : e === t ? 0 : 1;
2585
2582
  }
2586
- function qa(e, t) {
2583
+ function La(e, t) {
2587
2584
  return t < e ? -1 : e === t ? 0 : 1;
2588
2585
  }
2589
2586
  function Ke(e, t, n) {
@@ -2595,22 +2592,22 @@ function qi() {
2595
2592
  }).limit(0);
2596
2593
  }
2597
2594
  function fn(e, t, n, r) {
2598
- var a, u, h, m, b, _, x, y = n.length;
2599
- if (!n.every(function(T) {
2600
- return typeof T == "string";
2595
+ var i, u, h, m, b, _, T, y = n.length;
2596
+ if (!n.every(function(x) {
2597
+ return typeof x == "string";
2601
2598
  })) return Ke(e, Er);
2602
- function A(T) {
2603
- a = T === "next" ? function(N) {
2599
+ function A(x) {
2600
+ i = x === "next" ? function(N) {
2604
2601
  return N.toUpperCase();
2605
2602
  } : function(N) {
2606
2603
  return N.toLowerCase();
2607
- }, u = T === "next" ? function(N) {
2604
+ }, u = x === "next" ? function(N) {
2608
2605
  return N.toLowerCase();
2609
2606
  } : function(N) {
2610
2607
  return N.toUpperCase();
2611
- }, h = T === "next" ? Ka : qa;
2608
+ }, h = x === "next" ? qa : La;
2612
2609
  var O = n.map(function(N) {
2613
- return { lower: u(N), upper: a(N) };
2610
+ return { lower: u(N), upper: i(N) };
2614
2611
  }).sort(function(N, C) {
2615
2612
  return h(N.lower, C.lower);
2616
2613
  });
@@ -2618,16 +2615,16 @@ function qi() {
2618
2615
  return N.upper;
2619
2616
  }), b = O.map(function(N) {
2620
2617
  return N.lower;
2621
- }), x = (_ = T) === "next" ? "" : r;
2618
+ }), T = (_ = x) === "next" ? "" : r;
2622
2619
  }
2623
2620
  A("next"), e = new e.Collection(e, function() {
2624
2621
  return st(m[0], b[y - 1] + r);
2625
- }), e._ondirectionchange = function(T) {
2626
- A(T);
2622
+ }), e._ondirectionchange = function(x) {
2623
+ A(x);
2627
2624
  };
2628
2625
  var w = 0;
2629
- return e._addAlgorithm(function(T, O, N) {
2630
- var C = T.key;
2626
+ return e._addAlgorithm(function(x, O, N) {
2627
+ var C = x.key;
2631
2628
  if (typeof C != "string") return !1;
2632
2629
  var I = u(C);
2633
2630
  if (t(I, b, w)) return !0;
@@ -2643,7 +2640,7 @@ function qi() {
2643
2640
  M === null && P === null ? w = F + 1 : (P === null || 0 < h(P, M)) && (P = M);
2644
2641
  }
2645
2642
  return O(P !== null ? function() {
2646
- T.continue(P + x);
2643
+ x.continue(P + T);
2647
2644
  } : N), !1;
2648
2645
  }), e;
2649
2646
  }
@@ -2720,11 +2717,11 @@ function qi() {
2720
2717
  r._ondirectionchange = function(u) {
2721
2718
  n = u === "next" ? e._ascending : e._descending, t.sort(n);
2722
2719
  };
2723
- var a = 0;
2720
+ var i = 0;
2724
2721
  return r._addAlgorithm(function(u, h, m) {
2725
- for (var b = u.key; 0 < n(b, t[a]); ) if (++a === t.length) return h(m), !1;
2726
- return n(b, t[a]) === 0 || (h(function() {
2727
- u.continue(t[a]);
2722
+ for (var b = u.key; 0 < n(b, t[i]); ) if (++i === t.length) return h(m), !1;
2723
+ return n(b, t[i]) === 0 || (h(function() {
2724
+ u.continue(t[i]);
2728
2725
  }), !1);
2729
2726
  }), r;
2730
2727
  }, De.prototype.notEqual = function(e) {
@@ -2742,17 +2739,17 @@ function qi() {
2742
2739
  }, null);
2743
2740
  return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, { includeLowers: !1, includeUppers: !1 });
2744
2741
  }, De.prototype.inAnyRange = function(C, t) {
2745
- var n = this, r = this._cmp, a = this._ascending, u = this._descending, h = this._min, m = this._max;
2742
+ var n = this, r = this._cmp, i = this._ascending, u = this._descending, h = this._min, m = this._max;
2746
2743
  if (C.length === 0) return Ct(this);
2747
2744
  if (!C.every(function(I) {
2748
- return I[0] !== void 0 && I[1] !== void 0 && a(I[0], I[1]) <= 0;
2745
+ return I[0] !== void 0 && I[1] !== void 0 && i(I[0], I[1]) <= 0;
2749
2746
  })) return Ke(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", z.InvalidArgument);
2750
- var b = !t || t.includeLowers !== !1, _ = t && t.includeUppers === !0, x, y = a;
2747
+ var b = !t || t.includeLowers !== !1, _ = t && t.includeUppers === !0, T, y = i;
2751
2748
  function A(I, P) {
2752
2749
  return y(I[0], P[0]);
2753
2750
  }
2754
2751
  try {
2755
- (x = C.reduce(function(I, P) {
2752
+ (T = C.reduce(function(I, P) {
2756
2753
  for (var F = 0, M = I.length; F < M; ++F) {
2757
2754
  var U = I[F];
2758
2755
  if (r(P[0], U[1]) < 0 && 0 < r(P[1], U[0])) {
@@ -2765,23 +2762,23 @@ function qi() {
2765
2762
  } catch {
2766
2763
  return Ke(this, Qe);
2767
2764
  }
2768
- var w = 0, T = _ ? function(I) {
2769
- return 0 < a(I, x[w][1]);
2765
+ var w = 0, x = _ ? function(I) {
2766
+ return 0 < i(I, T[w][1]);
2770
2767
  } : function(I) {
2771
- return 0 <= a(I, x[w][1]);
2768
+ return 0 <= i(I, T[w][1]);
2772
2769
  }, O = b ? function(I) {
2773
- return 0 < u(I, x[w][0]);
2770
+ return 0 < u(I, T[w][0]);
2774
2771
  } : function(I) {
2775
- return 0 <= u(I, x[w][0]);
2776
- }, N = T, C = new this.Collection(this, function() {
2777
- return st(x[0][0], x[x.length - 1][1], !b, !_);
2772
+ return 0 <= u(I, T[w][0]);
2773
+ }, N = x, C = new this.Collection(this, function() {
2774
+ return st(T[0][0], T[T.length - 1][1], !b, !_);
2778
2775
  });
2779
2776
  return C._ondirectionchange = function(I) {
2780
- y = I === "next" ? (N = T, a) : (N = O, u), x.sort(A);
2777
+ y = I === "next" ? (N = x, i) : (N = O, u), T.sort(A);
2781
2778
  }, C._addAlgorithm(function(I, P, F) {
2782
- for (var M, U = I.key; N(U); ) if (++w === x.length) return P(F), !1;
2783
- return !T(M = U) && !O(M) || (n._cmp(U, x[w][1]) === 0 || n._cmp(U, x[w][0]) === 0 || P(function() {
2784
- y === a ? I.continue(x[w][0]) : I.continue(x[w][1]);
2779
+ for (var M, U = I.key; N(U); ) if (++w === T.length) return P(F), !1;
2780
+ return !x(M = U) && !O(M) || (n._cmp(U, T[w][1]) === 0 || n._cmp(U, T[w][0]) === 0 || P(function() {
2781
+ y === i ? I.continue(T[w][0]) : I.continue(T[w][1]);
2785
2782
  }), !1);
2786
2783
  }), C;
2787
2784
  }, De.prototype.startsWithAnyOf = function() {
@@ -2802,7 +2799,7 @@ function qi() {
2802
2799
  function Kt(e) {
2803
2800
  e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
2804
2801
  }
2805
- var qt = "storagemutated", qn = "x-storagemutated-1", ut = Bt(null, qt), La = (Ye.prototype._lock = function() {
2802
+ var qt = "storagemutated", qn = "x-storagemutated-1", ut = Bt(null, qt), Ua = (Ye.prototype._lock = function() {
2806
2803
  return H(!W.global), ++this._reculock, this._reculock !== 1 || W.global || (W.lockOwnerFor = this), this;
2807
2804
  }, Ye.prototype._unlock = function() {
2808
2805
  if (H(!W.global), --this._reculock == 0) for (W.global || (W.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) {
@@ -2828,10 +2825,10 @@ function qi() {
2828
2825
  throw new z.OpenFailed(r);
2829
2826
  }
2830
2827
  if (!this.active) throw new z.TransactionInactive();
2831
- return H(this._completion._state === null), (e = this.idbtrans = e || (this.db.core || n).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = pe(function(a) {
2832
- Kt(a), t._reject(e.error);
2833
- }), e.onabort = pe(function(a) {
2834
- Kt(a), t.active && t._reject(new z.Abort(e.error)), t.active = !1, t.on("abort").fire(a);
2828
+ return H(this._completion._state === null), (e = this.idbtrans = e || (this.db.core || n).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = pe(function(i) {
2829
+ Kt(i), t._reject(e.error);
2830
+ }), e.onabort = pe(function(i) {
2831
+ Kt(i), t.active && t._reject(new z.Abort(e.error)), t.active = !1, t.on("abort").fire(i);
2835
2832
  }), e.oncomplete = pe(function() {
2836
2833
  t.active = !1, t._resolve(), "mutatedParts" in e && ut.storagemutated.fire(e.mutatedParts);
2837
2834
  }), this;
@@ -2854,11 +2851,11 @@ function qi() {
2854
2851
  return r._unlock();
2855
2852
  }), u._lib = !0, u;
2856
2853
  });
2857
- var a = new $(function(u, h) {
2854
+ var i = new $(function(u, h) {
2858
2855
  var m = t(u, h, r);
2859
2856
  m && m.then && m.then(u, h);
2860
2857
  });
2861
- return a._lib = !0, a;
2858
+ return i._lib = !0, i;
2862
2859
  }, Ye.prototype._root = function() {
2863
2860
  return this.parent ? this.parent._root() : this;
2864
2861
  }, Ye.prototype.waitFor = function(e) {
@@ -2869,14 +2866,14 @@ function qi() {
2869
2866
  for (++n._spinCount; n._waitingQueue.length; ) n._waitingQueue.shift()();
2870
2867
  n._waitingFor && (t.get(-1 / 0).onsuccess = u);
2871
2868
  })());
2872
- var a = n._waitingFor;
2869
+ var i = n._waitingFor;
2873
2870
  return new $(function(u, h) {
2874
2871
  r.then(function(m) {
2875
2872
  return n._waitingQueue.push(pe(u.bind(null, m)));
2876
2873
  }, function(m) {
2877
2874
  return n._waitingQueue.push(pe(h.bind(null, m)));
2878
2875
  }).finally(function() {
2879
- n._waitingFor === a && (n._waitingFor = null);
2876
+ n._waitingFor === i && (n._waitingFor = null);
2880
2877
  });
2881
2878
  });
2882
2879
  }, Ye.prototype.abort = function() {
@@ -2890,17 +2887,17 @@ function qi() {
2890
2887
  }, Ye);
2891
2888
  function Ye() {
2892
2889
  }
2893
- function Ln(e, t, n, r, a, u, h, m) {
2894
- return { name: e, keyPath: t, unique: n, multi: r, auto: a, compound: u, src: (n && !h ? "&" : "") + (r ? "*" : "") + (a ? "++" : "") + Pr(t), type: m };
2890
+ function Ln(e, t, n, r, i, u, h, m) {
2891
+ return { name: e, keyPath: t, unique: n, multi: r, auto: i, compound: u, src: (n && !h ? "&" : "") + (r ? "*" : "") + (i ? "++" : "") + Pr(t), type: m };
2895
2892
  }
2896
2893
  function Pr(e) {
2897
2894
  return typeof e == "string" ? e : e ? "[" + [].join.call(e, "+") + "]" : "";
2898
2895
  }
2899
2896
  function Un(e, t, n) {
2900
- return { name: e, primKey: t, indexes: n, mappedClass: null, idxByName: (r = function(a) {
2901
- return [a.name, a];
2902
- }, n.reduce(function(a, u, h) {
2903
- return h = r(u, h), h && (a[h[0]] = h[1]), a;
2897
+ return { name: e, primKey: t, indexes: n, mappedClass: null, idxByName: (r = function(i) {
2898
+ return [i.name, i];
2899
+ }, n.reduce(function(i, u, h) {
2900
+ return h = r(u, h), h && (i[h[0]] = h[1]), i;
2904
2901
  }, {})) };
2905
2902
  var r;
2906
2903
  }
@@ -2929,24 +2926,24 @@ function qi() {
2929
2926
  function Fr(e) {
2930
2927
  return [].slice.call(e);
2931
2928
  }
2932
- var Ua = 0;
2929
+ var Va = 0;
2933
2930
  function Ut(e) {
2934
2931
  return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
2935
2932
  }
2936
- function Va(e, t, b) {
2933
+ function Ga(e, t, b) {
2937
2934
  function r(N) {
2938
2935
  if (N.type === 3) return null;
2939
2936
  if (N.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
2940
- var w = N.lower, T = N.upper, O = N.lowerOpen, N = N.upperOpen;
2941
- return w === void 0 ? T === void 0 ? null : t.upperBound(T, !!N) : T === void 0 ? t.lowerBound(w, !!O) : t.bound(w, T, !!O, !!N);
2937
+ var w = N.lower, x = N.upper, O = N.lowerOpen, N = N.upperOpen;
2938
+ return w === void 0 ? x === void 0 ? null : t.upperBound(x, !!N) : x === void 0 ? t.lowerBound(w, !!O) : t.bound(w, x, !!O, !!N);
2942
2939
  }
2943
- function a(A) {
2944
- var w, T = A.name;
2945
- return { name: T, schema: A, mutate: function(O) {
2940
+ function i(A) {
2941
+ var w, x = A.name;
2942
+ return { name: x, schema: A, mutate: function(O) {
2946
2943
  var N = O.trans, C = O.type, I = O.keys, P = O.values, F = O.range;
2947
2944
  return new Promise(function(M, U) {
2948
2945
  M = pe(M);
2949
- var K = N.objectStore(T), L = K.keyPath == null, G = C === "put" || C === "add";
2946
+ var K = N.objectStore(x), L = K.keyPath == null, G = C === "put" || C === "add";
2950
2947
  if (!G && C !== "delete" && C !== "deleteRange") throw new Error("Invalid operation type: " + C);
2951
2948
  var V, X = (I || P || { length: 1 }).length;
2952
2949
  if (I && P && I.length !== P.length) throw new Error("Given keys array must have same length as given values array.");
@@ -2963,7 +2960,7 @@ function qi() {
2963
2960
  if (G) for (var Pe = 0; Pe < X; ++Pe) ae.push(V = ke && ke[Pe] !== void 0 ? K[C](J[Pe], ke[Pe]) : K[C](J[Pe])), V.onerror = ne;
2964
2961
  else for (Pe = 0; Pe < X; ++Pe) ae.push(V = K[C](J[Pe])), V.onerror = ne;
2965
2962
  }
2966
- function Tn(Be) {
2963
+ function xn(Be) {
2967
2964
  Be = Be.target.result, ae.forEach(function(vt, sr) {
2968
2965
  return vt.error != null && (ee[sr] = vt.error);
2969
2966
  }), M({ numFailures: we, failures: ee, results: C === "delete" ? I : ae.map(function(vt) {
@@ -2971,14 +2968,14 @@ function qi() {
2971
2968
  }), lastResult: Be });
2972
2969
  }
2973
2970
  V.onerror = function(Be) {
2974
- ne(Be), Tn(Be);
2975
- }, V.onsuccess = Tn;
2971
+ ne(Be), xn(Be);
2972
+ }, V.onsuccess = xn;
2976
2973
  });
2977
2974
  }, getMany: function(O) {
2978
2975
  var N = O.trans, C = O.keys;
2979
2976
  return new Promise(function(I, P) {
2980
2977
  I = pe(I);
2981
- for (var F, M = N.objectStore(T), U = C.length, K = new Array(U), L = 0, G = 0, V = function(ae) {
2978
+ for (var F, M = N.objectStore(x), U = C.length, K = new Array(U), L = 0, G = 0, V = function(ae) {
2982
2979
  ae = ae.target, K[ae._pos] = ae.result, ++G === L && I(K);
2983
2980
  }, X = Xe(P), ne = 0; ne < U; ++ne) C[ne] != null && ((F = M.get(C[ne]))._pos = ne, F.onsuccess = V, F.onerror = X, ++L);
2984
2981
  L === 0 && I(K);
@@ -2987,7 +2984,7 @@ function qi() {
2987
2984
  var N = O.trans, C = O.key;
2988
2985
  return new Promise(function(I, P) {
2989
2986
  I = pe(I);
2990
- var F = N.objectStore(T).get(C);
2987
+ var F = N.objectStore(x).get(C);
2991
2988
  F.onsuccess = function(M) {
2992
2989
  return I(M.target.result);
2993
2990
  }, F.onerror = Xe(P);
@@ -2995,7 +2992,7 @@ function qi() {
2995
2992
  }, query: (w = _, function(O) {
2996
2993
  return new Promise(function(N, C) {
2997
2994
  N = pe(N);
2998
- var I, P, F, L = O.trans, M = O.values, U = O.limit, V = O.query, K = U === 1 / 0 ? void 0 : U, G = V.index, V = V.range, L = L.objectStore(T), G = G.isPrimaryKey ? L : L.index(G.name), V = r(V);
2995
+ var I, P, F, L = O.trans, M = O.values, U = O.limit, V = O.query, K = U === 1 / 0 ? void 0 : U, G = V.index, V = V.range, L = L.objectStore(x), G = G.isPrimaryKey ? L : L.index(G.name), V = r(V);
2999
2996
  if (U === 0) return N({ result: [] });
3000
2997
  w ? ((K = M ? G.getAll(V, K) : G.getAllKeys(V, K)).onsuccess = function(X) {
3001
2998
  return N({ result: X.target.result });
@@ -3008,10 +3005,10 @@ function qi() {
3008
3005
  var N = O.trans, C = O.values, I = O.query, P = O.reverse, F = O.unique;
3009
3006
  return new Promise(function(M, U) {
3010
3007
  M = pe(M);
3011
- var G = I.index, K = I.range, L = N.objectStore(T), L = G.isPrimaryKey ? L : L.index(G.name), G = P ? F ? "prevunique" : "prev" : F ? "nextunique" : "next", V = !C && "openKeyCursor" in L ? L.openKeyCursor(r(K), G) : L.openCursor(r(K), G);
3008
+ var G = I.index, K = I.range, L = N.objectStore(x), L = G.isPrimaryKey ? L : L.index(G.name), G = P ? F ? "prevunique" : "prev" : F ? "nextunique" : "next", V = !C && "openKeyCursor" in L ? L.openKeyCursor(r(K), G) : L.openCursor(r(K), G);
3012
3009
  V.onerror = Xe(U), V.onsuccess = pe(function(X) {
3013
3010
  var ne, ae, ee, we, J = V.result;
3014
- J ? (J.___id = ++Ua, J.done = !1, ne = J.continue.bind(J), ae = (ae = J.continuePrimaryKey) && ae.bind(J), ee = J.advance.bind(J), we = function() {
3011
+ J ? (J.___id = ++Va, J.done = !1, ne = J.continue.bind(J), ae = (ae = J.continuePrimaryKey) && ae.bind(J), ee = J.advance.bind(J), we = function() {
3015
3012
  throw new Error("Cursor not stopped");
3016
3013
  }, J.trans = N, J.stop = J.continue = J.continuePrimaryKey = J.advance = function() {
3017
3014
  throw new Error("Cursor not started");
@@ -3033,31 +3030,31 @@ function qi() {
3033
3030
  throw new Error("Cursor behind last entry");
3034
3031
  }, J.stop();
3035
3032
  }
3036
- var Tn = new Promise(function(Be, vt) {
3033
+ var xn = new Promise(function(Be, vt) {
3037
3034
  Be = pe(Be), V.onerror = Xe(vt), J.fail = vt, J.stop = function(sr) {
3038
3035
  J.stop = J.continue = J.continuePrimaryKey = J.advance = we, Be(sr);
3039
3036
  };
3040
3037
  });
3041
3038
  return V.onsuccess = pe(function(Be) {
3042
3039
  V.onsuccess = Pe, Pe();
3043
- }), J.continue = ne, J.continuePrimaryKey = ae, J.advance = ee, Pe(), Tn;
3040
+ }), J.continue = ne, J.continuePrimaryKey = ae, J.advance = ee, Pe(), xn;
3044
3041
  }, M(J)) : M(null);
3045
3042
  }, U);
3046
3043
  });
3047
3044
  }, count: function(O) {
3048
3045
  var N = O.query, C = O.trans, I = N.index, P = N.range;
3049
3046
  return new Promise(function(F, M) {
3050
- var U = C.objectStore(T), K = I.isPrimaryKey ? U : U.index(I.name), U = r(P), K = U ? K.count(U) : K.count();
3047
+ var U = C.objectStore(x), K = I.isPrimaryKey ? U : U.index(I.name), U = r(P), K = U ? K.count(U) : K.count();
3051
3048
  K.onsuccess = pe(function(L) {
3052
3049
  return F(L.target.result);
3053
3050
  }), K.onerror = Xe(M);
3054
3051
  });
3055
3052
  } };
3056
3053
  }
3057
- var u, h, m, x = (h = b, m = Fr((u = e).objectStoreNames), { schema: { name: u.name, tables: m.map(function(A) {
3054
+ var u, h, m, T = (h = b, m = Fr((u = e).objectStoreNames), { schema: { name: u.name, tables: m.map(function(A) {
3058
3055
  return h.objectStore(A);
3059
3056
  }).map(function(A) {
3060
- var w = A.keyPath, N = A.autoIncrement, T = v(w), O = {}, N = { name: A.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: w == null, compound: T, keyPath: w, autoIncrement: N, unique: !0, extractKey: Vn(w) }, indexes: Fr(A.indexNames).map(function(C) {
3057
+ var w = A.keyPath, N = A.autoIncrement, x = v(w), O = {}, N = { name: A.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: w == null, compound: x, keyPath: w, autoIncrement: N, unique: !0, extractKey: Vn(w) }, indexes: Fr(A.indexNames).map(function(C) {
3061
3058
  return A.index(C);
3062
3059
  }).map(function(F) {
3063
3060
  var I = F.name, P = F.unique, M = F.multiEntry, F = F.keyPath, M = { name: I, compound: v(F), keyPath: F, unique: P, multiEntry: M, extractKey: Vn(F) };
@@ -3066,41 +3063,41 @@ function qi() {
3066
3063
  return O[Ut(C)];
3067
3064
  } };
3068
3065
  return O[":id"] = N.primaryKey, w != null && (O[Ut(w)] = N.primaryKey), N;
3069
- }) }, hasGetAll: 0 < m.length && "getAll" in h.objectStore(m[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), b = x.schema, _ = x.hasGetAll, x = b.tables.map(a), y = {};
3070
- return x.forEach(function(A) {
3066
+ }) }, hasGetAll: 0 < m.length && "getAll" in h.objectStore(m[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), b = T.schema, _ = T.hasGetAll, T = b.tables.map(i), y = {};
3067
+ return T.forEach(function(A) {
3071
3068
  return y[A.name] = A;
3072
3069
  }), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(A) {
3073
3070
  if (!y[A]) throw new Error("Table '".concat(A, "' not found"));
3074
3071
  return y[A];
3075
3072
  }, MIN_KEY: -1 / 0, MAX_KEY: Lt(t), schema: b };
3076
3073
  }
3077
- function Ga(e, t, n, r) {
3078
- var a = n.IDBKeyRange;
3079
- return n.indexedDB, { dbcore: (r = Va(t, a, r), e.dbcore.reduce(function(u, h) {
3080
- return h = h.create, i(i({}, u), h(u));
3074
+ function $a(e, t, n, r) {
3075
+ var i = n.IDBKeyRange;
3076
+ return n.indexedDB, { dbcore: (r = Ga(t, i, r), e.dbcore.reduce(function(u, h) {
3077
+ return h = h.create, a(a({}, u), h(u));
3081
3078
  }, r)) };
3082
3079
  }
3083
3080
  function dn(e, r) {
3084
- var n = r.db, r = Ga(e._middlewares, n, e._deps, r);
3085
- e.core = r.dbcore, e.tables.forEach(function(a) {
3086
- var u = a.name;
3081
+ var n = r.db, r = $a(e._middlewares, n, e._deps, r);
3082
+ e.core = r.dbcore, e.tables.forEach(function(i) {
3083
+ var u = i.name;
3087
3084
  e.core.schema.tables.some(function(h) {
3088
3085
  return h.name === u;
3089
- }) && (a.core = e.core.table(u), e[u] instanceof e.Table && (e[u].core = a.core));
3086
+ }) && (i.core = e.core.table(u), e[u] instanceof e.Table && (e[u].core = i.core));
3090
3087
  });
3091
3088
  }
3092
3089
  function hn(e, t, n, r) {
3093
- n.forEach(function(a) {
3094
- var u = r[a];
3090
+ n.forEach(function(i) {
3091
+ var u = r[i];
3095
3092
  t.forEach(function(h) {
3096
- var m = (function b(_, x) {
3097
- return ue(_, x) || (_ = R(_)) && b(_, x);
3098
- })(h, a);
3099
- (!m || "value" in m && m.value === void 0) && (h === e.Transaction.prototype || h instanceof e.Transaction ? j(h, a, { get: function() {
3100
- return this.table(a);
3093
+ var m = (function b(_, T) {
3094
+ return ue(_, T) || (_ = R(_)) && b(_, T);
3095
+ })(h, i);
3096
+ (!m || "value" in m && m.value === void 0) && (h === e.Transaction.prototype || h instanceof e.Transaction ? j(h, i, { get: function() {
3097
+ return this.table(i);
3101
3098
  }, set: function(b) {
3102
- fe(this, a, { value: b, writable: !0, configurable: !0, enumerable: !0 });
3103
- } }) : h[a] = new e.Table(a, u));
3099
+ fe(this, i, { value: b, writable: !0, configurable: !0, enumerable: !0 });
3100
+ } }) : h[i] = new e.Table(i, u));
3104
3101
  });
3105
3102
  });
3106
3103
  }
@@ -3109,31 +3106,31 @@ function qi() {
3109
3106
  for (var r in n) n[r] instanceof e.Table && delete n[r];
3110
3107
  });
3111
3108
  }
3112
- function $a(e, t) {
3109
+ function Xa(e, t) {
3113
3110
  return e._cfg.version - t._cfg.version;
3114
3111
  }
3115
- function Xa(e, t, n, r) {
3116
- var a = e._dbSchema;
3117
- n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Un("$meta", jr("")[0], []), e._storeNames.push("$meta"));
3118
- var u = e._createTransaction("readwrite", e._storeNames, a);
3112
+ function Ya(e, t, n, r) {
3113
+ var i = e._dbSchema;
3114
+ n.objectStoreNames.contains("$meta") && !i.$meta && (i.$meta = Un("$meta", jr("")[0], []), e._storeNames.push("$meta"));
3115
+ var u = e._createTransaction("readwrite", e._storeNames, i);
3119
3116
  u.create(n), u._completion.catch(r);
3120
3117
  var h = u._reject.bind(u), m = W.transless || W;
3121
3118
  at(function() {
3122
- return W.trans = u, W.transless = m, t !== 0 ? (dn(e, n), _ = t, ((b = u).storeNames.includes("$meta") ? b.table("$meta").get("version").then(function(x) {
3123
- return x ?? _;
3124
- }) : $.resolve(_)).then(function(x) {
3125
- return A = x, w = u, T = n, O = [], x = (y = e)._versions, N = y._dbSchema = mn(0, y.idbdb, T), (x = x.filter(function(C) {
3119
+ return W.trans = u, W.transless = m, t !== 0 ? (dn(e, n), _ = t, ((b = u).storeNames.includes("$meta") ? b.table("$meta").get("version").then(function(T) {
3120
+ return T ?? _;
3121
+ }) : $.resolve(_)).then(function(T) {
3122
+ return A = T, w = u, x = n, O = [], T = (y = e)._versions, N = y._dbSchema = mn(0, y.idbdb, x), (T = T.filter(function(C) {
3126
3123
  return C._cfg.version >= A;
3127
- })).length !== 0 ? (x.forEach(function(C) {
3124
+ })).length !== 0 ? (T.forEach(function(C) {
3128
3125
  O.push(function() {
3129
3126
  var I = N, P = C._cfg.dbschema;
3130
- gn(y, I, T), gn(y, P, T), N = y._dbSchema = P;
3127
+ gn(y, I, x), gn(y, P, x), N = y._dbSchema = P;
3131
3128
  var F = $n(I, P);
3132
3129
  F.add.forEach(function(G) {
3133
- Xn(T, G[0], G[1].primKey, G[1].indexes);
3130
+ Xn(x, G[0], G[1].primKey, G[1].indexes);
3134
3131
  }), F.change.forEach(function(G) {
3135
3132
  if (G.recreate) throw new z.Upgrade("Not yet support for changing primary key");
3136
- var V = T.objectStore(G.name);
3133
+ var V = x.objectStore(G.name);
3137
3134
  G.add.forEach(function(X) {
3138
3135
  return pn(V, X);
3139
3136
  }), G.change.forEach(function(X) {
@@ -3144,7 +3141,7 @@ function qi() {
3144
3141
  });
3145
3142
  var M = C._cfg.contentUpgrade;
3146
3143
  if (M && C._cfg.version > A) {
3147
- dn(y, T), w._memoizedTables = {};
3144
+ dn(y, x), w._memoizedTables = {};
3148
3145
  var U = ge(P);
3149
3146
  F.del.forEach(function(G) {
3150
3147
  U[G] = I[G];
@@ -3170,29 +3167,29 @@ function qi() {
3170
3167
  }), (function C() {
3171
3168
  return O.length ? $.resolve(O.shift()(w.idbtrans)).then(C) : $.resolve();
3172
3169
  })().then(function() {
3173
- Br(N, T);
3170
+ Br(N, x);
3174
3171
  })) : $.resolve();
3175
- var y, A, w, T, O, N;
3176
- }).catch(h)) : (g(a).forEach(function(x) {
3177
- Xn(n, x, a[x].primKey, a[x].indexes);
3172
+ var y, A, w, x, O, N;
3173
+ }).catch(h)) : (g(i).forEach(function(T) {
3174
+ Xn(n, T, i[T].primKey, i[T].indexes);
3178
3175
  }), dn(e, n), void $.follow(function() {
3179
3176
  return e.on.populate.fire(u);
3180
3177
  }).catch(h));
3181
3178
  var b, _;
3182
3179
  });
3183
3180
  }
3184
- function Ya(e, t) {
3181
+ function Wa(e, t) {
3185
3182
  Br(e._dbSchema, t), t.db.version % 10 != 0 || t.objectStoreNames.contains("$meta") || t.db.createObjectStore("$meta").add(Math.ceil(t.db.version / 10 - 1), "version");
3186
3183
  var n = mn(0, e.idbdb, t);
3187
3184
  gn(e, e._dbSchema, t);
3188
- for (var r = 0, a = $n(n, e._dbSchema).change; r < a.length; r++) {
3185
+ for (var r = 0, i = $n(n, e._dbSchema).change; r < i.length; r++) {
3189
3186
  var u = (function(h) {
3190
3187
  if (h.change.length || h.recreate) return console.warn("Unable to patch indexes of table ".concat(h.name, " because it has changes on the type of index or primary key.")), { value: void 0 };
3191
3188
  var m = t.objectStore(h.name);
3192
3189
  h.add.forEach(function(b) {
3193
3190
  Ne && console.debug("Dexie upgrade patch: Creating missing index ".concat(h.name, ".").concat(b.src)), pn(m, b);
3194
3191
  });
3195
- })(a[r]);
3192
+ })(i[r]);
3196
3193
  if (typeof u == "object") return u.value;
3197
3194
  }
3198
3195
  }
@@ -3200,16 +3197,16 @@ function qi() {
3200
3197
  var n, r = { del: [], add: [], change: [] };
3201
3198
  for (n in e) t[n] || r.del.push(n);
3202
3199
  for (n in t) {
3203
- var a = e[n], u = t[n];
3204
- if (a) {
3200
+ var i = e[n], u = t[n];
3201
+ if (i) {
3205
3202
  var h = { name: n, def: u, recreate: !1, del: [], add: [], change: [] };
3206
- if ("" + (a.primKey.keyPath || "") != "" + (u.primKey.keyPath || "") || a.primKey.auto !== u.primKey.auto) h.recreate = !0, r.change.push(h);
3203
+ if ("" + (i.primKey.keyPath || "") != "" + (u.primKey.keyPath || "") || i.primKey.auto !== u.primKey.auto) h.recreate = !0, r.change.push(h);
3207
3204
  else {
3208
- var m = a.idxByName, b = u.idxByName, _ = void 0;
3205
+ var m = i.idxByName, b = u.idxByName, _ = void 0;
3209
3206
  for (_ in m) b[_] || h.del.push(_);
3210
3207
  for (_ in b) {
3211
- var x = m[_], y = b[_];
3212
- x ? x.src !== y.src && h.change.push(y) : h.add.push(y);
3208
+ var T = m[_], y = b[_];
3209
+ T ? T.src !== y.src && h.change.push(y) : h.add.push(y);
3213
3210
  }
3214
3211
  (0 < h.del.length || 0 < h.add.length || 0 < h.change.length) && r.change.push(h);
3215
3212
  }
@@ -3218,10 +3215,10 @@ function qi() {
3218
3215
  return r;
3219
3216
  }
3220
3217
  function Xn(e, t, n, r) {
3221
- var a = e.db.createObjectStore(t, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
3218
+ var i = e.db.createObjectStore(t, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
3222
3219
  return r.forEach(function(u) {
3223
- return pn(a, u);
3224
- }), a;
3220
+ return pn(i, u);
3221
+ }), i;
3225
3222
  }
3226
3223
  function Br(e, t) {
3227
3224
  g(e).forEach(function(n) {
@@ -3233,51 +3230,51 @@ function qi() {
3233
3230
  }
3234
3231
  function mn(e, t, n) {
3235
3232
  var r = {};
3236
- return xe(t.objectStoreNames, 0).forEach(function(a) {
3237
- for (var u = n.objectStore(a), h = Ln(Pr(_ = u.keyPath), _ || "", !0, !1, !!u.autoIncrement, _ && typeof _ != "string", !0), m = [], b = 0; b < u.indexNames.length; ++b) {
3238
- var x = u.index(u.indexNames[b]), _ = x.keyPath, x = Ln(x.name, _, !!x.unique, !!x.multiEntry, !1, _ && typeof _ != "string", !1);
3239
- m.push(x);
3233
+ return Te(t.objectStoreNames, 0).forEach(function(i) {
3234
+ for (var u = n.objectStore(i), h = Ln(Pr(_ = u.keyPath), _ || "", !0, !1, !!u.autoIncrement, _ && typeof _ != "string", !0), m = [], b = 0; b < u.indexNames.length; ++b) {
3235
+ var T = u.index(u.indexNames[b]), _ = T.keyPath, T = Ln(T.name, _, !!T.unique, !!T.multiEntry, !1, _ && typeof _ != "string", !1);
3236
+ m.push(T);
3240
3237
  }
3241
- r[a] = Un(a, h, m);
3238
+ r[i] = Un(i, h, m);
3242
3239
  }), r;
3243
3240
  }
3244
3241
  function gn(e, t, n) {
3245
- for (var r = n.db.objectStoreNames, a = 0; a < r.length; ++a) {
3246
- var u = r[a], h = n.objectStore(u);
3242
+ for (var r = n.db.objectStoreNames, i = 0; i < r.length; ++i) {
3243
+ var u = r[i], h = n.objectStore(u);
3247
3244
  e._hasGetAll = "getAll" in h;
3248
3245
  for (var m = 0; m < h.indexNames.length; ++m) {
3249
- var b = h.indexNames[m], _ = h.index(b).keyPath, x = typeof _ == "string" ? _ : "[" + xe(_).join("+") + "]";
3250
- !t[u] || (_ = t[u].idxByName[x]) && (_.name = b, delete t[u].idxByName[x], t[u].idxByName[b] = _);
3246
+ var b = h.indexNames[m], _ = h.index(b).keyPath, T = typeof _ == "string" ? _ : "[" + Te(_).join("+") + "]";
3247
+ !t[u] || (_ = t[u].idxByName[T]) && (_.name = b, delete t[u].idxByName[T], t[u].idxByName[b] = _);
3251
3248
  }
3252
3249
  }
3253
3250
  typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && d.WorkerGlobalScope && d instanceof d.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
3254
3251
  }
3255
3252
  function jr(e) {
3256
3253
  return e.split(",").map(function(t, n) {
3257
- var u = t.split(":"), r = (a = u[1]) === null || a === void 0 ? void 0 : a.trim(), a = (t = u[0].trim()).replace(/([&*]|\+\+)/g, ""), u = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
3258
- return Ln(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), v(u), n === 0, r);
3254
+ var u = t.split(":"), r = (i = u[1]) === null || i === void 0 ? void 0 : i.trim(), i = (t = u[0].trim()).replace(/([&*]|\+\+)/g, ""), u = /^\[/.test(i) ? i.match(/^\[(.*)\]$/)[1].split("+") : i;
3255
+ return Ln(i, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), v(u), n === 0, r);
3259
3256
  });
3260
3257
  }
3261
- var Wa = (Dt.prototype._createTableSchema = Un, Dt.prototype._parseIndexSyntax = jr, Dt.prototype._parseStoresSpec = function(e, t) {
3258
+ var za = (Dt.prototype._createTableSchema = Un, Dt.prototype._parseIndexSyntax = jr, Dt.prototype._parseStoresSpec = function(e, t) {
3262
3259
  var n = this;
3263
3260
  g(e).forEach(function(r) {
3264
3261
  if (e[r] !== null) {
3265
- var a = n._parseIndexSyntax(e[r]), u = a.shift();
3262
+ var i = n._parseIndexSyntax(e[r]), u = i.shift();
3266
3263
  if (!u) throw new z.Schema("Invalid schema for table " + r + ": " + e[r]);
3267
3264
  if (u.unique = !0, u.multi) throw new z.Schema("Primary key cannot be multiEntry*");
3268
- a.forEach(function(h) {
3265
+ i.forEach(function(h) {
3269
3266
  if (h.auto) throw new z.Schema("Only primary key can be marked as autoIncrement (++)");
3270
3267
  if (!h.keyPath) throw new z.Schema("Index must have a name and cannot be an empty string");
3271
- }), a = n._createTableSchema(r, u, a), t[r] = a;
3268
+ }), i = n._createTableSchema(r, u, i), t[r] = i;
3272
3269
  }
3273
3270
  });
3274
3271
  }, Dt.prototype.stores = function(n) {
3275
3272
  var t = this.db;
3276
3273
  this._cfg.storesSource = this._cfg.storesSource ? D(this._cfg.storesSource, n) : n;
3277
- var n = t._versions, r = {}, a = {};
3274
+ var n = t._versions, r = {}, i = {};
3278
3275
  return n.forEach(function(u) {
3279
- D(r, u._cfg.storesSource), a = u._cfg.dbschema = {}, u._parseStoresSpec(r, a);
3280
- }), t._dbSchema = a, Gn(t, [t._allTables, t, t.Transaction.prototype]), hn(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], g(a), a), t._storeNames = g(a), this;
3276
+ D(r, u._cfg.storesSource), i = u._cfg.dbschema = {}, u._parseStoresSpec(r, i);
3277
+ }), t._dbSchema = i, Gn(t, [t._allTables, t, t.Transaction.prototype]), hn(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], g(i), i), t._storeNames = g(i), this;
3281
3278
  }, Dt.prototype.upgrade = function(e) {
3282
3279
  return this._cfg.contentUpgrade = Ae(this._cfg.contentUpgrade || l, e), this;
3283
3280
  }, Dt);
@@ -3310,10 +3307,10 @@ function qi() {
3310
3307
  if (!isNaN(r)) {
3311
3308
  if (0 < r) throw RangeError();
3312
3309
  if (Qn(e)) return D(e, { from: t, to: n, d: 1 });
3313
- var a = e.l, r = e.r;
3314
- if (re(n, e.from) < 0) return a ? Vt(a, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null }, Kr(e);
3310
+ var i = e.l, r = e.r;
3311
+ if (re(n, e.from) < 0) return i ? Vt(i, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null }, Kr(e);
3315
3312
  if (0 < re(t, e.to)) return r ? Vt(r, t, n) : e.r = { from: t, to: n, d: 1, l: null, r: null }, Kr(e);
3316
- re(t, e.from) < 0 && (e.from = t, e.l = null, e.d = r ? r.d + 1 : 1), 0 < re(n, e.to) && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1), n = !e.r, a && !e.l && Gt(e, a), r && n && Gt(e, r);
3313
+ re(t, e.from) < 0 && (e.from = t, e.l = null, e.d = r ? r.d + 1 : 1), 0 < re(n, e.to) && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1), n = !e.r, i && !e.l && Gt(e, i), r && n && Gt(e, r);
3317
3314
  }
3318
3315
  }
3319
3316
  function Gt(e, t) {
@@ -3325,9 +3322,9 @@ function qi() {
3325
3322
  function Mr(e, t) {
3326
3323
  var n = yn(t), r = n.next();
3327
3324
  if (r.done) return !1;
3328
- for (var a = r.value, u = yn(e), h = u.next(a.from), m = h.value; !r.done && !h.done; ) {
3329
- if (re(m.from, a.to) <= 0 && 0 <= re(m.to, a.from)) return !0;
3330
- re(a.from, m.from) < 0 ? a = (r = n.next(m.from)).value : m = (h = u.next(a.from)).value;
3325
+ for (var i = r.value, u = yn(e), h = u.next(i.from), m = h.value; !r.done && !h.done; ) {
3326
+ if (re(m.from, i.to) <= 0 && 0 <= re(m.to, i.from)) return !0;
3327
+ re(i.from, m.from) < 0 ? i = (r = n.next(m.from)).value : m = (h = u.next(i.from)).value;
3331
3328
  }
3332
3329
  return !1;
3333
3330
  }
@@ -3352,8 +3349,8 @@ function qi() {
3352
3349
  } };
3353
3350
  }
3354
3351
  function Kr(e) {
3355
- 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" : "";
3356
- 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 = qr(n)), e.d = qr(e);
3352
+ 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), i = 1 < r ? "r" : r < -1 ? "l" : "";
3353
+ i && (t = i == "r" ? "l" : "r", n = a({}, e), r = e[i], e.from = r.from, e.to = r.to, e[i] = r[i], n[i] = r[t], (e[t] = n).d = qr(n)), e.d = qr(e);
3357
3354
  }
3358
3355
  function qr(n) {
3359
3356
  var t = n.r, n = n.l;
@@ -3361,9 +3358,9 @@ function qi() {
3361
3358
  }
3362
3359
  function vn(e, t) {
3363
3360
  return g(t).forEach(function(n) {
3364
- e[n] ? Gt(e[n], t[n]) : e[n] = (function r(a) {
3361
+ e[n] ? Gt(e[n], t[n]) : e[n] = (function r(i) {
3365
3362
  var u, h, m = {};
3366
- for (u in a) Y(a, u) && (h = a[u], m[u] = !h || typeof h != "object" || It.has(h.constructor) ? h : r(h));
3363
+ for (u in i) Y(i, u) && (h = i[u], m[u] = !h || typeof h != "object" || It.has(h.constructor) ? h : r(h));
3367
3364
  return m;
3368
3365
  })(t[n]);
3369
3366
  }), e;
@@ -3397,7 +3394,7 @@ function qi() {
3397
3394
  function er(e, t) {
3398
3395
  t === void 0 && (t = !1);
3399
3396
  var n = /* @__PURE__ */ new Set();
3400
- if (e.all) for (var r = 0, a = Object.values(gt); r < a.length; r++) Lr(h = a[r], e, n, t);
3397
+ if (e.all) for (var r = 0, i = Object.values(gt); r < i.length; r++) Lr(h = i[r], e, n, t);
3401
3398
  else for (var u in e) {
3402
3399
  var h, m = /^idb\:\/\/(.*)\/(.*)\//.exec(u);
3403
3400
  m && (u = m[1], m = m[2], (h = gt["idb://".concat(u, "/").concat(m)]) && Lr(h, e, n, t));
@@ -3407,49 +3404,49 @@ function qi() {
3407
3404
  });
3408
3405
  }
3409
3406
  function Lr(e, t, n, r) {
3410
- for (var a = [], u = 0, h = Object.entries(e.queries.query); u < h.length; u++) {
3411
- for (var m = h[u], b = m[0], _ = [], x = 0, y = m[1]; x < y.length; x++) {
3412
- var A = y[x];
3407
+ for (var i = [], u = 0, h = Object.entries(e.queries.query); u < h.length; u++) {
3408
+ for (var m = h[u], b = m[0], _ = [], T = 0, y = m[1]; T < y.length; T++) {
3409
+ var A = y[T];
3413
3410
  Hn(t, A.obsSet) ? A.subscribers.forEach(function(N) {
3414
3411
  return n.add(N);
3415
3412
  }) : r && _.push(A);
3416
3413
  }
3417
- r && a.push([b, _]);
3414
+ r && i.push([b, _]);
3418
3415
  }
3419
- if (r) for (var w = 0, T = a; w < T.length; w++) {
3420
- var O = T[w], b = O[0], _ = O[1];
3416
+ if (r) for (var w = 0, x = i; w < x.length; w++) {
3417
+ var O = x[w], b = O[0], _ = O[1];
3421
3418
  e.queries.query[b] = _;
3422
3419
  }
3423
3420
  }
3424
- function za(e) {
3421
+ function Qa(e) {
3425
3422
  var t = e._state, n = e._deps.indexedDB;
3426
3423
  if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then(function() {
3427
3424
  return t.dbOpenError ? Ee(t.dbOpenError) : e;
3428
3425
  });
3429
3426
  t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
3430
- var r = t.openCanceller, a = Math.round(10 * e.verno), u = !1;
3427
+ var r = t.openCanceller, i = Math.round(10 * e.verno), u = !1;
3431
3428
  function h() {
3432
3429
  if (t.openCanceller !== r) throw new z.DatabaseClosed("db.open() was cancelled");
3433
3430
  }
3434
3431
  function m() {
3435
3432
  return new $(function(A, w) {
3436
3433
  if (h(), !n) throw new z.MissingAPI();
3437
- var T = e.name, O = t.autoSchema || !a ? n.open(T) : n.open(T, a);
3434
+ var x = e.name, O = t.autoSchema || !i ? n.open(x) : n.open(x, i);
3438
3435
  if (!O) throw new z.MissingAPI();
3439
3436
  O.onerror = Xe(w), O.onblocked = pe(e._fireOnBlocked), O.onupgradeneeded = pe(function(N) {
3440
3437
  var C;
3441
- x = O.transaction, t.autoSchema && !e._options.allowEmptyDB ? (O.onerror = Kt, x.abort(), O.result.close(), (C = n.deleteDatabase(T)).onsuccess = C.onerror = pe(function() {
3442
- w(new z.NoSuchDatabase("Database ".concat(T, " doesnt exist")));
3443
- })) : (x.onerror = Xe(w), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, y = N < 1, e.idbdb = O.result, u && Ya(e, x), Xa(e, N / 10, x, w));
3438
+ T = O.transaction, t.autoSchema && !e._options.allowEmptyDB ? (O.onerror = Kt, T.abort(), O.result.close(), (C = n.deleteDatabase(x)).onsuccess = C.onerror = pe(function() {
3439
+ w(new z.NoSuchDatabase("Database ".concat(x, " doesnt exist")));
3440
+ })) : (T.onerror = Xe(w), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, y = N < 1, e.idbdb = O.result, u && Wa(e, T), Ya(e, N / 10, T, w));
3444
3441
  }, w), O.onsuccess = pe(function() {
3445
- x = null;
3446
- var N, C, I, P, F, M = e.idbdb = O.result, U = xe(M.objectStoreNames);
3442
+ T = null;
3443
+ var N, C, I, P, F, M = e.idbdb = O.result, U = Te(M.objectStoreNames);
3447
3444
  if (0 < U.length) try {
3448
3445
  var K = M.transaction((P = U).length === 1 ? P[0] : P, "readonly");
3449
- if (t.autoSchema) C = M, I = K, (N = e).verno = C.version / 10, I = N._dbSchema = mn(0, C, I), N._storeNames = xe(C.objectStoreNames, 0), hn(N, [N._allTables], g(I), I);
3446
+ if (t.autoSchema) C = M, I = K, (N = e).verno = C.version / 10, I = N._dbSchema = mn(0, C, I), N._storeNames = Te(C.objectStoreNames, 0), hn(N, [N._allTables], g(I), I);
3450
3447
  else if (gn(e, e._dbSchema, K), ((F = $n(mn(0, (F = e).idbdb, K), F._dbSchema)).add.length || F.change.some(function(L) {
3451
3448
  return L.add.length || L.change.length;
3452
- })) && !u) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), M.close(), a = M.version + 1, u = !0, A(m());
3449
+ })) && !u) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), M.close(), i = M.version + 1, u = !0, A(m());
3453
3450
  dn(e, K);
3454
3451
  } catch {
3455
3452
  }
@@ -3457,7 +3454,7 @@ function qi() {
3457
3454
  t.vcFired = !0, e.on("versionchange").fire(L);
3458
3455
  }), M.onclose = pe(function(L) {
3459
3456
  e.on("close").fire(L);
3460
- }), y && (F = e._deps, K = T, M = F.indexedDB, F = F.IDBKeyRange, Wn(M) || K === on || Yn(M, F).put({ name: K }).catch(l)), A();
3457
+ }), y && (F = e._deps, K = x, M = F.indexedDB, F = F.IDBKeyRange, Wn(M) || K === on || Yn(M, F).put({ name: K }).catch(l)), A();
3461
3458
  }, w);
3462
3459
  }).catch(function(A) {
3463
3460
  switch (A?.name) {
@@ -3465,12 +3462,12 @@ function qi() {
3465
3462
  if (0 < t.PR1398_maxLoop) return t.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"), m();
3466
3463
  break;
3467
3464
  case "VersionError":
3468
- if (0 < a) return a = 0, m();
3465
+ if (0 < i) return i = 0, m();
3469
3466
  }
3470
3467
  return $.reject(A);
3471
3468
  });
3472
3469
  }
3473
- var b, _ = t.dbReadyResolve, x = null, y = !1;
3470
+ var b, _ = t.dbReadyResolve, T = null, y = !1;
3474
3471
  return $.race([r, (typeof navigator > "u" ? $.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(A) {
3475
3472
  function w() {
3476
3473
  return indexedDB.databases().finally(A);
@@ -3494,7 +3491,7 @@ function qi() {
3494
3491
  }).catch(function(A) {
3495
3492
  t.dbOpenError = A;
3496
3493
  try {
3497
- x && x.abort();
3494
+ T && T.abort();
3498
3495
  } catch {
3499
3496
  }
3500
3497
  return r === t.openCanceller && e._close(), Ee(A);
@@ -3503,8 +3500,8 @@ function qi() {
3503
3500
  }).then(function() {
3504
3501
  var A;
3505
3502
  return y && (A = {}, e.tables.forEach(function(w) {
3506
- w.schema.indexes.forEach(function(T) {
3507
- T.name && (A["idb://".concat(e.name, "/").concat(w.name, "/").concat(T.name)] = new Re(-1 / 0, [[[]]]));
3503
+ w.schema.indexes.forEach(function(x) {
3504
+ x.name && (A["idb://".concat(e.name, "/").concat(w.name, "/").concat(x.name)] = new Re(-1 / 0, [[[]]]));
3508
3505
  }), A["idb://".concat(e.name, "/").concat(w.name, "/")] = A["idb://".concat(e.name, "/").concat(w.name, "/:dels")] = new Re(-1 / 0, [[[]]]);
3509
3506
  }), ut(qt).fire(A), er(A, !0)), e;
3510
3507
  });
@@ -3513,48 +3510,48 @@ function qi() {
3513
3510
  function t(u) {
3514
3511
  return e.next(u);
3515
3512
  }
3516
- var n = a(t), r = a(function(u) {
3513
+ var n = i(t), r = i(function(u) {
3517
3514
  return e.throw(u);
3518
3515
  });
3519
- function a(u) {
3516
+ function i(u) {
3520
3517
  return function(b) {
3521
3518
  var m = u(b), b = m.value;
3522
3519
  return m.done ? b : b && typeof b.then == "function" ? b.then(n, r) : v(b) ? Promise.all(b).then(n, r) : n(b);
3523
3520
  };
3524
3521
  }
3525
- return a(t)();
3522
+ return i(t)();
3526
3523
  }
3527
3524
  function wn(e, t, n) {
3528
- for (var r = v(e) ? e.slice() : [e], a = 0; a < n; ++a) r.push(t);
3525
+ for (var r = v(e) ? e.slice() : [e], i = 0; i < n; ++i) r.push(t);
3529
3526
  return r;
3530
3527
  }
3531
- var Qa = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3532
- return i(i({}, e), { table: function(t) {
3533
- var n = e.table(t), r = n.schema, a = {}, u = [];
3528
+ var Ha = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3529
+ return a(a({}, e), { table: function(t) {
3530
+ var n = e.table(t), r = n.schema, i = {}, u = [];
3534
3531
  function h(y, A, w) {
3535
- var T = Ut(y), O = a[T] = a[T] || [], N = y == null ? 0 : typeof y == "string" ? 1 : y.length, C = 0 < A, C = i(i({}, w), { name: C ? "".concat(T, "(virtual-from:").concat(w.name, ")") : w.name, lowLevelIndex: w, isVirtual: C, keyTail: A, keyLength: N, extractKey: Vn(y), unique: !C && w.unique });
3532
+ var x = Ut(y), O = i[x] = i[x] || [], N = y == null ? 0 : typeof y == "string" ? 1 : y.length, C = 0 < A, C = a(a({}, w), { name: C ? "".concat(x, "(virtual-from:").concat(w.name, ")") : w.name, lowLevelIndex: w, isVirtual: C, keyTail: A, keyLength: N, extractKey: Vn(y), unique: !C && w.unique });
3536
3533
  return O.push(C), C.isPrimaryKey || u.push(C), 1 < N && h(N === 2 ? y[0] : y.slice(0, N - 1), A + 1, w), O.sort(function(I, P) {
3537
3534
  return I.keyTail - P.keyTail;
3538
3535
  }), C;
3539
3536
  }
3540
- t = h(r.primaryKey.keyPath, 0, r.primaryKey), a[":id"] = [t];
3537
+ t = h(r.primaryKey.keyPath, 0, r.primaryKey), i[":id"] = [t];
3541
3538
  for (var m = 0, b = r.indexes; m < b.length; m++) {
3542
3539
  var _ = b[m];
3543
3540
  h(_.keyPath, 0, _);
3544
3541
  }
3545
- function x(y) {
3542
+ function T(y) {
3546
3543
  var A, w = y.query.index;
3547
- return w.isVirtual ? i(i({}, y), { query: { index: w.lowLevelIndex, range: (A = y.query.range, w = w.keyTail, { type: A.type === 1 ? 2 : A.type, lower: wn(A.lower, A.lowerOpen ? e.MAX_KEY : e.MIN_KEY, w), lowerOpen: !0, upper: wn(A.upper, A.upperOpen ? e.MIN_KEY : e.MAX_KEY, w), upperOpen: !0 }) } }) : y;
3544
+ return w.isVirtual ? a(a({}, y), { query: { index: w.lowLevelIndex, range: (A = y.query.range, w = w.keyTail, { type: A.type === 1 ? 2 : A.type, lower: wn(A.lower, A.lowerOpen ? e.MAX_KEY : e.MIN_KEY, w), lowerOpen: !0, upper: wn(A.upper, A.upperOpen ? e.MIN_KEY : e.MAX_KEY, w), upperOpen: !0 }) } }) : y;
3548
3545
  }
3549
- return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes: u, getIndexByKeyPath: function(y) {
3550
- return (y = a[Ut(y)]) && y[0];
3546
+ return a(a({}, n), { schema: a(a({}, r), { primaryKey: t, indexes: u, getIndexByKeyPath: function(y) {
3547
+ return (y = i[Ut(y)]) && y[0];
3551
3548
  } }), count: function(y) {
3552
- return n.count(x(y));
3549
+ return n.count(T(y));
3553
3550
  }, query: function(y) {
3554
- return n.query(x(y));
3551
+ return n.query(T(y));
3555
3552
  }, openCursor: function(y) {
3556
- var A = y.query.index, w = A.keyTail, T = A.isVirtual, O = A.keyLength;
3557
- return T ? n.openCursor(x(y)).then(function(C) {
3553
+ var A = y.query.index, w = A.keyTail, x = A.isVirtual, O = A.keyLength;
3554
+ return x ? n.openCursor(T(y)).then(function(C) {
3558
3555
  return C && N(C);
3559
3556
  }) : n.openCursor(y);
3560
3557
  function N(C) {
@@ -3575,55 +3572,55 @@ function qi() {
3575
3572
  } });
3576
3573
  } };
3577
3574
  function nr(e, t, n, r) {
3578
- return n = n || {}, r = r || "", g(e).forEach(function(a) {
3575
+ return n = n || {}, r = r || "", g(e).forEach(function(i) {
3579
3576
  var u, h, m;
3580
- Y(t, a) ? (u = e[a], h = t[a], typeof u == "object" && typeof h == "object" && u && h ? (m = Rt(u)) !== Rt(h) ? n[r + a] = t[a] : m === "Object" ? nr(u, h, n, r + a + ".") : u !== h && (n[r + a] = t[a]) : u !== h && (n[r + a] = t[a])) : n[r + a] = void 0;
3581
- }), g(t).forEach(function(a) {
3582
- Y(e, a) || (n[r + a] = t[a]);
3577
+ Y(t, i) ? (u = e[i], h = t[i], typeof u == "object" && typeof h == "object" && u && h ? (m = Rt(u)) !== Rt(h) ? n[r + i] = t[i] : m === "Object" ? nr(u, h, n, r + i + ".") : u !== h && (n[r + i] = t[i]) : u !== h && (n[r + i] = t[i])) : n[r + i] = void 0;
3578
+ }), g(t).forEach(function(i) {
3579
+ Y(e, i) || (n[r + i] = t[i]);
3583
3580
  }), n;
3584
3581
  }
3585
3582
  function rr(e, t) {
3586
3583
  return t.type === "delete" ? t.keys : t.keys || t.values.map(e.extractKey);
3587
3584
  }
3588
- var Ha = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3589
- return i(i({}, e), { table: function(t) {
3585
+ var Za = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3586
+ return a(a({}, e), { table: function(t) {
3590
3587
  var n = e.table(t), r = n.schema.primaryKey;
3591
- return i(i({}, n), { mutate: function(a) {
3588
+ return a(a({}, n), { mutate: function(i) {
3592
3589
  var u = W.trans, h = u.table(t).hook, m = h.deleting, b = h.creating, _ = h.updating;
3593
- switch (a.type) {
3590
+ switch (i.type) {
3594
3591
  case "add":
3595
3592
  if (b.fire === l) break;
3596
3593
  return u._promise("readwrite", function() {
3597
- return x(a);
3594
+ return T(i);
3598
3595
  }, !0);
3599
3596
  case "put":
3600
3597
  if (b.fire === l && _.fire === l) break;
3601
3598
  return u._promise("readwrite", function() {
3602
- return x(a);
3599
+ return T(i);
3603
3600
  }, !0);
3604
3601
  case "delete":
3605
3602
  if (m.fire === l) break;
3606
3603
  return u._promise("readwrite", function() {
3607
- return x(a);
3604
+ return T(i);
3608
3605
  }, !0);
3609
3606
  case "deleteRange":
3610
3607
  if (m.fire === l) break;
3611
3608
  return u._promise("readwrite", function() {
3612
- return (function y(A, w, T) {
3613
- return n.query({ trans: A, values: !1, query: { index: r, range: w }, limit: T }).then(function(O) {
3609
+ return (function y(A, w, x) {
3610
+ return n.query({ trans: A, values: !1, query: { index: r, range: w }, limit: x }).then(function(O) {
3614
3611
  var N = O.result;
3615
- return x({ type: "delete", keys: N, trans: A }).then(function(C) {
3616
- return 0 < C.numFailures ? Promise.reject(C.failures[0]) : N.length < T ? { failures: [], numFailures: 0, lastResult: void 0 } : y(A, i(i({}, w), { lower: N[N.length - 1], lowerOpen: !0 }), T);
3612
+ return T({ type: "delete", keys: N, trans: A }).then(function(C) {
3613
+ return 0 < C.numFailures ? Promise.reject(C.failures[0]) : N.length < x ? { failures: [], numFailures: 0, lastResult: void 0 } : y(A, a(a({}, w), { lower: N[N.length - 1], lowerOpen: !0 }), x);
3617
3614
  });
3618
3615
  });
3619
- })(a.trans, a.range, 1e4);
3616
+ })(i.trans, i.range, 1e4);
3620
3617
  }, !0);
3621
3618
  }
3622
- return n.mutate(a);
3623
- function x(y) {
3624
- var A, w, T, O = W.trans, N = y.keys || rr(r, y);
3619
+ return n.mutate(i);
3620
+ function T(y) {
3621
+ var A, w, x, O = W.trans, N = y.keys || rr(r, y);
3625
3622
  if (!N) throw new Error("Keys missing");
3626
- return (y = y.type === "add" || y.type === "put" ? i(i({}, y), { keys: N }) : i({}, y)).type !== "delete" && (y.values = f([], y.values)), y.keys && (y.keys = f([], y.keys)), A = n, T = N, ((w = y).type === "add" ? Promise.resolve([]) : A.getMany({ trans: w.trans, keys: T, cache: "immutable" })).then(function(C) {
3623
+ return (y = y.type === "add" || y.type === "put" ? a(a({}, y), { keys: N }) : a({}, y)).type !== "delete" && (y.values = f([], y.values)), y.keys && (y.keys = f([], y.keys)), A = n, x = N, ((w = y).type === "add" ? Promise.resolve([]) : A.getMany({ trans: w.trans, keys: x, cache: "immutable" })).then(function(C) {
3627
3624
  var I = N.map(function(P, F) {
3628
3625
  var M, U, K, L = C[F], G = { onerror: null, onsuccess: null };
3629
3626
  return y.type === "delete" ? m.fire.call(G, P, L, O) : y.type === "add" || L === void 0 ? (M = b.fire.call(G, P, y.values[F], O), P == null && M != null && (y.keys[F] = P = M, r.outbound || le(y.values[F], r.keyPath, P))) : (M = nr(L, y.values[F]), (U = _.fire.call(G, M, P, L, O)) && (K = y.values[F], Object.keys(U).forEach(function(V) {
@@ -3649,19 +3646,19 @@ function qi() {
3649
3646
  function Ur(e, t, n) {
3650
3647
  try {
3651
3648
  if (!t || t.keys.length < e.length) return null;
3652
- for (var r = [], a = 0, u = 0; a < t.keys.length && u < e.length; ++a) re(t.keys[a], e[u]) === 0 && (r.push(n ? We(t.values[a]) : t.values[a]), ++u);
3649
+ for (var r = [], i = 0, u = 0; i < t.keys.length && u < e.length; ++i) re(t.keys[i], e[u]) === 0 && (r.push(n ? We(t.values[i]) : t.values[i]), ++u);
3653
3650
  return r.length === e.length ? r : null;
3654
3651
  } catch {
3655
3652
  return null;
3656
3653
  }
3657
3654
  }
3658
- var Za = { stack: "dbcore", level: -1, create: function(e) {
3655
+ var Ja = { stack: "dbcore", level: -1, create: function(e) {
3659
3656
  return { table: function(t) {
3660
3657
  var n = e.table(t);
3661
- return i(i({}, n), { getMany: function(r) {
3658
+ return a(a({}, n), { getMany: function(r) {
3662
3659
  if (!r.cache) return n.getMany(r);
3663
- var a = Ur(r.keys, r.trans._cache, r.cache === "clone");
3664
- return a ? $.resolve(a) : n.getMany(r).then(function(u) {
3660
+ var i = Ur(r.keys, r.trans._cache, r.cache === "clone");
3661
+ return i ? $.resolve(i) : n.getMany(r).then(function(u) {
3665
3662
  return r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? We(u) : u }, u;
3666
3663
  });
3667
3664
  }, mutate: function(r) {
@@ -3683,22 +3680,22 @@ function qi() {
3683
3680
  return !1;
3684
3681
  }
3685
3682
  }
3686
- var Ja = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3683
+ var ei = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3687
3684
  var t = e.schema.name, n = new Re(e.MIN_KEY, e.MAX_KEY);
3688
- return i(i({}, e), { transaction: function(r, a, u) {
3689
- if (W.subscr && a !== "readonly") throw new z.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(W.querier));
3690
- return e.transaction(r, a, u);
3685
+ return a(a({}, e), { transaction: function(r, i, u) {
3686
+ if (W.subscr && i !== "readonly") throw new z.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(W.querier));
3687
+ return e.transaction(r, i, u);
3691
3688
  }, table: function(r) {
3692
- var a = e.table(r), u = a.schema, h = u.primaryKey, y = u.indexes, m = h.extractKey, b = h.outbound, _ = h.autoIncrement && y.filter(function(w) {
3689
+ var i = e.table(r), u = i.schema, h = u.primaryKey, y = u.indexes, m = h.extractKey, b = h.outbound, _ = h.autoIncrement && y.filter(function(w) {
3693
3690
  return w.compound && w.keyPath.includes(h.keyPath);
3694
- }), x = i(i({}, a), { mutate: function(w) {
3695
- function T(V) {
3691
+ }), T = a(a({}, i), { mutate: function(w) {
3692
+ function x(V) {
3696
3693
  return V = "idb://".concat(t, "/").concat(r, "/").concat(V), P[V] || (P[V] = new Re());
3697
3694
  }
3698
- var O, N, C, I = w.trans, P = w.mutatedParts || (w.mutatedParts = {}), F = T(""), M = T(":dels"), U = w.type, G = w.type === "deleteRange" ? [w.range] : w.type === "delete" ? [w.keys] : w.values.length < 50 ? [rr(h, w).filter(function(V) {
3695
+ var O, N, C, I = w.trans, P = w.mutatedParts || (w.mutatedParts = {}), F = x(""), M = x(":dels"), U = w.type, G = w.type === "deleteRange" ? [w.range] : w.type === "delete" ? [w.keys] : w.values.length < 50 ? [rr(h, w).filter(function(V) {
3699
3696
  return V;
3700
3697
  }), w.values] : [], K = G[0], L = G[1], G = w.trans._cache;
3701
- return v(K) ? (F.addKeys(K), (G = U === "delete" || K.length === L.length ? Ur(K, G) : null) || M.addKeys(K), (G || L) && (O = T, N = G, C = L, u.indexes.forEach(function(V) {
3698
+ return v(K) ? (F.addKeys(K), (G = U === "delete" || K.length === L.length ? Ur(K, G) : null) || M.addKeys(K), (G || L) && (O = x, N = G, C = L, u.indexes.forEach(function(V) {
3702
3699
  var X = O(V.name || "");
3703
3700
  function ne(ee) {
3704
3701
  return ee != null ? V.extractKey(ee) : null;
@@ -3713,44 +3710,44 @@ function qi() {
3713
3710
  re(J, ke) !== 0 && (J != null && ae(J), ke != null && ae(ke));
3714
3711
  });
3715
3712
  }))) : K ? (L = { from: (L = K.lower) !== null && L !== void 0 ? L : e.MIN_KEY, to: (L = K.upper) !== null && L !== void 0 ? L : e.MAX_KEY }, M.add(L), F.add(L)) : (F.add(n), M.add(n), u.indexes.forEach(function(V) {
3716
- return T(V.name).add(n);
3717
- })), a.mutate(w).then(function(V) {
3713
+ return x(V.name).add(n);
3714
+ })), i.mutate(w).then(function(V) {
3718
3715
  return !K || w.type !== "add" && w.type !== "put" || (F.addKeys(V.results), _ && _.forEach(function(X) {
3719
3716
  for (var ne = w.values.map(function(J) {
3720
3717
  return X.extractKey(J);
3721
3718
  }), ae = X.keyPath.findIndex(function(J) {
3722
3719
  return J === h.keyPath;
3723
3720
  }), ee = 0, we = V.results.length; ee < we; ++ee) ne[ee][ae] = V.results[ee];
3724
- T(X.name).addKeys(ne);
3721
+ x(X.name).addKeys(ne);
3725
3722
  })), I.mutatedParts = vn(I.mutatedParts || {}, P), V;
3726
3723
  });
3727
- } }), y = function(T) {
3728
- var O = T.query, T = O.index, O = O.range;
3729
- return [T, new Re((T = O.lower) !== null && T !== void 0 ? T : e.MIN_KEY, (O = O.upper) !== null && O !== void 0 ? O : e.MAX_KEY)];
3724
+ } }), y = function(x) {
3725
+ var O = x.query, x = O.index, O = O.range;
3726
+ return [x, new Re((x = O.lower) !== null && x !== void 0 ? x : e.MIN_KEY, (O = O.upper) !== null && O !== void 0 ? O : e.MAX_KEY)];
3730
3727
  }, A = { get: function(w) {
3731
3728
  return [h, new Re(w.key)];
3732
3729
  }, getMany: function(w) {
3733
3730
  return [h, new Re().addKeys(w.keys)];
3734
3731
  }, count: y, query: y, openCursor: y };
3735
3732
  return g(A).forEach(function(w) {
3736
- x[w] = function(T) {
3737
- var O = W.subscr, N = !!O, C = Vr(W, a) && Gr(w, T) ? T.obsSet = {} : O;
3733
+ T[w] = function(x) {
3734
+ var O = W.subscr, N = !!O, C = Vr(W, i) && Gr(w, x) ? x.obsSet = {} : O;
3738
3735
  if (N) {
3739
3736
  var I = function(L) {
3740
3737
  return L = "idb://".concat(t, "/").concat(r, "/").concat(L), C[L] || (C[L] = new Re());
3741
- }, P = I(""), F = I(":dels"), O = A[w](T), N = O[0], O = O[1];
3742
- if ((w === "query" && N.isPrimaryKey && !T.values ? F : I(N.name || "")).add(O), !N.isPrimaryKey) {
3738
+ }, P = I(""), F = I(":dels"), O = A[w](x), N = O[0], O = O[1];
3739
+ if ((w === "query" && N.isPrimaryKey && !x.values ? F : I(N.name || "")).add(O), !N.isPrimaryKey) {
3743
3740
  if (w !== "count") {
3744
- var M = w === "query" && b && T.values && a.query(i(i({}, T), { values: !1 }));
3745
- return a[w].apply(this, arguments).then(function(L) {
3741
+ var M = w === "query" && b && x.values && i.query(a(a({}, x), { values: !1 }));
3742
+ return i[w].apply(this, arguments).then(function(L) {
3746
3743
  if (w === "query") {
3747
- if (b && T.values) return M.then(function(ne) {
3744
+ if (b && x.values) return M.then(function(ne) {
3748
3745
  return ne = ne.result, P.addKeys(ne), L;
3749
3746
  });
3750
- var G = T.values ? L.result.map(m) : L.result;
3751
- (T.values ? P : F).addKeys(G);
3747
+ var G = x.values ? L.result.map(m) : L.result;
3748
+ (x.values ? P : F).addKeys(G);
3752
3749
  } else if (w === "openCursor") {
3753
- var V = L, X = T.values;
3750
+ var V = L, X = x.values;
3754
3751
  return V && Object.create(V, { key: { get: function() {
3755
3752
  return F.addKey(V.primaryKey), V.key;
3756
3753
  } }, primaryKey: { get: function() {
@@ -3766,18 +3763,18 @@ function qi() {
3766
3763
  F.add(n);
3767
3764
  }
3768
3765
  }
3769
- return a[w].apply(this, arguments);
3766
+ return i[w].apply(this, arguments);
3770
3767
  };
3771
- }), x;
3768
+ }), T;
3772
3769
  } });
3773
3770
  } };
3774
3771
  function $r(e, t, n) {
3775
3772
  if (n.numFailures === 0) return t;
3776
3773
  if (t.type === "deleteRange") return null;
3777
3774
  var r = t.keys ? t.keys.length : "values" in t && t.values ? t.values.length : 1;
3778
- return n.numFailures === r ? null : (t = i({}, t), v(t.keys) && (t.keys = t.keys.filter(function(a, u) {
3775
+ return n.numFailures === r ? null : (t = a({}, t), v(t.keys) && (t.keys = t.keys.filter(function(i, u) {
3779
3776
  return !(u in n.failures);
3780
- })), "values" in t && v(t.values) && (t.values = t.values.filter(function(a, u) {
3777
+ })), "values" in t && v(t.values) && (t.values = t.values.filter(function(i, u) {
3781
3778
  return !(u in n.failures);
3782
3779
  })), t);
3783
3780
  }
@@ -3785,17 +3782,17 @@ function qi() {
3785
3782
  return n = e, ((r = t).lower === void 0 || (r.lowerOpen ? 0 < re(n, r.lower) : 0 <= re(n, r.lower))) && (e = e, (t = t).upper === void 0 || (t.upperOpen ? re(e, t.upper) < 0 : re(e, t.upper) <= 0));
3786
3783
  var n, r;
3787
3784
  }
3788
- function Xr(e, t, A, r, a, u) {
3785
+ function Xr(e, t, A, r, i, u) {
3789
3786
  if (!A || A.length === 0) return e;
3790
- var h = t.query.index, m = h.multiEntry, b = t.query.range, _ = r.schema.primaryKey.extractKey, x = h.extractKey, y = (h.lowLevelIndex || h).extractKey, A = A.reduce(function(w, T) {
3787
+ var h = t.query.index, m = h.multiEntry, b = t.query.range, _ = r.schema.primaryKey.extractKey, T = h.extractKey, y = (h.lowLevelIndex || h).extractKey, A = A.reduce(function(w, x) {
3791
3788
  var O = w, N = [];
3792
- if (T.type === "add" || T.type === "put") for (var C = new Re(), I = T.values.length - 1; 0 <= I; --I) {
3793
- var P, F = T.values[I], M = _(F);
3794
- C.hasKey(M) || (P = x(F), (m && v(P) ? P.some(function(V) {
3789
+ if (x.type === "add" || x.type === "put") for (var C = new Re(), I = x.values.length - 1; 0 <= I; --I) {
3790
+ var P, F = x.values[I], M = _(F);
3791
+ C.hasKey(M) || (P = T(F), (m && v(P) ? P.some(function(V) {
3795
3792
  return ar(V, b);
3796
3793
  }) : ar(P, b)) && (C.addKey(M), N.push(F)));
3797
3794
  }
3798
- switch (T.type) {
3795
+ switch (x.type) {
3799
3796
  case "add":
3800
3797
  var U = new Re().addKeys(t.values ? w.map(function(X) {
3801
3798
  return _(X);
@@ -3808,7 +3805,7 @@ function qi() {
3808
3805
  }));
3809
3806
  break;
3810
3807
  case "put":
3811
- var K = new Re().addKeys(T.values.map(function(X) {
3808
+ var K = new Re().addKeys(x.values.map(function(X) {
3812
3809
  return _(X);
3813
3810
  }));
3814
3811
  O = w.filter(function(X) {
@@ -3818,66 +3815,66 @@ function qi() {
3818
3815
  }));
3819
3816
  break;
3820
3817
  case "delete":
3821
- var L = new Re().addKeys(T.keys);
3818
+ var L = new Re().addKeys(x.keys);
3822
3819
  O = w.filter(function(X) {
3823
3820
  return !L.hasKey(t.values ? _(X) : X);
3824
3821
  });
3825
3822
  break;
3826
3823
  case "deleteRange":
3827
- var G = T.range;
3824
+ var G = x.range;
3828
3825
  O = w.filter(function(X) {
3829
3826
  return !ar(_(X), G);
3830
3827
  });
3831
3828
  }
3832
3829
  return O;
3833
3830
  }, e);
3834
- return A === e ? e : (A.sort(function(w, T) {
3835
- return re(y(w), y(T)) || re(_(w), _(T));
3836
- }), t.limit && t.limit < 1 / 0 && (A.length > t.limit ? A.length = t.limit : e.length === t.limit && A.length < t.limit && (a.dirty = !0)), u ? Object.freeze(A) : A);
3831
+ return A === e ? e : (A.sort(function(w, x) {
3832
+ return re(y(w), y(x)) || re(_(w), _(x));
3833
+ }), t.limit && t.limit < 1 / 0 && (A.length > t.limit ? A.length = t.limit : e.length === t.limit && A.length < t.limit && (i.dirty = !0)), u ? Object.freeze(A) : A);
3837
3834
  }
3838
3835
  function Yr(e, t) {
3839
3836
  return re(e.lower, t.lower) === 0 && re(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
3840
3837
  }
3841
- function ei(e, t) {
3842
- return (function(n, r, a, u) {
3838
+ function ti(e, t) {
3839
+ return (function(n, r, i, u) {
3843
3840
  if (n === void 0) return r !== void 0 ? -1 : 0;
3844
3841
  if (r === void 0) return 1;
3845
3842
  if ((r = re(n, r)) === 0) {
3846
- if (a && u) return 0;
3847
- if (a) return 1;
3843
+ if (i && u) return 0;
3844
+ if (i) return 1;
3848
3845
  if (u) return -1;
3849
3846
  }
3850
3847
  return r;
3851
- })(e.lower, t.lower, e.lowerOpen, t.lowerOpen) <= 0 && 0 <= (function(n, r, a, u) {
3848
+ })(e.lower, t.lower, e.lowerOpen, t.lowerOpen) <= 0 && 0 <= (function(n, r, i, u) {
3852
3849
  if (n === void 0) return r !== void 0 ? 1 : 0;
3853
3850
  if (r === void 0) return -1;
3854
3851
  if ((r = re(n, r)) === 0) {
3855
- if (a && u) return 0;
3856
- if (a) return -1;
3852
+ if (i && u) return 0;
3853
+ if (i) return -1;
3857
3854
  if (u) return 1;
3858
3855
  }
3859
3856
  return r;
3860
3857
  })(e.upper, t.upper, e.upperOpen, t.upperOpen);
3861
3858
  }
3862
- function ti(e, t, n, r) {
3859
+ function ni(e, t, n, r) {
3863
3860
  e.subscribers.add(n), r.addEventListener("abort", function() {
3864
- var a, u;
3865
- e.subscribers.delete(n), e.subscribers.size === 0 && (a = e, u = t, setTimeout(function() {
3866
- a.subscribers.size === 0 && Me(u, a);
3861
+ var i, u;
3862
+ e.subscribers.delete(n), e.subscribers.size === 0 && (i = e, u = t, setTimeout(function() {
3863
+ i.subscribers.size === 0 && Me(u, i);
3867
3864
  }, 3e3));
3868
3865
  });
3869
3866
  }
3870
- var ni = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
3867
+ var ri = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
3871
3868
  var t = e.schema.name;
3872
- return i(i({}, e), { transaction: function(n, r, a) {
3873
- var u, h, m = e.transaction(n, r, a);
3874
- return r === "readwrite" && (h = (u = new AbortController()).signal, a = function(b) {
3869
+ return a(a({}, e), { transaction: function(n, r, i) {
3870
+ var u, h, m = e.transaction(n, r, i);
3871
+ return r === "readwrite" && (h = (u = new AbortController()).signal, i = function(b) {
3875
3872
  return function() {
3876
3873
  if (u.abort(), r === "readwrite") {
3877
- for (var _ = /* @__PURE__ */ new Set(), x = 0, y = n; x < y.length; x++) {
3878
- var A = y[x], w = gt["idb://".concat(t, "/").concat(A)];
3874
+ for (var _ = /* @__PURE__ */ new Set(), T = 0, y = n; T < y.length; T++) {
3875
+ var A = y[T], w = gt["idb://".concat(t, "/").concat(A)];
3879
3876
  if (w) {
3880
- var T = e.table(A), O = w.optimisticOps.filter(function(X) {
3877
+ var x = e.table(A), O = w.optimisticOps.filter(function(X) {
3881
3878
  return X.trans === m;
3882
3879
  });
3883
3880
  if (m._explicit && b && m.mutatedParts) for (var N = 0, C = Object.values(w.queries.query); N < C.length; N++) for (var I = 0, P = (U = C[N]).slice(); I < P.length; I++) Hn((K = P[I]).obsSet, m.mutatedParts) && (Me(U, K), K.subscribers.forEach(function(X) {
@@ -3887,7 +3884,7 @@ function qi() {
3887
3884
  w.optimisticOps = w.optimisticOps.filter(function(X) {
3888
3885
  return X.trans !== m;
3889
3886
  });
3890
- for (var F = 0, M = Object.values(w.queries.query); F < M.length; F++) for (var U, K, L, G = 0, V = (U = M[F]).slice(); G < V.length; G++) (K = V[G]).res != null && m.mutatedParts && (b && !K.dirty ? (L = Object.isFrozen(K.res), L = Xr(K.res, K.req, O, T, K, L), K.dirty ? (Me(U, K), K.subscribers.forEach(function(X) {
3887
+ for (var F = 0, M = Object.values(w.queries.query); F < M.length; F++) for (var U, K, L, G = 0, V = (U = M[F]).slice(); G < V.length; G++) (K = V[G]).res != null && m.mutatedParts && (b && !K.dirty ? (L = Object.isFrozen(K.res), L = Xr(K.res, K.req, O, x, K, L), K.dirty ? (Me(U, K), K.subscribers.forEach(function(X) {
3891
3888
  return _.add(X);
3892
3889
  })) : L !== K.res && (K.res = L, K.promise = $.resolve({ result: L }))) : (K.dirty && Me(U, K), K.subscribers.forEach(function(X) {
3893
3890
  return _.add(X);
@@ -3900,23 +3897,23 @@ function qi() {
3900
3897
  });
3901
3898
  }
3902
3899
  };
3903
- }, m.addEventListener("abort", a(!1), { signal: h }), m.addEventListener("error", a(!1), { signal: h }), m.addEventListener("complete", a(!0), { signal: h })), m;
3900
+ }, m.addEventListener("abort", i(!1), { signal: h }), m.addEventListener("error", i(!1), { signal: h }), m.addEventListener("complete", i(!0), { signal: h })), m;
3904
3901
  }, table: function(n) {
3905
- var r = e.table(n), a = r.schema.primaryKey;
3906
- return i(i({}, r), { mutate: function(u) {
3902
+ var r = e.table(n), i = r.schema.primaryKey;
3903
+ return a(a({}, r), { mutate: function(u) {
3907
3904
  var h = W.trans;
3908
- if (a.outbound || h.db._options.cache === "disabled" || h.explicit || h.idbtrans.mode !== "readwrite") return r.mutate(u);
3905
+ if (i.outbound || h.db._options.cache === "disabled" || h.explicit || h.idbtrans.mode !== "readwrite") return r.mutate(u);
3909
3906
  var m = gt["idb://".concat(t, "/").concat(n)];
3910
- return m ? (h = r.mutate(u), u.type !== "add" && u.type !== "put" || !(50 <= u.values.length || rr(a, u).some(function(b) {
3907
+ return m ? (h = r.mutate(u), u.type !== "add" && u.type !== "put" || !(50 <= u.values.length || rr(i, u).some(function(b) {
3911
3908
  return b == null;
3912
3909
  })) ? (m.optimisticOps.push(u), u.mutatedParts && bn(u.mutatedParts), h.then(function(b) {
3913
3910
  0 < b.numFailures && (Me(m.optimisticOps, u), (b = $r(0, u, b)) && m.optimisticOps.push(b), u.mutatedParts && bn(u.mutatedParts));
3914
3911
  }), h.catch(function() {
3915
3912
  Me(m.optimisticOps, u), u.mutatedParts && bn(u.mutatedParts);
3916
3913
  })) : h.then(function(b) {
3917
- var _ = $r(0, i(i({}, u), { values: u.values.map(function(x, y) {
3914
+ var _ = $r(0, a(a({}, u), { values: u.values.map(function(T, y) {
3918
3915
  var A;
3919
- return b.failures[y] ? x : (x = (A = a.keyPath) !== null && A !== void 0 && A.includes(".") ? We(x) : i({}, x), le(x, a.keyPath, b.results[y]), x);
3916
+ return b.failures[y] ? T : (T = (A = i.keyPath) !== null && A !== void 0 && A.includes(".") ? We(T) : a({}, T), le(T, i.keyPath, b.results[y]), T);
3920
3917
  }) }), b);
3921
3918
  m.optimisticOps.push(_), queueMicrotask(function() {
3922
3919
  return u.mutatedParts && bn(u.mutatedParts);
@@ -3924,8 +3921,8 @@ function qi() {
3924
3921
  }), h) : r.mutate(u);
3925
3922
  }, query: function(u) {
3926
3923
  if (!Vr(W, r) || !Gr("query", u)) return r.query(u);
3927
- var h = ((_ = W.trans) === null || _ === void 0 ? void 0 : _.db._options.cache) === "immutable", y = W, m = y.requery, b = y.signal, _ = (function(T, O, N, C) {
3928
- var I = gt["idb://".concat(T, "/").concat(O)];
3924
+ var h = ((_ = W.trans) === null || _ === void 0 ? void 0 : _.db._options.cache) === "immutable", y = W, m = y.requery, b = y.signal, _ = (function(x, O, N, C) {
3925
+ var I = gt["idb://".concat(x, "/").concat(O)];
3929
3926
  if (!I) return [];
3930
3927
  if (!(O = I.queries[N])) return [null, !1, I, null];
3931
3928
  var P = O[(C.query ? C.query.index.name : null) || ""];
@@ -3936,43 +3933,43 @@ function qi() {
3936
3933
  return M.req.limit === C.limit && M.req.values === C.values && Yr(M.req.query.range, C.query.range);
3937
3934
  });
3938
3935
  return F ? [F, !0, I, P] : [P.find(function(M) {
3939
- return ("limit" in M.req ? M.req.limit : 1 / 0) >= C.limit && (!C.values || M.req.values) && ei(M.req.query.range, C.query.range);
3936
+ return ("limit" in M.req ? M.req.limit : 1 / 0) >= C.limit && (!C.values || M.req.values) && ti(M.req.query.range, C.query.range);
3940
3937
  }), !1, I, P];
3941
3938
  case "count":
3942
3939
  return F = P.find(function(M) {
3943
3940
  return Yr(M.req.query.range, C.query.range);
3944
3941
  }), [F, !!F, I, P];
3945
3942
  }
3946
- })(t, n, "query", u), x = _[0], y = _[1], A = _[2], w = _[3];
3947
- return x && y ? x.obsSet = u.obsSet : (y = r.query(u).then(function(T) {
3948
- var O = T.result;
3949
- if (x && (x.res = O), h) {
3943
+ })(t, n, "query", u), T = _[0], y = _[1], A = _[2], w = _[3];
3944
+ return T && y ? T.obsSet = u.obsSet : (y = r.query(u).then(function(x) {
3945
+ var O = x.result;
3946
+ if (T && (T.res = O), h) {
3950
3947
  for (var N = 0, C = O.length; N < C; ++N) Object.freeze(O[N]);
3951
3948
  Object.freeze(O);
3952
- } else T.result = We(O);
3953
- return T;
3954
- }).catch(function(T) {
3955
- return w && x && Me(w, x), Promise.reject(T);
3956
- }), x = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(x) : (w = [x], (A = A || (gt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), ti(x, w, m, b), x.promise.then(function(T) {
3957
- return { result: Xr(T.result, u, A?.optimisticOps, r, x, h) };
3949
+ } else x.result = We(O);
3950
+ return x;
3951
+ }).catch(function(x) {
3952
+ return w && T && Me(w, T), Promise.reject(x);
3953
+ }), T = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(T) : (w = [T], (A = A || (gt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), ni(T, w, m, b), T.promise.then(function(x) {
3954
+ return { result: Xr(x.result, u, A?.optimisticOps, r, T, h) };
3958
3955
  });
3959
3956
  } });
3960
3957
  } });
3961
3958
  } };
3962
3959
  function _n(e, t) {
3963
- return new Proxy(e, { get: function(n, r, a) {
3964
- return r === "db" ? t : Reflect.get(n, r, a);
3960
+ return new Proxy(e, { get: function(n, r, i) {
3961
+ return r === "db" ? t : Reflect.get(n, r, i);
3965
3962
  } });
3966
3963
  }
3967
- var He = (Te.prototype.version = function(e) {
3964
+ var He = (xe.prototype.version = function(e) {
3968
3965
  if (isNaN(e) || e < 0.1) throw new z.Type("Given version is not a positive number");
3969
3966
  if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new z.Schema("Cannot add version when database is open");
3970
3967
  this.verno = Math.max(this.verno, e);
3971
3968
  var t = this._versions, n = t.filter(function(r) {
3972
3969
  return r._cfg.version === e;
3973
3970
  })[0];
3974
- return n || (n = new this.Version(e), t.push(n), t.sort($a), n.stores({}), this._state.autoSchema = !1, n);
3975
- }, Te.prototype._whenReady = function(e) {
3971
+ return n || (n = new this.Version(e), t.push(n), t.sort(Xa), n.stores({}), this._state.autoSchema = !1, n);
3972
+ }, xe.prototype._whenReady = function(e) {
3976
3973
  var t = this;
3977
3974
  return this.idbdb && (this._state.openComplete || W.letThrough || this._vip) ? e() : new $(function(n, r) {
3978
3975
  if (t._state.openComplete) return r(new z.DatabaseClosed(t._state.dbOpenError));
@@ -3982,22 +3979,22 @@ function qi() {
3982
3979
  }
3983
3980
  t._state.dbReadyPromise.then(n, r);
3984
3981
  }).then(e);
3985
- }, Te.prototype.use = function(e) {
3986
- var t = e.stack, n = e.create, r = e.level, a = e.name;
3987
- 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(u, h) {
3982
+ }, xe.prototype.use = function(e) {
3983
+ var t = e.stack, n = e.create, r = e.level, i = e.name;
3984
+ return i && this.unuse({ stack: t, name: i }), e = this._middlewares[t] || (this._middlewares[t] = []), e.push({ stack: t, create: n, level: r ?? 10, name: i }), e.sort(function(u, h) {
3988
3985
  return u.level - h.level;
3989
3986
  }), this;
3990
- }, Te.prototype.unuse = function(e) {
3987
+ }, xe.prototype.unuse = function(e) {
3991
3988
  var t = e.stack, n = e.name, r = e.create;
3992
- return t && this._middlewares[t] && (this._middlewares[t] = this._middlewares[t].filter(function(a) {
3993
- return r ? a.create !== r : !!n && a.name !== n;
3989
+ return t && this._middlewares[t] && (this._middlewares[t] = this._middlewares[t].filter(function(i) {
3990
+ return r ? i.create !== r : !!n && i.name !== n;
3994
3991
  })), this;
3995
- }, Te.prototype.open = function() {
3992
+ }, xe.prototype.open = function() {
3996
3993
  var e = this;
3997
3994
  return ht(rt, function() {
3998
- return za(e);
3995
+ return Qa(e);
3999
3996
  });
4000
- }, Te.prototype._close = function() {
3997
+ }, xe.prototype._close = function() {
4001
3998
  this.on.close.fire(new CustomEvent("close"));
4002
3999
  var e = this._state, t = Ot.indexOf(this);
4003
4000
  if (0 <= t && Ot.splice(t, 1), this.idbdb) {
@@ -4012,52 +4009,52 @@ function qi() {
4012
4009
  }), e.openCanceller = new $(function(n, r) {
4013
4010
  e.cancelOpen = r;
4014
4011
  }));
4015
- }, Te.prototype.close = function(n) {
4012
+ }, xe.prototype.close = function(n) {
4016
4013
  var t = (n === void 0 ? { disableAutoOpen: !0 } : n).disableAutoOpen, n = this._state;
4017
4014
  t ? (n.isBeingOpened && n.cancelOpen(new z.DatabaseClosed()), this._close(), n.autoOpen = !1, n.dbOpenError = new z.DatabaseClosed()) : (this._close(), n.autoOpen = this._options.autoOpen || n.isBeingOpened, n.openComplete = !1, n.dbOpenError = null);
4018
- }, Te.prototype.delete = function(e) {
4015
+ }, xe.prototype.delete = function(e) {
4019
4016
  var t = this;
4020
4017
  e === void 0 && (e = { disableAutoOpen: !0 });
4021
4018
  var n = 0 < arguments.length && typeof arguments[0] != "object", r = this._state;
4022
- return new $(function(a, u) {
4019
+ return new $(function(i, u) {
4023
4020
  function h() {
4024
4021
  t.close(e);
4025
4022
  var m = t._deps.indexedDB.deleteDatabase(t.name);
4026
4023
  m.onsuccess = pe(function() {
4027
- var b, _, x;
4028
- b = t._deps, _ = t.name, x = b.indexedDB, b = b.IDBKeyRange, Wn(x) || _ === on || Yn(x, b).delete(_).catch(l), a();
4024
+ var b, _, T;
4025
+ b = t._deps, _ = t.name, T = b.indexedDB, b = b.IDBKeyRange, Wn(T) || _ === on || Yn(T, b).delete(_).catch(l), i();
4029
4026
  }), m.onerror = Xe(u), m.onblocked = t._fireOnBlocked;
4030
4027
  }
4031
4028
  if (n) throw new z.InvalidArgument("Invalid closeOptions argument to db.delete()");
4032
4029
  r.isBeingOpened ? r.dbReadyPromise.then(h) : h();
4033
4030
  });
4034
- }, Te.prototype.backendDB = function() {
4031
+ }, xe.prototype.backendDB = function() {
4035
4032
  return this.idbdb;
4036
- }, Te.prototype.isOpen = function() {
4033
+ }, xe.prototype.isOpen = function() {
4037
4034
  return this.idbdb !== null;
4038
- }, Te.prototype.hasBeenClosed = function() {
4035
+ }, xe.prototype.hasBeenClosed = function() {
4039
4036
  var e = this._state.dbOpenError;
4040
4037
  return e && e.name === "DatabaseClosed";
4041
- }, Te.prototype.hasFailed = function() {
4038
+ }, xe.prototype.hasFailed = function() {
4042
4039
  return this._state.dbOpenError !== null;
4043
- }, Te.prototype.dynamicallyOpened = function() {
4040
+ }, xe.prototype.dynamicallyOpened = function() {
4044
4041
  return this._state.autoSchema;
4045
- }, Object.defineProperty(Te.prototype, "tables", { get: function() {
4042
+ }, Object.defineProperty(xe.prototype, "tables", { get: function() {
4046
4043
  var e = this;
4047
4044
  return g(this._allTables).map(function(t) {
4048
4045
  return e._allTables[t];
4049
4046
  });
4050
- }, enumerable: !1, configurable: !0 }), Te.prototype.transaction = function() {
4047
+ }, enumerable: !1, configurable: !0 }), xe.prototype.transaction = function() {
4051
4048
  var e = (function(t, n, r) {
4052
- var a = arguments.length;
4053
- if (a < 2) throw new z.InvalidArgument("Too few arguments");
4054
- for (var u = new Array(a - 1); --a; ) u[a - 1] = arguments[a];
4049
+ var i = arguments.length;
4050
+ if (i < 2) throw new z.InvalidArgument("Too few arguments");
4051
+ for (var u = new Array(i - 1); --i; ) u[i - 1] = arguments[i];
4055
4052
  return r = u.pop(), [t, S(u), r];
4056
4053
  }).apply(this, arguments);
4057
4054
  return this._transaction.apply(this, e);
4058
- }, Te.prototype._transaction = function(e, t, n) {
4059
- var r = this, a = W.trans;
4060
- a && a.db === this && e.indexOf("!") === -1 || (a = null);
4055
+ }, xe.prototype._transaction = function(e, t, n) {
4056
+ var r = this, i = W.trans;
4057
+ i && i.db === this && e.indexOf("!") === -1 || (i = null);
4061
4058
  var u, h, m = e.indexOf("?") !== -1;
4062
4059
  e = e.replace("!", "").replace("?", "");
4063
4060
  try {
@@ -4069,38 +4066,38 @@ function qi() {
4069
4066
  if (e != "rw" && e != jn) throw new z.InvalidArgument("Invalid transaction mode: " + e);
4070
4067
  u = jn;
4071
4068
  }
4072
- if (a) {
4073
- if (a.mode === Bn && u === jn) {
4069
+ if (i) {
4070
+ if (i.mode === Bn && u === jn) {
4074
4071
  if (!m) throw new z.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
4075
- a = null;
4072
+ i = null;
4076
4073
  }
4077
- a && h.forEach(function(_) {
4078
- if (a && a.storeNames.indexOf(_) === -1) {
4074
+ i && h.forEach(function(_) {
4075
+ if (i && i.storeNames.indexOf(_) === -1) {
4079
4076
  if (!m) throw new z.SubTransaction("Table " + _ + " not included in parent transaction.");
4080
- a = null;
4077
+ i = null;
4081
4078
  }
4082
- }), m && a && !a.active && (a = null);
4079
+ }), m && i && !i.active && (i = null);
4083
4080
  }
4084
4081
  } catch (_) {
4085
- return a ? a._promise(null, function(x, y) {
4082
+ return i ? i._promise(null, function(T, y) {
4086
4083
  y(_);
4087
4084
  }) : Ee(_);
4088
4085
  }
4089
- var b = (function _(x, y, A, w, T) {
4086
+ var b = (function _(T, y, A, w, x) {
4090
4087
  return $.resolve().then(function() {
4091
- var O = W.transless || W, N = x._createTransaction(y, A, x._dbSchema, w);
4088
+ var O = W.transless || W, N = T._createTransaction(y, A, T._dbSchema, w);
4092
4089
  if (N.explicit = !0, O = { trans: N, transless: O }, w) N.idbtrans = w.idbtrans;
4093
4090
  else try {
4094
- N.create(), N.idbtrans._explicit = !0, x._state.PR1398_maxLoop = 3;
4091
+ N.create(), N.idbtrans._explicit = !0, T._state.PR1398_maxLoop = 3;
4095
4092
  } catch (P) {
4096
- return P.name === lt.InvalidState && x.isOpen() && 0 < --x._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), x.close({ disableAutoOpen: !1 }), x.open().then(function() {
4097
- return _(x, y, A, null, T);
4093
+ return P.name === lt.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
4094
+ return _(T, y, A, null, x);
4098
4095
  })) : Ee(P);
4099
4096
  }
4100
- var C, I = bt(T);
4097
+ var C, I = bt(x);
4101
4098
  return I && Nt(), O = $.follow(function() {
4102
4099
  var P;
4103
- (C = T.call(N, N)) && (I ? (P = it.bind(null, null), C.then(P, P)) : typeof C.next == "function" && typeof C.throw == "function" && (C = tr(C)));
4100
+ (C = x.call(N, N)) && (I ? (P = it.bind(null, null), C.then(P, P)) : typeof C.next == "function" && typeof C.throw == "function" && (C = tr(C)));
4104
4101
  }, O), (C && typeof C.then == "function" ? $.resolve(C).then(function(P) {
4105
4102
  return N.active ? P : Ee(new z.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
4106
4103
  }) : O.then(function() {
@@ -4113,58 +4110,58 @@ function qi() {
4113
4110
  return N._reject(P), Ee(P);
4114
4111
  });
4115
4112
  });
4116
- }).bind(null, this, u, h, a, n);
4117
- return a ? a._promise(u, b, "lock") : W.trans ? ht(W.transless, function() {
4113
+ }).bind(null, this, u, h, i, n);
4114
+ return i ? i._promise(u, b, "lock") : W.trans ? ht(W.transless, function() {
4118
4115
  return r._whenReady(b);
4119
4116
  }) : this._whenReady(b);
4120
- }, Te.prototype.table = function(e) {
4117
+ }, xe.prototype.table = function(e) {
4121
4118
  if (!Y(this._allTables, e)) throw new z.InvalidTable("Table ".concat(e, " does not exist"));
4122
4119
  return this._allTables[e];
4123
- }, Te);
4124
- function Te(e, t) {
4120
+ }, xe);
4121
+ function xe(e, t) {
4125
4122
  var n = this;
4126
4123
  this._middlewares = {}, this.verno = 0;
4127
- var r = Te.dependencies;
4128
- this._options = t = i({ addons: Te.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;
4129
- var a, u, h, m, b, _ = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: l, dbReadyPromise: null, cancelOpen: l, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
4124
+ var r = xe.dependencies;
4125
+ this._options = t = a({ addons: xe.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;
4126
+ var i, u, h, m, b, _ = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: l, dbReadyPromise: null, cancelOpen: l, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
4130
4127
  _.dbReadyPromise = new $(function(y) {
4131
4128
  _.dbReadyResolve = y;
4132
4129
  }), _.openCanceller = new $(function(y, A) {
4133
4130
  _.cancelOpen = A;
4134
4131
  }), this._state = _, this.name = e, this.on = Bt(this, "populate", "blocked", "versionchange", "close", { ready: [Ae, l] }), this.once = function(y, A) {
4135
4132
  var w = function() {
4136
- for (var T = [], O = 0; O < arguments.length; O++) T[O] = arguments[O];
4137
- n.on(y).unsubscribe(w), A.apply(n, T);
4133
+ for (var x = [], O = 0; O < arguments.length; O++) x[O] = arguments[O];
4134
+ n.on(y).unsubscribe(w), A.apply(n, x);
4138
4135
  };
4139
4136
  return n.on(y, w);
4140
4137
  }, this.on.ready.subscribe = te(this.on.ready.subscribe, function(y) {
4141
4138
  return function(A, w) {
4142
- Te.vip(function() {
4143
- var T, O = n._state;
4144
- O.openComplete ? (O.dbOpenError || $.resolve().then(A), w && y(A)) : O.onReadyBeingFired ? (O.onReadyBeingFired.push(A), w && y(A)) : (y(A), T = n, w || y(function N() {
4145
- T.on.ready.unsubscribe(A), T.on.ready.unsubscribe(N);
4139
+ xe.vip(function() {
4140
+ var x, O = n._state;
4141
+ O.openComplete ? (O.dbOpenError || $.resolve().then(A), w && y(A)) : O.onReadyBeingFired ? (O.onReadyBeingFired.push(A), w && y(A)) : (y(A), x = n, w || y(function N() {
4142
+ x.on.ready.unsubscribe(A), x.on.ready.unsubscribe(N);
4146
4143
  }));
4147
4144
  });
4148
4145
  };
4149
- }), this.Collection = (a = this, jt(Ma.prototype, function(C, N) {
4150
- this.db = a;
4151
- var w = Tr, T = null;
4146
+ }), this.Collection = (i = this, jt(Ka.prototype, function(C, N) {
4147
+ this.db = i;
4148
+ var w = xr, x = null;
4152
4149
  if (N) try {
4153
4150
  w = N();
4154
4151
  } catch (I) {
4155
- T = I;
4152
+ x = I;
4156
4153
  }
4157
4154
  var O = C._ctx, N = O.table, C = N.hook.reading.fire;
4158
- this._ctx = { table: N, index: O.index, isPrimKey: !O.index || N.schema.primKey.keyPath && O.index === N.schema.primKey.name, range: w, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: T, or: O.or, valueMapper: C !== s ? C : null };
4155
+ this._ctx = { table: N, index: O.index, isPrimKey: !O.index || N.schema.primKey.keyPath && O.index === N.schema.primKey.name, range: w, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: x, or: O.or, valueMapper: C !== s ? C : null };
4159
4156
  })), this.Table = (u = this, jt(Ar.prototype, function(y, A, w) {
4160
4157
  this.db = u, this._tx = w, this.name = y, this.schema = A, this.hook = u._allTables[y] ? u._allTables[y].hook : Bt(null, { creating: [se, l], reading: [k, s], updating: [_e, l], deleting: [ye, l] });
4161
- })), this.Transaction = (h = this, jt(La.prototype, function(y, A, w, T, O) {
4158
+ })), this.Transaction = (h = this, jt(Ua.prototype, function(y, A, w, x, O) {
4162
4159
  var N = this;
4163
4160
  y !== "readonly" && A.forEach(function(C) {
4164
4161
  C = (C = w[C]) === null || C === void 0 ? void 0 : C.yProps, C && (A = A.concat(C.map(function(I) {
4165
4162
  return I.updatesTable;
4166
4163
  })));
4167
- }), this.db = h, this.mode = y, this.storeNames = A, this.schema = w, this.chromeTransactionDurability = T, this.idbtrans = null, this.on = Bt(this, "complete", "error", "abort"), this.parent = O || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new $(function(C, I) {
4164
+ }), this.db = h, this.mode = y, this.storeNames = A, this.schema = w, this.chromeTransactionDurability = x, this.idbtrans = null, this.on = Bt(this, "complete", "error", "abort"), this.parent = O || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new $(function(C, I) {
4168
4165
  N._resolve = C, N._reject = I;
4169
4166
  }), this._completion.then(function() {
4170
4167
  N.active = !1, N.on.complete.fire();
@@ -4172,46 +4169,46 @@ function qi() {
4172
4169
  var I = N.active;
4173
4170
  return N.active = !1, N.on.error.fire(C), N.parent ? N.parent._reject(C) : I && N.idbtrans && N.idbtrans.abort(), Ee(C);
4174
4171
  });
4175
- })), this.Version = (m = this, jt(Wa.prototype, function(y) {
4172
+ })), this.Version = (m = this, jt(za.prototype, function(y) {
4176
4173
  this.db = m, this._cfg = { version: y, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
4177
4174
  })), this.WhereClause = (b = this, jt(kr.prototype, function(y, A, w) {
4178
- if (this.db = b, this._ctx = { table: y, index: A === ":id" ? null : A, or: w }, this._cmp = this._ascending = re, this._descending = function(T, O) {
4179
- return re(O, T);
4180
- }, this._max = function(T, O) {
4181
- return 0 < re(T, O) ? T : O;
4182
- }, this._min = function(T, O) {
4183
- return re(T, O) < 0 ? T : O;
4175
+ if (this.db = b, this._ctx = { table: y, index: A === ":id" ? null : A, or: w }, this._cmp = this._ascending = re, this._descending = function(x, O) {
4176
+ return re(O, x);
4177
+ }, this._max = function(x, O) {
4178
+ return 0 < re(x, O) ? x : O;
4179
+ }, this._min = function(x, O) {
4180
+ return re(x, O) < 0 ? x : O;
4184
4181
  }, this._IDBKeyRange = b._deps.IDBKeyRange, !this._IDBKeyRange) throw new z.MissingAPI();
4185
4182
  })), this.on("versionchange", function(y) {
4186
4183
  0 < y.newVersion ? console.warn("Another connection wants to upgrade database '".concat(n.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(n.name, "'. Closing db now to resume the delete request.")), n.close({ disableAutoOpen: !1 });
4187
4184
  }), this.on("blocked", function(y) {
4188
4185
  !y.newVersion || y.newVersion < y.oldVersion ? console.warn("Dexie.delete('".concat(n.name, "') was blocked")) : console.warn("Upgrade '".concat(n.name, "' blocked by other connection holding version ").concat(y.oldVersion / 10));
4189
- }), this._maxKey = Lt(t.IDBKeyRange), this._createTransaction = function(y, A, w, T) {
4190
- return new n.Transaction(y, A, w, n._options.chromeTransactionDurability, T);
4186
+ }), this._maxKey = Lt(t.IDBKeyRange), this._createTransaction = function(y, A, w, x) {
4187
+ return new n.Transaction(y, A, w, n._options.chromeTransactionDurability, x);
4191
4188
  }, this._fireOnBlocked = function(y) {
4192
4189
  n.on("blocked").fire(y), Ot.filter(function(A) {
4193
4190
  return A.name === n.name && A !== n && !A._state.vcFired;
4194
4191
  }).map(function(A) {
4195
4192
  return A.on("versionchange").fire(y);
4196
4193
  });
4197
- }, this.use(Za), this.use(ni), this.use(Ja), this.use(Qa), this.use(Ha);
4198
- var x = new Proxy(this, { get: function(y, A, w) {
4194
+ }, this.use(Ja), this.use(ri), this.use(ei), this.use(Ha), this.use(Za);
4195
+ var T = new Proxy(this, { get: function(y, A, w) {
4199
4196
  if (A === "_vip") return !0;
4200
4197
  if (A === "table") return function(O) {
4201
- return _n(n.table(O), x);
4198
+ return _n(n.table(O), T);
4202
4199
  };
4203
- var T = Reflect.get(y, A, w);
4204
- return T instanceof Ar ? _n(T, x) : A === "tables" ? T.map(function(O) {
4205
- return _n(O, x);
4200
+ var x = Reflect.get(y, A, w);
4201
+ return x instanceof Ar ? _n(x, T) : A === "tables" ? x.map(function(O) {
4202
+ return _n(O, T);
4206
4203
  }) : A === "_createTransaction" ? function() {
4207
- return _n(T.apply(this, arguments), x);
4208
- } : T;
4204
+ return _n(x.apply(this, arguments), T);
4205
+ } : x;
4209
4206
  } });
4210
- this.vip = x, r.forEach(function(y) {
4207
+ this.vip = T, r.forEach(function(y) {
4211
4208
  return y(n);
4212
4209
  });
4213
4210
  }
4214
- var En, Le = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", ri = (ir.prototype.subscribe = function(e, t, n) {
4211
+ var En, Le = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", ai = (ir.prototype.subscribe = function(e, t, n) {
4215
4212
  return this._subscribe(e && typeof e != "function" ? e : { next: e, error: t, complete: n });
4216
4213
  }, ir.prototype[Le] = function() {
4217
4214
  return this;
@@ -4225,42 +4222,42 @@ function qi() {
4225
4222
  En = { indexedDB: null, IDBKeyRange: null };
4226
4223
  }
4227
4224
  function Wr(e) {
4228
- var t, n = !1, r = new ri(function(a) {
4229
- var u = bt(e), h, m = !1, b = {}, _ = {}, x = { get closed() {
4225
+ var t, n = !1, r = new ai(function(i) {
4226
+ var u = bt(e), h, m = !1, b = {}, _ = {}, T = { get closed() {
4230
4227
  return m;
4231
4228
  }, unsubscribe: function() {
4232
4229
  m || (m = !0, h && h.abort(), y && ut.storagemutated.unsubscribe(w));
4233
4230
  } };
4234
- a.start && a.start(x);
4231
+ i.start && i.start(T);
4235
4232
  var y = !1, A = function() {
4236
- return Fn(T);
4233
+ return Fn(x);
4237
4234
  }, w = function(O) {
4238
4235
  vn(b, O), Hn(_, b) && A();
4239
- }, T = function() {
4236
+ }, x = function() {
4240
4237
  var O, N, C;
4241
4238
  !m && En.indexedDB && (b = {}, O = {}, h && h.abort(), h = new AbortController(), C = (function(I) {
4242
- var P = Tt();
4239
+ var P = xt();
4243
4240
  try {
4244
4241
  u && Nt();
4245
4242
  var F = at(e, I);
4246
4243
  return F = u ? F.finally(it) : F;
4247
4244
  } finally {
4248
- P && xt();
4245
+ P && Tt();
4249
4246
  }
4250
4247
  })(N = { subscr: O, signal: h.signal, requery: A, querier: e, trans: null }), Promise.resolve(C).then(function(I) {
4251
4248
  n = !0, t = I, m || N.signal.aborted || (b = {}, (function(P) {
4252
4249
  for (var F in P) if (Y(P, F)) return;
4253
4250
  return 1;
4254
4251
  })(_ = O) || y || (ut(qt, w), y = !0), Fn(function() {
4255
- return !m && a.next && a.next(I);
4252
+ return !m && i.next && i.next(I);
4256
4253
  }));
4257
4254
  }, function(I) {
4258
4255
  n = !1, ["DatabaseClosedError", "AbortError"].includes(I?.name) || m || Fn(function() {
4259
- m || a.error && a.error(I);
4256
+ m || i.error && i.error(I);
4260
4257
  });
4261
4258
  }));
4262
4259
  };
4263
- return setTimeout(A, 0), x;
4260
+ return setTimeout(A, 0), T;
4264
4261
  });
4265
4262
  return r.hasValue = function() {
4266
4263
  return n;
@@ -4277,7 +4274,7 @@ function qi() {
4277
4274
  ct = t;
4278
4275
  }
4279
4276
  }
4280
- Q(yt, i(i({}, Et), { delete: function(e) {
4277
+ Q(yt, a(a({}, Et), { delete: function(e) {
4281
4278
  return new yt(e, { addons: [] }).delete();
4282
4279
  }, exists: function(e) {
4283
4280
  return new yt(e, { addons: [] }).open().then(function(t) {
@@ -4288,10 +4285,10 @@ function qi() {
4288
4285
  }, getDatabaseNames: function(e) {
4289
4286
  try {
4290
4287
  return t = yt.dependencies, n = t.indexedDB, t = t.IDBKeyRange, (Wn(n) ? Promise.resolve(n.databases()).then(function(r) {
4291
- return r.map(function(a) {
4292
- return a.name;
4293
- }).filter(function(a) {
4294
- return a !== on;
4288
+ return r.map(function(i) {
4289
+ return i.name;
4290
+ }).filter(function(i) {
4291
+ return i !== on;
4295
4292
  });
4296
4293
  }) : Yn(n, t).toCollection().primaryKeys()).then(e);
4297
4294
  } catch {
@@ -4317,8 +4314,8 @@ function qi() {
4317
4314
  try {
4318
4315
  var r = tr(e.apply(n, t || []));
4319
4316
  return r && typeof r.then == "function" ? r : $.resolve(r);
4320
- } catch (a) {
4321
- return Ee(a);
4317
+ } catch (i) {
4318
+ return Ee(i);
4322
4319
  }
4323
4320
  }, currentTransaction: { get: function() {
4324
4321
  return W.trans || null;
@@ -4360,7 +4357,7 @@ function qi() {
4360
4357
  return !e || e instanceof et || e instanceof TypeError || e instanceof SyntaxError || !e.name || !_t[e.name] ? e : (t = new _t[e.name](t || e.message, e), "stack" in e && j(t, "stack", { get: function() {
4361
4358
  return this.inner.stack;
4362
4359
  } }), t);
4363
- }, Oe(Ne), i(He, Object.freeze({ __proto__: null, Dexie: He, liveQuery: Wr, Entity: xr, cmp: re, PropModification: Mt, replacePrefix: function(e, t) {
4360
+ }, Oe(Ne), a(He, Object.freeze({ __proto__: null, Dexie: He, liveQuery: Wr, Entity: Tr, cmp: re, PropModification: Mt, replacePrefix: function(e, t) {
4364
4361
  return new Mt({ replacePrefix: [e, t] });
4365
4362
  }, add: function(e) {
4366
4363
  return new Mt({ add: e });
@@ -4371,7 +4368,7 @@ function qi() {
4371
4368
  })(Nn)), Nn.exports;
4372
4369
  }
4373
4370
  var Li = qi();
4374
- const hr = /* @__PURE__ */ xa(Li), ra = /* @__PURE__ */ Symbol.for("Dexie"), Je = globalThis[ra] || (globalThis[ra] = hr);
4371
+ const hr = /* @__PURE__ */ Na(Li), aa = /* @__PURE__ */ Symbol.for("Dexie"), Je = globalThis[aa] || (globalThis[aa] = hr);
4375
4372
  if (hr.semVer !== Je.semVer)
4376
4373
  throw new Error(`Two different versions of Dexie loaded in the same app: ${hr.semVer} and ${Je.semVer}`);
4377
4374
  const {
@@ -4386,19 +4383,19 @@ const {
4386
4383
  add: Lo,
4387
4384
  remove: Uo,
4388
4385
  DexieYProvider: Vo
4389
- } = Je, aa = "_changeLog", ia = "_meta";
4386
+ } = Je, ia = "_changeLog", oa = "_meta";
4390
4387
  class Ui {
4391
4388
  constructor(o, c) {
4392
4389
  this.name = o;
4393
- const { xmlElements: i, additionalTables: f } = c.database.tables;
4394
- this.tableName = i.name, this.databaseInstance = new Je(o);
4390
+ const { xmlElements: a, additionalTables: f } = c.database.tables;
4391
+ this.tableName = a.name, this.databaseInstance = new Je(o);
4395
4392
  const d = {
4396
- [i.name]: i.schema
4393
+ [a.name]: a.schema
4397
4394
  };
4398
4395
  if (f)
4399
4396
  for (const [g, v] of Object.entries(f))
4400
4397
  d[g] = v.schema;
4401
- d[aa] = "++sequenceNumber, id", d[ia] = "key", this.databaseInstance.version(1).stores(d);
4398
+ d[ia] = "++sequenceNumber, id", d[oa] = "key", this.databaseInstance.version(1).stores(d);
4402
4399
  }
4403
4400
  async get(o) {
4404
4401
  return this.databaseInstance.table(this.tableName).get(o);
@@ -4407,10 +4404,10 @@ class Ui {
4407
4404
  return this.databaseInstance.table(this.tableName).where({ tagName: o }).toArray();
4408
4405
  }
4409
4406
  get changeLogTable() {
4410
- return this.databaseInstance.table(aa);
4407
+ return this.databaseInstance.table(ia);
4411
4408
  }
4412
4409
  get metaTable() {
4413
- return this.databaseInstance.table(ia);
4410
+ return this.databaseInstance.table(oa);
4414
4411
  }
4415
4412
  async getHead() {
4416
4413
  return (await this.metaTable.get("head"))?.value ?? 0;
@@ -4419,7 +4416,7 @@ class Ui {
4419
4416
  await this.metaTable.put({ key: "head", value: o });
4420
4417
  }
4421
4418
  async commit(o) {
4422
- const { creates: c, updates: i, deletes: f, onProgress: d } = o, g = this.databaseInstance.table(this.tableName), v = c.length + i.length + f.length;
4419
+ const { creates: c, updates: a, deletes: f, onProgress: d } = o, g = this.databaseInstance.table(this.tableName), v = c.length + a.length + f.length;
4423
4420
  let D = 0;
4424
4421
  try {
4425
4422
  await this.databaseInstance.transaction(
@@ -4428,7 +4425,7 @@ class Ui {
4428
4425
  this.changeLogTable,
4429
4426
  this.metaTable,
4430
4427
  async () => {
4431
- const R = i.length > 0 ? await g.bulkGet(i.map((j) => j.id)) : [], q = f.length > 0 ? await g.bulkGet(f) : [];
4428
+ const R = a.length > 0 ? await g.bulkGet(a.map((j) => j.id)) : [], q = f.length > 0 ? await g.bulkGet(f) : [];
4432
4429
  if (c.length > 0)
4433
4430
  try {
4434
4431
  await g.bulkAdd(c), D += c.length, d(D, v);
@@ -4442,11 +4439,11 @@ class Ui {
4442
4439
  }
4443
4440
  });
4444
4441
  }
4445
- if (i.length > 0)
4442
+ if (a.length > 0)
4446
4443
  try {
4447
- await g.bulkPut(i), D += i.length, d(D, v);
4444
+ await g.bulkPut(a), D += a.length, d(D, v);
4448
4445
  } catch (j) {
4449
- const B = this.extractFailedRecordFromError(j, i);
4446
+ const B = this.extractFailedRecordFromError(j, a);
4450
4447
  qe("STORE_BULK_UPDATE_FAILED", {
4451
4448
  detail: j instanceof Error ? j.message : String(j),
4452
4449
  cause: j instanceof Error ? j : void 0,
@@ -4472,7 +4469,7 @@ class Ui {
4472
4469
  timestamp: Date.now(),
4473
4470
  operations: {
4474
4471
  creates: c,
4475
- updates: i.map((j, B) => ({
4472
+ updates: a.map((j, B) => ({
4476
4473
  before: R[B],
4477
4474
  after: j
4478
4475
  })),
@@ -4493,9 +4490,9 @@ class Ui {
4493
4490
  }
4494
4491
  extractFailedRecordFromError(o, c) {
4495
4492
  if (o instanceof Error && "failures" in o) {
4496
- const i = o.failures;
4497
- if (i && i.length > 0) {
4498
- const f = i[0].key;
4493
+ const a = o.failures;
4494
+ if (a && a.length > 0) {
4495
+ const f = a[0].key;
4499
4496
  return c.find((d) => d.id === f);
4500
4497
  }
4501
4498
  }
@@ -4511,19 +4508,19 @@ class Ui {
4511
4508
  const c = await this.changeLogTable.where({ sequenceNumber: o }).first();
4512
4509
  if (!c)
4513
4510
  return;
4514
- const i = this.databaseInstance.table(this.tableName);
4515
- await this.databaseInstance.transaction("rw", i, this.metaTable, async () => {
4511
+ const a = this.databaseInstance.table(this.tableName);
4512
+ await this.databaseInstance.transaction("rw", a, this.metaTable, async () => {
4516
4513
  const { creates: f, updates: d, deletes: g } = c.operations;
4517
- f.length > 0 && await i.bulkDelete(f.map((v) => v.id)), d.length > 0 && await i.bulkPut(d.map((v) => v.before)), g.length > 0 && await i.bulkAdd(g), await this.setHead(o - 1);
4514
+ f.length > 0 && await a.bulkDelete(f.map((v) => v.id)), d.length > 0 && await a.bulkPut(d.map((v) => v.before)), g.length > 0 && await a.bulkAdd(g), await this.setHead(o - 1);
4518
4515
  });
4519
4516
  }
4520
4517
  async redo() {
4521
- const c = await this.getHead() + 1, i = await this.changeLogTable.where({ sequenceNumber: c }).first();
4522
- if (!i)
4518
+ const c = await this.getHead() + 1, a = await this.changeLogTable.where({ sequenceNumber: c }).first();
4519
+ if (!a)
4523
4520
  return;
4524
4521
  const f = this.databaseInstance.table(this.tableName);
4525
4522
  await this.databaseInstance.transaction("rw", f, this.metaTable, async () => {
4526
- const { creates: d, updates: g, deletes: v } = i.operations;
4523
+ const { creates: d, updates: g, deletes: v } = a.operations;
4527
4524
  d.length > 0 && await f.bulkAdd(d), g.length > 0 && await f.bulkPut(g.map((D) => D.after)), v.length > 0 && await f.bulkDelete(v.map((D) => D.id)), await this.setHead(c);
4528
4525
  });
4529
4526
  }
@@ -4541,24 +4538,24 @@ class Ui {
4541
4538
  }
4542
4539
  }
4543
4540
  function Vi(p) {
4544
- const { databaseName: o, dialecteConfig: c } = p, { xmlElements: i, additionalTables: f } = c.database.tables, d = new Je(o), g = {
4545
- [i.name]: i.schema
4541
+ const { databaseName: o, dialecteConfig: c } = p, { xmlElements: a, additionalTables: f } = c.database.tables, d = new Je(o), g = {
4542
+ [a.name]: a.schema
4546
4543
  };
4547
4544
  if (f)
4548
4545
  for (const [v, D] of Object.entries(f))
4549
4546
  g[v] = D.schema;
4550
4547
  return d.version(1).stores(g), d;
4551
4548
  }
4552
- async function Na(p) {
4553
- const { databaseInstance: o, elementsTableName: c, records: i } = p, f = o.table(c);
4554
- await o.transaction("rw", f, () => f.bulkAdd(i));
4549
+ async function Oa(p) {
4550
+ const { databaseInstance: o, elementsTableName: c, records: a } = p, f = o.table(c);
4551
+ await o.transaction("rw", f, () => f.bulkAdd(a));
4555
4552
  }
4556
4553
  async function Gi(p) {
4557
- const { databaseInstance: o, elementsTableName: c, updates: i } = p;
4558
- if (i.length === 0) return;
4554
+ const { databaseInstance: o, elementsTableName: c, updates: a } = p;
4555
+ if (a.length === 0) return;
4559
4556
  const f = o.table(c);
4560
4557
  await o.transaction("rw", f, async () => {
4561
- for (const { recordId: d, ...g } of i) {
4558
+ for (const { recordId: d, ...g } of a) {
4562
4559
  const v = await f.get(d);
4563
4560
  if (!v) continue;
4564
4561
  const D = { ...g };
@@ -4583,11 +4580,11 @@ async function Gi(p) {
4583
4580
  });
4584
4581
  }
4585
4582
  async function Go(p) {
4586
- const { databaseInstance: o, elementsTableName: c, updates: i } = p;
4587
- if (i.length === 0) return;
4583
+ const { databaseInstance: o, elementsTableName: c, updates: a } = p;
4584
+ if (a.length === 0) return;
4588
4585
  const f = o.table(c);
4589
4586
  await o.transaction("rw", f, async () => {
4590
- for (const { recordId: d, attributes: g } of i) {
4587
+ for (const { recordId: d, attributes: g } of a) {
4591
4588
  const v = await f.get(d);
4592
4589
  if (!v) continue;
4593
4590
  const D = [...v.attributes];
@@ -4600,10 +4597,10 @@ async function Go(p) {
4600
4597
  });
4601
4598
  }
4602
4599
  async function $i(p) {
4603
- const { databaseInstance: o, elementsTableName: c, ids: i } = p;
4604
- if (i.length === 0) return;
4600
+ const { databaseInstance: o, elementsTableName: c, ids: a } = p;
4601
+ if (a.length === 0) return;
4605
4602
  const f = o.table(c);
4606
- await o.transaction("rw", f, () => f.bulkDelete(i));
4603
+ await o.transaction("rw", f, () => f.bulkDelete(a));
4607
4604
  }
4608
4605
  async function $o(p) {
4609
4606
  if (await Je.exists(p))
@@ -4616,17 +4613,17 @@ const Yt = {};
4616
4613
  function Yi(p) {
4617
4614
  const { parentId: o, child: c } = p;
4618
4615
  Yt[o] || (Yt[o] = []);
4619
- const i = {
4616
+ const a = {
4620
4617
  id: c.id,
4621
4618
  tagName: c.tagName
4622
4619
  };
4623
- Yt[o].push(i);
4620
+ Yt[o].push(a);
4624
4621
  }
4625
4622
  function Wi(p) {
4626
4623
  const { currentBatch: o } = p, c = [...o];
4627
- for (const [i, f] of c.entries()) {
4624
+ for (const [a, f] of c.entries()) {
4628
4625
  const d = Yt[f.id] || [];
4629
- d.length > 0 && (c[i].children.push(...d), zi({
4626
+ d.length > 0 && (c[a].children.push(...d), zi({
4630
4627
  parentId: f.id
4631
4628
  }));
4632
4629
  }
@@ -4641,13 +4638,13 @@ const Qi = {}, Hi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
4641
4638
  __proto__: null,
4642
4639
  default: Qi
4643
4640
  }, Symbol.toStringTag, { value: "Module" })), Zi = /* @__PURE__ */ Mi(Hi);
4644
- var oa;
4641
+ var sa;
4645
4642
  function Ji() {
4646
- return oa || (oa = 1, (function(p) {
4643
+ return sa || (sa = 1, (function(p) {
4647
4644
  (function(o) {
4648
4645
  o.parser = function(l, s) {
4649
- return new i(l, s);
4650
- }, o.SAXParser = i, o.SAXStream = Y, o.createStream = R, o.MAX_BUFFER_LENGTH = 64 * 1024;
4646
+ return new a(l, s);
4647
+ }, o.SAXParser = a, o.SAXStream = Y, o.createStream = R, o.MAX_BUFFER_LENGTH = 64 * 1024;
4651
4648
  var c = [
4652
4649
  "comment",
4653
4650
  "sgmlDecl",
@@ -4682,9 +4679,9 @@ function Ji() {
4682
4679
  "opennamespace",
4683
4680
  "closenamespace"
4684
4681
  ];
4685
- function i(l, s) {
4686
- if (!(this instanceof i))
4687
- return new i(l, s);
4682
+ function a(l, s) {
4683
+ if (!(this instanceof a))
4684
+ return new a(l, s);
4688
4685
  var k = this;
4689
4686
  d(k), k.q = k.c = "", k.bufferCheckPosition = o.MAX_BUFFER_LENGTH, k.encoding = null, k.opt = s || {}, k.opt.lowercase = k.opt.lowercase || k.opt.lowercasetags, k.looseCase = k.opt.lowercase ? "toLowerCase" : "toUpperCase", k.opt.maxEntityCount = k.opt.maxEntityCount || 512, k.opt.maxEntityDepth = k.opt.maxEntityDepth || 4, k.entityCount = k.entityDepth = 0, k.tags = [], k.closed = k.closedRoot = k.sawRoot = !1, k.tag = k.error = null, k.strict = !!l, k.noscript = !!(l || k.opt.noscript), k.state = S.BEGIN, k.strictEntities = k.opt.strictEntities, k.ENTITIES = k.strictEntities ? Object.create(o.XML_ENTITIES) : Object.create(o.ENTITIES), k.attribList = [], k.opt.xmlns && (k.ns = Object.create(ue)), k.opt.unquotedAttributeValues === void 0 && (k.opt.unquotedAttributeValues = !l), k.trackPosition = k.opt.position !== !1, k.trackPosition && (k.position = k.line = k.column = 0), Ue(k, "onready");
4690
4687
  }
@@ -4728,7 +4725,7 @@ function Ji() {
4728
4725
  function g(l) {
4729
4726
  Me(l), l.cdata !== "" && (be(l, "oncdata", l.cdata), l.cdata = ""), l.script !== "" && (be(l, "onscript", l.script), l.script = "");
4730
4727
  }
4731
- i.prototype = {
4728
+ a.prototype = {
4732
4729
  end: function() {
4733
4730
  bt(this);
4734
4731
  },
@@ -4770,7 +4767,7 @@ function Ji() {
4770
4767
  function Y(l, s) {
4771
4768
  if (!(this instanceof Y))
4772
4769
  return new Y(l, s);
4773
- v.apply(this), this._parser = new i(l, s), this.writable = !0, this.readable = !0;
4770
+ v.apply(this), this._parser = new a(l, s), this.writable = !0, this.readable = !0;
4774
4771
  var k = this;
4775
4772
  this._parser.onend = function() {
4776
4773
  k.emit("end");
@@ -4827,7 +4824,7 @@ function Ji() {
4827
4824
  E.splice(0, 0, l), k.emit.apply(k, E);
4828
4825
  }), v.prototype.on.call(k, l, s);
4829
4826
  };
4830
- var Q = "[CDATA[", fe = "DOCTYPE", j = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", ue = { xml: j, xmlns: B }, ie = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, xe = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, te = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, H = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
4827
+ var Q = "[CDATA[", fe = "DOCTYPE", j = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", ue = { xml: j, xmlns: B }, ie = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, Te = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, te = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, H = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
4831
4828
  function Z(l) {
4832
4829
  return l === " " || l === `
4833
4830
  ` || l === "\r" || l === " ";
@@ -5224,10 +5221,10 @@ Column: ` + l.column + `
5224
5221
  Char: ` + l.c), s = new Error(s), l.error = s, Ue(l, "onerror", s), l;
5225
5222
  }
5226
5223
  function bt(l) {
5227
- return l.sawRoot && !l.closedRoot && ce(l, "Unclosed root tag"), l.state !== S.BEGIN && l.state !== S.BEGIN_WHITESPACE && l.state !== S.TEXT && Se(l, "Unexpected end"), Me(l), l.c = "", l.closed = !0, Ue(l, "onend"), i.call(l, l.strict, l.opt), l;
5224
+ return l.sawRoot && !l.closedRoot && ce(l, "Unclosed root tag"), l.state !== S.BEGIN && l.state !== S.BEGIN_WHITESPACE && l.state !== S.TEXT && Se(l, "Unexpected end"), Me(l), l.c = "", l.closed = !0, Ue(l, "onend"), a.call(l, l.strict, l.opt), l;
5228
5225
  }
5229
5226
  function ce(l, s) {
5230
- if (typeof l != "object" || !(l instanceof i))
5227
+ if (typeof l != "object" || !(l instanceof a))
5231
5228
  throw new Error("bad call to strictFail");
5232
5229
  l.strict && Se(l, s);
5233
5230
  }
@@ -5474,7 +5471,7 @@ Actual: ` + l.attribValue
5474
5471
  s.procInstBody += "?" + E, s.state = S.PROC_INST_BODY;
5475
5472
  continue;
5476
5473
  case S.OPEN_TAG:
5477
- ge(xe, E) ? s.tagName += E : (et(s), E === ">" ? je(s) : E === "/" ? s.state = S.OPEN_TAG_SLASH : (Z(E) || ce(s, "Invalid character in tag name"), s.state = S.ATTRIB));
5474
+ ge(Te, E) ? s.tagName += E : (et(s), E === ">" ? je(s) : E === "/" ? s.state = S.OPEN_TAG_SLASH : (Z(E) || ce(s, "Invalid character in tag name"), s.state = S.ATTRIB));
5478
5475
  continue;
5479
5476
  case S.OPEN_TAG_SLASH:
5480
5477
  E === ">" ? (je(s, !0), lt(s)) : (ce(
@@ -5488,7 +5485,7 @@ Actual: ` + l.attribValue
5488
5485
  E === ">" ? je(s) : E === "/" ? s.state = S.OPEN_TAG_SLASH : ge(ie, E) ? (s.attribName = E, s.attribValue = "", s.state = S.ATTRIB_NAME) : ce(s, "Invalid attribute name");
5489
5486
  continue;
5490
5487
  case S.ATTRIB_NAME:
5491
- E === "=" ? s.state = S.ATTRIB_VALUE : E === ">" ? (ce(s, "Attribute without value"), s.attribValue = s.attribName, tt(s), je(s)) : Z(E) ? s.state = S.ATTRIB_NAME_SAW_WHITE : ge(xe, E) ? s.attribName += E : ce(s, "Invalid attribute name");
5488
+ E === "=" ? s.state = S.ATTRIB_VALUE : E === ">" ? (ce(s, "Attribute without value"), s.attribValue = s.attribName, tt(s), je(s)) : Z(E) ? s.state = S.ATTRIB_NAME_SAW_WHITE : ge(Te, E) ? s.attribName += E : ce(s, "Invalid attribute name");
5492
5489
  continue;
5493
5490
  case S.ATTRIB_NAME_SAW_WHITE:
5494
5491
  if (E === "=")
@@ -5526,7 +5523,7 @@ Actual: ` + l.attribValue
5526
5523
  continue;
5527
5524
  case S.CLOSE_TAG:
5528
5525
  if (s.tagName)
5529
- E === ">" ? lt(s) : ge(xe, E) ? s.tagName += E : s.script ? (s.script += "</" + s.tagName + E, s.tagName = "", s.state = S.SCRIPT) : (Z(E) || ce(s, "Invalid tagname in closing tag"), s.state = S.CLOSE_TAG_SAW_WHITE);
5526
+ E === ">" ? lt(s) : ge(Te, E) ? s.tagName += E : s.script ? (s.script += "</" + s.tagName + E, s.tagName = "", s.state = S.SCRIPT) : (Z(E) || ce(s, "Invalid tagname in closing tag"), s.state = S.CLOSE_TAG_SAW_WHITE);
5530
5527
  else {
5531
5528
  if (Z(E))
5532
5529
  continue;
@@ -5596,7 +5593,7 @@ Actual: ` + l.attribValue
5596
5593
  }
5597
5594
  var eo = Ji();
5598
5595
  function to(p) {
5599
- const { dialecteConfig: o, useCustomRecordsIds: c } = p, i = o.io.hooks;
5596
+ const { dialecteConfig: o, useCustomRecordsIds: c } = p, a = o.io.hooks;
5600
5597
  let d = {
5601
5598
  defaultNamespace: null,
5602
5599
  stack: [],
@@ -5625,7 +5622,7 @@ function to(p) {
5625
5622
  useCustomRecordsIds: c
5626
5623
  }), g.ontext = (R) => d = ro({ text: R, state: d }), g.onclosetag = () => ({ updatedState: d } = ao({
5627
5624
  state: d,
5628
- ioHooks: i
5625
+ ioHooks: a
5629
5626
  })), g.onerror = io;
5630
5627
  function v() {
5631
5628
  const R = d.recordsBatch;
@@ -5641,11 +5638,11 @@ function to(p) {
5641
5638
  };
5642
5639
  }
5643
5640
  function no(p) {
5644
- const { node: o, state: c, dialecteConfig: i, useCustomRecordsIds: f } = p, d = { ...c }, g = oo(o);
5641
+ const { node: o, state: c, dialecteConfig: a, useCustomRecordsIds: f } = p, d = { ...c }, g = oo(o);
5645
5642
  d.defaultNamespace || (d.defaultNamespace = so({
5646
5643
  element: o,
5647
- defaultNamespace: i.namespaces.default,
5648
- rootElementName: i.rootElementName
5644
+ defaultNamespace: a.namespaces.default,
5645
+ rootElementName: a.rootElementName
5649
5646
  }));
5650
5647
  const v = uo(o, d.defaultNamespace), D = fo({ attributes: o.attributes, useCustomRecordsIds: f }), R = ho({
5651
5648
  attributes: o.attributes,
@@ -5666,12 +5663,12 @@ function ro(p) {
5666
5663
  return o && c.stack.length > 0 && (c.stack[c.stack.length - 1].value += o), c;
5667
5664
  }
5668
5665
  function ao(p) {
5669
- const { state: o, ioHooks: c } = p, i = o.stack.at(-1);
5666
+ const { state: o, ioHooks: c } = p, a = o.stack.at(-1);
5670
5667
  let f = o.stack.slice(0, -1);
5671
5668
  const d = [...o.recordsBatch];
5672
- if (i) {
5669
+ if (a) {
5673
5670
  if (c?.beforeImportRecord && c.beforeImportRecord({
5674
- record: i,
5671
+ record: a,
5675
5672
  ancestry: f
5676
5673
  }), f.length) {
5677
5674
  const g = f.length - 1;
@@ -5680,15 +5677,15 @@ function ao(p) {
5680
5677
  ...v,
5681
5678
  children: [
5682
5679
  ...v.children,
5683
- { id: i.id, tagName: i.tagName }
5680
+ { id: a.id, tagName: a.tagName }
5684
5681
  ]
5685
5682
  } : v
5686
5683
  );
5687
- } else i.parent && Yi({
5688
- parentId: i.parent.id,
5689
- child: { id: i.id, tagName: i.tagName }
5684
+ } else a.parent && Yi({
5685
+ parentId: a.parent.id,
5686
+ child: { id: a.id, tagName: a.tagName }
5690
5687
  });
5691
- d.push(i);
5688
+ d.push(a);
5692
5689
  }
5693
5690
  return {
5694
5691
  updatedState: {
@@ -5705,9 +5702,9 @@ function oo(p) {
5705
5702
  return p.local;
5706
5703
  }
5707
5704
  function so(p) {
5708
- const { element: o, defaultNamespace: c, rootElementName: i } = p;
5709
- return Ge(o.name === i, {
5710
- detail: `Expected root element <${i}>, got <${o.name}>`
5705
+ const { element: o, defaultNamespace: c, rootElementName: a } = p;
5706
+ return Ge(o.name === a, {
5707
+ detail: `Expected root element <${a}>, got <${o.name}>`
5711
5708
  }), o.attributes?.xmlns?.value ? {
5712
5709
  prefix: "",
5713
5710
  uri: o.attributes.xmlns.value
@@ -5738,24 +5735,24 @@ function lo(p) {
5738
5735
  return o ? { id: o.id, tagName: o.tagName } : null;
5739
5736
  }
5740
5737
  function fo(p) {
5741
- const { attributes: o, useCustomRecordsIds: c } = p, i = o[da];
5742
- return c && i && i.value ? i.value : crypto.randomUUID();
5738
+ const { attributes: o, useCustomRecordsIds: c } = p, a = o[ha];
5739
+ return c && a && a.value ? a.value : crypto.randomUUID();
5743
5740
  }
5744
5741
  function ho(p) {
5745
5742
  const { attributes: o, useCustomRecordsIds: c } = p;
5746
- return c ? Object.values(o).filter((i) => i.name !== da) : Object.values(o);
5743
+ return c ? Object.values(o).filter((a) => a.name !== ha) : Object.values(o);
5747
5744
  }
5748
- const sa = {
5745
+ const ua = {
5749
5746
  useBrowserApi: !0,
5750
5747
  chunkSize: 32 * 1024,
5751
5748
  // 32KB
5752
5749
  batchSize: 2e3
5753
5750
  };
5754
5751
  async function Xo(p) {
5755
- const { files: o, dialecteConfig: c, useCustomRecordsIds: i = !1 } = p, f = [];
5752
+ const { files: o, dialecteConfig: c, useCustomRecordsIds: a = !1 } = p, f = [];
5756
5753
  if (o.length === 0) throw new Error("No files provided for import.");
5757
- const { importOptions: d = sa, supportedFileExtensions: g } = c.io, v = {
5758
- ...sa,
5754
+ const { importOptions: d = ua, supportedFileExtensions: g } = c.io, v = {
5755
+ ...ua,
5759
5756
  ...d
5760
5757
  };
5761
5758
  for (const D of o) {
@@ -5768,7 +5765,7 @@ async function Xo(p) {
5768
5765
  file: D,
5769
5766
  dialecteConfig: c,
5770
5767
  options: v,
5771
- useCustomRecordsIds: i
5768
+ useCustomRecordsIds: a
5772
5769
  });
5773
5770
  f.push(R);
5774
5771
  }
@@ -5776,28 +5773,28 @@ async function Xo(p) {
5776
5773
  }
5777
5774
  function po(p) {
5778
5775
  const { file: o, supportedExtensions: c } = p;
5779
- return c.some((i) => o.name.toLowerCase().endsWith(i));
5776
+ return c.some((a) => o.name.toLowerCase().endsWith(a));
5780
5777
  }
5781
5778
  function mo(p) {
5782
5779
  return p.name.replace(/\.[^.]+$/, "");
5783
5780
  }
5784
5781
  async function go(p) {
5785
- const { file: o, dialecteConfig: c, options: i, useCustomRecordsIds: f } = p, d = mo(o), g = await Vi({ databaseName: d, dialecteConfig: c });
5782
+ const { file: o, dialecteConfig: c, options: a, useCustomRecordsIds: f } = p, d = mo(o), g = await Vi({ databaseName: d, dialecteConfig: c });
5786
5783
  try {
5787
5784
  const v = c.database.tables.xmlElements.name;
5788
- if (await g.table(v).clear(), i.useBrowserApi && o.size !== 0 && await yo({
5785
+ if (await g.table(v).clear(), a.useBrowserApi && o.size !== 0 && await yo({
5789
5786
  file: o,
5790
5787
  databaseInstance: g,
5791
5788
  elementsTableName: v,
5792
5789
  dialecteConfig: c,
5793
5790
  options: {
5794
5791
  useCustomRecordsIds: f,
5795
- chunkSize: i.chunkSize,
5796
- batchSize: i.batchSize
5792
+ chunkSize: a.chunkSize,
5793
+ batchSize: a.batchSize
5797
5794
  }
5798
5795
  }), c.io.hooks?.afterImport) {
5799
5796
  const { creates: D, updates: R, deletes: q } = await c.io.hooks.afterImport();
5800
- D?.length && await Na({ databaseInstance: g, elementsTableName: v, records: D }), R?.length && await Gi({ databaseInstance: g, elementsTableName: v, updates: R }), q?.length && await $i({ databaseInstance: g, elementsTableName: v, ids: q });
5797
+ D?.length && await Oa({ databaseInstance: g, elementsTableName: v, records: D }), R?.length && await Gi({ databaseInstance: g, elementsTableName: v, updates: R }), q?.length && await $i({ databaseInstance: g, elementsTableName: v, ids: q });
5801
5798
  }
5802
5799
  return d;
5803
5800
  } catch (v) {
@@ -5807,13 +5804,13 @@ async function go(p) {
5807
5804
  }
5808
5805
  }
5809
5806
  async function yo(p) {
5810
- const { file: o, databaseInstance: c, elementsTableName: i, dialecteConfig: f, options: d } = p, g = o.stream().getReader(), v = to({
5807
+ const { file: o, databaseInstance: c, elementsTableName: a, dialecteConfig: f, options: d } = p, g = o.stream().getReader(), v = to({
5811
5808
  dialecteConfig: f,
5812
5809
  useCustomRecordsIds: d.useCustomRecordsIds
5813
5810
  }), D = new TextDecoder(), R = new Uint8Array(0);
5814
5811
  return await pr({
5815
5812
  databaseInstance: c,
5816
- elementsTableName: i,
5813
+ elementsTableName: a,
5817
5814
  reader: g,
5818
5815
  sax: v,
5819
5816
  textDecoder: D,
@@ -5822,13 +5819,13 @@ async function yo(p) {
5822
5819
  });
5823
5820
  }
5824
5821
  async function pr(p) {
5825
- const { databaseInstance: o, elementsTableName: c, reader: i, sax: f, textDecoder: d, buffer: g, options: v } = p, { chunkSize: D, batchSize: R } = v, { done: q, value: Y } = await i.read();
5822
+ const { databaseInstance: o, elementsTableName: c, reader: a, sax: f, textDecoder: d, buffer: g, options: v } = p, { chunkSize: D, batchSize: R } = v, { done: q, value: Y } = await a.read();
5826
5823
  if (q) {
5827
5824
  if (g.length > 0) {
5828
5825
  const fe = d.decode(g);
5829
5826
  f.parser.write(fe);
5830
5827
  }
5831
- return f.parser.close(), await ua({
5828
+ return f.parser.close(), await ca({
5832
5829
  databaseInstance: o,
5833
5830
  elementsTableName: c,
5834
5831
  sax: f,
@@ -5842,7 +5839,7 @@ async function pr(p) {
5842
5839
  const fe = Q.slice(0, D);
5843
5840
  Q = Q.slice(D);
5844
5841
  const j = d.decode(fe, { stream: !0 });
5845
- f.parser.write(j), await ua({
5842
+ f.parser.write(j), await ca({
5846
5843
  databaseInstance: o,
5847
5844
  elementsTableName: c,
5848
5845
  sax: f,
@@ -5851,23 +5848,23 @@ async function pr(p) {
5851
5848
  }
5852
5849
  return await pr({ ...p, buffer: Q });
5853
5850
  }
5854
- async function ua(p) {
5855
- const { databaseInstance: o, elementsTableName: c, sax: i, batchSize: f } = p;
5856
- if (i.getSize() >= f) {
5857
- const g = i.drainBatch(), v = Wi({
5851
+ async function ca(p) {
5852
+ const { databaseInstance: o, elementsTableName: c, sax: a, batchSize: f } = p;
5853
+ if (a.getSize() >= f) {
5854
+ const g = a.drainBatch(), v = Wi({
5858
5855
  currentBatch: g
5859
5856
  });
5860
- await Na({
5857
+ await Oa({
5861
5858
  databaseInstance: o,
5862
5859
  elementsTableName: c,
5863
5860
  records: v
5864
5861
  });
5865
5862
  }
5866
5863
  }
5867
- const Oa = "_temp-idb-id";
5868
- var Xt = { exports: {} }, xn = { exports: {} }, ca;
5864
+ const Aa = "_temp-idb-id";
5865
+ var Xt = { exports: {} }, Tn = { exports: {} }, la;
5869
5866
  function vo() {
5870
- return ca || (ca = 1, (function(p, o) {
5867
+ return la || (la = 1, (function(p, o) {
5871
5868
  Object.defineProperty(o, "__esModule", { value: !0 }), o.ParsingError = void 0;
5872
5869
  class c extends Error {
5873
5870
  constructor(H, Z) {
@@ -5875,7 +5872,7 @@ function vo() {
5875
5872
  }
5876
5873
  }
5877
5874
  o.ParsingError = c;
5878
- let i;
5875
+ let a;
5879
5876
  function f() {
5880
5877
  return D(!1) || Q() || Y() || q() || v();
5881
5878
  }
@@ -5895,7 +5892,7 @@ function vo() {
5895
5892
  }
5896
5893
  if (!Z)
5897
5894
  throw new c("Failed to parse XML", "Root Element not found");
5898
- if (i.xml.length !== 0)
5895
+ if (a.xml.length !== 0)
5899
5896
  throw new c("Failed to parse XML", "Not Well-Formed XML");
5900
5897
  return {
5901
5898
  declaration: te ? te.node : null,
@@ -5911,13 +5908,13 @@ function vo() {
5911
5908
  name: te[1],
5912
5909
  type: "ProcessingInstruction",
5913
5910
  content: ""
5914
- }, Z = i.xml.indexOf("?>");
5911
+ }, Z = a.xml.indexOf("?>");
5915
5912
  if (Z > -1)
5916
- H.content = i.xml.substring(0, Z).trim(), i.xml = i.xml.slice(Z);
5913
+ H.content = a.xml.substring(0, Z).trim(), a.xml = a.xml.slice(Z);
5917
5914
  else
5918
5915
  throw new c("Failed to parse XML", "ProcessingInstruction closing tag not found");
5919
5916
  return B(/\?>/), {
5920
- excluded: i.options.filter(H) === !1,
5917
+ excluded: a.options.filter(H) === !1,
5921
5918
  node: H
5922
5919
  };
5923
5920
  }
@@ -5930,7 +5927,7 @@ function vo() {
5930
5927
  name: H[1],
5931
5928
  attributes: {},
5932
5929
  children: []
5933
- }, de = te ? !1 : i.options.filter(Z) === !1;
5930
+ }, de = te ? !1 : a.options.filter(Z) === !1;
5934
5931
  for (; !(ue() || ie(">") || ie("?>") || ie("/>")); ) {
5935
5932
  const ge = fe();
5936
5933
  if (ge)
@@ -5947,10 +5944,10 @@ function vo() {
5947
5944
  let le = f();
5948
5945
  for (; le; )
5949
5946
  le.excluded || Z.children.push(le.node), le = f();
5950
- if (i.options.strictMode) {
5947
+ if (a.options.strictMode) {
5951
5948
  const ge = `</${Z.name}>`;
5952
- if (i.xml.startsWith(ge))
5953
- i.xml = i.xml.slice(ge.length);
5949
+ if (a.xml.startsWith(ge))
5950
+ a.xml = a.xml.slice(ge.length);
5954
5951
  else
5955
5952
  throw new c("Failed to parse XML", `Closing tag not matching "${ge}"`);
5956
5953
  } else
@@ -5968,21 +5965,21 @@ function vo() {
5968
5965
  content: te[0]
5969
5966
  };
5970
5967
  return {
5971
- excluded: i.options.filter(H) === !1,
5968
+ excluded: a.options.filter(H) === !1,
5972
5969
  node: H
5973
5970
  };
5974
5971
  }
5975
5972
  }
5976
5973
  function q() {
5977
- if (i.xml.startsWith("<![CDATA[")) {
5978
- const te = i.xml.indexOf("]]>");
5974
+ if (a.xml.startsWith("<![CDATA[")) {
5975
+ const te = a.xml.indexOf("]]>");
5979
5976
  if (te > -1) {
5980
5977
  const H = te + 3, Z = {
5981
5978
  type: "CDATA",
5982
- content: i.xml.substring(0, H)
5979
+ content: a.xml.substring(0, H)
5983
5980
  };
5984
- return i.xml = i.xml.slice(H), {
5985
- excluded: i.options.filter(Z) === !1,
5981
+ return a.xml = a.xml.slice(H), {
5982
+ excluded: a.options.filter(Z) === !1,
5986
5983
  node: Z
5987
5984
  };
5988
5985
  }
@@ -5996,7 +5993,7 @@ function vo() {
5996
5993
  content: te[0]
5997
5994
  };
5998
5995
  return {
5999
- excluded: i.options.filter(H) === !1,
5996
+ excluded: a.options.filter(H) === !1,
6000
5997
  node: H
6001
5998
  };
6002
5999
  }
@@ -6009,7 +6006,7 @@ function vo() {
6009
6006
  content: te[1]
6010
6007
  };
6011
6008
  return {
6012
- excluded: i.options.filter(H) === !1,
6009
+ excluded: a.options.filter(H) === !1,
6013
6010
  node: H
6014
6011
  };
6015
6012
  }
@@ -6026,35 +6023,35 @@ function vo() {
6026
6023
  return te.replace(/^['"]|['"]$/g, "");
6027
6024
  }
6028
6025
  function B(te) {
6029
- const H = i.xml.match(te);
6026
+ const H = a.xml.match(te);
6030
6027
  if (H)
6031
- return i.xml = i.xml.slice(H[0].length), H;
6028
+ return a.xml = a.xml.slice(H[0].length), H;
6032
6029
  }
6033
6030
  function ue() {
6034
- return i.xml.length === 0;
6031
+ return a.xml.length === 0;
6035
6032
  }
6036
6033
  function ie(te) {
6037
- return i.xml.indexOf(te) === 0;
6034
+ return a.xml.indexOf(te) === 0;
6038
6035
  }
6039
- function xe(te, H = {}) {
6036
+ function Te(te, H = {}) {
6040
6037
  te = te.trim();
6041
6038
  const Z = H.filter || (() => !0);
6042
- return i = {
6039
+ return a = {
6043
6040
  xml: te,
6044
6041
  options: Object.assign(Object.assign({}, H), { filter: Z, strictMode: H.strictMode === !0 })
6045
6042
  }, g();
6046
6043
  }
6047
- p.exports = xe, o.default = xe;
6048
- })(xn, xn.exports)), xn.exports;
6044
+ p.exports = Te, o.default = Te;
6045
+ })(Tn, Tn.exports)), Tn.exports;
6049
6046
  }
6050
- var la = Xt.exports, fa;
6047
+ var fa = Xt.exports, da;
6051
6048
  function bo() {
6052
- return fa || (fa = 1, (function(p, o) {
6053
- var c = la && la.__importDefault || function(j) {
6049
+ return da || (da = 1, (function(p, o) {
6050
+ var c = fa && fa.__importDefault || function(j) {
6054
6051
  return j && j.__esModule ? j : { default: j };
6055
6052
  };
6056
6053
  Object.defineProperty(o, "__esModule", { value: !0 });
6057
- const i = c(/* @__PURE__ */ vo());
6054
+ const a = c(/* @__PURE__ */ vo());
6058
6055
  function f(j) {
6059
6056
  if (!j.options.indentation && !j.options.lineSeparator)
6060
6057
  return;
@@ -6102,17 +6099,17 @@ function bo() {
6102
6099
  else {
6103
6100
  const ie = j.children;
6104
6101
  g(B, ">"), B.level++;
6105
- let xe = j.attributes["xml:space"] === "preserve" || ue, te = !1;
6106
- if (!xe && B.options.ignoredPaths && (te = R(B.path, B.options.ignoredPaths), xe = te), !xe && B.options.collapseContent) {
6102
+ let Te = j.attributes["xml:space"] === "preserve" || ue, te = !1;
6103
+ if (!Te && B.options.ignoredPaths && (te = R(B.path, B.options.ignoredPaths), Te = te), !Te && B.options.collapseContent) {
6107
6104
  let H = !1, Z = !1, de = !1;
6108
6105
  ie.forEach(function(le, ge) {
6109
6106
  le.type === "Text" ? (le.content.includes(`
6110
6107
  `) ? (Z = !0, le.content = le.content.trim()) : (ge === 0 || ge === ie.length - 1) && !ue && le.content.trim().length === 0 && (le.content = ""), (le.content.trim().length > 0 || ie.length === 1) && (H = !0)) : le.type === "CDATA" ? H = !0 : de = !0;
6111
- }), H && (!de || !Z) && (xe = !0);
6108
+ }), H && (!de || !Z) && (Te = !0);
6112
6109
  }
6113
6110
  ie.forEach(function(H) {
6114
- v(H, B, ue || xe);
6115
- }), B.level--, !ue && !xe && f(B), te && d(B), g(B, "</" + j.name + ">");
6111
+ v(H, B, ue || Te);
6112
+ }), B.level--, !ue && !Te && f(B), te && d(B), g(B, "</" + j.name + ">");
6116
6113
  }
6117
6114
  B.path.pop();
6118
6115
  }
@@ -6134,9 +6131,9 @@ function bo() {
6134
6131
  B.indentation = "indentation" in B ? B.indentation : " ", B.collapseContent = B.collapseContent === !0, B.lineSeparator = "lineSeparator" in B ? B.lineSeparator : `\r
6135
6132
  `, B.whiteSpaceAtEndOfSelfclosingTag = B.whiteSpaceAtEndOfSelfclosingTag === !0, B.throwOnFailure = B.throwOnFailure !== !1, B.attributeQuotes = "attributeQuotes" in B ? B.attributeQuotes : "double";
6136
6133
  try {
6137
- const ue = (0, i.default)(j, { filter: B.filter, strictMode: B.strictMode }), ie = { content: "", level: 0, options: B, path: [] };
6138
- return ue.declaration && Q(ue.declaration, ie), ue.children.forEach(function(xe) {
6139
- v(xe, ie, !1);
6134
+ const ue = (0, a.default)(j, { filter: B.filter, strictMode: B.strictMode }), ie = { content: "", level: 0, options: B, path: [] };
6135
+ return ue.declaration && Q(ue.declaration, ie), ue.children.forEach(function(Te) {
6136
+ v(Te, ie, !1);
6140
6137
  }), B.lineSeparator ? ie.content.replace(/\r\n/g, `
6141
6138
  `).replace(/\n/g, B.lineSeparator) : ie.content;
6142
6139
  } catch (ue) {
@@ -6149,17 +6146,17 @@ function bo() {
6149
6146
  })(Xt, Xt.exports)), Xt.exports;
6150
6147
  }
6151
6148
  var wo = /* @__PURE__ */ bo();
6152
- const _o = /* @__PURE__ */ xa(wo);
6149
+ const _o = /* @__PURE__ */ Na(wo);
6153
6150
  function Eo(p) {
6154
6151
  return _o(p);
6155
6152
  }
6156
- async function To(p) {
6157
- const { extension: o, xmlDocument: c, filename: i } = p, v = `<?xml version="1.0" encoding="UTF-8"?>
6153
+ async function xo(p) {
6154
+ const { extension: o, xmlDocument: c, filename: a } = p, v = `<?xml version="1.0" encoding="UTF-8"?>
6158
6155
  ` + new XMLSerializer().serializeToString(c), D = Eo(v), R = new Blob([D], { type: "application/xml" });
6159
6156
  if ("showSaveFilePicker" in window)
6160
6157
  try {
6161
6158
  const Y = await (await window.showSaveFilePicker({
6162
- suggestedName: i,
6159
+ suggestedName: a,
6163
6160
  types: [
6164
6161
  {
6165
6162
  description: `${o.replace(/^\./, "").toUpperCase()} Files`,
@@ -6173,35 +6170,35 @@ async function To(p) {
6173
6170
  }
6174
6171
  else {
6175
6172
  const q = URL.createObjectURL(R), Y = document.createElement("a");
6176
- Y.href = q, Y.download = i, document.body.appendChild(Y), Y.click(), Y.remove(), URL.revokeObjectURL(q);
6173
+ Y.href = q, Y.download = a, document.body.appendChild(Y), Y.click(), Y.remove(), URL.revokeObjectURL(q);
6177
6174
  }
6178
6175
  }
6179
6176
  async function Yo(p) {
6180
6177
  const {
6181
6178
  dialecteConfig: o,
6182
6179
  databaseName: c,
6183
- extension: i,
6180
+ extension: a,
6184
6181
  withDownload: f = !1,
6185
6182
  withDatabaseIds: d = !1
6186
- } = p, g = await xo({
6183
+ } = p, g = await To({
6187
6184
  databaseName: c,
6188
- extension: i,
6185
+ extension: a,
6189
6186
  dialecteConfig: o,
6190
6187
  withDatabaseIds: d
6191
6188
  });
6192
- return f && await To({
6193
- extension: i,
6189
+ return f && await xo({
6190
+ extension: a,
6194
6191
  xmlDocument: g.xmlDocument,
6195
6192
  filename: g.filename
6196
6193
  }), g;
6197
6194
  }
6198
- async function xo(p) {
6199
- const { databaseName: o, extension: c = "xml", dialecteConfig: i, withDatabaseIds: f } = p, d = new Je(o);
6195
+ async function To(p) {
6196
+ const { databaseName: o, extension: c = "xml", dialecteConfig: a, withDatabaseIds: f } = p, d = new Je(o);
6200
6197
  await d.open();
6201
6198
  try {
6202
6199
  const g = await No({
6203
6200
  databaseInstance: d,
6204
- dialecteConfig: i,
6201
+ dialecteConfig: a,
6205
6202
  withDatabaseIds: f
6206
6203
  });
6207
6204
  if (!g)
@@ -6215,7 +6212,7 @@ async function xo(p) {
6215
6212
  }
6216
6213
  }
6217
6214
  async function No(p) {
6218
- const { databaseInstance: o, dialecteConfig: c, withDatabaseIds: i } = p, { useBrowserApi: f = !0 } = c.io.exportOptions ?? { useBrowserApi: !0 }, d = c.rootElementName, g = c.namespaces.default, v = c.database.tables.xmlElements.name;
6215
+ const { databaseInstance: o, dialecteConfig: c, withDatabaseIds: a } = p, { useBrowserApi: f = !0 } = c.io.exportOptions ?? { useBrowserApi: !0 }, d = c.rootElementName, g = c.namespaces.default, v = c.database.tables.xmlElements.name;
6219
6216
  if (f) {
6220
6217
  const D = document.implementation.createDocument(
6221
6218
  g.uri,
@@ -6227,36 +6224,36 @@ async function No(p) {
6227
6224
  R.namespace.uri,
6228
6225
  R.tagName
6229
6226
  );
6230
- return q.setAttribute("xmlns", R.namespace.uri), R.attributes && Ca({
6227
+ return q.setAttribute("xmlns", R.namespace.uri), R.attributes && Da({
6231
6228
  dialecteConfig: c,
6232
6229
  document: D,
6233
6230
  element: q,
6234
6231
  attributes: R.attributes,
6235
6232
  tagName: R.tagName,
6236
6233
  isRoot: !0
6237
- }), Sa({ dialecteConfig: c, rootElement: q, namespace: R.namespace }), R.value && (q.textContent = R.value.trim()), i && q.setAttribute(Oa, R.id), D.appendChild(q), await Aa({
6234
+ }), Ia({ dialecteConfig: c, rootElement: q, namespace: R.namespace }), R.value && (q.textContent = R.value.trim()), a && q.setAttribute(Aa, R.id), D.appendChild(q), await Ca({
6238
6235
  databaseInstance: o,
6239
6236
  dialecteConfig: c,
6240
6237
  elementsTableName: v,
6241
- withDatabaseIds: i,
6238
+ withDatabaseIds: a,
6242
6239
  xmlDocument: D,
6243
6240
  databaseRecord: R,
6244
6241
  parentDomElement: q
6245
6242
  });
6246
6243
  }
6247
6244
  }
6248
- async function Aa(p) {
6245
+ async function Ca(p) {
6249
6246
  const {
6250
6247
  databaseInstance: o,
6251
6248
  dialecteConfig: c,
6252
- elementsTableName: i,
6249
+ elementsTableName: a,
6253
6250
  withDatabaseIds: f,
6254
6251
  xmlDocument: d,
6255
6252
  databaseRecord: g,
6256
6253
  parentDomElement: v
6257
6254
  } = p;
6258
6255
  if (!g.children) return;
6259
- const D = g.children.map((Q) => Q.id), q = await o.table(i).bulkGet(D);
6256
+ const D = g.children.map((Q) => Q.id), q = await o.table(a).bulkGet(D);
6260
6257
  Co({
6261
6258
  childrenRecords: q,
6262
6259
  parentRecord: g
@@ -6274,10 +6271,10 @@ async function Aa(p) {
6274
6271
  defaultNamespace: c.namespaces.default,
6275
6272
  withDatabaseIds: f
6276
6273
  });
6277
- v.appendChild(fe), await Aa({
6274
+ v.appendChild(fe), await Ca({
6278
6275
  databaseInstance: o,
6279
6276
  dialecteConfig: c,
6280
- elementsTableName: i,
6277
+ elementsTableName: a,
6281
6278
  withDatabaseIds: f,
6282
6279
  xmlDocument: d,
6283
6280
  databaseRecord: Q,
@@ -6287,53 +6284,53 @@ async function Aa(p) {
6287
6284
  return p.xmlDocument;
6288
6285
  }
6289
6286
  function Oo(p) {
6290
- const { dialecteConfig: o, document: c, record: i, defaultNamespace: f, withDatabaseIds: d } = p;
6287
+ const { dialecteConfig: o, document: c, record: a, defaultNamespace: f, withDatabaseIds: d } = p;
6291
6288
  let g;
6292
- return !(i.namespace.uri === f.uri) && i.namespace.prefix && i.namespace.prefix !== "xmlns" ? (Da({
6289
+ return !(a.namespace.uri === f.uri) && a.namespace.prefix && a.namespace.prefix !== "xmlns" ? (Sa({
6293
6290
  dialecteConfig: o,
6294
6291
  document: c,
6295
- namespace: i.namespace
6292
+ namespace: a.namespace
6296
6293
  }), g = c.createElementNS(
6297
- i.namespace.uri,
6298
- `${i.namespace.prefix}:${i.tagName}`
6299
- )) : g = c.createElementNS(i.namespace.uri, i.tagName), i.attributes && Ca({
6294
+ a.namespace.uri,
6295
+ `${a.namespace.prefix}:${a.tagName}`
6296
+ )) : g = c.createElementNS(a.namespace.uri, a.tagName), a.attributes && Da({
6300
6297
  dialecteConfig: o,
6301
6298
  document: c,
6302
6299
  element: g,
6303
- attributes: i.attributes,
6304
- tagName: i.tagName,
6300
+ attributes: a.attributes,
6301
+ tagName: a.tagName,
6305
6302
  isRoot: !1
6306
- }), i.value && (g.textContent = i.value.trim()), d && g.setAttribute(Oa, i.id), g;
6303
+ }), a.value && (g.textContent = a.value.trim()), d && g.setAttribute(Aa, a.id), g;
6307
6304
  }
6308
- function Ca(p) {
6309
- const { dialecteConfig: o, document: c, element: i, attributes: f, tagName: d, isRoot: g } = p;
6305
+ function Da(p) {
6306
+ const { dialecteConfig: o, document: c, element: a, attributes: f, tagName: d, isRoot: g } = p;
6310
6307
  for (const v of f)
6311
6308
  if (!Do(v) && !(!g && So({ dialecteConfig: o, tagName: d, attribute: v })))
6312
- if (Ia(v)) {
6309
+ if (Ra(v)) {
6313
6310
  const D = v.namespace?.prefix || "";
6314
6311
  if (!D) {
6315
- i.setAttribute(v.name, String(v.value));
6312
+ a.setAttribute(v.name, String(v.value));
6316
6313
  continue;
6317
6314
  }
6318
- g || Da({
6315
+ g || Sa({
6319
6316
  dialecteConfig: o,
6320
6317
  document: c,
6321
6318
  namespace: v.namespace
6322
6319
  });
6323
6320
  const R = v.name.includes(":") && v.name.split(":").pop() || v.name, q = `${D}:${R}`;
6324
- i.setAttributeNS(v.namespace.uri, q, String(v.value));
6325
- } else i.setAttribute(v.name, String(v.value));
6321
+ a.setAttributeNS(v.namespace.uri, q, String(v.value));
6322
+ } else a.setAttribute(v.name, String(v.value));
6326
6323
  }
6327
- function Da(p) {
6328
- const { dialecteConfig: o, document: c, namespace: i } = p, f = c.documentElement;
6329
- if (!f || !i.prefix || i.prefix === "xmlns") return;
6324
+ function Sa(p) {
6325
+ const { dialecteConfig: o, document: c, namespace: a } = p, f = c.documentElement;
6326
+ if (!f || !a.prefix || a.prefix === "xmlns") return;
6330
6327
  const d = "http://www.w3.org/2000/xmlns/";
6331
- f.getAttributeNS(d, i.prefix) === null && (f.setAttributeNS(d, `xmlns:${i.prefix}`, i.uri), Sa({ dialecteConfig: o, rootElement: f, namespace: i }));
6328
+ f.getAttributeNS(d, a.prefix) === null && (f.setAttributeNS(d, `xmlns:${a.prefix}`, a.uri), Ia({ dialecteConfig: o, rootElement: f, namespace: a }));
6332
6329
  }
6333
- function Sa(p) {
6334
- const { dialecteConfig: o, rootElement: c, namespace: i } = p, f = Object.entries(
6330
+ function Ia(p) {
6331
+ const { dialecteConfig: o, rootElement: c, namespace: a } = p, f = Object.entries(
6335
6332
  o.definition[o.rootElementName].attributes.details
6336
- ).filter(([g, v]) => i.uri === o.namespaces.default.uri ? !v.namespace : v.namespace?.prefix === i.prefix && v.namespace?.uri === i.uri);
6333
+ ).filter(([g, v]) => a.uri === o.namespaces.default.uri ? !v.namespace : v.namespace?.prefix === a.prefix && v.namespace?.uri === a.uri);
6337
6334
  if (f.length > 0)
6338
6335
  for (const [g, v] of f) {
6339
6336
  const D = g.includes(":") && g.split(":").pop() || g;
@@ -6346,12 +6343,12 @@ function Sa(p) {
6346
6343
  }
6347
6344
  }
6348
6345
  function Ao(p) {
6349
- const { parentTagName: o, availableChildren: c, childrenRecords: i } = p, f = [], d = new Set(c[o]);
6350
- if (!d.size) return i;
6346
+ const { parentTagName: o, availableChildren: c, childrenRecords: a } = p, f = [], d = new Set(c[o]);
6347
+ if (!d.size) return a;
6351
6348
  const g = /* @__PURE__ */ new Map(), v = [];
6352
6349
  for (const D of d)
6353
6350
  g.set(D, []);
6354
- for (const D of i)
6351
+ for (const D of a)
6355
6352
  d.has(D.tagName) ? g.get(D.tagName)?.push(D) : v.push(D);
6356
6353
  for (const D of d) {
6357
6354
  const R = g.get(D);
@@ -6360,37 +6357,37 @@ function Ao(p) {
6360
6357
  return f.push(...v), f;
6361
6358
  }
6362
6359
  function Co(p) {
6363
- const { childrenRecords: o, parentRecord: c } = p, i = o.map((f, d) => f === void 0 ? d : -1).filter((f) => f !== -1);
6364
- if (i.length > 0) {
6365
- const f = i.map((d) => {
6360
+ const { childrenRecords: o, parentRecord: c } = p, a = o.map((f, d) => f === void 0 ? d : -1).filter((f) => f !== -1);
6361
+ if (a.length > 0) {
6362
+ const f = a.map((d) => {
6366
6363
  const g = c.children[d];
6367
6364
  return `'${g.tagName}' (id: ${g.id})`;
6368
6365
  });
6369
6366
  throw new Error(
6370
- `Database corruption detected: Parent element '${c.tagName}' (id: ${c.id}) references ${i.length} non-existent child record(s): ${f.join(", ")}`
6367
+ `Database corruption detected: Parent element '${c.tagName}' (id: ${c.id}) references ${a.length} non-existent child record(s): ${f.join(", ")}`
6371
6368
  );
6372
6369
  }
6373
6370
  }
6374
- function Ia(p) {
6371
+ function Ra(p) {
6375
6372
  return p !== null && typeof p == "object" && "namespace" in p && !!p.namespace;
6376
6373
  }
6377
6374
  function Do(p) {
6378
- return !!(p.name === "xmlns" || p.name.startsWith("xmlns:") || Ia(p) && p.namespace?.prefix === "xmlns");
6375
+ return !!(p.name === "xmlns" || p.name.startsWith("xmlns:") || Ra(p) && p.namespace?.prefix === "xmlns");
6379
6376
  }
6380
6377
  function So(p) {
6381
- const { dialecteConfig: o, tagName: c, attribute: i } = p;
6378
+ const { dialecteConfig: o, tagName: c, attribute: a } = p;
6382
6379
  if (!o.elements.includes(c)) return !1;
6383
6380
  const f = o.definition[c];
6384
6381
  if (!f) return !1;
6385
- const d = f.attributes.details[i.name];
6386
- return !(!d || d.required || d.default === void 0 || String(i.value) !== d.default || f.attributes.identityFields?.includes(i.name));
6382
+ const d = f.attributes.details[a.name];
6383
+ return !(!d || d.required || d.default === void 0 || String(a.value) !== d.default || f.attributes.identityFields?.includes(a.name));
6387
6384
  }
6388
6385
  function Wo(p) {
6389
- const { config: o, storage: c, extensions: i, hooks: f } = p, d = ha({ base: i?.base, custom: i?.custom }), g = Ra(c, o);
6386
+ const { config: o, storage: c, extensions: a, hooks: f } = p, d = pa({ base: a?.base, custom: a?.custom }), g = ka(c, o);
6390
6387
  return new Ta(g, o, d, f);
6391
6388
  }
6392
6389
  async function zo(p) {
6393
- const { config: o, storage: c, extensions: i, hooks: f } = p, d = ha({ base: i?.base, custom: i?.custom }), g = Ra(c, o), v = o.definition[o.rootElementName], D = Object.entries(v?.attributes.details ?? {}).filter(([, R]) => R.required).map(([R, q]) => ({
6390
+ const { config: o, storage: c, extensions: a, hooks: f } = p, d = pa({ base: a?.base, custom: a?.custom }), g = ka(c, o), v = o.definition[o.rootElementName], D = Object.entries(v?.attributes.details ?? {}).filter(([, R]) => R.required).map(([R, q]) => ({
6394
6391
  name: R,
6395
6392
  value: q.fixed ?? q.default ?? "",
6396
6393
  ...q.namespace ? { namespace: q.namespace } : {}
@@ -6413,7 +6410,7 @@ async function zo(p) {
6413
6410
  }
6414
6411
  }), new Ta(g, o, d, f);
6415
6412
  }
6416
- function Ra(p, o) {
6413
+ function ka(p, o) {
6417
6414
  return p.type === "local" ? new Ui(p.databaseName, o) : p.store;
6418
6415
  }
6419
6416
  export {
@@ -6422,11 +6419,11 @@ export {
6422
6419
  $t as C,
6423
6420
  Ui as D,
6424
6421
  Wt as E,
6425
- wa as Q,
6426
- Oa as T,
6422
+ _a as Q,
6423
+ Aa as T,
6427
6424
  Ta as a,
6428
6425
  Bi as b,
6429
- Na as c,
6426
+ Oa as c,
6430
6427
  $i as d,
6431
6428
  Yo as e,
6432
6429
  Go as f,
@@ -6434,20 +6431,20 @@ export {
6434
6431
  zo as h,
6435
6432
  Xo as i,
6436
6433
  $o as j,
6437
- li as k,
6438
- ma as l,
6439
- fi as m,
6434
+ fi as k,
6435
+ ga as l,
6436
+ Qr as m,
6440
6437
  Eo as n,
6441
6438
  Wo as o,
6442
- Zr as p,
6443
- Jr as q,
6444
- ea as r,
6445
- ta as s,
6446
- ui as t,
6447
- ci as u,
6439
+ Jr as p,
6440
+ ea as q,
6441
+ ta as r,
6442
+ na as s,
6443
+ ci as t,
6444
+ li as u,
6448
6445
  mo as v,
6449
6446
  ve as w,
6450
6447
  _o as x,
6451
- pa as y,
6448
+ ma as y,
6452
6449
  mr as z
6453
6450
  };