@prose-reader/core 1.8.0 → 1.9.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/prose.js CHANGED
@@ -1,12 +1,12 @@
1
- import { BehaviorSubject as q, takeUntil as dn, combineLatest as Ie, map as ft, scheduled as fn, animationFrameScheduler as me, of as J, Subject as H, distinctUntilChanged as gn, switchMap as Ct, from as fe, merge as X, EMPTY as te, fromEvent as Ft, interval as pn, iif as hn, withLatestFrom as mn, take as yn, identity as ke, forkJoin as vn } from "rxjs";
2
- import { parseContentType as bn, detectMimeTypeFromName as Sn } from "@prose-reader/shared";
3
- const wn = !1, Pn = (e) => (t) => {
1
+ import { BehaviorSubject as q, takeUntil as dn, combineLatest as $e, map as ft, scheduled as fn, animationFrameScheduler as me, of as J, Subject as H, distinctUntilChanged as gn, switchMap as Ct, from as fe, merge as X, EMPTY as te, fromEvent as Ft, interval as pn, iif as hn, withLatestFrom as mn, take as yn, identity as ke, forkJoin as vn } from "rxjs";
2
+ import { parseContentType as bn, detectMimeTypeFromName as wn } from "@prose-reader/shared";
3
+ const Sn = !1, Pn = (e) => (t) => {
4
4
  const n = e(t);
5
5
  return n.manipulateContainer((o) => {
6
6
  const r = () => {
7
7
  n.context.getSettings().computedPageTurnMode === "controlled" && o.scrollTo(0, 0);
8
8
  };
9
- return o.addEventListener("scroll", r), wn;
9
+ return o.addEventListener("scroll", r), Sn;
10
10
  }), n.registerHook("item.onLoad", ({ frame: o }) => {
11
11
  var r;
12
12
  (r = o.contentDocument) == null || r.body.setAttribute("tabindex", "-1");
@@ -15,12 +15,12 @@ const wn = !1, Pn = (e) => (t) => {
15
15
  function G(e) {
16
16
  return typeof e == "function";
17
17
  }
18
- function $n(e) {
18
+ function In(e) {
19
19
  return G(e == null ? void 0 : e.lift);
20
20
  }
21
21
  function K(e) {
22
22
  return function(t) {
23
- if ($n(t))
23
+ if (In(t))
24
24
  return t.lift(function(n) {
25
25
  try {
26
26
  return e(n, this);
@@ -48,7 +48,7 @@ function le(e, t) {
48
48
  }
49
49
  e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
50
50
  }
51
- function In(e, t, n, o) {
51
+ function $n(e, t, n, o) {
52
52
  function r(i) {
53
53
  return i instanceof n ? i : new n(function(s) {
54
54
  s(i);
@@ -140,7 +140,7 @@ function Et(e, t) {
140
140
  return { value: u[0] ? u[1] : void 0, done: !0 };
141
141
  }
142
142
  }
143
- function we(e) {
143
+ function Se(e) {
144
144
  var t = typeof Symbol == "function" && Symbol.iterator, n = t && e[t], o = 0;
145
145
  if (n)
146
146
  return n.call(e);
@@ -178,8 +178,8 @@ function ae(e, t, n) {
178
178
  (i || !(o in t)) && (i || (i = Array.prototype.slice.call(t, 0, o)), i[o] = t[o]);
179
179
  return e.concat(i || Array.prototype.slice.call(t));
180
180
  }
181
- function Se(e) {
182
- return this instanceof Se ? (this.v = e, this) : new Se(e);
181
+ function we(e) {
182
+ return this instanceof we ? (this.v = e, this) : new we(e);
183
183
  }
184
184
  function xn(e, t, n) {
185
185
  if (!Symbol.asyncIterator)
@@ -203,7 +203,7 @@ function xn(e, t, n) {
203
203
  }
204
204
  }
205
205
  function c(f) {
206
- f.value instanceof Se ? Promise.resolve(f.value.v).then(u, d) : l(i[0][2], f);
206
+ f.value instanceof we ? Promise.resolve(f.value.v).then(u, d) : l(i[0][2], f);
207
207
  }
208
208
  function u(f) {
209
209
  a("next", f);
@@ -219,7 +219,7 @@ function Tn(e) {
219
219
  if (!Symbol.asyncIterator)
220
220
  throw new TypeError("Symbol.asyncIterator is not defined.");
221
221
  var t = e[Symbol.asyncIterator], n;
222
- return t ? t.call(e) : (e = typeof we == "function" ? we(e) : e[Symbol.iterator](), n = {}, o("next"), o("throw"), o("return"), n[Symbol.asyncIterator] = function() {
222
+ return t ? t.call(e) : (e = typeof Se == "function" ? Se(e) : e[Symbol.iterator](), n = {}, o("next"), o("throw"), o("return"), n[Symbol.asyncIterator] = function() {
223
223
  return this;
224
224
  }, n);
225
225
  function o(i) {
@@ -274,7 +274,7 @@ var xe = function() {
274
274
  if (s)
275
275
  if (this._parentage = null, Array.isArray(s))
276
276
  try {
277
- for (var a = we(s), c = a.next(); !c.done; c = a.next()) {
277
+ for (var a = Se(s), c = a.next(); !c.done; c = a.next()) {
278
278
  var u = c.value;
279
279
  u.remove(this);
280
280
  }
@@ -301,7 +301,7 @@ var xe = function() {
301
301
  if (l) {
302
302
  this._finalizers = null;
303
303
  try {
304
- for (var f = we(l), g = f.next(); !g.done; g = f.next()) {
304
+ for (var f = Se(l), g = f.next(); !g.done; g = f.next()) {
305
305
  var y = g.value;
306
306
  try {
307
307
  gt(y);
@@ -411,7 +411,7 @@ var rt = function(e) {
411
411
  return o.isStopped = !1, n ? (o.destination = n, Lt(n) && n.add(o)) : o.destination = Rn, o;
412
412
  }
413
413
  return t.create = function(n, o, r) {
414
- return new $e(n, o, r);
414
+ return new Ie(n, o, r);
415
415
  }, t.prototype.next = function(n) {
416
416
  this.isStopped ? We(En(n), this) : this._next(n);
417
417
  }, t.prototype.error = function(n) {
@@ -470,7 +470,7 @@ var Nn = function() {
470
470
  Ce(n);
471
471
  }
472
472
  }, e;
473
- }(), $e = function(e) {
473
+ }(), Ie = function(e) {
474
474
  le(t, e);
475
475
  function t(n, o, r) {
476
476
  var i = e.call(this) || this, s;
@@ -532,7 +532,7 @@ var ne = function() {
532
532
  var n = new e();
533
533
  return n.source = this, n.operator = t, n;
534
534
  }, e.prototype.subscribe = function(t, n, o) {
535
- var r = this, i = _n(t) ? t : new $e(t, n, o);
535
+ var r = this, i = _n(t) ? t : new Ie(t, n, o);
536
536
  return Oe(function() {
537
537
  var s = r, a = s.operator, c = s.source;
538
538
  i.add(a ? a.call(i, c) : c ? r._subscribe(i) : r._trySubscribe(i));
@@ -546,7 +546,7 @@ var ne = function() {
546
546
  }, e.prototype.forEach = function(t, n) {
547
547
  var o = this;
548
548
  return n = pt(n), new n(function(r, i) {
549
- var s = new $e({
549
+ var s = new Ie({
550
550
  next: function(a) {
551
551
  try {
552
552
  t(a);
@@ -620,13 +620,13 @@ function zt(e) {
620
620
  case 1:
621
621
  s.trys.push([1, , 9, 10]), s.label = 2;
622
622
  case 2:
623
- return [4, Se(n.read())];
623
+ return [4, we(n.read())];
624
624
  case 3:
625
- return o = s.sent(), r = o.value, i = o.done, i ? [4, Se(void 0)] : [3, 5];
625
+ return o = s.sent(), r = o.value, i = o.done, i ? [4, we(void 0)] : [3, 5];
626
626
  case 4:
627
627
  return [2, s.sent()];
628
628
  case 5:
629
- return [4, Se(r)];
629
+ return [4, we(r)];
630
630
  case 6:
631
631
  return [4, s.sent()];
632
632
  case 7:
@@ -691,7 +691,7 @@ function zn(e) {
691
691
  return new ne(function(t) {
692
692
  var n, o;
693
693
  try {
694
- for (var r = we(e), i = r.next(); !i.done; i = r.next()) {
694
+ for (var r = Se(e), i = r.next(); !i.done; i = r.next()) {
695
695
  var s = i.value;
696
696
  if (t.next(s), t.closed)
697
697
  return;
@@ -721,7 +721,7 @@ function Un(e) {
721
721
  }
722
722
  function Wn(e, t) {
723
723
  var n, o, r, i;
724
- return In(this, void 0, void 0, function() {
724
+ return $n(this, void 0, void 0, function() {
725
725
  var s, a;
726
726
  return Et(this, function(c) {
727
727
  switch (c.label) {
@@ -1049,13 +1049,13 @@ function io(e, t, n, o, r, i, s, a) {
1049
1049
  return u < o ? y(v) : c.push(v);
1050
1050
  }, y = function(v) {
1051
1051
  i && t.next(v), u++;
1052
- var S = !1;
1052
+ var w = !1;
1053
1053
  ee(n(v, d++)).subscribe(Z(t, function(p) {
1054
1054
  r == null || r(p), i ? g(p) : t.next(p);
1055
1055
  }, function() {
1056
- S = !0;
1056
+ w = !0;
1057
1057
  }, void 0, function() {
1058
- if (S)
1058
+ if (w)
1059
1059
  try {
1060
1060
  u--;
1061
1061
  for (var p = function() {
@@ -1115,7 +1115,7 @@ var co = Ot(function(e) {
1115
1115
  if (o._throwIfClosed(), !o.isStopped) {
1116
1116
  o.currentObservers || (o.currentObservers = Array.from(o.observers));
1117
1117
  try {
1118
- for (var s = we(o.currentObservers), a = s.next(); !a.done; a = s.next()) {
1118
+ for (var s = Se(o.currentObservers), a = s.next(); !a.done; a = s.next()) {
1119
1119
  var c = a.value;
1120
1120
  c.next(n);
1121
1121
  }
@@ -1359,28 +1359,28 @@ function oe(e) {
1359
1359
  return new ct();
1360
1360
  } : t, o = e.resetOnError, r = o === void 0 ? !0 : o, i = e.resetOnComplete, s = i === void 0 ? !0 : i, a = e.resetOnRefCountZero, c = a === void 0 ? !0 : a;
1361
1361
  return function(u) {
1362
- var d, l, f, g = 0, y = !1, v = !1, S = function() {
1362
+ var d, l, f, g = 0, y = !1, v = !1, w = function() {
1363
1363
  l == null || l.unsubscribe(), l = void 0;
1364
1364
  }, p = function() {
1365
- S(), d = f = void 0, y = v = !1;
1365
+ w(), d = f = void 0, y = v = !1;
1366
1366
  }, C = function() {
1367
1367
  var N = d;
1368
1368
  p(), N == null || N.unsubscribe();
1369
1369
  };
1370
- return K(function(N, $) {
1371
- g++, !v && !y && S();
1372
- var w = f = f ?? n();
1373
- $.add(function() {
1370
+ return K(function(N, I) {
1371
+ g++, !v && !y && w();
1372
+ var S = f = f ?? n();
1373
+ I.add(function() {
1374
1374
  g--, g === 0 && !v && !y && (l = Be(C, c));
1375
- }), w.subscribe($), !d && g > 0 && (d = new $e({
1375
+ }), S.subscribe(I), !d && g > 0 && (d = new Ie({
1376
1376
  next: function(m) {
1377
- return w.next(m);
1377
+ return S.next(m);
1378
1378
  },
1379
1379
  error: function(m) {
1380
- v = !0, S(), l = Be(p, r, m), w.error(m);
1380
+ v = !0, w(), l = Be(p, r, m), S.error(m);
1381
1381
  },
1382
1382
  complete: function() {
1383
- y = !0, S(), l = Be(p, s), w.complete();
1383
+ y = !0, w(), l = Be(p, s), S.complete();
1384
1384
  }
1385
1385
  }), ee(N).subscribe(d));
1386
1386
  })(u);
@@ -1394,7 +1394,7 @@ function Be(e, t) {
1394
1394
  return;
1395
1395
  }
1396
1396
  if (t !== !1) {
1397
- var r = new $e({
1397
+ var r = new Ie({
1398
1398
  next: function() {
1399
1399
  r.unsubscribe(), e();
1400
1400
  }
@@ -1525,13 +1525,13 @@ const ho = (e) => ({ fontScale: t = 1, lineHeight: n = "publisher", fontWeight:
1525
1525
  fontScale: g = s.value.fontScale,
1526
1526
  fontWeight: y = s.value.fontWeight,
1527
1527
  lineHeight: v = s.value.lineHeight,
1528
- ...S
1528
+ ...w
1529
1529
  } = l;
1530
- mo(l, ["fontJustification", "fontScale", "fontWeight", "lineHeight"]) && s.next({ fontJustification: f, fontScale: g, fontWeight: y, lineHeight: v }), a.setSettings(S);
1530
+ mo(l, ["fontJustification", "fontScale", "fontWeight", "lineHeight"]) && s.next({ fontJustification: f, fontScale: g, fontWeight: y, lineHeight: v }), a.setSettings(w);
1531
1531
  },
1532
1532
  $: {
1533
1533
  ...a.$,
1534
- settings$: Ie([a.$.settings$, s]).pipe(
1534
+ settings$: $e([a.$.settings$, s]).pipe(
1535
1535
  ft(([l, f]) => ({
1536
1536
  ...l,
1537
1537
  ...f
@@ -1586,7 +1586,7 @@ const ho = (e) => ({ fontScale: t = 1, lineHeight: n = "publisher", fontWeight:
1586
1586
  }, Qt = (e) => k((t) => Object.entries(t).reduce((n, [o, r]) => e.includes(o) ? {
1587
1587
  ...n,
1588
1588
  [o]: r
1589
- } : n, {})), So = Object.prototype.hasOwnProperty, wo = (e, t) => e === t ? e !== 0 || t !== 0 || 1 / e === 1 / t : !1, ce = (e, t, n) => {
1589
+ } : n, {})), wo = Object.prototype.hasOwnProperty, So = (e, t) => e === t ? e !== 0 || t !== 0 || 1 / e === 1 / t : !1, ce = (e, t, n) => {
1590
1590
  if (e === t)
1591
1591
  return !0;
1592
1592
  if (typeof e != "object" || e === null || typeof t != "object" || t === null)
@@ -1594,14 +1594,14 @@ const ho = (e) => ({ fontScale: t = 1, lineHeight: n = "publisher", fontWeight:
1594
1594
  const o = Object.keys(e), r = Object.keys(t);
1595
1595
  if (o.length !== r.length)
1596
1596
  return !1;
1597
- const i = n && typeof n.customEqual == "function" ? n.customEqual : wo;
1597
+ const i = n && typeof n.customEqual == "function" ? n.customEqual : So;
1598
1598
  for (let s = 0; s < o.length; s++) {
1599
1599
  const a = o[s] || "";
1600
- if (!So.call(t, a) || !i(e[a], t[a]))
1600
+ if (!wo.call(t, a) || !i(e[a], t[a]))
1601
1601
  return !1;
1602
1602
  }
1603
1603
  return !0;
1604
- }, ci = (e, t) => e.reduce((n, o) => {
1604
+ }, ui = (e, t) => e.reduce((n, o) => {
1605
1605
  const r = t(o);
1606
1606
  return n[r] || (n[r] = []), n[r].push(o), n;
1607
1607
  }, {}), Po = (e) => {
@@ -1615,7 +1615,7 @@ const ho = (e) => ({ fontScale: t = 1, lineHeight: n = "publisher", fontWeight:
1615
1615
  !1
1616
1616
  ), t.readAsDataURL(e);
1617
1617
  });
1618
- }, $o = (e) => {
1618
+ }, Io = (e) => {
1619
1619
  e.registerHook("item.onAfterLayout", ({ item: t, blankPagePosition: n, minimumWidth: o }) => {
1620
1620
  var c;
1621
1621
  const r = e.getSpineItem(t.id);
@@ -1627,28 +1627,28 @@ const ho = (e) => ({ fontScale: t = 1, lineHeight: n = "publisher", fontWeight:
1627
1627
  n === "none" && u && (a == null || a.style.setProperty("left", e.context.isRTL() ? "75%" : "25%"));
1628
1628
  }
1629
1629
  });
1630
- }, Io = !1, xo = (e) => ({ pageHorizontalMargin: t = 24, pageVerticalMargin: n = 24, ...o }) => {
1630
+ }, $o = !1, xo = (e) => ({ pageHorizontalMargin: t = 24, pageVerticalMargin: n = 24, ...o }) => {
1631
1631
  const r = e(o), i = new q({
1632
1632
  pageHorizontalMargin: t,
1633
1633
  pageVerticalMargin: n
1634
1634
  });
1635
1635
  r.registerHook("onViewportOffsetAdjust", () => {
1636
1636
  let c = !1;
1637
- r.manipulateSpineItems(({ frame: u }) => (!c && u && (u.getBoundingClientRect().left, c = !0), Io));
1637
+ r.manipulateSpineItems(({ frame: u }) => (!c && u && (u.getBoundingClientRect().left, c = !0), $o));
1638
1638
  }), r.registerHook("item.onLayoutBeforeMeasurement", ({ frame: c, minimumWidth: u, item: d, isImageType: l }) => {
1639
- var v, S;
1639
+ var v, w;
1640
1640
  const { pageHorizontalMargin: f = 0, pageVerticalMargin: g = 0 } = i.value, y = r.context.getPageSize();
1641
1641
  if (d.renditionLayout === "reflowable" && c.getIsReady() && !l() && !c.getViewportDimensions()) {
1642
1642
  let p = y.width - f * 2;
1643
1643
  const C = y.height - g * 2;
1644
- let N = y.width - f * 2, $ = f * 2;
1645
- c.isUsingVerticalWriting() && (N = u - f * 2, p = C, $ = g * 2), (v = c.getManipulableFrame()) == null || v.removeStyle("prose-layout-enhancer-css"), (S = c.getManipulableFrame()) == null || S.addStyle(
1644
+ let N = y.width - f * 2, I = f * 2;
1645
+ c.isUsingVerticalWriting() && (N = u - f * 2, p = C, I = g * 2), (v = c.getManipulableFrame()) == null || v.removeStyle("prose-layout-enhancer-css"), (w = c.getManipulableFrame()) == null || w.addStyle(
1646
1646
  "prose-layout-enhancer-css",
1647
1647
  `
1648
1648
  body {
1649
1649
  width: ${N}px !important;
1650
1650
  margin: ${g}px ${f}px !important;
1651
- column-gap: ${$}px !important;
1651
+ column-gap: ${I}px !important;
1652
1652
  column-width: ${p}px !important;
1653
1653
  height: ${C}px !important;
1654
1654
  }
@@ -1665,7 +1665,7 @@ const ho = (e) => ({ fontScale: t = 1, lineHeight: n = "publisher", fontWeight:
1665
1665
  `
1666
1666
  );
1667
1667
  }
1668
- }), $o(r);
1668
+ }), Io(r);
1669
1669
  let s;
1670
1670
  return o.layoutAutoResize === "container" && (s = new ResizeObserver(() => {
1671
1671
  r == null || r.layout();
@@ -1690,7 +1690,7 @@ const ho = (e) => ({ fontScale: t = 1, lineHeight: n = "publisher", fontWeight:
1690
1690
  },
1691
1691
  $: {
1692
1692
  ...r.$,
1693
- settings$: Ie([r.$.settings$, i.asObservable()]).pipe(
1693
+ settings$: $e([r.$.settings$, i.asObservable()]).pipe(
1694
1694
  k(([c, u]) => ({
1695
1695
  ...c,
1696
1696
  ...u
@@ -1884,7 +1884,7 @@ const ho = (e) => ({ fontScale: t = 1, lineHeight: n = "publisher", fontWeight:
1884
1884
  numberOfPagesPerItems: [],
1885
1885
  numberOfTotalPages: 0
1886
1886
  })
1887
- ), d = Ie([c, u]).pipe(
1887
+ ), d = $e([c, u]).pipe(
1888
1888
  k(([l, f]) => ({
1889
1889
  ...l,
1890
1890
  ...f,
@@ -1987,7 +1987,7 @@ function _o(...e) {
1987
1987
  function tn(...e) {
1988
1988
  return _o(...e);
1989
1989
  }
1990
- const St = !1, Mo = (e) => {
1990
+ const wt = !1, Mo = (e) => {
1991
1991
  const t = new q(!1);
1992
1992
  let n, o = { x: 0, y: 0 }, r = { x: 0, y: 0 }, i = 1, s = 1;
1993
1993
  const a = (y) => {
@@ -2002,14 +2002,14 @@ const St = !1, Mo = (e) => {
2002
2002
  width: 100%;
2003
2003
  height: 100%;
2004
2004
  `;
2005
- const S = y.cloneNode();
2006
- return S.src = y.src, S.style.setProperty("height", "100%"), S.style.setProperty("width", "100%"), S.style.setProperty("object-fit", "contain"), S.style.setProperty("pointer-events", "none"), n.appendChild(S), v.appendChild(n), St;
2005
+ const w = y.cloneNode();
2006
+ return w.src = y.src, w.style.setProperty("height", "100%"), w.style.setProperty("width", "100%"), w.style.setProperty("object-fit", "contain"), w.style.setProperty("pointer-events", "none"), n.appendChild(w), v.appendChild(n), wt;
2007
2007
  }), u(1.2), c();
2008
2008
  }, c = () => {
2009
2009
  i = s;
2010
2010
  }, u = (y) => {
2011
- const v = n == null ? void 0 : n.querySelector("img"), S = Math.ceil((y < 1 ? i - (1 - y) : i + (y - 1)) * 100) / 100, p = Math.max(S, 1);
2012
- S < 1 && (o = { x: 0, y: 0 }), v == null || v.style.setProperty(
2011
+ const v = n == null ? void 0 : n.querySelector("img"), w = Math.ceil((y < 1 ? i - (1 - y) : i + (y - 1)) * 100) / 100, p = Math.max(w, 1);
2012
+ w < 1 && (o = { x: 0, y: 0 }), v == null || v.style.setProperty(
2013
2013
  "transform",
2014
2014
  `translate3d(${o.x}px, ${o.y}px, 0px) scale3d(${p}, ${p}, 1)`
2015
2015
  ), s = p;
@@ -2017,9 +2017,9 @@ const St = !1, Mo = (e) => {
2017
2017
  return {
2018
2018
  enter: a,
2019
2019
  exit: () => {
2020
- s = 1, e.manipulateContainer(() => (n == null || n.remove(), n = void 0, St)), t.next(!1);
2020
+ s = 1, e.manipulateContainer(() => (n == null || n.remove(), n = void 0, wt)), t.next(!1);
2021
2021
  },
2022
- move: (y, { isFirst: v, isLast: S }) => {
2022
+ move: (y, { isFirst: v, isLast: w }) => {
2023
2023
  const p = n == null ? void 0 : n.querySelector("img");
2024
2024
  if (v && (r = { x: 0, y: 0 }), y) {
2025
2025
  const C = y.x - ((r == null ? void 0 : r.x) || 0), N = y.y - ((r == null ? void 0 : r.y) || 0);
@@ -2031,7 +2031,7 @@ const St = !1, Mo = (e) => {
2031
2031
  `translate3d(${o.x}px, ${o.y}px, 0px) scale3d(${i}, ${i}, 1)`
2032
2032
  ), r = y;
2033
2033
  }
2034
- S && (r = void 0);
2034
+ w && (r = void 0);
2035
2035
  },
2036
2036
  scale: u,
2037
2037
  setCurrentScaleAsBase: c,
@@ -2060,7 +2060,7 @@ const St = !1, Mo = (e) => {
2060
2060
  }, s = () => {
2061
2061
  n = o;
2062
2062
  }, a = (f) => {
2063
- const g = Math.ceil((f < 1 ? n - (1 - f) : n + (f - 1)) * 100) / 100, y = Math.max(g, 1), v = e.spine.element.getBoundingClientRect().width / e.spine.element.offsetWidth, S = e.viewportNavigator.element.scrollTop;
2063
+ const g = Math.ceil((f < 1 ? n - (1 - f) : n + (f - 1)) * 100) / 100, y = Math.max(g, 1), v = e.spine.element.getBoundingClientRect().width / e.spine.element.offsetWidth, w = e.viewportNavigator.element.scrollTop;
2064
2064
  e.spine.element.style.transform = `scale(${y})`, e.viewportNavigator.element.scrollLeft = je({
2065
2065
  newScale: y,
2066
2066
  oldScale: v,
@@ -2072,7 +2072,7 @@ const St = !1, Mo = (e) => {
2072
2072
  oldScale: v,
2073
2073
  pageSize: e.viewportNavigator.element.clientHeight,
2074
2074
  screenSize: e.spine.element.offsetHeight,
2075
- scrollOffset: S
2075
+ scrollOffset: w
2076
2076
  }), o = y;
2077
2077
  };
2078
2078
  return {
@@ -2194,10 +2194,10 @@ const St = !1, Mo = (e) => {
2194
2194
  x: 0,
2195
2195
  y: 0
2196
2196
  }, s = 0, a = 0, c = new H(), u = ko(e), d = () => {
2197
- const { height: v, width: S } = i, p = S > v;
2197
+ const { height: v, width: w } = i, p = w > v;
2198
2198
  return u.getSettings().forceSinglePageMode || (t == null ? void 0 : t.renditionFlow) === "scrolled-continuous" ? !1 : !p && (t == null ? void 0 : t.renditionSpread) === "portrait" ? !0 : p && ((t == null ? void 0 : t.renditionSpread) === void 0 || (t == null ? void 0 : t.renditionSpread) === "auto" || (t == null ? void 0 : t.renditionSpread) === "landscape" || (t == null ? void 0 : t.renditionSpread) === "both");
2199
- }, l = (v, S) => {
2200
- t = v, n = S, u.recompute({ manifest: t, hasVerticalWritingSubject: o.value }), r.next(v);
2199
+ }, l = (v, w) => {
2200
+ t = v, n = w, u.recompute({ manifest: t, hasVerticalWritingSubject: o.value }), r.next(v);
2201
2201
  }, f = () => (t == null ? void 0 : t.readingDirection) === "rtl", g = () => o.next(!0);
2202
2202
  return o.pipe(
2203
2203
  Me(1),
@@ -2218,8 +2218,8 @@ const St = !1, Mo = (e) => {
2218
2218
  getVisibleAreaRect: () => i,
2219
2219
  shouldDisplaySpread: d,
2220
2220
  setHasVerticalWriting: g,
2221
- setVisibleAreaRect: (v, S, p, C) => {
2222
- i.width = p, i.height = C - s - a, i.x = v, i.y = S;
2221
+ setVisibleAreaRect: (v, w, p, C) => {
2222
+ i.width = p, i.height = C - s - a, i.x = v, i.y = w;
2223
2223
  },
2224
2224
  getManifest: () => t,
2225
2225
  getReadingDirection: () => t == null ? void 0 : t.readingDirection,
@@ -2249,7 +2249,7 @@ const St = !1, Mo = (e) => {
2249
2249
  const r = document.createElement("style");
2250
2250
  r.id = t, r.innerHTML = n, o ? e.contentDocument.head.prepend(r) : e.contentDocument.head.appendChild(r);
2251
2251
  }
2252
- }, wt = (e, t) => {
2252
+ }, St = (e, t) => {
2253
2253
  const n = new RegExp(t + "\\s*=\\s*([0-9.]+)", "i"), o = e.match(n) || [], r = o[1] || "0";
2254
2254
  return o && parseFloat(r) || 0;
2255
2255
  }, Xo = (e) => e[nn], qo = (e, t) => {
@@ -2269,16 +2269,21 @@ const St = !1, Mo = (e) => {
2269
2269
  frame: e,
2270
2270
  removeStyle: Bo(e),
2271
2271
  addStyle: Yo(e)
2272
+ }), Zo = (e) => new Promise((t, n) => {
2273
+ const o = new Image();
2274
+ o.src = e, o.onload = () => {
2275
+ t({ height: o.naturalHeight, width: o.naturalWidth });
2276
+ }, o.onerror = n;
2272
2277
  }), rn = async (e, t) => {
2273
2278
  if (typeof e == "string")
2274
2279
  return e;
2275
- const n = bn(e.headers.get("Content-Type") || "") || Sn(t.href);
2280
+ const n = bn(e.headers.get("Content-Type") || "") || wn(t.href);
2276
2281
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some((r) => r === n)) {
2277
- const r = await Po(await e.blob());
2282
+ const r = await Po(await e.blob()), { height: i, width: s } = await Zo(r);
2278
2283
  return `
2279
2284
  <html>
2280
2285
  <head>
2281
- ${t.renditionLayout !== "reflowable" ? '<meta name="viewport" content="width=device-width, minimum-scale=0.1">' : ""}
2286
+ ${t.renditionLayout !== "reflowable" ? `<meta name="viewport" content="width=${s}, height=${i}">` : ""}
2282
2287
  </head>
2283
2288
  <body style="margin: 0px;" tab-index="-1;">
2284
2289
  <img
@@ -2306,7 +2311,7 @@ const St = !1, Mo = (e) => {
2306
2311
  </body>
2307
2312
  </html>
2308
2313
  ` : await e.text();
2309
- }, Zo = (e) => e.name === "item.onLoad", Jo = ({
2314
+ }, Jo = (e) => e.name === "item.onLoad", Ko = ({
2310
2315
  item: e,
2311
2316
  parent: t,
2312
2317
  fetchResource: n,
@@ -2316,48 +2321,48 @@ const St = !1, Mo = (e) => {
2316
2321
  }) => {
2317
2322
  const s = new H(), a = new H(), c = new H(), u = new q(void 0), d = new q(!1), l = new q(!1);
2318
2323
  let f = [], g;
2319
- const y = ($) => ($.pipe(j(r.$.destroy$)).subscribe(), $), v = ($) => rn($, e), S = i.pipe(
2320
- B(($) => $ === "free"),
2324
+ const y = (I) => (I.pipe(j(r.$.destroy$)).subscribe(), I), v = (I) => rn(I, e), w = i.pipe(
2325
+ B((I) => I === "free"),
2321
2326
  ye(1)
2322
2327
  ), p = c.asObservable().pipe(
2323
2328
  re(u),
2324
- B(([$, w]) => !!w),
2325
- k(([, $]) => {
2326
- f.forEach((w) => {
2327
- w && "unsubscribe" in w ? w.unsubscribe() : w && w();
2328
- }), f = [], $ == null || $.remove(), u.next(void 0);
2329
+ B(([I, S]) => !!S),
2330
+ k(([, I]) => {
2331
+ f.forEach((S) => {
2332
+ S && "unsubscribe" in S ? S.unsubscribe() : S && S();
2333
+ }), f = [], I == null || I.remove(), u.next(void 0);
2329
2334
  }),
2330
2335
  oe(),
2331
2336
  j(s)
2332
2337
  ), C = a.asObservable().pipe(
2333
2338
  re(d),
2334
- B(([$, w]) => !w),
2339
+ B(([I, S]) => !S),
2335
2340
  Jt(() => Go().pipe(
2336
- ie(($) => S.pipe(he($))),
2337
- ie(($) => (t.appendChild($), u.next($), !n && e.href.startsWith(window.location.origin) && (e.mediaType && ["application/xhtml+xml", "application/xml", "text/html", "text/xml"].includes(e.mediaType) || !e.mediaType && Ho.some((w) => e.href.endsWith(w))) ? ($ == null || $.setAttribute("src", e.href), J($)) : fe((n || (() => fetch(e.href)))(e)).pipe(
2341
+ ie((I) => w.pipe(he(I))),
2342
+ ie((I) => (t.appendChild(I), u.next(I), !n && e.href.startsWith(window.location.origin) && (e.mediaType && ["application/xhtml+xml", "application/xml", "text/html", "text/xml"].includes(e.mediaType) || !e.mediaType && Ho.some((S) => e.href.endsWith(S))) ? (I == null || I.setAttribute("src", e.href), J(I)) : fe((n || (() => fetch(e.href)))(e)).pipe(
2338
2343
  ie((m) => v(m)),
2339
2344
  U((m) => {
2340
- $ == null || $.setAttribute("srcdoc", m);
2345
+ I == null || I.setAttribute("srcdoc", m);
2341
2346
  }),
2342
- k(() => $)
2347
+ k(() => I)
2343
2348
  ))),
2344
- ie(($) => $ ? ($.setAttribute("sandbox", "allow-same-origin allow-scripts"), Ft($, "load").pipe(
2349
+ ie((I) => I ? (I.setAttribute("sandbox", "allow-same-origin allow-scripts"), Ft(I, "load").pipe(
2345
2350
  ye(1),
2346
2351
  re(o),
2347
- ie(([w, m]) => {
2348
- var x, I;
2349
- const h = (x = $.contentDocument) == null ? void 0 : x.body;
2352
+ ie(([S, m]) => {
2353
+ var x, $;
2354
+ const h = (x = I.contentDocument) == null ? void 0 : x.body;
2350
2355
  if (!h)
2351
2356
  return R.error(`Something went wrong on iframe load ${e.id}`), te;
2352
- $.setAttribute("role", "main"), $ != null && $.contentDocument && h && (g = (I = $ == null ? void 0 : $.contentWindow) == null ? void 0 : I.getComputedStyle(h)), r.getSettings().computedPageTurnMode !== "scrollable" && $.setAttribute("tab-index", "0");
2353
- const b = on($);
2354
- return f = m.filter(Zo).map((T) => {
2357
+ I.setAttribute("role", "main"), I != null && I.contentDocument && h && (g = ($ = I == null ? void 0 : I.contentWindow) == null ? void 0 : $.getComputedStyle(h)), r.getSettings().computedPageTurnMode !== "scrollable" && I.setAttribute("tab-index", "0");
2358
+ const b = on(I);
2359
+ return f = m.filter(Jo).map((T) => {
2355
2360
  const A = T.fn({
2356
2361
  ...b,
2357
2362
  item: e
2358
2363
  });
2359
2364
  return A && "subscribe" in A ? A.subscribe() : A;
2360
- }), J($);
2365
+ }), J(I);
2361
2366
  })
2362
2367
  )) : te),
2363
2368
  j(c)
@@ -2366,9 +2371,9 @@ const St = !1, Mo = (e) => {
2366
2371
  y,
2367
2372
  j(s)
2368
2373
  ), N = C.pipe(
2369
- W(($) => {
2370
- var w;
2371
- return fe(((w = $ == null ? void 0 : $.contentDocument) == null ? void 0 : w.fonts.ready) || J(void 0)).pipe(j(c));
2374
+ W((I) => {
2375
+ var S;
2376
+ return fe(((S = I == null ? void 0 : I.contentDocument) == null ? void 0 : S.fonts.ready) || J(void 0)).pipe(j(c));
2372
2377
  }),
2373
2378
  oe(),
2374
2379
  y,
@@ -2392,7 +2397,7 @@ const St = !1, Mo = (e) => {
2392
2397
  frameElement$: u
2393
2398
  }
2394
2399
  };
2395
- }, Ko = ({
2400
+ }, Qo = ({
2396
2401
  item: e,
2397
2402
  parent: t,
2398
2403
  fetchResource: n,
@@ -2404,22 +2409,22 @@ const St = !1, Mo = (e) => {
2404
2409
  $: { unload$: a, loaded$: c, isLoaded$: u, isReady$: d, unloaded$: l, frameElement$: f, ready$: g },
2405
2410
  load: y,
2406
2411
  unload: v,
2407
- destroy: S,
2412
+ destroy: w,
2408
2413
  getComputedStyleAfterLoad: p
2409
- } = Jo({ context: o, hooks$: r, item: e, parent: t, fetchResource: n, viewportState$: i }), C = new q(!1), N = new q(!1);
2414
+ } = Ko({ context: o, hooks$: r, item: e, parent: t, fetchResource: n, viewportState$: i }), C = new q(!1), N = new q(!1);
2410
2415
  u.subscribe(C), d.subscribe(N);
2411
- const $ = () => {
2416
+ const I = () => {
2412
2417
  const T = f.getValue();
2413
2418
  if (C.value && T)
2414
2419
  return on(T);
2415
- }, w = () => {
2420
+ }, S = () => {
2416
2421
  const T = f.getValue();
2417
2422
  if (T && (T != null && T.contentDocument)) {
2418
2423
  const E = T.contentDocument.querySelector("meta[name='viewport']");
2419
2424
  if (E) {
2420
2425
  const O = E.getAttribute("content");
2421
2426
  if (O) {
2422
- const _ = wt(O, "width"), F = wt(O, "height");
2427
+ const _ = St(O, "width"), F = St(O, "height");
2423
2428
  return _ > 0 && F > 0 ? {
2424
2429
  width: _,
2425
2430
  height: F
@@ -2440,7 +2445,7 @@ const St = !1, Mo = (e) => {
2440
2445
  return {
2441
2446
  getIsLoaded: () => C.value,
2442
2447
  getIsReady: () => N.value,
2443
- getViewportDimensions: w,
2448
+ getViewportDimensions: S,
2444
2449
  getFrameElement: () => f.getValue(),
2445
2450
  getHtmlFromResource: b,
2446
2451
  load: y,
@@ -2449,7 +2454,7 @@ const St = !1, Mo = (e) => {
2449
2454
  const A = f.getValue();
2450
2455
  A && (A.style.width = `${T.width}px`, A.style.height = `${T.height}px`, o.getSettings().computedPageTurnMode !== "scrollable" && A.setAttribute("tab-index", "0"));
2451
2456
  },
2452
- getManipulableFrame: $,
2457
+ getManipulableFrame: I,
2453
2458
  getReadingDirection: () => {
2454
2459
  var E;
2455
2460
  if (m() === "vertical-rl")
@@ -2461,7 +2466,7 @@ const St = !1, Mo = (e) => {
2461
2466
  isUsingVerticalWriting: h,
2462
2467
  getWritingMode: m,
2463
2468
  destroy: () => {
2464
- v(), S(), s.next(), s.complete();
2469
+ v(), w(), s.next(), s.complete();
2465
2470
  },
2466
2471
  $: {
2467
2472
  unload$: a,
@@ -2472,7 +2477,7 @@ const St = !1, Mo = (e) => {
2472
2477
  contentLayoutChange$: x
2473
2478
  }
2474
2479
  };
2475
- }, Qo = () => {
2480
+ }, er = () => {
2476
2481
  const e = { x: void 0, y: void 0 }, t = new H();
2477
2482
  let n = !1;
2478
2483
  return {
@@ -2493,7 +2498,7 @@ const St = !1, Mo = (e) => {
2493
2498
  },
2494
2499
  $: t.asObservable()
2495
2500
  };
2496
- }, er = () => {
2501
+ }, tr = () => {
2497
2502
  let e = !1, t;
2498
2503
  const n = new H(), o = ["mouseup", "pointerup"];
2499
2504
  return {
@@ -2522,14 +2527,14 @@ const St = !1, Mo = (e) => {
2522
2527
  },
2523
2528
  $: n.asObservable()
2524
2529
  };
2525
- }, tr = (e) => typeof e == "object" && !!e && "nodeType" in e && (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE && "innerText" in e;
2526
- function nr(e, t, n) {
2530
+ }, nr = (e) => typeof e == "object" && !!e && "nodeType" in e && (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE && "innerText" in e;
2531
+ function or(e, t, n) {
2527
2532
  if ("caretPositionFromPoint" in e)
2528
2533
  return e.caretPositionFromPoint(t, n);
2529
2534
  if (typeof e.caretRangeFromPoint < "u")
2530
2535
  return e.caretRangeFromPoint(t, n);
2531
2536
  }
2532
- const or = R.measurePerformance(
2537
+ const rr = R.measurePerformance(
2533
2538
  "getFirstVisibleNodeForViewport",
2534
2539
  1,
2535
2540
  (e, t) => {
@@ -2539,10 +2544,10 @@ const or = R.measurePerformance(
2539
2544
  const s = o.createRange();
2540
2545
  return Array.from(n.childNodes).some((a) => {
2541
2546
  s.selectNodeContents(a);
2542
- const c = s.getClientRects(), u = rr(c, t);
2547
+ const c = s.getClientRects(), u = ir(c, t);
2543
2548
  if (u) {
2544
2549
  r = s.cloneRange();
2545
- const d = nr(o, Math.ceil(u.left), Math.ceil(u.top));
2550
+ const d = or(o, Math.ceil(u.left), Math.ceil(u.top));
2546
2551
  return d && "startContainer" in d && d.startContainer === r.startContainer && (i = d.startOffset), d && "offsetNode" in d && d.offsetNode === r.startContainer && (i = d.offset), !0;
2547
2552
  }
2548
2553
  return !1;
@@ -2560,13 +2565,13 @@ const or = R.measurePerformance(
2560
2565
  function sn(e, { left: t, right: n }) {
2561
2566
  return e.left <= t && e.right <= t ? "before" : e.left <= t && e.right > t && e.right <= n ? "partially-before" : e.left <= n && e.right > n ? "partially-after" : e.left > n ? "after" : "within";
2562
2567
  }
2563
- function rr(e, t) {
2568
+ function ir(e, t) {
2564
2569
  return Array.from(e).find((n) => {
2565
2570
  const o = sn(n, t);
2566
2571
  return o !== "before" && o !== "after";
2567
2572
  });
2568
2573
  }
2569
- const ir = (e, t) => {
2574
+ const sr = (e, t) => {
2570
2575
  var n;
2571
2576
  if (e.nodeType !== Node.CDATA_SECTION_NODE && e.nodeType !== Node.DOCUMENT_TYPE_NODE) {
2572
2577
  const o = (n = e.ownerDocument) == null ? void 0 : n.createRange();
@@ -2606,7 +2611,7 @@ const ir = (e, t) => {
2606
2611
  return e instanceof s.MouseEvent;
2607
2612
  }
2608
2613
  return !1;
2609
- }, sr = (e) => {
2614
+ }, ar = (e) => {
2610
2615
  var t, n, o, r, i;
2611
2616
  if (e != null && e.target && ((n = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && n.defaultView)) {
2612
2617
  const s = (r = (o = e == null ? void 0 : e.target) == null ? void 0 : o.ownerDocument) == null ? void 0 : r.defaultView;
@@ -2619,7 +2624,7 @@ const ir = (e, t) => {
2619
2624
  return e instanceof s.TouchEvent;
2620
2625
  }
2621
2626
  return !1;
2622
- }, ar = [
2627
+ }, cr = [
2623
2628
  "pointercancel",
2624
2629
  "pointerdown",
2625
2630
  "pointerenter",
@@ -2628,7 +2633,7 @@ const ir = (e, t) => {
2628
2633
  "pointerout",
2629
2634
  "pointerover",
2630
2635
  "pointerup"
2631
- ], cr = [
2636
+ ], ur = [
2632
2637
  "mousedown",
2633
2638
  "mouseup",
2634
2639
  "mouseenter",
@@ -2636,7 +2641,7 @@ const ir = (e, t) => {
2636
2641
  "mousemove",
2637
2642
  "mouseout",
2638
2643
  "mouseover"
2639
- ], ur = [...ar, ...cr], cn = ({
2644
+ ], lr = [...cr, ...ur], cn = ({
2640
2645
  item: e,
2641
2646
  context: t,
2642
2647
  parentElement: n,
@@ -2645,7 +2650,7 @@ const ir = (e, t) => {
2645
2650
  viewportState$: i
2646
2651
  }) => {
2647
2652
  var _;
2648
- const s = new H(), a = lr(n, e, r), c = dr(n, e), u = Qo(), d = er(), l = fr(o, u, d), f = Ko({
2653
+ const s = new H(), a = dr(n, e, r), c = fr(n, e), u = er(), d = tr(), l = gr(o, u, d), f = Qo({
2649
2654
  parent: a,
2650
2655
  item: e,
2651
2656
  context: t,
@@ -2667,7 +2672,7 @@ const ir = (e, t) => {
2667
2672
  }, v = () => {
2668
2673
  var F;
2669
2674
  return !!((F = e.mediaType) != null && F.startsWith("image/"));
2670
- }, S = (F) => {
2675
+ }, w = (F) => {
2671
2676
  var D, V;
2672
2677
  (D = f.getManipulableFrame()) == null || D.removeStyle("prose-reader-css"), (V = f.getManipulableFrame()) == null || V.addStyle("prose-reader-css", F);
2673
2678
  }, p = ({ right: F, left: D, top: V }) => {
@@ -2679,7 +2684,7 @@ const ir = (e, t) => {
2679
2684
  const M = F / V.width;
2680
2685
  return { computedScale: Math.min(M, D / V.height), computedWidthScale: M, viewportDimensions: V };
2681
2686
  }
2682
- }, N = () => f.load(), $ = () => f.unload(), w = (F) => {
2687
+ }, N = () => f.load(), I = () => f.unload(), S = (F) => {
2683
2688
  var V, P, L, M, z;
2684
2689
  const D = (V = f.getManipulableFrame()) == null ? void 0 : V.frame;
2685
2690
  if (D && F)
@@ -2708,7 +2713,7 @@ const ir = (e, t) => {
2708
2713
  a.style.width = `${D}px`, a.style.height = `${F}px`, r.getValue().forEach((L) => {
2709
2714
  L.name === "item.onAfterLayout" && L.fn({ blankPagePosition: V, item: e, minimumWidth: P });
2710
2715
  }), m();
2711
- }, I = (F) => {
2716
+ }, $ = (F) => {
2712
2717
  var z, Y;
2713
2718
  const { left: D = 0, top: V = 0 } = ((z = f.getFrameElement()) == null ? void 0 : z.getBoundingClientRect()) || {}, P = ((Y = C()) == null ? void 0 : Y.computedScale) ?? 1, L = F.clientX * P + D, M = F.clientY * P + V;
2714
2719
  return {
@@ -2760,14 +2765,14 @@ const ir = (e, t) => {
2760
2765
  getElementDimensions: y,
2761
2766
  getHtmlFromResource: f.getHtmlFromResource,
2762
2767
  getResource: T,
2763
- translateFramePositionIntoPage: I,
2768
+ translateFramePositionIntoPage: $,
2764
2769
  setLayoutDirty: m,
2765
- injectStyle: S,
2770
+ injectStyle: w,
2766
2771
  loadContent: N,
2767
- unloadContent: $,
2772
+ unloadContent: I,
2768
2773
  spineItemFrame: f,
2769
2774
  element: a,
2770
- getBoundingRectOfElementFromSelector: w,
2775
+ getBoundingRectOfElementFromSelector: S,
2771
2776
  getViewPortInformation: C,
2772
2777
  isImageType: v,
2773
2778
  isReady: f.getIsReady,
@@ -2791,13 +2796,13 @@ const ir = (e, t) => {
2791
2796
  isReady$: f.$.isReady$
2792
2797
  }
2793
2798
  };
2794
- }, lr = (e, t, n) => {
2799
+ }, dr = (e, t, n) => {
2795
2800
  const o = e.ownerDocument.createElement("div");
2796
2801
  return o.classList.add("spineItem"), o.classList.add(`spineItem-${t.renditionLayout}`), o.style.cssText = `
2797
2802
  position: absolute;
2798
2803
  overflow: hidden;
2799
2804
  `, n.getValue().reduce((r, i) => i.name === "item.onBeforeContainerCreated" ? i.fn(r) : r, o);
2800
- }, dr = (e, t) => {
2805
+ }, fr = (e, t) => {
2801
2806
  const n = e.ownerDocument.createElement("div");
2802
2807
  return n.classList.add("spineItemOverlay"), n.classList.add(`spineItemOverlay-${t.renditionLayout}`), n.style.cssText = `
2803
2808
  position: absolute;
@@ -2806,11 +2811,11 @@ const ir = (e, t) => {
2806
2811
  pointer-events: none;
2807
2812
  background-color: transparent;
2808
2813
  `, n;
2809
- }, fr = (e, t, n) => [
2814
+ }, gr = (e, t, n) => [
2810
2815
  {
2811
2816
  name: "item.onLoad",
2812
2817
  fn: ({ frame: o }) => {
2813
- const r = ur.map((i) => {
2818
+ const r = lr.map((i) => {
2814
2819
  var a;
2815
2820
  const s = (c) => {
2816
2821
  let u = c;
@@ -2831,7 +2836,7 @@ const ir = (e, t) => {
2831
2836
  margin: 0;
2832
2837
  }
2833
2838
  }
2834
- `, gr = ({
2839
+ `, pr = ({
2835
2840
  item: e,
2836
2841
  context: t,
2837
2842
  containerElement: n,
@@ -2855,9 +2860,9 @@ const ir = (e, t) => {
2855
2860
  spreadPosition: l
2856
2861
  }) => {
2857
2862
  var C;
2858
- const { width: f, height: g } = t.getPageSize(), { viewportDimensions: y, computedScale: v = 1 } = s.getViewPortInformation() ?? {}, S = t.getVisibleAreaRect(), p = (C = a.getManipulableFrame()) == null ? void 0 : C.frame;
2863
+ const { width: f, height: g } = t.getPageSize(), { viewportDimensions: y, computedScale: v = 1 } = s.getViewPortInformation() ?? {}, w = t.getVisibleAreaRect(), p = (C = a.getManipulableFrame()) == null ? void 0 : C.frame;
2859
2864
  if (a != null && a.getIsLoaded() && (p != null && p.contentDocument) && (p != null && p.contentWindow)) {
2860
- const N = f, $ = S.height + t.getCalculatedInnerMargin(), w = pr(
2865
+ const N = f, I = w.height + t.getCalculatedInnerMargin(), S = hr(
2861
2866
  {
2862
2867
  ...s.getDimensionsForPaginatedContent(),
2863
2868
  enableTouch: t.getSettings().computedPageTurnMode !== "scrollable",
@@ -2866,7 +2871,7 @@ const ir = (e, t) => {
2866
2871
  y
2867
2872
  );
2868
2873
  if (p == null || p.style.setProperty("visibility", "visible"), p == null || p.style.setProperty("opacity", "1"), y) {
2869
- s.injectStyle(w), a.staticLayout({
2874
+ s.injectStyle(S), a.staticLayout({
2870
2875
  width: y.width,
2871
2876
  height: y.height
2872
2877
  }), p == null || p.style.setProperty("position", "absolute"), p == null || p.style.setProperty("top", "50%"), l === "left" ? (p == null || p.style.setProperty("right", "0"), p == null || p.style.removeProperty("left")) : u === "before" && t.isRTL() ? (p == null || p.style.setProperty("right", "50%"), p == null || p.style.removeProperty("left")) : l === "right" ? (p == null || p.style.setProperty("left", "0"), p == null || p.style.removeProperty("right")) : (p == null || p.style.setProperty(
@@ -2876,17 +2881,17 @@ const ir = (e, t) => {
2876
2881
  const m = l !== "none" ? "0" : "-50%", h = l === "right" && u !== "before" ? "left" : l === "left" || u === "before" && t.isRTL() ? "right" : "center";
2877
2882
  p == null || p.style.setProperty("transform", `translate(${m}, -50%) scale(${v})`), p == null || p.style.setProperty("transform-origin", `${h} center`), s.executeOnLayoutBeforeMeasurementHook({ minimumWidth: d });
2878
2883
  } else
2879
- s.injectStyle(w), a.staticLayout({
2884
+ s.injectStyle(S), a.staticLayout({
2880
2885
  width: N,
2881
- height: $
2886
+ height: I
2882
2887
  }), u === "before" ? t.isRTL() ? p == null || p.style.setProperty("margin-right", `${f}px`) : p == null || p.style.setProperty("margin-left", `${f}px`) : (p == null || p.style.removeProperty("margin-left"), p == null || p.style.removeProperty("margin-right"));
2883
- return s.executeOnLayoutBeforeMeasurementHook({ minimumWidth: d }), s.layout({ width: d, height: $, blankPagePosition: u, minimumWidth: d }), { width: d, height: $ };
2888
+ return s.executeOnLayoutBeforeMeasurementHook({ minimumWidth: d }), s.layout({ width: d, height: I, blankPagePosition: u, minimumWidth: d }), { width: d, height: I };
2884
2889
  } else
2885
2890
  s.executeOnLayoutBeforeMeasurementHook({ minimumWidth: d }), s.layout({ width: d, height: g, blankPagePosition: u, minimumWidth: d });
2886
2891
  return { width: d, height: g };
2887
2892
  }
2888
2893
  };
2889
- }, pr = ({
2894
+ }, hr = ({
2890
2895
  columnWidth: e,
2891
2896
  enableTouch: t,
2892
2897
  spreadPosition: n
@@ -2931,7 +2936,7 @@ const ir = (e, t) => {
2931
2936
  object-fit:contain;
2932
2937
  `}
2933
2938
  }
2934
- `, hr = ({
2939
+ `, mr = ({
2935
2940
  item: e,
2936
2941
  context: t,
2937
2942
  containerElement: n,
@@ -2954,14 +2959,14 @@ const ir = (e, t) => {
2954
2959
  blankPagePosition: d,
2955
2960
  minimumWidth: l
2956
2961
  }) => {
2957
- var $, w, m, h, b, x, I, T;
2962
+ var I, S, m, h, b, x, $, T;
2958
2963
  const { width: f, height: g } = t.getPageSize();
2959
- (w = ($ = a.getManipulableFrame()) == null ? void 0 : $.frame) == null || w.style.setProperty("width", `${f}px`), (h = (m = a.getManipulableFrame()) == null ? void 0 : m.frame) == null || h.style.setProperty("height", `${g}px`);
2960
- const { viewportDimensions: y, computedScale: v = 1 } = s.getViewPortInformation() ?? {}, S = t.getVisibleAreaRect(), p = (b = a.getManipulableFrame()) == null ? void 0 : b.frame, C = ((x = t.getManifest()) == null ? void 0 : x.renditionLayout) === "pre-paginated";
2964
+ (S = (I = a.getManipulableFrame()) == null ? void 0 : I.frame) == null || S.style.setProperty("width", `${f}px`), (h = (m = a.getManipulableFrame()) == null ? void 0 : m.frame) == null || h.style.setProperty("height", `${g}px`);
2965
+ const { viewportDimensions: y, computedScale: v = 1 } = s.getViewPortInformation() ?? {}, w = t.getVisibleAreaRect(), p = (b = a.getManipulableFrame()) == null ? void 0 : b.frame, C = ((x = t.getManifest()) == null ? void 0 : x.renditionLayout) === "pre-paginated";
2961
2966
  if (a != null && a.getIsLoaded() && (p != null && p.contentDocument) && (p != null && p.contentWindow)) {
2962
- let A = f, E = S.height + t.getCalculatedInnerMargin();
2967
+ let A = f, E = w.height + t.getCalculatedInnerMargin();
2963
2968
  if (p == null || p.style.setProperty("visibility", "visible"), p == null || p.style.setProperty("opacity", "1"), y)
2964
- s.injectStyle(mr()), s.executeOnLayoutBeforeMeasurementHook({ minimumWidth: l }), a.staticLayout({
2969
+ s.injectStyle(yr()), s.executeOnLayoutBeforeMeasurementHook({ minimumWidth: l }), a.staticLayout({
2965
2970
  width: y.width,
2966
2971
  height: y.height
2967
2972
  }), p == null || p.style.setProperty("position", "absolute"), p == null || p.style.setProperty("top", "50%"), p == null || p.style.setProperty(
@@ -2969,10 +2974,10 @@ const ir = (e, t) => {
2969
2974
  d === "before" ? t.isRTL() ? "25%" : "75%" : d === "after" ? t.isRTL() ? "75%" : "25%" : "50%"
2970
2975
  ), p == null || p.style.setProperty("transform", `translate(-50%, -50%) scale(${v})`), p == null || p.style.setProperty("transform-origin", "center center");
2971
2976
  else {
2972
- const _ = s.isImageType() ? yr({
2973
- isScrollable: ((I = t.getManifest()) == null ? void 0 : I.renditionFlow) === "scrolled-continuous",
2977
+ const _ = s.isImageType() ? vr({
2978
+ isScrollable: (($ = t.getManifest()) == null ? void 0 : $.renditionFlow) === "scrolled-continuous",
2974
2979
  enableTouch: t.getSettings().computedPageTurnMode !== "scrollable"
2975
- }) : vr(
2980
+ }) : br(
2976
2981
  s.getDimensionsForReflowableContent(a.isUsingVerticalWriting(), l)
2977
2982
  );
2978
2983
  if (s.injectStyle(_), s.executeOnLayoutBeforeMeasurementHook({ minimumWidth: l }), a.isUsingVerticalWriting())
@@ -3000,7 +3005,7 @@ const ir = (e, t) => {
3000
3005
  return s.layout({ width: l, height: N, blankPagePosition: d, minimumWidth: l }), { width: l, height: N };
3001
3006
  }
3002
3007
  };
3003
- }, mr = () => `
3008
+ }, yr = () => `
3004
3009
  ${un()}
3005
3010
  html {
3006
3011
  width: 100%;
@@ -3015,7 +3020,7 @@ const ir = (e, t) => {
3015
3020
  html, body {
3016
3021
  touch-action: none;
3017
3022
  }
3018
- `, yr = ({ isScrollable: e, enableTouch: t }) => `
3023
+ `, vr = ({ isScrollable: e, enableTouch: t }) => `
3019
3024
 
3020
3025
  html, body {
3021
3026
  width: 100%;
@@ -3037,7 +3042,7 @@ const ir = (e, t) => {
3037
3042
  display: block;
3038
3043
  }
3039
3044
  ` : ""}
3040
- `, vr = ({
3045
+ `, br = ({
3041
3046
  width: e,
3042
3047
  columnHeight: t,
3043
3048
  columnWidth: n
@@ -3105,21 +3110,21 @@ const ir = (e, t) => {
3105
3110
  td {
3106
3111
  max-width: ${n}px;
3107
3112
  }
3108
- `, br = ({
3113
+ `, wr = ({
3109
3114
  item: e,
3110
3115
  context: t,
3111
3116
  containerElement: n,
3112
3117
  iframeEventBridgeElement: o,
3113
3118
  hooks$: r,
3114
3119
  viewportState$: i
3115
- }) => e.renditionLayout === "pre-paginated" ? gr({
3120
+ }) => e.renditionLayout === "pre-paginated" ? pr({
3116
3121
  item: e,
3117
3122
  context: t,
3118
3123
  containerElement: n,
3119
3124
  iframeEventBridgeElement: o,
3120
3125
  hooks$: r,
3121
3126
  viewportState$: i
3122
- }) : hr({
3127
+ }) : mr({
3123
3128
  item: e,
3124
3129
  context: t,
3125
3130
  containerElement: n,
@@ -3154,7 +3159,7 @@ const ir = (e, t) => {
3154
3159
  });
3155
3160
  return Object.defineProperty(l, "target", { value: i.target, enumerable: !0 }), l;
3156
3161
  }
3157
- if (sr(o)) {
3162
+ if (ar(o)) {
3158
3163
  const u = Array.from(o.touches).map((l) => {
3159
3164
  const { clientX: f, clientY: g } = a.translateFramePositionIntoPage(l);
3160
3165
  return new Touch({
@@ -3173,10 +3178,10 @@ const ir = (e, t) => {
3173
3178
  return o;
3174
3179
  }
3175
3180
  }), Qe = Node.ELEMENT_NODE, et = Node.TEXT_NODE, tt = Node.CDATA_SECTION_NODE;
3176
- function wr(e) {
3181
+ function Pr(e) {
3177
3182
  return e.replace(/[\[\]\^,();]/g, "^$&");
3178
3183
  }
3179
- function Pr(e, t, n) {
3184
+ function Ir(e, t, n) {
3180
3185
  n = n || 0;
3181
3186
  const o = [];
3182
3187
  let r = 0, i;
@@ -3193,7 +3198,7 @@ function $r(e, t) {
3193
3198
  i = Math.abs(e[r] - t), (!r || i < n) && (i = n, o = e[r]);
3194
3199
  return o;
3195
3200
  }
3196
- function Ir(e, t, n) {
3201
+ function xr(e, t, n) {
3197
3202
  let o = 0, r, i = 0, s = !0, a, c;
3198
3203
  for (a = 0; a < e.length; a++)
3199
3204
  if (c = e[a], c.nodeType === Qe) {
@@ -3208,11 +3213,11 @@ function Ir(e, t, n) {
3208
3213
  continue;
3209
3214
  throw new Error("The specified node was not found in the array of siblings");
3210
3215
  }
3211
- function xr(e, t) {
3216
+ function Tr(e, t) {
3212
3217
  const n = typeof e == "number", o = typeof t == "number";
3213
3218
  return !n && !o ? 0 : !n && o ? -1 : n && !o ? 1 : (e || 0) - (t || 0);
3214
3219
  }
3215
- function Tr(e, t) {
3220
+ function Cr(e, t) {
3216
3221
  if (!e && !t)
3217
3222
  return 0;
3218
3223
  if (!e && t)
@@ -3265,7 +3270,7 @@ class be {
3265
3270
  static generatePart(t, n, o) {
3266
3271
  let r = "", i;
3267
3272
  for (; t.parentNode; )
3268
- i = Ir(t.parentNode.childNodes, t, n), !r && i.offset && (r = ":" + i.offset), r = "/" + i.count + (t.id ? "[" + wr(t.id) + "]" : "") + r, t = t.parentNode;
3273
+ i = xr(t.parentNode.childNodes, t, n), !r && i.offset && (r = ":" + i.offset), r = "/" + i.count + (t.id ? "[" + Pr(t.id) + "]" : "") + r, t = t.parentNode;
3269
3274
  return r;
3270
3275
  }
3271
3276
  static generate(t, n, o) {
@@ -3321,7 +3326,7 @@ class be {
3321
3326
  return a;
3322
3327
  if (i.nodeIndex === 0)
3323
3328
  return 0;
3324
- if (!(r < o - 1) && (i.nodeIndex % 2 === 0 && (a = xr(i.temporal, s.temporal), a || (a = Tr(i.spatial, s.spatial), a)) || (a = (i.offset || 0) - (s.offset || 0), a)))
3329
+ if (!(r < o - 1) && (i.nodeIndex % 2 === 0 && (a = Tr(i.temporal, s.temporal), a || (a = Cr(i.spatial, s.spatial), a)) || (a = (i.offset || 0) - (s.offset || 0), a)))
3325
3330
  return a;
3326
3331
  }
3327
3332
  return 0;
@@ -3513,7 +3518,7 @@ class be {
3513
3518
  let d = "", l = 0;
3514
3519
  for (; this.isTextNode(i) && (c = this.decodeEntities(t, i.textContent), u[l] = c.length, d += c, !!i.nextSibling); )
3515
3520
  i = i.nextSibling, l++;
3516
- const f = r.pre ? r.pre.length : 0, g = Pr(d, new RegExp(s), f);
3521
+ const f = r.pre ? r.pre.length : 0, g = Ir(d, new RegExp(s), f);
3517
3522
  if (!g.length)
3518
3523
  return { node: n, offset: o };
3519
3524
  let y = $r(g, o);
@@ -3635,7 +3640,7 @@ const Xe = (e) => {
3635
3640
  itemId: t && decodeURIComponent(t),
3636
3641
  offset: isNaN(r) ? void 0 : r
3637
3642
  };
3638
- }, Cr = (e, t) => {
3643
+ }, Fr = (e, t) => {
3639
3644
  const n = e.toString();
3640
3645
  return {
3641
3646
  toString: () => n,
@@ -3648,7 +3653,7 @@ const Xe = (e) => {
3648
3653
  return be.generate(e.focusNode, e.focusOffset, `|[prose~anchor~${encodeURIComponent(t.id)}]`);
3649
3654
  }
3650
3655
  };
3651
- }, Ae = R.namespace("spine"), Fr = ({
3656
+ }, Ae = R.namespace("spine"), Er = ({
3652
3657
  ownerDocument: e,
3653
3658
  context: t,
3654
3659
  pagination: n,
@@ -3663,7 +3668,7 @@ const Xe = (e) => {
3663
3668
  currentNavigationPosition$: l,
3664
3669
  viewportState$: f
3665
3670
  }) => {
3666
- const g = new H(), y = new H(), v = new H(), S = Er(e, i), p = Sr({
3671
+ const g = new H(), y = new H(), v = new H(), w = Ar(e, i), p = Sr({
3667
3672
  context: t,
3668
3673
  spineItemManager: r,
3669
3674
  iframeEventBridgeElement: o,
@@ -3672,10 +3677,10 @@ const Xe = (e) => {
3672
3677
  let C;
3673
3678
  const N = () => {
3674
3679
  var x;
3675
- y.next(), r.destroyItems(), (x = t.getManifest()) == null || x.spineItems.map(async (I) => {
3676
- const T = br({
3677
- item: I,
3678
- containerElement: S,
3680
+ y.next(), r.destroyItems(), (x = t.getManifest()) == null || x.spineItems.map(async ($) => {
3681
+ const T = wr({
3682
+ item: $,
3683
+ containerElement: w,
3679
3684
  iframeEventBridgeElement: o,
3680
3685
  context: t,
3681
3686
  hooks$: i,
@@ -3683,14 +3688,14 @@ const Xe = (e) => {
3683
3688
  });
3684
3689
  r.add(T);
3685
3690
  }), g.next(r.getAll());
3686
- }, $ = (x) => {
3687
- let I = !1;
3691
+ }, I = (x) => {
3692
+ let $ = !1;
3688
3693
  r.getAll().forEach((T, A) => {
3689
- I = T.manipulateSpineItem((E) => x({ index: A, ...E })) || I;
3690
- }), I && r.layout();
3691
- }, w = (x, I) => {
3694
+ $ = T.manipulateSpineItem((E) => x({ index: A, ...E })) || $;
3695
+ }), $ && r.layout();
3696
+ }, S = (x, $) => {
3692
3697
  var T;
3693
- (T = r.get(x)) == null || T.manipulateSpineItem(I);
3698
+ (T = r.get(x)) == null || T.manipulateSpineItem($);
3694
3699
  };
3695
3700
  t.$.load$.pipe(U(N), j(t.$.destroy$)).subscribe();
3696
3701
  const m = f.pipe(
@@ -3702,13 +3707,13 @@ const Xe = (e) => {
3702
3707
  "adjustPagination",
3703
3708
  1,
3704
3709
  () => {
3705
- const I = a.getSpineItemsFromReadingOrderPosition(x), T = I ? r.get(I.begin) : void 0, A = I ? r.get(I.end) : void 0, E = n.getInfo().beginCfi, O = n.getInfo().endCfi, _ = n.getInfo().beginSpineItemIndex !== (I == null ? void 0 : I.begin) || E === void 0 || (E == null ? void 0 : E.startsWith("epubcfi(/0")), F = n.getInfo().endSpineItemIndex !== (I == null ? void 0 : I.end) || O === void 0 || (O == null ? void 0 : O.startsWith("epubcfi(/0"));
3706
- if (T && A && I) {
3710
+ const $ = a.getSpineItemsFromReadingOrderPosition(x), T = $ ? r.get($.begin) : void 0, A = $ ? r.get($.end) : void 0, E = n.getInfo().beginCfi, O = n.getInfo().endCfi, _ = n.getInfo().beginSpineItemIndex !== ($ == null ? void 0 : $.begin) || E === void 0 || (E == null ? void 0 : E.startsWith("epubcfi(/0")), F = n.getInfo().endSpineItemIndex !== ($ == null ? void 0 : $.end) || O === void 0 || (O == null ? void 0 : O.startsWith("epubcfi(/0"));
3711
+ if (T && A && $) {
3707
3712
  const D = a.getSpineItemPositionFromSpinePosition(
3708
- I.beginPosition,
3713
+ $.beginPosition,
3709
3714
  T
3710
3715
  ), V = s.getSpineItemPageIndexFromPosition(D, T), P = a.getSpineItemPositionFromSpinePosition(
3711
- I.endPosition,
3716
+ $.endPosition,
3712
3717
  A
3713
3718
  ), L = s.getSpineItemPageIndexFromPosition(P, A);
3714
3719
  n.updateBeginAndEnd(
@@ -3740,14 +3745,14 @@ const Xe = (e) => {
3740
3745
  X(
3741
3746
  r.$.focus$.pipe(
3742
3747
  U((x) => {
3743
- const I = x.data, T = I.fingerTracker.$, A = I.selectionTracker.$;
3748
+ const $ = x.data, T = $.fingerTracker.$, A = $.selectionTracker.$;
3744
3749
  C == null || C.unsubscribe(), C = X(
3745
3750
  A.pipe(
3746
3751
  B((E) => E.event === "selectionchange"),
3747
3752
  U((E) => {
3748
3753
  v.next({
3749
3754
  type: "onSelectionChange",
3750
- data: E.data ? Cr(E.data, I.item) : null
3755
+ data: E.data ? Fr(E.data, $.item) : null
3751
3756
  });
3752
3757
  })
3753
3758
  ),
@@ -3777,7 +3782,7 @@ const Xe = (e) => {
3777
3782
  ).subscribe();
3778
3783
  const b = u.pipe(
3779
3784
  U((x) => {
3780
- const I = Ae.time("navigation", 1), T = r.getFocusedSpineItem(), A = a.getSpineItemsFromReadingOrderPosition(x.position);
3785
+ const $ = Ae.time("navigation", 1), T = r.getFocusedSpineItem(), A = a.getSpineItemsFromReadingOrderPosition(x.position);
3781
3786
  let E = A ? r.get(A.begin) : void 0, O = A ? r.get(A.end) : void 0;
3782
3787
  E = E || T, O = O || T;
3783
3788
  const _ = x.position.spineItem || E;
@@ -3817,7 +3822,7 @@ const Xe = (e) => {
3817
3822
  spineItemsFromPosition: A
3818
3823
  });
3819
3824
  }
3820
- I();
3825
+ $();
3821
3826
  }),
3822
3827
  oe(),
3823
3828
  j(t.$.destroy$)
@@ -3832,25 +3837,25 @@ const Xe = (e) => {
3832
3837
  W(() => m.pipe(
3833
3838
  re(l),
3834
3839
  k(([, x]) => {
3835
- const I = r.getFocusedSpineItemIndex();
3836
- if (Ae.log("update contents", { focusedSpineItemIndex: I }), I === void 0)
3840
+ const $ = r.getFocusedSpineItemIndex();
3841
+ if (Ae.log("update contents", { focusedSpineItemIndex: $ }), $ === void 0)
3837
3842
  return;
3838
- const { begin: T = I, end: A = I } = a.getSpineItemsFromReadingOrderPosition(x) || {};
3839
- T !== I && A !== I ? (R.warn("Current viewport is not in sync with focus item, load from focus item rather than viewport"), r.loadContents([I, I])) : r.loadContents([T, A]);
3843
+ const { begin: T = $, end: A = $ } = a.getSpineItemsFromReadingOrderPosition(x) || {};
3844
+ T !== $ && A !== $ ? (R.warn("Current viewport is not in sync with focus item, load from focus item rather than viewport"), r.loadContents([$, $])) : r.loadContents([T, A]);
3840
3845
  }),
3841
3846
  ye(1)
3842
3847
  )),
3843
3848
  j(t.$.destroy$)
3844
3849
  ).subscribe(), {
3845
- element: S,
3850
+ element: w,
3846
3851
  locator: a,
3847
3852
  spineItemLocator: s,
3848
3853
  cfiLocator: c,
3849
3854
  normalizeEventForViewport: p.normalizeEventForViewport,
3850
- manipulateSpineItems: $,
3851
- manipulateSpineItem: w,
3855
+ manipulateSpineItems: I,
3856
+ manipulateSpineItem: S,
3852
3857
  destroy: () => {
3853
- g.complete(), y.next(), y.complete(), v.complete(), r.destroy(), C == null || C.unsubscribe(), S.remove();
3858
+ g.complete(), y.next(), y.complete(), v.complete(), r.destroy(), C == null || C.unsubscribe(), w.remove();
3854
3859
  },
3855
3860
  adjustPagination: h,
3856
3861
  isSelecting: () => {
@@ -3868,28 +3873,28 @@ const Xe = (e) => {
3868
3873
  itemsBeforeDestroy$: y.asObservable()
3869
3874
  }
3870
3875
  };
3871
- }, Er = (e, t) => {
3876
+ }, Ar = (e, t) => {
3872
3877
  const n = e.createElement("div");
3873
3878
  return n.style.cssText = `
3874
3879
  height: 100%;
3875
3880
  position: relative;
3876
3881
  `, n.className = `${Ve}-spine`, t.getValue().reduce((o, r) => r.name === "spine.onBeforeContainerCreated" ? r.fn(o) : o, n);
3877
- }, Ar = (e) => {
3882
+ }, Nr = (e) => {
3878
3883
  var n;
3879
3884
  const t = (n = e.guide) == null ? void 0 : n.find((o) => o.type === "cover");
3880
3885
  return e.spineItems.findIndex((o) => t != null && t.href ? o.href.endsWith(t.href) : !1);
3881
- }, Nr = "spineItemManager", Or = ({ context: e }) => {
3886
+ }, Or = "spineItemManager", Rr = ({ context: e }) => {
3882
3887
  const t = new H(), n = new H();
3883
3888
  let o = [];
3884
3889
  const r = new q([]);
3885
3890
  let i;
3886
3891
  const s = () => {
3887
- const w = e.getManifest(), m = [], h = (w == null ? void 0 : w.renditionLayout) === "pre-paginated", b = w ? Ar(w) : void 0;
3892
+ const S = e.getManifest(), m = [], h = (S == null ? void 0 : S.renditionLayout) === "pre-paginated", b = S ? Nr(S) : void 0;
3888
3893
  r.value.reduce(
3889
- (I, T, A) => {
3894
+ ($, T, A) => {
3890
3895
  const E = b === A;
3891
3896
  let O = e.getPageSize().width, _ = "none";
3892
- const F = I.edgeX % e.getVisibleAreaRect().width === 0, D = A === r.value.length - 1;
3897
+ const F = $.edgeX % e.getVisibleAreaRect().width === 0, D = A === r.value.length - 1;
3893
3898
  if (e.shouldDisplaySpread()) {
3894
3899
  !h && T.item.renditionLayout === "reflowable" && !D && (O = e.getPageSize().width * 2), !h && T.item.renditionLayout === "reflowable" && D && F && (O = e.getPageSize().width * 2);
3895
3900
  const M = F && D && h;
@@ -3901,7 +3906,7 @@ const Xe = (e) => {
3901
3906
  spreadPosition: e.shouldDisplaySpread() ? F ? e.isRTL() ? "right" : "left" : e.isRTL() ? "left" : "right" : "none"
3902
3907
  });
3903
3908
  if (e.getSettings().computedPageTurnDirection === "vertical") {
3904
- const M = F ? I.edgeY : I.edgeY - e.getVisibleAreaRect().height, z = F ? 0 : I.edgeX;
3909
+ const M = F ? $.edgeY : $.edgeY - e.getVisibleAreaRect().height, z = F ? 0 : $.edgeX;
3905
3910
  e.isRTL() ? T.adjustPositionOfElement({
3906
3911
  top: M,
3907
3912
  left: z
@@ -3922,12 +3927,12 @@ const Xe = (e) => {
3922
3927
  edgeY: de
3923
3928
  };
3924
3929
  }
3925
- e.isRTL() ? T.adjustPositionOfElement({ right: I.edgeX, top: 0 }) : T.adjustPositionOfElement({ left: I.edgeX, top: 0 });
3926
- const L = V + I.edgeX;
3930
+ e.isRTL() ? T.adjustPositionOfElement({ right: $.edgeX, top: 0 }) : T.adjustPositionOfElement({ left: $.edgeX, top: 0 });
3931
+ const L = V + $.edgeX;
3927
3932
  return m.push({
3928
- leftStart: I.edgeX,
3933
+ leftStart: $.edgeX,
3929
3934
  leftEnd: L,
3930
- topStart: I.edgeY,
3935
+ topStart: $.edgeY,
3931
3936
  topEnd: P,
3932
3937
  height: P,
3933
3938
  width: V
@@ -3938,27 +3943,27 @@ const Xe = (e) => {
3938
3943
  },
3939
3944
  { edgeX: 0, edgeY: 0 }
3940
3945
  );
3941
- const x = o.some((I, T) => !ce(I, m[T]));
3942
- o = m, R.log(Nr, "layout", { hasLayoutChanges: x, itemLayoutInformation: o }), n.next(x);
3943
- }, a = (w) => {
3944
- const m = typeof w == "number" ? u(w) : w;
3946
+ const x = o.some(($, T) => !ce($, m[T]));
3947
+ o = m, R.log(Or, "layout", { hasLayoutChanges: x, itemLayoutInformation: o }), n.next(x);
3948
+ }, a = (S) => {
3949
+ const m = typeof S == "number" ? u(S) : S;
3945
3950
  if (!m)
3946
3951
  return;
3947
3952
  const h = r.value.indexOf(m);
3948
3953
  h !== i && (i = h, t.next({ data: m }));
3949
- }, c = R.measurePerformance("loadContents", 10, (w) => {
3954
+ }, c = R.measurePerformance("loadContents", 10, (S) => {
3950
3955
  var T;
3951
- const [m, h] = w, b = e.getSettings().numberOfAdjacentSpineItemToPreLoad, x = ((T = e.getManifest()) == null ? void 0 : T.renditionLayout) === "pre-paginated", I = e.getSettings().computedPageTurnMode === "scrollable";
3956
+ const [m, h] = S, b = e.getSettings().numberOfAdjacentSpineItemToPreLoad, x = ((T = e.getManifest()) == null ? void 0 : T.renditionLayout) === "pre-paginated", $ = e.getSettings().computedPageTurnMode === "scrollable";
3952
3957
  r.value.forEach((A, E) => {
3953
- const O = E < m && !x && I ? !0 : E < m - b, _ = E > h + b;
3958
+ const O = E < m && !x && $ ? !0 : E < m - b, _ = E > h + b;
3954
3959
  !O && !_ ? A.loadContent() : A.unloadContent();
3955
3960
  });
3956
- }), u = (w) => typeof w == "number" ? r.value[w] : r.value.find(({ item: m }) => m.id === w), d = R.measurePerformance(
3961
+ }), u = (S) => typeof S == "number" ? r.value[S] : r.value.find(({ item: m }) => m.id === S), d = R.measurePerformance(
3957
3962
  "getAbsolutePositionOf",
3958
3963
  10,
3959
- (w) => {
3964
+ (S) => {
3960
3965
  e.getSettings().computedPageTurnDirection;
3961
- const m = typeof w == "number" ? w : r.value.indexOf(w);
3966
+ const m = typeof S == "number" ? S : r.value.indexOf(S);
3962
3967
  return o[m] ? o[m] || {
3963
3968
  leftStart: 0,
3964
3969
  leftEnd: 0,
@@ -3976,43 +3981,43 @@ const Xe = (e) => {
3976
3981
  };
3977
3982
  },
3978
3983
  { disable: !0 }
3979
- ), l = () => i !== void 0 ? r.value[i] : void 0, f = (w, m) => r.value.indexOf(w) > r.value.indexOf(m) ? "after" : "before", g = (w) => {
3980
- if (!w)
3984
+ ), l = () => i !== void 0 ? r.value[i] : void 0, f = (S, m) => r.value.indexOf(S) > r.value.indexOf(m) ? "after" : "before", g = (S) => {
3985
+ if (!S)
3981
3986
  return;
3982
- const m = r.value.indexOf(w);
3987
+ const m = r.value.indexOf(S);
3983
3988
  return m < 0 ? void 0 : m;
3984
- }, y = (w) => {
3985
- r.value.push(w), w.$.contentLayout$.pipe(j(e.$.destroy$)).subscribe(() => {
3989
+ }, y = (S) => {
3990
+ r.value.push(S), S.$.contentLayout$.pipe(j(e.$.destroy$)).subscribe(() => {
3986
3991
  s();
3987
- }), w.$.loaded$.pipe(
3992
+ }), S.$.loaded$.pipe(
3988
3993
  U(() => {
3989
- w.isUsingVerticalWriting() && e.setHasVerticalWriting();
3994
+ S.isUsingVerticalWriting() && e.setHasVerticalWriting();
3990
3995
  }),
3991
3996
  j(e.$.destroy$)
3992
- ).subscribe(), w.load();
3993
- }, v = () => r.value, S = () => r.value.length, p = () => {
3994
- const w = l();
3995
- return w && g(w);
3997
+ ).subscribe(), S.load();
3998
+ }, v = () => r.value, w = () => r.value.length, p = () => {
3999
+ const S = l();
4000
+ return S && g(S);
3996
4001
  }, C = R.measurePerformance(
3997
4002
  "getSpineItemAtPosition",
3998
4003
  10,
3999
- (w) => {
4004
+ (S) => {
4000
4005
  const m = r.value.find((h) => {
4001
- const { leftStart: b, leftEnd: x, topEnd: I, topStart: T } = d(h), A = w.x >= b && w.x < x;
4002
- return e.getSettings().computedPageTurnDirection === "horizontal" ? A : A && w.y >= T && w.y < I;
4006
+ const { leftStart: b, leftEnd: x, topEnd: $, topStart: T } = d(h), A = S.x >= b && S.x < x;
4007
+ return e.getSettings().computedPageTurnDirection === "horizontal" ? A : A && S.y >= T && S.y < $;
4003
4008
  });
4004
- return w.x === 0 && !m ? r.value[0] : m;
4009
+ return S.x === 0 && !m ? r.value[0] : m;
4005
4010
  },
4006
4011
  { disable: !0 }
4007
4012
  ), N = () => {
4008
- r.value.forEach((w) => w.destroy());
4013
+ r.value.forEach((S) => S.destroy());
4009
4014
  };
4010
4015
  return {
4011
4016
  destroyItems: N,
4012
4017
  add: y,
4013
4018
  get: u,
4014
4019
  getAll: v,
4015
- getLength: S,
4020
+ getLength: w,
4016
4021
  layout: s,
4017
4022
  focus: a,
4018
4023
  loadContents: c,
@@ -4029,8 +4034,8 @@ const Xe = (e) => {
4029
4034
  focus$: t.asObservable(),
4030
4035
  layout$: n.asObservable(),
4031
4036
  itemIsReady$: r.asObservable().pipe(
4032
- W((w) => {
4033
- const m = w.map((h) => h.$.isReady$.pipe(k((b) => ({ item: h.item, isReady: b }))));
4037
+ W((S) => {
4038
+ const m = S.map((h) => h.$.isReady$.pipe(k((b) => ({ item: h.item, isReady: b }))));
4034
4039
  return X(...m);
4035
4040
  })
4036
4041
  )
@@ -4054,13 +4059,13 @@ const Xe = (e) => {
4054
4059
  };
4055
4060
  }, n = (u, d) => {
4056
4061
  const { width: l, height: f } = d.getElementDimensions(), g = d.getReadingDirection(), y = e.getPageSize().width, v = e.getPageSize().height;
4057
- let S = Math.min(l, Math.max(0, u.x));
4058
- if (g === "rtl" && (S = l - S - e.getPageSize().width), d.isUsingVerticalWriting()) {
4062
+ let w = Math.min(l, Math.max(0, u.x));
4063
+ if (g === "rtl" && (w = l - w - e.getPageSize().width), d.isUsingVerticalWriting()) {
4059
4064
  const p = ue(f, v);
4060
4065
  return c(u.y, v, p);
4061
4066
  } else {
4062
4067
  const p = ue(l, y);
4063
- return c(S, y, p);
4068
+ return c(w, y, p);
4064
4069
  }
4065
4070
  }, o = (u, d) => {
4066
4071
  var v;
@@ -4072,8 +4077,8 @@ const Xe = (e) => {
4072
4077
  if ((u == null ? void 0 : u.nodeName) === "img" || (u == null ? void 0 : u.textContent) === "" && u.nodeType === Node.ELEMENT_NODE)
4073
4078
  f = u.getBoundingClientRect().x;
4074
4079
  else if (u) {
4075
- const S = u ? ir(u, d) : void 0;
4076
- f = (S == null ? void 0 : S.getBoundingClientRect().x) || f;
4080
+ const w = u ? sr(u, d) : void 0;
4081
+ f = (w == null ? void 0 : w.getBoundingClientRect().x) || f;
4077
4082
  }
4078
4083
  const g = ((v = l.getElementDimensions()) == null ? void 0 : v.width) || 0, y = e.getPageSize().width;
4079
4084
  if (f)
@@ -4082,13 +4087,13 @@ const Xe = (e) => {
4082
4087
  var g, y, v;
4083
4088
  const l = e.getPageSize(), f = (y = (g = d.spineItemFrame) == null ? void 0 : g.getManipulableFrame()) == null ? void 0 : y.frame;
4084
4089
  if ((v = f == null ? void 0 : f.contentWindow) != null && v.document && f.contentWindow.document.body !== null) {
4085
- const { x: S, y: p } = t(u, d), C = {
4086
- left: S,
4087
- right: S + l.width,
4090
+ const { x: w, y: p } = t(u, d), C = {
4091
+ left: w,
4092
+ right: w + l.width,
4088
4093
  top: p,
4089
4094
  bottom: p + l.height
4090
4095
  };
4091
- return or(f.contentWindow.document, C);
4096
+ return rr(f.contentWindow.document, C);
4092
4097
  }
4093
4098
  }, s = (u, d) => {
4094
4099
  const { width: l, height: f } = d.getElementDimensions();
@@ -4115,7 +4120,7 @@ const Xe = (e) => {
4115
4120
  getSpineItemClosestPositionFromUnsafePosition: s,
4116
4121
  getFirstNodeOrRangeAtPage: i
4117
4122
  };
4118
- }, Rr = ({ context: e }) => {
4123
+ }, Lr = ({ context: e }) => {
4119
4124
  const t = ln({ context: e }), n = (c, u) => {
4120
4125
  let d = {
4121
4126
  x: c.x - e.getPageSize().width,
@@ -4151,20 +4156,20 @@ const Xe = (e) => {
4151
4156
  getNavigationForPosition: (c, u) => t.getSpineItemClosestPositionFromUnsafePosition(u, c),
4152
4157
  getNavigationFromNode: (c, u, d) => t.getSpineItemPositionFromNode(u, d, c) || { x: 0, y: 0 }
4153
4158
  };
4154
- }, Pt = "spineNavigator", Lr = ({
4159
+ }, Pt = "spineNavigator", Dr = ({
4155
4160
  context: e,
4156
4161
  spineItemManager: t,
4157
4162
  cfiLocator: n,
4158
4163
  locator: o
4159
4164
  }) => {
4160
- const r = Rr({ context: e }), i = (m, h) => m.x !== h.x || m.y !== h.y, s = (m, h) => i(m, h) || !!m.spineItem && !!h.spineItem && m.spineItem !== h.spineItem, a = R.measurePerformance(
4165
+ const r = Lr({ context: e }), i = (m, h) => m.x !== h.x || m.y !== h.y, s = (m, h) => i(m, h) || !!m.spineItem && !!h.spineItem && m.spineItem !== h.spineItem, a = R.measurePerformance(
4161
4166
  `${Pt} wrapPositionWithSafeEdge`,
4162
4167
  1,
4163
4168
  (m) => {
4164
- const h = t.get(t.getLength() - 1), b = t.getAbsolutePositionOf(h || 0), x = b.leftEnd - e.getPageSize().width, I = b.topEnd - e.getPageSize().height;
4169
+ const h = t.get(t.getLength() - 1), b = t.getAbsolutePositionOf(h || 0), x = b.leftEnd - e.getPageSize().width, $ = b.topEnd - e.getPageSize().height;
4165
4170
  return {
4166
4171
  x: Math.min(Math.max(0, m.x), x),
4167
- y: Math.min(Math.max(0, m.y), I)
4172
+ y: Math.min(Math.max(0, m.y), $)
4168
4173
  };
4169
4174
  },
4170
4175
  { disable: !0 }
@@ -4173,14 +4178,14 @@ const Xe = (e) => {
4173
4178
  if (!h)
4174
4179
  R.warn(Pt, `unable to detect item id from cfi ${m}`);
4175
4180
  else {
4176
- const I = b ? r.getNavigationFromNode(h, b, x) : { x: 0, y: 0 }, T = o.getSpinePositionFromSpineItemPosition(I, h);
4181
+ const $ = b ? r.getNavigationFromNode(h, b, x) : { x: 0, y: 0 }, T = o.getSpinePositionFromSpineItemPosition($, h);
4177
4182
  return { ...c(T), spineItem: h };
4178
4183
  }
4179
4184
  return { x: 0, y: 0 };
4180
4185
  }, d = (m, h) => {
4181
4186
  if (!h) {
4182
- const I = m * e.getPageSize().width;
4183
- return N({ x: I, y: 0 });
4187
+ const $ = m * e.getPageSize().width;
4188
+ return N({ x: $, y: 0 });
4184
4189
  }
4185
4190
  const b = r.getNavigationForPage(m, h), x = o.getSpinePositionFromSpineItemPosition(b, h);
4186
4191
  return c(x);
@@ -4198,16 +4203,16 @@ const Xe = (e) => {
4198
4203
  const h = e.getSettings().computedPageTurnDirection, b = o.getSpineItemFromPosition(m) || t.getFocusedSpineItem(), x = m;
4199
4204
  if (!b)
4200
4205
  return x;
4201
- const I = o.getSpineItemPositionFromSpinePosition(m, b), T = r.getNavigationForRightPage(I, b);
4202
- return !I.outsideOfBoundaries && i(T, I) ? o.getSpinePositionFromSpineItemPosition(T, b) : a(
4206
+ const $ = o.getSpineItemPositionFromSpinePosition(m, b), T = r.getNavigationForRightPage($, b);
4207
+ return !$.outsideOfBoundaries && i(T, $) ? o.getSpinePositionFromSpineItemPosition(T, b) : a(
4203
4208
  e.isRTL() ? h === "horizontal" ? { x: m.x - e.getPageSize().width, y: 0 } : { y: m.y + e.getPageSize().height, x: 0 } : h === "horizontal" ? { x: m.x + e.getPageSize().width, y: 0 } : { y: m.y + e.getPageSize().height, x: 0 }
4204
4209
  );
4205
4210
  }, y = (m) => {
4206
4211
  const h = e.getSettings().computedPageTurnDirection, b = o.getSpineItemFromPosition(m) || t.getFocusedSpineItem(), x = { ...m, spineItem: b };
4207
4212
  if (!b)
4208
4213
  return x;
4209
- const I = o.getSpineItemPositionFromSpinePosition(m, b), T = r.getNavigationForLeftPage(I, b);
4210
- return !I.outsideOfBoundaries && i(T, I) ? o.getSpinePositionFromSpineItemPosition(T, b) : a(
4214
+ const $ = o.getSpineItemPositionFromSpinePosition(m, b), T = r.getNavigationForLeftPage($, b);
4215
+ return !$.outsideOfBoundaries && i(T, $) ? o.getSpinePositionFromSpineItemPosition(T, b) : a(
4211
4216
  e.isRTL() ? h === "horizontal" ? { x: m.x + e.getPageSize().width, y: 0 } : { y: m.y - e.getPageSize().height, x: 0 } : h === "horizontal" ? { x: m.x - e.getPageSize().width, y: 0 } : { y: m.y - e.getPageSize().height, x: 0 }
4212
4217
  );
4213
4218
  }, v = (m) => {
@@ -4233,7 +4238,7 @@ const Xe = (e) => {
4233
4238
  b = g(b);
4234
4239
  }
4235
4240
  return c(b);
4236
- }, S = (m) => {
4241
+ }, w = (m) => {
4237
4242
  const h = o.getSpineItemFromPosition(m) || t.getFocusedSpineItem();
4238
4243
  let b = y(m);
4239
4244
  if (h != null && h.isUsingVerticalWriting() && m.x === b.x)
@@ -4259,9 +4264,9 @@ const Xe = (e) => {
4259
4264
  R.error(x);
4260
4265
  }
4261
4266
  if (h) {
4262
- const x = `${h.origin}${h.pathname}`, I = (b = e.getManifest()) == null ? void 0 : b.spineItems.find((T) => T.href === x);
4263
- if (I) {
4264
- const T = t.get(I.id);
4267
+ const x = `${h.origin}${h.pathname}`, $ = (b = e.getManifest()) == null ? void 0 : b.spineItems.find((T) => T.href === x);
4268
+ if ($) {
4269
+ const T = t.get($.id);
4265
4270
  if (T) {
4266
4271
  const A = C(h.hash, T);
4267
4272
  return { ...c(A), url: h };
@@ -4274,8 +4279,8 @@ const Xe = (e) => {
4274
4279
  }, N = (m) => {
4275
4280
  const h = o.getSpineItemFromPosition(m);
4276
4281
  if (h) {
4277
- const b = o.getSpineItemPositionFromSpinePosition(m, h), x = r.getNavigationForPosition(h, b), I = o.getSpinePositionFromSpineItemPosition(x, h);
4278
- return c(I);
4282
+ const b = o.getSpineItemPositionFromSpinePosition(m, h), x = r.getNavigationForPosition(h, b), $ = o.getSpinePositionFromSpineItemPosition(x, h);
4283
+ return c($);
4279
4284
  }
4280
4285
  return { x: 0, y: 0 };
4281
4286
  };
@@ -4285,12 +4290,12 @@ const Xe = (e) => {
4285
4290
  getNavigationForLastPage: l,
4286
4291
  getNavigationForSpineIndexOrId: f,
4287
4292
  getNavigationForRightPage: v,
4288
- getNavigationForLeftPage: S,
4293
+ getNavigationForLeftPage: w,
4289
4294
  getNavigationForUrl: p,
4290
4295
  getNavigationForAnchor: C,
4291
4296
  getNavigationForPosition: N,
4292
4297
  getMostPredominantNavigationForPosition: (m) => {
4293
- const h = e.getSettings().computedPageTurnDirection, b = 0.5, x = h === "horizontal" ? m.x + e.getVisibleAreaRect().width * b : 0, I = h === "horizontal" ? 0 : m.y + e.getVisibleAreaRect().height * b, T = a({ x, y: I });
4298
+ const h = e.getSettings().computedPageTurnDirection, b = 0.5, x = h === "horizontal" ? m.x + e.getVisibleAreaRect().width * b : 0, $ = h === "horizontal" ? 0 : m.y + e.getVisibleAreaRect().height * b, T = a({ x, y: $ });
4294
4299
  return N(T);
4295
4300
  },
4296
4301
  wrapPositionWithSafeEdge: a,
@@ -4298,7 +4303,7 @@ const Xe = (e) => {
4298
4303
  areNavigationDifferent: s,
4299
4304
  arePositionsDifferent: i
4300
4305
  };
4301
- }, $t = 200, Dr = ({
4306
+ }, It = 200, _r = ({
4302
4307
  context: e,
4303
4308
  element: t,
4304
4309
  navigator: n,
@@ -4306,17 +4311,17 @@ const Xe = (e) => {
4306
4311
  spine: r
4307
4312
  }) => {
4308
4313
  let i = !1;
4309
- const s = (S) => S.pipe(
4314
+ const s = (w) => w.pipe(
4310
4315
  B(() => i ? (i = !1, !1) : !0)
4311
- ), a = ({ x: S, y: p }) => e.getSettings().computedPageTurnMode === "scrollable" ? (i = !0, t.scrollTo({ left: S, top: p }), !0) : !1, u = ((S) => e.$.settings$.pipe(
4316
+ ), a = ({ x: w, y: p }) => e.getSettings().computedPageTurnMode === "scrollable" ? (i = !0, t.scrollTo({ left: w, top: p }), !0) : !1, u = ((w) => e.$.settings$.pipe(
4312
4317
  k(() => e.getSettings().computedPageTurnMode),
4313
4318
  Q(),
4314
- W((p) => hn(() => p === "controlled", te, S))
4319
+ W((p) => hn(() => p === "controlled", te, w))
4315
4320
  ))(Ft(t, "scroll")).pipe(
4316
4321
  s,
4317
4322
  oe(),
4318
4323
  j(e.$.destroy$)
4319
- ), d = ({ x: S, y: p }) => {
4324
+ ), d = ({ x: w, y: p }) => {
4320
4325
  const C = r.element.getBoundingClientRect().width / r.element.offsetWidth;
4321
4326
  return {
4322
4327
  x: je({
@@ -4324,7 +4329,7 @@ const Xe = (e) => {
4324
4329
  oldScale: C,
4325
4330
  screenSize: t.clientWidth,
4326
4331
  pageSize: r.element.scrollWidth,
4327
- scrollOffset: S
4332
+ scrollOffset: w
4328
4333
  }),
4329
4334
  y: je({
4330
4335
  newScale: 1,
@@ -4334,16 +4339,16 @@ const Xe = (e) => {
4334
4339
  scrollOffset: p
4335
4340
  })
4336
4341
  };
4337
- }, l = (S) => n.getMostPredominantNavigationForPosition(S), f = () => d({ x: t.scrollLeft, y: t.scrollTop }), g = u.pipe(
4338
- Ze($t, me),
4342
+ }, l = (w) => n.getMostPredominantNavigationForPosition(w), f = () => d({ x: t.scrollLeft, y: t.scrollTop }), g = u.pipe(
4343
+ Ze(It, me),
4339
4344
  re(o),
4340
4345
  W(() => {
4341
- const S = l(d({ x: t.scrollLeft, y: t.scrollTop }));
4342
- return J({ position: S, animate: !1, lastUserExpectedNavigation: void 0 });
4346
+ const w = l(d({ x: t.scrollLeft, y: t.scrollTop }));
4347
+ return J({ position: w, animate: !1, lastUserExpectedNavigation: void 0 });
4343
4348
  }),
4344
4349
  oe()
4345
4350
  ), y = u.pipe(
4346
- Ze($t, me),
4351
+ Ze(It, me),
4347
4352
  oe(),
4348
4353
  j(e.$.destroy$)
4349
4354
  ), v = X(
@@ -4364,7 +4369,7 @@ const Xe = (e) => {
4364
4369
  navigation$: g
4365
4370
  }
4366
4371
  };
4367
- }, Ne = "manualViewportNavigator", _r = ({
4372
+ }, Ne = "manualViewportNavigator", Mr = ({
4368
4373
  navigator: e,
4369
4374
  spineItemManager: t,
4370
4375
  currentNavigationSubject$: n,
@@ -4388,10 +4393,10 @@ const Xe = (e) => {
4388
4393
  ), v = s.pipe(
4389
4394
  B((h) => h.type === "spineItem"),
4390
4395
  W(({ data: { animate: h, indexOrId: b } }) => {
4391
- const x = e.getNavigationForSpineIndexOrId(b), I = { type: "navigate-from-previous-item" };
4392
- return R.log(Ne, "goToSpineItem", { indexOrId: b, animate: h, navigation: x }), J({ ...x, animate: h, lastUserExpectedNavigation: I });
4396
+ const x = e.getNavigationForSpineIndexOrId(b), $ = { type: "navigate-from-previous-item" };
4397
+ return R.log(Ne, "goToSpineItem", { indexOrId: b, animate: h, navigation: x }), J({ ...x, animate: h, lastUserExpectedNavigation: $ });
4393
4398
  })
4394
- ), S = s.pipe(
4399
+ ), w = s.pipe(
4395
4400
  B((h) => h.type === "cfi"),
4396
4401
  k(({ data: { animate: h, cfi: b } }) => {
4397
4402
  const x = e.getNavigationForCfi(b);
@@ -4429,10 +4434,10 @@ const Xe = (e) => {
4429
4434
  const x = t.getFocusedSpineItem();
4430
4435
  if (!x)
4431
4436
  return te;
4432
- const I = o.getSpineItemFromPosition(h) || x;
4433
- if (I !== x) {
4437
+ const $ = o.getSpineItemFromPosition(h) || x;
4438
+ if ($ !== x) {
4434
4439
  if (b)
4435
- return t.comparePositionOf(I, x) === "before" ? J({ ...h, lastUserExpectedNavigation: { type: "navigate-from-next-item" }, animate: !0 }) : J({
4440
+ return t.comparePositionOf($, x) === "before" ? J({ ...h, lastUserExpectedNavigation: { type: "navigate-from-next-item" }, animate: !0 }) : J({
4436
4441
  ...h,
4437
4442
  lastUserExpectedNavigation: { type: "navigate-from-previous-item" },
4438
4443
  animate: !0
@@ -4441,7 +4446,7 @@ const Xe = (e) => {
4441
4446
  return J({ ...h, lastUserExpectedNavigation: void 0, animate: !0 });
4442
4447
  return te;
4443
4448
  }
4444
- ), $ = s.pipe(
4449
+ ), I = s.pipe(
4445
4450
  B((h) => h.type === "leftPage"),
4446
4451
  re(n),
4447
4452
  W(
@@ -4455,7 +4460,7 @@ const Xe = (e) => {
4455
4460
  return R.log(Ne, "turnLeft"), N(x, { allowSpineItemChange: h });
4456
4461
  }
4457
4462
  )
4458
- ), w = s.pipe(
4463
+ ), S = s.pipe(
4459
4464
  B((h) => h.type === "rightPage"),
4460
4465
  re(n),
4461
4466
  W(
@@ -4473,9 +4478,9 @@ const Xe = (e) => {
4473
4478
  y,
4474
4479
  v,
4475
4480
  p,
4476
- $,
4477
- w,
4478
- X(S, C)
4481
+ I,
4482
+ S,
4483
+ X(w, C)
4479
4484
  ).pipe(
4480
4485
  re(n),
4481
4486
  B(([h, b]) => e.areNavigationDifferent(h, b)),
@@ -4497,7 +4502,7 @@ const Xe = (e) => {
4497
4502
  navigation$: m
4498
4503
  }
4499
4504
  };
4500
- }, Mr = "panViewportNavigator", jr = ({
4505
+ }, jr = "panViewportNavigator", Vr = ({
4501
4506
  getCurrentViewportPosition: e,
4502
4507
  navigator: t,
4503
4508
  spineItemManager: n,
@@ -4508,45 +4513,45 @@ const Xe = (e) => {
4508
4513
  const s = new H(), a = new q("end");
4509
4514
  let c = { x: 0, y: 0 }, u = { x: 0, y: 0 };
4510
4515
  const d = new H(), l = R.measurePerformance(
4511
- `${Mr} moveTo`,
4516
+ `${jr} moveTo`,
4512
4517
  5,
4513
- (S, { final: p, start: C } = {}) => {
4518
+ (w, { final: p, start: C } = {}) => {
4514
4519
  if (r.getSettings().computedPageTurnMode === "scrollable") {
4515
4520
  R.warn("pan control is not available on free page turn mode");
4516
4521
  return;
4517
4522
  }
4518
4523
  const N = r.getSettings().computedPageTurnDirection;
4519
4524
  C && (a.next("start"), c = { x: 0, y: 0 }, u = e());
4520
- let $ = i.value;
4521
- if (S) {
4522
- const w = S.x - ((c == null ? void 0 : c.x) || 0), m = S.y - ((c == null ? void 0 : c.y) || 0);
4523
- $ = t.wrapPositionWithSafeEdge({
4524
- x: N === "horizontal" ? r.isRTL() ? u.x + w : u.x - w : 0,
4525
+ let I = i.value;
4526
+ if (w) {
4527
+ const S = w.x - ((c == null ? void 0 : c.x) || 0), m = w.y - ((c == null ? void 0 : c.y) || 0);
4528
+ I = t.wrapPositionWithSafeEdge({
4529
+ x: N === "horizontal" ? r.isRTL() ? u.x + S : u.x - S : 0,
4525
4530
  y: N === "horizontal" ? 0 : u.y - m
4526
- }), c = S;
4531
+ }), c = w;
4527
4532
  } else
4528
- $ = e();
4529
- if (u = $, p) {
4533
+ I = e();
4534
+ if (u = I, p) {
4530
4535
  c = { x: 0, y: 0 }, f({
4531
4536
  from: i.value,
4532
- to: $,
4537
+ to: I,
4533
4538
  pan: u
4534
4539
  }), a.next("end");
4535
4540
  return;
4536
4541
  }
4537
- d.next({ position: $ });
4542
+ d.next({ position: I });
4538
4543
  },
4539
4544
  { disable: !1 }
4540
- ), f = (S) => {
4541
- s.next({ type: "snap", data: S });
4545
+ ), f = (w) => {
4546
+ s.next({ type: "snap", data: w });
4542
4547
  }, g = R.measurePerformance(
4543
4548
  "turnTo",
4544
4549
  10,
4545
- (S, { allowSpineItemChange: p = !0 } = {}) => {
4550
+ (w, { allowSpineItemChange: p = !0 } = {}) => {
4546
4551
  const C = n.getFocusedSpineItem();
4547
4552
  if (!C)
4548
4553
  return;
4549
- const N = o.getSpineItemFromPosition(S) || C;
4554
+ const N = o.getSpineItemFromPosition(w) || C;
4550
4555
  if (N !== C) {
4551
4556
  if (p)
4552
4557
  return n.comparePositionOf(N, C) === "before" ? { type: "navigate-from-next-item" } : { type: "navigate-from-previous-item" };
@@ -4554,17 +4559,17 @@ const Xe = (e) => {
4554
4559
  return;
4555
4560
  }
4556
4561
  ), y = s.pipe(
4557
- B((S) => S.type === "snap"),
4562
+ B((w) => w.type === "snap"),
4558
4563
  mn(r.$.settings$),
4559
4564
  W(
4560
4565
  ([
4561
4566
  {
4562
- data: { from: S, to: p }
4567
+ data: { from: w, to: p }
4563
4568
  },
4564
4569
  { navigationSnapThreshold: C }
4565
4570
  ]) => {
4566
- const N = r.getSettings().computedPageTurnDirection, w = t.isNavigationGoingForwardFrom(p, S) ? 1 - C : C, m = N === "horizontal" ? p.x + r.getVisibleAreaRect().width * w : 0, h = N === "horizontal" ? 0 : p.y + r.getVisibleAreaRect().height * w, b = t.wrapPositionWithSafeEdge({ x: m, y: h }), x = t.getNavigationForPosition(b), I = g(x);
4567
- return J({ ...x, lastUserExpectedNavigation: I });
4571
+ const N = r.getSettings().computedPageTurnDirection, S = t.isNavigationGoingForwardFrom(p, w) ? 1 - C : C, m = N === "horizontal" ? p.x + r.getVisibleAreaRect().width * S : 0, h = N === "horizontal" ? 0 : p.y + r.getVisibleAreaRect().height * S, b = t.wrapPositionWithSafeEdge({ x: m, y: h }), x = t.getNavigationForPosition(b), $ = g(x);
4572
+ return J({ ...x, lastUserExpectedNavigation: $ });
4568
4573
  }
4569
4574
  )
4570
4575
  );
@@ -4573,14 +4578,14 @@ const Xe = (e) => {
4573
4578
  destroy: () => {
4574
4579
  d.complete(), a.complete();
4575
4580
  },
4576
- adjustReadingOffset: (S) => !1,
4581
+ adjustReadingOffset: (w) => !1,
4577
4582
  $: {
4578
4583
  moveToSubject$: d,
4579
4584
  state$: a.asObservable(),
4580
4585
  navigation$: X(y)
4581
4586
  }
4582
4587
  };
4583
- }, pe = "viewportNavigator", Vr = ({
4588
+ }, pe = "viewportNavigator", kr = ({
4584
4589
  spineItemManager: e,
4585
4590
  context: t,
4586
4591
  pagination: n,
@@ -4590,11 +4595,11 @@ const Xe = (e) => {
4590
4595
  hooks$: s,
4591
4596
  spine: a
4592
4597
  }) => {
4593
- const c = kr(o.ownerDocument, s);
4598
+ const c = zr(o.ownerDocument, s);
4594
4599
  c.appendChild(a.element);
4595
4600
  const u = new H();
4596
4601
  let d;
4597
- const l = new q({ x: -1, y: 0 }), f = Lr({
4602
+ const l = new q({ x: -1, y: 0 }), f = Dr({
4598
4603
  context: t,
4599
4604
  spineItemManager: e,
4600
4605
  cfiLocator: r,
@@ -4603,13 +4608,13 @@ const Xe = (e) => {
4603
4608
  o.appendChild(c);
4604
4609
  const y = R.measurePerformance(`${pe} getCurrentViewportPosition`, 1, () => {
4605
4610
  if (d && (d == null || d.x, ~~(Math.abs(c.getBoundingClientRect().x) * 10) / 10), t.getSettings().computedPageTurnMode === "scrollable")
4606
- return S.getCurrentViewportPosition();
4611
+ return w.getCurrentViewportPosition();
4607
4612
  const { x: P, y: L } = c.getBoundingClientRect();
4608
4613
  return d = {
4609
4614
  x: ~~(Math.abs(P) * 10) / 10,
4610
4615
  y: ~~(Math.abs(L) * 10) / 10
4611
4616
  }, d;
4612
- }), v = jr({
4617
+ }), v = Vr({
4613
4618
  context: t,
4614
4619
  element: c,
4615
4620
  navigator: f,
@@ -4617,23 +4622,23 @@ const Xe = (e) => {
4617
4622
  locator: i,
4618
4623
  getCurrentViewportPosition: y,
4619
4624
  currentNavigationSubject$: l
4620
- }), S = Dr({
4625
+ }), w = _r({
4621
4626
  context: t,
4622
4627
  element: c,
4623
4628
  navigator: f,
4624
4629
  currentNavigationSubject$: l,
4625
4630
  spine: a,
4626
4631
  spineItemManager: e
4627
- }), p = _r({
4632
+ }), p = Mr({
4628
4633
  context: t,
4629
4634
  element: c,
4630
4635
  navigator: f,
4631
4636
  currentNavigationSubject$: l,
4632
4637
  spineItemManager: e,
4633
4638
  locator: i
4634
- }), C = [S, v, p], N = X(...C.map(({ $: { state$: P } }) => P));
4635
- let $;
4636
- const w = (P) => (P.pipe(j(t.$.destroy$)).subscribe(), P), m = R.measurePerformance(
4639
+ }), C = [w, v, p], N = X(...C.map(({ $: { state$: P } }) => P));
4640
+ let I;
4641
+ const S = (P) => (P.pipe(j(t.$.destroy$)).subscribe(), P), m = R.measurePerformance(
4637
4642
  "adjustReadingOffset",
4638
4643
  2,
4639
4644
  ({ x: P, y: L }, M) => {
@@ -4647,15 +4652,15 @@ const Xe = (e) => {
4647
4652
  let M = l.value;
4648
4653
  const z = 0;
4649
4654
  if (t.getSettings().computedPageTurnMode === "scrollable")
4650
- M = S.getNavigationForPosition(y());
4651
- else if (($ == null ? void 0 : $.type) === "navigate-from-cfi")
4652
- M = f.getNavigationForCfi($.data), R.log(pe, "adjustNavigation", "navigate-from-cfi", "use last cfi");
4653
- else if (($ == null ? void 0 : $.type) === "navigate-from-next-item")
4655
+ M = w.getNavigationForPosition(y());
4656
+ else if ((I == null ? void 0 : I.type) === "navigate-from-cfi")
4657
+ M = f.getNavigationForCfi(I.data), R.log(pe, "adjustNavigation", "navigate-from-cfi", "use last cfi");
4658
+ else if ((I == null ? void 0 : I.type) === "navigate-from-next-item")
4654
4659
  M = f.getNavigationForLastPage(P), R.log(pe, "adjustNavigation", "navigate-from-next-item", {});
4655
- else if (($ == null ? void 0 : $.type) === "navigate-from-previous-item")
4660
+ else if ((I == null ? void 0 : I.type) === "navigate-from-previous-item")
4656
4661
  M = f.getNavigationForPage(0, P), R.log(pe, "adjustNavigation", "navigate-from-previous-item", {});
4657
- else if (($ == null ? void 0 : $.type) === "navigate-from-anchor") {
4658
- const de = $.data;
4662
+ else if ((I == null ? void 0 : I.type) === "navigate-from-anchor") {
4663
+ const de = I.data;
4659
4664
  M = f.getNavigationForAnchor(de, P);
4660
4665
  } else if (L)
4661
4666
  M = f.getNavigationForCfi(L), R.log(pe, "adjustNavigation", "use last cfi");
@@ -4669,7 +4674,7 @@ const Xe = (e) => {
4669
4674
  offsetInSpineItem: z,
4670
4675
  expectedSpineOffset: M,
4671
4676
  currentNavigationPosition: l.value,
4672
- lastUserExpectedNavigation: $
4677
+ lastUserExpectedNavigation: I
4673
4678
  }), Y && g.next({
4674
4679
  position: M,
4675
4680
  animate: !1
@@ -4692,7 +4697,7 @@ const Xe = (e) => {
4692
4697
  t.getSettings().computedPageTurnMode === "scrollable" ? (c.style.removeProperty("transform"), c.style.removeProperty("transition"), c.style.overflow = "scroll") : (c.style.removeProperty("overflow"), c.style.removeProperty("overflowY")), e.layout();
4693
4698
  })
4694
4699
  ).subscribe();
4695
- const I = X(
4700
+ const $ = X(
4696
4701
  v.$.navigation$.pipe(
4697
4702
  k((P) => ({
4698
4703
  ...P,
@@ -4716,7 +4721,7 @@ const Xe = (e) => {
4716
4721
  animation: P.animate ? "turn" : !1
4717
4722
  }))
4718
4723
  ),
4719
- S.$.navigation$.pipe(
4724
+ w.$.navigation$.pipe(
4720
4725
  k((P) => ({
4721
4726
  ...P,
4722
4727
  triggeredBy: "scroll",
@@ -4724,10 +4729,10 @@ const Xe = (e) => {
4724
4729
  }))
4725
4730
  )
4726
4731
  ).pipe(
4727
- k((P) => ("lastUserExpectedNavigation" in P && ($ = P.lastUserExpectedNavigation), l.next(P.position), { ...P, lastUserExpectedNavigation: $ })),
4732
+ k((P) => ("lastUserExpectedNavigation" in P && (I = P.lastUserExpectedNavigation), l.next(P.position), { ...P, lastUserExpectedNavigation: I })),
4728
4733
  oe(),
4729
4734
  j(t.$.destroy$)
4730
- ), T = I.pipe(
4735
+ ), T = $.pipe(
4731
4736
  B(({ triggeredBy: P }) => !(P === "scroll" || t.getSettings().computedPageTurnMode === "scrollable" && P === "adjust"))
4732
4737
  ), A = X(
4733
4738
  v.$.moveToSubject$.asObservable().pipe(k((P) => ({ ...P, animation: !1 }))),
@@ -4780,11 +4785,11 @@ const Xe = (e) => {
4780
4785
  ), O = X(
4781
4786
  X(A).pipe(k(() => "start")),
4782
4787
  X(E).pipe(k(() => "end"))
4783
- ), _ = Ie([...C.map(({ $: { state$: P } }) => P), O]).pipe(
4788
+ ), _ = $e([...C.map(({ $: { state$: P } }) => P), O]).pipe(
4784
4789
  k((P) => P.every((L) => L === "end") ? "free" : "busy"),
4785
4790
  Q(),
4786
4791
  ut(1),
4787
- w
4792
+ S
4788
4793
  ), F = _.pipe(
4789
4794
  B((P) => P === "free"),
4790
4795
  yn(1)
@@ -4795,7 +4800,7 @@ const Xe = (e) => {
4795
4800
  const P = e.getFocusedSpineItem();
4796
4801
  return P ? h(P) : te;
4797
4802
  }),
4798
- j(I)
4803
+ j($)
4799
4804
  )
4800
4805
  ),
4801
4806
  oe()
@@ -4816,22 +4821,22 @@ const Xe = (e) => {
4816
4821
  goToPageOfCurrentChapter: p.goToPageOfCurrentChapter,
4817
4822
  adjustNavigation: h,
4818
4823
  moveTo: v.moveTo,
4819
- getLastUserExpectedNavigation: () => $,
4824
+ getLastUserExpectedNavigation: () => I,
4820
4825
  element: c,
4821
4826
  $: {
4822
4827
  state$: _,
4823
- navigation$: I,
4828
+ navigation$: $,
4824
4829
  navigationAdjustedAfterLayout$: D,
4825
4830
  currentNavigationPosition$: l.asObservable()
4826
4831
  }
4827
4832
  };
4828
- }, kr = (e, t) => {
4833
+ }, zr = (e, t) => {
4829
4834
  const n = e.createElement("div");
4830
4835
  return n.style.cssText = `
4831
4836
  height: 100%;
4832
4837
  position: relative;
4833
4838
  `, n.className = `${Ve}-viewport-navigator`, t.getValue().reduce((o, r) => r.name === "viewportNavigator.onBeforeContainerCreated" ? r.fn(o) : o, n);
4834
- }, zr = ({
4839
+ }, Ur = ({
4835
4840
  spineItemManager: e,
4836
4841
  context: t,
4837
4842
  spineItemLocator: n
@@ -4840,7 +4845,7 @@ const Xe = (e) => {
4840
4845
  "getSpineItemPositionFromSpinePosition",
4841
4846
  10,
4842
4847
  (l, f) => {
4843
- const { leftEnd: g, leftStart: y, topStart: v, topEnd: S } = e.getAbsolutePositionOf(f);
4848
+ const { leftEnd: g, leftStart: y, topStart: v, topEnd: w } = e.getAbsolutePositionOf(f);
4844
4849
  return t.isRTL() ? {
4845
4850
  x: g - l.x - t.getPageSize().width,
4846
4851
  y: Math.max(0, l.y - v)
@@ -4851,7 +4856,7 @@ const Xe = (e) => {
4851
4856
  },
4852
4857
  { disable: !0 }
4853
4858
  ), r = (l, f) => {
4854
- const { leftEnd: g, leftStart: y, topStart: v, topEnd: S } = e.getAbsolutePositionOf(f);
4859
+ const { leftEnd: g, leftStart: y, topStart: v, topEnd: w } = e.getAbsolutePositionOf(f);
4855
4860
  return t.isRTL() ? {
4856
4861
  x: g - l.x - t.getPageSize().width,
4857
4862
  y: v + l.y
@@ -4888,24 +4893,24 @@ const Xe = (e) => {
4888
4893
  return;
4889
4894
  let y = l;
4890
4895
  t.shouldDisplaySpread() && (y = { x: l.x + t.getPageSize().width, y: l.y });
4891
- const v = e.getSpineItemIndex(i(y) || e.getFocusedSpineItem()) ?? g, [S = g, p = g] = [g, v].sort((C, N) => C - N);
4896
+ const v = e.getSpineItemIndex(i(y) || e.getFocusedSpineItem()) ?? g, [w = g, p = g] = [g, v].sort((C, N) => C - N);
4892
4897
  return {
4893
4898
  begin: g,
4894
4899
  beginPosition: l,
4895
4900
  end: v,
4896
4901
  endPosition: y,
4897
- left: S,
4902
+ left: w,
4898
4903
  right: p
4899
4904
  };
4900
4905
  }
4901
4906
  };
4902
- }, Ur = ({
4907
+ }, Wr = ({
4903
4908
  spineItemManager: e,
4904
4909
  spineItemLocator: t
4905
4910
  }) => {
4906
4911
  const n = (u) => `|[prose~anchor~${encodeURIComponent(u.item.id)}]`, o = R.measurePerformance("getCfi", 10, (u, d) => {
4907
- var v, S, p;
4908
- const l = t.getFirstNodeOrRangeAtPage(u, d), f = (p = (S = (v = d.spineItemFrame.getManipulableFrame()) == null ? void 0 : v.frame) == null ? void 0 : S.contentWindow) == null ? void 0 : p.document, g = n(d), y = `|[prose~offset~${(l == null ? void 0 : l.offset) || 0}]`;
4912
+ var v, w, p;
4913
+ const l = t.getFirstNodeOrRangeAtPage(u, d), f = (p = (w = (v = d.spineItemFrame.getManipulableFrame()) == null ? void 0 : v.frame) == null ? void 0 : w.contentWindow) == null ? void 0 : p.document, g = n(d), y = `|[prose~offset~${(l == null ? void 0 : l.offset) || 0}]`;
4909
4914
  return l && f ? be.generate(l.node, 0, `${g}${y}`) : r(d);
4910
4915
  }), r = (u) => `epubcfi(/0${n(u)}) `, i = (u) => {
4911
4916
  const { itemId: d } = Xe(u);
@@ -4926,17 +4931,17 @@ const Xe = (e) => {
4926
4931
  getCfi: o,
4927
4932
  getRootCfi: r,
4928
4933
  resolveCfi: (u) => {
4929
- var S, p, C;
4934
+ var w, p, C;
4930
4935
  if (!u)
4931
4936
  return;
4932
4937
  const d = i(u), l = e.getSpineItemIndex(d) || 0;
4933
4938
  if (!d)
4934
4939
  return;
4935
- const { cleanedCfi: f, offset: g } = Xe(u), y = new be(f, {}), v = (C = (p = (S = d.spineItemFrame.getManipulableFrame()) == null ? void 0 : S.frame) == null ? void 0 : p.contentWindow) == null ? void 0 : C.document;
4940
+ const { cleanedCfi: f, offset: g } = Xe(u), y = new be(f, {}), v = (C = (p = (w = d.spineItemFrame.getManipulableFrame()) == null ? void 0 : w.frame) == null ? void 0 : p.contentWindow) == null ? void 0 : C.document;
4936
4941
  if (v)
4937
4942
  try {
4938
- const { node: N, offset: $ } = y.resolve(v, {});
4939
- return { node: N, offset: g ?? $, spineItemIndex: l };
4943
+ const { node: N, offset: I } = y.resolve(v, {});
4944
+ return { node: N, offset: g ?? I, spineItemIndex: l };
4940
4945
  } catch (N) {
4941
4946
  return R.error(N), {
4942
4947
  spineItemIndex: l
@@ -4951,35 +4956,35 @@ const Xe = (e) => {
4951
4956
  return { start: y, end: v };
4952
4957
  }
4953
4958
  };
4954
- }, Wr = "proseReaderIframeEventBridgeElement", It = ({ containerElement: e, hooks: t, ...n }) => {
4959
+ }, Hr = "proseReaderIframeEventBridgeElement", $t = ({ containerElement: e, hooks: t, ...n }) => {
4955
4960
  const o = new q({
4956
4961
  supportedPageTurnAnimation: ["fade", "none", "slide"],
4957
4962
  supportedPageTurnMode: ["controlled", "scrollable"],
4958
4963
  supportedPageTurnDirection: ["horizontal", "vertical"],
4959
4964
  supportedComputedPageTurnDirection: ["horizontal", "vertical"]
4960
- }), r = new H(), i = new H(), s = new H(), a = new q(t || []), c = new H(), u = new H(), d = new q({ x: 0, y: 0 }), l = new q("free"), f = Uo(n), g = Or({ context: f }), y = Ao({ context: f, spineItemManager: g }), v = Hr(e), S = Br(e), p = ln({ context: f }), C = zr({
4965
+ }), r = new H(), i = new H(), s = new H(), a = new q(t || []), c = new H(), u = new H(), d = new q({ x: 0, y: 0 }), l = new q("free"), f = Uo(n), g = Rr({ context: f }), y = Ao({ context: f, spineItemManager: g }), v = Br(e), w = Yr(e), p = ln({ context: f }), C = Ur({
4961
4966
  context: f,
4962
4967
  spineItemManager: g,
4963
4968
  spineItemLocator: p
4964
- }), N = Ur({
4969
+ }), N = Wr({
4965
4970
  spineItemManager: g,
4966
4971
  context: f,
4967
4972
  spineItemLocator: p
4968
- }), $ = c.asObservable(), w = Fr({
4973
+ }), I = c.asObservable(), S = Er({
4969
4974
  ownerDocument: v.ownerDocument,
4970
- iframeEventBridgeElement: S,
4975
+ iframeEventBridgeElement: w,
4971
4976
  context: f,
4972
4977
  pagination: y,
4973
4978
  spineItemManager: g,
4974
4979
  hooks$: a,
4975
- navigation$: $,
4980
+ navigation$: I,
4976
4981
  spineLocator: C,
4977
4982
  spineItemLocator: p,
4978
4983
  cfiLocator: N,
4979
4984
  navigationAdjusted$: u.asObservable(),
4980
4985
  viewportState$: l.asObservable(),
4981
4986
  currentNavigationPosition$: d.asObservable()
4982
- }), m = Vr({
4987
+ }), m = kr({
4983
4988
  context: f,
4984
4989
  pagination: y,
4985
4990
  spineItemManager: g,
@@ -4987,9 +4992,9 @@ const Xe = (e) => {
4987
4992
  cfiLocator: N,
4988
4993
  spineLocator: C,
4989
4994
  hooks$: a,
4990
- spine: w
4995
+ spine: S
4991
4996
  });
4992
- e.appendChild(v), v.appendChild(S), m.$.state$.subscribe(l), m.$.navigation$.subscribe(c), m.$.navigationAdjustedAfterLayout$.subscribe(u), m.$.currentNavigationPosition$.subscribe(d);
4997
+ e.appendChild(v), v.appendChild(w), m.$.state$.subscribe(l), m.$.navigation$.subscribe(c), m.$.navigationAdjustedAfterLayout$.subscribe(u), m.$.currentNavigationPosition$.subscribe(d);
4993
4998
  const h = () => {
4994
4999
  const E = {
4995
5000
  width: e.offsetWidth,
@@ -5006,16 +5011,16 @@ const Xe = (e) => {
5006
5011
  R.log("load", { manifest: E, loadOptions: O }), f.load(E, O), h(), O.cfi ? m.goToCfi(O.cfi, { animate: !1 }) : m.goToSpineItem(0, { animate: !1 }), r.next();
5007
5012
  }, x = (E, O) => {
5008
5013
  a.next([...a.getValue(), { name: E, fn: O }]);
5009
- }, I = (E) => {
5014
+ }, $ = (E) => {
5010
5015
  E(v);
5011
5016
  };
5012
- w.$.$.pipe(
5017
+ S.$.$.pipe(
5013
5018
  U((E) => {
5014
5019
  E.type === "onSelectionChange" && s.next(E.data);
5015
5020
  }),
5016
5021
  j(i)
5017
5022
  ).subscribe(), m.$.navigationAdjustedAfterLayout$.pipe(
5018
- Ct(({ adjustedSpinePosition: E }) => w.adjustPagination(E).pipe(j($))),
5023
+ Ct(({ adjustedSpinePosition: E }) => S.adjustPagination(E).pipe(j(I))),
5019
5024
  j(f.$.destroy$)
5020
5025
  ).subscribe(), X(f.$.load$, f.$.settings$, f.$.hasVerticalWriting$).pipe(
5021
5026
  he(void 0),
@@ -5046,16 +5051,16 @@ const Xe = (e) => {
5046
5051
  j(i)
5047
5052
  ).subscribe(o);
5048
5053
  const T = () => {
5049
- a.next([]), a.complete(), y.destroy(), f.destroy(), m.destroy(), w.destroy(), v.remove(), S.remove(), r.complete(), o.complete(), s.complete(), i.next(), i.complete();
5054
+ a.next([]), a.complete(), y.destroy(), f.destroy(), m.destroy(), S.destroy(), v.remove(), w.remove(), r.complete(), o.complete(), s.complete(), i.next(), i.complete();
5050
5055
  };
5051
5056
  return {
5052
5057
  context: f,
5053
5058
  registerHook: x,
5054
- spine: w,
5059
+ spine: S,
5055
5060
  viewportNavigator: m,
5056
- manipulateSpineItems: w.manipulateSpineItems,
5057
- manipulateSpineItem: w.manipulateSpineItem,
5058
- manipulateContainer: I,
5061
+ manipulateSpineItems: S.manipulateSpineItems,
5062
+ manipulateSpineItem: S.manipulateSpineItem,
5063
+ manipulateContainer: $,
5059
5064
  moveTo: m.moveTo,
5060
5065
  turnLeft: m.turnLeft,
5061
5066
  turnRight: m.turnRight,
@@ -5068,13 +5073,13 @@ const Xe = (e) => {
5068
5073
  getSpineItem: g.get,
5069
5074
  getSpineItems: g.getAll,
5070
5075
  getAbsolutePositionOf: g.getAbsolutePositionOf,
5071
- getSelection: w.getSelection,
5072
- isSelecting: w.isSelecting,
5073
- normalizeEventForViewport: w.normalizeEventForViewport,
5074
- getCfiMetaInformation: w.cfiLocator.getCfiMetaInformation,
5075
- resolveCfi: w.cfiLocator.resolveCfi,
5076
- generateCfi: w.cfiLocator.generateFromRange,
5077
- locator: w.locator,
5076
+ getSelection: S.getSelection,
5077
+ isSelecting: S.isSelecting,
5078
+ normalizeEventForViewport: S.normalizeEventForViewport,
5079
+ getCfiMetaInformation: S.cfiLocator.getCfiMetaInformation,
5080
+ resolveCfi: S.cfiLocator.resolveCfi,
5081
+ generateCfi: S.cfiLocator.generateFromRange,
5082
+ locator: S.locator,
5078
5083
  getCurrentNavigationPosition: m.getCurrentNavigationPosition,
5079
5084
  getCurrentViewportPosition: m.getCurrentViewportPosition,
5080
5085
  layout: h,
@@ -5088,9 +5093,9 @@ const Xe = (e) => {
5088
5093
  ready$: r.asObservable(),
5089
5094
  selection$: s.asObservable(),
5090
5095
  viewportState$: m.$.state$,
5091
- layout$: w.$.layout$,
5092
- itemsCreated$: w.$.itemsCreated$,
5093
- itemsBeforeDestroy$: w.$.itemsBeforeDestroy$,
5096
+ layout$: S.$.layout$,
5097
+ itemsCreated$: S.$.itemsCreated$,
5098
+ itemsBeforeDestroy$: S.$.itemsBeforeDestroy$,
5094
5099
  itemIsReady$: g.$.itemIsReady$,
5095
5100
  destroy$: i
5096
5101
  },
@@ -5100,15 +5105,15 @@ const Xe = (e) => {
5100
5105
  spineItemManager: g
5101
5106
  }
5102
5107
  };
5103
- }, Hr = (e) => {
5108
+ }, Br = (e) => {
5104
5109
  const t = e.ownerDocument.createElement("div");
5105
5110
  return t.style.cssText = `
5106
5111
  background-color: white;
5107
5112
  position: relative;
5108
5113
  `, t.className = `${Ve}-reader`, t;
5109
- }, Br = (e) => {
5114
+ }, Yr = (e) => {
5110
5115
  const t = e.ownerDocument.createElement("div");
5111
- return t.id = Wr, t.style.cssText = `
5116
+ return t.id = Hr, t.style.cssText = `
5112
5117
  position: absolute;
5113
5118
  height: 100%;
5114
5119
  width: 100%;
@@ -5116,11 +5121,11 @@ const Xe = (e) => {
5116
5121
  left: 0;
5117
5122
  z-index: -1;
5118
5123
  `, t;
5119
- }, Yr = (e) => (t) => ({
5124
+ }, Xr = (e) => (t) => ({
5120
5125
  ...e(t),
5121
5126
  utils: {
5122
5127
  isOrIsWithinValidLink: (r) => {
5123
- if (tr(r)) {
5128
+ if (nr(r)) {
5124
5129
  const i = r.nodeName === "a" ? r : r.closest("a");
5125
5130
  if (i != null && i.getAttribute("href"))
5126
5131
  return !0;
@@ -5128,7 +5133,7 @@ const Xe = (e) => {
5128
5133
  return !1;
5129
5134
  }
5130
5135
  }
5131
- }), Xr = (e) => ({
5136
+ }), qr = (e) => ({
5132
5137
  put: (i, s) => new Promise((a, c) => {
5133
5138
  const u = e.transaction(["store"], "readwrite");
5134
5139
  u.onerror = function(f) {
@@ -5186,11 +5191,11 @@ const Xe = (e) => {
5186
5191
  o.onerror = function(r) {
5187
5192
  n(r);
5188
5193
  }, o.onsuccess = function() {
5189
- t(Xr(o.result));
5194
+ t(qr(o.result));
5190
5195
  }, o.onupgradeneeded = () => {
5191
5196
  o.result.createObjectStore("store");
5192
5197
  };
5193
- }), qr = (e) => {
5198
+ }), Gr = (e) => {
5194
5199
  let t = Date.now().toString();
5195
5200
  const n = new H(), o = (c) => {
5196
5201
  var u, d;
@@ -5246,8 +5251,8 @@ const Xe = (e) => {
5246
5251
  n.complete();
5247
5252
  }
5248
5253
  };
5249
- }, Gr = (e) => (t) => {
5250
- const n = e(t), o = qr(n.context), r = (s, a) => {
5254
+ }, Zr = (e) => (t) => {
5255
+ const n = e(t), o = Gr(n.context), r = (s, a) => {
5251
5256
  n.load(s, {
5252
5257
  ...a
5253
5258
  });
@@ -5259,7 +5264,7 @@ const Xe = (e) => {
5259
5264
  },
5260
5265
  load: r
5261
5266
  };
5262
- }, Zr = (e) => (t) => {
5267
+ }, Jr = (e) => (t) => {
5263
5268
  const n = e(t), o = new IntersectionObserver(
5264
5269
  (s) => {
5265
5270
  s.forEach((a) => {
@@ -5301,14 +5306,14 @@ const Xe = (e) => {
5301
5306
  o.disconnect(), r.disconnect(), n.destroy();
5302
5307
  }
5303
5308
  };
5304
- }, Jr = (e) => (t) => {
5309
+ }, Kr = (e) => (t) => {
5305
5310
  const n = e(t), o = (s, a, c, u, d, l) => {
5306
- var C, N, $, w, m, h;
5307
- const f = ((C = s.getManifest()) == null ? void 0 : C.renditionLayout) === "pre-paginated", g = ((N = s.getManifest()) == null ? void 0 : N.spineItems.length) || 0, y = (($ = s.getManifest()) == null ? void 0 : $.spineItems.slice(0, a).reduce((b, x) => b + x.progressionWeight, 0)) || 0, v = ((m = (w = s.getManifest()) == null ? void 0 : w.spineItems[a]) == null ? void 0 : m.progressionWeight) || 0;
5308
- let S = (u + 1) * (v / c);
5309
- !f && l.item.renditionLayout === "reflowable" && !l.isReady() && (S = 0);
5310
- let p = y + S;
5311
- return ((h = s.getManifest()) == null ? void 0 : h.renditionFlow) === "scrolled-continuous" && (l.isReady() ? S = i(s, d, l) : S = 0, p = r(y, v, S)), a === g - 1 && u === c - 1 && p > 0.99 ? 1 : p;
5311
+ var C, N, I, S, m, h;
5312
+ const f = ((C = s.getManifest()) == null ? void 0 : C.renditionLayout) === "pre-paginated", g = ((N = s.getManifest()) == null ? void 0 : N.spineItems.length) || 0, y = ((I = s.getManifest()) == null ? void 0 : I.spineItems.slice(0, a).reduce((b, x) => b + x.progressionWeight, 0)) || 0, v = ((m = (S = s.getManifest()) == null ? void 0 : S.spineItems[a]) == null ? void 0 : m.progressionWeight) || 0;
5313
+ let w = (u + 1) * (v / c);
5314
+ !f && l.item.renditionLayout === "reflowable" && !l.isReady() && (w = 0);
5315
+ let p = y + w;
5316
+ return ((h = s.getManifest()) == null ? void 0 : h.renditionFlow) === "scrolled-continuous" && (l.isReady() ? w = i(s, d, l) : w = 0, p = r(y, v, w)), a === g - 1 && u === c - 1 && p > 0.99 ? 1 : p;
5312
5317
  }, r = (s, a, c) => s + a * c, i = (s, a, c) => {
5313
5318
  const { height: u, width: d } = c.getElementDimensions(), { topStart: l, leftStart: f } = n.getAbsolutePositionOf(c);
5314
5319
  return s.getSettings().computedPageTurnDirection === "vertical" ? Math.max(0, Math.min(1, (a.y - l + s.getVisibleAreaRect().height) / u)) : Math.max(0, Math.min(1, (a.x - f + s.getVisibleAreaRect().width) / d));
@@ -5320,7 +5325,7 @@ const Xe = (e) => {
5320
5325
  getScrollPercentageWithinItem: i
5321
5326
  }
5322
5327
  };
5323
- }, Kr = (e) => (t) => {
5328
+ }, Qr = (e) => (t) => {
5324
5329
  const n = e(t), o = new IntersectionObserver((r) => {
5325
5330
  r.forEach((i) => {
5326
5331
  i.isIntersecting ? i.target.removeAttribute("tab-index") : i.target.setAttribute("tab-index", "-1");
@@ -5348,7 +5353,7 @@ const Xe = (e) => {
5348
5353
  }), {
5349
5354
  ...n
5350
5355
  };
5351
- }, Qr = navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1, ei = (e) => (t) => {
5356
+ }, ei = navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1, ti = (e) => (t) => {
5352
5357
  const n = [
5353
5358
  {
5354
5359
  name: "viewportNavigator.onBeforeContainerCreated",
@@ -5368,15 +5373,15 @@ const Xe = (e) => {
5368
5373
  ];
5369
5374
  return e({
5370
5375
  ...t,
5371
- ...Qr && {
5376
+ ...ei && {
5372
5377
  hooks: [...t.hooks || [], ...n]
5373
5378
  }
5374
5379
  });
5375
- }, ti = `${Ve}-enhancer-loading`, ni = `${ti}-container`, oi = (e) => (t) => {
5376
- const { loadingElementCreate: n = ii, ...o } = t, r = e(o), i = (d) => J(
5380
+ }, ni = `${Ve}-enhancer-loading`, oi = `${ni}-container`, ri = (e) => (t) => {
5381
+ const { loadingElementCreate: n = si, ...o } = t, r = e(o), i = (d) => J(
5377
5382
  d.reduce((l, { item: f, element: g }) => {
5378
5383
  const y = n({
5379
- container: ri(g, r.context),
5384
+ container: ii(g, r.context),
5380
5385
  item: f
5381
5386
  });
5382
5387
  return g.appendChild(y), {
@@ -5384,7 +5389,7 @@ const Xe = (e) => {
5384
5389
  [f.id]: y
5385
5390
  };
5386
5391
  }, {})
5387
- ), s = (d) => Ie([r.$.layout$, r.theme.$.theme$]).pipe(
5392
+ ), s = (d) => $e([r.$.layout$, r.theme.$.theme$]).pipe(
5388
5393
  k(([, l]) => ({
5389
5394
  width: r.context.getVisibleAreaRect().width,
5390
5395
  theme: l
@@ -5419,9 +5424,9 @@ const Xe = (e) => {
5419
5424
  }
5420
5425
  }
5421
5426
  };
5422
- }, ri = (e, t) => {
5427
+ }, ii = (e, t) => {
5423
5428
  const n = e.ownerDocument.createElement("div");
5424
- return n.classList.add(ni), n.style.cssText = `
5429
+ return n.classList.add(oi), n.style.cssText = `
5425
5430
  height: 100%;
5426
5431
  width: 100%;
5427
5432
  max-width: ${t.getVisibleAreaRect().width}px;
@@ -5436,7 +5441,7 @@ const Xe = (e) => {
5436
5441
  color: rgb(202, 202, 202);
5437
5442
  -background-color: white;
5438
5443
  `, n;
5439
- }, ii = ({ container: e, item: t }) => {
5444
+ }, si = ({ container: e, item: t }) => {
5440
5445
  const n = e.ownerDocument.createElement("div");
5441
5446
  n.innerText = "prose", n.style.cssText = `
5442
5447
  font-size: 4em;
@@ -5468,37 +5473,37 @@ const Xe = (e) => {
5468
5473
  } = e;
5469
5474
  return g;
5470
5475
  }, Tt = tn(
5471
- Jr,
5476
+ Kr,
5472
5477
  Ro,
5473
5478
  yo,
5474
5479
  Do,
5475
5480
  Fo,
5476
5481
  Pn,
5477
- Zr,
5482
+ Jr,
5478
5483
  Vo,
5479
5484
  xo,
5480
- Yr,
5481
- Gr,
5482
- Kr,
5485
+ Xr,
5486
+ Zr,
5487
+ Qr,
5483
5488
  Co,
5484
5489
  ho,
5485
- ei,
5486
- oi
5490
+ ti,
5491
+ ri
5487
5492
  );
5488
- function ui(e, t) {
5493
+ function li(e, t) {
5489
5494
  if (!t) {
5490
- const r = Tt(It);
5495
+ const r = Tt($t);
5491
5496
  return xt(r(e));
5492
5497
  }
5493
- const o = tn(Tt, t)(It);
5498
+ const o = tn(Tt, t)($t);
5494
5499
  return xt(o(e));
5495
5500
  }
5496
5501
  export {
5497
5502
  R as Report,
5498
5503
  _o as compose,
5499
5504
  tn as composeEnhancer,
5500
- ui as createReader,
5501
- ci as groupBy,
5505
+ li as createReader,
5506
+ ui as groupBy,
5502
5507
  ce as isShallowEqual
5503
5508
  };
5504
5509
  //# sourceMappingURL=prose.js.map