@prose-reader/core 1.268.0 → 1.270.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,11 +1,11 @@
1
- import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as A, takeUntil as $, Observable as se, defer as Ft, Subject as R, combineLatest as N, merge as x, EMPTY as _, NEVER as he, tap as P, share as j, BehaviorSubject as Y, distinctUntilChanged as k, filter as M, mergeMap as ge, first as V, endWith as ye, catchError as Ue, finalize as pe, lastValueFrom as an, scheduled as cn, animationFrameScheduler as ce, exhaustMap as ze, debounceTime as be, withLatestFrom as z, throttleTime as un, startWith as ne, shareReplay as J, switchScan as ln, defaultIfEmpty as dn, forkJoin as pn, delay as xe, timer as Te, skip as Lt, ReplaySubject as ot, identity as Pe, reduce as gn, concatMap as st } from "rxjs";
2
- import { Report as hn, isShallowEqual as U, shallowMergeIfDefined as $e, getParentPath as mn, parseContentType as fn, detectMimeTypeFromName as Me, arrayEqual as yn } from "@prose-reader/shared";
3
- import { isShallowEqual as or } from "@prose-reader/shared";
4
- import { switchMap as X, first as Mt, map as ie, distinctUntilChanged as fe, startWith as Sn, shareReplay as Ze, tap as O, pairwise as In, take as bn, takeUntil as K, filter as ae, debounceTime as vn, skip as Ct, mergeMap as wn, catchError as rt } from "rxjs/operators";
5
- import { generate as We, parse as Et, isIndirectionOnly as xn, isParsedCfiRange as Pn, resolve as $n } from "@prose-reader/cfi";
6
- const Tn = "@prose-reader/core", D = hn.namespace(Tn, void 0, {
1
+ import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as A, takeUntil as $, Observable as se, defer as Ft, Subject as R, combineLatest as O, merge as P, EMPTY as _, NEVER as he, tap as x, share as j, BehaviorSubject as Y, distinctUntilChanged as k, filter as M, mergeMap as ge, first as V, endWith as ye, catchError as Ue, finalize as pe, lastValueFrom as rn, scheduled as an, animationFrameScheduler as ce, exhaustMap as ze, debounceTime as be, withLatestFrom as z, throttleTime as cn, startWith as ne, shareReplay as J, switchScan as un, defaultIfEmpty as ln, forkJoin as dn, delay as Pe, timer as Te, skip as Lt, ReplaySubject as ot, identity as xe, reduce as pn, concatMap as st } from "rxjs";
2
+ import { Report as gn, isShallowEqual as U, shallowMergeIfDefined as $e, getParentPath as hn, parseContentType as mn, detectMimeTypeFromName as Me, arrayEqual as fn } from "@prose-reader/shared";
3
+ import { isShallowEqual as nr } from "@prose-reader/shared";
4
+ import { switchMap as X, first as Mt, map as ie, distinctUntilChanged as fe, startWith as yn, shareReplay as Ze, tap as N, pairwise as Sn, take as In, takeUntil as K, filter as ae, debounceTime as bn, skip as Ct, mergeMap as vn, catchError as rt } from "rxjs/operators";
5
+ import { generate as We, parse as Et, isIndirectionOnly as wn, isParsedCfiRange as Pn, resolve as xn } from "@prose-reader/cfi";
6
+ const $n = "@prose-reader/core", D = gn.namespace($n, void 0, {
7
7
  color: "#98cde7"
8
- }), Fn = [
8
+ }), Tn = [
9
9
  "pointercancel",
10
10
  "pointerdown",
11
11
  "pointerenter",
@@ -17,24 +17,24 @@ const Tn = "@prose-reader/core", D = hn.namespace(Tn, void 0, {
17
17
  // `touchstart` as const,
18
18
  // `touchend` as const,
19
19
  ];
20
- function Ln(n, e, t) {
20
+ function Fn(n, e, t) {
21
21
  if ("caretPositionFromPoint" in n)
22
22
  return n.caretPositionFromPoint(e, t);
23
23
  if ("caretRangeFromPoint" in n && // @ts-expect-error limited availability
24
24
  typeof n.caretRangeFromPoint < "u")
25
25
  return n.caretRangeFromPoint(e, t);
26
26
  }
27
- const Mn = (n, e) => {
27
+ const Ln = (n, e) => {
28
28
  const t = "body" in n ? _e(n.body, e) : _e(n, e), i = "createRange" in n ? n : n.ownerDocument;
29
29
  if (t) {
30
30
  let o, s = 0;
31
31
  const r = i.createRange();
32
32
  return Array.from(t.childNodes).some((a) => {
33
33
  r.selectNodeContents(a);
34
- const c = r.getClientRects(), u = Cn(c, e);
34
+ const c = r.getClientRects(), u = Mn(c, e);
35
35
  if (u) {
36
36
  o = r.cloneRange();
37
- const l = Ln(
37
+ const l = Fn(
38
38
  i,
39
39
  Math.ceil(u.left),
40
40
  Math.ceil(u.top)
@@ -64,13 +64,13 @@ const Mn = (n, e) => {
64
64
  function Dt(n, { left: e, right: t }) {
65
65
  return n.left <= e && n.right <= e ? "before" : n.left <= e && n.right > e && n.right <= t ? "partially-before" : n.left <= t && n.right > t ? "partially-after" : n.left > t ? "after" : "within";
66
66
  }
67
- function Cn(n, e) {
67
+ function Mn(n, e) {
68
68
  return Array.from(n).find((t) => {
69
69
  const i = Dt(t, e);
70
70
  return i !== "before" && i !== "after";
71
71
  });
72
72
  }
73
- const En = (n, e) => {
73
+ const Cn = (n, e) => {
74
74
  if (n.nodeType !== Node.CDATA_SECTION_NODE && n.nodeType !== Node.DOCUMENT_TYPE_NODE) {
75
75
  const t = n.ownerDocument?.createRange();
76
76
  t?.selectNodeContents(n);
@@ -92,8 +92,8 @@ const En = (n, e) => {
92
92
  if (e.PointerEvent && n instanceof e.PointerEvent)
93
93
  return !0;
94
94
  }
95
- return !!Fn.includes(n.type);
96
- }, Dn = (n) => {
95
+ return !!Tn.includes(n.type);
96
+ }, En = (n) => {
97
97
  if (Je(n)) return !1;
98
98
  if (n?.target && n?.target?.ownerDocument?.defaultView) {
99
99
  const e = n?.target?.ownerDocument?.defaultView;
@@ -106,7 +106,7 @@ const En = (n, e) => {
106
106
  return n instanceof e.MouseEvent;
107
107
  }
108
108
  return !1;
109
- }, Rn = (n) => {
109
+ }, Dn = (n) => {
110
110
  if (n?.target && n?.target?.ownerDocument?.defaultView) {
111
111
  const e = n?.target?.ownerDocument?.defaultView;
112
112
  if (e.TouchEvent)
@@ -118,7 +118,7 @@ const En = (n, e) => {
118
118
  return n instanceof e.TouchEvent;
119
119
  }
120
120
  return !1;
121
- }, An = () => document.createElement("div"), Rt = (n) => {
121
+ }, Rn = () => document.createElement("div"), Rt = (n) => {
122
122
  const e = [
123
123
  "img",
124
124
  // Images
@@ -134,7 +134,7 @@ const En = (n, e) => {
134
134
  // JavaScript files
135
135
  ].join(",");
136
136
  return Array.from(n?.querySelectorAll(e) || []);
137
- }, On = (n) => {
137
+ }, An = (n) => {
138
138
  if (Rt(n).forEach((t) => {
139
139
  const i = t.getAttribute("src") || t.getAttribute("href");
140
140
  i?.startsWith("blob:") && n?.defaultView?.URL.revokeObjectURL(i);
@@ -161,7 +161,7 @@ function At(n, e, t = []) {
161
161
  return !1;
162
162
  return !0;
163
163
  }
164
- function Ot(n) {
164
+ function Nt(n) {
165
165
  return At(
166
166
  n,
167
167
  ["nodeType"],
@@ -170,9 +170,9 @@ function Ot(n) {
170
170
  ) && n.nodeType === Node.ELEMENT_NODE;
171
171
  }
172
172
  function Nn(n, e) {
173
- return Ot(n) && n.tagName.toLowerCase() === e.toLowerCase();
173
+ return Nt(n) && n.tagName.toLowerCase() === e.toLowerCase();
174
174
  }
175
- function Vn(n) {
175
+ function On(n) {
176
176
  return At(
177
177
  n,
178
178
  [
@@ -199,9 +199,9 @@ const Ce = (n, e, t, i) => {
199
199
  }, at = (n, e) => {
200
200
  const t = new RegExp(`${e}\\s*=\\s*([0-9.]+)`, "i"), i = n.match(t) || [], o = i[1] || "0";
201
201
  return i && Number.parseFloat(o) || 0;
202
- }, jn = (n, e, t, i) => {
202
+ }, Vn = (n, e, t, i) => {
203
203
  n?.contentDocument?.head && Ce(n.contentDocument, e, t, i);
204
- }, Bs = (n, e) => {
204
+ }, _s = (n, e) => {
205
205
  n?.contentDocument && Ee(n.contentDocument, e);
206
206
  }, oe = (n, e, t, i) => {
207
207
  if (!n) return;
@@ -212,7 +212,7 @@ const Ce = (n, e, t, i) => {
212
212
  o.innerHTML = t;
213
213
  return;
214
214
  }
215
- jn(n, e, t, i);
215
+ Vn(n, e, t, i);
216
216
  }, Ke = (n) => {
217
217
  if (n?.contentDocument) {
218
218
  const t = n.contentDocument.querySelector("meta[name='viewport']");
@@ -229,17 +229,17 @@ const Ce = (n, e, t, i) => {
229
229
  }
230
230
  }
231
231
  return { hasViewport: !1 };
232
- }, kn = (n) => n.pipe(
232
+ }, jn = (n) => n.pipe(
233
233
  w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : q(e, "load").pipe(
234
234
  Tt(1),
235
235
  S(() => e)
236
236
  ))
237
- ), Un = (n) => n.pipe(
237
+ ), kn = (n) => n.pipe(
238
238
  w((e) => {
239
239
  const t = e?.contentDocument?.fonts.ready;
240
240
  return t ? A(t).pipe(S(() => e)) : v(void 0);
241
241
  })
242
- ), zn = (n) => (e) => {
242
+ ), Un = (n) => (e) => {
243
243
  const t = n(e), i = new IntersectionObserver((o) => {
244
244
  o.forEach((s) => {
245
245
  s.isIntersecting ? s.target.removeAttribute("tab-index") : s.target.setAttribute("tab-index", "-1");
@@ -274,7 +274,7 @@ const Ce = (n, e, t, i) => {
274
274
  ), {
275
275
  ...t
276
276
  };
277
- }, Wn = (n) => (e) => {
277
+ }, zn = (n) => (e) => {
278
278
  const t = n(e);
279
279
  return t.context.watch("rootElement").pipe($(t.context.destroy$)).subscribe((i) => {
280
280
  if (!i) return;
@@ -295,7 +295,7 @@ const Ce = (n, e, t, i) => {
295
295
  clientX: a,
296
296
  clientY: c
297
297
  };
298
- }, _n = (n, e, t, i) => {
298
+ }, Wn = (n, e, t, i) => {
299
299
  const o = e?.view?.frameElement;
300
300
  if (!e || !o) return n;
301
301
  const s = t.getSpineItemFromIframe(o), r = o, { height: a, width: c } = i.pageSize;
@@ -315,7 +315,7 @@ const Ce = (n, e, t, i) => {
315
315
  enumerable: !0
316
316
  }), d;
317
317
  }
318
- if (Dn(n)) {
318
+ if (En(n)) {
319
319
  const { clientX: u, clientY: l } = Ae({
320
320
  position: n,
321
321
  frameElement: r
@@ -329,7 +329,7 @@ const Ce = (n, e, t, i) => {
329
329
  enumerable: !0
330
330
  }), d;
331
331
  }
332
- if (Rn(n)) {
332
+ if (Dn(n)) {
333
333
  const u = Array.from(n.touches).map((d) => {
334
334
  const { clientX: p, clientY: g } = Ae({
335
335
  position: d,
@@ -352,7 +352,7 @@ const Ce = (n, e, t, i) => {
352
352
  }), l;
353
353
  }
354
354
  return n;
355
- }, Hn = [
355
+ }, _n = [
356
356
  "pointercancel",
357
357
  "pointerdown",
358
358
  "pointerenter",
@@ -361,21 +361,21 @@ const Ce = (n, e, t, i) => {
361
361
  "pointerout",
362
362
  "pointerover",
363
363
  "pointerup"
364
- ], Bn = [
365
- ...Hn
364
+ ], Hn = [
365
+ ..._n
366
366
  /*, ...mouseEvents*/
367
- ], Xn = (n) => (e) => {
367
+ ], Bn = (n) => (e) => {
368
368
  const t = n(e);
369
369
  return t.hookManager.register(
370
370
  "item.onDocumentLoad",
371
371
  ({ destroy: i, itemId: o }) => {
372
372
  const s = t.spineItemsManager.get(o), r = s?.renderer.getDocumentFrame();
373
373
  if (!r || !s) return;
374
- const a = Bn.map((c) => {
374
+ const a = Hn.map((c) => {
375
375
  const u = (l) => {
376
376
  let d = l;
377
377
  if (Je(l) && (d = new PointerEvent(l.type, l)), d !== l) {
378
- const p = _n(
378
+ const p = Wn(
379
379
  d,
380
380
  l,
381
381
  t.spine.locator,
@@ -395,13 +395,13 @@ const Ce = (n, e, t, i) => {
395
395
  });
396
396
  }
397
397
  ), t;
398
- }, Nt = (n) => ie((e) => Object.entries(e).reduce(
398
+ }, Ot = (n) => ie((e) => Object.entries(e).reduce(
399
399
  (t, [i, o]) => n.includes(i) ? {
400
400
  ...t,
401
401
  [i]: o
402
402
  } : t,
403
403
  {}
404
- )), Qe = (n) => (e) => e.pipe(Nt(n), fe(U));
404
+ )), Qe = (n) => (e) => e.pipe(Ot(n), fe(U));
405
405
  function et(n) {
406
406
  return new se((e) => {
407
407
  const t = new ResizeObserver((i) => {
@@ -419,7 +419,7 @@ const De = (n) => (e) => e.pipe(
419
419
  ie(() => t)
420
420
  )
421
421
  )
422
- ), Yn = (n) => {
422
+ ), Xn = (n) => {
423
423
  let e;
424
424
  const t = n.subscribe((i) => {
425
425
  e = { result: i };
@@ -449,7 +449,7 @@ const ut = (n, e) => new se((t) => {
449
449
  });
450
450
  return i.observe(n, e), () => i.disconnect();
451
451
  });
452
- function Xs(n, e) {
452
+ function Hs(n, e) {
453
453
  return new se((t) => {
454
454
  const i = new IntersectionObserver((o) => {
455
455
  t.next(o);
@@ -469,9 +469,9 @@ class jt {
469
469
  this.outputSettings = this.computeOutputSettings(i), this.inputSettings = $e(
470
470
  this.getDefaultSettings(),
471
471
  e
472
- ), this.outputSettingsUpdateSubject = new R(), this.values$ = N([
472
+ ), this.outputSettingsUpdateSubject = new R(), this.values$ = O([
473
473
  this.settingsManager.values$,
474
- this.outputSettingsUpdateSubject.pipe(Sn(this.outputSettings))
474
+ this.outputSettingsUpdateSubject.pipe(yn(this.outputSettings))
475
475
  ]).pipe(
476
476
  ie(([o, s]) => ({ ...o, ...s })),
477
477
  Ze(1)
@@ -507,7 +507,7 @@ class jt {
507
507
  this.outputSettingsUpdateSubject.complete();
508
508
  }
509
509
  }
510
- const Ys = (n) => {
510
+ const Bs = (n) => {
511
511
  const e = new FileReader();
512
512
  return new Promise((t) => {
513
513
  e.addEventListener(
@@ -519,7 +519,7 @@ const Ys = (n) => {
519
519
  ), e.readAsDataURL(n);
520
520
  });
521
521
  };
522
- let qn = class extends jt {
522
+ let Yn = class extends jt {
523
523
  computeOutputSettings(e) {
524
524
  return e;
525
525
  }
@@ -545,8 +545,8 @@ let qn = class extends jt {
545
545
  };
546
546
  }
547
547
  };
548
- const Gn = (n) => (e) => {
549
- const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new R(), a = n(e), c = new qn(
548
+ const qn = (n) => (e) => {
549
+ const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new R(), a = n(e), c = new Yn(
550
550
  {
551
551
  fontScale: t,
552
552
  lineHeight: i,
@@ -578,12 +578,12 @@ const Gn = (n) => (e) => {
578
578
  }
579
579
  });
580
580
  const d = (p) => p.pipe(
581
- In(),
581
+ Sn(),
582
582
  S(([g, h]) => h.fontScale !== g.fontScale || h.lineHeight !== g.lineHeight)
583
583
  );
584
584
  return c.values$.pipe(
585
585
  d,
586
- O(l),
586
+ N(l),
587
587
  $(a.$.destroy$)
588
588
  ).subscribe(), {
589
589
  ...a,
@@ -592,7 +592,7 @@ const Gn = (n) => (e) => {
592
592
  },
593
593
  settings: c
594
594
  };
595
- }, Zn = (n) => (e) => {
595
+ }, Gn = (n) => (e) => {
596
596
  const t = n(e), i = (o) => q(o, "keyup").pipe(
597
597
  S((s) => {
598
598
  const { pageTurnDirection: r, computedPageTurnMode: a } = t.settings.values;
@@ -615,7 +615,7 @@ const Gn = (n) => (e) => {
615
615
  );
616
616
  return i(document).pipe($(t.$.destroy$)).subscribe(), t.spineItemsManager.items$.pipe(
617
617
  w(
618
- (o) => x(
618
+ (o) => P(
619
619
  ...o.map(
620
620
  (s) => s.watch("isLoaded").pipe(
621
621
  w(() => {
@@ -628,9 +628,9 @@ const Gn = (n) => (e) => {
628
628
  ),
629
629
  $(t.$.destroy$)
630
630
  ).subscribe(), t;
631
- }, Jn = (n) => n.spine.spineItemsManager.items$.pipe(
631
+ }, Zn = (n) => n.spine.spineItemsManager.items$.pipe(
632
632
  w(
633
- (e) => x(
633
+ (e) => P(
634
634
  ...e.map((t) => t.watch("isLoaded").pipe(
635
635
  w(() => {
636
636
  const i = t.renderer.getDocumentFrame();
@@ -640,12 +640,12 @@ const Gn = (n) => (e) => {
640
640
  ).map(
641
641
  (r) => q(r, "click")
642
642
  );
643
- return x(...s);
643
+ return P(...s);
644
644
  })
645
645
  ))
646
646
  )
647
647
  ),
648
- P((e) => {
648
+ x((e) => {
649
649
  e.preventDefault();
650
650
  }),
651
651
  j()
@@ -705,7 +705,7 @@ const Le = class Le extends Q {
705
705
  }).filter(
706
706
  (l) => l instanceof se
707
707
  );
708
- return N([v(null), ...u]).pipe(V());
708
+ return O([v(null), ...u]).pipe(V());
709
709
  })
710
710
  ))),
711
711
  S(() => {
@@ -719,13 +719,13 @@ const Le = class Le extends Q {
719
719
  ge(() => this.value.state === "unloading" || this.value.state === "idle" ? _ : (this.next({ state: "unloading", error: void 0 }), this.context.bridgeEvent.viewportFree$.pipe(
720
720
  V(),
721
721
  w(() => (this.hookManager.destroy("item.onDocumentLoad", this.item.id), this.onUnload().pipe(ye(null), V()))),
722
- P(() => {
722
+ x(() => {
723
723
  this.next({ state: "idle", error: void 0 });
724
724
  }),
725
725
  $(i)
726
726
  )))
727
727
  );
728
- x(this.loaded$, o).pipe(
728
+ P(this.loaded$, o).pipe(
729
729
  Ue((s) => (this.next({ state: "error", error: s }), _)),
730
730
  $(this.destroy$)
731
731
  ).subscribe();
@@ -802,15 +802,15 @@ const Le = class Le extends Q {
802
802
  };
803
803
  Le.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
804
804
  let Se = Le;
805
- const Kn = (n) => new URL(n.href);
805
+ const Jn = (n) => new URL(n.href);
806
806
  class tt {
807
807
  constructor(e, t) {
808
808
  this.item = e, this.settings = t;
809
809
  }
810
810
  async getResource() {
811
- return await an(
811
+ return await rn(
812
812
  this.settings.values.getResource?.(this.item) ?? v(void 0)
813
- ) ?? Kn(this.item);
813
+ ) ?? Jn(this.item);
814
814
  }
815
815
  async fetchResource() {
816
816
  const e = await this.getResource();
@@ -820,7 +820,7 @@ class tt {
820
820
  const kt = (n, e) => {
821
821
  const t = n.startsWith("file://"), i = t ? n.replace("file://", "http://") : n, o = new URL(e, i).toString();
822
822
  return t ? o.replace("http://", "file://") : o;
823
- }, Qn = async (n, e, t, i, o) => {
823
+ }, Kn = async (n, e, t, i, o) => {
824
824
  if (!n || !n.defaultView) return;
825
825
  const s = e.sheet;
826
826
  if (s)
@@ -868,7 +868,7 @@ const kt = (n, e) => {
868
868
  } catch (r) {
869
869
  console.error("Could not access stylesheet rules:", r);
870
870
  }
871
- }, ei = (n, e, t, i, o) => {
871
+ }, Qn = (n, e, t, i, o) => {
872
872
  const s = e.getAttribute("src") || e.getAttribute("href");
873
873
  if (!s) return v(null);
874
874
  const r = i.manifest?.items.find(({ href: c }) => `${kt(t, s).toLowerCase()}`.endsWith(
@@ -890,7 +890,7 @@ const kt = (n, e) => {
890
890
  return new se((l) => {
891
891
  e.onload = async () => {
892
892
  try {
893
- e.sheet && await Qn(
893
+ e.sheet && await Kn(
894
894
  n,
895
895
  e,
896
896
  t,
@@ -905,7 +905,7 @@ const kt = (n, e) => {
905
905
  return v(null);
906
906
  })
907
907
  );
908
- }, ti = ({
908
+ }, ei = ({
909
909
  settings: n,
910
910
  item: e,
911
911
  context: t
@@ -913,8 +913,8 @@ const kt = (n, e) => {
913
913
  w((o) => {
914
914
  const s = Rt(
915
915
  o.contentDocument
916
- ), r = mn(e.href), a = s.map(
917
- (c) => ei(
916
+ ), r = hn(e.href), a = s.map(
917
+ (c) => Qn(
918
918
  o.contentDocument,
919
919
  c,
920
920
  r,
@@ -922,13 +922,13 @@ const kt = (n, e) => {
922
922
  n
923
923
  )
924
924
  );
925
- return N(a).pipe(S(() => o));
925
+ return O(a).pipe(S(() => o));
926
926
  })
927
- ), ni = (n) => {
928
- On(n?.contentDocument);
929
- }, Gs = "@prose-reader/core", Zs = 0, Js = 200, ii = [".xhtml", ".html", ".htm"], W = "prose-reader", Ut = `${W}-style`, oi = `data-${W}-id`, si = `${W}-viewport`, ri = `${W}-scroll-navigator`, ai = async (n, e) => {
927
+ ), ti = (n) => {
928
+ An(n?.contentDocument);
929
+ }, Ys = "@prose-reader/core", qs = 0, Gs = 200, ni = [".xhtml", ".html", ".htm"], W = "prose-reader", Ut = `${W}-style`, ii = `data-${W}-id`, oi = `${W}-viewport`, si = `${W}-scroll-navigator`, ri = async (n, e) => {
930
930
  if (typeof n == "string") return n;
931
- const t = fn(n.headers.get("Content-Type") || "") || Me(e.href);
931
+ const t = mn(n.headers.get("Content-Type") || "") || Me(e.href);
932
932
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
933
933
  (o) => o === t
934
934
  )) {
@@ -964,11 +964,11 @@ const kt = (n, e) => {
964
964
  </body>
965
965
  </html>
966
966
  ` : await n.text();
967
- }, ci = ({
967
+ }, ai = ({
968
968
  item: n,
969
969
  resourcesHandler: e
970
970
  }) => {
971
- const t = (i) => ai(i, n);
971
+ const t = (i) => ri(i, n);
972
972
  return (i) => i.pipe(
973
973
  w((o) => A(e.getResource()).pipe(
974
974
  w((s) => s instanceof URL && n.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
@@ -978,7 +978,7 @@ const kt = (n, e) => {
978
978
  "text/html",
979
979
  "text/xml"
980
980
  ].includes(n.mediaType) || // no encoding ? then try to detect html
981
- !n.mediaType && ii.some(
981
+ !n.mediaType && ni.some(
982
982
  (a) => n.href.endsWith(a)
983
983
  )) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ? A(e.fetchResource()) : v(s)).pipe(
984
984
  w((a) => {
@@ -986,7 +986,7 @@ const kt = (n, e) => {
986
986
  throw new Error("Invalid resource");
987
987
  return A(t(a));
988
988
  }),
989
- P((a) => {
989
+ x((a) => {
990
990
  if (a) {
991
991
  const c = new Blob([a], { type: "text/html" }), u = URL.createObjectURL(c);
992
992
  o?.setAttribute("src", u);
@@ -1000,7 +1000,7 @@ const kt = (n, e) => {
1000
1000
  ))
1001
1001
  ))
1002
1002
  );
1003
- }, ui = () => {
1003
+ }, ci = () => {
1004
1004
  const n = document.createElement("iframe");
1005
1005
  return n.frameBorder = "no", n.tabIndex = 0, n.setAttribute(
1006
1006
  "sandbox",
@@ -1015,12 +1015,7 @@ const kt = (n, e) => {
1015
1015
  border: 0px none transparent;
1016
1016
  padding: 0px;
1017
1017
  `, n.setAttribute("role", "main"), n;
1018
- }, zt = () => `
1019
- body {
1020
- margin: 0;
1021
- }
1022
- }
1023
- `, Wt = ({
1018
+ }, ui = "body{margin:0}html,body{height:100%;width:100%}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] body{display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=left] body{justify-content:flex-end}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=right] body{justify-content:flex-start}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=none] body{justify-content:center}:not(html.prose-reader-html-renderer-touch-enabled),:not(html.prose-reader-html-renderer-touch-enabled) body{touch-action:none}img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] img{max-width:100%;height:100%;object-fit:contain}", zt = ({
1024
1019
  pageHeight: n,
1025
1020
  pageWidth: e,
1026
1021
  frameElement: t
@@ -1033,102 +1028,51 @@ const kt = (n, e) => {
1033
1028
  n / (i.height ?? 1)
1034
1029
  ), computedWidthScale: o, viewportDimensions: i };
1035
1030
  }
1036
- }, li = ({
1037
- columnWidth: n,
1038
- enableTouch: e,
1039
- spreadPosition: t
1040
- }, i) => `
1041
- ${zt()}
1042
- body {
1043
- ${i ? "" : `
1044
- display: flex;
1045
- justify-content: ${t === "left" ? "flex-end" : t === "right" ? "flex-start" : "center"};
1046
- `}
1047
- }
1048
-
1049
- html, body {
1050
- height: 100%;
1051
- width: 100%;
1052
- }
1053
-
1054
- html, body {
1055
- -max-width: ${n}px !important;
1056
- }
1057
-
1058
- html, body {
1059
- ${e ? "" : `
1060
- touch-action: none
1061
- `}
1062
- }
1063
-
1064
- img {
1065
- user-select: none;
1066
- -webkit-user-drag: none;
1067
- -khtml-user-drag: none;
1068
- -moz-user-drag: none;
1069
- -o-user-drag: none;
1070
- user-drag: none;
1071
-
1072
- display: flex;
1073
-
1074
- ${i ? "" : `
1075
- -width: 100%;
1076
- max-width: 100%;
1077
- height:100%;
1078
- object-fit:contain;
1079
- `}
1080
- }
1081
- `, di = ({
1082
- pageHeight: n,
1083
- pageWidth: e
1084
- }) => ({ columnHeight: n, columnWidth: e }), lt = (n, e) => {
1031
+ }, lt = (n, e) => {
1085
1032
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1086
- }, pi = ({
1033
+ }, li = ({
1087
1034
  minPageSpread: n,
1088
1035
  blankPagePosition: e,
1089
1036
  spreadPosition: t,
1090
1037
  pageHeight: i,
1091
1038
  pageWidth: o,
1092
1039
  frameElement: s,
1093
- isRTL: r,
1094
- enableTouch: a
1040
+ isRTL: r
1095
1041
  }) => {
1096
- const c = n * o;
1042
+ const a = n * o;
1097
1043
  if (s?.contentDocument && s?.contentWindow) {
1098
- const { viewportDimensions: u, computedScale: l = 1 } = Wt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, d = o, p = i, g = li(
1099
- {
1100
- ...di({ pageHeight: i, pageWidth: o }),
1101
- enableTouch: a,
1102
- spreadPosition: t
1103
- },
1104
- u
1105
- );
1106
- if (oe(s, "prose-reader-css", g), u ? lt(s, {
1107
- width: u.width ?? 1,
1108
- height: u.height ?? 1
1044
+ const { viewportDimensions: c, computedScale: u = 1 } = zt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, l = !!c, d = o, p = i;
1045
+ if (s.contentDocument?.documentElement && s.contentDocument?.documentElement.setAttribute(
1046
+ "data-prose-reader-html-renderer-has-viewport-dimensions",
1047
+ l.toString()
1048
+ ), c ? lt(s, {
1049
+ width: c.width ?? 1,
1050
+ height: c.height ?? 1
1109
1051
  }) : lt(s, {
1110
1052
  width: d,
1111
1053
  height: p
1112
- }), u) {
1054
+ }), c) {
1113
1055
  s?.style.setProperty("position", "absolute"), s?.style.setProperty("top", "50%"), t === "left" ? (s?.style.setProperty("right", "0"), s?.style.removeProperty("left")) : e === "before" && r ? (s?.style.setProperty("right", "50%"), s?.style.removeProperty("left")) : t === "right" ? (s?.style.setProperty("left", "0"), s?.style.removeProperty("right")) : (s?.style.setProperty(
1114
1056
  "left",
1115
1057
  e === "before" ? r ? "25%" : "75%" : e === "after" ? r ? "75%" : "25%" : "50%"
1116
1058
  ), s?.style.removeProperty("right"));
1117
- const h = t !== "none" ? "0" : "-50%", m = t === "right" && e !== "before" ? "left" : t === "left" || e === "before" && r ? "right" : "center";
1059
+ const g = t !== "none" ? "0" : "-50%", h = t === "right" && e !== "before" ? "left" : t === "left" || e === "before" && r ? "right" : "center";
1118
1060
  s?.style.setProperty(
1119
1061
  "transform",
1120
- `translate(${h}, -50%) scale(${l})`
1062
+ `translate(${g}, -50%) scale(${u})`
1121
1063
  ), s?.style.setProperty(
1122
1064
  "transform-origin",
1123
- `${m} center`
1065
+ `${h} center`
1124
1066
  );
1125
1067
  } else
1126
1068
  e === "before" ? r ? s?.style.setProperty("margin-right", `${o}px`) : s?.style.setProperty("margin-left", `${o}px`) : (s?.style.removeProperty("margin-left"), s?.style.removeProperty("margin-right"));
1127
- return { width: c, height: p };
1069
+ return { width: a, height: p };
1128
1070
  }
1129
- return { width: c, height: i };
1130
- }, gi = () => `
1131
- ${zt()}
1071
+ return { width: a, height: i };
1072
+ }, di = () => `
1073
+ body {
1074
+ margin: 0;
1075
+ }
1132
1076
  html {
1133
1077
  width: 100%;
1134
1078
  height: 100%;
@@ -1142,7 +1086,7 @@ const kt = (n, e) => {
1142
1086
  html, body {
1143
1087
  touch-action: none;
1144
1088
  }
1145
- `, hi = ({
1089
+ `, pi = ({
1146
1090
  isScrollable: n,
1147
1091
  enableTouch: e
1148
1092
  }) => `
@@ -1167,7 +1111,7 @@ const kt = (n, e) => {
1167
1111
  display: block;
1168
1112
  }
1169
1113
  ` : ""}
1170
- `, mi = ({
1114
+ `, gi = ({
1171
1115
  width: n,
1172
1116
  columnHeight: e,
1173
1117
  columnWidth: t
@@ -1235,7 +1179,7 @@ const kt = (n, e) => {
1235
1179
  td {
1236
1180
  max-width: ${t}px;
1237
1181
  }
1238
- `, fi = ({
1182
+ `, hi = ({
1239
1183
  isUsingVerticalWriting: n,
1240
1184
  minimumWidth: e,
1241
1185
  pageHeight: t,
@@ -1251,7 +1195,7 @@ const kt = (n, e) => {
1251
1195
  };
1252
1196
  }, ve = (n, e) => {
1253
1197
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1254
- }, yi = ({
1198
+ }, mi = ({
1255
1199
  pageHeight: n,
1256
1200
  pageWidth: e,
1257
1201
  frameElement: t,
@@ -1265,7 +1209,7 @@ const kt = (n, e) => {
1265
1209
  }) => {
1266
1210
  const l = o * e, d = i?.renditionLayout === "reflowable" && i?.renditionFlow === "scrolled-continuous", p = d ? Math.min(400, n) : n;
1267
1211
  t?.style.setProperty("width", `${e}px`), d ? t?.style.removeProperty("height") : t?.style.setProperty("height", `${p}px`);
1268
- const { viewportDimensions: g, computedScale: h = 1 } = Wt({
1212
+ const { viewportDimensions: g, computedScale: h = 1 } = zt({
1269
1213
  frameElement: t,
1270
1214
  pageHeight: p,
1271
1215
  pageWidth: e
@@ -1276,7 +1220,7 @@ const kt = (n, e) => {
1276
1220
  oe(
1277
1221
  t,
1278
1222
  "prose-reader-html-renderer-framce-css",
1279
- gi()
1223
+ di()
1280
1224
  ), ve(t, {
1281
1225
  width: g.width ?? 1,
1282
1226
  height: g.height ?? 1
@@ -1288,11 +1232,11 @@ const kt = (n, e) => {
1288
1232
  `translate(-50%, -50%) scale(${h})`
1289
1233
  ), t?.style.setProperty("transform-origin", "center center");
1290
1234
  else {
1291
- const b = a ? hi({
1235
+ const b = a ? pi({
1292
1236
  isScrollable: i?.renditionFlow === "scrolled-continuous",
1293
1237
  enableTouch: c
1294
- }) : mi(
1295
- fi({
1238
+ }) : gi(
1239
+ hi({
1296
1240
  isUsingVerticalWriting: u,
1297
1241
  minimumWidth: l,
1298
1242
  pageHeight: p,
@@ -1324,38 +1268,41 @@ const kt = (n, e) => {
1324
1268
  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 };
1325
1269
  }
1326
1270
  };
1327
- class Si extends Se {
1271
+ class fi extends Se {
1328
1272
  constructor() {
1329
- super(...arguments), this.isImageType = () => !!(this.item.mediaType ?? Me(this.item.href))?.startsWith("image/");
1273
+ super(...arguments), this.isPrePaginated = () => this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated", this.isImageType = () => !!(this.item.mediaType ?? Me(this.item.href))?.startsWith("image/");
1330
1274
  }
1331
1275
  onCreateDocument() {
1332
- const e = ui();
1276
+ const e = ci();
1333
1277
  return this.setDocumentContainer(e), v(e);
1334
1278
  }
1335
1279
  onLoadDocument() {
1336
1280
  const e = this.getFrameElement();
1337
1281
  if (!e) throw new Error("invalid frame");
1338
1282
  return v(e).pipe(
1339
- ci({
1283
+ ai({
1340
1284
  item: this.item,
1341
1285
  resourcesHandler: this.resourcesHandler,
1342
1286
  settings: this.settings
1343
1287
  }),
1344
1288
  De(this.context.bridgeEvent.viewportFree$),
1345
- P(() => {
1289
+ x(() => {
1346
1290
  this.attach();
1347
1291
  }),
1348
- kn,
1349
- ti({
1292
+ jn,
1293
+ x((t) => {
1294
+ this.isPrePaginated() ? oe(t, "prose-reader-css", ui) : this.isImageType();
1295
+ }),
1296
+ ei({
1350
1297
  context: this.context,
1351
1298
  item: this.item,
1352
1299
  settings: this.settings
1353
1300
  }),
1354
- Un
1301
+ kn
1355
1302
  );
1356
1303
  }
1357
1304
  onUnload() {
1358
- return ni(this.getFrameElement()), this.detach(), _;
1305
+ return ti(this.getFrameElement()), this.detach(), _;
1359
1306
  }
1360
1307
  onLayout({
1361
1308
  minPageSpread: e,
@@ -1364,16 +1311,17 @@ class Si extends Se {
1364
1311
  }) {
1365
1312
  const { width: o, height: s } = this.viewport.pageSize, r = this.getFrameElement();
1366
1313
  if (!r) return v(void 0);
1367
- const a = !!this.writingMode?.startsWith("vertical");
1368
- if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated") {
1369
- const u = pi({
1314
+ const a = !!this.writingMode?.startsWith("vertical"), c = this.settings.values.computedPageTurnMode === "scrollable";
1315
+ if (r.contentDocument?.documentElement && (r.contentDocument?.documentElement.setAttribute(
1316
+ "data-prose-reader-html-renderer-spread-position",
1317
+ i
1318
+ ), c ? r.contentDocument?.documentElement.classList.add(
1319
+ "prose-reader-html-renderer-touch-enabled"
1320
+ ) : r.contentDocument?.documentElement.classList.remove(
1321
+ "prose-reader-html-renderer-touch-enabled"
1322
+ )), this.isPrePaginated()) {
1323
+ const l = li({
1370
1324
  blankPagePosition: t,
1371
- /**
1372
- * When we have scrollable content, we use "native" touch event from the frame instead of
1373
- * our own gestures.
1374
- * @todo move this into scroll navigator
1375
- */
1376
- enableTouch: this.settings.values.computedPageTurnMode === "scrollable",
1377
1325
  frameElement: r,
1378
1326
  isRTL: this.context.isRTL(),
1379
1327
  minPageSpread: e,
@@ -1381,9 +1329,9 @@ class Si extends Se {
1381
1329
  pageWidth: o,
1382
1330
  spreadPosition: i
1383
1331
  });
1384
- return v(u);
1332
+ return v(l);
1385
1333
  }
1386
- const c = yi({
1334
+ const u = mi({
1387
1335
  pageHeight: s,
1388
1336
  pageWidth: o,
1389
1337
  frameElement: r,
@@ -1400,7 +1348,7 @@ class Si extends Se {
1400
1348
  */
1401
1349
  enableTouch: this.settings.values.computedPageTurnMode === "scrollable"
1402
1350
  });
1403
- return v(c);
1351
+ return v(u);
1404
1352
  }
1405
1353
  onRenderHeadless() {
1406
1354
  return A(this.resourcesHandler.fetchResource()).pipe(
@@ -1456,13 +1404,13 @@ class Si extends Se {
1456
1404
  return this.getFrameElement();
1457
1405
  }
1458
1406
  }
1459
- const Ii = (n) => (e) => {
1407
+ const yi = (n) => (e) => {
1460
1408
  const t = n({
1461
1409
  ...e,
1462
1410
  getRenderer(o) {
1463
- return e.getRenderer?.(o) ?? ((r) => new Si(r));
1411
+ return e.getRenderer?.(o) ?? ((r) => new fi(r));
1464
1412
  }
1465
- }), i = Jn(t);
1413
+ }), i = Zn(t);
1466
1414
  return i.pipe($(t.$.destroy$)).subscribe(), {
1467
1415
  ...t,
1468
1416
  links$: i
@@ -1481,12 +1429,12 @@ class C {
1481
1429
  this.__symbol = /* @__PURE__ */ Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
1482
1430
  }
1483
1431
  }
1484
- class Oe {
1432
+ class Ne {
1485
1433
  constructor(e) {
1486
1434
  this.__symbol = /* @__PURE__ */ Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
1487
1435
  }
1488
1436
  }
1489
- class bi extends nt {
1437
+ class Si extends nt {
1490
1438
  constructor() {
1491
1439
  super(...arguments), this.__symbol = "SpineItemPageLayout";
1492
1440
  }
@@ -1496,17 +1444,17 @@ class He extends nt {
1496
1444
  super(...arguments), this.__symbol = "SpineItemSpineLayout";
1497
1445
  }
1498
1446
  }
1499
- class vi extends nt {
1447
+ class Ii extends nt {
1500
1448
  constructor() {
1501
1449
  super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
1502
1450
  }
1503
1451
  }
1504
- class _t {
1452
+ class Wt {
1505
1453
  constructor(e) {
1506
1454
  this.x = e.x, this.y = e.y;
1507
1455
  }
1508
1456
  }
1509
- class L extends _t {
1457
+ class L extends Wt {
1510
1458
  constructor() {
1511
1459
  super(...arguments), this.__symbol = "SpinePosition";
1512
1460
  }
@@ -1514,7 +1462,7 @@ class L extends _t {
1514
1462
  return new L(e);
1515
1463
  }
1516
1464
  }
1517
- class ue extends _t {
1465
+ class ue extends Wt {
1518
1466
  constructor() {
1519
1467
  super(...arguments), this.__symbol = "UnboundSpinePosition";
1520
1468
  }
@@ -1522,17 +1470,17 @@ class ue extends _t {
1522
1470
  return new ue(e);
1523
1471
  }
1524
1472
  }
1525
- const wi = (n, e) => {
1473
+ const bi = (n, e) => {
1526
1474
  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;
1527
1475
  return {
1528
1476
  x: u / a,
1529
1477
  y: l / c
1530
1478
  };
1531
- }, xi = (n, e) => new ue(
1532
- wi(n, e)
1533
- ), Pi = (n) => ({
1534
- getSpinePositionFromClientPosition: (e) => n.spine.element ? xi(e, n.spine.element) : void 0
1535
- }), $i = (n) => {
1479
+ }, vi = (n, e) => new ue(
1480
+ bi(n, e)
1481
+ ), wi = (n) => ({
1482
+ getSpinePositionFromClientPosition: (e) => n.spine.element ? vi(e, n.spine.element) : void 0
1483
+ }), Pi = (n) => {
1536
1484
  let e;
1537
1485
  const t = n.context.watch("rootElement").pipe(
1538
1486
  X((c) => c ? new se(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
@@ -1545,22 +1493,22 @@ const wi = (n, e) => {
1545
1493
  `, c.appendChild(e), () => {
1546
1494
  e?.remove(), e = void 0;
1547
1495
  })) : he)
1548
- ), i = (c) => cn(c, ce).pipe(
1549
- O(() => {
1496
+ ), i = (c) => an(c, ce).pipe(
1497
+ N(() => {
1550
1498
  e?.style.setProperty(
1551
1499
  "visibility",
1552
1500
  "hidden"
1553
1501
  );
1554
1502
  })
1555
1503
  ), o = n.context.bridgeEvent.viewportBusy$.pipe(
1556
- O(() => {
1504
+ N(() => {
1557
1505
  e?.style.setProperty(
1558
1506
  "visibility",
1559
1507
  "visible"
1560
1508
  );
1561
1509
  })
1562
1510
  ), s = i(n.viewportFree$).pipe(
1563
- bn(1)
1511
+ In(1)
1564
1512
  ), a = n.settings.values$.pipe(
1565
1513
  ie(() => n.settings.values.computedPageTurnMode),
1566
1514
  fe()
@@ -1570,14 +1518,14 @@ const wi = (n, e) => {
1570
1518
  ),
1571
1519
  K(n.$.destroy$)
1572
1520
  );
1573
- return x(t, a);
1574
- }, Ti = `${W}-enhancer-loading`, Ht = `${Ti}-container`, Fi = ({
1521
+ return P(t, a);
1522
+ }, xi = `${W}-enhancer-loading`, _t = `${xi}-container`, $i = ({
1575
1523
  container: n,
1576
1524
  item: e,
1577
1525
  viewport: t
1578
1526
  }) => {
1579
1527
  const i = n.ownerDocument.createElement("div");
1580
- i.classList.add(Ht), i.style.cssText = `
1528
+ i.classList.add(_t), i.style.cssText = `
1581
1529
  height: 100%;
1582
1530
  width: 100%;
1583
1531
  max-width: ${t.absoluteViewport.width}px;
@@ -1606,21 +1554,21 @@ const wi = (n, e) => {
1606
1554
  max-width: 300px;
1607
1555
  width: 80%;
1608
1556
  `, i.appendChild(o), i.appendChild(s), i;
1609
- }, Li = (n) => n.spineItemsManager.items$.pipe(
1557
+ }, Ti = (n) => n.spineItemsManager.items$.pipe(
1610
1558
  X(
1611
- (e) => x(
1559
+ (e) => P(
1612
1560
  ...e.map((t) => {
1613
1561
  t.containerElement.style.zIndex = "0";
1614
1562
  const i = t.containerElement.querySelector(
1615
- `.${Ht}`
1616
- ), o = i instanceof HTMLElement ? i : Fi({
1563
+ `.${_t}`
1564
+ ), o = i instanceof HTMLElement ? i : $i({
1617
1565
  container: t.containerElement,
1618
1566
  item: t.item,
1619
1567
  viewport: n.viewport
1620
1568
  });
1621
- return t.containerElement.appendChild(o), x(
1569
+ return t.containerElement.appendChild(o), P(
1622
1570
  t.pipe(
1623
- O((s) => {
1571
+ N((s) => {
1624
1572
  if (o.style.setProperty(
1625
1573
  "visibility",
1626
1574
  s.isReady ? "hidden" : "visible"
@@ -1635,8 +1583,8 @@ const wi = (n, e) => {
1635
1583
  }
1636
1584
  })
1637
1585
  ),
1638
- N([n.spine.layout$, n.theme.$.theme$]).pipe(
1639
- O(([, s]) => {
1586
+ O([n.spine.layout$, n.theme.$.theme$]).pipe(
1587
+ N(([, s]) => {
1640
1588
  const r = n.viewport.absoluteViewport.width;
1641
1589
  o.style.setProperty(
1642
1590
  "max-width",
@@ -1651,11 +1599,11 @@ const wi = (n, e) => {
1651
1599
  })
1652
1600
  )
1653
1601
  )
1654
- ), Mi = (n) => {
1602
+ ), Fi = (n) => {
1655
1603
  n.hookManager.register("item.onDocumentLoad", ({ itemId: e }) => {
1656
1604
  n.spineItemsManager.get(e)?.renderer.getDocumentFrame()?.setAttribute("scrolling", "no");
1657
1605
  });
1658
- }, Ci = (n) => {
1606
+ }, Li = (n) => {
1659
1607
  n.hookManager.register(
1660
1608
  "item.onAfterLayout",
1661
1609
  ({ item: e, blankPagePosition: t, minimumWidth: i }) => {
@@ -1672,12 +1620,12 @@ const wi = (n, e) => {
1672
1620
  }
1673
1621
  }
1674
1622
  );
1675
- }, Ei = (n) => n.spineItemsManager.items$.pipe(
1623
+ }, Mi = (n) => n.spineItemsManager.items$.pipe(
1676
1624
  w(
1677
- (e) => x(
1625
+ (e) => P(
1678
1626
  ...e.map(
1679
1627
  (t) => t.pipe(
1680
- P((i) => {
1628
+ x((i) => {
1681
1629
  t.containerElement.dataset.isDirty = i.iDirty.toString(), t.containerElement.dataset.isReady = i.isReady.toString();
1682
1630
  })
1683
1631
  )
@@ -1685,7 +1633,7 @@ const wi = (n, e) => {
1685
1633
  )
1686
1634
  )
1687
1635
  );
1688
- let Di = class extends jt {
1636
+ let Ci = class extends jt {
1689
1637
  computeOutputSettings(e) {
1690
1638
  return e;
1691
1639
  }
@@ -1711,21 +1659,21 @@ let Di = class extends jt {
1711
1659
  };
1712
1660
  }
1713
1661
  };
1714
- const Ri = (n) => N([
1662
+ const Ei = (n) => O([
1715
1663
  n.viewport.watch(["width", "height"]),
1716
1664
  n.context.watch("manifest")
1717
1665
  ]).pipe(
1718
- P(([{ width: e, height: t }, i]) => {
1666
+ x(([{ width: e, height: t }, i]) => {
1719
1667
  const o = e > t;
1720
1668
  return !o && i?.renditionSpread === "portrait" ? n.settings.update({ spreadMode: !0 }) : o && (i?.renditionSpread === void 0 || i?.renditionSpread === "auto" || i?.renditionSpread === "landscape" || i?.renditionSpread === "both") ? n.settings.update({ spreadMode: !0 }) : n.settings.update({ spreadMode: !1 });
1721
1669
  })
1722
- ), Ai = (n) => (e) => {
1670
+ ), Di = (n) => (e) => {
1723
1671
  const {
1724
1672
  pageHorizontalMargin: t,
1725
1673
  pageVerticalMargin: i,
1726
1674
  layoutAutoResize: o,
1727
1675
  layoutLayerTransition: s
1728
- } = e, r = n(e), a = new Di(
1676
+ } = e, r = n(e), a = new Ci(
1729
1677
  {
1730
1678
  pageHorizontalMargin: t,
1731
1679
  pageVerticalMargin: i,
@@ -1772,7 +1720,7 @@ const Ri = (n) => N([
1772
1720
  `
1773
1721
  );
1774
1722
  }
1775
- }), Ci(r), Mi(r), r.hookManager.register(
1723
+ }), Li(r), Fi(r), r.hookManager.register(
1776
1724
  "item.onDocumentCreated",
1777
1725
  ({ documentContainer: m }) => {
1778
1726
  m.style.opacity = "0", a.values.layoutLayerTransition && (m.style.transition = "opacity 300ms");
@@ -1783,7 +1731,7 @@ const Ri = (n) => N([
1783
1731
  });
1784
1732
  const c = r.spineItemsObserver.itemIsReady$.pipe(
1785
1733
  ae(({ isReady: m }) => m),
1786
- O(({ item: m }) => {
1734
+ N(({ item: m }) => {
1787
1735
  const y = m.renderer.documentContainer;
1788
1736
  y && (y.style.opacity = "1");
1789
1737
  })
@@ -1792,23 +1740,23 @@ const Ri = (n) => N([
1792
1740
  X(() => r.context.watch("rootElement")),
1793
1741
  ae(Z),
1794
1742
  X((m) => et(m)),
1795
- vn(100),
1743
+ bn(100),
1796
1744
  ae(Z),
1797
- O(() => {
1745
+ N(() => {
1798
1746
  r?.layout();
1799
1747
  })
1800
- ), l = $i(r);
1748
+ ), l = Pi(r);
1801
1749
  a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1802
1750
  Ct(1),
1803
- O(() => {
1751
+ N(() => {
1804
1752
  r.layout();
1805
1753
  }),
1806
1754
  K(r.$.destroy$)
1807
1755
  ).subscribe();
1808
1756
  const d = r.spine.pages.pipe(
1809
1757
  Ze({ refCount: !0, bufferSize: 1 })
1810
- ), p = Ei(r), g = Ri(r), h = Li(r);
1811
- return x(
1758
+ ), p = Mi(r), g = Ei(r), h = Ti(r);
1759
+ return P(
1812
1760
  c,
1813
1761
  l,
1814
1762
  u,
@@ -1824,10 +1772,10 @@ const Ri = (n) => N([
1824
1772
  settings: a,
1825
1773
  layout$: r.spine.layout$,
1826
1774
  layoutInfo$: d,
1827
- coordinates: Pi(r)
1775
+ coordinates: wi(r)
1828
1776
  };
1829
1777
  };
1830
- class Oi extends Se {
1778
+ class Ri extends Se {
1831
1779
  getImageElement() {
1832
1780
  const e = this.documentContainer;
1833
1781
  if (e instanceof HTMLImageElement)
@@ -1879,12 +1827,12 @@ class Oi extends Se {
1879
1827
  getDocumentFrame() {
1880
1828
  }
1881
1829
  }
1882
- const Ni = (n) => (e) => {
1830
+ const Ai = (n) => (e) => {
1883
1831
  const t = n({
1884
1832
  ...e,
1885
1833
  getRenderer(r) {
1886
1834
  const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Me(r.href))?.startsWith("image/");
1887
- return !a && u ? (l) => new Oi(l) : a;
1835
+ return !a && u ? (l) => new Ri(l) : a;
1888
1836
  }
1889
1837
  }), i = new IntersectionObserver(
1890
1838
  (r) => {
@@ -1934,15 +1882,15 @@ const Ni = (n) => (e) => {
1934
1882
  i.disconnect(), o.disconnect(), t.destroy();
1935
1883
  }
1936
1884
  };
1937
- }, Vi = (n, e) => n.links$.pipe(
1938
- P((t) => {
1885
+ }, Ni = (n, e) => n.links$.pipe(
1886
+ x((t) => {
1939
1887
  if (!Nn(t.target, "a") || t.type !== "click") return;
1940
1888
  const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
1941
1889
  n.context.manifest?.spineItems.some(
1942
1890
  (r) => r.href === o
1943
1891
  ) && e.goToUrl(i);
1944
1892
  })
1945
- ), ee = D.namespace("navigation"), ji = ({
1893
+ ), ee = D.namespace("navigation"), Oi = ({
1946
1894
  position: n,
1947
1895
  spineItem: e,
1948
1896
  pageHeight: t,
@@ -1974,7 +1922,7 @@ const Ni = (n) => (e) => {
1974
1922
  const u = o.getSpineItemPositionFromSpinePosition(
1975
1923
  n,
1976
1924
  a
1977
- ), l = ji({
1925
+ ), l = Oi({
1978
1926
  position: u,
1979
1927
  spineItem: a,
1980
1928
  pageHeight: s.pageSize.height,
@@ -1996,7 +1944,7 @@ const Ni = (n) => (e) => {
1996
1944
  x: 0
1997
1945
  })
1998
1946
  );
1999
- }, ki = ({
1947
+ }, Vi = ({
2000
1948
  position: n,
2001
1949
  spineItem: e,
2002
1950
  context: t,
@@ -2040,7 +1988,7 @@ const Ni = (n) => (e) => {
2040
1988
  return i.getAdjustedPositionForSpread(l);
2041
1989
  }
2042
1990
  return i.getAdjustedPositionForSpread(u);
2043
- }, Ui = ({
1991
+ }, ji = ({
2044
1992
  position: n,
2045
1993
  spineItem: e,
2046
1994
  pageHeight: t,
@@ -2072,7 +2020,7 @@ const Ni = (n) => (e) => {
2072
2020
  const u = o.getSpineItemPositionFromSpinePosition(
2073
2021
  n,
2074
2022
  a
2075
- ), l = Ui({
2023
+ ), l = ji({
2076
2024
  position: u,
2077
2025
  spineItem: a,
2078
2026
  pageHeight: s.pageSize.height,
@@ -2094,7 +2042,7 @@ const Ni = (n) => (e) => {
2094
2042
  x: 0
2095
2043
  })
2096
2044
  );
2097
- }, zi = ({
2045
+ }, ki = ({
2098
2046
  position: n,
2099
2047
  spineItem: e,
2100
2048
  context: t,
@@ -2142,7 +2090,7 @@ const Ni = (n) => (e) => {
2142
2090
  }
2143
2091
  return i.getAdjustedPositionForSpread(u);
2144
2092
  };
2145
- class Wi {
2093
+ class Ui {
2146
2094
  constructor(e) {
2147
2095
  this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new L({ x: 0, y: 0 }), this.unlock = void 0;
2148
2096
  }
@@ -2161,7 +2109,7 @@ class Wi {
2161
2109
  turnRightOrBottom() {
2162
2110
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2163
2111
  if (!t) return;
2164
- const i = zi({
2112
+ const i = ki({
2165
2113
  context: this.reader.context,
2166
2114
  navigationResolver: this.reader.navigation.navigationResolver,
2167
2115
  position: e.position,
@@ -2179,7 +2127,7 @@ class Wi {
2179
2127
  turnLeftOrTop() {
2180
2128
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2181
2129
  if (!t) return;
2182
- const i = ki({
2130
+ const i = Vi({
2183
2131
  context: this.reader.context,
2184
2132
  navigationResolver: this.reader.navigation.navigationResolver,
2185
2133
  position: e.position,
@@ -2321,7 +2269,7 @@ class Wi {
2321
2269
  }
2322
2270
  }
2323
2271
  }
2324
- class _i extends Q {
2272
+ class zi extends Q {
2325
2273
  constructor(e) {
2326
2274
  super({
2327
2275
  lastDelta: { x: 0, y: 0 },
@@ -2386,23 +2334,23 @@ class G {
2386
2334
  this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
2387
2335
  }
2388
2336
  }
2389
- const Hi = 500;
2390
- class Bi extends G {
2337
+ const Wi = 500;
2338
+ class _i extends G {
2391
2339
  constructor(e, t) {
2392
2340
  super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new R(), this.navigation$ = this.navigationSubject.asObservable();
2393
2341
  const i = this.scrollNavigationController.userScroll$.pipe(
2394
2342
  ze((o) => {
2395
2343
  const s = this.locker.lock();
2396
- return x(
2344
+ return P(
2397
2345
  this.scrollNavigationController.userScroll$,
2398
2346
  v(o)
2399
2347
  ).pipe(
2400
2348
  be(
2401
- Hi,
2349
+ Wi,
2402
2350
  ce
2403
2351
  ),
2404
2352
  V(),
2405
- P(() => {
2353
+ x(() => {
2406
2354
  const r = this.scrollNavigationController.fromScrollPosition(
2407
2355
  this.scrollNavigationController.scrollPosition
2408
2356
  );
@@ -2418,10 +2366,10 @@ class Bi extends G {
2418
2366
  );
2419
2367
  })
2420
2368
  );
2421
- x(i).pipe($(this.destroy$)).subscribe();
2369
+ P(i).pipe($(this.destroy$)).subscribe();
2422
2370
  }
2423
2371
  }
2424
- const Xi = (n) => n.pagination.state$.pipe(
2372
+ const Hi = (n) => n.pagination.state$.pipe(
2425
2373
  z(n.context.manifest$, n.settings.values$),
2426
2374
  S(
2427
2375
  ([
@@ -2441,32 +2389,32 @@ const Xi = (n) => n.pagination.state$.pipe(
2441
2389
  }
2442
2390
  ),
2443
2391
  k(U)
2444
- ), Yi = ({ reader: n, duration: e }) => (t) => {
2392
+ ), Bi = ({ reader: n, duration: e }) => (t) => {
2445
2393
  let i;
2446
2394
  const o = () => {
2447
2395
  i?.(), i = void 0;
2448
2396
  };
2449
2397
  return t.pipe(
2450
- P(() => {
2398
+ x(() => {
2451
2399
  i || (i = n?.navigation.lock());
2452
2400
  }),
2453
- un(e, ce, {
2401
+ cn(e, ce, {
2454
2402
  trailing: !0,
2455
2403
  leading: !0
2456
2404
  }),
2457
- P(o),
2405
+ x(o),
2458
2406
  pe(o)
2459
2407
  );
2460
- }, qi = (n) => (e) => {
2461
- const t = n(e), i = Xi(t), o = new Wi(t), s = new _i(t), r = new Bi(
2408
+ }, Xi = (n) => (e) => {
2409
+ const t = n(e), i = Hi(t), o = new Ui(t), s = new zi(t), r = new _i(
2462
2410
  t.navigation.scrollNavigationController,
2463
2411
  t.navigation.locker
2464
- ), a = Vi(t, o), c = r.navigation$.pipe(
2465
- P((d) => {
2412
+ ), a = Ni(t, o), c = r.navigation$.pipe(
2413
+ x((d) => {
2466
2414
  t.navigation.navigate(d);
2467
2415
  })
2468
2416
  );
2469
- return x(a, c).pipe($(t.$.destroy$)).subscribe(), {
2417
+ return P(a, c).pipe($(t.$.destroy$)).subscribe(), {
2470
2418
  ...t,
2471
2419
  load: (d) => {
2472
2420
  const { cfi: p, ...g } = d;
@@ -2478,7 +2426,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2478
2426
  navigation: {
2479
2427
  ...t.navigation,
2480
2428
  state$: i,
2481
- throttleLock: ({ duration: d, trigger: p }) => p.pipe(Yi({ duration: d, reader: t })),
2429
+ throttleLock: ({ duration: d, trigger: p }) => p.pipe(Bi({ duration: d, reader: t })),
2482
2430
  panNavigator: s,
2483
2431
  turnBottom: o.turnBottom.bind(o),
2484
2432
  turnTop: o.turnTop.bind(o),
@@ -2501,7 +2449,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2501
2449
  goToAbsolutePageIndex: o.goToAbsolutePageIndex.bind(o)
2502
2450
  }
2503
2451
  };
2504
- }, Bt = (n, e, t) => {
2452
+ }, Ht = (n, e, t) => {
2505
2453
  const i = t.spineItems.findIndex(
2506
2454
  (o) => o.href === n
2507
2455
  );
@@ -2518,7 +2466,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2518
2466
  const m = {
2519
2467
  title: s.title,
2520
2468
  path: s.path
2521
- }, y = Bt(n, s.contents, t);
2469
+ }, y = Ht(n, s.contents, t);
2522
2470
  return y ? {
2523
2471
  ...m,
2524
2472
  subChapter: y
@@ -2526,19 +2474,19 @@ const Xi = (n) => n.pagination.state$.pipe(
2526
2474
  }
2527
2475
  return o;
2528
2476
  }, void 0);
2529
- }, Gi = (n, e) => {
2477
+ }, Yi = (n, e) => {
2530
2478
  const { href: t } = e;
2531
- return Bt(t, n.nav?.toc ?? [], n);
2532
- }, Zi = (n) => {
2479
+ return Ht(t, n.nav?.toc ?? [], n);
2480
+ }, qi = (n) => {
2533
2481
  const e = n.context.manifest, t = n.spineItemsManager.items;
2534
2482
  return e ? t.reduce(
2535
- (i, { item: o }) => (i[o.id] = Gi(e, o), i),
2483
+ (i, { item: o }) => (i[o.id] = Yi(e, o), i),
2536
2484
  {}
2537
2485
  ) : {};
2538
- }, Ji = (n) => n.spineItemsManager.items$.pipe(
2486
+ }, Gi = (n) => n.spineItemsManager.items$.pipe(
2539
2487
  ne([]),
2540
- S(() => Zi(n))
2541
- ), Ki = (n, e, t) => n + e * t, Qi = (n, e, t) => {
2488
+ S(() => qi(n))
2489
+ ), Zi = (n, e, t) => n + e * t, Ji = (n, e, t) => {
2542
2490
  const { height: i, width: o } = t.layout.layoutInfo, { top: s, left: r } = n.spine.getSpineItemSpineLayoutInfo(t);
2543
2491
  return n.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
2544
2492
  0,
@@ -2553,7 +2501,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2553
2501
  (e.x - r + n.viewport.absoluteViewport.width) / o
2554
2502
  )
2555
2503
  );
2556
- }, eo = (n, e, t, i, o) => o.isReady$.pipe(
2504
+ }, Ki = (n, e, t, i, o) => o.isReady$.pipe(
2557
2505
  V(),
2558
2506
  z(n.layoutInfo$),
2559
2507
  S(([s, r]) => {
@@ -2563,17 +2511,17 @@ const Xi = (n) => n.pagination.state$.pipe(
2563
2511
  let m = (t + 1) * (h / g);
2564
2512
  !c && o.renditionLayout === "reflowable" && !s && (m = 0);
2565
2513
  let y = l + m;
2566
- return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Qi(
2514
+ return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Ji(
2567
2515
  n,
2568
2516
  i,
2569
2517
  o
2570
- ) : m = 0, y = Ki(
2518
+ ) : m = 0, y = Zi(
2571
2519
  l,
2572
2520
  h,
2573
2521
  m
2574
2522
  )), e === u - 1 && t === g - 1 && y > 0.99 ? 1 : y;
2575
2523
  })
2576
- ), to = (n) => n.spine.layout$.pipe(
2524
+ ), Qi = (n) => n.spine.layout$.pipe(
2577
2525
  be(10, ce),
2578
2526
  z(n.pagination.state$),
2579
2527
  S(() => ({
@@ -2591,7 +2539,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2591
2539
  numberOfPagesPerItems: [],
2592
2540
  numberOfTotalPages: 0
2593
2541
  })
2594
- ), no = (n, e, t, i) => {
2542
+ ), eo = (n, e, t, i) => {
2595
2543
  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;
2596
2544
  return v({
2597
2545
  ...e,
@@ -2622,7 +2570,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2622
2570
  // hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
2623
2571
  // numberOfSpineItems: context.manifest?.readingOrder.length,
2624
2572
  });
2625
- }, io = (n) => N([
2573
+ }, to = (n) => O([
2626
2574
  n.pagination.state$,
2627
2575
  // Usually pagination change if layout changes (number of pages) however it is especially
2628
2576
  // useful for like webtoon where you still have one page but only the layout will give you the final size
@@ -2631,7 +2579,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2631
2579
  ]).pipe(
2632
2580
  w(([e]) => {
2633
2581
  const t = e.endSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.endSpineItemIndex) : void 0;
2634
- return t ? eo(
2582
+ return t ? Ki(
2635
2583
  n,
2636
2584
  e.endSpineItemIndex ?? 0,
2637
2585
  e.endPageIndexInSpineItem || 0,
@@ -2639,8 +2587,8 @@ const Xi = (n) => n.pagination.state$.pipe(
2639
2587
  t
2640
2588
  ) : v(0);
2641
2589
  })
2642
- ), oo = (n) => {
2643
- const e = Ji(n), t = to(n), i = new Y({
2590
+ ), no = (n) => {
2591
+ const e = Gi(n), t = Qi(n), i = new Y({
2644
2592
  ...n.pagination.state,
2645
2593
  beginChapterInfo: void 0,
2646
2594
  beginCfi: void 0,
@@ -2655,13 +2603,13 @@ const Xi = (n) => n.pagination.state$.pipe(
2655
2603
  endChapterInfo: void 0,
2656
2604
  endSpineItemReadingDirection: void 0,
2657
2605
  percentageEstimateOfBook: 0
2658
- }), o = N([
2606
+ }), o = O([
2659
2607
  n.pagination.state$,
2660
2608
  e,
2661
- io(n)
2609
+ to(n)
2662
2610
  ]).pipe(
2663
2611
  w(
2664
- ([r, a, c]) => no(
2612
+ ([r, a, c]) => eo(
2665
2613
  n,
2666
2614
  r,
2667
2615
  a,
@@ -2675,7 +2623,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2675
2623
  ),
2676
2624
  k(U)
2677
2625
  );
2678
- return { paginationInfo$: N([
2626
+ return { paginationInfo$: O([
2679
2627
  o,
2680
2628
  t
2681
2629
  ]).pipe(
@@ -2691,7 +2639,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2691
2639
  r.endPageIndexInSpineItem ?? 0
2692
2640
  )
2693
2641
  })),
2694
- P((r) => {
2642
+ x((r) => {
2695
2643
  i.next(r);
2696
2644
  }),
2697
2645
  J(1)
@@ -2699,13 +2647,13 @@ const Xi = (n) => n.pagination.state$.pipe(
2699
2647
  }, me = (n) => We({
2700
2648
  spineIndex: n.index,
2701
2649
  spineId: n.id
2702
- }), Xt = ({
2650
+ }), Bt = ({
2703
2651
  nodeOrRange: n,
2704
2652
  offset: e,
2705
2653
  item: t
2706
2654
  }) => {
2707
2655
  const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
2708
- return !i || !i?.documentElement || n === i ? me(t) : Vn(n) ? We({
2656
+ return !i || !i?.documentElement || n === i ? me(t) : On(n) ? We({
2709
2657
  start: {
2710
2658
  node: n.startContainer,
2711
2659
  offset: n.startOffset,
@@ -2732,25 +2680,25 @@ const Xi = (n) => n.pagination.state$.pipe(
2732
2680
  const o = t.pages.value.pages.find(
2733
2681
  (r) => r.itemIndex === e.index && r.pageIndex === n
2734
2682
  )?.firstVisibleNode, s = e.renderer.getDocumentFrame();
2735
- return o && s instanceof HTMLIFrameElement && s.contentWindow?.document ? Xt({
2683
+ return o && s instanceof HTMLIFrameElement && s.contentWindow?.document ? Bt({
2736
2684
  nodeOrRange: o.node,
2737
2685
  offset: o.offset,
2738
2686
  item: e.item
2739
2687
  }).trim() : me(e.item);
2740
- }, so = (n, e) => Xt({
2688
+ }, io = (n, e) => Bt({
2741
2689
  nodeOrRange: n,
2742
2690
  item: e
2743
- }), Qs = (n) => n.index.toString(), gt = (n) => n[0]?.index === 6 && n.length > 1, Xe = (n) => {
2691
+ }), Js = (n) => n.index.toString(), gt = (n) => n[0]?.index === 6 && n.length > 1, Xe = (n) => {
2744
2692
  const e = Et(n);
2745
- return xn(e);
2746
- }, ro = (n) => Array.isArray(n) ? n[0] && gt(n[0]) ? n[0] : void 0 : n.parent[0] && gt(n.parent[0]) ? n.parent[0] : void 0, it = (n) => {
2747
- const e = Et(n), s = ((ro(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = Pn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2693
+ return wn(e);
2694
+ }, oo = (n) => Array.isArray(n) ? n[0] && gt(n[0]) ? n[0] : void 0 : n.parent[0] && gt(n.parent[0]) ? n.parent[0] : void 0, it = (n) => {
2695
+ const e = Et(n), s = ((oo(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = Pn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2748
2696
  return {
2749
2697
  isCfiRange: r,
2750
2698
  itemIndex: s,
2751
2699
  offset: a ?? 0
2752
2700
  };
2753
- }, Yt = ({
2701
+ }, Xt = ({
2754
2702
  cfi: n,
2755
2703
  spineItemsManager: e
2756
2704
  }) => {
@@ -2766,7 +2714,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2766
2714
  const r = s.contentWindow?.document;
2767
2715
  if (r)
2768
2716
  try {
2769
- const a = $n(n, r, {
2717
+ const a = xn(n, r, {
2770
2718
  throwOnError: !0
2771
2719
  });
2772
2720
  return {
@@ -2793,7 +2741,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2793
2741
  spineItem: o,
2794
2742
  node: null
2795
2743
  };
2796
- }, ao = (n, e) => {
2744
+ }, so = (n, e) => {
2797
2745
  if ("cfi" in e) {
2798
2746
  const { itemIndex: s, ...r } = n.cfi.parseCfi(e.cfi);
2799
2747
  return {
@@ -2813,7 +2761,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2813
2761
  itemIndex: t.index,
2814
2762
  node: null
2815
2763
  };
2816
- }, co = (n, e) => {
2764
+ }, ro = (n, e) => {
2817
2765
  let t = n?.itemPageIndex;
2818
2766
  const { itemIndex: i, ...o } = e.cfi.parseCfi(n.cfi), s = e.spineItemsManager.get(i);
2819
2767
  return s ? Vt().pipe(
@@ -2846,7 +2794,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2846
2794
  })
2847
2795
  ) : v({ ...n, itemIndex: i, ...o });
2848
2796
  };
2849
- class uo {
2797
+ class ao {
2850
2798
  constructor(e) {
2851
2799
  this.reader = e, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (t) => {
2852
2800
  const i = this.locatorsByKey.get(t);
@@ -2854,7 +2802,7 @@ class uo {
2854
2802
  }, this.locate = (t, i) => {
2855
2803
  const o = {
2856
2804
  resource: t,
2857
- meta: ao(this.reader, t)
2805
+ meta: so(this.reader, t)
2858
2806
  };
2859
2807
  return ct(() => {
2860
2808
  const s = this.reader.spineItemsManager.get(
@@ -2879,7 +2827,7 @@ class uo {
2879
2827
  const d = this.reader.spine.layout$.pipe(
2880
2828
  be(10),
2881
2829
  ne(o),
2882
- ln((p) => co(p.meta, this.reader).pipe(
2830
+ un((p) => ro(p.meta, this.reader).pipe(
2883
2831
  S((g) => ({
2884
2832
  ...p,
2885
2833
  meta: g
@@ -2896,16 +2844,16 @@ class uo {
2896
2844
  }
2897
2845
  locateResource(e, t) {
2898
2846
  return Array.isArray(e) ? ct(
2899
- () => N(
2847
+ () => O(
2900
2848
  e.map((i) => this.locate(i, t ?? {}))
2901
- ).pipe(dn([]))
2849
+ ).pipe(ln([]))
2902
2850
  ) : this.locate(e, t ?? {});
2903
2851
  }
2904
2852
  }
2905
- const lo = (n) => (e) => {
2906
- const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = oo(t);
2853
+ const co = (n) => (e) => {
2854
+ const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = no(t);
2907
2855
  i.pipe($(t.$.destroy$)).subscribe();
2908
- const s = new uo(t);
2856
+ const s = new ao(t);
2909
2857
  return {
2910
2858
  ...t,
2911
2859
  locateResource: s.locateResource.bind(s),
@@ -2919,7 +2867,7 @@ const lo = (n) => (e) => {
2919
2867
  }
2920
2868
  }
2921
2869
  };
2922
- }, po = (n) => ({
2870
+ }, uo = (n) => ({
2923
2871
  put: (s, r) => new Promise((a, c) => {
2924
2872
  const u = n.transaction(["store"], "readwrite");
2925
2873
  u.onerror = (p) => {
@@ -2971,16 +2919,16 @@ const lo = (n) => (e) => {
2971
2919
  a(d);
2972
2920
  };
2973
2921
  })
2974
- }), Ne = async (n) => new Promise((e, t) => {
2922
+ }), Oe = async (n) => new Promise((e, t) => {
2975
2923
  const i = window.indexedDB.open(n);
2976
2924
  i.onerror = (o) => {
2977
2925
  t(o);
2978
2926
  }, i.onsuccess = () => {
2979
- e(po(i.result));
2927
+ e(uo(i.result));
2980
2928
  }, i.onupgradeneeded = () => {
2981
2929
  i.result.createObjectStore("store");
2982
2930
  };
2983
- }), go = (n) => {
2931
+ }), lo = (n) => {
2984
2932
  let e = Date.now().toString();
2985
2933
  const t = new R(), i = (c) => {
2986
2934
  if (typeof c == "string" || typeof c == "object") {
@@ -2991,7 +2939,7 @@ const lo = (n) => (e) => {
2991
2939
  }, o = async (c, u) => {
2992
2940
  const l = i(c);
2993
2941
  if (!l) return new Response("Item not found", { status: 404 });
2994
- const p = await (await Ne("prose-reader")).get(`${e}_${l.id}`);
2942
+ const p = await (await Oe("prose-reader")).get(`${e}_${l.id}`);
2995
2943
  if (p)
2996
2944
  return new Response(p, { status: 200 });
2997
2945
  const g = u && await u(l) || await fetch(l.href);
@@ -3000,10 +2948,10 @@ const lo = (n) => (e) => {
3000
2948
  t.next({ id: c, data: u });
3001
2949
  };
3002
2950
  t.asObservable().pipe(
3003
- wn(({ id: c, data: u }) => {
2951
+ vn(({ id: c, data: u }) => {
3004
2952
  const l = i(c);
3005
2953
  return l ? A(
3006
- pn([Ne("prose-reader"), A(u.blob())])
2954
+ dn([Oe("prose-reader"), A(u.blob())])
3007
2955
  ).pipe(
3008
2956
  X(([d, p]) => A(d.put(`${e}_${l.id}`, p))),
3009
2957
  rt((d) => (D.error(d), _))
@@ -3012,12 +2960,12 @@ const lo = (n) => (e) => {
3012
2960
  K(n.destroy$)
3013
2961
  ).subscribe();
3014
2962
  const r = n.manifest$.pipe(
3015
- O(() => {
2963
+ N(() => {
3016
2964
  e = Date.now().toString();
3017
2965
  })
3018
2966
  );
3019
- return x(r).pipe(
3020
- X(() => (D.debug("Cleanup up old cache..."), A(Ne("prose-reader")).pipe(
2967
+ return P(r).pipe(
2968
+ X(() => (D.debug("Cleanup up old cache..."), A(Oe("prose-reader")).pipe(
3021
2969
  X(
3022
2970
  (c) => A(c.keys()).pipe(
3023
2971
  ie(
@@ -3038,8 +2986,8 @@ const lo = (n) => (e) => {
3038
2986
  t.complete();
3039
2987
  }
3040
2988
  };
3041
- }, ho = (n) => (e) => {
3042
- const t = n(e), i = go(t.context);
2989
+ }, po = (n) => (e) => {
2990
+ const t = n(e), i = lo(t.context);
3043
2991
  return {
3044
2992
  ...t,
3045
2993
  // $: {
@@ -3051,7 +2999,7 @@ const lo = (n) => (e) => {
3051
2999
  }
3052
3000
  // load,
3053
3001
  };
3054
- }, mo = (n, e) => {
3002
+ }, go = (n, e) => {
3055
3003
  const t = n.node.ownerDocument?.createRange(), i = n.node.compareDocumentPosition(e.node);
3056
3004
  if (t) {
3057
3005
  try {
@@ -3071,14 +3019,14 @@ const lo = (n) => (e) => {
3071
3019
  }
3072
3020
  return t;
3073
3021
  }
3074
- }, fo = ({
3022
+ }, ho = ({
3075
3023
  selection: n,
3076
3024
  spineItem: e
3077
3025
  }) => {
3078
3026
  const { anchorNode: t, anchorOffset: i, focusNode: o, focusOffset: s } = n;
3079
3027
  if (!(!t || !o))
3080
3028
  try {
3081
- return mo(
3029
+ return go(
3082
3030
  { node: t, offset: i },
3083
3031
  { node: o, offset: s }
3084
3032
  );
@@ -3090,7 +3038,7 @@ const lo = (n) => (e) => {
3090
3038
  return;
3091
3039
  }
3092
3040
  };
3093
- class yo extends G {
3041
+ class mo extends G {
3094
3042
  constructor(e) {
3095
3043
  super();
3096
3044
  const t = e.contentDocument || e.contentWindow?.document;
@@ -3113,16 +3061,16 @@ class yo extends G {
3113
3061
  )
3114
3062
  )
3115
3063
  ) : v(null);
3116
- this.selectionChange$ = x(
3064
+ this.selectionChange$ = P(
3117
3065
  q(t, "selectionchange"),
3118
3066
  i
3119
3067
  ).pipe(
3120
3068
  S(() => t.getSelection()),
3121
- $(x(o, this.destroy$)),
3069
+ $(P(o, this.destroy$)),
3122
3070
  ye(null)
3123
3071
  ), this.selectionOver$ = q(t, "pointerdown").pipe(
3124
3072
  w(
3125
- () => x(
3073
+ () => P(
3126
3074
  q(t, "pointerup"),
3127
3075
  q(t, "pointercancel"),
3128
3076
  q(t, "contextmenu")
@@ -3132,7 +3080,7 @@ class yo extends G {
3132
3080
  * The selection is still valid during the event even if it will
3133
3081
  * be discarded. The timeout make sure to detect this edge case.
3134
3082
  */
3135
- xe(0),
3083
+ Pe(0),
3136
3084
  S((s) => {
3137
3085
  const r = t.getSelection();
3138
3086
  return r && !r.isCollapsed ? [s, r] : void 0;
@@ -3140,17 +3088,17 @@ class yo extends G {
3140
3088
  M(Z)
3141
3089
  )
3142
3090
  ),
3143
- $(x(o, this.destroy$))
3091
+ $(P(o, this.destroy$))
3144
3092
  );
3145
3093
  }
3146
3094
  }
3147
3095
  }
3148
- const So = (n) => n.watch("isLoaded").pipe(
3096
+ const fo = (n) => n.watch("isLoaded").pipe(
3149
3097
  w(() => {
3150
3098
  const e = n.renderer.getDocumentFrame(), t = e?.contentDocument || e?.contentWindow?.document;
3151
3099
  if (!e || !t) return he;
3152
- const i = new yo(e);
3153
- return x(
3100
+ const i = new mo(e);
3101
+ return P(
3154
3102
  i.selectionChange$.pipe(
3155
3103
  S((o) => {
3156
3104
  if (o?.toString())
@@ -3176,14 +3124,14 @@ const So = (n) => n.watch("isLoaded").pipe(
3176
3124
  );
3177
3125
  }),
3178
3126
  k()
3179
- ), Io = (n) => (e) => {
3127
+ ), yo = (n) => (e) => {
3180
3128
  const t = n(e);
3181
3129
  let i;
3182
3130
  const o = t.spineItemsManager.items$.pipe(
3183
3131
  w((l) => {
3184
3132
  const d = l.map((p) => {
3185
3133
  const g = t.spineItemsManager.getSpineItemIndex(p) ?? 0;
3186
- return So(p).pipe(
3134
+ return fo(p).pipe(
3187
3135
  S((h) => {
3188
3136
  if (h)
3189
3137
  return {
@@ -3193,11 +3141,11 @@ const So = (n) => n.watch("isLoaded").pipe(
3193
3141
  })
3194
3142
  );
3195
3143
  });
3196
- return x(...d);
3144
+ return P(...d);
3197
3145
  }),
3198
3146
  ne(void 0),
3199
3147
  k(),
3200
- P((l) => {
3148
+ x((l) => {
3201
3149
  i = l;
3202
3150
  }),
3203
3151
  J({ refCount: !0, bufferSize: 1 })
@@ -3222,7 +3170,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3222
3170
  ne(void 0),
3223
3171
  J({ refCount: !0, bufferSize: 1 })
3224
3172
  );
3225
- return x(s, u).pipe($(t.$.destroy$)).subscribe(), {
3173
+ return P(s, u).pipe($(t.$.destroy$)).subscribe(), {
3226
3174
  ...t,
3227
3175
  selection: {
3228
3176
  selection$: s,
@@ -3231,7 +3179,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3231
3179
  selectionOver$: c,
3232
3180
  lastSelectionOnPointerdown$: u,
3233
3181
  getSelection: () => i,
3234
- createOrderedRangeFromSelection: fo
3182
+ createOrderedRangeFromSelection: ho
3235
3183
  }
3236
3184
  };
3237
3185
  }, ht = [
@@ -3249,7 +3197,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3249
3197
  backgroundColor: "#191717",
3250
3198
  foregroundColor: "#f1ebeb"
3251
3199
  }
3252
- ], bo = (n) => (e) => {
3200
+ ], So = (n) => (e) => {
3253
3201
  const t = n(e), i = new Y(
3254
3202
  e.theme ?? "bright"
3255
3203
  ), o = () => {
@@ -3291,14 +3239,14 @@ const So = (n) => n.watch("isLoaded").pipe(
3291
3239
  u && oe(u, "prose-reader-theme", o());
3292
3240
  }
3293
3241
  }), t.spineItemsManager.items$.pipe(
3294
- O(
3242
+ N(
3295
3243
  (a) => a.map(
3296
3244
  ({ element: c }) => s({ container: c })
3297
3245
  )
3298
3246
  ),
3299
3247
  K(t.$.destroy$)
3300
3248
  ).subscribe(), i.pipe(
3301
- O(() => {
3249
+ N(() => {
3302
3250
  r();
3303
3251
  }),
3304
3252
  K(t.$.destroy$)
@@ -3314,12 +3262,12 @@ const So = (n) => n.watch("isLoaded").pipe(
3314
3262
  }
3315
3263
  }
3316
3264
  };
3317
- }, vo = (n) => (e) => {
3265
+ }, Io = (n) => (e) => {
3318
3266
  const t = n(e);
3319
3267
  return {
3320
3268
  ...t,
3321
3269
  utils: {
3322
- isOrIsWithinValidLink: (s) => !!(Ot(s) && (s.nodeName === "a" ? s : s.closest("a"))?.getAttribute("href")),
3270
+ isOrIsWithinValidLink: (s) => !!(Nt(s) && (s.nodeName === "a" ? s : s.closest("a"))?.getAttribute("href")),
3323
3271
  injectScopedCSS: (s, r, a) => {
3324
3272
  const c = a.replace("${id}", t.id);
3325
3273
  return Ce(s, `${r}-${t.id}`, c);
@@ -3328,7 +3276,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3328
3276
  };
3329
3277
  };
3330
3278
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3331
- const wo = (n) => (e) => n(e), xo = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}", mt = (n, e, t) => {
3279
+ const bo = (n) => (e) => n(e), vo = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}", mt = (n, e, t) => {
3332
3280
  const { clientWidth: i, clientHeight: o } = t.value.element, s = {
3333
3281
  maxX: 0,
3334
3282
  minX: i * (1 - e),
@@ -3339,30 +3287,30 @@ const wo = (n) => (e) => n(e), xo = "[data-prose-reader-scroll-navigator][data-p
3339
3287
  x: Math.min(Math.max(n.x, s.minX), s.maxX),
3340
3288
  y: Math.min(Math.max(n.y, s.minY), s.maxY)
3341
3289
  };
3342
- }, Po = (n, e, t) => {
3290
+ }, wo = (n, e, t) => {
3343
3291
  t.style.transformOrigin = "0 0";
3344
3292
  const i = `translate3d(${e.x}px, ${e.y}px, 0px)`, o = `scale(${n})`;
3345
3293
  t.style.transform = `${i} ${o}`;
3346
- }, $o = (n, e, t, i) => {
3294
+ }, Po = (n, e, t, i) => {
3347
3295
  const o = e / n, s = t.clientWidth, r = t.clientHeight, a = s / 2 - i.x, c = r / 2 - i.y;
3348
3296
  return {
3349
3297
  x: i.x + a * (1 - o),
3350
3298
  y: i.y + c * (1 - o)
3351
3299
  };
3352
3300
  };
3353
- class qt {
3301
+ class Yt {
3354
3302
  constructor(e) {
3355
3303
  this.x = e.x, this.y = e.y;
3356
3304
  }
3357
3305
  }
3358
- class ft extends qt {
3306
+ class ft extends Yt {
3359
3307
  }
3360
- class To extends qt {
3308
+ class xo extends Yt {
3361
3309
  constructor() {
3362
3310
  super(...arguments), this.__symbol = /* @__PURE__ */ Symbol("UnboundScrollPosition");
3363
3311
  }
3364
3312
  }
3365
- class Fo extends Q {
3313
+ class $o extends Q {
3366
3314
  constructor(e, t, i, o, s) {
3367
3315
  super({
3368
3316
  element: void 0
@@ -3377,33 +3325,33 @@ class Fo extends Q {
3377
3325
  top: g.y,
3378
3326
  behavior: "instant"
3379
3327
  }), Te(1).pipe(
3380
- P(() => {
3328
+ x(() => {
3381
3329
  this.scrollingSubject.next(!1);
3382
3330
  }),
3383
- $(x(this.scrollingSubject.pipe(Lt(1)), this.destroy$))
3331
+ $(P(this.scrollingSubject.pipe(Lt(1)), this.destroy$))
3384
3332
  ).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3385
3333
  };
3386
3334
  const r = this.context.pipe(
3387
3335
  Qe(["rootElement"]),
3388
- P(({ rootElement: d }) => {
3336
+ x(({ rootElement: d }) => {
3389
3337
  if (!d) return;
3390
3338
  const p = document.createElement("div");
3391
- p.setAttribute(`data-${ri}`, ""), p.appendChild(this.viewport.value.element), d.appendChild(p), this.update({ element: p });
3339
+ p.setAttribute(`data-${si}`, ""), p.appendChild(this.viewport.value.element), d.appendChild(p), this.update({ element: p });
3392
3340
  })
3393
- ), a = N([
3341
+ ), a = O([
3394
3342
  t.watch(["computedPageTurnMode"]),
3395
3343
  this.watch("element")
3396
3344
  ]).pipe(
3397
- P(([{ computedPageTurnMode: d }, p]) => {
3345
+ x(([{ computedPageTurnMode: d }, p]) => {
3398
3346
  p && (d === "scrollable" ? p.style.display = "block" : p.style.display = "contents");
3399
3347
  })
3400
- ), c = this.navigateSubject.pipe(P(this.setViewportPosition));
3348
+ ), c = this.navigateSubject.pipe(x(this.setViewportPosition));
3401
3349
  this.isNavigating$ = this.navigateSubject.pipe(
3402
3350
  ne(!1),
3403
- w(() => x(v(!0), v(!1))),
3351
+ w(() => P(v(!0), v(!1))),
3404
3352
  J(1)
3405
3353
  );
3406
- const u = x(
3354
+ const u = P(
3407
3355
  o.element$.pipe(
3408
3356
  M(Z),
3409
3357
  w((d) => et(d))
@@ -3422,7 +3370,7 @@ class Fo extends Q {
3422
3370
  ),
3423
3371
  k(),
3424
3372
  ne(!1)
3425
- ), l = N([
3373
+ ), l = O([
3426
3374
  u,
3427
3375
  this.isScrolling$
3428
3376
  ]).pipe(
@@ -3447,7 +3395,7 @@ class Fo extends Q {
3447
3395
  )
3448
3396
  ),
3449
3397
  j()
3450
- ), x(r, a, c).pipe($(this.destroy$)).subscribe();
3398
+ ), P(r, a, c).pipe($(this.destroy$)).subscribe();
3451
3399
  }
3452
3400
  update(e) {
3453
3401
  this.mergeCompare(e);
@@ -3477,15 +3425,15 @@ class Fo extends Q {
3477
3425
  });
3478
3426
  }
3479
3427
  }
3480
- const Lo = (n, e, t, i, o) => {
3428
+ const To = (n, e, t, i, o) => {
3481
3429
  const s = n.clientWidth, r = n.clientHeight, a = n.scrollLeft, c = n.scrollTop, u = a + s / 2 - i, l = c + r / 2 - o, d = t / e, p = u * d, g = l * d, h = p - s / 2 + i, m = g - r / 2 + o;
3482
- return new To({
3430
+ return new xo({
3483
3431
  x: h,
3484
3432
  y: m
3485
3433
  });
3486
- }, Mo = (n, e) => {
3487
- const t = e.viewport, i = e.navigation.scrollNavigationController, o = t.value.element, s = i.value.element, r = i.value.element, a = Math.round(t.scaleFactor * 100) / 100, c = o.offsetLeft, u = o.offsetTop, l = Lo(
3488
- s ?? An(),
3434
+ }, Fo = (n, e) => {
3435
+ const t = e.viewport, i = e.navigation.scrollNavigationController, o = t.value.element, s = i.value.element, r = i.value.element, a = Math.round(t.scaleFactor * 100) / 100, c = o.offsetLeft, u = o.offsetTop, l = To(
3436
+ s ?? Rn(),
3489
3437
  a,
3490
3438
  n,
3491
3439
  c,
@@ -3502,7 +3450,7 @@ const Lo = (n, e, t, i, o) => {
3502
3450
  position: p
3503
3451
  });
3504
3452
  }, we = 200;
3505
- class Co extends Q {
3453
+ class Lo extends Q {
3506
3454
  constructor(e) {
3507
3455
  super({
3508
3456
  isZooming: !1,
@@ -3523,7 +3471,7 @@ class Co extends Q {
3523
3471
  currentScale: 1,
3524
3472
  currentPosition: { x: 0, y: 0 }
3525
3473
  }), this.updateZoom(s), s !== 1 && this.isControlled ? Te(o?.animate ? we : 0).pipe(
3526
- P(() => {
3474
+ x(() => {
3527
3475
  this.reader.layout();
3528
3476
  })
3529
3477
  ) : _;
@@ -3542,7 +3490,7 @@ class Co extends Q {
3542
3490
  ), o?.animate && this.isControlled && (s.style.transition = `transform ${we}ms`), this.updateZoom(1, { x: 0, y: 0 }), s.style.transform = "", this.mergeCompare({
3543
3491
  isZooming: !1
3544
3492
  }), Te(o?.animate ? we : 0).pipe(
3545
- P(() => {
3493
+ x(() => {
3546
3494
  const r = this.reader.viewport.value.element;
3547
3495
  r.style.transformOrigin = "", r.style.transition = "", this.isControlled && this.reader.layout();
3548
3496
  }),
@@ -3550,7 +3498,7 @@ class Co extends Q {
3550
3498
  );
3551
3499
  })
3552
3500
  );
3553
- x(t, i).pipe($(this.destroy$)).subscribe();
3501
+ P(t, i).pipe($(this.destroy$)).subscribe();
3554
3502
  }
3555
3503
  enter(e) {
3556
3504
  this.enterSubject.next(e);
@@ -3572,7 +3520,7 @@ class Co extends Q {
3572
3520
  }
3573
3521
  updateZoom(e, t, i) {
3574
3522
  if (this.isControlled) {
3575
- const o = t || $o(
3523
+ const o = t || Po(
3576
3524
  this.value.currentScale,
3577
3525
  e,
3578
3526
  this.viewport.element,
@@ -3588,11 +3536,11 @@ class Co extends Q {
3588
3536
  });
3589
3537
  }
3590
3538
  applyZoom(e, t) {
3591
- this.isControlled ? Po(
3539
+ this.isControlled ? wo(
3592
3540
  e,
3593
3541
  t,
3594
3542
  this.viewport.element
3595
- ) : Mo(e, this.reader);
3543
+ ) : Fo(e, this.reader);
3596
3544
  }
3597
3545
  get isControlled() {
3598
3546
  return this.reader.settings.values.computedPageTurnMode === "controlled";
@@ -3604,9 +3552,9 @@ class Co extends Q {
3604
3552
  return this.reader.viewport.value;
3605
3553
  }
3606
3554
  }
3607
- const yt = `${Ut}-enhancer-zoom`, Eo = (n) => (e) => {
3608
- const t = n(e), i = new Co(t);
3609
- Ce(document, yt, xo);
3555
+ const yt = `${Ut}-enhancer-zoom`, Mo = (n) => (e) => {
3556
+ const t = n(e), i = new Lo(t);
3557
+ Ce(document, yt, vo);
3610
3558
  const o = () => {
3611
3559
  Ee(document, yt), i.destroy(), t.destroy();
3612
3560
  }, s = i;
@@ -3624,8 +3572,8 @@ const yt = `${Ut}-enhancer-zoom`, Eo = (n) => (e) => {
3624
3572
  }
3625
3573
  }
3626
3574
  };
3627
- }, Gt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3628
- class Do {
3575
+ }, qt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3576
+ class Co {
3629
3577
  constructor() {
3630
3578
  this.navigationSubject = new ot(1), this.viewportStateSubject = new Y("free"), this.paginationSubject = new ot(), this.navigationIsLockedSubject = new Y(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3631
3579
  k(),
@@ -3637,11 +3585,11 @@ class Do {
3637
3585
  ), this.navigation$ = this.navigationSubject.asObservable();
3638
3586
  }
3639
3587
  }
3640
- class Ro extends Q {
3588
+ class Eo extends Q {
3641
3589
  constructor() {
3642
3590
  super({
3643
3591
  assumedRenditionLayout: "reflowable"
3644
- }), this.bridgeEvent = new Do(), this.manifest$ = this.pipe(
3592
+ }), this.bridgeEvent = new Co(), this.manifest$ = this.pipe(
3645
3593
  ie((e) => e.manifest),
3646
3594
  ae(Z),
3647
3595
  fe()
@@ -3652,7 +3600,7 @@ class Ro extends Q {
3652
3600
  ...t,
3653
3601
  ...e,
3654
3602
  ...e.manifest && {
3655
- isFullyPrePaginated: Gt(i),
3603
+ isFullyPrePaginated: qt(i),
3656
3604
  assumedRenditionLayout: i?.renditionLayout ?? "reflowable"
3657
3605
  }
3658
3606
  };
@@ -3665,14 +3613,14 @@ class Ro extends Q {
3665
3613
  return this.manifest?.readingDirection;
3666
3614
  }
3667
3615
  }
3668
- class Ao extends Q {
3616
+ class Do extends Q {
3669
3617
  constructor(e, t) {
3670
3618
  super({
3671
3619
  supportedPageTurnAnimation: ["fade", "none", "slide"],
3672
3620
  supportedPageTurnMode: ["controlled", "scrollable"],
3673
3621
  supportedPageTurnDirection: ["horizontal", "vertical"],
3674
3622
  supportedComputedPageTurnDirection: ["horizontal", "vertical"]
3675
- }), N([
3623
+ }), O([
3676
3624
  e.watch(["manifest", "hasVerticalWriting"]),
3677
3625
  t.watch(["computedPageTurnMode"])
3678
3626
  ]).pipe(
@@ -3700,7 +3648,7 @@ class Ao extends Q {
3700
3648
  ).subscribe(this.next.bind(this));
3701
3649
  }
3702
3650
  }
3703
- class Oo {
3651
+ class Ro {
3704
3652
  constructor() {
3705
3653
  this._hooks = [], this._hookExecutions = [];
3706
3654
  }
@@ -3759,20 +3707,20 @@ class Oo {
3759
3707
  (r) => !o.includes(r)
3760
3708
  );
3761
3709
  const s = o.map(({ destroyFn: r }) => r());
3762
- return N(s);
3710
+ return O(s);
3763
3711
  }
3764
3712
  }
3765
- const No = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position:relative;overflow-y:scroll;overflow-x:hidden}[data-prose-reader-viewport]{background-color:#fff;position:relative;height:100%;width:100%}", Vo = (n) => ({
3713
+ const Ao = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position:relative;overflow-y:scroll;overflow-x:hidden}[data-prose-reader-viewport]{background-color:#fff;position:relative;height:100%;width:100%}", No = (n) => ({
3766
3714
  x: -n.x,
3767
3715
  y: -n.y
3768
- }), jo = (n) => n instanceof DOMMatrix ? new L({
3716
+ }), Oo = (n) => n instanceof DOMMatrix ? new L({
3769
3717
  x: -n.e,
3770
3718
  y: -n.f
3771
3719
  }) : new L({
3772
3720
  x: -n.x,
3773
3721
  y: -n.y
3774
- }), ko = "navigation/ViewportNavigator", St = D.namespace(ko);
3775
- class Uo extends G {
3722
+ }), Vo = "navigation/ViewportNavigator", St = D.namespace(Vo);
3723
+ class jo extends G {
3776
3724
  constructor(e, t, i, o, s) {
3777
3725
  super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new R(), this.element$ = new Y(
3778
3726
  document.createElement("div")
@@ -3780,7 +3728,7 @@ class Uo extends G {
3780
3728
  const r = this.spine.element$.pipe(
3781
3729
  M(Z),
3782
3730
  z(this.element$),
3783
- P(([l, d]) => {
3731
+ x(([l, d]) => {
3784
3732
  d.style.cssText = `
3785
3733
  height: 100%;
3786
3734
  width: 100%;
@@ -3791,22 +3739,22 @@ class Uo extends G {
3791
3739
  "computedPageTurnDirection",
3792
3740
  "computedPageTurnMode",
3793
3741
  "numberOfAdjacentSpineItemToPreLoad"
3794
- ]), c = N([
3742
+ ]), c = O([
3795
3743
  a,
3796
3744
  this.element$
3797
3745
  ]).pipe(
3798
- P(([, l]) => {
3746
+ x(([, l]) => {
3799
3747
  e.values.computedPageTurnMode === "scrollable" ? l.style.display = "contents" : l.style.display = "block";
3800
3748
  })
3801
3749
  );
3802
3750
  this.layout$ = c.pipe(
3803
- P(() => {
3751
+ x(() => {
3804
3752
  St.info("layout", e.values);
3805
3753
  }),
3806
3754
  j()
3807
3755
  );
3808
3756
  const u = this.navigateSubject.pipe(
3809
- P((l) => {
3757
+ x((l) => {
3810
3758
  St.info("Navigation requested", l);
3811
3759
  })
3812
3760
  );
@@ -3819,7 +3767,7 @@ class Uo extends G {
3819
3767
  })),
3820
3768
  w((l) => {
3821
3769
  const d = this.element$.getValue();
3822
- return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"), x(
3770
+ return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"), P(
3823
3771
  v(!0),
3824
3772
  v(null).pipe(
3825
3773
  ge(() => {
@@ -3834,8 +3782,8 @@ class Uo extends G {
3834
3782
  * anything for x ms while we effectively adjust. We want it to be immediate.
3835
3783
  * However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
3836
3784
  */
3837
- l.shouldAnimate ? xe(1, ce) : Pe,
3838
- P((h) => {
3785
+ l.shouldAnimate ? Pe(1, ce) : xe,
3786
+ x((h) => {
3839
3787
  const m = this.element$.getValue();
3840
3788
  h.shouldAnimate ? g === "fade" ? (m.style.setProperty(
3841
3789
  "transition",
@@ -3853,16 +3801,16 @@ class Uo extends G {
3853
3801
  * need to adjust to anchor to the payload position. This is because we use viewport computed position,
3854
3802
  * not the value set by `setProperty`
3855
3803
  */
3856
- P((h) => {
3804
+ x((h) => {
3857
3805
  g !== "fade" && this.setViewportPosition(h.position);
3858
3806
  }),
3859
- l.shouldAnimate ? xe(p / 2, ce) : Pe,
3860
- P((h) => {
3807
+ l.shouldAnimate ? Pe(p / 2, ce) : xe,
3808
+ x((h) => {
3861
3809
  const m = this.element$.getValue();
3862
3810
  g === "fade" && (this.setViewportPosition(h.position), m.style.setProperty("opacity", "1"));
3863
3811
  }),
3864
- l.shouldAnimate ? xe(p / 2, ce) : Pe,
3865
- P((h) => {
3812
+ l.shouldAnimate ? Pe(p / 2, ce) : xe,
3813
+ x((h) => {
3866
3814
  g === "fade" && this.setViewportPosition(h.position);
3867
3815
  })
3868
3816
  );
@@ -3873,7 +3821,7 @@ class Uo extends G {
3873
3821
  }),
3874
3822
  ne(!1),
3875
3823
  J(1)
3876
- ), x(r, this.isNavigating$, this.layout$).pipe($(this.destroy$)).subscribe();
3824
+ ), P(r, this.isNavigating$, this.layout$).pipe($(this.destroy$)).subscribe();
3877
3825
  }
3878
3826
  /**
3879
3827
  * Programmatically set the viewport position.
@@ -3884,7 +3832,7 @@ class Uo extends G {
3884
3832
  * for remark about flicker / fonts smoothing
3885
3833
  */
3886
3834
  setViewportPosition(e) {
3887
- const t = this.element$.getValue(), i = Vo(e);
3835
+ const t = this.element$.getValue(), i = No(e);
3888
3836
  t.style.transform = `translate(${i.x}px, ${i.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3889
3837
  }
3890
3838
  navigate(e) {
@@ -3899,10 +3847,10 @@ class Uo extends G {
3899
3847
  if (!i || i === "none")
3900
3848
  return new L({ x: 0, y: 0 });
3901
3849
  const o = new DOMMatrix(i);
3902
- return jo(o);
3850
+ return Oo(o);
3903
3851
  }
3904
3852
  }
3905
- const zo = () => (n) => n.pipe(
3853
+ const ko = () => (n) => n.pipe(
3906
3854
  S(({ navigation: e, pagination: t, ...i }) => ({
3907
3855
  navigation: {
3908
3856
  ...e,
@@ -3910,7 +3858,7 @@ const zo = () => (n) => n.pipe(
3910
3858
  },
3911
3859
  ...i
3912
3860
  }))
3913
- ), Wo = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3861
+ ), Uo = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3914
3862
  z(e),
3915
3863
  M(
3916
3864
  ([i, o]) => i.navigationId === o.id
@@ -3927,7 +3875,7 @@ const zo = () => (n) => n.pipe(
3927
3875
  navigation: o
3928
3876
  }))
3929
3877
  )),
3930
- zo(),
3878
+ ko(),
3931
3879
  k(
3932
3880
  (i, o) => i.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
3933
3881
  ),
@@ -3939,7 +3887,7 @@ const zo = () => (n) => n.pipe(
3939
3887
  }
3940
3888
  })
3941
3889
  )
3942
- ), _o = ({ navigationResolver: n }) => (e) => e.pipe(
3890
+ ), zo = ({ navigationResolver: n }) => (e) => e.pipe(
3943
3891
  S(([t, i]) => {
3944
3892
  const o = {
3945
3893
  type: "api",
@@ -3976,7 +3924,7 @@ const zo = () => (n) => n.pipe(
3976
3924
  navigation: o
3977
3925
  };
3978
3926
  })
3979
- ), Ho = ({ navigationResolver: n }) => (e) => e.pipe(
3927
+ ), Wo = ({ navigationResolver: n }) => (e) => e.pipe(
3980
3928
  S((t) => {
3981
3929
  if (t.navigation.cfi) {
3982
3930
  const i = n.getNavigationForCfi(
@@ -3993,16 +3941,16 @@ const zo = () => (n) => n.pipe(
3993
3941
  }
3994
3942
  return t;
3995
3943
  })
3996
- ), Bo = ({
3944
+ ), _o = ({
3997
3945
  navigation: n,
3998
3946
  previousNavigation: e,
3999
3947
  settings: t
4000
- }) => 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", Xo = ({
3948
+ }) => 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", Ho = ({
4001
3949
  context: n,
4002
3950
  settings: e
4003
3951
  }) => (t) => t.pipe(
4004
3952
  S(({ navigation: i, previousNavigation: o }) => {
4005
- const s = Bo({
3953
+ const s = _o({
4006
3954
  navigation: i,
4007
3955
  previousNavigation: o,
4008
3956
  settings: e
@@ -4016,7 +3964,7 @@ const zo = () => (n) => n.pipe(
4016
3964
  direction: s
4017
3965
  };
4018
3966
  })
4019
- ), Yo = ({
3967
+ ), Bo = ({
4020
3968
  spineItemsManager: n,
4021
3969
  navigationResolver: e,
4022
3970
  settings: t
@@ -4185,7 +4133,7 @@ const zo = () => (n) => n.pipe(
4185
4133
  ...a
4186
4134
  }))
4187
4135
  );
4188
- }, qo = ({ navigationResolver: n }) => (e) => e.pipe(
4136
+ }, Xo = ({ navigationResolver: n }) => (e) => e.pipe(
4189
4137
  S((t) => {
4190
4138
  if (t.navigation.url) {
4191
4139
  const i = n.getNavigationForUrl(
@@ -4204,7 +4152,7 @@ const zo = () => (n) => n.pipe(
4204
4152
  return t;
4205
4153
  })
4206
4154
  );
4207
- class Zt {
4155
+ class Gt {
4208
4156
  constructor() {
4209
4157
  this.isLockedSubject = new Y(0), this.isLocked$ = this.isLockedSubject.pipe(
4210
4158
  S((e) => !!e),
@@ -4218,7 +4166,7 @@ class Zt {
4218
4166
  };
4219
4167
  }
4220
4168
  }
4221
- const Go = ({
4169
+ const Yo = ({
4222
4170
  spineLocator: n,
4223
4171
  navigation: e,
4224
4172
  navigationResolver: t,
@@ -4275,7 +4223,7 @@ const Go = ({
4275
4223
  return c ? t.getNavigationForPosition(e.position) : t.getNavigationForSpineIndexOrId(s);
4276
4224
  })
4277
4225
  ) : v(new L({ x: 0, y: 0 }));
4278
- }, Zo = ({
4226
+ }, qo = ({
4279
4227
  navigation: n,
4280
4228
  spineLocator: e,
4281
4229
  spineItemsManager: t,
@@ -4344,7 +4292,7 @@ const Go = ({
4344
4292
  }
4345
4293
  }
4346
4294
  return n.position;
4347
- }, Jo = ({
4295
+ }, Go = ({
4348
4296
  navigation: n,
4349
4297
  spineItemsManager: e,
4350
4298
  settings: t,
@@ -4352,7 +4300,7 @@ const Go = ({
4352
4300
  navigationResolver: o,
4353
4301
  spine: s
4354
4302
  }) => t.values.computedPageTurnMode === "scrollable" ? v(
4355
- Zo({
4303
+ qo({
4356
4304
  navigation: n,
4357
4305
  spineLocator: i,
4358
4306
  navigationResolver: o,
@@ -4360,7 +4308,7 @@ const Go = ({
4360
4308
  spineItemsManager: e,
4361
4309
  spine: s
4362
4310
  })
4363
- ) : Go({
4311
+ ) : Yo({
4364
4312
  navigation: n,
4365
4313
  spineLocator: i,
4366
4314
  navigationResolver: o,
@@ -4372,7 +4320,7 @@ const Go = ({
4372
4320
  context: t,
4373
4321
  spine: i
4374
4322
  }) => (o) => o.pipe(
4375
- w((s) => Jo({
4323
+ w((s) => Go({
4376
4324
  spineLocator: i.locator,
4377
4325
  navigation: s.navigation,
4378
4326
  navigationResolver: e,
@@ -4389,8 +4337,8 @@ const Go = ({
4389
4337
  }
4390
4338
  }))
4391
4339
  ))
4392
- ), Ko = "navigation/InternalNavigator", Qo = D.namespace(Ko);
4393
- class es extends G {
4340
+ ), Zo = "navigation/InternalNavigator", Jo = D.namespace(Zo);
4341
+ class Ko extends G {
4394
4342
  constructor(e, t, i, o, s, r, a, c) {
4395
4343
  super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isRestorationLocked$ = c, this.navigationSubject = new Y({
4396
4344
  animation: !1,
@@ -4410,27 +4358,27 @@ class es extends G {
4410
4358
  ({ position: f, ...I }, { position: b, ...F }) => U(I, F) && U(f, b)
4411
4359
  ),
4412
4360
  J(1)
4413
- ), this.locker = new Zt();
4361
+ ), this.locker = new Gt();
4414
4362
  const u = i.pipe(
4415
4363
  z(this.navigationSubject),
4416
- _o({
4364
+ zo({
4417
4365
  navigationResolver: r
4418
4366
  }),
4419
4367
  /**
4420
4368
  * Url lookup is heavier so we start with it to fill
4421
4369
  * as much information as needed to reduce later lookup
4422
4370
  */
4423
- qo({
4371
+ Xo({
4424
4372
  navigationResolver: r
4425
4373
  }),
4426
4374
  /**
4427
4375
  * Cfi lookup is heavier so we start with it to fill
4428
4376
  * as much information as needed to reduce later lookup
4429
4377
  */
4430
- Ho({
4378
+ Wo({
4431
4379
  navigationResolver: r
4432
4380
  }),
4433
- Xo({ context: t, settings: e }),
4381
+ Ho({ context: t, settings: e }),
4434
4382
  It({
4435
4383
  navigationResolver: r,
4436
4384
  settings: e,
@@ -4447,7 +4395,7 @@ class es extends G {
4447
4395
  spine: a
4448
4396
  })
4449
4397
  ).pipe(
4450
- Yo({
4398
+ Bo({
4451
4399
  navigationResolver: r,
4452
4400
  spineItemsManager: a.spineItemsManager,
4453
4401
  settings: e
@@ -4456,7 +4404,7 @@ class es extends G {
4456
4404
  w(([f, I]) => {
4457
4405
  const b = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || I;
4458
4406
  return v(f).pipe(
4459
- b ? Pe : vt({
4407
+ b ? xe : vt({
4460
4408
  navigationResolver: r,
4461
4409
  settings: e,
4462
4410
  spine: a,
@@ -4493,7 +4441,7 @@ class es extends G {
4493
4441
  );
4494
4442
  }),
4495
4443
  j()
4496
- ), d = x(
4444
+ ), d = P(
4497
4445
  o.layout$,
4498
4446
  a.layout$
4499
4447
  ).pipe(
@@ -4516,10 +4464,10 @@ class es extends G {
4516
4464
  * it has been controlled outside.
4517
4465
  */
4518
4466
  $(
4519
- x(l, u)
4467
+ P(l, u)
4520
4468
  )
4521
4469
  ))
4522
- ), p = x(
4470
+ ), p = P(
4523
4471
  d,
4524
4472
  l
4525
4473
  ).pipe(
@@ -4564,17 +4512,17 @@ class es extends G {
4564
4512
  }),
4565
4513
  S(({ navigation: f }) => f),
4566
4514
  j()
4567
- ), g = Wo(
4515
+ ), g = Uo(
4568
4516
  t,
4569
4517
  this.navigationSubject,
4570
4518
  a
4571
- ), h = x(
4519
+ ), h = P(
4572
4520
  p,
4573
4521
  u,
4574
4522
  g
4575
4523
  ), m = (f) => f.pipe(
4576
- P(([I, b]) => {
4577
- Qo.info(
4524
+ x(([I, b]) => {
4525
+ Jo.info(
4578
4526
  `navigation updated from ${I.meta.triggeredBy} of type ${I.type}`,
4579
4527
  {
4580
4528
  previousNavigation: b,
@@ -4583,7 +4531,7 @@ class es extends G {
4583
4531
  ), this.navigationSubject.next(I);
4584
4532
  })
4585
4533
  ), y = (f) => f.pipe(
4586
- P(([I, b]) => {
4534
+ x(([I, b]) => {
4587
4535
  const F = I.type === "scroll", T = I.meta.triggeredBy === "pagination", E = I.meta.triggeredBy === "restoration", H = U(
4588
4536
  b.position,
4589
4537
  I.position
@@ -4632,14 +4580,14 @@ const Fe = (n, e, t) => {
4632
4580
  }, wt = (n, e, t) => {
4633
4581
  const i = [...Array(t)].map((o, s) => s * e);
4634
4582
  return n <= 0 || t === 0 ? 0 : n >= t * e ? t - 1 : i.findIndex((o) => n < o + e) ?? 0;
4635
- }, ts = ({
4583
+ }, Qo = ({
4636
4584
  itemWidth: n,
4637
4585
  itemHeight: e,
4638
4586
  spineItemPosition: t
4639
4587
  }) => new C({
4640
4588
  x: Math.min(n, Math.max(0, t.x)),
4641
4589
  y: Math.min(e, Math.max(0, t.y))
4642
- }), Jt = ({
4590
+ }), Zt = ({
4643
4591
  itemHeight: n,
4644
4592
  itemWidth: e,
4645
4593
  isUsingVerticalWriting: t,
@@ -4647,7 +4595,7 @@ const Fe = (n, e, t) => {
4647
4595
  pageHeight: o,
4648
4596
  pageTurnDirection: s,
4649
4597
  pageTurnMode: r
4650
- }) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Ye(n, o) : Ye(e, i), xt = ({
4598
+ }) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Ye(n, o) : Ye(e, i), Pt = ({
4651
4599
  itemWidth: n,
4652
4600
  itemHeight: e,
4653
4601
  position: t,
@@ -4658,11 +4606,11 @@ const Fe = (n, e, t) => {
4658
4606
  pageTurnMode: a,
4659
4607
  isRTL: c
4660
4608
  }) => {
4661
- const l = ts({
4609
+ const l = Qo({
4662
4610
  spineItemPosition: t,
4663
4611
  itemHeight: e,
4664
4612
  itemWidth: n
4665
- }).x, d = Jt({
4613
+ }).x, d = Zt({
4666
4614
  isUsingVerticalWriting: i,
4667
4615
  itemHeight: e,
4668
4616
  itemWidth: n,
@@ -4675,7 +4623,7 @@ const Fe = (n, e, t) => {
4675
4623
  return wt(t.y, s, d);
4676
4624
  const p = wt(l, o, d);
4677
4625
  return c ? d - 1 - p : p;
4678
- }, ns = ({
4626
+ }, es = ({
4679
4627
  pageIndex: n,
4680
4628
  itemLayout: e,
4681
4629
  context: t,
@@ -4705,14 +4653,14 @@ const Fe = (n, e, t) => {
4705
4653
  x: s,
4706
4654
  y: 0
4707
4655
  });
4708
- }, Kt = ({
4656
+ }, Jt = ({
4709
4657
  context: n,
4710
4658
  settings: e,
4711
4659
  viewport: t
4712
4660
  }) => {
4713
4661
  const i = (a, c, u) => {
4714
4662
  let l;
4715
- a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? l = a.getBoundingClientRect().x : a && (l = (a ? En(a, c) : void 0)?.getBoundingClientRect().x || l);
4663
+ a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? l = a.getBoundingClientRect().x : a && (l = (a ? Cn(a, c) : void 0)?.getBoundingClientRect().x || l);
4716
4664
  const d = u.layout.layoutInfo?.width || 0, p = t.pageSize.width;
4717
4665
  if (l !== void 0) {
4718
4666
  const g = je(
@@ -4728,14 +4676,14 @@ const Fe = (n, e, t) => {
4728
4676
  getSpineItemPositionFromPageIndex: ({
4729
4677
  pageIndex: a,
4730
4678
  spineItem: c
4731
- }) => ns({
4679
+ }) => es({
4732
4680
  context: n,
4733
4681
  isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
4734
4682
  itemLayout: c.layout.layoutInfo,
4735
4683
  pageIndex: a,
4736
4684
  viewport: t
4737
4685
  }),
4738
- getSpineItemPageIndexFromPosition: (a) => xt({
4686
+ getSpineItemPageIndexFromPosition: (a) => Pt({
4739
4687
  ...a,
4740
4688
  isRTL: n.isRTL(),
4741
4689
  pageWidth: t.pageSize.width,
@@ -4745,7 +4693,7 @@ const Fe = (n, e, t) => {
4745
4693
  }),
4746
4694
  getSpineItemPageIndexFromNode: (a, c, u) => {
4747
4695
  const l = i(a, c, u), { height: d, width: p } = u.layout.layoutInfo;
4748
- return l ? xt({
4696
+ return l ? Pt({
4749
4697
  isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
4750
4698
  position: l,
4751
4699
  itemHeight: d,
@@ -4780,7 +4728,7 @@ const Fe = (n, e, t) => {
4780
4728
  c,
4781
4729
  d
4782
4730
  );
4783
- return new Oe({
4731
+ return new Ne({
4784
4732
  x: a.x,
4785
4733
  y: a.y - y
4786
4734
  });
@@ -4788,23 +4736,23 @@ const Fe = (n, e, t) => {
4788
4736
  const m = Fe(p, c, l);
4789
4737
  if (n.isRTL()) {
4790
4738
  const y = l - (c + 1) * p;
4791
- return new Oe({
4739
+ return new Ne({
4792
4740
  x: a.x - Math.max(0, y),
4793
4741
  y: a.y
4794
4742
  });
4795
4743
  }
4796
- return new Oe({
4744
+ return new Ne({
4797
4745
  x: a.x - m,
4798
4746
  y: a.y
4799
4747
  });
4800
4748
  }
4801
4749
  };
4802
- }, is = ({
4750
+ }, ts = ({
4803
4751
  context: n,
4804
4752
  settings: e,
4805
4753
  viewport: t
4806
4754
  }) => {
4807
- const i = Kt({
4755
+ const i = Jt({
4808
4756
  context: n,
4809
4757
  settings: e,
4810
4758
  viewport: t
@@ -4828,7 +4776,7 @@ const Fe = (n, e, t) => {
4828
4776
  ) || new C({ x: 0, y: 0 })
4829
4777
  };
4830
4778
  };
4831
- function Qt({
4779
+ function Kt({
4832
4780
  position: n,
4833
4781
  isRTL: e,
4834
4782
  spineItemsManager: t,
@@ -4853,7 +4801,7 @@ function Qt({
4853
4801
  y: u
4854
4802
  });
4855
4803
  }
4856
- const Pt = ({
4804
+ const xt = ({
4857
4805
  position: n,
4858
4806
  isRTL: e,
4859
4807
  pageSizeHeight: t,
@@ -4861,7 +4809,7 @@ const Pt = ({
4861
4809
  visibleAreaRectWidth: o,
4862
4810
  spine: s
4863
4811
  }) => {
4864
- const r = Qt({
4812
+ const r = Kt({
4865
4813
  position: n,
4866
4814
  isRTL: e,
4867
4815
  spineItemsManager: i,
@@ -4914,7 +4862,7 @@ const Pt = ({
4914
4862
  });
4915
4863
  }
4916
4864
  return new L({ x: 0, y: 0 });
4917
- }, os = ({
4865
+ }, ns = ({
4918
4866
  pageIndex: n,
4919
4867
  spineItemsManager: e,
4920
4868
  spineItemId: t,
@@ -4944,28 +4892,28 @@ const Pt = ({
4944
4892
  pageSizeWidth: s.pageSize.width,
4945
4893
  visibleAreaRectWidth: s.absoluteViewport.width
4946
4894
  });
4947
- }, ss = (n, e) => {
4895
+ }, is = (n, e) => {
4948
4896
  if (e && e instanceof HTMLIFrameElement)
4949
4897
  return n.startsWith("#") ? e.contentDocument?.getElementById(
4950
4898
  n.replace("#", "")
4951
4899
  ) : e.contentDocument?.querySelector(n);
4952
- }, rs = ({
4900
+ }, os = ({
4953
4901
  anchor: n,
4954
4902
  spineItem: e,
4955
4903
  spine: t
4956
4904
  }) => {
4957
- const i = ss(
4905
+ const i = is(
4958
4906
  n,
4959
4907
  e.renderer.getDocumentFrame()
4960
4908
  );
4961
4909
  return i ? t.spineItemLocator.getSpineItemPositionFromNode(i, 0, e)?.x ?? 0 : 0;
4962
- }, as = ({
4910
+ }, ss = ({
4963
4911
  anchor: n,
4964
4912
  spineItem: e,
4965
4913
  spineLocator: t,
4966
4914
  spine: i
4967
4915
  }) => {
4968
- const o = rs({
4916
+ const o = os({
4969
4917
  anchor: n,
4970
4918
  spineItem: e,
4971
4919
  spine: i
@@ -4974,7 +4922,7 @@ const Pt = ({
4974
4922
  spineItemPosition: new C({ x: o, y: 0 }),
4975
4923
  spineItem: e
4976
4924
  });
4977
- }, cs = ({
4925
+ }, rs = ({
4978
4926
  anchor: n,
4979
4927
  spineItem: e,
4980
4928
  spineLocator: t,
@@ -4982,7 +4930,7 @@ const Pt = ({
4982
4930
  pageSizeWidth: o,
4983
4931
  visibleAreaRectWidth: s
4984
4932
  }) => {
4985
- const r = as({
4933
+ const r = ss({
4986
4934
  anchor: n,
4987
4935
  spineItem: e,
4988
4936
  spineLocator: t,
@@ -4993,7 +4941,7 @@ const Pt = ({
4993
4941
  pageSizeWidth: o,
4994
4942
  visibleAreaRectWidth: s
4995
4943
  });
4996
- }, us = ({
4944
+ }, as = ({
4997
4945
  spine: n,
4998
4946
  spineItemsManager: e,
4999
4947
  spineLocator: t,
@@ -5009,7 +4957,7 @@ const Pt = ({
5009
4957
  if (u) {
5010
4958
  const l = e.get(u.id);
5011
4959
  if (l) {
5012
- const d = cs({
4960
+ const d = rs({
5013
4961
  anchor: a.hash,
5014
4962
  spineItem: l,
5015
4963
  spine: n,
@@ -5032,7 +4980,7 @@ const Pt = ({
5032
4980
  console.error(a);
5033
4981
  return;
5034
4982
  }
5035
- }, ls = ({
4983
+ }, cs = ({
5036
4984
  spineItem: n,
5037
4985
  spineItemPosition: e,
5038
4986
  spineLocator: t,
@@ -5051,7 +4999,7 @@ const Pt = ({
5051
4999
  pageSizeWidth: o.pageSize.width,
5052
5000
  visibleAreaRectWidth: o.absoluteViewport.width
5053
5001
  });
5054
- }, ds = "spineNavigator", ps = ({
5002
+ }, us = "spineNavigator", ls = ({
5055
5003
  context: n,
5056
5004
  spineItemsManager: e,
5057
5005
  locator: t,
@@ -5059,13 +5007,13 @@ const Pt = ({
5059
5007
  spine: o,
5060
5008
  viewport: s
5061
5009
  }) => {
5062
- const r = is({
5010
+ const r = ts({
5063
5011
  context: n,
5064
5012
  settings: i,
5065
5013
  viewport: s
5066
5014
  });
5067
5015
  return {
5068
- getNavigationForUrl: (g) => us({
5016
+ getNavigationForUrl: (g) => as({
5069
5017
  context: n,
5070
5018
  spineItemsManager: e,
5071
5019
  spineLocator: t,
@@ -5074,26 +5022,26 @@ const Pt = ({
5074
5022
  visibleAreaRectWidth: s.absoluteViewport.width,
5075
5023
  spine: o
5076
5024
  }),
5077
- getNavigationForSpineItemPage: (g) => os({
5025
+ getNavigationForSpineItemPage: (g) => ns({
5078
5026
  ...g,
5079
5027
  spineItemsManager: e,
5080
5028
  spineItemNavigationResolver: r,
5081
5029
  spineLocator: t,
5082
5030
  viewport: s
5083
5031
  }),
5084
- getNavigationFromSpineItemPosition: (g) => ls({
5032
+ getNavigationFromSpineItemPosition: (g) => cs({
5085
5033
  ...g,
5086
5034
  spineItemLocator: t.spineItemLocator,
5087
5035
  spineLocator: t,
5088
5036
  viewport: s
5089
5037
  }),
5090
5038
  getNavigationForCfi: (g) => {
5091
- const h = e.getSpineItemFromCfi(g), { node: m, offset: y = 0 } = Yt({
5039
+ const h = e.getSpineItemFromCfi(g), { node: m, offset: y = 0 } = Xt({
5092
5040
  cfi: g,
5093
5041
  spineItemsManager: e
5094
5042
  });
5095
5043
  if (!h) {
5096
- D.warn(ds, `unable to detect item id from cfi ${g}`);
5044
+ D.warn(us, `unable to detect item id from cfi ${g}`);
5097
5045
  return;
5098
5046
  }
5099
5047
  const f = m ? r.getNavigationFromNode(h, m, y) : new C({ x: 0, y: 0 }), I = t.getSpinePositionFromSpineItemPosition({
@@ -5136,7 +5084,7 @@ const Pt = ({
5136
5084
  viewport: s
5137
5085
  }),
5138
5086
  getMostPredominantNavigationForPosition: (g) => {
5139
- const h = i.values.computedPageTurnDirection, m = 0.5, y = h === "horizontal" ? g.x + s.absoluteViewport.width * m : 0, f = h === "horizontal" ? 0 : g.y + s.absoluteViewport.height * m, I = Pt({
5087
+ const h = i.values.computedPageTurnDirection, m = 0.5, y = h === "horizontal" ? g.x + s.absoluteViewport.width * m : 0, f = h === "horizontal" ? 0 : g.y + s.absoluteViewport.height * m, I = xt({
5140
5088
  position: new L({
5141
5089
  x: y,
5142
5090
  y: f
@@ -5154,7 +5102,7 @@ const Pt = ({
5154
5102
  viewport: s
5155
5103
  });
5156
5104
  },
5157
- fromUnboundSpinePosition: (g) => Pt({
5105
+ fromUnboundSpinePosition: (g) => xt({
5158
5106
  position: g,
5159
5107
  isRTL: n.isRTL(),
5160
5108
  pageSizeHeight: s.pageSize.height,
@@ -5162,7 +5110,7 @@ const Pt = ({
5162
5110
  spineItemsManager: e,
5163
5111
  spine: o
5164
5112
  }),
5165
- fromOutOfBoundsSpinePosition: (g) => Qt({
5113
+ fromOutOfBoundsSpinePosition: (g) => Kt({
5166
5114
  position: g,
5167
5115
  isRTL: n.isRTL(),
5168
5116
  spineItemsManager: e,
@@ -5178,7 +5126,7 @@ const Pt = ({
5178
5126
  }),
5179
5127
  spineItemNavigator: r
5180
5128
  };
5181
- }, gs = ({
5129
+ }, ds = ({
5182
5130
  spineItemsManager: n,
5183
5131
  context: e,
5184
5132
  hookManager: t,
@@ -5186,26 +5134,26 @@ const Pt = ({
5186
5134
  settings: o,
5187
5135
  viewport: s
5188
5136
  }) => {
5189
- const r = new R(), a = r.asObservable(), c = new Zt(), u = ps({
5137
+ const r = new R(), a = r.asObservable(), c = new Gt(), u = ls({
5190
5138
  context: e,
5191
5139
  settings: o,
5192
5140
  spineItemsManager: n,
5193
5141
  locator: i.locator,
5194
5142
  spine: i,
5195
5143
  viewport: s
5196
- }), l = new Uo(
5144
+ }), l = new jo(
5197
5145
  o,
5198
5146
  t,
5199
5147
  e,
5200
5148
  i,
5201
5149
  s
5202
- ), d = new Fo(
5150
+ ), d = new $o(
5203
5151
  s,
5204
5152
  o,
5205
5153
  t,
5206
5154
  i,
5207
5155
  e
5208
- ), p = new es(
5156
+ ), p = new Ko(
5209
5157
  o,
5210
5158
  e,
5211
5159
  a,
@@ -5214,7 +5162,7 @@ const Pt = ({
5214
5162
  u,
5215
5163
  i,
5216
5164
  c.isLocked$
5217
- ), g = N([
5165
+ ), g = O([
5218
5166
  l.isNavigating$,
5219
5167
  d.isNavigating$,
5220
5168
  c.isLocked$,
@@ -5248,7 +5196,7 @@ const Pt = ({
5248
5196
  navigation$: p.navigation$
5249
5197
  };
5250
5198
  };
5251
- class hs extends Q {
5199
+ class ps extends Q {
5252
5200
  constructor(e, t) {
5253
5201
  super({
5254
5202
  beginPageIndexInSpineItem: void 0,
@@ -5266,10 +5214,10 @@ class hs extends Q {
5266
5214
  this.mergeCompare(e);
5267
5215
  }
5268
5216
  }
5269
- class ms extends G {
5217
+ class gs extends G {
5270
5218
  constructor(e, t, i, o, s) {
5271
5219
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spine = o, this.spineItemLocator = s;
5272
- const r = x(
5220
+ const r = P(
5273
5221
  this.context.bridgeEvent.navigation$,
5274
5222
  o.layout$
5275
5223
  ).pipe(
@@ -5285,7 +5233,7 @@ class ms extends G {
5285
5233
  return this.context.bridgeEvent.navigationUnlocked$.pipe(
5286
5234
  Tt(1),
5287
5235
  z(this.context.bridgeEvent.navigation$),
5288
- P(([, u]) => {
5236
+ x(([, u]) => {
5289
5237
  const { position: l } = u, d = this.pagination.value, {
5290
5238
  beginIndex: p,
5291
5239
  endIndex: g
@@ -5317,7 +5265,7 @@ class ms extends G {
5317
5265
  })
5318
5266
  ), a = r.pipe(
5319
5267
  De(this.context.bridgeEvent.viewportFree$),
5320
- P(() => {
5268
+ x(() => {
5321
5269
  const {
5322
5270
  beginSpineItemIndex: c,
5323
5271
  endSpineItemIndex: u,
@@ -5341,14 +5289,14 @@ class ms extends G {
5341
5289
  });
5342
5290
  })
5343
5291
  );
5344
- x(r, a).pipe($(this.destroy$)).subscribe();
5292
+ P(r, a).pipe($(this.destroy$)).subscribe();
5345
5293
  }
5346
5294
  }
5347
- const fs = ({
5295
+ const hs = ({
5348
5296
  manifest: n,
5349
5297
  spreadMode: e
5350
5298
  }) => n?.renditionFlow === "scrolled-continuous" ? !1 : e;
5351
- class ys extends G {
5299
+ class ms extends G {
5352
5300
  constructor(e) {
5353
5301
  super();
5354
5302
  const t = {
@@ -5385,7 +5333,7 @@ class ys extends G {
5385
5333
  }
5386
5334
  watch(e) {
5387
5335
  return this.values$.pipe(
5388
- Nt(e),
5336
+ Ot(e),
5389
5337
  k(U)
5390
5338
  );
5391
5339
  }
@@ -5393,10 +5341,10 @@ class ys extends G {
5393
5341
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5394
5342
  }
5395
5343
  }
5396
- class Ss extends ys {
5344
+ class fs extends ms {
5397
5345
  constructor(e, t) {
5398
5346
  super(e), this.context = t, t.watch(["manifest", "hasVerticalWriting"]).pipe(
5399
- P(() => this.update(this.values)),
5347
+ x(() => this.update(this.values)),
5400
5348
  $(this.destroy$)
5401
5349
  ).subscribe();
5402
5350
  }
@@ -5406,7 +5354,7 @@ class Ss extends ys {
5406
5354
  computedPageTurnAnimation: e.pageTurnAnimation,
5407
5355
  computedPageTurnMode: e.pageTurnMode,
5408
5356
  computedPageTurnAnimationDuration: 0,
5409
- computedSpreadMode: fs({
5357
+ computedSpreadMode: hs({
5410
5358
  spreadMode: e.spreadMode,
5411
5359
  manifest: t
5412
5360
  })
@@ -5432,7 +5380,7 @@ class Ss extends ys {
5432
5380
  };
5433
5381
  }
5434
5382
  }
5435
- class Is extends Se {
5383
+ class ys extends Se {
5436
5384
  onUnload() {
5437
5385
  return _;
5438
5386
  }
@@ -5451,7 +5399,7 @@ class Is extends Se {
5451
5399
  getDocumentFrame() {
5452
5400
  }
5453
5401
  }
5454
- class bs extends G {
5402
+ class Ss extends G {
5455
5403
  constructor(e, t, i, o, s, r, a) {
5456
5404
  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 R(), this.lastLayout = null, this.applyDimsAfterLayout = ({
5457
5405
  blankPagePosition: c,
@@ -5481,7 +5429,7 @@ class bs extends G {
5481
5429
  }), { width: b, height: F };
5482
5430
  })
5483
5431
  ), this.layout = (c) => {
5484
- const u = Yn(this.layout$.pipe(V()));
5432
+ const u = Xn(this.layout$.pipe(V()));
5485
5433
  return this.layoutTriggerSubject.next(c), u();
5486
5434
  }, this.adjustPositionOfElement = ({
5487
5435
  right: c,
@@ -5503,7 +5451,7 @@ class bs extends G {
5503
5451
  minimumWidth: l,
5504
5452
  spreadPosition: d
5505
5453
  });
5506
- return x(
5454
+ return P(
5507
5455
  v({ type: "start" }),
5508
5456
  p.pipe(
5509
5457
  this.applyDimsAfterLayout(c),
@@ -5536,7 +5484,7 @@ class bs extends G {
5536
5484
  };
5537
5485
  }
5538
5486
  }
5539
- class en extends Q {
5487
+ class Qt extends Q {
5540
5488
  constructor(e, t, i, o, s, r, a) {
5541
5489
  super({
5542
5490
  isLoaded: !1,
@@ -5554,7 +5502,7 @@ class en extends Q {
5554
5502
  });
5555
5503
  }, this.destroy = () => {
5556
5504
  super.destroy(), this.containerElement.remove(), this.renderer.destroy();
5557
- }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = vs(
5505
+ }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = Is(
5558
5506
  t,
5559
5507
  e,
5560
5508
  s
@@ -5570,7 +5518,7 @@ class en extends Q {
5570
5518
  resourcesHandler: this.resourcesHandler,
5571
5519
  viewport: this.viewport
5572
5520
  };
5573
- this.renderer = c ? c(u) : new Is(u), this.layout = new bs(
5521
+ this.renderer = c ? c(u) : new ys(u), this.layout = new Ss(
5574
5522
  e,
5575
5523
  this.containerElement,
5576
5524
  i,
@@ -5580,7 +5528,7 @@ class en extends Q {
5580
5528
  this.viewport
5581
5529
  );
5582
5530
  const l = this.renderer.state$.pipe(
5583
- O(({ state: p, error: g }) => {
5531
+ N(({ state: p, error: g }) => {
5584
5532
  this.mergeCompare({
5585
5533
  isLoaded: p === "loaded",
5586
5534
  isError: p === "error",
@@ -5588,14 +5536,14 @@ class en extends Q {
5588
5536
  });
5589
5537
  })
5590
5538
  ), d = this.layout.layout$.pipe(
5591
- O(() => {
5539
+ N(() => {
5592
5540
  this.mergeCompare({
5593
5541
  iDirty: !1,
5594
5542
  isReady: this.renderer.state$.value.state === "loaded"
5595
5543
  });
5596
5544
  })
5597
5545
  );
5598
- this.needsLayout$ = x(this.unloaded$, this.loaded$), x(
5546
+ this.needsLayout$ = P(this.unloaded$, this.loaded$), P(
5599
5547
  /**
5600
5548
  * @important
5601
5549
  * The order is important here. We want to ensure the state value
@@ -5647,7 +5595,7 @@ class en extends Q {
5647
5595
  return this.renderer.renditionLayout;
5648
5596
  }
5649
5597
  get numberOfPages() {
5650
- return Jt({
5598
+ return Zt({
5651
5599
  isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
5652
5600
  itemHeight: this.layout.layoutInfo.height,
5653
5601
  itemWidth: this.layout.layoutInfo.width,
@@ -5658,22 +5606,24 @@ class en extends Q {
5658
5606
  });
5659
5607
  }
5660
5608
  }
5661
- const vs = (n, e, t) => {
5609
+ const Is = (n, e, t) => {
5662
5610
  const i = n.ownerDocument.createElement("div");
5663
5611
  return i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
5664
5612
  position: absolute;
5665
5613
  overflow: hidden;
5666
5614
  `, i.dataset.isReady = "false", t.execute("item.onBeforeContainerCreated", void 0, { element: i }), i;
5667
5615
  };
5668
- class ws extends G {
5616
+ class bs extends G {
5669
5617
  constructor(e, t, i, o, s) {
5670
- super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new Y([]);
5618
+ super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new Y(
5619
+ /* @__PURE__ */ new Map()
5620
+ );
5671
5621
  const r = this.forcedOpenSubject.pipe(
5672
- S((u) => [...new Set(u.flat())].sort()),
5673
- k(yn),
5622
+ S((u) => Array.from(u.keys()).sort((l, d) => l - d)),
5623
+ k(fn),
5674
5624
  J({ bufferSize: 1, refCount: !0 })
5675
5625
  );
5676
- x(
5626
+ P(
5677
5627
  this.context.bridgeEvent.navigation$,
5678
5628
  this.spineLayout.layout$,
5679
5629
  r,
@@ -5702,21 +5652,23 @@ class ws extends G {
5702
5652
  }
5703
5653
  forceOpen(e) {
5704
5654
  const t = e.map(
5705
- (i) => typeof i == "number" ? i : i.index
5706
- );
5707
- return this.forcedOpenSubject.next([...this.forcedOpenSubject.value, t]), () => {
5708
- this.isDestroyed || this.forcedOpenSubject.next(
5709
- this.forcedOpenSubject.value.filter(
5710
- (i) => i !== t
5711
- )
5712
- );
5655
+ (o) => typeof o == "number" ? o : o.index
5656
+ ), i = (o) => {
5657
+ const s = this.forcedOpenSubject.value;
5658
+ t.forEach((r) => {
5659
+ const a = s.get(r) || 0, c = o ? a + 1 : a - 1;
5660
+ c <= 0 ? s.delete(r) : s.set(r, c);
5661
+ }), this.forcedOpenSubject.next(s);
5662
+ };
5663
+ return i(!0), () => {
5664
+ this.isDestroyed || i(!1);
5713
5665
  };
5714
5666
  }
5715
5667
  destroy() {
5716
5668
  super.destroy(), this.forcedOpenSubject.complete();
5717
5669
  }
5718
5670
  }
5719
- const tn = (n, e, t) => {
5671
+ const en = (n, e, t) => {
5720
5672
  const i = (t.width - e.width) / 2, o = (t.height - e.height) / 2;
5721
5673
  return new ue({
5722
5674
  x: n.x - i,
@@ -5741,17 +5693,17 @@ class Ie extends DOMRect {
5741
5693
  return new Ie(i.x, i.y, i.width, i.height);
5742
5694
  }
5743
5695
  }
5744
- class xs {
5696
+ class vs {
5745
5697
  constructor({ width: e, height: t }) {
5746
5698
  this.__symbol = /* @__PURE__ */ Symbol("AbsoluteViewport"), this.width = e, this.height = t;
5747
5699
  }
5748
5700
  }
5749
- class Ps {
5701
+ class ws {
5750
5702
  constructor({ width: e, height: t }) {
5751
5703
  this.__symbol = /* @__PURE__ */ Symbol("RelativeViewport"), this.width = e, this.height = t;
5752
5704
  }
5753
5705
  }
5754
- const $s = ({
5706
+ const Ps = ({
5755
5707
  pageIndex: n,
5756
5708
  spineItemOrId: e,
5757
5709
  spineItemsManager: t
@@ -5773,7 +5725,7 @@ const $s = ({
5773
5725
  { currentAbsolutePage: 0, found: !1 }
5774
5726
  );
5775
5727
  return s;
5776
- }, Ts = ({
5728
+ }, xs = ({
5777
5729
  itemHeight: n,
5778
5730
  itemWidth: e,
5779
5731
  visibleWidthOfItem: t,
@@ -5782,7 +5734,7 @@ const $s = ({
5782
5734
  }) => {
5783
5735
  const s = t / e, r = i / n;
5784
5736
  return o.type === "percentage" ? s >= o.value && r >= o.value : t >= o.value && i >= o.value;
5785
- }, Fs = ({
5737
+ }, $s = ({
5786
5738
  visibleWidthOfItem: n,
5787
5739
  visibleHeightOfItem: e,
5788
5740
  threshold: t,
@@ -5790,7 +5742,7 @@ const $s = ({
5790
5742
  }) => {
5791
5743
  const o = n / i.width, s = e / i.height;
5792
5744
  return t.type === "percentage" ? s >= t.value && o >= t.value : e >= t.value && n >= t.value;
5793
- }, nn = ({
5745
+ }, tn = ({
5794
5746
  itemPosition: {
5795
5747
  bottom: n,
5796
5748
  left: e,
@@ -5814,14 +5766,14 @@ const $s = ({
5814
5766
  Math.min(n, p) - Math.max(i, d)
5815
5767
  );
5816
5768
  if (g <= 0 || h <= 0) return { visible: !1 };
5817
- const y = Fs({
5769
+ const y = $s({
5818
5770
  threshold: r,
5819
5771
  visibleHeightOfItem: h,
5820
5772
  visibleWidthOfItem: g,
5821
5773
  viewportPosition: a
5822
5774
  });
5823
5775
  return c ? { visible: y } : {
5824
- visible: Ts({
5776
+ visible: xs({
5825
5777
  itemHeight: s,
5826
5778
  itemWidth: o,
5827
5779
  threshold: r,
@@ -5845,7 +5797,7 @@ const $s = ({
5845
5797
  }) => new L({
5846
5798
  x: e + n.x,
5847
5799
  y: t + n.y
5848
- }), Ls = ({
5800
+ }), Ts = ({
5849
5801
  position: n,
5850
5802
  threshold: e,
5851
5803
  restrictToScreen: t,
@@ -5860,14 +5812,14 @@ const $s = ({
5860
5812
  spineLayout: o
5861
5813
  }) || i.get(0), c = i.items.reduce(
5862
5814
  (g, h) => {
5863
- const m = o.getSpineItemSpineLayoutInfo(h), y = s ? r.absoluteViewport : r.relativeViewport, f = tn(
5815
+ const m = o.getSpineItemSpineLayoutInfo(h), y = s ? r.absoluteViewport : r.relativeViewport, f = en(
5864
5816
  n,
5865
5817
  r.absoluteViewport,
5866
5818
  y
5867
5819
  ), I = Ie.from(
5868
5820
  f,
5869
5821
  y
5870
- ), { visible: b } = nn({
5822
+ ), { visible: b } = tn({
5871
5823
  itemPosition: m,
5872
5824
  threshold: e,
5873
5825
  viewportPosition: I,
@@ -5883,7 +5835,7 @@ const $s = ({
5883
5835
  beginIndex: d ?? 0,
5884
5836
  endIndex: p ?? 0
5885
5837
  };
5886
- }, Ms = ({
5838
+ }, Fs = ({
5887
5839
  spineItemsManager: n,
5888
5840
  context: e,
5889
5841
  spineItemLocator: t,
@@ -5950,20 +5902,20 @@ const $s = ({
5950
5902
  };
5951
5903
  }).reduce(
5952
5904
  (re, { absolutePosition: le, index: Re }) => {
5953
- const de = I ? b.absoluteViewport : b.relativeViewport, on = tn(
5905
+ const de = I ? b.absoluteViewport : b.relativeViewport, nn = en(
5954
5906
  h,
5955
5907
  b.absoluteViewport,
5956
5908
  de
5957
- ), sn = Ie.from(
5958
- on,
5909
+ ), on = Ie.from(
5910
+ nn,
5959
5911
  de
5960
- ), { visible: rn } = nn({
5961
- viewportPosition: sn,
5912
+ ), { visible: sn } = tn({
5913
+ viewportPosition: on,
5962
5914
  restrictToScreen: f,
5963
5915
  threshold: m,
5964
5916
  itemPosition: le
5965
5917
  });
5966
- return rn ? [...re, Re] : re;
5918
+ return sn ? [...re, Re] : re;
5967
5919
  },
5968
5920
  []
5969
5921
  ), H = E[0], B = E[E.length - 1] ?? H;
@@ -5987,7 +5939,7 @@ const $s = ({
5987
5939
  /**
5988
5940
  * @deprecated use Pages
5989
5941
  */
5990
- _getAbsolutePageIndexFromPageIndex: (h) => $s({
5942
+ _getAbsolutePageIndexFromPageIndex: (h) => Ps({
5991
5943
  ...h,
5992
5944
  spineItemsManager: n
5993
5945
  }),
@@ -6028,7 +5980,7 @@ const $s = ({
6028
5980
  }),
6029
5981
  getSpineItemFromIframe: c,
6030
5982
  getSpineItemPageIndexFromNode: u,
6031
- getVisibleSpineItemsFromPosition: (h) => Ls({
5983
+ getVisibleSpineItemsFromPosition: (h) => Ts({
6032
5984
  spineItemsManager: n,
6033
5985
  spineLayout: o,
6034
5986
  viewport: s,
@@ -6051,10 +6003,10 @@ const $s = ({
6051
6003
  });
6052
6004
  }
6053
6005
  };
6054
- }, Cs = D.namespace("spine"), Es = ({
6006
+ }, Ls = D.namespace("spine"), Ms = ({
6055
6007
  position: n,
6056
6008
  pageSize: e
6057
- }) => new vi({
6009
+ }) => new Ii({
6058
6010
  ...n,
6059
6011
  left: n.x,
6060
6012
  top: n.y,
@@ -6063,7 +6015,7 @@ const $s = ({
6063
6015
  bottom: n.y + e.height,
6064
6016
  right: n.x + e.width
6065
6017
  });
6066
- class Ds extends Q {
6018
+ class Cs extends Q {
6067
6019
  constructor(e, t, i, o, s, r) {
6068
6020
  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(
6069
6021
  (u) => u.itemIndex === a.index && u.pageIndex === c
@@ -6081,11 +6033,11 @@ class Ds extends Q {
6081
6033
  spineItemPosition: f
6082
6034
  });
6083
6035
  return {
6084
- absoluteLayout: Es({
6036
+ absoluteLayout: Ms({
6085
6037
  pageSize: a,
6086
6038
  position: I
6087
6039
  }),
6088
- layout: new bi({
6040
+ layout: new Si({
6089
6041
  left: f.x,
6090
6042
  right: f.x + a.width,
6091
6043
  top: f.y,
@@ -6105,14 +6057,14 @@ class Ds extends Q {
6105
6057
  },
6106
6058
  []
6107
6059
  );
6108
- return N(
6060
+ return O(
6109
6061
  c.map((l) => {
6110
6062
  const { spineItem: d, ...p } = l;
6111
6063
  return new se((g) => {
6112
6064
  const h = l.spineItem.renderer?.getDocumentFrame();
6113
6065
  let m;
6114
6066
  h && h?.contentWindow?.document && // very important because it is being used by next functions
6115
- h.contentWindow.document.body !== null && (m = Mn(
6067
+ h.contentWindow.document.body !== null && (m = Ln(
6116
6068
  h.contentWindow.document,
6117
6069
  l.layout
6118
6070
  )), g.next({ ...p, firstVisibleNode: m });
@@ -6120,19 +6072,19 @@ class Ds extends Q {
6120
6072
  })
6121
6073
  );
6122
6074
  }),
6123
- S((a) => (Cs.info("Pages layout", a), { pages: a })),
6075
+ S((a) => (Ls.info("Pages layout", a), { pages: a })),
6124
6076
  j()
6125
6077
  ), this.layout$.pipe($(this.destroy$)).subscribe(this.next.bind(this));
6126
6078
  }
6127
6079
  }
6128
- class Rs extends G {
6080
+ class Es extends G {
6129
6081
  constructor(e, t) {
6130
6082
  super(), this.spineItemsManager = e, this.spineLocator = t, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
6131
6083
  w((i) => {
6132
6084
  const o = i.map(
6133
6085
  (s) => s.isReady$.pipe(S((r) => ({ item: s, isReady: r })))
6134
6086
  );
6135
- return x(...o);
6087
+ return P(...o);
6136
6088
  }),
6137
6089
  j()
6138
6090
  ), this.itemResize$ = this.spineItemsManager.items$.pipe(
@@ -6142,13 +6094,13 @@ class Rs extends G {
6142
6094
  S((r) => ({ entries: r, item: s }))
6143
6095
  )
6144
6096
  );
6145
- return x(...o);
6097
+ return P(...o);
6146
6098
  }),
6147
6099
  j()
6148
6100
  );
6149
6101
  }
6150
6102
  }
6151
- const As = ({
6103
+ const Ds = ({
6152
6104
  horizontalOffset: n,
6153
6105
  verticalOffset: e,
6154
6106
  context: t,
@@ -6218,22 +6170,22 @@ const As = ({
6218
6170
  })
6219
6171
  );
6220
6172
  };
6221
- class Os extends G {
6173
+ class Rs extends G {
6222
6174
  constructor(e, t, i, o) {
6223
6175
  super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new R(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
6224
- P(() => {
6176
+ x(() => {
6225
6177
  this.spineItemsRelativeLayouts = [];
6226
6178
  }),
6227
6179
  w((r) => {
6228
6180
  const a = r.map(
6229
6181
  (u) => u.needsLayout$.pipe(
6230
- P(() => {
6182
+ x(() => {
6231
6183
  this.layout();
6232
6184
  })
6233
6185
  )
6234
6186
  ), c = r.map(
6235
6187
  (u) => u.loaded$.pipe(
6236
- P(() => {
6188
+ x(() => {
6237
6189
  u.isUsingVerticalWriting() ? this.context.update({
6238
6190
  hasVerticalWriting: !0
6239
6191
  }) : this.context.update({
@@ -6242,12 +6194,12 @@ class Os extends G {
6242
6194
  })
6243
6195
  )
6244
6196
  );
6245
- return x(...a, ...c);
6197
+ return P(...a, ...c);
6246
6198
  })
6247
6199
  ).pipe($(this.destroy$)).subscribe();
6248
6200
  const s = new Y(!1);
6249
6201
  this.layout$ = this.layoutSubject.pipe(
6250
- P(() => {
6202
+ x(() => {
6251
6203
  this.spineItemsManager.items.forEach((r) => {
6252
6204
  r.markDirty();
6253
6205
  });
@@ -6262,12 +6214,12 @@ class Os extends G {
6262
6214
  ),
6263
6215
  ze(() => {
6264
6216
  s.next(!0);
6265
- const r = this.context.manifest, a = Gt(r) ?? !1;
6217
+ const r = this.context.manifest, a = qt(r) ?? !1;
6266
6218
  return A(this.spineItemsManager.items).pipe(
6267
- gn(
6219
+ pn(
6268
6220
  (u, l, d) => u.pipe(
6269
6221
  st(
6270
- ({ horizontalOffset: p, verticalOffset: g }) => As({
6222
+ ({ horizontalOffset: p, verticalOffset: g }) => Ds({
6271
6223
  context: this.context,
6272
6224
  horizontalOffset: p,
6273
6225
  index: d,
@@ -6300,7 +6252,7 @@ class Os extends G {
6300
6252
  );
6301
6253
  }),
6302
6254
  j()
6303
- ), x(this.layout$).pipe($(this.destroy$)).subscribe();
6255
+ ), P(this.layout$).pipe($(this.destroy$)).subscribe();
6304
6256
  }
6305
6257
  layout() {
6306
6258
  this.layoutSubject.next(void 0);
@@ -6325,32 +6277,32 @@ class Os extends G {
6325
6277
  super.destroy(), this.layoutSubject.complete();
6326
6278
  }
6327
6279
  }
6328
- class Ns extends G {
6280
+ class As extends G {
6329
6281
  constructor(e, t, i, o, s, r, a) {
6330
6282
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spineItemLocator = o, this.settings = s, this.hookManager = r, this.viewport = a, this.elementSubject = new Y(
6331
6283
  void 0
6332
- ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Os(
6284
+ ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Rs(
6333
6285
  i,
6334
6286
  e,
6335
6287
  s,
6336
6288
  a
6337
- ), this.locator = Ms({
6289
+ ), this.locator = Fs({
6338
6290
  context: e,
6339
6291
  spineItemsManager: i,
6340
6292
  spineItemLocator: o,
6341
6293
  settings: s,
6342
6294
  spineLayout: this.spineLayout,
6343
6295
  viewport: a
6344
- }), this.spineItemsLoader = new ws(
6296
+ }), this.spineItemsLoader = new bs(
6345
6297
  this.context,
6346
6298
  i,
6347
6299
  this.locator,
6348
6300
  s,
6349
6301
  this.spineLayout
6350
- ), this.spineItemsObserver = new Rs(
6302
+ ), this.spineItemsObserver = new Es(
6351
6303
  i,
6352
6304
  this.locator
6353
- ), this.pages = new Ds(
6305
+ ), this.pages = new Cs(
6354
6306
  this.spineLayout,
6355
6307
  this.spineItemsManager,
6356
6308
  this.spineItemLocator,
@@ -6360,22 +6312,22 @@ class Ns extends G {
6360
6312
  );
6361
6313
  const c = e.watch("rootElement").pipe(
6362
6314
  ae(Z),
6363
- O((l) => {
6315
+ N((l) => {
6364
6316
  const d = l.ownerDocument.createElement("div");
6365
6317
  d.style.cssText = `
6366
6318
  height: 100%;
6367
6319
  position: relative;
6368
6320
  `, d.className = `${W}-spine`, this.elementSubject.next(d);
6369
6321
  })
6370
- ), u = N([
6322
+ ), u = O([
6371
6323
  this.context.manifest$,
6372
6324
  this.element$
6373
6325
  ]).pipe(
6374
- O(([l, d]) => {
6326
+ N(([l, d]) => {
6375
6327
  if (!d) return;
6376
6328
  this.spineItemsManager.destroyItems();
6377
6329
  const p = l.spineItems.map(
6378
- (g, h) => new en(
6330
+ (g, h) => new Qt(
6379
6331
  g,
6380
6332
  d,
6381
6333
  this.context,
@@ -6388,7 +6340,7 @@ class Ns extends G {
6388
6340
  this.spineItemsManager.addMany(p);
6389
6341
  })
6390
6342
  );
6391
- x(u, c).pipe(K(this.destroy$)).subscribe();
6343
+ P(u, c).pipe(K(this.destroy$)).subscribe();
6392
6344
  }
6393
6345
  get element() {
6394
6346
  return this.elementSubject.getValue();
@@ -6406,7 +6358,7 @@ class Ns extends G {
6406
6358
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
6407
6359
  }
6408
6360
  }
6409
- class Vs extends G {
6361
+ class Ns extends G {
6410
6362
  constructor(e, t) {
6411
6363
  super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new Y([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6412
6364
  }
@@ -6420,7 +6372,7 @@ class Vs extends G {
6420
6372
  return i > o ? "after" : i === o ? "same" : "before";
6421
6373
  }
6422
6374
  getSpineItemIndex(e) {
6423
- const t = e instanceof en ? e : this.get(e);
6375
+ const t = e instanceof Qt ? e : this.get(e);
6424
6376
  if (!t) return;
6425
6377
  const i = this.orderedSpineItemsSubject.value.indexOf(t);
6426
6378
  return i < 0 ? void 0 : i;
@@ -6449,10 +6401,10 @@ class Vs extends G {
6449
6401
  });
6450
6402
  }
6451
6403
  }
6452
- class js extends Q {
6404
+ class Os extends Q {
6453
6405
  constructor(e, t) {
6454
6406
  const i = document.createElement("div");
6455
- i.setAttribute(`data-${si}`, ""), super({
6407
+ i.setAttribute(`data-${oi}`, ""), super({
6456
6408
  element: i,
6457
6409
  pageSize: {
6458
6410
  width: 1,
@@ -6462,17 +6414,17 @@ class js extends Q {
6462
6414
  height: 1
6463
6415
  }), this.context = e, this.settingsManager = t;
6464
6416
  const o = this.settingsManager.watch(["computedSpreadMode"]).pipe(
6465
- P(() => {
6417
+ x(() => {
6466
6418
  this.mergeCompare({
6467
6419
  pageSize: this.calculatePageSize(this.value)
6468
6420
  });
6469
6421
  })
6470
6422
  ), s = this.context.watch("rootElement").pipe(
6471
- P(() => {
6423
+ x(() => {
6472
6424
  this.layout();
6473
6425
  })
6474
6426
  );
6475
- x(o, s).pipe($(this.destroy$)).subscribe();
6427
+ P(o, s).pipe($(this.destroy$)).subscribe();
6476
6428
  }
6477
6429
  calculatePageSize(e) {
6478
6430
  const { computedSpreadMode: t } = this.settingsManager.values;
@@ -6492,7 +6444,7 @@ class js extends Q {
6492
6444
  });
6493
6445
  }
6494
6446
  get absoluteViewport() {
6495
- return new xs({
6447
+ return new vs({
6496
6448
  width: this.value.width,
6497
6449
  height: this.value.height
6498
6450
  });
@@ -6520,18 +6472,18 @@ class js extends Q {
6520
6472
  */
6521
6473
  get relativeViewport() {
6522
6474
  const e = this.absoluteViewport, t = this.scaleFactor;
6523
- return new Ps({
6475
+ return new ws({
6524
6476
  width: e.width / t,
6525
6477
  height: e.height / t
6526
6478
  });
6527
6479
  }
6528
6480
  }
6529
- const $t = `${Ut}-core`, ks = (n) => {
6530
- const e = crypto.randomUUID(), t = new R(), i = new R(), o = new Oo(), s = new Ro(), r = new Ss(n, s), a = new Ao(s, r), c = new Vs(s, r), u = new js(s, r), l = Kt({
6481
+ const $t = `${Ut}-core`, Vs = (n) => {
6482
+ const e = crypto.randomUUID(), t = new R(), i = new R(), o = new Ro(), s = new Eo(), r = new fs(n, s), a = new Do(s, r), c = new Ns(s, r), u = new Os(s, r), l = Jt({
6531
6483
  context: s,
6532
6484
  settings: r,
6533
6485
  viewport: u
6534
- }), d = new hs(s, c), p = new Ns(
6486
+ }), d = new ps(s, c), p = new As(
6535
6487
  s,
6536
6488
  d,
6537
6489
  c,
@@ -6539,14 +6491,14 @@ const $t = `${Ut}-core`, ks = (n) => {
6539
6491
  r,
6540
6492
  o,
6541
6493
  u
6542
- ), g = gs({
6494
+ ), g = ds({
6543
6495
  context: s,
6544
6496
  spineItemsManager: c,
6545
6497
  hookManager: o,
6546
6498
  spine: p,
6547
6499
  settings: r,
6548
6500
  viewport: u
6549
- }), h = new ms(
6501
+ }), h = new gs(
6550
6502
  s,
6551
6503
  d,
6552
6504
  c,
@@ -6565,19 +6517,19 @@ const $t = `${Ut}-core`, ks = (n) => {
6565
6517
  return;
6566
6518
  }
6567
6519
  D.log("load", { options: T });
6568
- const B = Us(E, e);
6520
+ const B = js(E, e);
6569
6521
  s.update({
6570
6522
  manifest: H,
6571
6523
  rootElement: B
6572
6524
  }), m();
6573
- }, f = r.watch(["computedSpreadMode"]).pipe(Ct(1), O(m)), I = t.pipe(
6574
- O(() => {
6525
+ }, f = r.watch(["computedSpreadMode"]).pipe(Ct(1), N(m)), I = t.pipe(
6526
+ N(() => {
6575
6527
  const T = s.value.rootElement;
6576
6528
  T && (T.style.setProperty("overflow", "hidden"), u.layout(), p.layout());
6577
6529
  }),
6578
6530
  K(i)
6579
- ), b = x(I, f).subscribe();
6580
- Ce(document, $t, No);
6531
+ ), b = P(I, f).subscribe();
6532
+ Ce(document, $t, Ao);
6581
6533
  const F = () => {
6582
6534
  Ee(document, $t), b.unsubscribe(), c.destroy(), h.destroy(), r.destroy(), d.destroy(), s.destroy(), g.destroy(), p.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
6583
6535
  };
@@ -6587,13 +6539,13 @@ const $t = `${Ut}-core`, ks = (n) => {
6587
6539
  spine: p,
6588
6540
  hookManager: o,
6589
6541
  cfi: {
6590
- generateCfiFromRange: so,
6542
+ generateCfiFromRange: io,
6591
6543
  parseCfi: it,
6592
6544
  generateCfiForSpineItemPage: (T) => Be({
6593
6545
  ...T,
6594
6546
  spine: p
6595
6547
  }),
6596
- resolveCfi: (T) => Yt({ ...T, spineItemsManager: c })
6548
+ resolveCfi: (T) => Xt({ ...T, spineItemsManager: c })
6597
6549
  },
6598
6550
  navigation: g,
6599
6551
  spineItemsObserver: p.spineItemsObserver,
@@ -6628,30 +6580,30 @@ const $t = `${Ut}-core`, ks = (n) => {
6628
6580
  destroy$: i
6629
6581
  }
6630
6582
  };
6631
- }, Us = (n, e) => (n.style.cssText = `
6583
+ }, js = (n, e) => (n.style.cssText = `
6632
6584
  ${n.style.cssText}
6633
6585
  background-color: white;
6634
6586
  position: relative;
6635
- `, n.classList.add(`${W}-reader`), n.setAttribute(oi, e), n.setAttribute("data-prose-reader-container", e), n), er = (
6587
+ `, n.classList.add(`${W}-reader`), n.setAttribute(ii, e), n.setAttribute("data-prose-reader-container", e), n), Ks = (
6636
6588
  //__
6637
- Io(
6638
- Zn(
6639
- wo(
6640
- Gn(
6641
- zn(
6642
- ho(
6643
- vo(
6644
- Eo(
6645
- qi(
6646
- Ii(
6647
- Ni(
6648
- Wn(
6649
- Xn(
6650
- lo(
6651
- Ai(
6652
- bo(
6589
+ yo(
6590
+ Gn(
6591
+ bo(
6592
+ qn(
6593
+ Un(
6594
+ po(
6595
+ Io(
6596
+ Mo(
6597
+ Xi(
6598
+ yi(
6599
+ Ai(
6600
+ zn(
6601
+ Bn(
6602
+ co(
6603
+ Di(
6604
+ So(
6653
6605
  // __
6654
- ks
6606
+ Vs
6655
6607
  )
6656
6608
  )
6657
6609
  )
@@ -6668,82 +6620,82 @@ const $t = `${Ut}-core`, ks = (n) => {
6668
6620
  )
6669
6621
  )
6670
6622
  )
6671
- ), tr = (n) => (e) => n(e);
6623
+ ), Qs = (n) => (e) => n(e);
6672
6624
  export {
6673
- _t as AbstractSpinePosition,
6674
- Ro as Context,
6675
- Uo as ControlledNavigationController,
6625
+ Wt as AbstractSpinePosition,
6626
+ Eo as Context,
6627
+ jo as ControlledNavigationController,
6676
6628
  G as DestroyableClass,
6677
6629
  Se as DocumentRenderer,
6678
- Ao as Features,
6679
- oi as HTML_ATTRIBUTE_DATA_READER_ID,
6630
+ Do as Features,
6631
+ ii as HTML_ATTRIBUTE_DATA_READER_ID,
6680
6632
  W as HTML_PREFIX,
6681
- ri as HTML_PREFIX_SCROLL_NAVIGATOR,
6682
- si as HTML_PREFIX_VIEWPORT,
6633
+ si as HTML_PREFIX_SCROLL_NAVIGATOR,
6634
+ oi as HTML_PREFIX_VIEWPORT,
6683
6635
  Ut as HTML_STYLE_PREFIX,
6684
- Oo as HookManager,
6685
- ii as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6686
- es as InternalNavigator,
6636
+ Ro as HookManager,
6637
+ ni as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6638
+ Ko as InternalNavigator,
6687
6639
  nt as LayoutEntry,
6688
- Zt as Locker,
6689
- Js as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
6690
- Gs as PROSE_READER_NAMESPACE,
6691
- Ds as Pages,
6692
- hs as Pagination,
6693
- ms as PaginationController,
6640
+ Gt as Locker,
6641
+ Gs as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
6642
+ Ys as PROSE_READER_NAMESPACE,
6643
+ Cs as Pages,
6644
+ ps as Pagination,
6645
+ gs as PaginationController,
6694
6646
  Q as ReactiveEntity,
6695
6647
  tt as ResourceHandler,
6696
- uo as ResourcesLocator,
6697
- Fo as ScrollNavigationController,
6648
+ ao as ResourcesLocator,
6649
+ $o as ScrollNavigationController,
6698
6650
  ft as ScrollPosition,
6699
- ys as SettingsManager,
6700
- Ns as Spine,
6701
- en as SpineItem,
6702
- bi as SpineItemPageLayout,
6703
- vi as SpineItemPageSpineLayout,
6651
+ ms as SettingsManager,
6652
+ As as Spine,
6653
+ Qt as SpineItem,
6654
+ Si as SpineItemPageLayout,
6655
+ Ii as SpineItemPageSpineLayout,
6704
6656
  C as SpineItemPosition,
6705
6657
  He as SpineItemSpineLayout,
6706
- Vs as SpineItemsManager,
6707
- Rs as SpineItemsObserver,
6658
+ Ns as SpineItemsManager,
6659
+ Es as SpineItemsObserver,
6708
6660
  L as SpinePosition,
6709
- To as UnboundScrollPosition,
6710
- Oe as UnboundSpineItemPagePosition,
6661
+ xo as UnboundScrollPosition,
6662
+ Ne as UnboundSpineItemPagePosition,
6711
6663
  ue as UnboundSpinePosition,
6712
- Zs as VIEWPORT_ADJUSTMENT_THROTTLE,
6713
- js as Viewport,
6714
- co as consolidate,
6715
- er as createReader,
6664
+ qs as VIEWPORT_ADJUSTMENT_THROTTLE,
6665
+ Os as Viewport,
6666
+ ro as consolidate,
6667
+ Ks as createReader,
6716
6668
  ct as deferIdle,
6717
- Yn as deferNextResult,
6669
+ Xn as deferNextResult,
6718
6670
  Be as generateCfiForSpineItemPage,
6719
- so as generateCfiFromRange,
6671
+ io as generateCfiFromRange,
6720
6672
  me as generateRootCfi,
6721
6673
  at as getAttributeValueFromString,
6722
- Ys as getBase64FromBlob,
6674
+ Bs as getBase64FromBlob,
6723
6675
  Ke as getFrameViewportInfo,
6724
- Qs as getItemAnchor,
6725
- Ii as htmlEnhancer,
6676
+ Js as getItemAnchor,
6677
+ yi as htmlEnhancer,
6726
6678
  Vt as idle,
6727
- jn as injectCSSToFrame,
6679
+ Vn as injectCSSToFrame,
6728
6680
  Z as isDefined,
6729
- Ot as isHtmlElement,
6681
+ Nt as isHtmlElement,
6730
6682
  Nn as isHtmlTagElement,
6731
6683
  Xe as isRootCfi,
6732
- or as isShallowEqual,
6733
- Ai as layoutEnhancer,
6734
- Nt as mapKeysTo,
6735
- Xs as observeIntersection,
6684
+ nr as isShallowEqual,
6685
+ Di as layoutEnhancer,
6686
+ Ot as mapKeysTo,
6687
+ Hs as observeIntersection,
6736
6688
  ut as observeMutation,
6737
6689
  et as observeResize,
6738
- lo as paginationEnhancer,
6690
+ co as paginationEnhancer,
6739
6691
  it as parseCfi,
6740
- Bs as removeCSS,
6741
- Yt as resolveCfi,
6742
- tr as rootEnhancer,
6743
- Es as spinePositionToSpineItemSpineLayout,
6692
+ _s as removeCSS,
6693
+ Xt as resolveCfi,
6694
+ Qs as rootEnhancer,
6695
+ Ms as spinePositionToSpineItemSpineLayout,
6744
6696
  oe as upsertCSSToFrame,
6745
- kn as waitForFrameLoad,
6746
- Un as waitForFrameReady,
6697
+ jn as waitForFrameLoad,
6698
+ kn as waitForFrameReady,
6747
6699
  De as waitForSwitch,
6748
6700
  Qe as watchKeys
6749
6701
  };