@zinejs/core 0.9.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controls/sidebar.d.ts +2 -0
- package/dist/controls/types.d.ts +3 -0
- package/dist/{controls-DzVdwPJB.js → controls-Dh1okIx6.js} +50 -43
- package/dist/controls-Dh1okIx6.js.map +1 -0
- package/dist/cssRenderer-DAW29lU2.js +156 -0
- package/dist/cssRenderer-DAW29lU2.js.map +1 -0
- package/dist/engine/gutter.d.ts +12 -0
- package/dist/gutter-C3H2CDT2.js +43 -0
- package/dist/gutter-C3H2CDT2.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +678 -564
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +14 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/loading/loading.d.ts +2 -1
- package/dist/{loading-DF88K9yJ.js → loading-BgbqJz5k.js} +7 -8
- package/dist/loading-BgbqJz5k.js.map +1 -0
- package/dist/renderer/cssRenderer.d.ts +1 -1
- package/dist/renderer/types.d.ts +20 -0
- package/dist/renderer/webglRenderer.d.ts +1 -1
- package/dist/{share-Cq3RsjPr.js → share-CZorhnKI.js} +24 -21
- package/dist/share-CZorhnKI.js.map +1 -0
- package/dist/strings.d.ts +74 -0
- package/dist/types-DYqgosP1.js +9 -0
- package/dist/types-DYqgosP1.js.map +1 -0
- package/dist/webglRenderer-9RcNHAy-.js +430 -0
- package/dist/webglRenderer-9RcNHAy-.js.map +1 -0
- package/dist/zine.d.ts +18 -0
- package/options.schema.json +18 -0
- package/package.json +2 -2
- package/dist/controls-DzVdwPJB.js.map +0 -1
- package/dist/cssRenderer-Deskm2ND.js +0 -133
- package/dist/cssRenderer-Deskm2ND.js.map +0 -1
- package/dist/loading-DF88K9yJ.js.map +0 -1
- package/dist/share-Cq3RsjPr.js.map +0 -1
- package/dist/webglRenderer-CmQ_mUrX.js +0 -399
- package/dist/webglRenderer-CmQ_mUrX.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -281,28 +281,28 @@ function ee(e, t) {
|
|
|
281
281
|
//#endregion
|
|
282
282
|
//#region src/renderer/select.ts
|
|
283
283
|
var te = {
|
|
284
|
-
css: async () => new (await (import("./cssRenderer-
|
|
285
|
-
webgl2: async () => new (await (import("./webglRenderer-
|
|
286
|
-
},
|
|
287
|
-
function w(e) {
|
|
288
|
-
return typeof e == "object" && !!e && !Array.isArray(e) && typeof e.mount == "function";
|
|
289
|
-
}
|
|
284
|
+
css: async () => new (await (import("./cssRenderer-DAW29lU2.js"))).CssRenderer(),
|
|
285
|
+
webgl2: async () => new (await (import("./webglRenderer-9RcNHAy-.js"))).WebglRenderer()
|
|
286
|
+
}, w = !0;
|
|
290
287
|
function T(e) {
|
|
291
|
-
return e
|
|
288
|
+
return typeof e == "object" && !!e && !Array.isArray(e) && typeof e.mount == "function";
|
|
292
289
|
}
|
|
293
|
-
function E() {
|
|
294
|
-
return
|
|
290
|
+
function E(e) {
|
|
291
|
+
return e.gpu && w ? ["webgl2", "css"] : ["css"];
|
|
295
292
|
}
|
|
296
293
|
function D() {
|
|
294
|
+
return { gpu: ne() };
|
|
295
|
+
}
|
|
296
|
+
function ne() {
|
|
297
297
|
try {
|
|
298
298
|
return !!document.createElement("canvas").getContext("webgl2");
|
|
299
299
|
} catch {
|
|
300
300
|
return !1;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
async function O(e = "auto", t =
|
|
304
|
-
if (
|
|
305
|
-
let n = Array.isArray(e) ? e : e === "auto" ?
|
|
303
|
+
async function O(e = "auto", t = D()) {
|
|
304
|
+
if (T(e)) return e;
|
|
305
|
+
let n = Array.isArray(e) ? e : e === "auto" ? E(t) : [e];
|
|
306
306
|
for (let e of n) {
|
|
307
307
|
if (e === "webgl2" && !t.gpu) continue;
|
|
308
308
|
let n = te[e];
|
|
@@ -395,12 +395,81 @@ var ae = class {
|
|
|
395
395
|
throw this.#a.delete(e), t;
|
|
396
396
|
}), this.#a.set(e, t)), t;
|
|
397
397
|
}
|
|
398
|
-
}, k =
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
}, k = {
|
|
399
|
+
prevPage: "Previous page",
|
|
400
|
+
nextPage: "Next page",
|
|
401
|
+
firstPage: "First page",
|
|
402
|
+
lastPage: "Last page",
|
|
403
|
+
zoomIn: "Zoom in",
|
|
404
|
+
zoomOut: "Zoom out",
|
|
405
|
+
fullscreen: "Fullscreen",
|
|
406
|
+
mute: "Mute page sound",
|
|
407
|
+
unmute: "Unmute page sound",
|
|
408
|
+
share: "Share",
|
|
409
|
+
downloadPdf: "Download PDF",
|
|
410
|
+
showOnePage: "Show one page",
|
|
411
|
+
showTwoPages: "Show two pages",
|
|
412
|
+
print: "Print",
|
|
413
|
+
more: "More",
|
|
414
|
+
controlsLabel: "Flipbook controls",
|
|
415
|
+
showThumbnails: "Show thumbnails",
|
|
416
|
+
hideThumbnails: "Hide thumbnails",
|
|
417
|
+
showOutline: "Show outline",
|
|
418
|
+
hideOutline: "Hide outline",
|
|
419
|
+
searchOpen: "Search",
|
|
420
|
+
searchClose: "Hide search",
|
|
421
|
+
pageWidgetLabel: "Page",
|
|
422
|
+
pageNumberLabel: "Page number",
|
|
423
|
+
roledescription: "flipbook",
|
|
424
|
+
thumbnailsLabel: "Pages",
|
|
425
|
+
outlineLabel: "Outline",
|
|
426
|
+
outlineLoading: "Loading…",
|
|
427
|
+
outlineEmpty: "This document has no outline.",
|
|
428
|
+
untitled: "Untitled",
|
|
429
|
+
searchResultsLabel: "Search results",
|
|
430
|
+
searchPlaceholder: "Search…",
|
|
431
|
+
searchInputLabel: "Search the document",
|
|
432
|
+
searching: "Searching…",
|
|
433
|
+
loadingOpening: "Opening document…",
|
|
434
|
+
loadingPreparing: "Preparing pages…",
|
|
435
|
+
shareFallbackTitle: "Flipbook",
|
|
436
|
+
close: "Close",
|
|
437
|
+
copy: "Copy",
|
|
438
|
+
copied: "Copied",
|
|
439
|
+
copyManual: "Press Ctrl+C",
|
|
440
|
+
qrLabel: "QR code for this page",
|
|
441
|
+
linkLabel: "Link to this page",
|
|
442
|
+
email: "Email",
|
|
443
|
+
panHint: "Drag to move",
|
|
444
|
+
pageAnnounce: (e, t) => `Page ${e} of ${t}`,
|
|
445
|
+
pageTotal: (e) => `/ ${e}`,
|
|
446
|
+
downloadingPercent: (e) => `Downloading document… ${e}%`,
|
|
447
|
+
downloadingSize: (e) => `Downloading document… ${e.toFixed(1)} MB`,
|
|
448
|
+
zoomHint: ({ doubleClick: e, wheel: t, mac: n }) => {
|
|
449
|
+
let r = [];
|
|
450
|
+
return e && r.push("Double-click"), t && r.push(`${n ? "⌘" : "Ctrl"}-scroll`), `${r.join(" or ")} to zoom`;
|
|
451
|
+
},
|
|
452
|
+
noMatches: (e) => `No matches for “${e}”`,
|
|
453
|
+
searchHitLabel: (e) => `Page ${e}`,
|
|
454
|
+
searchHitAria: (e, t) => `Page ${e}: ${t}`,
|
|
455
|
+
shareOn: (e) => `Share on ${e}`,
|
|
456
|
+
thumbnailAria: (e) => e.length > 1 ? `Pages ${e[0]}–${e.at(-1)}` : `Page ${e[0] ?? ""}`,
|
|
457
|
+
outlineEntryAria: (e, t) => `${e}, page ${t}`
|
|
458
|
+
};
|
|
459
|
+
function oe(e) {
|
|
460
|
+
return e ? {
|
|
461
|
+
...k,
|
|
462
|
+
...e
|
|
463
|
+
} : k;
|
|
464
|
+
}
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/zine.ts
|
|
467
|
+
var A = .25, j = .0015, M = 6, N = 250, P = 24, F = 2 * N, I = 1.2, L = 32, R = 60, z = 2.5, B = 1.5, V = 120, H = .85, U = .82, W = .12, G = 360, se = 28, K = 260, ce = 7e3, le = 2200, q = "zine:hints-learned", J = "zine:sound-muted";
|
|
468
|
+
function ue(e, t, n) {
|
|
469
|
+
let r = Math.max(0, t - L), i = Math.min(e.length, t + n + L), a = e.slice(r, i).replace(/\s+/g, " ").trim();
|
|
401
470
|
return `${r > 0 ? "…" : ""}${a}${i < e.length ? "…" : ""}`;
|
|
402
471
|
}
|
|
403
|
-
var
|
|
472
|
+
var Y = class {
|
|
404
473
|
#e;
|
|
405
474
|
#t;
|
|
406
475
|
#n = new l();
|
|
@@ -415,140 +484,145 @@ var ce = class {
|
|
|
415
484
|
#d;
|
|
416
485
|
#f;
|
|
417
486
|
#p = null;
|
|
418
|
-
#m =
|
|
487
|
+
#m = /* @__PURE__ */ new Map();
|
|
419
488
|
#h;
|
|
420
489
|
#g;
|
|
421
490
|
#_;
|
|
422
|
-
#v;
|
|
491
|
+
#v = null;
|
|
423
492
|
#y = null;
|
|
424
|
-
#b
|
|
425
|
-
#x
|
|
426
|
-
#S
|
|
427
|
-
#C
|
|
493
|
+
#b;
|
|
494
|
+
#x;
|
|
495
|
+
#S;
|
|
496
|
+
#C;
|
|
497
|
+
#w = null;
|
|
498
|
+
#T = !1;
|
|
499
|
+
#E = !1;
|
|
500
|
+
#D = !1;
|
|
501
|
+
#O = {
|
|
428
502
|
turn: !1,
|
|
429
503
|
zoom: !1,
|
|
430
504
|
pan: !1
|
|
431
505
|
};
|
|
432
|
-
#w = null;
|
|
433
|
-
#T = null;
|
|
434
|
-
#E = null;
|
|
435
|
-
#D = null;
|
|
436
|
-
#O = null;
|
|
437
506
|
#k = null;
|
|
438
|
-
#A =
|
|
439
|
-
#j =
|
|
440
|
-
#M;
|
|
441
|
-
#N;
|
|
442
|
-
#P;
|
|
507
|
+
#A = null;
|
|
508
|
+
#j = null;
|
|
509
|
+
#M = null;
|
|
510
|
+
#N = null;
|
|
511
|
+
#P = null;
|
|
443
512
|
#F = !1;
|
|
444
|
-
#I =
|
|
445
|
-
#L
|
|
513
|
+
#I = "";
|
|
514
|
+
#L;
|
|
446
515
|
#R;
|
|
447
|
-
#z
|
|
448
|
-
#B;
|
|
449
|
-
#V;
|
|
450
|
-
#H;
|
|
451
|
-
#U
|
|
516
|
+
#z;
|
|
517
|
+
#B = !1;
|
|
518
|
+
#V = null;
|
|
519
|
+
#H = !1;
|
|
520
|
+
#U;
|
|
452
521
|
#W = null;
|
|
453
|
-
#G
|
|
454
|
-
#K
|
|
455
|
-
#q
|
|
456
|
-
#J =
|
|
522
|
+
#G;
|
|
523
|
+
#K;
|
|
524
|
+
#q;
|
|
525
|
+
#J = null;
|
|
526
|
+
#Y = null;
|
|
527
|
+
#X = [];
|
|
528
|
+
#Z = 0;
|
|
529
|
+
#Q = 0;
|
|
530
|
+
#$ = {
|
|
457
531
|
left: null,
|
|
458
532
|
right: null
|
|
459
533
|
};
|
|
460
|
-
#
|
|
461
|
-
#
|
|
462
|
-
#
|
|
463
|
-
#
|
|
464
|
-
|
|
465
|
-
#ee = null;
|
|
466
|
-
#te = !1;
|
|
467
|
-
#ne = 1;
|
|
468
|
-
#re = 0;
|
|
469
|
-
#ie = 0;
|
|
534
|
+
#ee;
|
|
535
|
+
#te;
|
|
536
|
+
#ne;
|
|
537
|
+
#re;
|
|
538
|
+
#ie;
|
|
470
539
|
#ae = null;
|
|
471
540
|
#oe = !1;
|
|
472
|
-
#se =
|
|
473
|
-
#ce =
|
|
474
|
-
#le =
|
|
541
|
+
#se = 1;
|
|
542
|
+
#ce = 0;
|
|
543
|
+
#le = 0;
|
|
475
544
|
#ue = null;
|
|
476
|
-
#de =
|
|
477
|
-
#fe =
|
|
545
|
+
#de = !1;
|
|
546
|
+
#fe = !1;
|
|
478
547
|
#pe = null;
|
|
479
548
|
#me = null;
|
|
480
|
-
#he =
|
|
549
|
+
#he = null;
|
|
481
550
|
#ge = null;
|
|
482
|
-
#_e =
|
|
483
|
-
#ve =
|
|
484
|
-
#ye =
|
|
485
|
-
#be =
|
|
551
|
+
#_e = null;
|
|
552
|
+
#ve = null;
|
|
553
|
+
#ye = null;
|
|
554
|
+
#be = 0;
|
|
486
555
|
#xe = null;
|
|
487
|
-
#Se =
|
|
488
|
-
#Ce =
|
|
489
|
-
#we =
|
|
556
|
+
#Se = !1;
|
|
557
|
+
#Ce = 1;
|
|
558
|
+
#we = !1;
|
|
490
559
|
#Te = null;
|
|
491
|
-
#Ee =
|
|
560
|
+
#Ee = null;
|
|
492
561
|
#De = null;
|
|
493
562
|
#Oe = null;
|
|
494
|
-
#ke =
|
|
495
|
-
#Ae;
|
|
496
|
-
#je =
|
|
497
|
-
#Me;
|
|
563
|
+
#ke = null;
|
|
564
|
+
#Ae = null;
|
|
565
|
+
#je = -Infinity;
|
|
566
|
+
#Me = null;
|
|
498
567
|
#Ne = null;
|
|
499
|
-
#Pe;
|
|
568
|
+
#Pe = /* @__PURE__ */ new Set();
|
|
500
569
|
#Fe;
|
|
501
570
|
#Ie = null;
|
|
502
|
-
#Le
|
|
503
|
-
#Re =
|
|
504
|
-
#ze
|
|
505
|
-
#Be
|
|
571
|
+
#Le;
|
|
572
|
+
#Re = null;
|
|
573
|
+
#ze;
|
|
574
|
+
#Be;
|
|
506
575
|
#Ve = null;
|
|
507
|
-
#He;
|
|
576
|
+
#He = null;
|
|
577
|
+
#Ue = "download";
|
|
578
|
+
#We = 1;
|
|
579
|
+
#Ge = 0;
|
|
580
|
+
#Ke = null;
|
|
581
|
+
#qe;
|
|
508
582
|
debug = { setFlipProgress: (e, t) => {
|
|
509
|
-
this.#
|
|
583
|
+
this.#ue?.setFlipProgress(e, t);
|
|
510
584
|
} };
|
|
511
585
|
constructor(e, t) {
|
|
512
|
-
|
|
586
|
+
fe(e, t), this.#e = e, t.width !== void 0 && (e.style.width = `${t.width}px`), t.height !== void 0 && (e.style.height = `${t.height}px`), this.#t = re(t.source, {
|
|
513
587
|
frontCover: t.frontCover,
|
|
514
588
|
backCover: t.backCover,
|
|
515
589
|
pages: t.pages
|
|
516
590
|
});
|
|
517
591
|
let n = t.direction ?? "ltr";
|
|
518
|
-
this.#a = n, this.#
|
|
592
|
+
this.#a = n, this.#K = (t.deepLink ?? !0) && b(), this.#q = t.disableContextMenu ?? !1, this.#o = t.spreadMode ?? "cover", this.#s = this.#o, this.#c = t.curl ?? "cone", this.#u = t.clickToFlip ?? "edge", this.#d = t.fit ?? "contain", this.#f = t.gutterOverlap ?? 0, this.#f === "auto" && (this.#p = import("./gutter-C3H2CDT2.js").then((e) => e.detectOverlap, () => null)), this.#h = oe(t.strings), this.#g = t.clickZoneSize ?? 64, this.#_ = t.cursorHints ?? !0;
|
|
519
593
|
let r = t.hints ?? !0;
|
|
520
|
-
this.#
|
|
594
|
+
this.#b = r === !0 || r !== !1 && (r.enabled ?? !0), this.#x = r !== !0 && r !== !1 && (r.persist ?? !1), this.#x && this.#wt();
|
|
521
595
|
let i = t.sound ?? !1;
|
|
522
|
-
this.#
|
|
596
|
+
this.#S = i !== !1, this.#C = i === !0 || i === !1 ? {} : i, this.#T = typeof i == "object" && i ? i.muted ?? !1 : !1, this.#E = typeof i == "object" && i ? i.persist ?? !1 : !1, this.#S && this.#E && this.#et(), this.#z = t.singlePageThreshold ?? 640, this.#U = t.responsiveSpread ?? !0, this.#Fe = t.controls ?? !0, this.#Le = t.contextMenu ?? !t.disableContextMenu, this.#ze = new Set(t.hideControls ?? []), this.#Be = t.loading ?? !0, this.#G = t.startPage, typeof this.#t.open != "function" && this.#An(), this.#ee = t.flipDuration ?? 800, this.#te = t.zoom?.enabled ?? !0, this.#ne = t.zoom?.wheel ?? !0;
|
|
523
597
|
let a = t.zoom?.doubleClick, o = a === !1 ? [] : [...a ?? [
|
|
524
598
|
1,
|
|
525
599
|
2,
|
|
526
600
|
4
|
|
527
601
|
]].sort((e, t) => e - t);
|
|
528
|
-
this.#
|
|
529
|
-
let s = this.#
|
|
530
|
-
this.#
|
|
602
|
+
this.#re = o.length > 0 ? o : null, this.#ie = t.zoom?.max ?? 4;
|
|
603
|
+
let s = this.#te && this.#re !== null, c = t.zoom?.doubleClickInFlipZone ?? this.#u === "half";
|
|
604
|
+
this.#L = this.#u !== "off" && s && c && t.clickFlipDelay !== 0, this.#R = this.#L ? t.clickFlipDelay ?? N : 0, this.#qe = this.#Jt(t.renderer ?? "auto");
|
|
531
605
|
}
|
|
532
606
|
get ready() {
|
|
533
|
-
return this.#
|
|
607
|
+
return this.#qe;
|
|
534
608
|
}
|
|
535
609
|
getPageCount() {
|
|
536
610
|
return this.#t.pageCount;
|
|
537
611
|
}
|
|
538
612
|
getPage() {
|
|
539
|
-
return this.#
|
|
613
|
+
return this.#Q;
|
|
540
614
|
}
|
|
541
615
|
get container() {
|
|
542
616
|
return this.#e;
|
|
543
617
|
}
|
|
544
618
|
getPageBox() {
|
|
545
|
-
return this.#
|
|
619
|
+
return this.#ue?.measure().book ?? null;
|
|
546
620
|
}
|
|
547
621
|
getSpreads() {
|
|
548
|
-
return this.#
|
|
622
|
+
return this.#X;
|
|
549
623
|
}
|
|
550
624
|
getSpreadIndex() {
|
|
551
|
-
return this.#
|
|
625
|
+
return this.#Z;
|
|
552
626
|
}
|
|
553
627
|
getDirection() {
|
|
554
628
|
return this.#a;
|
|
@@ -557,44 +631,44 @@ var ce = class {
|
|
|
557
631
|
return this.#o;
|
|
558
632
|
}
|
|
559
633
|
isSinglePage() {
|
|
560
|
-
return this.#
|
|
634
|
+
return this.#B;
|
|
561
635
|
}
|
|
562
636
|
setSpreadMode(e) {
|
|
563
|
-
e !== this.#o && (this.#o = e, this.#
|
|
637
|
+
e !== this.#o && (this.#o = e, this.#H = !1, this.#pn(), this.#mn());
|
|
564
638
|
}
|
|
565
639
|
toggleSpreadMode() {
|
|
566
640
|
this.setSpreadMode(this.#o === "single" ? this.#s === "single" ? "double" : this.#s : "single");
|
|
567
641
|
}
|
|
568
642
|
getResponsiveSpread() {
|
|
569
|
-
return this.#
|
|
643
|
+
return this.#U;
|
|
570
644
|
}
|
|
571
645
|
isResponsiveSingle() {
|
|
572
|
-
return this.#
|
|
646
|
+
return this.#H && this.#o !== "single";
|
|
573
647
|
}
|
|
574
648
|
setResponsiveSpread(e) {
|
|
575
|
-
if (e !== this.#
|
|
576
|
-
if (this.#
|
|
577
|
-
let e = this.#
|
|
649
|
+
if (e !== this.#U) {
|
|
650
|
+
if (this.#U = e, e) {
|
|
651
|
+
let e = this.#ue?.measure().containerWidth;
|
|
578
652
|
if (e === void 0) return;
|
|
579
|
-
this.#
|
|
653
|
+
this.#H = !1, this.#fn(e);
|
|
580
654
|
} else {
|
|
581
|
-
if (!this.#
|
|
582
|
-
this.#
|
|
655
|
+
if (!this.#H) return;
|
|
656
|
+
this.#H = !1, this.#pn();
|
|
583
657
|
}
|
|
584
|
-
this.#
|
|
658
|
+
this.#mn();
|
|
585
659
|
}
|
|
586
660
|
}
|
|
587
661
|
getPageImage(e) {
|
|
588
|
-
return this.#
|
|
662
|
+
return this.#Dn(e);
|
|
589
663
|
}
|
|
590
664
|
canFlipNext() {
|
|
591
|
-
return this.#
|
|
665
|
+
return this.#Z + 1 < this.#X.length;
|
|
592
666
|
}
|
|
593
667
|
canFlipPrev() {
|
|
594
|
-
return this.#
|
|
668
|
+
return this.#Z > 0;
|
|
595
669
|
}
|
|
596
670
|
getMaxZoom() {
|
|
597
|
-
return this
|
|
671
|
+
return this.#ie;
|
|
598
672
|
}
|
|
599
673
|
canSearch() {
|
|
600
674
|
return typeof this.#t.getText == "function";
|
|
@@ -611,7 +685,7 @@ var ce = class {
|
|
|
611
685
|
async print() {
|
|
612
686
|
let e = await this.getSourceFile(), t = this.#e.ownerDocument;
|
|
613
687
|
if (!e || !t) return !1;
|
|
614
|
-
let { url: n, revoke: r } = await this.#
|
|
688
|
+
let { url: n, revoke: r } = await this.#Je(e, t), i = t.createElement("iframe");
|
|
615
689
|
return i.style.cssText = "position:fixed;right:0;bottom:0;width:1px;height:1px;opacity:0;border:0;", i.setAttribute("aria-hidden", "true"), i.src = n, new Promise((e) => {
|
|
616
690
|
let a = !1, o = (t) => {
|
|
617
691
|
a || (a = !0, setTimeout(() => {
|
|
@@ -633,11 +707,11 @@ var ce = class {
|
|
|
633
707
|
return typeof this.#t.getOutline == "function";
|
|
634
708
|
}
|
|
635
709
|
getOutline() {
|
|
636
|
-
if (!this.#
|
|
710
|
+
if (!this.#Ne) {
|
|
637
711
|
let e = this.#t.getOutline;
|
|
638
|
-
this.#
|
|
712
|
+
this.#Ne = typeof e == "function" ? Promise.resolve(e.call(this.#t)).catch(() => []) : Promise.resolve([]);
|
|
639
713
|
}
|
|
640
|
-
return this.#
|
|
714
|
+
return this.#Ne;
|
|
641
715
|
}
|
|
642
716
|
async getSourceFile() {
|
|
643
717
|
let e = this.#t.getDownload;
|
|
@@ -648,11 +722,11 @@ var ce = class {
|
|
|
648
722
|
if (!e) return !1;
|
|
649
723
|
let t = this.#e.ownerDocument;
|
|
650
724
|
if (!t) return !1;
|
|
651
|
-
let { url: n, revoke: r } = await this.#
|
|
725
|
+
let { url: n, revoke: r } = await this.#Je(e, t), i = t.createElement("a");
|
|
652
726
|
return i.href = n, i.download = e.filename, i.rel = "noopener", t.body.appendChild(i), i.click(), i.remove(), r && setTimeout(() => URL.revokeObjectURL(n), 1e4), !0;
|
|
653
727
|
}
|
|
654
|
-
async #
|
|
655
|
-
if (e.revoke || !this.#
|
|
728
|
+
async #Je(e, t) {
|
|
729
|
+
if (e.revoke || !this.#Ye(e.url, t)) return {
|
|
656
730
|
url: e.url,
|
|
657
731
|
revoke: e.revoke ?? !1
|
|
658
732
|
};
|
|
@@ -669,7 +743,7 @@ var ce = class {
|
|
|
669
743
|
};
|
|
670
744
|
}
|
|
671
745
|
}
|
|
672
|
-
#
|
|
746
|
+
#Ye(e, t) {
|
|
673
747
|
let n = t.defaultView?.location?.href;
|
|
674
748
|
if (!n) return !1;
|
|
675
749
|
try {
|
|
@@ -696,82 +770,85 @@ var ce = class {
|
|
|
696
770
|
let i = t.toLowerCase().indexOf(r);
|
|
697
771
|
i < 0 || a.push({
|
|
698
772
|
page: e,
|
|
699
|
-
excerpt:
|
|
773
|
+
excerpt: ue(t, i, r.length)
|
|
700
774
|
});
|
|
701
775
|
}
|
|
702
776
|
return a;
|
|
703
777
|
}
|
|
704
778
|
flipNext() {
|
|
705
|
-
this.#
|
|
779
|
+
this.#Xe(1);
|
|
706
780
|
}
|
|
707
781
|
flipPrev() {
|
|
708
|
-
this.#
|
|
782
|
+
this.#Xe(-1);
|
|
709
783
|
}
|
|
710
|
-
#
|
|
711
|
-
this.#
|
|
784
|
+
#Xe(e) {
|
|
785
|
+
this.#Ze(() => this.#it(this.#Z + e));
|
|
712
786
|
}
|
|
713
787
|
flipTo(e) {
|
|
714
788
|
let t = X(e, 0, Math.max(0, this.#t.pageCount - 1));
|
|
715
|
-
this.#
|
|
789
|
+
this.#Ze(() => this.#it(this.#kn(t)));
|
|
716
790
|
}
|
|
717
|
-
#
|
|
718
|
-
this.#i.state === "idle" ? e() : this.#
|
|
791
|
+
#Ze(e) {
|
|
792
|
+
this.#i.state === "idle" ? e() : this.#ye ? (this.#ve = null, this.#Qe(), e()) : this.#ve = e;
|
|
719
793
|
}
|
|
720
|
-
#
|
|
721
|
-
let e = this.#
|
|
722
|
-
e && (this.#
|
|
794
|
+
#Qe() {
|
|
795
|
+
let e = this.#ye;
|
|
796
|
+
e && (this.#ye = null, this.#pe !== null && (cancelAnimationFrame(this.#pe), this.#pe = null), this.#ue?.setFlipProgress(e.toT, e.direction), e.onDone());
|
|
723
797
|
}
|
|
724
|
-
|
|
725
|
-
let e = this.#
|
|
798
|
+
#$e() {
|
|
799
|
+
let e = this.#ve;
|
|
726
800
|
if (!e) {
|
|
727
|
-
this.#
|
|
801
|
+
this.#Sn();
|
|
728
802
|
return;
|
|
729
803
|
}
|
|
730
|
-
this.#
|
|
804
|
+
this.#ve = null, e();
|
|
731
805
|
}
|
|
732
806
|
getZoom() {
|
|
733
|
-
return this.#
|
|
807
|
+
return this.#se;
|
|
734
808
|
}
|
|
735
809
|
setZoom(e, t) {
|
|
736
|
-
if (!this.#
|
|
737
|
-
this.#
|
|
738
|
-
let n = X(e, 1, this
|
|
739
|
-
x: i.x + this.#
|
|
740
|
-
y: i.y + this.#
|
|
810
|
+
if (!this.#ue || !this.#te) return;
|
|
811
|
+
this.#kt(), this.#Mt();
|
|
812
|
+
let n = X(e, 1, this.#ie), r = this.#ue.measure(), i = r.screenAt?.(this.#se), a = t ?? (i ? {
|
|
813
|
+
x: i.x + this.#ce + i.width / 2,
|
|
814
|
+
y: i.y + this.#le + i.height / 2
|
|
741
815
|
} : null) ?? {
|
|
742
816
|
x: r.containerWidth / 2,
|
|
743
817
|
y: r.containerHeight / 2
|
|
744
|
-
}, o = this.#
|
|
745
|
-
[s, c] = this.#
|
|
818
|
+
}, o = this.#se, s = n === 1 ? 0 : a.x - n / o * (a.x - this.#ce), c = n === 1 ? 0 : a.y - n / o * (a.y - this.#le);
|
|
819
|
+
[s, c] = this.#rt(s, c, n, r.containerWidth, r.containerHeight), this.#se = n, this.#ce = s, this.#le = c, this.#ue.setViewTransform(n, s, c), o > 1 != n > 1 && this.#nt(), this.#vn(), this.#St(), o <= 1 && n > 1 && (this.#Tt("zoom"), this.#Nt()), this.#n.emit("zoomChanged", { scale: n });
|
|
746
820
|
}
|
|
747
821
|
resetZoom() {
|
|
748
822
|
this.setZoom(1);
|
|
749
823
|
}
|
|
824
|
+
get strings() {
|
|
825
|
+
return this.#h;
|
|
826
|
+
}
|
|
750
827
|
isSoundEnabled() {
|
|
751
|
-
return this.#
|
|
828
|
+
return this.#S;
|
|
752
829
|
}
|
|
753
830
|
isSoundMuted() {
|
|
754
|
-
return this.#
|
|
831
|
+
return this.#S && this.#T;
|
|
755
832
|
}
|
|
756
833
|
setSoundMuted(e) {
|
|
757
|
-
this.#
|
|
834
|
+
this.#S && (this.#T = e, this.#w?.setMuted(e), this.#E && this.#tt(e), e || this.#Yt());
|
|
758
835
|
}
|
|
759
|
-
#
|
|
836
|
+
#et() {
|
|
760
837
|
try {
|
|
761
|
-
let e = localStorage.getItem(
|
|
762
|
-
(e === "true" || e === "false") && (this.#
|
|
838
|
+
let e = localStorage.getItem(J);
|
|
839
|
+
(e === "true" || e === "false") && (this.#T = e === "true");
|
|
763
840
|
} catch {}
|
|
764
841
|
}
|
|
765
|
-
#
|
|
842
|
+
#tt(e) {
|
|
766
843
|
try {
|
|
767
|
-
localStorage.setItem(
|
|
844
|
+
localStorage.setItem(J, String(e));
|
|
768
845
|
} catch {}
|
|
769
846
|
}
|
|
770
|
-
#
|
|
771
|
-
this.#e.style.touchAction = this.#
|
|
847
|
+
#nt() {
|
|
848
|
+
this.#e.style.touchAction = this.#se > 1 ? "none" : "pan-y";
|
|
772
849
|
}
|
|
773
|
-
#
|
|
774
|
-
let a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = (e) => Math.round(e * a) / a || 0, s = this.#
|
|
850
|
+
#rt(e, t, n, r, i) {
|
|
851
|
+
let a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = (e) => Math.round(e * a) / a || 0, s = this.#ue?.measure().screenAt?.(n) ?? {
|
|
775
852
|
x: 0,
|
|
776
853
|
y: 0,
|
|
777
854
|
width: r * n,
|
|
@@ -783,31 +860,32 @@ var ce = class {
|
|
|
783
860
|
return this.#n.on(e, t);
|
|
784
861
|
}
|
|
785
862
|
destroy() {
|
|
786
|
-
this.#
|
|
863
|
+
this.#fe = !0, this.#pe !== null && cancelAnimationFrame(this.#pe), this.#ye = null, this.#ve = null, this.#zt(), this.#Dt(), this.#kt(), this.#Mt(), this.#Rt(), this.#Ft(), this.#w?.destroy(), this.#w = null, this.#ae?.disconnect(), this.#J?.stop(), this.#J = null, this.#Y?.(), this.#K && x(), this.#Ie?.(), this.#Re?.(), this.#en(), this.#Me?.(), this.#De?.(), this.#ke?.(), this.#Oe?.(), this.#y?.(), this.#Ee?.(), this.#Ke !== null && clearTimeout(this.#Ke), this.#Ge++, this.#ue?.destroy(), this.#ue = null, this.#t.destroy(), this.#n.clear();
|
|
787
864
|
}
|
|
788
|
-
|
|
789
|
-
if (e < 0 || e >= this.#
|
|
790
|
-
let t = e > this.#
|
|
865
|
+
#it(e) {
|
|
866
|
+
if (e < 0 || e >= this.#X.length || e === this.#Z || (this.#kt(), this.#Mt(), this.#i.send("flip") === null)) return;
|
|
867
|
+
let t = e > this.#Z ? "forward" : "backward", n = this.#lt(e);
|
|
791
868
|
this.#n.emit("flipStart", {
|
|
792
|
-
from: this.#
|
|
869
|
+
from: this.#Q,
|
|
793
870
|
to: n
|
|
794
|
-
}), this.#
|
|
871
|
+
}), this.#Xt(), this.#at(e, t, n, ++this.#be);
|
|
795
872
|
}
|
|
796
|
-
async #
|
|
797
|
-
let i = this.#
|
|
873
|
+
async #at(e, t, n, r) {
|
|
874
|
+
let i = this.#X[e], a = i ? await this.#Tn(i) : {
|
|
798
875
|
left: null,
|
|
799
876
|
right: null
|
|
800
877
|
};
|
|
801
|
-
r === this.#
|
|
802
|
-
fill: this.#
|
|
803
|
-
|
|
878
|
+
r === this.#be && (this.#ue?.beginFlip(this.#$, a, t, {
|
|
879
|
+
fill: this.#B,
|
|
880
|
+
fit: this.#d,
|
|
881
|
+
curl: this.#un(),
|
|
804
882
|
anchor: { y: this.#l }
|
|
805
|
-
}), this.#
|
|
883
|
+
}), this.#ot(0, 1, t, () => this.#ct(e, n, a), () => this.#st(n)));
|
|
806
884
|
}
|
|
807
|
-
#
|
|
808
|
-
let a = this.#
|
|
885
|
+
#ot(e, t, n, r, i) {
|
|
886
|
+
let a = this.#ln() * Math.abs(t - e);
|
|
809
887
|
if (a <= 0) {
|
|
810
|
-
this.#
|
|
888
|
+
this.#ue?.setFlipProgress(t, n), r();
|
|
811
889
|
return;
|
|
812
890
|
}
|
|
813
891
|
let o = {
|
|
@@ -815,60 +893,60 @@ var ce = class {
|
|
|
815
893
|
direction: n,
|
|
816
894
|
onDone: r
|
|
817
895
|
};
|
|
818
|
-
this.#
|
|
896
|
+
this.#ye = o;
|
|
819
897
|
let s = performance.now(), c = !1, l = (u) => {
|
|
820
|
-
if (this.#
|
|
821
|
-
let d = Math.min(1, (u - s) / a), f =
|
|
822
|
-
i && !c && f >= (this.#
|
|
898
|
+
if (this.#ye !== o) return;
|
|
899
|
+
let d = Math.min(1, (u - s) / a), f = de(d);
|
|
900
|
+
i && !c && f >= (this.#B ? U : H) && (c = !0, i()), d < 1 ? (this.#ue?.setFlipProgress(e + (t - e) * f, n), this.#pe = requestAnimationFrame(l)) : (this.#ue?.setFlipProgress(t, n), this.#pe = null, this.#ye = null, r());
|
|
823
901
|
};
|
|
824
|
-
this.#
|
|
902
|
+
this.#pe = requestAnimationFrame(l);
|
|
825
903
|
}
|
|
826
|
-
#
|
|
827
|
-
this.#
|
|
904
|
+
#st(e) {
|
|
905
|
+
this.#Q !== e && (this.#Q = e, this.#cn(), this.#n.emit("pageChanged", { page: e }));
|
|
828
906
|
}
|
|
829
|
-
#
|
|
830
|
-
let r = this.#
|
|
831
|
-
this.#
|
|
907
|
+
#ct(e, t, n) {
|
|
908
|
+
let r = this.#X[e];
|
|
909
|
+
this.#Z = e, this.#$ = n, r && this.#hn(r, n), this.#On(), this.#i.send("settle"), this.#je = performance.now(), this.#st(t), this.#Tt("turn"), this.#St(), this.#n.emit("flipEnd", { page: t }), this.#$e();
|
|
832
910
|
}
|
|
833
|
-
#
|
|
834
|
-
let t = this.#
|
|
835
|
-
if (!t) return this.#
|
|
911
|
+
#lt(e) {
|
|
912
|
+
let t = this.#X[e];
|
|
913
|
+
if (!t) return this.#Q;
|
|
836
914
|
let n = [t.left, t.right].filter((e) => e !== null);
|
|
837
|
-
return n.length > 0 ? Math.min(...n) : this.#
|
|
915
|
+
return n.length > 0 ? Math.min(...n) : this.#Q;
|
|
838
916
|
}
|
|
839
|
-
#
|
|
840
|
-
if (this.#
|
|
841
|
-
if (this.#
|
|
917
|
+
#ut(e, t) {
|
|
918
|
+
if (this.#Se || !this.#ue) return;
|
|
919
|
+
if (this.#Mt(), this.#zt(), this.#se > 1) {
|
|
842
920
|
if (this.#i.send("panStart") === null) return;
|
|
843
|
-
this.#
|
|
844
|
-
baseTx: this.#
|
|
845
|
-
baseTy: this.#
|
|
921
|
+
this.#xe = {
|
|
922
|
+
baseTx: this.#ce,
|
|
923
|
+
baseTy: this.#le
|
|
846
924
|
};
|
|
847
925
|
return;
|
|
848
926
|
}
|
|
849
|
-
let n = this.#
|
|
850
|
-
this.#
|
|
851
|
-
let i = Math.min(n.width, n.height) *
|
|
927
|
+
let n = this.#_t(), r = this.#vt(e, t);
|
|
928
|
+
this.#ge = r;
|
|
929
|
+
let i = Math.min(n.width, n.height) * A, a = r.x >= 0 && r.x <= n.width && r.y >= 0 && r.y <= n.height, o = r.x <= i || r.x >= n.width - i, s = a && o;
|
|
852
930
|
if (this.#i.state !== "idle") {
|
|
853
|
-
if (!this.#
|
|
854
|
-
this.#
|
|
931
|
+
if (!this.#ye || !s) {
|
|
932
|
+
this.#he = null;
|
|
855
933
|
return;
|
|
856
934
|
}
|
|
857
|
-
this.#
|
|
935
|
+
this.#Qe();
|
|
858
936
|
}
|
|
859
937
|
if (!s) return;
|
|
860
938
|
this.#l = X(r.y / n.height, 0, 1);
|
|
861
|
-
let c = r.x > n.width / 2, l = this.#a === "rtl" ? !c : c, u = this.#
|
|
862
|
-
u < 0 || u >= this.#
|
|
939
|
+
let c = r.x > n.width / 2, l = this.#a === "rtl" ? !c : c, u = this.#Z + (l ? 1 : -1);
|
|
940
|
+
u < 0 || u >= this.#X.length || (this.#he = {
|
|
863
941
|
direction: l ? "forward" : "backward",
|
|
864
942
|
targetIndex: u,
|
|
865
|
-
toPage: this.#
|
|
943
|
+
toPage: this.#lt(u),
|
|
866
944
|
width: n.width
|
|
867
945
|
});
|
|
868
946
|
}
|
|
869
|
-
#
|
|
870
|
-
let e = this.#
|
|
871
|
-
e && (this.#
|
|
947
|
+
#dt() {
|
|
948
|
+
let e = this.#he;
|
|
949
|
+
e && (this.#he = null, this.#i.send("grab") !== null && (this.#me = {
|
|
872
950
|
direction: e.direction,
|
|
873
951
|
targetIndex: e.targetIndex,
|
|
874
952
|
toPage: e.toPage,
|
|
@@ -879,75 +957,76 @@ var ce = class {
|
|
|
879
957
|
width: e.width,
|
|
880
958
|
t: 0
|
|
881
959
|
}, this.#n.emit("flipStart", {
|
|
882
|
-
from: this.#
|
|
960
|
+
from: this.#Q,
|
|
883
961
|
to: e.toPage
|
|
884
|
-
}), this.#
|
|
962
|
+
}), this.#ft(e.targetIndex, e.direction)));
|
|
885
963
|
}
|
|
886
|
-
async #
|
|
887
|
-
let n = this.#
|
|
964
|
+
async #ft(e, t) {
|
|
965
|
+
let n = this.#X[e], r = n ? await this.#Tn(n) : {
|
|
888
966
|
left: null,
|
|
889
967
|
right: null
|
|
890
968
|
};
|
|
891
|
-
this.#
|
|
892
|
-
fill: this.#
|
|
893
|
-
|
|
969
|
+
this.#me?.targetIndex === e && (this.#me.toContent = r, this.#ue?.beginFlip(this.#$, r, t, {
|
|
970
|
+
fill: this.#B,
|
|
971
|
+
fit: this.#d,
|
|
972
|
+
curl: this.#un(),
|
|
894
973
|
anchor: { y: this.#l }
|
|
895
|
-
}), this.#
|
|
896
|
-
}
|
|
897
|
-
#
|
|
898
|
-
if (this.#
|
|
899
|
-
if (this.#
|
|
900
|
-
if (!this.#
|
|
901
|
-
let n = this.#
|
|
902
|
-
this.#
|
|
974
|
+
}), this.#ue?.setFlipProgress(this.#me.t, t));
|
|
975
|
+
}
|
|
976
|
+
#pt(e, t) {
|
|
977
|
+
if (this.#Se) return;
|
|
978
|
+
if (this.#xe) {
|
|
979
|
+
if (!this.#ue) return;
|
|
980
|
+
let n = this.#ue.measure(), [r, i] = this.#rt(this.#xe.baseTx + e, this.#xe.baseTy + t, this.#se, n.containerWidth, n.containerHeight);
|
|
981
|
+
this.#ce = r, this.#le = i, this.#ue.setViewTransform(this.#se, r, i), this.#vn(), this.#Tt("pan"), this.#Ft();
|
|
903
982
|
return;
|
|
904
983
|
}
|
|
905
|
-
this.#
|
|
906
|
-
let n = this.#
|
|
907
|
-
n && (n.t = X((n.direction === "forward" ? -e : e) / n.width, 0, 1), this.#
|
|
984
|
+
this.#he && Math.hypot(e, t) > M && this.#dt();
|
|
985
|
+
let n = this.#me;
|
|
986
|
+
n && (n.t = X((n.direction === "forward" ? -e : e) / n.width, 0, 1), this.#ue?.setFlipProgress(n.t, n.direction));
|
|
908
987
|
}
|
|
909
|
-
#
|
|
910
|
-
if (this.#
|
|
911
|
-
if (this.#
|
|
912
|
-
this.#
|
|
988
|
+
#mt(e) {
|
|
989
|
+
if (this.#Se) return;
|
|
990
|
+
if (this.#xe) {
|
|
991
|
+
this.#xe = null, this.#i.send("panEnd"), this.#St();
|
|
913
992
|
return;
|
|
914
993
|
}
|
|
915
|
-
let t = this.#
|
|
994
|
+
let t = this.#me;
|
|
916
995
|
if (!t) {
|
|
917
|
-
this.#
|
|
996
|
+
this.#he = null, this.#ht(e) || this.#gt(e);
|
|
918
997
|
return;
|
|
919
998
|
}
|
|
920
|
-
this.#
|
|
999
|
+
this.#me = null, this.#i.send("release");
|
|
921
1000
|
let n = e.swipe && Math.abs(e.vx) > Math.abs(e.vy), r = t.direction === "forward" ? e.vx < 0 : e.vx > 0, i = n && r, a = n && !r;
|
|
922
|
-
i || t.t >= .5 && !a ? (this.#
|
|
1001
|
+
i || t.t >= .5 && !a ? (this.#Xt(), this.#ot(t.t, 1, t.direction, () => this.#ct(t.targetIndex, t.toPage, t.toContent), () => this.#st(t.toPage))) : this.#ot(t.t, 0, t.direction, () => this.#Bt());
|
|
923
1002
|
}
|
|
924
|
-
#
|
|
925
|
-
if (this.#
|
|
1003
|
+
#ht(e) {
|
|
1004
|
+
if (this.#se > 1 || !e.swipe || Math.abs(e.dx) <= Math.abs(e.dy)) return !1;
|
|
926
1005
|
let t = this.#a === "rtl" ? e.dx > 0 : e.dx < 0, n = t ? "forward" : "backward";
|
|
927
|
-
if (!this.#
|
|
1006
|
+
if (!this.#bt(n)) return this.#jt(n), !1;
|
|
928
1007
|
let r = t ? 1 : -1;
|
|
929
|
-
return this.#
|
|
1008
|
+
return this.#Ze(() => this.#it(this.#Z + r)), !0;
|
|
930
1009
|
}
|
|
931
|
-
#
|
|
932
|
-
if (this.#u === "off" || this.#
|
|
933
|
-
let t = this.#
|
|
1010
|
+
#gt(e) {
|
|
1011
|
+
if (this.#u === "off" || this.#se > 1 || !this.#ge || Math.abs(e.dx) > M || Math.abs(e.dy) > M) return;
|
|
1012
|
+
let t = this.#yt(this.#ge);
|
|
934
1013
|
if (!t) return;
|
|
935
|
-
if (!this.#
|
|
936
|
-
this.#
|
|
1014
|
+
if (!this.#bt(t)) {
|
|
1015
|
+
this.#jt(t);
|
|
937
1016
|
return;
|
|
938
1017
|
}
|
|
939
|
-
this.#l = X(this.#
|
|
940
|
-
let n = t === "forward" ? 1 : -1, r = () => this
|
|
941
|
-
if (this.#
|
|
942
|
-
this.#
|
|
1018
|
+
this.#l = X(this.#ge.y / this.#_t().height, 0, 1);
|
|
1019
|
+
let n = t === "forward" ? 1 : -1, r = () => this.#it(this.#Z + n);
|
|
1020
|
+
if (this.#zt(), this.#R <= 0) {
|
|
1021
|
+
this.#Ze(r);
|
|
943
1022
|
return;
|
|
944
1023
|
}
|
|
945
|
-
this.#
|
|
946
|
-
this.#
|
|
947
|
-
}, this.#
|
|
1024
|
+
this.#_e = setTimeout(() => {
|
|
1025
|
+
this.#_e = null, this.#Ze(r);
|
|
1026
|
+
}, this.#R);
|
|
948
1027
|
}
|
|
949
|
-
#
|
|
950
|
-
let e = this.#
|
|
1028
|
+
#_t() {
|
|
1029
|
+
let e = this.#ue.measure();
|
|
951
1030
|
return e.content ?? e.book ?? {
|
|
952
1031
|
x: 0,
|
|
953
1032
|
y: 0,
|
|
@@ -955,364 +1034,365 @@ var ce = class {
|
|
|
955
1034
|
height: e.containerHeight
|
|
956
1035
|
};
|
|
957
1036
|
}
|
|
958
|
-
#
|
|
959
|
-
let n = this.#e.getBoundingClientRect(), r = this.#
|
|
1037
|
+
#vt(e, t) {
|
|
1038
|
+
let n = this.#e.getBoundingClientRect(), r = this.#_t();
|
|
960
1039
|
return {
|
|
961
1040
|
x: e - n.left - r.x,
|
|
962
1041
|
y: t - n.top - r.y
|
|
963
1042
|
};
|
|
964
1043
|
}
|
|
965
|
-
#
|
|
966
|
-
if (!this.#
|
|
967
|
-
let t = this.#
|
|
968
|
-
if (n = this.#u === "half" ? e.x > t / 2 ? "right" : "left" : e.x <= this.#
|
|
1044
|
+
#yt(e) {
|
|
1045
|
+
if (!this.#ue) return null;
|
|
1046
|
+
let t = this.#_t().width, n;
|
|
1047
|
+
if (n = this.#u === "half" ? e.x > t / 2 ? "right" : "left" : e.x <= this.#g ? "left" : e.x >= t - this.#g ? "right" : null, !n) return null;
|
|
969
1048
|
let r = this.#a === "rtl" ? "left" : "right";
|
|
970
1049
|
return n === r ? "forward" : "backward";
|
|
971
1050
|
}
|
|
972
|
-
#
|
|
973
|
-
let t = this.#
|
|
974
|
-
return t >= 0 && t < this.#
|
|
1051
|
+
#bt(e) {
|
|
1052
|
+
let t = this.#Z + (e === "forward" ? 1 : -1);
|
|
1053
|
+
return t >= 0 && t < this.#X.length;
|
|
975
1054
|
}
|
|
976
|
-
#
|
|
1055
|
+
#xt() {
|
|
977
1056
|
let e = (e) => {
|
|
978
1057
|
let t = e;
|
|
979
|
-
this.#
|
|
1058
|
+
this.#v = {
|
|
980
1059
|
x: t.clientX,
|
|
981
1060
|
y: t.clientY
|
|
982
|
-
}, this.#
|
|
1061
|
+
}, this.#St();
|
|
983
1062
|
}, t = () => {
|
|
984
|
-
this.#
|
|
1063
|
+
this.#v = null, this.#St();
|
|
985
1064
|
};
|
|
986
|
-
this.#e.addEventListener("pointermove", e), this.#e.addEventListener("pointerleave", t), this.#
|
|
1065
|
+
this.#e.addEventListener("pointermove", e), this.#e.addEventListener("pointerleave", t), this.#y = () => {
|
|
987
1066
|
this.#e.removeEventListener("pointermove", e), this.#e.removeEventListener("pointerleave", t);
|
|
988
1067
|
};
|
|
989
1068
|
}
|
|
990
|
-
#
|
|
991
|
-
if (!this.#
|
|
1069
|
+
#St() {
|
|
1070
|
+
if (!this.#_ || !this.#ue) return;
|
|
992
1071
|
let e = "";
|
|
993
|
-
this.#
|
|
1072
|
+
this.#me || this.#xe ? e = "grabbing" : this.#v && (e = this.#Ct(this.#v.x, this.#v.y)), this.#e.style.cursor = e;
|
|
994
1073
|
}
|
|
995
|
-
#
|
|
996
|
-
if (!this.#
|
|
997
|
-
let n = this.#
|
|
1074
|
+
#Ct(e, t) {
|
|
1075
|
+
if (!this.#ue) return "";
|
|
1076
|
+
let n = this.#_t(), r = this.#vt(e, t);
|
|
998
1077
|
if (r.x < 0 || r.y < 0 || r.x > n.width || r.y > n.height) return "";
|
|
999
|
-
if (this.#
|
|
1000
|
-
let i = this.#
|
|
1001
|
-
return i && this.#
|
|
1078
|
+
if (this.#se > 1) return "grab";
|
|
1079
|
+
let i = this.#yt(r);
|
|
1080
|
+
return i && this.#bt(i) ? "pointer" : this.#te && this.#re !== null ? "zoom-in" : "";
|
|
1002
1081
|
}
|
|
1003
|
-
#
|
|
1082
|
+
#wt() {
|
|
1004
1083
|
try {
|
|
1005
|
-
let e = localStorage.getItem(
|
|
1084
|
+
let e = localStorage.getItem(q);
|
|
1006
1085
|
if (!e) return;
|
|
1007
1086
|
let t = JSON.parse(e);
|
|
1008
|
-
this.#
|
|
1087
|
+
this.#O = {
|
|
1009
1088
|
turn: t.turn === !0,
|
|
1010
1089
|
zoom: t.zoom === !0,
|
|
1011
1090
|
pan: t.pan === !0
|
|
1012
1091
|
};
|
|
1013
1092
|
} catch {}
|
|
1014
1093
|
}
|
|
1015
|
-
#
|
|
1016
|
-
if (!this.#
|
|
1017
|
-
localStorage.setItem(
|
|
1094
|
+
#Tt(e) {
|
|
1095
|
+
if (!this.#O[e] && (this.#O[e] = !0, e === "turn" && this.#Dt(), e === "zoom" && this.#Rt(), this.#x)) try {
|
|
1096
|
+
localStorage.setItem(q, JSON.stringify(this.#O));
|
|
1018
1097
|
} catch {}
|
|
1019
1098
|
}
|
|
1020
|
-
#
|
|
1021
|
-
!this.#
|
|
1022
|
-
this.#
|
|
1023
|
-
},
|
|
1099
|
+
#Et() {
|
|
1100
|
+
!this.#b || this.#we || this.#O.turn || (this.#Dt(), this.#k = setTimeout(() => {
|
|
1101
|
+
this.#k = null, this.#Ot();
|
|
1102
|
+
}, ce));
|
|
1024
1103
|
}
|
|
1025
|
-
#
|
|
1026
|
-
this.#
|
|
1104
|
+
#Dt() {
|
|
1105
|
+
this.#k !== null && (clearTimeout(this.#k), this.#k = null);
|
|
1027
1106
|
}
|
|
1028
|
-
async #
|
|
1029
|
-
if (!this.#
|
|
1030
|
-
let e = this.#
|
|
1107
|
+
async #Ot() {
|
|
1108
|
+
if (!this.#b || this.#we || this.#O.turn || !this.#ue || typeof requestAnimationFrame != "function" || this.#i.state !== "idle") return;
|
|
1109
|
+
let e = this.#Z + 1, t = this.#X[e];
|
|
1031
1110
|
if (!t) return;
|
|
1032
|
-
let n = await this.#
|
|
1033
|
-
if (this.#
|
|
1034
|
-
this.#l = 1, this.#
|
|
1035
|
-
fill: this.#
|
|
1036
|
-
|
|
1111
|
+
let n = await this.#Tn(t);
|
|
1112
|
+
if (this.#fe || this.#O.turn || this.#i.state !== "idle" || this.#A) return;
|
|
1113
|
+
this.#l = 1, this.#ue.beginFlip(this.#$, n, "forward", {
|
|
1114
|
+
fill: this.#B,
|
|
1115
|
+
fit: this.#d,
|
|
1116
|
+
curl: this.#un(),
|
|
1037
1117
|
anchor: { y: this.#l }
|
|
1038
1118
|
});
|
|
1039
1119
|
let r = {};
|
|
1040
|
-
this.#
|
|
1041
|
-
let i = performance.now(), a =
|
|
1042
|
-
if (this.#
|
|
1043
|
-
let e = Math.min(1, (performance.now() - i) / a), t =
|
|
1044
|
-
this.#
|
|
1120
|
+
this.#A = r;
|
|
1121
|
+
let i = performance.now(), a = G * 2, o = () => {
|
|
1122
|
+
if (this.#A !== r) return;
|
|
1123
|
+
let e = Math.min(1, (performance.now() - i) / a), t = W * Math.sin(e * Math.PI);
|
|
1124
|
+
this.#ue?.setFlipProgress(Math.max(0, t), "forward"), e < 1 ? this.#pe = requestAnimationFrame(o) : (this.#pe = null, this.#A = null, this.#At());
|
|
1045
1125
|
};
|
|
1046
|
-
this.#
|
|
1126
|
+
this.#pe = requestAnimationFrame(o);
|
|
1047
1127
|
}
|
|
1048
|
-
#
|
|
1049
|
-
this.#
|
|
1128
|
+
#kt() {
|
|
1129
|
+
this.#A && (this.#A = null, this.#pe !== null && (cancelAnimationFrame(this.#pe), this.#pe = null), this.#At());
|
|
1050
1130
|
}
|
|
1051
|
-
#
|
|
1052
|
-
let e = this.#
|
|
1053
|
-
e && this.#i.state === "idle" && this.#
|
|
1131
|
+
#At() {
|
|
1132
|
+
let e = this.#X[this.#Z];
|
|
1133
|
+
e && this.#i.state === "idle" && this.#hn(e, this.#$);
|
|
1054
1134
|
}
|
|
1055
|
-
#
|
|
1056
|
-
if (!this.#
|
|
1135
|
+
#jt(e) {
|
|
1136
|
+
if (!this.#ue || typeof requestAnimationFrame != "function" || this.#we || this.#i.state !== "idle" || this.#se > 1 || this.#j) return;
|
|
1057
1137
|
let t = e === "forward", n = (this.#a === "rtl" ? !t : t) ? -1 : 1, r = {};
|
|
1058
|
-
this.#
|
|
1138
|
+
this.#j = r;
|
|
1059
1139
|
let i = performance.now(), a = () => {
|
|
1060
|
-
if (this.#
|
|
1061
|
-
let e = Math.min(1, (performance.now() - i) /
|
|
1062
|
-
this.#
|
|
1140
|
+
if (this.#j !== r) return;
|
|
1141
|
+
let e = Math.min(1, (performance.now() - i) / K), t = se * Math.sin(e * Math.PI);
|
|
1142
|
+
this.#ue?.setViewTransform(1, n * t, 0), e < 1 ? this.#pe = requestAnimationFrame(a) : (this.#pe = null, this.#j = null, this.#ue?.setViewTransform(1, 0, 0));
|
|
1063
1143
|
};
|
|
1064
|
-
this.#
|
|
1144
|
+
this.#pe = requestAnimationFrame(a);
|
|
1065
1145
|
}
|
|
1066
|
-
#
|
|
1067
|
-
this.#
|
|
1146
|
+
#Mt() {
|
|
1147
|
+
this.#j && (this.#j = null, this.#pe !== null && (cancelAnimationFrame(this.#pe), this.#pe = null), this.#ue?.setViewTransform(1, 0, 0));
|
|
1068
1148
|
}
|
|
1069
|
-
#
|
|
1070
|
-
this.#
|
|
1149
|
+
#Nt() {
|
|
1150
|
+
this.#O.pan || this.#Pt(this.#h.panHint);
|
|
1071
1151
|
}
|
|
1072
|
-
#
|
|
1073
|
-
if (!this.#
|
|
1152
|
+
#Pt(e) {
|
|
1153
|
+
if (!this.#b) return;
|
|
1074
1154
|
let t = this.#e.ownerDocument;
|
|
1075
1155
|
if (!t || typeof this.#e.appendChild != "function") return;
|
|
1076
|
-
this.#
|
|
1156
|
+
this.#Ft();
|
|
1077
1157
|
let n = t.createElement("div");
|
|
1078
1158
|
n.className = "zine-hint-caption", n.setAttribute("aria-hidden", "true"), n.textContent = e, n.style.cssText = "position:absolute;left:50%;bottom:16px;transform:translateX(-50%);z-index:3;pointer-events:none;padding:6px 12px;border-radius:999px;font:500 13px/1.2 system-ui,sans-serif;color:#fff;background:rgba(24,24,27,0.82);box-shadow:0 1px 4px rgba(0,0,0,0.35);white-space:nowrap;opacity:0;";
|
|
1079
|
-
let r = !this.#
|
|
1080
|
-
r && (n.style.transition = "opacity 200ms ease"), this.#e.appendChild(n), this.#
|
|
1081
|
-
this.#
|
|
1082
|
-
}) : n.style.opacity = "1", this.#
|
|
1159
|
+
let r = !this.#we && typeof requestAnimationFrame == "function";
|
|
1160
|
+
r && (n.style.transition = "opacity 200ms ease"), this.#e.appendChild(n), this.#M = n, r ? requestAnimationFrame(() => {
|
|
1161
|
+
this.#M === n && (n.style.opacity = "1");
|
|
1162
|
+
}) : n.style.opacity = "1", this.#N = setTimeout(() => this.#Ft(), le);
|
|
1083
1163
|
}
|
|
1084
|
-
#
|
|
1085
|
-
this.#
|
|
1164
|
+
#Ft() {
|
|
1165
|
+
this.#N !== null && (clearTimeout(this.#N), this.#N = null), this.#M?.remove(), this.#M = null;
|
|
1166
|
+
}
|
|
1167
|
+
#It(e, t) {
|
|
1168
|
+
!this.#b || this.#O.zoom || this.#F || this.#I === "mouse" && this.#Ct(e, t) === "zoom-in" && (this.#i.state === "animating" || performance.now() - this.#je <= F || (this.#Rt(), this.#P = setTimeout(() => {
|
|
1169
|
+
this.#P = null, !(this.#O.zoom || this.#F) && (this.#F = !0, this.#Pt(this.#Lt()));
|
|
1170
|
+
}, N)));
|
|
1171
|
+
}
|
|
1172
|
+
#Lt() {
|
|
1173
|
+
let e = this.#e.ownerDocument?.defaultView?.navigator, t = /Mac|iPhone|iPad/.test(e?.platform ?? "");
|
|
1174
|
+
return this.#h.zoomHint({
|
|
1175
|
+
doubleClick: this.#re !== null,
|
|
1176
|
+
wheel: this.#ne,
|
|
1177
|
+
mac: t
|
|
1178
|
+
});
|
|
1086
1179
|
}
|
|
1087
|
-
#
|
|
1088
|
-
|
|
1089
|
-
this.#k = null, !(this.#C.zoom || this.#A) && (this.#A = !0, this.#kt(this.#Mt()));
|
|
1090
|
-
}, M)));
|
|
1180
|
+
#Rt() {
|
|
1181
|
+
this.#P !== null && (clearTimeout(this.#P), this.#P = null);
|
|
1091
1182
|
}
|
|
1092
|
-
#
|
|
1093
|
-
|
|
1094
|
-
if (this.#Q !== null && e.push("Double-click"), this.#Z) {
|
|
1095
|
-
let t = this.#e.ownerDocument?.defaultView?.navigator, n = /Mac|iPhone|iPad/.test(t?.platform ?? "");
|
|
1096
|
-
e.push(`${n ? "⌘" : "Ctrl"}-scroll`);
|
|
1097
|
-
}
|
|
1098
|
-
return `${e.join(" or ")} to zoom`;
|
|
1183
|
+
#zt() {
|
|
1184
|
+
this.#_e !== null && (clearTimeout(this.#_e), this.#_e = null);
|
|
1099
1185
|
}
|
|
1100
|
-
#
|
|
1101
|
-
|
|
1186
|
+
#Bt() {
|
|
1187
|
+
let e = this.#X[this.#Z];
|
|
1188
|
+
e && this.#hn(e, this.#$), this.#i.send("settle"), this.#St(), this.#n.emit("flipEnd", { page: this.#Q }), this.#$e();
|
|
1102
1189
|
}
|
|
1103
|
-
#
|
|
1104
|
-
this.#
|
|
1190
|
+
#Vt() {
|
|
1191
|
+
if (this.#he = null, this.#zt(), this.#me) {
|
|
1192
|
+
this.#me = null, this.#i.send("release"), this.#i.send("settle");
|
|
1193
|
+
let e = this.#X[this.#Z];
|
|
1194
|
+
e && this.#hn(e, this.#$);
|
|
1195
|
+
} else this.#xe && (this.#xe = null, this.#i.send("panEnd"));
|
|
1196
|
+
this.#Se = !0, this.#Ce = this.#se;
|
|
1105
1197
|
}
|
|
1106
|
-
#
|
|
1107
|
-
|
|
1108
|
-
e && this.#un(e, this.#J), this.#i.send("settle"), this.#_t(), this.#n.emit("flipEnd", { page: this.#q }), this.#Je();
|
|
1109
|
-
}
|
|
1110
|
-
#It() {
|
|
1111
|
-
if (this.#ue = null, this.#Pt(), this.#le) {
|
|
1112
|
-
this.#le = null, this.#i.send("release"), this.#i.send("settle");
|
|
1113
|
-
let e = this.#G[this.#K];
|
|
1114
|
-
e && this.#un(e, this.#J);
|
|
1115
|
-
} else this.#ge && (this.#ge = null, this.#i.send("panEnd"));
|
|
1116
|
-
this.#_e = !0, this.#ve = this.#ne;
|
|
1117
|
-
}
|
|
1118
|
-
#Lt(e, t, n) {
|
|
1119
|
-
if (!this.#_e) return;
|
|
1198
|
+
#Ht(e, t, n) {
|
|
1199
|
+
if (!this.#Se) return;
|
|
1120
1200
|
let r = this.#e.getBoundingClientRect();
|
|
1121
|
-
this.setZoom(this.#
|
|
1201
|
+
this.setZoom(this.#Ce * n, {
|
|
1122
1202
|
x: e - r.left,
|
|
1123
1203
|
y: t - r.top
|
|
1124
1204
|
});
|
|
1125
1205
|
}
|
|
1126
|
-
#
|
|
1127
|
-
this.#
|
|
1206
|
+
#Ut() {
|
|
1207
|
+
this.#Se = !1;
|
|
1128
1208
|
}
|
|
1129
|
-
#
|
|
1130
|
-
if (!this.#
|
|
1209
|
+
#Wt() {
|
|
1210
|
+
if (!this.#q) return;
|
|
1131
1211
|
let e = (e) => e.preventDefault();
|
|
1132
|
-
this.#e.addEventListener("contextmenu", e), this.#
|
|
1212
|
+
this.#e.addEventListener("contextmenu", e), this.#Oe = () => this.#e.removeEventListener("contextmenu", e);
|
|
1133
1213
|
}
|
|
1134
|
-
#
|
|
1214
|
+
#Gt() {
|
|
1135
1215
|
let e = (e) => {
|
|
1136
|
-
if (!this.#
|
|
1216
|
+
if (!this.#ne || !this.#te || !(e.ctrlKey || e.metaKey)) return;
|
|
1137
1217
|
e.preventDefault();
|
|
1138
|
-
let t = this.#e.getBoundingClientRect(), n = Math.exp(-e.deltaY *
|
|
1139
|
-
this.setZoom(this.#
|
|
1218
|
+
let t = this.#e.getBoundingClientRect(), n = Math.exp(-e.deltaY * j);
|
|
1219
|
+
this.setZoom(this.#se * n, {
|
|
1140
1220
|
x: e.clientX - t.left,
|
|
1141
1221
|
y: e.clientY - t.top
|
|
1142
1222
|
});
|
|
1143
1223
|
};
|
|
1144
|
-
this.#e.addEventListener("wheel", e, { passive: !1 }), this.#
|
|
1224
|
+
this.#e.addEventListener("wheel", e, { passive: !1 }), this.#De = () => this.#e.removeEventListener("wheel", e);
|
|
1145
1225
|
}
|
|
1146
|
-
#
|
|
1226
|
+
#Kt() {
|
|
1147
1227
|
let e = (e) => {
|
|
1148
|
-
this.#
|
|
1228
|
+
this.#I = e.pointerType;
|
|
1149
1229
|
}, t = (e) => {
|
|
1150
|
-
let t = this.#
|
|
1151
|
-
if (!this.#
|
|
1152
|
-
let n = performance.now(), r = this.#
|
|
1153
|
-
if (!(r !== null && n - r.t <=
|
|
1154
|
-
this.#
|
|
1230
|
+
let t = this.#re;
|
|
1231
|
+
if (!this.#te || t === null || !this.#ue) return;
|
|
1232
|
+
let n = performance.now(), r = this.#Ae;
|
|
1233
|
+
if (!(r !== null && n - r.t <= N && Math.hypot(e.clientX - r.x, e.clientY - r.y) <= P)) {
|
|
1234
|
+
this.#Ae = {
|
|
1155
1235
|
t: n,
|
|
1156
1236
|
x: e.clientX,
|
|
1157
1237
|
y: e.clientY
|
|
1158
|
-
}, this.#
|
|
1238
|
+
}, this.#It(e.clientX, e.clientY);
|
|
1159
1239
|
return;
|
|
1160
1240
|
}
|
|
1161
|
-
this.#
|
|
1241
|
+
this.#Ae = null, this.#Rt(), this.#qt(e.clientX, e.clientY, t);
|
|
1162
1242
|
};
|
|
1163
|
-
this.#e.addEventListener("pointerdown", e), this.#e.addEventListener("click", t), this.#
|
|
1243
|
+
this.#e.addEventListener("pointerdown", e), this.#e.addEventListener("click", t), this.#ke = () => {
|
|
1164
1244
|
this.#e.removeEventListener("pointerdown", e), this.#e.removeEventListener("click", t);
|
|
1165
1245
|
};
|
|
1166
1246
|
}
|
|
1167
|
-
#
|
|
1168
|
-
if (this.#
|
|
1169
|
-
let n = this.#
|
|
1170
|
-
if (r !== null && this.#
|
|
1247
|
+
#qt(e, t, n) {
|
|
1248
|
+
if (this.#se <= 1 && this.#u !== "off" && !this.#L) {
|
|
1249
|
+
let n = this.#vt(e, t), r = this.#yt(n);
|
|
1250
|
+
if (r !== null && this.#bt(r) || this.#i.state === "animating" || performance.now() - this.#je <= F) return;
|
|
1171
1251
|
}
|
|
1172
|
-
this.#
|
|
1173
|
-
let r = n.find((e) => e > this.#
|
|
1252
|
+
this.#zt();
|
|
1253
|
+
let r = n.find((e) => e > this.#se + 1e-6) ?? n[0] ?? this.#se, i = this.#e.getBoundingClientRect();
|
|
1174
1254
|
this.setZoom(r, {
|
|
1175
1255
|
x: e - i.left,
|
|
1176
1256
|
y: t - i.top
|
|
1177
1257
|
});
|
|
1178
1258
|
}
|
|
1179
|
-
async #
|
|
1259
|
+
async #Jt(e) {
|
|
1180
1260
|
let t = O(e);
|
|
1181
|
-
if (this.#t.onProgress?.((e) => this.#
|
|
1182
|
-
this.#
|
|
1261
|
+
if (this.#t.onProgress?.((e) => this.#Zt(e)), typeof this.#t.open == "function") {
|
|
1262
|
+
this.#Qt();
|
|
1183
1263
|
try {
|
|
1184
|
-
await this.#t.open(), this.#
|
|
1264
|
+
await this.#t.open(), this.#An();
|
|
1185
1265
|
} catch (e) {
|
|
1186
|
-
throw this.#
|
|
1266
|
+
throw this.#en(), e;
|
|
1187
1267
|
}
|
|
1188
|
-
this
|
|
1268
|
+
this.#$t("preparing");
|
|
1189
1269
|
}
|
|
1190
|
-
this.#t.prefetch([this.#
|
|
1191
|
-
let n = await t, r = await this.#
|
|
1192
|
-
this.#
|
|
1270
|
+
this.#t.prefetch([this.#Q]);
|
|
1271
|
+
let n = await t, r = await this.#tn(n);
|
|
1272
|
+
this.#ue = r, this.#t.onPageUpdate?.((e) => this.#_n(e)), this.#fn(r.measure().containerWidth);
|
|
1193
1273
|
let i = new m({
|
|
1194
|
-
onStart: (e) => this.#
|
|
1195
|
-
onMove: (e) => this.#
|
|
1196
|
-
onEnd: (e) => this.#
|
|
1274
|
+
onStart: (e) => this.#ut(e.x, e.y),
|
|
1275
|
+
onMove: (e) => this.#pt(e.dx, e.dy),
|
|
1276
|
+
onEnd: (e) => this.#mt(e)
|
|
1197
1277
|
}), a = new _({
|
|
1198
|
-
onPinchStart: () => this.#
|
|
1199
|
-
onPinchMove: (e) => this.#
|
|
1200
|
-
onPinchEnd: () => this.#
|
|
1278
|
+
onPinchStart: () => this.#Vt(),
|
|
1279
|
+
onPinchMove: (e) => this.#Ht(e.centerX, e.centerY, e.scale),
|
|
1280
|
+
onPinchEnd: () => this.#Ut()
|
|
1201
1281
|
});
|
|
1202
|
-
this.#
|
|
1282
|
+
this.#Ee = h(this.#e, {
|
|
1203
1283
|
pointer: i,
|
|
1204
1284
|
pinch: a
|
|
1205
|
-
}), this.#
|
|
1285
|
+
}), this.#nt(), this.#Gt(), this.#Kt(), this.#Wt(), this.#xt(), this.#rn(), this.#Me = this.#on(), await this.#mn(), this.#en(), this.#Cn(), this.#On(), this.#cn(), this.#an(), await this.#in(), this.#Yt(), this.#n.emit("ready"), this.#Ot(), this.#Et();
|
|
1206
1286
|
}
|
|
1207
|
-
async #
|
|
1208
|
-
if (!(!this.#
|
|
1209
|
-
this.#
|
|
1287
|
+
async #Yt() {
|
|
1288
|
+
if (!(!this.#S || this.#T || this.#D || this.#fe)) {
|
|
1289
|
+
this.#D = !0;
|
|
1210
1290
|
try {
|
|
1211
1291
|
let { FlipSound: e } = await import("./flipSound-BFXSkWBo.js");
|
|
1212
|
-
if (this.#
|
|
1213
|
-
this.#
|
|
1292
|
+
if (this.#fe) return;
|
|
1293
|
+
this.#w = new e(this.#C), this.#w.setMuted(this.#T);
|
|
1214
1294
|
} catch {}
|
|
1215
1295
|
}
|
|
1216
1296
|
}
|
|
1217
|
-
#
|
|
1218
|
-
this.#
|
|
1297
|
+
#Xt() {
|
|
1298
|
+
this.#w?.play();
|
|
1219
1299
|
}
|
|
1220
|
-
#
|
|
1221
|
-
this.#
|
|
1300
|
+
#Zt(e) {
|
|
1301
|
+
this.#He = e, this.#n.emit("progress", e), this.#Ve?.update(e);
|
|
1222
1302
|
}
|
|
1223
|
-
async #
|
|
1224
|
-
if (this.#
|
|
1303
|
+
async #Qt() {
|
|
1304
|
+
if (this.#Be === !1 || this.#fe) return;
|
|
1225
1305
|
let e = this.#e;
|
|
1226
1306
|
if (!(!e.ownerDocument || typeof e.appendChild != "function")) try {
|
|
1227
|
-
let { mountLoading: t } = await import("./loading-
|
|
1228
|
-
if (this.#
|
|
1229
|
-
this.#
|
|
1307
|
+
let { mountLoading: t } = await import("./loading-BgbqJz5k.js");
|
|
1308
|
+
if (this.#Ue === "done" || this.#fe) return;
|
|
1309
|
+
this.#Ve = t(e, this.#h), this.#He && this.#Ve.update(this.#He), this.#Ue === "preparing" && this.#Ve.preparing();
|
|
1230
1310
|
} catch {}
|
|
1231
1311
|
}
|
|
1232
|
-
|
|
1233
|
-
this.#
|
|
1312
|
+
#$t(e) {
|
|
1313
|
+
this.#Ue !== "done" && (this.#Ue = e, this.#Ve?.preparing());
|
|
1234
1314
|
}
|
|
1235
|
-
#
|
|
1236
|
-
this.#
|
|
1315
|
+
#en() {
|
|
1316
|
+
this.#Ue = "done", this.#Ve?.destroy(), this.#Ve = null;
|
|
1237
1317
|
}
|
|
1238
|
-
async #
|
|
1318
|
+
async #tn(e) {
|
|
1239
1319
|
try {
|
|
1240
1320
|
return await e.mount(this.#e), e.onFatal?.(() => {
|
|
1241
|
-
this.#
|
|
1321
|
+
this.#nn();
|
|
1242
1322
|
}), e;
|
|
1243
1323
|
} catch {
|
|
1244
1324
|
e.destroy();
|
|
1245
1325
|
let t = await O("css");
|
|
1246
|
-
return await t.mount(this.#e), this.#
|
|
1326
|
+
return await t.mount(this.#e), this.#de = !0, this.#n.emit("rendererFallback", {
|
|
1247
1327
|
from: "webgl2",
|
|
1248
1328
|
to: "css"
|
|
1249
1329
|
}), t;
|
|
1250
1330
|
}
|
|
1251
1331
|
}
|
|
1252
|
-
async #
|
|
1253
|
-
if (this.#
|
|
1254
|
-
this.#
|
|
1332
|
+
async #nn() {
|
|
1333
|
+
if (this.#de || this.#fe) return;
|
|
1334
|
+
this.#de = !0, this.#ue?.destroy(), this.#ue = null;
|
|
1255
1335
|
let e = await O("css");
|
|
1256
|
-
if (this.#
|
|
1336
|
+
if (this.#fe) {
|
|
1257
1337
|
e.destroy();
|
|
1258
1338
|
return;
|
|
1259
1339
|
}
|
|
1260
|
-
await e.mount(this.#e), this.#
|
|
1340
|
+
await e.mount(this.#e), this.#ue = e, this.#fn(e.measure().containerWidth), await this.#mn(), this.#n.emit("rendererFallback", {
|
|
1261
1341
|
from: "webgl2",
|
|
1262
1342
|
to: "css"
|
|
1263
1343
|
});
|
|
1264
1344
|
}
|
|
1265
|
-
#
|
|
1345
|
+
#rn() {
|
|
1266
1346
|
if (typeof matchMedia != "function") return;
|
|
1267
1347
|
let e = matchMedia("(prefers-reduced-motion: reduce)");
|
|
1268
|
-
this.#
|
|
1269
|
-
this.#
|
|
1348
|
+
this.#we = e.matches, e.addEventListener?.("change", (e) => {
|
|
1349
|
+
this.#we = e.matches;
|
|
1270
1350
|
});
|
|
1271
1351
|
}
|
|
1272
|
-
async
|
|
1273
|
-
let e = this.#
|
|
1274
|
-
if (!e && !t || this.#
|
|
1352
|
+
async #in() {
|
|
1353
|
+
let e = this.#Fe !== !1, t = this.#Le !== !1;
|
|
1354
|
+
if (!e && !t || this.#fe) return;
|
|
1275
1355
|
let n = this.#e;
|
|
1276
1356
|
if (!(!n.ownerDocument || typeof n.appendChild != "function")) try {
|
|
1277
|
-
let { mountControls: e, mountContextMenu: t } = await import("./controls-
|
|
1278
|
-
if (this.#
|
|
1279
|
-
if (this.#
|
|
1280
|
-
let t = this.#
|
|
1281
|
-
this.#
|
|
1357
|
+
let { mountControls: e, mountContextMenu: t } = await import("./controls-Dh1okIx6.js");
|
|
1358
|
+
if (this.#fe) return;
|
|
1359
|
+
if (this.#Fe !== !1) {
|
|
1360
|
+
let t = this.#Fe === !0 ? {} : this.#Fe;
|
|
1361
|
+
this.#Ie = e(this, n, t, this.#ze);
|
|
1282
1362
|
}
|
|
1283
|
-
if (this.#
|
|
1284
|
-
let e = this.#
|
|
1285
|
-
this.#
|
|
1363
|
+
if (this.#Le !== !1) {
|
|
1364
|
+
let e = this.#Le === !0 ? {} : this.#Le;
|
|
1365
|
+
this.#Re = t(this, n, e, this.#ze);
|
|
1286
1366
|
}
|
|
1287
1367
|
} catch {}
|
|
1288
1368
|
}
|
|
1289
|
-
#
|
|
1290
|
-
if (!this.#
|
|
1369
|
+
#an() {
|
|
1370
|
+
if (!this.#K || globalThis.location === void 0) return;
|
|
1291
1371
|
let e = globalThis;
|
|
1292
|
-
this.#
|
|
1293
|
-
e !== this.#
|
|
1294
|
-
}), this.#
|
|
1295
|
-
this.#
|
|
1372
|
+
this.#J = ee(e, (e) => {
|
|
1373
|
+
e !== this.#Q && this.flipTo(e);
|
|
1374
|
+
}), this.#J.push(this.#Q), this.#Y = this.#n.on("pageChanged", ({ page: e }) => {
|
|
1375
|
+
this.#J?.push(e);
|
|
1296
1376
|
});
|
|
1297
1377
|
}
|
|
1298
|
-
pageLink(e = this.#
|
|
1378
|
+
pageLink(e = this.#Q) {
|
|
1299
1379
|
let t = globalThis.location?.href ?? "";
|
|
1300
1380
|
if (!t) return "";
|
|
1301
1381
|
let n = new URL(t);
|
|
1302
1382
|
return n.hash = C(n.hash, X(e, 0, Math.max(0, this.#t.pageCount - 1))), n.toString();
|
|
1303
1383
|
}
|
|
1304
|
-
#
|
|
1384
|
+
#on() {
|
|
1305
1385
|
let e = this.#e, t = e.ownerDocument;
|
|
1306
1386
|
if (!t || typeof e.setAttribute != "function") return null;
|
|
1307
|
-
e.hasAttribute("tabindex") || (e.tabIndex = 0), e.setAttribute("aria-roledescription",
|
|
1308
|
-
let n = (e) => this.#
|
|
1387
|
+
e.hasAttribute("tabindex") || (e.tabIndex = 0), e.setAttribute("aria-roledescription", this.#h.roledescription);
|
|
1388
|
+
let n = (e) => this.#sn(e);
|
|
1309
1389
|
e.addEventListener("keydown", n);
|
|
1310
1390
|
let r = t.createElement("div");
|
|
1311
|
-
return r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r.style.cssText = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;", e.appendChild(r), this.#
|
|
1312
|
-
e.removeEventListener("keydown", n), r.remove(), this.#
|
|
1391
|
+
return r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r.style.cssText = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;", e.appendChild(r), this.#Te = r, () => {
|
|
1392
|
+
e.removeEventListener("keydown", n), r.remove(), this.#Te = null;
|
|
1313
1393
|
};
|
|
1314
1394
|
}
|
|
1315
|
-
#
|
|
1395
|
+
#sn(e) {
|
|
1316
1396
|
let t = this.#a === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
1317
1397
|
switch (e.key) {
|
|
1318
1398
|
case "ArrowRight":
|
|
@@ -1328,98 +1408,104 @@ var ce = class {
|
|
|
1328
1408
|
default: break;
|
|
1329
1409
|
}
|
|
1330
1410
|
}
|
|
1331
|
-
#
|
|
1332
|
-
this.#
|
|
1411
|
+
#cn() {
|
|
1412
|
+
this.#Te && (this.#Te.textContent = this.#h.pageAnnounce(this.#Q + 1, this.#t.pageCount));
|
|
1333
1413
|
}
|
|
1334
|
-
#
|
|
1335
|
-
return this.#
|
|
1414
|
+
#ln() {
|
|
1415
|
+
return this.#we ? V : this.#ee * (this.#B ? I : 1);
|
|
1336
1416
|
}
|
|
1337
|
-
#
|
|
1338
|
-
return this.#
|
|
1417
|
+
#un() {
|
|
1418
|
+
return this.#we ? "simple" : this.#c;
|
|
1339
1419
|
}
|
|
1340
1420
|
update() {
|
|
1341
|
-
!this.#
|
|
1421
|
+
!this.#ue || this.#i.state !== "idle" || (this.#fn(this.#ue.measure().containerWidth), this.#mn(), this.#St());
|
|
1342
1422
|
}
|
|
1343
|
-
#
|
|
1344
|
-
return this.#
|
|
1423
|
+
#dn() {
|
|
1424
|
+
return this.#H || this.#o === "single" ? "single" : this.#o;
|
|
1345
1425
|
}
|
|
1346
|
-
#
|
|
1347
|
-
let t = this.#
|
|
1348
|
-
t !== this.#
|
|
1426
|
+
#fn(e) {
|
|
1427
|
+
let t = this.#U && o(e, this.#z);
|
|
1428
|
+
t !== this.#H && (this.#H = t, this.#pn());
|
|
1349
1429
|
}
|
|
1350
|
-
#
|
|
1351
|
-
let e = this.#
|
|
1352
|
-
this.#
|
|
1430
|
+
#pn() {
|
|
1431
|
+
let e = this.#dn(), t = e !== this.#V;
|
|
1432
|
+
this.#V = e, this.#B = e === "single", this.#X = a(this.#t.pageCount, {
|
|
1353
1433
|
direction: this.#a,
|
|
1354
1434
|
mode: e
|
|
1355
|
-
}), this.#
|
|
1435
|
+
}), this.#Z = this.#kn(this.#Q), t && this.#n.emit("spreadChanged", {
|
|
1356
1436
|
mode: e,
|
|
1357
|
-
singlePage: this.#
|
|
1437
|
+
singlePage: this.#B
|
|
1358
1438
|
});
|
|
1359
1439
|
}
|
|
1360
|
-
async #
|
|
1361
|
-
let e = this.#
|
|
1362
|
-
!e || !this.#
|
|
1363
|
-
}
|
|
1364
|
-
#
|
|
1365
|
-
this.#
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1440
|
+
async #mn() {
|
|
1441
|
+
let e = this.#X[this.#Z];
|
|
1442
|
+
!e || !this.#ue || (this.#$ = await this.#Tn(e), this.#hn(e, this.#$));
|
|
1443
|
+
}
|
|
1444
|
+
#hn(e, t) {
|
|
1445
|
+
this.#ue?.renderSpread(e, t, {
|
|
1446
|
+
fill: this.#B,
|
|
1447
|
+
fit: this.#d
|
|
1448
|
+
}), this.#gn(), this.#We = 1, this.#vn();
|
|
1449
|
+
}
|
|
1450
|
+
#gn() {
|
|
1451
|
+
let e = this.#ue?.measure(), t = e?.containerAspect;
|
|
1452
|
+
if (t === void 0) {
|
|
1453
|
+
let n = e?.book;
|
|
1454
|
+
if (!n || n.width <= 0 || n.height <= 0) return;
|
|
1455
|
+
t = n.width / n.height;
|
|
1456
|
+
}
|
|
1457
|
+
t <= 0 || this.#W !== null && Math.abs(t - this.#W) < .005 || (this.#W = t, this.#e.style.aspectRatio = t.toFixed(4));
|
|
1372
1458
|
}
|
|
1373
|
-
#
|
|
1459
|
+
#_n(e) {
|
|
1374
1460
|
if (this.#i.state !== "idle") {
|
|
1375
|
-
this.#
|
|
1461
|
+
this.#Pe.add(e);
|
|
1376
1462
|
return;
|
|
1377
1463
|
}
|
|
1378
|
-
let t = this.#
|
|
1464
|
+
let t = this.#X[this.#Z];
|
|
1379
1465
|
if (!(!t || !(t.left === e || t.right === e))) {
|
|
1380
|
-
if (this.#
|
|
1381
|
-
this.#
|
|
1466
|
+
if (this.#se > 1) {
|
|
1467
|
+
this.#vn();
|
|
1382
1468
|
return;
|
|
1383
1469
|
}
|
|
1384
|
-
this.#
|
|
1470
|
+
this.#mn();
|
|
1385
1471
|
}
|
|
1386
1472
|
}
|
|
1387
|
-
#
|
|
1388
|
-
this.#
|
|
1389
|
-
let e = this.#
|
|
1390
|
-
if (e !== this.#
|
|
1473
|
+
#vn() {
|
|
1474
|
+
this.#Ke !== null && clearTimeout(this.#Ke);
|
|
1475
|
+
let e = this.#bn();
|
|
1476
|
+
if (e !== this.#We) {
|
|
1391
1477
|
if (e === 1) {
|
|
1392
|
-
this.#
|
|
1478
|
+
this.#Ge++, this.#We = 1, this.#mn();
|
|
1393
1479
|
return;
|
|
1394
1480
|
}
|
|
1395
|
-
this.#
|
|
1396
|
-
this.#
|
|
1397
|
-
},
|
|
1481
|
+
this.#Ke = setTimeout(() => {
|
|
1482
|
+
this.#Ke = null, this.#xn();
|
|
1483
|
+
}, R);
|
|
1398
1484
|
}
|
|
1399
1485
|
}
|
|
1400
|
-
#
|
|
1401
|
-
let e = this.#
|
|
1486
|
+
#yn() {
|
|
1487
|
+
let e = this.#ue?.measure(), t = e?.content ?? e?.book;
|
|
1402
1488
|
if (!t || t.width <= 0) return 1;
|
|
1403
|
-
let n = this
|
|
1489
|
+
let n = this.#$, r = +!!n.left + +!!n.right;
|
|
1404
1490
|
if (r === 0) return 1;
|
|
1405
1491
|
let i = t.width / r, a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = 0;
|
|
1406
1492
|
for (let e of [n.left, n.right]) {
|
|
1407
1493
|
if (!e || e.width <= 0) continue;
|
|
1408
|
-
let t = e.width / this.#
|
|
1494
|
+
let t = e.width / this.#We;
|
|
1409
1495
|
o = Math.max(o, i * a / t);
|
|
1410
1496
|
}
|
|
1411
1497
|
return o === 0 ? 1 : o;
|
|
1412
1498
|
}
|
|
1413
|
-
#
|
|
1414
|
-
let e = Math.max(1,
|
|
1415
|
-
return n <= 1.001 ? 1 : Math.min(Math.ceil(n * 2) / 2,
|
|
1499
|
+
#bn() {
|
|
1500
|
+
let e = Math.max(1, B / (typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1)), t = this.#se <= 1 ? 1 : this.#se, n = this.#yn() * Math.max(t, e);
|
|
1501
|
+
return n <= 1.001 ? 1 : Math.min(Math.ceil(n * 2) / 2, z);
|
|
1416
1502
|
}
|
|
1417
|
-
async #
|
|
1418
|
-
let e = this.#
|
|
1419
|
-
if (!this.#
|
|
1420
|
-
let t = this.#
|
|
1421
|
-
if (t === 1 || t === this.#
|
|
1422
|
-
let n = ++this.#
|
|
1503
|
+
async #xn() {
|
|
1504
|
+
let e = this.#X[this.#Z];
|
|
1505
|
+
if (!this.#ue || !e) return;
|
|
1506
|
+
let t = this.#bn();
|
|
1507
|
+
if (t === 1 || t === this.#We || this.#i.state !== "idle") return;
|
|
1508
|
+
let n = ++this.#Ge, r = {
|
|
1423
1509
|
x: 0,
|
|
1424
1510
|
y: 0,
|
|
1425
1511
|
width: 1,
|
|
@@ -1430,7 +1516,7 @@ var ce = class {
|
|
|
1430
1516
|
return await this.#t.get(e, {
|
|
1431
1517
|
scale: t,
|
|
1432
1518
|
region: r,
|
|
1433
|
-
maxSize: this.#
|
|
1519
|
+
maxSize: this.#ue?.maxTextureSize
|
|
1434
1520
|
});
|
|
1435
1521
|
} catch (t) {
|
|
1436
1522
|
return this.#n.emit("sourceError", {
|
|
@@ -1439,34 +1525,56 @@ var ce = class {
|
|
|
1439
1525
|
}), null;
|
|
1440
1526
|
}
|
|
1441
1527
|
}));
|
|
1442
|
-
if (n !== this.#
|
|
1443
|
-
let a = i[0] ?? this
|
|
1444
|
-
a === this
|
|
1528
|
+
if (n !== this.#Ge || this.#bn() !== t || this.#i.state !== "idle") return;
|
|
1529
|
+
let a = i[0] ?? this.#$.left, o = i[1] ?? this.#$.right;
|
|
1530
|
+
a === this.#$.left && o === this.#$.right || (this.#We = t, this.#$ = {
|
|
1445
1531
|
left: a,
|
|
1446
1532
|
right: o
|
|
1447
|
-
}, this.#
|
|
1533
|
+
}, this.#ue.renderSpread(e, this.#$, {
|
|
1534
|
+
fill: this.#B,
|
|
1535
|
+
fit: this.#d
|
|
1536
|
+
}));
|
|
1448
1537
|
}
|
|
1449
|
-
#
|
|
1450
|
-
if (this.#
|
|
1451
|
-
let e = this.#
|
|
1452
|
-
this.#
|
|
1538
|
+
#Sn() {
|
|
1539
|
+
if (this.#Pe.size === 0) return;
|
|
1540
|
+
let e = this.#X[this.#Z], t = e !== void 0 && [e.left, e.right].some((e) => e !== null && this.#Pe.has(e));
|
|
1541
|
+
this.#Pe.clear(), t && (this.#se > 1 ? this.#vn() : this.#mn());
|
|
1453
1542
|
}
|
|
1454
|
-
#
|
|
1455
|
-
typeof ResizeObserver > "u" || (this.#
|
|
1543
|
+
#Cn() {
|
|
1544
|
+
typeof ResizeObserver > "u" || (this.#ae = new ResizeObserver(() => this.#wn()), this.#ae.observe(this.#e));
|
|
1456
1545
|
}
|
|
1457
|
-
#
|
|
1458
|
-
this.#
|
|
1459
|
-
this.#
|
|
1546
|
+
#wn() {
|
|
1547
|
+
this.#oe || (this.#oe = !0, requestAnimationFrame(() => {
|
|
1548
|
+
this.#oe = !1, this.update();
|
|
1460
1549
|
}));
|
|
1461
1550
|
}
|
|
1462
|
-
async #
|
|
1463
|
-
let [t, n] = await Promise.all([this.#
|
|
1464
|
-
return {
|
|
1551
|
+
async #Tn(e) {
|
|
1552
|
+
let [t, n] = await Promise.all([this.#Dn(e.left), this.#Dn(e.right)]), r = await this.#En(e, t, n);
|
|
1553
|
+
return r > 0 ? {
|
|
1554
|
+
left: t,
|
|
1555
|
+
right: n,
|
|
1556
|
+
spineTrim: r
|
|
1557
|
+
} : {
|
|
1465
1558
|
left: t,
|
|
1466
1559
|
right: n
|
|
1467
1560
|
};
|
|
1468
1561
|
}
|
|
1469
|
-
async #
|
|
1562
|
+
async #En(e, t, n) {
|
|
1563
|
+
let r = this.#f;
|
|
1564
|
+
if (r === 0 || t === null || n === null) return 0;
|
|
1565
|
+
if (r !== "auto") return r / 2;
|
|
1566
|
+
let i = `${e.left}:${e.right}`, a = this.#m.get(i);
|
|
1567
|
+
if (t.width !== n.width || t.height !== n.height) return (a?.overlap ?? 0) / 2;
|
|
1568
|
+
if (a !== void 0 && a.width >= t.width) return a.overlap / 2;
|
|
1569
|
+
let o = await this.#p;
|
|
1570
|
+
if (!o) return 0;
|
|
1571
|
+
let s = o(t, n);
|
|
1572
|
+
return this.#m.set(i, {
|
|
1573
|
+
overlap: s,
|
|
1574
|
+
width: t.width
|
|
1575
|
+
}), s / 2;
|
|
1576
|
+
}
|
|
1577
|
+
async #Dn(e) {
|
|
1470
1578
|
if (e === null) return null;
|
|
1471
1579
|
try {
|
|
1472
1580
|
return await this.#t.get(e);
|
|
@@ -1477,30 +1585,30 @@ var ce = class {
|
|
|
1477
1585
|
}), null;
|
|
1478
1586
|
}
|
|
1479
1587
|
}
|
|
1480
|
-
#
|
|
1481
|
-
let { toMount: e } = this.#r.update(this.#
|
|
1588
|
+
#On() {
|
|
1589
|
+
let { toMount: e } = this.#r.update(this.#Z, this.#X.length), t = [];
|
|
1482
1590
|
for (let n of e) {
|
|
1483
|
-
let e = this.#
|
|
1591
|
+
let e = this.#X[n];
|
|
1484
1592
|
e?.left != null && t.push(e.left), e?.right != null && t.push(e.right);
|
|
1485
1593
|
}
|
|
1486
1594
|
this.#t.prefetch(t);
|
|
1487
1595
|
}
|
|
1488
|
-
#
|
|
1489
|
-
let t = this.#
|
|
1596
|
+
#kn(e) {
|
|
1597
|
+
let t = this.#X.findIndex((t) => t.left === e || t.right === e);
|
|
1490
1598
|
return t === -1 ? 0 : t;
|
|
1491
1599
|
}
|
|
1492
|
-
#
|
|
1600
|
+
#An() {
|
|
1493
1601
|
let e = this.#t.pageCount;
|
|
1494
1602
|
if (!Number.isInteger(e) || e < 1) throw Error(`Zine: source has ${e} pages; a Source must have at least 1 page.`);
|
|
1495
|
-
let t = this.#
|
|
1603
|
+
let t = this.#G;
|
|
1496
1604
|
if (t !== void 0 && (!Number.isInteger(t) || t < 0 || t >= e)) throw Error(`Zine: startPage ${JSON.stringify(t)} is out of range for a ${e}-page book (valid 0..${e - 1}).`);
|
|
1497
|
-
let n = this.#
|
|
1498
|
-
this.#
|
|
1605
|
+
let n = this.#dn();
|
|
1606
|
+
this.#B = n === "single", this.#X = a(e, {
|
|
1499
1607
|
direction: this.#a,
|
|
1500
1608
|
mode: n
|
|
1501
1609
|
});
|
|
1502
|
-
let r = this.#
|
|
1503
|
-
this.#
|
|
1610
|
+
let r = this.#K ? S(globalThis.location?.hash ?? "") : null;
|
|
1611
|
+
this.#Q = X(r ?? t ?? 0, 0, e - 1), this.#Z = this.#kn(this.#Q);
|
|
1504
1612
|
}
|
|
1505
1613
|
};
|
|
1506
1614
|
function X(e, t, n) {
|
|
@@ -1513,13 +1621,13 @@ function Z(e, t, n) {
|
|
|
1513
1621
|
}
|
|
1514
1622
|
return [n - (e + t), -e];
|
|
1515
1623
|
}
|
|
1516
|
-
function
|
|
1624
|
+
function de(e) {
|
|
1517
1625
|
return e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2;
|
|
1518
1626
|
}
|
|
1519
1627
|
function Q(e) {
|
|
1520
1628
|
return e === null ? "null" : Array.isArray(e) ? "array" : typeof e;
|
|
1521
1629
|
}
|
|
1522
|
-
function
|
|
1630
|
+
function fe(n, r) {
|
|
1523
1631
|
if (typeof n != "object" || !n || typeof n.appendChild != "function" || typeof n.addEventListener != "function") throw Error(`Zine: container must be a DOM element; received ${Q(n)}.`);
|
|
1524
1632
|
if (typeof r != "object" || !r) throw Error("Zine: an options object with a `source` is required.");
|
|
1525
1633
|
let i = r, a = i.source;
|
|
@@ -1534,12 +1642,18 @@ function ue(n, r) {
|
|
|
1534
1642
|
"half",
|
|
1535
1643
|
"off"
|
|
1536
1644
|
].includes(c)) throw Error(`Zine: clickToFlip must be 'edge', 'half', or 'off'; got ${JSON.stringify(c)}.`);
|
|
1537
|
-
let l = i.
|
|
1538
|
-
if (l !== void 0) {
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1645
|
+
let l = i.fit;
|
|
1646
|
+
if (l !== void 0 && l !== "contain" && l !== "fill") throw Error(`Zine: fit must be 'contain' or 'fill'; got ${JSON.stringify(l)}.`);
|
|
1647
|
+
let u = i.gutterOverlap;
|
|
1648
|
+
if (u !== void 0 && u !== "auto" && !(typeof u == "number" && u >= 0 && u <= .5)) throw Error(`Zine: gutterOverlap must be 'auto' or a number from 0 to 0.5 (a fraction of page width); got ${JSON.stringify(u)}.`);
|
|
1649
|
+
let d = i.strings;
|
|
1650
|
+
if (d !== void 0 && (typeof d != "object" || !d)) throw Error(`Zine: strings must be an object of text overrides; got ${Q(d)}.`);
|
|
1651
|
+
let f = i.curl;
|
|
1652
|
+
if (f !== void 0) {
|
|
1653
|
+
if (typeof f == "object" && f) {
|
|
1654
|
+
if (typeof f.deform != "function") throw Error("Zine: a curl model must have a deform() function.");
|
|
1655
|
+
} else if (e.includes(f)) throw Error(`Zine: the '${String(f)}' curl is not bundled. Import it and pass the model: import { ${String(f)} } from '@zinejs/core/curls' → curl: ${String(f)}`);
|
|
1656
|
+
else if (!t.includes(f)) throw Error(`Zine: curl must be ${t.join(" or ")}, or a model imported from '@zinejs/core/curls' (${e.join(", ")}); got ${JSON.stringify(f)}.`);
|
|
1543
1657
|
}
|
|
1544
1658
|
for (let e of [
|
|
1545
1659
|
"deepLink",
|
|
@@ -1547,62 +1661,62 @@ function ue(n, r) {
|
|
|
1547
1661
|
"responsiveSpread",
|
|
1548
1662
|
"loading"
|
|
1549
1663
|
]) if (i[e] !== void 0 && typeof i[e] != "boolean") throw Error(`Zine: ${e} must be a boolean; got ${Q(i[e])}.`);
|
|
1550
|
-
let
|
|
1551
|
-
if (
|
|
1552
|
-
let
|
|
1553
|
-
if (
|
|
1664
|
+
let p = i.controls;
|
|
1665
|
+
if (p !== void 0 && typeof p != "boolean" && (typeof p != "object" || !p)) throw Error(`Zine: controls must be a boolean or an options object; got ${Q(p)}.`);
|
|
1666
|
+
let m = p?.position;
|
|
1667
|
+
if (m !== void 0 && ![
|
|
1554
1668
|
"top",
|
|
1555
1669
|
"bottom",
|
|
1556
1670
|
"left",
|
|
1557
1671
|
"right"
|
|
1558
|
-
].includes(
|
|
1559
|
-
let
|
|
1560
|
-
if (
|
|
1672
|
+
].includes(m)) throw Error(`Zine: controls.position must be 'top', 'bottom', 'left', or 'right'; got ${JSON.stringify(m)}.`);
|
|
1673
|
+
let h = p?.colorScheme;
|
|
1674
|
+
if (h !== void 0 && ![
|
|
1561
1675
|
"light",
|
|
1562
1676
|
"dark",
|
|
1563
1677
|
"auto"
|
|
1564
|
-
].includes(
|
|
1565
|
-
let
|
|
1566
|
-
if (
|
|
1567
|
-
let
|
|
1568
|
-
if (
|
|
1569
|
-
let
|
|
1570
|
-
if (
|
|
1678
|
+
].includes(h)) throw Error(`Zine: controls.colorScheme must be 'light', 'dark', or 'auto'; got ${JSON.stringify(h)}.`);
|
|
1679
|
+
let g = p?.arrows;
|
|
1680
|
+
if (g !== void 0 && typeof g != "boolean" && !["desktop", "mobile"].includes(g)) throw Error(`Zine: controls.arrows must be a boolean, 'desktop', or 'mobile'; got ${JSON.stringify(g)}.`);
|
|
1681
|
+
let _ = i.contextMenu;
|
|
1682
|
+
if (_ !== void 0 && typeof _ != "boolean" && (typeof _ != "object" || !_)) throw Error(`Zine: contextMenu must be a boolean or an options object; got ${Q(_)}.`);
|
|
1683
|
+
let v = _?.colorScheme;
|
|
1684
|
+
if (v !== void 0 && ![
|
|
1571
1685
|
"light",
|
|
1572
1686
|
"dark",
|
|
1573
1687
|
"auto"
|
|
1574
|
-
].includes(
|
|
1575
|
-
if (i.disableContextMenu === !0 &&
|
|
1576
|
-
let
|
|
1577
|
-
if (
|
|
1578
|
-
let
|
|
1579
|
-
if (
|
|
1580
|
-
if (typeof
|
|
1581
|
-
let e =
|
|
1688
|
+
].includes(v)) throw Error(`Zine: contextMenu.colorScheme must be 'light', 'dark', or 'auto'; got ${JSON.stringify(v)}.`);
|
|
1689
|
+
if (i.disableContextMenu === !0 && _ !== void 0 && _ !== !1) throw Error("Zine: disableContextMenu and contextMenu are mutually exclusive — one removes the browser's right-click menu, the other replaces it. Enable only one.");
|
|
1690
|
+
let y = i.hideControls;
|
|
1691
|
+
if (y !== void 0 && (!Array.isArray(y) || y.some((e) => typeof e != "string"))) throw Error(`Zine: hideControls must be an array of control-id strings; got ${Q(y)}.`);
|
|
1692
|
+
let b = i.sound;
|
|
1693
|
+
if (b !== void 0 && typeof b != "boolean" && (typeof b != "object" || !b)) throw Error(`Zine: sound must be a boolean or an options object; got ${Q(b)}.`);
|
|
1694
|
+
if (typeof b == "object" && b) {
|
|
1695
|
+
let e = b;
|
|
1582
1696
|
if (e.url !== void 0 && typeof e.url != "string") throw Error(`Zine: sound.url must be a string URL; got ${Q(e.url)}.`);
|
|
1583
1697
|
if (e.volume !== void 0 && (typeof e.volume != "number" || e.volume < 0 || e.volume > 1)) throw Error(`Zine: sound.volume must be a number between 0 and 1; got ${JSON.stringify(e.volume)}.`);
|
|
1584
1698
|
if (e.muted !== void 0 && typeof e.muted != "boolean") throw Error(`Zine: sound.muted must be a boolean; got ${Q(e.muted)}.`);
|
|
1585
1699
|
if (e.persist !== void 0 && typeof e.persist != "boolean") throw Error(`Zine: sound.persist must be a boolean; got ${Q(e.persist)}.`);
|
|
1586
1700
|
}
|
|
1587
|
-
let
|
|
1588
|
-
if (
|
|
1701
|
+
let x = i.spreadMode;
|
|
1702
|
+
if (x !== void 0 && ![
|
|
1589
1703
|
"double",
|
|
1590
1704
|
"single",
|
|
1591
1705
|
"cover",
|
|
1592
1706
|
"book"
|
|
1593
|
-
].includes(
|
|
1707
|
+
].includes(x)) throw Error(`Zine: spreadMode must be 'double', 'single', 'cover', or 'book'; got ${JSON.stringify(x)}.`);
|
|
1594
1708
|
for (let e of ["frontCover", "backCover"]) {
|
|
1595
1709
|
let t = i[e];
|
|
1596
1710
|
if (t !== void 0 && typeof t != "string") throw Error(`Zine: ${e} must be an image URL string; got ${JSON.stringify(t)}.`);
|
|
1597
1711
|
}
|
|
1598
|
-
let
|
|
1599
|
-
if (
|
|
1600
|
-
$(i.width, "width", 1), $(i.height, "height", 1), $(i.flipDuration, "flipDuration", 0), $(i.clickZoneSize, "clickZoneSize", 0), $(i.clickFlipDelay, "clickFlipDelay", 0), $(i.singlePageThreshold, "singlePageThreshold", 0),
|
|
1712
|
+
let S = i.pages;
|
|
1713
|
+
if (S !== void 0 && (typeof S != "object" || !S || Array.isArray(S))) throw Error("Zine: pages must be an object mapping page indices to image URLs.");
|
|
1714
|
+
$(i.width, "width", 1), $(i.height, "height", 1), $(i.flipDuration, "flipDuration", 0), $(i.clickZoneSize, "clickZoneSize", 0), $(i.clickFlipDelay, "clickFlipDelay", 0), $(i.singlePageThreshold, "singlePageThreshold", 0), pe(i.zoom), me(i.renderer);
|
|
1601
1715
|
}
|
|
1602
1716
|
function $(e, t, n) {
|
|
1603
1717
|
if (e !== void 0 && (typeof e != "number" || !Number.isFinite(e) || e < n)) throw Error(`Zine: ${t} must be a number >= ${n}; got ${JSON.stringify(e)}.`);
|
|
1604
1718
|
}
|
|
1605
|
-
function
|
|
1719
|
+
function pe(e) {
|
|
1606
1720
|
if (e === void 0) return;
|
|
1607
1721
|
if (typeof e != "object" || !e || Array.isArray(e)) throw Error("Zine: zoom must be an object, e.g. { max: 4 }.");
|
|
1608
1722
|
let t = e;
|
|
@@ -1615,7 +1729,7 @@ function de(e) {
|
|
|
1615
1729
|
}
|
|
1616
1730
|
$(t.max, "zoom.max", 1);
|
|
1617
1731
|
}
|
|
1618
|
-
function
|
|
1732
|
+
function me(e) {
|
|
1619
1733
|
if (e !== void 0) {
|
|
1620
1734
|
if (typeof e == "string") {
|
|
1621
1735
|
if (e !== "auto" && e !== "css" && e !== "webgl2") throw Error(`Zine: renderer '${e}' is not recognized; use 'auto', 'css', 'webgl2', an array of those, or a custom Renderer.`);
|
|
@@ -1630,7 +1744,7 @@ function fe(e) {
|
|
|
1630
1744
|
}
|
|
1631
1745
|
//#endregion
|
|
1632
1746
|
//#region src/source/imageSource.ts
|
|
1633
|
-
var
|
|
1747
|
+
var he = class {
|
|
1634
1748
|
pageCount;
|
|
1635
1749
|
fit;
|
|
1636
1750
|
#e;
|
|
@@ -1667,6 +1781,6 @@ var pe = class {
|
|
|
1667
1781
|
}
|
|
1668
1782
|
};
|
|
1669
1783
|
//#endregion
|
|
1670
|
-
export { t as CURL_TYPES, i as DEFAULT_ITEMS, e as IMPORTABLE_CURLS,
|
|
1784
|
+
export { t as CURL_TYPES, i as DEFAULT_ITEMS, e as IMPORTABLE_CURLS, he as ImageSource, Y as Zine, k as defaultStrings, n as defineControl, r as getControl };
|
|
1671
1785
|
|
|
1672
1786
|
//# sourceMappingURL=index.js.map
|