@prose-reader/core 1.270.0 → 1.272.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/cfi/generate.d.ts +4 -6
- package/dist/createReaderWithEnhancer.d.ts +4 -4
- package/dist/enhancers/layout/createPlaceholderPages.d.ts +3 -19
- package/dist/enhancers/layout/flagSpineItems.d.ts +3 -6
- package/dist/index.js +1123 -1125
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +17 -17
- package/dist/index.umd.cjs.map +1 -1
- package/dist/reader.d.ts +5 -5
- package/dist/spine/Pages.d.ts +1 -1
- package/dist/spine/Spine.d.ts +3 -14
- package/dist/spine/SpineItemsObserver.d.ts +6 -7
- package/dist/spine/SpineLayout.d.ts +8 -2
- package/dist/spineItem/SpineItem.d.ts +11 -13
- package/dist/spineItem/SpineItemLayout.d.ts +4 -16
- package/dist/spineItem/renderer/DocumentRenderer.d.ts +1 -0
- package/package.json +4 -4
- package/dist/spine/layout/layoutItem.d.ts +0 -22
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { switchMap as w, of as v, fromEvent as
|
|
2
|
-
import { Report as
|
|
3
|
-
import { isShallowEqual as
|
|
4
|
-
import { switchMap as
|
|
5
|
-
import { generate as We, parse as
|
|
6
|
-
const $n = "@prose-reader/core",
|
|
1
|
+
import { switchMap as w, of as v, fromEvent as X, take as $t, map as S, from as k, takeUntil as T, Observable as ce, defer as Tt, Subject as N, combineLatest as j, merge as P, EMPTY as _, NEVER as he, tap as x, share as D, BehaviorSubject as q, distinctUntilChanged as R, filter as C, mergeMap as ge, first as U, endWith as fe, catchError as ze, 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 Pe, timer as Te, skip as Ft, ReplaySubject as ot, identity as xe, concatMap as ln } from "rxjs";
|
|
2
|
+
import { Report as dn, isShallowEqual as O, shallowMergeIfDefined as $e, getParentPath as pn, parseContentType as gn, detectMimeTypeFromName as Me, arrayEqual as hn } from "@prose-reader/shared";
|
|
3
|
+
import { isShallowEqual as tr } from "@prose-reader/shared";
|
|
4
|
+
import { switchMap as Y, first as mn, map as ie, distinctUntilChanged as be, startWith as fn, shareReplay as Ge, 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 st, share as vn } from "rxjs/operators";
|
|
5
|
+
import { generate as We, parse as Mt, isIndirectionOnly as wn, isParsedCfiRange as Pn, resolve as xn } from "@prose-reader/cfi";
|
|
6
|
+
const $n = "@prose-reader/core", A = dn.namespace($n, void 0, {
|
|
7
7
|
color: "#98cde7"
|
|
8
8
|
}), Tn = [
|
|
9
9
|
"pointercancel",
|
|
@@ -25,17 +25,19 @@ function Fn(n, e, t) {
|
|
|
25
25
|
return n.caretRangeFromPoint(e, t);
|
|
26
26
|
}
|
|
27
27
|
const Ln = (n, e) => {
|
|
28
|
-
const t = "
|
|
29
|
-
if (t)
|
|
28
|
+
const t = "createRange" in n ? n : n.ownerDocument;
|
|
29
|
+
if (!t) return;
|
|
30
|
+
const i = "body" in n ? _e(n.body, e) : _e(n, e);
|
|
31
|
+
if (i) {
|
|
30
32
|
let o, s = 0;
|
|
31
|
-
const r =
|
|
32
|
-
return Array.from(
|
|
33
|
+
const r = t.createRange();
|
|
34
|
+
return Array.from(i.childNodes).some((a) => {
|
|
33
35
|
r.selectNodeContents(a);
|
|
34
36
|
const c = r.getClientRects(), u = Mn(c, e);
|
|
35
37
|
if (u) {
|
|
36
38
|
o = r.cloneRange();
|
|
37
39
|
const l = Fn(
|
|
38
|
-
|
|
40
|
+
t,
|
|
39
41
|
Math.ceil(u.left),
|
|
40
42
|
Math.ceil(u.top)
|
|
41
43
|
);
|
|
@@ -45,10 +47,10 @@ const Ln = (n, e) => {
|
|
|
45
47
|
}), o ? {
|
|
46
48
|
node: o.startContainer,
|
|
47
49
|
offset: s
|
|
48
|
-
} : { node:
|
|
50
|
+
} : { node: i, offset: 0 };
|
|
49
51
|
}
|
|
50
52
|
}, _e = (n, e) => {
|
|
51
|
-
const t = n.getBoundingClientRect(), i =
|
|
53
|
+
const t = n.getBoundingClientRect(), i = Ct(
|
|
52
54
|
t,
|
|
53
55
|
e
|
|
54
56
|
);
|
|
@@ -61,12 +63,12 @@ const Ln = (n, e) => {
|
|
|
61
63
|
}
|
|
62
64
|
return o;
|
|
63
65
|
};
|
|
64
|
-
function
|
|
66
|
+
function Ct(n, { left: e, right: t }) {
|
|
65
67
|
return n.left <= e && n.right <= e ? "before" : n.left <= e && n.right > e && n.right <= t ? "partially-before" : n.left <= t && n.right > t ? "partially-after" : n.left > t ? "after" : "within";
|
|
66
68
|
}
|
|
67
69
|
function Mn(n, e) {
|
|
68
70
|
return Array.from(n).find((t) => {
|
|
69
|
-
const i =
|
|
71
|
+
const i = Ct(t, e);
|
|
70
72
|
return i !== "before" && i !== "after";
|
|
71
73
|
});
|
|
72
74
|
}
|
|
@@ -77,11 +79,11 @@ const Cn = (n, e) => {
|
|
|
77
79
|
try {
|
|
78
80
|
e <= (t?.endOffset || 0) && t?.setStart(n, e || 0);
|
|
79
81
|
} catch (i) {
|
|
80
|
-
|
|
82
|
+
A.error(i);
|
|
81
83
|
}
|
|
82
84
|
return t;
|
|
83
85
|
}
|
|
84
|
-
},
|
|
86
|
+
}, Ze = (n) => {
|
|
85
87
|
if (n?.target && n?.target?.ownerDocument?.defaultView) {
|
|
86
88
|
const e = n?.target?.ownerDocument?.defaultView;
|
|
87
89
|
if (e.PointerEvent && n instanceof e.PointerEvent)
|
|
@@ -94,7 +96,7 @@ const Cn = (n, e) => {
|
|
|
94
96
|
}
|
|
95
97
|
return !!Tn.includes(n.type);
|
|
96
98
|
}, En = (n) => {
|
|
97
|
-
if (
|
|
99
|
+
if (Ze(n)) return !1;
|
|
98
100
|
if (n?.target && n?.target?.ownerDocument?.defaultView) {
|
|
99
101
|
const e = n?.target?.ownerDocument?.defaultView;
|
|
100
102
|
if (e.MouseEvent)
|
|
@@ -118,7 +120,7 @@ const Cn = (n, e) => {
|
|
|
118
120
|
return n instanceof e.TouchEvent;
|
|
119
121
|
}
|
|
120
122
|
return !1;
|
|
121
|
-
},
|
|
123
|
+
}, An = () => document.createElement("div"), Et = (n) => {
|
|
122
124
|
const e = [
|
|
123
125
|
"img",
|
|
124
126
|
// Images
|
|
@@ -134,8 +136,8 @@ const Cn = (n, e) => {
|
|
|
134
136
|
// JavaScript files
|
|
135
137
|
].join(",");
|
|
136
138
|
return Array.from(n?.querySelectorAll(e) || []);
|
|
137
|
-
},
|
|
138
|
-
if (
|
|
139
|
+
}, Nn = (n) => {
|
|
140
|
+
if (Et(n).forEach((t) => {
|
|
139
141
|
const i = t.getAttribute("src") || t.getAttribute("href");
|
|
140
142
|
i?.startsWith("blob:") && n?.defaultView?.URL.revokeObjectURL(i);
|
|
141
143
|
}), n) {
|
|
@@ -152,7 +154,7 @@ const Cn = (n, e) => {
|
|
|
152
154
|
}
|
|
153
155
|
}
|
|
154
156
|
};
|
|
155
|
-
function
|
|
157
|
+
function Dt(n, e, t = []) {
|
|
156
158
|
if (typeof n != "object" || n === null) return !1;
|
|
157
159
|
for (const i of e)
|
|
158
160
|
if (!(i in n)) return !1;
|
|
@@ -161,19 +163,19 @@ function At(n, e, t = []) {
|
|
|
161
163
|
return !1;
|
|
162
164
|
return !0;
|
|
163
165
|
}
|
|
164
|
-
function
|
|
165
|
-
return
|
|
166
|
+
function At(n) {
|
|
167
|
+
return Dt(
|
|
166
168
|
n,
|
|
167
169
|
["nodeType"],
|
|
168
170
|
[]
|
|
169
171
|
// biome-ignore lint/suspicious/noExplicitAny: TODO
|
|
170
172
|
) && n.nodeType === Node.ELEMENT_NODE;
|
|
171
173
|
}
|
|
172
|
-
function
|
|
173
|
-
return
|
|
174
|
+
function Rn(n, e) {
|
|
175
|
+
return At(n) && n.tagName.toLowerCase() === e.toLowerCase();
|
|
174
176
|
}
|
|
175
177
|
function On(n) {
|
|
176
|
-
return
|
|
178
|
+
return Dt(
|
|
177
179
|
n,
|
|
178
180
|
[
|
|
179
181
|
"startContainer",
|
|
@@ -196,12 +198,12 @@ const Ce = (n, e, t, i) => {
|
|
|
196
198
|
const t = n.getElementById(e);
|
|
197
199
|
t && t.remove();
|
|
198
200
|
}
|
|
199
|
-
},
|
|
201
|
+
}, rt = (n, e) => {
|
|
200
202
|
const t = new RegExp(`${e}\\s*=\\s*([0-9.]+)`, "i"), i = n.match(t) || [], o = i[1] || "0";
|
|
201
203
|
return i && Number.parseFloat(o) || 0;
|
|
202
204
|
}, Vn = (n, e, t, i) => {
|
|
203
205
|
n?.contentDocument?.head && Ce(n.contentDocument, e, t, i);
|
|
204
|
-
},
|
|
206
|
+
}, Ws = (n, e) => {
|
|
205
207
|
n?.contentDocument && Ee(n.contentDocument, e);
|
|
206
208
|
}, oe = (n, e, t, i) => {
|
|
207
209
|
if (!n) return;
|
|
@@ -213,13 +215,13 @@ const Ce = (n, e, t, i) => {
|
|
|
213
215
|
return;
|
|
214
216
|
}
|
|
215
217
|
Vn(n, e, t, i);
|
|
216
|
-
},
|
|
218
|
+
}, Je = (n) => {
|
|
217
219
|
if (n?.contentDocument) {
|
|
218
220
|
const t = n.contentDocument.querySelector("meta[name='viewport']");
|
|
219
221
|
if (t) {
|
|
220
222
|
const i = t.getAttribute("content");
|
|
221
223
|
if (i) {
|
|
222
|
-
const o =
|
|
224
|
+
const o = rt(i, "width"), s = rt(i, "height");
|
|
223
225
|
return o > 0 && s > 0 ? {
|
|
224
226
|
hasViewport: !0,
|
|
225
227
|
width: o,
|
|
@@ -230,14 +232,14 @@ const Ce = (n, e, t, i) => {
|
|
|
230
232
|
}
|
|
231
233
|
return { hasViewport: !1 };
|
|
232
234
|
}, jn = (n) => n.pipe(
|
|
233
|
-
w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) :
|
|
234
|
-
|
|
235
|
+
w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : X(e, "load").pipe(
|
|
236
|
+
$t(1),
|
|
235
237
|
S(() => e)
|
|
236
238
|
))
|
|
237
239
|
), kn = (n) => n.pipe(
|
|
238
240
|
w((e) => {
|
|
239
241
|
const t = e?.contentDocument?.fonts.ready;
|
|
240
|
-
return t ?
|
|
242
|
+
return t ? k(t).pipe(S(() => e)) : v(void 0);
|
|
241
243
|
})
|
|
242
244
|
), Un = (n) => (e) => {
|
|
243
245
|
const t = n(e), i = new IntersectionObserver((o) => {
|
|
@@ -276,7 +278,7 @@ const Ce = (n, e, t, i) => {
|
|
|
276
278
|
};
|
|
277
279
|
}, zn = (n) => (e) => {
|
|
278
280
|
const t = n(e);
|
|
279
|
-
return t.context.watch("rootElement").pipe(
|
|
281
|
+
return t.context.watch("rootElement").pipe(T(t.context.destroy$)).subscribe((i) => {
|
|
280
282
|
if (!i) return;
|
|
281
283
|
const o = () => {
|
|
282
284
|
t.settings.values.computedPageTurnMode === "controlled" && i.scrollTo(0, 0);
|
|
@@ -286,7 +288,7 @@ const Ce = (n, e, t, i) => {
|
|
|
286
288
|
const s = t.spineItemsManager.get(i)?.renderer.getDocumentFrame();
|
|
287
289
|
s && s.contentDocument?.body.setAttribute("tabindex", "-1");
|
|
288
290
|
}), t;
|
|
289
|
-
},
|
|
291
|
+
}, Ne = ({
|
|
290
292
|
position: n,
|
|
291
293
|
frameElement: e
|
|
292
294
|
}) => {
|
|
@@ -300,8 +302,8 @@ const Ce = (n, e, t, i) => {
|
|
|
300
302
|
if (!e || !o) return n;
|
|
301
303
|
const s = t.getSpineItemFromIframe(o), r = o, { height: a, width: c } = i.pageSize;
|
|
302
304
|
if (!s || !(r instanceof HTMLIFrameElement)) return n;
|
|
303
|
-
if (
|
|
304
|
-
const { clientX: u, clientY: l } =
|
|
305
|
+
if (Ze(n)) {
|
|
306
|
+
const { clientX: u, clientY: l } = Ne({
|
|
305
307
|
position: n,
|
|
306
308
|
frameElement: r
|
|
307
309
|
}), d = new PointerEvent(n.type, {
|
|
@@ -316,7 +318,7 @@ const Ce = (n, e, t, i) => {
|
|
|
316
318
|
}), d;
|
|
317
319
|
}
|
|
318
320
|
if (En(n)) {
|
|
319
|
-
const { clientX: u, clientY: l } =
|
|
321
|
+
const { clientX: u, clientY: l } = Ne({
|
|
320
322
|
position: n,
|
|
321
323
|
frameElement: r
|
|
322
324
|
}), d = new MouseEvent(n.type, {
|
|
@@ -331,15 +333,15 @@ const Ce = (n, e, t, i) => {
|
|
|
331
333
|
}
|
|
332
334
|
if (Dn(n)) {
|
|
333
335
|
const u = Array.from(n.touches).map((d) => {
|
|
334
|
-
const { clientX:
|
|
336
|
+
const { clientX: g, clientY: p } = Ne({
|
|
335
337
|
position: d,
|
|
336
338
|
frameElement: r
|
|
337
339
|
});
|
|
338
340
|
return new Touch({
|
|
339
341
|
identifier: d.identifier,
|
|
340
342
|
target: d.target,
|
|
341
|
-
clientX:
|
|
342
|
-
clientY:
|
|
343
|
+
clientX: g,
|
|
344
|
+
clientY: p
|
|
343
345
|
});
|
|
344
346
|
}), l = new TouchEvent(n.type, {
|
|
345
347
|
touches: u,
|
|
@@ -374,14 +376,14 @@ const Ce = (n, e, t, i) => {
|
|
|
374
376
|
const a = Hn.map((c) => {
|
|
375
377
|
const u = (l) => {
|
|
376
378
|
let d = l;
|
|
377
|
-
if (
|
|
378
|
-
const
|
|
379
|
+
if (Ze(l) && (d = new PointerEvent(l.type, l)), d !== l) {
|
|
380
|
+
const g = Wn(
|
|
379
381
|
d,
|
|
380
382
|
l,
|
|
381
383
|
t.spine.locator,
|
|
382
384
|
t.viewport
|
|
383
385
|
);
|
|
384
|
-
t.context.value.rootElement?.dispatchEvent(
|
|
386
|
+
t.context.value.rootElement?.dispatchEvent(g);
|
|
385
387
|
}
|
|
386
388
|
};
|
|
387
389
|
return r.contentDocument?.addEventListener(c, u), () => {
|
|
@@ -395,15 +397,15 @@ const Ce = (n, e, t, i) => {
|
|
|
395
397
|
});
|
|
396
398
|
}
|
|
397
399
|
), t;
|
|
398
|
-
},
|
|
400
|
+
}, Nt = (n) => ie((e) => Object.entries(e).reduce(
|
|
399
401
|
(t, [i, o]) => n.includes(i) ? {
|
|
400
402
|
...t,
|
|
401
403
|
[i]: o
|
|
402
404
|
} : t,
|
|
403
405
|
{}
|
|
404
|
-
)),
|
|
405
|
-
function
|
|
406
|
-
return new
|
|
406
|
+
)), Ke = (n) => (e) => e.pipe(Nt(n), be(O));
|
|
407
|
+
function Qe(n) {
|
|
408
|
+
return new ce((e) => {
|
|
407
409
|
const t = new ResizeObserver((i) => {
|
|
408
410
|
e.next(i);
|
|
409
411
|
});
|
|
@@ -413,9 +415,9 @@ function et(n) {
|
|
|
413
415
|
});
|
|
414
416
|
}
|
|
415
417
|
const De = (n) => (e) => e.pipe(
|
|
416
|
-
|
|
418
|
+
Y(
|
|
417
419
|
(t) => n.pipe(
|
|
418
|
-
|
|
420
|
+
mn(),
|
|
419
421
|
ie(() => t)
|
|
420
422
|
)
|
|
421
423
|
)
|
|
@@ -426,8 +428,8 @@ const De = (n) => (e) => e.pipe(
|
|
|
426
428
|
});
|
|
427
429
|
return () => (t.unsubscribe(), e ? v(e.result) : n);
|
|
428
430
|
};
|
|
429
|
-
function
|
|
430
|
-
return new
|
|
431
|
+
function et() {
|
|
432
|
+
return new ce((n) => {
|
|
431
433
|
if (window.requestIdleCallback) {
|
|
432
434
|
const t = window.requestIdleCallback(() => {
|
|
433
435
|
n.next(), n.complete();
|
|
@@ -440,17 +442,17 @@ function Vt() {
|
|
|
440
442
|
return () => clearTimeout(e);
|
|
441
443
|
});
|
|
442
444
|
}
|
|
443
|
-
function
|
|
444
|
-
return
|
|
445
|
+
function at(n) {
|
|
446
|
+
return Tt(() => et().pipe(Y(n)));
|
|
445
447
|
}
|
|
446
|
-
const
|
|
448
|
+
const ct = (n, e) => new ce((t) => {
|
|
447
449
|
const i = new MutationObserver((o) => {
|
|
448
450
|
t.next(o);
|
|
449
451
|
});
|
|
450
452
|
return i.observe(n, e), () => i.disconnect();
|
|
451
453
|
});
|
|
452
|
-
function
|
|
453
|
-
return new
|
|
454
|
+
function _s(n, e) {
|
|
455
|
+
return new ce((t) => {
|
|
454
456
|
const i = new IntersectionObserver((o) => {
|
|
455
457
|
t.next(o);
|
|
456
458
|
}, e);
|
|
@@ -459,7 +461,7 @@ function Hs(n, e) {
|
|
|
459
461
|
};
|
|
460
462
|
});
|
|
461
463
|
}
|
|
462
|
-
class
|
|
464
|
+
class Rt {
|
|
463
465
|
constructor(e, t) {
|
|
464
466
|
this.settingsManager = t;
|
|
465
467
|
const i = $e(
|
|
@@ -469,12 +471,12 @@ class jt {
|
|
|
469
471
|
this.outputSettings = this.computeOutputSettings(i), this.inputSettings = $e(
|
|
470
472
|
this.getDefaultSettings(),
|
|
471
473
|
e
|
|
472
|
-
), this.outputSettingsUpdateSubject = new
|
|
474
|
+
), this.outputSettingsUpdateSubject = new N(), this.values$ = j([
|
|
473
475
|
this.settingsManager.values$,
|
|
474
|
-
this.outputSettingsUpdateSubject.pipe(
|
|
476
|
+
this.outputSettingsUpdateSubject.pipe(fn(this.outputSettings))
|
|
475
477
|
]).pipe(
|
|
476
478
|
ie(([o, s]) => ({ ...o, ...s })),
|
|
477
|
-
|
|
479
|
+
Ge(1)
|
|
478
480
|
), this.values$.subscribe();
|
|
479
481
|
}
|
|
480
482
|
_prepareUpdate(e) {
|
|
@@ -498,16 +500,16 @@ class jt {
|
|
|
498
500
|
};
|
|
499
501
|
}
|
|
500
502
|
watch(e) {
|
|
501
|
-
return Array.isArray(e) ? this.values$.pipe(
|
|
503
|
+
return Array.isArray(e) ? this.values$.pipe(Ke(e)) : this.values$.pipe(
|
|
502
504
|
ie((t) => t[e]),
|
|
503
|
-
|
|
505
|
+
be(O)
|
|
504
506
|
);
|
|
505
507
|
}
|
|
506
508
|
destroy() {
|
|
507
509
|
this.outputSettingsUpdateSubject.complete();
|
|
508
510
|
}
|
|
509
511
|
}
|
|
510
|
-
const
|
|
512
|
+
const Hs = (n) => {
|
|
511
513
|
const e = new FileReader();
|
|
512
514
|
return new Promise((t) => {
|
|
513
515
|
e.addEventListener(
|
|
@@ -519,12 +521,12 @@ const Bs = (n) => {
|
|
|
519
521
|
), e.readAsDataURL(n);
|
|
520
522
|
});
|
|
521
523
|
};
|
|
522
|
-
let Yn = class extends
|
|
524
|
+
let Yn = class extends Rt {
|
|
523
525
|
computeOutputSettings(e) {
|
|
524
526
|
return e;
|
|
525
527
|
}
|
|
526
528
|
hasSettingsChanged(e) {
|
|
527
|
-
return !
|
|
529
|
+
return !O(this.outputSettings, e);
|
|
528
530
|
}
|
|
529
531
|
getCleanedParentInputSettings(e) {
|
|
530
532
|
const {
|
|
@@ -546,7 +548,7 @@ let Yn = class extends jt {
|
|
|
546
548
|
}
|
|
547
549
|
};
|
|
548
550
|
const qn = (n) => (e) => {
|
|
549
|
-
const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new
|
|
551
|
+
const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new N(), a = n(e), c = new Yn(
|
|
550
552
|
{
|
|
551
553
|
fontScale: t,
|
|
552
554
|
lineHeight: i,
|
|
@@ -562,29 +564,29 @@ const qn = (n) => (e) => {
|
|
|
562
564
|
${c.values.fontWeight !== "publisher" ? `font-weight: ${c.values.fontWeight} !important;` : ""}
|
|
563
565
|
${c.values.fontJustification !== "publisher" ? `text-align: ${c.values.fontJustification} !important;` : ""}
|
|
564
566
|
}
|
|
565
|
-
`, l = (
|
|
566
|
-
a.spineItemsManager.items.forEach((
|
|
567
|
-
if (
|
|
568
|
-
const h =
|
|
567
|
+
`, l = (g) => {
|
|
568
|
+
a.spineItemsManager.items.forEach((p) => {
|
|
569
|
+
if (p.renditionLayout !== "pre-paginated") {
|
|
570
|
+
const h = p.renderer.getDocumentFrame();
|
|
569
571
|
h && oe(h, "prose-reader-fonts", u());
|
|
570
572
|
}
|
|
571
|
-
}),
|
|
573
|
+
}), g && a.layout();
|
|
572
574
|
};
|
|
573
|
-
a.hookManager.register("item.onDocumentLoad", ({ itemId:
|
|
574
|
-
const
|
|
575
|
-
if (
|
|
576
|
-
const h =
|
|
575
|
+
a.hookManager.register("item.onDocumentLoad", ({ itemId: g }) => {
|
|
576
|
+
const p = a.spineItemsManager.get(g);
|
|
577
|
+
if (p?.renditionLayout !== "pre-paginated") {
|
|
578
|
+
const h = p?.renderer.getDocumentFrame();
|
|
577
579
|
h && oe(h, "prose-reader-fonts", u());
|
|
578
580
|
}
|
|
579
581
|
});
|
|
580
|
-
const d = (
|
|
581
|
-
|
|
582
|
-
S(([
|
|
582
|
+
const d = (g) => g.pipe(
|
|
583
|
+
yn(),
|
|
584
|
+
S(([p, h]) => h.fontScale !== p.fontScale || h.lineHeight !== p.lineHeight)
|
|
583
585
|
);
|
|
584
586
|
return c.values$.pipe(
|
|
585
587
|
d,
|
|
586
|
-
|
|
587
|
-
|
|
588
|
+
V(l),
|
|
589
|
+
T(a.$.destroy$)
|
|
588
590
|
).subscribe(), {
|
|
589
591
|
...a,
|
|
590
592
|
destroy: () => {
|
|
@@ -593,7 +595,7 @@ const qn = (n) => (e) => {
|
|
|
593
595
|
settings: c
|
|
594
596
|
};
|
|
595
597
|
}, Gn = (n) => (e) => {
|
|
596
|
-
const t = n(e), i = (o) =>
|
|
598
|
+
const t = n(e), i = (o) => X(o, "keyup").pipe(
|
|
597
599
|
S((s) => {
|
|
598
600
|
const { pageTurnDirection: r, computedPageTurnMode: a } = t.settings.values;
|
|
599
601
|
if (a === "scrollable")
|
|
@@ -613,7 +615,7 @@ const qn = (n) => (e) => {
|
|
|
613
615
|
return s;
|
|
614
616
|
})
|
|
615
617
|
);
|
|
616
|
-
return i(document).pipe(
|
|
618
|
+
return i(document).pipe(T(t.$.destroy$)).subscribe(), t.spineItemsManager.items$.pipe(
|
|
617
619
|
w(
|
|
618
620
|
(o) => P(
|
|
619
621
|
...o.map(
|
|
@@ -626,7 +628,7 @@ const qn = (n) => (e) => {
|
|
|
626
628
|
)
|
|
627
629
|
)
|
|
628
630
|
),
|
|
629
|
-
|
|
631
|
+
T(t.$.destroy$)
|
|
630
632
|
).subscribe(), t;
|
|
631
633
|
}, Zn = (n) => n.spine.spineItemsManager.items$.pipe(
|
|
632
634
|
w(
|
|
@@ -638,7 +640,7 @@ const qn = (n) => (e) => {
|
|
|
638
640
|
const s = Array.from(
|
|
639
641
|
i.contentDocument.querySelectorAll("a")
|
|
640
642
|
).map(
|
|
641
|
-
(r) =>
|
|
643
|
+
(r) => X(r, "click")
|
|
642
644
|
);
|
|
643
645
|
return P(...s);
|
|
644
646
|
})
|
|
@@ -648,11 +650,11 @@ const qn = (n) => (e) => {
|
|
|
648
650
|
x((e) => {
|
|
649
651
|
e.preventDefault();
|
|
650
652
|
}),
|
|
651
|
-
|
|
653
|
+
D()
|
|
652
654
|
);
|
|
653
|
-
class Q extends
|
|
655
|
+
class Q extends ce {
|
|
654
656
|
constructor(e) {
|
|
655
|
-
super((t) => this.stateSubject.pipe(
|
|
657
|
+
super((t) => this.stateSubject.pipe(T(this._destroy$)).subscribe(t)), this._destroy$ = new N(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new q(e);
|
|
656
658
|
}
|
|
657
659
|
next(e) {
|
|
658
660
|
this.stateSubject.next(e);
|
|
@@ -662,12 +664,12 @@ class Q extends se {
|
|
|
662
664
|
*/
|
|
663
665
|
mergeCompare(e) {
|
|
664
666
|
const t = { ...this.value, ...e };
|
|
665
|
-
|
|
667
|
+
O(this.value, t) || this.stateSubject.next(t);
|
|
666
668
|
}
|
|
667
669
|
watch(e) {
|
|
668
|
-
return Array.isArray(e) ? this.stateSubject.pipe(
|
|
670
|
+
return Array.isArray(e) ? this.stateSubject.pipe(Ke(e)) : this.stateSubject.pipe(
|
|
669
671
|
S((t) => t[e]),
|
|
670
|
-
|
|
672
|
+
R(O)
|
|
671
673
|
);
|
|
672
674
|
}
|
|
673
675
|
get value() {
|
|
@@ -682,52 +684,51 @@ const Le = class Le extends Q {
|
|
|
682
684
|
super({
|
|
683
685
|
state: "idle",
|
|
684
686
|
error: void 0
|
|
685
|
-
}), this.triggerSubject = new
|
|
687
|
+
}), this.triggerSubject = new N(), this.context = e.context, this.settings = e.settings, this.hookManager = e.hookManager, this.item = e.item, this.containerElement = e.containerElement, this.resourcesHandler = e.resourcesHandler, this.viewport = e.viewport;
|
|
686
688
|
const t = this.triggerSubject.pipe(
|
|
687
|
-
|
|
689
|
+
C((o) => o.type === "unload")
|
|
688
690
|
), i = this.triggerSubject.pipe(
|
|
689
|
-
|
|
691
|
+
C((o) => o.type === "load")
|
|
690
692
|
);
|
|
691
693
|
this.loaded$ = i.pipe(
|
|
692
|
-
ge(() => this.value.state === "loaded" || this.value.state === "loading" ? _ : (this.next({ state: "loading", error: void 0 }), this.onCreateDocument().pipe(
|
|
693
|
-
ge((
|
|
694
|
+
ge(() => this.value.state === "loaded" || this.value.state === "loading" ? _ : (this.next({ state: "loading", error: void 0 }), this.onCreateDocument().pipe(U()).pipe(
|
|
695
|
+
ge((r) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
|
|
694
696
|
itemId: this.item.id,
|
|
695
|
-
documentContainer:
|
|
697
|
+
documentContainer: r
|
|
696
698
|
}), this.onLoadDocument().pipe(
|
|
697
|
-
|
|
698
|
-
|
|
699
|
+
fe(null),
|
|
700
|
+
U()
|
|
699
701
|
).pipe(
|
|
700
702
|
De(this.context.bridgeEvent.viewportFree$),
|
|
701
703
|
w(() => {
|
|
702
|
-
const
|
|
704
|
+
const c = this.hookManager.execute("item.onDocumentLoad", this.item.id, {
|
|
703
705
|
itemId: this.item.id,
|
|
704
|
-
documentContainer:
|
|
706
|
+
documentContainer: r
|
|
705
707
|
}).filter(
|
|
706
|
-
(
|
|
708
|
+
(u) => u instanceof ce
|
|
707
709
|
);
|
|
708
|
-
return
|
|
710
|
+
return j([v(null), ...c]).pipe(U());
|
|
709
711
|
})
|
|
710
712
|
))),
|
|
711
713
|
S(() => {
|
|
712
714
|
this.next({ state: "loaded", error: void 0 });
|
|
713
715
|
}),
|
|
714
|
-
|
|
716
|
+
T(t)
|
|
715
717
|
))),
|
|
716
|
-
|
|
717
|
-
)
|
|
718
|
-
const o = t.pipe(
|
|
718
|
+
D()
|
|
719
|
+
), this.unloaded$ = t.pipe(
|
|
719
720
|
ge(() => this.value.state === "unloading" || this.value.state === "idle" ? _ : (this.next({ state: "unloading", error: void 0 }), this.context.bridgeEvent.viewportFree$.pipe(
|
|
720
|
-
|
|
721
|
-
w(() => (this.hookManager.destroy("item.onDocumentLoad", this.item.id), this.onUnload().pipe(
|
|
722
|
-
|
|
721
|
+
U(),
|
|
722
|
+
w(() => (this.hookManager.destroy("item.onDocumentLoad", this.item.id), this.onUnload().pipe(fe(null), U()))),
|
|
723
|
+
S(() => {
|
|
723
724
|
this.next({ state: "idle", error: void 0 });
|
|
724
725
|
}),
|
|
725
|
-
|
|
726
|
-
)))
|
|
727
|
-
|
|
728
|
-
P(this.loaded$,
|
|
729
|
-
|
|
730
|
-
|
|
726
|
+
T(i)
|
|
727
|
+
))),
|
|
728
|
+
D()
|
|
729
|
+
), P(this.loaded$, this.unloaded$).pipe(
|
|
730
|
+
ze((o) => (this.next({ state: "error", error: o }), _)),
|
|
731
|
+
T(this.destroy$)
|
|
731
732
|
).subscribe();
|
|
732
733
|
}
|
|
733
734
|
setDocumentContainer(e) {
|
|
@@ -757,10 +758,10 @@ const Le = class Le extends Q {
|
|
|
757
758
|
* Automatically release on complete or error.
|
|
758
759
|
*/
|
|
759
760
|
renderHeadless() {
|
|
760
|
-
const e = new
|
|
761
|
-
return
|
|
762
|
-
|
|
763
|
-
|
|
761
|
+
const e = new N();
|
|
762
|
+
return Tt(() => this.onRenderHeadless({ release: e })).pipe(
|
|
763
|
+
fe(void 0),
|
|
764
|
+
U(),
|
|
764
765
|
S((t) => {
|
|
765
766
|
if (t)
|
|
766
767
|
return {
|
|
@@ -770,10 +771,10 @@ const Le = class Le extends Q {
|
|
|
770
771
|
}
|
|
771
772
|
};
|
|
772
773
|
}),
|
|
773
|
-
|
|
774
|
+
me(() => {
|
|
774
775
|
e.complete();
|
|
775
776
|
}),
|
|
776
|
-
|
|
777
|
+
ze((t) => (A.error(t), v(void 0)))
|
|
777
778
|
);
|
|
778
779
|
}
|
|
779
780
|
layout(e) {
|
|
@@ -794,21 +795,21 @@ const Le = class Le extends Q {
|
|
|
794
795
|
if (e) return e;
|
|
795
796
|
const t = this.getDocumentFrame();
|
|
796
797
|
if (t) {
|
|
797
|
-
const { hasViewport: i } =
|
|
798
|
+
const { hasViewport: i } = Je(t);
|
|
798
799
|
if (i) return "pre-paginated";
|
|
799
800
|
}
|
|
800
801
|
return this.context.manifest?.renditionLayout ?? "reflowable";
|
|
801
802
|
}
|
|
802
803
|
};
|
|
803
804
|
Le.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
|
|
804
|
-
let
|
|
805
|
+
let ye = Le;
|
|
805
806
|
const Jn = (n) => new URL(n.href);
|
|
806
807
|
class tt {
|
|
807
808
|
constructor(e, t) {
|
|
808
809
|
this.item = e, this.settings = t;
|
|
809
810
|
}
|
|
810
811
|
async getResource() {
|
|
811
|
-
return await
|
|
812
|
+
return await nn(
|
|
812
813
|
this.settings.values.getResource?.(this.item) ?? v(void 0)
|
|
813
814
|
) ?? Jn(this.item);
|
|
814
815
|
}
|
|
@@ -817,7 +818,7 @@ class tt {
|
|
|
817
818
|
return e instanceof Response ? e : e instanceof URL ? fetch(e) : e;
|
|
818
819
|
}
|
|
819
820
|
}
|
|
820
|
-
const
|
|
821
|
+
const Ot = (n, e) => {
|
|
821
822
|
const t = n.startsWith("file://"), i = t ? n.replace("file://", "http://") : n, o = new URL(e, i).toString();
|
|
822
823
|
return t ? o.replace("http://", "file://") : o;
|
|
823
824
|
}, Kn = async (n, e, t, i, o) => {
|
|
@@ -831,13 +832,13 @@ const kt = (n, e) => {
|
|
|
831
832
|
if (n.defaultView && c instanceof n.defaultView.CSSFontFaceRule) {
|
|
832
833
|
const u = c.style.getPropertyValue("src");
|
|
833
834
|
if (u.match(/url\(['"]?([^'"]+)['"]?\)/g)) {
|
|
834
|
-
const d = u.split(",").map((h) => h.trim()),
|
|
835
|
+
const d = u.split(",").map((h) => h.trim()), g = await Promise.all(
|
|
835
836
|
d.map(async (h) => {
|
|
836
837
|
if (h.startsWith("local("))
|
|
837
838
|
return h;
|
|
838
839
|
const m = h.match(/url\(['"]?([^'"]+)['"]?\)/);
|
|
839
840
|
if (!m) return h;
|
|
840
|
-
const y = m[1] ?? "", f = i.manifest?.items.find(({ href: I }) => `${
|
|
841
|
+
const y = m[1] ?? "", f = i.manifest?.items.find(({ href: I }) => `${Ot(t, y).toLowerCase()}`.endsWith(
|
|
841
842
|
`${I.toLowerCase()}`
|
|
842
843
|
));
|
|
843
844
|
if (f) {
|
|
@@ -845,10 +846,10 @@ const kt = (n, e) => {
|
|
|
845
846
|
try {
|
|
846
847
|
const b = await I.getResource();
|
|
847
848
|
if (b instanceof Response) {
|
|
848
|
-
const F = await b.blob(),
|
|
849
|
+
const F = await b.blob(), $ = n.defaultView?.URL.createObjectURL(F);
|
|
849
850
|
return h.replace(
|
|
850
851
|
m[0],
|
|
851
|
-
`url("${
|
|
852
|
+
`url("${$}")`
|
|
852
853
|
);
|
|
853
854
|
}
|
|
854
855
|
} catch (b) {
|
|
@@ -857,11 +858,11 @@ const kt = (n, e) => {
|
|
|
857
858
|
}
|
|
858
859
|
return h;
|
|
859
860
|
})
|
|
860
|
-
),
|
|
861
|
+
), p = c.cssText.replace(
|
|
861
862
|
/src:\s*[^;]+;/,
|
|
862
|
-
`src: ${
|
|
863
|
+
`src: ${g.join(", ")};`
|
|
863
864
|
);
|
|
864
|
-
s.deleteRule(a), s.insertRule(
|
|
865
|
+
s.deleteRule(a), s.insertRule(p, a);
|
|
865
866
|
}
|
|
866
867
|
}
|
|
867
868
|
}
|
|
@@ -871,14 +872,14 @@ const kt = (n, e) => {
|
|
|
871
872
|
}, Qn = (n, e, t, i, o) => {
|
|
872
873
|
const s = e.getAttribute("src") || e.getAttribute("href");
|
|
873
874
|
if (!s) return v(null);
|
|
874
|
-
const r = i.manifest?.items.find(({ href: c }) => `${
|
|
875
|
+
const r = i.manifest?.items.find(({ href: c }) => `${Ot(t, s).toLowerCase()}`.endsWith(
|
|
875
876
|
`${c.toLowerCase()}`
|
|
876
877
|
));
|
|
877
878
|
if (!r) return v(null);
|
|
878
879
|
const a = new tt(r, o);
|
|
879
|
-
return
|
|
880
|
+
return k(a.getResource()).pipe(
|
|
880
881
|
ge(
|
|
881
|
-
(c) => c instanceof Response ?
|
|
882
|
+
(c) => c instanceof Response ? k(c.blob()) : v(void 0)
|
|
882
883
|
),
|
|
883
884
|
ge((c) => {
|
|
884
885
|
if (!c)
|
|
@@ -887,7 +888,7 @@ const kt = (n, e) => {
|
|
|
887
888
|
if (e.hasAttribute("src"))
|
|
888
889
|
e.setAttribute("src", u);
|
|
889
890
|
else if (e.hasAttribute("href") && (e.setAttribute("href", u), n?.defaultView && e instanceof n.defaultView.HTMLLinkElement))
|
|
890
|
-
return new
|
|
891
|
+
return new ce((l) => {
|
|
891
892
|
e.onload = async () => {
|
|
892
893
|
try {
|
|
893
894
|
e.sheet && await Kn(
|
|
@@ -911,9 +912,9 @@ const kt = (n, e) => {
|
|
|
911
912
|
context: t
|
|
912
913
|
}) => (i) => i.pipe(
|
|
913
914
|
w((o) => {
|
|
914
|
-
const s =
|
|
915
|
+
const s = Et(
|
|
915
916
|
o.contentDocument
|
|
916
|
-
), r =
|
|
917
|
+
), r = pn(e.href), a = s.map(
|
|
917
918
|
(c) => Qn(
|
|
918
919
|
o.contentDocument,
|
|
919
920
|
c,
|
|
@@ -922,13 +923,13 @@ const kt = (n, e) => {
|
|
|
922
923
|
n
|
|
923
924
|
)
|
|
924
925
|
);
|
|
925
|
-
return
|
|
926
|
+
return j(a).pipe(S(() => o));
|
|
926
927
|
})
|
|
927
928
|
), ti = (n) => {
|
|
928
|
-
|
|
929
|
-
},
|
|
929
|
+
Nn(n?.contentDocument);
|
|
930
|
+
}, Xs = "@prose-reader/core", Ys = 0, qs = 200, ni = [".xhtml", ".html", ".htm"], W = "prose-reader", Vt = `${W}-style`, ii = `data-${W}-id`, oi = `${W}-viewport`, si = `${W}-scroll-navigator`, ri = async (n, e) => {
|
|
930
931
|
if (typeof n == "string") return n;
|
|
931
|
-
const t =
|
|
932
|
+
const t = gn(n.headers.get("Content-Type") || "") || Me(e.href);
|
|
932
933
|
if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
|
|
933
934
|
(o) => o === t
|
|
934
935
|
)) {
|
|
@@ -970,7 +971,7 @@ const kt = (n, e) => {
|
|
|
970
971
|
}) => {
|
|
971
972
|
const t = (i) => ri(i, n);
|
|
972
973
|
return (i) => i.pipe(
|
|
973
|
-
w((o) =>
|
|
974
|
+
w((o) => k(e.getResource()).pipe(
|
|
974
975
|
w((s) => s instanceof URL && n.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
|
|
975
976
|
(n.mediaType && [
|
|
976
977
|
"application/xhtml+xml",
|
|
@@ -980,11 +981,11 @@ const kt = (n, e) => {
|
|
|
980
981
|
].includes(n.mediaType) || // no encoding ? then try to detect html
|
|
981
982
|
!n.mediaType && ni.some(
|
|
982
983
|
(a) => n.href.endsWith(a)
|
|
983
|
-
)) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ?
|
|
984
|
+
)) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ? k(e.fetchResource()) : v(s)).pipe(
|
|
984
985
|
w((a) => {
|
|
985
986
|
if (!(a instanceof Response))
|
|
986
987
|
throw new Error("Invalid resource");
|
|
987
|
-
return
|
|
988
|
+
return k(t(a));
|
|
988
989
|
}),
|
|
989
990
|
x((a) => {
|
|
990
991
|
if (a) {
|
|
@@ -993,10 +994,10 @@ const kt = (n, e) => {
|
|
|
993
994
|
}
|
|
994
995
|
}),
|
|
995
996
|
S(() => o),
|
|
996
|
-
|
|
997
|
+
ze((a) => (A.error(
|
|
997
998
|
`Error while trying to fetch or load resource for item ${n.id}`,
|
|
998
999
|
s
|
|
999
|
-
),
|
|
1000
|
+
), A.error(a), v(o)))
|
|
1000
1001
|
))
|
|
1001
1002
|
))
|
|
1002
1003
|
);
|
|
@@ -1015,12 +1016,12 @@ const kt = (n, e) => {
|
|
|
1015
1016
|
border: 0px none transparent;
|
|
1016
1017
|
padding: 0px;
|
|
1017
1018
|
`, n.setAttribute("role", "main"), n;
|
|
1018
|
-
}, ui = "body{margin:0}html,body{height:100%;width:100%}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] body{display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=left] body{justify-content:flex-end}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=right] body{justify-content:flex-start}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=none] body{justify-content:center}:not(html.prose-reader-html-renderer-touch-enabled),:not(html.prose-reader-html-renderer-touch-enabled) body{touch-action:none}img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] img{max-width:100%;height:100%;object-fit:contain}",
|
|
1019
|
+
}, ui = "body{margin:0}html,body{height:100%;width:100%}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] body{display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=left] body{justify-content:flex-end}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=right] body{justify-content:flex-start}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=none] body{justify-content:center}:not(html.prose-reader-html-renderer-touch-enabled),:not(html.prose-reader-html-renderer-touch-enabled) body{touch-action:none}img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] img{max-width:100%;height:100%;object-fit:contain}", jt = ({
|
|
1019
1020
|
pageHeight: n,
|
|
1020
1021
|
pageWidth: e,
|
|
1021
1022
|
frameElement: t
|
|
1022
1023
|
}) => {
|
|
1023
|
-
const i =
|
|
1024
|
+
const i = Je(t);
|
|
1024
1025
|
if (t?.contentDocument && t.contentWindow && i) {
|
|
1025
1026
|
const o = e / (i.width ?? 1);
|
|
1026
1027
|
return { computedScale: Math.min(
|
|
@@ -1028,7 +1029,7 @@ const kt = (n, e) => {
|
|
|
1028
1029
|
n / (i.height ?? 1)
|
|
1029
1030
|
), computedWidthScale: o, viewportDimensions: i };
|
|
1030
1031
|
}
|
|
1031
|
-
},
|
|
1032
|
+
}, ut = (n, e) => {
|
|
1032
1033
|
n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
|
|
1033
1034
|
}, li = ({
|
|
1034
1035
|
minPageSpread: n,
|
|
@@ -1041,32 +1042,32 @@ const kt = (n, e) => {
|
|
|
1041
1042
|
}) => {
|
|
1042
1043
|
const a = n * o;
|
|
1043
1044
|
if (s?.contentDocument && s?.contentWindow) {
|
|
1044
|
-
const { viewportDimensions: c, computedScale: u = 1 } =
|
|
1045
|
+
const { viewportDimensions: c, computedScale: u = 1 } = jt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, l = !!c, d = o, g = i;
|
|
1045
1046
|
if (s.contentDocument?.documentElement && s.contentDocument?.documentElement.setAttribute(
|
|
1046
1047
|
"data-prose-reader-html-renderer-has-viewport-dimensions",
|
|
1047
1048
|
l.toString()
|
|
1048
|
-
), c ?
|
|
1049
|
+
), c ? ut(s, {
|
|
1049
1050
|
width: c.width ?? 1,
|
|
1050
1051
|
height: c.height ?? 1
|
|
1051
|
-
}) :
|
|
1052
|
+
}) : ut(s, {
|
|
1052
1053
|
width: d,
|
|
1053
|
-
height:
|
|
1054
|
+
height: g
|
|
1054
1055
|
}), c) {
|
|
1055
1056
|
s?.style.setProperty("position", "absolute"), s?.style.setProperty("top", "50%"), t === "left" ? (s?.style.setProperty("right", "0"), s?.style.removeProperty("left")) : e === "before" && r ? (s?.style.setProperty("right", "50%"), s?.style.removeProperty("left")) : t === "right" ? (s?.style.setProperty("left", "0"), s?.style.removeProperty("right")) : (s?.style.setProperty(
|
|
1056
1057
|
"left",
|
|
1057
1058
|
e === "before" ? r ? "25%" : "75%" : e === "after" ? r ? "75%" : "25%" : "50%"
|
|
1058
1059
|
), s?.style.removeProperty("right"));
|
|
1059
|
-
const
|
|
1060
|
+
const p = t !== "none" ? "0" : "-50%", h = t === "right" && e !== "before" ? "left" : t === "left" || e === "before" && r ? "right" : "center";
|
|
1060
1061
|
s?.style.setProperty(
|
|
1061
1062
|
"transform",
|
|
1062
|
-
`translate(${
|
|
1063
|
+
`translate(${p}, -50%) scale(${u})`
|
|
1063
1064
|
), s?.style.setProperty(
|
|
1064
1065
|
"transform-origin",
|
|
1065
1066
|
`${h} center`
|
|
1066
1067
|
);
|
|
1067
1068
|
} else
|
|
1068
1069
|
e === "before" ? r ? s?.style.setProperty("margin-right", `${o}px`) : s?.style.setProperty("margin-left", `${o}px`) : (s?.style.removeProperty("margin-left"), s?.style.removeProperty("margin-right"));
|
|
1069
|
-
return { width: a, height:
|
|
1070
|
+
return { width: a, height: g };
|
|
1070
1071
|
}
|
|
1071
1072
|
return { width: a, height: i };
|
|
1072
1073
|
}, di = () => `
|
|
@@ -1207,23 +1208,23 @@ const kt = (n, e) => {
|
|
|
1207
1208
|
enableTouch: c,
|
|
1208
1209
|
isUsingVerticalWriting: u
|
|
1209
1210
|
}) => {
|
|
1210
|
-
const l = o * e, d = i?.renditionLayout === "reflowable" && i?.renditionFlow === "scrolled-continuous",
|
|
1211
|
-
t?.style.setProperty("width", `${e}px`), d ? t?.style.removeProperty("height") : t?.style.setProperty("height", `${
|
|
1212
|
-
const { viewportDimensions:
|
|
1211
|
+
const l = o * e, d = i?.renditionLayout === "reflowable" && i?.renditionFlow === "scrolled-continuous", g = d ? Math.min(400, n) : n;
|
|
1212
|
+
t?.style.setProperty("width", `${e}px`), d ? t?.style.removeProperty("height") : t?.style.setProperty("height", `${g}px`);
|
|
1213
|
+
const { viewportDimensions: p, computedScale: h = 1 } = jt({
|
|
1213
1214
|
frameElement: t,
|
|
1214
|
-
pageHeight:
|
|
1215
|
+
pageHeight: g,
|
|
1215
1216
|
pageWidth: e
|
|
1216
1217
|
}) ?? {}, m = i?.renditionLayout === "pre-paginated";
|
|
1217
1218
|
if (t?.contentDocument && t?.contentWindow && t.contentDocument.body) {
|
|
1218
|
-
let y = e, f =
|
|
1219
|
-
if (
|
|
1219
|
+
let y = e, f = g;
|
|
1220
|
+
if (p?.hasViewport)
|
|
1220
1221
|
oe(
|
|
1221
1222
|
t,
|
|
1222
1223
|
"prose-reader-html-renderer-framce-css",
|
|
1223
1224
|
di()
|
|
1224
1225
|
), ve(t, {
|
|
1225
|
-
width:
|
|
1226
|
-
height:
|
|
1226
|
+
width: p.width ?? 1,
|
|
1227
|
+
height: p.height ?? 1
|
|
1227
1228
|
}), t?.style.setProperty("position", "absolute"), t?.style.setProperty("top", "50%"), t?.style.setProperty(
|
|
1228
1229
|
"left",
|
|
1229
1230
|
r === "before" ? s ? "25%" : "75%" : r === "after" ? s ? "75%" : "25%" : "50%"
|
|
@@ -1239,14 +1240,14 @@ const kt = (n, e) => {
|
|
|
1239
1240
|
hi({
|
|
1240
1241
|
isUsingVerticalWriting: u,
|
|
1241
1242
|
minimumWidth: l,
|
|
1242
|
-
pageHeight:
|
|
1243
|
+
pageHeight: g,
|
|
1243
1244
|
pageWidth: e
|
|
1244
1245
|
})
|
|
1245
1246
|
);
|
|
1246
1247
|
if (oe(t, "prose-reader-css", b, !0), u)
|
|
1247
1248
|
f = Math.ceil(
|
|
1248
|
-
t.contentDocument.documentElement.scrollHeight /
|
|
1249
|
-
) *
|
|
1249
|
+
t.contentDocument.documentElement.scrollHeight / g
|
|
1250
|
+
) * g, ve(t, {
|
|
1250
1251
|
width: l,
|
|
1251
1252
|
height: f
|
|
1252
1253
|
});
|
|
@@ -1268,7 +1269,7 @@ const kt = (n, e) => {
|
|
|
1268
1269
|
return y % l === 0 ? t?.style.setProperty("margin-left", "0px") : (y = y + e, s && !u && t?.style.setProperty("margin-left", `${e}px`)), { width: y, height: f };
|
|
1269
1270
|
}
|
|
1270
1271
|
};
|
|
1271
|
-
class fi extends
|
|
1272
|
+
class fi extends ye {
|
|
1272
1273
|
constructor() {
|
|
1273
1274
|
super(...arguments), this.isPrePaginated = () => this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated", this.isImageType = () => !!(this.item.mediaType ?? Me(this.item.href))?.startsWith("image/");
|
|
1274
1275
|
}
|
|
@@ -1351,7 +1352,7 @@ class fi extends Se {
|
|
|
1351
1352
|
return v(u);
|
|
1352
1353
|
}
|
|
1353
1354
|
onRenderHeadless() {
|
|
1354
|
-
return
|
|
1355
|
+
return k(this.resourcesHandler.fetchResource()).pipe(
|
|
1355
1356
|
w((e) => {
|
|
1356
1357
|
if (e instanceof Response) {
|
|
1357
1358
|
const t = e.headers.get("content-type") ?? "";
|
|
@@ -1361,7 +1362,7 @@ class fi extends Se {
|
|
|
1361
1362
|
"text/html",
|
|
1362
1363
|
"text/xml"
|
|
1363
1364
|
].includes(t))
|
|
1364
|
-
return
|
|
1365
|
+
return k(e.text()).pipe(
|
|
1365
1366
|
S((o) => new DOMParser().parseFromString(
|
|
1366
1367
|
o,
|
|
1367
1368
|
t
|
|
@@ -1411,7 +1412,7 @@ const yi = (n) => (e) => {
|
|
|
1411
1412
|
return e.getRenderer?.(o) ?? ((r) => new fi(r));
|
|
1412
1413
|
}
|
|
1413
1414
|
}), i = Zn(t);
|
|
1414
|
-
return i.pipe(
|
|
1415
|
+
return i.pipe(T(t.$.destroy$)).subscribe(), {
|
|
1415
1416
|
...t,
|
|
1416
1417
|
links$: i
|
|
1417
1418
|
};
|
|
@@ -1424,12 +1425,12 @@ class nt {
|
|
|
1424
1425
|
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
1426
|
}
|
|
1426
1427
|
}
|
|
1427
|
-
class
|
|
1428
|
+
class E {
|
|
1428
1429
|
constructor(e) {
|
|
1429
1430
|
this.__symbol = /* @__PURE__ */ Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
|
|
1430
1431
|
}
|
|
1431
1432
|
}
|
|
1432
|
-
class
|
|
1433
|
+
class Re {
|
|
1433
1434
|
constructor(e) {
|
|
1434
1435
|
this.__symbol = /* @__PURE__ */ Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
|
|
1435
1436
|
}
|
|
@@ -1439,7 +1440,7 @@ class Si extends nt {
|
|
|
1439
1440
|
super(...arguments), this.__symbol = "SpineItemPageLayout";
|
|
1440
1441
|
}
|
|
1441
1442
|
}
|
|
1442
|
-
class
|
|
1443
|
+
class Oe extends nt {
|
|
1443
1444
|
constructor() {
|
|
1444
1445
|
super(...arguments), this.__symbol = "SpineItemSpineLayout";
|
|
1445
1446
|
}
|
|
@@ -1449,25 +1450,25 @@ class Ii extends nt {
|
|
|
1449
1450
|
super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
|
|
1450
1451
|
}
|
|
1451
1452
|
}
|
|
1452
|
-
class
|
|
1453
|
+
class kt {
|
|
1453
1454
|
constructor(e) {
|
|
1454
1455
|
this.x = e.x, this.y = e.y;
|
|
1455
1456
|
}
|
|
1456
1457
|
}
|
|
1457
|
-
class
|
|
1458
|
+
class M extends kt {
|
|
1458
1459
|
constructor() {
|
|
1459
1460
|
super(...arguments), this.__symbol = "SpinePosition";
|
|
1460
1461
|
}
|
|
1461
1462
|
static from(e) {
|
|
1462
|
-
return new
|
|
1463
|
+
return new M(e);
|
|
1463
1464
|
}
|
|
1464
1465
|
}
|
|
1465
|
-
class
|
|
1466
|
+
class ae extends kt {
|
|
1466
1467
|
constructor() {
|
|
1467
1468
|
super(...arguments), this.__symbol = "UnboundSpinePosition";
|
|
1468
1469
|
}
|
|
1469
1470
|
static from(e) {
|
|
1470
|
-
return new
|
|
1471
|
+
return new ae(e);
|
|
1471
1472
|
}
|
|
1472
1473
|
}
|
|
1473
1474
|
const bi = (n, e) => {
|
|
@@ -1476,14 +1477,14 @@ const bi = (n, e) => {
|
|
|
1476
1477
|
x: u / a,
|
|
1477
1478
|
y: l / c
|
|
1478
1479
|
};
|
|
1479
|
-
}, vi = (n, e) => new
|
|
1480
|
+
}, vi = (n, e) => new ae(
|
|
1480
1481
|
bi(n, e)
|
|
1481
1482
|
), wi = (n) => ({
|
|
1482
1483
|
getSpinePositionFromClientPosition: (e) => n.spine.element ? vi(e, n.spine.element) : void 0
|
|
1483
1484
|
}), Pi = (n) => {
|
|
1484
1485
|
let e;
|
|
1485
1486
|
const t = n.context.watch("rootElement").pipe(
|
|
1486
|
-
|
|
1487
|
+
Y((c) => c ? new ce(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
|
|
1487
1488
|
position: absolute;
|
|
1488
1489
|
left: 0;
|
|
1489
1490
|
top: 0;
|
|
@@ -1493,39 +1494,39 @@ const bi = (n, e) => {
|
|
|
1493
1494
|
`, c.appendChild(e), () => {
|
|
1494
1495
|
e?.remove(), e = void 0;
|
|
1495
1496
|
})) : he)
|
|
1496
|
-
), i = (c) =>
|
|
1497
|
-
|
|
1497
|
+
), i = (c) => on(c, re).pipe(
|
|
1498
|
+
V(() => {
|
|
1498
1499
|
e?.style.setProperty(
|
|
1499
1500
|
"visibility",
|
|
1500
1501
|
"hidden"
|
|
1501
1502
|
);
|
|
1502
1503
|
})
|
|
1503
1504
|
), o = n.context.bridgeEvent.viewportBusy$.pipe(
|
|
1504
|
-
|
|
1505
|
+
V(() => {
|
|
1505
1506
|
e?.style.setProperty(
|
|
1506
1507
|
"visibility",
|
|
1507
1508
|
"visible"
|
|
1508
1509
|
);
|
|
1509
1510
|
})
|
|
1510
1511
|
), s = i(n.viewportFree$).pipe(
|
|
1511
|
-
|
|
1512
|
+
Sn(1)
|
|
1512
1513
|
), a = n.settings.values$.pipe(
|
|
1513
1514
|
ie(() => n.settings.values.computedPageTurnMode),
|
|
1514
|
-
|
|
1515
|
+
be()
|
|
1515
1516
|
).pipe(
|
|
1516
|
-
|
|
1517
|
-
(c) => c === "controlled" ? o.pipe(
|
|
1517
|
+
Y(
|
|
1518
|
+
(c) => c === "controlled" ? o.pipe(Y(() => s)) : i(v(void 0))
|
|
1518
1519
|
),
|
|
1519
1520
|
K(n.$.destroy$)
|
|
1520
1521
|
);
|
|
1521
1522
|
return P(t, a);
|
|
1522
|
-
}, xi = `${W}-enhancer-loading`,
|
|
1523
|
+
}, xi = `${W}-enhancer-loading`, Ut = `${xi}-container`, $i = ({
|
|
1523
1524
|
container: n,
|
|
1524
1525
|
item: e,
|
|
1525
1526
|
viewport: t
|
|
1526
1527
|
}) => {
|
|
1527
1528
|
const i = n.ownerDocument.createElement("div");
|
|
1528
|
-
i.classList.add(
|
|
1529
|
+
i.classList.add(Ut), i.style.cssText = `
|
|
1529
1530
|
height: 100%;
|
|
1530
1531
|
width: 100%;
|
|
1531
1532
|
max-width: ${t.absoluteViewport.width}px;
|
|
@@ -1555,12 +1556,12 @@ const bi = (n, e) => {
|
|
|
1555
1556
|
width: 80%;
|
|
1556
1557
|
`, i.appendChild(o), i.appendChild(s), i;
|
|
1557
1558
|
}, Ti = (n) => n.spineItemsManager.items$.pipe(
|
|
1558
|
-
|
|
1559
|
+
Y(
|
|
1559
1560
|
(e) => P(
|
|
1560
1561
|
...e.map((t) => {
|
|
1561
1562
|
t.containerElement.style.zIndex = "0";
|
|
1562
1563
|
const i = t.containerElement.querySelector(
|
|
1563
|
-
`.${
|
|
1564
|
+
`.${Ut}`
|
|
1564
1565
|
), o = i instanceof HTMLElement ? i : $i({
|
|
1565
1566
|
container: t.containerElement,
|
|
1566
1567
|
item: t.item,
|
|
@@ -1568,7 +1569,7 @@ const bi = (n, e) => {
|
|
|
1568
1569
|
});
|
|
1569
1570
|
return t.containerElement.appendChild(o), P(
|
|
1570
1571
|
t.pipe(
|
|
1571
|
-
|
|
1572
|
+
V((s) => {
|
|
1572
1573
|
if (o.style.setProperty(
|
|
1573
1574
|
"visibility",
|
|
1574
1575
|
s.isReady ? "hidden" : "visible"
|
|
@@ -1583,8 +1584,8 @@ const bi = (n, e) => {
|
|
|
1583
1584
|
}
|
|
1584
1585
|
})
|
|
1585
1586
|
),
|
|
1586
|
-
|
|
1587
|
-
|
|
1587
|
+
j([n.spine.layout$, n.theme.$.theme$]).pipe(
|
|
1588
|
+
V(([, s]) => {
|
|
1588
1589
|
const r = n.viewport.absoluteViewport.width;
|
|
1589
1590
|
o.style.setProperty(
|
|
1590
1591
|
"max-width",
|
|
@@ -1610,7 +1611,7 @@ const bi = (n, e) => {
|
|
|
1610
1611
|
const o = n.spineItemsManager.get(e.id), s = o?.renderer.getDocumentFrame();
|
|
1611
1612
|
if (o?.renditionLayout !== "reflowable" || !(s instanceof HTMLIFrameElement))
|
|
1612
1613
|
return;
|
|
1613
|
-
const { hasViewport: r } =
|
|
1614
|
+
const { hasViewport: r } = Je(s), { width: a } = n.viewport.pageSize, c = o?.renderer.getDocumentFrame();
|
|
1614
1615
|
if (r) {
|
|
1615
1616
|
const u = a < i;
|
|
1616
1617
|
t === "none" && u && c instanceof HTMLIFrameElement && c?.style.setProperty(
|
|
@@ -1620,25 +1621,17 @@ const bi = (n, e) => {
|
|
|
1620
1621
|
}
|
|
1621
1622
|
}
|
|
1622
1623
|
);
|
|
1623
|
-
}, Mi = (n) => n.
|
|
1624
|
-
|
|
1625
|
-
(
|
|
1626
|
-
|
|
1627
|
-
(t) => t.pipe(
|
|
1628
|
-
x((i) => {
|
|
1629
|
-
t.containerElement.dataset.isDirty = i.iDirty.toString(), t.containerElement.dataset.isReady = i.isReady.toString();
|
|
1630
|
-
})
|
|
1631
|
-
)
|
|
1632
|
-
)
|
|
1633
|
-
)
|
|
1634
|
-
)
|
|
1624
|
+
}, Mi = (n) => n.spineItemsObserver.states$.pipe(
|
|
1625
|
+
x(({ item: e, isReady: t, isDirty: i }) => {
|
|
1626
|
+
e.containerElement.dataset.isDirty = i.toString(), e.containerElement.dataset.isReady = t.toString();
|
|
1627
|
+
})
|
|
1635
1628
|
);
|
|
1636
|
-
let Ci = class extends
|
|
1629
|
+
let Ci = class extends Rt {
|
|
1637
1630
|
computeOutputSettings(e) {
|
|
1638
1631
|
return e;
|
|
1639
1632
|
}
|
|
1640
1633
|
hasSettingsChanged(e) {
|
|
1641
|
-
return !
|
|
1634
|
+
return !O(this.outputSettings, e);
|
|
1642
1635
|
}
|
|
1643
1636
|
getCleanedParentInputSettings(e) {
|
|
1644
1637
|
const {
|
|
@@ -1659,7 +1652,7 @@ let Ci = class extends jt {
|
|
|
1659
1652
|
};
|
|
1660
1653
|
}
|
|
1661
1654
|
};
|
|
1662
|
-
const Ei = (n) =>
|
|
1655
|
+
const Ei = (n) => j([
|
|
1663
1656
|
n.viewport.watch(["width", "height"]),
|
|
1664
1657
|
n.context.watch("manifest")
|
|
1665
1658
|
]).pipe(
|
|
@@ -1689,33 +1682,33 @@ const Ei = (n) => O([
|
|
|
1689
1682
|
!m && f && (f.getBoundingClientRect().left, m = !0);
|
|
1690
1683
|
});
|
|
1691
1684
|
}), r.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
|
|
1692
|
-
const y = r.spineItemsManager.get(m.id), I = !!(m.mediaType ?? Me(m.href))?.startsWith("image/"), { pageHorizontalMargin: b = 0, pageVerticalMargin: F = 0 } = a.values,
|
|
1685
|
+
const y = r.spineItemsManager.get(m.id), I = !!(m.mediaType ?? Me(m.href))?.startsWith("image/"), { pageHorizontalMargin: b = 0, pageVerticalMargin: F = 0 } = a.values, $ = r.viewport.pageSize;
|
|
1693
1686
|
if (y?.renditionLayout === "reflowable" && !I) {
|
|
1694
|
-
let
|
|
1695
|
-
const H =
|
|
1696
|
-
let B =
|
|
1697
|
-
y.isUsingVerticalWriting() && (B =
|
|
1698
|
-
const
|
|
1699
|
-
|
|
1700
|
-
|
|
1687
|
+
let L = $.width - b * 2;
|
|
1688
|
+
const H = $.height - F * 2;
|
|
1689
|
+
let B = $.width - b * 2, se = b * 2;
|
|
1690
|
+
y.isUsingVerticalWriting() && (B = $.width - b * 2, L = H, se = F * 2);
|
|
1691
|
+
const ue = y?.renderer.getDocumentFrame();
|
|
1692
|
+
ue && oe(
|
|
1693
|
+
ue,
|
|
1701
1694
|
"prose-layout-enhancer-css",
|
|
1702
1695
|
`
|
|
1703
1696
|
body {
|
|
1704
1697
|
width: ${B}px !important;
|
|
1705
1698
|
margin: ${F}px ${b}px !important;
|
|
1706
|
-
column-gap: ${
|
|
1707
|
-
column-width: ${
|
|
1699
|
+
column-gap: ${se}px !important;
|
|
1700
|
+
column-width: ${L}px !important;
|
|
1708
1701
|
height: ${H}px !important;
|
|
1709
1702
|
}
|
|
1710
1703
|
img, video, audio, object, svg {
|
|
1711
|
-
-max-width: ${
|
|
1704
|
+
-max-width: ${L}px !important;
|
|
1712
1705
|
-max-height: ${H}px !important;
|
|
1713
1706
|
}
|
|
1714
1707
|
table {
|
|
1715
|
-
max-width: ${
|
|
1708
|
+
max-width: ${L}px !important;
|
|
1716
1709
|
}
|
|
1717
1710
|
td {
|
|
1718
|
-
max-width: ${
|
|
1711
|
+
max-width: ${L}px;
|
|
1719
1712
|
}
|
|
1720
1713
|
`
|
|
1721
1714
|
);
|
|
@@ -1729,40 +1722,40 @@ const Ei = (n) => O([
|
|
|
1729
1722
|
const f = r.spineItemsManager.get(m.id)?.renderer.documentContainer;
|
|
1730
1723
|
r.settings.values.computedPageTurnMode !== "scrollable" && f?.setAttribute("tab-index", "0");
|
|
1731
1724
|
});
|
|
1732
|
-
const c = r.spineItemsObserver.
|
|
1733
|
-
|
|
1734
|
-
|
|
1725
|
+
const c = r.spineItemsObserver.states$.pipe(
|
|
1726
|
+
pe(({ isReady: m }) => m),
|
|
1727
|
+
V(({ item: m }) => {
|
|
1735
1728
|
const y = m.renderer.documentContainer;
|
|
1736
1729
|
y && (y.style.opacity = "1");
|
|
1737
1730
|
})
|
|
1738
1731
|
), u = a.values$.pipe(
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1732
|
+
pe(({ layoutAutoResize: m }) => m === "container"),
|
|
1733
|
+
Y(() => r.context.watch("rootElement")),
|
|
1734
|
+
pe(Z),
|
|
1735
|
+
Y((m) => Qe(m)),
|
|
1736
|
+
In(100),
|
|
1737
|
+
pe(Z),
|
|
1738
|
+
V(() => {
|
|
1746
1739
|
r?.layout();
|
|
1747
1740
|
})
|
|
1748
1741
|
), l = Pi(r);
|
|
1749
1742
|
a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
|
|
1750
|
-
|
|
1751
|
-
|
|
1743
|
+
Lt(1),
|
|
1744
|
+
V(() => {
|
|
1752
1745
|
r.layout();
|
|
1753
1746
|
}),
|
|
1754
1747
|
K(r.$.destroy$)
|
|
1755
1748
|
).subscribe();
|
|
1756
1749
|
const d = r.spine.pages.pipe(
|
|
1757
|
-
|
|
1758
|
-
),
|
|
1750
|
+
Ge({ refCount: !0, bufferSize: 1 })
|
|
1751
|
+
), g = Mi(r), p = Ei(r), h = Ti(r);
|
|
1759
1752
|
return P(
|
|
1760
1753
|
c,
|
|
1761
1754
|
l,
|
|
1762
1755
|
u,
|
|
1763
1756
|
d,
|
|
1764
|
-
p,
|
|
1765
1757
|
g,
|
|
1758
|
+
p,
|
|
1766
1759
|
h
|
|
1767
1760
|
).pipe(K(r.$.destroy$)).subscribe(), {
|
|
1768
1761
|
...r,
|
|
@@ -1775,7 +1768,7 @@ const Ei = (n) => O([
|
|
|
1775
1768
|
coordinates: wi(r)
|
|
1776
1769
|
};
|
|
1777
1770
|
};
|
|
1778
|
-
class
|
|
1771
|
+
class Ai extends ye {
|
|
1779
1772
|
getImageElement() {
|
|
1780
1773
|
const e = this.documentContainer;
|
|
1781
1774
|
if (e instanceof HTMLImageElement)
|
|
@@ -1783,12 +1776,12 @@ class Ri extends Se {
|
|
|
1783
1776
|
}
|
|
1784
1777
|
onCreateDocument() {
|
|
1785
1778
|
const e = this.containerElement.ownerDocument.createElement("img");
|
|
1786
|
-
return
|
|
1779
|
+
return k(this.resourcesHandler.getResource()).pipe(
|
|
1787
1780
|
w((t) => {
|
|
1788
1781
|
if (this.setDocumentContainer(e), e.style.objectFit = "contain", e.style.userSelect = "none", t instanceof URL)
|
|
1789
1782
|
return v(t.href);
|
|
1790
1783
|
if (t instanceof Response)
|
|
1791
|
-
return
|
|
1784
|
+
return k(t.blob()).pipe(
|
|
1792
1785
|
S((i) => URL.createObjectURL(i))
|
|
1793
1786
|
);
|
|
1794
1787
|
throw new Error("Invalid resource");
|
|
@@ -1802,7 +1795,7 @@ class Ri extends Se {
|
|
|
1802
1795
|
onLoadDocument() {
|
|
1803
1796
|
const e = this.getImageElement();
|
|
1804
1797
|
if (!e) throw new Error("invalid element");
|
|
1805
|
-
return this.attach(),
|
|
1798
|
+
return this.attach(), X(e, "load");
|
|
1806
1799
|
}
|
|
1807
1800
|
onUnload() {
|
|
1808
1801
|
const e = this.getImageElement();
|
|
@@ -1827,12 +1820,12 @@ class Ri extends Se {
|
|
|
1827
1820
|
getDocumentFrame() {
|
|
1828
1821
|
}
|
|
1829
1822
|
}
|
|
1830
|
-
const
|
|
1823
|
+
const Ni = (n) => (e) => {
|
|
1831
1824
|
const t = n({
|
|
1832
1825
|
...e,
|
|
1833
1826
|
getRenderer(r) {
|
|
1834
1827
|
const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Me(r.href))?.startsWith("image/");
|
|
1835
|
-
return !a && u ? (l) => new
|
|
1828
|
+
return !a && u ? (l) => new Ai(l) : a;
|
|
1836
1829
|
}
|
|
1837
1830
|
}), i = new IntersectionObserver(
|
|
1838
1831
|
(r) => {
|
|
@@ -1882,33 +1875,33 @@ const Ai = (n) => (e) => {
|
|
|
1882
1875
|
i.disconnect(), o.disconnect(), t.destroy();
|
|
1883
1876
|
}
|
|
1884
1877
|
};
|
|
1885
|
-
},
|
|
1878
|
+
}, Ri = (n, e) => n.links$.pipe(
|
|
1886
1879
|
x((t) => {
|
|
1887
|
-
if (!
|
|
1880
|
+
if (!Rn(t.target, "a") || t.type !== "click") return;
|
|
1888
1881
|
const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
|
|
1889
1882
|
n.context.manifest?.spineItems.some(
|
|
1890
1883
|
(r) => r.href === o
|
|
1891
1884
|
) && e.goToUrl(i);
|
|
1892
1885
|
})
|
|
1893
|
-
), ee =
|
|
1886
|
+
), ee = A.namespace("navigation"), Oi = ({
|
|
1894
1887
|
position: n,
|
|
1895
1888
|
spineItem: e,
|
|
1896
1889
|
pageHeight: t,
|
|
1897
1890
|
pageWidth: i,
|
|
1898
1891
|
spineItemLocator: o
|
|
1899
1892
|
}) => {
|
|
1900
|
-
let s = new
|
|
1893
|
+
let s = new E({
|
|
1901
1894
|
x: n.x - i,
|
|
1902
1895
|
y: n.y
|
|
1903
1896
|
});
|
|
1904
|
-
return e.isUsingVerticalWriting() && (s = new
|
|
1897
|
+
return e.isUsingVerticalWriting() && (s = new E({
|
|
1905
1898
|
x: n.x,
|
|
1906
1899
|
y: n.y + t
|
|
1907
1900
|
})), o.getSpineItemClosestPositionFromUnsafePosition(
|
|
1908
1901
|
s,
|
|
1909
1902
|
e
|
|
1910
1903
|
);
|
|
1911
|
-
},
|
|
1904
|
+
}, lt = ({
|
|
1912
1905
|
position: n,
|
|
1913
1906
|
navigationResolver: e,
|
|
1914
1907
|
computedPageTurnDirection: t,
|
|
@@ -1936,10 +1929,10 @@ const Ai = (n) => (e) => {
|
|
|
1936
1929
|
spineItemPosition: l,
|
|
1937
1930
|
spineItem: a
|
|
1938
1931
|
}) : e.fromUnboundSpinePosition(
|
|
1939
|
-
r === "horizontal" ? new
|
|
1932
|
+
r === "horizontal" ? new M({
|
|
1940
1933
|
x: n.x - s.pageSize.width,
|
|
1941
1934
|
y: 0
|
|
1942
|
-
}) : new
|
|
1935
|
+
}) : new M({
|
|
1943
1936
|
y: n.y - s.pageSize.height,
|
|
1944
1937
|
x: 0
|
|
1945
1938
|
})
|
|
@@ -1955,7 +1948,7 @@ const Ai = (n) => (e) => {
|
|
|
1955
1948
|
viewport: a,
|
|
1956
1949
|
settings: c
|
|
1957
1950
|
}) => {
|
|
1958
|
-
const u =
|
|
1951
|
+
const u = lt({
|
|
1959
1952
|
position: n,
|
|
1960
1953
|
viewport: a,
|
|
1961
1954
|
navigationResolver: i,
|
|
@@ -1977,7 +1970,7 @@ const Ai = (n) => (e) => {
|
|
|
1977
1970
|
);
|
|
1978
1971
|
if (r === "vertical" && n.y !== u.y)
|
|
1979
1972
|
return i.getAdjustedPositionForSpread(u);
|
|
1980
|
-
const l =
|
|
1973
|
+
const l = lt({
|
|
1981
1974
|
position: u,
|
|
1982
1975
|
viewport: a,
|
|
1983
1976
|
navigationResolver: i,
|
|
@@ -1995,18 +1988,18 @@ const Ai = (n) => (e) => {
|
|
|
1995
1988
|
pageWidth: i,
|
|
1996
1989
|
spineItemLocator: o
|
|
1997
1990
|
}) => {
|
|
1998
|
-
let s = new
|
|
1991
|
+
let s = new E({
|
|
1999
1992
|
x: n.x + i,
|
|
2000
1993
|
y: n.y
|
|
2001
1994
|
});
|
|
2002
|
-
return e.isUsingVerticalWriting() && (s = new
|
|
1995
|
+
return e.isUsingVerticalWriting() && (s = new E({
|
|
2003
1996
|
x: n.x,
|
|
2004
1997
|
y: n.y - t
|
|
2005
1998
|
})), o.getSpineItemClosestPositionFromUnsafePosition(
|
|
2006
1999
|
s,
|
|
2007
2000
|
e
|
|
2008
2001
|
);
|
|
2009
|
-
},
|
|
2002
|
+
}, dt = ({
|
|
2010
2003
|
position: n,
|
|
2011
2004
|
navigationResolver: e,
|
|
2012
2005
|
computedPageTurnDirection: t,
|
|
@@ -2034,10 +2027,10 @@ const Ai = (n) => (e) => {
|
|
|
2034
2027
|
spineItemPosition: l,
|
|
2035
2028
|
spineItem: a
|
|
2036
2029
|
}) : e.fromUnboundSpinePosition(
|
|
2037
|
-
r === "horizontal" ? new
|
|
2030
|
+
r === "horizontal" ? new ae({
|
|
2038
2031
|
x: n.x + s.pageSize.width,
|
|
2039
2032
|
y: 0
|
|
2040
|
-
}) : new
|
|
2033
|
+
}) : new ae({
|
|
2041
2034
|
y: n.y + s.pageSize.height,
|
|
2042
2035
|
x: 0
|
|
2043
2036
|
})
|
|
@@ -2053,7 +2046,7 @@ const Ai = (n) => (e) => {
|
|
|
2053
2046
|
viewport: a,
|
|
2054
2047
|
settings: c
|
|
2055
2048
|
}) => {
|
|
2056
|
-
const u =
|
|
2049
|
+
const u = dt({
|
|
2057
2050
|
position: n,
|
|
2058
2051
|
viewport: a,
|
|
2059
2052
|
navigationResolver: i,
|
|
@@ -2078,7 +2071,7 @@ const Ai = (n) => (e) => {
|
|
|
2078
2071
|
);
|
|
2079
2072
|
if (r === "vertical" && n.y !== u.y)
|
|
2080
2073
|
return i.getAdjustedPositionForSpread(u);
|
|
2081
|
-
const l =
|
|
2074
|
+
const l = dt({
|
|
2082
2075
|
position: u,
|
|
2083
2076
|
viewport: a,
|
|
2084
2077
|
navigationResolver: i,
|
|
@@ -2092,7 +2085,7 @@ const Ai = (n) => (e) => {
|
|
|
2092
2085
|
};
|
|
2093
2086
|
class Ui {
|
|
2094
2087
|
constructor(e) {
|
|
2095
|
-
this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new
|
|
2088
|
+
this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new M({ x: 0, y: 0 }), this.unlock = void 0;
|
|
2096
2089
|
}
|
|
2097
2090
|
turnRight() {
|
|
2098
2091
|
return this.turnRightOrBottom();
|
|
@@ -2273,8 +2266,8 @@ class zi extends Q {
|
|
|
2273
2266
|
constructor(e) {
|
|
2274
2267
|
super({
|
|
2275
2268
|
lastDelta: { x: 0, y: 0 },
|
|
2276
|
-
lastPosition: new
|
|
2277
|
-
lastStartPosition: new
|
|
2269
|
+
lastPosition: new M({ x: 0, y: 0 }),
|
|
2270
|
+
lastStartPosition: new M({ x: 0, y: 0 }),
|
|
2278
2271
|
isStarted: !1
|
|
2279
2272
|
}), this.reader = e, this.unlock = void 0;
|
|
2280
2273
|
}
|
|
@@ -2310,7 +2303,7 @@ class zi extends Q {
|
|
|
2310
2303
|
), c = Math.floor(
|
|
2311
2304
|
t === "horizontal" ? 0 : this.value.lastPosition.y - r / o
|
|
2312
2305
|
);
|
|
2313
|
-
i = new
|
|
2306
|
+
i = new M({
|
|
2314
2307
|
x: a,
|
|
2315
2308
|
y: c
|
|
2316
2309
|
}), this.mergeCompare({
|
|
@@ -2328,7 +2321,7 @@ class zi extends Q {
|
|
|
2328
2321
|
}
|
|
2329
2322
|
class G {
|
|
2330
2323
|
constructor() {
|
|
2331
|
-
this.isDestroyed = !1, this.destroySubject = new
|
|
2324
|
+
this.isDestroyed = !1, this.destroySubject = new N(), this.destroy$ = this.destroySubject.asObservable();
|
|
2332
2325
|
}
|
|
2333
2326
|
destroy() {
|
|
2334
2327
|
this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
|
|
@@ -2337,19 +2330,19 @@ class G {
|
|
|
2337
2330
|
const Wi = 500;
|
|
2338
2331
|
class _i extends G {
|
|
2339
2332
|
constructor(e, t) {
|
|
2340
|
-
super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new
|
|
2333
|
+
super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new N(), this.navigation$ = this.navigationSubject.asObservable();
|
|
2341
2334
|
const i = this.scrollNavigationController.userScroll$.pipe(
|
|
2342
|
-
|
|
2335
|
+
sn((o) => {
|
|
2343
2336
|
const s = this.locker.lock();
|
|
2344
2337
|
return P(
|
|
2345
2338
|
this.scrollNavigationController.userScroll$,
|
|
2346
2339
|
v(o)
|
|
2347
2340
|
).pipe(
|
|
2348
|
-
|
|
2341
|
+
Ie(
|
|
2349
2342
|
Wi,
|
|
2350
|
-
|
|
2343
|
+
re
|
|
2351
2344
|
),
|
|
2352
|
-
|
|
2345
|
+
U(),
|
|
2353
2346
|
x(() => {
|
|
2354
2347
|
const r = this.scrollNavigationController.fromScrollPosition(
|
|
2355
2348
|
this.scrollNavigationController.scrollPosition
|
|
@@ -2360,13 +2353,13 @@ class _i extends G {
|
|
|
2360
2353
|
position: r
|
|
2361
2354
|
});
|
|
2362
2355
|
}),
|
|
2363
|
-
|
|
2356
|
+
me(() => {
|
|
2364
2357
|
s();
|
|
2365
2358
|
})
|
|
2366
2359
|
);
|
|
2367
2360
|
})
|
|
2368
2361
|
);
|
|
2369
|
-
P(i).pipe(
|
|
2362
|
+
P(i).pipe(T(this.destroy$)).subscribe();
|
|
2370
2363
|
}
|
|
2371
2364
|
}
|
|
2372
2365
|
const Hi = (n) => n.pagination.state$.pipe(
|
|
@@ -2388,7 +2381,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2388
2381
|
};
|
|
2389
2382
|
}
|
|
2390
2383
|
),
|
|
2391
|
-
|
|
2384
|
+
R(O)
|
|
2392
2385
|
), Bi = ({ reader: n, duration: e }) => (t) => {
|
|
2393
2386
|
let i;
|
|
2394
2387
|
const o = () => {
|
|
@@ -2398,27 +2391,27 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2398
2391
|
x(() => {
|
|
2399
2392
|
i || (i = n?.navigation.lock());
|
|
2400
2393
|
}),
|
|
2401
|
-
|
|
2394
|
+
rn(e, re, {
|
|
2402
2395
|
trailing: !0,
|
|
2403
2396
|
leading: !0
|
|
2404
2397
|
}),
|
|
2405
2398
|
x(o),
|
|
2406
|
-
|
|
2399
|
+
me(o)
|
|
2407
2400
|
);
|
|
2408
2401
|
}, Xi = (n) => (e) => {
|
|
2409
2402
|
const t = n(e), i = Hi(t), o = new Ui(t), s = new zi(t), r = new _i(
|
|
2410
2403
|
t.navigation.scrollNavigationController,
|
|
2411
2404
|
t.navigation.locker
|
|
2412
|
-
), a =
|
|
2405
|
+
), a = Ri(t, o), c = r.navigation$.pipe(
|
|
2413
2406
|
x((d) => {
|
|
2414
2407
|
t.navigation.navigate(d);
|
|
2415
2408
|
})
|
|
2416
2409
|
);
|
|
2417
|
-
return P(a, c).pipe(
|
|
2410
|
+
return P(a, c).pipe(T(t.$.destroy$)).subscribe(), {
|
|
2418
2411
|
...t,
|
|
2419
2412
|
load: (d) => {
|
|
2420
|
-
const { cfi:
|
|
2421
|
-
t.load(
|
|
2413
|
+
const { cfi: g, ...p } = d;
|
|
2414
|
+
t.load(p), g && o.goToCfi(g, { animate: !1 });
|
|
2422
2415
|
},
|
|
2423
2416
|
destroy: () => {
|
|
2424
2417
|
r.destroy(), t.destroy();
|
|
@@ -2426,7 +2419,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2426
2419
|
navigation: {
|
|
2427
2420
|
...t.navigation,
|
|
2428
2421
|
state$: i,
|
|
2429
|
-
throttleLock: ({ duration: d, trigger:
|
|
2422
|
+
throttleLock: ({ duration: d, trigger: g }) => g.pipe(Bi({ duration: d, reader: t })),
|
|
2430
2423
|
panNavigator: s,
|
|
2431
2424
|
turnBottom: o.turnBottom.bind(o),
|
|
2432
2425
|
turnTop: o.turnTop.bind(o),
|
|
@@ -2449,7 +2442,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2449
2442
|
goToAbsolutePageIndex: o.goToAbsolutePageIndex.bind(o)
|
|
2450
2443
|
}
|
|
2451
2444
|
};
|
|
2452
|
-
},
|
|
2445
|
+
}, zt = (n, e, t) => {
|
|
2453
2446
|
const i = t.spineItems.findIndex(
|
|
2454
2447
|
(o) => o.href === n
|
|
2455
2448
|
);
|
|
@@ -2459,14 +2452,14 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2459
2452
|
a.lastIndexOf("/")
|
|
2460
2453
|
), u = n.substring(0, n.lastIndexOf("/")), l = n.endsWith(a), d = u !== "" && u.endsWith(c);
|
|
2461
2454
|
if (l || d) {
|
|
2462
|
-
const
|
|
2455
|
+
const p = t.spineItems.findIndex(
|
|
2463
2456
|
(f) => f.href === s.href
|
|
2464
2457
|
);
|
|
2465
|
-
if (i <
|
|
2458
|
+
if (i < p) return o;
|
|
2466
2459
|
const m = {
|
|
2467
2460
|
title: s.title,
|
|
2468
2461
|
path: s.path
|
|
2469
|
-
}, y =
|
|
2462
|
+
}, y = zt(n, s.contents, t);
|
|
2470
2463
|
return y ? {
|
|
2471
2464
|
...m,
|
|
2472
2465
|
subChapter: y
|
|
@@ -2476,7 +2469,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2476
2469
|
}, void 0);
|
|
2477
2470
|
}, Yi = (n, e) => {
|
|
2478
2471
|
const { href: t } = e;
|
|
2479
|
-
return
|
|
2472
|
+
return zt(t, n.nav?.toc ?? [], n);
|
|
2480
2473
|
}, qi = (n) => {
|
|
2481
2474
|
const e = n.context.manifest, t = n.spineItemsManager.items;
|
|
2482
2475
|
return e ? t.reduce(
|
|
@@ -2487,7 +2480,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2487
2480
|
ne([]),
|
|
2488
2481
|
S(() => qi(n))
|
|
2489
2482
|
), Zi = (n, e, t) => n + e * t, Ji = (n, e, t) => {
|
|
2490
|
-
const { height: i, width: o } = t.
|
|
2483
|
+
const { height: i, width: o } = t.layoutInfo, { top: s, left: r } = n.spine.getSpineItemSpineLayoutInfo(t);
|
|
2491
2484
|
return n.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
|
|
2492
2485
|
0,
|
|
2493
2486
|
Math.min(
|
|
@@ -2502,13 +2495,13 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2502
2495
|
)
|
|
2503
2496
|
);
|
|
2504
2497
|
}, Ki = (n, e, t, i, o) => o.isReady$.pipe(
|
|
2505
|
-
|
|
2498
|
+
U(),
|
|
2506
2499
|
z(n.layoutInfo$),
|
|
2507
2500
|
S(([s, r]) => {
|
|
2508
|
-
const a = n.context, c = a.manifest?.renditionLayout === "pre-paginated", u = a.manifest?.spineItems.length || 0, l = a.manifest?.spineItems.slice(0, e).reduce((f, I) => f + (I.progressionWeight ?? 0), 0) || 0, d = n.spineItemsManager.getSpineItemIndex(o) ?? 0,
|
|
2501
|
+
const a = n.context, c = a.manifest?.renditionLayout === "pre-paginated", u = a.manifest?.spineItems.length || 0, l = a.manifest?.spineItems.slice(0, e).reduce((f, I) => f + (I.progressionWeight ?? 0), 0) || 0, d = n.spineItemsManager.getSpineItemIndex(o) ?? 0, g = n.context.manifest?.spineItems.length ?? 0, p = r.pages.filter((f) => f.itemIndex === d).length ?? 0, h = a.manifest?.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
|
|
2509
2502
|
// relative to the total number of documents
|
|
2510
|
-
(d + 1) /
|
|
2511
|
-
let m = (t + 1) * (h /
|
|
2503
|
+
(d + 1) / g;
|
|
2504
|
+
let m = (t + 1) * (h / p);
|
|
2512
2505
|
!c && o.renditionLayout === "reflowable" && !s && (m = 0);
|
|
2513
2506
|
let y = l + m;
|
|
2514
2507
|
return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Ji(
|
|
@@ -2519,10 +2512,10 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2519
2512
|
l,
|
|
2520
2513
|
h,
|
|
2521
2514
|
m
|
|
2522
|
-
)), e === u - 1 && t ===
|
|
2515
|
+
)), e === u - 1 && t === p - 1 && y > 0.99 ? 1 : y;
|
|
2523
2516
|
})
|
|
2524
2517
|
), Qi = (n) => n.spine.layout$.pipe(
|
|
2525
|
-
|
|
2518
|
+
Ie(10, re),
|
|
2526
2519
|
z(n.pagination.state$),
|
|
2527
2520
|
S(() => ({
|
|
2528
2521
|
numberOfPagesPerItems: n.spineItemsManager.items.reduce(
|
|
@@ -2534,7 +2527,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2534
2527
|
*/
|
|
2535
2528
|
numberOfTotalPages: n.spine.pages.value.pages.length
|
|
2536
2529
|
})),
|
|
2537
|
-
|
|
2530
|
+
R(O),
|
|
2538
2531
|
ne({
|
|
2539
2532
|
numberOfPagesPerItems: [],
|
|
2540
2533
|
numberOfTotalPages: 0
|
|
@@ -2570,7 +2563,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2570
2563
|
// hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
|
|
2571
2564
|
// numberOfSpineItems: context.manifest?.readingOrder.length,
|
|
2572
2565
|
});
|
|
2573
|
-
}, to = (n) =>
|
|
2566
|
+
}, to = (n) => j([
|
|
2574
2567
|
n.pagination.state$,
|
|
2575
2568
|
// Usually pagination change if layout changes (number of pages) however it is especially
|
|
2576
2569
|
// useful for like webtoon where you still have one page but only the layout will give you the final size
|
|
@@ -2588,7 +2581,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2588
2581
|
) : v(0);
|
|
2589
2582
|
})
|
|
2590
2583
|
), no = (n) => {
|
|
2591
|
-
const e = Gi(n), t = Qi(n), i = new
|
|
2584
|
+
const e = Gi(n), t = Qi(n), i = new q({
|
|
2592
2585
|
...n.pagination.state,
|
|
2593
2586
|
beginChapterInfo: void 0,
|
|
2594
2587
|
beginCfi: void 0,
|
|
@@ -2603,7 +2596,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2603
2596
|
endChapterInfo: void 0,
|
|
2604
2597
|
endSpineItemReadingDirection: void 0,
|
|
2605
2598
|
percentageEstimateOfBook: 0
|
|
2606
|
-
}), o =
|
|
2599
|
+
}), o = j([
|
|
2607
2600
|
n.pagination.state$,
|
|
2608
2601
|
e,
|
|
2609
2602
|
to(n)
|
|
@@ -2621,9 +2614,9 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2621
2614
|
}))
|
|
2622
2615
|
)
|
|
2623
2616
|
),
|
|
2624
|
-
|
|
2617
|
+
R(O)
|
|
2625
2618
|
);
|
|
2626
|
-
return { paginationInfo$:
|
|
2619
|
+
return { paginationInfo$: j([
|
|
2627
2620
|
o,
|
|
2628
2621
|
t
|
|
2629
2622
|
]).pipe(
|
|
@@ -2644,16 +2637,16 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2644
2637
|
}),
|
|
2645
2638
|
J(1)
|
|
2646
2639
|
), getPaginationInfo: () => i.value };
|
|
2647
|
-
},
|
|
2640
|
+
}, de = (n) => We({
|
|
2648
2641
|
spineIndex: n.index,
|
|
2649
2642
|
spineId: n.id
|
|
2650
|
-
}),
|
|
2643
|
+
}), Wt = ({
|
|
2651
2644
|
nodeOrRange: n,
|
|
2652
2645
|
offset: e,
|
|
2653
2646
|
item: t
|
|
2654
2647
|
}) => {
|
|
2655
2648
|
const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
|
|
2656
|
-
return !i || !i?.documentElement || n === i ?
|
|
2649
|
+
return !i || !i?.documentElement || n === i ? de(t) : On(n) ? We({
|
|
2657
2650
|
start: {
|
|
2658
2651
|
node: n.startContainer,
|
|
2659
2652
|
offset: n.startOffset,
|
|
@@ -2672,33 +2665,27 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2672
2665
|
spineIndex: t.index,
|
|
2673
2666
|
spineId: t.id
|
|
2674
2667
|
});
|
|
2675
|
-
},
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
return o && s instanceof HTMLIFrameElement && s.contentWindow?.document ? Bt({
|
|
2684
|
-
nodeOrRange: o.node,
|
|
2685
|
-
offset: o.offset,
|
|
2686
|
-
item: e.item
|
|
2687
|
-
}).trim() : me(e.item);
|
|
2688
|
-
}, io = (n, e) => Bt({
|
|
2668
|
+
}, He = ({
|
|
2669
|
+
spineItem: n,
|
|
2670
|
+
pageNode: e
|
|
2671
|
+
}) => Wt({
|
|
2672
|
+
nodeOrRange: e.node,
|
|
2673
|
+
offset: e.offset,
|
|
2674
|
+
item: n
|
|
2675
|
+
}).trim(), io = (n, e) => Wt({
|
|
2689
2676
|
nodeOrRange: n,
|
|
2690
2677
|
item: e
|
|
2691
|
-
}),
|
|
2692
|
-
const e =
|
|
2678
|
+
}), Zs = (n) => n.index.toString(), pt = (n) => n[0]?.index === 6 && n.length > 1, Be = (n) => {
|
|
2679
|
+
const e = Mt(n);
|
|
2693
2680
|
return wn(e);
|
|
2694
|
-
}, oo = (n) => Array.isArray(n) ? n[0] &&
|
|
2695
|
-
const e =
|
|
2681
|
+
}, oo = (n) => Array.isArray(n) ? n[0] && pt(n[0]) ? n[0] : void 0 : n.parent[0] && pt(n.parent[0]) ? n.parent[0] : void 0, it = (n) => {
|
|
2682
|
+
const e = Mt(n), s = ((oo(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = Pn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
|
|
2696
2683
|
return {
|
|
2697
2684
|
isCfiRange: r,
|
|
2698
2685
|
itemIndex: s,
|
|
2699
2686
|
offset: a ?? 0
|
|
2700
2687
|
};
|
|
2701
|
-
},
|
|
2688
|
+
}, _t = ({
|
|
2702
2689
|
cfi: n,
|
|
2703
2690
|
spineItemsManager: e
|
|
2704
2691
|
}) => {
|
|
@@ -2727,7 +2714,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2727
2714
|
spineItem: o
|
|
2728
2715
|
};
|
|
2729
2716
|
} catch (a) {
|
|
2730
|
-
return
|
|
2717
|
+
return A.warn(`Error resolving cfi: ${n}.`), A.warn(a), {
|
|
2731
2718
|
...i,
|
|
2732
2719
|
spineItem: o,
|
|
2733
2720
|
itemIndex: t,
|
|
@@ -2754,17 +2741,17 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2754
2741
|
const t = n.spineItemsManager.get(e);
|
|
2755
2742
|
if (!t)
|
|
2756
2743
|
throw new Error("Spine item not found");
|
|
2757
|
-
const i =
|
|
2744
|
+
const i = de(t.item);
|
|
2758
2745
|
return {
|
|
2759
2746
|
...n.cfi.parseCfi(i),
|
|
2760
|
-
cfi:
|
|
2747
|
+
cfi: de(t.item),
|
|
2761
2748
|
itemIndex: t.index,
|
|
2762
2749
|
node: null
|
|
2763
2750
|
};
|
|
2764
2751
|
}, ro = (n, e) => {
|
|
2765
2752
|
let t = n?.itemPageIndex;
|
|
2766
2753
|
const { itemIndex: i, ...o } = e.cfi.parseCfi(n.cfi), s = e.spineItemsManager.get(i);
|
|
2767
|
-
return s ?
|
|
2754
|
+
return s ? et().pipe(
|
|
2768
2755
|
z(s.isReady$),
|
|
2769
2756
|
S(([, r]) => {
|
|
2770
2757
|
const {
|
|
@@ -2804,12 +2791,12 @@ class ao {
|
|
|
2804
2791
|
resource: t,
|
|
2805
2792
|
meta: so(this.reader, t)
|
|
2806
2793
|
};
|
|
2807
|
-
return
|
|
2794
|
+
return at(() => {
|
|
2808
2795
|
const s = this.reader.spineItemsManager.get(
|
|
2809
2796
|
o.meta.itemIndex ?? 0
|
|
2810
2797
|
), r = s?.renditionLayout === "reflowable", a = i.mode === "shallow" || !r || !s ? () => {
|
|
2811
|
-
} : this.reader.spine.spineItemsLoader.forceOpen([s.index]), c = "cfi" in t ? t.cfi : void 0, u = c ? this.locatorsByKey.get(c) : void 0, l = (
|
|
2812
|
-
|
|
2798
|
+
} : this.reader.spine.spineItemsLoader.forceOpen([s.index]), c = "cfi" in t ? t.cfi : void 0, u = c ? this.locatorsByKey.get(c) : void 0, l = (g) => g.pipe(
|
|
2799
|
+
me(() => {
|
|
2813
2800
|
c && this.deregisterMemoizedStream(c), setTimeout(() => {
|
|
2814
2801
|
a();
|
|
2815
2802
|
}, 1e3);
|
|
@@ -2818,19 +2805,19 @@ class ao {
|
|
|
2818
2805
|
if (c && u)
|
|
2819
2806
|
return u.observerCount++, l(
|
|
2820
2807
|
u.consolidate$.pipe(
|
|
2821
|
-
S(({ resource:
|
|
2822
|
-
resource:
|
|
2823
|
-
meta:
|
|
2808
|
+
S(({ resource: g, meta: p }) => ({
|
|
2809
|
+
resource: g,
|
|
2810
|
+
meta: p
|
|
2824
2811
|
}))
|
|
2825
2812
|
)
|
|
2826
2813
|
);
|
|
2827
2814
|
const d = this.reader.spine.layout$.pipe(
|
|
2828
|
-
|
|
2815
|
+
Ie(10),
|
|
2829
2816
|
ne(o),
|
|
2830
|
-
|
|
2831
|
-
S((
|
|
2832
|
-
...
|
|
2833
|
-
meta:
|
|
2817
|
+
an((g) => ro(g.meta, this.reader).pipe(
|
|
2818
|
+
S((p) => ({
|
|
2819
|
+
...g,
|
|
2820
|
+
meta: p
|
|
2834
2821
|
}))
|
|
2835
2822
|
), o),
|
|
2836
2823
|
J({ refCount: !0, bufferSize: 1 })
|
|
@@ -2843,16 +2830,16 @@ class ao {
|
|
|
2843
2830
|
};
|
|
2844
2831
|
}
|
|
2845
2832
|
locateResource(e, t) {
|
|
2846
|
-
return Array.isArray(e) ?
|
|
2847
|
-
() =>
|
|
2833
|
+
return Array.isArray(e) ? at(
|
|
2834
|
+
() => j(
|
|
2848
2835
|
e.map((i) => this.locate(i, t ?? {}))
|
|
2849
|
-
).pipe(
|
|
2836
|
+
).pipe(cn([]))
|
|
2850
2837
|
) : this.locate(e, t ?? {});
|
|
2851
2838
|
}
|
|
2852
2839
|
}
|
|
2853
2840
|
const co = (n) => (e) => {
|
|
2854
2841
|
const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = no(t);
|
|
2855
|
-
i.pipe(
|
|
2842
|
+
i.pipe(T(t.$.destroy$)).subscribe();
|
|
2856
2843
|
const s = new ao(t);
|
|
2857
2844
|
return {
|
|
2858
2845
|
...t,
|
|
@@ -2870,16 +2857,16 @@ const co = (n) => (e) => {
|
|
|
2870
2857
|
}, uo = (n) => ({
|
|
2871
2858
|
put: (s, r) => new Promise((a, c) => {
|
|
2872
2859
|
const u = n.transaction(["store"], "readwrite");
|
|
2873
|
-
u.onerror = (
|
|
2874
|
-
c(
|
|
2860
|
+
u.onerror = (g) => {
|
|
2861
|
+
c(g);
|
|
2875
2862
|
}, u.oncomplete = () => {
|
|
2876
2863
|
a();
|
|
2877
2864
|
};
|
|
2878
2865
|
const d = u.objectStore("store").put(r, s);
|
|
2879
2866
|
d.onsuccess = () => {
|
|
2880
2867
|
a();
|
|
2881
|
-
}, d.onerror = (
|
|
2882
|
-
c(
|
|
2868
|
+
}, d.onerror = (g) => {
|
|
2869
|
+
c(g);
|
|
2883
2870
|
};
|
|
2884
2871
|
}),
|
|
2885
2872
|
keys: () => new Promise((s, r) => {
|
|
@@ -2919,7 +2906,7 @@ const co = (n) => (e) => {
|
|
|
2919
2906
|
a(d);
|
|
2920
2907
|
};
|
|
2921
2908
|
})
|
|
2922
|
-
}),
|
|
2909
|
+
}), Ve = async (n) => new Promise((e, t) => {
|
|
2923
2910
|
const i = window.indexedDB.open(n);
|
|
2924
2911
|
i.onerror = (o) => {
|
|
2925
2912
|
t(o);
|
|
@@ -2930,7 +2917,7 @@ const co = (n) => (e) => {
|
|
|
2930
2917
|
};
|
|
2931
2918
|
}), lo = (n) => {
|
|
2932
2919
|
let e = Date.now().toString();
|
|
2933
|
-
const t = new
|
|
2920
|
+
const t = new N(), i = (c) => {
|
|
2934
2921
|
if (typeof c == "string" || typeof c == "object") {
|
|
2935
2922
|
const u = typeof c == "object" ? c.id : c;
|
|
2936
2923
|
return n.manifest?.spineItems.find((l) => l.id === u);
|
|
@@ -2939,45 +2926,45 @@ const co = (n) => (e) => {
|
|
|
2939
2926
|
}, o = async (c, u) => {
|
|
2940
2927
|
const l = i(c);
|
|
2941
2928
|
if (!l) return new Response("Item not found", { status: 404 });
|
|
2942
|
-
const
|
|
2943
|
-
if (
|
|
2944
|
-
return new Response(
|
|
2945
|
-
const
|
|
2946
|
-
return s(l,
|
|
2929
|
+
const g = await (await Ve("prose-reader")).get(`${e}_${l.id}`);
|
|
2930
|
+
if (g)
|
|
2931
|
+
return new Response(g, { status: 200 });
|
|
2932
|
+
const p = u && await u(l) || await fetch(l.href);
|
|
2933
|
+
return s(l, p.clone()), p;
|
|
2947
2934
|
}, s = (c, u) => {
|
|
2948
2935
|
t.next({ id: c, data: u });
|
|
2949
2936
|
};
|
|
2950
2937
|
t.asObservable().pipe(
|
|
2951
|
-
|
|
2938
|
+
bn(({ id: c, data: u }) => {
|
|
2952
2939
|
const l = i(c);
|
|
2953
|
-
return l ?
|
|
2954
|
-
|
|
2940
|
+
return l ? k(
|
|
2941
|
+
un([Ve("prose-reader"), k(u.blob())])
|
|
2955
2942
|
).pipe(
|
|
2956
|
-
|
|
2957
|
-
|
|
2943
|
+
Y(([d, g]) => k(d.put(`${e}_${l.id}`, g))),
|
|
2944
|
+
st((d) => (A.error(d), _))
|
|
2958
2945
|
) : _;
|
|
2959
2946
|
}),
|
|
2960
2947
|
K(n.destroy$)
|
|
2961
2948
|
).subscribe();
|
|
2962
2949
|
const r = n.manifest$.pipe(
|
|
2963
|
-
|
|
2950
|
+
V(() => {
|
|
2964
2951
|
e = Date.now().toString();
|
|
2965
2952
|
})
|
|
2966
2953
|
);
|
|
2967
2954
|
return P(r).pipe(
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
(c) =>
|
|
2955
|
+
Y(() => (A.debug("Cleanup up old cache..."), k(Ve("prose-reader")).pipe(
|
|
2956
|
+
Y(
|
|
2957
|
+
(c) => k(c.keys()).pipe(
|
|
2971
2958
|
ie(
|
|
2972
2959
|
(u) => u.filter((l) => !l.toString().startsWith(e))
|
|
2973
2960
|
),
|
|
2974
|
-
|
|
2961
|
+
Y((u) => {
|
|
2975
2962
|
const l = u.map((d) => c.remove(d));
|
|
2976
|
-
return
|
|
2963
|
+
return k(Promise.all(l));
|
|
2977
2964
|
})
|
|
2978
2965
|
)
|
|
2979
2966
|
),
|
|
2980
|
-
|
|
2967
|
+
st((c) => (A.error(c), _))
|
|
2981
2968
|
))),
|
|
2982
2969
|
K(n.destroy$)
|
|
2983
2970
|
).subscribe(), {
|
|
@@ -3012,7 +2999,7 @@ const co = (n) => (e) => {
|
|
|
3012
2999
|
t.setStart(n.node, o), t.setEnd(n.node, s);
|
|
3013
3000
|
}
|
|
3014
3001
|
} catch (o) {
|
|
3015
|
-
|
|
3002
|
+
A.warn("Failed to create range from selection", o, {
|
|
3016
3003
|
anchor: n,
|
|
3017
3004
|
focus: e
|
|
3018
3005
|
});
|
|
@@ -3031,7 +3018,7 @@ const co = (n) => (e) => {
|
|
|
3031
3018
|
{ node: o, offset: s }
|
|
3032
3019
|
);
|
|
3033
3020
|
} catch (r) {
|
|
3034
|
-
|
|
3021
|
+
A.warn("Failed to create range from selection", r, {
|
|
3035
3022
|
selection: n,
|
|
3036
3023
|
spineItem: e
|
|
3037
3024
|
});
|
|
@@ -3045,37 +3032,37 @@ class mo extends G {
|
|
|
3045
3032
|
if (!t)
|
|
3046
3033
|
this.selectionChange$ = he, this.selectionOver$ = he;
|
|
3047
3034
|
else {
|
|
3048
|
-
const i =
|
|
3035
|
+
const i = ct(t.body, {
|
|
3049
3036
|
childList: !0,
|
|
3050
3037
|
subtree: !0
|
|
3051
3038
|
}).pipe(
|
|
3052
|
-
|
|
3039
|
+
C(
|
|
3053
3040
|
(s) => !!s.find((r) => r.type === "childList" && r.removedNodes.length)
|
|
3054
3041
|
)
|
|
3055
|
-
), o = e.parentElement ?
|
|
3042
|
+
), o = e.parentElement ? ct(e.parentElement, {
|
|
3056
3043
|
childList: !0
|
|
3057
3044
|
}).pipe(
|
|
3058
|
-
|
|
3045
|
+
C(
|
|
3059
3046
|
(s) => !!s.find(
|
|
3060
3047
|
(r) => Array.from(r.removedNodes).includes(e)
|
|
3061
3048
|
)
|
|
3062
3049
|
)
|
|
3063
3050
|
) : v(null);
|
|
3064
3051
|
this.selectionChange$ = P(
|
|
3065
|
-
|
|
3052
|
+
X(t, "selectionchange"),
|
|
3066
3053
|
i
|
|
3067
3054
|
).pipe(
|
|
3068
3055
|
S(() => t.getSelection()),
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
), this.selectionOver$ =
|
|
3056
|
+
T(P(o, this.destroy$)),
|
|
3057
|
+
fe(null)
|
|
3058
|
+
), this.selectionOver$ = X(t, "pointerdown").pipe(
|
|
3072
3059
|
w(
|
|
3073
3060
|
() => P(
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3061
|
+
X(t, "pointerup"),
|
|
3062
|
+
X(t, "pointercancel"),
|
|
3063
|
+
X(t, "contextmenu")
|
|
3077
3064
|
).pipe(
|
|
3078
|
-
|
|
3065
|
+
U(),
|
|
3079
3066
|
/**
|
|
3080
3067
|
* The selection is still valid during the event even if it will
|
|
3081
3068
|
* be discarded. The timeout make sure to detect this edge case.
|
|
@@ -3085,10 +3072,10 @@ class mo extends G {
|
|
|
3085
3072
|
const r = t.getSelection();
|
|
3086
3073
|
return r && !r.isCollapsed ? [s, r] : void 0;
|
|
3087
3074
|
}),
|
|
3088
|
-
|
|
3075
|
+
C(Z)
|
|
3089
3076
|
)
|
|
3090
3077
|
),
|
|
3091
|
-
|
|
3078
|
+
T(P(o, this.destroy$))
|
|
3092
3079
|
);
|
|
3093
3080
|
}
|
|
3094
3081
|
}
|
|
@@ -3116,27 +3103,27 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3116
3103
|
}))
|
|
3117
3104
|
)
|
|
3118
3105
|
).pipe(
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3106
|
+
T(n.unloaded$),
|
|
3107
|
+
fe(void 0),
|
|
3108
|
+
me(() => {
|
|
3122
3109
|
i.destroy();
|
|
3123
3110
|
})
|
|
3124
3111
|
);
|
|
3125
3112
|
}),
|
|
3126
|
-
|
|
3113
|
+
R()
|
|
3127
3114
|
), yo = (n) => (e) => {
|
|
3128
3115
|
const t = n(e);
|
|
3129
3116
|
let i;
|
|
3130
3117
|
const o = t.spineItemsManager.items$.pipe(
|
|
3131
3118
|
w((l) => {
|
|
3132
|
-
const d = l.map((
|
|
3133
|
-
const
|
|
3134
|
-
return fo(
|
|
3119
|
+
const d = l.map((g) => {
|
|
3120
|
+
const p = t.spineItemsManager.getSpineItemIndex(g) ?? 0;
|
|
3121
|
+
return fo(g).pipe(
|
|
3135
3122
|
S((h) => {
|
|
3136
3123
|
if (h)
|
|
3137
3124
|
return {
|
|
3138
3125
|
...h,
|
|
3139
|
-
itemIndex:
|
|
3126
|
+
itemIndex: p
|
|
3140
3127
|
};
|
|
3141
3128
|
})
|
|
3142
3129
|
);
|
|
@@ -3144,33 +3131,33 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3144
3131
|
return P(...d);
|
|
3145
3132
|
}),
|
|
3146
3133
|
ne(void 0),
|
|
3147
|
-
|
|
3134
|
+
R(),
|
|
3148
3135
|
x((l) => {
|
|
3149
3136
|
i = l;
|
|
3150
3137
|
}),
|
|
3151
3138
|
J({ refCount: !0, bufferSize: 1 })
|
|
3152
3139
|
), s = o, r = o.pipe(
|
|
3153
3140
|
S((l) => !!l),
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3141
|
+
R(),
|
|
3142
|
+
C((l) => l),
|
|
3143
|
+
D()
|
|
3157
3144
|
), a = r.pipe(
|
|
3158
3145
|
w(() => s),
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3146
|
+
R(),
|
|
3147
|
+
C((l) => !l),
|
|
3148
|
+
D()
|
|
3162
3149
|
), c = o.pipe(
|
|
3163
|
-
|
|
3164
|
-
|
|
3150
|
+
C((l) => l?.type === "over"),
|
|
3151
|
+
D()
|
|
3165
3152
|
), u = t.context.watch("rootElement").pipe(
|
|
3166
|
-
|
|
3167
|
-
w((l) =>
|
|
3153
|
+
C(Z),
|
|
3154
|
+
w((l) => X(l, "pointerdown")),
|
|
3168
3155
|
z(s),
|
|
3169
3156
|
S(([, l]) => l),
|
|
3170
3157
|
ne(void 0),
|
|
3171
3158
|
J({ refCount: !0, bufferSize: 1 })
|
|
3172
3159
|
);
|
|
3173
|
-
return P(s, u).pipe(
|
|
3160
|
+
return P(s, u).pipe(T(t.$.destroy$)).subscribe(), {
|
|
3174
3161
|
...t,
|
|
3175
3162
|
selection: {
|
|
3176
3163
|
selection$: s,
|
|
@@ -3182,7 +3169,7 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3182
3169
|
createOrderedRangeFromSelection: ho
|
|
3183
3170
|
}
|
|
3184
3171
|
};
|
|
3185
|
-
},
|
|
3172
|
+
}, gt = [
|
|
3186
3173
|
{
|
|
3187
3174
|
name: "bright",
|
|
3188
3175
|
backgroundColor: "white"
|
|
@@ -3198,10 +3185,10 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3198
3185
|
foregroundColor: "#f1ebeb"
|
|
3199
3186
|
}
|
|
3200
3187
|
], So = (n) => (e) => {
|
|
3201
|
-
const t = n(e), i = new
|
|
3188
|
+
const t = n(e), i = new q(
|
|
3202
3189
|
e.theme ?? "bright"
|
|
3203
3190
|
), o = () => {
|
|
3204
|
-
const a =
|
|
3191
|
+
const a = gt.find(
|
|
3205
3192
|
(c) => c.name === i.value
|
|
3206
3193
|
);
|
|
3207
3194
|
return `
|
|
@@ -3218,7 +3205,7 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3218
3205
|
}, s = ({
|
|
3219
3206
|
container: a
|
|
3220
3207
|
}) => {
|
|
3221
|
-
const c =
|
|
3208
|
+
const c = gt.find(
|
|
3222
3209
|
(u) => u.name === i.value
|
|
3223
3210
|
);
|
|
3224
3211
|
return c && a.style.setProperty(
|
|
@@ -3239,14 +3226,14 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3239
3226
|
u && oe(u, "prose-reader-theme", o());
|
|
3240
3227
|
}
|
|
3241
3228
|
}), t.spineItemsManager.items$.pipe(
|
|
3242
|
-
|
|
3229
|
+
V(
|
|
3243
3230
|
(a) => a.map(
|
|
3244
3231
|
({ element: c }) => s({ container: c })
|
|
3245
3232
|
)
|
|
3246
3233
|
),
|
|
3247
3234
|
K(t.$.destroy$)
|
|
3248
3235
|
).subscribe(), i.pipe(
|
|
3249
|
-
|
|
3236
|
+
V(() => {
|
|
3250
3237
|
r();
|
|
3251
3238
|
}),
|
|
3252
3239
|
K(t.$.destroy$)
|
|
@@ -3267,7 +3254,7 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3267
3254
|
return {
|
|
3268
3255
|
...t,
|
|
3269
3256
|
utils: {
|
|
3270
|
-
isOrIsWithinValidLink: (s) => !!(
|
|
3257
|
+
isOrIsWithinValidLink: (s) => !!(At(s) && (s.nodeName === "a" ? s : s.closest("a"))?.getAttribute("href")),
|
|
3271
3258
|
injectScopedCSS: (s, r, a) => {
|
|
3272
3259
|
const c = a.replace("${id}", t.id);
|
|
3273
3260
|
return Ce(s, `${r}-${t.id}`, c);
|
|
@@ -3276,7 +3263,7 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3276
3263
|
};
|
|
3277
3264
|
};
|
|
3278
3265
|
navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
|
|
3279
|
-
const bo = (n) => (e) => n(e), vo = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}",
|
|
3266
|
+
const bo = (n) => (e) => n(e), vo = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}", ht = (n, e, t) => {
|
|
3280
3267
|
const { clientWidth: i, clientHeight: o } = t.value.element, s = {
|
|
3281
3268
|
maxX: 0,
|
|
3282
3269
|
minX: i * (1 - e),
|
|
@@ -3298,14 +3285,14 @@ const bo = (n) => (e) => n(e), vo = "[data-prose-reader-scroll-navigator][data-p
|
|
|
3298
3285
|
y: i.y + c * (1 - o)
|
|
3299
3286
|
};
|
|
3300
3287
|
};
|
|
3301
|
-
class
|
|
3288
|
+
class Ht {
|
|
3302
3289
|
constructor(e) {
|
|
3303
3290
|
this.x = e.x, this.y = e.y;
|
|
3304
3291
|
}
|
|
3305
3292
|
}
|
|
3306
|
-
class
|
|
3293
|
+
class mt extends Ht {
|
|
3307
3294
|
}
|
|
3308
|
-
class xo extends
|
|
3295
|
+
class xo extends Ht {
|
|
3309
3296
|
constructor() {
|
|
3310
3297
|
super(...arguments), this.__symbol = /* @__PURE__ */ Symbol("UnboundScrollPosition");
|
|
3311
3298
|
}
|
|
@@ -3314,36 +3301,36 @@ class $o extends Q {
|
|
|
3314
3301
|
constructor(e, t, i, o, s) {
|
|
3315
3302
|
super({
|
|
3316
3303
|
element: void 0
|
|
3317
|
-
}), this.viewport = e, this.settings = t, this.hookManager = i, this.spine = o, this.context = s, this.navigateSubject = new
|
|
3304
|
+
}), this.viewport = e, this.settings = t, this.hookManager = i, this.spine = o, this.context = s, this.navigateSubject = new N(), this.scrollingSubject = new q(!1), this.isScrolling$ = this.scrollingSubject.asObservable(), this.setViewportPosition = ({
|
|
3318
3305
|
position: d
|
|
3319
3306
|
}) => {
|
|
3320
|
-
const
|
|
3307
|
+
const g = this.value.element;
|
|
3321
3308
|
this.scrollingSubject.next(!0);
|
|
3322
|
-
const
|
|
3323
|
-
|
|
3324
|
-
left:
|
|
3325
|
-
top:
|
|
3309
|
+
const p = this.fromSpinePosition(d);
|
|
3310
|
+
g?.scrollTo({
|
|
3311
|
+
left: p.x,
|
|
3312
|
+
top: p.y,
|
|
3326
3313
|
behavior: "instant"
|
|
3327
3314
|
}), Te(1).pipe(
|
|
3328
3315
|
x(() => {
|
|
3329
3316
|
this.scrollingSubject.next(!1);
|
|
3330
3317
|
}),
|
|
3331
|
-
|
|
3318
|
+
T(P(this.scrollingSubject.pipe(Ft(1)), this.destroy$))
|
|
3332
3319
|
).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
|
|
3333
3320
|
};
|
|
3334
3321
|
const r = this.context.pipe(
|
|
3335
|
-
|
|
3322
|
+
Ke(["rootElement"]),
|
|
3336
3323
|
x(({ rootElement: d }) => {
|
|
3337
3324
|
if (!d) return;
|
|
3338
|
-
const
|
|
3339
|
-
|
|
3325
|
+
const g = document.createElement("div");
|
|
3326
|
+
g.setAttribute(`data-${si}`, ""), g.appendChild(this.viewport.value.element), d.appendChild(g), this.update({ element: g });
|
|
3340
3327
|
})
|
|
3341
|
-
), a =
|
|
3328
|
+
), a = j([
|
|
3342
3329
|
t.watch(["computedPageTurnMode"]),
|
|
3343
3330
|
this.watch("element")
|
|
3344
3331
|
]).pipe(
|
|
3345
|
-
x(([{ computedPageTurnMode: d },
|
|
3346
|
-
|
|
3332
|
+
x(([{ computedPageTurnMode: d }, g]) => {
|
|
3333
|
+
g && (d === "scrollable" ? g.style.display = "block" : g.style.display = "contents");
|
|
3347
3334
|
})
|
|
3348
3335
|
), c = this.navigateSubject.pipe(x(this.setViewportPosition));
|
|
3349
3336
|
this.isNavigating$ = this.navigateSubject.pipe(
|
|
@@ -3353,12 +3340,12 @@ class $o extends Q {
|
|
|
3353
3340
|
);
|
|
3354
3341
|
const u = P(
|
|
3355
3342
|
o.element$.pipe(
|
|
3356
|
-
|
|
3357
|
-
w((d) =>
|
|
3343
|
+
C(Z),
|
|
3344
|
+
w((d) => Qe(d))
|
|
3358
3345
|
),
|
|
3359
3346
|
o.element$.pipe(
|
|
3360
|
-
|
|
3361
|
-
w((d) =>
|
|
3347
|
+
C(Z),
|
|
3348
|
+
w((d) => X(d, "scroll"))
|
|
3362
3349
|
),
|
|
3363
3350
|
o.spineItemsObserver.itemResize$
|
|
3364
3351
|
).pipe(
|
|
@@ -3368,34 +3355,34 @@ class $o extends Q {
|
|
|
3368
3355
|
ne(!0)
|
|
3369
3356
|
)
|
|
3370
3357
|
),
|
|
3371
|
-
|
|
3358
|
+
R(),
|
|
3372
3359
|
ne(!1)
|
|
3373
|
-
), l =
|
|
3360
|
+
), l = j([
|
|
3374
3361
|
u,
|
|
3375
3362
|
this.isScrolling$
|
|
3376
3363
|
]).pipe(
|
|
3377
3364
|
S(
|
|
3378
|
-
([d,
|
|
3365
|
+
([d, g]) => d || g
|
|
3379
3366
|
),
|
|
3380
3367
|
J(1)
|
|
3381
3368
|
);
|
|
3382
3369
|
this.userScroll$ = this.watch("element").pipe(
|
|
3383
|
-
|
|
3370
|
+
C(Z),
|
|
3384
3371
|
w(
|
|
3385
3372
|
(d) => t.watch(["computedPageTurnMode"]).pipe(
|
|
3386
3373
|
w(
|
|
3387
|
-
({ computedPageTurnMode:
|
|
3374
|
+
({ computedPageTurnMode: g }) => g === "controlled" ? he : X(d, "scroll").pipe(
|
|
3388
3375
|
z(l),
|
|
3389
|
-
|
|
3390
|
-
([,
|
|
3376
|
+
C(
|
|
3377
|
+
([, p]) => !p
|
|
3391
3378
|
),
|
|
3392
|
-
S(([
|
|
3379
|
+
S(([p]) => p)
|
|
3393
3380
|
)
|
|
3394
3381
|
)
|
|
3395
3382
|
)
|
|
3396
3383
|
),
|
|
3397
|
-
|
|
3398
|
-
), P(r, a, c).pipe(
|
|
3384
|
+
D()
|
|
3385
|
+
), P(r, a, c).pipe(T(this.destroy$)).subscribe();
|
|
3399
3386
|
}
|
|
3400
3387
|
update(e) {
|
|
3401
3388
|
this.mergeCompare(e);
|
|
@@ -3405,35 +3392,35 @@ class $o extends Q {
|
|
|
3405
3392
|
}
|
|
3406
3393
|
fromScrollPosition(e) {
|
|
3407
3394
|
const t = this.viewport.scaleFactor;
|
|
3408
|
-
return new
|
|
3395
|
+
return new ae({
|
|
3409
3396
|
x: e.x / t,
|
|
3410
3397
|
y: e.y / t
|
|
3411
3398
|
});
|
|
3412
3399
|
}
|
|
3413
3400
|
fromSpinePosition(e) {
|
|
3414
3401
|
const t = this.viewport.scaleFactor;
|
|
3415
|
-
return new
|
|
3402
|
+
return new mt({
|
|
3416
3403
|
x: e.x * t,
|
|
3417
3404
|
y: e.y * t
|
|
3418
3405
|
});
|
|
3419
3406
|
}
|
|
3420
3407
|
get scrollPosition() {
|
|
3421
3408
|
const e = this.value.element;
|
|
3422
|
-
return new
|
|
3409
|
+
return new mt({
|
|
3423
3410
|
x: e?.scrollLeft ?? 0,
|
|
3424
3411
|
y: e?.scrollTop ?? 0
|
|
3425
3412
|
});
|
|
3426
3413
|
}
|
|
3427
3414
|
}
|
|
3428
3415
|
const To = (n, e, t, i, o) => {
|
|
3429
|
-
const s = n.clientWidth, r = n.clientHeight, a = n.scrollLeft, c = n.scrollTop, u = a + s / 2 - i, l = c + r / 2 - o, d = t / e,
|
|
3416
|
+
const s = n.clientWidth, r = n.clientHeight, a = n.scrollLeft, c = n.scrollTop, u = a + s / 2 - i, l = c + r / 2 - o, d = t / e, g = u * d, p = l * d, h = g - s / 2 + i, m = p - r / 2 + o;
|
|
3430
3417
|
return new xo({
|
|
3431
3418
|
x: h,
|
|
3432
3419
|
y: m
|
|
3433
3420
|
});
|
|
3434
3421
|
}, Fo = (n, e) => {
|
|
3435
3422
|
const t = e.viewport, i = e.navigation.scrollNavigationController, o = t.value.element, s = i.value.element, r = i.value.element, a = Math.round(t.scaleFactor * 100) / 100, c = o.offsetLeft, u = o.offsetTop, l = To(
|
|
3436
|
-
s ??
|
|
3423
|
+
s ?? An(),
|
|
3437
3424
|
a,
|
|
3438
3425
|
n,
|
|
3439
3426
|
c,
|
|
@@ -3443,11 +3430,11 @@ const To = (n, e, t, i, o) => {
|
|
|
3443
3430
|
`data-${W}-zooming-direction`,
|
|
3444
3431
|
d
|
|
3445
3432
|
), n < 1 ? o.style.transformOrigin = "top" : n > 1 && (o.style.transformOrigin = `${c}px ${u}px`), o.style.transform = `scale(${n})`;
|
|
3446
|
-
const
|
|
3433
|
+
const g = i.fromScrollPosition(
|
|
3447
3434
|
l
|
|
3448
3435
|
);
|
|
3449
3436
|
e.navigation.navigate({
|
|
3450
|
-
position:
|
|
3437
|
+
position: g
|
|
3451
3438
|
});
|
|
3452
3439
|
}, we = 200;
|
|
3453
3440
|
class Lo extends Q {
|
|
@@ -3456,7 +3443,7 @@ class Lo extends Q {
|
|
|
3456
3443
|
isZooming: !1,
|
|
3457
3444
|
currentScale: 1,
|
|
3458
3445
|
currentPosition: { x: 0, y: 0 }
|
|
3459
|
-
}), this.reader = e, this.enterSubject = new
|
|
3446
|
+
}), this.reader = e, this.enterSubject = new N(), this.exitSubject = new N();
|
|
3460
3447
|
const t = this.enterSubject.pipe(
|
|
3461
3448
|
w((o) => {
|
|
3462
3449
|
const { scale: s = 1, animate: r = !1 } = o ?? {}, a = this.reader.viewport.value.element;
|
|
@@ -3494,11 +3481,11 @@ class Lo extends Q {
|
|
|
3494
3481
|
const r = this.reader.viewport.value.element;
|
|
3495
3482
|
r.style.transformOrigin = "", r.style.transition = "", this.isControlled && this.reader.layout();
|
|
3496
3483
|
}),
|
|
3497
|
-
|
|
3484
|
+
T(this.enterSubject)
|
|
3498
3485
|
);
|
|
3499
3486
|
})
|
|
3500
3487
|
);
|
|
3501
|
-
P(t, i).pipe(
|
|
3488
|
+
P(t, i).pipe(T(this.destroy$)).subscribe();
|
|
3502
3489
|
}
|
|
3503
3490
|
enter(e) {
|
|
3504
3491
|
this.enterSubject.next(e);
|
|
@@ -3508,14 +3495,14 @@ class Lo extends Q {
|
|
|
3508
3495
|
}
|
|
3509
3496
|
move(e, t) {
|
|
3510
3497
|
this.isControlled && (this.viewport.element.style.transition = "", this.updateZoom(this.value.currentScale, e, {
|
|
3511
|
-
constraints: t?.constrain === "within-viewport" ? (...i) =>
|
|
3498
|
+
constraints: t?.constrain === "within-viewport" ? (...i) => ht(...i, this.reader.viewport) : void 0
|
|
3512
3499
|
}));
|
|
3513
3500
|
}
|
|
3514
3501
|
scaleAt(e, t) {
|
|
3515
3502
|
this.viewport.element.style.transition = "";
|
|
3516
3503
|
const o = Math.ceil(e * 100) / 100;
|
|
3517
3504
|
this.updateZoom(o, void 0, {
|
|
3518
|
-
constraints: t?.constrain === "within-viewport" ? (...s) =>
|
|
3505
|
+
constraints: t?.constrain === "within-viewport" ? (...s) => ht(...s, this.reader.viewport) : void 0
|
|
3519
3506
|
});
|
|
3520
3507
|
}
|
|
3521
3508
|
updateZoom(e, t, i) {
|
|
@@ -3552,11 +3539,11 @@ class Lo extends Q {
|
|
|
3552
3539
|
return this.reader.viewport.value;
|
|
3553
3540
|
}
|
|
3554
3541
|
}
|
|
3555
|
-
const
|
|
3542
|
+
const ft = `${Vt}-enhancer-zoom`, Mo = (n) => (e) => {
|
|
3556
3543
|
const t = n(e), i = new Lo(t);
|
|
3557
|
-
Ce(document,
|
|
3544
|
+
Ce(document, ft, vo);
|
|
3558
3545
|
const o = () => {
|
|
3559
|
-
Ee(document,
|
|
3546
|
+
Ee(document, ft), i.destroy(), t.destroy();
|
|
3560
3547
|
}, s = i;
|
|
3561
3548
|
return {
|
|
3562
3549
|
...t,
|
|
@@ -3572,16 +3559,16 @@ const yt = `${Ut}-enhancer-zoom`, Mo = (n) => (e) => {
|
|
|
3572
3559
|
}
|
|
3573
3560
|
}
|
|
3574
3561
|
};
|
|
3575
|
-
},
|
|
3562
|
+
}, Bt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
|
|
3576
3563
|
class Co {
|
|
3577
3564
|
constructor() {
|
|
3578
|
-
this.navigationSubject = new ot(1), this.viewportStateSubject = new
|
|
3579
|
-
|
|
3580
|
-
|
|
3565
|
+
this.navigationSubject = new ot(1), this.viewportStateSubject = new q("free"), this.paginationSubject = new ot(), this.navigationIsLockedSubject = new q(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
|
|
3566
|
+
R(),
|
|
3567
|
+
C((e) => !e)
|
|
3581
3568
|
), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
|
|
3582
|
-
|
|
3569
|
+
C((e) => e === "free")
|
|
3583
3570
|
), this.viewportBusy$ = this.viewportState$.pipe(
|
|
3584
|
-
|
|
3571
|
+
C((e) => e === "busy")
|
|
3585
3572
|
), this.navigation$ = this.navigationSubject.asObservable();
|
|
3586
3573
|
}
|
|
3587
3574
|
}
|
|
@@ -3591,8 +3578,8 @@ class Eo extends Q {
|
|
|
3591
3578
|
assumedRenditionLayout: "reflowable"
|
|
3592
3579
|
}), this.bridgeEvent = new Co(), this.manifest$ = this.pipe(
|
|
3593
3580
|
ie((e) => e.manifest),
|
|
3594
|
-
|
|
3595
|
-
|
|
3581
|
+
pe(Z),
|
|
3582
|
+
be()
|
|
3596
3583
|
), this.isRTL = () => this.value.manifest?.readingDirection === "rtl";
|
|
3597
3584
|
}
|
|
3598
3585
|
update(e) {
|
|
@@ -3600,7 +3587,7 @@ class Eo extends Q {
|
|
|
3600
3587
|
...t,
|
|
3601
3588
|
...e,
|
|
3602
3589
|
...e.manifest && {
|
|
3603
|
-
isFullyPrePaginated:
|
|
3590
|
+
isFullyPrePaginated: Bt(i),
|
|
3604
3591
|
assumedRenditionLayout: i?.renditionLayout ?? "reflowable"
|
|
3605
3592
|
}
|
|
3606
3593
|
};
|
|
@@ -3620,7 +3607,7 @@ class Do extends Q {
|
|
|
3620
3607
|
supportedPageTurnMode: ["controlled", "scrollable"],
|
|
3621
3608
|
supportedPageTurnDirection: ["horizontal", "vertical"],
|
|
3622
3609
|
supportedComputedPageTurnDirection: ["horizontal", "vertical"]
|
|
3623
|
-
}),
|
|
3610
|
+
}), j([
|
|
3624
3611
|
e.watch(["manifest", "hasVerticalWriting"]),
|
|
3625
3612
|
t.watch(["computedPageTurnMode"])
|
|
3626
3613
|
]).pipe(
|
|
@@ -3630,7 +3617,7 @@ class Do extends Q {
|
|
|
3630
3617
|
renditionLayout: i?.renditionLayout,
|
|
3631
3618
|
computedPageTurnMode: s
|
|
3632
3619
|
})),
|
|
3633
|
-
|
|
3620
|
+
R(O),
|
|
3634
3621
|
S(
|
|
3635
3622
|
({
|
|
3636
3623
|
hasVerticalWriting: i,
|
|
@@ -3644,11 +3631,11 @@ class Do extends Q {
|
|
|
3644
3631
|
supportedPageTurnDirection: r === "scrollable" ? ["vertical"] : s === "reflowable" ? ["horizontal"] : ["horizontal", "vertical"]
|
|
3645
3632
|
})
|
|
3646
3633
|
),
|
|
3647
|
-
|
|
3634
|
+
T(this.destroy$)
|
|
3648
3635
|
).subscribe(this.next.bind(this));
|
|
3649
3636
|
}
|
|
3650
3637
|
}
|
|
3651
|
-
class
|
|
3638
|
+
class Ao {
|
|
3652
3639
|
constructor() {
|
|
3653
3640
|
this._hooks = [], this._hookExecutions = [];
|
|
3654
3641
|
}
|
|
@@ -3679,8 +3666,8 @@ class Ro {
|
|
|
3679
3666
|
(r) => e === r.name
|
|
3680
3667
|
).map((r) => {
|
|
3681
3668
|
let a = () => v(void 0);
|
|
3682
|
-
const c = new
|
|
3683
|
-
a =
|
|
3669
|
+
const c = new N(), u = (g) => {
|
|
3670
|
+
a = g;
|
|
3684
3671
|
}, l = () => (c.next(), c.complete(), a() ?? v(void 0)), d = r.runFn({
|
|
3685
3672
|
// biome-ignore lint/suspicious/noExplicitAny: TODO
|
|
3686
3673
|
...i,
|
|
@@ -3707,26 +3694,26 @@ class Ro {
|
|
|
3707
3694
|
(r) => !o.includes(r)
|
|
3708
3695
|
);
|
|
3709
3696
|
const s = o.map(({ destroyFn: r }) => r());
|
|
3710
|
-
return
|
|
3697
|
+
return j(s);
|
|
3711
3698
|
}
|
|
3712
3699
|
}
|
|
3713
|
-
const
|
|
3700
|
+
const No = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position:relative;overflow-y:scroll;overflow-x:hidden}[data-prose-reader-viewport]{background-color:#fff;position:relative;height:100%;width:100%}", Ro = (n) => ({
|
|
3714
3701
|
x: -n.x,
|
|
3715
3702
|
y: -n.y
|
|
3716
|
-
}), Oo = (n) => n instanceof DOMMatrix ? new
|
|
3703
|
+
}), Oo = (n) => n instanceof DOMMatrix ? new M({
|
|
3717
3704
|
x: -n.e,
|
|
3718
3705
|
y: -n.f
|
|
3719
|
-
}) : new
|
|
3706
|
+
}) : new M({
|
|
3720
3707
|
x: -n.x,
|
|
3721
3708
|
y: -n.y
|
|
3722
|
-
}), Vo = "navigation/ViewportNavigator",
|
|
3709
|
+
}), Vo = "navigation/ViewportNavigator", yt = A.namespace(Vo);
|
|
3723
3710
|
class jo extends G {
|
|
3724
3711
|
constructor(e, t, i, o, s) {
|
|
3725
|
-
super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new
|
|
3712
|
+
super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new N(), this.element$ = new q(
|
|
3726
3713
|
document.createElement("div")
|
|
3727
3714
|
);
|
|
3728
3715
|
const r = this.spine.element$.pipe(
|
|
3729
|
-
|
|
3716
|
+
C(Z),
|
|
3730
3717
|
z(this.element$),
|
|
3731
3718
|
x(([l, d]) => {
|
|
3732
3719
|
d.style.cssText = `
|
|
@@ -3739,7 +3726,7 @@ class jo extends G {
|
|
|
3739
3726
|
"computedPageTurnDirection",
|
|
3740
3727
|
"computedPageTurnMode",
|
|
3741
3728
|
"numberOfAdjacentSpineItemToPreLoad"
|
|
3742
|
-
]), c =
|
|
3729
|
+
]), c = j([
|
|
3743
3730
|
a,
|
|
3744
3731
|
this.element$
|
|
3745
3732
|
]).pipe(
|
|
@@ -3749,13 +3736,13 @@ class jo extends G {
|
|
|
3749
3736
|
);
|
|
3750
3737
|
this.layout$ = c.pipe(
|
|
3751
3738
|
x(() => {
|
|
3752
|
-
|
|
3739
|
+
yt.info("layout", e.values);
|
|
3753
3740
|
}),
|
|
3754
|
-
|
|
3741
|
+
D()
|
|
3755
3742
|
);
|
|
3756
3743
|
const u = this.navigateSubject.pipe(
|
|
3757
3744
|
x((l) => {
|
|
3758
|
-
|
|
3745
|
+
yt.info("Navigation requested", l);
|
|
3759
3746
|
})
|
|
3760
3747
|
);
|
|
3761
3748
|
this.isNavigating$ = u.pipe(
|
|
@@ -3772,7 +3759,7 @@ class jo extends G {
|
|
|
3772
3759
|
v(null).pipe(
|
|
3773
3760
|
ge(() => {
|
|
3774
3761
|
if (l?.type !== "manualAdjust") return v(!1);
|
|
3775
|
-
const
|
|
3762
|
+
const g = l.animation === "snap" ? e.values.snapAnimationDuration : e.values.computedPageTurnAnimationDuration, p = l.animation === "snap" ? "slide" : e.values.computedPageTurnAnimation;
|
|
3776
3763
|
return v(l).pipe(
|
|
3777
3764
|
/**
|
|
3778
3765
|
* @important
|
|
@@ -3782,15 +3769,15 @@ class jo extends G {
|
|
|
3782
3769
|
* anything for x ms while we effectively adjust. We want it to be immediate.
|
|
3783
3770
|
* However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
|
|
3784
3771
|
*/
|
|
3785
|
-
l.shouldAnimate ? Pe(1,
|
|
3772
|
+
l.shouldAnimate ? Pe(1, re) : xe,
|
|
3786
3773
|
x((h) => {
|
|
3787
3774
|
const m = this.element$.getValue();
|
|
3788
|
-
h.shouldAnimate ?
|
|
3775
|
+
h.shouldAnimate ? p === "fade" ? (m.style.setProperty(
|
|
3789
3776
|
"transition",
|
|
3790
|
-
`opacity ${
|
|
3791
|
-
), m.style.setProperty("opacity", "0")) : (l.animation === "snap" ||
|
|
3777
|
+
`opacity ${g / 2}ms`
|
|
3778
|
+
), m.style.setProperty("opacity", "0")) : (l.animation === "snap" || p === "slide") && (m.style.setProperty(
|
|
3792
3779
|
"transition",
|
|
3793
|
-
`transform ${
|
|
3780
|
+
`transform ${g}ms`
|
|
3794
3781
|
), m.style.setProperty("opacity", "1")) : (m.style.setProperty("transition", "none"), m.style.setProperty("opacity", "1"));
|
|
3795
3782
|
}),
|
|
3796
3783
|
/**
|
|
@@ -3802,16 +3789,16 @@ class jo extends G {
|
|
|
3802
3789
|
* not the value set by `setProperty`
|
|
3803
3790
|
*/
|
|
3804
3791
|
x((h) => {
|
|
3805
|
-
|
|
3792
|
+
p !== "fade" && this.setViewportPosition(h.position);
|
|
3806
3793
|
}),
|
|
3807
|
-
l.shouldAnimate ? Pe(
|
|
3794
|
+
l.shouldAnimate ? Pe(g / 2, re) : xe,
|
|
3808
3795
|
x((h) => {
|
|
3809
3796
|
const m = this.element$.getValue();
|
|
3810
|
-
|
|
3797
|
+
p === "fade" && (this.setViewportPosition(h.position), m.style.setProperty("opacity", "1"));
|
|
3811
3798
|
}),
|
|
3812
|
-
l.shouldAnimate ? Pe(
|
|
3799
|
+
l.shouldAnimate ? Pe(g / 2, re) : xe,
|
|
3813
3800
|
x((h) => {
|
|
3814
|
-
|
|
3801
|
+
p === "fade" && this.setViewportPosition(h.position);
|
|
3815
3802
|
})
|
|
3816
3803
|
);
|
|
3817
3804
|
}),
|
|
@@ -3821,7 +3808,7 @@ class jo extends G {
|
|
|
3821
3808
|
}),
|
|
3822
3809
|
ne(!1),
|
|
3823
3810
|
J(1)
|
|
3824
|
-
), P(r, this.isNavigating$, this.layout$).pipe(
|
|
3811
|
+
), P(r, this.isNavigating$, this.layout$).pipe(T(this.destroy$)).subscribe();
|
|
3825
3812
|
}
|
|
3826
3813
|
/**
|
|
3827
3814
|
* Programmatically set the viewport position.
|
|
@@ -3832,7 +3819,7 @@ class jo extends G {
|
|
|
3832
3819
|
* for remark about flicker / fonts smoothing
|
|
3833
3820
|
*/
|
|
3834
3821
|
setViewportPosition(e) {
|
|
3835
|
-
const t = this.element$.getValue(), i =
|
|
3822
|
+
const t = this.element$.getValue(), i = Ro(e);
|
|
3836
3823
|
t.style.transform = `translate(${i.x}px, ${i.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
|
|
3837
3824
|
}
|
|
3838
3825
|
navigate(e) {
|
|
@@ -3845,7 +3832,7 @@ class jo extends G {
|
|
|
3845
3832
|
get viewportPosition() {
|
|
3846
3833
|
const e = this.element$.getValue(), t = window.getComputedStyle(e), i = t.transform || t.webkitTransform;
|
|
3847
3834
|
if (!i || i === "none")
|
|
3848
|
-
return new
|
|
3835
|
+
return new M({ x: 0, y: 0 });
|
|
3849
3836
|
const o = new DOMMatrix(i);
|
|
3850
3837
|
return Oo(o);
|
|
3851
3838
|
}
|
|
@@ -3860,7 +3847,7 @@ const ko = () => (n) => n.pipe(
|
|
|
3860
3847
|
}))
|
|
3861
3848
|
), Uo = (n, e, t) => n.bridgeEvent.pagination$.pipe(
|
|
3862
3849
|
z(e),
|
|
3863
|
-
|
|
3850
|
+
C(
|
|
3864
3851
|
([i, o]) => i.navigationId === o.id
|
|
3865
3852
|
),
|
|
3866
3853
|
/**
|
|
@@ -3868,15 +3855,15 @@ const ko = () => (n) => n.pipe(
|
|
|
3868
3855
|
* Otherwise we might save something incomplete and thus restore
|
|
3869
3856
|
* the user to an invalid location.
|
|
3870
3857
|
*/
|
|
3871
|
-
w(([i, o]) => (t.spineItemsManager.get(o.spineItem)?.isReady$.pipe(
|
|
3872
|
-
|
|
3858
|
+
w(([i, o]) => (t.spineItemsManager.get(o.spineItem)?.isReady$.pipe(U()) ?? v(!1)).pipe(
|
|
3859
|
+
C((r) => r),
|
|
3873
3860
|
S(() => ({
|
|
3874
3861
|
pagination: i,
|
|
3875
3862
|
navigation: o
|
|
3876
3863
|
}))
|
|
3877
3864
|
)),
|
|
3878
3865
|
ko(),
|
|
3879
|
-
|
|
3866
|
+
R(
|
|
3880
3867
|
(i, o) => i.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
|
|
3881
3868
|
),
|
|
3882
3869
|
S(
|
|
@@ -3995,7 +3982,7 @@ const ko = () => (n) => n.pipe(
|
|
|
3995
3982
|
},
|
|
3996
3983
|
...s
|
|
3997
3984
|
};
|
|
3998
|
-
const a = e.getNavigationForSpineIndexOrId(r), c = t.values.computedPageTurnMode === "scrollable" ? new
|
|
3985
|
+
const a = e.getNavigationForSpineIndexOrId(r), c = t.values.computedPageTurnMode === "scrollable" ? new ae({
|
|
3999
3986
|
x: a.x + s.previousNavigation.position.x,
|
|
4000
3987
|
y: a.y
|
|
4001
3988
|
}) : e.fromUnboundSpinePosition(a);
|
|
@@ -4007,7 +3994,7 @@ const ko = () => (n) => n.pipe(
|
|
|
4007
3994
|
...s
|
|
4008
3995
|
};
|
|
4009
3996
|
})
|
|
4010
|
-
),
|
|
3997
|
+
), St = ({
|
|
4011
3998
|
settings: n,
|
|
4012
3999
|
spineItemsManager: e,
|
|
4013
4000
|
navigationResolver: t,
|
|
@@ -4019,23 +4006,23 @@ const ko = () => (n) => n.pipe(
|
|
|
4019
4006
|
spineItem: c,
|
|
4020
4007
|
cfi: u,
|
|
4021
4008
|
directionFromLastNavigation: l
|
|
4022
|
-
} = r, { navigationSnapThreshold: d, computedPageTurnMode:
|
|
4009
|
+
} = r, { navigationSnapThreshold: d, computedPageTurnMode: g } = n.values;
|
|
4023
4010
|
if (c !== void 0) {
|
|
4024
|
-
const
|
|
4025
|
-
if (
|
|
4011
|
+
const p = e.get(c);
|
|
4012
|
+
if (p) return p;
|
|
4026
4013
|
}
|
|
4027
4014
|
if (typeof c == "number")
|
|
4028
4015
|
return c > e.items.length - 1 ? e.get(e.items.length - 1) : e.get(0);
|
|
4029
4016
|
if (u) {
|
|
4030
|
-
const
|
|
4031
|
-
if (
|
|
4017
|
+
const p = e.getSpineItemFromCfi(u);
|
|
4018
|
+
if (p) return p;
|
|
4032
4019
|
}
|
|
4033
|
-
if (a &&
|
|
4034
|
-
const { beginIndex:
|
|
4020
|
+
if (a && g === "controlled") {
|
|
4021
|
+
const { beginIndex: p, endIndex: h } = i.getVisibleSpineItemsFromPosition({
|
|
4035
4022
|
position: a,
|
|
4036
4023
|
threshold: d,
|
|
4037
4024
|
restrictToScreen: !1
|
|
4038
|
-
}) ?? {}, m = (l === "forward" || l === "anchor" ? h :
|
|
4025
|
+
}) ?? {}, m = (l === "forward" || l === "anchor" ? h : p) ?? p, y = e.get(m);
|
|
4039
4026
|
if (!y) return;
|
|
4040
4027
|
const { endPageIndex: f, beginPageIndex: I } = i.getVisiblePagesFromViewportPosition({
|
|
4041
4028
|
position: a,
|
|
@@ -4045,14 +4032,14 @@ const ko = () => (n) => n.pipe(
|
|
|
4045
4032
|
}) ?? {}, b = (l === "forward" || l === "anchor" ? f : I) ?? 0, F = t.getNavigationForSpineItemPage({
|
|
4046
4033
|
pageIndex: b,
|
|
4047
4034
|
spineItemId: y
|
|
4048
|
-
}),
|
|
4035
|
+
}), $ = i.getVisibleSpineItemsFromPosition({
|
|
4049
4036
|
position: F,
|
|
4050
4037
|
threshold: d,
|
|
4051
4038
|
restrictToScreen: !1
|
|
4052
|
-
}),
|
|
4053
|
-
return e.get(
|
|
4039
|
+
}), L = l === "forward" || l === "anchor" ? $?.beginIndex : $?.endIndex;
|
|
4040
|
+
return e.get(L);
|
|
4054
4041
|
}
|
|
4055
|
-
return a &&
|
|
4042
|
+
return a && g === "scrollable" ? i.getSpineItemFromPosition(a) : e.get(0);
|
|
4056
4043
|
};
|
|
4057
4044
|
return o.pipe(
|
|
4058
4045
|
S(({ navigation: r, ...a }) => {
|
|
@@ -4066,13 +4053,13 @@ const ko = () => (n) => n.pipe(
|
|
|
4066
4053
|
};
|
|
4067
4054
|
})
|
|
4068
4055
|
);
|
|
4069
|
-
},
|
|
4056
|
+
}, It = ({ spine: n }) => (e) => e.pipe(
|
|
4070
4057
|
w(({ navigation: t, ...i }) => {
|
|
4071
4058
|
const o = n.getSpineItemSpineLayoutInfo(
|
|
4072
4059
|
t.spineItem
|
|
4073
4060
|
), s = n.spineItemsManager.get(t.spineItem);
|
|
4074
4061
|
return (s?.isReady$ ?? v(!1)).pipe(
|
|
4075
|
-
|
|
4062
|
+
U(),
|
|
4076
4063
|
S(
|
|
4077
4064
|
(r) => ({
|
|
4078
4065
|
navigation: {
|
|
@@ -4089,7 +4076,7 @@ const ko = () => (n) => n.pipe(
|
|
|
4089
4076
|
)
|
|
4090
4077
|
);
|
|
4091
4078
|
})
|
|
4092
|
-
),
|
|
4079
|
+
), je = ({
|
|
4093
4080
|
settings: n,
|
|
4094
4081
|
spineItemsManager: e,
|
|
4095
4082
|
spineLocator: t,
|
|
@@ -4104,11 +4091,11 @@ const ko = () => (n) => n.pipe(
|
|
|
4104
4091
|
spineItem: u,
|
|
4105
4092
|
threshold: a,
|
|
4106
4093
|
restrictToScreen: !1
|
|
4107
|
-
}) ?? {},
|
|
4108
|
-
pageIndex:
|
|
4094
|
+
}) ?? {}, g = (r.directionFromLastNavigation === "forward" || r.directionFromLastNavigation === "anchor" ? l : d) ?? 0, p = i.getNavigationForSpineItemPage({
|
|
4095
|
+
pageIndex: g,
|
|
4109
4096
|
spineItemId: u
|
|
4110
4097
|
}), h = t.getVisiblePagesFromViewportPosition({
|
|
4111
|
-
position:
|
|
4098
|
+
position: p,
|
|
4112
4099
|
spineItem: u,
|
|
4113
4100
|
threshold: { type: "percentage", value: 0 },
|
|
4114
4101
|
restrictToScreen: !0
|
|
@@ -4152,11 +4139,11 @@ const ko = () => (n) => n.pipe(
|
|
|
4152
4139
|
return t;
|
|
4153
4140
|
})
|
|
4154
4141
|
);
|
|
4155
|
-
class
|
|
4142
|
+
class Xt {
|
|
4156
4143
|
constructor() {
|
|
4157
|
-
this.isLockedSubject = new
|
|
4144
|
+
this.isLockedSubject = new q(0), this.isLocked$ = this.isLockedSubject.pipe(
|
|
4158
4145
|
S((e) => !!e),
|
|
4159
|
-
|
|
4146
|
+
R()
|
|
4160
4147
|
);
|
|
4161
4148
|
}
|
|
4162
4149
|
lock() {
|
|
@@ -4175,7 +4162,7 @@ const Yo = ({
|
|
|
4175
4162
|
}) => {
|
|
4176
4163
|
const s = i.get(e.spineItem);
|
|
4177
4164
|
return s ? s.isReady$.pipe(
|
|
4178
|
-
|
|
4165
|
+
U(),
|
|
4179
4166
|
S((r) => {
|
|
4180
4167
|
const a = o.getSpineItemSpineLayoutInfo(s), c = n.isPositionWithinSpineItem(
|
|
4181
4168
|
e.position,
|
|
@@ -4184,45 +4171,45 @@ const Yo = ({
|
|
|
4184
4171
|
if (e.url !== void 0 && (u || l || // when spine item is ready dimensions may have not changed but the position
|
|
4185
4172
|
// of dom elements may have!
|
|
4186
4173
|
r && !e.spineItemIsReady)) {
|
|
4187
|
-
const
|
|
4174
|
+
const p = t.getNavigationForUrl(
|
|
4188
4175
|
e.url
|
|
4189
4176
|
);
|
|
4190
|
-
if (
|
|
4191
|
-
return
|
|
4177
|
+
if (p)
|
|
4178
|
+
return p.position;
|
|
4192
4179
|
}
|
|
4193
|
-
const
|
|
4194
|
-
if (
|
|
4180
|
+
const g = e.cfi ?? e.paginationBeginCfi;
|
|
4181
|
+
if (g !== void 0 && !Be(g) && (u || l || // when spine item is ready dimensions may have not changed but the position
|
|
4195
4182
|
// of dom elements may have!
|
|
4196
4183
|
r && !e.spineItemIsReady)) {
|
|
4197
|
-
const
|
|
4198
|
-
if (
|
|
4199
|
-
return
|
|
4184
|
+
const p = t.getNavigationForCfi(g);
|
|
4185
|
+
if (p)
|
|
4186
|
+
return p;
|
|
4200
4187
|
}
|
|
4201
4188
|
if (c && d && e.directionFromLastNavigation === "backward") {
|
|
4202
|
-
const
|
|
4189
|
+
const p = new E({
|
|
4203
4190
|
x: (e.positionInSpineItem?.x ?? 0) + u,
|
|
4204
4191
|
y: (e.positionInSpineItem?.y ?? 0) + l
|
|
4205
4192
|
});
|
|
4206
4193
|
return t.getNavigationFromSpineItemPosition({
|
|
4207
4194
|
spineItem: s,
|
|
4208
|
-
spineItemPosition:
|
|
4195
|
+
spineItemPosition: p
|
|
4209
4196
|
});
|
|
4210
4197
|
}
|
|
4211
4198
|
if (e.positionInSpineItem && e.spineItemHeight && e.spineItemWidth) {
|
|
4212
|
-
const
|
|
4199
|
+
const p = n.spineItemLocator.getSpineItemPageIndexFromPosition({
|
|
4213
4200
|
itemWidth: e.spineItemWidth,
|
|
4214
4201
|
itemHeight: e.spineItemHeight,
|
|
4215
4202
|
isUsingVerticalWriting: !!e.spineItemIsUsingVerticalWriting,
|
|
4216
4203
|
position: e.positionInSpineItem
|
|
4217
4204
|
});
|
|
4218
4205
|
return t.getNavigationForSpineItemPage({
|
|
4219
|
-
pageIndex:
|
|
4206
|
+
pageIndex: p,
|
|
4220
4207
|
spineItemId: s
|
|
4221
4208
|
});
|
|
4222
4209
|
}
|
|
4223
4210
|
return c ? t.getNavigationForPosition(e.position) : t.getNavigationForSpineIndexOrId(s);
|
|
4224
4211
|
})
|
|
4225
|
-
) : v(new
|
|
4212
|
+
) : v(new M({ x: 0, y: 0 }));
|
|
4226
4213
|
}, qo = ({
|
|
4227
4214
|
navigation: n,
|
|
4228
4215
|
spineLocator: e,
|
|
@@ -4232,11 +4219,11 @@ const Yo = ({
|
|
|
4232
4219
|
spine: s
|
|
4233
4220
|
}) => {
|
|
4234
4221
|
const { spineItem: r } = n, a = t.get(r);
|
|
4235
|
-
if (!a) return new
|
|
4222
|
+
if (!a) return new M({ x: 0, y: 0 });
|
|
4236
4223
|
const { height: c, top: u } = s.getSpineItemSpineLayoutInfo(a), l = e.isPositionWithinSpineItem(
|
|
4237
4224
|
n.position,
|
|
4238
4225
|
a
|
|
4239
|
-
), d = n.positionInSpineItem ?? new
|
|
4226
|
+
), d = n.positionInSpineItem ?? new E({
|
|
4240
4227
|
y: 0,
|
|
4241
4228
|
x: 0
|
|
4242
4229
|
});
|
|
@@ -4246,26 +4233,26 @@ const Yo = ({
|
|
|
4246
4233
|
if (u === n.spineItemTop && c === n.spineItemHeight && !l)
|
|
4247
4234
|
return o.getNavigationForSpineIndexOrId(a);
|
|
4248
4235
|
if (u !== n.spineItemTop) {
|
|
4249
|
-
const
|
|
4250
|
-
n.positionInSpineItem ?? new
|
|
4236
|
+
const g = e.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
|
|
4237
|
+
n.positionInSpineItem ?? new E({
|
|
4251
4238
|
x: 0,
|
|
4252
4239
|
y: 0
|
|
4253
4240
|
}),
|
|
4254
4241
|
a
|
|
4255
4242
|
);
|
|
4256
4243
|
return e.getSpinePositionFromSpineItemPosition({
|
|
4257
|
-
spineItemPosition:
|
|
4244
|
+
spineItemPosition: g,
|
|
4258
4245
|
spineItem: a
|
|
4259
4246
|
});
|
|
4260
4247
|
}
|
|
4261
4248
|
if (u === n.spineItemTop && c !== n.spineItemHeight) {
|
|
4262
|
-
const
|
|
4263
|
-
y: n.directionFromLastNavigation === "backward" ? c -
|
|
4249
|
+
const g = (n.spineItemHeight ?? d.y) - d.y, p = new E({
|
|
4250
|
+
y: n.directionFromLastNavigation === "backward" ? c - g : d.y,
|
|
4264
4251
|
x: n.position.x
|
|
4265
4252
|
});
|
|
4266
4253
|
if (l) {
|
|
4267
4254
|
const h = e.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
|
|
4268
|
-
|
|
4255
|
+
p,
|
|
4269
4256
|
a
|
|
4270
4257
|
);
|
|
4271
4258
|
return e.getSpinePositionFromSpineItemPosition({
|
|
@@ -4275,8 +4262,8 @@ const Yo = ({
|
|
|
4275
4262
|
}
|
|
4276
4263
|
if (!l) {
|
|
4277
4264
|
if (!(n.position.y < u)) {
|
|
4278
|
-
const m = new
|
|
4279
|
-
y: c -
|
|
4265
|
+
const m = new E({
|
|
4266
|
+
y: c - g,
|
|
4280
4267
|
x: n.position.x
|
|
4281
4268
|
});
|
|
4282
4269
|
return e.getSpinePositionFromSpineItemPosition({
|
|
@@ -4314,7 +4301,7 @@ const Yo = ({
|
|
|
4314
4301
|
navigationResolver: o,
|
|
4315
4302
|
spineItemsManager: e,
|
|
4316
4303
|
spine: s
|
|
4317
|
-
}),
|
|
4304
|
+
}), bt = ({
|
|
4318
4305
|
settings: n,
|
|
4319
4306
|
navigationResolver: e,
|
|
4320
4307
|
context: t,
|
|
@@ -4337,28 +4324,28 @@ const Yo = ({
|
|
|
4337
4324
|
}
|
|
4338
4325
|
}))
|
|
4339
4326
|
))
|
|
4340
|
-
), Zo = "navigation/InternalNavigator", Jo =
|
|
4327
|
+
), Zo = "navigation/InternalNavigator", Jo = A.namespace(Zo);
|
|
4341
4328
|
class Ko extends G {
|
|
4342
4329
|
constructor(e, t, i, o, s, r, a, c) {
|
|
4343
|
-
super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isRestorationLocked$ = c, this.navigationSubject = new
|
|
4330
|
+
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({
|
|
4344
4331
|
animation: !1,
|
|
4345
|
-
position: new
|
|
4332
|
+
position: new M({ x: 0, y: 0 }),
|
|
4346
4333
|
meta: {
|
|
4347
4334
|
triggeredBy: "user"
|
|
4348
4335
|
},
|
|
4349
4336
|
spineItemIsReady: !1,
|
|
4350
4337
|
type: "api",
|
|
4351
4338
|
id: /* @__PURE__ */ Symbol()
|
|
4352
|
-
}), this.navigated$ = this.navigationSubject.pipe(
|
|
4339
|
+
}), this.navigated$ = this.navigationSubject.pipe(Ft(1)), this.navigation$ = this.navigationSubject.pipe(
|
|
4353
4340
|
S(({ position: f, id: I }) => ({
|
|
4354
4341
|
position: f,
|
|
4355
4342
|
id: I
|
|
4356
4343
|
})),
|
|
4357
|
-
|
|
4358
|
-
({ position: f, ...I }, { position: b, ...F }) =>
|
|
4344
|
+
R(
|
|
4345
|
+
({ position: f, ...I }, { position: b, ...F }) => O(I, F) && O(f, b)
|
|
4359
4346
|
),
|
|
4360
4347
|
J(1)
|
|
4361
|
-
), this.locker = new
|
|
4348
|
+
), this.locker = new Xt();
|
|
4362
4349
|
const u = i.pipe(
|
|
4363
4350
|
z(this.navigationSubject),
|
|
4364
4351
|
zo({
|
|
@@ -4379,19 +4366,19 @@ class Ko extends G {
|
|
|
4379
4366
|
navigationResolver: r
|
|
4380
4367
|
}),
|
|
4381
4368
|
Ho({ context: t, settings: e }),
|
|
4382
|
-
|
|
4369
|
+
St({
|
|
4383
4370
|
navigationResolver: r,
|
|
4384
4371
|
settings: e,
|
|
4385
4372
|
spineItemsManager: a.spineItemsManager,
|
|
4386
4373
|
spineLocator: a.locator
|
|
4387
4374
|
}),
|
|
4388
|
-
|
|
4375
|
+
je({
|
|
4389
4376
|
navigationResolver: r,
|
|
4390
4377
|
settings: e,
|
|
4391
4378
|
spineItemsManager: a.spineItemsManager,
|
|
4392
4379
|
spineLocator: a.locator
|
|
4393
4380
|
}),
|
|
4394
|
-
|
|
4381
|
+
It({
|
|
4395
4382
|
spine: a
|
|
4396
4383
|
})
|
|
4397
4384
|
).pipe(
|
|
@@ -4404,7 +4391,7 @@ class Ko extends G {
|
|
|
4404
4391
|
w(([f, I]) => {
|
|
4405
4392
|
const b = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || I;
|
|
4406
4393
|
return v(f).pipe(
|
|
4407
|
-
b ? xe :
|
|
4394
|
+
b ? xe : bt({
|
|
4408
4395
|
navigationResolver: r,
|
|
4409
4396
|
settings: e,
|
|
4410
4397
|
spine: a,
|
|
@@ -4412,35 +4399,35 @@ class Ko extends G {
|
|
|
4412
4399
|
})
|
|
4413
4400
|
);
|
|
4414
4401
|
}),
|
|
4415
|
-
|
|
4402
|
+
je({
|
|
4416
4403
|
spineItemsManager: a.spineItemsManager,
|
|
4417
4404
|
spineLocator: a.locator,
|
|
4418
4405
|
settings: e,
|
|
4419
4406
|
navigationResolver: r
|
|
4420
4407
|
}),
|
|
4421
4408
|
S((f) => f.navigation),
|
|
4422
|
-
|
|
4409
|
+
D()
|
|
4423
4410
|
), l = u.pipe(
|
|
4424
4411
|
z(c),
|
|
4425
|
-
|
|
4412
|
+
C(([, f]) => f),
|
|
4426
4413
|
w(([f]) => {
|
|
4427
4414
|
const I = this.locker.lock();
|
|
4428
4415
|
return c.pipe(
|
|
4429
|
-
|
|
4430
|
-
|
|
4416
|
+
C((b) => !b),
|
|
4417
|
+
U(),
|
|
4431
4418
|
S(
|
|
4432
4419
|
() => ({
|
|
4433
4420
|
...f,
|
|
4434
4421
|
animation: "snap"
|
|
4435
4422
|
})
|
|
4436
4423
|
),
|
|
4437
|
-
|
|
4424
|
+
me(() => {
|
|
4438
4425
|
I();
|
|
4439
4426
|
}),
|
|
4440
|
-
|
|
4427
|
+
T(u)
|
|
4441
4428
|
);
|
|
4442
4429
|
}),
|
|
4443
|
-
|
|
4430
|
+
D()
|
|
4444
4431
|
), d = P(
|
|
4445
4432
|
o.layout$,
|
|
4446
4433
|
a.layout$
|
|
@@ -4448,8 +4435,8 @@ class Ko extends G {
|
|
|
4448
4435
|
w(() => v(null).pipe(
|
|
4449
4436
|
w(
|
|
4450
4437
|
() => c.pipe(
|
|
4451
|
-
|
|
4452
|
-
|
|
4438
|
+
C((f) => !f),
|
|
4439
|
+
U()
|
|
4453
4440
|
)
|
|
4454
4441
|
),
|
|
4455
4442
|
S(
|
|
@@ -4463,16 +4450,16 @@ class Ko extends G {
|
|
|
4463
4450
|
* another navigation. Whether it's user or internal, it means
|
|
4464
4451
|
* it has been controlled outside.
|
|
4465
4452
|
*/
|
|
4466
|
-
|
|
4453
|
+
T(
|
|
4467
4454
|
P(l, u)
|
|
4468
4455
|
)
|
|
4469
4456
|
))
|
|
4470
|
-
),
|
|
4457
|
+
), g = P(
|
|
4471
4458
|
d,
|
|
4472
4459
|
l
|
|
4473
4460
|
).pipe(
|
|
4474
4461
|
S((f) => ({ navigation: f })),
|
|
4475
|
-
|
|
4462
|
+
bt({
|
|
4476
4463
|
navigationResolver: r,
|
|
4477
4464
|
settings: e,
|
|
4478
4465
|
context: t,
|
|
@@ -4495,31 +4482,31 @@ class Ko extends G {
|
|
|
4495
4482
|
* eg: after the reader load and the user has never navigated
|
|
4496
4483
|
* yet.
|
|
4497
4484
|
*/
|
|
4498
|
-
|
|
4485
|
+
St({
|
|
4499
4486
|
navigationResolver: r,
|
|
4500
4487
|
settings: e,
|
|
4501
4488
|
spineItemsManager: a.spineItemsManager,
|
|
4502
4489
|
spineLocator: a.locator
|
|
4503
4490
|
}),
|
|
4504
|
-
|
|
4491
|
+
It({
|
|
4505
4492
|
spine: a
|
|
4506
4493
|
}),
|
|
4507
|
-
|
|
4494
|
+
je({
|
|
4508
4495
|
spineItemsManager: a.spineItemsManager,
|
|
4509
4496
|
spineLocator: a.locator,
|
|
4510
4497
|
settings: e,
|
|
4511
4498
|
navigationResolver: r
|
|
4512
4499
|
}),
|
|
4513
4500
|
S(({ navigation: f }) => f),
|
|
4514
|
-
|
|
4515
|
-
),
|
|
4501
|
+
D()
|
|
4502
|
+
), p = Uo(
|
|
4516
4503
|
t,
|
|
4517
4504
|
this.navigationSubject,
|
|
4518
4505
|
a
|
|
4519
4506
|
), h = P(
|
|
4520
|
-
|
|
4507
|
+
g,
|
|
4521
4508
|
u,
|
|
4522
|
-
|
|
4509
|
+
p
|
|
4523
4510
|
), m = (f) => f.pipe(
|
|
4524
4511
|
x(([I, b]) => {
|
|
4525
4512
|
Jo.info(
|
|
@@ -4532,11 +4519,11 @@ class Ko extends G {
|
|
|
4532
4519
|
})
|
|
4533
4520
|
), y = (f) => f.pipe(
|
|
4534
4521
|
x(([I, b]) => {
|
|
4535
|
-
const F = I.type === "scroll",
|
|
4522
|
+
const F = I.type === "scroll", $ = I.meta.triggeredBy === "pagination", L = I.meta.triggeredBy === "restoration", H = O(
|
|
4536
4523
|
b.position,
|
|
4537
4524
|
I.position
|
|
4538
4525
|
);
|
|
4539
|
-
if (F && !
|
|
4526
|
+
if (F && !L || $ || H)
|
|
4540
4527
|
return;
|
|
4541
4528
|
const B = {
|
|
4542
4529
|
position: I.position,
|
|
@@ -4549,7 +4536,7 @@ class Ko extends G {
|
|
|
4549
4536
|
* Explicitly trust the unbound position to be valid at this point.
|
|
4550
4537
|
* Thanks to consolidation and restoration.
|
|
4551
4538
|
*/
|
|
4552
|
-
position:
|
|
4539
|
+
position: M.from(B.position)
|
|
4553
4540
|
});
|
|
4554
4541
|
})
|
|
4555
4542
|
);
|
|
@@ -4564,7 +4551,7 @@ class Ko extends G {
|
|
|
4564
4551
|
*/
|
|
4565
4552
|
y,
|
|
4566
4553
|
m,
|
|
4567
|
-
|
|
4554
|
+
T(this.destroy$)
|
|
4568
4555
|
).subscribe();
|
|
4569
4556
|
}
|
|
4570
4557
|
get navigation() {
|
|
@@ -4574,20 +4561,20 @@ class Ko extends G {
|
|
|
4574
4561
|
const Fe = (n, e, t) => {
|
|
4575
4562
|
const i = t - n, o = t * (e * n) / (t || 1);
|
|
4576
4563
|
return Math.max(0, Math.min(i, o));
|
|
4577
|
-
},
|
|
4578
|
-
const i =
|
|
4564
|
+
}, Xe = (n, e) => (e || 0) === 0 || (n || 0) === 0 ? 1 : Math.floor(Math.max(1, n / e)), ke = (n, e, t) => {
|
|
4565
|
+
const i = Xe(t, e), o = [...Array(i)].map((s, r) => r * e);
|
|
4579
4566
|
return n >= i * e ? o[o.length - 1] || 0 : o.find((s) => n < s + e) || 0;
|
|
4580
|
-
},
|
|
4567
|
+
}, vt = (n, e, t) => {
|
|
4581
4568
|
const i = [...Array(t)].map((o, s) => s * e);
|
|
4582
4569
|
return n <= 0 || t === 0 ? 0 : n >= t * e ? t - 1 : i.findIndex((o) => n < o + e) ?? 0;
|
|
4583
4570
|
}, Qo = ({
|
|
4584
4571
|
itemWidth: n,
|
|
4585
4572
|
itemHeight: e,
|
|
4586
4573
|
spineItemPosition: t
|
|
4587
|
-
}) => new
|
|
4574
|
+
}) => new E({
|
|
4588
4575
|
x: Math.min(n, Math.max(0, t.x)),
|
|
4589
4576
|
y: Math.min(e, Math.max(0, t.y))
|
|
4590
|
-
}),
|
|
4577
|
+
}), Yt = ({
|
|
4591
4578
|
itemHeight: n,
|
|
4592
4579
|
itemWidth: e,
|
|
4593
4580
|
isUsingVerticalWriting: t,
|
|
@@ -4595,7 +4582,7 @@ const Fe = (n, e, t) => {
|
|
|
4595
4582
|
pageHeight: o,
|
|
4596
4583
|
pageTurnDirection: s,
|
|
4597
4584
|
pageTurnMode: r
|
|
4598
|
-
}) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ?
|
|
4585
|
+
}) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? Xe(n, o) : Xe(e, i), wt = ({
|
|
4599
4586
|
itemWidth: n,
|
|
4600
4587
|
itemHeight: e,
|
|
4601
4588
|
position: t,
|
|
@@ -4610,7 +4597,7 @@ const Fe = (n, e, t) => {
|
|
|
4610
4597
|
spineItemPosition: t,
|
|
4611
4598
|
itemHeight: e,
|
|
4612
4599
|
itemWidth: n
|
|
4613
|
-
}).x, d =
|
|
4600
|
+
}).x, d = Yt({
|
|
4614
4601
|
isUsingVerticalWriting: i,
|
|
4615
4602
|
itemHeight: e,
|
|
4616
4603
|
itemWidth: n,
|
|
@@ -4620,9 +4607,9 @@ const Fe = (n, e, t) => {
|
|
|
4620
4607
|
pageTurnMode: a
|
|
4621
4608
|
});
|
|
4622
4609
|
if (i)
|
|
4623
|
-
return
|
|
4624
|
-
const
|
|
4625
|
-
return c ? d - 1 -
|
|
4610
|
+
return vt(t.y, s, d);
|
|
4611
|
+
const g = vt(l, o, d);
|
|
4612
|
+
return c ? d - 1 - g : g;
|
|
4626
4613
|
}, es = ({
|
|
4627
4614
|
pageIndex: n,
|
|
4628
4615
|
itemLayout: e,
|
|
@@ -4636,7 +4623,7 @@ const Fe = (n, e, t) => {
|
|
|
4636
4623
|
n,
|
|
4637
4624
|
e.height
|
|
4638
4625
|
);
|
|
4639
|
-
return new
|
|
4626
|
+
return new E({
|
|
4640
4627
|
x: 0,
|
|
4641
4628
|
y: r
|
|
4642
4629
|
});
|
|
@@ -4646,14 +4633,14 @@ const Fe = (n, e, t) => {
|
|
|
4646
4633
|
n,
|
|
4647
4634
|
e.width
|
|
4648
4635
|
);
|
|
4649
|
-
return t.isRTL() ? new
|
|
4636
|
+
return t.isRTL() ? new E({
|
|
4650
4637
|
x: e.width - s - o.pageSize.width,
|
|
4651
4638
|
y: 0
|
|
4652
|
-
}) : new
|
|
4639
|
+
}) : new E({
|
|
4653
4640
|
x: s,
|
|
4654
4641
|
y: 0
|
|
4655
4642
|
});
|
|
4656
|
-
},
|
|
4643
|
+
}, qt = ({
|
|
4657
4644
|
context: n,
|
|
4658
4645
|
settings: e,
|
|
4659
4646
|
viewport: t
|
|
@@ -4661,14 +4648,14 @@ const Fe = (n, e, t) => {
|
|
|
4661
4648
|
const i = (a, c, u) => {
|
|
4662
4649
|
let l;
|
|
4663
4650
|
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);
|
|
4664
|
-
const d = u.
|
|
4651
|
+
const d = u.layoutInfo?.width || 0, g = t.pageSize.width;
|
|
4665
4652
|
if (l !== void 0) {
|
|
4666
|
-
const
|
|
4653
|
+
const p = ke(
|
|
4667
4654
|
l,
|
|
4668
|
-
|
|
4655
|
+
g,
|
|
4669
4656
|
d
|
|
4670
4657
|
);
|
|
4671
|
-
return new
|
|
4658
|
+
return new E({ x: p, y: 0 });
|
|
4672
4659
|
}
|
|
4673
4660
|
};
|
|
4674
4661
|
return {
|
|
@@ -4679,11 +4666,11 @@ const Fe = (n, e, t) => {
|
|
|
4679
4666
|
}) => es({
|
|
4680
4667
|
context: n,
|
|
4681
4668
|
isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
|
|
4682
|
-
itemLayout: c.
|
|
4669
|
+
itemLayout: c.layoutInfo,
|
|
4683
4670
|
pageIndex: a,
|
|
4684
4671
|
viewport: t
|
|
4685
4672
|
}),
|
|
4686
|
-
getSpineItemPageIndexFromPosition: (a) =>
|
|
4673
|
+
getSpineItemPageIndexFromPosition: (a) => wt({
|
|
4687
4674
|
...a,
|
|
4688
4675
|
isRTL: n.isRTL(),
|
|
4689
4676
|
pageWidth: t.pageSize.width,
|
|
@@ -4692,12 +4679,12 @@ const Fe = (n, e, t) => {
|
|
|
4692
4679
|
pageTurnMode: e.values.pageTurnMode
|
|
4693
4680
|
}),
|
|
4694
4681
|
getSpineItemPageIndexFromNode: (a, c, u) => {
|
|
4695
|
-
const l = i(a, c, u), { height: d, width:
|
|
4696
|
-
return l ?
|
|
4682
|
+
const l = i(a, c, u), { height: d, width: g } = u.layoutInfo;
|
|
4683
|
+
return l ? wt({
|
|
4697
4684
|
isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
|
|
4698
4685
|
position: l,
|
|
4699
4686
|
itemHeight: d,
|
|
4700
|
-
itemWidth:
|
|
4687
|
+
itemWidth: g,
|
|
4701
4688
|
isRTL: n.isRTL(),
|
|
4702
4689
|
pageWidth: t.pageSize.width,
|
|
4703
4690
|
pageHeight: t.pageSize.height,
|
|
@@ -4706,14 +4693,14 @@ const Fe = (n, e, t) => {
|
|
|
4706
4693
|
}) : void 0;
|
|
4707
4694
|
},
|
|
4708
4695
|
getSpineItemClosestPositionFromUnsafePosition: (a, c) => {
|
|
4709
|
-
const { width: u, height: l } = c.
|
|
4710
|
-
return new
|
|
4711
|
-
x:
|
|
4696
|
+
const { width: u, height: l } = c.layoutInfo;
|
|
4697
|
+
return new E({
|
|
4698
|
+
x: ke(
|
|
4712
4699
|
a.x,
|
|
4713
4700
|
t.pageSize.width,
|
|
4714
4701
|
u
|
|
4715
4702
|
),
|
|
4716
|
-
y:
|
|
4703
|
+
y: ke(
|
|
4717
4704
|
a.y,
|
|
4718
4705
|
t.pageSize.height,
|
|
4719
4706
|
l
|
|
@@ -4721,27 +4708,27 @@ const Fe = (n, e, t) => {
|
|
|
4721
4708
|
});
|
|
4722
4709
|
},
|
|
4723
4710
|
getSpineItemPagePositionFromSpineItemPosition: (a, c, u) => {
|
|
4724
|
-
const { width: l, height: d } = u.
|
|
4711
|
+
const { width: l, height: d } = u.layoutInfo, g = t.pageSize.width, p = t.pageSize.height;
|
|
4725
4712
|
if (!!u.isUsingVerticalWriting()) {
|
|
4726
4713
|
const y = Fe(
|
|
4727
|
-
|
|
4714
|
+
p,
|
|
4728
4715
|
c,
|
|
4729
4716
|
d
|
|
4730
4717
|
);
|
|
4731
|
-
return new
|
|
4718
|
+
return new Re({
|
|
4732
4719
|
x: a.x,
|
|
4733
4720
|
y: a.y - y
|
|
4734
4721
|
});
|
|
4735
4722
|
}
|
|
4736
|
-
const m = Fe(
|
|
4723
|
+
const m = Fe(g, c, l);
|
|
4737
4724
|
if (n.isRTL()) {
|
|
4738
|
-
const y = l - (c + 1) *
|
|
4739
|
-
return new
|
|
4725
|
+
const y = l - (c + 1) * g;
|
|
4726
|
+
return new Re({
|
|
4740
4727
|
x: a.x - Math.max(0, y),
|
|
4741
4728
|
y: a.y
|
|
4742
4729
|
});
|
|
4743
4730
|
}
|
|
4744
|
-
return new
|
|
4731
|
+
return new Re({
|
|
4745
4732
|
x: a.x - m,
|
|
4746
4733
|
y: a.y
|
|
4747
4734
|
});
|
|
@@ -4752,7 +4739,7 @@ const Fe = (n, e, t) => {
|
|
|
4752
4739
|
settings: e,
|
|
4753
4740
|
viewport: t
|
|
4754
4741
|
}) => {
|
|
4755
|
-
const i =
|
|
4742
|
+
const i = qt({
|
|
4756
4743
|
context: n,
|
|
4757
4744
|
settings: e,
|
|
4758
4745
|
viewport: t
|
|
@@ -4773,10 +4760,10 @@ const Fe = (n, e, t) => {
|
|
|
4773
4760
|
c,
|
|
4774
4761
|
u,
|
|
4775
4762
|
a
|
|
4776
|
-
) || new
|
|
4763
|
+
) || new E({ x: 0, y: 0 })
|
|
4777
4764
|
};
|
|
4778
4765
|
};
|
|
4779
|
-
function
|
|
4766
|
+
function Gt({
|
|
4780
4767
|
position: n,
|
|
4781
4768
|
isRTL: e,
|
|
4782
4769
|
spineItemsManager: t,
|
|
@@ -4789,19 +4776,19 @@ function Kt({
|
|
|
4789
4776
|
s || 0
|
|
4790
4777
|
), a = r.bottom - 1, c = Math.max(0, n.y), u = Math.min(c, a);
|
|
4791
4778
|
if (e) {
|
|
4792
|
-
const
|
|
4793
|
-
return new
|
|
4779
|
+
const p = Math.min(o, n.x), h = Math.max(p, r.left);
|
|
4780
|
+
return new M({
|
|
4794
4781
|
x: h,
|
|
4795
4782
|
y: u
|
|
4796
4783
|
});
|
|
4797
4784
|
}
|
|
4798
|
-
const l = r.right - 1, d = Math.max(0, n.x),
|
|
4799
|
-
return new
|
|
4800
|
-
x:
|
|
4785
|
+
const l = r.right - 1, d = Math.max(0, n.x), g = Math.min(d, l);
|
|
4786
|
+
return new M({
|
|
4787
|
+
x: g,
|
|
4801
4788
|
y: u
|
|
4802
4789
|
});
|
|
4803
4790
|
}
|
|
4804
|
-
const
|
|
4791
|
+
const Pt = ({
|
|
4805
4792
|
position: n,
|
|
4806
4793
|
isRTL: e,
|
|
4807
4794
|
pageSizeHeight: t,
|
|
@@ -4809,7 +4796,7 @@ const xt = ({
|
|
|
4809
4796
|
visibleAreaRectWidth: o,
|
|
4810
4797
|
spine: s
|
|
4811
4798
|
}) => {
|
|
4812
|
-
const r =
|
|
4799
|
+
const r = Gt({
|
|
4813
4800
|
position: n,
|
|
4814
4801
|
isRTL: e,
|
|
4815
4802
|
spineItemsManager: i,
|
|
@@ -4819,14 +4806,14 @@ const xt = ({
|
|
|
4819
4806
|
i.items.length - 1
|
|
4820
4807
|
), c = s.getSpineItemSpineLayoutInfo(a), u = c.bottom - t, l = Math.min(r.y, u);
|
|
4821
4808
|
if (e) {
|
|
4822
|
-
const
|
|
4823
|
-
return new
|
|
4824
|
-
x:
|
|
4809
|
+
const g = Math.min(0, r.x);
|
|
4810
|
+
return new M({
|
|
4811
|
+
x: g,
|
|
4825
4812
|
y: l
|
|
4826
4813
|
});
|
|
4827
4814
|
}
|
|
4828
4815
|
const d = c.right - o;
|
|
4829
|
-
return new
|
|
4816
|
+
return new M({
|
|
4830
4817
|
x: Math.min(r.x, d),
|
|
4831
4818
|
y: l
|
|
4832
4819
|
});
|
|
@@ -4836,8 +4823,8 @@ const xt = ({
|
|
|
4836
4823
|
visibleAreaRectWidth: i
|
|
4837
4824
|
}) => {
|
|
4838
4825
|
const s = n % i !== 0 ? n - t : n;
|
|
4839
|
-
return new
|
|
4840
|
-
},
|
|
4826
|
+
return new M({ x: s, y: e });
|
|
4827
|
+
}, Ye = ({
|
|
4841
4828
|
viewportPosition: n,
|
|
4842
4829
|
spineLocator: e,
|
|
4843
4830
|
spineItemNavigationResolver: t,
|
|
@@ -4861,7 +4848,7 @@ const xt = ({
|
|
|
4861
4848
|
visibleAreaRectWidth: i.absoluteViewport.width
|
|
4862
4849
|
});
|
|
4863
4850
|
}
|
|
4864
|
-
return new
|
|
4851
|
+
return new M({ x: 0, y: 0 });
|
|
4865
4852
|
}, ns = ({
|
|
4866
4853
|
pageIndex: n,
|
|
4867
4854
|
spineItemsManager: e,
|
|
@@ -4873,8 +4860,8 @@ const xt = ({
|
|
|
4873
4860
|
const r = e.get(t);
|
|
4874
4861
|
if (!r) {
|
|
4875
4862
|
const u = n * s.pageSize.width;
|
|
4876
|
-
return
|
|
4877
|
-
viewportPosition: new
|
|
4863
|
+
return Ye({
|
|
4864
|
+
viewportPosition: new M({ x: u, y: 0 }),
|
|
4878
4865
|
spineItemNavigationResolver: o,
|
|
4879
4866
|
spineLocator: i,
|
|
4880
4867
|
viewport: s
|
|
@@ -4919,7 +4906,7 @@ const xt = ({
|
|
|
4919
4906
|
spine: i
|
|
4920
4907
|
});
|
|
4921
4908
|
return t.getSpinePositionFromSpineItemPosition({
|
|
4922
|
-
spineItemPosition: new
|
|
4909
|
+
spineItemPosition: new E({ x: o, y: 0 }),
|
|
4923
4910
|
spineItem: e
|
|
4924
4911
|
});
|
|
4925
4912
|
}, rs = ({
|
|
@@ -5013,38 +5000,38 @@ const xt = ({
|
|
|
5013
5000
|
viewport: s
|
|
5014
5001
|
});
|
|
5015
5002
|
return {
|
|
5016
|
-
getNavigationForUrl: (
|
|
5003
|
+
getNavigationForUrl: (p) => as({
|
|
5017
5004
|
context: n,
|
|
5018
5005
|
spineItemsManager: e,
|
|
5019
5006
|
spineLocator: t,
|
|
5020
|
-
url:
|
|
5007
|
+
url: p,
|
|
5021
5008
|
pageSizeWidth: s.pageSize.width,
|
|
5022
5009
|
visibleAreaRectWidth: s.absoluteViewport.width,
|
|
5023
5010
|
spine: o
|
|
5024
5011
|
}),
|
|
5025
|
-
getNavigationForSpineItemPage: (
|
|
5026
|
-
...
|
|
5012
|
+
getNavigationForSpineItemPage: (p) => ns({
|
|
5013
|
+
...p,
|
|
5027
5014
|
spineItemsManager: e,
|
|
5028
5015
|
spineItemNavigationResolver: r,
|
|
5029
5016
|
spineLocator: t,
|
|
5030
5017
|
viewport: s
|
|
5031
5018
|
}),
|
|
5032
|
-
getNavigationFromSpineItemPosition: (
|
|
5033
|
-
...
|
|
5019
|
+
getNavigationFromSpineItemPosition: (p) => cs({
|
|
5020
|
+
...p,
|
|
5034
5021
|
spineItemLocator: t.spineItemLocator,
|
|
5035
5022
|
spineLocator: t,
|
|
5036
5023
|
viewport: s
|
|
5037
5024
|
}),
|
|
5038
|
-
getNavigationForCfi: (
|
|
5039
|
-
const h = e.getSpineItemFromCfi(
|
|
5040
|
-
cfi:
|
|
5025
|
+
getNavigationForCfi: (p) => {
|
|
5026
|
+
const h = e.getSpineItemFromCfi(p), { node: m, offset: y = 0 } = _t({
|
|
5027
|
+
cfi: p,
|
|
5041
5028
|
spineItemsManager: e
|
|
5042
5029
|
});
|
|
5043
5030
|
if (!h) {
|
|
5044
|
-
|
|
5031
|
+
A.warn(us, `unable to detect item id from cfi ${p}`);
|
|
5045
5032
|
return;
|
|
5046
5033
|
}
|
|
5047
|
-
const f = m ? r.getNavigationFromNode(h, m, y) : new
|
|
5034
|
+
const f = m ? r.getNavigationFromNode(h, m, y) : new E({ x: 0, y: 0 }), I = t.getSpinePositionFromSpineItemPosition({
|
|
5048
5035
|
spineItemPosition: f,
|
|
5049
5036
|
spineItem: h
|
|
5050
5037
|
});
|
|
@@ -5054,10 +5041,10 @@ const xt = ({
|
|
|
5054
5041
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
5055
5042
|
});
|
|
5056
5043
|
},
|
|
5057
|
-
getNavigationForLastPage: (
|
|
5058
|
-
const h = r.getNavigationForLastPage(
|
|
5044
|
+
getNavigationForLastPage: (p) => {
|
|
5045
|
+
const h = r.getNavigationForLastPage(p), m = t.getSpinePositionFromSpineItemPosition({
|
|
5059
5046
|
spineItemPosition: h,
|
|
5060
|
-
spineItem:
|
|
5047
|
+
spineItem: p
|
|
5061
5048
|
});
|
|
5062
5049
|
return te({
|
|
5063
5050
|
position: m,
|
|
@@ -5065,8 +5052,8 @@ const xt = ({
|
|
|
5065
5052
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
5066
5053
|
});
|
|
5067
5054
|
},
|
|
5068
|
-
getNavigationForSpineIndexOrId: (
|
|
5069
|
-
const h = e.get(
|
|
5055
|
+
getNavigationForSpineIndexOrId: (p) => {
|
|
5056
|
+
const h = e.get(p);
|
|
5070
5057
|
if (h) {
|
|
5071
5058
|
const m = t.getSpinePositionFromSpineItem(h);
|
|
5072
5059
|
return te({
|
|
@@ -5075,17 +5062,17 @@ const xt = ({
|
|
|
5075
5062
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
5076
5063
|
});
|
|
5077
5064
|
}
|
|
5078
|
-
return new
|
|
5065
|
+
return new M({ x: 0, y: 0 });
|
|
5079
5066
|
},
|
|
5080
|
-
getNavigationForPosition: (
|
|
5081
|
-
viewportPosition:
|
|
5067
|
+
getNavigationForPosition: (p) => Ye({
|
|
5068
|
+
viewportPosition: p,
|
|
5082
5069
|
spineItemNavigationResolver: r,
|
|
5083
5070
|
spineLocator: t,
|
|
5084
5071
|
viewport: s
|
|
5085
5072
|
}),
|
|
5086
|
-
getMostPredominantNavigationForPosition: (
|
|
5087
|
-
const h = i.values.computedPageTurnDirection, m = 0.5, y = h === "horizontal" ?
|
|
5088
|
-
position: new
|
|
5073
|
+
getMostPredominantNavigationForPosition: (p) => {
|
|
5074
|
+
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 = Pt({
|
|
5075
|
+
position: new M({
|
|
5089
5076
|
x: y,
|
|
5090
5077
|
y: f
|
|
5091
5078
|
}),
|
|
@@ -5095,32 +5082,32 @@ const xt = ({
|
|
|
5095
5082
|
spineItemsManager: e,
|
|
5096
5083
|
spine: o
|
|
5097
5084
|
});
|
|
5098
|
-
return
|
|
5085
|
+
return Ye({
|
|
5099
5086
|
spineItemNavigationResolver: r,
|
|
5100
5087
|
spineLocator: t,
|
|
5101
5088
|
viewportPosition: I,
|
|
5102
5089
|
viewport: s
|
|
5103
5090
|
});
|
|
5104
5091
|
},
|
|
5105
|
-
fromUnboundSpinePosition: (
|
|
5106
|
-
position:
|
|
5092
|
+
fromUnboundSpinePosition: (p) => Pt({
|
|
5093
|
+
position: p,
|
|
5107
5094
|
isRTL: n.isRTL(),
|
|
5108
5095
|
pageSizeHeight: s.pageSize.height,
|
|
5109
5096
|
visibleAreaRectWidth: s.absoluteViewport.width,
|
|
5110
5097
|
spineItemsManager: e,
|
|
5111
5098
|
spine: o
|
|
5112
5099
|
}),
|
|
5113
|
-
fromOutOfBoundsSpinePosition: (
|
|
5114
|
-
position:
|
|
5100
|
+
fromOutOfBoundsSpinePosition: (p) => Gt({
|
|
5101
|
+
position: p,
|
|
5115
5102
|
isRTL: n.isRTL(),
|
|
5116
5103
|
spineItemsManager: e,
|
|
5117
5104
|
spine: o,
|
|
5118
5105
|
viewportWidth: s.absoluteViewport.width
|
|
5119
5106
|
}),
|
|
5120
|
-
isNavigationGoingForwardFrom: (
|
|
5121
|
-
arePositionsDifferent: (
|
|
5122
|
-
getAdjustedPositionForSpread: (
|
|
5123
|
-
position:
|
|
5107
|
+
isNavigationGoingForwardFrom: (p, h) => i.values.computedPageTurnDirection === "vertical" ? p.y > h.y : p.x > h.x,
|
|
5108
|
+
arePositionsDifferent: (p, h) => p.x !== h.x || p.y !== h.y,
|
|
5109
|
+
getAdjustedPositionForSpread: (p) => te({
|
|
5110
|
+
position: p,
|
|
5124
5111
|
pageSizeWidth: s.pageSize.width,
|
|
5125
5112
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
5126
5113
|
}),
|
|
@@ -5134,7 +5121,7 @@ const xt = ({
|
|
|
5134
5121
|
settings: o,
|
|
5135
5122
|
viewport: s
|
|
5136
5123
|
}) => {
|
|
5137
|
-
const r = new
|
|
5124
|
+
const r = new N(), a = r.asObservable(), c = new Xt(), u = ls({
|
|
5138
5125
|
context: e,
|
|
5139
5126
|
settings: o,
|
|
5140
5127
|
spineItemsManager: n,
|
|
@@ -5153,7 +5140,7 @@ const xt = ({
|
|
|
5153
5140
|
t,
|
|
5154
5141
|
i,
|
|
5155
5142
|
e
|
|
5156
|
-
),
|
|
5143
|
+
), g = new Ko(
|
|
5157
5144
|
o,
|
|
5158
5145
|
e,
|
|
5159
5146
|
a,
|
|
@@ -5162,26 +5149,26 @@ const xt = ({
|
|
|
5162
5149
|
u,
|
|
5163
5150
|
i,
|
|
5164
5151
|
c.isLocked$
|
|
5165
|
-
),
|
|
5152
|
+
), p = j([
|
|
5166
5153
|
l.isNavigating$,
|
|
5167
5154
|
d.isNavigating$,
|
|
5168
5155
|
c.isLocked$,
|
|
5169
|
-
|
|
5156
|
+
g.locker.isLocked$
|
|
5170
5157
|
]).pipe(
|
|
5171
5158
|
ie((y) => y.some((f) => f) ? "busy" : "free"),
|
|
5172
|
-
|
|
5173
|
-
|
|
5159
|
+
be(),
|
|
5160
|
+
Ge(1)
|
|
5174
5161
|
);
|
|
5175
5162
|
return {
|
|
5176
5163
|
destroy: () => {
|
|
5177
|
-
l.destroy(),
|
|
5164
|
+
l.destroy(), g.destroy();
|
|
5178
5165
|
},
|
|
5179
|
-
getNavigation: () =>
|
|
5180
|
-
internalNavigator:
|
|
5166
|
+
getNavigation: () => g.navigation,
|
|
5167
|
+
internalNavigator: g,
|
|
5181
5168
|
scrollNavigationController: d,
|
|
5182
5169
|
controlledNavigationController: l,
|
|
5183
5170
|
locker: c,
|
|
5184
|
-
navigationState$:
|
|
5171
|
+
navigationState$: p,
|
|
5185
5172
|
navigate: (y) => {
|
|
5186
5173
|
r.next(y);
|
|
5187
5174
|
},
|
|
@@ -5193,7 +5180,7 @@ const xt = ({
|
|
|
5193
5180
|
return c.lock();
|
|
5194
5181
|
},
|
|
5195
5182
|
navigationResolver: u,
|
|
5196
|
-
navigation$:
|
|
5183
|
+
navigation$: g.navigation$
|
|
5197
5184
|
};
|
|
5198
5185
|
};
|
|
5199
5186
|
class ps extends Q {
|
|
@@ -5231,16 +5218,16 @@ class gs extends G {
|
|
|
5231
5218
|
threshold: { type: "percentage", value: 0.5 }
|
|
5232
5219
|
});
|
|
5233
5220
|
return this.context.bridgeEvent.navigationUnlocked$.pipe(
|
|
5234
|
-
|
|
5221
|
+
$t(1),
|
|
5235
5222
|
z(this.context.bridgeEvent.navigation$),
|
|
5236
5223
|
x(([, u]) => {
|
|
5237
5224
|
const { position: l } = u, d = this.pagination.value, {
|
|
5238
|
-
beginIndex:
|
|
5239
|
-
endIndex:
|
|
5225
|
+
beginIndex: g,
|
|
5226
|
+
endIndex: p
|
|
5240
5227
|
} = this.spine.locator.getVisibleSpineItemsFromPosition({
|
|
5241
5228
|
position: l,
|
|
5242
5229
|
threshold: { type: "percentage", value: 0.5 }
|
|
5243
|
-
}) ?? {}, h = this.spineItemsManager.get(
|
|
5230
|
+
}) ?? {}, h = this.spineItemsManager.get(g), m = this.spineItemsManager.get(p);
|
|
5244
5231
|
if (!h || !m) return;
|
|
5245
5232
|
const y = d.beginCfi, f = d.endCfi, { beginPageIndex: I = 0 } = c({
|
|
5246
5233
|
spineItem: h,
|
|
@@ -5248,16 +5235,16 @@ class gs extends G {
|
|
|
5248
5235
|
}) ?? {}, { endPageIndex: b = 0 } = c({
|
|
5249
5236
|
spineItem: m,
|
|
5250
5237
|
position: l
|
|
5251
|
-
}) ?? {}, F = y === void 0 ||
|
|
5238
|
+
}) ?? {}, F = y === void 0 || Be(y) || d.beginSpineItemIndex !== g, $ = d.endSpineItemIndex !== p || f === void 0 || Be(f), L = F ? de(h.item) : y, H = $ ? de(m.item) : f, B = h.numberOfPages, se = m.numberOfPages;
|
|
5252
5239
|
this.pagination.update({
|
|
5253
|
-
beginCfi:
|
|
5240
|
+
beginCfi: L,
|
|
5254
5241
|
beginNumberOfPagesInSpineItem: B,
|
|
5255
5242
|
beginPageIndexInSpineItem: I,
|
|
5256
|
-
beginSpineItemIndex:
|
|
5243
|
+
beginSpineItemIndex: g,
|
|
5257
5244
|
endCfi: H,
|
|
5258
|
-
endNumberOfPagesInSpineItem:
|
|
5245
|
+
endNumberOfPagesInSpineItem: se,
|
|
5259
5246
|
endPageIndexInSpineItem: b,
|
|
5260
|
-
endSpineItemIndex:
|
|
5247
|
+
endSpineItemIndex: p,
|
|
5261
5248
|
navigationId: u.id
|
|
5262
5249
|
});
|
|
5263
5250
|
})
|
|
@@ -5274,22 +5261,28 @@ class gs extends G {
|
|
|
5274
5261
|
} = this.pagination.value;
|
|
5275
5262
|
if (l === void 0 || d === void 0 || c === void 0 || u === void 0)
|
|
5276
5263
|
return;
|
|
5277
|
-
const
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5264
|
+
const g = this.spineItemsManager.get(c), p = this.spineItemsManager.get(u);
|
|
5265
|
+
if (g === void 0 || p === void 0) return;
|
|
5266
|
+
const h = this.spine.pages.fromSpineItemPageIndex(
|
|
5267
|
+
g,
|
|
5268
|
+
l
|
|
5269
|
+
), m = this.spine.pages.fromSpineItemPageIndex(
|
|
5270
|
+
p,
|
|
5271
|
+
d
|
|
5272
|
+
);
|
|
5273
|
+
this.pagination.update({
|
|
5274
|
+
beginCfi: h?.firstVisibleNode ? He({
|
|
5275
|
+
spineItem: g.item,
|
|
5276
|
+
pageNode: h?.firstVisibleNode
|
|
5277
|
+
}) : de(g.item),
|
|
5278
|
+
endCfi: m?.firstVisibleNode ? He({
|
|
5279
|
+
spineItem: p.item,
|
|
5280
|
+
pageNode: m?.firstVisibleNode
|
|
5281
|
+
}) : de(p.item)
|
|
5289
5282
|
});
|
|
5290
5283
|
})
|
|
5291
5284
|
);
|
|
5292
|
-
P(r, a).pipe(
|
|
5285
|
+
P(r, a).pipe(T(this.destroy$)).subscribe();
|
|
5293
5286
|
}
|
|
5294
5287
|
}
|
|
5295
5288
|
const hs = ({
|
|
@@ -5303,10 +5296,10 @@ class ms extends G {
|
|
|
5303
5296
|
...this.getDefaultSettings(),
|
|
5304
5297
|
...e
|
|
5305
5298
|
};
|
|
5306
|
-
this.inputSettings = t, this.outputSettingsUpdateSubject = new
|
|
5299
|
+
this.inputSettings = t, this.outputSettingsUpdateSubject = new N(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(J(1)), this._settings$.subscribe();
|
|
5307
5300
|
}
|
|
5308
5301
|
_prepareUpdate(e) {
|
|
5309
|
-
const t = $e(this.inputSettings, e), i = this.getOutputSettings(t), o = !
|
|
5302
|
+
const t = $e(this.inputSettings, e), i = this.getOutputSettings(t), o = !O(this.outputSettings, i);
|
|
5310
5303
|
return {
|
|
5311
5304
|
hasChanged: o,
|
|
5312
5305
|
state: i,
|
|
@@ -5333,8 +5326,8 @@ class ms extends G {
|
|
|
5333
5326
|
}
|
|
5334
5327
|
watch(e) {
|
|
5335
5328
|
return this.values$.pipe(
|
|
5336
|
-
|
|
5337
|
-
|
|
5329
|
+
Nt(e),
|
|
5330
|
+
R(O)
|
|
5338
5331
|
);
|
|
5339
5332
|
}
|
|
5340
5333
|
destroy() {
|
|
@@ -5345,7 +5338,7 @@ class fs extends ms {
|
|
|
5345
5338
|
constructor(e, t) {
|
|
5346
5339
|
super(e), this.context = t, t.watch(["manifest", "hasVerticalWriting"]).pipe(
|
|
5347
5340
|
x(() => this.update(this.values)),
|
|
5348
|
-
|
|
5341
|
+
T(this.destroy$)
|
|
5349
5342
|
).subscribe();
|
|
5350
5343
|
}
|
|
5351
5344
|
getComputedSettings(e) {
|
|
@@ -5359,7 +5352,7 @@ class fs extends ms {
|
|
|
5359
5352
|
manifest: t
|
|
5360
5353
|
})
|
|
5361
5354
|
};
|
|
5362
|
-
return t?.renditionFlow === "scrolled-continuous" && (o.computedPageTurnMode = "scrollable"), o.computedPageTurnMode === "scrollable" && (o.computedPageTurnDirection = "vertical"), i && o.computedPageTurnAnimation === "slide" && (
|
|
5355
|
+
return t?.renditionFlow === "scrolled-continuous" && (o.computedPageTurnMode = "scrollable"), o.computedPageTurnMode === "scrollable" && (o.computedPageTurnDirection = "vertical"), i && o.computedPageTurnAnimation === "slide" && (A.warn(
|
|
5363
5356
|
`pageTurnAnimation ${o.computedPageTurnAnimation} incompatible with current book, switching back to default`
|
|
5364
5357
|
), o.computedPageTurnAnimation = "none"), o.computedPageTurnMode === "scrollable" ? (o.computedPageTurnAnimationDuration = 0, o.computedPageTurnAnimation = "none") : o.computedPageTurnAnimationDuration = e.pageTurnAnimationDuration !== void 0 ? e.pageTurnAnimationDuration : 300, o;
|
|
5365
5358
|
}
|
|
@@ -5380,7 +5373,7 @@ class fs extends ms {
|
|
|
5380
5373
|
};
|
|
5381
5374
|
}
|
|
5382
5375
|
}
|
|
5383
|
-
class ys extends
|
|
5376
|
+
class ys extends ye {
|
|
5384
5377
|
onUnload() {
|
|
5385
5378
|
return _;
|
|
5386
5379
|
}
|
|
@@ -5401,74 +5394,105 @@ class ys extends Se {
|
|
|
5401
5394
|
}
|
|
5402
5395
|
class Ss extends G {
|
|
5403
5396
|
constructor(e, t, i, o, s, r, a) {
|
|
5404
|
-
super(), this.item = e, this.containerElement = t, this.context = i, this.hookManager = o, this.renderer = s, this.settings = r, this.viewport = a, this.layoutTriggerSubject = new
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
}) =>
|
|
5408
|
-
|
|
5409
|
-
|
|
5397
|
+
super(), this.item = e, this.containerElement = t, this.context = i, this.hookManager = o, this.renderer = s, this.settings = r, this.viewport = a, this.layoutTriggerSubject = new N(), this.lastLayout = null, this.computeLayoutInformation = ({
|
|
5398
|
+
isLastItem: u,
|
|
5399
|
+
horizontalOffset: l
|
|
5400
|
+
}) => {
|
|
5401
|
+
let d = this.viewport.value.pageSize.width, g = "none";
|
|
5402
|
+
const p = l % this.viewport.absoluteViewport.width === 0, h = this.context.manifest, m = Bt(h) ?? !1;
|
|
5403
|
+
if (this.settings.values.computedSpreadMode) {
|
|
5404
|
+
!m && this.renderer.renditionLayout === "reflowable" && !u && (d = this.viewport.value.pageSize.width * 2), !m && this.renderer.renditionLayout === "reflowable" && u && p && (d = this.viewport.value.pageSize.width * 2);
|
|
5405
|
+
const y = p && u && m;
|
|
5406
|
+
this.item.pageSpreadRight && p && !this.context.isRTL() ? (g = "before", d = this.viewport.value.pageSize.width * 2) : this.item.pageSpreadLeft && p && this.context.isRTL() ? (g = "before", d = this.viewport.value.pageSize.width * 2) : y && (this.context.isRTL() ? g = "before" : g = "after", d = this.viewport.value.pageSize.width * 2);
|
|
5407
|
+
}
|
|
5408
|
+
return {
|
|
5409
|
+
minimumWidth: d,
|
|
5410
|
+
blankPagePosition: g
|
|
5411
|
+
};
|
|
5412
|
+
}, this.adjustPositionOfElement = ({
|
|
5413
|
+
right: u,
|
|
5414
|
+
left: l,
|
|
5415
|
+
top: d
|
|
5416
|
+
}) => {
|
|
5417
|
+
u !== void 0 ? this.containerElement.style.right = `${u}px` : this.containerElement.style.removeProperty("right"), l !== void 0 ? this.containerElement.style.left = `${l}px` : this.containerElement.style.removeProperty("left"), d !== void 0 ? this.containerElement.style.top = `${d}px` : this.containerElement.style.removeProperty("top");
|
|
5418
|
+
}, this.updateContainerLayout = ({
|
|
5419
|
+
minimumWidth: u,
|
|
5420
|
+
edgeX: l,
|
|
5421
|
+
edgeY: d
|
|
5422
|
+
}) => (g) => g.pipe(
|
|
5423
|
+
S((p) => {
|
|
5424
|
+
const h = O(
|
|
5410
5425
|
this.lastLayout?.pageSize,
|
|
5411
5426
|
this.viewport.pageSize
|
|
5412
|
-
) ? this.lastLayout : void 0, { width:
|
|
5413
|
-
|
|
5414
|
-
|
|
5427
|
+
) ? this.lastLayout : void 0, { width: m, height: y } = h ?? {}, { width: f = m, height: I = y } = p ?? {}, { width: b, height: F } = this.viewport.pageSize, $ = this.validateDimension(
|
|
5428
|
+
f ?? b,
|
|
5429
|
+
b,
|
|
5415
5430
|
u
|
|
5416
|
-
),
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5431
|
+
), L = this.settings.values.computedPageTurnMode === "scrollable" ? I ?? F : this.validateDimension(
|
|
5432
|
+
I ?? F,
|
|
5433
|
+
F,
|
|
5434
|
+
F
|
|
5420
5435
|
);
|
|
5421
5436
|
return this.lastLayout = {
|
|
5422
|
-
width:
|
|
5423
|
-
height:
|
|
5437
|
+
width: $,
|
|
5438
|
+
height: L,
|
|
5424
5439
|
pageSize: this.viewport.pageSize
|
|
5425
|
-
}, this.containerElement.style.width = `${
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5440
|
+
}, this.containerElement.style.width = `${$}px`, this.containerElement.style.height = `${L}px`, this.settings.values.computedPageTurnDirection === "vertical" ? (this.adjustPositionOfElement({
|
|
5441
|
+
top: d,
|
|
5442
|
+
left: l
|
|
5443
|
+
}), { width: $, height: L }) : (this.adjustPositionOfElement(
|
|
5444
|
+
this.context.isRTL() ? { right: l, top: 0 } : { left: l, top: 0 }
|
|
5445
|
+
), { width: $, height: L });
|
|
5430
5446
|
})
|
|
5431
|
-
), this.layout = (
|
|
5432
|
-
const
|
|
5433
|
-
return this.layoutTriggerSubject.next(
|
|
5434
|
-
}
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5447
|
+
), this.layout = (u) => {
|
|
5448
|
+
const l = Xn(this.didLayout$.pipe(U()));
|
|
5449
|
+
return this.layoutTriggerSubject.next(u), l();
|
|
5450
|
+
};
|
|
5451
|
+
const c = this.layoutTriggerSubject.pipe(
|
|
5452
|
+
w(
|
|
5453
|
+
({ spreadPosition: u, horizontalOffset: l, isLastItem: d, edgeX: g, edgeY: p }) => {
|
|
5454
|
+
const { blankPagePosition: h, minimumWidth: m } = this.computeLayoutInformation({ horizontalOffset: l, isLastItem: d });
|
|
5455
|
+
this.hookManager.execute("item.onBeforeLayout", void 0, {
|
|
5456
|
+
blankPagePosition: h,
|
|
5457
|
+
item: this.item,
|
|
5458
|
+
minimumWidth: m
|
|
5459
|
+
});
|
|
5460
|
+
const y = this.renderer.layout({
|
|
5461
|
+
blankPagePosition: h,
|
|
5462
|
+
minPageSpread: m / this.viewport.pageSize.width,
|
|
5463
|
+
minimumWidth: m,
|
|
5464
|
+
spreadPosition: u
|
|
5465
|
+
});
|
|
5466
|
+
return P(
|
|
5467
|
+
v({ type: "start" }),
|
|
5468
|
+
y.pipe(
|
|
5469
|
+
/**
|
|
5470
|
+
* Now that inner layout is done from the renderer, we adjust the dimensions
|
|
5471
|
+
* of the outer container element
|
|
5472
|
+
*/
|
|
5473
|
+
this.updateContainerLayout({
|
|
5474
|
+
minimumWidth: m,
|
|
5475
|
+
edgeX: g,
|
|
5476
|
+
edgeY: p
|
|
5477
|
+
}),
|
|
5478
|
+
S((f) => (this.hookManager.execute("item.onAfterLayout", void 0, {
|
|
5479
|
+
blankPagePosition: h,
|
|
5480
|
+
item: this.item,
|
|
5481
|
+
minimumWidth: m
|
|
5482
|
+
}), {
|
|
5460
5483
|
type: "end",
|
|
5461
|
-
data:
|
|
5462
|
-
})
|
|
5484
|
+
data: f
|
|
5485
|
+
}))
|
|
5463
5486
|
)
|
|
5464
|
-
)
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
)
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5487
|
+
);
|
|
5488
|
+
}
|
|
5489
|
+
),
|
|
5490
|
+
D()
|
|
5491
|
+
);
|
|
5492
|
+
this.didLayout$ = c.pipe(
|
|
5493
|
+
C((u) => u.type === "end"),
|
|
5494
|
+
S((u) => u.data),
|
|
5495
|
+
D()
|
|
5472
5496
|
);
|
|
5473
5497
|
}
|
|
5474
5498
|
validateDimension(e, t, i) {
|
|
@@ -5484,12 +5508,12 @@ class Ss extends G {
|
|
|
5484
5508
|
};
|
|
5485
5509
|
}
|
|
5486
5510
|
}
|
|
5487
|
-
class
|
|
5511
|
+
class Zt extends Q {
|
|
5488
5512
|
constructor(e, t, i, o, s, r, a) {
|
|
5489
5513
|
super({
|
|
5490
5514
|
isLoaded: !1,
|
|
5491
5515
|
isReady: !1,
|
|
5492
|
-
|
|
5516
|
+
isDirty: !1,
|
|
5493
5517
|
isError: !1,
|
|
5494
5518
|
error: void 0
|
|
5495
5519
|
}), this.item = e, this.parentElement = t, this.context = i, this.settings = o, this.hookManager = s, this.index = r, this.viewport = a, this.load = () => {
|
|
@@ -5498,11 +5522,11 @@ class Qt extends Q {
|
|
|
5498
5522
|
this.renderer.unload();
|
|
5499
5523
|
}, this.markDirty = () => {
|
|
5500
5524
|
this.mergeCompare({
|
|
5501
|
-
|
|
5525
|
+
isDirty: !0
|
|
5502
5526
|
});
|
|
5503
5527
|
}, this.destroy = () => {
|
|
5504
5528
|
super.destroy(), this.containerElement.remove(), this.renderer.destroy();
|
|
5505
|
-
}, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = Is(
|
|
5529
|
+
}, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.layout = (d) => this._layout.layout(d), this.containerElement = Is(
|
|
5506
5530
|
t,
|
|
5507
5531
|
e,
|
|
5508
5532
|
s
|
|
@@ -5518,7 +5542,7 @@ class Qt extends Q {
|
|
|
5518
5542
|
resourcesHandler: this.resourcesHandler,
|
|
5519
5543
|
viewport: this.viewport
|
|
5520
5544
|
};
|
|
5521
|
-
this.renderer = c ? c(u) : new ys(u), this.
|
|
5545
|
+
this.renderer = c ? c(u) : new ys(u), this._layout = new Ss(
|
|
5522
5546
|
e,
|
|
5523
5547
|
this.containerElement,
|
|
5524
5548
|
i,
|
|
@@ -5528,22 +5552,23 @@ class Qt extends Q {
|
|
|
5528
5552
|
this.viewport
|
|
5529
5553
|
);
|
|
5530
5554
|
const l = this.renderer.state$.pipe(
|
|
5531
|
-
|
|
5555
|
+
V(({ state: d, error: g }) => {
|
|
5532
5556
|
this.mergeCompare({
|
|
5533
|
-
isLoaded:
|
|
5534
|
-
isError:
|
|
5535
|
-
error:
|
|
5557
|
+
isLoaded: d === "loaded",
|
|
5558
|
+
isError: d === "error",
|
|
5559
|
+
error: d === "error" ? g : void 0
|
|
5536
5560
|
});
|
|
5537
5561
|
})
|
|
5538
|
-
)
|
|
5539
|
-
|
|
5562
|
+
);
|
|
5563
|
+
this.didLayout$ = this._layout.didLayout$.pipe(
|
|
5564
|
+
V(() => {
|
|
5540
5565
|
this.mergeCompare({
|
|
5541
|
-
|
|
5566
|
+
isDirty: !1,
|
|
5542
5567
|
isReady: this.renderer.state$.value.state === "loaded"
|
|
5543
5568
|
});
|
|
5544
|
-
})
|
|
5545
|
-
|
|
5546
|
-
|
|
5569
|
+
}),
|
|
5570
|
+
vn()
|
|
5571
|
+
), P(
|
|
5547
5572
|
/**
|
|
5548
5573
|
* @important
|
|
5549
5574
|
* The order is important here. We want to ensure the state value
|
|
@@ -5551,8 +5576,7 @@ class Qt extends Q {
|
|
|
5551
5576
|
* to layout changes may rely on the state value to be updated.
|
|
5552
5577
|
*/
|
|
5553
5578
|
l,
|
|
5554
|
-
|
|
5555
|
-
this.layout.layout$
|
|
5579
|
+
this.didLayout$
|
|
5556
5580
|
).pipe(K(this.destroy$)).subscribe();
|
|
5557
5581
|
}
|
|
5558
5582
|
/**
|
|
@@ -5576,29 +5600,29 @@ class Qt extends Q {
|
|
|
5576
5600
|
get readingDirection() {
|
|
5577
5601
|
return this.renderer.readingDirection;
|
|
5578
5602
|
}
|
|
5603
|
+
/**
|
|
5604
|
+
* Note that this is dispatched AFTER the state has been updated.
|
|
5605
|
+
*/
|
|
5579
5606
|
get loaded$() {
|
|
5580
5607
|
return this.renderer.loaded$;
|
|
5581
5608
|
}
|
|
5609
|
+
/**
|
|
5610
|
+
* Note that this is dispatched AFTER the state has been updated.
|
|
5611
|
+
*/
|
|
5582
5612
|
get unloaded$() {
|
|
5583
|
-
return this.renderer.
|
|
5584
|
-
fe(),
|
|
5585
|
-
ae(({ state: e }) => e !== "idle"),
|
|
5586
|
-
X(
|
|
5587
|
-
() => this.renderer.state$.pipe(
|
|
5588
|
-
ae(({ state: e }) => e === "idle"),
|
|
5589
|
-
Mt()
|
|
5590
|
-
)
|
|
5591
|
-
)
|
|
5592
|
-
);
|
|
5613
|
+
return this.renderer.unloaded$;
|
|
5593
5614
|
}
|
|
5594
5615
|
get renditionLayout() {
|
|
5595
5616
|
return this.renderer.renditionLayout;
|
|
5596
5617
|
}
|
|
5618
|
+
get layoutInfo() {
|
|
5619
|
+
return this._layout.layoutInfo;
|
|
5620
|
+
}
|
|
5597
5621
|
get numberOfPages() {
|
|
5598
|
-
return
|
|
5622
|
+
return Yt({
|
|
5599
5623
|
isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
|
|
5600
|
-
itemHeight: this.
|
|
5601
|
-
itemWidth: this.
|
|
5624
|
+
itemHeight: this._layout.layoutInfo.height,
|
|
5625
|
+
itemWidth: this._layout.layoutInfo.width,
|
|
5602
5626
|
pageWidth: this.viewport.pageSize.width,
|
|
5603
5627
|
pageHeight: this.viewport.pageSize.height,
|
|
5604
5628
|
pageTurnDirection: this.settings.values.computedPageTurnDirection,
|
|
@@ -5615,12 +5639,12 @@ const Is = (n, e, t) => {
|
|
|
5615
5639
|
};
|
|
5616
5640
|
class bs extends G {
|
|
5617
5641
|
constructor(e, t, i, o, s) {
|
|
5618
|
-
super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new
|
|
5642
|
+
super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new q(
|
|
5619
5643
|
/* @__PURE__ */ new Map()
|
|
5620
5644
|
);
|
|
5621
5645
|
const r = this.forcedOpenSubject.pipe(
|
|
5622
5646
|
S((u) => Array.from(u.keys()).sort((l, d) => l - d)),
|
|
5623
|
-
|
|
5647
|
+
R(hn),
|
|
5624
5648
|
J({ bufferSize: 1, refCount: !0 })
|
|
5625
5649
|
);
|
|
5626
5650
|
P(
|
|
@@ -5632,15 +5656,15 @@ class bs extends G {
|
|
|
5632
5656
|
// this can be changed by whatever we want and SHOULD not break navigation.
|
|
5633
5657
|
// Ideally loading faster is better but loading too close to user navigating can
|
|
5634
5658
|
// be dangerous.
|
|
5635
|
-
|
|
5659
|
+
Ie(100, re),
|
|
5636
5660
|
De(this.context.bridgeEvent.viewportFree$),
|
|
5637
5661
|
z(this.context.bridgeEvent.navigation$, r),
|
|
5638
5662
|
S(([, u, l]) => {
|
|
5639
|
-
const { numberOfAdjacentSpineItemToPreLoad: d } = o.values, { beginIndex:
|
|
5663
|
+
const { numberOfAdjacentSpineItemToPreLoad: d } = o.values, { beginIndex: g = 0, endIndex: p = 0 } = i.getVisibleSpineItemsFromPosition({
|
|
5640
5664
|
position: u.position,
|
|
5641
5665
|
threshold: { type: "percentage", value: 0 },
|
|
5642
5666
|
useAbsoluteViewport: !1
|
|
5643
|
-
}) || {}, h = d === 1 / 0 ? 0 :
|
|
5667
|
+
}) || {}, h = d === 1 / 0 ? 0 : g - d, m = d === 1 / 0 ? t.items.length - 1 : p + d, y = Array.from(
|
|
5644
5668
|
{ length: m - h + 1 },
|
|
5645
5669
|
(I, b) => h + b
|
|
5646
5670
|
), f = [...l, ...y];
|
|
@@ -5648,7 +5672,7 @@ class bs extends G {
|
|
|
5648
5672
|
f.includes(b) ? I.load() : I.unload();
|
|
5649
5673
|
});
|
|
5650
5674
|
})
|
|
5651
|
-
).pipe(
|
|
5675
|
+
).pipe(T(this.destroy$)).subscribe();
|
|
5652
5676
|
}
|
|
5653
5677
|
forceOpen(e) {
|
|
5654
5678
|
const t = e.map(
|
|
@@ -5668,21 +5692,21 @@ class bs extends G {
|
|
|
5668
5692
|
super.destroy(), this.forcedOpenSubject.complete();
|
|
5669
5693
|
}
|
|
5670
5694
|
}
|
|
5671
|
-
const
|
|
5695
|
+
const Jt = (n, e, t) => {
|
|
5672
5696
|
const i = (t.width - e.width) / 2, o = (t.height - e.height) / 2;
|
|
5673
|
-
return new
|
|
5697
|
+
return new ae({
|
|
5674
5698
|
x: n.x - i,
|
|
5675
5699
|
y: n.y - o
|
|
5676
5700
|
});
|
|
5677
5701
|
};
|
|
5678
|
-
class
|
|
5702
|
+
class Se extends DOMRect {
|
|
5679
5703
|
constructor() {
|
|
5680
5704
|
super(...arguments), this.__symbol = /* @__PURE__ */ Symbol("ViewportPosition");
|
|
5681
5705
|
}
|
|
5682
5706
|
static from(e, t) {
|
|
5683
5707
|
if (t) {
|
|
5684
5708
|
const o = e;
|
|
5685
|
-
return new
|
|
5709
|
+
return new Se(
|
|
5686
5710
|
o.x,
|
|
5687
5711
|
o.y,
|
|
5688
5712
|
t.width,
|
|
@@ -5690,7 +5714,7 @@ class Ie extends DOMRect {
|
|
|
5690
5714
|
);
|
|
5691
5715
|
}
|
|
5692
5716
|
const i = e;
|
|
5693
|
-
return new
|
|
5717
|
+
return new Se(i.x, i.y, i.width, i.height);
|
|
5694
5718
|
}
|
|
5695
5719
|
}
|
|
5696
5720
|
class vs {
|
|
@@ -5742,7 +5766,7 @@ const Ps = ({
|
|
|
5742
5766
|
}) => {
|
|
5743
5767
|
const o = n / i.width, s = e / i.height;
|
|
5744
5768
|
return t.type === "percentage" ? s >= t.value && o >= t.value : e >= t.value && n >= t.value;
|
|
5745
|
-
},
|
|
5769
|
+
}, Kt = ({
|
|
5746
5770
|
itemPosition: {
|
|
5747
5771
|
bottom: n,
|
|
5748
5772
|
left: e,
|
|
@@ -5755,21 +5779,21 @@ const Ps = ({
|
|
|
5755
5779
|
viewportPosition: a,
|
|
5756
5780
|
restrictToScreen: c
|
|
5757
5781
|
}) => {
|
|
5758
|
-
const u = a.x, l = a.x + (a.width - 1), d = a.y,
|
|
5782
|
+
const u = a.x, l = a.x + (a.width - 1), d = a.y, g = Math.max(
|
|
5759
5783
|
a.y + (a.height - 1),
|
|
5760
5784
|
0
|
|
5761
|
-
),
|
|
5785
|
+
), p = Math.max(
|
|
5762
5786
|
0,
|
|
5763
5787
|
Math.min(t, l) - Math.max(e, u)
|
|
5764
5788
|
), h = Math.max(
|
|
5765
5789
|
0,
|
|
5766
|
-
Math.min(n,
|
|
5790
|
+
Math.min(n, g) - Math.max(i, d)
|
|
5767
5791
|
);
|
|
5768
|
-
if (
|
|
5792
|
+
if (p <= 0 || h <= 0) return { visible: !1 };
|
|
5769
5793
|
const y = $s({
|
|
5770
5794
|
threshold: r,
|
|
5771
5795
|
visibleHeightOfItem: h,
|
|
5772
|
-
visibleWidthOfItem:
|
|
5796
|
+
visibleWidthOfItem: p,
|
|
5773
5797
|
viewportPosition: a
|
|
5774
5798
|
});
|
|
5775
5799
|
return c ? { visible: y } : {
|
|
@@ -5778,10 +5802,10 @@ const Ps = ({
|
|
|
5778
5802
|
itemWidth: o,
|
|
5779
5803
|
threshold: r,
|
|
5780
5804
|
visibleHeightOfItem: h,
|
|
5781
|
-
visibleWidthOfItem:
|
|
5805
|
+
visibleWidthOfItem: p
|
|
5782
5806
|
}) || y
|
|
5783
5807
|
};
|
|
5784
|
-
},
|
|
5808
|
+
}, qe = ({
|
|
5785
5809
|
position: n,
|
|
5786
5810
|
spineItemsManager: e,
|
|
5787
5811
|
spineLayout: t
|
|
@@ -5791,10 +5815,10 @@ const Ps = ({
|
|
|
5791
5815
|
return u && l;
|
|
5792
5816
|
});
|
|
5793
5817
|
return n.x === 0 && !i ? e.items[0] : i;
|
|
5794
|
-
},
|
|
5818
|
+
}, Ue = ({
|
|
5795
5819
|
spineItemPosition: n,
|
|
5796
5820
|
itemLayout: { left: e, top: t }
|
|
5797
|
-
}) => new
|
|
5821
|
+
}) => new M({
|
|
5798
5822
|
x: e + n.x,
|
|
5799
5823
|
y: t + n.y
|
|
5800
5824
|
}), Ts = ({
|
|
@@ -5806,34 +5830,34 @@ const Ps = ({
|
|
|
5806
5830
|
useAbsoluteViewport: s = !0,
|
|
5807
5831
|
viewport: r
|
|
5808
5832
|
}) => {
|
|
5809
|
-
const a =
|
|
5833
|
+
const a = qe({
|
|
5810
5834
|
position: n,
|
|
5811
5835
|
spineItemsManager: i,
|
|
5812
5836
|
spineLayout: o
|
|
5813
5837
|
}) || i.get(0), c = i.items.reduce(
|
|
5814
|
-
(
|
|
5815
|
-
const m = o.getSpineItemSpineLayoutInfo(h), y = s ? r.absoluteViewport : r.relativeViewport, f =
|
|
5838
|
+
(p, h) => {
|
|
5839
|
+
const m = o.getSpineItemSpineLayoutInfo(h), y = s ? r.absoluteViewport : r.relativeViewport, f = Jt(
|
|
5816
5840
|
n,
|
|
5817
5841
|
r.absoluteViewport,
|
|
5818
5842
|
y
|
|
5819
|
-
), I =
|
|
5843
|
+
), I = Se.from(
|
|
5820
5844
|
f,
|
|
5821
5845
|
y
|
|
5822
|
-
), { visible: b } =
|
|
5846
|
+
), { visible: b } = Kt({
|
|
5823
5847
|
itemPosition: m,
|
|
5824
5848
|
threshold: e,
|
|
5825
5849
|
viewportPosition: I,
|
|
5826
5850
|
restrictToScreen: t
|
|
5827
5851
|
});
|
|
5828
|
-
return b ? [...
|
|
5852
|
+
return b ? [...p, h] : p;
|
|
5829
5853
|
},
|
|
5830
5854
|
[]
|
|
5831
5855
|
), u = c[0] ?? a, l = c[c.length - 1] ?? u;
|
|
5832
5856
|
if (!u || !l) return;
|
|
5833
|
-
const d = i.getSpineItemIndex(u),
|
|
5857
|
+
const d = i.getSpineItemIndex(u), g = i.getSpineItemIndex(l);
|
|
5834
5858
|
return {
|
|
5835
5859
|
beginIndex: d ?? 0,
|
|
5836
|
-
endIndex:
|
|
5860
|
+
endIndex: g ?? 0
|
|
5837
5861
|
};
|
|
5838
5862
|
}, Fs = ({
|
|
5839
5863
|
spineItemsManager: n,
|
|
@@ -5845,7 +5869,7 @@ const Ps = ({
|
|
|
5845
5869
|
}) => {
|
|
5846
5870
|
const r = (h, m) => {
|
|
5847
5871
|
const { left: y, top: f } = o.getSpineItemSpineLayoutInfo(m);
|
|
5848
|
-
return new
|
|
5872
|
+
return new E({
|
|
5849
5873
|
/**
|
|
5850
5874
|
* when using spread the item could be on the right and therefore will be negative
|
|
5851
5875
|
* @example
|
|
@@ -5856,8 +5880,8 @@ const Ps = ({
|
|
|
5856
5880
|
x: Math.max(h.x - y, 0),
|
|
5857
5881
|
y: Math.max(h.y - f, 0)
|
|
5858
5882
|
});
|
|
5859
|
-
}, a = (h) =>
|
|
5860
|
-
spineItemPosition: new
|
|
5883
|
+
}, a = (h) => Ue({
|
|
5884
|
+
spineItemPosition: new E({ x: 0, y: 0 }),
|
|
5861
5885
|
itemLayout: o.getSpineItemSpineLayoutInfo(h)
|
|
5862
5886
|
}), c = (h) => n.items.find((m) => m.renderer.getDocumentFrame() === h), u = (h, m, y) => {
|
|
5863
5887
|
if (typeof y == "number") {
|
|
@@ -5881,44 +5905,44 @@ const Ps = ({
|
|
|
5881
5905
|
useAbsoluteViewport: I = !0,
|
|
5882
5906
|
viewport: b
|
|
5883
5907
|
}) => {
|
|
5884
|
-
const F = y.numberOfPages,
|
|
5885
|
-
const
|
|
5886
|
-
pageIndex:
|
|
5908
|
+
const F = y.numberOfPages, L = Array.from(Array(F)).map((se, ue) => {
|
|
5909
|
+
const Ae = t.getSpineItemPositionFromPageIndex({
|
|
5910
|
+
pageIndex: ue,
|
|
5887
5911
|
spineItem: y
|
|
5888
|
-
}),
|
|
5889
|
-
spineItemPosition:
|
|
5912
|
+
}), le = Ue({
|
|
5913
|
+
spineItemPosition: Ae,
|
|
5890
5914
|
itemLayout: o.getSpineItemSpineLayoutInfo(y)
|
|
5891
5915
|
});
|
|
5892
5916
|
return {
|
|
5893
|
-
index:
|
|
5917
|
+
index: ue,
|
|
5894
5918
|
absolutePosition: {
|
|
5895
5919
|
width: b.pageSize.width,
|
|
5896
5920
|
height: b.pageSize.height,
|
|
5897
|
-
left:
|
|
5898
|
-
top:
|
|
5899
|
-
bottom:
|
|
5900
|
-
right:
|
|
5921
|
+
left: le.x,
|
|
5922
|
+
top: le.y,
|
|
5923
|
+
bottom: le.y + b.pageSize.height,
|
|
5924
|
+
right: le.x + b.pageSize.width
|
|
5901
5925
|
}
|
|
5902
5926
|
};
|
|
5903
5927
|
}).reduce(
|
|
5904
|
-
(
|
|
5905
|
-
const
|
|
5928
|
+
(se, { absolutePosition: ue, index: Ae }) => {
|
|
5929
|
+
const le = I ? b.absoluteViewport : b.relativeViewport, Qt = Jt(
|
|
5906
5930
|
h,
|
|
5907
5931
|
b.absoluteViewport,
|
|
5908
|
-
|
|
5909
|
-
),
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
), { visible:
|
|
5913
|
-
viewportPosition:
|
|
5932
|
+
le
|
|
5933
|
+
), en = Se.from(
|
|
5934
|
+
Qt,
|
|
5935
|
+
le
|
|
5936
|
+
), { visible: tn } = Kt({
|
|
5937
|
+
viewportPosition: en,
|
|
5914
5938
|
restrictToScreen: f,
|
|
5915
5939
|
threshold: m,
|
|
5916
|
-
itemPosition:
|
|
5940
|
+
itemPosition: ue
|
|
5917
5941
|
});
|
|
5918
|
-
return
|
|
5942
|
+
return tn ? [...se, Ae] : se;
|
|
5919
5943
|
},
|
|
5920
5944
|
[]
|
|
5921
|
-
), H =
|
|
5945
|
+
), H = L[0], B = L[L.length - 1] ?? H;
|
|
5922
5946
|
if (!(H === void 0 || B === void 0))
|
|
5923
5947
|
return {
|
|
5924
5948
|
beginPageIndex: H,
|
|
@@ -5931,7 +5955,7 @@ const Ps = ({
|
|
|
5931
5955
|
spineItemPosition: m
|
|
5932
5956
|
}) => {
|
|
5933
5957
|
const y = o.getSpineItemSpineLayoutInfo(h);
|
|
5934
|
-
return
|
|
5958
|
+
return Ue({
|
|
5935
5959
|
itemLayout: y,
|
|
5936
5960
|
spineItemPosition: m
|
|
5937
5961
|
});
|
|
@@ -5944,7 +5968,7 @@ const Ps = ({
|
|
|
5944
5968
|
spineItemsManager: n
|
|
5945
5969
|
}),
|
|
5946
5970
|
getSpineItemPagePositionFromSpinePosition: (h) => {
|
|
5947
|
-
const m =
|
|
5971
|
+
const m = qe({
|
|
5948
5972
|
position: h,
|
|
5949
5973
|
spineItemsManager: n,
|
|
5950
5974
|
spineLayout: o
|
|
@@ -5955,8 +5979,8 @@ const Ps = ({
|
|
|
5955
5979
|
h,
|
|
5956
5980
|
m
|
|
5957
5981
|
), f = t.getSpineItemPageIndexFromPosition({
|
|
5958
|
-
itemWidth: m.
|
|
5959
|
-
itemHeight: m.
|
|
5982
|
+
itemWidth: m.layoutInfo.width,
|
|
5983
|
+
itemHeight: m.layoutInfo.height,
|
|
5960
5984
|
position: y,
|
|
5961
5985
|
isUsingVerticalWriting: !!m.isUsingVerticalWriting()
|
|
5962
5986
|
}), I = t.getSpineItemPagePositionFromSpineItemPosition(
|
|
@@ -5973,7 +5997,7 @@ const Ps = ({
|
|
|
5973
5997
|
},
|
|
5974
5998
|
getSpinePositionFromSpineItem: a,
|
|
5975
5999
|
getSpineItemPositionFromSpinePosition: r,
|
|
5976
|
-
getSpineItemFromPosition: (h) =>
|
|
6000
|
+
getSpineItemFromPosition: (h) => qe({
|
|
5977
6001
|
position: h,
|
|
5978
6002
|
spineItemsManager: n,
|
|
5979
6003
|
spineLayout: o
|
|
@@ -5997,13 +6021,13 @@ const Ps = ({
|
|
|
5997
6021
|
spineItemLocator: t,
|
|
5998
6022
|
getSafeSpineItemPositionFromUnsafeSpineItemPosition: (h, m) => {
|
|
5999
6023
|
const { height: y, width: f } = o.getSpineItemSpineLayoutInfo(m);
|
|
6000
|
-
return new
|
|
6024
|
+
return new E({
|
|
6001
6025
|
x: Math.min(Math.max(0, h.x), f),
|
|
6002
6026
|
y: Math.min(Math.max(0, h.y), y)
|
|
6003
6027
|
});
|
|
6004
6028
|
}
|
|
6005
6029
|
};
|
|
6006
|
-
}, Ls =
|
|
6030
|
+
}, Ls = A.namespace("spine"), Ms = ({
|
|
6007
6031
|
position: n,
|
|
6008
6032
|
pageSize: e
|
|
6009
6033
|
}) => new Ii({
|
|
@@ -6019,11 +6043,13 @@ class Cs extends Q {
|
|
|
6019
6043
|
constructor(e, t, i, o, s, r) {
|
|
6020
6044
|
super({ pages: [] }), this.spineLayout = e, this.spineItemsManager = t, this.spineItemLocator = i, this.context = o, this.locator = s, this.viewport = r, this.fromSpineItemPageIndex = (a, c) => this.value.pages.find(
|
|
6021
6045
|
(u) => u.itemIndex === a.index && u.pageIndex === c
|
|
6022
|
-
), this.fromAbsolutePageIndex = (a) => this.value.pages.
|
|
6046
|
+
), this.fromAbsolutePageIndex = (a) => this.value.pages.find(
|
|
6047
|
+
(c) => c.absolutePageIndex === a
|
|
6048
|
+
), this.observeFromAbsolutePageIndex = (a) => this.pipe(S(() => this.fromAbsolutePageIndex(a))), this.layout$ = e.layout$.pipe(
|
|
6023
6049
|
z(r),
|
|
6024
6050
|
w(([, { pageSize: a }]) => {
|
|
6025
6051
|
const c = t.items.reduce(
|
|
6026
|
-
(l, d,
|
|
6052
|
+
(l, d, g) => {
|
|
6027
6053
|
const h = new Array(d.numberOfPages).fill(void 0).map((m, y) => {
|
|
6028
6054
|
const f = i.getSpineItemPositionFromPageIndex({
|
|
6029
6055
|
spineItem: d,
|
|
@@ -6047,7 +6073,7 @@ class Cs extends Q {
|
|
|
6047
6073
|
x: f.x,
|
|
6048
6074
|
y: f.y
|
|
6049
6075
|
}),
|
|
6050
|
-
itemIndex:
|
|
6076
|
+
itemIndex: g,
|
|
6051
6077
|
absolutePageIndex: l.length + y,
|
|
6052
6078
|
spineItem: d,
|
|
6053
6079
|
pageIndex: y
|
|
@@ -6057,209 +6083,148 @@ class Cs extends Q {
|
|
|
6057
6083
|
},
|
|
6058
6084
|
[]
|
|
6059
6085
|
);
|
|
6060
|
-
return
|
|
6086
|
+
return j(
|
|
6061
6087
|
c.map((l) => {
|
|
6062
|
-
const { spineItem: d, ...
|
|
6063
|
-
|
|
6064
|
-
const
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6088
|
+
const { spineItem: d, ...g } = l;
|
|
6089
|
+
if (l.spineItem.value.isLoaded) {
|
|
6090
|
+
const p = l.spineItem.renderer?.getDocumentFrame();
|
|
6091
|
+
if (p && p?.contentWindow?.document && p.contentWindow.document.body !== null) {
|
|
6092
|
+
const h = p.contentWindow.document;
|
|
6093
|
+
return et().pipe(
|
|
6094
|
+
S(() => {
|
|
6095
|
+
const m = Ln(
|
|
6096
|
+
h,
|
|
6097
|
+
l.layout
|
|
6098
|
+
);
|
|
6099
|
+
return {
|
|
6100
|
+
...g,
|
|
6101
|
+
firstVisibleNode: m
|
|
6102
|
+
};
|
|
6103
|
+
})
|
|
6104
|
+
);
|
|
6105
|
+
}
|
|
6106
|
+
}
|
|
6107
|
+
return v({ ...g, firstVisibleNode: void 0 });
|
|
6072
6108
|
})
|
|
6073
6109
|
);
|
|
6074
6110
|
}),
|
|
6075
6111
|
S((a) => (Ls.info("Pages layout", a), { pages: a })),
|
|
6076
|
-
|
|
6077
|
-
), this.layout$.pipe(
|
|
6112
|
+
D()
|
|
6113
|
+
), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
|
|
6078
6114
|
}
|
|
6079
6115
|
}
|
|
6080
6116
|
class Es extends G {
|
|
6081
|
-
constructor(e
|
|
6082
|
-
super(), this.spineItemsManager = e, this.
|
|
6083
|
-
w((
|
|
6084
|
-
|
|
6085
|
-
(
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6117
|
+
constructor(e) {
|
|
6118
|
+
super(), this.spineItemsManager = e, this.states$ = this.spineItemsManager.items$.pipe(
|
|
6119
|
+
w((t) => P(
|
|
6120
|
+
...t.map(
|
|
6121
|
+
(i) => i.pipe(
|
|
6122
|
+
S((o) => ({ item: i, ...o })),
|
|
6123
|
+
R(O)
|
|
6124
|
+
)
|
|
6125
|
+
)
|
|
6126
|
+
)),
|
|
6127
|
+
D()
|
|
6090
6128
|
), this.itemResize$ = this.spineItemsManager.items$.pipe(
|
|
6091
|
-
w((
|
|
6092
|
-
const
|
|
6093
|
-
(
|
|
6094
|
-
S((
|
|
6129
|
+
w((t) => {
|
|
6130
|
+
const i = t.map(
|
|
6131
|
+
(o) => Qe(o.element).pipe(
|
|
6132
|
+
S((s) => ({ entries: s, item: o }))
|
|
6095
6133
|
)
|
|
6096
6134
|
);
|
|
6097
|
-
return P(...
|
|
6135
|
+
return P(...i);
|
|
6098
6136
|
}),
|
|
6099
|
-
|
|
6137
|
+
D()
|
|
6138
|
+
), this.itemLoad$ = this.spineItemsManager.items$.pipe(
|
|
6139
|
+
w((t) => P(...t.map((i) => i.loaded$.pipe(S(() => i))))),
|
|
6140
|
+
D()
|
|
6141
|
+
), this.itemUnload$ = this.spineItemsManager.items$.pipe(
|
|
6142
|
+
w((t) => P(
|
|
6143
|
+
...t.map((i) => i.unloaded$.pipe(S(() => i)))
|
|
6144
|
+
)),
|
|
6145
|
+
D()
|
|
6100
6146
|
);
|
|
6101
6147
|
}
|
|
6102
6148
|
}
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
let u = c.value.pageSize.width, l = "none";
|
|
6115
|
-
const d = n % c.absoluteViewport.width === 0, p = r === i.items.length - 1;
|
|
6116
|
-
if (s.values.computedSpreadMode) {
|
|
6117
|
-
!o && a.renditionLayout === "reflowable" && !p && (u = c.value.pageSize.width * 2), !o && a.renditionLayout === "reflowable" && p && d && (u = c.value.pageSize.width * 2);
|
|
6118
|
-
const h = d && p && o;
|
|
6119
|
-
a.item.pageSpreadRight && d && !t.isRTL() || a.item.pageSpreadLeft && d && t.isRTL() ? (l = "before", u = c.value.pageSize.width * 2) : h && (t.isRTL() ? l = "before" : l = "after", u = c.value.pageSize.width * 2);
|
|
6120
|
-
}
|
|
6121
|
-
return a.layout.layout({
|
|
6122
|
-
minimumWidth: u,
|
|
6123
|
-
blankPagePosition: l,
|
|
6124
|
-
spreadPosition: s.values.computedSpreadMode ? d ? t.isRTL() ? "right" : "left" : t.isRTL() ? "left" : "right" : "none"
|
|
6125
|
-
}).pipe(
|
|
6126
|
-
S(({ width: h, height: m }) => {
|
|
6127
|
-
if (s.values.computedPageTurnDirection === "vertical") {
|
|
6128
|
-
const I = d ? e : e - c.absoluteViewport.height, b = d ? 0 : n;
|
|
6129
|
-
t.isRTL() ? a.layout.adjustPositionOfElement({
|
|
6130
|
-
top: I,
|
|
6131
|
-
left: b
|
|
6132
|
-
}) : a.layout.adjustPositionOfElement({
|
|
6133
|
-
top: I,
|
|
6134
|
-
left: b
|
|
6135
|
-
});
|
|
6136
|
-
const F = h + b, T = m + I, E = new He({
|
|
6137
|
-
left: b,
|
|
6138
|
-
right: F,
|
|
6139
|
-
top: I,
|
|
6140
|
-
bottom: T,
|
|
6141
|
-
height: m,
|
|
6142
|
-
width: h,
|
|
6143
|
-
x: b,
|
|
6144
|
-
y: I
|
|
6145
|
-
});
|
|
6146
|
-
return {
|
|
6147
|
-
horizontalOffset: F,
|
|
6148
|
-
verticalOffset: T,
|
|
6149
|
-
layoutPosition: E
|
|
6150
|
-
};
|
|
6151
|
-
}
|
|
6152
|
-
a.layout.adjustPositionOfElement(
|
|
6153
|
-
t.isRTL() ? { right: n, top: 0 } : { left: n, top: 0 }
|
|
6154
|
-
);
|
|
6155
|
-
const y = t.isRTL() ? c.absoluteViewport.width - n - h : n, f = new He({
|
|
6156
|
-
right: t.isRTL() ? c.absoluteViewport.width - n : n + h,
|
|
6157
|
-
left: y,
|
|
6158
|
-
x: y,
|
|
6159
|
-
top: e,
|
|
6160
|
-
bottom: m,
|
|
6161
|
-
height: m,
|
|
6162
|
-
width: h,
|
|
6163
|
-
y: e
|
|
6164
|
-
});
|
|
6165
|
-
return {
|
|
6166
|
-
horizontalOffset: n + h,
|
|
6167
|
-
verticalOffset: 0,
|
|
6168
|
-
layoutPosition: f
|
|
6169
|
-
};
|
|
6170
|
-
})
|
|
6171
|
-
);
|
|
6172
|
-
};
|
|
6173
|
-
class Rs extends G {
|
|
6174
|
-
constructor(e, t, i, o) {
|
|
6175
|
-
super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new R(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
|
|
6176
|
-
x(() => {
|
|
6177
|
-
this.spineItemsRelativeLayouts = [];
|
|
6178
|
-
}),
|
|
6179
|
-
w((r) => {
|
|
6180
|
-
const a = r.map(
|
|
6181
|
-
(u) => u.needsLayout$.pipe(
|
|
6182
|
-
x(() => {
|
|
6183
|
-
this.layout();
|
|
6184
|
-
})
|
|
6185
|
-
)
|
|
6186
|
-
), c = r.map(
|
|
6187
|
-
(u) => u.loaded$.pipe(
|
|
6188
|
-
x(() => {
|
|
6189
|
-
u.isUsingVerticalWriting() ? this.context.update({
|
|
6190
|
-
hasVerticalWriting: !0
|
|
6191
|
-
}) : this.context.update({
|
|
6192
|
-
hasVerticalWriting: !1
|
|
6193
|
-
});
|
|
6194
|
-
})
|
|
6195
|
-
)
|
|
6196
|
-
);
|
|
6197
|
-
return P(...a, ...c);
|
|
6198
|
-
})
|
|
6199
|
-
).pipe($(this.destroy$)).subscribe();
|
|
6200
|
-
const s = new Y(!1);
|
|
6201
|
-
this.layout$ = this.layoutSubject.pipe(
|
|
6149
|
+
class Ds extends G {
|
|
6150
|
+
constructor(e, t, i, o, s) {
|
|
6151
|
+
super(), this.spineItemsManager = e, this.spineItemsObserver = t, this.context = i, this.settings = o, this.viewport = s, this.externalLayoutTrigger = new N(), this.spineItemsRelativeLayouts = [];
|
|
6152
|
+
const r = P(
|
|
6153
|
+
t.itemLoad$,
|
|
6154
|
+
t.itemUnload$
|
|
6155
|
+
), a = P(
|
|
6156
|
+
this.externalLayoutTrigger,
|
|
6157
|
+
r
|
|
6158
|
+
);
|
|
6159
|
+
this.layout$ = a.pipe(
|
|
6202
6160
|
x(() => {
|
|
6203
|
-
this.spineItemsManager.items.forEach((
|
|
6204
|
-
|
|
6161
|
+
this.spineItemsManager.items.forEach((c) => {
|
|
6162
|
+
c.markDirty();
|
|
6205
6163
|
});
|
|
6206
6164
|
}),
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6165
|
+
Ie(50),
|
|
6166
|
+
w(
|
|
6167
|
+
() => this.spineItemsManager.items.reduce(
|
|
6168
|
+
(c, u, l) => c.pipe(
|
|
6169
|
+
ln(({ horizontalOffset: d, verticalOffset: g }) => {
|
|
6170
|
+
const p = d % s.absoluteViewport.width === 0, h = l === e.items.length - 1, m = o.values.computedPageTurnDirection === "vertical", y = i.isRTL(), f = this.getSpreadPosition(
|
|
6171
|
+
p,
|
|
6172
|
+
y
|
|
6173
|
+
), { edgeX: I, edgeY: b } = this.getStartEdges(
|
|
6174
|
+
m,
|
|
6175
|
+
p,
|
|
6176
|
+
d,
|
|
6177
|
+
g,
|
|
6178
|
+
s.absoluteViewport.height
|
|
6179
|
+
);
|
|
6180
|
+
return u.layout({
|
|
6181
|
+
spreadPosition: f,
|
|
6182
|
+
horizontalOffset: d,
|
|
6183
|
+
isLastItem: h,
|
|
6184
|
+
edgeX: I,
|
|
6185
|
+
edgeY: b
|
|
6186
|
+
}).pipe(
|
|
6187
|
+
S(({ width: F, height: $ }) => {
|
|
6188
|
+
const L = this.createSpineItemLayout(
|
|
6189
|
+
m,
|
|
6190
|
+
y,
|
|
6191
|
+
I,
|
|
6192
|
+
b,
|
|
6193
|
+
F,
|
|
6194
|
+
$,
|
|
6195
|
+
s.absoluteViewport.width
|
|
6196
|
+
);
|
|
6197
|
+
return this.spineItemsRelativeLayouts[l] = L, {
|
|
6198
|
+
horizontalOffset: I + F,
|
|
6199
|
+
verticalOffset: m ? b + $ : 0
|
|
6200
|
+
};
|
|
6201
|
+
})
|
|
6202
|
+
);
|
|
6203
|
+
})
|
|
6204
|
+
),
|
|
6205
|
+
v({ horizontalOffset: 0, verticalOffset: 0 })
|
|
6213
6206
|
)
|
|
6214
6207
|
),
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
index: d,
|
|
6226
|
-
isGloballyPrePaginated: a,
|
|
6227
|
-
item: l,
|
|
6228
|
-
settings: this.settings,
|
|
6229
|
-
spineItemsManager: this.spineItemsManager,
|
|
6230
|
-
verticalOffset: g,
|
|
6231
|
-
viewport: o
|
|
6232
|
-
}).pipe(
|
|
6233
|
-
S(
|
|
6234
|
-
({
|
|
6235
|
-
horizontalOffset: h,
|
|
6236
|
-
verticalOffset: m,
|
|
6237
|
-
layoutPosition: y
|
|
6238
|
-
}) => (this.spineItemsRelativeLayouts[d] = y, {
|
|
6239
|
-
horizontalOffset: h,
|
|
6240
|
-
verticalOffset: m
|
|
6241
|
-
})
|
|
6242
|
-
)
|
|
6243
|
-
)
|
|
6244
|
-
)
|
|
6245
|
-
),
|
|
6246
|
-
v({ horizontalOffset: 0, verticalOffset: 0 })
|
|
6247
|
-
),
|
|
6248
|
-
st((u) => u),
|
|
6249
|
-
pe(() => {
|
|
6250
|
-
s.next(!1);
|
|
6251
|
-
})
|
|
6252
|
-
);
|
|
6208
|
+
T(this.destroy$),
|
|
6209
|
+
D()
|
|
6210
|
+
), this.layout$.subscribe(), this.watchForVerticalWritingUpdate();
|
|
6211
|
+
}
|
|
6212
|
+
watchForVerticalWritingUpdate() {
|
|
6213
|
+
this.spineItemsObserver.itemLoad$.pipe(
|
|
6214
|
+
x((e) => {
|
|
6215
|
+
this.context.update({
|
|
6216
|
+
hasVerticalWriting: e.isUsingVerticalWriting()
|
|
6217
|
+
});
|
|
6253
6218
|
}),
|
|
6254
|
-
|
|
6255
|
-
)
|
|
6219
|
+
T(this.destroy$)
|
|
6220
|
+
).subscribe();
|
|
6256
6221
|
}
|
|
6257
6222
|
layout() {
|
|
6258
|
-
this.
|
|
6223
|
+
this.externalLayoutTrigger.next(void 0);
|
|
6259
6224
|
}
|
|
6260
6225
|
getSpineItemSpineLayoutInfo(e) {
|
|
6261
6226
|
const t = this.spineItemsManager.getSpineItemIndex(e) ?? 0;
|
|
6262
|
-
return this.spineItemsRelativeLayouts[t] || new
|
|
6227
|
+
return this.spineItemsRelativeLayouts[t] || new Oe({
|
|
6263
6228
|
left: 0,
|
|
6264
6229
|
right: 0,
|
|
6265
6230
|
top: 0,
|
|
@@ -6274,15 +6239,54 @@ class Rs extends G {
|
|
|
6274
6239
|
return this.spineItemsManager.items.reduce((e, t) => e + t.numberOfPages, 0);
|
|
6275
6240
|
}
|
|
6276
6241
|
destroy() {
|
|
6277
|
-
super.destroy(), this.
|
|
6242
|
+
super.destroy(), this.externalLayoutTrigger.complete();
|
|
6243
|
+
}
|
|
6244
|
+
getSpreadPosition(e, t) {
|
|
6245
|
+
return this.settings.values.computedSpreadMode ? e ? t ? "right" : "left" : t ? "left" : "right" : "none";
|
|
6246
|
+
}
|
|
6247
|
+
getStartEdges(e, t, i, o, s) {
|
|
6248
|
+
return e ? {
|
|
6249
|
+
edgeX: t ? 0 : i,
|
|
6250
|
+
edgeY: t ? o : o - s
|
|
6251
|
+
} : {
|
|
6252
|
+
edgeX: i,
|
|
6253
|
+
edgeY: 0
|
|
6254
|
+
};
|
|
6255
|
+
}
|
|
6256
|
+
createSpineItemLayout(e, t, i, o, s, r, a) {
|
|
6257
|
+
if (e) {
|
|
6258
|
+
const u = s + i, l = r + o;
|
|
6259
|
+
return new Oe({
|
|
6260
|
+
left: i,
|
|
6261
|
+
right: u,
|
|
6262
|
+
top: o,
|
|
6263
|
+
bottom: l,
|
|
6264
|
+
height: r,
|
|
6265
|
+
width: s,
|
|
6266
|
+
x: i,
|
|
6267
|
+
y: o
|
|
6268
|
+
});
|
|
6269
|
+
}
|
|
6270
|
+
const c = t ? a - i - s : i;
|
|
6271
|
+
return new Oe({
|
|
6272
|
+
right: t ? a - i : i + s,
|
|
6273
|
+
left: c,
|
|
6274
|
+
x: c,
|
|
6275
|
+
top: o,
|
|
6276
|
+
bottom: r,
|
|
6277
|
+
height: r,
|
|
6278
|
+
width: s,
|
|
6279
|
+
y: o
|
|
6280
|
+
});
|
|
6278
6281
|
}
|
|
6279
6282
|
}
|
|
6280
6283
|
class As extends G {
|
|
6281
6284
|
constructor(e, t, i, o, s, r, a) {
|
|
6282
|
-
super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spineItemLocator = o, this.settings = s, this.hookManager = r, this.viewport = a, this.elementSubject = new
|
|
6285
|
+
super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spineItemLocator = o, this.settings = s, this.hookManager = r, this.viewport = a, this.elementSubject = new q(
|
|
6283
6286
|
void 0
|
|
6284
|
-
), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new
|
|
6287
|
+
), this.element$ = this.elementSubject.asObservable(), this.spineItemsObserver = new Es(i), this.spineLayout = new Ds(
|
|
6285
6288
|
i,
|
|
6289
|
+
this.spineItemsObserver,
|
|
6286
6290
|
e,
|
|
6287
6291
|
s,
|
|
6288
6292
|
a
|
|
@@ -6299,9 +6303,6 @@ class As extends G {
|
|
|
6299
6303
|
this.locator,
|
|
6300
6304
|
s,
|
|
6301
6305
|
this.spineLayout
|
|
6302
|
-
), this.spineItemsObserver = new Es(
|
|
6303
|
-
i,
|
|
6304
|
-
this.locator
|
|
6305
6306
|
), this.pages = new Cs(
|
|
6306
6307
|
this.spineLayout,
|
|
6307
6308
|
this.spineItemsManager,
|
|
@@ -6311,24 +6312,24 @@ class As extends G {
|
|
|
6311
6312
|
this.viewport
|
|
6312
6313
|
);
|
|
6313
6314
|
const c = e.watch("rootElement").pipe(
|
|
6314
|
-
|
|
6315
|
-
|
|
6315
|
+
pe(Z),
|
|
6316
|
+
V((l) => {
|
|
6316
6317
|
const d = l.ownerDocument.createElement("div");
|
|
6317
6318
|
d.style.cssText = `
|
|
6318
6319
|
height: 100%;
|
|
6319
6320
|
position: relative;
|
|
6320
6321
|
`, d.className = `${W}-spine`, this.elementSubject.next(d);
|
|
6321
6322
|
})
|
|
6322
|
-
), u =
|
|
6323
|
+
), u = j([
|
|
6323
6324
|
this.context.manifest$,
|
|
6324
6325
|
this.element$
|
|
6325
6326
|
]).pipe(
|
|
6326
|
-
|
|
6327
|
+
V(([l, d]) => {
|
|
6327
6328
|
if (!d) return;
|
|
6328
6329
|
this.spineItemsManager.destroyItems();
|
|
6329
|
-
const
|
|
6330
|
-
(
|
|
6331
|
-
|
|
6330
|
+
const g = l.spineItems.map(
|
|
6331
|
+
(p, h) => new Zt(
|
|
6332
|
+
p,
|
|
6332
6333
|
d,
|
|
6333
6334
|
this.context,
|
|
6334
6335
|
this.settings,
|
|
@@ -6337,7 +6338,7 @@ class As extends G {
|
|
|
6337
6338
|
this.viewport
|
|
6338
6339
|
)
|
|
6339
6340
|
);
|
|
6340
|
-
this.spineItemsManager.addMany(
|
|
6341
|
+
this.spineItemsManager.addMany(g);
|
|
6341
6342
|
})
|
|
6342
6343
|
);
|
|
6343
6344
|
P(u, c).pipe(K(this.destroy$)).subscribe();
|
|
@@ -6360,7 +6361,7 @@ class As extends G {
|
|
|
6360
6361
|
}
|
|
6361
6362
|
class Ns extends G {
|
|
6362
6363
|
constructor(e, t) {
|
|
6363
|
-
super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new
|
|
6364
|
+
super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new q([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
|
|
6364
6365
|
}
|
|
6365
6366
|
get(e) {
|
|
6366
6367
|
return typeof e == "number" ? this.orderedSpineItemsSubject.value[e] : typeof e == "string" ? this.orderedSpineItemsSubject.value.find(
|
|
@@ -6372,7 +6373,7 @@ class Ns extends G {
|
|
|
6372
6373
|
return i > o ? "after" : i === o ? "same" : "before";
|
|
6373
6374
|
}
|
|
6374
6375
|
getSpineItemIndex(e) {
|
|
6375
|
-
const t = e instanceof
|
|
6376
|
+
const t = e instanceof Zt ? e : this.get(e);
|
|
6376
6377
|
if (!t) return;
|
|
6377
6378
|
const i = this.orderedSpineItemsSubject.value.indexOf(t);
|
|
6378
6379
|
return i < 0 ? void 0 : i;
|
|
@@ -6401,7 +6402,7 @@ class Ns extends G {
|
|
|
6401
6402
|
});
|
|
6402
6403
|
}
|
|
6403
6404
|
}
|
|
6404
|
-
class
|
|
6405
|
+
class Rs extends Q {
|
|
6405
6406
|
constructor(e, t) {
|
|
6406
6407
|
const i = document.createElement("div");
|
|
6407
6408
|
i.setAttribute(`data-${oi}`, ""), super({
|
|
@@ -6424,7 +6425,7 @@ class Os extends Q {
|
|
|
6424
6425
|
this.layout();
|
|
6425
6426
|
})
|
|
6426
6427
|
);
|
|
6427
|
-
P(o, s).pipe(
|
|
6428
|
+
P(o, s).pipe(T(this.destroy$)).subscribe();
|
|
6428
6429
|
}
|
|
6429
6430
|
calculatePageSize(e) {
|
|
6430
6431
|
const { computedSpreadMode: t } = this.settingsManager.values;
|
|
@@ -6478,12 +6479,12 @@ class Os extends Q {
|
|
|
6478
6479
|
});
|
|
6479
6480
|
}
|
|
6480
6481
|
}
|
|
6481
|
-
const
|
|
6482
|
-
const e = crypto.randomUUID(), t = new
|
|
6482
|
+
const xt = `${Vt}-core`, Os = (n) => {
|
|
6483
|
+
const e = crypto.randomUUID(), t = new N(), i = new N(), o = new Ao(), s = new Eo(), r = new fs(n, s), a = new Do(s, r), c = new Ns(s, r), u = new Rs(s, r), l = qt({
|
|
6483
6484
|
context: s,
|
|
6484
6485
|
settings: r,
|
|
6485
6486
|
viewport: u
|
|
6486
|
-
}), d = new ps(s, c),
|
|
6487
|
+
}), d = new ps(s, c), g = new As(
|
|
6487
6488
|
s,
|
|
6488
6489
|
d,
|
|
6489
6490
|
c,
|
|
@@ -6491,64 +6492,61 @@ const $t = `${Ut}-core`, Vs = (n) => {
|
|
|
6491
6492
|
r,
|
|
6492
6493
|
o,
|
|
6493
6494
|
u
|
|
6494
|
-
),
|
|
6495
|
+
), p = ds({
|
|
6495
6496
|
context: s,
|
|
6496
6497
|
spineItemsManager: c,
|
|
6497
6498
|
hookManager: o,
|
|
6498
|
-
spine:
|
|
6499
|
+
spine: g,
|
|
6499
6500
|
settings: r,
|
|
6500
6501
|
viewport: u
|
|
6501
6502
|
}), h = new gs(
|
|
6502
6503
|
s,
|
|
6503
6504
|
d,
|
|
6504
6505
|
c,
|
|
6505
|
-
|
|
6506
|
+
g,
|
|
6506
6507
|
l
|
|
6507
6508
|
);
|
|
6508
|
-
|
|
6509
|
+
p.navigationState$.subscribe(s.bridgeEvent.viewportStateSubject), p.navigation$.subscribe(s.bridgeEvent.navigationSubject), p.locker.isLocked$.subscribe(
|
|
6509
6510
|
s.bridgeEvent.navigationIsLockedSubject
|
|
6510
6511
|
), d.subscribe(s.bridgeEvent.paginationSubject);
|
|
6511
6512
|
const m = () => {
|
|
6512
6513
|
t.next();
|
|
6513
|
-
}, y = (
|
|
6514
|
-
const { containerElement:
|
|
6514
|
+
}, y = ($) => {
|
|
6515
|
+
const { containerElement: L, manifest: H } = $;
|
|
6515
6516
|
if (s.manifest) {
|
|
6516
|
-
|
|
6517
|
+
A.warn("loading a new book is not supported yet");
|
|
6517
6518
|
return;
|
|
6518
6519
|
}
|
|
6519
|
-
|
|
6520
|
-
const B =
|
|
6520
|
+
A.log("load", { options: $ });
|
|
6521
|
+
const B = Vs(L, e);
|
|
6521
6522
|
s.update({
|
|
6522
6523
|
manifest: H,
|
|
6523
6524
|
rootElement: B
|
|
6524
6525
|
}), m();
|
|
6525
|
-
}, f = r.watch(["computedSpreadMode"]).pipe(
|
|
6526
|
-
|
|
6527
|
-
const
|
|
6528
|
-
|
|
6526
|
+
}, f = r.watch(["computedSpreadMode"]).pipe(Lt(1), V(m)), I = t.pipe(
|
|
6527
|
+
V(() => {
|
|
6528
|
+
const $ = s.value.rootElement;
|
|
6529
|
+
$ && ($.style.setProperty("overflow", "hidden"), u.layout(), g.layout());
|
|
6529
6530
|
}),
|
|
6530
6531
|
K(i)
|
|
6531
6532
|
), b = P(I, f).subscribe();
|
|
6532
|
-
Ce(document,
|
|
6533
|
+
Ce(document, xt, No);
|
|
6533
6534
|
const F = () => {
|
|
6534
|
-
Ee(document,
|
|
6535
|
+
Ee(document, xt), 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
6536
|
};
|
|
6536
6537
|
return {
|
|
6537
6538
|
id: e,
|
|
6538
6539
|
context: s,
|
|
6539
|
-
spine:
|
|
6540
|
+
spine: g,
|
|
6540
6541
|
hookManager: o,
|
|
6541
6542
|
cfi: {
|
|
6542
6543
|
generateCfiFromRange: io,
|
|
6543
6544
|
parseCfi: it,
|
|
6544
|
-
generateCfiForSpineItemPage:
|
|
6545
|
-
|
|
6546
|
-
spine: p
|
|
6547
|
-
}),
|
|
6548
|
-
resolveCfi: (T) => Xt({ ...T, spineItemsManager: c })
|
|
6545
|
+
generateCfiForSpineItemPage: He,
|
|
6546
|
+
resolveCfi: ($) => _t({ ...$, spineItemsManager: c })
|
|
6549
6547
|
},
|
|
6550
|
-
navigation:
|
|
6551
|
-
spineItemsObserver:
|
|
6548
|
+
navigation: p,
|
|
6549
|
+
spineItemsObserver: g.spineItemsObserver,
|
|
6552
6550
|
spineItemsManager: c,
|
|
6553
6551
|
layout: m,
|
|
6554
6552
|
load: y,
|
|
@@ -6562,7 +6560,7 @@ const $t = `${Ut}-core`, Vs = (n) => {
|
|
|
6562
6560
|
}
|
|
6563
6561
|
},
|
|
6564
6562
|
settings: r,
|
|
6565
|
-
renderHeadless: (
|
|
6563
|
+
renderHeadless: ($) => c.get($)?.renderer.renderHeadless() ?? v(void 0),
|
|
6566
6564
|
viewport: u,
|
|
6567
6565
|
viewportState$: s.bridgeEvent.viewportState$,
|
|
6568
6566
|
viewportFree$: s.bridgeEvent.viewportFree$,
|
|
@@ -6573,18 +6571,18 @@ const $t = `${Ut}-core`, Vs = (n) => {
|
|
|
6573
6571
|
* It can typically be used to hide a loading indicator.
|
|
6574
6572
|
*/
|
|
6575
6573
|
state$: s.manifest$.pipe(
|
|
6576
|
-
ie((
|
|
6574
|
+
ie(($) => $ ? "ready" : "idle")
|
|
6577
6575
|
),
|
|
6578
6576
|
features: a,
|
|
6579
6577
|
$: {
|
|
6580
6578
|
destroy$: i
|
|
6581
6579
|
}
|
|
6582
6580
|
};
|
|
6583
|
-
},
|
|
6581
|
+
}, Vs = (n, e) => (n.style.cssText = `
|
|
6584
6582
|
${n.style.cssText}
|
|
6585
6583
|
background-color: white;
|
|
6586
6584
|
position: relative;
|
|
6587
|
-
`, n.classList.add(`${W}-reader`), n.setAttribute(ii, e), n.setAttribute("data-prose-reader-container", e), n),
|
|
6585
|
+
`, n.classList.add(`${W}-reader`), n.setAttribute(ii, e), n.setAttribute("data-prose-reader-container", e), n), Js = (
|
|
6588
6586
|
//__
|
|
6589
6587
|
yo(
|
|
6590
6588
|
Gn(
|
|
@@ -6596,14 +6594,14 @@ const $t = `${Ut}-core`, Vs = (n) => {
|
|
|
6596
6594
|
Mo(
|
|
6597
6595
|
Xi(
|
|
6598
6596
|
yi(
|
|
6599
|
-
|
|
6597
|
+
Ni(
|
|
6600
6598
|
zn(
|
|
6601
6599
|
Bn(
|
|
6602
6600
|
co(
|
|
6603
6601
|
Di(
|
|
6604
6602
|
So(
|
|
6605
6603
|
// __
|
|
6606
|
-
|
|
6604
|
+
Os
|
|
6607
6605
|
)
|
|
6608
6606
|
)
|
|
6609
6607
|
)
|
|
@@ -6620,26 +6618,26 @@ const $t = `${Ut}-core`, Vs = (n) => {
|
|
|
6620
6618
|
)
|
|
6621
6619
|
)
|
|
6622
6620
|
)
|
|
6623
|
-
),
|
|
6621
|
+
), Ks = (n) => (e) => n(e);
|
|
6624
6622
|
export {
|
|
6625
|
-
|
|
6623
|
+
kt as AbstractSpinePosition,
|
|
6626
6624
|
Eo as Context,
|
|
6627
6625
|
jo as ControlledNavigationController,
|
|
6628
6626
|
G as DestroyableClass,
|
|
6629
|
-
|
|
6627
|
+
ye as DocumentRenderer,
|
|
6630
6628
|
Do as Features,
|
|
6631
6629
|
ii as HTML_ATTRIBUTE_DATA_READER_ID,
|
|
6632
6630
|
W as HTML_PREFIX,
|
|
6633
6631
|
si as HTML_PREFIX_SCROLL_NAVIGATOR,
|
|
6634
6632
|
oi as HTML_PREFIX_VIEWPORT,
|
|
6635
|
-
|
|
6636
|
-
|
|
6633
|
+
Vt as HTML_STYLE_PREFIX,
|
|
6634
|
+
Ao as HookManager,
|
|
6637
6635
|
ni as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
|
|
6638
6636
|
Ko as InternalNavigator,
|
|
6639
6637
|
nt as LayoutEntry,
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6638
|
+
Xt as Locker,
|
|
6639
|
+
qs as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
|
|
6640
|
+
Xs as PROSE_READER_NAMESPACE,
|
|
6643
6641
|
Cs as Pages,
|
|
6644
6642
|
ps as Pagination,
|
|
6645
6643
|
gs as PaginationController,
|
|
@@ -6647,56 +6645,56 @@ export {
|
|
|
6647
6645
|
tt as ResourceHandler,
|
|
6648
6646
|
ao as ResourcesLocator,
|
|
6649
6647
|
$o as ScrollNavigationController,
|
|
6650
|
-
|
|
6648
|
+
mt as ScrollPosition,
|
|
6651
6649
|
ms as SettingsManager,
|
|
6652
6650
|
As as Spine,
|
|
6653
|
-
|
|
6651
|
+
Zt as SpineItem,
|
|
6654
6652
|
Si as SpineItemPageLayout,
|
|
6655
6653
|
Ii as SpineItemPageSpineLayout,
|
|
6656
|
-
|
|
6657
|
-
|
|
6654
|
+
E as SpineItemPosition,
|
|
6655
|
+
Oe as SpineItemSpineLayout,
|
|
6658
6656
|
Ns as SpineItemsManager,
|
|
6659
6657
|
Es as SpineItemsObserver,
|
|
6660
|
-
|
|
6658
|
+
M as SpinePosition,
|
|
6661
6659
|
xo as UnboundScrollPosition,
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6660
|
+
Re as UnboundSpineItemPagePosition,
|
|
6661
|
+
ae as UnboundSpinePosition,
|
|
6662
|
+
Ys as VIEWPORT_ADJUSTMENT_THROTTLE,
|
|
6663
|
+
Rs as Viewport,
|
|
6666
6664
|
ro as consolidate,
|
|
6667
|
-
|
|
6668
|
-
|
|
6665
|
+
Js as createReader,
|
|
6666
|
+
at as deferIdle,
|
|
6669
6667
|
Xn as deferNextResult,
|
|
6670
|
-
|
|
6668
|
+
He as generateCfiForSpineItemPage,
|
|
6671
6669
|
io as generateCfiFromRange,
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6670
|
+
de as generateRootCfi,
|
|
6671
|
+
rt as getAttributeValueFromString,
|
|
6672
|
+
Hs as getBase64FromBlob,
|
|
6673
|
+
Je as getFrameViewportInfo,
|
|
6674
|
+
Zs as getItemAnchor,
|
|
6677
6675
|
yi as htmlEnhancer,
|
|
6678
|
-
|
|
6676
|
+
et as idle,
|
|
6679
6677
|
Vn as injectCSSToFrame,
|
|
6680
6678
|
Z as isDefined,
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6679
|
+
At as isHtmlElement,
|
|
6680
|
+
Rn as isHtmlTagElement,
|
|
6681
|
+
Be as isRootCfi,
|
|
6682
|
+
tr as isShallowEqual,
|
|
6685
6683
|
Di as layoutEnhancer,
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6684
|
+
Nt as mapKeysTo,
|
|
6685
|
+
_s as observeIntersection,
|
|
6686
|
+
ct as observeMutation,
|
|
6687
|
+
Qe as observeResize,
|
|
6690
6688
|
co as paginationEnhancer,
|
|
6691
6689
|
it as parseCfi,
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6690
|
+
Ws as removeCSS,
|
|
6691
|
+
_t as resolveCfi,
|
|
6692
|
+
Ks as rootEnhancer,
|
|
6695
6693
|
Ms as spinePositionToSpineItemSpineLayout,
|
|
6696
6694
|
oe as upsertCSSToFrame,
|
|
6697
6695
|
jn as waitForFrameLoad,
|
|
6698
6696
|
kn as waitForFrameReady,
|
|
6699
6697
|
De as waitForSwitch,
|
|
6700
|
-
|
|
6698
|
+
Ke as watchKeys
|
|
6701
6699
|
};
|
|
6702
6700
|
//# sourceMappingURL=index.js.map
|