@prose-reader/core 1.268.0 → 1.269.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as A, takeUntil as $, Observable as se, defer as Ft, Subject as R, combineLatest as N, merge as x, EMPTY as _, NEVER as he, tap as P, share as j, BehaviorSubject as Y, distinctUntilChanged as k, filter as M, mergeMap as ge, first as V, endWith as ye, catchError as Ue, finalize as pe, lastValueFrom as an, scheduled as cn, animationFrameScheduler as ce, exhaustMap as ze, debounceTime as be, withLatestFrom as z, throttleTime as un, startWith as ne, shareReplay as J, switchScan as ln, defaultIfEmpty as dn, forkJoin as pn, delay as xe, timer as Te, skip as Lt, ReplaySubject as ot, identity as Pe, reduce as gn, concatMap as st } from "rxjs";
1
+ import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as A, takeUntil as $, Observable as se, defer as Ft, Subject as R, combineLatest as O, merge as P, EMPTY as _, NEVER as he, tap as x, share as j, BehaviorSubject as Y, distinctUntilChanged as k, filter as M, mergeMap as ge, first as V, endWith as ye, catchError as Ue, finalize as pe, lastValueFrom as an, scheduled as cn, animationFrameScheduler as ce, exhaustMap as ze, debounceTime as be, withLatestFrom as z, throttleTime as un, startWith as ne, shareReplay as J, switchScan as ln, defaultIfEmpty as dn, forkJoin as pn, delay as Pe, timer as Te, skip as Lt, ReplaySubject as ot, identity as xe, reduce as gn, concatMap as st } from "rxjs";
2
2
  import { Report as hn, isShallowEqual as U, shallowMergeIfDefined as $e, getParentPath as mn, parseContentType as fn, detectMimeTypeFromName as Me, arrayEqual as yn } from "@prose-reader/shared";
3
3
  import { isShallowEqual as or } from "@prose-reader/shared";
4
- import { switchMap as X, first as Mt, map as ie, distinctUntilChanged as fe, startWith as Sn, shareReplay as Ze, tap as O, pairwise as In, take as bn, takeUntil as K, filter as ae, debounceTime as vn, skip as Ct, mergeMap as wn, catchError as rt } from "rxjs/operators";
5
- import { generate as We, parse as Et, isIndirectionOnly as xn, isParsedCfiRange as Pn, resolve as $n } from "@prose-reader/cfi";
4
+ import { switchMap as X, first as Mt, map as ie, distinctUntilChanged as fe, startWith as Sn, shareReplay as Ze, tap as N, pairwise as In, take as bn, takeUntil as K, filter as ae, debounceTime as vn, skip as Ct, mergeMap as wn, catchError as rt } from "rxjs/operators";
5
+ import { generate as We, parse as Et, isIndirectionOnly as Pn, isParsedCfiRange as xn, resolve as $n } from "@prose-reader/cfi";
6
6
  const Tn = "@prose-reader/core", D = hn.namespace(Tn, void 0, {
7
7
  color: "#98cde7"
8
8
  }), Fn = [
@@ -134,7 +134,7 @@ const En = (n, e) => {
134
134
  // JavaScript files
135
135
  ].join(",");
136
136
  return Array.from(n?.querySelectorAll(e) || []);
137
- }, On = (n) => {
137
+ }, Nn = (n) => {
138
138
  if (Rt(n).forEach((t) => {
139
139
  const i = t.getAttribute("src") || t.getAttribute("href");
140
140
  i?.startsWith("blob:") && n?.defaultView?.URL.revokeObjectURL(i);
@@ -161,7 +161,7 @@ function At(n, e, t = []) {
161
161
  return !1;
162
162
  return !0;
163
163
  }
164
- function Ot(n) {
164
+ function Nt(n) {
165
165
  return At(
166
166
  n,
167
167
  ["nodeType"],
@@ -169,8 +169,8 @@ function Ot(n) {
169
169
  // biome-ignore lint/suspicious/noExplicitAny: TODO
170
170
  ) && n.nodeType === Node.ELEMENT_NODE;
171
171
  }
172
- function Nn(n, e) {
173
- return Ot(n) && n.tagName.toLowerCase() === e.toLowerCase();
172
+ function On(n, e) {
173
+ return Nt(n) && n.tagName.toLowerCase() === e.toLowerCase();
174
174
  }
175
175
  function Vn(n) {
176
176
  return At(
@@ -395,13 +395,13 @@ const Ce = (n, e, t, i) => {
395
395
  });
396
396
  }
397
397
  ), t;
398
- }, Nt = (n) => ie((e) => Object.entries(e).reduce(
398
+ }, Ot = (n) => ie((e) => Object.entries(e).reduce(
399
399
  (t, [i, o]) => n.includes(i) ? {
400
400
  ...t,
401
401
  [i]: o
402
402
  } : t,
403
403
  {}
404
- )), Qe = (n) => (e) => e.pipe(Nt(n), fe(U));
404
+ )), Qe = (n) => (e) => e.pipe(Ot(n), fe(U));
405
405
  function et(n) {
406
406
  return new se((e) => {
407
407
  const t = new ResizeObserver((i) => {
@@ -469,7 +469,7 @@ class jt {
469
469
  this.outputSettings = this.computeOutputSettings(i), this.inputSettings = $e(
470
470
  this.getDefaultSettings(),
471
471
  e
472
- ), this.outputSettingsUpdateSubject = new R(), this.values$ = N([
472
+ ), this.outputSettingsUpdateSubject = new R(), this.values$ = O([
473
473
  this.settingsManager.values$,
474
474
  this.outputSettingsUpdateSubject.pipe(Sn(this.outputSettings))
475
475
  ]).pipe(
@@ -583,7 +583,7 @@ const Gn = (n) => (e) => {
583
583
  );
584
584
  return c.values$.pipe(
585
585
  d,
586
- O(l),
586
+ N(l),
587
587
  $(a.$.destroy$)
588
588
  ).subscribe(), {
589
589
  ...a,
@@ -615,7 +615,7 @@ const Gn = (n) => (e) => {
615
615
  );
616
616
  return i(document).pipe($(t.$.destroy$)).subscribe(), t.spineItemsManager.items$.pipe(
617
617
  w(
618
- (o) => x(
618
+ (o) => P(
619
619
  ...o.map(
620
620
  (s) => s.watch("isLoaded").pipe(
621
621
  w(() => {
@@ -630,7 +630,7 @@ const Gn = (n) => (e) => {
630
630
  ).subscribe(), t;
631
631
  }, Jn = (n) => n.spine.spineItemsManager.items$.pipe(
632
632
  w(
633
- (e) => x(
633
+ (e) => P(
634
634
  ...e.map((t) => t.watch("isLoaded").pipe(
635
635
  w(() => {
636
636
  const i = t.renderer.getDocumentFrame();
@@ -640,12 +640,12 @@ const Gn = (n) => (e) => {
640
640
  ).map(
641
641
  (r) => q(r, "click")
642
642
  );
643
- return x(...s);
643
+ return P(...s);
644
644
  })
645
645
  ))
646
646
  )
647
647
  ),
648
- P((e) => {
648
+ x((e) => {
649
649
  e.preventDefault();
650
650
  }),
651
651
  j()
@@ -705,7 +705,7 @@ const Le = class Le extends Q {
705
705
  }).filter(
706
706
  (l) => l instanceof se
707
707
  );
708
- return N([v(null), ...u]).pipe(V());
708
+ return O([v(null), ...u]).pipe(V());
709
709
  })
710
710
  ))),
711
711
  S(() => {
@@ -719,13 +719,13 @@ const Le = class Le extends Q {
719
719
  ge(() => this.value.state === "unloading" || this.value.state === "idle" ? _ : (this.next({ state: "unloading", error: void 0 }), this.context.bridgeEvent.viewportFree$.pipe(
720
720
  V(),
721
721
  w(() => (this.hookManager.destroy("item.onDocumentLoad", this.item.id), this.onUnload().pipe(ye(null), V()))),
722
- P(() => {
722
+ x(() => {
723
723
  this.next({ state: "idle", error: void 0 });
724
724
  }),
725
725
  $(i)
726
726
  )))
727
727
  );
728
- x(this.loaded$, o).pipe(
728
+ P(this.loaded$, o).pipe(
729
729
  Ue((s) => (this.next({ state: "error", error: s }), _)),
730
730
  $(this.destroy$)
731
731
  ).subscribe();
@@ -922,10 +922,10 @@ const kt = (n, e) => {
922
922
  n
923
923
  )
924
924
  );
925
- return N(a).pipe(S(() => o));
925
+ return O(a).pipe(S(() => o));
926
926
  })
927
927
  ), ni = (n) => {
928
- On(n?.contentDocument);
928
+ Nn(n?.contentDocument);
929
929
  }, Gs = "@prose-reader/core", Zs = 0, Js = 200, ii = [".xhtml", ".html", ".htm"], W = "prose-reader", Ut = `${W}-style`, oi = `data-${W}-id`, si = `${W}-viewport`, ri = `${W}-scroll-navigator`, ai = async (n, e) => {
930
930
  if (typeof n == "string") return n;
931
931
  const t = fn(n.headers.get("Content-Type") || "") || Me(e.href);
@@ -986,7 +986,7 @@ const kt = (n, e) => {
986
986
  throw new Error("Invalid resource");
987
987
  return A(t(a));
988
988
  }),
989
- P((a) => {
989
+ x((a) => {
990
990
  if (a) {
991
991
  const c = new Blob([a], { type: "text/html" }), u = URL.createObjectURL(c);
992
992
  o?.setAttribute("src", u);
@@ -1342,7 +1342,7 @@ class Si extends Se {
1342
1342
  settings: this.settings
1343
1343
  }),
1344
1344
  De(this.context.bridgeEvent.viewportFree$),
1345
- P(() => {
1345
+ x(() => {
1346
1346
  this.attach();
1347
1347
  }),
1348
1348
  kn,
@@ -1481,7 +1481,7 @@ class C {
1481
1481
  this.__symbol = /* @__PURE__ */ Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
1482
1482
  }
1483
1483
  }
1484
- class Oe {
1484
+ class Ne {
1485
1485
  constructor(e) {
1486
1486
  this.__symbol = /* @__PURE__ */ Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
1487
1487
  }
@@ -1528,10 +1528,10 @@ const wi = (n, e) => {
1528
1528
  x: u / a,
1529
1529
  y: l / c
1530
1530
  };
1531
- }, xi = (n, e) => new ue(
1531
+ }, Pi = (n, e) => new ue(
1532
1532
  wi(n, e)
1533
- ), Pi = (n) => ({
1534
- getSpinePositionFromClientPosition: (e) => n.spine.element ? xi(e, n.spine.element) : void 0
1533
+ ), xi = (n) => ({
1534
+ getSpinePositionFromClientPosition: (e) => n.spine.element ? Pi(e, n.spine.element) : void 0
1535
1535
  }), $i = (n) => {
1536
1536
  let e;
1537
1537
  const t = n.context.watch("rootElement").pipe(
@@ -1546,14 +1546,14 @@ const wi = (n, e) => {
1546
1546
  e?.remove(), e = void 0;
1547
1547
  })) : he)
1548
1548
  ), i = (c) => cn(c, ce).pipe(
1549
- O(() => {
1549
+ N(() => {
1550
1550
  e?.style.setProperty(
1551
1551
  "visibility",
1552
1552
  "hidden"
1553
1553
  );
1554
1554
  })
1555
1555
  ), o = n.context.bridgeEvent.viewportBusy$.pipe(
1556
- O(() => {
1556
+ N(() => {
1557
1557
  e?.style.setProperty(
1558
1558
  "visibility",
1559
1559
  "visible"
@@ -1570,7 +1570,7 @@ const wi = (n, e) => {
1570
1570
  ),
1571
1571
  K(n.$.destroy$)
1572
1572
  );
1573
- return x(t, a);
1573
+ return P(t, a);
1574
1574
  }, Ti = `${W}-enhancer-loading`, Ht = `${Ti}-container`, Fi = ({
1575
1575
  container: n,
1576
1576
  item: e,
@@ -1608,7 +1608,7 @@ const wi = (n, e) => {
1608
1608
  `, i.appendChild(o), i.appendChild(s), i;
1609
1609
  }, Li = (n) => n.spineItemsManager.items$.pipe(
1610
1610
  X(
1611
- (e) => x(
1611
+ (e) => P(
1612
1612
  ...e.map((t) => {
1613
1613
  t.containerElement.style.zIndex = "0";
1614
1614
  const i = t.containerElement.querySelector(
@@ -1618,9 +1618,9 @@ const wi = (n, e) => {
1618
1618
  item: t.item,
1619
1619
  viewport: n.viewport
1620
1620
  });
1621
- return t.containerElement.appendChild(o), x(
1621
+ return t.containerElement.appendChild(o), P(
1622
1622
  t.pipe(
1623
- O((s) => {
1623
+ N((s) => {
1624
1624
  if (o.style.setProperty(
1625
1625
  "visibility",
1626
1626
  s.isReady ? "hidden" : "visible"
@@ -1635,8 +1635,8 @@ const wi = (n, e) => {
1635
1635
  }
1636
1636
  })
1637
1637
  ),
1638
- N([n.spine.layout$, n.theme.$.theme$]).pipe(
1639
- O(([, s]) => {
1638
+ O([n.spine.layout$, n.theme.$.theme$]).pipe(
1639
+ N(([, s]) => {
1640
1640
  const r = n.viewport.absoluteViewport.width;
1641
1641
  o.style.setProperty(
1642
1642
  "max-width",
@@ -1674,10 +1674,10 @@ const wi = (n, e) => {
1674
1674
  );
1675
1675
  }, Ei = (n) => n.spineItemsManager.items$.pipe(
1676
1676
  w(
1677
- (e) => x(
1677
+ (e) => P(
1678
1678
  ...e.map(
1679
1679
  (t) => t.pipe(
1680
- P((i) => {
1680
+ x((i) => {
1681
1681
  t.containerElement.dataset.isDirty = i.iDirty.toString(), t.containerElement.dataset.isReady = i.isReady.toString();
1682
1682
  })
1683
1683
  )
@@ -1711,11 +1711,11 @@ let Di = class extends jt {
1711
1711
  };
1712
1712
  }
1713
1713
  };
1714
- const Ri = (n) => N([
1714
+ const Ri = (n) => O([
1715
1715
  n.viewport.watch(["width", "height"]),
1716
1716
  n.context.watch("manifest")
1717
1717
  ]).pipe(
1718
- P(([{ width: e, height: t }, i]) => {
1718
+ x(([{ width: e, height: t }, i]) => {
1719
1719
  const o = e > t;
1720
1720
  return !o && i?.renditionSpread === "portrait" ? n.settings.update({ spreadMode: !0 }) : o && (i?.renditionSpread === void 0 || i?.renditionSpread === "auto" || i?.renditionSpread === "landscape" || i?.renditionSpread === "both") ? n.settings.update({ spreadMode: !0 }) : n.settings.update({ spreadMode: !1 });
1721
1721
  })
@@ -1783,7 +1783,7 @@ const Ri = (n) => N([
1783
1783
  });
1784
1784
  const c = r.spineItemsObserver.itemIsReady$.pipe(
1785
1785
  ae(({ isReady: m }) => m),
1786
- O(({ item: m }) => {
1786
+ N(({ item: m }) => {
1787
1787
  const y = m.renderer.documentContainer;
1788
1788
  y && (y.style.opacity = "1");
1789
1789
  })
@@ -1794,13 +1794,13 @@ const Ri = (n) => N([
1794
1794
  X((m) => et(m)),
1795
1795
  vn(100),
1796
1796
  ae(Z),
1797
- O(() => {
1797
+ N(() => {
1798
1798
  r?.layout();
1799
1799
  })
1800
1800
  ), l = $i(r);
1801
1801
  a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1802
1802
  Ct(1),
1803
- O(() => {
1803
+ N(() => {
1804
1804
  r.layout();
1805
1805
  }),
1806
1806
  K(r.$.destroy$)
@@ -1808,7 +1808,7 @@ const Ri = (n) => N([
1808
1808
  const d = r.spine.pages.pipe(
1809
1809
  Ze({ refCount: !0, bufferSize: 1 })
1810
1810
  ), p = Ei(r), g = Ri(r), h = Li(r);
1811
- return x(
1811
+ return P(
1812
1812
  c,
1813
1813
  l,
1814
1814
  u,
@@ -1824,10 +1824,10 @@ const Ri = (n) => N([
1824
1824
  settings: a,
1825
1825
  layout$: r.spine.layout$,
1826
1826
  layoutInfo$: d,
1827
- coordinates: Pi(r)
1827
+ coordinates: xi(r)
1828
1828
  };
1829
1829
  };
1830
- class Oi extends Se {
1830
+ class Ni extends Se {
1831
1831
  getImageElement() {
1832
1832
  const e = this.documentContainer;
1833
1833
  if (e instanceof HTMLImageElement)
@@ -1879,12 +1879,12 @@ class Oi extends Se {
1879
1879
  getDocumentFrame() {
1880
1880
  }
1881
1881
  }
1882
- const Ni = (n) => (e) => {
1882
+ const Oi = (n) => (e) => {
1883
1883
  const t = n({
1884
1884
  ...e,
1885
1885
  getRenderer(r) {
1886
1886
  const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Me(r.href))?.startsWith("image/");
1887
- return !a && u ? (l) => new Oi(l) : a;
1887
+ return !a && u ? (l) => new Ni(l) : a;
1888
1888
  }
1889
1889
  }), i = new IntersectionObserver(
1890
1890
  (r) => {
@@ -1935,8 +1935,8 @@ const Ni = (n) => (e) => {
1935
1935
  }
1936
1936
  };
1937
1937
  }, Vi = (n, e) => n.links$.pipe(
1938
- P((t) => {
1939
- if (!Nn(t.target, "a") || t.type !== "click") return;
1938
+ x((t) => {
1939
+ if (!On(t.target, "a") || t.type !== "click") return;
1940
1940
  const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
1941
1941
  n.context.manifest?.spineItems.some(
1942
1942
  (r) => r.href === o
@@ -2393,7 +2393,7 @@ class Bi extends G {
2393
2393
  const i = this.scrollNavigationController.userScroll$.pipe(
2394
2394
  ze((o) => {
2395
2395
  const s = this.locker.lock();
2396
- return x(
2396
+ return P(
2397
2397
  this.scrollNavigationController.userScroll$,
2398
2398
  v(o)
2399
2399
  ).pipe(
@@ -2402,7 +2402,7 @@ class Bi extends G {
2402
2402
  ce
2403
2403
  ),
2404
2404
  V(),
2405
- P(() => {
2405
+ x(() => {
2406
2406
  const r = this.scrollNavigationController.fromScrollPosition(
2407
2407
  this.scrollNavigationController.scrollPosition
2408
2408
  );
@@ -2418,7 +2418,7 @@ class Bi extends G {
2418
2418
  );
2419
2419
  })
2420
2420
  );
2421
- x(i).pipe($(this.destroy$)).subscribe();
2421
+ P(i).pipe($(this.destroy$)).subscribe();
2422
2422
  }
2423
2423
  }
2424
2424
  const Xi = (n) => n.pagination.state$.pipe(
@@ -2447,14 +2447,14 @@ const Xi = (n) => n.pagination.state$.pipe(
2447
2447
  i?.(), i = void 0;
2448
2448
  };
2449
2449
  return t.pipe(
2450
- P(() => {
2450
+ x(() => {
2451
2451
  i || (i = n?.navigation.lock());
2452
2452
  }),
2453
2453
  un(e, ce, {
2454
2454
  trailing: !0,
2455
2455
  leading: !0
2456
2456
  }),
2457
- P(o),
2457
+ x(o),
2458
2458
  pe(o)
2459
2459
  );
2460
2460
  }, qi = (n) => (e) => {
@@ -2462,11 +2462,11 @@ const Xi = (n) => n.pagination.state$.pipe(
2462
2462
  t.navigation.scrollNavigationController,
2463
2463
  t.navigation.locker
2464
2464
  ), a = Vi(t, o), c = r.navigation$.pipe(
2465
- P((d) => {
2465
+ x((d) => {
2466
2466
  t.navigation.navigate(d);
2467
2467
  })
2468
2468
  );
2469
- return x(a, c).pipe($(t.$.destroy$)).subscribe(), {
2469
+ return P(a, c).pipe($(t.$.destroy$)).subscribe(), {
2470
2470
  ...t,
2471
2471
  load: (d) => {
2472
2472
  const { cfi: p, ...g } = d;
@@ -2622,7 +2622,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2622
2622
  // hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
2623
2623
  // numberOfSpineItems: context.manifest?.readingOrder.length,
2624
2624
  });
2625
- }, io = (n) => N([
2625
+ }, io = (n) => O([
2626
2626
  n.pagination.state$,
2627
2627
  // Usually pagination change if layout changes (number of pages) however it is especially
2628
2628
  // useful for like webtoon where you still have one page but only the layout will give you the final size
@@ -2655,7 +2655,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2655
2655
  endChapterInfo: void 0,
2656
2656
  endSpineItemReadingDirection: void 0,
2657
2657
  percentageEstimateOfBook: 0
2658
- }), o = N([
2658
+ }), o = O([
2659
2659
  n.pagination.state$,
2660
2660
  e,
2661
2661
  io(n)
@@ -2675,7 +2675,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2675
2675
  ),
2676
2676
  k(U)
2677
2677
  );
2678
- return { paginationInfo$: N([
2678
+ return { paginationInfo$: O([
2679
2679
  o,
2680
2680
  t
2681
2681
  ]).pipe(
@@ -2691,7 +2691,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2691
2691
  r.endPageIndexInSpineItem ?? 0
2692
2692
  )
2693
2693
  })),
2694
- P((r) => {
2694
+ x((r) => {
2695
2695
  i.next(r);
2696
2696
  }),
2697
2697
  J(1)
@@ -2742,9 +2742,9 @@ const Xi = (n) => n.pagination.state$.pipe(
2742
2742
  item: e
2743
2743
  }), Qs = (n) => n.index.toString(), gt = (n) => n[0]?.index === 6 && n.length > 1, Xe = (n) => {
2744
2744
  const e = Et(n);
2745
- return xn(e);
2745
+ return Pn(e);
2746
2746
  }, ro = (n) => Array.isArray(n) ? n[0] && gt(n[0]) ? n[0] : void 0 : n.parent[0] && gt(n.parent[0]) ? n.parent[0] : void 0, it = (n) => {
2747
- const e = Et(n), s = ((ro(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = Pn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2747
+ const e = Et(n), s = ((ro(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = xn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2748
2748
  return {
2749
2749
  isCfiRange: r,
2750
2750
  itemIndex: s,
@@ -2896,7 +2896,7 @@ class uo {
2896
2896
  }
2897
2897
  locateResource(e, t) {
2898
2898
  return Array.isArray(e) ? ct(
2899
- () => N(
2899
+ () => O(
2900
2900
  e.map((i) => this.locate(i, t ?? {}))
2901
2901
  ).pipe(dn([]))
2902
2902
  ) : this.locate(e, t ?? {});
@@ -2971,7 +2971,7 @@ const lo = (n) => (e) => {
2971
2971
  a(d);
2972
2972
  };
2973
2973
  })
2974
- }), Ne = async (n) => new Promise((e, t) => {
2974
+ }), Oe = async (n) => new Promise((e, t) => {
2975
2975
  const i = window.indexedDB.open(n);
2976
2976
  i.onerror = (o) => {
2977
2977
  t(o);
@@ -2991,7 +2991,7 @@ const lo = (n) => (e) => {
2991
2991
  }, o = async (c, u) => {
2992
2992
  const l = i(c);
2993
2993
  if (!l) return new Response("Item not found", { status: 404 });
2994
- const p = await (await Ne("prose-reader")).get(`${e}_${l.id}`);
2994
+ const p = await (await Oe("prose-reader")).get(`${e}_${l.id}`);
2995
2995
  if (p)
2996
2996
  return new Response(p, { status: 200 });
2997
2997
  const g = u && await u(l) || await fetch(l.href);
@@ -3003,7 +3003,7 @@ const lo = (n) => (e) => {
3003
3003
  wn(({ id: c, data: u }) => {
3004
3004
  const l = i(c);
3005
3005
  return l ? A(
3006
- pn([Ne("prose-reader"), A(u.blob())])
3006
+ pn([Oe("prose-reader"), A(u.blob())])
3007
3007
  ).pipe(
3008
3008
  X(([d, p]) => A(d.put(`${e}_${l.id}`, p))),
3009
3009
  rt((d) => (D.error(d), _))
@@ -3012,12 +3012,12 @@ const lo = (n) => (e) => {
3012
3012
  K(n.destroy$)
3013
3013
  ).subscribe();
3014
3014
  const r = n.manifest$.pipe(
3015
- O(() => {
3015
+ N(() => {
3016
3016
  e = Date.now().toString();
3017
3017
  })
3018
3018
  );
3019
- return x(r).pipe(
3020
- X(() => (D.debug("Cleanup up old cache..."), A(Ne("prose-reader")).pipe(
3019
+ return P(r).pipe(
3020
+ X(() => (D.debug("Cleanup up old cache..."), A(Oe("prose-reader")).pipe(
3021
3021
  X(
3022
3022
  (c) => A(c.keys()).pipe(
3023
3023
  ie(
@@ -3113,16 +3113,16 @@ class yo extends G {
3113
3113
  )
3114
3114
  )
3115
3115
  ) : v(null);
3116
- this.selectionChange$ = x(
3116
+ this.selectionChange$ = P(
3117
3117
  q(t, "selectionchange"),
3118
3118
  i
3119
3119
  ).pipe(
3120
3120
  S(() => t.getSelection()),
3121
- $(x(o, this.destroy$)),
3121
+ $(P(o, this.destroy$)),
3122
3122
  ye(null)
3123
3123
  ), this.selectionOver$ = q(t, "pointerdown").pipe(
3124
3124
  w(
3125
- () => x(
3125
+ () => P(
3126
3126
  q(t, "pointerup"),
3127
3127
  q(t, "pointercancel"),
3128
3128
  q(t, "contextmenu")
@@ -3132,7 +3132,7 @@ class yo extends G {
3132
3132
  * The selection is still valid during the event even if it will
3133
3133
  * be discarded. The timeout make sure to detect this edge case.
3134
3134
  */
3135
- xe(0),
3135
+ Pe(0),
3136
3136
  S((s) => {
3137
3137
  const r = t.getSelection();
3138
3138
  return r && !r.isCollapsed ? [s, r] : void 0;
@@ -3140,7 +3140,7 @@ class yo extends G {
3140
3140
  M(Z)
3141
3141
  )
3142
3142
  ),
3143
- $(x(o, this.destroy$))
3143
+ $(P(o, this.destroy$))
3144
3144
  );
3145
3145
  }
3146
3146
  }
@@ -3150,7 +3150,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3150
3150
  const e = n.renderer.getDocumentFrame(), t = e?.contentDocument || e?.contentWindow?.document;
3151
3151
  if (!e || !t) return he;
3152
3152
  const i = new yo(e);
3153
- return x(
3153
+ return P(
3154
3154
  i.selectionChange$.pipe(
3155
3155
  S((o) => {
3156
3156
  if (o?.toString())
@@ -3193,11 +3193,11 @@ const So = (n) => n.watch("isLoaded").pipe(
3193
3193
  })
3194
3194
  );
3195
3195
  });
3196
- return x(...d);
3196
+ return P(...d);
3197
3197
  }),
3198
3198
  ne(void 0),
3199
3199
  k(),
3200
- P((l) => {
3200
+ x((l) => {
3201
3201
  i = l;
3202
3202
  }),
3203
3203
  J({ refCount: !0, bufferSize: 1 })
@@ -3222,7 +3222,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3222
3222
  ne(void 0),
3223
3223
  J({ refCount: !0, bufferSize: 1 })
3224
3224
  );
3225
- return x(s, u).pipe($(t.$.destroy$)).subscribe(), {
3225
+ return P(s, u).pipe($(t.$.destroy$)).subscribe(), {
3226
3226
  ...t,
3227
3227
  selection: {
3228
3228
  selection$: s,
@@ -3291,14 +3291,14 @@ const So = (n) => n.watch("isLoaded").pipe(
3291
3291
  u && oe(u, "prose-reader-theme", o());
3292
3292
  }
3293
3293
  }), t.spineItemsManager.items$.pipe(
3294
- O(
3294
+ N(
3295
3295
  (a) => a.map(
3296
3296
  ({ element: c }) => s({ container: c })
3297
3297
  )
3298
3298
  ),
3299
3299
  K(t.$.destroy$)
3300
3300
  ).subscribe(), i.pipe(
3301
- O(() => {
3301
+ N(() => {
3302
3302
  r();
3303
3303
  }),
3304
3304
  K(t.$.destroy$)
@@ -3319,7 +3319,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3319
3319
  return {
3320
3320
  ...t,
3321
3321
  utils: {
3322
- isOrIsWithinValidLink: (s) => !!(Ot(s) && (s.nodeName === "a" ? s : s.closest("a"))?.getAttribute("href")),
3322
+ isOrIsWithinValidLink: (s) => !!(Nt(s) && (s.nodeName === "a" ? s : s.closest("a"))?.getAttribute("href")),
3323
3323
  injectScopedCSS: (s, r, a) => {
3324
3324
  const c = a.replace("${id}", t.id);
3325
3325
  return Ce(s, `${r}-${t.id}`, c);
@@ -3328,7 +3328,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3328
3328
  };
3329
3329
  };
3330
3330
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3331
- const wo = (n) => (e) => n(e), xo = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}", mt = (n, e, t) => {
3331
+ const wo = (n) => (e) => n(e), Po = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}", mt = (n, e, t) => {
3332
3332
  const { clientWidth: i, clientHeight: o } = t.value.element, s = {
3333
3333
  maxX: 0,
3334
3334
  minX: i * (1 - e),
@@ -3339,7 +3339,7 @@ const wo = (n) => (e) => n(e), xo = "[data-prose-reader-scroll-navigator][data-p
3339
3339
  x: Math.min(Math.max(n.x, s.minX), s.maxX),
3340
3340
  y: Math.min(Math.max(n.y, s.minY), s.maxY)
3341
3341
  };
3342
- }, Po = (n, e, t) => {
3342
+ }, xo = (n, e, t) => {
3343
3343
  t.style.transformOrigin = "0 0";
3344
3344
  const i = `translate3d(${e.x}px, ${e.y}px, 0px)`, o = `scale(${n})`;
3345
3345
  t.style.transform = `${i} ${o}`;
@@ -3377,33 +3377,33 @@ class Fo extends Q {
3377
3377
  top: g.y,
3378
3378
  behavior: "instant"
3379
3379
  }), Te(1).pipe(
3380
- P(() => {
3380
+ x(() => {
3381
3381
  this.scrollingSubject.next(!1);
3382
3382
  }),
3383
- $(x(this.scrollingSubject.pipe(Lt(1)), this.destroy$))
3383
+ $(P(this.scrollingSubject.pipe(Lt(1)), this.destroy$))
3384
3384
  ).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3385
3385
  };
3386
3386
  const r = this.context.pipe(
3387
3387
  Qe(["rootElement"]),
3388
- P(({ rootElement: d }) => {
3388
+ x(({ rootElement: d }) => {
3389
3389
  if (!d) return;
3390
3390
  const p = document.createElement("div");
3391
3391
  p.setAttribute(`data-${ri}`, ""), p.appendChild(this.viewport.value.element), d.appendChild(p), this.update({ element: p });
3392
3392
  })
3393
- ), a = N([
3393
+ ), a = O([
3394
3394
  t.watch(["computedPageTurnMode"]),
3395
3395
  this.watch("element")
3396
3396
  ]).pipe(
3397
- P(([{ computedPageTurnMode: d }, p]) => {
3397
+ x(([{ computedPageTurnMode: d }, p]) => {
3398
3398
  p && (d === "scrollable" ? p.style.display = "block" : p.style.display = "contents");
3399
3399
  })
3400
- ), c = this.navigateSubject.pipe(P(this.setViewportPosition));
3400
+ ), c = this.navigateSubject.pipe(x(this.setViewportPosition));
3401
3401
  this.isNavigating$ = this.navigateSubject.pipe(
3402
3402
  ne(!1),
3403
- w(() => x(v(!0), v(!1))),
3403
+ w(() => P(v(!0), v(!1))),
3404
3404
  J(1)
3405
3405
  );
3406
- const u = x(
3406
+ const u = P(
3407
3407
  o.element$.pipe(
3408
3408
  M(Z),
3409
3409
  w((d) => et(d))
@@ -3422,7 +3422,7 @@ class Fo extends Q {
3422
3422
  ),
3423
3423
  k(),
3424
3424
  ne(!1)
3425
- ), l = N([
3425
+ ), l = O([
3426
3426
  u,
3427
3427
  this.isScrolling$
3428
3428
  ]).pipe(
@@ -3447,7 +3447,7 @@ class Fo extends Q {
3447
3447
  )
3448
3448
  ),
3449
3449
  j()
3450
- ), x(r, a, c).pipe($(this.destroy$)).subscribe();
3450
+ ), P(r, a, c).pipe($(this.destroy$)).subscribe();
3451
3451
  }
3452
3452
  update(e) {
3453
3453
  this.mergeCompare(e);
@@ -3523,7 +3523,7 @@ class Co extends Q {
3523
3523
  currentScale: 1,
3524
3524
  currentPosition: { x: 0, y: 0 }
3525
3525
  }), this.updateZoom(s), s !== 1 && this.isControlled ? Te(o?.animate ? we : 0).pipe(
3526
- P(() => {
3526
+ x(() => {
3527
3527
  this.reader.layout();
3528
3528
  })
3529
3529
  ) : _;
@@ -3542,7 +3542,7 @@ class Co extends Q {
3542
3542
  ), o?.animate && this.isControlled && (s.style.transition = `transform ${we}ms`), this.updateZoom(1, { x: 0, y: 0 }), s.style.transform = "", this.mergeCompare({
3543
3543
  isZooming: !1
3544
3544
  }), Te(o?.animate ? we : 0).pipe(
3545
- P(() => {
3545
+ x(() => {
3546
3546
  const r = this.reader.viewport.value.element;
3547
3547
  r.style.transformOrigin = "", r.style.transition = "", this.isControlled && this.reader.layout();
3548
3548
  }),
@@ -3550,7 +3550,7 @@ class Co extends Q {
3550
3550
  );
3551
3551
  })
3552
3552
  );
3553
- x(t, i).pipe($(this.destroy$)).subscribe();
3553
+ P(t, i).pipe($(this.destroy$)).subscribe();
3554
3554
  }
3555
3555
  enter(e) {
3556
3556
  this.enterSubject.next(e);
@@ -3588,7 +3588,7 @@ class Co extends Q {
3588
3588
  });
3589
3589
  }
3590
3590
  applyZoom(e, t) {
3591
- this.isControlled ? Po(
3591
+ this.isControlled ? xo(
3592
3592
  e,
3593
3593
  t,
3594
3594
  this.viewport.element
@@ -3606,7 +3606,7 @@ class Co extends Q {
3606
3606
  }
3607
3607
  const yt = `${Ut}-enhancer-zoom`, Eo = (n) => (e) => {
3608
3608
  const t = n(e), i = new Co(t);
3609
- Ce(document, yt, xo);
3609
+ Ce(document, yt, Po);
3610
3610
  const o = () => {
3611
3611
  Ee(document, yt), i.destroy(), t.destroy();
3612
3612
  }, s = i;
@@ -3672,7 +3672,7 @@ class Ao extends Q {
3672
3672
  supportedPageTurnMode: ["controlled", "scrollable"],
3673
3673
  supportedPageTurnDirection: ["horizontal", "vertical"],
3674
3674
  supportedComputedPageTurnDirection: ["horizontal", "vertical"]
3675
- }), N([
3675
+ }), O([
3676
3676
  e.watch(["manifest", "hasVerticalWriting"]),
3677
3677
  t.watch(["computedPageTurnMode"])
3678
3678
  ]).pipe(
@@ -3700,7 +3700,7 @@ class Ao extends Q {
3700
3700
  ).subscribe(this.next.bind(this));
3701
3701
  }
3702
3702
  }
3703
- class Oo {
3703
+ class No {
3704
3704
  constructor() {
3705
3705
  this._hooks = [], this._hookExecutions = [];
3706
3706
  }
@@ -3759,10 +3759,10 @@ class Oo {
3759
3759
  (r) => !o.includes(r)
3760
3760
  );
3761
3761
  const s = o.map(({ destroyFn: r }) => r());
3762
- return N(s);
3762
+ return O(s);
3763
3763
  }
3764
3764
  }
3765
- const No = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position:relative;overflow-y:scroll;overflow-x:hidden}[data-prose-reader-viewport]{background-color:#fff;position:relative;height:100%;width:100%}", Vo = (n) => ({
3765
+ const Oo = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position:relative;overflow-y:scroll;overflow-x:hidden}[data-prose-reader-viewport]{background-color:#fff;position:relative;height:100%;width:100%}", Vo = (n) => ({
3766
3766
  x: -n.x,
3767
3767
  y: -n.y
3768
3768
  }), jo = (n) => n instanceof DOMMatrix ? new L({
@@ -3780,7 +3780,7 @@ class Uo extends G {
3780
3780
  const r = this.spine.element$.pipe(
3781
3781
  M(Z),
3782
3782
  z(this.element$),
3783
- P(([l, d]) => {
3783
+ x(([l, d]) => {
3784
3784
  d.style.cssText = `
3785
3785
  height: 100%;
3786
3786
  width: 100%;
@@ -3791,22 +3791,22 @@ class Uo extends G {
3791
3791
  "computedPageTurnDirection",
3792
3792
  "computedPageTurnMode",
3793
3793
  "numberOfAdjacentSpineItemToPreLoad"
3794
- ]), c = N([
3794
+ ]), c = O([
3795
3795
  a,
3796
3796
  this.element$
3797
3797
  ]).pipe(
3798
- P(([, l]) => {
3798
+ x(([, l]) => {
3799
3799
  e.values.computedPageTurnMode === "scrollable" ? l.style.display = "contents" : l.style.display = "block";
3800
3800
  })
3801
3801
  );
3802
3802
  this.layout$ = c.pipe(
3803
- P(() => {
3803
+ x(() => {
3804
3804
  St.info("layout", e.values);
3805
3805
  }),
3806
3806
  j()
3807
3807
  );
3808
3808
  const u = this.navigateSubject.pipe(
3809
- P((l) => {
3809
+ x((l) => {
3810
3810
  St.info("Navigation requested", l);
3811
3811
  })
3812
3812
  );
@@ -3819,7 +3819,7 @@ class Uo extends G {
3819
3819
  })),
3820
3820
  w((l) => {
3821
3821
  const d = this.element$.getValue();
3822
- return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"), x(
3822
+ return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"), P(
3823
3823
  v(!0),
3824
3824
  v(null).pipe(
3825
3825
  ge(() => {
@@ -3834,8 +3834,8 @@ class Uo extends G {
3834
3834
  * anything for x ms while we effectively adjust. We want it to be immediate.
3835
3835
  * However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
3836
3836
  */
3837
- l.shouldAnimate ? xe(1, ce) : Pe,
3838
- P((h) => {
3837
+ l.shouldAnimate ? Pe(1, ce) : xe,
3838
+ x((h) => {
3839
3839
  const m = this.element$.getValue();
3840
3840
  h.shouldAnimate ? g === "fade" ? (m.style.setProperty(
3841
3841
  "transition",
@@ -3853,16 +3853,16 @@ class Uo extends G {
3853
3853
  * need to adjust to anchor to the payload position. This is because we use viewport computed position,
3854
3854
  * not the value set by `setProperty`
3855
3855
  */
3856
- P((h) => {
3856
+ x((h) => {
3857
3857
  g !== "fade" && this.setViewportPosition(h.position);
3858
3858
  }),
3859
- l.shouldAnimate ? xe(p / 2, ce) : Pe,
3860
- P((h) => {
3859
+ l.shouldAnimate ? Pe(p / 2, ce) : xe,
3860
+ x((h) => {
3861
3861
  const m = this.element$.getValue();
3862
3862
  g === "fade" && (this.setViewportPosition(h.position), m.style.setProperty("opacity", "1"));
3863
3863
  }),
3864
- l.shouldAnimate ? xe(p / 2, ce) : Pe,
3865
- P((h) => {
3864
+ l.shouldAnimate ? Pe(p / 2, ce) : xe,
3865
+ x((h) => {
3866
3866
  g === "fade" && this.setViewportPosition(h.position);
3867
3867
  })
3868
3868
  );
@@ -3873,7 +3873,7 @@ class Uo extends G {
3873
3873
  }),
3874
3874
  ne(!1),
3875
3875
  J(1)
3876
- ), x(r, this.isNavigating$, this.layout$).pipe($(this.destroy$)).subscribe();
3876
+ ), P(r, this.isNavigating$, this.layout$).pipe($(this.destroy$)).subscribe();
3877
3877
  }
3878
3878
  /**
3879
3879
  * Programmatically set the viewport position.
@@ -4456,7 +4456,7 @@ class es extends G {
4456
4456
  w(([f, I]) => {
4457
4457
  const b = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || I;
4458
4458
  return v(f).pipe(
4459
- b ? Pe : vt({
4459
+ b ? xe : vt({
4460
4460
  navigationResolver: r,
4461
4461
  settings: e,
4462
4462
  spine: a,
@@ -4493,7 +4493,7 @@ class es extends G {
4493
4493
  );
4494
4494
  }),
4495
4495
  j()
4496
- ), d = x(
4496
+ ), d = P(
4497
4497
  o.layout$,
4498
4498
  a.layout$
4499
4499
  ).pipe(
@@ -4516,10 +4516,10 @@ class es extends G {
4516
4516
  * it has been controlled outside.
4517
4517
  */
4518
4518
  $(
4519
- x(l, u)
4519
+ P(l, u)
4520
4520
  )
4521
4521
  ))
4522
- ), p = x(
4522
+ ), p = P(
4523
4523
  d,
4524
4524
  l
4525
4525
  ).pipe(
@@ -4568,12 +4568,12 @@ class es extends G {
4568
4568
  t,
4569
4569
  this.navigationSubject,
4570
4570
  a
4571
- ), h = x(
4571
+ ), h = P(
4572
4572
  p,
4573
4573
  u,
4574
4574
  g
4575
4575
  ), m = (f) => f.pipe(
4576
- P(([I, b]) => {
4576
+ x(([I, b]) => {
4577
4577
  Qo.info(
4578
4578
  `navigation updated from ${I.meta.triggeredBy} of type ${I.type}`,
4579
4579
  {
@@ -4583,7 +4583,7 @@ class es extends G {
4583
4583
  ), this.navigationSubject.next(I);
4584
4584
  })
4585
4585
  ), y = (f) => f.pipe(
4586
- P(([I, b]) => {
4586
+ x(([I, b]) => {
4587
4587
  const F = I.type === "scroll", T = I.meta.triggeredBy === "pagination", E = I.meta.triggeredBy === "restoration", H = U(
4588
4588
  b.position,
4589
4589
  I.position
@@ -4647,7 +4647,7 @@ const Fe = (n, e, t) => {
4647
4647
  pageHeight: o,
4648
4648
  pageTurnDirection: s,
4649
4649
  pageTurnMode: r
4650
- }) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Ye(n, o) : Ye(e, i), xt = ({
4650
+ }) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Ye(n, o) : Ye(e, i), Pt = ({
4651
4651
  itemWidth: n,
4652
4652
  itemHeight: e,
4653
4653
  position: t,
@@ -4735,7 +4735,7 @@ const Fe = (n, e, t) => {
4735
4735
  pageIndex: a,
4736
4736
  viewport: t
4737
4737
  }),
4738
- getSpineItemPageIndexFromPosition: (a) => xt({
4738
+ getSpineItemPageIndexFromPosition: (a) => Pt({
4739
4739
  ...a,
4740
4740
  isRTL: n.isRTL(),
4741
4741
  pageWidth: t.pageSize.width,
@@ -4745,7 +4745,7 @@ const Fe = (n, e, t) => {
4745
4745
  }),
4746
4746
  getSpineItemPageIndexFromNode: (a, c, u) => {
4747
4747
  const l = i(a, c, u), { height: d, width: p } = u.layout.layoutInfo;
4748
- return l ? xt({
4748
+ return l ? Pt({
4749
4749
  isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
4750
4750
  position: l,
4751
4751
  itemHeight: d,
@@ -4780,7 +4780,7 @@ const Fe = (n, e, t) => {
4780
4780
  c,
4781
4781
  d
4782
4782
  );
4783
- return new Oe({
4783
+ return new Ne({
4784
4784
  x: a.x,
4785
4785
  y: a.y - y
4786
4786
  });
@@ -4788,12 +4788,12 @@ const Fe = (n, e, t) => {
4788
4788
  const m = Fe(p, c, l);
4789
4789
  if (n.isRTL()) {
4790
4790
  const y = l - (c + 1) * p;
4791
- return new Oe({
4791
+ return new Ne({
4792
4792
  x: a.x - Math.max(0, y),
4793
4793
  y: a.y
4794
4794
  });
4795
4795
  }
4796
- return new Oe({
4796
+ return new Ne({
4797
4797
  x: a.x - m,
4798
4798
  y: a.y
4799
4799
  });
@@ -4853,7 +4853,7 @@ function Qt({
4853
4853
  y: u
4854
4854
  });
4855
4855
  }
4856
- const Pt = ({
4856
+ const xt = ({
4857
4857
  position: n,
4858
4858
  isRTL: e,
4859
4859
  pageSizeHeight: t,
@@ -5136,7 +5136,7 @@ const Pt = ({
5136
5136
  viewport: s
5137
5137
  }),
5138
5138
  getMostPredominantNavigationForPosition: (g) => {
5139
- const h = i.values.computedPageTurnDirection, m = 0.5, y = h === "horizontal" ? g.x + s.absoluteViewport.width * m : 0, f = h === "horizontal" ? 0 : g.y + s.absoluteViewport.height * m, I = Pt({
5139
+ const h = i.values.computedPageTurnDirection, m = 0.5, y = h === "horizontal" ? g.x + s.absoluteViewport.width * m : 0, f = h === "horizontal" ? 0 : g.y + s.absoluteViewport.height * m, I = xt({
5140
5140
  position: new L({
5141
5141
  x: y,
5142
5142
  y: f
@@ -5154,7 +5154,7 @@ const Pt = ({
5154
5154
  viewport: s
5155
5155
  });
5156
5156
  },
5157
- fromUnboundSpinePosition: (g) => Pt({
5157
+ fromUnboundSpinePosition: (g) => xt({
5158
5158
  position: g,
5159
5159
  isRTL: n.isRTL(),
5160
5160
  pageSizeHeight: s.pageSize.height,
@@ -5214,7 +5214,7 @@ const Pt = ({
5214
5214
  u,
5215
5215
  i,
5216
5216
  c.isLocked$
5217
- ), g = N([
5217
+ ), g = O([
5218
5218
  l.isNavigating$,
5219
5219
  d.isNavigating$,
5220
5220
  c.isLocked$,
@@ -5269,7 +5269,7 @@ class hs extends Q {
5269
5269
  class ms extends G {
5270
5270
  constructor(e, t, i, o, s) {
5271
5271
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spine = o, this.spineItemLocator = s;
5272
- const r = x(
5272
+ const r = P(
5273
5273
  this.context.bridgeEvent.navigation$,
5274
5274
  o.layout$
5275
5275
  ).pipe(
@@ -5285,7 +5285,7 @@ class ms extends G {
5285
5285
  return this.context.bridgeEvent.navigationUnlocked$.pipe(
5286
5286
  Tt(1),
5287
5287
  z(this.context.bridgeEvent.navigation$),
5288
- P(([, u]) => {
5288
+ x(([, u]) => {
5289
5289
  const { position: l } = u, d = this.pagination.value, {
5290
5290
  beginIndex: p,
5291
5291
  endIndex: g
@@ -5317,7 +5317,7 @@ class ms extends G {
5317
5317
  })
5318
5318
  ), a = r.pipe(
5319
5319
  De(this.context.bridgeEvent.viewportFree$),
5320
- P(() => {
5320
+ x(() => {
5321
5321
  const {
5322
5322
  beginSpineItemIndex: c,
5323
5323
  endSpineItemIndex: u,
@@ -5341,7 +5341,7 @@ class ms extends G {
5341
5341
  });
5342
5342
  })
5343
5343
  );
5344
- x(r, a).pipe($(this.destroy$)).subscribe();
5344
+ P(r, a).pipe($(this.destroy$)).subscribe();
5345
5345
  }
5346
5346
  }
5347
5347
  const fs = ({
@@ -5385,7 +5385,7 @@ class ys extends G {
5385
5385
  }
5386
5386
  watch(e) {
5387
5387
  return this.values$.pipe(
5388
- Nt(e),
5388
+ Ot(e),
5389
5389
  k(U)
5390
5390
  );
5391
5391
  }
@@ -5396,7 +5396,7 @@ class ys extends G {
5396
5396
  class Ss extends ys {
5397
5397
  constructor(e, t) {
5398
5398
  super(e), this.context = t, t.watch(["manifest", "hasVerticalWriting"]).pipe(
5399
- P(() => this.update(this.values)),
5399
+ x(() => this.update(this.values)),
5400
5400
  $(this.destroy$)
5401
5401
  ).subscribe();
5402
5402
  }
@@ -5503,7 +5503,7 @@ class bs extends G {
5503
5503
  minimumWidth: l,
5504
5504
  spreadPosition: d
5505
5505
  });
5506
- return x(
5506
+ return P(
5507
5507
  v({ type: "start" }),
5508
5508
  p.pipe(
5509
5509
  this.applyDimsAfterLayout(c),
@@ -5580,7 +5580,7 @@ class en extends Q {
5580
5580
  this.viewport
5581
5581
  );
5582
5582
  const l = this.renderer.state$.pipe(
5583
- O(({ state: p, error: g }) => {
5583
+ N(({ state: p, error: g }) => {
5584
5584
  this.mergeCompare({
5585
5585
  isLoaded: p === "loaded",
5586
5586
  isError: p === "error",
@@ -5588,14 +5588,14 @@ class en extends Q {
5588
5588
  });
5589
5589
  })
5590
5590
  ), d = this.layout.layout$.pipe(
5591
- O(() => {
5591
+ N(() => {
5592
5592
  this.mergeCompare({
5593
5593
  iDirty: !1,
5594
5594
  isReady: this.renderer.state$.value.state === "loaded"
5595
5595
  });
5596
5596
  })
5597
5597
  );
5598
- this.needsLayout$ = x(this.unloaded$, this.loaded$), x(
5598
+ this.needsLayout$ = P(this.unloaded$, this.loaded$), P(
5599
5599
  /**
5600
5600
  * @important
5601
5601
  * The order is important here. We want to ensure the state value
@@ -5667,13 +5667,15 @@ const vs = (n, e, t) => {
5667
5667
  };
5668
5668
  class ws extends G {
5669
5669
  constructor(e, t, i, o, s) {
5670
- super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new Y([]);
5670
+ super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new Y(
5671
+ /* @__PURE__ */ new Map()
5672
+ );
5671
5673
  const r = this.forcedOpenSubject.pipe(
5672
- S((u) => [...new Set(u.flat())].sort()),
5674
+ S((u) => Array.from(u.keys()).sort((l, d) => l - d)),
5673
5675
  k(yn),
5674
5676
  J({ bufferSize: 1, refCount: !0 })
5675
5677
  );
5676
- x(
5678
+ P(
5677
5679
  this.context.bridgeEvent.navigation$,
5678
5680
  this.spineLayout.layout$,
5679
5681
  r,
@@ -5702,14 +5704,16 @@ class ws extends G {
5702
5704
  }
5703
5705
  forceOpen(e) {
5704
5706
  const t = e.map(
5705
- (i) => typeof i == "number" ? i : i.index
5706
- );
5707
- return this.forcedOpenSubject.next([...this.forcedOpenSubject.value, t]), () => {
5708
- this.isDestroyed || this.forcedOpenSubject.next(
5709
- this.forcedOpenSubject.value.filter(
5710
- (i) => i !== t
5711
- )
5712
- );
5707
+ (o) => typeof o == "number" ? o : o.index
5708
+ ), i = (o) => {
5709
+ const s = this.forcedOpenSubject.value;
5710
+ t.forEach((r) => {
5711
+ const a = s.get(r) || 0, c = o ? a + 1 : a - 1;
5712
+ c <= 0 ? s.delete(r) : s.set(r, c);
5713
+ }), this.forcedOpenSubject.next(s);
5714
+ };
5715
+ return i(!0), () => {
5716
+ this.isDestroyed || i(!1);
5713
5717
  };
5714
5718
  }
5715
5719
  destroy() {
@@ -5741,12 +5745,12 @@ class Ie extends DOMRect {
5741
5745
  return new Ie(i.x, i.y, i.width, i.height);
5742
5746
  }
5743
5747
  }
5744
- class xs {
5748
+ class Ps {
5745
5749
  constructor({ width: e, height: t }) {
5746
5750
  this.__symbol = /* @__PURE__ */ Symbol("AbsoluteViewport"), this.width = e, this.height = t;
5747
5751
  }
5748
5752
  }
5749
- class Ps {
5753
+ class xs {
5750
5754
  constructor({ width: e, height: t }) {
5751
5755
  this.__symbol = /* @__PURE__ */ Symbol("RelativeViewport"), this.width = e, this.height = t;
5752
5756
  }
@@ -6105,7 +6109,7 @@ class Ds extends Q {
6105
6109
  },
6106
6110
  []
6107
6111
  );
6108
- return N(
6112
+ return O(
6109
6113
  c.map((l) => {
6110
6114
  const { spineItem: d, ...p } = l;
6111
6115
  return new se((g) => {
@@ -6132,7 +6136,7 @@ class Rs extends G {
6132
6136
  const o = i.map(
6133
6137
  (s) => s.isReady$.pipe(S((r) => ({ item: s, isReady: r })))
6134
6138
  );
6135
- return x(...o);
6139
+ return P(...o);
6136
6140
  }),
6137
6141
  j()
6138
6142
  ), this.itemResize$ = this.spineItemsManager.items$.pipe(
@@ -6142,7 +6146,7 @@ class Rs extends G {
6142
6146
  S((r) => ({ entries: r, item: s }))
6143
6147
  )
6144
6148
  );
6145
- return x(...o);
6149
+ return P(...o);
6146
6150
  }),
6147
6151
  j()
6148
6152
  );
@@ -6218,22 +6222,22 @@ const As = ({
6218
6222
  })
6219
6223
  );
6220
6224
  };
6221
- class Os extends G {
6225
+ class Ns extends G {
6222
6226
  constructor(e, t, i, o) {
6223
6227
  super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new R(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
6224
- P(() => {
6228
+ x(() => {
6225
6229
  this.spineItemsRelativeLayouts = [];
6226
6230
  }),
6227
6231
  w((r) => {
6228
6232
  const a = r.map(
6229
6233
  (u) => u.needsLayout$.pipe(
6230
- P(() => {
6234
+ x(() => {
6231
6235
  this.layout();
6232
6236
  })
6233
6237
  )
6234
6238
  ), c = r.map(
6235
6239
  (u) => u.loaded$.pipe(
6236
- P(() => {
6240
+ x(() => {
6237
6241
  u.isUsingVerticalWriting() ? this.context.update({
6238
6242
  hasVerticalWriting: !0
6239
6243
  }) : this.context.update({
@@ -6242,12 +6246,12 @@ class Os extends G {
6242
6246
  })
6243
6247
  )
6244
6248
  );
6245
- return x(...a, ...c);
6249
+ return P(...a, ...c);
6246
6250
  })
6247
6251
  ).pipe($(this.destroy$)).subscribe();
6248
6252
  const s = new Y(!1);
6249
6253
  this.layout$ = this.layoutSubject.pipe(
6250
- P(() => {
6254
+ x(() => {
6251
6255
  this.spineItemsManager.items.forEach((r) => {
6252
6256
  r.markDirty();
6253
6257
  });
@@ -6300,7 +6304,7 @@ class Os extends G {
6300
6304
  );
6301
6305
  }),
6302
6306
  j()
6303
- ), x(this.layout$).pipe($(this.destroy$)).subscribe();
6307
+ ), P(this.layout$).pipe($(this.destroy$)).subscribe();
6304
6308
  }
6305
6309
  layout() {
6306
6310
  this.layoutSubject.next(void 0);
@@ -6325,11 +6329,11 @@ class Os extends G {
6325
6329
  super.destroy(), this.layoutSubject.complete();
6326
6330
  }
6327
6331
  }
6328
- class Ns extends G {
6332
+ class Os extends G {
6329
6333
  constructor(e, t, i, o, s, r, a) {
6330
6334
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spineItemLocator = o, this.settings = s, this.hookManager = r, this.viewport = a, this.elementSubject = new Y(
6331
6335
  void 0
6332
- ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Os(
6336
+ ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Ns(
6333
6337
  i,
6334
6338
  e,
6335
6339
  s,
@@ -6360,18 +6364,18 @@ class Ns extends G {
6360
6364
  );
6361
6365
  const c = e.watch("rootElement").pipe(
6362
6366
  ae(Z),
6363
- O((l) => {
6367
+ N((l) => {
6364
6368
  const d = l.ownerDocument.createElement("div");
6365
6369
  d.style.cssText = `
6366
6370
  height: 100%;
6367
6371
  position: relative;
6368
6372
  `, d.className = `${W}-spine`, this.elementSubject.next(d);
6369
6373
  })
6370
- ), u = N([
6374
+ ), u = O([
6371
6375
  this.context.manifest$,
6372
6376
  this.element$
6373
6377
  ]).pipe(
6374
- O(([l, d]) => {
6378
+ N(([l, d]) => {
6375
6379
  if (!d) return;
6376
6380
  this.spineItemsManager.destroyItems();
6377
6381
  const p = l.spineItems.map(
@@ -6388,7 +6392,7 @@ class Ns extends G {
6388
6392
  this.spineItemsManager.addMany(p);
6389
6393
  })
6390
6394
  );
6391
- x(u, c).pipe(K(this.destroy$)).subscribe();
6395
+ P(u, c).pipe(K(this.destroy$)).subscribe();
6392
6396
  }
6393
6397
  get element() {
6394
6398
  return this.elementSubject.getValue();
@@ -6462,17 +6466,17 @@ class js extends Q {
6462
6466
  height: 1
6463
6467
  }), this.context = e, this.settingsManager = t;
6464
6468
  const o = this.settingsManager.watch(["computedSpreadMode"]).pipe(
6465
- P(() => {
6469
+ x(() => {
6466
6470
  this.mergeCompare({
6467
6471
  pageSize: this.calculatePageSize(this.value)
6468
6472
  });
6469
6473
  })
6470
6474
  ), s = this.context.watch("rootElement").pipe(
6471
- P(() => {
6475
+ x(() => {
6472
6476
  this.layout();
6473
6477
  })
6474
6478
  );
6475
- x(o, s).pipe($(this.destroy$)).subscribe();
6479
+ P(o, s).pipe($(this.destroy$)).subscribe();
6476
6480
  }
6477
6481
  calculatePageSize(e) {
6478
6482
  const { computedSpreadMode: t } = this.settingsManager.values;
@@ -6492,7 +6496,7 @@ class js extends Q {
6492
6496
  });
6493
6497
  }
6494
6498
  get absoluteViewport() {
6495
- return new xs({
6499
+ return new Ps({
6496
6500
  width: this.value.width,
6497
6501
  height: this.value.height
6498
6502
  });
@@ -6520,18 +6524,18 @@ class js extends Q {
6520
6524
  */
6521
6525
  get relativeViewport() {
6522
6526
  const e = this.absoluteViewport, t = this.scaleFactor;
6523
- return new Ps({
6527
+ return new xs({
6524
6528
  width: e.width / t,
6525
6529
  height: e.height / t
6526
6530
  });
6527
6531
  }
6528
6532
  }
6529
6533
  const $t = `${Ut}-core`, ks = (n) => {
6530
- const e = crypto.randomUUID(), t = new R(), i = new R(), o = new Oo(), s = new Ro(), r = new Ss(n, s), a = new Ao(s, r), c = new Vs(s, r), u = new js(s, r), l = Kt({
6534
+ const e = crypto.randomUUID(), t = new R(), i = new R(), o = new No(), s = new Ro(), r = new Ss(n, s), a = new Ao(s, r), c = new Vs(s, r), u = new js(s, r), l = Kt({
6531
6535
  context: s,
6532
6536
  settings: r,
6533
6537
  viewport: u
6534
- }), d = new hs(s, c), p = new Ns(
6538
+ }), d = new hs(s, c), p = new Os(
6535
6539
  s,
6536
6540
  d,
6537
6541
  c,
@@ -6570,14 +6574,14 @@ const $t = `${Ut}-core`, ks = (n) => {
6570
6574
  manifest: H,
6571
6575
  rootElement: B
6572
6576
  }), m();
6573
- }, f = r.watch(["computedSpreadMode"]).pipe(Ct(1), O(m)), I = t.pipe(
6574
- O(() => {
6577
+ }, f = r.watch(["computedSpreadMode"]).pipe(Ct(1), N(m)), I = t.pipe(
6578
+ N(() => {
6575
6579
  const T = s.value.rootElement;
6576
6580
  T && (T.style.setProperty("overflow", "hidden"), u.layout(), p.layout());
6577
6581
  }),
6578
6582
  K(i)
6579
- ), b = x(I, f).subscribe();
6580
- Ce(document, $t, No);
6583
+ ), b = P(I, f).subscribe();
6584
+ Ce(document, $t, Oo);
6581
6585
  const F = () => {
6582
6586
  Ee(document, $t), b.unsubscribe(), c.destroy(), h.destroy(), r.destroy(), d.destroy(), s.destroy(), g.destroy(), p.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
6583
6587
  };
@@ -6644,7 +6648,7 @@ const $t = `${Ut}-core`, ks = (n) => {
6644
6648
  Eo(
6645
6649
  qi(
6646
6650
  Ii(
6647
- Ni(
6651
+ Oi(
6648
6652
  Wn(
6649
6653
  Xn(
6650
6654
  lo(
@@ -6681,7 +6685,7 @@ export {
6681
6685
  ri as HTML_PREFIX_SCROLL_NAVIGATOR,
6682
6686
  si as HTML_PREFIX_VIEWPORT,
6683
6687
  Ut as HTML_STYLE_PREFIX,
6684
- Oo as HookManager,
6688
+ No as HookManager,
6685
6689
  ii as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6686
6690
  es as InternalNavigator,
6687
6691
  nt as LayoutEntry,
@@ -6697,7 +6701,7 @@ export {
6697
6701
  Fo as ScrollNavigationController,
6698
6702
  ft as ScrollPosition,
6699
6703
  ys as SettingsManager,
6700
- Ns as Spine,
6704
+ Os as Spine,
6701
6705
  en as SpineItem,
6702
6706
  bi as SpineItemPageLayout,
6703
6707
  vi as SpineItemPageSpineLayout,
@@ -6707,7 +6711,7 @@ export {
6707
6711
  Rs as SpineItemsObserver,
6708
6712
  L as SpinePosition,
6709
6713
  To as UnboundScrollPosition,
6710
- Oe as UnboundSpineItemPagePosition,
6714
+ Ne as UnboundSpineItemPagePosition,
6711
6715
  ue as UnboundSpinePosition,
6712
6716
  Zs as VIEWPORT_ADJUSTMENT_THROTTLE,
6713
6717
  js as Viewport,
@@ -6726,12 +6730,12 @@ export {
6726
6730
  Vt as idle,
6727
6731
  jn as injectCSSToFrame,
6728
6732
  Z as isDefined,
6729
- Ot as isHtmlElement,
6730
- Nn as isHtmlTagElement,
6733
+ Nt as isHtmlElement,
6734
+ On as isHtmlTagElement,
6731
6735
  Xe as isRootCfi,
6732
6736
  or as isShallowEqual,
6733
6737
  Ai as layoutEnhancer,
6734
- Nt as mapKeysTo,
6738
+ Ot as mapKeysTo,
6735
6739
  Xs as observeIntersection,
6736
6740
  ut as observeMutation,
6737
6741
  et as observeResize,