@prose-reader/core 1.370.0 → 1.371.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/createReaderWithEnhancer.d.ts +3 -3
- package/dist/enhancers/pagination/trackPaginationInfo.d.ts +18 -14
- package/dist/enhancers/pagination/types.d.ts +13 -10
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +365 -362
- package/dist/index.js.map +1 -1
- package/dist/pagination/PaginationController.d.ts +2 -1
- package/dist/pagination/edges.d.ts +6 -0
- package/dist/pagination/edges.test.d.ts +1 -0
- package/dist/pagination/types.d.ts +8 -8
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1778,7 +1778,7 @@ var cn = class {
|
|
|
1778
1778
|
}))).pipe(j(this.destroy$)).subscribe();
|
|
1779
1779
|
}
|
|
1780
1780
|
}, lr = (e) => e.pagination.state$.pipe(N(e.settings.values$), T(([t, { computedPageTurnDirection: n }]) => {
|
|
1781
|
-
let { spineItems: r, readingDirection: i } = e.context.manifest, a = r.length ?? 0, o = t.
|
|
1781
|
+
let { spineItems: r, readingDirection: i } = e.context.manifest, a = r.length ?? 0, o = t.begin.spineItemIndex === 0, s = t.end.spineItemIndex === Math.max(a - 1, 0), c = t.end.spineItemIndex === Math.max(a - 1, 0), l = t.begin.spineItemIndex === 0, u = t.begin.pageIndexInSpineItem === 0, d = t.end.pageIndexInSpineItem === t.end.numberOfPagesInSpineItem - 1;
|
|
1782
1782
|
return {
|
|
1783
1783
|
canTurnLeft: n !== "vertical" && !u,
|
|
1784
1784
|
canTurnRight: n !== "vertical" && !d,
|
|
@@ -1921,7 +1921,15 @@ var cn = class {
|
|
|
1921
1921
|
locateResource(e, t) {
|
|
1922
1922
|
return Array.isArray(e) ? St(() => v(e.map((e) => this.locate(e, t ?? {}))).pipe(ne([]))) : this.locate(e, t ?? {});
|
|
1923
1923
|
}
|
|
1924
|
-
}, hr =
|
|
1924
|
+
}, hr = () => ({
|
|
1925
|
+
cfi: void 0,
|
|
1926
|
+
spineItemIndex: void 0,
|
|
1927
|
+
pageIndexInSpineItem: void 0,
|
|
1928
|
+
numberOfPagesInSpineItem: 0
|
|
1929
|
+
}), gr = (e, t) => {
|
|
1930
|
+
let { begin: n, end: r, ...i } = e, { begin: a, end: s, ...c } = t;
|
|
1931
|
+
return o(n, a) && o(r, s) && o(i, c);
|
|
1932
|
+
}, _r = L.namespace("spine"), vr = ({ position: e, pageSize: t }) => new fn({
|
|
1925
1933
|
...e,
|
|
1926
1934
|
left: e.x,
|
|
1927
1935
|
top: e.y,
|
|
@@ -1929,7 +1937,7 @@ var cn = class {
|
|
|
1929
1937
|
height: t.height,
|
|
1930
1938
|
bottom: e.y + t.height,
|
|
1931
1939
|
right: e.x + t.width
|
|
1932
|
-
}),
|
|
1940
|
+
}), yr = 10, br = (e) => {
|
|
1933
1941
|
let { spineItem: t, ...n } = e;
|
|
1934
1942
|
if (!e.spineItem.value.isLoaded) return {
|
|
1935
1943
|
...n,
|
|
@@ -1943,7 +1951,7 @@ var cn = class {
|
|
|
1943
1951
|
...n,
|
|
1944
1952
|
firstVisibleNode: ze(r, e.layout)
|
|
1945
1953
|
};
|
|
1946
|
-
},
|
|
1954
|
+
}, xr = (e) => new f((t) => {
|
|
1947
1955
|
if (e.length === 0) {
|
|
1948
1956
|
t.next([]), t.complete();
|
|
1949
1957
|
return;
|
|
@@ -1953,13 +1961,13 @@ var cn = class {
|
|
|
1953
1961
|
}, o = () => {
|
|
1954
1962
|
n = void 0;
|
|
1955
1963
|
let a = 0;
|
|
1956
|
-
for (; r < e.length && a <
|
|
1964
|
+
for (; r < e.length && a < yr;) {
|
|
1957
1965
|
let t = e[r];
|
|
1958
1966
|
if (!t) {
|
|
1959
1967
|
r = e.length;
|
|
1960
1968
|
break;
|
|
1961
1969
|
}
|
|
1962
|
-
i[r] =
|
|
1970
|
+
i[r] = br(t), r += 1, a += 1;
|
|
1963
1971
|
}
|
|
1964
1972
|
if (r >= e.length) {
|
|
1965
1973
|
t.next(i), t.complete();
|
|
@@ -1972,9 +1980,9 @@ var cn = class {
|
|
|
1972
1980
|
return s(), () => {
|
|
1973
1981
|
a();
|
|
1974
1982
|
};
|
|
1975
|
-
}),
|
|
1983
|
+
}), Sr = class e extends U {
|
|
1976
1984
|
constructor(t, n, r, i, a, o) {
|
|
1977
|
-
super({ pages: [] }), this.spineLayout = t, this.spineItemsManager = n, this.spineItemLocator = r, this.context = i, this.locator = a, this.viewport = o, this.fromSpineItemPageIndex = (t, n) => e.fromSpineItemPageIndex(this.value, t, n), this.fromNextPageWithinSameSpineItem = (t) => e.fromNextPageWithinSameSpineItem(this.value, t), this.fromAbsolutePageIndex = (t) => e.fromAbsolutePageIndex(this.value, t), this.observeFromAbsolutePageIndex = (e) => this.pipe(T(() => this.fromAbsolutePageIndex(e))), this.layout$ = t.layout$.pipe(N(o), A(([, { pageSize: e }]) =>
|
|
1985
|
+
super({ pages: [] }), this.spineLayout = t, this.spineItemsManager = n, this.spineItemLocator = r, this.context = i, this.locator = a, this.viewport = o, this.fromSpineItemPageIndex = (t, n) => e.fromSpineItemPageIndex(this.value, t, n), this.fromNextPageWithinSameSpineItem = (t) => e.fromNextPageWithinSameSpineItem(this.value, t), this.fromAbsolutePageIndex = (t) => e.fromAbsolutePageIndex(this.value, t), this.observeFromAbsolutePageIndex = (e) => this.pipe(T(() => this.fromAbsolutePageIndex(e))), this.layout$ = t.layout$.pipe(N(o), A(([, { pageSize: e }]) => xr(n.items.reduce((t, n, i) => {
|
|
1978
1986
|
for (let o = 0; o < n.numberOfPages; o += 1) {
|
|
1979
1987
|
let s = r.getSpineItemPositionFromPageIndex({
|
|
1980
1988
|
spineItem: n,
|
|
@@ -1984,7 +1992,7 @@ var cn = class {
|
|
|
1984
1992
|
spineItemPosition: s
|
|
1985
1993
|
}), l = t.length;
|
|
1986
1994
|
t.push({
|
|
1987
|
-
absoluteLayout:
|
|
1995
|
+
absoluteLayout: vr({
|
|
1988
1996
|
pageSize: e,
|
|
1989
1997
|
position: c
|
|
1990
1998
|
}),
|
|
@@ -2005,7 +2013,7 @@ var cn = class {
|
|
|
2005
2013
|
});
|
|
2006
2014
|
}
|
|
2007
2015
|
return t;
|
|
2008
|
-
}, []))), T((e) => (
|
|
2016
|
+
}, []))), T((e) => (_r.info("Pages layout", e), { pages: e })), O()), this.layout$.pipe(j(this.destroy$)).subscribe(this.next.bind(this));
|
|
2009
2017
|
}
|
|
2010
2018
|
static {
|
|
2011
2019
|
this.fromSpineItemPageIndex = (e, t, n) => {
|
|
@@ -2019,20 +2027,20 @@ var cn = class {
|
|
|
2019
2027
|
static {
|
|
2020
2028
|
this.fromAbsolutePageIndex = (e, t) => e.pages.find((e) => e.absolutePageIndex === t);
|
|
2021
2029
|
}
|
|
2022
|
-
},
|
|
2030
|
+
}, Cr = (e) => {
|
|
2023
2031
|
let t = e.indexOf("#");
|
|
2024
2032
|
return t >= 0 ? e.substring(0, t) : e;
|
|
2025
|
-
},
|
|
2033
|
+
}, wr = (e) => {
|
|
2026
2034
|
if (!e) return;
|
|
2027
2035
|
let t = e.indexOf("#");
|
|
2028
2036
|
if (!(t < 0)) return e.substring(t + 1) || void 0;
|
|
2029
|
-
},
|
|
2037
|
+
}, Tr = (e) => {
|
|
2030
2038
|
try {
|
|
2031
2039
|
return decodeURIComponent(e);
|
|
2032
2040
|
} catch {
|
|
2033
2041
|
return e;
|
|
2034
2042
|
}
|
|
2035
|
-
},
|
|
2043
|
+
}, Er = (e, t = []) => e.flatMap((e) => {
|
|
2036
2044
|
let n = [...t, {
|
|
2037
2045
|
title: e.title,
|
|
2038
2046
|
path: e.path
|
|
@@ -2040,24 +2048,24 @@ var cn = class {
|
|
|
2040
2048
|
return [{
|
|
2041
2049
|
chain: n,
|
|
2042
2050
|
href: e.href || e.path,
|
|
2043
|
-
anchorId:
|
|
2044
|
-
}, ...
|
|
2045
|
-
}),
|
|
2051
|
+
anchorId: wr(e.href) ?? wr(e.path)
|
|
2052
|
+
}, ...Er(e.contents, n)];
|
|
2053
|
+
}), Dr = (e) => {
|
|
2046
2054
|
let t = /* @__PURE__ */ new Map();
|
|
2047
2055
|
return e.spineItems.forEach((e, n) => {
|
|
2048
2056
|
t.has(e.href) || t.set(e.href, n);
|
|
2049
2057
|
}), t;
|
|
2050
|
-
},
|
|
2051
|
-
let n =
|
|
2052
|
-
return
|
|
2053
|
-
let t =
|
|
2058
|
+
}, Or = (e, t) => {
|
|
2059
|
+
let n = Dr(t);
|
|
2060
|
+
return Er(e).map((e) => {
|
|
2061
|
+
let t = Cr(e.href), r = n.get(t) ?? -1;
|
|
2054
2062
|
return {
|
|
2055
2063
|
...e,
|
|
2056
2064
|
hrefWithoutAnchor: t,
|
|
2057
2065
|
spineItemIndex: r
|
|
2058
2066
|
};
|
|
2059
2067
|
});
|
|
2060
|
-
},
|
|
2068
|
+
}, kr = ({ manifest: e, tocIndex: t }) => {
|
|
2061
2069
|
let n = /* @__PURE__ */ new Map();
|
|
2062
2070
|
t.forEach((e, t) => {
|
|
2063
2071
|
let r = n.get(e.hrefWithoutAnchor);
|
|
@@ -2070,19 +2078,19 @@ var cn = class {
|
|
|
2070
2078
|
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
|
|
2071
2079
|
for (let a of e.spineItems) {
|
|
2072
2080
|
if (r.has(a.href)) continue;
|
|
2073
|
-
let e =
|
|
2081
|
+
let e = Cr(a.href), o = i.get(e);
|
|
2074
2082
|
if (!o) {
|
|
2075
2083
|
let r = [];
|
|
2076
|
-
for (let [t, i] of n)
|
|
2084
|
+
for (let [t, i] of n) Ar(e, t) && r.push(...i);
|
|
2077
2085
|
r.sort((e, t) => e - t), o = r.map((e) => t[e]), i.set(e, o);
|
|
2078
2086
|
}
|
|
2079
2087
|
r.set(a.href, o);
|
|
2080
2088
|
}
|
|
2081
2089
|
return r;
|
|
2082
|
-
},
|
|
2090
|
+
}, Ar = (e, t) => e === t || e.endsWith(t) || t.endsWith(e), jr = (e, t) => {
|
|
2083
2091
|
let n = e.endsWith(t), r = e.substring(0, e.lastIndexOf("/")), i = t.substring(0, t.lastIndexOf("/")), a = r !== "" && r.endsWith(i);
|
|
2084
2092
|
return n || a;
|
|
2085
|
-
},
|
|
2093
|
+
}, Mr = (e) => {
|
|
2086
2094
|
let [t, ...n] = e;
|
|
2087
2095
|
if (!t) return;
|
|
2088
2096
|
let r = {
|
|
@@ -2097,7 +2105,7 @@ var cn = class {
|
|
|
2097
2105
|
i.subChapter = t, i = t;
|
|
2098
2106
|
}
|
|
2099
2107
|
return r;
|
|
2100
|
-
},
|
|
2108
|
+
}, Nr = ({ doc: e, node: t, offset: n }) => {
|
|
2101
2109
|
let r = e.createRange();
|
|
2102
2110
|
if (t.nodeType === Node.TEXT_NODE || t.nodeType === Node.CDATA_SECTION_NODE || t.nodeType === Node.COMMENT_NODE) {
|
|
2103
2111
|
let e = t, i = Math.max(0, Math.min(n, e.length));
|
|
@@ -2107,18 +2115,18 @@ var cn = class {
|
|
|
2107
2115
|
r.setStart(t, i);
|
|
2108
2116
|
}
|
|
2109
2117
|
return r.collapse(!0), r;
|
|
2110
|
-
},
|
|
2118
|
+
}, Pr = ({ rangeToTest: e, upperBoundRange: t }) => e.compareBoundaryPoints(Range.START_TO_START, t) < 0, Fr = (e) => {
|
|
2111
2119
|
let t = e.createRange(), n = e.body ?? e.documentElement;
|
|
2112
2120
|
if (n) return t.selectNodeContents(n), t.collapse(!1), t;
|
|
2113
|
-
},
|
|
2121
|
+
}, Ir = ({ anchorNode: e, nextPageNode: t }) => e === t || e.contains(t), Lr = ({ node: e, offset: t, candidates: n, spineItem: r, nextPageEntry: i }) => {
|
|
2114
2122
|
if (!e || t === void 0 || !r || n.length === 0) return;
|
|
2115
2123
|
let a = r.renderer.getDocumentFrame()?.contentDocument;
|
|
2116
2124
|
if (!a || e.ownerDocument !== a) return;
|
|
2117
|
-
let o = i?.firstVisibleNode?.node, s = i?.firstVisibleNode?.offset, c = i ? o !== void 0 && s !== void 0 && o.ownerDocument === a ?
|
|
2125
|
+
let o = i?.firstVisibleNode?.node, s = i?.firstVisibleNode?.offset, c = i ? o !== void 0 && s !== void 0 && o.ownerDocument === a ? Nr({
|
|
2118
2126
|
doc: a,
|
|
2119
2127
|
node: o,
|
|
2120
2128
|
offset: s
|
|
2121
|
-
}) : void 0 :
|
|
2129
|
+
}) : void 0 : Fr(a);
|
|
2122
2130
|
if (!c) return;
|
|
2123
2131
|
let l = i !== void 0 && o !== void 0 && o.ownerDocument === a, u, d, f;
|
|
2124
2132
|
for (let e of n) {
|
|
@@ -2126,119 +2134,123 @@ var cn = class {
|
|
|
2126
2134
|
f = e.chain;
|
|
2127
2135
|
continue;
|
|
2128
2136
|
}
|
|
2129
|
-
let t = a.getElementById(
|
|
2130
|
-
if (!t || l &&
|
|
2137
|
+
let t = a.getElementById(Tr(e.anchorId));
|
|
2138
|
+
if (!t || l && Ir({
|
|
2131
2139
|
anchorNode: t,
|
|
2132
2140
|
nextPageNode: o
|
|
2133
2141
|
})) continue;
|
|
2134
2142
|
let n = a.createRange();
|
|
2135
|
-
n.setStartBefore(t), n.collapse(!0),
|
|
2143
|
+
n.setStartBefore(t), n.collapse(!0), Pr({
|
|
2136
2144
|
rangeToTest: n,
|
|
2137
2145
|
upperBoundRange: c
|
|
2138
2146
|
}) && (!d || n.compareBoundaryPoints(Range.START_TO_START, d) > 0) && (u = e.chain, d = n);
|
|
2139
2147
|
}
|
|
2140
2148
|
let p = u ?? f;
|
|
2141
|
-
return p ?
|
|
2142
|
-
},
|
|
2149
|
+
return p ? Mr(p) : void 0;
|
|
2150
|
+
}, Rr = ({ candidate: e, hrefHasAnchor: t }) => {
|
|
2143
2151
|
if (t || !e.anchorId) return !1;
|
|
2144
2152
|
let n = e.chain[e.chain.length - 1], r = e.chain[e.chain.length - 2];
|
|
2145
|
-
return !n || !r ? !1 :
|
|
2146
|
-
},
|
|
2147
|
-
let r =
|
|
2148
|
-
for (let e of t)
|
|
2153
|
+
return !n || !r ? !1 : Cr(n.path) === Cr(r.path);
|
|
2154
|
+
}, zr = ({ href: e, tocIndex: t, manifest: n }) => {
|
|
2155
|
+
let r = Cr(e), i = e.includes("#"), a = n.spineItems.findIndex((e) => e.href === r), o;
|
|
2156
|
+
for (let e of t) jr(r, e.hrefWithoutAnchor) && (a < e.spineItemIndex || Rr({
|
|
2149
2157
|
candidate: e,
|
|
2150
2158
|
hrefHasAnchor: i
|
|
2151
2159
|
}) || (o = e.chain));
|
|
2152
2160
|
return o;
|
|
2153
|
-
},
|
|
2154
|
-
let { href: r } = n, i =
|
|
2161
|
+
}, Br = (e, t, n) => {
|
|
2162
|
+
let { href: r } = n, i = zr({
|
|
2155
2163
|
href: r,
|
|
2156
2164
|
tocIndex: t,
|
|
2157
2165
|
manifest: e
|
|
2158
2166
|
});
|
|
2159
|
-
return i ?
|
|
2160
|
-
},
|
|
2167
|
+
return i ? Mr(i) : void 0;
|
|
2168
|
+
}, Vr = (e, t) => e ? e.spineItems.reduce((n, r) => (n[r.id] = Br(e, t, r), n), {}) : {}, Hr = (e, t, n) => e + t * n, Ur = (e, t, n) => {
|
|
2161
2169
|
let { height: r, width: i } = n.layoutInfo, { top: a, left: o } = e.spine.getSpineItemSpineLayoutInfo(n);
|
|
2162
2170
|
return e.settings.values.computedPageTurnDirection === "vertical" ? Math.max(0, Math.min(1, (t.y - a + e.viewport.absoluteViewport.height) / r)) : Math.max(0, Math.min(1, (t.x - o + e.viewport.absoluteViewport.width) / i));
|
|
2163
|
-
},
|
|
2171
|
+
}, Wr = (e, t, n, r, i, a) => i.isReady$.pipe(S(), N(e.layoutInfo$), T(([o, s]) => {
|
|
2164
2172
|
let c = a.renditionLayout === "pre-paginated", l = a.spineItems.length || 0, u = a.spineItems.slice(0, t).reduce((e, t) => e + (t.progressionWeight ?? 0), 0) || 0, d = e.spineItemsManager.getSpineItemIndex(i) ?? 0, f = a.spineItems.length ?? 0, p = s.pages.filter((e) => e.itemIndex === d).length ?? 0, m = a.spineItems[t]?.progressionWeight ?? (d + 1) / f, h = (n + 1) * (m / p);
|
|
2165
2173
|
!c && i.renditionLayout === "reflowable" && !o && (h = 0);
|
|
2166
2174
|
let g = u + h;
|
|
2167
|
-
return a.renditionFlow === "scrolled-continuous" && (h = o ?
|
|
2168
|
-
})),
|
|
2169
|
-
let
|
|
2170
|
-
node: a?.firstVisibleNode?.node,
|
|
2171
|
-
offset: a?.firstVisibleNode?.offset,
|
|
2172
|
-
candidates: r.tocCandidatesBySpineHref.get(e.item.href) ?? [],
|
|
2173
|
-
spineItem: e,
|
|
2174
|
-
nextPageEntry: o
|
|
2175
|
-
}) : void 0, u = t ? Fr({
|
|
2176
|
-
node: s?.firstVisibleNode?.node,
|
|
2177
|
-
offset: s?.firstVisibleNode?.offset,
|
|
2178
|
-
candidates: r.tocCandidatesBySpineHref.get(t.item.href) ?? [],
|
|
2179
|
-
spineItem: t,
|
|
2180
|
-
nextPageEntry: c
|
|
2181
|
-
}) : void 0;
|
|
2175
|
+
return a.renditionFlow === "scrolled-continuous" && (h = o ? Ur(e, r, i) : 0, g = Hr(u, m, h)), t === l - 1 && n === p - 1 && g > .99 ? 1 : g;
|
|
2176
|
+
})), Gr = ({ spineItem: e, pageIndexInSpineItem: t, chaptersData: n, pagesState: r }) => {
|
|
2177
|
+
let i = e && t !== void 0 ? Sr.fromSpineItemPageIndex(r, e.index, t) : void 0;
|
|
2182
2178
|
return {
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2179
|
+
chapterInfo: (e ? Lr({
|
|
2180
|
+
node: i?.firstVisibleNode?.node,
|
|
2181
|
+
offset: i?.firstVisibleNode?.offset,
|
|
2182
|
+
candidates: n.tocCandidatesBySpineHref.get(e.item.href) ?? [],
|
|
2183
|
+
spineItem: e,
|
|
2184
|
+
nextPageEntry: i ? Sr.fromNextPageWithinSameSpineItem(r, i) : void 0
|
|
2185
|
+
}) : void 0) ?? (e ? n.chaptersInfo[e.item.id] : void 0),
|
|
2186
|
+
spineItemReadingDirection: e?.readingDirection,
|
|
2187
|
+
absolutePageIndex: i?.absolutePageIndex
|
|
2189
2188
|
};
|
|
2190
|
-
},
|
|
2189
|
+
}, Kr = ({ items: e, pagesState: t }) => {
|
|
2191
2190
|
let n = e.map(() => 0);
|
|
2192
2191
|
for (let e of t.pages) n[e.itemIndex] = (n[e.itemIndex] ?? 0) + 1;
|
|
2193
2192
|
return {
|
|
2194
2193
|
numberOfPagesPerItems: n,
|
|
2195
2194
|
numberOfTotalPages: t.pages.length
|
|
2196
2195
|
};
|
|
2197
|
-
},
|
|
2198
|
-
let i = e.spineItemsManager.get(t.
|
|
2199
|
-
return i ?
|
|
2200
|
-
},
|
|
2201
|
-
let t =
|
|
2196
|
+
}, qr = (e, t) => e.numberOfTotalPages !== t.numberOfTotalPages || e.numberOfPagesPerItems.length !== t.numberOfPagesPerItems.length ? !1 : e.numberOfPagesPerItems.every((e, n) => e === t.numberOfPagesPerItems[n]), Jr = ({ reader: e, paginationInfo: t, navigationPosition: n, manifest: r }) => {
|
|
2197
|
+
let i = e.spineItemsManager.get(t.end.spineItemIndex);
|
|
2198
|
+
return i ? Wr(e, t.end.spineItemIndex ?? 0, t.end.pageIndexInSpineItem || 0, n, i, r) : D(0);
|
|
2199
|
+
}, Yr = (e) => D(e.context.manifest).pipe(T((e) => {
|
|
2200
|
+
let t = Or(e.nav?.toc ?? [], e);
|
|
2202
2201
|
return {
|
|
2203
|
-
tocCandidatesBySpineHref:
|
|
2202
|
+
tocCandidatesBySpineHref: kr({
|
|
2204
2203
|
manifest: e,
|
|
2205
2204
|
tocIndex: t
|
|
2206
2205
|
}),
|
|
2207
|
-
chaptersInfo:
|
|
2206
|
+
chaptersInfo: Vr(e, t)
|
|
2208
2207
|
};
|
|
2209
|
-
})),
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2208
|
+
})), Xr = ({ spineItemIndex: e, pageIndexInSpineItem: t }) => ({
|
|
2209
|
+
spineItemIndex: e,
|
|
2210
|
+
pageIndexInSpineItem: t
|
|
2211
|
+
}), Zr = (e) => ({
|
|
2212
|
+
begin: Xr(e.begin),
|
|
2213
|
+
end: Xr(e.end)
|
|
2214
|
+
}), Qr = (e) => {
|
|
2215
|
+
let t = e.pagination.state$, n = e.spine.pages.layout$, r = Yr(e).pipe(k({
|
|
2216
2216
|
bufferSize: 1,
|
|
2217
2217
|
refCount: !0
|
|
2218
2218
|
})), i = v([
|
|
2219
|
-
t.pipe(T(
|
|
2219
|
+
t.pipe(T(Zr), b(gr)),
|
|
2220
2220
|
r,
|
|
2221
2221
|
n
|
|
2222
|
-
]).pipe(T(([t, n, r]) =>
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2222
|
+
]).pipe(T(([t, n, r]) => {
|
|
2223
|
+
let i = (t) => Gr({
|
|
2224
|
+
spineItem: e.spineItemsManager.get(t.spineItemIndex),
|
|
2225
|
+
pageIndexInSpineItem: t.pageIndexInSpineItem,
|
|
2226
|
+
chaptersData: n,
|
|
2227
|
+
pagesState: r
|
|
2228
|
+
});
|
|
2229
|
+
return {
|
|
2230
|
+
begin: i(t.begin),
|
|
2231
|
+
end: i(t.end)
|
|
2232
|
+
};
|
|
2233
|
+
}), k({
|
|
2229
2234
|
bufferSize: 1,
|
|
2230
2235
|
refCount: !0
|
|
2231
2236
|
})), a = v([
|
|
2232
2237
|
t,
|
|
2233
2238
|
e.settings.watch(["computedSpreadMode"]).pipe(T((e) => e.computedSpreadMode ?? !1), b()),
|
|
2234
2239
|
i,
|
|
2235
|
-
n.pipe(T((t) =>
|
|
2240
|
+
n.pipe(T((t) => Kr({
|
|
2236
2241
|
items: e.spineItemsManager.items,
|
|
2237
2242
|
pagesState: t
|
|
2238
|
-
})), b(
|
|
2243
|
+
})), b(qr))
|
|
2239
2244
|
]).pipe(T(([e, t, n, r]) => ({
|
|
2240
2245
|
...e,
|
|
2241
|
-
|
|
2246
|
+
begin: {
|
|
2247
|
+
...e.begin,
|
|
2248
|
+
...n.begin
|
|
2249
|
+
},
|
|
2250
|
+
end: {
|
|
2251
|
+
...e.end,
|
|
2252
|
+
...n.end
|
|
2253
|
+
},
|
|
2242
2254
|
isUsingSpread: t,
|
|
2243
2255
|
...r
|
|
2244
2256
|
}))), s = Jn(e.navigation).pipe(T(({ position: e }) => e), b(o));
|
|
@@ -2246,7 +2258,7 @@ var cn = class {
|
|
|
2246
2258
|
t,
|
|
2247
2259
|
e.layout$,
|
|
2248
2260
|
s
|
|
2249
|
-
]).pipe(A(([t, n, r]) =>
|
|
2261
|
+
]).pipe(A(([t, n, r]) => Jr({
|
|
2250
2262
|
reader: e,
|
|
2251
2263
|
paginationInfo: t,
|
|
2252
2264
|
navigationPosition: r,
|
|
@@ -2254,41 +2266,38 @@ var cn = class {
|
|
|
2254
2266
|
})), T((e) => ({ percentageEstimateOfBook: e })))]).pipe(T(([e, t]) => ({
|
|
2255
2267
|
...e,
|
|
2256
2268
|
...t
|
|
2257
|
-
})), b(
|
|
2258
|
-
},
|
|
2259
|
-
let n = e(t), r =
|
|
2269
|
+
})), b(gr), g(5));
|
|
2270
|
+
}, $r = (e) => (t) => {
|
|
2271
|
+
let n = e(t), r = (e) => ({
|
|
2272
|
+
...e,
|
|
2273
|
+
chapterInfo: void 0,
|
|
2274
|
+
spineItemReadingDirection: void 0,
|
|
2275
|
+
absolutePageIndex: 0
|
|
2276
|
+
}), i = new l({
|
|
2260
2277
|
...n.pagination.state,
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
beginPageIndexInSpineItem: void 0,
|
|
2278
|
+
begin: r(n.pagination.state.begin),
|
|
2279
|
+
end: r(n.pagination.state.end),
|
|
2264
2280
|
isUsingSpread: !1,
|
|
2265
|
-
beginAbsolutePageIndex: 0,
|
|
2266
|
-
endAbsolutePageIndex: 0,
|
|
2267
2281
|
numberOfTotalPages: 0,
|
|
2268
|
-
beginSpineItemReadingDirection: void 0,
|
|
2269
|
-
beginSpineItemIndex: void 0,
|
|
2270
|
-
endCfi: void 0,
|
|
2271
|
-
endChapterInfo: void 0,
|
|
2272
|
-
endSpineItemReadingDirection: void 0,
|
|
2273
2282
|
percentageEstimateOfBook: 0
|
|
2274
|
-
}),
|
|
2283
|
+
}), a = new mr(n), o = Qr(n).pipe(M((e) => L.log("Pagination", e))).subscribe(i);
|
|
2275
2284
|
return {
|
|
2276
2285
|
...n,
|
|
2277
|
-
locateResource:
|
|
2286
|
+
locateResource: a.locateResource.bind(a),
|
|
2278
2287
|
destroy: () => {
|
|
2279
|
-
|
|
2288
|
+
o.unsubscribe(), n.destroy();
|
|
2280
2289
|
},
|
|
2281
2290
|
pagination: {
|
|
2282
2291
|
...n.pagination,
|
|
2283
2292
|
get state() {
|
|
2284
|
-
return
|
|
2293
|
+
return i.value;
|
|
2285
2294
|
},
|
|
2286
2295
|
get state$() {
|
|
2287
|
-
return
|
|
2296
|
+
return i;
|
|
2288
2297
|
}
|
|
2289
2298
|
}
|
|
2290
2299
|
};
|
|
2291
|
-
},
|
|
2300
|
+
}, ei = (e, t) => {
|
|
2292
2301
|
let n = e.node.ownerDocument?.createRange(), r = e.node.compareDocumentPosition(t.node);
|
|
2293
2302
|
if (n) {
|
|
2294
2303
|
try {
|
|
@@ -2306,10 +2315,10 @@ var cn = class {
|
|
|
2306
2315
|
}
|
|
2307
2316
|
return n;
|
|
2308
2317
|
}
|
|
2309
|
-
},
|
|
2318
|
+
}, ti = ({ selection: e, spineItem: t }) => {
|
|
2310
2319
|
let { anchorNode: n, anchorOffset: r, focusNode: i, focusOffset: a } = e;
|
|
2311
2320
|
if (!(!n || !i)) try {
|
|
2312
|
-
return
|
|
2321
|
+
return ei({
|
|
2313
2322
|
node: n,
|
|
2314
2323
|
offset: r
|
|
2315
2324
|
}, {
|
|
@@ -2323,7 +2332,7 @@ var cn = class {
|
|
|
2323
2332
|
});
|
|
2324
2333
|
return;
|
|
2325
2334
|
}
|
|
2326
|
-
},
|
|
2335
|
+
}, ni = class extends Q {
|
|
2327
2336
|
constructor(e) {
|
|
2328
2337
|
super();
|
|
2329
2338
|
let t = e.contentDocument || e.contentWindow?.document;
|
|
@@ -2339,10 +2348,10 @@ var cn = class {
|
|
|
2339
2348
|
}), x(K))), j(E(r, this.destroy$)));
|
|
2340
2349
|
}
|
|
2341
2350
|
}
|
|
2342
|
-
},
|
|
2351
|
+
}, ri = (e) => e.watch("isLoaded").pipe(A(() => {
|
|
2343
2352
|
let t = e.renderer.getDocumentFrame(), n = t?.contentDocument || t?.contentWindow?.document;
|
|
2344
2353
|
if (!t || !n) return d;
|
|
2345
|
-
let r = new
|
|
2354
|
+
let r = new ni(t);
|
|
2346
2355
|
return E(r.selectionChange$.pipe(T((e) => {
|
|
2347
2356
|
if (e?.toString()) return {
|
|
2348
2357
|
type: "change",
|
|
@@ -2355,10 +2364,10 @@ var cn = class {
|
|
|
2355
2364
|
})))).pipe(j(e.unloaded$), ae(void 0), se(() => {
|
|
2356
2365
|
r.destroy();
|
|
2357
2366
|
}));
|
|
2358
|
-
}), b()),
|
|
2367
|
+
}), b()), ii = (e) => (t) => {
|
|
2359
2368
|
let n = e(t), r, i = E(...n.spineItemsManager.items.map((e) => {
|
|
2360
2369
|
let t = n.spineItemsManager.getSpineItemIndex(e) ?? 0;
|
|
2361
|
-
return
|
|
2370
|
+
return ri(e).pipe(T((e) => {
|
|
2362
2371
|
if (e) return {
|
|
2363
2372
|
...e,
|
|
2364
2373
|
itemIndex: t
|
|
@@ -2382,10 +2391,10 @@ var cn = class {
|
|
|
2382
2391
|
selectionOver$: c,
|
|
2383
2392
|
lastSelectionOnPointerdown$: l,
|
|
2384
2393
|
getSelection: () => r,
|
|
2385
|
-
createOrderedRangeFromSelection:
|
|
2394
|
+
createOrderedRangeFromSelection: ti
|
|
2386
2395
|
}
|
|
2387
2396
|
};
|
|
2388
|
-
},
|
|
2397
|
+
}, ai = [
|
|
2389
2398
|
{
|
|
2390
2399
|
name: "bright",
|
|
2391
2400
|
backgroundColor: "white"
|
|
@@ -2400,9 +2409,9 @@ var cn = class {
|
|
|
2400
2409
|
backgroundColor: "#191717",
|
|
2401
2410
|
foregroundColor: "#f1ebeb"
|
|
2402
2411
|
}
|
|
2403
|
-
],
|
|
2412
|
+
], oi = (e) => (t) => {
|
|
2404
2413
|
let n = e(t), r = new l(t.theme ?? "bright"), i = () => {
|
|
2405
|
-
let e =
|
|
2414
|
+
let e = ai.find((e) => e.name === r.value);
|
|
2406
2415
|
return `
|
|
2407
2416
|
body {
|
|
2408
2417
|
${e === void 0 ? "" : `background-color: ${e.backgroundColor} !important;`}
|
|
@@ -2415,7 +2424,7 @@ var cn = class {
|
|
|
2415
2424
|
` : ""}
|
|
2416
2425
|
`;
|
|
2417
2426
|
}, a = ({ container: e }) => {
|
|
2418
|
-
let t =
|
|
2427
|
+
let t = ai.find((e) => e.name === r.value);
|
|
2419
2428
|
return t && z(e.style, "background-color", t.backgroundColor), () => {};
|
|
2420
2429
|
}, o = () => {
|
|
2421
2430
|
n.spineItemsManager.items.forEach((e) => {
|
|
@@ -2441,7 +2450,7 @@ var cn = class {
|
|
|
2441
2450
|
$: { theme$: r.asObservable() }
|
|
2442
2451
|
}
|
|
2443
2452
|
};
|
|
2444
|
-
},
|
|
2453
|
+
}, si = (e) => (t) => {
|
|
2445
2454
|
let n = e(t), r = (e) => !!(Ze(e) && (e.nodeName === "a" ? e : e.closest("a"))?.getAttribute("href")), i = (e, t, r) => {
|
|
2446
2455
|
let i = r.replace("${id}", n.id);
|
|
2447
2456
|
return $e(e, `${t}-${n.id}`, i);
|
|
@@ -2455,7 +2464,7 @@ var cn = class {
|
|
|
2455
2464
|
};
|
|
2456
2465
|
};
|
|
2457
2466
|
navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome");
|
|
2458
|
-
var
|
|
2467
|
+
var ci = (e) => (t) => e(t), li = (e, t, n) => {
|
|
2459
2468
|
let { clientWidth: r, clientHeight: i } = n.value.element, a = {
|
|
2460
2469
|
maxX: 0,
|
|
2461
2470
|
minX: r * (1 - t),
|
|
@@ -2466,25 +2475,25 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2466
2475
|
x: Math.min(Math.max(e.x, a.minX), a.maxX),
|
|
2467
2476
|
y: Math.min(Math.max(e.y, a.minY), a.maxY)
|
|
2468
2477
|
};
|
|
2469
|
-
},
|
|
2478
|
+
}, ui = (e, t, n) => {
|
|
2470
2479
|
z(n.style, "transform-origin", "0 0");
|
|
2471
2480
|
let r = `translate3d(${t.x}px, ${t.y}px, 0px)`, i = `scale(${e})`;
|
|
2472
2481
|
z(n.style, "transform", `${r} ${i}`);
|
|
2473
|
-
},
|
|
2482
|
+
}, di = (e, t, n, r) => {
|
|
2474
2483
|
let i = t / e, a = n.clientWidth, o = n.clientHeight, s = a / 2 - r.x, c = o / 2 - r.y;
|
|
2475
2484
|
return {
|
|
2476
2485
|
x: r.x + s * (1 - i),
|
|
2477
2486
|
y: r.y + c * (1 - i)
|
|
2478
2487
|
};
|
|
2479
|
-
},
|
|
2488
|
+
}, fi = class {
|
|
2480
2489
|
constructor(e) {
|
|
2481
2490
|
this.x = e.x, this.y = e.y;
|
|
2482
2491
|
}
|
|
2483
|
-
},
|
|
2492
|
+
}, pi = class extends fi {}, mi = class extends fi {
|
|
2484
2493
|
constructor(...e) {
|
|
2485
2494
|
super(...e), this.__symbol = Symbol("UnboundScrollPosition");
|
|
2486
2495
|
}
|
|
2487
|
-
},
|
|
2496
|
+
}, hi = class extends U {
|
|
2488
2497
|
constructor(e, t, n, r, i) {
|
|
2489
2498
|
super({ element: void 0 }), this.viewport = e, this.settings = t, this.hookManager = n, this.spine = r, this.context = i, this.navigateSubject = new m(), this.scrollingSubject = new l(!1), this.applyNavigationPosition = ({ position: e }) => {
|
|
2490
2499
|
let t = this.value.element;
|
|
@@ -2527,30 +2536,30 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2527
2536
|
}
|
|
2528
2537
|
fromSpinePosition(e) {
|
|
2529
2538
|
let t = this.viewport.scaleFactor;
|
|
2530
|
-
return new
|
|
2539
|
+
return new pi({
|
|
2531
2540
|
x: e.x * t,
|
|
2532
2541
|
y: e.y * t
|
|
2533
2542
|
});
|
|
2534
2543
|
}
|
|
2535
2544
|
get scrollPosition() {
|
|
2536
2545
|
let e = this.value.element;
|
|
2537
|
-
return new
|
|
2546
|
+
return new pi({
|
|
2538
2547
|
x: e?.scrollLeft ?? 0,
|
|
2539
2548
|
y: e?.scrollTop ?? 0
|
|
2540
2549
|
});
|
|
2541
2550
|
}
|
|
2542
|
-
},
|
|
2551
|
+
}, gi = (e, t, n, r, i) => {
|
|
2543
2552
|
let a = e.clientWidth, o = e.clientHeight, s = e.scrollLeft, c = e.scrollTop, l = s + a / 2 - r, u = c + o / 2 - i, d = n / t, f = l * d, p = u * d;
|
|
2544
|
-
return new
|
|
2553
|
+
return new mi({
|
|
2545
2554
|
x: f - a / 2 + r,
|
|
2546
2555
|
y: p - o / 2 + i
|
|
2547
2556
|
});
|
|
2548
|
-
},
|
|
2549
|
-
let n = t.viewport, r = t.navigation.scrollNavigationController, i = n.value.element, a = r.value.element, o = r.value.element, s = Math.round(n.scaleFactor * 100) / 100, c = i.offsetLeft, l = i.offsetTop, u =
|
|
2557
|
+
}, _i = (e, t) => {
|
|
2558
|
+
let n = t.viewport, r = t.navigation.scrollNavigationController, i = n.value.element, a = r.value.element, o = r.value.element, s = Math.round(n.scaleFactor * 100) / 100, c = i.offsetLeft, l = i.offsetTop, u = gi(a ?? qe(), s, e, c, l), d = e < 1 ? "down" : "up";
|
|
2550
2559
|
o && R(o, `data-${X}-zooming-direction`, d), e < 1 ? z(i.style, "transform-origin", "top") : e > 1 && z(i.style, "transform-origin", `${c}px ${l}px`), z(i.style, "transform", `scale(${e})`);
|
|
2551
2560
|
let f = r.fromScrollPosition(u);
|
|
2552
2561
|
t.navigation.navigate({ position: f });
|
|
2553
|
-
},
|
|
2562
|
+
}, vi = 200, yi = class extends U {
|
|
2554
2563
|
constructor(e) {
|
|
2555
2564
|
super({
|
|
2556
2565
|
isZooming: !1,
|
|
@@ -2563,24 +2572,24 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2563
2572
|
let { scale: t = 1, animate: n = !1 } = e ?? {}, r = this.reader.viewport.value.element;
|
|
2564
2573
|
R(this.viewport.element, `data-${X}-zooming`, "true");
|
|
2565
2574
|
let i = this.scrollNavigationController.value.element;
|
|
2566
|
-
return i && R(i, `data-${X}-zooming`, this.isControlled ? "false" : "true"), n && this.isControlled && z(r.style, "transition", `transform ${
|
|
2575
|
+
return i && R(i, `data-${X}-zooming`, this.isControlled ? "false" : "true"), n && this.isControlled && z(r.style, "transition", `transform ${vi}ms`), this.mergeCompare({
|
|
2567
2576
|
isZooming: !0,
|
|
2568
2577
|
currentScale: 1,
|
|
2569
2578
|
currentPosition: {
|
|
2570
2579
|
x: 0,
|
|
2571
2580
|
y: 0
|
|
2572
2581
|
}
|
|
2573
|
-
}), this.updateZoom(t), t !== 1 && this.isControlled ? ve(e?.animate ?
|
|
2582
|
+
}), this.updateZoom(t), t !== 1 && this.isControlled ? ve(e?.animate ? vi : 0).pipe(M(() => {
|
|
2574
2583
|
this.reader.layout();
|
|
2575
2584
|
})) : u;
|
|
2576
2585
|
})), this.exitSubject.pipe(A((e) => {
|
|
2577
2586
|
let t = this.reader.viewport.value.element;
|
|
2578
2587
|
R(this.viewport.element, `data-${X}-zooming`, "false");
|
|
2579
2588
|
let n = this.scrollNavigationController.value.element;
|
|
2580
|
-
return n && (Ie(n, `data-${X}-zooming-direction`), R(n, `data-${X}-zooming`, "false")), e?.animate && this.isControlled && z(t.style, "transition", `transform ${
|
|
2589
|
+
return n && (Ie(n, `data-${X}-zooming-direction`), R(n, `data-${X}-zooming`, "false")), e?.animate && this.isControlled && z(t.style, "transition", `transform ${vi}ms`), this.updateZoom(1, {
|
|
2581
2590
|
x: 0,
|
|
2582
2591
|
y: 0
|
|
2583
|
-
}), B(t.style, "transform"), this.mergeCompare({ isZooming: !1 }), ve(e?.animate ?
|
|
2592
|
+
}), B(t.style, "transform"), this.mergeCompare({ isZooming: !1 }), ve(e?.animate ? vi : 0).pipe(M(() => {
|
|
2584
2593
|
let e = this.reader.viewport.value.element;
|
|
2585
2594
|
B(e.style, "transform-origin"), B(e.style, "transition"), this.isControlled && this.reader.layout();
|
|
2586
2595
|
}), j(this.enterSubject));
|
|
@@ -2593,17 +2602,17 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2593
2602
|
this.exitSubject.next(e);
|
|
2594
2603
|
}
|
|
2595
2604
|
move(e, t) {
|
|
2596
|
-
this.isControlled && (B(this.viewport.element.style, "transition"), this.updateZoom(this.value.currentScale, e, { constraints: t?.constrain === "within-viewport" ? (...e) =>
|
|
2605
|
+
this.isControlled && (B(this.viewport.element.style, "transition"), this.updateZoom(this.value.currentScale, e, { constraints: t?.constrain === "within-viewport" ? (...e) => li(...e, this.reader.viewport) : void 0 }));
|
|
2597
2606
|
}
|
|
2598
2607
|
scaleAt(e, t) {
|
|
2599
2608
|
if (!this.value.isZooming) return;
|
|
2600
2609
|
B(this.viewport.element.style, "transition");
|
|
2601
2610
|
let n = Math.ceil(e * 100) / 100;
|
|
2602
|
-
this.updateZoom(n, void 0, { constraints: t?.constrain === "within-viewport" ? (...e) =>
|
|
2611
|
+
this.updateZoom(n, void 0, { constraints: t?.constrain === "within-viewport" ? (...e) => li(...e, this.reader.viewport) : void 0 });
|
|
2603
2612
|
}
|
|
2604
2613
|
updateZoom(e, t, n) {
|
|
2605
2614
|
if (this.isControlled) {
|
|
2606
|
-
let r = t ||
|
|
2615
|
+
let r = t || di(this.value.currentScale, e, this.viewport.element, this.value.currentPosition), i = n?.constraints?.(r, e) ?? r;
|
|
2607
2616
|
return this.applyZoom(e, i), this.mergeCompare({
|
|
2608
2617
|
currentScale: e,
|
|
2609
2618
|
currentPosition: i
|
|
@@ -2612,7 +2621,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2612
2621
|
this.applyZoom(e, t ?? this.value.currentPosition), this.mergeCompare({ currentScale: e });
|
|
2613
2622
|
}
|
|
2614
2623
|
applyZoom(e, t) {
|
|
2615
|
-
this.isControlled ?
|
|
2624
|
+
this.isControlled ? ui(e, t, this.viewport.element) : _i(e, this.reader), this.reader.viewport.layout();
|
|
2616
2625
|
}
|
|
2617
2626
|
get isControlled() {
|
|
2618
2627
|
return this.reader.settings.values.computedPageTurnMode === "controlled";
|
|
@@ -2623,8 +2632,8 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2623
2632
|
get viewport() {
|
|
2624
2633
|
return this.reader.viewport.value;
|
|
2625
2634
|
}
|
|
2626
|
-
},
|
|
2627
|
-
let n = e(t), r = new
|
|
2635
|
+
}, bi = (e) => (t) => {
|
|
2636
|
+
let n = e(t), r = new yi(n), i = () => {
|
|
2628
2637
|
r.destroy(), n.destroy();
|
|
2629
2638
|
}, a = r;
|
|
2630
2639
|
return {
|
|
@@ -2641,12 +2650,12 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2641
2650
|
}
|
|
2642
2651
|
}
|
|
2643
2652
|
};
|
|
2644
|
-
},
|
|
2653
|
+
}, xi = (e) => Ae({
|
|
2645
2654
|
spineIndex: e.index,
|
|
2646
2655
|
spineId: e.id
|
|
2647
|
-
}),
|
|
2656
|
+
}), Si = ({ nodeOrRange: e, offset: t, item: n }) => {
|
|
2648
2657
|
let r = "ownerDocument" in e ? e.ownerDocument : e.startContainer.ownerDocument;
|
|
2649
|
-
return !r?.documentElement || e === r ?
|
|
2658
|
+
return !r?.documentElement || e === r ? xi(n) : Qe(e) ? Ae({
|
|
2650
2659
|
start: {
|
|
2651
2660
|
node: e.startContainer,
|
|
2652
2661
|
offset: e.startOffset,
|
|
@@ -2665,22 +2674,22 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2665
2674
|
spineIndex: n.index,
|
|
2666
2675
|
spineId: n.id
|
|
2667
2676
|
});
|
|
2668
|
-
},
|
|
2677
|
+
}, Ci = ({ spineItem: e, pageNode: t }) => Si({
|
|
2669
2678
|
nodeOrRange: t.node,
|
|
2670
2679
|
offset: t.offset,
|
|
2671
2680
|
item: e
|
|
2672
|
-
}).trim(),
|
|
2681
|
+
}).trim(), wi = (e, t) => Si({
|
|
2673
2682
|
nodeOrRange: e,
|
|
2674
2683
|
item: t
|
|
2675
|
-
}),
|
|
2676
|
-
let t = Ne(e), n = ((
|
|
2684
|
+
}), Ti = (e) => e.index.toString(), Ei = (e) => e[0]?.index === 6 && e.length > 1, Di = (e) => je(Ne(e)), Oi = (e) => Array.isArray(e) ? e[0] && Ei(e[0]) ? e[0] : void 0 : e.parent[0] && Ei(e.parent[0]) ? e.parent[0] : void 0, ki = (e) => {
|
|
2685
|
+
let t = Ne(e), n = ((Oi(t) ?? [])[1]?.index ?? 2) / 2 - 1, r = Me(t);
|
|
2677
2686
|
return {
|
|
2678
2687
|
isCfiRange: r,
|
|
2679
2688
|
itemIndex: n,
|
|
2680
2689
|
offset: (r ? t.end.at(-1)?.at(-1)?.offset : t.at(-1)?.at(-1)?.offset) ?? 0
|
|
2681
2690
|
};
|
|
2682
|
-
},
|
|
2683
|
-
let { itemIndex: n, ...r } =
|
|
2691
|
+
}, Ai = ({ cfi: e, spineItemsManager: t }) => {
|
|
2692
|
+
let { itemIndex: n, ...r } = ki(e), i = t.get(n);
|
|
2684
2693
|
if (!i) return {
|
|
2685
2694
|
...r,
|
|
2686
2695
|
itemIndex: n,
|
|
@@ -2715,27 +2724,27 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2715
2724
|
spineItem: i,
|
|
2716
2725
|
node: null
|
|
2717
2726
|
};
|
|
2718
|
-
},
|
|
2727
|
+
}, ji = class {
|
|
2719
2728
|
constructor(e, t) {
|
|
2720
2729
|
this.hookManager = e, this.spineItemsManager = t, this.transformForResolve = (e) => {
|
|
2721
2730
|
let { finalParams: t } = this.hookManager.executeSequential("cfi.beforeResolve", { cfi: e }, (e, t) => ({ cfi: t ?? e.cfi }));
|
|
2722
2731
|
return t.cfi;
|
|
2723
|
-
}, this.parseCfi = (e) =>
|
|
2732
|
+
}, this.parseCfi = (e) => ki(this.transformForResolve(e)), this.getSpineItemFromCfi = (e) => {
|
|
2724
2733
|
let { itemIndex: t } = this.parseCfi(e);
|
|
2725
2734
|
if (t !== void 0) return this.spineItemsManager.get(t);
|
|
2726
|
-
}, this.isRootCfi = (e) =>
|
|
2727
|
-
cfi:
|
|
2735
|
+
}, this.isRootCfi = (e) => Di(e), this.generateRootCfi = (e) => this.transformGeneratedCfi({
|
|
2736
|
+
cfi: xi(e),
|
|
2728
2737
|
spineItem: e
|
|
2729
2738
|
}), this.generateCfiForSpineItemPage = ({ spineItem: e, pageNode: t }) => this.transformGeneratedCfi({
|
|
2730
|
-
cfi:
|
|
2739
|
+
cfi: Ci({
|
|
2731
2740
|
spineItem: e,
|
|
2732
2741
|
pageNode: t
|
|
2733
2742
|
}),
|
|
2734
2743
|
spineItem: e
|
|
2735
2744
|
}), this.generateCfiFromRange = (e, t) => this.transformGeneratedCfi({
|
|
2736
|
-
cfi:
|
|
2745
|
+
cfi: wi(e, t),
|
|
2737
2746
|
spineItem: t
|
|
2738
|
-
}), this.resolveCfi = (e) =>
|
|
2747
|
+
}), this.resolveCfi = (e) => Ai({
|
|
2739
2748
|
...e,
|
|
2740
2749
|
cfi: this.transformForResolve(e.cfi),
|
|
2741
2750
|
spineItemsManager: this.spineItemsManager
|
|
@@ -2748,17 +2757,17 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2748
2757
|
}));
|
|
2749
2758
|
return t.cfi;
|
|
2750
2759
|
}
|
|
2751
|
-
},
|
|
2760
|
+
}, Mi = (e) => e.spineItems.every((t) => (t.renditionLayout ?? e.renditionLayout) === "pre-paginated"), Ni = class {
|
|
2752
2761
|
constructor() {
|
|
2753
2762
|
this.navigationSubject = new p(1), this.positionSubject = new p(1), this.viewportStateSubject = new l("free"), this.paginationSubject = new p(1), this.pagination$ = this.paginationSubject.asObservable(), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(x((e) => e === "free")), this.viewportBusy$ = this.viewportState$.pipe(x((e) => e === "busy")), this.navigation$ = this.navigationSubject.asObservable(), this.position$ = this.positionSubject.asObservable();
|
|
2754
2763
|
}
|
|
2755
|
-
},
|
|
2764
|
+
}, Pi = class extends U {
|
|
2756
2765
|
constructor(e, t = globalThis.document) {
|
|
2757
2766
|
super({
|
|
2758
2767
|
manifest: e,
|
|
2759
2768
|
assumedRenditionLayout: e.renditionLayout ?? "reflowable",
|
|
2760
|
-
isFullyPrePaginated:
|
|
2761
|
-
}), this.bridgeEvent = new
|
|
2769
|
+
isFullyPrePaginated: Mi(e)
|
|
2770
|
+
}), this.bridgeEvent = new Ni(), this.isRTL = () => this.value.manifest.readingDirection === "rtl", this.document = t;
|
|
2762
2771
|
}
|
|
2763
2772
|
update(e) {
|
|
2764
2773
|
this.mergeCompare(e);
|
|
@@ -2769,7 +2778,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2769
2778
|
get readingDirection() {
|
|
2770
2779
|
return this.manifest.readingDirection;
|
|
2771
2780
|
}
|
|
2772
|
-
},
|
|
2781
|
+
}, Fi = class extends U {
|
|
2773
2782
|
constructor(e, t) {
|
|
2774
2783
|
super({
|
|
2775
2784
|
supportedPageTurnAnimation: [
|
|
@@ -2796,7 +2805,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2796
2805
|
supportedPageTurnDirection: r === "scrollable" ? ["vertical"] : n === "reflowable" ? ["horizontal"] : ["horizontal", "vertical"]
|
|
2797
2806
|
})), j(this.destroy$)).subscribe(this.next.bind(this));
|
|
2798
2807
|
}
|
|
2799
|
-
},
|
|
2808
|
+
}, Ii = class {
|
|
2800
2809
|
constructor() {
|
|
2801
2810
|
this._hooks = [], this._hookExecutions = [];
|
|
2802
2811
|
}
|
|
@@ -2879,16 +2888,16 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2879
2888
|
let r = this._hookExecutions.filter((r) => n && r.ref === n || e === r.name && (!t || t && t === r.id));
|
|
2880
2889
|
return this._hookExecutions = this._hookExecutions.filter((e) => !r.includes(e)), v(r.map(({ destroyFn: e }) => e()));
|
|
2881
2890
|
}
|
|
2882
|
-
},
|
|
2891
|
+
}, Li = "[data-prose-reader-spine-item][data-is-ready=false]{pointer-events:none;-webkit-user-select:none;user-select:none}.prose-reader-enhancer-loading-container{width:100%;height:100%;max-width:var(--prose-reader-absolute-viewport-width,100%);text-align:center;color:#cacaca;z-index:1;background-color:#fff;flex-direction:column;justify-content:center;align-items:center;display:flex;position:absolute;top:0;left:0}[data-prose-reader-spine-item][data-is-ready=true] .prose-reader-enhancer-loading-container{visibility:hidden;z-index:0}.prose-reader-enhancer-loading-logo{font-size:4em}.prose-reader-enhancer-loading-details{text-overflow:ellipsis;white-space:nowrap;width:80%;max-width:300px;font-size:1.2em;overflow:hidden}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}[data-prose-reader-scroll-navigator]{width:100%;height:100%;position:relative;overflow:hidden scroll}[data-prose-reader-viewport]{background-color:#fff;width:100%;height:100%;position:relative}.prose-reader-reader{background-color:#fff;position:relative;overflow:hidden}", Ri = (e) => ({
|
|
2883
2892
|
x: -e.x,
|
|
2884
2893
|
y: -e.y
|
|
2885
|
-
}),
|
|
2894
|
+
}), zi = (e) => e instanceof DOMMatrix ? new J({
|
|
2886
2895
|
x: -e.e,
|
|
2887
2896
|
y: -e.f
|
|
2888
2897
|
}) : new J({
|
|
2889
2898
|
x: -e.x,
|
|
2890
2899
|
y: -e.y
|
|
2891
|
-
}),
|
|
2900
|
+
}), Bi = L.namespace("navigation/ControlledNavigationController"), Vi = class extends Q {
|
|
2892
2901
|
constructor(e, t, n, r, i) {
|
|
2893
2902
|
super(), this.settings = e, this.hookManager = t, this.context = n, this.spine = r, this.viewport = i, this.navigateSubject = new m(), this.isActive = () => this.settings.values.computedPageTurnMode === "controlled", this.getNavigationVisibleArea = () => this.viewport.absoluteViewport, this.element$ = new l(n.document.createElement("div"));
|
|
2894
2903
|
let o = this.spine.element$.pipe(x(K), N(this.element$), M(([e, t]) => {
|
|
@@ -2901,8 +2910,8 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2901
2910
|
e.values.computedPageTurnMode === "scrollable" ? z(t.style, "display", "contents") : z(t.style, "display", "block");
|
|
2902
2911
|
}));
|
|
2903
2912
|
this.layout$ = s.pipe(M(() => {
|
|
2904
|
-
|
|
2905
|
-
}), O()), this.isNavigating$ = this.navigateSubject.pipe(b((e, t) => a(e.position, t.position)), T(({ animation: t, position: n }) => (
|
|
2913
|
+
Bi.info("layout", e.values);
|
|
2914
|
+
}), O()), this.isNavigating$ = this.navigateSubject.pipe(b((e, t) => a(e.position, t.position)), T(({ animation: t, position: n }) => (Bi.info("Navigation requested", {
|
|
2906
2915
|
animation: t,
|
|
2907
2916
|
position: n
|
|
2908
2917
|
}), {
|
|
@@ -2930,7 +2939,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2930
2939
|
}), pe(!1), k(1)), E(o, this.isNavigating$, this.layout$).pipe(j(this.destroy$)).subscribe();
|
|
2931
2940
|
}
|
|
2932
2941
|
applyNavigationPosition(e) {
|
|
2933
|
-
let t = this.element$.getValue(), n =
|
|
2942
|
+
let t = this.element$.getValue(), n = Ri(e);
|
|
2934
2943
|
z(t.style, "transform", `translate(${n.x}px, ${n.y}px)`), this.hookManager.execute("onViewportOffsetAdjust", void 0);
|
|
2935
2944
|
}
|
|
2936
2945
|
navigate(e) {
|
|
@@ -2944,22 +2953,22 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2944
2953
|
return !n || n === "none" ? new J({
|
|
2945
2954
|
x: 0,
|
|
2946
2955
|
y: 0
|
|
2947
|
-
}) :
|
|
2956
|
+
}) : zi(new DOMMatrix(n));
|
|
2948
2957
|
}
|
|
2949
|
-
},
|
|
2958
|
+
}, Hi = () => (e) => e.pipe(T(({ navigation: e, pagination: t, ...n }) => ({
|
|
2950
2959
|
navigation: {
|
|
2951
2960
|
...e,
|
|
2952
|
-
paginationBeginCfi: t.
|
|
2961
|
+
paginationBeginCfi: t.begin.cfi
|
|
2953
2962
|
},
|
|
2954
2963
|
...n
|
|
2955
|
-
}))),
|
|
2964
|
+
}))), Ui = (e, t, n) => e.bridgeEvent.pagination$.pipe(N(t), x(([e, t]) => e.navigationId === t.id), A(([e, t]) => (n.spineItemsManager.get(t.spineItem)?.isReady$.pipe(S()) ?? D(!1)).pipe(x((e) => e), T(() => ({
|
|
2956
2965
|
pagination: e,
|
|
2957
2966
|
navigation: t
|
|
2958
|
-
})))),
|
|
2967
|
+
})))), Hi(), b((e, t) => e.navigation.paginationBeginCfi === t.navigation.paginationBeginCfi), T(({ navigation: e }) => ({
|
|
2959
2968
|
...e,
|
|
2960
2969
|
meta: { triggeredBy: "pagination" },
|
|
2961
2970
|
requestedPosition: e.position
|
|
2962
|
-
}))),
|
|
2971
|
+
}))), Wi = ({ navigationResolver: e, getNavigationVisibleArea: t }) => (n) => n.pipe(T(([n, r]) => {
|
|
2963
2972
|
let i = n.position, a = i ? t() : void 0, o = i && a ? e.clampPositionInSpine(i, a) : void 0;
|
|
2964
2973
|
return {
|
|
2965
2974
|
previousNavigation: r,
|
|
@@ -2974,7 +2983,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2974
2983
|
position: o
|
|
2975
2984
|
}
|
|
2976
2985
|
};
|
|
2977
|
-
})),
|
|
2986
|
+
})), Gi = ({ navigationResolver: e }) => (t) => t.pipe(T((t) => {
|
|
2978
2987
|
if (t.navigation.cfi) {
|
|
2979
2988
|
let n = e.getNavigationForCfi(t.navigation.cfi);
|
|
2980
2989
|
if (n) return {
|
|
@@ -2986,8 +2995,8 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
2986
2995
|
};
|
|
2987
2996
|
}
|
|
2988
2997
|
return t;
|
|
2989
|
-
})),
|
|
2990
|
-
let i =
|
|
2998
|
+
})), Ki = ({ navigation: e, previousNavigation: t, settings: n }) => e.directionFromLastNavigation ? e.directionFromLastNavigation : e.url !== void 0 || e.cfi !== void 0 ? "anchor" : t.spineItem === void 0 || e.spineItem || !e.position ? "forward" : n.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", qi = ({ context: e, settings: t }) => (n) => n.pipe(T(({ navigation: n, previousNavigation: r }) => {
|
|
2999
|
+
let i = Ki({
|
|
2991
3000
|
context: e,
|
|
2992
3001
|
navigation: n,
|
|
2993
3002
|
previousNavigation: r,
|
|
@@ -3001,7 +3010,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3001
3010
|
},
|
|
3002
3011
|
direction: i
|
|
3003
3012
|
};
|
|
3004
|
-
})),
|
|
3013
|
+
})), Ji = ({ spineItemsManager: e, navigationResolver: t, settings: n, viewport: r }) => (i) => i.pipe(T(({ navigation: i, ...a }) => {
|
|
3005
3014
|
let o = e.get(i.spineItem);
|
|
3006
3015
|
if (i.position) return n.values.computedPageTurnMode === "scrollable" ? {
|
|
3007
3016
|
navigation: {
|
|
@@ -3034,7 +3043,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3034
3043
|
},
|
|
3035
3044
|
...a
|
|
3036
3045
|
};
|
|
3037
|
-
})),
|
|
3046
|
+
})), Yi = ({ settings: e, spineItemsManager: t, navigationResolver: n, spineLocator: r, cfi: i }) => (a) => {
|
|
3038
3047
|
let o = (a) => {
|
|
3039
3048
|
let { position: o, spineItem: s, cfi: c, directionFromLastNavigation: l } = a, { navigationSnapThreshold: u, computedPageTurnMode: d } = e.values;
|
|
3040
3049
|
if (s !== void 0) {
|
|
@@ -3080,7 +3089,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3080
3089
|
...n
|
|
3081
3090
|
};
|
|
3082
3091
|
}));
|
|
3083
|
-
},
|
|
3092
|
+
}, Xi = ({ spine: e }) => (t) => t.pipe(A(({ navigation: t, ...n }) => {
|
|
3084
3093
|
let r = e.getSpineItemSpineLayoutInfo(t.spineItem), i = e.spineItemsManager.get(t.spineItem);
|
|
3085
3094
|
return (i?.isReady$ ?? D(!1)).pipe(S(), T((e) => ({
|
|
3086
3095
|
navigation: {
|
|
@@ -3094,7 +3103,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3094
3103
|
},
|
|
3095
3104
|
...n
|
|
3096
3105
|
})));
|
|
3097
|
-
})),
|
|
3106
|
+
})), Zi = ({ settings: e, spineItemsManager: t, spineLocator: n, navigationResolver: r }) => (i) => {
|
|
3098
3107
|
let a = (i) => {
|
|
3099
3108
|
let { navigationSnapThreshold: a, computedPageTurnMode: o } = e.values, s = t.get(i.spineItem);
|
|
3100
3109
|
if (!(!s || !i.position)) {
|
|
@@ -3131,7 +3140,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3131
3140
|
},
|
|
3132
3141
|
...t
|
|
3133
3142
|
})));
|
|
3134
|
-
},
|
|
3143
|
+
}, Qi = ({ navigationResolver: e }) => (t) => t.pipe(T((t) => {
|
|
3135
3144
|
if (t.navigation.url) {
|
|
3136
3145
|
let n = e.getNavigationForUrl(t.navigation.url);
|
|
3137
3146
|
if (n) return {
|
|
@@ -3144,7 +3153,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3144
3153
|
};
|
|
3145
3154
|
}
|
|
3146
3155
|
return t;
|
|
3147
|
-
})),
|
|
3156
|
+
})), $i = class {
|
|
3148
3157
|
constructor() {
|
|
3149
3158
|
this.isLockedSubject = new l(0), this.isLocked$ = this.isLockedSubject.pipe(T((e) => !!e), b());
|
|
3150
3159
|
}
|
|
@@ -3154,7 +3163,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3154
3163
|
e || (e = !0, this.isLockedSubject.next(this.isLockedSubject.getValue() - 1));
|
|
3155
3164
|
};
|
|
3156
3165
|
}
|
|
3157
|
-
},
|
|
3166
|
+
}, ea = ({ spineLocator: e, navigation: t, navigationResolver: n, spineItemsManager: r, spine: i, cfiManager: a }) => {
|
|
3158
3167
|
let o = r.get(t.spineItem);
|
|
3159
3168
|
return o ? o.isReady$.pipe(S(), T((r) => {
|
|
3160
3169
|
let s = i.getSpineItemSpineLayoutInfo(o), c = e.isPositionWithinSpineItem(t.position, o), l = s.width - (t.spineItemWidth ?? 0), u = s.height - (t.spineItemHeight ?? 0), d = l !== 0 || u !== 0;
|
|
@@ -3194,7 +3203,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3194
3203
|
x: 0,
|
|
3195
3204
|
y: 0
|
|
3196
3205
|
}));
|
|
3197
|
-
},
|
|
3206
|
+
}, ta = ({ navigation: e, spineLocator: t, spineItemsManager: n, settings: r, navigationResolver: i, spine: a }) => {
|
|
3198
3207
|
let { spineItem: o } = e, s = n.get(o);
|
|
3199
3208
|
if (!s) return new J({
|
|
3200
3209
|
x: 0,
|
|
@@ -3245,21 +3254,21 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3245
3254
|
}
|
|
3246
3255
|
}
|
|
3247
3256
|
return e.position;
|
|
3248
|
-
},
|
|
3257
|
+
}, na = ({ navigation: e, spineItemsManager: t, settings: n, spineLocator: r, navigationResolver: i, spine: a, cfiManager: o }) => n.values.computedPageTurnMode === "scrollable" ? D(ta({
|
|
3249
3258
|
navigation: e,
|
|
3250
3259
|
spineLocator: r,
|
|
3251
3260
|
navigationResolver: i,
|
|
3252
3261
|
settings: n,
|
|
3253
3262
|
spineItemsManager: t,
|
|
3254
3263
|
spine: a
|
|
3255
|
-
})) :
|
|
3264
|
+
})) : ea({
|
|
3256
3265
|
navigation: e,
|
|
3257
3266
|
spineLocator: r,
|
|
3258
3267
|
navigationResolver: i,
|
|
3259
3268
|
spineItemsManager: t,
|
|
3260
3269
|
spine: a,
|
|
3261
3270
|
cfiManager: o
|
|
3262
|
-
}),
|
|
3271
|
+
}), ra = ({ settings: e, navigationResolver: t, context: n, spine: r, cfiManager: i }) => (a) => a.pipe(A((a) => na({
|
|
3263
3272
|
spineLocator: r.locator,
|
|
3264
3273
|
navigation: a.navigation,
|
|
3265
3274
|
navigationResolver: t,
|
|
@@ -3275,7 +3284,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3275
3284
|
...a.navigation,
|
|
3276
3285
|
position: e
|
|
3277
3286
|
}
|
|
3278
|
-
}))))),
|
|
3287
|
+
}))))), ia = L.namespace("navigation/InternalNavigator"), aa = (e, t) => e === t || !!e && !!t && e.x === t.x && e.y === t.y, oa = (e, t) => e === t || !!e && !!t && e.width === t.width && e.height === t.height, sa = (e, t) => e.id === t.id && aa(e.position, t.position) && aa(e.requestedPosition, t.requestedPosition) && oa(e.requestedVisibleArea, t.requestedVisibleArea), ca = class extends Q {
|
|
3279
3288
|
constructor(e, t, n, r, i, a, o, s, c, u) {
|
|
3280
3289
|
super(), this.settings = e, this.context = t, this.userNavigation$ = n, this.getActiveNavigationModeController = r, this.navigationModeLayout$ = i, this.navigationResolver = a, this.spine = o, this.viewport = s, this.cfiManager = c, this.isUserInteractionLocked$ = u, this.navigationSubject = new l({
|
|
3281
3290
|
animation: !1,
|
|
@@ -3297,40 +3306,40 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3297
3306
|
requestedPosition: n,
|
|
3298
3307
|
requestedVisibleArea: r,
|
|
3299
3308
|
triggeredBy: i.triggeredBy
|
|
3300
|
-
})), b(
|
|
3301
|
-
let d = n.pipe(N(this.navigationSubject),
|
|
3309
|
+
})), b(sa), k(1)), this.locker = new $i();
|
|
3310
|
+
let d = n.pipe(N(this.navigationSubject), Wi({
|
|
3302
3311
|
navigationResolver: a,
|
|
3303
3312
|
getNavigationVisibleArea: () => r().getNavigationVisibleArea()
|
|
3304
|
-
}),
|
|
3313
|
+
}), Qi({ navigationResolver: a }), Gi({ navigationResolver: a }), qi({
|
|
3305
3314
|
context: t,
|
|
3306
3315
|
settings: e
|
|
3307
|
-
}),
|
|
3316
|
+
}), Yi({
|
|
3308
3317
|
context: t,
|
|
3309
3318
|
cfi: c,
|
|
3310
3319
|
navigationResolver: a,
|
|
3311
3320
|
settings: e,
|
|
3312
3321
|
spineItemsManager: o.spineItemsManager,
|
|
3313
3322
|
spineLocator: o.locator
|
|
3314
|
-
}),
|
|
3323
|
+
}), Zi({
|
|
3315
3324
|
navigationResolver: a,
|
|
3316
3325
|
settings: e,
|
|
3317
3326
|
spineItemsManager: o.spineItemsManager,
|
|
3318
3327
|
spineLocator: o.locator
|
|
3319
|
-
}),
|
|
3328
|
+
}), Xi({ spine: o })).pipe(Ji({
|
|
3320
3329
|
navigationResolver: a,
|
|
3321
3330
|
spineItemsManager: o.spineItemsManager,
|
|
3322
3331
|
settings: e,
|
|
3323
3332
|
viewport: s
|
|
3324
3333
|
}), N(u), A(([n, r]) => {
|
|
3325
3334
|
let i = n.navigation.cfi || n.navigation.url || e.values.computedPageTurnMode === "scrollable" || r;
|
|
3326
|
-
return D(n).pipe(i ? ce :
|
|
3335
|
+
return D(n).pipe(i ? ce : ra({
|
|
3327
3336
|
navigationResolver: a,
|
|
3328
3337
|
settings: e,
|
|
3329
3338
|
spine: o,
|
|
3330
3339
|
context: t,
|
|
3331
3340
|
cfiManager: c
|
|
3332
3341
|
}));
|
|
3333
|
-
}),
|
|
3342
|
+
}), Zi({
|
|
3334
3343
|
spineItemsManager: o.spineItemsManager,
|
|
3335
3344
|
spineLocator: o.locator,
|
|
3336
3345
|
settings: e,
|
|
@@ -3347,7 +3356,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3347
3356
|
E(E(E(i, o.layout$).pipe(A(() => D(null).pipe(A(() => u.pipe(x((e) => !e), S())), T(() => ({ navigation: {
|
|
3348
3357
|
...this.navigationSubject.getValue(),
|
|
3349
3358
|
animation: !1
|
|
3350
|
-
} })), j(E(f, d))))), f).pipe(
|
|
3359
|
+
} })), j(E(f, d))))), f).pipe(ra({
|
|
3351
3360
|
navigationResolver: a,
|
|
3352
3361
|
settings: e,
|
|
3353
3362
|
context: t,
|
|
@@ -3357,19 +3366,19 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3357
3366
|
...e,
|
|
3358
3367
|
meta: { triggeredBy: "restoration" },
|
|
3359
3368
|
requestedPosition: e.position
|
|
3360
|
-
} })),
|
|
3369
|
+
} })), Yi({
|
|
3361
3370
|
context: t,
|
|
3362
3371
|
cfi: c,
|
|
3363
3372
|
navigationResolver: a,
|
|
3364
3373
|
settings: e,
|
|
3365
3374
|
spineItemsManager: o.spineItemsManager,
|
|
3366
3375
|
spineLocator: o.locator
|
|
3367
|
-
}),
|
|
3376
|
+
}), Xi({ spine: o }), Zi({
|
|
3368
3377
|
spineItemsManager: o.spineItemsManager,
|
|
3369
3378
|
spineLocator: o.locator,
|
|
3370
3379
|
settings: e,
|
|
3371
3380
|
navigationResolver: a
|
|
3372
|
-
}), T(({ navigation: e }) => e), O()), d,
|
|
3381
|
+
}), T(({ navigation: e }) => e), O()), d, Ui(t, this.navigationSubject, o)).pipe(N(this.navigationSubject), (e) => e.pipe(M(([e]) => {
|
|
3373
3382
|
let t = e.type === "scroll", n = e.meta.triggeredBy === "pagination", r = e.meta.triggeredBy === "restoration";
|
|
3374
3383
|
if (t && !r || n) return;
|
|
3375
3384
|
let i = {
|
|
@@ -3378,7 +3387,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3378
3387
|
};
|
|
3379
3388
|
this.getActiveNavigationModeController().navigate(i);
|
|
3380
3389
|
})), (e) => e.pipe(M(([e, t]) => {
|
|
3381
|
-
|
|
3390
|
+
ia.info(`navigation updated from ${e.meta.triggeredBy} of type ${e.type}`, {
|
|
3382
3391
|
previousNavigation: t,
|
|
3383
3392
|
currentNavigation: e
|
|
3384
3393
|
}), this.navigationSubject.next(e);
|
|
@@ -3387,24 +3396,24 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3387
3396
|
get navigation() {
|
|
3388
3397
|
return this.navigationSubject.getValue();
|
|
3389
3398
|
}
|
|
3390
|
-
},
|
|
3399
|
+
}, la = (e, t, n) => {
|
|
3391
3400
|
let r = n - e, i = t * e * n / (n || 1);
|
|
3392
3401
|
return Math.max(0, Math.min(r, i));
|
|
3393
|
-
},
|
|
3394
|
-
let r =
|
|
3402
|
+
}, ua = (e, t) => (t || 0) === 0 || (e || 0) === 0 ? 1 : Math.floor(Math.max(1, e / t)), da = (e, t, n) => {
|
|
3403
|
+
let r = ua(n, t), i = [...Array(r)].map((e, n) => n * t);
|
|
3395
3404
|
return e >= r * t ? i[i.length - 1] || 0 : i.find((n) => e < n + t) || 0;
|
|
3396
|
-
},
|
|
3405
|
+
}, fa = (e, t, n) => {
|
|
3397
3406
|
let r = [...Array(n)].map((e, n) => n * t);
|
|
3398
3407
|
return e <= 0 || n === 0 ? 0 : e >= n * t ? n - 1 : r.findIndex((n) => e < n + t) ?? 0;
|
|
3399
|
-
},
|
|
3408
|
+
}, pa = ({ itemWidth: e, itemHeight: t, spineItemPosition: n }) => new q({
|
|
3400
3409
|
x: Math.min(e, Math.max(0, n.x)),
|
|
3401
3410
|
y: Math.min(t, Math.max(0, n.y))
|
|
3402
|
-
}),
|
|
3403
|
-
let l =
|
|
3411
|
+
}), ma = ({ itemHeight: e, itemWidth: t, isUsingVerticalWriting: n, pageWidth: r, pageHeight: i, pageTurnDirection: a, pageTurnMode: o }) => a === "vertical" && o === "scrollable" ? 1 : n || a === "vertical" ? ua(e, i) : ua(t, r), ha = ({ itemWidth: e, itemHeight: t, position: n, isUsingVerticalWriting: r, pageWidth: i, pageHeight: a, pageTurnDirection: o, pageTurnMode: s, isRTL: c }) => {
|
|
3412
|
+
let l = pa({
|
|
3404
3413
|
spineItemPosition: n,
|
|
3405
3414
|
itemHeight: t,
|
|
3406
3415
|
itemWidth: e
|
|
3407
|
-
}).x, u =
|
|
3416
|
+
}).x, u = ma({
|
|
3408
3417
|
isUsingVerticalWriting: r,
|
|
3409
3418
|
itemHeight: t,
|
|
3410
3419
|
itemWidth: e,
|
|
@@ -3413,15 +3422,15 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3413
3422
|
pageTurnDirection: o,
|
|
3414
3423
|
pageTurnMode: s
|
|
3415
3424
|
});
|
|
3416
|
-
if (r) return
|
|
3417
|
-
let d =
|
|
3425
|
+
if (r) return fa(n.y, a, u);
|
|
3426
|
+
let d = fa(l, i, u);
|
|
3418
3427
|
return c ? u - 1 - d : d;
|
|
3419
|
-
},
|
|
3428
|
+
}, ga = ({ pageIndex: e, itemLayout: t, context: n, isUsingVerticalWriting: r, viewport: i }) => {
|
|
3420
3429
|
if (r) return new q({
|
|
3421
3430
|
x: 0,
|
|
3422
|
-
y:
|
|
3431
|
+
y: la(i.pageSize.height, e, t.height)
|
|
3423
3432
|
});
|
|
3424
|
-
let a =
|
|
3433
|
+
let a = la(i.pageSize.width, e, t.width);
|
|
3425
3434
|
return n.isRTL() ? new q({
|
|
3426
3435
|
x: t.width - a - i.pageSize.width,
|
|
3427
3436
|
y: 0
|
|
@@ -3429,26 +3438,26 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3429
3438
|
x: a,
|
|
3430
3439
|
y: 0
|
|
3431
3440
|
});
|
|
3432
|
-
},
|
|
3441
|
+
}, _a = ({ context: e, settings: t, viewport: n }) => {
|
|
3433
3442
|
let r = (e, t, r) => {
|
|
3434
3443
|
let i;
|
|
3435
3444
|
e?.nodeName === "img" || e?.textContent === "" && e.nodeType === Node.ELEMENT_NODE ? i = e.getBoundingClientRect().x : e && (i = (e ? Ue(e, t) : void 0)?.getBoundingClientRect().x || i);
|
|
3436
3445
|
let a = r.layoutInfo?.width || 0, o = n.pageSize.width;
|
|
3437
3446
|
if (i !== void 0) return new q({
|
|
3438
|
-
x:
|
|
3447
|
+
x: da(i, o, a),
|
|
3439
3448
|
y: 0
|
|
3440
3449
|
});
|
|
3441
3450
|
};
|
|
3442
3451
|
return {
|
|
3443
3452
|
getSpineItemPositionFromNode: r,
|
|
3444
|
-
getSpineItemPositionFromPageIndex: ({ pageIndex: t, spineItem: r }) =>
|
|
3453
|
+
getSpineItemPositionFromPageIndex: ({ pageIndex: t, spineItem: r }) => ga({
|
|
3445
3454
|
context: e,
|
|
3446
3455
|
isUsingVerticalWriting: !!r.isUsingVerticalWriting(),
|
|
3447
3456
|
itemLayout: r.layoutInfo,
|
|
3448
3457
|
pageIndex: t,
|
|
3449
3458
|
viewport: n
|
|
3450
3459
|
}),
|
|
3451
|
-
getSpineItemPageIndexFromPosition: (r) =>
|
|
3460
|
+
getSpineItemPageIndexFromPosition: (r) => ha({
|
|
3452
3461
|
...r,
|
|
3453
3462
|
isRTL: e.isRTL(),
|
|
3454
3463
|
pageWidth: n.pageSize.width,
|
|
@@ -3458,7 +3467,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3458
3467
|
}),
|
|
3459
3468
|
getSpineItemPageIndexFromNode: (i, a, o) => {
|
|
3460
3469
|
let s = r(i, a, o), { height: c, width: l } = o.layoutInfo;
|
|
3461
|
-
return s ?
|
|
3470
|
+
return s ? ha({
|
|
3462
3471
|
isUsingVerticalWriting: !!o.isUsingVerticalWriting(),
|
|
3463
3472
|
position: s,
|
|
3464
3473
|
itemHeight: c,
|
|
@@ -3473,20 +3482,20 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3473
3482
|
getSpineItemClosestPositionFromUnsafePosition: (e, t) => {
|
|
3474
3483
|
let { width: r, height: i } = t.layoutInfo;
|
|
3475
3484
|
return new q({
|
|
3476
|
-
x:
|
|
3477
|
-
y:
|
|
3485
|
+
x: da(e.x, n.pageSize.width, r),
|
|
3486
|
+
y: da(e.y, n.pageSize.height, i)
|
|
3478
3487
|
});
|
|
3479
3488
|
},
|
|
3480
3489
|
getSpineItemPagePositionFromSpineItemPosition: (t, r, i) => {
|
|
3481
3490
|
let { width: a, height: o } = i.layoutInfo, s = n.pageSize.width, c = n.pageSize.height;
|
|
3482
3491
|
if (i.isUsingVerticalWriting()) {
|
|
3483
|
-
let e =
|
|
3492
|
+
let e = la(c, r, o);
|
|
3484
3493
|
return new ln({
|
|
3485
3494
|
x: t.x,
|
|
3486
3495
|
y: t.y - e
|
|
3487
3496
|
});
|
|
3488
3497
|
}
|
|
3489
|
-
let l =
|
|
3498
|
+
let l = la(s, r, a);
|
|
3490
3499
|
if (e.isRTL()) {
|
|
3491
3500
|
let e = a - (r + 1) * s;
|
|
3492
3501
|
return new ln({
|
|
@@ -3500,8 +3509,8 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3500
3509
|
});
|
|
3501
3510
|
}
|
|
3502
3511
|
};
|
|
3503
|
-
},
|
|
3504
|
-
let r =
|
|
3512
|
+
}, va = ({ context: e, settings: t, viewport: n }) => {
|
|
3513
|
+
let r = _a({
|
|
3505
3514
|
context: e,
|
|
3506
3515
|
settings: t,
|
|
3507
3516
|
viewport: n
|
|
@@ -3520,7 +3529,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3520
3529
|
y: 0
|
|
3521
3530
|
})
|
|
3522
3531
|
};
|
|
3523
|
-
},
|
|
3532
|
+
}, ya = ({ size: e, isRTL: t, spineItemsManager: n, spine: r }) => {
|
|
3524
3533
|
let i = n.get(n.items.length - 1);
|
|
3525
3534
|
if (!i) return;
|
|
3526
3535
|
let a = r.getSpineItemSpineLayoutInfo(i), o = Math.max(0, a.bottom - e.height);
|
|
@@ -3539,8 +3548,8 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3539
3548
|
yMin: 0,
|
|
3540
3549
|
yMax: o
|
|
3541
3550
|
};
|
|
3542
|
-
},
|
|
3543
|
-
let a =
|
|
3551
|
+
}, ba = ({ position: e, size: t, isRTL: n, spineItemsManager: r, spine: i }) => {
|
|
3552
|
+
let a = ya({
|
|
3544
3553
|
size: t,
|
|
3545
3554
|
isRTL: n,
|
|
3546
3555
|
spineItemsManager: r,
|
|
@@ -3555,8 +3564,8 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3555
3564
|
x: n ? Math.max(a.xMin, Math.min(a.xMax, e.x)) : Math.min(Math.max(a.xMin, e.x), a.xMax),
|
|
3556
3565
|
y: o
|
|
3557
3566
|
});
|
|
3558
|
-
},
|
|
3559
|
-
let a =
|
|
3567
|
+
}, xa = ({ position: e, size: t, isRTL: n, spineItemsManager: r, spine: i }) => {
|
|
3568
|
+
let a = ya({
|
|
3560
3569
|
size: t,
|
|
3561
3570
|
isRTL: n,
|
|
3562
3571
|
spineItemsManager: r,
|
|
@@ -3582,7 +3591,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3582
3591
|
x: a,
|
|
3583
3592
|
y: i
|
|
3584
3593
|
});
|
|
3585
|
-
},
|
|
3594
|
+
}, Sa = ({ viewportPosition: e, spineLocator: t, spineItemNavigationResolver: n, viewport: r }) => {
|
|
3586
3595
|
let i = t.getSpineItemFromPosition(e);
|
|
3587
3596
|
if (i) {
|
|
3588
3597
|
let a = t.getSpineItemPositionFromSpinePosition(e, i), o = n.getNavigationForPosition(i, a);
|
|
@@ -3599,9 +3608,9 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3599
3608
|
x: 0,
|
|
3600
3609
|
y: 0
|
|
3601
3610
|
});
|
|
3602
|
-
},
|
|
3611
|
+
}, Ca = ({ pageIndex: e, spineItemsManager: t, spineItemId: n, spineLocator: r, spineItemNavigationResolver: i, viewport: a }) => {
|
|
3603
3612
|
let o = t.get(n);
|
|
3604
|
-
if (!o) return
|
|
3613
|
+
if (!o) return Sa({
|
|
3605
3614
|
viewportPosition: new J({
|
|
3606
3615
|
x: e * a.pageSize.width,
|
|
3607
3616
|
y: 0
|
|
@@ -3622,7 +3631,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3622
3631
|
pageSizeWidth: a.pageSize.width,
|
|
3623
3632
|
visibleAreaRectWidth: a.absoluteViewport.width
|
|
3624
3633
|
});
|
|
3625
|
-
},
|
|
3634
|
+
}, wa = (e, t) => {
|
|
3626
3635
|
if (V(t, "iframe")) {
|
|
3627
3636
|
let n = t.contentDocument, r = e.trim();
|
|
3628
3637
|
if (!n || r.length === 0) return;
|
|
@@ -3636,11 +3645,11 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3636
3645
|
return;
|
|
3637
3646
|
}
|
|
3638
3647
|
}
|
|
3639
|
-
},
|
|
3640
|
-
let r =
|
|
3648
|
+
}, Ta = ({ anchor: e, spineItem: t, spine: n }) => {
|
|
3649
|
+
let r = wa(e, t.renderer.getDocumentFrame());
|
|
3641
3650
|
return r ? n.spineItemLocator.getSpineItemPositionFromNode(r, 0, t)?.x ?? 0 : 0;
|
|
3642
|
-
},
|
|
3643
|
-
let i =
|
|
3651
|
+
}, Ea = ({ anchor: e, spineItem: t, spineLocator: n, spine: r }) => {
|
|
3652
|
+
let i = Ta({
|
|
3644
3653
|
anchor: e,
|
|
3645
3654
|
spineItem: t,
|
|
3646
3655
|
spine: r
|
|
@@ -3652,8 +3661,8 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3652
3661
|
}),
|
|
3653
3662
|
spineItem: t
|
|
3654
3663
|
});
|
|
3655
|
-
},
|
|
3656
|
-
position:
|
|
3664
|
+
}, Da = ({ anchor: e, spineItem: t, spineLocator: n, spine: r, pageSizeWidth: i, visibleAreaRectWidth: a }) => $({
|
|
3665
|
+
position: Ea({
|
|
3657
3666
|
anchor: e,
|
|
3658
3667
|
spineItem: t,
|
|
3659
3668
|
spineLocator: n,
|
|
@@ -3661,14 +3670,14 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3661
3670
|
}),
|
|
3662
3671
|
pageSizeWidth: i,
|
|
3663
3672
|
visibleAreaRectWidth: a
|
|
3664
|
-
}),
|
|
3673
|
+
}), Oa = ({ spine: e, spineItemsManager: t, spineLocator: n, url: r, context: i, pageSizeWidth: a, visibleAreaRectWidth: o }) => {
|
|
3665
3674
|
try {
|
|
3666
3675
|
let s = r instanceof URL ? r : new URL(r), c = `${s.origin}${s.pathname}`, l = i.manifest.spineItems.find((e) => e.href === c);
|
|
3667
3676
|
if (l) {
|
|
3668
3677
|
let r = t.get(l.id);
|
|
3669
3678
|
if (r) return {
|
|
3670
3679
|
position: $({
|
|
3671
|
-
position:
|
|
3680
|
+
position: Da({
|
|
3672
3681
|
anchor: s.hash,
|
|
3673
3682
|
spineItem: r,
|
|
3674
3683
|
spine: e,
|
|
@@ -3687,7 +3696,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3687
3696
|
console.error(e);
|
|
3688
3697
|
return;
|
|
3689
3698
|
}
|
|
3690
|
-
},
|
|
3699
|
+
}, ka = ({ spineItem: e, spineItemPosition: t, spineLocator: n, spineItemLocator: r, viewport: i }) => {
|
|
3691
3700
|
let a = r.getSpineItemClosestPositionFromUnsafePosition(t, e);
|
|
3692
3701
|
return $({
|
|
3693
3702
|
position: n.getSpinePositionFromSpineItemPosition({
|
|
@@ -3697,14 +3706,14 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3697
3706
|
pageSizeWidth: i.pageSize.width,
|
|
3698
3707
|
visibleAreaRectWidth: i.absoluteViewport.width
|
|
3699
3708
|
});
|
|
3700
|
-
},
|
|
3701
|
-
let s =
|
|
3709
|
+
}, Aa = "spineNavigator", ja = ({ context: e, spineItemsManager: t, locator: n, settings: r, spine: i, viewport: a, cfi: o }) => {
|
|
3710
|
+
let s = va({
|
|
3702
3711
|
context: e,
|
|
3703
3712
|
settings: r,
|
|
3704
3713
|
viewport: a
|
|
3705
3714
|
});
|
|
3706
3715
|
return {
|
|
3707
|
-
getNavigationForUrl: (r) =>
|
|
3716
|
+
getNavigationForUrl: (r) => Oa({
|
|
3708
3717
|
context: e,
|
|
3709
3718
|
spineItemsManager: t,
|
|
3710
3719
|
spineLocator: n,
|
|
@@ -3713,14 +3722,14 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3713
3722
|
visibleAreaRectWidth: a.absoluteViewport.width,
|
|
3714
3723
|
spine: i
|
|
3715
3724
|
}),
|
|
3716
|
-
getNavigationForSpineItemPage: (e) =>
|
|
3725
|
+
getNavigationForSpineItemPage: (e) => Ca({
|
|
3717
3726
|
...e,
|
|
3718
3727
|
spineItemsManager: t,
|
|
3719
3728
|
spineItemNavigationResolver: s,
|
|
3720
3729
|
spineLocator: n,
|
|
3721
3730
|
viewport: a
|
|
3722
3731
|
}),
|
|
3723
|
-
getNavigationFromSpineItemPosition: (e) =>
|
|
3732
|
+
getNavigationFromSpineItemPosition: (e) => ka({
|
|
3724
3733
|
...e,
|
|
3725
3734
|
spineItemLocator: n.spineItemLocator,
|
|
3726
3735
|
spineLocator: n,
|
|
@@ -3729,7 +3738,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3729
3738
|
getNavigationForCfi: (e) => {
|
|
3730
3739
|
let { node: t, offset: r = 0, spineItem: i } = o.resolveCfi({ cfi: e });
|
|
3731
3740
|
if (!i) {
|
|
3732
|
-
L.warn(
|
|
3741
|
+
L.warn(Aa, `unable to detect item id from cfi ${e}`);
|
|
3733
3742
|
return;
|
|
3734
3743
|
}
|
|
3735
3744
|
let c = t ? s.getNavigationFromNode(i, t, r) : new q({
|
|
@@ -3767,14 +3776,14 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3767
3776
|
y: 0
|
|
3768
3777
|
});
|
|
3769
3778
|
},
|
|
3770
|
-
getNavigationForPosition: (e) =>
|
|
3779
|
+
getNavigationForPosition: (e) => Sa({
|
|
3771
3780
|
viewportPosition: e,
|
|
3772
3781
|
spineItemNavigationResolver: s,
|
|
3773
3782
|
spineLocator: n,
|
|
3774
3783
|
viewport: a
|
|
3775
3784
|
}),
|
|
3776
3785
|
getMostPredominantNavigationForPosition: (o) => {
|
|
3777
|
-
let c = r.values.computedPageTurnDirection, l = .5, u =
|
|
3786
|
+
let c = r.values.computedPageTurnDirection, l = .5, u = ba({
|
|
3778
3787
|
position: new J({
|
|
3779
3788
|
x: c === "horizontal" ? o.x + a.absoluteViewport.width * l : 0,
|
|
3780
3789
|
y: c === "horizontal" ? 0 : o.y + a.absoluteViewport.height * l
|
|
@@ -3784,21 +3793,21 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3784
3793
|
spineItemsManager: t,
|
|
3785
3794
|
spine: i
|
|
3786
3795
|
});
|
|
3787
|
-
return
|
|
3796
|
+
return Sa({
|
|
3788
3797
|
spineItemNavigationResolver: s,
|
|
3789
3798
|
spineLocator: n,
|
|
3790
3799
|
viewportPosition: u,
|
|
3791
3800
|
viewport: a
|
|
3792
3801
|
});
|
|
3793
3802
|
},
|
|
3794
|
-
clampPositionInSpine: (n, r) =>
|
|
3803
|
+
clampPositionInSpine: (n, r) => ba({
|
|
3795
3804
|
position: n,
|
|
3796
3805
|
size: r,
|
|
3797
3806
|
isRTL: e.isRTL(),
|
|
3798
3807
|
spineItemsManager: t,
|
|
3799
3808
|
spine: i
|
|
3800
3809
|
}),
|
|
3801
|
-
getBoundaryForPosition: (n, r = a.absoluteViewport) =>
|
|
3810
|
+
getBoundaryForPosition: (n, r = a.absoluteViewport) => xa({
|
|
3802
3811
|
position: n,
|
|
3803
3812
|
size: r,
|
|
3804
3813
|
isRTL: e.isRTL(),
|
|
@@ -3814,8 +3823,8 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3814
3823
|
}),
|
|
3815
3824
|
spineItemNavigator: s
|
|
3816
3825
|
};
|
|
3817
|
-
},
|
|
3818
|
-
let c = new m(), l = c.asObservable(), u = new
|
|
3826
|
+
}, Ma = ({ spineItemsManager: e, context: t, hookManager: n, spine: r, settings: i, viewport: a, cfi: s }) => {
|
|
3827
|
+
let c = new m(), l = c.asObservable(), u = new $i(), d = s, f = ja({
|
|
3819
3828
|
cfi: d,
|
|
3820
3829
|
context: t,
|
|
3821
3830
|
settings: i,
|
|
@@ -3823,7 +3832,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3823
3832
|
locator: r.locator,
|
|
3824
3833
|
spine: r,
|
|
3825
3834
|
viewport: a
|
|
3826
|
-
}), p = new
|
|
3835
|
+
}), p = new Vi(i, n, t, r, a), h = new hi(a, i, n, r, t), g = [h, p], _ = new ca(i, t, l, () => g.find((e) => e.isActive()) ?? p, E(...g.flatMap((e) => e.layout$ ? [e.layout$] : [])), f, r, a, d, u.isLocked$), y = v([
|
|
3827
3836
|
...g.map((e) => e.isNavigating$),
|
|
3828
3837
|
u.isLocked$,
|
|
3829
3838
|
_.locker.isLocked$
|
|
@@ -3848,27 +3857,21 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3848
3857
|
navigation$: _.navigation$,
|
|
3849
3858
|
position$: ee
|
|
3850
3859
|
};
|
|
3851
|
-
},
|
|
3860
|
+
}, Na = class extends U {
|
|
3852
3861
|
constructor(e, t) {
|
|
3853
3862
|
super({
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
beginCfi: void 0,
|
|
3857
|
-
beginSpineItemIndex: void 0,
|
|
3858
|
-
endPageIndexInSpineItem: void 0,
|
|
3859
|
-
endNumberOfPagesInSpineItem: 0,
|
|
3860
|
-
endCfi: void 0,
|
|
3861
|
-
endSpineItemIndex: void 0,
|
|
3863
|
+
begin: hr(),
|
|
3864
|
+
end: hr(),
|
|
3862
3865
|
navigationId: void 0
|
|
3863
3866
|
}), this.context = e, this.spineItemsManager = t;
|
|
3864
3867
|
}
|
|
3865
3868
|
update(e) {
|
|
3866
|
-
this.mergeCompare(e);
|
|
3869
|
+
gr(this.value, e) || this.mergeCompare(e);
|
|
3867
3870
|
}
|
|
3868
|
-
},
|
|
3871
|
+
}, Pa = {
|
|
3869
3872
|
type: "percentage",
|
|
3870
3873
|
value: .5
|
|
3871
|
-
},
|
|
3874
|
+
}, Fa = class extends Q {
|
|
3872
3875
|
constructor(e, t, n, r, i, a) {
|
|
3873
3876
|
super(), this.context = e, this.pagination = t, this.spineItemsManager = n, this.spine = r, this.isNavigationLocked$ = i, this.cfi = a;
|
|
3874
3877
|
let o = E(this.context.bridgeEvent.navigation$, r.layout$).pipe(A(() => this.isNavigationLocked$.pipe(x((e) => !e), he(1), N(this.context.bridgeEvent.navigation$), T(([, e]) => this.resolveMetrics(e) ?? this.pagination.value))), O());
|
|
@@ -3880,47 +3883,47 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3880
3883
|
return this.spine.locator.getVisiblePagesFromViewportPosition({
|
|
3881
3884
|
spineItem: e,
|
|
3882
3885
|
position: t,
|
|
3883
|
-
threshold:
|
|
3886
|
+
threshold: Pa
|
|
3884
3887
|
});
|
|
3885
3888
|
}
|
|
3886
3889
|
resolveMetrics(e) {
|
|
3887
3890
|
let { position: t } = e, n = this.pagination.value, { beginIndex: r, endIndex: i } = this.spine.locator.getVisibleSpineItemsFromPosition({
|
|
3888
3891
|
position: t,
|
|
3889
|
-
threshold:
|
|
3892
|
+
threshold: Pa
|
|
3890
3893
|
}) ?? {}, a = this.spineItemsManager.get(r), o = this.spineItemsManager.get(i);
|
|
3891
3894
|
if (!a || !o) return;
|
|
3892
3895
|
let { beginPageIndex: s = 0 } = this.getVisiblePages(a, t) ?? {}, { endPageIndex: c = 0 } = this.getVisiblePages(o, t) ?? {};
|
|
3893
3896
|
return {
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
spineItemIndex: n.beginSpineItemIndex
|
|
3897
|
-
}),
|
|
3898
|
-
beginNumberOfPagesInSpineItem: a.numberOfPages,
|
|
3899
|
-
beginPageIndexInSpineItem: s,
|
|
3900
|
-
beginSpineItemIndex: r,
|
|
3901
|
-
endCfi: this.carryOverCfi(o, i, {
|
|
3902
|
-
cfi: n.endCfi,
|
|
3903
|
-
spineItemIndex: n.endSpineItemIndex
|
|
3904
|
-
}),
|
|
3905
|
-
endNumberOfPagesInSpineItem: o.numberOfPages,
|
|
3906
|
-
endPageIndexInSpineItem: c,
|
|
3907
|
-
endSpineItemIndex: i,
|
|
3897
|
+
begin: this.resolveEdgeMetrics(a, r, s, n.begin),
|
|
3898
|
+
end: this.resolveEdgeMetrics(o, i, c, n.end),
|
|
3908
3899
|
navigationId: e.id
|
|
3909
3900
|
};
|
|
3910
3901
|
}
|
|
3911
|
-
|
|
3912
|
-
return
|
|
3902
|
+
resolveEdgeMetrics(e, t, n, r) {
|
|
3903
|
+
return {
|
|
3904
|
+
cfi: r.cfi !== void 0 && !this.cfi.isRootCfi(r.cfi) && r.spineItemIndex === t ? r.cfi : this.cfi.generateRootCfi(e.item),
|
|
3905
|
+
spineItemIndex: t,
|
|
3906
|
+
pageIndexInSpineItem: n,
|
|
3907
|
+
numberOfPagesInSpineItem: e.numberOfPages
|
|
3908
|
+
};
|
|
3913
3909
|
}
|
|
3914
3910
|
resolvePositions(e) {
|
|
3915
|
-
let
|
|
3916
|
-
if (
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3911
|
+
let t = this.resolveEdgePositions(e.begin), n = this.resolveEdgePositions(e.end);
|
|
3912
|
+
if (!(!t || !n)) return {
|
|
3913
|
+
...e,
|
|
3914
|
+
begin: t,
|
|
3915
|
+
end: n
|
|
3916
|
+
};
|
|
3917
|
+
}
|
|
3918
|
+
resolveEdgePositions(e) {
|
|
3919
|
+
let { spineItemIndex: t, pageIndexInSpineItem: n } = e;
|
|
3920
|
+
if (t === void 0 || n === void 0) return;
|
|
3921
|
+
let r = this.spineItemsManager.get(t);
|
|
3922
|
+
if (!r) return;
|
|
3923
|
+
let i = this.spine.pages.fromSpineItemPageIndex(r, n);
|
|
3920
3924
|
return {
|
|
3921
3925
|
...e,
|
|
3922
|
-
|
|
3923
|
-
endCfi: this.resolveCfi(o, c)
|
|
3926
|
+
cfi: this.resolveCfi(r, i)
|
|
3924
3927
|
};
|
|
3925
3928
|
}
|
|
3926
3929
|
resolveCfi(e, t) {
|
|
@@ -3929,7 +3932,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3929
3932
|
pageNode: t.firstVisibleNode
|
|
3930
3933
|
}) : this.cfi.generateRootCfi(e.item);
|
|
3931
3934
|
}
|
|
3932
|
-
},
|
|
3935
|
+
}, Ia = class extends Q {
|
|
3933
3936
|
constructor(e) {
|
|
3934
3937
|
super();
|
|
3935
3938
|
let t = {
|
|
@@ -3970,7 +3973,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
3970
3973
|
destroy() {
|
|
3971
3974
|
super.destroy(), this.outputSettingsUpdateSubject.complete();
|
|
3972
3975
|
}
|
|
3973
|
-
},
|
|
3976
|
+
}, La = class extends Ia {
|
|
3974
3977
|
constructor(e, t) {
|
|
3975
3978
|
super(e), this.context = t, t.watch(["hasVerticalWriting"]).pipe(M(() => this.update(this.values)), j(this.destroy$)).subscribe();
|
|
3976
3979
|
}
|
|
@@ -4010,7 +4013,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4010
4013
|
numberOfAdjacentSpineItemToPreLoad: 3
|
|
4011
4014
|
};
|
|
4012
4015
|
}
|
|
4013
|
-
},
|
|
4016
|
+
}, Ra = class extends Q {
|
|
4014
4017
|
constructor(e, n, r, i, a, o) {
|
|
4015
4018
|
super(), this.context = e, this.spineItemsManager = n, this.spineLocator = r, this.settings = i, this.spineLayout = a, this.viewport = o, this.forcedOpenSubject = new l(/* @__PURE__ */ new Map());
|
|
4016
4019
|
let s = this.forcedOpenSubject.pipe(T((e) => Array.from(e.keys()).sort((e, t) => e - t)), b(t), k({
|
|
@@ -4046,13 +4049,13 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4046
4049
|
destroy() {
|
|
4047
4050
|
super.destroy(), this.forcedOpenSubject.complete();
|
|
4048
4051
|
}
|
|
4049
|
-
},
|
|
4052
|
+
}, za = (e, t, n) => {
|
|
4050
4053
|
let r = (n.width - t.width) / 2, i = (n.height - t.height) / 2;
|
|
4051
4054
|
return new Y({
|
|
4052
4055
|
x: e.x - r,
|
|
4053
4056
|
y: e.y - i
|
|
4054
4057
|
});
|
|
4055
|
-
},
|
|
4058
|
+
}, Ba = class e extends DOMRect {
|
|
4056
4059
|
constructor(...e) {
|
|
4057
4060
|
super(...e), this.__symbol = Symbol("ViewportPosition");
|
|
4058
4061
|
}
|
|
@@ -4064,15 +4067,15 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4064
4067
|
let r = t;
|
|
4065
4068
|
return new e(r.x, r.y, r.width, r.height);
|
|
4066
4069
|
}
|
|
4067
|
-
},
|
|
4070
|
+
}, Va = class {
|
|
4068
4071
|
constructor({ width: e, height: t }) {
|
|
4069
4072
|
this.__symbol = Symbol("AbsoluteViewport"), this.width = e, this.height = t;
|
|
4070
4073
|
}
|
|
4071
|
-
},
|
|
4074
|
+
}, Ha = class {
|
|
4072
4075
|
constructor({ width: e, height: t }) {
|
|
4073
4076
|
this.__symbol = Symbol("RelativeViewport"), this.width = e, this.height = t;
|
|
4074
4077
|
}
|
|
4075
|
-
},
|
|
4078
|
+
}, Ua = ({ pageIndex: e, spineItemOrId: t, spineItemsManager: n }) => {
|
|
4076
4079
|
let r = n.items, i = n.get(t);
|
|
4077
4080
|
if (!i) return;
|
|
4078
4081
|
let { currentAbsolutePage: a } = r.reduce((t, n) => {
|
|
@@ -4090,45 +4093,45 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4090
4093
|
found: !1
|
|
4091
4094
|
});
|
|
4092
4095
|
return a;
|
|
4093
|
-
},
|
|
4096
|
+
}, Wa = ({ itemHeight: e, itemWidth: t, visibleWidthOfItem: n, visibleHeightOfItem: r, threshold: i }) => {
|
|
4094
4097
|
let a = n / t, o = r / e;
|
|
4095
4098
|
return i.type === "percentage" ? a >= i.value && o >= i.value : n >= i.value && r >= i.value;
|
|
4096
|
-
},
|
|
4099
|
+
}, Ga = ({ visibleWidthOfItem: e, visibleHeightOfItem: t, threshold: n, viewportPosition: r }) => {
|
|
4097
4100
|
let i = e / r.width, a = t / r.height;
|
|
4098
4101
|
return n.type === "percentage" ? a >= n.value && i >= n.value : t >= n.value && e >= n.value;
|
|
4099
|
-
},
|
|
4102
|
+
}, Ka = ({ itemPosition: { bottom: e, left: t, right: n, top: r, width: i, height: a }, threshold: o, viewportPosition: s, restrictToScreen: c }) => {
|
|
4100
4103
|
let l = s.x, u = s.x + (s.width - 1), d = s.y, f = Math.max(s.y + (s.height - 1), 0), p = Math.max(0, Math.min(n, u) - Math.max(t, l)), m = Math.max(0, Math.min(e, f) - Math.max(r, d));
|
|
4101
4104
|
if (p <= 0 || m <= 0) return { visible: !1 };
|
|
4102
|
-
let h =
|
|
4105
|
+
let h = Ga({
|
|
4103
4106
|
threshold: o,
|
|
4104
4107
|
visibleHeightOfItem: m,
|
|
4105
4108
|
visibleWidthOfItem: p,
|
|
4106
4109
|
viewportPosition: s
|
|
4107
4110
|
});
|
|
4108
|
-
return c ? { visible: h } : { visible:
|
|
4111
|
+
return c ? { visible: h } : { visible: Wa({
|
|
4109
4112
|
itemHeight: a,
|
|
4110
4113
|
itemWidth: i,
|
|
4111
4114
|
threshold: o,
|
|
4112
4115
|
visibleHeightOfItem: m,
|
|
4113
4116
|
visibleWidthOfItem: p
|
|
4114
4117
|
}) || h };
|
|
4115
|
-
},
|
|
4118
|
+
}, qa = ({ position: e, spineItemsManager: t, spineLayout: n }) => {
|
|
4116
4119
|
let r = t.items.find((t) => {
|
|
4117
4120
|
let { left: r, right: i, bottom: a, top: o } = n.getSpineItemSpineLayoutInfo(t), s = e.x >= r && e.x < i, c = e.y >= o && e.y < a;
|
|
4118
4121
|
return s && c;
|
|
4119
4122
|
});
|
|
4120
4123
|
return e.x === 0 && !r ? t.items[0] : r;
|
|
4121
|
-
},
|
|
4124
|
+
}, Ja = ({ spineItemPosition: e, itemLayout: { left: t, top: n } }) => new J({
|
|
4122
4125
|
x: t + e.x,
|
|
4123
4126
|
y: n + e.y
|
|
4124
|
-
}),
|
|
4125
|
-
let s =
|
|
4127
|
+
}), Ya = ({ position: e, threshold: t, restrictToScreen: n, spineItemsManager: r, spineLayout: i, useAbsoluteViewport: a = !0, viewport: o }) => {
|
|
4128
|
+
let s = qa({
|
|
4126
4129
|
position: e,
|
|
4127
4130
|
spineItemsManager: r,
|
|
4128
4131
|
spineLayout: i
|
|
4129
|
-
}) || r.get(0), c = a ? o.absoluteViewport : o.relativeViewport, l =
|
|
4132
|
+
}) || r.get(0), c = a ? o.absoluteViewport : o.relativeViewport, l = za(e, o.absoluteViewport, c), u = Ba.from(l, c), d = [];
|
|
4130
4133
|
for (let e of r.items) {
|
|
4131
|
-
let { visible: r } =
|
|
4134
|
+
let { visible: r } = Ka({
|
|
4132
4135
|
itemPosition: i.getSpineItemSpineLayoutInfo(e),
|
|
4133
4136
|
threshold: t,
|
|
4134
4137
|
viewportPosition: u,
|
|
@@ -4143,14 +4146,14 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4143
4146
|
beginIndex: m ?? 0,
|
|
4144
4147
|
endIndex: h ?? 0
|
|
4145
4148
|
};
|
|
4146
|
-
},
|
|
4149
|
+
}, Xa = ({ spineItemsManager: e, context: t, spineItemLocator: n, settings: r, spineLayout: i, viewport: a }) => {
|
|
4147
4150
|
let o = (e, t) => {
|
|
4148
4151
|
let { left: n, top: r } = i.getSpineItemSpineLayoutInfo(t);
|
|
4149
4152
|
return new q({
|
|
4150
4153
|
x: Math.max(e.x - n, 0),
|
|
4151
4154
|
y: Math.max(e.y - r, 0)
|
|
4152
4155
|
});
|
|
4153
|
-
}, s = (e) =>
|
|
4156
|
+
}, s = (e) => Ja({
|
|
4154
4157
|
spineItemPosition: new q({
|
|
4155
4158
|
x: 0,
|
|
4156
4159
|
y: 0
|
|
@@ -4164,7 +4167,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4164
4167
|
return n.getSpineItemPageIndexFromNode(t, r || 0, i);
|
|
4165
4168
|
}, u = ({ position: e, threshold: t, spineItem: r, restrictToScreen: a, useAbsoluteViewport: o = !0, viewport: s }) => {
|
|
4166
4169
|
let c = r.numberOfPages, l = Array.from(Array(c)).map((e, t) => {
|
|
4167
|
-
let a =
|
|
4170
|
+
let a = Ja({
|
|
4168
4171
|
spineItemPosition: n.getSpineItemPositionFromPageIndex({
|
|
4169
4172
|
pageIndex: t,
|
|
4170
4173
|
spineItem: r
|
|
@@ -4183,8 +4186,8 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4183
4186
|
}
|
|
4184
4187
|
};
|
|
4185
4188
|
}).reduce((n, { absolutePosition: r, index: i }) => {
|
|
4186
|
-
let c = o ? s.absoluteViewport : s.relativeViewport, l =
|
|
4187
|
-
viewportPosition:
|
|
4189
|
+
let c = o ? s.absoluteViewport : s.relativeViewport, l = za(e, s.absoluteViewport, c), { visible: u } = Ka({
|
|
4190
|
+
viewportPosition: Ba.from(l, c),
|
|
4188
4191
|
restrictToScreen: a,
|
|
4189
4192
|
threshold: t,
|
|
4190
4193
|
itemPosition: r
|
|
@@ -4197,11 +4200,11 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4197
4200
|
};
|
|
4198
4201
|
};
|
|
4199
4202
|
return {
|
|
4200
|
-
getSpinePositionFromSpineItemPosition: ({ spineItem: e, spineItemPosition: t }) =>
|
|
4203
|
+
getSpinePositionFromSpineItemPosition: ({ spineItem: e, spineItemPosition: t }) => Ja({
|
|
4201
4204
|
itemLayout: i.getSpineItemSpineLayoutInfo(e),
|
|
4202
4205
|
spineItemPosition: t
|
|
4203
4206
|
}),
|
|
4204
|
-
_getAbsolutePageIndexFromPageIndex: (n) =>
|
|
4207
|
+
_getAbsolutePageIndexFromPageIndex: (n) => Ua({
|
|
4205
4208
|
...n,
|
|
4206
4209
|
context: t,
|
|
4207
4210
|
settings: r,
|
|
@@ -4209,7 +4212,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4209
4212
|
spineLayout: i
|
|
4210
4213
|
}),
|
|
4211
4214
|
getSpineItemPagePositionFromSpinePosition: (t) => {
|
|
4212
|
-
let r =
|
|
4215
|
+
let r = qa({
|
|
4213
4216
|
position: t,
|
|
4214
4217
|
spineItemsManager: e,
|
|
4215
4218
|
spineLayout: i
|
|
@@ -4230,14 +4233,14 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4230
4233
|
},
|
|
4231
4234
|
getSpinePositionFromSpineItem: s,
|
|
4232
4235
|
getSpineItemPositionFromSpinePosition: o,
|
|
4233
|
-
getSpineItemFromPosition: (t) =>
|
|
4236
|
+
getSpineItemFromPosition: (t) => qa({
|
|
4234
4237
|
position: t,
|
|
4235
4238
|
spineItemsManager: e,
|
|
4236
4239
|
spineLayout: i
|
|
4237
4240
|
}),
|
|
4238
4241
|
getSpineItemFromIframe: c,
|
|
4239
4242
|
getSpineItemPageIndexFromNode: l,
|
|
4240
|
-
getVisibleSpineItemsFromPosition: (t) =>
|
|
4243
|
+
getVisibleSpineItemsFromPosition: (t) => Ya({
|
|
4241
4244
|
settings: r,
|
|
4242
4245
|
spineItemsManager: e,
|
|
4243
4246
|
spineLayout: i,
|
|
@@ -4261,7 +4264,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4261
4264
|
});
|
|
4262
4265
|
}
|
|
4263
4266
|
};
|
|
4264
|
-
},
|
|
4267
|
+
}, Za = class extends Q {
|
|
4265
4268
|
constructor(e) {
|
|
4266
4269
|
super(), this.spineItemsManager = e;
|
|
4267
4270
|
let t = e.items;
|
|
@@ -4273,7 +4276,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4273
4276
|
item: e
|
|
4274
4277
|
}))))).pipe(O()), this.itemLoad$ = E(...t.map((e) => e.loaded$.pipe(T(() => e)))).pipe(O()), this.itemUnload$ = E(...t.map((e) => e.unloaded$.pipe(T(() => e)))).pipe(O());
|
|
4275
4278
|
}
|
|
4276
|
-
},
|
|
4279
|
+
}, Qa = class extends Q {
|
|
4277
4280
|
constructor(e, t, n, r, i) {
|
|
4278
4281
|
super(), this.spineItemsManager = e, this.spineItemsObserver = t, this.context = n, this.settings = r, this.viewport = i, this.externalLayoutTrigger = new m(), this.spineItemsRelativeLayouts = [];
|
|
4279
4282
|
let a = E(t.itemLoad$, t.itemUnload$).pipe(T(() => ({ immediate: !1 }))), o = E(this.externalLayoutTrigger, a);
|
|
@@ -4368,16 +4371,16 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4368
4371
|
y: r
|
|
4369
4372
|
});
|
|
4370
4373
|
}
|
|
4371
|
-
},
|
|
4374
|
+
}, $a = class extends Q {
|
|
4372
4375
|
constructor(e, t, n, r, i, a) {
|
|
4373
|
-
super(), this.context = e, this.pagination = t, this.spineItemsManager = n, this.spineItemLocator = r, this.settings = i, this.viewport = a, this.elementSubject = new l(void 0), this.element$ = this.elementSubject.asObservable(), this.spineItemsObserver = new
|
|
4376
|
+
super(), this.context = e, this.pagination = t, this.spineItemsManager = n, this.spineItemLocator = r, this.settings = i, this.viewport = a, this.elementSubject = new l(void 0), this.element$ = this.elementSubject.asObservable(), this.spineItemsObserver = new Za(n), this.spineLayout = new Qa(n, this.spineItemsObserver, e, i, a), this.locator = Xa({
|
|
4374
4377
|
context: e,
|
|
4375
4378
|
spineItemsManager: n,
|
|
4376
4379
|
spineItemLocator: r,
|
|
4377
4380
|
settings: i,
|
|
4378
4381
|
spineLayout: this.spineLayout,
|
|
4379
4382
|
viewport: a
|
|
4380
|
-
}), this.spineItemsLoader = new
|
|
4383
|
+
}), this.spineItemsLoader = new Ra(this.context, n, this.locator, i, this.spineLayout, this.viewport), this.pages = new Sr(this.spineLayout, this.spineItemsManager, this.spineItemLocator, this.context, this.locator, this.viewport);
|
|
4381
4384
|
let o = e.watch("rootElement").pipe(xe(K), I(() => {
|
|
4382
4385
|
let e = this.context.document.createElement("div");
|
|
4383
4386
|
e.style.cssText = "\n height: 100%;\n position: relative;\n ", e.className = `${X}-spine`, this.elementSubject.next(e);
|
|
@@ -4403,7 +4406,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4403
4406
|
destroy() {
|
|
4404
4407
|
super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
|
|
4405
4408
|
}
|
|
4406
|
-
},
|
|
4409
|
+
}, eo = class extends At {
|
|
4407
4410
|
onUnload() {}
|
|
4408
4411
|
onCreateDocument() {
|
|
4409
4412
|
return D(this.context.document.createElement("div"));
|
|
@@ -4418,10 +4421,10 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4418
4421
|
return u;
|
|
4419
4422
|
}
|
|
4420
4423
|
getDocumentFrame() {}
|
|
4421
|
-
},
|
|
4424
|
+
}, to = class extends Q {
|
|
4422
4425
|
constructor(e, t, n, i, a, s, c) {
|
|
4423
4426
|
super(), this.item = e, this.containerElement = t, this.context = n, this.hookManager = i, this.renderer = a, this.settings = s, this.viewport = c, this.layoutTriggerSubject = new m(), this.lastLayout = null, this.computeLayoutInformation = ({ isLastItem: e, horizontalOffset: t, spreadPosition: n }) => {
|
|
4424
|
-
let i = this.viewport.value.pageSize.width, a = "none", o = t % this.viewport.absoluteViewport.width === 0, s = this.context.manifest, c =
|
|
4427
|
+
let i = this.viewport.value.pageSize.width, a = "none", o = t % this.viewport.absoluteViewport.width === 0, s = this.context.manifest, c = Mi(s);
|
|
4425
4428
|
if (this.settings.values.computedSpreadMode) {
|
|
4426
4429
|
!c && this.renderer.renditionLayout === "reflowable" && !e && (i = this.viewport.value.pageSize.width * 2), !c && this.renderer.renditionLayout === "reflowable" && e && o && (i = this.viewport.value.pageSize.width * 2);
|
|
4427
4430
|
let t = o && e && c, s = r(this.item);
|
|
@@ -4503,7 +4506,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4503
4506
|
height: e.height ? parseFloat(e.height) : 0
|
|
4504
4507
|
};
|
|
4505
4508
|
}
|
|
4506
|
-
},
|
|
4509
|
+
}, no = class extends U {
|
|
4507
4510
|
constructor(e, t, n, r, i, a) {
|
|
4508
4511
|
super({
|
|
4509
4512
|
isLoaded: !1,
|
|
@@ -4524,7 +4527,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4524
4527
|
this.updateState({ isDirty: !0 });
|
|
4525
4528
|
}, this.destroy = () => {
|
|
4526
4529
|
this.isDestroyed || (super.destroy(), this._layout.destroy(), this.renderer.destroy(), this.containerElement.remove());
|
|
4527
|
-
}, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.layout = (e) => this._layout.layout(e), this.containerElement =
|
|
4530
|
+
}, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.layout = (e) => this._layout.layout(e), this.containerElement = ro(e, t.document);
|
|
4528
4531
|
let o = this.settings.values.getRenderer?.(e);
|
|
4529
4532
|
this.resourcesHandler = new Mt(e, this.settings);
|
|
4530
4533
|
let s = {
|
|
@@ -4536,7 +4539,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4536
4539
|
resourcesHandler: this.resourcesHandler,
|
|
4537
4540
|
viewport: this.viewport
|
|
4538
4541
|
};
|
|
4539
|
-
this.renderer = o ? o(s) : new
|
|
4542
|
+
this.renderer = o ? o(s) : new eo(s), this._layout = new to(e, this.containerElement, t, r, this.renderer, this.settings, this.viewport);
|
|
4540
4543
|
let c = this.renderer.state$.pipe(I(({ state: e, error: t }) => {
|
|
4541
4544
|
this.updateState({
|
|
4542
4545
|
isLoaded: e === "loaded",
|
|
@@ -4583,7 +4586,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4583
4586
|
return this._layout.layoutInfo;
|
|
4584
4587
|
}
|
|
4585
4588
|
get numberOfPages() {
|
|
4586
|
-
return
|
|
4589
|
+
return ma({
|
|
4587
4590
|
isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
|
|
4588
4591
|
itemHeight: this._layout.layoutInfo.height,
|
|
4589
4592
|
itemWidth: this._layout.layoutInfo.width,
|
|
@@ -4593,12 +4596,12 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4593
4596
|
pageTurnMode: this.settings.values.pageTurnMode
|
|
4594
4597
|
});
|
|
4595
4598
|
}
|
|
4596
|
-
},
|
|
4599
|
+
}, ro = (e, t) => {
|
|
4597
4600
|
let n = t.createElement("div");
|
|
4598
4601
|
return n.setAttribute(`data-${Tn}`, ""), n.classList.add("spineItem"), n.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), n.style.cssText = "\n position: absolute;\n overflow: hidden;\n ", n.dataset.isReady = "false", n;
|
|
4599
|
-
},
|
|
4602
|
+
}, io = class extends Q {
|
|
4600
4603
|
constructor(e, t, n, r) {
|
|
4601
|
-
super(), this.context = e, this.settings = t, this.hookManager = n, this.viewport = r, this.items = e.manifest.spineItems.map((i, a) => new
|
|
4604
|
+
super(), this.context = e, this.settings = t, this.hookManager = n, this.viewport = r, this.items = e.manifest.spineItems.map((i, a) => new no(i, e, t, n, a, r));
|
|
4602
4605
|
}
|
|
4603
4606
|
get(e) {
|
|
4604
4607
|
return typeof e == "number" ? this.items[e] : typeof e == "string" ? this.items.find(({ item: t }) => t.id === e) : e;
|
|
@@ -4608,14 +4611,14 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4608
4611
|
return n > r ? "after" : n === r ? "same" : "before";
|
|
4609
4612
|
}
|
|
4610
4613
|
getSpineItemIndex(e) {
|
|
4611
|
-
return (e instanceof
|
|
4614
|
+
return (e instanceof no ? e : this.get(e))?.index;
|
|
4612
4615
|
}
|
|
4613
4616
|
destroy() {
|
|
4614
4617
|
this.items.forEach((e) => {
|
|
4615
4618
|
e.destroy();
|
|
4616
4619
|
}), super.destroy();
|
|
4617
4620
|
}
|
|
4618
|
-
},
|
|
4621
|
+
}, ao = class extends U {
|
|
4619
4622
|
constructor(e, t) {
|
|
4620
4623
|
let n = e.document.createElement("div");
|
|
4621
4624
|
n.setAttribute(`data-${Cn}`, ""), super({
|
|
@@ -4654,7 +4657,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4654
4657
|
}), this.layoutSubject.next();
|
|
4655
4658
|
}
|
|
4656
4659
|
get absoluteViewport() {
|
|
4657
|
-
return new
|
|
4660
|
+
return new Va({
|
|
4658
4661
|
width: this.value.width,
|
|
4659
4662
|
height: this.value.height
|
|
4660
4663
|
});
|
|
@@ -4668,7 +4671,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4668
4671
|
}
|
|
4669
4672
|
get relativeViewport() {
|
|
4670
4673
|
let e = this.absoluteViewport, t = this.scaleFactor;
|
|
4671
|
-
return new
|
|
4674
|
+
return new Ha({
|
|
4672
4675
|
width: e.width / t,
|
|
4673
4676
|
height: e.height / t
|
|
4674
4677
|
});
|
|
@@ -4676,12 +4679,12 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4676
4679
|
destroy() {
|
|
4677
4680
|
super.destroy(), this.layoutSubject.complete(), this.value.element.remove();
|
|
4678
4681
|
}
|
|
4679
|
-
},
|
|
4680
|
-
let i = crypto.randomUUID(), a = `${xn}-core-${i}`, o = new m(), s = new m(), c = new
|
|
4682
|
+
}, oo = ({ manifest: e, cfi: t, ownerDocument: n = globalThis.document, ...r }) => {
|
|
4683
|
+
let i = crypto.randomUUID(), a = `${xn}-core-${i}`, o = new m(), s = new m(), c = new Ii(), l = new Pi(e, n), u = new La(r, l), d = new Fi(l, u), f = new ao(l, u), p = new io(l, u, c, f), h = new ji(c, p), g = _a({
|
|
4681
4684
|
context: l,
|
|
4682
4685
|
settings: u,
|
|
4683
4686
|
viewport: f
|
|
4684
|
-
}), _ = new
|
|
4687
|
+
}), _ = new Na(l, p), v = new $a(l, _, p, g, u, f), y = Ma({
|
|
4685
4688
|
cfi: h,
|
|
4686
4689
|
context: l,
|
|
4687
4690
|
spineItemsManager: p,
|
|
@@ -4689,15 +4692,15 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4689
4692
|
spine: v,
|
|
4690
4693
|
settings: u,
|
|
4691
4694
|
viewport: f
|
|
4692
|
-
}), ee = new
|
|
4695
|
+
}), ee = new Fa(l, _, p, v, y.isLocked$, h);
|
|
4693
4696
|
y.navigationState$.subscribe(l.bridgeEvent.viewportStateSubject), y.navigation$.subscribe(l.bridgeEvent.navigationSubject), y.position$.subscribe(l.bridgeEvent.positionSubject), _.subscribe(l.bridgeEvent.paginationSubject);
|
|
4694
4697
|
let te = (e = {}) => {
|
|
4695
4698
|
o.next(e);
|
|
4696
4699
|
}, ne = (e) => {
|
|
4697
4700
|
if (l.value.rootElement) throw Error("This reader is already mounted. A reader renders a single book, destroy it and create a new reader instead.");
|
|
4698
4701
|
if (e.ownerDocument !== l.document) throw Error("The container element must belong to the reader's document. Pass `ownerDocument` to `createReader` when mounting into a foreign document (eg: an iframe's contentDocument).");
|
|
4699
|
-
L.log("mount", { containerElement: e }), $e(l.document, a,
|
|
4700
|
-
let t =
|
|
4702
|
+
L.log("mount", { containerElement: e }), $e(l.document, a, Li);
|
|
4703
|
+
let t = lo(e, i);
|
|
4701
4704
|
l.update({ rootElement: t }), te({ immediate: !0 });
|
|
4702
4705
|
}, re = u.watch(["computedSpreadMode"]).pipe(De(1), I(() => te())), ie = E(o.pipe(I((e) => {
|
|
4703
4706
|
l.value.rootElement && (f.layout(), v.layout(e));
|
|
@@ -4715,7 +4718,7 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4715
4718
|
mount: ne,
|
|
4716
4719
|
destroy: () => {
|
|
4717
4720
|
let e = l.value.rootElement;
|
|
4718
|
-
e && (et(l.document, a),
|
|
4721
|
+
e && (et(l.document, a), uo(e)), ie.unsubscribe(), p.destroy(), ee.destroy(), u.destroy(), _.destroy(), l.destroy(), y.destroy(), v.destroy(), d.destroy(), s.next(), s.complete(), f.destroy();
|
|
4719
4722
|
},
|
|
4720
4723
|
pagination: {
|
|
4721
4724
|
get state() {
|
|
@@ -4734,9 +4737,9 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4734
4737
|
features: d,
|
|
4735
4738
|
$: { destroy$: s }
|
|
4736
4739
|
};
|
|
4737
|
-
},
|
|
4738
|
-
e.classList.remove(
|
|
4739
|
-
},
|
|
4740
|
+
}, so = `${X}-reader`, co = "data-prose-reader-container", lo = (e, t) => (e.classList.add(so), R(e, Sn, t), R(e, co, t), e), uo = (e) => {
|
|
4741
|
+
e.classList.remove(so), e.removeAttribute(Sn), e.removeAttribute(co);
|
|
4742
|
+
}, fo = ii(Ot(ci(Dt(ct(si(bi(dr(sn(Kn(lt(pt($r(Gn(oi(oo))))))))))))))), po = (e) => (t) => e(t), mo = 5e3, ho = (e, { itemReadinessTimeoutMs: t = mo } = {}) => Zn(e).pipe(A((n) => {
|
|
4740
4743
|
if (n.boundary === "start") return D(n);
|
|
4741
4744
|
let r = e.spineItemsManager.items, i = r[r.length - 1];
|
|
4742
4745
|
return i ? i.value.isReady ? D(n) : i.isReady$.pipe(x(Boolean), S(), T(() => n), t === Infinity ? ce : _e({
|
|
@@ -4745,6 +4748,6 @@ var ai = (e) => (t) => e(t), oi = (e, t, n) => {
|
|
|
4745
4748
|
}), Xn(e.navigation)) : u;
|
|
4746
4749
|
}), O());
|
|
4747
4750
|
//#endregion
|
|
4748
|
-
export { pn as AbstractSpinePosition, Dn as CSS_VAR_ABSOLUTE_VIEWPORT_HEIGHT, En as CSS_VAR_ABSOLUTE_VIEWPORT_WIDTH,
|
|
4751
|
+
export { pn as AbstractSpinePosition, Dn as CSS_VAR_ABSOLUTE_VIEWPORT_HEIGHT, En as CSS_VAR_ABSOLUTE_VIEWPORT_WIDTH, ji as CfiManager, Pi as Context, Vi as ControlledNavigationController, Q as DestroyableClass, At as DocumentRenderer, Fi as Features, Sn as HTML_ATTRIBUTE_DATA_READER_ID, X as HTML_PREFIX, wn as HTML_PREFIX_SCROLL_NAVIGATOR, Tn as HTML_PREFIX_SPINE_ITEM, Cn as HTML_PREFIX_VIEWPORT, xn as HTML_STYLE_PREFIX, Ii as HookManager, ca as InternalNavigator, cn as LayoutEntry, $i as Locker, bn as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE, vn as PROSE_READER_NAMESPACE, Sr as Pages, U as ReactiveEntity, Mt as ResourceHandler, mr as ResourcesLocator, hi as ScrollNavigationController, pi as ScrollPosition, Ia as SettingsManager, $a as Spine, no as SpineItem, un as SpineItemPageLayout, fn as SpineItemPageSpineLayout, q as SpineItemPosition, dn as SpineItemSpineLayout, io as SpineItemsManager, Za as SpineItemsObserver, J as SpinePosition, mi as UnboundScrollPosition, ln as UnboundSpineItemPagePosition, Y as UnboundSpinePosition, yn as VIEWPORT_ADJUSTMENT_THROTTLE, ao as Viewport, pr as consolidate, fo as createReader, St as deferIdle, bt as deferNextResult, Ci as generateCfiForSpineItemPage, wi as generateCfiFromRange, xi as generateRootCfi, nt as getAttributeValueFromString, mt as getBase64FromBlob, at as getFrameViewportInfo, Ti as getItemAnchor, sn as htmlEnhancer, xt as idle, $e as injectCSS, rt as injectCSSToFrame, K as isDefined, Ze as isHtmlElement, V as isHtmlTagElement, Di as isRootCfi, a as isShallowEqual, Gn as layoutEnhancer, gt as mapKeysTo, ho as observeBookBoundaryReached, wt as observeIntersection, Ct as observeMutation, Yn as observeNextSettledNavigation, vt as observeResize, Jn as observeSettledNavigation, $r as paginationEnhancer, ki as parseCfi, ht as pick, Ie as removeAttributeIfPresent, it as removeCSS, B as removeStylePropertyIfPresent, Ai as resolveCfi, po as rootEnhancer, R as setAttributeIfChanged, Le as setPropertyIfChanged, z as setStylePropertyIfChanged, Hn as shouldEnableSpreadModeForViewport, Un as shouldUseComputedSpreadModeForViewport, vr as spinePositionToSpineItemSpineLayout, Xn as takeUntilNextNavigationSettled, H as upsertCSSToFrame, ot as waitForFrameLoad, st as waitForFrameReady, qn as waitForNavigationSettled, yt as waitForSwitch, _t as watchKeys };
|
|
4749
4752
|
|
|
4750
4753
|
//# sourceMappingURL=index.js.map
|