flipbookengine 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +119 -115
- package/README.md +429 -429
- package/dist/{engine-DD5qEHLm.js → engine-B7R3u8jR.js} +696 -692
- package/dist/engine-B7R3u8jR.js.map +1 -0
- package/dist/flipbook-engine.core.js +1 -1
- package/dist/flipbook-engine.iife.js +3 -3
- package/dist/flipbook-engine.iife.js.map +1 -1
- package/dist/flipbook-engine.js +1 -1
- package/dist/flipbook-engine.react.js +1 -1
- package/dist/flipbook-engine.vue.js +1 -1
- package/package.json +165 -165
- package/dist/engine-DD5qEHLm.js.map +0 -1
|
@@ -4,48 +4,48 @@ var ot = (t) => {
|
|
|
4
4
|
};
|
|
5
5
|
var Jt = (t, e, i) => e in t ? Kt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
6
6
|
var C = (t, e, i) => Jt(t, typeof e != "symbol" ? e + "" : e, i), Ne = (t, e, i) => e.has(t) || ot("Cannot " + i);
|
|
7
|
-
var j = (t, e, i) => (Ne(t, e, "read from private field"), i ? i.call(t) : e.get(t)), de = (t, e, i) => e.has(t) ? ot("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), ge = (t, e, i,
|
|
8
|
-
import { j as
|
|
7
|
+
var j = (t, e, i) => (Ne(t, e, "read from private field"), i ? i.call(t) : e.get(t)), de = (t, e, i) => e.has(t) ? ot("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, i), ge = (t, e, i, n) => (Ne(t, e, "write to private field"), n ? n.call(t, i) : e.set(t, i), i), se = (t, e, i) => (Ne(t, e, "access private method"), i);
|
|
8
|
+
import { j as U, g as d, y as A, F as ei } from "./index-BhTR2SK6.js";
|
|
9
9
|
import * as rt from "pdfjs-dist";
|
|
10
10
|
function ti(t, e) {
|
|
11
11
|
if (t.schemaVersion !== 1 || t.pageIndex !== e || typeof t.revision != "string" || !t.revision || typeof t.text != "string" || t.text.length > 1e5 || !Array.isArray(t.runs) || t.runs.length > 2e4)
|
|
12
12
|
throw new Error("Invalid text page");
|
|
13
13
|
let i = 0;
|
|
14
|
-
for (const
|
|
15
|
-
if (typeof
|
|
16
|
-
i =
|
|
14
|
+
for (const n of t.runs) {
|
|
15
|
+
if (typeof n.text != "string" || !n.text.length || !Number.isInteger(n.start) || n.start < i || t.text.slice(n.start, n.start + n.text.length) !== n.text || ![n.x, n.y, n.width, n.height].every(Number.isFinite) || n.x < 0 || n.y < 0 || n.width <= 0 || n.height <= 0 || n.x + n.width > 1.000001 || n.y + n.height > 1.000001 || n.direction !== void 0 && n.direction !== "ltr" && n.direction !== "rtl") throw new Error("Invalid text run");
|
|
16
|
+
i = n.start + n.text.length;
|
|
17
17
|
}
|
|
18
|
-
return { ...t, runs: t.runs.map((
|
|
18
|
+
return { ...t, runs: t.runs.map((n) => ({ ...n })) };
|
|
19
19
|
}
|
|
20
20
|
function ii(t, e, i) {
|
|
21
|
-
const
|
|
21
|
+
const n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), r = U(() => {
|
|
22
22
|
const c = t.currentPage.value, g = t.totalPages.value, v = new Set([c - 1, c, c + 1].filter((S) => S >= 0 && S < g));
|
|
23
|
-
for (const [S, m] of
|
|
23
|
+
for (const [S, m] of n) v.has(S) || (m.abort(), n.delete(S));
|
|
24
24
|
const y = new Map([...t.textPages.peek()].filter(([S]) => v.has(S)));
|
|
25
25
|
for (const S of [...a]) v.has(S) || a.delete(S);
|
|
26
26
|
t.textPages.value = y;
|
|
27
27
|
for (const S of v) {
|
|
28
|
-
if (
|
|
28
|
+
if (n.has(S) || a.has(S) || i.aborted) continue;
|
|
29
29
|
const m = new AbortController();
|
|
30
|
-
|
|
31
|
-
m.signal.aborted || i.aborted ||
|
|
30
|
+
n.set(S, m), Promise.resolve().then(() => e(S, m.signal)).then((w) => {
|
|
31
|
+
m.signal.aborted || i.aborted || n.get(S) !== m || (w && (t.textPages.value = new Map(t.textPages.peek()).set(S, ti(w, S))), a.add(S));
|
|
32
32
|
}).catch(() => {
|
|
33
33
|
m.signal.aborted || a.add(S);
|
|
34
34
|
}).finally(() => {
|
|
35
|
-
|
|
35
|
+
n.get(S) === m && n.delete(S);
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}), h = () => {
|
|
39
39
|
r();
|
|
40
|
-
for (const c of
|
|
41
|
-
|
|
40
|
+
for (const c of n.values()) c.abort();
|
|
41
|
+
n.clear();
|
|
42
42
|
};
|
|
43
43
|
return i.addEventListener("abort", h, { once: !0 }), () => {
|
|
44
44
|
i.removeEventListener("abort", h), h();
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
var Mt = /* @__PURE__ */ Symbol.for("Serenity.initPropHook");
|
|
48
|
-
function
|
|
48
|
+
function ni(t) {
|
|
49
49
|
return !!(t && typeof t.nodeType == "number");
|
|
50
50
|
}
|
|
51
51
|
function ye(t) {
|
|
@@ -57,7 +57,7 @@ function Et(t) {
|
|
|
57
57
|
function q(t) {
|
|
58
58
|
return typeof t == "object" && t !== null;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function si(t) {
|
|
61
61
|
return !!(t && t.isComponent);
|
|
62
62
|
}
|
|
63
63
|
function Ze(t) {
|
|
@@ -80,8 +80,8 @@ function Qe(t, e) {
|
|
|
80
80
|
}
|
|
81
81
|
function ri(t, e, i) {
|
|
82
82
|
e = { ...e, children: i };
|
|
83
|
-
const
|
|
84
|
-
return "ref" in e && Qe(e.ref,
|
|
83
|
+
const n = new t(e), a = n.render();
|
|
84
|
+
return "ref" in e && Qe(e.ref, n), a;
|
|
85
85
|
}
|
|
86
86
|
var li = "http://www.w3.org/1998/Math/MathML", hi = /* @__PURE__ */ new Set(["math", "annotation", "annotation-xml", "maction", "merror", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics", "menclose", "mfenced"]), ci = /* @__PURE__ */ new Set([
|
|
87
87
|
// "a",
|
|
@@ -168,7 +168,7 @@ function mi(t, e) {
|
|
|
168
168
|
if (!t)
|
|
169
169
|
return;
|
|
170
170
|
const i = Ke();
|
|
171
|
-
function
|
|
171
|
+
function n(a) {
|
|
172
172
|
const r = i.get(a);
|
|
173
173
|
if (r) {
|
|
174
174
|
i.delete(a), a.removeEventListener("disposing", Je);
|
|
@@ -179,15 +179,15 @@ function mi(t, e) {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
n(t);
|
|
183
183
|
}
|
|
184
184
|
function $e(t, e, i) {
|
|
185
185
|
if (!t || !e)
|
|
186
186
|
return t;
|
|
187
|
-
const
|
|
188
|
-
let a =
|
|
187
|
+
const n = Ke();
|
|
188
|
+
let a = n.get(t);
|
|
189
189
|
if (!a)
|
|
190
|
-
return typeof t.addEventListener != "function" || (
|
|
190
|
+
return typeof t.addEventListener != "function" || (n.set(t, a = [{
|
|
191
191
|
callback: e,
|
|
192
192
|
regKey: i
|
|
193
193
|
}]), t.addEventListener("disposing", Je, { once: !0 })), t;
|
|
@@ -197,13 +197,13 @@ function $e(t, e, i) {
|
|
|
197
197
|
function ct(t, e, i) {
|
|
198
198
|
if (!t || !e)
|
|
199
199
|
return t;
|
|
200
|
-
const
|
|
200
|
+
const n = Ke(), a = n.get(t);
|
|
201
201
|
if (a) {
|
|
202
202
|
for (let r = a.length - 1; r >= 0; r--) {
|
|
203
203
|
const h = a[r];
|
|
204
204
|
e && e === h.callback && a.splice(r, 1);
|
|
205
205
|
}
|
|
206
|
-
a.length === 0 && (
|
|
206
|
+
a.length === 0 && (n.delete(t), typeof t.removeEventListener == "function" && t.removeEventListener("disposing", Je));
|
|
207
207
|
}
|
|
208
208
|
return t;
|
|
209
209
|
}
|
|
@@ -231,10 +231,10 @@ var ce, _, X, qe, _e, Tt, bi = (Tt = class {
|
|
|
231
231
|
return j(this, ce);
|
|
232
232
|
}
|
|
233
233
|
set effectDisposer(t) {
|
|
234
|
-
|
|
234
|
+
se(this, X, qe).call(this), ge(this, ce, t), se(this, X, _e).call(this);
|
|
235
235
|
}
|
|
236
236
|
set lifecycleNode(t) {
|
|
237
|
-
t !== j(this, _) && (
|
|
237
|
+
t !== j(this, _) && (se(this, X, qe).call(this), ge(this, _, t), se(this, X, _e).call(this));
|
|
238
238
|
}
|
|
239
239
|
}, ce = new WeakMap(), _ = new WeakMap(), X = new WeakSet(), qe = function() {
|
|
240
240
|
var t;
|
|
@@ -244,7 +244,7 @@ var ce, _, X, qe, _e, Tt, bi = (Tt = class {
|
|
|
244
244
|
$e(j(this, _), this.effectDisposer), $e(j(this, _), (t = this.signal) == null ? void 0 : t.derivedDisposer);
|
|
245
245
|
}, Tt);
|
|
246
246
|
function le(t, e, i) {
|
|
247
|
-
const
|
|
247
|
+
const n = i != null && i.useLifecycleRoot ? vi() : void 0, a = new bi(t, n, i == null ? void 0 : i.lifecycleNode), r = a.signal.subscribe(function(h) {
|
|
248
248
|
a.newValue = h, a.isInitial && (this != null && this.dispose) && (a.effectDisposer = this.dispose.bind(this)), a.hasChanged = !a.isInitial && a.prevValue !== a.newValue;
|
|
249
249
|
try {
|
|
250
250
|
e(a);
|
|
@@ -257,9 +257,9 @@ function le(t, e, i) {
|
|
|
257
257
|
function ut(t, e) {
|
|
258
258
|
t instanceof window.HTMLTemplateElement ? t.content.appendChild(e) : t.appendChild(e);
|
|
259
259
|
}
|
|
260
|
-
var Fe = 0,
|
|
260
|
+
var Fe = 0, Ue = "__domwisefrag_";
|
|
261
261
|
function Dt(t) {
|
|
262
|
-
return t instanceof Comment && t.data.startsWith(
|
|
262
|
+
return t instanceof Comment && t.data.startsWith(Ue);
|
|
263
263
|
}
|
|
264
264
|
function dt(t) {
|
|
265
265
|
return t instanceof DocumentFragment && Dt(t.firstChild);
|
|
@@ -269,28 +269,28 @@ function wi(t, e) {
|
|
|
269
269
|
typeof t.replaceWith == "function" ? t.replaceWith(e) : (i = t.parentNode) == null || i.replaceChild(e, t);
|
|
270
270
|
}
|
|
271
271
|
function gt(t) {
|
|
272
|
-
return t instanceof DocumentFragment ? (++Fe, t.prepend(document.createComment(
|
|
272
|
+
return t instanceof DocumentFragment ? (++Fe, t.prepend(document.createComment(Ue + Fe)), t.append(document.createComment(Ue + Fe)), t) : t instanceof Node ? t : oe(t) ? document.createTextNode(t) : document.createComment("");
|
|
273
273
|
}
|
|
274
274
|
function yi(t, e) {
|
|
275
275
|
let i;
|
|
276
|
-
le(e, (
|
|
276
|
+
le(e, (n) => {
|
|
277
277
|
var h;
|
|
278
|
-
if (
|
|
279
|
-
i = gt(
|
|
278
|
+
if (n.isInitial) {
|
|
279
|
+
i = gt(n.newValue);
|
|
280
280
|
let c = dt(i) ? i.firstChild : i;
|
|
281
|
-
he(t, i),
|
|
281
|
+
he(t, i), n.lifecycleNode = (i = c) ?? t;
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
|
-
if (!
|
|
284
|
+
if (!n.hasChanged)
|
|
285
285
|
return;
|
|
286
|
-
const a = gt(
|
|
286
|
+
const a = gt(n.newValue);
|
|
287
287
|
if (Dt(i)) {
|
|
288
288
|
let c;
|
|
289
289
|
for (; (c = i.nextSibling) && ((h = c.parentNode) == null || h.removeChild(c), !(c instanceof Comment && c.data === i.data)); )
|
|
290
290
|
;
|
|
291
291
|
}
|
|
292
292
|
let r = dt(a) ? a.firstChild : a;
|
|
293
|
-
wi(i, a),
|
|
293
|
+
wi(i, a), n.lifecycleNode = (i = r) ?? t;
|
|
294
294
|
});
|
|
295
295
|
}
|
|
296
296
|
function he(t, e) {
|
|
@@ -300,7 +300,7 @@ function he(t, e) {
|
|
|
300
300
|
he(t, i);
|
|
301
301
|
else if (ye(e) || Et(e))
|
|
302
302
|
ut(t, document.createTextNode(e));
|
|
303
|
-
else if (
|
|
303
|
+
else if (ni(e))
|
|
304
304
|
ut(t, e);
|
|
305
305
|
else if (pi(e)) {
|
|
306
306
|
const i = t.attachShadow(e.attr);
|
|
@@ -317,17 +317,17 @@ function xi(t, e) {
|
|
|
317
317
|
return;
|
|
318
318
|
e = It(e);
|
|
319
319
|
const i = (re(e) ?? "").split(" ");
|
|
320
|
-
for (let
|
|
321
|
-
|
|
320
|
+
for (let n of i)
|
|
321
|
+
n && t.classList.remove(n);
|
|
322
322
|
}
|
|
323
323
|
function Pi(t, e, i) {
|
|
324
324
|
if (e == null || e === !1) {
|
|
325
325
|
xi(t, i);
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
|
-
i = It(i), Ze(e) ? e = Array.from(e).map((
|
|
329
|
-
let a =
|
|
330
|
-
return Q(
|
|
328
|
+
i = It(i), Ze(e) ? e = Array.from(e).map((n) => {
|
|
329
|
+
let a = n;
|
|
330
|
+
return Q(n) && le(n, (r) => {
|
|
331
331
|
if (r.isInitial) {
|
|
332
332
|
a = r.newValue;
|
|
333
333
|
return;
|
|
@@ -336,26 +336,26 @@ function Pi(t, e, i) {
|
|
|
336
336
|
}, {
|
|
337
337
|
lifecycleNode: t
|
|
338
338
|
}), a;
|
|
339
|
-
}) : q(e) && (e = { ...e }, Object.entries(e).forEach(([
|
|
339
|
+
}) : q(e) && (e = { ...e }, Object.entries(e).forEach(([n, a]) => {
|
|
340
340
|
Q(a) && le(a, (r) => {
|
|
341
341
|
if (r.isInitial) {
|
|
342
|
-
e[
|
|
342
|
+
e[n] = r.newValue;
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
345
|
-
Oe(t, !!r.newValue &&
|
|
345
|
+
Oe(t, !!r.newValue && n, !!r.prevValue && n);
|
|
346
346
|
}, {
|
|
347
347
|
lifecycleNode: t
|
|
348
348
|
});
|
|
349
349
|
})), Oe(t, e, i);
|
|
350
350
|
}
|
|
351
351
|
function Oe(t, e, i) {
|
|
352
|
-
const
|
|
352
|
+
const n = (re(e) ?? "").split(" ");
|
|
353
353
|
if (i) {
|
|
354
354
|
const a = (re(i) ?? "").split(" ");
|
|
355
355
|
for (let r of a)
|
|
356
|
-
r && !
|
|
356
|
+
r && !n.includes(r) && t.classList.remove(r);
|
|
357
357
|
}
|
|
358
|
-
for (let a of
|
|
358
|
+
for (let a of n)
|
|
359
359
|
a && t.classList.add(a);
|
|
360
360
|
}
|
|
361
361
|
function Si(t, e) {
|
|
@@ -409,12 +409,12 @@ var ki = /* @__PURE__ */ (() => {
|
|
|
409
409
|
};
|
|
410
410
|
const e = ["Webkit", "ms", "Moz", "O"];
|
|
411
411
|
return Object.keys(t).forEach((i) => {
|
|
412
|
-
e.forEach((
|
|
413
|
-
t[Si(
|
|
412
|
+
e.forEach((n) => {
|
|
413
|
+
t[Si(n, i)] = 0;
|
|
414
414
|
});
|
|
415
415
|
}), t;
|
|
416
416
|
})();
|
|
417
|
-
function
|
|
417
|
+
function Ge(t, e, i) {
|
|
418
418
|
e.indexOf("-") === 0 ? t.style.setProperty(e, i) : Et(i) && ki[e] !== 0 ? t.style[e] = i + "px" : t.style[e] = i;
|
|
419
419
|
}
|
|
420
420
|
function ft(t, e) {
|
|
@@ -424,7 +424,7 @@ function ft(t, e) {
|
|
|
424
424
|
return;
|
|
425
425
|
}
|
|
426
426
|
q(e) && Object.keys(e).forEach((i) => {
|
|
427
|
-
|
|
427
|
+
Ge(t, i, "");
|
|
428
428
|
});
|
|
429
429
|
}
|
|
430
430
|
}
|
|
@@ -438,12 +438,12 @@ function Ci(t, e, i) {
|
|
|
438
438
|
return;
|
|
439
439
|
}
|
|
440
440
|
if (q(e)) {
|
|
441
|
-
q(i) ? (e = { ...e }, Object.keys(i).forEach((
|
|
442
|
-
|
|
443
|
-
})) : ft(t, i), Object.entries(e).forEach(([
|
|
444
|
-
Q(a) ? le(a, (r) =>
|
|
441
|
+
q(i) ? (e = { ...e }, Object.keys(i).forEach((n) => {
|
|
442
|
+
n in e || (e[n] = "");
|
|
443
|
+
})) : ft(t, i), Object.entries(e).forEach(([n, a]) => {
|
|
444
|
+
Q(a) ? le(a, (r) => Ge(t, n, r.newValue), {
|
|
445
445
|
lifecycleNode: t
|
|
446
|
-
}) :
|
|
446
|
+
}) : Ge(t, n, a);
|
|
447
447
|
});
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
@@ -471,24 +471,24 @@ var Mi = /* @__PURE__ */ new Map([
|
|
|
471
471
|
["onDoubleClick", "onDblClick"],
|
|
472
472
|
["onDoubleClickCapture", "onDblClickCapture"]
|
|
473
473
|
]);
|
|
474
|
-
function pt(t, e, i,
|
|
474
|
+
function pt(t, e, i, n) {
|
|
475
475
|
switch (e) {
|
|
476
476
|
case "dataset":
|
|
477
|
-
|
|
477
|
+
n != null && Object.entries(n).forEach(([r, h]) => {
|
|
478
478
|
h != null && delete t.dataset[r];
|
|
479
479
|
}), Object.entries(i).forEach(([r, h]) => {
|
|
480
480
|
h != null && (t.dataset[r] = h);
|
|
481
481
|
});
|
|
482
482
|
return;
|
|
483
483
|
case "textContent":
|
|
484
|
-
oe(i) ? t[e] = i : oe(
|
|
484
|
+
oe(i) ? t[e] = i : oe(n) && (t[e] = "");
|
|
485
485
|
return;
|
|
486
486
|
case "dangerouslySetInnerHTML":
|
|
487
|
-
q(i) ? t.innerHTML = i.__html : q(
|
|
487
|
+
q(i) ? t.innerHTML = i.__html : q(n) && (t.innerHTML = "");
|
|
488
488
|
return;
|
|
489
489
|
case "value":
|
|
490
490
|
if (i == null) {
|
|
491
|
-
|
|
491
|
+
n != null && (t[e] = null);
|
|
492
492
|
return;
|
|
493
493
|
} else {
|
|
494
494
|
if (t instanceof window.HTMLSelectElement)
|
|
@@ -500,7 +500,7 @@ function pt(t, e, i, s) {
|
|
|
500
500
|
}
|
|
501
501
|
break;
|
|
502
502
|
case "class":
|
|
503
|
-
Pi(t, i,
|
|
503
|
+
Pi(t, i, n);
|
|
504
504
|
return;
|
|
505
505
|
case "spellcheck":
|
|
506
506
|
t.spellcheck = i === "" || i === !0 || i === "true" ? !0 : i === !1 || i === "false" ? !1 : i;
|
|
@@ -515,15 +515,15 @@ function pt(t, e, i, s) {
|
|
|
515
515
|
case "namespaceURI":
|
|
516
516
|
return;
|
|
517
517
|
case "style":
|
|
518
|
-
Ci(t, i,
|
|
518
|
+
Ci(t, i, n);
|
|
519
519
|
return;
|
|
520
520
|
case "on":
|
|
521
521
|
case "onCapture":
|
|
522
522
|
const a = e === "onCapture";
|
|
523
|
-
|
|
523
|
+
n != null && Object.entries(n).forEach(([r, h]) => {
|
|
524
524
|
(i == null || i[r] !== h) && t.removeEventListener(r, h, a);
|
|
525
525
|
}), Object.entries(i).forEach(([r, h]) => {
|
|
526
|
-
(
|
|
526
|
+
(n == null || n[r] !== h) && t.addEventListener(r, h, a);
|
|
527
527
|
});
|
|
528
528
|
return;
|
|
529
529
|
case "xlinkActuate":
|
|
@@ -546,28 +546,28 @@ function pt(t, e, i, s) {
|
|
|
546
546
|
}
|
|
547
547
|
if (typeof i == "function") {
|
|
548
548
|
if (e[0] === "o" && e[1] === "n") {
|
|
549
|
-
if (
|
|
549
|
+
if (n != null && n === i)
|
|
550
550
|
return;
|
|
551
551
|
let a = e.toLowerCase();
|
|
552
552
|
const r = a.endsWith("capture");
|
|
553
553
|
let h;
|
|
554
|
-
!r && (t[a] === null ||
|
|
554
|
+
!r && (t[a] === null || n != null && t[a] === n) ? (t[a] = i, $e(t, Di.bind(t, a))) : r ? (h = a.substring(2, a.length - 7), n != null && t.removeEventListener(h, n, !0), t.addEventListener(h, i, !0)) : (a in window ? h = a.substring(2) : h = a[2] + e.slice(3), n != null && t.removeEventListener(h, n), t.addEventListener(h, i));
|
|
555
555
|
} else
|
|
556
556
|
console.warn(`A function was provided for JSX ${t.tagName} element ${e} which does not start with "on":`, i, t.tagName);
|
|
557
557
|
return;
|
|
558
558
|
}
|
|
559
|
-
if (q(
|
|
560
|
-
if (
|
|
559
|
+
if (q(n)) {
|
|
560
|
+
if (n === i)
|
|
561
561
|
return;
|
|
562
562
|
delete t[e];
|
|
563
563
|
}
|
|
564
|
-
if (
|
|
565
|
-
if (
|
|
564
|
+
if (n === !0) {
|
|
565
|
+
if (n === i)
|
|
566
566
|
return;
|
|
567
567
|
t.removeAttribute(e);
|
|
568
568
|
}
|
|
569
|
-
if (
|
|
570
|
-
if (
|
|
569
|
+
if (n !== !1 && n != null) {
|
|
570
|
+
if (n === i)
|
|
571
571
|
return;
|
|
572
572
|
t instanceof SVGElement && !lt.test(e) ? t.removeAttributeNS(fe(e, "-"), i) : t.removeAttribute(e);
|
|
573
573
|
}
|
|
@@ -582,29 +582,29 @@ function pt(t, e, i, s) {
|
|
|
582
582
|
i !== !1 && i != null && (t instanceof SVGElement && !lt.test(e) ? t.setAttribute(fe(e, "-"), i) : t.setAttribute(e, i));
|
|
583
583
|
}
|
|
584
584
|
function Ei(t, e) {
|
|
585
|
-
for (let [i,
|
|
586
|
-
i = Mi.get(i) ?? i, Q(
|
|
585
|
+
for (let [i, n] of Object.entries(e))
|
|
586
|
+
i = Mi.get(i) ?? i, Q(n) ? le(n, (a) => pt(t, i, a.newValue, a.prevValue), {
|
|
587
587
|
lifecycleNode: t
|
|
588
|
-
}) : ai(
|
|
588
|
+
}) : ai(n) ? n[Mt](t, i) : pt(t, i, n);
|
|
589
589
|
return t;
|
|
590
590
|
}
|
|
591
591
|
function Di(t) {
|
|
592
592
|
this[t] = null;
|
|
593
593
|
}
|
|
594
594
|
function l(t, e) {
|
|
595
|
-
let { children: i, ...
|
|
595
|
+
let { children: i, ...n } = e || {}, a = n.namespaceURI;
|
|
596
596
|
a || (ci.has(t) ? a = ui : hi.has(t) ? a = li : a = di());
|
|
597
597
|
let r;
|
|
598
598
|
if (ye(t)) {
|
|
599
|
-
if (r = a ? document.createElementNS(a, t) : document.createElement(t), Ei(r,
|
|
600
|
-
if (
|
|
601
|
-
const h =
|
|
599
|
+
if (r = a ? document.createElementNS(a, t) : document.createElement(t), Ei(r, n), he(r, i), r instanceof window.HTMLSelectElement && n.value != null)
|
|
600
|
+
if (n.multiple === !0 && Array.isArray(n.value)) {
|
|
601
|
+
const h = n.value.map((c) => String(c));
|
|
602
602
|
r.querySelectorAll("option").forEach((c) => c.selected = h.includes(c.value));
|
|
603
603
|
} else
|
|
604
|
-
r.value =
|
|
605
|
-
Qe(
|
|
604
|
+
r.value = n.value;
|
|
605
|
+
Qe(n.ref, r);
|
|
606
606
|
} else if (typeof t == "function")
|
|
607
|
-
q(t.defaultProps) && (
|
|
607
|
+
q(t.defaultProps) && (n = { ...t.defaultProps, ...n }), r = si(t) ? ri(t, n, i) : t({ ...n, children: i });
|
|
608
608
|
else
|
|
609
609
|
throw new TypeError(`Invalid JSX element type: ${t}`);
|
|
610
610
|
return r;
|
|
@@ -626,13 +626,13 @@ function et() {
|
|
|
626
626
|
}(); ae !== void 0; ) {
|
|
627
627
|
var i = ae;
|
|
628
628
|
for (ae = void 0, me++; i !== void 0; ) {
|
|
629
|
-
var
|
|
629
|
+
var n = i.u;
|
|
630
630
|
if (i.u = void 0, i.f &= -3, !(8 & i.f) && Lt(i)) try {
|
|
631
631
|
i.c();
|
|
632
632
|
} catch (a) {
|
|
633
633
|
e || (t = a, e = !0);
|
|
634
634
|
}
|
|
635
|
-
i =
|
|
635
|
+
i = n;
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
638
|
if (me = 0, Z--, e) throw t;
|
|
@@ -668,15 +668,15 @@ H.prototype.h = function() {
|
|
|
668
668
|
H.prototype.S = function(t) {
|
|
669
669
|
var e = this, i = this.t;
|
|
670
670
|
i !== t && t.e === void 0 && (t.x = i, this.t = t, i !== void 0 ? i.e = t : Rt(function() {
|
|
671
|
-
var
|
|
672
|
-
(
|
|
671
|
+
var n;
|
|
672
|
+
(n = e.W) == null || n.call(e);
|
|
673
673
|
}));
|
|
674
674
|
};
|
|
675
675
|
H.prototype.U = function(t) {
|
|
676
676
|
var e = this;
|
|
677
677
|
if (this.t !== void 0) {
|
|
678
|
-
var i = t.e,
|
|
679
|
-
i !== void 0 && (i.x =
|
|
678
|
+
var i = t.e, n = t.x;
|
|
679
|
+
i !== void 0 && (i.x = n, t.e = void 0), n !== void 0 && (n.e = i, t.x = void 0), t === this.t && (this.t = n, n === void 0 && Rt(function() {
|
|
680
680
|
var a;
|
|
681
681
|
(a = e.Z) == null || a.call(e);
|
|
682
682
|
}));
|
|
@@ -685,12 +685,12 @@ H.prototype.U = function(t) {
|
|
|
685
685
|
H.prototype.subscribe = function(t) {
|
|
686
686
|
var e = this;
|
|
687
687
|
return Ni(function() {
|
|
688
|
-
var i = e.value,
|
|
688
|
+
var i = e.value, n = N;
|
|
689
689
|
N = void 0;
|
|
690
690
|
try {
|
|
691
691
|
t(i);
|
|
692
692
|
} finally {
|
|
693
|
-
N =
|
|
693
|
+
N = n;
|
|
694
694
|
}
|
|
695
695
|
}, { name: "sub" });
|
|
696
696
|
};
|
|
@@ -743,8 +743,8 @@ function zt(t) {
|
|
|
743
743
|
}
|
|
744
744
|
function Ft(t) {
|
|
745
745
|
for (var e = t.s, i = void 0; e !== void 0; ) {
|
|
746
|
-
var
|
|
747
|
-
e.i === -1 ? (e.S.U(e),
|
|
746
|
+
var n = e.p;
|
|
747
|
+
e.i === -1 ? (e.S.U(e), n !== void 0 && (n.n = e.n), e.n !== void 0 && (e.n.p = n)) : i = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = n;
|
|
748
748
|
}
|
|
749
749
|
t.s = i;
|
|
750
750
|
}
|
|
@@ -800,8 +800,8 @@ function Ot(t) {
|
|
|
800
800
|
N = void 0;
|
|
801
801
|
try {
|
|
802
802
|
e();
|
|
803
|
-
} catch (
|
|
804
|
-
throw t.f &= -2, t.f |= 8, tt(t),
|
|
803
|
+
} catch (n) {
|
|
804
|
+
throw t.f &= -2, t.f |= 8, tt(t), n;
|
|
805
805
|
} finally {
|
|
806
806
|
N = i, et();
|
|
807
807
|
}
|
|
@@ -850,8 +850,8 @@ function Ni(t, e) {
|
|
|
850
850
|
} catch (a) {
|
|
851
851
|
throw i.d(), a;
|
|
852
852
|
}
|
|
853
|
-
var
|
|
854
|
-
return
|
|
853
|
+
var n = i.d.bind(i);
|
|
854
|
+
return n[Symbol.dispose] = n, n;
|
|
855
855
|
}
|
|
856
856
|
const Li = {
|
|
857
857
|
emptyStateTitle: "No data available.",
|
|
@@ -965,22 +965,22 @@ const Li = {
|
|
|
965
965
|
en: Li,
|
|
966
966
|
tr: zi
|
|
967
967
|
};
|
|
968
|
-
function
|
|
968
|
+
function G(t = {}) {
|
|
969
969
|
var a;
|
|
970
|
-
const e = t.locale ?? "en", i = Be[e] ?? Be.en,
|
|
970
|
+
const e = t.locale ?? "en", i = Be[e] ?? Be.en, n = ((a = t.messages) == null ? void 0 : a[e]) ?? {};
|
|
971
971
|
return {
|
|
972
972
|
...Be.en,
|
|
973
973
|
...i,
|
|
974
|
-
...
|
|
974
|
+
...n
|
|
975
975
|
};
|
|
976
976
|
}
|
|
977
977
|
function Bt(t, e) {
|
|
978
978
|
var g;
|
|
979
979
|
(g = t.querySelector(".bk-shortcuts-dialog")) == null || g.remove();
|
|
980
|
-
const i =
|
|
981
|
-
|
|
980
|
+
const i = G({ locale: e.locale.value, messages: e.messages.value }), n = document.createElement("dialog");
|
|
981
|
+
n.className = "bk-shortcuts-dialog", n.setAttribute("aria-label", i.keyboardShortcuts);
|
|
982
982
|
const a = document.createElement("strong");
|
|
983
|
-
a.textContent = i.keyboardShortcuts,
|
|
983
|
+
a.textContent = i.keyboardShortcuts, n.append(a);
|
|
984
984
|
const r = document.createElement("dl");
|
|
985
985
|
for (const [v, y] of [["← / →", `${i.previous} / ${i.next}`], ["Home / End", i.pages], ["+ / −", `${i.zoomIn} / ${i.zoomOut}`], ["0", i.resetZoom], ["N", i.addNote], ["Shift + N", i.myNotes], ["/", i.search], ["I", i.tableOfContents], ["T", i.thumbnails], ["F", i.fullscreen], ["Esc", i.closeHotspot], ["Tab / Shift + Tab", i.moreActions]]) {
|
|
986
986
|
const S = document.createElement("dt");
|
|
@@ -989,14 +989,14 @@ function Bt(t, e) {
|
|
|
989
989
|
m.textContent = y, r.append(S, m);
|
|
990
990
|
}
|
|
991
991
|
const h = document.createElement("button");
|
|
992
|
-
h.type = "button", h.textContent = i.closeHotspot, h.addEventListener("click", () =>
|
|
992
|
+
h.type = "button", h.textContent = i.closeHotspot, h.addEventListener("click", () => n.close()), n.append(r, h), t.append(n);
|
|
993
993
|
const c = t.ownerDocument.activeElement;
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
}, { once: !0 }),
|
|
994
|
+
n.addEventListener("close", () => {
|
|
995
|
+
n.remove(), c != null && c.isConnected && c.focus();
|
|
996
|
+
}, { once: !0 }), n.showModal();
|
|
997
997
|
}
|
|
998
998
|
function Fi(t, e, i) {
|
|
999
|
-
const
|
|
999
|
+
const n = /* @__PURE__ */ l("div", { class: "bk-more-menu" }), a = [
|
|
1000
1000
|
[".bk-btn--autoplay", "play"],
|
|
1001
1001
|
[".bk-btn--single", "singlePageMode"],
|
|
1002
1002
|
[".bk-btn--share", "share"],
|
|
@@ -1006,9 +1006,9 @@ function Fi(t, e, i) {
|
|
|
1006
1006
|
];
|
|
1007
1007
|
for (const [h, c] of a) {
|
|
1008
1008
|
const g = t.querySelector(h);
|
|
1009
|
-
g && (g.append(/* @__PURE__ */ l("span", { children: d(() => e.value[c]) })),
|
|
1009
|
+
g && (g.append(/* @__PURE__ */ l("span", { children: d(() => e.value[c]) })), n.append(g));
|
|
1010
1010
|
}
|
|
1011
|
-
|
|
1011
|
+
n.append(/* @__PURE__ */ l(
|
|
1012
1012
|
"button",
|
|
1013
1013
|
{
|
|
1014
1014
|
type: "button",
|
|
@@ -1020,28 +1020,28 @@ function Fi(t, e, i) {
|
|
|
1020
1020
|
},
|
|
1021
1021
|
children: d(() => e.value.textSelection)
|
|
1022
1022
|
}
|
|
1023
|
-
)),
|
|
1023
|
+
)), n.append(/* @__PURE__ */ l("button", { type: "button", class: "bk-btn", onClick: () => Bt(t.closest(".bk-wrapper"), i), children: d(() => e.value.keyboardShortcuts) }));
|
|
1024
1024
|
let r;
|
|
1025
1025
|
r = /* @__PURE__ */ l("details", { class: "bk-more", onKeyDown: (h) => {
|
|
1026
1026
|
var c;
|
|
1027
1027
|
h.key === "Escape" && (r.open = !1, (c = r.querySelector("summary")) == null || c.focus());
|
|
1028
1028
|
}, children: [
|
|
1029
1029
|
/* @__PURE__ */ l("summary", { class: "bk-btn", "aria-label": d(() => e.value.moreActions), title: d(() => e.value.moreActions), children: "…" }),
|
|
1030
|
-
|
|
1031
|
-
] }),
|
|
1030
|
+
n
|
|
1031
|
+
] }), n.addEventListener("click", (h) => {
|
|
1032
1032
|
h.target.closest("button") && (r.open = !1);
|
|
1033
1033
|
}), t.lastElementChild.append(r);
|
|
1034
1034
|
}
|
|
1035
1035
|
function vt(t) {
|
|
1036
1036
|
return t.registry ? (t.registry.version.value, t.registry.getToolbarButtons().filter((i) => (i.placement || "end") === t.placement).map((i) => {
|
|
1037
|
-
const
|
|
1037
|
+
const n = typeof i.disabled == "function" ? i.disabled() : i.disabled;
|
|
1038
1038
|
return /* @__PURE__ */ l(
|
|
1039
1039
|
"button",
|
|
1040
1040
|
{
|
|
1041
1041
|
type: "button",
|
|
1042
1042
|
class: "bk-btn bk-btn--plugin",
|
|
1043
1043
|
onClick: i.onClick,
|
|
1044
|
-
disabled:
|
|
1044
|
+
disabled: n,
|
|
1045
1045
|
"aria-label": i.title || i.label,
|
|
1046
1046
|
title: i.title || i.label,
|
|
1047
1047
|
children: [
|
|
@@ -1053,7 +1053,7 @@ function vt(t) {
|
|
|
1053
1053
|
})) : [];
|
|
1054
1054
|
}
|
|
1055
1055
|
function Oi(t) {
|
|
1056
|
-
const e = d(() =>
|
|
1056
|
+
const e = d(() => G({ locale: t.store.locale.value, messages: t.store.messages.value })), i = /* @__PURE__ */ l("div", { class: "bk-toolbar", role: "toolbar", "aria-label": "Flipbook controls", children: [
|
|
1057
1057
|
/* @__PURE__ */ l("div", { class: "bk-btn-group", children: [
|
|
1058
1058
|
vt({ registry: t.pluginRegistry, placement: "start" }),
|
|
1059
1059
|
/* @__PURE__ */ l(
|
|
@@ -1145,10 +1145,10 @@ function Oi(t) {
|
|
|
1145
1145
|
/* @__PURE__ */ l("div", { class: "bk-btn-group bk-btn-group--center", children: [
|
|
1146
1146
|
/* @__PURE__ */ l("button", { type: "button", class: "bk-btn", onClick: t.onPrevPage, "aria-label": d(() => e.value.previous || "Previous"), title: d(() => e.value.previous || "Previous"), children: /* @__PURE__ */ l("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ l("polyline", { points: "15 18 9 12 15 6" }) }) }),
|
|
1147
1147
|
/* @__PURE__ */ l("span", { class: "bz-page-info", "aria-live": "polite", "aria-atomic": "true", children: d(() => {
|
|
1148
|
-
const
|
|
1149
|
-
if (t.store.isSingleMode.value ||
|
|
1150
|
-
return `${
|
|
1151
|
-
const r =
|
|
1148
|
+
const n = t.store.currentPage.value, a = t.store.totalPages.value;
|
|
1149
|
+
if (t.store.isSingleMode.value || n === 0 || n >= a - 1)
|
|
1150
|
+
return `${n + 1} / ${a}`;
|
|
1151
|
+
const r = n % 2 === 1 ? n : n - 1;
|
|
1152
1152
|
return `${r + 1}-${r + 2} / ${a}`;
|
|
1153
1153
|
}) }),
|
|
1154
1154
|
/* @__PURE__ */ l("button", { type: "button", class: "bk-btn", onClick: t.onNextPage, "aria-label": d(() => e.value.next || "Next"), title: d(() => e.value.next || "Next"), children: /* @__PURE__ */ l("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ l("polyline", { points: "9 18 15 12 9 6" }) }) })
|
|
@@ -1188,7 +1188,7 @@ function Oi(t) {
|
|
|
1188
1188
|
"button",
|
|
1189
1189
|
{
|
|
1190
1190
|
type: "button",
|
|
1191
|
-
class: d(() => `bk-btn bk-btn--notes ${t.store.showNotes.value ? "active" : ""} ${t.store.pageNotes.value.has(t.store.currentPage.value) || t.store.annotations.value.some((
|
|
1191
|
+
class: d(() => `bk-btn bk-btn--notes ${t.store.showNotes.value ? "active" : ""} ${t.store.pageNotes.value.has(t.store.currentPage.value) || t.store.annotations.value.some((n) => n.pageIndex === t.store.currentPage.value) ? "bk-has-page-note" : ""}`),
|
|
1192
1192
|
onClick: t.onToggleNotes,
|
|
1193
1193
|
"aria-label": d(() => `${e.value.myNotes} (${t.store.pageNotes.value.size + t.store.annotations.value.length})`),
|
|
1194
1194
|
title: d(() => e.value.myNotes),
|
|
@@ -1236,7 +1236,7 @@ function Oi(t) {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
function Bi(t) {
|
|
1238
1238
|
return /* @__PURE__ */ l("div", { class: "bk-thumbs", style: d(() => t.store.showThumbs.value ? "display:flex;" : "display:none;"), children: t.store.pages.value.map((e, i) => {
|
|
1239
|
-
const
|
|
1239
|
+
const n = () => {
|
|
1240
1240
|
const a = t.store.currentPage.value;
|
|
1241
1241
|
if (t.store.isSingleMode.value || a === 0 || a >= t.store.pages.value.length - 1)
|
|
1242
1242
|
return a === i;
|
|
@@ -1246,11 +1246,11 @@ function Bi(t) {
|
|
|
1246
1246
|
return /* @__PURE__ */ l(
|
|
1247
1247
|
"div",
|
|
1248
1248
|
{
|
|
1249
|
-
class: d(() => `thumb-item ${
|
|
1249
|
+
class: d(() => `thumb-item ${n() ? "active" : ""}`),
|
|
1250
1250
|
role: "button",
|
|
1251
1251
|
tabindex: "0",
|
|
1252
1252
|
"aria-label": `Go to page ${i + 1}`,
|
|
1253
|
-
"aria-current": d(() =>
|
|
1253
|
+
"aria-current": d(() => n() ? "page" : void 0),
|
|
1254
1254
|
onClick: () => t.onThumbClick(i),
|
|
1255
1255
|
onKeyDown: (a) => {
|
|
1256
1256
|
(a.key === "Enter" || a.key === " ") && (a.preventDefault(), t.onThumbClick(i));
|
|
@@ -1276,35 +1276,35 @@ function Bi(t) {
|
|
|
1276
1276
|
}) });
|
|
1277
1277
|
}
|
|
1278
1278
|
function Ht(t, e, i) {
|
|
1279
|
-
return /* @__PURE__ */ l("ol", { class: "bk-toc-list", children: t.map((
|
|
1279
|
+
return /* @__PURE__ */ l("ol", { class: "bk-toc-list", children: t.map((n) => {
|
|
1280
1280
|
var a;
|
|
1281
1281
|
return /* @__PURE__ */ l("li", { class: "bk-toc-item", children: [
|
|
1282
1282
|
/* @__PURE__ */ l(
|
|
1283
1283
|
"button",
|
|
1284
1284
|
{
|
|
1285
1285
|
type: "button",
|
|
1286
|
-
class: d(() => e.currentPage.value ===
|
|
1287
|
-
"aria-current": d(() => e.currentPage.value ===
|
|
1288
|
-
onClick: () => i(
|
|
1286
|
+
class: d(() => e.currentPage.value === n.pageIndex ? "bk-toc-entry active" : "bk-toc-entry"),
|
|
1287
|
+
"aria-current": d(() => e.currentPage.value === n.pageIndex ? "page" : void 0),
|
|
1288
|
+
onClick: () => i(n.pageIndex),
|
|
1289
1289
|
children: [
|
|
1290
|
-
/* @__PURE__ */ l("span", { class: "bk-toc-title", children:
|
|
1291
|
-
/* @__PURE__ */ l("span", { class: "bk-toc-page", children:
|
|
1290
|
+
/* @__PURE__ */ l("span", { class: "bk-toc-title", children: n.title }),
|
|
1291
|
+
/* @__PURE__ */ l("span", { class: "bk-toc-page", children: n.pageIndex + 1 })
|
|
1292
1292
|
]
|
|
1293
1293
|
}
|
|
1294
1294
|
),
|
|
1295
|
-
(a =
|
|
1295
|
+
(a = n.children) != null && a.length ? Ht(n.children, e, i) : null
|
|
1296
1296
|
] });
|
|
1297
1297
|
}) });
|
|
1298
1298
|
}
|
|
1299
1299
|
function Hi(t) {
|
|
1300
|
-
const e = d(() =>
|
|
1300
|
+
const e = d(() => G({ locale: t.store.locale.value, messages: t.store.messages.value }));
|
|
1301
1301
|
return /* @__PURE__ */ l(
|
|
1302
1302
|
"nav",
|
|
1303
1303
|
{
|
|
1304
1304
|
class: "bk-toc",
|
|
1305
1305
|
onKeyDown: (i) => {
|
|
1306
|
-
var
|
|
1307
|
-
i.key === "Escape" && ((
|
|
1306
|
+
var n;
|
|
1307
|
+
i.key === "Escape" && ((n = t.onClose) == null || n.call(t));
|
|
1308
1308
|
},
|
|
1309
1309
|
"aria-label": d(() => e.value.tableOfContents || "Table of Contents"),
|
|
1310
1310
|
style: d(() => t.store.showToc.value && t.store.toc.value.length ? "display:flex;" : "display:none;"),
|
|
@@ -1321,11 +1321,11 @@ function Hi(t) {
|
|
|
1321
1321
|
function Wt(t) {
|
|
1322
1322
|
const e = document.createElement("div");
|
|
1323
1323
|
e.className = "bk-note-editor-host";
|
|
1324
|
-
let i,
|
|
1324
|
+
let i, n;
|
|
1325
1325
|
t.onReady(!1);
|
|
1326
1326
|
const a = () => {
|
|
1327
1327
|
var r;
|
|
1328
|
-
|
|
1328
|
+
n == null || n.disconnect(), i && !t.signal.aborted && ((r = t.onDraft) == null || r.call(t, i.getValue())), i == null || i.destroy(), i = void 0, t.view.current = null;
|
|
1329
1329
|
};
|
|
1330
1330
|
return t.signal.addEventListener("abort", a, { once: !0 }), queueMicrotask(async () => {
|
|
1331
1331
|
var r;
|
|
@@ -1345,9 +1345,9 @@ function Wt(t) {
|
|
|
1345
1345
|
a();
|
|
1346
1346
|
return;
|
|
1347
1347
|
}
|
|
1348
|
-
t.view.current = i, t.onReady(!0),
|
|
1348
|
+
t.view.current = i, t.onReady(!0), n = new e.ownerDocument.defaultView.MutationObserver(() => {
|
|
1349
1349
|
e.isConnected || a();
|
|
1350
|
-
}),
|
|
1350
|
+
}), n.observe(e.ownerDocument.body, { childList: !0, subtree: !0 }), (r = e.querySelector('[contenteditable="true"],textarea')) == null || r.focus();
|
|
1351
1351
|
}
|
|
1352
1352
|
}), e;
|
|
1353
1353
|
}
|
|
@@ -1355,9 +1355,9 @@ function $t(t, e) {
|
|
|
1355
1355
|
const i = document.createElement("div");
|
|
1356
1356
|
if (i.className = "bk-note-document", !t)
|
|
1357
1357
|
return i.textContent = e, i;
|
|
1358
|
-
let
|
|
1358
|
+
let n = 512;
|
|
1359
1359
|
const a = (r, h = 0) => {
|
|
1360
|
-
if (h > 8 ||
|
|
1360
|
+
if (h > 8 || n-- <= 0) return document.createTextNode("");
|
|
1361
1361
|
if (r.type === "text") {
|
|
1362
1362
|
let g = document.createTextNode(r.text ?? "");
|
|
1363
1363
|
for (const v of (r.marks ?? []).slice(0, 3)) {
|
|
@@ -1371,7 +1371,7 @@ function $t(t, e) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
const c = document.createElement(r.type === "hardBreak" ? "br" : r.type === "paragraph" ? "p" : "div");
|
|
1373
1373
|
for (const g of r.content ?? []) {
|
|
1374
|
-
if (
|
|
1374
|
+
if (n <= 0) break;
|
|
1375
1375
|
c.append(a(g, h + 1));
|
|
1376
1376
|
}
|
|
1377
1377
|
return c;
|
|
@@ -1379,15 +1379,15 @@ function $t(t, e) {
|
|
|
1379
1379
|
return i.append(a(t)), i;
|
|
1380
1380
|
}
|
|
1381
1381
|
function Wi(t) {
|
|
1382
|
-
const e = d(() =>
|
|
1383
|
-
i.value = { page: t.store.currentPage.value, text: g.value },
|
|
1382
|
+
const e = d(() => G({ locale: t.store.locale.value, messages: t.store.messages.value })), i = A({ page: -1, text: "" }), n = A(null), a = { current: null }, r = A(!1), h = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), g = d(() => t.store.pageNotes.value.get(t.store.currentPage.value) ?? ""), v = d(() => i.value.page === t.store.currentPage.value ? i.value.text : g.value), y = d(() => n.value === t.store.currentPage.value || !g.value), S = () => {
|
|
1383
|
+
i.value = { page: t.store.currentPage.value, text: g.value }, n.value = t.store.currentPage.value;
|
|
1384
1384
|
}, m = async () => {
|
|
1385
1385
|
var E, I, F;
|
|
1386
1386
|
const b = t.store.currentPage.value, P = (E = a.current) == null ? void 0 : E.getValue();
|
|
1387
|
-
P && (c.add(b), (I = a.current) == null || I.setReadOnly(!0), await t.onSave(P.text, P.document) && t.store.currentPage.value === b && (h.delete(b),
|
|
1387
|
+
P && (c.add(b), (I = a.current) == null || I.setReadOnly(!0), await t.onSave(P.text, P.document) && t.store.currentPage.value === b && (h.delete(b), n.value = null), (F = a.current) == null || F.setReadOnly(!1), c.delete(b));
|
|
1388
1388
|
}, w = async () => {
|
|
1389
1389
|
const b = t.store.currentPage.value;
|
|
1390
|
-
c.add(b), h.delete(b), await t.onClear() && (i.value = { page: b, text: "" }, t.store.currentPage.value === b && (
|
|
1390
|
+
c.add(b), h.delete(b), await t.onClear() && (i.value = { page: b, text: "" }, t.store.currentPage.value === b && (n.value = b)), c.delete(b);
|
|
1391
1391
|
};
|
|
1392
1392
|
return /* @__PURE__ */ l(
|
|
1393
1393
|
"aside",
|
|
@@ -1445,7 +1445,7 @@ function Wi(t) {
|
|
|
1445
1445
|
);
|
|
1446
1446
|
}
|
|
1447
1447
|
function $i(t) {
|
|
1448
|
-
const e = d(() =>
|
|
1448
|
+
const e = d(() => G({ locale: t.store.locale.value, messages: t.store.messages.value })), i = d(() => t.store.pendingAnnotation.value ?? t.store.annotations.value.find((g) => g.id === t.store.activeAnnotationId.value)), n = /* @__PURE__ */ new Map(), a = A(null), r = A(null), h = { current: null }, c = A(!1);
|
|
1449
1449
|
return /* @__PURE__ */ l(
|
|
1450
1450
|
"aside",
|
|
1451
1451
|
{
|
|
@@ -1473,13 +1473,13 @@ function $i(t) {
|
|
|
1473
1473
|
/* @__PURE__ */ l("button", { type: "button", class: "bk-notes-close", onClick: t.onClose, "aria-label": e.value.closeNote, children: "×" })
|
|
1474
1474
|
] }),
|
|
1475
1475
|
v ? /* @__PURE__ */ l(pe, { children: [
|
|
1476
|
-
/* @__PURE__ */ l(Wt, { value:
|
|
1476
|
+
/* @__PURE__ */ l(Wt, { value: n.get(g.id) ?? { text: g.text, document: g.document }, factory: t.store.noteEditor.value, signal: t.signal, label: e.value.notes, view: h, onReady: (y) => c.value = y, onDraft: (y) => n.set(g.id, y) }),
|
|
1477
1477
|
/* @__PURE__ */ l("div", { class: "bk-notes-actions", children: [
|
|
1478
1478
|
/* @__PURE__ */ l("button", { type: "button", onClick: t.onClose, children: e.value.cancel }),
|
|
1479
1479
|
/* @__PURE__ */ l("button", { type: "button", class: "bk-notes-save", disabled: d(() => t.store.notesSaving.value || !c.value), onClick: async () => {
|
|
1480
1480
|
var S, m, w;
|
|
1481
1481
|
const y = (S = h.current) == null ? void 0 : S.getValue();
|
|
1482
|
-
y && (
|
|
1482
|
+
y && (n.set(g.id, y), (m = h.current) == null || m.setReadOnly(!0), await t.onSave({ ...g, ...y }) && (a.value = null, n.delete(g.id)), (w = h.current) == null || w.setReadOnly(!1));
|
|
1483
1483
|
}, children: e.value.saveNote })
|
|
1484
1484
|
] })
|
|
1485
1485
|
] }) : /* @__PURE__ */ l(pe, { children: [
|
|
@@ -1501,12 +1501,12 @@ function $i(t) {
|
|
|
1501
1501
|
);
|
|
1502
1502
|
}
|
|
1503
1503
|
function qi(t) {
|
|
1504
|
-
const e = d(() =>
|
|
1504
|
+
const e = d(() => G({ locale: t.store.locale.value, messages: t.store.messages.value }));
|
|
1505
1505
|
return /* @__PURE__ */ l("div", { class: "bk-note-placement-hint", style: d(() => t.store.placingNote.value ? "display:flex;" : "display:none;"), role: "status", children: [
|
|
1506
1506
|
/* @__PURE__ */ l("span", { children: d(() => e.value.placeNote) }),
|
|
1507
1507
|
/* @__PURE__ */ l("button", { type: "button", onClick: (i) => {
|
|
1508
|
-
var
|
|
1509
|
-
t.store.placingNote.value = !1, (a = (
|
|
1508
|
+
var n, a;
|
|
1509
|
+
t.store.placingNote.value = !1, (a = (n = i.currentTarget.closest(".bk-wrapper")) == null ? void 0 : n.querySelector(".bk-btn--notes")) == null || a.focus();
|
|
1510
1510
|
}, children: [
|
|
1511
1511
|
d(() => e.value.cancel),
|
|
1512
1512
|
" (Esc)"
|
|
@@ -1515,23 +1515,23 @@ function qi(t) {
|
|
|
1515
1515
|
}
|
|
1516
1516
|
function it(t, e) {
|
|
1517
1517
|
var a;
|
|
1518
|
-
const i = ((a = t.ownerDocument.defaultView) == null ? void 0 : a.AbortController) ?? AbortController,
|
|
1519
|
-
return e.aborted ?
|
|
1518
|
+
const i = ((a = t.ownerDocument.defaultView) == null ? void 0 : a.AbortController) ?? AbortController, n = new i();
|
|
1519
|
+
return e.aborted ? n.abort() : e.addEventListener("abort", () => n.abort(), { once: !0 }), n.signal;
|
|
1520
1520
|
}
|
|
1521
|
-
function _i(t, e, i,
|
|
1522
|
-
|
|
1521
|
+
function _i(t, e, i, n) {
|
|
1522
|
+
n = it(t, n), t.setAttribute("aria-keyshortcuts", "ArrowLeft ArrowRight Home End + - 0 n Shift+n / i t f Escape");
|
|
1523
1523
|
let a = null, r = !1;
|
|
1524
|
-
const h =
|
|
1524
|
+
const h = U(() => {
|
|
1525
1525
|
const c = e.showNotes.value || e.showSearch.value || e.showToc.value || !!e.pendingAnnotation.value || !!e.activeAnnotationId.value;
|
|
1526
1526
|
c && !r && (a = t.ownerDocument.activeElement), c ? queueMicrotask(() => {
|
|
1527
|
-
if (
|
|
1527
|
+
if (n.aborted) return;
|
|
1528
1528
|
const g = e.pendingAnnotation.value || e.activeAnnotationId.value ? ".bk-note-popover" : e.showSearch.value ? ".bk-search-panel" : e.showNotes.value ? ".bk-notes-panel" : ".bk-toc", v = t.querySelector(g), y = (v == null ? void 0 : v.querySelector('textarea:not([disabled]),input:not([disabled]),[contenteditable="true"]')) ?? (v == null ? void 0 : v.querySelector("button"));
|
|
1529
1529
|
y && (v != null && v.getBoundingClientRect().width) && y.focus();
|
|
1530
1530
|
}) : r && queueMicrotask(() => {
|
|
1531
|
-
!
|
|
1531
|
+
!n.aborted && (a != null && a.isConnected) && a.focus();
|
|
1532
1532
|
}), r = c;
|
|
1533
1533
|
});
|
|
1534
|
-
|
|
1534
|
+
n.addEventListener("abort", h, { once: !0 }), t.addEventListener("keydown", (c) => {
|
|
1535
1535
|
var y, S, m, w, b, P;
|
|
1536
1536
|
if (c.defaultPrevented || c.ctrlKey || c.metaKey || c.altKey || c.isComposing || c.target.closest("dialog")) return;
|
|
1537
1537
|
if (c.key === "Escape") {
|
|
@@ -1598,19 +1598,19 @@ function _i(t, e, i, s) {
|
|
|
1598
1598
|
c.preventDefault();
|
|
1599
1599
|
}
|
|
1600
1600
|
}
|
|
1601
|
-
}, { signal:
|
|
1601
|
+
}, { signal: n });
|
|
1602
1602
|
}
|
|
1603
|
-
function
|
|
1604
|
-
const i = it(t, e),
|
|
1603
|
+
function Ui(t, e) {
|
|
1604
|
+
const i = it(t, e), n = () => {
|
|
1605
1605
|
const g = t.parentElement;
|
|
1606
1606
|
if (g != null && g.clientWidth)
|
|
1607
1607
|
for (const v of t.querySelectorAll("[data-text-width]")) {
|
|
1608
1608
|
const y = v.scrollWidth;
|
|
1609
1609
|
y && (v.style.transform = `scaleX(${Number(v.dataset.textWidth) * g.clientWidth / y})`);
|
|
1610
1610
|
}
|
|
1611
|
-
}, a = t.ownerDocument.defaultView, r = a != null && a.ResizeObserver ? new a.ResizeObserver(
|
|
1611
|
+
}, a = t.ownerDocument.defaultView, r = a != null && a.ResizeObserver ? new a.ResizeObserver(n) : null;
|
|
1612
1612
|
queueMicrotask(() => {
|
|
1613
|
-
!i.aborted && t.isConnected && (r == null || r.observe(t.parentElement),
|
|
1613
|
+
!i.aborted && t.isConnected && (r == null || r.observe(t.parentElement), n());
|
|
1614
1614
|
});
|
|
1615
1615
|
const h = a ? new a.MutationObserver(() => {
|
|
1616
1616
|
t.isConnected || c();
|
|
@@ -1641,15 +1641,15 @@ function bt(t) {
|
|
|
1641
1641
|
onContextMenu: e,
|
|
1642
1642
|
children: d(() => {
|
|
1643
1643
|
const i = t.store.textPages.value.get(t.pageIndex);
|
|
1644
|
-
return i != null && i.runs.length ? /* @__PURE__ */ l("div", { ref: (
|
|
1645
|
-
(
|
|
1644
|
+
return i != null && i.runs.length ? /* @__PURE__ */ l("div", { ref: (n) => Ui(n, t.signal), children: i.runs.map(
|
|
1645
|
+
(n) => /* @__PURE__ */ l(
|
|
1646
1646
|
"span",
|
|
1647
1647
|
{
|
|
1648
|
-
dir:
|
|
1649
|
-
"data-text-start":
|
|
1650
|
-
"data-text-width":
|
|
1651
|
-
style: `left:${
|
|
1652
|
-
children:
|
|
1648
|
+
dir: n.direction ?? "ltr",
|
|
1649
|
+
"data-text-start": n.start,
|
|
1650
|
+
"data-text-width": n.width,
|
|
1651
|
+
style: `left:${n.x * 100}%;top:${n.y * 100}%;width:max-content;height:${n.height * 100}%;font-size:${n.height * 100}cqh;transform-origin:left top;`,
|
|
1652
|
+
children: n.text
|
|
1653
1653
|
}
|
|
1654
1654
|
)
|
|
1655
1655
|
) }) : null;
|
|
@@ -1657,7 +1657,7 @@ function bt(t) {
|
|
|
1657
1657
|
}
|
|
1658
1658
|
);
|
|
1659
1659
|
}
|
|
1660
|
-
function
|
|
1660
|
+
function Gi(t, e) {
|
|
1661
1661
|
return t.type === "image" ? /* @__PURE__ */ l("img", { class: "bk-hotspot-media-image", src: t.src, alt: t.alt || "", loading: "lazy" }) : t.type === "video" ? /* @__PURE__ */ l("video", { class: "bk-hotspot-media-video", controls: !0, preload: "metadata", poster: t.poster, "aria-label": t.alt || e, children: /* @__PURE__ */ l("source", { src: t.src }) }) : /* @__PURE__ */ l("audio", { class: "bk-hotspot-media-audio", controls: !0, preload: "metadata", "aria-label": t.alt || e, children: /* @__PURE__ */ l("source", { src: t.src }) });
|
|
1662
1662
|
}
|
|
1663
1663
|
function O(t) {
|
|
@@ -1668,12 +1668,12 @@ function Vi(t) {
|
|
|
1668
1668
|
return "left:" + e(t.x) + "%;top:" + e(t.y) + "%;width:" + e(t.width) + "%;height:" + e(t.height) + "%;";
|
|
1669
1669
|
}
|
|
1670
1670
|
function wt(t) {
|
|
1671
|
-
const e = d(() =>
|
|
1671
|
+
const e = d(() => G({ locale: t.store.locale.value, messages: t.store.messages.value })), i = d(() => t.store.hotspots.value.filter((r) => r.pageIndex === t.pageIndex)), n = d(() => t.store.annotations.value.filter((r) => r.pageIndex === t.pageIndex)), a = A(0);
|
|
1672
1672
|
return /* @__PURE__ */ l("div", { class: "bk-hotspot-layer", children: [
|
|
1673
1673
|
i.value.map((r) => /* @__PURE__ */ l("button", { type: "button", class: "bk-hotspot", style: Vi(r), "aria-label": r.label, onClick: () => {
|
|
1674
1674
|
a.value = 0, t.onActivate(r);
|
|
1675
1675
|
}, children: /* @__PURE__ */ l("span", { class: "bk-hotspot-label", children: r.label }) })),
|
|
1676
|
-
d(() => /* @__PURE__ */ l("div", { class: "bk-annotation-markers", children:
|
|
1676
|
+
d(() => /* @__PURE__ */ l("div", { class: "bk-annotation-markers", children: n.value.map((r) => /* @__PURE__ */ l("button", { type: "button", "data-annotation-id": r.id, class: d(() => "bk-annotation-marker" + (t.store.activeAnnotationId.value === r.id ? " active" : "")), style: "left:" + Math.max(0, Math.min(1, r.x)) * 100 + "%;top:" + Math.max(0, Math.min(1, r.y)) * 100 + "%;", "aria-label": r.text, onPointerDown: O, onTouchStart: O, onMouseDown: O, onClick: (h) => {
|
|
1677
1677
|
h.stopPropagation(), t.onAnnotationActivate(r);
|
|
1678
1678
|
}, children: "●" })) })),
|
|
1679
1679
|
d(() => {
|
|
@@ -1686,7 +1686,7 @@ function wt(t) {
|
|
|
1686
1686
|
/* @__PURE__ */ l("button", { type: "button", class: "bk-hotspot-popup-close", onClick: t.onClose, "aria-label": d(() => e.value.closeHotspot || "Close popup"), children: "×" })
|
|
1687
1687
|
] }),
|
|
1688
1688
|
r.content ? /* @__PURE__ */ l("p", { children: r.content }) : null,
|
|
1689
|
-
r.media ? /* @__PURE__ */ l("div", { class: "bk-hotspot-popup-media", children:
|
|
1689
|
+
r.media ? /* @__PURE__ */ l("div", { class: "bk-hotspot-popup-media", children: Gi(r.media, r.label) }) : null,
|
|
1690
1690
|
g ? /* @__PURE__ */ l("div", { class: "bk-hotspot-gallery", "aria-label": r.label + " gallery", children: [
|
|
1691
1691
|
/* @__PURE__ */ l("div", { class: "bk-hotspot-gallery-thumbs", children: h.map((v, y) => /* @__PURE__ */ l("button", { type: "button", class: d(() => "bk-hotspot-gallery-thumb" + (y === c ? " is-selected" : "")), onClick: () => {
|
|
1692
1692
|
a.value = y;
|
|
@@ -1711,7 +1711,7 @@ function wt(t) {
|
|
|
1711
1711
|
}
|
|
1712
1712
|
const yt = 'button,a,input,textarea,select,[contenteditable="true"],.bk-hotspot-popup', Y = (t) => t.stopPropagation();
|
|
1713
1713
|
function xt(t) {
|
|
1714
|
-
const e = d(() =>
|
|
1714
|
+
const e = d(() => G({ locale: t.store.locale.value, messages: t.store.messages.value }));
|
|
1715
1715
|
return /* @__PURE__ */ l(
|
|
1716
1716
|
"button",
|
|
1717
1717
|
{
|
|
@@ -1728,14 +1728,14 @@ function xt(t) {
|
|
|
1728
1728
|
onMouseDown: Y,
|
|
1729
1729
|
onClick: (i) => {
|
|
1730
1730
|
i.preventDefault(), i.stopPropagation();
|
|
1731
|
-
const
|
|
1732
|
-
t.onPlace(t.pageIndex, i.detail === 0 ? 0.5 : (i.clientX -
|
|
1731
|
+
const n = i.currentTarget.getBoundingClientRect();
|
|
1732
|
+
t.onPlace(t.pageIndex, i.detail === 0 ? 0.5 : (i.clientX - n.left) / n.width, i.detail === 0 ? 0.5 : (i.clientY - n.top) / n.height);
|
|
1733
1733
|
}
|
|
1734
1734
|
}
|
|
1735
1735
|
);
|
|
1736
1736
|
}
|
|
1737
|
-
function ji(t, e, i,
|
|
1738
|
-
|
|
1737
|
+
function ji(t, e, i, n) {
|
|
1738
|
+
n = it(t, n);
|
|
1739
1739
|
let a, r = !1, h = 0, c = 0, g = 0;
|
|
1740
1740
|
const v = () => {
|
|
1741
1741
|
clearTimeout(a), a = void 0;
|
|
@@ -1755,19 +1755,19 @@ function ji(t, e, i, s) {
|
|
|
1755
1755
|
r = !0, g = Date.now() + 1e3, S(m.target, h, c);
|
|
1756
1756
|
}, 550));
|
|
1757
1757
|
}
|
|
1758
|
-
}, { capture: !0, signal:
|
|
1758
|
+
}, { capture: !0, signal: n }), t.addEventListener("pointermove", (m) => {
|
|
1759
1759
|
Math.hypot(m.clientX - h, m.clientY - c) > 10 && v();
|
|
1760
|
-
}, { capture: !0, signal:
|
|
1760
|
+
}, { capture: !0, signal: n }), t.addEventListener("pointerup", (m) => {
|
|
1761
1761
|
v(), r && (m.preventDefault(), m.stopImmediatePropagation(), r = !1);
|
|
1762
|
-
}, { capture: !0, signal:
|
|
1762
|
+
}, { capture: !0, signal: n }), t.addEventListener("click", (m) => {
|
|
1763
1763
|
Date.now() < g && (m.preventDefault(), m.stopImmediatePropagation());
|
|
1764
|
-
}, { capture: !0, signal:
|
|
1764
|
+
}, { capture: !0, signal: n }), t.addEventListener("touchend", (m) => {
|
|
1765
1765
|
Date.now() < g && (m.preventDefault(), m.stopImmediatePropagation());
|
|
1766
|
-
}, { capture: !0, passive: !1, signal:
|
|
1766
|
+
}, { capture: !0, passive: !1, signal: n }), t.addEventListener("pointercancel", () => {
|
|
1767
1767
|
v(), r = !1;
|
|
1768
|
-
}, { capture: !0, signal:
|
|
1768
|
+
}, { capture: !0, signal: n }), t.addEventListener("contextmenu", (m) => {
|
|
1769
1769
|
e.textSelection.value || !e.canAnnotate.value || m.target.closest(yt) || (m.preventDefault(), m.stopPropagation(), v(), r || S(m.target, m.clientX, m.clientY));
|
|
1770
|
-
}, { capture: !0, signal:
|
|
1770
|
+
}, { capture: !0, signal: n }), n.addEventListener("abort", v, { once: !0 });
|
|
1771
1771
|
}
|
|
1772
1772
|
function Pt(t) {
|
|
1773
1773
|
const e = d(() => t.store.searchResults.value.filter((i) => i.pageIndex === t.pageIndex).flatMap((i) => i.highlights ?? []));
|
|
@@ -1799,12 +1799,12 @@ function Xi(t) {
|
|
|
1799
1799
|
class: d(() => "bk-book " + (t.store.flipState.value !== "read" ? "is-flipping" : "")),
|
|
1800
1800
|
style: d(() => `display: ${t.store.isSingleMode.value ? "none" : "block"};`),
|
|
1801
1801
|
children: t.store.pages.value.map((e, i) => {
|
|
1802
|
-
const
|
|
1802
|
+
const n = i === 0 || i === t.store.pages.value.length - 1;
|
|
1803
1803
|
return /* @__PURE__ */ l(
|
|
1804
1804
|
"div",
|
|
1805
1805
|
{
|
|
1806
1806
|
class: d(() => `bz-page ${i === 0 ? "bz-page--cover" : ""} ${i === t.store.pages.value.length - 1 ? "bz-page--back" : ""}`),
|
|
1807
|
-
"data-density":
|
|
1807
|
+
"data-density": n ? "hard" : "soft",
|
|
1808
1808
|
"data-idx": i,
|
|
1809
1809
|
children: /* @__PURE__ */ l("div", { class: "bz-page-content", style: "position:relative; width:100%; height:100%; overflow:hidden;", children: [
|
|
1810
1810
|
/* @__PURE__ */ l(
|
|
@@ -1871,8 +1871,8 @@ function Yi(t) {
|
|
|
1871
1871
|
type: "button",
|
|
1872
1872
|
class: "bk-nav-arrow bk-nav-prev",
|
|
1873
1873
|
style: d(() => e.value ? "visibility: visible;" : "visibility: hidden;"),
|
|
1874
|
-
onClick: (
|
|
1875
|
-
|
|
1874
|
+
onClick: (n) => {
|
|
1875
|
+
n.preventDefault(), n.stopPropagation(), t.onPrevPage();
|
|
1876
1876
|
},
|
|
1877
1877
|
"aria-label": "Previous Page",
|
|
1878
1878
|
children: /* @__PURE__ */ l("div", { class: "bk-arrow-icon bk-arrow-left" })
|
|
@@ -1884,8 +1884,8 @@ function Yi(t) {
|
|
|
1884
1884
|
type: "button",
|
|
1885
1885
|
class: "bk-nav-arrow bk-nav-next",
|
|
1886
1886
|
style: d(() => i.value ? "visibility: visible;" : "visibility: hidden;"),
|
|
1887
|
-
onClick: (
|
|
1888
|
-
|
|
1887
|
+
onClick: (n) => {
|
|
1888
|
+
n.preventDefault(), n.stopPropagation(), t.onNextPage();
|
|
1889
1889
|
},
|
|
1890
1890
|
"aria-label": "Next Page",
|
|
1891
1891
|
children: /* @__PURE__ */ l("div", { class: "bk-arrow-icon bk-arrow-right" })
|
|
@@ -1894,12 +1894,12 @@ function Yi(t) {
|
|
|
1894
1894
|
] });
|
|
1895
1895
|
}
|
|
1896
1896
|
function Zi(t) {
|
|
1897
|
-
const e = d(() =>
|
|
1897
|
+
const e = d(() => G({ locale: t.store.locale.value, messages: t.store.messages.value })), i = { current: null }, n = A(""), a = () => {
|
|
1898
1898
|
var c;
|
|
1899
|
-
const h = ((c = i.current) == null ? void 0 : c.value) ??
|
|
1900
|
-
|
|
1899
|
+
const h = ((c = i.current) == null ? void 0 : c.value) ?? n.value;
|
|
1900
|
+
n.value = h, t.onSearch(h);
|
|
1901
1901
|
}, r = () => {
|
|
1902
|
-
i.current && (i.current.value = ""),
|
|
1902
|
+
i.current && (i.current.value = ""), n.value = "", t.onClear();
|
|
1903
1903
|
};
|
|
1904
1904
|
return /* @__PURE__ */ l("section", { class: "bk-search-panel", style: d(() => t.store.showSearch.value ? "display:flex;" : "display:none;"), "aria-label": d(() => e.value.search || "Search"), onKeyDown: (h) => {
|
|
1905
1905
|
h.key === "Escape" && t.onClose();
|
|
@@ -1912,7 +1912,7 @@ function Zi(t) {
|
|
|
1912
1912
|
/* @__PURE__ */ l("input", { ref: (h) => {
|
|
1913
1913
|
i.current = h;
|
|
1914
1914
|
}, class: "bk-search-input", type: "search", placeholder: d(() => e.value.searchPlaceholder || "Search PDF text"), value: d(() => t.store.searchQuery.value), onInput: (h) => {
|
|
1915
|
-
|
|
1915
|
+
n.value = h.currentTarget.value;
|
|
1916
1916
|
}, onKeyDown: (h) => {
|
|
1917
1917
|
h.key === "Enter" && a();
|
|
1918
1918
|
} }),
|
|
@@ -1931,8 +1931,8 @@ function Zi(t) {
|
|
|
1931
1931
|
}
|
|
1932
1932
|
function Qi(t) {
|
|
1933
1933
|
let e;
|
|
1934
|
-
const i = (
|
|
1935
|
-
e == null || e(), e = void 0,
|
|
1934
|
+
const i = (n) => {
|
|
1935
|
+
e == null || e(), e = void 0, n && (e = t.panel.render(n) || void 0);
|
|
1936
1936
|
};
|
|
1937
1937
|
return /* @__PURE__ */ l(
|
|
1938
1938
|
"section",
|
|
@@ -1953,7 +1953,7 @@ function Ji(t) {
|
|
|
1953
1953
|
t.store.showThumbs.value = !t.store.showThumbs.value;
|
|
1954
1954
|
}, i = () => {
|
|
1955
1955
|
t.store.showSearch.value = !1, t.store.showNotes.value = !1, t.store.showToc.value = !t.store.showToc.value;
|
|
1956
|
-
},
|
|
1956
|
+
}, n = () => {
|
|
1957
1957
|
t.store.showToc.value = !1, t.store.showSearch.value = !1, t.onToggleNotes();
|
|
1958
1958
|
}, a = () => {
|
|
1959
1959
|
t.store.isSingleMode.value = !t.store.isSingleMode.value;
|
|
@@ -2034,7 +2034,7 @@ function Ji(t) {
|
|
|
2034
2034
|
onDownload: t.onDownload,
|
|
2035
2035
|
onShare: t.onShare,
|
|
2036
2036
|
onToggleBookmark: t.onToggleBookmark,
|
|
2037
|
-
onToggleNotes:
|
|
2037
|
+
onToggleNotes: n,
|
|
2038
2038
|
onNextPage: S,
|
|
2039
2039
|
onPrevPage: m,
|
|
2040
2040
|
onSoundToggle: () => t.store.soundEnabled.value = !t.store.soundEnabled.value,
|
|
@@ -2054,38 +2054,38 @@ function Ji(t) {
|
|
|
2054
2054
|
}
|
|
2055
2055
|
);
|
|
2056
2056
|
}
|
|
2057
|
-
var
|
|
2057
|
+
var en = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ve = { exports: {} };
|
|
2058
2058
|
(function(t, e) {
|
|
2059
|
-
(function(i,
|
|
2060
|
-
|
|
2061
|
-
})(
|
|
2062
|
-
class
|
|
2063
|
-
constructor(
|
|
2064
|
-
this.state = { angle: 0, area: [], position: { x: 0, y: 0 }, hardAngle: 0, hardDrawingAngle: 0 }, this.createdDensity = o, this.nowDrawingDensity = this.createdDensity, this.render =
|
|
2059
|
+
(function(i, n) {
|
|
2060
|
+
n(e);
|
|
2061
|
+
})(en, function(i) {
|
|
2062
|
+
class n {
|
|
2063
|
+
constructor(s, o) {
|
|
2064
|
+
this.state = { angle: 0, area: [], position: { x: 0, y: 0 }, hardAngle: 0, hardDrawingAngle: 0 }, this.createdDensity = o, this.nowDrawingDensity = this.createdDensity, this.render = s;
|
|
2065
2065
|
}
|
|
2066
|
-
setDensity(
|
|
2067
|
-
this.createdDensity =
|
|
2066
|
+
setDensity(s) {
|
|
2067
|
+
this.createdDensity = s, this.nowDrawingDensity = s;
|
|
2068
2068
|
}
|
|
2069
|
-
setDrawingDensity(
|
|
2070
|
-
this.nowDrawingDensity =
|
|
2069
|
+
setDrawingDensity(s) {
|
|
2070
|
+
this.nowDrawingDensity = s;
|
|
2071
2071
|
}
|
|
2072
|
-
setPosition(
|
|
2073
|
-
this.state.position =
|
|
2072
|
+
setPosition(s) {
|
|
2073
|
+
this.state.position = s;
|
|
2074
2074
|
}
|
|
2075
|
-
setAngle(
|
|
2076
|
-
this.state.angle =
|
|
2075
|
+
setAngle(s) {
|
|
2076
|
+
this.state.angle = s;
|
|
2077
2077
|
}
|
|
2078
|
-
setArea(
|
|
2079
|
-
this.state.area =
|
|
2078
|
+
setArea(s) {
|
|
2079
|
+
this.state.area = s;
|
|
2080
2080
|
}
|
|
2081
|
-
setHardDrawingAngle(
|
|
2082
|
-
this.state.hardDrawingAngle =
|
|
2081
|
+
setHardDrawingAngle(s) {
|
|
2082
|
+
this.state.hardDrawingAngle = s;
|
|
2083
2083
|
}
|
|
2084
|
-
setHardAngle(
|
|
2085
|
-
this.state.hardAngle =
|
|
2084
|
+
setHardAngle(s) {
|
|
2085
|
+
this.state.hardAngle = s, this.state.hardDrawingAngle = s;
|
|
2086
2086
|
}
|
|
2087
|
-
setOrientation(
|
|
2088
|
-
this.orientation =
|
|
2087
|
+
setOrientation(s) {
|
|
2088
|
+
this.orientation = s;
|
|
2089
2089
|
}
|
|
2090
2090
|
getDrawingDensity() {
|
|
2091
2091
|
return this.nowDrawingDensity;
|
|
@@ -2097,24 +2097,24 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2097
2097
|
return this.state.hardAngle;
|
|
2098
2098
|
}
|
|
2099
2099
|
}
|
|
2100
|
-
class a extends
|
|
2101
|
-
constructor(
|
|
2102
|
-
super(
|
|
2100
|
+
class a extends n {
|
|
2101
|
+
constructor(s, o, u) {
|
|
2102
|
+
super(s, u), this.image = null, this.isLoad = !1, this.loadingAngle = 0, this.image = new Image(), this.image.src = o;
|
|
2103
2103
|
}
|
|
2104
|
-
draw(
|
|
2104
|
+
draw(s) {
|
|
2105
2105
|
const o = this.render.getContext(), u = this.render.convertToGlobal(this.state.position), f = this.render.getRect().pageWidth, p = this.render.getRect().height;
|
|
2106
2106
|
o.save(), o.translate(u.x, u.y), o.beginPath();
|
|
2107
2107
|
for (let x of this.state.area) x !== null && (x = this.render.convertToGlobal(x), o.lineTo(x.x - u.x, x.y - u.y));
|
|
2108
2108
|
o.rotate(this.state.angle), o.clip(), this.isLoad ? o.drawImage(this.image, 0, 0, f, p) : this.drawLoader(o, { x: 0, y: 0 }, f, p), o.restore();
|
|
2109
2109
|
}
|
|
2110
|
-
simpleDraw(
|
|
2111
|
-
const o = this.render.getRect(), u = this.render.getContext(), f = o.pageWidth, p = o.height, x =
|
|
2110
|
+
simpleDraw(s) {
|
|
2111
|
+
const o = this.render.getRect(), u = this.render.getContext(), f = o.pageWidth, p = o.height, x = s === 1 ? o.left + o.pageWidth : o.left, T = o.top;
|
|
2112
2112
|
this.isLoad ? u.drawImage(this.image, x, T, f, p) : this.drawLoader(u, { x, y: T }, f, p);
|
|
2113
2113
|
}
|
|
2114
|
-
drawLoader(
|
|
2115
|
-
|
|
2114
|
+
drawLoader(s, o, u, f) {
|
|
2115
|
+
s.beginPath(), s.strokeStyle = "rgb(200, 200, 200)", s.fillStyle = "rgb(255, 255, 255)", s.lineWidth = 1, s.rect(o.x + 1, o.y + 1, u - 1, f - 1), s.stroke(), s.fill();
|
|
2116
2116
|
const p = { x: o.x + u / 2, y: o.y + f / 2 };
|
|
2117
|
-
|
|
2117
|
+
s.beginPath(), s.lineWidth = 10, s.arc(p.x, p.y, 20, this.loadingAngle, 3 * Math.PI / 2 + this.loadingAngle), s.stroke(), s.closePath(), this.loadingAngle += 0.07, this.loadingAngle >= 2 * Math.PI && (this.loadingAngle = 0);
|
|
2118
2118
|
}
|
|
2119
2119
|
load() {
|
|
2120
2120
|
this.isLoad || (this.image.onload = () => {
|
|
@@ -2131,8 +2131,8 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2131
2131
|
}
|
|
2132
2132
|
}
|
|
2133
2133
|
class r {
|
|
2134
|
-
constructor(
|
|
2135
|
-
this.pages = [], this.currentPageIndex = 0, this.currentSpreadIndex = 0, this.landscapeSpread = [], this.portraitSpread = [], this.render = o, this.app =
|
|
2134
|
+
constructor(s, o) {
|
|
2135
|
+
this.pages = [], this.currentPageIndex = 0, this.currentSpreadIndex = 0, this.landscapeSpread = [], this.portraitSpread = [], this.render = o, this.app = s, this.currentPageIndex = 0, this.isShowCover = this.app.getSettings().showCover;
|
|
2136
2136
|
}
|
|
2137
2137
|
destroy() {
|
|
2138
2138
|
this.pages = [];
|
|
@@ -2140,16 +2140,16 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2140
2140
|
createSpread() {
|
|
2141
2141
|
this.landscapeSpread = [], this.portraitSpread = [];
|
|
2142
2142
|
for (let o = 0; o < this.pages.length; o++) this.portraitSpread.push([o]);
|
|
2143
|
-
let
|
|
2144
|
-
this.isShowCover && (this.pages[0].setDensity("hard"), this.landscapeSpread.push([
|
|
2145
|
-
for (let o =
|
|
2143
|
+
let s = 0;
|
|
2144
|
+
this.isShowCover && (this.pages[0].setDensity("hard"), this.landscapeSpread.push([s]), s++);
|
|
2145
|
+
for (let o = s; o < this.pages.length; o += 2) o < this.pages.length - 1 ? this.landscapeSpread.push([o, o + 1]) : (this.landscapeSpread.push([o]), this.pages[o].setDensity("hard"));
|
|
2146
2146
|
}
|
|
2147
2147
|
getSpread() {
|
|
2148
2148
|
return this.render.getOrientation() === "landscape" ? this.landscapeSpread : this.portraitSpread;
|
|
2149
2149
|
}
|
|
2150
|
-
getSpreadIndexByPage(
|
|
2150
|
+
getSpreadIndexByPage(s) {
|
|
2151
2151
|
const o = this.getSpread();
|
|
2152
|
-
for (let u = 0; u < o.length; u++) if (
|
|
2152
|
+
for (let u = 0; u < o.length; u++) if (s === o[u][0] || s === o[u][1]) return u;
|
|
2153
2153
|
return null;
|
|
2154
2154
|
}
|
|
2155
2155
|
getPageCount() {
|
|
@@ -2158,32 +2158,32 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2158
2158
|
getPages() {
|
|
2159
2159
|
return this.pages;
|
|
2160
2160
|
}
|
|
2161
|
-
getPage(
|
|
2162
|
-
if (
|
|
2161
|
+
getPage(s) {
|
|
2162
|
+
if (s >= 0 && s < this.pages.length) return this.pages[s];
|
|
2163
2163
|
throw new Error("Invalid page number");
|
|
2164
2164
|
}
|
|
2165
|
-
nextBy(
|
|
2166
|
-
const o = this.pages.indexOf(
|
|
2165
|
+
nextBy(s) {
|
|
2166
|
+
const o = this.pages.indexOf(s);
|
|
2167
2167
|
return o < this.pages.length - 1 ? this.pages[o + 1] : null;
|
|
2168
2168
|
}
|
|
2169
|
-
prevBy(
|
|
2170
|
-
const o = this.pages.indexOf(
|
|
2169
|
+
prevBy(s) {
|
|
2170
|
+
const o = this.pages.indexOf(s);
|
|
2171
2171
|
return o > 0 ? this.pages[o - 1] : null;
|
|
2172
2172
|
}
|
|
2173
|
-
getFlippingPage(
|
|
2173
|
+
getFlippingPage(s) {
|
|
2174
2174
|
const o = this.currentSpreadIndex;
|
|
2175
|
-
if (this.render.getOrientation() === "portrait") return
|
|
2175
|
+
if (this.render.getOrientation() === "portrait") return s === 0 ? this.pages[o].newTemporaryCopy() : this.pages[o - 1];
|
|
2176
2176
|
{
|
|
2177
|
-
const u =
|
|
2178
|
-
return u.length === 1 ||
|
|
2177
|
+
const u = s === 0 ? this.getSpread()[o + 1] : this.getSpread()[o - 1];
|
|
2178
|
+
return u.length === 1 || s === 0 ? this.pages[u[0]] : this.pages[u[1]];
|
|
2179
2179
|
}
|
|
2180
2180
|
}
|
|
2181
|
-
getBottomPage(
|
|
2181
|
+
getBottomPage(s) {
|
|
2182
2182
|
const o = this.currentSpreadIndex;
|
|
2183
|
-
if (this.render.getOrientation() === "portrait") return
|
|
2183
|
+
if (this.render.getOrientation() === "portrait") return s === 0 ? this.pages[o + 1] : this.pages[o - 1];
|
|
2184
2184
|
{
|
|
2185
|
-
const u =
|
|
2186
|
-
return u.length === 1 ? this.pages[u[0]] :
|
|
2185
|
+
const u = s === 0 ? this.getSpread()[o + 1] : this.getSpread()[o - 1];
|
|
2186
|
+
return u.length === 1 ? this.pages[u[0]] : s === 0 ? this.pages[u[1]] : this.pages[u[0]];
|
|
2187
2187
|
}
|
|
2188
2188
|
}
|
|
2189
2189
|
showNext() {
|
|
@@ -2195,81 +2195,81 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2195
2195
|
getCurrentPageIndex() {
|
|
2196
2196
|
return this.currentPageIndex;
|
|
2197
2197
|
}
|
|
2198
|
-
show(
|
|
2199
|
-
if (
|
|
2200
|
-
const o = this.getSpreadIndexByPage(
|
|
2198
|
+
show(s = null) {
|
|
2199
|
+
if (s === null && (s = this.currentPageIndex), s < 0 || s >= this.pages.length) return;
|
|
2200
|
+
const o = this.getSpreadIndexByPage(s);
|
|
2201
2201
|
o !== null && (this.currentSpreadIndex = o, this.showSpread());
|
|
2202
2202
|
}
|
|
2203
2203
|
getCurrentSpreadIndex() {
|
|
2204
2204
|
return this.currentSpreadIndex;
|
|
2205
2205
|
}
|
|
2206
|
-
setCurrentSpreadIndex(
|
|
2207
|
-
if (!(
|
|
2208
|
-
this.currentSpreadIndex =
|
|
2206
|
+
setCurrentSpreadIndex(s) {
|
|
2207
|
+
if (!(s >= 0 && s < this.getSpread().length)) throw new Error("Invalid page");
|
|
2208
|
+
this.currentSpreadIndex = s;
|
|
2209
2209
|
}
|
|
2210
2210
|
showSpread() {
|
|
2211
|
-
const
|
|
2212
|
-
|
|
2211
|
+
const s = this.getSpread()[this.currentSpreadIndex];
|
|
2212
|
+
s.length === 2 ? (this.render.setLeftPage(this.pages[s[0]]), this.render.setRightPage(this.pages[s[1]])) : this.render.getOrientation() === "landscape" && s[0] === this.pages.length - 1 ? (this.render.setLeftPage(this.pages[s[0]]), this.render.setRightPage(null)) : (this.render.setLeftPage(null), this.render.setRightPage(this.pages[s[0]])), this.currentPageIndex = s[0], this.app.updatePageIndex(this.currentPageIndex);
|
|
2213
2213
|
}
|
|
2214
2214
|
}
|
|
2215
2215
|
class h extends r {
|
|
2216
|
-
constructor(
|
|
2217
|
-
super(
|
|
2216
|
+
constructor(s, o, u) {
|
|
2217
|
+
super(s, o), this.imagesHref = u;
|
|
2218
2218
|
}
|
|
2219
2219
|
load() {
|
|
2220
|
-
for (const
|
|
2221
|
-
const o = new a(this.render,
|
|
2220
|
+
for (const s of this.imagesHref) {
|
|
2221
|
+
const o = new a(this.render, s, "soft");
|
|
2222
2222
|
o.load(), this.pages.push(o);
|
|
2223
2223
|
}
|
|
2224
2224
|
this.createSpread();
|
|
2225
2225
|
}
|
|
2226
2226
|
}
|
|
2227
2227
|
class c {
|
|
2228
|
-
static GetDistanceBetweenTwoPoint(
|
|
2229
|
-
return
|
|
2228
|
+
static GetDistanceBetweenTwoPoint(s, o) {
|
|
2229
|
+
return s === null || o === null ? 1 / 0 : Math.sqrt(Math.pow(o.x - s.x, 2) + Math.pow(o.y - s.y, 2));
|
|
2230
2230
|
}
|
|
2231
|
-
static GetSegmentLength(
|
|
2232
|
-
return c.GetDistanceBetweenTwoPoint(
|
|
2231
|
+
static GetSegmentLength(s) {
|
|
2232
|
+
return c.GetDistanceBetweenTwoPoint(s[0], s[1]);
|
|
2233
2233
|
}
|
|
2234
|
-
static GetAngleBetweenTwoLine(
|
|
2235
|
-
const u =
|
|
2234
|
+
static GetAngleBetweenTwoLine(s, o) {
|
|
2235
|
+
const u = s[0].y - s[1].y, f = o[0].y - o[1].y, p = s[1].x - s[0].x, x = o[1].x - o[0].x;
|
|
2236
2236
|
return Math.acos((u * f + p * x) / (Math.sqrt(u * u + p * p) * Math.sqrt(f * f + x * x)));
|
|
2237
2237
|
}
|
|
2238
|
-
static PointInRect(
|
|
2239
|
-
return o === null ? null : o.x >=
|
|
2238
|
+
static PointInRect(s, o) {
|
|
2239
|
+
return o === null ? null : o.x >= s.left && o.x <= s.width + s.left && o.y >= s.top && o.y <= s.top + s.height ? o : null;
|
|
2240
2240
|
}
|
|
2241
|
-
static GetRotatedPoint(
|
|
2242
|
-
return { x:
|
|
2241
|
+
static GetRotatedPoint(s, o, u) {
|
|
2242
|
+
return { x: s.x * Math.cos(u) + s.y * Math.sin(u) + o.x, y: s.y * Math.cos(u) - s.x * Math.sin(u) + o.y };
|
|
2243
2243
|
}
|
|
2244
|
-
static LimitPointToCircle(
|
|
2245
|
-
if (c.GetDistanceBetweenTwoPoint(
|
|
2246
|
-
const f =
|
|
2244
|
+
static LimitPointToCircle(s, o, u) {
|
|
2245
|
+
if (c.GetDistanceBetweenTwoPoint(s, u) <= o) return u;
|
|
2246
|
+
const f = s.x, p = s.y, x = u.x, T = u.y;
|
|
2247
2247
|
let M = Math.sqrt(Math.pow(o, 2) * Math.pow(f - x, 2) / (Math.pow(f - x, 2) + Math.pow(p - T, 2))) + f;
|
|
2248
2248
|
u.x < 0 && (M *= -1);
|
|
2249
2249
|
let L = (M - f) * (p - T) / (f - x) + p;
|
|
2250
2250
|
return f - x + p === 0 && (L = o), { x: M, y: L };
|
|
2251
2251
|
}
|
|
2252
|
-
static GetIntersectBetweenTwoSegment(
|
|
2253
|
-
return c.PointInRect(
|
|
2252
|
+
static GetIntersectBetweenTwoSegment(s, o, u) {
|
|
2253
|
+
return c.PointInRect(s, c.GetIntersectBeetwenTwoLine(o, u));
|
|
2254
2254
|
}
|
|
2255
|
-
static GetIntersectBeetwenTwoLine(
|
|
2256
|
-
const u =
|
|
2255
|
+
static GetIntersectBeetwenTwoLine(s, o) {
|
|
2256
|
+
const u = s[0].y - s[1].y, f = o[0].y - o[1].y, p = s[1].x - s[0].x, x = o[1].x - o[0].x, T = s[0].x * s[1].y - s[1].x * s[0].y, M = o[0].x * o[1].y - o[1].x * o[0].y, L = u * M - f * T, z = p * M - x * T, B = -(T * x - M * p) / (u * x - f * p), W = -(u * M - f * T) / (u * x - f * p);
|
|
2257
2257
|
if (isFinite(B) && isFinite(W)) return { x: B, y: W };
|
|
2258
2258
|
if (Math.abs(L - z) < 0.1) throw new Error("Segment included");
|
|
2259
2259
|
return null;
|
|
2260
2260
|
}
|
|
2261
|
-
static GetCordsFromTwoPoint(
|
|
2262
|
-
const u = Math.abs(
|
|
2261
|
+
static GetCordsFromTwoPoint(s, o) {
|
|
2262
|
+
const u = Math.abs(s.x - o.x), f = Math.abs(s.y - o.y), p = Math.max(u, f), x = [s];
|
|
2263
2263
|
function T(M, L, z, B, W) {
|
|
2264
2264
|
return L > M ? M + W * (z / B) : L < M ? M - W * (z / B) : M;
|
|
2265
2265
|
}
|
|
2266
|
-
for (let M = 1; M <= p; M += 1) x.push({ x: T(
|
|
2266
|
+
for (let M = 1; M <= p; M += 1) x.push({ x: T(s.x, o.x, u, p, M), y: T(s.y, o.y, f, p, M) });
|
|
2267
2267
|
return x;
|
|
2268
2268
|
}
|
|
2269
2269
|
}
|
|
2270
|
-
class g extends
|
|
2271
|
-
constructor(
|
|
2272
|
-
super(
|
|
2270
|
+
class g extends n {
|
|
2271
|
+
constructor(s, o, u) {
|
|
2272
|
+
super(s, u), this.copiedElement = null, this.temporaryCopy = null, this.isLoad = !1, this.element = o, this.element.classList.add("stf__item"), this.element.classList.add("--" + u);
|
|
2273
2273
|
}
|
|
2274
2274
|
newTemporaryCopy() {
|
|
2275
2275
|
return this.nowDrawingDensity === "hard" ? this : (this.temporaryCopy === null && (this.copiedElement = this.element.cloneNode(!0), this.element.parentElement.appendChild(this.copiedElement), this.temporaryCopy = new g(this.render, this.copiedElement, this.nowDrawingDensity)), this.getTemporaryCopy());
|
|
@@ -2280,8 +2280,8 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2280
2280
|
hideTemporaryCopy() {
|
|
2281
2281
|
this.temporaryCopy !== null && (this.copiedElement.remove(), this.copiedElement = null, this.temporaryCopy = null);
|
|
2282
2282
|
}
|
|
2283
|
-
draw(
|
|
2284
|
-
const o =
|
|
2283
|
+
draw(s) {
|
|
2284
|
+
const o = s || this.nowDrawingDensity, u = this.render.convertToGlobal(this.state.position), f = this.render.getRect().pageWidth, p = this.render.getRect().height;
|
|
2285
2285
|
this.element.classList.remove("--simple");
|
|
2286
2286
|
const x = `
|
|
2287
2287
|
display: block;
|
|
@@ -2293,8 +2293,8 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2293
2293
|
`;
|
|
2294
2294
|
o === "hard" ? this.drawHard(x) : this.drawSoft(u, x);
|
|
2295
2295
|
}
|
|
2296
|
-
drawHard(
|
|
2297
|
-
const o = this.render.getRect().left + this.render.getRect().width / 2, u = this.state.hardDrawingAngle, f =
|
|
2296
|
+
drawHard(s = "") {
|
|
2297
|
+
const o = this.render.getRect().left + this.render.getRect().width / 2, u = this.state.hardDrawingAngle, f = s + `
|
|
2298
2298
|
backface-visibility: hidden;
|
|
2299
2299
|
-webkit-backface-visibility: hidden;
|
|
2300
2300
|
clip-path: none;
|
|
@@ -2304,18 +2304,18 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2304
2304
|
transform: translate3d(${o}px, 0, 0) rotateY(${u}deg);`);
|
|
2305
2305
|
this.element.style.cssText = f;
|
|
2306
2306
|
}
|
|
2307
|
-
drawSoft(
|
|
2307
|
+
drawSoft(s, o = "") {
|
|
2308
2308
|
let u = "polygon( ";
|
|
2309
2309
|
for (const p of this.state.area) if (p !== null) {
|
|
2310
2310
|
let x = this.render.getDirection() === 1 ? { x: -p.x + this.state.position.x, y: p.y - this.state.position.y } : { x: p.x - this.state.position.x, y: p.y - this.state.position.y };
|
|
2311
2311
|
x = c.GetRotatedPoint(x, { x: 0, y: 0 }, this.state.angle), u += x.x + "px " + x.y + "px, ";
|
|
2312
2312
|
}
|
|
2313
2313
|
u = u.slice(0, -2), u += ")";
|
|
2314
|
-
const f = o + `transform-origin: 0 0; clip-path: ${u}; -webkit-clip-path: ${u};` + (this.render.isSafari() && this.state.angle === 0 ? `transform: translate(${
|
|
2314
|
+
const f = o + `transform-origin: 0 0; clip-path: ${u}; -webkit-clip-path: ${u};` + (this.render.isSafari() && this.state.angle === 0 ? `transform: translate(${s.x}px, ${s.y}px);` : `transform: translate3d(${s.x}px, ${s.y}px, 0) rotate(${this.state.angle}rad);`);
|
|
2315
2315
|
this.element.style.cssText = f;
|
|
2316
2316
|
}
|
|
2317
|
-
simpleDraw(
|
|
2318
|
-
const o = this.render.getRect(), u = o.pageWidth, f = o.height, p =
|
|
2317
|
+
simpleDraw(s) {
|
|
2318
|
+
const o = this.render.getRect(), u = o.pageWidth, f = o.height, p = s === 1 ? o.left + o.pageWidth : o.left, x = o.top;
|
|
2319
2319
|
this.element.classList.add("--simple"), this.element.style.cssText = `
|
|
2320
2320
|
position: absolute;
|
|
2321
2321
|
display: block;
|
|
@@ -2331,44 +2331,44 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2331
2331
|
load() {
|
|
2332
2332
|
this.isLoad = !0;
|
|
2333
2333
|
}
|
|
2334
|
-
setOrientation(
|
|
2335
|
-
super.setOrientation(
|
|
2334
|
+
setOrientation(s) {
|
|
2335
|
+
super.setOrientation(s), this.element.classList.remove("--left", "--right"), this.element.classList.add(s === 1 ? "--right" : "--left");
|
|
2336
2336
|
}
|
|
2337
|
-
setDrawingDensity(
|
|
2338
|
-
this.element.classList.remove("--soft", "--hard"), this.element.classList.add("--" +
|
|
2337
|
+
setDrawingDensity(s) {
|
|
2338
|
+
this.element.classList.remove("--soft", "--hard"), this.element.classList.add("--" + s), super.setDrawingDensity(s);
|
|
2339
2339
|
}
|
|
2340
2340
|
}
|
|
2341
2341
|
class v extends r {
|
|
2342
|
-
constructor(
|
|
2343
|
-
super(
|
|
2342
|
+
constructor(s, o, u, f) {
|
|
2343
|
+
super(s, o), this.element = u, this.pagesElement = f;
|
|
2344
2344
|
}
|
|
2345
2345
|
load() {
|
|
2346
|
-
for (const
|
|
2347
|
-
const o = new g(this.render,
|
|
2346
|
+
for (const s of this.pagesElement) {
|
|
2347
|
+
const o = new g(this.render, s, s.dataset.density === "hard" ? "hard" : "soft");
|
|
2348
2348
|
o.load(), this.pages.push(o);
|
|
2349
2349
|
}
|
|
2350
2350
|
this.createSpread();
|
|
2351
2351
|
}
|
|
2352
2352
|
}
|
|
2353
2353
|
class y {
|
|
2354
|
-
constructor(
|
|
2355
|
-
this.direction =
|
|
2354
|
+
constructor(s, o, u, f) {
|
|
2355
|
+
this.direction = s, this.corner = o, this.topIntersectPoint = null, this.sideIntersectPoint = null, this.bottomIntersectPoint = null, this.pageWidth = parseInt(u, 10), this.pageHeight = parseInt(f, 10);
|
|
2356
2356
|
}
|
|
2357
|
-
calc(
|
|
2357
|
+
calc(s) {
|
|
2358
2358
|
try {
|
|
2359
|
-
return this.position = this.calcAngleAndPosition(
|
|
2359
|
+
return this.position = this.calcAngleAndPosition(s), this.calculateIntersectPoint(this.position), !0;
|
|
2360
2360
|
} catch {
|
|
2361
2361
|
return !1;
|
|
2362
2362
|
}
|
|
2363
2363
|
}
|
|
2364
2364
|
getFlippingClipArea() {
|
|
2365
|
-
const
|
|
2365
|
+
const s = [];
|
|
2366
2366
|
let o = !1;
|
|
2367
|
-
return
|
|
2367
|
+
return s.push(this.rect.topLeft), s.push(this.topIntersectPoint), this.sideIntersectPoint === null ? o = !0 : (s.push(this.sideIntersectPoint), this.bottomIntersectPoint === null && (o = !1)), s.push(this.bottomIntersectPoint), (o || this.corner === "bottom") && s.push(this.rect.bottomLeft), s;
|
|
2368
2368
|
}
|
|
2369
2369
|
getBottomClipArea() {
|
|
2370
|
-
const
|
|
2371
|
-
return
|
|
2370
|
+
const s = [];
|
|
2371
|
+
return s.push(this.topIntersectPoint), this.corner === "top" ? s.push({ x: this.pageWidth, y: 0 }) : (this.topIntersectPoint !== null && s.push({ x: this.pageWidth, y: 0 }), s.push({ x: this.pageWidth, y: this.pageHeight })), this.sideIntersectPoint !== null ? c.GetDistanceBetweenTwoPoint(this.sideIntersectPoint, this.topIntersectPoint) >= 10 && s.push(this.sideIntersectPoint) : this.corner === "top" && s.push({ x: this.pageWidth, y: this.pageHeight }), s.push(this.bottomIntersectPoint), s.push(this.topIntersectPoint), s;
|
|
2372
2372
|
}
|
|
2373
2373
|
getAngle() {
|
|
2374
2374
|
return this.direction === 0 ? -this.angle : this.angle;
|
|
@@ -2398,40 +2398,40 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2398
2398
|
return this.corner === "top" ? this.topIntersectPoint : this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.topIntersectPoint;
|
|
2399
2399
|
}
|
|
2400
2400
|
getShadowAngle() {
|
|
2401
|
-
const
|
|
2402
|
-
return this.direction === 0 ?
|
|
2401
|
+
const s = c.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(), [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]);
|
|
2402
|
+
return this.direction === 0 ? s : Math.PI - s;
|
|
2403
2403
|
}
|
|
2404
|
-
calcAngleAndPosition(
|
|
2405
|
-
let o =
|
|
2404
|
+
calcAngleAndPosition(s) {
|
|
2405
|
+
let o = s;
|
|
2406
2406
|
if (this.updateAngleAndGeometry(o), o = this.corner === "top" ? this.checkPositionAtCenterLine(o, { x: 0, y: 0 }, { x: 0, y: this.pageHeight }) : this.checkPositionAtCenterLine(o, { x: 0, y: this.pageHeight }, { x: 0, y: 0 }), Math.abs(o.x - this.pageWidth) < 1 && Math.abs(o.y) < 1) throw new Error("Point is too small");
|
|
2407
2407
|
return o;
|
|
2408
2408
|
}
|
|
2409
|
-
updateAngleAndGeometry(
|
|
2410
|
-
this.angle = this.calculateAngle(
|
|
2409
|
+
updateAngleAndGeometry(s) {
|
|
2410
|
+
this.angle = this.calculateAngle(s), this.rect = this.getPageRect(s);
|
|
2411
2411
|
}
|
|
2412
|
-
calculateAngle(
|
|
2413
|
-
const o = this.pageWidth -
|
|
2412
|
+
calculateAngle(s) {
|
|
2413
|
+
const o = this.pageWidth - s.x + 1, u = this.corner === "bottom" ? this.pageHeight - s.y : s.y;
|
|
2414
2414
|
let f = 2 * Math.acos(o / Math.sqrt(u * u + o * o));
|
|
2415
2415
|
u < 0 && (f = -f);
|
|
2416
2416
|
const p = Math.PI - f;
|
|
2417
2417
|
if (!isFinite(f) || p >= 0 && p < 3e-3) throw new Error("The G point is too small");
|
|
2418
2418
|
return this.corner === "bottom" && (f = -f), f;
|
|
2419
2419
|
}
|
|
2420
|
-
getPageRect(
|
|
2421
|
-
return this.corner === "top" ? this.getRectFromBasePoint([{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }, { x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }],
|
|
2420
|
+
getPageRect(s) {
|
|
2421
|
+
return this.corner === "top" ? this.getRectFromBasePoint([{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }, { x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }], s) : this.getRectFromBasePoint([{ x: 0, y: -this.pageHeight }, { x: this.pageWidth, y: -this.pageHeight }, { x: 0, y: 0 }, { x: this.pageWidth, y: 0 }], s);
|
|
2422
2422
|
}
|
|
2423
|
-
getRectFromBasePoint(
|
|
2424
|
-
return { topLeft: this.getRotatedPoint(
|
|
2423
|
+
getRectFromBasePoint(s, o) {
|
|
2424
|
+
return { topLeft: this.getRotatedPoint(s[0], o), topRight: this.getRotatedPoint(s[1], o), bottomLeft: this.getRotatedPoint(s[2], o), bottomRight: this.getRotatedPoint(s[3], o) };
|
|
2425
2425
|
}
|
|
2426
|
-
getRotatedPoint(
|
|
2427
|
-
return { x:
|
|
2426
|
+
getRotatedPoint(s, o) {
|
|
2427
|
+
return { x: s.x * Math.cos(this.angle) + s.y * Math.sin(this.angle) + o.x, y: s.y * Math.cos(this.angle) - s.x * Math.sin(this.angle) + o.y };
|
|
2428
2428
|
}
|
|
2429
|
-
calculateIntersectPoint(
|
|
2429
|
+
calculateIntersectPoint(s) {
|
|
2430
2430
|
const o = { left: -1, top: -1, width: this.pageWidth + 2, height: this.pageHeight + 2 };
|
|
2431
|
-
this.corner === "top" ? (this.topIntersectPoint = c.GetIntersectBetweenTwoSegment(o, [
|
|
2431
|
+
this.corner === "top" ? (this.topIntersectPoint = c.GetIntersectBetweenTwoSegment(o, [s, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = c.GetIntersectBetweenTwoSegment(o, [s, this.rect.bottomLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = c.GetIntersectBetweenTwoSegment(o, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }])) : (this.topIntersectPoint = c.GetIntersectBetweenTwoSegment(o, [this.rect.topLeft, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = c.GetIntersectBetweenTwoSegment(o, [s, this.rect.topLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = c.GetIntersectBetweenTwoSegment(o, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }]));
|
|
2432
2432
|
}
|
|
2433
|
-
checkPositionAtCenterLine(
|
|
2434
|
-
let f =
|
|
2433
|
+
checkPositionAtCenterLine(s, o, u) {
|
|
2434
|
+
let f = s;
|
|
2435
2435
|
const p = c.LimitPointToCircle(o, this.pageWidth, f);
|
|
2436
2436
|
f !== p && (f = p, this.updateAngleAndGeometry(f));
|
|
2437
2437
|
const x = Math.sqrt(Math.pow(this.pageWidth, 2) + Math.pow(this.pageHeight, 2));
|
|
@@ -2443,27 +2443,27 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2443
2443
|
return f;
|
|
2444
2444
|
}
|
|
2445
2445
|
getSegmentToShadowLine() {
|
|
2446
|
-
const
|
|
2447
|
-
return [
|
|
2446
|
+
const s = this.getShadowStartPoint();
|
|
2447
|
+
return [s, s !== this.sideIntersectPoint && this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.bottomIntersectPoint];
|
|
2448
2448
|
}
|
|
2449
2449
|
}
|
|
2450
2450
|
class S {
|
|
2451
|
-
constructor(
|
|
2452
|
-
this.flippingPage = null, this.bottomPage = null, this.calc = null, this.state = "read", this.render =
|
|
2451
|
+
constructor(s, o) {
|
|
2452
|
+
this.flippingPage = null, this.bottomPage = null, this.calc = null, this.state = "read", this.render = s, this.app = o;
|
|
2453
2453
|
}
|
|
2454
|
-
fold(
|
|
2455
|
-
this.setState("user_fold"), this.calc === null && this.start(
|
|
2454
|
+
fold(s) {
|
|
2455
|
+
this.setState("user_fold"), this.calc === null && this.start(s), this.do(this.render.convertToPage(s));
|
|
2456
2456
|
}
|
|
2457
|
-
flip(
|
|
2458
|
-
if (this.app.getSettings().disableFlipByClick && !this.isPointOnCorners(
|
|
2457
|
+
flip(s) {
|
|
2458
|
+
if (this.app.getSettings().disableFlipByClick && !this.isPointOnCorners(s) || (this.calc !== null && this.render.finishAnimation(), !this.start(s))) return;
|
|
2459
2459
|
const o = this.getBoundsRect();
|
|
2460
2460
|
this.setState("flipping");
|
|
2461
2461
|
const u = o.height / 10, f = this.calc.getCorner() === "bottom" ? o.height - u : u, p = this.calc.getCorner() === "bottom" ? o.height : 0;
|
|
2462
2462
|
this.calc.calc({ x: o.pageWidth - u, y: f }), this.animateFlippingTo({ x: o.pageWidth - u, y: f }, { x: -o.pageWidth, y: p }, !0);
|
|
2463
2463
|
}
|
|
2464
|
-
start(
|
|
2464
|
+
start(s) {
|
|
2465
2465
|
this.reset();
|
|
2466
|
-
const o = this.render.convertToBook(
|
|
2466
|
+
const o = this.render.convertToBook(s), u = this.getBoundsRect(), f = this.getDirectionByPoint(o), p = o.y >= u.height / 2 ? "bottom" : "top";
|
|
2467
2467
|
if (!this.checkDirection(f)) return !1;
|
|
2468
2468
|
try {
|
|
2469
2469
|
if (this.flippingPage = this.app.getPageCollection().getFlippingPage(f), this.bottomPage = this.app.getPageCollection().getBottomPage(f), this.render.getOrientation() === "landscape") if (f === 1) {
|
|
@@ -2478,43 +2478,43 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2478
2478
|
return !1;
|
|
2479
2479
|
}
|
|
2480
2480
|
}
|
|
2481
|
-
do(
|
|
2482
|
-
if (this.calc !== null && this.calc.calc(
|
|
2481
|
+
do(s) {
|
|
2482
|
+
if (this.calc !== null && this.calc.calc(s)) {
|
|
2483
2483
|
const o = this.calc.getFlippingProgress();
|
|
2484
2484
|
this.bottomPage.setArea(this.calc.getBottomClipArea()), this.bottomPage.setPosition(this.calc.getBottomPagePosition()), this.bottomPage.setAngle(0), this.bottomPage.setHardAngle(0), this.flippingPage.setArea(this.calc.getFlippingClipArea()), this.flippingPage.setPosition(this.calc.getActiveCorner()), this.flippingPage.setAngle(this.calc.getAngle()), this.calc.getDirection() === 0 ? this.flippingPage.setHardAngle(90 * (200 - 2 * o) / 100) : this.flippingPage.setHardAngle(-90 * (200 - 2 * o) / 100), this.render.setPageRect(this.calc.getRect()), this.render.setBottomPage(this.bottomPage), this.render.setFlippingPage(this.flippingPage), this.render.setShadowData(this.calc.getShadowStartPoint(), this.calc.getShadowAngle(), o, this.calc.getDirection());
|
|
2485
2485
|
}
|
|
2486
2486
|
}
|
|
2487
|
-
flipToPage(
|
|
2488
|
-
const u = this.app.getPageCollection().getCurrentSpreadIndex(), f = this.app.getPageCollection().getSpreadIndexByPage(
|
|
2487
|
+
flipToPage(s, o) {
|
|
2488
|
+
const u = this.app.getPageCollection().getCurrentSpreadIndex(), f = this.app.getPageCollection().getSpreadIndexByPage(s);
|
|
2489
2489
|
try {
|
|
2490
2490
|
f > u && (this.app.getPageCollection().setCurrentSpreadIndex(f - 1), this.flipNext(o)), f < u && (this.app.getPageCollection().setCurrentSpreadIndex(f + 1), this.flipPrev(o));
|
|
2491
2491
|
} catch {
|
|
2492
2492
|
}
|
|
2493
2493
|
}
|
|
2494
|
-
flipNext(
|
|
2495
|
-
this.flip({ x: this.render.getRect().left + 2 * this.render.getRect().pageWidth - 10, y:
|
|
2494
|
+
flipNext(s) {
|
|
2495
|
+
this.flip({ x: this.render.getRect().left + 2 * this.render.getRect().pageWidth - 10, y: s === "top" ? 1 : this.render.getRect().height - 2 });
|
|
2496
2496
|
}
|
|
2497
|
-
flipPrev(
|
|
2498
|
-
this.flip({ x: 10, y:
|
|
2497
|
+
flipPrev(s) {
|
|
2498
|
+
this.flip({ x: 10, y: s === "top" ? 1 : this.render.getRect().height - 2 });
|
|
2499
2499
|
}
|
|
2500
2500
|
stopMove() {
|
|
2501
2501
|
if (this.calc === null) return;
|
|
2502
|
-
const
|
|
2503
|
-
|
|
2502
|
+
const s = this.calc.getPosition(), o = this.getBoundsRect(), u = this.calc.getCorner() === "bottom" ? o.height : 0;
|
|
2503
|
+
s.x <= 0 ? this.animateFlippingTo(s, { x: -o.pageWidth, y: u }, !0) : this.animateFlippingTo(s, { x: o.pageWidth, y: u }, !1);
|
|
2504
2504
|
}
|
|
2505
|
-
showCorner(
|
|
2505
|
+
showCorner(s) {
|
|
2506
2506
|
if (!this.checkState("read", "fold_corner")) return;
|
|
2507
2507
|
const o = this.getBoundsRect(), u = o.pageWidth;
|
|
2508
|
-
if (this.isPointOnCorners(
|
|
2509
|
-
if (!this.start(
|
|
2508
|
+
if (this.isPointOnCorners(s)) if (this.calc === null) {
|
|
2509
|
+
if (!this.start(s)) return;
|
|
2510
2510
|
this.setState("fold_corner"), this.calc.calc({ x: u - 1, y: 1 });
|
|
2511
2511
|
const f = 50, p = this.calc.getCorner() === "bottom" ? o.height - 1 : 1, x = this.calc.getCorner() === "bottom" ? o.height - f : f;
|
|
2512
2512
|
this.animateFlippingTo({ x: u - 1, y: p }, { x: u - f, y: x }, !1, !1);
|
|
2513
|
-
} else this.do(this.render.convertToPage(
|
|
2513
|
+
} else this.do(this.render.convertToPage(s));
|
|
2514
2514
|
else this.setState("read"), this.render.finishAnimation(), this.stopMove();
|
|
2515
2515
|
}
|
|
2516
|
-
animateFlippingTo(
|
|
2517
|
-
const p = c.GetCordsFromTwoPoint(
|
|
2516
|
+
animateFlippingTo(s, o, u, f = !0) {
|
|
2517
|
+
const p = c.GetCordsFromTwoPoint(s, o), x = [];
|
|
2518
2518
|
for (const M of p) x.push(() => this.do(M));
|
|
2519
2519
|
const T = this.getAnimationDuration(p.length);
|
|
2520
2520
|
this.render.startAnimation(x, T, () => {
|
|
@@ -2527,22 +2527,22 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2527
2527
|
getState() {
|
|
2528
2528
|
return this.state;
|
|
2529
2529
|
}
|
|
2530
|
-
setState(
|
|
2531
|
-
this.state !==
|
|
2530
|
+
setState(s) {
|
|
2531
|
+
this.state !== s && (this.app.updateState(s), this.state = s);
|
|
2532
2532
|
}
|
|
2533
|
-
getDirectionByPoint(
|
|
2533
|
+
getDirectionByPoint(s) {
|
|
2534
2534
|
const o = this.getBoundsRect();
|
|
2535
2535
|
if (this.render.getOrientation() === "portrait") {
|
|
2536
|
-
if (
|
|
2537
|
-
} else if (
|
|
2536
|
+
if (s.x - o.pageWidth <= o.width / 5) return 1;
|
|
2537
|
+
} else if (s.x < o.width / 2) return 1;
|
|
2538
2538
|
return 0;
|
|
2539
2539
|
}
|
|
2540
|
-
getAnimationDuration(
|
|
2540
|
+
getAnimationDuration(s) {
|
|
2541
2541
|
const o = this.app.getSettings().flippingTime;
|
|
2542
|
-
return
|
|
2542
|
+
return s >= 1e3 ? o : s / 1e3 * o;
|
|
2543
2543
|
}
|
|
2544
|
-
checkDirection(
|
|
2545
|
-
return
|
|
2544
|
+
checkDirection(s) {
|
|
2545
|
+
return s === 0 ? this.app.getCurrentPageIndex() < this.app.getPageCount() - 1 : this.app.getCurrentPageIndex() >= 1;
|
|
2546
2546
|
}
|
|
2547
2547
|
reset() {
|
|
2548
2548
|
this.calc = null, this.flippingPage = null, this.bottomPage = null;
|
|
@@ -2550,56 +2550,56 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2550
2550
|
getBoundsRect() {
|
|
2551
2551
|
return this.render.getRect();
|
|
2552
2552
|
}
|
|
2553
|
-
checkState(...
|
|
2554
|
-
for (const o of
|
|
2553
|
+
checkState(...s) {
|
|
2554
|
+
for (const o of s) if (this.state === o) return !0;
|
|
2555
2555
|
return !1;
|
|
2556
2556
|
}
|
|
2557
|
-
isPointOnCorners(
|
|
2558
|
-
const o = this.getBoundsRect(), u = o.pageWidth, f = Math.sqrt(Math.pow(u, 2) + Math.pow(o.height, 2)) / 5, p = this.render.convertToBook(
|
|
2557
|
+
isPointOnCorners(s) {
|
|
2558
|
+
const o = this.getBoundsRect(), u = o.pageWidth, f = Math.sqrt(Math.pow(u, 2) + Math.pow(o.height, 2)) / 5, p = this.render.convertToBook(s);
|
|
2559
2559
|
return p.x > 0 && p.y > 0 && p.x < o.width && p.y < o.height && (p.x < f || p.x > o.width - f) && (p.y < f || p.y > o.height - f);
|
|
2560
2560
|
}
|
|
2561
2561
|
}
|
|
2562
2562
|
class m {
|
|
2563
|
-
constructor(
|
|
2564
|
-
this.leftPage = null, this.rightPage = null, this.flippingPage = null, this.bottomPage = null, this.direction = null, this.orientation = null, this.shadow = null, this.animation = null, this.pageRect = null, this.boundsRect = null, this.timer = 0, this.safari = !1, this.setting = o, this.app =
|
|
2563
|
+
constructor(s, o) {
|
|
2564
|
+
this.leftPage = null, this.rightPage = null, this.flippingPage = null, this.bottomPage = null, this.direction = null, this.orientation = null, this.shadow = null, this.animation = null, this.pageRect = null, this.boundsRect = null, this.timer = 0, this.safari = !1, this.setting = o, this.app = s;
|
|
2565
2565
|
const u = new RegExp("Version\\/[\\d\\.]+.*Safari/");
|
|
2566
2566
|
this.safari = u.exec(window.navigator.userAgent) !== null;
|
|
2567
2567
|
}
|
|
2568
|
-
render(
|
|
2568
|
+
render(s) {
|
|
2569
2569
|
if (this.animation !== null) {
|
|
2570
|
-
const o = Math.round((
|
|
2570
|
+
const o = Math.round((s - this.animation.startedAt) / this.animation.durationFrame);
|
|
2571
2571
|
o < this.animation.frames.length ? this.animation.frames[o]() : (this.animation.onAnimateEnd(), this.animation = null);
|
|
2572
2572
|
}
|
|
2573
|
-
this.timer =
|
|
2573
|
+
this.timer = s, this.drawFrame();
|
|
2574
2574
|
}
|
|
2575
2575
|
start() {
|
|
2576
2576
|
this.update();
|
|
2577
|
-
const
|
|
2578
|
-
this.render(o), requestAnimationFrame(
|
|
2577
|
+
const s = (o) => {
|
|
2578
|
+
this.render(o), requestAnimationFrame(s);
|
|
2579
2579
|
};
|
|
2580
|
-
requestAnimationFrame(
|
|
2580
|
+
requestAnimationFrame(s);
|
|
2581
2581
|
}
|
|
2582
|
-
startAnimation(
|
|
2583
|
-
this.finishAnimation(), this.animation = { frames:
|
|
2582
|
+
startAnimation(s, o, u) {
|
|
2583
|
+
this.finishAnimation(), this.animation = { frames: s, duration: o, durationFrame: o / s.length, onAnimateEnd: u, startedAt: this.timer };
|
|
2584
2584
|
}
|
|
2585
2585
|
finishAnimation() {
|
|
2586
2586
|
this.animation !== null && (this.animation.frames[this.animation.frames.length - 1](), this.animation.onAnimateEnd !== null && this.animation.onAnimateEnd()), this.animation = null;
|
|
2587
2587
|
}
|
|
2588
2588
|
update() {
|
|
2589
2589
|
this.boundsRect = null;
|
|
2590
|
-
const
|
|
2591
|
-
this.orientation !==
|
|
2590
|
+
const s = this.calculateBoundsRect();
|
|
2591
|
+
this.orientation !== s && (this.orientation = s, this.app.updateOrientation(s));
|
|
2592
2592
|
}
|
|
2593
2593
|
calculateBoundsRect() {
|
|
2594
|
-
let
|
|
2594
|
+
let s = "landscape";
|
|
2595
2595
|
const o = this.getBlockWidth(), u = o / 2, f = this.getBlockHeight() / 2, p = this.setting.width / this.setting.height;
|
|
2596
2596
|
let x = this.setting.width, T = this.setting.height, M = u - x;
|
|
2597
|
-
return this.setting.size === "stretch" ? (o < 2 * this.setting.minWidth && this.app.getSettings().usePortrait && (
|
|
2597
|
+
return this.setting.size === "stretch" ? (o < 2 * this.setting.minWidth && this.app.getSettings().usePortrait && (s = "portrait"), x = s === "portrait" ? this.getBlockWidth() : this.getBlockWidth() / 2, x > this.setting.maxWidth && (x = this.setting.maxWidth), T = x / p, T > this.getBlockHeight() && (T = this.getBlockHeight(), x = T * p), M = s === "portrait" ? u - x / 2 - x : u - x) : o < 2 * x && this.app.getSettings().usePortrait && (s = "portrait", M = u - x / 2 - x), this.boundsRect = { left: M, top: f - T / 2, width: 2 * x, height: T, pageWidth: x }, s;
|
|
2598
2598
|
}
|
|
2599
|
-
setShadowData(
|
|
2599
|
+
setShadowData(s, o, u, f) {
|
|
2600
2600
|
if (!this.app.getSettings().drawShadow) return;
|
|
2601
2601
|
const p = 100 * this.getSettings().maxShadowOpacity;
|
|
2602
|
-
this.shadow = { pos:
|
|
2602
|
+
this.shadow = { pos: s, angle: o, width: 3 * this.getRect().pageWidth / 4 * u / 100, opacity: (100 - u) * p / 100 / 100, direction: f, progress: 2 * u };
|
|
2603
2603
|
}
|
|
2604
2604
|
clearShadow() {
|
|
2605
2605
|
this.shadow = null;
|
|
@@ -2622,48 +2622,48 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2622
2622
|
getOrientation() {
|
|
2623
2623
|
return this.orientation;
|
|
2624
2624
|
}
|
|
2625
|
-
setPageRect(
|
|
2626
|
-
this.pageRect =
|
|
2625
|
+
setPageRect(s) {
|
|
2626
|
+
this.pageRect = s;
|
|
2627
2627
|
}
|
|
2628
|
-
setDirection(
|
|
2629
|
-
this.direction =
|
|
2628
|
+
setDirection(s) {
|
|
2629
|
+
this.direction = s;
|
|
2630
2630
|
}
|
|
2631
|
-
setRightPage(
|
|
2632
|
-
|
|
2631
|
+
setRightPage(s) {
|
|
2632
|
+
s !== null && s.setOrientation(1), this.rightPage = s;
|
|
2633
2633
|
}
|
|
2634
|
-
setLeftPage(
|
|
2635
|
-
|
|
2634
|
+
setLeftPage(s) {
|
|
2635
|
+
s !== null && s.setOrientation(0), this.leftPage = s;
|
|
2636
2636
|
}
|
|
2637
|
-
setBottomPage(
|
|
2638
|
-
|
|
2637
|
+
setBottomPage(s) {
|
|
2638
|
+
s !== null && s.setOrientation(this.direction === 1 ? 0 : 1), this.bottomPage = s;
|
|
2639
2639
|
}
|
|
2640
|
-
setFlippingPage(
|
|
2641
|
-
|
|
2640
|
+
setFlippingPage(s) {
|
|
2641
|
+
s !== null && s.setOrientation(this.direction === 0 && this.orientation !== "portrait" ? 0 : 1), this.flippingPage = s;
|
|
2642
2642
|
}
|
|
2643
|
-
convertToBook(
|
|
2643
|
+
convertToBook(s) {
|
|
2644
2644
|
const o = this.getRect();
|
|
2645
|
-
return { x:
|
|
2645
|
+
return { x: s.x - o.left, y: s.y - o.top };
|
|
2646
2646
|
}
|
|
2647
2647
|
isSafari() {
|
|
2648
2648
|
return this.safari;
|
|
2649
2649
|
}
|
|
2650
|
-
convertToPage(
|
|
2650
|
+
convertToPage(s, o) {
|
|
2651
2651
|
o || (o = this.direction);
|
|
2652
2652
|
const u = this.getRect();
|
|
2653
|
-
return { x: o === 0 ?
|
|
2653
|
+
return { x: o === 0 ? s.x - u.left - u.width / 2 : u.width / 2 - s.x + u.left, y: s.y - u.top };
|
|
2654
2654
|
}
|
|
2655
|
-
convertToGlobal(
|
|
2656
|
-
if (o || (o = this.direction),
|
|
2655
|
+
convertToGlobal(s, o) {
|
|
2656
|
+
if (o || (o = this.direction), s == null) return null;
|
|
2657
2657
|
const u = this.getRect();
|
|
2658
|
-
return { x: o === 0 ?
|
|
2658
|
+
return { x: o === 0 ? s.x + u.left + u.width / 2 : u.width / 2 - s.x + u.left, y: s.y + u.top };
|
|
2659
2659
|
}
|
|
2660
|
-
convertRectToGlobal(
|
|
2661
|
-
return o || (o = this.direction), { topLeft: this.convertToGlobal(
|
|
2660
|
+
convertRectToGlobal(s, o) {
|
|
2661
|
+
return o || (o = this.direction), { topLeft: this.convertToGlobal(s.topLeft, o), topRight: this.convertToGlobal(s.topRight, o), bottomLeft: this.convertToGlobal(s.bottomLeft, o), bottomRight: this.convertToGlobal(s.bottomRight, o) };
|
|
2662
2662
|
}
|
|
2663
2663
|
}
|
|
2664
2664
|
class w extends m {
|
|
2665
|
-
constructor(
|
|
2666
|
-
super(
|
|
2665
|
+
constructor(s, o, u) {
|
|
2666
|
+
super(s, o), this.canvas = u, this.ctx = u.getContext("2d");
|
|
2667
2667
|
}
|
|
2668
2668
|
getContext() {
|
|
2669
2669
|
return this.ctx;
|
|
@@ -2672,41 +2672,41 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2672
2672
|
}
|
|
2673
2673
|
drawFrame() {
|
|
2674
2674
|
this.clear(), this.orientation !== "portrait" && this.leftPage != null && this.leftPage.simpleDraw(0), this.rightPage != null && this.rightPage.simpleDraw(1), this.bottomPage != null && this.bottomPage.draw(), this.drawBookShadow(), this.flippingPage != null && this.flippingPage.draw(), this.shadow != null && (this.drawOuterShadow(), this.drawInnerShadow());
|
|
2675
|
-
const
|
|
2676
|
-
this.orientation === "portrait" && (this.ctx.beginPath(), this.ctx.rect(
|
|
2675
|
+
const s = this.getRect();
|
|
2676
|
+
this.orientation === "portrait" && (this.ctx.beginPath(), this.ctx.rect(s.left + s.pageWidth, s.top, s.width, s.height), this.ctx.clip());
|
|
2677
2677
|
}
|
|
2678
2678
|
drawBookShadow() {
|
|
2679
|
-
const
|
|
2679
|
+
const s = this.getRect();
|
|
2680
2680
|
this.ctx.save(), this.ctx.beginPath();
|
|
2681
|
-
const o =
|
|
2682
|
-
this.ctx.rect(
|
|
2683
|
-
const u = { x:
|
|
2681
|
+
const o = s.width / 20;
|
|
2682
|
+
this.ctx.rect(s.left, s.top, s.width, s.height);
|
|
2683
|
+
const u = { x: s.left + s.width / 2 - o / 2, y: 0 };
|
|
2684
2684
|
this.ctx.translate(u.x, u.y);
|
|
2685
2685
|
const f = this.ctx.createLinearGradient(0, 0, o, 0);
|
|
2686
|
-
f.addColorStop(0, "rgba(0, 0, 0, 0)"), f.addColorStop(0.4, "rgba(0, 0, 0, 0.2)"), f.addColorStop(0.49, "rgba(0, 0, 0, 0.1)"), f.addColorStop(0.5, "rgba(0, 0, 0, 0.5)"), f.addColorStop(0.51, "rgba(0, 0, 0, 0.4)"), f.addColorStop(1, "rgba(0, 0, 0, 0)"), this.ctx.clip(), this.ctx.fillStyle = f, this.ctx.fillRect(0, 0, o, 2 *
|
|
2686
|
+
f.addColorStop(0, "rgba(0, 0, 0, 0)"), f.addColorStop(0.4, "rgba(0, 0, 0, 0.2)"), f.addColorStop(0.49, "rgba(0, 0, 0, 0.1)"), f.addColorStop(0.5, "rgba(0, 0, 0, 0.5)"), f.addColorStop(0.51, "rgba(0, 0, 0, 0.4)"), f.addColorStop(1, "rgba(0, 0, 0, 0)"), this.ctx.clip(), this.ctx.fillStyle = f, this.ctx.fillRect(0, 0, o, 2 * s.height), this.ctx.restore();
|
|
2687
2687
|
}
|
|
2688
2688
|
drawOuterShadow() {
|
|
2689
|
-
const
|
|
2690
|
-
this.ctx.save(), this.ctx.beginPath(), this.ctx.rect(
|
|
2689
|
+
const s = this.getRect();
|
|
2690
|
+
this.ctx.save(), this.ctx.beginPath(), this.ctx.rect(s.left, s.top, s.width, s.height);
|
|
2691
2691
|
const o = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y });
|
|
2692
2692
|
this.ctx.translate(o.x, o.y), this.ctx.rotate(Math.PI + this.shadow.angle + Math.PI / 2);
|
|
2693
2693
|
const u = this.ctx.createLinearGradient(0, 0, this.shadow.width, 0);
|
|
2694
|
-
this.shadow.direction === 0 ? (this.ctx.translate(0, -100), u.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), u.addColorStop(1, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(-this.shadow.width, -100), u.addColorStop(0, "rgba(0, 0, 0, 0)"), u.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")")), this.ctx.clip(), this.ctx.fillStyle = u, this.ctx.fillRect(0, 0, this.shadow.width, 2 *
|
|
2694
|
+
this.shadow.direction === 0 ? (this.ctx.translate(0, -100), u.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), u.addColorStop(1, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(-this.shadow.width, -100), u.addColorStop(0, "rgba(0, 0, 0, 0)"), u.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")")), this.ctx.clip(), this.ctx.fillStyle = u, this.ctx.fillRect(0, 0, this.shadow.width, 2 * s.height), this.ctx.restore();
|
|
2695
2695
|
}
|
|
2696
2696
|
drawInnerShadow() {
|
|
2697
|
-
const
|
|
2697
|
+
const s = this.getRect();
|
|
2698
2698
|
this.ctx.save(), this.ctx.beginPath();
|
|
2699
2699
|
const o = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y }), u = this.convertRectToGlobal(this.pageRect);
|
|
2700
2700
|
this.ctx.moveTo(u.topLeft.x, u.topLeft.y), this.ctx.lineTo(u.topRight.x, u.topRight.y), this.ctx.lineTo(u.bottomRight.x, u.bottomRight.y), this.ctx.lineTo(u.bottomLeft.x, u.bottomLeft.y), this.ctx.translate(o.x, o.y), this.ctx.rotate(Math.PI + this.shadow.angle + Math.PI / 2);
|
|
2701
2701
|
const f = 3 * this.shadow.width / 4, p = this.ctx.createLinearGradient(0, 0, f, 0);
|
|
2702
|
-
this.shadow.direction === 0 ? (this.ctx.translate(-f, -100), p.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), p.addColorStop(0.9, "rgba(0, 0, 0, 0.05)"), p.addColorStop(0.7, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), p.addColorStop(0, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(0, -100), p.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), p.addColorStop(0.1, "rgba(0, 0, 0, 0.05)"), p.addColorStop(0.3, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), p.addColorStop(1, "rgba(0, 0, 0, 0)")), this.ctx.clip(), this.ctx.fillStyle = p, this.ctx.fillRect(0, 0, f, 2 *
|
|
2702
|
+
this.shadow.direction === 0 ? (this.ctx.translate(-f, -100), p.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), p.addColorStop(0.9, "rgba(0, 0, 0, 0.05)"), p.addColorStop(0.7, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), p.addColorStop(0, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(0, -100), p.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), p.addColorStop(0.1, "rgba(0, 0, 0, 0.05)"), p.addColorStop(0.3, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), p.addColorStop(1, "rgba(0, 0, 0, 0)")), this.ctx.clip(), this.ctx.fillStyle = p, this.ctx.fillRect(0, 0, f, 2 * s.height), this.ctx.restore();
|
|
2703
2703
|
}
|
|
2704
2704
|
clear() {
|
|
2705
2705
|
this.ctx.fillStyle = "white", this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2706
2706
|
}
|
|
2707
2707
|
}
|
|
2708
2708
|
class b {
|
|
2709
|
-
constructor(
|
|
2709
|
+
constructor(s, o, u) {
|
|
2710
2710
|
this.touchPoint = null, this.swipeTimeout = 250, this.onResize = () => {
|
|
2711
2711
|
this.update();
|
|
2712
2712
|
}, this.onMouseDown = (p) => {
|
|
@@ -2742,9 +2742,9 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2742
2742
|
}
|
|
2743
2743
|
this.app.userStop(T, M);
|
|
2744
2744
|
}
|
|
2745
|
-
}, this.parentElement =
|
|
2745
|
+
}, this.parentElement = s, s.classList.add("stf__parent"), s.insertAdjacentHTML("afterbegin", '<div class="stf__wrapper"></div>'), this.wrapper = s.querySelector(".stf__wrapper"), this.app = o;
|
|
2746
2746
|
const f = this.app.getSettings().usePortrait ? 1 : 2;
|
|
2747
|
-
|
|
2747
|
+
s.style.minWidth = u.minWidth * f + "px", s.style.minHeight = u.minHeight + "px", u.size === "fixed" && (s.style.minWidth = u.width * f + "px", s.style.minHeight = u.height + "px"), u.autoSize && (s.style.width = "100%", s.style.maxWidth = 2 * u.maxWidth + "px"), s.style.display = "block", window.addEventListener("resize", this.onResize, !1), this.swipeDistance = u.swipeDistance;
|
|
2748
2748
|
}
|
|
2749
2749
|
destroy() {
|
|
2750
2750
|
this.app.getSettings().useMouseEvents && this.removeHandlers(), this.distElement.remove(), this.wrapper.remove();
|
|
@@ -2755,8 +2755,8 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2755
2755
|
getWrapper() {
|
|
2756
2756
|
return this.wrapper;
|
|
2757
2757
|
}
|
|
2758
|
-
setOrientationStyle(
|
|
2759
|
-
this.wrapper.classList.remove("--portrait", "--landscape"),
|
|
2758
|
+
setOrientationStyle(s) {
|
|
2759
|
+
this.wrapper.classList.remove("--portrait", "--landscape"), s === "portrait" ? (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / this.app.getSettings().width * 100 + "%"), this.wrapper.classList.add("--portrait")) : (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / (2 * this.app.getSettings().width) * 100 + "%"), this.wrapper.classList.add("--landscape")), this.update();
|
|
2760
2760
|
}
|
|
2761
2761
|
removeHandlers() {
|
|
2762
2762
|
window.removeEventListener("resize", this.onResize), this.distElement.removeEventListener("mousedown", this.onMouseDown), this.distElement.removeEventListener("touchstart", this.onTouchStart), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("touchend", this.onTouchEnd);
|
|
@@ -2764,38 +2764,38 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2764
2764
|
setHandlers() {
|
|
2765
2765
|
window.addEventListener("resize", this.onResize, !1), this.app.getSettings().useMouseEvents && (this.distElement.addEventListener("mousedown", this.onMouseDown), this.distElement.addEventListener("touchstart", this.onTouchStart), window.addEventListener("mousemove", this.onMouseMove), window.addEventListener("touchmove", this.onTouchMove, { passive: !this.app.getSettings().mobileScrollSupport }), window.addEventListener("mouseup", this.onMouseUp), window.addEventListener("touchend", this.onTouchEnd));
|
|
2766
2766
|
}
|
|
2767
|
-
getMousePos(
|
|
2767
|
+
getMousePos(s, o) {
|
|
2768
2768
|
const u = this.distElement.getBoundingClientRect();
|
|
2769
|
-
return { x:
|
|
2769
|
+
return { x: s - u.left, y: o - u.top };
|
|
2770
2770
|
}
|
|
2771
|
-
checkTarget(
|
|
2772
|
-
return !this.app.getSettings().clickEventForward || !["a", "button"].includes(
|
|
2771
|
+
checkTarget(s) {
|
|
2772
|
+
return !this.app.getSettings().clickEventForward || !["a", "button"].includes(s.tagName.toLowerCase());
|
|
2773
2773
|
}
|
|
2774
2774
|
}
|
|
2775
2775
|
class P extends b {
|
|
2776
|
-
constructor(
|
|
2777
|
-
super(
|
|
2776
|
+
constructor(s, o, u, f) {
|
|
2777
|
+
super(s, o, u), this.wrapper.insertAdjacentHTML("afterbegin", '<div class="stf__block"></div>'), this.distElement = s.querySelector(".stf__block"), this.items = f;
|
|
2778
2778
|
for (const p of f) this.distElement.appendChild(p);
|
|
2779
2779
|
this.setHandlers();
|
|
2780
2780
|
}
|
|
2781
2781
|
clear() {
|
|
2782
|
-
for (const
|
|
2782
|
+
for (const s of this.items) this.parentElement.appendChild(s);
|
|
2783
2783
|
}
|
|
2784
|
-
updateItems(
|
|
2784
|
+
updateItems(s) {
|
|
2785
2785
|
this.removeHandlers(), this.distElement.innerHTML = "";
|
|
2786
|
-
for (const o of
|
|
2787
|
-
this.items =
|
|
2786
|
+
for (const o of s) this.distElement.appendChild(o);
|
|
2787
|
+
this.items = s, this.setHandlers();
|
|
2788
2788
|
}
|
|
2789
2789
|
update() {
|
|
2790
2790
|
this.app.getRender().update();
|
|
2791
2791
|
}
|
|
2792
2792
|
}
|
|
2793
2793
|
class E extends b {
|
|
2794
|
-
constructor(
|
|
2795
|
-
super(
|
|
2794
|
+
constructor(s, o, u) {
|
|
2795
|
+
super(s, o, u), this.wrapper.innerHTML = '<canvas class="stf__canvas"></canvas>', this.canvas = s.querySelectorAll("canvas")[0], this.distElement = this.canvas, this.resizeCanvas(), this.setHandlers();
|
|
2796
2796
|
}
|
|
2797
2797
|
resizeCanvas() {
|
|
2798
|
-
const
|
|
2798
|
+
const s = getComputedStyle(this.canvas), o = parseInt(s.getPropertyValue("width"), 10), u = parseInt(s.getPropertyValue("height"), 10);
|
|
2799
2799
|
this.canvas.width = o, this.canvas.height = u;
|
|
2800
2800
|
}
|
|
2801
2801
|
getCanvas() {
|
|
@@ -2806,8 +2806,8 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2806
2806
|
}
|
|
2807
2807
|
}
|
|
2808
2808
|
class I extends m {
|
|
2809
|
-
constructor(
|
|
2810
|
-
super(
|
|
2809
|
+
constructor(s, o, u) {
|
|
2810
|
+
super(s, o), this.outerShadow = null, this.innerShadow = null, this.hardShadow = null, this.hardInnerShadow = null, this.element = u, this.createShadows();
|
|
2811
2811
|
}
|
|
2812
2812
|
createShadows() {
|
|
2813
2813
|
this.element.insertAdjacentHTML("beforeend", `<div class="stf__outerShadow"></div>
|
|
@@ -2822,39 +2822,39 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2822
2822
|
this.element.querySelector(".stf__outerShadow") || this.createShadows();
|
|
2823
2823
|
}
|
|
2824
2824
|
drawHardInnerShadow() {
|
|
2825
|
-
const
|
|
2826
|
-
let u = (100 - o) * (2.5 *
|
|
2827
|
-
u >
|
|
2825
|
+
const s = this.getRect(), o = this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress;
|
|
2826
|
+
let u = (100 - o) * (2.5 * s.pageWidth) / 100 + 20;
|
|
2827
|
+
u > s.pageWidth && (u = s.pageWidth);
|
|
2828
2828
|
let f = `
|
|
2829
2829
|
display: block;
|
|
2830
2830
|
z-index: ${(this.getSettings().startZIndex + 5).toString(10)};
|
|
2831
2831
|
width: ${u}px;
|
|
2832
|
-
height: ${
|
|
2832
|
+
height: ${s.height}px;
|
|
2833
2833
|
background: linear-gradient(to right,
|
|
2834
2834
|
rgba(0, 0, 0, ${this.shadow.opacity * o / 100}) 5%,
|
|
2835
2835
|
rgba(0, 0, 0, 0) 100%);
|
|
2836
|
-
left: ${
|
|
2836
|
+
left: ${s.left + s.width / 2}px;
|
|
2837
2837
|
transform-origin: 0 0;
|
|
2838
2838
|
`;
|
|
2839
2839
|
f += this.getDirection() === 0 && this.shadow.progress > 100 || this.getDirection() === 1 && this.shadow.progress <= 100 ? "transform: translate3d(0, 0, 0);" : "transform: translate3d(0, 0, 0) rotateY(180deg);", this.hardInnerShadow.style.cssText = f;
|
|
2840
2840
|
}
|
|
2841
2841
|
drawHardOuterShadow() {
|
|
2842
|
-
const
|
|
2843
|
-
let o = (100 - (this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress)) * (2.5 *
|
|
2844
|
-
o >
|
|
2842
|
+
const s = this.getRect();
|
|
2843
|
+
let o = (100 - (this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress)) * (2.5 * s.pageWidth) / 100 + 20;
|
|
2844
|
+
o > s.pageWidth && (o = s.pageWidth);
|
|
2845
2845
|
let u = `
|
|
2846
2846
|
display: block;
|
|
2847
2847
|
z-index: ${(this.getSettings().startZIndex + 4).toString(10)};
|
|
2848
2848
|
width: ${o}px;
|
|
2849
|
-
height: ${
|
|
2849
|
+
height: ${s.height}px;
|
|
2850
2850
|
background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);
|
|
2851
|
-
left: ${
|
|
2851
|
+
left: ${s.left + s.width / 2}px;
|
|
2852
2852
|
transform-origin: 0 0;
|
|
2853
2853
|
`;
|
|
2854
2854
|
u += this.getDirection() === 0 && this.shadow.progress > 100 || this.getDirection() === 1 && this.shadow.progress <= 100 ? "transform: translate3d(0, 0, 0) rotateY(180deg);" : "transform: translate3d(0, 0, 0);", this.hardShadow.style.cssText = u;
|
|
2855
2855
|
}
|
|
2856
2856
|
drawInnerShadow() {
|
|
2857
|
-
const
|
|
2857
|
+
const s = this.getRect(), o = 3 * this.shadow.width / 4, u = this.getDirection() === 0 ? o : 0, f = this.getDirection() === 0 ? "to left" : "to right", p = this.convertToGlobal(this.shadow.pos), x = this.shadow.angle + 3 * Math.PI / 2, T = [this.pageRect.topLeft, this.pageRect.topRight, this.pageRect.bottomRight, this.pageRect.bottomLeft];
|
|
2858
2858
|
let M = "polygon( ";
|
|
2859
2859
|
for (const z of T) {
|
|
2860
2860
|
let B = this.getDirection() === 1 ? { x: -z.x + this.shadow.pos.x, y: z.y - this.shadow.pos.y } : { x: z.x - this.shadow.pos.x, y: z.y - this.shadow.pos.y };
|
|
@@ -2865,7 +2865,7 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2865
2865
|
display: block;
|
|
2866
2866
|
z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
|
|
2867
2867
|
width: ${o}px;
|
|
2868
|
-
height: ${2 *
|
|
2868
|
+
height: ${2 * s.height}px;
|
|
2869
2869
|
background: linear-gradient(${f},
|
|
2870
2870
|
rgba(0, 0, 0, ${this.shadow.opacity}) 5%,
|
|
2871
2871
|
rgba(0, 0, 0, 0.05) 15%,
|
|
@@ -2879,7 +2879,7 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2879
2879
|
this.innerShadow.style.cssText = L;
|
|
2880
2880
|
}
|
|
2881
2881
|
drawOuterShadow() {
|
|
2882
|
-
const
|
|
2882
|
+
const s = this.getRect(), o = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y }), u = this.shadow.angle + 3 * Math.PI / 2, f = this.getDirection() === 1 ? this.shadow.width : 0, p = this.getDirection() === 0 ? "to right" : "to left", x = [{ x: 0, y: 0 }, { x: s.pageWidth, y: 0 }, { x: s.pageWidth, y: s.height }, { x: 0, y: s.height }];
|
|
2883
2883
|
let T = "polygon( ";
|
|
2884
2884
|
for (const L of x) if (L !== null) {
|
|
2885
2885
|
let z = this.getDirection() === 1 ? { x: -L.x + this.shadow.pos.x, y: L.y - this.shadow.pos.y } : { x: L.x - this.shadow.pos.x, y: L.y - this.shadow.pos.y };
|
|
@@ -2890,7 +2890,7 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2890
2890
|
display: block;
|
|
2891
2891
|
z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
|
|
2892
2892
|
width: ${this.shadow.width}px;
|
|
2893
|
-
height: ${2 *
|
|
2893
|
+
height: ${2 * s.height}px;
|
|
2894
2894
|
background: linear-gradient(${p}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));
|
|
2895
2895
|
transform-origin: ${f}px 100px;
|
|
2896
2896
|
transform: translate3d(${o.x - f}px, ${o.y - 100}px, 0) rotate(${u}rad);
|
|
@@ -2907,14 +2907,14 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2907
2907
|
}
|
|
2908
2908
|
drawBottomPage() {
|
|
2909
2909
|
if (this.bottomPage === null) return;
|
|
2910
|
-
const
|
|
2911
|
-
this.orientation === "portrait" && this.direction === 1 || (this.bottomPage.getElement().style.zIndex = (this.getSettings().startZIndex + 3).toString(10), this.bottomPage.draw(
|
|
2910
|
+
const s = this.flippingPage != null ? this.flippingPage.getDrawingDensity() : null;
|
|
2911
|
+
this.orientation === "portrait" && this.direction === 1 || (this.bottomPage.getElement().style.zIndex = (this.getSettings().startZIndex + 3).toString(10), this.bottomPage.draw(s));
|
|
2912
2912
|
}
|
|
2913
2913
|
drawFrame() {
|
|
2914
2914
|
this.clear(), this.drawLeftPage(), this.drawRightPage(), this.drawBottomPage(), this.flippingPage != null && (this.flippingPage.getElement().style.zIndex = (this.getSettings().startZIndex + 5).toString(10), this.flippingPage.draw()), this.shadow != null && this.flippingPage !== null && (this.flippingPage.getDrawingDensity() === "soft" ? (this.drawOuterShadow(), this.drawInnerShadow()) : (this.drawHardOuterShadow(), this.drawHardInnerShadow()));
|
|
2915
2915
|
}
|
|
2916
2916
|
clear() {
|
|
2917
|
-
for (const
|
|
2917
|
+
for (const s of this.app.getPageCollection().getPages()) s !== this.leftPage && s !== this.rightPage && s !== this.flippingPage && s !== this.bottomPage && (s.getElement().style.cssText = "display: none"), s.getTemporaryCopy() !== this.flippingPage && s.hideTemporaryCopy();
|
|
2918
2918
|
}
|
|
2919
2919
|
update() {
|
|
2920
2920
|
super.update(), this.rightPage !== null && this.rightPage.setOrientation(1), this.leftPage !== null && this.leftPage.setOrientation(0);
|
|
@@ -2924,17 +2924,17 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2924
2924
|
constructor() {
|
|
2925
2925
|
this._default = { startPage: 0, size: "fixed", width: 0, height: 0, minWidth: 0, maxWidth: 0, minHeight: 0, maxHeight: 0, drawShadow: !0, flippingTime: 1e3, usePortrait: !0, startZIndex: 0, autoSize: !0, maxShadowOpacity: 1, showCover: !1, mobileScrollSupport: !0, swipeDistance: 30, clickEventForward: !0, useMouseEvents: !0, showPageCorners: !0, disableFlipByClick: !1 };
|
|
2926
2926
|
}
|
|
2927
|
-
getSettings(
|
|
2927
|
+
getSettings(s) {
|
|
2928
2928
|
const o = this._default;
|
|
2929
|
-
if (Object.assign(o,
|
|
2929
|
+
if (Object.assign(o, s), o.size !== "stretch" && o.size !== "fixed") throw new Error('Invalid size type. Available only "fixed" and "stretch" value');
|
|
2930
2930
|
if (o.width <= 0 || o.height <= 0) throw new Error("Invalid width or height");
|
|
2931
2931
|
if (o.flippingTime <= 0) throw new Error("Invalid flipping time");
|
|
2932
2932
|
return o.size === "stretch" ? (o.minWidth <= 0 && (o.minWidth = 100), o.maxWidth < o.minWidth && (o.maxWidth = 2e3), o.minHeight <= 0 && (o.minHeight = 100), o.maxHeight < o.minHeight && (o.maxHeight = 2e3)) : (o.minWidth = o.width, o.maxWidth = o.width, o.minHeight = o.height, o.maxHeight = o.height), o;
|
|
2933
2933
|
}
|
|
2934
2934
|
}
|
|
2935
|
-
(function(k,
|
|
2936
|
-
|
|
2937
|
-
var o =
|
|
2935
|
+
(function(k, s) {
|
|
2936
|
+
s === void 0 && (s = {});
|
|
2937
|
+
var o = s.insertAt;
|
|
2938
2938
|
if (typeof document < "u") {
|
|
2939
2939
|
var u = document.head || document.getElementsByTagName("head")[0], f = document.createElement("style");
|
|
2940
2940
|
f.type = "text/css", o === "top" && u.firstChild ? u.insertBefore(f, u.firstChild) : u.appendChild(f), f.styleSheet ? f.styleSheet.cssText = k : f.appendChild(document.createTextNode(k));
|
|
@@ -3003,18 +3003,18 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
3003
3003
|
constructor() {
|
|
3004
3004
|
this.events = /* @__PURE__ */ new Map();
|
|
3005
3005
|
}
|
|
3006
|
-
on(k,
|
|
3007
|
-
return this.events.has(k) ? this.events.get(k).push(
|
|
3006
|
+
on(k, s) {
|
|
3007
|
+
return this.events.has(k) ? this.events.get(k).push(s) : this.events.set(k, [s]), this;
|
|
3008
3008
|
}
|
|
3009
3009
|
off(k) {
|
|
3010
3010
|
this.events.delete(k);
|
|
3011
3011
|
}
|
|
3012
|
-
trigger(k,
|
|
3013
|
-
if (this.events.has(k)) for (const u of this.events.get(k)) u({ data: o, object:
|
|
3012
|
+
trigger(k, s, o = null) {
|
|
3013
|
+
if (this.events.has(k)) for (const u of this.events.get(k)) u({ data: o, object: s });
|
|
3014
3014
|
}
|
|
3015
3015
|
} {
|
|
3016
|
-
constructor(k,
|
|
3017
|
-
super(), this.isUserTouch = !1, this.isUserMove = !1, this.setting = null, this.pages = null, this.setting = new F().getSettings(
|
|
3016
|
+
constructor(k, s) {
|
|
3017
|
+
super(), this.isUserTouch = !1, this.isUserMove = !1, this.setting = null, this.pages = null, this.setting = new F().getSettings(s), this.block = k;
|
|
3018
3018
|
}
|
|
3019
3019
|
destroy() {
|
|
3020
3020
|
this.ui.destroy(), this.block.remove();
|
|
@@ -3024,8 +3024,8 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
3024
3024
|
}
|
|
3025
3025
|
loadFromImages(k) {
|
|
3026
3026
|
this.ui = new E(this.block, this, this.setting);
|
|
3027
|
-
const
|
|
3028
|
-
this.render = new w(this, this.setting,
|
|
3027
|
+
const s = this.ui.getCanvas();
|
|
3028
|
+
this.render = new w(this, this.setting, s), this.flipController = new S(this.render, this), this.pages = new h(this, this.render, k), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
|
|
3029
3029
|
this.ui.update(), this.trigger("init", this, { page: this.setting.startPage, mode: this.render.getOrientation() });
|
|
3030
3030
|
}, 1);
|
|
3031
3031
|
}
|
|
@@ -3035,12 +3035,12 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
3035
3035
|
}, 1);
|
|
3036
3036
|
}
|
|
3037
3037
|
updateFromImages(k) {
|
|
3038
|
-
const
|
|
3039
|
-
this.pages.destroy(), this.pages = new h(this, this.render, k), this.pages.load(), this.pages.show(
|
|
3038
|
+
const s = this.pages.getCurrentPageIndex();
|
|
3039
|
+
this.pages.destroy(), this.pages = new h(this, this.render, k), this.pages.load(), this.pages.show(s), this.trigger("update", this, { page: s, mode: this.render.getOrientation() });
|
|
3040
3040
|
}
|
|
3041
3041
|
updateFromHtml(k) {
|
|
3042
|
-
const
|
|
3043
|
-
this.pages.destroy(), this.pages = new v(this, this.render, this.ui.getDistElement(), k), this.pages.load(), this.ui.updateItems(k), this.render.reload(), this.pages.show(
|
|
3042
|
+
const s = this.pages.getCurrentPageIndex();
|
|
3043
|
+
this.pages.destroy(), this.pages = new v(this, this.render, this.ui.getDistElement(), k), this.pages.load(), this.ui.updateItems(k), this.render.reload(), this.pages.show(s), this.trigger("update", this, { page: s, mode: this.render.getOrientation() });
|
|
3044
3044
|
}
|
|
3045
3045
|
clear() {
|
|
3046
3046
|
this.pages.destroy(), this.ui.clear();
|
|
@@ -3060,8 +3060,8 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
3060
3060
|
flipPrev(k = "top") {
|
|
3061
3061
|
this.flipController.flipPrev(k);
|
|
3062
3062
|
}
|
|
3063
|
-
flip(k,
|
|
3064
|
-
this.flipController.flipToPage(k,
|
|
3063
|
+
flip(k, s = "top") {
|
|
3064
|
+
this.flipController.flipToPage(k, s);
|
|
3065
3065
|
}
|
|
3066
3066
|
updateState(k) {
|
|
3067
3067
|
this.trigger("changeState", this, k);
|
|
@@ -3108,16 +3108,16 @@ var es = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
3108
3108
|
startUserTouch(k) {
|
|
3109
3109
|
this.mousePosition = k, this.isUserTouch = !0, this.isUserMove = !1;
|
|
3110
3110
|
}
|
|
3111
|
-
userMove(k,
|
|
3112
|
-
this.isUserTouch ||
|
|
3111
|
+
userMove(k, s) {
|
|
3112
|
+
this.isUserTouch || s || !this.setting.showPageCorners ? this.isUserTouch && c.GetDistanceBetweenTwoPoint(this.mousePosition, k) > 5 && (this.isUserMove = !0, this.flipController.fold(k)) : this.flipController.showCorner(k);
|
|
3113
3113
|
}
|
|
3114
|
-
userStop(k,
|
|
3115
|
-
this.isUserTouch && (this.isUserTouch = !1,
|
|
3114
|
+
userStop(k, s = !1) {
|
|
3115
|
+
this.isUserTouch && (this.isUserTouch = !1, s || (this.isUserMove ? this.flipController.stopMove() : this.flipController.flip(k)));
|
|
3116
3116
|
}
|
|
3117
3117
|
}, Object.defineProperty(i, "__esModule", { value: !0 });
|
|
3118
3118
|
});
|
|
3119
3119
|
})(Ve, Ve.exports);
|
|
3120
|
-
var
|
|
3120
|
+
var tn = Ve.exports;
|
|
3121
3121
|
/**
|
|
3122
3122
|
* @license FlipbookEngine v1.0.0
|
|
3123
3123
|
* Copyright (c) 2026 Murat Dogan
|
|
@@ -3132,14 +3132,14 @@ var ts = Ve.exports;
|
|
|
3132
3132
|
* you must purchase a Commercial License from:
|
|
3133
3133
|
* https://flipbookengine.com/pricing
|
|
3134
3134
|
*/
|
|
3135
|
-
function
|
|
3135
|
+
function nn() {
|
|
3136
3136
|
return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
3137
3137
|
}
|
|
3138
|
-
function
|
|
3138
|
+
function sn(t, e = nn()) {
|
|
3139
3139
|
return e ? 0 : typeof t == "number" && t >= 0 ? t : 1e3;
|
|
3140
3140
|
}
|
|
3141
|
-
class
|
|
3142
|
-
constructor(e, i,
|
|
3141
|
+
class an {
|
|
3142
|
+
constructor(e, i, n) {
|
|
3143
3143
|
C(this, "pageFlip", null);
|
|
3144
3144
|
C(this, "bookContainer");
|
|
3145
3145
|
C(this, "options");
|
|
@@ -3150,7 +3150,7 @@ class ns {
|
|
|
3150
3150
|
C(this, "isLibraryFlipping", !1);
|
|
3151
3151
|
C(this, "autoPlayTimer", null);
|
|
3152
3152
|
C(this, "layoutUpdateTimer", null);
|
|
3153
|
-
this.bookContainer = e, this.options = i, this.store =
|
|
3153
|
+
this.bookContainer = e, this.options = i, this.store = n, i.soundUrl && (this.audioEl = new Audio(i.soundUrl), this.unlockAudio());
|
|
3154
3154
|
}
|
|
3155
3155
|
unlockAudio() {
|
|
3156
3156
|
if (!this.audioEl) return;
|
|
@@ -3167,7 +3167,7 @@ class ns {
|
|
|
3167
3167
|
this.audioUnlockHandler = e, document.addEventListener("touchstart", e, { once: !0 }), document.addEventListener("click", e, { once: !0 });
|
|
3168
3168
|
}
|
|
3169
3169
|
init(e, i) {
|
|
3170
|
-
this.pageFlip = new
|
|
3170
|
+
this.pageFlip = new tn.PageFlip(this.bookContainer, {
|
|
3171
3171
|
width: e,
|
|
3172
3172
|
height: i,
|
|
3173
3173
|
size: "stretch",
|
|
@@ -3181,10 +3181,10 @@ class ns {
|
|
|
3181
3181
|
// Keep native mobile scrolling available; this avoids preventDefault on non-cancelable touchstart events.
|
|
3182
3182
|
mobileScrollSupport: !0,
|
|
3183
3183
|
maxShadowOpacity: this.options.maxShadowOpacity || 0.5,
|
|
3184
|
-
flippingTime:
|
|
3184
|
+
flippingTime: sn(this.options.flippingTime)
|
|
3185
3185
|
});
|
|
3186
|
-
const
|
|
3187
|
-
this.pageFlip.loadFromHTML(Array.from(
|
|
3186
|
+
const n = this.bookContainer.querySelectorAll(".bz-page");
|
|
3187
|
+
this.pageFlip.loadFromHTML(Array.from(n)), this.bindEvents(), this.setupSignalSync();
|
|
3188
3188
|
}
|
|
3189
3189
|
bindEvents() {
|
|
3190
3190
|
this.pageFlip.on("flip", (e) => {
|
|
@@ -3197,27 +3197,27 @@ class ns {
|
|
|
3197
3197
|
}
|
|
3198
3198
|
setupSignalSync() {
|
|
3199
3199
|
this.unsubs.push(
|
|
3200
|
-
|
|
3200
|
+
U(() => {
|
|
3201
3201
|
const e = this.store.currentPage.value, i = this.store.flipState.peek();
|
|
3202
3202
|
if (!this.pageFlip || this.isLibraryFlipping || i !== "read") return;
|
|
3203
|
-
const
|
|
3204
|
-
if (
|
|
3205
|
-
const a = (c) => c === 0 ? 0 : Math.ceil(c / 2), r = a(e), h = a(
|
|
3203
|
+
const n = this.pageFlip.getCurrentPageIndex();
|
|
3204
|
+
if (n !== e && !this.store.isSingleMode.value) {
|
|
3205
|
+
const a = (c) => c === 0 ? 0 : Math.ceil(c / 2), r = a(e), h = a(n);
|
|
3206
3206
|
r === h + 1 ? this.pageFlip.flipNext() : r === h - 1 ? this.pageFlip.flipPrev() : r !== h && this.pageFlip.turnToPage(e);
|
|
3207
3207
|
}
|
|
3208
3208
|
})
|
|
3209
3209
|
), this.unsubs.push(
|
|
3210
|
-
|
|
3210
|
+
U(() => {
|
|
3211
3211
|
this.store.isSingleMode.value, this.pageFlip && (this.layoutUpdateTimer && clearTimeout(this.layoutUpdateTimer), this.layoutUpdateTimer = setTimeout(() => {
|
|
3212
3212
|
this.layoutUpdateTimer = null, this.pageFlip && this.pageFlip.update(), window.dispatchEvent(new Event("resize"));
|
|
3213
3213
|
}, 50));
|
|
3214
3214
|
})
|
|
3215
3215
|
), this.unsubs.push(
|
|
3216
|
-
|
|
3216
|
+
U(() => {
|
|
3217
3217
|
const e = this.store.isAutoPlaying.value, i = this.store.autoPlayInterval.value || 3e3;
|
|
3218
3218
|
this.autoPlayTimer && (clearInterval(this.autoPlayTimer), this.autoPlayTimer = null), e && (this.autoPlayTimer = setInterval(() => {
|
|
3219
|
-
const
|
|
3220
|
-
if (this.store.currentPage.peek() >=
|
|
3219
|
+
const n = this.store.pages.value.length - 1;
|
|
3220
|
+
if (this.store.currentPage.peek() >= n || this.store.currentPage.peek() >= n - 1 && !this.store.isSingleMode.peek()) {
|
|
3221
3221
|
this.store.isAutoPlaying.value = !1;
|
|
3222
3222
|
return;
|
|
3223
3223
|
}
|
|
@@ -3266,7 +3266,7 @@ class ns {
|
|
|
3266
3266
|
* you must purchase a Commercial License from:
|
|
3267
3267
|
* https://flipbookengine.com/pricing
|
|
3268
3268
|
*/
|
|
3269
|
-
class
|
|
3269
|
+
class on {
|
|
3270
3270
|
constructor(e, i) {
|
|
3271
3271
|
C(this, "wrapperElement", null);
|
|
3272
3272
|
C(this, "sizerElement", null);
|
|
@@ -3285,7 +3285,7 @@ class as {
|
|
|
3285
3285
|
}
|
|
3286
3286
|
setupStateSync() {
|
|
3287
3287
|
this.unsubs.push(
|
|
3288
|
-
|
|
3288
|
+
U(() => {
|
|
3289
3289
|
this.store.isSingleMode.value, this.store.orientation.value, this.scheduleAspectRatioUpdate();
|
|
3290
3290
|
})
|
|
3291
3291
|
);
|
|
@@ -3308,7 +3308,7 @@ class as {
|
|
|
3308
3308
|
if (!this.wrapperElement || !this.sizerElement) return;
|
|
3309
3309
|
const e = this.wrapperElement.clientWidth, i = this.wrapperElement.clientHeight;
|
|
3310
3310
|
if (e === 0 || i === 0) return;
|
|
3311
|
-
const
|
|
3311
|
+
const n = this.pageViewport.width, a = this.pageViewport.height, h = this.store.isDoublePageLayout.value ? n * 2 / a : n / a;
|
|
3312
3312
|
let c = e, g = e / h;
|
|
3313
3313
|
g > i && (g = i, c = i * h);
|
|
3314
3314
|
let v = Math.ceil(c);
|
|
@@ -3337,8 +3337,8 @@ class as {
|
|
|
3337
3337
|
* you must purchase a Commercial License from:
|
|
3338
3338
|
* https://flipbookengine.com/pricing
|
|
3339
3339
|
*/
|
|
3340
|
-
class
|
|
3341
|
-
constructor(e, i,
|
|
3340
|
+
class rn {
|
|
3341
|
+
constructor(e, i, n) {
|
|
3342
3342
|
C(this, "container");
|
|
3343
3343
|
C(this, "pageFlipAdapter");
|
|
3344
3344
|
C(this, "store");
|
|
@@ -3346,7 +3346,7 @@ class os {
|
|
|
3346
3346
|
C(this, "unsubs", []);
|
|
3347
3347
|
C(this, "listenerAbortController");
|
|
3348
3348
|
var r;
|
|
3349
|
-
this.container = e, this.pageFlipAdapter = i, this.store =
|
|
3349
|
+
this.container = e, this.pageFlipAdapter = i, this.store = n;
|
|
3350
3350
|
const a = ((r = e.ownerDocument.defaultView) == null ? void 0 : r.AbortController) ?? globalThis.AbortController;
|
|
3351
3351
|
this.listenerAbortController = new a();
|
|
3352
3352
|
}
|
|
@@ -3355,7 +3355,7 @@ class os {
|
|
|
3355
3355
|
}
|
|
3356
3356
|
setupStateSync() {
|
|
3357
3357
|
this.unsubs.push(
|
|
3358
|
-
|
|
3358
|
+
U(() => {
|
|
3359
3359
|
this.store.isZoomed.value = this.store.zoomState.value.isActive, this.store.zoomState.value.isActive ? (this.container.style.transform = `translate(${this.store.zoomState.value.translateX}px, ${this.store.zoomState.value.translateY}px) scale(${this.store.zoomState.value.scale})`, this.container.style.transition = "none") : (this.container.style.transform = "", this.container.style.transition = "transform 0.3s ease");
|
|
3360
3360
|
})
|
|
3361
3361
|
);
|
|
@@ -3375,19 +3375,19 @@ class os {
|
|
|
3375
3375
|
}, { passive: !1, signal: this.listenerAbortController.signal });
|
|
3376
3376
|
}
|
|
3377
3377
|
bindMouseDrag() {
|
|
3378
|
-
let e = !1, i = 0,
|
|
3378
|
+
let e = !1, i = 0, n = 0, a = 0, r = 0;
|
|
3379
3379
|
this.container.addEventListener("mousedown", (h) => {
|
|
3380
|
-
h.button !== 0 || this.store.textSelection.value || this.store.placingNote.value || h.target.closest("button,a,input,textarea,select,[contenteditable=true]") || this.store.zoomState.value.isActive && (h.preventDefault(), h.stopPropagation(), e = !0, i = h.clientX,
|
|
3380
|
+
h.button !== 0 || this.store.textSelection.value || this.store.placingNote.value || h.target.closest("button,a,input,textarea,select,[contenteditable=true]") || this.store.zoomState.value.isActive && (h.preventDefault(), h.stopPropagation(), e = !0, i = h.clientX, n = h.clientY, a = this.store.zoomState.value.translateX, r = this.store.zoomState.value.translateY, this.container.style.cursor = "grabbing");
|
|
3381
3381
|
}, { capture: !0, signal: this.listenerAbortController.signal }), window.addEventListener("mousemove", (h) => {
|
|
3382
3382
|
if (!e || !this.store.zoomState.value.isActive) return;
|
|
3383
|
-
const c = h.clientX - i, g = h.clientY -
|
|
3383
|
+
const c = h.clientX - i, g = h.clientY - n;
|
|
3384
3384
|
this.updateZoomPan(a + c, r + g);
|
|
3385
3385
|
}, { capture: !0, signal: this.listenerAbortController.signal }), window.addEventListener("mouseup", () => {
|
|
3386
3386
|
e && (e = !1, this.container.style.cursor = this.store.zoomState.value.isActive ? "grab" : "");
|
|
3387
3387
|
}, { capture: !0, signal: this.listenerAbortController.signal });
|
|
3388
3388
|
}
|
|
3389
3389
|
bindTouch() {
|
|
3390
|
-
let e = 0, i = 0,
|
|
3390
|
+
let e = 0, i = 0, n = 0, a = 0, r = 1, h = 0, c = 0, g = 0, v = 0, y = !1;
|
|
3391
3391
|
const S = this.listenerAbortController.signal, m = (b) => b == null ? void 0 : b.closest('button,a,input,textarea,select,[contenteditable="true"]');
|
|
3392
3392
|
this.container.addEventListener("touchstart", (b) => {
|
|
3393
3393
|
if (m(b.target) || this.store.textSelection.value || this.store.placingNote.value || this.store.pendingAnnotation.value || this.store.activeAnnotationId.value) {
|
|
@@ -3396,8 +3396,8 @@ class os {
|
|
|
3396
3396
|
}
|
|
3397
3397
|
if (b.touches.length === 2) {
|
|
3398
3398
|
const [P, E] = Array.from(b.touches), I = this.container.parentElement.getBoundingClientRect();
|
|
3399
|
-
a = Math.hypot(P.clientX - E.clientX, P.clientY - E.clientY), r = this.store.zoomState.value.scale, h = (P.clientX + E.clientX) / 2, c = (P.clientY + E.clientY) / 2, g = I.left + I.width / 2, v = I.top + I.height / 2, i = this.store.zoomState.value.translateX,
|
|
3400
|
-
} else b.touches.length === 1 && (y = !1, a = 0, this.touchStartX = b.touches[0].clientX, e = b.touches[0].clientY, i = this.store.zoomState.value.translateX,
|
|
3399
|
+
a = Math.hypot(P.clientX - E.clientX, P.clientY - E.clientY), r = this.store.zoomState.value.scale, h = (P.clientX + E.clientX) / 2, c = (P.clientY + E.clientY) / 2, g = I.left + I.width / 2, v = I.top + I.height / 2, i = this.store.zoomState.value.translateX, n = this.store.zoomState.value.translateY, y = !0, this.touchStartX = null, b.stopPropagation(), b.cancelable && b.preventDefault();
|
|
3400
|
+
} else b.touches.length === 1 && (y = !1, a = 0, this.touchStartX = b.touches[0].clientX, e = b.touches[0].clientY, i = this.store.zoomState.value.translateX, n = this.store.zoomState.value.translateY, this.store.zoomState.value.isActive && b.stopPropagation());
|
|
3401
3401
|
}, { capture: !0, passive: !1, signal: S }), this.container.addEventListener("touchmove", (b) => {
|
|
3402
3402
|
if (!(m(b.target) || this.store.placingNote.value))
|
|
3403
3403
|
if (b.touches.length === 2 && a > 0) {
|
|
@@ -3407,9 +3407,9 @@ class os {
|
|
|
3407
3407
|
scale: I,
|
|
3408
3408
|
isActive: I > 1,
|
|
3409
3409
|
translateX: i + (h - g) * (1 - F) + (P.clientX + E.clientX) / 2 - h,
|
|
3410
|
-
translateY:
|
|
3410
|
+
translateY: n + (c - v) * (1 - F) + (P.clientY + E.clientY) / 2 - c
|
|
3411
3411
|
}, b.stopPropagation(), b.cancelable && b.preventDefault();
|
|
3412
|
-
} else !y && this.store.zoomState.value.isActive && this.touchStartX !== null && b.touches.length === 1 && (this.updateZoomPan(i + b.touches[0].clientX - this.touchStartX,
|
|
3412
|
+
} else !y && this.store.zoomState.value.isActive && this.touchStartX !== null && b.touches.length === 1 && (this.updateZoomPan(i + b.touches[0].clientX - this.touchStartX, n + b.touches[0].clientY - e), b.stopPropagation(), b.cancelable && b.preventDefault());
|
|
3413
3413
|
}, { capture: !0, passive: !1, signal: S });
|
|
3414
3414
|
const w = (b) => {
|
|
3415
3415
|
if (!y && !this.store.placingNote.value && !this.store.pendingAnnotation.value && !this.store.activeAnnotationId.value && this.touchStartX !== null && !this.store.zoomState.value.isActive && this.store.isSingleMode.value && b.changedTouches.length === 1) {
|
|
@@ -3447,16 +3447,16 @@ class os {
|
|
|
3447
3447
|
}
|
|
3448
3448
|
function qt(t, e, i) {
|
|
3449
3449
|
if (!t || typeof t.title != "string" || !t.title.trim() || !Number.isFinite(t.pageIndex)) return null;
|
|
3450
|
-
const
|
|
3450
|
+
const n = Math.max(0, e - 1), a = Array.isArray(t.children) ? t.children.map((r, h) => qt(r, e, i + "-" + h)).filter((r) => r !== null) : [];
|
|
3451
3451
|
return {
|
|
3452
3452
|
id: t.id ?? i,
|
|
3453
3453
|
title: t.title.trim(),
|
|
3454
|
-
pageIndex: Math.max(0, Math.min(
|
|
3454
|
+
pageIndex: Math.max(0, Math.min(n, Math.trunc(t.pageIndex))),
|
|
3455
3455
|
...a.length ? { children: a } : {}
|
|
3456
3456
|
};
|
|
3457
3457
|
}
|
|
3458
3458
|
function je(t, e) {
|
|
3459
|
-
return Array.isArray(t) ? t.map((i,
|
|
3459
|
+
return Array.isArray(t) ? t.map((i, n) => qt(i, e, "toc-" + n)).filter((i) => i !== null) : [];
|
|
3460
3460
|
}
|
|
3461
3461
|
/**
|
|
3462
3462
|
* @license FlipbookEngine v1.0.0
|
|
@@ -3466,11 +3466,11 @@ function je(t, e) {
|
|
|
3466
3466
|
*/
|
|
3467
3467
|
const St = () => ({ isActive: !1, translateX: 0, translateY: 0, isDragging: !1, scale: 1 });
|
|
3468
3468
|
function _t() {
|
|
3469
|
-
const t = A(/* @__PURE__ */ new Map()), e = A(!1), i = A(!1),
|
|
3470
|
-
return { textAvailable: i, textPages: t, textSelection: e, pageNoteDocuments:
|
|
3471
|
-
|
|
3469
|
+
const t = A(/* @__PURE__ */ new Map()), e = A(!1), i = A(!1), n = A(/* @__PURE__ */ new Map()), a = A(void 0), r = A(!1), h = A(!1), c = A(null), g = A("page"), v = A(!1), y = A(!1), S = A(!1), m = A(!1), w = A(!1), b = A(0), P = A(0), E = A(!1), I = A(!1), F = A(!1), k = A(!1), s = A(!1), o = A(!0), u = A("landscape"), f = A("read"), p = A("auto"), x = A(!0), T = A(!1), M = A(!1), L = A("#7367f0"), z = A(!1), B = A(!1), W = A(!1), V = A(/* @__PURE__ */ new Set()), K = A(/* @__PURE__ */ new Map()), ie = A(3e3), xe = A(!0), Pe = A(""), Se = A([]), ke = A([]), Ce = A(null), Ae = A([]), Te = A(null), Me = A("en"), Ee = A({}), nt = A(St()), De = A([]), Ie = A([]), Re = d(() => !E.value && u.value === "landscape"), Yt = d(() => Re.value && b.value === 0), Zt = d(() => Re.value && b.value >= P.value - 1);
|
|
3470
|
+
return { textAvailable: i, textPages: t, textSelection: e, pageNoteDocuments: n, noteEditor: a, canAnnotate: r, placingNote: h, pendingAnnotation: c, notesView: g, searchAvailable: v, searchBusy: y, searchFailed: S, notesSaving: m, notesFailed: w, currentPage: b, totalPages: P, isSingleMode: E, showThumbs: I, showToc: F, showNotes: k, showSearch: s, showArrows: o, orientation: u, flipState: f, themeMode: p, allowDownload: x, bookmarkedPages: V, pageNotes: K, hasDownloadUrl: T, isPdfMode: M, primaryColor: L, whiteLabel: z, isZoomed: B, isAutoPlaying: W, autoPlayInterval: ie, soundEnabled: xe, searchQuery: Pe, searchResults: Se, hotspots: ke, activeHotspotId: Ce, annotations: Ae, activeAnnotationId: Te, locale: Me, messages: Ee, zoomState: nt, pages: De, toc: Ie, isDoublePageLayout: Re, isFrontCover: Yt, isBackCover: Zt, init: (D, ue, Qt, st, at = st) => {
|
|
3471
|
+
n.value = new Map(Object.entries(D.noteDocuments ?? {}).map(([$, ne]) => [Number($), ne])), a.value = D.noteEditor, r.value = !!D.annotationProvider, h.value = !1, c.value = null, i.value = !!D.textLayerProvider, t.value = /* @__PURE__ */ new Map(), e.value = D.textSelection ?? !1, v.value = at || !!D.searchProvider, P.value = ue, De.value = Qt, T.value = st, M.value = at, D.theme !== void 0 && (p.value = D.theme), D.primaryColor !== void 0 && (L.value = D.primaryColor), D.showThumbs !== void 0 && (I.value = D.showThumbs), D.showToc !== void 0 && (F.value = D.showToc), k.value = !1, g.value = "page", s.value = !1, y.value = !1, S.value = !1, m.value = !1, w.value = !1, Pe.value = "", Se.value = [], ke.value = D.hotspots ?? [], Ce.value = null, Ae.value = D.annotations ?? [], Te.value = null, Ie.value = je(D.toc ?? [], ue), D.showArrows !== void 0 && (o.value = D.showArrows), D.allowDownload !== void 0 && (x.value = D.allowDownload), D.whiteLabel !== void 0 && (z.value = D.whiteLabel), D.soundEnabled !== void 0 && (xe.value = D.soundEnabled), D.locale !== void 0 && (Me.value = D.locale), D.messages !== void 0 && (Ee.value = D.messages), D.isSingleMode !== void 0 && (E.value = D.isSingleMode), D.singleMode !== void 0 && (E.value = D.singleMode), D.autoPlay !== void 0 && (W.value = D.autoPlay), D.autoPlayInterval !== void 0 && (ie.value = D.autoPlayInterval), V.value = new Set((D.bookmarks ?? []).map(($) => Math.trunc($)).filter(($) => Number.isInteger($) && $ >= 0 && $ < ue)), K.value = new Map(Object.entries(D.notes ?? {}).map(([$, ne]) => [Math.trunc(Number($)), String(ne).trim()]).filter(([$, ne]) => Number.isInteger($) && $ >= 0 && $ < ue && ne.length > 0)), b.value = 0;
|
|
3472
3472
|
}, reset: () => {
|
|
3473
|
-
t.value = /* @__PURE__ */ new Map(), e.value = !1, i.value = !1, b.value = 0, P.value = 0, E.value = !1, I.value = !1, F.value = !1, k.value = !1, g.value = "page",
|
|
3473
|
+
t.value = /* @__PURE__ */ new Map(), e.value = !1, i.value = !1, b.value = 0, P.value = 0, E.value = !1, I.value = !1, F.value = !1, k.value = !1, g.value = "page", s.value = !1, y.value = !1, S.value = !1, m.value = !1, w.value = !1, o.value = !0, u.value = "landscape", f.value = "read", p.value = "auto", x.value = !0, T.value = !1, M.value = !1, v.value = !1, n.value = /* @__PURE__ */ new Map(), r.value = !1, h.value = !1, c.value = null, L.value = "#7367f0", z.value = !1, B.value = !1, W.value = !1, ie.value = 3e3, xe.value = !0, Me.value = "en", Ee.value = {}, nt.value = St(), De.value = [], Ie.value = [], V.value = /* @__PURE__ */ new Set(), K.value = /* @__PURE__ */ new Map(), Pe.value = "", Se.value = [], ke.value = [], Ce.value = null, Ae.value = [], Te.value = null;
|
|
3474
3474
|
} };
|
|
3475
3475
|
}
|
|
3476
3476
|
const R = _t();
|
|
@@ -3510,24 +3510,24 @@ R.toc;
|
|
|
3510
3510
|
R.isDoublePageLayout;
|
|
3511
3511
|
R.isFrontCover;
|
|
3512
3512
|
R.isBackCover;
|
|
3513
|
-
function
|
|
3513
|
+
function ln(t) {
|
|
3514
3514
|
if (!t || typeof t != "object") return !1;
|
|
3515
3515
|
const e = t;
|
|
3516
3516
|
return typeof e.normal == "string" && typeof e.low == "string" && typeof e.thumb == "string";
|
|
3517
3517
|
}
|
|
3518
|
-
function
|
|
3518
|
+
function hn(t) {
|
|
3519
3519
|
return Array.isArray(t.pageNumbers) && t.pageNumbers.length > 0 ? t.pageNumbers : typeof t.pageNumber == "number" ? t.kind === "spread" ? [t.pageNumber, t.pageNumber + 1] : [t.pageNumber] : [];
|
|
3520
3520
|
}
|
|
3521
|
-
function
|
|
3521
|
+
function cn(t) {
|
|
3522
3522
|
return t === "rtl" ? ["right", "left"] : ["left", "right"];
|
|
3523
3523
|
}
|
|
3524
|
-
function
|
|
3524
|
+
function un(t) {
|
|
3525
3525
|
const e = [];
|
|
3526
3526
|
let i = 1;
|
|
3527
|
-
return t.forEach((
|
|
3528
|
-
const r =
|
|
3527
|
+
return t.forEach((n, a) => {
|
|
3528
|
+
const r = n.kind ?? "single", h = n.id ?? `asset-${a}`, c = n.splitDirection ?? "ltr", g = hn(n);
|
|
3529
3529
|
if (r === "spread") {
|
|
3530
|
-
const y = g.length >= 2 ? g.slice(0, 2) : [i, i + 1], S =
|
|
3530
|
+
const y = g.length >= 2 ? g.slice(0, 2) : [i, i + 1], S = cn(c);
|
|
3531
3531
|
y.forEach((m, w) => {
|
|
3532
3532
|
e.push({
|
|
3533
3533
|
index: e.length,
|
|
@@ -3535,9 +3535,9 @@ function cs(t) {
|
|
|
3535
3535
|
pageNumber: m,
|
|
3536
3536
|
sourcePageNumber: m,
|
|
3537
3537
|
cropMode: S[w] ?? "full",
|
|
3538
|
-
normal:
|
|
3539
|
-
low:
|
|
3540
|
-
thumb:
|
|
3538
|
+
normal: n.normal,
|
|
3539
|
+
low: n.low,
|
|
3540
|
+
thumb: n.thumb
|
|
3541
3541
|
});
|
|
3542
3542
|
}), i = y[y.length - 1] + 1;
|
|
3543
3543
|
return;
|
|
@@ -3549,21 +3549,21 @@ function cs(t) {
|
|
|
3549
3549
|
pageNumber: v,
|
|
3550
3550
|
sourcePageNumber: v,
|
|
3551
3551
|
cropMode: "full",
|
|
3552
|
-
normal:
|
|
3553
|
-
low:
|
|
3554
|
-
thumb:
|
|
3552
|
+
normal: n.normal,
|
|
3553
|
+
low: n.low,
|
|
3554
|
+
thumb: n.thumb
|
|
3555
3555
|
}), i = v + 1;
|
|
3556
3556
|
}), e;
|
|
3557
3557
|
}
|
|
3558
|
-
function
|
|
3558
|
+
function dn(t) {
|
|
3559
3559
|
return t ? 'url("' + t.replace(/["\\\r\n]/g, (i) => "\\" + i) + '")' : void 0;
|
|
3560
3560
|
}
|
|
3561
3561
|
function kt(t, e) {
|
|
3562
3562
|
t.classList.add("bk-container"), t.classList.remove("bk-theme-light", "bk-theme-dark"), t.classList.add("bk-theme-" + (e.theme ?? "auto")), e.primaryColor && t.style.setProperty("--flipbook-accent", e.primaryColor);
|
|
3563
|
-
const i = e.background ?? {},
|
|
3563
|
+
const i = e.background ?? {}, n = e.backgroundColor || e.backgroundImage ? { color: e.backgroundColor, image: e.backgroundImage } : void 0, a = (h, c) => {
|
|
3564
3564
|
const g = {
|
|
3565
3565
|
["--flipbook-bg-" + h + "-color"]: c == null ? void 0 : c.color,
|
|
3566
|
-
["--flipbook-bg-" + h + "-image"]:
|
|
3566
|
+
["--flipbook-bg-" + h + "-image"]: dn(c == null ? void 0 : c.image),
|
|
3567
3567
|
["--flipbook-bg-" + h + "-size"]: c == null ? void 0 : c.size,
|
|
3568
3568
|
["--flipbook-bg-" + h + "-position"]: c == null ? void 0 : c.position,
|
|
3569
3569
|
["--flipbook-bg-" + h + "-repeat"]: c == null ? void 0 : c.repeat
|
|
@@ -3572,14 +3572,14 @@ function kt(t, e) {
|
|
|
3572
3572
|
y ? t.style.setProperty(v, y) : t.style.removeProperty(v);
|
|
3573
3573
|
});
|
|
3574
3574
|
};
|
|
3575
|
-
a("light", i.light ??
|
|
3575
|
+
a("light", i.light ?? n), a("dark", i.dark);
|
|
3576
3576
|
const r = e.cssVariables ?? {};
|
|
3577
3577
|
Object.entries(r).forEach(([h, c]) => {
|
|
3578
3578
|
const g = h.startsWith("--") ? h : "--" + h;
|
|
3579
3579
|
t.style.setProperty(g, c);
|
|
3580
3580
|
});
|
|
3581
3581
|
}
|
|
3582
|
-
class
|
|
3582
|
+
class gn {
|
|
3583
3583
|
constructor(e = 32) {
|
|
3584
3584
|
C(this, "entries", /* @__PURE__ */ new Map());
|
|
3585
3585
|
C(this, "hits", 0);
|
|
@@ -3598,9 +3598,9 @@ class ds {
|
|
|
3598
3598
|
set(e, i) {
|
|
3599
3599
|
if (!(this.maxEntries === 0 || !i))
|
|
3600
3600
|
for (this.entries.delete(e), this.entries.set(e, i); this.entries.size > this.maxEntries; ) {
|
|
3601
|
-
const
|
|
3602
|
-
if (
|
|
3603
|
-
this.entries.delete(
|
|
3601
|
+
const n = this.entries.keys().next().value;
|
|
3602
|
+
if (n === void 0) break;
|
|
3603
|
+
this.entries.delete(n);
|
|
3604
3604
|
}
|
|
3605
3605
|
}
|
|
3606
3606
|
clear() {
|
|
@@ -3614,11 +3614,11 @@ class ds {
|
|
|
3614
3614
|
}
|
|
3615
3615
|
}
|
|
3616
3616
|
const He = 1190.55, We = 841.89;
|
|
3617
|
-
function
|
|
3618
|
-
const i = Math.max(t, e),
|
|
3617
|
+
function fn(t, e) {
|
|
3618
|
+
const i = Math.max(t, e), n = Math.min(t, e), a = i / n, r = Math.abs(i - He) / He <= 0.08 && Math.abs(n - We) / We <= 0.08;
|
|
3619
3619
|
return t >= e && r && Math.abs(a - He / We) <= 0.04;
|
|
3620
3620
|
}
|
|
3621
|
-
class
|
|
3621
|
+
class pn {
|
|
3622
3622
|
constructor(e = {}) {
|
|
3623
3623
|
C(this, "pdfDoc", null);
|
|
3624
3624
|
C(this, "loadingTask", null);
|
|
@@ -3633,32 +3633,32 @@ class fs {
|
|
|
3633
3633
|
workerSrc: e.workerSrc || "",
|
|
3634
3634
|
concurrency: Math.max(1, Math.floor(e.concurrency || 3)),
|
|
3635
3635
|
cacheSize: i
|
|
3636
|
-
}, this.cache = new
|
|
3636
|
+
}, this.cache = new gn(this.options.cacheSize), this.options.workerSrc && (rt.GlobalWorkerOptions.workerSrc = this.options.workerSrc);
|
|
3637
3637
|
}
|
|
3638
3638
|
/** Loads a PDF document and cancels PDF.js loading when the signal aborts. */
|
|
3639
3639
|
async loadDocument(e, i) {
|
|
3640
3640
|
this.throwIfAborted(i), this.cache.clear();
|
|
3641
|
-
const
|
|
3642
|
-
this.loadingTask =
|
|
3641
|
+
const n = rt.getDocument(e);
|
|
3642
|
+
this.loadingTask = n;
|
|
3643
3643
|
const a = () => {
|
|
3644
3644
|
var r;
|
|
3645
|
-
return (r =
|
|
3645
|
+
return (r = n.destroy) == null ? void 0 : r.call(n);
|
|
3646
3646
|
};
|
|
3647
3647
|
i == null || i.addEventListener("abort", a, { once: !0 });
|
|
3648
3648
|
try {
|
|
3649
|
-
return this.pdfDoc = await
|
|
3649
|
+
return this.pdfDoc = await n.promise, this.throwIfAborted(i), this.pdfDoc.numPages;
|
|
3650
3650
|
} catch (r) {
|
|
3651
3651
|
throw i != null && i.aborted ? this.createAbortError() : r;
|
|
3652
3652
|
} finally {
|
|
3653
|
-
i == null || i.removeEventListener("abort", a), this.loadingTask ===
|
|
3653
|
+
i == null || i.removeEventListener("abort", a), this.loadingTask === n && (this.loadingTask = null);
|
|
3654
3654
|
}
|
|
3655
3655
|
}
|
|
3656
3656
|
/** Renders a specific page to a Data URL. The page index is 1-based. */
|
|
3657
3657
|
async renderPageToDataUrl(e, i) {
|
|
3658
3658
|
if (!this.pdfDoc) throw new Error("PDF document is not loaded.");
|
|
3659
3659
|
this.throwIfAborted(i);
|
|
3660
|
-
const
|
|
3661
|
-
if (
|
|
3660
|
+
const n = this.cache.get(e);
|
|
3661
|
+
if (n !== void 0) return n;
|
|
3662
3662
|
try {
|
|
3663
3663
|
const a = await this.pdfDoc.getPage(e);
|
|
3664
3664
|
this.throwIfAborted(i);
|
|
@@ -3696,16 +3696,16 @@ class fs {
|
|
|
3696
3696
|
}
|
|
3697
3697
|
/** Searches all PDF source pages and returns normalized rectangles for matched text. */
|
|
3698
3698
|
async searchText(e, i = {}) {
|
|
3699
|
-
const
|
|
3700
|
-
if (!this.pdfDoc || !
|
|
3701
|
-
const a = i.caseSensitive === !0, r = a ?
|
|
3699
|
+
const n = String(e ?? "").trim();
|
|
3700
|
+
if (!this.pdfDoc || !n) return [];
|
|
3701
|
+
const a = i.caseSensitive === !0, r = a ? n : n.toLocaleLowerCase(), h = Number.isFinite(i.maxResults) ? Math.max(1, Math.trunc(i.maxResults)) : 100, c = [];
|
|
3702
3702
|
for (let g = 1; g <= this.pdfDoc.numPages && c.length < h; g++) {
|
|
3703
3703
|
const v = await this.pdfDoc.getPage(g), y = await v.getTextContent(), S = ((y == null ? void 0 : y.items) ?? []).filter((p) => typeof (p == null ? void 0 : p.str) == "string" && p.str.length > 0), m = S.map((p) => p.str).join(" ").replace(/\s+/g, " ").trim(), w = a ? m : m.toLocaleLowerCase();
|
|
3704
3704
|
let b = 0, P = w.indexOf(r);
|
|
3705
3705
|
for (; P >= 0; )
|
|
3706
3706
|
b++, P = w.indexOf(r, P + Math.max(1, r.length));
|
|
3707
3707
|
if (!b) continue;
|
|
3708
|
-
const E = w.indexOf(r), I = Math.max(0, E - 70), F = Math.min(m.length, E +
|
|
3708
|
+
const E = w.indexOf(r), I = Math.max(0, E - 70), F = Math.min(m.length, E + n.length + 100), k = [], s = typeof v.getViewport == "function" ? v.getViewport({ scale: 1 }) : null, o = Number(s == null ? void 0 : s.width), u = Number(s == null ? void 0 : s.height);
|
|
3709
3709
|
o > 0 && u > 0 && S.forEach((p) => {
|
|
3710
3710
|
const x = String(p.str), T = a ? x : x.toLocaleLowerCase(), M = Array.isArray(p.transform) ? p.transform : [], L = Number(M[4]), z = Number(M[5]), B = Number(p.width) || Math.abs(Number(M[0])) || 0, W = Number(p.height) || Math.abs(Number(M[3])) || 0;
|
|
3711
3711
|
if (!(B > 0 && W > 0 && Number.isFinite(L) && Number.isFinite(z))) return;
|
|
@@ -3729,8 +3729,8 @@ class fs {
|
|
|
3729
3729
|
async getPageLayouts(e = "auto") {
|
|
3730
3730
|
if (!this.pdfDoc) return [];
|
|
3731
3731
|
const i = [];
|
|
3732
|
-
for (let
|
|
3733
|
-
const r = (await this.pdfDoc.getPage(
|
|
3732
|
+
for (let n = 1; n <= this.pdfDoc.numPages; n++) {
|
|
3733
|
+
const r = (await this.pdfDoc.getPage(n)).getViewport({ scale: 1 }), h = e === "split" ? r.width >= r.height : e === "auto" && fn(r.width, r.height);
|
|
3734
3734
|
i.push({ width: r.width, height: r.height, split: h });
|
|
3735
3735
|
}
|
|
3736
3736
|
return i;
|
|
@@ -3738,20 +3738,20 @@ class fs {
|
|
|
3738
3738
|
/** Calculates the best viewport dimensions based on the first logical page. */
|
|
3739
3739
|
async calculateViewportDimensions(e = 420, i) {
|
|
3740
3740
|
if (!this.pdfDoc) throw new Error("PDF document is not loaded.");
|
|
3741
|
-
const
|
|
3741
|
+
const n = await this.pdfDoc.getPage(1), a = i ? { width: i.split ? i.width / 2 : i.width, height: i.height } : n.getViewport({ scale: 1 }), r = a.width / a.height;
|
|
3742
3742
|
return r >= 1 ? { width: Math.round(e * r), height: e } : { width: e, height: Math.round(e / r) };
|
|
3743
3743
|
}
|
|
3744
3744
|
/** Renders pages concurrently with a bounded worker pool and preserves page order. */
|
|
3745
3745
|
async renderAllPages(e, i) {
|
|
3746
3746
|
if (!this.pdfDoc) return [];
|
|
3747
3747
|
this.throwIfAborted(e);
|
|
3748
|
-
const
|
|
3748
|
+
const n = this.pdfDoc.numPages, a = new Array(n);
|
|
3749
3749
|
let r = 1, h = 0;
|
|
3750
3750
|
const c = async () => {
|
|
3751
3751
|
for (; ; ) {
|
|
3752
3752
|
this.throwIfAborted(e);
|
|
3753
3753
|
const v = r++;
|
|
3754
|
-
if (v >
|
|
3754
|
+
if (v > n) return;
|
|
3755
3755
|
const y = await this.renderPageToDataUrl(v, e);
|
|
3756
3756
|
a[v - 1] = {
|
|
3757
3757
|
index: v - 1,
|
|
@@ -3761,9 +3761,9 @@ class fs {
|
|
|
3761
3761
|
normal: y,
|
|
3762
3762
|
low: y,
|
|
3763
3763
|
thumb: y
|
|
3764
|
-
}, h++, i == null || i({ completed: h, total:
|
|
3764
|
+
}, h++, i == null || i({ completed: h, total: n });
|
|
3765
3765
|
}
|
|
3766
|
-
}, g = Math.min(this.options.concurrency,
|
|
3766
|
+
}, g = Math.min(this.options.concurrency, n);
|
|
3767
3767
|
return await Promise.all(Array.from({ length: g }, () => c())), this.throwIfAborted(e), a;
|
|
3768
3768
|
}
|
|
3769
3769
|
getCacheStats() {
|
|
@@ -3777,8 +3777,8 @@ class fs {
|
|
|
3777
3777
|
return e.name = "AbortError", e;
|
|
3778
3778
|
}
|
|
3779
3779
|
destroy() {
|
|
3780
|
-
var e, i,
|
|
3781
|
-
(i = (e = this.loadingTask) == null ? void 0 : e.destroy) == null || i.call(e), this.loadingTask = null, this.pdfDoc && ((a = (
|
|
3780
|
+
var e, i, n, a;
|
|
3781
|
+
(i = (e = this.loadingTask) == null ? void 0 : e.destroy) == null || i.call(e), this.loadingTask = null, this.pdfDoc && ((a = (n = this.pdfDoc).destroy) == null || a.call(n), this.pdfDoc = null), this.cache.clear();
|
|
3782
3782
|
}
|
|
3783
3783
|
}
|
|
3784
3784
|
/**
|
|
@@ -3787,13 +3787,13 @@ class fs {
|
|
|
3787
3787
|
*
|
|
3788
3788
|
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
3789
3789
|
*/
|
|
3790
|
-
const
|
|
3790
|
+
const Ut = "flipbook:command", Gt = "flipbook:event", Vt = "flipbook:response";
|
|
3791
3791
|
function J() {
|
|
3792
3792
|
return typeof window > "u" ? null : window;
|
|
3793
3793
|
}
|
|
3794
3794
|
function Ct(t, e) {
|
|
3795
|
-
var
|
|
3796
|
-
const i = (
|
|
3795
|
+
var n;
|
|
3796
|
+
const i = (n = t.allowedOrigins) == null ? void 0 : n.filter(Boolean);
|
|
3797
3797
|
return i != null && i.length ? i : [e];
|
|
3798
3798
|
}
|
|
3799
3799
|
function Xe(t) {
|
|
@@ -3804,7 +3804,7 @@ function At(t, e) {
|
|
|
3804
3804
|
throw new Error(`${e} must be a finite number.`);
|
|
3805
3805
|
return t;
|
|
3806
3806
|
}
|
|
3807
|
-
class
|
|
3807
|
+
class mn {
|
|
3808
3808
|
constructor(e, i = {}) {
|
|
3809
3809
|
C(this, "engine");
|
|
3810
3810
|
C(this, "options");
|
|
@@ -3831,16 +3831,16 @@ class ps {
|
|
|
3831
3831
|
annotationChange: !0,
|
|
3832
3832
|
annotationActivate: !0
|
|
3833
3833
|
});
|
|
3834
|
-
this.engine = e, this.options = i, this.listener = (
|
|
3835
|
-
this.handleMessage(
|
|
3834
|
+
this.engine = e, this.options = i, this.listener = (n) => {
|
|
3835
|
+
this.handleMessage(n);
|
|
3836
3836
|
};
|
|
3837
3837
|
}
|
|
3838
3838
|
connect() {
|
|
3839
3839
|
if (this.connected) return this;
|
|
3840
3840
|
const e = J();
|
|
3841
3841
|
return !e || e.parent === e ? this : (this.connected = !0, e.addEventListener("message", this.listener), Object.keys(this.engineEventNames).forEach((i) => {
|
|
3842
|
-
this.unsubs.push(this.engine.on(i, (
|
|
3843
|
-
this.postEvent(i,
|
|
3842
|
+
this.unsubs.push(this.engine.on(i, (n) => {
|
|
3843
|
+
this.postEvent(i, n);
|
|
3844
3844
|
}));
|
|
3845
3845
|
}), this);
|
|
3846
3846
|
}
|
|
@@ -3849,37 +3849,37 @@ class ps {
|
|
|
3849
3849
|
this.connected && ((e = J()) == null || e.removeEventListener("message", this.listener), this.unsubs.splice(0).forEach((i) => i()), this.connected = !1, this.parentOrigin = null);
|
|
3850
3850
|
}
|
|
3851
3851
|
isAllowedOrigin(e) {
|
|
3852
|
-
const i = J(),
|
|
3853
|
-
return Ct(this.options,
|
|
3852
|
+
const i = J(), n = (i == null ? void 0 : i.location.origin) ?? "";
|
|
3853
|
+
return Ct(this.options, n).includes("*") || Ct(this.options, n).includes(e);
|
|
3854
3854
|
}
|
|
3855
3855
|
post(e) {
|
|
3856
|
-
const i = J(),
|
|
3857
|
-
if (!i || !
|
|
3856
|
+
const i = J(), n = i == null ? void 0 : i.parent;
|
|
3857
|
+
if (!i || !n || n === i) return;
|
|
3858
3858
|
const a = this.options.targetOrigin ?? this.parentOrigin ?? i.location.origin;
|
|
3859
|
-
|
|
3859
|
+
n.postMessage(e, a);
|
|
3860
3860
|
}
|
|
3861
3861
|
postEvent(e, i) {
|
|
3862
|
-
this.post({ type:
|
|
3862
|
+
this.post({ type: Gt, event: e, payload: i });
|
|
3863
3863
|
}
|
|
3864
|
-
respond(e, i,
|
|
3864
|
+
respond(e, i, n) {
|
|
3865
3865
|
this.post({
|
|
3866
3866
|
type: Vt,
|
|
3867
3867
|
requestId: e,
|
|
3868
|
-
ok: !
|
|
3869
|
-
...
|
|
3868
|
+
ok: !n,
|
|
3869
|
+
...n ? { error: n instanceof Error ? n.message : String(n) } : { result: i }
|
|
3870
3870
|
});
|
|
3871
3871
|
}
|
|
3872
3872
|
async handleMessage(e) {
|
|
3873
3873
|
const i = J();
|
|
3874
3874
|
if (!i || e.source !== i.parent || !this.isAllowedOrigin(e.origin)) return;
|
|
3875
|
-
const
|
|
3876
|
-
if (
|
|
3875
|
+
const n = Xe(e.data);
|
|
3876
|
+
if (n.type !== Ut || typeof n.command != "string") return;
|
|
3877
3877
|
this.parentOrigin = e.origin;
|
|
3878
|
-
const a = typeof
|
|
3878
|
+
const a = typeof n.requestId == "string" ? n.requestId : void 0;
|
|
3879
3879
|
try {
|
|
3880
|
-
const r = Xe(
|
|
3880
|
+
const r = Xe(n.payload);
|
|
3881
3881
|
let h;
|
|
3882
|
-
switch (
|
|
3882
|
+
switch (n.command) {
|
|
3883
3883
|
case "goToPage":
|
|
3884
3884
|
this.engine.goToPage(Math.trunc(At(r.pageIndex, "pageIndex"))), h = this.getState();
|
|
3885
3885
|
break;
|
|
@@ -3922,7 +3922,7 @@ class ps {
|
|
|
3922
3922
|
h = this.getState();
|
|
3923
3923
|
break;
|
|
3924
3924
|
default:
|
|
3925
|
-
throw new Error(`Unknown embed command: ${
|
|
3925
|
+
throw new Error(`Unknown embed command: ${n.command}`);
|
|
3926
3926
|
}
|
|
3927
3927
|
this.respond(a, h);
|
|
3928
3928
|
} catch (r) {
|
|
@@ -3937,10 +3937,10 @@ class ps {
|
|
|
3937
3937
|
};
|
|
3938
3938
|
}
|
|
3939
3939
|
}
|
|
3940
|
-
function
|
|
3941
|
-
const i = J(),
|
|
3940
|
+
function Pn(t, e = {}) {
|
|
3941
|
+
const i = J(), n = e.targetOrigin ?? (i == null ? void 0 : i.location.origin) ?? "*", a = e.responseTimeout ?? 5e3, r = /* @__PURE__ */ new Map(), h = {};
|
|
3942
3942
|
let c = 0;
|
|
3943
|
-
const g = (m) =>
|
|
3943
|
+
const g = (m) => n === "*" || m === n, v = (m) => {
|
|
3944
3944
|
var b;
|
|
3945
3945
|
if (m.source !== t.contentWindow || !g(m.origin)) return;
|
|
3946
3946
|
const w = Xe(m.data);
|
|
@@ -3950,7 +3950,7 @@ function ys(t, e = {}) {
|
|
|
3950
3950
|
r.delete(w.requestId), clearTimeout(P.timer), w.ok ? P.resolve(w.result) : P.reject(new Error(typeof w.error == "string" ? w.error : "Embed command failed."));
|
|
3951
3951
|
return;
|
|
3952
3952
|
}
|
|
3953
|
-
w.type ===
|
|
3953
|
+
w.type === Gt && typeof w.event == "string" && ((b = h[w.event]) == null || b.forEach((P) => P(w.payload)));
|
|
3954
3954
|
};
|
|
3955
3955
|
i == null || i.addEventListener("message", v);
|
|
3956
3956
|
const y = (m, w) => {
|
|
@@ -3963,7 +3963,7 @@ function ys(t, e = {}) {
|
|
|
3963
3963
|
const I = setTimeout(() => {
|
|
3964
3964
|
r.delete(b), E(new Error(`Embed command timed out: ${m}`));
|
|
3965
3965
|
}, a);
|
|
3966
|
-
r.set(b, { resolve: P, reject: E, timer: I }), t.contentWindow.postMessage({ type:
|
|
3966
|
+
r.set(b, { resolve: P, reject: E, timer: I }), t.contentWindow.postMessage({ type: Ut, command: m, payload: w, requestId: b }, n);
|
|
3967
3967
|
});
|
|
3968
3968
|
};
|
|
3969
3969
|
return {
|
|
@@ -3992,6 +3992,10 @@ function ys(t, e = {}) {
|
|
|
3992
3992
|
}
|
|
3993
3993
|
};
|
|
3994
3994
|
}
|
|
3995
|
+
function vn() {
|
|
3996
|
+
const t = globalThis.crypto;
|
|
3997
|
+
return typeof (t == null ? void 0 : t.randomUUID) == "function" ? t.randomUUID() : `note-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
3998
|
+
}
|
|
3995
3999
|
const we = class we {
|
|
3996
4000
|
constructor(e, i = {}) {
|
|
3997
4001
|
C(this, "searchSequence", 0);
|
|
@@ -4035,18 +4039,18 @@ const we = class we {
|
|
|
4035
4039
|
pdfPageMode: "auto",
|
|
4036
4040
|
deepLink: !1,
|
|
4037
4041
|
...i
|
|
4038
|
-
}, this.setupEventSync(), (i.plugins ?? []).forEach((
|
|
4042
|
+
}, this.setupEventSync(), (i.plugins ?? []).forEach((n) => this.installPlugin(n));
|
|
4039
4043
|
}
|
|
4040
4044
|
async init(e, i) {
|
|
4041
4045
|
if (typeof this.selector == "string" ? this.container = document.querySelector(this.selector) : this.container = this.selector, !this.container) return;
|
|
4042
4046
|
this.eventsReady = !1, this.destroy(!0), this.setupDeepLinkListener();
|
|
4043
|
-
const
|
|
4047
|
+
const n = this.initGeneration, a = new AbortController();
|
|
4044
4048
|
this.initAbortController = a;
|
|
4045
4049
|
let r = [], h = { ...we.DEFAULT_PAGE_VIEWPORT };
|
|
4046
4050
|
if (i && i.length > 0) {
|
|
4047
4051
|
if (a.signal.aborted) return;
|
|
4048
|
-
const w = i.filter(
|
|
4049
|
-
r =
|
|
4052
|
+
const w = i.filter(ln);
|
|
4053
|
+
r = un(w);
|
|
4050
4054
|
const b = r[0];
|
|
4051
4055
|
if (b) {
|
|
4052
4056
|
const P = await this.loadImageSize(b.low || b.normal);
|
|
@@ -4059,7 +4063,7 @@ const we = class we {
|
|
|
4059
4063
|
if (a.signal.aborted) return;
|
|
4060
4064
|
let w = "load";
|
|
4061
4065
|
try {
|
|
4062
|
-
this.pdfRenderer = new
|
|
4066
|
+
this.pdfRenderer = new pn({
|
|
4063
4067
|
scale: this.options.pdfRenderScale,
|
|
4064
4068
|
quality: this.options.pdfRenderQuality,
|
|
4065
4069
|
format: this.options.pdfRenderFormat,
|
|
@@ -4080,7 +4084,7 @@ const we = class we {
|
|
|
4080
4084
|
return;
|
|
4081
4085
|
}
|
|
4082
4086
|
}
|
|
4083
|
-
if (a.signal.aborted ||
|
|
4087
|
+
if (a.signal.aborted || n !== this.initGeneration || !r.length) return;
|
|
4084
4088
|
this.store.init(this.options, r.length, r, !!e, !(i != null && i.length) && !!e), this.applyInitialDeepLink(), this.options.textLayerProvider && (this.textLayerStop = ii(this.store, this.options.textLayerProvider, a.signal)), kt(this.container, this.options), this.container.innerHTML = "";
|
|
4085
4089
|
let c, g, v;
|
|
4086
4090
|
const y = { current: null }, S = { current: null }, m = Ji({
|
|
@@ -4137,25 +4141,25 @@ const we = class we {
|
|
|
4137
4141
|
onAnnotationActivate: (w) => this.activateAnnotation(w.id),
|
|
4138
4142
|
onAnnotationClose: () => this.closeAnnotation()
|
|
4139
4143
|
});
|
|
4140
|
-
this.container.appendChild(m), this.setupQualityLoading(), this.layoutManager = new
|
|
4144
|
+
this.container.appendChild(m), this.setupQualityLoading(), this.layoutManager = new on(h, this.store), this.layoutManager.onResizeCallback = () => {
|
|
4141
4145
|
this.pageFlipAdapter && this.pageFlipAdapter.update();
|
|
4142
|
-
}, this.layoutManager.init(c, g), this.pageFlipAdapter = new
|
|
4146
|
+
}, this.layoutManager.init(c, g), this.pageFlipAdapter = new an(v, this.options, this.store), y.current = this.pageFlipAdapter, await new Promise((w) => {
|
|
4143
4147
|
const b = () => {
|
|
4144
4148
|
a.signal.removeEventListener("abort", b), w();
|
|
4145
4149
|
};
|
|
4146
4150
|
a.signal.addEventListener("abort", b, { once: !0 }), this.initializationTimer = setTimeout(async () => {
|
|
4147
|
-
if (this.initializationTimer = null, a.signal.removeEventListener("abort", b), a.signal.aborted ||
|
|
4151
|
+
if (this.initializationTimer = null, a.signal.removeEventListener("abort", b), a.signal.aborted || n !== this.initGeneration || !this.pageFlipAdapter) {
|
|
4148
4152
|
w();
|
|
4149
4153
|
return;
|
|
4150
4154
|
}
|
|
4151
|
-
if (this.pageFlipAdapter.init(h.width, h.height), this.interactionManager = new
|
|
4155
|
+
if (this.pageFlipAdapter.init(h.width, h.height), this.interactionManager = new rn(c, this.pageFlipAdapter, this.store), this.interactionManager.init(), S.current = this.interactionManager, this.setupPdfLazyLoading(), this.pdfRenderer && e)
|
|
4152
4156
|
try {
|
|
4153
4157
|
await this.renderPdfPage(1, a.signal);
|
|
4154
4158
|
} catch {
|
|
4155
4159
|
w();
|
|
4156
4160
|
return;
|
|
4157
4161
|
}
|
|
4158
|
-
if (a.signal.aborted ||
|
|
4162
|
+
if (a.signal.aborted || n !== this.initGeneration) {
|
|
4159
4163
|
w();
|
|
4160
4164
|
return;
|
|
4161
4165
|
}
|
|
@@ -4168,13 +4172,13 @@ const we = class we {
|
|
|
4168
4172
|
return { index: e - 1, assetId: "pdf-page-" + e + "-full", pageNumber: e, sourcePageNumber: e, cropMode: "full", normal: i, low: i, thumb: i };
|
|
4169
4173
|
}
|
|
4170
4174
|
createPdfPlaceholders(e) {
|
|
4171
|
-
const i = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=",
|
|
4175
|
+
const i = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", n = [];
|
|
4172
4176
|
return e.forEach((a, r) => {
|
|
4173
4177
|
const h = r + 1;
|
|
4174
4178
|
(a.split ? ["left", "right"] : ["full"]).forEach((g) => {
|
|
4175
|
-
const v =
|
|
4176
|
-
|
|
4177
|
-
index:
|
|
4179
|
+
const v = n.length + 1;
|
|
4180
|
+
n.push({
|
|
4181
|
+
index: n.length,
|
|
4178
4182
|
assetId: `pdf-page-${h}-${g}`,
|
|
4179
4183
|
pageNumber: v,
|
|
4180
4184
|
sourcePageNumber: h,
|
|
@@ -4184,11 +4188,11 @@ const we = class we {
|
|
|
4184
4188
|
thumb: i
|
|
4185
4189
|
});
|
|
4186
4190
|
});
|
|
4187
|
-
}),
|
|
4191
|
+
}), n;
|
|
4188
4192
|
}
|
|
4189
4193
|
renderPdfPage(e, i) {
|
|
4190
|
-
const
|
|
4191
|
-
if (!
|
|
4194
|
+
const n = this.pdfRenderer, a = this.initGeneration;
|
|
4195
|
+
if (!n) return Promise.resolve("");
|
|
4192
4196
|
const r = this.pdfPageRequests.get(e);
|
|
4193
4197
|
if (r) return r;
|
|
4194
4198
|
if (this.pdfRenderedPages.has(e)) {
|
|
@@ -4200,7 +4204,7 @@ const we = class we {
|
|
|
4200
4204
|
(v.sourcePageNumber ?? v.pageNumber) === e && (v.normal = c, v.low = c, v.thumb = c);
|
|
4201
4205
|
return Promise.resolve(c || "");
|
|
4202
4206
|
}
|
|
4203
|
-
const h =
|
|
4207
|
+
const h = n.renderPageToDataUrl(e, i).then((c) => {
|
|
4204
4208
|
if (a !== this.initGeneration || i != null && i.aborted) throw this.createAbortError();
|
|
4205
4209
|
if (!c) throw new Error("PDF page " + e + " produced no image.");
|
|
4206
4210
|
return this.pdfRenderedPages.add(e), this.pdfRenderedSources.set(e, c), this.hydratePdfImages(e, c), this.emit("progress", {
|
|
@@ -4220,18 +4224,18 @@ const we = class we {
|
|
|
4220
4224
|
return this.pdfPageRequests.set(e, h), h;
|
|
4221
4225
|
}
|
|
4222
4226
|
hydratePdfImages(e, i) {
|
|
4223
|
-
var
|
|
4224
|
-
(
|
|
4227
|
+
var n;
|
|
4228
|
+
(n = this.container) == null || n.querySelectorAll("img").forEach((a) => {
|
|
4225
4229
|
a.dataset.pdfPage === String(e) && (a.src = i, delete a.dataset.pdfPage);
|
|
4226
4230
|
});
|
|
4227
4231
|
}
|
|
4228
4232
|
setupPdfLazyLoading() {
|
|
4229
4233
|
var e;
|
|
4230
|
-
(e = this.pdfLazyStop) == null || e.call(this), this.pdfLazyStop = null, this.pdfRenderer && (this.pdfLazyStop =
|
|
4231
|
-
const i = this.store.currentPage.value,
|
|
4234
|
+
(e = this.pdfLazyStop) == null || e.call(this), this.pdfLazyStop = null, this.pdfRenderer && (this.pdfLazyStop = U(() => {
|
|
4235
|
+
const i = this.store.currentPage.value, n = this.store.pages.value, r = this.store.isSingleMode.value ? [i - 1, i, i + 1] : [i - 1, i, i + 1, i % 2 === 1 ? i + 2 : i + 1], h = /* @__PURE__ */ new Set();
|
|
4232
4236
|
for (const c of r)
|
|
4233
|
-
if (c >= 0 && c <
|
|
4234
|
-
const g =
|
|
4237
|
+
if (c >= 0 && c < n.length) {
|
|
4238
|
+
const g = n[c], v = (g == null ? void 0 : g.sourcePageNumber) ?? (g == null ? void 0 : g.pageNumber);
|
|
4235
4239
|
v && h.add(v);
|
|
4236
4240
|
}
|
|
4237
4241
|
h.forEach((c) => {
|
|
@@ -4242,8 +4246,8 @@ const we = class we {
|
|
|
4242
4246
|
}
|
|
4243
4247
|
loadImageSize(e) {
|
|
4244
4248
|
return new Promise((i) => {
|
|
4245
|
-
const
|
|
4246
|
-
|
|
4249
|
+
const n = new Image();
|
|
4250
|
+
n.onload = () => i({ width: n.naturalWidth || n.width, height: n.naturalHeight || n.height }), n.onerror = () => i(null), n.src = e;
|
|
4247
4251
|
});
|
|
4248
4252
|
}
|
|
4249
4253
|
goToPage(e) {
|
|
@@ -4281,8 +4285,8 @@ const we = class we {
|
|
|
4281
4285
|
return this.pluginRegistry.getPluginNames();
|
|
4282
4286
|
}
|
|
4283
4287
|
/** Calls a namespaced API registered by a plugin. */
|
|
4284
|
-
callPluginApi(e, i, ...
|
|
4285
|
-
return this.pluginRegistry.callApi(e, i, ...
|
|
4288
|
+
callPluginApi(e, i, ...n) {
|
|
4289
|
+
return this.pluginRegistry.callApi(e, i, ...n);
|
|
4286
4290
|
}
|
|
4287
4291
|
/** Internal UI registry used by the built-in DOM renderer. */
|
|
4288
4292
|
getPluginRegistry() {
|
|
@@ -4299,10 +4303,10 @@ const we = class we {
|
|
|
4299
4303
|
/** Sets the bookmark state for a zero-based page index and emits bookmarkChange when it changes. */
|
|
4300
4304
|
setBookmark(e, i = !0) {
|
|
4301
4305
|
if (this.store.totalPages.value === 0 || !Number.isFinite(e)) return;
|
|
4302
|
-
const
|
|
4303
|
-
if (a.has(
|
|
4306
|
+
const n = Math.max(0, Math.min(this.store.totalPages.value - 1, Math.trunc(e))), a = this.store.bookmarkedPages.value;
|
|
4307
|
+
if (a.has(n) === i) return;
|
|
4304
4308
|
const r = new Set(a);
|
|
4305
|
-
i ? r.add(
|
|
4309
|
+
i ? r.add(n) : r.delete(n), this.store.bookmarkedPages.value = r, this.emit("bookmarkChange", { pageIndex: n, pageNumber: n + 1, bookmarked: i });
|
|
4306
4310
|
}
|
|
4307
4311
|
/** Toggles the bookmark state for a zero-based page index. */
|
|
4308
4312
|
toggleBookmark(e = this.getCurrentPage()) {
|
|
@@ -4319,10 +4323,10 @@ const we = class we {
|
|
|
4319
4323
|
/** Sets or clears a host-managed note and emits noteChange when it changes. */
|
|
4320
4324
|
setNote(e, i) {
|
|
4321
4325
|
if (this.store.totalPages.value === 0 || !Number.isFinite(e)) return;
|
|
4322
|
-
const
|
|
4323
|
-
if (this.store.pageNotes.value.get(
|
|
4326
|
+
const n = Math.max(0, Math.min(this.store.totalPages.value - 1, Math.trunc(e))), a = String(i ?? "").trim();
|
|
4327
|
+
if (this.store.pageNotes.value.get(n) === (a || void 0)) return;
|
|
4324
4328
|
const h = new Map(this.store.pageNotes.value);
|
|
4325
|
-
a ? h.set(
|
|
4329
|
+
a ? h.set(n, a) : h.delete(n), this.store.pageNotes.value = h, this.emit("noteChange", { pageIndex: n, pageNumber: n + 1, note: a || null });
|
|
4326
4330
|
}
|
|
4327
4331
|
/** Clears the host-managed note for a zero-based page index. */
|
|
4328
4332
|
clearNote(e = this.getCurrentPage()) {
|
|
@@ -4331,25 +4335,25 @@ const we = class we {
|
|
|
4331
4335
|
/** Searches the loaded PDF text without rendering pages and updates result highlights. */
|
|
4332
4336
|
async search(e, i = {}) {
|
|
4333
4337
|
var g;
|
|
4334
|
-
const
|
|
4338
|
+
const n = ++this.searchSequence, a = String(e ?? "").trim();
|
|
4335
4339
|
if (this.store.searchBusy.value = !1, this.store.searchFailed.value = !1, this.options.searchProvider && a) {
|
|
4336
4340
|
this.store.searchQuery.value = a, this.store.searchResults.value = [], this.store.searchBusy.value = !0;
|
|
4337
4341
|
const v = ((g = this.initAbortController) == null ? void 0 : g.signal) ?? new AbortController().signal;
|
|
4338
4342
|
try {
|
|
4339
4343
|
const y = await this.options.searchProvider(a, i, v);
|
|
4340
|
-
if (v.aborted ||
|
|
4344
|
+
if (v.aborted || n !== this.searchSequence) return [];
|
|
4341
4345
|
const S = Number.isFinite(i.maxResults) ? Math.max(1, Math.trunc(i.maxResults)) : 100;
|
|
4342
4346
|
return this.store.searchResults.value = y.filter((m) => Number.isInteger(m.pageIndex) && m.pageIndex >= 0 && m.pageIndex < this.store.totalPages.value).slice(0, S), this.emit("searchChange", { query: a, results: this.store.searchResults.value }), this.store.searchResults.value;
|
|
4343
4347
|
} catch (y) {
|
|
4344
|
-
throw !v.aborted &&
|
|
4348
|
+
throw !v.aborted && n === this.searchSequence && (this.store.searchFailed.value = !0), y;
|
|
4345
4349
|
} finally {
|
|
4346
|
-
|
|
4350
|
+
n === this.searchSequence && (this.store.searchBusy.value = !1);
|
|
4347
4351
|
}
|
|
4348
4352
|
}
|
|
4349
4353
|
if (!a || !this.pdfRenderer || !this.store.isPdfMode.value)
|
|
4350
4354
|
return this.store.searchQuery.value = a, this.store.searchResults.value = [], this.emit("searchChange", { query: a, results: [] }), [];
|
|
4351
4355
|
const r = await this.pdfRenderer.searchText(a, i);
|
|
4352
|
-
if (
|
|
4356
|
+
if (n !== this.searchSequence) return [];
|
|
4353
4357
|
const h = [];
|
|
4354
4358
|
r.forEach((v) => {
|
|
4355
4359
|
this.store.pages.value.forEach((y) => {
|
|
@@ -4364,11 +4368,11 @@ const we = class we {
|
|
|
4364
4368
|
}
|
|
4365
4369
|
mapSearchHighlights(e, i) {
|
|
4366
4370
|
if (!(e != null && e.length) || i === "full") return e ?? [];
|
|
4367
|
-
const
|
|
4371
|
+
const n = i === "right" ? 0.5 : 0;
|
|
4368
4372
|
return e.flatMap((a) => {
|
|
4369
|
-
const r = Math.max(
|
|
4373
|
+
const r = Math.max(n, a.x), h = Math.min(n + 0.5, a.x + a.width);
|
|
4370
4374
|
return h <= r ? [] : [{
|
|
4371
|
-
x: Math.max(0, Math.min(1, (r -
|
|
4375
|
+
x: Math.max(0, Math.min(1, (r - n) * 2)),
|
|
4372
4376
|
y: Math.max(0, Math.min(1, a.y)),
|
|
4373
4377
|
width: Math.max(0, Math.min(1, (h - r) * 2)),
|
|
4374
4378
|
height: Math.max(0, Math.min(1, a.height))
|
|
@@ -4383,16 +4387,16 @@ const we = class we {
|
|
|
4383
4387
|
return this.store.searchResults.value.slice();
|
|
4384
4388
|
}
|
|
4385
4389
|
/** The native editor commits locally only after host persistence succeeds. */
|
|
4386
|
-
async saveNote(e, i,
|
|
4390
|
+
async saveNote(e, i, n) {
|
|
4387
4391
|
var h, c, g;
|
|
4388
4392
|
if (this.store.notesSaving.value || !Number.isInteger(e) || e < 0 || e >= this.store.totalPages.value) return !1;
|
|
4389
4393
|
const a = ((h = this.initAbortController) == null ? void 0 : h.signal) ?? new AbortController().signal, r = (i == null ? void 0 : i.trim()) || null;
|
|
4390
4394
|
this.store.notesSaving.value = !0, this.store.notesFailed.value = !1;
|
|
4391
4395
|
try {
|
|
4392
|
-
if (await ((g = (c = this.options).noteProvider) == null ? void 0 : g.call(c, e, r, a,
|
|
4396
|
+
if (await ((g = (c = this.options).noteProvider) == null ? void 0 : g.call(c, e, r, a, n)), a.aborted) return !1;
|
|
4393
4397
|
this.setNote(e, r ?? "");
|
|
4394
4398
|
const v = new Map(this.store.pageNoteDocuments.value);
|
|
4395
|
-
return
|
|
4399
|
+
return n && r ? v.set(e, n) : v.delete(e), this.store.pageNoteDocuments.value = v, !0;
|
|
4396
4400
|
} catch {
|
|
4397
4401
|
return a.aborted || (this.store.notesFailed.value = !0), !1;
|
|
4398
4402
|
} finally {
|
|
@@ -4403,7 +4407,7 @@ const we = class we {
|
|
|
4403
4407
|
return this.store.hotspots.value.filter((i) => i.pageIndex === e);
|
|
4404
4408
|
}
|
|
4405
4409
|
activateHotspot(e) {
|
|
4406
|
-
const i = this.store.hotspots.value.find((
|
|
4410
|
+
const i = this.store.hotspots.value.find((n) => n.id === e);
|
|
4407
4411
|
i && (this.store.activeHotspotId.value = i.id, this.emit("hotspotActivate", { hotspot: i, pageIndex: i.pageIndex }));
|
|
4408
4412
|
}
|
|
4409
4413
|
closeHotspot() {
|
|
@@ -4413,7 +4417,7 @@ const we = class we {
|
|
|
4413
4417
|
return this.store.annotations.value.filter((i) => i.pageIndex === e);
|
|
4414
4418
|
}
|
|
4415
4419
|
activateAnnotation(e) {
|
|
4416
|
-
const i = this.store.annotations.value.find((
|
|
4420
|
+
const i = this.store.annotations.value.find((n) => n.id === e);
|
|
4417
4421
|
i && (this.goToPage(i.pageIndex), this.store.showNotes.value = !1, this.store.showToc.value = !1, this.store.showSearch.value = !1, this.store.activeAnnotationId.value = i.id, this.emit("annotationActivate", { annotation: i, pageIndex: i.pageIndex }));
|
|
4418
4422
|
}
|
|
4419
4423
|
closeAnnotation() {
|
|
@@ -4422,65 +4426,65 @@ const we = class we {
|
|
|
4422
4426
|
beginAnnotation() {
|
|
4423
4427
|
this.store.canAnnotate.value && (this.closeAnnotation(), this.store.showNotes.value = !1, this.store.showToc.value = !1, this.store.showSearch.value = !1, this.store.textSelection.value = !1, this.store.placingNote.value = !0, queueMicrotask(() => {
|
|
4424
4428
|
var e, i;
|
|
4425
|
-
this.store.placingNote.value && ((i = [...((e = this.container) == null ? void 0 : e.querySelectorAll(".bk-note-placement-layer")) ?? []].find((
|
|
4429
|
+
this.store.placingNote.value && ((i = [...((e = this.container) == null ? void 0 : e.querySelectorAll(".bk-note-placement-layer")) ?? []].find((n) => n.getBoundingClientRect().width > 0)) == null || i.focus());
|
|
4426
4430
|
}));
|
|
4427
4431
|
}
|
|
4428
|
-
placeAnnotation(e, i,
|
|
4429
|
-
!this.store.placingNote.value || !Number.isInteger(e) || e < 0 || e >= this.store.totalPages.value || !Number.isFinite(i) || !Number.isFinite(
|
|
4432
|
+
placeAnnotation(e, i, n) {
|
|
4433
|
+
!this.store.placingNote.value || !Number.isInteger(e) || e < 0 || e >= this.store.totalPages.value || !Number.isFinite(i) || !Number.isFinite(n) || (this.goToPage(e), this.store.pendingAnnotation.value = { id: vn(), pageIndex: e, x: Math.max(0, Math.min(1, i)), y: Math.max(0, Math.min(1, n)), text: "" }, this.store.placingNote.value = !1);
|
|
4430
4434
|
}
|
|
4431
4435
|
async saveAnnotation(e, i = "save") {
|
|
4432
4436
|
var r;
|
|
4433
4437
|
if (!this.options.annotationProvider || this.store.notesSaving.value || !e.id || !Number.isInteger(e.pageIndex) || e.pageIndex < 0 || e.pageIndex >= this.store.totalPages.value || !Number.isFinite(e.x) || !Number.isFinite(e.y) || e.x < 0 || e.x > 1 || e.y < 0 || e.y > 1 || i === "save" && (!e.text.trim() || e.text.length > 4e3)) return !1;
|
|
4434
|
-
const
|
|
4438
|
+
const n = ((r = this.initAbortController) == null ? void 0 : r.signal) ?? new AbortController().signal, a = { ...e, text: e.text.trim() };
|
|
4435
4439
|
this.store.notesSaving.value = !0, this.store.notesFailed.value = !1;
|
|
4436
4440
|
try {
|
|
4437
|
-
if (await this.options.annotationProvider(a, i,
|
|
4441
|
+
if (await this.options.annotationProvider(a, i, n), n.aborted) return !1;
|
|
4438
4442
|
const h = this.store.annotations.value.filter((c) => c.id !== a.id);
|
|
4439
4443
|
return this.store.annotations.value = i === "delete" ? h : [...h, a], this.store.pendingAnnotation.value = null, this.store.activeAnnotationId.value = i === "delete" ? null : a.id, this.emit("annotationChange", { annotation: a, action: i }), !0;
|
|
4440
4444
|
} catch {
|
|
4441
|
-
return
|
|
4445
|
+
return n.aborted || (this.store.notesFailed.value = !0), !1;
|
|
4442
4446
|
} finally {
|
|
4443
|
-
|
|
4447
|
+
n.aborted || (this.store.notesSaving.value = !1);
|
|
4444
4448
|
}
|
|
4445
4449
|
}
|
|
4446
4450
|
getZoom() {
|
|
4447
4451
|
return this.store.zoomState.value.scale;
|
|
4448
4452
|
}
|
|
4449
4453
|
setZoom(e) {
|
|
4450
|
-
const i = Number.isFinite(e) ? e : 1,
|
|
4454
|
+
const i = Number.isFinite(e) ? e : 1, n = Math.max(0.5, Math.min(5, i));
|
|
4451
4455
|
this.store.zoomState.value = {
|
|
4452
4456
|
...this.store.zoomState.value,
|
|
4453
|
-
scale:
|
|
4454
|
-
isActive:
|
|
4455
|
-
...
|
|
4456
|
-
}, this.store.isZoomed.value =
|
|
4457
|
+
scale: n,
|
|
4458
|
+
isActive: n > 1,
|
|
4459
|
+
...n <= 1 ? { translateX: 0, translateY: 0 } : {}
|
|
4460
|
+
}, this.store.isZoomed.value = n > 1;
|
|
4457
4461
|
}
|
|
4458
4462
|
nextPage() {
|
|
4459
4463
|
this.pageFlipAdapter && this.pageFlipAdapter.turnToNextPage();
|
|
4460
4464
|
}
|
|
4461
4465
|
toggleFullscreen() {
|
|
4462
|
-
var i,
|
|
4466
|
+
var i, n;
|
|
4463
4467
|
const e = this.container;
|
|
4464
|
-
e && (document.fullscreenElement ? (
|
|
4468
|
+
e && (document.fullscreenElement ? (n = document.exitFullscreen) == null || n.call(document).catch((a) => console.warn("Exit fullscreen err:", a)) : (i = e.requestFullscreen) == null || i.call(e).catch((a) => console.warn("Fullscreen err:", a)));
|
|
4465
4469
|
}
|
|
4466
4470
|
setLocale(e, i) {
|
|
4467
|
-
const
|
|
4468
|
-
this.options = { ...this.options, locale: e, messages:
|
|
4471
|
+
const n = i ? { ...this.options.messages, [e]: i[e] ?? i } : this.options.messages;
|
|
4472
|
+
this.options = { ...this.options, locale: e, messages: n }, this.store.locale.value = e, n && (this.store.messages.value = n);
|
|
4469
4473
|
}
|
|
4470
4474
|
prevPage() {
|
|
4471
4475
|
this.pageFlipAdapter && this.pageFlipAdapter.turnToPrevPage();
|
|
4472
4476
|
}
|
|
4473
4477
|
setSingleMode(e) {
|
|
4474
4478
|
this.options = { ...this.options, singleMode: e, isSingleMode: e }, this.store.isSingleMode.value = e, e && this.pdfRenderer && setTimeout(() => {
|
|
4475
|
-
const i = this.store.pages.value[this.store.currentPage.value],
|
|
4476
|
-
|
|
4479
|
+
const i = this.store.pages.value[this.store.currentPage.value], n = (i == null ? void 0 : i.sourcePageNumber) ?? (i == null ? void 0 : i.pageNumber);
|
|
4480
|
+
n && this.renderPdfPage(n).catch(() => {
|
|
4477
4481
|
});
|
|
4478
4482
|
}, 0);
|
|
4479
4483
|
}
|
|
4480
4484
|
updateOptions(e) {
|
|
4481
4485
|
"annotationProvider" in e && (this.store.canAnnotate.value = !!e.annotationProvider), "searchProvider" in e && (this.store.searchAvailable.value = !!e.searchProvider || this.store.isPdfMode.value);
|
|
4482
4486
|
const i = e.deepLink !== void 0 && e.deepLink !== this.options.deepLink;
|
|
4483
|
-
this.options = { ...this.options, ...e }, i && (this.options.deepLink ? this.setupDeepLinkListener() : this.teardownDeepLinkListener()), e.theme !== void 0 && (this.store.themeMode.value = e.theme), e.primaryColor !== void 0 && (this.store.primaryColor.value = e.primaryColor), e.showThumbs !== void 0 && (this.store.showThumbs.value = e.showThumbs), e.showToc !== void 0 && (this.store.showToc.value = e.showToc), e.toc !== void 0 && (this.store.toc.value = je(e.toc, this.store.totalPages.value)), e.showArrows !== void 0 && (this.store.showArrows.value = e.showArrows), e.allowDownload !== void 0 && (this.store.allowDownload.value = e.allowDownload), e.whiteLabel !== void 0 && (this.store.whiteLabel.value = e.whiteLabel), e.soundEnabled !== void 0 && (this.store.soundEnabled.value = e.soundEnabled), e.locale !== void 0 && (this.store.locale.value = e.locale), e.messages !== void 0 && (this.store.messages.value = e.messages), e.singleMode !== void 0 && (this.store.isSingleMode.value = e.singleMode), e.isSingleMode !== void 0 && (this.store.isSingleMode.value = e.isSingleMode), e.autoPlay !== void 0 && (this.store.isAutoPlaying.value = e.autoPlay), e.autoPlayInterval !== void 0 && (this.store.autoPlayInterval.value = e.autoPlayInterval), e.bookmarks !== void 0 && (this.store.bookmarkedPages.value = new Set(e.bookmarks.map((
|
|
4487
|
+
this.options = { ...this.options, ...e }, i && (this.options.deepLink ? this.setupDeepLinkListener() : this.teardownDeepLinkListener()), e.theme !== void 0 && (this.store.themeMode.value = e.theme), e.primaryColor !== void 0 && (this.store.primaryColor.value = e.primaryColor), e.showThumbs !== void 0 && (this.store.showThumbs.value = e.showThumbs), e.showToc !== void 0 && (this.store.showToc.value = e.showToc), e.toc !== void 0 && (this.store.toc.value = je(e.toc, this.store.totalPages.value)), e.showArrows !== void 0 && (this.store.showArrows.value = e.showArrows), e.allowDownload !== void 0 && (this.store.allowDownload.value = e.allowDownload), e.whiteLabel !== void 0 && (this.store.whiteLabel.value = e.whiteLabel), e.soundEnabled !== void 0 && (this.store.soundEnabled.value = e.soundEnabled), e.locale !== void 0 && (this.store.locale.value = e.locale), e.messages !== void 0 && (this.store.messages.value = e.messages), e.singleMode !== void 0 && (this.store.isSingleMode.value = e.singleMode), e.isSingleMode !== void 0 && (this.store.isSingleMode.value = e.isSingleMode), e.autoPlay !== void 0 && (this.store.isAutoPlaying.value = e.autoPlay), e.autoPlayInterval !== void 0 && (this.store.autoPlayInterval.value = e.autoPlayInterval), e.bookmarks !== void 0 && (this.store.bookmarkedPages.value = new Set(e.bookmarks.map((n) => Math.trunc(n)).filter((n) => Number.isInteger(n) && n >= 0 && n < this.store.totalPages.value))), e.notes !== void 0 && (this.store.pageNotes.value = new Map(Object.entries(e.notes).map(([n, a]) => [Math.trunc(Number(n)), String(a).trim()]).filter(([n, a]) => Number.isInteger(n) && n >= 0 && n < this.store.totalPages.value && a.length > 0))), e.hotspots !== void 0 && (this.store.hotspots.value = e.hotspots), e.annotations !== void 0 && (this.store.annotations.value = e.annotations), this.container && kt(this.container, this.options);
|
|
4484
4488
|
}
|
|
4485
4489
|
setupDeepLinkListener() {
|
|
4486
4490
|
this.teardownDeepLinkListener(), !(!this.options.deepLink || typeof window > "u") && (this.deepLinkListener = () => {
|
|
@@ -4496,7 +4500,7 @@ const we = class we {
|
|
|
4496
4500
|
var i;
|
|
4497
4501
|
if (!e || this.store.totalPages.value === 0) return null;
|
|
4498
4502
|
try {
|
|
4499
|
-
const
|
|
4503
|
+
const n = new URL(e, typeof document > "u" ? void 0 : document.baseURI), a = (i = n.hash.match(/(?:^#|&)page=(\d+)/i)) == null ? void 0 : i[1], r = n.searchParams.get("page") ?? a;
|
|
4500
4504
|
if (r == null) return 0;
|
|
4501
4505
|
const h = Number(r);
|
|
4502
4506
|
return !Number.isInteger(h) || h < 1 ? null : Math.min(h - 1, this.store.totalPages.value - 1);
|
|
@@ -4511,30 +4515,30 @@ const we = class we {
|
|
|
4511
4515
|
}
|
|
4512
4516
|
updateDeepLink(e) {
|
|
4513
4517
|
if (!this.options.deepLink || typeof window > "u" || this.store.totalPages.value === 0) return;
|
|
4514
|
-
const i = Math.max(0, Math.min(this.store.totalPages.value - 1, Math.trunc(e))),
|
|
4518
|
+
const i = Math.max(0, Math.min(this.store.totalPages.value - 1, Math.trunc(e))), n = i + 1;
|
|
4515
4519
|
try {
|
|
4516
4520
|
const a = new URL(window.location.href);
|
|
4517
|
-
a.searchParams.set("page", String(
|
|
4521
|
+
a.searchParams.set("page", String(n));
|
|
4518
4522
|
const r = a.toString();
|
|
4519
|
-
r !== window.location.href && window.history.replaceState(window.history.state, "", r), this.emit("deepLinkChange", { pageIndex: i, pageNumber:
|
|
4523
|
+
r !== window.location.href && window.history.replaceState(window.history.state, "", r), this.emit("deepLinkChange", { pageIndex: i, pageNumber: n, url: r });
|
|
4520
4524
|
} catch {
|
|
4521
4525
|
}
|
|
4522
4526
|
}
|
|
4523
4527
|
/** Returns a shareable URL addressing a 1-based page number. */
|
|
4524
4528
|
getPageUrl(e = this.getCurrentPage()) {
|
|
4525
4529
|
if (typeof window > "u") return "";
|
|
4526
|
-
const i = this.getTotalPages(),
|
|
4527
|
-
return a.searchParams.set("page", String(
|
|
4530
|
+
const i = this.getTotalPages(), n = i > 0 ? Math.max(0, Math.min(i - 1, Math.trunc(e))) : Math.max(0, Math.trunc(e)), a = new URL(window.location.href);
|
|
4531
|
+
return a.searchParams.set("page", String(n + 1)), a.toString();
|
|
4528
4532
|
}
|
|
4529
4533
|
/** Opens the native share dialog or copies a page URL to the clipboard. */
|
|
4530
4534
|
async sharePage(e = this.getCurrentPage()) {
|
|
4531
|
-
var
|
|
4535
|
+
var n;
|
|
4532
4536
|
const i = this.getPageUrl(e);
|
|
4533
|
-
return typeof navigator < "u" && typeof navigator.share == "function" ? await navigator.share({ title: typeof document > "u" ? void 0 : document.title, url: i }) : typeof navigator < "u" && ((
|
|
4537
|
+
return typeof navigator < "u" && typeof navigator.share == "function" ? await navigator.share({ title: typeof document > "u" ? void 0 : document.title, url: i }) : typeof navigator < "u" && ((n = navigator.clipboard) != null && n.writeText) && await navigator.clipboard.writeText(i), i;
|
|
4534
4538
|
}
|
|
4535
4539
|
/** Connects an optional postMessage bridge for iframe/embed integrations. */
|
|
4536
4540
|
connectEmbed(e = {}) {
|
|
4537
|
-
return new
|
|
4541
|
+
return new mn(this, e).connect();
|
|
4538
4542
|
}
|
|
4539
4543
|
async setPages(e, i) {
|
|
4540
4544
|
if (!(e != null && e.length)) {
|
|
@@ -4555,8 +4559,8 @@ const we = class we {
|
|
|
4555
4559
|
}
|
|
4556
4560
|
const c = r.dataset.src;
|
|
4557
4561
|
c && (r.src = c, delete r.dataset.src);
|
|
4558
|
-
},
|
|
4559
|
-
if (!
|
|
4562
|
+
}, n = (a = this.container.ownerDocument.defaultView) == null ? void 0 : a.IntersectionObserver;
|
|
4563
|
+
if (!n) {
|
|
4560
4564
|
const r = /* @__PURE__ */ new Set();
|
|
4561
4565
|
e.forEach((h) => {
|
|
4562
4566
|
const c = Number(h.dataset.pdfPage);
|
|
@@ -4564,7 +4568,7 @@ const we = class we {
|
|
|
4564
4568
|
});
|
|
4565
4569
|
return;
|
|
4566
4570
|
}
|
|
4567
|
-
this.qualityObserver = new
|
|
4571
|
+
this.qualityObserver = new n((r) => {
|
|
4568
4572
|
r.forEach((h) => {
|
|
4569
4573
|
var c;
|
|
4570
4574
|
h.isIntersecting && (i(h.target), (c = this.qualityObserver) == null || c.unobserve(h.target));
|
|
@@ -4579,7 +4583,7 @@ const we = class we {
|
|
|
4579
4583
|
(e = this.qualityObserver) == null || e.disconnect(), this.qualityObserver = null;
|
|
4580
4584
|
}
|
|
4581
4585
|
setupEventSync() {
|
|
4582
|
-
this.eventSyncStop =
|
|
4586
|
+
this.eventSyncStop = U(() => {
|
|
4583
4587
|
const e = {
|
|
4584
4588
|
currentPage: this.store.currentPage.value,
|
|
4585
4589
|
zoom: this.store.zoomState.value.scale,
|
|
@@ -4616,8 +4620,8 @@ const we = class we {
|
|
|
4616
4620
|
this.store.textSelection.value = !!e;
|
|
4617
4621
|
}
|
|
4618
4622
|
destroy(e = !1) {
|
|
4619
|
-
var
|
|
4620
|
-
(
|
|
4623
|
+
var n, a, r;
|
|
4624
|
+
(n = this.textLayerStop) == null || n.call(this), this.textLayerStop = null;
|
|
4621
4625
|
const i = this.hasActiveSession || !!this.initAbortController || !!this.pageFlipAdapter || !!this.layoutManager || !!this.interactionManager || !!this.pdfRenderer;
|
|
4622
4626
|
this.initGeneration++, this.teardownDeepLinkListener(), (a = this.initAbortController) == null || a.abort(), this.initAbortController = null, this.initializationTimer && (clearTimeout(this.initializationTimer), this.initializationTimer = null), this.pageFlipAdapter && this.pageFlipAdapter.destroy(), this.layoutManager && this.layoutManager.destroy(), this.interactionManager && this.interactionManager.destroy(), this.teardownQualityLoading(), (r = this.pdfLazyStop) == null || r.call(this), this.pdfLazyStop = null, this.pdfPageRequests.clear(), this.pdfRenderedPages.clear(), this.pdfRenderedSources.clear(), this.pdfSourcePageCount = 0, this.pdfRenderer && this.pdfRenderer.destroy(), this.pageFlipAdapter = null, this.layoutManager = null, this.interactionManager = null, this.pdfRenderer = null, this.eventsReady = !1, this.hasActiveSession = !1, this.store.reset(), !e && this.container && (this.container.innerHTML = ""), i && this.emit("destroy", void 0), e || this.pluginRegistry.clear();
|
|
4623
4627
|
}
|
|
@@ -4626,16 +4630,16 @@ const we = class we {
|
|
|
4626
4630
|
return e.name = "AbortError", e;
|
|
4627
4631
|
}
|
|
4628
4632
|
on(e, i) {
|
|
4629
|
-
const
|
|
4630
|
-
return
|
|
4633
|
+
const n = this.listeners[e] ?? /* @__PURE__ */ new Set();
|
|
4634
|
+
return n.add(i), this.listeners[e] = n, () => this.off(e, i);
|
|
4631
4635
|
}
|
|
4632
4636
|
off(e, i) {
|
|
4633
|
-
var
|
|
4634
|
-
(
|
|
4637
|
+
var n;
|
|
4638
|
+
(n = this.listeners[e]) == null || n.delete(i);
|
|
4635
4639
|
}
|
|
4636
4640
|
emit(e, i) {
|
|
4637
|
-
var
|
|
4638
|
-
(
|
|
4641
|
+
var n;
|
|
4642
|
+
(n = this.listeners[e]) == null || n.forEach((a) => {
|
|
4639
4643
|
a(i);
|
|
4640
4644
|
});
|
|
4641
4645
|
}
|
|
@@ -4646,12 +4650,12 @@ const jt = globalThis, Xt = jt.FlipbookEngine || {};
|
|
|
4646
4650
|
Xt.FlipbookEngine = Ye;
|
|
4647
4651
|
jt.FlipbookEngine = Xt;
|
|
4648
4652
|
export {
|
|
4649
|
-
|
|
4653
|
+
mn as F,
|
|
4650
4654
|
Ye as a,
|
|
4651
|
-
|
|
4652
|
-
|
|
4655
|
+
ln as b,
|
|
4656
|
+
Pn as c,
|
|
4653
4657
|
je as d,
|
|
4654
|
-
|
|
4655
|
-
|
|
4658
|
+
fn as i,
|
|
4659
|
+
un as n
|
|
4656
4660
|
};
|
|
4657
|
-
//# sourceMappingURL=engine-
|
|
4661
|
+
//# sourceMappingURL=engine-B7R3u8jR.js.map
|