@prose-reader/core 1.231.0 → 1.233.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/parse.d.ts +3 -2
- package/dist/cfi/resolve.d.ts +8 -14
- package/dist/createReaderWithEnhancer.d.ts +14 -15
- package/dist/enhancers/html/renderer/HtmlRenderer.d.ts +1 -1
- package/dist/enhancers/pagination/ResourcesLocator.d.ts +2 -1
- package/dist/index.js +1036 -1061
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +29 -29
- package/dist/index.umd.cjs.map +1 -1
- package/dist/reader.d.ts +14 -15
- package/dist/spine/Pages.d.ts +2 -0
- package/dist/spine/locator/SpineLocator.d.ts +0 -7
- package/dist/utils/frames.d.ts +1 -1
- package/package.json +4 -4
- package/dist/spine/locator/getSpineInfoFromAbsolutePageIndex.d.ts +0 -17
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { switchMap as P, of as w, fromEvent as q, take as we, map as S, from as j, takeUntil as T, Observable as ot, defer as kt, Subject as W, combineLatest as B, merge as v, EMPTY as Q, withLatestFrom as A, NEVER as gt, tap as $, share as V, BehaviorSubject as U, filter as M, first as z, mergeMap as $t, endWith as
|
|
1
|
+
import { switchMap as P, of as w, fromEvent as q, take as we, map as S, from as j, takeUntil as T, Observable as ot, defer as kt, Subject as W, combineLatest as B, merge as v, EMPTY as Q, withLatestFrom as A, NEVER as gt, tap as $, share as V, BehaviorSubject as U, filter as M, first as z, mergeMap as $t, endWith as mt, finalize as dt, catchError as Pe, lastValueFrom as ei, scheduled as ii, animationFrameScheduler as rt, distinctUntilChanged as H, throttleTime as ni, debounceTime as St, startWith as it, switchScan as oi, shareReplay as tt, defaultIfEmpty as si, forkJoin as ri, delay as wt, ReplaySubject as ie, skip as ve, identity as Pt, exhaustMap as Wt, timer as ne, reduce as ai, concatMap as oe } from "rxjs";
|
|
2
2
|
import { Report as ci, isShallowEqual as N, shallowMergeIfDefined as vt, getParentPath as ui, parseContentType as di, detectMimeTypeFromName as Mt, arrayEqual as gi } from "@prose-reader/shared";
|
|
3
|
-
import { isShallowEqual as
|
|
3
|
+
import { isShallowEqual as Ws } from "@prose-reader/shared";
|
|
4
4
|
import { switchMap as _, first as xe, map as Y, distinctUntilChanged as Z, startWith as $e, shareReplay as bt, tap as k, pairwise as li, take as pi, takeUntil as G, filter as K, debounceTime as hi, skip as mi, mergeMap as fi, catchError as se, withLatestFrom as yi } from "rxjs/operators";
|
|
5
5
|
import { generate as Ut, parse as Te, isIndirectionOnly as Si, isParsedCfiRange as bi, resolve as Ii } from "@prose-reader/cfi";
|
|
6
6
|
import { isDefined as qt } from "reactjrx";
|
|
@@ -8,19 +8,27 @@ const re = (e, t) => {
|
|
|
8
8
|
const i = new RegExp(`${t}\\s*=\\s*([0-9.]+)`, "i"), n = e.match(i) || [], o = n[1] || "0";
|
|
9
9
|
return n && Number.parseFloat(o) || 0;
|
|
10
10
|
}, wi = (e, t, i, n) => {
|
|
11
|
-
var
|
|
12
|
-
if ((
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, Pi = (e, t) => {
|
|
11
|
+
var s;
|
|
12
|
+
if (!((s = e == null ? void 0 : e.contentDocument) != null && s.head)) return;
|
|
13
|
+
const o = e.contentDocument.createElement("style");
|
|
14
|
+
o.id = t, o.innerHTML = i, n ? e.contentDocument.head.prepend(o) : e.contentDocument.head.appendChild(o);
|
|
15
|
+
}, Cs = (e, t) => {
|
|
17
16
|
var i;
|
|
18
17
|
if ((i = e == null ? void 0 : e.contentDocument) != null && i.head) {
|
|
19
18
|
const n = e.contentDocument.getElementById(t);
|
|
20
19
|
n && n.remove();
|
|
21
20
|
}
|
|
22
21
|
}, nt = (e, t, i, n) => {
|
|
23
|
-
|
|
22
|
+
var s;
|
|
23
|
+
if (!e) return;
|
|
24
|
+
const o = (s = e == null ? void 0 : e.contentDocument) == null ? void 0 : s.getElementById(
|
|
25
|
+
t
|
|
26
|
+
);
|
|
27
|
+
if (o) {
|
|
28
|
+
o.innerHTML = i;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
wi(e, t, i, n);
|
|
24
32
|
}, Zt = (e) => {
|
|
25
33
|
if (e != null && e.contentDocument) {
|
|
26
34
|
const i = e.contentDocument.querySelector("meta[name='viewport']");
|
|
@@ -37,7 +45,7 @@ const re = (e, t) => {
|
|
|
37
45
|
}
|
|
38
46
|
}
|
|
39
47
|
return { hasViewport: !1 };
|
|
40
|
-
},
|
|
48
|
+
}, Pi = (e) => e.pipe(
|
|
41
49
|
P((t) => {
|
|
42
50
|
var i;
|
|
43
51
|
return t.src === "about:blank" && ((i = t.contentDocument) == null ? void 0 : i.readyState) === "complete" && t.contentDocument.body ? w(t) : q(t, "load").pipe(
|
|
@@ -45,16 +53,13 @@ const re = (e, t) => {
|
|
|
45
53
|
S(() => t)
|
|
46
54
|
);
|
|
47
55
|
})
|
|
48
|
-
),
|
|
49
|
-
P(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
)
|
|
57
|
-
), $i = (e) => (t) => {
|
|
56
|
+
), vi = (e) => e.pipe(
|
|
57
|
+
P((t) => {
|
|
58
|
+
var n;
|
|
59
|
+
const i = (n = t == null ? void 0 : t.contentDocument) == null ? void 0 : n.fonts.ready;
|
|
60
|
+
return i ? j(i).pipe(S(() => t)) : w(void 0);
|
|
61
|
+
})
|
|
62
|
+
), xi = (e) => (t) => {
|
|
58
63
|
const i = e(t), n = new IntersectionObserver((o) => {
|
|
59
64
|
o.forEach((s) => {
|
|
60
65
|
s.isIntersecting ? s.target.removeAttribute("tab-index") : s.target.setAttribute("tab-index", "-1");
|
|
@@ -64,12 +69,12 @@ const re = (e, t) => {
|
|
|
64
69
|
"item.onDocumentLoad",
|
|
65
70
|
({ itemId: o, destroy: s }) => {
|
|
66
71
|
var u;
|
|
67
|
-
const
|
|
68
|
-
if (!r) return;
|
|
69
|
-
const a = r.renderer.getDocumentFrame();
|
|
72
|
+
const a = i.spineItemsManager.get(o);
|
|
70
73
|
if (!a) return;
|
|
74
|
+
const r = a.renderer.getDocumentFrame();
|
|
75
|
+
if (!r) return;
|
|
71
76
|
nt(
|
|
72
|
-
|
|
77
|
+
r,
|
|
73
78
|
"prose-reader-accessibility",
|
|
74
79
|
`
|
|
75
80
|
:focus-visible {
|
|
@@ -78,7 +83,7 @@ const re = (e, t) => {
|
|
|
78
83
|
}
|
|
79
84
|
`
|
|
80
85
|
);
|
|
81
|
-
const c = (u =
|
|
86
|
+
const c = (u = r.contentDocument) == null ? void 0 : u.body.querySelectorAll("a");
|
|
82
87
|
c == null || c.forEach((d) => {
|
|
83
88
|
n.observe(d);
|
|
84
89
|
}), s(() => {
|
|
@@ -90,7 +95,7 @@ const re = (e, t) => {
|
|
|
90
95
|
), {
|
|
91
96
|
...i
|
|
92
97
|
};
|
|
93
|
-
},
|
|
98
|
+
}, $i = (e) => (t) => {
|
|
94
99
|
const i = e(t);
|
|
95
100
|
return i.context.state$.pipe(T(i.$.destroy$)).subscribe(({ rootElement: n }) => {
|
|
96
101
|
if (!n) return;
|
|
@@ -99,13 +104,13 @@ const re = (e, t) => {
|
|
|
99
104
|
};
|
|
100
105
|
n.addEventListener("scroll", o);
|
|
101
106
|
}), i.hookManager.register("item.onDocumentLoad", ({ itemId: n }) => {
|
|
102
|
-
var
|
|
107
|
+
var a;
|
|
103
108
|
const o = i.spineItemsManager.get(n), s = o == null ? void 0 : o.renderer.getDocumentFrame();
|
|
104
|
-
s && ((
|
|
109
|
+
s && ((a = s.contentDocument) == null || a.body.setAttribute("tabindex", "-1"));
|
|
105
110
|
}), i;
|
|
106
|
-
},
|
|
111
|
+
}, Ti = "@prose-reader/core", O = ci.namespace(Ti, void 0, {
|
|
107
112
|
color: "#98cde7"
|
|
108
|
-
}),
|
|
113
|
+
}), Fi = [
|
|
109
114
|
"pointercancel",
|
|
110
115
|
"pointerdown",
|
|
111
116
|
"pointerenter",
|
|
@@ -117,24 +122,24 @@ const re = (e, t) => {
|
|
|
117
122
|
// `touchstart` as const,
|
|
118
123
|
// `touchend` as const,
|
|
119
124
|
];
|
|
120
|
-
function
|
|
125
|
+
function Li(e, t, i) {
|
|
121
126
|
if ("caretPositionFromPoint" in e)
|
|
122
127
|
return e.caretPositionFromPoint(t, i);
|
|
123
128
|
if ("caretRangeFromPoint" in e && // @ts-expect-error limited availability
|
|
124
129
|
typeof e.caretRangeFromPoint < "u")
|
|
125
130
|
return e.caretRangeFromPoint(t, i);
|
|
126
131
|
}
|
|
127
|
-
const
|
|
132
|
+
const Mi = (e, t) => {
|
|
128
133
|
const i = "body" in e ? zt(e.body, t) : zt(e, t), n = "createRange" in e ? e : e.ownerDocument;
|
|
129
134
|
if (i) {
|
|
130
135
|
let o, s = 0;
|
|
131
|
-
const
|
|
132
|
-
return Array.from(i.childNodes).some((
|
|
133
|
-
|
|
134
|
-
const c =
|
|
136
|
+
const a = n.createRange();
|
|
137
|
+
return Array.from(i.childNodes).some((r) => {
|
|
138
|
+
a.selectNodeContents(r);
|
|
139
|
+
const c = a.getClientRects(), u = Ci(c, t);
|
|
135
140
|
if (u) {
|
|
136
|
-
o =
|
|
137
|
-
const d =
|
|
141
|
+
o = a.cloneRange();
|
|
142
|
+
const d = Li(
|
|
138
143
|
n,
|
|
139
144
|
Math.ceil(u.left),
|
|
140
145
|
Math.ceil(u.top)
|
|
@@ -158,13 +163,13 @@ const Ci = (e, t) => {
|
|
|
158
163
|
function Fe(e, { left: t, right: i }) {
|
|
159
164
|
return e.left <= t && e.right <= t ? "before" : e.left <= t && e.right > t && e.right <= i ? "partially-before" : e.left <= i && e.right > i ? "partially-after" : e.left > i ? "after" : "within";
|
|
160
165
|
}
|
|
161
|
-
function
|
|
166
|
+
function Ci(e, t) {
|
|
162
167
|
return Array.from(e).find((i) => {
|
|
163
168
|
const n = Fe(i, t);
|
|
164
169
|
return n !== "before" && n !== "after";
|
|
165
170
|
});
|
|
166
171
|
}
|
|
167
|
-
const
|
|
172
|
+
const Ri = (e, t) => {
|
|
168
173
|
var i;
|
|
169
174
|
if (e.nodeType !== Node.CDATA_SECTION_NODE && e.nodeType !== Node.DOCUMENT_TYPE_NODE) {
|
|
170
175
|
const n = (i = e.ownerDocument) == null ? void 0 : i.createRange();
|
|
@@ -179,41 +184,41 @@ const Ai = (e, t) => {
|
|
|
179
184
|
}, Gt = (e) => {
|
|
180
185
|
var t, i, n, o, s;
|
|
181
186
|
if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
|
|
182
|
-
const
|
|
183
|
-
if (
|
|
187
|
+
const a = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
|
|
188
|
+
if (a.PointerEvent && e instanceof a.PointerEvent)
|
|
184
189
|
return !0;
|
|
185
190
|
}
|
|
186
191
|
if ((s = e == null ? void 0 : e.view) != null && s.window) {
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
192
|
+
const a = e == null ? void 0 : e.view;
|
|
193
|
+
if (a.PointerEvent && e instanceof a.PointerEvent)
|
|
189
194
|
return !0;
|
|
190
195
|
}
|
|
191
|
-
return !!
|
|
192
|
-
},
|
|
196
|
+
return !!Fi.includes(e.type);
|
|
197
|
+
}, Ai = (e) => {
|
|
193
198
|
var t, i, n, o, s;
|
|
194
199
|
if (Gt(e)) return !1;
|
|
195
200
|
if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
198
|
-
return e instanceof
|
|
201
|
+
const a = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
|
|
202
|
+
if (a.MouseEvent)
|
|
203
|
+
return e instanceof a.MouseEvent;
|
|
199
204
|
}
|
|
200
205
|
if ((s = e == null ? void 0 : e.view) != null && s.window) {
|
|
201
|
-
const
|
|
202
|
-
if (
|
|
203
|
-
return e instanceof
|
|
206
|
+
const a = e == null ? void 0 : e.view;
|
|
207
|
+
if (a.MouseEvent)
|
|
208
|
+
return e instanceof a.MouseEvent;
|
|
204
209
|
}
|
|
205
210
|
return !1;
|
|
206
|
-
},
|
|
211
|
+
}, Di = (e) => {
|
|
207
212
|
var t, i, n, o, s;
|
|
208
213
|
if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
return e instanceof
|
|
214
|
+
const a = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
|
|
215
|
+
if (a.TouchEvent)
|
|
216
|
+
return e instanceof a.TouchEvent;
|
|
212
217
|
}
|
|
213
218
|
if ((s = e == null ? void 0 : e.view) != null && s.window) {
|
|
214
|
-
const
|
|
215
|
-
if (
|
|
216
|
-
return e instanceof
|
|
219
|
+
const a = e == null ? void 0 : e.view;
|
|
220
|
+
if (a.TouchEvent)
|
|
221
|
+
return e instanceof a.TouchEvent;
|
|
217
222
|
}
|
|
218
223
|
return !1;
|
|
219
224
|
}, Le = () => document.createElement("div"), Me = (e) => {
|
|
@@ -232,7 +237,7 @@ const Ai = (e, t) => {
|
|
|
232
237
|
// JavaScript files
|
|
233
238
|
].join(",");
|
|
234
239
|
return Array.from((e == null ? void 0 : e.querySelectorAll(t)) || []);
|
|
235
|
-
},
|
|
240
|
+
}, Ni = (e) => {
|
|
236
241
|
if (Me(e).forEach((i) => {
|
|
237
242
|
var o;
|
|
238
243
|
const n = i.getAttribute("src") || i.getAttribute("href");
|
|
@@ -243,8 +248,8 @@ const Ai = (e, t) => {
|
|
|
243
248
|
const o = Array.from(n.cssRules || []);
|
|
244
249
|
for (const s of o)
|
|
245
250
|
if (e.defaultView && s instanceof e.defaultView.CSSFontFaceRule) {
|
|
246
|
-
const
|
|
247
|
-
|
|
251
|
+
const r = s.style.getPropertyValue("src").match(/blob:[^,\s'")]+/g);
|
|
252
|
+
r && r.forEach((c) => {
|
|
248
253
|
var u;
|
|
249
254
|
(u = e == null ? void 0 : e.defaultView) == null || u.URL.revokeObjectURL(c);
|
|
250
255
|
});
|
|
@@ -269,10 +274,10 @@ function Re(e) {
|
|
|
269
274
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
270
275
|
) && e.nodeType === Node.ELEMENT_NODE;
|
|
271
276
|
}
|
|
272
|
-
function
|
|
277
|
+
function Oi(e, t) {
|
|
273
278
|
return Re(e) && e.tagName.toLowerCase() === t.toLowerCase();
|
|
274
279
|
}
|
|
275
|
-
function
|
|
280
|
+
function Vi(e) {
|
|
276
281
|
return Ce(
|
|
277
282
|
e,
|
|
278
283
|
[
|
|
@@ -290,21 +295,21 @@ const Dt = ({
|
|
|
290
295
|
position: e,
|
|
291
296
|
frameElement: t
|
|
292
297
|
}) => {
|
|
293
|
-
const i = t.getBoundingClientRect(), n = i.width / t.offsetWidth, o = i.height / t.offsetHeight, { left: s = 0, top:
|
|
298
|
+
const i = t.getBoundingClientRect(), n = i.width / t.offsetWidth, o = i.height / t.offsetHeight, { left: s = 0, top: a = 0 } = i, r = e.clientX * n + s, c = e.clientY * o + a;
|
|
294
299
|
return {
|
|
295
|
-
clientX:
|
|
300
|
+
clientX: r,
|
|
296
301
|
clientY: c
|
|
297
302
|
};
|
|
298
|
-
},
|
|
303
|
+
}, ji = (e, t, i, n) => {
|
|
299
304
|
var u;
|
|
300
305
|
const o = (u = t == null ? void 0 : t.view) == null ? void 0 : u.frameElement;
|
|
301
306
|
if (!t || !o) return e;
|
|
302
|
-
const s = i.getSpineItemFromIframe(o),
|
|
303
|
-
if (!s || !(
|
|
307
|
+
const s = i.getSpineItemFromIframe(o), a = o, { height: r, width: c } = n.getPageSize();
|
|
308
|
+
if (!s || !(a instanceof HTMLIFrameElement)) return e;
|
|
304
309
|
if (Gt(e)) {
|
|
305
310
|
const { clientX: d, clientY: g } = Dt({
|
|
306
311
|
position: e,
|
|
307
|
-
frameElement:
|
|
312
|
+
frameElement: a
|
|
308
313
|
}), l = new PointerEvent(e.type, {
|
|
309
314
|
...e,
|
|
310
315
|
pointerId: e.pointerId,
|
|
@@ -316,10 +321,10 @@ const Dt = ({
|
|
|
316
321
|
enumerable: !0
|
|
317
322
|
}), l;
|
|
318
323
|
}
|
|
319
|
-
if (
|
|
324
|
+
if (Ai(e)) {
|
|
320
325
|
const { clientX: d, clientY: g } = Dt({
|
|
321
326
|
position: e,
|
|
322
|
-
frameElement:
|
|
327
|
+
frameElement: a
|
|
323
328
|
}), l = new MouseEvent(e.type, {
|
|
324
329
|
...e,
|
|
325
330
|
clientX: d,
|
|
@@ -330,11 +335,11 @@ const Dt = ({
|
|
|
330
335
|
enumerable: !0
|
|
331
336
|
}), l;
|
|
332
337
|
}
|
|
333
|
-
if (
|
|
338
|
+
if (Di(e)) {
|
|
334
339
|
const d = Array.from(e.touches).map((l) => {
|
|
335
340
|
const { clientX: h, clientY: p } = Dt({
|
|
336
341
|
position: l,
|
|
337
|
-
frameElement:
|
|
342
|
+
frameElement: a
|
|
338
343
|
});
|
|
339
344
|
return new Touch({
|
|
340
345
|
identifier: l.identifier,
|
|
@@ -353,7 +358,7 @@ const Dt = ({
|
|
|
353
358
|
}), g;
|
|
354
359
|
}
|
|
355
360
|
return e;
|
|
356
|
-
},
|
|
361
|
+
}, ki = [
|
|
357
362
|
"pointercancel",
|
|
358
363
|
"pointerdown",
|
|
359
364
|
"pointerenter",
|
|
@@ -362,23 +367,23 @@ const Dt = ({
|
|
|
362
367
|
"pointerout",
|
|
363
368
|
"pointerover",
|
|
364
369
|
"pointerup"
|
|
365
|
-
],
|
|
366
|
-
...
|
|
370
|
+
], Wi = [
|
|
371
|
+
...ki
|
|
367
372
|
/*, ...mouseEvents*/
|
|
368
|
-
],
|
|
373
|
+
], Ui = (e) => (t) => {
|
|
369
374
|
const i = e(t);
|
|
370
375
|
return i.hookManager.register(
|
|
371
376
|
"item.onDocumentLoad",
|
|
372
377
|
({ destroy: n, itemId: o }) => {
|
|
373
|
-
const s = i.spineItemsManager.get(o),
|
|
374
|
-
if (!
|
|
375
|
-
const
|
|
378
|
+
const s = i.spineItemsManager.get(o), a = s == null ? void 0 : s.renderer.getDocumentFrame();
|
|
379
|
+
if (!a || !s) return;
|
|
380
|
+
const r = Wi.map((c) => {
|
|
376
381
|
var d;
|
|
377
382
|
const u = (g) => {
|
|
378
383
|
var h;
|
|
379
384
|
let l = g;
|
|
380
385
|
if (Gt(g) && (l = new PointerEvent(g.type, g)), l !== g) {
|
|
381
|
-
const p =
|
|
386
|
+
const p = ji(
|
|
382
387
|
l,
|
|
383
388
|
g,
|
|
384
389
|
i.spine.locator,
|
|
@@ -387,13 +392,13 @@ const Dt = ({
|
|
|
387
392
|
(h = i.context.state.rootElement) == null || h.dispatchEvent(p);
|
|
388
393
|
}
|
|
389
394
|
};
|
|
390
|
-
return (d =
|
|
395
|
+
return (d = a.contentDocument) == null || d.addEventListener(c, u), () => {
|
|
391
396
|
var g;
|
|
392
|
-
(g =
|
|
397
|
+
(g = a.contentDocument) == null || g.removeEventListener(c, u);
|
|
393
398
|
};
|
|
394
399
|
});
|
|
395
400
|
n(() => {
|
|
396
|
-
|
|
401
|
+
r.forEach((c) => c());
|
|
397
402
|
});
|
|
398
403
|
}
|
|
399
404
|
), i;
|
|
@@ -421,7 +426,7 @@ const Ct = (e) => (t) => t.pipe(
|
|
|
421
426
|
Y(() => i)
|
|
422
427
|
)
|
|
423
428
|
)
|
|
424
|
-
),
|
|
429
|
+
), zi = (e) => {
|
|
425
430
|
let t;
|
|
426
431
|
const i = e.subscribe((n) => {
|
|
427
432
|
t = { result: n };
|
|
@@ -451,7 +456,7 @@ const ce = (e, t) => new ot((i) => {
|
|
|
451
456
|
});
|
|
452
457
|
return n.observe(e, t), () => n.disconnect();
|
|
453
458
|
});
|
|
454
|
-
function
|
|
459
|
+
function Rs(e, t) {
|
|
455
460
|
return new ot((i) => {
|
|
456
461
|
const n = new IntersectionObserver((o) => {
|
|
457
462
|
i.next(o);
|
|
@@ -480,10 +485,10 @@ class Ne {
|
|
|
480
485
|
), this.values$.subscribe();
|
|
481
486
|
}
|
|
482
487
|
_prepareUpdate(t) {
|
|
483
|
-
const i = this.getCleanedParentInputSettings(t), n = this.settingsManager._prepareUpdate(i), o = vt(this.inputSettings, t), s = this.computeOutputSettings(o),
|
|
488
|
+
const i = this.getCleanedParentInputSettings(t), n = this.settingsManager._prepareUpdate(i), o = vt(this.inputSettings, t), s = this.computeOutputSettings(o), a = this.hasSettingsChanged(s);
|
|
484
489
|
return {
|
|
485
|
-
hasChanged:
|
|
486
|
-
commit: () => (this.inputSettings = o, this.outputSettings = s, !n.hasChanged &&
|
|
490
|
+
hasChanged: a || n.hasChanged,
|
|
491
|
+
commit: () => (this.inputSettings = o, this.outputSettings = s, !n.hasChanged && a && this.outputSettingsUpdateSubject.next(s), {
|
|
487
492
|
...n.commit(),
|
|
488
493
|
...s
|
|
489
494
|
})
|
|
@@ -509,19 +514,7 @@ class Ne {
|
|
|
509
514
|
this.outputSettingsUpdateSubject.complete();
|
|
510
515
|
}
|
|
511
516
|
}
|
|
512
|
-
|
|
513
|
-
const t = new FileReader();
|
|
514
|
-
return new Promise((i) => {
|
|
515
|
-
t.addEventListener(
|
|
516
|
-
"load",
|
|
517
|
-
() => {
|
|
518
|
-
i(t.result);
|
|
519
|
-
},
|
|
520
|
-
!1
|
|
521
|
-
), t.readAsDataURL(e);
|
|
522
|
-
});
|
|
523
|
-
};
|
|
524
|
-
let Ei = class extends Ne {
|
|
517
|
+
let Hi = class extends Ne {
|
|
525
518
|
computeOutputSettings(t) {
|
|
526
519
|
return t;
|
|
527
520
|
}
|
|
@@ -529,8 +522,8 @@ let Ei = class extends Ne {
|
|
|
529
522
|
return !N(this.outputSettings, t);
|
|
530
523
|
}
|
|
531
524
|
getCleanedParentInputSettings(t) {
|
|
532
|
-
const { fontJustification: i, fontScale: n, fontWeight: o, lineHeight: s, ...
|
|
533
|
-
return
|
|
525
|
+
const { fontJustification: i, fontScale: n, fontWeight: o, lineHeight: s, ...a } = t;
|
|
526
|
+
return a;
|
|
534
527
|
}
|
|
535
528
|
getDefaultSettings() {
|
|
536
529
|
return {
|
|
@@ -541,15 +534,15 @@ let Ei = class extends Ne {
|
|
|
541
534
|
};
|
|
542
535
|
}
|
|
543
536
|
};
|
|
544
|
-
const
|
|
545
|
-
const { fontScale: i, lineHeight: n, fontWeight: o, fontJustification: s } = t,
|
|
537
|
+
const Bi = (e) => (t) => {
|
|
538
|
+
const { fontScale: i, lineHeight: n, fontWeight: o, fontJustification: s } = t, a = new W(), r = e(t), c = new Hi(
|
|
546
539
|
{
|
|
547
540
|
fontScale: i,
|
|
548
541
|
lineHeight: n,
|
|
549
542
|
fontWeight: o,
|
|
550
543
|
fontJustification: s
|
|
551
544
|
},
|
|
552
|
-
|
|
545
|
+
r.settings
|
|
553
546
|
), u = () => `
|
|
554
547
|
|
|
555
548
|
body {
|
|
@@ -559,15 +552,15 @@ const _i = (e) => (t) => {
|
|
|
559
552
|
${c.values.fontJustification !== "publisher" ? `text-align: ${c.values.fontJustification} !important;` : ""}
|
|
560
553
|
}
|
|
561
554
|
`, d = (l) => {
|
|
562
|
-
|
|
555
|
+
r.spineItemsManager.items.forEach((h) => {
|
|
563
556
|
if (h.renditionLayout !== "pre-paginated") {
|
|
564
557
|
const p = h.renderer.getDocumentFrame();
|
|
565
558
|
p && nt(p, "prose-reader-fonts", u());
|
|
566
559
|
}
|
|
567
|
-
}), l &&
|
|
560
|
+
}), l && r.layout();
|
|
568
561
|
};
|
|
569
|
-
|
|
570
|
-
const h =
|
|
562
|
+
r.hookManager.register("item.onDocumentLoad", ({ itemId: l }) => {
|
|
563
|
+
const h = r.spineItemsManager.get(l);
|
|
571
564
|
if ((h == null ? void 0 : h.renditionLayout) !== "pre-paginated") {
|
|
572
565
|
const p = h == null ? void 0 : h.renderer.getDocumentFrame();
|
|
573
566
|
p && nt(p, "prose-reader-fonts", u());
|
|
@@ -580,25 +573,25 @@ const _i = (e) => (t) => {
|
|
|
580
573
|
return c.values$.pipe(
|
|
581
574
|
g,
|
|
582
575
|
k(d),
|
|
583
|
-
T(
|
|
576
|
+
T(r.$.destroy$)
|
|
584
577
|
).subscribe(), {
|
|
585
|
-
...
|
|
578
|
+
...r,
|
|
586
579
|
destroy: () => {
|
|
587
|
-
|
|
580
|
+
a.complete(), c.destroy(), r.destroy();
|
|
588
581
|
},
|
|
589
582
|
settings: c
|
|
590
583
|
};
|
|
591
|
-
},
|
|
584
|
+
}, Ei = (e) => (t) => {
|
|
592
585
|
const i = e(t), n = (o) => q(o, "keyup").pipe(
|
|
593
586
|
A(i.settings.values$),
|
|
594
|
-
S(([s, { pageTurnDirection:
|
|
595
|
-
if (
|
|
587
|
+
S(([s, { pageTurnDirection: a }]) => {
|
|
588
|
+
if (a === "horizontal") {
|
|
596
589
|
if (s.key === "ArrowRight")
|
|
597
590
|
return i.navigation.turnRight();
|
|
598
591
|
if (s.key === "ArrowLeft")
|
|
599
592
|
return i.navigation.turnLeft();
|
|
600
593
|
}
|
|
601
|
-
if (
|
|
594
|
+
if (a === "vertical") {
|
|
602
595
|
if (s.key === "ArrowDown")
|
|
603
596
|
return i.navigation.turnRight();
|
|
604
597
|
if (s.key === "ArrowUp")
|
|
@@ -613,8 +606,8 @@ const _i = (e) => (t) => {
|
|
|
613
606
|
...o.map(
|
|
614
607
|
(s) => s.loaded$.pipe(
|
|
615
608
|
P(() => {
|
|
616
|
-
const
|
|
617
|
-
return
|
|
609
|
+
const a = s.renderer.getDocumentFrame();
|
|
610
|
+
return a instanceof HTMLIFrameElement && (a != null && a.contentDocument) ? n(a.contentDocument) : Q;
|
|
618
611
|
})
|
|
619
612
|
)
|
|
620
613
|
)
|
|
@@ -622,7 +615,7 @@ const _i = (e) => (t) => {
|
|
|
622
615
|
),
|
|
623
616
|
T(i.$.destroy$)
|
|
624
617
|
).subscribe(), i;
|
|
625
|
-
},
|
|
618
|
+
}, _i = (e) => e.spine.spineItemsManager.items$.pipe(
|
|
626
619
|
P(
|
|
627
620
|
(t) => v(
|
|
628
621
|
...t.map((i) => i.loaded$.pipe(
|
|
@@ -632,7 +625,7 @@ const _i = (e) => (t) => {
|
|
|
632
625
|
const s = Array.from(
|
|
633
626
|
n.contentDocument.querySelectorAll("a")
|
|
634
627
|
).map(
|
|
635
|
-
(
|
|
628
|
+
(a) => q(a, "click")
|
|
636
629
|
);
|
|
637
630
|
return v(...s);
|
|
638
631
|
})
|
|
@@ -686,18 +679,18 @@ const Lt = class Lt extends X {
|
|
|
686
679
|
itemId: this.item.id,
|
|
687
680
|
documentContainer: s
|
|
688
681
|
}), this.onLoadDocument().pipe(
|
|
689
|
-
|
|
682
|
+
mt(null),
|
|
690
683
|
z()
|
|
691
684
|
).pipe(
|
|
692
685
|
Ct(this.context.bridgeEvent.viewportFree$),
|
|
693
686
|
P(() => {
|
|
694
|
-
const
|
|
687
|
+
const r = this.hookManager.execute("item.onDocumentLoad", this.item.id, {
|
|
695
688
|
itemId: this.item.id,
|
|
696
689
|
documentContainer: s
|
|
697
690
|
}).filter(
|
|
698
691
|
(c) => c instanceof ot
|
|
699
692
|
);
|
|
700
|
-
return B([w(null), ...
|
|
693
|
+
return B([w(null), ...r]).pipe(z());
|
|
701
694
|
})
|
|
702
695
|
))),
|
|
703
696
|
$(() => {
|
|
@@ -712,7 +705,7 @@ const Lt = class Lt extends X {
|
|
|
712
705
|
$(() => {
|
|
713
706
|
this.hookManager.destroy("item.onDocumentLoad", this.item.id);
|
|
714
707
|
}),
|
|
715
|
-
P(() => this.onUnload().pipe(
|
|
708
|
+
P(() => this.onUnload().pipe(mt(null), z())),
|
|
716
709
|
$(() => {
|
|
717
710
|
this.stateSubject.next("idle");
|
|
718
711
|
}),
|
|
@@ -748,7 +741,7 @@ const Lt = class Lt extends X {
|
|
|
748
741
|
renderHeadless() {
|
|
749
742
|
const t = new W();
|
|
750
743
|
return kt(() => this.onRenderHeadless({ release: t })).pipe(
|
|
751
|
-
|
|
744
|
+
mt(void 0),
|
|
752
745
|
z(),
|
|
753
746
|
S((i) => {
|
|
754
747
|
if (i)
|
|
@@ -791,8 +784,8 @@ const Lt = class Lt extends X {
|
|
|
791
784
|
}
|
|
792
785
|
};
|
|
793
786
|
Lt.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
|
|
794
|
-
let
|
|
795
|
-
const
|
|
787
|
+
let ft = Lt;
|
|
788
|
+
const Xi = (e) => new URL(e.href);
|
|
796
789
|
class Qt {
|
|
797
790
|
constructor(t, i) {
|
|
798
791
|
this.item = t, this.settings = i;
|
|
@@ -801,7 +794,7 @@ class Qt {
|
|
|
801
794
|
var i, n;
|
|
802
795
|
return await ei(
|
|
803
796
|
((n = (i = this.settings.values).getResource) == null ? void 0 : n.call(i, this.item)) ?? w(void 0)
|
|
804
|
-
) ??
|
|
797
|
+
) ?? Xi(this.item);
|
|
805
798
|
}
|
|
806
799
|
async fetchResource() {
|
|
807
800
|
const t = await this.getResource();
|
|
@@ -811,14 +804,14 @@ class Qt {
|
|
|
811
804
|
const Oe = (e, t) => {
|
|
812
805
|
const i = e.startsWith("file://"), n = i ? e.replace("file://", "http://") : e, o = new URL(t, n).toString();
|
|
813
806
|
return i ? o.replace("http://", "file://") : o;
|
|
814
|
-
},
|
|
807
|
+
}, Yi = async (e, t, i, n, o) => {
|
|
815
808
|
if (!e || !e.defaultView) return;
|
|
816
809
|
const s = t.sheet;
|
|
817
810
|
if (s)
|
|
818
811
|
try {
|
|
819
|
-
const
|
|
820
|
-
for (let
|
|
821
|
-
const c = r
|
|
812
|
+
const a = Array.from(s.cssRules || []);
|
|
813
|
+
for (let r = 0; r < a.length; r++) {
|
|
814
|
+
const c = a[r];
|
|
822
815
|
if (e.defaultView && c instanceof e.defaultView.CSSFontFaceRule) {
|
|
823
816
|
const u = c.style.getPropertyValue("src");
|
|
824
817
|
if (u.match(/url\(['"]?([^'"]+)['"]?\)/g)) {
|
|
@@ -853,23 +846,23 @@ const Oe = (e, t) => {
|
|
|
853
846
|
/src:\s*[^;]+;/,
|
|
854
847
|
`src: ${l.join(", ")};`
|
|
855
848
|
);
|
|
856
|
-
s.deleteRule(
|
|
849
|
+
s.deleteRule(r), s.insertRule(h, r);
|
|
857
850
|
}
|
|
858
851
|
}
|
|
859
852
|
}
|
|
860
|
-
} catch (
|
|
861
|
-
console.error("Could not access stylesheet rules:",
|
|
853
|
+
} catch (a) {
|
|
854
|
+
console.error("Could not access stylesheet rules:", a);
|
|
862
855
|
}
|
|
863
|
-
},
|
|
856
|
+
}, qi = (e, t, i, n, o) => {
|
|
864
857
|
var c;
|
|
865
858
|
const s = t.getAttribute("src") || t.getAttribute("href");
|
|
866
859
|
if (!s) return w(null);
|
|
867
|
-
const
|
|
860
|
+
const a = (c = n.manifest) == null ? void 0 : c.items.find(({ href: u }) => `${Oe(i, s).toLowerCase()}`.endsWith(
|
|
868
861
|
`${u.toLowerCase()}`
|
|
869
862
|
));
|
|
870
|
-
if (!
|
|
871
|
-
const
|
|
872
|
-
return j(
|
|
863
|
+
if (!a) return w(null);
|
|
864
|
+
const r = new Qt(a, o);
|
|
865
|
+
return j(r.getResource()).pipe(
|
|
873
866
|
$t(
|
|
874
867
|
(u) => u instanceof Response ? j(u.blob()) : w(void 0)
|
|
875
868
|
),
|
|
@@ -884,7 +877,7 @@ const Oe = (e, t) => {
|
|
|
884
877
|
return new ot((l) => {
|
|
885
878
|
t.onload = async () => {
|
|
886
879
|
try {
|
|
887
|
-
t.sheet && await
|
|
880
|
+
t.sheet && await Yi(
|
|
888
881
|
e,
|
|
889
882
|
t,
|
|
890
883
|
i,
|
|
@@ -899,7 +892,7 @@ const Oe = (e, t) => {
|
|
|
899
892
|
return w(null);
|
|
900
893
|
})
|
|
901
894
|
);
|
|
902
|
-
},
|
|
895
|
+
}, Zi = ({
|
|
903
896
|
settings: e,
|
|
904
897
|
item: t,
|
|
905
898
|
context: i
|
|
@@ -907,39 +900,34 @@ const Oe = (e, t) => {
|
|
|
907
900
|
P((o) => {
|
|
908
901
|
const s = Me(
|
|
909
902
|
o.contentDocument
|
|
910
|
-
),
|
|
911
|
-
(c) =>
|
|
903
|
+
), a = ui(t.href), r = s.map(
|
|
904
|
+
(c) => qi(
|
|
912
905
|
o.contentDocument,
|
|
913
906
|
c,
|
|
914
|
-
|
|
907
|
+
a,
|
|
915
908
|
i,
|
|
916
909
|
e
|
|
917
910
|
)
|
|
918
911
|
);
|
|
919
|
-
return B(
|
|
912
|
+
return B(r).pipe(S(() => o));
|
|
920
913
|
})
|
|
921
|
-
),
|
|
922
|
-
|
|
923
|
-
},
|
|
924
|
-
const n = new Image();
|
|
925
|
-
n.src = e, n.onload = () => {
|
|
926
|
-
t({ height: n.naturalHeight, width: n.naturalWidth });
|
|
927
|
-
}, n.onerror = i;
|
|
928
|
-
}), en = async (e, t) => {
|
|
914
|
+
), Gi = (e) => {
|
|
915
|
+
Ni(e == null ? void 0 : e.contentDocument);
|
|
916
|
+
}, Ji = [".xhtml", ".html", ".htm"], pt = "prose-reader", Ki = async (e, t) => {
|
|
929
917
|
if (typeof e == "string") return e;
|
|
930
918
|
const i = di(e.headers.get("Content-Type") || "") || Mt(t.href);
|
|
931
919
|
if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
|
|
932
920
|
(o) => o === i
|
|
933
921
|
)) {
|
|
934
|
-
const o = await
|
|
935
|
-
return `
|
|
922
|
+
const o = await e.blob(), s = URL.createObjectURL(o), a = await createImageBitmap(o), { width: r, height: c } = { width: a.width, height: a.height };
|
|
923
|
+
return a.close(), `
|
|
936
924
|
<html>
|
|
937
925
|
<head>
|
|
938
|
-
${t.renditionLayout === "pre-paginated" ? `<meta name="viewport" content="width=${r}, height=${
|
|
926
|
+
${t.renditionLayout === "pre-paginated" ? `<meta name="viewport" content="width=${r}, height=${c}">` : ""}
|
|
939
927
|
</head>
|
|
940
928
|
<body style="margin: 0px;" tab-index="-1;">
|
|
941
929
|
<img
|
|
942
|
-
src="${
|
|
930
|
+
src="${s}"
|
|
943
931
|
style="max-width: 100%;height:100%;object-fit:contain;"
|
|
944
932
|
>
|
|
945
933
|
</body>
|
|
@@ -963,11 +951,11 @@ const Oe = (e, t) => {
|
|
|
963
951
|
</body>
|
|
964
952
|
</html>
|
|
965
953
|
` : await e.text();
|
|
966
|
-
},
|
|
954
|
+
}, Qi = ({
|
|
967
955
|
item: e,
|
|
968
956
|
resourcesHandler: t
|
|
969
957
|
}) => {
|
|
970
|
-
const i = (n) =>
|
|
958
|
+
const i = (n) => Ki(n, e);
|
|
971
959
|
return (n) => n.pipe(
|
|
972
960
|
P((o) => j(t.getResource()).pipe(
|
|
973
961
|
P((s) => s instanceof URL && e.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
|
|
@@ -977,29 +965,29 @@ const Oe = (e, t) => {
|
|
|
977
965
|
"text/html",
|
|
978
966
|
"text/xml"
|
|
979
967
|
].includes(e.mediaType) || // no encoding ? then try to detect html
|
|
980
|
-
!e.mediaType &&
|
|
981
|
-
(
|
|
968
|
+
!e.mediaType && Ji.some(
|
|
969
|
+
(r) => e.href.endsWith(r)
|
|
982
970
|
)) ? (o == null || o.setAttribute("src", e.href), w(o)) : (s instanceof URL ? j(t.fetchResource()) : w(s)).pipe(
|
|
983
|
-
P((
|
|
984
|
-
if (!(
|
|
971
|
+
P((r) => {
|
|
972
|
+
if (!(r instanceof Response))
|
|
985
973
|
throw new Error("Invalid resource");
|
|
986
|
-
return j(i(
|
|
974
|
+
return j(i(r));
|
|
987
975
|
}),
|
|
988
|
-
$((
|
|
989
|
-
if (
|
|
990
|
-
const c = new Blob([
|
|
976
|
+
$((r) => {
|
|
977
|
+
if (r) {
|
|
978
|
+
const c = new Blob([r], { type: "text/html" }), u = URL.createObjectURL(c);
|
|
991
979
|
o == null || o.setAttribute("src", u);
|
|
992
980
|
}
|
|
993
981
|
}),
|
|
994
982
|
S(() => o),
|
|
995
|
-
Pe((
|
|
983
|
+
Pe((r) => (O.error(
|
|
996
984
|
`Error while trying to fetch or load resource for item ${e.id}`,
|
|
997
985
|
s
|
|
998
|
-
), O.error(
|
|
986
|
+
), O.error(r), w(o)))
|
|
999
987
|
))
|
|
1000
988
|
))
|
|
1001
989
|
);
|
|
1002
|
-
},
|
|
990
|
+
}, tn = () => {
|
|
1003
991
|
const e = document.createElement("iframe");
|
|
1004
992
|
return e.frameBorder = "no", e.tabIndex = 0, e.setAttribute(
|
|
1005
993
|
"sandbox",
|
|
@@ -1032,7 +1020,7 @@ const Oe = (e, t) => {
|
|
|
1032
1020
|
e / (n.height ?? 1)
|
|
1033
1021
|
), computedWidthScale: o, viewportDimensions: n };
|
|
1034
1022
|
}
|
|
1035
|
-
},
|
|
1023
|
+
}, en = ({
|
|
1036
1024
|
columnWidth: e,
|
|
1037
1025
|
enableTouch: t,
|
|
1038
1026
|
spreadPosition: i
|
|
@@ -1077,27 +1065,27 @@ const Oe = (e, t) => {
|
|
|
1077
1065
|
object-fit:contain;
|
|
1078
1066
|
`}
|
|
1079
1067
|
}
|
|
1080
|
-
`,
|
|
1068
|
+
`, nn = ({
|
|
1081
1069
|
pageHeight: e,
|
|
1082
1070
|
pageWidth: t
|
|
1083
1071
|
}) => ({ columnHeight: e, columnWidth: t }), ue = (e, t) => {
|
|
1084
1072
|
e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
|
|
1085
|
-
},
|
|
1073
|
+
}, on = ({
|
|
1086
1074
|
minPageSpread: e,
|
|
1087
1075
|
blankPagePosition: t,
|
|
1088
1076
|
spreadPosition: i,
|
|
1089
1077
|
pageHeight: n,
|
|
1090
1078
|
pageWidth: o,
|
|
1091
1079
|
frameElement: s,
|
|
1092
|
-
isRTL:
|
|
1093
|
-
enableTouch:
|
|
1080
|
+
isRTL: a,
|
|
1081
|
+
enableTouch: r
|
|
1094
1082
|
}) => {
|
|
1095
1083
|
const c = e * o;
|
|
1096
1084
|
if (s != null && s.contentDocument && (s != null && s.contentWindow)) {
|
|
1097
|
-
const { viewportDimensions: u, computedScale: d = 1 } = je({ frameElement: s, pageHeight: n, pageWidth: o }) ?? {}, g = o, l = n, h =
|
|
1085
|
+
const { viewportDimensions: u, computedScale: d = 1 } = je({ frameElement: s, pageHeight: n, pageWidth: o }) ?? {}, g = o, l = n, h = en(
|
|
1098
1086
|
{
|
|
1099
|
-
...
|
|
1100
|
-
enableTouch:
|
|
1087
|
+
...nn({ pageHeight: n, pageWidth: o }),
|
|
1088
|
+
enableTouch: r,
|
|
1101
1089
|
spreadPosition: i
|
|
1102
1090
|
},
|
|
1103
1091
|
u
|
|
@@ -1109,11 +1097,11 @@ const Oe = (e, t) => {
|
|
|
1109
1097
|
width: g,
|
|
1110
1098
|
height: l
|
|
1111
1099
|
}), u) {
|
|
1112
|
-
s == null || s.style.setProperty("position", "absolute"), s == null || s.style.setProperty("top", "50%"), i === "left" ? (s == null || s.style.setProperty("right", "0"), s == null || s.style.removeProperty("left")) : t === "before" &&
|
|
1100
|
+
s == null || s.style.setProperty("position", "absolute"), s == null || s.style.setProperty("top", "50%"), i === "left" ? (s == null || s.style.setProperty("right", "0"), s == null || s.style.removeProperty("left")) : t === "before" && a ? (s == null || s.style.setProperty("right", "50%"), s == null || s.style.removeProperty("left")) : i === "right" ? (s == null || s.style.setProperty("left", "0"), s == null || s.style.removeProperty("right")) : (s == null || s.style.setProperty(
|
|
1113
1101
|
"left",
|
|
1114
|
-
t === "before" ?
|
|
1102
|
+
t === "before" ? a ? "25%" : "75%" : t === "after" ? a ? "75%" : "25%" : "50%"
|
|
1115
1103
|
), s == null || s.style.removeProperty("right"));
|
|
1116
|
-
const p = i !== "none" ? "0" : "-50%", m = i === "right" && t !== "before" ? "left" : i === "left" || t === "before" &&
|
|
1104
|
+
const p = i !== "none" ? "0" : "-50%", m = i === "right" && t !== "before" ? "left" : i === "left" || t === "before" && a ? "right" : "center";
|
|
1117
1105
|
s == null || s.style.setProperty(
|
|
1118
1106
|
"transform",
|
|
1119
1107
|
`translate(${p}, -50%) scale(${d})`
|
|
@@ -1122,11 +1110,11 @@ const Oe = (e, t) => {
|
|
|
1122
1110
|
`${m} center`
|
|
1123
1111
|
);
|
|
1124
1112
|
} else
|
|
1125
|
-
t === "before" ?
|
|
1113
|
+
t === "before" ? a ? s == null || s.style.setProperty("margin-right", `${o}px`) : s == null || s.style.setProperty("margin-left", `${o}px`) : (s == null || s.style.removeProperty("margin-left"), s == null || s.style.removeProperty("margin-right"));
|
|
1126
1114
|
return { width: c, height: l };
|
|
1127
1115
|
}
|
|
1128
1116
|
return { width: c, height: n };
|
|
1129
|
-
},
|
|
1117
|
+
}, sn = () => `
|
|
1130
1118
|
${Ve()}
|
|
1131
1119
|
html {
|
|
1132
1120
|
width: 100%;
|
|
@@ -1141,7 +1129,7 @@ const Oe = (e, t) => {
|
|
|
1141
1129
|
html, body {
|
|
1142
1130
|
touch-action: none;
|
|
1143
1131
|
}
|
|
1144
|
-
`,
|
|
1132
|
+
`, rn = ({
|
|
1145
1133
|
isScrollable: e,
|
|
1146
1134
|
enableTouch: t
|
|
1147
1135
|
}) => `
|
|
@@ -1166,7 +1154,7 @@ const Oe = (e, t) => {
|
|
|
1166
1154
|
display: block;
|
|
1167
1155
|
}
|
|
1168
1156
|
` : ""}
|
|
1169
|
-
`,
|
|
1157
|
+
`, an = ({
|
|
1170
1158
|
width: e,
|
|
1171
1159
|
columnHeight: t,
|
|
1172
1160
|
columnWidth: i
|
|
@@ -1234,31 +1222,31 @@ const Oe = (e, t) => {
|
|
|
1234
1222
|
td {
|
|
1235
1223
|
max-width: ${i}px;
|
|
1236
1224
|
}
|
|
1237
|
-
`,
|
|
1225
|
+
`, cn = ({
|
|
1238
1226
|
isUsingVerticalWriting: e,
|
|
1239
1227
|
minimumWidth: t,
|
|
1240
1228
|
pageHeight: i,
|
|
1241
1229
|
pageWidth: n
|
|
1242
1230
|
}) => {
|
|
1243
|
-
let
|
|
1244
|
-
const
|
|
1231
|
+
let a = n - 0;
|
|
1232
|
+
const r = i - 0 * 2;
|
|
1245
1233
|
let c = n - 0 * 2;
|
|
1246
|
-
return e && (c = t - 0 * 2,
|
|
1247
|
-
columnHeight:
|
|
1248
|
-
columnWidth:
|
|
1234
|
+
return e && (c = t - 0 * 2, a = r), {
|
|
1235
|
+
columnHeight: r,
|
|
1236
|
+
columnWidth: a,
|
|
1249
1237
|
width: c
|
|
1250
1238
|
};
|
|
1251
1239
|
}, It = (e, t) => {
|
|
1252
1240
|
e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
|
|
1253
|
-
},
|
|
1241
|
+
}, un = ({
|
|
1254
1242
|
pageHeight: e,
|
|
1255
1243
|
pageWidth: t,
|
|
1256
1244
|
frameElement: i,
|
|
1257
1245
|
manifest: n,
|
|
1258
1246
|
latestContentHeightWhenLoaded: o,
|
|
1259
1247
|
minPageSpread: s,
|
|
1260
|
-
isRTL:
|
|
1261
|
-
blankPagePosition:
|
|
1248
|
+
isRTL: a,
|
|
1249
|
+
blankPagePosition: r,
|
|
1262
1250
|
isImageType: c,
|
|
1263
1251
|
enableTouch: u,
|
|
1264
1252
|
isUsingVerticalWriting: d
|
|
@@ -1278,23 +1266,23 @@ const Oe = (e, t) => {
|
|
|
1278
1266
|
nt(
|
|
1279
1267
|
i,
|
|
1280
1268
|
"prose-reader-html-renderer-framce-css",
|
|
1281
|
-
|
|
1269
|
+
sn()
|
|
1282
1270
|
), It(i, {
|
|
1283
1271
|
width: m.width ?? 1,
|
|
1284
1272
|
height: m.height ?? 1
|
|
1285
1273
|
}), i == null || i.style.setProperty("position", "absolute"), i == null || i.style.setProperty("top", "50%"), i == null || i.style.setProperty(
|
|
1286
1274
|
"left",
|
|
1287
|
-
|
|
1275
|
+
r === "before" ? a ? "25%" : "75%" : r === "after" ? a ? "75%" : "25%" : "50%"
|
|
1288
1276
|
), i == null || i.style.setProperty(
|
|
1289
1277
|
"transform",
|
|
1290
1278
|
`translate(-50%, -50%) scale(${y})`
|
|
1291
1279
|
), i == null || i.style.setProperty("transform-origin", "center center");
|
|
1292
1280
|
else {
|
|
1293
|
-
const C = c ?
|
|
1281
|
+
const C = c ? rn({
|
|
1294
1282
|
isScrollable: (n == null ? void 0 : n.renditionFlow) === "scrolled-continuous",
|
|
1295
1283
|
enableTouch: u
|
|
1296
|
-
}) :
|
|
1297
|
-
|
|
1284
|
+
}) : an(
|
|
1285
|
+
cn({
|
|
1298
1286
|
isUsingVerticalWriting: d,
|
|
1299
1287
|
minimumWidth: g,
|
|
1300
1288
|
pageHeight: p,
|
|
@@ -1323,7 +1311,7 @@ const Oe = (e, t) => {
|
|
|
1323
1311
|
});
|
|
1324
1312
|
}
|
|
1325
1313
|
}
|
|
1326
|
-
return I % g === 0 ? i == null || i.style.setProperty("margin-left", "0px") : (I = I + t,
|
|
1314
|
+
return I % g === 0 ? i == null || i.style.setProperty("margin-left", "0px") : (I = I + t, a && !d && (i == null || i.style.setProperty("margin-left", `${t}px`))), { width: I, height: x };
|
|
1327
1315
|
}
|
|
1328
1316
|
return {
|
|
1329
1317
|
width: g,
|
|
@@ -1331,7 +1319,7 @@ const Oe = (e, t) => {
|
|
|
1331
1319
|
latestContentHeightWhenLoaded: l
|
|
1332
1320
|
};
|
|
1333
1321
|
};
|
|
1334
|
-
class
|
|
1322
|
+
class dn extends ft {
|
|
1335
1323
|
constructor() {
|
|
1336
1324
|
super(...arguments), this.isImageType = () => {
|
|
1337
1325
|
const t = this.item.mediaType ?? Mt(this.item.href);
|
|
@@ -1339,14 +1327,14 @@ class pn extends mt {
|
|
|
1339
1327
|
};
|
|
1340
1328
|
}
|
|
1341
1329
|
onCreateDocument() {
|
|
1342
|
-
const t =
|
|
1330
|
+
const t = tn();
|
|
1343
1331
|
return this.setDocumentContainer(t), w(t);
|
|
1344
1332
|
}
|
|
1345
1333
|
onLoadDocument() {
|
|
1346
1334
|
const t = this.getFrameElement();
|
|
1347
1335
|
if (!t) throw new Error("invalid frame");
|
|
1348
1336
|
return w(t).pipe(
|
|
1349
|
-
|
|
1337
|
+
Qi({
|
|
1350
1338
|
item: this.item,
|
|
1351
1339
|
resourcesHandler: this.resourcesHandler,
|
|
1352
1340
|
settings: this.settings
|
|
@@ -1355,17 +1343,17 @@ class pn extends mt {
|
|
|
1355
1343
|
$(() => {
|
|
1356
1344
|
this.attach();
|
|
1357
1345
|
}),
|
|
1358
|
-
|
|
1359
|
-
|
|
1346
|
+
Pi,
|
|
1347
|
+
Zi({
|
|
1360
1348
|
context: this.context,
|
|
1361
1349
|
item: this.item,
|
|
1362
1350
|
settings: this.settings
|
|
1363
1351
|
}),
|
|
1364
|
-
|
|
1352
|
+
vi
|
|
1365
1353
|
);
|
|
1366
1354
|
}
|
|
1367
1355
|
onUnload() {
|
|
1368
|
-
return
|
|
1356
|
+
return Gi(this.getFrameElement()), this.detach(), Q;
|
|
1369
1357
|
}
|
|
1370
1358
|
onLayout({
|
|
1371
1359
|
minPageSpread: t,
|
|
@@ -1373,14 +1361,14 @@ class pn extends mt {
|
|
|
1373
1361
|
spreadPosition: n
|
|
1374
1362
|
}) {
|
|
1375
1363
|
var d, g;
|
|
1376
|
-
const { width: o, height: s } = this.context.getPageSize(),
|
|
1377
|
-
if (!
|
|
1378
|
-
const
|
|
1364
|
+
const { width: o, height: s } = this.context.getPageSize(), a = this.getFrameElement();
|
|
1365
|
+
if (!a) return w(void 0);
|
|
1366
|
+
const r = !!((d = this.writingMode) != null && d.startsWith("vertical"));
|
|
1379
1367
|
if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && ((g = this.context.manifest) == null ? void 0 : g.renditionLayout) === "pre-paginated") {
|
|
1380
|
-
const l =
|
|
1368
|
+
const l = on({
|
|
1381
1369
|
blankPagePosition: i,
|
|
1382
1370
|
enableTouch: this.settings.values.computedPageTurnMode !== "scrollable",
|
|
1383
|
-
frameElement:
|
|
1371
|
+
frameElement: a,
|
|
1384
1372
|
isRTL: this.context.isRTL(),
|
|
1385
1373
|
minPageSpread: t,
|
|
1386
1374
|
pageHeight: s,
|
|
@@ -1389,13 +1377,13 @@ class pn extends mt {
|
|
|
1389
1377
|
});
|
|
1390
1378
|
return w(l);
|
|
1391
1379
|
}
|
|
1392
|
-
const { latestContentHeightWhenLoaded: c, ...u } =
|
|
1380
|
+
const { latestContentHeightWhenLoaded: c, ...u } = un({
|
|
1393
1381
|
pageHeight: s,
|
|
1394
1382
|
pageWidth: o,
|
|
1395
|
-
frameElement:
|
|
1383
|
+
frameElement: a,
|
|
1396
1384
|
manifest: this.context.manifest,
|
|
1397
1385
|
blankPagePosition: i,
|
|
1398
|
-
isUsingVerticalWriting:
|
|
1386
|
+
isUsingVerticalWriting: r,
|
|
1399
1387
|
isRTL: this.context.isRTL(),
|
|
1400
1388
|
latestContentHeightWhenLoaded: this.latestContentHeightWhenLoaded,
|
|
1401
1389
|
minPageSpread: t,
|
|
@@ -1461,14 +1449,14 @@ class pn extends mt {
|
|
|
1461
1449
|
return this.getFrameElement();
|
|
1462
1450
|
}
|
|
1463
1451
|
}
|
|
1464
|
-
const
|
|
1452
|
+
const gn = (e) => (t) => {
|
|
1465
1453
|
const i = e({
|
|
1466
1454
|
...t,
|
|
1467
1455
|
getRenderer(o) {
|
|
1468
|
-
var
|
|
1469
|
-
return ((
|
|
1456
|
+
var a;
|
|
1457
|
+
return ((a = t.getRenderer) == null ? void 0 : a.call(t, o)) ?? ((r) => new dn(r));
|
|
1470
1458
|
}
|
|
1471
|
-
}), n =
|
|
1459
|
+
}), n = _i(i);
|
|
1472
1460
|
return n.pipe(T(i.$.destroy$)).subscribe(), {
|
|
1473
1461
|
...i,
|
|
1474
1462
|
links$: n
|
|
@@ -1477,7 +1465,7 @@ const hn = (e) => (t) => {
|
|
|
1477
1465
|
function at(e) {
|
|
1478
1466
|
return e != null;
|
|
1479
1467
|
}
|
|
1480
|
-
let
|
|
1468
|
+
let ln = class extends Ne {
|
|
1481
1469
|
computeOutputSettings(t) {
|
|
1482
1470
|
return t;
|
|
1483
1471
|
}
|
|
@@ -1490,10 +1478,10 @@ let mn = class extends Ne {
|
|
|
1490
1478
|
pageHorizontalMargin: n,
|
|
1491
1479
|
pageVerticalMargin: o,
|
|
1492
1480
|
layoutLayerTransition: s,
|
|
1493
|
-
viewportMode:
|
|
1494
|
-
...
|
|
1481
|
+
viewportMode: a,
|
|
1482
|
+
...r
|
|
1495
1483
|
} = t;
|
|
1496
|
-
return
|
|
1484
|
+
return r;
|
|
1497
1485
|
}
|
|
1498
1486
|
getDefaultSettings() {
|
|
1499
1487
|
return {
|
|
@@ -1520,7 +1508,7 @@ class Nt {
|
|
|
1520
1508
|
this.__symbol = Symbol("SpineItemPagePosition"), this.x = t.x, this.y = t.y;
|
|
1521
1509
|
}
|
|
1522
1510
|
}
|
|
1523
|
-
class
|
|
1511
|
+
class pn extends te {
|
|
1524
1512
|
constructor() {
|
|
1525
1513
|
super(...arguments), this.__symbol = "SpineItemPageLayout";
|
|
1526
1514
|
}
|
|
@@ -1530,7 +1518,7 @@ class Ht extends te {
|
|
|
1530
1518
|
super(...arguments), this.__symbol = "SpineItemSpineLayout";
|
|
1531
1519
|
}
|
|
1532
1520
|
}
|
|
1533
|
-
class
|
|
1521
|
+
class hn extends te {
|
|
1534
1522
|
constructor() {
|
|
1535
1523
|
super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
|
|
1536
1524
|
}
|
|
@@ -1553,17 +1541,17 @@ class Rt extends ke {
|
|
|
1553
1541
|
return new Rt(t);
|
|
1554
1542
|
}
|
|
1555
1543
|
}
|
|
1556
|
-
const
|
|
1557
|
-
const i = t.getBoundingClientRect(), { x: n, y: o } = e, { left: s, top:
|
|
1544
|
+
const mn = (e, t) => {
|
|
1545
|
+
const i = t.getBoundingClientRect(), { x: n, y: o } = e, { left: s, top: a } = i, r = i.width / t.offsetWidth, c = i.height / t.offsetHeight, u = n - s, d = o - a;
|
|
1558
1546
|
return {
|
|
1559
|
-
x: u /
|
|
1547
|
+
x: u / r,
|
|
1560
1548
|
y: d / c
|
|
1561
1549
|
};
|
|
1562
|
-
},
|
|
1563
|
-
|
|
1564
|
-
),
|
|
1565
|
-
getSpinePositionFromClientPosition: (t) => e.spine.element ?
|
|
1566
|
-
}),
|
|
1550
|
+
}, fn = (e, t) => new Rt(
|
|
1551
|
+
mn(e, t)
|
|
1552
|
+
), yn = (e) => ({
|
|
1553
|
+
getSpinePositionFromClientPosition: (t) => e.spine.element ? fn(t, e.spine.element) : void 0
|
|
1554
|
+
}), Sn = (e) => {
|
|
1567
1555
|
let t;
|
|
1568
1556
|
const i = e.context.state$.pipe(
|
|
1569
1557
|
_(({ rootElement: c }) => c ? new ot(() => (t = c.ownerDocument.createElement("div"), t.style.cssText = `
|
|
@@ -1592,7 +1580,7 @@ const Sn = (e, t) => {
|
|
|
1592
1580
|
})
|
|
1593
1581
|
), s = n(e.viewportFree$).pipe(
|
|
1594
1582
|
pi(1)
|
|
1595
|
-
),
|
|
1583
|
+
), r = e.settings.values$.pipe(
|
|
1596
1584
|
Y(() => e.settings.values.computedPageTurnMode),
|
|
1597
1585
|
Z()
|
|
1598
1586
|
).pipe(
|
|
@@ -1601,17 +1589,17 @@ const Sn = (e, t) => {
|
|
|
1601
1589
|
),
|
|
1602
1590
|
G(e.$.destroy$)
|
|
1603
1591
|
);
|
|
1604
|
-
return v(i,
|
|
1605
|
-
},
|
|
1592
|
+
return v(i, r);
|
|
1593
|
+
}, bn = (e) => {
|
|
1606
1594
|
e.hookManager.register(
|
|
1607
1595
|
"item.onAfterLayout",
|
|
1608
1596
|
({ item: t, blankPagePosition: i, minimumWidth: n }) => {
|
|
1609
1597
|
const o = e.spineItemsManager.get(t.id), s = o == null ? void 0 : o.renderer.getDocumentFrame();
|
|
1610
1598
|
if ((o == null ? void 0 : o.renditionLayout) !== "reflowable" || !(s instanceof HTMLIFrameElement))
|
|
1611
1599
|
return;
|
|
1612
|
-
const { hasViewport:
|
|
1613
|
-
if (
|
|
1614
|
-
const u =
|
|
1600
|
+
const { hasViewport: a } = Zt(s), { width: r } = e.context.getPageSize(), c = o == null ? void 0 : o.renderer.getDocumentFrame();
|
|
1601
|
+
if (a) {
|
|
1602
|
+
const u = r < n;
|
|
1615
1603
|
i === "none" && u && c instanceof HTMLIFrameElement && (c == null || c.style.setProperty(
|
|
1616
1604
|
"left",
|
|
1617
1605
|
e.context.isRTL() ? "75%" : "25%"
|
|
@@ -1619,35 +1607,35 @@ const Sn = (e, t) => {
|
|
|
1619
1607
|
}
|
|
1620
1608
|
}
|
|
1621
1609
|
);
|
|
1622
|
-
},
|
|
1610
|
+
}, In = (e, t) => t.pipe(
|
|
1623
1611
|
$((i) => {
|
|
1624
1612
|
e.viewport.value.element.style.transition = "transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275)", e.settings.values.computedPageTurnMode === "scrollable" ? e.viewport.value.element.style.transformOrigin = "top" : e.viewport.value.element.style.transformOrigin = "center", i === "thumbnails" ? e.viewport.value.element.style.transform = "scale(0.5)" : e.viewport.value.element.style.transform = "scale(1)", e.layout();
|
|
1625
1613
|
})
|
|
1626
|
-
),
|
|
1614
|
+
), wn = (e) => (t) => {
|
|
1627
1615
|
const {
|
|
1628
1616
|
pageHorizontalMargin: i,
|
|
1629
1617
|
pageVerticalMargin: n,
|
|
1630
1618
|
layoutAutoResize: o,
|
|
1631
1619
|
layoutLayerTransition: s,
|
|
1632
|
-
viewportMode:
|
|
1633
|
-
} = t,
|
|
1620
|
+
viewportMode: a
|
|
1621
|
+
} = t, r = e(t), c = new ln(
|
|
1634
1622
|
{
|
|
1635
1623
|
pageHorizontalMargin: i,
|
|
1636
1624
|
pageVerticalMargin: n,
|
|
1637
1625
|
layoutAutoResize: o,
|
|
1638
1626
|
layoutLayerTransition: s,
|
|
1639
|
-
viewportMode:
|
|
1627
|
+
viewportMode: a
|
|
1640
1628
|
},
|
|
1641
|
-
|
|
1629
|
+
r.settings
|
|
1642
1630
|
);
|
|
1643
|
-
|
|
1631
|
+
r.hookManager.register("onViewportOffsetAdjust", () => {
|
|
1644
1632
|
let m = !1;
|
|
1645
|
-
|
|
1633
|
+
r.spineItemsManager.items.forEach((y) => {
|
|
1646
1634
|
const f = y.renderer.getDocumentFrame();
|
|
1647
1635
|
!m && f && (f.getBoundingClientRect().left, m = !0);
|
|
1648
1636
|
});
|
|
1649
|
-
}),
|
|
1650
|
-
const y =
|
|
1637
|
+
}), r.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
|
|
1638
|
+
const y = r.spineItemsManager.get(m.id), f = m.mediaType ?? Mt(m.href), b = !!(f != null && f.startsWith("image/")), { pageHorizontalMargin: I = 0, pageVerticalMargin: x = 0 } = c.values, F = r.context.getPageSize();
|
|
1651
1639
|
if ((y == null ? void 0 : y.renditionLayout) === "reflowable" && !b) {
|
|
1652
1640
|
let C = F.width - I * 2;
|
|
1653
1641
|
const D = F.height - x * 2;
|
|
@@ -1678,16 +1666,16 @@ const Sn = (e, t) => {
|
|
|
1678
1666
|
`
|
|
1679
1667
|
);
|
|
1680
1668
|
}
|
|
1681
|
-
}),
|
|
1669
|
+
}), bn(r), r.hookManager.register(
|
|
1682
1670
|
"item.onDocumentCreated",
|
|
1683
1671
|
({ documentContainer: m }) => {
|
|
1684
1672
|
m.style.opacity = "0", c.values.layoutLayerTransition && (m.style.transition = "opacity 300ms");
|
|
1685
1673
|
}
|
|
1686
|
-
),
|
|
1687
|
-
const y =
|
|
1688
|
-
|
|
1674
|
+
), r.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
|
|
1675
|
+
const y = r.spineItemsManager.get(m.id), f = y == null ? void 0 : y.renderer.documentContainer;
|
|
1676
|
+
r.settings.values.computedPageTurnMode !== "scrollable" && (f == null || f.setAttribute("tab-index", "0"));
|
|
1689
1677
|
});
|
|
1690
|
-
const u =
|
|
1678
|
+
const u = r.spineItemsObserver.itemIsReady$.pipe(
|
|
1691
1679
|
K(({ isReady: m }) => m),
|
|
1692
1680
|
k(({ item: m }) => {
|
|
1693
1681
|
const y = m.renderer.documentContainer;
|
|
@@ -1695,31 +1683,31 @@ const Sn = (e, t) => {
|
|
|
1695
1683
|
})
|
|
1696
1684
|
), d = c.values$.pipe(
|
|
1697
1685
|
K(({ layoutAutoResize: m }) => m === "container"),
|
|
1698
|
-
_(() =>
|
|
1686
|
+
_(() => r.context.watch("rootElement")),
|
|
1699
1687
|
K(at),
|
|
1700
1688
|
_((m) => Kt(m)),
|
|
1701
1689
|
hi(100),
|
|
1702
1690
|
K(at),
|
|
1703
1691
|
k(() => {
|
|
1704
|
-
|
|
1692
|
+
r == null || r.layout();
|
|
1705
1693
|
})
|
|
1706
|
-
), g =
|
|
1694
|
+
), g = Sn(r);
|
|
1707
1695
|
c.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
|
|
1708
1696
|
mi(1),
|
|
1709
1697
|
k(() => {
|
|
1710
|
-
|
|
1698
|
+
r.layout();
|
|
1711
1699
|
}),
|
|
1712
|
-
G(
|
|
1700
|
+
G(r.$.destroy$)
|
|
1713
1701
|
).subscribe();
|
|
1714
|
-
const l =
|
|
1702
|
+
const l = r.spineItemsObserver.itemIsReady$.pipe(
|
|
1715
1703
|
k(({ item: m, isReady: y }) => {
|
|
1716
1704
|
const f = "prose-spineItem-ready";
|
|
1717
1705
|
y ? m.containerElement.classList.add(f) : m.containerElement.classList.remove(f);
|
|
1718
1706
|
})
|
|
1719
|
-
), h =
|
|
1720
|
-
|
|
1707
|
+
), h = In(
|
|
1708
|
+
r,
|
|
1721
1709
|
c.watch("viewportMode")
|
|
1722
|
-
), p =
|
|
1710
|
+
), p = r.spine.pages.pipe(
|
|
1723
1711
|
bt({ refCount: !0, bufferSize: 1 })
|
|
1724
1712
|
);
|
|
1725
1713
|
return v(
|
|
@@ -1729,17 +1717,17 @@ const Sn = (e, t) => {
|
|
|
1729
1717
|
d,
|
|
1730
1718
|
h,
|
|
1731
1719
|
p
|
|
1732
|
-
).pipe(G(
|
|
1733
|
-
...
|
|
1720
|
+
).pipe(G(r.$.destroy$)).subscribe(), {
|
|
1721
|
+
...r,
|
|
1734
1722
|
destroy: () => {
|
|
1735
|
-
c.destroy(),
|
|
1723
|
+
c.destroy(), r.destroy();
|
|
1736
1724
|
},
|
|
1737
1725
|
settings: c,
|
|
1738
|
-
layout$:
|
|
1726
|
+
layout$: r.spine.layout$,
|
|
1739
1727
|
layoutInfo$: p,
|
|
1740
|
-
coordinates:
|
|
1728
|
+
coordinates: yn(r)
|
|
1741
1729
|
};
|
|
1742
|
-
},
|
|
1730
|
+
}, Pn = `${pt}-enhancer-loading`, We = `${Pn}-container`, vn = (e, t) => {
|
|
1743
1731
|
const i = e.ownerDocument.createElement("div");
|
|
1744
1732
|
return i.classList.add(We), i.style.cssText = `
|
|
1745
1733
|
height: 100%;
|
|
@@ -1757,7 +1745,7 @@ const Sn = (e, t) => {
|
|
|
1757
1745
|
background-color: white;
|
|
1758
1746
|
z-index: 1;
|
|
1759
1747
|
`, i;
|
|
1760
|
-
},
|
|
1748
|
+
}, xn = ({
|
|
1761
1749
|
container: e,
|
|
1762
1750
|
item: t
|
|
1763
1751
|
}) => {
|
|
@@ -1774,8 +1762,8 @@ const Sn = (e, t) => {
|
|
|
1774
1762
|
max-width: 300px;
|
|
1775
1763
|
width: 80%;
|
|
1776
1764
|
`, e.appendChild(i), e.appendChild(n), e;
|
|
1777
|
-
},
|
|
1778
|
-
const { loadingElementCreate: i =
|
|
1765
|
+
}, $n = (e) => (t) => {
|
|
1766
|
+
const { loadingElementCreate: i = xn } = t, n = e(t), o = (c) => w(
|
|
1779
1767
|
c.reduce((u, { item: d, element: g }) => {
|
|
1780
1768
|
g.style.zIndex = "0";
|
|
1781
1769
|
const l = g.querySelector(
|
|
@@ -1784,7 +1772,7 @@ const Sn = (e, t) => {
|
|
|
1784
1772
|
if (l instanceof HTMLElement)
|
|
1785
1773
|
return u[d.id] = l, u;
|
|
1786
1774
|
const h = i({
|
|
1787
|
-
container:
|
|
1775
|
+
container: vn(g, n.context),
|
|
1788
1776
|
item: d
|
|
1789
1777
|
});
|
|
1790
1778
|
return g.appendChild(h), u[d.id] = h, u;
|
|
@@ -1803,7 +1791,7 @@ const Sn = (e, t) => {
|
|
|
1803
1791
|
);
|
|
1804
1792
|
});
|
|
1805
1793
|
})
|
|
1806
|
-
),
|
|
1794
|
+
), a = (c) => n.spineItemsObserver.itemIsReady$.pipe(
|
|
1807
1795
|
k(({ item: u, isReady: d }) => {
|
|
1808
1796
|
var g, l;
|
|
1809
1797
|
(g = c[u.item.id]) == null || g.style.setProperty(
|
|
@@ -1814,16 +1802,16 @@ const Sn = (e, t) => {
|
|
|
1814
1802
|
d ? "0" : "1"
|
|
1815
1803
|
);
|
|
1816
1804
|
})
|
|
1817
|
-
),
|
|
1805
|
+
), r = n.spineItemsManager.items$.pipe(
|
|
1818
1806
|
_((c) => o(c)),
|
|
1819
1807
|
bt(1),
|
|
1820
1808
|
G(n.context.destroy$)
|
|
1821
1809
|
);
|
|
1822
|
-
return
|
|
1810
|
+
return r.pipe(
|
|
1823
1811
|
_(
|
|
1824
1812
|
(c) => v(
|
|
1825
1813
|
s(c),
|
|
1826
|
-
|
|
1814
|
+
a(c)
|
|
1827
1815
|
)
|
|
1828
1816
|
),
|
|
1829
1817
|
G(n.$.destroy$)
|
|
@@ -1831,12 +1819,12 @@ const Sn = (e, t) => {
|
|
|
1831
1819
|
...n,
|
|
1832
1820
|
loading: {
|
|
1833
1821
|
$: {
|
|
1834
|
-
items$:
|
|
1822
|
+
items$: r
|
|
1835
1823
|
}
|
|
1836
1824
|
}
|
|
1837
1825
|
};
|
|
1838
1826
|
};
|
|
1839
|
-
class
|
|
1827
|
+
class Tn extends ft {
|
|
1840
1828
|
getImageElement() {
|
|
1841
1829
|
const t = this.documentContainer;
|
|
1842
1830
|
if (t instanceof HTMLImageElement)
|
|
@@ -1874,11 +1862,11 @@ class Mn extends mt {
|
|
|
1874
1862
|
}) {
|
|
1875
1863
|
const i = this.getImageElement(), { height: n, width: o } = this.context.getPageSize();
|
|
1876
1864
|
let s = n;
|
|
1877
|
-
const
|
|
1865
|
+
const a = o;
|
|
1878
1866
|
if (!i) return w(void 0);
|
|
1879
|
-
const
|
|
1880
|
-
return this.settings.values.computedPageTurnDirection === "vertical" && this.settings.values.computedPageTurnMode === "scrollable" && !this.context.state.isUsingSpreadMode && (s = Math.ceil(o / u)), i.style.height = `${s}px`, i.style.width = `${
|
|
1881
|
-
width:
|
|
1867
|
+
const r = i.naturalWidth || 1, c = i.naturalHeight || 1, u = r / c;
|
|
1868
|
+
return this.settings.values.computedPageTurnDirection === "vertical" && this.settings.values.computedPageTurnMode === "scrollable" && !this.context.state.isUsingSpreadMode && (s = Math.ceil(o / u)), i.style.height = `${s}px`, i.style.width = `${a}px`, i.style.objectPosition = t === "left" ? "right" : t === "right" ? "left" : "center", w({
|
|
1869
|
+
width: a,
|
|
1882
1870
|
height: s
|
|
1883
1871
|
});
|
|
1884
1872
|
}
|
|
@@ -1888,22 +1876,22 @@ class Mn extends mt {
|
|
|
1888
1876
|
getDocumentFrame() {
|
|
1889
1877
|
}
|
|
1890
1878
|
}
|
|
1891
|
-
const
|
|
1879
|
+
const Fn = (e) => (t) => {
|
|
1892
1880
|
const i = e({
|
|
1893
1881
|
...t,
|
|
1894
|
-
getRenderer(
|
|
1882
|
+
getRenderer(a) {
|
|
1895
1883
|
var d;
|
|
1896
|
-
const
|
|
1897
|
-
return !
|
|
1884
|
+
const r = (d = t.getRenderer) == null ? void 0 : d.call(t, a), c = a.mediaType ?? Mt(a.href), u = !!(c != null && c.startsWith("image/"));
|
|
1885
|
+
return !r && u ? (g) => new Tn(g) : r;
|
|
1898
1886
|
}
|
|
1899
1887
|
}), n = new IntersectionObserver(
|
|
1900
|
-
(
|
|
1901
|
-
|
|
1888
|
+
(a) => {
|
|
1889
|
+
a.forEach((r) => {
|
|
1902
1890
|
var d;
|
|
1903
|
-
const c =
|
|
1891
|
+
const c = r.target, u = Array.from(
|
|
1904
1892
|
((d = c.contentDocument) == null ? void 0 : d.body.getElementsByTagName("audio")) || []
|
|
1905
1893
|
);
|
|
1906
|
-
|
|
1894
|
+
r.isIntersecting ? u.forEach((g) => {
|
|
1907
1895
|
g.hasAttribute("autoplay") && g.paused && g.readyState >= 2 && g.play().catch(console.error);
|
|
1908
1896
|
}) : u.forEach((g) => {
|
|
1909
1897
|
g.pause(), g.currentTime = 0;
|
|
@@ -1914,11 +1902,11 @@ const Cn = (e) => (t) => {
|
|
|
1914
1902
|
threshold: 0.01
|
|
1915
1903
|
}
|
|
1916
1904
|
), o = new IntersectionObserver(
|
|
1917
|
-
(
|
|
1918
|
-
|
|
1919
|
-
if (
|
|
1920
|
-
const c =
|
|
1921
|
-
|
|
1905
|
+
(a) => {
|
|
1906
|
+
a.forEach((r) => {
|
|
1907
|
+
if (r.target.tagName === "video") {
|
|
1908
|
+
const c = r.target;
|
|
1909
|
+
r.isIntersecting ? c.hasAttribute("autoplay") && c.paused && c.readyState >= 2 && c.play().catch(console.error) : (c.pause(), c.currentTime = 0);
|
|
1922
1910
|
}
|
|
1923
1911
|
});
|
|
1924
1912
|
},
|
|
@@ -1928,13 +1916,13 @@ const Cn = (e) => (t) => {
|
|
|
1928
1916
|
);
|
|
1929
1917
|
return i.hookManager.register(
|
|
1930
1918
|
"item.onDocumentLoad",
|
|
1931
|
-
({ destroy:
|
|
1919
|
+
({ destroy: a, itemId: r }) => {
|
|
1932
1920
|
var g, l;
|
|
1933
|
-
const c = (g = i.spineItemsManager.get(
|
|
1921
|
+
const c = (g = i.spineItemsManager.get(r)) == null ? void 0 : g.renderer.getDocumentFrame();
|
|
1934
1922
|
if (!c) return;
|
|
1935
1923
|
n.observe(c);
|
|
1936
1924
|
const u = (l = c.contentDocument) == null ? void 0 : l.body.getElementsByTagName("video"), d = Array.from(u || []).map((h) => (o.observe(h), () => o.unobserve(h)));
|
|
1937
|
-
|
|
1925
|
+
a(() => {
|
|
1938
1926
|
n.unobserve(c), d.forEach((h) => h());
|
|
1939
1927
|
});
|
|
1940
1928
|
}
|
|
@@ -1944,16 +1932,16 @@ const Cn = (e) => (t) => {
|
|
|
1944
1932
|
n.disconnect(), o.disconnect(), i.destroy();
|
|
1945
1933
|
}
|
|
1946
1934
|
};
|
|
1947
|
-
},
|
|
1935
|
+
}, Ln = (e, t) => e.links$.pipe(
|
|
1948
1936
|
$((i) => {
|
|
1949
|
-
var
|
|
1950
|
-
if (!
|
|
1937
|
+
var a;
|
|
1938
|
+
if (!Oi(i.target, "a") || i.type !== "click") return;
|
|
1951
1939
|
const n = new URL(i.target.href), o = `${n.origin}${n.pathname}`;
|
|
1952
|
-
((
|
|
1953
|
-
(
|
|
1940
|
+
((a = e.context.manifest) == null ? void 0 : a.spineItems.some(
|
|
1941
|
+
(r) => r.href === o
|
|
1954
1942
|
)) && t.goToUrl(n);
|
|
1955
1943
|
})
|
|
1956
|
-
), st = O.namespace("navigation"),
|
|
1944
|
+
), st = O.namespace("navigation"), Mn = ({
|
|
1957
1945
|
position: e,
|
|
1958
1946
|
spineItem: t,
|
|
1959
1947
|
pageHeight: i,
|
|
@@ -1979,15 +1967,15 @@ const Cn = (e) => (t) => {
|
|
|
1979
1967
|
spineLocator: o,
|
|
1980
1968
|
context: s
|
|
1981
1969
|
}) => {
|
|
1982
|
-
const
|
|
1983
|
-
if (!
|
|
1970
|
+
const a = i, r = o.getSpineItemFromPosition(e) || n.get(0), c = e;
|
|
1971
|
+
if (!r)
|
|
1984
1972
|
return c;
|
|
1985
1973
|
const u = o.getSpineItemPositionFromSpinePosition(
|
|
1986
1974
|
e,
|
|
1987
|
-
|
|
1988
|
-
), d =
|
|
1975
|
+
r
|
|
1976
|
+
), d = Mn({
|
|
1989
1977
|
position: u,
|
|
1990
|
-
spineItem:
|
|
1978
|
+
spineItem: r,
|
|
1991
1979
|
pageHeight: s.getPageSize().height,
|
|
1992
1980
|
pageWidth: s.getPageSize().width,
|
|
1993
1981
|
spineItemLocator: o.spineItemLocator
|
|
@@ -1997,9 +1985,9 @@ const Cn = (e) => (t) => {
|
|
|
1997
1985
|
u
|
|
1998
1986
|
) ? o.getSpinePositionFromSpineItemPosition({
|
|
1999
1987
|
spineItemPosition: d,
|
|
2000
|
-
spineItem:
|
|
1988
|
+
spineItem: r
|
|
2001
1989
|
}) : t.getAdjustedPositionWithSafeEdge(
|
|
2002
|
-
|
|
1990
|
+
a === "horizontal" ? new L({
|
|
2003
1991
|
x: e.x - s.getPageSize().width,
|
|
2004
1992
|
y: 0
|
|
2005
1993
|
}) : new L({
|
|
@@ -2007,49 +1995,49 @@ const Cn = (e) => (t) => {
|
|
|
2007
1995
|
x: 0
|
|
2008
1996
|
})
|
|
2009
1997
|
);
|
|
2010
|
-
},
|
|
1998
|
+
}, Cn = ({
|
|
2011
1999
|
position: e,
|
|
2012
2000
|
spineItem: t,
|
|
2013
2001
|
context: i,
|
|
2014
2002
|
navigationResolver: n,
|
|
2015
2003
|
spineItemsManager: o,
|
|
2016
2004
|
spineLocator: s,
|
|
2017
|
-
computedPageTurnDirection:
|
|
2005
|
+
computedPageTurnDirection: a
|
|
2018
2006
|
}) => {
|
|
2019
|
-
const
|
|
2007
|
+
const r = de({
|
|
2020
2008
|
position: e,
|
|
2021
2009
|
context: i,
|
|
2022
2010
|
navigationResolver: n,
|
|
2023
|
-
computedPageTurnDirection:
|
|
2011
|
+
computedPageTurnDirection: a,
|
|
2024
2012
|
spineItemsManager: o,
|
|
2025
2013
|
spineLocator: s
|
|
2026
2014
|
});
|
|
2027
|
-
if (t != null && t.isUsingVerticalWriting() && e.x ===
|
|
2028
|
-
return n.getAdjustedPositionForSpread(
|
|
2015
|
+
if (t != null && t.isUsingVerticalWriting() && e.x === r.x)
|
|
2016
|
+
return n.getAdjustedPositionForSpread(r);
|
|
2029
2017
|
if (i.state.isUsingSpreadMode) {
|
|
2030
|
-
if (t != null && t.isUsingVerticalWriting() && e.x !==
|
|
2018
|
+
if (t != null && t.isUsingVerticalWriting() && e.x !== r.x)
|
|
2031
2019
|
return n.getAdjustedPositionForSpread(
|
|
2032
2020
|
n.getAdjustedPositionWithSafeEdge(
|
|
2033
|
-
i.isRTL() ? { ...
|
|
2034
|
-
...
|
|
2035
|
-
x:
|
|
2021
|
+
i.isRTL() ? { ...r, x: r.x + i.getPageSize().width } : {
|
|
2022
|
+
...r,
|
|
2023
|
+
x: r.x - i.getPageSize().width
|
|
2036
2024
|
}
|
|
2037
2025
|
)
|
|
2038
2026
|
);
|
|
2039
|
-
if (
|
|
2040
|
-
return n.getAdjustedPositionForSpread(
|
|
2027
|
+
if (a === "vertical" && e.y !== r.y)
|
|
2028
|
+
return n.getAdjustedPositionForSpread(r);
|
|
2041
2029
|
const c = de({
|
|
2042
|
-
position:
|
|
2030
|
+
position: r,
|
|
2043
2031
|
context: i,
|
|
2044
2032
|
navigationResolver: n,
|
|
2045
|
-
computedPageTurnDirection:
|
|
2033
|
+
computedPageTurnDirection: a,
|
|
2046
2034
|
spineItemsManager: o,
|
|
2047
2035
|
spineLocator: s
|
|
2048
2036
|
});
|
|
2049
2037
|
return n.getAdjustedPositionForSpread(c);
|
|
2050
2038
|
}
|
|
2051
|
-
return n.getAdjustedPositionForSpread(
|
|
2052
|
-
},
|
|
2039
|
+
return n.getAdjustedPositionForSpread(r);
|
|
2040
|
+
}, Rn = ({
|
|
2053
2041
|
position: e,
|
|
2054
2042
|
spineItem: t,
|
|
2055
2043
|
pageHeight: i,
|
|
@@ -2075,15 +2063,15 @@ const Cn = (e) => (t) => {
|
|
|
2075
2063
|
spineLocator: o,
|
|
2076
2064
|
context: s
|
|
2077
2065
|
}) => {
|
|
2078
|
-
const
|
|
2079
|
-
if (!
|
|
2066
|
+
const a = i, r = o.getSpineItemFromPosition(e) || n.get(0), c = e;
|
|
2067
|
+
if (!r)
|
|
2080
2068
|
return c;
|
|
2081
2069
|
const u = o.getSpineItemPositionFromSpinePosition(
|
|
2082
2070
|
e,
|
|
2083
|
-
|
|
2084
|
-
), d =
|
|
2071
|
+
r
|
|
2072
|
+
), d = Rn({
|
|
2085
2073
|
position: u,
|
|
2086
|
-
spineItem:
|
|
2074
|
+
spineItem: r,
|
|
2087
2075
|
pageHeight: s.getPageSize().height,
|
|
2088
2076
|
pageWidth: s.getPageSize().width,
|
|
2089
2077
|
spineItemLocator: o.spineItemLocator
|
|
@@ -2093,9 +2081,9 @@ const Cn = (e) => (t) => {
|
|
|
2093
2081
|
u
|
|
2094
2082
|
) ? o.getSpinePositionFromSpineItemPosition({
|
|
2095
2083
|
spineItemPosition: d,
|
|
2096
|
-
spineItem:
|
|
2084
|
+
spineItem: r
|
|
2097
2085
|
}) : t.getAdjustedPositionWithSafeEdge(
|
|
2098
|
-
|
|
2086
|
+
a === "horizontal" ? new L({
|
|
2099
2087
|
x: e.x + s.getPageSize().width,
|
|
2100
2088
|
y: 0
|
|
2101
2089
|
}) : new L({
|
|
@@ -2103,53 +2091,53 @@ const Cn = (e) => (t) => {
|
|
|
2103
2091
|
x: 0
|
|
2104
2092
|
})
|
|
2105
2093
|
);
|
|
2106
|
-
},
|
|
2094
|
+
}, An = ({
|
|
2107
2095
|
position: e,
|
|
2108
2096
|
spineItem: t,
|
|
2109
2097
|
context: i,
|
|
2110
2098
|
navigationResolver: n,
|
|
2111
2099
|
spineItemsManager: o,
|
|
2112
2100
|
spineLocator: s,
|
|
2113
|
-
computedPageTurnDirection:
|
|
2101
|
+
computedPageTurnDirection: a
|
|
2114
2102
|
}) => {
|
|
2115
|
-
const
|
|
2103
|
+
const r = ge({
|
|
2116
2104
|
position: e,
|
|
2117
2105
|
context: i,
|
|
2118
2106
|
navigationResolver: n,
|
|
2119
|
-
computedPageTurnDirection:
|
|
2107
|
+
computedPageTurnDirection: a,
|
|
2120
2108
|
spineItemsManager: o,
|
|
2121
2109
|
spineLocator: s
|
|
2122
2110
|
});
|
|
2123
|
-
if (t != null && t.isUsingVerticalWriting() && e.x ===
|
|
2124
|
-
return n.getAdjustedPositionForSpread(
|
|
2111
|
+
if (t != null && t.isUsingVerticalWriting() && e.x === r.x)
|
|
2112
|
+
return n.getAdjustedPositionForSpread(r);
|
|
2125
2113
|
if (i.state.isUsingSpreadMode) {
|
|
2126
|
-
if (t != null && t.isUsingVerticalWriting() && e.x !==
|
|
2114
|
+
if (t != null && t.isUsingVerticalWriting() && e.x !== r.x)
|
|
2127
2115
|
return n.getAdjustedPositionForSpread(
|
|
2128
2116
|
n.getAdjustedPositionWithSafeEdge(
|
|
2129
2117
|
i.isRTL() ? {
|
|
2130
|
-
...
|
|
2131
|
-
x:
|
|
2118
|
+
...r,
|
|
2119
|
+
x: r.x - i.getPageSize().width
|
|
2132
2120
|
} : {
|
|
2133
|
-
...
|
|
2134
|
-
x:
|
|
2121
|
+
...r,
|
|
2122
|
+
x: r.x + i.getPageSize().width
|
|
2135
2123
|
}
|
|
2136
2124
|
)
|
|
2137
2125
|
);
|
|
2138
|
-
if (
|
|
2139
|
-
return n.getAdjustedPositionForSpread(
|
|
2126
|
+
if (a === "vertical" && e.y !== r.y)
|
|
2127
|
+
return n.getAdjustedPositionForSpread(r);
|
|
2140
2128
|
const c = ge({
|
|
2141
|
-
position:
|
|
2129
|
+
position: r,
|
|
2142
2130
|
context: i,
|
|
2143
2131
|
navigationResolver: n,
|
|
2144
|
-
computedPageTurnDirection:
|
|
2132
|
+
computedPageTurnDirection: a,
|
|
2145
2133
|
spineItemsManager: o,
|
|
2146
2134
|
spineLocator: s
|
|
2147
2135
|
});
|
|
2148
2136
|
return n.getAdjustedPositionForSpread(c);
|
|
2149
2137
|
}
|
|
2150
|
-
return n.getAdjustedPositionForSpread(
|
|
2138
|
+
return n.getAdjustedPositionForSpread(r);
|
|
2151
2139
|
};
|
|
2152
|
-
class
|
|
2140
|
+
class Dn {
|
|
2153
2141
|
constructor(t) {
|
|
2154
2142
|
this.reader = t, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new L({ x: 0, y: 0 }), this.unlock = void 0;
|
|
2155
2143
|
}
|
|
@@ -2168,7 +2156,7 @@ class Vn {
|
|
|
2168
2156
|
turnRightOrBottom() {
|
|
2169
2157
|
const t = this.reader.navigation.getNavigation(), i = this.reader.spineItemsManager.get(t.spineItem);
|
|
2170
2158
|
if (!i) return;
|
|
2171
|
-
const n =
|
|
2159
|
+
const n = An({
|
|
2172
2160
|
context: this.reader.context,
|
|
2173
2161
|
navigationResolver: this.reader.navigation.navigationResolver,
|
|
2174
2162
|
position: t.position,
|
|
@@ -2184,7 +2172,7 @@ class Vn {
|
|
|
2184
2172
|
turnLeftOrTop() {
|
|
2185
2173
|
const t = this.reader.navigation.getNavigation(), i = this.reader.spineItemsManager.get(t.spineItem);
|
|
2186
2174
|
if (!i) return;
|
|
2187
|
-
const n =
|
|
2175
|
+
const n = Cn({
|
|
2188
2176
|
context: this.reader.context,
|
|
2189
2177
|
navigationResolver: this.reader.navigation.navigationResolver,
|
|
2190
2178
|
position: t.position,
|
|
@@ -2305,9 +2293,7 @@ class Vn {
|
|
|
2305
2293
|
absolutePageIndex: t,
|
|
2306
2294
|
...i
|
|
2307
2295
|
}) {
|
|
2308
|
-
const n = this.reader.spine.
|
|
2309
|
-
absolutePageIndex: t
|
|
2310
|
-
});
|
|
2296
|
+
const n = this.reader.spine.pages.fromAbsolutePageIndex(t);
|
|
2311
2297
|
if (st.debug(".goToAbsolutePageIndex()", {
|
|
2312
2298
|
absolutePageIndex: t,
|
|
2313
2299
|
...i,
|
|
@@ -2326,12 +2312,12 @@ class Vn {
|
|
|
2326
2312
|
}
|
|
2327
2313
|
}
|
|
2328
2314
|
}
|
|
2329
|
-
class
|
|
2315
|
+
class Nn {
|
|
2330
2316
|
constructor(t) {
|
|
2331
2317
|
this.reader = t, this.lastDelta = { x: 0, y: 0 }, this.lastPosition = new L({ x: 0, y: 0 }), this.lastStartPosition = new L({ x: 0, y: 0 }), this.unlock = void 0;
|
|
2332
2318
|
}
|
|
2333
2319
|
moveTo(t, { final: i, start: n } = {}) {
|
|
2334
|
-
var
|
|
2320
|
+
var a, r, c, u;
|
|
2335
2321
|
if (this.reader.settings.values.computedPageTurnMode === "scrollable") {
|
|
2336
2322
|
st.warn(
|
|
2337
2323
|
"pan control is not available on free page turn mode"
|
|
@@ -2339,10 +2325,10 @@ class jn {
|
|
|
2339
2325
|
return;
|
|
2340
2326
|
}
|
|
2341
2327
|
const o = this.reader.settings.values.computedPageTurnDirection;
|
|
2342
|
-
n && ((
|
|
2328
|
+
n && ((a = this.unlock) == null || a.call(this), this.unlock = this.reader.navigation.lock(), this.lastDelta = { x: 0, y: 0 }, this.lastStartPosition = this.reader.navigation.controlledNavigationController.viewportPosition, this.lastPosition = this.lastStartPosition);
|
|
2343
2329
|
let s = this.reader.navigation.getNavigation().position;
|
|
2344
2330
|
if (t) {
|
|
2345
|
-
const d = this.reader.viewport.absoluteViewport.width / this.reader.viewport.relativeViewport.width, g = Math.floor(t.x) - (((
|
|
2331
|
+
const d = this.reader.viewport.absoluteViewport.width / this.reader.viewport.relativeViewport.width, g = Math.floor(t.x) - (((r = this.lastDelta) == null ? void 0 : r.x) || 0), l = Math.floor(t.y) - (((c = this.lastDelta) == null ? void 0 : c.y) || 0), h = Math.floor(
|
|
2346
2332
|
o === "horizontal" ? this.lastPosition.x - g / d : 0
|
|
2347
2333
|
), p = Math.floor(
|
|
2348
2334
|
o === "horizontal" ? 0 : this.lastPosition.y - l / d
|
|
@@ -2366,7 +2352,7 @@ class jn {
|
|
|
2366
2352
|
});
|
|
2367
2353
|
}
|
|
2368
2354
|
}
|
|
2369
|
-
const
|
|
2355
|
+
const On = (e) => e.pagination.state$.pipe(
|
|
2370
2356
|
A(e.context.manifest$, e.settings.values$),
|
|
2371
2357
|
S(
|
|
2372
2358
|
([
|
|
@@ -2374,19 +2360,19 @@ const kn = (e) => e.pagination.state$.pipe(
|
|
|
2374
2360
|
{ spineItems: i, readingDirection: n },
|
|
2375
2361
|
{ computedPageTurnDirection: o }
|
|
2376
2362
|
]) => {
|
|
2377
|
-
const s = i.length ?? 0,
|
|
2363
|
+
const s = i.length ?? 0, a = t.beginSpineItemIndex === 0, r = t.endSpineItemIndex === Math.max(s - 1, 0), c = t.endSpineItemIndex === Math.max(s - 1, 0), u = t.beginSpineItemIndex === 0, d = t.beginPageIndexInSpineItem === 0, g = t.endPageIndexInSpineItem === t.endNumberOfPagesInSpineItem - 1;
|
|
2378
2364
|
return {
|
|
2379
2365
|
canTurnLeft: o === "vertical" ? !1 : !d,
|
|
2380
2366
|
canTurnRight: o === "vertical" ? !1 : !g,
|
|
2381
|
-
canGoTopSpineItem: o === "vertical" && !
|
|
2382
|
-
canGoBottomSpineItem: o === "vertical" && !
|
|
2383
|
-
canGoLeftSpineItem: o !== "vertical" && (n === "ltr" && !
|
|
2384
|
-
canGoRightSpineItem: o !== "vertical" && (n === "ltr" && !
|
|
2367
|
+
canGoTopSpineItem: o === "vertical" && !a,
|
|
2368
|
+
canGoBottomSpineItem: o === "vertical" && !r,
|
|
2369
|
+
canGoLeftSpineItem: o !== "vertical" && (n === "ltr" && !a || n === "rtl" && !c),
|
|
2370
|
+
canGoRightSpineItem: o !== "vertical" && (n === "ltr" && !r || n === "rtl" && !u)
|
|
2385
2371
|
};
|
|
2386
2372
|
}
|
|
2387
2373
|
),
|
|
2388
2374
|
H(N)
|
|
2389
|
-
),
|
|
2375
|
+
), Vn = ({ reader: e, duration: t }) => (i) => {
|
|
2390
2376
|
let n;
|
|
2391
2377
|
const o = () => {
|
|
2392
2378
|
n == null || n(), n = void 0;
|
|
@@ -2402,18 +2388,18 @@ const kn = (e) => e.pagination.state$.pipe(
|
|
|
2402
2388
|
$(o),
|
|
2403
2389
|
dt(o)
|
|
2404
2390
|
);
|
|
2405
|
-
},
|
|
2406
|
-
const i = e(t), n =
|
|
2391
|
+
}, jn = (e) => (t) => {
|
|
2392
|
+
const i = e(t), n = On(i), o = new Dn(i), s = new Nn(i), a = (c) => {
|
|
2407
2393
|
const { cfi: u, ...d } = c;
|
|
2408
2394
|
i.load(d), u && o.goToCfi(u, { animate: !1 });
|
|
2409
2395
|
};
|
|
2410
|
-
return
|
|
2396
|
+
return Ln(i, o).pipe(T(i.$.destroy$)).subscribe(), {
|
|
2411
2397
|
...i,
|
|
2412
|
-
load:
|
|
2398
|
+
load: a,
|
|
2413
2399
|
navigation: {
|
|
2414
2400
|
...i.navigation,
|
|
2415
2401
|
state$: n,
|
|
2416
|
-
throttleLock: ({ duration: c, trigger: u }) => u.pipe(
|
|
2402
|
+
throttleLock: ({ duration: c, trigger: u }) => u.pipe(Vn({ duration: c, reader: i })),
|
|
2417
2403
|
moveTo: s.moveTo.bind(s),
|
|
2418
2404
|
turnBottom: o.turnBottom.bind(o),
|
|
2419
2405
|
turnTop: o.turnTop.bind(o),
|
|
@@ -2436,7 +2422,7 @@ const kn = (e) => e.pagination.state$.pipe(
|
|
|
2436
2422
|
goToAbsolutePageIndex: o.goToAbsolutePageIndex.bind(o)
|
|
2437
2423
|
}
|
|
2438
2424
|
};
|
|
2439
|
-
},
|
|
2425
|
+
}, lt = (e) => Ut({
|
|
2440
2426
|
spineIndex: e.index,
|
|
2441
2427
|
spineId: e.id
|
|
2442
2428
|
}), Ue = ({
|
|
@@ -2445,7 +2431,7 @@ const kn = (e) => e.pagination.state$.pipe(
|
|
|
2445
2431
|
item: i
|
|
2446
2432
|
}) => {
|
|
2447
2433
|
const n = "ownerDocument" in e ? e.ownerDocument : e.startContainer.ownerDocument;
|
|
2448
|
-
return !n || !(n != null && n.documentElement) || e === n ?
|
|
2434
|
+
return !n || !(n != null && n.documentElement) || e === n ? lt(i) : Vi(e) ? Ut({
|
|
2449
2435
|
start: {
|
|
2450
2436
|
node: e.startContainer,
|
|
2451
2437
|
offset: e.startOffset,
|
|
@@ -2469,28 +2455,29 @@ const kn = (e) => e.pagination.state$.pipe(
|
|
|
2469
2455
|
spineItem: t,
|
|
2470
2456
|
spine: i
|
|
2471
2457
|
}) => {
|
|
2472
|
-
var
|
|
2458
|
+
var a;
|
|
2473
2459
|
const n = i.pages.value.pages.find(
|
|
2474
|
-
(
|
|
2460
|
+
(r) => r.itemIndex === t.index && r.pageIndex === e
|
|
2475
2461
|
), o = n == null ? void 0 : n.firstVisibleNode, s = t.renderer.getDocumentFrame();
|
|
2476
|
-
return o && s instanceof HTMLIFrameElement && ((
|
|
2462
|
+
return o && s instanceof HTMLIFrameElement && ((a = s.contentWindow) != null && a.document) ? Ue({
|
|
2477
2463
|
nodeOrRange: o.node,
|
|
2478
2464
|
offset: o.offset,
|
|
2479
2465
|
item: t.item
|
|
2480
|
-
}).trim() :
|
|
2481
|
-
},
|
|
2466
|
+
}).trim() : lt(t.item);
|
|
2467
|
+
}, kn = (e, t) => Ue({
|
|
2482
2468
|
nodeOrRange: e,
|
|
2483
2469
|
item: t
|
|
2484
|
-
}),
|
|
2470
|
+
}), Ns = (e) => e.index.toString(), le = (e) => {
|
|
2485
2471
|
var t;
|
|
2486
2472
|
return ((t = e[0]) == null ? void 0 : t.index) === 6 && e.length > 1;
|
|
2487
2473
|
}, Et = (e) => {
|
|
2488
2474
|
const t = Te(e);
|
|
2489
2475
|
return Si(t);
|
|
2490
|
-
},
|
|
2491
|
-
var
|
|
2492
|
-
const t = Te(e), n = (
|
|
2476
|
+
}, Wn = (e) => Array.isArray(e) ? e[0] && le(e[0]) ? e[0] : void 0 : e.parent[0] && le(e.parent[0]) ? e.parent[0] : void 0, ee = (e) => {
|
|
2477
|
+
var c, u, d, g;
|
|
2478
|
+
const t = Te(e), n = (Wn(t) ?? [])[1], s = ((n == null ? void 0 : n.index) ?? 2) / 2 - 1, a = bi(t), r = a ? (u = (c = t.end.at(-1)) == null ? void 0 : c.at(-1)) == null ? void 0 : u.offset : (g = (d = t.at(-1)) == null ? void 0 : d.at(-1)) == null ? void 0 : g.offset;
|
|
2493
2479
|
return {
|
|
2480
|
+
isCfiRange: a,
|
|
2494
2481
|
cleanedCfi: e,
|
|
2495
2482
|
itemIndex: s,
|
|
2496
2483
|
offset: r ?? 0
|
|
@@ -2499,76 +2486,95 @@ const kn = (e) => e.pagination.state$.pipe(
|
|
|
2499
2486
|
cfi: e,
|
|
2500
2487
|
spineItemsManager: t
|
|
2501
2488
|
}) => {
|
|
2502
|
-
var
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2489
|
+
var a, r;
|
|
2490
|
+
const { itemIndex: i, ...n } = ee(e), o = t.get(i);
|
|
2491
|
+
if (!o)
|
|
2492
|
+
return {
|
|
2493
|
+
...n,
|
|
2494
|
+
itemIndex: i
|
|
2495
|
+
};
|
|
2496
|
+
const s = o.renderer.getDocumentFrame();
|
|
2497
|
+
if (s instanceof HTMLIFrameElement) {
|
|
2498
|
+
const c = (a = s.contentWindow) == null ? void 0 : a.document;
|
|
2499
|
+
if (c)
|
|
2510
2500
|
try {
|
|
2511
|
-
const
|
|
2501
|
+
const u = Ii(e, c, {
|
|
2512
2502
|
throwOnError: !0
|
|
2513
2503
|
});
|
|
2514
2504
|
return {
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2505
|
+
...n,
|
|
2506
|
+
itemIndex: i,
|
|
2507
|
+
node: u.isRange ? (r = u.node) == null ? void 0 : r.startContainer : u.node,
|
|
2508
|
+
isCfiRange: u.isRange,
|
|
2509
|
+
range: u.isRange ? u.node : void 0,
|
|
2510
|
+
offset: Array.isArray(u.offset) ? u.offset.at(-1) : u.offset,
|
|
2511
|
+
spineItem: o
|
|
2520
2512
|
};
|
|
2521
|
-
} catch (
|
|
2522
|
-
return O.warn(`Error resolving cfi: ${e}.`), O.warn(
|
|
2523
|
-
|
|
2513
|
+
} catch (u) {
|
|
2514
|
+
return O.warn(`Error resolving cfi: ${e}.`), O.warn(u), {
|
|
2515
|
+
...n,
|
|
2516
|
+
spineItem: o,
|
|
2517
|
+
itemIndex: i
|
|
2524
2518
|
};
|
|
2525
2519
|
}
|
|
2526
2520
|
}
|
|
2527
2521
|
return {
|
|
2528
|
-
|
|
2522
|
+
...n,
|
|
2523
|
+
itemIndex: i,
|
|
2524
|
+
spineItem: o
|
|
2529
2525
|
};
|
|
2530
|
-
},
|
|
2531
|
-
if ("cfi" in t)
|
|
2532
|
-
|
|
2526
|
+
}, Un = (e, t) => {
|
|
2527
|
+
if ("cfi" in t) {
|
|
2528
|
+
const { itemIndex: s, ...a } = e.cfi.parseCfi(t.cfi);
|
|
2529
|
+
return {
|
|
2530
|
+
...t,
|
|
2531
|
+
...a,
|
|
2532
|
+
itemIndex: s
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2533
2535
|
const i = e.spineItemsManager.get(t);
|
|
2534
2536
|
if (!i)
|
|
2535
2537
|
throw new Error("Spine item not found");
|
|
2538
|
+
const n = lt(i.item);
|
|
2536
2539
|
return {
|
|
2537
|
-
cfi
|
|
2540
|
+
...e.cfi.parseCfi(n),
|
|
2541
|
+
cfi: lt(i.item),
|
|
2542
|
+
itemIndex: i.index
|
|
2538
2543
|
};
|
|
2539
|
-
},
|
|
2544
|
+
}, zn = (e, t) => {
|
|
2540
2545
|
let i = e == null ? void 0 : e.itemPageIndex;
|
|
2541
|
-
const { itemIndex: n } = t.cfi.parseCfi(e.cfi),
|
|
2542
|
-
return
|
|
2543
|
-
A(
|
|
2544
|
-
S(([,
|
|
2546
|
+
const { itemIndex: n, ...o } = t.cfi.parseCfi(e.cfi), s = t.spineItemsManager.get(n);
|
|
2547
|
+
return s ? De().pipe(
|
|
2548
|
+
A(s.isReady$),
|
|
2549
|
+
S(([, a]) => {
|
|
2545
2550
|
const {
|
|
2546
2551
|
node: r,
|
|
2547
|
-
offset:
|
|
2548
|
-
range:
|
|
2549
|
-
} =
|
|
2550
|
-
|
|
2552
|
+
offset: c,
|
|
2553
|
+
range: u
|
|
2554
|
+
} = a ? t.cfi.resolveCfi({ cfi: e.cfi }) : {};
|
|
2555
|
+
s.renditionLayout !== "pre-paginated" && r && (i = t.spine.locator.spineItemLocator.getSpineItemPageIndexFromNode(
|
|
2551
2556
|
r,
|
|
2552
|
-
|
|
2553
|
-
|
|
2557
|
+
c ?? 0,
|
|
2558
|
+
s
|
|
2554
2559
|
) ?? i);
|
|
2555
|
-
let
|
|
2556
|
-
return i === void 0 && (i = 0),
|
|
2560
|
+
let g = e == null ? void 0 : e.absolutePageIndex;
|
|
2561
|
+
return i === void 0 && (i = 0), g = t.spine.locator._getAbsolutePageIndexFromPageIndex({
|
|
2557
2562
|
pageIndex: i,
|
|
2558
|
-
spineItemOrId:
|
|
2563
|
+
spineItemOrId: s
|
|
2559
2564
|
}) ?? (e == null ? void 0 : e.absolutePageIndex), {
|
|
2560
2565
|
...e,
|
|
2561
|
-
|
|
2566
|
+
...o,
|
|
2567
|
+
range: u,
|
|
2562
2568
|
itemIndex: n,
|
|
2563
2569
|
startNode: r ?? void 0,
|
|
2564
|
-
startOffset:
|
|
2565
|
-
absolutePageIndex:
|
|
2570
|
+
startOffset: c,
|
|
2571
|
+
absolutePageIndex: g,
|
|
2566
2572
|
itemPageIndex: i
|
|
2567
2573
|
};
|
|
2568
2574
|
})
|
|
2569
|
-
) : w({ ...e, itemIndex: n });
|
|
2575
|
+
) : w({ ...e, itemIndex: n, ...o });
|
|
2570
2576
|
};
|
|
2571
|
-
class
|
|
2577
|
+
class Hn {
|
|
2572
2578
|
constructor(t) {
|
|
2573
2579
|
this.reader = t, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (i) => {
|
|
2574
2580
|
const n = this.locatorsByKey.get(i);
|
|
@@ -2576,44 +2582,43 @@ class _n {
|
|
|
2576
2582
|
}, this.locate = (i, n) => {
|
|
2577
2583
|
const o = {
|
|
2578
2584
|
resource: i,
|
|
2579
|
-
meta:
|
|
2585
|
+
meta: Un(this.reader, i)
|
|
2580
2586
|
};
|
|
2581
2587
|
return ae(() => {
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
} : this.reader.spine.spineItemsLoader.forceOpen([r.index]), u = "cfi" in i ? i.cfi : void 0, d = u ? this.locatorsByKey.get(u) : void 0, g = (p) => p.pipe(
|
|
2588
|
+
const s = this.reader.spineItemsManager.get(
|
|
2589
|
+
o.meta.itemIndex ?? 0
|
|
2590
|
+
), a = (s == null ? void 0 : s.renditionLayout) === "reflowable", r = n.mode === "shallow" || !a || !s ? () => {
|
|
2591
|
+
} : this.reader.spine.spineItemsLoader.forceOpen([s.index]), c = "cfi" in i ? i.cfi : void 0, u = c ? this.locatorsByKey.get(c) : void 0, d = (l) => l.pipe(
|
|
2587
2592
|
dt(() => {
|
|
2588
|
-
|
|
2589
|
-
|
|
2593
|
+
c && this.deregisterMemoizedStream(c), setTimeout(() => {
|
|
2594
|
+
r();
|
|
2590
2595
|
}, 1e3);
|
|
2591
2596
|
})
|
|
2592
2597
|
);
|
|
2593
|
-
if (
|
|
2594
|
-
return
|
|
2595
|
-
|
|
2596
|
-
S(({ resource:
|
|
2597
|
-
resource:
|
|
2598
|
-
meta:
|
|
2598
|
+
if (c && u)
|
|
2599
|
+
return u.observerCount++, d(
|
|
2600
|
+
u.consolidate$.pipe(
|
|
2601
|
+
S(({ resource: l, meta: h }) => ({
|
|
2602
|
+
resource: l,
|
|
2603
|
+
meta: h
|
|
2599
2604
|
}))
|
|
2600
2605
|
)
|
|
2601
2606
|
);
|
|
2602
|
-
const
|
|
2607
|
+
const g = this.reader.spine.layout$.pipe(
|
|
2603
2608
|
St(10),
|
|
2604
2609
|
it(o),
|
|
2605
|
-
oi((
|
|
2606
|
-
S((
|
|
2607
|
-
...
|
|
2608
|
-
meta:
|
|
2610
|
+
oi((l) => zn(l.meta, this.reader).pipe(
|
|
2611
|
+
S((h) => ({
|
|
2612
|
+
...l,
|
|
2613
|
+
meta: h
|
|
2609
2614
|
}))
|
|
2610
2615
|
), o),
|
|
2611
2616
|
tt({ refCount: !0, bufferSize: 1 })
|
|
2612
2617
|
);
|
|
2613
|
-
return
|
|
2618
|
+
return c && this.locatorsByKey.set(c, {
|
|
2614
2619
|
observerCount: 1,
|
|
2615
|
-
consolidate$:
|
|
2616
|
-
}), g
|
|
2620
|
+
consolidate$: g
|
|
2621
|
+
}), d(g);
|
|
2617
2622
|
});
|
|
2618
2623
|
};
|
|
2619
2624
|
}
|
|
@@ -2630,10 +2635,10 @@ const He = (e, t, i) => {
|
|
|
2630
2635
|
(o) => o.href === e
|
|
2631
2636
|
);
|
|
2632
2637
|
return t.reduce((o, s) => {
|
|
2633
|
-
const
|
|
2638
|
+
const a = s.href.indexOf("#"), r = a > 0 ? s.href.substr(0, a) : s.href, c = r.substring(
|
|
2634
2639
|
0,
|
|
2635
|
-
|
|
2636
|
-
), u = e.substring(0, e.lastIndexOf("/")), d = e.endsWith(
|
|
2640
|
+
r.lastIndexOf("/")
|
|
2641
|
+
), u = e.substring(0, e.lastIndexOf("/")), d = e.endsWith(r), g = u !== "" && u.endsWith(c);
|
|
2637
2642
|
if (d || g) {
|
|
2638
2643
|
const h = i.spineItems.findIndex(
|
|
2639
2644
|
(f) => f.href === s.href
|
|
@@ -2650,56 +2655,56 @@ const He = (e, t, i) => {
|
|
|
2650
2655
|
}
|
|
2651
2656
|
return o;
|
|
2652
2657
|
}, void 0);
|
|
2653
|
-
},
|
|
2658
|
+
}, Bn = (e, t) => {
|
|
2654
2659
|
var n;
|
|
2655
2660
|
const { href: i } = t;
|
|
2656
2661
|
return He(i, ((n = e.nav) == null ? void 0 : n.toc) ?? [], e);
|
|
2657
|
-
},
|
|
2662
|
+
}, En = (e) => {
|
|
2658
2663
|
const t = e.context.manifest, i = e.spineItemsManager.items;
|
|
2659
2664
|
return t ? i.reduce(
|
|
2660
|
-
(n, { item: o }) => (n[o.id] =
|
|
2665
|
+
(n, { item: o }) => (n[o.id] = Bn(t, o), n),
|
|
2661
2666
|
{}
|
|
2662
2667
|
) : {};
|
|
2663
|
-
},
|
|
2668
|
+
}, _n = (e) => e.spineItemsManager.items$.pipe(
|
|
2664
2669
|
it([]),
|
|
2665
|
-
S(() =>
|
|
2666
|
-
),
|
|
2667
|
-
const n = e.context, { height: o, width: s } = i.layout.layoutInfo, { top:
|
|
2670
|
+
S(() => En(e))
|
|
2671
|
+
), Xn = (e, t, i) => e + t * i, Yn = (e, t, i) => {
|
|
2672
|
+
const n = e.context, { height: o, width: s } = i.layout.layoutInfo, { top: a, left: r } = e.spine.getSpineItemSpineLayoutInfo(i);
|
|
2668
2673
|
return e.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
|
|
2669
2674
|
0,
|
|
2670
2675
|
Math.min(
|
|
2671
2676
|
1,
|
|
2672
|
-
(t.y -
|
|
2677
|
+
(t.y - a + n.state.visibleAreaRect.height) / o
|
|
2673
2678
|
)
|
|
2674
2679
|
) : Math.max(
|
|
2675
2680
|
0,
|
|
2676
2681
|
Math.min(
|
|
2677
2682
|
1,
|
|
2678
|
-
(t.x -
|
|
2683
|
+
(t.x - r + n.state.visibleAreaRect.width) / s
|
|
2679
2684
|
)
|
|
2680
2685
|
);
|
|
2681
|
-
},
|
|
2686
|
+
}, qn = (e, t, i, n, o) => o.isReady$.pipe(
|
|
2682
2687
|
z(),
|
|
2683
2688
|
A(e.layoutInfo$),
|
|
2684
|
-
S(([s,
|
|
2689
|
+
S(([s, a]) => {
|
|
2685
2690
|
var f, b, I, x, F, C, D;
|
|
2686
|
-
const
|
|
2691
|
+
const r = e.context, c = ((f = r.manifest) == null ? void 0 : f.renditionLayout) === "pre-paginated", u = ((b = r.manifest) == null ? void 0 : b.spineItems.length) || 0, d = ((I = r.manifest) == null ? void 0 : I.spineItems.slice(0, t).reduce((E, J) => E + (J.progressionWeight ?? 0), 0)) || 0, g = e.spineItemsManager.getSpineItemIndex(o) ?? 0, l = ((x = e.context.manifest) == null ? void 0 : x.spineItems.length) ?? 0, h = a.pages.filter((E) => E.itemIndex === g).length ?? 0, p = ((C = (F = r.manifest) == null ? void 0 : F.spineItems[t]) == null ? void 0 : C.progressionWeight) ?? // if no progressionWeight is defined we "assume" the document weight to be
|
|
2687
2692
|
// relative to the total number of documents
|
|
2688
2693
|
(g + 1) / l;
|
|
2689
2694
|
let m = (i + 1) * (p / h);
|
|
2690
2695
|
!c && o.renditionLayout === "reflowable" && !s && (m = 0);
|
|
2691
2696
|
let y = d + m;
|
|
2692
|
-
return ((D =
|
|
2697
|
+
return ((D = r.manifest) == null ? void 0 : D.renditionFlow) === "scrolled-continuous" && (s ? m = Yn(
|
|
2693
2698
|
e,
|
|
2694
2699
|
n,
|
|
2695
2700
|
o
|
|
2696
|
-
) : m = 0, y =
|
|
2701
|
+
) : m = 0, y = Xn(
|
|
2697
2702
|
d,
|
|
2698
2703
|
p,
|
|
2699
2704
|
m
|
|
2700
2705
|
)), t === u - 1 && i === h - 1 && y > 0.99 ? 1 : y;
|
|
2701
2706
|
})
|
|
2702
|
-
),
|
|
2707
|
+
), Zn = (e) => e.spine.layout$.pipe(
|
|
2703
2708
|
St(10, rt),
|
|
2704
2709
|
A(e.pagination.state$),
|
|
2705
2710
|
S(() => ({
|
|
@@ -2717,8 +2722,8 @@ const He = (e, t, i) => {
|
|
|
2717
2722
|
numberOfPagesPerItems: [],
|
|
2718
2723
|
numberOfTotalPages: 0
|
|
2719
2724
|
})
|
|
2720
|
-
),
|
|
2721
|
-
const o = e.context, s = t.beginSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.beginSpineItemIndex) : void 0,
|
|
2725
|
+
), Gn = (e, t, i, n) => {
|
|
2726
|
+
const o = e.context, s = t.beginSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.beginSpineItemIndex) : void 0, a = t.endSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.endSpineItemIndex) : void 0;
|
|
2722
2727
|
return w({
|
|
2723
2728
|
...t,
|
|
2724
2729
|
beginChapterInfo: s ? i[s.item.id] : void 0,
|
|
@@ -2733,8 +2738,8 @@ const He = (e, t, i) => {
|
|
|
2733
2738
|
// charOffset: number;
|
|
2734
2739
|
// serializeString?: string;
|
|
2735
2740
|
beginSpineItemReadingDirection: s == null ? void 0 : s.readingDirection,
|
|
2736
|
-
endChapterInfo:
|
|
2737
|
-
endSpineItemReadingDirection:
|
|
2741
|
+
endChapterInfo: a ? i[a.item.id] : void 0,
|
|
2742
|
+
endSpineItemReadingDirection: a == null ? void 0 : a.readingDirection,
|
|
2738
2743
|
// spineItemReadingDirection: focusedSpineItem?.getReadingDirection(),
|
|
2739
2744
|
/**
|
|
2740
2745
|
* This percentage is based of the weight (kb) of every items and the number of pages.
|
|
@@ -2748,7 +2753,7 @@ const He = (e, t, i) => {
|
|
|
2748
2753
|
// hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
|
|
2749
2754
|
// numberOfSpineItems: context.manifest?.readingOrder.length,
|
|
2750
2755
|
});
|
|
2751
|
-
},
|
|
2756
|
+
}, Jn = (e) => B([
|
|
2752
2757
|
e.pagination.state$,
|
|
2753
2758
|
// Usually pagination change if layout changes (number of pages) however it is especially
|
|
2754
2759
|
// useful for like webtoon where you still have one page but only the layout will give you the final size
|
|
@@ -2757,7 +2762,7 @@ const He = (e, t, i) => {
|
|
|
2757
2762
|
]).pipe(
|
|
2758
2763
|
P(([t]) => {
|
|
2759
2764
|
const i = t.endSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.endSpineItemIndex) : void 0;
|
|
2760
|
-
return i ?
|
|
2765
|
+
return i ? qn(
|
|
2761
2766
|
e,
|
|
2762
2767
|
t.endSpineItemIndex ?? 0,
|
|
2763
2768
|
t.endPageIndexInSpineItem || 0,
|
|
@@ -2765,8 +2770,8 @@ const He = (e, t, i) => {
|
|
|
2765
2770
|
i
|
|
2766
2771
|
) : w(0);
|
|
2767
2772
|
})
|
|
2768
|
-
),
|
|
2769
|
-
const t =
|
|
2773
|
+
), Kn = (e) => {
|
|
2774
|
+
const t = _n(e), i = Zn(e), n = new U({
|
|
2770
2775
|
...e.pagination.state,
|
|
2771
2776
|
beginChapterInfo: void 0,
|
|
2772
2777
|
beginCfi: void 0,
|
|
@@ -2784,17 +2789,17 @@ const He = (e, t, i) => {
|
|
|
2784
2789
|
}), o = B([
|
|
2785
2790
|
e.pagination.state$,
|
|
2786
2791
|
t,
|
|
2787
|
-
|
|
2792
|
+
Jn(e)
|
|
2788
2793
|
]).pipe(
|
|
2789
2794
|
P(
|
|
2790
|
-
([
|
|
2795
|
+
([a, r, c]) => Gn(
|
|
2791
2796
|
e,
|
|
2792
|
-
r,
|
|
2793
2797
|
a,
|
|
2798
|
+
r,
|
|
2794
2799
|
c
|
|
2795
2800
|
).pipe(
|
|
2796
2801
|
S((u) => ({
|
|
2797
|
-
...
|
|
2802
|
+
...a,
|
|
2798
2803
|
...u
|
|
2799
2804
|
}))
|
|
2800
2805
|
)
|
|
@@ -2805,27 +2810,27 @@ const He = (e, t, i) => {
|
|
|
2805
2810
|
o,
|
|
2806
2811
|
i
|
|
2807
2812
|
]).pipe(
|
|
2808
|
-
S(([
|
|
2809
|
-
...r,
|
|
2813
|
+
S(([a, r]) => ({
|
|
2810
2814
|
...a,
|
|
2811
|
-
|
|
2815
|
+
...r,
|
|
2816
|
+
beginAbsolutePageIndex: r.numberOfPagesPerItems.slice(0, a.beginSpineItemIndex).reduce(
|
|
2812
2817
|
(c, u) => c + u,
|
|
2813
|
-
|
|
2818
|
+
a.beginPageIndexInSpineItem ?? 0
|
|
2814
2819
|
),
|
|
2815
|
-
endAbsolutePageIndex:
|
|
2820
|
+
endAbsolutePageIndex: r.numberOfPagesPerItems.slice(0, a.endSpineItemIndex).reduce(
|
|
2816
2821
|
(c, u) => c + u,
|
|
2817
|
-
|
|
2822
|
+
a.endPageIndexInSpineItem ?? 0
|
|
2818
2823
|
)
|
|
2819
2824
|
})),
|
|
2820
|
-
$((
|
|
2821
|
-
n.next(
|
|
2825
|
+
$((a) => {
|
|
2826
|
+
n.next(a);
|
|
2822
2827
|
}),
|
|
2823
2828
|
tt(1)
|
|
2824
2829
|
), getPaginationInfo: () => n.value };
|
|
2825
|
-
},
|
|
2826
|
-
const i = e(t), { paginationInfo$: n, getPaginationInfo: o } =
|
|
2830
|
+
}, Qn = (e) => (t) => {
|
|
2831
|
+
const i = e(t), { paginationInfo$: n, getPaginationInfo: o } = Kn(i);
|
|
2827
2832
|
n.pipe(T(i.$.destroy$)).subscribe();
|
|
2828
|
-
const s = new
|
|
2833
|
+
const s = new Hn(i);
|
|
2829
2834
|
return {
|
|
2830
2835
|
...i,
|
|
2831
2836
|
locateResource: s.locateResource.bind(s),
|
|
@@ -2839,27 +2844,27 @@ const He = (e, t, i) => {
|
|
|
2839
2844
|
}
|
|
2840
2845
|
}
|
|
2841
2846
|
};
|
|
2842
|
-
},
|
|
2843
|
-
put: (s,
|
|
2847
|
+
}, to = (e) => ({
|
|
2848
|
+
put: (s, a) => new Promise((r, c) => {
|
|
2844
2849
|
const u = e.transaction(["store"], "readwrite");
|
|
2845
2850
|
u.onerror = (l) => {
|
|
2846
2851
|
c(l);
|
|
2847
2852
|
}, u.oncomplete = () => {
|
|
2848
|
-
|
|
2853
|
+
r();
|
|
2849
2854
|
};
|
|
2850
|
-
const g = u.objectStore("store").put(
|
|
2855
|
+
const g = u.objectStore("store").put(a, s);
|
|
2851
2856
|
g.onsuccess = () => {
|
|
2852
|
-
|
|
2857
|
+
r();
|
|
2853
2858
|
}, g.onerror = (l) => {
|
|
2854
2859
|
c(l);
|
|
2855
2860
|
};
|
|
2856
2861
|
}),
|
|
2857
|
-
keys: () => new Promise((s,
|
|
2858
|
-
const
|
|
2859
|
-
|
|
2860
|
-
|
|
2862
|
+
keys: () => new Promise((s, a) => {
|
|
2863
|
+
const r = e.transaction(["store"], "readonly");
|
|
2864
|
+
r.onerror = (g) => {
|
|
2865
|
+
a(g);
|
|
2861
2866
|
};
|
|
2862
|
-
const u =
|
|
2867
|
+
const u = r.objectStore("store").openKeyCursor(), d = [];
|
|
2863
2868
|
u.onsuccess = () => {
|
|
2864
2869
|
const g = u.result;
|
|
2865
2870
|
if (!g) {
|
|
@@ -2868,28 +2873,28 @@ const He = (e, t, i) => {
|
|
|
2868
2873
|
}
|
|
2869
2874
|
d.push(g.key), g.continue();
|
|
2870
2875
|
}, u.onerror = () => {
|
|
2871
|
-
|
|
2876
|
+
a(u.error);
|
|
2872
2877
|
};
|
|
2873
2878
|
}),
|
|
2874
|
-
get: (s) => new Promise((
|
|
2879
|
+
get: (s) => new Promise((a, r) => {
|
|
2875
2880
|
const c = e.transaction(["store"], "readwrite"), d = c.objectStore("store").get(s);
|
|
2876
2881
|
d.onsuccess = () => {
|
|
2877
2882
|
let g = d.result;
|
|
2878
|
-
g === void 0 && (g = null),
|
|
2883
|
+
g === void 0 && (g = null), a(g);
|
|
2879
2884
|
}, c.onerror = () => {
|
|
2880
|
-
|
|
2885
|
+
r(d.error);
|
|
2881
2886
|
};
|
|
2882
2887
|
}),
|
|
2883
|
-
remove: (s) => new Promise((
|
|
2888
|
+
remove: (s) => new Promise((a, r) => {
|
|
2884
2889
|
const c = e.transaction(["store"], "readwrite"), d = c.objectStore("store").delete(s);
|
|
2885
2890
|
c.onerror = () => {
|
|
2886
|
-
|
|
2891
|
+
r(d.error);
|
|
2887
2892
|
}, c.oncomplete = () => {
|
|
2888
|
-
|
|
2893
|
+
a();
|
|
2889
2894
|
}, c.onabort = () => {
|
|
2890
2895
|
var l;
|
|
2891
2896
|
const g = d.error ? d.error : (l = d.transaction) == null ? void 0 : l.error;
|
|
2892
|
-
|
|
2897
|
+
r(g);
|
|
2893
2898
|
};
|
|
2894
2899
|
})
|
|
2895
2900
|
}), Ot = async (e) => new Promise((t, i) => {
|
|
@@ -2897,11 +2902,11 @@ const He = (e, t, i) => {
|
|
|
2897
2902
|
n.onerror = (o) => {
|
|
2898
2903
|
i(o);
|
|
2899
2904
|
}, n.onsuccess = () => {
|
|
2900
|
-
t(
|
|
2905
|
+
t(to(n.result));
|
|
2901
2906
|
}, n.onupgradeneeded = () => {
|
|
2902
2907
|
n.result.createObjectStore("store");
|
|
2903
2908
|
};
|
|
2904
|
-
}),
|
|
2909
|
+
}), eo = (e) => {
|
|
2905
2910
|
let t = Date.now().toString();
|
|
2906
2911
|
const i = new W(), n = (c) => {
|
|
2907
2912
|
var u, d;
|
|
@@ -2933,12 +2938,12 @@ const He = (e, t, i) => {
|
|
|
2933
2938
|
}),
|
|
2934
2939
|
G(e.destroy$)
|
|
2935
2940
|
).subscribe();
|
|
2936
|
-
const
|
|
2941
|
+
const a = e.manifest$.pipe(
|
|
2937
2942
|
k(() => {
|
|
2938
2943
|
t = Date.now().toString();
|
|
2939
2944
|
})
|
|
2940
2945
|
);
|
|
2941
|
-
return v(
|
|
2946
|
+
return v(a).pipe(
|
|
2942
2947
|
_(() => (O.debug("Cleanup up old cache..."), j(Ot("prose-reader")).pipe(
|
|
2943
2948
|
_(
|
|
2944
2949
|
(c) => j(c.keys()).pipe(
|
|
@@ -2960,8 +2965,8 @@ const He = (e, t, i) => {
|
|
|
2960
2965
|
i.complete();
|
|
2961
2966
|
}
|
|
2962
2967
|
};
|
|
2963
|
-
},
|
|
2964
|
-
const i = e(t), n =
|
|
2968
|
+
}, io = (e) => (t) => {
|
|
2969
|
+
const i = e(t), n = eo(i.context);
|
|
2965
2970
|
return {
|
|
2966
2971
|
...i,
|
|
2967
2972
|
// $: {
|
|
@@ -2973,7 +2978,7 @@ const He = (e, t, i) => {
|
|
|
2973
2978
|
}
|
|
2974
2979
|
// load,
|
|
2975
2980
|
};
|
|
2976
|
-
},
|
|
2981
|
+
}, no = (e, t) => {
|
|
2977
2982
|
var o;
|
|
2978
2983
|
const i = (o = e.node.ownerDocument) == null ? void 0 : o.createRange(), n = e.node.compareDocumentPosition(t.node);
|
|
2979
2984
|
if (i) {
|
|
@@ -2983,8 +2988,8 @@ const He = (e, t, i) => {
|
|
|
2983
2988
|
else if (n & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
2984
2989
|
i.setStart(e.node, e.offset || 0), i.setEnd(t.node, t.offset || 0);
|
|
2985
2990
|
else {
|
|
2986
|
-
const s = Math.min(e.offset || 0, t.offset || 0),
|
|
2987
|
-
i.setStart(e.node, s), i.setEnd(e.node,
|
|
2991
|
+
const s = Math.min(e.offset || 0, t.offset || 0), a = Math.max(e.offset || 0, t.offset || 0);
|
|
2992
|
+
i.setStart(e.node, s), i.setEnd(e.node, a);
|
|
2988
2993
|
}
|
|
2989
2994
|
} catch (s) {
|
|
2990
2995
|
O.warn("Failed to create range from selection", s, {
|
|
@@ -2994,26 +2999,26 @@ const He = (e, t, i) => {
|
|
|
2994
2999
|
}
|
|
2995
3000
|
return i;
|
|
2996
3001
|
}
|
|
2997
|
-
},
|
|
3002
|
+
}, oo = ({
|
|
2998
3003
|
selection: e,
|
|
2999
3004
|
spineItem: t
|
|
3000
3005
|
}) => {
|
|
3001
3006
|
const { anchorNode: i, anchorOffset: n, focusNode: o, focusOffset: s } = e;
|
|
3002
3007
|
if (!(!i || !o))
|
|
3003
3008
|
try {
|
|
3004
|
-
return
|
|
3009
|
+
return no(
|
|
3005
3010
|
{ node: i, offset: n },
|
|
3006
3011
|
{ node: o, offset: s }
|
|
3007
3012
|
);
|
|
3008
|
-
} catch (
|
|
3009
|
-
O.warn("Failed to create range from selection",
|
|
3013
|
+
} catch (a) {
|
|
3014
|
+
O.warn("Failed to create range from selection", a, {
|
|
3010
3015
|
selection: e,
|
|
3011
3016
|
spineItem: t
|
|
3012
3017
|
});
|
|
3013
3018
|
return;
|
|
3014
3019
|
}
|
|
3015
3020
|
};
|
|
3016
|
-
class
|
|
3021
|
+
class so extends X {
|
|
3017
3022
|
constructor(t) {
|
|
3018
3023
|
var n;
|
|
3019
3024
|
super();
|
|
@@ -3026,14 +3031,14 @@ class co extends X {
|
|
|
3026
3031
|
subtree: !0
|
|
3027
3032
|
}).pipe(
|
|
3028
3033
|
M(
|
|
3029
|
-
(
|
|
3034
|
+
(a) => !!a.find((r) => r.type === "childList" && r.removedNodes.length)
|
|
3030
3035
|
)
|
|
3031
3036
|
), s = t.parentElement ? ce(t.parentElement, {
|
|
3032
3037
|
childList: !0
|
|
3033
3038
|
}).pipe(
|
|
3034
3039
|
M(
|
|
3035
|
-
(
|
|
3036
|
-
(
|
|
3040
|
+
(a) => !!a.find(
|
|
3041
|
+
(r) => Array.from(r.removedNodes).includes(t)
|
|
3037
3042
|
)
|
|
3038
3043
|
)
|
|
3039
3044
|
) : w(null);
|
|
@@ -3043,7 +3048,7 @@ class co extends X {
|
|
|
3043
3048
|
).pipe(
|
|
3044
3049
|
S(() => i.getSelection()),
|
|
3045
3050
|
T(v(s, this.destroy$)),
|
|
3046
|
-
|
|
3051
|
+
mt(null)
|
|
3047
3052
|
), this.selectionOver$ = q(i, "pointerdown").pipe(
|
|
3048
3053
|
P(
|
|
3049
3054
|
() => v(
|
|
@@ -3057,9 +3062,9 @@ class co extends X {
|
|
|
3057
3062
|
* be discarded. The timeout make sure to detect this edge case.
|
|
3058
3063
|
*/
|
|
3059
3064
|
wt(0),
|
|
3060
|
-
S((
|
|
3061
|
-
const
|
|
3062
|
-
return
|
|
3065
|
+
S((a) => {
|
|
3066
|
+
const r = i.getSelection();
|
|
3067
|
+
return r && !r.isCollapsed ? [a, r] : void 0;
|
|
3063
3068
|
}),
|
|
3064
3069
|
M(at)
|
|
3065
3070
|
)
|
|
@@ -3069,12 +3074,12 @@ class co extends X {
|
|
|
3069
3074
|
}
|
|
3070
3075
|
}
|
|
3071
3076
|
}
|
|
3072
|
-
const
|
|
3077
|
+
const ro = (e) => e.loaded$.pipe(
|
|
3073
3078
|
P(() => {
|
|
3074
3079
|
var o;
|
|
3075
3080
|
const t = e.renderer.getDocumentFrame(), i = (t == null ? void 0 : t.contentDocument) || ((o = t == null ? void 0 : t.contentWindow) == null ? void 0 : o.document);
|
|
3076
3081
|
if (!t || !i) return gt;
|
|
3077
|
-
const n = new
|
|
3082
|
+
const n = new so(t);
|
|
3078
3083
|
return v(
|
|
3079
3084
|
n.selectionChange$.pipe(
|
|
3080
3085
|
S((s) => {
|
|
@@ -3086,29 +3091,29 @@ const uo = (e) => e.loaded$.pipe(
|
|
|
3086
3091
|
})
|
|
3087
3092
|
),
|
|
3088
3093
|
n.selectionOver$.pipe(
|
|
3089
|
-
S(([s,
|
|
3094
|
+
S(([s, a]) => ({
|
|
3090
3095
|
type: "over",
|
|
3091
3096
|
event: s,
|
|
3092
|
-
selection:
|
|
3097
|
+
selection: a
|
|
3093
3098
|
}))
|
|
3094
3099
|
)
|
|
3095
3100
|
).pipe(
|
|
3096
3101
|
T(e.unloaded$),
|
|
3097
|
-
|
|
3102
|
+
mt(void 0),
|
|
3098
3103
|
dt(() => {
|
|
3099
3104
|
n.destroy();
|
|
3100
3105
|
})
|
|
3101
3106
|
);
|
|
3102
3107
|
}),
|
|
3103
3108
|
H()
|
|
3104
|
-
),
|
|
3109
|
+
), ao = (e) => (t) => {
|
|
3105
3110
|
const i = e(t);
|
|
3106
3111
|
let n;
|
|
3107
3112
|
const o = i.spineItemsManager.items$.pipe(
|
|
3108
3113
|
P((d) => {
|
|
3109
3114
|
const g = d.map((l) => {
|
|
3110
3115
|
const h = i.spineItemsManager.getSpineItemIndex(l) ?? 0;
|
|
3111
|
-
return
|
|
3116
|
+
return ro(l).pipe(
|
|
3112
3117
|
S((p) => {
|
|
3113
3118
|
if (p)
|
|
3114
3119
|
return {
|
|
@@ -3126,12 +3131,12 @@ const uo = (e) => e.loaded$.pipe(
|
|
|
3126
3131
|
n = d;
|
|
3127
3132
|
}),
|
|
3128
3133
|
tt({ refCount: !0, bufferSize: 1 })
|
|
3129
|
-
), s = o,
|
|
3134
|
+
), s = o, a = o.pipe(
|
|
3130
3135
|
S((d) => !!d),
|
|
3131
3136
|
H(),
|
|
3132
3137
|
M((d) => d),
|
|
3133
3138
|
V()
|
|
3134
|
-
),
|
|
3139
|
+
), r = a.pipe(
|
|
3135
3140
|
P(() => s),
|
|
3136
3141
|
H(),
|
|
3137
3142
|
M((d) => !d),
|
|
@@ -3151,12 +3156,12 @@ const uo = (e) => e.loaded$.pipe(
|
|
|
3151
3156
|
...i,
|
|
3152
3157
|
selection: {
|
|
3153
3158
|
selection$: s,
|
|
3154
|
-
selectionStart$:
|
|
3155
|
-
selectionEnd$:
|
|
3159
|
+
selectionStart$: a,
|
|
3160
|
+
selectionEnd$: r,
|
|
3156
3161
|
selectionOver$: c,
|
|
3157
3162
|
lastSelectionOnPointerdown$: u,
|
|
3158
3163
|
getSelection: () => n,
|
|
3159
|
-
createOrderedRangeFromSelection:
|
|
3164
|
+
createOrderedRangeFromSelection: oo
|
|
3160
3165
|
}
|
|
3161
3166
|
};
|
|
3162
3167
|
}, pe = [
|
|
@@ -3174,64 +3179,64 @@ const uo = (e) => e.loaded$.pipe(
|
|
|
3174
3179
|
backgroundColor: "#191717",
|
|
3175
3180
|
foregroundColor: "#f1ebeb"
|
|
3176
3181
|
}
|
|
3177
|
-
],
|
|
3182
|
+
], co = (e) => (t) => {
|
|
3178
3183
|
const i = e(t), n = new U(
|
|
3179
3184
|
t.theme ?? "bright"
|
|
3180
3185
|
), o = () => {
|
|
3181
|
-
const
|
|
3186
|
+
const r = pe.find(
|
|
3182
3187
|
(c) => c.name === n.value
|
|
3183
3188
|
);
|
|
3184
3189
|
return `
|
|
3185
3190
|
body {
|
|
3186
|
-
${
|
|
3191
|
+
${r !== void 0 ? `background-color: ${r.backgroundColor} !important;` : ""}
|
|
3187
3192
|
}
|
|
3188
|
-
${
|
|
3193
|
+
${r != null && r.foregroundColor ? `
|
|
3189
3194
|
body * {
|
|
3190
3195
|
|
|
3191
|
-
color: ${
|
|
3196
|
+
color: ${r.foregroundColor};
|
|
3192
3197
|
}
|
|
3193
3198
|
` : ""}
|
|
3194
3199
|
`;
|
|
3195
3200
|
}, s = ({
|
|
3196
|
-
container:
|
|
3201
|
+
container: r
|
|
3197
3202
|
}) => {
|
|
3198
3203
|
const c = pe.find(
|
|
3199
3204
|
(u) => u.name === n.value
|
|
3200
3205
|
);
|
|
3201
|
-
return c &&
|
|
3206
|
+
return c && r.style.setProperty(
|
|
3202
3207
|
"background-color",
|
|
3203
3208
|
c.backgroundColor
|
|
3204
3209
|
), () => {
|
|
3205
3210
|
};
|
|
3206
|
-
},
|
|
3207
|
-
i.spineItemsManager.items.forEach((
|
|
3208
|
-
const c =
|
|
3209
|
-
c && nt(c, "prose-reader-theme", o()), s({ container:
|
|
3211
|
+
}, a = () => {
|
|
3212
|
+
i.spineItemsManager.items.forEach((r) => {
|
|
3213
|
+
const c = r.renderer.getDocumentFrame();
|
|
3214
|
+
c && nt(c, "prose-reader-theme", o()), s({ container: r.element });
|
|
3210
3215
|
});
|
|
3211
3216
|
};
|
|
3212
|
-
return i.hookManager.register("item.onDocumentLoad", ({ itemId:
|
|
3213
|
-
const c = i.spineItemsManager.get(
|
|
3217
|
+
return i.hookManager.register("item.onDocumentLoad", ({ itemId: r }) => {
|
|
3218
|
+
const c = i.spineItemsManager.get(r);
|
|
3214
3219
|
if ((c == null ? void 0 : c.renditionLayout) !== "pre-paginated") {
|
|
3215
3220
|
const u = c == null ? void 0 : c.renderer.getDocumentFrame();
|
|
3216
3221
|
u && nt(u, "prose-reader-theme", o());
|
|
3217
3222
|
}
|
|
3218
3223
|
}), i.spineItemsManager.items$.pipe(
|
|
3219
3224
|
k(
|
|
3220
|
-
(
|
|
3225
|
+
(r) => r.map(
|
|
3221
3226
|
({ element: c }) => s({ container: c })
|
|
3222
3227
|
)
|
|
3223
3228
|
),
|
|
3224
3229
|
G(i.$.destroy$)
|
|
3225
3230
|
).subscribe(), n.pipe(
|
|
3226
3231
|
k(() => {
|
|
3227
|
-
|
|
3232
|
+
a();
|
|
3228
3233
|
}),
|
|
3229
3234
|
G(i.$.destroy$)
|
|
3230
3235
|
).subscribe(), {
|
|
3231
3236
|
...i,
|
|
3232
3237
|
theme: {
|
|
3233
|
-
set: (
|
|
3234
|
-
|
|
3238
|
+
set: (r) => {
|
|
3239
|
+
r !== n.value && n.next(r);
|
|
3235
3240
|
},
|
|
3236
3241
|
get: () => n.value,
|
|
3237
3242
|
$: {
|
|
@@ -3239,7 +3244,7 @@ const uo = (e) => e.loaded$.pipe(
|
|
|
3239
3244
|
}
|
|
3240
3245
|
}
|
|
3241
3246
|
};
|
|
3242
|
-
},
|
|
3247
|
+
}, uo = (e) => (t) => ({
|
|
3243
3248
|
...e(t),
|
|
3244
3249
|
utils: {
|
|
3245
3250
|
isOrIsWithinValidLink: (o) => {
|
|
@@ -3253,13 +3258,13 @@ const uo = (e) => e.loaded$.pipe(
|
|
|
3253
3258
|
}
|
|
3254
3259
|
});
|
|
3255
3260
|
navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
|
|
3256
|
-
const
|
|
3261
|
+
const go = (e) => (t) => e(t);
|
|
3257
3262
|
class Be {
|
|
3258
3263
|
constructor(t) {
|
|
3259
3264
|
this.reader = t;
|
|
3260
3265
|
}
|
|
3261
3266
|
}
|
|
3262
|
-
class
|
|
3267
|
+
class lo extends Be {
|
|
3263
3268
|
constructor() {
|
|
3264
3269
|
super(...arguments), this.isZooming$ = new U(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
|
|
3265
3270
|
}
|
|
@@ -3313,10 +3318,10 @@ const Tt = ({
|
|
|
3313
3318
|
screenSize: i,
|
|
3314
3319
|
scrollOffset: n
|
|
3315
3320
|
}) => {
|
|
3316
|
-
const o = i * e / 2 - i + i / 2, s = i * t / 2 - i + i / 2,
|
|
3317
|
-
return Math.max(o +
|
|
3321
|
+
const o = i * e / 2 - i + i / 2, s = i * t / 2 - i + i / 2, a = e / t, r = n - s;
|
|
3322
|
+
return Math.max(o + r * a, 0);
|
|
3318
3323
|
};
|
|
3319
|
-
class
|
|
3324
|
+
class po extends Be {
|
|
3320
3325
|
constructor() {
|
|
3321
3326
|
super(...arguments), this.isZooming$ = new U(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
|
|
3322
3327
|
}
|
|
@@ -3333,24 +3338,24 @@ class fo extends Be {
|
|
|
3333
3338
|
scaleAt(t) {
|
|
3334
3339
|
const i = this.reader.spine.element, n = this.reader.navigation.scrollNavigationController.value.element;
|
|
3335
3340
|
if (!i || !n) return;
|
|
3336
|
-
const o = Math.ceil(t * 100) / 100, s = Math.max(o, 1),
|
|
3341
|
+
const o = Math.ceil(t * 100) / 100, s = Math.max(o, 1), a = i.getBoundingClientRect().width / i.offsetWidth, r = n.scrollTop;
|
|
3337
3342
|
i.style.transform = `scale(${s})`, n.scrollLeft = Tt({
|
|
3338
3343
|
newScale: s,
|
|
3339
|
-
oldScale:
|
|
3344
|
+
oldScale: a,
|
|
3340
3345
|
pageSize: n.clientWidth,
|
|
3341
3346
|
screenSize: i.offsetWidth,
|
|
3342
3347
|
scrollOffset: n.scrollLeft
|
|
3343
3348
|
}), n.scrollTop = Tt({
|
|
3344
3349
|
newScale: s,
|
|
3345
|
-
oldScale:
|
|
3350
|
+
oldScale: a,
|
|
3346
3351
|
pageSize: n.clientHeight,
|
|
3347
3352
|
screenSize: i.offsetHeight,
|
|
3348
|
-
scrollOffset:
|
|
3353
|
+
scrollOffset: r
|
|
3349
3354
|
}), this.currentScale = o;
|
|
3350
3355
|
}
|
|
3351
3356
|
}
|
|
3352
|
-
const
|
|
3353
|
-
const i = e(t), n = new
|
|
3357
|
+
const ho = (e) => (t) => {
|
|
3358
|
+
const i = e(t), n = new lo(i), o = new po(i), s = new U(o);
|
|
3354
3359
|
return {
|
|
3355
3360
|
...i,
|
|
3356
3361
|
destroy: () => {
|
|
@@ -3382,7 +3387,7 @@ const yo = (e) => (t) => {
|
|
|
3382
3387
|
}
|
|
3383
3388
|
};
|
|
3384
3389
|
}, Ee = (e) => (e == null ? void 0 : e.renditionLayout) === "pre-paginated" || (e == null ? void 0 : e.spineItems.every((t) => t.renditionLayout === "pre-paginated"));
|
|
3385
|
-
class
|
|
3390
|
+
class ht extends ot {
|
|
3386
3391
|
constructor(t) {
|
|
3387
3392
|
super((i) => this.stateSubject.pipe(T(this.destroy$)).subscribe(i)), this.destroy$ = new W(), this.stateSubject = new U(t);
|
|
3388
3393
|
}
|
|
@@ -3409,7 +3414,7 @@ class pt extends ot {
|
|
|
3409
3414
|
this.stateSubject.complete(), this.destroy$.complete();
|
|
3410
3415
|
}
|
|
3411
3416
|
}
|
|
3412
|
-
class
|
|
3417
|
+
class mo {
|
|
3413
3418
|
constructor() {
|
|
3414
3419
|
this.navigationSubject = new ie(1), this.viewportStateSubject = new U("free"), this.paginationSubject = new ie(), this.navigationIsLockedSubject = new U(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
|
|
3415
3420
|
H(),
|
|
@@ -3421,7 +3426,7 @@ class So {
|
|
|
3421
3426
|
), this.navigation$ = this.navigationSubject.asObservable();
|
|
3422
3427
|
}
|
|
3423
3428
|
}
|
|
3424
|
-
const
|
|
3429
|
+
const fo = ({
|
|
3425
3430
|
manifest: e,
|
|
3426
3431
|
visibleAreaRect: t,
|
|
3427
3432
|
forceSinglePageMode: i
|
|
@@ -3429,7 +3434,7 @@ const bo = ({
|
|
|
3429
3434
|
const { height: n, width: o } = t, s = o > n;
|
|
3430
3435
|
return i || (e == null ? void 0 : e.renditionFlow) === "scrolled-continuous" ? !1 : !s && (e == null ? void 0 : e.renditionSpread) === "portrait" ? !0 : s && ((e == null ? void 0 : e.renditionSpread) === void 0 || (e == null ? void 0 : e.renditionSpread) === "auto" || (e == null ? void 0 : e.renditionSpread) === "landscape" || (e == null ? void 0 : e.renditionSpread) === "both");
|
|
3431
3436
|
};
|
|
3432
|
-
class
|
|
3437
|
+
class yo extends ht {
|
|
3433
3438
|
constructor() {
|
|
3434
3439
|
super({
|
|
3435
3440
|
marginBottom: 0,
|
|
@@ -3442,7 +3447,7 @@ class Io extends pt {
|
|
|
3442
3447
|
x: 0,
|
|
3443
3448
|
y: 0
|
|
3444
3449
|
}
|
|
3445
|
-
}), this.bridgeEvent = new
|
|
3450
|
+
}), this.bridgeEvent = new mo(), this.destroy$ = new W(), this.state$ = this.pipe(Z(N)), this.manifest$ = this.pipe(
|
|
3446
3451
|
Y((t) => t.manifest),
|
|
3447
3452
|
K(at),
|
|
3448
3453
|
Z()
|
|
@@ -3462,18 +3467,18 @@ class Io extends pt {
|
|
|
3462
3467
|
* @todo optimize to not run if not necessary
|
|
3463
3468
|
*/
|
|
3464
3469
|
update(t) {
|
|
3465
|
-
const i = this.value, n = t.manifest ?? i.manifest, o = t.forceSinglePageMode ?? i.forceSinglePageMode, s = t.visibleAreaRect ?? i.visibleAreaRect,
|
|
3470
|
+
const i = this.value, n = t.manifest ?? i.manifest, o = t.forceSinglePageMode ?? i.forceSinglePageMode, s = t.visibleAreaRect ?? i.visibleAreaRect, a = t.marginTop ?? i.marginTop, r = t.marginBottom ?? i.marginBottom, c = {
|
|
3466
3471
|
...i,
|
|
3467
3472
|
...t,
|
|
3468
3473
|
...t.visibleAreaRect && {
|
|
3469
3474
|
...t.visibleAreaRect,
|
|
3470
|
-
height: t.visibleAreaRect.height -
|
|
3475
|
+
height: t.visibleAreaRect.height - a - r
|
|
3471
3476
|
},
|
|
3472
3477
|
...t.manifest && {
|
|
3473
3478
|
isFullyPrePaginated: Ee(n),
|
|
3474
3479
|
assumedRenditionLayout: (n == null ? void 0 : n.renditionLayout) ?? "reflowable"
|
|
3475
3480
|
},
|
|
3476
|
-
isUsingSpreadMode:
|
|
3481
|
+
isUsingSpreadMode: fo({
|
|
3477
3482
|
manifest: n,
|
|
3478
3483
|
visibleAreaRect: s,
|
|
3479
3484
|
forceSinglePageMode: o
|
|
@@ -3505,7 +3510,7 @@ class Io extends pt {
|
|
|
3505
3510
|
};
|
|
3506
3511
|
}
|
|
3507
3512
|
}
|
|
3508
|
-
class
|
|
3513
|
+
class So extends ht {
|
|
3509
3514
|
constructor(t, i) {
|
|
3510
3515
|
super({
|
|
3511
3516
|
supportedPageTurnAnimation: ["fade", "none", "slide"],
|
|
@@ -3529,19 +3534,19 @@ class wo extends pt {
|
|
|
3529
3534
|
hasVerticalWriting: n,
|
|
3530
3535
|
renditionFlow: o,
|
|
3531
3536
|
renditionLayout: s,
|
|
3532
|
-
computedPageTurnMode:
|
|
3537
|
+
computedPageTurnMode: a
|
|
3533
3538
|
}) => ({
|
|
3534
3539
|
...this.value,
|
|
3535
3540
|
supportedPageTurnMode: o === "scrolled-continuous" ? ["scrollable"] : ["controlled", "scrollable"],
|
|
3536
|
-
supportedPageTurnAnimation: o === "scrolled-continuous" ||
|
|
3537
|
-
supportedPageTurnDirection:
|
|
3541
|
+
supportedPageTurnAnimation: o === "scrolled-continuous" || a === "scrollable" ? ["none"] : n ? ["fade", "none"] : ["fade", "none", "slide"],
|
|
3542
|
+
supportedPageTurnDirection: a === "scrollable" ? ["vertical"] : s === "reflowable" ? ["horizontal"] : ["horizontal", "vertical"]
|
|
3538
3543
|
})
|
|
3539
3544
|
),
|
|
3540
3545
|
T(this.destroy$)
|
|
3541
3546
|
).subscribe(this.next.bind(this));
|
|
3542
3547
|
}
|
|
3543
3548
|
}
|
|
3544
|
-
class
|
|
3549
|
+
class bo {
|
|
3545
3550
|
constructor() {
|
|
3546
3551
|
this._hooks = [], this._hookExecutions = [];
|
|
3547
3552
|
}
|
|
@@ -3569,12 +3574,12 @@ class Po {
|
|
|
3569
3574
|
}
|
|
3570
3575
|
execute(t, i, n) {
|
|
3571
3576
|
return this._hooks.filter(
|
|
3572
|
-
(
|
|
3573
|
-
).map((
|
|
3574
|
-
let
|
|
3577
|
+
(a) => t === a.name
|
|
3578
|
+
).map((a) => {
|
|
3579
|
+
let r = () => w(void 0);
|
|
3575
3580
|
const c = new W(), u = (l) => {
|
|
3576
|
-
|
|
3577
|
-
}, d = () => (c.next(), c.complete(),
|
|
3581
|
+
r = l;
|
|
3582
|
+
}, d = () => (c.next(), c.complete(), r() ?? w(void 0)), g = a.runFn({
|
|
3578
3583
|
// biome-ignore lint/suspicious/noExplicitAny: TODO
|
|
3579
3584
|
...n,
|
|
3580
3585
|
destroy$: c.asObservable(),
|
|
@@ -3584,22 +3589,22 @@ class Po {
|
|
|
3584
3589
|
name: t,
|
|
3585
3590
|
id: i,
|
|
3586
3591
|
destroyFn: d,
|
|
3587
|
-
ref:
|
|
3592
|
+
ref: a
|
|
3588
3593
|
}), g;
|
|
3589
3594
|
});
|
|
3590
3595
|
}
|
|
3591
3596
|
destroy(t, i, n) {
|
|
3592
3597
|
const o = this._hookExecutions.filter(
|
|
3593
|
-
(
|
|
3598
|
+
(a) => (
|
|
3594
3599
|
// by ref is higher priority
|
|
3595
|
-
n &&
|
|
3596
|
-
t ===
|
|
3600
|
+
n && a.ref === n || // otherwise we refine by name and eventually by id
|
|
3601
|
+
t === a.name && (!i || i && i === a.id)
|
|
3597
3602
|
)
|
|
3598
3603
|
);
|
|
3599
3604
|
this._hookExecutions = this._hookExecutions.filter(
|
|
3600
|
-
(
|
|
3605
|
+
(a) => !o.includes(a)
|
|
3601
3606
|
);
|
|
3602
|
-
const s = o.map(({ destroyFn:
|
|
3607
|
+
const s = o.map(({ destroyFn: a }) => a());
|
|
3603
3608
|
return B(s);
|
|
3604
3609
|
}
|
|
3605
3610
|
}
|
|
@@ -3617,7 +3622,7 @@ class _e {
|
|
|
3617
3622
|
};
|
|
3618
3623
|
}
|
|
3619
3624
|
}
|
|
3620
|
-
const
|
|
3625
|
+
const Io = () => (e) => e.pipe(
|
|
3621
3626
|
S(({ navigation: t, pagination: i, ...n }) => ({
|
|
3622
3627
|
navigation: {
|
|
3623
3628
|
...t,
|
|
@@ -3625,7 +3630,7 @@ const vo = () => (e) => e.pipe(
|
|
|
3625
3630
|
},
|
|
3626
3631
|
...n
|
|
3627
3632
|
}))
|
|
3628
|
-
),
|
|
3633
|
+
), wo = (e, t, i) => e.bridgeEvent.pagination$.pipe(
|
|
3629
3634
|
A(t),
|
|
3630
3635
|
M(
|
|
3631
3636
|
([n, o]) => n.navigationId === o.id
|
|
@@ -3638,14 +3643,14 @@ const vo = () => (e) => e.pipe(
|
|
|
3638
3643
|
P(([n, o]) => {
|
|
3639
3644
|
const s = i.spineItemsManager.get(o.spineItem);
|
|
3640
3645
|
return ((s == null ? void 0 : s.isReady$.pipe(z())) ?? w(!1)).pipe(
|
|
3641
|
-
M((
|
|
3646
|
+
M((a) => a),
|
|
3642
3647
|
S(() => ({
|
|
3643
3648
|
pagination: n,
|
|
3644
3649
|
navigation: o
|
|
3645
3650
|
}))
|
|
3646
3651
|
);
|
|
3647
3652
|
}),
|
|
3648
|
-
|
|
3653
|
+
Io(),
|
|
3649
3654
|
H(
|
|
3650
3655
|
(n, o) => n.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
|
|
3651
3656
|
),
|
|
@@ -3657,7 +3662,7 @@ const vo = () => (e) => e.pipe(
|
|
|
3657
3662
|
}
|
|
3658
3663
|
})
|
|
3659
3664
|
)
|
|
3660
|
-
),
|
|
3665
|
+
), Po = (e) => e.pipe(
|
|
3661
3666
|
S(([t, i]) => {
|
|
3662
3667
|
const n = {
|
|
3663
3668
|
type: "api",
|
|
@@ -3673,7 +3678,7 @@ const vo = () => (e) => e.pipe(
|
|
|
3673
3678
|
navigation: n
|
|
3674
3679
|
};
|
|
3675
3680
|
})
|
|
3676
|
-
),
|
|
3681
|
+
), vo = ({ navigationResolver: e }) => (t) => t.pipe(
|
|
3677
3682
|
S((i) => {
|
|
3678
3683
|
if (i.navigation.cfi) {
|
|
3679
3684
|
const n = e.getNavigationForCfi(
|
|
@@ -3690,30 +3695,30 @@ const vo = () => (e) => e.pipe(
|
|
|
3690
3695
|
}
|
|
3691
3696
|
return i;
|
|
3692
3697
|
})
|
|
3693
|
-
),
|
|
3698
|
+
), xo = ({
|
|
3694
3699
|
navigation: e,
|
|
3695
3700
|
previousNavigation: t,
|
|
3696
3701
|
settings: i
|
|
3697
|
-
}) => e.directionFromLastNavigation ? e.directionFromLastNavigation : e.url !== void 0 || e.cfi !== void 0 ? "anchor" : t.spineItem === void 0 || e.spineItem || !e.position ? "forward" : i.values.computedPageTurnDirection === "vertical" ? e.position.y > t.position.y || e.position.y === t.position.y && t.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(e.position.x) > Math.abs(t.position.x) || e.position.x === t.position.x && t.directionFromLastNavigation !== "backward" ? "forward" : "backward",
|
|
3702
|
+
}) => e.directionFromLastNavigation ? e.directionFromLastNavigation : e.url !== void 0 || e.cfi !== void 0 ? "anchor" : t.spineItem === void 0 || e.spineItem || !e.position ? "forward" : i.values.computedPageTurnDirection === "vertical" ? e.position.y > t.position.y || e.position.y === t.position.y && t.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(e.position.x) > Math.abs(t.position.x) || e.position.x === t.position.x && t.directionFromLastNavigation !== "backward" ? "forward" : "backward", $o = ({
|
|
3698
3703
|
context: e,
|
|
3699
3704
|
settings: t
|
|
3700
3705
|
}) => (i) => i.pipe(
|
|
3701
3706
|
S(({ navigation: n, previousNavigation: o }) => {
|
|
3702
|
-
const s =
|
|
3707
|
+
const s = xo({
|
|
3703
3708
|
navigation: n,
|
|
3704
3709
|
previousNavigation: o,
|
|
3705
3710
|
settings: t
|
|
3706
|
-
}),
|
|
3711
|
+
}), a = {
|
|
3707
3712
|
...n,
|
|
3708
3713
|
directionFromLastNavigation: s
|
|
3709
3714
|
};
|
|
3710
3715
|
return {
|
|
3711
3716
|
previousNavigation: o,
|
|
3712
|
-
navigation:
|
|
3717
|
+
navigation: a,
|
|
3713
3718
|
direction: s
|
|
3714
3719
|
};
|
|
3715
3720
|
})
|
|
3716
|
-
),
|
|
3721
|
+
), To = ({
|
|
3717
3722
|
spineItemsManager: e,
|
|
3718
3723
|
navigationResolver: t
|
|
3719
3724
|
}) => (i) => i.pipe(
|
|
@@ -3747,13 +3752,13 @@ const vo = () => (e) => e.pipe(
|
|
|
3747
3752
|
navigationResolver: i,
|
|
3748
3753
|
spineLocator: n
|
|
3749
3754
|
}) => (o) => {
|
|
3750
|
-
const s = (
|
|
3755
|
+
const s = (a) => {
|
|
3751
3756
|
const {
|
|
3752
|
-
position:
|
|
3757
|
+
position: r,
|
|
3753
3758
|
spineItem: c,
|
|
3754
3759
|
cfi: u,
|
|
3755
3760
|
directionFromLastNavigation: d
|
|
3756
|
-
} =
|
|
3761
|
+
} = a, { navigationSnapThreshold: g, computedPageTurnMode: l } = e.values;
|
|
3757
3762
|
if (c !== void 0) {
|
|
3758
3763
|
const h = t.get(c);
|
|
3759
3764
|
if (h) return h;
|
|
@@ -3764,15 +3769,15 @@ const vo = () => (e) => e.pipe(
|
|
|
3764
3769
|
const h = t.getSpineItemFromCfi(u);
|
|
3765
3770
|
if (h) return h;
|
|
3766
3771
|
}
|
|
3767
|
-
if (
|
|
3772
|
+
if (r && l === "controlled") {
|
|
3768
3773
|
const { beginIndex: h, endIndex: p } = n.getVisibleSpineItemsFromPosition({
|
|
3769
|
-
position:
|
|
3774
|
+
position: r,
|
|
3770
3775
|
threshold: g,
|
|
3771
3776
|
restrictToScreen: !1
|
|
3772
3777
|
}) ?? {}, m = (d === "forward" || d === "anchor" ? p : h) ?? h, y = t.get(m);
|
|
3773
3778
|
if (!y) return;
|
|
3774
3779
|
const { endPageIndex: f, beginPageIndex: b } = n.getVisiblePagesFromViewportPosition({
|
|
3775
|
-
position:
|
|
3780
|
+
position: r,
|
|
3776
3781
|
spineItem: y,
|
|
3777
3782
|
threshold: g,
|
|
3778
3783
|
restrictToScreen: !1
|
|
@@ -3786,17 +3791,17 @@ const vo = () => (e) => e.pipe(
|
|
|
3786
3791
|
}), C = d === "forward" || d === "anchor" ? F == null ? void 0 : F.beginIndex : F == null ? void 0 : F.endIndex;
|
|
3787
3792
|
return t.get(C);
|
|
3788
3793
|
}
|
|
3789
|
-
return
|
|
3794
|
+
return r && l === "scrollable" ? n.getSpineItemFromPosition(r) : t.get(0);
|
|
3790
3795
|
};
|
|
3791
3796
|
return o.pipe(
|
|
3792
|
-
S(({ navigation:
|
|
3793
|
-
const c = s(
|
|
3797
|
+
S(({ navigation: a, ...r }) => {
|
|
3798
|
+
const c = s(a);
|
|
3794
3799
|
return {
|
|
3795
3800
|
navigation: {
|
|
3796
|
-
...
|
|
3801
|
+
...a,
|
|
3797
3802
|
spineItem: t.getSpineItemIndex(c)
|
|
3798
3803
|
},
|
|
3799
|
-
...
|
|
3804
|
+
...r
|
|
3800
3805
|
};
|
|
3801
3806
|
})
|
|
3802
3807
|
);
|
|
@@ -3808,7 +3813,7 @@ const vo = () => (e) => e.pipe(
|
|
|
3808
3813
|
return ((s == null ? void 0 : s.isReady$) ?? w(!1)).pipe(
|
|
3809
3814
|
z(),
|
|
3810
3815
|
S(
|
|
3811
|
-
(
|
|
3816
|
+
(a) => ({
|
|
3812
3817
|
navigation: {
|
|
3813
3818
|
...i,
|
|
3814
3819
|
spineItemHeight: o == null ? void 0 : o.height,
|
|
@@ -3816,7 +3821,7 @@ const vo = () => (e) => e.pipe(
|
|
|
3816
3821
|
spineItemLeft: o.left,
|
|
3817
3822
|
spineItemTop: o.top,
|
|
3818
3823
|
spineItemIsUsingVerticalWriting: s == null ? void 0 : s.isUsingVerticalWriting(),
|
|
3819
|
-
spineItemIsReady:
|
|
3824
|
+
spineItemIsReady: a
|
|
3820
3825
|
},
|
|
3821
3826
|
...n
|
|
3822
3827
|
})
|
|
@@ -3829,16 +3834,16 @@ const vo = () => (e) => e.pipe(
|
|
|
3829
3834
|
spineLocator: i,
|
|
3830
3835
|
navigationResolver: n
|
|
3831
3836
|
}) => (o) => {
|
|
3832
|
-
const s = (
|
|
3833
|
-
const { navigationSnapThreshold:
|
|
3834
|
-
if (!(!u || !
|
|
3837
|
+
const s = (a) => {
|
|
3838
|
+
const { navigationSnapThreshold: r, computedPageTurnMode: c } = e.values, u = t.get(a.spineItem);
|
|
3839
|
+
if (!(!u || !a.position)) {
|
|
3835
3840
|
if (c === "controlled") {
|
|
3836
3841
|
const { endPageIndex: d, beginPageIndex: g } = i.getVisiblePagesFromViewportPosition({
|
|
3837
|
-
position:
|
|
3842
|
+
position: a.position,
|
|
3838
3843
|
spineItem: u,
|
|
3839
|
-
threshold:
|
|
3844
|
+
threshold: r,
|
|
3840
3845
|
restrictToScreen: !1
|
|
3841
|
-
}) ?? {}, l = (
|
|
3846
|
+
}) ?? {}, l = (a.directionFromLastNavigation === "forward" || a.directionFromLastNavigation === "anchor" ? d : g) ?? 0, h = n.getNavigationForSpineItemPage({
|
|
3842
3847
|
pageIndex: l,
|
|
3843
3848
|
spineItemId: u
|
|
3844
3849
|
}), p = i.getVisiblePagesFromViewportPosition({
|
|
@@ -3846,28 +3851,28 @@ const vo = () => (e) => e.pipe(
|
|
|
3846
3851
|
spineItem: u,
|
|
3847
3852
|
threshold: { type: "percentage", value: 0 },
|
|
3848
3853
|
restrictToScreen: !0
|
|
3849
|
-
}), m = (
|
|
3854
|
+
}), m = (a.directionFromLastNavigation === "forward" || a.directionFromLastNavigation === "anchor" ? p == null ? void 0 : p.beginPageIndex : p == null ? void 0 : p.endPageIndex) ?? 0;
|
|
3850
3855
|
return i.spineItemLocator.getSpineItemPositionFromPageIndex({
|
|
3851
3856
|
pageIndex: m,
|
|
3852
3857
|
spineItem: u
|
|
3853
3858
|
});
|
|
3854
3859
|
}
|
|
3855
3860
|
return i.getSpineItemPositionFromSpinePosition(
|
|
3856
|
-
|
|
3861
|
+
a.position,
|
|
3857
3862
|
u
|
|
3858
3863
|
);
|
|
3859
3864
|
}
|
|
3860
3865
|
};
|
|
3861
3866
|
return o.pipe(
|
|
3862
|
-
S(({ navigation:
|
|
3867
|
+
S(({ navigation: a, ...r }) => ({
|
|
3863
3868
|
navigation: {
|
|
3864
|
-
...
|
|
3865
|
-
positionInSpineItem: s(
|
|
3869
|
+
...a,
|
|
3870
|
+
positionInSpineItem: s(a)
|
|
3866
3871
|
},
|
|
3867
|
-
...
|
|
3872
|
+
...r
|
|
3868
3873
|
}))
|
|
3869
3874
|
);
|
|
3870
|
-
},
|
|
3875
|
+
}, Fo = ({ navigationResolver: e }) => (t) => t.pipe(
|
|
3871
3876
|
S((i) => {
|
|
3872
3877
|
if (i.navigation.url) {
|
|
3873
3878
|
const n = e.getNavigationForUrl(
|
|
@@ -3885,7 +3890,7 @@ const vo = () => (e) => e.pipe(
|
|
|
3885
3890
|
}
|
|
3886
3891
|
return i;
|
|
3887
3892
|
})
|
|
3888
|
-
),
|
|
3893
|
+
), Lo = ({
|
|
3889
3894
|
spineLocator: e,
|
|
3890
3895
|
navigation: t,
|
|
3891
3896
|
navigationResolver: i,
|
|
@@ -3895,15 +3900,15 @@ const vo = () => (e) => e.pipe(
|
|
|
3895
3900
|
const s = n.get(t.spineItem);
|
|
3896
3901
|
return s ? s.isReady$.pipe(
|
|
3897
3902
|
z(),
|
|
3898
|
-
S((
|
|
3903
|
+
S((a) => {
|
|
3899
3904
|
var h, p;
|
|
3900
|
-
const
|
|
3905
|
+
const r = o.getSpineItemSpineLayoutInfo(s), c = e.isPositionWithinSpineItem(
|
|
3901
3906
|
t.position,
|
|
3902
3907
|
s
|
|
3903
|
-
), u =
|
|
3908
|
+
), u = r.width - (t.spineItemWidth ?? 0), d = r.height - (t.spineItemHeight ?? 0), g = u !== 0 || d !== 0;
|
|
3904
3909
|
if (t.url !== void 0 && (u || d || // when spine item is ready dimensions may have not changed but the position
|
|
3905
3910
|
// of dom elements may have!
|
|
3906
|
-
|
|
3911
|
+
a && !t.spineItemIsReady)) {
|
|
3907
3912
|
const m = i.getNavigationForUrl(
|
|
3908
3913
|
t.url
|
|
3909
3914
|
);
|
|
@@ -3913,7 +3918,7 @@ const vo = () => (e) => e.pipe(
|
|
|
3913
3918
|
const l = t.cfi ?? t.paginationBeginCfi;
|
|
3914
3919
|
if (l !== void 0 && !Et(l) && (u || d || // when spine item is ready dimensions may have not changed but the position
|
|
3915
3920
|
// of dom elements may have!
|
|
3916
|
-
|
|
3921
|
+
a && !t.spineItemIsReady)) {
|
|
3917
3922
|
const m = i.getNavigationForCfi(l);
|
|
3918
3923
|
if (m)
|
|
3919
3924
|
return m;
|
|
@@ -3943,7 +3948,7 @@ const vo = () => (e) => e.pipe(
|
|
|
3943
3948
|
return c ? i.getNavigationForPosition(t.position) : i.getNavigationForSpineIndexOrId(s);
|
|
3944
3949
|
})
|
|
3945
3950
|
) : w(new L({ x: 0, y: 0 }));
|
|
3946
|
-
},
|
|
3951
|
+
}, Mo = ({
|
|
3947
3952
|
navigation: e,
|
|
3948
3953
|
spineLocator: t,
|
|
3949
3954
|
spineItemsManager: i,
|
|
@@ -3951,11 +3956,11 @@ const vo = () => (e) => e.pipe(
|
|
|
3951
3956
|
navigationResolver: o,
|
|
3952
3957
|
spine: s
|
|
3953
3958
|
}) => {
|
|
3954
|
-
const { spineItem:
|
|
3955
|
-
if (!
|
|
3956
|
-
const { height: c, top: u } = s.getSpineItemSpineLayoutInfo(
|
|
3959
|
+
const { spineItem: a } = e, r = i.get(a);
|
|
3960
|
+
if (!r) return new L({ x: 0, y: 0 });
|
|
3961
|
+
const { height: c, top: u } = s.getSpineItemSpineLayoutInfo(r), d = t.isPositionWithinSpineItem(
|
|
3957
3962
|
e.position,
|
|
3958
|
-
|
|
3963
|
+
r
|
|
3959
3964
|
), g = e.positionInSpineItem ?? new R({
|
|
3960
3965
|
y: 0,
|
|
3961
3966
|
x: 0
|
|
@@ -3964,18 +3969,18 @@ const vo = () => (e) => e.pipe(
|
|
|
3964
3969
|
if (u === e.spineItemTop && c === e.spineItemHeight && d)
|
|
3965
3970
|
return e.position;
|
|
3966
3971
|
if (u === e.spineItemTop && c === e.spineItemHeight && !d)
|
|
3967
|
-
return o.getNavigationForSpineIndexOrId(
|
|
3972
|
+
return o.getNavigationForSpineIndexOrId(r);
|
|
3968
3973
|
if (u !== e.spineItemTop) {
|
|
3969
3974
|
const l = t.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
|
|
3970
3975
|
e.positionInSpineItem ?? new R({
|
|
3971
3976
|
x: 0,
|
|
3972
3977
|
y: 0
|
|
3973
3978
|
}),
|
|
3974
|
-
|
|
3979
|
+
r
|
|
3975
3980
|
);
|
|
3976
3981
|
return t.getSpinePositionFromSpineItemPosition({
|
|
3977
3982
|
spineItemPosition: l,
|
|
3978
|
-
spineItem:
|
|
3983
|
+
spineItem: r
|
|
3979
3984
|
});
|
|
3980
3985
|
}
|
|
3981
3986
|
if (u === e.spineItemTop && c !== e.spineItemHeight) {
|
|
@@ -3986,11 +3991,11 @@ const vo = () => (e) => e.pipe(
|
|
|
3986
3991
|
if (d) {
|
|
3987
3992
|
const p = t.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
|
|
3988
3993
|
h,
|
|
3989
|
-
|
|
3994
|
+
r
|
|
3990
3995
|
);
|
|
3991
3996
|
return t.getSpinePositionFromSpineItemPosition({
|
|
3992
3997
|
spineItemPosition: p,
|
|
3993
|
-
spineItem:
|
|
3998
|
+
spineItem: r
|
|
3994
3999
|
});
|
|
3995
4000
|
}
|
|
3996
4001
|
if (!d) {
|
|
@@ -4002,17 +4007,17 @@ const vo = () => (e) => e.pipe(
|
|
|
4002
4007
|
return t.getSpinePositionFromSpineItemPosition({
|
|
4003
4008
|
spineItemPosition: t.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
|
|
4004
4009
|
m,
|
|
4005
|
-
|
|
4010
|
+
r
|
|
4006
4011
|
),
|
|
4007
|
-
spineItem:
|
|
4012
|
+
spineItem: r
|
|
4008
4013
|
});
|
|
4009
4014
|
}
|
|
4010
|
-
return o.getNavigationForSpineIndexOrId(
|
|
4015
|
+
return o.getNavigationForSpineIndexOrId(r);
|
|
4011
4016
|
}
|
|
4012
4017
|
}
|
|
4013
4018
|
}
|
|
4014
4019
|
return e.position;
|
|
4015
|
-
},
|
|
4020
|
+
}, Co = ({
|
|
4016
4021
|
navigation: e,
|
|
4017
4022
|
spineItemsManager: t,
|
|
4018
4023
|
settings: i,
|
|
@@ -4020,7 +4025,7 @@ const vo = () => (e) => e.pipe(
|
|
|
4020
4025
|
navigationResolver: o,
|
|
4021
4026
|
spine: s
|
|
4022
4027
|
}) => i.values.computedPageTurnMode === "scrollable" ? w(
|
|
4023
|
-
|
|
4028
|
+
Mo({
|
|
4024
4029
|
navigation: e,
|
|
4025
4030
|
spineLocator: n,
|
|
4026
4031
|
navigationResolver: o,
|
|
@@ -4028,7 +4033,7 @@ const vo = () => (e) => e.pipe(
|
|
|
4028
4033
|
spineItemsManager: t,
|
|
4029
4034
|
spine: s
|
|
4030
4035
|
})
|
|
4031
|
-
) :
|
|
4036
|
+
) : Lo({
|
|
4032
4037
|
navigation: e,
|
|
4033
4038
|
spineLocator: n,
|
|
4034
4039
|
navigationResolver: o,
|
|
@@ -4040,7 +4045,7 @@ const vo = () => (e) => e.pipe(
|
|
|
4040
4045
|
context: i,
|
|
4041
4046
|
spine: n
|
|
4042
4047
|
}) => (o) => o.pipe(
|
|
4043
|
-
P((s) =>
|
|
4048
|
+
P((s) => Co({
|
|
4044
4049
|
spineLocator: n.locator,
|
|
4045
4050
|
navigation: s.navigation,
|
|
4046
4051
|
navigationResolver: t,
|
|
@@ -4049,18 +4054,18 @@ const vo = () => (e) => e.pipe(
|
|
|
4049
4054
|
spineItemLocator: n.locator.spineItemLocator,
|
|
4050
4055
|
spine: n
|
|
4051
4056
|
}).pipe(
|
|
4052
|
-
S((
|
|
4057
|
+
S((a) => ({
|
|
4053
4058
|
...s,
|
|
4054
4059
|
navigation: {
|
|
4055
4060
|
...s.navigation,
|
|
4056
|
-
position:
|
|
4061
|
+
position: a
|
|
4057
4062
|
}
|
|
4058
4063
|
}))
|
|
4059
4064
|
))
|
|
4060
|
-
),
|
|
4061
|
-
class
|
|
4062
|
-
constructor(t, i, n, o, s,
|
|
4063
|
-
super(), this.settings = t, this.context = i, this.userNavigation$ = n, this.viewportController = o, this.scrollNavigationController = s, this.navigationResolver =
|
|
4065
|
+
), Ro = "navigation/InternalNavigator", Ao = O.namespace(Ro);
|
|
4066
|
+
class Do extends X {
|
|
4067
|
+
constructor(t, i, n, o, s, a, r, c) {
|
|
4068
|
+
super(), this.settings = t, this.context = i, this.userNavigation$ = n, this.viewportController = o, this.scrollNavigationController = s, this.navigationResolver = a, this.spine = r, this.isUserLocked$ = c, this.navigationSubject = new U({
|
|
4064
4069
|
animation: !1,
|
|
4065
4070
|
position: new L({ x: 0, y: 0 }),
|
|
4066
4071
|
meta: {
|
|
@@ -4081,59 +4086,59 @@ class Vo extends X {
|
|
|
4081
4086
|
), this.locker = new _e();
|
|
4082
4087
|
const u = n.pipe(
|
|
4083
4088
|
A(this.navigationSubject),
|
|
4084
|
-
|
|
4089
|
+
Po,
|
|
4085
4090
|
/**
|
|
4086
4091
|
* Url lookup is heavier so we start with it to fill
|
|
4087
4092
|
* as much information as needed to reduce later lookup
|
|
4088
4093
|
*/
|
|
4089
|
-
|
|
4090
|
-
navigationResolver:
|
|
4094
|
+
Fo({
|
|
4095
|
+
navigationResolver: a
|
|
4091
4096
|
}),
|
|
4092
4097
|
/**
|
|
4093
4098
|
* Cfi lookup is heavier so we start with it to fill
|
|
4094
4099
|
* as much information as needed to reduce later lookup
|
|
4095
4100
|
*/
|
|
4096
|
-
|
|
4097
|
-
navigationResolver:
|
|
4101
|
+
vo({
|
|
4102
|
+
navigationResolver: a
|
|
4098
4103
|
}),
|
|
4099
|
-
|
|
4104
|
+
$o({ context: i, settings: t }),
|
|
4100
4105
|
he({
|
|
4101
|
-
navigationResolver:
|
|
4106
|
+
navigationResolver: a,
|
|
4102
4107
|
settings: t,
|
|
4103
|
-
spineItemsManager:
|
|
4104
|
-
spineLocator:
|
|
4108
|
+
spineItemsManager: r.spineItemsManager,
|
|
4109
|
+
spineLocator: r.locator
|
|
4105
4110
|
}),
|
|
4106
4111
|
Vt({
|
|
4107
|
-
navigationResolver:
|
|
4112
|
+
navigationResolver: a,
|
|
4108
4113
|
settings: t,
|
|
4109
|
-
spineItemsManager:
|
|
4110
|
-
spineLocator:
|
|
4114
|
+
spineItemsManager: r.spineItemsManager,
|
|
4115
|
+
spineLocator: r.locator
|
|
4111
4116
|
}),
|
|
4112
4117
|
me({
|
|
4113
|
-
spine:
|
|
4118
|
+
spine: r
|
|
4114
4119
|
})
|
|
4115
4120
|
).pipe(
|
|
4116
|
-
|
|
4117
|
-
navigationResolver:
|
|
4118
|
-
spineItemsManager:
|
|
4121
|
+
To({
|
|
4122
|
+
navigationResolver: a,
|
|
4123
|
+
spineItemsManager: r.spineItemsManager
|
|
4119
4124
|
}),
|
|
4120
4125
|
A(c),
|
|
4121
4126
|
P(([f, b]) => {
|
|
4122
4127
|
const I = f.navigation.cfi || f.navigation.url || t.values.computedPageTurnMode === "scrollable" || b;
|
|
4123
4128
|
return w(f).pipe(
|
|
4124
4129
|
I ? Pt : fe({
|
|
4125
|
-
navigationResolver:
|
|
4130
|
+
navigationResolver: a,
|
|
4126
4131
|
settings: t,
|
|
4127
|
-
spine:
|
|
4132
|
+
spine: r,
|
|
4128
4133
|
context: i
|
|
4129
4134
|
})
|
|
4130
4135
|
);
|
|
4131
4136
|
}),
|
|
4132
4137
|
Vt({
|
|
4133
|
-
spineItemsManager:
|
|
4134
|
-
spineLocator:
|
|
4138
|
+
spineItemsManager: r.spineItemsManager,
|
|
4139
|
+
spineLocator: r.locator,
|
|
4135
4140
|
settings: t,
|
|
4136
|
-
navigationResolver:
|
|
4141
|
+
navigationResolver: a
|
|
4137
4142
|
}),
|
|
4138
4143
|
S((f) => f.navigation),
|
|
4139
4144
|
V()
|
|
@@ -4160,7 +4165,7 @@ class Vo extends X {
|
|
|
4160
4165
|
V()
|
|
4161
4166
|
), g = v(
|
|
4162
4167
|
o.layout$,
|
|
4163
|
-
|
|
4168
|
+
r.layout$
|
|
4164
4169
|
).pipe(
|
|
4165
4170
|
P(() => w(null).pipe(
|
|
4166
4171
|
P(
|
|
@@ -4190,10 +4195,10 @@ class Vo extends X {
|
|
|
4190
4195
|
).pipe(
|
|
4191
4196
|
S((f) => ({ navigation: f })),
|
|
4192
4197
|
fe({
|
|
4193
|
-
navigationResolver:
|
|
4198
|
+
navigationResolver: a,
|
|
4194
4199
|
settings: t,
|
|
4195
4200
|
context: i,
|
|
4196
|
-
spine:
|
|
4201
|
+
spine: r
|
|
4197
4202
|
}),
|
|
4198
4203
|
S((f) => {
|
|
4199
4204
|
const b = {
|
|
@@ -4213,33 +4218,33 @@ class Vo extends X {
|
|
|
4213
4218
|
* yet.
|
|
4214
4219
|
*/
|
|
4215
4220
|
he({
|
|
4216
|
-
navigationResolver:
|
|
4221
|
+
navigationResolver: a,
|
|
4217
4222
|
settings: t,
|
|
4218
|
-
spineItemsManager:
|
|
4219
|
-
spineLocator:
|
|
4223
|
+
spineItemsManager: r.spineItemsManager,
|
|
4224
|
+
spineLocator: r.locator
|
|
4220
4225
|
}),
|
|
4221
4226
|
me({
|
|
4222
|
-
spine:
|
|
4227
|
+
spine: r
|
|
4223
4228
|
}),
|
|
4224
4229
|
Vt({
|
|
4225
|
-
spineItemsManager:
|
|
4226
|
-
spineLocator:
|
|
4230
|
+
spineItemsManager: r.spineItemsManager,
|
|
4231
|
+
spineLocator: r.locator,
|
|
4227
4232
|
settings: t,
|
|
4228
|
-
navigationResolver:
|
|
4233
|
+
navigationResolver: a
|
|
4229
4234
|
}),
|
|
4230
4235
|
S(({ navigation: f }) => f),
|
|
4231
4236
|
V()
|
|
4232
|
-
), h =
|
|
4237
|
+
), h = wo(
|
|
4233
4238
|
i,
|
|
4234
4239
|
this.navigationSubject,
|
|
4235
|
-
|
|
4240
|
+
r
|
|
4236
4241
|
), p = v(
|
|
4237
4242
|
l,
|
|
4238
4243
|
u,
|
|
4239
4244
|
h
|
|
4240
4245
|
), m = (f) => f.pipe(
|
|
4241
4246
|
$(([b, I]) => {
|
|
4242
|
-
|
|
4247
|
+
Ao.info(
|
|
4243
4248
|
`navigation updated from ${b.meta.triggeredBy} of type ${b.type}`,
|
|
4244
4249
|
{
|
|
4245
4250
|
previousNavigation: I,
|
|
@@ -4303,24 +4308,24 @@ const Xe = ({
|
|
|
4303
4308
|
scrollOffset: t
|
|
4304
4309
|
})
|
|
4305
4310
|
});
|
|
4306
|
-
},
|
|
4307
|
-
class
|
|
4311
|
+
}, No = 500;
|
|
4312
|
+
class Oo extends X {
|
|
4308
4313
|
constructor(t, i, n, o, s) {
|
|
4309
4314
|
super(), this.settings = t, this.context = i, this.spine = n, this.scrollNavigationController = o, this.locker = s, this.navigationSubject = new W(), this.navigation$ = this.navigationSubject.asObservable();
|
|
4310
|
-
const
|
|
4311
|
-
Wt((
|
|
4315
|
+
const a = this.scrollNavigationController.userScroll$.pipe(
|
|
4316
|
+
Wt((r) => {
|
|
4312
4317
|
const c = this.locker.lock();
|
|
4313
4318
|
return v(
|
|
4314
4319
|
this.scrollNavigationController.userScroll$,
|
|
4315
|
-
w(
|
|
4320
|
+
w(r)
|
|
4316
4321
|
).pipe(
|
|
4317
4322
|
St(
|
|
4318
|
-
|
|
4323
|
+
No,
|
|
4319
4324
|
rt
|
|
4320
4325
|
),
|
|
4321
4326
|
z(),
|
|
4322
4327
|
$(() => {
|
|
4323
|
-
const u =
|
|
4328
|
+
const u = r.target, d = Xe({
|
|
4324
4329
|
element: u,
|
|
4325
4330
|
position: new L({
|
|
4326
4331
|
x: u.scrollLeft ?? 0,
|
|
@@ -4340,25 +4345,25 @@ class ko extends X {
|
|
|
4340
4345
|
);
|
|
4341
4346
|
})
|
|
4342
4347
|
);
|
|
4343
|
-
v(
|
|
4348
|
+
v(a).pipe(T(this.destroy$)).subscribe();
|
|
4344
4349
|
}
|
|
4345
4350
|
}
|
|
4346
|
-
const
|
|
4351
|
+
const Vo = (e) => ({
|
|
4347
4352
|
x: -e.x,
|
|
4348
4353
|
y: -e.y
|
|
4349
|
-
}),
|
|
4354
|
+
}), jo = (e) => e instanceof DOMMatrix ? new L({
|
|
4350
4355
|
x: -e.e,
|
|
4351
4356
|
y: -e.f
|
|
4352
4357
|
}) : new L({
|
|
4353
4358
|
x: -e.x,
|
|
4354
4359
|
y: -e.y
|
|
4355
|
-
}),
|
|
4356
|
-
class
|
|
4360
|
+
}), ko = "navigation/ViewportNavigator", ye = O.namespace(ko);
|
|
4361
|
+
class Wo extends X {
|
|
4357
4362
|
constructor(t, i, n, o, s) {
|
|
4358
4363
|
super(), this.settings = t, this.hookManager = i, this.context = n, this.spine = o, this.viewport = s, this.navigateSubject = new W(), this.element$ = new U(
|
|
4359
4364
|
document.createElement("div")
|
|
4360
4365
|
);
|
|
4361
|
-
const
|
|
4366
|
+
const a = this.spine.element$.pipe(
|
|
4362
4367
|
M(qt),
|
|
4363
4368
|
A(this.element$),
|
|
4364
4369
|
$(([d, g]) => {
|
|
@@ -4366,14 +4371,14 @@ class Ho extends X {
|
|
|
4366
4371
|
height: 100%;
|
|
4367
4372
|
width: 100%;
|
|
4368
4373
|
position: relative;
|
|
4369
|
-
`, g.className = `${
|
|
4374
|
+
`, g.className = `${pt}-controlled-navigator`, g.innerHTML = "", g.appendChild(d), this.viewport.value.element.appendChild(g), this.element$.next(g);
|
|
4370
4375
|
})
|
|
4371
|
-
),
|
|
4376
|
+
), r = t.watch([
|
|
4372
4377
|
"computedPageTurnDirection",
|
|
4373
4378
|
"computedPageTurnMode",
|
|
4374
4379
|
"numberOfAdjacentSpineItemToPreLoad"
|
|
4375
4380
|
]), c = B([
|
|
4376
|
-
|
|
4381
|
+
r,
|
|
4377
4382
|
this.element$
|
|
4378
4383
|
]).pipe(
|
|
4379
4384
|
$(([, d]) => {
|
|
@@ -4454,7 +4459,7 @@ class Ho extends X {
|
|
|
4454
4459
|
}),
|
|
4455
4460
|
it(!1),
|
|
4456
4461
|
tt(1)
|
|
4457
|
-
), v(
|
|
4462
|
+
), v(a, this.isNavigating$, this.layout$).pipe(T(this.destroy$)).subscribe();
|
|
4458
4463
|
}
|
|
4459
4464
|
/**
|
|
4460
4465
|
* Programmatically set the viewport position.
|
|
@@ -4465,7 +4470,7 @@ class Ho extends X {
|
|
|
4465
4470
|
* for remark about flicker / fonts smoothing
|
|
4466
4471
|
*/
|
|
4467
4472
|
setViewportPosition(t) {
|
|
4468
|
-
const i = this.element$.getValue(), n =
|
|
4473
|
+
const i = this.element$.getValue(), n = Vo(t);
|
|
4469
4474
|
i.style.transform = `translate(${n.x}px, ${n.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
|
|
4470
4475
|
}
|
|
4471
4476
|
navigate(t) {
|
|
@@ -4480,10 +4485,10 @@ class Ho extends X {
|
|
|
4480
4485
|
if (!n || n === "none")
|
|
4481
4486
|
return new L({ x: 0, y: 0 });
|
|
4482
4487
|
const o = new DOMMatrix(n);
|
|
4483
|
-
return
|
|
4488
|
+
return jo(o);
|
|
4484
4489
|
}
|
|
4485
4490
|
}
|
|
4486
|
-
class
|
|
4491
|
+
class Uo extends ht {
|
|
4487
4492
|
constructor(t, i, n, o, s) {
|
|
4488
4493
|
super({
|
|
4489
4494
|
element: void 0
|
|
@@ -4500,7 +4505,7 @@ class Bo extends pt {
|
|
|
4500
4505
|
T(v(this.scrollingSubject.pipe(ve(1)), this.destroy$))
|
|
4501
4506
|
).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
|
|
4502
4507
|
};
|
|
4503
|
-
const
|
|
4508
|
+
const a = this.context.pipe(
|
|
4504
4509
|
Jt(["rootElement"]),
|
|
4505
4510
|
$(({ rootElement: g }) => {
|
|
4506
4511
|
if (!g) return;
|
|
@@ -4511,9 +4516,9 @@ class Bo extends pt {
|
|
|
4511
4516
|
position: relative;
|
|
4512
4517
|
overflow-y: scroll;
|
|
4513
4518
|
overflow-x: hidden;
|
|
4514
|
-
`, l.className = `${
|
|
4519
|
+
`, l.className = `${pt}-scroll-navigator`, l.appendChild(this.viewport.value.element), g.appendChild(l), this.update({ element: l });
|
|
4515
4520
|
})
|
|
4516
|
-
),
|
|
4521
|
+
), r = B([
|
|
4517
4522
|
i.watch(["computedPageTurnMode"]),
|
|
4518
4523
|
this.watch("element")
|
|
4519
4524
|
]).pipe(
|
|
@@ -4570,7 +4575,7 @@ class Bo extends pt {
|
|
|
4570
4575
|
)
|
|
4571
4576
|
),
|
|
4572
4577
|
V()
|
|
4573
|
-
), v(
|
|
4578
|
+
), v(a, r, c).pipe(T(this.destroy$)).subscribe();
|
|
4574
4579
|
}
|
|
4575
4580
|
update(t) {
|
|
4576
4581
|
this.mergeCompare(t);
|
|
@@ -4594,12 +4599,12 @@ const Ft = (e, t, i) => {
|
|
|
4594
4599
|
const n = i - e, o = i * (t * e) / (i || 1);
|
|
4595
4600
|
return Math.max(0, Math.min(n, o));
|
|
4596
4601
|
}, _t = (e, t) => (t || 0) === 0 || (e || 0) === 0 ? 1 : Math.floor(Math.max(1, e / t)), xt = (e, t, i) => {
|
|
4597
|
-
const n = _t(i, t), o = [...Array(n)].map((s,
|
|
4602
|
+
const n = _t(i, t), o = [...Array(n)].map((s, a) => a * t);
|
|
4598
4603
|
return e >= n * t ? o[o.length - 1] || 0 : o.find((s) => e < s + t) || 0;
|
|
4599
4604
|
}, Se = (e, t, i) => {
|
|
4600
4605
|
const n = [...Array(i)].map((o, s) => s * t);
|
|
4601
4606
|
return e <= 0 || i === 0 ? 0 : e >= i * t ? i - 1 : n.findIndex((o) => e < o + t) ?? 0;
|
|
4602
|
-
},
|
|
4607
|
+
}, zo = ({
|
|
4603
4608
|
itemWidth: e,
|
|
4604
4609
|
itemHeight: t,
|
|
4605
4610
|
spineItemPosition: i
|
|
@@ -4613,19 +4618,19 @@ const Ft = (e, t, i) => {
|
|
|
4613
4618
|
pageWidth: n,
|
|
4614
4619
|
pageHeight: o,
|
|
4615
4620
|
pageTurnDirection: s,
|
|
4616
|
-
pageTurnMode:
|
|
4617
|
-
}) => s === "vertical" &&
|
|
4621
|
+
pageTurnMode: a
|
|
4622
|
+
}) => s === "vertical" && a === "scrollable" ? 1 : i || s === "vertical" ? _t(e, o) : _t(t, n), be = ({
|
|
4618
4623
|
itemWidth: e,
|
|
4619
4624
|
itemHeight: t,
|
|
4620
4625
|
position: i,
|
|
4621
4626
|
isUsingVerticalWriting: n,
|
|
4622
4627
|
pageWidth: o,
|
|
4623
4628
|
pageHeight: s,
|
|
4624
|
-
pageTurnDirection:
|
|
4625
|
-
pageTurnMode:
|
|
4629
|
+
pageTurnDirection: a,
|
|
4630
|
+
pageTurnMode: r,
|
|
4626
4631
|
isRTL: c
|
|
4627
4632
|
}) => {
|
|
4628
|
-
const d =
|
|
4633
|
+
const d = zo({
|
|
4629
4634
|
spineItemPosition: i,
|
|
4630
4635
|
itemHeight: t,
|
|
4631
4636
|
itemWidth: e
|
|
@@ -4635,14 +4640,14 @@ const Ft = (e, t, i) => {
|
|
|
4635
4640
|
itemWidth: e,
|
|
4636
4641
|
pageWidth: o,
|
|
4637
4642
|
pageHeight: s,
|
|
4638
|
-
pageTurnDirection:
|
|
4639
|
-
pageTurnMode:
|
|
4643
|
+
pageTurnDirection: a,
|
|
4644
|
+
pageTurnMode: r
|
|
4640
4645
|
});
|
|
4641
4646
|
if (n)
|
|
4642
4647
|
return Se(i.y, s, g);
|
|
4643
4648
|
const l = Se(d, o, g);
|
|
4644
4649
|
return c ? g - 1 - l : l;
|
|
4645
|
-
},
|
|
4650
|
+
}, Ho = ({
|
|
4646
4651
|
pageIndex: e,
|
|
4647
4652
|
itemLayout: t,
|
|
4648
4653
|
context: i,
|
|
@@ -4675,13 +4680,13 @@ const Ft = (e, t, i) => {
|
|
|
4675
4680
|
context: e,
|
|
4676
4681
|
settings: t
|
|
4677
4682
|
}) => {
|
|
4678
|
-
const i = (
|
|
4683
|
+
const i = (a, r, c) => {
|
|
4679
4684
|
var l;
|
|
4680
4685
|
let u;
|
|
4681
|
-
if ((
|
|
4682
|
-
u =
|
|
4683
|
-
else if (
|
|
4684
|
-
const h =
|
|
4686
|
+
if ((a == null ? void 0 : a.nodeName) === "img" || (a == null ? void 0 : a.textContent) === "" && a.nodeType === Node.ELEMENT_NODE)
|
|
4687
|
+
u = a.getBoundingClientRect().x;
|
|
4688
|
+
else if (a) {
|
|
4689
|
+
const h = a ? Ri(a, r) : void 0;
|
|
4685
4690
|
u = (h == null ? void 0 : h.getBoundingClientRect().x) || u;
|
|
4686
4691
|
}
|
|
4687
4692
|
const d = ((l = c.layout.layoutInfo) == null ? void 0 : l.width) || 0, g = e.getPageSize().width;
|
|
@@ -4697,24 +4702,24 @@ const Ft = (e, t, i) => {
|
|
|
4697
4702
|
return {
|
|
4698
4703
|
getSpineItemPositionFromNode: i,
|
|
4699
4704
|
getSpineItemPositionFromPageIndex: ({
|
|
4700
|
-
pageIndex:
|
|
4701
|
-
spineItem:
|
|
4702
|
-
}) =>
|
|
4705
|
+
pageIndex: a,
|
|
4706
|
+
spineItem: r
|
|
4707
|
+
}) => Ho({
|
|
4703
4708
|
context: e,
|
|
4704
|
-
isUsingVerticalWriting: !!
|
|
4705
|
-
itemLayout:
|
|
4706
|
-
pageIndex:
|
|
4709
|
+
isUsingVerticalWriting: !!r.isUsingVerticalWriting(),
|
|
4710
|
+
itemLayout: r.layout.layoutInfo,
|
|
4711
|
+
pageIndex: a
|
|
4707
4712
|
}),
|
|
4708
|
-
getSpineItemPageIndexFromPosition: (
|
|
4709
|
-
...
|
|
4713
|
+
getSpineItemPageIndexFromPosition: (a) => be({
|
|
4714
|
+
...a,
|
|
4710
4715
|
isRTL: e.isRTL(),
|
|
4711
4716
|
pageWidth: e.getPageSize().width,
|
|
4712
4717
|
pageHeight: e.getPageSize().height,
|
|
4713
4718
|
pageTurnDirection: t.values.computedPageTurnDirection,
|
|
4714
4719
|
pageTurnMode: t.values.pageTurnMode
|
|
4715
4720
|
}),
|
|
4716
|
-
getSpineItemPageIndexFromNode: (
|
|
4717
|
-
const u = i(
|
|
4721
|
+
getSpineItemPageIndexFromNode: (a, r, c) => {
|
|
4722
|
+
const u = i(a, r, c), { height: d, width: g } = c.layout.layoutInfo;
|
|
4718
4723
|
return u ? be({
|
|
4719
4724
|
isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
|
|
4720
4725
|
position: u,
|
|
@@ -4727,69 +4732,69 @@ const Ft = (e, t, i) => {
|
|
|
4727
4732
|
pageTurnMode: t.values.pageTurnMode
|
|
4728
4733
|
}) : void 0;
|
|
4729
4734
|
},
|
|
4730
|
-
getSpineItemClosestPositionFromUnsafePosition: (
|
|
4731
|
-
const { width: c, height: u } =
|
|
4735
|
+
getSpineItemClosestPositionFromUnsafePosition: (a, r) => {
|
|
4736
|
+
const { width: c, height: u } = r.layout.layoutInfo;
|
|
4732
4737
|
return new R({
|
|
4733
4738
|
x: xt(
|
|
4734
|
-
|
|
4739
|
+
a.x,
|
|
4735
4740
|
e.getPageSize().width,
|
|
4736
4741
|
c
|
|
4737
4742
|
),
|
|
4738
4743
|
y: xt(
|
|
4739
|
-
|
|
4744
|
+
a.y,
|
|
4740
4745
|
e.getPageSize().height,
|
|
4741
4746
|
u
|
|
4742
4747
|
)
|
|
4743
4748
|
});
|
|
4744
4749
|
},
|
|
4745
|
-
getSpineItemPagePositionFromSpineItemPosition: (
|
|
4750
|
+
getSpineItemPagePositionFromSpineItemPosition: (a, r, c) => {
|
|
4746
4751
|
const { width: u, height: d } = c.layout.layoutInfo, g = e.getPageSize().width, l = e.getPageSize().height;
|
|
4747
4752
|
if (!!c.isUsingVerticalWriting()) {
|
|
4748
4753
|
const m = Ft(
|
|
4749
4754
|
l,
|
|
4750
|
-
|
|
4755
|
+
r,
|
|
4751
4756
|
d
|
|
4752
4757
|
);
|
|
4753
4758
|
return new Nt({
|
|
4754
|
-
x:
|
|
4755
|
-
y:
|
|
4759
|
+
x: a.x,
|
|
4760
|
+
y: a.y - m
|
|
4756
4761
|
});
|
|
4757
4762
|
}
|
|
4758
|
-
const p = Ft(g,
|
|
4763
|
+
const p = Ft(g, r, u);
|
|
4759
4764
|
if (e.isRTL()) {
|
|
4760
|
-
const m = u - (
|
|
4765
|
+
const m = u - (r + 1) * g;
|
|
4761
4766
|
return new Nt({
|
|
4762
|
-
x:
|
|
4763
|
-
y:
|
|
4767
|
+
x: a.x - Math.max(0, m),
|
|
4768
|
+
y: a.y
|
|
4764
4769
|
});
|
|
4765
4770
|
}
|
|
4766
4771
|
return new Nt({
|
|
4767
|
-
x:
|
|
4768
|
-
y:
|
|
4772
|
+
x: a.x - p,
|
|
4773
|
+
y: a.y
|
|
4769
4774
|
});
|
|
4770
4775
|
}
|
|
4771
4776
|
};
|
|
4772
|
-
},
|
|
4777
|
+
}, Bo = ({
|
|
4773
4778
|
context: e,
|
|
4774
4779
|
settings: t
|
|
4775
4780
|
}) => {
|
|
4776
4781
|
const i = qe({ context: e, settings: t });
|
|
4777
4782
|
return {
|
|
4778
|
-
getNavigationForLastPage: (
|
|
4779
|
-
const
|
|
4783
|
+
getNavigationForLastPage: (a) => {
|
|
4784
|
+
const r = a.numberOfPages;
|
|
4780
4785
|
return i.getSpineItemPositionFromPageIndex({
|
|
4781
|
-
pageIndex:
|
|
4782
|
-
spineItem:
|
|
4786
|
+
pageIndex: r - 1,
|
|
4787
|
+
spineItem: a
|
|
4783
4788
|
});
|
|
4784
4789
|
},
|
|
4785
|
-
getNavigationForPosition: (
|
|
4786
|
-
|
|
4787
|
-
|
|
4790
|
+
getNavigationForPosition: (a, r) => i.getSpineItemClosestPositionFromUnsafePosition(
|
|
4791
|
+
r,
|
|
4792
|
+
a
|
|
4788
4793
|
),
|
|
4789
|
-
getNavigationFromNode: (
|
|
4790
|
-
|
|
4794
|
+
getNavigationFromNode: (a, r, c) => i.getSpineItemPositionFromNode(
|
|
4795
|
+
r,
|
|
4791
4796
|
c,
|
|
4792
|
-
|
|
4797
|
+
a
|
|
4793
4798
|
) || new R({ x: 0, y: 0 })
|
|
4794
4799
|
};
|
|
4795
4800
|
}, et = ({
|
|
@@ -4807,17 +4812,17 @@ const Ft = (e, t, i) => {
|
|
|
4807
4812
|
visibleAreaRectWidth: o,
|
|
4808
4813
|
spine: s
|
|
4809
4814
|
}) => {
|
|
4810
|
-
const
|
|
4815
|
+
const a = n.get(
|
|
4811
4816
|
n.items.length - 1
|
|
4812
|
-
),
|
|
4813
|
-
|
|
4814
|
-
), c =
|
|
4817
|
+
), r = s.getSpineItemSpineLayoutInfo(
|
|
4818
|
+
a || 0
|
|
4819
|
+
), c = r.bottom - i, u = Math.min(Math.max(0, e.y), c);
|
|
4815
4820
|
if (t)
|
|
4816
4821
|
return new L({
|
|
4817
|
-
x: Math.max(Math.min(0, e.x),
|
|
4822
|
+
x: Math.max(Math.min(0, e.x), r.left),
|
|
4818
4823
|
y: u
|
|
4819
4824
|
});
|
|
4820
|
-
const d =
|
|
4825
|
+
const d = r.right - o;
|
|
4821
4826
|
return new L({
|
|
4822
4827
|
x: Math.min(Math.max(0, e.x), d),
|
|
4823
4828
|
y: u
|
|
@@ -4833,21 +4838,21 @@ const Ft = (e, t, i) => {
|
|
|
4833
4838
|
const s = t.getSpineItemPositionFromSpinePosition(
|
|
4834
4839
|
e,
|
|
4835
4840
|
o
|
|
4836
|
-
),
|
|
4841
|
+
), a = n.getNavigationForPosition(
|
|
4837
4842
|
o,
|
|
4838
4843
|
s
|
|
4839
|
-
),
|
|
4840
|
-
spineItemPosition:
|
|
4844
|
+
), r = t.getSpinePositionFromSpineItemPosition({
|
|
4845
|
+
spineItemPosition: a,
|
|
4841
4846
|
spineItem: o
|
|
4842
4847
|
});
|
|
4843
4848
|
return et({
|
|
4844
|
-
position:
|
|
4849
|
+
position: r,
|
|
4845
4850
|
pageSizeWidth: i.getPageSize().width,
|
|
4846
4851
|
visibleAreaRectWidth: i.state.visibleAreaRect.width
|
|
4847
4852
|
});
|
|
4848
4853
|
}
|
|
4849
4854
|
return new L({ x: 0, y: 0 });
|
|
4850
|
-
},
|
|
4855
|
+
}, Eo = ({
|
|
4851
4856
|
pageIndex: e,
|
|
4852
4857
|
spineItemsManager: t,
|
|
4853
4858
|
spineItemId: i,
|
|
@@ -4855,8 +4860,8 @@ const Ft = (e, t, i) => {
|
|
|
4855
4860
|
spineLocator: o,
|
|
4856
4861
|
spineItemNavigationResolver: s
|
|
4857
4862
|
}) => {
|
|
4858
|
-
const
|
|
4859
|
-
if (!
|
|
4863
|
+
const a = t.get(i);
|
|
4864
|
+
if (!a) {
|
|
4860
4865
|
const u = e * n.getPageSize().width;
|
|
4861
4866
|
return Xt({
|
|
4862
4867
|
viewportPosition: new L({ x: u, y: 0 }),
|
|
@@ -4865,37 +4870,37 @@ const Ft = (e, t, i) => {
|
|
|
4865
4870
|
spineLocator: o
|
|
4866
4871
|
});
|
|
4867
4872
|
}
|
|
4868
|
-
const
|
|
4873
|
+
const r = o.spineItemLocator.getSpineItemPositionFromPageIndex({
|
|
4869
4874
|
pageIndex: e,
|
|
4870
|
-
spineItem:
|
|
4875
|
+
spineItem: a
|
|
4871
4876
|
}), c = o.getSpinePositionFromSpineItemPosition({
|
|
4872
|
-
spineItemPosition:
|
|
4873
|
-
spineItem:
|
|
4877
|
+
spineItemPosition: r,
|
|
4878
|
+
spineItem: a
|
|
4874
4879
|
});
|
|
4875
4880
|
return et({
|
|
4876
4881
|
position: c,
|
|
4877
4882
|
pageSizeWidth: n.getPageSize().width,
|
|
4878
4883
|
visibleAreaRectWidth: n.state.visibleAreaRect.width
|
|
4879
4884
|
});
|
|
4880
|
-
},
|
|
4885
|
+
}, _o = ({
|
|
4881
4886
|
anchor: e,
|
|
4882
4887
|
spineItem: t,
|
|
4883
4888
|
context: i
|
|
4884
4889
|
}) => {
|
|
4885
|
-
var
|
|
4886
|
-
const n = ((
|
|
4890
|
+
var r;
|
|
4891
|
+
const n = ((r = t.layout.layoutInfo) == null ? void 0 : r.width) || 0, o = i.getPageSize().width, s = t.getBoundingRectOfElementFromSelector(e), a = (s == null ? void 0 : s.x) || 0;
|
|
4887
4892
|
return xt(
|
|
4888
|
-
|
|
4893
|
+
a,
|
|
4889
4894
|
o,
|
|
4890
4895
|
n
|
|
4891
4896
|
);
|
|
4892
|
-
},
|
|
4897
|
+
}, Xo = ({
|
|
4893
4898
|
anchor: e,
|
|
4894
4899
|
context: t,
|
|
4895
4900
|
spineItem: i,
|
|
4896
4901
|
spineLocator: n
|
|
4897
4902
|
}) => {
|
|
4898
|
-
const o =
|
|
4903
|
+
const o = _o({
|
|
4899
4904
|
anchor: e,
|
|
4900
4905
|
spineItem: i,
|
|
4901
4906
|
context: t
|
|
@@ -4904,7 +4909,7 @@ const Ft = (e, t, i) => {
|
|
|
4904
4909
|
spineItemPosition: new R({ x: o, y: 0 }),
|
|
4905
4910
|
spineItem: i
|
|
4906
4911
|
});
|
|
4907
|
-
},
|
|
4912
|
+
}, Yo = ({
|
|
4908
4913
|
anchor: e,
|
|
4909
4914
|
spineItem: t,
|
|
4910
4915
|
spineLocator: i,
|
|
@@ -4912,18 +4917,18 @@ const Ft = (e, t, i) => {
|
|
|
4912
4917
|
pageSizeWidth: o,
|
|
4913
4918
|
visibleAreaRectWidth: s
|
|
4914
4919
|
}) => {
|
|
4915
|
-
const
|
|
4920
|
+
const a = Xo({
|
|
4916
4921
|
anchor: e,
|
|
4917
4922
|
context: n,
|
|
4918
4923
|
spineItem: t,
|
|
4919
4924
|
spineLocator: i
|
|
4920
4925
|
});
|
|
4921
4926
|
return et({
|
|
4922
|
-
position:
|
|
4927
|
+
position: a,
|
|
4923
4928
|
pageSizeWidth: o,
|
|
4924
4929
|
visibleAreaRectWidth: s
|
|
4925
4930
|
});
|
|
4926
|
-
},
|
|
4931
|
+
}, qo = ({
|
|
4927
4932
|
context: e,
|
|
4928
4933
|
spineItemsManager: t,
|
|
4929
4934
|
spineLocator: i,
|
|
@@ -4931,16 +4936,16 @@ const Ft = (e, t, i) => {
|
|
|
4931
4936
|
pageSizeWidth: o,
|
|
4932
4937
|
visibleAreaRectWidth: s
|
|
4933
4938
|
}) => {
|
|
4934
|
-
var
|
|
4939
|
+
var a;
|
|
4935
4940
|
try {
|
|
4936
|
-
const
|
|
4941
|
+
const r = n instanceof URL ? n : new URL(n), c = `${r.origin}${r.pathname}`, u = (a = e.manifest) == null ? void 0 : a.spineItems.find(
|
|
4937
4942
|
(d) => d.href === c
|
|
4938
4943
|
);
|
|
4939
4944
|
if (u) {
|
|
4940
4945
|
const d = t.get(u.id);
|
|
4941
4946
|
if (d) {
|
|
4942
|
-
const g =
|
|
4943
|
-
anchor:
|
|
4947
|
+
const g = Yo({
|
|
4948
|
+
anchor: r.hash,
|
|
4944
4949
|
spineItem: d,
|
|
4945
4950
|
context: e,
|
|
4946
4951
|
spineLocator: i,
|
|
@@ -4958,11 +4963,11 @@ const Ft = (e, t, i) => {
|
|
|
4958
4963
|
}
|
|
4959
4964
|
}
|
|
4960
4965
|
return;
|
|
4961
|
-
} catch (
|
|
4962
|
-
console.error(
|
|
4966
|
+
} catch (r) {
|
|
4967
|
+
console.error(r);
|
|
4963
4968
|
return;
|
|
4964
4969
|
}
|
|
4965
|
-
},
|
|
4970
|
+
}, Zo = ({
|
|
4966
4971
|
spineItem: e,
|
|
4967
4972
|
spineItemPosition: t,
|
|
4968
4973
|
spineLocator: i,
|
|
@@ -4972,25 +4977,25 @@ const Ft = (e, t, i) => {
|
|
|
4972
4977
|
const s = n.getSpineItemClosestPositionFromUnsafePosition(
|
|
4973
4978
|
t,
|
|
4974
4979
|
e
|
|
4975
|
-
),
|
|
4980
|
+
), a = i.getSpinePositionFromSpineItemPosition({
|
|
4976
4981
|
spineItemPosition: s,
|
|
4977
4982
|
spineItem: e
|
|
4978
4983
|
});
|
|
4979
4984
|
return et({
|
|
4980
|
-
position:
|
|
4985
|
+
position: a,
|
|
4981
4986
|
pageSizeWidth: o.getPageSize().width,
|
|
4982
4987
|
visibleAreaRectWidth: o.state.visibleAreaRect.width
|
|
4983
4988
|
});
|
|
4984
|
-
},
|
|
4989
|
+
}, Go = "spineNavigator", Jo = ({
|
|
4985
4990
|
context: e,
|
|
4986
4991
|
spineItemsManager: t,
|
|
4987
4992
|
locator: i,
|
|
4988
4993
|
settings: n,
|
|
4989
4994
|
spine: o
|
|
4990
4995
|
}) => {
|
|
4991
|
-
const s =
|
|
4996
|
+
const s = Bo({ context: e, settings: n });
|
|
4992
4997
|
return {
|
|
4993
|
-
getNavigationForUrl: (l) =>
|
|
4998
|
+
getNavigationForUrl: (l) => qo({
|
|
4994
4999
|
context: e,
|
|
4995
5000
|
spineItemsManager: t,
|
|
4996
5001
|
spineLocator: i,
|
|
@@ -4998,14 +5003,14 @@ const Ft = (e, t, i) => {
|
|
|
4998
5003
|
pageSizeWidth: e.getPageSize().width,
|
|
4999
5004
|
visibleAreaRectWidth: e.state.visibleAreaRect.width
|
|
5000
5005
|
}),
|
|
5001
|
-
getNavigationForSpineItemPage: (l) =>
|
|
5006
|
+
getNavigationForSpineItemPage: (l) => Eo({
|
|
5002
5007
|
...l,
|
|
5003
5008
|
context: e,
|
|
5004
5009
|
spineItemsManager: t,
|
|
5005
5010
|
spineItemNavigationResolver: s,
|
|
5006
5011
|
spineLocator: i
|
|
5007
5012
|
}),
|
|
5008
|
-
getNavigationFromSpineItemPosition: (l) =>
|
|
5013
|
+
getNavigationFromSpineItemPosition: (l) => Zo({
|
|
5009
5014
|
...l,
|
|
5010
5015
|
spineItemLocator: i.spineItemLocator,
|
|
5011
5016
|
spineLocator: i,
|
|
@@ -5015,9 +5020,9 @@ const Ft = (e, t, i) => {
|
|
|
5015
5020
|
const h = t.getSpineItemFromCfi(l), { node: p, offset: m = 0 } = ze({
|
|
5016
5021
|
cfi: l,
|
|
5017
5022
|
spineItemsManager: t
|
|
5018
|
-
})
|
|
5023
|
+
});
|
|
5019
5024
|
if (!h) {
|
|
5020
|
-
O.warn(
|
|
5025
|
+
O.warn(Go, `unable to detect item id from cfi ${l}`);
|
|
5021
5026
|
return;
|
|
5022
5027
|
}
|
|
5023
5028
|
const y = p ? s.getNavigationFromNode(h, p, m) : new R({ x: 0, y: 0 }), f = i.getSpinePositionFromSpineItemPosition({
|
|
@@ -5095,7 +5100,7 @@ const Ft = (e, t, i) => {
|
|
|
5095
5100
|
}),
|
|
5096
5101
|
spineItemNavigator: s
|
|
5097
5102
|
};
|
|
5098
|
-
},
|
|
5103
|
+
}, Ko = ({
|
|
5099
5104
|
spineItemsManager: e,
|
|
5100
5105
|
context: t,
|
|
5101
5106
|
hookManager: i,
|
|
@@ -5103,34 +5108,34 @@ const Ft = (e, t, i) => {
|
|
|
5103
5108
|
settings: o,
|
|
5104
5109
|
viewport: s
|
|
5105
5110
|
}) => {
|
|
5106
|
-
const
|
|
5111
|
+
const a = new W(), r = new _e(), c = Jo({
|
|
5107
5112
|
context: t,
|
|
5108
5113
|
settings: o,
|
|
5109
5114
|
spineItemsManager: e,
|
|
5110
5115
|
locator: n.locator,
|
|
5111
5116
|
spine: n
|
|
5112
|
-
}), u = new
|
|
5117
|
+
}), u = new Wo(
|
|
5113
5118
|
o,
|
|
5114
5119
|
i,
|
|
5115
5120
|
t,
|
|
5116
5121
|
n,
|
|
5117
5122
|
s
|
|
5118
|
-
), d = new
|
|
5123
|
+
), d = new Uo(
|
|
5119
5124
|
s,
|
|
5120
5125
|
o,
|
|
5121
5126
|
i,
|
|
5122
5127
|
n,
|
|
5123
5128
|
t
|
|
5124
|
-
), g = new
|
|
5129
|
+
), g = new Oo(
|
|
5125
5130
|
o,
|
|
5126
5131
|
t,
|
|
5127
5132
|
n,
|
|
5128
5133
|
d,
|
|
5129
|
-
|
|
5134
|
+
r
|
|
5130
5135
|
), l = v(
|
|
5131
|
-
|
|
5136
|
+
a,
|
|
5132
5137
|
g.navigation$
|
|
5133
|
-
), h = new
|
|
5138
|
+
), h = new Do(
|
|
5134
5139
|
o,
|
|
5135
5140
|
t,
|
|
5136
5141
|
l,
|
|
@@ -5138,11 +5143,11 @@ const Ft = (e, t, i) => {
|
|
|
5138
5143
|
d,
|
|
5139
5144
|
c,
|
|
5140
5145
|
n,
|
|
5141
|
-
|
|
5146
|
+
r.isLocked$
|
|
5142
5147
|
), p = B([
|
|
5143
5148
|
u.isNavigating$,
|
|
5144
5149
|
d.isNavigating$,
|
|
5145
|
-
|
|
5150
|
+
r.isLocked$,
|
|
5146
5151
|
h.locker.isLocked$
|
|
5147
5152
|
]).pipe(
|
|
5148
5153
|
Y((f) => f.some((b) => b) ? "busy" : "free"),
|
|
@@ -5157,19 +5162,19 @@ const Ft = (e, t, i) => {
|
|
|
5157
5162
|
internalNavigator: h,
|
|
5158
5163
|
scrollNavigationController: d,
|
|
5159
5164
|
controlledNavigationController: u,
|
|
5160
|
-
locker:
|
|
5165
|
+
locker: r,
|
|
5161
5166
|
viewportState$: p,
|
|
5162
5167
|
navigate: (f) => {
|
|
5163
|
-
|
|
5168
|
+
a.next(f);
|
|
5164
5169
|
},
|
|
5165
5170
|
lock() {
|
|
5166
|
-
return
|
|
5171
|
+
return r.lock();
|
|
5167
5172
|
},
|
|
5168
5173
|
navigationResolver: c,
|
|
5169
5174
|
navigation$: h.navigation$
|
|
5170
5175
|
};
|
|
5171
5176
|
};
|
|
5172
|
-
class
|
|
5177
|
+
class Qo extends ht {
|
|
5173
5178
|
constructor(t, i) {
|
|
5174
5179
|
super({
|
|
5175
5180
|
beginPageIndexInSpineItem: void 0,
|
|
@@ -5187,10 +5192,10 @@ class is extends pt {
|
|
|
5187
5192
|
this.mergeCompare(t);
|
|
5188
5193
|
}
|
|
5189
5194
|
}
|
|
5190
|
-
class
|
|
5195
|
+
class ts extends X {
|
|
5191
5196
|
constructor(t, i, n, o, s) {
|
|
5192
5197
|
super(), this.context = t, this.pagination = i, this.spineItemsManager = n, this.spine = o, this.spineItemLocator = s;
|
|
5193
|
-
const
|
|
5198
|
+
const a = v(
|
|
5194
5199
|
this.context.bridgeEvent.navigation$,
|
|
5195
5200
|
o.layout$
|
|
5196
5201
|
).pipe(
|
|
@@ -5221,7 +5226,7 @@ class ns extends X {
|
|
|
5221
5226
|
}) ?? {}, { endPageIndex: I = 0 } = c({
|
|
5222
5227
|
spineItem: m,
|
|
5223
5228
|
position: d
|
|
5224
|
-
}) ?? {}, x = y === void 0 || Et(y) || g.beginSpineItemIndex !== l, F = g.endSpineItemIndex !== h || f === void 0 || Et(f), C = x ?
|
|
5229
|
+
}) ?? {}, x = y === void 0 || Et(y) || g.beginSpineItemIndex !== l, F = g.endSpineItemIndex !== h || f === void 0 || Et(f), C = x ? lt(p.item) : y, D = F ? lt(m.item) : f, E = p.numberOfPages, J = m.numberOfPages;
|
|
5225
5230
|
this.pagination.update({
|
|
5226
5231
|
beginCfi: C,
|
|
5227
5232
|
beginNumberOfPagesInSpineItem: E,
|
|
@@ -5236,7 +5241,7 @@ class ns extends X {
|
|
|
5236
5241
|
})
|
|
5237
5242
|
);
|
|
5238
5243
|
})
|
|
5239
|
-
),
|
|
5244
|
+
), r = a.pipe(
|
|
5240
5245
|
Ct(this.context.bridgeEvent.viewportFree$),
|
|
5241
5246
|
$(() => {
|
|
5242
5247
|
const {
|
|
@@ -5262,10 +5267,10 @@ class ns extends X {
|
|
|
5262
5267
|
});
|
|
5263
5268
|
})
|
|
5264
5269
|
);
|
|
5265
|
-
v(
|
|
5270
|
+
v(a, r).pipe(T(this.destroy$)).subscribe();
|
|
5266
5271
|
}
|
|
5267
5272
|
}
|
|
5268
|
-
class
|
|
5273
|
+
class es extends X {
|
|
5269
5274
|
constructor(t) {
|
|
5270
5275
|
super();
|
|
5271
5276
|
const i = {
|
|
@@ -5310,7 +5315,7 @@ class os extends X {
|
|
|
5310
5315
|
super.destroy(), this.outputSettingsUpdateSubject.complete();
|
|
5311
5316
|
}
|
|
5312
5317
|
}
|
|
5313
|
-
class
|
|
5318
|
+
class is extends es {
|
|
5314
5319
|
constructor(t, i) {
|
|
5315
5320
|
super(t), this.context = i;
|
|
5316
5321
|
const n = B([
|
|
@@ -5355,10 +5360,10 @@ class ss extends os {
|
|
|
5355
5360
|
};
|
|
5356
5361
|
}
|
|
5357
5362
|
}
|
|
5358
|
-
class
|
|
5359
|
-
constructor(t, i, n, o, s,
|
|
5360
|
-
super(), this.item = t, this.containerElement = i, this.context = n, this.hookManager = o, this.renderer = s, this.settings =
|
|
5361
|
-
blankPagePosition:
|
|
5363
|
+
class ns extends X {
|
|
5364
|
+
constructor(t, i, n, o, s, a) {
|
|
5365
|
+
super(), this.item = t, this.containerElement = i, this.context = n, this.hookManager = o, this.renderer = s, this.settings = a, this.layoutTriggerSubject = new W(), this.lastLayout = null, this.applyDimsAfterLayout = ({
|
|
5366
|
+
blankPagePosition: r,
|
|
5362
5367
|
minimumWidth: c
|
|
5363
5368
|
}) => (u) => u.pipe(
|
|
5364
5369
|
S((d) => {
|
|
@@ -5380,23 +5385,23 @@ class rs extends X {
|
|
|
5380
5385
|
height: I,
|
|
5381
5386
|
pageSize: this.context.getPageSize()
|
|
5382
5387
|
}, this.containerElement.style.width = `${b}px`, this.containerElement.style.height = `${I}px`, this.hookManager.execute("item.onAfterLayout", void 0, {
|
|
5383
|
-
blankPagePosition:
|
|
5388
|
+
blankPagePosition: r,
|
|
5384
5389
|
item: this.item,
|
|
5385
5390
|
minimumWidth: c
|
|
5386
5391
|
}), { width: b, height: I };
|
|
5387
5392
|
})
|
|
5388
|
-
), this.layout = (
|
|
5389
|
-
const c =
|
|
5390
|
-
return this.layoutTriggerSubject.next(
|
|
5393
|
+
), this.layout = (r) => {
|
|
5394
|
+
const c = zi(this.layout$.pipe(z()));
|
|
5395
|
+
return this.layoutTriggerSubject.next(r), c();
|
|
5391
5396
|
}, this.adjustPositionOfElement = ({
|
|
5392
|
-
right:
|
|
5397
|
+
right: r,
|
|
5393
5398
|
left: c,
|
|
5394
5399
|
top: u
|
|
5395
5400
|
}) => {
|
|
5396
|
-
|
|
5401
|
+
r !== void 0 ? this.containerElement.style.right = `${r}px` : this.containerElement.style.removeProperty("right"), c !== void 0 ? this.containerElement.style.left = `${c}px` : this.containerElement.style.removeProperty("left"), u !== void 0 ? this.containerElement.style.top = `${u}px` : this.containerElement.style.removeProperty("top");
|
|
5397
5402
|
}, this.layoutProcess$ = this.layoutTriggerSubject.pipe(
|
|
5398
|
-
P((
|
|
5399
|
-
const { blankPagePosition: c, minimumWidth: u, spreadPosition: d } =
|
|
5403
|
+
P((r) => {
|
|
5404
|
+
const { blankPagePosition: c, minimumWidth: u, spreadPosition: d } = r;
|
|
5400
5405
|
this.hookManager.execute("item.onBeforeLayout", void 0, {
|
|
5401
5406
|
blankPagePosition: c,
|
|
5402
5407
|
item: this.item,
|
|
@@ -5411,7 +5416,7 @@ class rs extends X {
|
|
|
5411
5416
|
return v(
|
|
5412
5417
|
w({ type: "start" }),
|
|
5413
5418
|
g.pipe(
|
|
5414
|
-
this.applyDimsAfterLayout(
|
|
5419
|
+
this.applyDimsAfterLayout(r),
|
|
5415
5420
|
S(
|
|
5416
5421
|
(l) => ({
|
|
5417
5422
|
type: "end",
|
|
@@ -5423,15 +5428,15 @@ class rs extends X {
|
|
|
5423
5428
|
}),
|
|
5424
5429
|
V()
|
|
5425
5430
|
), this.layout$ = this.layoutProcess$.pipe(
|
|
5426
|
-
M((
|
|
5427
|
-
S((
|
|
5431
|
+
M((r) => r.type === "end"),
|
|
5432
|
+
S((r) => r.data),
|
|
5428
5433
|
V()
|
|
5429
5434
|
);
|
|
5430
5435
|
}
|
|
5431
5436
|
validateDimension(t, i, n) {
|
|
5432
5437
|
if (t <= 0) return n;
|
|
5433
|
-
const o = Math.max(t, n),
|
|
5434
|
-
return Math.max(
|
|
5438
|
+
const o = Math.max(t, n), a = Math.ceil(o / i) * i;
|
|
5439
|
+
return Math.max(a, i);
|
|
5435
5440
|
}
|
|
5436
5441
|
get layoutInfo() {
|
|
5437
5442
|
const t = this.containerElement.style, i = t.width ? parseFloat(t.width) : 0, n = t.height ? parseFloat(t.height) : 0;
|
|
@@ -5441,7 +5446,7 @@ class rs extends X {
|
|
|
5441
5446
|
};
|
|
5442
5447
|
}
|
|
5443
5448
|
}
|
|
5444
|
-
class
|
|
5449
|
+
class os extends ft {
|
|
5445
5450
|
onUnload() {
|
|
5446
5451
|
return Q;
|
|
5447
5452
|
}
|
|
@@ -5461,9 +5466,9 @@ class as extends mt {
|
|
|
5461
5466
|
}
|
|
5462
5467
|
}
|
|
5463
5468
|
class Ze extends X {
|
|
5464
|
-
constructor(t, i, n, o, s,
|
|
5469
|
+
constructor(t, i, n, o, s, a) {
|
|
5465
5470
|
var u, d;
|
|
5466
|
-
super(), this.item = t, this.parentElement = i, this.context = n, this.settings = o, this.hookManager = s, this.index =
|
|
5471
|
+
super(), this.item = t, this.parentElement = i, this.context = n, this.settings = o, this.hookManager = s, this.index = a, this.getBoundingRectOfElementFromSelector = (g) => {
|
|
5467
5472
|
var h, p, m, y;
|
|
5468
5473
|
const l = this.renderer.getDocumentFrame();
|
|
5469
5474
|
if (l && l instanceof HTMLIFrameElement && g)
|
|
@@ -5477,12 +5482,12 @@ class Ze extends X {
|
|
|
5477
5482
|
}, this.isUsingVerticalWriting = () => {
|
|
5478
5483
|
var g;
|
|
5479
5484
|
return !!((g = this.renderer.writingMode) != null && g.startsWith("vertical"));
|
|
5480
|
-
}, this.containerElement =
|
|
5485
|
+
}, this.containerElement = ss(
|
|
5481
5486
|
i,
|
|
5482
5487
|
t,
|
|
5483
5488
|
s
|
|
5484
5489
|
), i.appendChild(this.containerElement);
|
|
5485
|
-
const
|
|
5490
|
+
const r = (d = (u = this.settings.values).getRenderer) == null ? void 0 : d.call(u, t);
|
|
5486
5491
|
this.resourcesHandler = new Qt(t, this.settings);
|
|
5487
5492
|
const c = {
|
|
5488
5493
|
context: n,
|
|
@@ -5492,7 +5497,7 @@ class Ze extends X {
|
|
|
5492
5497
|
containerElement: this.containerElement,
|
|
5493
5498
|
resourcesHandler: this.resourcesHandler
|
|
5494
5499
|
};
|
|
5495
|
-
this.renderer =
|
|
5500
|
+
this.renderer = r ? r(c) : new os(c), this.layout = new ns(
|
|
5496
5501
|
t,
|
|
5497
5502
|
this.containerElement,
|
|
5498
5503
|
n,
|
|
@@ -5566,16 +5571,16 @@ class Ze extends X {
|
|
|
5566
5571
|
});
|
|
5567
5572
|
}
|
|
5568
5573
|
}
|
|
5569
|
-
const
|
|
5574
|
+
const ss = (e, t, i) => {
|
|
5570
5575
|
const n = e.ownerDocument.createElement("div");
|
|
5571
5576
|
return n.classList.add("spineItem"), n.classList.add(`spineItem-${t.renditionLayout ?? "reflowable"}`), n.style.cssText = `
|
|
5572
5577
|
position: absolute;
|
|
5573
5578
|
overflow: hidden;
|
|
5574
5579
|
`, n.dataset.isReady = "false", i.execute("item.onBeforeContainerCreated", void 0, { element: n }), n;
|
|
5575
|
-
},
|
|
5580
|
+
}, rs = O.namespace("spine"), as = ({
|
|
5576
5581
|
position: e,
|
|
5577
5582
|
pageSize: t
|
|
5578
|
-
}) => new
|
|
5583
|
+
}) => new hn({
|
|
5579
5584
|
...e,
|
|
5580
5585
|
left: e.x,
|
|
5581
5586
|
top: e.y,
|
|
@@ -5584,13 +5589,13 @@ const cs = (e, t, i) => {
|
|
|
5584
5589
|
bottom: e.y + t.height,
|
|
5585
5590
|
right: e.x + t.width
|
|
5586
5591
|
});
|
|
5587
|
-
class
|
|
5588
|
-
constructor(t, i, n, o, s,
|
|
5589
|
-
super({ pages: [] }), this.spineLayout = t, this.spineItemsManager = i, this.spineItemLocator = n, this.context = o, this.locator = s, this.viewport =
|
|
5590
|
-
(u) => u.itemIndex ===
|
|
5591
|
-
), this.layout$ = t.layout$.pipe(
|
|
5592
|
-
A(
|
|
5593
|
-
P(([, { pageSize:
|
|
5592
|
+
class cs extends ht {
|
|
5593
|
+
constructor(t, i, n, o, s, a) {
|
|
5594
|
+
super({ pages: [] }), this.spineLayout = t, this.spineItemsManager = i, this.spineItemLocator = n, this.context = o, this.locator = s, this.viewport = a, this.fromSpineItemPageIndex = (r, c) => this.value.pages.find(
|
|
5595
|
+
(u) => u.itemIndex === r.index && u.pageIndex === c
|
|
5596
|
+
), this.fromAbsolutePageIndex = (r) => this.value.pages.reduce((c, u) => c || (u.absolutePageIndex === r ? u : c), void 0), this.observeFromAbsolutePageIndex = (r) => this.pipe(S(() => this.fromAbsolutePageIndex(r))), this.layout$ = t.layout$.pipe(
|
|
5597
|
+
A(a),
|
|
5598
|
+
P(([, { pageSize: r }]) => {
|
|
5594
5599
|
const c = i.items.reduce(
|
|
5595
5600
|
(d, g, l) => {
|
|
5596
5601
|
const p = new Array(g.numberOfPages).fill(void 0).map((m, y) => {
|
|
@@ -5602,17 +5607,17 @@ class gs extends pt {
|
|
|
5602
5607
|
spineItemPosition: f
|
|
5603
5608
|
});
|
|
5604
5609
|
return {
|
|
5605
|
-
absoluteLayout:
|
|
5606
|
-
pageSize:
|
|
5610
|
+
absoluteLayout: as({
|
|
5611
|
+
pageSize: r,
|
|
5607
5612
|
position: b
|
|
5608
5613
|
}),
|
|
5609
|
-
layout: new
|
|
5614
|
+
layout: new pn({
|
|
5610
5615
|
left: f.x,
|
|
5611
|
-
right: f.x +
|
|
5616
|
+
right: f.x + r.width,
|
|
5612
5617
|
top: f.y,
|
|
5613
|
-
bottom: f.y +
|
|
5614
|
-
width:
|
|
5615
|
-
height:
|
|
5618
|
+
bottom: f.y + r.height,
|
|
5619
|
+
width: r.width,
|
|
5620
|
+
height: r.height,
|
|
5616
5621
|
x: f.x,
|
|
5617
5622
|
y: f.y
|
|
5618
5623
|
}),
|
|
@@ -5634,7 +5639,7 @@ class gs extends pt {
|
|
|
5634
5639
|
const p = (y = d.spineItem.renderer) == null ? void 0 : y.getDocumentFrame();
|
|
5635
5640
|
let m;
|
|
5636
5641
|
p && ((f = p == null ? void 0 : p.contentWindow) != null && f.document) && // very important because it is being used by next functions
|
|
5637
|
-
p.contentWindow.document.body !== null && (m =
|
|
5642
|
+
p.contentWindow.document.body !== null && (m = Mi(
|
|
5638
5643
|
p.contentWindow.document,
|
|
5639
5644
|
d.layout
|
|
5640
5645
|
)), h.next({ ...l, firstVisibleNode: m });
|
|
@@ -5642,17 +5647,17 @@ class gs extends pt {
|
|
|
5642
5647
|
})
|
|
5643
5648
|
);
|
|
5644
5649
|
}),
|
|
5645
|
-
S((
|
|
5650
|
+
S((r) => (rs.info("Pages layout", r), { pages: r })),
|
|
5646
5651
|
V()
|
|
5647
5652
|
), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
|
|
5648
5653
|
}
|
|
5649
5654
|
}
|
|
5650
|
-
class
|
|
5655
|
+
class us extends X {
|
|
5651
5656
|
constructor(t, i) {
|
|
5652
5657
|
super(), this.spineItemsManager = t, this.spineLocator = i, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
|
|
5653
5658
|
P((n) => {
|
|
5654
5659
|
const o = n.map(
|
|
5655
|
-
(s) => s.isReady$.pipe(S((
|
|
5660
|
+
(s) => s.isReady$.pipe(S((a) => ({ item: s, isReady: a })))
|
|
5656
5661
|
);
|
|
5657
5662
|
return v(...o);
|
|
5658
5663
|
}),
|
|
@@ -5661,7 +5666,7 @@ class ls extends X {
|
|
|
5661
5666
|
P((n) => {
|
|
5662
5667
|
const o = n.map(
|
|
5663
5668
|
(s) => Kt(s.element).pipe(
|
|
5664
|
-
S((
|
|
5669
|
+
S((a) => ({ entries: a, item: s }))
|
|
5665
5670
|
)
|
|
5666
5671
|
);
|
|
5667
5672
|
return v(...o);
|
|
@@ -5677,25 +5682,25 @@ class ls extends X {
|
|
|
5677
5682
|
);
|
|
5678
5683
|
}
|
|
5679
5684
|
}
|
|
5680
|
-
const
|
|
5685
|
+
const ds = ({
|
|
5681
5686
|
horizontalOffset: e,
|
|
5682
5687
|
verticalOffset: t,
|
|
5683
5688
|
context: i,
|
|
5684
5689
|
spineItemsManager: n,
|
|
5685
5690
|
isGloballyPrePaginated: o,
|
|
5686
5691
|
settings: s,
|
|
5687
|
-
index:
|
|
5688
|
-
item:
|
|
5692
|
+
index: a,
|
|
5693
|
+
item: r,
|
|
5689
5694
|
viewport: c
|
|
5690
5695
|
}) => {
|
|
5691
5696
|
let u = i.getPageSize().width, d = "none";
|
|
5692
|
-
const g = e % c.absoluteViewport.width === 0, l =
|
|
5697
|
+
const g = e % c.absoluteViewport.width === 0, l = a === n.items.length - 1;
|
|
5693
5698
|
if (i.state.isUsingSpreadMode) {
|
|
5694
|
-
!o &&
|
|
5699
|
+
!o && r.renditionLayout === "reflowable" && !l && (u = i.getPageSize().width * 2), !o && r.renditionLayout === "reflowable" && l && g && (u = i.getPageSize().width * 2);
|
|
5695
5700
|
const p = g && l && o;
|
|
5696
|
-
|
|
5701
|
+
r.item.pageSpreadRight && g && !i.isRTL() || r.item.pageSpreadLeft && g && i.isRTL() ? (d = "before", u = i.getPageSize().width * 2) : p && (i.isRTL() ? d = "before" : d = "after", u = i.getPageSize().width * 2);
|
|
5697
5702
|
}
|
|
5698
|
-
return
|
|
5703
|
+
return r.layout.layout({
|
|
5699
5704
|
minimumWidth: u,
|
|
5700
5705
|
blankPagePosition: d,
|
|
5701
5706
|
spreadPosition: i.state.isUsingSpreadMode ? g ? i.isRTL() ? "right" : "left" : i.isRTL() ? "left" : "right" : "none"
|
|
@@ -5703,10 +5708,10 @@ const ps = ({
|
|
|
5703
5708
|
S(({ width: p, height: m }) => {
|
|
5704
5709
|
if (s.values.computedPageTurnDirection === "vertical") {
|
|
5705
5710
|
const b = g ? t : t - i.state.visibleAreaRect.height, I = g ? 0 : e;
|
|
5706
|
-
i.isRTL() ?
|
|
5711
|
+
i.isRTL() ? r.layout.adjustPositionOfElement({
|
|
5707
5712
|
top: b,
|
|
5708
5713
|
left: I
|
|
5709
|
-
}) :
|
|
5714
|
+
}) : r.layout.adjustPositionOfElement({
|
|
5710
5715
|
top: b,
|
|
5711
5716
|
left: I
|
|
5712
5717
|
});
|
|
@@ -5726,7 +5731,7 @@ const ps = ({
|
|
|
5726
5731
|
layoutPosition: C
|
|
5727
5732
|
};
|
|
5728
5733
|
}
|
|
5729
|
-
|
|
5734
|
+
r.layout.adjustPositionOfElement(
|
|
5730
5735
|
i.isRTL() ? { right: e, top: 0 } : { left: e, top: 0 }
|
|
5731
5736
|
);
|
|
5732
5737
|
const y = i.isRTL() ? c.absoluteViewport.width - e - p : e, f = new Ht({
|
|
@@ -5747,20 +5752,20 @@ const ps = ({
|
|
|
5747
5752
|
})
|
|
5748
5753
|
);
|
|
5749
5754
|
};
|
|
5750
|
-
class
|
|
5755
|
+
class gs extends X {
|
|
5751
5756
|
constructor(t, i, n, o) {
|
|
5752
5757
|
super(), this.spineItemsManager = t, this.context = i, this.settings = n, this.viewport = o, this.layoutSubject = new W(), this.spineItemsRelativeLayouts = [], t.items$.pipe(
|
|
5753
5758
|
$(() => {
|
|
5754
5759
|
this.spineItemsRelativeLayouts = [];
|
|
5755
5760
|
}),
|
|
5756
|
-
P((
|
|
5757
|
-
const
|
|
5761
|
+
P((a) => {
|
|
5762
|
+
const r = a.map(
|
|
5758
5763
|
(u) => u.needsLayout$.pipe(
|
|
5759
5764
|
$(() => {
|
|
5760
5765
|
this.layout();
|
|
5761
5766
|
})
|
|
5762
5767
|
)
|
|
5763
|
-
), c =
|
|
5768
|
+
), c = a.map(
|
|
5764
5769
|
(u) => u.loaded$.pipe(
|
|
5765
5770
|
$(() => {
|
|
5766
5771
|
u.isUsingVerticalWriting() ? this.context.update({
|
|
@@ -5771,7 +5776,7 @@ class hs extends X {
|
|
|
5771
5776
|
})
|
|
5772
5777
|
)
|
|
5773
5778
|
);
|
|
5774
|
-
return v(...
|
|
5779
|
+
return v(...r, ...c);
|
|
5775
5780
|
})
|
|
5776
5781
|
).pipe(T(this.destroy$)).subscribe();
|
|
5777
5782
|
const s = new U(!1);
|
|
@@ -5780,22 +5785,22 @@ class hs extends X {
|
|
|
5780
5785
|
// queue layout until previous layout is done
|
|
5781
5786
|
Wt(
|
|
5782
5787
|
() => s.pipe(
|
|
5783
|
-
M((
|
|
5788
|
+
M((a) => !a),
|
|
5784
5789
|
z()
|
|
5785
5790
|
)
|
|
5786
5791
|
),
|
|
5787
5792
|
Wt(() => {
|
|
5788
5793
|
s.next(!0);
|
|
5789
|
-
const
|
|
5794
|
+
const a = this.context.manifest, r = Ee(a) ?? !1;
|
|
5790
5795
|
return j(this.spineItemsManager.items).pipe(
|
|
5791
5796
|
ai(
|
|
5792
5797
|
(u, d, g) => u.pipe(
|
|
5793
5798
|
oe(
|
|
5794
|
-
({ horizontalOffset: l, verticalOffset: h }) =>
|
|
5799
|
+
({ horizontalOffset: l, verticalOffset: h }) => ds({
|
|
5795
5800
|
context: this.context,
|
|
5796
5801
|
horizontalOffset: l,
|
|
5797
5802
|
index: g,
|
|
5798
|
-
isGloballyPrePaginated:
|
|
5803
|
+
isGloballyPrePaginated: r,
|
|
5799
5804
|
item: d,
|
|
5800
5805
|
settings: this.settings,
|
|
5801
5806
|
spineItemsManager: this.spineItemsManager,
|
|
@@ -5849,10 +5854,10 @@ class hs extends X {
|
|
|
5849
5854
|
super.destroy(), this.layoutSubject.complete();
|
|
5850
5855
|
}
|
|
5851
5856
|
}
|
|
5852
|
-
class
|
|
5857
|
+
class ls extends X {
|
|
5853
5858
|
constructor(t, i, n, o, s) {
|
|
5854
5859
|
super(), this.context = t, this.spineItemsManager = i, this.spineLocator = n, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new U([]);
|
|
5855
|
-
const
|
|
5860
|
+
const a = this.forcedOpenSubject.pipe(
|
|
5856
5861
|
S((u) => [...new Set(u.flat())].sort()),
|
|
5857
5862
|
H(gi),
|
|
5858
5863
|
tt({ bufferSize: 1, refCount: !0 })
|
|
@@ -5860,7 +5865,7 @@ class ms extends X {
|
|
|
5860
5865
|
v(
|
|
5861
5866
|
this.context.bridgeEvent.navigation$,
|
|
5862
5867
|
this.spineLayout.layout$,
|
|
5863
|
-
|
|
5868
|
+
a,
|
|
5864
5869
|
o.watch(["numberOfAdjacentSpineItemToPreLoad"])
|
|
5865
5870
|
).pipe(
|
|
5866
5871
|
// this can be changed by whatever we want and SHOULD not break navigation.
|
|
@@ -5868,13 +5873,13 @@ class ms extends X {
|
|
|
5868
5873
|
// be dangerous.
|
|
5869
5874
|
St(100, rt),
|
|
5870
5875
|
Ct(this.context.bridgeEvent.viewportFree$),
|
|
5871
|
-
A(this.context.bridgeEvent.navigation$,
|
|
5876
|
+
A(this.context.bridgeEvent.navigation$, a),
|
|
5872
5877
|
S(([, u, d]) => {
|
|
5873
5878
|
const { numberOfAdjacentSpineItemToPreLoad: g } = o.values, { beginIndex: l = 0, endIndex: h = 0 } = n.getVisibleSpineItemsFromPosition({
|
|
5874
5879
|
position: u.position,
|
|
5875
5880
|
threshold: { type: "percentage", value: 0 },
|
|
5876
5881
|
useAbsoluteViewport: !1
|
|
5877
|
-
}) || {}, p = l - g, m = h + g, y = Array.from(
|
|
5882
|
+
}) || {}, p = g === 1 / 0 ? 0 : l - g, m = g === 1 / 0 ? i.items.length - 1 : h + g, y = Array.from(
|
|
5878
5883
|
{ length: m - p + 1 },
|
|
5879
5884
|
(b, I) => p + I
|
|
5880
5885
|
), f = [...d, ...y];
|
|
@@ -5925,17 +5930,17 @@ class yt extends DOMRect {
|
|
|
5925
5930
|
return new yt(n.x, n.y, n.width, n.height);
|
|
5926
5931
|
}
|
|
5927
5932
|
}
|
|
5928
|
-
class
|
|
5933
|
+
class ps {
|
|
5929
5934
|
constructor({ width: t, height: i }) {
|
|
5930
5935
|
this.__symbol = Symbol("AbsoluteViewport"), this.width = t, this.height = i;
|
|
5931
5936
|
}
|
|
5932
5937
|
}
|
|
5933
|
-
class
|
|
5938
|
+
class hs {
|
|
5934
5939
|
constructor({ width: t, height: i }) {
|
|
5935
5940
|
this.__symbol = Symbol("RelativeViewport"), this.width = t, this.height = i;
|
|
5936
5941
|
}
|
|
5937
5942
|
}
|
|
5938
|
-
const
|
|
5943
|
+
const ms = ({
|
|
5939
5944
|
pageIndex: e,
|
|
5940
5945
|
spineItemOrId: t,
|
|
5941
5946
|
spineItemsManager: i
|
|
@@ -5943,30 +5948,30 @@ const Ss = ({
|
|
|
5943
5948
|
const n = i.items, o = i.get(t);
|
|
5944
5949
|
if (!o) return;
|
|
5945
5950
|
const { currentAbsolutePage: s } = n.reduce(
|
|
5946
|
-
(
|
|
5947
|
-
if (
|
|
5948
|
-
const c =
|
|
5949
|
-
return o ===
|
|
5950
|
-
currentAbsolutePage:
|
|
5951
|
+
(a, r) => {
|
|
5952
|
+
if (a.found) return a;
|
|
5953
|
+
const c = r.numberOfPages;
|
|
5954
|
+
return o === r && e <= c - 1 ? {
|
|
5955
|
+
currentAbsolutePage: a.currentAbsolutePage + e,
|
|
5951
5956
|
found: !0
|
|
5952
5957
|
} : {
|
|
5953
|
-
...
|
|
5954
|
-
currentAbsolutePage:
|
|
5958
|
+
...a,
|
|
5959
|
+
currentAbsolutePage: a.currentAbsolutePage + c
|
|
5955
5960
|
};
|
|
5956
5961
|
},
|
|
5957
5962
|
{ currentAbsolutePage: 0, found: !1 }
|
|
5958
5963
|
);
|
|
5959
5964
|
return s;
|
|
5960
|
-
},
|
|
5965
|
+
}, fs = ({
|
|
5961
5966
|
itemHeight: e,
|
|
5962
5967
|
itemWidth: t,
|
|
5963
5968
|
visibleWidthOfItem: i,
|
|
5964
5969
|
visibleHeightOfItem: n,
|
|
5965
5970
|
threshold: o
|
|
5966
5971
|
}) => {
|
|
5967
|
-
const s = i / t,
|
|
5968
|
-
return o.type === "percentage" ? s >= o.value &&
|
|
5969
|
-
},
|
|
5972
|
+
const s = i / t, a = n / e;
|
|
5973
|
+
return o.type === "percentage" ? s >= o.value && a >= o.value : i >= o.value && n >= o.value;
|
|
5974
|
+
}, ys = ({
|
|
5970
5975
|
visibleWidthOfItem: e,
|
|
5971
5976
|
visibleHeightOfItem: t,
|
|
5972
5977
|
threshold: i,
|
|
@@ -5983,12 +5988,12 @@ const Ss = ({
|
|
|
5983
5988
|
width: o,
|
|
5984
5989
|
height: s
|
|
5985
5990
|
},
|
|
5986
|
-
threshold:
|
|
5987
|
-
viewportPosition:
|
|
5991
|
+
threshold: a,
|
|
5992
|
+
viewportPosition: r,
|
|
5988
5993
|
restrictToScreen: c
|
|
5989
5994
|
}) => {
|
|
5990
|
-
const u =
|
|
5991
|
-
|
|
5995
|
+
const u = r.x, d = r.x + (r.width - 1), g = r.y, l = Math.max(
|
|
5996
|
+
r.y + (r.height - 1),
|
|
5992
5997
|
0
|
|
5993
5998
|
), h = Math.max(
|
|
5994
5999
|
0,
|
|
@@ -5998,54 +6003,28 @@ const Ss = ({
|
|
|
5998
6003
|
Math.min(e, l) - Math.max(n, g)
|
|
5999
6004
|
);
|
|
6000
6005
|
if (h <= 0 || p <= 0) return { visible: !1 };
|
|
6001
|
-
const y =
|
|
6002
|
-
threshold:
|
|
6006
|
+
const y = ys({
|
|
6007
|
+
threshold: a,
|
|
6003
6008
|
visibleHeightOfItem: p,
|
|
6004
6009
|
visibleWidthOfItem: h,
|
|
6005
|
-
viewportPosition:
|
|
6010
|
+
viewportPosition: r
|
|
6006
6011
|
});
|
|
6007
6012
|
return c ? { visible: y } : {
|
|
6008
|
-
visible:
|
|
6013
|
+
visible: fs({
|
|
6009
6014
|
itemHeight: s,
|
|
6010
6015
|
itemWidth: o,
|
|
6011
|
-
threshold:
|
|
6016
|
+
threshold: a,
|
|
6012
6017
|
visibleHeightOfItem: p,
|
|
6013
6018
|
visibleWidthOfItem: h
|
|
6014
6019
|
}) || y
|
|
6015
6020
|
};
|
|
6016
|
-
}, ws = ({
|
|
6017
|
-
absolutePageIndex: e,
|
|
6018
|
-
spineItemsManager: t
|
|
6019
|
-
}) => {
|
|
6020
|
-
const i = t.items, { found: n, currentAbsolutePage: o } = i.reduce(
|
|
6021
|
-
(s, r) => {
|
|
6022
|
-
if (s.found) return s;
|
|
6023
|
-
const a = r.numberOfPages, c = e - s.currentAbsolutePage, u = s.currentAbsolutePage + a;
|
|
6024
|
-
return c <= a - 1 ? {
|
|
6025
|
-
...s,
|
|
6026
|
-
currentAbsolutePage: u,
|
|
6027
|
-
found: { item: r, pageIndex: c }
|
|
6028
|
-
} : {
|
|
6029
|
-
...s,
|
|
6030
|
-
currentAbsolutePage: u
|
|
6031
|
-
};
|
|
6032
|
-
},
|
|
6033
|
-
{ currentAbsolutePage: 0 }
|
|
6034
|
-
);
|
|
6035
|
-
if (n)
|
|
6036
|
-
return {
|
|
6037
|
-
spineItem: n.item,
|
|
6038
|
-
pageIndex: n.pageIndex,
|
|
6039
|
-
itemIndex: t.getSpineItemIndex(n.item) ?? 0,
|
|
6040
|
-
currentAbsolutePage: o
|
|
6041
|
-
};
|
|
6042
6021
|
}, Yt = ({
|
|
6043
6022
|
position: e,
|
|
6044
6023
|
spineItemsManager: t,
|
|
6045
6024
|
spineLayout: i
|
|
6046
6025
|
}) => {
|
|
6047
6026
|
const n = t.items.find((o) => {
|
|
6048
|
-
const { left: s, right:
|
|
6027
|
+
const { left: s, right: a, bottom: r, top: c } = i.getSpineItemSpineLayoutInfo(o), u = e.x >= s && e.x < a, d = e.y >= c && e.y < r;
|
|
6049
6028
|
return u && d;
|
|
6050
6029
|
});
|
|
6051
6030
|
return e.x === 0 && !n ? t.items[0] : n;
|
|
@@ -6055,24 +6034,24 @@ const Ss = ({
|
|
|
6055
6034
|
}) => new L({
|
|
6056
6035
|
x: t + e.x,
|
|
6057
6036
|
y: i + e.y
|
|
6058
|
-
}),
|
|
6037
|
+
}), Ss = ({
|
|
6059
6038
|
position: e,
|
|
6060
6039
|
threshold: t,
|
|
6061
6040
|
restrictToScreen: i,
|
|
6062
6041
|
spineItemsManager: n,
|
|
6063
6042
|
spineLayout: o,
|
|
6064
6043
|
useAbsoluteViewport: s = !0,
|
|
6065
|
-
viewport:
|
|
6044
|
+
viewport: a
|
|
6066
6045
|
}) => {
|
|
6067
|
-
const
|
|
6046
|
+
const r = Yt({
|
|
6068
6047
|
position: e,
|
|
6069
6048
|
spineItemsManager: n,
|
|
6070
6049
|
spineLayout: o
|
|
6071
6050
|
}) || n.get(0), c = n.items.reduce(
|
|
6072
6051
|
(h, p) => {
|
|
6073
|
-
const m = o.getSpineItemSpineLayoutInfo(p), y = s ?
|
|
6052
|
+
const m = o.getSpineItemSpineLayoutInfo(p), y = s ? a.absoluteViewport : a.relativeViewport, f = Ge(
|
|
6074
6053
|
e,
|
|
6075
|
-
|
|
6054
|
+
a.absoluteViewport,
|
|
6076
6055
|
y
|
|
6077
6056
|
), b = yt.from(
|
|
6078
6057
|
f,
|
|
@@ -6086,14 +6065,14 @@ const Ss = ({
|
|
|
6086
6065
|
return I ? [...h, p] : h;
|
|
6087
6066
|
},
|
|
6088
6067
|
[]
|
|
6089
|
-
), u = c[0] ??
|
|
6068
|
+
), u = c[0] ?? r, d = c[c.length - 1] ?? u;
|
|
6090
6069
|
if (!u || !d) return;
|
|
6091
6070
|
const g = n.getSpineItemIndex(u), l = n.getSpineItemIndex(d);
|
|
6092
6071
|
return {
|
|
6093
6072
|
beginIndex: g ?? 0,
|
|
6094
6073
|
endIndex: l ?? 0
|
|
6095
6074
|
};
|
|
6096
|
-
},
|
|
6075
|
+
}, bs = ({
|
|
6097
6076
|
spineItemsManager: e,
|
|
6098
6077
|
context: t,
|
|
6099
6078
|
spineItemLocator: i,
|
|
@@ -6101,7 +6080,7 @@ const Ss = ({
|
|
|
6101
6080
|
spineLayout: o,
|
|
6102
6081
|
viewport: s
|
|
6103
6082
|
}) => {
|
|
6104
|
-
const
|
|
6083
|
+
const a = (p, m) => {
|
|
6105
6084
|
const { left: y, top: f } = o.getSpineItemSpineLayoutInfo(m);
|
|
6106
6085
|
return new R({
|
|
6107
6086
|
/**
|
|
@@ -6114,7 +6093,7 @@ const Ss = ({
|
|
|
6114
6093
|
x: Math.max(p.x - y, 0),
|
|
6115
6094
|
y: Math.max(p.y - f, 0)
|
|
6116
6095
|
});
|
|
6117
|
-
},
|
|
6096
|
+
}, r = (p) => jt({
|
|
6118
6097
|
spineItemPosition: new R({ x: 0, y: 0 }),
|
|
6119
6098
|
itemLayout: o.getSpineItemSpineLayoutInfo(p)
|
|
6120
6099
|
}), c = (p) => e.items.find((m) => m.renderer.getDocumentFrame() === p), u = (p, m, y) => {
|
|
@@ -6197,11 +6176,7 @@ const Ss = ({
|
|
|
6197
6176
|
/**
|
|
6198
6177
|
* @deprecated use Pages
|
|
6199
6178
|
*/
|
|
6200
|
-
_getAbsolutePageIndexFromPageIndex: (p) =>
|
|
6201
|
-
...p,
|
|
6202
|
-
spineItemsManager: e
|
|
6203
|
-
}),
|
|
6204
|
-
getSpineInfoFromAbsolutePageIndex: (p) => ws({
|
|
6179
|
+
_getAbsolutePageIndexFromPageIndex: (p) => ms({
|
|
6205
6180
|
...p,
|
|
6206
6181
|
spineItemsManager: e
|
|
6207
6182
|
}),
|
|
@@ -6213,7 +6188,7 @@ const Ss = ({
|
|
|
6213
6188
|
});
|
|
6214
6189
|
if (!m)
|
|
6215
6190
|
return;
|
|
6216
|
-
const y =
|
|
6191
|
+
const y = a(
|
|
6217
6192
|
p,
|
|
6218
6193
|
m
|
|
6219
6194
|
), f = i.getSpineItemPageIndexFromPosition({
|
|
@@ -6233,8 +6208,8 @@ const Ss = ({
|
|
|
6233
6208
|
pageSize: s.value.pageSize
|
|
6234
6209
|
};
|
|
6235
6210
|
},
|
|
6236
|
-
getSpinePositionFromSpineItem:
|
|
6237
|
-
getSpineItemPositionFromSpinePosition:
|
|
6211
|
+
getSpinePositionFromSpineItem: r,
|
|
6212
|
+
getSpineItemPositionFromSpinePosition: a,
|
|
6238
6213
|
getSpineItemFromPosition: (p) => Yt({
|
|
6239
6214
|
position: p,
|
|
6240
6215
|
spineItemsManager: e,
|
|
@@ -6242,7 +6217,7 @@ const Ss = ({
|
|
|
6242
6217
|
}),
|
|
6243
6218
|
getSpineItemFromIframe: c,
|
|
6244
6219
|
getSpineItemPageIndexFromNode: u,
|
|
6245
|
-
getVisibleSpineItemsFromPosition: (p) =>
|
|
6220
|
+
getVisibleSpineItemsFromPosition: (p) => Ss({
|
|
6246
6221
|
spineItemsManager: e,
|
|
6247
6222
|
spineLayout: o,
|
|
6248
6223
|
viewport: s,
|
|
@@ -6266,32 +6241,32 @@ const Ss = ({
|
|
|
6266
6241
|
}
|
|
6267
6242
|
};
|
|
6268
6243
|
};
|
|
6269
|
-
class
|
|
6270
|
-
constructor(t, i, n, o, s,
|
|
6271
|
-
super(), this.parentElement$ = t, this.context = i, this.pagination = n, this.spineItemsManager = o, this.spineItemLocator = s, this.settings =
|
|
6244
|
+
class Is extends X {
|
|
6245
|
+
constructor(t, i, n, o, s, a, r, c) {
|
|
6246
|
+
super(), this.parentElement$ = t, this.context = i, this.pagination = n, this.spineItemsManager = o, this.spineItemLocator = s, this.settings = a, this.hookManager = r, this.viewport = c, this.elementSubject = new U(
|
|
6272
6247
|
void 0
|
|
6273
|
-
), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new
|
|
6248
|
+
), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new gs(
|
|
6274
6249
|
o,
|
|
6275
6250
|
i,
|
|
6276
|
-
|
|
6251
|
+
a,
|
|
6277
6252
|
c
|
|
6278
|
-
), this.locator =
|
|
6253
|
+
), this.locator = bs({
|
|
6279
6254
|
context: i,
|
|
6280
6255
|
spineItemsManager: o,
|
|
6281
6256
|
spineItemLocator: s,
|
|
6282
|
-
settings:
|
|
6257
|
+
settings: a,
|
|
6283
6258
|
spineLayout: this.spineLayout,
|
|
6284
6259
|
viewport: c
|
|
6285
|
-
}), this.spineItemsLoader = new
|
|
6260
|
+
}), this.spineItemsLoader = new ls(
|
|
6286
6261
|
this.context,
|
|
6287
6262
|
o,
|
|
6288
6263
|
this.locator,
|
|
6289
|
-
|
|
6264
|
+
a,
|
|
6290
6265
|
this.spineLayout
|
|
6291
|
-
), this.spineItemsObserver = new
|
|
6266
|
+
), this.spineItemsObserver = new us(
|
|
6292
6267
|
o,
|
|
6293
6268
|
this.locator
|
|
6294
|
-
), this.pages = new
|
|
6269
|
+
), this.pages = new cs(
|
|
6295
6270
|
this.spineLayout,
|
|
6296
6271
|
this.spineItemsManager,
|
|
6297
6272
|
this.spineItemLocator,
|
|
@@ -6306,7 +6281,7 @@ class xs extends X {
|
|
|
6306
6281
|
l.style.cssText = `
|
|
6307
6282
|
height: 100%;
|
|
6308
6283
|
position: relative;
|
|
6309
|
-
`, l.className = `${
|
|
6284
|
+
`, l.className = `${pt}-spine`, this.elementSubject.next(l);
|
|
6310
6285
|
})
|
|
6311
6286
|
), d = B([
|
|
6312
6287
|
this.context.manifest$,
|
|
@@ -6347,7 +6322,7 @@ class xs extends X {
|
|
|
6347
6322
|
super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), (t = this.elementSubject.getValue()) == null || t.remove(), this.elementSubject.complete();
|
|
6348
6323
|
}
|
|
6349
6324
|
}
|
|
6350
|
-
class
|
|
6325
|
+
class ws extends X {
|
|
6351
6326
|
constructor(t, i) {
|
|
6352
6327
|
super(), this.context = t, this.settings = i, this.orderedSpineItemsSubject = new U([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
|
|
6353
6328
|
}
|
|
@@ -6388,7 +6363,7 @@ class $s extends X {
|
|
|
6388
6363
|
this.orderedSpineItemsSubject.value.forEach((t) => t.destroy());
|
|
6389
6364
|
}
|
|
6390
6365
|
}
|
|
6391
|
-
class
|
|
6366
|
+
class Ps extends ht {
|
|
6392
6367
|
constructor(t) {
|
|
6393
6368
|
const i = document.createElement("div");
|
|
6394
6369
|
i.style.cssText = `
|
|
@@ -6397,7 +6372,7 @@ class Ts extends pt {
|
|
|
6397
6372
|
-transform: scale(0.2);
|
|
6398
6373
|
height: 100%;
|
|
6399
6374
|
width: 100%;
|
|
6400
|
-
`, i.className = `${
|
|
6375
|
+
`, i.className = `${pt}-viewport`, super({
|
|
6401
6376
|
element: i,
|
|
6402
6377
|
pageSize: {
|
|
6403
6378
|
width: 1,
|
|
@@ -6422,7 +6397,7 @@ class Ts extends pt {
|
|
|
6422
6397
|
}
|
|
6423
6398
|
get absoluteViewport() {
|
|
6424
6399
|
const t = this.context.state.visibleAreaRect;
|
|
6425
|
-
return new
|
|
6400
|
+
return new ps({
|
|
6426
6401
|
width: t.width,
|
|
6427
6402
|
height: t.height
|
|
6428
6403
|
});
|
|
@@ -6443,36 +6418,36 @@ class Ts extends pt {
|
|
|
6443
6418
|
*/
|
|
6444
6419
|
get relativeViewport() {
|
|
6445
6420
|
const t = this.absoluteViewport, i = this.value.element.getBoundingClientRect(), n = ((i == null ? void 0 : i.width) ?? t.width) / t.width;
|
|
6446
|
-
return new
|
|
6421
|
+
return new hs({
|
|
6447
6422
|
width: t.width / n,
|
|
6448
6423
|
height: t.height / n
|
|
6449
6424
|
});
|
|
6450
6425
|
}
|
|
6451
6426
|
}
|
|
6452
|
-
const
|
|
6453
|
-
const t = new W(), i = new
|
|
6427
|
+
const vs = (e) => {
|
|
6428
|
+
const t = new W(), i = new bo(), n = new yo(), o = new is(e, n), s = new So(n, o), a = new ws(n, o), r = new Ps(n), c = n.watch("rootElement"), u = qe({
|
|
6454
6429
|
context: n,
|
|
6455
6430
|
settings: o
|
|
6456
|
-
}), d = new
|
|
6431
|
+
}), d = new Qo(n, a), g = new Is(
|
|
6457
6432
|
c,
|
|
6458
6433
|
n,
|
|
6459
6434
|
d,
|
|
6460
|
-
|
|
6435
|
+
a,
|
|
6461
6436
|
u,
|
|
6462
6437
|
o,
|
|
6463
6438
|
i,
|
|
6464
|
-
|
|
6465
|
-
), l =
|
|
6439
|
+
r
|
|
6440
|
+
), l = Ko({
|
|
6466
6441
|
context: n,
|
|
6467
|
-
spineItemsManager:
|
|
6442
|
+
spineItemsManager: a,
|
|
6468
6443
|
hookManager: i,
|
|
6469
6444
|
spine: g,
|
|
6470
6445
|
settings: o,
|
|
6471
|
-
viewport:
|
|
6472
|
-
}), h = new
|
|
6446
|
+
viewport: r
|
|
6447
|
+
}), h = new ts(
|
|
6473
6448
|
n,
|
|
6474
6449
|
d,
|
|
6475
|
-
|
|
6450
|
+
a,
|
|
6476
6451
|
g,
|
|
6477
6452
|
u
|
|
6478
6453
|
);
|
|
@@ -6503,31 +6478,31 @@ const Fs = (e) => {
|
|
|
6503
6478
|
return;
|
|
6504
6479
|
}
|
|
6505
6480
|
O.log("load", { options: f });
|
|
6506
|
-
const x =
|
|
6481
|
+
const x = xs(b);
|
|
6507
6482
|
n.update({
|
|
6508
6483
|
manifest: I,
|
|
6509
6484
|
rootElement: x,
|
|
6510
6485
|
forceSinglePageMode: o.values.forceSinglePageMode
|
|
6511
6486
|
}), p();
|
|
6512
6487
|
}, y = () => {
|
|
6513
|
-
|
|
6488
|
+
a.destroy(), h.destroy(), o.destroy(), d.destroy(), n.destroy(), l.destroy(), g.destroy(), s.destroy(), t.next(), t.complete(), r.destroy();
|
|
6514
6489
|
};
|
|
6515
6490
|
return {
|
|
6516
6491
|
context: n,
|
|
6517
6492
|
spine: g,
|
|
6518
6493
|
hookManager: i,
|
|
6519
6494
|
cfi: {
|
|
6520
|
-
generateCfiFromRange:
|
|
6495
|
+
generateCfiFromRange: kn,
|
|
6521
6496
|
parseCfi: ee,
|
|
6522
6497
|
generateCfiForSpineItemPage: (f) => Bt({
|
|
6523
6498
|
...f,
|
|
6524
6499
|
spine: g
|
|
6525
6500
|
}),
|
|
6526
|
-
resolveCfi: (f) => ze({ ...f, spineItemsManager:
|
|
6501
|
+
resolveCfi: (f) => ze({ ...f, spineItemsManager: a })
|
|
6527
6502
|
},
|
|
6528
6503
|
navigation: l,
|
|
6529
6504
|
spineItemsObserver: g.spineItemsObserver,
|
|
6530
|
-
spineItemsManager:
|
|
6505
|
+
spineItemsManager: a,
|
|
6531
6506
|
layout: p,
|
|
6532
6507
|
load: m,
|
|
6533
6508
|
destroy: y,
|
|
@@ -6540,7 +6515,7 @@ const Fs = (e) => {
|
|
|
6540
6515
|
}
|
|
6541
6516
|
},
|
|
6542
6517
|
settings: o,
|
|
6543
|
-
viewport:
|
|
6518
|
+
viewport: r,
|
|
6544
6519
|
element$: c,
|
|
6545
6520
|
viewportState$: n.bridgeEvent.viewportState$,
|
|
6546
6521
|
viewportFree$: n.bridgeEvent.viewportFree$,
|
|
@@ -6558,31 +6533,31 @@ const Fs = (e) => {
|
|
|
6558
6533
|
destroy$: t
|
|
6559
6534
|
}
|
|
6560
6535
|
};
|
|
6561
|
-
},
|
|
6536
|
+
}, xs = (e) => (e.style.cssText = `
|
|
6562
6537
|
${e.style.cssText}
|
|
6563
6538
|
background-color: white;
|
|
6564
6539
|
position: relative;
|
|
6565
|
-
`, e.classList.add(`${
|
|
6540
|
+
`, e.classList.add(`${pt}-reader`), e), Os = (
|
|
6566
6541
|
//__
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6542
|
+
ao(
|
|
6543
|
+
Ei(
|
|
6544
|
+
$n(
|
|
6545
|
+
go(
|
|
6546
|
+
Bi(
|
|
6547
|
+
xi(
|
|
6548
|
+
io(
|
|
6549
|
+
uo(
|
|
6550
|
+
ho(
|
|
6551
|
+
jn(
|
|
6552
|
+
gn(
|
|
6553
|
+
Fn(
|
|
6554
|
+
$i(
|
|
6555
|
+
co(
|
|
6556
|
+
Qn(
|
|
6557
|
+
wn(
|
|
6558
|
+
Ui(
|
|
6584
6559
|
// __
|
|
6585
|
-
|
|
6560
|
+
vs
|
|
6586
6561
|
)
|
|
6587
6562
|
)
|
|
6588
6563
|
)
|
|
@@ -6600,68 +6575,68 @@ const Fs = (e) => {
|
|
|
6600
6575
|
)
|
|
6601
6576
|
)
|
|
6602
6577
|
)
|
|
6603
|
-
),
|
|
6578
|
+
), Vs = (e) => (t) => e(t);
|
|
6604
6579
|
export {
|
|
6605
6580
|
ke as AbstractSpinePosition,
|
|
6606
|
-
|
|
6607
|
-
|
|
6581
|
+
yo as Context,
|
|
6582
|
+
Wo as ControlledNavigationController,
|
|
6608
6583
|
X as DestroyableClass,
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6584
|
+
ft as DocumentRenderer,
|
|
6585
|
+
So as Features,
|
|
6586
|
+
bo as HookManager,
|
|
6587
|
+
Do as InternalNavigator,
|
|
6613
6588
|
te as LayoutEntry,
|
|
6614
6589
|
_e as Locker,
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6590
|
+
cs as Pages,
|
|
6591
|
+
Qo as Pagination,
|
|
6592
|
+
ts as PaginationController,
|
|
6618
6593
|
Qt as ResourceHandler,
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6594
|
+
Hn as ResourcesLocator,
|
|
6595
|
+
Uo as ScrollNavigationController,
|
|
6596
|
+
es as SettingsManager,
|
|
6597
|
+
Is as Spine,
|
|
6623
6598
|
Ze as SpineItem,
|
|
6624
|
-
|
|
6625
|
-
|
|
6599
|
+
pn as SpineItemPageLayout,
|
|
6600
|
+
hn as SpineItemPageSpineLayout,
|
|
6626
6601
|
R as SpineItemPosition,
|
|
6627
6602
|
Ht as SpineItemSpineLayout,
|
|
6628
|
-
|
|
6629
|
-
|
|
6603
|
+
ws as SpineItemsManager,
|
|
6604
|
+
us as SpineItemsObserver,
|
|
6630
6605
|
L as SpinePosition,
|
|
6631
6606
|
Nt as UnsafeSpineItemPagePosition,
|
|
6632
6607
|
Rt as UnsafeSpinePosition,
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6608
|
+
Ps as Viewport,
|
|
6609
|
+
zn as consolidate,
|
|
6610
|
+
Os as createReader,
|
|
6636
6611
|
ae as deferIdle,
|
|
6637
|
-
|
|
6612
|
+
zi as deferNextResult,
|
|
6638
6613
|
Bt as generateCfiForSpineItemPage,
|
|
6639
|
-
|
|
6640
|
-
|
|
6614
|
+
kn as generateCfiFromRange,
|
|
6615
|
+
lt as generateRootCfi,
|
|
6641
6616
|
re as getAttributeValueFromString,
|
|
6642
6617
|
Zt as getFrameViewportInfo,
|
|
6643
|
-
|
|
6644
|
-
|
|
6618
|
+
Ns as getItemAnchor,
|
|
6619
|
+
gn as htmlEnhancer,
|
|
6645
6620
|
De as idle,
|
|
6646
6621
|
wi as injectCSS,
|
|
6647
6622
|
Re as isHtmlElement,
|
|
6648
|
-
|
|
6623
|
+
Oi as isHtmlTagElement,
|
|
6649
6624
|
Et as isRootCfi,
|
|
6650
|
-
|
|
6651
|
-
|
|
6625
|
+
Ws as isShallowEqual,
|
|
6626
|
+
wn as layoutEnhancer,
|
|
6652
6627
|
Ae as mapKeysTo,
|
|
6653
|
-
|
|
6628
|
+
Rs as observeIntersection,
|
|
6654
6629
|
ce as observeMutation,
|
|
6655
6630
|
Kt as observeResize,
|
|
6656
|
-
|
|
6631
|
+
Qn as paginationEnhancer,
|
|
6657
6632
|
ee as parseCfi,
|
|
6658
|
-
|
|
6633
|
+
Cs as removeCSS,
|
|
6659
6634
|
ze as resolveCfi,
|
|
6660
|
-
|
|
6661
|
-
|
|
6635
|
+
Vs as rootEnhancer,
|
|
6636
|
+
as as spinePositionToSpineItemSpineLayout,
|
|
6662
6637
|
nt as upsertCSSToFrame,
|
|
6663
|
-
|
|
6664
|
-
|
|
6638
|
+
Pi as waitForFrameLoad,
|
|
6639
|
+
vi as waitForFrameReady,
|
|
6665
6640
|
Ct as waitForSwitch,
|
|
6666
6641
|
Jt as watchKeys
|
|
6667
6642
|
};
|