@prose-reader/core 1.273.0 → 1.274.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +255 -245
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +18 -18
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { switchMap as w, of as v, fromEvent as X, take as
|
|
2
|
-
import { Report as dn, isShallowEqual as O, shallowMergeIfDefined as
|
|
1
|
+
import { switchMap as w, of as v, fromEvent as X, take as Tt, map as S, from as k, takeUntil as T, Observable as ce, defer as We, Subject as N, combineLatest as j, merge as P, EMPTY as _, NEVER as he, tap as x, share as A, BehaviorSubject as q, distinctUntilChanged as R, filter as C, mergeMap as ge, first as U, endWith as fe, catchError as Pe, finalize as me, lastValueFrom as nn, scheduled as on, animationFrameScheduler as re, exhaustMap as sn, debounceTime as Ie, withLatestFrom as z, throttleTime as rn, startWith as ne, shareReplay as J, switchScan as an, defaultIfEmpty as cn, forkJoin as un, delay as xe, timer as Fe, skip as Ft, ReplaySubject as st, identity as $e, concatMap as ln } from "rxjs";
|
|
2
|
+
import { Report as dn, isShallowEqual as O, shallowMergeIfDefined as Te, getParentPath as pn, parseContentType as gn, detectMimeTypeFromName as Ce, arrayEqual as hn } from "@prose-reader/shared";
|
|
3
3
|
import { isShallowEqual as nr } from "@prose-reader/shared";
|
|
4
|
-
import { switchMap as Y, first as mn, map as ie, distinctUntilChanged as be, startWith as fn, shareReplay as
|
|
5
|
-
import { generate as
|
|
6
|
-
const $n = "@prose-reader/core",
|
|
4
|
+
import { switchMap as Y, first as mn, map as ie, distinctUntilChanged as be, startWith as fn, shareReplay as Ze, tap as V, pairwise as yn, take as Sn, takeUntil as K, filter as pe, debounceTime as In, skip as Lt, mergeMap as bn, catchError as rt, share as vn } from "rxjs/operators";
|
|
5
|
+
import { generate as _e, parse as Mt, isIndirectionOnly as wn, isParsedCfiRange as Pn, resolve as xn } from "@prose-reader/cfi";
|
|
6
|
+
const $n = "@prose-reader/core", D = dn.namespace($n, void 0, {
|
|
7
7
|
color: "#98cde7"
|
|
8
8
|
}), Tn = [
|
|
9
9
|
"pointercancel",
|
|
@@ -27,7 +27,7 @@ function Fn(n, e, t) {
|
|
|
27
27
|
const Ln = (n, e) => {
|
|
28
28
|
const t = "createRange" in n ? n : n.ownerDocument;
|
|
29
29
|
if (!t) return;
|
|
30
|
-
const i = "body" in n ?
|
|
30
|
+
const i = "body" in n ? He(n.body, e) : He(n, e);
|
|
31
31
|
if (i) {
|
|
32
32
|
let o, s = 0;
|
|
33
33
|
const r = t.createRange();
|
|
@@ -49,7 +49,7 @@ const Ln = (n, e) => {
|
|
|
49
49
|
offset: s
|
|
50
50
|
} : { node: i, offset: 0 };
|
|
51
51
|
}
|
|
52
|
-
},
|
|
52
|
+
}, He = (n, e) => {
|
|
53
53
|
const t = n.getBoundingClientRect(), i = Ct(
|
|
54
54
|
t,
|
|
55
55
|
e
|
|
@@ -57,7 +57,7 @@ const Ln = (n, e) => {
|
|
|
57
57
|
let o;
|
|
58
58
|
i !== "before" && i !== "after" && (o = n);
|
|
59
59
|
for (const s of n.children) {
|
|
60
|
-
const r =
|
|
60
|
+
const r = He(s, e);
|
|
61
61
|
if (r)
|
|
62
62
|
return r;
|
|
63
63
|
}
|
|
@@ -79,11 +79,11 @@ const Cn = (n, e) => {
|
|
|
79
79
|
try {
|
|
80
80
|
e <= (t?.endOffset || 0) && t?.setStart(n, e || 0);
|
|
81
81
|
} catch (i) {
|
|
82
|
-
|
|
82
|
+
D.error(i);
|
|
83
83
|
}
|
|
84
84
|
return t;
|
|
85
85
|
}
|
|
86
|
-
},
|
|
86
|
+
}, Je = (n) => {
|
|
87
87
|
if (n?.target && n?.target?.ownerDocument?.defaultView) {
|
|
88
88
|
const e = n?.target?.ownerDocument?.defaultView;
|
|
89
89
|
if (e.PointerEvent && n instanceof e.PointerEvent)
|
|
@@ -96,7 +96,7 @@ const Cn = (n, e) => {
|
|
|
96
96
|
}
|
|
97
97
|
return !!Tn.includes(n.type);
|
|
98
98
|
}, En = (n) => {
|
|
99
|
-
if (
|
|
99
|
+
if (Je(n)) return !1;
|
|
100
100
|
if (n?.target && n?.target?.ownerDocument?.defaultView) {
|
|
101
101
|
const e = n?.target?.ownerDocument?.defaultView;
|
|
102
102
|
if (e.MouseEvent)
|
|
@@ -143,12 +143,18 @@ const Cn = (n, e) => {
|
|
|
143
143
|
}), n) {
|
|
144
144
|
const t = Array.from(n.styleSheets || []);
|
|
145
145
|
for (const i of t) {
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
const s = (() => {
|
|
147
|
+
try {
|
|
148
|
+
return Array.from(i.cssRules || []);
|
|
149
|
+
} catch (r) {
|
|
150
|
+
return D.warn(`Error getting rules for sheet: ${i.href}`, r), [];
|
|
151
|
+
}
|
|
152
|
+
})();
|
|
153
|
+
for (const r of s)
|
|
154
|
+
if (n.defaultView && r instanceof n.defaultView.CSSFontFaceRule) {
|
|
155
|
+
const c = r.style.getPropertyValue("src").match(/blob:[^,\s'")]+/g);
|
|
156
|
+
c && c.forEach((u) => {
|
|
157
|
+
n?.defaultView?.URL.revokeObjectURL(u);
|
|
152
158
|
});
|
|
153
159
|
}
|
|
154
160
|
}
|
|
@@ -188,23 +194,23 @@ function On(n) {
|
|
|
188
194
|
["setStart", "setEnd", "selectNodeContents"]
|
|
189
195
|
);
|
|
190
196
|
}
|
|
191
|
-
const
|
|
197
|
+
const Ee = (n, e, t, i) => {
|
|
192
198
|
const o = n.createElement("style");
|
|
193
199
|
return o.id = e, o.innerHTML = t, i ? n.head.prepend(o) : n.head.appendChild(o), () => {
|
|
194
|
-
|
|
200
|
+
De(n, e);
|
|
195
201
|
};
|
|
196
|
-
},
|
|
202
|
+
}, De = (n, e) => {
|
|
197
203
|
if (n?.head) {
|
|
198
204
|
const t = n.getElementById(e);
|
|
199
205
|
t && t.remove();
|
|
200
206
|
}
|
|
201
|
-
},
|
|
207
|
+
}, at = (n, e) => {
|
|
202
208
|
const t = new RegExp(`${e}\\s*=\\s*([0-9.]+)`, "i"), i = n.match(t) || [], o = i[1] || "0";
|
|
203
209
|
return i && Number.parseFloat(o) || 0;
|
|
204
210
|
}, Vn = (n, e, t, i) => {
|
|
205
|
-
n?.contentDocument?.head &&
|
|
211
|
+
n?.contentDocument?.head && Ee(n.contentDocument, e, t, i);
|
|
206
212
|
}, _s = (n, e) => {
|
|
207
|
-
n?.contentDocument &&
|
|
213
|
+
n?.contentDocument && De(n.contentDocument, e);
|
|
208
214
|
}, oe = (n, e, t, i) => {
|
|
209
215
|
if (!n) return;
|
|
210
216
|
const o = n?.contentDocument?.getElementById(
|
|
@@ -215,13 +221,13 @@ const Ce = (n, e, t, i) => {
|
|
|
215
221
|
return;
|
|
216
222
|
}
|
|
217
223
|
Vn(n, e, t, i);
|
|
218
|
-
},
|
|
224
|
+
}, Ke = (n) => {
|
|
219
225
|
if (n?.contentDocument) {
|
|
220
226
|
const t = n.contentDocument.querySelector("meta[name='viewport']");
|
|
221
227
|
if (t) {
|
|
222
228
|
const i = t.getAttribute("content");
|
|
223
229
|
if (i) {
|
|
224
|
-
const o =
|
|
230
|
+
const o = at(i, "width"), s = at(i, "height");
|
|
225
231
|
return o > 0 && s > 0 ? {
|
|
226
232
|
hasViewport: !0,
|
|
227
233
|
width: o,
|
|
@@ -233,7 +239,7 @@ const Ce = (n, e, t, i) => {
|
|
|
233
239
|
return { hasViewport: !1 };
|
|
234
240
|
}, jn = (n) => n.pipe(
|
|
235
241
|
w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : X(e, "load").pipe(
|
|
236
|
-
|
|
242
|
+
Tt(1),
|
|
237
243
|
S(() => e)
|
|
238
244
|
))
|
|
239
245
|
), kn = (n) => n.pipe(
|
|
@@ -288,7 +294,7 @@ const Ce = (n, e, t, i) => {
|
|
|
288
294
|
const s = t.spineItemsManager.get(i)?.renderer.getDocumentFrame();
|
|
289
295
|
s && s.contentDocument?.body.setAttribute("tabindex", "-1");
|
|
290
296
|
}), t;
|
|
291
|
-
},
|
|
297
|
+
}, Re = ({
|
|
292
298
|
position: n,
|
|
293
299
|
frameElement: e
|
|
294
300
|
}) => {
|
|
@@ -302,8 +308,8 @@ const Ce = (n, e, t, i) => {
|
|
|
302
308
|
if (!e || !o) return n;
|
|
303
309
|
const s = t.getSpineItemFromIframe(o), r = o, { height: a, width: c } = i.pageSize;
|
|
304
310
|
if (!s || !(r instanceof HTMLIFrameElement)) return n;
|
|
305
|
-
if (
|
|
306
|
-
const { clientX: u, clientY: l } =
|
|
311
|
+
if (Je(n)) {
|
|
312
|
+
const { clientX: u, clientY: l } = Re({
|
|
307
313
|
position: n,
|
|
308
314
|
frameElement: r
|
|
309
315
|
}), d = new PointerEvent(n.type, {
|
|
@@ -318,7 +324,7 @@ const Ce = (n, e, t, i) => {
|
|
|
318
324
|
}), d;
|
|
319
325
|
}
|
|
320
326
|
if (En(n)) {
|
|
321
|
-
const { clientX: u, clientY: l } =
|
|
327
|
+
const { clientX: u, clientY: l } = Re({
|
|
322
328
|
position: n,
|
|
323
329
|
frameElement: r
|
|
324
330
|
}), d = new MouseEvent(n.type, {
|
|
@@ -333,7 +339,7 @@ const Ce = (n, e, t, i) => {
|
|
|
333
339
|
}
|
|
334
340
|
if (Dn(n)) {
|
|
335
341
|
const u = Array.from(n.touches).map((d) => {
|
|
336
|
-
const { clientX: g, clientY: p } =
|
|
342
|
+
const { clientX: g, clientY: p } = Re({
|
|
337
343
|
position: d,
|
|
338
344
|
frameElement: r
|
|
339
345
|
});
|
|
@@ -376,7 +382,7 @@ const Ce = (n, e, t, i) => {
|
|
|
376
382
|
const a = Hn.map((c) => {
|
|
377
383
|
const u = (l) => {
|
|
378
384
|
let d = l;
|
|
379
|
-
if (
|
|
385
|
+
if (Je(l) && (d = new PointerEvent(l.type, l)), d !== l) {
|
|
380
386
|
const g = Wn(
|
|
381
387
|
d,
|
|
382
388
|
l,
|
|
@@ -414,8 +420,8 @@ const Ce = (n, e, t, i) => {
|
|
|
414
420
|
[i]: o
|
|
415
421
|
} : t,
|
|
416
422
|
{}
|
|
417
|
-
), Nt = (n) => ie((e) => Xn(e, n)),
|
|
418
|
-
function
|
|
423
|
+
), Nt = (n) => ie((e) => Xn(e, n)), Qe = (n) => (e) => e.pipe(Nt(n), be(O));
|
|
424
|
+
function et(n) {
|
|
419
425
|
return new ce((e) => {
|
|
420
426
|
const t = new ResizeObserver((i) => {
|
|
421
427
|
e.next(i);
|
|
@@ -425,7 +431,7 @@ function Qe(n) {
|
|
|
425
431
|
};
|
|
426
432
|
});
|
|
427
433
|
}
|
|
428
|
-
const
|
|
434
|
+
const Ae = (n) => (e) => e.pipe(
|
|
429
435
|
Y(
|
|
430
436
|
(t) => n.pipe(
|
|
431
437
|
mn(),
|
|
@@ -439,7 +445,7 @@ const De = (n) => (e) => e.pipe(
|
|
|
439
445
|
});
|
|
440
446
|
return () => (t.unsubscribe(), e ? v(e.result) : n);
|
|
441
447
|
};
|
|
442
|
-
function
|
|
448
|
+
function tt() {
|
|
443
449
|
return new ce((n) => {
|
|
444
450
|
if (window.requestIdleCallback) {
|
|
445
451
|
const t = window.requestIdleCallback(() => {
|
|
@@ -453,10 +459,10 @@ function et() {
|
|
|
453
459
|
return () => clearTimeout(e);
|
|
454
460
|
});
|
|
455
461
|
}
|
|
456
|
-
function
|
|
457
|
-
return
|
|
462
|
+
function ct(n) {
|
|
463
|
+
return We(() => tt().pipe(Y(n)));
|
|
458
464
|
}
|
|
459
|
-
const
|
|
465
|
+
const ut = (n, e) => new ce((t) => {
|
|
460
466
|
const i = new MutationObserver((o) => {
|
|
461
467
|
t.next(o);
|
|
462
468
|
});
|
|
@@ -475,11 +481,11 @@ function Bs(n, e) {
|
|
|
475
481
|
class Rt {
|
|
476
482
|
constructor(e, t) {
|
|
477
483
|
this.settingsManager = t;
|
|
478
|
-
const i =
|
|
484
|
+
const i = Te(
|
|
479
485
|
this.getDefaultSettings(),
|
|
480
486
|
e
|
|
481
487
|
);
|
|
482
|
-
this.outputSettings = this.computeOutputSettings(i), this.inputSettings =
|
|
488
|
+
this.outputSettings = this.computeOutputSettings(i), this.inputSettings = Te(
|
|
483
489
|
this.getDefaultSettings(),
|
|
484
490
|
e
|
|
485
491
|
), this.outputSettingsUpdateSubject = new N(), this.values$ = j([
|
|
@@ -487,11 +493,11 @@ class Rt {
|
|
|
487
493
|
this.outputSettingsUpdateSubject.pipe(fn(this.outputSettings))
|
|
488
494
|
]).pipe(
|
|
489
495
|
ie(([o, s]) => ({ ...o, ...s })),
|
|
490
|
-
|
|
496
|
+
Ze(1)
|
|
491
497
|
), this.values$.subscribe();
|
|
492
498
|
}
|
|
493
499
|
_prepareUpdate(e) {
|
|
494
|
-
const t = this.getCleanedParentInputSettings(e), i = this.settingsManager._prepareUpdate(t), o =
|
|
500
|
+
const t = this.getCleanedParentInputSettings(e), i = this.settingsManager._prepareUpdate(t), o = Te(this.inputSettings, e), s = this.computeOutputSettings(o), r = this.hasSettingsChanged(s);
|
|
495
501
|
return {
|
|
496
502
|
hasChanged: r || i.hasChanged,
|
|
497
503
|
commit: () => (this.inputSettings = o, this.outputSettings = s, !i.hasChanged && r && this.outputSettingsUpdateSubject.next(s), {
|
|
@@ -511,7 +517,7 @@ class Rt {
|
|
|
511
517
|
};
|
|
512
518
|
}
|
|
513
519
|
watch(e) {
|
|
514
|
-
return Array.isArray(e) ? this.values$.pipe(
|
|
520
|
+
return Array.isArray(e) ? this.values$.pipe(Qe(e)) : this.values$.pipe(
|
|
515
521
|
ie((t) => t[e]),
|
|
516
522
|
be(O)
|
|
517
523
|
);
|
|
@@ -649,7 +655,7 @@ const Gn = (n) => (e) => {
|
|
|
649
655
|
x((e) => {
|
|
650
656
|
e.preventDefault();
|
|
651
657
|
}),
|
|
652
|
-
|
|
658
|
+
A()
|
|
653
659
|
);
|
|
654
660
|
class Q extends ce {
|
|
655
661
|
constructor(e) {
|
|
@@ -666,7 +672,7 @@ class Q extends ce {
|
|
|
666
672
|
O(this.value, t) || this.stateSubject.next(t);
|
|
667
673
|
}
|
|
668
674
|
watch(e) {
|
|
669
|
-
return Array.isArray(e) ? this.stateSubject.pipe(
|
|
675
|
+
return Array.isArray(e) ? this.stateSubject.pipe(Qe(e)) : this.stateSubject.pipe(
|
|
670
676
|
S((t) => t[e]),
|
|
671
677
|
R(O)
|
|
672
678
|
);
|
|
@@ -678,7 +684,7 @@ class Q extends ce {
|
|
|
678
684
|
this.stateSubject.complete(), this._destroy$.complete();
|
|
679
685
|
}
|
|
680
686
|
}
|
|
681
|
-
const
|
|
687
|
+
const Me = class Me extends Q {
|
|
682
688
|
constructor(e) {
|
|
683
689
|
super({
|
|
684
690
|
state: "idle",
|
|
@@ -698,7 +704,7 @@ const Le = class Le extends Q {
|
|
|
698
704
|
fe(null),
|
|
699
705
|
U()
|
|
700
706
|
).pipe(
|
|
701
|
-
|
|
707
|
+
Ae(this.context.bridgeEvent.viewportFree$),
|
|
702
708
|
w(() => {
|
|
703
709
|
const c = this.hookManager.execute("item.onDocumentLoad", this.item.id, {
|
|
704
710
|
itemId: this.item.id,
|
|
@@ -714,25 +720,29 @@ const Le = class Le extends Q {
|
|
|
714
720
|
}),
|
|
715
721
|
T(t)
|
|
716
722
|
))),
|
|
717
|
-
|
|
723
|
+
A()
|
|
718
724
|
), this.unloaded$ = t.pipe(
|
|
719
725
|
ge(() => this.value.state === "unloading" || this.value.state === "idle" ? _ : (this.next({ state: "unloading", error: void 0 }), this.context.bridgeEvent.viewportFree$.pipe(
|
|
720
726
|
U(),
|
|
721
|
-
w(() => (this.hookManager.destroy("item.onDocumentLoad", this.item.id), this.onUnload().pipe(
|
|
727
|
+
w(() => (this.hookManager.destroy("item.onDocumentLoad", this.item.id), We(() => this.onUnload()).pipe(
|
|
728
|
+
fe(null),
|
|
729
|
+
U(),
|
|
730
|
+
Pe((r) => (D.error("Error unloading document", r), v(null)))
|
|
731
|
+
))),
|
|
722
732
|
S(() => {
|
|
723
733
|
this.next({ state: "idle", error: void 0 });
|
|
724
734
|
}),
|
|
725
735
|
T(i)
|
|
726
736
|
))),
|
|
727
|
-
|
|
737
|
+
A()
|
|
728
738
|
), P(this.loaded$, this.unloaded$).pipe(
|
|
729
|
-
|
|
739
|
+
Pe((o) => (this.next({ state: "error", error: o }), _)),
|
|
730
740
|
T(this.destroy$)
|
|
731
741
|
).subscribe();
|
|
732
742
|
}
|
|
733
743
|
setDocumentContainer(e) {
|
|
734
744
|
this._documentContainer = e, this._documentContainer.classList.add(
|
|
735
|
-
|
|
745
|
+
Me.DOCUMENT_CONTAINER_CLASS_NAME
|
|
736
746
|
);
|
|
737
747
|
}
|
|
738
748
|
attach() {
|
|
@@ -758,7 +768,7 @@ const Le = class Le extends Q {
|
|
|
758
768
|
*/
|
|
759
769
|
renderHeadless() {
|
|
760
770
|
const e = new N();
|
|
761
|
-
return
|
|
771
|
+
return We(() => this.onRenderHeadless({ release: e })).pipe(
|
|
762
772
|
fe(void 0),
|
|
763
773
|
U(),
|
|
764
774
|
S((t) => {
|
|
@@ -773,7 +783,7 @@ const Le = class Le extends Q {
|
|
|
773
783
|
me(() => {
|
|
774
784
|
e.complete();
|
|
775
785
|
}),
|
|
776
|
-
|
|
786
|
+
Pe((t) => (D.error(t), v(void 0)))
|
|
777
787
|
);
|
|
778
788
|
}
|
|
779
789
|
layout(e) {
|
|
@@ -794,16 +804,16 @@ const Le = class Le extends Q {
|
|
|
794
804
|
if (e) return e;
|
|
795
805
|
const t = this.getDocumentFrame();
|
|
796
806
|
if (t) {
|
|
797
|
-
const { hasViewport: i } =
|
|
807
|
+
const { hasViewport: i } = Ke(t);
|
|
798
808
|
if (i) return "pre-paginated";
|
|
799
809
|
}
|
|
800
810
|
return this.context.manifest?.renditionLayout ?? "reflowable";
|
|
801
811
|
}
|
|
802
812
|
};
|
|
803
|
-
|
|
804
|
-
let ye =
|
|
813
|
+
Me.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
|
|
814
|
+
let ye = Me;
|
|
805
815
|
const Kn = (n) => new URL(n.href);
|
|
806
|
-
class
|
|
816
|
+
class nt {
|
|
807
817
|
constructor(e, t) {
|
|
808
818
|
this.item = e, this.settings = t;
|
|
809
819
|
}
|
|
@@ -841,7 +851,7 @@ const Ot = (n, e) => {
|
|
|
841
851
|
`${I.toLowerCase()}`
|
|
842
852
|
));
|
|
843
853
|
if (f) {
|
|
844
|
-
const I = new
|
|
854
|
+
const I = new nt(f, o);
|
|
845
855
|
try {
|
|
846
856
|
const b = await I.getResource();
|
|
847
857
|
if (b instanceof Response) {
|
|
@@ -875,7 +885,7 @@ const Ot = (n, e) => {
|
|
|
875
885
|
`${c.toLowerCase()}`
|
|
876
886
|
));
|
|
877
887
|
if (!r) return v(null);
|
|
878
|
-
const a = new
|
|
888
|
+
const a = new nt(r, o);
|
|
879
889
|
return k(a.getResource()).pipe(
|
|
880
890
|
ge(
|
|
881
891
|
(c) => c instanceof Response ? k(c.blob()) : v(void 0)
|
|
@@ -928,7 +938,7 @@ const Ot = (n, e) => {
|
|
|
928
938
|
Nn(n?.contentDocument);
|
|
929
939
|
}, Ys = "@prose-reader/core", qs = 0, Gs = 200, ii = [".xhtml", ".html", ".htm"], W = "prose-reader", Vt = `${W}-style`, oi = `data-${W}-id`, si = `${W}-viewport`, ri = `${W}-scroll-navigator`, ai = async (n, e) => {
|
|
930
940
|
if (typeof n == "string") return n;
|
|
931
|
-
const t = gn(n.headers.get("Content-Type") || "") ||
|
|
941
|
+
const t = gn(n.headers.get("Content-Type") || "") || Ce(e.href);
|
|
932
942
|
if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
|
|
933
943
|
(o) => o === t
|
|
934
944
|
)) {
|
|
@@ -993,10 +1003,10 @@ const Ot = (n, e) => {
|
|
|
993
1003
|
}
|
|
994
1004
|
}),
|
|
995
1005
|
S(() => o),
|
|
996
|
-
|
|
1006
|
+
Pe((a) => (D.error(
|
|
997
1007
|
`Error while trying to fetch or load resource for item ${n.id}`,
|
|
998
1008
|
s
|
|
999
|
-
),
|
|
1009
|
+
), D.error(a), v(o)))
|
|
1000
1010
|
))
|
|
1001
1011
|
))
|
|
1002
1012
|
);
|
|
@@ -1020,7 +1030,7 @@ const Ot = (n, e) => {
|
|
|
1020
1030
|
pageWidth: e,
|
|
1021
1031
|
frameElement: t
|
|
1022
1032
|
}) => {
|
|
1023
|
-
const i =
|
|
1033
|
+
const i = Ke(t);
|
|
1024
1034
|
if (t?.contentDocument && t.contentWindow && i) {
|
|
1025
1035
|
const o = e / (i.width ?? 1);
|
|
1026
1036
|
return { computedScale: Math.min(
|
|
@@ -1028,7 +1038,7 @@ const Ot = (n, e) => {
|
|
|
1028
1038
|
n / (i.height ?? 1)
|
|
1029
1039
|
), computedWidthScale: o, viewportDimensions: i };
|
|
1030
1040
|
}
|
|
1031
|
-
},
|
|
1041
|
+
}, lt = (n, e) => {
|
|
1032
1042
|
n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
|
|
1033
1043
|
}, di = ({
|
|
1034
1044
|
minPageSpread: n,
|
|
@@ -1045,10 +1055,10 @@ const Ot = (n, e) => {
|
|
|
1045
1055
|
if (s.contentDocument?.documentElement && s.contentDocument?.documentElement.setAttribute(
|
|
1046
1056
|
"data-prose-reader-html-renderer-has-viewport-dimensions",
|
|
1047
1057
|
l.toString()
|
|
1048
|
-
), c ?
|
|
1058
|
+
), c ? lt(s, {
|
|
1049
1059
|
width: c.width ?? 1,
|
|
1050
1060
|
height: c.height ?? 1
|
|
1051
|
-
}) :
|
|
1061
|
+
}) : lt(s, {
|
|
1052
1062
|
width: d,
|
|
1053
1063
|
height: g
|
|
1054
1064
|
}), c) {
|
|
@@ -1270,7 +1280,7 @@ const Ot = (n, e) => {
|
|
|
1270
1280
|
};
|
|
1271
1281
|
class yi extends ye {
|
|
1272
1282
|
constructor() {
|
|
1273
|
-
super(...arguments), this.isPrePaginated = () => this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated", this.isImageType = () => !!(this.item.mediaType ??
|
|
1283
|
+
super(...arguments), this.isPrePaginated = () => this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated", this.isImageType = () => !!(this.item.mediaType ?? Ce(this.item.href))?.startsWith("image/");
|
|
1274
1284
|
}
|
|
1275
1285
|
onCreateDocument() {
|
|
1276
1286
|
const e = ui();
|
|
@@ -1285,7 +1295,7 @@ class yi extends ye {
|
|
|
1285
1295
|
resourcesHandler: this.resourcesHandler,
|
|
1286
1296
|
settings: this.settings
|
|
1287
1297
|
}),
|
|
1288
|
-
|
|
1298
|
+
Ae(this.context.bridgeEvent.viewportFree$),
|
|
1289
1299
|
x(() => {
|
|
1290
1300
|
this.attach();
|
|
1291
1301
|
}),
|
|
@@ -1419,7 +1429,7 @@ const Si = (n) => (e) => {
|
|
|
1419
1429
|
function Z(n) {
|
|
1420
1430
|
return n != null;
|
|
1421
1431
|
}
|
|
1422
|
-
class
|
|
1432
|
+
class it {
|
|
1423
1433
|
constructor(e) {
|
|
1424
1434
|
this.left = e.left, this.right = e.right, this.top = e.top, this.bottom = e.bottom, this.width = e.width, this.height = e.height, this.x = e.x, this.y = e.y;
|
|
1425
1435
|
}
|
|
@@ -1429,22 +1439,22 @@ class E {
|
|
|
1429
1439
|
this.__symbol = /* @__PURE__ */ Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
|
|
1430
1440
|
}
|
|
1431
1441
|
}
|
|
1432
|
-
class
|
|
1442
|
+
class Oe {
|
|
1433
1443
|
constructor(e) {
|
|
1434
1444
|
this.__symbol = /* @__PURE__ */ Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
|
|
1435
1445
|
}
|
|
1436
1446
|
}
|
|
1437
|
-
class Ii extends
|
|
1447
|
+
class Ii extends it {
|
|
1438
1448
|
constructor() {
|
|
1439
1449
|
super(...arguments), this.__symbol = "SpineItemPageLayout";
|
|
1440
1450
|
}
|
|
1441
1451
|
}
|
|
1442
|
-
class
|
|
1452
|
+
class Ve extends it {
|
|
1443
1453
|
constructor() {
|
|
1444
1454
|
super(...arguments), this.__symbol = "SpineItemSpineLayout";
|
|
1445
1455
|
}
|
|
1446
1456
|
}
|
|
1447
|
-
class bi extends
|
|
1457
|
+
class bi extends it {
|
|
1448
1458
|
constructor() {
|
|
1449
1459
|
super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
|
|
1450
1460
|
}
|
|
@@ -1610,7 +1620,7 @@ const vi = (n, e) => {
|
|
|
1610
1620
|
const o = n.spineItemsManager.get(e.id), s = o?.renderer.getDocumentFrame();
|
|
1611
1621
|
if (o?.renditionLayout !== "reflowable" || !(s instanceof HTMLIFrameElement))
|
|
1612
1622
|
return;
|
|
1613
|
-
const { hasViewport: r } =
|
|
1623
|
+
const { hasViewport: r } = Ke(s), { width: a } = n.viewport.pageSize, c = o?.renderer.getDocumentFrame();
|
|
1614
1624
|
if (r) {
|
|
1615
1625
|
const u = a < i;
|
|
1616
1626
|
t === "none" && u && c instanceof HTMLIFrameElement && c?.style.setProperty(
|
|
@@ -1681,7 +1691,7 @@ const Di = (n) => j([
|
|
|
1681
1691
|
!m && f && (f.getBoundingClientRect().left, m = !0);
|
|
1682
1692
|
});
|
|
1683
1693
|
}), r.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
|
|
1684
|
-
const y = r.spineItemsManager.get(m.id), I = !!(m.mediaType ??
|
|
1694
|
+
const y = r.spineItemsManager.get(m.id), I = !!(m.mediaType ?? Ce(m.href))?.startsWith("image/"), { pageHorizontalMargin: b = 0, pageVerticalMargin: F = 0 } = a.values, $ = r.viewport.pageSize;
|
|
1685
1695
|
if (y?.renditionLayout === "reflowable" && !I) {
|
|
1686
1696
|
let L = $.width - b * 2;
|
|
1687
1697
|
const H = $.height - F * 2;
|
|
@@ -1731,7 +1741,7 @@ const Di = (n) => j([
|
|
|
1731
1741
|
pe(({ layoutAutoResize: m }) => m === "container"),
|
|
1732
1742
|
Y(() => r.context.watch("rootElement")),
|
|
1733
1743
|
pe(Z),
|
|
1734
|
-
Y((m) =>
|
|
1744
|
+
Y((m) => et(m)),
|
|
1735
1745
|
In(100),
|
|
1736
1746
|
pe(Z),
|
|
1737
1747
|
V(() => {
|
|
@@ -1746,7 +1756,7 @@ const Di = (n) => j([
|
|
|
1746
1756
|
K(r.$.destroy$)
|
|
1747
1757
|
).subscribe();
|
|
1748
1758
|
const d = r.spine.pages.pipe(
|
|
1749
|
-
|
|
1759
|
+
Ze({ refCount: !0, bufferSize: 1 })
|
|
1750
1760
|
), g = Ci(r), p = Di(r), h = Fi(r);
|
|
1751
1761
|
return P(
|
|
1752
1762
|
c,
|
|
@@ -1823,7 +1833,7 @@ const Ri = (n) => (e) => {
|
|
|
1823
1833
|
const t = n({
|
|
1824
1834
|
...e,
|
|
1825
1835
|
getRenderer(r) {
|
|
1826
|
-
const a = e.getRenderer?.(r), u = !!(r.mediaType ??
|
|
1836
|
+
const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Ce(r.href))?.startsWith("image/");
|
|
1827
1837
|
return !a && u ? (l) => new Ni(l) : a;
|
|
1828
1838
|
}
|
|
1829
1839
|
}), i = new IntersectionObserver(
|
|
@@ -1882,7 +1892,7 @@ const Ri = (n) => (e) => {
|
|
|
1882
1892
|
(r) => r.href === o
|
|
1883
1893
|
) && e.goToUrl(i);
|
|
1884
1894
|
})
|
|
1885
|
-
), ee =
|
|
1895
|
+
), ee = D.namespace("navigation"), Vi = ({
|
|
1886
1896
|
position: n,
|
|
1887
1897
|
spineItem: e,
|
|
1888
1898
|
pageHeight: t,
|
|
@@ -1900,7 +1910,7 @@ const Ri = (n) => (e) => {
|
|
|
1900
1910
|
s,
|
|
1901
1911
|
e
|
|
1902
1912
|
);
|
|
1903
|
-
},
|
|
1913
|
+
}, dt = ({
|
|
1904
1914
|
position: n,
|
|
1905
1915
|
navigationResolver: e,
|
|
1906
1916
|
computedPageTurnDirection: t,
|
|
@@ -1947,7 +1957,7 @@ const Ri = (n) => (e) => {
|
|
|
1947
1957
|
viewport: a,
|
|
1948
1958
|
settings: c
|
|
1949
1959
|
}) => {
|
|
1950
|
-
const u =
|
|
1960
|
+
const u = dt({
|
|
1951
1961
|
position: n,
|
|
1952
1962
|
viewport: a,
|
|
1953
1963
|
navigationResolver: i,
|
|
@@ -1969,7 +1979,7 @@ const Ri = (n) => (e) => {
|
|
|
1969
1979
|
);
|
|
1970
1980
|
if (r === "vertical" && n.y !== u.y)
|
|
1971
1981
|
return i.getAdjustedPositionForSpread(u);
|
|
1972
|
-
const l =
|
|
1982
|
+
const l = dt({
|
|
1973
1983
|
position: u,
|
|
1974
1984
|
viewport: a,
|
|
1975
1985
|
navigationResolver: i,
|
|
@@ -1998,7 +2008,7 @@ const Ri = (n) => (e) => {
|
|
|
1998
2008
|
s,
|
|
1999
2009
|
e
|
|
2000
2010
|
);
|
|
2001
|
-
},
|
|
2011
|
+
}, pt = ({
|
|
2002
2012
|
position: n,
|
|
2003
2013
|
navigationResolver: e,
|
|
2004
2014
|
computedPageTurnDirection: t,
|
|
@@ -2045,7 +2055,7 @@ const Ri = (n) => (e) => {
|
|
|
2045
2055
|
viewport: a,
|
|
2046
2056
|
settings: c
|
|
2047
2057
|
}) => {
|
|
2048
|
-
const u =
|
|
2058
|
+
const u = pt({
|
|
2049
2059
|
position: n,
|
|
2050
2060
|
viewport: a,
|
|
2051
2061
|
navigationResolver: i,
|
|
@@ -2070,7 +2080,7 @@ const Ri = (n) => (e) => {
|
|
|
2070
2080
|
);
|
|
2071
2081
|
if (r === "vertical" && n.y !== u.y)
|
|
2072
2082
|
return i.getAdjustedPositionForSpread(u);
|
|
2073
|
-
const l =
|
|
2083
|
+
const l = pt({
|
|
2074
2084
|
position: u,
|
|
2075
2085
|
viewport: a,
|
|
2076
2086
|
navigationResolver: i,
|
|
@@ -2636,7 +2646,7 @@ const Bi = (n) => n.pagination.state$.pipe(
|
|
|
2636
2646
|
}),
|
|
2637
2647
|
J(1)
|
|
2638
2648
|
), getPaginationInfo: () => i.value };
|
|
2639
|
-
}, de = (n) =>
|
|
2649
|
+
}, de = (n) => _e({
|
|
2640
2650
|
spineIndex: n.index,
|
|
2641
2651
|
spineId: n.id
|
|
2642
2652
|
}), Wt = ({
|
|
@@ -2645,7 +2655,7 @@ const Bi = (n) => n.pagination.state$.pipe(
|
|
|
2645
2655
|
item: t
|
|
2646
2656
|
}) => {
|
|
2647
2657
|
const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
|
|
2648
|
-
return !i || !i?.documentElement || n === i ? de(t) : On(n) ?
|
|
2658
|
+
return !i || !i?.documentElement || n === i ? de(t) : On(n) ? _e({
|
|
2649
2659
|
start: {
|
|
2650
2660
|
node: n.startContainer,
|
|
2651
2661
|
offset: n.startOffset,
|
|
@@ -2658,13 +2668,13 @@ const Bi = (n) => n.pagination.state$.pipe(
|
|
|
2658
2668
|
spineIndex: t.index,
|
|
2659
2669
|
spineId: t.id
|
|
2660
2670
|
}
|
|
2661
|
-
}) :
|
|
2671
|
+
}) : _e({
|
|
2662
2672
|
node: n,
|
|
2663
2673
|
offset: e,
|
|
2664
2674
|
spineIndex: t.index,
|
|
2665
2675
|
spineId: t.id
|
|
2666
2676
|
});
|
|
2667
|
-
},
|
|
2677
|
+
}, Be = ({
|
|
2668
2678
|
spineItem: n,
|
|
2669
2679
|
pageNode: e
|
|
2670
2680
|
}) => Wt({
|
|
@@ -2674,10 +2684,10 @@ const Bi = (n) => n.pagination.state$.pipe(
|
|
|
2674
2684
|
}).trim(), oo = (n, e) => Wt({
|
|
2675
2685
|
nodeOrRange: n,
|
|
2676
2686
|
item: e
|
|
2677
|
-
}), Js = (n) => n.index.toString(),
|
|
2687
|
+
}), Js = (n) => n.index.toString(), gt = (n) => n[0]?.index === 6 && n.length > 1, Xe = (n) => {
|
|
2678
2688
|
const e = Mt(n);
|
|
2679
2689
|
return wn(e);
|
|
2680
|
-
}, so = (n) => Array.isArray(n) ? n[0] &&
|
|
2690
|
+
}, so = (n) => Array.isArray(n) ? n[0] && gt(n[0]) ? n[0] : void 0 : n.parent[0] && gt(n.parent[0]) ? n.parent[0] : void 0, ot = (n) => {
|
|
2681
2691
|
const e = Mt(n), s = ((so(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = Pn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
|
|
2682
2692
|
return {
|
|
2683
2693
|
isCfiRange: r,
|
|
@@ -2688,7 +2698,7 @@ const Bi = (n) => n.pagination.state$.pipe(
|
|
|
2688
2698
|
cfi: n,
|
|
2689
2699
|
spineItemsManager: e
|
|
2690
2700
|
}) => {
|
|
2691
|
-
const { itemIndex: t, ...i } =
|
|
2701
|
+
const { itemIndex: t, ...i } = ot(n), o = e.get(t);
|
|
2692
2702
|
if (!o)
|
|
2693
2703
|
return {
|
|
2694
2704
|
...i,
|
|
@@ -2713,7 +2723,7 @@ const Bi = (n) => n.pagination.state$.pipe(
|
|
|
2713
2723
|
spineItem: o
|
|
2714
2724
|
};
|
|
2715
2725
|
} catch (a) {
|
|
2716
|
-
return
|
|
2726
|
+
return D.warn(`Error resolving cfi: ${n}.`), D.warn(a), {
|
|
2717
2727
|
...i,
|
|
2718
2728
|
spineItem: o,
|
|
2719
2729
|
itemIndex: t,
|
|
@@ -2750,7 +2760,7 @@ const Bi = (n) => n.pagination.state$.pipe(
|
|
|
2750
2760
|
}, ao = (n, e) => {
|
|
2751
2761
|
let t = n?.itemPageIndex;
|
|
2752
2762
|
const { itemIndex: i, ...o } = e.cfi.parseCfi(n.cfi), s = e.spineItemsManager.get(i);
|
|
2753
|
-
return s ?
|
|
2763
|
+
return s ? tt().pipe(
|
|
2754
2764
|
z(s.isReady$),
|
|
2755
2765
|
S(([, r]) => {
|
|
2756
2766
|
const {
|
|
@@ -2790,7 +2800,7 @@ class co {
|
|
|
2790
2800
|
resource: t,
|
|
2791
2801
|
meta: ro(this.reader, t)
|
|
2792
2802
|
};
|
|
2793
|
-
return
|
|
2803
|
+
return ct(() => {
|
|
2794
2804
|
const s = this.reader.spineItemsManager.get(
|
|
2795
2805
|
o.meta.itemIndex ?? 0
|
|
2796
2806
|
), r = s?.renditionLayout === "reflowable", a = i.mode === "shallow" || !r || !s ? () => {
|
|
@@ -2829,7 +2839,7 @@ class co {
|
|
|
2829
2839
|
};
|
|
2830
2840
|
}
|
|
2831
2841
|
locateResource(e, t) {
|
|
2832
|
-
return Array.isArray(e) ?
|
|
2842
|
+
return Array.isArray(e) ? ct(
|
|
2833
2843
|
() => j(
|
|
2834
2844
|
e.map((i) => this.locate(i, t ?? {}))
|
|
2835
2845
|
).pipe(cn([]))
|
|
@@ -2905,7 +2915,7 @@ const uo = (n) => (e) => {
|
|
|
2905
2915
|
a(d);
|
|
2906
2916
|
};
|
|
2907
2917
|
})
|
|
2908
|
-
}),
|
|
2918
|
+
}), je = async (n) => new Promise((e, t) => {
|
|
2909
2919
|
const i = window.indexedDB.open(n);
|
|
2910
2920
|
i.onerror = (o) => {
|
|
2911
2921
|
t(o);
|
|
@@ -2925,7 +2935,7 @@ const uo = (n) => (e) => {
|
|
|
2925
2935
|
}, o = async (c, u) => {
|
|
2926
2936
|
const l = i(c);
|
|
2927
2937
|
if (!l) return new Response("Item not found", { status: 404 });
|
|
2928
|
-
const g = await (await
|
|
2938
|
+
const g = await (await je("prose-reader")).get(`${e}_${l.id}`);
|
|
2929
2939
|
if (g)
|
|
2930
2940
|
return new Response(g, { status: 200 });
|
|
2931
2941
|
const p = u && await u(l) || await fetch(l.href);
|
|
@@ -2937,10 +2947,10 @@ const uo = (n) => (e) => {
|
|
|
2937
2947
|
bn(({ id: c, data: u }) => {
|
|
2938
2948
|
const l = i(c);
|
|
2939
2949
|
return l ? k(
|
|
2940
|
-
un([
|
|
2950
|
+
un([je("prose-reader"), k(u.blob())])
|
|
2941
2951
|
).pipe(
|
|
2942
2952
|
Y(([d, g]) => k(d.put(`${e}_${l.id}`, g))),
|
|
2943
|
-
|
|
2953
|
+
rt((d) => (D.error(d), _))
|
|
2944
2954
|
) : _;
|
|
2945
2955
|
}),
|
|
2946
2956
|
K(n.destroy$)
|
|
@@ -2951,7 +2961,7 @@ const uo = (n) => (e) => {
|
|
|
2951
2961
|
})
|
|
2952
2962
|
);
|
|
2953
2963
|
return P(r).pipe(
|
|
2954
|
-
Y(() => (
|
|
2964
|
+
Y(() => (D.debug("Cleanup up old cache..."), k(je("prose-reader")).pipe(
|
|
2955
2965
|
Y(
|
|
2956
2966
|
(c) => k(c.keys()).pipe(
|
|
2957
2967
|
ie(
|
|
@@ -2963,7 +2973,7 @@ const uo = (n) => (e) => {
|
|
|
2963
2973
|
})
|
|
2964
2974
|
)
|
|
2965
2975
|
),
|
|
2966
|
-
|
|
2976
|
+
rt((c) => (D.error(c), _))
|
|
2967
2977
|
))),
|
|
2968
2978
|
K(n.destroy$)
|
|
2969
2979
|
).subscribe(), {
|
|
@@ -2998,7 +3008,7 @@ const uo = (n) => (e) => {
|
|
|
2998
3008
|
t.setStart(n.node, o), t.setEnd(n.node, s);
|
|
2999
3009
|
}
|
|
3000
3010
|
} catch (o) {
|
|
3001
|
-
|
|
3011
|
+
D.warn("Failed to create range from selection", o, {
|
|
3002
3012
|
anchor: n,
|
|
3003
3013
|
focus: e
|
|
3004
3014
|
});
|
|
@@ -3017,7 +3027,7 @@ const uo = (n) => (e) => {
|
|
|
3017
3027
|
{ node: o, offset: s }
|
|
3018
3028
|
);
|
|
3019
3029
|
} catch (r) {
|
|
3020
|
-
|
|
3030
|
+
D.warn("Failed to create range from selection", r, {
|
|
3021
3031
|
selection: n,
|
|
3022
3032
|
spineItem: e
|
|
3023
3033
|
});
|
|
@@ -3031,14 +3041,14 @@ class fo extends G {
|
|
|
3031
3041
|
if (!t)
|
|
3032
3042
|
this.selectionChange$ = he, this.selectionOver$ = he;
|
|
3033
3043
|
else {
|
|
3034
|
-
const i =
|
|
3044
|
+
const i = ut(t.body, {
|
|
3035
3045
|
childList: !0,
|
|
3036
3046
|
subtree: !0
|
|
3037
3047
|
}).pipe(
|
|
3038
3048
|
C(
|
|
3039
3049
|
(s) => !!s.find((r) => r.type === "childList" && r.removedNodes.length)
|
|
3040
3050
|
)
|
|
3041
|
-
), o = e.parentElement ?
|
|
3051
|
+
), o = e.parentElement ? ut(e.parentElement, {
|
|
3042
3052
|
childList: !0
|
|
3043
3053
|
}).pipe(
|
|
3044
3054
|
C(
|
|
@@ -3066,7 +3076,7 @@ class fo extends G {
|
|
|
3066
3076
|
* The selection is still valid during the event even if it will
|
|
3067
3077
|
* be discarded. The timeout make sure to detect this edge case.
|
|
3068
3078
|
*/
|
|
3069
|
-
|
|
3079
|
+
xe(0),
|
|
3070
3080
|
S((s) => {
|
|
3071
3081
|
const r = t.getSelection();
|
|
3072
3082
|
return r && !r.isCollapsed ? [s, r] : void 0;
|
|
@@ -3139,15 +3149,15 @@ const yo = (n) => n.watch("isLoaded").pipe(
|
|
|
3139
3149
|
S((l) => !!l),
|
|
3140
3150
|
R(),
|
|
3141
3151
|
C((l) => l),
|
|
3142
|
-
|
|
3152
|
+
A()
|
|
3143
3153
|
), a = r.pipe(
|
|
3144
3154
|
w(() => s),
|
|
3145
3155
|
R(),
|
|
3146
3156
|
C((l) => !l),
|
|
3147
|
-
|
|
3157
|
+
A()
|
|
3148
3158
|
), c = o.pipe(
|
|
3149
3159
|
C((l) => l?.type === "over"),
|
|
3150
|
-
|
|
3160
|
+
A()
|
|
3151
3161
|
), u = t.context.watch("rootElement").pipe(
|
|
3152
3162
|
C(Z),
|
|
3153
3163
|
w((l) => X(l, "pointerdown")),
|
|
@@ -3168,7 +3178,7 @@ const yo = (n) => n.watch("isLoaded").pipe(
|
|
|
3168
3178
|
createOrderedRangeFromSelection: mo
|
|
3169
3179
|
}
|
|
3170
3180
|
};
|
|
3171
|
-
},
|
|
3181
|
+
}, ht = [
|
|
3172
3182
|
{
|
|
3173
3183
|
name: "bright",
|
|
3174
3184
|
backgroundColor: "white"
|
|
@@ -3187,7 +3197,7 @@ const yo = (n) => n.watch("isLoaded").pipe(
|
|
|
3187
3197
|
const t = n(e), i = new q(
|
|
3188
3198
|
e.theme ?? "bright"
|
|
3189
3199
|
), o = () => {
|
|
3190
|
-
const a =
|
|
3200
|
+
const a = ht.find(
|
|
3191
3201
|
(c) => c.name === i.value
|
|
3192
3202
|
);
|
|
3193
3203
|
return `
|
|
@@ -3204,7 +3214,7 @@ const yo = (n) => n.watch("isLoaded").pipe(
|
|
|
3204
3214
|
}, s = ({
|
|
3205
3215
|
container: a
|
|
3206
3216
|
}) => {
|
|
3207
|
-
const c =
|
|
3217
|
+
const c = ht.find(
|
|
3208
3218
|
(u) => u.name === i.value
|
|
3209
3219
|
);
|
|
3210
3220
|
return c && a.style.setProperty(
|
|
@@ -3256,13 +3266,13 @@ const yo = (n) => n.watch("isLoaded").pipe(
|
|
|
3256
3266
|
isOrIsWithinValidLink: (s) => !!(At(s) && (s.nodeName === "a" ? s : s.closest("a"))?.getAttribute("href")),
|
|
3257
3267
|
injectScopedCSS: (s, r, a) => {
|
|
3258
3268
|
const c = a.replace("${id}", t.id);
|
|
3259
|
-
return
|
|
3269
|
+
return Ee(s, `${r}-${t.id}`, c);
|
|
3260
3270
|
}
|
|
3261
3271
|
}
|
|
3262
3272
|
};
|
|
3263
3273
|
};
|
|
3264
3274
|
navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
|
|
3265
|
-
const vo = (n) => (e) => n(e), wo = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}",
|
|
3275
|
+
const vo = (n) => (e) => n(e), wo = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}", mt = (n, e, t) => {
|
|
3266
3276
|
const { clientWidth: i, clientHeight: o } = t.value.element, s = {
|
|
3267
3277
|
maxX: 0,
|
|
3268
3278
|
minX: i * (1 - e),
|
|
@@ -3289,7 +3299,7 @@ class Ht {
|
|
|
3289
3299
|
this.x = e.x, this.y = e.y;
|
|
3290
3300
|
}
|
|
3291
3301
|
}
|
|
3292
|
-
class
|
|
3302
|
+
class ft extends Ht {
|
|
3293
3303
|
}
|
|
3294
3304
|
class $o extends Ht {
|
|
3295
3305
|
constructor() {
|
|
@@ -3310,7 +3320,7 @@ class To extends Q {
|
|
|
3310
3320
|
left: p.x,
|
|
3311
3321
|
top: p.y,
|
|
3312
3322
|
behavior: "instant"
|
|
3313
|
-
}),
|
|
3323
|
+
}), Fe(1).pipe(
|
|
3314
3324
|
x(() => {
|
|
3315
3325
|
this.scrollingSubject.next(!1);
|
|
3316
3326
|
}),
|
|
@@ -3318,7 +3328,7 @@ class To extends Q {
|
|
|
3318
3328
|
).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
|
|
3319
3329
|
};
|
|
3320
3330
|
const r = this.context.pipe(
|
|
3321
|
-
|
|
3331
|
+
Qe(["rootElement"]),
|
|
3322
3332
|
x(({ rootElement: d }) => {
|
|
3323
3333
|
if (!d) return;
|
|
3324
3334
|
const g = document.createElement("div");
|
|
@@ -3340,7 +3350,7 @@ class To extends Q {
|
|
|
3340
3350
|
const u = P(
|
|
3341
3351
|
o.element$.pipe(
|
|
3342
3352
|
C(Z),
|
|
3343
|
-
w((d) =>
|
|
3353
|
+
w((d) => et(d))
|
|
3344
3354
|
),
|
|
3345
3355
|
o.element$.pipe(
|
|
3346
3356
|
C(Z),
|
|
@@ -3349,7 +3359,7 @@ class To extends Q {
|
|
|
3349
3359
|
o.spineItemsObserver.itemResize$
|
|
3350
3360
|
).pipe(
|
|
3351
3361
|
w(
|
|
3352
|
-
() =>
|
|
3362
|
+
() => Fe(10).pipe(
|
|
3353
3363
|
S(() => !1),
|
|
3354
3364
|
ne(!0)
|
|
3355
3365
|
)
|
|
@@ -3380,7 +3390,7 @@ class To extends Q {
|
|
|
3380
3390
|
)
|
|
3381
3391
|
)
|
|
3382
3392
|
),
|
|
3383
|
-
|
|
3393
|
+
A()
|
|
3384
3394
|
), P(r, a, c).pipe(T(this.destroy$)).subscribe();
|
|
3385
3395
|
}
|
|
3386
3396
|
update(e) {
|
|
@@ -3398,14 +3408,14 @@ class To extends Q {
|
|
|
3398
3408
|
}
|
|
3399
3409
|
fromSpinePosition(e) {
|
|
3400
3410
|
const t = this.viewport.scaleFactor;
|
|
3401
|
-
return new
|
|
3411
|
+
return new ft({
|
|
3402
3412
|
x: e.x * t,
|
|
3403
3413
|
y: e.y * t
|
|
3404
3414
|
});
|
|
3405
3415
|
}
|
|
3406
3416
|
get scrollPosition() {
|
|
3407
3417
|
const e = this.value.element;
|
|
3408
|
-
return new
|
|
3418
|
+
return new ft({
|
|
3409
3419
|
x: e?.scrollLeft ?? 0,
|
|
3410
3420
|
y: e?.scrollTop ?? 0
|
|
3411
3421
|
});
|
|
@@ -3456,7 +3466,7 @@ class Mo extends Q {
|
|
|
3456
3466
|
isZooming: !0,
|
|
3457
3467
|
currentScale: 1,
|
|
3458
3468
|
currentPosition: { x: 0, y: 0 }
|
|
3459
|
-
}), this.updateZoom(s), s !== 1 && this.isControlled ?
|
|
3469
|
+
}), this.updateZoom(s), s !== 1 && this.isControlled ? Fe(o?.animate ? we : 0).pipe(
|
|
3460
3470
|
x(() => {
|
|
3461
3471
|
this.reader.layout();
|
|
3462
3472
|
})
|
|
@@ -3475,7 +3485,7 @@ class Mo extends Q {
|
|
|
3475
3485
|
"false"
|
|
3476
3486
|
), o?.animate && this.isControlled && (s.style.transition = `transform ${we}ms`), this.updateZoom(1, { x: 0, y: 0 }), s.style.transform = "", this.mergeCompare({
|
|
3477
3487
|
isZooming: !1
|
|
3478
|
-
}),
|
|
3488
|
+
}), Fe(o?.animate ? we : 0).pipe(
|
|
3479
3489
|
x(() => {
|
|
3480
3490
|
const r = this.reader.viewport.value.element;
|
|
3481
3491
|
r.style.transformOrigin = "", r.style.transition = "", this.isControlled && this.reader.layout();
|
|
@@ -3494,14 +3504,14 @@ class Mo extends Q {
|
|
|
3494
3504
|
}
|
|
3495
3505
|
move(e, t) {
|
|
3496
3506
|
this.isControlled && (this.viewport.element.style.transition = "", this.updateZoom(this.value.currentScale, e, {
|
|
3497
|
-
constraints: t?.constrain === "within-viewport" ? (...i) =>
|
|
3507
|
+
constraints: t?.constrain === "within-viewport" ? (...i) => mt(...i, this.reader.viewport) : void 0
|
|
3498
3508
|
}));
|
|
3499
3509
|
}
|
|
3500
3510
|
scaleAt(e, t) {
|
|
3501
3511
|
this.viewport.element.style.transition = "";
|
|
3502
3512
|
const o = Math.ceil(e * 100) / 100;
|
|
3503
3513
|
this.updateZoom(o, void 0, {
|
|
3504
|
-
constraints: t?.constrain === "within-viewport" ? (...s) =>
|
|
3514
|
+
constraints: t?.constrain === "within-viewport" ? (...s) => mt(...s, this.reader.viewport) : void 0
|
|
3505
3515
|
});
|
|
3506
3516
|
}
|
|
3507
3517
|
updateZoom(e, t, i) {
|
|
@@ -3538,11 +3548,11 @@ class Mo extends Q {
|
|
|
3538
3548
|
return this.reader.viewport.value;
|
|
3539
3549
|
}
|
|
3540
3550
|
}
|
|
3541
|
-
const
|
|
3551
|
+
const yt = `${Vt}-enhancer-zoom`, Co = (n) => (e) => {
|
|
3542
3552
|
const t = n(e), i = new Mo(t);
|
|
3543
|
-
|
|
3553
|
+
Ee(document, yt, wo);
|
|
3544
3554
|
const o = () => {
|
|
3545
|
-
|
|
3555
|
+
De(document, yt), i.destroy(), t.destroy();
|
|
3546
3556
|
}, s = i;
|
|
3547
3557
|
return {
|
|
3548
3558
|
...t,
|
|
@@ -3561,7 +3571,7 @@ const ft = `${Vt}-enhancer-zoom`, Co = (n) => (e) => {
|
|
|
3561
3571
|
}, Bt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
|
|
3562
3572
|
class Eo {
|
|
3563
3573
|
constructor() {
|
|
3564
|
-
this.navigationSubject = new
|
|
3574
|
+
this.navigationSubject = new st(1), this.viewportStateSubject = new q("free"), this.paginationSubject = new st(), this.navigationIsLockedSubject = new q(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
|
|
3565
3575
|
R(),
|
|
3566
3576
|
C((e) => !e)
|
|
3567
3577
|
), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
|
|
@@ -3705,7 +3715,7 @@ const Ro = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position
|
|
|
3705
3715
|
}) : new M({
|
|
3706
3716
|
x: -n.x,
|
|
3707
3717
|
y: -n.y
|
|
3708
|
-
}), jo = "navigation/ViewportNavigator",
|
|
3718
|
+
}), jo = "navigation/ViewportNavigator", St = D.namespace(jo);
|
|
3709
3719
|
class ko extends G {
|
|
3710
3720
|
constructor(e, t, i, o, s) {
|
|
3711
3721
|
super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new N(), this.element$ = new q(
|
|
@@ -3735,13 +3745,13 @@ class ko extends G {
|
|
|
3735
3745
|
);
|
|
3736
3746
|
this.layout$ = c.pipe(
|
|
3737
3747
|
x(() => {
|
|
3738
|
-
|
|
3748
|
+
St.info("layout", e.values);
|
|
3739
3749
|
}),
|
|
3740
|
-
|
|
3750
|
+
A()
|
|
3741
3751
|
);
|
|
3742
3752
|
const u = this.navigateSubject.pipe(
|
|
3743
3753
|
x((l) => {
|
|
3744
|
-
|
|
3754
|
+
St.info("Navigation requested", l);
|
|
3745
3755
|
})
|
|
3746
3756
|
);
|
|
3747
3757
|
this.isNavigating$ = u.pipe(
|
|
@@ -3768,7 +3778,7 @@ class ko extends G {
|
|
|
3768
3778
|
* anything for x ms while we effectively adjust. We want it to be immediate.
|
|
3769
3779
|
* However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
|
|
3770
3780
|
*/
|
|
3771
|
-
l.shouldAnimate ?
|
|
3781
|
+
l.shouldAnimate ? xe(1, re) : $e,
|
|
3772
3782
|
x((h) => {
|
|
3773
3783
|
const m = this.element$.getValue();
|
|
3774
3784
|
h.shouldAnimate ? p === "fade" ? (m.style.setProperty(
|
|
@@ -3790,12 +3800,12 @@ class ko extends G {
|
|
|
3790
3800
|
x((h) => {
|
|
3791
3801
|
p !== "fade" && this.setViewportPosition(h.position);
|
|
3792
3802
|
}),
|
|
3793
|
-
l.shouldAnimate ?
|
|
3803
|
+
l.shouldAnimate ? xe(g / 2, re) : $e,
|
|
3794
3804
|
x((h) => {
|
|
3795
3805
|
const m = this.element$.getValue();
|
|
3796
3806
|
p === "fade" && (this.setViewportPosition(h.position), m.style.setProperty("opacity", "1"));
|
|
3797
3807
|
}),
|
|
3798
|
-
l.shouldAnimate ?
|
|
3808
|
+
l.shouldAnimate ? xe(g / 2, re) : $e,
|
|
3799
3809
|
x((h) => {
|
|
3800
3810
|
p === "fade" && this.setViewportPosition(h.position);
|
|
3801
3811
|
})
|
|
@@ -3993,7 +4003,7 @@ const Uo = () => (n) => n.pipe(
|
|
|
3993
4003
|
...s
|
|
3994
4004
|
};
|
|
3995
4005
|
})
|
|
3996
|
-
),
|
|
4006
|
+
), It = ({
|
|
3997
4007
|
settings: n,
|
|
3998
4008
|
spineItemsManager: e,
|
|
3999
4009
|
navigationResolver: t,
|
|
@@ -4052,7 +4062,7 @@ const Uo = () => (n) => n.pipe(
|
|
|
4052
4062
|
};
|
|
4053
4063
|
})
|
|
4054
4064
|
);
|
|
4055
|
-
},
|
|
4065
|
+
}, bt = ({ spine: n }) => (e) => e.pipe(
|
|
4056
4066
|
w(({ navigation: t, ...i }) => {
|
|
4057
4067
|
const o = n.getSpineItemSpineLayoutInfo(
|
|
4058
4068
|
t.spineItem
|
|
@@ -4075,7 +4085,7 @@ const Uo = () => (n) => n.pipe(
|
|
|
4075
4085
|
)
|
|
4076
4086
|
);
|
|
4077
4087
|
})
|
|
4078
|
-
),
|
|
4088
|
+
), ke = ({
|
|
4079
4089
|
settings: n,
|
|
4080
4090
|
spineItemsManager: e,
|
|
4081
4091
|
spineLocator: t,
|
|
@@ -4177,7 +4187,7 @@ const qo = ({
|
|
|
4177
4187
|
return p.position;
|
|
4178
4188
|
}
|
|
4179
4189
|
const g = e.cfi ?? e.paginationBeginCfi;
|
|
4180
|
-
if (g !== void 0 && !
|
|
4190
|
+
if (g !== void 0 && !Xe(g) && (u || l || // when spine item is ready dimensions may have not changed but the position
|
|
4181
4191
|
// of dom elements may have!
|
|
4182
4192
|
r && !e.spineItemIsReady)) {
|
|
4183
4193
|
const p = t.getNavigationForCfi(g);
|
|
@@ -4300,7 +4310,7 @@ const qo = ({
|
|
|
4300
4310
|
navigationResolver: o,
|
|
4301
4311
|
spineItemsManager: e,
|
|
4302
4312
|
spine: s
|
|
4303
|
-
}),
|
|
4313
|
+
}), vt = ({
|
|
4304
4314
|
settings: n,
|
|
4305
4315
|
navigationResolver: e,
|
|
4306
4316
|
context: t,
|
|
@@ -4323,7 +4333,7 @@ const qo = ({
|
|
|
4323
4333
|
}
|
|
4324
4334
|
}))
|
|
4325
4335
|
))
|
|
4326
|
-
), Jo = "navigation/InternalNavigator", Ko =
|
|
4336
|
+
), Jo = "navigation/InternalNavigator", Ko = D.namespace(Jo);
|
|
4327
4337
|
class Qo extends G {
|
|
4328
4338
|
constructor(e, t, i, o, s, r, a, c) {
|
|
4329
4339
|
super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isRestorationLocked$ = c, this.navigationSubject = new q({
|
|
@@ -4365,19 +4375,19 @@ class Qo extends G {
|
|
|
4365
4375
|
navigationResolver: r
|
|
4366
4376
|
}),
|
|
4367
4377
|
Bo({ context: t, settings: e }),
|
|
4368
|
-
|
|
4378
|
+
It({
|
|
4369
4379
|
navigationResolver: r,
|
|
4370
4380
|
settings: e,
|
|
4371
4381
|
spineItemsManager: a.spineItemsManager,
|
|
4372
4382
|
spineLocator: a.locator
|
|
4373
4383
|
}),
|
|
4374
|
-
|
|
4384
|
+
ke({
|
|
4375
4385
|
navigationResolver: r,
|
|
4376
4386
|
settings: e,
|
|
4377
4387
|
spineItemsManager: a.spineItemsManager,
|
|
4378
4388
|
spineLocator: a.locator
|
|
4379
4389
|
}),
|
|
4380
|
-
|
|
4390
|
+
bt({
|
|
4381
4391
|
spine: a
|
|
4382
4392
|
})
|
|
4383
4393
|
).pipe(
|
|
@@ -4390,7 +4400,7 @@ class Qo extends G {
|
|
|
4390
4400
|
w(([f, I]) => {
|
|
4391
4401
|
const b = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || I;
|
|
4392
4402
|
return v(f).pipe(
|
|
4393
|
-
b ?
|
|
4403
|
+
b ? $e : vt({
|
|
4394
4404
|
navigationResolver: r,
|
|
4395
4405
|
settings: e,
|
|
4396
4406
|
spine: a,
|
|
@@ -4398,14 +4408,14 @@ class Qo extends G {
|
|
|
4398
4408
|
})
|
|
4399
4409
|
);
|
|
4400
4410
|
}),
|
|
4401
|
-
|
|
4411
|
+
ke({
|
|
4402
4412
|
spineItemsManager: a.spineItemsManager,
|
|
4403
4413
|
spineLocator: a.locator,
|
|
4404
4414
|
settings: e,
|
|
4405
4415
|
navigationResolver: r
|
|
4406
4416
|
}),
|
|
4407
4417
|
S((f) => f.navigation),
|
|
4408
|
-
|
|
4418
|
+
A()
|
|
4409
4419
|
), l = u.pipe(
|
|
4410
4420
|
z(c),
|
|
4411
4421
|
C(([, f]) => f),
|
|
@@ -4426,7 +4436,7 @@ class Qo extends G {
|
|
|
4426
4436
|
T(u)
|
|
4427
4437
|
);
|
|
4428
4438
|
}),
|
|
4429
|
-
|
|
4439
|
+
A()
|
|
4430
4440
|
), d = P(
|
|
4431
4441
|
o.layout$,
|
|
4432
4442
|
a.layout$
|
|
@@ -4458,7 +4468,7 @@ class Qo extends G {
|
|
|
4458
4468
|
l
|
|
4459
4469
|
).pipe(
|
|
4460
4470
|
S((f) => ({ navigation: f })),
|
|
4461
|
-
|
|
4471
|
+
vt({
|
|
4462
4472
|
navigationResolver: r,
|
|
4463
4473
|
settings: e,
|
|
4464
4474
|
context: t,
|
|
@@ -4481,23 +4491,23 @@ class Qo extends G {
|
|
|
4481
4491
|
* eg: after the reader load and the user has never navigated
|
|
4482
4492
|
* yet.
|
|
4483
4493
|
*/
|
|
4484
|
-
|
|
4494
|
+
It({
|
|
4485
4495
|
navigationResolver: r,
|
|
4486
4496
|
settings: e,
|
|
4487
4497
|
spineItemsManager: a.spineItemsManager,
|
|
4488
4498
|
spineLocator: a.locator
|
|
4489
4499
|
}),
|
|
4490
|
-
|
|
4500
|
+
bt({
|
|
4491
4501
|
spine: a
|
|
4492
4502
|
}),
|
|
4493
|
-
|
|
4503
|
+
ke({
|
|
4494
4504
|
spineItemsManager: a.spineItemsManager,
|
|
4495
4505
|
spineLocator: a.locator,
|
|
4496
4506
|
settings: e,
|
|
4497
4507
|
navigationResolver: r
|
|
4498
4508
|
}),
|
|
4499
4509
|
S(({ navigation: f }) => f),
|
|
4500
|
-
|
|
4510
|
+
A()
|
|
4501
4511
|
), p = zo(
|
|
4502
4512
|
t,
|
|
4503
4513
|
this.navigationSubject,
|
|
@@ -4557,13 +4567,13 @@ class Qo extends G {
|
|
|
4557
4567
|
return this.navigationSubject.getValue();
|
|
4558
4568
|
}
|
|
4559
4569
|
}
|
|
4560
|
-
const
|
|
4570
|
+
const Le = (n, e, t) => {
|
|
4561
4571
|
const i = t - n, o = t * (e * n) / (t || 1);
|
|
4562
4572
|
return Math.max(0, Math.min(i, o));
|
|
4563
|
-
},
|
|
4564
|
-
const i =
|
|
4573
|
+
}, Ye = (n, e) => (e || 0) === 0 || (n || 0) === 0 ? 1 : Math.floor(Math.max(1, n / e)), Ue = (n, e, t) => {
|
|
4574
|
+
const i = Ye(t, e), o = [...Array(i)].map((s, r) => r * e);
|
|
4565
4575
|
return n >= i * e ? o[o.length - 1] || 0 : o.find((s) => n < s + e) || 0;
|
|
4566
|
-
},
|
|
4576
|
+
}, wt = (n, e, t) => {
|
|
4567
4577
|
const i = [...Array(t)].map((o, s) => s * e);
|
|
4568
4578
|
return n <= 0 || t === 0 ? 0 : n >= t * e ? t - 1 : i.findIndex((o) => n < o + e) ?? 0;
|
|
4569
4579
|
}, es = ({
|
|
@@ -4581,7 +4591,7 @@ const Fe = (n, e, t) => {
|
|
|
4581
4591
|
pageHeight: o,
|
|
4582
4592
|
pageTurnDirection: s,
|
|
4583
4593
|
pageTurnMode: r
|
|
4584
|
-
}) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ?
|
|
4594
|
+
}) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Ye(n, o) : Ye(e, i), Pt = ({
|
|
4585
4595
|
itemWidth: n,
|
|
4586
4596
|
itemHeight: e,
|
|
4587
4597
|
position: t,
|
|
@@ -4606,8 +4616,8 @@ const Fe = (n, e, t) => {
|
|
|
4606
4616
|
pageTurnMode: a
|
|
4607
4617
|
});
|
|
4608
4618
|
if (i)
|
|
4609
|
-
return
|
|
4610
|
-
const g =
|
|
4619
|
+
return wt(t.y, s, d);
|
|
4620
|
+
const g = wt(l, o, d);
|
|
4611
4621
|
return c ? d - 1 - g : g;
|
|
4612
4622
|
}, ts = ({
|
|
4613
4623
|
pageIndex: n,
|
|
@@ -4617,7 +4627,7 @@ const Fe = (n, e, t) => {
|
|
|
4617
4627
|
viewport: o
|
|
4618
4628
|
}) => {
|
|
4619
4629
|
if (i) {
|
|
4620
|
-
const r =
|
|
4630
|
+
const r = Le(
|
|
4621
4631
|
o.pageSize.height,
|
|
4622
4632
|
n,
|
|
4623
4633
|
e.height
|
|
@@ -4627,7 +4637,7 @@ const Fe = (n, e, t) => {
|
|
|
4627
4637
|
y: r
|
|
4628
4638
|
});
|
|
4629
4639
|
}
|
|
4630
|
-
const s =
|
|
4640
|
+
const s = Le(
|
|
4631
4641
|
o.pageSize.width,
|
|
4632
4642
|
n,
|
|
4633
4643
|
e.width
|
|
@@ -4649,7 +4659,7 @@ const Fe = (n, e, t) => {
|
|
|
4649
4659
|
a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? l = a.getBoundingClientRect().x : a && (l = (a ? Cn(a, c) : void 0)?.getBoundingClientRect().x || l);
|
|
4650
4660
|
const d = u.layoutInfo?.width || 0, g = t.pageSize.width;
|
|
4651
4661
|
if (l !== void 0) {
|
|
4652
|
-
const p =
|
|
4662
|
+
const p = Ue(
|
|
4653
4663
|
l,
|
|
4654
4664
|
g,
|
|
4655
4665
|
d
|
|
@@ -4669,7 +4679,7 @@ const Fe = (n, e, t) => {
|
|
|
4669
4679
|
pageIndex: a,
|
|
4670
4680
|
viewport: t
|
|
4671
4681
|
}),
|
|
4672
|
-
getSpineItemPageIndexFromPosition: (a) =>
|
|
4682
|
+
getSpineItemPageIndexFromPosition: (a) => Pt({
|
|
4673
4683
|
...a,
|
|
4674
4684
|
isRTL: n.isRTL(),
|
|
4675
4685
|
pageWidth: t.pageSize.width,
|
|
@@ -4679,7 +4689,7 @@ const Fe = (n, e, t) => {
|
|
|
4679
4689
|
}),
|
|
4680
4690
|
getSpineItemPageIndexFromNode: (a, c, u) => {
|
|
4681
4691
|
const l = i(a, c, u), { height: d, width: g } = u.layoutInfo;
|
|
4682
|
-
return l ?
|
|
4692
|
+
return l ? Pt({
|
|
4683
4693
|
isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
|
|
4684
4694
|
position: l,
|
|
4685
4695
|
itemHeight: d,
|
|
@@ -4694,12 +4704,12 @@ const Fe = (n, e, t) => {
|
|
|
4694
4704
|
getSpineItemClosestPositionFromUnsafePosition: (a, c) => {
|
|
4695
4705
|
const { width: u, height: l } = c.layoutInfo;
|
|
4696
4706
|
return new E({
|
|
4697
|
-
x:
|
|
4707
|
+
x: Ue(
|
|
4698
4708
|
a.x,
|
|
4699
4709
|
t.pageSize.width,
|
|
4700
4710
|
u
|
|
4701
4711
|
),
|
|
4702
|
-
y:
|
|
4712
|
+
y: Ue(
|
|
4703
4713
|
a.y,
|
|
4704
4714
|
t.pageSize.height,
|
|
4705
4715
|
l
|
|
@@ -4709,25 +4719,25 @@ const Fe = (n, e, t) => {
|
|
|
4709
4719
|
getSpineItemPagePositionFromSpineItemPosition: (a, c, u) => {
|
|
4710
4720
|
const { width: l, height: d } = u.layoutInfo, g = t.pageSize.width, p = t.pageSize.height;
|
|
4711
4721
|
if (!!u.isUsingVerticalWriting()) {
|
|
4712
|
-
const y =
|
|
4722
|
+
const y = Le(
|
|
4713
4723
|
p,
|
|
4714
4724
|
c,
|
|
4715
4725
|
d
|
|
4716
4726
|
);
|
|
4717
|
-
return new
|
|
4727
|
+
return new Oe({
|
|
4718
4728
|
x: a.x,
|
|
4719
4729
|
y: a.y - y
|
|
4720
4730
|
});
|
|
4721
4731
|
}
|
|
4722
|
-
const m =
|
|
4732
|
+
const m = Le(g, c, l);
|
|
4723
4733
|
if (n.isRTL()) {
|
|
4724
4734
|
const y = l - (c + 1) * g;
|
|
4725
|
-
return new
|
|
4735
|
+
return new Oe({
|
|
4726
4736
|
x: a.x - Math.max(0, y),
|
|
4727
4737
|
y: a.y
|
|
4728
4738
|
});
|
|
4729
4739
|
}
|
|
4730
|
-
return new
|
|
4740
|
+
return new Oe({
|
|
4731
4741
|
x: a.x - m,
|
|
4732
4742
|
y: a.y
|
|
4733
4743
|
});
|
|
@@ -4787,7 +4797,7 @@ function Gt({
|
|
|
4787
4797
|
y: u
|
|
4788
4798
|
});
|
|
4789
4799
|
}
|
|
4790
|
-
const
|
|
4800
|
+
const xt = ({
|
|
4791
4801
|
position: n,
|
|
4792
4802
|
isRTL: e,
|
|
4793
4803
|
pageSizeHeight: t,
|
|
@@ -4823,7 +4833,7 @@ const Pt = ({
|
|
|
4823
4833
|
}) => {
|
|
4824
4834
|
const s = n % i !== 0 ? n - t : n;
|
|
4825
4835
|
return new M({ x: s, y: e });
|
|
4826
|
-
},
|
|
4836
|
+
}, qe = ({
|
|
4827
4837
|
viewportPosition: n,
|
|
4828
4838
|
spineLocator: e,
|
|
4829
4839
|
spineItemNavigationResolver: t,
|
|
@@ -4859,7 +4869,7 @@ const Pt = ({
|
|
|
4859
4869
|
const r = e.get(t);
|
|
4860
4870
|
if (!r) {
|
|
4861
4871
|
const u = n * s.pageSize.width;
|
|
4862
|
-
return
|
|
4872
|
+
return qe({
|
|
4863
4873
|
viewportPosition: new M({ x: u, y: 0 }),
|
|
4864
4874
|
spineItemNavigationResolver: o,
|
|
4865
4875
|
spineLocator: i,
|
|
@@ -5027,7 +5037,7 @@ const Pt = ({
|
|
|
5027
5037
|
spineItemsManager: e
|
|
5028
5038
|
});
|
|
5029
5039
|
if (!h) {
|
|
5030
|
-
|
|
5040
|
+
D.warn(ls, `unable to detect item id from cfi ${p}`);
|
|
5031
5041
|
return;
|
|
5032
5042
|
}
|
|
5033
5043
|
const f = m ? r.getNavigationFromNode(h, m, y) : new E({ x: 0, y: 0 }), I = t.getSpinePositionFromSpineItemPosition({
|
|
@@ -5063,14 +5073,14 @@ const Pt = ({
|
|
|
5063
5073
|
}
|
|
5064
5074
|
return new M({ x: 0, y: 0 });
|
|
5065
5075
|
},
|
|
5066
|
-
getNavigationForPosition: (p) =>
|
|
5076
|
+
getNavigationForPosition: (p) => qe({
|
|
5067
5077
|
viewportPosition: p,
|
|
5068
5078
|
spineItemNavigationResolver: r,
|
|
5069
5079
|
spineLocator: t,
|
|
5070
5080
|
viewport: s
|
|
5071
5081
|
}),
|
|
5072
5082
|
getMostPredominantNavigationForPosition: (p) => {
|
|
5073
|
-
const h = i.values.computedPageTurnDirection, m = 0.5, y = h === "horizontal" ? p.x + s.absoluteViewport.width * m : 0, f = h === "horizontal" ? 0 : p.y + s.absoluteViewport.height * m, I =
|
|
5083
|
+
const h = i.values.computedPageTurnDirection, m = 0.5, y = h === "horizontal" ? p.x + s.absoluteViewport.width * m : 0, f = h === "horizontal" ? 0 : p.y + s.absoluteViewport.height * m, I = xt({
|
|
5074
5084
|
position: new M({
|
|
5075
5085
|
x: y,
|
|
5076
5086
|
y: f
|
|
@@ -5081,14 +5091,14 @@ const Pt = ({
|
|
|
5081
5091
|
spineItemsManager: e,
|
|
5082
5092
|
spine: o
|
|
5083
5093
|
});
|
|
5084
|
-
return
|
|
5094
|
+
return qe({
|
|
5085
5095
|
spineItemNavigationResolver: r,
|
|
5086
5096
|
spineLocator: t,
|
|
5087
5097
|
viewportPosition: I,
|
|
5088
5098
|
viewport: s
|
|
5089
5099
|
});
|
|
5090
5100
|
},
|
|
5091
|
-
fromUnboundSpinePosition: (p) =>
|
|
5101
|
+
fromUnboundSpinePosition: (p) => xt({
|
|
5092
5102
|
position: p,
|
|
5093
5103
|
isRTL: n.isRTL(),
|
|
5094
5104
|
pageSizeHeight: s.pageSize.height,
|
|
@@ -5156,7 +5166,7 @@ const Pt = ({
|
|
|
5156
5166
|
]).pipe(
|
|
5157
5167
|
ie((y) => y.some((f) => f) ? "busy" : "free"),
|
|
5158
5168
|
be(),
|
|
5159
|
-
|
|
5169
|
+
Ze(1)
|
|
5160
5170
|
);
|
|
5161
5171
|
return {
|
|
5162
5172
|
destroy: () => {
|
|
@@ -5217,7 +5227,7 @@ class hs extends G {
|
|
|
5217
5227
|
threshold: { type: "percentage", value: 0.5 }
|
|
5218
5228
|
});
|
|
5219
5229
|
return this.context.bridgeEvent.navigationUnlocked$.pipe(
|
|
5220
|
-
|
|
5230
|
+
Tt(1),
|
|
5221
5231
|
z(this.context.bridgeEvent.navigation$),
|
|
5222
5232
|
x(([, u]) => {
|
|
5223
5233
|
const { position: l } = u, d = this.pagination.value, {
|
|
@@ -5234,7 +5244,7 @@ class hs extends G {
|
|
|
5234
5244
|
}) ?? {}, { endPageIndex: b = 0 } = c({
|
|
5235
5245
|
spineItem: m,
|
|
5236
5246
|
position: l
|
|
5237
|
-
}) ?? {}, F = y === void 0 ||
|
|
5247
|
+
}) ?? {}, F = y === void 0 || Xe(y) || d.beginSpineItemIndex !== g, $ = d.endSpineItemIndex !== p || f === void 0 || Xe(f), L = F ? de(h.item) : y, H = $ ? de(m.item) : f, B = h.numberOfPages, se = m.numberOfPages;
|
|
5238
5248
|
this.pagination.update({
|
|
5239
5249
|
beginCfi: L,
|
|
5240
5250
|
beginNumberOfPagesInSpineItem: B,
|
|
@@ -5250,7 +5260,7 @@ class hs extends G {
|
|
|
5250
5260
|
);
|
|
5251
5261
|
})
|
|
5252
5262
|
), a = r.pipe(
|
|
5253
|
-
|
|
5263
|
+
Ae(this.context.bridgeEvent.viewportFree$),
|
|
5254
5264
|
x(() => {
|
|
5255
5265
|
const {
|
|
5256
5266
|
beginSpineItemIndex: c,
|
|
@@ -5270,11 +5280,11 @@ class hs extends G {
|
|
|
5270
5280
|
d
|
|
5271
5281
|
);
|
|
5272
5282
|
this.pagination.update({
|
|
5273
|
-
beginCfi: h?.firstVisibleNode ?
|
|
5283
|
+
beginCfi: h?.firstVisibleNode ? Be({
|
|
5274
5284
|
spineItem: g.item,
|
|
5275
5285
|
pageNode: h?.firstVisibleNode
|
|
5276
5286
|
}) : de(g.item),
|
|
5277
|
-
endCfi: m?.firstVisibleNode ?
|
|
5287
|
+
endCfi: m?.firstVisibleNode ? Be({
|
|
5278
5288
|
spineItem: p.item,
|
|
5279
5289
|
pageNode: m?.firstVisibleNode
|
|
5280
5290
|
}) : de(p.item)
|
|
@@ -5298,7 +5308,7 @@ class fs extends G {
|
|
|
5298
5308
|
this.inputSettings = t, this.outputSettingsUpdateSubject = new N(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(J(1)), this._settings$.subscribe();
|
|
5299
5309
|
}
|
|
5300
5310
|
_prepareUpdate(e) {
|
|
5301
|
-
const t =
|
|
5311
|
+
const t = Te(this.inputSettings, e), i = this.getOutputSettings(t), o = !O(this.outputSettings, i);
|
|
5302
5312
|
return {
|
|
5303
5313
|
hasChanged: o,
|
|
5304
5314
|
state: i,
|
|
@@ -5351,7 +5361,7 @@ class ys extends fs {
|
|
|
5351
5361
|
manifest: t
|
|
5352
5362
|
})
|
|
5353
5363
|
};
|
|
5354
|
-
return t?.renditionFlow === "scrolled-continuous" && (o.computedPageTurnMode = "scrollable"), o.computedPageTurnMode === "scrollable" && (o.computedPageTurnDirection = "vertical"), i && o.computedPageTurnAnimation === "slide" && (
|
|
5364
|
+
return t?.renditionFlow === "scrolled-continuous" && (o.computedPageTurnMode = "scrollable"), o.computedPageTurnMode === "scrollable" && (o.computedPageTurnDirection = "vertical"), i && o.computedPageTurnAnimation === "slide" && (D.warn(
|
|
5355
5365
|
`pageTurnAnimation ${o.computedPageTurnAnimation} incompatible with current book, switching back to default`
|
|
5356
5366
|
), o.computedPageTurnAnimation = "none"), o.computedPageTurnMode === "scrollable" ? (o.computedPageTurnAnimationDuration = 0, o.computedPageTurnAnimation = "none") : o.computedPageTurnAnimationDuration = e.pageTurnAnimationDuration !== void 0 ? e.pageTurnAnimationDuration : 300, o;
|
|
5357
5367
|
}
|
|
@@ -5486,12 +5496,12 @@ class Is extends G {
|
|
|
5486
5496
|
);
|
|
5487
5497
|
}
|
|
5488
5498
|
),
|
|
5489
|
-
|
|
5499
|
+
A()
|
|
5490
5500
|
);
|
|
5491
5501
|
this.didLayout$ = c.pipe(
|
|
5492
5502
|
C((u) => u.type === "end"),
|
|
5493
5503
|
S((u) => u.data),
|
|
5494
|
-
|
|
5504
|
+
A()
|
|
5495
5505
|
);
|
|
5496
5506
|
}
|
|
5497
5507
|
validateDimension(e, t, i) {
|
|
@@ -5531,7 +5541,7 @@ class Zt extends Q {
|
|
|
5531
5541
|
s
|
|
5532
5542
|
), t.appendChild(this.containerElement);
|
|
5533
5543
|
const c = this.settings.values.getRenderer?.(e);
|
|
5534
|
-
this.resourcesHandler = new
|
|
5544
|
+
this.resourcesHandler = new nt(e, this.settings);
|
|
5535
5545
|
const u = {
|
|
5536
5546
|
context: i,
|
|
5537
5547
|
settings: o,
|
|
@@ -5656,7 +5666,7 @@ class vs extends G {
|
|
|
5656
5666
|
// Ideally loading faster is better but loading too close to user navigating can
|
|
5657
5667
|
// be dangerous.
|
|
5658
5668
|
Ie(100, re),
|
|
5659
|
-
|
|
5669
|
+
Ae(this.context.bridgeEvent.viewportFree$),
|
|
5660
5670
|
z(this.context.bridgeEvent.navigation$, r),
|
|
5661
5671
|
S(([, u, l]) => {
|
|
5662
5672
|
const { numberOfAdjacentSpineItemToPreLoad: d } = o.values, { beginIndex: g = 0, endIndex: p = 0 } = i.getVisibleSpineItemsFromPosition({
|
|
@@ -5804,7 +5814,7 @@ const xs = ({
|
|
|
5804
5814
|
visibleWidthOfItem: p
|
|
5805
5815
|
}) || y
|
|
5806
5816
|
};
|
|
5807
|
-
},
|
|
5817
|
+
}, Ge = ({
|
|
5808
5818
|
position: n,
|
|
5809
5819
|
spineItemsManager: e,
|
|
5810
5820
|
spineLayout: t
|
|
@@ -5814,7 +5824,7 @@ const xs = ({
|
|
|
5814
5824
|
return u && l;
|
|
5815
5825
|
});
|
|
5816
5826
|
return n.x === 0 && !i ? e.items[0] : i;
|
|
5817
|
-
},
|
|
5827
|
+
}, ze = ({
|
|
5818
5828
|
spineItemPosition: n,
|
|
5819
5829
|
itemLayout: { left: e, top: t }
|
|
5820
5830
|
}) => new M({
|
|
@@ -5829,7 +5839,7 @@ const xs = ({
|
|
|
5829
5839
|
useAbsoluteViewport: s = !0,
|
|
5830
5840
|
viewport: r
|
|
5831
5841
|
}) => {
|
|
5832
|
-
const a =
|
|
5842
|
+
const a = Ge({
|
|
5833
5843
|
position: n,
|
|
5834
5844
|
spineItemsManager: i,
|
|
5835
5845
|
spineLayout: o
|
|
@@ -5879,7 +5889,7 @@ const xs = ({
|
|
|
5879
5889
|
x: Math.max(h.x - y, 0),
|
|
5880
5890
|
y: Math.max(h.y - f, 0)
|
|
5881
5891
|
});
|
|
5882
|
-
}, a = (h) =>
|
|
5892
|
+
}, a = (h) => ze({
|
|
5883
5893
|
spineItemPosition: new E({ x: 0, y: 0 }),
|
|
5884
5894
|
itemLayout: o.getSpineItemSpineLayoutInfo(h)
|
|
5885
5895
|
}), c = (h) => n.items.find((m) => m.renderer.getDocumentFrame() === h), u = (h, m, y) => {
|
|
@@ -5905,11 +5915,11 @@ const xs = ({
|
|
|
5905
5915
|
viewport: b
|
|
5906
5916
|
}) => {
|
|
5907
5917
|
const F = y.numberOfPages, L = Array.from(Array(F)).map((se, ue) => {
|
|
5908
|
-
const
|
|
5918
|
+
const Ne = t.getSpineItemPositionFromPageIndex({
|
|
5909
5919
|
pageIndex: ue,
|
|
5910
5920
|
spineItem: y
|
|
5911
|
-
}), le =
|
|
5912
|
-
spineItemPosition:
|
|
5921
|
+
}), le = ze({
|
|
5922
|
+
spineItemPosition: Ne,
|
|
5913
5923
|
itemLayout: o.getSpineItemSpineLayoutInfo(y)
|
|
5914
5924
|
});
|
|
5915
5925
|
return {
|
|
@@ -5924,7 +5934,7 @@ const xs = ({
|
|
|
5924
5934
|
}
|
|
5925
5935
|
};
|
|
5926
5936
|
}).reduce(
|
|
5927
|
-
(se, { absolutePosition: ue, index:
|
|
5937
|
+
(se, { absolutePosition: ue, index: Ne }) => {
|
|
5928
5938
|
const le = I ? b.absoluteViewport : b.relativeViewport, Qt = Jt(
|
|
5929
5939
|
h,
|
|
5930
5940
|
b.absoluteViewport,
|
|
@@ -5938,7 +5948,7 @@ const xs = ({
|
|
|
5938
5948
|
threshold: m,
|
|
5939
5949
|
itemPosition: ue
|
|
5940
5950
|
});
|
|
5941
|
-
return tn ? [...se,
|
|
5951
|
+
return tn ? [...se, Ne] : se;
|
|
5942
5952
|
},
|
|
5943
5953
|
[]
|
|
5944
5954
|
), H = L[0], B = L[L.length - 1] ?? H;
|
|
@@ -5954,7 +5964,7 @@ const xs = ({
|
|
|
5954
5964
|
spineItemPosition: m
|
|
5955
5965
|
}) => {
|
|
5956
5966
|
const y = o.getSpineItemSpineLayoutInfo(h);
|
|
5957
|
-
return
|
|
5967
|
+
return ze({
|
|
5958
5968
|
itemLayout: y,
|
|
5959
5969
|
spineItemPosition: m
|
|
5960
5970
|
});
|
|
@@ -5967,7 +5977,7 @@ const xs = ({
|
|
|
5967
5977
|
spineItemsManager: n
|
|
5968
5978
|
}),
|
|
5969
5979
|
getSpineItemPagePositionFromSpinePosition: (h) => {
|
|
5970
|
-
const m =
|
|
5980
|
+
const m = Ge({
|
|
5971
5981
|
position: h,
|
|
5972
5982
|
spineItemsManager: n,
|
|
5973
5983
|
spineLayout: o
|
|
@@ -5996,7 +6006,7 @@ const xs = ({
|
|
|
5996
6006
|
},
|
|
5997
6007
|
getSpinePositionFromSpineItem: a,
|
|
5998
6008
|
getSpineItemPositionFromSpinePosition: r,
|
|
5999
|
-
getSpineItemFromPosition: (h) =>
|
|
6009
|
+
getSpineItemFromPosition: (h) => Ge({
|
|
6000
6010
|
position: h,
|
|
6001
6011
|
spineItemsManager: n,
|
|
6002
6012
|
spineLayout: o
|
|
@@ -6026,7 +6036,7 @@ const xs = ({
|
|
|
6026
6036
|
});
|
|
6027
6037
|
}
|
|
6028
6038
|
};
|
|
6029
|
-
}, Ms =
|
|
6039
|
+
}, Ms = D.namespace("spine"), Cs = ({
|
|
6030
6040
|
position: n,
|
|
6031
6041
|
pageSize: e
|
|
6032
6042
|
}) => new bi({
|
|
@@ -6089,7 +6099,7 @@ class Es extends Q {
|
|
|
6089
6099
|
const p = l.spineItem.renderer?.getDocumentFrame();
|
|
6090
6100
|
if (p && p?.contentWindow?.document && p.contentWindow.document.body !== null) {
|
|
6091
6101
|
const h = p.contentWindow.document;
|
|
6092
|
-
return
|
|
6102
|
+
return tt().pipe(
|
|
6093
6103
|
S(() => {
|
|
6094
6104
|
const m = Ln(
|
|
6095
6105
|
h,
|
|
@@ -6108,7 +6118,7 @@ class Es extends Q {
|
|
|
6108
6118
|
);
|
|
6109
6119
|
}),
|
|
6110
6120
|
S((a) => (Ms.info("Pages layout", a), { pages: a })),
|
|
6111
|
-
|
|
6121
|
+
A()
|
|
6112
6122
|
), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
|
|
6113
6123
|
}
|
|
6114
6124
|
}
|
|
@@ -6123,25 +6133,25 @@ class Ds extends G {
|
|
|
6123
6133
|
)
|
|
6124
6134
|
)
|
|
6125
6135
|
)),
|
|
6126
|
-
|
|
6136
|
+
A()
|
|
6127
6137
|
), this.itemResize$ = this.spineItemsManager.items$.pipe(
|
|
6128
6138
|
w((t) => {
|
|
6129
6139
|
const i = t.map(
|
|
6130
|
-
(o) =>
|
|
6140
|
+
(o) => et(o.element).pipe(
|
|
6131
6141
|
S((s) => ({ entries: s, item: o }))
|
|
6132
6142
|
)
|
|
6133
6143
|
);
|
|
6134
6144
|
return P(...i);
|
|
6135
6145
|
}),
|
|
6136
|
-
|
|
6146
|
+
A()
|
|
6137
6147
|
), this.itemLoad$ = this.spineItemsManager.items$.pipe(
|
|
6138
6148
|
w((t) => P(...t.map((i) => i.loaded$.pipe(S(() => i))))),
|
|
6139
|
-
|
|
6149
|
+
A()
|
|
6140
6150
|
), this.itemUnload$ = this.spineItemsManager.items$.pipe(
|
|
6141
6151
|
w((t) => P(
|
|
6142
6152
|
...t.map((i) => i.unloaded$.pipe(S(() => i)))
|
|
6143
6153
|
)),
|
|
6144
|
-
|
|
6154
|
+
A()
|
|
6145
6155
|
);
|
|
6146
6156
|
}
|
|
6147
6157
|
}
|
|
@@ -6205,7 +6215,7 @@ class As extends G {
|
|
|
6205
6215
|
)
|
|
6206
6216
|
),
|
|
6207
6217
|
T(this.destroy$),
|
|
6208
|
-
|
|
6218
|
+
A()
|
|
6209
6219
|
), this.layout$.subscribe(), this.watchForVerticalWritingUpdate();
|
|
6210
6220
|
}
|
|
6211
6221
|
watchForVerticalWritingUpdate() {
|
|
@@ -6223,7 +6233,7 @@ class As extends G {
|
|
|
6223
6233
|
}
|
|
6224
6234
|
getSpineItemSpineLayoutInfo(e) {
|
|
6225
6235
|
const t = this.spineItemsManager.getSpineItemIndex(e) ?? 0;
|
|
6226
|
-
return this.spineItemsRelativeLayouts[t] || new
|
|
6236
|
+
return this.spineItemsRelativeLayouts[t] || new Ve({
|
|
6227
6237
|
left: 0,
|
|
6228
6238
|
right: 0,
|
|
6229
6239
|
top: 0,
|
|
@@ -6255,7 +6265,7 @@ class As extends G {
|
|
|
6255
6265
|
createSpineItemLayout(e, t, i, o, s, r, a) {
|
|
6256
6266
|
if (e) {
|
|
6257
6267
|
const u = s + i, l = r + o;
|
|
6258
|
-
return new
|
|
6268
|
+
return new Ve({
|
|
6259
6269
|
left: i,
|
|
6260
6270
|
right: u,
|
|
6261
6271
|
top: o,
|
|
@@ -6267,7 +6277,7 @@ class As extends G {
|
|
|
6267
6277
|
});
|
|
6268
6278
|
}
|
|
6269
6279
|
const c = t ? a - i - s : i;
|
|
6270
|
-
return new
|
|
6280
|
+
return new Ve({
|
|
6271
6281
|
right: t ? a - i : i + s,
|
|
6272
6282
|
left: c,
|
|
6273
6283
|
x: c,
|
|
@@ -6385,7 +6395,7 @@ class Rs extends G {
|
|
|
6385
6395
|
}
|
|
6386
6396
|
// @todo move
|
|
6387
6397
|
getSpineItemFromCfi(e) {
|
|
6388
|
-
const { itemIndex: t } =
|
|
6398
|
+
const { itemIndex: t } = ot(e);
|
|
6389
6399
|
if (t !== void 0)
|
|
6390
6400
|
return this.get(t);
|
|
6391
6401
|
}
|
|
@@ -6478,7 +6488,7 @@ class Os extends Q {
|
|
|
6478
6488
|
});
|
|
6479
6489
|
}
|
|
6480
6490
|
}
|
|
6481
|
-
const
|
|
6491
|
+
const $t = `${Vt}-core`, Vs = (n) => {
|
|
6482
6492
|
const e = crypto.randomUUID(), t = new N(), i = new N(), o = new No(), s = new Do(), r = new ys(n, s), a = new Ao(s, r), c = new Rs(s, r), u = new Os(s, r), l = qt({
|
|
6483
6493
|
context: s,
|
|
6484
6494
|
settings: r,
|
|
@@ -6513,10 +6523,10 @@ const xt = `${Vt}-core`, Vs = (n) => {
|
|
|
6513
6523
|
}, y = ($) => {
|
|
6514
6524
|
const { containerElement: L, manifest: H } = $;
|
|
6515
6525
|
if (s.manifest) {
|
|
6516
|
-
|
|
6526
|
+
D.warn("loading a new book is not supported yet");
|
|
6517
6527
|
return;
|
|
6518
6528
|
}
|
|
6519
|
-
|
|
6529
|
+
D.log("load", { options: $ });
|
|
6520
6530
|
const B = js(L, e);
|
|
6521
6531
|
s.update({
|
|
6522
6532
|
manifest: H,
|
|
@@ -6529,9 +6539,9 @@ const xt = `${Vt}-core`, Vs = (n) => {
|
|
|
6529
6539
|
}),
|
|
6530
6540
|
K(i)
|
|
6531
6541
|
), b = P(I, f).subscribe();
|
|
6532
|
-
|
|
6542
|
+
Ee(document, $t, Ro);
|
|
6533
6543
|
const F = () => {
|
|
6534
|
-
|
|
6544
|
+
De(document, $t), b.unsubscribe(), c.destroy(), h.destroy(), r.destroy(), d.destroy(), s.destroy(), p.destroy(), g.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
|
|
6535
6545
|
};
|
|
6536
6546
|
return {
|
|
6537
6547
|
id: e,
|
|
@@ -6540,8 +6550,8 @@ const xt = `${Vt}-core`, Vs = (n) => {
|
|
|
6540
6550
|
hookManager: o,
|
|
6541
6551
|
cfi: {
|
|
6542
6552
|
generateCfiFromRange: oo,
|
|
6543
|
-
parseCfi:
|
|
6544
|
-
generateCfiForSpineItemPage:
|
|
6553
|
+
parseCfi: ot,
|
|
6554
|
+
generateCfiForSpineItemPage: Be,
|
|
6545
6555
|
resolveCfi: ($) => _t({ ...$, spineItemsManager: c })
|
|
6546
6556
|
},
|
|
6547
6557
|
navigation: p,
|
|
@@ -6633,7 +6643,7 @@ export {
|
|
|
6633
6643
|
No as HookManager,
|
|
6634
6644
|
ii as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
|
|
6635
6645
|
Qo as InternalNavigator,
|
|
6636
|
-
|
|
6646
|
+
it as LayoutEntry,
|
|
6637
6647
|
Xt as Locker,
|
|
6638
6648
|
Gs as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
|
|
6639
6649
|
Ys as PROSE_READER_NAMESPACE,
|
|
@@ -6641,51 +6651,51 @@ export {
|
|
|
6641
6651
|
gs as Pagination,
|
|
6642
6652
|
hs as PaginationController,
|
|
6643
6653
|
Q as ReactiveEntity,
|
|
6644
|
-
|
|
6654
|
+
nt as ResourceHandler,
|
|
6645
6655
|
co as ResourcesLocator,
|
|
6646
6656
|
To as ScrollNavigationController,
|
|
6647
|
-
|
|
6657
|
+
ft as ScrollPosition,
|
|
6648
6658
|
fs as SettingsManager,
|
|
6649
6659
|
Ns as Spine,
|
|
6650
6660
|
Zt as SpineItem,
|
|
6651
6661
|
Ii as SpineItemPageLayout,
|
|
6652
6662
|
bi as SpineItemPageSpineLayout,
|
|
6653
6663
|
E as SpineItemPosition,
|
|
6654
|
-
|
|
6664
|
+
Ve as SpineItemSpineLayout,
|
|
6655
6665
|
Rs as SpineItemsManager,
|
|
6656
6666
|
Ds as SpineItemsObserver,
|
|
6657
6667
|
M as SpinePosition,
|
|
6658
6668
|
$o as UnboundScrollPosition,
|
|
6659
|
-
|
|
6669
|
+
Oe as UnboundSpineItemPagePosition,
|
|
6660
6670
|
ae as UnboundSpinePosition,
|
|
6661
6671
|
qs as VIEWPORT_ADJUSTMENT_THROTTLE,
|
|
6662
6672
|
Os as Viewport,
|
|
6663
6673
|
ao as consolidate,
|
|
6664
6674
|
Ks as createReader,
|
|
6665
|
-
|
|
6675
|
+
ct as deferIdle,
|
|
6666
6676
|
Yn as deferNextResult,
|
|
6667
|
-
|
|
6677
|
+
Be as generateCfiForSpineItemPage,
|
|
6668
6678
|
oo as generateCfiFromRange,
|
|
6669
6679
|
de as generateRootCfi,
|
|
6670
|
-
|
|
6680
|
+
at as getAttributeValueFromString,
|
|
6671
6681
|
Hs as getBase64FromBlob,
|
|
6672
|
-
|
|
6682
|
+
Ke as getFrameViewportInfo,
|
|
6673
6683
|
Js as getItemAnchor,
|
|
6674
6684
|
Si as htmlEnhancer,
|
|
6675
|
-
|
|
6685
|
+
tt as idle,
|
|
6676
6686
|
Vn as injectCSSToFrame,
|
|
6677
6687
|
Z as isDefined,
|
|
6678
6688
|
At as isHtmlElement,
|
|
6679
6689
|
Rn as isHtmlTagElement,
|
|
6680
|
-
|
|
6690
|
+
Xe as isRootCfi,
|
|
6681
6691
|
nr as isShallowEqual,
|
|
6682
6692
|
Ai as layoutEnhancer,
|
|
6683
6693
|
Nt as mapKeysTo,
|
|
6684
6694
|
Bs as observeIntersection,
|
|
6685
|
-
|
|
6686
|
-
|
|
6695
|
+
ut as observeMutation,
|
|
6696
|
+
et as observeResize,
|
|
6687
6697
|
uo as paginationEnhancer,
|
|
6688
|
-
|
|
6698
|
+
ot as parseCfi,
|
|
6689
6699
|
Xn as pick,
|
|
6690
6700
|
_s as removeCSS,
|
|
6691
6701
|
_t as resolveCfi,
|
|
@@ -6694,7 +6704,7 @@ export {
|
|
|
6694
6704
|
oe as upsertCSSToFrame,
|
|
6695
6705
|
jn as waitForFrameLoad,
|
|
6696
6706
|
kn as waitForFrameReady,
|
|
6697
|
-
|
|
6698
|
-
|
|
6707
|
+
Ae as waitForSwitch,
|
|
6708
|
+
Qe as watchKeys
|
|
6699
6709
|
};
|
|
6700
6710
|
//# sourceMappingURL=index.js.map
|