@dialecte/core 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { t as $e, i as we } from "./index-DWV6tSGF.js";
2
- import { g as vr, l as ce, o as br, k as pr, s as yo, t as vo, C as gi, m as bo } from "./merge-extensions-dj7By9gG.js";
2
+ import { g as vr, l as ce, o as br, k as pr, s as vo, t as bo, C as yi, m as wo } from "./merge-extensions-dj7By9gG.js";
3
3
  function gr(m, r) {
4
4
  if (!m) return {};
5
5
  const s = {};
@@ -13,7 +13,7 @@ function gr(m, r) {
13
13
  }
14
14
  return s;
15
15
  }
16
- function wo(m) {
16
+ function _o(m) {
17
17
  const { stagedOperations: r, tagName: s, id: o } = m;
18
18
  for (let f = r.length - 1; f >= 0; f--) {
19
19
  const d = r[f];
@@ -62,7 +62,7 @@ function wo(m) {
62
62
  }
63
63
  }
64
64
  }
65
- function _o(m) {
65
+ function Eo(m) {
66
66
  const { rawRecords: r, stagedOperations: s, tagName: o } = m, f = new Map(
67
67
  r.map((d) => [d.id, { ...d, status: "unchanged" }])
68
68
  );
@@ -78,7 +78,7 @@ function _o(m) {
78
78
  async function me(m) {
79
79
  const { context: r, ref: s } = m;
80
80
  if (r.stagedOperations.length > 0) {
81
- const f = wo({
81
+ const f = _o({
82
82
  stagedOperations: r.stagedOperations,
83
83
  tagName: s.tagName,
84
84
  id: s.id
@@ -111,9 +111,9 @@ async function Sn(m) {
111
111
  );
112
112
  for (const f of o)
113
113
  Ht(r) && r.recordCache.set(f.id, f);
114
- return _o({ rawRecords: o, stagedOperations: r.stagedOperations, tagName: s });
114
+ return Eo({ rawRecords: o, stagedOperations: r.stagedOperations, tagName: s });
115
115
  }
116
- async function yi(m) {
116
+ async function vi(m) {
117
117
  const { context: r, ref: s, tagName: o } = m, f = await me({ context: r, ref: s });
118
118
  if (!f) return;
119
119
  const d = f.children.find((D) => D.tagName === o);
@@ -130,7 +130,7 @@ async function yi(m) {
130
130
  if (K) return me({ context: r, ref: K });
131
131
  }
132
132
  }
133
- async function vi(m) {
133
+ async function bi(m) {
134
134
  const { context: r, ref: s, tagName: o } = m, f = await me({ context: r, ref: s });
135
135
  if (!f) return [];
136
136
  const d = f.children.filter((B) => B.tagName === o).map((B) => ({ tagName: o, id: B.id }));
@@ -149,7 +149,7 @@ async function vi(m) {
149
149
  (B) => B !== void 0
150
150
  ) : [];
151
151
  }
152
- async function bi(m) {
152
+ async function wi(m) {
153
153
  const { context: r, ref: s, options: o } = m, f = o?.depth ?? 1 / 0, d = o?.stopAtTagName, v = o?.order ?? "bottom-up", g = [];
154
154
  let D = await me({ context: r, ref: s });
155
155
  for (; D?.parent && g.length < f; ) {
@@ -184,13 +184,13 @@ function xt(m) {
184
184
  return !0;
185
185
  }
186
186
  async function wr(m) {
187
- const { context: r, ref: s, options: o } = m, { collect: f, omit: d } = o, v = Eo(d), g = xo(f), D = /* @__PURE__ */ new Map();
187
+ const { context: r, ref: s, options: o } = m, { collect: f, omit: d } = o, v = xo(d), g = To(f), D = /* @__PURE__ */ new Map();
188
188
  for (const K of g.allTags)
189
189
  D.set(K, /* @__PURE__ */ new Map());
190
190
  const R = await me({ context: r, ref: s });
191
- return R && (g.mode === "flat" ? await No({ context: r, rootId: R.id, collectSpec: g, omitSpec: v, collected: D }) : await Ei({ context: r, record: R, pathNodes: g.paths, omitSpec: v, collected: D })), ii(D);
191
+ return R && (g.mode === "flat" ? await Co({ context: r, rootId: R.id, collectSpec: g, omitSpec: v, collected: D }) : await xi({ context: r, record: R, pathNodes: g.paths, omitSpec: v, collected: D })), ii(D);
192
192
  }
193
- function Eo(m) {
193
+ function xo(m) {
194
194
  const r = /* @__PURE__ */ new Set(), s = [];
195
195
  if (!m) return { unconditional: r, conditional: s };
196
196
  for (const o of m)
@@ -213,7 +213,7 @@ function xr(m) {
213
213
  return !0;
214
214
  return !1;
215
215
  }
216
- function xo(m) {
216
+ function To(m) {
217
217
  if (typeof m == "string")
218
218
  return { mode: "flat", targets: [{ tagName: m }], allTags: /* @__PURE__ */ new Set([m]) };
219
219
  if (Array.isArray(m)) {
@@ -227,19 +227,19 @@ function xo(m) {
227
227
  return { mode: "flat", targets: o, allTags: f };
228
228
  }
229
229
  const r = /* @__PURE__ */ new Set();
230
- return { mode: "path", paths: wi(m, r), allTags: r };
230
+ return { mode: "path", paths: _i(m, r), allTags: r };
231
231
  }
232
- function wi(m, r) {
232
+ function _i(m, r) {
233
233
  const s = [];
234
234
  for (const [o, f] of Object.entries(m)) {
235
235
  if (o === "where") continue;
236
236
  r.add(o);
237
- const d = To({ tagName: o, value: f, allTags: r });
237
+ const d = No({ tagName: o, value: f, allTags: r });
238
238
  d && s.push(d);
239
239
  }
240
240
  return s;
241
241
  }
242
- function To(m) {
242
+ function No(m) {
243
243
  const { tagName: r, value: s, allTags: o } = m;
244
244
  if (s === !0)
245
245
  return { tagName: r, where: void 0, children: [], isLeaf: !0 };
@@ -250,10 +250,10 @@ function To(m) {
250
250
  const g = {};
251
251
  for (const R of v)
252
252
  g[R] = f[R];
253
- const D = wi(g, o);
253
+ const D = _i(g, o);
254
254
  return { tagName: r, where: d, children: D, isLeaf: !1 };
255
255
  }
256
- async function No(m) {
256
+ async function Co(m) {
257
257
  const { context: r, rootId: s, collectSpec: o, omitSpec: f, collected: d } = m;
258
258
  for (const v of o.targets) {
259
259
  if (f.unconditional.has(v.tagName)) continue;
@@ -262,17 +262,17 @@ async function No(m) {
262
262
  tagName: v.tagName
263
263
  });
264
264
  for (const D of g)
265
- _i({ record: D, where: v.where }) && (xr({ record: D, omitSpec: f }) || await Co({ context: r, record: D, rootId: s, omitSpec: f }) && d.get(v.tagName).set(D.id, D));
265
+ Ei({ record: D, where: v.where }) && (xr({ record: D, omitSpec: f }) || await Oo({ context: r, record: D, rootId: s, omitSpec: f }) && d.get(v.tagName).set(D.id, D));
266
266
  }
267
267
  }
268
- function _i(m) {
268
+ function Ei(m) {
269
269
  const { record: r, where: s } = m;
270
270
  return s ? xt({
271
271
  record: r,
272
272
  attributeFilter: s
273
273
  }) : !0;
274
274
  }
275
- async function Co(m) {
275
+ async function Oo(m) {
276
276
  const { context: r, record: s, rootId: o, omitSpec: f } = m;
277
277
  if (s.id === o) return !0;
278
278
  let d = s;
@@ -285,12 +285,12 @@ async function Co(m) {
285
285
  }
286
286
  return !1;
287
287
  }
288
- async function Ei(m) {
288
+ async function xi(m) {
289
289
  const { context: r, record: s, pathNodes: o, omitSpec: f, collected: d } = m;
290
290
  if (!s.children?.length) return;
291
291
  const v = new Set(o.map((g) => g.tagName));
292
292
  for (const g of o) {
293
- const D = await Oo({
293
+ const D = await Ao({
294
294
  context: r,
295
295
  record: s,
296
296
  tagName: g.tagName,
@@ -299,7 +299,7 @@ async function Ei(m) {
299
299
  stopAtTagNames: v
300
300
  });
301
301
  for (const R of D)
302
- d.get(g.tagName).set(R.id, R), !g.isLeaf && g.children.length > 0 && await Ei({
302
+ d.get(g.tagName).set(R.id, R), !g.isLeaf && g.children.length > 0 && await xi({
303
303
  context: r,
304
304
  record: R,
305
305
  pathNodes: g.children,
@@ -308,14 +308,14 @@ async function Ei(m) {
308
308
  });
309
309
  }
310
310
  }
311
- async function Oo(m) {
311
+ async function Ao(m) {
312
312
  const { context: r, record: s, tagName: o, where: f, omitSpec: d, stopAtTagNames: v } = m, g = [];
313
313
  if (!s.children?.length) return g;
314
314
  const D = [], R = await ri({ context: r, record: s, omitSpec: d });
315
315
  for (D.push(...R); D.length > 0; ) {
316
316
  const K = D.shift();
317
317
  if (K.tagName === o) {
318
- _i({ record: K, where: f }) && g.push(K);
318
+ Ei({ record: K, where: f }) && g.push(K);
319
319
  continue;
320
320
  }
321
321
  if (!(v.has(K.tagName) && K.tagName !== o) && K.children?.length) {
@@ -341,41 +341,41 @@ function ii(m) {
341
341
  r[s] = Array.from(o.values());
342
342
  return r;
343
343
  }
344
- async function xi(m) {
344
+ async function Ti(m) {
345
345
  const { context: r, ref: s, name: o } = m;
346
346
  return ((await me({ context: r, ref: s }))?.attributes ?? []).find((g) => g.name === o)?.value ?? "";
347
347
  }
348
- async function Ti(m) {
348
+ async function Ni(m) {
349
349
  const { context: r, ref: s, name: o } = m;
350
350
  return ((await me({ context: r, ref: s }))?.attributes ?? []).find((g) => g.name === o);
351
351
  }
352
- async function Ni(m) {
352
+ async function Ci(m) {
353
353
  const { context: r, ref: s } = m;
354
354
  return ((await me({ context: r, ref: s }))?.attributes ?? []).reduce(
355
355
  (d, v) => (d[v.name] = v.value ?? "", d),
356
356
  {}
357
357
  );
358
358
  }
359
- async function Ci(m) {
359
+ async function Oi(m) {
360
360
  const { context: r, ref: s } = m;
361
361
  return (await me({ context: r, ref: s }))?.attributes ?? [];
362
362
  }
363
- async function Oi(m) {
363
+ async function Ai(m) {
364
364
  const { context: r, ref: s, options: o = {}, dialecteConfig: f } = m, { select: d, omit: v, unwrap: g } = o, D = await me({ context: r, ref: s });
365
365
  we(D, {
366
366
  detail: "No record found for provided ref",
367
367
  key: "ELEMENT_NOT_FOUND"
368
368
  });
369
- const R = Ao(v), K = await Ai({
369
+ const R = Do(v), K = await Di({
370
370
  context: r,
371
371
  record: D,
372
372
  select: d,
373
373
  compiledOmit: R,
374
374
  dialecteConfig: f
375
375
  });
376
- return K ? g ? Ko({ tree: K, unwrapTagNames: g }) : K : br({ record: D });
376
+ return K ? g ? qo({ tree: K, unwrapTagNames: g }) : K : br({ record: D });
377
377
  }
378
- function Ao(m) {
378
+ function Do(m) {
379
379
  const r = /* @__PURE__ */ new Set(), s = [];
380
380
  if (!m) return { unconditional: r, conditional: s };
381
381
  for (const o of m) {
@@ -396,11 +396,11 @@ function Ao(m) {
396
396
  }
397
397
  return { unconditional: r, conditional: s };
398
398
  }
399
- async function Ai(m) {
399
+ async function Di(m) {
400
400
  const { context: r, record: s, select: o, compiledOmit: f, dialecteConfig: d } = m;
401
- if (Do({ record: s, compiledOmit: f }))
401
+ if (So({ record: s, compiledOmit: f }))
402
402
  return br({ record: s });
403
- const v = await ko({
403
+ const v = await Ro({
404
404
  context: r,
405
405
  record: s,
406
406
  select: o,
@@ -408,14 +408,14 @@ async function Ai(m) {
408
408
  dialecteConfig: d
409
409
  }), D = (await Promise.all(
410
410
  v.map(
411
- ({ record: R, select: K }) => Ai({ context: r, record: R, select: K, compiledOmit: f, dialecteConfig: d })
411
+ ({ record: R, select: K }) => Di({ context: r, record: R, select: K, compiledOmit: f, dialecteConfig: d })
412
412
  )
413
413
  )).filter(
414
414
  (R) => R !== null
415
415
  );
416
416
  return br({ record: s, tree: D });
417
417
  }
418
- function Do(m) {
418
+ function So(m) {
419
419
  const { record: r, compiledOmit: s } = m;
420
420
  return s.conditional.some(
421
421
  (o) => o.scope === "children" && o.tagName === r.tagName && xt({
@@ -424,7 +424,7 @@ function Do(m) {
424
424
  })
425
425
  );
426
426
  }
427
- function So(m) {
427
+ function ko(m) {
428
428
  const { record: r, compiledOmit: s } = m;
429
429
  return s.unconditional.has(r.tagName) ? !0 : s.conditional.some(
430
430
  (o) => o.scope === "self" && o.tagName === r.tagName && xt({
@@ -433,16 +433,16 @@ function So(m) {
433
433
  })
434
434
  );
435
435
  }
436
- async function ko(m) {
436
+ async function Ro(m) {
437
437
  const { context: r, record: s, select: o, compiledOmit: f, dialecteConfig: d } = m;
438
438
  if (!s.children?.length) return [];
439
- const v = o ? Po(o) : void 0;
439
+ const v = o ? Fo(o) : void 0;
440
440
  if (v && o && d && o.recursive !== !1) {
441
441
  const B = s.tagName, Y = d.children[B], oe = o[B] !== void 0;
442
442
  Y?.includes(B) && !oe && v.add(B);
443
443
  }
444
444
  const g = s.children.filter(
445
- (B) => Ro({ tagName: B.tagName, compiledOmit: f, selectKeys: v })
445
+ (B) => Io({ tagName: B.tagName, compiledOmit: f, selectKeys: v })
446
446
  );
447
447
  if (!g.length) return [];
448
448
  const K = (await Promise.all(
@@ -454,21 +454,21 @@ async function ko(m) {
454
454
  )
455
455
  )).filter(
456
456
  (B) => B !== void 0
457
- ).filter((B) => !So({ record: B, compiledOmit: f }));
458
- return Fo({ children: K, select: o, record: s, dialecteConfig: d });
457
+ ).filter((B) => !ko({ record: B, compiledOmit: f }));
458
+ return Bo({ children: K, select: o, record: s, dialecteConfig: d });
459
459
  }
460
- function Ro(m) {
460
+ function Io(m) {
461
461
  const { tagName: r, compiledOmit: s, selectKeys: o } = m;
462
462
  return !(s.unconditional.has(r) || o && !o.has(r));
463
463
  }
464
- const Io = /* @__PURE__ */ new Set(["where", "recursive"]);
465
- function Po(m) {
464
+ const Po = /* @__PURE__ */ new Set(["where", "recursive"]);
465
+ function Fo(m) {
466
466
  const r = /* @__PURE__ */ new Set();
467
467
  for (const s of Object.keys(m))
468
- Io.has(s) || r.add(s);
468
+ Po.has(s) || r.add(s);
469
469
  return r;
470
470
  }
471
- function Fo(m) {
471
+ function Bo(m) {
472
472
  const { children: r, select: s, record: o, dialecteConfig: f } = m;
473
473
  if (!s)
474
474
  return r.map((v) => ({ record: v, select: void 0 }));
@@ -476,7 +476,7 @@ function Fo(m) {
476
476
  for (const v of r) {
477
477
  const g = s[v.tagName];
478
478
  if (g === void 0 && v.tagName === o.tagName) {
479
- const R = Bo({ child: v, select: s, dialecteConfig: f });
479
+ const R = jo({ child: v, select: s, dialecteConfig: f });
480
480
  if (R) {
481
481
  d.push(R);
482
482
  continue;
@@ -487,12 +487,12 @@ function Fo(m) {
487
487
  d.push({ record: v, select: void 0 });
488
488
  continue;
489
489
  }
490
- const D = jo({ child: v, entry: g, parentRecord: o });
490
+ const D = Mo({ child: v, entry: g, parentRecord: o });
491
491
  D && d.push(D);
492
492
  }
493
493
  return d;
494
494
  }
495
- function Bo(m) {
495
+ function jo(m) {
496
496
  const { child: r, select: s, dialecteConfig: o } = m;
497
497
  if (!(!o || s.recursive === !1 || !o.children[r.tagName]?.includes(r.tagName)) && !(s.where && !xt({
498
498
  record: r,
@@ -500,7 +500,7 @@ function Bo(m) {
500
500
  })))
501
501
  return { record: r, select: s };
502
502
  }
503
- function jo(m) {
503
+ function Mo(m) {
504
504
  const { child: r, entry: s, parentRecord: o } = m, f = s;
505
505
  if (!(f.where && !xt({
506
506
  record: r,
@@ -510,21 +510,21 @@ function jo(m) {
510
510
  const d = f.recursive === !0 ? !0 : f.recursive - 1;
511
511
  return d === 0 ? void 0 : { record: r, select: { ...f, recursive: d } };
512
512
  }
513
- return f.recursive ? { record: r, select: Mo(f, r.tagName) } : r.tagName === o.tagName ? { record: r, select: { ...f, recursive: !1 } } : { record: r, select: f };
513
+ return f.recursive ? { record: r, select: Ko(f, r.tagName) } : r.tagName === o.tagName ? { record: r, select: { ...f, recursive: !1 } } : { record: r, select: f };
514
514
  }
515
515
  }
516
- function Mo(m, r) {
516
+ function Ko(m, r) {
517
517
  const s = m[r];
518
518
  return m;
519
519
  }
520
- function Ko(m) {
520
+ function qo(m) {
521
521
  const { tree: r, unwrapTagNames: s } = m;
522
522
  function o(f) {
523
523
  return f.flatMap((d) => s.includes(d.tagName) ? o(d.tree) : [{ ...d, tree: o(d.tree) }]);
524
524
  }
525
525
  return { ...r, tree: o(r.tree) };
526
526
  }
527
- class Di {
527
+ class Si {
528
528
  constructor(r, s) {
529
529
  this.getContext = r, this.dialecteConfig = s;
530
530
  }
@@ -541,14 +541,14 @@ class Di {
541
541
  });
542
542
  }
543
543
  async getChild(r, s) {
544
- return yi({
544
+ return vi({
545
545
  context: this.getContext(),
546
546
  ref: ce(r),
547
547
  tagName: s
548
548
  });
549
549
  }
550
550
  async getChildren(r, s) {
551
- return vi({
551
+ return bi({
552
552
  context: this.getContext(),
553
553
  ref: ce(r),
554
554
  tagName: s
@@ -562,14 +562,14 @@ class Di {
562
562
  }
563
563
  async getAttribute(r, s) {
564
564
  const o = ce(r), { fullObject: f } = s;
565
- return f ? Ti({ context: this.getContext(), ref: o, ...s }) : xi({ context: this.getContext(), ref: o, ...s });
565
+ return f ? Ni({ context: this.getContext(), ref: o, ...s }) : Ti({ context: this.getContext(), ref: o, ...s });
566
566
  }
567
567
  async getAttributes(r, s) {
568
568
  const o = ce(r), { fullObject: f } = s || {};
569
- return f ? Ci({ context: this.getContext(), ref: o, ...s }) : Ni({ context: this.getContext(), ref: o, ...s });
569
+ return f ? Oi({ context: this.getContext(), ref: o, ...s }) : Ci({ context: this.getContext(), ref: o, ...s });
570
570
  }
571
571
  async getTree(r) {
572
- return Oi({
572
+ return Ai({
573
573
  context: this.getContext(),
574
574
  ref: ce(r),
575
575
  dialecteConfig: this.dialecteConfig
@@ -584,7 +584,7 @@ class Di {
584
584
  });
585
585
  }
586
586
  async findAncestors(r) {
587
- return r ? bi({
587
+ return r ? wi({
588
588
  context: this.getContext(),
589
589
  ref: ce(r)
590
590
  }) : [];
@@ -597,13 +597,13 @@ class Di {
597
597
  });
598
598
  }
599
599
  }
600
- class Si {
600
+ class ki {
601
601
  constructor(r, s, o) {
602
602
  this.store = r, this.dialecteConfig = s, this.documentId = o;
603
603
  }
604
604
  //== Untyped namespace
605
605
  get any() {
606
- return this._any ??= new Di(() => this.context, this.dialecteConfig);
606
+ return this._any ??= new Si(() => this.context, this.dialecteConfig);
607
607
  }
608
608
  //== Context
609
609
  /**
@@ -704,7 +704,7 @@ class Si {
704
704
  */
705
705
  async getChild(r, s) {
706
706
  if (r)
707
- return yi({ context: this.context, ref: ce(r), tagName: s });
707
+ return vi({ context: this.context, ref: ce(r), tagName: s });
708
708
  }
709
709
  /**
710
710
  * Get all direct children of an element matching a given tag name.
@@ -719,7 +719,7 @@ class Si {
719
719
  * ```
720
720
  */
721
721
  async getChildren(r, s) {
722
- return r ? vi({ context: this.context, ref: ce(r), tagName: s }) : [];
722
+ return r ? bi({ context: this.context, ref: ce(r), tagName: s }) : [];
723
723
  }
724
724
  /**
725
725
  * Get all records of a given tag name.
@@ -765,7 +765,7 @@ class Si {
765
765
  * ```
766
766
  */
767
767
  async findAncestors(r, s) {
768
- return r ? bi({ context: this.context, ref: ce(r), options: s }) : [];
768
+ return r ? wi({ context: this.context, ref: ce(r), options: s }) : [];
769
769
  }
770
770
  /**
771
771
  * Build a full tree structure from an element down.
@@ -780,7 +780,7 @@ class Si {
780
780
  * ```
781
781
  */
782
782
  async getTree(r, s) {
783
- return Oi({
783
+ return Ai({
784
784
  context: this.context,
785
785
  ref: ce(r),
786
786
  options: s,
@@ -789,11 +789,11 @@ class Si {
789
789
  }
790
790
  async getAttribute(r, s) {
791
791
  const o = ce(r), { fullObject: f } = s;
792
- return f ? Ti({ context: this.context, ref: o, ...s }) : xi({ context: this.context, ref: o, ...s });
792
+ return f ? Ni({ context: this.context, ref: o, ...s }) : Ti({ context: this.context, ref: o, ...s });
793
793
  }
794
794
  async getAttributes(r, s) {
795
795
  const o = ce(r), { fullObject: f } = s || {};
796
- return f ? Ci({ context: this.context, ref: o, ...s }) : Ni({ context: this.context, ref: o, ...s });
796
+ return f ? Oi({ context: this.context, ref: o, ...s }) : Ci({ context: this.context, ref: o, ...s });
797
797
  }
798
798
  //== Find queries
799
799
  /**
@@ -855,7 +855,7 @@ async function kn(m) {
855
855
  key: "ELEMENT_NOT_FOUND",
856
856
  ref: d
857
857
  });
858
- const oe = yo({
858
+ const oe = vo({
859
859
  dialecteConfig: r,
860
860
  hooks: s,
861
861
  record: {
@@ -892,8 +892,8 @@ async function kn(m) {
892
892
  }
893
893
  return oe;
894
894
  }
895
- async function ki(m) {
896
- const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, record: v, cumulativeCloneMappings: g } = m, D = [], R = await Ri({
895
+ async function Ri(m) {
896
+ const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, record: v, cumulativeCloneMappings: g } = m, D = [], R = await Ii({
897
897
  dialecteConfig: r,
898
898
  hooks: s,
899
899
  context: o,
@@ -914,7 +914,7 @@ async function ki(m) {
914
914
  mappings: D
915
915
  };
916
916
  }
917
- async function Ri(m) {
917
+ async function Ii(m) {
918
918
  const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, record: v, mappings: g } = m;
919
919
  let D = !0, R = v;
920
920
  if (s?.beforeClone) {
@@ -942,7 +942,7 @@ async function Ri(m) {
942
942
  target: ce(K)
943
943
  });
944
944
  for (const Y of R.tree)
945
- await Ri({
945
+ await Ii({
946
946
  dialecteConfig: r,
947
947
  hooks: s,
948
948
  context: o,
@@ -953,7 +953,7 @@ async function Ri(m) {
953
953
  });
954
954
  return K;
955
955
  }
956
- async function Ii(m) {
956
+ async function Pi(m) {
957
957
  const { hooks: r, context: s, query: o, ref: f } = m, d = await me({ context: s, ref: f });
958
958
  if (we(d, {
959
959
  detail: `Record not found (tagName=${f.tagName}, id=${f.id})`,
@@ -966,7 +966,7 @@ async function Ii(m) {
966
966
  const R = await r.beforeDelete({ record: d, query: o });
967
967
  Tr({ context: s, operations: R });
968
968
  }
969
- await Pi({ context: s, record: d }), et({ context: s, status: "deleted", record: d });
969
+ await Fi({ context: s, record: d }), et({ context: s, status: "deleted", record: d });
970
970
  const v = ce(d.parent), g = await me({ context: s, ref: v });
971
971
  we(g, {
972
972
  detail: `Parent record not found (tagName=${d.parent.tagName}, id=${d.parent.id})`,
@@ -978,15 +978,15 @@ async function Ii(m) {
978
978
  };
979
979
  return et({ context: s, status: "updated", oldRecord: g, newRecord: D }), D;
980
980
  }
981
- async function Pi(m) {
981
+ async function Fi(m) {
982
982
  const { context: r, record: s } = m;
983
983
  for (const o of s.children) {
984
984
  const f = ce(o), d = await me({ context: r, ref: f });
985
- d && (d.children.length > 0 && await Pi({ context: r, record: d }), et({ context: r, status: "deleted", record: d }));
985
+ d && (d.children.length > 0 && await Fi({ context: r, record: d }), et({ context: r, status: "deleted", record: d }));
986
986
  }
987
987
  }
988
- async function Fi(m) {
989
- const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, params: v } = m, g = qo(v.attributes);
988
+ async function Bi(m) {
989
+ const { dialecteConfig: r, hooks: s, context: o, query: f, parentRef: d, params: v } = m, g = Lo(v.attributes);
990
990
  if (g) {
991
991
  const [D] = await Er({
992
992
  context: o,
@@ -1007,11 +1007,11 @@ async function Fi(m) {
1007
1007
  params: v
1008
1008
  });
1009
1009
  }
1010
- function qo(m) {
1010
+ function Lo(m) {
1011
1011
  const r = Array.isArray(m) ? Object.fromEntries(m.map((o) => [o.name, o.value])) : m;
1012
1012
  return Object.values(r).some((o) => o !== void 0 && o !== "") ? r : void 0;
1013
1013
  }
1014
- async function Bi(m) {
1014
+ async function ji(m) {
1015
1015
  const { dialecteConfig: r, hooks: s, context: o, query: f, ref: d, params: v } = m, { attributes: g, value: D } = v, R = await me({ context: o, ref: d });
1016
1016
  we(R, {
1017
1017
  detail: `Record not found (tagName=${d.tagName}, id=${d.id})`,
@@ -1020,7 +1020,7 @@ async function Bi(m) {
1020
1020
  });
1021
1021
  let K = R.attributes;
1022
1022
  if (g) {
1023
- const Y = vo({
1023
+ const Y = bo({
1024
1024
  dialecteConfig: r,
1025
1025
  tagName: R.tagName,
1026
1026
  attributes: g
@@ -1046,7 +1046,7 @@ async function Bi(m) {
1046
1046
  }
1047
1047
  return B;
1048
1048
  }
1049
- class Lo extends Di {
1049
+ class Uo extends Si {
1050
1050
  constructor(r, s, o, f) {
1051
1051
  super(r, s), this.hooks = o, this.query = f;
1052
1052
  }
@@ -1067,7 +1067,7 @@ class Lo extends Di {
1067
1067
  });
1068
1068
  }
1069
1069
  async ensureChild(r, s) {
1070
- return Fi({
1070
+ return Bi({
1071
1071
  context: this.getContext(),
1072
1072
  parentRef: ce(r),
1073
1073
  params: {
@@ -1083,7 +1083,7 @@ class Lo extends Di {
1083
1083
  });
1084
1084
  }
1085
1085
  async update(r, s) {
1086
- return Bi({
1086
+ return ji({
1087
1087
  context: this.getContext(),
1088
1088
  ref: ce(r),
1089
1089
  params: {
@@ -1096,7 +1096,7 @@ class Lo extends Di {
1096
1096
  });
1097
1097
  }
1098
1098
  async delete(r) {
1099
- return Ii({
1099
+ return Pi({
1100
1100
  context: this.getContext(),
1101
1101
  ref: ce(r),
1102
1102
  hooks: this.hooks,
@@ -1104,7 +1104,7 @@ class Lo extends Di {
1104
1104
  });
1105
1105
  }
1106
1106
  async deepClone(r, s) {
1107
- return await ki({
1107
+ return await Ri({
1108
1108
  dialecteConfig: this.dialecteConfig,
1109
1109
  hooks: this.hooks,
1110
1110
  context: this.getContext(),
@@ -1115,7 +1115,7 @@ class Lo extends Di {
1115
1115
  });
1116
1116
  }
1117
1117
  }
1118
- function Uo(m) {
1118
+ function Vo(m) {
1119
1119
  const r = /* @__PURE__ */ new Map();
1120
1120
  for (const o of m) {
1121
1121
  const f = (o.status === "deleted" ? o.oldRecord : o.newRecord).id, d = r.get(f);
@@ -1144,8 +1144,8 @@ function Uo(m) {
1144
1144
  deletes: s.filter((o) => o.status === "deleted")
1145
1145
  };
1146
1146
  }
1147
- async function Vo(m) {
1148
- const { stagedOperations: r, store: s, documentId: o, documentState: f } = m, { creates: d, updates: v, deletes: g } = Uo(r), D = d.length + v.length + g.length;
1147
+ async function $o(m) {
1148
+ const { stagedOperations: r, store: s, documentId: o, documentState: f } = m, { creates: d, updates: v, deletes: g } = Vo(r), D = d.length + v.length + g.length;
1149
1149
  f.loading = !0, f.progress = { message: "Committing changes...", current: 0, total: D };
1150
1150
  try {
1151
1151
  await s.commit({
@@ -1162,13 +1162,13 @@ async function Vo(m) {
1162
1162
  }
1163
1163
  f.lastUpdate = Date.now();
1164
1164
  }
1165
- class $o extends Si {
1165
+ class Go extends ki {
1166
1166
  constructor(r, s, o, f, d) {
1167
1167
  super(r, s, o), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.cumulativeCloneMappings = [], this.documentActivity = f, this.hooks = d;
1168
1168
  }
1169
1169
  //== Untyped namespace
1170
1170
  get any() {
1171
- return this._anyTx ??= new Lo(
1171
+ return this._anyTx ??= new Uo(
1172
1172
  () => this.context,
1173
1173
  this.dialecteConfig,
1174
1174
  this.hooks,
@@ -1244,7 +1244,7 @@ class $o extends Si {
1244
1244
  * If A already exists under root, returns its ref. Otherwise, creates it and returns the new ref.
1245
1245
  */
1246
1246
  async ensureChild(r, s) {
1247
- return Fi({
1247
+ return Bi({
1248
1248
  context: this.context,
1249
1249
  parentRef: ce(r),
1250
1250
  params: s,
@@ -1268,7 +1268,7 @@ class $o extends Si {
1268
1268
  * ```
1269
1269
  */
1270
1270
  async update(r, s) {
1271
- return Bi({
1271
+ return ji({
1272
1272
  context: this.context,
1273
1273
  ref: ce(r),
1274
1274
  params: s,
@@ -1289,7 +1289,7 @@ class $o extends Si {
1289
1289
  * ```
1290
1290
  */
1291
1291
  async delete(r) {
1292
- return Ii({
1292
+ return Pi({
1293
1293
  context: this.context,
1294
1294
  ref: ce(r),
1295
1295
  hooks: this.hooks,
@@ -1310,7 +1310,7 @@ class $o extends Si {
1310
1310
  * ```
1311
1311
  */
1312
1312
  async deepClone(r, s) {
1313
- return ki({
1313
+ return Ri({
1314
1314
  dialecteConfig: this.dialecteConfig,
1315
1315
  hooks: this.hooks,
1316
1316
  context: this.context,
@@ -1345,7 +1345,7 @@ class $o extends Si {
1345
1345
  * Merges operations by ID to optimize database writes.
1346
1346
  */
1347
1347
  async commit() {
1348
- await Vo({
1348
+ await $o({
1349
1349
  stagedOperations: this.stagedOperations,
1350
1350
  store: this.store,
1351
1351
  documentId: this.documentId,
@@ -1356,7 +1356,7 @@ class $o extends Si {
1356
1356
  function Ht(m) {
1357
1357
  return m.recordCache !== void 0;
1358
1358
  }
1359
- class Go {
1359
+ class Wo {
1360
1360
  constructor(r, s, o, f, d, v) {
1361
1361
  this.state = {
1362
1362
  loading: !1,
@@ -1381,7 +1381,7 @@ class Go {
1381
1381
  * Override in dialecte subclass to return a domain-specific Query.
1382
1382
  */
1383
1383
  createQuery() {
1384
- return new Si(this.store, this.config, this.documentId);
1384
+ return new ki(this.store, this.config, this.documentId);
1385
1385
  }
1386
1386
  get query() {
1387
1387
  return this.withQueryExtensions(this.createQuery());
@@ -1392,7 +1392,7 @@ class Go {
1392
1392
  * e.g. SclDocument overrides this to return new SclTransaction(...)
1393
1393
  */
1394
1394
  createTransaction() {
1395
- return new $o(this.store, this.config, this.documentId, this.state, this.hooks);
1395
+ return new Go(this.store, this.config, this.documentId, this.state, this.hooks);
1396
1396
  }
1397
1397
  async transaction(r, s) {
1398
1398
  this.activeTransactions > 0 && $e("CONCURRENT_TRANSACTION", {
@@ -1498,9 +1498,9 @@ class Go {
1498
1498
  await this.store.destroy();
1499
1499
  }
1500
1500
  }
1501
- const ft = "_documents", Ye = "_changeLog", ze = "_meta", Wo = "xel_";
1502
- function Xo(m) {
1503
- return `${Wo}${m}`;
1501
+ const ft = "_documents", Ye = "_changeLog", ze = "_meta", Xo = "xel_";
1502
+ function Yo(m) {
1503
+ return `${Xo}${m}`;
1504
1504
  }
1505
1505
  const oi = {
1506
1506
  primaryKey: "id",
@@ -1519,11 +1519,11 @@ const oi = {
1519
1519
  compoundIndexes: [],
1520
1520
  arrayIndexes: []
1521
1521
  };
1522
- var Yo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1523
- function ji(m) {
1522
+ var zo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1523
+ function Mi(m) {
1524
1524
  return m && m.__esModule && Object.prototype.hasOwnProperty.call(m, "default") ? m.default : m;
1525
1525
  }
1526
- function zo(m) {
1526
+ function Ho(m) {
1527
1527
  if (Object.prototype.hasOwnProperty.call(m, "__esModule")) return m;
1528
1528
  var r = m.default;
1529
1529
  if (typeof r == "function") {
@@ -1547,12 +1547,12 @@ function zo(m) {
1547
1547
  });
1548
1548
  }), s;
1549
1549
  }
1550
- var Dn = { exports: {} }, Ho = Dn.exports, ci;
1551
- function Qo() {
1550
+ var Dn = { exports: {} }, Qo = Dn.exports, ci;
1551
+ function Zo() {
1552
1552
  return ci || (ci = 1, (function(m, r) {
1553
1553
  (function(s, o) {
1554
1554
  m.exports = o();
1555
- })(Ho, function() {
1555
+ })(Qo, function() {
1556
1556
  var s = function(e, t) {
1557
1557
  return (s = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
1558
1558
  n.__proto__ = i;
@@ -1569,7 +1569,7 @@ function Qo() {
1569
1569
  for (var i, a = 0, u = t.length; a < u; a++) !i && a in t || ((i = i || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
1570
1570
  return e.concat(i || Array.prototype.slice.call(t));
1571
1571
  }
1572
- var d = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Yo, v = Object.keys, g = Array.isArray;
1572
+ var d = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : zo, v = Object.keys, g = Array.isArray;
1573
1573
  function D(e, t) {
1574
1574
  return typeof t != "object" || v(t).forEach(function(n) {
1575
1575
  e[n] = t[n];
@@ -1808,7 +1808,7 @@ function Qo() {
1808
1808
  var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
1809
1809
  return [t, R(t), e];
1810
1810
  })(), rt = Ve[0], Le = Ve[1], Ve = Ve[2], Le = Le && Le.then, Ge = rt && rt.constructor, Fn = !!Ve, Kt = function(e, t) {
1811
- qt.push([e, t]), tn && (queueMicrotask(Wi), tn = !1);
1811
+ qt.push([e, t]), tn && (queueMicrotask(Xi), tn = !1);
1812
1812
  }, Bn = !0, tn = !0, mt = [], nn = [], jn = c, it = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: l, pgp: !1, env: {}, finalize: l }, H = it, qt = [], pt = 0, rn = [];
1813
1813
  function W(e) {
1814
1814
  if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
@@ -1870,10 +1870,10 @@ function Qo() {
1870
1870
  if (e._state !== null) {
1871
1871
  var n = e._state ? t.onFulfilled : t.onRejected;
1872
1872
  if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
1873
- ++t.psd.ref, ++pt, Kt(Gi, [n, e, t]);
1873
+ ++t.psd.ref, ++pt, Kt(Wi, [n, e, t]);
1874
1874
  } else e._listeners.push(t);
1875
1875
  }
1876
- function Gi(e, t, n) {
1876
+ function Wi(e, t, n) {
1877
1877
  try {
1878
1878
  var i, a = t._value;
1879
1879
  !t._state && nn.length && (nn = []), i = Ce && t._consoleTask ? t._consoleTask.run(function() {
@@ -1887,7 +1887,7 @@ function Qo() {
1887
1887
  --pt == 0 && Ln(), --n.psd.ref || n.psd.finalize();
1888
1888
  }
1889
1889
  }
1890
- function Wi() {
1890
+ function Xi() {
1891
1891
  gt(it, function() {
1892
1892
  At() && Dt();
1893
1893
  });
@@ -2038,15 +2038,15 @@ function Qo() {
2038
2038
  });
2039
2039
  });
2040
2040
  }), Ge.withResolvers && (W.withResolvers = Ge.withResolvers));
2041
- var De = { awaits: 0, echoes: 0, id: 0 }, Xi = 0, an = [], sn = 0, cn = 0, Yi = 0;
2041
+ var De = { awaits: 0, echoes: 0, id: 0 }, Yi = 0, an = [], sn = 0, cn = 0, zi = 0;
2042
2042
  function ot(e, t, n, i) {
2043
2043
  var a = H, u = Object.create(a);
2044
- return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Yi, it.env, u.env = Fn ? { Promise: W, PromiseProp: { value: W, configurable: !0, writable: !0 }, all: W.all, race: W.race, allSettled: W.allSettled, any: W.any, resolve: W.resolve, reject: W.reject } : {}, t && D(u, t), ++a.ref, u.finalize = function() {
2044
+ return u.parent = a, u.ref = 0, u.global = !1, u.id = ++zi, it.env, u.env = Fn ? { Promise: W, PromiseProp: { value: W, configurable: !0, writable: !0 }, all: W.all, race: W.race, allSettled: W.allSettled, any: W.any, resolve: W.resolve, reject: W.reject } : {}, t && D(u, t), ++a.ref, u.finalize = function() {
2045
2045
  --this.parent.ref || this.parent.finalize();
2046
2046
  }, i = gt(u, e, n, i), u.ref === 0 && u.finalize(), i;
2047
2047
  }
2048
2048
  function St() {
2049
- return De.id || (De.id = ++Xi), ++De.awaits, De.echoes += en, De.id;
2049
+ return De.id || (De.id = ++Yi), ++De.awaits, De.echoes += en, De.id;
2050
2050
  }
2051
2051
  function at() {
2052
2052
  return !!De.awaits && (--De.awaits == 0 && (De.id = 0), De.echoes = De.awaits * en, !0);
@@ -2058,7 +2058,7 @@ function Qo() {
2058
2058
  return at(), Te(t);
2059
2059
  })) : e;
2060
2060
  }
2061
- function zi() {
2061
+ function Hi() {
2062
2062
  var e = an[an.length - 1];
2063
2063
  an.pop(), st(e, !1);
2064
2064
  }
@@ -2066,7 +2066,7 @@ function Qo() {
2066
2066
  var n, i = H;
2067
2067
  (t ? !De.echoes || sn++ && e === H : !sn || --sn && e === H) || queueMicrotask(t ? (function(a) {
2068
2068
  ++cn, De.echoes && --De.echoes != 0 || (De.echoes = De.awaits = De.id = 0), an.push(H), st(a, !0);
2069
- }).bind(null, e) : zi), e !== H && (H = e, i === it && (it.env = Or()), Fn && (n = it.env.Promise, t = e.env, (i.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))));
2069
+ }).bind(null, e) : Hi), e !== H && (H = e, i === it && (it.env = Or()), Fn && (n = it.env.Promise, t = e.env, (i.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))));
2070
2070
  }
2071
2071
  function Or() {
2072
2072
  var e = d.Promise;
@@ -2563,7 +2563,7 @@ function Qo() {
2563
2563
  function jr(e) {
2564
2564
  this["@@propmod"] = e;
2565
2565
  }
2566
- var Hi = (ue.prototype._read = function(e, t) {
2566
+ var Qi = (ue.prototype._read = function(e, t) {
2567
2567
  var n = this._ctx;
2568
2568
  return n.error ? n.table._trans(null, Te.bind(null, n.error)) : n.table._trans("readonly", e).then(t);
2569
2569
  }, ue.prototype._write = function(e) {
@@ -2800,10 +2800,10 @@ function Qo() {
2800
2800
  var Mr = function(e, t) {
2801
2801
  return t.value = null;
2802
2802
  };
2803
- function Qi(e, t) {
2803
+ function Zi(e, t) {
2804
2804
  return e < t ? -1 : e === t ? 0 : 1;
2805
2805
  }
2806
- function Zi(e, t) {
2806
+ function Ji(e, t) {
2807
2807
  return t < e ? -1 : e === t ? 0 : 1;
2808
2808
  }
2809
2809
  function qe(e, t, n) {
@@ -2828,7 +2828,7 @@ function Qo() {
2828
2828
  return N.toLowerCase();
2829
2829
  } : function(N) {
2830
2830
  return N.toUpperCase();
2831
- }, h = x === "next" ? Qi : Zi;
2831
+ }, h = x === "next" ? Zi : Ji;
2832
2832
  var C = n.map(function(N) {
2833
2833
  return { lower: u(N), upper: a(N) };
2834
2834
  }).sort(function(N, A) {
@@ -3022,7 +3022,7 @@ function Qo() {
3022
3022
  function $t(e) {
3023
3023
  e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
3024
3024
  }
3025
- var Gt = "storagemutated", Xn = "x-storagemutated-1", ut = Lt(null, Gt), Ji = (Xe.prototype._lock = function() {
3025
+ var Gt = "storagemutated", Xn = "x-storagemutated-1", ut = Lt(null, Gt), eo = (Xe.prototype._lock = function() {
3026
3026
  return Z(!H.global), ++this._reculock, this._reculock !== 1 || H.global || (H.lockOwnerFor = this), this;
3027
3027
  }, Xe.prototype._unlock = function() {
3028
3028
  if (Z(!H.global), --this._reculock == 0) for (H.global || (H.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) {
@@ -3149,11 +3149,11 @@ function Qo() {
3149
3149
  function Ur(e) {
3150
3150
  return [].slice.call(e);
3151
3151
  }
3152
- var eo = 0;
3152
+ var to = 0;
3153
3153
  function Xt(e) {
3154
3154
  return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
3155
3155
  }
3156
- function to(e, t, b) {
3156
+ function no(e, t, b) {
3157
3157
  function i(N) {
3158
3158
  if (N.type === 3) return null;
3159
3159
  if (N.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
@@ -3231,7 +3231,7 @@ function Qo() {
3231
3231
  var G = k.index, L = k.range, U = N.objectStore(x), U = G.isPrimaryKey ? U : U.index(G.name), G = P ? F ? "prevunique" : "prev" : F ? "nextunique" : "next", $ = !A && "openKeyCursor" in U ? U.openKeyCursor(i(L), G) : U.openCursor(i(L), G);
3232
3232
  $.onerror = We(V), $.onsuccess = ge(function(X) {
3233
3233
  var re, se, te, Ee, ee = $.result;
3234
- ee ? (ee.___id = ++eo, ee.done = !1, re = ee.continue.bind(ee), se = (se = ee.continuePrimaryKey) && se.bind(ee), te = ee.advance.bind(ee), Ee = function() {
3234
+ ee ? (ee.___id = ++to, ee.done = !1, re = ee.continue.bind(ee), se = (se = ee.continuePrimaryKey) && se.bind(ee), te = ee.advance.bind(ee), Ee = function() {
3235
3235
  throw new Error("Cursor not stopped");
3236
3236
  }, ee.trans = N, ee.stop = ee.continue = ee.continuePrimaryKey = ee.advance = function() {
3237
3237
  throw new Error("Cursor not started");
@@ -3294,14 +3294,14 @@ function Qo() {
3294
3294
  return y[O];
3295
3295
  }, MIN_KEY: -1 / 0, MAX_KEY: Wt(t), schema: b };
3296
3296
  }
3297
- function no(e, t, n, i) {
3297
+ function ro(e, t, n, i) {
3298
3298
  var a = n.IDBKeyRange;
3299
- return n.indexedDB, { dbcore: (i = to(t, a, i), e.dbcore.reduce(function(u, h) {
3299
+ return n.indexedDB, { dbcore: (i = no(t, a, i), e.dbcore.reduce(function(u, h) {
3300
3300
  return h = h.create, o(o({}, u), h(u));
3301
3301
  }, i)) };
3302
3302
  }
3303
3303
  function gn(e, i) {
3304
- var n = i.db, i = no(e._middlewares, n, e._deps, i);
3304
+ var n = i.db, i = ro(e._middlewares, n, e._deps, i);
3305
3305
  e.core = i.dbcore, e.tables.forEach(function(a) {
3306
3306
  var u = a.name;
3307
3307
  e.core.schema.tables.some(function(h) {
@@ -3329,10 +3329,10 @@ function Qo() {
3329
3329
  for (var i in n) n[i] instanceof e.Table && delete n[i];
3330
3330
  });
3331
3331
  }
3332
- function ro(e, t) {
3332
+ function io(e, t) {
3333
3333
  return e._cfg.version - t._cfg.version;
3334
3334
  }
3335
- function io(e, t, n, i) {
3335
+ function oo(e, t, n, i) {
3336
3336
  var a = e._dbSchema;
3337
3337
  n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = zn("$meta", $r("")[0], []), e._storeNames.push("$meta"));
3338
3338
  var u = e._createTransaction("readwrite", e._storeNames, a);
@@ -3401,7 +3401,7 @@ function Qo() {
3401
3401
  var b, _;
3402
3402
  });
3403
3403
  }
3404
- function oo(e, t) {
3404
+ function ao(e, t) {
3405
3405
  Vr(e._dbSchema, t), t.db.version % 10 != 0 || t.objectStoreNames.contains("$meta") || t.db.createObjectStore("$meta").add(Math.ceil(t.db.version / 10 - 1), "version");
3406
3406
  var n = bn(0, e.idbdb, t);
3407
3407
  wn(e, e._dbSchema, t);
@@ -3478,7 +3478,7 @@ function Qo() {
3478
3478
  return Yn(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), g(u), n === 0, i);
3479
3479
  });
3480
3480
  }
3481
- var ao = (Pt.prototype._createTableSchema = zn, Pt.prototype._parseIndexSyntax = $r, Pt.prototype._parseStoresSpec = function(e, t) {
3481
+ var so = (Pt.prototype._createTableSchema = zn, Pt.prototype._parseIndexSyntax = $r, Pt.prototype._parseStoresSpec = function(e, t) {
3482
3482
  var n = this;
3483
3483
  v(e).forEach(function(i) {
3484
3484
  if (e[i] !== null) {
@@ -3641,7 +3641,7 @@ function Qo() {
3641
3641
  e.queries.query[b] = _;
3642
3642
  }
3643
3643
  }
3644
- function so(e) {
3644
+ function co(e) {
3645
3645
  var t = e._state, n = e._deps.indexedDB;
3646
3646
  if (t.isBeingOpened || e.idbdb) return t.dbReadyPromise.then(function() {
3647
3647
  return t.dbOpenError ? Te(t.dbOpenError) : e;
@@ -3660,7 +3660,7 @@ function Qo() {
3660
3660
  var A;
3661
3661
  T = C.transaction, t.autoSchema && !e._options.allowEmptyDB ? (C.onerror = $t, T.abort(), C.result.close(), (A = n.deleteDatabase(x)).onsuccess = A.onerror = ge(function() {
3662
3662
  w(new Q.NoSuchDatabase("Database ".concat(x, " doesnt exist")));
3663
- })) : (T.onerror = We(w), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, y = N < 1, e.idbdb = C.result, u && oo(e, T), io(e, N / 10, T, w));
3663
+ })) : (T.onerror = We(w), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, y = N < 1, e.idbdb = C.result, u && ao(e, T), oo(e, N / 10, T, w));
3664
3664
  }, w), C.onsuccess = ge(function() {
3665
3665
  T = null;
3666
3666
  var N, A, k, P, F, q = e.idbdb = C.result, V = ye(q.objectStoreNames);
@@ -3748,7 +3748,7 @@ function Qo() {
3748
3748
  for (var i = g(e) ? e.slice() : [e], a = 0; a < n; ++a) i.push(t);
3749
3749
  return i;
3750
3750
  }
3751
- var co = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3751
+ var uo = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
3752
3752
  return o(o({}, e), { table: function(t) {
3753
3753
  var n = e.table(t), i = n.schema, a = {}, u = [];
3754
3754
  function h(y, O, w) {
@@ -3805,7 +3805,7 @@ function Qo() {
3805
3805
  function lr(e, t) {
3806
3806
  return t.type === "delete" ? t.keys : t.keys || t.values.map(e.extractKey);
3807
3807
  }
3808
- var uo = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3808
+ var lo = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: function(e) {
3809
3809
  return o(o({}, e), { table: function(t) {
3810
3810
  var n = e.table(t), i = n.schema.primaryKey;
3811
3811
  return o(o({}, n), { mutate: function(a) {
@@ -3875,7 +3875,7 @@ function Qo() {
3875
3875
  return null;
3876
3876
  }
3877
3877
  }
3878
- var lo = { stack: "dbcore", level: -1, create: function(e) {
3878
+ var fo = { stack: "dbcore", level: -1, create: function(e) {
3879
3879
  return { table: function(t) {
3880
3880
  var n = e.table(t);
3881
3881
  return o(o({}, n), { getMany: function(i) {
@@ -3903,7 +3903,7 @@ function Qo() {
3903
3903
  return !1;
3904
3904
  }
3905
3905
  }
3906
- var fo = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3906
+ var ho = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
3907
3907
  var t = e.schema.name, n = new Ie(e.MIN_KEY, e.MAX_KEY);
3908
3908
  return o(o({}, e), { transaction: function(i, a, u) {
3909
3909
  if (H.subscr && a !== "readonly") throw new Q.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(H.querier));
@@ -4058,7 +4058,7 @@ function Qo() {
4058
4058
  function ei(e, t) {
4059
4059
  return ae(e.lower, t.lower) === 0 && ae(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
4060
4060
  }
4061
- function ho(e, t) {
4061
+ function mo(e, t) {
4062
4062
  return (function(n, i, a, u) {
4063
4063
  if (n === void 0) return i !== void 0 ? -1 : 0;
4064
4064
  if (i === void 0) return 1;
@@ -4079,7 +4079,7 @@ function Qo() {
4079
4079
  return i;
4080
4080
  })(e.upper, t.upper, e.upperOpen, t.upperOpen);
4081
4081
  }
4082
- function mo(e, t, n, i) {
4082
+ function po(e, t, n, i) {
4083
4083
  e.subscribers.add(n), i.addEventListener("abort", function() {
4084
4084
  var a, u;
4085
4085
  e.subscribers.delete(n), e.subscribers.size === 0 && (a = e, u = t, setTimeout(function() {
@@ -4087,7 +4087,7 @@ function Qo() {
4087
4087
  }, 3e3));
4088
4088
  });
4089
4089
  }
4090
- var po = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
4090
+ var go = { stack: "dbcore", level: 0, name: "Cache", create: function(e) {
4091
4091
  var t = e.schema.name;
4092
4092
  return o(o({}, e), { transaction: function(n, i, a) {
4093
4093
  var u, h, p = e.transaction(n, i, a);
@@ -4156,7 +4156,7 @@ function Qo() {
4156
4156
  return q.req.limit === A.limit && q.req.values === A.values && ei(q.req.query.range, A.query.range);
4157
4157
  });
4158
4158
  return F ? [F, !0, k, P] : [P.find(function(q) {
4159
- return ("limit" in q.req ? q.req.limit : 1 / 0) >= A.limit && (!A.values || q.req.values) && ho(q.req.query.range, A.query.range);
4159
+ return ("limit" in q.req ? q.req.limit : 1 / 0) >= A.limit && (!A.values || q.req.values) && mo(q.req.query.range, A.query.range);
4160
4160
  }), !1, k, P];
4161
4161
  case "count":
4162
4162
  return F = P.find(function(q) {
@@ -4173,7 +4173,7 @@ function Qo() {
4173
4173
  return x;
4174
4174
  }).catch(function(x) {
4175
4175
  return w && T && Ke(w, T), Promise.reject(x);
4176
- }), T = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(T) : (w = [T], (O = O || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), mo(T, w, p, b), T.promise.then(function(x) {
4176
+ }), T = { obsSet: u.obsSet, promise: y, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, w ? w.push(T) : (w = [T], (O = O || (bt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = w)), po(T, w, p, b), T.promise.then(function(x) {
4177
4177
  return { result: Jr(x.result, u, O?.optimisticOps, i, T, h) };
4178
4178
  });
4179
4179
  } });
@@ -4191,7 +4191,7 @@ function Qo() {
4191
4191
  var t = this._versions, n = t.filter(function(i) {
4192
4192
  return i._cfg.version === e;
4193
4193
  })[0];
4194
- return n || (n = new this.Version(e), t.push(n), t.sort(ro), n.stores({}), this._state.autoSchema = !1, n);
4194
+ return n || (n = new this.Version(e), t.push(n), t.sort(io), n.stores({}), this._state.autoSchema = !1, n);
4195
4195
  }, Ne.prototype._whenReady = function(e) {
4196
4196
  var t = this;
4197
4197
  return this.idbdb && (this._state.openComplete || H.letThrough || this._vip) ? e() : new W(function(n, i) {
@@ -4215,7 +4215,7 @@ function Qo() {
4215
4215
  }, Ne.prototype.open = function() {
4216
4216
  var e = this;
4217
4217
  return gt(it, function() {
4218
- return so(e);
4218
+ return co(e);
4219
4219
  });
4220
4220
  }, Ne.prototype._close = function() {
4221
4221
  this.on.close.fire(new CustomEvent("close"));
@@ -4366,7 +4366,7 @@ function Qo() {
4366
4366
  }));
4367
4367
  });
4368
4368
  };
4369
- }), this.Collection = (a = this, Ut(Hi.prototype, function(A, N) {
4369
+ }), this.Collection = (a = this, Ut(Qi.prototype, function(A, N) {
4370
4370
  this.db = a;
4371
4371
  var w = Sr, x = null;
4372
4372
  if (N) try {
@@ -4378,7 +4378,7 @@ function Qo() {
4378
4378
  this._ctx = { table: N, index: C.index, isPrimKey: !C.index || N.schema.primKey.keyPath && C.index === N.schema.primKey.name, range: w, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: x, or: C.or, valueMapper: A !== c ? A : null };
4379
4379
  })), this.Table = (u = this, Ut(Pr.prototype, function(y, O, w) {
4380
4380
  this.db = u, this._tx = w, this.name = y, this.schema = O, this.hook = u._allTables[y] ? u._allTables[y].hook : Lt(null, { creating: [le, l], reading: [I, c], updating: [xe, l], deleting: [be, l] });
4381
- })), this.Transaction = (h = this, Ut(Ji.prototype, function(y, O, w, x, C) {
4381
+ })), this.Transaction = (h = this, Ut(eo.prototype, function(y, O, w, x, C) {
4382
4382
  var N = this;
4383
4383
  y !== "readonly" && O.forEach(function(A) {
4384
4384
  A = (A = w[A]) === null || A === void 0 ? void 0 : A.yProps, A && (O = O.concat(A.map(function(k) {
@@ -4392,7 +4392,7 @@ function Qo() {
4392
4392
  var k = N.active;
4393
4393
  return N.active = !1, N.on.error.fire(A), N.parent ? N.parent._reject(A) : k && N.idbtrans && N.idbtrans.abort(), Te(A);
4394
4394
  });
4395
- })), this.Version = (p = this, Ut(ao.prototype, function(y) {
4395
+ })), this.Version = (p = this, Ut(so.prototype, function(y) {
4396
4396
  this.db = p, this._cfg = { version: y, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
4397
4397
  })), this.WhereClause = (b = this, Ut(qr.prototype, function(y, O, w) {
4398
4398
  if (this.db = b, this._ctx = { table: y, index: O === ":id" ? null : O, or: w }, this._cmp = this._ascending = ae, this._descending = function(x, C) {
@@ -4414,7 +4414,7 @@ function Qo() {
4414
4414
  }).map(function(O) {
4415
4415
  return O.on("versionchange").fire(y);
4416
4416
  });
4417
- }, this.use(lo), this.use(po), this.use(fo), this.use(co), this.use(uo);
4417
+ }, this.use(fo), this.use(go), this.use(ho), this.use(uo), this.use(lo);
4418
4418
  var T = new Proxy(this, { get: function(y, O, w) {
4419
4419
  if (O === "_vip") return !0;
4420
4420
  if (O === "table") return function(C) {
@@ -4431,7 +4431,7 @@ function Qo() {
4431
4431
  return y(n);
4432
4432
  });
4433
4433
  }
4434
- var Cn, Le = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", go = (dr.prototype.subscribe = function(e, t, n) {
4434
+ var Cn, Le = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", yo = (dr.prototype.subscribe = function(e, t, n) {
4435
4435
  return this._subscribe(e && typeof e != "function" ? e : { next: e, error: t, complete: n });
4436
4436
  }, dr.prototype[Le] = function() {
4437
4437
  return this;
@@ -4445,7 +4445,7 @@ function Qo() {
4445
4445
  Cn = { indexedDB: null, IDBKeyRange: null };
4446
4446
  }
4447
4447
  function ti(e) {
4448
- var t, n = !1, i = new go(function(a) {
4448
+ var t, n = !1, i = new yo(function(a) {
4449
4449
  var u = Tt(e), h, p = !1, b = {}, _ = {}, T = { get closed() {
4450
4450
  return p;
4451
4451
  }, unsubscribe: function() {
@@ -4590,8 +4590,8 @@ function Qo() {
4590
4590
  });
4591
4591
  })(Dn)), Dn.exports;
4592
4592
  }
4593
- var Zo = Qo();
4594
- const _r = /* @__PURE__ */ ji(Zo), ui = /* @__PURE__ */ Symbol.for("Dexie"), dt = globalThis[ui] || (globalThis[ui] = _r);
4593
+ var Jo = Zo();
4594
+ const _r = /* @__PURE__ */ Mi(Jo), ui = /* @__PURE__ */ Symbol.for("Dexie"), dt = globalThis[ui] || (globalThis[ui] = _r);
4595
4595
  if (_r.semVer !== dt.semVer)
4596
4596
  throw new Error(`Two different versions of Dexie loaded in the same app: ${_r.semVer} and ${dt.semVer}`);
4597
4597
  const {
@@ -4617,15 +4617,15 @@ function Et(m) {
4617
4617
  s.push(`*${o}`);
4618
4618
  return s.join(", ");
4619
4619
  }
4620
- const Jo = {
4620
+ const ea = {
4621
4621
  primaryKey: "id",
4622
4622
  indexes: ["tagName"],
4623
4623
  compoundIndexes: [],
4624
4624
  arrayIndexes: []
4625
4625
  };
4626
- class ea {
4626
+ class ta {
4627
4627
  constructor(r, s) {
4628
- this.schemaVersion = 1, this.knownDocuments = /* @__PURE__ */ new Map(), this.schemaLock = Promise.resolve(), this.name = r, this.dexieRecordSchema = Et(s?.recordSchema ?? Jo), this.db = new dt(r);
4628
+ this.schemaVersion = 1, this.knownDocuments = /* @__PURE__ */ new Map(), this.schemaLock = Promise.resolve(), this.name = r, this.dexieRecordSchema = Et(s?.recordSchema ?? ea), this.db = new dt(r);
4629
4629
  }
4630
4630
  // --- Lifecycle ---
4631
4631
  async open() {
@@ -4847,21 +4847,21 @@ class ea {
4847
4847
  * Resolve the Dexie table name for a documentId.
4848
4848
  */
4849
4849
  resolveTableName(r) {
4850
- return Xo(r);
4850
+ return Yo(r);
4851
4851
  }
4852
4852
  }
4853
4853
  function li() {
4854
4854
  return new Promise((m) => setTimeout(m, 0));
4855
4855
  }
4856
- function ta(m, r, s) {
4856
+ function na(m, r, s) {
4857
4857
  if (r.type === "local") {
4858
4858
  const o = { recordSchema: s.database.recordSchema };
4859
- return new ea(m, o);
4859
+ return new ta(m, o);
4860
4860
  }
4861
4861
  return r.store;
4862
4862
  }
4863
4863
  var Qt = { exports: {} }, An = { exports: {} }, fi;
4864
- function na() {
4864
+ function ra() {
4865
4865
  return fi || (fi = 1, (function(m, r) {
4866
4866
  Object.defineProperty(r, "__esModule", { value: !0 }), r.ParsingError = void 0;
4867
4867
  class s extends Error {
@@ -5043,13 +5043,13 @@ function na() {
5043
5043
  })(An, An.exports)), An.exports;
5044
5044
  }
5045
5045
  var di = Qt.exports, hi;
5046
- function ra() {
5046
+ function ia() {
5047
5047
  return hi || (hi = 1, (function(m, r) {
5048
5048
  var s = di && di.__importDefault || function(M) {
5049
5049
  return M && M.__esModule ? M : { default: M };
5050
5050
  };
5051
5051
  Object.defineProperty(r, "__esModule", { value: !0 });
5052
- const o = s(/* @__PURE__ */ na());
5052
+ const o = s(/* @__PURE__ */ ra());
5053
5053
  function f(M) {
5054
5054
  if (!M.options.indentation && !M.options.lineSeparator)
5055
5055
  return;
@@ -5143,15 +5143,15 @@ function ra() {
5143
5143
  oe.minify = (M, j = {}) => oe(M, Object.assign(Object.assign({}, j), { indentation: "", lineSeparator: "" })), m.exports = oe, r.default = oe;
5144
5144
  })(Qt, Qt.exports)), Qt.exports;
5145
5145
  }
5146
- var ia = /* @__PURE__ */ ra();
5147
- const oa = /* @__PURE__ */ ji(ia);
5148
- function aa(m) {
5149
- return oa(m);
5146
+ var oa = /* @__PURE__ */ ia();
5147
+ const aa = /* @__PURE__ */ Mi(oa);
5148
+ function sa(m) {
5149
+ return aa(m);
5150
5150
  }
5151
- const Mi = "_temp-idb-id";
5152
- async function sa(m) {
5151
+ const Ki = "_temp-idb-id";
5152
+ async function ca(m) {
5153
5153
  const { extension: r, xmlDocument: s, filename: o } = m, g = `<?xml version="1.0" encoding="UTF-8"?>
5154
- ` + new XMLSerializer().serializeToString(s), D = aa(g), R = new Blob([D], { type: "application/xml" });
5154
+ ` + new XMLSerializer().serializeToString(s), D = sa(g), R = new Blob([D], { type: "application/xml" });
5155
5155
  if ("showSaveFilePicker" in window)
5156
5156
  try {
5157
5157
  const B = await (await window.showSaveFilePicker({
@@ -5172,7 +5172,7 @@ async function sa(m) {
5172
5172
  B.href = K, B.download = o, document.body.appendChild(B), B.click(), B.remove(), URL.revokeObjectURL(K);
5173
5173
  }
5174
5174
  }
5175
- function ca(m) {
5175
+ function ua(m) {
5176
5176
  const { records: r, config: s, withDatabaseIds: o = !1 } = m, f = /* @__PURE__ */ new Map();
5177
5177
  let d;
5178
5178
  for (const R of r)
@@ -5182,14 +5182,14 @@ function ca(m) {
5182
5182
  key: "EXPORT_ROOT_NOT_FOUND"
5183
5183
  });
5184
5184
  const v = s.namespaces.default, g = document.implementation.createDocument(v.uri, null, null), D = g.createElementNS(d.namespace.uri, d.tagName);
5185
- return D.setAttribute("xmlns", d.namespace.uri), d.attributes && qi({
5185
+ return D.setAttribute("xmlns", d.namespace.uri), d.attributes && Li({
5186
5186
  config: s,
5187
5187
  document: g,
5188
5188
  element: D,
5189
5189
  attributes: d.attributes,
5190
5190
  tagName: d.tagName,
5191
5191
  isRoot: !0
5192
- }), Ui({ config: s, rootElement: D, namespace: d.namespace }), d.value && (D.textContent = d.value.trim()), o && D.setAttribute(Mi, d.id), g.appendChild(D), Ki({
5192
+ }), Vi({ config: s, rootElement: D, namespace: d.namespace }), d.value && (D.textContent = d.value.trim()), o && D.setAttribute(Ki, d.id), g.appendChild(D), qi({
5193
5193
  index: f,
5194
5194
  config: s,
5195
5195
  withDatabaseIds: o,
@@ -5198,7 +5198,7 @@ function ca(m) {
5198
5198
  parentElement: D
5199
5199
  }), g;
5200
5200
  }
5201
- function Ki(m) {
5201
+ function qi(m) {
5202
5202
  const { index: r, config: s, withDatabaseIds: o, xmlDocument: f, parentRecord: d, parentElement: v } = m;
5203
5203
  if (!d.children || d.children.length === 0) return;
5204
5204
  const g = [];
@@ -5210,20 +5210,20 @@ function Ki(m) {
5210
5210
  ref: { tagName: d.tagName, id: d.id }
5211
5211
  }), g.push(K);
5212
5212
  }
5213
- const D = la({
5213
+ const D = fa({
5214
5214
  parentTagName: d.tagName,
5215
5215
  availableChildren: s.children,
5216
5216
  childrenRecords: g
5217
5217
  });
5218
5218
  for (const R of D) {
5219
- const K = ua({
5219
+ const K = la({
5220
5220
  config: s,
5221
5221
  document: f,
5222
5222
  record: R,
5223
5223
  defaultNamespace: s.namespaces.default,
5224
5224
  withDatabaseIds: o
5225
5225
  });
5226
- v.appendChild(K), Ki({
5226
+ v.appendChild(K), qi({
5227
5227
  index: r,
5228
5228
  config: s,
5229
5229
  withDatabaseIds: o,
@@ -5233,31 +5233,31 @@ function Ki(m) {
5233
5233
  });
5234
5234
  }
5235
5235
  }
5236
- function ua(m) {
5236
+ function la(m) {
5237
5237
  const { config: r, document: s, record: o, defaultNamespace: f, withDatabaseIds: d } = m, v = o.namespace.uri === f.uri;
5238
5238
  let g;
5239
- return !v && o.namespace.prefix && o.namespace.prefix !== "xmlns" ? (Li({ config: r, document: s, namespace: o.namespace }), g = s.createElementNS(
5239
+ return !v && o.namespace.prefix && o.namespace.prefix !== "xmlns" ? (Ui({ config: r, document: s, namespace: o.namespace }), g = s.createElementNS(
5240
5240
  o.namespace.uri,
5241
5241
  `${o.namespace.prefix}:${o.tagName}`
5242
- )) : g = s.createElementNS(o.namespace.uri, o.tagName), o.attributes && qi({
5242
+ )) : g = s.createElementNS(o.namespace.uri, o.tagName), o.attributes && Li({
5243
5243
  config: r,
5244
5244
  document: s,
5245
5245
  element: g,
5246
5246
  attributes: o.attributes,
5247
5247
  tagName: o.tagName,
5248
5248
  isRoot: !1
5249
- }), o.value && (g.textContent = o.value.trim()), d && g.setAttribute(Mi, o.id), g;
5249
+ }), o.value && (g.textContent = o.value.trim()), d && g.setAttribute(Ki, o.id), g;
5250
5250
  }
5251
- function qi(m) {
5251
+ function Li(m) {
5252
5252
  const { config: r, document: s, element: o, attributes: f, tagName: d, isRoot: v } = m;
5253
5253
  for (const g of f) {
5254
- if (fa(g) || !v && da({ config: r, tagName: d, attribute: g })) continue;
5255
- if (!$i(g) || !g.namespace.prefix) {
5254
+ if (da(g) || !v && ha({ config: r, tagName: d, attribute: g })) continue;
5255
+ if (!Gi(g) || !g.namespace.prefix) {
5256
5256
  o.setAttribute(g.name, String(g.value));
5257
5257
  continue;
5258
5258
  }
5259
- v || Li({ config: r, document: s, namespace: g.namespace });
5260
- const D = Vi(g.name);
5259
+ v || Ui({ config: r, document: s, namespace: g.namespace });
5260
+ const D = $i(g.name);
5261
5261
  o.setAttributeNS(
5262
5262
  g.namespace.uri,
5263
5263
  `${g.namespace.prefix}:${D}`,
@@ -5265,19 +5265,19 @@ function qi(m) {
5265
5265
  );
5266
5266
  }
5267
5267
  }
5268
- function Li(m) {
5268
+ function Ui(m) {
5269
5269
  const { config: r, document: s, namespace: o } = m, f = s.documentElement;
5270
5270
  if (!f || !o.prefix || o.prefix === "xmlns") return;
5271
5271
  const d = "http://www.w3.org/2000/xmlns/";
5272
- f.getAttributeNS(d, o.prefix) === null && (f.setAttributeNS(d, `xmlns:${o.prefix}`, o.uri), Ui({ config: r, rootElement: f, namespace: o }));
5272
+ f.getAttributeNS(d, o.prefix) === null && (f.setAttributeNS(d, `xmlns:${o.prefix}`, o.uri), Vi({ config: r, rootElement: f, namespace: o }));
5273
5273
  }
5274
- function Ui(m) {
5274
+ function Vi(m) {
5275
5275
  const { config: r, rootElement: s, namespace: o } = m, f = Object.entries(
5276
5276
  r.definition[r.rootElementName].attributes.details
5277
5277
  ).filter(([v, g]) => o.uri === r.namespaces.default.uri ? !g.namespace : g.namespace?.prefix === o.prefix && g.namespace?.uri === o.uri);
5278
5278
  if (f.length > 0)
5279
5279
  for (const [v, g] of f) {
5280
- const D = Vi(v);
5280
+ const D = $i(v);
5281
5281
  if (!(g.namespace ? s.hasAttributeNS(g.namespace.uri, D) : s.hasAttribute(D)))
5282
5282
  if (g.namespace) {
5283
5283
  const K = `${g.namespace.prefix}:${D}`;
@@ -5286,7 +5286,7 @@ function Ui(m) {
5286
5286
  s.setAttribute(D, g.default || "");
5287
5287
  }
5288
5288
  }
5289
- function la(m) {
5289
+ function fa(m) {
5290
5290
  const { parentTagName: r, availableChildren: s, childrenRecords: o } = m, f = new Set(s[r]);
5291
5291
  if (!f.size) return o;
5292
5292
  const d = /* @__PURE__ */ new Map(), v = [];
@@ -5301,17 +5301,17 @@ function la(m) {
5301
5301
  }
5302
5302
  return g.push(...v), g;
5303
5303
  }
5304
- function Vi(m) {
5304
+ function $i(m) {
5305
5305
  const r = m.lastIndexOf(":");
5306
5306
  return r === -1 ? m : m.slice(r + 1);
5307
5307
  }
5308
- function $i(m) {
5308
+ function Gi(m) {
5309
5309
  return m !== null && typeof m == "object" && "namespace" in m && !!m.namespace;
5310
5310
  }
5311
- function fa(m) {
5312
- return !!(m.name === "xmlns" || m.name.startsWith("xmlns:") || $i(m) && m.namespace?.prefix === "xmlns");
5313
- }
5314
5311
  function da(m) {
5312
+ return !!(m.name === "xmlns" || m.name.startsWith("xmlns:") || Gi(m) && m.namespace?.prefix === "xmlns");
5313
+ }
5314
+ function ha(m) {
5315
5315
  const { config: r, tagName: s, attribute: o } = m;
5316
5316
  if (!r.elements.includes(s)) return !1;
5317
5317
  const f = r.definition[s];
@@ -5319,7 +5319,7 @@ function da(m) {
5319
5319
  const d = f.attributes.details[o.name];
5320
5320
  return !(!d || d.required || d.default === void 0 || String(o.value) !== d.default || f.attributes.identityFields?.includes(o.name));
5321
5321
  }
5322
- class ha {
5322
+ class ma {
5323
5323
  constructor() {
5324
5324
  this.pendingChildren = /* @__PURE__ */ new Map();
5325
5325
  }
@@ -5347,16 +5347,16 @@ class ha {
5347
5347
  return this.pendingChildren.size;
5348
5348
  }
5349
5349
  }
5350
- function ma(m) {
5350
+ function pa(m) {
5351
5351
  return "prefix" in m && "uri" in m && !!m.prefix && !!m.uri;
5352
5352
  }
5353
5353
  var yr = {};
5354
- const pa = {}, ga = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5354
+ const ga = {}, ya = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5355
5355
  __proto__: null,
5356
- default: pa
5357
- }, Symbol.toStringTag, { value: "Module" })), ya = /* @__PURE__ */ zo(ga);
5356
+ default: ga
5357
+ }, Symbol.toStringTag, { value: "Module" })), va = /* @__PURE__ */ Ho(ya);
5358
5358
  var mi;
5359
- function va() {
5359
+ function ba() {
5360
5360
  return mi || (mi = 1, (function(m) {
5361
5361
  (function(r) {
5362
5362
  r.parser = function(l, c) {
@@ -5459,7 +5459,7 @@ function va() {
5459
5459
  };
5460
5460
  var g;
5461
5461
  try {
5462
- g = ya.Stream;
5462
+ g = va.Stream;
5463
5463
  } catch {
5464
5464
  g = function() {
5465
5465
  };
@@ -6308,15 +6308,15 @@ Actual: ` + l.attribValue
6308
6308
  })(m);
6309
6309
  })(yr)), yr;
6310
6310
  }
6311
- var ba = va();
6312
- function wa(m) {
6311
+ var wa = ba();
6312
+ function _a(m) {
6313
6313
  const { dialecteConfig: r, useCustomRecordsIds: s, session: o } = m, f = r.io.hooks;
6314
6314
  let v = {
6315
6315
  defaultNamespace: null,
6316
6316
  stack: [],
6317
6317
  recordsBatch: []
6318
6318
  };
6319
- const g = ba.parser(
6319
+ const g = wa.parser(
6320
6320
  !0,
6321
6321
  // strict mode
6322
6322
  {
@@ -6332,12 +6332,12 @@ function wa(m) {
6332
6332
  // Enable namespace handling
6333
6333
  }
6334
6334
  );
6335
- g.onopentag = (K) => v = _a({
6335
+ g.onopentag = (K) => v = Ea({
6336
6336
  node: K,
6337
6337
  state: v,
6338
6338
  dialecteConfig: r,
6339
6339
  useCustomRecordsIds: s
6340
- }), g.ontext = (K) => v = Ea({ text: K, state: v }), g.onclosetag = () => ({ updatedState: v } = xa({
6340
+ }), g.ontext = (K) => v = pi({ text: K, state: v }), g.oncdata = (K) => v = pi({ text: K, state: v }), g.onclosetag = () => ({ updatedState: v } = xa({
6341
6341
  state: v,
6342
6342
  ioHooks: f,
6343
6343
  session: o
@@ -6355,7 +6355,7 @@ function wa(m) {
6355
6355
  getSize: R
6356
6356
  };
6357
6357
  }
6358
- function _a(m) {
6358
+ function Ea(m) {
6359
6359
  const { node: r, state: s, dialecteConfig: o, useCustomRecordsIds: f } = m, d = { ...s }, v = Na(r);
6360
6360
  d.defaultNamespace || (d.defaultNamespace = Ca({
6361
6361
  element: r,
@@ -6376,7 +6376,7 @@ function _a(m) {
6376
6376
  };
6377
6377
  return d.stack.push(Y), d;
6378
6378
  }
6379
- function Ea(m) {
6379
+ function pi(m) {
6380
6380
  const { text: r, state: s } = m;
6381
6381
  return r && s.stack.length > 0 && (s.stack[s.stack.length - 1].value += r), s;
6382
6382
  }
@@ -6429,7 +6429,7 @@ function Ca(m) {
6429
6429
  } : s;
6430
6430
  }
6431
6431
  function Oa(m, r) {
6432
- return ma(m) ? {
6432
+ return pa(m) ? {
6433
6433
  prefix: m.prefix,
6434
6434
  uri: m.uri
6435
6435
  } : r;
@@ -6453,12 +6453,12 @@ function Da(m) {
6453
6453
  return r ? { id: r.id, tagName: r.tagName } : null;
6454
6454
  }
6455
6455
  function Sa(m) {
6456
- const { attributes: r, useCustomRecordsIds: s } = m, o = r[gi];
6456
+ const { attributes: r, useCustomRecordsIds: s } = m, o = r[yi];
6457
6457
  return s && o && o.value ? o.value : crypto.randomUUID();
6458
6458
  }
6459
6459
  function ka(m) {
6460
6460
  const { attributes: r, useCustomRecordsIds: s } = m;
6461
- return s ? Object.values(r).filter((o) => o.name !== gi) : Object.values(r);
6461
+ return s ? Object.values(r).filter((o) => o.name !== yi) : Object.values(r);
6462
6462
  }
6463
6463
  const Ra = 32 * 1024, Ia = 2e3;
6464
6464
  async function Pa(m) {
@@ -6468,7 +6468,7 @@ async function Pa(m) {
6468
6468
  { key: "ASSERTION_FAILED", detail: `Unsupported file type: ${r.name}` }
6469
6469
  ), r.size === 0)
6470
6470
  return { documentId: s, recordCount: 0 };
6471
- const D = v?.chunkSize ?? Ra, R = v?.batchSize ?? Ia, K = new ha(), B = wa({ dialecteConfig: f, useCustomRecordsIds: d, session: K }), Y = await Fa({
6471
+ const D = v?.chunkSize ?? Ra, R = v?.batchSize ?? Ia, K = new ma(), B = _a({ dialecteConfig: f, useCustomRecordsIds: d, session: K }), Y = await Fa({
6472
6472
  file: r,
6473
6473
  sax: B,
6474
6474
  session: K,
@@ -6487,13 +6487,13 @@ async function Fa(m) {
6487
6487
  for (; !Y; ) {
6488
6488
  const oe = await R.read();
6489
6489
  if (Y = oe.done, Y) {
6490
- B.length > 0 && s.parser.write(K.decode(B)), s.parser.close(), D += await pi({ sax: s, session: o, store: f, documentId: d, threshold: 0 });
6490
+ B.length > 0 && s.parser.write(K.decode(B)), s.parser.close(), D += await gi({ sax: s, session: o, store: f, documentId: d, threshold: 0 });
6491
6491
  break;
6492
6492
  }
6493
6493
  if (oe.value)
6494
6494
  for (B = ja(B, oe.value); B.length >= v; ) {
6495
6495
  const M = K.decode(B.slice(0, v), { stream: !0 });
6496
- B = B.slice(v), s.parser.write(M), D += await pi({ sax: s, session: o, store: f, documentId: d, threshold: g });
6496
+ B = B.slice(v), s.parser.write(M), D += await gi({ sax: s, session: o, store: f, documentId: d, threshold: g });
6497
6497
  }
6498
6498
  }
6499
6499
  return D;
@@ -6508,7 +6508,7 @@ function ja(m, r) {
6508
6508
  const s = new Uint8Array(m.length + r.length);
6509
6509
  return s.set(m), s.set(r, m.length), s;
6510
6510
  }
6511
- async function pi(m) {
6511
+ async function gi(m) {
6512
6512
  const { sax: r, session: s, store: o, documentId: f, threshold: d } = m;
6513
6513
  if (r.getSize() < d) return 0;
6514
6514
  const v = r.drainBatch(), g = s.resolveChildrenForBatch(v);
@@ -6520,12 +6520,12 @@ async function Ma(m) {
6520
6520
  key: "DOCUMENT_NOT_REGISTERED",
6521
6521
  detail: `Document "${r}" not registered in project "${d}"`
6522
6522
  });
6523
- const D = o[g.document.configKey], R = await f.getByDocumentId(r), K = ca({
6523
+ const D = o[g.document.configKey], R = await f.getByDocumentId(r), K = ua({
6524
6524
  records: R,
6525
6525
  config: D,
6526
6526
  withDatabaseIds: v?.withDatabaseIds
6527
6527
  }), B = `${g.document.name}${g.document.extension}`;
6528
- return v?.withDownload && await sa({
6528
+ return v?.withDownload && await ca({
6529
6529
  extension: g.document.extension,
6530
6530
  xmlDocument: K,
6531
6531
  filename: B
@@ -6617,7 +6617,7 @@ class ts {
6617
6617
  activeTransactions: 0
6618
6618
  };
6619
6619
  const s = Object.keys(r.configs);
6620
- this.storage = r.storage, this.configs = r.configs, this.defaultConfigKey = r.defaultConfigKey ?? s[0], this.mergedExtensions = r.extensions ? bo({
6620
+ this.storage = r.storage, this.configs = r.configs, this.defaultConfigKey = r.defaultConfigKey ?? s[0], this.mergedExtensions = r.extensions ? wo({
6621
6621
  base: r.extensions.base,
6622
6622
  custom: r.extensions.custom
6623
6623
  }) : void 0, this.hooks = r.hooks;
@@ -6650,7 +6650,7 @@ class ts {
6650
6650
  const { type: d } = f.data ?? {};
6651
6651
  (d === "init-empty-document" || d === "document-removed" || d === "document-imported") && this.refreshState();
6652
6652
  };
6653
- const s = ta(r, this.storage, this.configs[this.defaultConfigKey]);
6653
+ const s = na(r, this.storage, this.configs[this.defaultConfigKey]);
6654
6654
  await s.open(), this._store = s;
6655
6655
  const o = await s.getDocuments();
6656
6656
  for (const f of o)
@@ -6740,7 +6740,7 @@ class ts {
6740
6740
  detail: `Document "${r}" not registered in project "${this.name}"`
6741
6741
  });
6742
6742
  const o = this.configs[s.document.configKey];
6743
- return new Go(
6743
+ return new Wo(
6744
6744
  this.store,
6745
6745
  o,
6746
6746
  r,
@@ -6806,47 +6806,47 @@ class ts {
6806
6806
  }
6807
6807
  }
6808
6808
  export {
6809
- Di as A,
6809
+ Si as A,
6810
6810
  Sn as B,
6811
6811
  ai as C,
6812
- ea as D,
6813
- Oi as E,
6812
+ ta as D,
6813
+ Ai as E,
6814
6814
  qa as F,
6815
6815
  La as G,
6816
6816
  Ht as H,
6817
6817
  xt as I,
6818
6818
  Pa as J,
6819
6819
  Ka as K,
6820
- Xo as L,
6820
+ Yo as L,
6821
6821
  si as M,
6822
- ta as N,
6822
+ na as N,
6823
6823
  ts as P,
6824
- Si as Q,
6824
+ ki as Q,
6825
6825
  Ye as T,
6826
- Lo as a,
6826
+ Uo as a,
6827
6827
  oi as b,
6828
- Go as c,
6829
- ha as d,
6828
+ Wo as c,
6829
+ ma as d,
6830
6830
  ft as e,
6831
6831
  ze as f,
6832
- Wo as g,
6833
- Mi as h,
6834
- $o as i,
6832
+ Xo as g,
6833
+ Ki as h,
6834
+ Go as i,
6835
6835
  Rn as j,
6836
- ca as k,
6837
- sa as l,
6836
+ ua as k,
6837
+ ca as l,
6838
6838
  Ma as m,
6839
- bi as n,
6839
+ wi as n,
6840
6840
  Er as o,
6841
6841
  wr as p,
6842
- aa as q,
6843
- xi as r,
6844
- Ti as s,
6845
- Ni as t,
6846
- Ci as u,
6847
- yi as v,
6848
- vi as w,
6849
- oa as x,
6842
+ sa as q,
6843
+ Ti as r,
6844
+ Ni as s,
6845
+ Ci as t,
6846
+ Oi as u,
6847
+ vi as v,
6848
+ bi as w,
6849
+ aa as x,
6850
6850
  me as y,
6851
6851
  Zt as z
6852
6852
  };