@prose-reader/core 1.292.0 → 1.293.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { switchMap as x, of as v, fromEvent as Z, take as Rt, map as y, from as H, takeUntil as F, defer as He, Observable as ae, Subject as D, combineLatest as V, merge as P, EMPTY as B, NEVER as fe, tap as T, share as A, BehaviorSubject as J, distinctUntilChanged as N, filter as C, mergeMap as me, first as k, endWith as Ie, catchError as Te, finalize as Se, lastValueFrom as fn, scheduled as yn, animationFrameScheduler as be, skip as Dt, exhaustMap as Sn, debounceTime as Ee, withLatestFrom as _, throttleTime as In, startWith as ye, switchScan as bn, shareReplay as Y, defaultIfEmpty as vn, auditTime as wn, forkJoin as xn, delay as Fe, timer as Ce, ReplaySubject as Ve, identity as ve, concatMap as Pn, timeout as $n } from "rxjs";
2
- import { Report as Tn, isShallowEqual as j, shallowMergeIfDefined as Me, getParentPath as Fn, parseContentType as Mn, detectMimeTypeFromName as tt, arrayEqual as Cn } from "@prose-reader/shared";
3
- import { isShallowEqual as Hs } from "@prose-reader/shared";
4
- import { switchMap as q, first as Ln, map as ue, distinctUntilChanged as Re, startWith as Nn, shareReplay as Ot, tap as U, pairwise as An, take as En, takeUntil as ee, filter as he, debounceTime as Rn, skip as Vt, mergeMap as Dn, catchError as lt, share as On } from "rxjs/operators";
5
- import { generate as qe, parse as kt, isIndirectionOnly as Vn, isParsedCfiRange as kn, resolve as jn } from "@prose-reader/cfi";
6
- const Un = "@prose-reader/core", L = Tn.namespace(Un, void 0, {
1
+ import { switchMap as x, of as v, fromEvent as Z, take as Vt, map as y, from as H, takeUntil as F, defer as He, Observable as ae, Subject as D, combineLatest as V, merge as P, EMPTY as B, NEVER as fe, tap as T, share as A, BehaviorSubject as J, distinctUntilChanged as N, filter as C, mergeMap as me, first as j, endWith as Ie, catchError as Te, finalize as Se, lastValueFrom as vn, scheduled as wn, animationFrameScheduler as be, skip as jt, exhaustMap as xn, debounceTime as Ee, withLatestFrom as _, throttleTime as Pn, startWith as ye, switchScan as $n, shareReplay as Y, defaultIfEmpty as Tn, auditTime as Fn, forkJoin as Mn, delay as Fe, timer as Ce, ReplaySubject as Ve, identity as ve, concatMap as Cn, timeout as Ln } from "rxjs";
2
+ import { Report as Nn, isShallowEqual as k, shallowMergeIfDefined as Me, getParentPath as An, parseContentType as En, detectMimeTypeFromName as tt, arrayEqual as Rn } from "@prose-reader/shared";
3
+ import { isShallowEqual as Js } from "@prose-reader/shared";
4
+ import { switchMap as q, first as Dn, map as ue, distinctUntilChanged as Re, startWith as On, shareReplay as kt, tap as U, pairwise as Vn, take as jn, takeUntil as ee, filter as he, debounceTime as kn, skip as Ut, mergeMap as Un, catchError as lt, share as zn } from "rxjs/operators";
5
+ import { generate as qe, parse as zt, isIndirectionOnly as Wn, isParsedCfiRange as _n, resolve as Bn } from "@prose-reader/cfi";
6
+ const Hn = "@prose-reader/core", L = Nn.namespace(Hn, void 0, {
7
7
  color: "#98cde7"
8
- }), zn = [
8
+ }), qn = [
9
9
  "pointercancel",
10
10
  "pointerdown",
11
11
  "pointerenter",
@@ -17,14 +17,14 @@ const Un = "@prose-reader/core", L = Tn.namespace(Un, void 0, {
17
17
  // `touchstart` as const,
18
18
  // `touchend` as const,
19
19
  ];
20
- function Wn(t, e, n) {
20
+ function Yn(t, e, n) {
21
21
  if ("caretPositionFromPoint" in t)
22
22
  return t.caretPositionFromPoint(e, n);
23
23
  if ("caretRangeFromPoint" in t && // @ts-expect-error limited availability
24
24
  typeof t.caretRangeFromPoint < "u")
25
25
  return t.caretRangeFromPoint(e, n);
26
26
  }
27
- const _n = (t, e) => {
27
+ const Xn = (t, e) => {
28
28
  const n = "createRange" in t ? t : t.ownerDocument;
29
29
  if (!n) return;
30
30
  const i = "body" in t ? Ye(t.body, e) : Ye(t, e);
@@ -33,10 +33,10 @@ const _n = (t, e) => {
33
33
  const s = n.createRange();
34
34
  return Array.from(i.childNodes).some((a) => {
35
35
  s.selectNodeContents(a);
36
- const c = s.getClientRects(), u = Bn(c, e);
36
+ const c = s.getClientRects(), u = Gn(c, e);
37
37
  if (u) {
38
38
  r = s.cloneRange();
39
- const d = Wn(
39
+ const d = Yn(
40
40
  n,
41
41
  Math.ceil(u.left),
42
42
  Math.ceil(u.top)
@@ -50,7 +50,7 @@ const _n = (t, e) => {
50
50
  } : { node: i, offset: 0 };
51
51
  }
52
52
  }, Ye = (t, e) => {
53
- const n = t.getBoundingClientRect(), i = jt(
53
+ const n = t.getBoundingClientRect(), i = Wt(
54
54
  n,
55
55
  e
56
56
  );
@@ -63,16 +63,16 @@ const _n = (t, e) => {
63
63
  }
64
64
  return r;
65
65
  };
66
- function jt(t, { left: e, right: n }) {
66
+ function Wt(t, { left: e, right: n }) {
67
67
  return t.left <= e && t.right <= e ? "before" : t.left <= e && t.right > e && t.right <= n ? "partially-before" : t.left <= n && t.right > n ? "partially-after" : t.left > n ? "after" : "within";
68
68
  }
69
- function Bn(t, e) {
69
+ function Gn(t, e) {
70
70
  return Array.from(t).find((n) => {
71
- const i = jt(n, e);
71
+ const i = Wt(n, e);
72
72
  return i !== "before" && i !== "after";
73
73
  });
74
74
  }
75
- const Hn = (t, e) => {
75
+ const Zn = (t, e) => {
76
76
  if (t.nodeType !== Node.CDATA_SECTION_NODE && t.nodeType !== Node.DOCUMENT_TYPE_NODE) {
77
77
  const n = t.ownerDocument?.createRange();
78
78
  n?.selectNodeContents(t);
@@ -94,8 +94,8 @@ const Hn = (t, e) => {
94
94
  if (e.PointerEvent && t instanceof e.PointerEvent)
95
95
  return !0;
96
96
  }
97
- return !!zn.includes(t.type);
98
- }, qn = (t) => {
97
+ return !!qn.includes(t.type);
98
+ }, Jn = (t) => {
99
99
  if (nt(t)) return !1;
100
100
  if (t?.target && t?.target?.ownerDocument?.defaultView) {
101
101
  const e = t?.target?.ownerDocument?.defaultView;
@@ -108,7 +108,7 @@ const Hn = (t, e) => {
108
108
  return t instanceof e.MouseEvent;
109
109
  }
110
110
  return !1;
111
- }, Yn = (t) => {
111
+ }, Kn = (t) => {
112
112
  if (t?.target && t?.target?.ownerDocument?.defaultView) {
113
113
  const e = t?.target?.ownerDocument?.defaultView;
114
114
  if (e.TouchEvent)
@@ -120,7 +120,7 @@ const Hn = (t, e) => {
120
120
  return t instanceof e.TouchEvent;
121
121
  }
122
122
  return !1;
123
- }, Xn = () => document.createElement("div"), Ut = (t) => {
123
+ }, Qn = () => document.createElement("div"), _t = (t) => {
124
124
  const e = [
125
125
  "img",
126
126
  // Images
@@ -136,8 +136,8 @@ const Hn = (t, e) => {
136
136
  // JavaScript files
137
137
  ].join(",");
138
138
  return Array.from(t?.querySelectorAll(e) || []);
139
- }, Gn = (t) => {
140
- if (Ut(t).forEach((n) => {
139
+ }, ei = (t) => {
140
+ if (_t(t).forEach((n) => {
141
141
  const i = n.getAttribute("src") || n.getAttribute("href");
142
142
  i?.startsWith("blob:") && t?.defaultView?.URL.revokeObjectURL(i);
143
143
  }), t) {
@@ -160,7 +160,7 @@ const Hn = (t, e) => {
160
160
  }
161
161
  }
162
162
  };
163
- function zt(t, e, n = []) {
163
+ function Bt(t, e, n = []) {
164
164
  if (typeof t != "object" || t === null) return !1;
165
165
  for (const i of e)
166
166
  if (!(i in t)) return !1;
@@ -169,19 +169,19 @@ function zt(t, e, n = []) {
169
169
  return !1;
170
170
  return !0;
171
171
  }
172
- function Wt(t) {
173
- return zt(
172
+ function Ht(t) {
173
+ return Bt(
174
174
  t,
175
175
  ["nodeType"],
176
176
  []
177
177
  // biome-ignore lint/suspicious/noExplicitAny: TODO
178
178
  ) && t.nodeType === Node.ELEMENT_NODE;
179
179
  }
180
- function Zn(t, e) {
181
- return Wt(t) && t.tagName.toLowerCase() === e.toLowerCase();
180
+ function ti(t, e) {
181
+ return Ht(t) && t.tagName.toLowerCase() === e.toLowerCase();
182
182
  }
183
- function Jn(t) {
184
- return zt(
183
+ function ni(t) {
184
+ return Bt(
185
185
  t,
186
186
  [
187
187
  "startContainer",
@@ -212,9 +212,9 @@ const it = (t, e, n, i) => {
212
212
  if (!n) return 0;
213
213
  const i = Number.parseFloat(n);
214
214
  return Number.isFinite(i) ? i : 0;
215
- }, Kn = (t, e, n, i) => {
215
+ }, ii = (t, e, n, i) => {
216
216
  t?.contentDocument?.head && it(t.contentDocument, e, n, i);
217
- }, Ns = (t, e) => {
217
+ }, Os = (t, e) => {
218
218
  t?.contentDocument && ot(t.contentDocument, e);
219
219
  }, se = (t, e, n, i) => {
220
220
  if (!t) return;
@@ -225,7 +225,7 @@ const it = (t, e, n, i) => {
225
225
  r.innerHTML = n;
226
226
  return;
227
227
  }
228
- Kn(t, e, n, i);
228
+ ii(t, e, n, i);
229
229
  }, rt = (t) => {
230
230
  if (t?.contentDocument) {
231
231
  const n = t.contentDocument.querySelector("meta[name='viewport']");
@@ -247,17 +247,17 @@ const it = (t, e, n, i) => {
247
247
  }
248
248
  }
249
249
  return { hasViewport: !1 };
250
- }, Qn = (t) => t.pipe(
250
+ }, oi = (t) => t.pipe(
251
251
  x((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : Z(e, "load").pipe(
252
- Rt(1),
252
+ Vt(1),
253
253
  y(() => e)
254
254
  ))
255
- ), ei = (t) => t.pipe(
255
+ ), ri = (t) => t.pipe(
256
256
  x((e) => {
257
257
  const n = e?.contentDocument?.fonts.ready;
258
258
  return n ? H(n).pipe(y(() => e)) : v(e);
259
259
  })
260
- ), ti = (t) => (e) => {
260
+ ), si = (t) => (e) => {
261
261
  const n = t(e), i = new IntersectionObserver((r) => {
262
262
  r.forEach((o) => {
263
263
  o.isIntersecting ? o.target.removeAttribute("tab-index") : o.target.setAttribute("tab-index", "-1");
@@ -292,7 +292,7 @@ const it = (t, e, n, i) => {
292
292
  ), {
293
293
  ...n
294
294
  };
295
- }, ni = (t) => (e) => {
295
+ }, ai = (t) => (e) => {
296
296
  const n = t(e);
297
297
  return n.context.watch("rootElement").pipe(F(n.context.destroy$)).subscribe((i) => {
298
298
  if (!i) return;
@@ -304,7 +304,7 @@ const it = (t, e, n, i) => {
304
304
  const o = n.spineItemsManager.get(i)?.renderer.getDocumentFrame();
305
305
  o && o.contentDocument?.body.setAttribute("tabindex", "-1");
306
306
  }), n;
307
- }, ke = ({
307
+ }, je = ({
308
308
  position: t,
309
309
  frameElement: e
310
310
  }) => {
@@ -313,13 +313,13 @@ const it = (t, e, n, i) => {
313
313
  clientX: a,
314
314
  clientY: c
315
315
  };
316
- }, ii = (t, e, n, i) => {
316
+ }, ci = (t, e, n, i) => {
317
317
  const r = e?.view?.frameElement;
318
318
  if (!e || !r) return t;
319
319
  const o = n.getSpineItemFromIframe(r), s = r, { height: a, width: c } = i.pageSize;
320
320
  if (!o || !(s instanceof HTMLIFrameElement)) return t;
321
321
  if (nt(t)) {
322
- const { clientX: u, clientY: d } = ke({
322
+ const { clientX: u, clientY: d } = je({
323
323
  position: t,
324
324
  frameElement: s
325
325
  }), l = new PointerEvent(t.type, {
@@ -333,8 +333,8 @@ const it = (t, e, n, i) => {
333
333
  enumerable: !0
334
334
  }), l;
335
335
  }
336
- if (qn(t)) {
337
- const { clientX: u, clientY: d } = ke({
336
+ if (Jn(t)) {
337
+ const { clientX: u, clientY: d } = je({
338
338
  position: t,
339
339
  frameElement: s
340
340
  }), l = new MouseEvent(t.type, {
@@ -347,9 +347,9 @@ const it = (t, e, n, i) => {
347
347
  enumerable: !0
348
348
  }), l;
349
349
  }
350
- if (Yn(t)) {
350
+ if (Kn(t)) {
351
351
  const u = Array.from(t.touches).map((l) => {
352
- const { clientX: g, clientY: p } = ke({
352
+ const { clientX: g, clientY: p } = je({
353
353
  position: l,
354
354
  frameElement: s
355
355
  });
@@ -370,7 +370,7 @@ const it = (t, e, n, i) => {
370
370
  }), d;
371
371
  }
372
372
  return t;
373
- }, oi = [
373
+ }, ui = [
374
374
  "pointercancel",
375
375
  "pointerdown",
376
376
  "pointerenter",
@@ -379,21 +379,21 @@ const it = (t, e, n, i) => {
379
379
  "pointerout",
380
380
  "pointerover",
381
381
  "pointerup"
382
- ], ri = [
383
- ...oi
382
+ ], di = [
383
+ ...ui
384
384
  /*, ...mouseEvents*/
385
- ], si = (t) => (e) => {
385
+ ], li = (t) => (e) => {
386
386
  const n = t(e);
387
387
  return n.hookManager.register(
388
388
  "item.onDocumentLoad",
389
389
  ({ destroy: i, itemId: r }) => {
390
390
  const o = n.spineItemsManager.get(r), s = o?.renderer.getDocumentFrame();
391
391
  if (!s || !o) return;
392
- const a = ri.map((c) => {
392
+ const a = di.map((c) => {
393
393
  const u = (d) => {
394
394
  let l = d;
395
395
  if (nt(d) && (l = new PointerEvent(d.type, d)), l !== d) {
396
- const g = ii(
396
+ const g = ci(
397
397
  l,
398
398
  d,
399
399
  n.spine.locator,
@@ -413,7 +413,7 @@ const it = (t, e, n, i) => {
413
413
  });
414
414
  }
415
415
  ), n;
416
- }, As = (t) => {
416
+ }, Vs = (t) => {
417
417
  const e = new FileReader();
418
418
  return new Promise((n) => {
419
419
  e.addEventListener(
@@ -424,13 +424,13 @@ const it = (t, e, n, i) => {
424
424
  !1
425
425
  ), e.readAsDataURL(t);
426
426
  });
427
- }, ai = (t, e) => Object.entries(t).reduce(
427
+ }, pi = (t, e) => Object.entries(t).reduce(
428
428
  (n, [i, r]) => e.includes(i) ? {
429
429
  ...n,
430
430
  [i]: r
431
431
  } : n,
432
432
  {}
433
- ), _t = (t) => ue((e) => ai(e, t)), st = (t) => (e) => e.pipe(_t(t), Re(j));
433
+ ), qt = (t) => ue((e) => pi(e, t)), st = (t) => (e) => e.pipe(qt(t), Re(k));
434
434
  function at(t) {
435
435
  return new ae((e) => {
436
436
  const n = new ResizeObserver((i) => {
@@ -444,18 +444,18 @@ function at(t) {
444
444
  const De = (t) => (e) => e.pipe(
445
445
  q(
446
446
  (n) => t.pipe(
447
- Ln(),
447
+ Dn(),
448
448
  ue(() => n)
449
449
  )
450
450
  )
451
- ), ci = (t) => {
451
+ ), gi = (t) => {
452
452
  let e;
453
453
  const n = t.subscribe((i) => {
454
454
  e = { result: i };
455
455
  });
456
456
  return () => (n.unsubscribe(), e ? v(e.result) : t);
457
457
  };
458
- function Bt() {
458
+ function Yt() {
459
459
  return new ae((t) => {
460
460
  if (window.requestIdleCallback) {
461
461
  const n = window.requestIdleCallback(() => {
@@ -470,7 +470,7 @@ function Bt() {
470
470
  });
471
471
  }
472
472
  function gt(t) {
473
- return He(() => Bt().pipe(q(t)));
473
+ return He(() => Yt().pipe(q(t)));
474
474
  }
475
475
  const ht = (t, e) => new ae((n) => {
476
476
  const i = new MutationObserver((r) => {
@@ -478,7 +478,7 @@ const ht = (t, e) => new ae((n) => {
478
478
  });
479
479
  return i.observe(t, e), () => i.disconnect();
480
480
  });
481
- function Es(t, e) {
481
+ function js(t, e) {
482
482
  return new ae((n) => {
483
483
  const i = new IntersectionObserver((r) => {
484
484
  n.next(r);
@@ -488,7 +488,7 @@ function Es(t, e) {
488
488
  };
489
489
  });
490
490
  }
491
- class Ht {
491
+ class Xt {
492
492
  constructor(e, n) {
493
493
  this.settingsManager = n;
494
494
  const i = Me(
@@ -500,10 +500,10 @@ class Ht {
500
500
  e
501
501
  ), this.outputSettingsUpdateSubject = new D(), this.values$ = V([
502
502
  this.settingsManager.values$,
503
- this.outputSettingsUpdateSubject.pipe(Nn(this.outputSettings))
503
+ this.outputSettingsUpdateSubject.pipe(On(this.outputSettings))
504
504
  ]).pipe(
505
505
  ue(([r, o]) => ({ ...r, ...o })),
506
- Ot(1)
506
+ kt(1)
507
507
  ), this.values$.subscribe();
508
508
  }
509
509
  _prepareUpdate(e) {
@@ -529,19 +529,19 @@ class Ht {
529
529
  watch(e) {
530
530
  return Array.isArray(e) ? this.values$.pipe(st(e)) : this.values$.pipe(
531
531
  ue((n) => n[e]),
532
- Re(j)
532
+ Re(k)
533
533
  );
534
534
  }
535
535
  destroy() {
536
536
  this.outputSettingsUpdateSubject.complete();
537
537
  }
538
538
  }
539
- let ui = class extends Ht {
539
+ let hi = class extends Xt {
540
540
  computeOutputSettings(e) {
541
541
  return e;
542
542
  }
543
543
  hasSettingsChanged(e) {
544
- return !j(this.outputSettings, e);
544
+ return !k(this.outputSettings, e);
545
545
  }
546
546
  getCleanedParentInputSettings(e) {
547
547
  const {
@@ -562,8 +562,8 @@ let ui = class extends Ht {
562
562
  };
563
563
  }
564
564
  };
565
- const di = (t) => (e) => {
566
- const { fontScale: n, lineHeight: i, fontWeight: r, fontJustification: o } = e, s = new D(), a = t(e), c = new ui(
565
+ const mi = (t) => (e) => {
566
+ const { fontScale: n, lineHeight: i, fontWeight: r, fontJustification: o } = e, s = new D(), a = t(e), c = new hi(
567
567
  {
568
568
  fontScale: n,
569
569
  lineHeight: i,
@@ -595,7 +595,7 @@ const di = (t) => (e) => {
595
595
  }
596
596
  });
597
597
  const l = (g) => g.pipe(
598
- An(),
598
+ Vn(),
599
599
  y(([p, h]) => h.fontScale !== p.fontScale || h.lineHeight !== p.lineHeight)
600
600
  );
601
601
  return c.values$.pipe(
@@ -609,7 +609,7 @@ const di = (t) => (e) => {
609
609
  },
610
610
  settings: c
611
611
  };
612
- }, li = (t) => (e) => {
612
+ }, fi = (t) => (e) => {
613
613
  const n = t(e), i = (r) => Z(r, "keyup").pipe(
614
614
  y((o) => {
615
615
  const { pageTurnDirection: s, computedPageTurnMode: a } = n.settings.values;
@@ -645,7 +645,7 @@ const di = (t) => (e) => {
645
645
  ),
646
646
  F(n.$.destroy$)
647
647
  ).subscribe(), n;
648
- }, pi = (t) => t.spine.spineItemsManager.items$.pipe(
648
+ }, yi = (t) => t.spine.spineItemsManager.items$.pipe(
649
649
  x(
650
650
  (e) => P(
651
651
  ...e.map((n) => n.watch("isLoaded").pipe(
@@ -679,12 +679,12 @@ class te extends ae {
679
679
  */
680
680
  mergeCompare(e) {
681
681
  const n = { ...this.value, ...e };
682
- j(this.value, n) || this.stateSubject.next(n);
682
+ k(this.value, n) || this.stateSubject.next(n);
683
683
  }
684
684
  watch(e) {
685
685
  return Array.isArray(e) ? this.stateSubject.pipe(st(e)) : this.stateSubject.pipe(
686
686
  y((n) => n[e]),
687
- N(j)
687
+ N(k)
688
688
  );
689
689
  }
690
690
  get value() {
@@ -707,13 +707,13 @@ const Ae = class Ae extends te {
707
707
  C((r) => r.type === "load")
708
708
  );
709
709
  this.loaded$ = i.pipe(
710
- me(() => this.value.state === "loaded" || this.value.state === "loading" ? B : (this.mergeCompare({ state: "loading", error: void 0 }), this.onCreateDocument().pipe(k()).pipe(
710
+ me(() => this.value.state === "loaded" || this.value.state === "loading" ? B : (this.mergeCompare({ state: "loading", error: void 0 }), this.onCreateDocument().pipe(j()).pipe(
711
711
  me((s) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
712
712
  itemId: this.item.id,
713
713
  documentContainer: s
714
714
  }), this.onLoadDocument().pipe(
715
715
  Ie(null),
716
- k()
716
+ j()
717
717
  ).pipe(
718
718
  De(this.context.bridgeEvent.viewportFree$),
719
719
  x(() => {
@@ -723,7 +723,7 @@ const Ae = class Ae extends te {
723
723
  }).filter(
724
724
  (u) => u instanceof ae
725
725
  );
726
- return V([v(null), ...c]).pipe(k());
726
+ return V([v(null), ...c]).pipe(j());
727
727
  })
728
728
  ))),
729
729
  y(() => {
@@ -734,10 +734,10 @@ const Ae = class Ae extends te {
734
734
  A()
735
735
  ), this.unloaded$ = n.pipe(
736
736
  me(() => this.value.state === "unloading" || this.value.state === "idle" ? B : (this.mergeCompare({ state: "unloading", error: void 0 }), this.context.bridgeEvent.viewportFree$.pipe(
737
- k(),
737
+ j(),
738
738
  x(() => (this.hookManager.destroy("item.onDocumentLoad", this.item.id), He(() => this.onUnload()).pipe(
739
739
  Ie(null),
740
- k(),
740
+ j(),
741
741
  Te((s) => (L.error("Error unloading document", s), v(null)))
742
742
  ))),
743
743
  y(() => {
@@ -776,7 +776,7 @@ const Ae = class Ae extends te {
776
776
  const e = new D();
777
777
  return He(() => this.onRenderHeadless({ release: e })).pipe(
778
778
  Ie(void 0),
779
- k(),
779
+ j(),
780
780
  y((n) => {
781
781
  if (n)
782
782
  return {
@@ -818,25 +818,25 @@ const Ae = class Ae extends te {
818
818
  };
819
819
  Ae.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
820
820
  let Le = Ae;
821
- const gi = (t) => new URL(t.href);
821
+ const Si = (t) => new URL(t.href);
822
822
  class ct {
823
823
  constructor(e, n) {
824
824
  this.item = e, this.settings = n;
825
825
  }
826
826
  async getResource() {
827
- return await fn(
827
+ return await vn(
828
828
  this.settings.values.getResource?.(this.item) ?? v(void 0)
829
- ) ?? gi(this.item);
829
+ ) ?? Si(this.item);
830
830
  }
831
831
  async fetchResource() {
832
832
  const e = await this.getResource();
833
833
  return e instanceof Response ? e : e instanceof URL ? fetch(e) : e;
834
834
  }
835
835
  }
836
- const qt = (t, e) => {
836
+ const Gt = (t, e) => {
837
837
  const n = t.startsWith("file://"), i = n ? t.replace("file://", "http://") : t, r = new URL(e, i).toString();
838
838
  return n ? r.replace("http://", "file://") : r;
839
- }, hi = async (t, e, n, i, r) => {
839
+ }, Ii = async (t, e, n, i, r) => {
840
840
  if (!t || !t.defaultView) return;
841
841
  const o = e.sheet;
842
842
  if (o)
@@ -853,7 +853,7 @@ const qt = (t, e) => {
853
853
  return h;
854
854
  const m = h.match(/url\(['"]?([^'"]+)['"]?\)/);
855
855
  if (!m) return h;
856
- const f = m[1] ?? "", b = i.manifest?.items.find(({ href: $ }) => `${qt(n, f).toLowerCase()}`.endsWith(
856
+ const f = m[1] ?? "", b = i.manifest?.items.find(({ href: $ }) => `${Gt(n, f).toLowerCase()}`.endsWith(
857
857
  `${$.toLowerCase()}`
858
858
  ));
859
859
  if (b) {
@@ -884,10 +884,10 @@ const qt = (t, e) => {
884
884
  } catch (s) {
885
885
  console.error("Could not access stylesheet rules:", s);
886
886
  }
887
- }, mi = (t, e, n, i, r) => {
887
+ }, bi = (t, e, n, i, r) => {
888
888
  const o = e.getAttribute("src") || e.getAttribute("href");
889
889
  if (!o) return v(null);
890
- const s = i.manifest?.items.find(({ href: c }) => `${qt(n, o).toLowerCase()}`.endsWith(
890
+ const s = i.manifest?.items.find(({ href: c }) => `${Gt(n, o).toLowerCase()}`.endsWith(
891
891
  `${c.toLowerCase()}`
892
892
  ));
893
893
  if (!s) return v(null);
@@ -906,7 +906,7 @@ const qt = (t, e) => {
906
906
  return new ae((d) => {
907
907
  e.onload = async () => {
908
908
  try {
909
- e.sheet && await hi(
909
+ e.sheet && await Ii(
910
910
  t,
911
911
  e,
912
912
  n,
@@ -921,16 +921,16 @@ const qt = (t, e) => {
921
921
  return v(null);
922
922
  })
923
923
  );
924
- }, fi = ({
924
+ }, vi = ({
925
925
  settings: t,
926
926
  item: e,
927
927
  context: n
928
928
  }) => (i) => i.pipe(
929
929
  x((r) => {
930
- const o = Ut(
930
+ const o = _t(
931
931
  r.contentDocument
932
- ), s = Fn(e.href), a = o.map(
933
- (c) => mi(
932
+ ), s = An(e.href), a = o.map(
933
+ (c) => bi(
934
934
  r.contentDocument,
935
935
  c,
936
936
  s,
@@ -940,12 +940,12 @@ const qt = (t, e) => {
940
940
  );
941
941
  return a.length === 0 ? v(r) : V(a).pipe(y(() => r));
942
942
  })
943
- ), yi = (t) => {
944
- Gn(t?.contentDocument);
945
- }, Si = async (t, e) => {
943
+ ), wi = (t) => {
944
+ ei(t?.contentDocument);
945
+ }, xi = async (t, e) => {
946
946
  if (typeof t == "string")
947
947
  return new Blob([t], { type: "text/html" });
948
- const n = Mn(t.headers.get("Content-Type") || "") || tt(e.href);
948
+ const n = En(t.headers.get("Content-Type") || "") || tt(e.href);
949
949
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
950
950
  (i) => i === n
951
951
  )) {
@@ -1010,13 +1010,13 @@ const qt = (t, e) => {
1010
1010
  );
1011
1011
  }
1012
1012
  return await t.blob();
1013
- }, Ii = [
1013
+ }, Pi = [
1014
1014
  ".txt",
1015
1015
  ".jpg",
1016
1016
  ".jpeg",
1017
1017
  ".png",
1018
1018
  ".webp"
1019
- ], bi = [
1019
+ ], $i = [
1020
1020
  "text/plain",
1021
1021
  "image/jpg",
1022
1022
  "image/jpeg",
@@ -1025,7 +1025,7 @@ const qt = (t, e) => {
1025
1025
  ], Ge = (t) => {
1026
1026
  const e = t?.getAttribute("src");
1027
1027
  e?.startsWith("blob:") && URL.revokeObjectURL(e);
1028
- }, vi = ({
1028
+ }, Ti = ({
1029
1029
  item: t,
1030
1030
  resourcesHandler: e
1031
1031
  }) => {
@@ -1037,14 +1037,14 @@ const qt = (t, e) => {
1037
1037
  return (i) => i.pipe(
1038
1038
  x((r) => H(e.getResource()).pipe(
1039
1039
  x((o) => {
1040
- const s = Ii.some(
1040
+ const s = Pi.some(
1041
1041
  (c) => t.href.endsWith(c)
1042
- ) || t.mediaType && bi.includes(t.mediaType);
1042
+ ) || t.mediaType && $i.includes(t.mediaType);
1043
1043
  return o instanceof URL && t.href.startsWith(window.location.origin) && !s ? (Ge(r), r?.setAttribute("src", o.href), v(r)) : (o instanceof URL ? H(e.fetchResource()) : v(o)).pipe(
1044
1044
  x((c) => {
1045
1045
  if (!(c instanceof Response))
1046
1046
  throw new Error("Invalid resource");
1047
- return Si(c, t);
1047
+ return xi(c, t);
1048
1048
  }),
1049
1049
  T((c) => {
1050
1050
  n(r, c);
@@ -1058,7 +1058,7 @@ const qt = (t, e) => {
1058
1058
  })
1059
1059
  ))
1060
1060
  );
1061
- }, wi = () => {
1061
+ }, Fi = () => {
1062
1062
  const t = document.createElement("iframe");
1063
1063
  return t.frameBorder = "no", t.tabIndex = 0, t.setAttribute(
1064
1064
  "sandbox",
@@ -1073,7 +1073,7 @@ const qt = (t, e) => {
1073
1073
  border: 0px none transparent;
1074
1074
  padding: 0px;
1075
1075
  `, t.setAttribute("role", "main"), t;
1076
- }, xi = "body{margin:0}html,body{height:100%;width:100%}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] body{display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=left] body{justify-content:flex-end}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=right] body{justify-content:flex-start}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=none] body{justify-content:center}:not(html.prose-reader-html-renderer-touch-enabled),:not(html.prose-reader-html-renderer-touch-enabled) body{touch-action:none}img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] img{max-width:100%;height:100%;object-fit:contain}", Yt = ({
1076
+ }, Mi = "body{margin:0}html,body{height:100%;width:100%}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] body{display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=left] body{justify-content:flex-end}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=right] body{justify-content:flex-start}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=none] body{justify-content:center}:not(html.prose-reader-html-renderer-touch-enabled),:not(html.prose-reader-html-renderer-touch-enabled) body{touch-action:none}img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] img{max-width:100%;height:100%;object-fit:contain}", Zt = ({
1077
1077
  pageHeight: t,
1078
1078
  pageWidth: e,
1079
1079
  frameElement: n
@@ -1104,10 +1104,10 @@ const qt = (t, e) => {
1104
1104
  }, ft = (t, e) => {
1105
1105
  const n = `${e.width}px`, i = `${e.height}px`;
1106
1106
  t.style.width !== n && (t.style.width = n), t.style.height !== i && (t.style.height = i);
1107
- }, Pi = (t, e, n) => {
1107
+ }, Ci = (t, e, n) => {
1108
1108
  const i = t.contentDocument?.documentElement;
1109
1109
  i && i.getAttribute(e) !== n && i.setAttribute(e, n);
1110
- }, $i = ({
1110
+ }, Li = ({
1111
1111
  hasViewportDimensions: t,
1112
1112
  viewportWidth: e,
1113
1113
  viewportHeight: n,
@@ -1127,7 +1127,7 @@ const qt = (t, e) => {
1127
1127
  s ? "1" : "0",
1128
1128
  a,
1129
1129
  c
1130
- ].join("|"), Ti = ({
1130
+ ].join("|"), Ni = ({
1131
1131
  frameElement: t,
1132
1132
  viewportDimensions: e,
1133
1133
  computedScale: n,
@@ -1155,7 +1155,7 @@ const qt = (t, e) => {
1155
1155
  return;
1156
1156
  }
1157
1157
  r === "before" ? o ? K(t, "margin-right", `${s}px`) : K(t, "margin-left", `${s}px`) : (ge(t, "margin-left"), ge(t, "margin-right"));
1158
- }, Fi = ({
1158
+ }, Ai = ({
1159
1159
  minPageSpread: t,
1160
1160
  blankPagePosition: e,
1161
1161
  spreadPosition: n,
@@ -1166,7 +1166,7 @@ const qt = (t, e) => {
1166
1166
  }) => {
1167
1167
  const a = t * r;
1168
1168
  if (o?.contentDocument && o?.contentWindow) {
1169
- const { viewportDimensions: c, computedScale: u = 1 } = Yt({ frameElement: o, pageHeight: i, pageWidth: r }) ?? {}, d = !!c, l = r, g = i, p = $i({
1169
+ const { viewportDimensions: c, computedScale: u = 1 } = Zt({ frameElement: o, pageHeight: i, pageWidth: r }) ?? {}, d = !!c, l = r, g = i, p = Li({
1170
1170
  hasViewportDimensions: d,
1171
1171
  viewportWidth: c?.width,
1172
1172
  viewportHeight: c?.height,
@@ -1177,7 +1177,7 @@ const qt = (t, e) => {
1177
1177
  pageWidth: r,
1178
1178
  pageHeight: i
1179
1179
  });
1180
- return mt.get(o) === p ? { width: a, height: g } : (mt.set(o, p), Pi(
1180
+ return mt.get(o) === p ? { width: a, height: g } : (mt.set(o, p), Ci(
1181
1181
  o,
1182
1182
  "data-prose-reader-html-renderer-has-viewport-dimensions",
1183
1183
  d.toString()
@@ -1187,7 +1187,7 @@ const qt = (t, e) => {
1187
1187
  }) : ft(o, {
1188
1188
  width: l,
1189
1189
  height: g
1190
- }), Ti({
1190
+ }), Ni({
1191
1191
  frameElement: o,
1192
1192
  viewportDimensions: c,
1193
1193
  computedScale: u,
@@ -1198,7 +1198,7 @@ const qt = (t, e) => {
1198
1198
  }), { width: a, height: g });
1199
1199
  }
1200
1200
  return { width: a, height: i };
1201
- }, Mi = () => `
1201
+ }, Ei = () => `
1202
1202
  body {
1203
1203
  margin: 0;
1204
1204
  }
@@ -1215,7 +1215,7 @@ const qt = (t, e) => {
1215
1215
  html, body {
1216
1216
  touch-action: none;
1217
1217
  }
1218
- `, Ci = ({
1218
+ `, Ri = ({
1219
1219
  isScrollable: t,
1220
1220
  enableTouch: e
1221
1221
  }) => `
@@ -1240,7 +1240,7 @@ const qt = (t, e) => {
1240
1240
  display: block;
1241
1241
  }
1242
1242
  ` : ""}
1243
- `, Li = ({
1243
+ `, Di = ({
1244
1244
  width: t,
1245
1245
  columnHeight: e,
1246
1246
  columnWidth: n
@@ -1308,7 +1308,7 @@ const qt = (t, e) => {
1308
1308
  td {
1309
1309
  max-width: ${n}px;
1310
1310
  }
1311
- `, Ni = ({
1311
+ `, Oi = ({
1312
1312
  isUsingVerticalWriting: t,
1313
1313
  minimumWidth: e,
1314
1314
  pageHeight: n,
@@ -1324,7 +1324,7 @@ const qt = (t, e) => {
1324
1324
  };
1325
1325
  }, Pe = (t, e) => {
1326
1326
  t.style.width = `${e.width}px`, t.style.height = `${e.height}px`;
1327
- }, Ai = ({
1327
+ }, Vi = ({
1328
1328
  pageHeight: t,
1329
1329
  pageWidth: e,
1330
1330
  frameElement: n,
@@ -1338,7 +1338,7 @@ const qt = (t, e) => {
1338
1338
  }) => {
1339
1339
  const d = r * e, l = i?.renditionLayout === "reflowable" && i?.renditionFlow === "scrolled-continuous", g = l ? Math.min(400, t) : t;
1340
1340
  n?.style.setProperty("width", `${e}px`), l ? n?.style.removeProperty("height") : n?.style.setProperty("height", `${g}px`);
1341
- const { viewportDimensions: p, computedScale: h = 1 } = Yt({
1341
+ const { viewportDimensions: p, computedScale: h = 1 } = Zt({
1342
1342
  frameElement: n,
1343
1343
  pageHeight: g,
1344
1344
  pageWidth: e
@@ -1349,7 +1349,7 @@ const qt = (t, e) => {
1349
1349
  se(
1350
1350
  n,
1351
1351
  "prose-reader-html-renderer-framce-css",
1352
- Mi()
1352
+ Ei()
1353
1353
  ), Pe(n, {
1354
1354
  width: p.width ?? 1,
1355
1355
  height: p.height ?? 1
@@ -1361,11 +1361,11 @@ const qt = (t, e) => {
1361
1361
  `translate(-50%, -50%) scale(${h})`
1362
1362
  ), n?.style.setProperty("transform-origin", "center center");
1363
1363
  else {
1364
- const S = a ? Ci({
1364
+ const S = a ? Ri({
1365
1365
  isScrollable: i?.renditionFlow === "scrolled-continuous",
1366
1366
  enableTouch: c
1367
- }) : Li(
1368
- Ni({
1367
+ }) : Di(
1368
+ Oi({
1369
1369
  isUsingVerticalWriting: u,
1370
1370
  minimumWidth: d,
1371
1371
  pageHeight: g,
@@ -1397,19 +1397,19 @@ const qt = (t, e) => {
1397
1397
  return f % d === 0 ? n?.style.setProperty("margin-left", "0px") : (f = f + e, o && !u && n?.style.setProperty("margin-left", `${e}px`)), { width: f, height: b };
1398
1398
  }
1399
1399
  };
1400
- class Ei extends Le {
1400
+ class ji extends Le {
1401
1401
  constructor() {
1402
1402
  super(...arguments), this.isPrePaginated = () => this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated", this.isImageType = () => !!(this.item.mediaType ?? tt(this.item.href))?.startsWith("image/");
1403
1403
  }
1404
1404
  onCreateDocument() {
1405
- const e = wi();
1405
+ const e = Fi();
1406
1406
  return this.setDocumentContainer(e), v(e);
1407
1407
  }
1408
1408
  onLoadDocument() {
1409
1409
  const e = this.getFrameElement();
1410
1410
  if (!e) throw new Error("invalid frame");
1411
1411
  return v(e).pipe(
1412
- vi({
1412
+ Ti({
1413
1413
  item: this.item,
1414
1414
  resourcesHandler: this.resourcesHandler,
1415
1415
  settings: this.settings
@@ -1422,16 +1422,16 @@ class Ei extends Le {
1422
1422
  T((n) => {
1423
1423
  this.prepareFrameForAttach(n), this.attach();
1424
1424
  }),
1425
- Qn,
1425
+ oi,
1426
1426
  T((n) => {
1427
- this.isPrePaginated() ? se(n, "prose-reader-css", xi) : this.isImageType();
1427
+ this.isPrePaginated() ? se(n, "prose-reader-css", Mi) : this.isImageType();
1428
1428
  }),
1429
- fi({
1429
+ vi({
1430
1430
  context: this.context,
1431
1431
  item: this.item,
1432
1432
  settings: this.settings
1433
1433
  }),
1434
- ei,
1434
+ ri,
1435
1435
  T((n) => {
1436
1436
  this.revealFrameAfterReady(n);
1437
1437
  })
@@ -1439,7 +1439,7 @@ class Ei extends Le {
1439
1439
  }
1440
1440
  onUnload() {
1441
1441
  const e = this.getFrameElement();
1442
- return yi(e), Ge(e), this.detach(), B;
1442
+ return wi(e), Ge(e), this.detach(), B;
1443
1443
  }
1444
1444
  onLayout({
1445
1445
  minPageSpread: e,
@@ -1457,7 +1457,7 @@ class Ei extends Le {
1457
1457
  ) : s.contentDocument?.documentElement.classList.remove(
1458
1458
  "prose-reader-html-renderer-touch-enabled"
1459
1459
  )), this.isPrePaginated()) {
1460
- const l = Fi({
1460
+ const l = Ai({
1461
1461
  blankPagePosition: n,
1462
1462
  frameElement: s,
1463
1463
  isRTL: this.context.isRTL(),
@@ -1468,7 +1468,7 @@ class Ei extends Le {
1468
1468
  });
1469
1469
  return v(l);
1470
1470
  }
1471
- const c = !!this.writingMode?.startsWith("vertical"), u = this.isImageType(), d = Ai({
1471
+ const c = !!this.writingMode?.startsWith("vertical"), u = this.isImageType(), d = Vi({
1472
1472
  pageHeight: o,
1473
1473
  pageWidth: r,
1474
1474
  frameElement: s,
@@ -1548,13 +1548,13 @@ class Ei extends Le {
1548
1548
  return this.getFrameElement();
1549
1549
  }
1550
1550
  }
1551
- const Ri = (t) => (e) => {
1551
+ const ki = (t) => (e) => {
1552
1552
  const n = t({
1553
1553
  ...e,
1554
1554
  getRenderer(r) {
1555
- return e.getRenderer?.(r) ?? ((s) => new Ei(s));
1555
+ return e.getRenderer?.(r) ?? ((s) => new ji(s));
1556
1556
  }
1557
- }), i = pi(n);
1557
+ }), i = yi(n);
1558
1558
  return i.pipe(F(n.$.destroy$)).subscribe(), {
1559
1559
  ...n,
1560
1560
  links$: i
@@ -1573,12 +1573,12 @@ class E {
1573
1573
  this.__symbol = /* @__PURE__ */ Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
1574
1574
  }
1575
1575
  }
1576
- class je {
1576
+ class ke {
1577
1577
  constructor(e) {
1578
1578
  this.__symbol = /* @__PURE__ */ Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
1579
1579
  }
1580
1580
  }
1581
- class Di extends ut {
1581
+ class Ui extends ut {
1582
1582
  constructor() {
1583
1583
  super(...arguments), this.__symbol = "SpineItemPageLayout";
1584
1584
  }
@@ -1588,17 +1588,17 @@ class Ue extends ut {
1588
1588
  super(...arguments), this.__symbol = "SpineItemSpineLayout";
1589
1589
  }
1590
1590
  }
1591
- class Oi extends ut {
1591
+ class zi extends ut {
1592
1592
  constructor() {
1593
1593
  super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
1594
1594
  }
1595
1595
  }
1596
- class Xt {
1596
+ class Jt {
1597
1597
  constructor(e) {
1598
1598
  this.x = e.x, this.y = e.y;
1599
1599
  }
1600
1600
  }
1601
- class O extends Xt {
1601
+ class O extends Jt {
1602
1602
  constructor() {
1603
1603
  super(...arguments), this.__symbol = "SpinePosition";
1604
1604
  }
@@ -1606,7 +1606,7 @@ class O extends Xt {
1606
1606
  return new O(e);
1607
1607
  }
1608
1608
  }
1609
- class R extends Xt {
1609
+ class R extends Jt {
1610
1610
  constructor() {
1611
1611
  super(...arguments), this.__symbol = "UnboundSpinePosition";
1612
1612
  }
@@ -1614,17 +1614,17 @@ class R extends Xt {
1614
1614
  return new R(e);
1615
1615
  }
1616
1616
  }
1617
- const Vi = (t, e) => {
1617
+ const Wi = (t, e) => {
1618
1618
  const n = e.getBoundingClientRect(), { x: i, y: r } = t, { left: o, top: s } = n, a = n.width / e.offsetWidth, c = n.height / e.offsetHeight, u = i - o, d = r - s;
1619
1619
  return {
1620
1620
  x: u / a,
1621
1621
  y: d / c
1622
1622
  };
1623
- }, ki = (t, e) => new R(
1624
- Vi(t, e)
1625
- ), ji = (t) => ({
1626
- getSpinePositionFromClientPosition: (e) => t.spine.element ? ki(e, t.spine.element) : void 0
1627
- }), Ui = (t) => {
1623
+ }, _i = (t, e) => new R(
1624
+ Wi(t, e)
1625
+ ), Bi = (t) => ({
1626
+ getSpinePositionFromClientPosition: (e) => t.spine.element ? _i(e, t.spine.element) : void 0
1627
+ }), Hi = (t) => {
1628
1628
  let e;
1629
1629
  const n = t.context.watch("rootElement").pipe(
1630
1630
  q((c) => c ? new ae(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
@@ -1637,7 +1637,7 @@ const Vi = (t, e) => {
1637
1637
  `, c.appendChild(e), () => {
1638
1638
  e?.remove(), e = void 0;
1639
1639
  })) : fe)
1640
- ), i = (c) => yn(c, be).pipe(
1640
+ ), i = (c) => wn(c, be).pipe(
1641
1641
  U(() => {
1642
1642
  e?.style.setProperty(
1643
1643
  "visibility",
@@ -1652,7 +1652,7 @@ const Vi = (t, e) => {
1652
1652
  );
1653
1653
  })
1654
1654
  ), o = i(t.viewportFree$).pipe(
1655
- En(1)
1655
+ jn(1)
1656
1656
  ), a = t.settings.values$.pipe(
1657
1657
  ue(() => t.settings.values.computedPageTurnMode),
1658
1658
  Re()
@@ -1663,13 +1663,13 @@ const Vi = (t, e) => {
1663
1663
  ee(t.$.destroy$)
1664
1664
  );
1665
1665
  return P(n, a);
1666
- }, Ds = "@prose-reader/core", Os = 0, Vs = 200, W = "prose-reader", zi = `${W}-style`, Wi = `data-${W}-id`, _i = `${W}-viewport`, Bi = `${W}-scroll-navigator`, Hi = `${W}-spine-item`, qi = `${W}-enhancer-loading`, Gt = `${qi}-container`, Yi = ({
1666
+ }, Us = "@prose-reader/core", zs = 0, Ws = 200, W = "prose-reader", qi = `${W}-style`, Yi = `data-${W}-id`, Xi = `${W}-viewport`, Gi = `${W}-scroll-navigator`, Zi = `${W}-spine-item`, Ji = `${W}-enhancer-loading`, Kt = `${Ji}-container`, Ki = ({
1667
1667
  container: t,
1668
1668
  item: e,
1669
1669
  viewport: n
1670
1670
  }) => {
1671
1671
  const i = t.ownerDocument.createElement("div");
1672
- i.classList.add(Gt), i.style.cssText = `
1672
+ i.classList.add(Kt), i.style.cssText = `
1673
1673
  height: 100%;
1674
1674
  width: 100%;
1675
1675
  max-width: ${n.absoluteViewport.width}px;
@@ -1698,14 +1698,14 @@ const Vi = (t, e) => {
1698
1698
  max-width: 300px;
1699
1699
  width: 80%;
1700
1700
  `, i.appendChild(r), i.appendChild(o), i;
1701
- }, Xi = (t) => t.spineItemsManager.items$.pipe(
1701
+ }, Qi = (t) => t.spineItemsManager.items$.pipe(
1702
1702
  q(
1703
1703
  (e) => P(
1704
1704
  ...e.map((n) => {
1705
1705
  n.containerElement.style.zIndex = "0";
1706
1706
  const i = n.containerElement.querySelector(
1707
- `.${Gt}`
1708
- ), r = i instanceof HTMLElement ? i : Yi({
1707
+ `.${Kt}`
1708
+ ), r = i instanceof HTMLElement ? i : Ki({
1709
1709
  container: n.containerElement,
1710
1710
  item: n.item,
1711
1711
  viewport: t.viewport
@@ -1743,11 +1743,11 @@ const Vi = (t, e) => {
1743
1743
  })
1744
1744
  )
1745
1745
  )
1746
- ), Gi = (t) => {
1746
+ ), eo = (t) => {
1747
1747
  t.hookManager.register("item.onDocumentLoad", ({ itemId: e }) => {
1748
1748
  t.spineItemsManager.get(e)?.renderer.getDocumentFrame()?.setAttribute("scrolling", "no");
1749
1749
  });
1750
- }, Zi = (t) => {
1750
+ }, to = (t) => {
1751
1751
  t.hookManager.register(
1752
1752
  "item.onAfterLayout",
1753
1753
  ({ item: e, blankPagePosition: n, minimumWidth: i }) => {
@@ -1764,17 +1764,17 @@ const Vi = (t, e) => {
1764
1764
  }
1765
1765
  }
1766
1766
  );
1767
- }, Ji = (t) => t.spineItemsObserver.states$.pipe(
1767
+ }, no = (t) => t.spineItemsObserver.states$.pipe(
1768
1768
  T(({ item: e, isReady: n, isDirty: i }) => {
1769
1769
  e.containerElement.dataset.isDirty = i.toString(), e.containerElement.dataset.isReady = n.toString();
1770
1770
  })
1771
1771
  );
1772
- let Ki = class extends Ht {
1772
+ let io = class extends Xt {
1773
1773
  computeOutputSettings(e) {
1774
1774
  return e;
1775
1775
  }
1776
1776
  hasSettingsChanged(e) {
1777
- return !j(this.outputSettings, e);
1777
+ return !k(this.outputSettings, e);
1778
1778
  }
1779
1779
  getCleanedParentInputSettings(e) {
1780
1780
  const {
@@ -1795,21 +1795,40 @@ let Ki = class extends Ht {
1795
1795
  };
1796
1796
  }
1797
1797
  };
1798
- const Qi = (t) => V([
1798
+ const Qt = ({
1799
+ manifest: t,
1800
+ spreadMode: e
1801
+ }) => t?.renditionFlow === "scrolled-continuous" ? !1 : e, oo = (t) => t === void 0 || t === "auto" || t === "landscape" || t === "both", en = ({
1802
+ manifest: t,
1803
+ viewport: e
1804
+ }) => {
1805
+ const n = e.width > e.height;
1806
+ return !!(!n && t?.renditionSpread === "portrait" || n && oo(t?.renditionSpread));
1807
+ }, Bs = ({
1808
+ manifest: t,
1809
+ viewport: e
1810
+ }) => Qt({
1811
+ manifest: t,
1812
+ spreadMode: en({ manifest: t, viewport: e })
1813
+ }), ro = (t) => V([
1799
1814
  t.viewport.watch(["width", "height"]),
1800
1815
  t.context.watch("manifest")
1801
1816
  ]).pipe(
1802
- T(([{ width: e, height: n }, i]) => {
1803
- const r = e > n;
1804
- return !r && i?.renditionSpread === "portrait" ? t.settings.update({ spreadMode: !0 }) : r && (i?.renditionSpread === void 0 || i?.renditionSpread === "auto" || i?.renditionSpread === "landscape" || i?.renditionSpread === "both") ? t.settings.update({ spreadMode: !0 }) : t.settings.update({ spreadMode: !1 });
1805
- })
1806
- ), eo = (t) => (e) => {
1817
+ T(
1818
+ ([e, n]) => t.settings.update({
1819
+ spreadMode: en({
1820
+ manifest: n,
1821
+ viewport: e
1822
+ })
1823
+ })
1824
+ )
1825
+ ), so = (t) => (e) => {
1807
1826
  const {
1808
1827
  pageHorizontalMargin: n,
1809
1828
  pageVerticalMargin: i,
1810
1829
  layoutAutoResize: r,
1811
1830
  layoutLayerTransition: o
1812
- } = e, s = t(e), a = new Ki(
1831
+ } = e, s = t(e), a = new io(
1813
1832
  {
1814
1833
  pageHorizontalMargin: n,
1815
1834
  pageVerticalMargin: i,
@@ -1858,7 +1877,7 @@ const Qi = (t) => V([
1858
1877
  `
1859
1878
  );
1860
1879
  }
1861
- }), Zi(s), Gi(s), s.hookManager.register(
1880
+ }), to(s), eo(s), s.hookManager.register(
1862
1881
  "item.onDocumentCreated",
1863
1882
  ({ documentContainer: m }) => {
1864
1883
  m.style.opacity = "0", a.values.layoutLayerTransition && (m.style.transition = "opacity 800ms");
@@ -1878,22 +1897,22 @@ const Qi = (t) => V([
1878
1897
  q(() => s.context.watch("rootElement")),
1879
1898
  he(Q),
1880
1899
  q((m) => at(m)),
1881
- Rn(100),
1900
+ kn(100),
1882
1901
  he(Q),
1883
1902
  U(() => {
1884
1903
  s?.layout();
1885
1904
  })
1886
- ), d = Ui(s);
1905
+ ), d = Hi(s);
1887
1906
  a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1888
- Vt(1),
1907
+ Ut(1),
1889
1908
  U(() => {
1890
1909
  s.layout();
1891
1910
  }),
1892
1911
  ee(s.$.destroy$)
1893
1912
  ).subscribe();
1894
1913
  const l = s.spine.pages.pipe(
1895
- Ot({ refCount: !0, bufferSize: 1 })
1896
- ), g = Ji(s), p = Qi(s), h = Xi(s);
1914
+ kt({ refCount: !0, bufferSize: 1 })
1915
+ ), g = no(s), p = ro(s), h = Qi(s);
1897
1916
  return P(
1898
1917
  c,
1899
1918
  d,
@@ -1910,9 +1929,9 @@ const Qi = (t) => V([
1910
1929
  settings: a,
1911
1930
  layout$: s.spine.layout$,
1912
1931
  layoutInfo$: l,
1913
- coordinates: ji(s)
1932
+ coordinates: Bi(s)
1914
1933
  };
1915
- }, to = (t) => (e) => {
1934
+ }, ao = (t) => (e) => {
1916
1935
  const n = t(e), i = new IntersectionObserver(
1917
1936
  (s) => {
1918
1937
  s.forEach((a) => {
@@ -1961,20 +1980,20 @@ const Qi = (t) => V([
1961
1980
  i.disconnect(), r.disconnect(), n.destroy();
1962
1981
  }
1963
1982
  };
1964
- }, Zt = (t) => (e) => e.pipe(
1983
+ }, tn = (t) => (e) => e.pipe(
1965
1984
  x(
1966
1985
  (n) => t.pipe(
1967
1986
  C((i) => i === "free"),
1968
- k(),
1987
+ j(),
1969
1988
  y(() => n)
1970
1989
  )
1971
1990
  )
1972
- ), Jt = ({
1991
+ ), nn = ({
1973
1992
  navigation$: t,
1974
1993
  navigationState$: e
1975
- }) => t.pipe(Zt(e)), no = (t) => Jt(t).pipe(Dt(1)), io = (t) => (e) => e.pipe(F(no(t))), Kt = (t) => t.navigation.navigation$.pipe(
1994
+ }) => t.pipe(tn(e)), co = (t) => nn(t).pipe(jt(1)), uo = (t) => (e) => e.pipe(F(co(t))), on = (t) => t.navigation.navigation$.pipe(
1976
1995
  C((e) => e.triggeredBy === "user"),
1977
- Zt(t.navigation.navigationState$),
1996
+ tn(t.navigation.navigationState$),
1978
1997
  y((e) => {
1979
1998
  const n = e.requestedPosition, i = e.requestedVisibleArea;
1980
1999
  return n && i ? t.navigation.navigationResolver.getBoundaryForPosition(
@@ -1985,15 +2004,15 @@ const Qi = (t) => V([
1985
2004
  C((e) => e !== void 0),
1986
2005
  y((e) => ({ boundary: e })),
1987
2006
  A()
1988
- ), oo = (t, e) => t.links$.pipe(
2007
+ ), lo = (t, e) => t.links$.pipe(
1989
2008
  T((n) => {
1990
- if (!Zn(n.target, "a") || n.type !== "click") return;
2009
+ if (!ti(n.target, "a") || n.type !== "click") return;
1991
2010
  const i = new URL(n.target.href), r = `${i.origin}${i.pathname}`;
1992
2011
  t.context.manifest?.spineItems.some(
1993
2012
  (s) => s.href === r
1994
2013
  ) && e.goToUrl(i);
1995
2014
  })
1996
- ), ie = L.namespace("navigation"), ro = ({
2015
+ ), ie = L.namespace("navigation"), po = ({
1997
2016
  position: t,
1998
2017
  spineItem: e,
1999
2018
  pageHeight: n,
@@ -2025,7 +2044,7 @@ const Qi = (t) => V([
2025
2044
  const u = r.getSpineItemPositionFromSpinePosition(
2026
2045
  t,
2027
2046
  a
2028
- ), d = ro({
2047
+ ), d = po({
2029
2048
  position: u,
2030
2049
  spineItem: a,
2031
2050
  pageHeight: o.pageSize.height,
@@ -2045,7 +2064,7 @@ const Qi = (t) => V([
2045
2064
  y: t.y - o.pageSize.height,
2046
2065
  x: 0
2047
2066
  });
2048
- }, so = ({
2067
+ }, go = ({
2049
2068
  position: t,
2050
2069
  spineItem: e,
2051
2070
  context: n,
@@ -2095,7 +2114,7 @@ const Qi = (t) => V([
2095
2114
  return i.getAdjustedPositionForSpread(d);
2096
2115
  }
2097
2116
  return i.getAdjustedPositionForSpread(u);
2098
- }, ao = ({
2117
+ }, ho = ({
2099
2118
  position: t,
2100
2119
  spineItem: e,
2101
2120
  pageHeight: n,
@@ -2127,7 +2146,7 @@ const Qi = (t) => V([
2127
2146
  const u = r.getSpineItemPositionFromSpinePosition(
2128
2147
  t,
2129
2148
  a
2130
- ), d = ao({
2149
+ ), d = ho({
2131
2150
  position: u,
2132
2151
  spineItem: a,
2133
2152
  pageHeight: o.pageSize.height,
@@ -2147,7 +2166,7 @@ const Qi = (t) => V([
2147
2166
  y: t.y + o.pageSize.height,
2148
2167
  x: 0
2149
2168
  });
2150
- }, co = ({
2169
+ }, mo = ({
2151
2170
  position: t,
2152
2171
  spineItem: e,
2153
2172
  context: n,
@@ -2198,7 +2217,7 @@ const Qi = (t) => V([
2198
2217
  }
2199
2218
  return i.getAdjustedPositionForSpread(u);
2200
2219
  };
2201
- class uo {
2220
+ class fo {
2202
2221
  constructor(e) {
2203
2222
  this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new O({ x: 0, y: 0 }), this.unlock = void 0;
2204
2223
  }
@@ -2217,7 +2236,7 @@ class uo {
2217
2236
  turnRightOrBottom() {
2218
2237
  const e = this.reader.navigation.getNavigation(), n = this.reader.spineItemsManager.get(e.spineItem);
2219
2238
  if (!n) return;
2220
- const i = co({
2239
+ const i = mo({
2221
2240
  context: this.reader.context,
2222
2241
  navigationResolver: this.reader.navigation.navigationResolver,
2223
2242
  position: e.position,
@@ -2235,7 +2254,7 @@ class uo {
2235
2254
  turnLeftOrTop() {
2236
2255
  const e = this.reader.navigation.getNavigation(), n = this.reader.spineItemsManager.get(e.spineItem);
2237
2256
  if (!n) return;
2238
- const i = so({
2257
+ const i = go({
2239
2258
  context: this.reader.context,
2240
2259
  navigationResolver: this.reader.navigation.navigationResolver,
2241
2260
  position: e.position,
@@ -2377,7 +2396,7 @@ class uo {
2377
2396
  }
2378
2397
  }
2379
2398
  }
2380
- class lo extends te {
2399
+ class yo extends te {
2381
2400
  constructor(e) {
2382
2401
  super({
2383
2402
  lastDelta: { x: 0, y: 0 },
@@ -2442,22 +2461,22 @@ class X {
2442
2461
  this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
2443
2462
  }
2444
2463
  }
2445
- const po = 500;
2446
- class go extends X {
2464
+ const So = 500;
2465
+ class Io extends X {
2447
2466
  constructor(e, n) {
2448
2467
  super(), this.scrollNavigationController = e, this.lock = n, this.navigationSubject = new D(), this.navigation$ = this.navigationSubject.asObservable();
2449
2468
  const i = this.scrollNavigationController.userScroll$.pipe(
2450
- Sn((r) => {
2469
+ xn((r) => {
2451
2470
  const o = this.lock();
2452
2471
  return P(
2453
2472
  this.scrollNavigationController.userScroll$,
2454
2473
  v(r)
2455
2474
  ).pipe(
2456
2475
  Ee(
2457
- po,
2476
+ So,
2458
2477
  be
2459
2478
  ),
2460
- k(),
2479
+ j(),
2461
2480
  T(() => {
2462
2481
  const s = this.scrollNavigationController.fromScrollPosition(
2463
2482
  this.scrollNavigationController.scrollPosition
@@ -2477,7 +2496,7 @@ class go extends X {
2477
2496
  P(i).pipe(F(this.destroy$)).subscribe();
2478
2497
  }
2479
2498
  }
2480
- const ho = (t) => t.pagination.state$.pipe(
2499
+ const bo = (t) => t.pagination.state$.pipe(
2481
2500
  _(t.context.manifest$, t.settings.values$),
2482
2501
  y(
2483
2502
  ([
@@ -2496,8 +2515,8 @@ const ho = (t) => t.pagination.state$.pipe(
2496
2515
  };
2497
2516
  }
2498
2517
  ),
2499
- N(j)
2500
- ), mo = ({ reader: t, duration: e }) => (n) => {
2518
+ N(k)
2519
+ ), vo = ({ reader: t, duration: e }) => (n) => {
2501
2520
  let i;
2502
2521
  const r = () => {
2503
2522
  i?.(), i = void 0;
@@ -2506,18 +2525,18 @@ const ho = (t) => t.pagination.state$.pipe(
2506
2525
  T(() => {
2507
2526
  i || (i = t?.navigation.lock());
2508
2527
  }),
2509
- In(e, void 0, {
2528
+ Pn(e, void 0, {
2510
2529
  trailing: !0,
2511
2530
  leading: !0
2512
2531
  }),
2513
2532
  T(r),
2514
2533
  Se(r)
2515
2534
  );
2516
- }, fo = (t) => (e) => {
2517
- const n = t(e), i = ho(n), r = Kt(n), o = new uo(n), s = new lo(n), a = new go(
2535
+ }, wo = (t) => (e) => {
2536
+ const n = t(e), i = bo(n), r = on(n), o = new fo(n), s = new yo(n), a = new Io(
2518
2537
  n.navigation.scrollNavigationController,
2519
2538
  n.navigation.lock
2520
- ), c = oo(n, o), u = a.navigation$.pipe(
2539
+ ), c = lo(n, o), u = a.navigation$.pipe(
2521
2540
  T((g) => {
2522
2541
  n.navigation.navigate(g);
2523
2542
  })
@@ -2535,7 +2554,7 @@ const ho = (t) => t.pagination.state$.pipe(
2535
2554
  ...n.navigation,
2536
2555
  state$: i,
2537
2556
  outOfSpineBoundary$: r,
2538
- throttleLock: ({ duration: g, trigger: p }) => p.pipe(mo({ duration: g, reader: n })),
2557
+ throttleLock: ({ duration: g, trigger: p }) => p.pipe(vo({ duration: g, reader: n })),
2539
2558
  panNavigator: s,
2540
2559
  turnBottom: o.turnBottom.bind(o),
2541
2560
  turnTop: o.turnTop.bind(o),
@@ -2561,13 +2580,13 @@ const ho = (t) => t.pagination.state$.pipe(
2561
2580
  }, le = (t) => qe({
2562
2581
  spineIndex: t.index,
2563
2582
  spineId: t.id
2564
- }), Qt = ({
2583
+ }), rn = ({
2565
2584
  nodeOrRange: t,
2566
2585
  offset: e,
2567
2586
  item: n
2568
2587
  }) => {
2569
2588
  const i = "ownerDocument" in t ? t.ownerDocument : t.startContainer.ownerDocument;
2570
- return !i || !i?.documentElement || t === i ? le(n) : Jn(t) ? qe({
2589
+ return !i || !i?.documentElement || t === i ? le(n) : ni(t) ? qe({
2571
2590
  start: {
2572
2591
  node: t.startContainer,
2573
2592
  offset: t.startOffset,
@@ -2589,24 +2608,24 @@ const ho = (t) => t.pagination.state$.pipe(
2589
2608
  }, Ze = ({
2590
2609
  spineItem: t,
2591
2610
  pageNode: e
2592
- }) => Qt({
2611
+ }) => rn({
2593
2612
  nodeOrRange: e.node,
2594
2613
  offset: e.offset,
2595
2614
  item: t
2596
- }).trim(), yo = (t, e) => Qt({
2615
+ }).trim(), xo = (t, e) => rn({
2597
2616
  nodeOrRange: t,
2598
2617
  item: e
2599
- }), js = (t) => t.index.toString(), It = (t) => t[0]?.index === 6 && t.length > 1, Je = (t) => {
2600
- const e = kt(t);
2601
- return Vn(e);
2602
- }, So = (t) => Array.isArray(t) ? t[0] && It(t[0]) ? t[0] : void 0 : t.parent[0] && It(t.parent[0]) ? t.parent[0] : void 0, dt = (t) => {
2603
- const e = kt(t), o = ((So(e) ?? [])[1]?.index ?? 2) / 2 - 1, s = kn(e), a = s ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2618
+ }), Hs = (t) => t.index.toString(), It = (t) => t[0]?.index === 6 && t.length > 1, Je = (t) => {
2619
+ const e = zt(t);
2620
+ return Wn(e);
2621
+ }, Po = (t) => Array.isArray(t) ? t[0] && It(t[0]) ? t[0] : void 0 : t.parent[0] && It(t.parent[0]) ? t.parent[0] : void 0, dt = (t) => {
2622
+ const e = zt(t), o = ((Po(e) ?? [])[1]?.index ?? 2) / 2 - 1, s = _n(e), a = s ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2604
2623
  return {
2605
2624
  isCfiRange: s,
2606
2625
  itemIndex: o,
2607
2626
  offset: a ?? 0
2608
2627
  };
2609
- }, en = ({
2628
+ }, sn = ({
2610
2629
  cfi: t,
2611
2630
  spineItemsManager: e
2612
2631
  }) => {
@@ -2622,7 +2641,7 @@ const ho = (t) => t.pagination.state$.pipe(
2622
2641
  const s = o.contentWindow?.document;
2623
2642
  if (s)
2624
2643
  try {
2625
- const a = jn(t, s, {
2644
+ const a = Bn(t, s, {
2626
2645
  throwOnError: !0
2627
2646
  });
2628
2647
  return {
@@ -2649,7 +2668,7 @@ const ho = (t) => t.pagination.state$.pipe(
2649
2668
  spineItem: r,
2650
2669
  node: null
2651
2670
  };
2652
- }, Io = (t, e) => {
2671
+ }, $o = (t, e) => {
2653
2672
  if ("cfi" in e) {
2654
2673
  const { itemIndex: o, ...s } = t.cfi.parseCfi(e.cfi);
2655
2674
  return {
@@ -2669,10 +2688,10 @@ const ho = (t) => t.pagination.state$.pipe(
2669
2688
  itemIndex: n.index,
2670
2689
  node: null
2671
2690
  };
2672
- }, bo = (t, e) => {
2691
+ }, To = (t, e) => {
2673
2692
  let n = t?.itemPageIndex;
2674
2693
  const { itemIndex: i, ...r } = e.cfi.parseCfi(t.cfi), o = e.spineItemsManager.get(i);
2675
- return o ? Bt().pipe(
2694
+ return o ? Yt().pipe(
2676
2695
  _(o.isReady$),
2677
2696
  y(([, s]) => {
2678
2697
  const {
@@ -2702,7 +2721,7 @@ const ho = (t) => t.pagination.state$.pipe(
2702
2721
  })
2703
2722
  ) : v({ ...t, itemIndex: i, ...r });
2704
2723
  };
2705
- class vo {
2724
+ class Fo {
2706
2725
  constructor(e) {
2707
2726
  this.reader = e, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (n) => {
2708
2727
  const i = this.locatorsByKey.get(n);
@@ -2710,7 +2729,7 @@ class vo {
2710
2729
  }, this.locate = (n, i) => {
2711
2730
  const r = {
2712
2731
  resource: n,
2713
- meta: Io(this.reader, n)
2732
+ meta: $o(this.reader, n)
2714
2733
  };
2715
2734
  return gt(() => {
2716
2735
  const o = this.reader.spineItemsManager.get(
@@ -2735,7 +2754,7 @@ class vo {
2735
2754
  const l = this.reader.spine.layout$.pipe(
2736
2755
  Ee(10),
2737
2756
  ye(r),
2738
- bn((g) => bo(g.meta, this.reader).pipe(
2757
+ $n((g) => To(g.meta, this.reader).pipe(
2739
2758
  y((p) => ({
2740
2759
  ...g,
2741
2760
  meta: p
@@ -2754,14 +2773,14 @@ class vo {
2754
2773
  return Array.isArray(e) ? gt(
2755
2774
  () => V(
2756
2775
  e.map((i) => this.locate(i, n ?? {}))
2757
- ).pipe(vn([]))
2776
+ ).pipe(Tn([]))
2758
2777
  ) : this.locate(e, n ?? {});
2759
2778
  }
2760
2779
  }
2761
- const wo = L.namespace("spine"), xo = ({
2780
+ const Mo = L.namespace("spine"), Co = ({
2762
2781
  position: t,
2763
2782
  pageSize: e
2764
- }) => new Oi({
2783
+ }) => new zi({
2765
2784
  ...t,
2766
2785
  left: t.x,
2767
2786
  top: t.y,
@@ -2769,7 +2788,7 @@ const wo = L.namespace("spine"), xo = ({
2769
2788
  height: e.height,
2770
2789
  bottom: t.y + e.height,
2771
2790
  right: t.x + e.width
2772
- }), Po = 10, $o = (t) => {
2791
+ }), Lo = 10, No = (t) => {
2773
2792
  const { spineItem: e, ...n } = t;
2774
2793
  if (!t.spineItem.value.isLoaded)
2775
2794
  return {
@@ -2782,12 +2801,12 @@ const wo = L.namespace("spine"), xo = ({
2782
2801
  firstVisibleNode: void 0
2783
2802
  } : {
2784
2803
  ...n,
2785
- firstVisibleNode: _n(
2804
+ firstVisibleNode: Xn(
2786
2805
  r,
2787
2806
  t.layout
2788
2807
  )
2789
2808
  };
2790
- }, To = (t) => new ae((e) => {
2809
+ }, Ao = (t) => new ae((e) => {
2791
2810
  if (t.length === 0) {
2792
2811
  e.next([]), e.complete();
2793
2812
  return;
@@ -2798,13 +2817,13 @@ const wo = L.namespace("spine"), xo = ({
2798
2817
  }, s = () => {
2799
2818
  n = void 0;
2800
2819
  let c = 0;
2801
- for (; i < t.length && c < Po; ) {
2820
+ for (; i < t.length && c < Lo; ) {
2802
2821
  const u = t[i];
2803
2822
  if (!u) {
2804
2823
  i = t.length;
2805
2824
  break;
2806
2825
  }
2807
- r[i] = $o(u), i += 1, c += 1;
2826
+ r[i] = No(u), i += 1, c += 1;
2808
2827
  }
2809
2828
  if (i >= t.length) {
2810
2829
  e.next(r), e.complete();
@@ -2833,11 +2852,11 @@ const wo = L.namespace("spine"), xo = ({
2833
2852
  spineItemPosition: p
2834
2853
  }), m = u.length;
2835
2854
  u.push({
2836
- absoluteLayout: xo({
2855
+ absoluteLayout: Co({
2837
2856
  pageSize: a,
2838
2857
  position: h
2839
2858
  }),
2840
- layout: new Di({
2859
+ layout: new Ui({
2841
2860
  left: p.x,
2842
2861
  right: p.x + a.width,
2843
2862
  top: p.y,
@@ -2857,9 +2876,9 @@ const wo = L.namespace("spine"), xo = ({
2857
2876
  },
2858
2877
  []
2859
2878
  );
2860
- return To(c);
2879
+ return Ao(c);
2861
2880
  }),
2862
- y((a) => (wo.info("Pages layout", a), { pages: a })),
2881
+ y((a) => (Mo.info("Pages layout", a), { pages: a })),
2863
2882
  A()
2864
2883
  ), this.layout$.pipe(F(this.destroy$)).subscribe(this.next.bind(this));
2865
2884
  }
@@ -2884,13 +2903,13 @@ const we = (t) => {
2884
2903
  if (!t) return;
2885
2904
  const e = t.indexOf("#");
2886
2905
  return e < 0 ? void 0 : t.substring(e + 1) || void 0;
2887
- }, Fo = (t) => {
2906
+ }, Eo = (t) => {
2888
2907
  try {
2889
2908
  return decodeURIComponent(t);
2890
2909
  } catch {
2891
2910
  return t;
2892
2911
  }
2893
- }, tn = (t, e = []) => t.flatMap((n) => {
2912
+ }, an = (t, e = []) => t.flatMap((n) => {
2894
2913
  const i = [...e, { title: n.title, path: n.path }], r = n.href || n.path;
2895
2914
  return [
2896
2915
  {
@@ -2898,16 +2917,16 @@ const we = (t) => {
2898
2917
  href: r,
2899
2918
  anchorId: bt(n.href) ?? bt(n.path)
2900
2919
  },
2901
- ...tn(n.contents, i)
2920
+ ...an(n.contents, i)
2902
2921
  ];
2903
- }), Mo = (t) => {
2922
+ }), Ro = (t) => {
2904
2923
  const e = /* @__PURE__ */ new Map();
2905
2924
  return t.spineItems.forEach((n, i) => {
2906
2925
  e.has(n.href) || e.set(n.href, i);
2907
2926
  }), e;
2908
- }, Co = (t, e) => {
2909
- const n = Mo(e);
2910
- return tn(t).map((i) => {
2927
+ }, Do = (t, e) => {
2928
+ const n = Ro(e);
2929
+ return an(t).map((i) => {
2911
2930
  const r = we(i.href), o = n.get(r) ?? -1;
2912
2931
  return {
2913
2932
  ...i,
@@ -2915,7 +2934,7 @@ const we = (t) => {
2915
2934
  spineItemIndex: o
2916
2935
  };
2917
2936
  });
2918
- }, Lo = ({
2937
+ }, Oo = ({
2919
2938
  manifest: t,
2920
2939
  tocIndex: e
2921
2940
  }) => {
@@ -2939,7 +2958,7 @@ const we = (t) => {
2939
2958
  u,
2940
2959
  d
2941
2960
  ] of n)
2942
- No(
2961
+ Vo(
2943
2962
  s,
2944
2963
  u
2945
2964
  ) && c.push(...d);
@@ -2950,7 +2969,7 @@ const we = (t) => {
2950
2969
  i.set(o.href, a);
2951
2970
  }
2952
2971
  return i;
2953
- }, No = (t, e) => t === e || t.endsWith(e) || e.endsWith(t), Ao = (t, e) => {
2972
+ }, Vo = (t, e) => t === e || t.endsWith(e) || e.endsWith(t), jo = (t, e) => {
2954
2973
  const n = t.endsWith(e), i = t.substring(
2955
2974
  0,
2956
2975
  t.lastIndexOf("/")
@@ -2959,7 +2978,7 @@ const we = (t) => {
2959
2978
  e.lastIndexOf("/")
2960
2979
  ), o = i !== "" && i.endsWith(r);
2961
2980
  return n || o;
2962
- }, nn = (t) => {
2981
+ }, cn = (t) => {
2963
2982
  const [e, ...n] = t;
2964
2983
  if (!e) return;
2965
2984
  const i = {
@@ -2975,7 +2994,7 @@ const we = (t) => {
2975
2994
  r.subChapter = s, r = s;
2976
2995
  }
2977
2996
  return i;
2978
- }, Eo = ({
2997
+ }, ko = ({
2979
2998
  doc: t,
2980
2999
  node: e,
2981
3000
  offset: n
@@ -2989,14 +3008,14 @@ const we = (t) => {
2989
3008
  i.setStart(e, o);
2990
3009
  }
2991
3010
  return i.collapse(!0), i;
2992
- }, Ro = ({
3011
+ }, Uo = ({
2993
3012
  rangeToTest: t,
2994
3013
  upperBoundRange: e
2995
- }) => t.compareBoundaryPoints(Range.START_TO_START, e) < 0, Do = (t) => {
3014
+ }) => t.compareBoundaryPoints(Range.START_TO_START, e) < 0, zo = (t) => {
2996
3015
  const e = t.createRange(), n = t.body ?? t.documentElement;
2997
3016
  if (n)
2998
3017
  return e.selectNodeContents(n), e.collapse(!1), e;
2999
- }, Oo = ({
3018
+ }, Wo = ({
3000
3019
  anchorNode: t,
3001
3020
  nextPageNode: e
3002
3021
  }) => t === e || t.contains(e), vt = ({
@@ -3009,11 +3028,11 @@ const we = (t) => {
3009
3028
  if (!t || e === void 0 || !i || n.length === 0) return;
3010
3029
  const o = i.renderer.getDocumentFrame()?.contentDocument;
3011
3030
  if (!o || t.ownerDocument !== o) return;
3012
- const s = r?.firstVisibleNode?.node, a = r?.firstVisibleNode?.offset, c = r ? s !== void 0 && a !== void 0 && s.ownerDocument === o ? Eo({
3031
+ const s = r?.firstVisibleNode?.node, a = r?.firstVisibleNode?.offset, c = r ? s !== void 0 && a !== void 0 && s.ownerDocument === o ? ko({
3013
3032
  doc: o,
3014
3033
  node: s,
3015
3034
  offset: a
3016
- }) : void 0 : Do(o);
3035
+ }) : void 0 : zo(o);
3017
3036
  if (!c) return;
3018
3037
  const u = r !== void 0 && s !== void 0 && s.ownerDocument === o;
3019
3038
  let d, l, g;
@@ -3022,14 +3041,14 @@ const we = (t) => {
3022
3041
  g = h.chain;
3023
3042
  continue;
3024
3043
  }
3025
- const m = o.getElementById(Fo(h.anchorId));
3026
- if (!m || u && Oo({
3044
+ const m = o.getElementById(Eo(h.anchorId));
3045
+ if (!m || u && Wo({
3027
3046
  anchorNode: m,
3028
3047
  nextPageNode: s
3029
3048
  }))
3030
3049
  continue;
3031
3050
  const f = o.createRange();
3032
- f.setStartBefore(m), f.collapse(!0), Ro({
3051
+ f.setStartBefore(m), f.collapse(!0), Uo({
3033
3052
  rangeToTest: f,
3034
3053
  upperBoundRange: c
3035
3054
  }) && (!l || f.compareBoundaryPoints(
@@ -3038,15 +3057,15 @@ const we = (t) => {
3038
3057
  ) > 0) && (d = h.chain, l = f);
3039
3058
  }
3040
3059
  const p = d ?? g;
3041
- return p ? nn(p) : void 0;
3042
- }, Vo = ({
3060
+ return p ? cn(p) : void 0;
3061
+ }, _o = ({
3043
3062
  candidate: t,
3044
3063
  hrefHasAnchor: e
3045
3064
  }) => {
3046
3065
  if (e || !t.anchorId) return !1;
3047
3066
  const n = t.chain[t.chain.length - 1], i = t.chain[t.chain.length - 2];
3048
3067
  return !n || !i ? !1 : we(n.path) === we(i.path);
3049
- }, ko = ({
3068
+ }, Bo = ({
3050
3069
  href: t,
3051
3070
  tocIndex: e,
3052
3071
  manifest: n
@@ -3056,18 +3075,18 @@ const we = (t) => {
3056
3075
  );
3057
3076
  let s;
3058
3077
  for (const a of e)
3059
- Ao(
3078
+ jo(
3060
3079
  i,
3061
3080
  a.hrefWithoutAnchor
3062
- ) && (o < a.spineItemIndex || Vo({ candidate: a, hrefHasAnchor: r }) || (s = a.chain));
3081
+ ) && (o < a.spineItemIndex || _o({ candidate: a, hrefHasAnchor: r }) || (s = a.chain));
3063
3082
  return s;
3064
- }, jo = (t, e, n) => {
3065
- const { href: i } = n, r = ko({ href: i, tocIndex: e, manifest: t });
3066
- return r ? nn(r) : void 0;
3067
- }, Uo = (t, e) => t ? t.spineItems.reduce(
3068
- (i, r) => (i[r.id] = jo(t, e, r), i),
3083
+ }, Ho = (t, e, n) => {
3084
+ const { href: i } = n, r = Bo({ href: i, tocIndex: e, manifest: t });
3085
+ return r ? cn(r) : void 0;
3086
+ }, qo = (t, e) => t ? t.spineItems.reduce(
3087
+ (i, r) => (i[r.id] = Ho(t, e, r), i),
3069
3088
  {}
3070
- ) : {}, zo = (t, e, n) => t + e * n, Wo = (t, e, n) => {
3089
+ ) : {}, Yo = (t, e, n) => t + e * n, Xo = (t, e, n) => {
3071
3090
  const { height: i, width: r } = n.layoutInfo, { top: o, left: s } = t.spine.getSpineItemSpineLayoutInfo(n);
3072
3091
  return t.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
3073
3092
  0,
@@ -3082,8 +3101,8 @@ const we = (t) => {
3082
3101
  (e.x - s + t.viewport.absoluteViewport.width) / r
3083
3102
  )
3084
3103
  );
3085
- }, _o = (t, e, n, i, r, o) => r.isReady$.pipe(
3086
- k(),
3104
+ }, Go = (t, e, n, i, r, o) => r.isReady$.pipe(
3105
+ j(),
3087
3106
  _(t.layoutInfo$),
3088
3107
  y(([s, a]) => {
3089
3108
  const c = o.renditionLayout === "pre-paginated", u = o.spineItems.length || 0, d = o.spineItems.slice(0, e).reduce((b, $) => b + ($.progressionWeight ?? 0), 0) || 0, l = t.spineItemsManager.getSpineItemIndex(r) ?? 0, g = o.spineItems.length ?? 0, p = a.pages.filter((b) => b.itemIndex === l).length ?? 0, h = o.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
@@ -3092,56 +3111,77 @@ const we = (t) => {
3092
3111
  let m = (n + 1) * (h / p);
3093
3112
  !c && r.renditionLayout === "reflowable" && !s && (m = 0);
3094
3113
  let f = d + m;
3095
- return o.renditionFlow === "scrolled-continuous" && (s ? m = Wo(
3114
+ return o.renditionFlow === "scrolled-continuous" && (s ? m = Xo(
3096
3115
  t,
3097
3116
  i,
3098
3117
  r
3099
- ) : m = 0, f = zo(
3118
+ ) : m = 0, f = Yo(
3100
3119
  d,
3101
3120
  h,
3102
3121
  m
3103
3122
  )), e === u - 1 && n === p - 1 && f > 0.99 ? 1 : f;
3104
3123
  })
3105
- ), Bo = {
3124
+ ), wt = (t) => {
3125
+ if (t?.item.pageSpreadLeft) return "left";
3126
+ if (t?.item.pageSpreadRight) return "right";
3127
+ }, xt = (t, e) => {
3128
+ const n = wt(t), i = wt(e);
3129
+ return n !== void 0 && i !== void 0 && n !== i;
3130
+ }, Pt = ({
3131
+ item: t,
3132
+ nextItem: e,
3133
+ previousItem: n
3134
+ }) => xt(t, n) || xt(t, e), Zo = {
3106
3135
  tocCandidatesBySpineHref: /* @__PURE__ */ new Map(),
3107
3136
  chaptersInfo: {}
3108
- }, Ho = ({
3137
+ }, Jo = ({
3109
3138
  beginItem: t,
3110
3139
  endItem: e,
3111
3140
  paginationInfo: n,
3112
3141
  chaptersData: i,
3113
- pagesState: r
3142
+ pagesState: r,
3143
+ spineItems: o
3114
3144
  }) => {
3115
- const o = t && n.beginPageIndexInSpineItem !== void 0 ? pe.fromSpineItemPageIndex(
3145
+ const s = t && n.beginPageIndexInSpineItem !== void 0 ? pe.fromSpineItemPageIndex(
3116
3146
  r,
3117
3147
  t.index,
3118
3148
  n.beginPageIndexInSpineItem
3119
- ) : void 0, s = o ? pe.fromNextPageWithinSameSpineItem(r, o) : void 0, a = e && n.endPageIndexInSpineItem !== void 0 ? pe.fromSpineItemPageIndex(
3149
+ ) : void 0, a = s ? pe.fromNextPageWithinSameSpineItem(r, s) : void 0, c = e && n.endPageIndexInSpineItem !== void 0 ? pe.fromSpineItemPageIndex(
3120
3150
  r,
3121
3151
  e.index,
3122
3152
  n.endPageIndexInSpineItem
3123
- ) : void 0, c = a ? pe.fromNextPageWithinSameSpineItem(r, a) : void 0, u = t ? vt({
3124
- node: o?.firstVisibleNode?.node,
3125
- offset: o?.firstVisibleNode?.offset,
3153
+ ) : void 0, u = c ? pe.fromNextPageWithinSameSpineItem(r, c) : void 0, d = t ? vt({
3154
+ node: s?.firstVisibleNode?.node,
3155
+ offset: s?.firstVisibleNode?.offset,
3126
3156
  candidates: i.tocCandidatesBySpineHref.get(t.item.href) ?? [],
3127
3157
  spineItem: t,
3128
- nextPageEntry: s
3129
- }) : void 0, d = e ? vt({
3130
- node: a?.firstVisibleNode?.node,
3131
- offset: a?.firstVisibleNode?.offset,
3158
+ nextPageEntry: a
3159
+ }) : void 0, l = e ? vt({
3160
+ node: c?.firstVisibleNode?.node,
3161
+ offset: c?.firstVisibleNode?.offset,
3132
3162
  candidates: i.tocCandidatesBySpineHref.get(e.item.href) ?? [],
3133
3163
  spineItem: e,
3134
- nextPageEntry: c
3164
+ nextPageEntry: u
3135
3165
  }) : void 0;
3136
3166
  return {
3137
- beginChapterInfo: u ?? (t ? i.chaptersInfo[t.item.id] : void 0),
3167
+ beginChapterInfo: d ?? (t ? i.chaptersInfo[t.item.id] : void 0),
3168
+ beginHasAdjacentSpreadPage: Pt({
3169
+ item: t,
3170
+ nextItem: t !== void 0 ? o[t.index + 1] : void 0,
3171
+ previousItem: t !== void 0 ? o[t.index - 1] : void 0
3172
+ }),
3138
3173
  beginSpineItemReadingDirection: t?.readingDirection,
3139
- beginAbsolutePageIndex: o?.absolutePageIndex,
3140
- endChapterInfo: d ?? (e ? i.chaptersInfo[e.item.id] : void 0),
3174
+ beginAbsolutePageIndex: s?.absolutePageIndex,
3175
+ endChapterInfo: l ?? (e ? i.chaptersInfo[e.item.id] : void 0),
3176
+ endHasAdjacentSpreadPage: Pt({
3177
+ item: e,
3178
+ nextItem: e !== void 0 ? o[e.index + 1] : void 0,
3179
+ previousItem: e !== void 0 ? o[e.index - 1] : void 0
3180
+ }),
3141
3181
  endSpineItemReadingDirection: e?.readingDirection,
3142
- endAbsolutePageIndex: a?.absolutePageIndex
3182
+ endAbsolutePageIndex: c?.absolutePageIndex
3143
3183
  };
3144
- }, qo = ({
3184
+ }, Ko = ({
3145
3185
  items: t,
3146
3186
  pagesState: e
3147
3187
  }) => {
@@ -3155,16 +3195,16 @@ const we = (t) => {
3155
3195
  */
3156
3196
  numberOfTotalPages: e.pages.length
3157
3197
  };
3158
- }, Yo = (t, e) => t.numberOfTotalPages !== e.numberOfTotalPages || t.numberOfPagesPerItems.length !== e.numberOfPagesPerItems.length ? !1 : t.numberOfPagesPerItems.every(
3198
+ }, Qo = (t, e) => t.numberOfTotalPages !== e.numberOfTotalPages || t.numberOfPagesPerItems.length !== e.numberOfPagesPerItems.length ? !1 : t.numberOfPagesPerItems.every(
3159
3199
  (n, i) => n === e.numberOfPagesPerItems[i]
3160
- ), Xo = ({
3200
+ ), er = ({
3161
3201
  reader: t,
3162
3202
  paginationInfo: e,
3163
3203
  navigationPosition: n,
3164
3204
  manifest: i
3165
3205
  }) => {
3166
3206
  const r = t.spineItemsManager.get(e.endSpineItemIndex);
3167
- return r ? _o(
3207
+ return r ? Go(
3168
3208
  t,
3169
3209
  e.endSpineItemIndex ?? 0,
3170
3210
  e.endPageIndexInSpineItem || 0,
@@ -3172,47 +3212,45 @@ const we = (t) => {
3172
3212
  r,
3173
3213
  i
3174
3214
  ) : v(0);
3175
- }, Go = (t) => t.context.manifest$.pipe(
3215
+ }, tr = (t) => t.context.manifest$.pipe(
3176
3216
  y((e) => {
3177
3217
  if (!e)
3178
- return Bo;
3179
- const n = Co(e.nav?.toc ?? [], e);
3218
+ return Zo;
3219
+ const n = Do(e.nav?.toc ?? [], e);
3180
3220
  return {
3181
- tocCandidatesBySpineHref: Lo({
3221
+ tocCandidatesBySpineHref: Oo({
3182
3222
  manifest: e,
3183
3223
  tocIndex: n
3184
3224
  }),
3185
- chaptersInfo: Uo(e, n)
3225
+ chaptersInfo: qo(e, n)
3186
3226
  };
3187
3227
  })
3188
- ), Zo = (t) => ({
3228
+ ), nr = (t) => ({
3189
3229
  beginSpineItemIndex: t.beginSpineItemIndex,
3190
3230
  beginPageIndexInSpineItem: t.beginPageIndexInSpineItem,
3191
3231
  endSpineItemIndex: t.endSpineItemIndex,
3192
3232
  endPageIndexInSpineItem: t.endPageIndexInSpineItem
3193
- }), Jo = (t) => {
3194
- const e = t.pagination.state$, n = t.spine.pages.layout$, i = Go(t).pipe(
3233
+ }), ir = (t) => {
3234
+ const e = t.pagination.state$, n = t.spine.pages.layout$, i = tr(t).pipe(
3195
3235
  Y({ bufferSize: 1, refCount: !0 })
3196
3236
  ), r = e.pipe(
3197
- y(Zo),
3198
- N(j)
3237
+ y(nr),
3238
+ N(k)
3199
3239
  ), o = V([
3200
3240
  r,
3201
3241
  i,
3202
- n
3242
+ n,
3243
+ t.spineItemsManager.items$
3203
3244
  ]).pipe(
3204
- y(([l, g, p]) => {
3205
- const h = t.spineItemsManager.get(
3206
- l.beginSpineItemIndex
3207
- ), m = t.spineItemsManager.get(
3208
- l.endSpineItemIndex
3209
- );
3210
- return Ho({
3211
- beginItem: h,
3212
- endItem: m,
3245
+ y(([l, g, p, h]) => {
3246
+ const m = l.beginSpineItemIndex !== void 0 ? h[l.beginSpineItemIndex] : void 0, f = l.endSpineItemIndex !== void 0 ? h[l.endSpineItemIndex] : void 0;
3247
+ return Jo({
3248
+ beginItem: m,
3249
+ endItem: f,
3213
3250
  paginationInfo: l,
3214
3251
  chaptersData: g,
3215
- pagesState: p
3252
+ pagesState: p,
3253
+ spineItems: h
3216
3254
  });
3217
3255
  }),
3218
3256
  Y({ bufferSize: 1, refCount: !0 })
@@ -3224,9 +3262,9 @@ const we = (t) => {
3224
3262
  t.spineItemsManager.items$
3225
3263
  ]).pipe(
3226
3264
  y(
3227
- ([l, g]) => qo({ items: g, pagesState: l })
3265
+ ([l, g]) => Ko({ items: g, pagesState: l })
3228
3266
  ),
3229
- N(Yo)
3267
+ N(Qo)
3230
3268
  ), c = V([
3231
3269
  e,
3232
3270
  s,
@@ -3239,9 +3277,9 @@ const we = (t) => {
3239
3277
  isUsingSpread: g,
3240
3278
  ...h
3241
3279
  }))
3242
- ), u = Jt(t.navigation).pipe(
3280
+ ), u = nn(t.navigation).pipe(
3243
3281
  y(({ position: l }) => l),
3244
- N(j)
3282
+ N(k)
3245
3283
  ), d = V([
3246
3284
  e,
3247
3285
  t.layout$,
@@ -3249,7 +3287,7 @@ const we = (t) => {
3249
3287
  t.context.manifest$
3250
3288
  ]).pipe(
3251
3289
  x(
3252
- ([l, g, p, h]) => Xo({
3290
+ ([l, g, p, h]) => er({
3253
3291
  reader: t,
3254
3292
  paginationInfo: l,
3255
3293
  navigationPosition: p,
@@ -3271,13 +3309,14 @@ const we = (t) => {
3271
3309
  ...l,
3272
3310
  ...g
3273
3311
  })),
3274
- N(j),
3275
- wn(5)
3312
+ N(k),
3313
+ Fn(5)
3276
3314
  );
3277
- }, Ko = (t) => (e) => {
3315
+ }, or = (t) => (e) => {
3278
3316
  const n = t(e), i = new J({
3279
3317
  ...n.pagination.state,
3280
3318
  beginChapterInfo: void 0,
3319
+ beginHasAdjacentSpreadPage: !1,
3281
3320
  beginCfi: void 0,
3282
3321
  beginPageIndexInSpineItem: void 0,
3283
3322
  isUsingSpread: !1,
@@ -3288,9 +3327,10 @@ const we = (t) => {
3288
3327
  beginSpineItemIndex: void 0,
3289
3328
  endCfi: void 0,
3290
3329
  endChapterInfo: void 0,
3330
+ endHasAdjacentSpreadPage: !1,
3291
3331
  endSpineItemReadingDirection: void 0,
3292
3332
  percentageEstimateOfBook: 0
3293
- }), r = new vo(n), o = Jo(n).pipe(T((s) => L.log("Pagination", s))).subscribe(i);
3333
+ }), r = new Fo(n), o = ir(n).pipe(T((s) => L.log("Pagination", s))).subscribe(i);
3294
3334
  return {
3295
3335
  ...n,
3296
3336
  locateResource: r.locateResource.bind(r),
@@ -3307,7 +3347,7 @@ const we = (t) => {
3307
3347
  }
3308
3348
  }
3309
3349
  };
3310
- }, Qo = (t) => ({
3350
+ }, rr = (t) => ({
3311
3351
  put: (o, s) => new Promise((a, c) => {
3312
3352
  const u = t.transaction(["store"], "readwrite");
3313
3353
  u.onerror = (g) => {
@@ -3364,11 +3404,11 @@ const we = (t) => {
3364
3404
  i.onerror = (r) => {
3365
3405
  n(r);
3366
3406
  }, i.onsuccess = () => {
3367
- e(Qo(i.result));
3407
+ e(rr(i.result));
3368
3408
  }, i.onupgradeneeded = () => {
3369
3409
  i.result.createObjectStore("store");
3370
3410
  };
3371
- }), er = (t) => {
3411
+ }), sr = (t) => {
3372
3412
  let e = Date.now().toString();
3373
3413
  const n = new D(), i = (c) => {
3374
3414
  if (typeof c == "string" || typeof c == "object") {
@@ -3388,10 +3428,10 @@ const we = (t) => {
3388
3428
  n.next({ id: c, data: u });
3389
3429
  };
3390
3430
  n.asObservable().pipe(
3391
- Dn(({ id: c, data: u }) => {
3431
+ Un(({ id: c, data: u }) => {
3392
3432
  const d = i(c);
3393
3433
  return d ? H(
3394
- xn([ze("prose-reader"), H(u.blob())])
3434
+ Mn([ze("prose-reader"), H(u.blob())])
3395
3435
  ).pipe(
3396
3436
  q(([l, g]) => H(l.put(`${e}_${d.id}`, g))),
3397
3437
  lt((l) => (L.error(l), B))
@@ -3426,8 +3466,8 @@ const we = (t) => {
3426
3466
  n.complete();
3427
3467
  }
3428
3468
  };
3429
- }, tr = (t) => (e) => {
3430
- const n = t(e), i = er(n.context);
3469
+ }, ar = (t) => (e) => {
3470
+ const n = t(e), i = sr(n.context);
3431
3471
  return {
3432
3472
  ...n,
3433
3473
  // $: {
@@ -3439,7 +3479,7 @@ const we = (t) => {
3439
3479
  }
3440
3480
  // load,
3441
3481
  };
3442
- }, nr = (t, e) => {
3482
+ }, cr = (t, e) => {
3443
3483
  const n = t.node.ownerDocument?.createRange(), i = t.node.compareDocumentPosition(e.node);
3444
3484
  if (n) {
3445
3485
  try {
@@ -3459,14 +3499,14 @@ const we = (t) => {
3459
3499
  }
3460
3500
  return n;
3461
3501
  }
3462
- }, ir = ({
3502
+ }, ur = ({
3463
3503
  selection: t,
3464
3504
  spineItem: e
3465
3505
  }) => {
3466
3506
  const { anchorNode: n, anchorOffset: i, focusNode: r, focusOffset: o } = t;
3467
3507
  if (!(!n || !r))
3468
3508
  try {
3469
- return nr(
3509
+ return cr(
3470
3510
  { node: n, offset: i },
3471
3511
  { node: r, offset: o }
3472
3512
  );
@@ -3478,7 +3518,7 @@ const we = (t) => {
3478
3518
  return;
3479
3519
  }
3480
3520
  };
3481
- class or extends X {
3521
+ class dr extends X {
3482
3522
  constructor(e) {
3483
3523
  super();
3484
3524
  const n = e.contentDocument || e.contentWindow?.document;
@@ -3515,7 +3555,7 @@ class or extends X {
3515
3555
  Z(n, "pointercancel"),
3516
3556
  Z(n, "contextmenu")
3517
3557
  ).pipe(
3518
- k(),
3558
+ j(),
3519
3559
  /**
3520
3560
  * The selection is still valid during the event even if it will
3521
3561
  * be discarded. The timeout make sure to detect this edge case.
@@ -3533,11 +3573,11 @@ class or extends X {
3533
3573
  }
3534
3574
  }
3535
3575
  }
3536
- const rr = (t) => t.watch("isLoaded").pipe(
3576
+ const lr = (t) => t.watch("isLoaded").pipe(
3537
3577
  x(() => {
3538
3578
  const e = t.renderer.getDocumentFrame(), n = e?.contentDocument || e?.contentWindow?.document;
3539
3579
  if (!e || !n) return fe;
3540
- const i = new or(e);
3580
+ const i = new dr(e);
3541
3581
  return P(
3542
3582
  i.selectionChange$.pipe(
3543
3583
  y((r) => {
@@ -3564,14 +3604,14 @@ const rr = (t) => t.watch("isLoaded").pipe(
3564
3604
  );
3565
3605
  }),
3566
3606
  N()
3567
- ), sr = (t) => (e) => {
3607
+ ), pr = (t) => (e) => {
3568
3608
  const n = t(e);
3569
3609
  let i;
3570
3610
  const r = n.spineItemsManager.items$.pipe(
3571
3611
  x((d) => {
3572
3612
  const l = d.map((g) => {
3573
3613
  const p = n.spineItemsManager.getSpineItemIndex(g) ?? 0;
3574
- return rr(g).pipe(
3614
+ return lr(g).pipe(
3575
3615
  y((h) => {
3576
3616
  if (h)
3577
3617
  return {
@@ -3619,10 +3659,10 @@ const rr = (t) => t.watch("isLoaded").pipe(
3619
3659
  selectionOver$: c,
3620
3660
  lastSelectionOnPointerdown$: u,
3621
3661
  getSelection: () => i,
3622
- createOrderedRangeFromSelection: ir
3662
+ createOrderedRangeFromSelection: ur
3623
3663
  }
3624
3664
  };
3625
- }, wt = [
3665
+ }, $t = [
3626
3666
  {
3627
3667
  name: "bright",
3628
3668
  backgroundColor: "white"
@@ -3637,11 +3677,11 @@ const rr = (t) => t.watch("isLoaded").pipe(
3637
3677
  backgroundColor: "#191717",
3638
3678
  foregroundColor: "#f1ebeb"
3639
3679
  }
3640
- ], ar = (t) => (e) => {
3680
+ ], gr = (t) => (e) => {
3641
3681
  const n = t(e), i = new J(
3642
3682
  e.theme ?? "bright"
3643
3683
  ), r = () => {
3644
- const a = wt.find(
3684
+ const a = $t.find(
3645
3685
  (c) => c.name === i.value
3646
3686
  );
3647
3687
  return `
@@ -3658,7 +3698,7 @@ const rr = (t) => t.watch("isLoaded").pipe(
3658
3698
  }, o = ({
3659
3699
  container: a
3660
3700
  }) => {
3661
- const c = wt.find(
3701
+ const c = $t.find(
3662
3702
  (u) => u.name === i.value
3663
3703
  );
3664
3704
  return c && a.style.setProperty(
@@ -3702,12 +3742,12 @@ const rr = (t) => t.watch("isLoaded").pipe(
3702
3742
  }
3703
3743
  }
3704
3744
  };
3705
- }, cr = (t) => (e) => {
3745
+ }, hr = (t) => (e) => {
3706
3746
  const n = t(e);
3707
3747
  return {
3708
3748
  ...n,
3709
3749
  utils: {
3710
- isOrIsWithinValidLink: (o) => !!(Wt(o) && (o.nodeName === "a" ? o : o.closest("a"))?.getAttribute("href")),
3750
+ isOrIsWithinValidLink: (o) => !!(Ht(o) && (o.nodeName === "a" ? o : o.closest("a"))?.getAttribute("href")),
3711
3751
  injectScopedCSS: (o, s, a) => {
3712
3752
  const c = a.replace("${id}", n.id);
3713
3753
  return it(o, `${s}-${n.id}`, c);
@@ -3716,7 +3756,7 @@ const rr = (t) => t.watch("isLoaded").pipe(
3716
3756
  };
3717
3757
  };
3718
3758
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3719
- const ur = (t) => (e) => t(e), xt = (t, e, n) => {
3759
+ const mr = (t) => (e) => t(e), Tt = (t, e, n) => {
3720
3760
  const { clientWidth: i, clientHeight: r } = n.value.element, o = {
3721
3761
  maxX: 0,
3722
3762
  minX: i * (1 - e),
@@ -3727,30 +3767,30 @@ const ur = (t) => (e) => t(e), xt = (t, e, n) => {
3727
3767
  x: Math.min(Math.max(t.x, o.minX), o.maxX),
3728
3768
  y: Math.min(Math.max(t.y, o.minY), o.maxY)
3729
3769
  };
3730
- }, dr = (t, e, n) => {
3770
+ }, fr = (t, e, n) => {
3731
3771
  n.style.transformOrigin = "0 0";
3732
3772
  const i = `translate3d(${e.x}px, ${e.y}px, 0px)`, r = `scale(${t})`;
3733
3773
  n.style.transform = `${i} ${r}`;
3734
- }, lr = (t, e, n, i) => {
3774
+ }, yr = (t, e, n, i) => {
3735
3775
  const r = e / t, o = n.clientWidth, s = n.clientHeight, a = o / 2 - i.x, c = s / 2 - i.y;
3736
3776
  return {
3737
3777
  x: i.x + a * (1 - r),
3738
3778
  y: i.y + c * (1 - r)
3739
3779
  };
3740
3780
  };
3741
- class on {
3781
+ class un {
3742
3782
  constructor(e) {
3743
3783
  this.x = e.x, this.y = e.y;
3744
3784
  }
3745
3785
  }
3746
- class Pt extends on {
3786
+ class Ft extends un {
3747
3787
  }
3748
- class pr extends on {
3788
+ class Sr extends un {
3749
3789
  constructor() {
3750
3790
  super(...arguments), this.__symbol = /* @__PURE__ */ Symbol("UnboundScrollPosition");
3751
3791
  }
3752
3792
  }
3753
- class gr extends te {
3793
+ class Ir extends te {
3754
3794
  constructor(e, n, i, r, o) {
3755
3795
  super({
3756
3796
  element: void 0
@@ -3766,7 +3806,7 @@ class gr extends te {
3766
3806
  T(() => {
3767
3807
  this.scrollingSubject.next(!1);
3768
3808
  }),
3769
- F(P(this.scrollingSubject.pipe(Dt(1)), this.destroy$))
3809
+ F(P(this.scrollingSubject.pipe(jt(1)), this.destroy$))
3770
3810
  ).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {}));
3771
3811
  }, this.isActive = () => this.settings.values.computedPageTurnMode === "scrollable", this.getNavigationVisibleArea = () => this.viewport.relativeViewport;
3772
3812
  const s = this.context.pipe(
@@ -3774,7 +3814,7 @@ class gr extends te {
3774
3814
  T(({ rootElement: l }) => {
3775
3815
  if (!l) return;
3776
3816
  const g = document.createElement("div");
3777
- g.setAttribute(`data-${Bi}`, ""), g.appendChild(this.viewport.value.element), l.appendChild(g), this.update({ element: g });
3817
+ g.setAttribute(`data-${Gi}`, ""), g.appendChild(this.viewport.value.element), l.appendChild(g), this.update({ element: g });
3778
3818
  })
3779
3819
  ), a = V([
3780
3820
  n.watch(["computedPageTurnMode"]),
@@ -3852,28 +3892,28 @@ class gr extends te {
3852
3892
  }
3853
3893
  fromSpinePosition(e) {
3854
3894
  const n = this.viewport.scaleFactor;
3855
- return new Pt({
3895
+ return new Ft({
3856
3896
  x: e.x * n,
3857
3897
  y: e.y * n
3858
3898
  });
3859
3899
  }
3860
3900
  get scrollPosition() {
3861
3901
  const e = this.value.element;
3862
- return new Pt({
3902
+ return new Ft({
3863
3903
  x: e?.scrollLeft ?? 0,
3864
3904
  y: e?.scrollTop ?? 0
3865
3905
  });
3866
3906
  }
3867
3907
  }
3868
- const hr = (t, e, n, i, r) => {
3908
+ const br = (t, e, n, i, r) => {
3869
3909
  const o = t.clientWidth, s = t.clientHeight, a = t.scrollLeft, c = t.scrollTop, u = a + o / 2 - i, d = c + s / 2 - r, l = n / e, g = u * l, p = d * l, h = g - o / 2 + i, m = p - s / 2 + r;
3870
- return new pr({
3910
+ return new Sr({
3871
3911
  x: h,
3872
3912
  y: m
3873
3913
  });
3874
- }, mr = (t, e) => {
3875
- const n = e.viewport, i = e.navigation.scrollNavigationController, r = n.value.element, o = i.value.element, s = i.value.element, a = Math.round(n.scaleFactor * 100) / 100, c = r.offsetLeft, u = r.offsetTop, d = hr(
3876
- o ?? Xn(),
3914
+ }, vr = (t, e) => {
3915
+ const n = e.viewport, i = e.navigation.scrollNavigationController, r = n.value.element, o = i.value.element, s = i.value.element, a = Math.round(n.scaleFactor * 100) / 100, c = r.offsetLeft, u = r.offsetTop, d = br(
3916
+ o ?? Qn(),
3877
3917
  a,
3878
3918
  t,
3879
3919
  c,
@@ -3890,7 +3930,7 @@ const hr = (t, e, n, i, r) => {
3890
3930
  position: g
3891
3931
  });
3892
3932
  }, $e = 200;
3893
- class fr extends te {
3933
+ class wr extends te {
3894
3934
  constructor(e) {
3895
3935
  super({
3896
3936
  isZooming: !1,
@@ -3948,7 +3988,7 @@ class fr extends te {
3948
3988
  }
3949
3989
  move(e, n) {
3950
3990
  this.isControlled && (this.viewport.element.style.transition = "", this.updateZoom(this.value.currentScale, e, {
3951
- constraints: n?.constrain === "within-viewport" ? (...i) => xt(...i, this.reader.viewport) : void 0
3991
+ constraints: n?.constrain === "within-viewport" ? (...i) => Tt(...i, this.reader.viewport) : void 0
3952
3992
  }));
3953
3993
  }
3954
3994
  scaleAt(e, n) {
@@ -3956,12 +3996,12 @@ class fr extends te {
3956
3996
  this.viewport.element.style.transition = "";
3957
3997
  const r = Math.ceil(e * 100) / 100;
3958
3998
  this.updateZoom(r, void 0, {
3959
- constraints: n?.constrain === "within-viewport" ? (...o) => xt(...o, this.reader.viewport) : void 0
3999
+ constraints: n?.constrain === "within-viewport" ? (...o) => Tt(...o, this.reader.viewport) : void 0
3960
4000
  });
3961
4001
  }
3962
4002
  updateZoom(e, n, i) {
3963
4003
  if (this.isControlled) {
3964
- const r = n || lr(
4004
+ const r = n || yr(
3965
4005
  this.value.currentScale,
3966
4006
  e,
3967
4007
  this.viewport.element,
@@ -3977,11 +4017,11 @@ class fr extends te {
3977
4017
  });
3978
4018
  }
3979
4019
  applyZoom(e, n) {
3980
- this.isControlled ? dr(
4020
+ this.isControlled ? fr(
3981
4021
  e,
3982
4022
  n,
3983
4023
  this.viewport.element
3984
- ) : mr(e, this.reader), this.reader.viewport.layout();
4024
+ ) : vr(e, this.reader), this.reader.viewport.layout();
3985
4025
  }
3986
4026
  get isControlled() {
3987
4027
  return this.reader.settings.values.computedPageTurnMode === "controlled";
@@ -3993,8 +4033,8 @@ class fr extends te {
3993
4033
  return this.reader.viewport.value;
3994
4034
  }
3995
4035
  }
3996
- const yr = (t) => (e) => {
3997
- const n = t(e), i = new fr(n), r = () => {
4036
+ const xr = (t) => (e) => {
4037
+ const n = t(e), i = new wr(n), r = () => {
3998
4038
  i.destroy(), n.destroy();
3999
4039
  }, o = i;
4000
4040
  return {
@@ -4011,8 +4051,8 @@ const yr = (t) => (e) => {
4011
4051
  }
4012
4052
  }
4013
4053
  };
4014
- }, rn = (t) => t?.renditionLayout === "pre-paginated" || t?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
4015
- class Sr {
4054
+ }, dn = (t) => t?.renditionLayout === "pre-paginated" || t?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
4055
+ class Pr {
4016
4056
  constructor() {
4017
4057
  this.navigationSubject = new Ve(1), this.positionSubject = new Ve(1), this.viewportStateSubject = new J("free"), this.paginationSubject = new Ve(1), this.pagination$ = this.paginationSubject.asObservable(), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
4018
4058
  C((e) => e === "free")
@@ -4021,11 +4061,11 @@ class Sr {
4021
4061
  ), this.navigation$ = this.navigationSubject.asObservable(), this.position$ = this.positionSubject.asObservable();
4022
4062
  }
4023
4063
  }
4024
- class Ir extends te {
4064
+ class $r extends te {
4025
4065
  constructor() {
4026
4066
  super({
4027
4067
  assumedRenditionLayout: "reflowable"
4028
- }), this.bridgeEvent = new Sr(), this.manifest$ = this.pipe(
4068
+ }), this.bridgeEvent = new Pr(), this.manifest$ = this.pipe(
4029
4069
  ue((e) => e.manifest),
4030
4070
  he(Q),
4031
4071
  Re()
@@ -4036,7 +4076,7 @@ class Ir extends te {
4036
4076
  ...n,
4037
4077
  ...e,
4038
4078
  ...e.manifest && {
4039
- isFullyPrePaginated: rn(i),
4079
+ isFullyPrePaginated: dn(i),
4040
4080
  assumedRenditionLayout: i?.renditionLayout ?? "reflowable"
4041
4081
  }
4042
4082
  };
@@ -4049,7 +4089,7 @@ class Ir extends te {
4049
4089
  return this.manifest?.readingDirection;
4050
4090
  }
4051
4091
  }
4052
- class br extends te {
4092
+ class Tr extends te {
4053
4093
  constructor(e, n) {
4054
4094
  super({
4055
4095
  supportedPageTurnAnimation: ["fade", "none", "slide"],
@@ -4066,7 +4106,7 @@ class br extends te {
4066
4106
  renditionLayout: i?.renditionLayout,
4067
4107
  computedPageTurnMode: o
4068
4108
  })),
4069
- N(j),
4109
+ N(k),
4070
4110
  y(
4071
4111
  ({
4072
4112
  hasVerticalWriting: i,
@@ -4084,7 +4124,7 @@ class br extends te {
4084
4124
  ).subscribe(this.next.bind(this));
4085
4125
  }
4086
4126
  }
4087
- class vr {
4127
+ class Fr {
4088
4128
  constructor() {
4089
4129
  this._hooks = [], this._hookExecutions = [];
4090
4130
  }
@@ -4146,17 +4186,17 @@ class vr {
4146
4186
  return V(o);
4147
4187
  }
4148
4188
  }
4149
- const wr = "[data-prose-reader-spine-item][data-is-ready=false]{pointer-events:none;user-select:none;-webkit-user-select:none}[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}[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%}", xr = (t) => ({
4189
+ const Mr = "[data-prose-reader-spine-item][data-is-ready=false]{pointer-events:none;user-select:none;-webkit-user-select:none}[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}[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%}", Cr = (t) => ({
4150
4190
  x: -t.x,
4151
4191
  y: -t.y
4152
- }), Pr = (t) => t instanceof DOMMatrix ? new O({
4192
+ }), Lr = (t) => t instanceof DOMMatrix ? new O({
4153
4193
  x: -t.e,
4154
4194
  y: -t.f
4155
4195
  }) : new O({
4156
4196
  x: -t.x,
4157
4197
  y: -t.y
4158
- }), $r = "navigation/ControlledNavigationController", $t = L.namespace($r);
4159
- class Tr extends X {
4198
+ }), Nr = "navigation/ControlledNavigationController", Mt = L.namespace(Nr);
4199
+ class Ar extends X {
4160
4200
  constructor(e, n, i, r, o) {
4161
4201
  super(), this.settings = e, this.hookManager = n, this.context = i, this.spine = r, this.viewport = o, this.navigateSubject = new D(), this.element$ = new J(
4162
4202
  document.createElement("div")
@@ -4185,12 +4225,12 @@ class Tr extends X {
4185
4225
  );
4186
4226
  this.layout$ = c.pipe(
4187
4227
  T(() => {
4188
- $t.info("layout", e.values);
4228
+ Mt.info("layout", e.values);
4189
4229
  }),
4190
4230
  A()
4191
4231
  ), this.isNavigating$ = this.navigateSubject.pipe(
4192
- N((u, d) => j(u.position, d.position)),
4193
- y(({ animation: u, position: d }) => ($t.info("Navigation requested", { animation: u, position: d }), {
4232
+ N((u, d) => k(u.position, d.position)),
4233
+ y(({ animation: u, position: d }) => (Mt.info("Navigation requested", { animation: u, position: d }), {
4194
4234
  type: "manualAdjust",
4195
4235
  shouldAnimate: !(!u || u === "turn" && e.values.computedPageTurnAnimation === "none"),
4196
4236
  animation: u,
@@ -4263,7 +4303,7 @@ class Tr extends X {
4263
4303
  * for remark about flicker / fonts smoothing
4264
4304
  */
4265
4305
  applyNavigationPosition(e) {
4266
- const n = this.element$.getValue(), i = xr(e);
4306
+ const n = this.element$.getValue(), i = Cr(e);
4267
4307
  n.style.transform = `translate(${i.x}px, ${i.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
4268
4308
  }
4269
4309
  navigate(e) {
@@ -4278,10 +4318,10 @@ class Tr extends X {
4278
4318
  if (!i || i === "none")
4279
4319
  return new O({ x: 0, y: 0 });
4280
4320
  const r = new DOMMatrix(i);
4281
- return Pr(r);
4321
+ return Lr(r);
4282
4322
  }
4283
4323
  }
4284
- const Fr = () => (t) => t.pipe(
4324
+ const Er = () => (t) => t.pipe(
4285
4325
  y(({ navigation: e, pagination: n, ...i }) => ({
4286
4326
  navigation: {
4287
4327
  ...e,
@@ -4289,7 +4329,7 @@ const Fr = () => (t) => t.pipe(
4289
4329
  },
4290
4330
  ...i
4291
4331
  }))
4292
- ), Mr = (t, e, n) => t.bridgeEvent.pagination$.pipe(
4332
+ ), Rr = (t, e, n) => t.bridgeEvent.pagination$.pipe(
4293
4333
  _(e),
4294
4334
  C(
4295
4335
  ([i, r]) => i.navigationId === r.id
@@ -4299,14 +4339,14 @@ const Fr = () => (t) => t.pipe(
4299
4339
  * Otherwise we might save something incomplete and thus restore
4300
4340
  * the user to an invalid location.
4301
4341
  */
4302
- x(([i, r]) => (n.spineItemsManager.get(r.spineItem)?.isReady$.pipe(k()) ?? v(!1)).pipe(
4342
+ x(([i, r]) => (n.spineItemsManager.get(r.spineItem)?.isReady$.pipe(j()) ?? v(!1)).pipe(
4303
4343
  C((s) => s),
4304
4344
  y(() => ({
4305
4345
  pagination: i,
4306
4346
  navigation: r
4307
4347
  }))
4308
4348
  )),
4309
- Fr(),
4349
+ Er(),
4310
4350
  N(
4311
4351
  (i, r) => i.navigation.paginationBeginCfi === r.navigation.paginationBeginCfi
4312
4352
  ),
@@ -4319,7 +4359,7 @@ const Fr = () => (t) => t.pipe(
4319
4359
  requestedPosition: i.position
4320
4360
  })
4321
4361
  )
4322
- ), Cr = ({
4362
+ ), Dr = ({
4323
4363
  navigationResolver: t,
4324
4364
  getNavigationVisibleArea: e
4325
4365
  }) => (n) => n.pipe(
@@ -4352,7 +4392,7 @@ const Fr = () => (t) => t.pipe(
4352
4392
  navigation: c
4353
4393
  };
4354
4394
  })
4355
- ), Lr = ({ navigationResolver: t }) => (e) => e.pipe(
4395
+ ), Or = ({ navigationResolver: t }) => (e) => e.pipe(
4356
4396
  y((n) => {
4357
4397
  if (n.navigation.cfi) {
4358
4398
  const i = t.getNavigationForCfi(
@@ -4369,16 +4409,16 @@ const Fr = () => (t) => t.pipe(
4369
4409
  }
4370
4410
  return n;
4371
4411
  })
4372
- ), Nr = ({
4412
+ ), Vr = ({
4373
4413
  navigation: t,
4374
4414
  previousNavigation: e,
4375
4415
  settings: n
4376
- }) => t.directionFromLastNavigation ? t.directionFromLastNavigation : t.url !== void 0 || t.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || t.spineItem || !t.position ? "forward" : n.values.computedPageTurnDirection === "vertical" ? t.position.y > e.position.y || t.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(t.position.x) > Math.abs(e.position.x) || t.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward", Ar = ({
4416
+ }) => t.directionFromLastNavigation ? t.directionFromLastNavigation : t.url !== void 0 || t.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || t.spineItem || !t.position ? "forward" : n.values.computedPageTurnDirection === "vertical" ? t.position.y > e.position.y || t.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(t.position.x) > Math.abs(e.position.x) || t.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward", jr = ({
4377
4417
  context: t,
4378
4418
  settings: e
4379
4419
  }) => (n) => n.pipe(
4380
4420
  y(({ navigation: i, previousNavigation: r }) => {
4381
- const o = Nr({
4421
+ const o = Vr({
4382
4422
  navigation: i,
4383
4423
  previousNavigation: r,
4384
4424
  settings: e
@@ -4392,7 +4432,7 @@ const Fr = () => (t) => t.pipe(
4392
4432
  direction: o
4393
4433
  };
4394
4434
  })
4395
- ), Er = ({
4435
+ ), kr = ({
4396
4436
  spineItemsManager: t,
4397
4437
  navigationResolver: e,
4398
4438
  settings: n,
@@ -4440,7 +4480,7 @@ const Fr = () => (t) => t.pipe(
4440
4480
  ...s
4441
4481
  };
4442
4482
  })
4443
- ), Tt = ({
4483
+ ), Ct = ({
4444
4484
  settings: t,
4445
4485
  spineItemsManager: e,
4446
4486
  navigationResolver: n,
@@ -4499,13 +4539,13 @@ const Fr = () => (t) => t.pipe(
4499
4539
  };
4500
4540
  })
4501
4541
  );
4502
- }, Ft = ({ spine: t }) => (e) => e.pipe(
4542
+ }, Lt = ({ spine: t }) => (e) => e.pipe(
4503
4543
  x(({ navigation: n, ...i }) => {
4504
4544
  const r = t.getSpineItemSpineLayoutInfo(
4505
4545
  n.spineItem
4506
4546
  ), o = t.spineItemsManager.get(n.spineItem);
4507
4547
  return (o?.isReady$ ?? v(!1)).pipe(
4508
- k(),
4548
+ j(),
4509
4549
  y(
4510
4550
  (s) => ({
4511
4551
  navigation: {
@@ -4566,7 +4606,7 @@ const Fr = () => (t) => t.pipe(
4566
4606
  ...a
4567
4607
  }))
4568
4608
  );
4569
- }, Rr = ({ navigationResolver: t }) => (e) => e.pipe(
4609
+ }, Ur = ({ navigationResolver: t }) => (e) => e.pipe(
4570
4610
  y((n) => {
4571
4611
  if (n.navigation.url) {
4572
4612
  const i = t.getNavigationForUrl(
@@ -4585,7 +4625,7 @@ const Fr = () => (t) => t.pipe(
4585
4625
  return n;
4586
4626
  })
4587
4627
  );
4588
- class sn {
4628
+ class ln {
4589
4629
  constructor() {
4590
4630
  this.isLockedSubject = new J(0), this.isLocked$ = this.isLockedSubject.pipe(
4591
4631
  y((e) => !!e),
@@ -4599,7 +4639,7 @@ class sn {
4599
4639
  };
4600
4640
  }
4601
4641
  }
4602
- const Dr = ({
4642
+ const zr = ({
4603
4643
  spineLocator: t,
4604
4644
  navigation: e,
4605
4645
  navigationResolver: n,
@@ -4608,7 +4648,7 @@ const Dr = ({
4608
4648
  }) => {
4609
4649
  const o = i.get(e.spineItem);
4610
4650
  return o ? o.isReady$.pipe(
4611
- k(),
4651
+ j(),
4612
4652
  y((s) => {
4613
4653
  const a = r.getSpineItemSpineLayoutInfo(o), c = t.isPositionWithinSpineItem(
4614
4654
  e.position,
@@ -4656,7 +4696,7 @@ const Dr = ({
4656
4696
  return c ? n.getNavigationForPosition(e.position) : n.getNavigationForSpineIndexOrId(o);
4657
4697
  })
4658
4698
  ) : v(new O({ x: 0, y: 0 }));
4659
- }, Or = ({
4699
+ }, Wr = ({
4660
4700
  navigation: t,
4661
4701
  spineLocator: e,
4662
4702
  spineItemsManager: n,
@@ -4725,7 +4765,7 @@ const Dr = ({
4725
4765
  }
4726
4766
  }
4727
4767
  return t.position;
4728
- }, Vr = ({
4768
+ }, _r = ({
4729
4769
  navigation: t,
4730
4770
  spineItemsManager: e,
4731
4771
  settings: n,
@@ -4733,7 +4773,7 @@ const Dr = ({
4733
4773
  navigationResolver: r,
4734
4774
  spine: o
4735
4775
  }) => n.values.computedPageTurnMode === "scrollable" ? v(
4736
- Or({
4776
+ Wr({
4737
4777
  navigation: t,
4738
4778
  spineLocator: i,
4739
4779
  navigationResolver: r,
@@ -4741,19 +4781,19 @@ const Dr = ({
4741
4781
  spineItemsManager: e,
4742
4782
  spine: o
4743
4783
  })
4744
- ) : Dr({
4784
+ ) : zr({
4745
4785
  navigation: t,
4746
4786
  spineLocator: i,
4747
4787
  navigationResolver: r,
4748
4788
  spineItemsManager: e,
4749
4789
  spine: o
4750
- }), Mt = ({
4790
+ }), Nt = ({
4751
4791
  settings: t,
4752
4792
  navigationResolver: e,
4753
4793
  context: n,
4754
4794
  spine: i
4755
4795
  }) => (r) => r.pipe(
4756
- x((o) => Vr({
4796
+ x((o) => _r({
4757
4797
  spineLocator: i.locator,
4758
4798
  navigation: o.navigation,
4759
4799
  navigationResolver: e,
@@ -4770,8 +4810,8 @@ const Dr = ({
4770
4810
  }
4771
4811
  }))
4772
4812
  ))
4773
- ), kr = "navigation/InternalNavigator", jr = L.namespace(kr), Ct = (t, e) => t === e || !!t && !!e && t.x === e.x && t.y === e.y, Ur = (t, e) => t === e || !!t && !!e && t.width === e.width && t.height === e.height, zr = (t, e) => t.id === e.id && Ct(t.position, e.position) && Ct(t.requestedPosition, e.requestedPosition) && Ur(t.requestedVisibleArea, e.requestedVisibleArea);
4774
- class Wr extends X {
4813
+ ), Br = "navigation/InternalNavigator", Hr = L.namespace(Br), At = (t, e) => t === e || !!t && !!e && t.x === e.x && t.y === e.y, qr = (t, e) => t === e || !!t && !!e && t.width === e.width && t.height === e.height, Yr = (t, e) => t.id === e.id && At(t.position, e.position) && At(t.requestedPosition, e.requestedPosition) && qr(t.requestedVisibleArea, e.requestedVisibleArea);
4814
+ class Xr extends X {
4775
4815
  constructor(e, n, i, r, o, s, a, c, u) {
4776
4816
  super(), this.settings = e, this.context = n, this.userNavigation$ = i, this.getActiveNavigationModeController = r, this.navigationModeLayout$ = o, this.navigationResolver = s, this.spine = a, this.viewport = c, this.isUserInteractionLocked$ = u, this.navigationSubject = new J({
4777
4817
  animation: !1,
@@ -4791,12 +4831,12 @@ class Wr extends X {
4791
4831
  requestedVisibleArea: M,
4792
4832
  triggeredBy: z.triggeredBy
4793
4833
  })),
4794
- N(zr),
4834
+ N(Yr),
4795
4835
  Y(1)
4796
- ), this.locker = new sn();
4836
+ ), this.locker = new ln();
4797
4837
  const d = () => r().getNavigationVisibleArea(), l = i.pipe(
4798
4838
  _(this.navigationSubject),
4799
- Cr({
4839
+ Dr({
4800
4840
  navigationResolver: s,
4801
4841
  getNavigationVisibleArea: d
4802
4842
  }),
@@ -4804,18 +4844,18 @@ class Wr extends X {
4804
4844
  * Url lookup is heavier so we start with it to fill
4805
4845
  * as much information as needed to reduce later lookup
4806
4846
  */
4807
- Rr({
4847
+ Ur({
4808
4848
  navigationResolver: s
4809
4849
  }),
4810
4850
  /**
4811
4851
  * Cfi lookup is heavier so we start with it to fill
4812
4852
  * as much information as needed to reduce later lookup
4813
4853
  */
4814
- Lr({
4854
+ Or({
4815
4855
  navigationResolver: s
4816
4856
  }),
4817
- Ar({ context: n, settings: e }),
4818
- Tt({
4857
+ jr({ context: n, settings: e }),
4858
+ Ct({
4819
4859
  navigationResolver: s,
4820
4860
  settings: e,
4821
4861
  spineItemsManager: a.spineItemsManager,
@@ -4827,11 +4867,11 @@ class Wr extends X {
4827
4867
  spineItemsManager: a.spineItemsManager,
4828
4868
  spineLocator: a.locator
4829
4869
  }),
4830
- Ft({
4870
+ Lt({
4831
4871
  spine: a
4832
4872
  })
4833
4873
  ).pipe(
4834
- Er({
4874
+ kr({
4835
4875
  navigationResolver: s,
4836
4876
  spineItemsManager: a.spineItemsManager,
4837
4877
  settings: e,
@@ -4841,7 +4881,7 @@ class Wr extends X {
4841
4881
  x(([S, I]) => {
4842
4882
  const w = S.navigation.cfi || S.navigation.url || e.values.computedPageTurnMode === "scrollable" || I;
4843
4883
  return v(S).pipe(
4844
- w ? ve : Mt({
4884
+ w ? ve : Nt({
4845
4885
  navigationResolver: s,
4846
4886
  settings: e,
4847
4887
  spine: a,
@@ -4864,7 +4904,7 @@ class Wr extends X {
4864
4904
  const I = this.locker.lock();
4865
4905
  return u.pipe(
4866
4906
  C((w) => !w),
4867
- k(),
4907
+ j(),
4868
4908
  y(() => ({
4869
4909
  navigation: {
4870
4910
  ...S,
@@ -4886,7 +4926,7 @@ class Wr extends X {
4886
4926
  x(
4887
4927
  () => u.pipe(
4888
4928
  C((S) => !S),
4889
- k()
4929
+ j()
4890
4930
  )
4891
4931
  ),
4892
4932
  y(() => ({
@@ -4908,7 +4948,7 @@ class Wr extends X {
4908
4948
  p,
4909
4949
  g
4910
4950
  ).pipe(
4911
- Mt({
4951
+ Nt({
4912
4952
  navigationResolver: s,
4913
4953
  settings: e,
4914
4954
  context: n,
@@ -4926,13 +4966,13 @@ class Wr extends X {
4926
4966
  * eg: after the reader load and the user has never navigated
4927
4967
  * yet.
4928
4968
  */
4929
- Tt({
4969
+ Ct({
4930
4970
  navigationResolver: s,
4931
4971
  settings: e,
4932
4972
  spineItemsManager: a.spineItemsManager,
4933
4973
  spineLocator: a.locator
4934
4974
  }),
4935
- Ft({
4975
+ Lt({
4936
4976
  spine: a
4937
4977
  }),
4938
4978
  We({
@@ -4943,7 +4983,7 @@ class Wr extends X {
4943
4983
  }),
4944
4984
  y(({ navigation: S }) => S),
4945
4985
  A()
4946
- ), m = Mr(
4986
+ ), m = Rr(
4947
4987
  n,
4948
4988
  this.navigationSubject,
4949
4989
  a
@@ -4953,7 +4993,7 @@ class Wr extends X {
4953
4993
  m
4954
4994
  ), b = (S) => S.pipe(
4955
4995
  T(([I, w]) => {
4956
- jr.info(
4996
+ Hr.info(
4957
4997
  `navigation updated from ${I.meta.triggeredBy} of type ${I.type}`,
4958
4998
  {
4959
4999
  previousNavigation: w,
@@ -4995,17 +5035,17 @@ const Ne = (t, e, n) => {
4995
5035
  }, Ke = (t, e) => (e || 0) === 0 || (t || 0) === 0 ? 1 : Math.floor(Math.max(1, t / e)), _e = (t, e, n) => {
4996
5036
  const i = Ke(n, e), r = [...Array(i)].map((o, s) => s * e);
4997
5037
  return t >= i * e ? r[r.length - 1] || 0 : r.find((o) => t < o + e) || 0;
4998
- }, Lt = (t, e, n) => {
5038
+ }, Et = (t, e, n) => {
4999
5039
  const i = [...Array(n)].map((r, o) => o * e);
5000
5040
  return t <= 0 || n === 0 ? 0 : t >= n * e ? n - 1 : i.findIndex((r) => t < r + e) ?? 0;
5001
- }, _r = ({
5041
+ }, Gr = ({
5002
5042
  itemWidth: t,
5003
5043
  itemHeight: e,
5004
5044
  spineItemPosition: n
5005
5045
  }) => new E({
5006
5046
  x: Math.min(t, Math.max(0, n.x)),
5007
5047
  y: Math.min(e, Math.max(0, n.y))
5008
- }), an = ({
5048
+ }), pn = ({
5009
5049
  itemHeight: t,
5010
5050
  itemWidth: e,
5011
5051
  isUsingVerticalWriting: n,
@@ -5013,7 +5053,7 @@ const Ne = (t, e, n) => {
5013
5053
  pageHeight: r,
5014
5054
  pageTurnDirection: o,
5015
5055
  pageTurnMode: s
5016
- }) => o === "vertical" && s === "scrollable" ? 1 : n || o === "vertical" ? Ke(t, r) : Ke(e, i), Nt = ({
5056
+ }) => o === "vertical" && s === "scrollable" ? 1 : n || o === "vertical" ? Ke(t, r) : Ke(e, i), Rt = ({
5017
5057
  itemWidth: t,
5018
5058
  itemHeight: e,
5019
5059
  position: n,
@@ -5024,11 +5064,11 @@ const Ne = (t, e, n) => {
5024
5064
  pageTurnMode: a,
5025
5065
  isRTL: c
5026
5066
  }) => {
5027
- const d = _r({
5067
+ const d = Gr({
5028
5068
  spineItemPosition: n,
5029
5069
  itemHeight: e,
5030
5070
  itemWidth: t
5031
- }).x, l = an({
5071
+ }).x, l = pn({
5032
5072
  isUsingVerticalWriting: i,
5033
5073
  itemHeight: e,
5034
5074
  itemWidth: t,
@@ -5038,10 +5078,10 @@ const Ne = (t, e, n) => {
5038
5078
  pageTurnMode: a
5039
5079
  });
5040
5080
  if (i)
5041
- return Lt(n.y, o, l);
5042
- const g = Lt(d, r, l);
5081
+ return Et(n.y, o, l);
5082
+ const g = Et(d, r, l);
5043
5083
  return c ? l - 1 - g : g;
5044
- }, Br = ({
5084
+ }, Zr = ({
5045
5085
  pageIndex: t,
5046
5086
  itemLayout: e,
5047
5087
  context: n,
@@ -5071,14 +5111,14 @@ const Ne = (t, e, n) => {
5071
5111
  x: o,
5072
5112
  y: 0
5073
5113
  });
5074
- }, cn = ({
5114
+ }, gn = ({
5075
5115
  context: t,
5076
5116
  settings: e,
5077
5117
  viewport: n
5078
5118
  }) => {
5079
5119
  const i = (a, c, u) => {
5080
5120
  let d;
5081
- a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? d = a.getBoundingClientRect().x : a && (d = (a ? Hn(a, c) : void 0)?.getBoundingClientRect().x || d);
5121
+ a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? d = a.getBoundingClientRect().x : a && (d = (a ? Zn(a, c) : void 0)?.getBoundingClientRect().x || d);
5082
5122
  const l = u.layoutInfo?.width || 0, g = n.pageSize.width;
5083
5123
  if (d !== void 0) {
5084
5124
  const p = _e(
@@ -5094,14 +5134,14 @@ const Ne = (t, e, n) => {
5094
5134
  getSpineItemPositionFromPageIndex: ({
5095
5135
  pageIndex: a,
5096
5136
  spineItem: c
5097
- }) => Br({
5137
+ }) => Zr({
5098
5138
  context: t,
5099
5139
  isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
5100
5140
  itemLayout: c.layoutInfo,
5101
5141
  pageIndex: a,
5102
5142
  viewport: n
5103
5143
  }),
5104
- getSpineItemPageIndexFromPosition: (a) => Nt({
5144
+ getSpineItemPageIndexFromPosition: (a) => Rt({
5105
5145
  ...a,
5106
5146
  isRTL: t.isRTL(),
5107
5147
  pageWidth: n.pageSize.width,
@@ -5111,7 +5151,7 @@ const Ne = (t, e, n) => {
5111
5151
  }),
5112
5152
  getSpineItemPageIndexFromNode: (a, c, u) => {
5113
5153
  const d = i(a, c, u), { height: l, width: g } = u.layoutInfo;
5114
- return d ? Nt({
5154
+ return d ? Rt({
5115
5155
  isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
5116
5156
  position: d,
5117
5157
  itemHeight: l,
@@ -5146,7 +5186,7 @@ const Ne = (t, e, n) => {
5146
5186
  c,
5147
5187
  l
5148
5188
  );
5149
- return new je({
5189
+ return new ke({
5150
5190
  x: a.x,
5151
5191
  y: a.y - f
5152
5192
  });
@@ -5154,23 +5194,23 @@ const Ne = (t, e, n) => {
5154
5194
  const m = Ne(g, c, d);
5155
5195
  if (t.isRTL()) {
5156
5196
  const f = d - (c + 1) * g;
5157
- return new je({
5197
+ return new ke({
5158
5198
  x: a.x - Math.max(0, f),
5159
5199
  y: a.y
5160
5200
  });
5161
5201
  }
5162
- return new je({
5202
+ return new ke({
5163
5203
  x: a.x - m,
5164
5204
  y: a.y
5165
5205
  });
5166
5206
  }
5167
5207
  };
5168
- }, Hr = ({
5208
+ }, Jr = ({
5169
5209
  context: t,
5170
5210
  settings: e,
5171
5211
  viewport: n
5172
5212
  }) => {
5173
- const i = cn({
5213
+ const i = gn({
5174
5214
  context: t,
5175
5215
  settings: e,
5176
5216
  viewport: n
@@ -5193,7 +5233,7 @@ const Ne = (t, e, n) => {
5193
5233
  a
5194
5234
  ) || new E({ x: 0, y: 0 })
5195
5235
  };
5196
- }, un = ({
5236
+ }, hn = ({
5197
5237
  size: t,
5198
5238
  isRTL: e,
5199
5239
  spineItemsManager: n,
@@ -5219,14 +5259,14 @@ const Ne = (t, e, n) => {
5219
5259
  yMin: 0,
5220
5260
  yMax: s
5221
5261
  };
5222
- }, At = ({
5262
+ }, Dt = ({
5223
5263
  position: t,
5224
5264
  size: e,
5225
5265
  isRTL: n,
5226
5266
  spineItemsManager: i,
5227
5267
  spine: r
5228
5268
  }) => {
5229
- const o = un({
5269
+ const o = hn({
5230
5270
  size: e,
5231
5271
  isRTL: n,
5232
5272
  spineItemsManager: i,
@@ -5235,14 +5275,14 @@ const Ne = (t, e, n) => {
5235
5275
  if (!o) return new R({ x: 0, y: 0 });
5236
5276
  const s = Math.min(Math.max(o.yMin, t.y), o.yMax), a = n ? Math.max(o.xMin, Math.min(o.xMax, t.x)) : Math.min(Math.max(o.xMin, t.x), o.xMax);
5237
5277
  return new R({ x: a, y: s });
5238
- }, qr = ({
5278
+ }, Kr = ({
5239
5279
  position: t,
5240
5280
  size: e,
5241
5281
  isRTL: n,
5242
5282
  spineItemsManager: i,
5243
5283
  spine: r
5244
5284
  }) => {
5245
- const o = un({
5285
+ const o = hn({
5246
5286
  size: e,
5247
5287
  isRTL: n,
5248
5288
  spineItemsManager: i,
@@ -5291,7 +5331,7 @@ const Ne = (t, e, n) => {
5291
5331
  });
5292
5332
  }
5293
5333
  return new O({ x: 0, y: 0 });
5294
- }, Yr = ({
5334
+ }, Qr = ({
5295
5335
  pageIndex: t,
5296
5336
  spineItemsManager: e,
5297
5337
  spineItemId: n,
@@ -5321,7 +5361,7 @@ const Ne = (t, e, n) => {
5321
5361
  pageSizeWidth: o.pageSize.width,
5322
5362
  visibleAreaRectWidth: o.absoluteViewport.width
5323
5363
  });
5324
- }, Xr = (t, e) => {
5364
+ }, es = (t, e) => {
5325
5365
  if (e && e instanceof HTMLIFrameElement) {
5326
5366
  const n = e.contentDocument, i = t.trim();
5327
5367
  if (!n || i.length === 0)
@@ -5336,23 +5376,23 @@ const Ne = (t, e, n) => {
5336
5376
  return;
5337
5377
  }
5338
5378
  }
5339
- }, Gr = ({
5379
+ }, ts = ({
5340
5380
  anchor: t,
5341
5381
  spineItem: e,
5342
5382
  spine: n
5343
5383
  }) => {
5344
- const i = Xr(
5384
+ const i = es(
5345
5385
  t,
5346
5386
  e.renderer.getDocumentFrame()
5347
5387
  );
5348
5388
  return i ? n.spineItemLocator.getSpineItemPositionFromNode(i, 0, e)?.x ?? 0 : 0;
5349
- }, Zr = ({
5389
+ }, ns = ({
5350
5390
  anchor: t,
5351
5391
  spineItem: e,
5352
5392
  spineLocator: n,
5353
5393
  spine: i
5354
5394
  }) => {
5355
- const r = Gr({
5395
+ const r = ts({
5356
5396
  anchor: t,
5357
5397
  spineItem: e,
5358
5398
  spine: i
@@ -5361,7 +5401,7 @@ const Ne = (t, e, n) => {
5361
5401
  spineItemPosition: new E({ x: r, y: 0 }),
5362
5402
  spineItem: e
5363
5403
  });
5364
- }, Jr = ({
5404
+ }, is = ({
5365
5405
  anchor: t,
5366
5406
  spineItem: e,
5367
5407
  spineLocator: n,
@@ -5369,7 +5409,7 @@ const Ne = (t, e, n) => {
5369
5409
  pageSizeWidth: r,
5370
5410
  visibleAreaRectWidth: o
5371
5411
  }) => {
5372
- const s = Zr({
5412
+ const s = ns({
5373
5413
  anchor: t,
5374
5414
  spineItem: e,
5375
5415
  spineLocator: n,
@@ -5380,7 +5420,7 @@ const Ne = (t, e, n) => {
5380
5420
  pageSizeWidth: r,
5381
5421
  visibleAreaRectWidth: o
5382
5422
  });
5383
- }, Kr = ({
5423
+ }, os = ({
5384
5424
  spine: t,
5385
5425
  spineItemsManager: e,
5386
5426
  spineLocator: n,
@@ -5396,7 +5436,7 @@ const Ne = (t, e, n) => {
5396
5436
  if (u) {
5397
5437
  const d = e.get(u.id);
5398
5438
  if (d) {
5399
- const l = Jr({
5439
+ const l = is({
5400
5440
  anchor: a.hash,
5401
5441
  spineItem: d,
5402
5442
  spine: t,
@@ -5419,7 +5459,7 @@ const Ne = (t, e, n) => {
5419
5459
  console.error(a);
5420
5460
  return;
5421
5461
  }
5422
- }, Qr = ({
5462
+ }, rs = ({
5423
5463
  spineItem: t,
5424
5464
  spineItemPosition: e,
5425
5465
  spineLocator: n,
@@ -5438,7 +5478,7 @@ const Ne = (t, e, n) => {
5438
5478
  pageSizeWidth: r.pageSize.width,
5439
5479
  visibleAreaRectWidth: r.absoluteViewport.width
5440
5480
  });
5441
- }, es = "spineNavigator", ts = ({
5481
+ }, ss = "spineNavigator", as = ({
5442
5482
  context: t,
5443
5483
  spineItemsManager: e,
5444
5484
  locator: n,
@@ -5446,13 +5486,13 @@ const Ne = (t, e, n) => {
5446
5486
  spine: r,
5447
5487
  viewport: o
5448
5488
  }) => {
5449
- const s = Hr({
5489
+ const s = Jr({
5450
5490
  context: t,
5451
5491
  settings: i,
5452
5492
  viewport: o
5453
5493
  });
5454
5494
  return {
5455
- getNavigationForUrl: (p) => Kr({
5495
+ getNavigationForUrl: (p) => os({
5456
5496
  context: t,
5457
5497
  spineItemsManager: e,
5458
5498
  spineLocator: n,
@@ -5461,26 +5501,26 @@ const Ne = (t, e, n) => {
5461
5501
  visibleAreaRectWidth: o.absoluteViewport.width,
5462
5502
  spine: r
5463
5503
  }),
5464
- getNavigationForSpineItemPage: (p) => Yr({
5504
+ getNavigationForSpineItemPage: (p) => Qr({
5465
5505
  ...p,
5466
5506
  spineItemsManager: e,
5467
5507
  spineItemNavigationResolver: s,
5468
5508
  spineLocator: n,
5469
5509
  viewport: o
5470
5510
  }),
5471
- getNavigationFromSpineItemPosition: (p) => Qr({
5511
+ getNavigationFromSpineItemPosition: (p) => rs({
5472
5512
  ...p,
5473
5513
  spineItemLocator: n.spineItemLocator,
5474
5514
  spineLocator: n,
5475
5515
  viewport: o
5476
5516
  }),
5477
5517
  getNavigationForCfi: (p) => {
5478
- const h = e.getSpineItemFromCfi(p), { node: m, offset: f = 0 } = en({
5518
+ const h = e.getSpineItemFromCfi(p), { node: m, offset: f = 0 } = sn({
5479
5519
  cfi: p,
5480
5520
  spineItemsManager: e
5481
5521
  });
5482
5522
  if (!h) {
5483
- L.warn(es, `unable to detect item id from cfi ${p}`);
5523
+ L.warn(ss, `unable to detect item id from cfi ${p}`);
5484
5524
  return;
5485
5525
  }
5486
5526
  const b = m ? s.getNavigationFromNode(h, m, f) : new E({ x: 0, y: 0 }), $ = n.getSpinePositionFromSpineItemPosition({
@@ -5523,7 +5563,7 @@ const Ne = (t, e, n) => {
5523
5563
  viewport: o
5524
5564
  }),
5525
5565
  getMostPredominantNavigationForPosition: (p) => {
5526
- const h = i.values.computedPageTurnDirection, m = 0.5, f = h === "horizontal" ? p.x + o.absoluteViewport.width * m : 0, b = h === "horizontal" ? 0 : p.y + o.absoluteViewport.height * m, $ = At({
5566
+ const h = i.values.computedPageTurnDirection, m = 0.5, f = h === "horizontal" ? p.x + o.absoluteViewport.width * m : 0, b = h === "horizontal" ? 0 : p.y + o.absoluteViewport.height * m, $ = Dt({
5527
5567
  position: new O({
5528
5568
  x: f,
5529
5569
  y: b
@@ -5540,14 +5580,14 @@ const Ne = (t, e, n) => {
5540
5580
  viewport: o
5541
5581
  });
5542
5582
  },
5543
- clampPositionInSpine: (p, h) => At({
5583
+ clampPositionInSpine: (p, h) => Dt({
5544
5584
  position: p,
5545
5585
  size: h,
5546
5586
  isRTL: t.isRTL(),
5547
5587
  spineItemsManager: e,
5548
5588
  spine: r
5549
5589
  }),
5550
- getBoundaryForPosition: (p, h = o.absoluteViewport) => qr({
5590
+ getBoundaryForPosition: (p, h = o.absoluteViewport) => Kr({
5551
5591
  position: p,
5552
5592
  size: h,
5553
5593
  isRTL: t.isRTL(),
@@ -5563,7 +5603,7 @@ const Ne = (t, e, n) => {
5563
5603
  }),
5564
5604
  spineItemNavigator: s
5565
5605
  };
5566
- }, ns = ({
5606
+ }, cs = ({
5567
5607
  spineItemsManager: t,
5568
5608
  context: e,
5569
5609
  hookManager: n,
@@ -5571,20 +5611,20 @@ const Ne = (t, e, n) => {
5571
5611
  settings: r,
5572
5612
  viewport: o
5573
5613
  }) => {
5574
- const s = new D(), a = s.asObservable(), c = new sn(), u = ts({
5614
+ const s = new D(), a = s.asObservable(), c = new ln(), u = as({
5575
5615
  context: e,
5576
5616
  settings: r,
5577
5617
  spineItemsManager: t,
5578
5618
  locator: i.locator,
5579
5619
  spine: i,
5580
5620
  viewport: o
5581
- }), d = new Tr(
5621
+ }), d = new Ar(
5582
5622
  r,
5583
5623
  n,
5584
5624
  e,
5585
5625
  i,
5586
5626
  o
5587
- ), l = new gr(
5627
+ ), l = new Ir(
5588
5628
  o,
5589
5629
  r,
5590
5630
  n,
@@ -5597,7 +5637,7 @@ const Ne = (t, e, n) => {
5597
5637
  ...g.flatMap(
5598
5638
  (I) => I.layout$ ? [I.layout$] : []
5599
5639
  )
5600
- ), m = new Wr(
5640
+ ), m = new Xr(
5601
5641
  r,
5602
5642
  e,
5603
5643
  a,
@@ -5617,7 +5657,7 @@ const Ne = (t, e, n) => {
5617
5657
  Y(1)
5618
5658
  ), b = m.navigation$.pipe(
5619
5659
  y(({ position: I }) => I),
5620
- N(j),
5660
+ N(k),
5621
5661
  Y(1)
5622
5662
  );
5623
5663
  return {
@@ -5650,7 +5690,7 @@ const Ne = (t, e, n) => {
5650
5690
  position$: b
5651
5691
  };
5652
5692
  };
5653
- class is extends te {
5693
+ class us extends te {
5654
5694
  constructor(e, n) {
5655
5695
  super({
5656
5696
  beginPageIndexInSpineItem: void 0,
@@ -5668,7 +5708,7 @@ class is extends te {
5668
5708
  this.mergeCompare(e);
5669
5709
  }
5670
5710
  }
5671
- class os extends X {
5711
+ class ds extends X {
5672
5712
  constructor(e, n, i, r, o, s) {
5673
5713
  super(), this.context = e, this.pagination = n, this.spineItemsManager = i, this.spine = r, this.spineItemLocator = o, this.isNavigationLocked$ = s;
5674
5714
  const a = P(
@@ -5686,7 +5726,7 @@ class os extends X {
5686
5726
  });
5687
5727
  return this.isNavigationLocked$.pipe(
5688
5728
  C((d) => !d),
5689
- Rt(1),
5729
+ Vt(1),
5690
5730
  _(this.context.bridgeEvent.navigation$),
5691
5731
  T(([, d]) => {
5692
5732
  const { position: l } = d, g = this.pagination.value, {
@@ -5753,11 +5793,7 @@ class os extends X {
5753
5793
  P(a, c).pipe(F(this.destroy$)).subscribe();
5754
5794
  }
5755
5795
  }
5756
- const rs = ({
5757
- manifest: t,
5758
- spreadMode: e
5759
- }) => t?.renditionFlow === "scrolled-continuous" ? !1 : e;
5760
- class ss extends X {
5796
+ class ls extends X {
5761
5797
  constructor(e) {
5762
5798
  super();
5763
5799
  const n = {
@@ -5767,7 +5803,7 @@ class ss extends X {
5767
5803
  this.inputSettings = n, this.outputSettingsUpdateSubject = new D(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(Y(1)), this._settings$.subscribe();
5768
5804
  }
5769
5805
  _prepareUpdate(e) {
5770
- const n = Me(this.inputSettings, e), i = this.getOutputSettings(n), r = !j(this.outputSettings, i);
5806
+ const n = Me(this.inputSettings, e), i = this.getOutputSettings(n), r = !k(this.outputSettings, i);
5771
5807
  return {
5772
5808
  hasChanged: r,
5773
5809
  state: i,
@@ -5794,15 +5830,15 @@ class ss extends X {
5794
5830
  }
5795
5831
  watch(e) {
5796
5832
  return this.values$.pipe(
5797
- _t(e),
5798
- N(j)
5833
+ qt(e),
5834
+ N(k)
5799
5835
  );
5800
5836
  }
5801
5837
  destroy() {
5802
5838
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5803
5839
  }
5804
5840
  }
5805
- class as extends ss {
5841
+ class ps extends ls {
5806
5842
  constructor(e, n) {
5807
5843
  super(e), this.context = n, n.watch(["manifest", "hasVerticalWriting"]).pipe(
5808
5844
  T(() => this.update(this.values)),
@@ -5815,7 +5851,7 @@ class as extends ss {
5815
5851
  computedPageTurnAnimation: e.pageTurnAnimation,
5816
5852
  computedPageTurnMode: e.pageTurnMode,
5817
5853
  computedPageTurnAnimationDuration: 0,
5818
- computedSpreadMode: rs({
5854
+ computedSpreadMode: Qt({
5819
5855
  spreadMode: e.spreadMode,
5820
5856
  manifest: n
5821
5857
  })
@@ -5841,7 +5877,7 @@ class as extends ss {
5841
5877
  };
5842
5878
  }
5843
5879
  }
5844
- class cs extends Le {
5880
+ class gs extends Le {
5845
5881
  onUnload() {
5846
5882
  return B;
5847
5883
  }
@@ -5860,14 +5896,14 @@ class cs extends Le {
5860
5896
  getDocumentFrame() {
5861
5897
  }
5862
5898
  }
5863
- class us extends X {
5899
+ class hs extends X {
5864
5900
  constructor(e, n, i, r, o, s, a) {
5865
5901
  super(), this.item = e, this.containerElement = n, this.context = i, this.hookManager = r, this.renderer = o, this.settings = s, this.viewport = a, this.layoutTriggerSubject = new D(), this.lastLayout = null, this.computeLayoutInformation = ({
5866
5902
  isLastItem: u,
5867
5903
  horizontalOffset: d
5868
5904
  }) => {
5869
5905
  let l = this.viewport.value.pageSize.width, g = "none";
5870
- const p = d % this.viewport.absoluteViewport.width === 0, h = this.context.manifest, m = rn(h) ?? !1;
5906
+ const p = d % this.viewport.absoluteViewport.width === 0, h = this.context.manifest, m = dn(h) ?? !1;
5871
5907
  if (this.settings.values.computedSpreadMode) {
5872
5908
  !m && this.renderer.renditionLayout === "reflowable" && !u && (l = this.viewport.value.pageSize.width * 2), !m && this.renderer.renditionLayout === "reflowable" && u && p && (l = this.viewport.value.pageSize.width * 2);
5873
5909
  const f = p && u && m;
@@ -5889,7 +5925,7 @@ class us extends X {
5889
5925
  edgeY: l
5890
5926
  }) => (g) => g.pipe(
5891
5927
  y((p) => {
5892
- const h = j(
5928
+ const h = k(
5893
5929
  this.lastLayout?.pageSize,
5894
5930
  this.viewport.pageSize
5895
5931
  ) ? this.lastLayout : void 0, { width: m, height: f } = h ?? {}, { width: b = m, height: $ = f } = p ?? {}, { width: S, height: I } = this.viewport.pageSize, w = this.validateDimension(
@@ -5913,7 +5949,7 @@ class us extends X {
5913
5949
  ), { width: w, height: M });
5914
5950
  })
5915
5951
  ), this.layout = (u) => {
5916
- const d = ci(this.didLayout$.pipe(k()));
5952
+ const d = gi(this.didLayout$.pipe(j()));
5917
5953
  return this.layoutTriggerSubject.next(u), d();
5918
5954
  };
5919
5955
  const c = this.layoutTriggerSubject.pipe(
@@ -5976,7 +6012,7 @@ class us extends X {
5976
6012
  };
5977
6013
  }
5978
6014
  }
5979
- class dn extends te {
6015
+ class mn extends te {
5980
6016
  constructor(e, n, i, r, o, s, a) {
5981
6017
  super({
5982
6018
  isLoaded: !1,
@@ -5994,7 +6030,7 @@ class dn extends te {
5994
6030
  });
5995
6031
  }, this.destroy = () => {
5996
6032
  super.destroy(), this.containerElement.remove(), this.renderer.destroy();
5997
- }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.layout = (l) => this._layout.layout(l), this.containerElement = ds(
6033
+ }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.layout = (l) => this._layout.layout(l), this.containerElement = ms(
5998
6034
  n,
5999
6035
  e,
6000
6036
  o
@@ -6010,7 +6046,7 @@ class dn extends te {
6010
6046
  resourcesHandler: this.resourcesHandler,
6011
6047
  viewport: this.viewport
6012
6048
  };
6013
- this.renderer = c ? c(u) : new cs(u), this._layout = new us(
6049
+ this.renderer = c ? c(u) : new gs(u), this._layout = new hs(
6014
6050
  e,
6015
6051
  this.containerElement,
6016
6052
  i,
@@ -6035,7 +6071,7 @@ class dn extends te {
6035
6071
  isReady: this.renderer.value.state === "loaded"
6036
6072
  });
6037
6073
  }),
6038
- On()
6074
+ zn()
6039
6075
  ), P(
6040
6076
  /**
6041
6077
  * @important
@@ -6087,7 +6123,7 @@ class dn extends te {
6087
6123
  return this._layout.layoutInfo;
6088
6124
  }
6089
6125
  get numberOfPages() {
6090
- return an({
6126
+ return pn({
6091
6127
  isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
6092
6128
  itemHeight: this._layout.layoutInfo.height,
6093
6129
  itemWidth: this._layout.layoutInfo.width,
@@ -6098,21 +6134,21 @@ class dn extends te {
6098
6134
  });
6099
6135
  }
6100
6136
  }
6101
- const ds = (t, e, n) => {
6137
+ const ms = (t, e, n) => {
6102
6138
  const i = t.ownerDocument.createElement("div");
6103
- return i.setAttribute(`data-${Hi}`, ""), i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
6139
+ return i.setAttribute(`data-${Zi}`, ""), i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
6104
6140
  position: absolute;
6105
6141
  overflow: hidden;
6106
6142
  `, i.dataset.isReady = "false", n.execute("item.onBeforeContainerCreated", void 0, { element: i }), i;
6107
6143
  };
6108
- class ls extends X {
6144
+ class fs extends X {
6109
6145
  constructor(e, n, i, r, o, s) {
6110
6146
  super(), this.context = e, this.spineItemsManager = n, this.spineLocator = i, this.settings = r, this.spineLayout = o, this.viewport = s, this.forcedOpenSubject = new J(
6111
6147
  /* @__PURE__ */ new Map()
6112
6148
  );
6113
6149
  const a = this.forcedOpenSubject.pipe(
6114
6150
  y((d) => Array.from(d.keys()).sort((l, g) => l - g)),
6115
- N(Cn),
6151
+ N(Rn),
6116
6152
  Y({ bufferSize: 1, refCount: !0 })
6117
6153
  );
6118
6154
  P(
@@ -6161,7 +6197,7 @@ class ls extends X {
6161
6197
  super.destroy(), this.forcedOpenSubject.complete();
6162
6198
  }
6163
6199
  }
6164
- const ln = (t, e, n) => {
6200
+ const fn = (t, e, n) => {
6165
6201
  const i = (n.width - e.width) / 2, r = (n.height - e.height) / 2;
6166
6202
  return new R({
6167
6203
  x: t.x - i,
@@ -6186,17 +6222,17 @@ class xe extends DOMRect {
6186
6222
  return new xe(i.x, i.y, i.width, i.height);
6187
6223
  }
6188
6224
  }
6189
- class ps {
6225
+ class ys {
6190
6226
  constructor({ width: e, height: n }) {
6191
6227
  this.__symbol = /* @__PURE__ */ Symbol("AbsoluteViewport"), this.width = e, this.height = n;
6192
6228
  }
6193
6229
  }
6194
- class gs {
6230
+ class Ss {
6195
6231
  constructor({ width: e, height: n }) {
6196
6232
  this.__symbol = /* @__PURE__ */ Symbol("RelativeViewport"), this.width = e, this.height = n;
6197
6233
  }
6198
6234
  }
6199
- const hs = ({
6235
+ const Is = ({
6200
6236
  pageIndex: t,
6201
6237
  spineItemOrId: e,
6202
6238
  spineItemsManager: n
@@ -6218,7 +6254,7 @@ const hs = ({
6218
6254
  { currentAbsolutePage: 0, found: !1 }
6219
6255
  );
6220
6256
  return o;
6221
- }, ms = ({
6257
+ }, bs = ({
6222
6258
  itemHeight: t,
6223
6259
  itemWidth: e,
6224
6260
  visibleWidthOfItem: n,
@@ -6227,7 +6263,7 @@ const hs = ({
6227
6263
  }) => {
6228
6264
  const o = n / e, s = i / t;
6229
6265
  return r.type === "percentage" ? o >= r.value && s >= r.value : n >= r.value && i >= r.value;
6230
- }, fs = ({
6266
+ }, vs = ({
6231
6267
  visibleWidthOfItem: t,
6232
6268
  visibleHeightOfItem: e,
6233
6269
  threshold: n,
@@ -6235,7 +6271,7 @@ const hs = ({
6235
6271
  }) => {
6236
6272
  const r = t / i.width, o = e / i.height;
6237
6273
  return n.type === "percentage" ? o >= n.value && r >= n.value : e >= n.value && t >= n.value;
6238
- }, pn = ({
6274
+ }, yn = ({
6239
6275
  itemPosition: {
6240
6276
  bottom: t,
6241
6277
  left: e,
@@ -6259,14 +6295,14 @@ const hs = ({
6259
6295
  Math.min(t, g) - Math.max(i, l)
6260
6296
  );
6261
6297
  if (p <= 0 || h <= 0) return { visible: !1 };
6262
- const f = fs({
6298
+ const f = vs({
6263
6299
  threshold: s,
6264
6300
  visibleHeightOfItem: h,
6265
6301
  visibleWidthOfItem: p,
6266
6302
  viewportPosition: a
6267
6303
  });
6268
6304
  return c ? { visible: f } : {
6269
- visible: ms({
6305
+ visible: bs({
6270
6306
  itemHeight: o,
6271
6307
  itemWidth: r,
6272
6308
  threshold: s,
@@ -6290,7 +6326,7 @@ const hs = ({
6290
6326
  }) => new O({
6291
6327
  x: e + t.x,
6292
6328
  y: n + t.y
6293
- }), ys = ({
6329
+ }), ws = ({
6294
6330
  position: t,
6295
6331
  threshold: e,
6296
6332
  restrictToScreen: n,
@@ -6305,14 +6341,14 @@ const hs = ({
6305
6341
  spineLayout: r
6306
6342
  }) || i.get(0), c = i.items.reduce(
6307
6343
  (p, h) => {
6308
- const m = r.getSpineItemSpineLayoutInfo(h), f = o ? s.absoluteViewport : s.relativeViewport, b = ln(
6344
+ const m = r.getSpineItemSpineLayoutInfo(h), f = o ? s.absoluteViewport : s.relativeViewport, b = fn(
6309
6345
  t,
6310
6346
  s.absoluteViewport,
6311
6347
  f
6312
6348
  ), $ = xe.from(
6313
6349
  b,
6314
6350
  f
6315
- ), { visible: S } = pn({
6351
+ ), { visible: S } = yn({
6316
6352
  itemPosition: m,
6317
6353
  threshold: e,
6318
6354
  viewportPosition: $,
@@ -6328,7 +6364,7 @@ const hs = ({
6328
6364
  beginIndex: l ?? 0,
6329
6365
  endIndex: g ?? 0
6330
6366
  };
6331
- }, Ss = ({
6367
+ }, xs = ({
6332
6368
  spineItemsManager: t,
6333
6369
  context: e,
6334
6370
  spineItemLocator: n,
@@ -6395,20 +6431,20 @@ const hs = ({
6395
6431
  };
6396
6432
  }).reduce(
6397
6433
  (ce, { absolutePosition: ne, index: Oe }) => {
6398
- const de = $ ? S.absoluteViewport : S.relativeViewport, gn = ln(
6434
+ const de = $ ? S.absoluteViewport : S.relativeViewport, Sn = fn(
6399
6435
  h,
6400
6436
  S.absoluteViewport,
6401
6437
  de
6402
- ), hn = xe.from(
6403
- gn,
6438
+ ), In = xe.from(
6439
+ Sn,
6404
6440
  de
6405
- ), { visible: mn } = pn({
6406
- viewportPosition: hn,
6441
+ ), { visible: bn } = yn({
6442
+ viewportPosition: In,
6407
6443
  restrictToScreen: b,
6408
6444
  threshold: m,
6409
6445
  itemPosition: ne
6410
6446
  });
6411
- return mn ? [...ce, Oe] : ce;
6447
+ return bn ? [...ce, Oe] : ce;
6412
6448
  },
6413
6449
  []
6414
6450
  ), z = M[0], G = M[M.length - 1] ?? z;
@@ -6432,7 +6468,7 @@ const hs = ({
6432
6468
  /**
6433
6469
  * @deprecated use Pages
6434
6470
  */
6435
- _getAbsolutePageIndexFromPageIndex: (h) => hs({
6471
+ _getAbsolutePageIndexFromPageIndex: (h) => Is({
6436
6472
  ...h,
6437
6473
  spineItemsManager: t
6438
6474
  }),
@@ -6473,7 +6509,7 @@ const hs = ({
6473
6509
  }),
6474
6510
  getSpineItemFromIframe: c,
6475
6511
  getSpineItemPageIndexFromNode: u,
6476
- getVisibleSpineItemsFromPosition: (h) => ys({
6512
+ getVisibleSpineItemsFromPosition: (h) => ws({
6477
6513
  spineItemsManager: t,
6478
6514
  spineLayout: r,
6479
6515
  viewport: o,
@@ -6497,14 +6533,14 @@ const hs = ({
6497
6533
  }
6498
6534
  };
6499
6535
  };
6500
- class Is extends X {
6536
+ class Ps extends X {
6501
6537
  constructor(e) {
6502
6538
  super(), this.spineItemsManager = e, this.states$ = this.spineItemsManager.items$.pipe(
6503
6539
  x((n) => P(
6504
6540
  ...n.map(
6505
6541
  (i) => i.pipe(
6506
6542
  y((r) => ({ item: i, ...r })),
6507
- N(j)
6543
+ N(k)
6508
6544
  )
6509
6545
  )
6510
6546
  )),
@@ -6530,7 +6566,7 @@ class Is extends X {
6530
6566
  );
6531
6567
  }
6532
6568
  }
6533
- class bs extends X {
6569
+ class $s extends X {
6534
6570
  constructor(e, n, i, r, o) {
6535
6571
  super(), this.spineItemsManager = e, this.spineItemsObserver = n, this.context = i, this.settings = r, this.viewport = o, this.externalLayoutTrigger = new D(), this.spineItemsRelativeLayouts = [];
6536
6572
  const s = P(
@@ -6550,7 +6586,7 @@ class bs extends X {
6550
6586
  x(
6551
6587
  () => this.spineItemsManager.items.reduce(
6552
6588
  (c, u, d) => c.pipe(
6553
- Pn(({ horizontalOffset: l, verticalOffset: g }) => {
6589
+ Cn(({ horizontalOffset: l, verticalOffset: g }) => {
6554
6590
  const p = l % o.absoluteViewport.width === 0, h = d === e.items.length - 1, m = r.values.computedPageTurnDirection === "vertical", f = i.isRTL(), b = this.getSpreadPosition(
6555
6591
  p,
6556
6592
  f
@@ -6664,24 +6700,24 @@ class bs extends X {
6664
6700
  });
6665
6701
  }
6666
6702
  }
6667
- class vs extends X {
6703
+ class Ts extends X {
6668
6704
  constructor(e, n, i, r, o, s, a) {
6669
6705
  super(), this.context = e, this.pagination = n, this.spineItemsManager = i, this.spineItemLocator = r, this.settings = o, this.hookManager = s, this.viewport = a, this.elementSubject = new J(
6670
6706
  void 0
6671
- ), this.element$ = this.elementSubject.asObservable(), this.spineItemsObserver = new Is(i), this.spineLayout = new bs(
6707
+ ), this.element$ = this.elementSubject.asObservable(), this.spineItemsObserver = new Ps(i), this.spineLayout = new $s(
6672
6708
  i,
6673
6709
  this.spineItemsObserver,
6674
6710
  e,
6675
6711
  o,
6676
6712
  a
6677
- ), this.locator = Ss({
6713
+ ), this.locator = xs({
6678
6714
  context: e,
6679
6715
  spineItemsManager: i,
6680
6716
  spineItemLocator: r,
6681
6717
  settings: o,
6682
6718
  spineLayout: this.spineLayout,
6683
6719
  viewport: a
6684
- }), this.spineItemsLoader = new ls(
6720
+ }), this.spineItemsLoader = new fs(
6685
6721
  this.context,
6686
6722
  i,
6687
6723
  this.locator,
@@ -6713,7 +6749,7 @@ class vs extends X {
6713
6749
  if (!l) return;
6714
6750
  this.spineItemsManager.destroyItems();
6715
6751
  const g = d.spineItems.map(
6716
- (p, h) => new dn(
6752
+ (p, h) => new mn(
6717
6753
  p,
6718
6754
  l,
6719
6755
  this.context,
@@ -6744,7 +6780,7 @@ class vs extends X {
6744
6780
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
6745
6781
  }
6746
6782
  }
6747
- class ws extends X {
6783
+ class Fs extends X {
6748
6784
  constructor(e, n) {
6749
6785
  super(), this.context = e, this.settings = n, this.orderedSpineItemsSubject = new J([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6750
6786
  }
@@ -6758,7 +6794,7 @@ class ws extends X {
6758
6794
  return i > r ? "after" : i === r ? "same" : "before";
6759
6795
  }
6760
6796
  getSpineItemIndex(e) {
6761
- const n = e instanceof dn ? e : this.get(e);
6797
+ const n = e instanceof mn ? e : this.get(e);
6762
6798
  if (!n) return;
6763
6799
  const i = this.orderedSpineItemsSubject.value.indexOf(n);
6764
6800
  return i < 0 ? void 0 : i;
@@ -6787,10 +6823,10 @@ class ws extends X {
6787
6823
  });
6788
6824
  }
6789
6825
  }
6790
- class xs extends te {
6826
+ class Ms extends te {
6791
6827
  constructor(e, n) {
6792
6828
  const i = document.createElement("div");
6793
- i.setAttribute(`data-${_i}`, ""), super({
6829
+ i.setAttribute(`data-${Xi}`, ""), super({
6794
6830
  element: i,
6795
6831
  pageSize: {
6796
6832
  width: 1,
@@ -6839,7 +6875,7 @@ class xs extends te {
6839
6875
  }), this.layoutSubject.next();
6840
6876
  }
6841
6877
  get absoluteViewport() {
6842
- return new ps({
6878
+ return new ys({
6843
6879
  width: this.value.width,
6844
6880
  height: this.value.height
6845
6881
  });
@@ -6867,7 +6903,7 @@ class xs extends te {
6867
6903
  */
6868
6904
  get relativeViewport() {
6869
6905
  const e = this.absoluteViewport, n = this.scaleFactor;
6870
- return new gs({
6906
+ return new Ss({
6871
6907
  width: e.width / n,
6872
6908
  height: e.height / n
6873
6909
  });
@@ -6876,12 +6912,12 @@ class xs extends te {
6876
6912
  super.destroy(), this.layoutSubject.complete();
6877
6913
  }
6878
6914
  }
6879
- const Et = `${zi}-core`, Ps = (t) => {
6880
- const e = crypto.randomUUID(), n = new D(), i = new D(), r = new vr(), o = new Ir(), s = new as(t, o), a = new br(o, s), c = new ws(o, s), u = new xs(o, s), d = cn({
6915
+ const Ot = `${qi}-core`, Cs = (t) => {
6916
+ const e = crypto.randomUUID(), n = new D(), i = new D(), r = new Fr(), o = new $r(), s = new ps(t, o), a = new Tr(o, s), c = new Fs(o, s), u = new Ms(o, s), d = gn({
6881
6917
  context: o,
6882
6918
  settings: s,
6883
6919
  viewport: u
6884
- }), l = new is(o, c), g = new vs(
6920
+ }), l = new us(o, c), g = new Ts(
6885
6921
  o,
6886
6922
  l,
6887
6923
  c,
@@ -6889,14 +6925,14 @@ const Et = `${zi}-core`, Ps = (t) => {
6889
6925
  s,
6890
6926
  r,
6891
6927
  u
6892
- ), p = ns({
6928
+ ), p = cs({
6893
6929
  context: o,
6894
6930
  spineItemsManager: c,
6895
6931
  hookManager: r,
6896
6932
  spine: g,
6897
6933
  settings: s,
6898
6934
  viewport: u
6899
- }), h = new os(
6935
+ }), h = new ds(
6900
6936
  o,
6901
6937
  l,
6902
6938
  c,
@@ -6914,21 +6950,21 @@ const Et = `${zi}-core`, Ps = (t) => {
6914
6950
  return;
6915
6951
  }
6916
6952
  L.log("load", { options: w });
6917
- const G = $s(M, e);
6953
+ const G = Ls(M, e);
6918
6954
  o.update({
6919
6955
  manifest: z,
6920
6956
  rootElement: G
6921
6957
  }), m();
6922
- }, b = s.watch(["computedSpreadMode"]).pipe(Vt(1), U(m)), $ = n.pipe(
6958
+ }, b = s.watch(["computedSpreadMode"]).pipe(Ut(1), U(m)), $ = n.pipe(
6923
6959
  U(() => {
6924
6960
  const w = o.value.rootElement;
6925
6961
  w && (w.style.setProperty("overflow", "hidden"), u.layout(), g.layout());
6926
6962
  }),
6927
6963
  ee(i)
6928
6964
  ), S = P($, b).subscribe();
6929
- it(document, Et, wr);
6965
+ it(document, Ot, Mr);
6930
6966
  const I = () => {
6931
- ot(document, Et), S.unsubscribe(), c.destroy(), h.destroy(), s.destroy(), l.destroy(), o.destroy(), p.destroy(), g.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
6967
+ ot(document, Ot), S.unsubscribe(), c.destroy(), h.destroy(), s.destroy(), l.destroy(), o.destroy(), p.destroy(), g.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
6932
6968
  };
6933
6969
  return {
6934
6970
  id: e,
@@ -6936,10 +6972,10 @@ const Et = `${zi}-core`, Ps = (t) => {
6936
6972
  spine: g,
6937
6973
  hookManager: r,
6938
6974
  cfi: {
6939
- generateCfiFromRange: yo,
6975
+ generateCfiFromRange: xo,
6940
6976
  parseCfi: dt,
6941
6977
  generateCfiForSpineItemPage: Ze,
6942
- resolveCfi: (w) => en({ ...w, spineItemsManager: c })
6978
+ resolveCfi: (w) => sn({ ...w, spineItemsManager: c })
6943
6979
  },
6944
6980
  navigation: p,
6945
6981
  spineItemsObserver: g.spineItemsObserver,
@@ -6974,30 +7010,30 @@ const Et = `${zi}-core`, Ps = (t) => {
6974
7010
  destroy$: i
6975
7011
  }
6976
7012
  };
6977
- }, $s = (t, e) => (t.style.cssText = `
7013
+ }, Ls = (t, e) => (t.style.cssText = `
6978
7014
  ${t.style.cssText}
6979
7015
  background-color: white;
6980
7016
  position: relative;
6981
- `, t.classList.add(`${W}-reader`), t.setAttribute(Wi, e), t.setAttribute("data-prose-reader-container", e), t), Us = (
7017
+ `, t.classList.add(`${W}-reader`), t.setAttribute(Yi, e), t.setAttribute("data-prose-reader-container", e), t), qs = (
6982
7018
  //__
6983
- sr(
6984
- li(
6985
- ur(
6986
- di(
6987
- ti(
6988
- tr(
6989
- cr(
6990
- yr(
6991
- fo(
6992
- Ri(
6993
- to(
6994
- ni(
6995
- si(
6996
- Ko(
6997
- eo(
6998
- ar(
7019
+ pr(
7020
+ fi(
7021
+ mr(
7022
+ mi(
7023
+ si(
7024
+ ar(
7025
+ hr(
7026
+ xr(
7027
+ wo(
7028
+ ki(
7029
+ ao(
7030
+ ai(
7031
+ li(
7032
+ or(
7033
+ so(
7034
+ gr(
6999
7035
  // __
7000
- Ps
7036
+ Cs
7001
7037
  )
7002
7038
  )
7003
7039
  )
@@ -7014,106 +7050,108 @@ const Et = `${zi}-core`, Ps = (t) => {
7014
7050
  )
7015
7051
  )
7016
7052
  )
7017
- ), zs = (t) => (e) => t(e), Ts = 5e3, Ws = (t, {
7018
- itemReadinessTimeoutMs: e = Ts
7019
- } = {}) => Kt(t).pipe(
7053
+ ), Ys = (t) => (e) => t(e), Ns = 5e3, Xs = (t, {
7054
+ itemReadinessTimeoutMs: e = Ns
7055
+ } = {}) => on(t).pipe(
7020
7056
  x((n) => {
7021
7057
  if (n.boundary === "start") return v(n);
7022
7058
  const i = t.spineItemsManager.items, r = i[i.length - 1];
7023
7059
  return r ? r.value.isReady ? v(n) : r.isReady$.pipe(
7024
7060
  C(Boolean),
7025
- k(),
7061
+ j(),
7026
7062
  y(() => n),
7027
- e === 1 / 0 ? ve : $n({
7063
+ e === 1 / 0 ? ve : Ln({
7028
7064
  first: e,
7029
7065
  with: () => B
7030
7066
  }),
7031
- io(t.navigation)
7067
+ uo(t.navigation)
7032
7068
  ) : B;
7033
7069
  }),
7034
7070
  A()
7035
7071
  );
7036
7072
  export {
7037
- Xt as AbstractSpinePosition,
7038
- Ir as Context,
7039
- Tr as ControlledNavigationController,
7073
+ Jt as AbstractSpinePosition,
7074
+ $r as Context,
7075
+ Ar as ControlledNavigationController,
7040
7076
  X as DestroyableClass,
7041
7077
  Le as DocumentRenderer,
7042
- br as Features,
7043
- Wi as HTML_ATTRIBUTE_DATA_READER_ID,
7078
+ Tr as Features,
7079
+ Yi as HTML_ATTRIBUTE_DATA_READER_ID,
7044
7080
  W as HTML_PREFIX,
7045
- Bi as HTML_PREFIX_SCROLL_NAVIGATOR,
7046
- Hi as HTML_PREFIX_SPINE_ITEM,
7047
- _i as HTML_PREFIX_VIEWPORT,
7048
- zi as HTML_STYLE_PREFIX,
7049
- vr as HookManager,
7050
- Wr as InternalNavigator,
7081
+ Gi as HTML_PREFIX_SCROLL_NAVIGATOR,
7082
+ Zi as HTML_PREFIX_SPINE_ITEM,
7083
+ Xi as HTML_PREFIX_VIEWPORT,
7084
+ qi as HTML_STYLE_PREFIX,
7085
+ Fr as HookManager,
7086
+ Xr as InternalNavigator,
7051
7087
  ut as LayoutEntry,
7052
- sn as Locker,
7053
- Vs as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
7054
- Ds as PROSE_READER_NAMESPACE,
7088
+ ln as Locker,
7089
+ Ws as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
7090
+ Us as PROSE_READER_NAMESPACE,
7055
7091
  pe as Pages,
7056
- is as Pagination,
7057
- os as PaginationController,
7092
+ us as Pagination,
7093
+ ds as PaginationController,
7058
7094
  te as ReactiveEntity,
7059
7095
  ct as ResourceHandler,
7060
- vo as ResourcesLocator,
7061
- gr as ScrollNavigationController,
7062
- Pt as ScrollPosition,
7063
- ss as SettingsManager,
7064
- vs as Spine,
7065
- dn as SpineItem,
7066
- Di as SpineItemPageLayout,
7067
- Oi as SpineItemPageSpineLayout,
7096
+ Fo as ResourcesLocator,
7097
+ Ir as ScrollNavigationController,
7098
+ Ft as ScrollPosition,
7099
+ ls as SettingsManager,
7100
+ Ts as Spine,
7101
+ mn as SpineItem,
7102
+ Ui as SpineItemPageLayout,
7103
+ zi as SpineItemPageSpineLayout,
7068
7104
  E as SpineItemPosition,
7069
7105
  Ue as SpineItemSpineLayout,
7070
- ws as SpineItemsManager,
7071
- Is as SpineItemsObserver,
7106
+ Fs as SpineItemsManager,
7107
+ Ps as SpineItemsObserver,
7072
7108
  O as SpinePosition,
7073
- pr as UnboundScrollPosition,
7074
- je as UnboundSpineItemPagePosition,
7109
+ Sr as UnboundScrollPosition,
7110
+ ke as UnboundSpineItemPagePosition,
7075
7111
  R as UnboundSpinePosition,
7076
- Os as VIEWPORT_ADJUSTMENT_THROTTLE,
7077
- xs as Viewport,
7078
- bo as consolidate,
7079
- Us as createReader,
7112
+ zs as VIEWPORT_ADJUSTMENT_THROTTLE,
7113
+ Ms as Viewport,
7114
+ To as consolidate,
7115
+ qs as createReader,
7080
7116
  gt as deferIdle,
7081
- ci as deferNextResult,
7117
+ gi as deferNextResult,
7082
7118
  Ze as generateCfiForSpineItemPage,
7083
- yo as generateCfiFromRange,
7119
+ xo as generateCfiFromRange,
7084
7120
  le as generateRootCfi,
7085
7121
  pt as getAttributeValueFromString,
7086
- As as getBase64FromBlob,
7122
+ Vs as getBase64FromBlob,
7087
7123
  rt as getFrameViewportInfo,
7088
- js as getItemAnchor,
7089
- Ri as htmlEnhancer,
7090
- Bt as idle,
7091
- Kn as injectCSSToFrame,
7124
+ Hs as getItemAnchor,
7125
+ ki as htmlEnhancer,
7126
+ Yt as idle,
7127
+ ii as injectCSSToFrame,
7092
7128
  Q as isDefined,
7093
- Wt as isHtmlElement,
7094
- Zn as isHtmlTagElement,
7129
+ Ht as isHtmlElement,
7130
+ ti as isHtmlTagElement,
7095
7131
  Je as isRootCfi,
7096
- Hs as isShallowEqual,
7097
- eo as layoutEnhancer,
7098
- _t as mapKeysTo,
7099
- Ws as observeBookBoundaryReached,
7100
- Es as observeIntersection,
7132
+ Js as isShallowEqual,
7133
+ so as layoutEnhancer,
7134
+ qt as mapKeysTo,
7135
+ Xs as observeBookBoundaryReached,
7136
+ js as observeIntersection,
7101
7137
  ht as observeMutation,
7102
- no as observeNextSettledNavigation,
7138
+ co as observeNextSettledNavigation,
7103
7139
  at as observeResize,
7104
- Jt as observeSettledNavigation,
7105
- Ko as paginationEnhancer,
7140
+ nn as observeSettledNavigation,
7141
+ or as paginationEnhancer,
7106
7142
  dt as parseCfi,
7107
- ai as pick,
7108
- Ns as removeCSS,
7109
- en as resolveCfi,
7110
- zs as rootEnhancer,
7111
- xo as spinePositionToSpineItemSpineLayout,
7112
- io as takeUntilNextNavigationSettled,
7143
+ pi as pick,
7144
+ Os as removeCSS,
7145
+ sn as resolveCfi,
7146
+ Ys as rootEnhancer,
7147
+ en as shouldEnableSpreadModeForViewport,
7148
+ Bs as shouldUseComputedSpreadModeForViewport,
7149
+ Co as spinePositionToSpineItemSpineLayout,
7150
+ uo as takeUntilNextNavigationSettled,
7113
7151
  se as upsertCSSToFrame,
7114
- Qn as waitForFrameLoad,
7115
- ei as waitForFrameReady,
7116
- Zt as waitForNavigationSettled,
7152
+ oi as waitForFrameLoad,
7153
+ ri as waitForFrameReady,
7154
+ tn as waitForNavigationSettled,
7117
7155
  De as waitForSwitch,
7118
7156
  st as watchKeys
7119
7157
  };