@prose-reader/core 1.242.0 → 1.243.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 X, take as wt, map as S, from as O, takeUntil as T, Observable as te, defer as ke, Subject as j, combineLatest as k, merge as x, EMPTY as G, withLatestFrom as D, NEVER as pe, tap as $, share as R, BehaviorSubject as W, filter as L, first as U, mergeMap as Pe, endWith as me, finalize as ue, catchError as xt, lastValueFrom as tn, scheduled as nn, animationFrameScheduler as se, exhaustMap as Ue, debounceTime as Se, distinctUntilChanged as z, throttleTime as on, startWith as Q, shareReplay as Z, switchScan as sn, defaultIfEmpty as rn, forkJoin as an, delay as ve, timer as $e, ReplaySubject as it, identity as we, skip as Pt, reduce as cn, concatMap as ot } from "rxjs";
2
- import { Report as un, isShallowEqual as A, shallowMergeIfDefined as xe, getParentPath as ln, parseContentType as pn, detectMimeTypeFromName as Le, arrayEqual as dn } from "@prose-reader/shared";
3
- import { isShallowEqual as Hs } from "@prose-reader/shared";
4
- import { switchMap as H, first as $t, map as J, distinctUntilChanged as le, startWith as gn, shareReplay as Me, tap as V, pairwise as hn, take as mn, takeUntil as Y, filter as oe, debounceTime as fn, skip as Tt, mergeMap as yn, catchError as st } from "rxjs/operators";
5
- import { generate as ze, parse as Ft, isIndirectionOnly as Sn, isParsedCfiRange as bn, resolve as In } from "@prose-reader/cfi";
1
+ import { switchMap as w, of as v, fromEvent as Y, take as wt, map as S, from as N, takeUntil as T, Observable as te, defer as ke, Subject as j, combineLatest as k, merge as x, EMPTY as G, withLatestFrom as D, NEVER as de, tap as P, share as R, BehaviorSubject as W, filter as M, first as U, mergeMap as Pe, endWith as me, finalize as ue, catchError as xt, lastValueFrom as tn, scheduled as nn, animationFrameScheduler as se, exhaustMap as Ue, debounceTime as Se, distinctUntilChanged as z, throttleTime as on, startWith as Q, shareReplay as Z, switchScan as sn, defaultIfEmpty as rn, forkJoin as an, delay as ve, timer as $e, ReplaySubject as it, identity as we, skip as Pt, reduce as cn, concatMap as ot } from "rxjs";
2
+ import { Report as un, isShallowEqual as O, shallowMergeIfDefined as xe, getParentPath as ln, parseContentType as pn, detectMimeTypeFromName as Le, arrayEqual as dn } from "@prose-reader/shared";
3
+ import { isShallowEqual as Gs } from "@prose-reader/shared";
4
+ import { switchMap as _, first as $t, map as J, distinctUntilChanged as le, startWith as gn, shareReplay as Me, tap as V, pairwise as hn, take as mn, takeUntil as q, filter as oe, debounceTime as fn, skip as Tt, mergeMap as yn, catchError as st } from "rxjs/operators";
5
+ import { generate as ze, parse as Ft, isIndirectionOnly as Sn, isParsedCfiRange as In, resolve as bn } from "@prose-reader/cfi";
6
6
  import { isDefined as Ge } from "reactjrx";
7
7
  const rt = (n, e) => {
8
8
  const t = new RegExp(`${e}\\s*=\\s*([0-9.]+)`, "i"), i = n.match(t) || [], o = i[1] || "0";
@@ -11,7 +11,7 @@ const rt = (n, e) => {
11
11
  if (!n?.contentDocument?.head) return;
12
12
  const o = n.contentDocument.createElement("style");
13
13
  o.id = e, o.innerHTML = t, i ? n.contentDocument.head.prepend(o) : n.contentDocument.head.appendChild(o);
14
- }, Ns = (n, e) => {
14
+ }, Os = (n, e) => {
15
15
  if (n?.contentDocument?.head) {
16
16
  const t = n.contentDocument.getElementById(e);
17
17
  t && t.remove();
@@ -43,14 +43,14 @@ const rt = (n, e) => {
43
43
  }
44
44
  return { hasViewport: !1 };
45
45
  }, wn = (n) => n.pipe(
46
- w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : X(e, "load").pipe(
46
+ w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : Y(e, "load").pipe(
47
47
  wt(1),
48
48
  S(() => e)
49
49
  ))
50
50
  ), xn = (n) => n.pipe(
51
51
  w((e) => {
52
52
  const t = e?.contentDocument?.fonts.ready;
53
- return t ? O(t).pipe(S(() => e)) : v(void 0);
53
+ return t ? N(t).pipe(S(() => e)) : v(void 0);
54
54
  })
55
55
  ), Pn = (n) => (e) => {
56
56
  const t = n(e), i = new IntersectionObserver((o) => {
@@ -208,7 +208,7 @@ const En = (n, e) => {
208
208
  return n instanceof e.TouchEvent;
209
209
  }
210
210
  return !1;
211
- }, Nn = () => document.createElement("div"), Mt = (n) => {
211
+ }, An = () => document.createElement("div"), Mt = (n) => {
212
212
  const e = [
213
213
  "img",
214
214
  // Images
@@ -224,7 +224,7 @@ const En = (n, e) => {
224
224
  // JavaScript files
225
225
  ].join(",");
226
226
  return Array.from(n?.querySelectorAll(e) || []);
227
- }, On = (n) => {
227
+ }, Nn = (n) => {
228
228
  if (Mt(n).forEach((t) => {
229
229
  const i = t.getAttribute("src") || t.getAttribute("href");
230
230
  i?.startsWith("blob:") && n?.defaultView?.URL.revokeObjectURL(i);
@@ -259,7 +259,7 @@ function Et(n) {
259
259
  // biome-ignore lint/suspicious/noExplicitAny: TODO
260
260
  ) && n.nodeType === Node.ELEMENT_NODE;
261
261
  }
262
- function An(n, e) {
262
+ function On(n, e) {
263
263
  return Et(n) && n.tagName.toLowerCase() === e.toLowerCase();
264
264
  }
265
265
  function Vn(n) {
@@ -389,7 +389,7 @@ const De = ({
389
389
  [i]: o
390
390
  } : t,
391
391
  {}
392
- )), Ke = (n) => (e) => e.pipe(Dt(n), le(A));
392
+ )), Ke = (n) => (e) => e.pipe(Dt(n), le(O));
393
393
  function Qe(n) {
394
394
  return new te((e) => {
395
395
  const t = new ResizeObserver((i) => {
@@ -401,7 +401,7 @@ function Qe(n) {
401
401
  });
402
402
  }
403
403
  const Ce = (n) => (e) => e.pipe(
404
- H(
404
+ _(
405
405
  (t) => n.pipe(
406
406
  $t(),
407
407
  J(() => t)
@@ -429,7 +429,7 @@ function Rt() {
429
429
  });
430
430
  }
431
431
  function at(n) {
432
- return ke(() => Rt().pipe(H(n)));
432
+ return ke(() => Rt().pipe(_(n)));
433
433
  }
434
434
  const ct = (n, e) => new te((t) => {
435
435
  const i = new MutationObserver((o) => {
@@ -437,7 +437,7 @@ const ct = (n, e) => new te((t) => {
437
437
  });
438
438
  return i.observe(n, e), () => i.disconnect();
439
439
  });
440
- function Os(n, e) {
440
+ function Vs(n, e) {
441
441
  return new te((t) => {
442
442
  const i = new IntersectionObserver((o) => {
443
443
  t.next(o);
@@ -447,7 +447,7 @@ function Os(n, e) {
447
447
  };
448
448
  });
449
449
  }
450
- class Nt {
450
+ class At {
451
451
  constructor(e, t) {
452
452
  this.settingsManager = t;
453
453
  const i = xe(
@@ -488,19 +488,31 @@ class Nt {
488
488
  watch(e) {
489
489
  return Array.isArray(e) ? this.values$.pipe(Ke(e)) : this.values$.pipe(
490
490
  J((t) => t[e]),
491
- le(A)
491
+ le(O)
492
492
  );
493
493
  }
494
494
  destroy() {
495
495
  this.outputSettingsUpdateSubject.complete();
496
496
  }
497
497
  }
498
- let Hn = class extends Nt {
498
+ const js = (n) => {
499
+ const e = new FileReader();
500
+ return new Promise((t) => {
501
+ e.addEventListener(
502
+ "load",
503
+ () => {
504
+ t(e.result);
505
+ },
506
+ !1
507
+ ), e.readAsDataURL(n);
508
+ });
509
+ };
510
+ let _n = class extends At {
499
511
  computeOutputSettings(e) {
500
512
  return e;
501
513
  }
502
514
  hasSettingsChanged(e) {
503
- return !A(this.outputSettings, e);
515
+ return !O(this.outputSettings, e);
504
516
  }
505
517
  getCleanedParentInputSettings(e) {
506
518
  const {
@@ -521,8 +533,8 @@ let Hn = class extends Nt {
521
533
  };
522
534
  }
523
535
  };
524
- const _n = (n) => (e) => {
525
- const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new j(), a = n(e), c = new Hn(
536
+ const Hn = (n) => (e) => {
537
+ const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new j(), a = n(e), c = new _n(
526
538
  {
527
539
  fontScale: t,
528
540
  lineHeight: i,
@@ -569,7 +581,7 @@ const _n = (n) => (e) => {
569
581
  settings: c
570
582
  };
571
583
  }, Bn = (n) => (e) => {
572
- const t = n(e), i = (o) => X(o, "keyup").pipe(
584
+ const t = n(e), i = (o) => Y(o, "keyup").pipe(
573
585
  D(t.settings.values$),
574
586
  S(([s, { pageTurnDirection: r }]) => {
575
587
  if (r === "horizontal") {
@@ -608,23 +620,23 @@ const _n = (n) => (e) => {
608
620
  ...e.map((t) => t.watch("isLoaded").pipe(
609
621
  w(() => {
610
622
  const i = t.renderer.getDocumentFrame();
611
- if (!i || !i?.contentDocument) return pe;
623
+ if (!i || !i?.contentDocument) return de;
612
624
  const s = Array.from(
613
625
  i.contentDocument.querySelectorAll("a")
614
626
  ).map(
615
- (r) => X(r, "click")
627
+ (r) => Y(r, "click")
616
628
  );
617
629
  return x(...s);
618
630
  })
619
631
  ))
620
632
  )
621
633
  ),
622
- $((e) => {
634
+ P((e) => {
623
635
  e.preventDefault();
624
636
  }),
625
637
  R()
626
638
  );
627
- class _ {
639
+ class B {
628
640
  constructor() {
629
641
  this.isDestroyed = !1, this.destroySubject = new j(), this.destroy$ = this.destroySubject.asObservable();
630
642
  }
@@ -632,11 +644,11 @@ class _ {
632
644
  this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
633
645
  }
634
646
  }
635
- const Fe = class Fe extends _ {
647
+ const Fe = class Fe extends B {
636
648
  constructor(e) {
637
649
  super(), this.triggerSubject = new j(), this.stateSubject = new W("idle"), this.unload$ = this.triggerSubject.pipe(
638
650
  D(this.stateSubject),
639
- L(
651
+ M(
640
652
  ([o, s]) => o.type === "unload" && s !== "idle" && s !== "unloading"
641
653
  ),
642
654
  S(() => {
@@ -644,7 +656,7 @@ const Fe = class Fe extends _ {
644
656
  R()
645
657
  ), this.load$ = this.triggerSubject.pipe(
646
658
  D(this.stateSubject),
647
- L(
659
+ M(
648
660
  ([o, s]) => o.type === "load" && s !== "loaded" && s !== "loading"
649
661
  ),
650
662
  S(() => {
@@ -653,7 +665,7 @@ const Fe = class Fe extends _ {
653
665
  ), this.context = e.context, this.settings = e.settings, this.hookManager = e.hookManager, this.item = e.item, this.containerElement = e.containerElement, this.resourcesHandler = e.resourcesHandler, this.viewport = e.viewport;
654
666
  const t = this.triggerSubject.pipe(
655
667
  D(this.stateSubject),
656
- L(
668
+ M(
657
669
  ([o, s]) => o.type === "unload" && s !== "idle" && s !== "unloading"
658
670
  ),
659
671
  S(() => {
@@ -690,11 +702,11 @@ const Fe = class Fe extends _ {
690
702
  const i = t.pipe(
691
703
  w(() => (this.stateSubject.next("unloading"), this.context.bridgeEvent.viewportFree$.pipe(
692
704
  U(),
693
- $(() => {
705
+ P(() => {
694
706
  this.hookManager.destroy("item.onDocumentLoad", this.item.id);
695
707
  }),
696
708
  w(() => this.onUnload().pipe(me(null), U())),
697
- $(() => {
709
+ P(() => {
698
710
  this.stateSubject.next("idle");
699
711
  }),
700
712
  T(this.load$)
@@ -786,7 +798,7 @@ class et {
786
798
  return e instanceof Response ? e : e instanceof URL ? fetch(e) : e;
787
799
  }
788
800
  }
789
- const Ot = (n, e) => {
801
+ const Nt = (n, e) => {
790
802
  const t = n.startsWith("file://"), i = t ? n.replace("file://", "http://") : n, o = new URL(e, i).toString();
791
803
  return t ? o.replace("http://", "file://") : o;
792
804
  }, qn = async (n, e, t, i, o) => {
@@ -806,22 +818,22 @@ const Ot = (n, e) => {
806
818
  return d;
807
819
  const m = d.match(/url\(['"]?([^'"]+)['"]?\)/);
808
820
  if (!m) return d;
809
- const y = m[1] ?? "", f = i.manifest?.items.find(({ href: b }) => `${Ot(t, y).toLowerCase()}`.endsWith(
810
- `${b.toLowerCase()}`
821
+ const y = m[1] ?? "", f = i.manifest?.items.find(({ href: I }) => `${Nt(t, y).toLowerCase()}`.endsWith(
822
+ `${I.toLowerCase()}`
811
823
  ));
812
824
  if (f) {
813
- const b = new et(f, o);
825
+ const I = new et(f, o);
814
826
  try {
815
- const I = await b.getResource();
816
- if (I instanceof Response) {
817
- const P = await I.blob(), C = n.defaultView?.URL.createObjectURL(P);
827
+ const b = await I.getResource();
828
+ if (b instanceof Response) {
829
+ const F = await b.blob(), $ = n.defaultView?.URL.createObjectURL(F);
818
830
  return d.replace(
819
831
  m[0],
820
- `url("${C}")`
832
+ `url("${$}")`
821
833
  );
822
834
  }
823
- } catch (I) {
824
- console.error("Error loading font:", I);
835
+ } catch (b) {
836
+ console.error("Error loading font:", b);
825
837
  }
826
838
  }
827
839
  return d;
@@ -840,14 +852,14 @@ const Ot = (n, e) => {
840
852
  }, Gn = (n, e, t, i, o) => {
841
853
  const s = e.getAttribute("src") || e.getAttribute("href");
842
854
  if (!s) return v(null);
843
- const r = i.manifest?.items.find(({ href: c }) => `${Ot(t, s).toLowerCase()}`.endsWith(
855
+ const r = i.manifest?.items.find(({ href: c }) => `${Nt(t, s).toLowerCase()}`.endsWith(
844
856
  `${c.toLowerCase()}`
845
857
  ));
846
858
  if (!r) return v(null);
847
859
  const a = new et(r, o);
848
- return O(a.getResource()).pipe(
860
+ return N(a.getResource()).pipe(
849
861
  Pe(
850
- (c) => c instanceof Response ? O(c.blob()) : v(void 0)
862
+ (c) => c instanceof Response ? N(c.blob()) : v(void 0)
851
863
  ),
852
864
  Pe((c) => {
853
865
  if (!c)
@@ -894,8 +906,8 @@ const Ot = (n, e) => {
894
906
  return k(a).pipe(S(() => o));
895
907
  })
896
908
  ), Jn = (n) => {
897
- On(n?.contentDocument);
898
- }, Kn = [".xhtml", ".html", ".htm"], ge = "prose-reader", Qn = async (n, e) => {
909
+ Nn(n?.contentDocument);
910
+ }, Us = "@prose-reader/core", zs = 0, Ws = 200, Kn = [".xhtml", ".html", ".htm"], pe = "prose-reader", Qn = `data-${pe}-id`, ei = `${pe}-viewport`, ti = async (n, e) => {
899
911
  if (typeof n == "string") return n;
900
912
  const t = pn(n.headers.get("Content-Type") || "") || Le(e.href);
901
913
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
@@ -933,13 +945,13 @@ const Ot = (n, e) => {
933
945
  </body>
934
946
  </html>
935
947
  ` : await n.text();
936
- }, ei = ({
948
+ }, ni = ({
937
949
  item: n,
938
950
  resourcesHandler: e
939
951
  }) => {
940
- const t = (i) => Qn(i, n);
952
+ const t = (i) => ti(i, n);
941
953
  return (i) => i.pipe(
942
- w((o) => O(e.getResource()).pipe(
954
+ w((o) => N(e.getResource()).pipe(
943
955
  w((s) => s instanceof URL && n.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
944
956
  (n.mediaType && [
945
957
  "application/xhtml+xml",
@@ -949,13 +961,13 @@ const Ot = (n, e) => {
949
961
  ].includes(n.mediaType) || // no encoding ? then try to detect html
950
962
  !n.mediaType && Kn.some(
951
963
  (a) => n.href.endsWith(a)
952
- )) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ? O(e.fetchResource()) : v(s)).pipe(
964
+ )) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ? N(e.fetchResource()) : v(s)).pipe(
953
965
  w((a) => {
954
966
  if (!(a instanceof Response))
955
967
  throw new Error("Invalid resource");
956
- return O(t(a));
968
+ return N(t(a));
957
969
  }),
958
- $((a) => {
970
+ P((a) => {
959
971
  if (a) {
960
972
  const c = new Blob([a], { type: "text/html" }), u = URL.createObjectURL(c);
961
973
  o?.setAttribute("src", u);
@@ -969,7 +981,7 @@ const Ot = (n, e) => {
969
981
  ))
970
982
  ))
971
983
  );
972
- }, ti = () => {
984
+ }, ii = () => {
973
985
  const n = document.createElement("iframe");
974
986
  return n.frameBorder = "no", n.tabIndex = 0, n.setAttribute(
975
987
  "sandbox",
@@ -984,7 +996,7 @@ const Ot = (n, e) => {
984
996
  border: 0px none transparent;
985
997
  padding: 0px;
986
998
  `, n.setAttribute("role", "main"), n;
987
- }, At = () => `
999
+ }, Ot = () => `
988
1000
  body {
989
1001
  margin: 0;
990
1002
  }
@@ -1002,12 +1014,12 @@ const Ot = (n, e) => {
1002
1014
  n / (i.height ?? 1)
1003
1015
  ), computedWidthScale: o, viewportDimensions: i };
1004
1016
  }
1005
- }, ni = ({
1017
+ }, oi = ({
1006
1018
  columnWidth: n,
1007
1019
  enableTouch: e,
1008
1020
  spreadPosition: t
1009
1021
  }, i) => `
1010
- ${At()}
1022
+ ${Ot()}
1011
1023
  body {
1012
1024
  ${i ? "" : `
1013
1025
  display: flex;
@@ -1047,12 +1059,12 @@ const Ot = (n, e) => {
1047
1059
  object-fit:contain;
1048
1060
  `}
1049
1061
  }
1050
- `, ii = ({
1062
+ `, si = ({
1051
1063
  pageHeight: n,
1052
1064
  pageWidth: e
1053
1065
  }) => ({ columnHeight: n, columnWidth: e }), ut = (n, e) => {
1054
1066
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1055
- }, oi = ({
1067
+ }, ri = ({
1056
1068
  minPageSpread: n,
1057
1069
  blankPagePosition: e,
1058
1070
  spreadPosition: t,
@@ -1064,9 +1076,9 @@ const Ot = (n, e) => {
1064
1076
  }) => {
1065
1077
  const c = n * o;
1066
1078
  if (s?.contentDocument && s?.contentWindow) {
1067
- const { viewportDimensions: u, computedScale: l = 1 } = Vt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, p = o, g = i, h = ni(
1079
+ const { viewportDimensions: u, computedScale: l = 1 } = Vt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, p = o, g = i, h = oi(
1068
1080
  {
1069
- ...ii({ pageHeight: i, pageWidth: o }),
1081
+ ...si({ pageHeight: i, pageWidth: o }),
1070
1082
  enableTouch: a,
1071
1083
  spreadPosition: t
1072
1084
  },
@@ -1096,8 +1108,8 @@ const Ot = (n, e) => {
1096
1108
  return { width: c, height: g };
1097
1109
  }
1098
1110
  return { width: c, height: i };
1099
- }, si = () => `
1100
- ${At()}
1111
+ }, ai = () => `
1112
+ ${Ot()}
1101
1113
  html {
1102
1114
  width: 100%;
1103
1115
  height: 100%;
@@ -1111,7 +1123,7 @@ const Ot = (n, e) => {
1111
1123
  html, body {
1112
1124
  touch-action: none;
1113
1125
  }
1114
- `, ri = ({
1126
+ `, ci = ({
1115
1127
  isScrollable: n,
1116
1128
  enableTouch: e
1117
1129
  }) => `
@@ -1136,7 +1148,7 @@ const Ot = (n, e) => {
1136
1148
  display: block;
1137
1149
  }
1138
1150
  ` : ""}
1139
- `, ai = ({
1151
+ `, ui = ({
1140
1152
  width: n,
1141
1153
  columnHeight: e,
1142
1154
  columnWidth: t
@@ -1204,7 +1216,7 @@ const Ot = (n, e) => {
1204
1216
  td {
1205
1217
  max-width: ${t}px;
1206
1218
  }
1207
- `, ci = ({
1219
+ `, li = ({
1208
1220
  isUsingVerticalWriting: n,
1209
1221
  minimumWidth: e,
1210
1222
  pageHeight: t,
@@ -1218,9 +1230,9 @@ const Ot = (n, e) => {
1218
1230
  columnWidth: r,
1219
1231
  width: c
1220
1232
  };
1221
- }, Ie = (n, e) => {
1233
+ }, be = (n, e) => {
1222
1234
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1223
- }, ui = ({
1235
+ }, pi = ({
1224
1236
  pageHeight: n,
1225
1237
  pageWidth: e,
1226
1238
  frameElement: t,
@@ -1245,8 +1257,8 @@ const Ot = (n, e) => {
1245
1257
  ee(
1246
1258
  t,
1247
1259
  "prose-reader-html-renderer-framce-css",
1248
- si()
1249
- ), Ie(t, {
1260
+ ai()
1261
+ ), be(t, {
1250
1262
  width: h.width ?? 1,
1251
1263
  height: h.height ?? 1
1252
1264
  }), t?.style.setProperty("position", "absolute"), t?.style.setProperty("top", "50%"), t?.style.setProperty(
@@ -1257,34 +1269,34 @@ const Ot = (n, e) => {
1257
1269
  `translate(-50%, -50%) scale(${d})`
1258
1270
  ), t?.style.setProperty("transform-origin", "center center");
1259
1271
  else {
1260
- const I = a ? ri({
1272
+ const b = a ? ci({
1261
1273
  isScrollable: i?.renditionFlow === "scrolled-continuous",
1262
1274
  enableTouch: c
1263
- }) : ai(
1264
- ci({
1275
+ }) : ui(
1276
+ li({
1265
1277
  isUsingVerticalWriting: u,
1266
1278
  minimumWidth: l,
1267
1279
  pageHeight: g,
1268
1280
  pageWidth: e
1269
1281
  })
1270
1282
  );
1271
- if (ee(t, "prose-reader-css", I, !0), u)
1283
+ if (ee(t, "prose-reader-css", b, !0), u)
1272
1284
  f = Math.ceil(
1273
1285
  t.contentDocument.documentElement.scrollHeight / g
1274
- ) * g, Ie(t, {
1286
+ ) * g, be(t, {
1275
1287
  width: l,
1276
1288
  height: f
1277
1289
  });
1278
1290
  else if (i?.renditionFlow === "scrolled-continuous")
1279
- f = t.contentDocument.body.scrollHeight, Ie(t, {
1291
+ f = t.contentDocument.body.scrollHeight, be(t, {
1280
1292
  width: l,
1281
1293
  height: f
1282
1294
  });
1283
1295
  else {
1284
- const P = Math.ceil(
1296
+ const F = Math.ceil(
1285
1297
  t.contentDocument.documentElement.scrollWidth / e
1286
1298
  );
1287
- m ? y = e : y = P * e, Ie(t, {
1299
+ m ? y = e : y = F * e, be(t, {
1288
1300
  width: y,
1289
1301
  height: f
1290
1302
  });
@@ -1293,25 +1305,25 @@ const Ot = (n, e) => {
1293
1305
  return y % l === 0 ? t?.style.setProperty("margin-left", "0px") : (y = y + e, s && !u && t?.style.setProperty("margin-left", `${e}px`)), { width: y, height: f };
1294
1306
  }
1295
1307
  };
1296
- class li extends fe {
1308
+ class di extends fe {
1297
1309
  constructor() {
1298
1310
  super(...arguments), this.isImageType = () => !!(this.item.mediaType ?? Le(this.item.href))?.startsWith("image/");
1299
1311
  }
1300
1312
  onCreateDocument() {
1301
- const e = ti();
1313
+ const e = ii();
1302
1314
  return this.setDocumentContainer(e), v(e);
1303
1315
  }
1304
1316
  onLoadDocument() {
1305
1317
  const e = this.getFrameElement();
1306
1318
  if (!e) throw new Error("invalid frame");
1307
1319
  return v(e).pipe(
1308
- ei({
1320
+ ni({
1309
1321
  item: this.item,
1310
1322
  resourcesHandler: this.resourcesHandler,
1311
1323
  settings: this.settings
1312
1324
  }),
1313
1325
  Ce(this.context.bridgeEvent.viewportFree$),
1314
- $(() => {
1326
+ P(() => {
1315
1327
  this.attach();
1316
1328
  }),
1317
1329
  wn,
@@ -1335,7 +1347,7 @@ class li extends fe {
1335
1347
  if (!r) return v(void 0);
1336
1348
  const a = !!this.writingMode?.startsWith("vertical");
1337
1349
  if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated") {
1338
- const u = oi({
1350
+ const u = ri({
1339
1351
  blankPagePosition: t,
1340
1352
  enableTouch: this.settings.values.computedPageTurnMode !== "scrollable",
1341
1353
  frameElement: r,
@@ -1347,7 +1359,7 @@ class li extends fe {
1347
1359
  });
1348
1360
  return v(u);
1349
1361
  }
1350
- const c = ui({
1362
+ const c = pi({
1351
1363
  pageHeight: s,
1352
1364
  pageWidth: o,
1353
1365
  frameElement: r,
@@ -1362,7 +1374,7 @@ class li extends fe {
1362
1374
  return v(c);
1363
1375
  }
1364
1376
  onRenderHeadless() {
1365
- return O(this.resourcesHandler.fetchResource()).pipe(
1377
+ return N(this.resourcesHandler.fetchResource()).pipe(
1366
1378
  w((e) => {
1367
1379
  if (e instanceof Response) {
1368
1380
  const t = e.headers.get("content-type") ?? "";
@@ -1372,7 +1384,7 @@ class li extends fe {
1372
1384
  "text/html",
1373
1385
  "text/xml"
1374
1386
  ].includes(t))
1375
- return O(e.text()).pipe(
1387
+ return N(e.text()).pipe(
1376
1388
  S((o) => new DOMParser().parseFromString(
1377
1389
  o,
1378
1390
  t
@@ -1415,11 +1427,11 @@ class li extends fe {
1415
1427
  return this.getFrameElement();
1416
1428
  }
1417
1429
  }
1418
- const pi = (n) => (e) => {
1430
+ const gi = (n) => (e) => {
1419
1431
  const t = n({
1420
1432
  ...e,
1421
1433
  getRenderer(o) {
1422
- return e.getRenderer?.(o) ?? ((r) => new li(r));
1434
+ return e.getRenderer?.(o) ?? ((r) => new di(r));
1423
1435
  }
1424
1436
  }), i = Xn(t);
1425
1437
  return i.pipe(T(t.$.destroy$)).subscribe(), {
@@ -1435,7 +1447,7 @@ class tt {
1435
1447
  this.left = e.left, this.right = e.right, this.top = e.top, this.bottom = e.bottom, this.width = e.width, this.height = e.height, this.x = e.x, this.y = e.y;
1436
1448
  }
1437
1449
  }
1438
- class M {
1450
+ class C {
1439
1451
  constructor(e) {
1440
1452
  this.__symbol = Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
1441
1453
  }
@@ -1445,17 +1457,17 @@ class Re {
1445
1457
  this.__symbol = Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
1446
1458
  }
1447
1459
  }
1448
- class di extends tt {
1460
+ class hi extends tt {
1449
1461
  constructor() {
1450
1462
  super(...arguments), this.__symbol = "SpineItemPageLayout";
1451
1463
  }
1452
1464
  }
1453
- class He extends tt {
1465
+ class _e extends tt {
1454
1466
  constructor() {
1455
1467
  super(...arguments), this.__symbol = "SpineItemSpineLayout";
1456
1468
  }
1457
1469
  }
1458
- class gi extends tt {
1470
+ class mi extends tt {
1459
1471
  constructor() {
1460
1472
  super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
1461
1473
  }
@@ -1465,12 +1477,12 @@ class jt {
1465
1477
  this.x = e.x, this.y = e.y;
1466
1478
  }
1467
1479
  }
1468
- class F extends jt {
1480
+ class L extends jt {
1469
1481
  constructor() {
1470
1482
  super(...arguments), this.__symbol = "SpinePosition";
1471
1483
  }
1472
1484
  static from(e) {
1473
- return new F(e);
1485
+ return new L(e);
1474
1486
  }
1475
1487
  }
1476
1488
  class he extends jt {
@@ -1481,20 +1493,20 @@ class he extends jt {
1481
1493
  return new he(e);
1482
1494
  }
1483
1495
  }
1484
- const hi = (n, e) => {
1496
+ const fi = (n, e) => {
1485
1497
  const t = e.getBoundingClientRect(), { x: i, y: o } = n, { left: s, top: r } = t, a = t.width / e.offsetWidth, c = t.height / e.offsetHeight, u = i - s, l = o - r;
1486
1498
  return {
1487
1499
  x: u / a,
1488
1500
  y: l / c
1489
1501
  };
1490
- }, mi = (n, e) => new he(
1491
- hi(n, e)
1492
- ), fi = (n) => ({
1493
- getSpinePositionFromClientPosition: (e) => n.spine.element ? mi(e, n.spine.element) : void 0
1494
- }), yi = (n) => {
1502
+ }, yi = (n, e) => new he(
1503
+ fi(n, e)
1504
+ ), Si = (n) => ({
1505
+ getSpinePositionFromClientPosition: (e) => n.spine.element ? yi(e, n.spine.element) : void 0
1506
+ }), Ii = (n) => {
1495
1507
  let e;
1496
1508
  const t = n.context.watch("rootElement").pipe(
1497
- H((c) => c ? new te(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
1509
+ _((c) => c ? new te(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
1498
1510
  position: absolute;
1499
1511
  left: 0;
1500
1512
  top: 0;
@@ -1503,7 +1515,7 @@ const hi = (n, e) => {
1503
1515
  visibility: hidden;
1504
1516
  `, c.appendChild(e), () => {
1505
1517
  e?.remove(), e = void 0;
1506
- })) : pe)
1518
+ })) : de)
1507
1519
  ), i = (c) => nn(c, se).pipe(
1508
1520
  V(() => {
1509
1521
  e?.style.setProperty(
@@ -1524,13 +1536,13 @@ const hi = (n, e) => {
1524
1536
  J(() => n.settings.values.computedPageTurnMode),
1525
1537
  le()
1526
1538
  ).pipe(
1527
- H(
1528
- (c) => c === "controlled" ? o.pipe(H(() => s)) : i(v(void 0))
1539
+ _(
1540
+ (c) => c === "controlled" ? o.pipe(_(() => s)) : i(v(void 0))
1529
1541
  ),
1530
- Y(n.$.destroy$)
1542
+ q(n.$.destroy$)
1531
1543
  );
1532
1544
  return x(t, a);
1533
- }, Si = (n) => {
1545
+ }, bi = (n) => {
1534
1546
  n.hookManager.register(
1535
1547
  "item.onAfterLayout",
1536
1548
  ({ item: e, blankPagePosition: t, minimumWidth: i }) => {
@@ -1547,12 +1559,12 @@ const hi = (n, e) => {
1547
1559
  }
1548
1560
  }
1549
1561
  );
1550
- }, bi = (n) => n.spineItemsManager.items$.pipe(
1562
+ }, vi = (n) => n.spineItemsManager.items$.pipe(
1551
1563
  w(
1552
1564
  (e) => x(
1553
1565
  ...e.map(
1554
1566
  (t) => t.pipe(
1555
- $((i) => {
1567
+ P((i) => {
1556
1568
  t.containerElement.dataset.isDirty = i.iDirty.toString(), t.containerElement.dataset.isReady = i.isReady.toString();
1557
1569
  })
1558
1570
  )
@@ -1560,12 +1572,12 @@ const hi = (n, e) => {
1560
1572
  )
1561
1573
  )
1562
1574
  );
1563
- let Ii = class extends Nt {
1575
+ let wi = class extends At {
1564
1576
  computeOutputSettings(e) {
1565
1577
  return e;
1566
1578
  }
1567
1579
  hasSettingsChanged(e) {
1568
- return !A(this.outputSettings, e);
1580
+ return !O(this.outputSettings, e);
1569
1581
  }
1570
1582
  getCleanedParentInputSettings(e) {
1571
1583
  const {
@@ -1586,21 +1598,21 @@ let Ii = class extends Nt {
1586
1598
  };
1587
1599
  }
1588
1600
  };
1589
- const vi = (n) => k([
1601
+ const xi = (n) => k([
1590
1602
  n.viewport.watch(["width", "height"]),
1591
1603
  n.context.watch("manifest")
1592
1604
  ]).pipe(
1593
- $(([{ width: e, height: t }, i]) => {
1605
+ P(([{ width: e, height: t }, i]) => {
1594
1606
  const o = e > t;
1595
1607
  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 });
1596
1608
  })
1597
- ), wi = (n) => (e) => {
1609
+ ), Pi = (n) => (e) => {
1598
1610
  const {
1599
1611
  pageHorizontalMargin: t,
1600
1612
  pageVerticalMargin: i,
1601
1613
  layoutAutoResize: o,
1602
1614
  layoutLayerTransition: s
1603
- } = e, r = n(e), a = new Ii(
1615
+ } = e, r = n(e), a = new wi(
1604
1616
  {
1605
1617
  pageHorizontalMargin: t,
1606
1618
  pageVerticalMargin: i,
@@ -1616,38 +1628,38 @@ const vi = (n) => k([
1616
1628
  !d && y && (y.getBoundingClientRect().left, d = !0);
1617
1629
  });
1618
1630
  }), r.hookManager.register("item.onBeforeLayout", ({ item: d }) => {
1619
- const m = r.spineItemsManager.get(d.id), f = !!(d.mediaType ?? Le(d.href))?.startsWith("image/"), { pageHorizontalMargin: b = 0, pageVerticalMargin: I = 0 } = a.values, P = r.viewport.pageSize;
1631
+ const m = r.spineItemsManager.get(d.id), f = !!(d.mediaType ?? Le(d.href))?.startsWith("image/"), { pageHorizontalMargin: I = 0, pageVerticalMargin: b = 0 } = a.values, F = r.viewport.pageSize;
1620
1632
  if (m?.renditionLayout === "reflowable" && !f) {
1621
- let C = P.width - b * 2;
1622
- const N = P.height - I * 2;
1623
- let B = P.width - b * 2, q = b * 2;
1624
- m.isUsingVerticalWriting() && (B = P.width - b * 2, C = N, q = I * 2);
1633
+ let $ = F.width - I * 2;
1634
+ const A = F.height - b * 2;
1635
+ let X = F.width - I * 2, H = I * 2;
1636
+ m.isUsingVerticalWriting() && (X = F.width - I * 2, $ = A, H = b * 2);
1625
1637
  const ne = m?.renderer.getDocumentFrame();
1626
1638
  ne && ee(
1627
1639
  ne,
1628
1640
  "prose-layout-enhancer-css",
1629
1641
  `
1630
1642
  body {
1631
- width: ${B}px !important;
1632
- margin: ${I}px ${b}px !important;
1633
- column-gap: ${q}px !important;
1634
- column-width: ${C}px !important;
1635
- height: ${N}px !important;
1643
+ width: ${X}px !important;
1644
+ margin: ${b}px ${I}px !important;
1645
+ column-gap: ${H}px !important;
1646
+ column-width: ${$}px !important;
1647
+ height: ${A}px !important;
1636
1648
  }
1637
1649
  img, video, audio, object, svg {
1638
- -max-width: ${C}px !important;
1639
- -max-height: ${N}px !important;
1650
+ -max-width: ${$}px !important;
1651
+ -max-height: ${A}px !important;
1640
1652
  }
1641
1653
  table {
1642
- max-width: ${C}px !important;
1654
+ max-width: ${$}px !important;
1643
1655
  }
1644
1656
  td {
1645
- max-width: ${C}px;
1657
+ max-width: ${$}px;
1646
1658
  }
1647
1659
  `
1648
1660
  );
1649
1661
  }
1650
- }), Si(r), r.hookManager.register(
1662
+ }), bi(r), r.hookManager.register(
1651
1663
  "item.onDocumentCreated",
1652
1664
  ({ documentContainer: d }) => {
1653
1665
  d.style.opacity = "0", a.values.layoutLayerTransition && (d.style.transition = "opacity 300ms");
@@ -1664,25 +1676,25 @@ const vi = (n) => k([
1664
1676
  })
1665
1677
  ), u = a.values$.pipe(
1666
1678
  oe(({ layoutAutoResize: d }) => d === "container"),
1667
- H(() => r.context.watch("rootElement")),
1679
+ _(() => r.context.watch("rootElement")),
1668
1680
  oe(ce),
1669
- H((d) => Qe(d)),
1681
+ _((d) => Qe(d)),
1670
1682
  fn(100),
1671
1683
  oe(ce),
1672
1684
  V(() => {
1673
1685
  r?.layout();
1674
1686
  })
1675
- ), l = yi(r);
1687
+ ), l = Ii(r);
1676
1688
  a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1677
1689
  Tt(1),
1678
1690
  V(() => {
1679
1691
  r.layout();
1680
1692
  }),
1681
- Y(r.$.destroy$)
1693
+ q(r.$.destroy$)
1682
1694
  ).subscribe();
1683
1695
  const p = r.spine.pages.pipe(
1684
1696
  Me({ refCount: !0, bufferSize: 1 })
1685
- ), g = bi(r), h = vi(r);
1697
+ ), g = vi(r), h = xi(r);
1686
1698
  return x(
1687
1699
  c,
1688
1700
  l,
@@ -1690,7 +1702,7 @@ const vi = (n) => k([
1690
1702
  p,
1691
1703
  g,
1692
1704
  h
1693
- ).pipe(Y(r.$.destroy$)).subscribe(), {
1705
+ ).pipe(q(r.$.destroy$)).subscribe(), {
1694
1706
  ...r,
1695
1707
  destroy: () => {
1696
1708
  a.destroy(), r.destroy();
@@ -1698,9 +1710,9 @@ const vi = (n) => k([
1698
1710
  settings: a,
1699
1711
  layout$: r.spine.layout$,
1700
1712
  layoutInfo$: p,
1701
- coordinates: fi(r)
1713
+ coordinates: Si(r)
1702
1714
  };
1703
- }, xi = `${ge}-enhancer-loading`, kt = `${xi}-container`, Pi = (n, e) => {
1715
+ }, $i = `${pe}-enhancer-loading`, kt = `${$i}-container`, Ti = (n, e) => {
1704
1716
  const t = n.ownerDocument.createElement("div");
1705
1717
  return t.classList.add(kt), t.style.cssText = `
1706
1718
  height: 100%;
@@ -1718,7 +1730,7 @@ const vi = (n) => k([
1718
1730
  background-color: white;
1719
1731
  z-index: 1;
1720
1732
  `, t;
1721
- }, $i = ({
1733
+ }, Fi = ({
1722
1734
  container: n,
1723
1735
  item: e
1724
1736
  }) => {
@@ -1735,8 +1747,8 @@ const vi = (n) => k([
1735
1747
  max-width: 300px;
1736
1748
  width: 80%;
1737
1749
  `, n.appendChild(t), n.appendChild(i), n;
1738
- }, Ti = (n) => (e) => {
1739
- const { loadingElementCreate: t = $i } = e, i = n(e), o = (c) => v(
1750
+ }, Li = (n) => (e) => {
1751
+ const { loadingElementCreate: t = Fi } = e, i = n(e), o = (c) => v(
1740
1752
  c.reduce((u, { item: l, element: p }) => {
1741
1753
  p.style.zIndex = "0";
1742
1754
  const g = p.querySelector(
@@ -1745,7 +1757,7 @@ const vi = (n) => k([
1745
1757
  if (g instanceof HTMLElement)
1746
1758
  return u[l.id] = g, u;
1747
1759
  const h = t({
1748
- container: Pi(p, i.viewport),
1760
+ container: Ti(p, i.viewport),
1749
1761
  item: l
1750
1762
  });
1751
1763
  return p.appendChild(h), u[l.id] = h, u;
@@ -1755,7 +1767,7 @@ const vi = (n) => k([
1755
1767
  width: i.viewport.absoluteViewport.width,
1756
1768
  theme: u
1757
1769
  })),
1758
- le(A),
1770
+ le(O),
1759
1771
  V(({ width: u, theme: l }) => {
1760
1772
  Object.values(c).forEach((p) => {
1761
1773
  p.style.setProperty("max-width", `${u}px`), p.style.setProperty(
@@ -1775,18 +1787,18 @@ const vi = (n) => k([
1775
1787
  );
1776
1788
  })
1777
1789
  ), a = i.spineItemsManager.items$.pipe(
1778
- H((c) => o(c)),
1790
+ _((c) => o(c)),
1779
1791
  Me(1),
1780
- Y(i.context.destroy$)
1792
+ q(i.context.destroy$)
1781
1793
  );
1782
1794
  return a.pipe(
1783
- H(
1795
+ _(
1784
1796
  (c) => x(
1785
1797
  s(c),
1786
1798
  r(c)
1787
1799
  )
1788
1800
  ),
1789
- Y(i.$.destroy$)
1801
+ q(i.$.destroy$)
1790
1802
  ).subscribe(), {
1791
1803
  ...i,
1792
1804
  loading: {
@@ -1796,7 +1808,7 @@ const vi = (n) => k([
1796
1808
  }
1797
1809
  };
1798
1810
  };
1799
- class Fi extends fe {
1811
+ class Mi extends fe {
1800
1812
  getImageElement() {
1801
1813
  const e = this.documentContainer;
1802
1814
  if (e instanceof HTMLImageElement)
@@ -1804,12 +1816,12 @@ class Fi extends fe {
1804
1816
  }
1805
1817
  onCreateDocument() {
1806
1818
  const e = this.containerElement.ownerDocument.createElement("img");
1807
- return O(this.resourcesHandler.getResource()).pipe(
1819
+ return N(this.resourcesHandler.getResource()).pipe(
1808
1820
  w((t) => {
1809
1821
  if (this.setDocumentContainer(e), e.style.objectFit = "contain", e.style.userSelect = "none", t instanceof URL)
1810
1822
  return v(t.href);
1811
1823
  if (t instanceof Response)
1812
- return O(t.blob()).pipe(
1824
+ return N(t.blob()).pipe(
1813
1825
  S((i) => URL.createObjectURL(i))
1814
1826
  );
1815
1827
  throw new Error("Invalid resource");
@@ -1823,7 +1835,7 @@ class Fi extends fe {
1823
1835
  onLoadDocument() {
1824
1836
  const e = this.getImageElement();
1825
1837
  if (!e) throw new Error("invalid element");
1826
- return this.attach(), X(e, "load");
1838
+ return this.attach(), Y(e, "load");
1827
1839
  }
1828
1840
  onUnload() {
1829
1841
  const e = this.getImageElement();
@@ -1848,12 +1860,12 @@ class Fi extends fe {
1848
1860
  getDocumentFrame() {
1849
1861
  }
1850
1862
  }
1851
- const Li = (n) => (e) => {
1863
+ const Ci = (n) => (e) => {
1852
1864
  const t = n({
1853
1865
  ...e,
1854
1866
  getRenderer(r) {
1855
1867
  const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Le(r.href))?.startsWith("image/");
1856
- return !a && u ? (l) => new Fi(l) : a;
1868
+ return !a && u ? (l) => new Mi(l) : a;
1857
1869
  }
1858
1870
  }), i = new IntersectionObserver(
1859
1871
  (r) => {
@@ -1901,26 +1913,26 @@ const Li = (n) => (e) => {
1901
1913
  i.disconnect(), o.disconnect(), t.destroy();
1902
1914
  }
1903
1915
  };
1904
- }, Mi = (n, e) => n.links$.pipe(
1905
- $((t) => {
1906
- if (!An(t.target, "a") || t.type !== "click") return;
1916
+ }, Ei = (n, e) => n.links$.pipe(
1917
+ P((t) => {
1918
+ if (!On(t.target, "a") || t.type !== "click") return;
1907
1919
  const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
1908
1920
  n.context.manifest?.spineItems.some(
1909
1921
  (r) => r.href === o
1910
1922
  ) && e.goToUrl(i);
1911
1923
  })
1912
- ), ie = E.namespace("navigation"), Ci = ({
1924
+ ), ie = E.namespace("navigation"), Di = ({
1913
1925
  position: n,
1914
1926
  spineItem: e,
1915
1927
  pageHeight: t,
1916
1928
  pageWidth: i,
1917
1929
  spineItemLocator: o
1918
1930
  }) => {
1919
- let s = new M({
1931
+ let s = new C({
1920
1932
  x: n.x - i,
1921
1933
  y: n.y
1922
1934
  });
1923
- return e.isUsingVerticalWriting() && (s = new M({
1935
+ return e.isUsingVerticalWriting() && (s = new C({
1924
1936
  x: n.x,
1925
1937
  y: n.y + t
1926
1938
  })), o.getSpineItemClosestPositionFromUnsafePosition(
@@ -1941,7 +1953,7 @@ const Li = (n) => (e) => {
1941
1953
  const u = o.getSpineItemPositionFromSpinePosition(
1942
1954
  n,
1943
1955
  a
1944
- ), l = Ci({
1956
+ ), l = Di({
1945
1957
  position: u,
1946
1958
  spineItem: a,
1947
1959
  pageHeight: s.pageSize.height,
@@ -1955,15 +1967,15 @@ const Li = (n) => (e) => {
1955
1967
  spineItemPosition: l,
1956
1968
  spineItem: a
1957
1969
  }) : e.fromUnboundSpinePosition(
1958
- r === "horizontal" ? new F({
1970
+ r === "horizontal" ? new L({
1959
1971
  x: n.x - s.pageSize.width,
1960
1972
  y: 0
1961
- }) : new F({
1973
+ }) : new L({
1962
1974
  y: n.y - s.pageSize.height,
1963
1975
  x: 0
1964
1976
  })
1965
1977
  );
1966
- }, Ei = ({
1978
+ }, Ri = ({
1967
1979
  position: n,
1968
1980
  spineItem: e,
1969
1981
  context: t,
@@ -2007,18 +2019,18 @@ const Li = (n) => (e) => {
2007
2019
  return i.getAdjustedPositionForSpread(l);
2008
2020
  }
2009
2021
  return i.getAdjustedPositionForSpread(u);
2010
- }, Di = ({
2022
+ }, Ai = ({
2011
2023
  position: n,
2012
2024
  spineItem: e,
2013
2025
  pageHeight: t,
2014
2026
  pageWidth: i,
2015
2027
  spineItemLocator: o
2016
2028
  }) => {
2017
- let s = new M({
2029
+ let s = new C({
2018
2030
  x: n.x + i,
2019
2031
  y: n.y
2020
2032
  });
2021
- return e.isUsingVerticalWriting() && (s = new M({
2033
+ return e.isUsingVerticalWriting() && (s = new C({
2022
2034
  x: n.x,
2023
2035
  y: n.y - t
2024
2036
  })), o.getSpineItemClosestPositionFromUnsafePosition(
@@ -2039,7 +2051,7 @@ const Li = (n) => (e) => {
2039
2051
  const u = o.getSpineItemPositionFromSpinePosition(
2040
2052
  n,
2041
2053
  a
2042
- ), l = Di({
2054
+ ), l = Ai({
2043
2055
  position: u,
2044
2056
  spineItem: a,
2045
2057
  pageHeight: s.pageSize.height,
@@ -2053,15 +2065,15 @@ const Li = (n) => (e) => {
2053
2065
  spineItemPosition: l,
2054
2066
  spineItem: a
2055
2067
  }) : e.fromUnboundSpinePosition(
2056
- r === "horizontal" ? new F({
2068
+ r === "horizontal" ? new L({
2057
2069
  x: n.x + s.pageSize.width,
2058
2070
  y: 0
2059
- }) : new F({
2071
+ }) : new L({
2060
2072
  y: n.y + s.pageSize.height,
2061
2073
  x: 0
2062
2074
  })
2063
2075
  );
2064
- }, Ri = ({
2076
+ }, Ni = ({
2065
2077
  position: n,
2066
2078
  spineItem: e,
2067
2079
  context: t,
@@ -2109,9 +2121,9 @@ const Li = (n) => (e) => {
2109
2121
  }
2110
2122
  return i.getAdjustedPositionForSpread(u);
2111
2123
  };
2112
- class Ni {
2124
+ class Oi {
2113
2125
  constructor(e) {
2114
- this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new F({ x: 0, y: 0 }), this.unlock = void 0;
2126
+ this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new L({ x: 0, y: 0 }), this.unlock = void 0;
2115
2127
  }
2116
2128
  turnRight() {
2117
2129
  return this.turnRightOrBottom();
@@ -2128,7 +2140,7 @@ class Ni {
2128
2140
  turnRightOrBottom() {
2129
2141
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2130
2142
  if (!t) return;
2131
- const i = Ri({
2143
+ const i = Ni({
2132
2144
  context: this.reader.context,
2133
2145
  navigationResolver: this.reader.navigation.navigationResolver,
2134
2146
  position: e.position,
@@ -2146,7 +2158,7 @@ class Ni {
2146
2158
  turnLeftOrTop() {
2147
2159
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2148
2160
  if (!t) return;
2149
- const i = Ei({
2161
+ const i = Ri({
2150
2162
  context: this.reader.context,
2151
2163
  navigationResolver: this.reader.navigation.navigationResolver,
2152
2164
  position: e.position,
@@ -2288,9 +2300,9 @@ class Ni {
2288
2300
  }
2289
2301
  }
2290
2302
  }
2291
- class Oi {
2303
+ class Vi {
2292
2304
  constructor(e) {
2293
- this.reader = e, this.lastDelta = { x: 0, y: 0 }, this.lastPosition = new F({ x: 0, y: 0 }), this.lastStartPosition = new F({ x: 0, y: 0 }), this.unlock = void 0;
2305
+ this.reader = e, this.lastDelta = { x: 0, y: 0 }, this.lastPosition = new L({ x: 0, y: 0 }), this.lastStartPosition = new L({ x: 0, y: 0 }), this.unlock = void 0;
2294
2306
  }
2295
2307
  moveTo(e, { final: t, start: i } = {}) {
2296
2308
  if (this.reader.settings.values.computedPageTurnMode === "scrollable") {
@@ -2308,7 +2320,7 @@ class Oi {
2308
2320
  ), l = Math.floor(
2309
2321
  o === "horizontal" ? 0 : this.lastPosition.y - c / r
2310
2322
  );
2311
- s = new F({
2323
+ s = new L({
2312
2324
  x: u,
2313
2325
  y: l
2314
2326
  }), this.lastDelta = e;
@@ -2327,8 +2339,8 @@ class Oi {
2327
2339
  });
2328
2340
  }
2329
2341
  }
2330
- const Ai = 500;
2331
- class Vi extends _ {
2342
+ const ji = 500;
2343
+ class ki extends B {
2332
2344
  constructor(e, t) {
2333
2345
  super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new j(), this.navigation$ = this.navigationSubject.asObservable();
2334
2346
  const i = this.scrollNavigationController.userScroll$.pipe(
@@ -2339,11 +2351,11 @@ class Vi extends _ {
2339
2351
  v(o)
2340
2352
  ).pipe(
2341
2353
  Se(
2342
- Ai,
2354
+ ji,
2343
2355
  se
2344
2356
  ),
2345
2357
  U(),
2346
- $(() => {
2358
+ P(() => {
2347
2359
  const r = this.scrollNavigationController.fromScrollPosition(
2348
2360
  this.scrollNavigationController.scrollPosition
2349
2361
  );
@@ -2362,7 +2374,7 @@ class Vi extends _ {
2362
2374
  x(i).pipe(T(this.destroy$)).subscribe();
2363
2375
  }
2364
2376
  }
2365
- const ji = (n) => n.pagination.state$.pipe(
2377
+ const Ui = (n) => n.pagination.state$.pipe(
2366
2378
  D(n.context.manifest$, n.settings.values$),
2367
2379
  S(
2368
2380
  ([
@@ -2381,29 +2393,29 @@ const ji = (n) => n.pagination.state$.pipe(
2381
2393
  };
2382
2394
  }
2383
2395
  ),
2384
- z(A)
2385
- ), ki = ({ reader: n, duration: e }) => (t) => {
2396
+ z(O)
2397
+ ), zi = ({ reader: n, duration: e }) => (t) => {
2386
2398
  let i;
2387
2399
  const o = () => {
2388
2400
  i?.(), i = void 0;
2389
2401
  };
2390
2402
  return t.pipe(
2391
- $(() => {
2403
+ P(() => {
2392
2404
  i || (i = n?.navigation.lock());
2393
2405
  }),
2394
2406
  on(e, se, {
2395
2407
  trailing: !0,
2396
2408
  leading: !0
2397
2409
  }),
2398
- $(o),
2410
+ P(o),
2399
2411
  ue(o)
2400
2412
  );
2401
- }, Ui = (n) => (e) => {
2402
- const t = n(e), i = ji(t), o = new Ni(t), s = new Oi(t), r = new Vi(
2413
+ }, Wi = (n) => (e) => {
2414
+ const t = n(e), i = Ui(t), o = new Oi(t), s = new Vi(t), r = new ki(
2403
2415
  t.navigation.scrollNavigationController,
2404
2416
  t.navigation.locker
2405
- ), a = Mi(t, o), c = r.navigation$.pipe(
2406
- $((p) => {
2417
+ ), a = Ei(t, o), c = r.navigation$.pipe(
2418
+ P((p) => {
2407
2419
  t.navigation.navigate(p);
2408
2420
  })
2409
2421
  );
@@ -2419,7 +2431,7 @@ const ji = (n) => n.pagination.state$.pipe(
2419
2431
  navigation: {
2420
2432
  ...t.navigation,
2421
2433
  state$: i,
2422
- throttleLock: ({ duration: p, trigger: g }) => g.pipe(ki({ duration: p, reader: t })),
2434
+ throttleLock: ({ duration: p, trigger: g }) => g.pipe(zi({ duration: p, reader: t })),
2423
2435
  moveTo: s.moveTo.bind(s),
2424
2436
  turnBottom: o.turnBottom.bind(o),
2425
2437
  turnTop: o.turnTop.bind(o),
@@ -2467,19 +2479,19 @@ const ji = (n) => n.pagination.state$.pipe(
2467
2479
  }
2468
2480
  return o;
2469
2481
  }, void 0);
2470
- }, zi = (n, e) => {
2482
+ }, _i = (n, e) => {
2471
2483
  const { href: t } = e;
2472
2484
  return Ut(t, n.nav?.toc ?? [], n);
2473
- }, Wi = (n) => {
2485
+ }, Hi = (n) => {
2474
2486
  const e = n.context.manifest, t = n.spineItemsManager.items;
2475
2487
  return e ? t.reduce(
2476
- (i, { item: o }) => (i[o.id] = zi(e, o), i),
2488
+ (i, { item: o }) => (i[o.id] = _i(e, o), i),
2477
2489
  {}
2478
2490
  ) : {};
2479
- }, Hi = (n) => n.spineItemsManager.items$.pipe(
2491
+ }, Bi = (n) => n.spineItemsManager.items$.pipe(
2480
2492
  Q([]),
2481
- S(() => Wi(n))
2482
- ), _i = (n, e, t) => n + e * t, Bi = (n, e, t) => {
2493
+ S(() => Hi(n))
2494
+ ), Xi = (n, e, t) => n + e * t, Yi = (n, e, t) => {
2483
2495
  const { height: i, width: o } = t.layout.layoutInfo, { top: s, left: r } = n.spine.getSpineItemSpineLayoutInfo(t);
2484
2496
  return n.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
2485
2497
  0,
@@ -2494,27 +2506,27 @@ const ji = (n) => n.pagination.state$.pipe(
2494
2506
  (e.x - r + n.viewport.absoluteViewport.width) / o
2495
2507
  )
2496
2508
  );
2497
- }, Xi = (n, e, t, i, o) => o.isReady$.pipe(
2509
+ }, qi = (n, e, t, i, o) => o.isReady$.pipe(
2498
2510
  U(),
2499
2511
  D(n.layoutInfo$),
2500
2512
  S(([s, r]) => {
2501
- const a = n.context, c = a.manifest?.renditionLayout === "pre-paginated", u = a.manifest?.spineItems.length || 0, l = a.manifest?.spineItems.slice(0, e).reduce((f, b) => f + (b.progressionWeight ?? 0), 0) || 0, p = n.spineItemsManager.getSpineItemIndex(o) ?? 0, g = n.context.manifest?.spineItems.length ?? 0, h = r.pages.filter((f) => f.itemIndex === p).length ?? 0, d = a.manifest?.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
2513
+ const a = n.context, c = a.manifest?.renditionLayout === "pre-paginated", u = a.manifest?.spineItems.length || 0, l = a.manifest?.spineItems.slice(0, e).reduce((f, I) => f + (I.progressionWeight ?? 0), 0) || 0, p = n.spineItemsManager.getSpineItemIndex(o) ?? 0, g = n.context.manifest?.spineItems.length ?? 0, h = r.pages.filter((f) => f.itemIndex === p).length ?? 0, d = a.manifest?.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
2502
2514
  // relative to the total number of documents
2503
2515
  (p + 1) / g;
2504
2516
  let m = (t + 1) * (d / h);
2505
2517
  !c && o.renditionLayout === "reflowable" && !s && (m = 0);
2506
2518
  let y = l + m;
2507
- return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Bi(
2519
+ return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Yi(
2508
2520
  n,
2509
2521
  i,
2510
2522
  o
2511
- ) : m = 0, y = _i(
2523
+ ) : m = 0, y = Xi(
2512
2524
  l,
2513
2525
  d,
2514
2526
  m
2515
2527
  )), e === u - 1 && t === h - 1 && y > 0.99 ? 1 : y;
2516
2528
  })
2517
- ), Yi = (n) => n.spine.layout$.pipe(
2529
+ ), Gi = (n) => n.spine.layout$.pipe(
2518
2530
  Se(10, se),
2519
2531
  D(n.pagination.state$),
2520
2532
  S(() => ({
@@ -2527,12 +2539,12 @@ const ji = (n) => n.pagination.state$.pipe(
2527
2539
  */
2528
2540
  numberOfTotalPages: n.spine.pages.value.pages.length
2529
2541
  })),
2530
- z(A),
2542
+ z(O),
2531
2543
  Q({
2532
2544
  numberOfPagesPerItems: [],
2533
2545
  numberOfTotalPages: 0
2534
2546
  })
2535
- ), qi = (n, e, t, i) => {
2547
+ ), Zi = (n, e, t, i) => {
2536
2548
  const o = e.beginSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.beginSpineItemIndex) : void 0, s = e.endSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.endSpineItemIndex) : void 0;
2537
2549
  return v({
2538
2550
  ...e,
@@ -2563,7 +2575,7 @@ const ji = (n) => n.pagination.state$.pipe(
2563
2575
  // hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
2564
2576
  // numberOfSpineItems: context.manifest?.readingOrder.length,
2565
2577
  });
2566
- }, Gi = (n) => k([
2578
+ }, Ji = (n) => k([
2567
2579
  n.pagination.state$,
2568
2580
  // Usually pagination change if layout changes (number of pages) however it is especially
2569
2581
  // useful for like webtoon where you still have one page but only the layout will give you the final size
@@ -2572,7 +2584,7 @@ const ji = (n) => n.pagination.state$.pipe(
2572
2584
  ]).pipe(
2573
2585
  w(([e]) => {
2574
2586
  const t = e.endSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.endSpineItemIndex) : void 0;
2575
- return t ? Xi(
2587
+ return t ? qi(
2576
2588
  n,
2577
2589
  e.endSpineItemIndex ?? 0,
2578
2590
  e.endPageIndexInSpineItem || 0,
@@ -2580,8 +2592,8 @@ const ji = (n) => n.pagination.state$.pipe(
2580
2592
  t
2581
2593
  ) : v(0);
2582
2594
  })
2583
- ), Zi = (n) => {
2584
- const e = Hi(n), t = Yi(n), i = new W({
2595
+ ), Ki = (n) => {
2596
+ const e = Bi(n), t = Gi(n), i = new W({
2585
2597
  ...n.pagination.state,
2586
2598
  beginChapterInfo: void 0,
2587
2599
  beginCfi: void 0,
@@ -2599,10 +2611,10 @@ const ji = (n) => n.pagination.state$.pipe(
2599
2611
  }), o = k([
2600
2612
  n.pagination.state$,
2601
2613
  e,
2602
- Gi(n)
2614
+ Ji(n)
2603
2615
  ]).pipe(
2604
2616
  w(
2605
- ([r, a, c]) => qi(
2617
+ ([r, a, c]) => Zi(
2606
2618
  n,
2607
2619
  r,
2608
2620
  a,
@@ -2614,7 +2626,7 @@ const ji = (n) => n.pagination.state$.pipe(
2614
2626
  }))
2615
2627
  )
2616
2628
  ),
2617
- z(A)
2629
+ z(O)
2618
2630
  );
2619
2631
  return { paginationInfo$: k([
2620
2632
  o,
@@ -2632,12 +2644,12 @@ const ji = (n) => n.pagination.state$.pipe(
2632
2644
  r.endPageIndexInSpineItem ?? 0
2633
2645
  )
2634
2646
  })),
2635
- $((r) => {
2647
+ P((r) => {
2636
2648
  i.next(r);
2637
2649
  }),
2638
2650
  Z(1)
2639
2651
  ), getPaginationInfo: () => i.value };
2640
- }, de = (n) => ze({
2652
+ }, ge = (n) => ze({
2641
2653
  spineIndex: n.index,
2642
2654
  spineId: n.id
2643
2655
  }), zt = ({
@@ -2646,7 +2658,7 @@ const ji = (n) => n.pagination.state$.pipe(
2646
2658
  item: t
2647
2659
  }) => {
2648
2660
  const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
2649
- return !i || !i?.documentElement || n === i ? de(t) : Vn(n) ? ze({
2661
+ return !i || !i?.documentElement || n === i ? ge(t) : Vn(n) ? ze({
2650
2662
  start: {
2651
2663
  node: n.startContainer,
2652
2664
  offset: n.startOffset,
@@ -2665,7 +2677,7 @@ const ji = (n) => n.pagination.state$.pipe(
2665
2677
  spineIndex: t.index,
2666
2678
  spineId: t.id
2667
2679
  });
2668
- }, _e = ({
2680
+ }, He = ({
2669
2681
  pageIndex: n,
2670
2682
  spineItem: e,
2671
2683
  spine: t
@@ -2677,15 +2689,15 @@ const ji = (n) => n.pagination.state$.pipe(
2677
2689
  nodeOrRange: o.node,
2678
2690
  offset: o.offset,
2679
2691
  item: e.item
2680
- }).trim() : de(e.item);
2681
- }, Ji = (n, e) => zt({
2692
+ }).trim() : ge(e.item);
2693
+ }, Qi = (n, e) => zt({
2682
2694
  nodeOrRange: n,
2683
2695
  item: e
2684
- }), js = (n) => n.index.toString(), dt = (n) => n[0]?.index === 6 && n.length > 1, Be = (n) => {
2696
+ }), Hs = (n) => n.index.toString(), dt = (n) => n[0]?.index === 6 && n.length > 1, Be = (n) => {
2685
2697
  const e = Ft(n);
2686
2698
  return Sn(e);
2687
- }, Ki = (n) => Array.isArray(n) ? n[0] && dt(n[0]) ? n[0] : void 0 : n.parent[0] && dt(n.parent[0]) ? n.parent[0] : void 0, nt = (n) => {
2688
- const e = Ft(n), s = ((Ki(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = bn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2699
+ }, eo = (n) => Array.isArray(n) ? n[0] && dt(n[0]) ? n[0] : void 0 : n.parent[0] && dt(n.parent[0]) ? n.parent[0] : void 0, nt = (n) => {
2700
+ const e = Ft(n), s = ((eo(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = In(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2689
2701
  return {
2690
2702
  isCfiRange: r,
2691
2703
  cleanedCfi: n,
@@ -2708,7 +2720,7 @@ const ji = (n) => n.pagination.state$.pipe(
2708
2720
  const r = s.contentWindow?.document;
2709
2721
  if (r)
2710
2722
  try {
2711
- const a = In(n, r, {
2723
+ const a = bn(n, r, {
2712
2724
  throwOnError: !0
2713
2725
  });
2714
2726
  return {
@@ -2735,7 +2747,7 @@ const ji = (n) => n.pagination.state$.pipe(
2735
2747
  spineItem: o,
2736
2748
  node: null
2737
2749
  };
2738
- }, Qi = (n, e) => {
2750
+ }, to = (n, e) => {
2739
2751
  if ("cfi" in e) {
2740
2752
  const { itemIndex: s, ...r } = n.cfi.parseCfi(e.cfi);
2741
2753
  return {
@@ -2748,14 +2760,14 @@ const ji = (n) => n.pagination.state$.pipe(
2748
2760
  const t = n.spineItemsManager.get(e);
2749
2761
  if (!t)
2750
2762
  throw new Error("Spine item not found");
2751
- const i = de(t.item);
2763
+ const i = ge(t.item);
2752
2764
  return {
2753
2765
  ...n.cfi.parseCfi(i),
2754
- cfi: de(t.item),
2766
+ cfi: ge(t.item),
2755
2767
  itemIndex: t.index,
2756
2768
  node: null
2757
2769
  };
2758
- }, eo = (n, e) => {
2770
+ }, no = (n, e) => {
2759
2771
  let t = n?.itemPageIndex;
2760
2772
  const { itemIndex: i, ...o } = e.cfi.parseCfi(n.cfi), s = e.spineItemsManager.get(i);
2761
2773
  return s ? Rt().pipe(
@@ -2788,7 +2800,7 @@ const ji = (n) => n.pagination.state$.pipe(
2788
2800
  })
2789
2801
  ) : v({ ...n, itemIndex: i, ...o });
2790
2802
  };
2791
- class to {
2803
+ class io {
2792
2804
  constructor(e) {
2793
2805
  this.reader = e, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (t) => {
2794
2806
  const i = this.locatorsByKey.get(t);
@@ -2796,7 +2808,7 @@ class to {
2796
2808
  }, this.locate = (t, i) => {
2797
2809
  const o = {
2798
2810
  resource: t,
2799
- meta: Qi(this.reader, t)
2811
+ meta: to(this.reader, t)
2800
2812
  };
2801
2813
  return at(() => {
2802
2814
  const s = this.reader.spineItemsManager.get(
@@ -2821,7 +2833,7 @@ class to {
2821
2833
  const p = this.reader.spine.layout$.pipe(
2822
2834
  Se(10),
2823
2835
  Q(o),
2824
- sn((g) => eo(g.meta, this.reader).pipe(
2836
+ sn((g) => no(g.meta, this.reader).pipe(
2825
2837
  S((h) => ({
2826
2838
  ...g,
2827
2839
  meta: h
@@ -2844,10 +2856,10 @@ class to {
2844
2856
  ) : this.locate(e, t ?? {});
2845
2857
  }
2846
2858
  }
2847
- const no = (n) => (e) => {
2848
- const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = Zi(t);
2859
+ const oo = (n) => (e) => {
2860
+ const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = Ki(t);
2849
2861
  i.pipe(T(t.$.destroy$)).subscribe();
2850
- const s = new to(t);
2862
+ const s = new io(t);
2851
2863
  return {
2852
2864
  ...t,
2853
2865
  locateResource: s.locateResource.bind(s),
@@ -2861,7 +2873,7 @@ const no = (n) => (e) => {
2861
2873
  }
2862
2874
  }
2863
2875
  };
2864
- }, io = (n) => ({
2876
+ }, so = (n) => ({
2865
2877
  put: (s, r) => new Promise((a, c) => {
2866
2878
  const u = n.transaction(["store"], "readwrite");
2867
2879
  u.onerror = (g) => {
@@ -2913,16 +2925,16 @@ const no = (n) => (e) => {
2913
2925
  a(p);
2914
2926
  };
2915
2927
  })
2916
- }), Ne = async (n) => new Promise((e, t) => {
2928
+ }), Ae = async (n) => new Promise((e, t) => {
2917
2929
  const i = window.indexedDB.open(n);
2918
2930
  i.onerror = (o) => {
2919
2931
  t(o);
2920
2932
  }, i.onsuccess = () => {
2921
- e(io(i.result));
2933
+ e(so(i.result));
2922
2934
  }, i.onupgradeneeded = () => {
2923
2935
  i.result.createObjectStore("store");
2924
2936
  };
2925
- }), oo = (n) => {
2937
+ }), ro = (n) => {
2926
2938
  let e = Date.now().toString();
2927
2939
  const t = new j(), i = (c) => {
2928
2940
  if (typeof c == "string" || typeof c == "object") {
@@ -2933,7 +2945,7 @@ const no = (n) => (e) => {
2933
2945
  }, o = async (c, u) => {
2934
2946
  const l = i(c);
2935
2947
  if (!l) return new Response("Item not found", { status: 404 });
2936
- const g = await (await Ne("prose-reader")).get(`${e}_${l.id}`);
2948
+ const g = await (await Ae("prose-reader")).get(`${e}_${l.id}`);
2937
2949
  if (g)
2938
2950
  return new Response(g, { status: 200 });
2939
2951
  const h = u && await u(l) || await fetch(l.href);
@@ -2944,14 +2956,14 @@ const no = (n) => (e) => {
2944
2956
  t.asObservable().pipe(
2945
2957
  yn(({ id: c, data: u }) => {
2946
2958
  const l = i(c);
2947
- return l ? O(
2948
- an([Ne("prose-reader"), O(u.blob())])
2959
+ return l ? N(
2960
+ an([Ae("prose-reader"), N(u.blob())])
2949
2961
  ).pipe(
2950
- H(([p, g]) => O(p.put(`${e}_${l.id}`, g))),
2962
+ _(([p, g]) => N(p.put(`${e}_${l.id}`, g))),
2951
2963
  st((p) => (E.error(p), G))
2952
2964
  ) : G;
2953
2965
  }),
2954
- Y(n.destroy$)
2966
+ q(n.destroy$)
2955
2967
  ).subscribe();
2956
2968
  const r = n.manifest$.pipe(
2957
2969
  V(() => {
@@ -2959,29 +2971,29 @@ const no = (n) => (e) => {
2959
2971
  })
2960
2972
  );
2961
2973
  return x(r).pipe(
2962
- H(() => (E.debug("Cleanup up old cache..."), O(Ne("prose-reader")).pipe(
2963
- H(
2964
- (c) => O(c.keys()).pipe(
2974
+ _(() => (E.debug("Cleanup up old cache..."), N(Ae("prose-reader")).pipe(
2975
+ _(
2976
+ (c) => N(c.keys()).pipe(
2965
2977
  J(
2966
2978
  (u) => u.filter((l) => !l.toString().startsWith(e))
2967
2979
  ),
2968
- H((u) => {
2980
+ _((u) => {
2969
2981
  const l = u.map((p) => c.remove(p));
2970
- return O(Promise.all(l));
2982
+ return N(Promise.all(l));
2971
2983
  })
2972
2984
  )
2973
2985
  ),
2974
2986
  st((c) => (E.error(c), G))
2975
2987
  ))),
2976
- Y(n.destroy$)
2988
+ q(n.destroy$)
2977
2989
  ).subscribe(), {
2978
2990
  get: o,
2979
2991
  destroy: () => {
2980
2992
  t.complete();
2981
2993
  }
2982
2994
  };
2983
- }, so = (n) => (e) => {
2984
- const t = n(e), i = oo(t.context);
2995
+ }, ao = (n) => (e) => {
2996
+ const t = n(e), i = ro(t.context);
2985
2997
  return {
2986
2998
  ...t,
2987
2999
  // $: {
@@ -2993,7 +3005,7 @@ const no = (n) => (e) => {
2993
3005
  }
2994
3006
  // load,
2995
3007
  };
2996
- }, ro = (n, e) => {
3008
+ }, co = (n, e) => {
2997
3009
  const t = n.node.ownerDocument?.createRange(), i = n.node.compareDocumentPosition(e.node);
2998
3010
  if (t) {
2999
3011
  try {
@@ -3013,14 +3025,14 @@ const no = (n) => (e) => {
3013
3025
  }
3014
3026
  return t;
3015
3027
  }
3016
- }, ao = ({
3028
+ }, uo = ({
3017
3029
  selection: n,
3018
3030
  spineItem: e
3019
3031
  }) => {
3020
3032
  const { anchorNode: t, anchorOffset: i, focusNode: o, focusOffset: s } = n;
3021
3033
  if (!(!t || !o))
3022
3034
  try {
3023
- return ro(
3035
+ return co(
3024
3036
  { node: t, offset: i },
3025
3037
  { node: o, offset: s }
3026
3038
  );
@@ -3032,42 +3044,42 @@ const no = (n) => (e) => {
3032
3044
  return;
3033
3045
  }
3034
3046
  };
3035
- class co extends _ {
3047
+ class lo extends B {
3036
3048
  constructor(e) {
3037
3049
  super();
3038
3050
  const t = e.contentDocument || e.contentWindow?.document;
3039
3051
  if (!t)
3040
- this.selectionChange$ = pe, this.selectionOver$ = pe;
3052
+ this.selectionChange$ = de, this.selectionOver$ = de;
3041
3053
  else {
3042
3054
  const i = ct(t.body, {
3043
3055
  childList: !0,
3044
3056
  subtree: !0
3045
3057
  }).pipe(
3046
- L(
3058
+ M(
3047
3059
  (s) => !!s.find((r) => r.type === "childList" && r.removedNodes.length)
3048
3060
  )
3049
3061
  ), o = e.parentElement ? ct(e.parentElement, {
3050
3062
  childList: !0
3051
3063
  }).pipe(
3052
- L(
3064
+ M(
3053
3065
  (s) => !!s.find(
3054
3066
  (r) => Array.from(r.removedNodes).includes(e)
3055
3067
  )
3056
3068
  )
3057
3069
  ) : v(null);
3058
3070
  this.selectionChange$ = x(
3059
- X(t, "selectionchange"),
3071
+ Y(t, "selectionchange"),
3060
3072
  i
3061
3073
  ).pipe(
3062
3074
  S(() => t.getSelection()),
3063
3075
  T(x(o, this.destroy$)),
3064
3076
  me(null)
3065
- ), this.selectionOver$ = X(t, "pointerdown").pipe(
3077
+ ), this.selectionOver$ = Y(t, "pointerdown").pipe(
3066
3078
  w(
3067
3079
  () => x(
3068
- X(t, "pointerup"),
3069
- X(t, "pointercancel"),
3070
- X(t, "contextmenu")
3080
+ Y(t, "pointerup"),
3081
+ Y(t, "pointercancel"),
3082
+ Y(t, "contextmenu")
3071
3083
  ).pipe(
3072
3084
  U(),
3073
3085
  /**
@@ -3079,7 +3091,7 @@ class co extends _ {
3079
3091
  const r = t.getSelection();
3080
3092
  return r && !r.isCollapsed ? [s, r] : void 0;
3081
3093
  }),
3082
- L(ce)
3094
+ M(ce)
3083
3095
  )
3084
3096
  ),
3085
3097
  T(x(o, this.destroy$))
@@ -3087,11 +3099,11 @@ class co extends _ {
3087
3099
  }
3088
3100
  }
3089
3101
  }
3090
- const uo = (n) => n.watch("isLoaded").pipe(
3102
+ const po = (n) => n.watch("isLoaded").pipe(
3091
3103
  w(() => {
3092
3104
  const e = n.renderer.getDocumentFrame(), t = e?.contentDocument || e?.contentWindow?.document;
3093
- if (!e || !t) return pe;
3094
- const i = new co(e);
3105
+ if (!e || !t) return de;
3106
+ const i = new lo(e);
3095
3107
  return x(
3096
3108
  i.selectionChange$.pipe(
3097
3109
  S((o) => {
@@ -3118,14 +3130,14 @@ const uo = (n) => n.watch("isLoaded").pipe(
3118
3130
  );
3119
3131
  }),
3120
3132
  z()
3121
- ), lo = (n) => (e) => {
3133
+ ), go = (n) => (e) => {
3122
3134
  const t = n(e);
3123
3135
  let i;
3124
3136
  const o = t.spineItemsManager.items$.pipe(
3125
3137
  w((l) => {
3126
3138
  const p = l.map((g) => {
3127
3139
  const h = t.spineItemsManager.getSpineItemIndex(g) ?? 0;
3128
- return uo(g).pipe(
3140
+ return po(g).pipe(
3129
3141
  S((d) => {
3130
3142
  if (d)
3131
3143
  return {
@@ -3139,26 +3151,26 @@ const uo = (n) => n.watch("isLoaded").pipe(
3139
3151
  }),
3140
3152
  Q(void 0),
3141
3153
  z(),
3142
- $((l) => {
3154
+ P((l) => {
3143
3155
  i = l;
3144
3156
  }),
3145
3157
  Z({ refCount: !0, bufferSize: 1 })
3146
3158
  ), s = o, r = o.pipe(
3147
3159
  S((l) => !!l),
3148
3160
  z(),
3149
- L((l) => l),
3161
+ M((l) => l),
3150
3162
  R()
3151
3163
  ), a = r.pipe(
3152
3164
  w(() => s),
3153
3165
  z(),
3154
- L((l) => !l),
3166
+ M((l) => !l),
3155
3167
  R()
3156
3168
  ), c = o.pipe(
3157
- L((l) => l?.type === "over"),
3169
+ M((l) => l?.type === "over"),
3158
3170
  R()
3159
3171
  ), u = t.context.watch("rootElement").pipe(
3160
- L(Ge),
3161
- w((l) => X(l, "pointerdown")),
3172
+ M(Ge),
3173
+ w((l) => Y(l, "pointerdown")),
3162
3174
  D(s),
3163
3175
  S(([, l]) => l),
3164
3176
  Q(void 0),
@@ -3173,7 +3185,7 @@ const uo = (n) => n.watch("isLoaded").pipe(
3173
3185
  selectionOver$: c,
3174
3186
  lastSelectionOnPointerdown$: u,
3175
3187
  getSelection: () => i,
3176
- createOrderedRangeFromSelection: ao
3188
+ createOrderedRangeFromSelection: uo
3177
3189
  }
3178
3190
  };
3179
3191
  }, gt = [
@@ -3191,7 +3203,7 @@ const uo = (n) => n.watch("isLoaded").pipe(
3191
3203
  backgroundColor: "#191717",
3192
3204
  foregroundColor: "#f1ebeb"
3193
3205
  }
3194
- ], po = (n) => (e) => {
3206
+ ], ho = (n) => (e) => {
3195
3207
  const t = n(e), i = new W(
3196
3208
  e.theme ?? "bright"
3197
3209
  ), o = () => {
@@ -3238,12 +3250,12 @@ const uo = (n) => n.watch("isLoaded").pipe(
3238
3250
  ({ element: c }) => s({ container: c })
3239
3251
  )
3240
3252
  ),
3241
- Y(t.$.destroy$)
3253
+ q(t.$.destroy$)
3242
3254
  ).subscribe(), i.pipe(
3243
3255
  V(() => {
3244
3256
  r();
3245
3257
  }),
3246
- Y(t.$.destroy$)
3258
+ q(t.$.destroy$)
3247
3259
  ).subscribe(), {
3248
3260
  ...t,
3249
3261
  theme: {
@@ -3256,14 +3268,14 @@ const uo = (n) => n.watch("isLoaded").pipe(
3256
3268
  }
3257
3269
  }
3258
3270
  };
3259
- }, go = (n) => (e) => ({
3271
+ }, mo = (n) => (e) => ({
3260
3272
  ...n(e),
3261
3273
  utils: {
3262
3274
  isOrIsWithinValidLink: (o) => !!(Et(o) && (o.nodeName === "a" ? o : o.closest("a"))?.getAttribute("href"))
3263
3275
  }
3264
3276
  });
3265
3277
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3266
- const ho = (n) => (e) => n(e);
3278
+ const fo = (n) => (e) => n(e);
3267
3279
  class re extends te {
3268
3280
  constructor(e) {
3269
3281
  super((t) => this.stateSubject.pipe(T(this._destroy$)).subscribe(t)), this._destroy$ = new j(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new W(e);
@@ -3276,12 +3288,12 @@ class re extends te {
3276
3288
  */
3277
3289
  mergeCompare(e) {
3278
3290
  const t = { ...this.value, ...e };
3279
- A(this.value, t) || this.stateSubject.next(t);
3291
+ O(this.value, t) || this.stateSubject.next(t);
3280
3292
  }
3281
3293
  watch(e) {
3282
3294
  return Array.isArray(e) ? this.stateSubject.pipe(Ke(e)) : this.stateSubject.pipe(
3283
3295
  S((t) => t[e]),
3284
- z(A)
3296
+ z(O)
3285
3297
  );
3286
3298
  }
3287
3299
  get value() {
@@ -3291,7 +3303,7 @@ class re extends te {
3291
3303
  this.stateSubject.complete(), this._destroy$.complete();
3292
3304
  }
3293
3305
  }
3294
- class Ht extends re {
3306
+ class _t extends re {
3295
3307
  constructor(e) {
3296
3308
  super({
3297
3309
  element: void 0,
@@ -3301,22 +3313,22 @@ class Ht extends re {
3301
3313
  }), this.reader = e;
3302
3314
  }
3303
3315
  }
3304
- const Oe = 200;
3305
- class mo extends Ht {
3316
+ const Ne = 200;
3317
+ class yo extends _t {
3306
3318
  constructor(e) {
3307
3319
  super(e), this.watch("isZooming").pipe(
3308
- L((t) => !t),
3320
+ M((t) => !t),
3309
3321
  w(
3310
- () => $e(Oe).pipe(
3311
- $(() => {
3322
+ () => $e(Ne).pipe(
3323
+ P(() => {
3312
3324
  this.reader.viewport.value.element.style.transition = "";
3313
3325
  })
3314
3326
  )
3315
3327
  )
3316
3328
  ), this.watch("currentScale").pipe(
3317
3329
  w(
3318
- () => $e(Oe).pipe(
3319
- $(() => {
3330
+ () => $e(Ne).pipe(
3331
+ P(() => {
3320
3332
  this.reader.layout();
3321
3333
  })
3322
3334
  )
@@ -3346,7 +3358,7 @@ class mo extends Ht {
3346
3358
  const a = e.cloneNode();
3347
3359
  a.src = e.src, a.style.setProperty("height", "100%"), a.style.setProperty("width", "100%"), a.style.setProperty("object-fit", "contain"), a.style.setProperty("pointer-events", "none"), r.appendChild(a), o.appendChild(r);
3348
3360
  }
3349
- i && !e && (s.style.transition = `transform ${Oe}ms`), this.setScale(t), this.mergeCompare({
3361
+ i && !e && (s.style.transition = `transform ${Ne}ms`), this.setScale(t), this.mergeCompare({
3350
3362
  element: r,
3351
3363
  isZooming: !0,
3352
3364
  currentScale: t,
@@ -3390,11 +3402,11 @@ class mo extends Ht {
3390
3402
  });
3391
3403
  }
3392
3404
  }
3393
- const fo = (n, e, t) => {
3394
- const i = n.clientWidth, o = n.clientHeight, s = n.scrollLeft, r = n.scrollTop, a = s + i / 2, c = r + o / 2, u = t / e, l = a * u, p = c * u, g = l - i / 2, h = p - o / 2;
3395
- return { newScrollLeft: g, newScrollTop: h };
3405
+ const So = (n, e, t, i, o) => {
3406
+ const s = n.clientWidth, r = n.clientHeight, a = n.scrollLeft, c = n.scrollTop, u = a + s / 2 - i, l = c + r / 2 - o, p = t / e, g = u * p, h = l * p, d = g - s / 2 + i, m = h - r / 2 + o;
3407
+ return { newScrollLeft: d, newScrollTop: m };
3396
3408
  };
3397
- class yo extends Ht {
3409
+ class Io extends _t {
3398
3410
  enter({ scale: e = 1 } = {}) {
3399
3411
  this.value.isZooming || (this.setScale(e), this.mergeCompare({
3400
3412
  currentPosition: { x: 0, y: 0 },
@@ -3417,18 +3429,20 @@ class yo extends Ht {
3417
3429
  setScale(e) {
3418
3430
  const t = this.reader.viewport.value.element, i = this.reader.navigation.scrollNavigationController.value.element, o = this.reader.navigation.scrollNavigationController.value.element;
3419
3431
  if (!t || !o) return;
3420
- const s = this.reader.viewport.scaleFactor, { newScrollLeft: r, newScrollTop: a } = fo(
3421
- i ?? Nn(),
3432
+ const s = this.reader.viewport.scaleFactor, r = t.offsetLeft, a = t.offsetTop, { newScrollLeft: c, newScrollTop: u } = So(
3433
+ i ?? An(),
3422
3434
  s,
3423
- e
3435
+ e,
3436
+ r,
3437
+ a
3424
3438
  );
3425
- e < 1 ? (t.style.transformOrigin = "top", o.style.overflowX = "auto") : e > 1 && (t.style.transformOrigin = "top left", o.style.overflowX = "scroll"), t.style.transform = `scale(${e})`;
3426
- const c = this.reader.navigation.scrollNavigationController.fromScrollPosition({
3427
- x: r,
3428
- y: a
3439
+ e < 1 ? (t.style.transformOrigin = "top", o.style.overflowX = "auto") : e > 1 && (t.style.transformOrigin = `${r}px ${a}px`, o.style.overflowX = "scroll"), t.style.transform = `scale(${e})`;
3440
+ const l = this.reader.navigation.scrollNavigationController.fromScrollPosition({
3441
+ x: c,
3442
+ y: u
3429
3443
  });
3430
3444
  this.reader.navigation.navigate({
3431
- position: c
3445
+ position: l
3432
3446
  });
3433
3447
  }
3434
3448
  scaleAt(e) {
@@ -3438,8 +3452,8 @@ class yo extends Ht {
3438
3452
  });
3439
3453
  }
3440
3454
  }
3441
- const So = (n) => (e) => {
3442
- const t = n(e), i = new mo(t), o = new yo(t), s = new W(o);
3455
+ const bo = (n) => (e) => {
3456
+ const t = n(e), i = new yo(t), o = new Io(t), s = new W(o);
3443
3457
  return {
3444
3458
  ...t,
3445
3459
  destroy: () => {
@@ -3459,24 +3473,24 @@ const So = (n) => (e) => {
3459
3473
  }
3460
3474
  }
3461
3475
  };
3462
- }, _t = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3463
- class bo {
3476
+ }, Ht = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3477
+ class vo {
3464
3478
  constructor() {
3465
3479
  this.navigationSubject = new it(1), this.viewportStateSubject = new W("free"), this.paginationSubject = new it(), this.navigationIsLockedSubject = new W(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3466
3480
  z(),
3467
- L((e) => !e)
3481
+ M((e) => !e)
3468
3482
  ), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
3469
- L((e) => e === "free")
3483
+ M((e) => e === "free")
3470
3484
  ), this.viewportBusy$ = this.viewportState$.pipe(
3471
- L((e) => e === "busy")
3485
+ M((e) => e === "busy")
3472
3486
  ), this.navigation$ = this.navigationSubject.asObservable();
3473
3487
  }
3474
3488
  }
3475
- class Io extends re {
3489
+ class wo extends re {
3476
3490
  constructor() {
3477
3491
  super({
3478
3492
  assumedRenditionLayout: "reflowable"
3479
- }), this.bridgeEvent = new bo(), this.manifest$ = this.pipe(
3493
+ }), this.bridgeEvent = new vo(), this.manifest$ = this.pipe(
3480
3494
  J((e) => e.manifest),
3481
3495
  oe(ce),
3482
3496
  le()
@@ -3487,7 +3501,7 @@ class Io extends re {
3487
3501
  ...t,
3488
3502
  ...e,
3489
3503
  ...e.manifest && {
3490
- isFullyPrePaginated: _t(i),
3504
+ isFullyPrePaginated: Ht(i),
3491
3505
  assumedRenditionLayout: i?.renditionLayout ?? "reflowable"
3492
3506
  }
3493
3507
  };
@@ -3500,7 +3514,7 @@ class Io extends re {
3500
3514
  return this.manifest?.readingDirection;
3501
3515
  }
3502
3516
  }
3503
- class vo extends re {
3517
+ class xo extends re {
3504
3518
  constructor(e, t) {
3505
3519
  super({
3506
3520
  supportedPageTurnAnimation: ["fade", "none", "slide"],
@@ -3517,7 +3531,7 @@ class vo extends re {
3517
3531
  renditionLayout: i?.renditionLayout,
3518
3532
  computedPageTurnMode: s
3519
3533
  })),
3520
- z(A),
3534
+ z(O),
3521
3535
  S(
3522
3536
  ({
3523
3537
  hasVerticalWriting: i,
@@ -3535,7 +3549,7 @@ class vo extends re {
3535
3549
  ).subscribe(this.next.bind(this));
3536
3550
  }
3537
3551
  }
3538
- class wo {
3552
+ class Po {
3539
3553
  constructor() {
3540
3554
  this._hooks = [], this._hookExecutions = [];
3541
3555
  }
@@ -3597,30 +3611,30 @@ class wo {
3597
3611
  return k(s);
3598
3612
  }
3599
3613
  }
3600
- const xo = (n) => ({
3614
+ const $o = (n) => ({
3601
3615
  x: -n.x,
3602
3616
  y: -n.y
3603
- }), Po = (n) => n instanceof DOMMatrix ? new F({
3617
+ }), To = (n) => n instanceof DOMMatrix ? new L({
3604
3618
  x: -n.e,
3605
3619
  y: -n.f
3606
- }) : new F({
3620
+ }) : new L({
3607
3621
  x: -n.x,
3608
3622
  y: -n.y
3609
- }), $o = "navigation/ViewportNavigator", ht = E.namespace($o);
3610
- class To extends _ {
3623
+ }), Fo = "navigation/ViewportNavigator", ht = E.namespace(Fo);
3624
+ class Lo extends B {
3611
3625
  constructor(e, t, i, o, s) {
3612
3626
  super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new j(), this.element$ = new W(
3613
3627
  document.createElement("div")
3614
3628
  );
3615
3629
  const r = this.spine.element$.pipe(
3616
- L(Ge),
3630
+ M(Ge),
3617
3631
  D(this.element$),
3618
- $(([l, p]) => {
3632
+ P(([l, p]) => {
3619
3633
  p.style.cssText = `
3620
3634
  height: 100%;
3621
3635
  width: 100%;
3622
3636
  position: relative;
3623
- `, p.className = `${ge}-controlled-navigator`, p.innerHTML = "", p.appendChild(l), this.viewport.value.element.appendChild(p), this.element$.next(p);
3637
+ `, p.className = `${pe}-controlled-navigator`, p.innerHTML = "", p.appendChild(l), this.viewport.value.element.appendChild(p), this.element$.next(p);
3624
3638
  })
3625
3639
  ), a = e.watch([
3626
3640
  "computedPageTurnDirection",
@@ -3630,18 +3644,18 @@ class To extends _ {
3630
3644
  a,
3631
3645
  this.element$
3632
3646
  ]).pipe(
3633
- $(([, l]) => {
3647
+ P(([, l]) => {
3634
3648
  e.values.computedPageTurnMode === "scrollable" ? l.style.display = "contents" : l.style.display = "block";
3635
3649
  })
3636
3650
  );
3637
3651
  this.layout$ = c.pipe(
3638
- $(() => {
3652
+ P(() => {
3639
3653
  ht.info("layout", e.values);
3640
3654
  }),
3641
3655
  R()
3642
3656
  );
3643
3657
  const u = this.navigateSubject.pipe(
3644
- $((l) => {
3658
+ P((l) => {
3645
3659
  ht.info("Navigation requested", l);
3646
3660
  })
3647
3661
  );
@@ -3670,7 +3684,7 @@ class To extends _ {
3670
3684
  * However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
3671
3685
  */
3672
3686
  l.shouldAnimate ? ve(1, se) : we,
3673
- $((d) => {
3687
+ P((d) => {
3674
3688
  const m = this.element$.getValue();
3675
3689
  d.shouldAnimate ? h === "fade" ? (m.style.setProperty(
3676
3690
  "transition",
@@ -3688,16 +3702,16 @@ class To extends _ {
3688
3702
  * need to adjust to anchor to the payload position. This is because we use viewport computed position,
3689
3703
  * not the value set by `setProperty`
3690
3704
  */
3691
- $((d) => {
3705
+ P((d) => {
3692
3706
  h !== "fade" && this.setViewportPosition(d.position);
3693
3707
  }),
3694
3708
  l.shouldAnimate ? ve(g / 2, se) : we,
3695
- $((d) => {
3709
+ P((d) => {
3696
3710
  const m = this.element$.getValue();
3697
3711
  h === "fade" && (this.setViewportPosition(d.position), m.style.setProperty("opacity", "1"));
3698
3712
  }),
3699
3713
  l.shouldAnimate ? ve(g / 2, se) : we,
3700
- $((d) => {
3714
+ P((d) => {
3701
3715
  h === "fade" && this.setViewportPosition(d.position);
3702
3716
  })
3703
3717
  );
@@ -3719,7 +3733,7 @@ class To extends _ {
3719
3733
  * for remark about flicker / fonts smoothing
3720
3734
  */
3721
3735
  setViewportPosition(e) {
3722
- const t = this.element$.getValue(), i = xo(e);
3736
+ const t = this.element$.getValue(), i = $o(e);
3723
3737
  t.style.transform = `translate(${i.x}px, ${i.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3724
3738
  }
3725
3739
  navigate(e) {
@@ -3732,19 +3746,19 @@ class To extends _ {
3732
3746
  get viewportPosition() {
3733
3747
  const e = this.element$.getValue(), t = window.getComputedStyle(e), i = t.transform || t.webkitTransform;
3734
3748
  if (!i || i === "none")
3735
- return new F({ x: 0, y: 0 });
3749
+ return new L({ x: 0, y: 0 });
3736
3750
  const o = new DOMMatrix(i);
3737
- return Po(o);
3751
+ return To(o);
3738
3752
  }
3739
3753
  }
3740
- class Fo {
3754
+ class Mo {
3741
3755
  constructor(e) {
3742
3756
  this.x = e.x, this.y = e.y;
3743
3757
  }
3744
3758
  }
3745
- class mt extends Fo {
3759
+ class mt extends Mo {
3746
3760
  }
3747
- class Lo extends re {
3761
+ class Co extends re {
3748
3762
  constructor(e, t, i, o, s) {
3749
3763
  super({
3750
3764
  element: void 0
@@ -3759,7 +3773,7 @@ class Lo extends re {
3759
3773
  top: h.y,
3760
3774
  behavior: "instant"
3761
3775
  }), $e(1).pipe(
3762
- $(() => {
3776
+ P(() => {
3763
3777
  this.scrollingSubject.next(!1);
3764
3778
  }),
3765
3779
  T(x(this.scrollingSubject.pipe(Pt(1)), this.destroy$))
@@ -3767,7 +3781,7 @@ class Lo extends re {
3767
3781
  };
3768
3782
  const r = this.context.pipe(
3769
3783
  Ke(["rootElement"]),
3770
- $(({ rootElement: p }) => {
3784
+ P(({ rootElement: p }) => {
3771
3785
  if (!p) return;
3772
3786
  const g = document.createElement("div");
3773
3787
  g.style.cssText = `
@@ -3776,16 +3790,16 @@ class Lo extends re {
3776
3790
  position: relative;
3777
3791
  overflow-y: scroll;
3778
3792
  overflow-x: hidden;
3779
- `, g.className = `${ge}-scroll-navigator`, g.appendChild(this.viewport.value.element), p.appendChild(g), this.update({ element: g });
3793
+ `, g.className = `${pe}-scroll-navigator`, g.appendChild(this.viewport.value.element), p.appendChild(g), this.update({ element: g });
3780
3794
  })
3781
3795
  ), a = k([
3782
3796
  t.watch(["computedPageTurnMode"]),
3783
3797
  this.watch("element")
3784
3798
  ]).pipe(
3785
- $(([{ computedPageTurnMode: p }, g]) => {
3799
+ P(([{ computedPageTurnMode: p }, g]) => {
3786
3800
  g && (p === "scrollable" ? g.style.display = "block" : g.style.display = "contents");
3787
3801
  })
3788
- ), c = this.navigateSubject.pipe($(this.setViewportPosition));
3802
+ ), c = this.navigateSubject.pipe(P(this.setViewportPosition));
3789
3803
  this.isNavigating$ = this.navigateSubject.pipe(
3790
3804
  Q(!1),
3791
3805
  w(() => x(v(!0), v(!1))),
@@ -3793,12 +3807,12 @@ class Lo extends re {
3793
3807
  );
3794
3808
  const u = x(
3795
3809
  o.element$.pipe(
3796
- L(ce),
3810
+ M(ce),
3797
3811
  w((p) => Qe(p))
3798
3812
  ),
3799
3813
  o.element$.pipe(
3800
- L(ce),
3801
- w((p) => X(p, "scroll"))
3814
+ M(ce),
3815
+ w((p) => Y(p, "scroll"))
3802
3816
  ),
3803
3817
  o.spineItemsObserver.itemResize$
3804
3818
  ).pipe(
@@ -3820,13 +3834,13 @@ class Lo extends re {
3820
3834
  Z(1)
3821
3835
  );
3822
3836
  this.userScroll$ = this.watch("element").pipe(
3823
- L(ce),
3837
+ M(ce),
3824
3838
  w(
3825
3839
  (p) => t.watch(["computedPageTurnMode"]).pipe(
3826
3840
  w(
3827
- ({ computedPageTurnMode: g }) => g === "controlled" ? pe : X(p, "scroll").pipe(
3841
+ ({ computedPageTurnMode: g }) => g === "controlled" ? de : Y(p, "scroll").pipe(
3828
3842
  D(l),
3829
- L(
3843
+ M(
3830
3844
  ([, h]) => !h
3831
3845
  ),
3832
3846
  S(([h]) => h)
@@ -3865,7 +3879,7 @@ class Lo extends re {
3865
3879
  });
3866
3880
  }
3867
3881
  }
3868
- const Mo = () => (n) => n.pipe(
3882
+ const Eo = () => (n) => n.pipe(
3869
3883
  S(({ navigation: e, pagination: t, ...i }) => ({
3870
3884
  navigation: {
3871
3885
  ...e,
@@ -3873,9 +3887,9 @@ const Mo = () => (n) => n.pipe(
3873
3887
  },
3874
3888
  ...i
3875
3889
  }))
3876
- ), Co = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3890
+ ), Do = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3877
3891
  D(e),
3878
- L(
3892
+ M(
3879
3893
  ([i, o]) => i.navigationId === o.id
3880
3894
  ),
3881
3895
  /**
@@ -3884,13 +3898,13 @@ const Mo = () => (n) => n.pipe(
3884
3898
  * the user to an invalid location.
3885
3899
  */
3886
3900
  w(([i, o]) => (t.spineItemsManager.get(o.spineItem)?.isReady$.pipe(U()) ?? v(!1)).pipe(
3887
- L((r) => r),
3901
+ M((r) => r),
3888
3902
  S(() => ({
3889
3903
  pagination: i,
3890
3904
  navigation: o
3891
3905
  }))
3892
3906
  )),
3893
- Mo(),
3907
+ Eo(),
3894
3908
  z(
3895
3909
  (i, o) => i.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
3896
3910
  ),
@@ -3902,7 +3916,7 @@ const Mo = () => (n) => n.pipe(
3902
3916
  }
3903
3917
  })
3904
3918
  )
3905
- ), Eo = ({ navigationResolver: n }) => (e) => e.pipe(
3919
+ ), Ro = ({ navigationResolver: n }) => (e) => e.pipe(
3906
3920
  S(([t, i]) => {
3907
3921
  const o = {
3908
3922
  type: "api",
@@ -3934,7 +3948,7 @@ const Mo = () => (n) => n.pipe(
3934
3948
  navigation: o
3935
3949
  };
3936
3950
  })
3937
- ), Do = ({ navigationResolver: n }) => (e) => e.pipe(
3951
+ ), Ao = ({ navigationResolver: n }) => (e) => e.pipe(
3938
3952
  S((t) => {
3939
3953
  if (t.navigation.cfi) {
3940
3954
  const i = n.getNavigationForCfi(
@@ -3951,16 +3965,16 @@ const Mo = () => (n) => n.pipe(
3951
3965
  }
3952
3966
  return t;
3953
3967
  })
3954
- ), Ro = ({
3968
+ ), No = ({
3955
3969
  navigation: n,
3956
3970
  previousNavigation: e,
3957
3971
  settings: t
3958
- }) => n.directionFromLastNavigation ? n.directionFromLastNavigation : n.url !== void 0 || n.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || n.spineItem || !n.position ? "forward" : t.values.computedPageTurnDirection === "vertical" ? n.position.y > e.position.y || n.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(n.position.x) > Math.abs(e.position.x) || n.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward", No = ({
3972
+ }) => n.directionFromLastNavigation ? n.directionFromLastNavigation : n.url !== void 0 || n.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || n.spineItem || !n.position ? "forward" : t.values.computedPageTurnDirection === "vertical" ? n.position.y > e.position.y || n.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(n.position.x) > Math.abs(e.position.x) || n.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward", Oo = ({
3959
3973
  context: n,
3960
3974
  settings: e
3961
3975
  }) => (t) => t.pipe(
3962
3976
  S(({ navigation: i, previousNavigation: o }) => {
3963
- const s = Ro({
3977
+ const s = No({
3964
3978
  navigation: i,
3965
3979
  previousNavigation: o,
3966
3980
  settings: e
@@ -3974,7 +3988,7 @@ const Mo = () => (n) => n.pipe(
3974
3988
  direction: s
3975
3989
  };
3976
3990
  })
3977
- ), Oo = ({
3991
+ ), Vo = ({
3978
3992
  spineItemsManager: n,
3979
3993
  navigationResolver: e,
3980
3994
  settings: t
@@ -4047,20 +4061,20 @@ const Mo = () => (n) => n.pipe(
4047
4061
  restrictToScreen: !1
4048
4062
  }) ?? {}, m = (l === "forward" || l === "anchor" ? d : h) ?? h, y = e.get(m);
4049
4063
  if (!y) return;
4050
- const { endPageIndex: f, beginPageIndex: b } = i.getVisiblePagesFromViewportPosition({
4064
+ const { endPageIndex: f, beginPageIndex: I } = i.getVisiblePagesFromViewportPosition({
4051
4065
  position: a,
4052
4066
  spineItem: y,
4053
4067
  threshold: p,
4054
4068
  restrictToScreen: !1
4055
- }) ?? {}, I = (l === "forward" || l === "anchor" ? f : b) ?? 0, P = t.getNavigationForSpineItemPage({
4056
- pageIndex: I,
4069
+ }) ?? {}, b = (l === "forward" || l === "anchor" ? f : I) ?? 0, F = t.getNavigationForSpineItemPage({
4070
+ pageIndex: b,
4057
4071
  spineItemId: y
4058
- }), C = i.getVisibleSpineItemsFromPosition({
4059
- position: P,
4072
+ }), $ = i.getVisibleSpineItemsFromPosition({
4073
+ position: F,
4060
4074
  threshold: p,
4061
4075
  restrictToScreen: !1
4062
- }), N = l === "forward" || l === "anchor" ? C?.beginIndex : C?.endIndex;
4063
- return e.get(N);
4076
+ }), A = l === "forward" || l === "anchor" ? $?.beginIndex : $?.endIndex;
4077
+ return e.get(A);
4064
4078
  }
4065
4079
  return a && g === "scrollable" ? i.getSpineItemFromPosition(a) : e.get(0);
4066
4080
  };
@@ -4099,7 +4113,7 @@ const Mo = () => (n) => n.pipe(
4099
4113
  )
4100
4114
  );
4101
4115
  })
4102
- ), Ae = ({
4116
+ ), Oe = ({
4103
4117
  settings: n,
4104
4118
  spineItemsManager: e,
4105
4119
  spineLocator: t,
@@ -4143,7 +4157,7 @@ const Mo = () => (n) => n.pipe(
4143
4157
  ...a
4144
4158
  }))
4145
4159
  );
4146
- }, Ao = ({ navigationResolver: n }) => (e) => e.pipe(
4160
+ }, jo = ({ navigationResolver: n }) => (e) => e.pipe(
4147
4161
  S((t) => {
4148
4162
  if (t.navigation.url) {
4149
4163
  const i = n.getNavigationForUrl(
@@ -4176,7 +4190,7 @@ class Bt {
4176
4190
  };
4177
4191
  }
4178
4192
  }
4179
- const Vo = ({
4193
+ const ko = ({
4180
4194
  spineLocator: n,
4181
4195
  navigation: e,
4182
4196
  navigationResolver: t,
@@ -4209,7 +4223,7 @@ const Vo = ({
4209
4223
  return h;
4210
4224
  }
4211
4225
  if (c && p && e.directionFromLastNavigation === "backward") {
4212
- const h = new M({
4226
+ const h = new C({
4213
4227
  x: (e.positionInSpineItem?.x ?? 0) + u,
4214
4228
  y: (e.positionInSpineItem?.y ?? 0) + l
4215
4229
  });
@@ -4232,8 +4246,8 @@ const Vo = ({
4232
4246
  }
4233
4247
  return c ? t.getNavigationForPosition(e.position) : t.getNavigationForSpineIndexOrId(s);
4234
4248
  })
4235
- ) : v(new F({ x: 0, y: 0 }));
4236
- }, jo = ({
4249
+ ) : v(new L({ x: 0, y: 0 }));
4250
+ }, Uo = ({
4237
4251
  navigation: n,
4238
4252
  spineLocator: e,
4239
4253
  spineItemsManager: t,
@@ -4242,11 +4256,11 @@ const Vo = ({
4242
4256
  spine: s
4243
4257
  }) => {
4244
4258
  const { spineItem: r } = n, a = t.get(r);
4245
- if (!a) return new F({ x: 0, y: 0 });
4259
+ if (!a) return new L({ x: 0, y: 0 });
4246
4260
  const { height: c, top: u } = s.getSpineItemSpineLayoutInfo(a), l = e.isPositionWithinSpineItem(
4247
4261
  n.position,
4248
4262
  a
4249
- ), p = n.positionInSpineItem ?? new M({
4263
+ ), p = n.positionInSpineItem ?? new C({
4250
4264
  y: 0,
4251
4265
  x: 0
4252
4266
  });
@@ -4257,7 +4271,7 @@ const Vo = ({
4257
4271
  return o.getNavigationForSpineIndexOrId(a);
4258
4272
  if (u !== n.spineItemTop) {
4259
4273
  const g = e.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
4260
- n.positionInSpineItem ?? new M({
4274
+ n.positionInSpineItem ?? new C({
4261
4275
  x: 0,
4262
4276
  y: 0
4263
4277
  }),
@@ -4269,7 +4283,7 @@ const Vo = ({
4269
4283
  });
4270
4284
  }
4271
4285
  if (u === n.spineItemTop && c !== n.spineItemHeight) {
4272
- const g = (n.spineItemHeight ?? p.y) - p.y, h = new M({
4286
+ const g = (n.spineItemHeight ?? p.y) - p.y, h = new C({
4273
4287
  y: n.directionFromLastNavigation === "backward" ? c - g : p.y,
4274
4288
  x: n.position.x
4275
4289
  });
@@ -4285,7 +4299,7 @@ const Vo = ({
4285
4299
  }
4286
4300
  if (!l) {
4287
4301
  if (!(n.position.y < u)) {
4288
- const m = new M({
4302
+ const m = new C({
4289
4303
  y: c - g,
4290
4304
  x: n.position.x
4291
4305
  });
@@ -4302,7 +4316,7 @@ const Vo = ({
4302
4316
  }
4303
4317
  }
4304
4318
  return n.position;
4305
- }, ko = ({
4319
+ }, zo = ({
4306
4320
  navigation: n,
4307
4321
  spineItemsManager: e,
4308
4322
  settings: t,
@@ -4310,7 +4324,7 @@ const Vo = ({
4310
4324
  navigationResolver: o,
4311
4325
  spine: s
4312
4326
  }) => t.values.computedPageTurnMode === "scrollable" ? v(
4313
- jo({
4327
+ Uo({
4314
4328
  navigation: n,
4315
4329
  spineLocator: i,
4316
4330
  navigationResolver: o,
@@ -4318,7 +4332,7 @@ const Vo = ({
4318
4332
  spineItemsManager: e,
4319
4333
  spine: s
4320
4334
  })
4321
- ) : Vo({
4335
+ ) : ko({
4322
4336
  navigation: n,
4323
4337
  spineLocator: i,
4324
4338
  navigationResolver: o,
@@ -4330,7 +4344,7 @@ const Vo = ({
4330
4344
  context: t,
4331
4345
  spine: i
4332
4346
  }) => (o) => o.pipe(
4333
- w((s) => ko({
4347
+ w((s) => zo({
4334
4348
  spineLocator: i.locator,
4335
4349
  navigation: s.navigation,
4336
4350
  navigationResolver: e,
@@ -4347,12 +4361,12 @@ const Vo = ({
4347
4361
  }
4348
4362
  }))
4349
4363
  ))
4350
- ), Uo = "navigation/InternalNavigator", zo = E.namespace(Uo);
4351
- class Wo extends _ {
4364
+ ), Wo = "navigation/InternalNavigator", _o = E.namespace(Wo);
4365
+ class Ho extends B {
4352
4366
  constructor(e, t, i, o, s, r, a, c) {
4353
4367
  super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isUserLocked$ = c, this.navigationSubject = new W({
4354
4368
  animation: !1,
4355
- position: new F({ x: 0, y: 0 }),
4369
+ position: new L({ x: 0, y: 0 }),
4356
4370
  meta: {
4357
4371
  triggeredBy: "user"
4358
4372
  },
@@ -4360,42 +4374,42 @@ class Wo extends _ {
4360
4374
  type: "api",
4361
4375
  id: Symbol()
4362
4376
  }), this.navigated$ = this.navigationSubject.pipe(Pt(1)), this.navigation$ = this.navigationSubject.pipe(
4363
- S(({ position: f, id: b }) => ({
4377
+ S(({ position: f, id: I }) => ({
4364
4378
  position: f,
4365
- id: b
4379
+ id: I
4366
4380
  })),
4367
4381
  z(
4368
- ({ position: f, ...b }, { position: I, ...P }) => A(b, P) && A(f, I)
4382
+ ({ position: f, ...I }, { position: b, ...F }) => O(I, F) && O(f, b)
4369
4383
  ),
4370
4384
  Z(1)
4371
4385
  ), this.locker = new Bt();
4372
4386
  const u = i.pipe(
4373
4387
  D(this.navigationSubject),
4374
- Eo({
4388
+ Ro({
4375
4389
  navigationResolver: r
4376
4390
  }),
4377
4391
  /**
4378
4392
  * Url lookup is heavier so we start with it to fill
4379
4393
  * as much information as needed to reduce later lookup
4380
4394
  */
4381
- Ao({
4395
+ jo({
4382
4396
  navigationResolver: r
4383
4397
  }),
4384
4398
  /**
4385
4399
  * Cfi lookup is heavier so we start with it to fill
4386
4400
  * as much information as needed to reduce later lookup
4387
4401
  */
4388
- Do({
4402
+ Ao({
4389
4403
  navigationResolver: r
4390
4404
  }),
4391
- No({ context: t, settings: e }),
4405
+ Oo({ context: t, settings: e }),
4392
4406
  ft({
4393
4407
  navigationResolver: r,
4394
4408
  settings: e,
4395
4409
  spineItemsManager: a.spineItemsManager,
4396
4410
  spineLocator: a.locator
4397
4411
  }),
4398
- Ae({
4412
+ Oe({
4399
4413
  navigationResolver: r,
4400
4414
  settings: e,
4401
4415
  spineItemsManager: a.spineItemsManager,
@@ -4405,16 +4419,16 @@ class Wo extends _ {
4405
4419
  spine: a
4406
4420
  })
4407
4421
  ).pipe(
4408
- Oo({
4422
+ Vo({
4409
4423
  navigationResolver: r,
4410
4424
  spineItemsManager: a.spineItemsManager,
4411
4425
  settings: e
4412
4426
  }),
4413
4427
  D(c),
4414
- w(([f, b]) => {
4415
- const I = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || b;
4428
+ w(([f, I]) => {
4429
+ const b = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || I;
4416
4430
  return v(f).pipe(
4417
- I ? we : St({
4431
+ b ? we : St({
4418
4432
  navigationResolver: r,
4419
4433
  settings: e,
4420
4434
  spine: a,
@@ -4422,7 +4436,7 @@ class Wo extends _ {
4422
4436
  })
4423
4437
  );
4424
4438
  }),
4425
- Ae({
4439
+ Oe({
4426
4440
  spineItemsManager: a.spineItemsManager,
4427
4441
  spineLocator: a.locator,
4428
4442
  settings: e,
@@ -4432,11 +4446,11 @@ class Wo extends _ {
4432
4446
  R()
4433
4447
  ), l = u.pipe(
4434
4448
  D(c),
4435
- L(([, f]) => f),
4449
+ M(([, f]) => f),
4436
4450
  w(([f]) => {
4437
- const b = this.locker.lock();
4451
+ const I = this.locker.lock();
4438
4452
  return c.pipe(
4439
- L((I) => !I),
4453
+ M((b) => !b),
4440
4454
  U(),
4441
4455
  S(
4442
4456
  () => ({
@@ -4445,7 +4459,7 @@ class Wo extends _ {
4445
4459
  })
4446
4460
  ),
4447
4461
  ue(() => {
4448
- b();
4462
+ I();
4449
4463
  }),
4450
4464
  T(u)
4451
4465
  );
@@ -4458,7 +4472,7 @@ class Wo extends _ {
4458
4472
  w(() => v(null).pipe(
4459
4473
  w(
4460
4474
  () => c.pipe(
4461
- L((f) => !f),
4475
+ M((f) => !f),
4462
4476
  U()
4463
4477
  )
4464
4478
  ),
@@ -4489,7 +4503,7 @@ class Wo extends _ {
4489
4503
  spine: a
4490
4504
  }),
4491
4505
  S((f) => {
4492
- const b = {
4506
+ const I = {
4493
4507
  ...f.navigation,
4494
4508
  meta: {
4495
4509
  triggeredBy: "restoration"
@@ -4497,7 +4511,7 @@ class Wo extends _ {
4497
4511
  };
4498
4512
  return {
4499
4513
  ...f,
4500
- navigation: b
4514
+ navigation: I
4501
4515
  };
4502
4516
  }),
4503
4517
  /**
@@ -4514,7 +4528,7 @@ class Wo extends _ {
4514
4528
  yt({
4515
4529
  spine: a
4516
4530
  }),
4517
- Ae({
4531
+ Oe({
4518
4532
  spineItemsManager: a.spineItemsManager,
4519
4533
  spineLocator: a.locator,
4520
4534
  settings: e,
@@ -4522,7 +4536,7 @@ class Wo extends _ {
4522
4536
  }),
4523
4537
  S(({ navigation: f }) => f),
4524
4538
  R()
4525
- ), h = Co(
4539
+ ), h = Do(
4526
4540
  t,
4527
4541
  this.navigationSubject,
4528
4542
  a
@@ -4531,35 +4545,35 @@ class Wo extends _ {
4531
4545
  u,
4532
4546
  h
4533
4547
  ), m = (f) => f.pipe(
4534
- $(([b, I]) => {
4535
- zo.info(
4536
- `navigation updated from ${b.meta.triggeredBy} of type ${b.type}`,
4548
+ P(([I, b]) => {
4549
+ _o.info(
4550
+ `navigation updated from ${I.meta.triggeredBy} of type ${I.type}`,
4537
4551
  {
4538
- previousNavigation: I,
4539
- currentNavigation: b
4552
+ previousNavigation: b,
4553
+ currentNavigation: I
4540
4554
  }
4541
- ), this.navigationSubject.next(b);
4555
+ ), this.navigationSubject.next(I);
4542
4556
  })
4543
4557
  ), y = (f) => f.pipe(
4544
- $(([b, I]) => {
4545
- const P = b.type === "scroll", C = b.meta.triggeredBy === "pagination", N = b.meta.triggeredBy === "restoration", B = A(
4546
- I.position,
4547
- b.position
4558
+ P(([I, b]) => {
4559
+ const F = I.type === "scroll", $ = I.meta.triggeredBy === "pagination", A = I.meta.triggeredBy === "restoration", X = O(
4560
+ b.position,
4561
+ I.position
4548
4562
  );
4549
- if (P && !N || C || B)
4563
+ if (F && !A || $ || X)
4550
4564
  return;
4551
- const q = {
4552
- position: b.position,
4553
- animation: b.animation
4565
+ const H = {
4566
+ position: I.position,
4567
+ animation: I.animation
4554
4568
  };
4555
- e.values.computedPageTurnMode === "scrollable" ? this.scrollNavigationController.navigate(q) : this.controlledNavigationController.navigate({
4556
- ...q,
4569
+ e.values.computedPageTurnMode === "scrollable" ? this.scrollNavigationController.navigate(H) : this.controlledNavigationController.navigate({
4570
+ ...H,
4557
4571
  /**
4558
4572
  * @important
4559
4573
  * Explicitly trust the unbound position to be valid at this point.
4560
4574
  * Thanks to consolidation and restoration.
4561
4575
  */
4562
- position: F.from(q.position)
4576
+ position: L.from(H.position)
4563
4577
  });
4564
4578
  })
4565
4579
  );
@@ -4587,14 +4601,14 @@ const Te = (n, e, t) => {
4587
4601
  }, Xe = (n, e) => (e || 0) === 0 || (n || 0) === 0 ? 1 : Math.floor(Math.max(1, n / e)), Ve = (n, e, t) => {
4588
4602
  const i = Xe(t, e), o = [...Array(i)].map((s, r) => r * e);
4589
4603
  return n >= i * e ? o[o.length - 1] || 0 : o.find((s) => n < s + e) || 0;
4590
- }, bt = (n, e, t) => {
4604
+ }, It = (n, e, t) => {
4591
4605
  const i = [...Array(t)].map((o, s) => s * e);
4592
4606
  return n <= 0 || t === 0 ? 0 : n >= t * e ? t - 1 : i.findIndex((o) => n < o + e) ?? 0;
4593
- }, Ho = ({
4607
+ }, Bo = ({
4594
4608
  itemWidth: n,
4595
4609
  itemHeight: e,
4596
4610
  spineItemPosition: t
4597
- }) => new M({
4611
+ }) => new C({
4598
4612
  x: Math.min(n, Math.max(0, t.x)),
4599
4613
  y: Math.min(e, Math.max(0, t.y))
4600
4614
  }), Xt = ({
@@ -4605,7 +4619,7 @@ const Te = (n, e, t) => {
4605
4619
  pageHeight: o,
4606
4620
  pageTurnDirection: s,
4607
4621
  pageTurnMode: r
4608
- }) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Xe(n, o) : Xe(e, i), It = ({
4622
+ }) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Xe(n, o) : Xe(e, i), bt = ({
4609
4623
  itemWidth: n,
4610
4624
  itemHeight: e,
4611
4625
  position: t,
@@ -4616,7 +4630,7 @@ const Te = (n, e, t) => {
4616
4630
  pageTurnMode: a,
4617
4631
  isRTL: c
4618
4632
  }) => {
4619
- const l = Ho({
4633
+ const l = Bo({
4620
4634
  spineItemPosition: t,
4621
4635
  itemHeight: e,
4622
4636
  itemWidth: n
@@ -4630,10 +4644,10 @@ const Te = (n, e, t) => {
4630
4644
  pageTurnMode: a
4631
4645
  });
4632
4646
  if (i)
4633
- return bt(t.y, s, p);
4634
- const g = bt(l, o, p);
4647
+ return It(t.y, s, p);
4648
+ const g = It(l, o, p);
4635
4649
  return c ? p - 1 - g : g;
4636
- }, _o = ({
4650
+ }, Xo = ({
4637
4651
  pageIndex: n,
4638
4652
  itemLayout: e,
4639
4653
  context: t,
@@ -4646,7 +4660,7 @@ const Te = (n, e, t) => {
4646
4660
  n,
4647
4661
  e.height
4648
4662
  );
4649
- return new M({
4663
+ return new C({
4650
4664
  x: 0,
4651
4665
  y: r
4652
4666
  });
@@ -4656,10 +4670,10 @@ const Te = (n, e, t) => {
4656
4670
  n,
4657
4671
  e.width
4658
4672
  );
4659
- return t.isRTL() ? new M({
4673
+ return t.isRTL() ? new C({
4660
4674
  x: e.width - s - o.pageSize.width,
4661
4675
  y: 0
4662
- }) : new M({
4676
+ }) : new C({
4663
4677
  x: s,
4664
4678
  y: 0
4665
4679
  });
@@ -4678,7 +4692,7 @@ const Te = (n, e, t) => {
4678
4692
  g,
4679
4693
  p
4680
4694
  );
4681
- return new M({ x: h, y: 0 });
4695
+ return new C({ x: h, y: 0 });
4682
4696
  }
4683
4697
  };
4684
4698
  return {
@@ -4686,14 +4700,14 @@ const Te = (n, e, t) => {
4686
4700
  getSpineItemPositionFromPageIndex: ({
4687
4701
  pageIndex: a,
4688
4702
  spineItem: c
4689
- }) => _o({
4703
+ }) => Xo({
4690
4704
  context: n,
4691
4705
  isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
4692
4706
  itemLayout: c.layout.layoutInfo,
4693
4707
  pageIndex: a,
4694
4708
  viewport: t
4695
4709
  }),
4696
- getSpineItemPageIndexFromPosition: (a) => It({
4710
+ getSpineItemPageIndexFromPosition: (a) => bt({
4697
4711
  ...a,
4698
4712
  isRTL: n.isRTL(),
4699
4713
  pageWidth: t.pageSize.width,
@@ -4703,7 +4717,7 @@ const Te = (n, e, t) => {
4703
4717
  }),
4704
4718
  getSpineItemPageIndexFromNode: (a, c, u) => {
4705
4719
  const l = i(a, c, u), { height: p, width: g } = u.layout.layoutInfo;
4706
- return l ? It({
4720
+ return l ? bt({
4707
4721
  isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
4708
4722
  position: l,
4709
4723
  itemHeight: p,
@@ -4717,7 +4731,7 @@ const Te = (n, e, t) => {
4717
4731
  },
4718
4732
  getSpineItemClosestPositionFromUnsafePosition: (a, c) => {
4719
4733
  const { width: u, height: l } = c.layout.layoutInfo;
4720
- return new M({
4734
+ return new C({
4721
4735
  x: Ve(
4722
4736
  a.x,
4723
4737
  t.pageSize.width,
@@ -4757,7 +4771,7 @@ const Te = (n, e, t) => {
4757
4771
  });
4758
4772
  }
4759
4773
  };
4760
- }, Bo = ({
4774
+ }, Yo = ({
4761
4775
  context: n,
4762
4776
  settings: e,
4763
4777
  viewport: t
@@ -4783,7 +4797,7 @@ const Te = (n, e, t) => {
4783
4797
  c,
4784
4798
  u,
4785
4799
  a
4786
- ) || new M({ x: 0, y: 0 })
4800
+ ) || new C({ x: 0, y: 0 })
4787
4801
  };
4788
4802
  };
4789
4803
  function qt({
@@ -4800,13 +4814,13 @@ function qt({
4800
4814
  ), a = r.bottom, c = Math.max(0, n.y), u = Math.min(c, a);
4801
4815
  if (e) {
4802
4816
  const h = Math.min(o, n.x), d = Math.max(h, r.left);
4803
- return new F({
4817
+ return new L({
4804
4818
  x: d,
4805
4819
  y: u
4806
4820
  });
4807
4821
  }
4808
4822
  const l = r.right, p = Math.max(0, n.x), g = Math.min(p, l);
4809
- return new F({
4823
+ return new L({
4810
4824
  x: g,
4811
4825
  y: u
4812
4826
  });
@@ -4830,13 +4844,13 @@ const vt = ({
4830
4844
  ), c = s.getSpineItemSpineLayoutInfo(a), u = c.bottom - t, l = Math.min(r.x, u);
4831
4845
  if (e) {
4832
4846
  const g = Math.min(0, r.x);
4833
- return new F({
4847
+ return new L({
4834
4848
  x: g,
4835
4849
  y: l
4836
4850
  });
4837
4851
  }
4838
4852
  const p = c.right - o;
4839
- return new F({
4853
+ return new L({
4840
4854
  x: Math.min(r.x, p),
4841
4855
  y: l
4842
4856
  });
@@ -4846,7 +4860,7 @@ const vt = ({
4846
4860
  visibleAreaRectWidth: i
4847
4861
  }) => {
4848
4862
  const s = n % i !== 0 ? n - t : n;
4849
- return new F({ x: s, y: e });
4863
+ return new L({ x: s, y: e });
4850
4864
  }, Ye = ({
4851
4865
  viewportPosition: n,
4852
4866
  spineLocator: e,
@@ -4871,8 +4885,8 @@ const vt = ({
4871
4885
  visibleAreaRectWidth: i.absoluteViewport.width
4872
4886
  });
4873
4887
  }
4874
- return new F({ x: 0, y: 0 });
4875
- }, Xo = ({
4888
+ return new L({ x: 0, y: 0 });
4889
+ }, qo = ({
4876
4890
  pageIndex: n,
4877
4891
  spineItemsManager: e,
4878
4892
  spineItemId: t,
@@ -4884,7 +4898,7 @@ const vt = ({
4884
4898
  if (!r) {
4885
4899
  const u = n * s.pageSize.width;
4886
4900
  return Ye({
4887
- viewportPosition: new F({ x: u, y: 0 }),
4901
+ viewportPosition: new L({ x: u, y: 0 }),
4888
4902
  spineItemNavigationResolver: o,
4889
4903
  spineLocator: i,
4890
4904
  viewport: s
@@ -4902,37 +4916,37 @@ const vt = ({
4902
4916
  pageSizeWidth: s.pageSize.width,
4903
4917
  visibleAreaRectWidth: s.absoluteViewport.width
4904
4918
  });
4905
- }, Yo = (n, e) => {
4919
+ }, Go = (n, e) => {
4906
4920
  if (e && e instanceof HTMLIFrameElement)
4907
4921
  return n.startsWith("#") ? e.contentDocument?.getElementById(
4908
4922
  n.replace("#", "")
4909
4923
  ) : e.contentDocument?.querySelector(n);
4910
- }, qo = ({
4924
+ }, Zo = ({
4911
4925
  anchor: n,
4912
4926
  spineItem: e,
4913
4927
  spine: t
4914
4928
  }) => {
4915
- const i = Yo(
4929
+ const i = Go(
4916
4930
  n,
4917
4931
  e.renderer.getDocumentFrame()
4918
4932
  );
4919
4933
  return i ? t.spineItemLocator.getSpineItemPositionFromNode(i, 0, e)?.x ?? 0 : 0;
4920
- }, Go = ({
4934
+ }, Jo = ({
4921
4935
  anchor: n,
4922
4936
  spineItem: e,
4923
4937
  spineLocator: t,
4924
4938
  spine: i
4925
4939
  }) => {
4926
- const o = qo({
4940
+ const o = Zo({
4927
4941
  anchor: n,
4928
4942
  spineItem: e,
4929
4943
  spine: i
4930
4944
  });
4931
4945
  return t.getSpinePositionFromSpineItemPosition({
4932
- spineItemPosition: new M({ x: o, y: 0 }),
4946
+ spineItemPosition: new C({ x: o, y: 0 }),
4933
4947
  spineItem: e
4934
4948
  });
4935
- }, Zo = ({
4949
+ }, Ko = ({
4936
4950
  anchor: n,
4937
4951
  spineItem: e,
4938
4952
  spineLocator: t,
@@ -4940,7 +4954,7 @@ const vt = ({
4940
4954
  pageSizeWidth: o,
4941
4955
  visibleAreaRectWidth: s
4942
4956
  }) => {
4943
- const r = Go({
4957
+ const r = Jo({
4944
4958
  anchor: n,
4945
4959
  spineItem: e,
4946
4960
  spineLocator: t,
@@ -4951,7 +4965,7 @@ const vt = ({
4951
4965
  pageSizeWidth: o,
4952
4966
  visibleAreaRectWidth: s
4953
4967
  });
4954
- }, Jo = ({
4968
+ }, Qo = ({
4955
4969
  spine: n,
4956
4970
  spineItemsManager: e,
4957
4971
  spineLocator: t,
@@ -4967,7 +4981,7 @@ const vt = ({
4967
4981
  if (u) {
4968
4982
  const l = e.get(u.id);
4969
4983
  if (l) {
4970
- const p = Zo({
4984
+ const p = Ko({
4971
4985
  anchor: a.hash,
4972
4986
  spineItem: l,
4973
4987
  spine: n,
@@ -4990,7 +5004,7 @@ const vt = ({
4990
5004
  console.error(a);
4991
5005
  return;
4992
5006
  }
4993
- }, Ko = ({
5007
+ }, es = ({
4994
5008
  spineItem: n,
4995
5009
  spineItemPosition: e,
4996
5010
  spineLocator: t,
@@ -5009,7 +5023,7 @@ const vt = ({
5009
5023
  pageSizeWidth: o.pageSize.width,
5010
5024
  visibleAreaRectWidth: o.absoluteViewport.width
5011
5025
  });
5012
- }, Qo = "spineNavigator", es = ({
5026
+ }, ts = "spineNavigator", ns = ({
5013
5027
  context: n,
5014
5028
  spineItemsManager: e,
5015
5029
  locator: t,
@@ -5017,13 +5031,13 @@ const vt = ({
5017
5031
  spine: o,
5018
5032
  viewport: s
5019
5033
  }) => {
5020
- const r = Bo({
5034
+ const r = Yo({
5021
5035
  context: n,
5022
5036
  settings: i,
5023
5037
  viewport: s
5024
5038
  });
5025
5039
  return {
5026
- getNavigationForUrl: (h) => Jo({
5040
+ getNavigationForUrl: (h) => Qo({
5027
5041
  context: n,
5028
5042
  spineItemsManager: e,
5029
5043
  spineLocator: t,
@@ -5032,14 +5046,14 @@ const vt = ({
5032
5046
  visibleAreaRectWidth: s.absoluteViewport.width,
5033
5047
  spine: o
5034
5048
  }),
5035
- getNavigationForSpineItemPage: (h) => Xo({
5049
+ getNavigationForSpineItemPage: (h) => qo({
5036
5050
  ...h,
5037
5051
  spineItemsManager: e,
5038
5052
  spineItemNavigationResolver: r,
5039
5053
  spineLocator: t,
5040
5054
  viewport: s
5041
5055
  }),
5042
- getNavigationFromSpineItemPosition: (h) => Ko({
5056
+ getNavigationFromSpineItemPosition: (h) => es({
5043
5057
  ...h,
5044
5058
  spineItemLocator: t.spineItemLocator,
5045
5059
  spineLocator: t,
@@ -5051,15 +5065,15 @@ const vt = ({
5051
5065
  spineItemsManager: e
5052
5066
  });
5053
5067
  if (!d) {
5054
- E.warn(Qo, `unable to detect item id from cfi ${h}`);
5068
+ E.warn(ts, `unable to detect item id from cfi ${h}`);
5055
5069
  return;
5056
5070
  }
5057
- const f = m ? r.getNavigationFromNode(d, m, y) : new M({ x: 0, y: 0 }), b = t.getSpinePositionFromSpineItemPosition({
5071
+ const f = m ? r.getNavigationFromNode(d, m, y) : new C({ x: 0, y: 0 }), I = t.getSpinePositionFromSpineItemPosition({
5058
5072
  spineItemPosition: f,
5059
5073
  spineItem: d
5060
5074
  });
5061
5075
  return K({
5062
- position: b,
5076
+ position: I,
5063
5077
  pageSizeWidth: s.pageSize.width,
5064
5078
  visibleAreaRectWidth: s.absoluteViewport.width
5065
5079
  });
@@ -5085,7 +5099,7 @@ const vt = ({
5085
5099
  visibleAreaRectWidth: s.absoluteViewport.width
5086
5100
  });
5087
5101
  }
5088
- return new F({ x: 0, y: 0 });
5102
+ return new L({ x: 0, y: 0 });
5089
5103
  },
5090
5104
  getNavigationForPosition: (h) => Ye({
5091
5105
  viewportPosition: h,
@@ -5094,8 +5108,8 @@ const vt = ({
5094
5108
  viewport: s
5095
5109
  }),
5096
5110
  getMostPredominantNavigationForPosition: (h) => {
5097
- const d = i.values.computedPageTurnDirection, m = 0.5, y = d === "horizontal" ? h.x + s.absoluteViewport.width * m : 0, f = d === "horizontal" ? 0 : h.y + s.absoluteViewport.height * m, b = vt({
5098
- position: new F({
5111
+ const d = i.values.computedPageTurnDirection, m = 0.5, y = d === "horizontal" ? h.x + s.absoluteViewport.width * m : 0, f = d === "horizontal" ? 0 : h.y + s.absoluteViewport.height * m, I = vt({
5112
+ position: new L({
5099
5113
  x: y,
5100
5114
  y: f
5101
5115
  }),
@@ -5108,7 +5122,7 @@ const vt = ({
5108
5122
  return Ye({
5109
5123
  spineItemNavigationResolver: r,
5110
5124
  spineLocator: t,
5111
- viewportPosition: b,
5125
+ viewportPosition: I,
5112
5126
  viewport: s
5113
5127
  });
5114
5128
  },
@@ -5136,7 +5150,7 @@ const vt = ({
5136
5150
  }),
5137
5151
  spineItemNavigator: r
5138
5152
  };
5139
- }, ts = ({
5153
+ }, is = ({
5140
5154
  spineItemsManager: n,
5141
5155
  context: e,
5142
5156
  hookManager: t,
@@ -5144,26 +5158,26 @@ const vt = ({
5144
5158
  settings: o,
5145
5159
  viewport: s
5146
5160
  }) => {
5147
- const r = new j(), a = r.asObservable(), c = new Bt(), u = es({
5161
+ const r = new j(), a = r.asObservable(), c = new Bt(), u = ns({
5148
5162
  context: e,
5149
5163
  settings: o,
5150
5164
  spineItemsManager: n,
5151
5165
  locator: i.locator,
5152
5166
  spine: i,
5153
5167
  viewport: s
5154
- }), l = new To(
5168
+ }), l = new Lo(
5155
5169
  o,
5156
5170
  t,
5157
5171
  e,
5158
5172
  i,
5159
5173
  s
5160
- ), p = new Lo(
5174
+ ), p = new Co(
5161
5175
  s,
5162
5176
  o,
5163
5177
  t,
5164
5178
  i,
5165
5179
  e
5166
- ), g = new Wo(
5180
+ ), g = new Ho(
5167
5181
  o,
5168
5182
  e,
5169
5183
  a,
@@ -5202,7 +5216,7 @@ const vt = ({
5202
5216
  navigation$: g.navigation$
5203
5217
  };
5204
5218
  };
5205
- class ns extends re {
5219
+ class os extends re {
5206
5220
  constructor(e, t) {
5207
5221
  super({
5208
5222
  beginPageIndexInSpineItem: void 0,
@@ -5220,7 +5234,7 @@ class ns extends re {
5220
5234
  this.mergeCompare(e);
5221
5235
  }
5222
5236
  }
5223
- class is extends _ {
5237
+ class ss extends B {
5224
5238
  constructor(e, t, i, o, s) {
5225
5239
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spine = o, this.spineItemLocator = s;
5226
5240
  const r = x(
@@ -5239,7 +5253,7 @@ class is extends _ {
5239
5253
  return this.context.bridgeEvent.navigationUnlocked$.pipe(
5240
5254
  wt(1),
5241
5255
  D(this.context.bridgeEvent.navigation$),
5242
- $(([, u]) => {
5256
+ P(([, u]) => {
5243
5257
  const { position: l } = u, p = this.pagination.value, {
5244
5258
  beginIndex: g,
5245
5259
  endIndex: h
@@ -5248,21 +5262,21 @@ class is extends _ {
5248
5262
  threshold: { type: "percentage", value: 0.5 }
5249
5263
  }) ?? {}, d = this.spineItemsManager.get(g), m = this.spineItemsManager.get(h);
5250
5264
  if (!d || !m) return;
5251
- const y = p.beginCfi, f = p.endCfi, { beginPageIndex: b = 0 } = c({
5265
+ const y = p.beginCfi, f = p.endCfi, { beginPageIndex: I = 0 } = c({
5252
5266
  spineItem: d,
5253
5267
  position: l
5254
- }) ?? {}, { endPageIndex: I = 0 } = c({
5268
+ }) ?? {}, { endPageIndex: b = 0 } = c({
5255
5269
  spineItem: m,
5256
5270
  position: l
5257
- }) ?? {}, P = y === void 0 || Be(y) || p.beginSpineItemIndex !== g, C = p.endSpineItemIndex !== h || f === void 0 || Be(f), N = P ? de(d.item) : y, B = C ? de(m.item) : f, q = d.numberOfPages, ne = m.numberOfPages;
5271
+ }) ?? {}, F = y === void 0 || Be(y) || p.beginSpineItemIndex !== g, $ = p.endSpineItemIndex !== h || f === void 0 || Be(f), A = F ? ge(d.item) : y, X = $ ? ge(m.item) : f, H = d.numberOfPages, ne = m.numberOfPages;
5258
5272
  this.pagination.update({
5259
- beginCfi: N,
5260
- beginNumberOfPagesInSpineItem: q,
5261
- beginPageIndexInSpineItem: b,
5273
+ beginCfi: A,
5274
+ beginNumberOfPagesInSpineItem: H,
5275
+ beginPageIndexInSpineItem: I,
5262
5276
  beginSpineItemIndex: g,
5263
- endCfi: B,
5277
+ endCfi: X,
5264
5278
  endNumberOfPagesInSpineItem: ne,
5265
- endPageIndexInSpineItem: I,
5279
+ endPageIndexInSpineItem: b,
5266
5280
  endSpineItemIndex: h,
5267
5281
  navigationId: u.id
5268
5282
  });
@@ -5271,7 +5285,7 @@ class is extends _ {
5271
5285
  })
5272
5286
  ), a = r.pipe(
5273
5287
  Ce(this.context.bridgeEvent.viewportFree$),
5274
- $(() => {
5288
+ P(() => {
5275
5289
  const {
5276
5290
  beginSpineItemIndex: c,
5277
5291
  endSpineItemIndex: u,
@@ -5282,12 +5296,12 @@ class is extends _ {
5282
5296
  return;
5283
5297
  const g = this.spineItemsManager.get(c), h = this.spineItemsManager.get(u);
5284
5298
  g === void 0 || h === void 0 || this.pagination.update({
5285
- beginCfi: _e({
5299
+ beginCfi: He({
5286
5300
  pageIndex: l,
5287
5301
  spineItem: g,
5288
5302
  spine: this.spine
5289
5303
  }),
5290
- endCfi: _e({
5304
+ endCfi: He({
5291
5305
  pageIndex: p,
5292
5306
  spineItem: h,
5293
5307
  spine: this.spine
@@ -5298,11 +5312,11 @@ class is extends _ {
5298
5312
  x(r, a).pipe(T(this.destroy$)).subscribe();
5299
5313
  }
5300
5314
  }
5301
- const os = ({
5315
+ const rs = ({
5302
5316
  manifest: n,
5303
5317
  spreadMode: e
5304
5318
  }) => n?.renditionFlow === "scrolled-continuous" ? !1 : e;
5305
- class ss extends _ {
5319
+ class as extends B {
5306
5320
  constructor(e) {
5307
5321
  super();
5308
5322
  const t = {
@@ -5312,7 +5326,7 @@ class ss extends _ {
5312
5326
  this.inputSettings = t, this.outputSettingsUpdateSubject = new j(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(Z(1)), this._settings$.subscribe();
5313
5327
  }
5314
5328
  _prepareUpdate(e) {
5315
- const t = xe(this.inputSettings, e), i = this.getOutputSettings(t), o = !A(this.outputSettings, i);
5329
+ const t = xe(this.inputSettings, e), i = this.getOutputSettings(t), o = !O(this.outputSettings, i);
5316
5330
  return {
5317
5331
  hasChanged: o,
5318
5332
  state: i,
@@ -5340,17 +5354,17 @@ class ss extends _ {
5340
5354
  watch(e) {
5341
5355
  return this.values$.pipe(
5342
5356
  Dt(e),
5343
- z(A)
5357
+ z(O)
5344
5358
  );
5345
5359
  }
5346
5360
  destroy() {
5347
5361
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5348
5362
  }
5349
5363
  }
5350
- class rs extends ss {
5364
+ class cs extends as {
5351
5365
  constructor(e, t) {
5352
5366
  super(e), this.context = t, t.watch(["manifest", "hasVerticalWriting"]).pipe(
5353
- $(() => this.update(this.values)),
5367
+ P(() => this.update(this.values)),
5354
5368
  T(this.destroy$)
5355
5369
  ).subscribe();
5356
5370
  }
@@ -5360,7 +5374,7 @@ class rs extends ss {
5360
5374
  computedPageTurnAnimation: e.pageTurnAnimation,
5361
5375
  computedPageTurnMode: e.pageTurnMode,
5362
5376
  computedPageTurnAnimationDuration: 0,
5363
- computedSpreadMode: os({
5377
+ computedSpreadMode: rs({
5364
5378
  spreadMode: e.spreadMode,
5365
5379
  manifest: t
5366
5380
  })
@@ -5386,7 +5400,7 @@ class rs extends ss {
5386
5400
  };
5387
5401
  }
5388
5402
  }
5389
- class as extends fe {
5403
+ class us extends fe {
5390
5404
  onUnload() {
5391
5405
  return G;
5392
5406
  }
@@ -5405,34 +5419,34 @@ class as extends fe {
5405
5419
  getDocumentFrame() {
5406
5420
  }
5407
5421
  }
5408
- class cs extends _ {
5422
+ class ls extends B {
5409
5423
  constructor(e, t, i, o, s, r, a) {
5410
5424
  super(), this.item = e, this.containerElement = t, this.context = i, this.hookManager = o, this.renderer = s, this.settings = r, this.viewport = a, this.layoutTriggerSubject = new j(), this.lastLayout = null, this.applyDimsAfterLayout = ({
5411
5425
  blankPagePosition: c,
5412
5426
  minimumWidth: u
5413
5427
  }) => (l) => l.pipe(
5414
5428
  S((p) => {
5415
- const g = A(
5429
+ const g = O(
5416
5430
  this.lastLayout?.pageSize,
5417
5431
  this.viewport.pageSize
5418
- ) ? this.lastLayout : void 0, { width: h, height: d } = g ?? {}, { width: m = h, height: y = d } = p ?? {}, { width: f, height: b } = this.viewport.pageSize, I = this.validateDimension(
5432
+ ) ? this.lastLayout : void 0, { width: h, height: d } = g ?? {}, { width: m = h, height: y = d } = p ?? {}, { width: f, height: I } = this.viewport.pageSize, b = this.validateDimension(
5419
5433
  m ?? f,
5420
5434
  f,
5421
5435
  u
5422
- ), P = this.settings.values.computedPageTurnMode === "scrollable" ? y ?? b : this.validateDimension(
5423
- y ?? b,
5424
- b,
5425
- b
5436
+ ), F = this.settings.values.computedPageTurnMode === "scrollable" ? y ?? I : this.validateDimension(
5437
+ y ?? I,
5438
+ I,
5439
+ I
5426
5440
  );
5427
5441
  return this.lastLayout = {
5428
- width: I,
5429
- height: P,
5442
+ width: b,
5443
+ height: F,
5430
5444
  pageSize: this.viewport.pageSize
5431
- }, this.containerElement.style.width = `${I}px`, this.containerElement.style.height = `${P}px`, this.hookManager.execute("item.onAfterLayout", void 0, {
5445
+ }, this.containerElement.style.width = `${b}px`, this.containerElement.style.height = `${F}px`, this.hookManager.execute("item.onAfterLayout", void 0, {
5432
5446
  blankPagePosition: c,
5433
5447
  item: this.item,
5434
5448
  minimumWidth: u
5435
- }), { width: I, height: P };
5449
+ }), { width: b, height: F };
5436
5450
  })
5437
5451
  ), this.layout = (c) => {
5438
5452
  const u = Wn(this.layout$.pipe(U()));
@@ -5472,7 +5486,7 @@ class cs extends _ {
5472
5486
  }),
5473
5487
  R()
5474
5488
  ), this.layout$ = this.layoutProcess$.pipe(
5475
- L((c) => c.type === "end"),
5489
+ M((c) => c.type === "end"),
5476
5490
  S((c) => c.data),
5477
5491
  R()
5478
5492
  );
@@ -5506,7 +5520,7 @@ class Gt extends re {
5506
5520
  });
5507
5521
  }, this.destroy = () => {
5508
5522
  super.destroy(), this.containerElement.remove(), this.renderer.destroy();
5509
- }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = us(
5523
+ }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = ps(
5510
5524
  t,
5511
5525
  e,
5512
5526
  s
@@ -5522,7 +5536,7 @@ class Gt extends re {
5522
5536
  resourcesHandler: this.resourcesHandler,
5523
5537
  viewport: this.viewport
5524
5538
  };
5525
- this.renderer = c ? c(u) : new as(u), this.layout = new cs(
5539
+ this.renderer = c ? c(u) : new us(u), this.layout = new ls(
5526
5540
  e,
5527
5541
  this.containerElement,
5528
5542
  i,
@@ -5555,7 +5569,7 @@ class Gt extends re {
5555
5569
  l,
5556
5570
  p,
5557
5571
  this.layout.layout$
5558
- ).pipe(Y(this.destroy$)).subscribe();
5572
+ ).pipe(q(this.destroy$)).subscribe();
5559
5573
  }
5560
5574
  /**
5561
5575
  * Renderer loaded + spine item layout done
@@ -5585,7 +5599,7 @@ class Gt extends re {
5585
5599
  return this.renderer.state$.pipe(
5586
5600
  le(),
5587
5601
  oe((e) => e !== "idle"),
5588
- H(
5602
+ _(
5589
5603
  () => this.renderer.state$.pipe(
5590
5604
  oe((e) => e === "idle"),
5591
5605
  $t()
@@ -5608,14 +5622,14 @@ class Gt extends re {
5608
5622
  });
5609
5623
  }
5610
5624
  }
5611
- const us = (n, e, t) => {
5625
+ const ps = (n, e, t) => {
5612
5626
  const i = n.ownerDocument.createElement("div");
5613
5627
  return i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
5614
5628
  position: absolute;
5615
5629
  overflow: hidden;
5616
5630
  `, i.dataset.isReady = "false", t.execute("item.onBeforeContainerCreated", void 0, { element: i }), i;
5617
5631
  };
5618
- class ls extends _ {
5632
+ class ds extends B {
5619
5633
  constructor(e, t, i, o, s) {
5620
5634
  super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new W([]);
5621
5635
  const r = this.forcedOpenSubject.pipe(
@@ -5642,10 +5656,10 @@ class ls extends _ {
5642
5656
  useAbsoluteViewport: !1
5643
5657
  }) || {}, d = p === 1 / 0 ? 0 : g - p, m = p === 1 / 0 ? t.items.length - 1 : h + p, y = Array.from(
5644
5658
  { length: m - d + 1 },
5645
- (b, I) => d + I
5659
+ (I, b) => d + b
5646
5660
  ), f = [...l, ...y];
5647
- t.items.forEach((b, I) => {
5648
- f.includes(I) ? b.load() : b.unload();
5661
+ t.items.forEach((I, b) => {
5662
+ f.includes(b) ? I.load() : I.unload();
5649
5663
  });
5650
5664
  })
5651
5665
  ).pipe(T(this.destroy$)).subscribe();
@@ -5691,17 +5705,17 @@ class ye extends DOMRect {
5691
5705
  return new ye(i.x, i.y, i.width, i.height);
5692
5706
  }
5693
5707
  }
5694
- class ps {
5708
+ class gs {
5695
5709
  constructor({ width: e, height: t }) {
5696
5710
  this.__symbol = Symbol("AbsoluteViewport"), this.width = e, this.height = t;
5697
5711
  }
5698
5712
  }
5699
- class ds {
5713
+ class hs {
5700
5714
  constructor({ width: e, height: t }) {
5701
5715
  this.__symbol = Symbol("RelativeViewport"), this.width = e, this.height = t;
5702
5716
  }
5703
5717
  }
5704
- const gs = ({
5718
+ const ms = ({
5705
5719
  pageIndex: n,
5706
5720
  spineItemOrId: e,
5707
5721
  spineItemsManager: t
@@ -5723,7 +5737,7 @@ const gs = ({
5723
5737
  { currentAbsolutePage: 0, found: !1 }
5724
5738
  );
5725
5739
  return s;
5726
- }, hs = ({
5740
+ }, fs = ({
5727
5741
  itemHeight: n,
5728
5742
  itemWidth: e,
5729
5743
  visibleWidthOfItem: t,
@@ -5732,7 +5746,7 @@ const gs = ({
5732
5746
  }) => {
5733
5747
  const s = t / e, r = i / n;
5734
5748
  return o.type === "percentage" ? s >= o.value && r >= o.value : t >= o.value && i >= o.value;
5735
- }, ms = ({
5749
+ }, ys = ({
5736
5750
  visibleWidthOfItem: n,
5737
5751
  visibleHeightOfItem: e,
5738
5752
  threshold: t,
@@ -5764,14 +5778,14 @@ const gs = ({
5764
5778
  Math.min(n, g) - Math.max(i, p)
5765
5779
  );
5766
5780
  if (h <= 0 || d <= 0) return { visible: !1 };
5767
- const y = ms({
5781
+ const y = ys({
5768
5782
  threshold: r,
5769
5783
  visibleHeightOfItem: d,
5770
5784
  visibleWidthOfItem: h,
5771
5785
  viewportPosition: a
5772
5786
  });
5773
5787
  return c ? { visible: y } : {
5774
- visible: hs({
5788
+ visible: fs({
5775
5789
  itemHeight: s,
5776
5790
  itemWidth: o,
5777
5791
  threshold: r,
@@ -5792,10 +5806,10 @@ const gs = ({
5792
5806
  }, je = ({
5793
5807
  spineItemPosition: n,
5794
5808
  itemLayout: { left: e, top: t }
5795
- }) => new F({
5809
+ }) => new L({
5796
5810
  x: e + n.x,
5797
5811
  y: t + n.y
5798
- }), fs = ({
5812
+ }), Ss = ({
5799
5813
  position: n,
5800
5814
  threshold: e,
5801
5815
  restrictToScreen: t,
@@ -5814,16 +5828,16 @@ const gs = ({
5814
5828
  n,
5815
5829
  r.absoluteViewport,
5816
5830
  y
5817
- ), b = ye.from(
5831
+ ), I = ye.from(
5818
5832
  f,
5819
5833
  y
5820
- ), { visible: I } = Jt({
5834
+ ), { visible: b } = Jt({
5821
5835
  itemPosition: m,
5822
5836
  threshold: e,
5823
- viewportPosition: b,
5837
+ viewportPosition: I,
5824
5838
  restrictToScreen: t
5825
5839
  });
5826
- return I ? [...h, d] : h;
5840
+ return b ? [...h, d] : h;
5827
5841
  },
5828
5842
  []
5829
5843
  ), u = c[0] ?? a, l = c[c.length - 1] ?? u;
@@ -5833,7 +5847,7 @@ const gs = ({
5833
5847
  beginIndex: p ?? 0,
5834
5848
  endIndex: g ?? 0
5835
5849
  };
5836
- }, ys = ({
5850
+ }, Is = ({
5837
5851
  spineItemsManager: n,
5838
5852
  context: e,
5839
5853
  spineItemLocator: t,
@@ -5843,7 +5857,7 @@ const gs = ({
5843
5857
  }) => {
5844
5858
  const r = (d, m) => {
5845
5859
  const { left: y, top: f } = o.getSpineItemSpineLayoutInfo(m);
5846
- return new M({
5860
+ return new C({
5847
5861
  /**
5848
5862
  * when using spread the item could be on the right and therefore will be negative
5849
5863
  * @example
@@ -5855,7 +5869,7 @@ const gs = ({
5855
5869
  y: Math.max(d.y - f, 0)
5856
5870
  });
5857
5871
  }, a = (d) => je({
5858
- spineItemPosition: new M({ x: 0, y: 0 }),
5872
+ spineItemPosition: new C({ x: 0, y: 0 }),
5859
5873
  itemLayout: o.getSpineItemSpineLayoutInfo(d)
5860
5874
  }), c = (d) => n.items.find((m) => m.renderer.getDocumentFrame() === d), u = (d, m, y) => {
5861
5875
  if (typeof y == "number") {
@@ -5876,33 +5890,33 @@ const gs = ({
5876
5890
  threshold: m,
5877
5891
  spineItem: y,
5878
5892
  restrictToScreen: f,
5879
- useAbsoluteViewport: b = !0,
5880
- viewport: I
5893
+ useAbsoluteViewport: I = !0,
5894
+ viewport: b
5881
5895
  }) => {
5882
- const P = y.numberOfPages, N = Array.from(Array(P)).map((ne, be) => {
5896
+ const F = y.numberOfPages, A = Array.from(Array(F)).map((ne, Ie) => {
5883
5897
  const Ee = t.getSpineItemPositionFromPageIndex({
5884
- pageIndex: be,
5898
+ pageIndex: Ie,
5885
5899
  spineItem: y
5886
5900
  }), ae = je({
5887
5901
  spineItemPosition: Ee,
5888
5902
  itemLayout: o.getSpineItemSpineLayoutInfo(y)
5889
5903
  });
5890
5904
  return {
5891
- index: be,
5905
+ index: Ie,
5892
5906
  absolutePosition: {
5893
- width: I.pageSize.width,
5894
- height: I.pageSize.height,
5907
+ width: b.pageSize.width,
5908
+ height: b.pageSize.height,
5895
5909
  left: ae.x,
5896
5910
  top: ae.y,
5897
- bottom: ae.y + I.pageSize.height,
5898
- right: ae.x + I.pageSize.width
5911
+ bottom: ae.y + b.pageSize.height,
5912
+ right: ae.x + b.pageSize.width
5899
5913
  }
5900
5914
  };
5901
5915
  }).reduce(
5902
- (ne, { absolutePosition: be, index: Ee }) => {
5903
- const ae = b ? I.absoluteViewport : I.relativeViewport, Kt = Zt(
5916
+ (ne, { absolutePosition: Ie, index: Ee }) => {
5917
+ const ae = I ? b.absoluteViewport : b.relativeViewport, Kt = Zt(
5904
5918
  d,
5905
- I.absoluteViewport,
5919
+ b.absoluteViewport,
5906
5920
  ae
5907
5921
  ), Qt = ye.from(
5908
5922
  Kt,
@@ -5911,16 +5925,16 @@ const gs = ({
5911
5925
  viewportPosition: Qt,
5912
5926
  restrictToScreen: f,
5913
5927
  threshold: m,
5914
- itemPosition: be
5928
+ itemPosition: Ie
5915
5929
  });
5916
5930
  return en ? [...ne, Ee] : ne;
5917
5931
  },
5918
5932
  []
5919
- ), B = N[0], q = N[N.length - 1] ?? B;
5920
- if (!(B === void 0 || q === void 0))
5933
+ ), X = A[0], H = A[A.length - 1] ?? X;
5934
+ if (!(X === void 0 || H === void 0))
5921
5935
  return {
5922
- beginPageIndex: B,
5923
- endPageIndex: q
5936
+ beginPageIndex: X,
5937
+ endPageIndex: H
5924
5938
  };
5925
5939
  };
5926
5940
  return {
@@ -5937,7 +5951,7 @@ const gs = ({
5937
5951
  /**
5938
5952
  * @deprecated use Pages
5939
5953
  */
5940
- _getAbsolutePageIndexFromPageIndex: (d) => gs({
5954
+ _getAbsolutePageIndexFromPageIndex: (d) => ms({
5941
5955
  ...d,
5942
5956
  spineItemsManager: n
5943
5957
  }),
@@ -5957,7 +5971,7 @@ const gs = ({
5957
5971
  itemHeight: m.layout.layoutInfo.height,
5958
5972
  position: y,
5959
5973
  isUsingVerticalWriting: !!m.isUsingVerticalWriting()
5960
- }), b = t.getSpineItemPagePositionFromSpineItemPosition(
5974
+ }), I = t.getSpineItemPagePositionFromSpineItemPosition(
5961
5975
  y,
5962
5976
  f,
5963
5977
  m
@@ -5965,7 +5979,7 @@ const gs = ({
5965
5979
  return {
5966
5980
  spineItem: m,
5967
5981
  spineItemPageIndex: f,
5968
- spineItemPagePosition: b,
5982
+ spineItemPagePosition: I,
5969
5983
  pageSize: s.value.pageSize
5970
5984
  };
5971
5985
  },
@@ -5978,7 +5992,7 @@ const gs = ({
5978
5992
  }),
5979
5993
  getSpineItemFromIframe: c,
5980
5994
  getSpineItemPageIndexFromNode: u,
5981
- getVisibleSpineItemsFromPosition: (d) => fs({
5995
+ getVisibleSpineItemsFromPosition: (d) => Ss({
5982
5996
  spineItemsManager: n,
5983
5997
  spineLayout: o,
5984
5998
  viewport: s,
@@ -5989,22 +6003,22 @@ const gs = ({
5989
6003
  viewport: s
5990
6004
  }),
5991
6005
  isPositionWithinSpineItem: (d, m) => {
5992
- const { bottom: y, left: f, right: b, top: I } = o.getSpineItemSpineLayoutInfo(m);
5993
- return d.x >= f && d.x <= b && d.y <= y && d.y >= I;
6006
+ const { bottom: y, left: f, right: I, top: b } = o.getSpineItemSpineLayoutInfo(m);
6007
+ return d.x >= f && d.x <= I && d.y <= y && d.y >= b;
5994
6008
  },
5995
6009
  spineItemLocator: t,
5996
6010
  getSafeSpineItemPositionFromUnsafeSpineItemPosition: (d, m) => {
5997
6011
  const { height: y, width: f } = o.getSpineItemSpineLayoutInfo(m);
5998
- return new M({
6012
+ return new C({
5999
6013
  x: Math.min(Math.max(0, d.x), f),
6000
6014
  y: Math.min(Math.max(0, d.y), y)
6001
6015
  });
6002
6016
  }
6003
6017
  };
6004
- }, Ss = E.namespace("spine"), bs = ({
6018
+ }, bs = E.namespace("spine"), vs = ({
6005
6019
  position: n,
6006
6020
  pageSize: e
6007
- }) => new gi({
6021
+ }) => new mi({
6008
6022
  ...n,
6009
6023
  left: n.x,
6010
6024
  top: n.y,
@@ -6013,7 +6027,7 @@ const gs = ({
6013
6027
  bottom: n.y + e.height,
6014
6028
  right: n.x + e.width
6015
6029
  });
6016
- class Is extends re {
6030
+ class ws extends re {
6017
6031
  constructor(e, t, i, o, s, r) {
6018
6032
  super({ pages: [] }), this.spineLayout = e, this.spineItemsManager = t, this.spineItemLocator = i, this.context = o, this.locator = s, this.viewport = r, this.fromSpineItemPageIndex = (a, c) => this.value.pages.find(
6019
6033
  (u) => u.itemIndex === a.index && u.pageIndex === c
@@ -6026,16 +6040,16 @@ class Is extends re {
6026
6040
  const f = i.getSpineItemPositionFromPageIndex({
6027
6041
  spineItem: p,
6028
6042
  pageIndex: y
6029
- }), b = s.getSpinePositionFromSpineItemPosition({
6043
+ }), I = s.getSpinePositionFromSpineItemPosition({
6030
6044
  spineItem: p,
6031
6045
  spineItemPosition: f
6032
6046
  });
6033
6047
  return {
6034
- absoluteLayout: bs({
6048
+ absoluteLayout: vs({
6035
6049
  pageSize: a,
6036
- position: b
6050
+ position: I
6037
6051
  }),
6038
- layout: new di({
6052
+ layout: new hi({
6039
6053
  left: f.x,
6040
6054
  right: f.x + a.width,
6041
6055
  top: f.y,
@@ -6070,12 +6084,12 @@ class Is extends re {
6070
6084
  })
6071
6085
  );
6072
6086
  }),
6073
- S((a) => (Ss.info("Pages layout", a), { pages: a })),
6087
+ S((a) => (bs.info("Pages layout", a), { pages: a })),
6074
6088
  R()
6075
6089
  ), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
6076
6090
  }
6077
6091
  }
6078
- class vs extends _ {
6092
+ class xs extends B {
6079
6093
  constructor(e, t) {
6080
6094
  super(), this.spineItemsManager = e, this.spineLocator = t, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
6081
6095
  w((i) => {
@@ -6098,7 +6112,7 @@ class vs extends _ {
6098
6112
  );
6099
6113
  }
6100
6114
  }
6101
- const ws = ({
6115
+ const Ps = ({
6102
6116
  horizontalOffset: n,
6103
6117
  verticalOffset: e,
6104
6118
  context: t,
@@ -6123,34 +6137,34 @@ const ws = ({
6123
6137
  }).pipe(
6124
6138
  S(({ width: d, height: m }) => {
6125
6139
  if (s.values.computedPageTurnDirection === "vertical") {
6126
- const b = p ? e : e - c.absoluteViewport.height, I = p ? 0 : n;
6140
+ const I = p ? e : e - c.absoluteViewport.height, b = p ? 0 : n;
6127
6141
  t.isRTL() ? a.layout.adjustPositionOfElement({
6128
- top: b,
6129
- left: I
6142
+ top: I,
6143
+ left: b
6130
6144
  }) : a.layout.adjustPositionOfElement({
6131
- top: b,
6132
- left: I
6145
+ top: I,
6146
+ left: b
6133
6147
  });
6134
- const P = d + I, C = m + b, N = new He({
6135
- left: I,
6136
- right: P,
6137
- top: b,
6138
- bottom: C,
6148
+ const F = d + b, $ = m + I, A = new _e({
6149
+ left: b,
6150
+ right: F,
6151
+ top: I,
6152
+ bottom: $,
6139
6153
  height: m,
6140
6154
  width: d,
6141
- x: I,
6142
- y: b
6155
+ x: b,
6156
+ y: I
6143
6157
  });
6144
6158
  return {
6145
- horizontalOffset: P,
6146
- verticalOffset: C,
6147
- layoutPosition: N
6159
+ horizontalOffset: F,
6160
+ verticalOffset: $,
6161
+ layoutPosition: A
6148
6162
  };
6149
6163
  }
6150
6164
  a.layout.adjustPositionOfElement(
6151
6165
  t.isRTL() ? { right: n, top: 0 } : { left: n, top: 0 }
6152
6166
  );
6153
- const y = t.isRTL() ? c.absoluteViewport.width - n - d : n, f = new He({
6167
+ const y = t.isRTL() ? c.absoluteViewport.width - n - d : n, f = new _e({
6154
6168
  right: t.isRTL() ? c.absoluteViewport.width - n : n + d,
6155
6169
  left: y,
6156
6170
  x: y,
@@ -6168,22 +6182,22 @@ const ws = ({
6168
6182
  })
6169
6183
  );
6170
6184
  };
6171
- class xs extends _ {
6185
+ class $s extends B {
6172
6186
  constructor(e, t, i, o) {
6173
6187
  super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new j(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
6174
- $(() => {
6188
+ P(() => {
6175
6189
  this.spineItemsRelativeLayouts = [];
6176
6190
  }),
6177
6191
  w((r) => {
6178
6192
  const a = r.map(
6179
6193
  (u) => u.needsLayout$.pipe(
6180
- $(() => {
6194
+ P(() => {
6181
6195
  this.layout();
6182
6196
  })
6183
6197
  )
6184
6198
  ), c = r.map(
6185
6199
  (u) => u.loaded$.pipe(
6186
- $(() => {
6200
+ P(() => {
6187
6201
  u.isUsingVerticalWriting() ? this.context.update({
6188
6202
  hasVerticalWriting: !0
6189
6203
  }) : this.context.update({
@@ -6197,7 +6211,7 @@ class xs extends _ {
6197
6211
  ).pipe(T(this.destroy$)).subscribe();
6198
6212
  const s = new W(!1);
6199
6213
  this.layout$ = this.layoutSubject.pipe(
6200
- $(() => {
6214
+ P(() => {
6201
6215
  this.spineItemsManager.items.forEach((r) => {
6202
6216
  r.markDirty();
6203
6217
  });
@@ -6206,18 +6220,18 @@ class xs extends _ {
6206
6220
  // queue layout until previous layout is done
6207
6221
  Ue(
6208
6222
  () => s.pipe(
6209
- L((r) => !r),
6223
+ M((r) => !r),
6210
6224
  U()
6211
6225
  )
6212
6226
  ),
6213
6227
  Ue(() => {
6214
6228
  s.next(!0);
6215
- const r = this.context.manifest, a = _t(r) ?? !1;
6216
- return O(this.spineItemsManager.items).pipe(
6229
+ const r = this.context.manifest, a = Ht(r) ?? !1;
6230
+ return N(this.spineItemsManager.items).pipe(
6217
6231
  cn(
6218
6232
  (u, l, p) => u.pipe(
6219
6233
  ot(
6220
- ({ horizontalOffset: g, verticalOffset: h }) => ws({
6234
+ ({ horizontalOffset: g, verticalOffset: h }) => Ps({
6221
6235
  context: this.context,
6222
6236
  horizontalOffset: g,
6223
6237
  index: p,
@@ -6257,7 +6271,7 @@ class xs extends _ {
6257
6271
  }
6258
6272
  getSpineItemSpineLayoutInfo(e) {
6259
6273
  const t = this.spineItemsManager.getSpineItemIndex(e) ?? 0;
6260
- return this.spineItemsRelativeLayouts[t] || new He({
6274
+ return this.spineItemsRelativeLayouts[t] || new _e({
6261
6275
  left: 0,
6262
6276
  right: 0,
6263
6277
  top: 0,
@@ -6275,32 +6289,32 @@ class xs extends _ {
6275
6289
  super.destroy(), this.layoutSubject.complete();
6276
6290
  }
6277
6291
  }
6278
- class Ps extends _ {
6292
+ class Ts extends B {
6279
6293
  constructor(e, t, i, o, s, r, a) {
6280
6294
  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 W(
6281
6295
  void 0
6282
- ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new xs(
6296
+ ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new $s(
6283
6297
  i,
6284
6298
  e,
6285
6299
  s,
6286
6300
  a
6287
- ), this.locator = ys({
6301
+ ), this.locator = Is({
6288
6302
  context: e,
6289
6303
  spineItemsManager: i,
6290
6304
  spineItemLocator: o,
6291
6305
  settings: s,
6292
6306
  spineLayout: this.spineLayout,
6293
6307
  viewport: a
6294
- }), this.spineItemsLoader = new ls(
6308
+ }), this.spineItemsLoader = new ds(
6295
6309
  this.context,
6296
6310
  i,
6297
6311
  this.locator,
6298
6312
  s,
6299
6313
  this.spineLayout
6300
- ), this.spineItemsObserver = new vs(
6314
+ ), this.spineItemsObserver = new xs(
6301
6315
  i,
6302
6316
  this.locator
6303
- ), this.pages = new Is(
6317
+ ), this.pages = new ws(
6304
6318
  this.spineLayout,
6305
6319
  this.spineItemsManager,
6306
6320
  this.spineItemLocator,
@@ -6315,7 +6329,7 @@ class Ps extends _ {
6315
6329
  p.style.cssText = `
6316
6330
  height: 100%;
6317
6331
  position: relative;
6318
- `, p.className = `${ge}-spine`, this.elementSubject.next(p);
6332
+ `, p.className = `${pe}-spine`, this.elementSubject.next(p);
6319
6333
  })
6320
6334
  ), u = k([
6321
6335
  this.context.manifest$,
@@ -6338,7 +6352,7 @@ class Ps extends _ {
6338
6352
  this.spineItemsManager.addMany(g);
6339
6353
  })
6340
6354
  );
6341
- x(u, c).pipe(Y(this.destroy$)).subscribe();
6355
+ x(u, c).pipe(q(this.destroy$)).subscribe();
6342
6356
  }
6343
6357
  get element() {
6344
6358
  return this.elementSubject.getValue();
@@ -6356,7 +6370,7 @@ class Ps extends _ {
6356
6370
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
6357
6371
  }
6358
6372
  }
6359
- class $s extends _ {
6373
+ class Fs extends B {
6360
6374
  constructor(e, t) {
6361
6375
  super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new W([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6362
6376
  }
@@ -6397,7 +6411,7 @@ class $s extends _ {
6397
6411
  this.orderedSpineItemsSubject.value.forEach((e) => e.destroy());
6398
6412
  }
6399
6413
  }
6400
- class Ts extends re {
6414
+ class Ls extends re {
6401
6415
  constructor(e, t) {
6402
6416
  const i = document.createElement("div");
6403
6417
  i.style.cssText = `
@@ -6405,7 +6419,7 @@ class Ts extends re {
6405
6419
  position: relative;
6406
6420
  height: 100%;
6407
6421
  width: 100%;
6408
- `, i.className = `${ge}-viewport`, super({
6422
+ `, i.className = ei, super({
6409
6423
  element: i,
6410
6424
  pageSize: {
6411
6425
  width: 1,
@@ -6415,13 +6429,13 @@ class Ts extends re {
6415
6429
  height: 1
6416
6430
  }), this.context = e, this.settingsManager = t;
6417
6431
  const o = this.settingsManager.watch(["computedSpreadMode"]).pipe(
6418
- $(() => {
6432
+ P(() => {
6419
6433
  this.mergeCompare({
6420
6434
  pageSize: this.calculatePageSize(this.value)
6421
6435
  });
6422
6436
  })
6423
6437
  ), s = this.context.watch("rootElement").pipe(
6424
- $(() => {
6438
+ P(() => {
6425
6439
  this.layout();
6426
6440
  })
6427
6441
  );
@@ -6445,7 +6459,7 @@ class Ts extends re {
6445
6459
  });
6446
6460
  }
6447
6461
  get absoluteViewport() {
6448
- return new ps({
6462
+ return new gs({
6449
6463
  width: this.value.width,
6450
6464
  height: this.value.height
6451
6465
  });
@@ -6473,136 +6487,137 @@ class Ts extends re {
6473
6487
  */
6474
6488
  get relativeViewport() {
6475
6489
  const e = this.absoluteViewport, t = this.scaleFactor;
6476
- return new ds({
6490
+ return new hs({
6477
6491
  width: e.width / t,
6478
6492
  height: e.height / t
6479
6493
  });
6480
6494
  }
6481
6495
  }
6482
- const Fs = (n) => {
6483
- const e = new j(), t = new j(), i = new wo(), o = new Io(), s = new rs(n, o), r = new vo(o, s), a = new $s(o, s), c = new Ts(o, s), u = Yt({
6484
- context: o,
6485
- settings: s,
6486
- viewport: c
6487
- }), l = new ns(o, a), p = new Ps(
6488
- o,
6489
- l,
6490
- a,
6491
- u,
6496
+ const Ms = (n) => {
6497
+ const e = crypto.randomUUID(), t = new j(), i = new j(), o = new Po(), s = new wo(), r = new cs(n, s), a = new xo(s, r), c = new Fs(s, r), u = new Ls(s, r), l = Yt({
6498
+ context: s,
6499
+ settings: r,
6500
+ viewport: u
6501
+ }), p = new os(s, c), g = new Ts(
6492
6502
  s,
6493
- i,
6494
- c
6495
- ), g = ts({
6496
- context: o,
6497
- spineItemsManager: a,
6498
- hookManager: i,
6499
- spine: p,
6500
- settings: s,
6501
- viewport: c
6502
- }), h = new is(
6503
- o,
6504
- l,
6505
- a,
6506
6503
  p,
6504
+ c,
6505
+ l,
6506
+ r,
6507
+ o,
6507
6508
  u
6509
+ ), h = is({
6510
+ context: s,
6511
+ spineItemsManager: c,
6512
+ hookManager: o,
6513
+ spine: g,
6514
+ settings: r,
6515
+ viewport: u
6516
+ }), d = new ss(
6517
+ s,
6518
+ p,
6519
+ c,
6520
+ g,
6521
+ l
6508
6522
  );
6509
- g.viewportState$.subscribe(o.bridgeEvent.viewportStateSubject), g.navigation$.subscribe(o.bridgeEvent.navigationSubject), g.locker.isLocked$.subscribe(
6510
- o.bridgeEvent.navigationIsLockedSubject
6511
- ), l.subscribe(o.bridgeEvent.paginationSubject);
6512
- const d = () => {
6513
- e.next();
6514
- }, m = (P) => {
6515
- const { containerElement: C, manifest: N } = P;
6516
- if (o.manifest) {
6523
+ h.viewportState$.subscribe(s.bridgeEvent.viewportStateSubject), h.navigation$.subscribe(s.bridgeEvent.navigationSubject), h.locker.isLocked$.subscribe(
6524
+ s.bridgeEvent.navigationIsLockedSubject
6525
+ ), p.subscribe(s.bridgeEvent.paginationSubject);
6526
+ const m = () => {
6527
+ t.next();
6528
+ }, y = ($) => {
6529
+ const { containerElement: A, manifest: X } = $;
6530
+ if (s.manifest) {
6517
6531
  E.warn("loading a new book is not supported yet");
6518
6532
  return;
6519
6533
  }
6520
- E.log("load", { options: P });
6521
- const B = Ls(C);
6522
- o.update({
6523
- manifest: N,
6524
- rootElement: B
6525
- }), d();
6526
- }, y = s.watch(["computedSpreadMode"]).pipe(Tt(1), V(d)), f = e.pipe(
6534
+ E.log("load", { options: $ });
6535
+ const H = Cs(A, e);
6536
+ s.update({
6537
+ manifest: X,
6538
+ rootElement: H
6539
+ }), m();
6540
+ }, f = r.watch(["computedSpreadMode"]).pipe(Tt(1), V(m)), I = t.pipe(
6527
6541
  V(() => {
6528
- const P = o.value.rootElement;
6529
- P && (P.style.setProperty("overflow", "hidden"), c.layout(), p.layout());
6542
+ const $ = s.value.rootElement;
6543
+ $ && ($.style.setProperty("overflow", "hidden"), u.layout(), g.layout());
6530
6544
  }),
6531
- Y(t)
6532
- ), b = x(f, y).subscribe(), I = () => {
6533
- b.unsubscribe(), a.destroy(), h.destroy(), s.destroy(), l.destroy(), o.destroy(), g.destroy(), p.destroy(), r.destroy(), t.next(), t.complete(), c.destroy();
6545
+ q(i)
6546
+ ), b = x(I, f).subscribe(), F = () => {
6547
+ b.unsubscribe(), c.destroy(), d.destroy(), r.destroy(), p.destroy(), s.destroy(), h.destroy(), g.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
6534
6548
  };
6535
6549
  return {
6536
- context: o,
6537
- spine: p,
6538
- hookManager: i,
6550
+ id: e,
6551
+ context: s,
6552
+ spine: g,
6553
+ hookManager: o,
6539
6554
  cfi: {
6540
- generateCfiFromRange: Ji,
6555
+ generateCfiFromRange: Qi,
6541
6556
  parseCfi: nt,
6542
- generateCfiForSpineItemPage: (P) => _e({
6543
- ...P,
6544
- spine: p
6557
+ generateCfiForSpineItemPage: ($) => He({
6558
+ ...$,
6559
+ spine: g
6545
6560
  }),
6546
- resolveCfi: (P) => Wt({ ...P, spineItemsManager: a })
6561
+ resolveCfi: ($) => Wt({ ...$, spineItemsManager: c })
6547
6562
  },
6548
- navigation: g,
6549
- spineItemsObserver: p.spineItemsObserver,
6550
- spineItemsManager: a,
6551
- layout: d,
6552
- load: m,
6553
- destroy: I,
6563
+ navigation: h,
6564
+ spineItemsObserver: g.spineItemsObserver,
6565
+ spineItemsManager: c,
6566
+ layout: m,
6567
+ load: y,
6568
+ destroy: F,
6554
6569
  pagination: {
6555
6570
  get state() {
6556
- return l.value;
6571
+ return p.value;
6557
6572
  },
6558
6573
  get state$() {
6559
- return l;
6574
+ return p;
6560
6575
  }
6561
6576
  },
6562
- settings: s,
6563
- renderHeadless: (P) => a.get(P)?.renderer.renderHeadless() ?? v(void 0),
6564
- viewport: c,
6565
- viewportState$: o.bridgeEvent.viewportState$,
6566
- viewportFree$: o.bridgeEvent.viewportFree$,
6577
+ settings: r,
6578
+ renderHeadless: ($) => c.get($)?.renderer.renderHeadless() ?? v(void 0),
6579
+ viewport: u,
6580
+ viewportState$: s.bridgeEvent.viewportState$,
6581
+ viewportFree$: s.bridgeEvent.viewportFree$,
6567
6582
  /**
6568
6583
  * Dispatched when the reader has loaded a book and is rendering a book.
6569
6584
  * Using navigation API and getting information about current content will
6570
6585
  * have an effect.
6571
6586
  * It can typically be used to hide a loading indicator.
6572
6587
  */
6573
- state$: o.manifest$.pipe(
6574
- J((P) => P ? "ready" : "idle")
6588
+ state$: s.manifest$.pipe(
6589
+ J(($) => $ ? "ready" : "idle")
6575
6590
  ),
6576
- features: r,
6591
+ features: a,
6577
6592
  $: {
6578
- destroy$: t
6593
+ destroy$: i
6579
6594
  }
6580
6595
  };
6581
- }, Ls = (n) => (n.style.cssText = `
6596
+ }, Cs = (n, e) => (n.style.cssText = `
6582
6597
  ${n.style.cssText}
6583
6598
  background-color: white;
6584
6599
  position: relative;
6585
- `, n.classList.add(`${ge}-reader`), n), ks = (
6600
+ `, n.classList.add(`${pe}-reader`), n.setAttribute(Qn, e), n), Bs = (
6586
6601
  //__
6587
- lo(
6602
+ go(
6588
6603
  Bn(
6589
- Ti(
6590
- ho(
6591
- _n(
6604
+ Li(
6605
+ fo(
6606
+ Hn(
6592
6607
  Pn(
6593
- so(
6594
- go(
6595
- So(
6596
- Ui(
6597
- pi(
6598
- Li(
6608
+ ao(
6609
+ mo(
6610
+ bo(
6611
+ Wi(
6612
+ gi(
6613
+ Ci(
6599
6614
  $n(
6600
- po(
6601
- no(
6602
- wi(
6615
+ ho(
6616
+ oo(
6617
+ Pi(
6603
6618
  zn(
6604
6619
  // __
6605
- Fs
6620
+ Ms
6606
6621
  )
6607
6622
  )
6608
6623
  )
@@ -6620,66 +6635,75 @@ const Fs = (n) => {
6620
6635
  )
6621
6636
  )
6622
6637
  )
6623
- ), Us = (n) => (e) => n(e);
6638
+ ), Xs = (n) => (e) => n(e);
6624
6639
  export {
6625
6640
  jt as AbstractSpinePosition,
6626
- Io as Context,
6627
- To as ControlledNavigationController,
6628
- _ as DestroyableClass,
6641
+ wo as Context,
6642
+ Lo as ControlledNavigationController,
6643
+ B as DestroyableClass,
6629
6644
  fe as DocumentRenderer,
6630
- vo as Features,
6631
- wo as HookManager,
6632
- Wo as InternalNavigator,
6645
+ xo as Features,
6646
+ Qn as HTML_ATTRIBUTE_DATA_READER_ID,
6647
+ ei as HTML_ATTRIBUTE_VIEWPORT_CLASSNAME,
6648
+ pe as HTML_PREFIX,
6649
+ Po as HookManager,
6650
+ Kn as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6651
+ Ho as InternalNavigator,
6633
6652
  tt as LayoutEntry,
6634
6653
  Bt as Locker,
6635
- Is as Pages,
6636
- ns as Pagination,
6637
- is as PaginationController,
6654
+ Ws as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
6655
+ Us as PROSE_READER_NAMESPACE,
6656
+ ws as Pages,
6657
+ os as Pagination,
6658
+ ss as PaginationController,
6659
+ re as ReactiveEntity,
6638
6660
  et as ResourceHandler,
6639
- to as ResourcesLocator,
6640
- Lo as ScrollNavigationController,
6661
+ io as ResourcesLocator,
6662
+ Co as ScrollNavigationController,
6641
6663
  mt as ScrollPosition,
6642
- ss as SettingsManager,
6643
- Ps as Spine,
6664
+ as as SettingsManager,
6665
+ Ts as Spine,
6644
6666
  Gt as SpineItem,
6645
- di as SpineItemPageLayout,
6646
- gi as SpineItemPageSpineLayout,
6647
- M as SpineItemPosition,
6648
- He as SpineItemSpineLayout,
6649
- $s as SpineItemsManager,
6650
- vs as SpineItemsObserver,
6651
- F as SpinePosition,
6667
+ hi as SpineItemPageLayout,
6668
+ mi as SpineItemPageSpineLayout,
6669
+ C as SpineItemPosition,
6670
+ _e as SpineItemSpineLayout,
6671
+ Fs as SpineItemsManager,
6672
+ xs as SpineItemsObserver,
6673
+ L as SpinePosition,
6652
6674
  Re as UnboundSpineItemPagePosition,
6653
6675
  he as UnboundSpinePosition,
6654
- Ts as Viewport,
6655
- eo as consolidate,
6656
- ks as createReader,
6676
+ zs as VIEWPORT_ADJUSTMENT_THROTTLE,
6677
+ Ls as Viewport,
6678
+ no as consolidate,
6679
+ Bs as createReader,
6657
6680
  at as deferIdle,
6658
6681
  Wn as deferNextResult,
6659
- _e as generateCfiForSpineItemPage,
6660
- Ji as generateCfiFromRange,
6661
- de as generateRootCfi,
6682
+ He as generateCfiForSpineItemPage,
6683
+ Qi as generateCfiFromRange,
6684
+ ge as generateRootCfi,
6662
6685
  rt as getAttributeValueFromString,
6686
+ js as getBase64FromBlob,
6663
6687
  Ze as getFrameViewportInfo,
6664
- js as getItemAnchor,
6665
- pi as htmlEnhancer,
6688
+ Hs as getItemAnchor,
6689
+ gi as htmlEnhancer,
6666
6690
  Rt as idle,
6667
6691
  vn as injectCSS,
6668
6692
  Et as isHtmlElement,
6669
- An as isHtmlTagElement,
6693
+ On as isHtmlTagElement,
6670
6694
  Be as isRootCfi,
6671
- Hs as isShallowEqual,
6672
- wi as layoutEnhancer,
6695
+ Gs as isShallowEqual,
6696
+ Pi as layoutEnhancer,
6673
6697
  Dt as mapKeysTo,
6674
- Os as observeIntersection,
6698
+ Vs as observeIntersection,
6675
6699
  ct as observeMutation,
6676
6700
  Qe as observeResize,
6677
- no as paginationEnhancer,
6701
+ oo as paginationEnhancer,
6678
6702
  nt as parseCfi,
6679
- Ns as removeCSS,
6703
+ Os as removeCSS,
6680
6704
  Wt as resolveCfi,
6681
- Us as rootEnhancer,
6682
- bs as spinePositionToSpineItemSpineLayout,
6705
+ Xs as rootEnhancer,
6706
+ vs as spinePositionToSpineItemSpineLayout,
6683
6707
  ee as upsertCSSToFrame,
6684
6708
  wn as waitForFrameLoad,
6685
6709
  xn as waitForFrameReady,