@prose-reader/core 1.251.0 → 1.252.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,12 +1,12 @@
1
- import { switchMap as w, of as v, fromEvent as Y, take as Tt, map as S, from as O, takeUntil as T, Observable as ne, defer as ke, Subject as j, combineLatest as k, merge as x, EMPTY as Z, NEVER as ge, tap as P, share as D, BehaviorSubject as W, withLatestFrom as A, filter as L, first as U, mergeMap as Pe, endWith as me, finalize as de, catchError as Ft, lastValueFrom as an, scheduled as cn, animationFrameScheduler as re, exhaustMap as Ue, debounceTime as Se, distinctUntilChanged as z, throttleTime as un, startWith as ee, shareReplay as J, switchScan as ln, defaultIfEmpty as dn, forkJoin as pn, delay as ve, timer as $e, ReplaySubject as st, identity as we, skip as Lt, reduce as gn, concatMap as rt } from "rxjs";
2
- import { Report as hn, isShallowEqual as N, shallowMergeIfDefined as xe, getParentPath as mn, parseContentType as fn, detectMimeTypeFromName as Le, arrayEqual as yn } from "@prose-reader/shared";
3
- import { isShallowEqual as or } from "@prose-reader/shared";
4
- import { map as K, distinctUntilChanged as pe, switchMap as _, first as Mt, startWith as Sn, shareReplay as Me, tap as V, pairwise as In, take as bn, takeUntil as q, filter as se, debounceTime as vn, skip as Ct, mergeMap as wn, catchError as at } from "rxjs/operators";
5
- import { generate as ze, parse as Et, isIndirectionOnly as xn, isParsedCfiRange as Pn, resolve as $n } from "@prose-reader/cfi";
1
+ import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as N, takeUntil as T, Observable as ne, defer as ke, Subject as R, combineLatest as k, merge as P, EMPTY as Z, NEVER as ge, tap as x, share as E, BehaviorSubject as H, withLatestFrom as O, filter as L, first as U, mergeMap as $e, endWith as me, finalize as de, catchError as Ft, lastValueFrom as rn, scheduled as an, animationFrameScheduler as re, exhaustMap as Ue, debounceTime as Se, distinctUntilChanged as z, throttleTime as cn, startWith as ee, shareReplay as J, switchScan as un, defaultIfEmpty as ln, forkJoin as dn, delay as we, timer as Te, ReplaySubject as st, identity as Pe, skip as Lt, reduce as pn, concatMap as rt } from "rxjs";
2
+ import { Report as gn, isShallowEqual as V, shallowMergeIfDefined as xe, getParentPath as hn, parseContentType as mn, detectMimeTypeFromName as Me, arrayEqual as fn } from "@prose-reader/shared";
3
+ import { isShallowEqual as sr } from "@prose-reader/shared";
4
+ import { map as K, distinctUntilChanged as pe, switchMap as _, first as Mt, startWith as yn, shareReplay as Ce, tap as j, pairwise as Sn, take as In, takeUntil as G, filter as se, debounceTime as bn, skip as Ct, mergeMap as vn, catchError as at } from "rxjs/operators";
5
+ import { generate as ze, parse as Et, isIndirectionOnly as wn, isParsedCfiRange as Pn, resolve as xn } from "@prose-reader/cfi";
6
6
  import { isDefined as Ge } from "reactjrx";
7
- const Tn = "@prose-reader/core", E = hn.namespace(Tn, void 0, {
7
+ const $n = "@prose-reader/core", D = gn.namespace($n, void 0, {
8
8
  color: "#98cde7"
9
- }), Fn = [
9
+ }), Tn = [
10
10
  "pointercancel",
11
11
  "pointerdown",
12
12
  "pointerenter",
@@ -18,24 +18,24 @@ const Tn = "@prose-reader/core", E = hn.namespace(Tn, void 0, {
18
18
  // `touchstart` as const,
19
19
  // `touchend` as const,
20
20
  ];
21
- function Ln(n, e, t) {
21
+ function Fn(n, e, t) {
22
22
  if ("caretPositionFromPoint" in n)
23
23
  return n.caretPositionFromPoint(e, t);
24
24
  if ("caretRangeFromPoint" in n && // @ts-expect-error limited availability
25
25
  typeof n.caretRangeFromPoint < "u")
26
26
  return n.caretRangeFromPoint(e, t);
27
27
  }
28
- const Mn = (n, e) => {
28
+ const Ln = (n, e) => {
29
29
  const t = "body" in n ? We(n.body, e) : We(n, e), i = "createRange" in n ? n : n.ownerDocument;
30
30
  if (t) {
31
31
  let o, s = 0;
32
32
  const r = i.createRange();
33
33
  return Array.from(t.childNodes).some((a) => {
34
34
  r.selectNodeContents(a);
35
- const c = r.getClientRects(), u = Cn(c, e);
35
+ const c = r.getClientRects(), u = Mn(c, e);
36
36
  if (u) {
37
37
  o = r.cloneRange();
38
- const l = Ln(
38
+ const l = Fn(
39
39
  i,
40
40
  Math.ceil(u.left),
41
41
  Math.ceil(u.top)
@@ -65,20 +65,20 @@ const Mn = (n, e) => {
65
65
  function Dt(n, { left: e, right: t }) {
66
66
  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";
67
67
  }
68
- function Cn(n, e) {
68
+ function Mn(n, e) {
69
69
  return Array.from(n).find((t) => {
70
70
  const i = Dt(t, e);
71
71
  return i !== "before" && i !== "after";
72
72
  });
73
73
  }
74
- const En = (n, e) => {
74
+ const Cn = (n, e) => {
75
75
  if (n.nodeType !== Node.CDATA_SECTION_NODE && n.nodeType !== Node.DOCUMENT_TYPE_NODE) {
76
76
  const t = n.ownerDocument?.createRange();
77
77
  t?.selectNodeContents(n);
78
78
  try {
79
79
  e <= (t?.endOffset || 0) && t?.setStart(n, e || 0);
80
80
  } catch (i) {
81
- E.error(i);
81
+ D.error(i);
82
82
  }
83
83
  return t;
84
84
  }
@@ -93,8 +93,8 @@ const En = (n, e) => {
93
93
  if (e.PointerEvent && n instanceof e.PointerEvent)
94
94
  return !0;
95
95
  }
96
- return !!Fn.includes(n.type);
97
- }, Dn = (n) => {
96
+ return !!Tn.includes(n.type);
97
+ }, En = (n) => {
98
98
  if (Ze(n)) return !1;
99
99
  if (n?.target && n?.target?.ownerDocument?.defaultView) {
100
100
  const e = n?.target?.ownerDocument?.defaultView;
@@ -107,7 +107,7 @@ const En = (n, e) => {
107
107
  return n instanceof e.MouseEvent;
108
108
  }
109
109
  return !1;
110
- }, Rn = (n) => {
110
+ }, Dn = (n) => {
111
111
  if (n?.target && n?.target?.ownerDocument?.defaultView) {
112
112
  const e = n?.target?.ownerDocument?.defaultView;
113
113
  if (e.TouchEvent)
@@ -119,7 +119,7 @@ const En = (n, e) => {
119
119
  return n instanceof e.TouchEvent;
120
120
  }
121
121
  return !1;
122
- }, An = () => document.createElement("div"), Rt = (n) => {
122
+ }, Rn = () => document.createElement("div"), Rt = (n) => {
123
123
  const e = [
124
124
  "img",
125
125
  // Images
@@ -135,7 +135,7 @@ const En = (n, e) => {
135
135
  // JavaScript files
136
136
  ].join(",");
137
137
  return Array.from(n?.querySelectorAll(e) || []);
138
- }, On = (n) => {
138
+ }, An = (n) => {
139
139
  if (Rt(n).forEach((t) => {
140
140
  const i = t.getAttribute("src") || t.getAttribute("href");
141
141
  i?.startsWith("blob:") && n?.defaultView?.URL.revokeObjectURL(i);
@@ -170,10 +170,10 @@ function Ot(n) {
170
170
  // biome-ignore lint/suspicious/noExplicitAny: TODO
171
171
  ) && n.nodeType === Node.ELEMENT_NODE;
172
172
  }
173
- function Nn(n, e) {
173
+ function On(n, e) {
174
174
  return Ot(n) && n.tagName.toLowerCase() === e.toLowerCase();
175
175
  }
176
- function Vn(n) {
176
+ function Nn(n) {
177
177
  return At(
178
178
  n,
179
179
  [
@@ -198,9 +198,9 @@ const Je = (n, e, t, i) => {
198
198
  }, ct = (n, e) => {
199
199
  const t = new RegExp(`${e}\\s*=\\s*([0-9.]+)`, "i"), i = n.match(t) || [], o = i[1] || "0";
200
200
  return i && Number.parseFloat(o) || 0;
201
- }, jn = (n, e, t, i) => {
201
+ }, Vn = (n, e, t, i) => {
202
202
  n?.contentDocument?.head && Je(n.contentDocument, e, t, i);
203
- }, Bs = (n, e) => {
203
+ }, Xs = (n, e) => {
204
204
  n?.contentDocument && Ke(n.contentDocument, e);
205
205
  }, te = (n, e, t, i) => {
206
206
  if (!n) return;
@@ -211,7 +211,7 @@ const Je = (n, e, t, i) => {
211
211
  o.innerHTML = t;
212
212
  return;
213
213
  }
214
- jn(n, e, t, i);
214
+ Vn(n, e, t, i);
215
215
  }, Qe = (n) => {
216
216
  if (n?.contentDocument) {
217
217
  const t = n.contentDocument.querySelector("meta[name='viewport']");
@@ -228,17 +228,17 @@ const Je = (n, e, t, i) => {
228
228
  }
229
229
  }
230
230
  return { hasViewport: !1 };
231
- }, kn = (n) => n.pipe(
232
- w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : Y(e, "load").pipe(
231
+ }, jn = (n) => n.pipe(
232
+ w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : q(e, "load").pipe(
233
233
  Tt(1),
234
234
  S(() => e)
235
235
  ))
236
- ), Un = (n) => n.pipe(
236
+ ), kn = (n) => n.pipe(
237
237
  w((e) => {
238
238
  const t = e?.contentDocument?.fonts.ready;
239
- return t ? O(t).pipe(S(() => e)) : v(void 0);
239
+ return t ? N(t).pipe(S(() => e)) : v(void 0);
240
240
  })
241
- ), zn = (n) => (e) => {
241
+ ), Un = (n) => (e) => {
242
242
  const t = n(e), i = new IntersectionObserver((o) => {
243
243
  o.forEach((s) => {
244
244
  s.isIntersecting ? s.target.removeAttribute("tab-index") : s.target.setAttribute("tab-index", "-1");
@@ -273,7 +273,7 @@ const Je = (n, e, t, i) => {
273
273
  ), {
274
274
  ...t
275
275
  };
276
- }, Wn = (n) => (e) => {
276
+ }, zn = (n) => (e) => {
277
277
  const t = n(e);
278
278
  return t.context.watch("rootElement").pipe(T(t.context.destroy$)).subscribe((i) => {
279
279
  if (!i) return;
@@ -285,7 +285,7 @@ const Je = (n, e, t, i) => {
285
285
  const s = t.spineItemsManager.get(i)?.renderer.getDocumentFrame();
286
286
  s && s.contentDocument?.body.setAttribute("tabindex", "-1");
287
287
  }), t;
288
- }, De = ({
288
+ }, Re = ({
289
289
  position: n,
290
290
  frameElement: e
291
291
  }) => {
@@ -294,13 +294,13 @@ const Je = (n, e, t, i) => {
294
294
  clientX: a,
295
295
  clientY: c
296
296
  };
297
- }, _n = (n, e, t, i) => {
297
+ }, Wn = (n, e, t, i) => {
298
298
  const o = e?.view?.frameElement;
299
299
  if (!e || !o) return n;
300
300
  const s = t.getSpineItemFromIframe(o), r = o, { height: a, width: c } = i.pageSize;
301
301
  if (!s || !(r instanceof HTMLIFrameElement)) return n;
302
302
  if (Ze(n)) {
303
- const { clientX: u, clientY: l } = De({
303
+ const { clientX: u, clientY: l } = Re({
304
304
  position: n,
305
305
  frameElement: r
306
306
  }), d = new PointerEvent(n.type, {
@@ -314,8 +314,8 @@ const Je = (n, e, t, i) => {
314
314
  enumerable: !0
315
315
  }), d;
316
316
  }
317
- if (Dn(n)) {
318
- const { clientX: u, clientY: l } = De({
317
+ if (En(n)) {
318
+ const { clientX: u, clientY: l } = Re({
319
319
  position: n,
320
320
  frameElement: r
321
321
  }), d = new MouseEvent(n.type, {
@@ -328,9 +328,9 @@ const Je = (n, e, t, i) => {
328
328
  enumerable: !0
329
329
  }), d;
330
330
  }
331
- if (Rn(n)) {
331
+ if (Dn(n)) {
332
332
  const u = Array.from(n.touches).map((d) => {
333
- const { clientX: g, clientY: h } = De({
333
+ const { clientX: g, clientY: h } = Re({
334
334
  position: d,
335
335
  frameElement: r
336
336
  });
@@ -351,7 +351,7 @@ const Je = (n, e, t, i) => {
351
351
  }), l;
352
352
  }
353
353
  return n;
354
- }, Hn = [
354
+ }, _n = [
355
355
  "pointercancel",
356
356
  "pointerdown",
357
357
  "pointerenter",
@@ -360,21 +360,21 @@ const Je = (n, e, t, i) => {
360
360
  "pointerout",
361
361
  "pointerover",
362
362
  "pointerup"
363
- ], Bn = [
364
- ...Hn
363
+ ], Hn = [
364
+ ..._n
365
365
  /*, ...mouseEvents*/
366
- ], Xn = (n) => (e) => {
366
+ ], Bn = (n) => (e) => {
367
367
  const t = n(e);
368
368
  return t.hookManager.register(
369
369
  "item.onDocumentLoad",
370
370
  ({ destroy: i, itemId: o }) => {
371
371
  const s = t.spineItemsManager.get(o), r = s?.renderer.getDocumentFrame();
372
372
  if (!r || !s) return;
373
- const a = Bn.map((c) => {
373
+ const a = Hn.map((c) => {
374
374
  const u = (l) => {
375
375
  let d = l;
376
376
  if (Ze(l) && (d = new PointerEvent(l.type, l)), d !== l) {
377
- const g = _n(
377
+ const g = Wn(
378
378
  d,
379
379
  l,
380
380
  t.spine.locator,
@@ -400,7 +400,7 @@ const Je = (n, e, t, i) => {
400
400
  [i]: o
401
401
  } : t,
402
402
  {}
403
- )), et = (n) => (e) => e.pipe(Nt(n), pe(N));
403
+ )), et = (n) => (e) => e.pipe(Nt(n), pe(V));
404
404
  function tt(n) {
405
405
  return new ne((e) => {
406
406
  const t = new ResizeObserver((i) => {
@@ -411,14 +411,14 @@ function tt(n) {
411
411
  };
412
412
  });
413
413
  }
414
- const Ce = (n) => (e) => e.pipe(
414
+ const Ee = (n) => (e) => e.pipe(
415
415
  _(
416
416
  (t) => n.pipe(
417
417
  Mt(),
418
418
  K(() => t)
419
419
  )
420
420
  )
421
- ), Yn = (n) => {
421
+ ), Xn = (n) => {
422
422
  let e;
423
423
  const t = n.subscribe((i) => {
424
424
  e = { result: i };
@@ -448,7 +448,7 @@ const lt = (n, e) => new ne((t) => {
448
448
  });
449
449
  return i.observe(n, e), () => i.disconnect();
450
450
  });
451
- function Xs(n, e) {
451
+ function Ys(n, e) {
452
452
  return new ne((t) => {
453
453
  const i = new IntersectionObserver((o) => {
454
454
  t.next(o);
@@ -468,12 +468,12 @@ class jt {
468
468
  this.outputSettings = this.computeOutputSettings(i), this.inputSettings = xe(
469
469
  this.getDefaultSettings(),
470
470
  e
471
- ), this.outputSettingsUpdateSubject = new j(), this.values$ = k([
471
+ ), this.outputSettingsUpdateSubject = new R(), this.values$ = k([
472
472
  this.settingsManager.values$,
473
- this.outputSettingsUpdateSubject.pipe(Sn(this.outputSettings))
473
+ this.outputSettingsUpdateSubject.pipe(yn(this.outputSettings))
474
474
  ]).pipe(
475
475
  K(([o, s]) => ({ ...o, ...s })),
476
- Me(1)
476
+ Ce(1)
477
477
  ), this.values$.subscribe();
478
478
  }
479
479
  _prepareUpdate(e) {
@@ -499,14 +499,14 @@ class jt {
499
499
  watch(e) {
500
500
  return Array.isArray(e) ? this.values$.pipe(et(e)) : this.values$.pipe(
501
501
  K((t) => t[e]),
502
- pe(N)
502
+ pe(V)
503
503
  );
504
504
  }
505
505
  destroy() {
506
506
  this.outputSettingsUpdateSubject.complete();
507
507
  }
508
508
  }
509
- const Ys = (n) => {
509
+ const qs = (n) => {
510
510
  const e = new FileReader();
511
511
  return new Promise((t) => {
512
512
  e.addEventListener(
@@ -518,12 +518,12 @@ const Ys = (n) => {
518
518
  ), e.readAsDataURL(n);
519
519
  });
520
520
  };
521
- let qn = class extends jt {
521
+ let Yn = class extends jt {
522
522
  computeOutputSettings(e) {
523
523
  return e;
524
524
  }
525
525
  hasSettingsChanged(e) {
526
- return !N(this.outputSettings, e);
526
+ return !V(this.outputSettings, e);
527
527
  }
528
528
  getCleanedParentInputSettings(e) {
529
529
  const {
@@ -544,8 +544,8 @@ let qn = class extends jt {
544
544
  };
545
545
  }
546
546
  };
547
- const Gn = (n) => (e) => {
548
- const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new j(), a = n(e), c = new qn(
547
+ const qn = (n) => (e) => {
548
+ const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new R(), a = n(e), c = new Yn(
549
549
  {
550
550
  fontScale: t,
551
551
  lineHeight: i,
@@ -577,12 +577,12 @@ const Gn = (n) => (e) => {
577
577
  }
578
578
  });
579
579
  const d = (g) => g.pipe(
580
- In(),
580
+ Sn(),
581
581
  S(([h, p]) => p.fontScale !== h.fontScale || p.lineHeight !== h.lineHeight)
582
582
  );
583
583
  return c.values$.pipe(
584
584
  d,
585
- V(l),
585
+ j(l),
586
586
  T(a.$.destroy$)
587
587
  ).subscribe(), {
588
588
  ...a,
@@ -591,8 +591,8 @@ const Gn = (n) => (e) => {
591
591
  },
592
592
  settings: c
593
593
  };
594
- }, Zn = (n) => (e) => {
595
- const t = n(e), i = (o) => Y(o, "keyup").pipe(
594
+ }, Gn = (n) => (e) => {
595
+ const t = n(e), i = (o) => q(o, "keyup").pipe(
596
596
  S((s) => {
597
597
  const { pageTurnDirection: r, computedPageTurnMode: a } = t.settings.values;
598
598
  if (a === "scrollable")
@@ -614,7 +614,7 @@ const Gn = (n) => (e) => {
614
614
  );
615
615
  return i(document).pipe(T(t.$.destroy$)).subscribe(), t.spineItemsManager.items$.pipe(
616
616
  w(
617
- (o) => x(
617
+ (o) => P(
618
618
  ...o.map(
619
619
  (s) => s.watch("isLoaded").pipe(
620
620
  w(() => {
@@ -627,9 +627,9 @@ const Gn = (n) => (e) => {
627
627
  ),
628
628
  T(t.$.destroy$)
629
629
  ).subscribe(), t;
630
- }, Jn = (n) => n.spine.spineItemsManager.items$.pipe(
630
+ }, Zn = (n) => n.spine.spineItemsManager.items$.pipe(
631
631
  w(
632
- (e) => x(
632
+ (e) => P(
633
633
  ...e.map((t) => t.watch("isLoaded").pipe(
634
634
  w(() => {
635
635
  const i = t.renderer.getDocumentFrame();
@@ -637,64 +637,64 @@ const Gn = (n) => (e) => {
637
637
  const s = Array.from(
638
638
  i.contentDocument.querySelectorAll("a")
639
639
  ).map(
640
- (r) => Y(r, "click")
640
+ (r) => q(r, "click")
641
641
  );
642
- return x(...s);
642
+ return P(...s);
643
643
  })
644
644
  ))
645
645
  )
646
646
  ),
647
- P((e) => {
647
+ x((e) => {
648
648
  e.preventDefault();
649
649
  }),
650
- D()
650
+ E()
651
651
  );
652
- class B {
652
+ class X {
653
653
  constructor() {
654
- this.isDestroyed = !1, this.destroySubject = new j(), this.destroy$ = this.destroySubject.asObservable();
654
+ this.isDestroyed = !1, this.destroySubject = new R(), this.destroy$ = this.destroySubject.asObservable();
655
655
  }
656
656
  destroy() {
657
657
  this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
658
658
  }
659
659
  }
660
- const Fe = class Fe extends B {
660
+ const Le = class Le extends X {
661
661
  constructor(e) {
662
- super(), this.triggerSubject = new j(), this.stateSubject = new W("idle"), this.unload$ = this.triggerSubject.pipe(
663
- A(this.stateSubject),
662
+ super(), this.triggerSubject = new R(), this.stateSubject = new H("idle"), this.unload$ = this.triggerSubject.pipe(
663
+ O(this.stateSubject),
664
664
  L(
665
665
  ([o, s]) => o.type === "unload" && s !== "idle" && s !== "unloading"
666
666
  ),
667
667
  S(() => {
668
668
  }),
669
- D()
669
+ E()
670
670
  ), this.load$ = this.triggerSubject.pipe(
671
- A(this.stateSubject),
671
+ O(this.stateSubject),
672
672
  L(
673
673
  ([o, s]) => o.type === "load" && s !== "loaded" && s !== "loading"
674
674
  ),
675
675
  S(() => {
676
676
  }),
677
- D()
677
+ E()
678
678
  ), this.context = e.context, this.settings = e.settings, this.hookManager = e.hookManager, this.item = e.item, this.containerElement = e.containerElement, this.resourcesHandler = e.resourcesHandler, this.viewport = e.viewport;
679
679
  const t = this.triggerSubject.pipe(
680
- A(this.stateSubject),
680
+ O(this.stateSubject),
681
681
  L(
682
682
  ([o, s]) => o.type === "unload" && s !== "idle" && s !== "unloading"
683
683
  ),
684
684
  S(() => {
685
685
  }),
686
- D()
686
+ E()
687
687
  );
688
688
  this.loaded$ = this.load$.pipe(
689
689
  w(() => (this.stateSubject.next("loading"), this.onCreateDocument().pipe(U()).pipe(
690
- Pe((s) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
690
+ $e((s) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
691
691
  itemId: this.item.id,
692
692
  documentContainer: s
693
693
  }), this.onLoadDocument().pipe(
694
694
  me(null),
695
695
  U()
696
696
  ).pipe(
697
- Ce(this.context.bridgeEvent.viewportFree$),
697
+ Ee(this.context.bridgeEvent.viewportFree$),
698
698
  w(() => {
699
699
  const a = this.hookManager.execute("item.onDocumentLoad", this.item.id, {
700
700
  itemId: this.item.id,
@@ -710,26 +710,26 @@ const Fe = class Fe extends B {
710
710
  }),
711
711
  T(t)
712
712
  ))),
713
- D()
713
+ E()
714
714
  );
715
715
  const i = t.pipe(
716
716
  w(() => (this.stateSubject.next("unloading"), this.context.bridgeEvent.viewportFree$.pipe(
717
717
  U(),
718
- P(() => {
718
+ x(() => {
719
719
  this.hookManager.destroy("item.onDocumentLoad", this.item.id);
720
720
  }),
721
721
  w(() => this.onUnload().pipe(me(null), U())),
722
- P(() => {
722
+ x(() => {
723
723
  this.stateSubject.next("idle");
724
724
  }),
725
725
  T(this.load$)
726
726
  )))
727
727
  );
728
- x(this.unload$, i).pipe(T(this.destroy$)).subscribe();
728
+ P(this.unload$, i).pipe(T(this.destroy$)).subscribe();
729
729
  }
730
730
  setDocumentContainer(e) {
731
731
  this._documentContainer = e, this._documentContainer.classList.add(
732
- Fe.DOCUMENT_CONTAINER_CLASS_NAME
732
+ Le.DOCUMENT_CONTAINER_CLASS_NAME
733
733
  );
734
734
  }
735
735
  attach() {
@@ -751,7 +751,7 @@ const Fe = class Fe extends B {
751
751
  this.triggerSubject.next({ type: "unload" });
752
752
  }
753
753
  renderHeadless() {
754
- const e = new j();
754
+ const e = new R();
755
755
  return ke(() => this.onRenderHeadless({ release: e })).pipe(
756
756
  me(void 0),
757
757
  U(),
@@ -767,7 +767,7 @@ const Fe = class Fe extends B {
767
767
  de(() => {
768
768
  e.complete();
769
769
  }),
770
- Ft((t) => (E.error(t), v(void 0)))
770
+ Ft((t) => (D.error(t), v(void 0)))
771
771
  );
772
772
  }
773
773
  layout(e) {
@@ -794,17 +794,17 @@ const Fe = class Fe extends B {
794
794
  return this.context.manifest?.renditionLayout ?? "reflowable";
795
795
  }
796
796
  };
797
- Fe.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
798
- let fe = Fe;
799
- const Kn = (n) => new URL(n.href);
797
+ Le.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
798
+ let fe = Le;
799
+ const Jn = (n) => new URL(n.href);
800
800
  class nt {
801
801
  constructor(e, t) {
802
802
  this.item = e, this.settings = t;
803
803
  }
804
804
  async getResource() {
805
- return await an(
805
+ return await rn(
806
806
  this.settings.values.getResource?.(this.item) ?? v(void 0)
807
- ) ?? Kn(this.item);
807
+ ) ?? Jn(this.item);
808
808
  }
809
809
  async fetchResource() {
810
810
  const e = await this.getResource();
@@ -814,7 +814,7 @@ class nt {
814
814
  const kt = (n, e) => {
815
815
  const t = n.startsWith("file://"), i = t ? n.replace("file://", "http://") : n, o = new URL(e, i).toString();
816
816
  return t ? o.replace("http://", "file://") : o;
817
- }, Qn = async (n, e, t, i, o) => {
817
+ }, Kn = async (n, e, t, i, o) => {
818
818
  if (!n || !n.defaultView) return;
819
819
  const s = e.sheet;
820
820
  if (s)
@@ -862,7 +862,7 @@ const kt = (n, e) => {
862
862
  } catch (r) {
863
863
  console.error("Could not access stylesheet rules:", r);
864
864
  }
865
- }, ei = (n, e, t, i, o) => {
865
+ }, Qn = (n, e, t, i, o) => {
866
866
  const s = e.getAttribute("src") || e.getAttribute("href");
867
867
  if (!s) return v(null);
868
868
  const r = i.manifest?.items.find(({ href: c }) => `${kt(t, s).toLowerCase()}`.endsWith(
@@ -870,11 +870,11 @@ const kt = (n, e) => {
870
870
  ));
871
871
  if (!r) return v(null);
872
872
  const a = new nt(r, o);
873
- return O(a.getResource()).pipe(
874
- Pe(
875
- (c) => c instanceof Response ? O(c.blob()) : v(void 0)
873
+ return N(a.getResource()).pipe(
874
+ $e(
875
+ (c) => c instanceof Response ? N(c.blob()) : v(void 0)
876
876
  ),
877
- Pe((c) => {
877
+ $e((c) => {
878
878
  if (!c)
879
879
  return v(null);
880
880
  const u = n?.defaultView?.URL.createObjectURL(c) ?? "";
@@ -884,7 +884,7 @@ const kt = (n, e) => {
884
884
  return new ne((l) => {
885
885
  e.onload = async () => {
886
886
  try {
887
- e.sheet && await Qn(
887
+ e.sheet && await Kn(
888
888
  n,
889
889
  e,
890
890
  t,
@@ -899,7 +899,7 @@ const kt = (n, e) => {
899
899
  return v(null);
900
900
  })
901
901
  );
902
- }, ti = ({
902
+ }, ei = ({
903
903
  settings: n,
904
904
  item: e,
905
905
  context: t
@@ -907,8 +907,8 @@ const kt = (n, e) => {
907
907
  w((o) => {
908
908
  const s = Rt(
909
909
  o.contentDocument
910
- ), r = mn(e.href), a = s.map(
911
- (c) => ei(
910
+ ), r = hn(e.href), a = s.map(
911
+ (c) => Qn(
912
912
  o.contentDocument,
913
913
  c,
914
914
  r,
@@ -918,11 +918,11 @@ const kt = (n, e) => {
918
918
  );
919
919
  return k(a).pipe(S(() => o));
920
920
  })
921
- ), ni = (n) => {
922
- On(n?.contentDocument);
923
- }, Gs = "@prose-reader/core", Zs = 0, Js = 200, ii = [".xhtml", ".html", ".htm"], G = "prose-reader", Ut = `${G}-style`, oi = `data-${G}-id`, si = `${G}-viewport`, ri = `${G}-scroll-navigator`, ai = async (n, e) => {
921
+ ), ti = (n) => {
922
+ An(n?.contentDocument);
923
+ }, Zs = "@prose-reader/core", Js = 0, Ks = 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) => {
924
924
  if (typeof n == "string") return n;
925
- const t = fn(n.headers.get("Content-Type") || "") || Le(e.href);
925
+ const t = mn(n.headers.get("Content-Type") || "") || Me(e.href);
926
926
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
927
927
  (o) => o === t
928
928
  )) {
@@ -958,13 +958,13 @@ const kt = (n, e) => {
958
958
  </body>
959
959
  </html>
960
960
  ` : await n.text();
961
- }, ci = ({
961
+ }, ai = ({
962
962
  item: n,
963
963
  resourcesHandler: e
964
964
  }) => {
965
- const t = (i) => ai(i, n);
965
+ const t = (i) => ri(i, n);
966
966
  return (i) => i.pipe(
967
- w((o) => O(e.getResource()).pipe(
967
+ w((o) => N(e.getResource()).pipe(
968
968
  w((s) => s instanceof URL && n.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
969
969
  (n.mediaType && [
970
970
  "application/xhtml+xml",
@@ -972,29 +972,29 @@ const kt = (n, e) => {
972
972
  "text/html",
973
973
  "text/xml"
974
974
  ].includes(n.mediaType) || // no encoding ? then try to detect html
975
- !n.mediaType && ii.some(
975
+ !n.mediaType && ni.some(
976
976
  (a) => n.href.endsWith(a)
977
- )) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ? O(e.fetchResource()) : v(s)).pipe(
977
+ )) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ? N(e.fetchResource()) : v(s)).pipe(
978
978
  w((a) => {
979
979
  if (!(a instanceof Response))
980
980
  throw new Error("Invalid resource");
981
- return O(t(a));
981
+ return N(t(a));
982
982
  }),
983
- P((a) => {
983
+ x((a) => {
984
984
  if (a) {
985
985
  const c = new Blob([a], { type: "text/html" }), u = URL.createObjectURL(c);
986
986
  o?.setAttribute("src", u);
987
987
  }
988
988
  }),
989
989
  S(() => o),
990
- Ft((a) => (E.error(
990
+ Ft((a) => (D.error(
991
991
  `Error while trying to fetch or load resource for item ${n.id}`,
992
992
  s
993
- ), E.error(a), v(o)))
993
+ ), D.error(a), v(o)))
994
994
  ))
995
995
  ))
996
996
  );
997
- }, ui = () => {
997
+ }, ci = () => {
998
998
  const n = document.createElement("iframe");
999
999
  return n.frameBorder = "no", n.tabIndex = 0, n.setAttribute(
1000
1000
  "sandbox",
@@ -1027,7 +1027,7 @@ const kt = (n, e) => {
1027
1027
  n / (i.height ?? 1)
1028
1028
  ), computedWidthScale: o, viewportDimensions: i };
1029
1029
  }
1030
- }, li = ({
1030
+ }, ui = ({
1031
1031
  columnWidth: n,
1032
1032
  enableTouch: e,
1033
1033
  spreadPosition: t
@@ -1072,12 +1072,12 @@ const kt = (n, e) => {
1072
1072
  object-fit:contain;
1073
1073
  `}
1074
1074
  }
1075
- `, di = ({
1075
+ `, li = ({
1076
1076
  pageHeight: n,
1077
1077
  pageWidth: e
1078
1078
  }) => ({ columnHeight: n, columnWidth: e }), dt = (n, e) => {
1079
1079
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1080
- }, pi = ({
1080
+ }, di = ({
1081
1081
  minPageSpread: n,
1082
1082
  blankPagePosition: e,
1083
1083
  spreadPosition: t,
@@ -1089,9 +1089,9 @@ const kt = (n, e) => {
1089
1089
  }) => {
1090
1090
  const c = n * o;
1091
1091
  if (s?.contentDocument && s?.contentWindow) {
1092
- const { viewportDimensions: u, computedScale: l = 1 } = Wt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, d = o, g = i, h = li(
1092
+ const { viewportDimensions: u, computedScale: l = 1 } = Wt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, d = o, g = i, h = ui(
1093
1093
  {
1094
- ...di({ pageHeight: i, pageWidth: o }),
1094
+ ...li({ pageHeight: i, pageWidth: o }),
1095
1095
  enableTouch: a,
1096
1096
  spreadPosition: t
1097
1097
  },
@@ -1121,7 +1121,7 @@ const kt = (n, e) => {
1121
1121
  return { width: c, height: g };
1122
1122
  }
1123
1123
  return { width: c, height: i };
1124
- }, gi = () => `
1124
+ }, pi = () => `
1125
1125
  ${zt()}
1126
1126
  html {
1127
1127
  width: 100%;
@@ -1136,7 +1136,7 @@ const kt = (n, e) => {
1136
1136
  html, body {
1137
1137
  touch-action: none;
1138
1138
  }
1139
- `, hi = ({
1139
+ `, gi = ({
1140
1140
  isScrollable: n,
1141
1141
  enableTouch: e
1142
1142
  }) => `
@@ -1161,7 +1161,7 @@ const kt = (n, e) => {
1161
1161
  display: block;
1162
1162
  }
1163
1163
  ` : ""}
1164
- `, mi = ({
1164
+ `, hi = ({
1165
1165
  width: n,
1166
1166
  columnHeight: e,
1167
1167
  columnWidth: t
@@ -1229,7 +1229,7 @@ const kt = (n, e) => {
1229
1229
  td {
1230
1230
  max-width: ${t}px;
1231
1231
  }
1232
- `, fi = ({
1232
+ `, mi = ({
1233
1233
  isUsingVerticalWriting: n,
1234
1234
  minimumWidth: e,
1235
1235
  pageHeight: t,
@@ -1245,7 +1245,7 @@ const kt = (n, e) => {
1245
1245
  };
1246
1246
  }, be = (n, e) => {
1247
1247
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1248
- }, yi = ({
1248
+ }, fi = ({
1249
1249
  pageHeight: n,
1250
1250
  pageWidth: e,
1251
1251
  frameElement: t,
@@ -1270,7 +1270,7 @@ const kt = (n, e) => {
1270
1270
  te(
1271
1271
  t,
1272
1272
  "prose-reader-html-renderer-framce-css",
1273
- gi()
1273
+ pi()
1274
1274
  ), be(t, {
1275
1275
  width: h.width ?? 1,
1276
1276
  height: h.height ?? 1
@@ -1282,11 +1282,11 @@ const kt = (n, e) => {
1282
1282
  `translate(-50%, -50%) scale(${p})`
1283
1283
  ), t?.style.setProperty("transform-origin", "center center");
1284
1284
  else {
1285
- const b = a ? hi({
1285
+ const b = a ? gi({
1286
1286
  isScrollable: i?.renditionFlow === "scrolled-continuous",
1287
1287
  enableTouch: c
1288
- }) : mi(
1289
- fi({
1288
+ }) : hi(
1289
+ mi({
1290
1290
  isUsingVerticalWriting: u,
1291
1291
  minimumWidth: l,
1292
1292
  pageHeight: g,
@@ -1318,38 +1318,38 @@ const kt = (n, e) => {
1318
1318
  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 };
1319
1319
  }
1320
1320
  };
1321
- class Si extends fe {
1321
+ class yi extends fe {
1322
1322
  constructor() {
1323
- super(...arguments), this.isImageType = () => !!(this.item.mediaType ?? Le(this.item.href))?.startsWith("image/");
1323
+ super(...arguments), this.isImageType = () => !!(this.item.mediaType ?? Me(this.item.href))?.startsWith("image/");
1324
1324
  }
1325
1325
  onCreateDocument() {
1326
- const e = ui();
1326
+ const e = ci();
1327
1327
  return this.setDocumentContainer(e), v(e);
1328
1328
  }
1329
1329
  onLoadDocument() {
1330
1330
  const e = this.getFrameElement();
1331
1331
  if (!e) throw new Error("invalid frame");
1332
1332
  return v(e).pipe(
1333
- ci({
1333
+ ai({
1334
1334
  item: this.item,
1335
1335
  resourcesHandler: this.resourcesHandler,
1336
1336
  settings: this.settings
1337
1337
  }),
1338
- Ce(this.context.bridgeEvent.viewportFree$),
1339
- P(() => {
1338
+ Ee(this.context.bridgeEvent.viewportFree$),
1339
+ x(() => {
1340
1340
  this.attach();
1341
1341
  }),
1342
- kn,
1343
- ti({
1342
+ jn,
1343
+ ei({
1344
1344
  context: this.context,
1345
1345
  item: this.item,
1346
1346
  settings: this.settings
1347
1347
  }),
1348
- Un
1348
+ kn
1349
1349
  );
1350
1350
  }
1351
1351
  onUnload() {
1352
- return ni(this.getFrameElement()), this.detach(), Z;
1352
+ return ti(this.getFrameElement()), this.detach(), Z;
1353
1353
  }
1354
1354
  onLayout({
1355
1355
  minPageSpread: e,
@@ -1360,7 +1360,7 @@ class Si extends fe {
1360
1360
  if (!r) return v(void 0);
1361
1361
  const a = !!this.writingMode?.startsWith("vertical");
1362
1362
  if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated") {
1363
- const u = pi({
1363
+ const u = di({
1364
1364
  blankPagePosition: t,
1365
1365
  enableTouch: this.settings.values.computedPageTurnMode !== "scrollable",
1366
1366
  frameElement: r,
@@ -1372,7 +1372,7 @@ class Si extends fe {
1372
1372
  });
1373
1373
  return v(u);
1374
1374
  }
1375
- const c = yi({
1375
+ const c = fi({
1376
1376
  pageHeight: s,
1377
1377
  pageWidth: o,
1378
1378
  frameElement: r,
@@ -1387,7 +1387,7 @@ class Si extends fe {
1387
1387
  return v(c);
1388
1388
  }
1389
1389
  onRenderHeadless() {
1390
- return O(this.resourcesHandler.fetchResource()).pipe(
1390
+ return N(this.resourcesHandler.fetchResource()).pipe(
1391
1391
  w((e) => {
1392
1392
  if (e instanceof Response) {
1393
1393
  const t = e.headers.get("content-type") ?? "";
@@ -1397,7 +1397,7 @@ class Si extends fe {
1397
1397
  "text/html",
1398
1398
  "text/xml"
1399
1399
  ].includes(t))
1400
- return O(e.text()).pipe(
1400
+ return N(e.text()).pipe(
1401
1401
  S((o) => new DOMParser().parseFromString(
1402
1402
  o,
1403
1403
  t
@@ -1440,13 +1440,13 @@ class Si extends fe {
1440
1440
  return this.getFrameElement();
1441
1441
  }
1442
1442
  }
1443
- const Ii = (n) => (e) => {
1443
+ const Si = (n) => (e) => {
1444
1444
  const t = n({
1445
1445
  ...e,
1446
1446
  getRenderer(o) {
1447
- return e.getRenderer?.(o) ?? ((r) => new Si(r));
1447
+ return e.getRenderer?.(o) ?? ((r) => new yi(r));
1448
1448
  }
1449
- }), i = Jn(t);
1449
+ }), i = Zn(t);
1450
1450
  return i.pipe(T(t.$.destroy$)).subscribe(), {
1451
1451
  ...t,
1452
1452
  links$: i
@@ -1465,12 +1465,12 @@ class C {
1465
1465
  this.__symbol = Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
1466
1466
  }
1467
1467
  }
1468
- class Re {
1468
+ class Ae {
1469
1469
  constructor(e) {
1470
1470
  this.__symbol = Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
1471
1471
  }
1472
1472
  }
1473
- class bi extends it {
1473
+ class Ii extends it {
1474
1474
  constructor() {
1475
1475
  super(...arguments), this.__symbol = "SpineItemPageLayout";
1476
1476
  }
@@ -1480,7 +1480,7 @@ class _e extends it {
1480
1480
  super(...arguments), this.__symbol = "SpineItemSpineLayout";
1481
1481
  }
1482
1482
  }
1483
- class vi extends it {
1483
+ class bi extends it {
1484
1484
  constructor() {
1485
1485
  super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
1486
1486
  }
@@ -1506,17 +1506,17 @@ class ae extends _t {
1506
1506
  return new ae(e);
1507
1507
  }
1508
1508
  }
1509
- const wi = (n, e) => {
1509
+ const vi = (n, e) => {
1510
1510
  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;
1511
1511
  return {
1512
1512
  x: u / a,
1513
1513
  y: l / c
1514
1514
  };
1515
- }, xi = (n, e) => new ae(
1516
- wi(n, e)
1515
+ }, wi = (n, e) => new ae(
1516
+ vi(n, e)
1517
1517
  ), Pi = (n) => ({
1518
- getSpinePositionFromClientPosition: (e) => n.spine.element ? xi(e, n.spine.element) : void 0
1519
- }), $i = (n) => {
1518
+ getSpinePositionFromClientPosition: (e) => n.spine.element ? wi(e, n.spine.element) : void 0
1519
+ }), xi = (n) => {
1520
1520
  let e;
1521
1521
  const t = n.context.watch("rootElement").pipe(
1522
1522
  _((c) => c ? new ne(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
@@ -1529,22 +1529,22 @@ const wi = (n, e) => {
1529
1529
  `, c.appendChild(e), () => {
1530
1530
  e?.remove(), e = void 0;
1531
1531
  })) : ge)
1532
- ), i = (c) => cn(c, re).pipe(
1533
- V(() => {
1532
+ ), i = (c) => an(c, re).pipe(
1533
+ j(() => {
1534
1534
  e?.style.setProperty(
1535
1535
  "visibility",
1536
1536
  "hidden"
1537
1537
  );
1538
1538
  })
1539
1539
  ), o = n.context.bridgeEvent.viewportBusy$.pipe(
1540
- V(() => {
1540
+ j(() => {
1541
1541
  e?.style.setProperty(
1542
1542
  "visibility",
1543
1543
  "visible"
1544
1544
  );
1545
1545
  })
1546
1546
  ), s = i(n.viewportFree$).pipe(
1547
- bn(1)
1547
+ In(1)
1548
1548
  ), a = n.settings.values$.pipe(
1549
1549
  K(() => n.settings.values.computedPageTurnMode),
1550
1550
  pe()
@@ -1552,14 +1552,14 @@ const wi = (n, e) => {
1552
1552
  _(
1553
1553
  (c) => c === "controlled" ? o.pipe(_(() => s)) : i(v(void 0))
1554
1554
  ),
1555
- q(n.$.destroy$)
1555
+ G(n.$.destroy$)
1556
1556
  );
1557
- return x(t, a);
1558
- }, Ti = (n) => {
1557
+ return P(t, a);
1558
+ }, $i = (n) => {
1559
1559
  n.hookManager.register("item.onDocumentLoad", ({ itemId: e }) => {
1560
1560
  n.spineItemsManager.get(e)?.renderer.getDocumentFrame()?.setAttribute("scrolling", "no");
1561
1561
  });
1562
- }, Fi = (n) => {
1562
+ }, Ti = (n) => {
1563
1563
  n.hookManager.register(
1564
1564
  "item.onAfterLayout",
1565
1565
  ({ item: e, blankPagePosition: t, minimumWidth: i }) => {
@@ -1576,12 +1576,12 @@ const wi = (n, e) => {
1576
1576
  }
1577
1577
  }
1578
1578
  );
1579
- }, Li = (n) => n.spineItemsManager.items$.pipe(
1579
+ }, Fi = (n) => n.spineItemsManager.items$.pipe(
1580
1580
  w(
1581
- (e) => x(
1581
+ (e) => P(
1582
1582
  ...e.map(
1583
1583
  (t) => t.pipe(
1584
- P((i) => {
1584
+ x((i) => {
1585
1585
  t.containerElement.dataset.isDirty = i.iDirty.toString(), t.containerElement.dataset.isReady = i.isReady.toString();
1586
1586
  })
1587
1587
  )
@@ -1589,12 +1589,12 @@ const wi = (n, e) => {
1589
1589
  )
1590
1590
  )
1591
1591
  );
1592
- let Mi = class extends jt {
1592
+ let Li = class extends jt {
1593
1593
  computeOutputSettings(e) {
1594
1594
  return e;
1595
1595
  }
1596
1596
  hasSettingsChanged(e) {
1597
- return !N(this.outputSettings, e);
1597
+ return !V(this.outputSettings, e);
1598
1598
  }
1599
1599
  getCleanedParentInputSettings(e) {
1600
1600
  const {
@@ -1615,21 +1615,21 @@ let Mi = class extends jt {
1615
1615
  };
1616
1616
  }
1617
1617
  };
1618
- const Ci = (n) => k([
1618
+ const Mi = (n) => k([
1619
1619
  n.viewport.watch(["width", "height"]),
1620
1620
  n.context.watch("manifest")
1621
1621
  ]).pipe(
1622
- P(([{ width: e, height: t }, i]) => {
1622
+ x(([{ width: e, height: t }, i]) => {
1623
1623
  const o = e > t;
1624
1624
  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 });
1625
1625
  })
1626
- ), Ei = (n) => (e) => {
1626
+ ), Ci = (n) => (e) => {
1627
1627
  const {
1628
1628
  pageHorizontalMargin: t,
1629
1629
  pageVerticalMargin: i,
1630
1630
  layoutAutoResize: o,
1631
1631
  layoutLayerTransition: s
1632
- } = e, r = n(e), a = new Mi(
1632
+ } = e, r = n(e), a = new Li(
1633
1633
  {
1634
1634
  pageHorizontalMargin: t,
1635
1635
  pageVerticalMargin: i,
@@ -1645,27 +1645,27 @@ const Ci = (n) => k([
1645
1645
  !p && y && (y.getBoundingClientRect().left, p = !0);
1646
1646
  });
1647
1647
  }), r.hookManager.register("item.onBeforeLayout", ({ item: p }) => {
1648
- const m = r.spineItemsManager.get(p.id), f = !!(p.mediaType ?? Le(p.href))?.startsWith("image/"), { pageHorizontalMargin: I = 0, pageVerticalMargin: b = 0 } = a.values, F = r.viewport.pageSize;
1648
+ const m = r.spineItemsManager.get(p.id), f = !!(p.mediaType ?? Me(p.href))?.startsWith("image/"), { pageHorizontalMargin: I = 0, pageVerticalMargin: b = 0 } = a.values, F = r.viewport.pageSize;
1649
1649
  if (m?.renditionLayout === "reflowable" && !f) {
1650
1650
  let $ = F.width - I * 2;
1651
- const R = F.height - b * 2;
1652
- let X = F.width - I * 2, H = I * 2;
1653
- m.isUsingVerticalWriting() && (X = F.width - I * 2, $ = R, H = b * 2);
1651
+ const A = F.height - b * 2;
1652
+ let Y = F.width - I * 2, B = I * 2;
1653
+ m.isUsingVerticalWriting() && (Y = F.width - I * 2, $ = A, B = b * 2);
1654
1654
  const ie = m?.renderer.getDocumentFrame();
1655
1655
  ie && te(
1656
1656
  ie,
1657
1657
  "prose-layout-enhancer-css",
1658
1658
  `
1659
1659
  body {
1660
- width: ${X}px !important;
1660
+ width: ${Y}px !important;
1661
1661
  margin: ${b}px ${I}px !important;
1662
- column-gap: ${H}px !important;
1662
+ column-gap: ${B}px !important;
1663
1663
  column-width: ${$}px !important;
1664
- height: ${R}px !important;
1664
+ height: ${A}px !important;
1665
1665
  }
1666
1666
  img, video, audio, object, svg {
1667
1667
  -max-width: ${$}px !important;
1668
- -max-height: ${R}px !important;
1668
+ -max-height: ${A}px !important;
1669
1669
  }
1670
1670
  table {
1671
1671
  max-width: ${$}px !important;
@@ -1676,7 +1676,7 @@ const Ci = (n) => k([
1676
1676
  `
1677
1677
  );
1678
1678
  }
1679
- }), Fi(r), Ti(r), r.hookManager.register(
1679
+ }), Ti(r), $i(r), r.hookManager.register(
1680
1680
  "item.onDocumentCreated",
1681
1681
  ({ documentContainer: p }) => {
1682
1682
  p.style.opacity = "0", a.values.layoutLayerTransition && (p.style.transition = "opacity 300ms");
@@ -1687,7 +1687,7 @@ const Ci = (n) => k([
1687
1687
  });
1688
1688
  const c = r.spineItemsObserver.itemIsReady$.pipe(
1689
1689
  se(({ isReady: p }) => p),
1690
- V(({ item: p }) => {
1690
+ j(({ item: p }) => {
1691
1691
  const m = p.renderer.documentContainer;
1692
1692
  m && (m.style.opacity = "1");
1693
1693
  })
@@ -1696,30 +1696,30 @@ const Ci = (n) => k([
1696
1696
  _(() => r.context.watch("rootElement")),
1697
1697
  se(le),
1698
1698
  _((p) => tt(p)),
1699
- vn(100),
1699
+ bn(100),
1700
1700
  se(le),
1701
- V(() => {
1701
+ j(() => {
1702
1702
  r?.layout();
1703
1703
  })
1704
- ), l = $i(r);
1704
+ ), l = xi(r);
1705
1705
  a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1706
1706
  Ct(1),
1707
- V(() => {
1707
+ j(() => {
1708
1708
  r.layout();
1709
1709
  }),
1710
- q(r.$.destroy$)
1710
+ G(r.$.destroy$)
1711
1711
  ).subscribe();
1712
1712
  const d = r.spine.pages.pipe(
1713
- Me({ refCount: !0, bufferSize: 1 })
1714
- ), g = Li(r), h = Ci(r);
1715
- return x(
1713
+ Ce({ refCount: !0, bufferSize: 1 })
1714
+ ), g = Fi(r), h = Mi(r);
1715
+ return P(
1716
1716
  c,
1717
1717
  l,
1718
1718
  u,
1719
1719
  d,
1720
1720
  g,
1721
1721
  h
1722
- ).pipe(q(r.$.destroy$)).subscribe(), {
1722
+ ).pipe(G(r.$.destroy$)).subscribe(), {
1723
1723
  ...r,
1724
1724
  destroy: () => {
1725
1725
  a.destroy(), r.destroy();
@@ -1729,7 +1729,7 @@ const Ci = (n) => k([
1729
1729
  layoutInfo$: d,
1730
1730
  coordinates: Pi(r)
1731
1731
  };
1732
- }, Di = `${G}-enhancer-loading`, Ht = `${Di}-container`, Ri = (n, e) => {
1732
+ }, Ei = `${W}-enhancer-loading`, Ht = `${Ei}-container`, Di = (n, e) => {
1733
1733
  const t = n.ownerDocument.createElement("div");
1734
1734
  return t.classList.add(Ht), t.style.cssText = `
1735
1735
  height: 100%;
@@ -1747,7 +1747,7 @@ const Ci = (n) => k([
1747
1747
  background-color: white;
1748
1748
  z-index: 1;
1749
1749
  `, t;
1750
- }, Ai = ({
1750
+ }, Ri = ({
1751
1751
  container: n,
1752
1752
  item: e
1753
1753
  }) => {
@@ -1764,8 +1764,8 @@ const Ci = (n) => k([
1764
1764
  max-width: 300px;
1765
1765
  width: 80%;
1766
1766
  `, n.appendChild(t), n.appendChild(i), n;
1767
- }, Oi = (n) => (e) => {
1768
- const { loadingElementCreate: t = Ai } = e, i = n(e), o = (c) => v(
1767
+ }, Ai = (n) => (e) => {
1768
+ const { loadingElementCreate: t = Ri } = e, i = n(e), o = (c) => v(
1769
1769
  c.reduce((u, { item: l, element: d }) => {
1770
1770
  d.style.zIndex = "0";
1771
1771
  const g = d.querySelector(
@@ -1774,7 +1774,7 @@ const Ci = (n) => k([
1774
1774
  if (g instanceof HTMLElement)
1775
1775
  return u[l.id] = g, u;
1776
1776
  const h = t({
1777
- container: Ri(d, i.viewport),
1777
+ container: Di(d, i.viewport),
1778
1778
  item: l
1779
1779
  });
1780
1780
  return d.appendChild(h), u[l.id] = h, u;
@@ -1784,8 +1784,8 @@ const Ci = (n) => k([
1784
1784
  width: i.viewport.absoluteViewport.width,
1785
1785
  theme: u
1786
1786
  })),
1787
- pe(N),
1788
- V(({ width: u, theme: l }) => {
1787
+ pe(V),
1788
+ j(({ width: u, theme: l }) => {
1789
1789
  Object.values(c).forEach((d) => {
1790
1790
  d.style.setProperty("max-width", `${u}px`), d.style.setProperty(
1791
1791
  "color",
@@ -1794,7 +1794,7 @@ const Ci = (n) => k([
1794
1794
  });
1795
1795
  })
1796
1796
  ), r = (c) => i.spineItemsObserver.itemIsReady$.pipe(
1797
- V(({ item: u, isReady: l }) => {
1797
+ j(({ item: u, isReady: l }) => {
1798
1798
  c[u.item.id]?.style.setProperty(
1799
1799
  "visibility",
1800
1800
  l ? "hidden" : "visible"
@@ -1805,17 +1805,17 @@ const Ci = (n) => k([
1805
1805
  })
1806
1806
  ), a = i.spineItemsManager.items$.pipe(
1807
1807
  _((c) => o(c)),
1808
- Me(1),
1809
- q(i.context.destroy$)
1808
+ Ce(1),
1809
+ G(i.context.destroy$)
1810
1810
  );
1811
1811
  return a.pipe(
1812
1812
  _(
1813
- (c) => x(
1813
+ (c) => P(
1814
1814
  s(c),
1815
1815
  r(c)
1816
1816
  )
1817
1817
  ),
1818
- q(i.$.destroy$)
1818
+ G(i.$.destroy$)
1819
1819
  ).subscribe(), {
1820
1820
  ...i,
1821
1821
  loading: {
@@ -1825,7 +1825,7 @@ const Ci = (n) => k([
1825
1825
  }
1826
1826
  };
1827
1827
  };
1828
- class Ni extends fe {
1828
+ class Oi extends fe {
1829
1829
  getImageElement() {
1830
1830
  const e = this.documentContainer;
1831
1831
  if (e instanceof HTMLImageElement)
@@ -1833,12 +1833,12 @@ class Ni extends fe {
1833
1833
  }
1834
1834
  onCreateDocument() {
1835
1835
  const e = this.containerElement.ownerDocument.createElement("img");
1836
- return O(this.resourcesHandler.getResource()).pipe(
1836
+ return N(this.resourcesHandler.getResource()).pipe(
1837
1837
  w((t) => {
1838
1838
  if (this.setDocumentContainer(e), e.style.objectFit = "contain", e.style.userSelect = "none", t instanceof URL)
1839
1839
  return v(t.href);
1840
1840
  if (t instanceof Response)
1841
- return O(t.blob()).pipe(
1841
+ return N(t.blob()).pipe(
1842
1842
  S((i) => URL.createObjectURL(i))
1843
1843
  );
1844
1844
  throw new Error("Invalid resource");
@@ -1852,7 +1852,7 @@ class Ni extends fe {
1852
1852
  onLoadDocument() {
1853
1853
  const e = this.getImageElement();
1854
1854
  if (!e) throw new Error("invalid element");
1855
- return this.attach(), Y(e, "load");
1855
+ return this.attach(), q(e, "load");
1856
1856
  }
1857
1857
  onUnload() {
1858
1858
  const e = this.getImageElement();
@@ -1877,12 +1877,12 @@ class Ni extends fe {
1877
1877
  getDocumentFrame() {
1878
1878
  }
1879
1879
  }
1880
- const Vi = (n) => (e) => {
1880
+ const Ni = (n) => (e) => {
1881
1881
  const t = n({
1882
1882
  ...e,
1883
1883
  getRenderer(r) {
1884
- const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Le(r.href))?.startsWith("image/");
1885
- return !a && u ? (l) => new Ni(l) : a;
1884
+ const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Me(r.href))?.startsWith("image/");
1885
+ return !a && u ? (l) => new Oi(l) : a;
1886
1886
  }
1887
1887
  }), i = new IntersectionObserver(
1888
1888
  (r) => {
@@ -1932,15 +1932,15 @@ const Vi = (n) => (e) => {
1932
1932
  i.disconnect(), o.disconnect(), t.destroy();
1933
1933
  }
1934
1934
  };
1935
- }, ji = (n, e) => n.links$.pipe(
1936
- P((t) => {
1937
- if (!Nn(t.target, "a") || t.type !== "click") return;
1935
+ }, Vi = (n, e) => n.links$.pipe(
1936
+ x((t) => {
1937
+ if (!On(t.target, "a") || t.type !== "click") return;
1938
1938
  const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
1939
1939
  n.context.manifest?.spineItems.some(
1940
1940
  (r) => r.href === o
1941
1941
  ) && e.goToUrl(i);
1942
1942
  })
1943
- ), oe = E.namespace("navigation"), ki = ({
1943
+ ), oe = D.namespace("navigation"), ji = ({
1944
1944
  position: n,
1945
1945
  spineItem: e,
1946
1946
  pageHeight: t,
@@ -1972,7 +1972,7 @@ const Vi = (n) => (e) => {
1972
1972
  const u = o.getSpineItemPositionFromSpinePosition(
1973
1973
  n,
1974
1974
  a
1975
- ), l = ki({
1975
+ ), l = ji({
1976
1976
  position: u,
1977
1977
  spineItem: a,
1978
1978
  pageHeight: s.pageSize.height,
@@ -1994,7 +1994,7 @@ const Vi = (n) => (e) => {
1994
1994
  x: 0
1995
1995
  })
1996
1996
  );
1997
- }, Ui = ({
1997
+ }, ki = ({
1998
1998
  position: n,
1999
1999
  spineItem: e,
2000
2000
  context: t,
@@ -2038,7 +2038,7 @@ const Vi = (n) => (e) => {
2038
2038
  return i.getAdjustedPositionForSpread(l);
2039
2039
  }
2040
2040
  return i.getAdjustedPositionForSpread(u);
2041
- }, zi = ({
2041
+ }, Ui = ({
2042
2042
  position: n,
2043
2043
  spineItem: e,
2044
2044
  pageHeight: t,
@@ -2070,7 +2070,7 @@ const Vi = (n) => (e) => {
2070
2070
  const u = o.getSpineItemPositionFromSpinePosition(
2071
2071
  n,
2072
2072
  a
2073
- ), l = zi({
2073
+ ), l = Ui({
2074
2074
  position: u,
2075
2075
  spineItem: a,
2076
2076
  pageHeight: s.pageSize.height,
@@ -2092,7 +2092,7 @@ const Vi = (n) => (e) => {
2092
2092
  x: 0
2093
2093
  })
2094
2094
  );
2095
- }, Wi = ({
2095
+ }, zi = ({
2096
2096
  position: n,
2097
2097
  spineItem: e,
2098
2098
  context: t,
@@ -2140,7 +2140,7 @@ const Vi = (n) => (e) => {
2140
2140
  }
2141
2141
  return i.getAdjustedPositionForSpread(u);
2142
2142
  };
2143
- class _i {
2143
+ class Wi {
2144
2144
  constructor(e) {
2145
2145
  this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new M({ x: 0, y: 0 }), this.unlock = void 0;
2146
2146
  }
@@ -2159,7 +2159,7 @@ class _i {
2159
2159
  turnRightOrBottom() {
2160
2160
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2161
2161
  if (!t) return;
2162
- const i = Wi({
2162
+ const i = zi({
2163
2163
  context: this.reader.context,
2164
2164
  navigationResolver: this.reader.navigation.navigationResolver,
2165
2165
  position: e.position,
@@ -2177,7 +2177,7 @@ class _i {
2177
2177
  turnLeftOrTop() {
2178
2178
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2179
2179
  if (!t) return;
2180
- const i = Ui({
2180
+ const i = ki({
2181
2181
  context: this.reader.context,
2182
2182
  navigationResolver: this.reader.navigation.navigationResolver,
2183
2183
  position: e.position,
@@ -2319,7 +2319,7 @@ class _i {
2319
2319
  }
2320
2320
  }
2321
2321
  }
2322
- class Hi {
2322
+ class _i {
2323
2323
  constructor(e) {
2324
2324
  this.reader = e, this.lastDelta = { x: 0, y: 0 }, this.lastPosition = new M({ x: 0, y: 0 }), this.lastStartPosition = new M({ x: 0, y: 0 }), this.unlock = void 0;
2325
2325
  }
@@ -2358,23 +2358,23 @@ class Hi {
2358
2358
  });
2359
2359
  }
2360
2360
  }
2361
- const Bi = 500;
2362
- class Xi extends B {
2361
+ const Hi = 500;
2362
+ class Bi extends X {
2363
2363
  constructor(e, t) {
2364
- super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new j(), this.navigation$ = this.navigationSubject.asObservable();
2364
+ super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new R(), this.navigation$ = this.navigationSubject.asObservable();
2365
2365
  const i = this.scrollNavigationController.userScroll$.pipe(
2366
2366
  Ue((o) => {
2367
2367
  const s = this.locker.lock();
2368
- return x(
2368
+ return P(
2369
2369
  this.scrollNavigationController.userScroll$,
2370
2370
  v(o)
2371
2371
  ).pipe(
2372
2372
  Se(
2373
- Bi,
2373
+ Hi,
2374
2374
  re
2375
2375
  ),
2376
2376
  U(),
2377
- P(() => {
2377
+ x(() => {
2378
2378
  const r = this.scrollNavigationController.fromScrollPosition(
2379
2379
  this.scrollNavigationController.scrollPosition
2380
2380
  );
@@ -2390,11 +2390,11 @@ class Xi extends B {
2390
2390
  );
2391
2391
  })
2392
2392
  );
2393
- x(i).pipe(T(this.destroy$)).subscribe();
2393
+ P(i).pipe(T(this.destroy$)).subscribe();
2394
2394
  }
2395
2395
  }
2396
- const Yi = (n) => n.pagination.state$.pipe(
2397
- A(n.context.manifest$, n.settings.values$),
2396
+ const Xi = (n) => n.pagination.state$.pipe(
2397
+ O(n.context.manifest$, n.settings.values$),
2398
2398
  S(
2399
2399
  ([
2400
2400
  e,
@@ -2412,33 +2412,33 @@ const Yi = (n) => n.pagination.state$.pipe(
2412
2412
  };
2413
2413
  }
2414
2414
  ),
2415
- z(N)
2416
- ), qi = ({ reader: n, duration: e }) => (t) => {
2415
+ z(V)
2416
+ ), Yi = ({ reader: n, duration: e }) => (t) => {
2417
2417
  let i;
2418
2418
  const o = () => {
2419
2419
  i?.(), i = void 0;
2420
2420
  };
2421
2421
  return t.pipe(
2422
- P(() => {
2422
+ x(() => {
2423
2423
  i || (i = n?.navigation.lock());
2424
2424
  }),
2425
- un(e, re, {
2425
+ cn(e, re, {
2426
2426
  trailing: !0,
2427
2427
  leading: !0
2428
2428
  }),
2429
- P(o),
2429
+ x(o),
2430
2430
  de(o)
2431
2431
  );
2432
- }, Gi = (n) => (e) => {
2433
- const t = n(e), i = Yi(t), o = new _i(t), s = new Hi(t), r = new Xi(
2432
+ }, qi = (n) => (e) => {
2433
+ const t = n(e), i = Xi(t), o = new Wi(t), s = new _i(t), r = new Bi(
2434
2434
  t.navigation.scrollNavigationController,
2435
2435
  t.navigation.locker
2436
- ), a = ji(t, o), c = r.navigation$.pipe(
2437
- P((d) => {
2436
+ ), a = Vi(t, o), c = r.navigation$.pipe(
2437
+ x((d) => {
2438
2438
  t.navigation.navigate(d);
2439
2439
  })
2440
2440
  );
2441
- return x(a, c).pipe(T(t.$.destroy$)).subscribe(), {
2441
+ return P(a, c).pipe(T(t.$.destroy$)).subscribe(), {
2442
2442
  ...t,
2443
2443
  load: (d) => {
2444
2444
  const { cfi: g, ...h } = d;
@@ -2450,7 +2450,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2450
2450
  navigation: {
2451
2451
  ...t.navigation,
2452
2452
  state$: i,
2453
- throttleLock: ({ duration: d, trigger: g }) => g.pipe(qi({ duration: d, reader: t })),
2453
+ throttleLock: ({ duration: d, trigger: g }) => g.pipe(Yi({ duration: d, reader: t })),
2454
2454
  moveTo: s.moveTo.bind(s),
2455
2455
  turnBottom: o.turnBottom.bind(o),
2456
2456
  turnTop: o.turnTop.bind(o),
@@ -2498,19 +2498,19 @@ const Yi = (n) => n.pagination.state$.pipe(
2498
2498
  }
2499
2499
  return o;
2500
2500
  }, void 0);
2501
- }, Zi = (n, e) => {
2501
+ }, Gi = (n, e) => {
2502
2502
  const { href: t } = e;
2503
2503
  return Bt(t, n.nav?.toc ?? [], n);
2504
- }, Ji = (n) => {
2504
+ }, Zi = (n) => {
2505
2505
  const e = n.context.manifest, t = n.spineItemsManager.items;
2506
2506
  return e ? t.reduce(
2507
- (i, { item: o }) => (i[o.id] = Zi(e, o), i),
2507
+ (i, { item: o }) => (i[o.id] = Gi(e, o), i),
2508
2508
  {}
2509
2509
  ) : {};
2510
- }, Ki = (n) => n.spineItemsManager.items$.pipe(
2510
+ }, Ji = (n) => n.spineItemsManager.items$.pipe(
2511
2511
  ee([]),
2512
- S(() => Ji(n))
2513
- ), Qi = (n, e, t) => n + e * t, eo = (n, e, t) => {
2512
+ S(() => Zi(n))
2513
+ ), Ki = (n, e, t) => n + e * t, Qi = (n, e, t) => {
2514
2514
  const { height: i, width: o } = t.layout.layoutInfo, { top: s, left: r } = n.spine.getSpineItemSpineLayoutInfo(t);
2515
2515
  return n.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
2516
2516
  0,
@@ -2525,9 +2525,9 @@ const Yi = (n) => n.pagination.state$.pipe(
2525
2525
  (e.x - r + n.viewport.absoluteViewport.width) / o
2526
2526
  )
2527
2527
  );
2528
- }, to = (n, e, t, i, o) => o.isReady$.pipe(
2528
+ }, eo = (n, e, t, i, o) => o.isReady$.pipe(
2529
2529
  U(),
2530
- A(n.layoutInfo$),
2530
+ O(n.layoutInfo$),
2531
2531
  S(([s, r]) => {
2532
2532
  const a = n.context, c = a.manifest?.renditionLayout === "pre-paginated", u = a.manifest?.spineItems.length || 0, l = a.manifest?.spineItems.slice(0, e).reduce((f, I) => f + (I.progressionWeight ?? 0), 0) || 0, d = n.spineItemsManager.getSpineItemIndex(o) ?? 0, g = n.context.manifest?.spineItems.length ?? 0, h = r.pages.filter((f) => f.itemIndex === d).length ?? 0, p = a.manifest?.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
2533
2533
  // relative to the total number of documents
@@ -2535,19 +2535,19 @@ const Yi = (n) => n.pagination.state$.pipe(
2535
2535
  let m = (t + 1) * (p / h);
2536
2536
  !c && o.renditionLayout === "reflowable" && !s && (m = 0);
2537
2537
  let y = l + m;
2538
- return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = eo(
2538
+ return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Qi(
2539
2539
  n,
2540
2540
  i,
2541
2541
  o
2542
- ) : m = 0, y = Qi(
2542
+ ) : m = 0, y = Ki(
2543
2543
  l,
2544
2544
  p,
2545
2545
  m
2546
2546
  )), e === u - 1 && t === h - 1 && y > 0.99 ? 1 : y;
2547
2547
  })
2548
- ), no = (n) => n.spine.layout$.pipe(
2548
+ ), to = (n) => n.spine.layout$.pipe(
2549
2549
  Se(10, re),
2550
- A(n.pagination.state$),
2550
+ O(n.pagination.state$),
2551
2551
  S(() => ({
2552
2552
  numberOfPagesPerItems: n.spineItemsManager.items.reduce(
2553
2553
  (t, i) => [...t, i.numberOfPages],
@@ -2558,12 +2558,12 @@ const Yi = (n) => n.pagination.state$.pipe(
2558
2558
  */
2559
2559
  numberOfTotalPages: n.spine.pages.value.pages.length
2560
2560
  })),
2561
- z(N),
2561
+ z(V),
2562
2562
  ee({
2563
2563
  numberOfPagesPerItems: [],
2564
2564
  numberOfTotalPages: 0
2565
2565
  })
2566
- ), io = (n, e, t, i) => {
2566
+ ), no = (n, e, t, i) => {
2567
2567
  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;
2568
2568
  return v({
2569
2569
  ...e,
@@ -2594,7 +2594,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2594
2594
  // hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
2595
2595
  // numberOfSpineItems: context.manifest?.readingOrder.length,
2596
2596
  });
2597
- }, oo = (n) => k([
2597
+ }, io = (n) => k([
2598
2598
  n.pagination.state$,
2599
2599
  // Usually pagination change if layout changes (number of pages) however it is especially
2600
2600
  // useful for like webtoon where you still have one page but only the layout will give you the final size
@@ -2603,7 +2603,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2603
2603
  ]).pipe(
2604
2604
  w(([e]) => {
2605
2605
  const t = e.endSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.endSpineItemIndex) : void 0;
2606
- return t ? to(
2606
+ return t ? eo(
2607
2607
  n,
2608
2608
  e.endSpineItemIndex ?? 0,
2609
2609
  e.endPageIndexInSpineItem || 0,
@@ -2611,8 +2611,8 @@ const Yi = (n) => n.pagination.state$.pipe(
2611
2611
  t
2612
2612
  ) : v(0);
2613
2613
  })
2614
- ), so = (n) => {
2615
- const e = Ki(n), t = no(n), i = new W({
2614
+ ), oo = (n) => {
2615
+ const e = Ji(n), t = to(n), i = new H({
2616
2616
  ...n.pagination.state,
2617
2617
  beginChapterInfo: void 0,
2618
2618
  beginCfi: void 0,
@@ -2630,10 +2630,10 @@ const Yi = (n) => n.pagination.state$.pipe(
2630
2630
  }), o = k([
2631
2631
  n.pagination.state$,
2632
2632
  e,
2633
- oo(n)
2633
+ io(n)
2634
2634
  ]).pipe(
2635
2635
  w(
2636
- ([r, a, c]) => io(
2636
+ ([r, a, c]) => no(
2637
2637
  n,
2638
2638
  r,
2639
2639
  a,
@@ -2645,7 +2645,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2645
2645
  }))
2646
2646
  )
2647
2647
  ),
2648
- z(N)
2648
+ z(V)
2649
2649
  );
2650
2650
  return { paginationInfo$: k([
2651
2651
  o,
@@ -2663,7 +2663,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2663
2663
  r.endPageIndexInSpineItem ?? 0
2664
2664
  )
2665
2665
  })),
2666
- P((r) => {
2666
+ x((r) => {
2667
2667
  i.next(r);
2668
2668
  }),
2669
2669
  J(1)
@@ -2677,7 +2677,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2677
2677
  item: t
2678
2678
  }) => {
2679
2679
  const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
2680
- return !i || !i?.documentElement || n === i ? he(t) : Vn(n) ? ze({
2680
+ return !i || !i?.documentElement || n === i ? he(t) : Nn(n) ? ze({
2681
2681
  start: {
2682
2682
  node: n.startContainer,
2683
2683
  offset: n.startOffset,
@@ -2709,14 +2709,14 @@ const Yi = (n) => n.pagination.state$.pipe(
2709
2709
  offset: o.offset,
2710
2710
  item: e.item
2711
2711
  }).trim() : he(e.item);
2712
- }, ro = (n, e) => Xt({
2712
+ }, so = (n, e) => Xt({
2713
2713
  nodeOrRange: n,
2714
2714
  item: e
2715
- }), Qs = (n) => n.index.toString(), ht = (n) => n[0]?.index === 6 && n.length > 1, Be = (n) => {
2715
+ }), er = (n) => n.index.toString(), ht = (n) => n[0]?.index === 6 && n.length > 1, Be = (n) => {
2716
2716
  const e = Et(n);
2717
- return xn(e);
2718
- }, ao = (n) => Array.isArray(n) ? n[0] && ht(n[0]) ? n[0] : void 0 : n.parent[0] && ht(n.parent[0]) ? n.parent[0] : void 0, ot = (n) => {
2719
- const e = Et(n), s = ((ao(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = Pn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2717
+ return wn(e);
2718
+ }, ro = (n) => Array.isArray(n) ? n[0] && ht(n[0]) ? n[0] : void 0 : n.parent[0] && ht(n.parent[0]) ? n.parent[0] : void 0, ot = (n) => {
2719
+ 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;
2720
2720
  return {
2721
2721
  isCfiRange: r,
2722
2722
  cleanedCfi: n,
@@ -2739,7 +2739,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2739
2739
  const r = s.contentWindow?.document;
2740
2740
  if (r)
2741
2741
  try {
2742
- const a = $n(n, r, {
2742
+ const a = xn(n, r, {
2743
2743
  throwOnError: !0
2744
2744
  });
2745
2745
  return {
@@ -2752,7 +2752,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2752
2752
  spineItem: o
2753
2753
  };
2754
2754
  } catch (a) {
2755
- return E.warn(`Error resolving cfi: ${n}.`), E.warn(a), {
2755
+ return D.warn(`Error resolving cfi: ${n}.`), D.warn(a), {
2756
2756
  ...i,
2757
2757
  spineItem: o,
2758
2758
  itemIndex: t,
@@ -2766,7 +2766,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2766
2766
  spineItem: o,
2767
2767
  node: null
2768
2768
  };
2769
- }, co = (n, e) => {
2769
+ }, ao = (n, e) => {
2770
2770
  if ("cfi" in e) {
2771
2771
  const { itemIndex: s, ...r } = n.cfi.parseCfi(e.cfi);
2772
2772
  return {
@@ -2786,11 +2786,11 @@ const Yi = (n) => n.pagination.state$.pipe(
2786
2786
  itemIndex: t.index,
2787
2787
  node: null
2788
2788
  };
2789
- }, uo = (n, e) => {
2789
+ }, co = (n, e) => {
2790
2790
  let t = n?.itemPageIndex;
2791
2791
  const { itemIndex: i, ...o } = e.cfi.parseCfi(n.cfi), s = e.spineItemsManager.get(i);
2792
2792
  return s ? Vt().pipe(
2793
- A(s.isReady$),
2793
+ O(s.isReady$),
2794
2794
  S(([, r]) => {
2795
2795
  const {
2796
2796
  node: a = null,
@@ -2819,7 +2819,7 @@ const Yi = (n) => n.pagination.state$.pipe(
2819
2819
  })
2820
2820
  ) : v({ ...n, itemIndex: i, ...o });
2821
2821
  };
2822
- class lo {
2822
+ class uo {
2823
2823
  constructor(e) {
2824
2824
  this.reader = e, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (t) => {
2825
2825
  const i = this.locatorsByKey.get(t);
@@ -2827,7 +2827,7 @@ class lo {
2827
2827
  }, this.locate = (t, i) => {
2828
2828
  const o = {
2829
2829
  resource: t,
2830
- meta: co(this.reader, t)
2830
+ meta: ao(this.reader, t)
2831
2831
  };
2832
2832
  return ut(() => {
2833
2833
  const s = this.reader.spineItemsManager.get(
@@ -2852,7 +2852,7 @@ class lo {
2852
2852
  const d = this.reader.spine.layout$.pipe(
2853
2853
  Se(10),
2854
2854
  ee(o),
2855
- ln((g) => uo(g.meta, this.reader).pipe(
2855
+ un((g) => co(g.meta, this.reader).pipe(
2856
2856
  S((h) => ({
2857
2857
  ...g,
2858
2858
  meta: h
@@ -2871,14 +2871,14 @@ class lo {
2871
2871
  return Array.isArray(e) ? ut(
2872
2872
  () => k(
2873
2873
  e.map((i) => this.locate(i, t ?? {}))
2874
- ).pipe(dn([]))
2874
+ ).pipe(ln([]))
2875
2875
  ) : this.locate(e, t ?? {});
2876
2876
  }
2877
2877
  }
2878
- const po = (n) => (e) => {
2879
- const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = so(t);
2878
+ const lo = (n) => (e) => {
2879
+ const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = oo(t);
2880
2880
  i.pipe(T(t.$.destroy$)).subscribe();
2881
- const s = new lo(t);
2881
+ const s = new uo(t);
2882
2882
  return {
2883
2883
  ...t,
2884
2884
  locateResource: s.locateResource.bind(s),
@@ -2892,7 +2892,7 @@ const po = (n) => (e) => {
2892
2892
  }
2893
2893
  }
2894
2894
  };
2895
- }, go = (n) => ({
2895
+ }, po = (n) => ({
2896
2896
  put: (s, r) => new Promise((a, c) => {
2897
2897
  const u = n.transaction(["store"], "readwrite");
2898
2898
  u.onerror = (g) => {
@@ -2944,18 +2944,18 @@ const po = (n) => (e) => {
2944
2944
  a(d);
2945
2945
  };
2946
2946
  })
2947
- }), Ae = async (n) => new Promise((e, t) => {
2947
+ }), Oe = async (n) => new Promise((e, t) => {
2948
2948
  const i = window.indexedDB.open(n);
2949
2949
  i.onerror = (o) => {
2950
2950
  t(o);
2951
2951
  }, i.onsuccess = () => {
2952
- e(go(i.result));
2952
+ e(po(i.result));
2953
2953
  }, i.onupgradeneeded = () => {
2954
2954
  i.result.createObjectStore("store");
2955
2955
  };
2956
- }), ho = (n) => {
2956
+ }), go = (n) => {
2957
2957
  let e = Date.now().toString();
2958
- const t = new j(), i = (c) => {
2958
+ const t = new R(), i = (c) => {
2959
2959
  if (typeof c == "string" || typeof c == "object") {
2960
2960
  const u = typeof c == "object" ? c.id : c;
2961
2961
  return n.manifest?.spineItems.find((l) => l.id === u);
@@ -2964,7 +2964,7 @@ const po = (n) => (e) => {
2964
2964
  }, o = async (c, u) => {
2965
2965
  const l = i(c);
2966
2966
  if (!l) return new Response("Item not found", { status: 404 });
2967
- const g = await (await Ae("prose-reader")).get(`${e}_${l.id}`);
2967
+ const g = await (await Oe("prose-reader")).get(`${e}_${l.id}`);
2968
2968
  if (g)
2969
2969
  return new Response(g, { status: 200 });
2970
2970
  const h = u && await u(l) || await fetch(l.href);
@@ -2973,46 +2973,46 @@ const po = (n) => (e) => {
2973
2973
  t.next({ id: c, data: u });
2974
2974
  };
2975
2975
  t.asObservable().pipe(
2976
- wn(({ id: c, data: u }) => {
2976
+ vn(({ id: c, data: u }) => {
2977
2977
  const l = i(c);
2978
- return l ? O(
2979
- pn([Ae("prose-reader"), O(u.blob())])
2978
+ return l ? N(
2979
+ dn([Oe("prose-reader"), N(u.blob())])
2980
2980
  ).pipe(
2981
- _(([d, g]) => O(d.put(`${e}_${l.id}`, g))),
2982
- at((d) => (E.error(d), Z))
2981
+ _(([d, g]) => N(d.put(`${e}_${l.id}`, g))),
2982
+ at((d) => (D.error(d), Z))
2983
2983
  ) : Z;
2984
2984
  }),
2985
- q(n.destroy$)
2985
+ G(n.destroy$)
2986
2986
  ).subscribe();
2987
2987
  const r = n.manifest$.pipe(
2988
- V(() => {
2988
+ j(() => {
2989
2989
  e = Date.now().toString();
2990
2990
  })
2991
2991
  );
2992
- return x(r).pipe(
2993
- _(() => (E.debug("Cleanup up old cache..."), O(Ae("prose-reader")).pipe(
2992
+ return P(r).pipe(
2993
+ _(() => (D.debug("Cleanup up old cache..."), N(Oe("prose-reader")).pipe(
2994
2994
  _(
2995
- (c) => O(c.keys()).pipe(
2995
+ (c) => N(c.keys()).pipe(
2996
2996
  K(
2997
2997
  (u) => u.filter((l) => !l.toString().startsWith(e))
2998
2998
  ),
2999
2999
  _((u) => {
3000
3000
  const l = u.map((d) => c.remove(d));
3001
- return O(Promise.all(l));
3001
+ return N(Promise.all(l));
3002
3002
  })
3003
3003
  )
3004
3004
  ),
3005
- at((c) => (E.error(c), Z))
3005
+ at((c) => (D.error(c), Z))
3006
3006
  ))),
3007
- q(n.destroy$)
3007
+ G(n.destroy$)
3008
3008
  ).subscribe(), {
3009
3009
  get: o,
3010
3010
  destroy: () => {
3011
3011
  t.complete();
3012
3012
  }
3013
3013
  };
3014
- }, mo = (n) => (e) => {
3015
- const t = n(e), i = ho(t.context);
3014
+ }, ho = (n) => (e) => {
3015
+ const t = n(e), i = go(t.context);
3016
3016
  return {
3017
3017
  ...t,
3018
3018
  // $: {
@@ -3024,7 +3024,7 @@ const po = (n) => (e) => {
3024
3024
  }
3025
3025
  // load,
3026
3026
  };
3027
- }, fo = (n, e) => {
3027
+ }, mo = (n, e) => {
3028
3028
  const t = n.node.ownerDocument?.createRange(), i = n.node.compareDocumentPosition(e.node);
3029
3029
  if (t) {
3030
3030
  try {
@@ -3037,33 +3037,33 @@ const po = (n) => (e) => {
3037
3037
  t.setStart(n.node, o), t.setEnd(n.node, s);
3038
3038
  }
3039
3039
  } catch (o) {
3040
- E.warn("Failed to create range from selection", o, {
3040
+ D.warn("Failed to create range from selection", o, {
3041
3041
  anchor: n,
3042
3042
  focus: e
3043
3043
  });
3044
3044
  }
3045
3045
  return t;
3046
3046
  }
3047
- }, yo = ({
3047
+ }, fo = ({
3048
3048
  selection: n,
3049
3049
  spineItem: e
3050
3050
  }) => {
3051
3051
  const { anchorNode: t, anchorOffset: i, focusNode: o, focusOffset: s } = n;
3052
3052
  if (!(!t || !o))
3053
3053
  try {
3054
- return fo(
3054
+ return mo(
3055
3055
  { node: t, offset: i },
3056
3056
  { node: o, offset: s }
3057
3057
  );
3058
3058
  } catch (r) {
3059
- E.warn("Failed to create range from selection", r, {
3059
+ D.warn("Failed to create range from selection", r, {
3060
3060
  selection: n,
3061
3061
  spineItem: e
3062
3062
  });
3063
3063
  return;
3064
3064
  }
3065
3065
  };
3066
- class So extends B {
3066
+ class yo extends X {
3067
3067
  constructor(e) {
3068
3068
  super();
3069
3069
  const t = e.contentDocument || e.contentWindow?.document;
@@ -3086,26 +3086,26 @@ class So extends B {
3086
3086
  )
3087
3087
  )
3088
3088
  ) : v(null);
3089
- this.selectionChange$ = x(
3090
- Y(t, "selectionchange"),
3089
+ this.selectionChange$ = P(
3090
+ q(t, "selectionchange"),
3091
3091
  i
3092
3092
  ).pipe(
3093
3093
  S(() => t.getSelection()),
3094
- T(x(o, this.destroy$)),
3094
+ T(P(o, this.destroy$)),
3095
3095
  me(null)
3096
- ), this.selectionOver$ = Y(t, "pointerdown").pipe(
3096
+ ), this.selectionOver$ = q(t, "pointerdown").pipe(
3097
3097
  w(
3098
- () => x(
3099
- Y(t, "pointerup"),
3100
- Y(t, "pointercancel"),
3101
- Y(t, "contextmenu")
3098
+ () => P(
3099
+ q(t, "pointerup"),
3100
+ q(t, "pointercancel"),
3101
+ q(t, "contextmenu")
3102
3102
  ).pipe(
3103
3103
  U(),
3104
3104
  /**
3105
3105
  * The selection is still valid during the event even if it will
3106
3106
  * be discarded. The timeout make sure to detect this edge case.
3107
3107
  */
3108
- ve(0),
3108
+ we(0),
3109
3109
  S((s) => {
3110
3110
  const r = t.getSelection();
3111
3111
  return r && !r.isCollapsed ? [s, r] : void 0;
@@ -3113,17 +3113,17 @@ class So extends B {
3113
3113
  L(le)
3114
3114
  )
3115
3115
  ),
3116
- T(x(o, this.destroy$))
3116
+ T(P(o, this.destroy$))
3117
3117
  );
3118
3118
  }
3119
3119
  }
3120
3120
  }
3121
- const Io = (n) => n.watch("isLoaded").pipe(
3121
+ const So = (n) => n.watch("isLoaded").pipe(
3122
3122
  w(() => {
3123
3123
  const e = n.renderer.getDocumentFrame(), t = e?.contentDocument || e?.contentWindow?.document;
3124
3124
  if (!e || !t) return ge;
3125
- const i = new So(e);
3126
- return x(
3125
+ const i = new yo(e);
3126
+ return P(
3127
3127
  i.selectionChange$.pipe(
3128
3128
  S((o) => {
3129
3129
  if (o?.toString())
@@ -3149,14 +3149,14 @@ const Io = (n) => n.watch("isLoaded").pipe(
3149
3149
  );
3150
3150
  }),
3151
3151
  z()
3152
- ), bo = (n) => (e) => {
3152
+ ), Io = (n) => (e) => {
3153
3153
  const t = n(e);
3154
3154
  let i;
3155
3155
  const o = t.spineItemsManager.items$.pipe(
3156
3156
  w((l) => {
3157
3157
  const d = l.map((g) => {
3158
3158
  const h = t.spineItemsManager.getSpineItemIndex(g) ?? 0;
3159
- return Io(g).pipe(
3159
+ return So(g).pipe(
3160
3160
  S((p) => {
3161
3161
  if (p)
3162
3162
  return {
@@ -3166,11 +3166,11 @@ const Io = (n) => n.watch("isLoaded").pipe(
3166
3166
  })
3167
3167
  );
3168
3168
  });
3169
- return x(...d);
3169
+ return P(...d);
3170
3170
  }),
3171
3171
  ee(void 0),
3172
3172
  z(),
3173
- P((l) => {
3173
+ x((l) => {
3174
3174
  i = l;
3175
3175
  }),
3176
3176
  J({ refCount: !0, bufferSize: 1 })
@@ -3178,24 +3178,24 @@ const Io = (n) => n.watch("isLoaded").pipe(
3178
3178
  S((l) => !!l),
3179
3179
  z(),
3180
3180
  L((l) => l),
3181
- D()
3181
+ E()
3182
3182
  ), a = r.pipe(
3183
3183
  w(() => s),
3184
3184
  z(),
3185
3185
  L((l) => !l),
3186
- D()
3186
+ E()
3187
3187
  ), c = o.pipe(
3188
3188
  L((l) => l?.type === "over"),
3189
- D()
3189
+ E()
3190
3190
  ), u = t.context.watch("rootElement").pipe(
3191
3191
  L(Ge),
3192
- w((l) => Y(l, "pointerdown")),
3193
- A(s),
3192
+ w((l) => q(l, "pointerdown")),
3193
+ O(s),
3194
3194
  S(([, l]) => l),
3195
3195
  ee(void 0),
3196
3196
  J({ refCount: !0, bufferSize: 1 })
3197
3197
  );
3198
- return x(s, u).pipe(T(t.$.destroy$)).subscribe(), {
3198
+ return P(s, u).pipe(T(t.$.destroy$)).subscribe(), {
3199
3199
  ...t,
3200
3200
  selection: {
3201
3201
  selection$: s,
@@ -3204,7 +3204,7 @@ const Io = (n) => n.watch("isLoaded").pipe(
3204
3204
  selectionOver$: c,
3205
3205
  lastSelectionOnPointerdown$: u,
3206
3206
  getSelection: () => i,
3207
- createOrderedRangeFromSelection: yo
3207
+ createOrderedRangeFromSelection: fo
3208
3208
  }
3209
3209
  };
3210
3210
  }, mt = [
@@ -3222,8 +3222,8 @@ const Io = (n) => n.watch("isLoaded").pipe(
3222
3222
  backgroundColor: "#191717",
3223
3223
  foregroundColor: "#f1ebeb"
3224
3224
  }
3225
- ], vo = (n) => (e) => {
3226
- const t = n(e), i = new W(
3225
+ ], bo = (n) => (e) => {
3226
+ const t = n(e), i = new H(
3227
3227
  e.theme ?? "bright"
3228
3228
  ), o = () => {
3229
3229
  const a = mt.find(
@@ -3264,17 +3264,17 @@ const Io = (n) => n.watch("isLoaded").pipe(
3264
3264
  u && te(u, "prose-reader-theme", o());
3265
3265
  }
3266
3266
  }), t.spineItemsManager.items$.pipe(
3267
- V(
3267
+ j(
3268
3268
  (a) => a.map(
3269
3269
  ({ element: c }) => s({ container: c })
3270
3270
  )
3271
3271
  ),
3272
- q(t.$.destroy$)
3272
+ G(t.$.destroy$)
3273
3273
  ).subscribe(), i.pipe(
3274
- V(() => {
3274
+ j(() => {
3275
3275
  r();
3276
3276
  }),
3277
- q(t.$.destroy$)
3277
+ G(t.$.destroy$)
3278
3278
  ).subscribe(), {
3279
3279
  ...t,
3280
3280
  theme: {
@@ -3287,17 +3287,17 @@ const Io = (n) => n.watch("isLoaded").pipe(
3287
3287
  }
3288
3288
  }
3289
3289
  };
3290
- }, wo = (n) => (e) => ({
3290
+ }, vo = (n) => (e) => ({
3291
3291
  ...n(e),
3292
3292
  utils: {
3293
3293
  isOrIsWithinValidLink: (o) => !!(Ot(o) && (o.nodeName === "a" ? o : o.closest("a"))?.getAttribute("href"))
3294
3294
  }
3295
3295
  });
3296
3296
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3297
- const xo = (n) => (e) => n(e);
3297
+ const wo = (n) => (e) => n(e), Po = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}";
3298
3298
  class ce extends ne {
3299
3299
  constructor(e) {
3300
- super((t) => this.stateSubject.pipe(T(this._destroy$)).subscribe(t)), this._destroy$ = new j(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new W(e);
3300
+ super((t) => this.stateSubject.pipe(T(this._destroy$)).subscribe(t)), this._destroy$ = new R(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new H(e);
3301
3301
  }
3302
3302
  next(e) {
3303
3303
  this.stateSubject.next(e);
@@ -3307,12 +3307,12 @@ class ce extends ne {
3307
3307
  */
3308
3308
  mergeCompare(e) {
3309
3309
  const t = { ...this.value, ...e };
3310
- N(this.value, t) || this.stateSubject.next(t);
3310
+ V(this.value, t) || this.stateSubject.next(t);
3311
3311
  }
3312
3312
  watch(e) {
3313
3313
  return Array.isArray(e) ? this.stateSubject.pipe(et(e)) : this.stateSubject.pipe(
3314
3314
  S((t) => t[e]),
3315
- z(N)
3315
+ z(V)
3316
3316
  );
3317
3317
  }
3318
3318
  get value() {
@@ -3322,211 +3322,164 @@ class ce extends ne {
3322
3322
  this.stateSubject.complete(), this._destroy$.complete();
3323
3323
  }
3324
3324
  }
3325
- class qt extends ce {
3325
+ const xo = (n, e, t) => {
3326
+ t.style.transformOrigin = "0 0";
3327
+ const i = `translate3d(${e.x}px, ${e.y}px, 0px)`, o = `scale(${n})`;
3328
+ t.style.transform = `${i} ${o}`;
3329
+ }, $o = (n, e, t, i) => {
3330
+ const o = e / n, s = t.clientWidth, r = t.clientHeight, a = s / 2 - i.x, c = r / 2 - i.y;
3331
+ return {
3332
+ x: i.x + a * (1 - o),
3333
+ y: i.y + c * (1 - o)
3334
+ };
3335
+ }, To = (n, e, t, i, o) => {
3336
+ 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, g = u * d, h = l * d, p = g - s / 2 + i, m = h - r / 2 + o;
3337
+ return { newScrollLeft: p, newScrollTop: m };
3338
+ }, Fo = (n, e) => {
3339
+ const t = e.viewport, i = e.navigation.scrollNavigationController, o = t.value.element, s = i.value.element, r = i.value.element, a = t.scaleFactor, c = o.offsetLeft, u = o.offsetTop, { newScrollLeft: l, newScrollTop: d } = To(
3340
+ s ?? Rn(),
3341
+ a,
3342
+ n,
3343
+ c,
3344
+ u
3345
+ ), g = n < 1 ? "down" : "up";
3346
+ return r?.setAttribute(
3347
+ `data-${W}-zooming-direction`,
3348
+ g
3349
+ ), n < 1 ? o.style.transformOrigin = "top" : n > 1 && (o.style.transformOrigin = `${c}px ${u}px`), o.style.transform = `scale(${n})`, i.fromScrollPosition({
3350
+ x: l,
3351
+ y: d
3352
+ });
3353
+ }, ve = 200;
3354
+ class Lo extends ce {
3326
3355
  constructor(e) {
3327
3356
  super({
3328
- element: void 0,
3329
3357
  isZooming: !1,
3330
3358
  currentScale: 1,
3331
3359
  currentPosition: { x: 0, y: 0 }
3332
- }), this.reader = e;
3333
- }
3334
- exit() {
3335
- this.scrollNavigationController.value.element?.removeAttribute(
3336
- `data-${G}-zooming-direction`
3337
- ), this.scrollNavigationController.value.element?.setAttribute(
3338
- `data-${G}-zooming`,
3339
- "false"
3340
- );
3341
- }
3342
- get scrollNavigationController() {
3343
- return this.reader.navigation.scrollNavigationController;
3344
- }
3345
- }
3346
- const Oe = 200;
3347
- class Po extends qt {
3348
- constructor(e) {
3349
- super(e), this.watch("isZooming").pipe(
3350
- L((t) => !t),
3351
- w(
3352
- () => $e(Oe).pipe(
3353
- P(() => {
3354
- this.reader.viewport.value.element.style.transition = "";
3355
- })
3356
- )
3357
- )
3358
- ), this.watch("currentScale").pipe(
3359
- w(
3360
- () => $e(Oe).pipe(
3361
- P(() => {
3360
+ }), this.reader = e, this.enterSubject = new R(), this.exitSubject = new R();
3361
+ const t = this.enterSubject.pipe(
3362
+ w((o) => {
3363
+ const { scale: s = 1, animate: r = !1 } = o ?? {}, a = this.reader.viewport.value.element;
3364
+ return this.viewport.element.setAttribute(
3365
+ `data-${W}-zooming`,
3366
+ "true"
3367
+ ), this.scrollNavigationController.value.element?.setAttribute(
3368
+ `data-${W}-zooming`,
3369
+ this.isControlled ? "false" : "true"
3370
+ ), r && this.isControlled && (a.style.transition = `transform ${ve}ms`), this.mergeCompare({
3371
+ isZooming: !0,
3372
+ currentScale: 1,
3373
+ currentPosition: { x: 0, y: 0 }
3374
+ }), this.updateZoom(s), s !== 1 && this.isControlled ? Te(o?.animate ? ve : 0).pipe(
3375
+ x(() => {
3362
3376
  this.reader.layout();
3363
3377
  })
3364
- )
3365
- ),
3366
- T(this.destroy$)
3367
- ).subscribe();
3368
- }
3369
- enter({
3370
- element: e,
3371
- scale: t = 1,
3372
- animate: i
3373
- } = {}) {
3374
- const o = this.reader.context.value.rootElement, s = this.reader.viewport.value.element;
3375
- let r;
3376
- if (o && e) {
3377
- r = o.ownerDocument.createElement("div"), r.style.cssText = `
3378
- top: 0;
3379
- left: 0;
3380
- display: block;
3381
- position: absolute;
3382
- z-index: 1;
3383
- background: black;
3384
- width: 100%;
3385
- height: 100%;
3386
- user-select: none;
3387
- `;
3388
- const a = e.cloneNode();
3389
- a.src = e.src, a.style.setProperty("height", "100%"), a.style.setProperty("width", "100%"), a.style.setProperty("object-fit", "contain"), a.style.setProperty("pointer-events", "none"), r.appendChild(a), o.appendChild(r);
3390
- }
3391
- i && !e && (s.style.transition = `transform ${Oe}ms`), this.setScale(t), this.mergeCompare({
3392
- element: r,
3393
- isZooming: !0,
3394
- currentScale: t,
3395
- currentPosition: { x: 0, y: 0 }
3396
- });
3397
- }
3398
- exit() {
3399
- super.exit();
3400
- const e = this.reader.viewport.value.element;
3401
- this.value.element || (e.style.transformOrigin = "", e.style.transform = ""), this.value.element?.remove(), this.mergeCompare({
3402
- element: void 0,
3403
- isZooming: !1,
3404
- currentScale: 1,
3405
- currentPosition: { x: 0, y: 0 }
3406
- });
3407
- }
3408
- moveAt(e) {
3409
- this.value.element?.querySelector("img")?.style.setProperty(
3410
- "transform",
3411
- `translate3d(${e.x}px, ${e.y}px, 0px) scale3d(${this.value.currentScale}, ${this.value.currentScale}, 1)`
3412
- ), this.mergeCompare({
3413
- currentPosition: e
3414
- });
3415
- }
3416
- setElementScale(e, t) {
3417
- e.querySelector("img")?.style.setProperty(
3418
- "transform",
3419
- `translate3d(${this.value.currentPosition.x}px, ${this.value.currentPosition.y}px, 0px) scale3d(${t}, ${t}, 1)`
3378
+ ) : Z;
3379
+ })
3380
+ ), i = this.exitSubject.pipe(
3381
+ w((o) => {
3382
+ const s = this.reader.viewport.value.element;
3383
+ return this.viewport.element.setAttribute(
3384
+ `data-${W}-zooming`,
3385
+ "false"
3386
+ ), this.scrollNavigationController.value.element?.removeAttribute(
3387
+ `data-${W}-zooming-direction`
3388
+ ), this.scrollNavigationController.value.element?.setAttribute(
3389
+ `data-${W}-zooming`,
3390
+ "false"
3391
+ ), o?.animate && this.isControlled && (s.style.transition = `transform ${ve}ms`), this.updateZoom(1, { x: 0, y: 0 }), s.style.transform = "", Te(o?.animate ? ve : 0).pipe(
3392
+ x(() => {
3393
+ const r = this.reader.viewport.value.element;
3394
+ r.style.transformOrigin = "", r.style.transition = "", this.isControlled && this.reader.layout(), this.mergeCompare({
3395
+ isZooming: !1
3396
+ });
3397
+ }),
3398
+ T(this.enterSubject)
3399
+ );
3400
+ })
3420
3401
  );
3402
+ P(t, i).pipe(T(this.destroy$)).subscribe();
3421
3403
  }
3422
- setViewportScale(e) {
3423
- const t = this.reader.viewport.value.element;
3424
- t.style.transformOrigin = "center", t.style.transform = `scale(${e})`;
3404
+ enter(e) {
3405
+ this.enterSubject.next(e);
3425
3406
  }
3426
- setScale(e) {
3427
- this.value.element ? this.setElementScale(this.value.element, e) : this.setViewportScale(e);
3407
+ exit(e) {
3408
+ this.exitSubject.next(e);
3409
+ }
3410
+ move(e) {
3411
+ this.isControlled && (this.viewport.element.style.transition = "", this.updateZoom(this.value.currentScale, e));
3428
3412
  }
3429
3413
  scaleAt(e) {
3430
- const t = e;
3431
- this.setScale(t), this.mergeCompare({
3432
- currentScale: t
3414
+ this.viewport.element.style.transition = "";
3415
+ const i = Math.ceil(e * 100) / 100;
3416
+ this.updateZoom(i);
3417
+ }
3418
+ updateZoom(e, t) {
3419
+ if (this.isControlled) {
3420
+ const i = t || $o(
3421
+ this.value.currentScale,
3422
+ e,
3423
+ this.viewport.element,
3424
+ this.value.currentPosition
3425
+ );
3426
+ return this.applyZoom(e, i), this.mergeCompare({
3427
+ currentScale: e,
3428
+ currentPosition: i
3429
+ });
3430
+ }
3431
+ this.applyZoom(e, t ?? this.value.currentPosition), this.mergeCompare({
3432
+ currentScale: e
3433
3433
  });
3434
3434
  }
3435
- }
3436
- const $o = "[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}", To = (n, e, t, i, o) => {
3437
- 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, g = u * d, h = l * d, p = g - s / 2 + i, m = h - r / 2 + o;
3438
- return { newScrollLeft: p, newScrollTop: m };
3439
- };
3440
- class Fo extends qt {
3441
- enter({ scale: e = 1 } = {}) {
3442
- this.setScale(e), this.mergeCompare({
3443
- currentPosition: { x: 0, y: 0 },
3444
- currentScale: e,
3445
- isZooming: !0
3446
- }), this.scrollNavigationController.value.element?.setAttribute(
3447
- `data-${G}-zooming`,
3448
- "true"
3449
- );
3435
+ applyZoom(e, t) {
3436
+ if (this.isControlled)
3437
+ xo(
3438
+ e,
3439
+ t,
3440
+ this.viewport.element
3441
+ );
3442
+ else {
3443
+ const i = Fo(e, this.reader);
3444
+ this.reader.navigation.navigate({
3445
+ position: i
3446
+ });
3447
+ }
3450
3448
  }
3451
- exit() {
3452
- super.exit(), this.setScale(1), this.mergeCompare({
3453
- isZooming: !1,
3454
- currentScale: 1
3455
- });
3449
+ get isControlled() {
3450
+ return this.reader.settings.values.computedPageTurnMode === "controlled";
3456
3451
  }
3457
- /**
3458
- * Panning is directly managed through the scroll navigator element.
3459
- */
3460
- moveAt() {
3461
- E.warn("moveAt should not be called on scroll mode");
3462
- }
3463
- setScale(e) {
3464
- const t = this.reader.viewport.value.element, i = this.reader.navigation.scrollNavigationController.value.element, o = this.reader.navigation.scrollNavigationController.value.element;
3465
- if (!t || !o) return;
3466
- const s = this.reader.viewport.scaleFactor, r = t.offsetLeft, a = t.offsetTop, { newScrollLeft: c, newScrollTop: u } = To(
3467
- i ?? An(),
3468
- s,
3469
- e,
3470
- r,
3471
- a
3472
- ), l = e < 1 ? "down" : "up";
3473
- o.setAttribute(
3474
- `data-${G}-zooming-direction`,
3475
- l
3476
- ), e < 1 ? t.style.transformOrigin = "top" : e > 1 && (t.style.transformOrigin = `${r}px ${a}px`), t.style.transform = `scale(${e})`;
3477
- const d = this.reader.navigation.scrollNavigationController.fromScrollPosition({
3478
- x: c,
3479
- y: u
3480
- });
3481
- this.reader.navigation.navigate({
3482
- position: d
3483
- });
3452
+ get scrollNavigationController() {
3453
+ return this.reader.navigation.scrollNavigationController;
3484
3454
  }
3485
- scaleAt(e) {
3486
- const i = Math.ceil(e * 100) / 100;
3487
- this.setScale(i), this.mergeCompare({
3488
- currentScale: i
3489
- });
3455
+ get viewport() {
3456
+ return this.reader.viewport.value;
3490
3457
  }
3491
3458
  }
3492
- const ft = `${Ut}-enhancer-zoom`, Lo = (n) => (e) => {
3493
- const t = n(e), i = {
3494
- currentPosition: { x: 0, y: 0 },
3495
- currentScale: 1,
3496
- element: void 0,
3497
- isZooming: !1
3498
- }, o = new Po(t), s = new Fo(t), r = new W(
3499
- void 0
3500
- );
3501
- Je(document, ft, $o);
3502
- const a = (l) => {
3503
- const d = t.settings.values.computedPageTurnMode === "scrollable" ? s : o;
3504
- r.next(d), d.enter(l);
3505
- }, c = () => {
3506
- Ke(document, ft), o.exit(), s.exit(), r.complete(), t.destroy();
3507
- }, u = r.pipe(
3508
- w((l) => l ?? v(i))
3509
- );
3459
+ const ft = `${Ut}-enhancer-zoom`, Mo = (n) => (e) => {
3460
+ const t = n(e), i = new Lo(t);
3461
+ Je(document, ft, Po);
3462
+ const o = () => {
3463
+ Ke(document, ft), i.destroy(), t.destroy();
3464
+ }, s = i;
3510
3465
  return {
3511
3466
  ...t,
3512
- destroy: c,
3467
+ destroy: o,
3513
3468
  zoom: {
3514
- enter: a,
3515
- scaleAt: (l) => r.getValue()?.scaleAt(l),
3516
- moveAt: (l) => r.getValue()?.moveAt(l),
3517
- exit: () => {
3518
- r?.getValue()?.exit(), r.next(void 0);
3519
- },
3520
- state$: u,
3469
+ enter: i.enter.bind(i),
3470
+ scaleAt: i.scaleAt.bind(i),
3471
+ move: i.move.bind(i),
3472
+ exit: i.exit.bind(i),
3473
+ state$: s,
3521
3474
  get state() {
3522
- return r.getValue()?.value ?? i;
3475
+ return i.value;
3523
3476
  }
3524
3477
  }
3525
3478
  };
3526
- }, Gt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3527
- class Mo {
3479
+ }, qt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3480
+ class Co {
3528
3481
  constructor() {
3529
- this.navigationSubject = new st(1), this.viewportStateSubject = new W("free"), this.paginationSubject = new st(), this.navigationIsLockedSubject = new W(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3482
+ this.navigationSubject = new st(1), this.viewportStateSubject = new H("free"), this.paginationSubject = new st(), this.navigationIsLockedSubject = new H(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3530
3483
  z(),
3531
3484
  L((e) => !e)
3532
3485
  ), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
@@ -3536,11 +3489,11 @@ class Mo {
3536
3489
  ), this.navigation$ = this.navigationSubject.asObservable();
3537
3490
  }
3538
3491
  }
3539
- class Co extends ce {
3492
+ class Eo extends ce {
3540
3493
  constructor() {
3541
3494
  super({
3542
3495
  assumedRenditionLayout: "reflowable"
3543
- }), this.bridgeEvent = new Mo(), this.manifest$ = this.pipe(
3496
+ }), this.bridgeEvent = new Co(), this.manifest$ = this.pipe(
3544
3497
  K((e) => e.manifest),
3545
3498
  se(le),
3546
3499
  pe()
@@ -3551,7 +3504,7 @@ class Co extends ce {
3551
3504
  ...t,
3552
3505
  ...e,
3553
3506
  ...e.manifest && {
3554
- isFullyPrePaginated: Gt(i),
3507
+ isFullyPrePaginated: qt(i),
3555
3508
  assumedRenditionLayout: i?.renditionLayout ?? "reflowable"
3556
3509
  }
3557
3510
  };
@@ -3564,7 +3517,7 @@ class Co extends ce {
3564
3517
  return this.manifest?.readingDirection;
3565
3518
  }
3566
3519
  }
3567
- class Eo extends ce {
3520
+ class Do extends ce {
3568
3521
  constructor(e, t) {
3569
3522
  super({
3570
3523
  supportedPageTurnAnimation: ["fade", "none", "slide"],
@@ -3581,7 +3534,7 @@ class Eo extends ce {
3581
3534
  renditionLayout: i?.renditionLayout,
3582
3535
  computedPageTurnMode: s
3583
3536
  })),
3584
- z(N),
3537
+ z(V),
3585
3538
  S(
3586
3539
  ({
3587
3540
  hasVerticalWriting: i,
@@ -3599,7 +3552,7 @@ class Eo extends ce {
3599
3552
  ).subscribe(this.next.bind(this));
3600
3553
  }
3601
3554
  }
3602
- class Do {
3555
+ class Ro {
3603
3556
  constructor() {
3604
3557
  this._hooks = [], this._hookExecutions = [];
3605
3558
  }
@@ -3630,7 +3583,7 @@ class Do {
3630
3583
  (r) => e === r.name
3631
3584
  ).map((r) => {
3632
3585
  let a = () => v(void 0);
3633
- const c = new j(), u = (g) => {
3586
+ const c = new R(), u = (g) => {
3634
3587
  a = g;
3635
3588
  }, l = () => (c.next(), c.complete(), a() ?? v(void 0)), d = r.runFn({
3636
3589
  // biome-ignore lint/suspicious/noExplicitAny: TODO
@@ -3661,30 +3614,30 @@ class Do {
3661
3614
  return k(s);
3662
3615
  }
3663
3616
  }
3664
- const Ro = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position:relative;overflow-y:scroll;overflow-x:hidden}", Ao = (n) => ({
3617
+ 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%}", Oo = (n) => ({
3665
3618
  x: -n.x,
3666
3619
  y: -n.y
3667
- }), Oo = (n) => n instanceof DOMMatrix ? new M({
3620
+ }), No = (n) => n instanceof DOMMatrix ? new M({
3668
3621
  x: -n.e,
3669
3622
  y: -n.f
3670
3623
  }) : new M({
3671
3624
  x: -n.x,
3672
3625
  y: -n.y
3673
- }), No = "navigation/ViewportNavigator", yt = E.namespace(No);
3674
- class Vo extends B {
3626
+ }), Vo = "navigation/ViewportNavigator", yt = D.namespace(Vo);
3627
+ class jo extends X {
3675
3628
  constructor(e, t, i, o, s) {
3676
- super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new j(), this.element$ = new W(
3629
+ super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new R(), this.element$ = new H(
3677
3630
  document.createElement("div")
3678
3631
  );
3679
3632
  const r = this.spine.element$.pipe(
3680
3633
  L(Ge),
3681
- A(this.element$),
3682
- P(([l, d]) => {
3634
+ O(this.element$),
3635
+ x(([l, d]) => {
3683
3636
  d.style.cssText = `
3684
3637
  height: 100%;
3685
3638
  width: 100%;
3686
3639
  position: relative;
3687
- `, d.className = `${G}-controlled-navigator`, d.innerHTML = "", d.appendChild(l), this.viewport.value.element.appendChild(d), this.element$.next(d);
3640
+ `, d.className = `${W}-controlled-navigator`, d.innerHTML = "", d.appendChild(l), this.viewport.value.element.appendChild(d), this.element$.next(d);
3688
3641
  })
3689
3642
  ), a = e.watch([
3690
3643
  "computedPageTurnDirection",
@@ -3694,18 +3647,18 @@ class Vo extends B {
3694
3647
  a,
3695
3648
  this.element$
3696
3649
  ]).pipe(
3697
- P(([, l]) => {
3650
+ x(([, l]) => {
3698
3651
  e.values.computedPageTurnMode === "scrollable" ? l.style.display = "contents" : l.style.display = "block";
3699
3652
  })
3700
3653
  );
3701
3654
  this.layout$ = c.pipe(
3702
- P(() => {
3655
+ x(() => {
3703
3656
  yt.info("layout", e.values);
3704
3657
  }),
3705
- D()
3658
+ E()
3706
3659
  );
3707
3660
  const u = this.navigateSubject.pipe(
3708
- P((l) => {
3661
+ x((l) => {
3709
3662
  yt.info("Navigation requested", l);
3710
3663
  })
3711
3664
  );
@@ -3718,10 +3671,10 @@ class Vo extends B {
3718
3671
  })),
3719
3672
  w((l) => {
3720
3673
  const d = this.element$.getValue();
3721
- return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"), x(
3674
+ return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"), P(
3722
3675
  v(!0),
3723
3676
  v(null).pipe(
3724
- Pe(() => {
3677
+ $e(() => {
3725
3678
  if (l?.type !== "manualAdjust") return v(!1);
3726
3679
  const g = l.animation === "snap" ? e.values.snapAnimationDuration : e.values.computedPageTurnAnimationDuration, h = l.animation === "snap" ? "slide" : e.values.computedPageTurnAnimation;
3727
3680
  return v(l).pipe(
@@ -3733,8 +3686,8 @@ class Vo extends B {
3733
3686
  * anything for x ms while we effectively adjust. We want it to be immediate.
3734
3687
  * However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
3735
3688
  */
3736
- l.shouldAnimate ? ve(1, re) : we,
3737
- P((p) => {
3689
+ l.shouldAnimate ? we(1, re) : Pe,
3690
+ x((p) => {
3738
3691
  const m = this.element$.getValue();
3739
3692
  p.shouldAnimate ? h === "fade" ? (m.style.setProperty(
3740
3693
  "transition",
@@ -3752,16 +3705,16 @@ class Vo extends B {
3752
3705
  * need to adjust to anchor to the payload position. This is because we use viewport computed position,
3753
3706
  * not the value set by `setProperty`
3754
3707
  */
3755
- P((p) => {
3708
+ x((p) => {
3756
3709
  h !== "fade" && this.setViewportPosition(p.position);
3757
3710
  }),
3758
- l.shouldAnimate ? ve(g / 2, re) : we,
3759
- P((p) => {
3711
+ l.shouldAnimate ? we(g / 2, re) : Pe,
3712
+ x((p) => {
3760
3713
  const m = this.element$.getValue();
3761
3714
  h === "fade" && (this.setViewportPosition(p.position), m.style.setProperty("opacity", "1"));
3762
3715
  }),
3763
- l.shouldAnimate ? ve(g / 2, re) : we,
3764
- P((p) => {
3716
+ l.shouldAnimate ? we(g / 2, re) : Pe,
3717
+ x((p) => {
3765
3718
  h === "fade" && this.setViewportPosition(p.position);
3766
3719
  })
3767
3720
  );
@@ -3772,7 +3725,7 @@ class Vo extends B {
3772
3725
  }),
3773
3726
  ee(!1),
3774
3727
  J(1)
3775
- ), x(r, this.isNavigating$, this.layout$).pipe(T(this.destroy$)).subscribe();
3728
+ ), P(r, this.isNavigating$, this.layout$).pipe(T(this.destroy$)).subscribe();
3776
3729
  }
3777
3730
  /**
3778
3731
  * Programmatically set the viewport position.
@@ -3783,7 +3736,7 @@ class Vo extends B {
3783
3736
  * for remark about flicker / fonts smoothing
3784
3737
  */
3785
3738
  setViewportPosition(e) {
3786
- const t = this.element$.getValue(), i = Ao(e);
3739
+ const t = this.element$.getValue(), i = Oo(e);
3787
3740
  t.style.transform = `translate(${i.x}px, ${i.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3788
3741
  }
3789
3742
  navigate(e) {
@@ -3798,21 +3751,21 @@ class Vo extends B {
3798
3751
  if (!i || i === "none")
3799
3752
  return new M({ x: 0, y: 0 });
3800
3753
  const o = new DOMMatrix(i);
3801
- return Oo(o);
3754
+ return No(o);
3802
3755
  }
3803
3756
  }
3804
- class jo {
3757
+ class ko {
3805
3758
  constructor(e) {
3806
3759
  this.x = e.x, this.y = e.y;
3807
3760
  }
3808
3761
  }
3809
- class St extends jo {
3762
+ class St extends ko {
3810
3763
  }
3811
- class ko extends ce {
3764
+ class Uo extends ce {
3812
3765
  constructor(e, t, i, o, s) {
3813
3766
  super({
3814
3767
  element: void 0
3815
- }), this.viewport = e, this.settings = t, this.hookManager = i, this.spine = o, this.context = s, this.navigateSubject = new j(), this.scrollingSubject = new W(!1), this.isScrolling$ = this.scrollingSubject.asObservable(), this.setViewportPosition = ({
3768
+ }), this.viewport = e, this.settings = t, this.hookManager = i, this.spine = o, this.context = s, this.navigateSubject = new R(), this.scrollingSubject = new H(!1), this.isScrolling$ = this.scrollingSubject.asObservable(), this.setViewportPosition = ({
3816
3769
  position: d
3817
3770
  }) => {
3818
3771
  const g = this.value.element;
@@ -3822,46 +3775,46 @@ class ko extends ce {
3822
3775
  left: h.x,
3823
3776
  top: h.y,
3824
3777
  behavior: "instant"
3825
- }), $e(1).pipe(
3826
- P(() => {
3778
+ }), Te(1).pipe(
3779
+ x(() => {
3827
3780
  this.scrollingSubject.next(!1);
3828
3781
  }),
3829
- T(x(this.scrollingSubject.pipe(Lt(1)), this.destroy$))
3782
+ T(P(this.scrollingSubject.pipe(Lt(1)), this.destroy$))
3830
3783
  ).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3831
3784
  };
3832
3785
  const r = this.context.pipe(
3833
3786
  et(["rootElement"]),
3834
- P(({ rootElement: d }) => {
3787
+ x(({ rootElement: d }) => {
3835
3788
  if (!d) return;
3836
3789
  const g = document.createElement("div");
3837
- g.setAttribute(`data-${ri}`, ""), g.appendChild(this.viewport.value.element), d.appendChild(g), this.update({ element: g });
3790
+ g.setAttribute(`data-${si}`, ""), g.appendChild(this.viewport.value.element), d.appendChild(g), this.update({ element: g });
3838
3791
  })
3839
3792
  ), a = k([
3840
3793
  t.watch(["computedPageTurnMode"]),
3841
3794
  this.watch("element")
3842
3795
  ]).pipe(
3843
- P(([{ computedPageTurnMode: d }, g]) => {
3796
+ x(([{ computedPageTurnMode: d }, g]) => {
3844
3797
  g && (d === "scrollable" ? g.style.display = "block" : g.style.display = "contents");
3845
3798
  })
3846
- ), c = this.navigateSubject.pipe(P(this.setViewportPosition));
3799
+ ), c = this.navigateSubject.pipe(x(this.setViewportPosition));
3847
3800
  this.isNavigating$ = this.navigateSubject.pipe(
3848
3801
  ee(!1),
3849
- w(() => x(v(!0), v(!1))),
3802
+ w(() => P(v(!0), v(!1))),
3850
3803
  J(1)
3851
3804
  );
3852
- const u = x(
3805
+ const u = P(
3853
3806
  o.element$.pipe(
3854
3807
  L(le),
3855
3808
  w((d) => tt(d))
3856
3809
  ),
3857
3810
  o.element$.pipe(
3858
3811
  L(le),
3859
- w((d) => Y(d, "scroll"))
3812
+ w((d) => q(d, "scroll"))
3860
3813
  ),
3861
3814
  o.spineItemsObserver.itemResize$
3862
3815
  ).pipe(
3863
3816
  w(
3864
- () => $e(10).pipe(
3817
+ () => Te(10).pipe(
3865
3818
  S(() => !1),
3866
3819
  ee(!0)
3867
3820
  )
@@ -3882,8 +3835,8 @@ class ko extends ce {
3882
3835
  w(
3883
3836
  (d) => t.watch(["computedPageTurnMode"]).pipe(
3884
3837
  w(
3885
- ({ computedPageTurnMode: g }) => g === "controlled" ? ge : Y(d, "scroll").pipe(
3886
- A(l),
3838
+ ({ computedPageTurnMode: g }) => g === "controlled" ? ge : q(d, "scroll").pipe(
3839
+ O(l),
3887
3840
  L(
3888
3841
  ([, h]) => !h
3889
3842
  ),
@@ -3892,8 +3845,8 @@ class ko extends ce {
3892
3845
  )
3893
3846
  )
3894
3847
  ),
3895
- D()
3896
- ), x(r, a, c).pipe(T(this.destroy$)).subscribe();
3848
+ E()
3849
+ ), P(r, a, c).pipe(T(this.destroy$)).subscribe();
3897
3850
  }
3898
3851
  update(e) {
3899
3852
  this.mergeCompare(e);
@@ -3923,7 +3876,7 @@ class ko extends ce {
3923
3876
  });
3924
3877
  }
3925
3878
  }
3926
- const Uo = () => (n) => n.pipe(
3879
+ const zo = () => (n) => n.pipe(
3927
3880
  S(({ navigation: e, pagination: t, ...i }) => ({
3928
3881
  navigation: {
3929
3882
  ...e,
@@ -3931,8 +3884,8 @@ const Uo = () => (n) => n.pipe(
3931
3884
  },
3932
3885
  ...i
3933
3886
  }))
3934
- ), zo = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3935
- A(e),
3887
+ ), Wo = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3888
+ O(e),
3936
3889
  L(
3937
3890
  ([i, o]) => i.navigationId === o.id
3938
3891
  ),
@@ -3948,7 +3901,7 @@ const Uo = () => (n) => n.pipe(
3948
3901
  navigation: o
3949
3902
  }))
3950
3903
  )),
3951
- Uo(),
3904
+ zo(),
3952
3905
  z(
3953
3906
  (i, o) => i.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
3954
3907
  ),
@@ -3960,7 +3913,7 @@ const Uo = () => (n) => n.pipe(
3960
3913
  }
3961
3914
  })
3962
3915
  )
3963
- ), Wo = ({ navigationResolver: n }) => (e) => e.pipe(
3916
+ ), _o = ({ navigationResolver: n }) => (e) => e.pipe(
3964
3917
  S(([t, i]) => {
3965
3918
  const o = {
3966
3919
  type: "api",
@@ -3992,7 +3945,7 @@ const Uo = () => (n) => n.pipe(
3992
3945
  navigation: o
3993
3946
  };
3994
3947
  })
3995
- ), _o = ({ navigationResolver: n }) => (e) => e.pipe(
3948
+ ), Ho = ({ navigationResolver: n }) => (e) => e.pipe(
3996
3949
  S((t) => {
3997
3950
  if (t.navigation.cfi) {
3998
3951
  const i = n.getNavigationForCfi(
@@ -4009,16 +3962,16 @@ const Uo = () => (n) => n.pipe(
4009
3962
  }
4010
3963
  return t;
4011
3964
  })
4012
- ), Ho = ({
3965
+ ), Bo = ({
4013
3966
  navigation: n,
4014
3967
  previousNavigation: e,
4015
3968
  settings: t
4016
- }) => 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", Bo = ({
3969
+ }) => 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 = ({
4017
3970
  context: n,
4018
3971
  settings: e
4019
3972
  }) => (t) => t.pipe(
4020
3973
  S(({ navigation: i, previousNavigation: o }) => {
4021
- const s = Ho({
3974
+ const s = Bo({
4022
3975
  navigation: i,
4023
3976
  previousNavigation: o,
4024
3977
  settings: e
@@ -4032,7 +3985,7 @@ const Uo = () => (n) => n.pipe(
4032
3985
  direction: s
4033
3986
  };
4034
3987
  })
4035
- ), Xo = ({
3988
+ ), Yo = ({
4036
3989
  spineItemsManager: n,
4037
3990
  navigationResolver: e,
4038
3991
  settings: t
@@ -4117,8 +4070,8 @@ const Uo = () => (n) => n.pipe(
4117
4070
  position: F,
4118
4071
  threshold: d,
4119
4072
  restrictToScreen: !1
4120
- }), R = l === "forward" || l === "anchor" ? $?.beginIndex : $?.endIndex;
4121
- return e.get(R);
4073
+ }), A = l === "forward" || l === "anchor" ? $?.beginIndex : $?.endIndex;
4074
+ return e.get(A);
4122
4075
  }
4123
4076
  return a && g === "scrollable" ? i.getSpineItemFromPosition(a) : e.get(0);
4124
4077
  };
@@ -4201,7 +4154,7 @@ const Uo = () => (n) => n.pipe(
4201
4154
  ...a
4202
4155
  }))
4203
4156
  );
4204
- }, Yo = ({ navigationResolver: n }) => (e) => e.pipe(
4157
+ }, qo = ({ navigationResolver: n }) => (e) => e.pipe(
4205
4158
  S((t) => {
4206
4159
  if (t.navigation.url) {
4207
4160
  const i = n.getNavigationForUrl(
@@ -4220,9 +4173,9 @@ const Uo = () => (n) => n.pipe(
4220
4173
  return t;
4221
4174
  })
4222
4175
  );
4223
- class Zt {
4176
+ class Gt {
4224
4177
  constructor() {
4225
- this.isLockedSubject = new W(0), this.isLocked$ = this.isLockedSubject.pipe(
4178
+ this.isLockedSubject = new H(0), this.isLocked$ = this.isLockedSubject.pipe(
4226
4179
  S((e) => !!e),
4227
4180
  z()
4228
4181
  );
@@ -4234,7 +4187,7 @@ class Zt {
4234
4187
  };
4235
4188
  }
4236
4189
  }
4237
- const qo = ({
4190
+ const Go = ({
4238
4191
  spineLocator: n,
4239
4192
  navigation: e,
4240
4193
  navigationResolver: t,
@@ -4291,7 +4244,7 @@ const qo = ({
4291
4244
  return c ? t.getNavigationForPosition(e.position) : t.getNavigationForSpineIndexOrId(s);
4292
4245
  })
4293
4246
  ) : v(new M({ x: 0, y: 0 }));
4294
- }, Go = ({
4247
+ }, Zo = ({
4295
4248
  navigation: n,
4296
4249
  spineLocator: e,
4297
4250
  spineItemsManager: t,
@@ -4360,7 +4313,7 @@ const qo = ({
4360
4313
  }
4361
4314
  }
4362
4315
  return n.position;
4363
- }, Zo = ({
4316
+ }, Jo = ({
4364
4317
  navigation: n,
4365
4318
  spineItemsManager: e,
4366
4319
  settings: t,
@@ -4368,7 +4321,7 @@ const qo = ({
4368
4321
  navigationResolver: o,
4369
4322
  spine: s
4370
4323
  }) => t.values.computedPageTurnMode === "scrollable" ? v(
4371
- Go({
4324
+ Zo({
4372
4325
  navigation: n,
4373
4326
  spineLocator: i,
4374
4327
  navigationResolver: o,
@@ -4376,7 +4329,7 @@ const qo = ({
4376
4329
  spineItemsManager: e,
4377
4330
  spine: s
4378
4331
  })
4379
- ) : qo({
4332
+ ) : Go({
4380
4333
  navigation: n,
4381
4334
  spineLocator: i,
4382
4335
  navigationResolver: o,
@@ -4388,7 +4341,7 @@ const qo = ({
4388
4341
  context: t,
4389
4342
  spine: i
4390
4343
  }) => (o) => o.pipe(
4391
- w((s) => Zo({
4344
+ w((s) => Jo({
4392
4345
  spineLocator: i.locator,
4393
4346
  navigation: s.navigation,
4394
4347
  navigationResolver: e,
@@ -4405,10 +4358,10 @@ const qo = ({
4405
4358
  }
4406
4359
  }))
4407
4360
  ))
4408
- ), Jo = "navigation/InternalNavigator", Ko = E.namespace(Jo);
4409
- class Qo extends B {
4361
+ ), Ko = "navigation/InternalNavigator", Qo = D.namespace(Ko);
4362
+ class es extends X {
4410
4363
  constructor(e, t, i, o, s, r, a, c) {
4411
- super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isUserLocked$ = c, this.navigationSubject = new W({
4364
+ super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isUserLocked$ = c, this.navigationSubject = new H({
4412
4365
  animation: !1,
4413
4366
  position: new M({ x: 0, y: 0 }),
4414
4367
  meta: {
@@ -4423,30 +4376,30 @@ class Qo extends B {
4423
4376
  id: I
4424
4377
  })),
4425
4378
  z(
4426
- ({ position: f, ...I }, { position: b, ...F }) => N(I, F) && N(f, b)
4379
+ ({ position: f, ...I }, { position: b, ...F }) => V(I, F) && V(f, b)
4427
4380
  ),
4428
4381
  J(1)
4429
- ), this.locker = new Zt();
4382
+ ), this.locker = new Gt();
4430
4383
  const u = i.pipe(
4431
- A(this.navigationSubject),
4432
- Wo({
4384
+ O(this.navigationSubject),
4385
+ _o({
4433
4386
  navigationResolver: r
4434
4387
  }),
4435
4388
  /**
4436
4389
  * Url lookup is heavier so we start with it to fill
4437
4390
  * as much information as needed to reduce later lookup
4438
4391
  */
4439
- Yo({
4392
+ qo({
4440
4393
  navigationResolver: r
4441
4394
  }),
4442
4395
  /**
4443
4396
  * Cfi lookup is heavier so we start with it to fill
4444
4397
  * as much information as needed to reduce later lookup
4445
4398
  */
4446
- _o({
4399
+ Ho({
4447
4400
  navigationResolver: r
4448
4401
  }),
4449
- Bo({ context: t, settings: e }),
4402
+ Xo({ context: t, settings: e }),
4450
4403
  It({
4451
4404
  navigationResolver: r,
4452
4405
  settings: e,
@@ -4463,16 +4416,16 @@ class Qo extends B {
4463
4416
  spine: a
4464
4417
  })
4465
4418
  ).pipe(
4466
- Xo({
4419
+ Yo({
4467
4420
  navigationResolver: r,
4468
4421
  spineItemsManager: a.spineItemsManager,
4469
4422
  settings: e
4470
4423
  }),
4471
- A(c),
4424
+ O(c),
4472
4425
  w(([f, I]) => {
4473
4426
  const b = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || I;
4474
4427
  return v(f).pipe(
4475
- b ? we : vt({
4428
+ b ? Pe : vt({
4476
4429
  navigationResolver: r,
4477
4430
  settings: e,
4478
4431
  spine: a,
@@ -4487,9 +4440,9 @@ class Qo extends B {
4487
4440
  navigationResolver: r
4488
4441
  }),
4489
4442
  S((f) => f.navigation),
4490
- D()
4443
+ E()
4491
4444
  ), l = u.pipe(
4492
- A(c),
4445
+ O(c),
4493
4446
  L(([, f]) => f),
4494
4447
  w(([f]) => {
4495
4448
  const I = this.locker.lock();
@@ -4508,8 +4461,8 @@ class Qo extends B {
4508
4461
  T(u)
4509
4462
  );
4510
4463
  }),
4511
- D()
4512
- ), d = x(
4464
+ E()
4465
+ ), d = P(
4513
4466
  o.layout$,
4514
4467
  a.layout$
4515
4468
  ).pipe(
@@ -4532,10 +4485,10 @@ class Qo extends B {
4532
4485
  * it has been controlled outside.
4533
4486
  */
4534
4487
  T(
4535
- x(l, u)
4488
+ P(l, u)
4536
4489
  )
4537
4490
  ))
4538
- ), g = x(
4491
+ ), g = P(
4539
4492
  d,
4540
4493
  l
4541
4494
  ).pipe(
@@ -4579,18 +4532,18 @@ class Qo extends B {
4579
4532
  navigationResolver: r
4580
4533
  }),
4581
4534
  S(({ navigation: f }) => f),
4582
- D()
4583
- ), h = zo(
4535
+ E()
4536
+ ), h = Wo(
4584
4537
  t,
4585
4538
  this.navigationSubject,
4586
4539
  a
4587
- ), p = x(
4540
+ ), p = P(
4588
4541
  g,
4589
4542
  u,
4590
4543
  h
4591
4544
  ), m = (f) => f.pipe(
4592
- P(([I, b]) => {
4593
- Ko.info(
4545
+ x(([I, b]) => {
4546
+ Qo.info(
4594
4547
  `navigation updated from ${I.meta.triggeredBy} of type ${I.type}`,
4595
4548
  {
4596
4549
  previousNavigation: b,
@@ -4599,30 +4552,30 @@ class Qo extends B {
4599
4552
  ), this.navigationSubject.next(I);
4600
4553
  })
4601
4554
  ), y = (f) => f.pipe(
4602
- P(([I, b]) => {
4603
- const F = I.type === "scroll", $ = I.meta.triggeredBy === "pagination", R = I.meta.triggeredBy === "restoration", X = N(
4555
+ x(([I, b]) => {
4556
+ const F = I.type === "scroll", $ = I.meta.triggeredBy === "pagination", A = I.meta.triggeredBy === "restoration", Y = V(
4604
4557
  b.position,
4605
4558
  I.position
4606
4559
  );
4607
- if (F && !R || $ || X)
4560
+ if (F && !A || $ || Y)
4608
4561
  return;
4609
- const H = {
4562
+ const B = {
4610
4563
  position: I.position,
4611
4564
  animation: I.animation
4612
4565
  };
4613
- e.values.computedPageTurnMode === "scrollable" ? this.scrollNavigationController.navigate(H) : this.controlledNavigationController.navigate({
4614
- ...H,
4566
+ e.values.computedPageTurnMode === "scrollable" ? this.scrollNavigationController.navigate(B) : this.controlledNavigationController.navigate({
4567
+ ...B,
4615
4568
  /**
4616
4569
  * @important
4617
4570
  * Explicitly trust the unbound position to be valid at this point.
4618
4571
  * Thanks to consolidation and restoration.
4619
4572
  */
4620
- position: M.from(H.position)
4573
+ position: M.from(B.position)
4621
4574
  });
4622
4575
  })
4623
4576
  );
4624
4577
  p.pipe(
4625
- A(this.navigationSubject),
4578
+ O(this.navigationSubject),
4626
4579
  /**
4627
4580
  * @important
4628
4581
  *
@@ -4639,7 +4592,7 @@ class Qo extends B {
4639
4592
  return this.navigationSubject.getValue();
4640
4593
  }
4641
4594
  }
4642
- const Te = (n, e, t) => {
4595
+ const Fe = (n, e, t) => {
4643
4596
  const i = t - n, o = t * (e * n) / (t || 1);
4644
4597
  return Math.max(0, Math.min(i, o));
4645
4598
  }, Xe = (n, e) => (e || 0) === 0 || (n || 0) === 0 ? 1 : Math.floor(Math.max(1, n / e)), Ve = (n, e, t) => {
@@ -4648,14 +4601,14 @@ const Te = (n, e, t) => {
4648
4601
  }, wt = (n, e, t) => {
4649
4602
  const i = [...Array(t)].map((o, s) => s * e);
4650
4603
  return n <= 0 || t === 0 ? 0 : n >= t * e ? t - 1 : i.findIndex((o) => n < o + e) ?? 0;
4651
- }, es = ({
4604
+ }, ts = ({
4652
4605
  itemWidth: n,
4653
4606
  itemHeight: e,
4654
4607
  spineItemPosition: t
4655
4608
  }) => new C({
4656
4609
  x: Math.min(n, Math.max(0, t.x)),
4657
4610
  y: Math.min(e, Math.max(0, t.y))
4658
- }), Jt = ({
4611
+ }), Zt = ({
4659
4612
  itemHeight: n,
4660
4613
  itemWidth: e,
4661
4614
  isUsingVerticalWriting: t,
@@ -4663,7 +4616,7 @@ const Te = (n, e, t) => {
4663
4616
  pageHeight: o,
4664
4617
  pageTurnDirection: s,
4665
4618
  pageTurnMode: r
4666
- }) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Xe(n, o) : Xe(e, i), xt = ({
4619
+ }) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Xe(n, o) : Xe(e, i), Pt = ({
4667
4620
  itemWidth: n,
4668
4621
  itemHeight: e,
4669
4622
  position: t,
@@ -4674,11 +4627,11 @@ const Te = (n, e, t) => {
4674
4627
  pageTurnMode: a,
4675
4628
  isRTL: c
4676
4629
  }) => {
4677
- const l = es({
4630
+ const l = ts({
4678
4631
  spineItemPosition: t,
4679
4632
  itemHeight: e,
4680
4633
  itemWidth: n
4681
- }).x, d = Jt({
4634
+ }).x, d = Zt({
4682
4635
  isUsingVerticalWriting: i,
4683
4636
  itemHeight: e,
4684
4637
  itemWidth: n,
@@ -4691,7 +4644,7 @@ const Te = (n, e, t) => {
4691
4644
  return wt(t.y, s, d);
4692
4645
  const g = wt(l, o, d);
4693
4646
  return c ? d - 1 - g : g;
4694
- }, ts = ({
4647
+ }, ns = ({
4695
4648
  pageIndex: n,
4696
4649
  itemLayout: e,
4697
4650
  context: t,
@@ -4699,7 +4652,7 @@ const Te = (n, e, t) => {
4699
4652
  viewport: o
4700
4653
  }) => {
4701
4654
  if (i) {
4702
- const r = Te(
4655
+ const r = Fe(
4703
4656
  o.pageSize.height,
4704
4657
  n,
4705
4658
  e.height
@@ -4709,7 +4662,7 @@ const Te = (n, e, t) => {
4709
4662
  y: r
4710
4663
  });
4711
4664
  }
4712
- const s = Te(
4665
+ const s = Fe(
4713
4666
  o.pageSize.width,
4714
4667
  n,
4715
4668
  e.width
@@ -4721,14 +4674,14 @@ const Te = (n, e, t) => {
4721
4674
  x: s,
4722
4675
  y: 0
4723
4676
  });
4724
- }, Kt = ({
4677
+ }, Jt = ({
4725
4678
  context: n,
4726
4679
  settings: e,
4727
4680
  viewport: t
4728
4681
  }) => {
4729
4682
  const i = (a, c, u) => {
4730
4683
  let l;
4731
- 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);
4684
+ 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);
4732
4685
  const d = u.layout.layoutInfo?.width || 0, g = t.pageSize.width;
4733
4686
  if (l !== void 0) {
4734
4687
  const h = Ve(
@@ -4744,14 +4697,14 @@ const Te = (n, e, t) => {
4744
4697
  getSpineItemPositionFromPageIndex: ({
4745
4698
  pageIndex: a,
4746
4699
  spineItem: c
4747
- }) => ts({
4700
+ }) => ns({
4748
4701
  context: n,
4749
4702
  isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
4750
4703
  itemLayout: c.layout.layoutInfo,
4751
4704
  pageIndex: a,
4752
4705
  viewport: t
4753
4706
  }),
4754
- getSpineItemPageIndexFromPosition: (a) => xt({
4707
+ getSpineItemPageIndexFromPosition: (a) => Pt({
4755
4708
  ...a,
4756
4709
  isRTL: n.isRTL(),
4757
4710
  pageWidth: t.pageSize.width,
@@ -4761,7 +4714,7 @@ const Te = (n, e, t) => {
4761
4714
  }),
4762
4715
  getSpineItemPageIndexFromNode: (a, c, u) => {
4763
4716
  const l = i(a, c, u), { height: d, width: g } = u.layout.layoutInfo;
4764
- return l ? xt({
4717
+ return l ? Pt({
4765
4718
  isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
4766
4719
  position: l,
4767
4720
  itemHeight: d,
@@ -4791,36 +4744,36 @@ const Te = (n, e, t) => {
4791
4744
  getSpineItemPagePositionFromSpineItemPosition: (a, c, u) => {
4792
4745
  const { width: l, height: d } = u.layout.layoutInfo, g = t.pageSize.width, h = t.pageSize.height;
4793
4746
  if (!!u.isUsingVerticalWriting()) {
4794
- const y = Te(
4747
+ const y = Fe(
4795
4748
  h,
4796
4749
  c,
4797
4750
  d
4798
4751
  );
4799
- return new Re({
4752
+ return new Ae({
4800
4753
  x: a.x,
4801
4754
  y: a.y - y
4802
4755
  });
4803
4756
  }
4804
- const m = Te(g, c, l);
4757
+ const m = Fe(g, c, l);
4805
4758
  if (n.isRTL()) {
4806
4759
  const y = l - (c + 1) * g;
4807
- return new Re({
4760
+ return new Ae({
4808
4761
  x: a.x - Math.max(0, y),
4809
4762
  y: a.y
4810
4763
  });
4811
4764
  }
4812
- return new Re({
4765
+ return new Ae({
4813
4766
  x: a.x - m,
4814
4767
  y: a.y
4815
4768
  });
4816
4769
  }
4817
4770
  };
4818
- }, ns = ({
4771
+ }, is = ({
4819
4772
  context: n,
4820
4773
  settings: e,
4821
4774
  viewport: t
4822
4775
  }) => {
4823
- const i = Kt({
4776
+ const i = Jt({
4824
4777
  context: n,
4825
4778
  settings: e,
4826
4779
  viewport: t
@@ -4844,7 +4797,7 @@ const Te = (n, e, t) => {
4844
4797
  ) || new C({ x: 0, y: 0 })
4845
4798
  };
4846
4799
  };
4847
- function Qt({
4800
+ function Kt({
4848
4801
  position: n,
4849
4802
  isRTL: e,
4850
4803
  spineItemsManager: t,
@@ -4869,7 +4822,7 @@ function Qt({
4869
4822
  y: u
4870
4823
  });
4871
4824
  }
4872
- const Pt = ({
4825
+ const xt = ({
4873
4826
  position: n,
4874
4827
  isRTL: e,
4875
4828
  pageSizeHeight: t,
@@ -4877,7 +4830,7 @@ const Pt = ({
4877
4830
  visibleAreaRectWidth: o,
4878
4831
  spine: s
4879
4832
  }) => {
4880
- const r = Qt({
4833
+ const r = Kt({
4881
4834
  position: n,
4882
4835
  isRTL: e,
4883
4836
  spineItemsManager: i,
@@ -4930,7 +4883,7 @@ const Pt = ({
4930
4883
  });
4931
4884
  }
4932
4885
  return new M({ x: 0, y: 0 });
4933
- }, is = ({
4886
+ }, os = ({
4934
4887
  pageIndex: n,
4935
4888
  spineItemsManager: e,
4936
4889
  spineItemId: t,
@@ -4960,28 +4913,28 @@ const Pt = ({
4960
4913
  pageSizeWidth: s.pageSize.width,
4961
4914
  visibleAreaRectWidth: s.absoluteViewport.width
4962
4915
  });
4963
- }, os = (n, e) => {
4916
+ }, ss = (n, e) => {
4964
4917
  if (e && e instanceof HTMLIFrameElement)
4965
4918
  return n.startsWith("#") ? e.contentDocument?.getElementById(
4966
4919
  n.replace("#", "")
4967
4920
  ) : e.contentDocument?.querySelector(n);
4968
- }, ss = ({
4921
+ }, rs = ({
4969
4922
  anchor: n,
4970
4923
  spineItem: e,
4971
4924
  spine: t
4972
4925
  }) => {
4973
- const i = os(
4926
+ const i = ss(
4974
4927
  n,
4975
4928
  e.renderer.getDocumentFrame()
4976
4929
  );
4977
4930
  return i ? t.spineItemLocator.getSpineItemPositionFromNode(i, 0, e)?.x ?? 0 : 0;
4978
- }, rs = ({
4931
+ }, as = ({
4979
4932
  anchor: n,
4980
4933
  spineItem: e,
4981
4934
  spineLocator: t,
4982
4935
  spine: i
4983
4936
  }) => {
4984
- const o = ss({
4937
+ const o = rs({
4985
4938
  anchor: n,
4986
4939
  spineItem: e,
4987
4940
  spine: i
@@ -4990,7 +4943,7 @@ const Pt = ({
4990
4943
  spineItemPosition: new C({ x: o, y: 0 }),
4991
4944
  spineItem: e
4992
4945
  });
4993
- }, as = ({
4946
+ }, cs = ({
4994
4947
  anchor: n,
4995
4948
  spineItem: e,
4996
4949
  spineLocator: t,
@@ -4998,7 +4951,7 @@ const Pt = ({
4998
4951
  pageSizeWidth: o,
4999
4952
  visibleAreaRectWidth: s
5000
4953
  }) => {
5001
- const r = rs({
4954
+ const r = as({
5002
4955
  anchor: n,
5003
4956
  spineItem: e,
5004
4957
  spineLocator: t,
@@ -5009,7 +4962,7 @@ const Pt = ({
5009
4962
  pageSizeWidth: o,
5010
4963
  visibleAreaRectWidth: s
5011
4964
  });
5012
- }, cs = ({
4965
+ }, us = ({
5013
4966
  spine: n,
5014
4967
  spineItemsManager: e,
5015
4968
  spineLocator: t,
@@ -5025,7 +4978,7 @@ const Pt = ({
5025
4978
  if (u) {
5026
4979
  const l = e.get(u.id);
5027
4980
  if (l) {
5028
- const d = as({
4981
+ const d = cs({
5029
4982
  anchor: a.hash,
5030
4983
  spineItem: l,
5031
4984
  spine: n,
@@ -5048,7 +5001,7 @@ const Pt = ({
5048
5001
  console.error(a);
5049
5002
  return;
5050
5003
  }
5051
- }, us = ({
5004
+ }, ls = ({
5052
5005
  spineItem: n,
5053
5006
  spineItemPosition: e,
5054
5007
  spineLocator: t,
@@ -5067,7 +5020,7 @@ const Pt = ({
5067
5020
  pageSizeWidth: o.pageSize.width,
5068
5021
  visibleAreaRectWidth: o.absoluteViewport.width
5069
5022
  });
5070
- }, ls = "spineNavigator", ds = ({
5023
+ }, ds = "spineNavigator", ps = ({
5071
5024
  context: n,
5072
5025
  spineItemsManager: e,
5073
5026
  locator: t,
@@ -5075,13 +5028,13 @@ const Pt = ({
5075
5028
  spine: o,
5076
5029
  viewport: s
5077
5030
  }) => {
5078
- const r = ns({
5031
+ const r = is({
5079
5032
  context: n,
5080
5033
  settings: i,
5081
5034
  viewport: s
5082
5035
  });
5083
5036
  return {
5084
- getNavigationForUrl: (h) => cs({
5037
+ getNavigationForUrl: (h) => us({
5085
5038
  context: n,
5086
5039
  spineItemsManager: e,
5087
5040
  spineLocator: t,
@@ -5090,14 +5043,14 @@ const Pt = ({
5090
5043
  visibleAreaRectWidth: s.absoluteViewport.width,
5091
5044
  spine: o
5092
5045
  }),
5093
- getNavigationForSpineItemPage: (h) => is({
5046
+ getNavigationForSpineItemPage: (h) => os({
5094
5047
  ...h,
5095
5048
  spineItemsManager: e,
5096
5049
  spineItemNavigationResolver: r,
5097
5050
  spineLocator: t,
5098
5051
  viewport: s
5099
5052
  }),
5100
- getNavigationFromSpineItemPosition: (h) => us({
5053
+ getNavigationFromSpineItemPosition: (h) => ls({
5101
5054
  ...h,
5102
5055
  spineItemLocator: t.spineItemLocator,
5103
5056
  spineLocator: t,
@@ -5109,7 +5062,7 @@ const Pt = ({
5109
5062
  spineItemsManager: e
5110
5063
  });
5111
5064
  if (!p) {
5112
- E.warn(ls, `unable to detect item id from cfi ${h}`);
5065
+ D.warn(ds, `unable to detect item id from cfi ${h}`);
5113
5066
  return;
5114
5067
  }
5115
5068
  const f = m ? r.getNavigationFromNode(p, m, y) : new C({ x: 0, y: 0 }), I = t.getSpinePositionFromSpineItemPosition({
@@ -5152,7 +5105,7 @@ const Pt = ({
5152
5105
  viewport: s
5153
5106
  }),
5154
5107
  getMostPredominantNavigationForPosition: (h) => {
5155
- const p = i.values.computedPageTurnDirection, m = 0.5, y = p === "horizontal" ? h.x + s.absoluteViewport.width * m : 0, f = p === "horizontal" ? 0 : h.y + s.absoluteViewport.height * m, I = Pt({
5108
+ const p = i.values.computedPageTurnDirection, m = 0.5, y = p === "horizontal" ? h.x + s.absoluteViewport.width * m : 0, f = p === "horizontal" ? 0 : h.y + s.absoluteViewport.height * m, I = xt({
5156
5109
  position: new M({
5157
5110
  x: y,
5158
5111
  y: f
@@ -5170,7 +5123,7 @@ const Pt = ({
5170
5123
  viewport: s
5171
5124
  });
5172
5125
  },
5173
- fromUnboundSpinePosition: (h) => Pt({
5126
+ fromUnboundSpinePosition: (h) => xt({
5174
5127
  position: h,
5175
5128
  isRTL: n.isRTL(),
5176
5129
  pageSizeHeight: s.pageSize.height,
@@ -5178,7 +5131,7 @@ const Pt = ({
5178
5131
  spineItemsManager: e,
5179
5132
  spine: o
5180
5133
  }),
5181
- fromOutOfBoundsSpinePosition: (h) => Qt({
5134
+ fromOutOfBoundsSpinePosition: (h) => Kt({
5182
5135
  position: h,
5183
5136
  isRTL: n.isRTL(),
5184
5137
  spineItemsManager: e,
@@ -5194,7 +5147,7 @@ const Pt = ({
5194
5147
  }),
5195
5148
  spineItemNavigator: r
5196
5149
  };
5197
- }, ps = ({
5150
+ }, gs = ({
5198
5151
  spineItemsManager: n,
5199
5152
  context: e,
5200
5153
  hookManager: t,
@@ -5202,26 +5155,26 @@ const Pt = ({
5202
5155
  settings: o,
5203
5156
  viewport: s
5204
5157
  }) => {
5205
- const r = new j(), a = r.asObservable(), c = new Zt(), u = ds({
5158
+ const r = new R(), a = r.asObservable(), c = new Gt(), u = ps({
5206
5159
  context: e,
5207
5160
  settings: o,
5208
5161
  spineItemsManager: n,
5209
5162
  locator: i.locator,
5210
5163
  spine: i,
5211
5164
  viewport: s
5212
- }), l = new Vo(
5165
+ }), l = new jo(
5213
5166
  o,
5214
5167
  t,
5215
5168
  e,
5216
5169
  i,
5217
5170
  s
5218
- ), d = new ko(
5171
+ ), d = new Uo(
5219
5172
  s,
5220
5173
  o,
5221
5174
  t,
5222
5175
  i,
5223
5176
  e
5224
- ), g = new Qo(
5177
+ ), g = new es(
5225
5178
  o,
5226
5179
  e,
5227
5180
  a,
@@ -5238,7 +5191,7 @@ const Pt = ({
5238
5191
  ]).pipe(
5239
5192
  K((y) => y.some((f) => f) ? "busy" : "free"),
5240
5193
  pe(),
5241
- Me(1)
5194
+ Ce(1)
5242
5195
  );
5243
5196
  return {
5244
5197
  destroy: () => {
@@ -5260,7 +5213,7 @@ const Pt = ({
5260
5213
  navigation$: g.navigation$
5261
5214
  };
5262
5215
  };
5263
- class gs extends ce {
5216
+ class hs extends ce {
5264
5217
  constructor(e, t) {
5265
5218
  super({
5266
5219
  beginPageIndexInSpineItem: void 0,
@@ -5278,10 +5231,10 @@ class gs extends ce {
5278
5231
  this.mergeCompare(e);
5279
5232
  }
5280
5233
  }
5281
- class hs extends B {
5234
+ class ms extends X {
5282
5235
  constructor(e, t, i, o, s) {
5283
5236
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spine = o, this.spineItemLocator = s;
5284
- const r = x(
5237
+ const r = P(
5285
5238
  this.context.bridgeEvent.navigation$,
5286
5239
  o.layout$
5287
5240
  ).pipe(
@@ -5296,8 +5249,8 @@ class hs extends B {
5296
5249
  });
5297
5250
  return this.context.bridgeEvent.navigationUnlocked$.pipe(
5298
5251
  Tt(1),
5299
- A(this.context.bridgeEvent.navigation$),
5300
- P(([, u]) => {
5252
+ O(this.context.bridgeEvent.navigation$),
5253
+ x(([, u]) => {
5301
5254
  const { position: l } = u, d = this.pagination.value, {
5302
5255
  beginIndex: g,
5303
5256
  endIndex: h
@@ -5312,13 +5265,13 @@ class hs extends B {
5312
5265
  }) ?? {}, { endPageIndex: b = 0 } = c({
5313
5266
  spineItem: m,
5314
5267
  position: l
5315
- }) ?? {}, F = y === void 0 || Be(y) || d.beginSpineItemIndex !== g, $ = d.endSpineItemIndex !== h || f === void 0 || Be(f), R = F ? he(p.item) : y, X = $ ? he(m.item) : f, H = p.numberOfPages, ie = m.numberOfPages;
5268
+ }) ?? {}, F = y === void 0 || Be(y) || d.beginSpineItemIndex !== g, $ = d.endSpineItemIndex !== h || f === void 0 || Be(f), A = F ? he(p.item) : y, Y = $ ? he(m.item) : f, B = p.numberOfPages, ie = m.numberOfPages;
5316
5269
  this.pagination.update({
5317
- beginCfi: R,
5318
- beginNumberOfPagesInSpineItem: H,
5270
+ beginCfi: A,
5271
+ beginNumberOfPagesInSpineItem: B,
5319
5272
  beginPageIndexInSpineItem: I,
5320
5273
  beginSpineItemIndex: g,
5321
- endCfi: X,
5274
+ endCfi: Y,
5322
5275
  endNumberOfPagesInSpineItem: ie,
5323
5276
  endPageIndexInSpineItem: b,
5324
5277
  endSpineItemIndex: h,
@@ -5328,8 +5281,8 @@ class hs extends B {
5328
5281
  );
5329
5282
  })
5330
5283
  ), a = r.pipe(
5331
- Ce(this.context.bridgeEvent.viewportFree$),
5332
- P(() => {
5284
+ Ee(this.context.bridgeEvent.viewportFree$),
5285
+ x(() => {
5333
5286
  const {
5334
5287
  beginSpineItemIndex: c,
5335
5288
  endSpineItemIndex: u,
@@ -5353,24 +5306,24 @@ class hs extends B {
5353
5306
  });
5354
5307
  })
5355
5308
  );
5356
- x(r, a).pipe(T(this.destroy$)).subscribe();
5309
+ P(r, a).pipe(T(this.destroy$)).subscribe();
5357
5310
  }
5358
5311
  }
5359
- const ms = ({
5312
+ const fs = ({
5360
5313
  manifest: n,
5361
5314
  spreadMode: e
5362
5315
  }) => n?.renditionFlow === "scrolled-continuous" ? !1 : e;
5363
- class fs extends B {
5316
+ class ys extends X {
5364
5317
  constructor(e) {
5365
5318
  super();
5366
5319
  const t = {
5367
5320
  ...this.getDefaultSettings(),
5368
5321
  ...e
5369
5322
  };
5370
- this.inputSettings = t, this.outputSettingsUpdateSubject = new j(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(J(1)), this._settings$.subscribe();
5323
+ this.inputSettings = t, this.outputSettingsUpdateSubject = new R(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(J(1)), this._settings$.subscribe();
5371
5324
  }
5372
5325
  _prepareUpdate(e) {
5373
- const t = xe(this.inputSettings, e), i = this.getOutputSettings(t), o = !N(this.outputSettings, i);
5326
+ const t = xe(this.inputSettings, e), i = this.getOutputSettings(t), o = !V(this.outputSettings, i);
5374
5327
  return {
5375
5328
  hasChanged: o,
5376
5329
  state: i,
@@ -5398,17 +5351,17 @@ class fs extends B {
5398
5351
  watch(e) {
5399
5352
  return this.values$.pipe(
5400
5353
  Nt(e),
5401
- z(N)
5354
+ z(V)
5402
5355
  );
5403
5356
  }
5404
5357
  destroy() {
5405
5358
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5406
5359
  }
5407
5360
  }
5408
- class ys extends fs {
5361
+ class Ss extends ys {
5409
5362
  constructor(e, t) {
5410
5363
  super(e), this.context = t, t.watch(["manifest", "hasVerticalWriting"]).pipe(
5411
- P(() => this.update(this.values)),
5364
+ x(() => this.update(this.values)),
5412
5365
  T(this.destroy$)
5413
5366
  ).subscribe();
5414
5367
  }
@@ -5418,12 +5371,12 @@ class ys extends fs {
5418
5371
  computedPageTurnAnimation: e.pageTurnAnimation,
5419
5372
  computedPageTurnMode: e.pageTurnMode,
5420
5373
  computedPageTurnAnimationDuration: 0,
5421
- computedSpreadMode: ms({
5374
+ computedSpreadMode: fs({
5422
5375
  spreadMode: e.spreadMode,
5423
5376
  manifest: t
5424
5377
  })
5425
5378
  };
5426
- return t?.renditionFlow === "scrolled-continuous" && (o.computedPageTurnMode = "scrollable"), o.computedPageTurnMode === "scrollable" && (o.computedPageTurnDirection = "vertical"), i && o.computedPageTurnAnimation === "slide" && (E.warn(
5379
+ return t?.renditionFlow === "scrolled-continuous" && (o.computedPageTurnMode = "scrollable"), o.computedPageTurnMode === "scrollable" && (o.computedPageTurnDirection = "vertical"), i && o.computedPageTurnAnimation === "slide" && (D.warn(
5427
5380
  `pageTurnAnimation ${o.computedPageTurnAnimation} incompatible with current book, switching back to default`
5428
5381
  ), o.computedPageTurnAnimation = "none"), o.computedPageTurnMode === "scrollable" ? (o.computedPageTurnAnimationDuration = 0, o.computedPageTurnAnimation = "none") : o.computedPageTurnAnimationDuration = e.pageTurnAnimationDuration !== void 0 ? e.pageTurnAnimationDuration : 300, o;
5429
5382
  }
@@ -5444,7 +5397,7 @@ class ys extends fs {
5444
5397
  };
5445
5398
  }
5446
5399
  }
5447
- class Ss extends fe {
5400
+ class Is extends fe {
5448
5401
  onUnload() {
5449
5402
  return Z;
5450
5403
  }
@@ -5463,14 +5416,14 @@ class Ss extends fe {
5463
5416
  getDocumentFrame() {
5464
5417
  }
5465
5418
  }
5466
- class Is extends B {
5419
+ class bs extends X {
5467
5420
  constructor(e, t, i, o, s, r, a) {
5468
- super(), this.item = e, this.containerElement = t, this.context = i, this.hookManager = o, this.renderer = s, this.settings = r, this.viewport = a, this.layoutTriggerSubject = new j(), this.lastLayout = null, this.applyDimsAfterLayout = ({
5421
+ 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 = ({
5469
5422
  blankPagePosition: c,
5470
5423
  minimumWidth: u
5471
5424
  }) => (l) => l.pipe(
5472
5425
  S((d) => {
5473
- const g = N(
5426
+ const g = V(
5474
5427
  this.lastLayout?.pageSize,
5475
5428
  this.viewport.pageSize
5476
5429
  ) ? this.lastLayout : void 0, { width: h, height: p } = g ?? {}, { width: m = h, height: y = p } = d ?? {}, { width: f, height: I } = this.viewport.pageSize, b = this.validateDimension(
@@ -5493,7 +5446,7 @@ class Is extends B {
5493
5446
  }), { width: b, height: F };
5494
5447
  })
5495
5448
  ), this.layout = (c) => {
5496
- const u = Yn(this.layout$.pipe(U()));
5449
+ const u = Xn(this.layout$.pipe(U()));
5497
5450
  return this.layoutTriggerSubject.next(c), u();
5498
5451
  }, this.adjustPositionOfElement = ({
5499
5452
  right: c,
@@ -5515,7 +5468,7 @@ class Is extends B {
5515
5468
  minimumWidth: l,
5516
5469
  spreadPosition: d
5517
5470
  });
5518
- return x(
5471
+ return P(
5519
5472
  v({ type: "start" }),
5520
5473
  g.pipe(
5521
5474
  this.applyDimsAfterLayout(c),
@@ -5528,11 +5481,11 @@ class Is extends B {
5528
5481
  )
5529
5482
  );
5530
5483
  }),
5531
- D()
5484
+ E()
5532
5485
  ), this.layout$ = this.layoutProcess$.pipe(
5533
5486
  L((c) => c.type === "end"),
5534
5487
  S((c) => c.data),
5535
- D()
5488
+ E()
5536
5489
  );
5537
5490
  }
5538
5491
  validateDimension(e, t, i) {
@@ -5548,7 +5501,7 @@ class Is extends B {
5548
5501
  };
5549
5502
  }
5550
5503
  }
5551
- class en extends ce {
5504
+ class Qt extends ce {
5552
5505
  constructor(e, t, i, o, s, r, a) {
5553
5506
  super({
5554
5507
  isLoaded: !1,
@@ -5564,7 +5517,7 @@ class en extends ce {
5564
5517
  });
5565
5518
  }, this.destroy = () => {
5566
5519
  super.destroy(), this.containerElement.remove(), this.renderer.destroy();
5567
- }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = bs(
5520
+ }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = vs(
5568
5521
  t,
5569
5522
  e,
5570
5523
  s
@@ -5580,7 +5533,7 @@ class en extends ce {
5580
5533
  resourcesHandler: this.resourcesHandler,
5581
5534
  viewport: this.viewport
5582
5535
  };
5583
- this.renderer = c ? c(u) : new Ss(u), this.layout = new Is(
5536
+ this.renderer = c ? c(u) : new Is(u), this.layout = new bs(
5584
5537
  e,
5585
5538
  this.containerElement,
5586
5539
  i,
@@ -5590,20 +5543,20 @@ class en extends ce {
5590
5543
  this.viewport
5591
5544
  );
5592
5545
  const l = this.renderer.state$.pipe(
5593
- V((g) => {
5546
+ j((g) => {
5594
5547
  this.mergeCompare({
5595
5548
  isLoaded: g === "loaded"
5596
5549
  });
5597
5550
  })
5598
5551
  ), d = this.layout.layout$.pipe(
5599
- V(() => {
5552
+ j(() => {
5600
5553
  this.mergeCompare({
5601
5554
  iDirty: !1,
5602
5555
  isReady: this.renderer.state$.value === "loaded"
5603
5556
  });
5604
5557
  })
5605
5558
  );
5606
- this.needsLayout$ = x(this.unloaded$, this.loaded$), x(
5559
+ this.needsLayout$ = P(this.unloaded$, this.loaded$), P(
5607
5560
  /**
5608
5561
  * @important
5609
5562
  * The order is important here. We want to ensure the state value
@@ -5613,7 +5566,7 @@ class en extends ce {
5613
5566
  l,
5614
5567
  d,
5615
5568
  this.layout.layout$
5616
- ).pipe(q(this.destroy$)).subscribe();
5569
+ ).pipe(G(this.destroy$)).subscribe();
5617
5570
  }
5618
5571
  /**
5619
5572
  * Renderer loaded + spine item layout done
@@ -5655,7 +5608,7 @@ class en extends ce {
5655
5608
  return this.renderer.renditionLayout;
5656
5609
  }
5657
5610
  get numberOfPages() {
5658
- return Jt({
5611
+ return Zt({
5659
5612
  isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
5660
5613
  itemHeight: this.layout.layoutInfo.height,
5661
5614
  itemWidth: this.layout.layoutInfo.width,
@@ -5666,22 +5619,22 @@ class en extends ce {
5666
5619
  });
5667
5620
  }
5668
5621
  }
5669
- const bs = (n, e, t) => {
5622
+ const vs = (n, e, t) => {
5670
5623
  const i = n.ownerDocument.createElement("div");
5671
5624
  return i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
5672
5625
  position: absolute;
5673
5626
  overflow: hidden;
5674
5627
  `, i.dataset.isReady = "false", t.execute("item.onBeforeContainerCreated", void 0, { element: i }), i;
5675
5628
  };
5676
- class vs extends B {
5629
+ class ws extends X {
5677
5630
  constructor(e, t, i, o, s) {
5678
- super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new W([]);
5631
+ super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new H([]);
5679
5632
  const r = this.forcedOpenSubject.pipe(
5680
5633
  S((u) => [...new Set(u.flat())].sort()),
5681
- z(yn),
5634
+ z(fn),
5682
5635
  J({ bufferSize: 1, refCount: !0 })
5683
5636
  );
5684
- x(
5637
+ P(
5685
5638
  this.context.bridgeEvent.navigation$,
5686
5639
  this.spineLayout.layout$,
5687
5640
  r,
@@ -5691,8 +5644,8 @@ class vs extends B {
5691
5644
  // Ideally loading faster is better but loading too close to user navigating can
5692
5645
  // be dangerous.
5693
5646
  Se(100, re),
5694
- Ce(this.context.bridgeEvent.viewportFree$),
5695
- A(this.context.bridgeEvent.navigation$, r),
5647
+ Ee(this.context.bridgeEvent.viewportFree$),
5648
+ O(this.context.bridgeEvent.navigation$, r),
5696
5649
  S(([, u, l]) => {
5697
5650
  const { numberOfAdjacentSpineItemToPreLoad: d } = o.values, { beginIndex: g = 0, endIndex: h = 0 } = i.getVisibleSpineItemsFromPosition({
5698
5651
  position: u.position,
@@ -5724,7 +5677,7 @@ class vs extends B {
5724
5677
  super.destroy(), this.forcedOpenSubject.complete();
5725
5678
  }
5726
5679
  }
5727
- const tn = (n, e, t) => {
5680
+ const en = (n, e, t) => {
5728
5681
  const i = (t.width - e.width) / 2, o = (t.height - e.height) / 2;
5729
5682
  return new ae({
5730
5683
  x: n.x - i,
@@ -5749,7 +5702,7 @@ class ye extends DOMRect {
5749
5702
  return new ye(i.x, i.y, i.width, i.height);
5750
5703
  }
5751
5704
  }
5752
- class ws {
5705
+ class Ps {
5753
5706
  constructor({ width: e, height: t }) {
5754
5707
  this.__symbol = Symbol("AbsoluteViewport"), this.width = e, this.height = t;
5755
5708
  }
@@ -5759,7 +5712,7 @@ class xs {
5759
5712
  this.__symbol = Symbol("RelativeViewport"), this.width = e, this.height = t;
5760
5713
  }
5761
5714
  }
5762
- const Ps = ({
5715
+ const $s = ({
5763
5716
  pageIndex: n,
5764
5717
  spineItemOrId: e,
5765
5718
  spineItemsManager: t
@@ -5781,7 +5734,7 @@ const Ps = ({
5781
5734
  { currentAbsolutePage: 0, found: !1 }
5782
5735
  );
5783
5736
  return s;
5784
- }, $s = ({
5737
+ }, Ts = ({
5785
5738
  itemHeight: n,
5786
5739
  itemWidth: e,
5787
5740
  visibleWidthOfItem: t,
@@ -5790,7 +5743,7 @@ const Ps = ({
5790
5743
  }) => {
5791
5744
  const s = t / e, r = i / n;
5792
5745
  return o.type === "percentage" ? s >= o.value && r >= o.value : t >= o.value && i >= o.value;
5793
- }, Ts = ({
5746
+ }, Fs = ({
5794
5747
  visibleWidthOfItem: n,
5795
5748
  visibleHeightOfItem: e,
5796
5749
  threshold: t,
@@ -5798,7 +5751,7 @@ const Ps = ({
5798
5751
  }) => {
5799
5752
  const o = n / i.width, s = e / i.height;
5800
5753
  return t.type === "percentage" ? s >= t.value && o >= t.value : e >= t.value && n >= t.value;
5801
- }, nn = ({
5754
+ }, tn = ({
5802
5755
  itemPosition: {
5803
5756
  bottom: n,
5804
5757
  left: e,
@@ -5822,14 +5775,14 @@ const Ps = ({
5822
5775
  Math.min(n, g) - Math.max(i, d)
5823
5776
  );
5824
5777
  if (h <= 0 || p <= 0) return { visible: !1 };
5825
- const y = Ts({
5778
+ const y = Fs({
5826
5779
  threshold: r,
5827
5780
  visibleHeightOfItem: p,
5828
5781
  visibleWidthOfItem: h,
5829
5782
  viewportPosition: a
5830
5783
  });
5831
5784
  return c ? { visible: y } : {
5832
- visible: $s({
5785
+ visible: Ts({
5833
5786
  itemHeight: s,
5834
5787
  itemWidth: o,
5835
5788
  threshold: r,
@@ -5853,7 +5806,7 @@ const Ps = ({
5853
5806
  }) => new M({
5854
5807
  x: e + n.x,
5855
5808
  y: t + n.y
5856
- }), Fs = ({
5809
+ }), Ls = ({
5857
5810
  position: n,
5858
5811
  threshold: e,
5859
5812
  restrictToScreen: t,
@@ -5868,14 +5821,14 @@ const Ps = ({
5868
5821
  spineLayout: o
5869
5822
  }) || i.get(0), c = i.items.reduce(
5870
5823
  (h, p) => {
5871
- const m = o.getSpineItemSpineLayoutInfo(p), y = s ? r.absoluteViewport : r.relativeViewport, f = tn(
5824
+ const m = o.getSpineItemSpineLayoutInfo(p), y = s ? r.absoluteViewport : r.relativeViewport, f = en(
5872
5825
  n,
5873
5826
  r.absoluteViewport,
5874
5827
  y
5875
5828
  ), I = ye.from(
5876
5829
  f,
5877
5830
  y
5878
- ), { visible: b } = nn({
5831
+ ), { visible: b } = tn({
5879
5832
  itemPosition: m,
5880
5833
  threshold: e,
5881
5834
  viewportPosition: I,
@@ -5891,7 +5844,7 @@ const Ps = ({
5891
5844
  beginIndex: d ?? 0,
5892
5845
  endIndex: g ?? 0
5893
5846
  };
5894
- }, Ls = ({
5847
+ }, Ms = ({
5895
5848
  spineItemsManager: n,
5896
5849
  context: e,
5897
5850
  spineItemLocator: t,
@@ -5937,12 +5890,12 @@ const Ps = ({
5937
5890
  useAbsoluteViewport: I = !0,
5938
5891
  viewport: b
5939
5892
  }) => {
5940
- const F = y.numberOfPages, R = Array.from(Array(F)).map((ie, Ie) => {
5941
- const Ee = t.getSpineItemPositionFromPageIndex({
5893
+ const F = y.numberOfPages, A = Array.from(Array(F)).map((ie, Ie) => {
5894
+ const De = t.getSpineItemPositionFromPageIndex({
5942
5895
  pageIndex: Ie,
5943
5896
  spineItem: y
5944
5897
  }), ue = je({
5945
- spineItemPosition: Ee,
5898
+ spineItemPosition: De,
5946
5899
  itemLayout: o.getSpineItemSpineLayoutInfo(y)
5947
5900
  });
5948
5901
  return {
@@ -5957,28 +5910,28 @@ const Ps = ({
5957
5910
  }
5958
5911
  };
5959
5912
  }).reduce(
5960
- (ie, { absolutePosition: Ie, index: Ee }) => {
5961
- const ue = I ? b.absoluteViewport : b.relativeViewport, on = tn(
5913
+ (ie, { absolutePosition: Ie, index: De }) => {
5914
+ const ue = I ? b.absoluteViewport : b.relativeViewport, nn = en(
5962
5915
  p,
5963
5916
  b.absoluteViewport,
5964
5917
  ue
5965
- ), sn = ye.from(
5966
- on,
5918
+ ), on = ye.from(
5919
+ nn,
5967
5920
  ue
5968
- ), { visible: rn } = nn({
5969
- viewportPosition: sn,
5921
+ ), { visible: sn } = tn({
5922
+ viewportPosition: on,
5970
5923
  restrictToScreen: f,
5971
5924
  threshold: m,
5972
5925
  itemPosition: Ie
5973
5926
  });
5974
- return rn ? [...ie, Ee] : ie;
5927
+ return sn ? [...ie, De] : ie;
5975
5928
  },
5976
5929
  []
5977
- ), X = R[0], H = R[R.length - 1] ?? X;
5978
- if (!(X === void 0 || H === void 0))
5930
+ ), Y = A[0], B = A[A.length - 1] ?? Y;
5931
+ if (!(Y === void 0 || B === void 0))
5979
5932
  return {
5980
- beginPageIndex: X,
5981
- endPageIndex: H
5933
+ beginPageIndex: Y,
5934
+ endPageIndex: B
5982
5935
  };
5983
5936
  };
5984
5937
  return {
@@ -5995,7 +5948,7 @@ const Ps = ({
5995
5948
  /**
5996
5949
  * @deprecated use Pages
5997
5950
  */
5998
- _getAbsolutePageIndexFromPageIndex: (p) => Ps({
5951
+ _getAbsolutePageIndexFromPageIndex: (p) => $s({
5999
5952
  ...p,
6000
5953
  spineItemsManager: n
6001
5954
  }),
@@ -6036,7 +5989,7 @@ const Ps = ({
6036
5989
  }),
6037
5990
  getSpineItemFromIframe: c,
6038
5991
  getSpineItemPageIndexFromNode: u,
6039
- getVisibleSpineItemsFromPosition: (p) => Fs({
5992
+ getVisibleSpineItemsFromPosition: (p) => Ls({
6040
5993
  spineItemsManager: n,
6041
5994
  spineLayout: o,
6042
5995
  viewport: s,
@@ -6059,10 +6012,10 @@ const Ps = ({
6059
6012
  });
6060
6013
  }
6061
6014
  };
6062
- }, Ms = E.namespace("spine"), Cs = ({
6015
+ }, Cs = D.namespace("spine"), Es = ({
6063
6016
  position: n,
6064
6017
  pageSize: e
6065
- }) => new vi({
6018
+ }) => new bi({
6066
6019
  ...n,
6067
6020
  left: n.x,
6068
6021
  top: n.y,
@@ -6071,12 +6024,12 @@ const Ps = ({
6071
6024
  bottom: n.y + e.height,
6072
6025
  right: n.x + e.width
6073
6026
  });
6074
- class Es extends ce {
6027
+ class Ds extends ce {
6075
6028
  constructor(e, t, i, o, s, r) {
6076
6029
  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(
6077
6030
  (u) => u.itemIndex === a.index && u.pageIndex === c
6078
6031
  ), this.fromAbsolutePageIndex = (a) => this.value.pages.reduce((c, u) => c || (u.absolutePageIndex === a ? u : c), void 0), this.observeFromAbsolutePageIndex = (a) => this.pipe(S(() => this.fromAbsolutePageIndex(a))), this.layout$ = e.layout$.pipe(
6079
- A(r),
6032
+ O(r),
6080
6033
  w(([, { pageSize: a }]) => {
6081
6034
  const c = t.items.reduce(
6082
6035
  (l, d, g) => {
@@ -6089,11 +6042,11 @@ class Es extends ce {
6089
6042
  spineItemPosition: f
6090
6043
  });
6091
6044
  return {
6092
- absoluteLayout: Cs({
6045
+ absoluteLayout: Es({
6093
6046
  pageSize: a,
6094
6047
  position: I
6095
6048
  }),
6096
- layout: new bi({
6049
+ layout: new Ii({
6097
6050
  left: f.x,
6098
6051
  right: f.x + a.width,
6099
6052
  top: f.y,
@@ -6120,7 +6073,7 @@ class Es extends ce {
6120
6073
  const p = l.spineItem.renderer?.getDocumentFrame();
6121
6074
  let m;
6122
6075
  p && p?.contentWindow?.document && // very important because it is being used by next functions
6123
- p.contentWindow.document.body !== null && (m = Mn(
6076
+ p.contentWindow.document.body !== null && (m = Ln(
6124
6077
  p.contentWindow.document,
6125
6078
  l.layout
6126
6079
  )), h.next({ ...g, firstVisibleNode: m });
@@ -6128,21 +6081,21 @@ class Es extends ce {
6128
6081
  })
6129
6082
  );
6130
6083
  }),
6131
- S((a) => (Ms.info("Pages layout", a), { pages: a })),
6132
- D()
6084
+ S((a) => (Cs.info("Pages layout", a), { pages: a })),
6085
+ E()
6133
6086
  ), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
6134
6087
  }
6135
6088
  }
6136
- class Ds extends B {
6089
+ class Rs extends X {
6137
6090
  constructor(e, t) {
6138
6091
  super(), this.spineItemsManager = e, this.spineLocator = t, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
6139
6092
  w((i) => {
6140
6093
  const o = i.map(
6141
6094
  (s) => s.isReady$.pipe(S((r) => ({ item: s, isReady: r })))
6142
6095
  );
6143
- return x(...o);
6096
+ return P(...o);
6144
6097
  }),
6145
- D()
6098
+ E()
6146
6099
  ), this.itemResize$ = this.spineItemsManager.items$.pipe(
6147
6100
  w((i) => {
6148
6101
  const o = i.map(
@@ -6150,13 +6103,13 @@ class Ds extends B {
6150
6103
  S((r) => ({ entries: r, item: s }))
6151
6104
  )
6152
6105
  );
6153
- return x(...o);
6106
+ return P(...o);
6154
6107
  }),
6155
- D()
6108
+ E()
6156
6109
  );
6157
6110
  }
6158
6111
  }
6159
- const Rs = ({
6112
+ const As = ({
6160
6113
  horizontalOffset: n,
6161
6114
  verticalOffset: e,
6162
6115
  context: t,
@@ -6189,7 +6142,7 @@ const Rs = ({
6189
6142
  top: I,
6190
6143
  left: b
6191
6144
  });
6192
- const F = p + b, $ = m + I, R = new _e({
6145
+ const F = p + b, $ = m + I, A = new _e({
6193
6146
  left: b,
6194
6147
  right: F,
6195
6148
  top: I,
@@ -6202,7 +6155,7 @@ const Rs = ({
6202
6155
  return {
6203
6156
  horizontalOffset: F,
6204
6157
  verticalOffset: $,
6205
- layoutPosition: R
6158
+ layoutPosition: A
6206
6159
  };
6207
6160
  }
6208
6161
  a.layout.adjustPositionOfElement(
@@ -6226,22 +6179,22 @@ const Rs = ({
6226
6179
  })
6227
6180
  );
6228
6181
  };
6229
- class As extends B {
6182
+ class Os extends X {
6230
6183
  constructor(e, t, i, o) {
6231
- super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new j(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
6232
- P(() => {
6184
+ super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new R(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
6185
+ x(() => {
6233
6186
  this.spineItemsRelativeLayouts = [];
6234
6187
  }),
6235
6188
  w((r) => {
6236
6189
  const a = r.map(
6237
6190
  (u) => u.needsLayout$.pipe(
6238
- P(() => {
6191
+ x(() => {
6239
6192
  this.layout();
6240
6193
  })
6241
6194
  )
6242
6195
  ), c = r.map(
6243
6196
  (u) => u.loaded$.pipe(
6244
- P(() => {
6197
+ x(() => {
6245
6198
  u.isUsingVerticalWriting() ? this.context.update({
6246
6199
  hasVerticalWriting: !0
6247
6200
  }) : this.context.update({
@@ -6250,12 +6203,12 @@ class As extends B {
6250
6203
  })
6251
6204
  )
6252
6205
  );
6253
- return x(...a, ...c);
6206
+ return P(...a, ...c);
6254
6207
  })
6255
6208
  ).pipe(T(this.destroy$)).subscribe();
6256
- const s = new W(!1);
6209
+ const s = new H(!1);
6257
6210
  this.layout$ = this.layoutSubject.pipe(
6258
- P(() => {
6211
+ x(() => {
6259
6212
  this.spineItemsManager.items.forEach((r) => {
6260
6213
  r.markDirty();
6261
6214
  });
@@ -6270,12 +6223,12 @@ class As extends B {
6270
6223
  ),
6271
6224
  Ue(() => {
6272
6225
  s.next(!0);
6273
- const r = this.context.manifest, a = Gt(r) ?? !1;
6274
- return O(this.spineItemsManager.items).pipe(
6275
- gn(
6226
+ const r = this.context.manifest, a = qt(r) ?? !1;
6227
+ return N(this.spineItemsManager.items).pipe(
6228
+ pn(
6276
6229
  (u, l, d) => u.pipe(
6277
6230
  rt(
6278
- ({ horizontalOffset: g, verticalOffset: h }) => Rs({
6231
+ ({ horizontalOffset: g, verticalOffset: h }) => As({
6279
6232
  context: this.context,
6280
6233
  horizontalOffset: g,
6281
6234
  index: d,
@@ -6307,8 +6260,8 @@ class As extends B {
6307
6260
  })
6308
6261
  );
6309
6262
  }),
6310
- D()
6311
- ), x(this.layout$).pipe(T(this.destroy$)).subscribe();
6263
+ E()
6264
+ ), P(this.layout$).pipe(T(this.destroy$)).subscribe();
6312
6265
  }
6313
6266
  layout() {
6314
6267
  this.layoutSubject.next(void 0);
@@ -6333,32 +6286,32 @@ class As extends B {
6333
6286
  super.destroy(), this.layoutSubject.complete();
6334
6287
  }
6335
6288
  }
6336
- class Os extends B {
6289
+ class Ns extends X {
6337
6290
  constructor(e, t, i, o, s, r, a) {
6338
- super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spineItemLocator = o, this.settings = s, this.hookManager = r, this.viewport = a, this.elementSubject = new W(
6291
+ 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 H(
6339
6292
  void 0
6340
- ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new As(
6293
+ ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Os(
6341
6294
  i,
6342
6295
  e,
6343
6296
  s,
6344
6297
  a
6345
- ), this.locator = Ls({
6298
+ ), this.locator = Ms({
6346
6299
  context: e,
6347
6300
  spineItemsManager: i,
6348
6301
  spineItemLocator: o,
6349
6302
  settings: s,
6350
6303
  spineLayout: this.spineLayout,
6351
6304
  viewport: a
6352
- }), this.spineItemsLoader = new vs(
6305
+ }), this.spineItemsLoader = new ws(
6353
6306
  this.context,
6354
6307
  i,
6355
6308
  this.locator,
6356
6309
  s,
6357
6310
  this.spineLayout
6358
- ), this.spineItemsObserver = new Ds(
6311
+ ), this.spineItemsObserver = new Rs(
6359
6312
  i,
6360
6313
  this.locator
6361
- ), this.pages = new Es(
6314
+ ), this.pages = new Ds(
6362
6315
  this.spineLayout,
6363
6316
  this.spineItemsManager,
6364
6317
  this.spineItemLocator,
@@ -6368,22 +6321,22 @@ class Os extends B {
6368
6321
  );
6369
6322
  const c = e.watch("rootElement").pipe(
6370
6323
  se(Ge),
6371
- V((l) => {
6324
+ j((l) => {
6372
6325
  const d = l.ownerDocument.createElement("div");
6373
6326
  d.style.cssText = `
6374
6327
  height: 100%;
6375
6328
  position: relative;
6376
- `, d.className = `${G}-spine`, this.elementSubject.next(d);
6329
+ `, d.className = `${W}-spine`, this.elementSubject.next(d);
6377
6330
  })
6378
6331
  ), u = k([
6379
6332
  this.context.manifest$,
6380
6333
  this.element$
6381
6334
  ]).pipe(
6382
- V(([l, d]) => {
6335
+ j(([l, d]) => {
6383
6336
  if (!d) return;
6384
6337
  this.spineItemsManager.destroyItems();
6385
6338
  const g = l.spineItems.map(
6386
- (h, p) => new en(
6339
+ (h, p) => new Qt(
6387
6340
  h,
6388
6341
  d,
6389
6342
  this.context,
@@ -6396,7 +6349,7 @@ class Os extends B {
6396
6349
  this.spineItemsManager.addMany(g);
6397
6350
  })
6398
6351
  );
6399
- x(u, c).pipe(q(this.destroy$)).subscribe();
6352
+ P(u, c).pipe(G(this.destroy$)).subscribe();
6400
6353
  }
6401
6354
  get element() {
6402
6355
  return this.elementSubject.getValue();
@@ -6414,9 +6367,9 @@ class Os extends B {
6414
6367
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
6415
6368
  }
6416
6369
  }
6417
- class Ns extends B {
6370
+ class Vs extends X {
6418
6371
  constructor(e, t) {
6419
- super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new W([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6372
+ super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new H([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6420
6373
  }
6421
6374
  get(e) {
6422
6375
  return typeof e == "number" ? this.orderedSpineItemsSubject.value[e] : typeof e == "string" ? this.orderedSpineItemsSubject.value.find(
@@ -6428,7 +6381,7 @@ class Ns extends B {
6428
6381
  return i > o ? "after" : i === o ? "same" : "before";
6429
6382
  }
6430
6383
  getSpineItemIndex(e) {
6431
- const t = e instanceof en ? e : this.get(e);
6384
+ const t = e instanceof Qt ? e : this.get(e);
6432
6385
  if (!t) return;
6433
6386
  const i = this.orderedSpineItemsSubject.value.indexOf(t);
6434
6387
  return i < 0 ? void 0 : i;
@@ -6457,15 +6410,10 @@ class Ns extends B {
6457
6410
  });
6458
6411
  }
6459
6412
  }
6460
- class Vs extends ce {
6413
+ class js extends ce {
6461
6414
  constructor(e, t) {
6462
6415
  const i = document.createElement("div");
6463
- i.style.cssText = `
6464
- background-color: white;
6465
- position: relative;
6466
- height: 100%;
6467
- width: 100%;
6468
- `, i.className = si, super({
6416
+ i.setAttribute(`data-${oi}`, ""), super({
6469
6417
  element: i,
6470
6418
  pageSize: {
6471
6419
  width: 1,
@@ -6475,17 +6423,17 @@ class Vs extends ce {
6475
6423
  height: 1
6476
6424
  }), this.context = e, this.settingsManager = t;
6477
6425
  const o = this.settingsManager.watch(["computedSpreadMode"]).pipe(
6478
- P(() => {
6426
+ x(() => {
6479
6427
  this.mergeCompare({
6480
6428
  pageSize: this.calculatePageSize(this.value)
6481
6429
  });
6482
6430
  })
6483
6431
  ), s = this.context.watch("rootElement").pipe(
6484
- P(() => {
6432
+ x(() => {
6485
6433
  this.layout();
6486
6434
  })
6487
6435
  );
6488
- x(o, s).pipe(T(this.destroy$)).subscribe();
6436
+ P(o, s).pipe(T(this.destroy$)).subscribe();
6489
6437
  }
6490
6438
  calculatePageSize(e) {
6491
6439
  const { computedSpreadMode: t } = this.settingsManager.values;
@@ -6505,7 +6453,7 @@ class Vs extends ce {
6505
6453
  });
6506
6454
  }
6507
6455
  get absoluteViewport() {
6508
- return new ws({
6456
+ return new Ps({
6509
6457
  width: this.value.width,
6510
6458
  height: this.value.height
6511
6459
  });
@@ -6539,12 +6487,12 @@ class Vs extends ce {
6539
6487
  });
6540
6488
  }
6541
6489
  }
6542
- const $t = `${Ut}-core`, js = (n) => {
6543
- const e = crypto.randomUUID(), t = new j(), i = new j(), o = new Do(), s = new Co(), r = new ys(n, s), a = new Eo(s, r), c = new Ns(s, r), u = new Vs(s, r), l = Kt({
6490
+ const $t = `${Ut}-core`, ks = (n) => {
6491
+ const e = crypto.randomUUID(), t = new R(), i = new R(), o = new Ro(), s = new Eo(), r = new Ss(n, s), a = new Do(s, r), c = new Vs(s, r), u = new js(s, r), l = Jt({
6544
6492
  context: s,
6545
6493
  settings: r,
6546
6494
  viewport: u
6547
- }), d = new gs(s, c), g = new Os(
6495
+ }), d = new hs(s, c), g = new Ns(
6548
6496
  s,
6549
6497
  d,
6550
6498
  c,
@@ -6552,14 +6500,14 @@ const $t = `${Ut}-core`, js = (n) => {
6552
6500
  r,
6553
6501
  o,
6554
6502
  u
6555
- ), h = ps({
6503
+ ), h = gs({
6556
6504
  context: s,
6557
6505
  spineItemsManager: c,
6558
6506
  hookManager: o,
6559
6507
  spine: g,
6560
6508
  settings: r,
6561
6509
  viewport: u
6562
- }), p = new hs(
6510
+ }), p = new ms(
6563
6511
  s,
6564
6512
  d,
6565
6513
  c,
@@ -6572,25 +6520,25 @@ const $t = `${Ut}-core`, js = (n) => {
6572
6520
  const m = () => {
6573
6521
  t.next();
6574
6522
  }, y = ($) => {
6575
- const { containerElement: R, manifest: X } = $;
6523
+ const { containerElement: A, manifest: Y } = $;
6576
6524
  if (s.manifest) {
6577
- E.warn("loading a new book is not supported yet");
6525
+ D.warn("loading a new book is not supported yet");
6578
6526
  return;
6579
6527
  }
6580
- E.log("load", { options: $ });
6581
- const H = ks(R, e);
6528
+ D.log("load", { options: $ });
6529
+ const B = Us(A, e);
6582
6530
  s.update({
6583
- manifest: X,
6584
- rootElement: H
6531
+ manifest: Y,
6532
+ rootElement: B
6585
6533
  }), m();
6586
- }, f = r.watch(["computedSpreadMode"]).pipe(Ct(1), V(m)), I = t.pipe(
6587
- V(() => {
6534
+ }, f = r.watch(["computedSpreadMode"]).pipe(Ct(1), j(m)), I = t.pipe(
6535
+ j(() => {
6588
6536
  const $ = s.value.rootElement;
6589
6537
  $ && ($.style.setProperty("overflow", "hidden"), u.layout(), g.layout());
6590
6538
  }),
6591
- q(i)
6592
- ), b = x(I, f).subscribe();
6593
- Je(document, $t, Ro);
6539
+ G(i)
6540
+ ), b = P(I, f).subscribe();
6541
+ Je(document, $t, Ao);
6594
6542
  const F = () => {
6595
6543
  Ke(document, $t), b.unsubscribe(), c.destroy(), p.destroy(), r.destroy(), d.destroy(), s.destroy(), h.destroy(), g.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
6596
6544
  };
@@ -6600,7 +6548,7 @@ const $t = `${Ut}-core`, js = (n) => {
6600
6548
  spine: g,
6601
6549
  hookManager: o,
6602
6550
  cfi: {
6603
- generateCfiFromRange: ro,
6551
+ generateCfiFromRange: so,
6604
6552
  parseCfi: ot,
6605
6553
  generateCfiForSpineItemPage: ($) => He({
6606
6554
  ...$,
@@ -6641,31 +6589,31 @@ const $t = `${Ut}-core`, js = (n) => {
6641
6589
  destroy$: i
6642
6590
  }
6643
6591
  };
6644
- }, ks = (n, e) => (n.style.cssText = `
6592
+ }, Us = (n, e) => (n.style.cssText = `
6645
6593
  ${n.style.cssText}
6646
6594
  background-color: white;
6647
6595
  position: relative;
6648
- `, n.classList.add(`${G}-reader`), n.setAttribute(oi, e), n), er = (
6596
+ `, n.classList.add(`${W}-reader`), n.setAttribute(ii, e), n), tr = (
6649
6597
  //__
6650
- bo(
6651
- Zn(
6652
- Oi(
6653
- xo(
6654
- Gn(
6655
- zn(
6656
- mo(
6657
- wo(
6658
- Lo(
6659
- Gi(
6660
- Ii(
6661
- Vi(
6662
- Wn(
6663
- vo(
6664
- po(
6665
- Ei(
6666
- Xn(
6598
+ Io(
6599
+ Gn(
6600
+ Ai(
6601
+ wo(
6602
+ qn(
6603
+ Un(
6604
+ ho(
6605
+ vo(
6606
+ Mo(
6607
+ qi(
6608
+ Si(
6609
+ Ni(
6610
+ zn(
6611
+ bo(
6612
+ lo(
6613
+ Ci(
6614
+ Bn(
6667
6615
  // __
6668
- js
6616
+ ks
6669
6617
  )
6670
6618
  )
6671
6619
  )
@@ -6683,81 +6631,81 @@ const $t = `${Ut}-core`, js = (n) => {
6683
6631
  )
6684
6632
  )
6685
6633
  )
6686
- ), tr = (n) => (e) => n(e);
6634
+ ), nr = (n) => (e) => n(e);
6687
6635
  export {
6688
6636
  _t as AbstractSpinePosition,
6689
- Co as Context,
6690
- Vo as ControlledNavigationController,
6691
- B as DestroyableClass,
6637
+ Eo as Context,
6638
+ jo as ControlledNavigationController,
6639
+ X as DestroyableClass,
6692
6640
  fe as DocumentRenderer,
6693
- Eo as Features,
6694
- oi as HTML_ATTRIBUTE_DATA_READER_ID,
6695
- si as HTML_ATTRIBUTE_VIEWPORT_CLASSNAME,
6696
- G as HTML_PREFIX,
6697
- ri as HTML_PREFIX_SCROLL_NAVIGATOR,
6641
+ Do as Features,
6642
+ ii as HTML_ATTRIBUTE_DATA_READER_ID,
6643
+ W as HTML_PREFIX,
6644
+ si as HTML_PREFIX_SCROLL_NAVIGATOR,
6645
+ oi as HTML_PREFIX_VIEWPORT,
6698
6646
  Ut as HTML_STYLE_PREFIX,
6699
- Do as HookManager,
6700
- ii as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6701
- Qo as InternalNavigator,
6647
+ Ro as HookManager,
6648
+ ni as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6649
+ es as InternalNavigator,
6702
6650
  it as LayoutEntry,
6703
- Zt as Locker,
6704
- Js as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
6705
- Gs as PROSE_READER_NAMESPACE,
6706
- Es as Pages,
6707
- gs as Pagination,
6708
- hs as PaginationController,
6651
+ Gt as Locker,
6652
+ Ks as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
6653
+ Zs as PROSE_READER_NAMESPACE,
6654
+ Ds as Pages,
6655
+ hs as Pagination,
6656
+ ms as PaginationController,
6709
6657
  ce as ReactiveEntity,
6710
6658
  nt as ResourceHandler,
6711
- lo as ResourcesLocator,
6712
- ko as ScrollNavigationController,
6659
+ uo as ResourcesLocator,
6660
+ Uo as ScrollNavigationController,
6713
6661
  St as ScrollPosition,
6714
- fs as SettingsManager,
6715
- Os as Spine,
6716
- en as SpineItem,
6717
- bi as SpineItemPageLayout,
6718
- vi as SpineItemPageSpineLayout,
6662
+ ys as SettingsManager,
6663
+ Ns as Spine,
6664
+ Qt as SpineItem,
6665
+ Ii as SpineItemPageLayout,
6666
+ bi as SpineItemPageSpineLayout,
6719
6667
  C as SpineItemPosition,
6720
6668
  _e as SpineItemSpineLayout,
6721
- Ns as SpineItemsManager,
6722
- Ds as SpineItemsObserver,
6669
+ Vs as SpineItemsManager,
6670
+ Rs as SpineItemsObserver,
6723
6671
  M as SpinePosition,
6724
- Re as UnboundSpineItemPagePosition,
6672
+ Ae as UnboundSpineItemPagePosition,
6725
6673
  ae as UnboundSpinePosition,
6726
- Zs as VIEWPORT_ADJUSTMENT_THROTTLE,
6727
- Vs as Viewport,
6728
- uo as consolidate,
6729
- er as createReader,
6674
+ Js as VIEWPORT_ADJUSTMENT_THROTTLE,
6675
+ js as Viewport,
6676
+ co as consolidate,
6677
+ tr as createReader,
6730
6678
  ut as deferIdle,
6731
- Yn as deferNextResult,
6679
+ Xn as deferNextResult,
6732
6680
  He as generateCfiForSpineItemPage,
6733
- ro as generateCfiFromRange,
6681
+ so as generateCfiFromRange,
6734
6682
  he as generateRootCfi,
6735
6683
  ct as getAttributeValueFromString,
6736
- Ys as getBase64FromBlob,
6684
+ qs as getBase64FromBlob,
6737
6685
  Qe as getFrameViewportInfo,
6738
- Qs as getItemAnchor,
6739
- Ii as htmlEnhancer,
6686
+ er as getItemAnchor,
6687
+ Si as htmlEnhancer,
6740
6688
  Vt as idle,
6741
- jn as injectCSS,
6689
+ Vn as injectCSS,
6742
6690
  Ot as isHtmlElement,
6743
- Nn as isHtmlTagElement,
6691
+ On as isHtmlTagElement,
6744
6692
  Be as isRootCfi,
6745
- or as isShallowEqual,
6746
- Ei as layoutEnhancer,
6693
+ sr as isShallowEqual,
6694
+ Ci as layoutEnhancer,
6747
6695
  Nt as mapKeysTo,
6748
- Xs as observeIntersection,
6696
+ Ys as observeIntersection,
6749
6697
  lt as observeMutation,
6750
6698
  tt as observeResize,
6751
- po as paginationEnhancer,
6699
+ lo as paginationEnhancer,
6752
6700
  ot as parseCfi,
6753
- Bs as removeCSS,
6701
+ Xs as removeCSS,
6754
6702
  Yt as resolveCfi,
6755
- tr as rootEnhancer,
6756
- Cs as spinePositionToSpineItemSpineLayout,
6703
+ nr as rootEnhancer,
6704
+ Es as spinePositionToSpineItemSpineLayout,
6757
6705
  te as upsertCSSToFrame,
6758
- kn as waitForFrameLoad,
6759
- Un as waitForFrameReady,
6760
- Ce as waitForSwitch,
6706
+ jn as waitForFrameLoad,
6707
+ kn as waitForFrameReady,
6708
+ Ee as waitForSwitch,
6761
6709
  et as watchKeys
6762
6710
  };
6763
6711
  //# sourceMappingURL=index.js.map