@readium/navigator 2.7.0-alpha.2 → 2.7.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +260 -260
- package/dist/index.umd.cjs +17 -17
- package/package.json +3 -3
- package/src/epub/frame/FramePoolManager.ts +7 -13
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const E = class E {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
this.uri = t;
|
|
4
4
|
}
|
|
@@ -7,7 +7,7 @@ const C = class C {
|
|
|
7
7
|
*/
|
|
8
8
|
static deserialize(t) {
|
|
9
9
|
if (!(!t || typeof t != "string"))
|
|
10
|
-
return new
|
|
10
|
+
return new E(t);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Serializes an [AccessibilityProfile] to its RWPM JSON representation.
|
|
@@ -19,23 +19,23 @@ const C = class C {
|
|
|
19
19
|
* Returns true if the profile is a WCAG Level A profile.
|
|
20
20
|
*/
|
|
21
21
|
get isWCAGLevelA() {
|
|
22
|
-
return this ===
|
|
22
|
+
return this === E.EPUB_A11Y_10_WCAG_20_A || this === E.EPUB_A11Y_11_WCAG_20_A || this === E.EPUB_A11Y_11_WCAG_21_A || this === E.EPUB_A11Y_11_WCAG_22_A;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Returns true if the profile is a WCAG Level AA profile.
|
|
26
26
|
*/
|
|
27
27
|
get isWCAGLevelAA() {
|
|
28
|
-
return this ===
|
|
28
|
+
return this === E.EPUB_A11Y_10_WCAG_20_AA || this === E.EPUB_A11Y_11_WCAG_20_AA || this === E.EPUB_A11Y_11_WCAG_21_AA || this === E.EPUB_A11Y_11_WCAG_22_AA;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Returns true if the profile is a WCAG Level AAA profile.
|
|
32
32
|
*/
|
|
33
33
|
get isWCAGLevelAAA() {
|
|
34
|
-
return this ===
|
|
34
|
+
return this === E.EPUB_A11Y_10_WCAG_20_AAA || this === E.EPUB_A11Y_11_WCAG_20_AAA || this === E.EPUB_A11Y_11_WCAG_21_AAA || this === E.EPUB_A11Y_11_WCAG_22_AAA;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
let pi =
|
|
37
|
+
E.EPUB_A11Y_10_WCAG_20_A = new E("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), E.EPUB_A11Y_10_WCAG_20_AA = new E("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), E.EPUB_A11Y_10_WCAG_20_AAA = new E("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), E.EPUB_A11Y_11_WCAG_20_A = new E("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), E.EPUB_A11Y_11_WCAG_20_AA = new E("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), E.EPUB_A11Y_11_WCAG_20_AAA = new E("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), E.EPUB_A11Y_11_WCAG_21_A = new E("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), E.EPUB_A11Y_11_WCAG_21_AA = new E("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), E.EPUB_A11Y_11_WCAG_21_AAA = new E("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), E.EPUB_A11Y_11_WCAG_22_A = new E("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), E.EPUB_A11Y_11_WCAG_22_AA = new E("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), E.EPUB_A11Y_11_WCAG_22_AAA = new E("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
|
|
38
|
+
let pi = E;
|
|
39
39
|
const O = class O {
|
|
40
40
|
constructor(t) {
|
|
41
41
|
this.value = t;
|
|
@@ -338,19 +338,19 @@ class g {
|
|
|
338
338
|
} else
|
|
339
339
|
throw new Error("Invalid media type");
|
|
340
340
|
const r = {};
|
|
341
|
-
for (let
|
|
342
|
-
const f = s[
|
|
341
|
+
for (let p = 1; p < s.length; p++) {
|
|
342
|
+
const f = s[p].split("=");
|
|
343
343
|
if (f.length === 2) {
|
|
344
|
-
const m = f[0].toLocaleLowerCase(),
|
|
345
|
-
r[m] =
|
|
344
|
+
const m = f[0].toLocaleLowerCase(), u = m === "charset" ? f[1].toUpperCase() : f[1];
|
|
345
|
+
r[m] = u;
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
const a = {}, l = Object.keys(r);
|
|
349
|
-
l.sort((
|
|
349
|
+
l.sort((p, f) => p.localeCompare(f)), l.forEach((p) => a[p] = r[p]);
|
|
350
350
|
let c = "";
|
|
351
|
-
for (const
|
|
352
|
-
const f = a[
|
|
353
|
-
c += `;${
|
|
351
|
+
for (const p in a) {
|
|
352
|
+
const f = a[p];
|
|
353
|
+
c += `;${p}=${f}`;
|
|
354
354
|
}
|
|
355
355
|
const h = `${e}/${i}${c}`, d = a.encoding;
|
|
356
356
|
this.string = h, this.type = e, this.subtype = i, this.parameters = a, this.encoding = d, this.name = t.name, this.fileExtension = t.fileExtension;
|
|
@@ -1506,8 +1506,8 @@ function xi(o, t, e, i) {
|
|
|
1506
1506
|
let s = o.P[e], n = o.M[e];
|
|
1507
1507
|
const r = i >>> 31, a = t[e] | r, l = a | n, c = (a & s) + s ^ s | a;
|
|
1508
1508
|
let h = n | ~(c | s), d = s & c;
|
|
1509
|
-
const
|
|
1510
|
-
return h <<= 1, d <<= 1, d |= r, h |= Le(i) - r, s = d | ~(l | h), n = h & l, o.P[e] = s, o.M[e] = n,
|
|
1509
|
+
const p = Le(h & o.lastRowMask[e]) - Le(d & o.lastRowMask[e]);
|
|
1510
|
+
return h <<= 1, d <<= 1, d |= r, h |= Le(i) - r, s = d | ~(l | h), n = h & l, o.P[e] = s, o.M[e] = n, p;
|
|
1511
1511
|
}
|
|
1512
1512
|
function ks(o, t, e) {
|
|
1513
1513
|
if (t.length === 0)
|
|
@@ -1520,39 +1520,39 @@ function ks(o, t, e) {
|
|
|
1520
1520
|
};
|
|
1521
1521
|
r.lastRowMask.fill(1 << 31), r.lastRowMask[n] = 1 << (t.length - 1) % s;
|
|
1522
1522
|
const a = new Uint32Array(n + 1), l = /* @__PURE__ */ new Map(), c = [];
|
|
1523
|
-
for (let
|
|
1523
|
+
for (let p = 0; p < 256; p++)
|
|
1524
1524
|
c.push(a);
|
|
1525
|
-
for (let
|
|
1526
|
-
const f = t.charCodeAt(
|
|
1525
|
+
for (let p = 0; p < t.length; p += 1) {
|
|
1526
|
+
const f = t.charCodeAt(p);
|
|
1527
1527
|
if (l.has(f))
|
|
1528
1528
|
continue;
|
|
1529
1529
|
const m = new Uint32Array(n + 1);
|
|
1530
1530
|
l.set(f, m), f < c.length && (c[f] = m);
|
|
1531
|
-
for (let
|
|
1532
|
-
m[
|
|
1531
|
+
for (let u = 0; u <= n; u += 1) {
|
|
1532
|
+
m[u] = 0;
|
|
1533
1533
|
for (let y = 0; y < s; y += 1) {
|
|
1534
|
-
const w =
|
|
1534
|
+
const w = u * s + y;
|
|
1535
1535
|
if (w >= t.length)
|
|
1536
1536
|
continue;
|
|
1537
|
-
t.charCodeAt(w) === f && (m[
|
|
1537
|
+
t.charCodeAt(w) === f && (m[u] |= 1 << y);
|
|
1538
1538
|
}
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
1541
|
let h = Math.max(0, Math.ceil(e / s) - 1);
|
|
1542
1542
|
const d = new Uint32Array(n + 1);
|
|
1543
|
-
for (let
|
|
1544
|
-
d[
|
|
1543
|
+
for (let p = 0; p <= h; p += 1)
|
|
1544
|
+
d[p] = (p + 1) * s;
|
|
1545
1545
|
d[n] = t.length;
|
|
1546
|
-
for (let
|
|
1547
|
-
r.P[
|
|
1548
|
-
for (let
|
|
1549
|
-
const f = o.charCodeAt(
|
|
1546
|
+
for (let p = 0; p <= h; p += 1)
|
|
1547
|
+
r.P[p] = -1, r.M[p] = 0;
|
|
1548
|
+
for (let p = 0; p < o.length; p += 1) {
|
|
1549
|
+
const f = o.charCodeAt(p);
|
|
1550
1550
|
let m;
|
|
1551
1551
|
f < c.length ? m = c[f] : (m = l.get(f), typeof m > "u" && (m = a));
|
|
1552
|
-
let
|
|
1552
|
+
let u = 0;
|
|
1553
1553
|
for (let y = 0; y <= h; y += 1)
|
|
1554
|
-
|
|
1555
|
-
if (d[h] -
|
|
1554
|
+
u = xi(r, m, y, u), d[y] += u;
|
|
1555
|
+
if (d[h] - u <= e && h < n && (m[h + 1] & 1 || u < 0)) {
|
|
1556
1556
|
h += 1, r.P[h] = -1, r.M[h] = 0;
|
|
1557
1557
|
let y;
|
|
1558
1558
|
if (h === n) {
|
|
@@ -1560,13 +1560,13 @@ function ks(o, t, e) {
|
|
|
1560
1560
|
y = w === 0 ? s : w;
|
|
1561
1561
|
} else
|
|
1562
1562
|
y = s;
|
|
1563
|
-
d[h] = d[h - 1] + y -
|
|
1563
|
+
d[h] = d[h - 1] + y - u + xi(r, m, h, u);
|
|
1564
1564
|
} else
|
|
1565
1565
|
for (; h > 0 && d[h] >= e + s; )
|
|
1566
1566
|
h -= 1;
|
|
1567
1567
|
h === n && d[h] <= e && (d[h] < e && i.splice(0, i.length), i.push({
|
|
1568
1568
|
start: -1,
|
|
1569
|
-
end:
|
|
1569
|
+
end: p + 1,
|
|
1570
1570
|
errors: d[h]
|
|
1571
1571
|
}), e = d[h]);
|
|
1572
1572
|
}
|
|
@@ -1597,7 +1597,7 @@ function _n(o, t, e = {}) {
|
|
|
1597
1597
|
if (s.length === 0)
|
|
1598
1598
|
return null;
|
|
1599
1599
|
const n = (a) => {
|
|
1600
|
-
const
|
|
1600
|
+
const p = 1 - a.errors / t.length, f = e.prefix ? Li(
|
|
1601
1601
|
o.slice(
|
|
1602
1602
|
Math.max(0, a.start - e.prefix.length),
|
|
1603
1603
|
a.start
|
|
@@ -1607,8 +1607,8 @@ function _n(o, t, e = {}) {
|
|
|
1607
1607
|
o.slice(a.end, a.end + e.suffix.length),
|
|
1608
1608
|
e.suffix
|
|
1609
1609
|
) : 1;
|
|
1610
|
-
let
|
|
1611
|
-
return typeof e.hint == "number" && (
|
|
1610
|
+
let u = 1;
|
|
1611
|
+
return typeof e.hint == "number" && (u = 1 - Math.abs(a.start - e.hint) / o.length), (50 * p + 20 * f + 20 * m + 2 * u) / 92;
|
|
1612
1612
|
}, r = s.map((a) => ({
|
|
1613
1613
|
start: a.start,
|
|
1614
1614
|
end: a.end,
|
|
@@ -2031,9 +2031,9 @@ function As(o, t, e, i = !1) {
|
|
|
2031
2031
|
continue;
|
|
2032
2032
|
const l = J(r.top, a.top, t) && J(r.bottom, a.bottom, t), c = J(r.left, a.left, t) && J(r.right, a.right, t);
|
|
2033
2033
|
if (l && !c && Ns(r, a, t)) {
|
|
2034
|
-
const
|
|
2035
|
-
return
|
|
2036
|
-
|
|
2034
|
+
const p = o.filter((m) => m !== r && m !== a), f = Tn(r, a);
|
|
2035
|
+
return p.push(f), As(
|
|
2036
|
+
p,
|
|
2037
2037
|
t,
|
|
2038
2038
|
e,
|
|
2039
2039
|
i
|
|
@@ -2263,8 +2263,8 @@ const vt = { r: 255, g: 255, b: 255, a: 1 }, mt = /* @__PURE__ */ new Map(), In
|
|
|
2263
2263
|
const [l, c, h, d] = a.data;
|
|
2264
2264
|
if (d === 0)
|
|
2265
2265
|
return Kt(o, "Fully transparent color."), mt.set(e, null), vt;
|
|
2266
|
-
const
|
|
2267
|
-
return mt.set(e,
|
|
2266
|
+
const p = { r: l, g: c, b: h, a: d / 255 };
|
|
2267
|
+
return mt.set(e, p), p;
|
|
2268
2268
|
} catch (n) {
|
|
2269
2269
|
return Kt(o, `Error: ${n instanceof Error ? n.message : String(n)}`), mt.set(e, null), vt;
|
|
2270
2270
|
}
|
|
@@ -2331,11 +2331,11 @@ function Re(o) {
|
|
|
2331
2331
|
blockStart: (d) => t ? d.left : d.top,
|
|
2332
2332
|
inlineSize: (d) => t ? d.height : d.width,
|
|
2333
2333
|
blockSize: (d) => t ? d.width : d.height,
|
|
2334
|
-
applyPosition(d,
|
|
2335
|
-
d.style.position = "absolute", t ? (d.style.top = `${
|
|
2334
|
+
applyPosition(d, p, f, m, u, y) {
|
|
2335
|
+
d.style.position = "absolute", t ? (d.style.top = `${p * y}px`, d.style.left = `${f * y}px`, d.style.height = `${m * y}px`, d.style.width = `${u * y}px`) : (d.style.left = `${p * y}px`, d.style.top = `${f * y}px`, d.style.width = `${m * y}px`, d.style.height = `${u * y}px`);
|
|
2336
2336
|
},
|
|
2337
|
-
toRect(d,
|
|
2338
|
-
return t ? new DOMRect(
|
|
2337
|
+
toRect(d, p, f, m) {
|
|
2338
|
+
return t ? new DOMRect(p, d, m, f) : new DOMRect(d, p, f, m);
|
|
2339
2339
|
}
|
|
2340
2340
|
};
|
|
2341
2341
|
}
|
|
@@ -2630,23 +2630,23 @@ class Zn {
|
|
|
2630
2630
|
console.warn("Vertical writing detected: caretPositionFromPoint has known bugs, falling back to original range"), i.add(t.range);
|
|
2631
2631
|
else {
|
|
2632
2632
|
const m = t.range.getBoundingClientRect();
|
|
2633
|
-
let
|
|
2634
|
-
a === "page" ? (
|
|
2635
|
-
const w = c(
|
|
2636
|
-
if (w &&
|
|
2633
|
+
let u, y;
|
|
2634
|
+
a === "page" ? (u = Math.floor(f.inlineStart(m) / f.pageInlineSize) * f.pageInlineSize, y = f.pageInlineSize) : (u = f.inlineStart(m), y = f.inlineSize(m));
|
|
2635
|
+
const w = c(u, f.blockStart(m) + 1), C = c(u + y, f.blockStart(m) + f.blockSize(m) - 1);
|
|
2636
|
+
if (w && C) {
|
|
2637
2637
|
const T = this.wnd.document.createRange();
|
|
2638
|
-
T.setStart(w.offsetNode, w.offset), T.setEnd(
|
|
2638
|
+
T.setStart(w.offsetNode, w.offset), T.setEnd(C.offsetNode, C.offset), i.add(T), t.range = T;
|
|
2639
2639
|
} else
|
|
2640
2640
|
i.add(t.range);
|
|
2641
2641
|
}
|
|
2642
2642
|
} else
|
|
2643
2643
|
i.add(t.range);
|
|
2644
2644
|
const h = this.getBackgroundColor(), d = s.enforceContrast !== !1;
|
|
2645
|
-
let
|
|
2645
|
+
let p;
|
|
2646
2646
|
switch (n) {
|
|
2647
2647
|
case _.Underline:
|
|
2648
2648
|
const f = d ? ut(r, h) : r;
|
|
2649
|
-
|
|
2649
|
+
p = `::highlight(${this.id}) {
|
|
2650
2650
|
text-decoration: underline;
|
|
2651
2651
|
text-decoration-color: ${f};
|
|
2652
2652
|
text-decoration-thickness: 0.1em;
|
|
@@ -2654,28 +2654,28 @@ class Zn {
|
|
|
2654
2654
|
break;
|
|
2655
2655
|
case _.Outline:
|
|
2656
2656
|
const m = d ? ut(r, h) : r;
|
|
2657
|
-
|
|
2657
|
+
p = `::highlight(${this.id}) {
|
|
2658
2658
|
outline: 2px solid ${m};
|
|
2659
2659
|
outline-offset: 1px;
|
|
2660
2660
|
}`;
|
|
2661
2661
|
break;
|
|
2662
2662
|
case _.TextColor: {
|
|
2663
|
-
const
|
|
2664
|
-
|
|
2665
|
-
color: ${
|
|
2663
|
+
const u = d ? ut(r, h) : r;
|
|
2664
|
+
p = `::highlight(${this.id}) {
|
|
2665
|
+
color: ${u};
|
|
2666
2666
|
}`;
|
|
2667
2667
|
break;
|
|
2668
2668
|
}
|
|
2669
2669
|
case _.Highlight:
|
|
2670
2670
|
default: {
|
|
2671
|
-
const
|
|
2672
|
-
|
|
2673
|
-
color: ${Fn(
|
|
2674
|
-
background-color: ${
|
|
2671
|
+
const u = d ? ut(r, h) : r;
|
|
2672
|
+
p = `::highlight(${this.id}) {
|
|
2673
|
+
color: ${Fn(u, h)};
|
|
2674
|
+
background-color: ${u};
|
|
2675
2675
|
}`;
|
|
2676
2676
|
}
|
|
2677
2677
|
}
|
|
2678
|
-
e.innerHTML =
|
|
2678
|
+
e.innerHTML = p;
|
|
2679
2679
|
}
|
|
2680
2680
|
/**
|
|
2681
2681
|
* Layouts a single DecorationItem.
|
|
@@ -2689,23 +2689,23 @@ class Zn {
|
|
|
2689
2689
|
const i = Re(this.wnd);
|
|
2690
2690
|
let s = 1;
|
|
2691
2691
|
if (G.UA.Blink) {
|
|
2692
|
-
const h = parseFloat(this.wnd.getComputedStyle(this.wnd.document.documentElement).zoom), d = parseFloat(this.wnd.getComputedStyle(this.wnd.document.body).zoom),
|
|
2693
|
-
|
|
2692
|
+
const h = parseFloat(this.wnd.getComputedStyle(this.wnd.document.documentElement).zoom), d = parseFloat(this.wnd.getComputedStyle(this.wnd.document.body).zoom), p = (h || 1) * (d || 1);
|
|
2693
|
+
p && (s = 1 / p);
|
|
2694
2694
|
}
|
|
2695
|
-
const n = (h, d,
|
|
2695
|
+
const n = (h, d, p, f = 0) => {
|
|
2696
2696
|
switch (t.decoration?.style?.width) {
|
|
2697
2697
|
case "viewport": {
|
|
2698
|
-
const
|
|
2699
|
-
i.applyPosition(h,
|
|
2698
|
+
const u = Math.floor(i.inlineStart(d) / i.viewportInlineSize) * i.viewportInlineSize;
|
|
2699
|
+
i.applyPosition(h, u + i.inlineScrollOffset + f, i.blockStart(d) + i.blockScrollOffset, i.viewportInlineSize - 2 * f, i.blockSize(d), s);
|
|
2700
2700
|
break;
|
|
2701
2701
|
}
|
|
2702
2702
|
case "page": {
|
|
2703
|
-
const
|
|
2704
|
-
i.applyPosition(h,
|
|
2703
|
+
const u = Math.floor(i.inlineStart(d) / i.pageInlineSize) * i.pageInlineSize;
|
|
2704
|
+
i.applyPosition(h, u + i.inlineScrollOffset + f, i.blockStart(d) + i.blockScrollOffset, i.pageInlineSize - 2 * f, i.blockSize(d), s);
|
|
2705
2705
|
break;
|
|
2706
2706
|
}
|
|
2707
2707
|
case "bounds": {
|
|
2708
|
-
i.applyPosition(h, i.inlineStart(
|
|
2708
|
+
i.applyPosition(h, i.inlineStart(p) + i.inlineScrollOffset, i.blockStart(d) + i.blockScrollOffset, i.inlineSize(p), i.blockSize(d), s);
|
|
2709
2709
|
break;
|
|
2710
2710
|
}
|
|
2711
2711
|
default:
|
|
@@ -2726,7 +2726,7 @@ class Zn {
|
|
|
2726
2726
|
}
|
|
2727
2727
|
h.style.setProperty("pointer-events", "none"), c = h;
|
|
2728
2728
|
} else {
|
|
2729
|
-
const h = a, d = h.type ?? _.Highlight,
|
|
2729
|
+
const h = a, d = h.type ?? _.Highlight, p = h.tint ?? Ae(d);
|
|
2730
2730
|
if (d === _.TextColor) {
|
|
2731
2731
|
t.container = e, t.clickableElements = [];
|
|
2732
2732
|
return;
|
|
@@ -2735,10 +2735,10 @@ class Zn {
|
|
|
2735
2735
|
t.container = e, t.clickableElements = [], this.updateSharedMask();
|
|
2736
2736
|
return;
|
|
2737
2737
|
}
|
|
2738
|
-
const f = this.getCurrentDarkMode(), m = this.getBackgroundColor(),
|
|
2738
|
+
const f = this.getCurrentDarkMode(), m = this.getBackgroundColor(), u = h.enforceContrast !== !1, y = (() => {
|
|
2739
2739
|
switch (d) {
|
|
2740
2740
|
case _.Underline: {
|
|
2741
|
-
const T =
|
|
2741
|
+
const T = u ? ut(p, m) : p;
|
|
2742
2742
|
return [
|
|
2743
2743
|
h.layout === "bounds" ? `border-top: 0.1em solid ${T} !important` : null,
|
|
2744
2744
|
`border-bottom: 0.1em solid ${T} !important`,
|
|
@@ -2748,7 +2748,7 @@ class Zn {
|
|
|
2748
2748
|
}
|
|
2749
2749
|
case _.Outline:
|
|
2750
2750
|
return [
|
|
2751
|
-
`outline: 2px solid ${
|
|
2751
|
+
`outline: 2px solid ${u ? ut(p, m) : p} !important`,
|
|
2752
2752
|
"outline-offset: 1px !important",
|
|
2753
2753
|
"background-color: transparent !important",
|
|
2754
2754
|
"box-sizing: border-box !important"
|
|
@@ -2756,7 +2756,7 @@ class Zn {
|
|
|
2756
2756
|
case _.Highlight:
|
|
2757
2757
|
default:
|
|
2758
2758
|
return [
|
|
2759
|
-
`background-color: ${
|
|
2759
|
+
`background-color: ${u ? ut(p, m) : p} !important`,
|
|
2760
2760
|
`mix-blend-mode: ${f ? "exclusion" : "multiply"} !important`,
|
|
2761
2761
|
"opacity: 1 !important",
|
|
2762
2762
|
"box-sizing: border-box !important"
|
|
@@ -2776,10 +2776,10 @@ class Zn {
|
|
|
2776
2776
|
i.isVertical
|
|
2777
2777
|
// doNotMergeVerticallyAlignedRects
|
|
2778
2778
|
);
|
|
2779
|
-
h = h.sort((d,
|
|
2779
|
+
h = h.sort((d, p) => i.isVertical ? (i.isVertLR ? 1 : -1) * (d.left - p.left) : d.top - p.top);
|
|
2780
2780
|
for (let d of h) {
|
|
2781
|
-
const
|
|
2782
|
-
|
|
2781
|
+
const p = c.cloneNode(!0);
|
|
2782
|
+
p.style.setProperty("pointer-events", "none"), n(p, d, r, l), e.append(p);
|
|
2783
2783
|
}
|
|
2784
2784
|
}
|
|
2785
2785
|
t.container = e, t.clickableElements = Array.from(
|
|
@@ -2813,7 +2813,7 @@ class Zn {
|
|
|
2813
2813
|
}
|
|
2814
2814
|
updateSharedMask() {
|
|
2815
2815
|
const t = this.items.filter(
|
|
2816
|
-
(
|
|
2816
|
+
(p) => p.decoration.style?.type === _.Mask
|
|
2817
2817
|
);
|
|
2818
2818
|
if (t.length === 0) {
|
|
2819
2819
|
this.maskSvg && (this.maskSvg.remove(), this.maskSvg = void 0), this.shadowRoot && (this.shadowRoot.innerHTML = "");
|
|
@@ -2822,48 +2822,48 @@ class Zn {
|
|
|
2822
2822
|
const e = Re(this.wnd);
|
|
2823
2823
|
let i = 1;
|
|
2824
2824
|
if (G.UA.Blink) {
|
|
2825
|
-
const
|
|
2825
|
+
const p = parseFloat(this.wnd.getComputedStyle(this.wnd.document.documentElement).zoom), f = parseFloat(this.wnd.getComputedStyle(this.wnd.document.body).zoom), m = (p || 1) * (f || 1);
|
|
2826
2826
|
m && (i = 1 / m);
|
|
2827
2827
|
}
|
|
2828
2828
|
const s = this.wnd.document.documentElement, n = s.scrollWidth, r = s.scrollHeight, a = [];
|
|
2829
|
-
for (const
|
|
2830
|
-
const f =
|
|
2831
|
-
for (const
|
|
2829
|
+
for (const p of t) {
|
|
2830
|
+
const f = p.decoration.style, m = f.layout ?? "boxes", u = f.width ?? "wrap", y = p.range.getBoundingClientRect(), w = m === "bounds" ? [y] : Array.from(p.range.getClientRects());
|
|
2831
|
+
for (const C of w) {
|
|
2832
2832
|
let T;
|
|
2833
|
-
switch (
|
|
2833
|
+
switch (u) {
|
|
2834
2834
|
case "viewport": {
|
|
2835
|
-
const K = Math.floor(e.inlineStart(
|
|
2836
|
-
T = e.toRect(K, e.blockStart(
|
|
2835
|
+
const K = Math.floor(e.inlineStart(C) / e.viewportInlineSize) * e.viewportInlineSize;
|
|
2836
|
+
T = e.toRect(K, e.blockStart(C), e.viewportInlineSize, e.blockSize(C));
|
|
2837
2837
|
break;
|
|
2838
2838
|
}
|
|
2839
2839
|
case "page": {
|
|
2840
|
-
const K = Math.floor(e.inlineStart(
|
|
2841
|
-
T = e.toRect(K, e.blockStart(
|
|
2840
|
+
const K = Math.floor(e.inlineStart(C) / e.pageInlineSize) * e.pageInlineSize;
|
|
2841
|
+
T = e.toRect(K, e.blockStart(C), e.pageInlineSize, e.blockSize(C));
|
|
2842
2842
|
break;
|
|
2843
2843
|
}
|
|
2844
2844
|
case "bounds": {
|
|
2845
|
-
T = e.toRect(e.inlineStart(y), e.blockStart(
|
|
2845
|
+
T = e.toRect(e.inlineStart(y), e.blockStart(C), e.inlineSize(y), e.blockSize(C));
|
|
2846
2846
|
break;
|
|
2847
2847
|
}
|
|
2848
2848
|
default:
|
|
2849
|
-
T =
|
|
2849
|
+
T = C;
|
|
2850
2850
|
}
|
|
2851
2851
|
a.push(T);
|
|
2852
2852
|
}
|
|
2853
2853
|
}
|
|
2854
2854
|
const l = [
|
|
2855
2855
|
`M0 0 H${n} V${r} H0 Z`,
|
|
2856
|
-
...a.map((
|
|
2857
|
-
const f = (
|
|
2858
|
-
return `M${f} ${m} H${
|
|
2856
|
+
...a.map((p) => {
|
|
2857
|
+
const f = (p.left + e.xDocOffset) * i, m = (p.top + e.yDocOffset) * i, u = (p.right + e.xDocOffset) * i, y = (p.bottom + e.yDocOffset) * i;
|
|
2858
|
+
return `M${f} ${m} H${u} V${y} H${f} Z`;
|
|
2859
2859
|
})
|
|
2860
2860
|
].join(" "), c = "http://www.w3.org/2000/svg";
|
|
2861
2861
|
if (!this.maskSvg) {
|
|
2862
2862
|
this.shadowRoot || (this.shadowHost = this.wnd.document.createElement("div"), this.shadowHost.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none", this.wnd.document.body.appendChild(this.shadowHost), this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" })), this.maskSvg = this.wnd.document.createElementNS(c, "svg"), this.maskSvg.style.cssText = `position:absolute;top:0;left:0;width:${n}px;height:${r}px;pointer-events:none;z-index:9999`, this.maskSvg.dataset.readium = "true";
|
|
2863
|
-
const
|
|
2863
|
+
const p = this.wnd.document.createElementNS(c, "defs"), f = this.wnd.document.createElementNS(c, "clipPath"), m = `${this.id}-mask-clip`;
|
|
2864
2864
|
f.setAttribute("id", m), f.setAttribute("clipPathUnits", "userSpaceOnUse");
|
|
2865
|
-
const
|
|
2866
|
-
|
|
2865
|
+
const u = this.wnd.document.createElementNS(c, "path");
|
|
2866
|
+
u.setAttribute("clip-rule", "evenodd"), f.appendChild(u), p.appendChild(f), this.maskSvg.appendChild(p);
|
|
2867
2867
|
const y = this.wnd.document.createElementNS(c, "rect");
|
|
2868
2868
|
y.setAttribute("id", `${this.id}-mask-rect`), y.setAttribute("clip-path", `url(#${m})`), y.style.pointerEvents = "none", this.maskSvg.appendChild(y), this.shadowRoot.appendChild(this.maskSvg);
|
|
2869
2869
|
}
|
|
@@ -2872,8 +2872,8 @@ class Zn {
|
|
|
2872
2872
|
h && h.setAttribute("d", l);
|
|
2873
2873
|
const d = this.maskSvg.querySelector("rect");
|
|
2874
2874
|
if (d) {
|
|
2875
|
-
const f = t[0].decoration.style.tint, m = f ?? this.getBackgroundColor() ?? Ae(_.Mask),
|
|
2876
|
-
d.setAttribute("x", "0"), d.setAttribute("y", "0"), d.setAttribute("width", String(n)), d.setAttribute("height", String(r)), d.setAttribute("fill", m), d.setAttribute("fill-opacity",
|
|
2875
|
+
const f = t[0].decoration.style.tint, m = f ?? this.getBackgroundColor() ?? Ae(_.Mask), u = f ? "1" : "0.5";
|
|
2876
|
+
d.setAttribute("x", "0"), d.setAttribute("y", "0"), d.setAttribute("width", String(n)), d.setAttribute("height", String(r)), d.setAttribute("fill", m), d.setAttribute("fill-opacity", u);
|
|
2877
2877
|
}
|
|
2878
2878
|
}
|
|
2879
2879
|
injectCustomStylesheet(t) {
|
|
@@ -3098,19 +3098,19 @@ class ve {
|
|
|
3098
3098
|
direction: t,
|
|
3099
3099
|
velocity: s,
|
|
3100
3100
|
distance: Math.abs(e)
|
|
3101
|
-
}), this.history = this.history.filter((
|
|
3101
|
+
}), this.history = this.history.filter((u) => n - u.timestamp < 2e3).slice(-(this.options.historySize || 20)), this.history.length < 3) return !1;
|
|
3102
3102
|
if (s > this.options.maxVelocity)
|
|
3103
3103
|
return this.resetAfterDetection(), !0;
|
|
3104
|
-
const r = this.history.map((
|
|
3104
|
+
const r = this.history.map((u) => u.velocity), a = this.history.map((u) => u.distance), l = r.reduce((u, y) => u + y, 0) / r.length, c = a.reduce((u, y) => u + y, 0) / a.length, h = r.reduce((u, y) => u + Math.pow(y - l, 2), 0) / r.length, d = a.reduce((u, y) => u + Math.pow(y - c, 2), 0) / a.length;
|
|
3105
3105
|
if (h < this.options.minVariance && d < c * 0.1) {
|
|
3106
3106
|
if (this.consistentScrollCount++, this.consistentScrollCount >= (this.options.maxConsistentScrolls || 10))
|
|
3107
3107
|
return this.resetAfterDetection(), !0;
|
|
3108
3108
|
} else
|
|
3109
3109
|
this.consistentScrollCount = Math.max(0, this.consistentScrollCount - 1);
|
|
3110
|
-
let
|
|
3111
|
-
for (let
|
|
3112
|
-
this.history[
|
|
3113
|
-
return
|
|
3110
|
+
let p = 0, f = this.history[0].direction;
|
|
3111
|
+
for (let u = 1; u < this.history.length; u++)
|
|
3112
|
+
this.history[u].direction !== f && (p++, f = this.history[u].direction);
|
|
3113
|
+
return p / this.history.length > (this.options.minDirectionChanges || 0.3) ? (this.resetAfterDetection(), !0) : !1;
|
|
3114
3114
|
}
|
|
3115
3115
|
resetAfterDetection() {
|
|
3116
3116
|
this.history = this.history.slice(-3), this.consistentScrollCount = 0;
|
|
@@ -3175,18 +3175,18 @@ const zi = "readium-column-snapper-style", lr = 200, V = class V extends Ot {
|
|
|
3175
3175
|
}
|
|
3176
3176
|
// Snaps the current offset to the page width.
|
|
3177
3177
|
snapCurrentOffset(t = !1, e = !1) {
|
|
3178
|
-
const i = this.doc(), s = zs(this.wnd), n = this.cachedScrollWidth - this.wnd.innerWidth, r = Math.min(Math.max(0, this.normScroll()), n), a = this.dragOffset(), l = this.rtl ? -a : a, c = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), h = Math.min(n, Math.max(0, this.snapNormOffset(r + c))), d = this.rtl ? -h : h,
|
|
3179
|
-
if (this.checkSuspiciousSnap(f, Math.abs(d -
|
|
3178
|
+
const i = this.doc(), s = zs(this.wnd), n = this.cachedScrollWidth - this.wnd.innerWidth, r = Math.min(Math.max(0, this.normScroll()), n), a = this.dragOffset(), l = this.rtl ? -a : a, c = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), h = Math.min(n, Math.max(0, this.snapNormOffset(r + c))), d = this.rtl ? -h : h, p = this.rtl ? -r : r, f = d > p ? "right" : "left";
|
|
3179
|
+
if (this.checkSuspiciousSnap(f, Math.abs(d - p)), t && d !== p) {
|
|
3180
3180
|
this.snappingCancelled = !1;
|
|
3181
|
-
const m = (
|
|
3181
|
+
const m = (C, T, K, ft) => K > ft ? T : C + (T - C) * Qn(K / ft), u = lr * s;
|
|
3182
3182
|
let y;
|
|
3183
|
-
const w = (
|
|
3183
|
+
const w = (C) => {
|
|
3184
3184
|
if (this.snappingCancelled) return;
|
|
3185
|
-
y || (y =
|
|
3186
|
-
const T =
|
|
3185
|
+
y || (y = C);
|
|
3186
|
+
const T = C - y, K = m(this.overscroll, 0, T, u), ft = m(p, d, T, u);
|
|
3187
3187
|
i.scrollLeft = ft, this.overscroll !== 0 && (ke() ? i.attributeStyleMap.set("transform", new CSSTransformValue([
|
|
3188
3188
|
new CSSTranslate(CSS.px(-K), CSS.px(0), CSS.px(0))
|
|
3189
|
-
])) : i.style.transform = `translate3d(${-K}px, 0px, 0px)`), T <
|
|
3189
|
+
])) : i.style.transform = `translate3d(${-K}px, 0px, 0px)`), T < u ? this.wnd.requestAnimationFrame(w) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = d, e || this.reportProgress());
|
|
3190
3190
|
};
|
|
3191
3191
|
this.wnd.requestAnimationFrame(w);
|
|
3192
3192
|
} else
|
|
@@ -3302,8 +3302,8 @@ const zi = "readium-column-snapper-style", lr = 200, V = class V extends Ot {
|
|
|
3302
3302
|
}), this.resizeObserver.observe(t.document.body), this.mutationObserver = new MutationObserver((r) => {
|
|
3303
3303
|
for (const a of r)
|
|
3304
3304
|
if (a.target === this.wnd.document.documentElement) {
|
|
3305
|
-
const l = a.oldValue, c = a.target.getAttribute("style"), h = /transform\s*:\s*([^;]+)/, d = l?.match(h),
|
|
3306
|
-
(!d && !
|
|
3305
|
+
const l = a.oldValue, c = a.target.getAttribute("style"), h = /transform\s*:\s*([^;]+)/, d = l?.match(h), p = c?.match(h);
|
|
3306
|
+
(!d && !p && Nn(l, c) || d && !p || d && p && d[1] !== p[1]) && (t.requestAnimationFrame(() => {
|
|
3307
3307
|
t && Ni(t);
|
|
3308
3308
|
}), this.onWidthChange());
|
|
3309
3309
|
} else
|
|
@@ -4112,7 +4112,7 @@ const Wt = class Wt extends At {
|
|
|
4112
4112
|
), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
|
|
4113
4113
|
value: {
|
|
4114
4114
|
name: "readium-ts-toolkit",
|
|
4115
|
-
version: "2.7.0-alpha.
|
|
4115
|
+
version: "2.7.0-alpha.3",
|
|
4116
4116
|
hasFeature: (s, n = "") => {
|
|
4117
4117
|
switch (s) {
|
|
4118
4118
|
case "dom-manipulation":
|
|
@@ -4967,14 +4967,14 @@ class Cr {
|
|
|
4967
4967
|
this.inprogress.has(r) && await this.inprogress.get(r);
|
|
4968
4968
|
const a = new Promise(async (l, c) => {
|
|
4969
4969
|
const h = [], d = [];
|
|
4970
|
-
t.readingOrder.items.forEach((m,
|
|
4971
|
-
|
|
4970
|
+
t.readingOrder.items.forEach((m, u) => {
|
|
4971
|
+
u !== n && u !== n - 1 && u !== n + 1 && (h.includes(m.href) || h.push(m.href)), u === n && (d.includes(m.href) || d.push(m.href));
|
|
4972
4972
|
}), h.forEach(async (m) => {
|
|
4973
4973
|
d.includes(m) || this.pool.has(m) && (await this.pool.get(m)?.destroy(), this.pool.delete(m));
|
|
4974
4974
|
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((m) => {
|
|
4975
4975
|
this.injector?.releaseBlobUrl?.(m), URL.revokeObjectURL(m);
|
|
4976
4976
|
}), this.blobs.clear()), this.currentBaseURL = t.baseURL;
|
|
4977
|
-
const
|
|
4977
|
+
const p = async (m) => {
|
|
4978
4978
|
if (this.pendingUpdates.has(m) && this.pendingUpdates.get(m)?.inPool === !1) {
|
|
4979
4979
|
const w = this.blobs.get(m);
|
|
4980
4980
|
w && (this.injector?.releaseBlobUrl?.(w), URL.revokeObjectURL(w), this.blobs.delete(m), this.pendingUpdates.delete(m));
|
|
@@ -4988,25 +4988,25 @@ class Cr {
|
|
|
4988
4988
|
return;
|
|
4989
4989
|
}
|
|
4990
4990
|
}
|
|
4991
|
-
const
|
|
4992
|
-
if (!
|
|
4991
|
+
const u = t.readingOrder.findWithHref(m);
|
|
4992
|
+
if (!u) return;
|
|
4993
4993
|
if (!this.blobs.has(m)) {
|
|
4994
|
-
const
|
|
4994
|
+
const C = await new vr(
|
|
4995
4995
|
t,
|
|
4996
4996
|
this.currentBaseURL || "",
|
|
4997
|
-
|
|
4997
|
+
u,
|
|
4998
4998
|
{
|
|
4999
4999
|
cssProperties: this.currentCssProperties,
|
|
5000
5000
|
injector: this.injector
|
|
5001
5001
|
}
|
|
5002
5002
|
).build();
|
|
5003
|
-
this.blobs.set(m,
|
|
5003
|
+
this.blobs.set(m, C);
|
|
5004
5004
|
}
|
|
5005
5005
|
const y = new Er(this.blobs.get(m), this.contentProtectionConfig, this.keyboardPeripheralsConfig);
|
|
5006
5006
|
m !== r && await y.hide(), this.container.appendChild(y.iframe), await y.load(i), this.pool.set(m, y);
|
|
5007
5007
|
};
|
|
5008
5008
|
try {
|
|
5009
|
-
await Promise.all(d.map((m) =>
|
|
5009
|
+
await Promise.all(d.map((m) => p(m)));
|
|
5010
5010
|
} catch (m) {
|
|
5011
5011
|
c(m);
|
|
5012
5012
|
}
|
|
@@ -5081,9 +5081,9 @@ function _r() {
|
|
|
5081
5081
|
if (!(l === d - 1 || c === 1)) if (l !== d - 1 && c === 2) {
|
|
5082
5082
|
if (r.length < 2 || a !== 2 || r.charCodeAt(r.length - 1) !== 46 || r.charCodeAt(r.length - 2) !== 46) {
|
|
5083
5083
|
if (r.length > 2) {
|
|
5084
|
-
var
|
|
5085
|
-
if (
|
|
5086
|
-
|
|
5084
|
+
var p = r.lastIndexOf("/");
|
|
5085
|
+
if (p !== r.length - 1) {
|
|
5086
|
+
p === -1 ? (r = "", a = 0) : (r = r.slice(0, p), a = r.length - 1 - r.lastIndexOf("/")), l = d, c = 0;
|
|
5087
5087
|
continue;
|
|
5088
5088
|
}
|
|
5089
5089
|
} else if (r.length === 2 || r.length === 1) {
|
|
@@ -5135,25 +5135,25 @@ function _r() {
|
|
|
5135
5135
|
;
|
|
5136
5136
|
for (var l = n.length, c = l - a, h = 1; h < r.length && r.charCodeAt(h) === 47; ++h)
|
|
5137
5137
|
;
|
|
5138
|
-
for (var d = r.length,
|
|
5139
|
-
if (
|
|
5140
|
-
if (
|
|
5141
|
-
if (r.charCodeAt(h +
|
|
5142
|
-
return r.slice(h +
|
|
5143
|
-
if (
|
|
5144
|
-
return r.slice(h +
|
|
5145
|
-
} else c > f && (n.charCodeAt(a +
|
|
5138
|
+
for (var d = r.length, p = d - h, f = c < p ? c : p, m = -1, u = 0; u <= f; ++u) {
|
|
5139
|
+
if (u === f) {
|
|
5140
|
+
if (p > f) {
|
|
5141
|
+
if (r.charCodeAt(h + u) === 47)
|
|
5142
|
+
return r.slice(h + u + 1);
|
|
5143
|
+
if (u === 0)
|
|
5144
|
+
return r.slice(h + u);
|
|
5145
|
+
} else c > f && (n.charCodeAt(a + u) === 47 ? m = u : u === 0 && (m = 0));
|
|
5146
5146
|
break;
|
|
5147
5147
|
}
|
|
5148
|
-
var y = n.charCodeAt(a +
|
|
5148
|
+
var y = n.charCodeAt(a + u), w = r.charCodeAt(h + u);
|
|
5149
5149
|
if (y !== w)
|
|
5150
5150
|
break;
|
|
5151
|
-
y === 47 && (m =
|
|
5151
|
+
y === 47 && (m = u);
|
|
5152
5152
|
}
|
|
5153
|
-
var
|
|
5154
|
-
for (
|
|
5155
|
-
(
|
|
5156
|
-
return
|
|
5153
|
+
var C = "";
|
|
5154
|
+
for (u = a + m + 1; u <= l; ++u)
|
|
5155
|
+
(u === l || n.charCodeAt(u) === 47) && (C.length === 0 ? C += ".." : C += "/..");
|
|
5156
|
+
return C.length > 0 ? C + r.slice(h + m) : (h += m, r.charCodeAt(h) === 47 && ++h, r.slice(h));
|
|
5157
5157
|
},
|
|
5158
5158
|
_makeLong: function(n) {
|
|
5159
5159
|
return n;
|
|
@@ -5176,7 +5176,7 @@ function _r() {
|
|
|
5176
5176
|
var a = 0, l = -1, c = !0, h;
|
|
5177
5177
|
if (r !== void 0 && r.length > 0 && r.length <= n.length) {
|
|
5178
5178
|
if (r.length === n.length && r === n) return "";
|
|
5179
|
-
var d = r.length - 1,
|
|
5179
|
+
var d = r.length - 1, p = -1;
|
|
5180
5180
|
for (h = n.length - 1; h >= 0; --h) {
|
|
5181
5181
|
var f = n.charCodeAt(h);
|
|
5182
5182
|
if (f === 47) {
|
|
@@ -5185,9 +5185,9 @@ function _r() {
|
|
|
5185
5185
|
break;
|
|
5186
5186
|
}
|
|
5187
5187
|
} else
|
|
5188
|
-
|
|
5188
|
+
p === -1 && (c = !1, p = h + 1), d >= 0 && (f === r.charCodeAt(d) ? --d === -1 && (l = h) : (d = -1, l = p));
|
|
5189
5189
|
}
|
|
5190
|
-
return a === l ? l =
|
|
5190
|
+
return a === l ? l = p : l === -1 && (l = n.length), n.slice(a, l);
|
|
5191
5191
|
} else {
|
|
5192
5192
|
for (h = n.length - 1; h >= 0; --h)
|
|
5193
5193
|
if (n.charCodeAt(h) === 47) {
|
|
@@ -5202,15 +5202,15 @@ function _r() {
|
|
|
5202
5202
|
extname: function(n) {
|
|
5203
5203
|
o(n);
|
|
5204
5204
|
for (var r = -1, a = 0, l = -1, c = !0, h = 0, d = n.length - 1; d >= 0; --d) {
|
|
5205
|
-
var
|
|
5206
|
-
if (
|
|
5205
|
+
var p = n.charCodeAt(d);
|
|
5206
|
+
if (p === 47) {
|
|
5207
5207
|
if (!c) {
|
|
5208
5208
|
a = d + 1;
|
|
5209
5209
|
break;
|
|
5210
5210
|
}
|
|
5211
5211
|
continue;
|
|
5212
5212
|
}
|
|
5213
|
-
l === -1 && (c = !1, l = d + 1),
|
|
5213
|
+
l === -1 && (c = !1, l = d + 1), p === 46 ? r === -1 ? r = d : h !== 1 && (h = 1) : r !== -1 && (h = -1);
|
|
5214
5214
|
}
|
|
5215
5215
|
return r === -1 || l === -1 || // We saw a non-dot character immediately before the dot
|
|
5216
5216
|
h === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
@@ -5227,7 +5227,7 @@ function _r() {
|
|
|
5227
5227
|
if (n.length === 0) return r;
|
|
5228
5228
|
var a = n.charCodeAt(0), l = a === 47, c;
|
|
5229
5229
|
l ? (r.root = "/", c = 1) : c = 0;
|
|
5230
|
-
for (var h = -1, d = 0,
|
|
5230
|
+
for (var h = -1, d = 0, p = -1, f = !0, m = n.length - 1, u = 0; m >= c; --m) {
|
|
5231
5231
|
if (a = n.charCodeAt(m), a === 47) {
|
|
5232
5232
|
if (!f) {
|
|
5233
5233
|
d = m + 1;
|
|
@@ -5235,11 +5235,11 @@ function _r() {
|
|
|
5235
5235
|
}
|
|
5236
5236
|
continue;
|
|
5237
5237
|
}
|
|
5238
|
-
|
|
5238
|
+
p === -1 && (f = !1, p = m + 1), a === 46 ? h === -1 ? h = m : u !== 1 && (u = 1) : h !== -1 && (u = -1);
|
|
5239
5239
|
}
|
|
5240
|
-
return h === -1 ||
|
|
5241
|
-
|
|
5242
|
-
|
|
5240
|
+
return h === -1 || p === -1 || // We saw a non-dot character immediately before the dot
|
|
5241
|
+
u === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
5242
|
+
u === 1 && h === p - 1 && h === d + 1 ? p !== -1 && (d === 0 && l ? r.base = r.name = n.slice(1, p) : r.base = r.name = n.slice(d, p)) : (d === 0 && l ? (r.name = n.slice(1, h), r.base = n.slice(1, p)) : (r.name = n.slice(d, h), r.base = n.slice(d, p)), r.ext = n.slice(h, p)), d > 0 ? r.dir = n.slice(0, d - 1) : l && (r.dir = "/"), r;
|
|
5243
5243
|
},
|
|
5244
5244
|
sep: "/",
|
|
5245
5245
|
delimiter: ":",
|
|
@@ -5423,7 +5423,7 @@ function ao(o, t) {
|
|
|
5423
5423
|
function W(o) {
|
|
5424
5424
|
return typeof o == "string" ? o : o === null ? null : void 0;
|
|
5425
5425
|
}
|
|
5426
|
-
function
|
|
5426
|
+
function P(o) {
|
|
5427
5427
|
return typeof o == "boolean" || o == null ? o : void 0;
|
|
5428
5428
|
}
|
|
5429
5429
|
function Mt(o, t) {
|
|
@@ -5454,7 +5454,7 @@ function Ks(o) {
|
|
|
5454
5454
|
}
|
|
5455
5455
|
class Xt {
|
|
5456
5456
|
constructor(t = {}) {
|
|
5457
|
-
this.fontFamily = W(t.fontFamily), this.fontWeight = H(t.fontWeight, dt.range), this.hyphens =
|
|
5457
|
+
this.fontFamily = W(t.fontFamily), this.fontWeight = H(t.fontWeight, dt.range), this.hyphens = P(t.hyphens), this.iOSPatch = P(t.iOSPatch), this.iPadOSPatch = P(t.iPadOSPatch), this.letterSpacing = v(t.letterSpacing), this.ligatures = P(t.ligatures), this.lineHeight = v(t.lineHeight), this.noRuby = P(t.noRuby), this.paragraphIndent = v(t.paragraphIndent), this.paragraphSpacing = v(t.paragraphSpacing), this.textAlign = Mt(t.textAlign, rt), this.textNormalization = P(t.textNormalization), this.wordSpacing = v(t.wordSpacing), this.zoom = H(t.zoom, pe.range);
|
|
5458
5458
|
}
|
|
5459
5459
|
static serialize(t) {
|
|
5460
5460
|
const { ...e } = t;
|
|
@@ -5477,7 +5477,7 @@ class Xt {
|
|
|
5477
5477
|
}
|
|
5478
5478
|
class lo {
|
|
5479
5479
|
constructor(t) {
|
|
5480
|
-
this.fontFamily = W(t.fontFamily) || null, this.fontWeight = H(t.fontWeight, dt.range) || null, this.hyphens =
|
|
5480
|
+
this.fontFamily = W(t.fontFamily) || null, this.fontWeight = H(t.fontWeight, dt.range) || null, this.hyphens = P(t.hyphens) ?? null, this.iOSPatch = t.iOSPatch === !1 ? !1 : (D.OS.iOS || D.OS.iPadOS) && D.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : D.OS.iPadOS && D.iOSRequest === "desktop", this.letterSpacing = v(t.letterSpacing) || null, this.ligatures = P(t.ligatures) ?? null, this.lineHeight = v(t.lineHeight) || null, this.noRuby = P(t.noRuby) ?? !1, this.paragraphIndent = v(t.paragraphIndent) ?? null, this.paragraphSpacing = v(t.paragraphSpacing) ?? null, this.textAlign = Mt(t.textAlign, rt) || null, this.textNormalization = P(t.textNormalization) ?? !1, this.wordSpacing = v(t.wordSpacing) || null, this.zoom = H(t.zoom, pe.range) || 1, this.experiments = Ks(t.experiments) ?? null;
|
|
5481
5481
|
}
|
|
5482
5482
|
}
|
|
5483
5483
|
class $i {
|
|
@@ -6853,8 +6853,8 @@ class xo extends oi {
|
|
|
6853
6853
|
if (c.startsWith("http://") || c.startsWith("https://"))
|
|
6854
6854
|
h = c;
|
|
6855
6855
|
else if (this.currentLocation.href.startsWith("http://") || this.currentLocation.href.startsWith("https://")) {
|
|
6856
|
-
const
|
|
6857
|
-
h = new URL(c,
|
|
6856
|
+
const p = new URL(this.currentLocation.href);
|
|
6857
|
+
h = new URL(c, p).href;
|
|
6858
6858
|
} else
|
|
6859
6859
|
h = re.join(re.dirname(this.currentLocation.href), c);
|
|
6860
6860
|
const d = this.pub.readingOrder.findWithHref(h);
|
|
@@ -7217,8 +7217,8 @@ class sn {
|
|
|
7217
7217
|
}), s.isHTML && this.pub.metadata.languages?.[0]) {
|
|
7218
7218
|
const d = this.pub.metadata.languages[0];
|
|
7219
7219
|
if (s === g.XHTML) {
|
|
7220
|
-
const
|
|
7221
|
-
f && !
|
|
7220
|
+
const p = t.documentElement.lang || t.documentElement.getAttribute("xml:lang"), f = t.body.lang || t.body.getAttribute("xml:lang");
|
|
7221
|
+
f && !p ? (t.documentElement.lang = f, t.documentElement.setAttribute("xml:lang", f), t.body.removeAttribute("xml:lang"), t.body.removeAttribute("lang")) : p || (t.documentElement.lang = d, t.documentElement.setAttribute("xml:lang", d));
|
|
7222
7222
|
} else s === g.HTML && !t.documentElement.lang && (t.documentElement.lang = d);
|
|
7223
7223
|
}
|
|
7224
7224
|
if (Lt(this.pub.metadata) === "rtl" && !t.documentElement.dir && !t.body.dir && (t.documentElement.dir = z.rtl), i !== void 0) {
|
|
@@ -7364,29 +7364,29 @@ class ko {
|
|
|
7364
7364
|
const a = this.positions[r].href;
|
|
7365
7365
|
this.inprogress.has(a) && await this.inprogress.get(a);
|
|
7366
7366
|
const l = new Promise(async (c, h) => {
|
|
7367
|
-
const d = [],
|
|
7368
|
-
this.positions.forEach((
|
|
7369
|
-
(y > r + Ki || y < r - Ki) && (d.includes(
|
|
7370
|
-
}), d.forEach(async (
|
|
7371
|
-
|
|
7372
|
-
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((
|
|
7373
|
-
const f = async (
|
|
7374
|
-
if (
|
|
7375
|
-
const
|
|
7376
|
-
|
|
7367
|
+
const d = [], p = [];
|
|
7368
|
+
this.positions.forEach((u, y) => {
|
|
7369
|
+
(y > r + Ki || y < r - Ki) && (d.includes(u.href) || d.push(u.href)), y < r + Ji && y > r - Ji && (p.includes(u.href) || p.push(u.href));
|
|
7370
|
+
}), d.forEach(async (u) => {
|
|
7371
|
+
p.includes(u) || this.pool.has(u) && (await this.pool.get(u)?.destroy(), this.pool.delete(u), this.pendingUpdates.has(u) && this.pendingUpdates.set(u, { inPool: !1 }));
|
|
7372
|
+
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((u) => u.reset()), this.blobs.clear()), this.currentBaseURL = t.baseURL, s && (this.blobs.forEach((u) => u.reset()), this.blobs.clear(), this.pendingUpdates.clear());
|
|
7373
|
+
const f = async (u) => {
|
|
7374
|
+
if (this.pendingUpdates.has(u) && this.pendingUpdates.get(u)?.inPool === !1) {
|
|
7375
|
+
const C = this.blobs.get(u);
|
|
7376
|
+
C && (C.reset(), this.blobs.delete(u), this.pendingUpdates.delete(u));
|
|
7377
7377
|
}
|
|
7378
|
-
if (this.pool.has(
|
|
7379
|
-
const
|
|
7380
|
-
if (!this.blobs.has(
|
|
7381
|
-
await
|
|
7378
|
+
if (this.pool.has(u)) {
|
|
7379
|
+
const C = this.pool.get(u);
|
|
7380
|
+
if (!this.blobs.has(u))
|
|
7381
|
+
await C.destroy(), this.pool.delete(u), this.pendingUpdates.delete(u);
|
|
7382
7382
|
else {
|
|
7383
|
-
await
|
|
7383
|
+
await C.load(i);
|
|
7384
7384
|
return;
|
|
7385
7385
|
}
|
|
7386
7386
|
}
|
|
7387
|
-
const y = t.readingOrder.findWithHref(
|
|
7387
|
+
const y = t.readingOrder.findWithHref(u);
|
|
7388
7388
|
if (!y) return;
|
|
7389
|
-
this.blobs.has(
|
|
7389
|
+
this.blobs.has(u) || this.blobs.set(u, new sn(
|
|
7390
7390
|
t,
|
|
7391
7391
|
this.currentBaseURL || "",
|
|
7392
7392
|
y,
|
|
@@ -7395,22 +7395,22 @@ class ko {
|
|
|
7395
7395
|
injector: this.injector
|
|
7396
7396
|
}
|
|
7397
7397
|
));
|
|
7398
|
-
const w = new nn(await this.blobs.get(
|
|
7399
|
-
return
|
|
7398
|
+
const w = new nn(await this.blobs.get(u).build(), this.contentProtectionConfig, this.keyboardPeripheralsConfig);
|
|
7399
|
+
return u !== a && await w.hide(), this.container.appendChild(w.iframe), await w.load(i), this.pool.set(u, w), w;
|
|
7400
7400
|
};
|
|
7401
7401
|
try {
|
|
7402
|
-
await Promise.all(
|
|
7403
|
-
} catch (
|
|
7404
|
-
h(
|
|
7402
|
+
await Promise.all(p.filter((u) => u === a).map((u) => f(u)));
|
|
7403
|
+
} catch (u) {
|
|
7404
|
+
h(u);
|
|
7405
7405
|
return;
|
|
7406
7406
|
}
|
|
7407
7407
|
if (n !== this.updateSequence) {
|
|
7408
7408
|
c();
|
|
7409
7409
|
return;
|
|
7410
7410
|
}
|
|
7411
|
-
Promise.all(u.map(async (
|
|
7412
|
-
const y = f(
|
|
7413
|
-
this.inprogress.set(
|
|
7411
|
+
Promise.all(p.filter((u) => u !== a).map(async (u) => {
|
|
7412
|
+
const y = f(u);
|
|
7413
|
+
this.inprogress.set(u, y), await y, this.inprogress.delete(u);
|
|
7414
7414
|
}));
|
|
7415
7415
|
const m = this.pool.get(a);
|
|
7416
7416
|
if (!m) {
|
|
@@ -7422,12 +7422,12 @@ class ko {
|
|
|
7422
7422
|
c();
|
|
7423
7423
|
return;
|
|
7424
7424
|
}
|
|
7425
|
-
const
|
|
7426
|
-
if (!
|
|
7425
|
+
const u = this.pool.get(a);
|
|
7426
|
+
if (!u) {
|
|
7427
7427
|
c();
|
|
7428
7428
|
return;
|
|
7429
7429
|
}
|
|
7430
|
-
if (await
|
|
7430
|
+
if (await u.load(i), n !== this.updateSequence) {
|
|
7431
7431
|
c();
|
|
7432
7432
|
return;
|
|
7433
7433
|
}
|
|
@@ -7713,8 +7713,8 @@ class Ao {
|
|
|
7713
7713
|
c += l.X / this.scale, this.pinch.target.X += c, l.X += this.pinch.target.X * this.scale / this.pinch.startScale;
|
|
7714
7714
|
let h = -l.Y / n;
|
|
7715
7715
|
h += l.Y / this.scale, this.pinch.target.Y += h, l.Y += this.pinch.target.Y * this.scale / this.pinch.startScale;
|
|
7716
|
-
let d = (l.X - (this.pan.startX - this.manager.width / 2)) * 1 / this.scale,
|
|
7717
|
-
this.pan.translateX = d, this.pan.translateY =
|
|
7716
|
+
let d = (l.X - (this.pan.startX - this.manager.width / 2)) * 1 / this.scale, p = (l.Y - (this.pan.startY - this.manager.height / 2)) * 1 / this.scale;
|
|
7717
|
+
this.pan.translateX = d, this.pan.translateY = p, this.debugger?.show && (this.debugger.DOM.pinchTarget.style.left = `${this.pinch.target.X * this.scale / this.pinch.startScale - 5 + this.manager.width / 2}px`, this.debugger.DOM.pinchTarget.style.top = `${this.pinch.target.Y * this.scale / this.pinch.startScale - 5 + this.manager.height / 2}px`, this.debugger.DOM.pinchTarget.innerText = `${(this.pinch.target.X * this.scale / this.pinch.startScale).toFixed(2)},${(this.pinch.target.Y * this.scale / this.pinch.startScale).toFixed(2)}`);
|
|
7718
7718
|
}
|
|
7719
7719
|
const r = this.frameBounds.width / 6, a = this.frameBounds.height / 6;
|
|
7720
7720
|
this.pan.translateX < -r && (this.pan.overscrollX = -(r + this.pan.translateX), this.pan.translateX = -r), this.pan.translateY < -a && (this.pan.overscrollY = -(a + this.pan.translateY), this.pan.translateY = -a), this.pan.translateX > r && (this.pan.overscrollX = r - this.pan.translateX, this.pan.translateX = r), this.pan.translateY > a && (this.pan.overscrollY = a - this.pan.translateY, this.pan.translateY = a), s = !0, this.debugger?.show && (this.debugger.DOM.stats.innerText = `TX: ${this.pan.translateX.toFixed(2)}
|
|
@@ -8235,49 +8235,49 @@ class zo {
|
|
|
8235
8235
|
await this.waitForItem(l.href);
|
|
8236
8236
|
const a = new Promise(async (l, c) => {
|
|
8237
8237
|
const h = [], d = [];
|
|
8238
|
-
this.positions.forEach((
|
|
8239
|
-
(y > n + ts || y < n - ts) && (h.includes(
|
|
8240
|
-
}), h.forEach(async (
|
|
8241
|
-
d.includes(
|
|
8242
|
-
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((
|
|
8243
|
-
const
|
|
8244
|
-
const y = t.readingOrder.findIndexWithHref(
|
|
8245
|
-
w && (this.blobs.has(
|
|
8238
|
+
this.positions.forEach((u, y) => {
|
|
8239
|
+
(y > n + ts || y < n - ts) && (h.includes(u.href) || h.push(u.href)), y < n + es && y > n - es && (d.includes(u.href) || d.push(u.href));
|
|
8240
|
+
}), h.forEach(async (u) => {
|
|
8241
|
+
d.includes(u) || this.pool.has(u) && (this.cancelShowing(u), await this.pool.get(u)?.unload(), this.blobs.get(u)?.reset());
|
|
8242
|
+
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((u) => u.reset()), this.blobs.clear()), this.currentBaseURL = t.baseURL;
|
|
8243
|
+
const p = async (u) => {
|
|
8244
|
+
const y = t.readingOrder.findIndexWithHref(u), w = t.readingOrder.items[y];
|
|
8245
|
+
w && (this.blobs.has(u) || this.blobs.set(u, new sn(
|
|
8246
8246
|
t,
|
|
8247
8247
|
this.currentBaseURL || "",
|
|
8248
8248
|
w,
|
|
8249
8249
|
{
|
|
8250
8250
|
injector: this.injector
|
|
8251
8251
|
}
|
|
8252
|
-
)), this.delayedShow.has(
|
|
8252
|
+
)), this.delayedShow.has(u) || this.delayedShow.set(u, new Promise((C, T) => {
|
|
8253
8253
|
let K = !1;
|
|
8254
8254
|
const ft = window.setTimeout(async () => {
|
|
8255
|
-
this.delayedTimeout.set(
|
|
8256
|
-
const cn = this.makeSpread(this.reAlign(y)), dn = this.spreadPosition(cn, w), ui = this.pool.get(
|
|
8257
|
-
await ui.load(i, await this.blobs.get(
|
|
8255
|
+
this.delayedTimeout.set(u, 0);
|
|
8256
|
+
const cn = this.makeSpread(this.reAlign(y)), dn = this.spreadPosition(cn, w), ui = this.pool.get(u);
|
|
8257
|
+
await ui.load(i, await this.blobs.get(u).build(!0)), this.peripherals.isScaled || await ui.show(dn), this.delayedShow.delete(u), K = !0, C();
|
|
8258
8258
|
}, Io);
|
|
8259
8259
|
setTimeout(() => {
|
|
8260
|
-
!K && this.delayedShow.has(
|
|
8261
|
-
}, Do), this.delayedTimeout.set(
|
|
8260
|
+
!K && this.delayedShow.has(u) && T(`Offscreen load timeout: ${u}`);
|
|
8261
|
+
}, Do), this.delayedTimeout.set(u, ft);
|
|
8262
8262
|
})));
|
|
8263
8263
|
};
|
|
8264
8264
|
try {
|
|
8265
|
-
await Promise.all(d.map((
|
|
8266
|
-
} catch (
|
|
8267
|
-
c(
|
|
8265
|
+
await Promise.all(d.map((u) => p(u)));
|
|
8266
|
+
} catch (u) {
|
|
8267
|
+
c(u);
|
|
8268
8268
|
}
|
|
8269
8269
|
const f = [];
|
|
8270
|
-
for (const
|
|
8271
|
-
const y = this.pool.get(
|
|
8272
|
-
w && (this.cancelShowing(
|
|
8270
|
+
for (const u of r) {
|
|
8271
|
+
const y = this.pool.get(u.href), w = this.blobs.get(u.href);
|
|
8272
|
+
w && (this.cancelShowing(u.href), await y.load(i, await w.build(!0)), await y.show(this.spreadPosition(r, u)), this.previousFrames.push(y), await y.activate(), f.push(y));
|
|
8273
8273
|
}
|
|
8274
8274
|
for (; this.previousFrames.length > 0; ) {
|
|
8275
|
-
const
|
|
8276
|
-
|
|
8275
|
+
const u = this.previousFrames.shift();
|
|
8276
|
+
u && !f.includes(u) && await u.unfocus();
|
|
8277
8277
|
}
|
|
8278
8278
|
this.previousFrames = f;
|
|
8279
8279
|
const m = this.container.ownerDocument.activeElement;
|
|
8280
|
-
m && m.tagName === "IFRAME" && !f.some((
|
|
8280
|
+
m && m.tagName === "IFRAME" && !f.some((u) => u.iframe === m) && f[0]?.iframe.focus({ preventScroll: !0 }), l();
|
|
8281
8281
|
});
|
|
8282
8282
|
for (const l of r)
|
|
8283
8283
|
this.inprogress.set(l.href, a);
|
|
@@ -8337,7 +8337,7 @@ class zo {
|
|
|
8337
8337
|
}
|
|
8338
8338
|
class Yt {
|
|
8339
8339
|
constructor(t = {}) {
|
|
8340
|
-
this.backgroundColor = W(t.backgroundColor), this.blendFilter =
|
|
8340
|
+
this.backgroundColor = W(t.backgroundColor), this.blendFilter = P(t.blendFilter), this.constraint = v(t.constraint), this.columnCount = v(t.columnCount), this.darkenFilter = kt(t.darkenFilter), this.deprecatedFontSize = P(t.deprecatedFontSize), this.fontFamily = W(t.fontFamily), this.fontSize = H(t.fontSize, oe.range), this.fontSizeNormalize = P(t.fontSizeNormalize), this.fontOpticalSizing = P(t.fontOpticalSizing), this.fontWeight = H(t.fontWeight, dt.range), this.fontWidth = H(t.fontWidth, ae.range), this.hyphens = P(t.hyphens), this.invertFilter = kt(t.invertFilter), this.invertGaijiFilter = kt(t.invertGaijiFilter), this.iOSPatch = P(t.iOSPatch), this.iPadOSPatch = P(t.iPadOSPatch), this.letterSpacing = v(t.letterSpacing), this.ligatures = P(t.ligatures), this.lineHeight = v(t.lineHeight), this.linkColor = W(t.linkColor), this.noRuby = P(t.noRuby), this.pageGutter = v(t.pageGutter), this.paragraphIndent = v(t.paragraphIndent), this.paragraphSpacing = v(t.paragraphSpacing), this.scroll = P(t.scroll), this.scrollPaddingTop = v(t.scrollPaddingTop), this.scrollPaddingBottom = v(t.scrollPaddingBottom), this.scrollPaddingLeft = v(t.scrollPaddingLeft), this.scrollPaddingRight = v(t.scrollPaddingRight), this.selectionBackgroundColor = W(t.selectionBackgroundColor), this.selectionTextColor = W(t.selectionTextColor), this.textAlign = Mt(t.textAlign, rt), this.textColor = W(t.textColor), this.textNormalization = P(t.textNormalization), this.visitedColor = W(t.visitedColor), this.wordSpacing = v(t.wordSpacing), this.optimalLineLength = v(t.optimalLineLength), this.maximalLineLength = v(t.maximalLineLength), this.minimalLineLength = v(t.minimalLineLength);
|
|
8341
8341
|
}
|
|
8342
8342
|
static serialize(t) {
|
|
8343
8343
|
const { ...e } = t;
|
|
@@ -8360,7 +8360,7 @@ class Yt {
|
|
|
8360
8360
|
}
|
|
8361
8361
|
class Ho {
|
|
8362
8362
|
constructor(t) {
|
|
8363
|
-
this.backgroundColor = W(t.backgroundColor) || null, this.blendFilter =
|
|
8363
|
+
this.backgroundColor = W(t.backgroundColor) || null, this.blendFilter = P(t.blendFilter) ?? !1, this.constraint = v(t.constraint) || 0, this.columnCount = v(t.columnCount) || null, this.darkenFilter = kt(t.darkenFilter) ?? !1, this.deprecatedFontSize = P(t.deprecatedFontSize), (this.deprecatedFontSize === !1 || this.deprecatedFontSize === null) && (this.deprecatedFontSize = !CSS.supports("zoom", "1")), this.fontFamily = W(t.fontFamily) || null, this.fontSize = H(t.fontSize, oe.range) || 1, this.fontSizeNormalize = P(t.fontSizeNormalize) ?? !1, this.fontOpticalSizing = P(t.fontOpticalSizing) ?? null, this.fontWeight = H(t.fontWeight, dt.range) || null, this.fontWidth = H(t.fontWidth, ae.range) || null, this.hyphens = P(t.hyphens) ?? null, this.invertFilter = kt(t.invertFilter) ?? !1, this.invertGaijiFilter = kt(t.invertGaijiFilter) ?? !1, this.iOSPatch = t.iOSPatch === !1 ? !1 : (D.OS.iOS || D.OS.iPadOS) && D.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : D.OS.iPadOS && D.iOSRequest === "desktop", this.letterSpacing = v(t.letterSpacing) || null, this.ligatures = P(t.ligatures) ?? null, this.lineHeight = v(t.lineHeight) || null, this.linkColor = W(t.linkColor) || null, this.noRuby = P(t.noRuby) ?? !1, this.pageGutter = Ne(v(t.pageGutter), 20), this.paragraphIndent = v(t.paragraphIndent) ?? null, this.paragraphSpacing = v(t.paragraphSpacing) ?? null, this.scroll = P(t.scroll) ?? !1, this.scrollPaddingTop = v(t.scrollPaddingTop) ?? null, this.scrollPaddingBottom = v(t.scrollPaddingBottom) ?? null, this.scrollPaddingLeft = v(t.scrollPaddingLeft) ?? null, this.scrollPaddingRight = v(t.scrollPaddingRight) ?? null, this.selectionBackgroundColor = W(t.selectionBackgroundColor) || null, this.selectionTextColor = W(t.selectionTextColor) || null, this.textAlign = Mt(t.textAlign, rt) || null, this.textColor = W(t.textColor) || null, this.textNormalization = P(t.textNormalization) ?? !1, this.visitedColor = W(t.visitedColor) || null, this.wordSpacing = v(t.wordSpacing) || null, this.optimalLineLength = v(t.optimalLineLength) || 65, this.maximalLineLength = Ne(ao(t.maximalLineLength, this.optimalLineLength), 80), this.minimalLineLength = Ne(oo(t.minimalLineLength, this.optimalLineLength), 40), this.experiments = Ks(t.experiments) || null;
|
|
8364
8364
|
}
|
|
8365
8365
|
}
|
|
8366
8366
|
const Wo = "#FFFFFF", Uo = "#121212", Bo = "#0000EE", Vo = "#551A8B", Xo = "#b4d8fe", $o = "inherit", bt = {
|
|
@@ -8919,47 +8919,47 @@ class Go {
|
|
|
8919
8919
|
// should be the same as uncompensated when scale >= 1
|
|
8920
8920
|
paginate(t, e, i) {
|
|
8921
8921
|
const s = Math.round(Ct(this.containerParent) - this.constraint), n = this.getCompensatedMetrics(t, e), { zoomCompensation: r, optimal: a, minimal: l, maximal: c } = n, h = () => s >= a && c !== null ? Math.min(Math.round(c * r), s) : s;
|
|
8922
|
-
let d = 1,
|
|
8922
|
+
let d = 1, p = s;
|
|
8923
8923
|
if (i === void 0)
|
|
8924
8924
|
return {
|
|
8925
8925
|
colCount: void 0,
|
|
8926
|
-
effectiveContainerWidth:
|
|
8927
|
-
effectiveLineLength: Math.round(
|
|
8926
|
+
effectiveContainerWidth: p,
|
|
8927
|
+
effectiveLineLength: Math.round(p / d * r)
|
|
8928
8928
|
};
|
|
8929
8929
|
if (i === null)
|
|
8930
8930
|
if (s >= a && c !== null) {
|
|
8931
8931
|
d = Math.floor(s / a);
|
|
8932
8932
|
const f = Math.round(d * (c * r));
|
|
8933
|
-
|
|
8933
|
+
p = Math.min(f, s);
|
|
8934
8934
|
} else
|
|
8935
|
-
|
|
8935
|
+
p = h();
|
|
8936
8936
|
else if (i > 1) {
|
|
8937
8937
|
const f = Math.round(i * (l !== null ? l : a));
|
|
8938
8938
|
if (s >= f)
|
|
8939
8939
|
if (d = i, c === null)
|
|
8940
|
-
|
|
8940
|
+
p = s;
|
|
8941
8941
|
else {
|
|
8942
8942
|
const m = Math.round(d * (c * r));
|
|
8943
|
-
|
|
8943
|
+
p = Math.min(m, s);
|
|
8944
8944
|
}
|
|
8945
8945
|
else if (l !== null && s < Math.round(i * l))
|
|
8946
8946
|
if (d = Math.floor(s / l), d <= 1)
|
|
8947
|
-
d = 1,
|
|
8947
|
+
d = 1, p = h();
|
|
8948
8948
|
else {
|
|
8949
8949
|
const m = Math.round(d * (a * r));
|
|
8950
|
-
|
|
8950
|
+
p = Math.min(m, s);
|
|
8951
8951
|
}
|
|
8952
8952
|
else {
|
|
8953
8953
|
d = i;
|
|
8954
8954
|
const m = Math.round(d * (a * r));
|
|
8955
|
-
|
|
8955
|
+
p = Math.min(m, s);
|
|
8956
8956
|
}
|
|
8957
8957
|
} else
|
|
8958
|
-
d = 1,
|
|
8958
|
+
d = 1, p = h();
|
|
8959
8959
|
return {
|
|
8960
8960
|
colCount: d,
|
|
8961
|
-
effectiveContainerWidth:
|
|
8962
|
-
effectiveLineLength: Math.round(
|
|
8961
|
+
effectiveContainerWidth: p,
|
|
8962
|
+
effectiveLineLength: Math.round(p / d / (t && t >= 1 ? t : 1) * r)
|
|
8963
8963
|
};
|
|
8964
8964
|
}
|
|
8965
8965
|
computeCJKVerticalLength(t, e) {
|
|
@@ -9088,21 +9088,21 @@ async function Ko(o, t) {
|
|
|
9088
9088
|
let l, c, h;
|
|
9089
9089
|
switch (a) {
|
|
9090
9090
|
case "rtl": {
|
|
9091
|
-
const [d,
|
|
9091
|
+
const [d, p, f] = await Promise.all([
|
|
9092
9092
|
import("./ReadiumCSS-before-DwBLxUVH.js"),
|
|
9093
9093
|
import("./ReadiumCSS-default-BhdLiyWp.js"),
|
|
9094
9094
|
import("./ReadiumCSS-after-d5mC4cme.js")
|
|
9095
9095
|
]);
|
|
9096
|
-
l = d.default, c =
|
|
9096
|
+
l = d.default, c = p.default, h = f.default;
|
|
9097
9097
|
break;
|
|
9098
9098
|
}
|
|
9099
9099
|
case "cjk-horizontal": {
|
|
9100
|
-
const [d,
|
|
9100
|
+
const [d, p, f] = await Promise.all([
|
|
9101
9101
|
import("./ReadiumCSS-before-CG-KmDa3.js"),
|
|
9102
9102
|
import("./ReadiumCSS-default-N65xNiIp.js"),
|
|
9103
9103
|
import("./ReadiumCSS-after-XUKPAxfT.js")
|
|
9104
9104
|
]);
|
|
9105
|
-
l = d.default, c =
|
|
9105
|
+
l = d.default, c = p.default, h = f.default;
|
|
9106
9106
|
break;
|
|
9107
9107
|
}
|
|
9108
9108
|
case "cjk-vertical":
|
|
@@ -9110,21 +9110,21 @@ async function Ko(o, t) {
|
|
|
9110
9110
|
// layout as CJK vertical-rl — it is an outlier handled by the
|
|
9111
9111
|
// same stylesheet set per the Readium CSS spec.
|
|
9112
9112
|
case "mongolian-vertical": {
|
|
9113
|
-
const [d,
|
|
9113
|
+
const [d, p, f] = await Promise.all([
|
|
9114
9114
|
import("./ReadiumCSS-before-BNTwR8Qm.js"),
|
|
9115
9115
|
import("./ReadiumCSS-default-BesyZHRU.js"),
|
|
9116
9116
|
import("./ReadiumCSS-after-ClF4TBzj.js")
|
|
9117
9117
|
]);
|
|
9118
|
-
l = d.default, c =
|
|
9118
|
+
l = d.default, c = p.default, h = f.default;
|
|
9119
9119
|
break;
|
|
9120
9120
|
}
|
|
9121
9121
|
default: {
|
|
9122
|
-
const [d,
|
|
9122
|
+
const [d, p, f] = await Promise.all([
|
|
9123
9123
|
import("./ReadiumCSS-before-8FMq19-x.js"),
|
|
9124
9124
|
import("./ReadiumCSS-default-AIAk8uwU.js"),
|
|
9125
9125
|
import("./ReadiumCSS-after-D7unrNI9.js")
|
|
9126
9126
|
]);
|
|
9127
|
-
l = d.default, c =
|
|
9127
|
+
l = d.default, c = p.default, h = f.default;
|
|
9128
9128
|
break;
|
|
9129
9129
|
}
|
|
9130
9130
|
}
|
|
@@ -9153,12 +9153,12 @@ async function Ko(o, t) {
|
|
|
9153
9153
|
rel: "stylesheet"
|
|
9154
9154
|
}
|
|
9155
9155
|
), (a === "cjk-horizontal" || a === "cjk-vertical") && (o.description === "ebpaj-guide-1.0" || o.otherMetadata?.["ebpaj:guide-version"] !== void 0)) {
|
|
9156
|
-
const { default:
|
|
9156
|
+
const { default: p } = await import("./ReadiumCSS-ebpaj_fonts_patch-Dt2XliTg.js");
|
|
9157
9157
|
r.push({
|
|
9158
9158
|
id: "readium-css-ebpaj",
|
|
9159
9159
|
as: "link",
|
|
9160
9160
|
target: "head",
|
|
9161
|
-
blob: new Blob([Dt(
|
|
9161
|
+
blob: new Blob([Dt(p)], { type: "text/css" }),
|
|
9162
9162
|
rel: "stylesheet"
|
|
9163
9163
|
});
|
|
9164
9164
|
}
|
|
@@ -9203,7 +9203,7 @@ class an extends oi {
|
|
|
9203
9203
|
progressions: /* @__PURE__ */ new Map(),
|
|
9204
9204
|
positions: null
|
|
9205
9205
|
}, this.pub = e, this.container = t, this.listeners = Jo(i), this.currentLocation = n, s.length && (this.positions = s), this._preferences = new Yt(r.preferences), this._defaults = new Ho(r.defaults), this._settings = new rs(this._preferences, this._defaults);
|
|
9206
|
-
const a = Lt(e.metadata), l = a === "cjk-horizontal", c = a === "cjk-vertical", d = c || a === "mongolian-vertical",
|
|
9206
|
+
const a = Lt(e.metadata), l = a === "cjk-horizontal", c = a === "cjk-vertical", d = c || a === "mongolian-vertical", p = l || c;
|
|
9207
9207
|
this._css = new Go({
|
|
9208
9208
|
rsProperties: new jo({ noVerticalPagination: d || void 0 }),
|
|
9209
9209
|
userProperties: new on({}),
|
|
@@ -9215,7 +9215,7 @@ class an extends oi {
|
|
|
9215
9215
|
fontFace: this._settings.fontFamily,
|
|
9216
9216
|
letterSpacing: this._settings.letterSpacing,
|
|
9217
9217
|
wordSpacing: this._settings.wordSpacing,
|
|
9218
|
-
isCJK:
|
|
9218
|
+
isCJK: p
|
|
9219
9219
|
// sample: this.pub.metadata.description
|
|
9220
9220
|
}),
|
|
9221
9221
|
container: t,
|
|
@@ -9225,8 +9225,8 @@ class an extends oi {
|
|
|
9225
9225
|
this._contentProtection,
|
|
9226
9226
|
r.keyboardPeripherals || []
|
|
9227
9227
|
), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new Ce(this._contentProtection), this._suspiciousActivityListener = (f) => {
|
|
9228
|
-
const { type: m, ...
|
|
9229
|
-
m === "context_menu" ? this.listeners.contextMenu(
|
|
9228
|
+
const { type: m, ...u } = f.detail;
|
|
9229
|
+
m === "context_menu" ? this.listeners.contextMenu(u) : this.listeners.contentProtection(m, u);
|
|
9230
9230
|
}, window.addEventListener(ot, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new _e({
|
|
9231
9231
|
keyboardPeripherals: this._keyboardPeripherals
|
|
9232
9232
|
}), this._keyboardPeripheralListener = (f) => {
|
|
@@ -9363,7 +9363,7 @@ class an extends oi {
|
|
|
9363
9363
|
switch (t) {
|
|
9364
9364
|
case "_pong":
|
|
9365
9365
|
if (this.listeners.frameLoaded(this._cframes[0].iframe.contentWindow), this.listeners.positionChanged(this.currentLocation), i) {
|
|
9366
|
-
const h = this._cframes.filter((
|
|
9366
|
+
const h = this._cframes.filter((p) => !!p).indexOf(i), d = h >= 0 ? this.viewport.readingOrder[h] : void 0;
|
|
9367
9367
|
d && this._reapplyDecorationsToFrame(i, d);
|
|
9368
9368
|
} else
|
|
9369
9369
|
this._reapplyDecorationsToCurrentFrames();
|
|
@@ -9382,10 +9382,10 @@ class an extends oi {
|
|
|
9382
9382
|
case "text_selected": {
|
|
9383
9383
|
const c = e;
|
|
9384
9384
|
if (i) {
|
|
9385
|
-
const d = this._cframes.filter((f) => !!f).indexOf(i),
|
|
9386
|
-
if (
|
|
9387
|
-
const f = this.pub.readingOrder.findWithHref(
|
|
9388
|
-
c.locator = new F({ href:
|
|
9385
|
+
const d = this._cframes.filter((f) => !!f).indexOf(i), p = d >= 0 ? this.viewport.readingOrder[d] : void 0;
|
|
9386
|
+
if (p) {
|
|
9387
|
+
const f = this.pub.readingOrder.findWithHref(p);
|
|
9388
|
+
c.locator = new F({ href: p, type: f.type || "application/xhtml+xml", text: new et({ highlight: c.text }) });
|
|
9389
9389
|
}
|
|
9390
9390
|
}
|
|
9391
9391
|
this.listeners.textSelected(c);
|
|
@@ -9542,14 +9542,14 @@ class an extends oi {
|
|
|
9542
9542
|
if (!c.msg) return;
|
|
9543
9543
|
const d = l[h];
|
|
9544
9544
|
if (d) {
|
|
9545
|
-
for (const
|
|
9546
|
-
const f = a.get(
|
|
9547
|
-
!f || f.locator.href !== d || c.msg.send("decorate", { group: t, action: "remove", decoration: { id:
|
|
9545
|
+
for (const p of e) {
|
|
9546
|
+
const f = a.get(p);
|
|
9547
|
+
!f || f.locator.href !== d || c.msg.send("decorate", { group: t, action: "remove", decoration: { id: p } });
|
|
9548
9548
|
}
|
|
9549
|
-
for (const
|
|
9550
|
-
|
|
9551
|
-
for (const
|
|
9552
|
-
|
|
9549
|
+
for (const p of i)
|
|
9550
|
+
p.locator.href === d && c.msg.send("decorate", { group: t, action: "add", decoration: xt(p, this._decoratorConfig.decorationTemplates) });
|
|
9551
|
+
for (const p of s)
|
|
9552
|
+
p.locator.href === d && c.msg.send("decorate", { group: t, action: "update", decoration: xt(p, this._decoratorConfig.decorationTemplates) });
|
|
9553
9553
|
}
|
|
9554
9554
|
});
|
|
9555
9555
|
}
|
|
@@ -10900,7 +10900,7 @@ const be = {
|
|
|
10900
10900
|
};
|
|
10901
10901
|
class jt {
|
|
10902
10902
|
constructor(t = {}) {
|
|
10903
|
-
this.backgroundColor = W(t.backgroundColor), this.constraint = v(t.constraint), this.quality = Mt(t.quality, nt), this.scrolled =
|
|
10903
|
+
this.backgroundColor = W(t.backgroundColor), this.constraint = v(t.constraint), this.quality = Mt(t.quality, nt), this.scrolled = P(t.scrolled), this.spreads = P(t.spreads), this.stripWidth = H(t.stripWidth, be.range);
|
|
10904
10904
|
}
|
|
10905
10905
|
static serialize(t) {
|
|
10906
10906
|
const { ...e } = t;
|
|
@@ -10923,7 +10923,7 @@ class jt {
|
|
|
10923
10923
|
}
|
|
10924
10924
|
class va {
|
|
10925
10925
|
constructor(t) {
|
|
10926
|
-
this.backgroundColor = W(t.backgroundColor) || null, this.constraint = v(t.constraint) || 0, this.quality = Mt(t.quality, nt) || nt.auto, this.scrolled =
|
|
10926
|
+
this.backgroundColor = W(t.backgroundColor) || null, this.constraint = v(t.constraint) || 0, this.quality = Mt(t.quality, nt) || nt.auto, this.scrolled = P(t.scrolled) ?? null, this.spreads = P(t.spreads) ?? !0, this.stripWidth = H(t.stripWidth, be.range) || 720;
|
|
10927
10927
|
}
|
|
10928
10928
|
}
|
|
10929
10929
|
class Ss {
|
|
@@ -11856,7 +11856,7 @@ class Ca {
|
|
|
11856
11856
|
}
|
|
11857
11857
|
class xe {
|
|
11858
11858
|
constructor(t = {}) {
|
|
11859
|
-
this.volume = H(t.volume, fe.range), this.playbackRate = H(t.playbackRate, me.range), this.preservePitch =
|
|
11859
|
+
this.volume = H(t.volume, fe.range), this.playbackRate = H(t.playbackRate, me.range), this.preservePitch = P(t.preservePitch), this.skipBackwardInterval = H(t.skipBackwardInterval, ht.range), this.skipForwardInterval = H(t.skipForwardInterval, ht.range), this.pollInterval = v(t.pollInterval), this.autoPlay = P(t.autoPlay), this.enableMediaSession = P(t.enableMediaSession);
|
|
11860
11860
|
}
|
|
11861
11861
|
merging(t) {
|
|
11862
11862
|
const e = { ...this };
|
|
@@ -11867,7 +11867,7 @@ class xe {
|
|
|
11867
11867
|
}
|
|
11868
11868
|
class _a {
|
|
11869
11869
|
constructor(t = {}) {
|
|
11870
|
-
this.volume = H(t.volume, fe.range) ?? 1, this.playbackRate = H(t.playbackRate, me.range) ?? 1, this.preservePitch =
|
|
11870
|
+
this.volume = H(t.volume, fe.range) ?? 1, this.playbackRate = H(t.playbackRate, me.range) ?? 1, this.preservePitch = P(t.preservePitch) ?? !0, this.skipBackwardInterval = H(t.skipBackwardInterval, ht.range) ?? 10, this.skipForwardInterval = H(t.skipForwardInterval, ht.range) ?? 10, this.pollInterval = v(t.pollInterval) ?? 1e3, this.autoPlay = P(t.autoPlay) ?? !0, this.enableMediaSession = P(t.enableMediaSession) ?? !0;
|
|
11871
11871
|
}
|
|
11872
11872
|
}
|
|
11873
11873
|
class vs {
|
|
@@ -12147,8 +12147,8 @@ class Da extends Sr {
|
|
|
12147
12147
|
s.keyboardPeripherals || []
|
|
12148
12148
|
);
|
|
12149
12149
|
(c.disableContextMenu || c.checkAutomation || c.checkIFrameEmbedding || c.monitorDevTools || c.protectPrinting?.disable || c.disableDragAndDrop || c.protectCopy) && (this._navigatorProtector = new La(c), this._suspiciousActivityListener = (d) => {
|
|
12150
|
-
const { type:
|
|
12151
|
-
|
|
12150
|
+
const { type: p, ...f } = d.detail;
|
|
12151
|
+
p === "context_menu" ? this.listeners.contextMenu(f) : this.listeners.contentProtection(p, f);
|
|
12152
12152
|
}, window.addEventListener(ot, this._suspiciousActivityListener)), h.length > 0 && (this._keyboardPeripheralsManager = new _e({ keyboardPeripherals: h }), this._keyboardPeripheralListener = (d) => {
|
|
12153
12153
|
this.listeners.peripheral(d.detail);
|
|
12154
12154
|
}, window.addEventListener(at, this._keyboardPeripheralListener)), this.setupEventListeners(), this._isNavigating = !0, this.pool.setCurrentAudio(r, "forward"), this.applyPreferences(), this.waitForLoadedAndSeeked(a).then(() => {
|
|
@@ -12608,7 +12608,7 @@ export {
|
|
|
12608
12608
|
no as WebRSProperties,
|
|
12609
12609
|
qs as WebUserProperties,
|
|
12610
12610
|
js as decorationsEqual,
|
|
12611
|
-
|
|
12611
|
+
P as ensureBoolean,
|
|
12612
12612
|
Mt as ensureEnumValue,
|
|
12613
12613
|
Ks as ensureExperiment,
|
|
12614
12614
|
kt as ensureFilter,
|