@likecoin/epub-ts 0.4.6 → 0.4.8
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/epub.cjs +3 -3
- package/dist/epub.cjs.map +1 -1
- package/dist/epub.js +228 -160
- package/dist/epub.js.map +1 -1
- package/dist/epub.node.cjs +3 -3
- package/dist/epub.node.cjs.map +1 -1
- package/dist/epub.node.js +192 -124
- package/dist/epub.node.js.map +1 -1
- package/dist/epub.umd.js +3 -3
- package/dist/epub.umd.js.map +1 -1
- package/package.json +7 -3
package/dist/epub.js
CHANGED
|
@@ -14,7 +14,7 @@ function P(l) {
|
|
|
14
14
|
s[n](...i);
|
|
15
15
|
}, l;
|
|
16
16
|
}
|
|
17
|
-
const Et = typeof window < "u" ? window.requestAnimationFrame.bind(window) : !1, te = 1, ee = 3,
|
|
17
|
+
const Et = typeof window < "u" ? window.requestAnimationFrame.bind(window) : !1, te = 1, ee = 3, Pt = typeof URL < "u" ? URL : typeof window < "u" ? window.URL : void 0;
|
|
18
18
|
function ot() {
|
|
19
19
|
let l = (/* @__PURE__ */ new Date()).getTime();
|
|
20
20
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
|
|
@@ -31,13 +31,13 @@ function ie() {
|
|
|
31
31
|
document.documentElement.offsetHeight
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function zt(l) {
|
|
35
35
|
return !!(l && l.nodeType == 1);
|
|
36
36
|
}
|
|
37
37
|
function E(l) {
|
|
38
38
|
return !isNaN(parseFloat(l)) && isFinite(l);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Dt(l) {
|
|
41
41
|
const t = parseFloat(l);
|
|
42
42
|
return E(l) === !1 ? !1 : typeof l == "string" && l.indexOf(".") > -1 ? !0 : Math.floor(t) !== t;
|
|
43
43
|
}
|
|
@@ -50,7 +50,7 @@ function U(l) {
|
|
|
50
50
|
return e[n] + i;
|
|
51
51
|
return l;
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Bt(l, ...t) {
|
|
54
54
|
for (let e = 0; e < t.length; e++) {
|
|
55
55
|
const i = t[e];
|
|
56
56
|
for (const s in i)
|
|
@@ -142,21 +142,21 @@ function St(l, t) {
|
|
|
142
142
|
function ne(l) {
|
|
143
143
|
return St(l, ee);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Mt(l) {
|
|
146
146
|
return St(l, te);
|
|
147
147
|
}
|
|
148
148
|
function Y(l) {
|
|
149
149
|
return ["xml", "opf", "ncx"].indexOf(l) > -1;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function qt(l, t) {
|
|
152
152
|
return new Blob([l], { type: t });
|
|
153
153
|
}
|
|
154
154
|
function it(l, t) {
|
|
155
|
-
const e =
|
|
156
|
-
return
|
|
155
|
+
const e = qt(l, t);
|
|
156
|
+
return Pt.createObjectURL(e);
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
return
|
|
158
|
+
function _t(l) {
|
|
159
|
+
return Pt.revokeObjectURL(l);
|
|
160
160
|
}
|
|
161
161
|
function mt(l, t) {
|
|
162
162
|
if (typeof l != "string")
|
|
@@ -212,7 +212,7 @@ function Ft(l) {
|
|
|
212
212
|
};
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
|
-
class
|
|
215
|
+
class w {
|
|
216
216
|
constructor() {
|
|
217
217
|
this.id = ot(), this.promise = new Promise((t, e) => {
|
|
218
218
|
this.resolve = t, this.reject = e;
|
|
@@ -312,22 +312,22 @@ const oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
312
312
|
borders: tt,
|
|
313
313
|
bounds: Z,
|
|
314
314
|
createBase64Url: mt,
|
|
315
|
-
createBlob:
|
|
315
|
+
createBlob: qt,
|
|
316
316
|
createBlobUrl: it,
|
|
317
|
-
defaults:
|
|
318
|
-
defer:
|
|
317
|
+
defaults: Bt,
|
|
318
|
+
defer: w,
|
|
319
319
|
documentHeight: ie,
|
|
320
320
|
extend: C,
|
|
321
321
|
filterChildren: F,
|
|
322
322
|
findChildren: vt,
|
|
323
323
|
getParentByTagName: re,
|
|
324
|
-
indexOfElementNode:
|
|
324
|
+
indexOfElementNode: Mt,
|
|
325
325
|
indexOfNode: St,
|
|
326
326
|
indexOfSorted: Q,
|
|
327
327
|
indexOfTextNode: ne,
|
|
328
328
|
insert: se,
|
|
329
|
-
isElement:
|
|
330
|
-
isFloat:
|
|
329
|
+
isElement: zt,
|
|
330
|
+
isFloat: Dt,
|
|
331
331
|
isNumber: E,
|
|
332
332
|
isXml: Y,
|
|
333
333
|
locationOf: H,
|
|
@@ -340,7 +340,7 @@ const oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
340
340
|
qsp: j,
|
|
341
341
|
querySelectorByType: nt,
|
|
342
342
|
requestAnimationFrame: Et,
|
|
343
|
-
revokeBlobUrl:
|
|
343
|
+
revokeBlobUrl: _t,
|
|
344
344
|
sprint: st,
|
|
345
345
|
treeWalker: Ut,
|
|
346
346
|
type: Wt,
|
|
@@ -571,10 +571,10 @@ class R {
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
const W = 1, L = 3, ue = 9;
|
|
574
|
-
class
|
|
574
|
+
class y {
|
|
575
575
|
constructor(t, e, i) {
|
|
576
|
-
if (this.str = "", this.base = {}, this.spinePos = 0, this.range = !1, this.path = {}, this.start = null, this.end = null, !(this instanceof
|
|
577
|
-
return new
|
|
576
|
+
if (this.str = "", this.base = {}, this.spinePos = 0, this.range = !1, this.path = {}, this.start = null, this.end = null, !(this instanceof y))
|
|
577
|
+
return new y(t, e, i);
|
|
578
578
|
typeof e == "string" ? this.base = this.parseComponent(e) : typeof e == "object" && e.steps && (this.base = e);
|
|
579
579
|
const s = this.checkType(t);
|
|
580
580
|
if (s === "string")
|
|
@@ -594,7 +594,7 @@ class v {
|
|
|
594
594
|
* @private
|
|
595
595
|
*/
|
|
596
596
|
checkType(t) {
|
|
597
|
-
return this.isCfiString(t) ? "string" : t && typeof t == "object" && (Wt(t) === "Range" || typeof t.startContainer < "u") ? "range" : t && typeof t == "object" && typeof t.nodeType < "u" ? "node" : t && typeof t == "object" && t instanceof
|
|
597
|
+
return this.isCfiString(t) ? "string" : t && typeof t == "object" && (Wt(t) === "Range" || typeof t.startContainer < "u") ? "range" : t && typeof t == "object" && typeof t.nodeType < "u" ? "node" : t && typeof t == "object" && t instanceof y ? "EpubCFI" : !1;
|
|
598
598
|
}
|
|
599
599
|
/**
|
|
600
600
|
* Parse a cfi string to a CFI object representation
|
|
@@ -696,7 +696,7 @@ class v {
|
|
|
696
696
|
*/
|
|
697
697
|
compare(t, e) {
|
|
698
698
|
let i, s, n, r;
|
|
699
|
-
if (typeof t == "string" && (t = new
|
|
699
|
+
if (typeof t == "string" && (t = new y(t)), typeof e == "string" && (e = new y(e)), t.spinePos > e.spinePos)
|
|
700
700
|
return 1;
|
|
701
701
|
if (t.spinePos < e.spinePos)
|
|
702
702
|
return -1;
|
|
@@ -1070,7 +1070,7 @@ function ge(l, t) {
|
|
|
1070
1070
|
for (let r = 0; r < e.length; r++)
|
|
1071
1071
|
n(e[r]);
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function Nt(l, t, e) {
|
|
1074
1074
|
return t.forEach(function(i, s) {
|
|
1075
1075
|
if (i && e[s]) {
|
|
1076
1076
|
try {
|
|
@@ -1086,7 +1086,7 @@ function Lt(l, t, e) {
|
|
|
1086
1086
|
}), l;
|
|
1087
1087
|
}
|
|
1088
1088
|
function $(l, t, e, i) {
|
|
1089
|
-
const s = typeof window < "u" ? window.URL : !1, n = s ? "blob" : "arraybuffer", r = new
|
|
1089
|
+
const s = typeof window < "u" ? window.URL : !1, n = s ? "blob" : "arraybuffer", r = new w(), o = new XMLHttpRequest();
|
|
1090
1090
|
let h;
|
|
1091
1091
|
e && (o.withCredentials = !0), o.onreadystatechange = c, o.onerror = a, o.open("GET", l, !0);
|
|
1092
1092
|
for (h in i)
|
|
@@ -1134,7 +1134,7 @@ class me {
|
|
|
1134
1134
|
* @return {document} a promise with the xml document
|
|
1135
1135
|
*/
|
|
1136
1136
|
load(t) {
|
|
1137
|
-
const e = t || this.request || $, i = new
|
|
1137
|
+
const e = t || this.request || $, i = new w(), s = i.promise;
|
|
1138
1138
|
return this.contents ? i.resolve(this.contents) : e(this.url).then((n) => (this.document = n, this.contents = n.documentElement, this.hooks.content.trigger(this.document, this))).then(() => {
|
|
1139
1139
|
i.resolve(this.contents);
|
|
1140
1140
|
}).catch(function(n) {
|
|
@@ -1154,7 +1154,7 @@ class me {
|
|
|
1154
1154
|
* @return {string} output a serialized XML Document
|
|
1155
1155
|
*/
|
|
1156
1156
|
render(t) {
|
|
1157
|
-
const e = new
|
|
1157
|
+
const e = new w(), i = e.promise;
|
|
1158
1158
|
return this.load(t).then((s) => {
|
|
1159
1159
|
const n = new XMLSerializer();
|
|
1160
1160
|
return this.output = n.serializeToString(s), this.output;
|
|
@@ -1192,17 +1192,17 @@ class me {
|
|
|
1192
1192
|
*/
|
|
1193
1193
|
search(t, e = 5) {
|
|
1194
1194
|
const i = [], n = this, r = t.toLowerCase(), o = function(d) {
|
|
1195
|
-
const g = d.reduce((m,
|
|
1195
|
+
const g = d.reduce((m, v) => m + (v.textContent ?? ""), "").toLowerCase().indexOf(r);
|
|
1196
1196
|
if (g != -1) {
|
|
1197
|
-
const
|
|
1197
|
+
const v = g + r.length;
|
|
1198
1198
|
let x = 0, k = 0;
|
|
1199
1199
|
if (g < d[0].length) {
|
|
1200
|
-
for (; x < d.length - 1 && (k += d[x].length, !(
|
|
1200
|
+
for (; x < d.length - 1 && (k += d[x].length, !(v <= k)); )
|
|
1201
1201
|
x += 1;
|
|
1202
1202
|
const S = d[0], _ = d[x], T = n.document.createRange();
|
|
1203
1203
|
T.setStart(S, g);
|
|
1204
1204
|
const I = d.slice(0, x).reduce((lt, at) => lt + (at.textContent ?? "").length, 0);
|
|
1205
|
-
T.setEnd(_, I >
|
|
1205
|
+
T.setEnd(_, I > v ? v : v - I);
|
|
1206
1206
|
const q = n.cfiFromRange(T);
|
|
1207
1207
|
let D = d.slice(0, x + 1).reduce((lt, at) => lt + (at.textContent ?? ""), "");
|
|
1208
1208
|
D.length > 150 && (D = D.substring(g - 150 / 2, g + 150 / 2), D = "..." + D + "..."), i.push({
|
|
@@ -1241,7 +1241,7 @@ class me {
|
|
|
1241
1241
|
* @return {string} cfi an EpubCFI string
|
|
1242
1242
|
*/
|
|
1243
1243
|
cfiFromRange(t) {
|
|
1244
|
-
return new
|
|
1244
|
+
return new y(t, this.cfiBase).toString();
|
|
1245
1245
|
}
|
|
1246
1246
|
/**
|
|
1247
1247
|
* Get a CFI from an Element in the Section
|
|
@@ -1249,7 +1249,7 @@ class me {
|
|
|
1249
1249
|
* @return {string} cfi an EpubCFI string
|
|
1250
1250
|
*/
|
|
1251
1251
|
cfiFromElement(t) {
|
|
1252
|
-
return new
|
|
1252
|
+
return new y(t, this.cfiBase).toString();
|
|
1253
1253
|
}
|
|
1254
1254
|
/**
|
|
1255
1255
|
* Unload the section document
|
|
@@ -1263,7 +1263,7 @@ class me {
|
|
|
1263
1263
|
}
|
|
1264
1264
|
class ve {
|
|
1265
1265
|
constructor() {
|
|
1266
|
-
this.spineItems = [], this.spineByHref = {}, this.spineById = {}, this.hooks = {}, this.hooks.serialize = new A(), this.hooks.content = new A(), this.hooks.content.register(Ht), this.hooks.content.register(fe), this.hooks.content.register(pe), this.epubcfi = new
|
|
1266
|
+
this.spineItems = [], this.spineByHref = {}, this.spineById = {}, this.hooks = {}, this.hooks.serialize = new A(), this.hooks.content = new A(), this.hooks.content.register(Ht), this.hooks.content.register(fe), this.hooks.content.register(pe), this.epubcfi = new y(), this.loaded = !1, this.items = [], this.manifest = {}, this.spineNodeIndex = 0, this.baseUrl = "", this.length = 0;
|
|
1267
1267
|
}
|
|
1268
1268
|
/**
|
|
1269
1269
|
* Unpack items from a opf into spine items
|
|
@@ -1315,7 +1315,7 @@ class ve {
|
|
|
1315
1315
|
break;
|
|
1316
1316
|
e += 1;
|
|
1317
1317
|
}
|
|
1318
|
-
else this.epubcfi.isCfiString(t) ? e = new
|
|
1318
|
+
else this.epubcfi.isCfiString(t) ? e = new y(t).spinePos : typeof t == "number" || isNaN(Number(t)) === !1 ? e = Number(t) : typeof t == "string" && t.indexOf("#") === 0 ? e = this.spineById[t.substring(1)] ?? -1 : typeof t == "string" && (t = t.split("#")[0], e = this.spineByHref[t] ?? this.spineByHref[encodeURI(t)] ?? -1);
|
|
1319
1319
|
return this.spineItems[e] ?? null;
|
|
1320
1320
|
}
|
|
1321
1321
|
/**
|
|
@@ -1387,7 +1387,7 @@ class ve {
|
|
|
1387
1387
|
this.each((t) => t.destroy()), this.spineItems = void 0, this.spineByHref = void 0, this.spineById = void 0, this.hooks.serialize.clear(), this.hooks.content.clear(), this.hooks = void 0, this.epubcfi = void 0, this.loaded = !1, this.items = void 0, this.manifest = void 0, this.spineNodeIndex = void 0, this.baseUrl = void 0, this.length = void 0;
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
|
-
class
|
|
1390
|
+
class Ct {
|
|
1391
1391
|
constructor(t) {
|
|
1392
1392
|
this._q = [], this.context = t, this.tick = Et, this.running = !1, this.paused = !1;
|
|
1393
1393
|
}
|
|
@@ -1396,7 +1396,7 @@ class _t {
|
|
|
1396
1396
|
const [n, ...r] = t;
|
|
1397
1397
|
if (!n)
|
|
1398
1398
|
throw new Error("No Task Provided");
|
|
1399
|
-
return typeof n == "function" ? (e = new
|
|
1399
|
+
return typeof n == "function" ? (e = new w(), i = e.promise, s = {
|
|
1400
1400
|
task: n,
|
|
1401
1401
|
args: r,
|
|
1402
1402
|
//"context" : context,
|
|
@@ -1429,7 +1429,7 @@ class _t {
|
|
|
1429
1429
|
* @return {Promise}
|
|
1430
1430
|
*/
|
|
1431
1431
|
run() {
|
|
1432
|
-
return this.running || (this.running = !0, this.defered = new
|
|
1432
|
+
return this.running || (this.running = !0, this.defered = new w()), this.tick && this.tick(() => {
|
|
1433
1433
|
var t;
|
|
1434
1434
|
this._q.length ? (t = this.dequeue()) == null || t.then(() => {
|
|
1435
1435
|
this.run();
|
|
@@ -1532,7 +1532,7 @@ const ht = "0.3", J = ["keydown", "keyup", "keypress", "mouseup", "mousedown", "
|
|
|
1532
1532
|
};
|
|
1533
1533
|
class Xt {
|
|
1534
1534
|
constructor(t, e, i) {
|
|
1535
|
-
this.spine = t, this.request = e, this.pause = i || 100, this.q = new
|
|
1535
|
+
this.spine = t, this.request = e, this.pause = i || 100, this.q = new Ct(this), this.epubcfi = new y(), this._locations = [], this._locationsWords = [], this.total = 0, this.break = 150, this._current = 0, this._wordCounter = 0, this._currentCfi = "", this.processingTimeout = void 0;
|
|
1536
1536
|
}
|
|
1537
1537
|
/**
|
|
1538
1538
|
* Load all of sections in the book to generate locations
|
|
@@ -1554,7 +1554,7 @@ class Xt {
|
|
|
1554
1554
|
}
|
|
1555
1555
|
process(t) {
|
|
1556
1556
|
return t.load(this.request).then((e) => {
|
|
1557
|
-
const i = new
|
|
1557
|
+
const i = new w(), s = this.parse(e, t.cfiBase);
|
|
1558
1558
|
return this._locations = this._locations.concat(s), t.unload(), this.processingTimeout = setTimeout(() => i.resolve(s), this.pause), i.promise;
|
|
1559
1559
|
});
|
|
1560
1560
|
}
|
|
@@ -1574,13 +1574,13 @@ class Xt {
|
|
|
1574
1574
|
h += p - m, m = p;
|
|
1575
1575
|
else {
|
|
1576
1576
|
m += g, n.endContainer = u, n.endOffset = m;
|
|
1577
|
-
const
|
|
1578
|
-
s.push(
|
|
1577
|
+
const v = new y(n, e).toString();
|
|
1578
|
+
s.push(v), h = 0;
|
|
1579
1579
|
}
|
|
1580
1580
|
return a = u, !1;
|
|
1581
1581
|
}), n && n.startContainer && a) {
|
|
1582
1582
|
n.endContainer = a, n.endOffset = a.length;
|
|
1583
|
-
const u = new
|
|
1583
|
+
const u = new y(n, e).toString();
|
|
1584
1584
|
s.push(u), h = 0;
|
|
1585
1585
|
}
|
|
1586
1586
|
return s;
|
|
@@ -1593,14 +1593,14 @@ class Xt {
|
|
|
1593
1593
|
* @return {object} locations
|
|
1594
1594
|
*/
|
|
1595
1595
|
generateFromWords(t, e, i) {
|
|
1596
|
-
const s = t ? new
|
|
1596
|
+
const s = t ? new y(t) : void 0;
|
|
1597
1597
|
return this.q.pause(), this._locationsWords = [], this._wordCounter = 0, this.spine.each((n) => {
|
|
1598
1598
|
n.linear && (s ? n.index >= s.spinePos && this.q.enqueue((r, o, h, a) => this.processWords(r, o, h, a), n, e, s, i) : this.q.enqueue((r, o, h, a) => this.processWords(r, o, h, a), n, e, s, i));
|
|
1599
1599
|
}), this.q.run().then(() => (this._currentCfi && (this.currentLocation = this._currentCfi), this._locationsWords));
|
|
1600
1600
|
}
|
|
1601
1601
|
processWords(t, e, i, s) {
|
|
1602
1602
|
return s && this._locationsWords.length >= s ? Promise.resolve([]) : t.load(this.request).then((n) => {
|
|
1603
|
-
const r = new
|
|
1603
|
+
const r = new w(), o = this.parseWords(n, t, e, i), h = s - this._locationsWords.length;
|
|
1604
1604
|
return this._locationsWords = this._locationsWords.concat(o.length >= s ? o.slice(0, h) : o), t.unload(), this.processingTimeout = setTimeout(() => r.resolve(o), this.pause), r.promise;
|
|
1605
1605
|
});
|
|
1606
1606
|
}
|
|
@@ -1621,15 +1621,15 @@ class Xt {
|
|
|
1621
1621
|
if ((p.textContent ?? "").length < 10 && (p.textContent ?? "").trim().length === 0)
|
|
1622
1622
|
return !1;
|
|
1623
1623
|
const g = this.countWords(p.textContent ?? "");
|
|
1624
|
-
let m,
|
|
1624
|
+
let m, v = 0;
|
|
1625
1625
|
if (g === 0)
|
|
1626
1626
|
return !1;
|
|
1627
|
-
for (m = a - this._wordCounter, m > g && (this._wordCounter += g,
|
|
1628
|
-
if (m = a - this._wordCounter,
|
|
1629
|
-
this._wordCounter += g -
|
|
1627
|
+
for (m = a - this._wordCounter, m > g && (this._wordCounter += g, v = g); v < g; )
|
|
1628
|
+
if (m = a - this._wordCounter, v + m >= g)
|
|
1629
|
+
this._wordCounter += g - v, v = g;
|
|
1630
1630
|
else {
|
|
1631
|
-
|
|
1632
|
-
const x = new
|
|
1631
|
+
v += m;
|
|
1632
|
+
const x = new y(p, n);
|
|
1633
1633
|
r.push({ cfi: x.toString(), wordCount: this._wordCounter }), this._wordCounter = 0;
|
|
1634
1634
|
}
|
|
1635
1635
|
return !1;
|
|
@@ -1641,7 +1641,7 @@ class Xt {
|
|
|
1641
1641
|
* @return {number}
|
|
1642
1642
|
*/
|
|
1643
1643
|
locationFromCfi(t) {
|
|
1644
|
-
if (
|
|
1644
|
+
if (y.prototype.isCfiString(t) && (t = new y(t)), this._locations.length === 0)
|
|
1645
1645
|
return -1;
|
|
1646
1646
|
const e = H(t, this._locations, this.epubcfi.compare);
|
|
1647
1647
|
return e > this.total ? this.total : e;
|
|
@@ -1681,7 +1681,7 @@ class Xt {
|
|
|
1681
1681
|
*/
|
|
1682
1682
|
cfiFromPercentage(t) {
|
|
1683
1683
|
if (t > 1 && console.warn("Normalize cfiFromPercentage value to between 0 - 1"), t >= 1) {
|
|
1684
|
-
const i = new
|
|
1684
|
+
const i = new y(this._locations[this.total]);
|
|
1685
1685
|
return i.collapse(), i.toString();
|
|
1686
1686
|
}
|
|
1687
1687
|
const e = Math.ceil(this.total * t);
|
|
@@ -1760,7 +1760,7 @@ class ye {
|
|
|
1760
1760
|
this.packagePath = void 0, this.directory = void 0, this.encoding = void 0;
|
|
1761
1761
|
}
|
|
1762
1762
|
}
|
|
1763
|
-
class
|
|
1763
|
+
class Rt {
|
|
1764
1764
|
constructor(t) {
|
|
1765
1765
|
this.manifest = {}, this.navPath = "", this.ncxPath = "", this.coverPath = "", this.spineNodeIndex = 0, this.spine = [], this.metadata = {}, t && this.parse(t);
|
|
1766
1766
|
}
|
|
@@ -1781,7 +1781,7 @@ class Nt {
|
|
|
1781
1781
|
const s = b(t, "spine");
|
|
1782
1782
|
if (!s)
|
|
1783
1783
|
throw new Error("No Spine Found");
|
|
1784
|
-
return this.manifest = this.parseManifest(i), this.navPath = this.findNavPath(i), this.ncxPath = this.findNcxPath(i, s), this.coverPath = this.findCoverPath(t), this.spineNodeIndex =
|
|
1784
|
+
return this.manifest = this.parseManifest(i), this.navPath = this.findNavPath(i), this.ncxPath = this.findNcxPath(i, s), this.coverPath = this.findCoverPath(t), this.spineNodeIndex = Mt(s), this.spine = this.parseSpine(s, this.manifest), this.uniqueIdentifier = this.findUniqueIdentifier(t), this.metadata = this.parseMetadata(e), this.metadata.direction = s.getAttribute("page-progression-direction") ?? "", {
|
|
1785
1785
|
metadata: this.metadata,
|
|
1786
1786
|
spine: this.spine,
|
|
1787
1787
|
manifest: this.manifest,
|
|
@@ -2405,7 +2405,7 @@ class Ee {
|
|
|
2405
2405
|
return new z(i).relative(o);
|
|
2406
2406
|
});
|
|
2407
2407
|
return s ? s.then((r) => {
|
|
2408
|
-
const o =
|
|
2408
|
+
const o = Nt(r, n, this.replacementUrls);
|
|
2409
2409
|
return this.settings.replacements === "base64" ? e = mt(o, "text/css") : e = it(o, "text/css"), e;
|
|
2410
2410
|
}, (r) => new Promise(function(o) {
|
|
2411
2411
|
o();
|
|
@@ -2446,15 +2446,17 @@ class Ee {
|
|
|
2446
2446
|
*/
|
|
2447
2447
|
substitute(t, e) {
|
|
2448
2448
|
let i;
|
|
2449
|
-
return e ? i = this.relativeTo(e) : i = this.urls,
|
|
2449
|
+
return e ? i = this.relativeTo(e) : i = this.urls, Nt(t, i, this.replacementUrls);
|
|
2450
2450
|
}
|
|
2451
2451
|
destroy() {
|
|
2452
|
-
this.
|
|
2452
|
+
this.replacementUrls && this.replacementUrls.forEach((t) => {
|
|
2453
|
+
t && _t(t);
|
|
2454
|
+
}), this.settings = void 0, this.manifest = void 0, this.resources = void 0, this.replacementUrls = void 0, this.html = void 0, this.assets = void 0, this.css = void 0, this.urls = void 0, this.cssUrls = void 0;
|
|
2453
2455
|
}
|
|
2454
2456
|
}
|
|
2455
2457
|
class ut {
|
|
2456
2458
|
constructor(t) {
|
|
2457
|
-
this.pages = [], this.locations = [], this.epubcfi = new
|
|
2459
|
+
this.pages = [], this.locations = [], this.epubcfi = new y(), this.firstPage = 0, this.lastPage = 0, this.totalPages = 0, this.toc = void 0, this.ncx = void 0, t && (this.pageList = this.parse(t)), this.pageList && this.pageList.length && this.process(this.pageList);
|
|
2458
2460
|
}
|
|
2459
2461
|
/**
|
|
2460
2462
|
* Parse PageList Xml
|
|
@@ -2858,7 +2860,7 @@ class _e {
|
|
|
2858
2860
|
* @returns {Annotation} annotation
|
|
2859
2861
|
*/
|
|
2860
2862
|
add(t, e, i, s, n, r) {
|
|
2861
|
-
const o = encodeURI(e + t), a = new
|
|
2863
|
+
const o = encodeURI(e + t), a = new y(e).spinePos, c = new Yt({
|
|
2862
2864
|
type: t,
|
|
2863
2865
|
cfiRange: e,
|
|
2864
2866
|
data: i,
|
|
@@ -3048,7 +3050,7 @@ class bt {
|
|
|
3048
3050
|
end: this.findEnd(n, i, s)
|
|
3049
3051
|
});
|
|
3050
3052
|
if (this._dev === !0) {
|
|
3051
|
-
const o = t.document, h = new
|
|
3053
|
+
const o = t.document, h = new y(r.start).toRange(o), a = new y(r.end).toRange(o), c = o.defaultView.getSelection(), d = o.createRange();
|
|
3052
3054
|
c.removeAllRanges(), d.setStart(h.startContainer, h.startOffset), d.setEnd(a.endContainer, a.endOffset), c.addRange(d);
|
|
3053
3055
|
}
|
|
3054
3056
|
return r;
|
|
@@ -3239,7 +3241,7 @@ class bt {
|
|
|
3239
3241
|
rangePairToCfiPair(t, e) {
|
|
3240
3242
|
const i = e.start, s = e.end;
|
|
3241
3243
|
i.collapse(!0), s.collapse(!1);
|
|
3242
|
-
const n = new
|
|
3244
|
+
const n = new y(i, t).toString(), r = new y(s, t).toString();
|
|
3243
3245
|
return {
|
|
3244
3246
|
start: n,
|
|
3245
3247
|
end: r
|
|
@@ -3261,10 +3263,10 @@ class bt {
|
|
|
3261
3263
|
return t && (this.horizontal = t === "horizontal"), this.horizontal;
|
|
3262
3264
|
}
|
|
3263
3265
|
}
|
|
3264
|
-
const $t = typeof navigator < "u", Ce = $t && /Chrome/.test(navigator.userAgent),
|
|
3265
|
-
class
|
|
3266
|
+
const $t = typeof navigator < "u", Ce = $t && /Chrome/.test(navigator.userAgent), At = $t && !Ce && /AppleWebKit/.test(navigator.userAgent), Te = 1;
|
|
3267
|
+
class Tt {
|
|
3266
3268
|
constructor(t, e, i, s) {
|
|
3267
|
-
this.epubcfi = new
|
|
3269
|
+
this.epubcfi = new y(), this.document = t, this.documentElement = this.document.documentElement, this.content = e || this.document.body, this.window = this.document.defaultView, this._size = {
|
|
3268
3270
|
width: 0,
|
|
3269
3271
|
height: 0
|
|
3270
3272
|
}, this.sectionIndex = s || 0, this.cfiBase = i || "", this._mediaQueryHandlers = [], this.epubReadingSystem("epub.js", ht), this.called = 0, this.active = !0, this.listeners();
|
|
@@ -3400,7 +3402,7 @@ class Ct {
|
|
|
3400
3402
|
const r = e.getAttribute("content") ?? "", o = r.match(/width\s*=\s*([^,]*)/), h = r.match(/height\s*=\s*([^,]*)/), a = r.match(/initial-scale\s*=\s*([^,]*)/), c = r.match(/minimum-scale\s*=\s*([^,]*)/), d = r.match(/maximum-scale\s*=\s*([^,]*)/), u = r.match(/user-scalable\s*=\s*([^,]*)/);
|
|
3401
3403
|
o && o.length && typeof o[1] < "u" && (i.width = o[1]), h && h.length && typeof h[1] < "u" && (i.height = h[1]), a && a.length && typeof a[1] < "u" && (i.scale = a[1]), c && c.length && typeof c[1] < "u" && (i.minimum = c[1]), d && d.length && typeof d[1] < "u" && (i.maximum = d[1]), u && u.length && typeof u[1] < "u" && (i.scalable = u[1]);
|
|
3402
3404
|
}
|
|
3403
|
-
return n =
|
|
3405
|
+
return n = Bt(t ?? {}, i), t && (n.width && s.push("width=" + n.width), n.height && s.push("height=" + n.height), n.scale && s.push("initial-scale=" + n.scale), n.scalable === "no" ? (s.push("minimum-scale=" + n.scale), s.push("maximum-scale=" + n.scale), s.push("user-scalable=" + n.scalable)) : (n.scalable && s.push("user-scalable=" + n.scalable), n.minimum && s.push("minimum-scale=" + n.minimum), n.maximum && s.push("minimum-scale=" + n.maximum)), e || (e = this.document.createElement("meta"), e.setAttribute("name", "viewport"), this.document.querySelector("head").appendChild(e)), e.setAttribute("content", s.join(", ")), this.window.scrollTo(0, 0)), n;
|
|
3404
3406
|
}
|
|
3405
3407
|
/**
|
|
3406
3408
|
* Event emitter for when the contents has expanded
|
|
@@ -3414,7 +3416,7 @@ class Ct {
|
|
|
3414
3416
|
* @private
|
|
3415
3417
|
*/
|
|
3416
3418
|
listeners() {
|
|
3417
|
-
this.imageLoadListeners(), this.mediaQueryListeners(), this.addEventListeners(), this.addSelectionListeners(), typeof ResizeObserver > "u" ? (this.resizeListeners(), this.visibilityListeners()) : this.resizeObservers(), this.linksHandler();
|
|
3419
|
+
this.imageLoadListeners(), this.mediaQueryListeners(), this.fontLoadListeners(), this.addEventListeners(), this.addSelectionListeners(), typeof ResizeObserver > "u" ? (this.resizeListeners(), this.visibilityListeners()) : this.resizeObservers(), this.linksHandler();
|
|
3418
3420
|
}
|
|
3419
3421
|
/**
|
|
3420
3422
|
* Remove DOM listeners
|
|
@@ -3546,7 +3548,7 @@ class Ct {
|
|
|
3546
3548
|
const s = { left: 0, top: 0 };
|
|
3547
3549
|
if (!this.document) return s;
|
|
3548
3550
|
if (this.epubcfi.isCfiString(t)) {
|
|
3549
|
-
const n = new
|
|
3551
|
+
const n = new y(t).toRange(this.document, e);
|
|
3550
3552
|
if (n) {
|
|
3551
3553
|
try {
|
|
3552
3554
|
if (!n.endContainer || n.startContainer == n.endContainer && n.startOffset == n.endOffset) {
|
|
@@ -3558,7 +3560,7 @@ class Ct {
|
|
|
3558
3560
|
}
|
|
3559
3561
|
if (n.startContainer.nodeType === Node.ELEMENT_NODE)
|
|
3560
3562
|
i = n.startContainer.getBoundingClientRect(), s.left = i.left, s.top = i.top;
|
|
3561
|
-
else if (
|
|
3563
|
+
else if (At) {
|
|
3562
3564
|
const r = n.startContainer, o = new Range();
|
|
3563
3565
|
try {
|
|
3564
3566
|
r.nodeType === Te ? i = r.getBoundingClientRect() : n.startOffset + 2 < r.length ? (o.setStart(r, n.startOffset), o.setEnd(r, n.startOffset + 2), i = o.getBoundingClientRect()) : n.startOffset - 2 > 0 ? (o.setStart(r, n.startOffset - 2), o.setEnd(r, n.startOffset), i = o.getBoundingClientRect()) : i = r.parentNode.getBoundingClientRect();
|
|
@@ -3571,7 +3573,7 @@ class Ct {
|
|
|
3571
3573
|
} else if (typeof t == "string" && t.indexOf("#") > -1) {
|
|
3572
3574
|
const n = t.substring(t.indexOf("#") + 1), r = this.document.getElementById(n);
|
|
3573
3575
|
if (r)
|
|
3574
|
-
if (
|
|
3576
|
+
if (At) {
|
|
3575
3577
|
const o = new Range();
|
|
3576
3578
|
o.selectNode(r), i = o.getBoundingClientRect();
|
|
3577
3579
|
} else
|
|
@@ -3745,7 +3747,7 @@ class Ct {
|
|
|
3745
3747
|
*/
|
|
3746
3748
|
triggerSelectedEvent(t) {
|
|
3747
3749
|
let e, i;
|
|
3748
|
-
t && t.rangeCount > 0 && (e = t.getRangeAt(0), e.collapsed || (i = new
|
|
3750
|
+
t && t.rangeCount > 0 && (e = t.getRangeAt(0), e.collapsed || (i = new y(e, this.cfiBase).toString(), this.emit(f.CONTENTS.SELECTED, i), this.emit(f.CONTENTS.SELECTED_RANGE, e)));
|
|
3749
3751
|
}
|
|
3750
3752
|
/**
|
|
3751
3753
|
* Get a Dom Range from EpubCFI
|
|
@@ -3754,7 +3756,7 @@ class Ct {
|
|
|
3754
3756
|
* @returns {Range} range
|
|
3755
3757
|
*/
|
|
3756
3758
|
range(t, e) {
|
|
3757
|
-
return new
|
|
3759
|
+
return new y(t).toRange(this.document, e);
|
|
3758
3760
|
}
|
|
3759
3761
|
/**
|
|
3760
3762
|
* Get an EpubCFI from a Dom Range
|
|
@@ -3763,7 +3765,7 @@ class Ct {
|
|
|
3763
3765
|
* @returns {EpubCFI} cfi
|
|
3764
3766
|
*/
|
|
3765
3767
|
cfiFromRange(t, e) {
|
|
3766
|
-
return new
|
|
3768
|
+
return new y(t, this.cfiBase, e).toString();
|
|
3767
3769
|
}
|
|
3768
3770
|
/**
|
|
3769
3771
|
* Get an EpubCFI from a Dom node
|
|
@@ -3772,7 +3774,7 @@ class Ct {
|
|
|
3772
3774
|
* @returns {EpubCFI} cfi
|
|
3773
3775
|
*/
|
|
3774
3776
|
cfiFromNode(t, e) {
|
|
3775
|
-
return new
|
|
3777
|
+
return new y(t, this.cfiBase, e).toString();
|
|
3776
3778
|
}
|
|
3777
3779
|
/**
|
|
3778
3780
|
* Size the contents to a given width and height
|
|
@@ -3887,7 +3889,7 @@ class Ct {
|
|
|
3887
3889
|
this.removeListeners(), this.__listeners = {};
|
|
3888
3890
|
}
|
|
3889
3891
|
}
|
|
3890
|
-
P(
|
|
3892
|
+
P(Tt.prototype);
|
|
3891
3893
|
function K(l) {
|
|
3892
3894
|
return document.createElementNS("http://www.w3.org/2000/svg", l);
|
|
3893
3895
|
}
|
|
@@ -3969,7 +3971,7 @@ function Ae(l, t) {
|
|
|
3969
3971
|
function Ie(l, t) {
|
|
3970
3972
|
return t.right <= l.right && t.left >= l.left && t.top >= l.top && t.bottom <= l.bottom;
|
|
3971
3973
|
}
|
|
3972
|
-
class
|
|
3974
|
+
class It {
|
|
3973
3975
|
constructor(t, e = document.body) {
|
|
3974
3976
|
this.target = t, this.element = K("svg"), this.marks = [], this.element.style.position = "absolute", this.element.setAttribute("pointer-events", "none"), ke(this.target, this.marks), this.container = e, this.container.appendChild(this.element), this.render();
|
|
3975
3977
|
}
|
|
@@ -4084,7 +4086,7 @@ class Zt {
|
|
|
4084
4086
|
forceRight: !1,
|
|
4085
4087
|
allowScriptedContent: !1,
|
|
4086
4088
|
allowPopups: !1
|
|
4087
|
-
}, e || {}), this.id = "epubjs-view-" + ot(), this.section = t, this.index = t.index, this.element = this.container(this.settings.axis), this.added = !1, this.displayed = !1, this.rendered = !1, this.fixedWidth = 0, this.fixedHeight = 0, this.epubcfi = new
|
|
4089
|
+
}, e || {}), this.id = "epubjs-view-" + ot(), this.section = t, this.index = t.index, this.element = this.container(this.settings.axis), this.added = !1, this.displayed = !1, this.rendered = !1, this.fixedWidth = 0, this.fixedHeight = 0, this.epubcfi = new y(), this.layout = this.settings.layout, this.pane = void 0, this.highlights = {}, this.underlines = {}, this.marks = {};
|
|
4088
4090
|
}
|
|
4089
4091
|
container(t) {
|
|
4090
4092
|
const e = document.createElement("div");
|
|
@@ -4140,7 +4142,7 @@ class Zt {
|
|
|
4140
4142
|
}), this.onResize(this, n), this.emit(f.VIEWS.RESIZED, n), this.prevBounds = n, this.elementBounds = Z(this.element);
|
|
4141
4143
|
}
|
|
4142
4144
|
load(t) {
|
|
4143
|
-
const e = new
|
|
4145
|
+
const e = new w(), i = e.promise;
|
|
4144
4146
|
if (!this.iframe)
|
|
4145
4147
|
return e.reject(new Error("No Iframe Available")), i;
|
|
4146
4148
|
if (this.iframe.onload = (s) => {
|
|
@@ -4157,7 +4159,7 @@ class Zt {
|
|
|
4157
4159
|
return i;
|
|
4158
4160
|
}
|
|
4159
4161
|
onLoad(t, e) {
|
|
4160
|
-
this.window = this.iframe.contentWindow, this.document = this.iframe.contentDocument, this.contents = new
|
|
4162
|
+
this.window = this.iframe.contentWindow, this.document = this.iframe.contentDocument, this.contents = new Tt(this.document, this.document.body, this.section.cfiBase, this.section.index), this.rendering = !1;
|
|
4161
4163
|
let i = this.document.querySelector("link[rel='canonical']");
|
|
4162
4164
|
i ? i.setAttribute("href", this.section.canonical) : (i = this.document.createElement("link"), i.setAttribute("rel", "canonical"), i.setAttribute("href", this.section.canonical), this.document.querySelector("head").appendChild(i)), this.contents.on(f.CONTENTS.EXPAND, () => {
|
|
4163
4165
|
this.displayed && this.iframe && (this.expand(), this.contents && this.layout.format(this.contents));
|
|
@@ -4180,7 +4182,7 @@ class Zt {
|
|
|
4180
4182
|
this.contents && (this.contents.off(f.CONTENTS.EXPAND), this.contents.off(f.CONTENTS.RESIZE));
|
|
4181
4183
|
}
|
|
4182
4184
|
display(t) {
|
|
4183
|
-
const e = new
|
|
4185
|
+
const e = new w();
|
|
4184
4186
|
return this.displayed ? e.resolve(this) : this.render(t).then(() => {
|
|
4185
4187
|
this.emit(f.VIEWS.DISPLAYED, this), this.onDisplayed(this), this.displayed = !0, e.resolve(this);
|
|
4186
4188
|
}, (i) => {
|
|
@@ -4229,7 +4231,7 @@ class Zt {
|
|
|
4229
4231
|
const r = Object.assign({ fill: "yellow", "fill-opacity": "0.3", "mix-blend-mode": "multiply" }, n), o = this.contents.range(t), h = (d) => {
|
|
4230
4232
|
this.emit(f.VIEWS.MARK_CLICKED, t, e);
|
|
4231
4233
|
};
|
|
4232
|
-
e.epubcfi = t, this.pane || (this.pane = new
|
|
4234
|
+
e.epubcfi = t, this.pane || (this.pane = new It(this.iframe, this.element));
|
|
4233
4235
|
const a = new Kt(o, s, e, r);
|
|
4234
4236
|
let c;
|
|
4235
4237
|
try {
|
|
@@ -4246,7 +4248,7 @@ class Zt {
|
|
|
4246
4248
|
const r = Object.assign({ stroke: "black", "stroke-opacity": "0.3", "mix-blend-mode": "multiply" }, n), o = this.contents.range(t), h = (d) => {
|
|
4247
4249
|
this.emit(f.VIEWS.MARK_CLICKED, t, e);
|
|
4248
4250
|
};
|
|
4249
|
-
e.epubcfi = t, this.pane || (this.pane = new
|
|
4251
|
+
e.epubcfi = t, this.pane || (this.pane = new It(this.iframe, this.element));
|
|
4250
4252
|
const a = new Pe(o, s, e, r);
|
|
4251
4253
|
let c;
|
|
4252
4254
|
try {
|
|
@@ -4318,7 +4320,7 @@ class Zt {
|
|
|
4318
4320
|
this.ununderline(t);
|
|
4319
4321
|
for (const t in this.marks)
|
|
4320
4322
|
this.unmark(t);
|
|
4321
|
-
this.blobUrl &&
|
|
4323
|
+
this.blobUrl && _t(this.blobUrl), this.displayed && (this.displayed = !1, this.removeListeners(), this.contents.destroy(), this.stopExpanding = !0, this.iframe && (this.iframe.onload = null), this.element.removeChild(this.iframe), this.pane && (this.pane.element.remove(), this.pane = void 0), this.iframe = void 0, this.contents = void 0, this.section.unload(), this._textWidth = void 0, this._textHeight = void 0, this._width = void 0, this._height = void 0), this.__listeners = {};
|
|
4322
4324
|
}
|
|
4323
4325
|
}
|
|
4324
4326
|
P(Zt.prototype);
|
|
@@ -4367,7 +4369,7 @@ class Me {
|
|
|
4367
4369
|
}
|
|
4368
4370
|
getElement(t) {
|
|
4369
4371
|
let e = null;
|
|
4370
|
-
if (
|
|
4372
|
+
if (zt(t) ? e = t : typeof t == "string" && (e = document.getElementById(t)), !e)
|
|
4371
4373
|
throw new Error("Not an Element");
|
|
4372
4374
|
return e;
|
|
4373
4375
|
}
|
|
@@ -4527,7 +4529,7 @@ class qe {
|
|
|
4527
4529
|
}
|
|
4528
4530
|
class rt {
|
|
4529
4531
|
constructor(t) {
|
|
4530
|
-
this.name = "default", this.optsSettings = t.settings, this.View = t.view, this.request = t.request, this.renditionQueue = t.queue, this.q = new
|
|
4532
|
+
this.name = "default", this.optsSettings = t.settings, this.View = t.view, this.request = t.request, this.renditionQueue = t.queue, this.q = new Ct(this), this.settings = C({}, {
|
|
4531
4533
|
infinite: !0,
|
|
4532
4534
|
hidden: !1,
|
|
4533
4535
|
width: void 0,
|
|
@@ -4614,7 +4616,7 @@ class rt {
|
|
|
4614
4616
|
}
|
|
4615
4617
|
}
|
|
4616
4618
|
display(t, e) {
|
|
4617
|
-
const i = new
|
|
4619
|
+
const i = new w(), s = i.promise;
|
|
4618
4620
|
(e === t.href || E(e)) && (e = void 0);
|
|
4619
4621
|
const n = this.views.find(t);
|
|
4620
4622
|
if (n && t && this.layout.name !== "pre-paginated") {
|
|
@@ -4696,31 +4698,95 @@ class rt {
|
|
|
4696
4698
|
var s, n, r, o, h, a, c, d, u, p;
|
|
4697
4699
|
let t, e;
|
|
4698
4700
|
const i = this.settings.direction;
|
|
4699
|
-
if (this.views.length
|
|
4700
|
-
this.
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4701
|
+
if (this.views.length) {
|
|
4702
|
+
if (this.isPaginated && this.settings.axis === "horizontal" && (!i || i === "ltr"))
|
|
4703
|
+
if (this.scrollLeft = this.container.scrollLeft, e = this.container.scrollLeft + this.container.offsetWidth + this.layout.delta, e <= this.container.scrollWidth)
|
|
4704
|
+
this.scrollBy(this.layout.delta, 0, !0);
|
|
4705
|
+
else {
|
|
4706
|
+
const g = this.views.last();
|
|
4707
|
+
g && g.expand(), e = this.container.scrollLeft + this.container.offsetWidth + this.layout.delta, e <= this.container.scrollWidth ? this.scrollBy(this.layout.delta, 0, !0) : t = (n = g == null ? void 0 : (s = g.section).next) == null ? void 0 : n.call(s);
|
|
4708
|
+
}
|
|
4709
|
+
else if (this.isPaginated && this.settings.axis === "horizontal" && i === "rtl")
|
|
4710
|
+
if (this.scrollLeft = this.container.scrollLeft, this.settings.rtlScrollType === "default")
|
|
4711
|
+
if (e = this.container.scrollLeft, e > 0)
|
|
4712
|
+
this.scrollBy(this.layout.delta, 0, !0);
|
|
4713
|
+
else {
|
|
4714
|
+
const g = this.views.last();
|
|
4715
|
+
g && g.expand(), e = this.container.scrollLeft, e > 0 ? this.scrollBy(this.layout.delta, 0, !0) : t = (o = g == null ? void 0 : (r = g.section).next) == null ? void 0 : o.call(r);
|
|
4716
|
+
}
|
|
4717
|
+
else if (e = this.container.scrollLeft + this.layout.delta * -1, e > this.container.scrollWidth * -1)
|
|
4718
|
+
this.scrollBy(this.layout.delta, 0, !0);
|
|
4719
|
+
else {
|
|
4720
|
+
const g = this.views.last();
|
|
4721
|
+
g && g.expand(), e = this.container.scrollLeft + this.layout.delta * -1, e > this.container.scrollWidth * -1 ? this.scrollBy(this.layout.delta, 0, !0) : t = (a = g == null ? void 0 : (h = g.section).next) == null ? void 0 : a.call(h);
|
|
4722
|
+
}
|
|
4723
|
+
else if (this.isPaginated && this.settings.axis === "vertical")
|
|
4724
|
+
if (this.scrollTop = this.container.scrollTop, !(Math.abs(this.container.scrollHeight - this.container.clientHeight - this.container.scrollTop) < 1))
|
|
4725
|
+
this.scrollBy(0, this.layout.height, !0);
|
|
4726
|
+
else {
|
|
4727
|
+
const m = this.views.last();
|
|
4728
|
+
m && m.expand(), Math.abs(this.container.scrollHeight - this.container.clientHeight - this.container.scrollTop) < 1 ? t = (d = m == null ? void 0 : (c = m.section).next) == null ? void 0 : d.call(c) : this.scrollBy(0, this.layout.height, !0);
|
|
4729
|
+
}
|
|
4730
|
+
else
|
|
4731
|
+
t = (p = (u = this.views.last().section).next) == null ? void 0 : p.call(u);
|
|
4732
|
+
if (t) {
|
|
4733
|
+
this.clear(), this.updateLayout();
|
|
4734
|
+
let g = !1;
|
|
4735
|
+
return this.layout.name === "pre-paginated" && this.layout.divisor === 2 && t.properties.includes("page-spread-right") && (g = !0), this.append(t, g).then(() => this.handleNextPrePaginated(g, t, this.append), (m) => m).then(() => {
|
|
4736
|
+
!this.isPaginated && this.settings.axis === "horizontal" && this.settings.direction === "rtl" && this.settings.rtlScrollType === "default" && this.scrollTo(this.container.scrollWidth, 0, !0), this.views.show();
|
|
4737
|
+
});
|
|
4738
|
+
}
|
|
4705
4739
|
}
|
|
4706
4740
|
}
|
|
4707
4741
|
prev() {
|
|
4708
4742
|
var s, n, r, o, h, a, c, d, u, p, g;
|
|
4709
4743
|
let t, e;
|
|
4710
4744
|
const i = this.settings.direction;
|
|
4711
|
-
if (this.views.length
|
|
4712
|
-
this.
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
if (x)
|
|
4719
|
-
return this.prepend(x);
|
|
4745
|
+
if (this.views.length) {
|
|
4746
|
+
if (this.isPaginated && this.settings.axis === "horizontal" && (!i || i === "ltr"))
|
|
4747
|
+
if (this.scrollLeft = this.container.scrollLeft, e = this.container.scrollLeft, e > 0)
|
|
4748
|
+
this.scrollBy(-this.layout.delta, 0, !0);
|
|
4749
|
+
else {
|
|
4750
|
+
const m = this.views.first();
|
|
4751
|
+
m && m.expand(), e = this.container.scrollLeft, e > 0 ? this.scrollBy(-this.layout.delta, 0, !0) : t = (n = m == null ? void 0 : (s = m.section).prev) == null ? void 0 : n.call(s);
|
|
4720
4752
|
}
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4753
|
+
else if (this.isPaginated && this.settings.axis === "horizontal" && i === "rtl")
|
|
4754
|
+
if (this.scrollLeft = this.container.scrollLeft, this.settings.rtlScrollType === "default")
|
|
4755
|
+
if (e = this.container.scrollLeft + this.container.offsetWidth, e < this.container.scrollWidth)
|
|
4756
|
+
this.scrollBy(-this.layout.delta, 0, !0);
|
|
4757
|
+
else {
|
|
4758
|
+
const m = this.views.first();
|
|
4759
|
+
m && m.expand(), e = this.container.scrollLeft + this.container.offsetWidth, e < this.container.scrollWidth ? this.scrollBy(-this.layout.delta, 0, !0) : t = (o = m == null ? void 0 : (r = m.section).prev) == null ? void 0 : o.call(r);
|
|
4760
|
+
}
|
|
4761
|
+
else if (e = this.container.scrollLeft, e < 0)
|
|
4762
|
+
this.scrollBy(-this.layout.delta, 0, !0);
|
|
4763
|
+
else {
|
|
4764
|
+
const m = this.views.first();
|
|
4765
|
+
m && m.expand(), e = this.container.scrollLeft, e < 0 ? this.scrollBy(-this.layout.delta, 0, !0) : t = (a = m == null ? void 0 : (h = m.section).prev) == null ? void 0 : a.call(h);
|
|
4766
|
+
}
|
|
4767
|
+
else if (this.isPaginated && this.settings.axis === "vertical")
|
|
4768
|
+
if (this.scrollTop = this.container.scrollTop, this.container.scrollTop > 0)
|
|
4769
|
+
this.scrollBy(0, -this.layout.height, !0);
|
|
4770
|
+
else {
|
|
4771
|
+
const v = this.views.first();
|
|
4772
|
+
v && v.expand(), this.container.scrollTop > 0 ? this.scrollBy(0, -this.layout.height, !0) : t = (d = v == null ? void 0 : (c = v.section).prev) == null ? void 0 : d.call(c);
|
|
4773
|
+
}
|
|
4774
|
+
else
|
|
4775
|
+
t = (p = (u = this.views.first().section).prev) == null ? void 0 : p.call(u);
|
|
4776
|
+
if (t) {
|
|
4777
|
+
this.clear(), this.updateLayout();
|
|
4778
|
+
let m = !1;
|
|
4779
|
+
return this.layout.name === "pre-paginated" && this.layout.divisor === 2 && typeof ((g = t.prev) == null ? void 0 : g.call(t)) != "object" && (m = !0), this.prepend(t, m).then(() => {
|
|
4780
|
+
var v;
|
|
4781
|
+
if (this.layout.name === "pre-paginated" && this.layout.divisor > 1) {
|
|
4782
|
+
const x = (v = t.prev) == null ? void 0 : v.call(t);
|
|
4783
|
+
if (x)
|
|
4784
|
+
return this.prepend(x);
|
|
4785
|
+
}
|
|
4786
|
+
}, (v) => v).then(() => {
|
|
4787
|
+
this.isPaginated && this.settings.axis === "horizontal" && (this.settings.direction === "rtl" ? this.settings.rtlScrollType === "default" ? this.scrollTo(0, 0, !0) : this.scrollTo(this.container.scrollWidth * -1 + this.layout.delta, 0, !0) : this.scrollTo(this.container.scrollWidth - this.layout.delta, 0, !0)), this.views.show();
|
|
4788
|
+
});
|
|
4789
|
+
}
|
|
4724
4790
|
}
|
|
4725
4791
|
}
|
|
4726
4792
|
current() {
|
|
@@ -4740,9 +4806,9 @@ class rt {
|
|
|
4740
4806
|
const o = 0;
|
|
4741
4807
|
return this.settings.fullsize && (r = n ? window.scrollY : window.scrollX), t.map((a) => {
|
|
4742
4808
|
const c = a.section.index, d = a.section.href, u = a.position(), p = a.width(), g = a.height();
|
|
4743
|
-
let m,
|
|
4744
|
-
n ? (m = r + e.top - u.top + o,
|
|
4745
|
-
let S = Math.ceil(m / x), _ = [], T = Math.ceil(
|
|
4809
|
+
let m, v, x, k;
|
|
4810
|
+
n ? (m = r + e.top - u.top + o, v = m + i - o, k = this.layout.count(g, i).pages, x = i) : (m = r + e.left - u.left + o, v = m + s - o, k = this.layout.count(p, s).pages, x = s);
|
|
4811
|
+
let S = Math.ceil(m / x), _ = [], T = Math.ceil(v / x);
|
|
4746
4812
|
if (this.settings.direction === "rtl" && !n) {
|
|
4747
4813
|
const q = S;
|
|
4748
4814
|
S = k - T, T = k - q;
|
|
@@ -4752,7 +4818,7 @@ class rt {
|
|
|
4752
4818
|
const D = q + 1;
|
|
4753
4819
|
_.push(D);
|
|
4754
4820
|
}
|
|
4755
|
-
const I = this.mapping.page(a.contents, a.section.cfiBase, m,
|
|
4821
|
+
const I = this.mapping.page(a.contents, a.section.cfiBase, m, v);
|
|
4756
4822
|
return {
|
|
4757
4823
|
index: c,
|
|
4758
4824
|
href: d,
|
|
@@ -4771,13 +4837,13 @@ class rt {
|
|
|
4771
4837
|
const c = r.position(), d = r.width();
|
|
4772
4838
|
let u, p, g;
|
|
4773
4839
|
this.settings.direction === "rtl" ? (a = e.right - i, g = Math.min(Math.abs(a - c.left), this.layout.width) - s, p = c.width - (c.right - a) - s, u = p - g) : (a = e.left + i, g = Math.min(c.right - a, this.layout.width) - s, u = a - c.left + s, p = u + g), s += g;
|
|
4774
|
-
const m = this.mapping.page(r.contents, r.section.cfiBase, u, p),
|
|
4840
|
+
const m = this.mapping.page(r.contents, r.section.cfiBase, u, p), v = this.layout.count(d).pages;
|
|
4775
4841
|
let x = Math.floor(u / this.layout.pageWidth);
|
|
4776
4842
|
const k = [];
|
|
4777
4843
|
let S = Math.floor(p / this.layout.pageWidth);
|
|
4778
4844
|
if (x < 0 && (x = 0, S = S + 1), this.settings.direction === "rtl") {
|
|
4779
4845
|
const _ = x;
|
|
4780
|
-
x =
|
|
4846
|
+
x = v - S, S = v - _;
|
|
4781
4847
|
}
|
|
4782
4848
|
for (let _ = x + 1; _ <= S; _++) {
|
|
4783
4849
|
const T = _;
|
|
@@ -4787,7 +4853,7 @@ class rt {
|
|
|
4787
4853
|
index: o,
|
|
4788
4854
|
href: h,
|
|
4789
4855
|
pages: k,
|
|
4790
|
-
totalPages:
|
|
4856
|
+
totalPages: v,
|
|
4791
4857
|
mapping: m
|
|
4792
4858
|
};
|
|
4793
4859
|
});
|
|
@@ -4941,7 +5007,7 @@ class xt {
|
|
|
4941
5007
|
return t && (s += t * i), this.smoothScrollTo(s);
|
|
4942
5008
|
}
|
|
4943
5009
|
smoothScrollTo(t) {
|
|
4944
|
-
const e = new
|
|
5010
|
+
const e = new w(), i = this.scrollLeft, s = this.now(), n = this.settings.duration, r = this.settings.easing;
|
|
4945
5011
|
this.snapping = !0;
|
|
4946
5012
|
const o = () => {
|
|
4947
5013
|
const h = this.now(), a = Math.min(1, (h - s) / n);
|
|
@@ -5007,7 +5073,7 @@ class je extends rt {
|
|
|
5007
5073
|
return rt.prototype.display.call(this, t, e).then(() => this.fill());
|
|
5008
5074
|
}
|
|
5009
5075
|
fill(t) {
|
|
5010
|
-
const e = t || new
|
|
5076
|
+
const e = t || new w();
|
|
5011
5077
|
return this.q.enqueue(() => this.check()).then((i) => {
|
|
5012
5078
|
i ? this.fill(e) : e.resolve();
|
|
5013
5079
|
}), e.promise;
|
|
@@ -5062,7 +5128,7 @@ class je extends rt {
|
|
|
5062
5128
|
update(t) {
|
|
5063
5129
|
const e = this.bounds(), i = this.views.all(), s = i.length, n = typeof t < "u" ? t : this.settings.offset || 0;
|
|
5064
5130
|
let r, o;
|
|
5065
|
-
const h = new
|
|
5131
|
+
const h = new w(), a = [];
|
|
5066
5132
|
for (let c = 0; c < s; c++)
|
|
5067
5133
|
if (o = i[c], r = this.isVisible(o, n, n, e), r === !0)
|
|
5068
5134
|
if (o.displayed)
|
|
@@ -5084,7 +5150,7 @@ class je extends rt {
|
|
|
5084
5150
|
}) : (h.resolve(), h.promise);
|
|
5085
5151
|
}
|
|
5086
5152
|
check(t, e) {
|
|
5087
|
-
const i = new
|
|
5153
|
+
const i = new w(), s = [], n = this.settings.axis === "horizontal";
|
|
5088
5154
|
let r = this.settings.offset || 0;
|
|
5089
5155
|
t && n && (r = t), e && !n && (r = e);
|
|
5090
5156
|
const o = this._bounds;
|
|
@@ -5099,15 +5165,15 @@ class je extends rt {
|
|
|
5099
5165
|
var T, I;
|
|
5100
5166
|
const S = this.views.last(), _ = S && ((I = (T = S.section).next) == null ? void 0 : I.call(T));
|
|
5101
5167
|
_ && s.push(this.append(_));
|
|
5102
|
-
},
|
|
5103
|
-
|
|
5168
|
+
}, v = h + a + r, x = h - r;
|
|
5169
|
+
v >= c && m(), x < 0 && g();
|
|
5104
5170
|
const k = s.map((S) => S.display(this.request));
|
|
5105
5171
|
return s.length ? Promise.all(k).then(() => this.check()).then(() => this.update(r), (S) => S) : (this.q.enqueue(() => {
|
|
5106
5172
|
this.update();
|
|
5107
5173
|
}), i.resolve(!1), i.promise);
|
|
5108
5174
|
}
|
|
5109
5175
|
trim() {
|
|
5110
|
-
const t = new
|
|
5176
|
+
const t = new w(), e = this.views.displayed();
|
|
5111
5177
|
if (!e.length)
|
|
5112
5178
|
return t.resolve(), t.promise;
|
|
5113
5179
|
const i = e[0], s = e[e.length - 1], n = this.views.indexOf(i), r = this.views.indexOf(s), o = this.views.slice(0, n), h = this.views.slice(r + 1);
|
|
@@ -5171,7 +5237,7 @@ class je extends rt {
|
|
|
5171
5237
|
clearTimeout(this.scrollTimeout), clearTimeout(this.trimTimeout), super.destroy(), this.snapper && this.snapper.destroy();
|
|
5172
5238
|
}
|
|
5173
5239
|
}
|
|
5174
|
-
class
|
|
5240
|
+
class kt {
|
|
5175
5241
|
constructor(t, e) {
|
|
5176
5242
|
this.settings = C({}, {
|
|
5177
5243
|
width: null,
|
|
@@ -5190,7 +5256,7 @@ class Tt {
|
|
|
5190
5256
|
defaultDirection: "ltr",
|
|
5191
5257
|
allowScriptedContent: !1,
|
|
5192
5258
|
allowPopups: !1
|
|
5193
|
-
}), C(this.settings, e), typeof this.settings.manager == "object" && (this.manager = this.settings.manager), this.book = t, this.hooks = {}, this.hooks.display = new A(this), this.hooks.serialize = new A(this), this.hooks.content = new A(this), this.hooks.unloaded = new A(this), this.hooks.layout = new A(this), this.hooks.render = new A(this), this.hooks.show = new A(this), this.hooks.content.register((i) => this.handleLinks(i)), this.hooks.content.register((i) => this.passEvents(i)), this.hooks.content.register((i) => this.adjustImages(i)), this.book.spine.hooks.content.register((i, s) => this.injectIdentifier(i, s)), this.settings.stylesheet && this.book.spine.hooks.content.register((i, s) => this.injectStylesheet(i, s)), this.settings.script && this.book.spine.hooks.content.register((i, s) => this.injectScript(i, s)), this.themes = new Se(this), this.annotations = new _e(this), this.epubcfi = new
|
|
5259
|
+
}), C(this.settings, e), typeof this.settings.manager == "object" && (this.manager = this.settings.manager), this.book = t, this.hooks = {}, this.hooks.display = new A(this), this.hooks.serialize = new A(this), this.hooks.content = new A(this), this.hooks.unloaded = new A(this), this.hooks.layout = new A(this), this.hooks.render = new A(this), this.hooks.show = new A(this), this.hooks.content.register((i) => this.handleLinks(i)), this.hooks.content.register((i) => this.passEvents(i)), this.hooks.content.register((i) => this.adjustImages(i)), this.book.spine.hooks.content.register((i, s) => this.injectIdentifier(i, s)), this.settings.stylesheet && this.book.spine.hooks.content.register((i, s) => this.injectStylesheet(i, s)), this.settings.script && this.book.spine.hooks.content.register((i, s) => this.injectScript(i, s)), this.themes = new Se(this), this.annotations = new _e(this), this.epubcfi = new y(), this.q = new Ct(this), this.location = void 0, this.q.enqueue(this.book.opened), this.starting = new w(), this.started = this.starting.promise, this.q.enqueue(this.start);
|
|
5194
5260
|
}
|
|
5195
5261
|
/**
|
|
5196
5262
|
* Set the manager function
|
|
@@ -5272,8 +5338,8 @@ class Tt {
|
|
|
5272
5338
|
if (!this.book)
|
|
5273
5339
|
return;
|
|
5274
5340
|
this.epubcfi.isCfiString(t);
|
|
5275
|
-
const e = new
|
|
5276
|
-
this.displaying = e, this.book.locations.length() &&
|
|
5341
|
+
const e = new w(), i = e.promise;
|
|
5342
|
+
this.displaying = e, this.book.locations.length() && Dt(t) && (t = this.book.locations.cfiFromPercentage(parseFloat(t)));
|
|
5277
5343
|
const s = this.book.spine.get(t);
|
|
5278
5344
|
return s ? (this.manager.display(s, t).then(() => {
|
|
5279
5345
|
e.resolve(s), this.displaying = void 0, this.emit(f.RENDITION.DISPLAYED, s), this.reportLocation();
|
|
@@ -5580,7 +5646,7 @@ class Tt {
|
|
|
5580
5646
|
* @return {range}
|
|
5581
5647
|
*/
|
|
5582
5648
|
getRange(t, e) {
|
|
5583
|
-
const i = new
|
|
5649
|
+
const i = new y(t), s = this.manager.visible().filter(function(n) {
|
|
5584
5650
|
return i.spinePos === n.index;
|
|
5585
5651
|
});
|
|
5586
5652
|
if (s.length)
|
|
@@ -5677,7 +5743,7 @@ class Tt {
|
|
|
5677
5743
|
s.setAttribute("name", "dc.relation.ispartof"), i && s.setAttribute("content", i), t.getElementsByTagName("head")[0].appendChild(s);
|
|
5678
5744
|
}
|
|
5679
5745
|
}
|
|
5680
|
-
P(
|
|
5746
|
+
P(kt.prototype);
|
|
5681
5747
|
class Fe {
|
|
5682
5748
|
constructor() {
|
|
5683
5749
|
this.zip = void 0, this.urlCache = {}, this.checkRequirements();
|
|
@@ -5719,7 +5785,7 @@ class Fe {
|
|
|
5719
5785
|
* @return {Promise<Blob | string | JSON | Document | XMLDocument>}
|
|
5720
5786
|
*/
|
|
5721
5787
|
request(t, e) {
|
|
5722
|
-
const i = new
|
|
5788
|
+
const i = new w();
|
|
5723
5789
|
let s;
|
|
5724
5790
|
const n = new z(t);
|
|
5725
5791
|
return e || (e = n.extension), e == "blob" ? s = this.getBlob(t) : s = this.getText(t), s ? s.then((r) => {
|
|
@@ -5787,7 +5853,7 @@ class Fe {
|
|
|
5787
5853
|
* @return {Promise} url promise with Url string
|
|
5788
5854
|
*/
|
|
5789
5855
|
createUrl(t, e) {
|
|
5790
|
-
const i = new
|
|
5856
|
+
const i = new w(), s = typeof window < "u" ? window.URL || window.webkitURL || window.mozURL : URL;
|
|
5791
5857
|
let n, r;
|
|
5792
5858
|
const o = e && e.base64;
|
|
5793
5859
|
return t in this.urlCache ? (i.resolve(this.urlCache[t]), i.promise) : (o ? (r = this.getBase64(t), r && r.then((h) => {
|
|
@@ -5926,7 +5992,7 @@ class Jt {
|
|
|
5926
5992
|
let i;
|
|
5927
5993
|
const s = new z(t);
|
|
5928
5994
|
return e || (e = s.extension), e == "blob" ? i = this.getBlob(t) : i = this.getText(t), i.then((n) => {
|
|
5929
|
-
const r = new
|
|
5995
|
+
const r = new w();
|
|
5930
5996
|
let o;
|
|
5931
5997
|
return n ? (o = this.handleResponse(n, e), r.resolve(o)) : r.reject({
|
|
5932
5998
|
message: "File not found in storage: " + t,
|
|
@@ -5967,7 +6033,7 @@ class Jt {
|
|
|
5967
6033
|
getText(t, e) {
|
|
5968
6034
|
const i = encodeURIComponent(t);
|
|
5969
6035
|
return e = e || V.lookup(t), this.storage.getItem(i).then(function(s) {
|
|
5970
|
-
const n = new
|
|
6036
|
+
const n = new w(), r = new FileReader();
|
|
5971
6037
|
if (!s) return;
|
|
5972
6038
|
const o = new Blob([s], { type: e });
|
|
5973
6039
|
return r.addEventListener("loadend", () => {
|
|
@@ -5984,7 +6050,7 @@ class Jt {
|
|
|
5984
6050
|
getBase64(t, e) {
|
|
5985
6051
|
const i = encodeURIComponent(t);
|
|
5986
6052
|
return e = e || V.lookup(t), this.storage.getItem(i).then((s) => {
|
|
5987
|
-
const n = new
|
|
6053
|
+
const n = new w(), r = new FileReader();
|
|
5988
6054
|
if (!s) return;
|
|
5989
6055
|
const o = new Blob([s], { type: e });
|
|
5990
6056
|
return r.addEventListener("loadend", () => {
|
|
@@ -5999,7 +6065,7 @@ class Jt {
|
|
|
5999
6065
|
* @return {Promise} url promise with Url string
|
|
6000
6066
|
*/
|
|
6001
6067
|
createUrl(t, e) {
|
|
6002
|
-
const i = new
|
|
6068
|
+
const i = new w();
|
|
6003
6069
|
let s, n;
|
|
6004
6070
|
const r = e && e.base64;
|
|
6005
6071
|
return t in this.urlCache ? (i.resolve(this.urlCache[t]), i.promise) : (r ? (n = this.getBase64(t), n && n.then((o) => {
|
|
@@ -6020,8 +6086,10 @@ class Jt {
|
|
|
6020
6086
|
e && ft.revokeObjectURL(e);
|
|
6021
6087
|
}
|
|
6022
6088
|
destroy() {
|
|
6023
|
-
for (const t in this.urlCache)
|
|
6024
|
-
|
|
6089
|
+
for (const t in this.urlCache) {
|
|
6090
|
+
const e = this.urlCache[t];
|
|
6091
|
+
e && ft.revokeObjectURL(e);
|
|
6092
|
+
}
|
|
6025
6093
|
this.urlCache = {}, this.removeListeners();
|
|
6026
6094
|
}
|
|
6027
6095
|
}
|
|
@@ -6061,7 +6129,7 @@ class pt {
|
|
|
6061
6129
|
this.interactive = void 0, this.fixedLayout = void 0, this.openToSpread = void 0, this.orientationLock = void 0;
|
|
6062
6130
|
}
|
|
6063
6131
|
}
|
|
6064
|
-
const
|
|
6132
|
+
const Ot = "META-INF/container.xml", Xe = "META-INF/com.apple.ibooks.display-options.xml", N = {
|
|
6065
6133
|
BINARY: "binary",
|
|
6066
6134
|
BASE64: "base64",
|
|
6067
6135
|
EPUB: "epub",
|
|
@@ -6069,7 +6137,7 @@ const It = "META-INF/container.xml", Xe = "META-INF/com.apple.ibooks.display-opt
|
|
|
6069
6137
|
MANIFEST: "json",
|
|
6070
6138
|
DIRECTORY: "directory"
|
|
6071
6139
|
};
|
|
6072
|
-
class
|
|
6140
|
+
class Lt {
|
|
6073
6141
|
constructor(t, e) {
|
|
6074
6142
|
typeof e > "u" && typeof t != "string" && !(t instanceof Blob) && !(t instanceof ArrayBuffer) && (e = t, t = void 0), this.settings = C({}, {
|
|
6075
6143
|
requestMethod: void 0,
|
|
@@ -6080,15 +6148,15 @@ class kt {
|
|
|
6080
6148
|
canonical: void 0,
|
|
6081
6149
|
openAs: void 0,
|
|
6082
6150
|
store: void 0
|
|
6083
|
-
}), C(this.settings, e), this.opening = new
|
|
6084
|
-
manifest: new
|
|
6085
|
-
spine: new
|
|
6086
|
-
metadata: new
|
|
6087
|
-
cover: new
|
|
6088
|
-
navigation: new
|
|
6089
|
-
pageList: new
|
|
6090
|
-
resources: new
|
|
6091
|
-
displayOptions: new
|
|
6151
|
+
}), C(this.settings, e), this.opening = new w(), this.opened = this.opening.promise, this.isOpen = !1, this.loading = {
|
|
6152
|
+
manifest: new w(),
|
|
6153
|
+
spine: new w(),
|
|
6154
|
+
metadata: new w(),
|
|
6155
|
+
cover: new w(),
|
|
6156
|
+
navigation: new w(),
|
|
6157
|
+
pageList: new w(),
|
|
6158
|
+
resources: new w(),
|
|
6159
|
+
displayOptions: new w()
|
|
6092
6160
|
}, this.loaded = {
|
|
6093
6161
|
manifest: this.loading.manifest.promise,
|
|
6094
6162
|
spine: this.loading.spine.promise,
|
|
@@ -6121,7 +6189,7 @@ class kt {
|
|
|
6121
6189
|
open(t, e) {
|
|
6122
6190
|
let i;
|
|
6123
6191
|
const s = e || this.determineType(t);
|
|
6124
|
-
return s === N.BINARY ? (this.archived = !0, this.url = new R("/", ""), i = this.openEpub(t)) : s === N.BASE64 ? (this.archived = !0, this.url = new R("/", ""), i = this.openEpub(t, s)) : s === N.EPUB ? (this.archived = !0, this.url = new R("/", ""), i = this.request(t, "binary", this.settings.requestCredentials, this.settings.requestHeaders).then((n) => this.openEpub(n))) : s == N.OPF ? (this.url = new R(t), i = this.openPackaging(this.url.Path.toString())) : s == N.MANIFEST ? (this.url = new R(t), i = this.openManifest(this.url.Path.toString())) : (this.url = new R(t), i = this.openContainer(
|
|
6192
|
+
return s === N.BINARY ? (this.archived = !0, this.url = new R("/", ""), i = this.openEpub(t)) : s === N.BASE64 ? (this.archived = !0, this.url = new R("/", ""), i = this.openEpub(t, s)) : s === N.EPUB ? (this.archived = !0, this.url = new R("/", ""), i = this.request(t, "binary", this.settings.requestCredentials, this.settings.requestHeaders).then((n) => this.openEpub(n))) : s == N.OPF ? (this.url = new R(t), i = this.openPackaging(this.url.Path.toString())) : s == N.MANIFEST ? (this.url = new R(t), i = this.openManifest(this.url.Path.toString())) : (this.url = new R(t), i = this.openContainer(Ot).then((n) => this.openPackaging(n))), i;
|
|
6125
6193
|
}
|
|
6126
6194
|
/**
|
|
6127
6195
|
* Open an archived epub
|
|
@@ -6131,7 +6199,7 @@ class kt {
|
|
|
6131
6199
|
* @return {Promise}
|
|
6132
6200
|
*/
|
|
6133
6201
|
openEpub(t, e) {
|
|
6134
|
-
return this.unarchive(t, e || this.settings.encoding).then(() => this.openContainer(
|
|
6202
|
+
return this.unarchive(t, e || this.settings.encoding).then(() => this.openContainer(Ot)).then((i) => this.openPackaging(i));
|
|
6135
6203
|
}
|
|
6136
6204
|
/**
|
|
6137
6205
|
* Open the epub container
|
|
@@ -6149,7 +6217,7 @@ class kt {
|
|
|
6149
6217
|
* @return {Promise}
|
|
6150
6218
|
*/
|
|
6151
6219
|
openPackaging(t) {
|
|
6152
|
-
return this.path = new z(t), this.load(t).then((e) => (this.packaging = new
|
|
6220
|
+
return this.path = new z(t), this.load(t).then((e) => (this.packaging = new Rt(e), this.unpack(this.packaging)));
|
|
6153
6221
|
}
|
|
6154
6222
|
/**
|
|
6155
6223
|
* Open the manifest JSON
|
|
@@ -6158,7 +6226,7 @@ class kt {
|
|
|
6158
6226
|
* @return {Promise}
|
|
6159
6227
|
*/
|
|
6160
6228
|
openManifest(t) {
|
|
6161
|
-
return this.path = new z(t), this.load(t).then((e) => (this.packaging = new
|
|
6229
|
+
return this.path = new z(t), this.load(t).then((e) => (this.packaging = new Rt(), this.packaging.load(e), this.unpack(this.packaging)));
|
|
6162
6230
|
}
|
|
6163
6231
|
/**
|
|
6164
6232
|
* Load a resource from the Book
|
|
@@ -6269,7 +6337,7 @@ class kt {
|
|
|
6269
6337
|
* @return {Rendition}
|
|
6270
6338
|
*/
|
|
6271
6339
|
renderTo(t, e) {
|
|
6272
|
-
return this.rendition = new
|
|
6340
|
+
return this.rendition = new kt(this, e), this.rendition.attachTo(t), this.rendition;
|
|
6273
6341
|
}
|
|
6274
6342
|
/**
|
|
6275
6343
|
* Set if request should use withCredentials
|
|
@@ -6340,7 +6408,7 @@ class kt {
|
|
|
6340
6408
|
* @return {Promise}
|
|
6341
6409
|
*/
|
|
6342
6410
|
getRange(t) {
|
|
6343
|
-
const e = new
|
|
6411
|
+
const e = new y(t), i = this.spine.get(e.spinePos), s = (n) => this.load(n);
|
|
6344
6412
|
return i ? i.load(s).then(function(n) {
|
|
6345
6413
|
return e.toRange(i.document);
|
|
6346
6414
|
}) : new Promise((n, r) => {
|
|
@@ -6363,31 +6431,31 @@ class kt {
|
|
|
6363
6431
|
this.opened = void 0, this.loading = void 0, this.loaded = void 0, this.ready = void 0, this.isOpen = !1, this.isRendered = !1, this.spine && this.spine.destroy(), this.locations && this.locations.destroy(), this.pageList && this.pageList.destroy(), this.archive && this.archive.destroy(), this.resources && this.resources.destroy(), this.container && this.container.destroy(), this.packaging && this.packaging.destroy(), this.rendition && this.rendition.destroy(), this.displayOptions && this.displayOptions.destroy(), this.storage && (this.storage.destroy(), this.storage = void 0), this.spine = void 0, this.locations = void 0, this.pageList = void 0, this.archive = void 0, this.resources = void 0, this.container = void 0, this.packaging = void 0, this.rendition = void 0, this.navigation = void 0, this.url = void 0, this.path = void 0, this.archived = !1;
|
|
6364
6432
|
}
|
|
6365
6433
|
}
|
|
6366
|
-
P(
|
|
6434
|
+
P(Lt.prototype);
|
|
6367
6435
|
function G(l, t) {
|
|
6368
|
-
return new
|
|
6436
|
+
return new Lt(l, t);
|
|
6369
6437
|
}
|
|
6370
6438
|
G.VERSION = ht;
|
|
6371
6439
|
typeof global < "u" && (globalThis.EPUBJS_VERSION = ht);
|
|
6372
|
-
G.Book =
|
|
6373
|
-
G.Rendition =
|
|
6374
|
-
G.Contents =
|
|
6375
|
-
G.CFI =
|
|
6440
|
+
G.Book = Lt;
|
|
6441
|
+
G.Rendition = kt;
|
|
6442
|
+
G.Contents = Tt;
|
|
6443
|
+
G.CFI = y;
|
|
6376
6444
|
G.utils = oe;
|
|
6377
6445
|
export {
|
|
6378
6446
|
_e as Annotations,
|
|
6379
6447
|
Fe as Archive,
|
|
6380
|
-
|
|
6381
|
-
|
|
6448
|
+
Lt as Book,
|
|
6449
|
+
Tt as Contents,
|
|
6382
6450
|
pt as DisplayOptions,
|
|
6383
|
-
|
|
6451
|
+
y as EpubCFI,
|
|
6384
6452
|
Gt as Layout,
|
|
6385
6453
|
Xt as Locations,
|
|
6386
6454
|
bt as Mapping,
|
|
6387
6455
|
ct as Navigation,
|
|
6388
|
-
|
|
6456
|
+
Rt as Packaging,
|
|
6389
6457
|
ut as PageList,
|
|
6390
|
-
|
|
6458
|
+
kt as Rendition,
|
|
6391
6459
|
Ee as Resources,
|
|
6392
6460
|
me as Section,
|
|
6393
6461
|
ve as Spine,
|